kbuild-3608/0000775000175000017500000000000014670377500012717 5ustar locutuslocutuskbuild-3608/src/0000775000175000017500000000000014670377472013516 5ustar locutuslocutuskbuild-3608/src/grep/0000775000175000017500000000000014670377472014453 5ustar locutuslocutuskbuild-3608/src/grep/Makefile.am0000664000175000017500000000547014670377427016515 0ustar locutuslocutus# Process this file with automake to create Makefile.in # # Copyright 1997-1998, 2005-2021 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, 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 . # AUTOMAKE_OPTIONS = gnu 1.12 SUBDIRS = po lib doc src tests gnulib-tests EXTRA_DIST = \ .mailmap \ ChangeLog-2009 \ dist-check.mk \ README \ README-alpha \ THANKS.in \ TODO \ cfg.mk \ thanks-gen # Shortcut targets to make it easier to run expensive tests. .PHONY: check-expensive check-expensive: $(MAKE) check RUN_EXPENSIVE_TESTS=yes .PHONY: check-very-expensive check-very-expensive: check-expensive # Run syntax-check rules before creating a distribution tarball. .PHONY: run-syntax-check run-syntax-check: all $(AM_V_GEN)test ! -d .git || $(MAKE) syntax-check # Arrange so that .tarball-version appears only in the distribution # tarball, and never in a checked-out repository. dist-hook: gen-ChangeLog run-syntax-check $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version gen_start_date = 2009-11-27 .PHONY: gen-ChangeLog gen-ChangeLog: $(AM_V_GEN)if test -d .git; then \ log_fix="$(srcdir)/build-aux/git-log-fix"; \ test -e "$$log_fix" \ && amend_git_log="--amend=$$log_fix" \ || amend_git_log=; \ $(top_srcdir)/build-aux/gitlog-to-changelog \ $$amend_git_log --since=$(gen_start_date) > $(distdir)/cl-t && \ { rm -f $(distdir)/ChangeLog && \ mv $(distdir)/cl-t $(distdir)/ChangeLog; } \ fi # Sort in traditional ASCII order, regardless of the current locale; # otherwise we may get into trouble with distinct strings that the # current locale considers to be equal. ASSORT = LC_ALL=C sort # Extract all lines up to the first one starting with "##". prologue = perl -ne '/^\#\#/ and exit; print' $(srcdir)/THANKS.in THANKS: THANKS.in Makefile.am .mailmap thanks-gen $(AM_V_GEN)rm -f $@-t $@; \ { \ $(prologue); echo; \ { perl -ne '/^$$/.../^$$/ and !/^$$/ and s/ +/\0/ and print' \ $(srcdir)/THANKS.in; \ git log --pretty=format:'%aN%x00%aE' \ | $(ASSORT) -u; \ } | $(srcdir)/thanks-gen \ | LC_ALL=en_US.UTF-8 sort -k1,1; \ echo; \ printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:; \ } > $@-t && chmod a-w $@-t && mv $@-t $@ kbuild-3608/src/grep/Makefile.in0000664000175000017500000024324514670377427016532 0ustar locutuslocutus# Makefile.in generated by automake 1.16d from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/__inline.m4 \ $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \ $(top_srcdir)/m4/arpa_inet_h.m4 \ $(top_srcdir)/m4/asm-underscore.m4 $(top_srcdir)/m4/assert.m4 \ $(top_srcdir)/m4/btowc.m4 $(top_srcdir)/m4/builtin-expect.m4 \ $(top_srcdir)/m4/c-stack.m4 $(top_srcdir)/m4/calloc.m4 \ $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/close.m4 \ $(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/ctype_h.m4 \ $(top_srcdir)/m4/cycle-check.m4 $(top_srcdir)/m4/d-ino.m4 \ $(top_srcdir)/m4/d-type.m4 $(top_srcdir)/m4/dirent_h.m4 \ $(top_srcdir)/m4/dirfd.m4 \ $(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup.m4 \ $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exponentd.m4 \ $(top_srcdir)/m4/extensions.m4 \ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopen.m4 $(top_srcdir)/m4/fdopendir.m4 \ $(top_srcdir)/m4/filenamecat.m4 $(top_srcdir)/m4/flexmember.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fnmatch.m4 \ $(top_srcdir)/m4/fnmatch_h.m4 $(top_srcdir)/m4/fopen.m4 \ $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/fpieee.m4 \ $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/fstat.m4 \ $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/ftruncate.m4 \ $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \ $(top_srcdir)/m4/getpagesize.m4 \ $(top_srcdir)/m4/getprogname.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/iconv_h.m4 \ $(top_srcdir)/m4/iconv_open.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_pton.m4 \ $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intl-thread-locale.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax_t.m4 \ $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes.m4 \ $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/ioctl.m4 \ $(top_srcdir)/m4/isatty.m4 $(top_srcdir)/m4/isblank.m4 \ $(top_srcdir)/m4/iswblank.m4 $(top_srcdir)/m4/iswctype.m4 \ $(top_srcdir)/m4/iswdigit.m4 $(top_srcdir)/m4/iswxdigit.m4 \ $(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \ $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/libsigsegv.m4 \ $(top_srcdir)/m4/libunistring-base.m4 \ $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/localcharset.m4 \ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \ $(top_srcdir)/m4/locale-tr.m4 $(top_srcdir)/m4/locale-zh.m4 \ $(top_srcdir)/m4/locale_h.m4 $(top_srcdir)/m4/localeconv.m4 \ $(top_srcdir)/m4/localename.m4 $(top_srcdir)/m4/lock.m4 \ $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/lstat.m4 \ $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/malloca.m4 \ $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/mbchar.m4 \ $(top_srcdir)/m4/mbiter.m4 $(top_srcdir)/m4/mbrlen.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \ $(top_srcdir)/m4/mbslen.m4 $(top_srcdir)/m4/mbsrtowcs.m4 \ $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbtowc.m4 \ $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/minmax.m4 \ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/musl.m4 $(top_srcdir)/m4/nanosleep.m4 \ $(top_srcdir)/m4/netinet_in_h.m4 \ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/obstack.m4 \ $(top_srcdir)/m4/off_t.m4 $(top_srcdir)/m4/open-cloexec.m4 \ $(top_srcdir)/m4/open-slash.m4 $(top_srcdir)/m4/open.m4 \ $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/opendir.m4 \ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/pcre.m4 \ $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/perror.m4 \ $(top_srcdir)/m4/pipe.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/pthread-thread.m4 \ $(top_srcdir)/m4/pthread_h.m4 \ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \ $(top_srcdir)/m4/pthread_sigmask.m4 $(top_srcdir)/m4/putenv.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/rawmemchr.m4 \ $(top_srcdir)/m4/read.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/reallocarray.m4 \ $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/safe-read.m4 \ $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/sched_h.m4 \ $(top_srcdir)/m4/select.m4 $(top_srcdir)/m4/setenv.m4 \ $(top_srcdir)/m4/setlocale.m4 \ $(top_srcdir)/m4/setlocale_null.m4 \ $(top_srcdir)/m4/sigaction.m4 $(top_srcdir)/m4/sigaltstack.m4 \ $(top_srcdir)/m4/signal_h.m4 \ $(top_srcdir)/m4/signalblocking.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/sleep.m4 \ $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/socketlib.m4 \ $(top_srcdir)/m4/sockets.m4 $(top_srcdir)/m4/socklen.m4 \ $(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stack-direction.m4 \ $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \ $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdarg.m4 \ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/stpcpy.m4 $(top_srcdir)/m4/strdup.m4 \ $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/strerror_r.m4 \ $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strnlen.m4 \ $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtoimax.m4 \ $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoull.m4 \ $(top_srcdir)/m4/strtoumax.m4 $(top_srcdir)/m4/symlink.m4 \ $(top_srcdir)/m4/sys_ioctl_h.m4 \ $(top_srcdir)/m4/sys_select_h.m4 \ $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/sys_uio_h.m4 \ $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/unistd-safer.m4 \ $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/version-etc.m4 \ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/warn-on-use.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_h.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcrtomb.m4 \ $(top_srcdir)/m4/wctob.m4 $(top_srcdir)/m4/wctomb.m4 \ $(top_srcdir)/m4/wctype_h.m4 $(top_srcdir)/m4/wcwidth.m4 \ $(top_srcdir)/m4/windows-stat-inodes.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/wmemchr.m4 \ $(top_srcdir)/m4/wmempcpy.m4 $(top_srcdir)/m4/xalloc.m4 \ $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrtol.m4 \ $(top_srcdir)/m4/year2038.m4 $(top_srcdir)/m4/zzgnulib.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.hin # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.hin \ $(top_srcdir)/build-aux/compile \ $(top_srcdir)/build-aux/config.guess \ $(top_srcdir)/build-aux/config.rpath \ $(top_srcdir)/build-aux/config.sub \ $(top_srcdir)/build-aux/install-sh \ $(top_srcdir)/build-aux/missing ABOUT-NLS AUTHORS COPYING \ ChangeLog INSTALL NEWS README THANKS TODO build-aux/ar-lib \ build-aux/compile build-aux/config.guess \ build-aux/config.rpath build-aux/config.sub build-aux/depcomp \ build-aux/install-sh build-aux/mdate-sh build-aux/missing \ build-aux/texinfo.tex DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz GZIP_ENV = --best DIST_TARGETS = dist-xz dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print pkglibexecdir = @pkglibexecdir@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ AR = @AR@ ARFLAGS = @ARFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ COLORIZE_SOURCE = @COLORIZE_SOURCE@ CONFIG_INCLUDE = @CONFIG_INCLUDE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ ENOLINK_VALUE = @ENOLINK_VALUE@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ FNMATCH_H = @FNMATCH_H@ GETOPT_CDEFS_H = @GETOPT_CDEFS_H@ GETOPT_H = @GETOPT_H@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@ GL_CXXFLAG_ALLOW_WARNINGS = @GL_CXXFLAG_ALLOW_WARNINGS@ GL_GNULIB_ACCEPT = @GL_GNULIB_ACCEPT@ GL_GNULIB_ACCEPT4 = @GL_GNULIB_ACCEPT4@ GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@ GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@ GL_GNULIB_ALPHASORT = @GL_GNULIB_ALPHASORT@ GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@ GL_GNULIB_BIND = @GL_GNULIB_BIND@ GL_GNULIB_BTOWC = @GL_GNULIB_BTOWC@ GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@ GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@ GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@ GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@ GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@ GL_GNULIB_CLOSEDIR = @GL_GNULIB_CLOSEDIR@ GL_GNULIB_CONNECT = @GL_GNULIB_CONNECT@ GL_GNULIB_COPY_FILE_RANGE = @GL_GNULIB_COPY_FILE_RANGE@ GL_GNULIB_CREAT = @GL_GNULIB_CREAT@ GL_GNULIB_CTIME = @GL_GNULIB_CTIME@ GL_GNULIB_DIRFD = @GL_GNULIB_DIRFD@ GL_GNULIB_DPRINTF = @GL_GNULIB_DPRINTF@ GL_GNULIB_DUP = @GL_GNULIB_DUP@ GL_GNULIB_DUP2 = @GL_GNULIB_DUP2@ GL_GNULIB_DUP3 = @GL_GNULIB_DUP3@ GL_GNULIB_DUPLOCALE = @GL_GNULIB_DUPLOCALE@ GL_GNULIB_ENVIRON = @GL_GNULIB_ENVIRON@ GL_GNULIB_EUIDACCESS = @GL_GNULIB_EUIDACCESS@ GL_GNULIB_EXECL = @GL_GNULIB_EXECL@ GL_GNULIB_EXECLE = @GL_GNULIB_EXECLE@ GL_GNULIB_EXECLP = @GL_GNULIB_EXECLP@ GL_GNULIB_EXECV = @GL_GNULIB_EXECV@ GL_GNULIB_EXECVE = @GL_GNULIB_EXECVE@ GL_GNULIB_EXECVP = @GL_GNULIB_EXECVP@ GL_GNULIB_EXECVPE = @GL_GNULIB_EXECVPE@ GL_GNULIB_EXPLICIT_BZERO = @GL_GNULIB_EXPLICIT_BZERO@ GL_GNULIB_FACCESSAT = @GL_GNULIB_FACCESSAT@ GL_GNULIB_FCHDIR = @GL_GNULIB_FCHDIR@ GL_GNULIB_FCHMODAT = @GL_GNULIB_FCHMODAT@ GL_GNULIB_FCHOWNAT = @GL_GNULIB_FCHOWNAT@ GL_GNULIB_FCLOSE = @GL_GNULIB_FCLOSE@ GL_GNULIB_FCNTL = @GL_GNULIB_FCNTL@ GL_GNULIB_FDATASYNC = @GL_GNULIB_FDATASYNC@ GL_GNULIB_FDOPEN = @GL_GNULIB_FDOPEN@ GL_GNULIB_FDOPENDIR = @GL_GNULIB_FDOPENDIR@ GL_GNULIB_FFLUSH = @GL_GNULIB_FFLUSH@ GL_GNULIB_FFSL = @GL_GNULIB_FFSL@ GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@ GL_GNULIB_FGETC = @GL_GNULIB_FGETC@ GL_GNULIB_FGETS = @GL_GNULIB_FGETS@ GL_GNULIB_FNMATCH = @GL_GNULIB_FNMATCH@ GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@ GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@ GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@ GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@ GL_GNULIB_FPUTC = @GL_GNULIB_FPUTC@ GL_GNULIB_FPUTS = @GL_GNULIB_FPUTS@ GL_GNULIB_FREAD = @GL_GNULIB_FREAD@ GL_GNULIB_FREE_POSIX = @GL_GNULIB_FREE_POSIX@ GL_GNULIB_FREOPEN = @GL_GNULIB_FREOPEN@ GL_GNULIB_FSCANF = @GL_GNULIB_FSCANF@ GL_GNULIB_FSEEK = @GL_GNULIB_FSEEK@ GL_GNULIB_FSEEKO = @GL_GNULIB_FSEEKO@ GL_GNULIB_FSTAT = @GL_GNULIB_FSTAT@ GL_GNULIB_FSTATAT = @GL_GNULIB_FSTATAT@ GL_GNULIB_FSYNC = @GL_GNULIB_FSYNC@ GL_GNULIB_FTELL = @GL_GNULIB_FTELL@ GL_GNULIB_FTELLO = @GL_GNULIB_FTELLO@ GL_GNULIB_FTRUNCATE = @GL_GNULIB_FTRUNCATE@ GL_GNULIB_FUTIMENS = @GL_GNULIB_FUTIMENS@ GL_GNULIB_FWRITE = @GL_GNULIB_FWRITE@ GL_GNULIB_GETC = @GL_GNULIB_GETC@ GL_GNULIB_GETCHAR = @GL_GNULIB_GETCHAR@ GL_GNULIB_GETCWD = @GL_GNULIB_GETCWD@ GL_GNULIB_GETDELIM = @GL_GNULIB_GETDELIM@ GL_GNULIB_GETDOMAINNAME = @GL_GNULIB_GETDOMAINNAME@ GL_GNULIB_GETDTABLESIZE = @GL_GNULIB_GETDTABLESIZE@ GL_GNULIB_GETENTROPY = @GL_GNULIB_GETENTROPY@ GL_GNULIB_GETGROUPS = @GL_GNULIB_GETGROUPS@ GL_GNULIB_GETHOSTNAME = @GL_GNULIB_GETHOSTNAME@ GL_GNULIB_GETLINE = @GL_GNULIB_GETLINE@ GL_GNULIB_GETLOADAVG = @GL_GNULIB_GETLOADAVG@ GL_GNULIB_GETLOGIN = @GL_GNULIB_GETLOGIN@ GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@ GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@ GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@ GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@ GL_GNULIB_GETPEERNAME = @GL_GNULIB_GETPEERNAME@ GL_GNULIB_GETSOCKNAME = @GL_GNULIB_GETSOCKNAME@ GL_GNULIB_GETSOCKOPT = @GL_GNULIB_GETSOCKOPT@ GL_GNULIB_GETSUBOPT = @GL_GNULIB_GETSUBOPT@ GL_GNULIB_GETTIMEOFDAY = @GL_GNULIB_GETTIMEOFDAY@ GL_GNULIB_GETUMASK = @GL_GNULIB_GETUMASK@ GL_GNULIB_GETUSERSHELL = @GL_GNULIB_GETUSERSHELL@ GL_GNULIB_GRANTPT = @GL_GNULIB_GRANTPT@ GL_GNULIB_GROUP_MEMBER = @GL_GNULIB_GROUP_MEMBER@ GL_GNULIB_ICONV = @GL_GNULIB_ICONV@ GL_GNULIB_IMAXABS = @GL_GNULIB_IMAXABS@ GL_GNULIB_IMAXDIV = @GL_GNULIB_IMAXDIV@ GL_GNULIB_INET_NTOP = @GL_GNULIB_INET_NTOP@ GL_GNULIB_INET_PTON = @GL_GNULIB_INET_PTON@ GL_GNULIB_IOCTL = @GL_GNULIB_IOCTL@ GL_GNULIB_ISATTY = @GL_GNULIB_ISATTY@ GL_GNULIB_ISBLANK = @GL_GNULIB_ISBLANK@ GL_GNULIB_ISWBLANK = @GL_GNULIB_ISWBLANK@ GL_GNULIB_ISWCTYPE = @GL_GNULIB_ISWCTYPE@ GL_GNULIB_ISWDIGIT = @GL_GNULIB_ISWDIGIT@ GL_GNULIB_ISWXDIGIT = @GL_GNULIB_ISWXDIGIT@ GL_GNULIB_LCHMOD = @GL_GNULIB_LCHMOD@ GL_GNULIB_LCHOWN = @GL_GNULIB_LCHOWN@ GL_GNULIB_LINK = @GL_GNULIB_LINK@ GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@ GL_GNULIB_LISTEN = @GL_GNULIB_LISTEN@ GL_GNULIB_LOCALECONV = @GL_GNULIB_LOCALECONV@ GL_GNULIB_LOCALENAME = @GL_GNULIB_LOCALENAME@ GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@ GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@ GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@ GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@ GL_GNULIB_MBRLEN = @GL_GNULIB_MBRLEN@ GL_GNULIB_MBRTOWC = @GL_GNULIB_MBRTOWC@ GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@ GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@ GL_GNULIB_MBSCHR = @GL_GNULIB_MBSCHR@ GL_GNULIB_MBSCSPN = @GL_GNULIB_MBSCSPN@ GL_GNULIB_MBSINIT = @GL_GNULIB_MBSINIT@ GL_GNULIB_MBSLEN = @GL_GNULIB_MBSLEN@ GL_GNULIB_MBSNCASECMP = @GL_GNULIB_MBSNCASECMP@ GL_GNULIB_MBSNLEN = @GL_GNULIB_MBSNLEN@ GL_GNULIB_MBSNRTOWCS = @GL_GNULIB_MBSNRTOWCS@ GL_GNULIB_MBSPBRK = @GL_GNULIB_MBSPBRK@ GL_GNULIB_MBSPCASECMP = @GL_GNULIB_MBSPCASECMP@ GL_GNULIB_MBSRCHR = @GL_GNULIB_MBSRCHR@ GL_GNULIB_MBSRTOWCS = @GL_GNULIB_MBSRTOWCS@ GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@ GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@ GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@ GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@ GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@ GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@ GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@ GL_GNULIB_MDA_CHMOD = @GL_GNULIB_MDA_CHMOD@ GL_GNULIB_MDA_CLOSE = @GL_GNULIB_MDA_CLOSE@ GL_GNULIB_MDA_CREAT = @GL_GNULIB_MDA_CREAT@ GL_GNULIB_MDA_DUP = @GL_GNULIB_MDA_DUP@ GL_GNULIB_MDA_DUP2 = @GL_GNULIB_MDA_DUP2@ GL_GNULIB_MDA_ECVT = @GL_GNULIB_MDA_ECVT@ GL_GNULIB_MDA_EXECL = @GL_GNULIB_MDA_EXECL@ GL_GNULIB_MDA_EXECLE = @GL_GNULIB_MDA_EXECLE@ GL_GNULIB_MDA_EXECLP = @GL_GNULIB_MDA_EXECLP@ GL_GNULIB_MDA_EXECV = @GL_GNULIB_MDA_EXECV@ GL_GNULIB_MDA_EXECVE = @GL_GNULIB_MDA_EXECVE@ GL_GNULIB_MDA_EXECVP = @GL_GNULIB_MDA_EXECVP@ GL_GNULIB_MDA_EXECVPE = @GL_GNULIB_MDA_EXECVPE@ GL_GNULIB_MDA_FCLOSEALL = @GL_GNULIB_MDA_FCLOSEALL@ GL_GNULIB_MDA_FCVT = @GL_GNULIB_MDA_FCVT@ GL_GNULIB_MDA_FDOPEN = @GL_GNULIB_MDA_FDOPEN@ GL_GNULIB_MDA_FILENO = @GL_GNULIB_MDA_FILENO@ GL_GNULIB_MDA_GCVT = @GL_GNULIB_MDA_GCVT@ GL_GNULIB_MDA_GETCWD = @GL_GNULIB_MDA_GETCWD@ GL_GNULIB_MDA_GETPID = @GL_GNULIB_MDA_GETPID@ GL_GNULIB_MDA_GETW = @GL_GNULIB_MDA_GETW@ GL_GNULIB_MDA_ISATTY = @GL_GNULIB_MDA_ISATTY@ GL_GNULIB_MDA_LSEEK = @GL_GNULIB_MDA_LSEEK@ GL_GNULIB_MDA_MEMCCPY = @GL_GNULIB_MDA_MEMCCPY@ GL_GNULIB_MDA_MKDIR = @GL_GNULIB_MDA_MKDIR@ GL_GNULIB_MDA_MKTEMP = @GL_GNULIB_MDA_MKTEMP@ GL_GNULIB_MDA_OPEN = @GL_GNULIB_MDA_OPEN@ GL_GNULIB_MDA_PUTENV = @GL_GNULIB_MDA_PUTENV@ GL_GNULIB_MDA_PUTW = @GL_GNULIB_MDA_PUTW@ GL_GNULIB_MDA_READ = @GL_GNULIB_MDA_READ@ GL_GNULIB_MDA_RMDIR = @GL_GNULIB_MDA_RMDIR@ GL_GNULIB_MDA_STRDUP = @GL_GNULIB_MDA_STRDUP@ GL_GNULIB_MDA_SWAB = @GL_GNULIB_MDA_SWAB@ GL_GNULIB_MDA_TEMPNAM = @GL_GNULIB_MDA_TEMPNAM@ GL_GNULIB_MDA_TZSET = @GL_GNULIB_MDA_TZSET@ GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@ GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@ GL_GNULIB_MDA_WCSDUP = @GL_GNULIB_MDA_WCSDUP@ GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@ GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@ GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@ GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@ GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@ GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@ GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@ GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@ GL_GNULIB_MKFIFO = @GL_GNULIB_MKFIFO@ GL_GNULIB_MKFIFOAT = @GL_GNULIB_MKFIFOAT@ GL_GNULIB_MKNOD = @GL_GNULIB_MKNOD@ GL_GNULIB_MKNODAT = @GL_GNULIB_MKNODAT@ GL_GNULIB_MKOSTEMP = @GL_GNULIB_MKOSTEMP@ GL_GNULIB_MKOSTEMPS = @GL_GNULIB_MKOSTEMPS@ GL_GNULIB_MKSTEMP = @GL_GNULIB_MKSTEMP@ GL_GNULIB_MKSTEMPS = @GL_GNULIB_MKSTEMPS@ GL_GNULIB_MKTIME = @GL_GNULIB_MKTIME@ GL_GNULIB_NANOSLEEP = @GL_GNULIB_NANOSLEEP@ GL_GNULIB_NL_LANGINFO = @GL_GNULIB_NL_LANGINFO@ GL_GNULIB_NONBLOCKING = @GL_GNULIB_NONBLOCKING@ GL_GNULIB_OBSTACK_PRINTF = @GL_GNULIB_OBSTACK_PRINTF@ GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@ GL_GNULIB_OPEN = @GL_GNULIB_OPEN@ GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@ GL_GNULIB_OPENDIR = @GL_GNULIB_OPENDIR@ GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@ GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@ GL_GNULIB_PERROR = @GL_GNULIB_PERROR@ GL_GNULIB_PIPE = @GL_GNULIB_PIPE@ GL_GNULIB_PIPE2 = @GL_GNULIB_PIPE2@ GL_GNULIB_POPEN = @GL_GNULIB_POPEN@ GL_GNULIB_POSIX_MEMALIGN = @GL_GNULIB_POSIX_MEMALIGN@ GL_GNULIB_POSIX_OPENPT = @GL_GNULIB_POSIX_OPENPT@ GL_GNULIB_PREAD = @GL_GNULIB_PREAD@ GL_GNULIB_PRINTF = @GL_GNULIB_PRINTF@ GL_GNULIB_PRINTF_POSIX = @GL_GNULIB_PRINTF_POSIX@ GL_GNULIB_PSELECT = @GL_GNULIB_PSELECT@ GL_GNULIB_PTHREAD_COND = @GL_GNULIB_PTHREAD_COND@ GL_GNULIB_PTHREAD_MUTEX = @GL_GNULIB_PTHREAD_MUTEX@ GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK = @GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK@ GL_GNULIB_PTHREAD_ONCE = @GL_GNULIB_PTHREAD_ONCE@ GL_GNULIB_PTHREAD_RWLOCK = @GL_GNULIB_PTHREAD_RWLOCK@ GL_GNULIB_PTHREAD_SIGMASK = @GL_GNULIB_PTHREAD_SIGMASK@ GL_GNULIB_PTHREAD_SPIN = @GL_GNULIB_PTHREAD_SPIN@ GL_GNULIB_PTHREAD_THREAD = @GL_GNULIB_PTHREAD_THREAD@ GL_GNULIB_PTHREAD_TSS = @GL_GNULIB_PTHREAD_TSS@ GL_GNULIB_PTSNAME = @GL_GNULIB_PTSNAME@ GL_GNULIB_PTSNAME_R = @GL_GNULIB_PTSNAME_R@ GL_GNULIB_PUTC = @GL_GNULIB_PUTC@ GL_GNULIB_PUTCHAR = @GL_GNULIB_PUTCHAR@ GL_GNULIB_PUTENV = @GL_GNULIB_PUTENV@ GL_GNULIB_PUTS = @GL_GNULIB_PUTS@ GL_GNULIB_PWRITE = @GL_GNULIB_PWRITE@ GL_GNULIB_QSORT_R = @GL_GNULIB_QSORT_R@ GL_GNULIB_RAISE = @GL_GNULIB_RAISE@ GL_GNULIB_RANDOM = @GL_GNULIB_RANDOM@ GL_GNULIB_RANDOM_R = @GL_GNULIB_RANDOM_R@ GL_GNULIB_RAWMEMCHR = @GL_GNULIB_RAWMEMCHR@ GL_GNULIB_READ = @GL_GNULIB_READ@ GL_GNULIB_READDIR = @GL_GNULIB_READDIR@ GL_GNULIB_READLINK = @GL_GNULIB_READLINK@ GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@ GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@ GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@ GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@ GL_GNULIB_RECV = @GL_GNULIB_RECV@ GL_GNULIB_RECVFROM = @GL_GNULIB_RECVFROM@ GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@ GL_GNULIB_RENAME = @GL_GNULIB_RENAME@ GL_GNULIB_RENAMEAT = @GL_GNULIB_RENAMEAT@ GL_GNULIB_REWINDDIR = @GL_GNULIB_REWINDDIR@ GL_GNULIB_RMDIR = @GL_GNULIB_RMDIR@ GL_GNULIB_RPMATCH = @GL_GNULIB_RPMATCH@ GL_GNULIB_SCANDIR = @GL_GNULIB_SCANDIR@ GL_GNULIB_SCANF = @GL_GNULIB_SCANF@ GL_GNULIB_SCHED_YIELD = @GL_GNULIB_SCHED_YIELD@ GL_GNULIB_SECURE_GETENV = @GL_GNULIB_SECURE_GETENV@ GL_GNULIB_SELECT = @GL_GNULIB_SELECT@ GL_GNULIB_SEND = @GL_GNULIB_SEND@ GL_GNULIB_SENDTO = @GL_GNULIB_SENDTO@ GL_GNULIB_SETENV = @GL_GNULIB_SETENV@ GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@ GL_GNULIB_SETLOCALE = @GL_GNULIB_SETLOCALE@ GL_GNULIB_SETLOCALE_NULL = @GL_GNULIB_SETLOCALE_NULL@ GL_GNULIB_SETSOCKOPT = @GL_GNULIB_SETSOCKOPT@ GL_GNULIB_SHUTDOWN = @GL_GNULIB_SHUTDOWN@ GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@ GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@ GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@ GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@ GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@ GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@ GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@ GL_GNULIB_SOCKET = @GL_GNULIB_SOCKET@ GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@ GL_GNULIB_STAT = @GL_GNULIB_STAT@ GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@ GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@ GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@ GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@ GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@ GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@ GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@ GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@ GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@ GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@ GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@ GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@ GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@ GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@ GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@ GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@ GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@ GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@ GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@ GL_GNULIB_STRTOLD = @GL_GNULIB_STRTOLD@ GL_GNULIB_STRTOLL = @GL_GNULIB_STRTOLL@ GL_GNULIB_STRTOUL = @GL_GNULIB_STRTOUL@ GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@ GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@ GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@ GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@ GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@ GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@ GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@ GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@ GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@ GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@ GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@ GL_GNULIB_TOWCTRANS = @GL_GNULIB_TOWCTRANS@ GL_GNULIB_TRUNCATE = @GL_GNULIB_TRUNCATE@ GL_GNULIB_TTYNAME_R = @GL_GNULIB_TTYNAME_R@ GL_GNULIB_TZSET = @GL_GNULIB_TZSET@ GL_GNULIB_UNISTD_H_GETOPT = @GL_GNULIB_UNISTD_H_GETOPT@ GL_GNULIB_UNISTD_H_NONBLOCKING = @GL_GNULIB_UNISTD_H_NONBLOCKING@ GL_GNULIB_UNISTD_H_SIGPIPE = @GL_GNULIB_UNISTD_H_SIGPIPE@ GL_GNULIB_UNLINK = @GL_GNULIB_UNLINK@ GL_GNULIB_UNLINKAT = @GL_GNULIB_UNLINKAT@ GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@ GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@ GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@ GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@ GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@ GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@ GL_GNULIB_VFPRINTF = @GL_GNULIB_VFPRINTF@ GL_GNULIB_VFPRINTF_POSIX = @GL_GNULIB_VFPRINTF_POSIX@ GL_GNULIB_VFSCANF = @GL_GNULIB_VFSCANF@ GL_GNULIB_VPRINTF = @GL_GNULIB_VPRINTF@ GL_GNULIB_VPRINTF_POSIX = @GL_GNULIB_VPRINTF_POSIX@ GL_GNULIB_VSCANF = @GL_GNULIB_VSCANF@ GL_GNULIB_VSNPRINTF = @GL_GNULIB_VSNPRINTF@ GL_GNULIB_VSPRINTF_POSIX = @GL_GNULIB_VSPRINTF_POSIX@ GL_GNULIB_WCPCPY = @GL_GNULIB_WCPCPY@ GL_GNULIB_WCPNCPY = @GL_GNULIB_WCPNCPY@ GL_GNULIB_WCRTOMB = @GL_GNULIB_WCRTOMB@ GL_GNULIB_WCSCASECMP = @GL_GNULIB_WCSCASECMP@ GL_GNULIB_WCSCAT = @GL_GNULIB_WCSCAT@ GL_GNULIB_WCSCHR = @GL_GNULIB_WCSCHR@ GL_GNULIB_WCSCMP = @GL_GNULIB_WCSCMP@ GL_GNULIB_WCSCOLL = @GL_GNULIB_WCSCOLL@ GL_GNULIB_WCSCPY = @GL_GNULIB_WCSCPY@ GL_GNULIB_WCSCSPN = @GL_GNULIB_WCSCSPN@ GL_GNULIB_WCSDUP = @GL_GNULIB_WCSDUP@ GL_GNULIB_WCSFTIME = @GL_GNULIB_WCSFTIME@ GL_GNULIB_WCSLEN = @GL_GNULIB_WCSLEN@ GL_GNULIB_WCSNCASECMP = @GL_GNULIB_WCSNCASECMP@ GL_GNULIB_WCSNCAT = @GL_GNULIB_WCSNCAT@ GL_GNULIB_WCSNCMP = @GL_GNULIB_WCSNCMP@ GL_GNULIB_WCSNCPY = @GL_GNULIB_WCSNCPY@ GL_GNULIB_WCSNLEN = @GL_GNULIB_WCSNLEN@ GL_GNULIB_WCSNRTOMBS = @GL_GNULIB_WCSNRTOMBS@ GL_GNULIB_WCSPBRK = @GL_GNULIB_WCSPBRK@ GL_GNULIB_WCSRCHR = @GL_GNULIB_WCSRCHR@ GL_GNULIB_WCSRTOMBS = @GL_GNULIB_WCSRTOMBS@ GL_GNULIB_WCSSPN = @GL_GNULIB_WCSSPN@ GL_GNULIB_WCSSTR = @GL_GNULIB_WCSSTR@ GL_GNULIB_WCSTOK = @GL_GNULIB_WCSTOK@ GL_GNULIB_WCSWIDTH = @GL_GNULIB_WCSWIDTH@ GL_GNULIB_WCSXFRM = @GL_GNULIB_WCSXFRM@ GL_GNULIB_WCTOB = @GL_GNULIB_WCTOB@ GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@ GL_GNULIB_WCTRANS = @GL_GNULIB_WCTRANS@ GL_GNULIB_WCTYPE = @GL_GNULIB_WCTYPE@ GL_GNULIB_WCWIDTH = @GL_GNULIB_WCWIDTH@ GL_GNULIB_WMEMCHR = @GL_GNULIB_WMEMCHR@ GL_GNULIB_WMEMCMP = @GL_GNULIB_WMEMCMP@ GL_GNULIB_WMEMCPY = @GL_GNULIB_WMEMCPY@ GL_GNULIB_WMEMMOVE = @GL_GNULIB_WMEMMOVE@ GL_GNULIB_WMEMPCPY = @GL_GNULIB_WMEMPCPY@ GL_GNULIB_WMEMSET = @GL_GNULIB_WMEMSET@ GL_GNULIB_WRITE = @GL_GNULIB_WRITE@ GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_TEST_WARN_CFLAGS = @GNULIB_TEST_WARN_CFLAGS@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ GREP = @GREP@ HAVE_ACCEPT4 = @HAVE_ACCEPT4@ HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@ HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@ HAVE_DECL_DIRFD = @HAVE_DECL_DIRFD@ HAVE_DECL_ECVT = @HAVE_DECL_ECVT@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXECVPE = @HAVE_DECL_EXECVPE@ HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ HAVE_DECL_FCLOSEALL = @HAVE_DECL_FCLOSEALL@ HAVE_DECL_FCVT = @HAVE_DECL_FCVT@ HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@ HAVE_DECL_FDOPENDIR = @HAVE_DECL_FDOPENDIR@ HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@ HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@ HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@ HAVE_DECL_GCVT = @HAVE_DECL_GCVT@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@ HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@ HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCSDUP = @HAVE_DECL_WCSDUP@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DIRENT_H = @HAVE_DIRENT_H@ HAVE_DPRINTF = @HAVE_DPRINTF@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_EXECVPE = @HAVE_EXECVPE@ HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHMODAT = @HAVE_FCHMODAT@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FCNTL = @HAVE_FCNTL@ HAVE_FDATASYNC = @HAVE_FDATASYNC@ HAVE_FDOPENDIR = @HAVE_FDOPENDIR@ HAVE_FEATURES_H = @HAVE_FEATURES_H@ HAVE_FFSL = @HAVE_FFSL@ HAVE_FFSLL = @HAVE_FFSLL@ HAVE_FNMATCH = @HAVE_FNMATCH@ HAVE_FNMATCH_H = @HAVE_FNMATCH_H@ HAVE_FREELOCALE = @HAVE_FREELOCALE@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FSTATAT = @HAVE_FSTATAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_FUTIMENS = @HAVE_FUTIMENS@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETENTROPY = @HAVE_GETENTROPY@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETPASS = @HAVE_GETPASS@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ HAVE_GETUMASK = @HAVE_GETUMASK@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISBLANK = @HAVE_ISBLANK@ HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LANGINFO_ALTMON = @HAVE_LANGINFO_ALTMON@ HAVE_LANGINFO_CODESET = @HAVE_LANGINFO_CODESET@ HAVE_LANGINFO_ERA = @HAVE_LANGINFO_ERA@ HAVE_LANGINFO_H = @HAVE_LANGINFO_H@ HAVE_LANGINFO_T_FMT_AMPM = @HAVE_LANGINFO_T_FMT_AMPM@ HAVE_LANGINFO_YESEXPR = @HAVE_LANGINFO_YESEXPR@ HAVE_LCHMOD = @HAVE_LCHMOD@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDIRAT = @HAVE_MKDIRAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ HAVE_MKFIFO = @HAVE_MKFIFO@ HAVE_MKFIFOAT = @HAVE_MKFIFOAT@ HAVE_MKNOD = @HAVE_MKNOD@ HAVE_MKNODAT = @HAVE_MKNODAT@ HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ HAVE_MKSTEMP = @HAVE_MKSTEMP@ HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@ HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@ HAVE_NEWLOCALE = @HAVE_NEWLOCALE@ HAVE_NL_LANGINFO = @HAVE_NL_LANGINFO@ HAVE_OPENAT = @HAVE_OPENAT@ HAVE_OPENDIR = @HAVE_OPENDIR@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PCLOSE = @HAVE_PCLOSE@ HAVE_PIPE = @HAVE_PIPE@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_POPEN = @HAVE_POPEN@ HAVE_POSIX_MEMALIGN = @HAVE_POSIX_MEMALIGN@ HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PSELECT = @HAVE_PSELECT@ HAVE_PTHREAD_ATTR_DESTROY = @HAVE_PTHREAD_ATTR_DESTROY@ HAVE_PTHREAD_ATTR_GETDETACHSTATE = @HAVE_PTHREAD_ATTR_GETDETACHSTATE@ HAVE_PTHREAD_ATTR_INIT = @HAVE_PTHREAD_ATTR_INIT@ HAVE_PTHREAD_ATTR_SETDETACHSTATE = @HAVE_PTHREAD_ATTR_SETDETACHSTATE@ HAVE_PTHREAD_CONDATTR_DESTROY = @HAVE_PTHREAD_CONDATTR_DESTROY@ HAVE_PTHREAD_CONDATTR_INIT = @HAVE_PTHREAD_CONDATTR_INIT@ HAVE_PTHREAD_COND_BROADCAST = @HAVE_PTHREAD_COND_BROADCAST@ HAVE_PTHREAD_COND_DESTROY = @HAVE_PTHREAD_COND_DESTROY@ HAVE_PTHREAD_COND_INIT = @HAVE_PTHREAD_COND_INIT@ HAVE_PTHREAD_COND_SIGNAL = @HAVE_PTHREAD_COND_SIGNAL@ HAVE_PTHREAD_COND_TIMEDWAIT = @HAVE_PTHREAD_COND_TIMEDWAIT@ HAVE_PTHREAD_COND_WAIT = @HAVE_PTHREAD_COND_WAIT@ HAVE_PTHREAD_CREATE = @HAVE_PTHREAD_CREATE@ HAVE_PTHREAD_CREATE_DETACHED = @HAVE_PTHREAD_CREATE_DETACHED@ HAVE_PTHREAD_DETACH = @HAVE_PTHREAD_DETACH@ HAVE_PTHREAD_EQUAL = @HAVE_PTHREAD_EQUAL@ HAVE_PTHREAD_EXIT = @HAVE_PTHREAD_EXIT@ HAVE_PTHREAD_GETSPECIFIC = @HAVE_PTHREAD_GETSPECIFIC@ HAVE_PTHREAD_H = @HAVE_PTHREAD_H@ HAVE_PTHREAD_JOIN = @HAVE_PTHREAD_JOIN@ HAVE_PTHREAD_KEY_CREATE = @HAVE_PTHREAD_KEY_CREATE@ HAVE_PTHREAD_KEY_DELETE = @HAVE_PTHREAD_KEY_DELETE@ HAVE_PTHREAD_MUTEXATTR_DESTROY = @HAVE_PTHREAD_MUTEXATTR_DESTROY@ HAVE_PTHREAD_MUTEXATTR_GETROBUST = @HAVE_PTHREAD_MUTEXATTR_GETROBUST@ HAVE_PTHREAD_MUTEXATTR_GETTYPE = @HAVE_PTHREAD_MUTEXATTR_GETTYPE@ HAVE_PTHREAD_MUTEXATTR_INIT = @HAVE_PTHREAD_MUTEXATTR_INIT@ HAVE_PTHREAD_MUTEXATTR_SETROBUST = @HAVE_PTHREAD_MUTEXATTR_SETROBUST@ HAVE_PTHREAD_MUTEXATTR_SETTYPE = @HAVE_PTHREAD_MUTEXATTR_SETTYPE@ HAVE_PTHREAD_MUTEX_DESTROY = @HAVE_PTHREAD_MUTEX_DESTROY@ HAVE_PTHREAD_MUTEX_INIT = @HAVE_PTHREAD_MUTEX_INIT@ HAVE_PTHREAD_MUTEX_LOCK = @HAVE_PTHREAD_MUTEX_LOCK@ HAVE_PTHREAD_MUTEX_RECURSIVE = @HAVE_PTHREAD_MUTEX_RECURSIVE@ HAVE_PTHREAD_MUTEX_ROBUST = @HAVE_PTHREAD_MUTEX_ROBUST@ HAVE_PTHREAD_MUTEX_TIMEDLOCK = @HAVE_PTHREAD_MUTEX_TIMEDLOCK@ HAVE_PTHREAD_MUTEX_TRYLOCK = @HAVE_PTHREAD_MUTEX_TRYLOCK@ HAVE_PTHREAD_MUTEX_UNLOCK = @HAVE_PTHREAD_MUTEX_UNLOCK@ HAVE_PTHREAD_ONCE = @HAVE_PTHREAD_ONCE@ HAVE_PTHREAD_PROCESS_SHARED = @HAVE_PTHREAD_PROCESS_SHARED@ HAVE_PTHREAD_RWLOCKATTR_DESTROY = @HAVE_PTHREAD_RWLOCKATTR_DESTROY@ HAVE_PTHREAD_RWLOCKATTR_INIT = @HAVE_PTHREAD_RWLOCKATTR_INIT@ HAVE_PTHREAD_RWLOCK_DESTROY = @HAVE_PTHREAD_RWLOCK_DESTROY@ HAVE_PTHREAD_RWLOCK_INIT = @HAVE_PTHREAD_RWLOCK_INIT@ HAVE_PTHREAD_RWLOCK_RDLOCK = @HAVE_PTHREAD_RWLOCK_RDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@ HAVE_PTHREAD_RWLOCK_TRYRDLOCK = @HAVE_PTHREAD_RWLOCK_TRYRDLOCK@ HAVE_PTHREAD_RWLOCK_TRYWRLOCK = @HAVE_PTHREAD_RWLOCK_TRYWRLOCK@ HAVE_PTHREAD_RWLOCK_UNLOCK = @HAVE_PTHREAD_RWLOCK_UNLOCK@ HAVE_PTHREAD_RWLOCK_WRLOCK = @HAVE_PTHREAD_RWLOCK_WRLOCK@ HAVE_PTHREAD_SELF = @HAVE_PTHREAD_SELF@ HAVE_PTHREAD_SETSPECIFIC = @HAVE_PTHREAD_SETSPECIFIC@ HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@ HAVE_PTHREAD_SPINLOCK_T = @HAVE_PTHREAD_SPINLOCK_T@ HAVE_PTHREAD_SPIN_DESTROY = @HAVE_PTHREAD_SPIN_DESTROY@ HAVE_PTHREAD_SPIN_INIT = @HAVE_PTHREAD_SPIN_INIT@ HAVE_PTHREAD_SPIN_LOCK = @HAVE_PTHREAD_SPIN_LOCK@ HAVE_PTHREAD_SPIN_TRYLOCK = @HAVE_PTHREAD_SPIN_TRYLOCK@ HAVE_PTHREAD_SPIN_UNLOCK = @HAVE_PTHREAD_SPIN_UNLOCK@ HAVE_PTHREAD_T = @HAVE_PTHREAD_T@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RAISE = @HAVE_RAISE@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READDIR = @HAVE_READDIR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RENAMEAT = @HAVE_RENAMEAT@ HAVE_REWINDDIR = @HAVE_REWINDDIR@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SA_FAMILY_T = @HAVE_SA_FAMILY_T@ HAVE_SCANDIR = @HAVE_SCANDIR@ HAVE_SCHED_H = @HAVE_SCHED_H@ HAVE_SCHED_YIELD = @HAVE_SCHED_YIELD@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ HAVE_SETSTATE = @HAVE_SETSTATE@ HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@ HAVE_SIGACTION = @HAVE_SIGACTION@ HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@ HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRTOL = @HAVE_STRTOL@ HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOUL = @HAVE_STRTOUL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRUCT_SCHED_PARAM = @HAVE_STRUCT_SCHED_PARAM@ HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@ HAVE_STRUCT_SOCKADDR_STORAGE = @HAVE_STRUCT_SOCKADDR_STORAGE@ HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = @HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_IOCTL_H = @HAVE_SYS_IOCTL_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@ HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_SYS_UIO_H = @HAVE_SYS_UIO_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@ HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_VDPRINTF = @HAVE_VDPRINTF@ HAVE_VISIBILITY = @HAVE_VISIBILITY@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCPCPY = @HAVE_WCPCPY@ HAVE_WCPNCPY = @HAVE_WCPNCPY@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ HAVE_WCSCASECMP = @HAVE_WCSCASECMP@ HAVE_WCSCAT = @HAVE_WCSCAT@ HAVE_WCSCHR = @HAVE_WCSCHR@ HAVE_WCSCMP = @HAVE_WCSCMP@ HAVE_WCSCOLL = @HAVE_WCSCOLL@ HAVE_WCSCPY = @HAVE_WCSCPY@ HAVE_WCSCSPN = @HAVE_WCSCSPN@ HAVE_WCSDUP = @HAVE_WCSDUP@ HAVE_WCSFTIME = @HAVE_WCSFTIME@ HAVE_WCSLEN = @HAVE_WCSLEN@ HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@ HAVE_WCSNCAT = @HAVE_WCSNCAT@ HAVE_WCSNCMP = @HAVE_WCSNCMP@ HAVE_WCSNCPY = @HAVE_WCSNCPY@ HAVE_WCSNLEN = @HAVE_WCSNLEN@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSPBRK = @HAVE_WCSPBRK@ HAVE_WCSRCHR = @HAVE_WCSRCHR@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCSSPN = @HAVE_WCSSPN@ HAVE_WCSSTR = @HAVE_WCSSTR@ HAVE_WCSTOK = @HAVE_WCSTOK@ HAVE_WCSWIDTH = @HAVE_WCSWIDTH@ HAVE_WCSXFRM = @HAVE_WCSXFRM@ HAVE_WCTRANS_T = @HAVE_WCTRANS_T@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WCTYPE_T = @HAVE_WCTYPE_T@ HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE_WMEMCHR = @HAVE_WMEMCHR@ HAVE_WMEMCMP = @HAVE_WMEMCMP@ HAVE_WMEMCPY = @HAVE_WMEMCPY@ HAVE_WMEMMOVE = @HAVE_WMEMMOVE@ HAVE_WMEMPCPY = @HAVE_WMEMPCPY@ HAVE_WMEMSET = @HAVE_WMEMSET@ HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@ HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HAVE__EXIT = @HAVE__EXIT@ HOST_CPU = @HOST_CPU@ HOST_CPU_C_ABI = @HOST_CPU_C_ABI@ ICONV_CONST = @ICONV_CONST@ ICONV_H = @ICONV_H@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INET_PTON_LIB = @INET_PTON_LIB@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBCSTACK = @LIBCSTACK@ LIBGREPUTILS_LIBDEPS = @LIBGREPUTILS_LIBDEPS@ LIBGREPUTILS_LTLIBDEPS = @LIBGREPUTILS_LTLIBDEPS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ LIBPMULTITHREAD = @LIBPMULTITHREAD@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBSIGSEGV = @LIBSIGSEGV@ LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@ LIBSOCKET = @LIBSOCKET@ LIBSTDTHREAD = @LIBSTDTHREAD@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ LIBTHREAD = @LIBTHREAD@ LIBUNISTRING_UNISTR_H = @LIBUNISTRING_UNISTR_H@ LIBUNISTRING_UNITYPES_H = @LIBUNISTRING_UNITYPES_H@ LIBUNISTRING_UNIWIDTH_H = @LIBUNISTRING_UNIWIDTH_H@ LIB_HARD_LOCALE = @LIB_HARD_LOCALE@ LIB_MBRTOWC = @LIB_MBRTOWC@ LIB_NANOSLEEP = @LIB_NANOSLEEP@ LIB_NL_LANGINFO = @LIB_NL_LANGINFO@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ LIB_SCHED_YIELD = @LIB_SCHED_YIELD@ LIB_SELECT = @LIB_SELECT@ LIB_SETLOCALE = @LIB_SETLOCALE@ LIB_SETLOCALE_NULL = @LIB_SETLOCALE_NULL@ LIMITS_H = @LIMITS_H@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALENAME_ENHANCE_LOCALE_FUNCS = @LOCALENAME_ENHANCE_LOCALE_FUNCS@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBCSTACK = @LTLIBCSTACK@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ LTLIBSIGSEGV = @LTLIBSIGSEGV@ LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ NETINET_IN_H = @NETINET_IN_H@ NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_CTYPE_H@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H = @NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@ NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@ NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H = @NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H@ NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H = @NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H@ NEXT_AS_FIRST_DIRECTIVE_SCHED_H = @NEXT_AS_FIRST_DIRECTIVE_SCHED_H@ NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@ NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_CTYPE_H = @NEXT_CTYPE_H@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_FNMATCH_H = @NEXT_FNMATCH_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ NEXT_LANGINFO_H = @NEXT_LANGINFO_H@ NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@ NEXT_PTHREAD_H = @NEXT_PTHREAD_H@ NEXT_SCHED_H = @NEXT_SCHED_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_IOCTL_H = @NEXT_SYS_IOCTL_H@ NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@ NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@ NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NEXT_WCHAR_H = @NEXT_WCHAR_H@ NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_LIBS = @PCRE_LIBS@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ PRAGMA_COLUMNS = @PRAGMA_COLUMNS@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ PRIPTR_PREFIX = @PRIPTR_PREFIX@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_ACCESS = @REPLACE_ACCESS@ REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@ REPLACE_BTOWC = @REPLACE_BTOWC@ REPLACE_CALLOC = @REPLACE_CALLOC@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@ REPLACE_CREAT = @REPLACE_CREAT@ REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ REPLACE_EXECL = @REPLACE_EXECL@ REPLACE_EXECLE = @REPLACE_EXECLE@ REPLACE_EXECLP = @REPLACE_EXECLP@ REPLACE_EXECV = @REPLACE_EXECV@ REPLACE_EXECVE = @REPLACE_EXECVE@ REPLACE_EXECVP = @REPLACE_EXECVP@ REPLACE_EXECVPE = @REPLACE_EXECVPE@ REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHMODAT = @REPLACE_FCHMODAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ REPLACE_FDOPEN = @REPLACE_FDOPEN@ REPLACE_FDOPENDIR = @REPLACE_FDOPENDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ REPLACE_FFSLL = @REPLACE_FFSLL@ REPLACE_FNMATCH = @REPLACE_FNMATCH@ REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ REPLACE_FPURGE = @REPLACE_FPURGE@ REPLACE_FREE = @REPLACE_FREE@ REPLACE_FREELOCALE = @REPLACE_FREELOCALE@ REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FSEEK = @REPLACE_FSEEK@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FSTAT = @REPLACE_FSTAT@ REPLACE_FSTATAT = @REPLACE_FSTATAT@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@ REPLACE_FUTIMENS = @REPLACE_FUTIMENS@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETDELIM = @REPLACE_GETDELIM@ REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ REPLACE_GETDTABLESIZE = @REPLACE_GETDTABLESIZE@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETLINE = @REPLACE_GETLINE@ REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETPASS = @REPLACE_GETPASS@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ REPLACE_GMTIME = @REPLACE_GMTIME@ REPLACE_ICONV = @REPLACE_ICONV@ REPLACE_ICONV_OPEN = @REPLACE_ICONV_OPEN@ REPLACE_ICONV_UTF = @REPLACE_ICONV_UTF@ REPLACE_INET_NTOP = @REPLACE_INET_NTOP@ REPLACE_INET_PTON = @REPLACE_INET_PTON@ REPLACE_INITSTATE = @REPLACE_INITSTATE@ REPLACE_IOCTL = @REPLACE_IOCTL@ REPLACE_ISATTY = @REPLACE_ISATTY@ REPLACE_ISWBLANK = @REPLACE_ISWBLANK@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_ISWDIGIT = @REPLACE_ISWDIGIT@ REPLACE_ISWXDIGIT = @REPLACE_ISWXDIGIT@ REPLACE_ITOLD = @REPLACE_ITOLD@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LOCALECONV = @REPLACE_LOCALECONV@ REPLACE_LOCALTIME = @REPLACE_LOCALTIME@ REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_LSTAT = @REPLACE_LSTAT@ REPLACE_MALLOC = @REPLACE_MALLOC@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ REPLACE_MBSINIT = @REPLACE_MBSINIT@ REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@ REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@ REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@ REPLACE_MBTOWC = @REPLACE_MBTOWC@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKDIR = @REPLACE_MKDIR@ REPLACE_MKFIFO = @REPLACE_MKFIFO@ REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@ REPLACE_MKNOD = @REPLACE_MKNOD@ REPLACE_MKNODAT = @REPLACE_MKNODAT@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_MKTIME = @REPLACE_MKTIME@ REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ REPLACE_NEWLOCALE = @REPLACE_NEWLOCALE@ REPLACE_NL_LANGINFO = @REPLACE_NL_LANGINFO@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ REPLACE_OPEN = @REPLACE_OPEN@ REPLACE_OPENAT = @REPLACE_OPENAT@ REPLACE_OPENDIR = @REPLACE_OPENDIR@ REPLACE_PERROR = @REPLACE_PERROR@ REPLACE_POPEN = @REPLACE_POPEN@ REPLACE_POSIX_MEMALIGN = @REPLACE_POSIX_MEMALIGN@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PRINTF = @REPLACE_PRINTF@ REPLACE_PSELECT = @REPLACE_PSELECT@ REPLACE_PTHREAD_ATTR_DESTROY = @REPLACE_PTHREAD_ATTR_DESTROY@ REPLACE_PTHREAD_ATTR_GETDETACHSTATE = @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@ REPLACE_PTHREAD_ATTR_INIT = @REPLACE_PTHREAD_ATTR_INIT@ REPLACE_PTHREAD_ATTR_SETDETACHSTATE = @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@ REPLACE_PTHREAD_CONDATTR_DESTROY = @REPLACE_PTHREAD_CONDATTR_DESTROY@ REPLACE_PTHREAD_CONDATTR_INIT = @REPLACE_PTHREAD_CONDATTR_INIT@ REPLACE_PTHREAD_COND_BROADCAST = @REPLACE_PTHREAD_COND_BROADCAST@ REPLACE_PTHREAD_COND_DESTROY = @REPLACE_PTHREAD_COND_DESTROY@ REPLACE_PTHREAD_COND_INIT = @REPLACE_PTHREAD_COND_INIT@ REPLACE_PTHREAD_COND_SIGNAL = @REPLACE_PTHREAD_COND_SIGNAL@ REPLACE_PTHREAD_COND_TIMEDWAIT = @REPLACE_PTHREAD_COND_TIMEDWAIT@ REPLACE_PTHREAD_COND_WAIT = @REPLACE_PTHREAD_COND_WAIT@ REPLACE_PTHREAD_CREATE = @REPLACE_PTHREAD_CREATE@ REPLACE_PTHREAD_DETACH = @REPLACE_PTHREAD_DETACH@ REPLACE_PTHREAD_EQUAL = @REPLACE_PTHREAD_EQUAL@ REPLACE_PTHREAD_EXIT = @REPLACE_PTHREAD_EXIT@ REPLACE_PTHREAD_GETSPECIFIC = @REPLACE_PTHREAD_GETSPECIFIC@ REPLACE_PTHREAD_JOIN = @REPLACE_PTHREAD_JOIN@ REPLACE_PTHREAD_KEY_CREATE = @REPLACE_PTHREAD_KEY_CREATE@ REPLACE_PTHREAD_KEY_DELETE = @REPLACE_PTHREAD_KEY_DELETE@ REPLACE_PTHREAD_MUTEXATTR_DESTROY = @REPLACE_PTHREAD_MUTEXATTR_DESTROY@ REPLACE_PTHREAD_MUTEXATTR_GETROBUST = @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@ REPLACE_PTHREAD_MUTEXATTR_GETTYPE = @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@ REPLACE_PTHREAD_MUTEXATTR_INIT = @REPLACE_PTHREAD_MUTEXATTR_INIT@ REPLACE_PTHREAD_MUTEXATTR_SETROBUST = @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@ REPLACE_PTHREAD_MUTEXATTR_SETTYPE = @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@ REPLACE_PTHREAD_MUTEX_DESTROY = @REPLACE_PTHREAD_MUTEX_DESTROY@ REPLACE_PTHREAD_MUTEX_INIT = @REPLACE_PTHREAD_MUTEX_INIT@ REPLACE_PTHREAD_MUTEX_LOCK = @REPLACE_PTHREAD_MUTEX_LOCK@ REPLACE_PTHREAD_MUTEX_TIMEDLOCK = @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@ REPLACE_PTHREAD_MUTEX_TRYLOCK = @REPLACE_PTHREAD_MUTEX_TRYLOCK@ REPLACE_PTHREAD_MUTEX_UNLOCK = @REPLACE_PTHREAD_MUTEX_UNLOCK@ REPLACE_PTHREAD_ONCE = @REPLACE_PTHREAD_ONCE@ REPLACE_PTHREAD_RWLOCKATTR_DESTROY = @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@ REPLACE_PTHREAD_RWLOCKATTR_INIT = @REPLACE_PTHREAD_RWLOCKATTR_INIT@ REPLACE_PTHREAD_RWLOCK_DESTROY = @REPLACE_PTHREAD_RWLOCK_DESTROY@ REPLACE_PTHREAD_RWLOCK_INIT = @REPLACE_PTHREAD_RWLOCK_INIT@ REPLACE_PTHREAD_RWLOCK_RDLOCK = @REPLACE_PTHREAD_RWLOCK_RDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@ REPLACE_PTHREAD_RWLOCK_TRYRDLOCK = @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@ REPLACE_PTHREAD_RWLOCK_TRYWRLOCK = @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@ REPLACE_PTHREAD_RWLOCK_UNLOCK = @REPLACE_PTHREAD_RWLOCK_UNLOCK@ REPLACE_PTHREAD_RWLOCK_WRLOCK = @REPLACE_PTHREAD_RWLOCK_WRLOCK@ REPLACE_PTHREAD_SELF = @REPLACE_PTHREAD_SELF@ REPLACE_PTHREAD_SETSPECIFIC = @REPLACE_PTHREAD_SETSPECIFIC@ REPLACE_PTHREAD_SIGMASK = @REPLACE_PTHREAD_SIGMASK@ REPLACE_PTHREAD_SPIN_DESTROY = @REPLACE_PTHREAD_SPIN_DESTROY@ REPLACE_PTHREAD_SPIN_INIT = @REPLACE_PTHREAD_SPIN_INIT@ REPLACE_PTHREAD_SPIN_LOCK = @REPLACE_PTHREAD_SPIN_LOCK@ REPLACE_PTHREAD_SPIN_TRYLOCK = @REPLACE_PTHREAD_SPIN_TRYLOCK@ REPLACE_PTHREAD_SPIN_UNLOCK = @REPLACE_PTHREAD_SPIN_UNLOCK@ REPLACE_PTSNAME = @REPLACE_PTSNAME@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RAISE = @REPLACE_RAISE@ REPLACE_RANDOM = @REPLACE_RANDOM@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SCHED_YIELD = @REPLACE_SCHED_YIELD@ REPLACE_SELECT = @REPLACE_SELECT@ REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SETLOCALE = @REPLACE_SETLOCALE@ REPLACE_SETSTATE = @REPLACE_SETSTATE@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ REPLACE_STAT = @REPLACE_STAT@ REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@ REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRTOL = @REPLACE_STRTOL@ REPLACE_STRTOLD = @REPLACE_STRTOLD@ REPLACE_STRTOLL = @REPLACE_STRTOLL@ REPLACE_STRTOUL = @REPLACE_STRTOUL@ REPLACE_STRTOULL = @REPLACE_STRTOULL@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TOWLOWER = @REPLACE_TOWLOWER@ REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_TZSET = @REPLACE_TZSET@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VDPRINTF = @REPLACE_VDPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ REPLACE_WCSTOK = @REPLACE_WCSTOK@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ REPLACE_WCTOMB = @REPLACE_WCTOMB@ REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIGSEGV_H = @SIGSEGV_H@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STDALIGN_H = @STDALIGN_H@ STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_IOCTL_H_HAVE_WINSOCK2_H = @SYS_IOCTL_H_HAVE_WINSOCK2_H@ SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@ UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WERROR_CFLAGS = @WERROR_CFLAGS@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@ WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_aux_dir = @abs_aux_dir@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # Process this file with automake to create Makefile.in # # Copyright 1997-1998, 2005-2021 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, 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 . # AUTOMAKE_OPTIONS = gnu 1.12 SUBDIRS = po lib doc src tests gnulib-tests EXTRA_DIST = \ .mailmap \ ChangeLog-2009 \ dist-check.mk \ README \ README-alpha \ THANKS.in \ TODO \ cfg.mk \ thanks-gen gen_start_date = 2009-11-27 # Sort in traditional ASCII order, regardless of the current locale; # otherwise we may get into trouble with distinct strings that the # current locale considers to be equal. ASSORT = LC_ALL=C sort # Extract all lines up to the first one starting with "##". prologue = perl -ne '/^\#\#/ and exit; print' $(srcdir)/THANKS.in all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.hin $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.hin: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ dist-zip dist-zstd distcheck distclean distclean-generic \ distclean-hdr distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # Shortcut targets to make it easier to run expensive tests. .PHONY: check-expensive check-expensive: $(MAKE) check RUN_EXPENSIVE_TESTS=yes .PHONY: check-very-expensive check-very-expensive: check-expensive # Run syntax-check rules before creating a distribution tarball. .PHONY: run-syntax-check run-syntax-check: all $(AM_V_GEN)test ! -d .git || $(MAKE) syntax-check # Arrange so that .tarball-version appears only in the distribution # tarball, and never in a checked-out repository. dist-hook: gen-ChangeLog run-syntax-check $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version .PHONY: gen-ChangeLog gen-ChangeLog: $(AM_V_GEN)if test -d .git; then \ log_fix="$(srcdir)/build-aux/git-log-fix"; \ test -e "$$log_fix" \ && amend_git_log="--amend=$$log_fix" \ || amend_git_log=; \ $(top_srcdir)/build-aux/gitlog-to-changelog \ $$amend_git_log --since=$(gen_start_date) > $(distdir)/cl-t && \ { rm -f $(distdir)/ChangeLog && \ mv $(distdir)/cl-t $(distdir)/ChangeLog; } \ fi THANKS: THANKS.in Makefile.am .mailmap thanks-gen $(AM_V_GEN)rm -f $@-t $@; \ { \ $(prologue); echo; \ { perl -ne '/^$$/.../^$$/ and !/^$$/ and s/ +/\0/ and print' \ $(srcdir)/THANKS.in; \ git log --pretty=format:'%aN%x00%aE' \ | $(ASSORT) -u; \ } | $(srcdir)/thanks-gen \ | LC_ALL=en_US.UTF-8 sort -k1,1; \ echo; \ printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:; \ } > $@-t && chmod a-w $@-t && mv $@-t $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: kbuild-3608/src/grep/lib/0000775000175000017500000000000014670377426015220 5ustar locutuslocutuskbuild-3608/src/grep/lib/rawmemchr.valgrind0000664000175000017500000000171414670377426020740 0ustar locutuslocutus# Suppress a valgrind message about use of uninitialized memory in rawmemchr(). # Copyright (C) 2008-2021 Free Software Foundation, Inc. # # 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. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # This use is OK because it provides only a speedup. { rawmemchr-value4 Memcheck:Value4 fun:rawmemchr } { rawmemchr-value8 Memcheck:Value8 fun:rawmemchr } kbuild-3608/src/grep/lib/unistd-safer.h0000664000175000017500000000203514670377426017775 0ustar locutuslocutus/* Invoke unistd-like functions, but avoid some glitches. Copyright (C) 2001, 2003, 2005, 2009-2021 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 . */ /* Written by Paul Eggert and Eric Blake. */ int dup_safer (int); int fd_safer (int); int pipe_safer (int[2]); #if GNULIB_FD_SAFER_FLAG int dup_safer_flag (int, int); int fd_safer_flag (int, int); #endif #if GNULIB_PIPE2_SAFER int pipe2_safer (int[2], int); #endif kbuild-3608/src/grep/lib/stat-time.c0000664000175000017500000000152014670377426017271 0ustar locutuslocutus/* stat-related time functions. Copyright (C) 2012-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE #include "stat-time.h" kbuild-3608/src/grep/lib/langinfo.in.h0000664000175000017500000001512414670377424017574 0ustar locutuslocutus/* Substitute for and wrapper around . Copyright (C) 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* * POSIX for platforms that lack it or have an incomplete one. * */ #ifndef _@GUARD_PREFIX@_LANGINFO_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_LANGINFO_H@ # @INCLUDE_NEXT@ @NEXT_LANGINFO_H@ #endif #ifndef _@GUARD_PREFIX@_LANGINFO_H #define _@GUARD_PREFIX@_LANGINFO_H #if !@HAVE_LANGINFO_H@ /* A platform that lacks . */ /* Assume that it also lacks and the nl_item type. */ # if !GNULIB_defined_nl_item typedef int nl_item; # define GNULIB_defined_nl_item 1 # endif /* nl_langinfo items of the LC_CTYPE category */ # define CODESET 10000 /* nl_langinfo items of the LC_NUMERIC category */ # define RADIXCHAR 10001 # define DECIMAL_POINT RADIXCHAR # define THOUSEP 10002 # define THOUSANDS_SEP THOUSEP # define GROUPING 10114 /* nl_langinfo items of the LC_TIME category */ # define D_T_FMT 10003 # define D_FMT 10004 # define T_FMT 10005 # define T_FMT_AMPM 10006 # define AM_STR 10007 # define PM_STR 10008 # define DAY_1 10009 # define DAY_2 (DAY_1 + 1) # define DAY_3 (DAY_1 + 2) # define DAY_4 (DAY_1 + 3) # define DAY_5 (DAY_1 + 4) # define DAY_6 (DAY_1 + 5) # define DAY_7 (DAY_1 + 6) # define ABDAY_1 10016 # define ABDAY_2 (ABDAY_1 + 1) # define ABDAY_3 (ABDAY_1 + 2) # define ABDAY_4 (ABDAY_1 + 3) # define ABDAY_5 (ABDAY_1 + 4) # define ABDAY_6 (ABDAY_1 + 5) # define ABDAY_7 (ABDAY_1 + 6) # define MON_1 10023 # define MON_2 (MON_1 + 1) # define MON_3 (MON_1 + 2) # define MON_4 (MON_1 + 3) # define MON_5 (MON_1 + 4) # define MON_6 (MON_1 + 5) # define MON_7 (MON_1 + 6) # define MON_8 (MON_1 + 7) # define MON_9 (MON_1 + 8) # define MON_10 (MON_1 + 9) # define MON_11 (MON_1 + 10) # define MON_12 (MON_1 + 11) # define ALTMON_1 10200 # define ALTMON_2 (ALTMON_1 + 1) # define ALTMON_3 (ALTMON_1 + 2) # define ALTMON_4 (ALTMON_1 + 3) # define ALTMON_5 (ALTMON_1 + 4) # define ALTMON_6 (ALTMON_1 + 5) # define ALTMON_7 (ALTMON_1 + 6) # define ALTMON_8 (ALTMON_1 + 7) # define ALTMON_9 (ALTMON_1 + 8) # define ALTMON_10 (ALTMON_1 + 9) # define ALTMON_11 (ALTMON_1 + 10) # define ALTMON_12 (ALTMON_1 + 11) # define ABMON_1 10035 # define ABMON_2 (ABMON_1 + 1) # define ABMON_3 (ABMON_1 + 2) # define ABMON_4 (ABMON_1 + 3) # define ABMON_5 (ABMON_1 + 4) # define ABMON_6 (ABMON_1 + 5) # define ABMON_7 (ABMON_1 + 6) # define ABMON_8 (ABMON_1 + 7) # define ABMON_9 (ABMON_1 + 8) # define ABMON_10 (ABMON_1 + 9) # define ABMON_11 (ABMON_1 + 10) # define ABMON_12 (ABMON_1 + 11) # define ERA 10047 # define ERA_D_FMT 10048 # define ERA_D_T_FMT 10049 # define ERA_T_FMT 10050 # define ALT_DIGITS 10051 /* nl_langinfo items of the LC_MONETARY category */ # define CRNCYSTR 10052 # define CURRENCY_SYMBOL CRNCYSTR # define INT_CURR_SYMBOL 10100 # define MON_DECIMAL_POINT 10101 # define MON_THOUSANDS_SEP 10102 # define MON_GROUPING 10103 # define POSITIVE_SIGN 10104 # define NEGATIVE_SIGN 10105 # define FRAC_DIGITS 10106 # define INT_FRAC_DIGITS 10107 # define P_CS_PRECEDES 10108 # define N_CS_PRECEDES 10109 # define P_SEP_BY_SPACE 10110 # define N_SEP_BY_SPACE 10111 # define P_SIGN_POSN 10112 # define N_SIGN_POSN 10113 /* nl_langinfo items of the LC_MESSAGES category */ # define YESEXPR 10053 # define NOEXPR 10054 #else /* A platform that has . */ # if !@HAVE_LANGINFO_CODESET@ # define CODESET 10000 # define GNULIB_defined_CODESET 1 # endif # if !@HAVE_LANGINFO_T_FMT_AMPM@ # define T_FMT_AMPM 10006 # define GNULIB_defined_T_FMT_AMPM 1 # endif # if !@HAVE_LANGINFO_ALTMON@ # define ALTMON_1 10200 # define ALTMON_2 (ALTMON_1 + 1) # define ALTMON_3 (ALTMON_1 + 2) # define ALTMON_4 (ALTMON_1 + 3) # define ALTMON_5 (ALTMON_1 + 4) # define ALTMON_6 (ALTMON_1 + 5) # define ALTMON_7 (ALTMON_1 + 6) # define ALTMON_8 (ALTMON_1 + 7) # define ALTMON_9 (ALTMON_1 + 8) # define ALTMON_10 (ALTMON_1 + 9) # define ALTMON_11 (ALTMON_1 + 10) # define ALTMON_12 (ALTMON_1 + 11) # define GNULIB_defined_ALTMON 1 # endif # if !@HAVE_LANGINFO_ERA@ # define ERA 10047 # define ERA_D_FMT 10048 # define ERA_D_T_FMT 10049 # define ERA_T_FMT 10050 # define ALT_DIGITS 10051 # define GNULIB_defined_ERA 1 # endif # if !@HAVE_LANGINFO_YESEXPR@ # define YESEXPR 10053 # define NOEXPR 10054 # define GNULIB_defined_YESEXPR 1 # endif #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Declare overridden functions. */ /* Return a piece of locale dependent information. Note: The difference between nl_langinfo (CODESET) and locale_charset () is that the latter normalizes the encoding names to GNU conventions. */ #if @GNULIB_NL_LANGINFO@ # if @REPLACE_NL_LANGINFO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef nl_langinfo # define nl_langinfo rpl_nl_langinfo # endif _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item)); _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item)); # else # if !@HAVE_NL_LANGINFO@ _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item)); # endif _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item)); # endif _GL_CXXALIASWARN (nl_langinfo); #elif defined GNULIB_POSIXCHECK # undef nl_langinfo # if HAVE_RAW_DECL_NL_LANGINFO _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - " "use gnulib module nl_langinfo for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_LANGINFO_H */ #endif /* _@GUARD_PREFIX@_LANGINFO_H */ kbuild-3608/src/grep/lib/obstack.h0000664000175000017500000005440014670377425017021 0ustar locutuslocutus/* obstack.h - object stack macros Copyright (C) 1988-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Summary: All the apparent functions defined here are macros. The idea is that you would use these pre-tested macros to solve a very specific set of problems, and they would run fast. Caution: no side-effects in arguments please!! They may be evaluated MANY times!! These macros operate a stack of objects. Each object starts life small, and may grow to maturity. (Consider building a word syllable by syllable.) An object can move while it is growing. Once it has been "finished" it never changes address again. So the "top of the stack" is typically an immature growing object, while the rest of the stack is of mature, fixed size and fixed address objects. These routines grab large chunks of memory, using a function you supply, called 'obstack_chunk_alloc'. On occasion, they free chunks, by calling 'obstack_chunk_free'. You must define them and declare them before using any obstack macros. Each independent stack is represented by a 'struct obstack'. Each of the obstack macros expects a pointer to such a structure as the first argument. One motivation for this package is the problem of growing char strings in symbol tables. Unless you are "fascist pig with a read-only mind" --Gosper's immortal quote from HAKMEM item 154, out of context--you would not like to put any arbitrary upper limit on the length of your symbols. In practice this often means you will build many short symbols and a few long symbols. At the time you are reading a symbol you don't know how long it is. One traditional method is to read a symbol into a buffer, realloc()ating the buffer every time you try to read a symbol that is longer than the buffer. This is beaut, but you still will want to copy the symbol from the buffer to a more permanent symbol-table entry say about half the time. With obstacks, you can work differently. Use one obstack for all symbol names. As you read a symbol, grow the name in the obstack gradually. When the name is complete, finalize it. Then, if the symbol exists already, free the newly read name. The way we do this is to take a large chunk, allocating memory from low addresses. When you want to build a symbol in the chunk you just add chars above the current "high water mark" in the chunk. When you have finished adding chars, because you got to the end of the symbol, you know how long the chars are, and you can create a new object. Mostly the chars will not burst over the highest address of the chunk, because you would typically expect a chunk to be (say) 100 times as long as an average object. In case that isn't clear, when we have enough chars to make up the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) so we just point to it where it lies. No moving of chars is needed and this is the second win: potentially long strings need never be explicitly shuffled. Once an object is formed, it does not change its address during its lifetime. When the chars burst over a chunk boundary, we allocate a larger chunk, and then copy the partly formed object from the end of the old chunk to the beginning of the new larger chunk. We then carry on accreting characters to the end of the object as we normally would. A special macro is provided to add a single char at a time to a growing object. This allows the use of register variables, which break the ordinary 'growth' macro. Summary: We allocate large chunks. We carve out one object at a time from the current chunk. Once carved, an object never moves. We are free to append data of any size to the currently growing object. Exactly one object is growing in an obstack at any one time. You can run one obstack per control block. You may have as many control blocks as you dare. Because of the way we do it, you can "unwind" an obstack back to a previous state. (You may remove objects much as you would with a stack.) */ /* Don't do the contents of this file more than once. */ #ifndef _OBSTACK_H #define _OBSTACK_H 1 #ifndef _OBSTACK_INTERFACE_VERSION # define _OBSTACK_INTERFACE_VERSION 2 #endif #include /* For size_t and ptrdiff_t. */ #include /* For __GNU_LIBRARY__, and memcpy. */ #if __STDC_VERSION__ < 199901L || defined __HP_cc # define __FLEXIBLE_ARRAY_MEMBER 1 #else # define __FLEXIBLE_ARRAY_MEMBER #endif #if _OBSTACK_INTERFACE_VERSION == 1 /* For binary compatibility with obstack version 1, which used "int" and "long" for these two types. */ # define _OBSTACK_SIZE_T unsigned int # define _CHUNK_SIZE_T unsigned long # define _OBSTACK_CAST(type, expr) ((type) (expr)) #else /* Version 2 with sane types, especially for 64-bit hosts. */ # define _OBSTACK_SIZE_T size_t # define _CHUNK_SIZE_T size_t # define _OBSTACK_CAST(type, expr) (expr) #endif /* If B is the base of an object addressed by P, return the result of aligning P to the next multiple of A + 1. B and P must be of type char *. A + 1 must be a power of 2. */ #define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A))) /* Similar to __BPTR_ALIGN (B, P, A), except optimize the common case where pointers can be converted to integers, aligned as integers, and converted back again. If ptrdiff_t is narrower than a pointer (e.g., the AS/400), play it safe and compute the alignment relative to B. Otherwise, use the faster strategy of computing the alignment relative to 0. */ #define __PTR_ALIGN(B, P, A) \ __BPTR_ALIGN (sizeof (ptrdiff_t) < sizeof (void *) ? (B) : (char *) 0, \ P, A) #ifndef __attribute_pure__ # define __attribute_pure__ _GL_ATTRIBUTE_PURE #endif /* Not the same as _Noreturn, since it also works with function pointers. */ #ifndef __attribute_noreturn__ # if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ || 0x5110 <= __SUNPRO_C # define __attribute_noreturn__ __attribute__ ((__noreturn__)) # else # define __attribute_noreturn__ # endif #endif #ifdef __cplusplus extern "C" { #endif struct _obstack_chunk /* Lives at front of each chunk. */ { char *limit; /* 1 past end of this chunk */ struct _obstack_chunk *prev; /* address of prior chunk or NULL */ char contents[__FLEXIBLE_ARRAY_MEMBER]; /* objects begin here */ }; struct obstack /* control current object in current chunk */ { _CHUNK_SIZE_T chunk_size; /* preferred size to allocate chunks in */ struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ char *object_base; /* address of object we are building */ char *next_free; /* where to add next char to current object */ char *chunk_limit; /* address of char after current chunk */ union { _OBSTACK_SIZE_T i; void *p; } temp; /* Temporary for some macros. */ _OBSTACK_SIZE_T alignment_mask; /* Mask of alignment for each object. */ /* These prototypes vary based on 'use_extra_arg'. */ union { void *(*plain) (size_t); void *(*extra) (void *, size_t); } chunkfun; union { void (*plain) (void *); void (*extra) (void *, void *); } freefun; void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ unsigned use_extra_arg : 1; /* chunk alloc/dealloc funcs take extra arg */ unsigned maybe_empty_object : 1; /* There is a possibility that the current chunk contains a zero-length object. This prevents freeing the chunk if we allocate a bigger chunk to replace it. */ unsigned alloc_failed : 1; /* No longer used, as we now call the failed handler on error, but retained for binary compatibility. */ }; /* Declare the external functions we use; they are in obstack.c. */ extern void _obstack_newchunk (struct obstack *, _OBSTACK_SIZE_T); extern void _obstack_free (struct obstack *, void *); extern int _obstack_begin (struct obstack *, _OBSTACK_SIZE_T, _OBSTACK_SIZE_T, void *(*) (size_t), void (*) (void *)); extern int _obstack_begin_1 (struct obstack *, _OBSTACK_SIZE_T, _OBSTACK_SIZE_T, void *(*) (void *, size_t), void (*) (void *, void *), void *); extern _OBSTACK_SIZE_T _obstack_memory_used (struct obstack *) __attribute_pure__; /* Error handler called when 'obstack_chunk_alloc' failed to allocate more memory. This can be set to a user defined function which should either abort gracefully or use longjump - but shouldn't return. The default action is to print a message and abort. */ extern __attribute_noreturn__ void (*obstack_alloc_failed_handler) (void); /* Exit value used when 'print_and_abort' is used. */ extern int obstack_exit_failure; /* Pointer to beginning of object being allocated or to be allocated next. Note that this might not be the final address of the object because a new chunk might be needed to hold the final size. */ #define obstack_base(h) ((void *) (h)->object_base) /* Size for allocating ordinary chunks. */ #define obstack_chunk_size(h) ((h)->chunk_size) /* Pointer to next byte not yet allocated in current chunk. */ #define obstack_next_free(h) ((void *) (h)->next_free) /* Mask specifying low bits that should be clear in address of an object. */ #define obstack_alignment_mask(h) ((h)->alignment_mask) /* To prevent prototype warnings provide complete argument list. */ #define obstack_init(h) \ _obstack_begin ((h), 0, 0, \ _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \ _OBSTACK_CAST (void (*) (void *), obstack_chunk_free)) #define obstack_begin(h, size) \ _obstack_begin ((h), (size), 0, \ _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \ _OBSTACK_CAST (void (*) (void *), obstack_chunk_free)) #define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ _obstack_begin ((h), (size), (alignment), \ _OBSTACK_CAST (void *(*) (size_t), chunkfun), \ _OBSTACK_CAST (void (*) (void *), freefun)) #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ _obstack_begin_1 ((h), (size), (alignment), \ _OBSTACK_CAST (void *(*) (void *, size_t), chunkfun), \ _OBSTACK_CAST (void (*) (void *, void *), freefun), arg) #define obstack_chunkfun(h, newchunkfun) \ ((void) ((h)->chunkfun.extra = (void *(*) (void *, size_t)) (newchunkfun))) #define obstack_freefun(h, newfreefun) \ ((void) ((h)->freefun.extra = (void *(*) (void *, void *)) (newfreefun))) #define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ = (achar))) #define obstack_blank_fast(h, n) ((void) ((h)->next_free += (n))) #define obstack_memory_used(h) _obstack_memory_used (h) #if defined __GNUC__ || defined __clang__ # if !(defined __GNUC_MINOR__ && __GNUC__ * 1000 + __GNUC_MINOR__ >= 2008 \ || defined __clang__) # define __extension__ # endif /* For GNU C, if not -traditional, we can define these macros to compute all args only once without using a global variable. Also, we can avoid using the 'temp' slot, to make faster code. */ # define obstack_object_size(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (_OBSTACK_SIZE_T) (__o->next_free - __o->object_base); }) /* The local variable is named __o1 to avoid a shadowed variable warning when invoked from other obstack macros. */ # define obstack_room(OBSTACK) \ __extension__ \ ({ struct obstack const *__o1 = (OBSTACK); \ (_OBSTACK_SIZE_T) (__o1->chunk_limit - __o1->next_free); }) # define obstack_make_room(OBSTACK, length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ _OBSTACK_SIZE_T __len = (length); \ if (obstack_room (__o) < __len) \ _obstack_newchunk (__o, __len); \ (void) 0; }) # define obstack_empty_p(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (__o->chunk->prev == 0 \ && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ __o->chunk->contents, \ __o->alignment_mask)); }) # define obstack_grow(OBSTACK, where, length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ _OBSTACK_SIZE_T __len = (length); \ if (obstack_room (__o) < __len) \ _obstack_newchunk (__o, __len); \ memcpy (__o->next_free, where, __len); \ __o->next_free += __len; \ (void) 0; }) # define obstack_grow0(OBSTACK, where, length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ _OBSTACK_SIZE_T __len = (length); \ if (obstack_room (__o) < __len + 1) \ _obstack_newchunk (__o, __len + 1); \ memcpy (__o->next_free, where, __len); \ __o->next_free += __len; \ *(__o->next_free)++ = 0; \ (void) 0; }) # define obstack_1grow(OBSTACK, datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (obstack_room (__o) < 1) \ _obstack_newchunk (__o, 1); \ obstack_1grow_fast (__o, datum); }) /* These assume that the obstack alignment is good enough for pointers or ints, and that the data added so far to the current object shares that much alignment. */ # define obstack_ptr_grow(OBSTACK, datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (obstack_room (__o) < sizeof (void *)) \ _obstack_newchunk (__o, sizeof (void *)); \ obstack_ptr_grow_fast (__o, datum); }) # define obstack_int_grow(OBSTACK, datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (obstack_room (__o) < sizeof (int)) \ _obstack_newchunk (__o, sizeof (int)); \ obstack_int_grow_fast (__o, datum); }) # define obstack_ptr_grow_fast(OBSTACK, aptr) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ void *__p1 = __o1->next_free; \ *(const void **) __p1 = (aptr); \ __o1->next_free += sizeof (const void *); \ (void) 0; }) # define obstack_int_grow_fast(OBSTACK, aint) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ void *__p1 = __o1->next_free; \ *(int *) __p1 = (aint); \ __o1->next_free += sizeof (int); \ (void) 0; }) # define obstack_blank(OBSTACK, length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ _OBSTACK_SIZE_T __len = (length); \ if (obstack_room (__o) < __len) \ _obstack_newchunk (__o, __len); \ obstack_blank_fast (__o, __len); }) # define obstack_alloc(OBSTACK, length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_blank (__h, (length)); \ obstack_finish (__h); }) # define obstack_copy(OBSTACK, where, length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_grow (__h, (where), (length)); \ obstack_finish (__h); }) # define obstack_copy0(OBSTACK, where, length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_grow0 (__h, (where), (length)); \ obstack_finish (__h); }) /* The local variable is named __o1 to avoid a shadowed variable warning when invoked from other obstack macros, typically obstack_free. */ # define obstack_finish(OBSTACK) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ void *__value = (void *) __o1->object_base; \ if (__o1->next_free == __value) \ __o1->maybe_empty_object = 1; \ __o1->next_free \ = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ __o1->alignment_mask); \ if ((size_t) (__o1->next_free - (char *) __o1->chunk) \ > (size_t) (__o1->chunk_limit - (char *) __o1->chunk)) \ __o1->next_free = __o1->chunk_limit; \ __o1->object_base = __o1->next_free; \ __value; }) # define obstack_free(OBSTACK, OBJ) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ void *__obj = (void *) (OBJ); \ if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) \ __o->next_free = __o->object_base = (char *) __obj; \ else \ _obstack_free (__o, __obj); }) #else /* not __GNUC__ */ # define obstack_object_size(h) \ ((_OBSTACK_SIZE_T) ((h)->next_free - (h)->object_base)) # define obstack_room(h) \ ((_OBSTACK_SIZE_T) ((h)->chunk_limit - (h)->next_free)) # define obstack_empty_p(h) \ ((h)->chunk->prev == 0 \ && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ (h)->chunk->contents, \ (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions in the arms of the conditional expression. Casting the third operand to void was tried before, but some compilers won't accept it. */ # define obstack_make_room(h, length) \ ((h)->temp.i = (length), \ ((obstack_room (h) < (h)->temp.i) \ ? (_obstack_newchunk (h, (h)->temp.i), 0) : 0), \ (void) 0) # define obstack_grow(h, where, length) \ ((h)->temp.i = (length), \ ((obstack_room (h) < (h)->temp.i) \ ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \ memcpy ((h)->next_free, where, (h)->temp.i), \ (h)->next_free += (h)->temp.i, \ (void) 0) # define obstack_grow0(h, where, length) \ ((h)->temp.i = (length), \ ((obstack_room (h) < (h)->temp.i + 1) \ ? (_obstack_newchunk ((h), (h)->temp.i + 1), 0) : 0), \ memcpy ((h)->next_free, where, (h)->temp.i), \ (h)->next_free += (h)->temp.i, \ *((h)->next_free)++ = 0, \ (void) 0) # define obstack_1grow(h, datum) \ (((obstack_room (h) < 1) \ ? (_obstack_newchunk ((h), 1), 0) : 0), \ obstack_1grow_fast (h, datum)) # define obstack_ptr_grow(h, datum) \ (((obstack_room (h) < sizeof (char *)) \ ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ obstack_ptr_grow_fast (h, datum)) # define obstack_int_grow(h, datum) \ (((obstack_room (h) < sizeof (int)) \ ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ obstack_int_grow_fast (h, datum)) # define obstack_ptr_grow_fast(h, aptr) \ (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr), \ (void) 0) # define obstack_int_grow_fast(h, aint) \ (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint), \ (void) 0) # define obstack_blank(h, length) \ ((h)->temp.i = (length), \ ((obstack_room (h) < (h)->temp.i) \ ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \ obstack_blank_fast (h, (h)->temp.i)) # define obstack_alloc(h, length) \ (obstack_blank ((h), (length)), obstack_finish ((h))) # define obstack_copy(h, where, length) \ (obstack_grow ((h), (where), (length)), obstack_finish ((h))) # define obstack_copy0(h, where, length) \ (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) # define obstack_finish(h) \ (((h)->next_free == (h)->object_base \ ? (((h)->maybe_empty_object = 1), 0) \ : 0), \ (h)->temp.p = (h)->object_base, \ (h)->next_free \ = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ (h)->alignment_mask), \ (((size_t) ((h)->next_free - (char *) (h)->chunk) \ > (size_t) ((h)->chunk_limit - (char *) (h)->chunk)) \ ? ((h)->next_free = (h)->chunk_limit) : 0), \ (h)->object_base = (h)->next_free, \ (h)->temp.p) # define obstack_free(h, obj) \ ((h)->temp.p = (void *) (obj), \ (((h)->temp.p > (void *) (h)->chunk \ && (h)->temp.p < (void *) (h)->chunk_limit) \ ? (void) ((h)->next_free = (h)->object_base = (char *) (h)->temp.p) \ : _obstack_free ((h), (h)->temp.p))) #endif /* not __GNUC__ */ #ifdef __cplusplus } /* C++ */ #endif #endif /* _OBSTACK_H */ kbuild-3608/src/grep/lib/Makefile.am0000664000175000017500000000235214670377422017252 0ustar locutuslocutus# Copyright 1997-1998, 2005-2021 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, 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 . # AM_CFLAGS = AM_CPPFLAGS = BUILT_SOURCES = CLEANFILES = EXTRA_DIST = MAINTAINERCLEANFILES = MOSTLYCLEANDIRS = MOSTLYCLEANFILES = SUFFIXES = noinst_LIBRARIES = include gnulib.mk AM_CFLAGS += $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) nodist_libgreputils_a_SOURCES = colorize.c libgreputils_a_SOURCES += colorize.h EXTRA_DIST += colorize-posix.c colorize-w32.c CLEANFILES += colorize.c colorize.c: $(AM_V_at)echo '#include <$(COLORIZE_SOURCE)>' >$@-t $(AM_V_at)mv $@-t $@ libgreputils_a_LIBADD += $(LIBOBJS) $(ALLOCA) libgreputils_a_DEPENDENCIES += $(LIBOBJS) $(ALLOCA) kbuild-3608/src/grep/lib/stackvma.h0000664000175000017500000000464114670377426017207 0ustar locutuslocutus/* Determine the virtual memory area of a given address. Copyright (C) 2002-2021 Free Software Foundation, Inc. Copyright (C) 2003-2006 Paolo Bonzini 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 2 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 . */ /* Written by Bruno Haible and Paolo Bonzini. */ #ifndef _STACKVMA_H #define _STACKVMA_H #include /* Describes a virtual memory area, with some info about the gap between it and the next or previous virtual memory area. */ struct vma_struct { uintptr_t start; uintptr_t end; #if STACK_DIRECTION < 0 /* Info about the gap between this VMA and the previous one. addr must be < vma->start. */ int (*is_near_this) (uintptr_t addr, struct vma_struct *vma); /* Private field, not provided by all sigsegv_get_vma implementations. */ uintptr_t prev_end; #endif #if STACK_DIRECTION > 0 /* Info about the gap between this VMA and the next one. addr must be > vma->end - 1. */ int (*is_near_this) (uintptr_t addr, struct vma_struct *vma); /* Private field, not provided by all sigsegv_get_vma implementations. */ uintptr_t next_start; #endif }; /* Determines the virtual memory area to which a given address belongs, and returns 0. Returns -1 if it cannot be determined. This function is used to determine the stack extent when a fault occurs. */ extern int sigsegv_get_vma (uintptr_t address, struct vma_struct *vma); /* Defined if sigsegv_get_vma actually works (i.e. does not always fail). */ #if defined __linux__ || defined __ANDROID__ \ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \ || defined __NetBSD__ || defined __OpenBSD__ \ || (defined __APPLE__ && defined __MACH__) \ || defined _AIX || defined __sgi || defined __sun \ || defined __CYGWIN__ || defined __HAIKU__ # define HAVE_STACKVMA 1 #endif #endif /* _STACKVMA_H */ kbuild-3608/src/grep/lib/unistd.in.h0000664000175000017500000023437614670377426017323 0ustar locutuslocutus/* Substitute for and wrapper around . Copyright (C) 2003-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_UNISTD_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if @HAVE_UNISTD_H@ && defined _GL_INCLUDING_UNISTD_H /* Special invocation convention: - On Mac OS X 10.3.9 we have a sequence of nested includes -> -> -> In this situation, the functions are not yet declared, therefore we cannot provide the C++ aliases. */ #@INCLUDE_NEXT@ @NEXT_UNISTD_H@ #else /* Normal invocation convention. */ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_UNISTD_H@ # define _GL_INCLUDING_UNISTD_H # @INCLUDE_NEXT@ @NEXT_UNISTD_H@ # undef _GL_INCLUDING_UNISTD_H #endif /* Get all possible declarations of gethostname(). */ #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ && !defined _GL_INCLUDING_WINSOCK2_H # define _GL_INCLUDING_WINSOCK2_H # include # undef _GL_INCLUDING_WINSOCK2_H #endif #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H #define _@GUARD_PREFIX@_UNISTD_H /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ /* But avoid namespace pollution on glibc systems. */ #ifndef __GLIBC__ # include #endif /* mingw doesn't define the SEEK_* or *_FILENO macros in . */ /* MSVC declares 'unlink' in , not in . We must include it before we #define unlink rpl_unlink. */ /* Cygwin 1.7.1 declares symlinkat in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \ && (defined _WIN32 && ! defined __CYGWIN__)) \ || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ && defined __CYGWIN__)) \ && ! defined __GLIBC__ # include #endif /* Cygwin 1.7.1 and Android 4.3 declare unlinkat in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ && (defined __CYGWIN__ || defined __ANDROID__) \ && ! defined __GLIBC__ # include #endif /* mingw fails to declare _exit in . */ /* mingw, MSVC, BeOS, Haiku declare environ in , not in . */ /* Solaris declares getcwd not only in but also in . */ /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system is included here. */ /* But avoid namespace pollution on glibc systems. */ #if !defined __GLIBC__ && !defined __osf__ # define __need_system_stdlib_h # include # undef __need_system_stdlib_h #endif /* Native Windows platforms declare _chdir, _getcwd, _rmdir in and/or , not in . They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(), _lseek(), _read(), _unlink(), _write() in . */ #if defined _WIN32 && !defined __CYGWIN__ # include # include #endif /* Native Windows platforms declare _execl*, _execv* in . */ #if defined _WIN32 && !defined __CYGWIN__ # include #endif /* AIX and OSF/1 5.1 declare getdomainname in , not in . NonStop Kernel declares gethostname in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \ || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \ && !defined __GLIBC__ # include #endif /* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \ && ((defined __APPLE__ && defined __MACH__) || defined __sun \ || defined __ANDROID__) \ && @UNISTD_H_HAVE_SYS_RANDOM_H@ \ && !defined __GLIBC__ # include #endif /* Android 4.3 declares fchownat in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ && !defined __GLIBC__ # include #endif /* MSVC defines off_t in . May also define off_t to a 64-bit type on native Windows. */ /* Get off_t, ssize_t, mode_t. */ #include /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Get getopt(), optarg, optind, opterr, optopt. */ #if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT # include # include #endif #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_UNISTD_INLINE # define _GL_UNISTD_INLINE _GL_INLINE #endif /* Hide some function declarations from . */ #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef socket # define socket socket_used_without_including_sys_socket_h # undef connect # define connect connect_used_without_including_sys_socket_h # undef accept # define accept accept_used_without_including_sys_socket_h # undef bind # define bind bind_used_without_including_sys_socket_h # undef getpeername # define getpeername getpeername_used_without_including_sys_socket_h # undef getsockname # define getsockname getsockname_used_without_including_sys_socket_h # undef getsockopt # define getsockopt getsockopt_used_without_including_sys_socket_h # undef listen # define listen listen_used_without_including_sys_socket_h # undef recv # define recv recv_used_without_including_sys_socket_h # undef send # define send send_used_without_including_sys_socket_h # undef recvfrom # define recvfrom recvfrom_used_without_including_sys_socket_h # undef sendto # define sendto sendto_used_without_including_sys_socket_h # undef setsockopt # define setsockopt setsockopt_used_without_including_sys_socket_h # undef shutdown # define shutdown shutdown_used_without_including_sys_socket_h # else _GL_WARN_ON_USE (socket, "socket() used without including "); _GL_WARN_ON_USE (connect, "connect() used without including "); _GL_WARN_ON_USE (accept, "accept() used without including "); _GL_WARN_ON_USE (bind, "bind() used without including "); _GL_WARN_ON_USE (getpeername, "getpeername() used without including "); _GL_WARN_ON_USE (getsockname, "getsockname() used without including "); _GL_WARN_ON_USE (getsockopt, "getsockopt() used without including "); _GL_WARN_ON_USE (listen, "listen() used without including "); _GL_WARN_ON_USE (recv, "recv() used without including "); _GL_WARN_ON_USE (send, "send() used without including "); _GL_WARN_ON_USE (recvfrom, "recvfrom() used without including "); _GL_WARN_ON_USE (sendto, "sendto() used without including "); _GL_WARN_ON_USE (setsockopt, "setsockopt() used without including "); _GL_WARN_ON_USE (shutdown, "shutdown() used without including "); # endif # endif # if !defined _@GUARD_PREFIX@_SYS_SELECT_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef select # define select select_used_without_including_sys_select_h # else _GL_WARN_ON_USE (select, "select() used without including "); # endif # endif #endif /* OS/2 EMX lacks these macros. */ #ifndef STDIN_FILENO # define STDIN_FILENO 0 #endif #ifndef STDOUT_FILENO # define STDOUT_FILENO 1 #endif #ifndef STDERR_FILENO # define STDERR_FILENO 2 #endif /* Ensure *_OK macros exist. */ #ifndef F_OK # define F_OK 0 # define X_OK 1 # define W_OK 2 # define R_OK 4 #endif /* Declare overridden functions. */ #if @GNULIB_ACCESS@ # if @REPLACE_ACCESS@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef access # define access rpl_access # endif _GL_FUNCDECL_RPL (access, int, (const char *file, int mode) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef access # define access _access # endif _GL_CXXALIAS_MDA (access, int, (const char *file, int mode)); # else _GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); # endif _GL_CXXALIASWARN (access); #elif defined GNULIB_POSIXCHECK # undef access # if HAVE_RAW_DECL_ACCESS /* The access() function is a security risk. */ _GL_WARN_ON_USE (access, "access does not always support X_OK - " "use gnulib module access for portability; " "also, this function is a security risk - " "use the gnulib module faccessat instead"); # endif #elif @GNULIB_MDA_ACCESS@ /* On native Windows, map 'access' to '_access', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::access always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef access # define access _access # endif _GL_CXXALIAS_MDA (access, int, (const char *file, int mode)); # else _GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); # endif _GL_CXXALIASWARN (access); #endif #if @GNULIB_CHDIR@ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef chdir # define chdir _chdir # endif _GL_CXXALIAS_MDA (chdir, int, (const char *file)); # else _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIASWARN (chdir); #elif defined GNULIB_POSIXCHECK # undef chdir # if HAVE_RAW_DECL_CHDIR _GL_WARN_ON_USE (chown, "chdir is not always in - " "use gnulib module chdir for portability"); # endif #elif @GNULIB_MDA_CHDIR@ /* On native Windows, map 'chdir' to '_chdir', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::chdir always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef chdir # define chdir _chdir # endif _GL_CXXALIAS_MDA (chdir, int, (const char *file)); # else _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIASWARN (chdir); #endif #if @GNULIB_CHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification . */ # if @REPLACE_DUP2@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup2 rpl_dup2 # endif _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef dup2 # define dup2 _dup2 # endif _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd)); # else _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); # endif _GL_CXXALIASWARN (dup2); #elif defined GNULIB_POSIXCHECK # undef dup2 # if HAVE_RAW_DECL_DUP2 _GL_WARN_ON_USE (dup2, "dup2 is unportable - " "use gnulib module dup2 for portability"); # endif #elif @GNULIB_MDA_DUP2@ /* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::dup2 always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef dup2 # define dup2 _dup2 # endif _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd)); # else _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); # endif _GL_CXXALIASWARN (dup2); #endif #if @GNULIB_DUP3@ /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the specified flags. The flags are a bitmask, possibly including O_CLOEXEC (defined in ) and O_TEXT, O_BINARY (defined in "binary-io.h"). Close NEWFD first if it is open. Return newfd if successful, otherwise -1 and errno set. See the Linux man page at . */ # if @HAVE_DUP3@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup3 rpl_dup3 # endif _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); # else _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); # endif _GL_CXXALIASWARN (dup3); #elif defined GNULIB_POSIXCHECK # undef dup3 # if HAVE_RAW_DECL_DUP3 _GL_WARN_ON_USE (dup3, "dup3 is unportable - " "use gnulib module dup3 for portability"); # endif #endif #if @GNULIB_ENVIRON@ # if defined __CYGWIN__ && !defined __i386__ /* The 'environ' variable is defined in a DLL. Therefore its declaration needs the '__declspec(dllimport)' attribute, but the system's lacks it. This leads to a link error on 64-bit Cygwin when the option -Wl,--disable-auto-import is in use. */ _GL_EXTERN_C __declspec(dllimport) char **environ; # endif # if !@HAVE_DECL_ENVIRON@ /* Set of environment variables and values. An array of strings of the form "VARIABLE=VALUE", terminated with a NULL. */ # if defined __APPLE__ && defined __MACH__ # include # if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR # define _GL_USE_CRT_EXTERNS # endif # endif # ifdef _GL_USE_CRT_EXTERNS # include # define environ (*_NSGetEnviron ()) # else # ifdef __cplusplus extern "C" { # endif extern char **environ; # ifdef __cplusplus } # endif # endif # endif #elif defined GNULIB_POSIXCHECK # if HAVE_RAW_DECL_ENVIRON _GL_UNISTD_INLINE char *** _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - " "use gnulib module environ for portability") rpl_environ (void) { return &environ; } # undef environ # define environ (*rpl_environ ()) # endif #endif #if @GNULIB_EUIDACCESS@ /* Like access(), except that it uses the effective user id and group id of the current process. */ # if !@HAVE_EUIDACCESS@ _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); _GL_CXXALIASWARN (euidaccess); # if defined GNULIB_POSIXCHECK /* Like access(), this function is a security risk. */ _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " "use the gnulib module faccessat instead"); # endif #elif defined GNULIB_POSIXCHECK # undef euidaccess # if HAVE_RAW_DECL_EUIDACCESS _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " "use gnulib module euidaccess for portability"); # endif #endif #if @GNULIB_EXECL@ # if @REPLACE_EXECL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execl # define execl rpl_execl # endif _GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); # else _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execl); #elif defined GNULIB_POSIXCHECK # undef execl # if HAVE_RAW_DECL_EXECL _GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - " "use gnulib module execl for portability"); # endif #elif @GNULIB_MDA_EXECL@ /* On native Windows, map 'execl' to '_execl', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::execl always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execl # define execl _execl # endif _GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, ...)); # else _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execl); #endif #if @GNULIB_EXECLE@ # if @REPLACE_EXECLE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execle # define execle rpl_execle # endif _GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); # else _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execle); #elif defined GNULIB_POSIXCHECK # undef execle # if HAVE_RAW_DECL_EXECLE _GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - " "use gnulib module execle for portability"); # endif #elif @GNULIB_MDA_EXECLE@ /* On native Windows, map 'execle' to '_execle', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::execle always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execle # define execle _execle # endif _GL_CXXALIAS_MDA (execle, intptr_t, (const char *program, const char *arg, ...)); # else _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execle); #endif #if @GNULIB_EXECLP@ # if @REPLACE_EXECLP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execlp # define execlp rpl_execlp # endif _GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); # else _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execlp); #elif defined GNULIB_POSIXCHECK # undef execlp # if HAVE_RAW_DECL_EXECLP _GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - " "use gnulib module execlp for portability"); # endif #elif @GNULIB_MDA_EXECLP@ /* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::execlp always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execlp # define execlp _execlp # endif _GL_CXXALIAS_MDA (execlp, intptr_t, (const char *program, const char *arg, ...)); # else _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execlp); #endif #if @GNULIB_EXECV@ # if @REPLACE_EXECV@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execv # define execv rpl_execv # endif _GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); # else _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv)); # endif _GL_CXXALIASWARN (execv); #elif defined GNULIB_POSIXCHECK # undef execv # if HAVE_RAW_DECL_EXECV _GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - " "use gnulib module execv for portability"); # endif #elif @GNULIB_MDA_EXECV@ /* On native Windows, map 'execv' to '_execv', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::execv always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execv # define execv _execv # endif _GL_CXXALIAS_MDA_CAST (execv, intptr_t, (const char *program, char * const *argv)); # else _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv)); # endif _GL_CXXALIASWARN (execv); #endif #if @GNULIB_EXECVE@ # if @REPLACE_EXECVE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execve # define execve rpl_execve # endif _GL_FUNCDECL_RPL (execve, int, (const char *program, char * const *argv, char * const *env) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (execve, int, (const char *program, char * const *argv, char * const *env)); # else _GL_CXXALIAS_SYS (execve, int, (const char *program, char * const *argv, char * const *env)); # endif _GL_CXXALIASWARN (execve); #elif defined GNULIB_POSIXCHECK # undef execve # if HAVE_RAW_DECL_EXECVE _GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - " "use gnulib module execve for portability"); # endif #elif @GNULIB_MDA_EXECVE@ /* On native Windows, map 'execve' to '_execve', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::execve always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execve # define execve _execve # endif _GL_CXXALIAS_MDA_CAST (execve, intptr_t, (const char *program, char * const *argv, char * const *env)); # else _GL_CXXALIAS_SYS (execve, int, (const char *program, char * const *argv, char * const *env)); # endif _GL_CXXALIASWARN (execve); #endif #if @GNULIB_EXECVP@ # if @REPLACE_EXECVP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execvp # define execvp rpl_execvp # endif _GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); # else _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv)); # endif _GL_CXXALIASWARN (execvp); #elif defined GNULIB_POSIXCHECK # undef execvp # if HAVE_RAW_DECL_EXECVP _GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - " "use gnulib module execvp for portability"); # endif #elif @GNULIB_MDA_EXECVP@ /* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::execvp always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execvp # define execvp _execvp # endif _GL_CXXALIAS_MDA_CAST (execvp, intptr_t, (const char *program, char * const *argv)); # else _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv)); # endif _GL_CXXALIASWARN (execvp); #endif #if @GNULIB_EXECVPE@ # if @REPLACE_EXECVPE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execvpe # define execvpe rpl_execvpe # endif _GL_FUNCDECL_RPL (execvpe, int, (const char *program, char * const *argv, char * const *env) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (execvpe, int, (const char *program, char * const *argv, char * const *env)); # else # if !@HAVE_DECL_EXECVPE@ _GL_FUNCDECL_SYS (execvpe, int, (const char *program, char * const *argv, char * const *env) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (execvpe, int, (const char *program, char * const *argv, char * const *env)); # endif _GL_CXXALIASWARN (execvpe); #elif defined GNULIB_POSIXCHECK # undef execvpe # if HAVE_RAW_DECL_EXECVPE _GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - " "use gnulib module execvpe for portability"); # endif #elif @GNULIB_MDA_EXECVPE@ /* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have it. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef execvpe # define execvpe _execvpe # endif _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t, (const char *program, char * const *argv, char * const *env)); # elif @HAVE_EXECVPE@ # if !@HAVE_DECL_EXECVPE@ _GL_FUNCDECL_SYS (execvpe, int, (const char *program, char * const *argv, char * const *env) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (execvpe, int, (const char *program, char * const *argv, char * const *env)); # endif # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_EXECVPE@ _GL_CXXALIASWARN (execvpe); # endif #endif #if @GNULIB_FACCESSAT@ # if @REPLACE_FACCESSAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef faccessat # define faccessat rpl_faccessat # endif _GL_FUNCDECL_RPL (faccessat, int, (int fd, char const *name, int mode, int flag) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (faccessat, int, (int fd, char const *name, int mode, int flag)); # else # if !@HAVE_FACCESSAT@ _GL_FUNCDECL_SYS (faccessat, int, (int fd, char const *file, int mode, int flag) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (faccessat, int, (int fd, char const *file, int mode, int flag)); # endif _GL_CXXALIASWARN (faccessat); #elif defined GNULIB_POSIXCHECK # undef faccessat # if HAVE_RAW_DECL_FACCESSAT _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " "use gnulib module faccessat for portability"); # endif #endif #if @GNULIB_FCHDIR@ /* Change the process' current working directory to the directory on which the given file descriptor is open. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification . */ # if ! @HAVE_FCHDIR@ _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); /* Gnulib internal hooks needed to maintain the fchdir metadata. */ _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) _GL_ARG_NONNULL ((2)); _GL_EXTERN_C void _gl_unregister_fd (int fd); _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); _GL_EXTERN_C const char *_gl_directory_name (int fd); # else # if !@HAVE_DECL_FCHDIR@ _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); # endif # endif _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); _GL_CXXALIASWARN (fchdir); #elif defined GNULIB_POSIXCHECK # undef fchdir # if HAVE_RAW_DECL_FCHDIR _GL_WARN_ON_USE (fchdir, "fchdir is unportable - " "use gnulib module fchdir for portability"); # endif #endif #if @GNULIB_FCHOWNAT@ # if @REPLACE_FCHOWNAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fchownat # define fchownat rpl_fchownat # endif _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, uid_t owner, gid_t group, int flag) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, uid_t owner, gid_t group, int flag)); # else # if !@HAVE_FCHOWNAT@ _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, uid_t owner, gid_t group, int flag) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, uid_t owner, gid_t group, int flag)); # endif _GL_CXXALIASWARN (fchownat); #elif defined GNULIB_POSIXCHECK # undef fchownat # if HAVE_RAW_DECL_FCHOWNAT _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " "use gnulib module fchownat for portability"); # endif #endif #if @GNULIB_FDATASYNC@ /* Synchronize changes to a file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2008 specification . */ # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); # endif _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); _GL_CXXALIASWARN (fdatasync); #elif defined GNULIB_POSIXCHECK # undef fdatasync # if HAVE_RAW_DECL_FDATASYNC _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " "use gnulib module fdatasync for portability"); # endif #endif #if @GNULIB_FSYNC@ /* Synchronize changes, including metadata, to a file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2008 specification . */ # if !@HAVE_FSYNC@ _GL_FUNCDECL_SYS (fsync, int, (int fd)); # endif _GL_CXXALIAS_SYS (fsync, int, (int fd)); _GL_CXXALIASWARN (fsync); #elif defined GNULIB_POSIXCHECK # undef fsync # if HAVE_RAW_DECL_FSYNC _GL_WARN_ON_USE (fsync, "fsync is unportable - " "use gnulib module fsync for portability"); # endif #endif #if @GNULIB_FTRUNCATE@ /* Change the size of the file to which FD is opened to become equal to LENGTH. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification . */ # if @REPLACE_FTRUNCATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ftruncate # define ftruncate rpl_ftruncate # endif _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); # else # if !@HAVE_FTRUNCATE@ _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); # endif _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); # endif _GL_CXXALIASWARN (ftruncate); #elif defined GNULIB_POSIXCHECK # undef ftruncate # if HAVE_RAW_DECL_FTRUNCATE _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " "use gnulib module ftruncate for portability"); # endif #endif #if @GNULIB_GETCWD@ /* Get the name of the current working directory, and put it in SIZE bytes of BUF. Return BUF if successful, or NULL if the directory couldn't be determined or SIZE was too small. See the POSIX:2008 specification . Additionally, the gnulib module 'getcwd' guarantees the following GNU extension: If BUF is NULL, an array is allocated with 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary. */ # if @REPLACE_GETCWD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getcwd rpl_getcwd # endif _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getcwd # define getcwd _getcwd # endif _GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size)); # else /* Need to cast, because on mingw, the second parameter is int size. */ _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); # endif _GL_CXXALIASWARN (getcwd); #elif defined GNULIB_POSIXCHECK # undef getcwd # if HAVE_RAW_DECL_GETCWD _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " "use gnulib module getcwd for portability"); # endif #elif @GNULIB_MDA_GETCWD@ /* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::getcwd always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getcwd # define getcwd _getcwd # endif /* Need to cast, because on mingw, the second parameter is either 'int size' or 'size_t size'. */ _GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size)); # else _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); # endif _GL_CXXALIASWARN (getcwd); #endif #if @GNULIB_GETDOMAINNAME@ /* Return the NIS domain name of the machine. WARNING! The NIS domain name is unrelated to the fully qualified host name of the machine. It is also unrelated to email addresses. WARNING! The NIS domain name is usually the empty string or "(none)" when not using NIS. Put up to LEN bytes of the NIS domain name into NAME. Null terminate it if the name is shorter than LEN. If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. Return 0 if successful, otherwise set errno and return -1. */ # if @REPLACE_GETDOMAINNAME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getdomainname # define getdomainname rpl_getdomainname # endif _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); # else # if !@HAVE_DECL_GETDOMAINNAME@ _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); # endif _GL_CXXALIASWARN (getdomainname); #elif defined GNULIB_POSIXCHECK # undef getdomainname # if HAVE_RAW_DECL_GETDOMAINNAME _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " "use gnulib module getdomainname for portability"); # endif #endif #if @GNULIB_GETDTABLESIZE@ /* Return the maximum number of file descriptors in the current process. In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ # if @REPLACE_GETDTABLESIZE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getdtablesize # define getdtablesize rpl_getdtablesize # endif _GL_FUNCDECL_RPL (getdtablesize, int, (void)); _GL_CXXALIAS_RPL (getdtablesize, int, (void)); # else # if !@HAVE_GETDTABLESIZE@ _GL_FUNCDECL_SYS (getdtablesize, int, (void)); # endif /* Need to cast, because on AIX, the parameter list is (...). */ _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void)); # endif _GL_CXXALIASWARN (getdtablesize); #elif defined GNULIB_POSIXCHECK # undef getdtablesize # if HAVE_RAW_DECL_GETDTABLESIZE _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " "use gnulib module getdtablesize for portability"); # endif #endif #if @GNULIB_GETENTROPY@ /* Fill a buffer with random bytes. */ # if !@HAVE_GETENTROPY@ _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); # endif _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); _GL_CXXALIASWARN (getentropy); #elif defined GNULIB_POSIXCHECK # undef getentropy # if HAVE_RAW_DECL_GETENTROPY _GL_WARN_ON_USE (getentropy, "getentropy is unportable - " "use gnulib module getentropy for portability"); # endif #endif #if @GNULIB_GETGROUPS@ /* Return the supplemental groups that the current process belongs to. It is unspecified whether the effective group id is in the list. If N is 0, return the group count; otherwise, N describes how many entries are available in GROUPS. Return -1 and set errno if N is not 0 and not large enough. Fails with ENOSYS on some systems. */ # if @REPLACE_GETGROUPS@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getgroups # define getgroups rpl_getgroups # endif _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); # else # if !@HAVE_GETGROUPS@ _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); # endif _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); # endif _GL_CXXALIASWARN (getgroups); #elif defined GNULIB_POSIXCHECK # undef getgroups # if HAVE_RAW_DECL_GETGROUPS _GL_WARN_ON_USE (getgroups, "getgroups is unportable - " "use gnulib module getgroups for portability"); # endif #endif #if @GNULIB_GETHOSTNAME@ /* Return the standard host name of the machine. WARNING! The host name may or may not be fully qualified. Put up to LEN bytes of the host name into NAME. Null terminate it if the name is shorter than LEN. If the host name is longer than LEN, set errno = EINVAL and return -1. Return 0 if successful, otherwise set errno and return -1. */ # if @UNISTD_H_HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gethostname # define gethostname rpl_gethostname # endif _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); # else # if !@HAVE_GETHOSTNAME@ _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) _GL_ARG_NONNULL ((1))); # endif /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second parameter is int len. */ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); # endif _GL_CXXALIASWARN (gethostname); #elif @UNISTD_H_HAVE_WINSOCK2_H@ # undef gethostname # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname #elif defined GNULIB_POSIXCHECK # undef gethostname # if HAVE_RAW_DECL_GETHOSTNAME _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " "use gnulib module gethostname for portability"); # endif #endif #if @GNULIB_GETLOGIN@ /* Returns the user's login name, or NULL if it cannot be found. Upon error, returns NULL with errno set. See . Most programs don't need to use this function, because the information is available through environment variables: ${LOGNAME-$USER} on Unix platforms, $USERNAME on native Windows platforms. */ # if !@HAVE_DECL_GETLOGIN@ _GL_FUNCDECL_SYS (getlogin, char *, (void)); # endif _GL_CXXALIAS_SYS (getlogin, char *, (void)); _GL_CXXALIASWARN (getlogin); #elif defined GNULIB_POSIXCHECK # undef getlogin # if HAVE_RAW_DECL_GETLOGIN _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " "use gnulib module getlogin for portability"); # endif #endif #if @GNULIB_GETLOGIN_R@ /* Copies the user's login name to NAME. The array pointed to by NAME has room for SIZE bytes. Returns 0 if successful. Upon error, an error number is returned, or -1 in the case that the login name cannot be found but no specific error is provided (this case is hopefully rare but is left open by the POSIX spec). See . Most programs don't need to use this function, because the information is available through environment variables: ${LOGNAME-$USER} on Unix platforms, $USERNAME on native Windows platforms. */ # if @REPLACE_GETLOGIN_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getlogin_r rpl_getlogin_r # endif _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); # else # if !@HAVE_DECL_GETLOGIN_R@ _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) _GL_ARG_NONNULL ((1))); # endif /* Need to cast, because on Solaris 10 systems, the second argument is int size. */ _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); # endif _GL_CXXALIASWARN (getlogin_r); #elif defined GNULIB_POSIXCHECK # undef getlogin_r # if HAVE_RAW_DECL_GETLOGIN_R _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " "use gnulib module getlogin_r for portability"); # endif #endif #if @GNULIB_GETPAGESIZE@ # if @REPLACE_GETPAGESIZE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getpagesize rpl_getpagesize # endif _GL_FUNCDECL_RPL (getpagesize, int, (void)); _GL_CXXALIAS_RPL (getpagesize, int, (void)); # else /* On HP-UX, getpagesize exists, but it is not declared in even if the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ # if defined __hpux _GL_FUNCDECL_SYS (getpagesize, int, (void)); # endif # if !@HAVE_GETPAGESIZE@ # if !defined getpagesize /* This is for POSIX systems. */ # if !defined _gl_getpagesize && defined _SC_PAGESIZE # if ! (defined __VMS && __VMS_VER < 70000000) # define _gl_getpagesize() sysconf (_SC_PAGESIZE) # endif # endif /* This is for older VMS. */ # if !defined _gl_getpagesize && defined __VMS # ifdef __ALPHA # define _gl_getpagesize() 8192 # else # define _gl_getpagesize() 512 # endif # endif /* This is for BeOS. */ # if !defined _gl_getpagesize && @HAVE_OS_H@ # include # if defined B_PAGE_SIZE # define _gl_getpagesize() B_PAGE_SIZE # endif # endif /* This is for AmigaOS4.0. */ # if !defined _gl_getpagesize && defined __amigaos4__ # define _gl_getpagesize() 2048 # endif /* This is for older Unix systems. */ # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@ # include # ifdef EXEC_PAGESIZE # define _gl_getpagesize() EXEC_PAGESIZE # else # ifdef NBPG # ifndef CLSIZE # define CLSIZE 1 # endif # define _gl_getpagesize() (NBPG * CLSIZE) # else # ifdef NBPC # define _gl_getpagesize() NBPC # endif # endif # endif # endif # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getpagesize() _gl_getpagesize () # else # if !GNULIB_defined_getpagesize_function _GL_UNISTD_INLINE int getpagesize () { return _gl_getpagesize (); } # define GNULIB_defined_getpagesize_function 1 # endif # endif # endif # endif /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); # endif # if @HAVE_DECL_GETPAGESIZE@ _GL_CXXALIASWARN (getpagesize); # endif #elif defined GNULIB_POSIXCHECK # undef getpagesize # if HAVE_RAW_DECL_GETPAGESIZE _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " "use gnulib module getpagesize for portability"); # endif #endif #if @GNULIB_GETPASS@ /* Function getpass() from module 'getpass': Read a password from /dev/tty or stdin. Function getpass() from module 'getpass-gnu': Read a password of arbitrary length from /dev/tty or stdin. */ # if @REPLACE_GETPASS@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getpass # define getpass rpl_getpass # endif _GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); # else # if !@HAVE_GETPASS@ _GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); # endif _GL_CXXALIASWARN (getpass); #elif defined GNULIB_POSIXCHECK # undef getpass # if HAVE_RAW_DECL_GETPASS _GL_WARN_ON_USE (getpass, "getpass is unportable - " "use gnulib module getpass or getpass-gnu for portability"); # endif #endif #if @GNULIB_MDA_GETPID@ /* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::getpid always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getpid # define getpid _getpid # endif _GL_CXXALIAS_MDA (getpid, int, (void)); # else _GL_CXXALIAS_SYS (getpid, pid_t, (void)); # endif _GL_CXXALIASWARN (getpid); #endif #if @GNULIB_GETUSERSHELL@ /* Return the next valid login shell on the system, or NULL when the end of the list has been reached. */ # if !@HAVE_DECL_GETUSERSHELL@ _GL_FUNCDECL_SYS (getusershell, char *, (void)); # endif _GL_CXXALIAS_SYS (getusershell, char *, (void)); _GL_CXXALIASWARN (getusershell); #elif defined GNULIB_POSIXCHECK # undef getusershell # if HAVE_RAW_DECL_GETUSERSHELL _GL_WARN_ON_USE (getusershell, "getusershell is unportable - " "use gnulib module getusershell for portability"); # endif #endif #if @GNULIB_GETUSERSHELL@ /* Rewind to pointer that is advanced at each getusershell() call. */ # if !@HAVE_DECL_GETUSERSHELL@ _GL_FUNCDECL_SYS (setusershell, void, (void)); # endif _GL_CXXALIAS_SYS (setusershell, void, (void)); _GL_CXXALIASWARN (setusershell); #elif defined GNULIB_POSIXCHECK # undef setusershell # if HAVE_RAW_DECL_SETUSERSHELL _GL_WARN_ON_USE (setusershell, "setusershell is unportable - " "use gnulib module getusershell for portability"); # endif #endif #if @GNULIB_GETUSERSHELL@ /* Free the pointer that is advanced at each getusershell() call and associated resources. */ # if !@HAVE_DECL_GETUSERSHELL@ _GL_FUNCDECL_SYS (endusershell, void, (void)); # endif _GL_CXXALIAS_SYS (endusershell, void, (void)); _GL_CXXALIASWARN (endusershell); #elif defined GNULIB_POSIXCHECK # undef endusershell # if HAVE_RAW_DECL_ENDUSERSHELL _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " "use gnulib module getusershell for portability"); # endif #endif #if @GNULIB_GROUP_MEMBER@ /* Determine whether group id is in calling user's group list. */ # if !@HAVE_GROUP_MEMBER@ _GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); # endif _GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); _GL_CXXALIASWARN (group_member); #elif defined GNULIB_POSIXCHECK # undef group_member # if HAVE_RAW_DECL_GROUP_MEMBER _GL_WARN_ON_USE (group_member, "group_member is unportable - " "use gnulib module group-member for portability"); # endif #endif #if @GNULIB_ISATTY@ # if @REPLACE_ISATTY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef isatty # define isatty rpl_isatty # endif # define GNULIB_defined_isatty 1 _GL_FUNCDECL_RPL (isatty, int, (int fd)); _GL_CXXALIAS_RPL (isatty, int, (int fd)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef isatty # define isatty _isatty # endif _GL_CXXALIAS_MDA (isatty, int, (int fd)); # else _GL_CXXALIAS_SYS (isatty, int, (int fd)); # endif _GL_CXXALIASWARN (isatty); #elif defined GNULIB_POSIXCHECK # undef isatty # if HAVE_RAW_DECL_ISATTY _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " "use gnulib module isatty for portability"); # endif #elif @GNULIB_MDA_ISATTY@ /* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::isatty always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef isatty # define isatty _isatty # endif _GL_CXXALIAS_MDA (isatty, int, (int fd)); # else _GL_CXXALIAS_SYS (isatty, int, (int fd)); # endif _GL_CXXALIASWARN (isatty); #endif #if @GNULIB_LCHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Do not follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification . */ # if @REPLACE_LCHOWN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef lchown # define lchown rpl_lchown # endif _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); # else # if !@HAVE_LCHOWN@ _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); # endif _GL_CXXALIASWARN (lchown); #elif defined GNULIB_POSIXCHECK # undef lchown # if HAVE_RAW_DECL_LCHOWN _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " "use gnulib module lchown for portability"); # endif #endif #if @GNULIB_LINK@ /* Create a new hard link for an existing file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2008 specification . */ # if @REPLACE_LINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define link rpl_link # endif _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); # else # if !@HAVE_LINK@ _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); # endif _GL_CXXALIASWARN (link); #elif defined GNULIB_POSIXCHECK # undef link # if HAVE_RAW_DECL_LINK _GL_WARN_ON_USE (link, "link is unportable - " "use gnulib module link for portability"); # endif #endif #if @GNULIB_LINKAT@ /* Create a new hard link for an existing file, relative to two directories. FLAG controls whether symlinks are followed. Return 0 if successful, otherwise -1 and errno set. */ # if @REPLACE_LINKAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef linkat # define linkat rpl_linkat # endif _GL_FUNCDECL_RPL (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, int flag) _GL_ARG_NONNULL ((2, 4))); _GL_CXXALIAS_RPL (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, int flag)); # else # if !@HAVE_LINKAT@ _GL_FUNCDECL_SYS (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, int flag) _GL_ARG_NONNULL ((2, 4))); # endif _GL_CXXALIAS_SYS (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, int flag)); # endif _GL_CXXALIASWARN (linkat); #elif defined GNULIB_POSIXCHECK # undef linkat # if HAVE_RAW_DECL_LINKAT _GL_WARN_ON_USE (linkat, "linkat is unportable - " "use gnulib module linkat for portability"); # endif #endif #if @GNULIB_LSEEK@ /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. Return the new offset if successful, otherwise -1 and errno set. See the POSIX:2008 specification . */ # if @REPLACE_LSEEK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lseek rpl_lseek # endif _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef lseek # define lseek _lseek # endif _GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence)); # else _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); # endif _GL_CXXALIASWARN (lseek); #elif defined GNULIB_POSIXCHECK # undef lseek # if HAVE_RAW_DECL_LSEEK _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " "systems - use gnulib module lseek for portability"); # endif #elif @GNULIB_MDA_LSEEK@ /* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::lseek always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef lseek # define lseek _lseek # endif _GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence)); # else _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); # endif _GL_CXXALIASWARN (lseek); #endif #if @GNULIB_PIPE@ /* Create a pipe, defaulting to O_BINARY mode. Store the read-end as fd[0] and the write-end as fd[1]. Return 0 upon success, or -1 with errno set upon failure. */ # if !@HAVE_PIPE@ _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pipe, int, (int fd[2])); _GL_CXXALIASWARN (pipe); #elif defined GNULIB_POSIXCHECK # undef pipe # if HAVE_RAW_DECL_PIPE _GL_WARN_ON_USE (pipe, "pipe is unportable - " "use gnulib module pipe-posix for portability"); # endif #endif #if @GNULIB_PIPE2@ /* Create a pipe, applying the given flags when opening the read-end of the pipe and the write-end of the pipe. The flags are a bitmask, possibly including O_CLOEXEC (defined in ) and O_TEXT, O_BINARY (defined in "binary-io.h"). Store the read-end as fd[0] and the write-end as fd[1]. Return 0 upon success, or -1 with errno set upon failure. See also the Linux man page at . */ # if @HAVE_PIPE2@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define pipe2 rpl_pipe2 # endif _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); # else _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); # endif _GL_CXXALIASWARN (pipe2); #elif defined GNULIB_POSIXCHECK # undef pipe2 # if HAVE_RAW_DECL_PIPE2 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " "use gnulib module pipe2 for portability"); # endif #endif #if @GNULIB_PREAD@ /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. Return the number of bytes placed into BUF if successful, otherwise set errno and return -1. 0 indicates EOF. See the POSIX:2008 specification . */ # if @REPLACE_PREAD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pread # define pread rpl_pread # endif _GL_FUNCDECL_RPL (pread, ssize_t, (int fd, void *buf, size_t bufsize, off_t offset) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (pread, ssize_t, (int fd, void *buf, size_t bufsize, off_t offset)); # else # if !@HAVE_PREAD@ _GL_FUNCDECL_SYS (pread, ssize_t, (int fd, void *buf, size_t bufsize, off_t offset) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (pread, ssize_t, (int fd, void *buf, size_t bufsize, off_t offset)); # endif _GL_CXXALIASWARN (pread); #elif defined GNULIB_POSIXCHECK # undef pread # if HAVE_RAW_DECL_PREAD _GL_WARN_ON_USE (pread, "pread is unportable - " "use gnulib module pread for portability"); # endif #endif #if @GNULIB_PWRITE@ /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. Return the number of bytes written if successful, otherwise set errno and return -1. 0 indicates nothing written. See the POSIX:2008 specification . */ # if @REPLACE_PWRITE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pwrite # define pwrite rpl_pwrite # endif _GL_FUNCDECL_RPL (pwrite, ssize_t, (int fd, const void *buf, size_t bufsize, off_t offset) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (pwrite, ssize_t, (int fd, const void *buf, size_t bufsize, off_t offset)); # else # if !@HAVE_PWRITE@ _GL_FUNCDECL_SYS (pwrite, ssize_t, (int fd, const void *buf, size_t bufsize, off_t offset) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (pwrite, ssize_t, (int fd, const void *buf, size_t bufsize, off_t offset)); # endif _GL_CXXALIASWARN (pwrite); #elif defined GNULIB_POSIXCHECK # undef pwrite # if HAVE_RAW_DECL_PWRITE _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " "use gnulib module pwrite for portability"); # endif #endif #if @GNULIB_READ@ /* Read up to COUNT bytes from file descriptor FD into the buffer starting at BUF. See the POSIX:2008 specification . */ # if @REPLACE_READ@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef read # define read rpl_read # endif _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef read # define read _read # endif _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count)); # else _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); # endif _GL_CXXALIASWARN (read); #elif @GNULIB_MDA_READ@ /* On native Windows, map 'read' to '_read', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::read always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef read # define read _read # endif # ifdef __MINGW32__ _GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count)); # else _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count)); # endif # else _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); # endif _GL_CXXALIASWARN (read); #endif #if @GNULIB_READLINK@ /* Read the contents of the symbolic link FILE and place the first BUFSIZE bytes of it into BUF. Return the number of bytes placed into BUF if successful, otherwise -1 and errno set. See the POSIX:2008 specification . */ # if @REPLACE_READLINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define readlink rpl_readlink # endif _GL_FUNCDECL_RPL (readlink, ssize_t, (const char *restrict file, char *restrict buf, size_t bufsize) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (readlink, ssize_t, (const char *restrict file, char *restrict buf, size_t bufsize)); # else # if !@HAVE_READLINK@ _GL_FUNCDECL_SYS (readlink, ssize_t, (const char *restrict file, char *restrict buf, size_t bufsize) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (readlink, ssize_t, (const char *restrict file, char *restrict buf, size_t bufsize)); # endif _GL_CXXALIASWARN (readlink); #elif defined GNULIB_POSIXCHECK # undef readlink # if HAVE_RAW_DECL_READLINK _GL_WARN_ON_USE (readlink, "readlink is unportable - " "use gnulib module readlink for portability"); # endif #endif #if @GNULIB_READLINKAT@ # if @REPLACE_READLINKAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define readlinkat rpl_readlinkat # endif _GL_FUNCDECL_RPL (readlinkat, ssize_t, (int fd, char const *restrict file, char *restrict buf, size_t len) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (readlinkat, ssize_t, (int fd, char const *restrict file, char *restrict buf, size_t len)); # else # if !@HAVE_READLINKAT@ _GL_FUNCDECL_SYS (readlinkat, ssize_t, (int fd, char const *restrict file, char *restrict buf, size_t len) _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (readlinkat, ssize_t, (int fd, char const *restrict file, char *restrict buf, size_t len)); # endif _GL_CXXALIASWARN (readlinkat); #elif defined GNULIB_POSIXCHECK # undef readlinkat # if HAVE_RAW_DECL_READLINKAT _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " "use gnulib module readlinkat for portability"); # endif #endif #if @GNULIB_RMDIR@ /* Remove the directory DIR. */ # if @REPLACE_RMDIR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define rmdir rpl_rmdir # endif _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (rmdir, int, (char const *name)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef rmdir # define rmdir _rmdir # endif _GL_CXXALIAS_MDA (rmdir, int, (char const *name)); # else _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); # endif _GL_CXXALIASWARN (rmdir); #elif defined GNULIB_POSIXCHECK # undef rmdir # if HAVE_RAW_DECL_RMDIR _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " "use gnulib module rmdir for portability"); # endif #elif @GNULIB_MDA_RMDIR@ /* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::rmdir always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef rmdir # define rmdir _rmdir # endif _GL_CXXALIAS_MDA (rmdir, int, (char const *name)); # else _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); # endif _GL_CXXALIASWARN (rmdir); #endif #if @GNULIB_SETHOSTNAME@ /* Set the host name of the machine. The host name may or may not be fully qualified. Put LEN bytes of NAME into the host name. Return 0 if successful, otherwise, set errno and return -1. Platforms with no ability to set the hostname return -1 and set errno = ENOSYS. */ # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) _GL_ARG_NONNULL ((1))); # endif /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 and FreeBSD 6.4 the second parameter is int. On Solaris 11 2011-10, the first parameter is not const. */ _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); _GL_CXXALIASWARN (sethostname); #elif defined GNULIB_POSIXCHECK # undef sethostname # if HAVE_RAW_DECL_SETHOSTNAME _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " "use gnulib module sethostname for portability"); # endif #endif #if @GNULIB_SLEEP@ /* Pause the execution of the current thread for N seconds. Returns the number of seconds left to sleep. See the POSIX:2008 specification . */ # if @REPLACE_SLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef sleep # define sleep rpl_sleep # endif _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); # else # if !@HAVE_SLEEP@ _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); # endif _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); # endif _GL_CXXALIASWARN (sleep); #elif defined GNULIB_POSIXCHECK # undef sleep # if HAVE_RAW_DECL_SLEEP _GL_WARN_ON_USE (sleep, "sleep is unportable - " "use gnulib module sleep for portability"); # endif #endif #if @GNULIB_MDA_SWAB@ /* On native Windows, map 'swab' to '_swab', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::swab always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef swab # define swab _swab # endif /* Need to cast, because in old mingw the arguments are (const char *from, char *to, size_t n). */ _GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n)); # else # if defined __hpux /* HP-UX */ _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n)); # elif defined __sun && !defined _XPG4 /* Solaris */ _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n)); # else _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n)); # endif # endif _GL_CXXALIASWARN (swab); #endif #if @GNULIB_SYMLINK@ # if @REPLACE_SYMLINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef symlink # define symlink rpl_symlink # endif _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); # else # if !@HAVE_SYMLINK@ _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); # endif _GL_CXXALIASWARN (symlink); #elif defined GNULIB_POSIXCHECK # undef symlink # if HAVE_RAW_DECL_SYMLINK _GL_WARN_ON_USE (symlink, "symlink is not portable - " "use gnulib module symlink for portability"); # endif #endif #if @GNULIB_SYMLINKAT@ # if @REPLACE_SYMLINKAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef symlinkat # define symlinkat rpl_symlinkat # endif _GL_FUNCDECL_RPL (symlinkat, int, (char const *contents, int fd, char const *file) _GL_ARG_NONNULL ((1, 3))); _GL_CXXALIAS_RPL (symlinkat, int, (char const *contents, int fd, char const *file)); # else # if !@HAVE_SYMLINKAT@ _GL_FUNCDECL_SYS (symlinkat, int, (char const *contents, int fd, char const *file) _GL_ARG_NONNULL ((1, 3))); # endif _GL_CXXALIAS_SYS (symlinkat, int, (char const *contents, int fd, char const *file)); # endif _GL_CXXALIASWARN (symlinkat); #elif defined GNULIB_POSIXCHECK # undef symlinkat # if HAVE_RAW_DECL_SYMLINKAT _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " "use gnulib module symlinkat for portability"); # endif #endif #if @GNULIB_TRUNCATE@ /* Change the size of the file designated by FILENAME to become equal to LENGTH. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification . */ # if @REPLACE_TRUNCATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef truncate # define truncate rpl_truncate # endif _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); # else # if !@HAVE_DECL_TRUNCATE@ _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); # endif _GL_CXXALIASWARN (truncate); #elif defined GNULIB_POSIXCHECK # undef truncate # if HAVE_RAW_DECL_TRUNCATE _GL_WARN_ON_USE (truncate, "truncate is unportable - " "use gnulib module truncate for portability"); # endif #endif #if @GNULIB_TTYNAME_R@ /* Store at most BUFLEN characters of the pathname of the terminal FD is open on in BUF. Return 0 on success, otherwise an error number. */ # if @REPLACE_TTYNAME_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ttyname_r # define ttyname_r rpl_ttyname_r # endif _GL_FUNCDECL_RPL (ttyname_r, int, (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (ttyname_r, int, (int fd, char *buf, size_t buflen)); # else # if !@HAVE_DECL_TTYNAME_R@ _GL_FUNCDECL_SYS (ttyname_r, int, (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (ttyname_r, int, (int fd, char *buf, size_t buflen)); # endif _GL_CXXALIASWARN (ttyname_r); #elif defined GNULIB_POSIXCHECK # undef ttyname_r # if HAVE_RAW_DECL_TTYNAME_R _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " "use gnulib module ttyname_r for portability"); # endif #endif #if @GNULIB_UNLINK@ # if @REPLACE_UNLINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef unlink # define unlink rpl_unlink # endif _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (unlink, int, (char const *file)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef unlink # define unlink _unlink # endif _GL_CXXALIAS_MDA (unlink, int, (char const *file)); # else _GL_CXXALIAS_SYS (unlink, int, (char const *file)); # endif _GL_CXXALIASWARN (unlink); #elif defined GNULIB_POSIXCHECK # undef unlink # if HAVE_RAW_DECL_UNLINK _GL_WARN_ON_USE (unlink, "unlink is not portable - " "use gnulib module unlink for portability"); # endif #elif @GNULIB_MDA_UNLINK@ /* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::unlink always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef unlink # define unlink _unlink # endif _GL_CXXALIAS_MDA (unlink, int, (char const *file)); # else _GL_CXXALIAS_SYS (unlink, int, (char const *file)); # endif _GL_CXXALIASWARN (unlink); #endif #if @GNULIB_UNLINKAT@ # if @REPLACE_UNLINKAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef unlinkat # define unlinkat rpl_unlinkat # endif _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); # else # if !@HAVE_UNLINKAT@ _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); # endif _GL_CXXALIASWARN (unlinkat); #elif defined GNULIB_POSIXCHECK # undef unlinkat # if HAVE_RAW_DECL_UNLINKAT _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " "use gnulib module unlinkat for portability"); # endif #endif #if @GNULIB_USLEEP@ /* Pause the execution of the current thread for N microseconds. Returns 0 on completion, or -1 on range error. See the POSIX:2001 specification . */ # if @REPLACE_USLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef usleep # define usleep rpl_usleep # endif _GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); _GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); # else # if !@HAVE_USLEEP@ _GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); # endif /* Need to cast, because on Haiku, the first parameter is unsigned int n. */ _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n)); # endif _GL_CXXALIASWARN (usleep); #elif defined GNULIB_POSIXCHECK # undef usleep # if HAVE_RAW_DECL_USLEEP _GL_WARN_ON_USE (usleep, "usleep is unportable - " "use gnulib module usleep for portability"); # endif #endif #if @GNULIB_WRITE@ /* Write up to COUNT bytes starting at BUF to file descriptor FD. See the POSIX:2008 specification . */ # if @REPLACE_WRITE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef write # define write rpl_write # endif _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef write # define write _write # endif _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count)); # else _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); # endif _GL_CXXALIASWARN (write); #elif @GNULIB_MDA_WRITE@ /* On native Windows, map 'write' to '_write', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::write always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef write # define write _write # endif # ifdef __MINGW32__ _GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count)); # else _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count)); # endif # else _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); # endif _GL_CXXALIASWARN (write); #endif _GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_UNISTD_H */ #endif /* _GL_INCLUDING_UNISTD_H */ #endif /* _@GUARD_PREFIX@_UNISTD_H */ kbuild-3608/src/grep/lib/stripslash.c0000664000175000017500000000306314670377426017562 0ustar locutuslocutus/* stripslash.c -- remove redundant trailing slashes from a file name Copyright (C) 1990, 2001, 2003-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include "dirname.h" /* Remove trailing slashes from FILE. Return true if a trailing slash was removed. This is useful when using file name completion from a shell that adds a "/" after directory names (such as tcsh and bash), because on symlinks to directories, several system calls have different semantics according to whether a trailing slash is present. */ bool strip_trailing_slashes (char *file) { char *base = last_component (file); char *base_lim; bool had_slash; /* last_component returns "" for file system roots, but we need to turn "///" into "/". */ if (! *base) base = file; base_lim = base + base_len (base); had_slash = (*base_lim != '\0'); *base_lim = '\0'; return had_slash; } kbuild-3608/src/grep/lib/unistr.in.h0000664000175000017500000005623014670377426017330 0ustar locutuslocutus/* Elementary Unicode string functions. Copyright (C) 2001-2002, 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _UNISTR_H #define _UNISTR_H #include "unitypes.h" /* Get bool. */ #include /* Get size_t, ptrdiff_t. */ #include /* Get free(). */ #include #ifdef __cplusplus extern "C" { #endif /* Conventions: All functions prefixed with u8_ operate on UTF-8 encoded strings. Their unit is an uint8_t (1 byte). All functions prefixed with u16_ operate on UTF-16 encoded strings. Their unit is an uint16_t (a 2-byte word). All functions prefixed with u32_ operate on UCS-4 encoded strings. Their unit is an uint32_t (a 4-byte word). All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly n units. All arguments starting with "str" and the arguments of functions starting with u8_str/u16_str/u32_str denote a NUL terminated string, i.e. a string which terminates at the first NUL unit. This termination unit is considered part of the string for all memory allocation purposes, but is not considered part of the string for all other logical purposes. Functions returning a string result take a (resultbuf, lengthp) argument pair. If resultbuf is not NULL and the result fits into *lengthp units, it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly allocated string is returned. In both cases, *lengthp is set to the length (number of units) of the returned string. In case of error, NULL is returned and errno is set. */ /* Elementary string checks. */ /* Check whether an UTF-8 string is well-formed. Return NULL if valid, or a pointer to the first invalid unit otherwise. */ extern const uint8_t * u8_check (const uint8_t *s, size_t n) _UC_ATTRIBUTE_PURE; /* Check whether an UTF-16 string is well-formed. Return NULL if valid, or a pointer to the first invalid unit otherwise. */ extern const uint16_t * u16_check (const uint16_t *s, size_t n) _UC_ATTRIBUTE_PURE; /* Check whether an UCS-4 string is well-formed. Return NULL if valid, or a pointer to the first invalid unit otherwise. */ extern const uint32_t * u32_check (const uint32_t *s, size_t n) _UC_ATTRIBUTE_PURE; /* Elementary string conversions. */ /* Convert an UTF-8 string to an UTF-16 string. */ extern uint16_t * u8_to_u16 (const uint8_t *s, size_t n, uint16_t *resultbuf, size_t *lengthp); /* Convert an UTF-8 string to an UCS-4 string. */ extern uint32_t * u8_to_u32 (const uint8_t *s, size_t n, uint32_t *resultbuf, size_t *lengthp); /* Convert an UTF-16 string to an UTF-8 string. */ extern uint8_t * u16_to_u8 (const uint16_t *s, size_t n, uint8_t *resultbuf, size_t *lengthp); /* Convert an UTF-16 string to an UCS-4 string. */ extern uint32_t * u16_to_u32 (const uint16_t *s, size_t n, uint32_t *resultbuf, size_t *lengthp); /* Convert an UCS-4 string to an UTF-8 string. */ extern uint8_t * u32_to_u8 (const uint32_t *s, size_t n, uint8_t *resultbuf, size_t *lengthp); /* Convert an UCS-4 string to an UTF-16 string. */ extern uint16_t * u32_to_u16 (const uint32_t *s, size_t n, uint16_t *resultbuf, size_t *lengthp); /* Elementary string functions. */ /* Return the length (number of units) of the first character in S, which is no longer than N. Return 0 if it is the NUL character. Return -1 upon failure. */ /* Similar to mblen(), except that s must not be NULL. */ extern int u8_mblen (const uint8_t *s, size_t n) _UC_ATTRIBUTE_PURE; extern int u16_mblen (const uint16_t *s, size_t n) _UC_ATTRIBUTE_PURE; extern int u32_mblen (const uint32_t *s, size_t n) _UC_ATTRIBUTE_PURE; /* Return the length (number of units) of the first character in S, putting its 'ucs4_t' representation in *PUC. Upon failure, *PUC is set to 0xfffd, and an appropriate number of units is returned. The number of available units, N, must be > 0. */ /* Similar to mbtowc(), except that puc and s must not be NULL, n must be > 0, and the NUL character is not treated specially. */ /* The variants with _unsafe suffix are for backward compatibility with libunistring versions < 0.9.7. */ #if GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING # if !HAVE_INLINE extern int u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n); # else extern int u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n); static inline int u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n) { uint8_t c = *s; if (c < 0x80) { *puc = c; return 1; } else return u8_mbtouc_unsafe_aux (puc, s, n); } # endif #endif #if GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING # if !HAVE_INLINE extern int u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n); # else extern int u16_mbtouc_unsafe_aux (ucs4_t *puc, const uint16_t *s, size_t n); static inline int u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n) { uint16_t c = *s; if (c < 0xd800 || c >= 0xe000) { *puc = c; return 1; } else return u16_mbtouc_unsafe_aux (puc, s, n); } # endif #endif #if GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING # if !HAVE_INLINE extern int u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n); # else static inline int u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, _GL_ATTRIBUTE_MAYBE_UNUSED size_t n) { uint32_t c = *s; if (c < 0xd800 || (c >= 0xe000 && c < 0x110000)) *puc = c; else /* invalid multibyte character */ *puc = 0xfffd; return 1; } # endif #endif #if GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING # if !HAVE_INLINE extern int u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n); # else extern int u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n); static inline int u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n) { uint8_t c = *s; if (c < 0x80) { *puc = c; return 1; } else return u8_mbtouc_aux (puc, s, n); } # endif #endif #if GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING # if !HAVE_INLINE extern int u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n); # else extern int u16_mbtouc_aux (ucs4_t *puc, const uint16_t *s, size_t n); static inline int u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n) { uint16_t c = *s; if (c < 0xd800 || c >= 0xe000) { *puc = c; return 1; } else return u16_mbtouc_aux (puc, s, n); } # endif #endif #if GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING # if !HAVE_INLINE extern int u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n); # else static inline int u32_mbtouc (ucs4_t *puc, const uint32_t *s, _GL_ATTRIBUTE_MAYBE_UNUSED size_t n) { uint32_t c = *s; if (c < 0xd800 || (c >= 0xe000 && c < 0x110000)) *puc = c; else /* invalid multibyte character */ *puc = 0xfffd; return 1; } # endif #endif /* Return the length (number of units) of the first character in S, putting its 'ucs4_t' representation in *PUC. Upon failure, *PUC is set to 0xfffd, and -1 is returned for an invalid sequence of units, -2 is returned for an incomplete sequence of units. The number of available units, N, must be > 0. */ /* Similar to u*_mbtouc(), except that the return value gives more details about the failure, similar to mbrtowc(). */ #if GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING extern int u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n); #endif #if GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING extern int u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n); #endif #if GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING extern int u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n); #endif /* Put the multibyte character represented by UC in S, returning its length. Return -1 upon failure, -2 if the number of available units, N, is too small. The latter case cannot occur if N >= 6/2/1, respectively. */ /* Similar to wctomb(), except that s must not be NULL, and the argument n must be specified. */ #if GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING /* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr. */ extern int u8_uctomb_aux (uint8_t *s, ucs4_t uc, ptrdiff_t n); # if !HAVE_INLINE extern int u8_uctomb (uint8_t *s, ucs4_t uc, ptrdiff_t n); # else static inline int u8_uctomb (uint8_t *s, ucs4_t uc, ptrdiff_t n) { if (uc < 0x80 && n > 0) { s[0] = uc; return 1; } else return u8_uctomb_aux (s, uc, n); } # endif #endif #if GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING /* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr. */ extern int u16_uctomb_aux (uint16_t *s, ucs4_t uc, ptrdiff_t n); # if !HAVE_INLINE extern int u16_uctomb (uint16_t *s, ucs4_t uc, ptrdiff_t n); # else static inline int u16_uctomb (uint16_t *s, ucs4_t uc, ptrdiff_t n) { if (uc < 0xd800 && n > 0) { s[0] = uc; return 1; } else return u16_uctomb_aux (s, uc, n); } # endif #endif #if GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING # if !HAVE_INLINE extern int u32_uctomb (uint32_t *s, ucs4_t uc, ptrdiff_t n); # else static inline int u32_uctomb (uint32_t *s, ucs4_t uc, ptrdiff_t n) { if (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000)) { if (n > 0) { *s = uc; return 1; } else return -2; } else return -1; } # endif #endif /* Copy N units from SRC to DEST. */ /* Similar to memcpy(). */ extern uint8_t * u8_cpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n); extern uint16_t * u16_cpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n); extern uint32_t * u32_cpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n); /* Copy N units from SRC to DEST, guaranteeing correct behavior for overlapping memory areas. */ /* Similar to memmove(). */ extern uint8_t * u8_move (uint8_t *dest, const uint8_t *src, size_t n); extern uint16_t * u16_move (uint16_t *dest, const uint16_t *src, size_t n); extern uint32_t * u32_move (uint32_t *dest, const uint32_t *src, size_t n); /* Set the first N characters of S to UC. UC should be a character that occupies only 1 unit. */ /* Similar to memset(). */ extern uint8_t * u8_set (uint8_t *s, ucs4_t uc, size_t n); extern uint16_t * u16_set (uint16_t *s, ucs4_t uc, size_t n); extern uint32_t * u32_set (uint32_t *s, ucs4_t uc, size_t n); /* Compare S1 and S2, each of length N. */ /* Similar to memcmp(). */ extern int u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n) _UC_ATTRIBUTE_PURE; extern int u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n) _UC_ATTRIBUTE_PURE; extern int u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n) _UC_ATTRIBUTE_PURE; /* Compare S1 and S2. */ /* Similar to the gnulib function memcmp2(). */ extern int u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2) _UC_ATTRIBUTE_PURE; extern int u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2) _UC_ATTRIBUTE_PURE; extern int u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2) _UC_ATTRIBUTE_PURE; /* Search the string at S for UC. */ /* Similar to memchr(). */ extern uint8_t * u8_chr (const uint8_t *s, size_t n, ucs4_t uc) _UC_ATTRIBUTE_PURE; extern uint16_t * u16_chr (const uint16_t *s, size_t n, ucs4_t uc) _UC_ATTRIBUTE_PURE; extern uint32_t * u32_chr (const uint32_t *s, size_t n, ucs4_t uc) _UC_ATTRIBUTE_PURE; /* Count the number of Unicode characters in the N units from S. */ /* Similar to mbsnlen(). */ extern size_t u8_mbsnlen (const uint8_t *s, size_t n) _UC_ATTRIBUTE_PURE; extern size_t u16_mbsnlen (const uint16_t *s, size_t n) _UC_ATTRIBUTE_PURE; extern size_t u32_mbsnlen (const uint32_t *s, size_t n) _UC_ATTRIBUTE_PURE; /* Elementary string functions with memory allocation. */ /* Make a freshly allocated copy of S, of length N. */ extern uint8_t * u8_cpy_alloc (const uint8_t *s, size_t n); extern uint16_t * u16_cpy_alloc (const uint16_t *s, size_t n); extern uint32_t * u32_cpy_alloc (const uint32_t *s, size_t n); /* Elementary string functions on NUL terminated strings. */ /* Return the length (number of units) of the first character in S. Return 0 if it is the NUL character. Return -1 upon failure. */ extern int u8_strmblen (const uint8_t *s) _UC_ATTRIBUTE_PURE; extern int u16_strmblen (const uint16_t *s) _UC_ATTRIBUTE_PURE; extern int u32_strmblen (const uint32_t *s) _UC_ATTRIBUTE_PURE; /* Return the length (number of units) of the first character in S, putting its 'ucs4_t' representation in *PUC. Return 0 if it is the NUL character. Return -1 upon failure. */ extern int u8_strmbtouc (ucs4_t *puc, const uint8_t *s); extern int u16_strmbtouc (ucs4_t *puc, const uint16_t *s); extern int u32_strmbtouc (ucs4_t *puc, const uint32_t *s); /* Forward iteration step. Advances the pointer past the next character, or returns NULL if the end of the string has been reached. Puts the character's 'ucs4_t' representation in *PUC. */ extern const uint8_t * u8_next (ucs4_t *puc, const uint8_t *s); extern const uint16_t * u16_next (ucs4_t *puc, const uint16_t *s); extern const uint32_t * u32_next (ucs4_t *puc, const uint32_t *s); /* Backward iteration step. Advances the pointer to point to the previous character, or returns NULL if the beginning of the string had been reached. Puts the character's 'ucs4_t' representation in *PUC. */ extern const uint8_t * u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start); extern const uint16_t * u16_prev (ucs4_t *puc, const uint16_t *s, const uint16_t *start); extern const uint32_t * u32_prev (ucs4_t *puc, const uint32_t *s, const uint32_t *start); /* Return the number of units in S. */ /* Similar to strlen(), wcslen(). */ extern size_t u8_strlen (const uint8_t *s) _UC_ATTRIBUTE_PURE; extern size_t u16_strlen (const uint16_t *s) _UC_ATTRIBUTE_PURE; extern size_t u32_strlen (const uint32_t *s) _UC_ATTRIBUTE_PURE; /* Return the number of units in S, but at most MAXLEN. */ /* Similar to strnlen(), wcsnlen(). */ extern size_t u8_strnlen (const uint8_t *s, size_t maxlen) _UC_ATTRIBUTE_PURE; extern size_t u16_strnlen (const uint16_t *s, size_t maxlen) _UC_ATTRIBUTE_PURE; extern size_t u32_strnlen (const uint32_t *s, size_t maxlen) _UC_ATTRIBUTE_PURE; /* Copy SRC to DEST. */ /* Similar to strcpy(), wcscpy(). */ extern uint8_t * u8_strcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src); extern uint16_t * u16_strcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src); extern uint32_t * u32_strcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src); /* Copy SRC to DEST, returning the address of the terminating NUL in DEST. */ /* Similar to stpcpy(). */ extern uint8_t * u8_stpcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src); extern uint16_t * u16_stpcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src); extern uint32_t * u32_stpcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src); /* Copy no more than N units of SRC to DEST. */ /* Similar to strncpy(), wcsncpy(). */ extern uint8_t * u8_strncpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n); extern uint16_t * u16_strncpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n); extern uint32_t * u32_strncpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n); /* Copy no more than N units of SRC to DEST. Return a pointer past the last non-NUL unit written into DEST. */ /* Similar to stpncpy(). */ extern uint8_t * u8_stpncpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n); extern uint16_t * u16_stpncpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n); extern uint32_t * u32_stpncpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n); /* Append SRC onto DEST. */ /* Similar to strcat(), wcscat(). */ extern uint8_t * u8_strcat (uint8_t *_UC_RESTRICT dest, const uint8_t *src); extern uint16_t * u16_strcat (uint16_t *_UC_RESTRICT dest, const uint16_t *src); extern uint32_t * u32_strcat (uint32_t *_UC_RESTRICT dest, const uint32_t *src); /* Append no more than N units of SRC onto DEST. */ /* Similar to strncat(), wcsncat(). */ extern uint8_t * u8_strncat (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n); extern uint16_t * u16_strncat (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n); extern uint32_t * u32_strncat (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n); /* Compare S1 and S2. */ /* Similar to strcmp(), wcscmp(). */ #ifdef __sun /* Avoid a collision with the u8_strcmp() function in Solaris 11 libc. */ extern int u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2) _UC_ATTRIBUTE_PURE; # define u8_strcmp u8_strcmp_gnu #else extern int u8_strcmp (const uint8_t *s1, const uint8_t *s2) _UC_ATTRIBUTE_PURE; #endif extern int u16_strcmp (const uint16_t *s1, const uint16_t *s2) _UC_ATTRIBUTE_PURE; extern int u32_strcmp (const uint32_t *s1, const uint32_t *s2) _UC_ATTRIBUTE_PURE; /* Compare S1 and S2 using the collation rules of the current locale. Return -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2. Upon failure, set errno and return any value. */ /* Similar to strcoll(), wcscoll(). */ extern int u8_strcoll (const uint8_t *s1, const uint8_t *s2); extern int u16_strcoll (const uint16_t *s1, const uint16_t *s2); extern int u32_strcoll (const uint32_t *s1, const uint32_t *s2); /* Compare no more than N units of S1 and S2. */ /* Similar to strncmp(), wcsncmp(). */ extern int u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n) _UC_ATTRIBUTE_PURE; extern int u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n) _UC_ATTRIBUTE_PURE; extern int u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n) _UC_ATTRIBUTE_PURE; /* Duplicate S, returning an identical malloc'd string. */ /* Similar to strdup(), wcsdup(). */ extern uint8_t * u8_strdup (const uint8_t *s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; extern uint16_t * u16_strdup (const uint16_t *s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; extern uint32_t * u32_strdup (const uint32_t *s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; /* Find the first occurrence of UC in STR. */ /* Similar to strchr(), wcschr(). */ extern uint8_t * u8_strchr (const uint8_t *str, ucs4_t uc) _UC_ATTRIBUTE_PURE; extern uint16_t * u16_strchr (const uint16_t *str, ucs4_t uc) _UC_ATTRIBUTE_PURE; extern uint32_t * u32_strchr (const uint32_t *str, ucs4_t uc) _UC_ATTRIBUTE_PURE; /* Find the last occurrence of UC in STR. */ /* Similar to strrchr(), wcsrchr(). */ extern uint8_t * u8_strrchr (const uint8_t *str, ucs4_t uc) _UC_ATTRIBUTE_PURE; extern uint16_t * u16_strrchr (const uint16_t *str, ucs4_t uc) _UC_ATTRIBUTE_PURE; extern uint32_t * u32_strrchr (const uint32_t *str, ucs4_t uc) _UC_ATTRIBUTE_PURE; /* Return the length of the initial segment of STR which consists entirely of Unicode characters not in REJECT. */ /* Similar to strcspn(), wcscspn(). */ extern size_t u8_strcspn (const uint8_t *str, const uint8_t *reject) _UC_ATTRIBUTE_PURE; extern size_t u16_strcspn (const uint16_t *str, const uint16_t *reject) _UC_ATTRIBUTE_PURE; extern size_t u32_strcspn (const uint32_t *str, const uint32_t *reject) _UC_ATTRIBUTE_PURE; /* Return the length of the initial segment of STR which consists entirely of Unicode characters in ACCEPT. */ /* Similar to strspn(), wcsspn(). */ extern size_t u8_strspn (const uint8_t *str, const uint8_t *accept) _UC_ATTRIBUTE_PURE; extern size_t u16_strspn (const uint16_t *str, const uint16_t *accept) _UC_ATTRIBUTE_PURE; extern size_t u32_strspn (const uint32_t *str, const uint32_t *accept) _UC_ATTRIBUTE_PURE; /* Find the first occurrence in STR of any character in ACCEPT. */ /* Similar to strpbrk(), wcspbrk(). */ extern uint8_t * u8_strpbrk (const uint8_t *str, const uint8_t *accept) _UC_ATTRIBUTE_PURE; extern uint16_t * u16_strpbrk (const uint16_t *str, const uint16_t *accept) _UC_ATTRIBUTE_PURE; extern uint32_t * u32_strpbrk (const uint32_t *str, const uint32_t *accept) _UC_ATTRIBUTE_PURE; /* Find the first occurrence of NEEDLE in HAYSTACK. */ /* Similar to strstr(), wcsstr(). */ extern uint8_t * u8_strstr (const uint8_t *haystack, const uint8_t *needle) _UC_ATTRIBUTE_PURE; extern uint16_t * u16_strstr (const uint16_t *haystack, const uint16_t *needle) _UC_ATTRIBUTE_PURE; extern uint32_t * u32_strstr (const uint32_t *haystack, const uint32_t *needle) _UC_ATTRIBUTE_PURE; /* Test whether STR starts with PREFIX. */ extern bool u8_startswith (const uint8_t *str, const uint8_t *prefix) _UC_ATTRIBUTE_PURE; extern bool u16_startswith (const uint16_t *str, const uint16_t *prefix) _UC_ATTRIBUTE_PURE; extern bool u32_startswith (const uint32_t *str, const uint32_t *prefix) _UC_ATTRIBUTE_PURE; /* Test whether STR ends with SUFFIX. */ extern bool u8_endswith (const uint8_t *str, const uint8_t *suffix) _UC_ATTRIBUTE_PURE; extern bool u16_endswith (const uint16_t *str, const uint16_t *suffix) _UC_ATTRIBUTE_PURE; extern bool u32_endswith (const uint32_t *str, const uint32_t *suffix) _UC_ATTRIBUTE_PURE; /* Divide STR into tokens separated by characters in DELIM. This interface is actually more similar to wcstok than to strtok. */ /* Similar to strtok_r(), wcstok(). */ extern uint8_t * u8_strtok (uint8_t *_UC_RESTRICT str, const uint8_t *delim, uint8_t **ptr); extern uint16_t * u16_strtok (uint16_t *_UC_RESTRICT str, const uint16_t *delim, uint16_t **ptr); extern uint32_t * u32_strtok (uint32_t *_UC_RESTRICT str, const uint32_t *delim, uint32_t **ptr); #ifdef __cplusplus } #endif #endif /* _UNISTR_H */ kbuild-3608/src/grep/lib/windows-once.h0000664000175000017500000000260214670377426020005 0ustar locutuslocutus/* Once-only control (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-win32.h. */ #ifndef _WINDOWS_ONCE_H #define _WINDOWS_ONCE_H #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include typedef struct { volatile int inited; volatile LONG started; CRITICAL_SECTION lock; } glwthread_once_t; #define GLWTHREAD_ONCE_INIT { -1, -1 } #ifdef __cplusplus extern "C" { #endif extern void glwthread_once (glwthread_once_t *once_control, void (*initfunction) (void)); #ifdef __cplusplus } #endif #endif /* _WINDOWS_ONCE_H */ kbuild-3608/src/grep/lib/colorize-w32.c0000664000175000017500000001462414670377422017626 0ustar locutuslocutus/* Output colorization on MS-Windows. Copyright 2011-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Eli Zaretskii. */ #include #include "colorize.h" #include #include #include #include #undef DATADIR /* conflicts with objidl.h, which is included by windows.h */ #include static HANDLE hstdout = INVALID_HANDLE_VALUE; static SHORT norm_attr; /* Initialize the normal text attribute used by the console. */ void init_colorize (void) { CONSOLE_SCREEN_BUFFER_INFO csbi; hstdout = GetStdHandle (STD_OUTPUT_HANDLE); if (hstdout != INVALID_HANDLE_VALUE && GetConsoleScreenBufferInfo (hstdout, &csbi)) norm_attr = csbi.wAttributes; else hstdout = INVALID_HANDLE_VALUE; } /* Return non-zero if we should highlight matches in output. */ int should_colorize (void) { /* $TERM is not normally defined on DOS/Windows, so don't require it for highlighting. But some programs, like Emacs, do define it when running Grep as a subprocess, so make sure they don't set TERM=dumb. */ char const *t = getenv ("TERM"); return ! (t && strcmp (t, "dumb") == 0); } /* Convert a color spec, a semi-colon separated list of the form "NN;MM;KK;...", where each number is a value of the SGR parameter, into the corresponding Windows console text attribute. This function supports a subset of the SGR rendition aspects that the Windows console can display. */ static int w32_sgr2attr (const char *sgr_seq) { const char *s, *p; int code, fg = norm_attr & 15, bg = norm_attr & (15 << 4); int bright = 0, inverse = 0; static const int fg_color[] = { 0, /* black */ FOREGROUND_RED, /* red */ FOREGROUND_GREEN, /* green */ FOREGROUND_GREEN | FOREGROUND_RED, /* yellow */ FOREGROUND_BLUE, /* blue */ FOREGROUND_BLUE | FOREGROUND_RED, /* magenta */ FOREGROUND_BLUE | FOREGROUND_GREEN, /* cyan */ FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE /* gray */ }; static const int bg_color[] = { 0, /* black */ BACKGROUND_RED, /* red */ BACKGROUND_GREEN, /* green */ BACKGROUND_GREEN | BACKGROUND_RED, /* yellow */ BACKGROUND_BLUE, /* blue */ BACKGROUND_BLUE | BACKGROUND_RED, /* magenta */ BACKGROUND_BLUE | BACKGROUND_GREEN, /* cyan */ BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE /* gray */ }; for (s = p = sgr_seq; *s; p++) { if (*p == ';' || *p == '\0') { code = strtol (s, NULL, 10); s = p + (*p != '\0'); switch (code) { case 0: /* all attributes off */ fg = norm_attr & 15; bg = norm_attr & (15 << 4); bright = 0; inverse = 0; break; case 1: /* intensity on */ bright = 1; break; case 7: /* inverse video */ inverse = 1; break; case 22: /* intensity off */ bright = 0; break; case 27: /* inverse off */ inverse = 0; break; case 30: case 31: case 32: case 33: /* foreground color */ case 34: case 35: case 36: case 37: fg = fg_color[code - 30]; break; case 39: /* default foreground */ fg = norm_attr & 15; break; case 40: case 41: case 42: case 43: /* background color */ case 44: case 45: case 46: case 47: bg = bg_color[code - 40]; break; case 49: /* default background */ bg = norm_attr & (15 << 4); break; default: break; } } } if (inverse) { int t = fg; fg = (bg >> 4); bg = (t << 4); } if (bright) fg |= FOREGROUND_INTENSITY; return (bg & (15 << 4)) | (fg & 15); } /* Start a colorized text attribute on stdout using the SGR_START format; the attribute is specified by SGR_SEQ. */ void print_start_colorize (char const *sgr_start, char const *sgr_seq) { /* If stdout is connected to a console, set the console text attribute directly instead of using SGR_START. Otherwise, use SGR_START to emit the SGR escape sequence as on Posix platforms; this is needed when Grep is invoked as a subprocess of another program, such as Emacs, which will handle the display of the matches. */ if (hstdout != INVALID_HANDLE_VALUE) { SHORT attr = w32_sgr2attr (sgr_seq); SetConsoleTextAttribute (hstdout, attr); } else printf (sgr_start, sgr_seq); } /* Clear to the end of the current line with the default attribute. This is needed for reasons similar to those that require the "EL to Right after SGR" operation on Posix platforms: if we don't do this, setting the 'mt', 'ms', or 'mc' capabilities to use a non-default background color spills that color to the empty space at the end of the last screen line in a match whose line spans multiple screen lines. */ static void w32_clreol (void) { DWORD nchars; COORD start_pos; DWORD written; CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo (hstdout, &csbi); start_pos = csbi.dwCursorPosition; nchars = csbi.dwSize.X - start_pos.X; FillConsoleOutputAttribute (hstdout, norm_attr, nchars, start_pos, &written); FillConsoleOutputCharacter (hstdout, ' ', nchars, start_pos, &written); } /* Restore the normal text attribute using the SGR_END string. */ void print_end_colorize (char const *sgr_end) { if (hstdout != INVALID_HANDLE_VALUE) { SetConsoleTextAttribute (hstdout, norm_attr); w32_clreol (); } else fputs (sgr_end, stdout); } kbuild-3608/src/grep/lib/striconv.c0000664000175000017500000003047014670377426017237 0ustar locutuslocutus/* Charset conversion. Copyright (C) 2001-2007, 2010-2021 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "striconv.h" #include #include #include #if HAVE_ICONV # include /* Get MB_LEN_MAX, CHAR_BIT. */ # include #endif #include "c-strcase.h" #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif #if HAVE_ICONV int mem_cd_iconv (const char *src, size_t srclen, iconv_t cd, char **resultp, size_t *lengthp) { # define tmpbufsize 4096 size_t length; char *result; /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */ # if defined _LIBICONV_VERSION \ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ || defined __sun) /* Set to the initial state. */ iconv (cd, NULL, NULL, NULL, NULL); # endif /* Determine the length we need. */ { size_t count = 0; /* The alignment is needed when converting e.g. to glibc's WCHAR_T or libiconv's UCS-4-INTERNAL encoding. */ union { unsigned int align; char buf[tmpbufsize]; } tmp; # define tmpbuf tmp.buf const char *inptr = src; size_t insize = srclen; while (insize > 0) { char *outptr = tmpbuf; size_t outsize = tmpbufsize; size_t res = iconv (cd, (ICONV_CONST char **) &inptr, &insize, &outptr, &outsize); if (res == (size_t)(-1)) { if (errno == E2BIG) ; else if (errno == EINVAL) break; else return -1; } # if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. Only GNU libiconv and GNU libc are known to prefer to fail rather than doing a lossy conversion. */ else if (res > 0) { errno = EILSEQ; return -1; } # endif count += outptr - tmpbuf; } /* Avoid glibc-2.1 bug and Solaris 2.7 bug. */ # if defined _LIBICONV_VERSION \ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ || defined __sun) { char *outptr = tmpbuf; size_t outsize = tmpbufsize; size_t res = iconv (cd, NULL, NULL, &outptr, &outsize); if (res == (size_t)(-1)) return -1; count += outptr - tmpbuf; } # endif length = count; # undef tmpbuf } if (length == 0) { *lengthp = 0; return 0; } if (*resultp != NULL && *lengthp >= length) result = *resultp; else { result = (char *) malloc (length); if (result == NULL) { errno = ENOMEM; return -1; } } /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */ # if defined _LIBICONV_VERSION \ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ || defined __sun) /* Return to the initial state. */ iconv (cd, NULL, NULL, NULL, NULL); # endif /* Do the conversion for real. */ { const char *inptr = src; size_t insize = srclen; char *outptr = result; size_t outsize = length; while (insize > 0) { size_t res = iconv (cd, (ICONV_CONST char **) &inptr, &insize, &outptr, &outsize); if (res == (size_t)(-1)) { if (errno == EINVAL) break; else goto fail; } # if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. Only GNU libiconv and GNU libc are known to prefer to fail rather than doing a lossy conversion. */ else if (res > 0) { errno = EILSEQ; goto fail; } # endif } /* Avoid glibc-2.1 bug and Solaris 2.7 bug. */ # if defined _LIBICONV_VERSION \ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ || defined __sun) { size_t res = iconv (cd, NULL, NULL, &outptr, &outsize); if (res == (size_t)(-1)) goto fail; } # endif if (outsize != 0) abort (); } *resultp = result; *lengthp = length; return 0; fail: { if (result != *resultp) free (result); return -1; } # undef tmpbufsize } char * str_cd_iconv (const char *src, iconv_t cd) { /* For most encodings, a trailing NUL byte in the input will be converted to a trailing NUL byte in the output. But not for UTF-7. So that this function is usable for UTF-7, we have to exclude the NUL byte from the conversion and add it by hand afterwards. */ # if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. Only GNU libiconv and GNU libc are known to prefer to fail rather than doing a lossy conversion. For other iconv() implementations, we have to look at the number of irreversible conversions returned; but this information is lost when iconv() returns for an E2BIG reason. Therefore we cannot use the second, faster algorithm. */ char *result = NULL; size_t length = 0; int retval = mem_cd_iconv (src, strlen (src), cd, &result, &length); char *final_result; if (retval < 0) { if (result != NULL) abort (); return NULL; } /* Add the terminating NUL byte. */ final_result = (result != NULL ? realloc (result, length + 1) : malloc (length + 1)); if (final_result == NULL) { free (result); errno = ENOMEM; return NULL; } final_result[length] = '\0'; return final_result; # else /* This algorithm is likely faster than the one above. But it may produce iconv() returns for an E2BIG reason, when the output size guess is too small. Therefore it can only be used when we don't need the number of irreversible conversions performed. */ char *result; size_t result_size; size_t length; const char *inptr = src; size_t inbytes_remaining = strlen (src); /* Make a guess for the worst-case output size, in order to avoid a realloc. It's OK if the guess is wrong as long as it is not zero and doesn't lead to an integer overflow. */ result_size = inbytes_remaining; { size_t approx_sqrt_SIZE_MAX = SIZE_MAX >> (sizeof (size_t) * CHAR_BIT / 2); if (result_size <= approx_sqrt_SIZE_MAX / MB_LEN_MAX) result_size *= MB_LEN_MAX; } result_size += 1; /* for the terminating NUL */ result = (char *) malloc (result_size); if (result == NULL) { errno = ENOMEM; return NULL; } /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */ # if defined _LIBICONV_VERSION \ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ || defined __sun) /* Set to the initial state. */ iconv (cd, NULL, NULL, NULL, NULL); # endif /* Do the conversion. */ { char *outptr = result; size_t outbytes_remaining = result_size - 1; for (;;) { /* Here inptr + inbytes_remaining = src + strlen (src), outptr + outbytes_remaining = result + result_size - 1. */ size_t res = iconv (cd, (ICONV_CONST char **) &inptr, &inbytes_remaining, &outptr, &outbytes_remaining); if (res == (size_t)(-1)) { if (errno == EINVAL) break; else if (errno == E2BIG) { size_t used = outptr - result; size_t newsize = result_size * 2; char *newresult; if (!(newsize > result_size)) { errno = ENOMEM; goto failed; } newresult = (char *) realloc (result, newsize); if (newresult == NULL) { errno = ENOMEM; goto failed; } result = newresult; result_size = newsize; outptr = result + used; outbytes_remaining = result_size - 1 - used; } else goto failed; } else break; } /* Avoid glibc-2.1 bug and Solaris 2.7 bug. */ # if defined _LIBICONV_VERSION \ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ || defined __sun) for (;;) { /* Here outptr + outbytes_remaining = result + result_size - 1. */ size_t res = iconv (cd, NULL, NULL, &outptr, &outbytes_remaining); if (res == (size_t)(-1)) { if (errno == E2BIG) { size_t used = outptr - result; size_t newsize = result_size * 2; char *newresult; if (!(newsize > result_size)) { errno = ENOMEM; goto failed; } newresult = (char *) realloc (result, newsize); if (newresult == NULL) { errno = ENOMEM; goto failed; } result = newresult; result_size = newsize; outptr = result + used; outbytes_remaining = result_size - 1 - used; } else goto failed; } else break; } # endif /* Add the terminating NUL byte. */ *outptr++ = '\0'; length = outptr - result; } /* Give away unused memory. */ if (length < result_size) { char *smaller_result = (char *) realloc (result, length); if (smaller_result != NULL) result = smaller_result; } return result; failed: free (result); return NULL; # endif } #endif char * str_iconv (const char *src, const char *from_codeset, const char *to_codeset) { if (*src == '\0' || c_strcasecmp (from_codeset, to_codeset) == 0) { char *result = strdup (src); if (result == NULL) errno = ENOMEM; return result; } else { #if HAVE_ICONV iconv_t cd; char *result; /* Avoid glibc-2.1 bug with EUC-KR. */ # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ && !defined _LIBICONV_VERSION if (c_strcasecmp (from_codeset, "EUC-KR") == 0 || c_strcasecmp (to_codeset, "EUC-KR") == 0) { errno = EINVAL; return NULL; } # endif cd = iconv_open (to_codeset, from_codeset); if (cd == (iconv_t) -1) return NULL; result = str_cd_iconv (src, cd); if (result == NULL) { /* Close cd, but preserve the errno from str_cd_iconv. */ int saved_errno = errno; iconv_close (cd); errno = saved_errno; } else { if (iconv_close (cd) < 0) { free (result); return NULL; } } return result; #else /* This is a different error code than if iconv_open existed but didn't support from_codeset and to_codeset, so that the caller can emit an error message such as "iconv() is not supported. Installing GNU libiconv and then reinstalling this package would fix this." */ errno = ENOSYS; return NULL; #endif } } kbuild-3608/src/grep/lib/save-cwd.c0000664000175000017500000000575114670377426017105 0ustar locutuslocutus/* save-cwd.c -- Save and restore current working directory. Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2021 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 . */ /* Written by Jim Meyering. */ #include #include "save-cwd.h" #include #include #include #include #include #include "chdir-long.h" #include "unistd--.h" #if GNULIB_FCNTL_SAFER # include "fcntl--.h" #else # define GNULIB_FCNTL_SAFER 0 #endif /* Record the location of the current working directory in CWD so that the program may change to other directories and later use restore_cwd to return to the recorded location. This function may allocate space using malloc (via getcwd) or leave a file descriptor open; use free_cwd to perform the necessary free or close. Upon failure, no memory is allocated, any locally opened file descriptors are closed; return non-zero -- in that case, free_cwd need not be called, but doing so is ok. Otherwise, return zero. The _raison d'etre_ for this interface is that the working directory is sometimes inaccessible, and getcwd is not robust or as efficient. So, we prefer to use the open/fchdir approach, but fall back on getcwd if necessary. This module works for most cases with just the getcwd-lgpl module, but to be truly robust, use the getcwd module. Some systems lack fchdir altogether: e.g., OS/2, pre-2001 Cygwin, SCO Xenix. Also, SunOS 4 and Irix 5.3 provide the function, yet it doesn't work for partitions on which auditing is enabled. If you're still using an obsolete system with these problems, please send email to the maintainer of this code. */ int save_cwd (struct saved_cwd *cwd) { cwd->name = NULL; cwd->desc = open (".", O_SEARCH | O_CLOEXEC); if (!GNULIB_FCNTL_SAFER) cwd->desc = fd_safer_flag (cwd->desc, O_CLOEXEC); if (cwd->desc < 0) { cwd->name = getcwd (NULL, 0); return cwd->name ? 0 : -1; } return 0; } /* Change to recorded location, CWD, in directory hierarchy. Upon failure, return -1 (errno is set by chdir or fchdir). Upon success, return zero. */ int restore_cwd (const struct saved_cwd *cwd) { if (0 <= cwd->desc) return fchdir (cwd->desc); else return chdir_long (cwd->name); } void free_cwd (struct saved_cwd *cwd) { if (cwd->desc >= 0) close (cwd->desc); free (cwd->name); } kbuild-3608/src/grep/lib/dirent.in.h0000664000175000017500000002377414670377423017275 0ustar locutuslocutus/* A GNU-like . Copyright (C) 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_DIRENT_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_DIRENT_H@ # @INCLUDE_NEXT@ @NEXT_DIRENT_H@ #endif #ifndef _@GUARD_PREFIX@_DIRENT_H #define _@GUARD_PREFIX@_DIRENT_H /* Get ino_t. Needed on some systems, including glibc 2.8. */ #include #if !@HAVE_DIRENT_H@ /* Define types DIR and 'struct dirent'. */ # if !GNULIB_defined_struct_dirent struct dirent { char d_type; char d_name[1]; }; /* Possible values for 'd_type'. */ # define DT_UNKNOWN 0 # define DT_FIFO 1 /* FIFO */ # define DT_CHR 2 /* character device */ # define DT_DIR 4 /* directory */ # define DT_BLK 6 /* block device */ # define DT_REG 8 /* regular file */ # define DT_LNK 10 /* symbolic link */ # define DT_SOCK 12 /* socket */ # define DT_WHT 14 /* whiteout */ typedef struct gl_directory DIR; # define GNULIB_defined_struct_dirent 1 # endif #endif /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ #ifndef _GL_ATTRIBUTE_PURE # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define _GL_ATTRIBUTE_PURE /* empty */ # endif #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Declare overridden functions. */ #if @GNULIB_CLOSEDIR@ # if @REPLACE_CLOSEDIR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef closedir # define closedir rpl_closedir # define GNULIB_defined_closedir 1 # endif _GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (closedir, int, (DIR *dirp)); # else # if !@HAVE_CLOSEDIR@ _GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (closedir, int, (DIR *dirp)); # endif _GL_CXXALIASWARN (closedir); #elif defined GNULIB_POSIXCHECK # undef closedir # if HAVE_RAW_DECL_CLOSEDIR _GL_WARN_ON_USE (closedir, "closedir is not portable - " "use gnulib module closedir for portability"); # endif #endif #if @GNULIB_OPENDIR@ # if @REPLACE_OPENDIR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef opendir # define opendir rpl_opendir # define GNULIB_defined_opendir 1 # endif _GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name)); # else # if !@HAVE_OPENDIR@ || __GNUC__ >= 11 _GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); # endif _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name)); # endif _GL_CXXALIASWARN (opendir); #else # if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined opendir /* For -Wmismatched-dealloc: Associate opendir with closedir or rpl_closedir. */ _GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); # endif # if defined GNULIB_POSIXCHECK # undef opendir # if HAVE_RAW_DECL_OPENDIR _GL_WARN_ON_USE (opendir, "opendir is not portable - " "use gnulib module opendir for portability"); # endif # endif #endif #if @GNULIB_READDIR@ # if !@HAVE_READDIR@ _GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp)); _GL_CXXALIASWARN (readdir); #elif defined GNULIB_POSIXCHECK # undef readdir # if HAVE_RAW_DECL_READDIR _GL_WARN_ON_USE (readdir, "readdir is not portable - " "use gnulib module readdir for portability"); # endif #endif #if @GNULIB_REWINDDIR@ # if !@HAVE_REWINDDIR@ _GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp)); _GL_CXXALIASWARN (rewinddir); #elif defined GNULIB_POSIXCHECK # undef rewinddir # if HAVE_RAW_DECL_REWINDDIR _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - " "use gnulib module rewinddir for portability"); # endif #endif #if @GNULIB_DIRFD@ /* Return the file descriptor associated with the given directory stream, or -1 if none exists. */ # if @REPLACE_DIRFD@ /* On kLIBC, dirfd() is a macro that does not work. Undefine it. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) || defined dirfd # undef dirfd # define dirfd rpl_dirfd # endif _GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (dirfd, int, (DIR *)); # ifdef __KLIBC__ /* Gnulib internal hooks needed to maintain the dirfd metadata. */ _GL_EXTERN_C int _gl_register_dirp_fd (int fd, DIR *dirp) _GL_ARG_NONNULL ((2)); _GL_EXTERN_C void _gl_unregister_dirp_fd (int fd); # endif # else # if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd /* dirfd is defined as a macro and not as a function. Turn it into a function and get rid of the macro. */ static inline int (dirfd) (DIR *dp) { return dirfd (dp); } # undef dirfd # endif # if !(@HAVE_DECL_DIRFD@ || defined dirfd) _GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (dirfd, int, (DIR *)); # endif _GL_CXXALIASWARN (dirfd); #elif defined GNULIB_POSIXCHECK # undef dirfd # if HAVE_RAW_DECL_DIRFD _GL_WARN_ON_USE (dirfd, "dirfd is unportable - " "use gnulib module dirfd for portability"); # endif #endif #if @GNULIB_FDOPENDIR@ /* Open a directory stream visiting the given directory file descriptor. Return NULL and set errno if fd is not visiting a directory. On success, this function consumes fd (it will be implicitly closed either by this function or by a subsequent closedir). */ # if @REPLACE_FDOPENDIR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fdopendir # define fdopendir rpl_fdopendir # endif _GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); _GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd)); # else # if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ || __GNUC__ >= 11 _GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); # endif _GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd)); # endif _GL_CXXALIASWARN (fdopendir); #else # if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined fdopendir /* For -Wmismatched-dealloc: Associate fdopendir with closedir or rpl_closedir. */ _GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); # endif # if defined GNULIB_POSIXCHECK # undef fdopendir # if HAVE_RAW_DECL_FDOPENDIR _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - " "use gnulib module fdopendir for portability"); # endif # endif #endif #if @GNULIB_SCANDIR@ /* Scan the directory DIR, calling FILTER on each directory entry. Entries for which FILTER returns nonzero are individually malloc'd, sorted using qsort with CMP, and collected in a malloc'd array in *NAMELIST. Returns the number of entries selected, or -1 on error. */ # if !@HAVE_SCANDIR@ _GL_FUNCDECL_SYS (scandir, int, (const char *dir, struct dirent ***namelist, int (*filter) (const struct dirent *), int (*cmp) (const struct dirent **, const struct dirent **)) _GL_ARG_NONNULL ((1, 2, 4))); # endif /* Need to cast, because on glibc systems, the fourth parameter is int (*cmp) (const void *, const void *). */ _GL_CXXALIAS_SYS_CAST (scandir, int, (const char *dir, struct dirent ***namelist, int (*filter) (const struct dirent *), int (*cmp) (const struct dirent **, const struct dirent **))); _GL_CXXALIASWARN (scandir); #elif defined GNULIB_POSIXCHECK # undef scandir # if HAVE_RAW_DECL_SCANDIR _GL_WARN_ON_USE (scandir, "scandir is unportable - " "use gnulib module scandir for portability"); # endif #endif #if @GNULIB_ALPHASORT@ /* Compare two 'struct dirent' entries alphabetically. */ # if !@HAVE_ALPHASORT@ _GL_FUNCDECL_SYS (alphasort, int, (const struct dirent **, const struct dirent **) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # endif /* Need to cast, because on glibc systems, the parameters are (const void *, const void *). */ _GL_CXXALIAS_SYS_CAST (alphasort, int, (const struct dirent **, const struct dirent **)); _GL_CXXALIASWARN (alphasort); #elif defined GNULIB_POSIXCHECK # undef alphasort # if HAVE_RAW_DECL_ALPHASORT _GL_WARN_ON_USE (alphasort, "alphasort is unportable - " "use gnulib module alphasort for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_DIRENT_H */ #endif /* _@GUARD_PREFIX@_DIRENT_H */ kbuild-3608/src/grep/lib/Makefile.in0000664000175000017500000061753514670377423017303 0ustar locutuslocutus# Makefile.in generated by automake 1.16d from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright 1997-1998, 2005-2021 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, 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 . # # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file 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 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. # # You should have received a copy of the GNU General Public License # along with this file. If not, see . # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that # contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. # Reproduce by: # gnulib-tool --import --local-dir=gl \ # --lib=libgreputils \ # --source-base=lib \ # --m4-base=m4 \ # --doc-base=doc \ # --tests-base=gnulib-tests \ # --aux-dir=build-aux \ # --with-tests \ # --makefile-name=gnulib.mk \ # --no-conditional-dependencies \ # --no-libtool \ # --macro-prefix=gl \ # --avoid=lock-tests \ # --avoid=mbrtowc-tests \ # --avoid=update-copyright-tests \ # alloca \ # announce-gen \ # argmatch \ # c-ctype \ # c-stack \ # c-strcase \ # closeout \ # configmake \ # dfa \ # dirname-lgpl \ # do-release-commit-and-tag \ # error \ # exclude \ # fcntl-h \ # fdl \ # fnmatch \ # fstatat \ # fts \ # getopt-gnu \ # getpagesize \ # getprogname \ # gettext-h \ # git-version-gen \ # gitlog-to-changelog \ # gnu-web-doc-update \ # gnupload \ # hash \ # ignore-value \ # intprops \ # inttypes \ # isatty \ # isblank \ # iswctype \ # largefile \ # locale \ # lseek \ # maintainer-makefile \ # malloc-gnu \ # manywarnings \ # mbrlen \ # mbrtowc \ # memchr \ # memchr2 \ # mempcpy \ # minmax \ # obstack \ # openat-safer \ # perl \ # propername \ # rawmemchr \ # readme-release \ # realloc-gnu \ # regex \ # safe-read \ # same-inode \ # ssize_t \ # stddef \ # stdlib \ # stpcpy \ # strerror \ # string \ # strstr \ # strtoull \ # strtoumax \ # sys_stat \ # unistd \ # unlocked-io \ # update-copyright \ # useless-if-before-free \ # verify \ # version-etc-fsf \ # wchar \ # wcrtomb \ # wctob \ # wctype-h \ # windows-stat-inodes \ # xalloc \ # xbinary-io \ # xstrtoimax VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @GL_GENERATE_SIGSEGV_H_TRUE@am__append_1 = sigsegv.c stackvma.c @LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE@am__append_2 = unistr/u8-mbtoucr.c @LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE@am__append_3 = unistr/u8-uctomb.c unistr/u8-uctomb-aux.c @LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE@am__append_4 = uniwidth/width.c subdir = lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/__inline.m4 \ $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \ $(top_srcdir)/m4/arpa_inet_h.m4 \ $(top_srcdir)/m4/asm-underscore.m4 $(top_srcdir)/m4/assert.m4 \ $(top_srcdir)/m4/btowc.m4 $(top_srcdir)/m4/builtin-expect.m4 \ $(top_srcdir)/m4/c-stack.m4 $(top_srcdir)/m4/calloc.m4 \ $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/close.m4 \ $(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/ctype_h.m4 \ $(top_srcdir)/m4/cycle-check.m4 $(top_srcdir)/m4/d-ino.m4 \ $(top_srcdir)/m4/d-type.m4 $(top_srcdir)/m4/dirent_h.m4 \ $(top_srcdir)/m4/dirfd.m4 \ $(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup.m4 \ $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exponentd.m4 \ $(top_srcdir)/m4/extensions.m4 \ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopen.m4 $(top_srcdir)/m4/fdopendir.m4 \ $(top_srcdir)/m4/filenamecat.m4 $(top_srcdir)/m4/flexmember.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fnmatch.m4 \ $(top_srcdir)/m4/fnmatch_h.m4 $(top_srcdir)/m4/fopen.m4 \ $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/fpieee.m4 \ $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/fstat.m4 \ $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/ftruncate.m4 \ $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \ $(top_srcdir)/m4/getpagesize.m4 \ $(top_srcdir)/m4/getprogname.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/iconv_h.m4 \ $(top_srcdir)/m4/iconv_open.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_pton.m4 \ $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intl-thread-locale.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax_t.m4 \ $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes.m4 \ $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/ioctl.m4 \ $(top_srcdir)/m4/isatty.m4 $(top_srcdir)/m4/isblank.m4 \ $(top_srcdir)/m4/iswblank.m4 $(top_srcdir)/m4/iswctype.m4 \ $(top_srcdir)/m4/iswdigit.m4 $(top_srcdir)/m4/iswxdigit.m4 \ $(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \ $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/libsigsegv.m4 \ $(top_srcdir)/m4/libunistring-base.m4 \ $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/localcharset.m4 \ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \ $(top_srcdir)/m4/locale-tr.m4 $(top_srcdir)/m4/locale-zh.m4 \ $(top_srcdir)/m4/locale_h.m4 $(top_srcdir)/m4/localeconv.m4 \ $(top_srcdir)/m4/localename.m4 $(top_srcdir)/m4/lock.m4 \ $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/lstat.m4 \ $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/malloca.m4 \ $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/mbchar.m4 \ $(top_srcdir)/m4/mbiter.m4 $(top_srcdir)/m4/mbrlen.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \ $(top_srcdir)/m4/mbslen.m4 $(top_srcdir)/m4/mbsrtowcs.m4 \ $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbtowc.m4 \ $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/minmax.m4 \ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/musl.m4 $(top_srcdir)/m4/nanosleep.m4 \ $(top_srcdir)/m4/netinet_in_h.m4 \ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/obstack.m4 \ $(top_srcdir)/m4/off_t.m4 $(top_srcdir)/m4/open-cloexec.m4 \ $(top_srcdir)/m4/open-slash.m4 $(top_srcdir)/m4/open.m4 \ $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/opendir.m4 \ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/pcre.m4 \ $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/perror.m4 \ $(top_srcdir)/m4/pipe.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/pthread-thread.m4 \ $(top_srcdir)/m4/pthread_h.m4 \ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \ $(top_srcdir)/m4/pthread_sigmask.m4 $(top_srcdir)/m4/putenv.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/rawmemchr.m4 \ $(top_srcdir)/m4/read.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/reallocarray.m4 \ $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/safe-read.m4 \ $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/sched_h.m4 \ $(top_srcdir)/m4/select.m4 $(top_srcdir)/m4/setenv.m4 \ $(top_srcdir)/m4/setlocale.m4 \ $(top_srcdir)/m4/setlocale_null.m4 \ $(top_srcdir)/m4/sigaction.m4 $(top_srcdir)/m4/sigaltstack.m4 \ $(top_srcdir)/m4/signal_h.m4 \ $(top_srcdir)/m4/signalblocking.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/sleep.m4 \ $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/socketlib.m4 \ $(top_srcdir)/m4/sockets.m4 $(top_srcdir)/m4/socklen.m4 \ $(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stack-direction.m4 \ $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \ $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdarg.m4 \ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/stpcpy.m4 $(top_srcdir)/m4/strdup.m4 \ $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/strerror_r.m4 \ $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strnlen.m4 \ $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtoimax.m4 \ $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoull.m4 \ $(top_srcdir)/m4/strtoumax.m4 $(top_srcdir)/m4/symlink.m4 \ $(top_srcdir)/m4/sys_ioctl_h.m4 \ $(top_srcdir)/m4/sys_select_h.m4 \ $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/sys_uio_h.m4 \ $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/unistd-safer.m4 \ $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/version-etc.m4 \ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/warn-on-use.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_h.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcrtomb.m4 \ $(top_srcdir)/m4/wctob.m4 $(top_srcdir)/m4/wctomb.m4 \ $(top_srcdir)/m4/wctype_h.m4 $(top_srcdir)/m4/wcwidth.m4 \ $(top_srcdir)/m4/windows-stat-inodes.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/wmemchr.m4 \ $(top_srcdir)/m4/wmempcpy.m4 $(top_srcdir)/m4/xalloc.m4 \ $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrtol.m4 \ $(top_srcdir)/m4/year2038.m4 $(top_srcdir)/m4/zzgnulib.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libgreputils_a_AR = $(AR) $(ARFLAGS) am__DEPENDENCIES_1 = am__libgreputils_a_SOURCES_DIST = argmatch.c openat-priv.h \ openat-proc.c basename-lgpl.c binary-io.h binary-io.c \ bitrotate.h bitrotate.c c-ctype.h c-ctype.c c-stack.h \ c-stack.c c-strcase.h c-strcasecmp.c c-strncasecmp.c cloexec.c \ close-stream.c closeout.c cycle-check.c dfa.c localeinfo.c \ dirname-lgpl.c stripslash.c malloc/dynarray_at_failure.c \ malloc/dynarray_emplace_enlarge.c malloc/dynarray_finalize.c \ malloc/dynarray_resize.c malloc/dynarray_resize_clear.c \ exclude.c exitfail.c creat-safer.c open-safer.c fd-hook.c \ fd-safer-flag.c dup-safer-flag.c filenamecat-lgpl.c \ getprogname.h getprogname.c gettext.h hard-locale.c hash.c \ i-ring.c ialloc.c idx.h localcharset.c glthread/lock.h \ glthread/lock.c malloca.c mbchar.c mbiter.h mbiter.c \ mbscasecmp.c mbslen.c mbsstr.c mbuiter.h mbuiter.c memchr2.h \ memchr2.c minmax.h openat-die.c openat-safer.c opendirat.c \ propername.h propername.c quotearg.c safe-read.c save-cwd.c \ setlocale_null.c sigsegv.c stackvma.c stat-time.c striconv.h \ striconv.c strnlen1.h strnlen1.c glthread/threadlib.c trim.c \ unistd.c dup-safer.c fd-safer.c pipe-safer.c \ unistr/u8-mbtoucr.c unistr/u8-uctomb.c unistr/u8-uctomb-aux.c \ uniwidth/width.c version-etc.h version-etc.c version-etc-fsf.c \ wctype-h.c xmalloc.c xalloc-die.c xbinary-io.h xbinary-io.c \ xstriconv.h xstriconv.c xstrtoimax.c xstrtol.c xstrtoul.c \ colorize.h am__dirstamp = $(am__leading_dot)dirstamp @GL_GENERATE_SIGSEGV_H_TRUE@am__objects_1 = sigsegv.$(OBJEXT) \ @GL_GENERATE_SIGSEGV_H_TRUE@ stackvma.$(OBJEXT) @LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE@am__objects_2 = unistr/u8-mbtoucr.$(OBJEXT) @LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE@am__objects_3 = unistr/u8-uctomb.$(OBJEXT) \ @LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE@ unistr/u8-uctomb-aux.$(OBJEXT) @LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE@am__objects_4 = uniwidth/width.$(OBJEXT) am_libgreputils_a_OBJECTS = argmatch.$(OBJEXT) openat-proc.$(OBJEXT) \ basename-lgpl.$(OBJEXT) binary-io.$(OBJEXT) \ bitrotate.$(OBJEXT) c-ctype.$(OBJEXT) c-stack.$(OBJEXT) \ c-strcasecmp.$(OBJEXT) c-strncasecmp.$(OBJEXT) \ cloexec.$(OBJEXT) close-stream.$(OBJEXT) closeout.$(OBJEXT) \ cycle-check.$(OBJEXT) dfa.$(OBJEXT) localeinfo.$(OBJEXT) \ dirname-lgpl.$(OBJEXT) stripslash.$(OBJEXT) \ malloc/dynarray_at_failure.$(OBJEXT) \ malloc/dynarray_emplace_enlarge.$(OBJEXT) \ malloc/dynarray_finalize.$(OBJEXT) \ malloc/dynarray_resize.$(OBJEXT) \ malloc/dynarray_resize_clear.$(OBJEXT) exclude.$(OBJEXT) \ exitfail.$(OBJEXT) creat-safer.$(OBJEXT) open-safer.$(OBJEXT) \ fd-hook.$(OBJEXT) fd-safer-flag.$(OBJEXT) \ dup-safer-flag.$(OBJEXT) filenamecat-lgpl.$(OBJEXT) \ getprogname.$(OBJEXT) hard-locale.$(OBJEXT) hash.$(OBJEXT) \ i-ring.$(OBJEXT) ialloc.$(OBJEXT) localcharset.$(OBJEXT) \ glthread/lock.$(OBJEXT) malloca.$(OBJEXT) mbchar.$(OBJEXT) \ mbiter.$(OBJEXT) mbscasecmp.$(OBJEXT) mbslen.$(OBJEXT) \ mbsstr.$(OBJEXT) mbuiter.$(OBJEXT) memchr2.$(OBJEXT) \ openat-die.$(OBJEXT) openat-safer.$(OBJEXT) \ opendirat.$(OBJEXT) propername.$(OBJEXT) quotearg.$(OBJEXT) \ safe-read.$(OBJEXT) save-cwd.$(OBJEXT) \ setlocale_null.$(OBJEXT) $(am__objects_1) stat-time.$(OBJEXT) \ striconv.$(OBJEXT) strnlen1.$(OBJEXT) \ glthread/threadlib.$(OBJEXT) trim.$(OBJEXT) unistd.$(OBJEXT) \ dup-safer.$(OBJEXT) fd-safer.$(OBJEXT) pipe-safer.$(OBJEXT) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) \ version-etc.$(OBJEXT) version-etc-fsf.$(OBJEXT) \ wctype-h.$(OBJEXT) xmalloc.$(OBJEXT) xalloc-die.$(OBJEXT) \ xbinary-io.$(OBJEXT) xstriconv.$(OBJEXT) xstrtoimax.$(OBJEXT) \ xstrtol.$(OBJEXT) xstrtoul.$(OBJEXT) nodist_libgreputils_a_OBJECTS = colorize.$(OBJEXT) libgreputils_a_OBJECTS = $(am_libgreputils_a_OBJECTS) \ $(nodist_libgreputils_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/alloca.Po ./$(DEPDIR)/argmatch.Po \ ./$(DEPDIR)/at-func.Po ./$(DEPDIR)/basename-lgpl.Po \ ./$(DEPDIR)/binary-io.Po ./$(DEPDIR)/bitrotate.Po \ ./$(DEPDIR)/btowc.Po ./$(DEPDIR)/c-ctype.Po \ ./$(DEPDIR)/c-stack.Po ./$(DEPDIR)/c-strcasecmp.Po \ ./$(DEPDIR)/c-strncasecmp.Po ./$(DEPDIR)/calloc.Po \ ./$(DEPDIR)/chdir-long.Po ./$(DEPDIR)/cloexec.Po \ ./$(DEPDIR)/close-stream.Po ./$(DEPDIR)/close.Po \ ./$(DEPDIR)/closedir.Po ./$(DEPDIR)/closeout.Po \ ./$(DEPDIR)/colorize.Po ./$(DEPDIR)/creat-safer.Po \ ./$(DEPDIR)/cycle-check.Po ./$(DEPDIR)/dfa.Po \ ./$(DEPDIR)/dirfd.Po ./$(DEPDIR)/dirname-lgpl.Po \ ./$(DEPDIR)/dup-safer-flag.Po ./$(DEPDIR)/dup-safer.Po \ ./$(DEPDIR)/dup.Po ./$(DEPDIR)/dup2.Po ./$(DEPDIR)/error.Po \ ./$(DEPDIR)/exclude.Po ./$(DEPDIR)/exitfail.Po \ ./$(DEPDIR)/fchdir.Po ./$(DEPDIR)/fcntl.Po \ ./$(DEPDIR)/fd-hook.Po ./$(DEPDIR)/fd-safer-flag.Po \ ./$(DEPDIR)/fd-safer.Po ./$(DEPDIR)/fdopendir.Po \ ./$(DEPDIR)/filenamecat-lgpl.Po ./$(DEPDIR)/fnmatch.Po \ ./$(DEPDIR)/fnmatch_loop.Po ./$(DEPDIR)/fopen.Po \ ./$(DEPDIR)/fpending.Po ./$(DEPDIR)/free.Po \ ./$(DEPDIR)/fstat.Po ./$(DEPDIR)/fstatat.Po \ ./$(DEPDIR)/fts-cycle.Po ./$(DEPDIR)/fts.Po \ ./$(DEPDIR)/getcwd-lgpl.Po ./$(DEPDIR)/getdtablesize.Po \ ./$(DEPDIR)/getopt.Po ./$(DEPDIR)/getopt1.Po \ ./$(DEPDIR)/getpagesize.Po ./$(DEPDIR)/getprogname.Po \ ./$(DEPDIR)/hard-locale.Po ./$(DEPDIR)/hash.Po \ ./$(DEPDIR)/i-ring.Po ./$(DEPDIR)/ialloc.Po \ ./$(DEPDIR)/iconv.Po ./$(DEPDIR)/iconv_close.Po \ ./$(DEPDIR)/iconv_open.Po ./$(DEPDIR)/isatty.Po \ ./$(DEPDIR)/isblank.Po ./$(DEPDIR)/iswblank.Po \ ./$(DEPDIR)/iswctype.Po ./$(DEPDIR)/iswdigit.Po \ ./$(DEPDIR)/iswxdigit.Po ./$(DEPDIR)/lc-charset-dispatch.Po \ ./$(DEPDIR)/localcharset.Po ./$(DEPDIR)/localeconv.Po \ ./$(DEPDIR)/localeinfo.Po ./$(DEPDIR)/lseek.Po \ ./$(DEPDIR)/lstat.Po ./$(DEPDIR)/malloc.Po \ ./$(DEPDIR)/malloca.Po ./$(DEPDIR)/mbchar.Po \ ./$(DEPDIR)/mbiter.Po ./$(DEPDIR)/mbrlen.Po \ ./$(DEPDIR)/mbrtowc.Po ./$(DEPDIR)/mbscasecmp.Po \ ./$(DEPDIR)/mbsinit.Po ./$(DEPDIR)/mbslen.Po \ ./$(DEPDIR)/mbsrtowcs-state.Po ./$(DEPDIR)/mbsrtowcs.Po \ ./$(DEPDIR)/mbsstr.Po ./$(DEPDIR)/mbtowc-lock.Po \ ./$(DEPDIR)/mbtowc.Po ./$(DEPDIR)/mbuiter.Po \ ./$(DEPDIR)/memchr.Po ./$(DEPDIR)/memchr2.Po \ ./$(DEPDIR)/mempcpy.Po ./$(DEPDIR)/memrchr.Po \ ./$(DEPDIR)/msvc-inval.Po ./$(DEPDIR)/msvc-nothrow.Po \ ./$(DEPDIR)/nl_langinfo-lock.Po ./$(DEPDIR)/nl_langinfo.Po \ ./$(DEPDIR)/obstack.Po ./$(DEPDIR)/open-safer.Po \ ./$(DEPDIR)/open.Po ./$(DEPDIR)/openat-die.Po \ ./$(DEPDIR)/openat-proc.Po ./$(DEPDIR)/openat-safer.Po \ ./$(DEPDIR)/openat.Po ./$(DEPDIR)/opendir.Po \ ./$(DEPDIR)/opendirat.Po ./$(DEPDIR)/pipe-safer.Po \ ./$(DEPDIR)/pipe.Po ./$(DEPDIR)/propername.Po \ ./$(DEPDIR)/quotearg.Po ./$(DEPDIR)/raise.Po \ ./$(DEPDIR)/rawmemchr.Po ./$(DEPDIR)/read.Po \ ./$(DEPDIR)/readdir.Po ./$(DEPDIR)/realloc.Po \ ./$(DEPDIR)/reallocarray.Po ./$(DEPDIR)/regcomp.Po \ ./$(DEPDIR)/regex.Po ./$(DEPDIR)/regex_internal.Po \ ./$(DEPDIR)/regexec.Po ./$(DEPDIR)/safe-read.Po \ ./$(DEPDIR)/save-cwd.Po ./$(DEPDIR)/setlocale-lock.Po \ ./$(DEPDIR)/setlocale_null.Po ./$(DEPDIR)/sigsegv.Po \ ./$(DEPDIR)/stackvma.Po ./$(DEPDIR)/stat-time.Po \ ./$(DEPDIR)/stat-w32.Po ./$(DEPDIR)/stat.Po \ ./$(DEPDIR)/stpcpy.Po ./$(DEPDIR)/strdup.Po \ ./$(DEPDIR)/strerror-override.Po ./$(DEPDIR)/strerror.Po \ ./$(DEPDIR)/striconv.Po ./$(DEPDIR)/stripslash.Po \ ./$(DEPDIR)/strnlen.Po ./$(DEPDIR)/strnlen1.Po \ ./$(DEPDIR)/strstr.Po ./$(DEPDIR)/strtoimax.Po \ ./$(DEPDIR)/strtol.Po ./$(DEPDIR)/strtoll.Po \ ./$(DEPDIR)/strtoul.Po ./$(DEPDIR)/strtoull.Po \ ./$(DEPDIR)/strtoumax.Po ./$(DEPDIR)/trim.Po \ ./$(DEPDIR)/unistd.Po ./$(DEPDIR)/version-etc-fsf.Po \ ./$(DEPDIR)/version-etc.Po ./$(DEPDIR)/wcrtomb.Po \ ./$(DEPDIR)/wctob.Po ./$(DEPDIR)/wctomb.Po \ ./$(DEPDIR)/wctype-h.Po ./$(DEPDIR)/wcwidth.Po \ ./$(DEPDIR)/windows-mutex.Po ./$(DEPDIR)/windows-once.Po \ ./$(DEPDIR)/windows-recmutex.Po ./$(DEPDIR)/windows-rwlock.Po \ ./$(DEPDIR)/wmemchr.Po ./$(DEPDIR)/wmempcpy.Po \ ./$(DEPDIR)/xalloc-die.Po ./$(DEPDIR)/xbinary-io.Po \ ./$(DEPDIR)/xmalloc.Po ./$(DEPDIR)/xstriconv.Po \ ./$(DEPDIR)/xstrtoimax.Po ./$(DEPDIR)/xstrtol.Po \ ./$(DEPDIR)/xstrtoul.Po glthread/$(DEPDIR)/lock.Po \ glthread/$(DEPDIR)/threadlib.Po \ malloc/$(DEPDIR)/dynarray-skeleton.Po \ malloc/$(DEPDIR)/dynarray_at_failure.Po \ malloc/$(DEPDIR)/dynarray_emplace_enlarge.Po \ malloc/$(DEPDIR)/dynarray_finalize.Po \ malloc/$(DEPDIR)/dynarray_resize.Po \ malloc/$(DEPDIR)/dynarray_resize_clear.Po \ unistr/$(DEPDIR)/u8-mbtoucr.Po \ unistr/$(DEPDIR)/u8-uctomb-aux.Po \ unistr/$(DEPDIR)/u8-uctomb.Po uniwidth/$(DEPDIR)/width.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libgreputils_a_SOURCES) $(EXTRA_libgreputils_a_SOURCES) \ $(nodist_libgreputils_a_SOURCES) DIST_SOURCES = $(am__libgreputils_a_SOURCES_DIST) \ $(EXTRA_libgreputils_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/gnulib.mk \ $(top_srcdir)/build-aux/depcomp alloca.c DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkglibexecdir = @pkglibexecdir@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ AR = @AR@ ARFLAGS = @ARFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ COLORIZE_SOURCE = @COLORIZE_SOURCE@ CONFIG_INCLUDE = @CONFIG_INCLUDE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ ENOLINK_VALUE = @ENOLINK_VALUE@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ FNMATCH_H = @FNMATCH_H@ GETOPT_CDEFS_H = @GETOPT_CDEFS_H@ GETOPT_H = @GETOPT_H@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@ GL_CXXFLAG_ALLOW_WARNINGS = @GL_CXXFLAG_ALLOW_WARNINGS@ GL_GNULIB_ACCEPT = @GL_GNULIB_ACCEPT@ GL_GNULIB_ACCEPT4 = @GL_GNULIB_ACCEPT4@ GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@ GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@ GL_GNULIB_ALPHASORT = @GL_GNULIB_ALPHASORT@ GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@ GL_GNULIB_BIND = @GL_GNULIB_BIND@ GL_GNULIB_BTOWC = @GL_GNULIB_BTOWC@ GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@ GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@ GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@ GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@ GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@ GL_GNULIB_CLOSEDIR = @GL_GNULIB_CLOSEDIR@ GL_GNULIB_CONNECT = @GL_GNULIB_CONNECT@ GL_GNULIB_COPY_FILE_RANGE = @GL_GNULIB_COPY_FILE_RANGE@ GL_GNULIB_CREAT = @GL_GNULIB_CREAT@ GL_GNULIB_CTIME = @GL_GNULIB_CTIME@ GL_GNULIB_DIRFD = @GL_GNULIB_DIRFD@ GL_GNULIB_DPRINTF = @GL_GNULIB_DPRINTF@ GL_GNULIB_DUP = @GL_GNULIB_DUP@ GL_GNULIB_DUP2 = @GL_GNULIB_DUP2@ GL_GNULIB_DUP3 = @GL_GNULIB_DUP3@ GL_GNULIB_DUPLOCALE = @GL_GNULIB_DUPLOCALE@ GL_GNULIB_ENVIRON = @GL_GNULIB_ENVIRON@ GL_GNULIB_EUIDACCESS = @GL_GNULIB_EUIDACCESS@ GL_GNULIB_EXECL = @GL_GNULIB_EXECL@ GL_GNULIB_EXECLE = @GL_GNULIB_EXECLE@ GL_GNULIB_EXECLP = @GL_GNULIB_EXECLP@ GL_GNULIB_EXECV = @GL_GNULIB_EXECV@ GL_GNULIB_EXECVE = @GL_GNULIB_EXECVE@ GL_GNULIB_EXECVP = @GL_GNULIB_EXECVP@ GL_GNULIB_EXECVPE = @GL_GNULIB_EXECVPE@ GL_GNULIB_EXPLICIT_BZERO = @GL_GNULIB_EXPLICIT_BZERO@ GL_GNULIB_FACCESSAT = @GL_GNULIB_FACCESSAT@ GL_GNULIB_FCHDIR = @GL_GNULIB_FCHDIR@ GL_GNULIB_FCHMODAT = @GL_GNULIB_FCHMODAT@ GL_GNULIB_FCHOWNAT = @GL_GNULIB_FCHOWNAT@ GL_GNULIB_FCLOSE = @GL_GNULIB_FCLOSE@ GL_GNULIB_FCNTL = @GL_GNULIB_FCNTL@ GL_GNULIB_FDATASYNC = @GL_GNULIB_FDATASYNC@ GL_GNULIB_FDOPEN = @GL_GNULIB_FDOPEN@ GL_GNULIB_FDOPENDIR = @GL_GNULIB_FDOPENDIR@ GL_GNULIB_FFLUSH = @GL_GNULIB_FFLUSH@ GL_GNULIB_FFSL = @GL_GNULIB_FFSL@ GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@ GL_GNULIB_FGETC = @GL_GNULIB_FGETC@ GL_GNULIB_FGETS = @GL_GNULIB_FGETS@ GL_GNULIB_FNMATCH = @GL_GNULIB_FNMATCH@ GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@ GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@ GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@ GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@ GL_GNULIB_FPUTC = @GL_GNULIB_FPUTC@ GL_GNULIB_FPUTS = @GL_GNULIB_FPUTS@ GL_GNULIB_FREAD = @GL_GNULIB_FREAD@ GL_GNULIB_FREE_POSIX = @GL_GNULIB_FREE_POSIX@ GL_GNULIB_FREOPEN = @GL_GNULIB_FREOPEN@ GL_GNULIB_FSCANF = @GL_GNULIB_FSCANF@ GL_GNULIB_FSEEK = @GL_GNULIB_FSEEK@ GL_GNULIB_FSEEKO = @GL_GNULIB_FSEEKO@ GL_GNULIB_FSTAT = @GL_GNULIB_FSTAT@ GL_GNULIB_FSTATAT = @GL_GNULIB_FSTATAT@ GL_GNULIB_FSYNC = @GL_GNULIB_FSYNC@ GL_GNULIB_FTELL = @GL_GNULIB_FTELL@ GL_GNULIB_FTELLO = @GL_GNULIB_FTELLO@ GL_GNULIB_FTRUNCATE = @GL_GNULIB_FTRUNCATE@ GL_GNULIB_FUTIMENS = @GL_GNULIB_FUTIMENS@ GL_GNULIB_FWRITE = @GL_GNULIB_FWRITE@ GL_GNULIB_GETC = @GL_GNULIB_GETC@ GL_GNULIB_GETCHAR = @GL_GNULIB_GETCHAR@ GL_GNULIB_GETCWD = @GL_GNULIB_GETCWD@ GL_GNULIB_GETDELIM = @GL_GNULIB_GETDELIM@ GL_GNULIB_GETDOMAINNAME = @GL_GNULIB_GETDOMAINNAME@ GL_GNULIB_GETDTABLESIZE = @GL_GNULIB_GETDTABLESIZE@ GL_GNULIB_GETENTROPY = @GL_GNULIB_GETENTROPY@ GL_GNULIB_GETGROUPS = @GL_GNULIB_GETGROUPS@ GL_GNULIB_GETHOSTNAME = @GL_GNULIB_GETHOSTNAME@ GL_GNULIB_GETLINE = @GL_GNULIB_GETLINE@ GL_GNULIB_GETLOADAVG = @GL_GNULIB_GETLOADAVG@ GL_GNULIB_GETLOGIN = @GL_GNULIB_GETLOGIN@ GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@ GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@ GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@ GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@ GL_GNULIB_GETPEERNAME = @GL_GNULIB_GETPEERNAME@ GL_GNULIB_GETSOCKNAME = @GL_GNULIB_GETSOCKNAME@ GL_GNULIB_GETSOCKOPT = @GL_GNULIB_GETSOCKOPT@ GL_GNULIB_GETSUBOPT = @GL_GNULIB_GETSUBOPT@ GL_GNULIB_GETTIMEOFDAY = @GL_GNULIB_GETTIMEOFDAY@ GL_GNULIB_GETUMASK = @GL_GNULIB_GETUMASK@ GL_GNULIB_GETUSERSHELL = @GL_GNULIB_GETUSERSHELL@ GL_GNULIB_GRANTPT = @GL_GNULIB_GRANTPT@ GL_GNULIB_GROUP_MEMBER = @GL_GNULIB_GROUP_MEMBER@ GL_GNULIB_ICONV = @GL_GNULIB_ICONV@ GL_GNULIB_IMAXABS = @GL_GNULIB_IMAXABS@ GL_GNULIB_IMAXDIV = @GL_GNULIB_IMAXDIV@ GL_GNULIB_INET_NTOP = @GL_GNULIB_INET_NTOP@ GL_GNULIB_INET_PTON = @GL_GNULIB_INET_PTON@ GL_GNULIB_IOCTL = @GL_GNULIB_IOCTL@ GL_GNULIB_ISATTY = @GL_GNULIB_ISATTY@ GL_GNULIB_ISBLANK = @GL_GNULIB_ISBLANK@ GL_GNULIB_ISWBLANK = @GL_GNULIB_ISWBLANK@ GL_GNULIB_ISWCTYPE = @GL_GNULIB_ISWCTYPE@ GL_GNULIB_ISWDIGIT = @GL_GNULIB_ISWDIGIT@ GL_GNULIB_ISWXDIGIT = @GL_GNULIB_ISWXDIGIT@ GL_GNULIB_LCHMOD = @GL_GNULIB_LCHMOD@ GL_GNULIB_LCHOWN = @GL_GNULIB_LCHOWN@ GL_GNULIB_LINK = @GL_GNULIB_LINK@ GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@ GL_GNULIB_LISTEN = @GL_GNULIB_LISTEN@ GL_GNULIB_LOCALECONV = @GL_GNULIB_LOCALECONV@ GL_GNULIB_LOCALENAME = @GL_GNULIB_LOCALENAME@ GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@ GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@ GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@ GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@ GL_GNULIB_MBRLEN = @GL_GNULIB_MBRLEN@ GL_GNULIB_MBRTOWC = @GL_GNULIB_MBRTOWC@ GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@ GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@ GL_GNULIB_MBSCHR = @GL_GNULIB_MBSCHR@ GL_GNULIB_MBSCSPN = @GL_GNULIB_MBSCSPN@ GL_GNULIB_MBSINIT = @GL_GNULIB_MBSINIT@ GL_GNULIB_MBSLEN = @GL_GNULIB_MBSLEN@ GL_GNULIB_MBSNCASECMP = @GL_GNULIB_MBSNCASECMP@ GL_GNULIB_MBSNLEN = @GL_GNULIB_MBSNLEN@ GL_GNULIB_MBSNRTOWCS = @GL_GNULIB_MBSNRTOWCS@ GL_GNULIB_MBSPBRK = @GL_GNULIB_MBSPBRK@ GL_GNULIB_MBSPCASECMP = @GL_GNULIB_MBSPCASECMP@ GL_GNULIB_MBSRCHR = @GL_GNULIB_MBSRCHR@ GL_GNULIB_MBSRTOWCS = @GL_GNULIB_MBSRTOWCS@ GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@ GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@ GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@ GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@ GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@ GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@ GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@ GL_GNULIB_MDA_CHMOD = @GL_GNULIB_MDA_CHMOD@ GL_GNULIB_MDA_CLOSE = @GL_GNULIB_MDA_CLOSE@ GL_GNULIB_MDA_CREAT = @GL_GNULIB_MDA_CREAT@ GL_GNULIB_MDA_DUP = @GL_GNULIB_MDA_DUP@ GL_GNULIB_MDA_DUP2 = @GL_GNULIB_MDA_DUP2@ GL_GNULIB_MDA_ECVT = @GL_GNULIB_MDA_ECVT@ GL_GNULIB_MDA_EXECL = @GL_GNULIB_MDA_EXECL@ GL_GNULIB_MDA_EXECLE = @GL_GNULIB_MDA_EXECLE@ GL_GNULIB_MDA_EXECLP = @GL_GNULIB_MDA_EXECLP@ GL_GNULIB_MDA_EXECV = @GL_GNULIB_MDA_EXECV@ GL_GNULIB_MDA_EXECVE = @GL_GNULIB_MDA_EXECVE@ GL_GNULIB_MDA_EXECVP = @GL_GNULIB_MDA_EXECVP@ GL_GNULIB_MDA_EXECVPE = @GL_GNULIB_MDA_EXECVPE@ GL_GNULIB_MDA_FCLOSEALL = @GL_GNULIB_MDA_FCLOSEALL@ GL_GNULIB_MDA_FCVT = @GL_GNULIB_MDA_FCVT@ GL_GNULIB_MDA_FDOPEN = @GL_GNULIB_MDA_FDOPEN@ GL_GNULIB_MDA_FILENO = @GL_GNULIB_MDA_FILENO@ GL_GNULIB_MDA_GCVT = @GL_GNULIB_MDA_GCVT@ GL_GNULIB_MDA_GETCWD = @GL_GNULIB_MDA_GETCWD@ GL_GNULIB_MDA_GETPID = @GL_GNULIB_MDA_GETPID@ GL_GNULIB_MDA_GETW = @GL_GNULIB_MDA_GETW@ GL_GNULIB_MDA_ISATTY = @GL_GNULIB_MDA_ISATTY@ GL_GNULIB_MDA_LSEEK = @GL_GNULIB_MDA_LSEEK@ GL_GNULIB_MDA_MEMCCPY = @GL_GNULIB_MDA_MEMCCPY@ GL_GNULIB_MDA_MKDIR = @GL_GNULIB_MDA_MKDIR@ GL_GNULIB_MDA_MKTEMP = @GL_GNULIB_MDA_MKTEMP@ GL_GNULIB_MDA_OPEN = @GL_GNULIB_MDA_OPEN@ GL_GNULIB_MDA_PUTENV = @GL_GNULIB_MDA_PUTENV@ GL_GNULIB_MDA_PUTW = @GL_GNULIB_MDA_PUTW@ GL_GNULIB_MDA_READ = @GL_GNULIB_MDA_READ@ GL_GNULIB_MDA_RMDIR = @GL_GNULIB_MDA_RMDIR@ GL_GNULIB_MDA_STRDUP = @GL_GNULIB_MDA_STRDUP@ GL_GNULIB_MDA_SWAB = @GL_GNULIB_MDA_SWAB@ GL_GNULIB_MDA_TEMPNAM = @GL_GNULIB_MDA_TEMPNAM@ GL_GNULIB_MDA_TZSET = @GL_GNULIB_MDA_TZSET@ GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@ GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@ GL_GNULIB_MDA_WCSDUP = @GL_GNULIB_MDA_WCSDUP@ GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@ GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@ GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@ GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@ GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@ GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@ GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@ GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@ GL_GNULIB_MKFIFO = @GL_GNULIB_MKFIFO@ GL_GNULIB_MKFIFOAT = @GL_GNULIB_MKFIFOAT@ GL_GNULIB_MKNOD = @GL_GNULIB_MKNOD@ GL_GNULIB_MKNODAT = @GL_GNULIB_MKNODAT@ GL_GNULIB_MKOSTEMP = @GL_GNULIB_MKOSTEMP@ GL_GNULIB_MKOSTEMPS = @GL_GNULIB_MKOSTEMPS@ GL_GNULIB_MKSTEMP = @GL_GNULIB_MKSTEMP@ GL_GNULIB_MKSTEMPS = @GL_GNULIB_MKSTEMPS@ GL_GNULIB_MKTIME = @GL_GNULIB_MKTIME@ GL_GNULIB_NANOSLEEP = @GL_GNULIB_NANOSLEEP@ GL_GNULIB_NL_LANGINFO = @GL_GNULIB_NL_LANGINFO@ GL_GNULIB_NONBLOCKING = @GL_GNULIB_NONBLOCKING@ GL_GNULIB_OBSTACK_PRINTF = @GL_GNULIB_OBSTACK_PRINTF@ GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@ GL_GNULIB_OPEN = @GL_GNULIB_OPEN@ GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@ GL_GNULIB_OPENDIR = @GL_GNULIB_OPENDIR@ GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@ GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@ GL_GNULIB_PERROR = @GL_GNULIB_PERROR@ GL_GNULIB_PIPE = @GL_GNULIB_PIPE@ GL_GNULIB_PIPE2 = @GL_GNULIB_PIPE2@ GL_GNULIB_POPEN = @GL_GNULIB_POPEN@ GL_GNULIB_POSIX_MEMALIGN = @GL_GNULIB_POSIX_MEMALIGN@ GL_GNULIB_POSIX_OPENPT = @GL_GNULIB_POSIX_OPENPT@ GL_GNULIB_PREAD = @GL_GNULIB_PREAD@ GL_GNULIB_PRINTF = @GL_GNULIB_PRINTF@ GL_GNULIB_PRINTF_POSIX = @GL_GNULIB_PRINTF_POSIX@ GL_GNULIB_PSELECT = @GL_GNULIB_PSELECT@ GL_GNULIB_PTHREAD_COND = @GL_GNULIB_PTHREAD_COND@ GL_GNULIB_PTHREAD_MUTEX = @GL_GNULIB_PTHREAD_MUTEX@ GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK = @GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK@ GL_GNULIB_PTHREAD_ONCE = @GL_GNULIB_PTHREAD_ONCE@ GL_GNULIB_PTHREAD_RWLOCK = @GL_GNULIB_PTHREAD_RWLOCK@ GL_GNULIB_PTHREAD_SIGMASK = @GL_GNULIB_PTHREAD_SIGMASK@ GL_GNULIB_PTHREAD_SPIN = @GL_GNULIB_PTHREAD_SPIN@ GL_GNULIB_PTHREAD_THREAD = @GL_GNULIB_PTHREAD_THREAD@ GL_GNULIB_PTHREAD_TSS = @GL_GNULIB_PTHREAD_TSS@ GL_GNULIB_PTSNAME = @GL_GNULIB_PTSNAME@ GL_GNULIB_PTSNAME_R = @GL_GNULIB_PTSNAME_R@ GL_GNULIB_PUTC = @GL_GNULIB_PUTC@ GL_GNULIB_PUTCHAR = @GL_GNULIB_PUTCHAR@ GL_GNULIB_PUTENV = @GL_GNULIB_PUTENV@ GL_GNULIB_PUTS = @GL_GNULIB_PUTS@ GL_GNULIB_PWRITE = @GL_GNULIB_PWRITE@ GL_GNULIB_QSORT_R = @GL_GNULIB_QSORT_R@ GL_GNULIB_RAISE = @GL_GNULIB_RAISE@ GL_GNULIB_RANDOM = @GL_GNULIB_RANDOM@ GL_GNULIB_RANDOM_R = @GL_GNULIB_RANDOM_R@ GL_GNULIB_RAWMEMCHR = @GL_GNULIB_RAWMEMCHR@ GL_GNULIB_READ = @GL_GNULIB_READ@ GL_GNULIB_READDIR = @GL_GNULIB_READDIR@ GL_GNULIB_READLINK = @GL_GNULIB_READLINK@ GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@ GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@ GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@ GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@ GL_GNULIB_RECV = @GL_GNULIB_RECV@ GL_GNULIB_RECVFROM = @GL_GNULIB_RECVFROM@ GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@ GL_GNULIB_RENAME = @GL_GNULIB_RENAME@ GL_GNULIB_RENAMEAT = @GL_GNULIB_RENAMEAT@ GL_GNULIB_REWINDDIR = @GL_GNULIB_REWINDDIR@ GL_GNULIB_RMDIR = @GL_GNULIB_RMDIR@ GL_GNULIB_RPMATCH = @GL_GNULIB_RPMATCH@ GL_GNULIB_SCANDIR = @GL_GNULIB_SCANDIR@ GL_GNULIB_SCANF = @GL_GNULIB_SCANF@ GL_GNULIB_SCHED_YIELD = @GL_GNULIB_SCHED_YIELD@ GL_GNULIB_SECURE_GETENV = @GL_GNULIB_SECURE_GETENV@ GL_GNULIB_SELECT = @GL_GNULIB_SELECT@ GL_GNULIB_SEND = @GL_GNULIB_SEND@ GL_GNULIB_SENDTO = @GL_GNULIB_SENDTO@ GL_GNULIB_SETENV = @GL_GNULIB_SETENV@ GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@ GL_GNULIB_SETLOCALE = @GL_GNULIB_SETLOCALE@ GL_GNULIB_SETLOCALE_NULL = @GL_GNULIB_SETLOCALE_NULL@ GL_GNULIB_SETSOCKOPT = @GL_GNULIB_SETSOCKOPT@ GL_GNULIB_SHUTDOWN = @GL_GNULIB_SHUTDOWN@ GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@ GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@ GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@ GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@ GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@ GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@ GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@ GL_GNULIB_SOCKET = @GL_GNULIB_SOCKET@ GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@ GL_GNULIB_STAT = @GL_GNULIB_STAT@ GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@ GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@ GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@ GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@ GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@ GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@ GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@ GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@ GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@ GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@ GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@ GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@ GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@ GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@ GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@ GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@ GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@ GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@ GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@ GL_GNULIB_STRTOLD = @GL_GNULIB_STRTOLD@ GL_GNULIB_STRTOLL = @GL_GNULIB_STRTOLL@ GL_GNULIB_STRTOUL = @GL_GNULIB_STRTOUL@ GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@ GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@ GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@ GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@ GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@ GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@ GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@ GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@ GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@ GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@ GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@ GL_GNULIB_TOWCTRANS = @GL_GNULIB_TOWCTRANS@ GL_GNULIB_TRUNCATE = @GL_GNULIB_TRUNCATE@ GL_GNULIB_TTYNAME_R = @GL_GNULIB_TTYNAME_R@ GL_GNULIB_TZSET = @GL_GNULIB_TZSET@ GL_GNULIB_UNISTD_H_GETOPT = @GL_GNULIB_UNISTD_H_GETOPT@ GL_GNULIB_UNISTD_H_NONBLOCKING = @GL_GNULIB_UNISTD_H_NONBLOCKING@ GL_GNULIB_UNISTD_H_SIGPIPE = @GL_GNULIB_UNISTD_H_SIGPIPE@ GL_GNULIB_UNLINK = @GL_GNULIB_UNLINK@ GL_GNULIB_UNLINKAT = @GL_GNULIB_UNLINKAT@ GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@ GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@ GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@ GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@ GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@ GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@ GL_GNULIB_VFPRINTF = @GL_GNULIB_VFPRINTF@ GL_GNULIB_VFPRINTF_POSIX = @GL_GNULIB_VFPRINTF_POSIX@ GL_GNULIB_VFSCANF = @GL_GNULIB_VFSCANF@ GL_GNULIB_VPRINTF = @GL_GNULIB_VPRINTF@ GL_GNULIB_VPRINTF_POSIX = @GL_GNULIB_VPRINTF_POSIX@ GL_GNULIB_VSCANF = @GL_GNULIB_VSCANF@ GL_GNULIB_VSNPRINTF = @GL_GNULIB_VSNPRINTF@ GL_GNULIB_VSPRINTF_POSIX = @GL_GNULIB_VSPRINTF_POSIX@ GL_GNULIB_WCPCPY = @GL_GNULIB_WCPCPY@ GL_GNULIB_WCPNCPY = @GL_GNULIB_WCPNCPY@ GL_GNULIB_WCRTOMB = @GL_GNULIB_WCRTOMB@ GL_GNULIB_WCSCASECMP = @GL_GNULIB_WCSCASECMP@ GL_GNULIB_WCSCAT = @GL_GNULIB_WCSCAT@ GL_GNULIB_WCSCHR = @GL_GNULIB_WCSCHR@ GL_GNULIB_WCSCMP = @GL_GNULIB_WCSCMP@ GL_GNULIB_WCSCOLL = @GL_GNULIB_WCSCOLL@ GL_GNULIB_WCSCPY = @GL_GNULIB_WCSCPY@ GL_GNULIB_WCSCSPN = @GL_GNULIB_WCSCSPN@ GL_GNULIB_WCSDUP = @GL_GNULIB_WCSDUP@ GL_GNULIB_WCSFTIME = @GL_GNULIB_WCSFTIME@ GL_GNULIB_WCSLEN = @GL_GNULIB_WCSLEN@ GL_GNULIB_WCSNCASECMP = @GL_GNULIB_WCSNCASECMP@ GL_GNULIB_WCSNCAT = @GL_GNULIB_WCSNCAT@ GL_GNULIB_WCSNCMP = @GL_GNULIB_WCSNCMP@ GL_GNULIB_WCSNCPY = @GL_GNULIB_WCSNCPY@ GL_GNULIB_WCSNLEN = @GL_GNULIB_WCSNLEN@ GL_GNULIB_WCSNRTOMBS = @GL_GNULIB_WCSNRTOMBS@ GL_GNULIB_WCSPBRK = @GL_GNULIB_WCSPBRK@ GL_GNULIB_WCSRCHR = @GL_GNULIB_WCSRCHR@ GL_GNULIB_WCSRTOMBS = @GL_GNULIB_WCSRTOMBS@ GL_GNULIB_WCSSPN = @GL_GNULIB_WCSSPN@ GL_GNULIB_WCSSTR = @GL_GNULIB_WCSSTR@ GL_GNULIB_WCSTOK = @GL_GNULIB_WCSTOK@ GL_GNULIB_WCSWIDTH = @GL_GNULIB_WCSWIDTH@ GL_GNULIB_WCSXFRM = @GL_GNULIB_WCSXFRM@ GL_GNULIB_WCTOB = @GL_GNULIB_WCTOB@ GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@ GL_GNULIB_WCTRANS = @GL_GNULIB_WCTRANS@ GL_GNULIB_WCTYPE = @GL_GNULIB_WCTYPE@ GL_GNULIB_WCWIDTH = @GL_GNULIB_WCWIDTH@ GL_GNULIB_WMEMCHR = @GL_GNULIB_WMEMCHR@ GL_GNULIB_WMEMCMP = @GL_GNULIB_WMEMCMP@ GL_GNULIB_WMEMCPY = @GL_GNULIB_WMEMCPY@ GL_GNULIB_WMEMMOVE = @GL_GNULIB_WMEMMOVE@ GL_GNULIB_WMEMPCPY = @GL_GNULIB_WMEMPCPY@ GL_GNULIB_WMEMSET = @GL_GNULIB_WMEMSET@ GL_GNULIB_WRITE = @GL_GNULIB_WRITE@ GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_TEST_WARN_CFLAGS = @GNULIB_TEST_WARN_CFLAGS@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ GREP = @GREP@ HAVE_ACCEPT4 = @HAVE_ACCEPT4@ HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@ HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@ HAVE_DECL_DIRFD = @HAVE_DECL_DIRFD@ HAVE_DECL_ECVT = @HAVE_DECL_ECVT@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXECVPE = @HAVE_DECL_EXECVPE@ HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ HAVE_DECL_FCLOSEALL = @HAVE_DECL_FCLOSEALL@ HAVE_DECL_FCVT = @HAVE_DECL_FCVT@ HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@ HAVE_DECL_FDOPENDIR = @HAVE_DECL_FDOPENDIR@ HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@ HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@ HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@ HAVE_DECL_GCVT = @HAVE_DECL_GCVT@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@ HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@ HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCSDUP = @HAVE_DECL_WCSDUP@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DIRENT_H = @HAVE_DIRENT_H@ HAVE_DPRINTF = @HAVE_DPRINTF@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_EXECVPE = @HAVE_EXECVPE@ HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHMODAT = @HAVE_FCHMODAT@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FCNTL = @HAVE_FCNTL@ HAVE_FDATASYNC = @HAVE_FDATASYNC@ HAVE_FDOPENDIR = @HAVE_FDOPENDIR@ HAVE_FEATURES_H = @HAVE_FEATURES_H@ HAVE_FFSL = @HAVE_FFSL@ HAVE_FFSLL = @HAVE_FFSLL@ HAVE_FNMATCH = @HAVE_FNMATCH@ HAVE_FNMATCH_H = @HAVE_FNMATCH_H@ HAVE_FREELOCALE = @HAVE_FREELOCALE@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FSTATAT = @HAVE_FSTATAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_FUTIMENS = @HAVE_FUTIMENS@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETENTROPY = @HAVE_GETENTROPY@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETPASS = @HAVE_GETPASS@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ HAVE_GETUMASK = @HAVE_GETUMASK@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISBLANK = @HAVE_ISBLANK@ HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LANGINFO_ALTMON = @HAVE_LANGINFO_ALTMON@ HAVE_LANGINFO_CODESET = @HAVE_LANGINFO_CODESET@ HAVE_LANGINFO_ERA = @HAVE_LANGINFO_ERA@ HAVE_LANGINFO_H = @HAVE_LANGINFO_H@ HAVE_LANGINFO_T_FMT_AMPM = @HAVE_LANGINFO_T_FMT_AMPM@ HAVE_LANGINFO_YESEXPR = @HAVE_LANGINFO_YESEXPR@ HAVE_LCHMOD = @HAVE_LCHMOD@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDIRAT = @HAVE_MKDIRAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ HAVE_MKFIFO = @HAVE_MKFIFO@ HAVE_MKFIFOAT = @HAVE_MKFIFOAT@ HAVE_MKNOD = @HAVE_MKNOD@ HAVE_MKNODAT = @HAVE_MKNODAT@ HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ HAVE_MKSTEMP = @HAVE_MKSTEMP@ HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@ HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@ HAVE_NEWLOCALE = @HAVE_NEWLOCALE@ HAVE_NL_LANGINFO = @HAVE_NL_LANGINFO@ HAVE_OPENAT = @HAVE_OPENAT@ HAVE_OPENDIR = @HAVE_OPENDIR@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PCLOSE = @HAVE_PCLOSE@ HAVE_PIPE = @HAVE_PIPE@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_POPEN = @HAVE_POPEN@ HAVE_POSIX_MEMALIGN = @HAVE_POSIX_MEMALIGN@ HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PSELECT = @HAVE_PSELECT@ HAVE_PTHREAD_ATTR_DESTROY = @HAVE_PTHREAD_ATTR_DESTROY@ HAVE_PTHREAD_ATTR_GETDETACHSTATE = @HAVE_PTHREAD_ATTR_GETDETACHSTATE@ HAVE_PTHREAD_ATTR_INIT = @HAVE_PTHREAD_ATTR_INIT@ HAVE_PTHREAD_ATTR_SETDETACHSTATE = @HAVE_PTHREAD_ATTR_SETDETACHSTATE@ HAVE_PTHREAD_CONDATTR_DESTROY = @HAVE_PTHREAD_CONDATTR_DESTROY@ HAVE_PTHREAD_CONDATTR_INIT = @HAVE_PTHREAD_CONDATTR_INIT@ HAVE_PTHREAD_COND_BROADCAST = @HAVE_PTHREAD_COND_BROADCAST@ HAVE_PTHREAD_COND_DESTROY = @HAVE_PTHREAD_COND_DESTROY@ HAVE_PTHREAD_COND_INIT = @HAVE_PTHREAD_COND_INIT@ HAVE_PTHREAD_COND_SIGNAL = @HAVE_PTHREAD_COND_SIGNAL@ HAVE_PTHREAD_COND_TIMEDWAIT = @HAVE_PTHREAD_COND_TIMEDWAIT@ HAVE_PTHREAD_COND_WAIT = @HAVE_PTHREAD_COND_WAIT@ HAVE_PTHREAD_CREATE = @HAVE_PTHREAD_CREATE@ HAVE_PTHREAD_CREATE_DETACHED = @HAVE_PTHREAD_CREATE_DETACHED@ HAVE_PTHREAD_DETACH = @HAVE_PTHREAD_DETACH@ HAVE_PTHREAD_EQUAL = @HAVE_PTHREAD_EQUAL@ HAVE_PTHREAD_EXIT = @HAVE_PTHREAD_EXIT@ HAVE_PTHREAD_GETSPECIFIC = @HAVE_PTHREAD_GETSPECIFIC@ HAVE_PTHREAD_H = @HAVE_PTHREAD_H@ HAVE_PTHREAD_JOIN = @HAVE_PTHREAD_JOIN@ HAVE_PTHREAD_KEY_CREATE = @HAVE_PTHREAD_KEY_CREATE@ HAVE_PTHREAD_KEY_DELETE = @HAVE_PTHREAD_KEY_DELETE@ HAVE_PTHREAD_MUTEXATTR_DESTROY = @HAVE_PTHREAD_MUTEXATTR_DESTROY@ HAVE_PTHREAD_MUTEXATTR_GETROBUST = @HAVE_PTHREAD_MUTEXATTR_GETROBUST@ HAVE_PTHREAD_MUTEXATTR_GETTYPE = @HAVE_PTHREAD_MUTEXATTR_GETTYPE@ HAVE_PTHREAD_MUTEXATTR_INIT = @HAVE_PTHREAD_MUTEXATTR_INIT@ HAVE_PTHREAD_MUTEXATTR_SETROBUST = @HAVE_PTHREAD_MUTEXATTR_SETROBUST@ HAVE_PTHREAD_MUTEXATTR_SETTYPE = @HAVE_PTHREAD_MUTEXATTR_SETTYPE@ HAVE_PTHREAD_MUTEX_DESTROY = @HAVE_PTHREAD_MUTEX_DESTROY@ HAVE_PTHREAD_MUTEX_INIT = @HAVE_PTHREAD_MUTEX_INIT@ HAVE_PTHREAD_MUTEX_LOCK = @HAVE_PTHREAD_MUTEX_LOCK@ HAVE_PTHREAD_MUTEX_RECURSIVE = @HAVE_PTHREAD_MUTEX_RECURSIVE@ HAVE_PTHREAD_MUTEX_ROBUST = @HAVE_PTHREAD_MUTEX_ROBUST@ HAVE_PTHREAD_MUTEX_TIMEDLOCK = @HAVE_PTHREAD_MUTEX_TIMEDLOCK@ HAVE_PTHREAD_MUTEX_TRYLOCK = @HAVE_PTHREAD_MUTEX_TRYLOCK@ HAVE_PTHREAD_MUTEX_UNLOCK = @HAVE_PTHREAD_MUTEX_UNLOCK@ HAVE_PTHREAD_ONCE = @HAVE_PTHREAD_ONCE@ HAVE_PTHREAD_PROCESS_SHARED = @HAVE_PTHREAD_PROCESS_SHARED@ HAVE_PTHREAD_RWLOCKATTR_DESTROY = @HAVE_PTHREAD_RWLOCKATTR_DESTROY@ HAVE_PTHREAD_RWLOCKATTR_INIT = @HAVE_PTHREAD_RWLOCKATTR_INIT@ HAVE_PTHREAD_RWLOCK_DESTROY = @HAVE_PTHREAD_RWLOCK_DESTROY@ HAVE_PTHREAD_RWLOCK_INIT = @HAVE_PTHREAD_RWLOCK_INIT@ HAVE_PTHREAD_RWLOCK_RDLOCK = @HAVE_PTHREAD_RWLOCK_RDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@ HAVE_PTHREAD_RWLOCK_TRYRDLOCK = @HAVE_PTHREAD_RWLOCK_TRYRDLOCK@ HAVE_PTHREAD_RWLOCK_TRYWRLOCK = @HAVE_PTHREAD_RWLOCK_TRYWRLOCK@ HAVE_PTHREAD_RWLOCK_UNLOCK = @HAVE_PTHREAD_RWLOCK_UNLOCK@ HAVE_PTHREAD_RWLOCK_WRLOCK = @HAVE_PTHREAD_RWLOCK_WRLOCK@ HAVE_PTHREAD_SELF = @HAVE_PTHREAD_SELF@ HAVE_PTHREAD_SETSPECIFIC = @HAVE_PTHREAD_SETSPECIFIC@ HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@ HAVE_PTHREAD_SPINLOCK_T = @HAVE_PTHREAD_SPINLOCK_T@ HAVE_PTHREAD_SPIN_DESTROY = @HAVE_PTHREAD_SPIN_DESTROY@ HAVE_PTHREAD_SPIN_INIT = @HAVE_PTHREAD_SPIN_INIT@ HAVE_PTHREAD_SPIN_LOCK = @HAVE_PTHREAD_SPIN_LOCK@ HAVE_PTHREAD_SPIN_TRYLOCK = @HAVE_PTHREAD_SPIN_TRYLOCK@ HAVE_PTHREAD_SPIN_UNLOCK = @HAVE_PTHREAD_SPIN_UNLOCK@ HAVE_PTHREAD_T = @HAVE_PTHREAD_T@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RAISE = @HAVE_RAISE@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READDIR = @HAVE_READDIR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RENAMEAT = @HAVE_RENAMEAT@ HAVE_REWINDDIR = @HAVE_REWINDDIR@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SA_FAMILY_T = @HAVE_SA_FAMILY_T@ HAVE_SCANDIR = @HAVE_SCANDIR@ HAVE_SCHED_H = @HAVE_SCHED_H@ HAVE_SCHED_YIELD = @HAVE_SCHED_YIELD@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ HAVE_SETSTATE = @HAVE_SETSTATE@ HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@ HAVE_SIGACTION = @HAVE_SIGACTION@ HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@ HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRTOL = @HAVE_STRTOL@ HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOUL = @HAVE_STRTOUL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRUCT_SCHED_PARAM = @HAVE_STRUCT_SCHED_PARAM@ HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@ HAVE_STRUCT_SOCKADDR_STORAGE = @HAVE_STRUCT_SOCKADDR_STORAGE@ HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = @HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_IOCTL_H = @HAVE_SYS_IOCTL_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@ HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_SYS_UIO_H = @HAVE_SYS_UIO_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@ HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_VDPRINTF = @HAVE_VDPRINTF@ HAVE_VISIBILITY = @HAVE_VISIBILITY@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCPCPY = @HAVE_WCPCPY@ HAVE_WCPNCPY = @HAVE_WCPNCPY@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ HAVE_WCSCASECMP = @HAVE_WCSCASECMP@ HAVE_WCSCAT = @HAVE_WCSCAT@ HAVE_WCSCHR = @HAVE_WCSCHR@ HAVE_WCSCMP = @HAVE_WCSCMP@ HAVE_WCSCOLL = @HAVE_WCSCOLL@ HAVE_WCSCPY = @HAVE_WCSCPY@ HAVE_WCSCSPN = @HAVE_WCSCSPN@ HAVE_WCSDUP = @HAVE_WCSDUP@ HAVE_WCSFTIME = @HAVE_WCSFTIME@ HAVE_WCSLEN = @HAVE_WCSLEN@ HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@ HAVE_WCSNCAT = @HAVE_WCSNCAT@ HAVE_WCSNCMP = @HAVE_WCSNCMP@ HAVE_WCSNCPY = @HAVE_WCSNCPY@ HAVE_WCSNLEN = @HAVE_WCSNLEN@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSPBRK = @HAVE_WCSPBRK@ HAVE_WCSRCHR = @HAVE_WCSRCHR@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCSSPN = @HAVE_WCSSPN@ HAVE_WCSSTR = @HAVE_WCSSTR@ HAVE_WCSTOK = @HAVE_WCSTOK@ HAVE_WCSWIDTH = @HAVE_WCSWIDTH@ HAVE_WCSXFRM = @HAVE_WCSXFRM@ HAVE_WCTRANS_T = @HAVE_WCTRANS_T@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WCTYPE_T = @HAVE_WCTYPE_T@ HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE_WMEMCHR = @HAVE_WMEMCHR@ HAVE_WMEMCMP = @HAVE_WMEMCMP@ HAVE_WMEMCPY = @HAVE_WMEMCPY@ HAVE_WMEMMOVE = @HAVE_WMEMMOVE@ HAVE_WMEMPCPY = @HAVE_WMEMPCPY@ HAVE_WMEMSET = @HAVE_WMEMSET@ HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@ HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HAVE__EXIT = @HAVE__EXIT@ HOST_CPU = @HOST_CPU@ HOST_CPU_C_ABI = @HOST_CPU_C_ABI@ ICONV_CONST = @ICONV_CONST@ ICONV_H = @ICONV_H@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INET_PTON_LIB = @INET_PTON_LIB@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBCSTACK = @LIBCSTACK@ LIBGREPUTILS_LIBDEPS = @LIBGREPUTILS_LIBDEPS@ LIBGREPUTILS_LTLIBDEPS = @LIBGREPUTILS_LTLIBDEPS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ LIBPMULTITHREAD = @LIBPMULTITHREAD@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBSIGSEGV = @LIBSIGSEGV@ LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@ LIBSOCKET = @LIBSOCKET@ LIBSTDTHREAD = @LIBSTDTHREAD@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ LIBTHREAD = @LIBTHREAD@ LIBUNISTRING_UNISTR_H = @LIBUNISTRING_UNISTR_H@ LIBUNISTRING_UNITYPES_H = @LIBUNISTRING_UNITYPES_H@ LIBUNISTRING_UNIWIDTH_H = @LIBUNISTRING_UNIWIDTH_H@ LIB_HARD_LOCALE = @LIB_HARD_LOCALE@ LIB_MBRTOWC = @LIB_MBRTOWC@ LIB_NANOSLEEP = @LIB_NANOSLEEP@ LIB_NL_LANGINFO = @LIB_NL_LANGINFO@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ LIB_SCHED_YIELD = @LIB_SCHED_YIELD@ LIB_SELECT = @LIB_SELECT@ LIB_SETLOCALE = @LIB_SETLOCALE@ LIB_SETLOCALE_NULL = @LIB_SETLOCALE_NULL@ LIMITS_H = @LIMITS_H@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALENAME_ENHANCE_LOCALE_FUNCS = @LOCALENAME_ENHANCE_LOCALE_FUNCS@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBCSTACK = @LTLIBCSTACK@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ LTLIBSIGSEGV = @LTLIBSIGSEGV@ LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ NETINET_IN_H = @NETINET_IN_H@ NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_CTYPE_H@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H = @NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@ NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@ NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H = @NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H@ NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H = @NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H@ NEXT_AS_FIRST_DIRECTIVE_SCHED_H = @NEXT_AS_FIRST_DIRECTIVE_SCHED_H@ NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@ NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_CTYPE_H = @NEXT_CTYPE_H@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_FNMATCH_H = @NEXT_FNMATCH_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ NEXT_LANGINFO_H = @NEXT_LANGINFO_H@ NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@ NEXT_PTHREAD_H = @NEXT_PTHREAD_H@ NEXT_SCHED_H = @NEXT_SCHED_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_IOCTL_H = @NEXT_SYS_IOCTL_H@ NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@ NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@ NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NEXT_WCHAR_H = @NEXT_WCHAR_H@ NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_LIBS = @PCRE_LIBS@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ PRAGMA_COLUMNS = @PRAGMA_COLUMNS@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ PRIPTR_PREFIX = @PRIPTR_PREFIX@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_ACCESS = @REPLACE_ACCESS@ REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@ REPLACE_BTOWC = @REPLACE_BTOWC@ REPLACE_CALLOC = @REPLACE_CALLOC@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@ REPLACE_CREAT = @REPLACE_CREAT@ REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ REPLACE_EXECL = @REPLACE_EXECL@ REPLACE_EXECLE = @REPLACE_EXECLE@ REPLACE_EXECLP = @REPLACE_EXECLP@ REPLACE_EXECV = @REPLACE_EXECV@ REPLACE_EXECVE = @REPLACE_EXECVE@ REPLACE_EXECVP = @REPLACE_EXECVP@ REPLACE_EXECVPE = @REPLACE_EXECVPE@ REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHMODAT = @REPLACE_FCHMODAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ REPLACE_FDOPEN = @REPLACE_FDOPEN@ REPLACE_FDOPENDIR = @REPLACE_FDOPENDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ REPLACE_FFSLL = @REPLACE_FFSLL@ REPLACE_FNMATCH = @REPLACE_FNMATCH@ REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ REPLACE_FPURGE = @REPLACE_FPURGE@ REPLACE_FREE = @REPLACE_FREE@ REPLACE_FREELOCALE = @REPLACE_FREELOCALE@ REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FSEEK = @REPLACE_FSEEK@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FSTAT = @REPLACE_FSTAT@ REPLACE_FSTATAT = @REPLACE_FSTATAT@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@ REPLACE_FUTIMENS = @REPLACE_FUTIMENS@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETDELIM = @REPLACE_GETDELIM@ REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ REPLACE_GETDTABLESIZE = @REPLACE_GETDTABLESIZE@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETLINE = @REPLACE_GETLINE@ REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETPASS = @REPLACE_GETPASS@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ REPLACE_GMTIME = @REPLACE_GMTIME@ REPLACE_ICONV = @REPLACE_ICONV@ REPLACE_ICONV_OPEN = @REPLACE_ICONV_OPEN@ REPLACE_ICONV_UTF = @REPLACE_ICONV_UTF@ REPLACE_INET_NTOP = @REPLACE_INET_NTOP@ REPLACE_INET_PTON = @REPLACE_INET_PTON@ REPLACE_INITSTATE = @REPLACE_INITSTATE@ REPLACE_IOCTL = @REPLACE_IOCTL@ REPLACE_ISATTY = @REPLACE_ISATTY@ REPLACE_ISWBLANK = @REPLACE_ISWBLANK@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_ISWDIGIT = @REPLACE_ISWDIGIT@ REPLACE_ISWXDIGIT = @REPLACE_ISWXDIGIT@ REPLACE_ITOLD = @REPLACE_ITOLD@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LOCALECONV = @REPLACE_LOCALECONV@ REPLACE_LOCALTIME = @REPLACE_LOCALTIME@ REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_LSTAT = @REPLACE_LSTAT@ REPLACE_MALLOC = @REPLACE_MALLOC@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ REPLACE_MBSINIT = @REPLACE_MBSINIT@ REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@ REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@ REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@ REPLACE_MBTOWC = @REPLACE_MBTOWC@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKDIR = @REPLACE_MKDIR@ REPLACE_MKFIFO = @REPLACE_MKFIFO@ REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@ REPLACE_MKNOD = @REPLACE_MKNOD@ REPLACE_MKNODAT = @REPLACE_MKNODAT@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_MKTIME = @REPLACE_MKTIME@ REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ REPLACE_NEWLOCALE = @REPLACE_NEWLOCALE@ REPLACE_NL_LANGINFO = @REPLACE_NL_LANGINFO@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ REPLACE_OPEN = @REPLACE_OPEN@ REPLACE_OPENAT = @REPLACE_OPENAT@ REPLACE_OPENDIR = @REPLACE_OPENDIR@ REPLACE_PERROR = @REPLACE_PERROR@ REPLACE_POPEN = @REPLACE_POPEN@ REPLACE_POSIX_MEMALIGN = @REPLACE_POSIX_MEMALIGN@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PRINTF = @REPLACE_PRINTF@ REPLACE_PSELECT = @REPLACE_PSELECT@ REPLACE_PTHREAD_ATTR_DESTROY = @REPLACE_PTHREAD_ATTR_DESTROY@ REPLACE_PTHREAD_ATTR_GETDETACHSTATE = @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@ REPLACE_PTHREAD_ATTR_INIT = @REPLACE_PTHREAD_ATTR_INIT@ REPLACE_PTHREAD_ATTR_SETDETACHSTATE = @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@ REPLACE_PTHREAD_CONDATTR_DESTROY = @REPLACE_PTHREAD_CONDATTR_DESTROY@ REPLACE_PTHREAD_CONDATTR_INIT = @REPLACE_PTHREAD_CONDATTR_INIT@ REPLACE_PTHREAD_COND_BROADCAST = @REPLACE_PTHREAD_COND_BROADCAST@ REPLACE_PTHREAD_COND_DESTROY = @REPLACE_PTHREAD_COND_DESTROY@ REPLACE_PTHREAD_COND_INIT = @REPLACE_PTHREAD_COND_INIT@ REPLACE_PTHREAD_COND_SIGNAL = @REPLACE_PTHREAD_COND_SIGNAL@ REPLACE_PTHREAD_COND_TIMEDWAIT = @REPLACE_PTHREAD_COND_TIMEDWAIT@ REPLACE_PTHREAD_COND_WAIT = @REPLACE_PTHREAD_COND_WAIT@ REPLACE_PTHREAD_CREATE = @REPLACE_PTHREAD_CREATE@ REPLACE_PTHREAD_DETACH = @REPLACE_PTHREAD_DETACH@ REPLACE_PTHREAD_EQUAL = @REPLACE_PTHREAD_EQUAL@ REPLACE_PTHREAD_EXIT = @REPLACE_PTHREAD_EXIT@ REPLACE_PTHREAD_GETSPECIFIC = @REPLACE_PTHREAD_GETSPECIFIC@ REPLACE_PTHREAD_JOIN = @REPLACE_PTHREAD_JOIN@ REPLACE_PTHREAD_KEY_CREATE = @REPLACE_PTHREAD_KEY_CREATE@ REPLACE_PTHREAD_KEY_DELETE = @REPLACE_PTHREAD_KEY_DELETE@ REPLACE_PTHREAD_MUTEXATTR_DESTROY = @REPLACE_PTHREAD_MUTEXATTR_DESTROY@ REPLACE_PTHREAD_MUTEXATTR_GETROBUST = @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@ REPLACE_PTHREAD_MUTEXATTR_GETTYPE = @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@ REPLACE_PTHREAD_MUTEXATTR_INIT = @REPLACE_PTHREAD_MUTEXATTR_INIT@ REPLACE_PTHREAD_MUTEXATTR_SETROBUST = @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@ REPLACE_PTHREAD_MUTEXATTR_SETTYPE = @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@ REPLACE_PTHREAD_MUTEX_DESTROY = @REPLACE_PTHREAD_MUTEX_DESTROY@ REPLACE_PTHREAD_MUTEX_INIT = @REPLACE_PTHREAD_MUTEX_INIT@ REPLACE_PTHREAD_MUTEX_LOCK = @REPLACE_PTHREAD_MUTEX_LOCK@ REPLACE_PTHREAD_MUTEX_TIMEDLOCK = @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@ REPLACE_PTHREAD_MUTEX_TRYLOCK = @REPLACE_PTHREAD_MUTEX_TRYLOCK@ REPLACE_PTHREAD_MUTEX_UNLOCK = @REPLACE_PTHREAD_MUTEX_UNLOCK@ REPLACE_PTHREAD_ONCE = @REPLACE_PTHREAD_ONCE@ REPLACE_PTHREAD_RWLOCKATTR_DESTROY = @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@ REPLACE_PTHREAD_RWLOCKATTR_INIT = @REPLACE_PTHREAD_RWLOCKATTR_INIT@ REPLACE_PTHREAD_RWLOCK_DESTROY = @REPLACE_PTHREAD_RWLOCK_DESTROY@ REPLACE_PTHREAD_RWLOCK_INIT = @REPLACE_PTHREAD_RWLOCK_INIT@ REPLACE_PTHREAD_RWLOCK_RDLOCK = @REPLACE_PTHREAD_RWLOCK_RDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@ REPLACE_PTHREAD_RWLOCK_TRYRDLOCK = @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@ REPLACE_PTHREAD_RWLOCK_TRYWRLOCK = @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@ REPLACE_PTHREAD_RWLOCK_UNLOCK = @REPLACE_PTHREAD_RWLOCK_UNLOCK@ REPLACE_PTHREAD_RWLOCK_WRLOCK = @REPLACE_PTHREAD_RWLOCK_WRLOCK@ REPLACE_PTHREAD_SELF = @REPLACE_PTHREAD_SELF@ REPLACE_PTHREAD_SETSPECIFIC = @REPLACE_PTHREAD_SETSPECIFIC@ REPLACE_PTHREAD_SIGMASK = @REPLACE_PTHREAD_SIGMASK@ REPLACE_PTHREAD_SPIN_DESTROY = @REPLACE_PTHREAD_SPIN_DESTROY@ REPLACE_PTHREAD_SPIN_INIT = @REPLACE_PTHREAD_SPIN_INIT@ REPLACE_PTHREAD_SPIN_LOCK = @REPLACE_PTHREAD_SPIN_LOCK@ REPLACE_PTHREAD_SPIN_TRYLOCK = @REPLACE_PTHREAD_SPIN_TRYLOCK@ REPLACE_PTHREAD_SPIN_UNLOCK = @REPLACE_PTHREAD_SPIN_UNLOCK@ REPLACE_PTSNAME = @REPLACE_PTSNAME@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RAISE = @REPLACE_RAISE@ REPLACE_RANDOM = @REPLACE_RANDOM@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SCHED_YIELD = @REPLACE_SCHED_YIELD@ REPLACE_SELECT = @REPLACE_SELECT@ REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SETLOCALE = @REPLACE_SETLOCALE@ REPLACE_SETSTATE = @REPLACE_SETSTATE@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ REPLACE_STAT = @REPLACE_STAT@ REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@ REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRTOL = @REPLACE_STRTOL@ REPLACE_STRTOLD = @REPLACE_STRTOLD@ REPLACE_STRTOLL = @REPLACE_STRTOLL@ REPLACE_STRTOUL = @REPLACE_STRTOUL@ REPLACE_STRTOULL = @REPLACE_STRTOULL@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TOWLOWER = @REPLACE_TOWLOWER@ REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_TZSET = @REPLACE_TZSET@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VDPRINTF = @REPLACE_VDPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ REPLACE_WCSTOK = @REPLACE_WCSTOK@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ REPLACE_WCTOMB = @REPLACE_WCTOMB@ REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIGSEGV_H = @SIGSEGV_H@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STDALIGN_H = @STDALIGN_H@ STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_IOCTL_H_HAVE_WINSOCK2_H = @SYS_IOCTL_H_HAVE_WINSOCK2_H@ SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@ UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WERROR_CFLAGS = @WERROR_CFLAGS@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@ WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_aux_dir = @abs_aux_dir@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) AM_CPPFLAGS = BUILT_SOURCES = $(ALLOCA_H) configmake.h ctype.h dirent.h \ malloc/dynarray.gl.h malloc/dynarray-skeleton.gl.h $(ERRNO_H) \ fcntl.h $(FNMATCH_H) $(GETOPT_H) $(GETOPT_CDEFS_H) $(ICONV_H) \ iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h \ iconv_open-osf.h iconv_open-solaris.h iconv_open-zos.h \ inttypes.h langinfo.h $(LIMITS_H) locale.h signal.h \ $(SIGSEGV_H) $(STDALIGN_H) $(STDARG_H) $(STDBOOL_H) \ $(STDDEF_H) $(STDINT_H) stdio.h stdlib.h string.h sys/stat.h \ sys/types.h time.h unistd.h $(LIBUNISTRING_UNISTR_H) \ $(LIBUNISTRING_UNITYPES_H) $(LIBUNISTRING_UNIWIDTH_H) wchar.h \ wctype.h CLEANFILES = configmake.h configmake.h-t colorize.c EXTRA_DIST = alignof.h alloca.c alloca.in.h \ $(top_srcdir)/build-aux/announce-gen argmatch.h assure.h \ attribute.h basename-lgpl.h btowc.c c-strcaseeq.h calloc.c \ calloc.c chdir-long.c chdir-long.h cloexec.h close.c \ close-stream.h closedir.c dirent-private.h closeout.h \ ctype.in.h cycle-check.h dev-ino.h dfa.h localeinfo.h \ dirent.in.h dirfd.c dirname.h \ $(top_srcdir)/build-aux/do-release-commit-and-tag dup.c dup2.c \ dynarray.h malloc/dynarray-skeleton.c malloc/dynarray.h \ errno.in.h error.c error.h exclude.h exitfail.h fchdir.c \ fcntl.c fcntl.in.h fcntl--.h fcntl-safer.h fd-hook.h \ fdopendir.c filename.h filenamecat.h flexmember.h fnmatch.c \ fnmatch_loop.c fnmatch.in.h fopen.c fopen.c fpending.c \ fpending.h stdio-impl.h free.c fstat.c stat-w32.c stat-w32.h \ at-func.c fstatat.c fts-cycle.c fts.c fts_.h \ $(top_srcdir)/build-aux/gendocs.sh getcwd-lgpl.c \ getdtablesize.c getopt-cdefs.in.h getopt-core.h getopt-ext.h \ getopt-pfx-core.h getopt-pfx-ext.h getopt.c getopt.in.h \ getopt1.c getopt_int.h getpagesize.c \ $(top_srcdir)/build-aux/git-version-gen \ $(top_srcdir)/build-aux/gitlog-to-changelog \ $(top_srcdir)/build-aux/gnu-web-doc-update \ $(top_srcdir)/GNUmakefile $(top_srcdir)/build-aux/gnupload \ hard-locale.h hash.h $(top_srcdir)/build-aux/config.rpath \ i-ring.h ialloc.h iconv.in.h iconv_open-aix.h \ iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h \ iconv_open-solaris.h iconv_open-zos.h iconv.c iconv_close.c \ iconv_open-aix.gperf iconv_open-hpux.gperf \ iconv_open-irix.gperf iconv_open-osf.gperf \ iconv_open-solaris.gperf iconv_open-zos.gperf iconv_open.c \ ignore-value.h intprops.h inttypes.in.h isatty.c isblank.c \ iswblank.c iswctype-impl.h iswctype.c iswdigit.c iswxdigit.c \ langinfo.in.h cdefs.h libc-config.h limits.in.h localcharset.h \ locale.in.h localeconv.c lseek.c lstat.c \ $(top_srcdir)/maint.mk malloc.c malloc.c malloca.h mbchar.h \ mbrlen.c lc-charset-dispatch.c lc-charset-dispatch.h \ mbrtowc-impl-utf8.h mbrtowc-impl.h mbrtowc.c mbtowc-lock.c \ mbtowc-lock.h windows-initguard.h mbsinit.c mbsrtowcs-impl.h \ mbsrtowcs-state.c mbsrtowcs.c str-kmp.h mbtowc-impl.h mbtowc.c \ memchr.c memchr.valgrind memchr2.valgrind mempcpy.c memrchr.c \ msvc-inval.c msvc-inval.h msvc-nothrow.c msvc-nothrow.h \ nl_langinfo-lock.c nl_langinfo.c windows-initguard.h obstack.c \ obstack.h open.c openat.c openat.h fcntl--.h fcntl-safer.h \ dirent-private.h opendir.c opendirat.h pathmax.h pipe.c \ quote.h quote.h quotearg.h raise.c rawmemchr.c \ rawmemchr.valgrind read.c dirent-private.h readdir.c realloc.c \ realloc.c reallocarray.c regcomp.c regex.c regex.h \ regex_internal.c regex_internal.h regexec.c safe-read.h \ sys-limits.h same-inode.h save-cwd.h setlocale-lock.c \ setlocale_null.h windows-initguard.h signal.in.h sigsegv.in.h \ stackvma.h _Noreturn.h arg-nonnull.h c++defs.h warn-on-use.h \ stat-w32.c stat-w32.h stat.c stat-time.h stdalign.in.h \ stdarg.in.h stdbool.in.h stddef.in.h stdint.in.h stdio.in.h \ stdlib.in.h stpcpy.c strdup.c streq.h strerror.c \ strerror-override.c strerror-override.h string.in.h strnlen.c \ strstr.c str-two-way.h strstr.c strtoimax.c strtol.c strtoll.c \ strtol.c strtoul.c strtoull.c strtoimax.c strtoumax.c \ sys_stat.in.h sys_types.in.h time.in.h trim.h unistd.in.h \ unistd--.h unistd-safer.h unistr.in.h unitypes.in.h \ localcharset.h uniwidth.in.h uniwidth/cjk.h unlocked-io.h \ $(top_srcdir)/build-aux/update-copyright \ $(top_srcdir)/build-aux/useless-if-before-free \ $(top_srcdir)/build-aux/vc-list-files verify.h wchar.in.h \ wcrtomb.c wctob.c wctomb-impl.h wctomb.c wctype.in.h wcwidth.c \ windows-initguard.h windows-mutex.c windows-mutex.h \ windows-once.c windows-once.h windows-initguard.h \ windows-recmutex.c windows-recmutex.h windows-initguard.h \ windows-rwlock.c windows-rwlock.h wmemchr-impl.h wmemchr.c \ wmempcpy.c xalloc.h xalloc.h xalloc-oversized.h xstrtol.h \ colorize-posix.c colorize-w32.c MAINTAINERCLEANFILES = iconv_open-aix.h iconv_open-hpux.h \ iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h \ iconv_open-zos.h MOSTLYCLEANDIRS = sys MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t ctype.h \ ctype.h-t dirent.h dirent.h-t malloc/dynarray.gl.h \ malloc/dynarray.gl.h-t malloc/dynarray-skeleton.gl.h \ malloc/dynarray-skeleton.gl.h-t errno.h errno.h-t fcntl.h \ fcntl.h-t fnmatch.h fnmatch.h-t getopt.h getopt.h-t \ getopt-cdefs.h getopt-cdefs.h-t iconv.h iconv.h-t \ iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h-t \ iconv_open-osf.h-t iconv_open-solaris.h-t iconv_open-zos.h-t \ inttypes.h inttypes.h-t langinfo.h langinfo.h-t limits.h \ limits.h-t locale.h locale.h-t signal.h signal.h-t sigsegv.h \ sigsegv.h-t stdalign.h stdalign.h-t stdarg.h stdarg.h-t \ stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t \ stdio.h stdio.h-t stdlib.h stdlib.h-t string.h string.h-t \ sys/stat.h sys/stat.h-t sys/types.h sys/types.h-t time.h \ time.h-t unistd.h unistd.h-t unistr.h unistr.h-t unitypes.h \ unitypes.h-t uniwidth.h uniwidth.h-t wchar.h wchar.h-t \ wctype.h wctype.h-t SUFFIXES = # No GNU Make output. noinst_LIBRARIES = libgreputils.a libgreputils_a_SOURCES = argmatch.c openat-priv.h openat-proc.c \ basename-lgpl.c binary-io.h binary-io.c bitrotate.h \ bitrotate.c c-ctype.h c-ctype.c c-stack.h c-stack.c \ c-strcase.h c-strcasecmp.c c-strncasecmp.c cloexec.c \ close-stream.c closeout.c cycle-check.c dfa.c localeinfo.c \ dirname-lgpl.c stripslash.c malloc/dynarray_at_failure.c \ malloc/dynarray_emplace_enlarge.c malloc/dynarray_finalize.c \ malloc/dynarray_resize.c malloc/dynarray_resize_clear.c \ exclude.c exitfail.c creat-safer.c open-safer.c fd-hook.c \ fd-safer-flag.c dup-safer-flag.c filenamecat-lgpl.c \ getprogname.h getprogname.c gettext.h hard-locale.c hash.c \ i-ring.c ialloc.c idx.h localcharset.c glthread/lock.h \ glthread/lock.c malloca.c mbchar.c mbiter.h mbiter.c \ mbscasecmp.c mbslen.c mbsstr.c mbuiter.h mbuiter.c memchr2.h \ memchr2.c minmax.h openat-die.c openat-safer.c opendirat.c \ propername.h propername.c quotearg.c safe-read.c save-cwd.c \ setlocale_null.c $(am__append_1) stat-time.c striconv.h \ striconv.c strnlen1.h strnlen1.c glthread/threadlib.c trim.c \ unistd.c dup-safer.c fd-safer.c pipe-safer.c $(am__append_2) \ $(am__append_3) $(am__append_4) version-etc.h version-etc.c \ version-etc-fsf.c wctype-h.c xmalloc.c xalloc-die.c \ xbinary-io.h xbinary-io.c xstriconv.h xstriconv.c xstrtoimax.c \ xstrtol.c xstrtoul.c colorize.h libgreputils_a_LIBADD = $(gl_LIBOBJS) @ALLOCA@ $(LIBOBJS) $(ALLOCA) libgreputils_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@ $(LIBOBJS) \ $(ALLOCA) EXTRA_libgreputils_a_SOURCES = alloca.c btowc.c calloc.c calloc.c \ chdir-long.c close.c closedir.c dirfd.c dup.c dup2.c \ malloc/dynarray-skeleton.c error.c fchdir.c fcntl.c \ fdopendir.c fnmatch.c fnmatch_loop.c fopen.c fopen.c \ fpending.c free.c fstat.c stat-w32.c at-func.c fstatat.c \ fts-cycle.c fts.c getcwd-lgpl.c getdtablesize.c getopt.c \ getopt1.c getpagesize.c iconv.c iconv_close.c iconv_open.c \ isatty.c isblank.c iswblank.c iswctype.c iswdigit.c \ iswxdigit.c localeconv.c lseek.c lstat.c malloc.c malloc.c \ mbrlen.c lc-charset-dispatch.c mbrtowc.c mbtowc-lock.c \ mbsinit.c mbsrtowcs-state.c mbsrtowcs.c mbtowc.c memchr.c \ mempcpy.c memrchr.c msvc-inval.c msvc-nothrow.c \ nl_langinfo-lock.c nl_langinfo.c obstack.c open.c openat.c \ opendir.c pipe.c raise.c rawmemchr.c read.c readdir.c \ realloc.c realloc.c reallocarray.c regcomp.c regex.c \ regex_internal.c regexec.c setlocale-lock.c stat-w32.c stat.c \ stpcpy.c strdup.c strerror.c strerror-override.c strnlen.c \ strstr.c strstr.c strtoimax.c strtol.c strtoll.c strtol.c \ strtoul.c strtoull.c strtoimax.c strtoumax.c wcrtomb.c wctob.c \ wctomb.c wcwidth.c windows-mutex.c windows-once.c \ windows-recmutex.c windows-rwlock.c wmemchr.c wmempcpy.c # Use this preprocessor expression to decide whether #include_next works. # Do not rely on a 'configure'-time test for this, since the expression # might appear in an installed header, which is used by some other compiler. HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER) GPERF = gperf V_GPERF = $(V_GPERF_@AM_V@) V_GPERF_ = $(V_GPERF_@AM_DEFAULT_V@) V_GPERF_0 = @echo " GPERF " $@; # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. _NORETURN_H = $(srcdir)/_Noreturn.h # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. ARG_NONNULL_H = $(srcdir)/arg-nonnull.h # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. CXXDEFS_H = $(srcdir)/c++defs.h # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. WARN_ON_USE_H = $(srcdir)/warn-on-use.h nodist_libgreputils_a_SOURCES = colorize.c all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/gnulib.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(srcdir)/gnulib.mk $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) malloc/$(am__dirstamp): @$(MKDIR_P) malloc @: > malloc/$(am__dirstamp) malloc/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) malloc/$(DEPDIR) @: > malloc/$(DEPDIR)/$(am__dirstamp) malloc/dynarray_at_failure.$(OBJEXT): malloc/$(am__dirstamp) \ malloc/$(DEPDIR)/$(am__dirstamp) malloc/dynarray_emplace_enlarge.$(OBJEXT): malloc/$(am__dirstamp) \ malloc/$(DEPDIR)/$(am__dirstamp) malloc/dynarray_finalize.$(OBJEXT): malloc/$(am__dirstamp) \ malloc/$(DEPDIR)/$(am__dirstamp) malloc/dynarray_resize.$(OBJEXT): malloc/$(am__dirstamp) \ malloc/$(DEPDIR)/$(am__dirstamp) malloc/dynarray_resize_clear.$(OBJEXT): malloc/$(am__dirstamp) \ malloc/$(DEPDIR)/$(am__dirstamp) glthread/$(am__dirstamp): @$(MKDIR_P) glthread @: > glthread/$(am__dirstamp) glthread/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) glthread/$(DEPDIR) @: > glthread/$(DEPDIR)/$(am__dirstamp) glthread/lock.$(OBJEXT): glthread/$(am__dirstamp) \ glthread/$(DEPDIR)/$(am__dirstamp) glthread/threadlib.$(OBJEXT): glthread/$(am__dirstamp) \ glthread/$(DEPDIR)/$(am__dirstamp) unistr/$(am__dirstamp): @$(MKDIR_P) unistr @: > unistr/$(am__dirstamp) unistr/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) unistr/$(DEPDIR) @: > unistr/$(DEPDIR)/$(am__dirstamp) unistr/u8-mbtoucr.$(OBJEXT): unistr/$(am__dirstamp) \ unistr/$(DEPDIR)/$(am__dirstamp) unistr/u8-uctomb.$(OBJEXT): unistr/$(am__dirstamp) \ unistr/$(DEPDIR)/$(am__dirstamp) unistr/u8-uctomb-aux.$(OBJEXT): unistr/$(am__dirstamp) \ unistr/$(DEPDIR)/$(am__dirstamp) uniwidth/$(am__dirstamp): @$(MKDIR_P) uniwidth @: > uniwidth/$(am__dirstamp) uniwidth/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) uniwidth/$(DEPDIR) @: > uniwidth/$(DEPDIR)/$(am__dirstamp) uniwidth/width.$(OBJEXT): uniwidth/$(am__dirstamp) \ uniwidth/$(DEPDIR)/$(am__dirstamp) malloc/dynarray-skeleton.$(OBJEXT): malloc/$(am__dirstamp) \ malloc/$(DEPDIR)/$(am__dirstamp) libgreputils.a: $(libgreputils_a_OBJECTS) $(libgreputils_a_DEPENDENCIES) $(EXTRA_libgreputils_a_DEPENDENCIES) $(AM_V_at)-rm -f libgreputils.a $(AM_V_AR)$(libgreputils_a_AR) libgreputils.a $(libgreputils_a_OBJECTS) $(libgreputils_a_LIBADD) $(AM_V_at)$(RANLIB) libgreputils.a mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f glthread/*.$(OBJEXT) -rm -f malloc/*.$(OBJEXT) -rm -f unistr/*.$(OBJEXT) -rm -f uniwidth/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloca.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argmatch.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at-func.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename-lgpl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binary-io.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitrotate.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btowc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-ctype.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-stack.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strcasecmp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strncasecmp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calloc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chdir-long.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cloexec.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close-stream.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closedir.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closeout.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/colorize.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/creat-safer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cycle-check.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfa.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirfd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirname-lgpl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup-safer-flag.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup-safer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exclude.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchdir.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcntl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-hook.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer-flag.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdopendir.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filenamecat-lgpl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fnmatch.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fnmatch_loop.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fopen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fpending.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/free.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstatat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fts-cycle.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fts.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcwd-lgpl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdtablesize.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getpagesize.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getprogname.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hard-locale.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i-ring.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ialloc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iconv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iconv_close.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iconv_open.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isatty.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isblank.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iswblank.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iswctype.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iswdigit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iswxdigit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lc-charset-dispatch.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localeconv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localeinfo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lseek.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloca.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbchar.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbiter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbrlen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbrtowc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbscasecmp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsinit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbslen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsrtowcs-state.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsrtowcs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsstr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbtowc-lock.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbtowc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbuiter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mempcpy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memrchr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msvc-inval.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msvc-nothrow.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nl_langinfo-lock.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nl_langinfo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obstack.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open-safer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-die.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-proc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-safer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opendir.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opendirat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipe-safer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipe.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/propername.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quotearg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raise.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawmemchr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readdir.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/realloc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reallocarray.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regcomp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex_internal.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regexec.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe-read.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/save-cwd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setlocale-lock.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setlocale_null.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigsegv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stackvma.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-time.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-w32.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stpcpy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strdup.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror-override.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/striconv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stripslash.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strstr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoimax.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoll.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoul.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoull.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoumax.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trim.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version-etc-fsf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version-etc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcrtomb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wctob.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wctomb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wctype-h.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcwidth.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-mutex.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-once.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-recmutex.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-rwlock.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wmemchr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wmempcpy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc-die.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbinary-io.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstriconv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrtoimax.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrtol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrtoul.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/lock.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/threadlib.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@malloc/$(DEPDIR)/dynarray-skeleton.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@malloc/$(DEPDIR)/dynarray_at_failure.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@malloc/$(DEPDIR)/dynarray_emplace_enlarge.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@malloc/$(DEPDIR)/dynarray_finalize.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@malloc/$(DEPDIR)/dynarray_resize.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@malloc/$(DEPDIR)/dynarray_resize_clear.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/u8-mbtoucr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/u8-uctomb-aux.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/u8-uctomb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@uniwidth/$(DEPDIR)/width.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LIBRARIES) installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f glthread/$(DEPDIR)/$(am__dirstamp) -rm -f glthread/$(am__dirstamp) -rm -f malloc/$(DEPDIR)/$(am__dirstamp) -rm -f malloc/$(am__dirstamp) -rm -f unistr/$(DEPDIR)/$(am__dirstamp) -rm -f unistr/$(am__dirstamp) -rm -f uniwidth/$(DEPDIR)/$(am__dirstamp) -rm -f uniwidth/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/alloca.Po -rm -f ./$(DEPDIR)/argmatch.Po -rm -f ./$(DEPDIR)/at-func.Po -rm -f ./$(DEPDIR)/basename-lgpl.Po -rm -f ./$(DEPDIR)/binary-io.Po -rm -f ./$(DEPDIR)/bitrotate.Po -rm -f ./$(DEPDIR)/btowc.Po -rm -f ./$(DEPDIR)/c-ctype.Po -rm -f ./$(DEPDIR)/c-stack.Po -rm -f ./$(DEPDIR)/c-strcasecmp.Po -rm -f ./$(DEPDIR)/c-strncasecmp.Po -rm -f ./$(DEPDIR)/calloc.Po -rm -f ./$(DEPDIR)/chdir-long.Po -rm -f ./$(DEPDIR)/cloexec.Po -rm -f ./$(DEPDIR)/close-stream.Po -rm -f ./$(DEPDIR)/close.Po -rm -f ./$(DEPDIR)/closedir.Po -rm -f ./$(DEPDIR)/closeout.Po -rm -f ./$(DEPDIR)/colorize.Po -rm -f ./$(DEPDIR)/creat-safer.Po -rm -f ./$(DEPDIR)/cycle-check.Po -rm -f ./$(DEPDIR)/dfa.Po -rm -f ./$(DEPDIR)/dirfd.Po -rm -f ./$(DEPDIR)/dirname-lgpl.Po -rm -f ./$(DEPDIR)/dup-safer-flag.Po -rm -f ./$(DEPDIR)/dup-safer.Po -rm -f ./$(DEPDIR)/dup.Po -rm -f ./$(DEPDIR)/dup2.Po -rm -f ./$(DEPDIR)/error.Po -rm -f ./$(DEPDIR)/exclude.Po -rm -f ./$(DEPDIR)/exitfail.Po -rm -f ./$(DEPDIR)/fchdir.Po -rm -f ./$(DEPDIR)/fcntl.Po -rm -f ./$(DEPDIR)/fd-hook.Po -rm -f ./$(DEPDIR)/fd-safer-flag.Po -rm -f ./$(DEPDIR)/fd-safer.Po -rm -f ./$(DEPDIR)/fdopendir.Po -rm -f ./$(DEPDIR)/filenamecat-lgpl.Po -rm -f ./$(DEPDIR)/fnmatch.Po -rm -f ./$(DEPDIR)/fnmatch_loop.Po -rm -f ./$(DEPDIR)/fopen.Po -rm -f ./$(DEPDIR)/fpending.Po -rm -f ./$(DEPDIR)/free.Po -rm -f ./$(DEPDIR)/fstat.Po -rm -f ./$(DEPDIR)/fstatat.Po -rm -f ./$(DEPDIR)/fts-cycle.Po -rm -f ./$(DEPDIR)/fts.Po -rm -f ./$(DEPDIR)/getcwd-lgpl.Po -rm -f ./$(DEPDIR)/getdtablesize.Po -rm -f ./$(DEPDIR)/getopt.Po -rm -f ./$(DEPDIR)/getopt1.Po -rm -f ./$(DEPDIR)/getpagesize.Po -rm -f ./$(DEPDIR)/getprogname.Po -rm -f ./$(DEPDIR)/hard-locale.Po -rm -f ./$(DEPDIR)/hash.Po -rm -f ./$(DEPDIR)/i-ring.Po -rm -f ./$(DEPDIR)/ialloc.Po -rm -f ./$(DEPDIR)/iconv.Po -rm -f ./$(DEPDIR)/iconv_close.Po -rm -f ./$(DEPDIR)/iconv_open.Po -rm -f ./$(DEPDIR)/isatty.Po -rm -f ./$(DEPDIR)/isblank.Po -rm -f ./$(DEPDIR)/iswblank.Po -rm -f ./$(DEPDIR)/iswctype.Po -rm -f ./$(DEPDIR)/iswdigit.Po -rm -f ./$(DEPDIR)/iswxdigit.Po -rm -f ./$(DEPDIR)/lc-charset-dispatch.Po -rm -f ./$(DEPDIR)/localcharset.Po -rm -f ./$(DEPDIR)/localeconv.Po -rm -f ./$(DEPDIR)/localeinfo.Po -rm -f ./$(DEPDIR)/lseek.Po -rm -f ./$(DEPDIR)/lstat.Po -rm -f ./$(DEPDIR)/malloc.Po -rm -f ./$(DEPDIR)/malloca.Po -rm -f ./$(DEPDIR)/mbchar.Po -rm -f ./$(DEPDIR)/mbiter.Po -rm -f ./$(DEPDIR)/mbrlen.Po -rm -f ./$(DEPDIR)/mbrtowc.Po -rm -f ./$(DEPDIR)/mbscasecmp.Po -rm -f ./$(DEPDIR)/mbsinit.Po -rm -f ./$(DEPDIR)/mbslen.Po -rm -f ./$(DEPDIR)/mbsrtowcs-state.Po -rm -f ./$(DEPDIR)/mbsrtowcs.Po -rm -f ./$(DEPDIR)/mbsstr.Po -rm -f ./$(DEPDIR)/mbtowc-lock.Po -rm -f ./$(DEPDIR)/mbtowc.Po -rm -f ./$(DEPDIR)/mbuiter.Po -rm -f ./$(DEPDIR)/memchr.Po -rm -f ./$(DEPDIR)/memchr2.Po -rm -f ./$(DEPDIR)/mempcpy.Po -rm -f ./$(DEPDIR)/memrchr.Po -rm -f ./$(DEPDIR)/msvc-inval.Po -rm -f ./$(DEPDIR)/msvc-nothrow.Po -rm -f ./$(DEPDIR)/nl_langinfo-lock.Po -rm -f ./$(DEPDIR)/nl_langinfo.Po -rm -f ./$(DEPDIR)/obstack.Po -rm -f ./$(DEPDIR)/open-safer.Po -rm -f ./$(DEPDIR)/open.Po -rm -f ./$(DEPDIR)/openat-die.Po -rm -f ./$(DEPDIR)/openat-proc.Po -rm -f ./$(DEPDIR)/openat-safer.Po -rm -f ./$(DEPDIR)/openat.Po -rm -f ./$(DEPDIR)/opendir.Po -rm -f ./$(DEPDIR)/opendirat.Po -rm -f ./$(DEPDIR)/pipe-safer.Po -rm -f ./$(DEPDIR)/pipe.Po -rm -f ./$(DEPDIR)/propername.Po -rm -f ./$(DEPDIR)/quotearg.Po -rm -f ./$(DEPDIR)/raise.Po -rm -f ./$(DEPDIR)/rawmemchr.Po -rm -f ./$(DEPDIR)/read.Po -rm -f ./$(DEPDIR)/readdir.Po -rm -f ./$(DEPDIR)/realloc.Po -rm -f ./$(DEPDIR)/reallocarray.Po -rm -f ./$(DEPDIR)/regcomp.Po -rm -f ./$(DEPDIR)/regex.Po -rm -f ./$(DEPDIR)/regex_internal.Po -rm -f ./$(DEPDIR)/regexec.Po -rm -f ./$(DEPDIR)/safe-read.Po -rm -f ./$(DEPDIR)/save-cwd.Po -rm -f ./$(DEPDIR)/setlocale-lock.Po -rm -f ./$(DEPDIR)/setlocale_null.Po -rm -f ./$(DEPDIR)/sigsegv.Po -rm -f ./$(DEPDIR)/stackvma.Po -rm -f ./$(DEPDIR)/stat-time.Po -rm -f ./$(DEPDIR)/stat-w32.Po -rm -f ./$(DEPDIR)/stat.Po -rm -f ./$(DEPDIR)/stpcpy.Po -rm -f ./$(DEPDIR)/strdup.Po -rm -f ./$(DEPDIR)/strerror-override.Po -rm -f ./$(DEPDIR)/strerror.Po -rm -f ./$(DEPDIR)/striconv.Po -rm -f ./$(DEPDIR)/stripslash.Po -rm -f ./$(DEPDIR)/strnlen.Po -rm -f ./$(DEPDIR)/strnlen1.Po -rm -f ./$(DEPDIR)/strstr.Po -rm -f ./$(DEPDIR)/strtoimax.Po -rm -f ./$(DEPDIR)/strtol.Po -rm -f ./$(DEPDIR)/strtoll.Po -rm -f ./$(DEPDIR)/strtoul.Po -rm -f ./$(DEPDIR)/strtoull.Po -rm -f ./$(DEPDIR)/strtoumax.Po -rm -f ./$(DEPDIR)/trim.Po -rm -f ./$(DEPDIR)/unistd.Po -rm -f ./$(DEPDIR)/version-etc-fsf.Po -rm -f ./$(DEPDIR)/version-etc.Po -rm -f ./$(DEPDIR)/wcrtomb.Po -rm -f ./$(DEPDIR)/wctob.Po -rm -f ./$(DEPDIR)/wctomb.Po -rm -f ./$(DEPDIR)/wctype-h.Po -rm -f ./$(DEPDIR)/wcwidth.Po -rm -f ./$(DEPDIR)/windows-mutex.Po -rm -f ./$(DEPDIR)/windows-once.Po -rm -f ./$(DEPDIR)/windows-recmutex.Po -rm -f ./$(DEPDIR)/windows-rwlock.Po -rm -f ./$(DEPDIR)/wmemchr.Po -rm -f ./$(DEPDIR)/wmempcpy.Po -rm -f ./$(DEPDIR)/xalloc-die.Po -rm -f ./$(DEPDIR)/xbinary-io.Po -rm -f ./$(DEPDIR)/xmalloc.Po -rm -f ./$(DEPDIR)/xstriconv.Po -rm -f ./$(DEPDIR)/xstrtoimax.Po -rm -f ./$(DEPDIR)/xstrtol.Po -rm -f ./$(DEPDIR)/xstrtoul.Po -rm -f glthread/$(DEPDIR)/lock.Po -rm -f glthread/$(DEPDIR)/threadlib.Po -rm -f malloc/$(DEPDIR)/dynarray-skeleton.Po -rm -f malloc/$(DEPDIR)/dynarray_at_failure.Po -rm -f malloc/$(DEPDIR)/dynarray_emplace_enlarge.Po -rm -f malloc/$(DEPDIR)/dynarray_finalize.Po -rm -f malloc/$(DEPDIR)/dynarray_resize.Po -rm -f malloc/$(DEPDIR)/dynarray_resize_clear.Po -rm -f unistr/$(DEPDIR)/u8-mbtoucr.Po -rm -f unistr/$(DEPDIR)/u8-uctomb-aux.Po -rm -f unistr/$(DEPDIR)/u8-uctomb.Po -rm -f uniwidth/$(DEPDIR)/width.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-local distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/alloca.Po -rm -f ./$(DEPDIR)/argmatch.Po -rm -f ./$(DEPDIR)/at-func.Po -rm -f ./$(DEPDIR)/basename-lgpl.Po -rm -f ./$(DEPDIR)/binary-io.Po -rm -f ./$(DEPDIR)/bitrotate.Po -rm -f ./$(DEPDIR)/btowc.Po -rm -f ./$(DEPDIR)/c-ctype.Po -rm -f ./$(DEPDIR)/c-stack.Po -rm -f ./$(DEPDIR)/c-strcasecmp.Po -rm -f ./$(DEPDIR)/c-strncasecmp.Po -rm -f ./$(DEPDIR)/calloc.Po -rm -f ./$(DEPDIR)/chdir-long.Po -rm -f ./$(DEPDIR)/cloexec.Po -rm -f ./$(DEPDIR)/close-stream.Po -rm -f ./$(DEPDIR)/close.Po -rm -f ./$(DEPDIR)/closedir.Po -rm -f ./$(DEPDIR)/closeout.Po -rm -f ./$(DEPDIR)/colorize.Po -rm -f ./$(DEPDIR)/creat-safer.Po -rm -f ./$(DEPDIR)/cycle-check.Po -rm -f ./$(DEPDIR)/dfa.Po -rm -f ./$(DEPDIR)/dirfd.Po -rm -f ./$(DEPDIR)/dirname-lgpl.Po -rm -f ./$(DEPDIR)/dup-safer-flag.Po -rm -f ./$(DEPDIR)/dup-safer.Po -rm -f ./$(DEPDIR)/dup.Po -rm -f ./$(DEPDIR)/dup2.Po -rm -f ./$(DEPDIR)/error.Po -rm -f ./$(DEPDIR)/exclude.Po -rm -f ./$(DEPDIR)/exitfail.Po -rm -f ./$(DEPDIR)/fchdir.Po -rm -f ./$(DEPDIR)/fcntl.Po -rm -f ./$(DEPDIR)/fd-hook.Po -rm -f ./$(DEPDIR)/fd-safer-flag.Po -rm -f ./$(DEPDIR)/fd-safer.Po -rm -f ./$(DEPDIR)/fdopendir.Po -rm -f ./$(DEPDIR)/filenamecat-lgpl.Po -rm -f ./$(DEPDIR)/fnmatch.Po -rm -f ./$(DEPDIR)/fnmatch_loop.Po -rm -f ./$(DEPDIR)/fopen.Po -rm -f ./$(DEPDIR)/fpending.Po -rm -f ./$(DEPDIR)/free.Po -rm -f ./$(DEPDIR)/fstat.Po -rm -f ./$(DEPDIR)/fstatat.Po -rm -f ./$(DEPDIR)/fts-cycle.Po -rm -f ./$(DEPDIR)/fts.Po -rm -f ./$(DEPDIR)/getcwd-lgpl.Po -rm -f ./$(DEPDIR)/getdtablesize.Po -rm -f ./$(DEPDIR)/getopt.Po -rm -f ./$(DEPDIR)/getopt1.Po -rm -f ./$(DEPDIR)/getpagesize.Po -rm -f ./$(DEPDIR)/getprogname.Po -rm -f ./$(DEPDIR)/hard-locale.Po -rm -f ./$(DEPDIR)/hash.Po -rm -f ./$(DEPDIR)/i-ring.Po -rm -f ./$(DEPDIR)/ialloc.Po -rm -f ./$(DEPDIR)/iconv.Po -rm -f ./$(DEPDIR)/iconv_close.Po -rm -f ./$(DEPDIR)/iconv_open.Po -rm -f ./$(DEPDIR)/isatty.Po -rm -f ./$(DEPDIR)/isblank.Po -rm -f ./$(DEPDIR)/iswblank.Po -rm -f ./$(DEPDIR)/iswctype.Po -rm -f ./$(DEPDIR)/iswdigit.Po -rm -f ./$(DEPDIR)/iswxdigit.Po -rm -f ./$(DEPDIR)/lc-charset-dispatch.Po -rm -f ./$(DEPDIR)/localcharset.Po -rm -f ./$(DEPDIR)/localeconv.Po -rm -f ./$(DEPDIR)/localeinfo.Po -rm -f ./$(DEPDIR)/lseek.Po -rm -f ./$(DEPDIR)/lstat.Po -rm -f ./$(DEPDIR)/malloc.Po -rm -f ./$(DEPDIR)/malloca.Po -rm -f ./$(DEPDIR)/mbchar.Po -rm -f ./$(DEPDIR)/mbiter.Po -rm -f ./$(DEPDIR)/mbrlen.Po -rm -f ./$(DEPDIR)/mbrtowc.Po -rm -f ./$(DEPDIR)/mbscasecmp.Po -rm -f ./$(DEPDIR)/mbsinit.Po -rm -f ./$(DEPDIR)/mbslen.Po -rm -f ./$(DEPDIR)/mbsrtowcs-state.Po -rm -f ./$(DEPDIR)/mbsrtowcs.Po -rm -f ./$(DEPDIR)/mbsstr.Po -rm -f ./$(DEPDIR)/mbtowc-lock.Po -rm -f ./$(DEPDIR)/mbtowc.Po -rm -f ./$(DEPDIR)/mbuiter.Po -rm -f ./$(DEPDIR)/memchr.Po -rm -f ./$(DEPDIR)/memchr2.Po -rm -f ./$(DEPDIR)/mempcpy.Po -rm -f ./$(DEPDIR)/memrchr.Po -rm -f ./$(DEPDIR)/msvc-inval.Po -rm -f ./$(DEPDIR)/msvc-nothrow.Po -rm -f ./$(DEPDIR)/nl_langinfo-lock.Po -rm -f ./$(DEPDIR)/nl_langinfo.Po -rm -f ./$(DEPDIR)/obstack.Po -rm -f ./$(DEPDIR)/open-safer.Po -rm -f ./$(DEPDIR)/open.Po -rm -f ./$(DEPDIR)/openat-die.Po -rm -f ./$(DEPDIR)/openat-proc.Po -rm -f ./$(DEPDIR)/openat-safer.Po -rm -f ./$(DEPDIR)/openat.Po -rm -f ./$(DEPDIR)/opendir.Po -rm -f ./$(DEPDIR)/opendirat.Po -rm -f ./$(DEPDIR)/pipe-safer.Po -rm -f ./$(DEPDIR)/pipe.Po -rm -f ./$(DEPDIR)/propername.Po -rm -f ./$(DEPDIR)/quotearg.Po -rm -f ./$(DEPDIR)/raise.Po -rm -f ./$(DEPDIR)/rawmemchr.Po -rm -f ./$(DEPDIR)/read.Po -rm -f ./$(DEPDIR)/readdir.Po -rm -f ./$(DEPDIR)/realloc.Po -rm -f ./$(DEPDIR)/reallocarray.Po -rm -f ./$(DEPDIR)/regcomp.Po -rm -f ./$(DEPDIR)/regex.Po -rm -f ./$(DEPDIR)/regex_internal.Po -rm -f ./$(DEPDIR)/regexec.Po -rm -f ./$(DEPDIR)/safe-read.Po -rm -f ./$(DEPDIR)/save-cwd.Po -rm -f ./$(DEPDIR)/setlocale-lock.Po -rm -f ./$(DEPDIR)/setlocale_null.Po -rm -f ./$(DEPDIR)/sigsegv.Po -rm -f ./$(DEPDIR)/stackvma.Po -rm -f ./$(DEPDIR)/stat-time.Po -rm -f ./$(DEPDIR)/stat-w32.Po -rm -f ./$(DEPDIR)/stat.Po -rm -f ./$(DEPDIR)/stpcpy.Po -rm -f ./$(DEPDIR)/strdup.Po -rm -f ./$(DEPDIR)/strerror-override.Po -rm -f ./$(DEPDIR)/strerror.Po -rm -f ./$(DEPDIR)/striconv.Po -rm -f ./$(DEPDIR)/stripslash.Po -rm -f ./$(DEPDIR)/strnlen.Po -rm -f ./$(DEPDIR)/strnlen1.Po -rm -f ./$(DEPDIR)/strstr.Po -rm -f ./$(DEPDIR)/strtoimax.Po -rm -f ./$(DEPDIR)/strtol.Po -rm -f ./$(DEPDIR)/strtoll.Po -rm -f ./$(DEPDIR)/strtoul.Po -rm -f ./$(DEPDIR)/strtoull.Po -rm -f ./$(DEPDIR)/strtoumax.Po -rm -f ./$(DEPDIR)/trim.Po -rm -f ./$(DEPDIR)/unistd.Po -rm -f ./$(DEPDIR)/version-etc-fsf.Po -rm -f ./$(DEPDIR)/version-etc.Po -rm -f ./$(DEPDIR)/wcrtomb.Po -rm -f ./$(DEPDIR)/wctob.Po -rm -f ./$(DEPDIR)/wctomb.Po -rm -f ./$(DEPDIR)/wctype-h.Po -rm -f ./$(DEPDIR)/wcwidth.Po -rm -f ./$(DEPDIR)/windows-mutex.Po -rm -f ./$(DEPDIR)/windows-once.Po -rm -f ./$(DEPDIR)/windows-recmutex.Po -rm -f ./$(DEPDIR)/windows-rwlock.Po -rm -f ./$(DEPDIR)/wmemchr.Po -rm -f ./$(DEPDIR)/wmempcpy.Po -rm -f ./$(DEPDIR)/xalloc-die.Po -rm -f ./$(DEPDIR)/xbinary-io.Po -rm -f ./$(DEPDIR)/xmalloc.Po -rm -f ./$(DEPDIR)/xstriconv.Po -rm -f ./$(DEPDIR)/xstrtoimax.Po -rm -f ./$(DEPDIR)/xstrtol.Po -rm -f ./$(DEPDIR)/xstrtoul.Po -rm -f glthread/$(DEPDIR)/lock.Po -rm -f glthread/$(DEPDIR)/threadlib.Po -rm -f malloc/$(DEPDIR)/dynarray-skeleton.Po -rm -f malloc/$(DEPDIR)/dynarray_at_failure.Po -rm -f malloc/$(DEPDIR)/dynarray_emplace_enlarge.Po -rm -f malloc/$(DEPDIR)/dynarray_finalize.Po -rm -f malloc/$(DEPDIR)/dynarray_resize.Po -rm -f malloc/$(DEPDIR)/dynarray_resize_clear.Po -rm -f unistr/$(DEPDIR)/u8-mbtoucr.Po -rm -f unistr/$(DEPDIR)/u8-uctomb-aux.Po -rm -f unistr/$(DEPDIR)/u8-uctomb.Po -rm -f uniwidth/$(DEPDIR)/width.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-local pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: all check install install-am install-exec install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-noinstLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-local distclean-tags distdir dvi dvi-am html html-am \ info info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-local pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile # We need the following in order to create when the system # doesn't have one that works with the given compiler. @GL_GENERATE_ALLOCA_H_TRUE@alloca.h: alloca.in.h $(top_builddir)/config.status @GL_GENERATE_ALLOCA_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_ALLOCA_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @GL_GENERATE_ALLOCA_H_TRUE@ sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < $(srcdir)/alloca.in.h; \ @GL_GENERATE_ALLOCA_H_TRUE@ } > $@-t && \ @GL_GENERATE_ALLOCA_H_TRUE@ mv -f $@-t $@ @GL_GENERATE_ALLOCA_H_FALSE@alloca.h: $(top_builddir)/config.status @GL_GENERATE_ALLOCA_H_FALSE@ rm -f $@ # Listed in the same order as the GNU makefile conventions, and # provided by autoconf 2.59c+ or 2.70. # The Automake-defined pkg* macros are appended, in the order # listed in the Automake 1.10a+ documentation. configmake.h: Makefile $(AM_V_GEN)rm -f $@-t && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ echo '#if HAVE_WINSOCK2_H'; \ echo '# include /* avoid mingw pollution on DATADIR */'; \ echo '#endif'; \ echo '#define PREFIX "$(prefix)"'; \ echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ echo '#define BINDIR "$(bindir)"'; \ echo '#define SBINDIR "$(sbindir)"'; \ echo '#define LIBEXECDIR "$(libexecdir)"'; \ echo '#define DATAROOTDIR "$(datarootdir)"'; \ echo '#define DATADIR "$(datadir)"'; \ echo '#define SYSCONFDIR "$(sysconfdir)"'; \ echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \ echo '#define LOCALSTATEDIR "$(localstatedir)"'; \ echo '#define RUNSTATEDIR "$(runstatedir)"'; \ echo '#define INCLUDEDIR "$(includedir)"'; \ echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \ echo '#define DOCDIR "$(docdir)"'; \ echo '#define INFODIR "$(infodir)"'; \ echo '#define HTMLDIR "$(htmldir)"'; \ echo '#define DVIDIR "$(dvidir)"'; \ echo '#define PDFDIR "$(pdfdir)"'; \ echo '#define PSDIR "$(psdir)"'; \ echo '#define LIBDIR "$(libdir)"'; \ echo '#define LISPDIR "$(lispdir)"'; \ echo '#define LOCALEDIR "$(localedir)"'; \ echo '#define MANDIR "$(mandir)"'; \ echo '#define MANEXT "$(manext)"'; \ echo '#define PKGDATADIR "$(pkgdatadir)"'; \ echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \ echo '#define PKGLIBDIR "$(pkglibdir)"'; \ echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ } | sed '/""/d' > $@-t && \ mv -f $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. ctype.h: ctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \ -e 's/@''GNULIB_ISBLANK''@/$(GL_GNULIB_ISBLANK)/g' \ -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/ctype.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_DIRENT_H''@|$(HAVE_DIRENT_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \ -e 's/@''GNULIB_OPENDIR''@/$(GL_GNULIB_OPENDIR)/g' \ -e 's/@''GNULIB_READDIR''@/$(GL_GNULIB_READDIR)/g' \ -e 's/@''GNULIB_REWINDDIR''@/$(GL_GNULIB_REWINDDIR)/g' \ -e 's/@''GNULIB_CLOSEDIR''@/$(GL_GNULIB_CLOSEDIR)/g' \ -e 's/@''GNULIB_DIRFD''@/$(GL_GNULIB_DIRFD)/g' \ -e 's/@''GNULIB_FDOPENDIR''@/$(GL_GNULIB_FDOPENDIR)/g' \ -e 's/@''GNULIB_SCANDIR''@/$(GL_GNULIB_SCANDIR)/g' \ -e 's/@''GNULIB_ALPHASORT''@/$(GL_GNULIB_ALPHASORT)/g' \ -e 's/@''HAVE_OPENDIR''@/$(HAVE_OPENDIR)/g' \ -e 's/@''HAVE_READDIR''@/$(HAVE_READDIR)/g' \ -e 's/@''HAVE_REWINDDIR''@/$(HAVE_REWINDDIR)/g' \ -e 's/@''HAVE_CLOSEDIR''@/$(HAVE_CLOSEDIR)/g' \ -e 's|@''HAVE_DECL_DIRFD''@|$(HAVE_DECL_DIRFD)|g' \ -e 's|@''HAVE_DECL_FDOPENDIR''@|$(HAVE_DECL_FDOPENDIR)|g' \ -e 's|@''HAVE_FDOPENDIR''@|$(HAVE_FDOPENDIR)|g' \ -e 's|@''HAVE_SCANDIR''@|$(HAVE_SCANDIR)|g' \ -e 's|@''HAVE_ALPHASORT''@|$(HAVE_ALPHASORT)|g' \ -e 's|@''REPLACE_OPENDIR''@|$(REPLACE_OPENDIR)|g' \ -e 's|@''REPLACE_CLOSEDIR''@|$(REPLACE_CLOSEDIR)|g' \ -e 's|@''REPLACE_DIRFD''@|$(REPLACE_DIRFD)|g' \ -e 's|@''REPLACE_FDOPENDIR''@|$(REPLACE_FDOPENDIR)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/dirent.in.h; \ } > $@-t && \ mv $@-t $@ malloc/dynarray.gl.h: malloc/dynarray.h $(AM_V_at)$(MKDIR_P) malloc $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e '/libc_hidden_proto/d' < $(srcdir)/malloc/dynarray.h; \ } > $@-t && \ mv $@-t $@ malloc/dynarray-skeleton.gl.h: malloc/dynarray-skeleton.c $(AM_V_at)$(MKDIR_P) malloc $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|||g' \ -e 's|__attribute_maybe_unused__|_GL_ATTRIBUTE_MAYBE_UNUSED|g' \ -e 's|__attribute_nonnull__|_GL_ATTRIBUTE_NONNULL|g' \ -e 's|__attribute_warn_unused_result__|_GL_ATTRIBUTE_NODISCARD|g' \ -e 's|__glibc_likely|_GL_LIKELY|g' \ -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \ < $(srcdir)/malloc/dynarray-skeleton.c; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have one that is POSIX compliant. @GL_GENERATE_ERRNO_H_TRUE@errno.h: errno.in.h $(top_builddir)/config.status @GL_GENERATE_ERRNO_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_ERRNO_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @GL_GENERATE_ERRNO_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ @GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ @GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ @GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ @GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ @GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ @GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ @GL_GENERATE_ERRNO_H_TRUE@ < $(srcdir)/errno.in.h; \ @GL_GENERATE_ERRNO_H_TRUE@ } > $@-t && \ @GL_GENERATE_ERRNO_H_TRUE@ mv $@-t $@ @GL_GENERATE_ERRNO_H_FALSE@errno.h: $(top_builddir)/config.status @GL_GENERATE_ERRNO_H_FALSE@ rm -f $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ -e 's/@''GNULIB_CREAT''@/$(GL_GNULIB_CREAT)/g' \ -e 's/@''GNULIB_FCNTL''@/$(GL_GNULIB_FCNTL)/g' \ -e 's/@''GNULIB_NONBLOCKING''@/$(GL_GNULIB_NONBLOCKING)/g' \ -e 's/@''GNULIB_OPEN''@/$(GL_GNULIB_OPEN)/g' \ -e 's/@''GNULIB_OPENAT''@/$(GL_GNULIB_OPENAT)/g' \ -e 's/@''GNULIB_MDA_CREAT''@/$(GL_GNULIB_MDA_CREAT)/g' \ -e 's/@''GNULIB_MDA_OPEN''@/$(GL_GNULIB_MDA_OPEN)/g' \ -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/fcntl.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create . @GL_GENERATE_FNMATCH_H_TRUE@fnmatch.h: fnmatch.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) @GL_GENERATE_FNMATCH_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_FNMATCH_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @GL_GENERATE_FNMATCH_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''HAVE_FNMATCH_H''@|$(HAVE_FNMATCH_H)|g' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''NEXT_FNMATCH_H''@|$(NEXT_FNMATCH_H)|g' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e 's/@''GNULIB_FNMATCH''@/$(GL_GNULIB_FNMATCH)/g' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''HAVE_FNMATCH''@|$(HAVE_FNMATCH)|g' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''REPLACE_FNMATCH''@|$(REPLACE_FNMATCH)|g' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ @GL_GENERATE_FNMATCH_H_TRUE@ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ @GL_GENERATE_FNMATCH_H_TRUE@ < $(srcdir)/fnmatch.in.h; \ @GL_GENERATE_FNMATCH_H_TRUE@ } > $@-t && \ @GL_GENERATE_FNMATCH_H_TRUE@ mv $@-t $@ @GL_GENERATE_FNMATCH_H_FALSE@fnmatch.h: $(top_builddir)/config.status @GL_GENERATE_FNMATCH_H_FALSE@ rm -f $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ < $(srcdir)/getopt.in.h; \ } > $@-t && \ mv -f $@-t $@ getopt-cdefs.h: getopt-cdefs.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ < $(srcdir)/getopt-cdefs.in.h; \ } > $@-t && \ mv -f $@-t $@ distclean-local: clean-GNUmakefile clean-GNUmakefile: test '$(srcdir)' = . || rm -f $(top_builddir)/GNUmakefile # We need the following in order to create when the system # doesn't have one that works with the given compiler. @GL_GENERATE_ICONV_H_TRUE@iconv.h: iconv.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) @GL_GENERATE_ICONV_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_ICONV_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @GL_GENERATE_ICONV_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @GL_GENERATE_ICONV_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @GL_GENERATE_ICONV_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_ICONV_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_ICONV_H_TRUE@ -e 's|@''NEXT_ICONV_H''@|$(NEXT_ICONV_H)|g' \ @GL_GENERATE_ICONV_H_TRUE@ -e 's/@''GNULIB_ICONV''@/$(GL_GNULIB_ICONV)/g' \ @GL_GENERATE_ICONV_H_TRUE@ -e 's|@''ICONV_CONST''@|$(ICONV_CONST)|g' \ @GL_GENERATE_ICONV_H_TRUE@ -e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \ @GL_GENERATE_ICONV_H_TRUE@ -e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \ @GL_GENERATE_ICONV_H_TRUE@ -e 's|@''REPLACE_ICONV_UTF''@|$(REPLACE_ICONV_UTF)|g' \ @GL_GENERATE_ICONV_H_TRUE@ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ @GL_GENERATE_ICONV_H_TRUE@ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ @GL_GENERATE_ICONV_H_TRUE@ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ @GL_GENERATE_ICONV_H_TRUE@ < $(srcdir)/iconv.in.h; \ @GL_GENERATE_ICONV_H_TRUE@ } > $@-t && \ @GL_GENERATE_ICONV_H_TRUE@ mv $@-t $@ @GL_GENERATE_ICONV_H_FALSE@iconv.h: $(top_builddir)/config.status @GL_GENERATE_ICONV_H_FALSE@ rm -f $@ $(srcdir)/iconv_open-aix.h: $(srcdir)/iconv_open-aix.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-aix.gperf > $(srcdir)/iconv_open-aix.h-t && \ mv $(srcdir)/iconv_open-aix.h-t $(srcdir)/iconv_open-aix.h $(srcdir)/iconv_open-hpux.h: $(srcdir)/iconv_open-hpux.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-hpux.gperf > $(srcdir)/iconv_open-hpux.h-t && \ mv $(srcdir)/iconv_open-hpux.h-t $(srcdir)/iconv_open-hpux.h $(srcdir)/iconv_open-irix.h: $(srcdir)/iconv_open-irix.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-irix.gperf > $(srcdir)/iconv_open-irix.h-t && \ mv $(srcdir)/iconv_open-irix.h-t $(srcdir)/iconv_open-irix.h $(srcdir)/iconv_open-osf.h: $(srcdir)/iconv_open-osf.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-osf.gperf > $(srcdir)/iconv_open-osf.h-t && \ mv $(srcdir)/iconv_open-osf.h-t $(srcdir)/iconv_open-osf.h $(srcdir)/iconv_open-solaris.h: $(srcdir)/iconv_open-solaris.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-solaris.gperf > $(srcdir)/iconv_open-solaris.h-t && \ mv $(srcdir)/iconv_open-solaris.h-t $(srcdir)/iconv_open-solaris.h $(srcdir)/iconv_open-zos.h: $(srcdir)/iconv_open-zos.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-zos.gperf > $(srcdir)/iconv_open-zos.h-t && \ mv $(srcdir)/iconv_open-zos.h-t $(srcdir)/iconv_open-zos.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \ -e 's/@''GNULIB_IMAXABS''@/$(GL_GNULIB_IMAXABS)/g' \ -e 's/@''GNULIB_IMAXDIV''@/$(GL_GNULIB_IMAXDIV)/g' \ -e 's/@''GNULIB_STRTOIMAX''@/$(GL_GNULIB_STRTOIMAX)/g' \ -e 's/@''GNULIB_STRTOUMAX''@/$(GL_GNULIB_STRTOUMAX)/g' \ -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \ -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ -e 's/@''HAVE_IMAXDIV_T''@/$(HAVE_IMAXDIV_T)/g' \ -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \ -e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \ -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \ -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \ -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/inttypes.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create an empty placeholder for # when the system doesn't have one. langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \ -e 's/@''GNULIB_NL_LANGINFO''@/$(GL_GNULIB_NL_LANGINFO)/g' \ -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \ -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \ -e 's|@''HAVE_LANGINFO_ALTMON''@|$(HAVE_LANGINFO_ALTMON)|g' \ -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \ -e 's|@''HAVE_LANGINFO_YESEXPR''@|$(HAVE_LANGINFO_YESEXPR)|g' \ -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \ -e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/langinfo.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have one that is compatible with GNU. @GL_GENERATE_LIMITS_H_TRUE@limits.h: limits.in.h $(top_builddir)/config.status @GL_GENERATE_LIMITS_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_LIMITS_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @GL_GENERATE_LIMITS_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ @GL_GENERATE_LIMITS_H_TRUE@ < $(srcdir)/limits.in.h; \ @GL_GENERATE_LIMITS_H_TRUE@ } > $@-t && \ @GL_GENERATE_LIMITS_H_TRUE@ mv $@-t $@ @GL_GENERATE_LIMITS_H_FALSE@limits.h: $(top_builddir)/config.status @GL_GENERATE_LIMITS_H_FALSE@ rm -f $@ # We need the following in order to create when the system # doesn't have one that provides all definitions. locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ -e 's/@''GNULIB_LOCALECONV''@/$(GL_GNULIB_LOCALECONV)/g' \ -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \ -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \ -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \ -e 's/@''GNULIB_LOCALENAME''@/$(GL_GNULIB_LOCALENAME)/g' \ -e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \ -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ -e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \ -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \ -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \ -e 's|@''REPLACE_NEWLOCALE''@|$(REPLACE_NEWLOCALE)|g' \ -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ -e 's|@''REPLACE_FREELOCALE''@|$(REPLACE_FREELOCALE)|g' \ -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \ -e 's|@''LOCALENAME_ENHANCE_LOCALE_FUNCS''@|$(LOCALENAME_ENHANCE_LOCALE_FUNCS)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/locale.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have a complete one. signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GL_GNULIB_PTHREAD_SIGMASK)/g' \ -e 's/@''GNULIB_RAISE''@/$(GL_GNULIB_RAISE)/g' \ -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GL_GNULIB_SIGNAL_H_SIGPIPE)/g' \ -e 's/@''GNULIB_SIGPROCMASK''@/$(GL_GNULIB_SIGPROCMASK)/g' \ -e 's/@''GNULIB_SIGACTION''@/$(GL_GNULIB_SIGACTION)/g' \ -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \ -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \ -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \ -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \ -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \ -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \ -e 's|@''REPLACE_RAISE''@|$(REPLACE_RAISE)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/signal.in.h; \ } > $@-t && \ mv $@-t $@ @GL_GENERATE_SIGSEGV_H_TRUE@sigsegv.h: sigsegv.in.h $(top_builddir)/config.status @GL_GENERATE_SIGSEGV_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_SIGSEGV_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @GL_GENERATE_SIGSEGV_H_TRUE@ cat $(srcdir)/sigsegv.in.h; \ @GL_GENERATE_SIGSEGV_H_TRUE@ } > $@-t && \ @GL_GENERATE_SIGSEGV_H_TRUE@ mv $@-t $@ @GL_GENERATE_SIGSEGV_H_FALSE@sigsegv.h: $(top_builddir)/config.status @GL_GENERATE_SIGSEGV_H_FALSE@ rm -f $@ # We need the following in order to create when the system # doesn't have one that works. @GL_GENERATE_STDALIGN_H_TRUE@stdalign.h: stdalign.in.h $(top_builddir)/config.status @GL_GENERATE_STDALIGN_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_STDALIGN_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @GL_GENERATE_STDALIGN_H_TRUE@ cat $(srcdir)/stdalign.in.h; \ @GL_GENERATE_STDALIGN_H_TRUE@ } > $@-t && \ @GL_GENERATE_STDALIGN_H_TRUE@ mv $@-t $@ @GL_GENERATE_STDALIGN_H_FALSE@stdalign.h: $(top_builddir)/config.status @GL_GENERATE_STDALIGN_H_FALSE@ rm -f $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. @GL_GENERATE_STDARG_H_TRUE@stdarg.h: stdarg.in.h $(top_builddir)/config.status @GL_GENERATE_STDARG_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_STDARG_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @GL_GENERATE_STDARG_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @GL_GENERATE_STDARG_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @GL_GENERATE_STDARG_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_STDARG_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_STDARG_H_TRUE@ -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \ @GL_GENERATE_STDARG_H_TRUE@ < $(srcdir)/stdarg.in.h; \ @GL_GENERATE_STDARG_H_TRUE@ } > $@-t && \ @GL_GENERATE_STDARG_H_TRUE@ mv $@-t $@ @GL_GENERATE_STDARG_H_FALSE@stdarg.h: $(top_builddir)/config.status @GL_GENERATE_STDARG_H_FALSE@ rm -f $@ # We need the following in order to create when the system # doesn't have one that works. @GL_GENERATE_STDBOOL_H_TRUE@stdbool.h: stdbool.in.h $(top_builddir)/config.status @GL_GENERATE_STDBOOL_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_STDBOOL_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @GL_GENERATE_STDBOOL_H_TRUE@ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ @GL_GENERATE_STDBOOL_H_TRUE@ } > $@-t && \ @GL_GENERATE_STDBOOL_H_TRUE@ mv $@-t $@ @GL_GENERATE_STDBOOL_H_FALSE@stdbool.h: $(top_builddir)/config.status @GL_GENERATE_STDBOOL_H_FALSE@ rm -f $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. @GL_GENERATE_STDDEF_H_TRUE@stddef.h: stddef.in.h $(top_builddir)/config.status @GL_GENERATE_STDDEF_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_STDDEF_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @GL_GENERATE_STDDEF_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ < $(srcdir)/stddef.in.h; \ @GL_GENERATE_STDDEF_H_TRUE@ } > $@-t && \ @GL_GENERATE_STDDEF_H_TRUE@ mv $@-t $@ @GL_GENERATE_STDDEF_H_FALSE@stddef.h: $(top_builddir)/config.status @GL_GENERATE_STDDEF_H_FALSE@ rm -f $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. @GL_GENERATE_STDINT_H_TRUE@stdint.h: stdint.in.h $(top_builddir)/config.status @GL_GENERATE_STDINT_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_STDINT_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @GL_GENERATE_STDINT_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ < $(srcdir)/stdint.in.h; \ @GL_GENERATE_STDINT_H_TRUE@ } > $@-t && \ @GL_GENERATE_STDINT_H_TRUE@ mv $@-t $@ @GL_GENERATE_STDINT_H_FALSE@stdint.h: $(top_builddir)/config.status @GL_GENERATE_STDINT_H_FALSE@ rm -f $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \ -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \ -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \ -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \ -e 's/@''GNULIB_FGETC''@/$(GL_GNULIB_FGETC)/g' \ -e 's/@''GNULIB_FGETS''@/$(GL_GNULIB_FGETS)/g' \ -e 's/@''GNULIB_FOPEN''@/$(GL_GNULIB_FOPEN)/g' \ -e 's/@''GNULIB_FPRINTF''@/$(GL_GNULIB_FPRINTF)/g' \ -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GL_GNULIB_FPRINTF_POSIX)/g' \ -e 's/@''GNULIB_FPURGE''@/$(GL_GNULIB_FPURGE)/g' \ -e 's/@''GNULIB_FPUTC''@/$(GL_GNULIB_FPUTC)/g' \ -e 's/@''GNULIB_FPUTS''@/$(GL_GNULIB_FPUTS)/g' \ -e 's/@''GNULIB_FREAD''@/$(GL_GNULIB_FREAD)/g' \ -e 's/@''GNULIB_FREOPEN''@/$(GL_GNULIB_FREOPEN)/g' \ -e 's/@''GNULIB_FSCANF''@/$(GL_GNULIB_FSCANF)/g' \ -e 's/@''GNULIB_FSEEK''@/$(GL_GNULIB_FSEEK)/g' \ -e 's/@''GNULIB_FSEEKO''@/$(GL_GNULIB_FSEEKO)/g' \ -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \ -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \ -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \ -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \ -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \ -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \ -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \ -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \ -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \ -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \ -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \ -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \ -e 's/@''GNULIB_PRINTF''@/$(GL_GNULIB_PRINTF)/g' \ -e 's/@''GNULIB_PRINTF_POSIX''@/$(GL_GNULIB_PRINTF_POSIX)/g' \ -e 's/@''GNULIB_PUTC''@/$(GL_GNULIB_PUTC)/g' \ -e 's/@''GNULIB_PUTCHAR''@/$(GL_GNULIB_PUTCHAR)/g' \ -e 's/@''GNULIB_PUTS''@/$(GL_GNULIB_PUTS)/g' \ -e 's/@''GNULIB_REMOVE''@/$(GL_GNULIB_REMOVE)/g' \ -e 's/@''GNULIB_RENAME''@/$(GL_GNULIB_RENAME)/g' \ -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \ -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \ -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \ -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \ -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \ -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \ -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \ -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \ -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \ -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \ -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \ -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \ -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \ -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \ -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \ -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \ -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \ -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \ -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \ -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \ -e 's/@''GNULIB_MDA_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \ -e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \ -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/g' \ < $(srcdir)/stdio.in.h | \ sed -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \ -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \ -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ -e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \ -e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \ -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \ -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \ -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ -e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \ -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ -e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \ -e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \ -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \ -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \ -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \ -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ -e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \ -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \ -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \ -e 's/@''GNULIB_CALLOC_POSIX''@/$(GL_GNULIB_CALLOC_POSIX)/g' \ -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GL_GNULIB_CANONICALIZE_FILE_NAME)/g' \ -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ -e 's/@''GNULIB_GETLOADAVG''@/$(GL_GNULIB_GETLOADAVG)/g' \ -e 's/@''GNULIB_GETSUBOPT''@/$(GL_GNULIB_GETSUBOPT)/g' \ -e 's/@''GNULIB_GRANTPT''@/$(GL_GNULIB_GRANTPT)/g' \ -e 's/@''GNULIB_MALLOC_POSIX''@/$(GL_GNULIB_MALLOC_POSIX)/g' \ -e 's/@''GNULIB_MBTOWC''@/$(GL_GNULIB_MBTOWC)/g' \ -e 's/@''GNULIB_MKDTEMP''@/$(GL_GNULIB_MKDTEMP)/g' \ -e 's/@''GNULIB_MKOSTEMP''@/$(GL_GNULIB_MKOSTEMP)/g' \ -e 's/@''GNULIB_MKOSTEMPS''@/$(GL_GNULIB_MKOSTEMPS)/g' \ -e 's/@''GNULIB_MKSTEMP''@/$(GL_GNULIB_MKSTEMP)/g' \ -e 's/@''GNULIB_MKSTEMPS''@/$(GL_GNULIB_MKSTEMPS)/g' \ -e 's/@''GNULIB_POSIX_MEMALIGN''@/$(GL_GNULIB_POSIX_MEMALIGN)/g' \ -e 's/@''GNULIB_POSIX_OPENPT''@/$(GL_GNULIB_POSIX_OPENPT)/g' \ -e 's/@''GNULIB_PTSNAME''@/$(GL_GNULIB_PTSNAME)/g' \ -e 's/@''GNULIB_PTSNAME_R''@/$(GL_GNULIB_PTSNAME_R)/g' \ -e 's/@''GNULIB_PUTENV''@/$(GL_GNULIB_PUTENV)/g' \ -e 's/@''GNULIB_QSORT_R''@/$(GL_GNULIB_QSORT_R)/g' \ -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \ -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GL_GNULIB_REALLOC_POSIX)/g' \ -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \ -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \ -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \ -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ -e 's/@''GNULIB_STRTOLD''@/$(GL_GNULIB_STRTOLD)/g' \ -e 's/@''GNULIB_STRTOLL''@/$(GL_GNULIB_STRTOLL)/g' \ -e 's/@''GNULIB_STRTOUL''@/$(GL_GNULIB_STRTOUL)/g' \ -e 's/@''GNULIB_STRTOULL''@/$(GL_GNULIB_STRTOULL)/g' \ -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GL_GNULIB_SYSTEM_POSIX)/g' \ -e 's/@''GNULIB_UNLOCKPT''@/$(GL_GNULIB_UNLOCKPT)/g' \ -e 's/@''GNULIB_UNSETENV''@/$(GL_GNULIB_UNSETENV)/g' \ -e 's/@''GNULIB_WCTOMB''@/$(GL_GNULIB_WCTOMB)/g' \ -e 's/@''GNULIB_MDA_ECVT''@/$(GL_GNULIB_MDA_ECVT)/g' \ -e 's/@''GNULIB_MDA_FCVT''@/$(GL_GNULIB_MDA_FCVT)/g' \ -e 's/@''GNULIB_MDA_GCVT''@/$(GL_GNULIB_MDA_GCVT)/g' \ -e 's/@''GNULIB_MDA_MKTEMP''@/$(GL_GNULIB_MDA_MKTEMP)/g' \ -e 's/@''GNULIB_MDA_PUTENV''@/$(GL_GNULIB_MDA_PUTENV)/g' \ < $(srcdir)/stdlib.in.h | \ sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ -e 's|@''HAVE_ALIGNED_ALLOC''@|$(HAVE_ALIGNED_ALLOC)|g' \ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''HAVE_DECL_ECVT''@|$(HAVE_DECL_ECVT)|g' \ -e 's|@''HAVE_DECL_FCVT''@|$(HAVE_DECL_FCVT)|g' \ -e 's|@''HAVE_DECL_GCVT''@|$(HAVE_DECL_GCVT)|g' \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ -e 's|@''HAVE_INITSTATE''@|$(HAVE_INITSTATE)|g' \ -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \ -e 's|@''HAVE_MBTOWC''@|$(HAVE_MBTOWC)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ -e 's|@''HAVE_POSIX_MEMALIGN''@|$(HAVE_POSIX_MEMALIGN)|g' \ -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \ -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \ -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \ -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ -e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -e 's|@''HAVE_STRTOL''@|$(HAVE_STRTOL)|g' \ -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOUL''@|$(HAVE_STRTOUL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \ -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e 's|@''REPLACE_POSIX_MEMALIGN''@|$(REPLACE_POSIX_MEMALIGN)|g' \ -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ -e 's|@''REPLACE_STRTOL''@|$(REPLACE_STRTOL)|g' \ -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ -e 's|@''REPLACE_STRTOLL''@|$(REPLACE_STRTOLL)|g' \ -e 's|@''REPLACE_STRTOUL''@|$(REPLACE_STRTOUL)|g' \ -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _Noreturn/r $(_NORETURN_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GL_GNULIB_EXPLICIT_BZERO)/g' \ -e 's/@''GNULIB_FFSL''@/$(GL_GNULIB_FFSL)/g' \ -e 's/@''GNULIB_FFSLL''@/$(GL_GNULIB_FFSLL)/g' \ -e 's/@''GNULIB_MBSLEN''@/$(GL_GNULIB_MBSLEN)/g' \ -e 's/@''GNULIB_MBSNLEN''@/$(GL_GNULIB_MBSNLEN)/g' \ -e 's/@''GNULIB_MBSCHR''@/$(GL_GNULIB_MBSCHR)/g' \ -e 's/@''GNULIB_MBSRCHR''@/$(GL_GNULIB_MBSRCHR)/g' \ -e 's/@''GNULIB_MBSSTR''@/$(GL_GNULIB_MBSSTR)/g' \ -e 's/@''GNULIB_MBSCASECMP''@/$(GL_GNULIB_MBSCASECMP)/g' \ -e 's/@''GNULIB_MBSNCASECMP''@/$(GL_GNULIB_MBSNCASECMP)/g' \ -e 's/@''GNULIB_MBSPCASECMP''@/$(GL_GNULIB_MBSPCASECMP)/g' \ -e 's/@''GNULIB_MBSCASESTR''@/$(GL_GNULIB_MBSCASESTR)/g' \ -e 's/@''GNULIB_MBSCSPN''@/$(GL_GNULIB_MBSCSPN)/g' \ -e 's/@''GNULIB_MBSPBRK''@/$(GL_GNULIB_MBSPBRK)/g' \ -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \ -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \ -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \ -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \ -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \ -e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \ -e 's/@''GNULIB_RAWMEMCHR''@/$(GL_GNULIB_RAWMEMCHR)/g' \ -e 's/@''GNULIB_STPCPY''@/$(GL_GNULIB_STPCPY)/g' \ -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \ -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \ -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \ -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \ -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \ -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \ -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \ -e 's/@''GNULIB_STRSEP''@/$(GL_GNULIB_STRSEP)/g' \ -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \ -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \ -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \ -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \ -e 's/@''GNULIB_STRSIGNAL''@/$(GL_GNULIB_STRSIGNAL)/g' \ -e 's/@''GNULIB_STRVERSCMP''@/$(GL_GNULIB_STRVERSCMP)/g' \ -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GL_GNULIB_MDA_MEMCCPY)/g' \ -e 's/@''GNULIB_MDA_STRDUP''@/$(GL_GNULIB_MDA_STRDUP)/g' \ < $(srcdir)/string.in.h | \ sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \ -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \ -e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ -e 's|@''REPLACE_FFSLL''@|$(REPLACE_FFSLL)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ < $(srcdir)/string.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # has one that is incomplete. sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ -e 's/@''GNULIB_FCHMODAT''@/$(GL_GNULIB_FCHMODAT)/g' \ -e 's/@''GNULIB_FSTAT''@/$(GL_GNULIB_FSTAT)/g' \ -e 's/@''GNULIB_FSTATAT''@/$(GL_GNULIB_FSTATAT)/g' \ -e 's/@''GNULIB_FUTIMENS''@/$(GL_GNULIB_FUTIMENS)/g' \ -e 's/@''GNULIB_GETUMASK''@/$(GL_GNULIB_GETUMASK)/g' \ -e 's/@''GNULIB_LCHMOD''@/$(GL_GNULIB_LCHMOD)/g' \ -e 's/@''GNULIB_LSTAT''@/$(GL_GNULIB_LSTAT)/g' \ -e 's/@''GNULIB_MKDIR''@/$(GL_GNULIB_MKDIR)/g' \ -e 's/@''GNULIB_MKDIRAT''@/$(GL_GNULIB_MKDIRAT)/g' \ -e 's/@''GNULIB_MKFIFO''@/$(GL_GNULIB_MKFIFO)/g' \ -e 's/@''GNULIB_MKFIFOAT''@/$(GL_GNULIB_MKFIFOAT)/g' \ -e 's/@''GNULIB_MKNOD''@/$(GL_GNULIB_MKNOD)/g' \ -e 's/@''GNULIB_MKNODAT''@/$(GL_GNULIB_MKNODAT)/g' \ -e 's/@''GNULIB_STAT''@/$(GL_GNULIB_STAT)/g' \ -e 's/@''GNULIB_UTIMENSAT''@/$(GL_GNULIB_UTIMENSAT)/g' \ -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GL_GNULIB_OVERRIDES_STRUCT_STAT)/g' \ -e 's/@''GNULIB_MDA_CHMOD''@/$(GL_GNULIB_MDA_CHMOD)/g' \ -e 's/@''GNULIB_MDA_MKDIR''@/$(GL_GNULIB_MDA_MKDIR)/g' \ -e 's/@''GNULIB_MDA_UMASK''@/$(GL_GNULIB_MDA_UMASK)/g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ -e 's|@''HAVE_GETUMASK''@|$(HAVE_GETUMASK)|g' \ -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ -e 's|@''REPLACE_FCHMODAT''@|$(REPLACE_FCHMODAT)|g' \ -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ -e 's|@''REPLACE_MKFIFOAT''@|$(REPLACE_MKFIFOAT)|g' \ -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ -e 's|@''REPLACE_MKNODAT''@|$(REPLACE_MKNODAT)|g' \ -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_stat.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. sys/types.h: sys_types.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ < $(srcdir)/sys_types.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ -e 's/@''GNULIB_CTIME''@/$(GL_GNULIB_CTIME)/g' \ -e 's/@''GNULIB_LOCALTIME''@/$(GL_GNULIB_LOCALTIME)/g' \ -e 's/@''GNULIB_MKTIME''@/$(GL_GNULIB_MKTIME)/g' \ -e 's/@''GNULIB_NANOSLEEP''@/$(GL_GNULIB_NANOSLEEP)/g' \ -e 's/@''GNULIB_STRFTIME''@/$(GL_GNULIB_STRFTIME)/g' \ -e 's/@''GNULIB_STRPTIME''@/$(GL_GNULIB_STRPTIME)/g' \ -e 's/@''GNULIB_TIMEGM''@/$(GL_GNULIB_TIMEGM)/g' \ -e 's/@''GNULIB_TIMESPEC_GET''@/$(GL_GNULIB_TIMESPEC_GET)/g' \ -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \ -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \ -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \ -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \ -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''TIME_H_DEFINES_TIME_UTC''@|$(TIME_H_DEFINES_TIME_UTC)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/time.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create an empty placeholder for # when the system doesn't have one. unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ -e 's/@''GNULIB_ACCESS''@/$(GL_GNULIB_ACCESS)/g' \ -e 's/@''GNULIB_CHDIR''@/$(GL_GNULIB_CHDIR)/g' \ -e 's/@''GNULIB_CHOWN''@/$(GL_GNULIB_CHOWN)/g' \ -e 's/@''GNULIB_CLOSE''@/$(GL_GNULIB_CLOSE)/g' \ -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GL_GNULIB_COPY_FILE_RANGE)/g' \ -e 's/@''GNULIB_DUP''@/$(GL_GNULIB_DUP)/g' \ -e 's/@''GNULIB_DUP2''@/$(GL_GNULIB_DUP2)/g' \ -e 's/@''GNULIB_DUP3''@/$(GL_GNULIB_DUP3)/g' \ -e 's/@''GNULIB_ENVIRON''@/$(GL_GNULIB_ENVIRON)/g' \ -e 's/@''GNULIB_EUIDACCESS''@/$(GL_GNULIB_EUIDACCESS)/g' \ -e 's/@''GNULIB_EXECL''@/$(GL_GNULIB_EXECL)/g' \ -e 's/@''GNULIB_EXECLE''@/$(GL_GNULIB_EXECLE)/g' \ -e 's/@''GNULIB_EXECLP''@/$(GL_GNULIB_EXECLP)/g' \ -e 's/@''GNULIB_EXECV''@/$(GL_GNULIB_EXECV)/g' \ -e 's/@''GNULIB_EXECVE''@/$(GL_GNULIB_EXECVE)/g' \ -e 's/@''GNULIB_EXECVP''@/$(GL_GNULIB_EXECVP)/g' \ -e 's/@''GNULIB_EXECVPE''@/$(GL_GNULIB_EXECVPE)/g' \ -e 's/@''GNULIB_FACCESSAT''@/$(GL_GNULIB_FACCESSAT)/g' \ -e 's/@''GNULIB_FCHDIR''@/$(GL_GNULIB_FCHDIR)/g' \ -e 's/@''GNULIB_FCHOWNAT''@/$(GL_GNULIB_FCHOWNAT)/g' \ -e 's/@''GNULIB_FDATASYNC''@/$(GL_GNULIB_FDATASYNC)/g' \ -e 's/@''GNULIB_FSYNC''@/$(GL_GNULIB_FSYNC)/g' \ -e 's/@''GNULIB_FTRUNCATE''@/$(GL_GNULIB_FTRUNCATE)/g' \ -e 's/@''GNULIB_GETCWD''@/$(GL_GNULIB_GETCWD)/g' \ -e 's/@''GNULIB_GETDOMAINNAME''@/$(GL_GNULIB_GETDOMAINNAME)/g' \ -e 's/@''GNULIB_GETDTABLESIZE''@/$(GL_GNULIB_GETDTABLESIZE)/g' \ -e 's/@''GNULIB_GETENTROPY''@/$(GL_GNULIB_GETENTROPY)/g' \ -e 's/@''GNULIB_GETGROUPS''@/$(GL_GNULIB_GETGROUPS)/g' \ -e 's/@''GNULIB_GETHOSTNAME''@/$(GL_GNULIB_GETHOSTNAME)/g' \ -e 's/@''GNULIB_GETLOGIN''@/$(GL_GNULIB_GETLOGIN)/g' \ -e 's/@''GNULIB_GETLOGIN_R''@/$(GL_GNULIB_GETLOGIN_R)/g' \ -e 's/@''GNULIB_GETOPT_POSIX''@/$(GL_GNULIB_GETOPT_POSIX)/g' \ -e 's/@''GNULIB_GETPAGESIZE''@/$(GL_GNULIB_GETPAGESIZE)/g' \ -e 's/@''GNULIB_GETPASS''@/$(GL_GNULIB_GETPASS)/g' \ -e 's/@''GNULIB_GETUSERSHELL''@/$(GL_GNULIB_GETUSERSHELL)/g' \ -e 's/@''GNULIB_GROUP_MEMBER''@/$(GL_GNULIB_GROUP_MEMBER)/g' \ -e 's/@''GNULIB_ISATTY''@/$(GL_GNULIB_ISATTY)/g' \ -e 's/@''GNULIB_LCHOWN''@/$(GL_GNULIB_LCHOWN)/g' \ -e 's/@''GNULIB_LINK''@/$(GL_GNULIB_LINK)/g' \ -e 's/@''GNULIB_LINKAT''@/$(GL_GNULIB_LINKAT)/g' \ -e 's/@''GNULIB_LSEEK''@/$(GL_GNULIB_LSEEK)/g' \ -e 's/@''GNULIB_PIPE''@/$(GL_GNULIB_PIPE)/g' \ -e 's/@''GNULIB_PIPE2''@/$(GL_GNULIB_PIPE2)/g' \ -e 's/@''GNULIB_PREAD''@/$(GL_GNULIB_PREAD)/g' \ -e 's/@''GNULIB_PWRITE''@/$(GL_GNULIB_PWRITE)/g' \ -e 's/@''GNULIB_READ''@/$(GL_GNULIB_READ)/g' \ -e 's/@''GNULIB_READLINK''@/$(GL_GNULIB_READLINK)/g' \ -e 's/@''GNULIB_READLINKAT''@/$(GL_GNULIB_READLINKAT)/g' \ -e 's/@''GNULIB_RMDIR''@/$(GL_GNULIB_RMDIR)/g' \ -e 's/@''GNULIB_SETHOSTNAME''@/$(GL_GNULIB_SETHOSTNAME)/g' \ -e 's/@''GNULIB_SLEEP''@/$(GL_GNULIB_SLEEP)/g' \ -e 's/@''GNULIB_SYMLINK''@/$(GL_GNULIB_SYMLINK)/g' \ -e 's/@''GNULIB_SYMLINKAT''@/$(GL_GNULIB_SYMLINKAT)/g' \ -e 's/@''GNULIB_TRUNCATE''@/$(GL_GNULIB_TRUNCATE)/g' \ -e 's/@''GNULIB_TTYNAME_R''@/$(GL_GNULIB_TTYNAME_R)/g' \ -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GL_GNULIB_UNISTD_H_GETOPT)/g' \ -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GL_GNULIB_UNISTD_H_NONBLOCKING)/g' \ -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GL_GNULIB_UNISTD_H_SIGPIPE)/g' \ -e 's/@''GNULIB_UNLINK''@/$(GL_GNULIB_UNLINK)/g' \ -e 's/@''GNULIB_UNLINKAT''@/$(GL_GNULIB_UNLINKAT)/g' \ -e 's/@''GNULIB_USLEEP''@/$(GL_GNULIB_USLEEP)/g' \ -e 's/@''GNULIB_WRITE''@/$(GL_GNULIB_WRITE)/g' \ -e 's/@''GNULIB_MDA_ACCESS''@/$(GL_GNULIB_MDA_ACCESS)/g' \ -e 's/@''GNULIB_MDA_CHDIR''@/$(GL_GNULIB_MDA_CHDIR)/g' \ -e 's/@''GNULIB_MDA_CLOSE''@/$(GL_GNULIB_MDA_CLOSE)/g' \ -e 's/@''GNULIB_MDA_DUP''@/$(GL_GNULIB_MDA_DUP)/g' \ -e 's/@''GNULIB_MDA_DUP2''@/$(GL_GNULIB_MDA_DUP2)/g' \ -e 's/@''GNULIB_MDA_EXECL''@/$(GL_GNULIB_MDA_EXECL)/g' \ -e 's/@''GNULIB_MDA_EXECLE''@/$(GL_GNULIB_MDA_EXECLE)/g' \ -e 's/@''GNULIB_MDA_EXECLP''@/$(GL_GNULIB_MDA_EXECLP)/g' \ -e 's/@''GNULIB_MDA_EXECV''@/$(GL_GNULIB_MDA_EXECV)/g' \ -e 's/@''GNULIB_MDA_EXECVE''@/$(GL_GNULIB_MDA_EXECVE)/g' \ -e 's/@''GNULIB_MDA_EXECVP''@/$(GL_GNULIB_MDA_EXECVP)/g' \ -e 's/@''GNULIB_MDA_EXECVPE''@/$(GL_GNULIB_MDA_EXECVPE)/g' \ -e 's/@''GNULIB_MDA_GETCWD''@/$(GL_GNULIB_MDA_GETCWD)/g' \ -e 's/@''GNULIB_MDA_GETPID''@/$(GL_GNULIB_MDA_GETPID)/g' \ -e 's/@''GNULIB_MDA_ISATTY''@/$(GL_GNULIB_MDA_ISATTY)/g' \ -e 's/@''GNULIB_MDA_LSEEK''@/$(GL_GNULIB_MDA_LSEEK)/g' \ -e 's/@''GNULIB_MDA_READ''@/$(GL_GNULIB_MDA_READ)/g' \ -e 's/@''GNULIB_MDA_RMDIR''@/$(GL_GNULIB_MDA_RMDIR)/g' \ -e 's/@''GNULIB_MDA_SWAB''@/$(GL_GNULIB_MDA_SWAB)/g' \ -e 's/@''GNULIB_MDA_UNLINK''@/$(GL_GNULIB_MDA_UNLINK)/g' \ -e 's/@''GNULIB_MDA_WRITE''@/$(GL_GNULIB_MDA_WRITE)/g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ -e 's|@''HAVE_EXECVPE''@|$(HAVE_EXECVPE)|g' \ -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ -e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETENTROPY''@|$(HAVE_GETENTROPY)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_GETPASS''@|$(HAVE_GETPASS)|g' \ -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ -e 's|@''HAVE_PIPE''@|$(HAVE_PIPE)|g' \ -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_EXECVPE''@|$(HAVE_DECL_EXECVPE)|g' \ -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ -e 's|@''HAVE_DECL_GETLOGIN''@|$(HAVE_DECL_GETLOGIN)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \ -e 's|@''HAVE_DECL_TRUNCATE''@|$(HAVE_DECL_TRUNCATE)|g' \ -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ | \ sed -e 's|@''REPLACE_ACCESS''@|$(REPLACE_ACCESS)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ -e 's|@''REPLACE_EXECL''@|$(REPLACE_EXECL)|g' \ -e 's|@''REPLACE_EXECLE''@|$(REPLACE_EXECLE)|g' \ -e 's|@''REPLACE_EXECLP''@|$(REPLACE_EXECLP)|g' \ -e 's|@''REPLACE_EXECV''@|$(REPLACE_EXECV)|g' \ -e 's|@''REPLACE_EXECVE''@|$(REPLACE_EXECVE)|g' \ -e 's|@''REPLACE_EXECVP''@|$(REPLACE_EXECVP)|g' \ -e 's|@''REPLACE_EXECVPE''@|$(REPLACE_EXECVPE)|g' \ -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \ -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ -e 's|@''REPLACE_TRUNCATE''@|$(REPLACE_TRUNCATE)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \ -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ -e 's|@''UNISTD_H_HAVE_SYS_RANDOM_H''@|$(UNISTD_H_HAVE_SYS_RANDOM_H)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ unistr.h: unistr.in.h $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/unistr.in.h; \ } > $@-t && \ mv -f $@-t $@ unitypes.h: unitypes.in.h $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/unitypes.in.h; \ } > $@-t && \ mv -f $@-t $@ uniwidth.h: uniwidth.in.h $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/uniwidth.in.h; \ } > $@-t && \ mv -f $@-t $@ # We need the following in order to create when the system # version does not work standalone. wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ -e 's/@''GNULIB_BTOWC''@/$(GL_GNULIB_BTOWC)/g' \ -e 's/@''GNULIB_WCTOB''@/$(GL_GNULIB_WCTOB)/g' \ -e 's/@''GNULIB_MBSINIT''@/$(GL_GNULIB_MBSINIT)/g' \ -e 's/@''GNULIB_MBRTOWC''@/$(GL_GNULIB_MBRTOWC)/g' \ -e 's/@''GNULIB_MBRLEN''@/$(GL_GNULIB_MBRLEN)/g' \ -e 's/@''GNULIB_MBSRTOWCS''@/$(GL_GNULIB_MBSRTOWCS)/g' \ -e 's/@''GNULIB_MBSNRTOWCS''@/$(GL_GNULIB_MBSNRTOWCS)/g' \ -e 's/@''GNULIB_WCRTOMB''@/$(GL_GNULIB_WCRTOMB)/g' \ -e 's/@''GNULIB_WCSRTOMBS''@/$(GL_GNULIB_WCSRTOMBS)/g' \ -e 's/@''GNULIB_WCSNRTOMBS''@/$(GL_GNULIB_WCSNRTOMBS)/g' \ -e 's/@''GNULIB_WCWIDTH''@/$(GL_GNULIB_WCWIDTH)/g' \ -e 's/@''GNULIB_WMEMCHR''@/$(GL_GNULIB_WMEMCHR)/g' \ -e 's/@''GNULIB_WMEMCMP''@/$(GL_GNULIB_WMEMCMP)/g' \ -e 's/@''GNULIB_WMEMCPY''@/$(GL_GNULIB_WMEMCPY)/g' \ -e 's/@''GNULIB_WMEMMOVE''@/$(GL_GNULIB_WMEMMOVE)/g' \ -e 's/@''GNULIB_WMEMPCPY''@/$(GL_GNULIB_WMEMPCPY)/g' \ -e 's/@''GNULIB_WMEMSET''@/$(GL_GNULIB_WMEMSET)/g' \ -e 's/@''GNULIB_WCSLEN''@/$(GL_GNULIB_WCSLEN)/g' \ -e 's/@''GNULIB_WCSNLEN''@/$(GL_GNULIB_WCSNLEN)/g' \ -e 's/@''GNULIB_WCSCPY''@/$(GL_GNULIB_WCSCPY)/g' \ -e 's/@''GNULIB_WCPCPY''@/$(GL_GNULIB_WCPCPY)/g' \ -e 's/@''GNULIB_WCSNCPY''@/$(GL_GNULIB_WCSNCPY)/g' \ -e 's/@''GNULIB_WCPNCPY''@/$(GL_GNULIB_WCPNCPY)/g' \ -e 's/@''GNULIB_WCSCAT''@/$(GL_GNULIB_WCSCAT)/g' \ -e 's/@''GNULIB_WCSNCAT''@/$(GL_GNULIB_WCSNCAT)/g' \ -e 's/@''GNULIB_WCSCMP''@/$(GL_GNULIB_WCSCMP)/g' \ -e 's/@''GNULIB_WCSNCMP''@/$(GL_GNULIB_WCSNCMP)/g' \ -e 's/@''GNULIB_WCSCASECMP''@/$(GL_GNULIB_WCSCASECMP)/g' \ -e 's/@''GNULIB_WCSNCASECMP''@/$(GL_GNULIB_WCSNCASECMP)/g' \ -e 's/@''GNULIB_WCSCOLL''@/$(GL_GNULIB_WCSCOLL)/g' \ -e 's/@''GNULIB_WCSXFRM''@/$(GL_GNULIB_WCSXFRM)/g' \ -e 's/@''GNULIB_WCSDUP''@/$(GL_GNULIB_WCSDUP)/g' \ -e 's/@''GNULIB_WCSCHR''@/$(GL_GNULIB_WCSCHR)/g' \ -e 's/@''GNULIB_WCSRCHR''@/$(GL_GNULIB_WCSRCHR)/g' \ -e 's/@''GNULIB_WCSCSPN''@/$(GL_GNULIB_WCSCSPN)/g' \ -e 's/@''GNULIB_WCSSPN''@/$(GL_GNULIB_WCSSPN)/g' \ -e 's/@''GNULIB_WCSPBRK''@/$(GL_GNULIB_WCSPBRK)/g' \ -e 's/@''GNULIB_WCSSTR''@/$(GL_GNULIB_WCSSTR)/g' \ -e 's/@''GNULIB_WCSTOK''@/$(GL_GNULIB_WCSTOK)/g' \ -e 's/@''GNULIB_WCSWIDTH''@/$(GL_GNULIB_WCSWIDTH)/g' \ -e 's/@''GNULIB_WCSFTIME''@/$(GL_GNULIB_WCSFTIME)/g' \ -e 's/@''GNULIB_MDA_WCSDUP''@/$(GL_GNULIB_MDA_WCSDUP)/g' \ < $(srcdir)/wchar.in.h | \ sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \ -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \ -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \ -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \ -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \ -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \ -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \ -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \ -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \ -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \ -e 's|@''HAVE_WMEMPCPY''@|$(HAVE_WMEMPCPY)|g' \ -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \ -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \ -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \ -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \ -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \ -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \ -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \ -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \ -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \ -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \ -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \ -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \ -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \ -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \ -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \ -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \ -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \ -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \ -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \ -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \ -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \ -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \ -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ -e 's|@''HAVE_WCSFTIME''@|$(HAVE_WCSFTIME)|g' \ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ -e 's|@''HAVE_DECL_WCSDUP''@|$(HAVE_DECL_WCSDUP)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ | \ sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \ -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \ -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \ -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \ -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \ -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \ -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \ -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \ -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ -e 's/@''GNULIB_ISWBLANK''@/$(GL_GNULIB_ISWBLANK)/g' \ -e 's/@''GNULIB_ISWDIGIT''@/$(GL_GNULIB_ISWDIGIT)/g' \ -e 's/@''GNULIB_ISWXDIGIT''@/$(GL_GNULIB_ISWXDIGIT)/g' \ -e 's/@''GNULIB_WCTYPE''@/$(GL_GNULIB_WCTYPE)/g' \ -e 's/@''GNULIB_ISWCTYPE''@/$(GL_GNULIB_ISWCTYPE)/g' \ -e 's/@''GNULIB_WCTRANS''@/$(GL_GNULIB_WCTRANS)/g' \ -e 's/@''GNULIB_TOWCTRANS''@/$(GL_GNULIB_TOWCTRANS)/g' \ -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \ -e 's/@''HAVE_WCTRANS_T''@/$(HAVE_WCTRANS_T)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \ -e 's/@''REPLACE_ISWDIGIT''@/$(REPLACE_ISWDIGIT)/g' \ -e 's/@''REPLACE_ISWXDIGIT''@/$(REPLACE_ISWXDIGIT)/g' \ -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ -e 's/@''REPLACE_TOWLOWER''@/$(REPLACE_TOWLOWER)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/wctype.in.h; \ } > $@-t && \ mv $@-t $@ mostlyclean-local: mostlyclean-generic @for dir in '' $(MOSTLYCLEANDIRS); do \ if test -n "$$dir" && test -d $$dir; then \ echo "rmdir $$dir"; rmdir $$dir; \ fi; \ done; \ : colorize.c: $(AM_V_at)echo '#include <$(COLORIZE_SOURCE)>' >$@-t $(AM_V_at)mv $@-t $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: kbuild-3608/src/grep/lib/quotearg.c0000664000175000017500000010455314670377426017223 0ustar locutuslocutus/* quotearg.c - quote arguments for output Copyright (C) 1998-2002, 2004-2021 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 . */ /* Written by Paul Eggert */ /* Without this pragma, gcc 4.7.0 20111124 mistakenly suggests that the quoting_options_from_style function might be candidate for attribute 'pure' */ #if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" #endif #include #include "quotearg.h" #include "quote.h" #include "attribute.h" #include "minmax.h" #include "xalloc.h" #include "c-strcaseeq.h" #include "localcharset.h" #include #include #include #include #include #include #include #include #include #include "gettext.h" #define _(msgid) gettext (msgid) #define N_(msgid) msgid #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif #define INT_BITS (sizeof (int) * CHAR_BIT) struct quoting_options { /* Basic quoting style. */ enum quoting_style style; /* Additional flags. Bitwise combination of enum quoting_flags. */ int flags; /* Quote the characters indicated by this bit vector even if the quoting style would not normally require them to be quoted. */ unsigned int quote_these_too[(UCHAR_MAX / INT_BITS) + 1]; /* The left quote for custom_quoting_style. */ char const *left_quote; /* The right quote for custom_quoting_style. */ char const *right_quote; }; /* Names of quoting styles. */ char const *const quoting_style_args[] = { "literal", "shell", "shell-always", "shell-escape", "shell-escape-always", "c", "c-maybe", "escape", "locale", "clocale", 0 }; /* Correspondences to quoting style names. */ enum quoting_style const quoting_style_vals[] = { literal_quoting_style, shell_quoting_style, shell_always_quoting_style, shell_escape_quoting_style, shell_escape_always_quoting_style, c_quoting_style, c_maybe_quoting_style, escape_quoting_style, locale_quoting_style, clocale_quoting_style }; /* The default quoting options. */ static struct quoting_options default_quoting_options; /* Allocate a new set of quoting options, with contents initially identical to O if O is not null, or to the default if O is null. It is the caller's responsibility to free the result. */ struct quoting_options * clone_quoting_options (struct quoting_options *o) { int e = errno; struct quoting_options *p = xmemdup (o ? o : &default_quoting_options, sizeof *o); errno = e; return p; } /* Get the value of O's quoting style. If O is null, use the default. */ enum quoting_style get_quoting_style (struct quoting_options const *o) { return (o ? o : &default_quoting_options)->style; } /* In O (or in the default if O is null), set the value of the quoting style to S. */ void set_quoting_style (struct quoting_options *o, enum quoting_style s) { (o ? o : &default_quoting_options)->style = s; } /* In O (or in the default if O is null), set the value of the quoting options for character C to I. Return the old value. Currently, the only values defined for I are 0 (the default) and 1 (which means to quote the character even if it would not otherwise be quoted). */ int set_char_quoting (struct quoting_options *o, char c, int i) { unsigned char uc = c; unsigned int *p = (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS; int shift = uc % INT_BITS; int r = (*p >> shift) & 1; *p ^= ((i & 1) ^ r) << shift; return r; } /* In O (or in the default if O is null), set the value of the quoting options flag to I, which can be a bitwise combination of enum quoting_flags, or 0 for default behavior. Return the old value. */ int set_quoting_flags (struct quoting_options *o, int i) { int r; if (!o) o = &default_quoting_options; r = o->flags; o->flags = i; return r; } void set_custom_quoting (struct quoting_options *o, char const *left_quote, char const *right_quote) { if (!o) o = &default_quoting_options; o->style = custom_quoting_style; if (!left_quote || !right_quote) abort (); o->left_quote = left_quote; o->right_quote = right_quote; } /* Return quoting options for STYLE, with no extra quoting. */ static struct quoting_options /* NOT PURE!! */ quoting_options_from_style (enum quoting_style style) { struct quoting_options o = { literal_quoting_style, 0, { 0 }, NULL, NULL }; if (style == custom_quoting_style) abort (); o.style = style; return o; } /* MSGID approximates a quotation mark. Return its translation if it has one; otherwise, return either it or "\"", depending on S. S is either clocale_quoting_style or locale_quoting_style. */ static char const * gettext_quote (char const *msgid, enum quoting_style s) { char const *translation = _(msgid); char const *locale_code; if (translation != msgid) return translation; /* For UTF-8 and GB-18030, use single quotes U+2018 and U+2019. Here is a list of other locales that include U+2018 and U+2019: ISO-8859-7 0xA1 KOI8-T 0x91 CP869 0x8B CP874 0x91 CP932 0x81 0x65 CP936 0xA1 0xAE CP949 0xA1 0xAE CP950 0xA1 0xA5 CP1250 0x91 CP1251 0x91 CP1252 0x91 CP1253 0x91 CP1254 0x91 CP1255 0x91 CP1256 0x91 CP1257 0x91 EUC-JP 0xA1 0xC6 EUC-KR 0xA1 0xAE EUC-TW 0xA1 0xE4 BIG5 0xA1 0xA5 BIG5-HKSCS 0xA1 0xA5 EUC-CN 0xA1 0xAE GBK 0xA1 0xAE Georgian-PS 0x91 PT154 0x91 None of these is still in wide use; using iconv is overkill. */ locale_code = locale_charset (); if (STRCASEEQ (locale_code, "UTF-8", 'U','T','F','-','8',0,0,0,0)) return msgid[0] == '`' ? "\xe2\x80\x98": "\xe2\x80\x99"; if (STRCASEEQ (locale_code, "GB18030", 'G','B','1','8','0','3','0',0,0)) return msgid[0] == '`' ? "\xa1\ae": "\xa1\xaf"; return (s == clocale_quoting_style ? "\"" : "'"); } /* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of argument ARG (of size ARGSIZE), using QUOTING_STYLE, FLAGS, and QUOTE_THESE_TOO to control quoting. Terminate the output with a null character, and return the written size of the output, not counting the terminating null. If BUFFERSIZE is too small to store the output string, return the value that would have been returned had BUFFERSIZE been large enough. If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE. This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG, ARGSIZE, O), except it breaks O into its component pieces and is not careful about errno. */ static size_t quotearg_buffer_restyled (char *buffer, size_t buffersize, char const *arg, size_t argsize, enum quoting_style quoting_style, int flags, unsigned int const *quote_these_too, char const *left_quote, char const *right_quote) { size_t i; size_t len = 0; size_t orig_buffersize = 0; char const *quote_string = 0; size_t quote_string_len = 0; bool backslash_escapes = false; bool unibyte_locale = MB_CUR_MAX == 1; bool elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0; bool pending_shell_escape_end = false; bool encountered_single_quote = false; bool all_c_and_shell_quote_compat = true; #define STORE(c) \ do \ { \ if (len < buffersize) \ buffer[len] = (c); \ len++; \ } \ while (0) #define START_ESC() \ do \ { \ if (elide_outer_quotes) \ goto force_outer_quoting_style; \ escaping = true; \ if (quoting_style == shell_always_quoting_style \ && ! pending_shell_escape_end) \ { \ STORE ('\''); \ STORE ('$'); \ STORE ('\''); \ pending_shell_escape_end = true; \ } \ STORE ('\\'); \ } \ while (0) #define END_ESC() \ do \ { \ if (pending_shell_escape_end && ! escaping) \ { \ STORE ('\''); \ STORE ('\''); \ pending_shell_escape_end = false; \ } \ } \ while (0) process_input: switch (quoting_style) { case c_maybe_quoting_style: quoting_style = c_quoting_style; elide_outer_quotes = true; FALLTHROUGH; case c_quoting_style: if (!elide_outer_quotes) STORE ('"'); backslash_escapes = true; quote_string = "\""; quote_string_len = 1; break; case escape_quoting_style: backslash_escapes = true; elide_outer_quotes = false; break; case locale_quoting_style: case clocale_quoting_style: case custom_quoting_style: { if (quoting_style != custom_quoting_style) { /* TRANSLATORS: Get translations for open and closing quotation marks. The message catalog should translate "`" to a left quotation mark suitable for the locale, and similarly for "'". For example, a French Unicode local should translate these to U+00AB (LEFT-POINTING DOUBLE ANGLE QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK), respectively. If the catalog has no translation, we will try to use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the current locale is not Unicode, locale_quoting_style will quote 'like this', and clocale_quoting_style will quote "like this". You should always include translations for "`" and "'" even if U+2018 and U+2019 are appropriate for your locale. If you don't know what to put here, please see and use glyphs suitable for your language. */ left_quote = gettext_quote (N_("`"), quoting_style); right_quote = gettext_quote (N_("'"), quoting_style); } if (!elide_outer_quotes) for (quote_string = left_quote; *quote_string; quote_string++) STORE (*quote_string); backslash_escapes = true; quote_string = right_quote; quote_string_len = strlen (quote_string); } break; case shell_escape_quoting_style: backslash_escapes = true; FALLTHROUGH; case shell_quoting_style: elide_outer_quotes = true; FALLTHROUGH; case shell_escape_always_quoting_style: if (!elide_outer_quotes) backslash_escapes = true; FALLTHROUGH; case shell_always_quoting_style: quoting_style = shell_always_quoting_style; if (!elide_outer_quotes) STORE ('\''); quote_string = "'"; quote_string_len = 1; break; case literal_quoting_style: elide_outer_quotes = false; break; default: abort (); } for (i = 0; ! (argsize == SIZE_MAX ? arg[i] == '\0' : i == argsize); i++) { unsigned char c; unsigned char esc; bool is_right_quote = false; bool escaping = false; bool c_and_shell_quote_compat = false; if (backslash_escapes && quoting_style != shell_always_quoting_style && quote_string_len && (i + quote_string_len <= (argsize == SIZE_MAX && 1 < quote_string_len /* Use strlen only if we must: when argsize is SIZE_MAX, and when the quote string is more than 1 byte long. If we do call strlen, save the result. */ ? (argsize = strlen (arg)) : argsize)) && memcmp (arg + i, quote_string, quote_string_len) == 0) { if (elide_outer_quotes) goto force_outer_quoting_style; is_right_quote = true; } c = arg[i]; switch (c) { case '\0': if (backslash_escapes) { START_ESC (); /* If quote_string were to begin with digits, we'd need to test for the end of the arg as well. However, it's hard to imagine any locale that would use digits in quotes, and set_custom_quoting is documented not to accept them. Use only a single \0 with shell-escape as currently digits are not printed within $'...' */ if (quoting_style != shell_always_quoting_style && i + 1 < argsize && '0' <= arg[i + 1] && arg[i + 1] <= '9') { STORE ('0'); STORE ('0'); } c = '0'; /* We don't have to worry that this last '0' will be backslash-escaped because, again, quote_string should not start with it and because quote_these_too is documented as not accepting it. */ } else if (flags & QA_ELIDE_NULL_BYTES) continue; break; case '?': switch (quoting_style) { case shell_always_quoting_style: if (elide_outer_quotes) goto force_outer_quoting_style; break; case c_quoting_style: if ((flags & QA_SPLIT_TRIGRAPHS) && i + 2 < argsize && arg[i + 1] == '?') switch (arg[i + 2]) { case '!': case '\'': case '(': case ')': case '-': case '/': case '<': case '=': case '>': /* Escape the second '?' in what would otherwise be a trigraph. */ if (elide_outer_quotes) goto force_outer_quoting_style; c = arg[i + 2]; i += 2; STORE ('?'); STORE ('"'); STORE ('"'); STORE ('?'); break; default: break; } break; default: break; } break; case '\a': esc = 'a'; goto c_escape; case '\b': esc = 'b'; goto c_escape; case '\f': esc = 'f'; goto c_escape; case '\n': esc = 'n'; goto c_and_shell_escape; case '\r': esc = 'r'; goto c_and_shell_escape; case '\t': esc = 't'; goto c_and_shell_escape; case '\v': esc = 'v'; goto c_escape; case '\\': esc = c; /* Never need to escape '\' in shell case. */ if (quoting_style == shell_always_quoting_style) { if (elide_outer_quotes) goto force_outer_quoting_style; goto store_c; } /* No need to escape the escape if we are trying to elide outer quotes and nothing else is problematic. */ if (backslash_escapes && elide_outer_quotes && quote_string_len) goto store_c; c_and_shell_escape: if (quoting_style == shell_always_quoting_style && elide_outer_quotes) goto force_outer_quoting_style; /* fall through */ c_escape: if (backslash_escapes) { c = esc; goto store_escape; } break; case '{': case '}': /* sometimes special if isolated */ if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1)) break; FALLTHROUGH; case '#': case '~': if (i != 0) break; FALLTHROUGH; case ' ': c_and_shell_quote_compat = true; FALLTHROUGH; case '!': /* special in bash */ case '"': case '$': case '&': case '(': case ')': case '*': case ';': case '<': case '=': /* sometimes special in 0th or (with "set -k") later args */ case '>': case '[': case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */ case '`': case '|': /* A shell special character. In theory, '$' and '`' could be the first bytes of multibyte characters, which means we should check them with mbrtowc, but in practice this doesn't happen so it's not worth worrying about. */ if (quoting_style == shell_always_quoting_style && elide_outer_quotes) goto force_outer_quoting_style; break; case '\'': encountered_single_quote = true; c_and_shell_quote_compat = true; if (quoting_style == shell_always_quoting_style) { if (elide_outer_quotes) goto force_outer_quoting_style; if (buffersize && ! orig_buffersize) { /* Just scan string to see if supports a more concise representation, rather than writing a longer string but returning the length of the more concise form. */ orig_buffersize = buffersize; buffersize = 0; } STORE ('\''); STORE ('\\'); STORE ('\''); pending_shell_escape_end = false; } break; 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 '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 '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': /* These characters don't cause problems, no matter what the quoting style is. They cannot start multibyte sequences. A digit or a special letter would cause trouble if it appeared at the beginning of quote_string because we'd then escape by prepending a backslash. However, it's hard to imagine any locale that would use digits or letters as quotes, and set_custom_quoting is documented not to accept them. Also, a digit or a special letter would cause trouble if it appeared in quote_these_too, but that's also documented as not accepting them. */ c_and_shell_quote_compat = true; break; default: /* If we have a multibyte sequence, copy it until we reach its end, find an error, or come back to the initial shift state. For C-like styles, if the sequence has unprintable characters, escape the whole sequence, since we can't easily escape single characters within it. */ { /* Length of multibyte sequence found so far. */ size_t m; bool printable; if (unibyte_locale) { m = 1; printable = isprint (c) != 0; } else { mbstate_t mbstate; memset (&mbstate, 0, sizeof mbstate); m = 0; printable = true; if (argsize == SIZE_MAX) argsize = strlen (arg); do { wchar_t w; size_t bytes = mbrtowc (&w, &arg[i + m], argsize - (i + m), &mbstate); if (bytes == 0) break; else if (bytes == (size_t) -1) { printable = false; break; } else if (bytes == (size_t) -2) { printable = false; while (i + m < argsize && arg[i + m]) m++; break; } else { /* Work around a bug with older shells that "see" a '\' that is really the 2nd byte of a multibyte character. In practice the problem is limited to ASCII chars >= '@' that are shell special chars. */ if ('[' == 0x5b && elide_outer_quotes && quoting_style == shell_always_quoting_style) { size_t j; for (j = 1; j < bytes; j++) switch (arg[i + m + j]) { case '[': case '\\': case '^': case '`': case '|': goto force_outer_quoting_style; default: break; } } if (! iswprint (w)) printable = false; m += bytes; } } while (! mbsinit (&mbstate)); } c_and_shell_quote_compat = printable; if (1 < m || (backslash_escapes && ! printable)) { /* Output a multibyte sequence, or an escaped unprintable unibyte character. */ size_t ilim = i + m; for (;;) { if (backslash_escapes && ! printable) { START_ESC (); STORE ('0' + (c >> 6)); STORE ('0' + ((c >> 3) & 7)); c = '0' + (c & 7); } else if (is_right_quote) { STORE ('\\'); is_right_quote = false; } if (ilim <= i + 1) break; END_ESC (); STORE (c); c = arg[++i]; } goto store_c; } } } if (! (((backslash_escapes && quoting_style != shell_always_quoting_style) || elide_outer_quotes) && quote_these_too && quote_these_too[c / INT_BITS] >> (c % INT_BITS) & 1) && !is_right_quote) goto store_c; store_escape: START_ESC (); store_c: END_ESC (); STORE (c); if (! c_and_shell_quote_compat) all_c_and_shell_quote_compat = false; } if (len == 0 && quoting_style == shell_always_quoting_style && elide_outer_quotes) goto force_outer_quoting_style; /* Single shell quotes (') are commonly enough used as an apostrophe, that we attempt to minimize the quoting in this case. Note itʼs better to use the apostrophe modifier "\u02BC" if possible, as that renders better and works with the word match regex \W+ etc. */ if (quoting_style == shell_always_quoting_style && ! elide_outer_quotes && encountered_single_quote) { if (all_c_and_shell_quote_compat) return quotearg_buffer_restyled (buffer, orig_buffersize, arg, argsize, c_quoting_style, flags, quote_these_too, left_quote, right_quote); else if (! buffersize && orig_buffersize) { /* Disable read-only scan, and reprocess to write quoted string. */ buffersize = orig_buffersize; len = 0; goto process_input; } } if (quote_string && !elide_outer_quotes) for (; *quote_string; quote_string++) STORE (*quote_string); if (len < buffersize) buffer[len] = '\0'; return len; force_outer_quoting_style: /* Don't reuse quote_these_too, since the addition of outer quotes sufficiently quotes the specified characters. */ if (quoting_style == shell_always_quoting_style && backslash_escapes) quoting_style = shell_escape_always_quoting_style; return quotearg_buffer_restyled (buffer, buffersize, arg, argsize, quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, NULL, left_quote, right_quote); } /* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of argument ARG (of size ARGSIZE), using O to control quoting. If O is null, use the default. Terminate the output with a null character, and return the written size of the output, not counting the terminating null. If BUFFERSIZE is too small to store the output string, return the value that would have been returned had BUFFERSIZE been large enough. If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE. */ size_t quotearg_buffer (char *buffer, size_t buffersize, char const *arg, size_t argsize, struct quoting_options const *o) { struct quoting_options const *p = o ? o : &default_quoting_options; int e = errno; size_t r = quotearg_buffer_restyled (buffer, buffersize, arg, argsize, p->style, p->flags, p->quote_these_too, p->left_quote, p->right_quote); errno = e; return r; } char * quotearg_alloc (char const *arg, size_t argsize, struct quoting_options const *o) { return quotearg_alloc_mem (arg, argsize, NULL, o); } /* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly allocated storage containing the quoted string, and store the resulting size into *SIZE, if non-NULL. The result can contain embedded null bytes only if ARGSIZE is not SIZE_MAX, SIZE is not NULL, and set_quoting_flags has not set the null byte elision flag. */ char * quotearg_alloc_mem (char const *arg, size_t argsize, size_t *size, struct quoting_options const *o) { struct quoting_options const *p = o ? o : &default_quoting_options; int e = errno; /* Elide embedded null bytes if we can't return a size. */ int flags = p->flags | (size ? 0 : QA_ELIDE_NULL_BYTES); size_t bufsize = quotearg_buffer_restyled (0, 0, arg, argsize, p->style, flags, p->quote_these_too, p->left_quote, p->right_quote) + 1; char *buf = xcharalloc (bufsize); quotearg_buffer_restyled (buf, bufsize, arg, argsize, p->style, flags, p->quote_these_too, p->left_quote, p->right_quote); errno = e; if (size) *size = bufsize - 1; return buf; } /* A storage slot with size and pointer to a value. */ struct slotvec { size_t size; char *val; }; /* Preallocate a slot 0 buffer, so that the caller can always quote one small component of a "memory exhausted" message in slot 0. */ static char slot0[256]; static int nslots = 1; static struct slotvec slotvec0 = {sizeof slot0, slot0}; static struct slotvec *slotvec = &slotvec0; void quotearg_free (void) { struct slotvec *sv = slotvec; int i; for (i = 1; i < nslots; i++) free (sv[i].val); if (sv[0].val != slot0) { free (sv[0].val); slotvec0.size = sizeof slot0; slotvec0.val = slot0; } if (sv != &slotvec0) { free (sv); slotvec = &slotvec0; } nslots = 1; } /* Use storage slot N to return a quoted version of argument ARG. ARG is of size ARGSIZE, but if that is SIZE_MAX, ARG is a null-terminated string. OPTIONS specifies the quoting options. The returned value points to static storage that can be reused by the next call to this function with the same value of N. N must be nonnegative; it is typically small, and must be less than MIN (INT_MAX, IDX_MAX). The type of N is signed to allow for future extensions (using negative values). */ static char * quotearg_n_options (int n, char const *arg, size_t argsize, struct quoting_options const *options) { int e = errno; struct slotvec *sv = slotvec; int nslots_max = MIN (INT_MAX, IDX_MAX); if (! (0 <= n && n < nslots_max)) abort (); if (nslots <= n) { bool preallocated = (sv == &slotvec0); idx_t new_nslots = nslots; slotvec = sv = xpalloc (preallocated ? NULL : sv, &new_nslots, n - nslots + 1, nslots_max, sizeof *sv); if (preallocated) *sv = slotvec0; memset (sv + nslots, 0, (new_nslots - nslots) * sizeof *sv); nslots = new_nslots; } { size_t size = sv[n].size; char *val = sv[n].val; /* Elide embedded null bytes since we don't return a size. */ int flags = options->flags | QA_ELIDE_NULL_BYTES; size_t qsize = quotearg_buffer_restyled (val, size, arg, argsize, options->style, flags, options->quote_these_too, options->left_quote, options->right_quote); if (size <= qsize) { sv[n].size = size = qsize + 1; if (val != slot0) free (val); sv[n].val = val = xcharalloc (size); quotearg_buffer_restyled (val, size, arg, argsize, options->style, flags, options->quote_these_too, options->left_quote, options->right_quote); } errno = e; return val; } } char * quotearg_n (int n, char const *arg) { return quotearg_n_options (n, arg, SIZE_MAX, &default_quoting_options); } char * quotearg_n_mem (int n, char const *arg, size_t argsize) { return quotearg_n_options (n, arg, argsize, &default_quoting_options); } char * quotearg (char const *arg) { return quotearg_n (0, arg); } char * quotearg_mem (char const *arg, size_t argsize) { return quotearg_n_mem (0, arg, argsize); } char * quotearg_n_style (int n, enum quoting_style s, char const *arg) { struct quoting_options const o = quoting_options_from_style (s); return quotearg_n_options (n, arg, SIZE_MAX, &o); } char * quotearg_n_style_mem (int n, enum quoting_style s, char const *arg, size_t argsize) { struct quoting_options const o = quoting_options_from_style (s); return quotearg_n_options (n, arg, argsize, &o); } char * quotearg_style (enum quoting_style s, char const *arg) { return quotearg_n_style (0, s, arg); } char * quotearg_style_mem (enum quoting_style s, char const *arg, size_t argsize) { return quotearg_n_style_mem (0, s, arg, argsize); } char * quotearg_char_mem (char const *arg, size_t argsize, char ch) { struct quoting_options options; options = default_quoting_options; set_char_quoting (&options, ch, 1); return quotearg_n_options (0, arg, argsize, &options); } char * quotearg_char (char const *arg, char ch) { return quotearg_char_mem (arg, SIZE_MAX, ch); } char * quotearg_colon (char const *arg) { return quotearg_char (arg, ':'); } char * quotearg_colon_mem (char const *arg, size_t argsize) { return quotearg_char_mem (arg, argsize, ':'); } char * quotearg_n_style_colon (int n, enum quoting_style s, char const *arg) { struct quoting_options options; options = quoting_options_from_style (s); set_char_quoting (&options, ':', 1); return quotearg_n_options (n, arg, SIZE_MAX, &options); } char * quotearg_n_custom (int n, char const *left_quote, char const *right_quote, char const *arg) { return quotearg_n_custom_mem (n, left_quote, right_quote, arg, SIZE_MAX); } char * quotearg_n_custom_mem (int n, char const *left_quote, char const *right_quote, char const *arg, size_t argsize) { struct quoting_options o = default_quoting_options; set_custom_quoting (&o, left_quote, right_quote); return quotearg_n_options (n, arg, argsize, &o); } char * quotearg_custom (char const *left_quote, char const *right_quote, char const *arg) { return quotearg_n_custom (0, left_quote, right_quote, arg); } char * quotearg_custom_mem (char const *left_quote, char const *right_quote, char const *arg, size_t argsize) { return quotearg_n_custom_mem (0, left_quote, right_quote, arg, argsize); } /* The quoting option used by the functions of quote.h. */ struct quoting_options quote_quoting_options = { locale_quoting_style, 0, { 0 }, NULL, NULL }; char const * quote_n_mem (int n, char const *arg, size_t argsize) { return quotearg_n_options (n, arg, argsize, "e_quoting_options); } char const * quote_mem (char const *arg, size_t argsize) { return quote_n_mem (0, arg, argsize); } char const * quote_n (int n, char const *arg) { return quote_n_mem (n, arg, SIZE_MAX); } char const * quote (char const *arg) { return quote_n (0, arg); } /* * Hey Emacs! * Local Variables: * coding: utf-8 * End: */ kbuild-3608/src/grep/lib/regex_internal.h0000664000175000017500000005616014670377423020404 0ustar locutuslocutus/* Extended regular expression matching and search library. Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _REGEX_INTERNAL_H #define _REGEX_INTERNAL_H 1 #include #include #include #include #if !defined(KMK_GREP) || !defined(_MSC_VER) #include #endif #include #include #include #include #include #ifndef _LIBC # include #endif #include #include #if defined DEBUG && DEBUG != 0 # include # define DEBUG_ASSERT(x) assert (x) #else # define DEBUG_ASSERT(x) assume (x) #endif #ifdef _LIBC # include # define lock_define(name) __libc_lock_define (, name) # define lock_init(lock) (__libc_lock_init (lock), 0) # define lock_fini(lock) ((void) 0) # define lock_lock(lock) __libc_lock_lock (lock) # define lock_unlock(lock) __libc_lock_unlock (lock) #elif defined GNULIB_LOCK && !defined GNULIB_REGEX_SINGLE_THREAD # include "glthread/lock.h" # define lock_define(name) gl_lock_define (, name) # define lock_init(lock) glthread_lock_init (&(lock)) # define lock_fini(lock) glthread_lock_destroy (&(lock)) # define lock_lock(lock) glthread_lock_lock (&(lock)) # define lock_unlock(lock) glthread_lock_unlock (&(lock)) #elif defined GNULIB_PTHREAD && !defined GNULIB_REGEX_SINGLE_THREAD # include # define lock_define(name) pthread_mutex_t name; # define lock_init(lock) pthread_mutex_init (&(lock), 0) # define lock_fini(lock) pthread_mutex_destroy (&(lock)) # define lock_lock(lock) pthread_mutex_lock (&(lock)) # define lock_unlock(lock) pthread_mutex_unlock (&(lock)) #else # define lock_define(name) # define lock_init(lock) 0 # define lock_fini(lock) ((void) 0) /* The 'dfa' avoids an "unused variable 'dfa'" warning from GCC. */ # define lock_lock(lock) ((void) dfa) # define lock_unlock(lock) ((void) 0) #endif /* In case that the system doesn't have isblank(). */ #if !defined _LIBC && ! (defined isblank || (HAVE_ISBLANK && HAVE_DECL_ISBLANK)) # define isblank(ch) ((ch) == ' ' || (ch) == '\t') #endif /* regex code assumes isascii has its usual numeric meaning, even if the portable character set uses EBCDIC encoding, and even if wint_t is wider than int. */ #ifndef _LIBC # undef isascii # define isascii(c) (((c) & ~0x7f) == 0) #endif #ifdef _LIBC # ifndef _RE_DEFINE_LOCALE_FUNCTIONS # define _RE_DEFINE_LOCALE_FUNCTIONS 1 # include # include # endif #endif /* This is for other GNU distributions with internationalized messages. */ #if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC # include # ifdef _LIBC # undef gettext # define gettext(msgid) \ __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES) # endif #else # undef gettext # define gettext(msgid) (msgid) #endif #ifndef gettext_noop /* This define is so xgettext can find the internationalizable strings. */ # define gettext_noop(String) String #endif #if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE) || _LIBC # define RE_ENABLE_I18N #endif /* Number of ASCII characters. */ #define ASCII_CHARS 0x80 /* Number of single byte characters. */ #define SBC_MAX (UCHAR_MAX + 1) #define COLL_ELEM_LEN_MAX 8 /* The character which represents newline. */ #define NEWLINE_CHAR '\n' #define WIDE_NEWLINE_CHAR L'\n' /* Rename to standard API for using out of glibc. */ #ifndef _LIBC # undef __wctype # undef __iswalnum # undef __iswctype # undef __towlower # undef __towupper # define __wctype wctype # define __iswalnum iswalnum # define __iswctype iswctype # define __towlower towlower # define __towupper towupper # define __btowc btowc # define __mbrtowc mbrtowc # define __wcrtomb wcrtomb # define __regfree regfree #endif /* not _LIBC */ #ifndef SSIZE_MAX # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif #ifndef ULONG_WIDTH # define ULONG_WIDTH REGEX_UINTEGER_WIDTH (ULONG_MAX) /* The number of usable bits in an unsigned integer type with maximum value MAX, as an int expression suitable in #if. Cover all known practical hosts. This implementation exploits the fact that MAX is 1 less than a power of 2, and merely counts the number of 1 bits in MAX; "COBn" means "count the number of 1 bits in the low-order n bits". */ # define REGEX_UINTEGER_WIDTH(max) REGEX_COB128 (max) # define REGEX_COB128(n) (REGEX_COB64 ((n) >> 31 >> 31 >> 2) + REGEX_COB64 (n)) # define REGEX_COB64(n) (REGEX_COB32 ((n) >> 31 >> 1) + REGEX_COB32 (n)) # define REGEX_COB32(n) (REGEX_COB16 ((n) >> 16) + REGEX_COB16 (n)) # define REGEX_COB16(n) (REGEX_COB8 ((n) >> 8) + REGEX_COB8 (n)) # define REGEX_COB8(n) (REGEX_COB4 ((n) >> 4) + REGEX_COB4 (n)) # define REGEX_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + ((n) & 1)) # if ULONG_MAX / 2 + 1 != 1ul << (ULONG_WIDTH - 1) # error "ULONG_MAX out of range" # endif #endif /* The type of indexes into strings. This is signed, not size_t, since the API requires indexes to fit in regoff_t anyway, and using signed integers makes the code a bit smaller and presumably faster. The traditional GNU regex implementation uses int for indexes. The POSIX-compatible implementation uses a possibly-wider type. The name 'Idx' is three letters to minimize the hassle of reindenting a lot of regex code that formerly used 'int'. */ typedef regoff_t Idx; #ifdef _REGEX_LARGE_OFFSETS # define IDX_MAX SSIZE_MAX #else # define IDX_MAX INT_MAX #endif /* A hash value, suitable for computing hash tables. */ typedef __re_size_t re_hashval_t; /* An integer used to represent a set of bits. It must be unsigned, and must be at least as wide as unsigned int. */ typedef unsigned long int bitset_word_t; /* All bits set in a bitset_word_t. */ #define BITSET_WORD_MAX ULONG_MAX /* Number of bits in a bitset_word_t. */ #define BITSET_WORD_BITS ULONG_WIDTH /* Number of bitset_word_t values in a bitset_t. */ #define BITSET_WORDS ((SBC_MAX + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS) typedef bitset_word_t bitset_t[BITSET_WORDS]; typedef bitset_word_t *re_bitset_ptr_t; typedef const bitset_word_t *re_const_bitset_ptr_t; #define PREV_WORD_CONSTRAINT 0x0001 #define PREV_NOTWORD_CONSTRAINT 0x0002 #define NEXT_WORD_CONSTRAINT 0x0004 #define NEXT_NOTWORD_CONSTRAINT 0x0008 #define PREV_NEWLINE_CONSTRAINT 0x0010 #define NEXT_NEWLINE_CONSTRAINT 0x0020 #define PREV_BEGBUF_CONSTRAINT 0x0040 #define NEXT_ENDBUF_CONSTRAINT 0x0080 #define WORD_DELIM_CONSTRAINT 0x0100 #define NOT_WORD_DELIM_CONSTRAINT 0x0200 typedef enum { INSIDE_WORD = PREV_WORD_CONSTRAINT | NEXT_WORD_CONSTRAINT, WORD_FIRST = PREV_NOTWORD_CONSTRAINT | NEXT_WORD_CONSTRAINT, WORD_LAST = PREV_WORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT, INSIDE_NOTWORD = PREV_NOTWORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT, LINE_FIRST = PREV_NEWLINE_CONSTRAINT, LINE_LAST = NEXT_NEWLINE_CONSTRAINT, BUF_FIRST = PREV_BEGBUF_CONSTRAINT, BUF_LAST = NEXT_ENDBUF_CONSTRAINT, WORD_DELIM = WORD_DELIM_CONSTRAINT, NOT_WORD_DELIM = NOT_WORD_DELIM_CONSTRAINT } re_context_type; typedef struct { Idx alloc; Idx nelem; Idx *elems; } re_node_set; typedef enum { NON_TYPE = 0, /* Node type, These are used by token, node, tree. */ CHARACTER = 1, END_OF_RE = 2, SIMPLE_BRACKET = 3, OP_BACK_REF = 4, OP_PERIOD = 5, #ifdef RE_ENABLE_I18N COMPLEX_BRACKET = 6, OP_UTF8_PERIOD = 7, #endif /* RE_ENABLE_I18N */ /* We define EPSILON_BIT as a macro so that OP_OPEN_SUBEXP is used when the debugger shows values of this enum type. */ #define EPSILON_BIT 8 OP_OPEN_SUBEXP = EPSILON_BIT | 0, OP_CLOSE_SUBEXP = EPSILON_BIT | 1, OP_ALT = EPSILON_BIT | 2, OP_DUP_ASTERISK = EPSILON_BIT | 3, ANCHOR = EPSILON_BIT | 4, /* Tree type, these are used only by tree. */ CONCAT = 16, SUBEXP = 17, /* Token type, these are used only by token. */ OP_DUP_PLUS = 18, OP_DUP_QUESTION, OP_OPEN_BRACKET, OP_CLOSE_BRACKET, OP_CHARSET_RANGE, OP_OPEN_DUP_NUM, OP_CLOSE_DUP_NUM, OP_NON_MATCH_LIST, OP_OPEN_COLL_ELEM, OP_CLOSE_COLL_ELEM, OP_OPEN_EQUIV_CLASS, OP_CLOSE_EQUIV_CLASS, OP_OPEN_CHAR_CLASS, OP_CLOSE_CHAR_CLASS, OP_WORD, OP_NOTWORD, OP_SPACE, OP_NOTSPACE, BACK_SLASH } re_token_type_t; #ifdef RE_ENABLE_I18N typedef struct { /* Multibyte characters. */ wchar_t *mbchars; /* Collating symbols. */ # ifdef _LIBC int32_t *coll_syms; # endif /* Equivalence classes. */ # ifdef _LIBC int32_t *equiv_classes; # endif /* Range expressions. */ # ifdef _LIBC uint32_t *range_starts; uint32_t *range_ends; # else /* not _LIBC */ wchar_t *range_starts; wchar_t *range_ends; # endif /* not _LIBC */ /* Character classes. */ wctype_t *char_classes; /* If this character set is the non-matching list. */ unsigned int non_match : 1; /* # of multibyte characters. */ Idx nmbchars; /* # of collating symbols. */ Idx ncoll_syms; /* # of equivalence classes. */ Idx nequiv_classes; /* # of range expressions. */ Idx nranges; /* # of character classes. */ Idx nchar_classes; } re_charset_t; #endif /* RE_ENABLE_I18N */ typedef struct { union { unsigned char c; /* for CHARACTER */ re_bitset_ptr_t sbcset; /* for SIMPLE_BRACKET */ #ifdef RE_ENABLE_I18N re_charset_t *mbcset; /* for COMPLEX_BRACKET */ #endif /* RE_ENABLE_I18N */ Idx idx; /* for BACK_REF */ re_context_type ctx_type; /* for ANCHOR */ } opr; #if (__GNUC__ >= 2 || defined __clang__) && !defined __STRICT_ANSI__ re_token_type_t type : 8; #else re_token_type_t type; #endif unsigned int constraint : 10; /* context constraint */ unsigned int duplicated : 1; unsigned int opt_subexp : 1; #ifdef RE_ENABLE_I18N unsigned int accept_mb : 1; /* These 2 bits can be moved into the union if needed (e.g. if running out of bits; move opr.c to opr.c.c and move the flags to opr.c.flags). */ unsigned int mb_partial : 1; #endif unsigned int word_char : 1; } re_token_t; #define IS_EPSILON_NODE(type) ((type) & EPSILON_BIT) struct re_string_t { /* Indicate the raw buffer which is the original string passed as an argument of regexec(), re_search(), etc.. */ const unsigned char *raw_mbs; /* Store the multibyte string. In case of "case insensitive mode" like REG_ICASE, upper cases of the string are stored, otherwise MBS points the same address that RAW_MBS points. */ unsigned char *mbs; #ifdef RE_ENABLE_I18N /* Store the wide character string which is corresponding to MBS. */ wint_t *wcs; Idx *offsets; mbstate_t cur_state; #endif /* Index in RAW_MBS. Each character mbs[i] corresponds to raw_mbs[raw_mbs_idx + i]. */ Idx raw_mbs_idx; /* The length of the valid characters in the buffers. */ Idx valid_len; /* The corresponding number of bytes in raw_mbs array. */ Idx valid_raw_len; /* The length of the buffers MBS and WCS. */ Idx bufs_len; /* The index in MBS, which is updated by re_string_fetch_byte. */ Idx cur_idx; /* length of RAW_MBS array. */ Idx raw_len; /* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN. */ Idx len; /* End of the buffer may be shorter than its length in the cases such as re_match_2, re_search_2. Then, we use STOP for end of the buffer instead of LEN. */ Idx raw_stop; /* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS. */ Idx stop; /* The context of mbs[0]. We store the context independently, since the context of mbs[0] may be different from raw_mbs[0], which is the beginning of the input string. */ unsigned int tip_context; /* The translation passed as a part of an argument of re_compile_pattern. */ RE_TRANSLATE_TYPE trans; /* Copy of re_dfa_t's word_char. */ re_const_bitset_ptr_t word_char; /* true if REG_ICASE. */ unsigned char icase; unsigned char is_utf8; unsigned char map_notascii; unsigned char mbs_allocated; unsigned char offsets_needed; unsigned char newline_anchor; unsigned char word_ops_used; int mb_cur_max; }; typedef struct re_string_t re_string_t; struct re_dfa_t; typedef struct re_dfa_t re_dfa_t; #ifndef _LIBC # define IS_IN(libc) false #endif #define re_string_peek_byte(pstr, offset) \ ((pstr)->mbs[(pstr)->cur_idx + offset]) #define re_string_fetch_byte(pstr) \ ((pstr)->mbs[(pstr)->cur_idx++]) #define re_string_first_byte(pstr, idx) \ ((idx) == (pstr)->valid_len || (pstr)->wcs[idx] != WEOF) #define re_string_is_single_byte_char(pstr, idx) \ ((pstr)->wcs[idx] != WEOF && ((pstr)->valid_len == (idx) + 1 \ || (pstr)->wcs[(idx) + 1] != WEOF)) #define re_string_eoi(pstr) ((pstr)->stop <= (pstr)->cur_idx) #define re_string_cur_idx(pstr) ((pstr)->cur_idx) #define re_string_get_buffer(pstr) ((pstr)->mbs) #define re_string_length(pstr) ((pstr)->len) #define re_string_byte_at(pstr,idx) ((pstr)->mbs[idx]) #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) #ifdef _LIBC # define MALLOC_0_IS_NONNULL 1 #elif !defined MALLOC_0_IS_NONNULL # define MALLOC_0_IS_NONNULL 0 #endif #ifndef MAX # define MAX(a,b) ((a) < (b) ? (b) : (a)) #endif #ifndef MIN # define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif #define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t))) #define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t))) #define re_free(p) free (p) struct bin_tree_t { struct bin_tree_t *parent; struct bin_tree_t *left; struct bin_tree_t *right; struct bin_tree_t *first; struct bin_tree_t *next; re_token_t token; /* 'node_idx' is the index in dfa->nodes, if 'type' == 0. Otherwise 'type' indicate the type of this node. */ Idx node_idx; }; typedef struct bin_tree_t bin_tree_t; #define BIN_TREE_STORAGE_SIZE \ ((1024 - sizeof (void *)) / sizeof (bin_tree_t)) struct bin_tree_storage_t { struct bin_tree_storage_t *next; bin_tree_t data[BIN_TREE_STORAGE_SIZE]; }; typedef struct bin_tree_storage_t bin_tree_storage_t; #define CONTEXT_WORD 1 #define CONTEXT_NEWLINE (CONTEXT_WORD << 1) #define CONTEXT_BEGBUF (CONTEXT_NEWLINE << 1) #define CONTEXT_ENDBUF (CONTEXT_BEGBUF << 1) #define IS_WORD_CONTEXT(c) ((c) & CONTEXT_WORD) #define IS_NEWLINE_CONTEXT(c) ((c) & CONTEXT_NEWLINE) #define IS_BEGBUF_CONTEXT(c) ((c) & CONTEXT_BEGBUF) #define IS_ENDBUF_CONTEXT(c) ((c) & CONTEXT_ENDBUF) #define IS_ORDINARY_CONTEXT(c) ((c) == 0) #define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_') #define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR) #define IS_WIDE_WORD_CHAR(ch) (__iswalnum (ch) || (ch) == L'_') #define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR) #define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \ ((((constraint) & PREV_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \ || ((constraint & PREV_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \ || ((constraint & PREV_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context))\ || ((constraint & PREV_BEGBUF_CONSTRAINT) && !IS_BEGBUF_CONTEXT (context))) #define NOT_SATISFY_NEXT_CONSTRAINT(constraint,context) \ ((((constraint) & NEXT_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \ || (((constraint) & NEXT_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \ || (((constraint) & NEXT_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context)) \ || (((constraint) & NEXT_ENDBUF_CONSTRAINT) && !IS_ENDBUF_CONTEXT (context))) struct re_dfastate_t { re_hashval_t hash; re_node_set nodes; re_node_set non_eps_nodes; re_node_set inveclosure; re_node_set *entrance_nodes; struct re_dfastate_t **trtable, **word_trtable; unsigned int context : 4; unsigned int halt : 1; /* If this state can accept "multi byte". Note that we refer to multibyte characters, and multi character collating elements as "multi byte". */ unsigned int accept_mb : 1; /* If this state has backreference node(s). */ unsigned int has_backref : 1; unsigned int has_constraint : 1; }; typedef struct re_dfastate_t re_dfastate_t; struct re_state_table_entry { Idx num; Idx alloc; re_dfastate_t **array; }; /* Array type used in re_sub_match_last_t and re_sub_match_top_t. */ typedef struct { Idx next_idx; Idx alloc; re_dfastate_t **array; } state_array_t; /* Store information about the node NODE whose type is OP_CLOSE_SUBEXP. */ typedef struct { Idx node; Idx str_idx; /* The position NODE match at. */ state_array_t path; } re_sub_match_last_t; /* Store information about the node NODE whose type is OP_OPEN_SUBEXP. And information about the node, whose type is OP_CLOSE_SUBEXP, corresponding to NODE is stored in LASTS. */ typedef struct { Idx str_idx; Idx node; state_array_t *path; Idx alasts; /* Allocation size of LASTS. */ Idx nlasts; /* The number of LASTS. */ re_sub_match_last_t **lasts; } re_sub_match_top_t; struct re_backref_cache_entry { Idx node; Idx str_idx; Idx subexp_from; Idx subexp_to; bitset_word_t eps_reachable_subexps_map; char more; }; typedef struct { /* The string object corresponding to the input string. */ re_string_t input; const re_dfa_t *const dfa; /* EFLAGS of the argument of regexec. */ int eflags; /* Where the matching ends. */ Idx match_last; Idx last_node; /* The state log used by the matcher. */ re_dfastate_t **state_log; Idx state_log_top; /* Back reference cache. */ Idx nbkref_ents; Idx abkref_ents; struct re_backref_cache_entry *bkref_ents; int max_mb_elem_len; Idx nsub_tops; Idx asub_tops; re_sub_match_top_t **sub_tops; } re_match_context_t; typedef struct { re_dfastate_t **sifted_states; re_dfastate_t **limited_states; Idx last_node; Idx last_str_idx; re_node_set limits; } re_sift_context_t; struct re_fail_stack_ent_t { Idx idx; Idx node; regmatch_t *regs; re_node_set eps_via_nodes; }; struct re_fail_stack_t { Idx num; Idx alloc; struct re_fail_stack_ent_t *stack; }; struct re_dfa_t { re_token_t *nodes; size_t nodes_alloc; size_t nodes_len; Idx *nexts; Idx *org_indices; re_node_set *edests; re_node_set *eclosures; re_node_set *inveclosures; struct re_state_table_entry *state_table; re_dfastate_t *init_state; re_dfastate_t *init_state_word; re_dfastate_t *init_state_nl; re_dfastate_t *init_state_begbuf; bin_tree_t *str_tree; bin_tree_storage_t *str_tree_storage; re_bitset_ptr_t sb_char; int str_tree_storage_idx; /* number of subexpressions 're_nsub' is in regex_t. */ re_hashval_t state_hash_mask; Idx init_node; Idx nbackref; /* The number of backreference in this dfa. */ /* Bitmap expressing which backreference is used. */ bitset_word_t used_bkref_map; bitset_word_t completed_bkref_map; unsigned int has_plural_match : 1; /* If this dfa has "multibyte node", which is a backreference or a node which can accept multibyte character or multi character collating element. */ unsigned int has_mb_node : 1; unsigned int is_utf8 : 1; unsigned int map_notascii : 1; unsigned int word_ops_used : 1; int mb_cur_max; bitset_t word_char; reg_syntax_t syntax; Idx *subexp_map; #ifdef DEBUG char* re_str; #endif lock_define (lock) }; #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set)) #define re_node_set_remove(set,id) \ (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1)) #define re_node_set_empty(p) ((p)->nelem = 0) #define re_node_set_free(set) re_free ((set)->elems) typedef enum { SB_CHAR, MB_CHAR, EQUIV_CLASS, COLL_SYM, CHAR_CLASS } bracket_elem_type; typedef struct { bracket_elem_type type; union { unsigned char ch; unsigned char *name; wchar_t wch; } opr; } bracket_elem_t; /* Functions for bitset_t operation. */ static inline void bitset_set (bitset_t set, Idx i) { set[i / BITSET_WORD_BITS] |= (bitset_word_t) 1 << i % BITSET_WORD_BITS; } static inline void bitset_clear (bitset_t set, Idx i) { set[i / BITSET_WORD_BITS] &= ~ ((bitset_word_t) 1 << i % BITSET_WORD_BITS); } static inline bool bitset_contain (const bitset_t set, Idx i) { return (set[i / BITSET_WORD_BITS] >> i % BITSET_WORD_BITS) & 1; } static inline void bitset_empty (bitset_t set) { memset (set, '\0', sizeof (bitset_t)); } static inline void bitset_set_all (bitset_t set) { memset (set, -1, sizeof (bitset_word_t) * (SBC_MAX / BITSET_WORD_BITS)); if (SBC_MAX % BITSET_WORD_BITS != 0) set[BITSET_WORDS - 1] = ((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1; } static inline void bitset_copy (bitset_t dest, const bitset_t src) { memcpy (dest, src, sizeof (bitset_t)); } static inline void bitset_not (bitset_t set) { int bitset_i; for (bitset_i = 0; bitset_i < SBC_MAX / BITSET_WORD_BITS; ++bitset_i) set[bitset_i] = ~set[bitset_i]; if (SBC_MAX % BITSET_WORD_BITS != 0) set[BITSET_WORDS - 1] = ((((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1) & ~set[BITSET_WORDS - 1]); } static inline void bitset_merge (bitset_t dest, const bitset_t src) { int bitset_i; for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i) dest[bitset_i] |= src[bitset_i]; } static inline void bitset_mask (bitset_t dest, const bitset_t src) { int bitset_i; for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i) dest[bitset_i] &= src[bitset_i]; } #ifdef RE_ENABLE_I18N /* Functions for re_string. */ static int __attribute__ ((pure, unused)) re_string_char_size_at (const re_string_t *pstr, Idx idx) { int byte_idx; if (pstr->mb_cur_max == 1) return 1; for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx) if (pstr->wcs[idx + byte_idx] != WEOF) break; return byte_idx; } static wint_t __attribute__ ((pure, unused)) re_string_wchar_at (const re_string_t *pstr, Idx idx) { if (pstr->mb_cur_max == 1) return (wint_t) pstr->mbs[idx]; return (wint_t) pstr->wcs[idx]; } # ifdef _LIBC # include # endif static int __attribute__ ((pure, unused)) re_string_elem_size_at (const re_string_t *pstr, Idx idx) { # ifdef _LIBC const unsigned char *p, *extra; const int32_t *table, *indirect; uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules != 0) { table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB); extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); p = pstr->mbs + idx; findidx (table, indirect, extra, &p, pstr->len - idx); return p - pstr->mbs - idx; } else # endif /* _LIBC */ return 1; } #endif /* RE_ENABLE_I18N */ #ifdef _LIBC # if __GNUC__ >= 7 # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) # endif #else # include "attribute.h" #endif #endif /* _REGEX_INTERNAL_H */ kbuild-3608/src/grep/lib/iswctype-impl.h0000664000175000017500000000162214670377424020176 0ustar locutuslocutus/* Test whether a wide character has a given property. Copyright (C) 2011-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ int iswctype (wint_t wc, wctype_t desc) { return ((int (*) (wint_t)) desc) (wc); } kbuild-3608/src/grep/lib/sys-limits.h0000664000175000017500000000322714670377426017512 0ustar locutuslocutus/* System call limits Copyright 2018-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _GL_SYS_LIMITS_H #define _GL_SYS_LIMITS_H #include /* Maximum number of bytes to read or write in a single system call. This can be useful for system calls like sendfile on GNU/Linux, which do not handle more than MAX_RW_COUNT bytes correctly. The Linux kernel MAX_RW_COUNT is at least INT_MAX >> 20 << 20, where the 20 comes from the Hexagon port with 1 MiB pages; use that as an approximation, as the exact value may not be available to us. Using this also works around a serious Linux bug before 2.6.16; see . Using this also works around a Tru64 5.1 bug, where attempting to read INT_MAX bytes fails with errno == EINVAL. See . Using this is likely to work around similar bugs in other operating systems. */ enum { SYS_BUFSIZE_MAX = INT_MAX >> 20 << 20 }; #endif kbuild-3608/src/grep/lib/malloca.c0000664000175000017500000000725314670377424017001 0ustar locutuslocutus/* Safe automatic memory allocation. Copyright (C) 2003, 2006-2007, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2003, 2018. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #define _GL_USE_STDLIB_ALLOC 1 #include /* Specification. */ #include "malloca.h" #include "idx.h" #include "intprops.h" #include "verify.h" /* The speed critical point in this file is freea() applied to an alloca() result: it must be fast, to match the speed of alloca(). The speed of mmalloca() and freea() in the other case are not critical, because they are only invoked for big memory sizes. Here we use a bit in the address as an indicator, an idea by Ondřej Bílka. malloca() can return three types of pointers: - Pointers ≡ 0 mod 2*sa_alignment_max come from stack allocation. - Pointers ≡ sa_alignment_max mod 2*sa_alignment_max come from heap allocation. - NULL comes from a failed heap allocation. */ /* Type for holding very small pointer differences. */ typedef unsigned char small_t; /* Verify that it is wide enough. */ verify (2 * sa_alignment_max - 1 <= (small_t) -1); void * mmalloca (size_t n) { #if HAVE_ALLOCA /* Allocate one more word, used to determine the address to pass to freea(), and room for the alignment ≡ sa_alignment_max mod 2*sa_alignment_max. */ uintptr_t alignment2_mask = 2 * sa_alignment_max - 1; int plus = sizeof (small_t) + alignment2_mask; idx_t nplus; if (!INT_ADD_WRAPV (n, plus, &nplus) && !xalloc_oversized (nplus, 1)) { char *mem = (char *) malloc (nplus); if (mem != NULL) { uintptr_t umem = (uintptr_t)mem, umemplus; /* The INT_ADD_WRAPV avoids signed integer overflow on theoretical platforms where UINTPTR_MAX <= INT_MAX. */ INT_ADD_WRAPV (umem, sizeof (small_t) + sa_alignment_max - 1, &umemplus); idx_t offset = ((umemplus & ~alignment2_mask) + sa_alignment_max - umem); void *vp = mem + offset; small_t *p = vp; /* Here p >= mem + sizeof (small_t), and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1 hence p + n <= mem + nplus. So, the memory range [p, p+n) lies in the allocated memory range [mem, mem + nplus). */ p[-1] = offset; /* p ≡ sa_alignment_max mod 2*sa_alignment_max. */ return p; } } /* Out of memory. */ return NULL; #else # if !MALLOC_0_IS_NONNULL if (n == 0) n = 1; # endif return malloc (n); #endif } #if HAVE_ALLOCA void freea (void *p) { /* Check argument. */ if ((uintptr_t) p & (sa_alignment_max - 1)) { /* p was not the result of a malloca() call. Invalid argument. */ abort (); } /* Determine whether p was a non-NULL pointer returned by mmalloca(). */ if ((uintptr_t) p & sa_alignment_max) { void *mem = (char *) p - ((small_t *) p)[-1]; free (mem); } } #endif /* * Hey Emacs! * Local Variables: * coding: utf-8 * End: */ kbuild-3608/src/grep/lib/strdup.c0000664000175000017500000000253214670377426016707 0ustar locutuslocutus/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _LIBC # include #endif /* Get specification. */ #include #include #undef __strdup #ifdef _LIBC # undef strdup #endif #ifndef weak_alias # define __strdup strdup #endif /* Duplicate S, returning an identical malloc'd string. */ char * __strdup (const char *s) { size_t len = strlen (s) + 1; void *new = malloc (len); if (new == NULL) return NULL; return (char *) memcpy (new, s, len); } #ifdef libc_hidden_def libc_hidden_def (__strdup) #endif #ifdef weak_alias weak_alias (__strdup, strdup) #endif kbuild-3608/src/grep/lib/read.c0000664000175000017500000000446614670377426016311 0ustar locutuslocutus/* POSIX compatible read() function. Copyright (C) 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #if defined _WIN32 && ! defined __CYGWIN__ # include # include # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" # endif # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include # endif /* Don't assume that UNICODE is not defined. */ # undef GetNamedPipeHandleState # define GetNamedPipeHandleState GetNamedPipeHandleStateA # undef read # if HAVE_MSVC_INVALID_PARAMETER_HANDLER static ssize_t read_nothrow (int fd, void *buf, size_t count) { ssize_t result; TRY_MSVC_INVAL { result = _read (fd, buf, count); } CATCH_MSVC_INVAL { result = -1; errno = EBADF; } DONE_MSVC_INVAL; return result; } # else # define read_nothrow _read # endif ssize_t rpl_read (int fd, void *buf, size_t count) { ssize_t ret = read_nothrow (fd, buf, count); # if GNULIB_NONBLOCKING if (ret < 0 && GetLastError () == ERROR_NO_DATA) { HANDLE h = (HANDLE) _get_osfhandle (fd); if (GetFileType (h) == FILE_TYPE_PIPE) { /* h is a pipe or socket. */ DWORD state; if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0) && (state & PIPE_NOWAIT) != 0) /* h is a pipe in non-blocking mode. Change errno from EINVAL to EAGAIN. */ errno = EAGAIN; } } # endif return ret; } #endif kbuild-3608/src/grep/lib/xstriconv.c0000664000175000017500000000312014670377426017417 0ustar locutuslocutus/* Charset conversion with out-of-memory checking. Copyright (C) 2001-2004, 2006, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible. 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 . */ #include /* Specification. */ #include "xstriconv.h" #include #include "striconv.h" #include "xalloc.h" #if HAVE_ICONV int xmem_cd_iconv (const char *src, size_t srclen, iconv_t cd, char **resultp, size_t *lengthp) { int retval = mem_cd_iconv (src, srclen, cd, resultp, lengthp); if (retval < 0 && errno == ENOMEM) xalloc_die (); return retval; } char * xstr_cd_iconv (const char *src, iconv_t cd) { char *result = str_cd_iconv (src, cd); if (result == NULL && errno == ENOMEM) xalloc_die (); return result; } #endif char * xstr_iconv (const char *src, const char *from_codeset, const char *to_codeset) { char *result = str_iconv (src, from_codeset, to_codeset); if (result == NULL && errno == ENOMEM) xalloc_die (); return result; } kbuild-3608/src/grep/lib/dirname.h0000664000175000017500000000305214670377422017004 0ustar locutuslocutus/* Take file names apart into directory and base names. Copyright (C) 1998, 2001, 2003-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef DIRNAME_H_ # define DIRNAME_H_ 1 # include # include # include "filename.h" # include "basename-lgpl.h" # ifndef DIRECTORY_SEPARATOR # define DIRECTORY_SEPARATOR '/' # endif #ifdef __cplusplus extern "C" { #endif # if GNULIB_DIRNAME char *base_name (char const *file) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; char *dir_name (char const *file) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; # endif char *mdir_name (char const *file) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE; bool strip_trailing_slashes (char *file); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* not DIRNAME_H_ */ kbuild-3608/src/grep/lib/dynarray.h0000664000175000017500000002230214670377422017215 0ustar locutuslocutus/* Type-safe arrays which grow dynamically. Copyright 2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert and Bruno Haible, 2021. */ #ifndef _GL_DYNARRAY_H #define _GL_DYNARRAY_H /* Before including this file, you need to define: DYNARRAY_STRUCT The struct tag of dynamic array to be defined. DYNARRAY_ELEMENT The type name of the element type. Elements are copied as if by memcpy, and can change address as the dynamic array grows. DYNARRAY_PREFIX The prefix of the functions which are defined. The following parameters are optional: DYNARRAY_ELEMENT_FREE DYNARRAY_ELEMENT_FREE (E) is evaluated to deallocate the contents of elements. E is of type DYNARRAY_ELEMENT *. DYNARRAY_ELEMENT_INIT DYNARRAY_ELEMENT_INIT (E) is evaluated to initialize a new element. E is of type DYNARRAY_ELEMENT *. If DYNARRAY_ELEMENT_FREE but not DYNARRAY_ELEMENT_INIT is defined, new elements are automatically zero-initialized. Otherwise, new elements have undefined contents. DYNARRAY_INITIAL_SIZE The size of the statically allocated array (default: at least 2, more elements if they fit into 128 bytes). Must be a preprocessor constant. If DYNARRAY_INITIAL_SIZE is 0, there is no statically allocated array at, and all non-empty arrays are heap-allocated. DYNARRAY_FINAL_TYPE The name of the type which holds the final array. If not defined, is PREFIX##finalize not provided. DYNARRAY_FINAL_TYPE must be a struct type, with members of type DYNARRAY_ELEMENT and size_t at the start (in this order). These macros are undefined after this header file has been included. The following types are provided (their members are private to the dynarray implementation): struct DYNARRAY_STRUCT The following functions are provided: */ /* Initialize a dynamic array object. This must be called before any use of the object. */ #if 0 static void DYNARRAY_PREFIX##init (struct DYNARRAY_STRUCT *list); #endif /* Deallocate the dynamic array and its elements. */ #if 0 static void DYNARRAY_PREFIX##free (struct DYNARRAY_STRUCT *list); #endif /* Return true if the dynamic array is in an error state. */ #if 0 static bool DYNARRAY_PREFIX##has_failed (const struct DYNARRAY_STRUCT *list); #endif /* Mark the dynamic array as failed. All elements are deallocated as a side effect. */ #if 0 static void DYNARRAY_PREFIX##mark_failed (struct DYNARRAY_STRUCT *list); #endif /* Return the number of elements which have been added to the dynamic array. */ #if 0 static size_t DYNARRAY_PREFIX##size (const struct DYNARRAY_STRUCT *list); #endif /* Return a pointer to the first array element, if any. For a zero-length array, the pointer can be NULL even though the dynamic array has not entered the failure state. */ #if 0 static DYNARRAY_ELEMENT * DYNARRAY_PREFIX##begin (const struct DYNARRAY_STRUCT *list); #endif /* Return a pointer one element past the last array element. For a zero-length array, the pointer can be NULL even though the dynamic array has not entered the failure state. */ #if 0 static DYNARRAY_ELEMENT * DYNARRAY_PREFIX##end (const struct DYNARRAY_STRUCT *list); #endif /* Return a pointer to the array element at INDEX. Terminate the process if INDEX is out of bounds. */ #if 0 static DYNARRAY_ELEMENT * DYNARRAY_PREFIX##at (struct DYNARRAY_STRUCT *list, size_t index); #endif /* Add ITEM at the end of the array, enlarging it by one element. Mark *LIST as failed if the dynamic array allocation size cannot be increased. */ #if 0 static void DYNARRAY_PREFIX##add (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item); #endif /* Allocate a place for a new element in *LIST and return a pointer to it. The pointer can be NULL if the dynamic array cannot be enlarged due to a memory allocation failure. */ #if 0 static DYNARRAY_ELEMENT * DYNARRAY_PREFIX##emplace (struct DYNARRAY_STRUCT *list); #endif /* Change the size of *LIST to SIZE. If SIZE is larger than the existing size, new elements are added (which can be initialized). Otherwise, the list is truncated, and elements are freed. Return false on memory allocation failure (and mark *LIST as failed). */ #if 0 static bool DYNARRAY_PREFIX##resize (struct DYNARRAY_STRUCT *list, size_t size); #endif /* Remove the last element of LIST if it is present. */ #if 0 static void DYNARRAY_PREFIX##remove_last (struct DYNARRAY_STRUCT *list); #endif /* Remove all elements from the list. The elements are freed, but the list itself is not. */ #if 0 static void DYNARRAY_PREFIX##clear (struct DYNARRAY_STRUCT *list); #endif #if defined DYNARRAY_FINAL_TYPE /* Transfer the dynamic array to a permanent location at *RESULT. Returns true on success on false on allocation failure. In either case, *LIST is re-initialized and can be reused. A NULL pointer is stored in *RESULT if LIST refers to an empty list. On success, the pointer in *RESULT is heap-allocated and must be deallocated using free. */ #if 0 static bool DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *list, DYNARRAY_FINAL_TYPE *result); #endif #else /* !defined DYNARRAY_FINAL_TYPE */ /* Transfer the dynamic array to a heap-allocated array and return a pointer to it. The pointer is NULL if memory allocation fails, or if the array is empty, so this function should be used only for arrays which are known not be empty (usually because they always have a sentinel at the end). If LENGTHP is not NULL, the array length is written to *LENGTHP. *LIST is re-initialized and can be reused. */ #if 0 static DYNARRAY_ELEMENT * DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *list, size_t *lengthp); #endif #endif /* A minimal example which provides a growing list of integers can be defined like this: struct int_array { // Pointer to result array followed by its length, // as required by DYNARRAY_FINAL_TYPE. int *array; size_t length; }; #define DYNARRAY_STRUCT dynarray_int #define DYNARRAY_ELEMENT int #define DYNARRAY_PREFIX dynarray_int_ #define DYNARRAY_FINAL_TYPE struct int_array #include To create a three-element array with elements 1, 2, 3, use this code: struct dynarray_int dyn; dynarray_int_init (&dyn); for (int i = 1; i <= 3; ++i) { int *place = dynarray_int_emplace (&dyn); assert (place != NULL); *place = i; } struct int_array result; bool ok = dynarray_int_finalize (&dyn, &result); assert (ok); assert (result.length == 3); assert (result.array[0] == 1); assert (result.array[1] == 2); assert (result.array[2] == 3); free (result.array); If the elements contain resources which must be freed, define DYNARRAY_ELEMENT_FREE appropriately, like this: struct str_array { char **array; size_t length; }; #define DYNARRAY_STRUCT dynarray_str #define DYNARRAY_ELEMENT char * #define DYNARRAY_ELEMENT_FREE(ptr) free (*ptr) #define DYNARRAY_PREFIX dynarray_str_ #define DYNARRAY_FINAL_TYPE struct str_array #include */ /* The implementation is imported from glibc. */ /* Avoid possible conflicts with symbols exported by the GNU libc. */ #define __libc_dynarray_at_failure gl_dynarray_at_failure #define __libc_dynarray_emplace_enlarge gl_dynarray_emplace_enlarge #define __libc_dynarray_finalize gl_dynarray_finalize #define __libc_dynarray_resize_clear gl_dynarray_resize_clear #define __libc_dynarray_resize gl_dynarray_resize #if defined DYNARRAY_STRUCT || defined DYNARRAY_ELEMENT || defined DYNARRAY_PREFIX # ifndef _GL_LIKELY /* Rely on __builtin_expect, as provided by the module 'builtin-expect'. */ # define _GL_LIKELY(cond) __builtin_expect ((cond), 1) # define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0) # endif /* Define auxiliary structs and declare auxiliary functions, common to all instantiations of dynarray. */ # include /* Define the instantiation, specified through DYNARRAY_STRUCT DYNARRAY_ELEMENT DYNARRAY_PREFIX etc. */ # include #else /* This file is being included from one of the malloc/dynarray_*.c files. */ # include #endif #endif /* _GL_DYNARRAY_H */ kbuild-3608/src/grep/lib/colorize-posix.c0000664000175000017500000000335014670377422020347 0ustar locutuslocutus/* Output colorization. Copyright 2011-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Without this pragma, gcc 4.7.0 20120102 suggests that the init_colorize function might be candidate for attribute 'const' */ #if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ # pragma GCC diagnostic ignored "-Wsuggest-attribute=const" #endif #include #include "colorize.h" #include #include #include #include /* Return non-zero if we should highlight matches in output to file descriptor FD. */ int should_colorize (void) { char const *t = getenv ("TERM"); return t && strcmp (t, "dumb") != 0; } void init_colorize (void) { } /* Start a colorized text attribute on stdout using the SGR_START format; the attribute is specified by SGR_SEQ. */ void print_start_colorize (char const *sgr_start, char const *sgr_seq) { printf (sgr_start, sgr_seq); } /* Restore the normal text attribute using the SGR_END string. */ void print_end_colorize (char const *sgr_end) { fputs (sgr_end, stdout); } kbuild-3608/src/grep/lib/openat.h0000664000175000017500000000575214670377425016667 0ustar locutuslocutus/* provide a replacement openat function Copyright (C) 2004-2006, 2008-2021 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 . */ /* written by Jim Meyering */ #ifndef _GL_HEADER_OPENAT #define _GL_HEADER_OPENAT #include #include #include #include #include #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #if !HAVE_OPENAT int openat_permissive (int fd, char const *file, int flags, mode_t mode, int *cwd_errno); bool openat_needs_fchdir (void); #else # define openat_permissive(Fd, File, Flags, Mode, Cwd_errno) \ openat (Fd, File, Flags, Mode) # define openat_needs_fchdir() false #endif _Noreturn void openat_restore_fail (int); _Noreturn void openat_save_fail (int); /* Using these function names makes application code slightly more readable than it would be with fchownat (..., 0) or fchownat (..., AT_SYMLINK_NOFOLLOW). */ #if GNULIB_CHOWNAT # ifndef CHOWNAT_INLINE # define CHOWNAT_INLINE _GL_INLINE # endif CHOWNAT_INLINE int chownat (int fd, char const *file, uid_t owner, gid_t group) { return fchownat (fd, file, owner, group, 0); } CHOWNAT_INLINE int lchownat (int fd, char const *file, uid_t owner, gid_t group) { return fchownat (fd, file, owner, group, AT_SYMLINK_NOFOLLOW); } #endif #if GNULIB_CHMODAT # ifndef CHMODAT_INLINE # define CHMODAT_INLINE _GL_INLINE # endif CHMODAT_INLINE int chmodat (int fd, char const *file, mode_t mode) { return fchmodat (fd, file, mode, 0); } CHMODAT_INLINE int lchmodat (int fd, char const *file, mode_t mode) { return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW); } #endif #if GNULIB_STATAT # ifndef STATAT_INLINE # define STATAT_INLINE _GL_INLINE # endif STATAT_INLINE int statat (int fd, char const *name, struct stat *st) { return fstatat (fd, name, st, 0); } STATAT_INLINE int lstatat (int fd, char const *name, struct stat *st) { return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW); } #endif /* For now, there are no wrappers named laccessat or leuidaccessat, since gnulib doesn't support faccessat(,AT_SYMLINK_NOFOLLOW) and since access rights on symlinks are of limited utility. Likewise, wrappers are not provided for accessat or euidaccessat, so as to avoid dragging in -lgen on some platforms. */ _GL_INLINE_HEADER_END #endif /* _GL_HEADER_OPENAT */ kbuild-3608/src/grep/lib/sigsegv.in.h0000664000175000017500000002332114670377426017446 0ustar locutuslocutus/* Page fault handling library. Copyright (C) 1998-2021 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 2 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 . */ /* Written by Bruno Haible. */ #ifndef _SIGSEGV_H #define _SIGSEGV_H /* Get size_t. */ #include /* Define the fault context structure. */ #if defined __linux__ || defined __ANDROID__ \ || (defined __FreeBSD__ && (defined __arm__ || defined __armhf__ || defined __arm64__)) \ || defined __NetBSD__ \ || defined _AIX || defined __sun \ || defined __CYGWIN__ /* Linux, FreeBSD, NetBSD, AIX, Solaris, Cygwin */ # include #elif (defined __APPLE__ && defined __MACH__) /* macOS */ # include #elif defined __HAIKU__ /* Haiku */ # include #endif /* Correct the value of SIGSTKSZ on some systems. glibc >= 2.34: When _GNU_SOURCE is defined, SIGSTKSZ is no longer a compile-time constant. But most programs need a simple constant. AIX 64-bit: original value 4096 is too small. HP-UX: original value 8192 is too small. Solaris 11/x86_64: original value 8192 is too small. */ #include #if __GLIBC__ >= 2 # undef SIGSTKSZ # if defined __ia64__ # define SIGSTKSZ 262144 # else # define SIGSTKSZ 65536 # endif #endif #if defined _AIX && defined _ARCH_PPC64 # undef SIGSTKSZ # define SIGSTKSZ 8192 #endif #if defined __hpux || (defined __sun && (defined __x86_64__ || defined __amd64__)) # undef SIGSTKSZ # define SIGSTKSZ 16384 #endif /* HAVE_SIGSEGV_RECOVERY is defined if the system supports catching SIGSEGV. */ #if defined __linux__ || defined __ANDROID__ || defined __GNU__ \ || defined __FreeBSD_kernel__ || (defined __FreeBSD__ && !(defined __sparc__ || defined __sparc64__)) || defined __DragonFly__ \ || defined __NetBSD__ \ || defined __OpenBSD__ \ || (defined __APPLE__ && defined __MACH__) \ || defined _AIX || defined __sgi || defined __sun \ || defined __CYGWIN__ || defined __HAIKU__ /* Linux, Hurd, GNU/kFreeBSD, FreeBSD, NetBSD, OpenBSD, macOS, AIX, IRIX, Solaris, Cygwin, Haiku */ # define HAVE_SIGSEGV_RECOVERY 1 #endif /* HAVE_STACK_OVERFLOW_RECOVERY is defined if stack overflow can be caught. */ #if defined __linux__ || defined __ANDROID__ || defined __GNU__ \ || defined __FreeBSD_kernel__ || (defined __FreeBSD__ && !(defined __sparc__ || defined __sparc64__)) || defined __DragonFly__ \ || (defined __NetBSD__ && !(defined __sparc__ || defined __sparc64__)) \ || defined __OpenBSD__ \ || (defined __APPLE__ && defined __MACH__) \ || defined _AIX || defined __sgi || defined __sun \ || defined __CYGWIN__ || defined __HAIKU__ /* Linux, Hurd, GNU/kFreeBSD, FreeBSD, NetBSD, OpenBSD, macOS, AIX, IRIX, Solaris, Cygwin, Haiku */ # define HAVE_STACK_OVERFLOW_RECOVERY 1 #endif #ifdef __cplusplus extern "C" { #endif #define LIBSIGSEGV_VERSION 0x020D /* version number: (major<<8) + minor */ extern int libsigsegv_version; /* Likewise */ /* -------------------------------------------------------------------------- */ #if 1 /* really only HAVE_SIGSEGV_RECOVERY */ /* * The mask of bits that are set to zero in a fault address that gets passed * to a global SIGSEGV handler. * On some platforms, the precise fault address is not known, only the memory * page into which the fault address falls. This is apparently allowed by POSIX: * * says: "For some implementations, the value of si_addr may be inaccurate." * In this case, the returned fault address is rounded down to a multiple of * getpagesize() = sysconf(_SC_PAGESIZE). * On such platforms, we define SIGSEGV_FAULT_ADDRESS_ALIGNMENT to be an upper * bound for getpagesize() (and, like getpagesize(), also a power of 2). * On the platforms where the returned fault address is the precise one, we * define SIGSEGV_FAULT_ADDRESS_ALIGNMENT to 1. */ # if defined __NetBSD__ && (defined __sparc__ || defined __sparc64__) /* getpagesize () is 0x1000 or 0x2000, depending on hardware. */ # define SIGSEGV_FAULT_ADDRESS_ALIGNMENT 0x2000UL # elif defined __linux__ && (defined __s390__ || defined __s390x__) /* getpagesize () is 0x1000. */ # define SIGSEGV_FAULT_ADDRESS_ALIGNMENT 0x1000UL # else # define SIGSEGV_FAULT_ADDRESS_ALIGNMENT 1UL # endif /* * The type of a global SIGSEGV handler. * The fault address, with the bits (SIGSEGV_FAULT_ADDRESS_ALIGNMENT - 1) * cleared, is passed as argument. * The access type (read access or write access) is not passed; your handler * has to know itself how to distinguish these two cases. * The second argument is 0, meaning it could also be a stack overflow, or 1, * meaning the handler should seriously try to fix the fault. * The return value should be nonzero if the handler has done its job * and no other handler should be called, or 0 if the handler declines * responsibility for the given address. * * The handler is run at a moment when nothing about the global state of the * program is known. Therefore it cannot use facilities that manipulate global * variables or locks. In particular, it cannot use malloc(); use mmap() * instead. It cannot use fopen(); use open() instead. Etc. All global * variables that are accessed by the handler should be marked 'volatile'. */ typedef int (*sigsegv_handler_t) (void* fault_address, int serious); /* * Installs a global SIGSEGV handler. * This should be called once only, and it ignores any previously installed * SIGSEGV handler. * Returns 0 on success, or -1 if the system doesn't support catching SIGSEGV. */ extern int sigsegv_install_handler (sigsegv_handler_t handler); /* * Deinstalls the global SIGSEGV handler. * This goes back to the state where no SIGSEGV handler is installed. */ extern void sigsegv_deinstall_handler (void); /* * Prepares leaving a SIGSEGV handler (through longjmp or similar means). * Control is transferred by calling CONTINUATION with CONT_ARG1, CONT_ARG2, * CONT_ARG3 as arguments. * CONTINUATION must not return. * The sigsegv_leave_handler function may return if called from a SIGSEGV * handler; its return value should be used as the handler's return value. * The sigsegv_leave_handler function does not return if called from a * stack overflow handler. */ extern int sigsegv_leave_handler (void (*continuation) (void*, void*, void*), void* cont_arg1, void* cont_arg2, void* cont_arg3); #endif /* HAVE_SIGSEGV_RECOVERY */ #if 1 /* really only HAVE_STACK_OVERFLOW_RECOVERY */ /* * The type of a context passed to a stack overflow handler. * This type is system dependent; on some platforms it is an 'ucontext_t *', * on some platforms it is a 'struct sigcontext *', on others merely an * opaque 'void *'. */ # if defined __linux__ || defined __ANDROID__ \ || (defined __FreeBSD__ && (defined __arm__ || defined __armhf__ || defined __arm64__)) \ || defined __NetBSD__ \ || (defined __APPLE__ && defined __MACH__) \ || defined _AIX || defined __sun \ || defined __CYGWIN__ || defined __HAIKU__ typedef ucontext_t *stackoverflow_context_t; # elif defined __GNU__ \ || defined __FreeBSD_kernel__ || (defined __FreeBSD__ && !(defined __sparc__ || defined __sparc64__)) || defined __DragonFly__ \ || defined __OpenBSD__ || defined __sgi typedef struct sigcontext *stackoverflow_context_t; # else typedef void *stackoverflow_context_t; # endif /* * The type of a stack overflow handler. * Such a handler should perform a longjmp call in order to reduce the amount * of stack needed. It must not return. * The emergency argument is 0 when the stack could be repared, or 1 if the * application should better save its state and exit now. * * The handler is run at a moment when nothing about the global state of the * program is known. Therefore it cannot use facilities that manipulate global * variables or locks. In particular, it cannot use malloc(); use mmap() * instead. It cannot use fopen(); use open() instead. Etc. All global * variables that are accessed by the handler should be marked 'volatile'. */ typedef void (*stackoverflow_handler_t) (int emergency, stackoverflow_context_t scp); /* * Installs a stack overflow handler. * The extra_stack argument is a pointer to a pre-allocated area used as a * stack for executing the handler. It typically comes from a static variable * or from heap-allocated memoty; placing it on the main stack may fail on * some operating systems. * Its size, passed in extra_stack_size, should be sufficiently large. The * following code determines an appropriate size: * #include * #ifndef SIGSTKSZ / * glibc defines SIGSTKSZ for this purpose * / * # define SIGSTKSZ 16384 / * on most platforms, 16 KB are sufficient * / * #endif * Returns 0 on success, or -1 if the system doesn't support catching stack * overflow. */ extern int stackoverflow_install_handler (stackoverflow_handler_t handler, void* extra_stack, size_t extra_stack_size); /* * Deinstalls the stack overflow handler. */ extern void stackoverflow_deinstall_handler (void); #endif /* HAVE_STACK_OVERFLOW_RECOVERY */ /* -------------------------------------------------------------------------- */ #ifdef __cplusplus } #endif #endif /* _SIGSEGV_H */ kbuild-3608/src/grep/lib/closedir.c0000664000175000017500000000301714670377422017165 0ustar locutuslocutus/* Stop reading the entries of a directory. Copyright (C) 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #if REPLACE_FCHDIR # include #endif #if HAVE_CLOSEDIR /* Override closedir(), to keep track of the open file descriptors. Needed because there is a function dirfd(). */ #else # include # include "dirent-private.h" #endif int closedir (DIR *dirp) { # if REPLACE_FCHDIR || REPLACE_DIRFD int fd = dirfd (dirp); # endif int retval; #if HAVE_CLOSEDIR # undef closedir retval = closedir (dirp); # ifdef __KLIBC__ if (!retval) _gl_unregister_dirp_fd (fd); # endif #else if (dirp->current != INVALID_HANDLE_VALUE) FindClose (dirp->current); free (dirp); retval = 0; #endif #if REPLACE_FCHDIR if (retval >= 0) _gl_unregister_fd (fd); #endif return retval; } kbuild-3608/src/grep/lib/alloca.c0000664000175000017500000001303514670377422016615 0ustar locutuslocutus/* alloca.c -- allocate automatically reclaimed memory This file is in the public domain. */ /* (Mostly) portable implementation -- D A Gwyn This implementation of the PWB library alloca function, which is used to allocate space off the run-time stack so that it is automatically reclaimed upon procedure exit, was inspired by discussions with J. Q. Johnson of Cornell. J.Otto Tennant contributed the Cray support. There are some preprocessor constants that can be defined when compiling for your specific system, for improved efficiency; however, the defaults should be okay. The general concept of this implementation is to keep track of all alloca-allocated blocks, and reclaim any that are found to be deeper in the stack than the current invocation. This heuristic does not reclaim storage as soon as it becomes invalid, but it will do so eventually. As a special case, alloca(0) reclaims storage without allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ #include #include #include #include #ifdef emacs # include "lisp.h" # include "blockinput.h" # ifdef EMACS_FREE # undef free # define free EMACS_FREE # endif #else # define memory_full() abort () #endif /* If compiling with GCC or clang, this file is not needed. */ #if !(defined __GNUC__ || defined __clang__) /* If someone has defined alloca as a macro, there must be some other way alloca is supposed to work. */ # ifndef alloca # ifdef emacs # ifdef static /* actually, only want this if static is defined as "" -- this is for usg, in which emacs must undefine static in order to make unexec workable */ # ifndef STACK_DIRECTION you lose -- must know STACK_DIRECTION at compile-time /* Using #error here is not wise since this file should work for old and obscure compilers. */ # endif /* STACK_DIRECTION undefined */ # endif /* static */ # endif /* emacs */ /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ # ifndef STACK_DIRECTION # define STACK_DIRECTION 0 /* Direction unknown. */ # endif # if STACK_DIRECTION != 0 # define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ # else /* STACK_DIRECTION == 0; need run-time code. */ static int stack_dir; /* 1 or -1 once known. */ # define STACK_DIR stack_dir static int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } # endif /* STACK_DIRECTION == 0 */ /* An "alloca header" is used to: (a) chain together all alloca'ed blocks; (b) keep track of stack depth. It is very important that sizeof(header) agree with malloc alignment chunk size. The following default should work okay. */ # ifndef ALIGN_SIZE # define ALIGN_SIZE sizeof(double) # endif typedef union hdr { char align[ALIGN_SIZE]; /* To force sizeof(header). */ struct { union hdr *next; /* For chaining headers. */ char *deep; /* For stack depth measure. */ } h; } header; static header *last_alloca_header = NULL; /* -> last alloca header. */ /* Return a pointer to at least SIZE bytes of storage, which will be automatically reclaimed upon exit from the procedure that called alloca. Originally, this space was supposed to be taken from the current stack frame of the caller, but that method cannot be made to work for some implementations of C, for example under Gould's UTX/32. */ void * alloca (size_t size) { auto char probe; /* Probes stack depth: */ register char *depth = &probe; # if STACK_DIRECTION == 0 if (STACK_DIR == 0) /* Unknown growth direction. */ STACK_DIR = find_stack_direction (NULL, (size & 1) + 20); # endif /* Reclaim garbage, defined as all alloca'd storage that was allocated from deeper in the stack than currently. */ { register header *hp; /* Traverses linked list. */ # ifdef emacs BLOCK_INPUT; # endif for (hp = last_alloca_header; hp != NULL;) if ((STACK_DIR > 0 && hp->h.deep > depth) || (STACK_DIR < 0 && hp->h.deep < depth)) { register header *np = hp->h.next; free (hp); /* Collect garbage. */ hp = np; /* -> next header. */ } else break; /* Rest are not deeper. */ last_alloca_header = hp; /* -> last valid storage. */ # ifdef emacs UNBLOCK_INPUT; # endif } if (size == 0) return NULL; /* No allocation required. */ /* Allocate combined header + user data storage. */ { /* Address of header. */ register header *new; size_t combined_size = sizeof (header) + size; if (combined_size < sizeof (header)) memory_full (); new = malloc (combined_size); if (! new) memory_full (); new->h.next = last_alloca_header; new->h.deep = depth; last_alloca_header = new; /* User storage begins just after header. */ return (void *) (new + 1); } } # endif /* no alloca */ #endif /* not GCC || clang */ kbuild-3608/src/grep/lib/stdarg.in.h0000664000175000017500000000222414670377426017262 0ustar locutuslocutus/* Substitute for and wrapper around . Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_STDARG_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STDARG_H@ #ifndef _@GUARD_PREFIX@_STDARG_H #define _@GUARD_PREFIX@_STDARG_H #ifndef va_copy # define va_copy(a,b) ((a) = (b)) #endif #endif /* _@GUARD_PREFIX@_STDARG_H */ #endif /* _@GUARD_PREFIX@_STDARG_H */ kbuild-3608/src/grep/lib/flexmember.h0000664000175000017500000000506514670377423017522 0ustar locutuslocutus/* Sizes of structs with flexible array members. Copyright 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . Written by Paul Eggert. */ #include /* Nonzero multiple of alignment of TYPE, suitable for FLEXSIZEOF below. On older platforms without _Alignof, use a pessimistic bound that is safe in practice even if FLEXIBLE_ARRAY_MEMBER is 1. On newer platforms, use _Alignof to get a tighter bound. */ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 # define FLEXALIGNOF(type) (sizeof (type) & ~ (sizeof (type) - 1)) #else # define FLEXALIGNOF(type) _Alignof (type) #endif /* Yield a properly aligned upper bound on the size of a struct of type TYPE with a flexible array member named MEMBER that is followed by N bytes of other data. The result is suitable as an argument to malloc. For example: struct s { int n; char d[FLEXIBLE_ARRAY_MEMBER]; }; struct s *p = malloc (FLEXSIZEOF (struct s, d, n * sizeof (char))); FLEXSIZEOF (TYPE, MEMBER, N) is not simply (sizeof (TYPE) + N), since FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms. Nor is it simply (offsetof (TYPE, MEMBER) + N), as that might yield a size that causes malloc to yield a pointer that is not properly aligned for TYPE; for example, if sizeof (int) == alignof (int) == 4, malloc (offsetof (struct s, d) + 3 * sizeof (char)) is equivalent to malloc (7) and might yield a pointer that is not a multiple of 4 (which means the pointer is not properly aligned for struct s), whereas malloc (FLEXSIZEOF (struct s, d, 3 * sizeof (char))) is equivalent to malloc (8) and must yield a pointer that is a multiple of 4. Yield a value less than N if and only if arithmetic overflow occurs. */ #define FLEXSIZEOF(type, member, n) \ ((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \ & ~ (FLEXALIGNOF (type) - 1)) kbuild-3608/src/grep/lib/limits.in.h0000664000175000017500000001072514670377424017302 0ustar locutuslocutus/* A GNU-like . Copyright 2016-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined _GL_ALREADY_INCLUDING_LIMITS_H /* Special invocation convention: On Haiku/x86_64, we have a sequence of nested includes -> -> . In this situation, LONG_MAX and INT_MAX are not yet defined, therefore we should not attempt to define LONG_BIT. */ #@INCLUDE_NEXT@ @NEXT_LIMITS_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_LIMITS_H # define _GL_ALREADY_INCLUDING_LIMITS_H /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_LIMITS_H@ # undef _GL_ALREADY_INCLUDING_LIMITS_H #ifndef _@GUARD_PREFIX@_LIMITS_H #define _@GUARD_PREFIX@_LIMITS_H #ifndef LLONG_MIN # if defined LONG_LONG_MIN /* HP-UX 11.31 */ # define LLONG_MIN LONG_LONG_MIN # elif defined LONGLONG_MIN /* IRIX 6.5 */ # define LLONG_MIN LONGLONG_MIN # elif defined __GNUC__ # define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL) # endif #endif #ifndef LLONG_MAX # if defined LONG_LONG_MAX /* HP-UX 11.31 */ # define LLONG_MAX LONG_LONG_MAX # elif defined LONGLONG_MAX /* IRIX 6.5 */ # define LLONG_MAX LONGLONG_MAX # elif defined __GNUC__ # define LLONG_MAX __LONG_LONG_MAX__ # endif #endif #ifndef ULLONG_MAX # if defined ULONG_LONG_MAX /* HP-UX 11.31 */ # define ULLONG_MAX ULONG_LONG_MAX # elif defined ULONGLONG_MAX /* IRIX 6.5 */ # define ULLONG_MAX ULONGLONG_MAX # elif defined __GNUC__ # define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL) # endif #endif /* The number of usable bits in an unsigned or signed integer type with minimum value MIN and maximum value MAX, as an int expression suitable in #if. Cover all known practical hosts. This implementation exploits the fact that MAX is 1 less than a power of 2, and merely counts the number of 1 bits in MAX; "COBn" means "count the number of 1 bits in the low-order n bits"). */ #define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max)) #define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n)) #define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n)) #define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n)) #define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n)) #define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n)) #define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1)) #ifndef WORD_BIT /* Assume 'int' is 32 bits wide. */ # define WORD_BIT 32 #endif #ifndef LONG_BIT /* Assume 'long' is 32 or 64 bits wide. */ # if LONG_MAX == INT_MAX # define LONG_BIT 32 # else # define LONG_BIT 64 # endif #endif /* Macros specified by C2x and by ISO/IEC TS 18661-1:2014. */ #if (! defined ULLONG_WIDTH \ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__ \ || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) # define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) # define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) # define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) # define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX) # define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX) # define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX) # define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX) # define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX) # define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) # define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) # define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) #endif /* Macros specified by C2x. */ #if (! defined BOOL_WIDTH \ && (defined _GNU_SOURCE \ || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) # define BOOL_MAX 1 # define BOOL_WIDTH 1 #endif #endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif kbuild-3608/src/grep/lib/unlocked-io.h0000664000175000017500000000745714670377426017617 0ustar locutuslocutus/* Prefer faster, non-thread-safe stdio functions if available. Copyright (C) 2001-2004, 2009-2021 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 . */ /* Written by Jim Meyering. */ #ifndef UNLOCKED_IO_H # define UNLOCKED_IO_H 1 /* These are wrappers for functions/macros from the GNU C library, and from other C libraries supporting POSIX's optional thread-safe functions. The standard I/O functions are thread-safe. These *_unlocked ones are more efficient but not thread-safe. That they're not thread-safe is fine since all of the applications in this package are single threaded. Also, some code that is shared with the GNU C library may invoke the *_unlocked functions directly. On hosts that lack those functions, invoke the non-thread-safe versions instead. */ # include # if HAVE_DECL_CLEARERR_UNLOCKED || defined clearerr_unlocked # undef clearerr # define clearerr(x) clearerr_unlocked (x) # else # define clearerr_unlocked(x) clearerr (x) # endif # if HAVE_DECL_FEOF_UNLOCKED || defined feof_unlocked # undef feof # define feof(x) feof_unlocked (x) # else # define feof_unlocked(x) feof (x) # endif # if HAVE_DECL_FERROR_UNLOCKED || defined ferror_unlocked # undef ferror # define ferror(x) ferror_unlocked (x) # else # define ferror_unlocked(x) ferror (x) # endif # if HAVE_DECL_FFLUSH_UNLOCKED || defined fflush_unlocked # undef fflush # define fflush(x) fflush_unlocked (x) # else # define fflush_unlocked(x) fflush (x) # endif # if HAVE_DECL_FGETS_UNLOCKED || defined fgets_unlocked # undef fgets # define fgets(x,y,z) fgets_unlocked (x,y,z) # else # define fgets_unlocked(x,y,z) fgets (x,y,z) # endif # if HAVE_DECL_FPUTC_UNLOCKED || defined fputc_unlocked # undef fputc # define fputc(x,y) fputc_unlocked (x,y) # else # define fputc_unlocked(x,y) fputc (x,y) # endif # if HAVE_DECL_FPUTS_UNLOCKED || defined fputs_unlocked # undef fputs # define fputs(x,y) fputs_unlocked (x,y) # else # define fputs_unlocked(x,y) fputs (x,y) # endif # if HAVE_DECL_FREAD_UNLOCKED || defined fread_unlocked # undef fread # define fread(w,x,y,z) fread_unlocked (w,x,y,z) # else # define fread_unlocked(w,x,y,z) fread (w,x,y,z) # endif # if HAVE_DECL_FWRITE_UNLOCKED || defined fwrite_unlocked # undef fwrite # define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) # else # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) # endif # if HAVE_DECL_GETC_UNLOCKED || defined get_unlocked # undef getc # define getc(x) getc_unlocked (x) # else # define getc_unlocked(x) getc (x) # endif # if HAVE_DECL_GETCHAR_UNLOCKED || defined getchar_unlocked # undef getchar # define getchar() getchar_unlocked () # else # define getchar_unlocked() getchar () # endif # if HAVE_DECL_PUTC_UNLOCKED || defined putc_unlocked # undef putc # define putc(x,y) putc_unlocked (x,y) # else # define putc_unlocked(x,y) putc (x,y) # endif # if HAVE_DECL_PUTCHAR_UNLOCKED || defined putchar_unlocked # undef putchar # define putchar(x) putchar_unlocked (x) # else # define putchar_unlocked(x) putchar (x) # endif # undef flockfile # define flockfile(x) ((void) 0) # undef ftrylockfile # define ftrylockfile(x) 0 # undef funlockfile # define funlockfile(x) ((void) 0) #endif /* UNLOCKED_IO_H */ kbuild-3608/src/grep/lib/locale.in.h0000664000175000017500000002370314670377424017240 0ustar locutuslocutus/* A POSIX . Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if (defined _WIN32 && !defined __CYGWIN__ && defined __need_locale_t) \ || defined _GL_ALREADY_INCLUDING_LOCALE_H /* Special invocation convention: - Inside mingw header files, - To handle Solaris header files (through Solaris 10) when combined with gettext's libintl.h. */ #@INCLUDE_NEXT@ @NEXT_LOCALE_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_LOCALE_H #define _GL_ALREADY_INCLUDING_LOCALE_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_LOCALE_H@ #undef _GL_ALREADY_INCLUDING_LOCALE_H #ifndef _@GUARD_PREFIX@_LOCALE_H #define _@GUARD_PREFIX@_LOCALE_H /* NetBSD 5.0 mis-defines NULL. */ #include /* Mac OS X 10.5 defines the locale_t type in . */ #if @HAVE_XLOCALE_H@ # include #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C. On systems that don't define it, use the same value as GNU libintl. */ #if !defined LC_MESSAGES # define LC_MESSAGES 1729 #endif /* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and int_n_*. Instead of overriding 'struct lconv', merely define these member names as macros. This avoids trouble in C++ mode. */ #if defined _MSC_VER # define int_p_cs_precedes p_cs_precedes # define int_p_sign_posn p_sign_posn # define int_p_sep_by_space p_sep_by_space # define int_n_cs_precedes n_cs_precedes # define int_n_sign_posn n_sign_posn # define int_n_sep_by_space n_sep_by_space #endif /* Bionic libc's 'struct lconv' is just a dummy. */ #if @REPLACE_STRUCT_LCONV@ # define lconv rpl_lconv struct lconv { /* All 'char *' are actually 'const char *'. */ /* Members that depend on the LC_NUMERIC category of the locale. See */ /* Symbol used as decimal point. */ char *decimal_point; /* Symbol used to separate groups of digits to the left of the decimal point. */ char *thousands_sep; /* Definition of the size of groups of digits to the left of the decimal point. */ char *grouping; /* Members that depend on the LC_MONETARY category of the locale. See */ /* Symbol used as decimal point. */ char *mon_decimal_point; /* Symbol used to separate groups of digits to the left of the decimal point. */ char *mon_thousands_sep; /* Definition of the size of groups of digits to the left of the decimal point. */ char *mon_grouping; /* Sign used to indicate a value >= 0. */ char *positive_sign; /* Sign used to indicate a value < 0. */ char *negative_sign; /* For formatting local currency. */ /* Currency symbol (3 characters) followed by separator (1 character). */ char *currency_symbol; /* Number of digits after the decimal point. */ char frac_digits; /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it comes after the number. */ char p_cs_precedes; /* For values >= 0: Position of the sign. */ char p_sign_posn; /* For values >= 0: Placement of spaces between currency symbol, sign, and number. */ char p_sep_by_space; /* For values < 0: 1 if the currency symbol precedes the number, 0 if it comes after the number. */ char n_cs_precedes; /* For values < 0: Position of the sign. */ char n_sign_posn; /* For values < 0: Placement of spaces between currency symbol, sign, and number. */ char n_sep_by_space; /* For formatting international currency. */ /* Currency symbol (3 characters) followed by separator (1 character). */ char *int_curr_symbol; /* Number of digits after the decimal point. */ char int_frac_digits; /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it comes after the number. */ char int_p_cs_precedes; /* For values >= 0: Position of the sign. */ char int_p_sign_posn; /* For values >= 0: Placement of spaces between currency symbol, sign, and number. */ char int_p_sep_by_space; /* For values < 0: 1 if the currency symbol precedes the number, 0 if it comes after the number. */ char int_n_cs_precedes; /* For values < 0: Position of the sign. */ char int_n_sign_posn; /* For values < 0: Placement of spaces between currency symbol, sign, and number. */ char int_n_sep_by_space; }; #endif #if @GNULIB_LOCALECONV@ # if @REPLACE_LOCALECONV@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef localeconv # define localeconv rpl_localeconv # endif _GL_FUNCDECL_RPL (localeconv, struct lconv *, (void)); _GL_CXXALIAS_RPL (localeconv, struct lconv *, (void)); # else _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (localeconv); # endif #elif @REPLACE_STRUCT_LCONV@ # undef localeconv # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv #elif defined GNULIB_POSIXCHECK # undef localeconv # if HAVE_RAW_DECL_LOCALECONV _GL_WARN_ON_USE (localeconv, "localeconv returns too few information on some platforms - " "use gnulib module localeconv for portability"); # endif #endif #if @GNULIB_SETLOCALE@ # if @REPLACE_SETLOCALE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef setlocale # define setlocale rpl_setlocale # define GNULIB_defined_setlocale 1 # endif _GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale)); _GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale)); # else _GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (setlocale); # endif #elif defined GNULIB_POSIXCHECK # undef setlocale # if HAVE_RAW_DECL_SETLOCALE _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - " "use gnulib module setlocale for portability"); # endif #endif #if @GNULIB_SETLOCALE_NULL@ /* Included here for convenience. */ # include "setlocale_null.h" #endif #if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@) # if @REPLACE_NEWLOCALE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef newlocale # define newlocale rpl_newlocale # define GNULIB_defined_newlocale 1 # endif _GL_FUNCDECL_RPL (newlocale, locale_t, (int category_mask, const char *name, locale_t base) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (newlocale, locale_t, (int category_mask, const char *name, locale_t base)); # else # if @HAVE_NEWLOCALE@ _GL_CXXALIAS_SYS (newlocale, locale_t, (int category_mask, const char *name, locale_t base)); # endif # endif # if @HAVE_NEWLOCALE@ _GL_CXXALIASWARN (newlocale); # endif # if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@ # ifndef HAVE_WORKING_NEWLOCALE # define HAVE_WORKING_NEWLOCALE 1 # endif # endif #elif defined GNULIB_POSIXCHECK # undef newlocale # if HAVE_RAW_DECL_NEWLOCALE _GL_WARN_ON_USE (newlocale, "newlocale is not portable"); # endif #endif #if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@) # if @REPLACE_DUPLOCALE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef duplocale # define duplocale rpl_duplocale # define GNULIB_defined_duplocale 1 # endif _GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); # else # if @HAVE_DUPLOCALE@ _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); # endif # endif # if @HAVE_DUPLOCALE@ _GL_CXXALIASWARN (duplocale); # endif # if @HAVE_DUPLOCALE@ || @REPLACE_DUPLOCALE@ # ifndef HAVE_WORKING_DUPLOCALE # define HAVE_WORKING_DUPLOCALE 1 # endif # endif #elif defined GNULIB_POSIXCHECK # undef duplocale # if HAVE_RAW_DECL_DUPLOCALE _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - " "use gnulib module duplocale for portability"); # endif #endif #if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@) # if @REPLACE_FREELOCALE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef freelocale # define freelocale rpl_freelocale # define GNULIB_defined_freelocale 1 # endif _GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (freelocale, void, (locale_t locale)); # else # if @HAVE_FREELOCALE@ /* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is int. */ _GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); # endif # endif # if @HAVE_FREELOCALE@ _GL_CXXALIASWARN (freelocale); # endif #elif defined GNULIB_POSIXCHECK # undef freelocale # if HAVE_RAW_DECL_FREELOCALE _GL_WARN_ON_USE (freelocale, "freelocale is not portable"); # endif #endif #endif /* _@GUARD_PREFIX@_LOCALE_H */ #endif /* _@GUARD_PREFIX@_LOCALE_H */ #endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */ kbuild-3608/src/grep/lib/xmalloc.c0000664000175000017500000002017614670377426017031 0ustar locutuslocutus/* xmalloc.c -- malloc with out of memory checking Copyright (C) 1990-2000, 2002-2006, 2008-2021 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 . */ #include #define XALLOC_INLINE _GL_EXTERN_INLINE #include "xalloc.h" #include "ialloc.h" #include "intprops.h" #include "minmax.h" #include #include static void * _GL_ATTRIBUTE_PURE nonnull (void *p) { if (!p) xalloc_die (); return p; } /* Allocate S bytes of memory dynamically, with error checking. */ void * xmalloc (size_t s) { return nonnull (malloc (s)); } void * ximalloc (idx_t s) { return nonnull (imalloc (s)); } char * xcharalloc (size_t n) { return XNMALLOC (n, char); } /* Change the size of an allocated block of memory P to S bytes, with error checking. */ void * xrealloc (void *p, size_t s) { void *r = realloc (p, s); if (!r && (!p || s)) xalloc_die (); return r; } void * xirealloc (void *p, idx_t s) { return nonnull (irealloc (p, s)); } /* Change the size of an allocated block of memory P to an array of N objects each of S bytes, with error checking. */ void * xreallocarray (void *p, size_t n, size_t s) { void *r = reallocarray (p, n, s); if (!r && (!p || (n && s))) xalloc_die (); return r; } void * xireallocarray (void *p, idx_t n, idx_t s) { return nonnull (ireallocarray (p, n, s)); } /* Allocate an array of N objects, each with S bytes of memory, dynamically, with error checking. S must be nonzero. */ void * xnmalloc (size_t n, size_t s) { return xreallocarray (NULL, n, s); } /* If P is null, allocate a block of at least *PS bytes; otherwise, reallocate P so that it contains more than *PS bytes. *PS must be nonzero unless P is null. Set *PS to the new block's size, and return the pointer to the new block. *PS is never set to zero, and the returned pointer is never null. */ void * x2realloc (void *p, size_t *ps) { return x2nrealloc (p, ps, 1); } /* If P is null, allocate a block of at least *PN such objects; otherwise, reallocate P so that it contains more than *PN objects each of S bytes. S must be nonzero. Set *PN to the new number of objects, and return the pointer to the new block. *PN is never set to zero, and the returned pointer is never null. Repeated reallocations are guaranteed to make progress, either by allocating an initial block with a nonzero size, or by allocating a larger block. In the following implementation, nonzero sizes are increased by a factor of approximately 1.5 so that repeated reallocations have O(N) overall cost rather than O(N**2) cost, but the specification for this function does not guarantee that rate. Here is an example of use: int *p = NULL; size_t used = 0; size_t allocated = 0; void append_int (int value) { if (used == allocated) p = x2nrealloc (p, &allocated, sizeof *p); p[used++] = value; } This causes x2nrealloc to allocate a block of some nonzero size the first time it is called. To have finer-grained control over the initial size, set *PN to a nonzero value before calling this function with P == NULL. For example: int *p = NULL; size_t used = 0; size_t allocated = 0; size_t allocated1 = 1000; void append_int (int value) { if (used == allocated) { p = x2nrealloc (p, &allocated1, sizeof *p); allocated = allocated1; } p[used++] = value; } */ void * x2nrealloc (void *p, size_t *pn, size_t s) { size_t n = *pn; if (! p) { if (! n) { /* The approximate size to use for initial small allocation requests, when the invoking code specifies an old size of zero. This is the largest "small" request for the GNU C library malloc. */ enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; n = DEFAULT_MXFAST / s; n += !n; } } else { /* Set N = floor (1.5 * N) + 1 to make progress even if N == 0. */ if (INT_ADD_WRAPV (n, (n >> 1) + 1, &n)) xalloc_die (); } p = xreallocarray (p, n, s); *pn = n; return p; } /* Grow PA, which points to an array of *PN items, and return the location of the reallocated array, updating *PN to reflect its new size. The new array will contain at least N_INCR_MIN more items, but will not contain more than N_MAX items total. S is the size of each item, in bytes. S and N_INCR_MIN must be positive. *PN must be nonnegative. If N_MAX is -1, it is treated as if it were infinity. If PA is null, then allocate a new array instead of reallocating the old one. Thus, to grow an array A without saving its old contents, do { free (A); A = xpalloc (NULL, &AITEMS, ...); }. */ void * xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s) { idx_t n0 = *pn; /* The approximate size to use for initial small allocation requests. This is the largest "small" request for the GNU C library malloc. */ enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; /* If the array is tiny, grow it to about (but no greater than) DEFAULT_MXFAST bytes. Otherwise, grow it by about 50%. Adjust the growth according to three constraints: N_INCR_MIN, N_MAX, and what the C language can represent safely. */ idx_t n; if (INT_ADD_WRAPV (n0, n0 >> 1, &n)) n = IDX_MAX; if (0 <= n_max && n_max < n) n = n_max; /* NBYTES is of a type suitable for holding the count of bytes in an object. This is typically idx_t, but it should be size_t on (theoretical?) platforms where SIZE_MAX < IDX_MAX so xpalloc does not pass values greater than SIZE_MAX to xrealloc. */ #if IDX_MAX <= SIZE_MAX idx_t nbytes; #else size_t nbytes; #endif idx_t adjusted_nbytes = (INT_MULTIPLY_WRAPV (n, s, &nbytes) ? MIN (IDX_MAX, SIZE_MAX) : nbytes < DEFAULT_MXFAST ? DEFAULT_MXFAST : 0); if (adjusted_nbytes) { n = adjusted_nbytes / s; nbytes = adjusted_nbytes - adjusted_nbytes % s; } if (! pa) *pn = 0; if (n - n0 < n_incr_min && (INT_ADD_WRAPV (n0, n_incr_min, &n) || (0 <= n_max && n_max < n) || INT_MULTIPLY_WRAPV (n, s, &nbytes))) xalloc_die (); pa = xrealloc (pa, nbytes); *pn = n; return pa; } /* Allocate S bytes of zeroed memory dynamically, with error checking. There's no need for xnzalloc (N, S), since it would be equivalent to xcalloc (N, S). */ void * xzalloc (size_t s) { return xcalloc (s, 1); } void * xizalloc (idx_t s) { return xicalloc (s, 1); } /* Allocate zeroed memory for N elements of S bytes, with error checking. S must be nonzero. */ void * xcalloc (size_t n, size_t s) { return nonnull (calloc (n, s)); } void * xicalloc (idx_t n, idx_t s) { return nonnull (icalloc (n, s)); } /* Clone an object P of size S, with error checking. There's no need for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any need for an arithmetic overflow check. */ void * xmemdup (void const *p, size_t s) { return memcpy (xmalloc (s), p, s); } void * ximemdup (void const *p, idx_t s) { return memcpy (ximalloc (s), p, s); } /* Clone an object P of size S, with error checking. Append a terminating NUL byte. */ char * ximemdup0 (void const *p, idx_t s) { char *result = ximalloc (s + 1); result[s] = 0; return memcpy (result, p, s); } /* Clone STRING. */ char * xstrdup (char const *string) { return xmemdup (string, strlen (string) + 1); } kbuild-3608/src/grep/lib/setlocale-lock.c0000664000175000017500000001053014670377426020264 0ustar locutuslocutus/* Return the internal lock used by setlocale_null_r. Copyright (C) 2019-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2019. */ #include /* When it is known that the gl_get_setlocale_null_lock function is defined by a dependency library, it should not be defined here. */ #if OMIT_SETLOCALE_LOCK /* This declaration is solely to ensure that after preprocessing this file is never empty. */ typedef int dummy; #else /* This file defines the internal lock used by setlocale_null_r. It is a separate compilation unit, so that only one copy of it is present when linking statically. */ /* Prohibit renaming this symbol. */ # undef gl_get_setlocale_null_lock /* Macro for exporting a symbol (function, not variable) defined in this file, when compiled into a shared library. */ # ifndef DLL_EXPORTED # if HAVE_VISIBILITY /* Override the effect of the compiler option '-fvisibility=hidden'. */ # define DLL_EXPORTED __attribute__((__visibility__("default"))) # elif defined _WIN32 || defined __CYGWIN__ # define DLL_EXPORTED __declspec(dllexport) # else # define DLL_EXPORTED # endif # endif # if defined _WIN32 && !defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # include "windows-initguard.h" /* The return type is a 'CRITICAL_SECTION *', not a 'glwthread_mutex_t *', because the latter is not guaranteed to be a stable ABI in the future. */ /* Make sure the function gets exported from DLLs. */ DLL_EXPORTED CRITICAL_SECTION *gl_get_setlocale_null_lock (void); static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT; static CRITICAL_SECTION lock; /* Returns the internal lock used by setlocale_null_r. */ CRITICAL_SECTION * gl_get_setlocale_null_lock (void) { if (!guard.done) { if (InterlockedIncrement (&guard.started) == 0) { /* This thread is the first one to need the lock. Initialize it. */ InitializeCriticalSection (&lock); guard.done = 1; } else { /* Don't let guard.started grow and wrap around. */ InterlockedDecrement (&guard.started); /* Yield the CPU while waiting for another thread to finish initializing this mutex. */ while (!guard.done) Sleep (0); } } return &lock; } # elif HAVE_PTHREAD_API # include static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Make sure the function gets exported from shared libraries. */ DLL_EXPORTED pthread_mutex_t *gl_get_setlocale_null_lock (void); /* Returns the internal lock used by setlocale_null_r. */ pthread_mutex_t * gl_get_setlocale_null_lock (void) { return &mutex; } # elif HAVE_THREADS_H # include # include static int volatile init_needed = 1; static once_flag init_once = ONCE_FLAG_INIT; static mtx_t mutex; static void atomic_init (void) { if (mtx_init (&mutex, mtx_plain) != thrd_success) abort (); init_needed = 0; } /* Make sure the function gets exported from shared libraries. */ DLL_EXPORTED mtx_t *gl_get_setlocale_null_lock (void); /* Returns the internal lock used by setlocale_null_r. */ mtx_t * gl_get_setlocale_null_lock (void) { if (init_needed) call_once (&init_once, atomic_init); return &mutex; } # endif # if (defined _WIN32 || defined __CYGWIN__) && !defined _MSC_VER /* Make sure the '__declspec(dllimport)' in setlocale_null.c does not cause a link failure when no DLLs are involved. */ # if defined _WIN64 || defined _LP64 # define IMP(x) __imp_##x # else # define IMP(x) _imp__##x # endif void * IMP(gl_get_setlocale_null_lock) = &gl_get_setlocale_null_lock; # endif #endif kbuild-3608/src/grep/lib/trim.h0000664000175000017500000000242514670377426016347 0ustar locutuslocutus/* Removes leading and/or trailing whitespaces Copyright (C) 2006, 2009-2021 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 . */ /* Written by Davide Angelocola */ #include /* Trim mode. */ #define TRIM_TRAILING 0 #define TRIM_LEADING 1 #define TRIM_BOTH 2 /* Removes trailing and leading whitespaces. */ #define trim(s) trim2(s, TRIM_BOTH) /* Removes trailing whitespaces. */ #define trim_trailing(s) trim2(s, TRIM_TRAILING) /* Removes leading whitespaces. */ #define trim_leading(s) trim2(s, TRIM_LEADING) char *trim2 (const char *, int) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; kbuild-3608/src/grep/lib/chdir-long.c0000664000175000017500000001526614670377423017421 0ustar locutuslocutus/* provide a chdir function that tries not to fail due to ENAMETOOLONG Copyright (C) 2004-2021 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 . */ /* written by Jim Meyering */ #include #include "chdir-long.h" #include #include #include #include #include #include #include "assure.h" #ifndef PATH_MAX # error "compile this file only if your system defines PATH_MAX" #endif /* The results of openat() in this file are not leaked to any single-threaded code that could use stdio. FIXME - if the kernel ever adds support for multi-thread safety for avoiding standard fds, then we should use openat_safer. */ struct cd_buf { int fd; }; static void cdb_init (struct cd_buf *cdb) { cdb->fd = AT_FDCWD; } static int cdb_fchdir (struct cd_buf const *cdb) { return fchdir (cdb->fd); } static void cdb_free (struct cd_buf const *cdb) { if (0 <= cdb->fd) { bool close_fail = close (cdb->fd); assure (! close_fail); } } /* Given a file descriptor of an open directory (or AT_FDCWD), CDB->fd, try to open the CDB->fd-relative directory, DIR. If the open succeeds, update CDB->fd with the resulting descriptor, close the incoming file descriptor, and return zero. Upon failure, return -1 and set errno. */ static int cdb_advance_fd (struct cd_buf *cdb, char const *dir) { int new_fd = openat (cdb->fd, dir, O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK); if (new_fd < 0) return -1; cdb_free (cdb); cdb->fd = new_fd; return 0; } /* Return a pointer to the first non-slash in S. */ static char * _GL_ATTRIBUTE_PURE find_non_slash (char const *s) { size_t n_slash = strspn (s, "/"); return (char *) s + n_slash; } /* This is a function much like chdir, but without the PATH_MAX limitation on the length of the directory name. A significant difference is that it must be able to modify (albeit only temporarily) the directory name. It handles an arbitrarily long directory name by operating on manageable portions of the name. On systems without the openat syscall, this means changing the working directory to more and more "distant" points along the long directory name and then restoring the working directory. If any of those attempts to save or restore the working directory fails, this function exits nonzero. Note that this function may still fail with errno == ENAMETOOLONG, but only if the specified directory name contains a component that is long enough to provoke such a failure all by itself (e.g. if the component has length PATH_MAX or greater on systems that define PATH_MAX). */ int chdir_long (char *dir) { int e = chdir (dir); if (e == 0 || errno != ENAMETOOLONG) return e; { size_t len = strlen (dir); char *dir_end = dir + len; struct cd_buf cdb; size_t n_leading_slash; cdb_init (&cdb); /* If DIR is the empty string, then the chdir above must have failed and set errno to ENOENT. */ assure (0 < len); assure (PATH_MAX <= len); /* Count leading slashes. */ n_leading_slash = strspn (dir, "/"); /* Handle any leading slashes as well as any name that matches the regular expression, m!^//hostname[/]*! . Handling this prefix separately usually results in a single additional cdb_advance_fd call, but it's worthwhile, since it makes the code in the following loop cleaner. */ if (n_leading_slash == 2) { int err; /* Find next slash. We already know that dir[2] is neither a slash nor '\0'. */ char *slash = memchr (dir + 3, '/', dir_end - (dir + 3)); if (slash == NULL) { errno = ENAMETOOLONG; return -1; } *slash = '\0'; err = cdb_advance_fd (&cdb, dir); *slash = '/'; if (err != 0) goto Fail; dir = find_non_slash (slash + 1); } else if (n_leading_slash) { if (cdb_advance_fd (&cdb, "/") != 0) goto Fail; dir += n_leading_slash; } assure (*dir != '/'); assure (dir <= dir_end); while (PATH_MAX <= dir_end - dir) { int err; /* Find a slash that is PATH_MAX or fewer bytes away from dir. I.e. see if there is a slash that will give us a name of length PATH_MAX-1 or less. */ char *slash = memrchr (dir, '/', PATH_MAX); if (slash == NULL) { errno = ENAMETOOLONG; return -1; } *slash = '\0'; assure (slash - dir < PATH_MAX); err = cdb_advance_fd (&cdb, dir); *slash = '/'; if (err != 0) goto Fail; dir = find_non_slash (slash + 1); } if (dir < dir_end) { if (cdb_advance_fd (&cdb, dir) != 0) goto Fail; } if (cdb_fchdir (&cdb) != 0) goto Fail; cdb_free (&cdb); return 0; Fail: { int saved_errno = errno; cdb_free (&cdb); errno = saved_errno; return -1; } } } #if TEST_CHDIR # include "closeout.h" # include "error.h" int main (int argc, char *argv[]) { char *line = NULL; size_t n = 0; int len; atexit (close_stdout); len = getline (&line, &n, stdin); if (len < 0) { int saved_errno = errno; if (feof (stdin)) exit (0); error (EXIT_FAILURE, saved_errno, "reading standard input"); } else if (len == 0) exit (0); if (line[len-1] == '\n') line[len-1] = '\0'; if (chdir_long (line) != 0) error (EXIT_FAILURE, errno, "chdir_long failed: %s", line); if (argc <= 1) { /* Using 'pwd' here makes sense only if it is a robust implementation, like the one in coreutils after the 2004-04-19 changes. */ char const *cmd = "pwd"; execlp (cmd, (char *) NULL); error (EXIT_FAILURE, errno, "%s", cmd); } fclose (stdin); fclose (stderr); exit (EXIT_SUCCESS); } #endif /* Local Variables: compile-command: "gcc -DTEST_CHDIR=1 -g -O -W -Wall chdir-long.c libcoreutils.a" End: */ kbuild-3608/src/grep/lib/safe-read.h0000664000175000017500000000345614670377426017230 0ustar locutuslocutus/* An interface to read() that retries after interrupts. Copyright (C) 2002, 2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Some system calls may be interrupted and fail with errno = EINTR in the following situations: - The process is stopped and restarted (signal SIGSTOP and SIGCONT, user types Ctrl-Z) on some platforms: Mac OS X. - The process receives a signal for which a signal handler was installed with sigaction() with an sa_flags field that does not contain SA_RESTART. - The process receives a signal for which a signal handler was installed with signal() and for which no call to siginterrupt(sig,0) was done, on some platforms: AIX, HP-UX, IRIX, OSF/1, Solaris. This module provides a wrapper around read() that handles EINTR. */ #include #ifdef __cplusplus extern "C" { #endif #define SAFE_READ_ERROR ((size_t) -1) /* Read up to COUNT bytes at BUF from descriptor FD, retrying if interrupted. Return the actual number of bytes read, zero for EOF, or SAFE_READ_ERROR upon error. */ extern size_t safe_read (int fd, void *buf, size_t count); #ifdef __cplusplus } #endif kbuild-3608/src/grep/lib/iconv_open-osf.h0000664000175000017500000002536514670377424020326 0ustar locutuslocutus/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -m 10 ./iconv_open-osf.gperf */ /* Computed positions: -k'4,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 17 "./iconv_open-osf.gperf" struct mapping { int standard_name; const char vendor_name[10 + 1]; }; #define TOTAL_KEYWORDS 38 #define MIN_WORD_LENGTH 4 #define MAX_WORD_LENGTH 11 #define MIN_HASH_VALUE 6 #define MAX_HASH_VALUE 47 /* maximum key range = 42, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int mapping_hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 2, 29, 24, 34, 31, 0, 15, 14, 10, 13, 2, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 7, 48, 48, 48, 48, 48, 48, 11, 48, 2, 7, 48, 48, 48, 1, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48 }; return len + asso_values[(unsigned char)str[3]+3] + asso_values[(unsigned char)str[len - 1]]; } struct stringpool_t { char stringpool_str6[sizeof("CP1255")]; char stringpool_str7[sizeof("CP775")]; char stringpool_str8[sizeof("CP1250")]; char stringpool_str9[sizeof("EUC-TW")]; char stringpool_str10[sizeof("EUC-KR")]; char stringpool_str11[sizeof("TIS-620")]; char stringpool_str12[sizeof("ISO-8859-5")]; char stringpool_str13[sizeof("ISO-8859-15")]; char stringpool_str14[sizeof("BIG5")]; char stringpool_str15[sizeof("CP855")]; char stringpool_str16[sizeof("CP1258")]; char stringpool_str17[sizeof("CP850")]; char stringpool_str18[sizeof("CP865")]; char stringpool_str19[sizeof("EUC-JP")]; char stringpool_str20[sizeof("CP1257")]; char stringpool_str21[sizeof("CP1256")]; char stringpool_str22[sizeof("ISO-8859-8")]; char stringpool_str23[sizeof("SHIFT_JIS")]; char stringpool_str25[sizeof("ISO-8859-9")]; char stringpool_str26[sizeof("ISO-8859-7")]; char stringpool_str27[sizeof("ISO-8859-6")]; char stringpool_str29[sizeof("CP857")]; char stringpool_str30[sizeof("CP1252")]; char stringpool_str31[sizeof("CP869")]; char stringpool_str32[sizeof("CP949")]; char stringpool_str33[sizeof("CP866")]; char stringpool_str34[sizeof("CP437")]; char stringpool_str35[sizeof("CP1251")]; char stringpool_str36[sizeof("ISO-8859-2")]; char stringpool_str37[sizeof("CP1254")]; char stringpool_str38[sizeof("CP874")]; char stringpool_str39[sizeof("CP852")]; char stringpool_str40[sizeof("CP1253")]; char stringpool_str41[sizeof("ISO-8859-1")]; char stringpool_str42[sizeof("CP862")]; char stringpool_str43[sizeof("ISO-8859-4")]; char stringpool_str46[sizeof("ISO-8859-3")]; char stringpool_str47[sizeof("CP861")]; }; static const struct stringpool_t stringpool_contents = { "CP1255", "CP775", "CP1250", "EUC-TW", "EUC-KR", "TIS-620", "ISO-8859-5", "ISO-8859-15", "BIG5", "CP855", "CP1258", "CP850", "CP865", "EUC-JP", "CP1257", "CP1256", "ISO-8859-8", "SHIFT_JIS", "ISO-8859-9", "ISO-8859-7", "ISO-8859-6", "CP857", "CP1252", "CP869", "CP949", "CP866", "CP437", "CP1251", "ISO-8859-2", "CP1254", "CP874", "CP852", "CP1253", "ISO-8859-1", "CP862", "ISO-8859-4", "ISO-8859-3", "CP861" }; #define stringpool ((const char *) &stringpool_contents) static const struct mapping mappings[] = { {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, #line 57 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "cp1255"}, #line 40 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, "cp775"}, #line 52 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, "cp1250"}, #line 63 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, "eucTW"}, #line 62 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "eucKR"}, #line 66 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "TACTIS"}, #line 33 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-5"}, #line 38 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-15"}, #line 64 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "big5"}, #line 43 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "cp855"}, #line 60 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "cp1258"}, #line 41 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "cp850"}, #line 47 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "cp865"}, #line 61 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "eucJP"}, #line 59 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, "cp1257"}, #line 58 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, "cp1256"}, #line 36 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, "ISO8859-8"}, #line 65 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, "SJIS"}, {-1}, #line 37 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25, "ISO8859-9"}, #line 35 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, "ISO8859-7"}, #line 34 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, "ISO8859-6"}, {-1}, #line 44 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, "cp857"}, #line 54 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, "cp1252"}, #line 49 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, "cp869"}, #line 51 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str32, "KSC5601"}, #line 48 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, "cp866"}, #line 39 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34, "cp437"}, #line 53 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, "cp1251"}, #line 30 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str36, "ISO8859-2"}, #line 56 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str37, "cp1254"}, #line 50 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, "cp874"}, #line 42 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str39, "cp852"}, #line 55 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str40, "cp1253"}, #line 29 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41, "ISO8859-1"}, #line 46 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str42, "cp862"}, #line 32 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str43, "ISO8859-4"}, {-1}, {-1}, #line 31 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str46, "ISO8859-3"}, #line 45 "./iconv_open-osf.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str47, "cp861"} }; const struct mapping * mapping_lookup (register const char *str, register size_t len) { if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = mapping_hash (str, len); if (key <= MAX_HASH_VALUE) { register int o = mappings[key].standard_name; if (o >= 0) { register const char *s = o + stringpool; if (*str == *s && !strcmp (str + 1, s + 1)) return &mappings[key]; } } } return 0; } kbuild-3608/src/grep/lib/fd-safer.c0000664000175000017500000000300314670377423017044 0ustar locutuslocutus/* Return a safer copy of a file descriptor. Copyright (C) 2005-2006, 2009-2021 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 . */ /* Written by Paul Eggert. */ #include #include "unistd-safer.h" #include #include /* Return FD, unless FD would be a copy of standard input, output, or error; in that case, return a duplicate of FD, closing FD. On failure to duplicate, close FD, set errno, and return -1. Preserve errno if FD is negative, so that the caller can always inspect errno when the returned value is negative. This function is usefully wrapped around functions that return file descriptors, e.g., fd_safer (open ("file", O_RDONLY)). */ int fd_safer (int fd) { if (STDIN_FILENO <= fd && fd <= STDERR_FILENO) { int f = dup_safer (fd); int e = errno; close (fd); errno = e; fd = f; } return fd; } kbuild-3608/src/grep/lib/getprogname-w32.c0000664000175000017500000000121514670377422020300 0ustar locutuslocutus/* Added by bird - Public Domain. */ #include #include static char g_szProgName[260] = {0}; const char *getprogname(void) { if (g_szProgName[0] == '\0') { char szName[260]; UINT const cchName = GetModuleFileNameA(NULL, szName, sizeof(szName)); UINT offName = cchName; while ( offName > 0 && szName[offName - 1] != '\\' && szName[offName - 1] != '/' && szName[offName - 1] != ':') offName--; memcpy(g_szProgName, &szName[offName], cchName - offName); } return g_szProgName; } kbuild-3608/src/grep/lib/error.c0000664000175000017500000002475114670377423016523 0ustar locutuslocutus/* Error handler for noninteractive utilities Copyright (C) 1990-1998, 2000-2007, 2009-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by David MacKenzie . */ #if !_LIBC # include #endif #include "error.h" #include #include #include #include #if !_LIBC && ENABLE_NLS # include "gettext.h" # define _(msgid) gettext (msgid) #endif #ifdef _LIBC # include # include # include # include # define mbsrtowcs __mbsrtowcs # define USE_UNLOCKED_IO 0 # define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(a, b) # define _GL_ARG_NONNULL(a) #else # include "getprogname.h" #endif #if USE_UNLOCKED_IO # include "unlocked-io.h" #endif #ifndef _ # define _(String) String #endif /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ void (*error_print_progname) (void); /* This variable is incremented each time 'error' is called. */ unsigned int error_message_count; #ifdef _LIBC /* In the GNU C library, there is a predefined variable for this. */ # define program_name program_invocation_name # include # include # include /* In GNU libc we want do not want to use the common name 'error' directly. Instead make it a weak alias. */ extern void __error (int status, int errnum, const char *message, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void __error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) __attribute__ ((__format__ (__printf__, 5, 6))); # define error __error # define error_at_line __error_at_line # include # define fflush(s) _IO_fflush (s) # undef putc # define putc(c, fp) _IO_putc (c, fp) # include #else /* not _LIBC */ # include # include # if defined _WIN32 && ! defined __CYGWIN__ /* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include # endif # endif /* The gnulib override of fcntl is not needed in this file. */ # undef fcntl # if !(GNULIB_STRERROR_R_POSIX || HAVE_DECL_STRERROR_R) # ifndef HAVE_DECL_STRERROR_R "this configure-time declaration test was not run" # endif # if STRERROR_R_CHAR_P char *strerror_r (int errnum, char *buf, size_t buflen); # else int strerror_r (int errnum, char *buf, size_t buflen); # endif # endif # define program_name getprogname () # if GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r # endif /* GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r */ #endif /* not _LIBC */ #if !_LIBC /* Return non-zero if FD is open. */ static int is_open (int fd) { # if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows: The initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE. There is no fcntl, and the gnulib replacement fcntl does not support F_GETFL. */ return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; # else # ifndef F_GETFL # error Please port fcntl to your platform # endif return 0 <= fcntl (fd, F_GETFL); # endif } #endif static void flush_stdout (void) { #if !_LIBC int stdout_fd; # if GNULIB_FREOPEN_SAFER /* Use of gnulib's freopen-safer module normally ensures that fileno (stdout) == 1 whenever stdout is open. */ stdout_fd = STDOUT_FILENO; # else /* POSIX states that fileno (stdout) after fclose is unspecified. But in practice it is not a problem, because stdout is statically allocated and the fd of a FILE stream is stored as a field in its allocated memory. */ stdout_fd = fileno (stdout); # endif /* POSIX states that fflush (stdout) after fclose is unspecified; it is safe in glibc, but not on all other platforms. fflush (NULL) is always defined, but too draconian. */ if (0 <= stdout_fd && is_open (stdout_fd)) #endif fflush (stdout); } static void print_errno_message (int errnum) { char const *s; #if _LIBC || GNULIB_STRERROR_R_POSIX || defined HAVE_STRERROR_R char errbuf[1024]; # if _LIBC || (!GNULIB_STRERROR_R_POSIX && STRERROR_R_CHAR_P) s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) s = errbuf; else s = 0; # endif #else s = strerror (errnum); #endif #if !_LIBC if (! s) s = _("Unknown system error"); #endif #if _LIBC __fxprintf (NULL, ": %s", s); #else fprintf (stderr, ": %s", s); #endif } static void _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) _GL_ARG_NONNULL ((3)) error_tail (int status, int errnum, const char *message, va_list args) { #if _LIBC if (_IO_fwide (stderr, 0) > 0) { size_t len = strlen (message) + 1; wchar_t *wmessage = NULL; mbstate_t st; size_t res; const char *tmp; bool use_malloc = false; while (1) { if (__libc_use_alloca (len * sizeof (wchar_t))) wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); else { if (!use_malloc) wmessage = NULL; wchar_t *p = (wchar_t *) realloc (wmessage, len * sizeof (wchar_t)); if (p == NULL) { free (wmessage); fputws_unlocked (L"out of memory\n", stderr); return; } wmessage = p; use_malloc = true; } memset (&st, '\0', sizeof (st)); tmp = message; res = mbsrtowcs (wmessage, &tmp, len, &st); if (res != len) break; if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0)) { /* This really should not happen if everything is fine. */ res = (size_t) -1; break; } len *= 2; } if (res == (size_t) -1) { /* The string cannot be converted. */ if (use_malloc) { free (wmessage); use_malloc = false; } wmessage = (wchar_t *) L"???"; } __vfwprintf (stderr, wmessage, args); if (use_malloc) free (wmessage); } else #endif vfprintf (stderr, message, args); ++error_message_count; if (errnum) print_errno_message (errnum); #if _LIBC __fxprintf (NULL, "\n"); #else putc ('\n', stderr); #endif fflush (stderr); if (status) exit (status); } /* Print the program name and error message MESSAGE, which is a printf-style format string with optional args. If ERRNUM is nonzero, print its corresponding system error message. Exit with status STATUS if it is nonzero. */ void error (int status, int errnum, const char *message, ...) { va_list args; #if defined _LIBC && defined __libc_ptf_call /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), 0); #endif flush_stdout (); #ifdef _LIBC _IO_flockfile (stderr); #endif if (error_print_progname) (*error_print_progname) (); else { #if _LIBC __fxprintf (NULL, "%s: ", program_name); #else fprintf (stderr, "%s: ", program_name); #endif } va_start (args, message); error_tail (status, errnum, message, args); va_end (args); #ifdef _LIBC _IO_funlockfile (stderr); # ifdef __libc_ptf_call __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); # endif #endif } /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ int error_one_per_line; void error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) { va_list args; if (error_one_per_line) { static const char *old_file_name; static unsigned int old_line_number; if (old_line_number == line_number && (file_name == old_file_name || (old_file_name != NULL && file_name != NULL && strcmp (old_file_name, file_name) == 0))) /* Simply return and print nothing. */ return; old_file_name = file_name; old_line_number = line_number; } #if defined _LIBC && defined __libc_ptf_call /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), 0); #endif flush_stdout (); #ifdef _LIBC _IO_flockfile (stderr); #endif if (error_print_progname) (*error_print_progname) (); else { #if _LIBC __fxprintf (NULL, "%s:", program_name); #else fprintf (stderr, "%s:", program_name); #endif } #if _LIBC __fxprintf (NULL, file_name != NULL ? "%s:%u: " : " ", file_name, line_number); #else fprintf (stderr, file_name != NULL ? "%s:%u: " : " ", file_name, line_number); #endif va_start (args, message); error_tail (status, errnum, message, args); va_end (args); #ifdef _LIBC _IO_funlockfile (stderr); # ifdef __libc_ptf_call __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); # endif #endif } #ifdef _LIBC /* Make the weak alias. */ # undef error # undef error_at_line weak_alias (__error, error) weak_alias (__error_at_line, error_at_line) #endif kbuild-3608/src/grep/lib/strnlen1.h0000664000175000017500000000233114670377426017136 0ustar locutuslocutus/* Find the length of STRING + 1, but scan at most MAXLEN bytes. Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _STRNLEN1_H #define _STRNLEN1_H #include #ifdef __cplusplus extern "C" { #endif /* Find the length of STRING + 1, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many characters, return MAXLEN. */ /* This is the same as strnlen (string, maxlen - 1) + 1. */ extern size_t strnlen1 (const char *string, size_t maxlen) _GL_ATTRIBUTE_PURE; #ifdef __cplusplus } #endif #endif /* _STRNLEN1_H */ kbuild-3608/src/grep/lib/openat-die.c0000664000175000017500000000350614670377425017414 0ustar locutuslocutus/* Report a save- or restore-cwd failure in our openat replacement and then exit. Copyright (C) 2005-2006, 2008-2021 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 . */ #include #include "openat.h" #include #ifndef GNULIB_LIBPOSIX # include "error.h" #endif #include "exitfail.h" #include "gettext.h" #define _(msgid) gettext (msgid) _Noreturn void openat_save_fail (int errnum) { #ifndef GNULIB_LIBPOSIX error (exit_failure, errnum, _("unable to record current working directory")); #endif /* _Noreturn cannot be applied to error, since it returns when its first argument is 0. To help compilers understand that this function does not return, call abort. Also, the abort is a safety feature if exit_failure is 0 (which shouldn't happen). */ abort (); } /* Exit with an error about failure to restore the working directory during an openat emulation. The caller must ensure that fd 2 is not a just-opened fd, even when openat_safer is not in use. */ _Noreturn void openat_restore_fail (int errnum) { #ifndef GNULIB_LIBPOSIX error (exit_failure, errnum, _("failed to return to initial working directory")); #endif /* As above. */ abort (); } kbuild-3608/src/grep/lib/msvc-nothrow.h0000664000175000017500000000302314670377425020034 0ustar locutuslocutus/* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _MSVC_NOTHROW_H #define _MSVC_NOTHROW_H /* With MSVC runtime libraries with the "invalid parameter handler" concept, functions like fprintf(), dup2(), or close() crash when the caller passes an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF) instead. This file defines wrappers that turn such an invalid parameter notification into an error code. */ #if defined _WIN32 && ! defined __CYGWIN__ /* Get original declaration of _get_osfhandle. */ # include # if HAVE_MSVC_INVALID_PARAMETER_HANDLER /* Override _get_osfhandle. */ extern intptr_t _gl_nothrow_get_osfhandle (int fd); # define _get_osfhandle _gl_nothrow_get_osfhandle # endif #endif #endif /* _MSVC_NOTHROW_H */ kbuild-3608/src/grep/lib/closeout.c0000664000175000017500000001141714670377423017222 0ustar locutuslocutus/* Close standard output and standard error, exiting with a diagnostic on error. Copyright (C) 1998-2002, 2004, 2006, 2008-2021 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 . */ #include #include "closeout.h" #include #include #include #include #include "gettext.h" #define _(msgid) gettext (msgid) #include "close-stream.h" #include "error.h" #include "exitfail.h" #include "quotearg.h" #ifndef __has_feature # define __has_feature(a) false #endif #if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer) enum { SANITIZE_ADDRESS = true }; #else enum { SANITIZE_ADDRESS = false }; #endif static const char *file_name; /* Set the file name to be reported in the event an error is detected by close_stdout. */ void close_stdout_set_file_name (const char *file) { file_name = file; } static bool ignore_EPIPE /* = false */; /* Specify the reaction to an EPIPE error during the closing of stdout: - If ignore = true, it shall be ignored. - If ignore = false, it shall evoke a diagnostic, along with a nonzero exit status. The default is ignore = false. This setting matters only if the SIGPIPE signal is ignored (i.e. its handler set to SIG_IGN) or blocked. Only particular programs need to temporarily ignore SIGPIPE. If SIGPIPE is ignored or blocked because it was ignored or blocked in the parent process when it created the child process, it usually is a bug in the parent process: It is bad practice to have SIGPIPE ignored or blocked while creating a child process. EPIPE occurs when writing to a pipe or socket that has no readers now, when SIGPIPE is ignored or blocked. The ignore = false setting is suitable for a scenario where it is normally guaranteed that the pipe writer terminates before the pipe reader. In this case, an EPIPE is an indication of a premature termination of the pipe reader and should lead to a diagnostic and a nonzero exit status. The ignore = true setting is suitable for a scenario where you don't know ahead of time whether the pipe writer or the pipe reader will terminate first. In this case, an EPIPE is an indication that the pipe writer can stop doing useless write() calls; this is what close_stdout does anyway. EPIPE is part of the normal pipe/socket shutdown protocol in this case, and should not lead to a diagnostic message. */ void close_stdout_set_ignore_EPIPE (bool ignore) { ignore_EPIPE = ignore; } /* Close standard output. On error, issue a diagnostic and _exit with status 'exit_failure'. Also close standard error. On error, _exit with status 'exit_failure'. Since close_stdout is commonly registered via 'atexit', POSIX and the C standard both say that it should not call 'exit', because the behavior is undefined if 'exit' is called more than once. So it calls '_exit' instead of 'exit'. If close_stdout is registered via atexit before other functions are registered, the other functions can act before this _exit is invoked. Applications that use close_stdout should flush any streams other than stdout and stderr before exiting, since the call to _exit will bypass other buffer flushing. Applications should be flushing and closing other streams anyway, to check for I/O errors. Also, applications should not use tmpfile, since _exit can bypass the removal of these files. It's important to detect such failures and exit nonzero because many tools (most notably 'make' and other build-management systems) depend on being able to detect failure in other tools via their exit status. */ void close_stdout (void) { if (close_stream (stdout) != 0 && !(ignore_EPIPE && errno == EPIPE)) { char const *write_error = _("write error"); if (file_name) error (0, errno, "%s: %s", quotearg_colon (file_name), write_error); else error (0, errno, "%s", write_error); _exit (exit_failure); } /* Close stderr only if not sanitizing, as sanitizers may report to stderr after this function returns. */ if (!SANITIZE_ADDRESS && close_stream (stderr) != 0) _exit (exit_failure); } kbuild-3608/src/grep/lib/stpcpy.c0000664000175000017500000000260514670377426016711 0ustar locutuslocutus/* stpcpy.c -- copy a string and return pointer to end of new string Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2021 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include #undef __stpcpy #ifdef _LIBC # undef stpcpy #endif #ifndef weak_alias # define __stpcpy stpcpy #endif /* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */ char * __stpcpy (char *dest, const char *src) { register char *d = dest; register const char *s = src; do *d++ = *s; while (*s++ != '\0'); return d - 1; } #ifdef weak_alias weak_alias (__stpcpy, stpcpy) #endif kbuild-3608/src/grep/lib/mbtowc-lock.c0000664000175000017500000001044614670377425017611 0ustar locutuslocutus/* Return the internal lock used by mbrtowc and mbrtoc32. Copyright (C) 2019-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2019-2020. */ #include /* When it is known that the gl_get_mbtowc_lock function is defined by a dependency library, it should not be defined here. */ #if OMIT_MBTOWC_LOCK /* This declaration is solely to ensure that after preprocessing this file is never empty. */ typedef int dummy; #else /* This file defines the internal lock used by mbrtowc and mbrtoc32. It is a separate compilation unit, so that only one copy of it is present when linking statically. */ /* Prohibit renaming this symbol. */ # undef gl_get_mbtowc_lock /* Macro for exporting a symbol (function, not variable) defined in this file, when compiled into a shared library. */ # ifndef DLL_EXPORTED # if HAVE_VISIBILITY /* Override the effect of the compiler option '-fvisibility=hidden'. */ # define DLL_EXPORTED __attribute__((__visibility__("default"))) # elif defined _WIN32 || defined __CYGWIN__ # define DLL_EXPORTED __declspec(dllexport) # else # define DLL_EXPORTED # endif # endif # if defined _WIN32 && !defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # include "windows-initguard.h" /* The return type is a 'CRITICAL_SECTION *', not a 'glwthread_mutex_t *', because the latter is not guaranteed to be a stable ABI in the future. */ /* Make sure the function gets exported from DLLs. */ DLL_EXPORTED CRITICAL_SECTION *gl_get_mbtowc_lock (void); static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT; static CRITICAL_SECTION lock; /* Returns the internal lock used by mbrtowc and mbrtoc32. */ CRITICAL_SECTION * gl_get_mbtowc_lock (void) { if (!guard.done) { if (InterlockedIncrement (&guard.started) == 0) { /* This thread is the first one to need the lock. Initialize it. */ InitializeCriticalSection (&lock); guard.done = 1; } else { /* Don't let guard.started grow and wrap around. */ InterlockedDecrement (&guard.started); /* Yield the CPU while waiting for another thread to finish initializing this mutex. */ while (!guard.done) Sleep (0); } } return &lock; } # elif HAVE_PTHREAD_API # include static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Make sure the function gets exported from shared libraries. */ DLL_EXPORTED pthread_mutex_t *gl_get_mbtowc_lock (void); /* Returns the internal lock used by mbrtowc and mbrtoc32. */ pthread_mutex_t * gl_get_mbtowc_lock (void) { return &mutex; } # elif HAVE_THREADS_H # include # include static int volatile init_needed = 1; static once_flag init_once = ONCE_FLAG_INIT; static mtx_t mutex; static void atomic_init (void) { if (mtx_init (&mutex, mtx_plain) != thrd_success) abort (); init_needed = 0; } /* Make sure the function gets exported from shared libraries. */ DLL_EXPORTED mtx_t *gl_get_mbtowc_lock (void); /* Returns the internal lock used by mbrtowc and mbrtoc32. */ mtx_t * gl_get_mbtowc_lock (void) { if (init_needed) call_once (&init_once, atomic_init); return &mutex; } # endif # if (defined _WIN32 || defined __CYGWIN__) && !defined _MSC_VER /* Make sure the '__declspec(dllimport)' in mbrtowc.c and mbrtoc32.c does not cause a link failure when no DLLs are involved. */ # if defined _WIN64 || defined _LP64 # define IMP(x) __imp_##x # else # define IMP(x) _imp__##x # endif void * IMP(gl_get_mbtowc_lock) = &gl_get_mbtowc_lock; # endif #endif kbuild-3608/src/grep/lib/version-etc.c0000664000175000017500000002230514670377426017624 0ustar locutuslocutus/* Print --version and bug-reporting information in a consistent format. Copyright (C) 1999-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Jim Meyering. */ #include /* Specification. */ #include "version-etc.h" #include #include #if USE_UNLOCKED_IO # include "unlocked-io.h" #endif #include "gettext.h" #define _(msgid) gettext (msgid) /* If you use AM_INIT_AUTOMAKE's no-define option, PACKAGE is not defined. Use PACKAGE_TARNAME instead. */ #if ! defined PACKAGE && defined PACKAGE_TARNAME # define PACKAGE PACKAGE_TARNAME #endif enum { COPYRIGHT_YEAR = 2021 }; /* The three functions below display the --version information the standard way. If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of the program. The formats are therefore: PACKAGE VERSION or COMMAND_NAME (PACKAGE) VERSION. The functions differ in the way they are passed author names. */ /* Display the --version information the standard way. Author names are given in the array AUTHORS. N_AUTHORS is the number of elements in the array. */ void version_etc_arn (FILE *stream, const char *command_name, const char *package, const char *version, const char * const * authors, size_t n_authors) { if (command_name) fprintf (stream, "%s (%s) %s\n", command_name, package, version); else fprintf (stream, "%s %s\n", package, version); #ifdef PACKAGE_PACKAGER # ifdef PACKAGE_PACKAGER_VERSION fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER, PACKAGE_PACKAGER_VERSION); # else fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER); # endif #endif /* TRANSLATORS: Translate "(C)" to the copyright symbol (C-in-a-circle), if this symbol is available in the user's locale. Otherwise, do not translate "(C)"; leave it as-is. */ fprintf (stream, version_etc_copyright, _("(C)"), COPYRIGHT_YEAR); fputs ("\n", stream); /* TRANSLATORS: The %s placeholder is the web address of the GPL license. */ fprintf (stream, _("\ License GPLv3+: GNU GPL version 3 or later <%s>.\n\ This is free software: you are free to change and redistribute it.\n\ There is NO WARRANTY, to the extent permitted by law.\n\ "), "https://gnu.org/licenses/gpl.html"); fputs ("\n", stream); switch (n_authors) { case 0: /* No authors are given. The caller should output authorship info after calling this function. */ break; case 1: /* TRANSLATORS: %s denotes an author name. */ fprintf (stream, _("Written by %s.\n"), authors[0]); break; case 2: /* TRANSLATORS: Each %s denotes an author name. */ fprintf (stream, _("Written by %s and %s.\n"), authors[0], authors[1]); break; case 3: /* TRANSLATORS: Each %s denotes an author name. */ fprintf (stream, _("Written by %s, %s, and %s.\n"), authors[0], authors[1], authors[2]); break; case 4: /* TRANSLATORS: Each %s denotes an author name. You can use line breaks, estimating that each author name occupies ca. 16 screen columns and that a screen line has ca. 80 columns. */ fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"), authors[0], authors[1], authors[2], authors[3]); break; case 5: /* TRANSLATORS: Each %s denotes an author name. You can use line breaks, estimating that each author name occupies ca. 16 screen columns and that a screen line has ca. 80 columns. */ fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"), authors[0], authors[1], authors[2], authors[3], authors[4]); break; case 6: /* TRANSLATORS: Each %s denotes an author name. You can use line breaks, estimating that each author name occupies ca. 16 screen columns and that a screen line has ca. 80 columns. */ fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"), authors[0], authors[1], authors[2], authors[3], authors[4], authors[5]); break; case 7: /* TRANSLATORS: Each %s denotes an author name. You can use line breaks, estimating that each author name occupies ca. 16 screen columns and that a screen line has ca. 80 columns. */ fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"), authors[0], authors[1], authors[2], authors[3], authors[4], authors[5], authors[6]); break; case 8: /* TRANSLATORS: Each %s denotes an author name. You can use line breaks, estimating that each author name occupies ca. 16 screen columns and that a screen line has ca. 80 columns. */ fprintf (stream, _("\ Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"), authors[0], authors[1], authors[2], authors[3], authors[4], authors[5], authors[6], authors[7]); break; case 9: /* TRANSLATORS: Each %s denotes an author name. You can use line breaks, estimating that each author name occupies ca. 16 screen columns and that a screen line has ca. 80 columns. */ fprintf (stream, _("\ Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"), authors[0], authors[1], authors[2], authors[3], authors[4], authors[5], authors[6], authors[7], authors[8]); break; default: /* 10 or more authors. Use an abbreviation, since the human reader will probably not want to read the entire list anyway. */ /* TRANSLATORS: Each %s denotes an author name. You can use line breaks, estimating that each author name occupies ca. 16 screen columns and that a screen line has ca. 80 columns. */ fprintf (stream, _("\ Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"), authors[0], authors[1], authors[2], authors[3], authors[4], authors[5], authors[6], authors[7], authors[8]); break; } } /* Display the --version information the standard way. See the initial comment to this module, for more information. Author names are given in the NULL-terminated array AUTHORS. */ void version_etc_ar (FILE *stream, const char *command_name, const char *package, const char *version, const char * const * authors) { size_t n_authors; for (n_authors = 0; authors[n_authors]; n_authors++) ; version_etc_arn (stream, command_name, package, version, authors, n_authors); } /* Display the --version information the standard way. See the initial comment to this module, for more information. Author names are given in the NULL-terminated va_list AUTHORS. */ void version_etc_va (FILE *stream, const char *command_name, const char *package, const char *version, va_list authors) { size_t n_authors; const char *authtab[10]; for (n_authors = 0; n_authors < 10 && (authtab[n_authors] = va_arg (authors, const char *)) != NULL; n_authors++) ; version_etc_arn (stream, command_name, package, version, authtab, n_authors); } /* Display the --version information the standard way. If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of the program. The formats are therefore: PACKAGE VERSION or COMMAND_NAME (PACKAGE) VERSION. The authors names are passed as separate arguments, with an additional NULL argument at the end. */ void version_etc (FILE *stream, const char *command_name, const char *package, const char *version, /* const char *author1, ...*/ ...) { va_list authors; va_start (authors, version); version_etc_va (stream, command_name, package, version, authors); va_end (authors); } void emit_bug_reporting_address (void) { fputs ("\n", stdout); /* TRANSLATORS: The placeholder indicates the bug-reporting address for this package. Please add _another line_ saying "Report translation bugs to <...>\n" with the address for translation bugs (typically your translation team's web or email address). */ printf (_("Report bugs to: %s\n"), PACKAGE_BUGREPORT); #ifdef PACKAGE_PACKAGER_BUG_REPORTS printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER, PACKAGE_PACKAGER_BUG_REPORTS); #endif #ifdef PACKAGE_URL printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL); #else printf (_("%s home page: <%s>\n"), PACKAGE_NAME, "https://www.gnu.org/software/" PACKAGE "/"); #endif printf (_("General help using GNU software: <%s>\n"), "https://www.gnu.org/gethelp/"); } kbuild-3608/src/grep/lib/chdir-long.h0000664000175000017500000000207014670377423017413 0ustar locutuslocutus/* provide a chdir function that tries not to fail due to ENAMETOOLONG Copyright (C) 2004-2005, 2009-2021 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 . */ /* Written by Jim Meyering. */ #include #include #include "pathmax.h" /* On systems without PATH_MAX, presume that chdir accepts arbitrarily long directory names. */ #ifndef PATH_MAX # define chdir_long(Dir) chdir (Dir) #else int chdir_long (char *dir); #endif kbuild-3608/src/grep/lib/iconv_open-solaris.gperf0000664000175000017500000000314014670377423022051 0ustar locutuslocutus/* Character set conversion. Copyright (C) 2007, 2009, 2020-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ struct mapping { int standard_name; const char vendor_name[10 + 1]; }; %struct-type %language=ANSI-C %define slot-name standard_name %define hash-function-name mapping_hash %define lookup-function-name mapping_lookup %readonly-tables %global-table %define word-array-name mappings %pic %% # On Solaris 10, look in the "iconv -l" output. Some aliases are advertised but # not actually supported by the iconv() function and by the 'iconv' program. # For example: # $ echo abc | iconv -f 646 -t ISO-8859-1 # Not supported 646 to ISO-8859-1 # $ echo abc | iconv -f 646 -t ISO8859-1 $ abc ASCII, "646" ISO-8859-1, "ISO8859-1" ISO-8859-2, "ISO8859-2" ISO-8859-3, "ISO8859-3" ISO-8859-4, "ISO8859-4" ISO-8859-5, "ISO8859-5" ISO-8859-6, "ISO8859-6" ISO-8859-7, "ISO8859-7" ISO-8859-8, "ISO8859-8" ISO-8859-9, "ISO8859-9" ISO-8859-15, "ISO8859-15" CP1251, "ansi-1251" kbuild-3608/src/grep/lib/xstrtol.c0000664000175000017500000001403714670377426017110 0ustar locutuslocutus/* A more useful interface to strtol. Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2021 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 . */ /* Written by Jim Meyering. */ #ifndef __strtol # define __strtol strtol # define __strtol_t long int # define __xstrtol xstrtol # define STRTOL_T_MINIMUM LONG_MIN # define STRTOL_T_MAXIMUM LONG_MAX #endif #include #include "xstrtol.h" /* Some pre-ANSI implementations (e.g. SunOS 4) need stderr defined if assertion checking is enabled. */ #include #include #include #include #include #include #include "assure.h" #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) static strtol_error bkm_scale (__strtol_t *x, int scale_factor) { if (TYPE_SIGNED (__strtol_t) && *x < STRTOL_T_MINIMUM / scale_factor) { *x = STRTOL_T_MINIMUM; return LONGINT_OVERFLOW; } if (STRTOL_T_MAXIMUM / scale_factor < *x) { *x = STRTOL_T_MAXIMUM; return LONGINT_OVERFLOW; } *x *= scale_factor; return LONGINT_OK; } static strtol_error bkm_scale_by_power (__strtol_t *x, int base, int power) { strtol_error err = LONGINT_OK; while (power--) err |= bkm_scale (x, base); return err; } /* FIXME: comment. */ strtol_error __xstrtol (const char *s, char **ptr, int strtol_base, __strtol_t *val, const char *valid_suffixes) { char *t_ptr; char **p; __strtol_t tmp; strtol_error err = LONGINT_OK; assure (0 <= strtol_base && strtol_base <= 36); p = (ptr ? ptr : &t_ptr); errno = 0; if (! TYPE_SIGNED (__strtol_t)) { const char *q = s; unsigned char ch = *q; while (isspace (ch)) ch = *++q; if (ch == '-') return LONGINT_INVALID; } tmp = __strtol (s, p, strtol_base); if (*p == s) { /* If there is no number but there is a valid suffix, assume the number is 1. The string is invalid otherwise. */ if (valid_suffixes && **p && strchr (valid_suffixes, **p)) tmp = 1; else return LONGINT_INVALID; } else if (errno != 0) { if (errno != ERANGE) return LONGINT_INVALID; err = LONGINT_OVERFLOW; } /* Let valid_suffixes == NULL mean "allow any suffix". */ /* FIXME: update all callers except the ones that allow suffixes after the number, changing last parameter NULL to "". */ if (!valid_suffixes) { *val = tmp; return err; } if (**p != '\0') { int base = 1024; int suffixes = 1; strtol_error overflow; if (!strchr (valid_suffixes, **p)) { *val = tmp; return err | LONGINT_INVALID_SUFFIX_CHAR; } switch (**p) { case 'E': case 'G': case 'g': case 'k': case 'K': case 'M': case 'm': case 'P': case 'T': case 't': case 'Y': case 'Z': /* The "valid suffix" '0' is a special flag meaning that an optional second suffix is allowed, which can change the base. A suffix "B" (e.g. "100MB") stands for a power of 1000, whereas a suffix "iB" (e.g. "100MiB") stands for a power of 1024. If no suffix (e.g. "100M"), assume power-of-1024. */ if (strchr (valid_suffixes, '0')) switch (p[0][1]) { case 'i': if (p[0][2] == 'B') suffixes += 2; break; case 'B': case 'D': /* 'D' is obsolescent */ base = 1000; suffixes++; break; } } switch (**p) { case 'b': overflow = bkm_scale (&tmp, 512); break; case 'B': /* This obsolescent first suffix is distinct from the 'B' second suffix above. E.g., 'tar -L 1000B' means change the tape after writing 1000 KiB of data. */ overflow = bkm_scale (&tmp, 1024); break; case 'c': overflow = LONGINT_OK; break; case 'E': /* exa or exbi */ overflow = bkm_scale_by_power (&tmp, base, 6); break; case 'G': /* giga or gibi */ case 'g': /* 'g' is undocumented; for compatibility only */ overflow = bkm_scale_by_power (&tmp, base, 3); break; case 'k': /* kilo */ case 'K': /* kibi */ overflow = bkm_scale_by_power (&tmp, base, 1); break; case 'M': /* mega or mebi */ case 'm': /* 'm' is undocumented; for compatibility only */ overflow = bkm_scale_by_power (&tmp, base, 2); break; case 'P': /* peta or pebi */ overflow = bkm_scale_by_power (&tmp, base, 5); break; case 'T': /* tera or tebi */ case 't': /* 't' is undocumented; for compatibility only */ overflow = bkm_scale_by_power (&tmp, base, 4); break; case 'w': overflow = bkm_scale (&tmp, 2); break; case 'Y': /* yotta or 2**80 */ overflow = bkm_scale_by_power (&tmp, base, 8); break; case 'Z': /* zetta or 2**70 */ overflow = bkm_scale_by_power (&tmp, base, 7); break; default: *val = tmp; return err | LONGINT_INVALID_SUFFIX_CHAR; } err |= overflow; *p += suffixes; if (**p) err |= LONGINT_INVALID_SUFFIX_CHAR; } *val = tmp; return err; } kbuild-3608/src/grep/lib/isblank.c0000664000175000017500000000251014670377424017003 0ustar locutuslocutus/* Test whether a character is a blank. Copyright (C) 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include int isblank (int c) { /* On all known platforms, in all predefined locales, isblank(c) is likely equivalent with (c == ' ' || c == '\t'). Look at the glibc definition (in glibc/localedata/locales/i18n): The "blank" characters are '\t', ' ', U+1680, U+180E, U+2000..U+2006, U+2008..U+200A, U+205F, U+3000, and none except the first two is present in a common 8-bit encoding. Therefore the substitute for other platforms is not more complicated than this. */ return (c == ' ' || c == '\t'); } kbuild-3608/src/grep/lib/str-kmp.h0000664000175000017500000001333114670377426016767 0ustar locutuslocutus/* Substring search in a NUL terminated string of UNIT elements, using the Knuth-Morris-Pratt algorithm. Copyright (C) 2005-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2005. This file is free software. It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+". You can redistribute it and/or modify it under either - the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version, or - the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+". 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 Lesser General Public License and the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License and of the GNU General Public License along with this program. If not, see . */ /* Before including this file, you need to define: UNIT The element type of the needle and haystack. CANON_ELEMENT(c) A macro that canonicalizes an element right after it has been fetched from needle or haystack. The argument is of type UNIT; the result must be of type UNIT as well. */ /* Knuth-Morris-Pratt algorithm. See https://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm HAYSTACK is the NUL terminated string in which to search for. NEEDLE is the string to search for in HAYSTACK, consisting of NEEDLE_LEN units. Return a boolean indicating success: Return true and set *RESULTP if the search was completed. Return false if it was aborted because not enough memory was available. */ static bool knuth_morris_pratt (const UNIT *haystack, const UNIT *needle, size_t needle_len, const UNIT **resultp) { size_t m = needle_len; /* Allocate the table. */ size_t *table = (size_t *) nmalloca (m, sizeof (size_t)); if (table == NULL) return false; /* Fill the table. For 0 < i < m: 0 < table[i] <= i is defined such that forall 0 < x < table[i]: needle[x..i-1] != needle[0..i-1-x], and table[i] is as large as possible with this property. This implies: 1) For 0 < i < m: If table[i] < i, needle[table[i]..i-1] = needle[0..i-1-table[i]]. 2) For 0 < i < m: rhaystack[0..i-1] == needle[0..i-1] and exists h, i <= h < m: rhaystack[h] != needle[h] implies forall 0 <= x < table[i]: rhaystack[x..x+m-1] != needle[0..m-1]. table[0] remains uninitialized. */ { size_t i, j; /* i = 1: Nothing to verify for x = 0. */ table[1] = 1; j = 0; for (i = 2; i < m; i++) { /* Here: j = i-1 - table[i-1]. The inequality needle[x..i-1] != needle[0..i-1-x] is known to hold for x < table[i-1], by induction. Furthermore, if j>0: needle[i-1-j..i-2] = needle[0..j-1]. */ UNIT b = CANON_ELEMENT (needle[i - 1]); for (;;) { /* Invariants: The inequality needle[x..i-1] != needle[0..i-1-x] is known to hold for x < i-1-j. Furthermore, if j>0: needle[i-1-j..i-2] = needle[0..j-1]. */ if (b == CANON_ELEMENT (needle[j])) { /* Set table[i] := i-1-j. */ table[i] = i - ++j; break; } /* The inequality needle[x..i-1] != needle[0..i-1-x] also holds for x = i-1-j, because needle[i-1] != needle[j] = needle[i-1-x]. */ if (j == 0) { /* The inequality holds for all possible x. */ table[i] = i; break; } /* The inequality needle[x..i-1] != needle[0..i-1-x] also holds for i-1-j < x < i-1-j+table[j], because for these x: needle[x..i-2] = needle[x-(i-1-j)..j-1] != needle[0..j-1-(x-(i-1-j))] (by definition of table[j]) = needle[0..i-2-x], hence needle[x..i-1] != needle[0..i-1-x]. Furthermore needle[i-1-j+table[j]..i-2] = needle[table[j]..j-1] = needle[0..j-1-table[j]] (by definition of table[j]). */ j = j - table[j]; } /* Here: j = i - table[i]. */ } } /* Search, using the table to accelerate the processing. */ { size_t j; const UNIT *rhaystack; const UNIT *phaystack; *resultp = NULL; j = 0; rhaystack = haystack; phaystack = haystack; /* Invariant: phaystack = rhaystack + j. */ while (*phaystack != 0) if (CANON_ELEMENT (needle[j]) == CANON_ELEMENT (*phaystack)) { j++; phaystack++; if (j == m) { /* The entire needle has been found. */ *resultp = rhaystack; break; } } else if (j > 0) { /* Found a match of needle[0..j-1], mismatch at needle[j]. */ rhaystack += table[j]; j -= table[j]; } else { /* Found a mismatch at needle[0] already. */ rhaystack++; phaystack++; } } freea (table); return true; } #undef CANON_ELEMENT kbuild-3608/src/grep/lib/getopt-cdefs.in.h0000664000175000017500000000404614670377423020363 0ustar locutuslocutus/* getopt-on-non-glibc compatibility macros. Copyright (C) 1989-2021 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _GETOPT_CDEFS_H #define _GETOPT_CDEFS_H 1 /* This header should not be used directly; include getopt.h or unistd.h instead. It does not have a protective #error, because the guard macro for getopt.h in gnulib is not fixed. */ /* getopt-core.h and getopt-ext.h are shared with GNU libc, and expect a number of the internal macros supplied to GNU libc's headers by sys/cdefs.h. Provide fallback definitions for all of them. */ #if @HAVE_SYS_CDEFS_H@ # include #endif #ifndef __BEGIN_DECLS # ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # else # define __BEGIN_DECLS /* nothing */ # endif #endif #ifndef __END_DECLS # ifdef __cplusplus # define __END_DECLS } # else # define __END_DECLS /* nothing */ # endif #endif #ifndef __GNUC_PREREQ # if defined __GNUC__ && defined __GNUC_VERSION__ # define __GNUC_PREREQ(maj, min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) # else # define __GNUC_PREREQ(maj, min) 0 # endif #endif #ifndef __THROW # if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4) # define __THROW throw () # else # define __THROW # endif #endif #endif /* _GETOPT_CDEFS_H */ kbuild-3608/src/grep/lib/iconv_open.c0000664000175000017500000001301414670377424017520 0ustar locutuslocutus/* Character set conversion. Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include #include "c-ctype.h" #include "c-strcase.h" #define SIZEOF(a) (sizeof(a) / sizeof(a[0])) /* Namespace cleanliness. */ #define mapping_lookup rpl_iconv_open_mapping_lookup /* The macro ICONV_FLAVOR is defined to one of these or undefined. */ #define ICONV_FLAVOR_AIX "iconv_open-aix.h" #define ICONV_FLAVOR_HPUX "iconv_open-hpux.h" #define ICONV_FLAVOR_IRIX "iconv_open-irix.h" #define ICONV_FLAVOR_OSF "iconv_open-osf.h" #define ICONV_FLAVOR_SOLARIS "iconv_open-solaris.h" #define ICONV_FLAVOR_ZOS "iconv_open-zos.h" #ifdef ICONV_FLAVOR # include ICONV_FLAVOR #endif iconv_t rpl_iconv_open (const char *tocode, const char *fromcode) #undef iconv_open { char fromcode_upper[32]; char tocode_upper[32]; char *fromcode_upper_end; char *tocode_upper_end; #if REPLACE_ICONV_UTF /* Special handling of conversion between UTF-8 and UTF-{16,32}{BE,LE}. Do this here, before calling the real iconv_open(), because OSF/1 5.1 iconv() to these encoding inserts a BOM, which is wrong. We do not need to handle conversion between arbitrary encodings and UTF-{16,32}{BE,LE}, because the 'striconveh' module implements two-step conversion through UTF-8. The _ICONV_* constants are chosen to be disjoint from any iconv_t returned by the system's iconv_open() functions. Recall that iconv_t is a scalar type. */ if (c_toupper (fromcode[0]) == 'U' && c_toupper (fromcode[1]) == 'T' && c_toupper (fromcode[2]) == 'F' && fromcode[3] == '-') { if (c_toupper (tocode[0]) == 'U' && c_toupper (tocode[1]) == 'T' && c_toupper (tocode[2]) == 'F' && tocode[3] == '-') { if (strcmp (fromcode + 4, "8") == 0) { if (c_strcasecmp (tocode + 4, "16BE") == 0) return _ICONV_UTF8_UTF16BE; if (c_strcasecmp (tocode + 4, "16LE") == 0) return _ICONV_UTF8_UTF16LE; if (c_strcasecmp (tocode + 4, "32BE") == 0) return _ICONV_UTF8_UTF32BE; if (c_strcasecmp (tocode + 4, "32LE") == 0) return _ICONV_UTF8_UTF32LE; } else if (strcmp (tocode + 4, "8") == 0) { if (c_strcasecmp (fromcode + 4, "16BE") == 0) return _ICONV_UTF16BE_UTF8; if (c_strcasecmp (fromcode + 4, "16LE") == 0) return _ICONV_UTF16LE_UTF8; if (c_strcasecmp (fromcode + 4, "32BE") == 0) return _ICONV_UTF32BE_UTF8; if (c_strcasecmp (fromcode + 4, "32LE") == 0) return _ICONV_UTF32LE_UTF8; } } } #endif /* Do *not* add special support for 8-bit encodings like ASCII or ISO-8859-1 here. This would lead to programs that work in some locales (such as the "C" or "en_US" locales) but do not work in East Asian locales. It is better if programmers make their programs depend on GNU libiconv (except on glibc systems), e.g. by using the AM_ICONV macro and documenting the dependency in an INSTALL or DEPENDENCIES file. */ /* Try with the original names first. This covers the case when fromcode or tocode is a lowercase encoding name that is understood by the system's iconv_open but not listed in our mappings table. */ { iconv_t cd = iconv_open (tocode, fromcode); if (cd != (iconv_t)(-1)) return cd; } /* Convert the encodings to upper case, because 1. in the arguments of iconv_open() on AIX, HP-UX, and OSF/1 the case matters, 2. it makes searching in the table faster. */ { const char *p = fromcode; char *q = fromcode_upper; while ((*q = c_toupper (*p)) != '\0') { p++; q++; if (q == &fromcode_upper[SIZEOF (fromcode_upper)]) { errno = EINVAL; return (iconv_t)(-1); } } fromcode_upper_end = q; } { const char *p = tocode; char *q = tocode_upper; while ((*q = c_toupper (*p)) != '\0') { p++; q++; if (q == &tocode_upper[SIZEOF (tocode_upper)]) { errno = EINVAL; return (iconv_t)(-1); } } tocode_upper_end = q; } #ifdef ICONV_FLAVOR /* Apply the mappings. */ { const struct mapping *m = mapping_lookup (fromcode_upper, fromcode_upper_end - fromcode_upper); fromcode = (m != NULL ? m->vendor_name : fromcode_upper); } { const struct mapping *m = mapping_lookup (tocode_upper, tocode_upper_end - tocode_upper); tocode = (m != NULL ? m->vendor_name : tocode_upper); } #else fromcode = fromcode_upper; tocode = tocode_upper; #endif return iconv_open (tocode, fromcode); } kbuild-3608/src/grep/lib/glthread/0000775000175000017500000000000014670377423017007 5ustar locutuslocutuskbuild-3608/src/grep/lib/glthread/lock.c0000664000175000017500000004421114670377423020105 0ustar locutuslocutus/* Locking in multithreaded situations. Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-posix.h, gthr-posix95.h. */ #include #include "glthread/lock.h" /* ========================================================================= */ #if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS /* -------------------------- gl_lock_t datatype -------------------------- */ int glthread_lock_init (gl_lock_t *lock) { if (mtx_init (&lock->mutex, mtx_plain) != thrd_success) return ENOMEM; lock->init_needed = 0; return 0; } int glthread_lock_lock (gl_lock_t *lock) { if (lock->init_needed) call_once (&lock->init_once, lock->init_func); if (mtx_lock (&lock->mutex) != thrd_success) return EAGAIN; return 0; } int glthread_lock_unlock (gl_lock_t *lock) { if (lock->init_needed) call_once (&lock->init_once, lock->init_func); if (mtx_unlock (&lock->mutex) != thrd_success) return EINVAL; return 0; } int glthread_lock_destroy (gl_lock_t *lock) { if (lock->init_needed) call_once (&lock->init_once, lock->init_func); mtx_destroy (&lock->mutex); return 0; } /* ------------------------- gl_rwlock_t datatype ------------------------- */ int glthread_rwlock_init (gl_rwlock_t *lock) { if (mtx_init (&lock->lock, mtx_plain) != thrd_success || cnd_init (&lock->waiting_readers) != thrd_success || cnd_init (&lock->waiting_writers) != thrd_success) return ENOMEM; lock->waiting_writers_count = 0; lock->runcount = 0; lock->init_needed = 0; return 0; } int glthread_rwlock_rdlock (gl_rwlock_t *lock) { if (lock->init_needed) call_once (&lock->init_once, lock->init_func); if (mtx_lock (&lock->lock) != thrd_success) return EAGAIN; /* Test whether only readers are currently running, and whether the runcount field will not overflow, and whether no writer is waiting. The latter condition is because POSIX recommends that "write locks shall take precedence over read locks", to avoid "writer starvation". */ while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_readers. */ if (cnd_wait (&lock->waiting_readers, &lock->lock) != thrd_success) { mtx_unlock (&lock->lock); return EINVAL; } } lock->runcount++; if (mtx_unlock (&lock->lock) != thrd_success) return EINVAL; return 0; } int glthread_rwlock_wrlock (gl_rwlock_t *lock) { if (lock->init_needed) call_once (&lock->init_once, lock->init_func); if (mtx_lock (&lock->lock) != thrd_success) return EAGAIN; /* Test whether no readers or writers are currently running. */ while (!(lock->runcount == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_writers. */ lock->waiting_writers_count++; if (cnd_wait (&lock->waiting_writers, &lock->lock) != thrd_success) { lock->waiting_writers_count--; mtx_unlock (&lock->lock); return EINVAL; } lock->waiting_writers_count--; } lock->runcount--; /* runcount becomes -1 */ if (mtx_unlock (&lock->lock) != thrd_success) return EINVAL; return 0; } int glthread_rwlock_unlock (gl_rwlock_t *lock) { if (lock->init_needed) call_once (&lock->init_once, lock->init_func); if (mtx_lock (&lock->lock) != thrd_success) return EAGAIN; if (lock->runcount < 0) { /* Drop a writer lock. */ if (!(lock->runcount == -1)) { mtx_unlock (&lock->lock); return EINVAL; } lock->runcount = 0; } else { /* Drop a reader lock. */ if (!(lock->runcount > 0)) { mtx_unlock (&lock->lock); return EINVAL; } lock->runcount--; } if (lock->runcount == 0) { /* POSIX recommends that "write locks shall take precedence over read locks", to avoid "writer starvation". */ if (lock->waiting_writers_count > 0) { /* Wake up one of the waiting writers. */ if (cnd_signal (&lock->waiting_writers) != thrd_success) { mtx_unlock (&lock->lock); return EINVAL; } } else { /* Wake up all waiting readers. */ if (cnd_broadcast (&lock->waiting_readers) != thrd_success) { mtx_unlock (&lock->lock); return EINVAL; } } } if (mtx_unlock (&lock->lock) != thrd_success) return EINVAL; return 0; } int glthread_rwlock_destroy (gl_rwlock_t *lock) { if (lock->init_needed) call_once (&lock->init_once, lock->init_func); mtx_destroy (&lock->lock); cnd_destroy (&lock->waiting_readers); cnd_destroy (&lock->waiting_writers); return 0; } /* --------------------- gl_recursive_lock_t datatype --------------------- */ int glthread_recursive_lock_init (gl_recursive_lock_t *lock) { if (mtx_init (&lock->mutex, mtx_plain | mtx_recursive) != thrd_success) return ENOMEM; lock->init_needed = 0; return 0; } int glthread_recursive_lock_lock (gl_recursive_lock_t *lock) { if (lock->init_needed) call_once (&lock->init_once, lock->init_func); if (mtx_lock (&lock->mutex) != thrd_success) return EAGAIN; return 0; } int glthread_recursive_lock_unlock (gl_recursive_lock_t *lock) { if (lock->init_needed) call_once (&lock->init_once, lock->init_func); if (mtx_unlock (&lock->mutex) != thrd_success) return EINVAL; return 0; } int glthread_recursive_lock_destroy (gl_recursive_lock_t *lock) { if (lock->init_needed) call_once (&lock->init_once, lock->init_func); mtx_destroy (&lock->mutex); return 0; } /* -------------------------- gl_once_t datatype -------------------------- */ #endif /* ========================================================================= */ #if USE_POSIX_THREADS /* -------------------------- gl_lock_t datatype -------------------------- */ /* ------------------------- gl_rwlock_t datatype ------------------------- */ # if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1))) # if defined PTHREAD_RWLOCK_INITIALIZER || defined PTHREAD_RWLOCK_INITIALIZER_NP # if !HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */ int glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock) { pthread_rwlockattr_t attributes; int err; err = pthread_rwlockattr_init (&attributes); if (err != 0) return err; /* Note: PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP is the only value that causes the writer to be preferred. PTHREAD_RWLOCK_PREFER_WRITER_NP does not do this; see http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html */ err = pthread_rwlockattr_setkind_np (&attributes, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); if (err == 0) err = pthread_rwlock_init(lock, &attributes); /* pthread_rwlockattr_destroy always returns 0. It cannot influence the return value. */ pthread_rwlockattr_destroy (&attributes); return err; } # endif # else int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock) { int err; err = pthread_rwlock_init (&lock->rwlock, NULL); if (err != 0) return err; lock->initialized = 1; return 0; } int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock) { if (!lock->initialized) { int err; err = pthread_mutex_lock (&lock->guard); if (err != 0) return err; if (!lock->initialized) { err = glthread_rwlock_init_multithreaded (lock); if (err != 0) { pthread_mutex_unlock (&lock->guard); return err; } } err = pthread_mutex_unlock (&lock->guard); if (err != 0) return err; } return pthread_rwlock_rdlock (&lock->rwlock); } int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock) { if (!lock->initialized) { int err; err = pthread_mutex_lock (&lock->guard); if (err != 0) return err; if (!lock->initialized) { err = glthread_rwlock_init_multithreaded (lock); if (err != 0) { pthread_mutex_unlock (&lock->guard); return err; } } err = pthread_mutex_unlock (&lock->guard); if (err != 0) return err; } return pthread_rwlock_wrlock (&lock->rwlock); } int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock) { if (!lock->initialized) return EINVAL; return pthread_rwlock_unlock (&lock->rwlock); } int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock) { int err; if (!lock->initialized) return EINVAL; err = pthread_rwlock_destroy (&lock->rwlock); if (err != 0) return err; lock->initialized = 0; return 0; } # endif # else int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock) { int err; err = pthread_mutex_init (&lock->lock, NULL); if (err != 0) return err; err = pthread_cond_init (&lock->waiting_readers, NULL); if (err != 0) return err; err = pthread_cond_init (&lock->waiting_writers, NULL); if (err != 0) return err; lock->waiting_writers_count = 0; lock->runcount = 0; return 0; } int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock) { int err; err = pthread_mutex_lock (&lock->lock); if (err != 0) return err; /* Test whether only readers are currently running, and whether the runcount field will not overflow, and whether no writer is waiting. The latter condition is because POSIX recommends that "write locks shall take precedence over read locks", to avoid "writer starvation". */ while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_readers. */ err = pthread_cond_wait (&lock->waiting_readers, &lock->lock); if (err != 0) { pthread_mutex_unlock (&lock->lock); return err; } } lock->runcount++; return pthread_mutex_unlock (&lock->lock); } int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock) { int err; err = pthread_mutex_lock (&lock->lock); if (err != 0) return err; /* Test whether no readers or writers are currently running. */ while (!(lock->runcount == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_writers. */ lock->waiting_writers_count++; err = pthread_cond_wait (&lock->waiting_writers, &lock->lock); if (err != 0) { lock->waiting_writers_count--; pthread_mutex_unlock (&lock->lock); return err; } lock->waiting_writers_count--; } lock->runcount--; /* runcount becomes -1 */ return pthread_mutex_unlock (&lock->lock); } int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock) { int err; err = pthread_mutex_lock (&lock->lock); if (err != 0) return err; if (lock->runcount < 0) { /* Drop a writer lock. */ if (!(lock->runcount == -1)) { pthread_mutex_unlock (&lock->lock); return EINVAL; } lock->runcount = 0; } else { /* Drop a reader lock. */ if (!(lock->runcount > 0)) { pthread_mutex_unlock (&lock->lock); return EINVAL; } lock->runcount--; } if (lock->runcount == 0) { /* POSIX recommends that "write locks shall take precedence over read locks", to avoid "writer starvation". */ if (lock->waiting_writers_count > 0) { /* Wake up one of the waiting writers. */ err = pthread_cond_signal (&lock->waiting_writers); if (err != 0) { pthread_mutex_unlock (&lock->lock); return err; } } else { /* Wake up all waiting readers. */ err = pthread_cond_broadcast (&lock->waiting_readers); if (err != 0) { pthread_mutex_unlock (&lock->lock); return err; } } } return pthread_mutex_unlock (&lock->lock); } int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock) { int err; err = pthread_mutex_destroy (&lock->lock); if (err != 0) return err; err = pthread_cond_destroy (&lock->waiting_readers); if (err != 0) return err; err = pthread_cond_destroy (&lock->waiting_writers); if (err != 0) return err; return 0; } # endif /* --------------------- gl_recursive_lock_t datatype --------------------- */ # if HAVE_PTHREAD_MUTEX_RECURSIVE # if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) { pthread_mutexattr_t attributes; int err; err = pthread_mutexattr_init (&attributes); if (err != 0) return err; err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE); if (err != 0) { pthread_mutexattr_destroy (&attributes); return err; } err = pthread_mutex_init (lock, &attributes); if (err != 0) { pthread_mutexattr_destroy (&attributes); return err; } err = pthread_mutexattr_destroy (&attributes); if (err != 0) return err; return 0; } # else int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) { pthread_mutexattr_t attributes; int err; err = pthread_mutexattr_init (&attributes); if (err != 0) return err; err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE); if (err != 0) { pthread_mutexattr_destroy (&attributes); return err; } err = pthread_mutex_init (&lock->recmutex, &attributes); if (err != 0) { pthread_mutexattr_destroy (&attributes); return err; } err = pthread_mutexattr_destroy (&attributes); if (err != 0) return err; lock->initialized = 1; return 0; } int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock) { if (!lock->initialized) { int err; err = pthread_mutex_lock (&lock->guard); if (err != 0) return err; if (!lock->initialized) { err = glthread_recursive_lock_init_multithreaded (lock); if (err != 0) { pthread_mutex_unlock (&lock->guard); return err; } } err = pthread_mutex_unlock (&lock->guard); if (err != 0) return err; } return pthread_mutex_lock (&lock->recmutex); } int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock) { if (!lock->initialized) return EINVAL; return pthread_mutex_unlock (&lock->recmutex); } int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) { int err; if (!lock->initialized) return EINVAL; err = pthread_mutex_destroy (&lock->recmutex); if (err != 0) return err; lock->initialized = 0; return 0; } # endif # else int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) { int err; err = pthread_mutex_init (&lock->mutex, NULL); if (err != 0) return err; lock->owner = (pthread_t) 0; lock->depth = 0; return 0; } int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock) { pthread_t self = pthread_self (); if (lock->owner != self) { int err; err = pthread_mutex_lock (&lock->mutex); if (err != 0) return err; lock->owner = self; } if (++(lock->depth) == 0) /* wraparound? */ { lock->depth--; return EAGAIN; } return 0; } int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock) { if (lock->owner != pthread_self ()) return EPERM; if (lock->depth == 0) return EINVAL; if (--(lock->depth) == 0) { lock->owner = (pthread_t) 0; return pthread_mutex_unlock (&lock->mutex); } else return 0; } int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) { if (lock->owner != (pthread_t) 0) return EBUSY; return pthread_mutex_destroy (&lock->mutex); } # endif /* -------------------------- gl_once_t datatype -------------------------- */ static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT; int glthread_once_singlethreaded (pthread_once_t *once_control) { /* We don't know whether pthread_once_t is an integer type, a floating-point type, a pointer type, or a structure type. */ char *firstbyte = (char *)once_control; if (*firstbyte == *(const char *)&fresh_once) { /* First time use of once_control. Invert the first byte. */ *firstbyte = ~ *(const char *)&fresh_once; return 1; } else return 0; } # if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK) int glthread_once_multithreaded (pthread_once_t *once_control, void (*init_function) (void)) { int err = pthread_once (once_control, init_function); if (err == ENOSYS) { /* This happens on FreeBSD 11: The pthread_once function in libc returns ENOSYS. */ if (glthread_once_singlethreaded (once_control)) init_function (); return 0; } return err; } # endif #endif /* ========================================================================= */ #if USE_WINDOWS_THREADS #endif /* ========================================================================= */ kbuild-3608/src/grep/lib/glthread/threadlib.c0000664000175000017500000000512014670377423021107 0ustar locutuslocutus/* Multithreading primitives. Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. */ #include /* ========================================================================= */ #if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS /* Use the POSIX threads library. */ # include # include # include # if PTHREAD_IN_USE_DETECTION_HARD # if defined __FreeBSD__ || defined __DragonFly__ /* FreeBSD */ /* Test using pthread_key_create. */ int glthread_in_use (void) { static int tested; static int result; /* 1: linked with -lpthread, 0: only with libc */ if (!tested) { pthread_key_t key; int err = pthread_key_create (&key, NULL); if (err == ENOSYS) result = 0; else { result = 1; if (err == 0) pthread_key_delete (key); } tested = 1; } return result; } # else /* Solaris, HP-UX */ /* Test using pthread_create. */ /* The function to be executed by a dummy thread. */ static void * dummy_thread_func (void *arg) { return arg; } int glthread_in_use (void) { static int tested; static int result; /* 1: linked with -lpthread, 0: only with libc */ if (!tested) { pthread_t thread; if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0) /* Thread creation failed. */ result = 0; else { /* Thread creation works. */ void *retval; if (pthread_join (thread, &retval) != 0) abort (); result = 1; } tested = 1; } return result; } # endif # endif #endif /* ========================================================================= */ /* This declaration is solely to ensure that after preprocessing this file is never empty. */ typedef int dummy; kbuild-3608/src/grep/lib/glthread/lock.h0000664000175000017500000007546614670377423020132 0ustar locutuslocutus/* Locking in multithreaded situations. Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h. */ /* This file contains locking primitives for use with a given thread library. It does not contain primitives for creating threads or for other synchronization primitives. Normal (non-recursive) locks: Type: gl_lock_t Declaration: gl_lock_define(extern, name) Initializer: gl_lock_define_initialized(, name) Initialization: gl_lock_init (name); Taking the lock: gl_lock_lock (name); Releasing the lock: gl_lock_unlock (name); De-initialization: gl_lock_destroy (name); Equivalent functions with control of error handling: Initialization: err = glthread_lock_init (&name); Taking the lock: err = glthread_lock_lock (&name); Releasing the lock: err = glthread_lock_unlock (&name); De-initialization: err = glthread_lock_destroy (&name); Read-Write (non-recursive) locks: Type: gl_rwlock_t Declaration: gl_rwlock_define(extern, name) Initializer: gl_rwlock_define_initialized(, name) Initialization: gl_rwlock_init (name); Taking the lock: gl_rwlock_rdlock (name); gl_rwlock_wrlock (name); Releasing the lock: gl_rwlock_unlock (name); De-initialization: gl_rwlock_destroy (name); Equivalent functions with control of error handling: Initialization: err = glthread_rwlock_init (&name); Taking the lock: err = glthread_rwlock_rdlock (&name); err = glthread_rwlock_wrlock (&name); Releasing the lock: err = glthread_rwlock_unlock (&name); De-initialization: err = glthread_rwlock_destroy (&name); Recursive locks: Type: gl_recursive_lock_t Declaration: gl_recursive_lock_define(extern, name) Initializer: gl_recursive_lock_define_initialized(, name) Initialization: gl_recursive_lock_init (name); Taking the lock: gl_recursive_lock_lock (name); Releasing the lock: gl_recursive_lock_unlock (name); De-initialization: gl_recursive_lock_destroy (name); Equivalent functions with control of error handling: Initialization: err = glthread_recursive_lock_init (&name); Taking the lock: err = glthread_recursive_lock_lock (&name); Releasing the lock: err = glthread_recursive_lock_unlock (&name); De-initialization: err = glthread_recursive_lock_destroy (&name); Once-only execution: Type: gl_once_t Initializer: gl_once_define(extern, name) Execution: gl_once (name, initfunction); Equivalent functions with control of error handling: Execution: err = glthread_once (&name, initfunction); */ #ifndef _LOCK_H #define _LOCK_H #include #include #if !defined c11_threads_in_use # if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC # define c11_threads_in_use() 1 # elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK # include # pragma weak thrd_exit # define c11_threads_in_use() (thrd_exit != NULL) # else # define c11_threads_in_use() 0 # endif #endif /* ========================================================================= */ #if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS /* Use the ISO C threads library. */ # include # ifdef __cplusplus extern "C" { # endif /* -------------------------- gl_lock_t datatype -------------------------- */ typedef struct { int volatile init_needed; once_flag init_once; void (*init_func) (void); mtx_t mutex; } gl_lock_t; # define gl_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_lock_t NAME; # define gl_lock_define_initialized(STORAGECLASS, NAME) \ static void _atomic_init_##NAME (void); \ STORAGECLASS gl_lock_t NAME = \ { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \ static void _atomic_init_##NAME (void) \ { \ if (glthread_lock_init (&(NAME))) \ abort (); \ } extern int glthread_lock_init (gl_lock_t *lock); extern int glthread_lock_lock (gl_lock_t *lock); extern int glthread_lock_unlock (gl_lock_t *lock); extern int glthread_lock_destroy (gl_lock_t *lock); /* ------------------------- gl_rwlock_t datatype ------------------------- */ typedef struct { int volatile init_needed; once_flag init_once; void (*init_func) (void); mtx_t lock; /* protects the remaining fields */ cnd_t waiting_readers; /* waiting readers */ cnd_t waiting_writers; /* waiting writers */ unsigned int waiting_writers_count; /* number of waiting writers */ int runcount; /* number of readers running, or -1 when a writer runs */ } gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ static void _atomic_init_##NAME (void); \ STORAGECLASS gl_rwlock_t NAME = \ { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \ static void _atomic_init_##NAME (void) \ { \ if (glthread_rwlock_init (&(NAME))) \ abort (); \ } extern int glthread_rwlock_init (gl_rwlock_t *lock); extern int glthread_rwlock_rdlock (gl_rwlock_t *lock); extern int glthread_rwlock_wrlock (gl_rwlock_t *lock); extern int glthread_rwlock_unlock (gl_rwlock_t *lock); extern int glthread_rwlock_destroy (gl_rwlock_t *lock); /* --------------------- gl_recursive_lock_t datatype --------------------- */ typedef struct { int volatile init_needed; once_flag init_once; void (*init_func) (void); mtx_t mutex; } gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ static void _atomic_init_##NAME (void); \ STORAGECLASS gl_recursive_lock_t NAME = \ { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \ static void _atomic_init_##NAME (void) \ { \ if (glthread_recursive_lock_init (&(NAME))) \ abort (); \ } extern int glthread_recursive_lock_init (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_lock (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_unlock (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_destroy (gl_recursive_lock_t *lock); /* -------------------------- gl_once_t datatype -------------------------- */ typedef once_flag gl_once_t; # define gl_once_define(STORAGECLASS, NAME) \ STORAGECLASS once_flag NAME = ONCE_FLAG_INIT; # define glthread_once(ONCE_CONTROL, INITFUNCTION) \ (call_once (ONCE_CONTROL, INITFUNCTION), 0) # ifdef __cplusplus } # endif #endif /* ========================================================================= */ #if USE_POSIX_THREADS /* Use the POSIX threads library. */ # include # ifdef __cplusplus extern "C" { # endif # if PTHREAD_IN_USE_DETECTION_HARD /* The pthread_in_use() detection needs to be done at runtime. */ # define pthread_in_use() \ glthread_in_use () extern int glthread_in_use (void); # endif # if USE_POSIX_THREADS_WEAK /* Use weak references to the POSIX threads library. */ /* Weak references avoid dragging in external libraries if the other parts of the program don't use them. Here we use them, because we don't want every program that uses libintl to depend on libpthread. This assumes that libpthread would not be loaded after libintl; i.e. if libintl is loaded first, by an executable that does not depend on libpthread, and then a module is dynamically loaded that depends on libpthread, libintl will not be multithread-safe. */ /* The way to test at runtime whether libpthread is present is to test whether a function pointer's value, such as &pthread_mutex_init, is non-NULL. However, some versions of GCC have a bug through which, in PIC mode, &foo != NULL always evaluates to true if there is a direct call to foo(...) in the same function. To avoid this, we test the address of a function in libpthread that we don't use. */ # pragma weak pthread_mutex_init # pragma weak pthread_mutex_lock # pragma weak pthread_mutex_unlock # pragma weak pthread_mutex_destroy # pragma weak pthread_rwlock_init # pragma weak pthread_rwlock_rdlock # pragma weak pthread_rwlock_wrlock # pragma weak pthread_rwlock_unlock # pragma weak pthread_rwlock_destroy # pragma weak pthread_once # pragma weak pthread_cond_init # pragma weak pthread_cond_wait # pragma weak pthread_cond_signal # pragma weak pthread_cond_broadcast # pragma weak pthread_cond_destroy # pragma weak pthread_mutexattr_init # pragma weak pthread_mutexattr_settype # pragma weak pthread_mutexattr_destroy # pragma weak pthread_rwlockattr_init # if __GNU_LIBRARY__ > 1 # pragma weak pthread_rwlockattr_setkind_np # endif # pragma weak pthread_rwlockattr_destroy # ifndef pthread_self # pragma weak pthread_self # endif # if !PTHREAD_IN_USE_DETECTION_HARD /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols can be used to determine whether libpthread is in use. These are: pthread_mutexattr_gettype pthread_rwlockattr_destroy pthread_rwlockattr_init */ # pragma weak pthread_mutexattr_gettype # define pthread_in_use() \ (pthread_mutexattr_gettype != NULL || c11_threads_in_use ()) # endif # else # if !PTHREAD_IN_USE_DETECTION_HARD # define pthread_in_use() 1 # endif # endif /* -------------------------- gl_lock_t datatype -------------------------- */ typedef pthread_mutex_t gl_lock_t; # define gl_lock_define(STORAGECLASS, NAME) \ STORAGECLASS pthread_mutex_t NAME; # define gl_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS pthread_mutex_t NAME = gl_lock_initializer; # define gl_lock_initializer \ PTHREAD_MUTEX_INITIALIZER # define glthread_lock_init(LOCK) \ (pthread_in_use () ? pthread_mutex_init (LOCK, NULL) : 0) # define glthread_lock_lock(LOCK) \ (pthread_in_use () ? pthread_mutex_lock (LOCK) : 0) # define glthread_lock_unlock(LOCK) \ (pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0) # define glthread_lock_destroy(LOCK) \ (pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0) /* ------------------------- gl_rwlock_t datatype ------------------------- */ # if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1))) # if defined PTHREAD_RWLOCK_INITIALIZER || defined PTHREAD_RWLOCK_INITIALIZER_NP typedef pthread_rwlock_t gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS pthread_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer; # if HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER # if defined PTHREAD_RWLOCK_INITIALIZER # define gl_rwlock_initializer \ PTHREAD_RWLOCK_INITIALIZER # else # define gl_rwlock_initializer \ PTHREAD_RWLOCK_INITIALIZER_NP # endif # define glthread_rwlock_init(LOCK) \ (pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0) # else /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */ # define gl_rwlock_initializer \ PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP # define glthread_rwlock_init(LOCK) \ (pthread_in_use () ? glthread_rwlock_init_for_glibc (LOCK) : 0) extern int glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock); # endif # define glthread_rwlock_rdlock(LOCK) \ (pthread_in_use () ? pthread_rwlock_rdlock (LOCK) : 0) # define glthread_rwlock_wrlock(LOCK) \ (pthread_in_use () ? pthread_rwlock_wrlock (LOCK) : 0) # define glthread_rwlock_unlock(LOCK) \ (pthread_in_use () ? pthread_rwlock_unlock (LOCK) : 0) # define glthread_rwlock_destroy(LOCK) \ (pthread_in_use () ? pthread_rwlock_destroy (LOCK) : 0) # else typedef struct { int initialized; pthread_mutex_t guard; /* protects the initialization */ pthread_rwlock_t rwlock; /* read-write lock */ } gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ { 0, PTHREAD_MUTEX_INITIALIZER } # define glthread_rwlock_init(LOCK) \ (pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0) # define glthread_rwlock_rdlock(LOCK) \ (pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0) # define glthread_rwlock_wrlock(LOCK) \ (pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0) # define glthread_rwlock_unlock(LOCK) \ (pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0) # define glthread_rwlock_destroy(LOCK) \ (pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0) extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock); extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock); extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock); extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock); extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock); # endif # else typedef struct { pthread_mutex_t lock; /* protects the remaining fields */ pthread_cond_t waiting_readers; /* waiting readers */ pthread_cond_t waiting_writers; /* waiting writers */ unsigned int waiting_writers_count; /* number of waiting writers */ int runcount; /* number of readers running, or -1 when a writer runs */ } gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 } # define glthread_rwlock_init(LOCK) \ (pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0) # define glthread_rwlock_rdlock(LOCK) \ (pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0) # define glthread_rwlock_wrlock(LOCK) \ (pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0) # define glthread_rwlock_unlock(LOCK) \ (pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0) # define glthread_rwlock_destroy(LOCK) \ (pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0) extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock); extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock); extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock); extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock); extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock); # endif /* --------------------- gl_recursive_lock_t datatype --------------------- */ # if HAVE_PTHREAD_MUTEX_RECURSIVE # if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP typedef pthread_mutex_t gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS pthread_mutex_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS pthread_mutex_t NAME = gl_recursive_lock_initializer; # ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER # define gl_recursive_lock_initializer \ PTHREAD_RECURSIVE_MUTEX_INITIALIZER # else # define gl_recursive_lock_initializer \ PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP # endif # define glthread_recursive_lock_init(LOCK) \ (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) # define glthread_recursive_lock_lock(LOCK) \ (pthread_in_use () ? pthread_mutex_lock (LOCK) : 0) # define glthread_recursive_lock_unlock(LOCK) \ (pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0) # define glthread_recursive_lock_destroy(LOCK) \ (pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0) extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); # else typedef struct { pthread_mutex_t recmutex; /* recursive mutex */ pthread_mutex_t guard; /* protects the initialization */ int initialized; } gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; # define gl_recursive_lock_initializer \ { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 } # define glthread_recursive_lock_init(LOCK) \ (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) # define glthread_recursive_lock_lock(LOCK) \ (pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0) # define glthread_recursive_lock_unlock(LOCK) \ (pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0) # define glthread_recursive_lock_destroy(LOCK) \ (pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0) extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock); # endif # else /* Old versions of POSIX threads on Solaris did not have recursive locks. We have to implement them ourselves. */ typedef struct { pthread_mutex_t mutex; pthread_t owner; unsigned long depth; } gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; # define gl_recursive_lock_initializer \ { PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 } # define glthread_recursive_lock_init(LOCK) \ (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) # define glthread_recursive_lock_lock(LOCK) \ (pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0) # define glthread_recursive_lock_unlock(LOCK) \ (pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0) # define glthread_recursive_lock_destroy(LOCK) \ (pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0) extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock); # endif /* -------------------------- gl_once_t datatype -------------------------- */ typedef pthread_once_t gl_once_t; # define gl_once_define(STORAGECLASS, NAME) \ STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT; # if PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK # define glthread_once(ONCE_CONTROL, INITFUNCTION) \ (pthread_in_use () \ ? pthread_once (ONCE_CONTROL, INITFUNCTION) \ : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) # else # define glthread_once(ONCE_CONTROL, INITFUNCTION) \ (pthread_in_use () \ ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \ : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) extern int glthread_once_multithreaded (pthread_once_t *once_control, void (*init_function) (void)); # endif extern int glthread_once_singlethreaded (pthread_once_t *once_control); # ifdef __cplusplus } # endif #endif /* ========================================================================= */ #if USE_WINDOWS_THREADS # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # include "windows-mutex.h" # include "windows-rwlock.h" # include "windows-recmutex.h" # include "windows-once.h" # ifdef __cplusplus extern "C" { # endif /* We can use CRITICAL_SECTION directly, rather than the native Windows Event, Mutex, Semaphore types, because - we need only to synchronize inside a single process (address space), not inter-process locking, - we don't need to support trylock operations. (TryEnterCriticalSection does not work on Windows 95/98/ME. Packages that need trylock usually define their own mutex type.) */ /* There is no way to statically initialize a CRITICAL_SECTION. It needs to be done lazily, once only. For this we need spinlocks. */ /* -------------------------- gl_lock_t datatype -------------------------- */ typedef glwthread_mutex_t gl_lock_t; # define gl_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_lock_t NAME; # define gl_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_lock_t NAME = gl_lock_initializer; # define gl_lock_initializer \ GLWTHREAD_MUTEX_INIT # define glthread_lock_init(LOCK) \ (glwthread_mutex_init (LOCK), 0) # define glthread_lock_lock(LOCK) \ glwthread_mutex_lock (LOCK) # define glthread_lock_unlock(LOCK) \ glwthread_mutex_unlock (LOCK) # define glthread_lock_destroy(LOCK) \ glwthread_mutex_destroy (LOCK) /* ------------------------- gl_rwlock_t datatype ------------------------- */ typedef glwthread_rwlock_t gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ GLWTHREAD_RWLOCK_INIT # define glthread_rwlock_init(LOCK) \ (glwthread_rwlock_init (LOCK), 0) # define glthread_rwlock_rdlock(LOCK) \ glwthread_rwlock_rdlock (LOCK) # define glthread_rwlock_wrlock(LOCK) \ glwthread_rwlock_wrlock (LOCK) # define glthread_rwlock_unlock(LOCK) \ glwthread_rwlock_unlock (LOCK) # define glthread_rwlock_destroy(LOCK) \ glwthread_rwlock_destroy (LOCK) /* --------------------- gl_recursive_lock_t datatype --------------------- */ typedef glwthread_recmutex_t gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; # define gl_recursive_lock_initializer \ GLWTHREAD_RECMUTEX_INIT # define glthread_recursive_lock_init(LOCK) \ (glwthread_recmutex_init (LOCK), 0) # define glthread_recursive_lock_lock(LOCK) \ glwthread_recmutex_lock (LOCK) # define glthread_recursive_lock_unlock(LOCK) \ glwthread_recmutex_unlock (LOCK) # define glthread_recursive_lock_destroy(LOCK) \ glwthread_recmutex_destroy (LOCK) /* -------------------------- gl_once_t datatype -------------------------- */ typedef glwthread_once_t gl_once_t; # define gl_once_define(STORAGECLASS, NAME) \ STORAGECLASS gl_once_t NAME = GLWTHREAD_ONCE_INIT; # define glthread_once(ONCE_CONTROL, INITFUNCTION) \ (glwthread_once (ONCE_CONTROL, INITFUNCTION), 0) # ifdef __cplusplus } # endif #endif /* ========================================================================= */ #if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS) /* Provide dummy implementation if threads are not supported. */ /* -------------------------- gl_lock_t datatype -------------------------- */ typedef int gl_lock_t; # define gl_lock_define(STORAGECLASS, NAME) # define gl_lock_define_initialized(STORAGECLASS, NAME) # define glthread_lock_init(NAME) 0 # define glthread_lock_lock(NAME) 0 # define glthread_lock_unlock(NAME) 0 # define glthread_lock_destroy(NAME) 0 /* ------------------------- gl_rwlock_t datatype ------------------------- */ typedef int gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) # define gl_rwlock_define_initialized(STORAGECLASS, NAME) # define glthread_rwlock_init(NAME) 0 # define glthread_rwlock_rdlock(NAME) 0 # define glthread_rwlock_wrlock(NAME) 0 # define glthread_rwlock_unlock(NAME) 0 # define glthread_rwlock_destroy(NAME) 0 /* --------------------- gl_recursive_lock_t datatype --------------------- */ typedef int gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) # define glthread_recursive_lock_init(NAME) 0 # define glthread_recursive_lock_lock(NAME) 0 # define glthread_recursive_lock_unlock(NAME) 0 # define glthread_recursive_lock_destroy(NAME) 0 /* -------------------------- gl_once_t datatype -------------------------- */ typedef int gl_once_t; # define gl_once_define(STORAGECLASS, NAME) \ STORAGECLASS gl_once_t NAME = 0; # define glthread_once(ONCE_CONTROL, INITFUNCTION) \ (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0) #endif /* ========================================================================= */ /* Macros with built-in error handling. */ /* -------------------------- gl_lock_t datatype -------------------------- */ #define gl_lock_init(NAME) \ do \ { \ if (glthread_lock_init (&NAME)) \ abort (); \ } \ while (0) #define gl_lock_lock(NAME) \ do \ { \ if (glthread_lock_lock (&NAME)) \ abort (); \ } \ while (0) #define gl_lock_unlock(NAME) \ do \ { \ if (glthread_lock_unlock (&NAME)) \ abort (); \ } \ while (0) #define gl_lock_destroy(NAME) \ do \ { \ if (glthread_lock_destroy (&NAME)) \ abort (); \ } \ while (0) /* ------------------------- gl_rwlock_t datatype ------------------------- */ #define gl_rwlock_init(NAME) \ do \ { \ if (glthread_rwlock_init (&NAME)) \ abort (); \ } \ while (0) #define gl_rwlock_rdlock(NAME) \ do \ { \ if (glthread_rwlock_rdlock (&NAME)) \ abort (); \ } \ while (0) #define gl_rwlock_wrlock(NAME) \ do \ { \ if (glthread_rwlock_wrlock (&NAME)) \ abort (); \ } \ while (0) #define gl_rwlock_unlock(NAME) \ do \ { \ if (glthread_rwlock_unlock (&NAME)) \ abort (); \ } \ while (0) #define gl_rwlock_destroy(NAME) \ do \ { \ if (glthread_rwlock_destroy (&NAME)) \ abort (); \ } \ while (0) /* --------------------- gl_recursive_lock_t datatype --------------------- */ #define gl_recursive_lock_init(NAME) \ do \ { \ if (glthread_recursive_lock_init (&NAME)) \ abort (); \ } \ while (0) #define gl_recursive_lock_lock(NAME) \ do \ { \ if (glthread_recursive_lock_lock (&NAME)) \ abort (); \ } \ while (0) #define gl_recursive_lock_unlock(NAME) \ do \ { \ if (glthread_recursive_lock_unlock (&NAME)) \ abort (); \ } \ while (0) #define gl_recursive_lock_destroy(NAME) \ do \ { \ if (glthread_recursive_lock_destroy (&NAME)) \ abort (); \ } \ while (0) /* -------------------------- gl_once_t datatype -------------------------- */ #define gl_once(NAME, INITFUNCTION) \ do \ { \ if (glthread_once (&NAME, INITFUNCTION)) \ abort (); \ } \ while (0) /* ========================================================================= */ #endif /* _LOCK_H */ kbuild-3608/src/grep/lib/inttypes.in.h0000664000175000017500000005123214670377424017656 0ustar locutuslocutus/* Copyright (C) 2006-2021 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Derek Price. This file is part of gnulib. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* * ISO C 99 for platforms that lack it. * */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* Include the original if it exists, and if this file has not been included yet or if this file includes gnulib stdint.h which in turn includes this file. The include_next requires a split double-inclusion guard. */ #if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H # if @HAVE_INTTYPES_H@ /* Some pre-C++11 implementations need this. */ # if defined __cplusplus && ! defined __STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS 1 # endif # @INCLUDE_NEXT@ @NEXT_INTTYPES_H@ # define _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H # endif #endif #if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H #define INTTYPES_H /* Include or the gnulib replacement. But avoid namespace pollution on glibc systems. */ #ifndef __GLIBC__ # include #endif /* Get CHAR_BIT, INT_MAX, LONG_MAX, etc. */ #include /* On mingw, __USE_MINGW_ANSI_STDIO only works if is also included */ #if defined _WIN32 && ! defined __CYGWIN__ # include #endif #if !(INT_MAX == 0x7fffffff && INT_MIN + INT_MAX == -1) # error "This file assumes that 'int' is 32-bit two's complement. Please report your platform and compiler to ." #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* 7.8.1 Macros for format specifiers */ #if defined _TNS_R_TARGET /* Tandem NonStop R series and compatible platforms released before July 2005 support %Ld but not %lld. */ # define _LONG_LONG_FORMAT_PREFIX "L" #else # define _LONG_LONG_FORMAT_PREFIX "ll" #endif #if !defined PRId8 # ifdef INT8_MAX # define PRId8 "d" # endif #endif #if !defined PRIi8 # ifdef INT8_MAX # define PRIi8 "i" # endif #endif #if !defined PRIo8 # ifdef UINT8_MAX # define PRIo8 "o" # endif #endif #if !defined PRIu8 # ifdef UINT8_MAX # define PRIu8 "u" # endif #endif #if !defined PRIx8 # ifdef UINT8_MAX # define PRIx8 "x" # endif #endif #if !defined PRIX8 # ifdef UINT8_MAX # define PRIX8 "X" # endif #endif #if !defined PRId16 # ifdef INT16_MAX # define PRId16 "d" # endif #endif #if !defined PRIi16 # ifdef INT16_MAX # define PRIi16 "i" # endif #endif #if !defined PRIo16 # ifdef UINT16_MAX # define PRIo16 "o" # endif #endif #if !defined PRIu16 # ifdef UINT16_MAX # define PRIu16 "u" # endif #endif #if !defined PRIx16 # ifdef UINT16_MAX # define PRIx16 "x" # endif #endif #if !defined PRIX16 # ifdef UINT16_MAX # define PRIX16 "X" # endif #endif #if !defined PRId32 # ifdef INT32_MAX # define PRId32 "d" # endif #endif #if !defined PRIi32 # ifdef INT32_MAX # define PRIi32 "i" # endif #endif #if !defined PRIo32 # ifdef UINT32_MAX # define PRIo32 "o" # endif #endif #if !defined PRIu32 # ifdef UINT32_MAX # define PRIu32 "u" # endif #endif #if !defined PRIx32 # ifdef UINT32_MAX # define PRIx32 "x" # endif #endif #if !defined PRIX32 # ifdef UINT32_MAX # define PRIX32 "X" # endif #endif #ifdef INT64_MAX # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@) # define _PRI64_PREFIX "l" # elif defined _MSC_VER || defined __MINGW32__ # define _PRI64_PREFIX "I64" # elif LONG_MAX >> 30 == 1 # define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX # endif # if !defined PRId64 # define PRId64 _PRI64_PREFIX "d" # endif # if !defined PRIi64 # define PRIi64 _PRI64_PREFIX "i" # endif #endif #ifdef UINT64_MAX # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@) # define _PRIu64_PREFIX "l" # elif defined _MSC_VER || defined __MINGW32__ # define _PRIu64_PREFIX "I64" # elif ULONG_MAX >> 31 == 1 # define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX # endif # if !defined PRIo64 # define PRIo64 _PRIu64_PREFIX "o" # endif # if !defined PRIu64 # define PRIu64 _PRIu64_PREFIX "u" # endif # if !defined PRIx64 # define PRIx64 _PRIu64_PREFIX "x" # endif # if !defined PRIX64 # define PRIX64 _PRIu64_PREFIX "X" # endif #endif #if !defined PRIdLEAST8 # define PRIdLEAST8 "d" #endif #if !defined PRIiLEAST8 # define PRIiLEAST8 "i" #endif #if !defined PRIoLEAST8 # define PRIoLEAST8 "o" #endif #if !defined PRIuLEAST8 # define PRIuLEAST8 "u" #endif #if !defined PRIxLEAST8 # define PRIxLEAST8 "x" #endif #if !defined PRIXLEAST8 # define PRIXLEAST8 "X" #endif #if !defined PRIdLEAST16 # define PRIdLEAST16 "d" #endif #if !defined PRIiLEAST16 # define PRIiLEAST16 "i" #endif #if !defined PRIoLEAST16 # define PRIoLEAST16 "o" #endif #if !defined PRIuLEAST16 # define PRIuLEAST16 "u" #endif #if !defined PRIxLEAST16 # define PRIxLEAST16 "x" #endif #if !defined PRIXLEAST16 # define PRIXLEAST16 "X" #endif #if !defined PRIdLEAST32 # define PRIdLEAST32 "d" #endif #if !defined PRIiLEAST32 # define PRIiLEAST32 "i" #endif #if !defined PRIoLEAST32 # define PRIoLEAST32 "o" #endif #if !defined PRIuLEAST32 # define PRIuLEAST32 "u" #endif #if !defined PRIxLEAST32 # define PRIxLEAST32 "x" #endif #if !defined PRIXLEAST32 # define PRIXLEAST32 "X" #endif #ifdef INT64_MAX # if !defined PRIdLEAST64 # define PRIdLEAST64 PRId64 # endif # if !defined PRIiLEAST64 # define PRIiLEAST64 PRIi64 # endif #endif #ifdef UINT64_MAX # if !defined PRIoLEAST64 # define PRIoLEAST64 PRIo64 # endif # if !defined PRIuLEAST64 # define PRIuLEAST64 PRIu64 # endif # if !defined PRIxLEAST64 # define PRIxLEAST64 PRIx64 # endif # if !defined PRIXLEAST64 # define PRIXLEAST64 PRIX64 # endif #endif #if !defined PRIdFAST8 # if INT_FAST8_MAX > INT32_MAX # define PRIdFAST8 PRId64 # else # define PRIdFAST8 "d" # endif #endif #if !defined PRIiFAST8 # if INT_FAST8_MAX > INT32_MAX # define PRIiFAST8 PRIi64 # else # define PRIiFAST8 "i" # endif #endif #if !defined PRIoFAST8 # if UINT_FAST8_MAX > UINT32_MAX # define PRIoFAST8 PRIo64 # else # define PRIoFAST8 "o" # endif #endif #if !defined PRIuFAST8 # if UINT_FAST8_MAX > UINT32_MAX # define PRIuFAST8 PRIu64 # else # define PRIuFAST8 "u" # endif #endif #if !defined PRIxFAST8 # if UINT_FAST8_MAX > UINT32_MAX # define PRIxFAST8 PRIx64 # else # define PRIxFAST8 "x" # endif #endif #if !defined PRIXFAST8 # if UINT_FAST8_MAX > UINT32_MAX # define PRIXFAST8 PRIX64 # else # define PRIXFAST8 "X" # endif #endif #if !defined PRIdFAST16 # if INT_FAST16_MAX > INT32_MAX # define PRIdFAST16 PRId64 # else # define PRIdFAST16 "d" # endif #endif #if !defined PRIiFAST16 # if INT_FAST16_MAX > INT32_MAX # define PRIiFAST16 PRIi64 # else # define PRIiFAST16 "i" # endif #endif #if !defined PRIoFAST16 # if UINT_FAST16_MAX > UINT32_MAX # define PRIoFAST16 PRIo64 # else # define PRIoFAST16 "o" # endif #endif #if !defined PRIuFAST16 # if UINT_FAST16_MAX > UINT32_MAX # define PRIuFAST16 PRIu64 # else # define PRIuFAST16 "u" # endif #endif #if !defined PRIxFAST16 # if UINT_FAST16_MAX > UINT32_MAX # define PRIxFAST16 PRIx64 # else # define PRIxFAST16 "x" # endif #endif #if !defined PRIXFAST16 # if UINT_FAST16_MAX > UINT32_MAX # define PRIXFAST16 PRIX64 # else # define PRIXFAST16 "X" # endif #endif #if !defined PRIdFAST32 # if INT_FAST32_MAX > INT32_MAX # define PRIdFAST32 PRId64 # else # define PRIdFAST32 "d" # endif #endif #if !defined PRIiFAST32 # if INT_FAST32_MAX > INT32_MAX # define PRIiFAST32 PRIi64 # else # define PRIiFAST32 "i" # endif #endif #if !defined PRIoFAST32 # if UINT_FAST32_MAX > UINT32_MAX # define PRIoFAST32 PRIo64 # else # define PRIoFAST32 "o" # endif #endif #if !defined PRIuFAST32 # if UINT_FAST32_MAX > UINT32_MAX # define PRIuFAST32 PRIu64 # else # define PRIuFAST32 "u" # endif #endif #if !defined PRIxFAST32 # if UINT_FAST32_MAX > UINT32_MAX # define PRIxFAST32 PRIx64 # else # define PRIxFAST32 "x" # endif #endif #if !defined PRIXFAST32 # if UINT_FAST32_MAX > UINT32_MAX # define PRIXFAST32 PRIX64 # else # define PRIXFAST32 "X" # endif #endif #ifdef INT64_MAX # if !defined PRIdFAST64 # define PRIdFAST64 PRId64 # endif # if !defined PRIiFAST64 # define PRIiFAST64 PRIi64 # endif #endif #ifdef UINT64_MAX # if !defined PRIoFAST64 # define PRIoFAST64 PRIo64 # endif # if !defined PRIuFAST64 # define PRIuFAST64 PRIu64 # endif # if !defined PRIxFAST64 # define PRIxFAST64 PRIx64 # endif # if !defined PRIXFAST64 # define PRIXFAST64 PRIX64 # endif #endif #if !defined PRIdMAX # if @INT32_MAX_LT_INTMAX_MAX@ # define PRIdMAX PRId64 # else # define PRIdMAX "ld" # endif #endif #if !defined PRIiMAX # if @INT32_MAX_LT_INTMAX_MAX@ # define PRIiMAX PRIi64 # else # define PRIiMAX "li" # endif #endif #if !defined PRIoMAX # if @UINT32_MAX_LT_UINTMAX_MAX@ # define PRIoMAX PRIo64 # else # define PRIoMAX "lo" # endif #endif #if !defined PRIuMAX # if @UINT32_MAX_LT_UINTMAX_MAX@ # define PRIuMAX PRIu64 # else # define PRIuMAX "lu" # endif #endif #if !defined PRIxMAX # if @UINT32_MAX_LT_UINTMAX_MAX@ # define PRIxMAX PRIx64 # else # define PRIxMAX "lx" # endif #endif #if !defined PRIXMAX # if @UINT32_MAX_LT_UINTMAX_MAX@ # define PRIXMAX PRIX64 # else # define PRIXMAX "lX" # endif #endif #if !defined PRIdPTR # ifdef INTPTR_MAX # define PRIdPTR @PRIPTR_PREFIX@ "d" # endif #endif #if !defined PRIiPTR # ifdef INTPTR_MAX # define PRIiPTR @PRIPTR_PREFIX@ "i" # endif #endif #if !defined PRIoPTR # ifdef UINTPTR_MAX # define PRIoPTR @PRIPTR_PREFIX@ "o" # endif #endif #if !defined PRIuPTR # ifdef UINTPTR_MAX # define PRIuPTR @PRIPTR_PREFIX@ "u" # endif #endif #if !defined PRIxPTR # ifdef UINTPTR_MAX # define PRIxPTR @PRIPTR_PREFIX@ "x" # endif #endif #if !defined PRIXPTR # ifdef UINTPTR_MAX # define PRIXPTR @PRIPTR_PREFIX@ "X" # endif #endif #if !defined SCNd8 # ifdef INT8_MAX # define SCNd8 "hhd" # endif #endif #if !defined SCNi8 # ifdef INT8_MAX # define SCNi8 "hhi" # endif #endif #if !defined SCNo8 # ifdef UINT8_MAX # define SCNo8 "hho" # endif #endif #if !defined SCNu8 # ifdef UINT8_MAX # define SCNu8 "hhu" # endif #endif #if !defined SCNx8 # ifdef UINT8_MAX # define SCNx8 "hhx" # endif #endif #if !defined SCNd16 # ifdef INT16_MAX # define SCNd16 "hd" # endif #endif #if !defined SCNi16 # ifdef INT16_MAX # define SCNi16 "hi" # endif #endif #if !defined SCNo16 # ifdef UINT16_MAX # define SCNo16 "ho" # endif #endif #if !defined SCNu16 # ifdef UINT16_MAX # define SCNu16 "hu" # endif #endif #if !defined SCNx16 # ifdef UINT16_MAX # define SCNx16 "hx" # endif #endif #if !defined SCNd32 # ifdef INT32_MAX # define SCNd32 "d" # endif #endif #if !defined SCNi32 # ifdef INT32_MAX # define SCNi32 "i" # endif #endif #if !defined SCNo32 # ifdef UINT32_MAX # define SCNo32 "o" # endif #endif #if !defined SCNu32 # ifdef UINT32_MAX # define SCNu32 "u" # endif #endif #if !defined SCNx32 # ifdef UINT32_MAX # define SCNx32 "x" # endif #endif #ifdef INT64_MAX # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@) # define _SCN64_PREFIX "l" # elif defined _MSC_VER || defined __MINGW32__ # define _SCN64_PREFIX "I64" # elif LONG_MAX >> 30 == 1 # define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX # endif # if !defined SCNd64 # define SCNd64 _SCN64_PREFIX "d" # endif # if !defined SCNi64 # define SCNi64 _SCN64_PREFIX "i" # endif #endif #ifdef UINT64_MAX # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@) # define _SCNu64_PREFIX "l" # elif defined _MSC_VER || defined __MINGW32__ # define _SCNu64_PREFIX "I64" # elif ULONG_MAX >> 31 == 1 # define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX # endif # if !defined SCNo64 # define SCNo64 _SCNu64_PREFIX "o" # endif # if !defined SCNu64 # define SCNu64 _SCNu64_PREFIX "u" # endif # if !defined SCNx64 # define SCNx64 _SCNu64_PREFIX "x" # endif #endif #if !defined SCNdLEAST8 # define SCNdLEAST8 "hhd" #endif #if !defined SCNiLEAST8 # define SCNiLEAST8 "hhi" #endif #if !defined SCNoLEAST8 # define SCNoLEAST8 "hho" #endif #if !defined SCNuLEAST8 # define SCNuLEAST8 "hhu" #endif #if !defined SCNxLEAST8 # define SCNxLEAST8 "hhx" #endif #if !defined SCNdLEAST16 # define SCNdLEAST16 "hd" #endif #if !defined SCNiLEAST16 # define SCNiLEAST16 "hi" #endif #if !defined SCNoLEAST16 # define SCNoLEAST16 "ho" #endif #if !defined SCNuLEAST16 # define SCNuLEAST16 "hu" #endif #if !defined SCNxLEAST16 # define SCNxLEAST16 "hx" #endif #if !defined SCNdLEAST32 # define SCNdLEAST32 "d" #endif #if !defined SCNiLEAST32 # define SCNiLEAST32 "i" #endif #if !defined SCNoLEAST32 # define SCNoLEAST32 "o" #endif #if !defined SCNuLEAST32 # define SCNuLEAST32 "u" #endif #if !defined SCNxLEAST32 # define SCNxLEAST32 "x" #endif #ifdef INT64_MAX # if !defined SCNdLEAST64 # define SCNdLEAST64 SCNd64 # endif # if !defined SCNiLEAST64 # define SCNiLEAST64 SCNi64 # endif #endif #ifdef UINT64_MAX # if !defined SCNoLEAST64 # define SCNoLEAST64 SCNo64 # endif # if !defined SCNuLEAST64 # define SCNuLEAST64 SCNu64 # endif # if !defined SCNxLEAST64 # define SCNxLEAST64 SCNx64 # endif #endif #if !defined SCNdFAST8 # if INT_FAST8_MAX > INT32_MAX # define SCNdFAST8 SCNd64 # elif INT_FAST8_MAX == 0x7fff # define SCNdFAST8 "hd" # elif INT_FAST8_MAX == 0x7f # define SCNdFAST8 "hhd" # else # define SCNdFAST8 "d" # endif #endif #if !defined SCNiFAST8 # if INT_FAST8_MAX > INT32_MAX # define SCNiFAST8 SCNi64 # elif INT_FAST8_MAX == 0x7fff # define SCNiFAST8 "hi" # elif INT_FAST8_MAX == 0x7f # define SCNiFAST8 "hhi" # else # define SCNiFAST8 "i" # endif #endif #if !defined SCNoFAST8 # if UINT_FAST8_MAX > UINT32_MAX # define SCNoFAST8 SCNo64 # elif UINT_FAST8_MAX == 0xffff # define SCNoFAST8 "ho" # elif UINT_FAST8_MAX == 0xff # define SCNoFAST8 "hho" # else # define SCNoFAST8 "o" # endif #endif #if !defined SCNuFAST8 # if UINT_FAST8_MAX > UINT32_MAX # define SCNuFAST8 SCNu64 # elif UINT_FAST8_MAX == 0xffff # define SCNuFAST8 "hu" # elif UINT_FAST8_MAX == 0xff # define SCNuFAST8 "hhu" # else # define SCNuFAST8 "u" # endif #endif #if !defined SCNxFAST8 # if UINT_FAST8_MAX > UINT32_MAX # define SCNxFAST8 SCNx64 # elif UINT_FAST8_MAX == 0xffff # define SCNxFAST8 "hx" # elif UINT_FAST8_MAX == 0xff # define SCNxFAST8 "hhx" # else # define SCNxFAST8 "x" # endif #endif #if !defined SCNdFAST16 # if INT_FAST16_MAX > INT32_MAX # define SCNdFAST16 SCNd64 # elif INT_FAST16_MAX == 0x7fff # define SCNdFAST16 "hd" # else # define SCNdFAST16 "d" # endif #endif #if !defined SCNiFAST16 # if INT_FAST16_MAX > INT32_MAX # define SCNiFAST16 SCNi64 # elif INT_FAST16_MAX == 0x7fff # define SCNiFAST16 "hi" # else # define SCNiFAST16 "i" # endif #endif #if !defined SCNoFAST16 # if UINT_FAST16_MAX > UINT32_MAX # define SCNoFAST16 SCNo64 # elif UINT_FAST16_MAX == 0xffff # define SCNoFAST16 "ho" # else # define SCNoFAST16 "o" # endif #endif #if !defined SCNuFAST16 # if UINT_FAST16_MAX > UINT32_MAX # define SCNuFAST16 SCNu64 # elif UINT_FAST16_MAX == 0xffff # define SCNuFAST16 "hu" # else # define SCNuFAST16 "u" # endif #endif #if !defined SCNxFAST16 # if UINT_FAST16_MAX > UINT32_MAX # define SCNxFAST16 SCNx64 # elif UINT_FAST16_MAX == 0xffff # define SCNxFAST16 "hx" # else # define SCNxFAST16 "x" # endif #endif #if !defined SCNdFAST32 # if INT_FAST32_MAX > INT32_MAX # define SCNdFAST32 SCNd64 # else # define SCNdFAST32 "d" # endif #endif #if !defined SCNiFAST32 # if INT_FAST32_MAX > INT32_MAX # define SCNiFAST32 SCNi64 # else # define SCNiFAST32 "i" # endif #endif #if !defined SCNoFAST32 # if UINT_FAST32_MAX > UINT32_MAX # define SCNoFAST32 SCNo64 # else # define SCNoFAST32 "o" # endif #endif #if !defined SCNuFAST32 # if UINT_FAST32_MAX > UINT32_MAX # define SCNuFAST32 SCNu64 # else # define SCNuFAST32 "u" # endif #endif #if !defined SCNxFAST32 # if UINT_FAST32_MAX > UINT32_MAX # define SCNxFAST32 SCNx64 # else # define SCNxFAST32 "x" # endif #endif #ifdef INT64_MAX # if !defined SCNdFAST64 # define SCNdFAST64 SCNd64 # endif # if !defined SCNiFAST64 # define SCNiFAST64 SCNi64 # endif #endif #ifdef UINT64_MAX # if !defined SCNoFAST64 # define SCNoFAST64 SCNo64 # endif # if !defined SCNuFAST64 # define SCNuFAST64 SCNu64 # endif # if !defined SCNxFAST64 # define SCNxFAST64 SCNx64 # endif #endif #if !defined SCNdMAX # if @INT32_MAX_LT_INTMAX_MAX@ # define SCNdMAX SCNd64 # else # define SCNdMAX "ld" # endif #endif #if !defined SCNiMAX # if @INT32_MAX_LT_INTMAX_MAX@ # define SCNiMAX SCNi64 # else # define SCNiMAX "li" # endif #endif #if !defined SCNoMAX # if @UINT32_MAX_LT_UINTMAX_MAX@ # define SCNoMAX SCNo64 # else # define SCNoMAX "lo" # endif #endif #if !defined SCNuMAX # if @UINT32_MAX_LT_UINTMAX_MAX@ # define SCNuMAX SCNu64 # else # define SCNuMAX "lu" # endif #endif #if !defined SCNxMAX # if @UINT32_MAX_LT_UINTMAX_MAX@ # define SCNxMAX SCNx64 # else # define SCNxMAX "lx" # endif #endif #if !defined SCNdPTR # ifdef INTPTR_MAX # define SCNdPTR @PRIPTR_PREFIX@ "d" # endif #endif #if !defined SCNiPTR # ifdef INTPTR_MAX # define SCNiPTR @PRIPTR_PREFIX@ "i" # endif #endif #if !defined SCNoPTR # ifdef UINTPTR_MAX # define SCNoPTR @PRIPTR_PREFIX@ "o" # endif #endif #if !defined SCNuPTR # ifdef UINTPTR_MAX # define SCNuPTR @PRIPTR_PREFIX@ "u" # endif #endif #if !defined SCNxPTR # ifdef UINTPTR_MAX # define SCNxPTR @PRIPTR_PREFIX@ "x" # endif #endif /* 7.8.2 Functions for greatest-width integer types */ #ifdef __cplusplus extern "C" { #endif #if @GNULIB_IMAXABS@ # if !@HAVE_DECL_IMAXABS@ extern intmax_t imaxabs (intmax_t); # endif #elif defined GNULIB_POSIXCHECK # undef imaxabs # if HAVE_RAW_DECL_IMAXABS _GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - " "use gnulib module imaxabs for portability"); # endif #endif #if @GNULIB_IMAXDIV@ # if !@HAVE_IMAXDIV_T@ # if !GNULIB_defined_imaxdiv_t typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; # define GNULIB_defined_imaxdiv_t 1 # endif # endif # if !@HAVE_DECL_IMAXDIV@ extern imaxdiv_t imaxdiv (intmax_t, intmax_t); # endif #elif defined GNULIB_POSIXCHECK # undef imaxdiv # if HAVE_RAW_DECL_IMAXDIV _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - " "use gnulib module imaxdiv for portability"); # endif #endif #if @GNULIB_STRTOIMAX@ # if @REPLACE_STRTOIMAX@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strtoimax # define strtoimax rpl_strtoimax # endif _GL_FUNCDECL_RPL (strtoimax, intmax_t, (const char *restrict, char **restrict, int) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtoimax, intmax_t, (const char *restrict, char **restrict, int)); # else # if !@HAVE_DECL_STRTOIMAX@ # undef strtoimax _GL_FUNCDECL_SYS (strtoimax, intmax_t, (const char *restrict, char **restrict, int) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoimax, intmax_t, (const char *restrict, char **restrict, int)); # endif _GL_CXXALIASWARN (strtoimax); #elif defined GNULIB_POSIXCHECK # undef strtoimax # if HAVE_RAW_DECL_STRTOIMAX _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - " "use gnulib module strtoimax for portability"); # endif #endif #if @GNULIB_STRTOUMAX@ # if @REPLACE_STRTOUMAX@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strtoumax # define strtoumax rpl_strtoumax # endif _GL_FUNCDECL_RPL (strtoumax, uintmax_t, (const char *restrict, char **restrict, int) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtoumax, uintmax_t, (const char *restrict, char **restrict, int)); # else # if !@HAVE_DECL_STRTOUMAX@ # undef strtoumax _GL_FUNCDECL_SYS (strtoumax, uintmax_t, (const char *restrict, char **restrict, int) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *restrict, char **restrict, int)); # endif _GL_CXXALIASWARN (strtoumax); #elif defined GNULIB_POSIXCHECK # undef strtoumax # if HAVE_RAW_DECL_STRTOUMAX _GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - " "use gnulib module strtoumax for portability"); # endif #endif /* Don't bother defining or declaring wcstoimax and wcstoumax, since wide-character functions like this are hardly ever useful. */ #ifdef __cplusplus } #endif #endif /* !defined INTTYPES_H && !defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H */ kbuild-3608/src/grep/lib/dfa.c0000664000175000017500000041260114670377422016116 0ustar locutuslocutus/* dfa.c - deterministic extended regexp routines for GNU Copyright (C) 1988, 1998, 2000, 2002, 2004-2005, 2007-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA */ /* Written June, 1988 by Mike Haertel Modified July, 1988 by Arthur David Olson to assist BMG speedups */ #include #include "dfa.h" #include "flexmember.h" #include "idx.h" #include "verify.h" #include #include #include #include #include #include #include /* Pacify gcc -Wanalyzer-null-dereference in areas where GCC understandably cannot deduce that the input comes from a well-formed regular expression. There's little point to the runtime overhead of 'assert' instead of 'assume_nonnull' when the MMU will check anyway. */ #define assume_nonnull(x) assume ((x) != NULL) static bool streq (char const *a, char const *b) { return strcmp (a, b) == 0; } static bool isasciidigit (char c) { return '0' <= c && c <= '9'; } #include "gettext.h" #define _(str) gettext (str) #include #include "xalloc.h" #include "localeinfo.h" #ifndef FALLTHROUGH # if 201710L < __STDC_VERSION__ # define FALLTHROUGH [[__fallthrough__]] # elif (__GNUC__ >= 7) || (__clang_major__ >= 10) # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) # endif #endif #ifndef MIN # define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif /* HPUX defines these as macros in sys/param.h. */ #ifdef setbit # undef setbit #endif #ifdef clrbit # undef clrbit #endif /* For code that does not use Gnulib’s isblank module. */ #if !defined isblank && !defined HAVE_ISBLANK && !defined GNULIB_ISBLANK # define isblank dfa_isblank static int isblank (int c) { return c == ' ' || c == '\t'; } #endif /* First integer value that is greater than any character code. */ enum { NOTCHAR = 1 << CHAR_BIT }; #ifdef UINT_LEAST64_MAX /* Number of bits used in a charclass word. */ enum { CHARCLASS_WORD_BITS = 64 }; /* This represents part of a character class. It must be unsigned and at least CHARCLASS_WORD_BITS wide. Any excess bits are zero. */ typedef uint_least64_t charclass_word; /* Part of a charclass initializer that represents 64 bits' worth of a charclass, where LO and HI are the low and high-order 32 bits of the 64-bit quantity. */ # define CHARCLASS_PAIR(lo, hi) (((charclass_word) (hi) << 32) + (lo)) #else /* Fallbacks for pre-C99 hosts that lack 64-bit integers. */ enum { CHARCLASS_WORD_BITS = 32 }; typedef unsigned long charclass_word; # define CHARCLASS_PAIR(lo, hi) lo, hi #endif /* An initializer for a charclass whose 32-bit words are A through H. */ #define CHARCLASS_INIT(a, b, c, d, e, f, g, h) \ {{ \ CHARCLASS_PAIR (a, b), CHARCLASS_PAIR (c, d), \ CHARCLASS_PAIR (e, f), CHARCLASS_PAIR (g, h) \ }} /* The maximum useful value of a charclass_word; all used bits are 1. */ static charclass_word const CHARCLASS_WORD_MASK = ((charclass_word) 1 << (CHARCLASS_WORD_BITS - 1) << 1) - 1; /* Number of words required to hold a bit for every character. */ enum { CHARCLASS_WORDS = (NOTCHAR + CHARCLASS_WORD_BITS - 1) / CHARCLASS_WORD_BITS }; /* Sets of unsigned characters are stored as bit vectors in arrays of ints. */ typedef struct { charclass_word w[CHARCLASS_WORDS]; } charclass; /* Convert a possibly-signed character to an unsigned character. This is a bit safer than casting to unsigned char, since it catches some type errors that the cast doesn't. */ static unsigned char to_uchar (char ch) { return ch; } /* Contexts tell us whether a character is a newline or a word constituent. Word-constituent characters are those that satisfy iswalnum, plus '_'. Each character has a single CTX_* value; bitmasks of CTX_* values denote a particular character class. A state also stores a context value, which is a bitmask of CTX_* values. A state's context represents a set of characters that the state's predecessors must match. For example, a state whose context does not include CTX_LETTER will never have transitions where the previous character is a word constituent. A state whose context is CTX_ANY might have transitions from any character. */ enum { CTX_NONE = 1, CTX_LETTER = 2, CTX_NEWLINE = 4, CTX_ANY = 7 }; /* Sometimes characters can only be matched depending on the surrounding context. Such context decisions depend on what the previous character was, and the value of the current (lookahead) character. Context dependent constraints are encoded as 9-bit integers. Each bit that is set indicates that the constraint succeeds in the corresponding context. bit 6-8 - valid contexts when next character is CTX_NEWLINE bit 3-5 - valid contexts when next character is CTX_LETTER bit 0-2 - valid contexts when next character is CTX_NONE succeeds_in_context determines whether a given constraint succeeds in a particular context. Prev is a bitmask of possible context values for the previous character, curr is the (single-bit) context value for the lookahead character. */ static int newline_constraint (int constraint) { return (constraint >> 6) & 7; } static int letter_constraint (int constraint) { return (constraint >> 3) & 7; } static int other_constraint (int constraint) { return constraint & 7; } static bool succeeds_in_context (int constraint, int prev, int curr) { return !! (((curr & CTX_NONE ? other_constraint (constraint) : 0) \ | (curr & CTX_LETTER ? letter_constraint (constraint) : 0) \ | (curr & CTX_NEWLINE ? newline_constraint (constraint) : 0)) \ & prev); } /* The following describe what a constraint depends on. */ static bool prev_newline_dependent (int constraint) { return ((constraint ^ constraint >> 2) & 0111) != 0; } static bool prev_letter_dependent (int constraint) { return ((constraint ^ constraint >> 1) & 0111) != 0; } /* Tokens that match the empty string subject to some constraint actually work by applying that constraint to determine what may follow them, taking into account what has gone before. The following values are the constraints corresponding to the special tokens previously defined. */ enum { NO_CONSTRAINT = 0777, BEGLINE_CONSTRAINT = 0444, ENDLINE_CONSTRAINT = 0700, BEGWORD_CONSTRAINT = 0050, ENDWORD_CONSTRAINT = 0202, LIMWORD_CONSTRAINT = 0252, NOTLIMWORD_CONSTRAINT = 0525 }; /* The regexp is parsed into an array of tokens in postfix form. Some tokens are operators and others are terminal symbols. Most (but not all) of these codes are returned by the lexical analyzer. */ typedef ptrdiff_t token; static token const TOKEN_MAX = PTRDIFF_MAX; /* States are indexed by state_num values. These are normally nonnegative but -1 is used as a special value. */ typedef ptrdiff_t state_num; /* Predefined token values. */ enum { END = -1, /* END is a terminal symbol that matches the end of input; any value of END or less in the parse tree is such a symbol. Accepting states of the DFA are those that would have a transition on END. This is -1, not some more-negative value, to tweak the speed of comparisons to END. */ /* Ordinary character values are terminal symbols that match themselves. */ /* CSET must come last in the following list of special tokens. Otherwise, the list order matters only for performance. Related special tokens should have nearby values so that code like (t == ANYCHAR || t == MBCSET || CSET <= t) can be done with a single machine-level comparison. */ EMPTY = NOTCHAR, /* EMPTY is a terminal symbol that matches the empty string. */ QMARK, /* QMARK is an operator of one argument that matches zero or one occurrences of its argument. */ STAR, /* STAR is an operator of one argument that matches the Kleene closure (zero or more occurrences) of its argument. */ PLUS, /* PLUS is an operator of one argument that matches the positive closure (one or more occurrences) of its argument. */ REPMN, /* REPMN is a lexical token corresponding to the {m,n} construct. REPMN never appears in the compiled token vector. */ CAT, /* CAT is an operator of two arguments that matches the concatenation of its arguments. CAT is never returned by the lexical analyzer. */ OR, /* OR is an operator of two arguments that matches either of its arguments. */ LPAREN, /* LPAREN never appears in the parse tree, it is only a lexeme. */ RPAREN, /* RPAREN never appears in the parse tree. */ #if defined(KMK_GREP) && defined(KBUILD_OS_WINDOWS) # define WCHAR DFA_WCHAR #endif WCHAR, /* Only returned by lex. wctok contains the wide character representation. */ ANYCHAR, /* ANYCHAR is a terminal symbol that matches a valid multibyte (or single byte) character. It is used only if MB_CUR_MAX > 1. */ BEG, /* BEG is an initial symbol that matches the beginning of input. */ BEGLINE, /* BEGLINE is a terminal symbol that matches the empty string at the beginning of a line. */ ENDLINE, /* ENDLINE is a terminal symbol that matches the empty string at the end of a line. */ BEGWORD, /* BEGWORD is a terminal symbol that matches the empty string at the beginning of a word. */ ENDWORD, /* ENDWORD is a terminal symbol that matches the empty string at the end of a word. */ LIMWORD, /* LIMWORD is a terminal symbol that matches the empty string at the beginning or the end of a word. */ NOTLIMWORD, /* NOTLIMWORD is a terminal symbol that matches the empty string not at the beginning or end of a word. */ BACKREF, /* BACKREF is generated by \ or by any other construct that is not completely handled. If the scanner detects a transition on backref, it returns a kind of "semi-success" indicating that the match will have to be verified with a backtracking matcher. */ MBCSET, /* MBCSET is similar to CSET, but for multibyte characters. */ CSET /* CSET and (and any value greater) is a terminal symbol that matches any of a class of characters. */ }; /* States of the recognizer correspond to sets of positions in the parse tree, together with the constraints under which they may be matched. So a position is encoded as an index into the parse tree together with a constraint. */ typedef struct { idx_t index; /* Index into the parse array. */ unsigned int constraint; /* Constraint for matching this position. */ } position; /* Sets of positions are stored as arrays. */ typedef struct { position *elems; /* Elements of this position set. */ idx_t nelem; /* Number of elements in this set. */ idx_t alloc; /* Number of elements allocated in ELEMS. */ } position_set; /* A state of the dfa consists of a set of positions, some flags, and the token value of the lowest-numbered position of the state that contains an END token. */ typedef struct { size_t hash; /* Hash of the positions of this state. */ position_set elems; /* Positions this state could match. */ unsigned char context; /* Context from previous state. */ unsigned short constraint; /* Constraint for this state to accept. */ position_set mbps; /* Positions which can match multibyte characters or the follows, e.g., period. Used only if MB_CUR_MAX > 1. */ state_num mb_trindex; /* Index of this state in MB_TRANS, or negative if the state does not have ANYCHAR. */ } dfa_state; /* Maximum for any transition table count. This should be at least 3, for the initial state setup. */ enum { MAX_TRCOUNT = 1024 }; /* A bracket operator. e.g., [a-c], [[:alpha:]], etc. */ struct mb_char_classes { ptrdiff_t cset; bool invert; wchar_t *chars; /* Normal characters. */ idx_t nchars; idx_t nchars_alloc; }; struct regex_syntax { /* Syntax bits controlling the behavior of the lexical analyzer. */ reg_syntax_t syntax_bits; bool syntax_bits_set; /* Flag for case-folding letters into sets. */ bool case_fold; /* True if ^ and $ match only the start and end of data, and do not match end-of-line within data. */ bool anchor; /* End-of-line byte in data. */ unsigned char eolbyte; /* Cache of char-context values. */ char sbit[NOTCHAR]; /* If never_trail[B], the byte B cannot be a non-initial byte in a multibyte character. */ bool never_trail[NOTCHAR]; /* Set of characters considered letters. */ charclass letters; /* Set of characters that are newline. */ charclass newline; }; /* Lexical analyzer. All the dross that deals with the obnoxious GNU Regex syntax bits is located here. The poor, suffering reader is referred to the GNU Regex documentation for the meaning of the @#%!@#%^!@ syntax bits. */ struct lexer_state { char const *ptr; /* Pointer to next input character. */ idx_t left; /* Number of characters remaining. */ token lasttok; /* Previous token returned; initially END. */ idx_t parens; /* Count of outstanding left parens. */ int minrep, maxrep; /* Repeat counts for {m,n}. */ /* Wide character representation of the current multibyte character, or WEOF if there was an encoding error. Used only if MB_CUR_MAX > 1. */ wint_t wctok; /* The most recently analyzed multibyte bracket expression. */ struct mb_char_classes brack; /* We're separated from beginning or (, | only by zero-width characters. */ bool laststart; }; /* Recursive descent parser for regular expressions. */ struct parser_state { token tok; /* Lookahead token. */ idx_t depth; /* Current depth of a hypothetical stack holding deferred productions. This is used to determine the depth that will be required of the real stack later on in dfaanalyze. */ }; /* A compiled regular expression. */ struct dfa { /* Fields filled by the scanner. */ charclass *charclasses; /* Array of character sets for CSET tokens. */ idx_t cindex; /* Index for adding new charclasses. */ idx_t calloc; /* Number of charclasses allocated. */ ptrdiff_t canychar; /* Index of anychar class, or -1. */ /* Scanner state */ struct lexer_state lex; /* Parser state */ struct parser_state parse; /* Fields filled by the parser. */ token *tokens; /* Postfix parse array. */ idx_t tindex; /* Index for adding new tokens. */ idx_t talloc; /* Number of tokens currently allocated. */ idx_t depth; /* Depth required of an evaluation stack used for depth-first traversal of the parse tree. */ idx_t nleaves; /* Number of non-EMPTY leaves in the parse tree. */ idx_t nregexps; /* Count of parallel regexps being built with dfaparse. */ bool fast; /* The DFA is fast. */ bool epsilon; /* Does a token match only the empty string? */ token utf8_anychar_classes[9]; /* To lower ANYCHAR in UTF-8 locales. */ mbstate_t mbs; /* Multibyte conversion state. */ /* The following are valid only if MB_CUR_MAX > 1. */ /* The value of multibyte_prop[i] is defined by following rule. if tokens[i] < NOTCHAR bit 0 : tokens[i] is the first byte of a character, including single-byte characters. bit 1 : tokens[i] is the last byte of a character, including single-byte characters. e.g. tokens = 'single_byte_a', 'multi_byte_A', single_byte_b' = 'sb_a', 'mb_A(1st byte)', 'mb_A(2nd byte)', 'mb_A(3rd byte)', 'sb_b' multibyte_prop = 3 , 1 , 0 , 2 , 3 */ char *multibyte_prop; /* Fields filled by the superset. */ struct dfa *superset; /* Hint of the dfa. */ /* Fields filled by the state builder. */ dfa_state *states; /* States of the dfa. */ state_num sindex; /* Index for adding new states. */ idx_t salloc; /* Number of states currently allocated. */ /* Fields filled by the parse tree->NFA conversion. */ position_set *follows; /* Array of follow sets, indexed by position index. The follow of a position is the set of positions containing characters that could conceivably follow a character matching the given position in a string matching the regexp. Allocated to the maximum possible position index. */ bool searchflag; /* We are supposed to build a searching as opposed to an exact matcher. A searching matcher finds the first and shortest string matching a regexp anywhere in the buffer, whereas an exact matcher finds the longest string matching, but anchored to the beginning of the buffer. */ /* Fields filled by dfaanalyze. */ int *constraints; /* Array of union of accepting constraints in the follow of a position. */ int *separates; /* Array of contexts on follow of a position. */ /* Fields filled by dfaexec. */ state_num tralloc; /* Number of transition tables that have slots so far, not counting trans[-1] and trans[-2]. */ int trcount; /* Number of transition tables that have been built, other than for initial states. */ int min_trcount; /* Number of initial states. Equivalently, the minimum state number for which trcount counts transitions. */ state_num **trans; /* Transition tables for states that can never accept. If the transitions for a state have not yet been computed, or the state could possibly accept, its entry in this table is NULL. This points to two past the start of the allocated array, and trans[-1] and trans[-2] are always NULL. */ state_num **fails; /* Transition tables after failing to accept on a state that potentially could do so. If trans[i] is non-null, fails[i] must be null. */ char *success; /* Table of acceptance conditions used in dfaexec and computed in build_state. */ state_num *newlines; /* Transitions on newlines. The entry for a newline in any transition table is always -1 so we can count lines without wasting too many cycles. The transition for a newline is stored separately and handled as a special case. Newline is also used as a sentinel at the end of the buffer. */ state_num initstate_notbol; /* Initial state for CTX_LETTER and CTX_NONE context in multibyte locales, in which we do not distinguish between their contexts, as not supported word. */ position_set mb_follows; /* Follow set added by ANYCHAR on demand. */ state_num **mb_trans; /* Transition tables for states with ANYCHAR. */ state_num mb_trcount; /* Number of transition tables for states with ANYCHAR that have actually been built. */ /* Syntax configuration. This is near the end so that dfacopysyntax can memset up to here. */ struct regex_syntax syntax; /* Information derived from the locale. This is at the end so that a quick memset need not clear it specially. */ /* dfaexec implementation. */ char *(*dfaexec) (struct dfa *, char const *, char *, bool, ptrdiff_t *, bool *); /* Other cached information derived from the locale. */ struct localeinfo localeinfo; }; /* User access to dfa internals. */ /* S could possibly be an accepting state of R. */ static bool accepting (state_num s, struct dfa const *r) { return r->states[s].constraint != 0; } /* STATE accepts in the specified context. */ static bool accepts_in_context (int prev, int curr, state_num state, struct dfa const *dfa) { return succeeds_in_context (dfa->states[state].constraint, prev, curr); } static void regexp (struct dfa *dfa); /* Store into *PWC the result of converting the leading bytes of the multibyte buffer S of length N bytes, using D->localeinfo.sbctowc and updating the conversion state in *D. On conversion error, convert just a single byte, to WEOF. Return the number of bytes converted. This differs from mbrtowc (PWC, S, N, &D->mbs) as follows: * PWC points to wint_t, not to wchar_t. * The last arg is a dfa *D instead of merely a multibyte conversion state D->mbs. * N is idx_t not size_t, and must be at least 1. * S[N - 1] must be a sentinel byte. * Shift encodings are not supported. * The return value is always in the range 1..N. * D->mbs is always valid afterwards. * *PWC is always set to something. */ static int mbs_to_wchar (wint_t *pwc, char const *s, idx_t n, struct dfa *d) { unsigned char uc = s[0]; wint_t wc = d->localeinfo.sbctowc[uc]; if (wc == WEOF) { wchar_t wch; size_t nbytes = mbrtowc (&wch, s, n, &d->mbs); if (0 < nbytes && nbytes < (size_t) -2) { *pwc = wch; return nbytes; } memset (&d->mbs, 0, sizeof d->mbs); } *pwc = wc; return 1; } #ifdef DEBUG static void prtok (token t) { if (t <= END) fprintf (stderr, "END"); else if (0 <= t && t < NOTCHAR) { unsigned int ch = t; fprintf (stderr, "0x%02x", ch); } else { char const *s; switch (t) { case BEG: s = "BEG"; break; case EMPTY: s = "EMPTY"; break; case BACKREF: s = "BACKREF"; break; case BEGLINE: s = "BEGLINE"; break; case ENDLINE: s = "ENDLINE"; break; case BEGWORD: s = "BEGWORD"; break; case ENDWORD: s = "ENDWORD"; break; case LIMWORD: s = "LIMWORD"; break; case NOTLIMWORD: s = "NOTLIMWORD"; break; case QMARK: s = "QMARK"; break; case STAR: s = "STAR"; break; case PLUS: s = "PLUS"; break; case CAT: s = "CAT"; break; case OR: s = "OR"; break; case LPAREN: s = "LPAREN"; break; case RPAREN: s = "RPAREN"; break; case ANYCHAR: s = "ANYCHAR"; break; case MBCSET: s = "MBCSET"; break; default: s = "CSET"; break; } fprintf (stderr, "%s", s); } } #endif /* DEBUG */ /* Stuff pertaining to charclasses. */ static bool tstbit (unsigned int b, charclass const *c) { return c->w[b / CHARCLASS_WORD_BITS] >> b % CHARCLASS_WORD_BITS & 1; } static void setbit (unsigned int b, charclass *c) { charclass_word one = 1; c->w[b / CHARCLASS_WORD_BITS] |= one << b % CHARCLASS_WORD_BITS; } static void clrbit (unsigned int b, charclass *c) { charclass_word one = 1; c->w[b / CHARCLASS_WORD_BITS] &= ~(one << b % CHARCLASS_WORD_BITS); } static void zeroset (charclass *s) { memset (s, 0, sizeof *s); } static void fillset (charclass *s) { for (int i = 0; i < CHARCLASS_WORDS; i++) s->w[i] = CHARCLASS_WORD_MASK; } static void notset (charclass *s) { for (int i = 0; i < CHARCLASS_WORDS; ++i) s->w[i] = CHARCLASS_WORD_MASK & ~s->w[i]; } static bool equal (charclass const *s1, charclass const *s2) { charclass_word w = 0; for (int i = 0; i < CHARCLASS_WORDS; i++) w |= s1->w[i] ^ s2->w[i]; return w == 0; } static bool emptyset (charclass const *s) { charclass_word w = 0; for (int i = 0; i < CHARCLASS_WORDS; i++) w |= s->w[i]; return w == 0; } /* Ensure that the array addressed by PA holds at least I + 1 items. Either return PA, or reallocate the array and return its new address. Although PA may be null, the returned value is never null. The array holds *NITEMS items, where 0 <= I <= *NITEMS; *NITEMS is updated on reallocation. If PA is null, *NITEMS must be zero. Do not allocate more than NITEMS_MAX items total; -1 means no limit. ITEM_SIZE is the size of one item; it must be positive. Avoid O(N**2) behavior on arrays growing linearly. */ static void * maybe_realloc (void *pa, idx_t i, idx_t *nitems, ptrdiff_t nitems_max, idx_t item_size) { if (i < *nitems) return pa; return xpalloc (pa, nitems, 1, nitems_max, item_size); } /* In DFA D, find the index of charclass S, or allocate a new one. */ static idx_t charclass_index (struct dfa *d, charclass const *s) { idx_t i; for (i = 0; i < d->cindex; ++i) if (equal (s, &d->charclasses[i])) return i; d->charclasses = maybe_realloc (d->charclasses, d->cindex, &d->calloc, TOKEN_MAX - CSET, sizeof *d->charclasses); ++d->cindex; d->charclasses[i] = *s; return i; } static bool unibyte_word_constituent (struct dfa const *dfa, unsigned char c) { return dfa->localeinfo.sbctowc[c] != WEOF && (isalnum (c) || (c) == '_'); } static int char_context (struct dfa const *dfa, unsigned char c) { if (c == dfa->syntax.eolbyte && !dfa->syntax.anchor) return CTX_NEWLINE; if (unibyte_word_constituent (dfa, c)) return CTX_LETTER; return CTX_NONE; } /* Set a bit in the charclass for the given wchar_t. Do nothing if WC is represented by a multi-byte sequence. Even for MB_CUR_MAX == 1, this may happen when folding case in weird Turkish locales where dotless i/dotted I are not included in the chosen character set. Return whether a bit was set in the charclass. */ static bool setbit_wc (wint_t wc, charclass *c) { int b = wctob (wc); if (b < 0) return false; setbit (b, c); return true; } /* Set a bit for B and its case variants in the charclass C. MB_CUR_MAX must be 1. */ static void setbit_case_fold_c (int b, charclass *c) { int ub = toupper (b); for (int i = 0; i < NOTCHAR; i++) if (toupper (i) == ub) setbit (i, c); } /* Fetch the next lexical input character from the pattern. There must at least one byte of pattern input. Set DFA->lex.wctok to the value of the character or to WEOF depending on whether the input is a valid multibyte character (possibly of length 1). Then return the next input byte value, except return EOF if the input is a multibyte character of length greater than 1. */ static int fetch_wc (struct dfa *dfa) { int nbytes = mbs_to_wchar (&dfa->lex.wctok, dfa->lex.ptr, dfa->lex.left, dfa); int c = nbytes == 1 ? to_uchar (dfa->lex.ptr[0]) : EOF; dfa->lex.ptr += nbytes; dfa->lex.left -= nbytes; return c; } /* If there is no more input, report an error about unbalanced brackets. Otherwise, behave as with fetch_wc (DFA). */ static int bracket_fetch_wc (struct dfa *dfa) { if (! dfa->lex.left) dfaerror (_("unbalanced [")); return fetch_wc (dfa); } typedef int predicate (int); /* The following list maps the names of the Posix named character classes to predicate functions that determine whether a given character is in the class. The leading [ has already been eaten by the lexical analyzer. */ struct dfa_ctype { const char *name; predicate *func; bool single_byte_only; }; static const struct dfa_ctype prednames[] = { {"alpha", isalpha, false}, {"upper", isupper, false}, {"lower", islower, false}, {"digit", isdigit, true}, {"xdigit", isxdigit, false}, {"space", isspace, false}, {"punct", ispunct, false}, {"alnum", isalnum, false}, {"print", isprint, false}, {"graph", isgraph, false}, {"cntrl", iscntrl, false}, {"blank", isblank, false}, {NULL, NULL, false} }; static const struct dfa_ctype *_GL_ATTRIBUTE_PURE find_pred (const char *str) { for (int i = 0; prednames[i].name; i++) if (streq (str, prednames[i].name)) return &prednames[i]; return NULL; } /* Parse a bracket expression, which possibly includes multibyte characters. */ static token parse_bracket_exp (struct dfa *dfa) { /* This is a bracket expression that dfaexec is known to process correctly. */ bool known_bracket_exp = true; /* Used to warn about [:space:]. Bit 0 = first character is a colon. Bit 1 = last character is a colon. Bit 2 = includes any other character but a colon. Bit 3 = includes ranges, char/equiv classes or collation elements. */ int colon_warning_state; dfa->lex.brack.nchars = 0; charclass ccl; zeroset (&ccl); int c = bracket_fetch_wc (dfa); bool invert = c == '^'; if (invert) { c = bracket_fetch_wc (dfa); known_bracket_exp = dfa->localeinfo.simple; } wint_t wc = dfa->lex.wctok; int c1; wint_t wc1; colon_warning_state = (c == ':'); do { c1 = NOTCHAR; /* Mark c1 as not initialized. */ colon_warning_state &= ~2; /* Note that if we're looking at some other [:...:] construct, we just treat it as a bunch of ordinary characters. We can do this because we assume regex has checked for syntax errors before dfa is ever called. */ if (c == '[') { c1 = bracket_fetch_wc (dfa); wc1 = dfa->lex.wctok; if ((c1 == ':' && (dfa->syntax.syntax_bits & RE_CHAR_CLASSES)) || c1 == '.' || c1 == '=') { enum { MAX_BRACKET_STRING_LEN = 32 }; char str[MAX_BRACKET_STRING_LEN + 1]; int len = 0; for (;;) { c = bracket_fetch_wc (dfa); if (dfa->lex.left == 0 || (c == c1 && dfa->lex.ptr[0] == ']')) break; if (len < MAX_BRACKET_STRING_LEN) str[len++] = c; else /* This is in any case an invalid class name. */ str[0] = '\0'; } str[len] = '\0'; /* Fetch bracket. */ c = bracket_fetch_wc (dfa); wc = dfa->lex.wctok; if (c1 == ':') /* Build character class. POSIX allows character classes to match multicharacter collating elements, but the regex code does not support that, so do not worry about that possibility. */ { char const *class = (dfa->syntax.case_fold && (streq (str, "upper") || streq (str, "lower")) ? "alpha" : str); const struct dfa_ctype *pred = find_pred (class); if (!pred) dfaerror (_("invalid character class")); if (dfa->localeinfo.multibyte && !pred->single_byte_only) known_bracket_exp = false; else for (int c2 = 0; c2 < NOTCHAR; ++c2) if (pred->func (c2)) setbit (c2, &ccl); } else known_bracket_exp = false; colon_warning_state |= 8; /* Fetch new lookahead character. */ c1 = bracket_fetch_wc (dfa); wc1 = dfa->lex.wctok; continue; } /* We treat '[' as a normal character here. c/c1/wc/wc1 are already set up. */ } if (c == '\\' && (dfa->syntax.syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS)) { c = bracket_fetch_wc (dfa); wc = dfa->lex.wctok; } if (c1 == NOTCHAR) { c1 = bracket_fetch_wc (dfa); wc1 = dfa->lex.wctok; } if (c1 == '-') /* build range characters. */ { int c2 = bracket_fetch_wc (dfa); wint_t wc2 = dfa->lex.wctok; /* A bracket expression like [a-[.aa.]] matches an unknown set. Treat it like [-a[.aa.]] while parsing it, and remember that the set is unknown. */ if (c2 == '[' && dfa->lex.ptr[0] == '.') { known_bracket_exp = false; c2 = ']'; } if (c2 == ']') { /* In the case [x-], the - is an ordinary hyphen, which is left in c1, the lookahead character. */ dfa->lex.ptr--; dfa->lex.left++; } else { if (c2 == '\\' && (dfa->syntax.syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS)) { c2 = bracket_fetch_wc (dfa); wc2 = dfa->lex.wctok; } colon_warning_state |= 8; c1 = bracket_fetch_wc (dfa); wc1 = dfa->lex.wctok; /* Treat [x-y] as a range if x != y. */ if (wc != wc2 || wc == WEOF) { if (dfa->localeinfo.simple || (isasciidigit (c) & isasciidigit (c2))) { for (int ci = c; ci <= c2; ci++) if (dfa->syntax.case_fold && isalpha (ci)) setbit_case_fold_c (ci, &ccl); else setbit (ci, &ccl); } else known_bracket_exp = false; continue; } } } colon_warning_state |= (c == ':') ? 2 : 4; if (!dfa->localeinfo.multibyte) { if (dfa->syntax.case_fold && isalpha (c)) setbit_case_fold_c (c, &ccl); else setbit (c, &ccl); continue; } if (wc == WEOF) known_bracket_exp = false; else { wchar_t folded[CASE_FOLDED_BUFSIZE + 1]; int n = (dfa->syntax.case_fold ? case_folded_counterparts (wc, folded + 1) + 1 : 1); folded[0] = wc; for (int i = 0; i < n; i++) if (!setbit_wc (folded[i], &ccl)) { dfa->lex.brack.chars = maybe_realloc (dfa->lex.brack.chars, dfa->lex.brack.nchars, &dfa->lex.brack.nchars_alloc, -1, sizeof *dfa->lex.brack.chars); dfa->lex.brack.chars[dfa->lex.brack.nchars++] = folded[i]; } } } while ((wc = wc1, (c = c1) != ']')); if (colon_warning_state == 7) dfawarn (_("character class syntax is [[:space:]], not [:space:]")); if (! known_bracket_exp) return BACKREF; if (dfa->localeinfo.multibyte && (invert || dfa->lex.brack.nchars != 0)) { dfa->lex.brack.invert = invert; dfa->lex.brack.cset = emptyset (&ccl) ? -1 : charclass_index (dfa, &ccl); return MBCSET; } if (invert) { notset (&ccl); if (dfa->syntax.syntax_bits & RE_HAT_LISTS_NOT_NEWLINE) clrbit ('\n', &ccl); } return CSET + charclass_index (dfa, &ccl); } struct lexptr { char const *ptr; idx_t left; }; static void push_lex_state (struct dfa *dfa, struct lexptr *ls, char const *s) { ls->ptr = dfa->lex.ptr; ls->left = dfa->lex.left; dfa->lex.ptr = s; dfa->lex.left = strlen (s); } static void pop_lex_state (struct dfa *dfa, struct lexptr const *ls) { dfa->lex.ptr = ls->ptr; dfa->lex.left = ls->left; } static token lex (struct dfa *dfa) { bool backslash = false; /* Basic plan: We fetch a character. If it's a backslash, we set the backslash flag and go through the loop again. On the plus side, this avoids having a duplicate of the main switch inside the backslash case. On the minus side, it means that just about every case begins with "if (backslash) ...". */ for (int i = 0; i < 2; ++i) { if (! dfa->lex.left) return dfa->lex.lasttok = END; int c = fetch_wc (dfa); switch (c) { case '\\': if (backslash) goto normal_char; if (dfa->lex.left == 0) dfaerror (_("unfinished \\ escape")); backslash = true; break; case '^': if (backslash) goto normal_char; if (dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_ANCHORS || dfa->lex.lasttok == END || dfa->lex.lasttok == LPAREN || dfa->lex.lasttok == OR) return dfa->lex.lasttok = BEGLINE; goto normal_char; case '$': if (backslash) goto normal_char; if (dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_ANCHORS || dfa->lex.left == 0 || ((dfa->lex.left > !(dfa->syntax.syntax_bits & RE_NO_BK_PARENS)) && (dfa->lex.ptr[!(dfa->syntax.syntax_bits & RE_NO_BK_PARENS) & (dfa->lex.ptr[0] == '\\')] == ')')) || ((dfa->lex.left > !(dfa->syntax.syntax_bits & RE_NO_BK_VBAR)) && (dfa->lex.ptr[!(dfa->syntax.syntax_bits & RE_NO_BK_VBAR) & (dfa->lex.ptr[0] == '\\')] == '|')) || ((dfa->syntax.syntax_bits & RE_NEWLINE_ALT) && dfa->lex.left > 0 && dfa->lex.ptr[0] == '\n')) return dfa->lex.lasttok = ENDLINE; goto normal_char; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (backslash && !(dfa->syntax.syntax_bits & RE_NO_BK_REFS)) { dfa->lex.laststart = false; return dfa->lex.lasttok = BACKREF; } goto normal_char; case '`': if (backslash && !(dfa->syntax.syntax_bits & RE_NO_GNU_OPS)) { /* FIXME: should be beginning of string */ return dfa->lex.lasttok = BEGLINE; } goto normal_char; case '\'': if (backslash && !(dfa->syntax.syntax_bits & RE_NO_GNU_OPS)) { /* FIXME: should be end of string */ return dfa->lex.lasttok = ENDLINE; } goto normal_char; case '<': if (backslash && !(dfa->syntax.syntax_bits & RE_NO_GNU_OPS)) return dfa->lex.lasttok = BEGWORD; goto normal_char; case '>': if (backslash && !(dfa->syntax.syntax_bits & RE_NO_GNU_OPS)) return dfa->lex.lasttok = ENDWORD; goto normal_char; case 'b': if (backslash && !(dfa->syntax.syntax_bits & RE_NO_GNU_OPS)) return dfa->lex.lasttok = LIMWORD; goto normal_char; case 'B': if (backslash && !(dfa->syntax.syntax_bits & RE_NO_GNU_OPS)) return dfa->lex.lasttok = NOTLIMWORD; goto normal_char; case '?': if (dfa->syntax.syntax_bits & RE_LIMITED_OPS) goto normal_char; if (backslash != ((dfa->syntax.syntax_bits & RE_BK_PLUS_QM) != 0)) goto normal_char; if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS) && dfa->lex.laststart) goto normal_char; return dfa->lex.lasttok = QMARK; case '*': if (backslash) goto normal_char; if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS) && dfa->lex.laststart) goto normal_char; return dfa->lex.lasttok = STAR; case '+': if (dfa->syntax.syntax_bits & RE_LIMITED_OPS) goto normal_char; if (backslash != ((dfa->syntax.syntax_bits & RE_BK_PLUS_QM) != 0)) goto normal_char; if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS) && dfa->lex.laststart) goto normal_char; return dfa->lex.lasttok = PLUS; case '{': if (!(dfa->syntax.syntax_bits & RE_INTERVALS)) goto normal_char; if (backslash != ((dfa->syntax.syntax_bits & RE_NO_BK_BRACES) == 0)) goto normal_char; if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS) && dfa->lex.laststart) goto normal_char; /* Cases: {M} - exact count {M,} - minimum count, maximum is infinity {,N} - 0 through N {,} - 0 to infinity (same as '*') {M,N} - M through N */ { char const *p = dfa->lex.ptr; char const *lim = p + dfa->lex.left; dfa->lex.minrep = dfa->lex.maxrep = -1; for (; p != lim && isasciidigit (*p); p++) dfa->lex.minrep = (dfa->lex.minrep < 0 ? *p - '0' : MIN (RE_DUP_MAX + 1, dfa->lex.minrep * 10 + *p - '0')); if (p != lim) { if (*p != ',') dfa->lex.maxrep = dfa->lex.minrep; else { if (dfa->lex.minrep < 0) dfa->lex.minrep = 0; while (++p != lim && isasciidigit (*p)) dfa->lex.maxrep = (dfa->lex.maxrep < 0 ? *p - '0' : MIN (RE_DUP_MAX + 1, dfa->lex.maxrep * 10 + *p - '0')); } } if (! ((! backslash || (p != lim && *p++ == '\\')) && p != lim && *p++ == '}' && 0 <= dfa->lex.minrep && (dfa->lex.maxrep < 0 || dfa->lex.minrep <= dfa->lex.maxrep))) { if (dfa->syntax.syntax_bits & RE_INVALID_INTERVAL_ORD) goto normal_char; dfaerror (_("invalid content of \\{\\}")); } if (RE_DUP_MAX < dfa->lex.maxrep) dfaerror (_("regular expression too big")); dfa->lex.ptr = p; dfa->lex.left = lim - p; } dfa->lex.laststart = false; return dfa->lex.lasttok = REPMN; case '|': if (dfa->syntax.syntax_bits & RE_LIMITED_OPS) goto normal_char; if (backslash != ((dfa->syntax.syntax_bits & RE_NO_BK_VBAR) == 0)) goto normal_char; dfa->lex.laststart = true; return dfa->lex.lasttok = OR; case '\n': if (dfa->syntax.syntax_bits & RE_LIMITED_OPS || backslash || !(dfa->syntax.syntax_bits & RE_NEWLINE_ALT)) goto normal_char; dfa->lex.laststart = true; return dfa->lex.lasttok = OR; case '(': if (backslash != ((dfa->syntax.syntax_bits & RE_NO_BK_PARENS) == 0)) goto normal_char; dfa->lex.parens++; dfa->lex.laststart = true; return dfa->lex.lasttok = LPAREN; case ')': if (backslash != ((dfa->syntax.syntax_bits & RE_NO_BK_PARENS) == 0)) goto normal_char; if (dfa->lex.parens == 0 && dfa->syntax.syntax_bits & RE_UNMATCHED_RIGHT_PAREN_ORD) goto normal_char; dfa->lex.parens--; dfa->lex.laststart = false; return dfa->lex.lasttok = RPAREN; case '.': if (backslash) goto normal_char; if (dfa->canychar < 0) { charclass ccl; fillset (&ccl); if (!(dfa->syntax.syntax_bits & RE_DOT_NEWLINE)) clrbit ('\n', &ccl); if (dfa->syntax.syntax_bits & RE_DOT_NOT_NULL) clrbit ('\0', &ccl); if (dfa->localeinfo.multibyte) for (int c2 = 0; c2 < NOTCHAR; c2++) if (dfa->localeinfo.sbctowc[c2] == WEOF) clrbit (c2, &ccl); dfa->canychar = charclass_index (dfa, &ccl); } dfa->lex.laststart = false; return dfa->lex.lasttok = (dfa->localeinfo.multibyte ? ANYCHAR : CSET + dfa->canychar); case 's': case 'S': if (!backslash || (dfa->syntax.syntax_bits & RE_NO_GNU_OPS)) goto normal_char; if (!dfa->localeinfo.multibyte) { charclass ccl; zeroset (&ccl); for (int c2 = 0; c2 < NOTCHAR; ++c2) if (isspace (c2)) setbit (c2, &ccl); if (c == 'S') notset (&ccl); dfa->lex.laststart = false; return dfa->lex.lasttok = CSET + charclass_index (dfa, &ccl); } /* FIXME: see if optimizing this, as is done with ANYCHAR and add_utf8_anychar, makes sense. */ /* \s and \S are documented to be equivalent to [[:space:]] and [^[:space:]] respectively, so tell the lexer to process those strings, each minus its "already processed" '['. */ { struct lexptr ls; push_lex_state (dfa, &ls, &"^[:space:]]"[c == 's']); dfa->lex.lasttok = parse_bracket_exp (dfa); pop_lex_state (dfa, &ls); } dfa->lex.laststart = false; return dfa->lex.lasttok; case 'w': case 'W': if (!backslash || (dfa->syntax.syntax_bits & RE_NO_GNU_OPS)) goto normal_char; if (!dfa->localeinfo.multibyte) { charclass ccl; zeroset (&ccl); for (int c2 = 0; c2 < NOTCHAR; ++c2) if (dfa->syntax.sbit[c2] == CTX_LETTER) setbit (c2, &ccl); if (c == 'W') notset (&ccl); dfa->lex.laststart = false; return dfa->lex.lasttok = CSET + charclass_index (dfa, &ccl); } /* FIXME: see if optimizing this, as is done with ANYCHAR and add_utf8_anychar, makes sense. */ /* \w and \W are documented to be equivalent to [_[:alnum:]] and [^_[:alnum:]] respectively, so tell the lexer to process those strings, each minus its "already processed" '['. */ { struct lexptr ls; push_lex_state (dfa, &ls, &"^_[:alnum:]]"[c == 'w']); dfa->lex.lasttok = parse_bracket_exp (dfa); pop_lex_state (dfa, &ls); } dfa->lex.laststart = false; return dfa->lex.lasttok; case '[': if (backslash) goto normal_char; dfa->lex.laststart = false; return dfa->lex.lasttok = parse_bracket_exp (dfa); default: normal_char: dfa->lex.laststart = false; /* For multibyte character sets, folding is done in atom. Always return WCHAR. */ if (dfa->localeinfo.multibyte) return dfa->lex.lasttok = WCHAR; if (dfa->syntax.case_fold && isalpha (c)) { charclass ccl; zeroset (&ccl); setbit_case_fold_c (c, &ccl); return dfa->lex.lasttok = CSET + charclass_index (dfa, &ccl); } return dfa->lex.lasttok = c; } } /* The above loop should consume at most a backslash and some other character. */ abort (); return END; /* keeps pedantic compilers happy. */ } static void addtok_mb (struct dfa *dfa, token t, char mbprop) { if (dfa->talloc == dfa->tindex) { dfa->tokens = xpalloc (dfa->tokens, &dfa->talloc, 1, -1, sizeof *dfa->tokens); if (dfa->localeinfo.multibyte) dfa->multibyte_prop = xreallocarray (dfa->multibyte_prop, dfa->talloc, sizeof *dfa->multibyte_prop); } if (dfa->localeinfo.multibyte) dfa->multibyte_prop[dfa->tindex] = mbprop; dfa->tokens[dfa->tindex++] = t; switch (t) { case QMARK: case STAR: case PLUS: break; case CAT: case OR: dfa->parse.depth--; break; case EMPTY: dfa->epsilon = true; goto increment_depth; case BACKREF: dfa->fast = false; goto increment_nleaves; case BEGLINE: case ENDLINE: case BEGWORD: case ENDWORD: case LIMWORD: case NOTLIMWORD: dfa->epsilon = true; FALLTHROUGH; default: increment_nleaves: dfa->nleaves++; increment_depth: dfa->parse.depth++; if (dfa->depth < dfa->parse.depth) dfa->depth = dfa->parse.depth; break; } } static void addtok_wc (struct dfa *dfa, wint_t wc); /* Add the given token to the parse tree, maintaining the depth count and updating the maximum depth if necessary. */ static void addtok (struct dfa *dfa, token t) { if (dfa->localeinfo.multibyte && t == MBCSET) { bool need_or = false; /* Extract wide characters into alternations for better performance. This does not require UTF-8. */ for (idx_t i = 0; i < dfa->lex.brack.nchars; i++) { addtok_wc (dfa, dfa->lex.brack.chars[i]); if (need_or) addtok (dfa, OR); need_or = true; } dfa->lex.brack.nchars = 0; /* Wide characters have been handled above, so it is possible that the set is empty now. Do nothing in that case. */ if (dfa->lex.brack.cset != -1) { addtok (dfa, CSET + dfa->lex.brack.cset); if (need_or) addtok (dfa, OR); } } else { addtok_mb (dfa, t, 3); } } /* We treat a multibyte character as a single atom, so that DFA can treat a multibyte character as a single expression. e.g., we construct the following tree from "". */ static void addtok_wc (struct dfa *dfa, wint_t wc) { unsigned char buf[MB_LEN_MAX]; mbstate_t s = { 0 }; size_t stored_bytes = wcrtomb ((char *) buf, wc, &s); int buflen; if (stored_bytes != (size_t) -1) buflen = stored_bytes; else { /* This is merely stop-gap. buf[0] is undefined, yet skipping the addtok_mb call altogether can corrupt the heap. */ buflen = 1; buf[0] = 0; } addtok_mb (dfa, buf[0], buflen == 1 ? 3 : 1); for (int i = 1; i < buflen; i++) { addtok_mb (dfa, buf[i], i == buflen - 1 ? 2 : 0); addtok (dfa, CAT); } } static void add_utf8_anychar (struct dfa *dfa) { /* Since the Unicode Standard Version 4.0.0 (2003), a well-formed UTF-8 byte sequence has been defined as follows: ([\x00-\x7f] |[\xc2-\xdf][\x80-\xbf] |[\xe0][\xa0-\xbf][\x80-\xbf] |[\xe1-\xec\xee-\xef][\x80-\xbf][\x80-\xbf] |[\xed][\x80-\x9f][\x80-\xbf] |[\xf0][\x90-\xbf][\x80-\xbf][\x80-\xbf]) |[\xf1-\xf3][\x80-\xbf][\x80-\xbf][\x80-\xbf] |[\xf4][\x80-\x8f][\x80-\xbf][\x80-\xbf]) which I'll write more concisely "A|BC|DEC|FCC|GHC|IJCC|KCCC|LMCC", where A = [\x00-\x7f], B = [\xc2-\xdf], C = [\x80-\xbf], D = [\xe0], E = [\xa0-\xbf], F = [\xe1-\xec\xee-\xef], G = [\xed], H = [\x80-\x9f], I = [\xf0], J = [\x90-\xbf], K = [\xf1-\xf3], L = [\xf4], M = [\x80-\x8f]. This can be refactored to "A|(B|DE|GH|(F|IJ|LM|KC)C)C". */ /* Mnemonics for classes containing two or more bytes. */ enum { A, B, C, E, F, H, J, K, M }; /* Mnemonics for single-byte tokens. */ enum { D_token = 0xe0, G_token = 0xed, I_token = 0xf0, L_token = 0xf4 }; static charclass const utf8_classes[] = { /* A. 00-7f: 1-byte sequence. */ CHARCLASS_INIT (0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0, 0, 0, 0), /* B. c2-df: 1st byte of a 2-byte sequence. */ CHARCLASS_INIT (0, 0, 0, 0, 0, 0, 0xfffffffc, 0), /* C. 80-bf: non-leading bytes. */ CHARCLASS_INIT (0, 0, 0, 0, 0xffffffff, 0xffffffff, 0, 0), /* D. e0 (just a token). */ /* E. a0-bf: 2nd byte of a "DEC" sequence. */ CHARCLASS_INIT (0, 0, 0, 0, 0, 0xffffffff, 0, 0), /* F. e1-ec + ee-ef: 1st byte of an "FCC" sequence. */ CHARCLASS_INIT (0, 0, 0, 0, 0, 0, 0, 0xdffe), /* G. ed (just a token). */ /* H. 80-9f: 2nd byte of a "GHC" sequence. */ CHARCLASS_INIT (0, 0, 0, 0, 0xffff, 0, 0, 0), /* I. f0 (just a token). */ /* J. 90-bf: 2nd byte of an "IJCC" sequence. */ CHARCLASS_INIT (0, 0, 0, 0, 0xffff0000, 0xffffffff, 0, 0), /* K. f1-f3: 1st byte of a "KCCC" sequence. */ CHARCLASS_INIT (0, 0, 0, 0, 0, 0, 0, 0xe0000), /* L. f4 (just a token). */ /* M. 80-8f: 2nd byte of a "LMCC" sequence. */ CHARCLASS_INIT (0, 0, 0, 0, 0xff, 0, 0, 0), }; /* Define the character classes that are needed below. */ if (dfa->utf8_anychar_classes[0] == 0) { charclass c = utf8_classes[0]; if (! (dfa->syntax.syntax_bits & RE_DOT_NEWLINE)) clrbit ('\n', &c); if (dfa->syntax.syntax_bits & RE_DOT_NOT_NULL) clrbit ('\0', &c); dfa->utf8_anychar_classes[0] = CSET + charclass_index (dfa, &c); for (int i = 1; i < sizeof utf8_classes / sizeof *utf8_classes; i++) dfa->utf8_anychar_classes[i] = CSET + charclass_index (dfa, &utf8_classes[i]); } /* Implement the "A|(B|DE|GH|(F|IJ|LM|KC)C)C" pattern mentioned above. The token buffer is in reverse Polish order, so we get "A B D E CAT OR G H CAT OR F I J CAT OR L M CAT OR K C CAT OR C CAT OR C CAT OR". */ addtok (dfa, dfa->utf8_anychar_classes[A]); addtok (dfa, dfa->utf8_anychar_classes[B]); addtok (dfa, D_token); addtok (dfa, dfa->utf8_anychar_classes[E]); addtok (dfa, CAT); addtok (dfa, OR); addtok (dfa, G_token); addtok (dfa, dfa->utf8_anychar_classes[H]); addtok (dfa, CAT); addtok (dfa, OR); addtok (dfa, dfa->utf8_anychar_classes[F]); addtok (dfa, I_token); addtok (dfa, dfa->utf8_anychar_classes[J]); addtok (dfa, CAT); addtok (dfa, OR); addtok (dfa, L_token); addtok (dfa, dfa->utf8_anychar_classes[M]); addtok (dfa, CAT); addtok (dfa, OR); addtok (dfa, dfa->utf8_anychar_classes[K]); for (int i = 0; i < 3; i++) { addtok (dfa, dfa->utf8_anychar_classes[C]); addtok (dfa, CAT); addtok (dfa, OR); } } /* The grammar understood by the parser is as follows. regexp: regexp OR branch branch branch: branch closure closure closure: closure QMARK closure STAR closure PLUS closure REPMN atom atom: ANYCHAR MBCSET CSET BACKREF BEGLINE ENDLINE BEGWORD ENDWORD LIMWORD NOTLIMWORD LPAREN regexp RPAREN The parser builds a parse tree in postfix form in an array of tokens. */ static void atom (struct dfa *dfa) { if ((0 <= dfa->parse.tok && dfa->parse.tok < NOTCHAR) || dfa->parse.tok >= CSET || dfa->parse.tok == BEG || dfa->parse.tok == BACKREF || dfa->parse.tok == BEGLINE || dfa->parse.tok == ENDLINE || dfa->parse.tok == BEGWORD || dfa->parse.tok == ENDWORD || dfa->parse.tok == LIMWORD || dfa->parse.tok == NOTLIMWORD || dfa->parse.tok == ANYCHAR || dfa->parse.tok == MBCSET) { if (dfa->parse.tok == ANYCHAR && dfa->localeinfo.using_utf8) { /* For UTF-8 expand the period to a series of CSETs that define a valid UTF-8 character. This avoids using the slow multibyte path. I'm pretty sure it would be both profitable and correct to do it for any encoding; however, the optimization must be done manually as it is done above in add_utf8_anychar. So, let's start with UTF-8: it is the most used, and the structure of the encoding makes the correctness more obvious. */ add_utf8_anychar (dfa); } else addtok (dfa, dfa->parse.tok); dfa->parse.tok = lex (dfa); } else if (dfa->parse.tok == WCHAR) { if (dfa->lex.wctok == WEOF) addtok (dfa, BACKREF); else { addtok_wc (dfa, dfa->lex.wctok); if (dfa->syntax.case_fold) { wchar_t folded[CASE_FOLDED_BUFSIZE]; int n = case_folded_counterparts (dfa->lex.wctok, folded); for (int i = 0; i < n; i++) { addtok_wc (dfa, folded[i]); addtok (dfa, OR); } } } dfa->parse.tok = lex (dfa); } else if (dfa->parse.tok == LPAREN) { dfa->parse.tok = lex (dfa); regexp (dfa); if (dfa->parse.tok != RPAREN) dfaerror (_("unbalanced (")); dfa->parse.tok = lex (dfa); } else addtok (dfa, EMPTY); } /* Return the number of tokens in the given subexpression. */ static idx_t _GL_ATTRIBUTE_PURE nsubtoks (struct dfa const *dfa, idx_t tindex) { switch (dfa->tokens[tindex - 1]) { default: return 1; case QMARK: case STAR: case PLUS: return 1 + nsubtoks (dfa, tindex - 1); case CAT: case OR: { idx_t ntoks1 = nsubtoks (dfa, tindex - 1); return 1 + ntoks1 + nsubtoks (dfa, tindex - 1 - ntoks1); } } } /* Copy the given subexpression to the top of the tree. */ static void copytoks (struct dfa *dfa, idx_t tindex, idx_t ntokens) { if (dfa->localeinfo.multibyte) for (idx_t i = 0; i < ntokens; i++) addtok_mb (dfa, dfa->tokens[tindex + i], dfa->multibyte_prop[tindex + i]); else for (idx_t i = 0; i < ntokens; i++) addtok_mb (dfa, dfa->tokens[tindex + i], 3); } static void closure (struct dfa *dfa) { atom (dfa); while (dfa->parse.tok == QMARK || dfa->parse.tok == STAR || dfa->parse.tok == PLUS || dfa->parse.tok == REPMN) if (dfa->parse.tok == REPMN && (dfa->lex.minrep || dfa->lex.maxrep)) { idx_t ntokens = nsubtoks (dfa, dfa->tindex); idx_t tindex = dfa->tindex - ntokens; if (dfa->lex.maxrep < 0) addtok (dfa, PLUS); if (dfa->lex.minrep == 0) addtok (dfa, QMARK); int i; for (i = 1; i < dfa->lex.minrep; i++) { copytoks (dfa, tindex, ntokens); addtok (dfa, CAT); } for (; i < dfa->lex.maxrep; i++) { copytoks (dfa, tindex, ntokens); addtok (dfa, QMARK); addtok (dfa, CAT); } dfa->parse.tok = lex (dfa); } else if (dfa->parse.tok == REPMN) { dfa->tindex -= nsubtoks (dfa, dfa->tindex); dfa->parse.tok = lex (dfa); closure (dfa); } else { addtok (dfa, dfa->parse.tok); dfa->parse.tok = lex (dfa); } } static void branch (struct dfa* dfa) { closure (dfa); while (dfa->parse.tok != RPAREN && dfa->parse.tok != OR && dfa->parse.tok >= 0) { closure (dfa); addtok (dfa, CAT); } } static void regexp (struct dfa *dfa) { branch (dfa); while (dfa->parse.tok == OR) { dfa->parse.tok = lex (dfa); branch (dfa); addtok (dfa, OR); } } /* Parse a string S of length LEN into D. S can include NUL characters. This is the main entry point for the parser. */ void dfaparse (char const *s, idx_t len, struct dfa *d) { d->lex.ptr = s; d->lex.left = len; d->lex.lasttok = END; d->lex.laststart = true; if (!d->syntax.syntax_bits_set) dfaerror (_("no syntax specified")); if (!d->nregexps) addtok (d, BEG); d->parse.tok = lex (d); d->parse.depth = d->depth; regexp (d); if (d->parse.tok != END) dfaerror (_("unbalanced )")); addtok (d, END - d->nregexps); addtok (d, CAT); if (d->nregexps) addtok (d, OR); ++d->nregexps; } /* Some primitives for operating on sets of positions. */ /* Copy one set to another. */ static void copy (position_set const *src, position_set *dst) { if (dst->alloc < src->nelem) { free (dst->elems); dst->elems = xpalloc (NULL, &dst->alloc, src->nelem - dst->alloc, -1, sizeof *dst->elems); } dst->nelem = src->nelem; if (src->nelem != 0) memcpy (dst->elems, src->elems, src->nelem * sizeof *dst->elems); } static void alloc_position_set (position_set *s, idx_t size) { s->elems = xnmalloc (size, sizeof *s->elems); s->alloc = size; s->nelem = 0; } /* Insert position P in set S. S is maintained in sorted order on decreasing index. If there is already an entry in S with P.index then merge (logically-OR) P's constraints into the one in S. S->elems must point to an array large enough to hold the resulting set. */ static void insert (position p, position_set *s) { idx_t count = s->nelem; idx_t lo = 0, hi = count; while (lo < hi) { idx_t mid = (lo + hi) >> 1; if (s->elems[mid].index < p.index) lo = mid + 1; else if (s->elems[mid].index == p.index) { s->elems[mid].constraint |= p.constraint; return; } else hi = mid; } s->elems = maybe_realloc (s->elems, count, &s->alloc, -1, sizeof *s->elems); for (idx_t i = count; i > lo; i--) s->elems[i] = s->elems[i - 1]; s->elems[lo] = p; ++s->nelem; } static void append (position p, position_set *s) { idx_t count = s->nelem; s->elems = maybe_realloc (s->elems, count, &s->alloc, -1, sizeof *s->elems); s->elems[s->nelem++] = p; } /* Merge S1 and S2 (with the additional constraint C2) into M. The result is as if the positions of S1, and of S2 with the additional constraint C2, were inserted into an initially empty set. */ static void merge_constrained (position_set const *s1, position_set const *s2, unsigned int c2, position_set *m) { idx_t i = 0, j = 0; if (m->alloc - s1->nelem < s2->nelem) { free (m->elems); m->alloc = s1->nelem; m->elems = xpalloc (NULL, &m->alloc, s2->nelem, -1, sizeof *m->elems); } m->nelem = 0; while (i < s1->nelem || j < s2->nelem) if (! (j < s2->nelem) || (i < s1->nelem && s1->elems[i].index <= s2->elems[j].index)) { unsigned int c = ((i < s1->nelem && j < s2->nelem && s1->elems[i].index == s2->elems[j].index) ? s2->elems[j++].constraint & c2 : 0); m->elems[m->nelem].index = s1->elems[i].index; m->elems[m->nelem++].constraint = s1->elems[i++].constraint | c; } else { if (s2->elems[j].constraint & c2) { m->elems[m->nelem].index = s2->elems[j].index; m->elems[m->nelem++].constraint = s2->elems[j].constraint & c2; } j++; } } /* Merge two sets of positions into a third. The result is exactly as if the positions of both sets were inserted into an initially empty set. */ static void merge (position_set const *s1, position_set const *s2, position_set *m) { merge_constrained (s1, s2, -1, m); } /* Merge into DST all the elements of SRC, possibly destroying the contents of the temporary M. */ static void merge2 (position_set *dst, position_set const *src, position_set *m) { if (src->nelem < 4) { for (idx_t i = 0; i < src->nelem; i++) insert (src->elems[i], dst); } else { merge (src, dst, m); copy (m, dst); } } /* Delete a position from a set. Return the nonzero constraint of the deleted position, or zero if there was no such position. */ static unsigned int delete (idx_t del, position_set *s) { idx_t count = s->nelem; idx_t lo = 0, hi = count; while (lo < hi) { idx_t mid = (lo + hi) >> 1; if (s->elems[mid].index < del) lo = mid + 1; else if (s->elems[mid].index == del) { unsigned int c = s->elems[mid].constraint; idx_t i; for (i = mid; i + 1 < count; i++) s->elems[i] = s->elems[i + 1]; s->nelem = i; return c; } else hi = mid; } return 0; } /* Replace a position with the followed set. */ static void replace (position_set *dst, idx_t del, position_set *add, unsigned int constraint, position_set *tmp) { unsigned int c = delete (del, dst) & constraint; if (c) { copy (dst, tmp); merge_constrained (tmp, add, c, dst); } } /* Find the index of the state corresponding to the given position set with the given preceding context, or create a new state if there is no such state. Context tells whether we got here on a newline or letter. */ static state_num state_index (struct dfa *d, position_set const *s, int context) { size_t hash = 0; int constraint = 0; state_num i; for (i = 0; i < s->nelem; ++i) { idx_t ind = s->elems[i].index; hash ^= ind + s->elems[i].constraint; } /* Try to find a state that exactly matches the proposed one. */ for (i = 0; i < d->sindex; ++i) { if (hash != d->states[i].hash || s->nelem != d->states[i].elems.nelem || context != d->states[i].context) continue; state_num j; for (j = 0; j < s->nelem; ++j) if (s->elems[j].constraint != d->states[i].elems.elems[j].constraint || s->elems[j].index != d->states[i].elems.elems[j].index) break; if (j == s->nelem) return i; } #ifdef DEBUG fprintf (stderr, "new state %td\n nextpos:", i); for (state_num j = 0; j < s->nelem; j++) { fprintf (stderr, " %td:", s->elems[j].index); prtok (d->tokens[s->elems[j].index]); } fprintf (stderr, "\n context:"); if (context ^ CTX_ANY) { if (context & CTX_NONE) fprintf (stderr, " CTX_NONE"); if (context & CTX_LETTER) fprintf (stderr, " CTX_LETTER"); if (context & CTX_NEWLINE) fprintf (stderr, " CTX_NEWLINE"); } else fprintf (stderr, " CTX_ANY"); fprintf (stderr, "\n"); #endif for (state_num j = 0; j < s->nelem; j++) { int c = d->constraints[s->elems[j].index]; if (c != 0) { if (succeeds_in_context (c, context, CTX_ANY)) constraint |= c; } else if (d->tokens[s->elems[j].index] == BACKREF) constraint = NO_CONSTRAINT; } /* Create a new state. */ d->states = maybe_realloc (d->states, d->sindex, &d->salloc, -1, sizeof *d->states); d->states[i].hash = hash; alloc_position_set (&d->states[i].elems, s->nelem); copy (s, &d->states[i].elems); d->states[i].context = context; d->states[i].constraint = constraint; d->states[i].mbps.nelem = 0; d->states[i].mbps.elems = NULL; d->states[i].mb_trindex = -1; ++d->sindex; return i; } /* Find the epsilon closure of D's set of positions. If any position of the set contains a symbol that matches the empty string in some context, replace that position with the elements of its follow labeled with an appropriate constraint. Repeat exhaustively until no funny positions are left. S->elems must be large enough to hold the result. BACKWARD is D's backward set; use and update it too. */ static void epsclosure (struct dfa const *d, position_set *backward) { position_set tmp; alloc_position_set (&tmp, d->nleaves); for (idx_t i = 0; i < d->tindex; i++) if (0 < d->follows[i].nelem) { unsigned int constraint; switch (d->tokens[i]) { default: continue; case BEGLINE: constraint = BEGLINE_CONSTRAINT; break; case ENDLINE: constraint = ENDLINE_CONSTRAINT; break; case BEGWORD: constraint = BEGWORD_CONSTRAINT; break; case ENDWORD: constraint = ENDWORD_CONSTRAINT; break; case LIMWORD: constraint = LIMWORD_CONSTRAINT; break; case NOTLIMWORD: constraint = NOTLIMWORD_CONSTRAINT; break; case EMPTY: constraint = NO_CONSTRAINT; break; } delete (i, &d->follows[i]); for (idx_t j = 0; j < backward[i].nelem; j++) replace (&d->follows[backward[i].elems[j].index], i, &d->follows[i], constraint, &tmp); for (idx_t j = 0; j < d->follows[i].nelem; j++) replace (&backward[d->follows[i].elems[j].index], i, &backward[i], NO_CONSTRAINT, &tmp); } free (tmp.elems); } /* Returns the set of contexts for which there is at least one character included in C. */ static int charclass_context (struct dfa const *dfa, charclass const *c) { int context = 0; for (int j = 0; j < CHARCLASS_WORDS; j++) { if (c->w[j] & dfa->syntax.newline.w[j]) context |= CTX_NEWLINE; if (c->w[j] & dfa->syntax.letters.w[j]) context |= CTX_LETTER; if (c->w[j] & ~(dfa->syntax.letters.w[j] | dfa->syntax.newline.w[j])) context |= CTX_NONE; } return context; } /* Returns the contexts on which the position set S depends. Each context in the set of returned contexts (let's call it SC) may have a different follow set than other contexts in SC, and also different from the follow set of the complement set (sc ^ CTX_ANY). However, all contexts in the complement set will have the same follow set. */ static int _GL_ATTRIBUTE_PURE state_separate_contexts (struct dfa *d, position_set const *s) { int separate_contexts = 0; for (idx_t j = 0; j < s->nelem; j++) separate_contexts |= d->separates[s->elems[j].index]; return separate_contexts; } enum { /* Single token is repeated. It is distinguished from non-repeated. */ OPT_REPEAT = (1 << 0), /* Multiple tokens are repeated. This flag is on at head of tokens. The node is not merged. */ OPT_LPAREN = (1 << 1), /* Multiple branches are joined. The node is not merged. */ OPT_RPAREN = (1 << 2), /* The node is walked. If the node is found in walking again, OPT_RPAREN flag is turned on. */ OPT_WALKED = (1 << 3), /* The node is queued. The node is not queued again. */ OPT_QUEUED = (1 << 4) }; static void merge_nfa_state (struct dfa *d, idx_t tindex, char *flags, position_set *merged) { position_set *follows = d->follows; idx_t nelem = 0; for (idx_t i = 0; i < follows[tindex].nelem; i++) { idx_t sindex = follows[tindex].elems[i].index; /* Skip the node as pruned in future. */ unsigned int iconstraint = follows[tindex].elems[i].constraint; if (iconstraint == 0) continue; if (d->tokens[follows[tindex].elems[i].index] <= END) { d->constraints[tindex] |= follows[tindex].elems[i].constraint; continue; } if (sindex != tindex && !(flags[sindex] & (OPT_LPAREN | OPT_RPAREN))) { idx_t j; for (j = 0; j < nelem; j++) { idx_t dindex = follows[tindex].elems[j].index; if (dindex == tindex) continue; if (follows[tindex].elems[j].constraint != iconstraint) continue; if (flags[dindex] & (OPT_LPAREN | OPT_RPAREN)) continue; if (d->tokens[sindex] != d->tokens[dindex]) continue; if ((flags[sindex] ^ flags[dindex]) & OPT_REPEAT) continue; if (flags[sindex] & OPT_REPEAT) delete (sindex, &follows[sindex]); merge2 (&follows[dindex], &follows[sindex], merged); break; } if (j < nelem) continue; } follows[tindex].elems[nelem++] = follows[tindex].elems[i]; flags[sindex] |= OPT_QUEUED; } follows[tindex].nelem = nelem; } static int compare (const void *a, const void *b) { position const *p = a, *q = b; return (p->index > q->index) - (p->index < q->index); } static void reorder_tokens (struct dfa *d) { idx_t nleaves = 0; ptrdiff_t *map = xnmalloc (d->tindex, sizeof *map); map[0] = nleaves++; for (idx_t i = 1; i < d->tindex; i++) map[i] = -1; token *tokens = xnmalloc (d->nleaves, sizeof *tokens); position_set *follows = xnmalloc (d->nleaves, sizeof *follows); int *constraints = xnmalloc (d->nleaves, sizeof *constraints); char *multibyte_prop = (d->localeinfo.multibyte ? xnmalloc (d->nleaves, sizeof *multibyte_prop) : NULL); for (idx_t i = 0; i < d->tindex; i++) { if (map[i] < 0) { free (d->follows[i].elems); d->follows[i].elems = NULL; d->follows[i].nelem = 0; continue; } tokens[map[i]] = d->tokens[i]; follows[map[i]] = d->follows[i]; constraints[map[i]] = d->constraints[i]; if (multibyte_prop != NULL) multibyte_prop[map[i]] = d->multibyte_prop[i]; for (idx_t j = 0; j < d->follows[i].nelem; j++) { if (map[d->follows[i].elems[j].index] == -1) map[d->follows[i].elems[j].index] = nleaves++; d->follows[i].elems[j].index = map[d->follows[i].elems[j].index]; } qsort (d->follows[i].elems, d->follows[i].nelem, sizeof *d->follows[i].elems, compare); } for (idx_t i = 0; i < nleaves; i++) { d->tokens[i] = tokens[i]; d->follows[i] = follows[i]; d->constraints[i] = constraints[i]; if (multibyte_prop != NULL) d->multibyte_prop[i] = multibyte_prop[i]; } d->tindex = d->nleaves = nleaves; free (tokens); free (follows); free (constraints); free (multibyte_prop); free (map); } static void dfaoptimize (struct dfa *d) { char *flags = xizalloc (d->tindex); for (idx_t i = 0; i < d->tindex; i++) { for (idx_t j = 0; j < d->follows[i].nelem; j++) { if (d->follows[i].elems[j].index == i) flags[d->follows[i].elems[j].index] |= OPT_REPEAT; else if (d->follows[i].elems[j].index < i) flags[d->follows[i].elems[j].index] |= OPT_LPAREN; else if (flags[d->follows[i].elems[j].index] &= OPT_WALKED) flags[d->follows[i].elems[j].index] |= OPT_RPAREN; else flags[d->follows[i].elems[j].index] |= OPT_WALKED; } } flags[0] |= OPT_QUEUED; position_set merged0; position_set *merged = &merged0; alloc_position_set (merged, d->nleaves); d->constraints = xicalloc (d->tindex, sizeof *d->constraints); for (idx_t i = 0; i < d->tindex; i++) if (flags[i] & OPT_QUEUED) merge_nfa_state (d, i, flags, merged); reorder_tokens (d); free (merged->elems); free (flags); } /* Perform bottom-up analysis on the parse tree, computing various functions. Note that at this point, we're pretending constructs like \< are real characters rather than constraints on what can follow them. Nullable: A node is nullable if it is at the root of a regexp that can match the empty string. * EMPTY leaves are nullable. * No other leaf is nullable. * A QMARK or STAR node is nullable. * A PLUS node is nullable if its argument is nullable. * A CAT node is nullable if both its arguments are nullable. * An OR node is nullable if either argument is nullable. Firstpos: The firstpos of a node is the set of positions (nonempty leaves) that could correspond to the first character of a string matching the regexp rooted at the given node. * EMPTY leaves have empty firstpos. * The firstpos of a nonempty leaf is that leaf itself. * The firstpos of a QMARK, STAR, or PLUS node is the firstpos of its argument. * The firstpos of a CAT node is the firstpos of the left argument, union the firstpos of the right if the left argument is nullable. * The firstpos of an OR node is the union of firstpos of each argument. Lastpos: The lastpos of a node is the set of positions that could correspond to the last character of a string matching the regexp at the given node. * EMPTY leaves have empty lastpos. * The lastpos of a nonempty leaf is that leaf itself. * The lastpos of a QMARK, STAR, or PLUS node is the lastpos of its argument. * The lastpos of a CAT node is the lastpos of its right argument, union the lastpos of the left if the right argument is nullable. * The lastpos of an OR node is the union of the lastpos of each argument. Follow: The follow of a position is the set of positions that could correspond to the character following a character matching the node in a string matching the regexp. At this point we consider special symbols that match the empty string in some context to be just normal characters. Later, if we find that a special symbol is in a follow set, we will replace it with the elements of its follow, labeled with an appropriate constraint. * Every node in the firstpos of the argument of a STAR or PLUS node is in the follow of every node in the lastpos. * Every node in the firstpos of the second argument of a CAT node is in the follow of every node in the lastpos of the first argument. Because of the postfix representation of the parse tree, the depth-first analysis is conveniently done by a linear scan with the aid of a stack. Sets are stored as arrays of the elements, obeying a stack-like allocation scheme; the number of elements in each set deeper in the stack can be used to determine the address of a particular set's array. */ static void dfaanalyze (struct dfa *d, bool searchflag) { /* Array allocated to hold position sets. */ position *posalloc = xnmalloc (d->nleaves, 2 * sizeof *posalloc); /* Firstpos and lastpos elements. */ position *firstpos = posalloc; position *lastpos = firstpos + d->nleaves; position pos; position_set tmp; /* Stack for element counts and nullable flags. */ struct { /* Whether the entry is nullable. */ bool nullable; /* Counts of firstpos and lastpos sets. */ idx_t nfirstpos; idx_t nlastpos; } *stkalloc = xnmalloc (d->depth, sizeof *stkalloc), *stk = stkalloc; position_set merged; /* Result of merging sets. */ addtok (d, CAT); idx_t tindex = d->tindex; #ifdef DEBUG fprintf (stderr, "dfaanalyze:\n"); for (idx_t i = 0; i < tindex; i++) { fprintf (stderr, " %td:", i); prtok (d->tokens[i]); } putc ('\n', stderr); #endif d->searchflag = searchflag; alloc_position_set (&merged, d->nleaves); d->follows = xicalloc (tindex, sizeof *d->follows); position_set *backward = d->epsilon ? xicalloc (tindex, sizeof *backward) : NULL; for (idx_t i = 0; i < tindex; i++) { switch (d->tokens[i]) { case EMPTY: /* The empty set is nullable. */ stk->nullable = true; /* The firstpos and lastpos of the empty leaf are both empty. */ stk->nfirstpos = stk->nlastpos = 0; stk++; break; case STAR: case PLUS: /* Every element in the lastpos of the argument is in the backward set of every element in the firstpos. */ if (d->epsilon) { tmp.elems = lastpos - stk[-1].nlastpos; tmp.nelem = stk[-1].nlastpos; for (position *p = firstpos - stk[-1].nfirstpos; p < firstpos; p++) merge2 (&backward[p->index], &tmp, &merged); } /* Every element in the firstpos of the argument is in the follow of every element in the lastpos. */ { tmp.elems = firstpos - stk[-1].nfirstpos; tmp.nelem = stk[-1].nfirstpos; for (position *p = lastpos - stk[-1].nlastpos; p < lastpos; p++) merge2 (&d->follows[p->index], &tmp, &merged); } FALLTHROUGH; case QMARK: /* A QMARK or STAR node is automatically nullable. */ if (d->tokens[i] != PLUS) stk[-1].nullable = true; break; case CAT: /* Every element in the lastpos of the first argument is in the backward set of every element in the firstpos of the second argument. */ if (backward) { tmp.nelem = stk[-2].nlastpos; tmp.elems = lastpos - stk[-1].nlastpos - stk[-2].nlastpos; for (position *p = firstpos - stk[-1].nfirstpos; p < firstpos; p++) merge2 (&backward[p->index], &tmp, &merged); } /* Every element in the firstpos of the second argument is in the follow of every element in the lastpos of the first argument. */ { tmp.nelem = stk[-1].nfirstpos; tmp.elems = firstpos - stk[-1].nfirstpos; for (position *plim = lastpos - stk[-1].nlastpos, *p = plim - stk[-2].nlastpos; p < plim; p++) merge2 (&d->follows[p->index], &tmp, &merged); } /* The firstpos of a CAT node is the firstpos of the first argument, union that of the second argument if the first is nullable. */ if (stk[-2].nullable) stk[-2].nfirstpos += stk[-1].nfirstpos; else firstpos -= stk[-1].nfirstpos; /* The lastpos of a CAT node is the lastpos of the second argument, union that of the first argument if the second is nullable. */ if (stk[-1].nullable) stk[-2].nlastpos += stk[-1].nlastpos; else { position *p = lastpos - stk[-1].nlastpos - stk[-2].nlastpos; for (idx_t j = 0; j < stk[-1].nlastpos; j++) p[j] = p[j + stk[-2].nlastpos]; lastpos -= stk[-2].nlastpos; stk[-2].nlastpos = stk[-1].nlastpos; } /* A CAT node is nullable if both arguments are nullable. */ stk[-2].nullable &= stk[-1].nullable; stk--; break; case OR: /* The firstpos is the union of the firstpos of each argument. */ stk[-2].nfirstpos += stk[-1].nfirstpos; /* The lastpos is the union of the lastpos of each argument. */ stk[-2].nlastpos += stk[-1].nlastpos; /* An OR node is nullable if either argument is nullable. */ stk[-2].nullable |= stk[-1].nullable; stk--; break; default: /* Anything else is a nonempty position. (Note that special constructs like \< are treated as nonempty strings here; an "epsilon closure" effectively makes them nullable later. Backreferences have to get a real position so we can detect transitions on them later. But they are nullable. */ stk->nullable = d->tokens[i] == BACKREF; /* This position is in its own firstpos and lastpos. */ stk->nfirstpos = stk->nlastpos = 1; stk++; firstpos->index = lastpos->index = i; firstpos->constraint = lastpos->constraint = NO_CONSTRAINT; firstpos++, lastpos++; break; } #ifdef DEBUG /* ... balance the above nonsyntactic #ifdef goo... */ fprintf (stderr, "node %td:", i); prtok (d->tokens[i]); putc ('\n', stderr); fprintf (stderr, stk[-1].nullable ? " nullable: yes\n" : " nullable: no\n"); fprintf (stderr, " firstpos:"); for (idx_t j = 0; j < stk[-1].nfirstpos; j++) { fprintf (stderr, " %td:", firstpos[j - stk[-1].nfirstpos].index); prtok (d->tokens[firstpos[j - stk[-1].nfirstpos].index]); } fprintf (stderr, "\n lastpos:"); for (idx_t j = 0; j < stk[-1].nlastpos; j++) { fprintf (stderr, " %td:", lastpos[j - stk[-1].nlastpos].index); prtok (d->tokens[lastpos[j - stk[-1].nlastpos].index]); } putc ('\n', stderr); #endif } if (backward) { /* For each follow set that is the follow set of a real position, replace it with its epsilon closure. */ epsclosure (d, backward); for (idx_t i = 0; i < tindex; i++) free (backward[i].elems); free (backward); } dfaoptimize (d); #ifdef DEBUG for (idx_t i = 0; i < tindex; i++) if (d->tokens[i] == BEG || d->tokens[i] < NOTCHAR || d->tokens[i] == BACKREF || d->tokens[i] == ANYCHAR || d->tokens[i] == MBCSET || d->tokens[i] >= CSET) { fprintf (stderr, "follows(%td:", i); prtok (d->tokens[i]); fprintf (stderr, "):"); for (idx_t j = 0; j < d->follows[i].nelem; j++) { fprintf (stderr, " %td:", d->follows[i].elems[j].index); prtok (d->tokens[d->follows[i].elems[j].index]); } putc ('\n', stderr); } #endif pos.index = 0; pos.constraint = NO_CONSTRAINT; alloc_position_set (&tmp, 1); append (pos, &tmp); d->separates = xicalloc (tindex, sizeof *d->separates); for (idx_t i = 0; i < tindex; i++) { if (prev_newline_dependent (d->constraints[i])) d->separates[i] |= CTX_NEWLINE; if (prev_letter_dependent (d->constraints[i])) d->separates[i] |= CTX_LETTER; for (idx_t j = 0; j < d->follows[i].nelem; j++) { if (prev_newline_dependent (d->follows[i].elems[j].constraint)) d->separates[i] |= CTX_NEWLINE; if (prev_letter_dependent (d->follows[i].elems[j].constraint)) d->separates[i] |= CTX_LETTER; } } /* Context wanted by some position. */ int separate_contexts = state_separate_contexts (d, &tmp); /* Build the initial state. */ if (separate_contexts & CTX_NEWLINE) state_index (d, &tmp, CTX_NEWLINE); d->initstate_notbol = d->min_trcount = state_index (d, &tmp, separate_contexts ^ CTX_ANY); if (separate_contexts & CTX_LETTER) d->min_trcount = state_index (d, &tmp, CTX_LETTER); d->min_trcount++; d->trcount = 0; free (posalloc); free (stkalloc); free (merged.elems); free (tmp.elems); } /* Make sure D's state arrays are large enough to hold NEW_STATE. */ static void realloc_trans_if_necessary (struct dfa *d) { state_num oldalloc = d->tralloc; if (oldalloc < d->sindex) { state_num **realtrans = d->trans ? d->trans - 2 : NULL; idx_t newalloc1 = realtrans ? d->tralloc + 2 : 0; realtrans = xpalloc (realtrans, &newalloc1, d->sindex - oldalloc, -1, sizeof *realtrans); realtrans[0] = realtrans[1] = NULL; d->trans = realtrans + 2; idx_t newalloc = d->tralloc = newalloc1 - 2; d->fails = xreallocarray (d->fails, newalloc, sizeof *d->fails); d->success = xreallocarray (d->success, newalloc, sizeof *d->success); d->newlines = xreallocarray (d->newlines, newalloc, sizeof *d->newlines); if (d->localeinfo.multibyte) { realtrans = d->mb_trans ? d->mb_trans - 2 : NULL; realtrans = xreallocarray (realtrans, newalloc1, sizeof *realtrans); if (oldalloc == 0) realtrans[0] = realtrans[1] = NULL; d->mb_trans = realtrans + 2; } for (; oldalloc < newalloc; oldalloc++) { d->trans[oldalloc] = NULL; d->fails[oldalloc] = NULL; if (d->localeinfo.multibyte) d->mb_trans[oldalloc] = NULL; } } } /* Calculate the transition table for a new state derived from state s for a compiled dfa d after input character uc, and return the new state number. Do not worry about all possible input characters; calculate just the group of positions that match uc. Label it with the set of characters that every position in the group matches (taking into account, if necessary, preceding context information of s). Then find the union of these positions' follows, i.e., the set of positions of the new state. For each character in the group's label, set the transition on this character to be to a state corresponding to the set's positions, and its associated backward context information, if necessary. When building a searching matcher, include the positions of state 0 in every state. The group is constructed by building an equivalence-class partition of the positions of s. For each position, find the set of characters C that it matches. Eliminate any characters from C that fail on grounds of backward context. Check whether the group's label L has nonempty intersection with C. If L - C is nonempty, create a new group labeled L - C and having the same positions as the current group, and set L to the intersection of L and C. Insert the position in the group, set C = C - L, and resume scanning. If after comparing with every group there are characters remaining in C, create a new group labeled with the characters of C and insert this position in that group. */ static state_num build_state (state_num s, struct dfa *d, unsigned char uc) { position_set follows; /* Union of the follows for each position of the current state. */ position_set group; /* Positions that match the input char. */ position_set tmp; /* Temporary space for merging sets. */ state_num state; /* New state. */ state_num state_newline; /* New state on a newline transition. */ state_num state_letter; /* New state on a letter transition. */ #ifdef DEBUG fprintf (stderr, "build state %td\n", s); #endif /* A pointer to the new transition table, and the table itself. */ state_num **ptrans = (accepting (s, d) ? d->fails : d->trans) + s; state_num *trans = *ptrans; if (!trans) { /* MAX_TRCOUNT is an arbitrary upper limit on the number of transition tables that can exist at once, other than for initial states. Often-used transition tables are quickly rebuilt, whereas rarely-used ones are cleared away. */ if (MAX_TRCOUNT <= d->trcount) { for (state_num i = d->min_trcount; i < d->tralloc; i++) { free (d->trans[i]); free (d->fails[i]); d->trans[i] = d->fails[i] = NULL; } d->trcount = 0; } d->trcount++; *ptrans = trans = xmalloc (NOTCHAR * sizeof *trans); /* Fill transition table with a default value which means that the transited state has not been calculated yet. */ for (int i = 0; i < NOTCHAR; i++) trans[i] = -2; } /* Set up the success bits for this state. */ d->success[s] = 0; if (accepts_in_context (d->states[s].context, CTX_NEWLINE, s, d)) d->success[s] |= CTX_NEWLINE; if (accepts_in_context (d->states[s].context, CTX_LETTER, s, d)) d->success[s] |= CTX_LETTER; if (accepts_in_context (d->states[s].context, CTX_NONE, s, d)) d->success[s] |= CTX_NONE; alloc_position_set (&follows, d->nleaves); /* Find the union of the follows of the positions of the group. This is a hideously inefficient loop. Fix it someday. */ for (idx_t j = 0; j < d->states[s].elems.nelem; j++) for (idx_t k = 0; k < d->follows[d->states[s].elems.elems[j].index].nelem; ++k) insert (d->follows[d->states[s].elems.elems[j].index].elems[k], &follows); /* Positions that match the input char. */ alloc_position_set (&group, d->nleaves); /* The group's label. */ charclass label; fillset (&label); for (idx_t i = 0; i < follows.nelem; i++) { charclass matches; /* Set of matching characters. */ position pos = follows.elems[i]; bool matched = false; if (d->tokens[pos.index] >= 0 && d->tokens[pos.index] < NOTCHAR) { zeroset (&matches); setbit (d->tokens[pos.index], &matches); if (d->tokens[pos.index] == uc) matched = true; } else if (d->tokens[pos.index] >= CSET) { matches = d->charclasses[d->tokens[pos.index] - CSET]; if (tstbit (uc, &matches)) matched = true; } else if (d->tokens[pos.index] == ANYCHAR) { matches = d->charclasses[d->canychar]; if (tstbit (uc, &matches)) matched = true; /* ANYCHAR must match with a single character, so we must put it to D->states[s].mbps which contains the positions which can match with a single character not a byte. If all positions which has ANYCHAR does not depend on context of next character, we put the follows instead of it to D->states[s].mbps to optimize. */ if (succeeds_in_context (pos.constraint, d->states[s].context, CTX_NONE)) { if (d->states[s].mbps.nelem == 0) alloc_position_set (&d->states[s].mbps, 1); insert (pos, &d->states[s].mbps); } } else continue; /* Some characters may need to be eliminated from matches because they fail in the current context. */ if (pos.constraint != NO_CONSTRAINT) { if (!succeeds_in_context (pos.constraint, d->states[s].context, CTX_NEWLINE)) for (int j = 0; j < CHARCLASS_WORDS; j++) matches.w[j] &= ~d->syntax.newline.w[j]; if (!succeeds_in_context (pos.constraint, d->states[s].context, CTX_LETTER)) for (int j = 0; j < CHARCLASS_WORDS; ++j) matches.w[j] &= ~d->syntax.letters.w[j]; if (!succeeds_in_context (pos.constraint, d->states[s].context, CTX_NONE)) for (int j = 0; j < CHARCLASS_WORDS; ++j) matches.w[j] &= d->syntax.letters.w[j] | d->syntax.newline.w[j]; /* If there are no characters left, there's no point in going on. */ if (emptyset (&matches)) continue; /* If we have reset the bit that made us declare "matched", reset that indicator, too. This is required to avoid an infinite loop with this command: echo cx | LC_ALL=C grep -E 'c\b[x ]' */ if (!tstbit (uc, &matches)) matched = false; } #ifdef DEBUG fprintf (stderr, " nextpos %td:", pos.index); prtok (d->tokens[pos.index]); fprintf (stderr, " of"); for (unsigned j = 0; j < NOTCHAR; j++) if (tstbit (j, &matches)) fprintf (stderr, " 0x%02x", j); fprintf (stderr, "\n"); #endif if (matched) { for (int k = 0; k < CHARCLASS_WORDS; ++k) label.w[k] &= matches.w[k]; append (pos, &group); } else { for (int k = 0; k < CHARCLASS_WORDS; ++k) label.w[k] &= ~matches.w[k]; } } alloc_position_set (&tmp, d->nleaves); if (group.nelem > 0) { /* If we are building a searching matcher, throw in the positions of state 0 as well, if possible. */ if (d->searchflag) { /* If a token in follows.elems is not 1st byte of a multibyte character, or the states of follows must accept the bytes which are not 1st byte of the multibyte character. Then, if a state of follows encounters a byte, it must not be a 1st byte of a multibyte character nor a single byte character. In this case, do not add state[0].follows to next state, because state[0] must accept 1st-byte. For example, suppose is a certain single byte character, is a certain multibyte character, and the codepoint of equals the 2nd byte of the codepoint of . When state[0] accepts , state[i] transits to state[i+1] by accepting the 1st byte of , and state[i+1] accepts the 2nd byte of , if state[i+1] encounters the codepoint of , it must not be but the 2nd byte of , so do not add state[0]. */ bool mergeit = !d->localeinfo.multibyte; if (!mergeit) { mergeit = true; for (idx_t j = 0; mergeit && j < group.nelem; j++) mergeit &= d->multibyte_prop[group.elems[j].index]; } if (mergeit) merge2 (&group, &d->states[0].elems, &tmp); } /* Find out if the new state will want any context information, by calculating possible contexts that the group can match, and separate contexts that the new state wants to know. */ int possible_contexts = charclass_context (d, &label); int separate_contexts = state_separate_contexts (d, &group); /* Find the state(s) corresponding to the union of the follows. */ if (possible_contexts & ~separate_contexts) state = state_index (d, &group, separate_contexts ^ CTX_ANY); else state = -1; if (separate_contexts & possible_contexts & CTX_NEWLINE) state_newline = state_index (d, &group, CTX_NEWLINE); else state_newline = state; if (separate_contexts & possible_contexts & CTX_LETTER) state_letter = state_index (d, &group, CTX_LETTER); else state_letter = state; /* Reallocate now, to reallocate any newline transition properly. */ realloc_trans_if_necessary (d); } /* If we are a searching matcher, the default transition is to a state containing the positions of state 0, otherwise the default transition is to fail miserably. */ else if (d->searchflag) { state_newline = 0; state_letter = d->min_trcount - 1; state = d->initstate_notbol; } else { state_newline = -1; state_letter = -1; state = -1; } /* Set the transitions for each character in the label. */ for (int i = 0; i < NOTCHAR; i++) if (tstbit (i, &label)) switch (d->syntax.sbit[i]) { case CTX_NEWLINE: trans[i] = state_newline; break; case CTX_LETTER: trans[i] = state_letter; break; default: trans[i] = state; break; } #ifdef DEBUG fprintf (stderr, "trans table %td", s); for (int i = 0; i < NOTCHAR; ++i) { if (!(i & 0xf)) fprintf (stderr, "\n"); fprintf (stderr, " %2td", trans[i]); } fprintf (stderr, "\n"); #endif free (group.elems); free (follows.elems); free (tmp.elems); /* Keep the newline transition in a special place so we can use it as a sentinel. */ if (tstbit (d->syntax.eolbyte, &label)) { d->newlines[s] = trans[d->syntax.eolbyte]; trans[d->syntax.eolbyte] = -1; } return trans[uc]; } /* Multibyte character handling sub-routines for dfaexec. */ /* Consume a single byte and transit state from 's' to '*next_state'. This function is almost same as the state transition routin in dfaexec. But state transition is done just once, otherwise matching succeed or reach the end of the buffer. */ static state_num transit_state_singlebyte (struct dfa *d, state_num s, unsigned char const **pp) { state_num *t; if (d->trans[s]) t = d->trans[s]; else if (d->fails[s]) t = d->fails[s]; else { build_state (s, d, **pp); if (d->trans[s]) t = d->trans[s]; else { t = d->fails[s]; assert (t); } } if (t[**pp] == -2) build_state (s, d, **pp); return t[*(*pp)++]; } /* Transit state from s, then return new state and update the pointer of the buffer. This function is for a period operator which can match a multi-byte character. */ static state_num transit_state (struct dfa *d, state_num s, unsigned char const **pp, unsigned char const *end) { wint_t wc; int mbclen = mbs_to_wchar (&wc, (char const *) *pp, end - *pp, d); /* This state has some operators which can match a multibyte character. */ d->mb_follows.nelem = 0; /* Calculate the state which can be reached from the state 's' by consuming 'mbclen' single bytes from the buffer. */ state_num s1 = s; int mbci; for (mbci = 0; mbci < mbclen && (mbci == 0 || d->min_trcount <= s); mbci++) s = transit_state_singlebyte (d, s, pp); *pp += mbclen - mbci; if (wc == WEOF) { /* It is an invalid character, so ANYCHAR is not accepted. */ return s; } /* If all positions which have ANYCHAR do not depend on the context of the next character, calculate the next state with pre-calculated follows and cache the result. */ if (d->states[s1].mb_trindex < 0) { if (MAX_TRCOUNT <= d->mb_trcount) { state_num s3; for (s3 = -1; s3 < d->tralloc; s3++) { free (d->mb_trans[s3]); d->mb_trans[s3] = NULL; } for (state_num i = 0; i < d->sindex; i++) d->states[i].mb_trindex = -1; d->mb_trcount = 0; } d->states[s1].mb_trindex = d->mb_trcount++; } if (! d->mb_trans[s]) { enum { TRANSPTR_SIZE = sizeof *d->mb_trans[s] }; enum { TRANSALLOC_SIZE = MAX_TRCOUNT * TRANSPTR_SIZE }; d->mb_trans[s] = xmalloc (TRANSALLOC_SIZE); for (int i = 0; i < MAX_TRCOUNT; i++) d->mb_trans[s][i] = -1; } else if (d->mb_trans[s][d->states[s1].mb_trindex] >= 0) return d->mb_trans[s][d->states[s1].mb_trindex]; if (s == -1) copy (&d->states[s1].mbps, &d->mb_follows); else merge (&d->states[s1].mbps, &d->states[s].elems, &d->mb_follows); int separate_contexts = state_separate_contexts (d, &d->mb_follows); state_num s2 = state_index (d, &d->mb_follows, separate_contexts ^ CTX_ANY); realloc_trans_if_necessary (d); d->mb_trans[s][d->states[s1].mb_trindex] = s2; return s2; } /* The initial state may encounter a byte which is not a single byte character nor the first byte of a multibyte character. But it is incorrect for the initial state to accept such a byte. For example, in Shift JIS the regular expression "\\" accepts the codepoint 0x5c, but should not accept the second byte of the codepoint 0x815c. Then the initial state must skip the bytes that are not a single byte character nor the first byte of a multibyte character. Given DFA state d, use mbs_to_wchar to advance MBP until it reaches or exceeds P, and return the advanced MBP. If WCP is non-NULL and the result is greater than P, set *WCP to the final wide character processed, or to WEOF if no wide character is processed. Otherwise, if WCP is non-NULL, *WCP may or may not be updated. Both P and MBP must be no larger than END. */ static unsigned char const * skip_remains_mb (struct dfa *d, unsigned char const *p, unsigned char const *mbp, char const *end) { if (d->syntax.never_trail[*p]) return p; while (mbp < p) { wint_t wc; mbp += mbs_to_wchar (&wc, (char const *) mbp, end - (char const *) mbp, d); } return mbp; } /* Search through a buffer looking for a match to the struct dfa *D. Find the first occurrence of a string matching the regexp in the buffer, and the shortest possible version thereof. Return a pointer to the first character after the match, or NULL if none is found. BEGIN points to the beginning of the buffer, and END points to the first byte after its end. Note however that we store a sentinel byte (usually newline) in *END, so the actual buffer must be one byte longer. When ALLOW_NL, newlines may appear in the matching string. If COUNT is non-NULL, increment *COUNT once for each newline processed. If MULTIBYTE, the input consists of multibyte characters and/or encoding-error bytes. Otherwise, it consists of single-byte characters. Here is the list of features that make this DFA matcher punt: - [M-N] range in non-simple locale: regex is up to 25% faster on [a-z] - [^...] in non-simple locale - [[=foo=]] or [[.foo.]] - [[:alpha:]] etc. in multibyte locale (except [[:digit:]] works OK) - back-reference: (.)\1 - word-delimiter in multibyte locale: \<, \>, \b, \B See struct localeinfo.simple for the definition of "simple locale". */ static inline char * dfaexec_main (struct dfa *d, char const *begin, char *end, bool allow_nl, ptrdiff_t *count, bool multibyte) { if (MAX_TRCOUNT <= d->sindex) { for (state_num s = d->min_trcount; s < d->sindex; s++) { free (d->states[s].elems.elems); free (d->states[s].mbps.elems); } d->sindex = d->min_trcount; if (d->trans) { for (state_num s = 0; s < d->tralloc; s++) { free (d->trans[s]); free (d->fails[s]); d->trans[s] = d->fails[s] = NULL; } d->trcount = 0; } if (d->localeinfo.multibyte && d->mb_trans) { for (state_num s = -1; s < d->tralloc; s++) { free (d->mb_trans[s]); d->mb_trans[s] = NULL; } for (state_num s = 0; s < d->min_trcount; s++) d->states[s].mb_trindex = -1; d->mb_trcount = 0; } } if (!d->tralloc) realloc_trans_if_necessary (d); /* Current state. */ state_num s = 0, s1 = 0; /* Current input character. */ unsigned char const *p = (unsigned char const *) begin; unsigned char const *mbp = p; /* Copy of d->trans so it can be optimized into a register. */ state_num **trans = d->trans; unsigned char eol = d->syntax.eolbyte; /* Likewise for eolbyte. */ unsigned char saved_end = *(unsigned char *) end; *end = eol; if (multibyte) { memset (&d->mbs, 0, sizeof d->mbs); if (d->mb_follows.alloc == 0) alloc_position_set (&d->mb_follows, d->nleaves); } idx_t nlcount = 0; for (;;) { state_num *t; while ((t = trans[s]) != NULL) { if (s < d->min_trcount) { if (!multibyte || d->states[s].mbps.nelem == 0) { while (t[*p] == s) p++; } if (multibyte) p = mbp = skip_remains_mb (d, p, mbp, end); } if (multibyte) { s1 = s; if (d->states[s].mbps.nelem == 0 || d->localeinfo.sbctowc[*p] != WEOF || (char *) p >= end) { /* If an input character does not match ANYCHAR, do it like a single-byte character. */ s = t[*p++]; } else { s = transit_state (d, s, &p, (unsigned char *) end); mbp = p; trans = d->trans; } } else { s1 = t[*p++]; t = trans[s1]; if (! t) { state_num tmp = s; s = s1; s1 = tmp; /* swap */ break; } if (s < d->min_trcount) { while (t[*p] == s1) p++; } s = t[*p++]; } } if (s < 0) { if (s == -2) { s = build_state (s1, d, p[-1]); trans = d->trans; } else if ((char *) p <= end && p[-1] == eol && 0 <= d->newlines[s1]) { /* The previous character was a newline. Count it, and skip checking of multibyte character boundary until here. */ nlcount++; mbp = p; s = (allow_nl ? d->newlines[s1] : d->syntax.sbit[eol] == CTX_NEWLINE ? 0 : d->syntax.sbit[eol] == CTX_LETTER ? d->min_trcount - 1 : d->initstate_notbol); } else { p = NULL; goto done; } } else if (d->fails[s]) { if ((d->success[s] & d->syntax.sbit[*p]) || ((char *) p == end && accepts_in_context (d->states[s].context, CTX_NEWLINE, s, d))) goto done; if (multibyte && s < d->min_trcount) p = mbp = skip_remains_mb (d, p, mbp, end); s1 = s; if (!multibyte || d->states[s].mbps.nelem == 0 || d->localeinfo.sbctowc[*p] != WEOF || (char *) p >= end) { /* If a input character does not match ANYCHAR, do it like a single-byte character. */ s = d->fails[s][*p++]; } else { s = transit_state (d, s, &p, (unsigned char *) end); mbp = p; trans = d->trans; } } else { build_state (s, d, p[0]); trans = d->trans; } } done: if (count) *count += nlcount; *end = saved_end; return (char *) p; } /* Specialized versions of dfaexec for multibyte and single-byte cases. This is for performance, as dfaexec_main is an inline function. */ static char * dfaexec_mb (struct dfa *d, char const *begin, char *end, bool allow_nl, ptrdiff_t *count, bool *backref) { return dfaexec_main (d, begin, end, allow_nl, count, true); } static char * dfaexec_sb (struct dfa *d, char const *begin, char *end, bool allow_nl, ptrdiff_t *count, bool *backref) { return dfaexec_main (d, begin, end, allow_nl, count, false); } /* Always set *BACKREF and return BEGIN. Use this wrapper for any regexp that uses a construct not supported by this code. */ static char * dfaexec_noop (struct dfa *d, char const *begin, char *end, bool allow_nl, ptrdiff_t *count, bool *backref) { *backref = true; return (char *) begin; } /* Like dfaexec_main (D, BEGIN, END, ALLOW_NL, COUNT, D->localeinfo.multibyte), but faster and set *BACKREF if the DFA code does not support this regexp usage. */ char * dfaexec (struct dfa *d, char const *begin, char *end, bool allow_nl, ptrdiff_t *count, bool *backref) { return d->dfaexec (d, begin, end, allow_nl, count, backref); } struct dfa * dfasuperset (struct dfa const *d) { return d->superset; } bool dfaisfast (struct dfa const *d) { return d->fast; } static void free_mbdata (struct dfa *d) { free (d->multibyte_prop); free (d->lex.brack.chars); free (d->mb_follows.elems); if (d->mb_trans) { state_num s; for (s = -1; s < d->tralloc; s++) free (d->mb_trans[s]); free (d->mb_trans - 2); } } /* Return true if every construct in D is supported by this DFA matcher. */ bool dfasupported (struct dfa const *d) { for (idx_t i = 0; i < d->tindex; i++) { switch (d->tokens[i]) { case BEGWORD: case ENDWORD: case LIMWORD: case NOTLIMWORD: if (!d->localeinfo.multibyte) continue; FALLTHROUGH; case BACKREF: case MBCSET: return false; } } return true; } /* Disable use of the superset DFA if it is not likely to help performance. */ static void maybe_disable_superset_dfa (struct dfa *d) { if (!d->localeinfo.using_utf8) return; bool have_backref = false; for (idx_t i = 0; i < d->tindex; i++) { switch (d->tokens[i]) { case ANYCHAR: /* Lowered. */ abort (); case BACKREF: have_backref = true; break; case MBCSET: /* Requires multi-byte algorithm. */ return; default: break; } } if (!have_backref && d->superset) { /* The superset DFA is not likely to be much faster, so remove it. */ dfafree (d->superset); free (d->superset); d->superset = NULL; } free_mbdata (d); d->localeinfo.multibyte = false; d->dfaexec = dfaexec_sb; d->fast = true; } static void dfassbuild (struct dfa *d) { struct dfa *sup = dfaalloc (); *sup = *d; sup->localeinfo.multibyte = false; sup->dfaexec = dfaexec_sb; sup->multibyte_prop = NULL; sup->superset = NULL; sup->states = NULL; sup->sindex = 0; sup->constraints = NULL; sup->separates = NULL; sup->follows = NULL; sup->tralloc = 0; sup->trans = NULL; sup->fails = NULL; sup->success = NULL; sup->newlines = NULL; sup->charclasses = xnmalloc (sup->calloc, sizeof *sup->charclasses); if (d->cindex) { memcpy (sup->charclasses, d->charclasses, d->cindex * sizeof *sup->charclasses); } sup->tokens = xnmalloc (d->tindex, 2 * sizeof *sup->tokens); sup->talloc = d->tindex * 2; bool have_achar = false; bool have_nchar = false; idx_t j; for (idx_t i = j = 0; i < d->tindex; i++) { switch (d->tokens[i]) { case ANYCHAR: case MBCSET: case BACKREF: { charclass ccl; fillset (&ccl); sup->tokens[j++] = CSET + charclass_index (sup, &ccl); sup->tokens[j++] = STAR; if (d->tokens[i + 1] == QMARK || d->tokens[i + 1] == STAR || d->tokens[i + 1] == PLUS) i++; have_achar = true; } break; case BEGWORD: case ENDWORD: case LIMWORD: case NOTLIMWORD: if (d->localeinfo.multibyte) { /* These constraints aren't supported in a multibyte locale. Ignore them in the superset DFA. */ sup->tokens[j++] = EMPTY; break; } FALLTHROUGH; default: sup->tokens[j++] = d->tokens[i]; if ((0 <= d->tokens[i] && d->tokens[i] < NOTCHAR) || d->tokens[i] >= CSET) have_nchar = true; break; } } sup->tindex = j; if (have_nchar && (have_achar || d->localeinfo.multibyte)) d->superset = sup; else { dfafree (sup); free (sup); } } /* Parse a string S of length LEN into D (but skip this step if S is null). Then analyze D and build a matcher for it. SEARCHFLAG says whether to build a searching or an exact matcher. */ void dfacomp (char const *s, idx_t len, struct dfa *d, bool searchflag) { if (s != NULL) dfaparse (s, len, d); dfassbuild (d); if (dfasupported (d)) { maybe_disable_superset_dfa (d); dfaanalyze (d, searchflag); } else { d->dfaexec = dfaexec_noop; } if (d->superset) { d->fast = true; dfaanalyze (d->superset, searchflag); } } /* Free the storage held by the components of a dfa. */ void dfafree (struct dfa *d) { free (d->charclasses); free (d->tokens); if (d->localeinfo.multibyte) free_mbdata (d); free (d->constraints); free (d->separates); for (idx_t i = 0; i < d->sindex; i++) { free (d->states[i].elems.elems); free (d->states[i].mbps.elems); } free (d->states); if (d->follows) { for (idx_t i = 0; i < d->tindex; i++) free (d->follows[i].elems); free (d->follows); } if (d->trans) { for (idx_t i = 0; i < d->tralloc; i++) { free (d->trans[i]); free (d->fails[i]); } free (d->trans - 2); free (d->fails); free (d->newlines); free (d->success); } if (d->superset) { dfafree (d->superset); free (d->superset); } } /* Having found the postfix representation of the regular expression, try to find a long sequence of characters that must appear in any line containing the r.e. Finding a "longest" sequence is beyond the scope here; we take an easy way out and hope for the best. (Take "(ab|a)b"--please.) We do a bottom-up calculation of sequences of characters that must appear in matches of r.e.'s represented by trees rooted at the nodes of the postfix representation: sequences that must appear at the left of the match ("left") sequences that must appear at the right of the match ("right") lists of sequences that must appear somewhere in the match ("in") sequences that must constitute the match ("is") When we get to the root of the tree, we use one of the longest of its calculated "in" sequences as our answer. The sequences calculated for the various types of node (in pseudo ANSI c) are shown below. "p" is the operand of unary operators (and the left-hand operand of binary operators); "q" is the right-hand operand of binary operators. "ZERO" means "a zero-length sequence" below. Type left right is in ---- ---- ----- -- -- char c # c # c # c # c ANYCHAR ZERO ZERO ZERO ZERO MBCSET ZERO ZERO ZERO ZERO CSET ZERO ZERO ZERO ZERO STAR ZERO ZERO ZERO ZERO QMARK ZERO ZERO ZERO ZERO PLUS p->left p->right ZERO p->in CAT (p->is==ZERO)? (q->is==ZERO)? (p->is!=ZERO && p->in plus p->left : q->right : q->is!=ZERO) ? q->in plus p->is##q->left p->right##q->is p->is##q->is : p->right##q->left ZERO OR longest common longest common (do p->is and substrings common leading trailing to q->is have same p->in and (sub)sequence (sub)sequence q->in length and content) ? of p->left of p->right and q->left and q->right p->is : NULL If there's anything else we recognize in the tree, all four sequences get set to zero-length sequences. If there's something we don't recognize in the tree, we just return a zero-length sequence. Break ties in favor of infrequent letters (choosing 'zzz' in preference to 'aaa')? And ... is it here or someplace that we might ponder "optimizations" such as egrep 'psi|epsilon' -> egrep 'psi' egrep 'pepsi|epsilon' -> egrep 'epsi' (Yes, we now find "epsi" as a "string that must occur", but we might also simplify the *entire* r.e. being sought) grep '[c]' -> grep 'c' grep '(ab|a)b' -> grep 'ab' grep 'ab*' -> grep 'a' grep 'a*b' -> grep 'b' There are several issues: Is optimization easy (enough)? Does optimization actually accomplish anything, or is the automaton you get from "psi|epsilon" (for example) the same as the one you get from "psi" (for example)? Are optimizable r.e.'s likely to be used in real-life situations (something like 'ab*' is probably unlikely; something like is 'psi|epsilon' is likelier)? */ static char * icatalloc (char *old, char const *new) { idx_t newsize = strlen (new); if (newsize == 0) return old; idx_t oldsize = strlen (old); char *result = xirealloc (old, oldsize + newsize + 1); memcpy (result + oldsize, new, newsize + 1); return result; } static void freelist (char **cpp) { while (*cpp) free (*cpp++); } static char ** enlistnew (char **cpp, char *new) { /* Is there already something in the list that's new (or longer)? */ idx_t i; for (i = 0; cpp[i] != NULL; i++) if (strstr (cpp[i], new) != NULL) { free (new); return cpp; } /* Eliminate any obsoleted strings. */ for (idx_t j = 0; cpp[j] != NULL; ) if (strstr (new, cpp[j]) == NULL) ++j; else { free (cpp[j]); if (--i == j) break; cpp[j] = cpp[i]; cpp[i] = NULL; } /* Add the new string. */ cpp = xreallocarray (cpp, i + 2, sizeof *cpp); cpp[i] = new; cpp[i + 1] = NULL; return cpp; } static char ** enlist (char **cpp, char const *str, idx_t len) { return enlistnew (cpp, ximemdup0 (str, len)); } /* Given pointers to two strings, return a pointer to an allocated list of their distinct common substrings. */ static char ** comsubs (char *left, char const *right) { char **cpp = xzalloc (sizeof *cpp); for (char *lcp = left; *lcp != '\0'; lcp++) { idx_t len = 0; char *rcp = strchr (right, *lcp); while (rcp != NULL) { idx_t i; for (i = 1; lcp[i] != '\0' && lcp[i] == rcp[i]; ++i) continue; if (i > len) len = i; rcp = strchr (rcp + 1, *lcp); } if (len != 0) cpp = enlist (cpp, lcp, len); } return cpp; } static char ** addlists (char **old, char **new) { for (; *new; new++) old = enlistnew (old, xstrdup (*new)); return old; } /* Given two lists of substrings, return a new list giving substrings common to both. */ static char ** inboth (char **left, char **right) { char **both = xzalloc (sizeof *both); for (idx_t lnum = 0; left[lnum] != NULL; lnum++) { for (idx_t rnum = 0; right[rnum] != NULL; rnum++) { char **temp = comsubs (left[lnum], right[rnum]); both = addlists (both, temp); freelist (temp); free (temp); } } return both; } typedef struct must must; struct must { char **in; char *left; char *right; char *is; bool begline; bool endline; must *prev; }; static must * allocmust (must *mp, idx_t size) { must *new_mp = xmalloc (sizeof *new_mp); new_mp->in = xzalloc (sizeof *new_mp->in); new_mp->left = xizalloc (size); new_mp->right = xizalloc (size); new_mp->is = xizalloc (size); new_mp->begline = false; new_mp->endline = false; new_mp->prev = mp; return new_mp; } static void resetmust (must *mp) { freelist (mp->in); mp->in[0] = NULL; mp->left[0] = mp->right[0] = mp->is[0] = '\0'; mp->begline = false; mp->endline = false; } static void freemust (must *mp) { freelist (mp->in); free (mp->in); free (mp->left); free (mp->right); free (mp->is); free (mp); } struct dfamust * dfamust (struct dfa const *d) { must *mp = NULL; char const *result = ""; bool exact = false; bool begline = false; bool endline = false; bool need_begline = false; bool need_endline = false; bool case_fold_unibyte = d->syntax.case_fold & !d->localeinfo.multibyte; for (idx_t ri = 1; ri + 1 < d->tindex; ri++) { token t = d->tokens[ri]; switch (t) { case BEGLINE: mp = allocmust (mp, 2); mp->begline = true; need_begline = true; break; case ENDLINE: mp = allocmust (mp, 2); mp->endline = true; need_endline = true; break; case LPAREN: case RPAREN: assert (!"neither LPAREN nor RPAREN may appear here"); case EMPTY: case BEGWORD: case ENDWORD: case LIMWORD: case NOTLIMWORD: case BACKREF: case ANYCHAR: case MBCSET: mp = allocmust (mp, 2); break; case STAR: case QMARK: assume_nonnull (mp); resetmust (mp); break; case OR: { char **new; must *rmp = mp; assume_nonnull (rmp); must *lmp = mp = mp->prev; assume_nonnull (lmp); idx_t j, ln, rn, n; /* Guaranteed to be. Unlikely, but ... */ if (streq (lmp->is, rmp->is)) { lmp->begline &= rmp->begline; lmp->endline &= rmp->endline; } else { lmp->is[0] = '\0'; lmp->begline = false; lmp->endline = false; } /* Left side--easy */ idx_t i = 0; while (lmp->left[i] != '\0' && lmp->left[i] == rmp->left[i]) ++i; lmp->left[i] = '\0'; /* Right side */ ln = strlen (lmp->right); rn = strlen (rmp->right); n = ln; if (n > rn) n = rn; for (i = 0; i < n; ++i) if (lmp->right[ln - i - 1] != rmp->right[rn - i - 1]) break; for (j = 0; j < i; ++j) lmp->right[j] = lmp->right[(ln - i) + j]; lmp->right[j] = '\0'; new = inboth (lmp->in, rmp->in); freelist (lmp->in); free (lmp->in); lmp->in = new; freemust (rmp); } break; case PLUS: assume_nonnull (mp); mp->is[0] = '\0'; break; case END: assume_nonnull (mp); assert (!mp->prev); for (idx_t i = 0; mp->in[i] != NULL; i++) if (strlen (mp->in[i]) > strlen (result)) result = mp->in[i]; if (streq (result, mp->is)) { if ((!need_begline || mp->begline) && (!need_endline || mp->endline)) exact = true; begline = mp->begline; endline = mp->endline; } goto done; case CAT: { must *rmp = mp; assume_nonnull (rmp); must *lmp = mp = mp->prev; assume_nonnull (lmp); /* In. Everything in left, plus everything in right, plus concatenation of left's right and right's left. */ lmp->in = addlists (lmp->in, rmp->in); if (lmp->right[0] != '\0' && rmp->left[0] != '\0') { idx_t lrlen = strlen (lmp->right); idx_t rllen = strlen (rmp->left); char *tp = ximalloc (lrlen + rllen + 1); memcpy (tp + lrlen, rmp->left, rllen + 1); memcpy (tp, lmp->right, lrlen); lmp->in = enlistnew (lmp->in, tp); } /* Left-hand */ if (lmp->is[0] != '\0') lmp->left = icatalloc (lmp->left, rmp->left); /* Right-hand */ if (rmp->is[0] == '\0') lmp->right[0] = '\0'; lmp->right = icatalloc (lmp->right, rmp->right); /* Guaranteed to be */ if ((lmp->is[0] != '\0' || lmp->begline) && (rmp->is[0] != '\0' || rmp->endline)) { lmp->is = icatalloc (lmp->is, rmp->is); lmp->endline = rmp->endline; } else { lmp->is[0] = '\0'; lmp->begline = false; lmp->endline = false; } freemust (rmp); } break; case '\0': /* Not on *my* shift. */ goto done; default: if (CSET <= t) { /* If T is a singleton, or if case-folding in a unibyte locale and T's members all case-fold to the same char, convert T to one of its members. Otherwise, do nothing further with T. */ charclass *ccl = &d->charclasses[t - CSET]; int j; for (j = 0; j < NOTCHAR; j++) if (tstbit (j, ccl)) break; if (! (j < NOTCHAR)) { mp = allocmust (mp, 2); break; } t = j; while (++j < NOTCHAR) if (tstbit (j, ccl) && ! (case_fold_unibyte && toupper (j) == toupper (t))) break; if (j < NOTCHAR) { mp = allocmust (mp, 2); break; } } idx_t rj = ri + 2; if (d->tokens[ri + 1] == CAT) { for (; rj < d->tindex - 1; rj += 2) { if ((rj != ri && (d->tokens[rj] <= 0 || NOTCHAR <= d->tokens[rj])) || d->tokens[rj + 1] != CAT) break; } } mp = allocmust (mp, ((rj - ri) >> 1) + 1); mp->is[0] = mp->left[0] = mp->right[0] = case_fold_unibyte ? toupper (t) : t; idx_t i; for (i = 1; ri + 2 < rj; i++) { ri += 2; t = d->tokens[ri]; mp->is[i] = mp->left[i] = mp->right[i] = case_fold_unibyte ? toupper (t) : t; } mp->is[i] = mp->left[i] = mp->right[i] = '\0'; mp->in = enlist (mp->in, mp->is, i); break; } } done:; struct dfamust *dm = NULL; if (*result) { dm = xmalloc (FLEXSIZEOF (struct dfamust, must, strlen (result) + 1)); dm->exact = exact; dm->begline = begline; dm->endline = endline; strcpy (dm->must, result); } while (mp) { must *prev = mp->prev; freemust (mp); mp = prev; } return dm; } void dfamustfree (struct dfamust *dm) { free (dm); } struct dfa * dfaalloc (void) { return xmalloc (sizeof (struct dfa)); } /* Initialize DFA. */ void dfasyntax (struct dfa *dfa, struct localeinfo const *linfo, reg_syntax_t bits, int dfaopts) { memset (dfa, 0, offsetof (struct dfa, dfaexec)); dfa->dfaexec = linfo->multibyte ? dfaexec_mb : dfaexec_sb; dfa->localeinfo = *linfo; dfa->fast = !dfa->localeinfo.multibyte; dfa->canychar = -1; dfa->syntax.syntax_bits_set = true; dfa->syntax.case_fold = (bits & RE_ICASE) != 0; dfa->syntax.anchor = (dfaopts & DFA_ANCHOR) != 0; dfa->syntax.eolbyte = dfaopts & DFA_EOL_NUL ? '\0' : '\n'; dfa->syntax.syntax_bits = bits; for (int i = CHAR_MIN; i <= CHAR_MAX; ++i) { unsigned char uc = i; dfa->syntax.sbit[uc] = char_context (dfa, uc); switch (dfa->syntax.sbit[uc]) { case CTX_LETTER: setbit (uc, &dfa->syntax.letters); break; case CTX_NEWLINE: setbit (uc, &dfa->syntax.newline); break; } /* POSIX requires that the five bytes in "\n\r./" (including the terminating NUL) cannot occur inside a multibyte character. */ dfa->syntax.never_trail[uc] = (dfa->localeinfo.using_utf8 ? (uc & 0xc0) != 0x80 : strchr ("\n\r./", uc) != NULL); } } /* Initialize TO by copying FROM's syntax settings. */ void dfacopysyntax (struct dfa *to, struct dfa const *from) { memset (to, 0, offsetof (struct dfa, syntax)); to->canychar = -1; to->fast = from->fast; to->syntax = from->syntax; to->dfaexec = from->dfaexec; to->localeinfo = from->localeinfo; } /* vim:set shiftwidth=2: */ kbuild-3608/src/grep/lib/getopt-core.h0000664000175000017500000000713214670377423017621 0ustar locutuslocutus/* Declarations for getopt (basic, portable features only). Copyright (C) 1989-2021 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _GETOPT_CORE_H #define _GETOPT_CORE_H 1 /* This header should not be used directly; include getopt.h or unistd.h instead. Unlike most bits headers, it does not have a protective #error, because the guard macro for getopt.h in gnulib is not fixed. */ __BEGIN_DECLS /* For communication from 'getopt' to the caller. When 'getopt' finds an option that takes an argument, the argument value is returned here. Also, when 'ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to 'getopt'. On entry to 'getopt', zero means this is the first call; initialize. When 'getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, 'optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message 'getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, 'optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in 'optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU 'getopt'. The argument '--' causes premature termination of argument scanning, explicitly telling 'getopt' that there are no more options. If OPTS begins with '-', then non-option arguments are treated as arguments to the option '\1'. This behavior is specific to the GNU 'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in the environment, then do not permute arguments. For standards compliance, the 'argv' argument has the type char *const *, but this is inaccurate; if argument permutation is enabled, the argv array (not the strings it points to) must be writable. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW _GL_ARG_NONNULL ((2, 3)); __END_DECLS #endif /* _GETOPT_CORE_H */ kbuild-3608/src/grep/lib/windows-recmutex.c0000664000175000017500000000654214670377426020717 0ustar locutuslocutus/* Plain recursive mutexes (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-win32.h. */ #include /* Specification. */ #include "windows-recmutex.h" #include void glwthread_recmutex_init (glwthread_recmutex_t *mutex) { mutex->owner = 0; mutex->depth = 0; InitializeCriticalSection (&mutex->lock); mutex->guard.done = 1; } int glwthread_recmutex_lock (glwthread_recmutex_t *mutex) { if (!mutex->guard.done) { if (InterlockedIncrement (&mutex->guard.started) == 0) /* This thread is the first one to need this mutex. Initialize it. */ glwthread_recmutex_init (mutex); else { /* Don't let mutex->guard.started grow and wrap around. */ InterlockedDecrement (&mutex->guard.started); /* Yield the CPU while waiting for another thread to finish initializing this mutex. */ while (!mutex->guard.done) Sleep (0); } } { DWORD self = GetCurrentThreadId (); if (mutex->owner != self) { EnterCriticalSection (&mutex->lock); mutex->owner = self; } if (++(mutex->depth) == 0) /* wraparound? */ { mutex->depth--; return EAGAIN; } } return 0; } int glwthread_recmutex_trylock (glwthread_recmutex_t *mutex) { if (!mutex->guard.done) { if (InterlockedIncrement (&mutex->guard.started) == 0) /* This thread is the first one to need this mutex. Initialize it. */ glwthread_recmutex_init (mutex); else { /* Don't let mutex->guard.started grow and wrap around. */ InterlockedDecrement (&mutex->guard.started); /* Let another thread finish initializing this mutex, and let it also lock this mutex. */ return EBUSY; } } { DWORD self = GetCurrentThreadId (); if (mutex->owner != self) { if (!TryEnterCriticalSection (&mutex->lock)) return EBUSY; mutex->owner = self; } if (++(mutex->depth) == 0) /* wraparound? */ { mutex->depth--; return EAGAIN; } } return 0; } int glwthread_recmutex_unlock (glwthread_recmutex_t *mutex) { if (mutex->owner != GetCurrentThreadId ()) return EPERM; if (mutex->depth == 0) return EINVAL; if (--(mutex->depth) == 0) { mutex->owner = 0; LeaveCriticalSection (&mutex->lock); } return 0; } int glwthread_recmutex_destroy (glwthread_recmutex_t *mutex) { if (mutex->owner != 0) return EBUSY; DeleteCriticalSection (&mutex->lock); mutex->guard.done = 0; return 0; } kbuild-3608/src/grep/lib/alignof.h0000664000175000017500000000437014670377422017010 0ustar locutuslocutus/* Determine alignment of types. Copyright (C) 2003-2004, 2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _ALIGNOF_H #define _ALIGNOF_H #include /* alignof_slot (TYPE) Determine the alignment of a structure slot (field) of a given type, at compile time. Note that the result depends on the ABI. This is the same as alignof (TYPE) and _Alignof (TYPE), defined in if __alignof_is_defined is 1. Note: The result cannot be used as a value for an 'enum' constant, due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */ #if defined __cplusplus template struct alignof_helper { char __slot1; type __slot2; }; # define alignof_slot(type) offsetof (alignof_helper, __slot2) #else # define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) #endif /* alignof_type (TYPE) Determine the good alignment of an object of the given type at compile time. Note that this is not necessarily the same as alignof_slot(type). For example, with GNU C on x86 platforms and with clang on Linux/x86: alignof_type(long long) = 8, but alignof_slot(long long) = 4. And alignof_type(double) = 8, but - when -malign-double is not specified: alignof_slot(double) = 4, - when -malign-double is specified: alignof_slot(double) = 8. Note: The result cannot be used as a value for an 'enum' constant, due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */ #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ # define alignof_type __alignof__ #else # define alignof_type alignof_slot #endif #endif /* _ALIGNOF_H */ kbuild-3608/src/grep/lib/iconv_open-hpux.h0000664000175000017500000002740114670377424020514 0ustar locutuslocutus/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -m 10 ./iconv_open-hpux.gperf */ /* Computed positions: -k'4,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 17 "./iconv_open-hpux.gperf" struct mapping { int standard_name; const char vendor_name[9 + 1]; }; #define TOTAL_KEYWORDS 44 #define MIN_WORD_LENGTH 4 #define MAX_WORD_LENGTH 11 #define MIN_HASH_VALUE 6 #define MAX_HASH_VALUE 49 /* maximum key range = 44, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int mapping_hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 1, 2, 24, 43, 5, 10, 0, 13, 32, 3, 19, 18, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, 50, 50, 50, 50, 14, 5, 0, 50, 50, 0, 27, 50, 12, 14, 50, 50, 0, 5, 2, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50 }; return len + asso_values[(unsigned char)str[3]+4] + asso_values[(unsigned char)str[len - 1]]; } struct stringpool_t { char stringpool_str6[sizeof("CP1256")]; char stringpool_str7[sizeof("CP1250")]; char stringpool_str8[sizeof("CP1251")]; char stringpool_str9[sizeof("CP850")]; char stringpool_str10[sizeof("TIS-620")]; char stringpool_str11[sizeof("CP1254")]; char stringpool_str12[sizeof("ISO-8859-6")]; char stringpool_str13[sizeof("EUC-TW")]; char stringpool_str14[sizeof("ISO-8859-1")]; char stringpool_str15[sizeof("ISO-8859-9")]; char stringpool_str16[sizeof("CP1255")]; char stringpool_str17[sizeof("BIG5")]; char stringpool_str18[sizeof("CP855")]; char stringpool_str19[sizeof("CP1257")]; char stringpool_str20[sizeof("EUC-KR")]; char stringpool_str21[sizeof("CP857")]; char stringpool_str22[sizeof("ISO-8859-5")]; char stringpool_str23[sizeof("ISO-8859-15")]; char stringpool_str24[sizeof("CP866")]; char stringpool_str25[sizeof("ISO-8859-7")]; char stringpool_str26[sizeof("CP861")]; char stringpool_str27[sizeof("CP869")]; char stringpool_str28[sizeof("CP874")]; char stringpool_str29[sizeof("CP864")]; char stringpool_str30[sizeof("CP1252")]; char stringpool_str31[sizeof("CP437")]; char stringpool_str32[sizeof("CP852")]; char stringpool_str33[sizeof("CP775")]; char stringpool_str34[sizeof("CP865")]; char stringpool_str35[sizeof("EUC-JP")]; char stringpool_str36[sizeof("ISO-8859-2")]; char stringpool_str37[sizeof("SHIFT_JIS")]; char stringpool_str38[sizeof("CP1258")]; char stringpool_str39[sizeof("UTF-8")]; char stringpool_str40[sizeof("HP-KANA8")]; char stringpool_str41[sizeof("HP-ROMAN8")]; char stringpool_str42[sizeof("HP-HEBREW8")]; char stringpool_str43[sizeof("GB2312")]; char stringpool_str44[sizeof("ISO-8859-8")]; char stringpool_str45[sizeof("HP-TURKISH8")]; char stringpool_str46[sizeof("HP-GREEK8")]; char stringpool_str47[sizeof("HP-ARABIC8")]; char stringpool_str48[sizeof("CP862")]; char stringpool_str49[sizeof("CP1253")]; }; static const struct stringpool_t stringpool_contents = { "CP1256", "CP1250", "CP1251", "CP850", "TIS-620", "CP1254", "ISO-8859-6", "EUC-TW", "ISO-8859-1", "ISO-8859-9", "CP1255", "BIG5", "CP855", "CP1257", "EUC-KR", "CP857", "ISO-8859-5", "ISO-8859-15", "CP866", "ISO-8859-7", "CP861", "CP869", "CP874", "CP864", "CP1252", "CP437", "CP852", "CP775", "CP865", "EUC-JP", "ISO-8859-2", "SHIFT_JIS", "CP1258", "UTF-8", "HP-KANA8", "HP-ROMAN8", "HP-HEBREW8", "GB2312", "ISO-8859-8", "HP-TURKISH8", "HP-GREEK8", "HP-ARABIC8", "CP862", "CP1253" }; #define stringpool ((const char *) &stringpool_contents) static const struct mapping mappings[] = { {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, #line 56 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "cp1256"}, #line 50 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, "cp1250"}, #line 51 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, "cp1251"}, #line 39 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, "cp850"}, #line 65 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "tis620"}, #line 54 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "cp1254"}, #line 32 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "iso88596"}, #line 69 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "eucTW"}, #line 29 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "iso88591"}, #line 35 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "iso88599"}, #line 55 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "cp1255"}, #line 70 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "big5"}, #line 41 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "cp855"}, #line 57 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "cp1257"}, #line 68 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, "eucKR"}, #line 42 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, "cp857"}, #line 31 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, "iso88595"}, #line 36 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, "iso885915"}, #line 47 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str24, "cp866"}, #line 33 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25, "iso88597"}, #line 43 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, "cp861"}, #line 48 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, "cp869"}, #line 49 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str28, "cp874"}, #line 45 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, "cp864"}, #line 52 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, "cp1252"}, #line 37 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, "cp437"}, #line 40 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str32, "cp852"}, #line 38 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, "cp775"}, #line 46 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34, "cp865"}, #line 67 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, "eucJP"}, #line 30 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str36, "iso88592"}, #line 71 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str37, "sjis"}, #line 58 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, "cp1258"}, #line 72 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str39, "utf8"}, #line 64 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str40, "kana8"}, #line 59 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41, "roman8"}, #line 62 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str42, "hebrew8"}, #line 66 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str43, "hp15CN"}, #line 34 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str44, "iso88598"}, #line 63 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str45, "turkish8"}, #line 61 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str46, "greek8"}, #line 60 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str47, "arabic8"}, #line 44 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str48, "cp862"}, #line 53 "./iconv_open-hpux.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str49, "cp1253"} }; const struct mapping * mapping_lookup (register const char *str, register size_t len) { if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = mapping_hash (str, len); if (key <= MAX_HASH_VALUE) { register int o = mappings[key].standard_name; if (o >= 0) { register const char *s = o + stringpool; if (*str == *s && !strcmp (str + 1, s + 1)) return &mappings[key]; } } } return 0; } kbuild-3608/src/grep/lib/pipe.c0000664000175000017500000000253614670377425016326 0ustar locutuslocutus/* Create a pipe. Copyright (C) 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #if defined _WIN32 && ! defined __CYGWIN__ /* Native Windows API. */ /* Get _pipe(). */ # include /* Get _O_BINARY. */ # include int pipe (int fd[2]) { /* Mingw changes fd to {-1,-1} on failure, but this violates http://austingroupbugs.net/view.php?id=467 */ int tmp[2]; int result = _pipe (tmp, 4096, _O_BINARY); if (!result) { fd[0] = tmp[0]; fd[1] = tmp[1]; } return result; } #else # error "This platform lacks a pipe function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib." #endif kbuild-3608/src/grep/lib/c-stack.h0000664000175000017500000000434014670377423016714 0ustar locutuslocutus/* Stack overflow handling. Copyright (C) 2002, 2004, 2008-2021 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 . */ /* Set up ACTION so that it is invoked on C stack overflow and on other, stack-unrelated, segmentation violation. Return -1 (setting errno) if this cannot be done. When a stack overflow or segmentation violation occurs: 1) ACTION is called. It is passed an argument equal to - 0, for a stack overflow, - SIGSEGV, for a segmentation violation that does not appear related to stack overflow. On many platforms the two cases are hard to distinguish; when in doubt, zero is passed. 2) If ACTION returns, a message is written to standard error, and the program is terminated: in the case of stack overflow, with exit code exit_failure (see "exitfail.h"), otherwise through a signal SIGSEGV. A null ACTION acts like an action that does nothing. Restrictions: - ACTION must be async-signal-safe. - ACTION together with its callees must not require more than 64 KiB of stack space. - ACTION must not create and then invoke nested functions , because this implementation does not guarantee an executable stack. - ACTION should not call longjmp, because this implementation does not guarantee that it is safe to return to the original stack. This function may install a handler for the SIGSEGV signal or for the SIGBUS signal or exercise other system dependent exception handling APIs. */ extern int c_stack_action (_GL_ASYNC_SAFE void (* /*action*/) (int)); kbuild-3608/src/grep/lib/fnmatch.in.h0000664000175000017500000000765614670377422017430 0ustar locutuslocutus/* Substitute for and wrapper around . Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_FNMATCH_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_FNMATCH_H@ && !@REPLACE_FNMATCH@ # @INCLUDE_NEXT@ @NEXT_FNMATCH_H@ #endif #ifndef _@GUARD_PREFIX@_FNMATCH_H #define _@GUARD_PREFIX@_FNMATCH_H /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ #if defined(KMK_GREP) # include "c++defs.h" #endif /* The definition of _GL_ARG_NONNULL is copied here. */ #if defined(KMK_GREP) # include "arg-nonnull.h" #endif /* The definition of _GL_WARN_ON_USE is copied here. */ #if !@HAVE_FNMATCH_H@ || @REPLACE_FNMATCH@ /* We #undef these before defining them because some losing systems (HP-UX A.08.07 for example) define these in . */ #undef FNM_PATHNAME #undef FNM_NOESCAPE #undef FNM_PERIOD /* Bits set in the FLAGS argument to 'fnmatch'. */ #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match '/'. */ #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ #define FNM_PERIOD (1 << 2) /* Leading '.' is matched only explicitly. */ #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ # define FNM_LEADING_DIR (1 << 3) /* Ignore '/...' after a match. */ # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ # define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */ #endif /* Value returned by 'fnmatch' if STRING does not match PATTERN. */ #define FNM_NOMATCH 1 /* This value is returned if the implementation does not support 'fnmatch'. Since this is not the case here it will never be returned but the conformance test suites still require the symbol to be defined. */ #ifdef _XOPEN_SOURCE # define FNM_NOSYS (-1) #endif #endif #if @GNULIB_FNMATCH@ /* Match NAME against the file name pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ # if @REPLACE_FNMATCH@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fnmatch rpl_fnmatch # endif _GL_FUNCDECL_RPL (fnmatch, int, (const char *pattern, const char *name, int flags) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (fnmatch, int, (const char *pattern, const char *name, int flags)); # else # if !@HAVE_FNMATCH@ _GL_FUNCDECL_SYS (fnmatch, int, (const char *pattern, const char *name, int flags) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (fnmatch, int, (const char *pattern, const char *name, int flags)); # endif # if !GNULIB_FNMATCH_GNU && __GLIBC__ >= 2 _GL_CXXALIASWARN (fnmatch); # endif #elif defined GNULIB_POSIXCHECK # undef fnmatch # if HAVE_RAW_DECL_FNMATCH _GL_WARN_ON_USE (fnmatch, "fnmatch does not portably work - " "use gnulib module fnmatch for portability or gnulib module fnmatch-gnu for a glibc compatible implementation"); # endif #endif #endif /* _@GUARD_PREFIX@_FNMATCH_H */ #endif /* _@GUARD_PREFIX@_FNMATCH_H */ kbuild-3608/src/grep/lib/at-func.c0000664000175000017500000001047014670377423016720 0ustar locutuslocutus/* Define at-style functions like fstatat, unlinkat, fchownat, etc. Copyright (C) 2006, 2009-2021 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 . */ /* written by Jim Meyering */ #include "filename.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ #ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD # include # ifndef ENOTSUP # define ENOTSUP EINVAL # endif #else # include "openat.h" # include "openat-priv.h" # include "save-cwd.h" #endif #ifdef AT_FUNC_USE_F1_COND # define CALL_FUNC(F) \ (flag == AT_FUNC_USE_F1_COND \ ? AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS) \ : AT_FUNC_F2 (F AT_FUNC_POST_FILE_ARGS)) # define VALIDATE_FLAG(F) \ if (flag & ~AT_FUNC_USE_F1_COND) \ { \ errno = EINVAL; \ return FUNC_FAIL; \ } #else # define CALL_FUNC(F) (AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS)) # define VALIDATE_FLAG(F) /* empty */ #endif #ifdef AT_FUNC_RESULT # define FUNC_RESULT AT_FUNC_RESULT #else # define FUNC_RESULT int #endif #ifdef AT_FUNC_FAIL # define FUNC_FAIL AT_FUNC_FAIL #else # define FUNC_FAIL -1 #endif /* Call AT_FUNC_F1 to operate on FILE, which is in the directory open on descriptor FD. If AT_FUNC_USE_F1_COND is defined to a value, AT_FUNC_POST_FILE_PARAM_DECLS must include a parameter named flag; call AT_FUNC_F2 if FLAG is 0 or fail if FLAG contains more bits than AT_FUNC_USE_F1_COND. Return int and fail with -1 unless AT_FUNC_RESULT or AT_FUNC_FAIL are defined. If possible, do it without changing the working directory. Otherwise, resort to using save_cwd/fchdir, then AT_FUNC_F?/restore_cwd. If either the save_cwd or the restore_cwd fails, then give a diagnostic and exit nonzero. */ FUNC_RESULT AT_FUNC_NAME (int fd, char const *file AT_FUNC_POST_FILE_PARAM_DECLS) { VALIDATE_FLAG (flag); if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file)) return CALL_FUNC (file); #ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD errno = ENOTSUP; return FUNC_FAIL; #else { /* Be careful to choose names unlikely to conflict with AT_FUNC_POST_FILE_PARAM_DECLS. */ struct saved_cwd saved_cwd; int saved_errno; FUNC_RESULT err; { char proc_buf[OPENAT_BUFFER_SIZE]; char *proc_file = openat_proc_name (proc_buf, fd, file); if (proc_file) { FUNC_RESULT proc_result = CALL_FUNC (proc_file); int proc_errno = errno; if (proc_file != proc_buf) free (proc_file); /* If the syscall succeeds, or if it fails with an unexpected errno value, then return right away. Otherwise, fall through and resort to using save_cwd/restore_cwd. */ if (FUNC_FAIL != proc_result) return proc_result; if (! EXPECTED_ERRNO (proc_errno)) { errno = proc_errno; return proc_result; } } } if (save_cwd (&saved_cwd) != 0) openat_save_fail (errno); if (0 <= fd && fd == saved_cwd.desc) { /* If saving the working directory collides with the user's requested fd, then the user's fd must have been closed to begin with. */ free_cwd (&saved_cwd); errno = EBADF; return FUNC_FAIL; } if (fchdir (fd) != 0) { saved_errno = errno; free_cwd (&saved_cwd); errno = saved_errno; return FUNC_FAIL; } err = CALL_FUNC (file); saved_errno = (err == FUNC_FAIL ? errno : 0); if (restore_cwd (&saved_cwd) != 0) openat_restore_fail (errno); free_cwd (&saved_cwd); if (saved_errno) errno = saved_errno; return err; } #endif } #undef CALL_FUNC #undef FUNC_RESULT #undef FUNC_FAIL kbuild-3608/src/grep/lib/stdbool.in.h0000664000175000017500000001201114670377426017437 0ustar locutuslocutus/* Copyright (C) 2001-2003, 2006-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2001. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _GL_STDBOOL_H #define _GL_STDBOOL_H /* ISO C 99 for platforms that lack it. */ /* Usage suggestions: Programs that use should be aware of some limitations and standards compliance issues. Standards compliance: - must be #included before 'bool', 'false', 'true' can be used. - You cannot assume that sizeof (bool) == 1. - Programs should not undefine the macros bool, true, and false, as C99 lists that as an "obsolescent feature". Limitations of this substitute, when used in a C89 environment: - must be #included before the '_Bool' type can be used. - You cannot assume that _Bool is a typedef; it might be a macro. - Bit-fields of type 'bool' are not supported. Portable code should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. - In C99, casts and automatic conversions to '_Bool' or 'bool' are performed in such a way that every nonzero value gets converted to 'true', and zero gets converted to 'false'. This doesn't work with this substitute. With this substitute, only the values 0 and 1 give the expected result when converted to _Bool' or 'bool'. - C99 allows the use of (_Bool)0.0 in constant expressions, but this substitute cannot always provide this property. Also, it is suggested that programs use 'bool' rather than '_Bool'; this isn't required, but 'bool' is more common. */ /* 7.16. Boolean type and values */ /* BeOS already #defines false 0, true 1. We use the same definitions below, but temporarily we have to #undef them. */ #if defined __BEOS__ && !defined __HAIKU__ # include /* defines bool but not _Bool */ # undef false # undef true #endif #ifdef __cplusplus # define _Bool bool # define bool bool #else # if defined __BEOS__ && !defined __HAIKU__ /* A compiler known to have 'bool'. */ /* If the compiler already has both 'bool' and '_Bool', we can assume they are the same types. */ # if !@HAVE__BOOL@ typedef bool _Bool; # endif # else # if !defined __GNUC__ /* If @HAVE__BOOL@: Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when the built-in _Bool type is used. See https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html https://lists.gnu.org/r/bug-coreutils/2005-10/msg00086.html Similar bugs are likely with other compilers as well; this file wouldn't be used if was working. So we override the _Bool type. If !@HAVE__BOOL@: Need to define _Bool ourselves. As 'signed char' or as an enum type? Use of a typedef, with SunPRO C, leads to a stupid "warning: _Bool is a keyword in ISO C99". Use of an enum type, with IRIX cc, leads to a stupid "warning(1185): enumerated type mixed with another type". Even the existence of an enum type, without a typedef, "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. The only benefit of the enum, debuggability, is not important with these compilers. So use 'signed char' and no enum. */ # define _Bool signed char # else /* With this compiler, trust the _Bool type if the compiler has it. */ # if !@HAVE__BOOL@ /* For the sake of symbolic names in gdb, define true and false as enum constants, not only as macros. It is tempting to write typedef enum { false = 0, true = 1 } _Bool; so that gdb prints values of type 'bool' symbolically. But then values of type '_Bool' might promote to 'int' or 'unsigned int' (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' (see ISO C 99 6.3.1.1.(2)). So add a negative value to the enum; this ensures that '_Bool' promotes to 'int'. */ typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; # endif # endif # endif # define bool _Bool #endif /* The other macros must be usable in preprocessor directives. */ #ifdef __cplusplus # define false false # define true true #else # define false 0 # define true 1 #endif #define __bool_true_false_are_defined 1 #endif /* _GL_STDBOOL_H */ kbuild-3608/src/grep/lib/iconv_open-zos.h0000664000175000017500000003143714670377424020347 0ustar locutuslocutus/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -m 10 ./iconv_open-zos.gperf */ /* Computed positions: -k'4,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 17 "./iconv_open-zos.gperf" struct mapping { int standard_name; const char vendor_name[10 + 1]; }; #define TOTAL_KEYWORDS 49 #define MIN_WORD_LENGTH 3 #define MAX_WORD_LENGTH 11 #define MIN_HASH_VALUE 3 #define MAX_HASH_VALUE 64 /* maximum key range = 62, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int mapping_hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 16, 38, 14, 1, 32, 22, 29, 3, 0, 7, 40, 2, 5, 18, 23, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 0, 65, 65, 65, 0, 43, 65, 1, 65, 65, 8, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65 }; register unsigned int hval = len; switch (hval) { default: hval += asso_values[(unsigned char)str[3]+6]; /*FALLTHROUGH*/ case 3: break; } return hval + asso_values[(unsigned char)str[len - 1]]; } struct stringpool_t { char stringpool_str3[sizeof("GBK")]; char stringpool_str5[sizeof("ASCII")]; char stringpool_str7[sizeof("CP1253")]; char stringpool_str8[sizeof("EUC-KR")]; char stringpool_str9[sizeof("CP1257")]; char stringpool_str10[sizeof("CP857")]; char stringpool_str11[sizeof("ISO-8859-8")]; char stringpool_str12[sizeof("ISO-8859-3")]; char stringpool_str13[sizeof("ISO-8859-13")]; char stringpool_str14[sizeof("ISO-8859-7")]; char stringpool_str15[sizeof("CP437")]; char stringpool_str16[sizeof("CP1129")]; char stringpool_str17[sizeof("CP869")]; char stringpool_str18[sizeof("ISO-8859-9")]; char stringpool_str19[sizeof("CP922")]; char stringpool_str20[sizeof("CP1252")]; char stringpool_str21[sizeof("CP852")]; char stringpool_str22[sizeof("CP1250")]; char stringpool_str23[sizeof("CP850")]; char stringpool_str24[sizeof("CP862")]; char stringpool_str25[sizeof("ISO-8859-2")]; char stringpool_str26[sizeof("CP932")]; char stringpool_str27[sizeof("GB2312")]; char stringpool_str28[sizeof("CP1255")]; char stringpool_str29[sizeof("CP855")]; char stringpool_str30[sizeof("KOI8-R")]; char stringpool_str31[sizeof("CP1125")]; char stringpool_str32[sizeof("CP865")]; char stringpool_str33[sizeof("ISO-8859-5")]; char stringpool_str34[sizeof("ISO-8859-15")]; char stringpool_str35[sizeof("CP1256")]; char stringpool_str36[sizeof("CP856")]; char stringpool_str37[sizeof("KOI8-U")]; char stringpool_str38[sizeof("CP1254")]; char stringpool_str39[sizeof("CP866")]; char stringpool_str40[sizeof("ISO-8859-6")]; char stringpool_str41[sizeof("CP1124")]; char stringpool_str42[sizeof("CP864")]; char stringpool_str43[sizeof("ISO-8859-4")]; char stringpool_str44[sizeof("CP1251")]; char stringpool_str45[sizeof("CP775")]; char stringpool_str46[sizeof("CP943")]; char stringpool_str47[sizeof("CP1131")]; char stringpool_str48[sizeof("CP861")]; char stringpool_str49[sizeof("ISO-8859-1")]; char stringpool_str50[sizeof("EUC-JP")]; char stringpool_str52[sizeof("CP949")]; char stringpool_str55[sizeof("CP874")]; char stringpool_str64[sizeof("CP1046")]; }; static const struct stringpool_t stringpool_contents = { "GBK", "ASCII", "CP1253", "EUC-KR", "CP1257", "CP857", "ISO-8859-8", "ISO-8859-3", "ISO-8859-13", "ISO-8859-7", "CP437", "CP1129", "CP869", "ISO-8859-9", "CP922", "CP1252", "CP852", "CP1250", "CP850", "CP862", "ISO-8859-2", "CP932", "GB2312", "CP1255", "CP855", "KOI8-R", "CP1125", "CP865", "ISO-8859-5", "ISO-8859-15", "CP1256", "CP856", "KOI8-U", "CP1254", "CP866", "ISO-8859-6", "CP1124", "CP864", "ISO-8859-4", "CP1251", "CP775", "CP943", "CP1131", "CP861", "ISO-8859-1", "EUC-JP", "CP949", "CP874", "CP1046" }; #define stringpool ((const char *) &stringpool_contents) static const struct mapping mappings[] = { {-1}, {-1}, {-1}, #line 76 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str3, "IBM-1386"}, {-1}, #line 28 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str5, "00367"}, {-1}, #line 68 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, "IBM-5349"}, #line 75 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, "IBM-eucKR"}, #line 72 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, "09449"}, #line 48 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "00857"}, #line 36 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "05012"}, #line 31 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "00913"}, #line 38 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-13"}, #line 35 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "ISO8859-7"}, #line 42 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "IBM-437"}, #line 63 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "01129"}, #line 54 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "IBM-869"}, #line 37 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "ISO8859-9"}, #line 56 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "IBM-922"}, #line 67 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, "IBM-5348"}, #line 45 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, "IBM-852"}, #line 65 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, "IBM-5346"}, #line 44 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, "09042"}, #line 50 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str24, "IBM-862"}, #line 30 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25, "ISO8859-2"}, #line 57 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, "IBM-943"}, #line 73 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, "IBM-eucCN"}, #line 70 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str28, "09447"}, #line 46 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, "13143"}, #line 40 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, "00878"}, #line 62 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, "IBM-1125"}, #line 52 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str32, "00865"}, #line 33 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, "ISO8859-5"}, #line 39 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34, "ISO8859-15"}, #line 71 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, "09448"}, #line 47 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str36, "IBM-856"}, #line 41 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str37, "01168"}, #line 69 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, "IBM-5350"}, #line 53 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str39, "04962"}, #line 34 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str40, "ISO8859-6"}, #line 61 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41, "IBM-1124"}, #line 51 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str42, "IBM-864"}, #line 32 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str43, "ISO8859-4"}, #line 66 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str44, "IBM-5347"}, #line 43 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str45, "00775"}, #line 58 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str46, "IBM-943"}, #line 64 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str47, "01131"}, #line 49 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str48, "IBM-861"}, #line 29 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str49, "ISO8859-1"}, #line 74 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str50, "01350"}, {-1}, #line 59 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str52, "IBM-1363"}, {-1}, {-1}, #line 55 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str55, "TIS-620"}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, #line 60 "./iconv_open-zos.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str64, "IBM-1046"} }; const struct mapping * mapping_lookup (register const char *str, register size_t len) { if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = mapping_hash (str, len); if (key <= MAX_HASH_VALUE) { register int o = mappings[key].standard_name; if (o >= 0) { register const char *s = o + stringpool; if (*str == *s && !strcmp (str + 1, s + 1)) return &mappings[key]; } } } return 0; } kbuild-3608/src/grep/lib/getcwd-lgpl.c0000664000175000017500000000626614670377423017604 0ustar locutuslocutus/* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of gnulib. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification */ #include #include #include #include #if GNULIB_GETCWD /* Favor GPL getcwd.c if both getcwd and getcwd-lgpl modules are in use. */ typedef int dummy; #else /* Get the name of the current working directory, and put it in SIZE bytes of BUF. Returns NULL if the directory couldn't be determined (perhaps because the absolute name was longer than PATH_MAX, or because of missing read/search permissions on parent directories) or SIZE was too small. If successful, returns BUF. If BUF is NULL, an array is allocated with 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary. */ # undef getcwd # if defined _WIN32 && !defined __CYGWIN__ # define getcwd _getcwd # endif char * rpl_getcwd (char *buf, size_t size) { char *ptr; char *result; /* Handle single size operations. */ if (buf) { if (!size) { errno = EINVAL; return NULL; } return getcwd (buf, size); } if (size) { buf = malloc (size); if (!buf) { errno = ENOMEM; return NULL; } result = getcwd (buf, size); if (!result) free (buf); return result; } /* Flexible sizing requested. Avoid over-allocation for the common case of a name that fits within a 4k page, minus some space for local variables, to be sure we don't skip over a guard page. */ { char tmp[4032]; size = sizeof tmp; ptr = getcwd (tmp, size); if (ptr) { result = strdup (ptr); if (!result) errno = ENOMEM; return result; } if (errno != ERANGE) return NULL; } /* My what a large directory name we have. */ do { size <<= 1; ptr = realloc (buf, size); if (ptr == NULL) { free (buf); errno = ENOMEM; return NULL; } buf = ptr; result = getcwd (buf, size); } while (!result && errno == ERANGE); if (!result) free (buf); else { /* Here result == buf. */ /* Shrink result before returning it. */ size_t actual_size = strlen (result) + 1; if (actual_size < size) { char *shrinked_result = realloc (result, actual_size); if (shrinked_result != NULL) result = shrinked_result; } } return result; } #endif kbuild-3608/src/grep/lib/fts.c0000664000175000017500000021740414670377423016165 0ustar locutuslocutus/* Traverse a file hierarchy. Copyright (C) 2004-2021 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 . */ /*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #if defined LIBC_SCCS && !defined GCC_LINT && !defined lint static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #endif #include "fts_.h" #if HAVE_SYS_PARAM_H || defined _LIBC # include #endif #ifdef _LIBC # include #else # include #endif #include #include #include #include #include #include #include #include #if ! _LIBC # include "attribute.h" # include "fcntl--.h" # include "flexmember.h" # include "openat.h" # include "opendirat.h" # include "same-inode.h" #endif #include #ifndef _D_EXACT_NAMLEN # define _D_EXACT_NAMLEN(dirent) strlen ((dirent)->d_name) #endif #if HAVE_STRUCT_DIRENT_D_TYPE /* True if the type of the directory entry D is known. */ # define DT_IS_KNOWN(d) ((d)->d_type != DT_UNKNOWN) /* True if the type of the directory entry D must be T. */ # define DT_MUST_BE(d, t) ((d)->d_type == (t)) # define D_TYPE(d) ((d)->d_type) #else # define DT_IS_KNOWN(d) false # define DT_MUST_BE(d, t) false # define D_TYPE(d) DT_UNKNOWN # undef DT_UNKNOWN # define DT_UNKNOWN 0 /* Any nonzero values will do here, so long as they're distinct. Undef any existing macros out of the way. */ # undef DT_BLK # undef DT_CHR # undef DT_DIR # undef DT_FIFO # undef DT_LNK # undef DT_REG # undef DT_SOCK # define DT_BLK 1 # define DT_CHR 2 # define DT_DIR 3 # define DT_FIFO 4 # define DT_LNK 5 # define DT_REG 6 # define DT_SOCK 7 #endif #ifndef S_IFLNK # define S_IFLNK 0 #endif #ifndef S_IFSOCK # define S_IFSOCK 0 #endif enum { NOT_AN_INODE_NUMBER = 0 }; #ifdef D_INO_IN_DIRENT # define D_INO(dp) (dp)->d_ino #else /* Some systems don't have inodes, so fake them to avoid lots of ifdefs. */ # define D_INO(dp) NOT_AN_INODE_NUMBER #endif /* If possible (see max_entries, below), read no more than this many directory entries at a time. Without this limit (i.e., when using non-NULL fts_compar), processing a directory with 4,000,000 entries requires ~1GiB of memory, and handling 64M entries would require 16GiB of memory. */ #ifndef FTS_MAX_READDIR_ENTRIES # define FTS_MAX_READDIR_ENTRIES 100000 #endif /* If there are more than this many entries in a directory, and the conditions mentioned below are satisfied, then sort the entries on inode number before any further processing. */ #ifndef FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD # define FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD 10000 #endif enum { _FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD = FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD }; enum Fts_stat { FTS_NO_STAT_REQUIRED = 1, FTS_STAT_REQUIRED = 2 }; #ifdef _LIBC # undef close # define close __close # undef closedir # define closedir __closedir # undef fchdir # define fchdir __fchdir # undef open # define open __open # undef readdir # define readdir __readdir #else # undef internal_function # define internal_function /* empty */ #endif #ifndef __set_errno # define __set_errno(Val) errno = (Val) #endif /* If this host provides the openat function, then we can avoid attempting to open "." in some initialization code below. */ #ifdef HAVE_OPENAT # define HAVE_OPENAT_SUPPORT 1 #else # define HAVE_OPENAT_SUPPORT 0 #endif #ifdef NDEBUG # define fts_assert(expr) ((void) (0 && (expr))) #else # define fts_assert(expr) \ do \ { \ if (!(expr)) \ abort (); \ } \ while (false) #endif #ifdef _LIBC # if __GNUC__ >= 7 # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) # endif #endif static FTSENT *fts_alloc (FTS *, const char *, size_t) internal_function; static FTSENT *fts_build (FTS *, int) internal_function; static void fts_lfree (FTSENT *) internal_function; static void fts_load (FTS *, FTSENT *) internal_function; static size_t fts_maxarglen (char * const *) internal_function; static void fts_padjust (FTS *, FTSENT *) internal_function; static bool fts_palloc (FTS *, size_t) internal_function; static FTSENT *fts_sort (FTS *, FTSENT *, size_t) internal_function; static unsigned short int fts_stat (FTS *, FTSENT *, bool) internal_function; static int fts_safe_changedir (FTS *, FTSENT *, int, const char *) internal_function; #include "fts-cycle.c" #ifndef MAX # define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2]))) #define STREQ(a, b) (strcmp (a, b) == 0) #define CLR(opt) (sp->fts_options &= ~(opt)) #define ISSET(opt) (sp->fts_options & (opt)) #define SET(opt) (sp->fts_options |= (opt)) /* FIXME: FTS_NOCHDIR is now misnamed. Call it FTS_USE_FULL_RELATIVE_FILE_NAMES instead. */ #define FCHDIR(sp, fd) \ (!ISSET(FTS_NOCHDIR) && (ISSET(FTS_CWDFD) \ ? (cwd_advance_fd ((sp), (fd), true), 0) \ : fchdir (fd))) /* fts_build flags */ /* FIXME: make this an enum */ #define BCHILD 1 /* fts_children */ #define BNAMES 2 /* fts_children, names only */ #define BREAD 3 /* fts_read */ #if FTS_DEBUG # include # include # include # include "getcwdat.h" bool fts_debug = false; # define Dprintf(x) do { if (fts_debug) printf x; } while (false) #else # define Dprintf(x) # define fd_ring_check(x) # define fd_ring_print(a, b, c) #endif #define LEAVE_DIR(Fts, Ent, Tag) \ do \ { \ Dprintf ((" %s-leaving: %s\n", Tag, (Ent)->fts_path)); \ leave_dir (Fts, Ent); \ fd_ring_check (Fts); \ } \ while (false) static void fd_ring_clear (I_ring *fd_ring) { while ( ! i_ring_empty (fd_ring)) { int fd = i_ring_pop (fd_ring); if (0 <= fd) close (fd); } } /* Overload the fts_statp->st_size member (otherwise unused, when fts_info is FTS_NSOK) to indicate whether fts_read should stat this entry or not. */ static void fts_set_stat_required (FTSENT *p, bool required) { fts_assert (p->fts_info == FTS_NSOK); p->fts_statp->st_size = (required ? FTS_STAT_REQUIRED : FTS_NO_STAT_REQUIRED); } /* Virtual fchdir. Advance SP's working directory file descriptor, SP->fts_cwd_fd, to FD, and push the previous value onto the fd_ring. CHDIR_DOWN_ONE is true if FD corresponds to an entry in the directory open on sp->fts_cwd_fd; i.e., to move the working directory one level down. */ static void internal_function cwd_advance_fd (FTS *sp, int fd, bool chdir_down_one) { int old = sp->fts_cwd_fd; fts_assert (old != fd || old == AT_FDCWD); if (chdir_down_one) { /* Push "old" onto the ring. If the displaced file descriptor is non-negative, close it. */ int prev_fd_in_slot = i_ring_push (&sp->fts_fd_ring, old); fd_ring_print (sp, stderr, "post-push"); if (0 <= prev_fd_in_slot) close (prev_fd_in_slot); /* ignore any close failure */ } else if ( ! ISSET (FTS_NOCHDIR)) { if (0 <= old) close (old); /* ignore any close failure */ } sp->fts_cwd_fd = fd; } /* Restore the initial, pre-traversal, "working directory". In FTS_CWDFD mode, we merely call cwd_advance_fd, otherwise, we may actually change the working directory. Return 0 upon success. Upon failure, set errno and return nonzero. */ static int restore_initial_cwd (FTS *sp) { int fail = FCHDIR (sp, ISSET (FTS_CWDFD) ? AT_FDCWD : sp->fts_rfd); fd_ring_clear (&(sp->fts_fd_ring)); return fail; } /* Open the directory DIR if possible, and return a file descriptor. Return -1 and set errno on failure. It doesn't matter whether the file descriptor has read or write access. */ static int internal_function diropen (FTS const *sp, char const *dir) { int open_flags = (O_SEARCH | O_CLOEXEC | O_DIRECTORY | O_NOCTTY | O_NONBLOCK | (ISSET (FTS_PHYSICAL) ? O_NOFOLLOW : 0)); int fd = (ISSET (FTS_CWDFD) ? openat (sp->fts_cwd_fd, dir, open_flags) : open (dir, open_flags)); return fd; } FTS * fts_open (char * const *argv, register int options, int (*compar) (FTSENT const **, FTSENT const **)) { register FTS *sp; register FTSENT *p, *root; register size_t nitems; FTSENT *parent = NULL; FTSENT *tmp = NULL; /* pacify gcc */ bool defer_stat; /* Options check. */ if (options & ~FTS_OPTIONMASK) { __set_errno (EINVAL); return (NULL); } if ((options & FTS_NOCHDIR) && (options & FTS_CWDFD)) { __set_errno (EINVAL); return (NULL); } if ( ! (options & (FTS_LOGICAL | FTS_PHYSICAL))) { __set_errno (EINVAL); return (NULL); } /* Allocate/initialize the stream */ sp = calloc (1, sizeof *sp); if (sp == NULL) return (NULL); sp->fts_compar = compar; sp->fts_options = options; /* Logical walks turn on NOCHDIR; symbolic links are too hard. */ if (ISSET(FTS_LOGICAL)) { SET(FTS_NOCHDIR); CLR(FTS_CWDFD); } /* Initialize fts_cwd_fd. */ sp->fts_cwd_fd = AT_FDCWD; if ( ISSET(FTS_CWDFD) && ! HAVE_OPENAT_SUPPORT) { /* While it isn't technically necessary to open "." this early, doing it here saves us the trouble of ensuring later (where it'd be messier) that "." can in fact be opened. If not, revert to FTS_NOCHDIR mode. */ int fd = open (".", O_SEARCH | O_CLOEXEC); if (fd < 0) { /* Even if "." is unreadable, don't revert to FTS_NOCHDIR mode on systems like Linux+PROC_FS, where our openat emulation is good enough. Note: on a system that emulates openat via /proc, this technique can still fail, but only in extreme conditions, e.g., when the working directory cannot be saved (i.e. save_cwd fails) -- and that happens on Linux only when "." is unreadable and the CWD would be longer than PATH_MAX. FIXME: once Linux kernel openat support is well established, replace the above open call and this entire if/else block with the body of the if-block below. */ if ( openat_needs_fchdir ()) { SET(FTS_NOCHDIR); CLR(FTS_CWDFD); } } else { close (fd); } } /* * Start out with 1K of file name space, and enough, in any case, * to hold the user's file names. */ #ifndef MAXPATHLEN # define MAXPATHLEN 1024 #endif { size_t maxarglen = fts_maxarglen(argv); if (! fts_palloc(sp, MAX(maxarglen, MAXPATHLEN))) goto mem1; } /* Allocate/initialize root's parent. */ if (*argv != NULL) { if ((parent = fts_alloc(sp, "", 0)) == NULL) goto mem2; parent->fts_level = FTS_ROOTPARENTLEVEL; } /* The classic fts implementation would call fts_stat with a new entry for each iteration of the loop below. If the comparison function is not specified or if the FTS_DEFER_STAT option is in effect, don't stat any entry in this loop. This is an attempt to minimize the interval between the initial stat/lstat/fstatat and the point at which a directory argument is first opened. This matters for any directory command line argument that resides on a file system without genuine i-nodes. If you specify FTS_DEFER_STAT along with a comparison function, that function must not access any data via the fts_statp pointer. */ defer_stat = (compar == NULL || ISSET(FTS_DEFER_STAT)); /* Allocate/initialize root(s). */ for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) { /* *Do* allow zero-length file names. */ size_t len = strlen(*argv); if ( ! (options & FTS_VERBATIM)) { /* If there are two or more trailing slashes, trim all but one, but don't change "//" to "/", and do map "///" to "/". */ char const *v = *argv; if (2 < len && v[len - 1] == '/') while (1 < len && v[len - 2] == '/') --len; } if ((p = fts_alloc(sp, *argv, len)) == NULL) goto mem3; p->fts_level = FTS_ROOTLEVEL; p->fts_parent = parent; p->fts_accpath = p->fts_name; /* Even when defer_stat is true, be sure to stat the first command line argument, since fts_read (at least with FTS_XDEV) requires that. */ if (defer_stat && root != NULL) { p->fts_info = FTS_NSOK; fts_set_stat_required(p, true); } else { p->fts_info = fts_stat(sp, p, false); } /* * If comparison routine supplied, traverse in sorted * order; otherwise traverse in the order specified. */ if (compar) { p->fts_link = root; root = p; } else { p->fts_link = NULL; if (root == NULL) tmp = root = p; else { tmp->fts_link = p; tmp = p; } } } if (compar && nitems > 1) root = fts_sort(sp, root, nitems); /* * Allocate a dummy pointer and make fts_read think that we've just * finished the node before the root(s); set p->fts_info to FTS_INIT * so that everything about the "current" node is ignored. */ if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL) goto mem3; sp->fts_cur->fts_link = root; sp->fts_cur->fts_info = FTS_INIT; sp->fts_cur->fts_level = 1; if (! setup_dir (sp)) goto mem3; /* * If using chdir(2), grab a file descriptor pointing to dot to ensure * that we can get back here; this could be avoided for some file names, * but almost certainly not worth the effort. Slashes, symbolic links, * and ".." are all fairly nasty problems. Note, if we can't get the * descriptor we run anyway, just more slowly. */ if (!ISSET(FTS_NOCHDIR) && !ISSET(FTS_CWDFD) && (sp->fts_rfd = diropen (sp, ".")) < 0) SET(FTS_NOCHDIR); i_ring_init (&sp->fts_fd_ring, -1); return (sp); mem3: fts_lfree(root); free(parent); mem2: free(sp->fts_path); mem1: free(sp); return (NULL); } static void internal_function fts_load (FTS *sp, register FTSENT *p) { register size_t len; register char *cp; /* * Load the stream structure for the next traversal. Since we don't * actually enter the directory until after the preorder visit, set * the fts_accpath field specially so the chdir gets done to the right * place and the user can access the first node. From fts_open it's * known that the file name will fit. */ len = p->fts_pathlen = p->fts_namelen; memmove(sp->fts_path, p->fts_name, len + 1); if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) { len = strlen(++cp); memmove(p->fts_name, cp, len + 1); p->fts_namelen = len; } p->fts_accpath = p->fts_path = sp->fts_path; } int fts_close (FTS *sp) { register FTSENT *freep, *p; int saved_errno = 0; /* * This still works if we haven't read anything -- the dummy structure * points to the root list, so we step through to the end of the root * list which has a valid parent pointer. */ if (sp->fts_cur) { for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) { freep = p; p = p->fts_link != NULL ? p->fts_link : p->fts_parent; free(freep); } free(p); } /* Free up child linked list, sort array, file name buffer. */ if (sp->fts_child) fts_lfree(sp->fts_child); free(sp->fts_array); free(sp->fts_path); if (ISSET(FTS_CWDFD)) { if (0 <= sp->fts_cwd_fd) if (close (sp->fts_cwd_fd)) saved_errno = errno; } else if (!ISSET(FTS_NOCHDIR)) { /* Return to original directory, save errno if necessary. */ if (fchdir(sp->fts_rfd)) saved_errno = errno; /* If close fails, record errno only if saved_errno is zero, so that we report the probably-more-meaningful fchdir errno. */ if (close (sp->fts_rfd)) if (saved_errno == 0) saved_errno = errno; } fd_ring_clear (&sp->fts_fd_ring); if (sp->fts_leaf_optimization_works_ht) hash_free (sp->fts_leaf_optimization_works_ht); free_dir (sp); /* Free up the stream pointer. */ free(sp); /* Set errno and return. */ if (saved_errno) { __set_errno (saved_errno); return (-1); } return (0); } /* Minimum link count of a traditional Unix directory. When leaf optimization is OK and a directory's st_nlink == MIN_DIR_NLINK, then the directory has no subdirectories. */ enum { MIN_DIR_NLINK = 2 }; /* Whether leaf optimization is OK for a directory. */ enum leaf_optimization { /* st_nlink is not reliable for this directory's subdirectories. */ NO_LEAF_OPTIMIZATION, /* st_nlink == 2 means the directory lacks subdirectories. */ OK_LEAF_OPTIMIZATION }; #if (defined __linux__ || defined __ANDROID__) \ && HAVE_SYS_VFS_H && HAVE_FSTATFS && HAVE_STRUCT_STATFS_F_TYPE # include /* Linux-specific constants from coreutils' src/fs.h */ # define S_MAGIC_AFS 0x5346414F # define S_MAGIC_CIFS 0xFF534D42 # define S_MAGIC_NFS 0x6969 # define S_MAGIC_PROC 0x9FA0 # define S_MAGIC_TMPFS 0x1021994 # ifdef HAVE___FSWORD_T typedef __fsword_t fsword; # else typedef long int fsword; # endif /* Map a stat.st_dev number to a file system type number f_ftype. */ struct dev_type { dev_t st_dev; fsword f_type; }; /* Use a tiny initial size. If a traversal encounters more than a few devices, the cost of growing/rehashing this table will be rendered negligible by the number of inodes processed. */ enum { DEV_TYPE_HT_INITIAL_SIZE = 13 }; static size_t dev_type_hash (void const *x, size_t table_size) { struct dev_type const *ax = x; uintmax_t dev = ax->st_dev; return dev % table_size; } static bool dev_type_compare (void const *x, void const *y) { struct dev_type const *ax = x; struct dev_type const *ay = y; return ax->st_dev == ay->st_dev; } /* Return the file system type of P with file descriptor FD, or 0 if not known. If FD is negative, P's file descriptor is unavailable. Try to cache known values. */ static fsword filesystem_type (FTSENT const *p, int fd) { FTS *sp = p->fts_fts; Hash_table *h = sp->fts_leaf_optimization_works_ht; struct dev_type *ent; struct statfs fs_buf; /* If we're not in CWDFD mode, don't bother with this optimization, since the caller is not serious about performance. */ if (!ISSET (FTS_CWDFD)) return 0; if (! h) h = sp->fts_leaf_optimization_works_ht = hash_initialize (DEV_TYPE_HT_INITIAL_SIZE, NULL, dev_type_hash, dev_type_compare, free); if (h) { struct dev_type tmp; tmp.st_dev = p->fts_statp->st_dev; ent = hash_lookup (h, &tmp); if (ent) return ent->f_type; } /* Look-up failed. Query directly and cache the result. */ if (fd < 0 || fstatfs (fd, &fs_buf) != 0) return 0; if (h) { struct dev_type *t2 = malloc (sizeof *t2); if (t2) { t2->st_dev = p->fts_statp->st_dev; t2->f_type = fs_buf.f_type; ent = hash_insert (h, t2); if (ent) fts_assert (ent == t2); else free (t2); } } return fs_buf.f_type; } /* Return true if sorting dirents on inode numbers is known to improve traversal performance for the directory P with descriptor DIR_FD. Return false otherwise. When in doubt, return true. DIR_FD is negative if unavailable. */ static bool dirent_inode_sort_may_be_useful (FTSENT const *p, int dir_fd) { /* Skip the sort only if we can determine efficiently that skipping it is the right thing to do. The cost of performing an unnecessary sort is negligible, while the cost of *not* performing it can be O(N^2) with a very large constant. */ switch (filesystem_type (p, dir_fd)) { case S_MAGIC_CIFS: case S_MAGIC_NFS: case S_MAGIC_TMPFS: /* On a file system of any of these types, sorting is unnecessary, and hence wasteful. */ return false; default: return true; } } /* Given an FTS entry P for a directory with descriptor DIR_FD, return whether it is valid to apply leaf optimization. The optimization is valid if a directory's st_nlink value equal to MIN_DIR_NLINK means the directory has no subdirectories. DIR_FD is negative if unavailable. */ static enum leaf_optimization leaf_optimization (FTSENT const *p, int dir_fd) { switch (filesystem_type (p, dir_fd)) { case 0: /* Leaf optimization is unsafe if the file system type is unknown. */ FALLTHROUGH; case S_MAGIC_AFS: /* Although AFS mount points are not counted in st_nlink, they act like directories. See . */ FALLTHROUGH; case S_MAGIC_CIFS: /* Leaf optimization causes 'find' to abort. See . */ FALLTHROUGH; case S_MAGIC_NFS: /* NFS provides usable dirent.d_type but not necessarily for all entries of large directories, so as per NFS should return true. However st_nlink values are not accurate on all implementations as per . */ FALLTHROUGH; case S_MAGIC_PROC: /* Per /proc may have bogus stat.st_nlink values. */ return NO_LEAF_OPTIMIZATION; default: return OK_LEAF_OPTIMIZATION; } } #else static bool dirent_inode_sort_may_be_useful (FTSENT const *p _GL_UNUSED, int dir_fd _GL_UNUSED) { return true; } static enum leaf_optimization leaf_optimization (FTSENT const *p _GL_UNUSED, int dir_fd _GL_UNUSED) { return NO_LEAF_OPTIMIZATION; } #endif /* * Special case of "/" at the end of the file name so that slashes aren't * appended which would cause file names to be written as "....//foo". */ #define NAPPEND(p) \ (p->fts_path[p->fts_pathlen - 1] == '/' \ ? p->fts_pathlen - 1 : p->fts_pathlen) FTSENT * fts_read (register FTS *sp) { register FTSENT *p, *tmp; register unsigned short int instr; register char *t; /* If finished or unrecoverable error, return NULL. */ if (sp->fts_cur == NULL || ISSET(FTS_STOP)) return (NULL); /* Set current node pointer. */ p = sp->fts_cur; /* Save and zero out user instructions. */ instr = p->fts_instr; p->fts_instr = FTS_NOINSTR; /* Any type of file may be re-visited; re-stat and re-turn. */ if (instr == FTS_AGAIN) { p->fts_info = fts_stat(sp, p, false); return (p); } Dprintf (("fts_read: p=%s\n", p->fts_info == FTS_INIT ? "" : p->fts_path)); /* * Following a symlink -- SLNONE test allows application to see * SLNONE and recover. If indirecting through a symlink, have * keep a pointer to current location. If unable to get that * pointer, follow fails. */ if (instr == FTS_FOLLOW && (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) { p->fts_info = fts_stat(sp, p, true); if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { if ((p->fts_symfd = diropen (sp, ".")) < 0) { p->fts_errno = errno; p->fts_info = FTS_ERR; } else p->fts_flags |= FTS_SYMFOLLOW; } goto check_for_dir; } /* Directory in pre-order. */ if (p->fts_info == FTS_D) { /* If skipped or crossed mount point, do post-order visit. */ if (instr == FTS_SKIP || (ISSET(FTS_XDEV) && p->fts_statp->st_dev != sp->fts_dev)) { if (p->fts_flags & FTS_SYMFOLLOW) (void)close(p->fts_symfd); if (sp->fts_child) { fts_lfree(sp->fts_child); sp->fts_child = NULL; } p->fts_info = FTS_DP; LEAVE_DIR (sp, p, "1"); return (p); } /* Rebuild if only read the names and now traversing. */ if (sp->fts_child != NULL && ISSET(FTS_NAMEONLY)) { CLR(FTS_NAMEONLY); fts_lfree(sp->fts_child); sp->fts_child = NULL; } /* * Cd to the subdirectory. * * If have already read and now fail to chdir, whack the list * to make the names come out right, and set the parent errno * so the application will eventually get an error condition. * Set the FTS_DONTCHDIR flag so that when we logically change * directories back to the parent we don't do a chdir. * * If haven't read do so. If the read fails, fts_build sets * FTS_STOP or the fts_info field of the node. */ if (sp->fts_child != NULL) { if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) { p->fts_errno = errno; p->fts_flags |= FTS_DONTCHDIR; for (p = sp->fts_child; p != NULL; p = p->fts_link) p->fts_accpath = p->fts_parent->fts_accpath; } } else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) { if (ISSET(FTS_STOP)) return (NULL); /* If fts_build's call to fts_safe_changedir failed because it was not able to fchdir into a subdirectory, tell the caller. */ if (p->fts_errno && p->fts_info != FTS_DNR) p->fts_info = FTS_ERR; LEAVE_DIR (sp, p, "2"); return (p); } p = sp->fts_child; sp->fts_child = NULL; goto name; } /* Move to the next node on this level. */ next: tmp = p; /* If we have so many directory entries that we're reading them in batches, and we've reached the end of the current batch, read in a new batch. */ if (p->fts_link == NULL && p->fts_parent->fts_dirp) { p = tmp->fts_parent; sp->fts_cur = p; sp->fts_path[p->fts_pathlen] = '\0'; if ((p = fts_build (sp, BREAD)) == NULL) { if (ISSET(FTS_STOP)) return NULL; goto cd_dot_dot; } free(tmp); goto name; } if ((p = p->fts_link) != NULL) { sp->fts_cur = p; free(tmp); /* * If reached the top, return to the original directory (or * the root of the tree), and load the file names for the next * root. */ if (p->fts_level == FTS_ROOTLEVEL) { if (restore_initial_cwd(sp)) { SET(FTS_STOP); return (NULL); } free_dir(sp); fts_load(sp, p); setup_dir(sp); goto check_for_dir; } /* * User may have called fts_set on the node. If skipped, * ignore. If followed, get a file descriptor so we can * get back if necessary. */ if (p->fts_instr == FTS_SKIP) goto next; if (p->fts_instr == FTS_FOLLOW) { p->fts_info = fts_stat(sp, p, true); if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { if ((p->fts_symfd = diropen (sp, ".")) < 0) { p->fts_errno = errno; p->fts_info = FTS_ERR; } else p->fts_flags |= FTS_SYMFOLLOW; } p->fts_instr = FTS_NOINSTR; } name: t = sp->fts_path + NAPPEND(p->fts_parent); *t++ = '/'; memmove(t, p->fts_name, p->fts_namelen + 1); check_for_dir: sp->fts_cur = p; if (p->fts_info == FTS_NSOK) { if (p->fts_statp->st_size == FTS_STAT_REQUIRED) p->fts_info = fts_stat(sp, p, false); else fts_assert (p->fts_statp->st_size == FTS_NO_STAT_REQUIRED); } if (p->fts_info == FTS_D) { /* Now that P->fts_statp is guaranteed to be valid, if this is a command-line directory, record its device number, to be used for FTS_XDEV. */ if (p->fts_level == FTS_ROOTLEVEL) sp->fts_dev = p->fts_statp->st_dev; Dprintf ((" entering: %s\n", p->fts_path)); if (! enter_dir (sp, p)) { __set_errno (ENOMEM); return NULL; } } return p; } cd_dot_dot: /* Move up to the parent node. */ p = tmp->fts_parent; sp->fts_cur = p; free(tmp); if (p->fts_level == FTS_ROOTPARENTLEVEL) { /* * Done; free everything up and set errno to 0 so the user * can distinguish between error and EOF. */ free(p); __set_errno (0); return (sp->fts_cur = NULL); } fts_assert (p->fts_info != FTS_NSOK); /* NUL terminate the file name. */ sp->fts_path[p->fts_pathlen] = '\0'; /* * Return to the parent directory. If at a root node, restore * the initial working directory. If we came through a symlink, * go back through the file descriptor. Otherwise, move up * one level, via "..". */ if (p->fts_level == FTS_ROOTLEVEL) { if (restore_initial_cwd(sp)) { p->fts_errno = errno; SET(FTS_STOP); } } else if (p->fts_flags & FTS_SYMFOLLOW) { if (FCHDIR(sp, p->fts_symfd)) { p->fts_errno = errno; SET(FTS_STOP); } (void)close(p->fts_symfd); } else if (!(p->fts_flags & FTS_DONTCHDIR) && fts_safe_changedir(sp, p->fts_parent, -1, "..")) { p->fts_errno = errno; SET(FTS_STOP); } /* If the directory causes a cycle, preserve the FTS_DC flag and keep the corresponding dev/ino pair in the hash table. It is going to be removed when leaving the original directory. */ if (p->fts_info != FTS_DC) { p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP; if (p->fts_errno == 0) LEAVE_DIR (sp, p, "3"); } return ISSET(FTS_STOP) ? NULL : p; } /* * Fts_set takes the stream as an argument although it's not used in this * implementation; it would be necessary if anyone wanted to add global * semantics to fts using fts_set. An error return is allowed for similar * reasons. */ /* ARGSUSED */ int fts_set(FTS *sp _GL_UNUSED, FTSENT *p, int instr) { if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW && instr != FTS_NOINSTR && instr != FTS_SKIP) { __set_errno (EINVAL); return (1); } p->fts_instr = instr; return (0); } FTSENT * fts_children (register FTS *sp, int instr) { register FTSENT *p; int fd; if (instr != 0 && instr != FTS_NAMEONLY) { __set_errno (EINVAL); return (NULL); } /* Set current node pointer. */ p = sp->fts_cur; /* * Errno set to 0 so user can distinguish empty directory from * an error. */ __set_errno (0); /* Fatal errors stop here. */ if (ISSET(FTS_STOP)) return (NULL); /* Return logical hierarchy of user's arguments. */ if (p->fts_info == FTS_INIT) return (p->fts_link); /* * If not a directory being visited in pre-order, stop here. Could * allow FTS_DNR, assuming the user has fixed the problem, but the * same effect is available with FTS_AGAIN. */ if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */) return (NULL); /* Free up any previous child list. */ if (sp->fts_child != NULL) fts_lfree(sp->fts_child); if (instr == FTS_NAMEONLY) { SET(FTS_NAMEONLY); instr = BNAMES; } else instr = BCHILD; /* * If using chdir on a relative file name and called BEFORE fts_read * does its chdir to the root of a traversal, we can lose -- we need to * chdir into the subdirectory, and we don't know where the current * directory is, so we can't get back so that the upcoming chdir by * fts_read will work. */ if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' || ISSET(FTS_NOCHDIR)) return (sp->fts_child = fts_build(sp, instr)); if ((fd = diropen (sp, ".")) < 0) return (sp->fts_child = NULL); sp->fts_child = fts_build(sp, instr); if (ISSET(FTS_CWDFD)) { cwd_advance_fd (sp, fd, true); } else { if (fchdir(fd)) { int saved_errno = errno; close (fd); __set_errno (saved_errno); return NULL; } close (fd); } return (sp->fts_child); } /* A comparison function to sort on increasing inode number. For some file system types, sorting either way makes a huge performance difference for a directory with very many entries, but sorting on increasing values is slightly better than sorting on decreasing values. The difference is in the 5% range. */ static int fts_compare_ino (struct _ftsent const **a, struct _ftsent const **b) { return _GL_CMP (a[0]->fts_statp->st_ino, b[0]->fts_statp->st_ino); } /* Map the dirent.d_type value, DTYPE, to the corresponding stat.st_mode S_IF* bit and set ST.st_mode, thus clearing all other bits in that field. */ static void set_stat_type (struct stat *st, unsigned int dtype) { mode_t type; switch (dtype) { case DT_BLK: type = S_IFBLK; break; case DT_CHR: type = S_IFCHR; break; case DT_DIR: type = S_IFDIR; break; case DT_FIFO: type = S_IFIFO; break; case DT_LNK: type = S_IFLNK; break; case DT_REG: type = S_IFREG; break; case DT_SOCK: type = S_IFSOCK; break; default: type = 0; } st->st_mode = type; } #define closedir_and_clear(dirp) \ do \ { \ closedir (dirp); \ dirp = NULL; \ } \ while (0) #define fts_opendir(file, Pdir_fd) \ opendirat((! ISSET(FTS_NOCHDIR) && ISSET(FTS_CWDFD) \ ? sp->fts_cwd_fd : AT_FDCWD), \ file, \ (((ISSET(FTS_PHYSICAL) \ && ! (ISSET(FTS_COMFOLLOW) \ && cur->fts_level == FTS_ROOTLEVEL)) \ ? O_NOFOLLOW : 0)), \ Pdir_fd) /* * This is the tricky part -- do not casually change *anything* in here. The * idea is to build the linked list of entries that are used by fts_children * and fts_read. There are lots of special cases. * * The real slowdown in walking the tree is the stat calls. If FTS_NOSTAT is * set and it's a physical walk (so that symbolic links can't be directories), * we can do things quickly. First, if it's a 4.4BSD file system, the type * of the file is in the directory entry. Otherwise, we assume that the number * of subdirectories in a node is equal to the number of links to the parent. * The former skips all stat calls. The latter skips stat calls in any leaf * directories and for any files after the subdirectories in the directory have * been found, cutting the stat calls by about 2/3. */ static FTSENT * internal_function fts_build (register FTS *sp, int type) { register FTSENT *p, *head; register size_t nitems; FTSENT *tail; void *oldaddr; int saved_errno; bool descend; bool doadjust; ptrdiff_t level; size_t len, maxlen, new_len; char *cp; int dir_fd; FTSENT *cur = sp->fts_cur; bool continue_readdir = !!cur->fts_dirp; bool sort_by_inode = false; size_t max_entries; /* When cur->fts_dirp is non-NULL, that means we should continue calling readdir on that existing DIR* pointer rather than opening a new one. */ if (continue_readdir) { DIR *dp = cur->fts_dirp; dir_fd = dirfd (dp); if (dir_fd < 0) { closedir_and_clear (cur->fts_dirp); if (type == BREAD) { cur->fts_info = FTS_DNR; cur->fts_errno = errno; } return NULL; } } else { /* Open the directory for reading. If this fails, we're done. If being called from fts_read, set the fts_info field. */ if ((cur->fts_dirp = fts_opendir(cur->fts_accpath, &dir_fd)) == NULL) { if (type == BREAD) { cur->fts_info = FTS_DNR; cur->fts_errno = errno; } return NULL; } /* Rather than calling fts_stat for each and every entry encountered in the readdir loop (below), stat each directory only right after opening it. */ if (cur->fts_info == FTS_NSOK) cur->fts_info = fts_stat(sp, cur, false); else if (sp->fts_options & FTS_TIGHT_CYCLE_CHECK) { /* Now read the stat info again after opening a directory to reveal eventual changes caused by a submount triggered by the traversal. But do it only for utilities which use FTS_TIGHT_CYCLE_CHECK. Therefore, only find and du benefit/suffer from this feature for now. */ LEAVE_DIR (sp, cur, "4"); fts_stat (sp, cur, false); if (! enter_dir (sp, cur)) { __set_errno (ENOMEM); return NULL; } } } /* Maximum number of readdir entries to read at one time. This limitation is to avoid reading millions of entries into memory at once. When an fts_compar function is specified, we have no choice: we must read all entries into memory before calling that function. But when no such function is specified, we can read entries in batches that are large enough to help us with inode- sorting, yet not so large that we risk exhausting memory. */ max_entries = sp->fts_compar ? SIZE_MAX : FTS_MAX_READDIR_ENTRIES; /* * If we're going to need to stat anything or we want to descend * and stay in the directory, chdir. If this fails we keep going, * but set a flag so we don't chdir after the post-order visit. * We won't be able to stat anything, but we can still return the * names themselves. Note, that since fts_read won't be able to * chdir into the directory, it will have to return different file * names than before, i.e. "a/b" instead of "b". Since the node * has already been visited in pre-order, have to wait until the * post-order visit to return the error. There is a special case * here, if there was nothing to stat then it's not an error to * not be able to stat. This is all fairly nasty. If a program * needed sorted entries or stat information, they had better be * checking FTS_NS on the returned nodes. */ if (continue_readdir) { /* When resuming a short readdir run, we already have the required dirp and dir_fd. */ descend = true; } else { /* Try to descend unless it is a names-only fts_children, or the directory is known to lack subdirectories. */ descend = (type != BNAMES && ! (ISSET (FTS_NOSTAT) && ISSET (FTS_PHYSICAL) && ! ISSET (FTS_SEEDOT) && cur->fts_statp->st_nlink == MIN_DIR_NLINK && (leaf_optimization (cur, dir_fd) != NO_LEAF_OPTIMIZATION))); if (descend || type == BREAD) { if (ISSET(FTS_CWDFD)) dir_fd = fcntl (dir_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1); if (dir_fd < 0 || fts_safe_changedir(sp, cur, dir_fd, NULL)) { if (descend && type == BREAD) cur->fts_errno = errno; cur->fts_flags |= FTS_DONTCHDIR; descend = false; closedir_and_clear(cur->fts_dirp); if (ISSET(FTS_CWDFD) && 0 <= dir_fd) close (dir_fd); cur->fts_dirp = NULL; } else descend = true; } } /* * Figure out the max file name length that can be stored in the * current buffer -- the inner loop allocates more space as necessary. * We really wouldn't have to do the maxlen calculations here, we * could do them in fts_read before returning the name, but it's a * lot easier here since the length is part of the dirent structure. * * If not changing directories set a pointer so that can just append * each new component into the file name. */ len = NAPPEND(cur); if (ISSET(FTS_NOCHDIR)) { cp = sp->fts_path + len; *cp++ = '/'; } else { /* GCC, you're too verbose. */ cp = NULL; } len++; maxlen = sp->fts_pathlen - len; level = cur->fts_level + 1; /* Read the directory, attaching each entry to the "link" pointer. */ doadjust = false; head = NULL; tail = NULL; nitems = 0; while (cur->fts_dirp) { size_t d_namelen; __set_errno (0); struct dirent *dp = readdir(cur->fts_dirp); if (dp == NULL) { if (errno) { cur->fts_errno = errno; /* If we've not read any items yet, treat the error as if we can't access the dir. */ cur->fts_info = (continue_readdir || nitems) ? FTS_ERR : FTS_DNR; } break; } if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name)) continue; d_namelen = _D_EXACT_NAMLEN (dp); p = fts_alloc (sp, dp->d_name, d_namelen); if (!p) goto mem1; if (d_namelen >= maxlen) { /* include space for NUL */ oldaddr = sp->fts_path; if (! fts_palloc(sp, d_namelen + len + 1)) { /* * No more memory. Save * errno, free up the current structure and the * structures already allocated. */ mem1: saved_errno = errno; free(p); fts_lfree(head); closedir_and_clear(cur->fts_dirp); cur->fts_info = FTS_ERR; SET(FTS_STOP); __set_errno (saved_errno); return (NULL); } /* Did realloc() change the pointer? */ if (oldaddr != sp->fts_path) { doadjust = true; if (ISSET(FTS_NOCHDIR)) cp = sp->fts_path + len; } maxlen = sp->fts_pathlen - len; } new_len = len + d_namelen; if (new_len < len) { /* * In the unlikely event that we would end up * with a file name longer than SIZE_MAX, free up * the current structure and the structures already * allocated, then error out with ENAMETOOLONG. */ free(p); fts_lfree(head); closedir_and_clear(cur->fts_dirp); cur->fts_info = FTS_ERR; SET(FTS_STOP); __set_errno (ENAMETOOLONG); return (NULL); } p->fts_level = level; p->fts_parent = sp->fts_cur; p->fts_pathlen = new_len; /* Store dirent.d_ino, in case we need to sort entries before processing them. */ p->fts_statp->st_ino = D_INO (dp); /* Build a file name for fts_stat to stat. */ if (ISSET(FTS_NOCHDIR)) { p->fts_accpath = p->fts_path; memmove(cp, p->fts_name, p->fts_namelen + 1); } else p->fts_accpath = p->fts_name; if (sp->fts_compar == NULL || ISSET(FTS_DEFER_STAT)) { /* Record what fts_read will have to do with this entry. In many cases, it will simply fts_stat it, but we can take advantage of any d_type information to optimize away the unnecessary stat calls. I.e., if FTS_NOSTAT is in effect and we're not following symlinks (FTS_PHYSICAL) and d_type indicates this is *not* a directory, then we won't have to stat it at all. If it *is* a directory, then (currently) we stat it regardless, in order to get device and inode numbers. Some day we might optimize that away, too, for directories where d_ino is known to be valid. */ bool skip_stat = (ISSET(FTS_NOSTAT) && DT_IS_KNOWN(dp) && ! DT_MUST_BE(dp, DT_DIR) && (ISSET(FTS_PHYSICAL) || ! DT_MUST_BE(dp, DT_LNK))); p->fts_info = FTS_NSOK; /* Propagate dirent.d_type information back to caller, when possible. */ set_stat_type (p->fts_statp, D_TYPE (dp)); fts_set_stat_required(p, !skip_stat); } else { p->fts_info = fts_stat(sp, p, false); } /* We walk in directory order so "ls -f" doesn't get upset. */ p->fts_link = NULL; if (head == NULL) head = tail = p; else { tail->fts_link = p; tail = p; } /* If there are many entries, no sorting function has been specified, and this file system is of a type that may be slow with a large number of entries, arrange to sort the directory entries on increasing inode numbers. The NITEMS comparison uses ==, not >, because the test needs to be tried at most once once, and NITEMS will exceed the threshold after it is incremented below. */ if (nitems == _FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD && !sp->fts_compar) sort_by_inode = dirent_inode_sort_may_be_useful (cur, dir_fd); ++nitems; if (max_entries <= nitems) { /* When there are too many dir entries, leave fts_dirp open, so that a subsequent fts_read can take up where we leave off. */ goto break_without_closedir; } } if (cur->fts_dirp) closedir_and_clear(cur->fts_dirp); break_without_closedir: /* * If realloc() changed the address of the file name, adjust the * addresses for the rest of the tree and the dir list. */ if (doadjust) fts_padjust(sp, head); /* * If not changing directories, reset the file name back to original * state. */ if (ISSET(FTS_NOCHDIR)) { if (len == sp->fts_pathlen || nitems == 0) --cp; *cp = '\0'; } /* * If descended after called from fts_children or after called from * fts_read and nothing found, get back. At the root level we use * the saved fd; if one of fts_open()'s arguments is a relative name * to an empty directory, we wind up here with no other way back. If * can't get back, we're done. */ if (!continue_readdir && descend && (type == BCHILD || !nitems) && (cur->fts_level == FTS_ROOTLEVEL ? restore_initial_cwd(sp) : fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) { cur->fts_info = FTS_ERR; SET(FTS_STOP); fts_lfree(head); return (NULL); } /* If didn't find anything, return NULL. */ if (!nitems) { if (type == BREAD && cur->fts_info != FTS_DNR && cur->fts_info != FTS_ERR) cur->fts_info = FTS_DP; fts_lfree(head); return (NULL); } if (sort_by_inode) { sp->fts_compar = fts_compare_ino; head = fts_sort (sp, head, nitems); sp->fts_compar = NULL; } /* Sort the entries. */ if (sp->fts_compar && nitems > 1) head = fts_sort(sp, head, nitems); return (head); } #if FTS_DEBUG /* Walk ->fts_parent links starting at E_CURR, until the root of the current hierarchy. There should be a directory with dev/inode matching those of AD. If not, print a lot of diagnostics. */ static void find_matching_ancestor (FTSENT const *e_curr, struct Active_dir const *ad) { FTSENT const *ent; for (ent = e_curr; ent->fts_level >= FTS_ROOTLEVEL; ent = ent->fts_parent) { if (ad->ino == ent->fts_statp->st_ino && ad->dev == ent->fts_statp->st_dev) return; } printf ("ERROR: tree dir, %s, not active\n", ad->fts_ent->fts_accpath); printf ("active dirs:\n"); for (ent = e_curr; ent->fts_level >= FTS_ROOTLEVEL; ent = ent->fts_parent) printf (" %s(%"PRIuMAX"/%"PRIuMAX") to %s(%"PRIuMAX"/%"PRIuMAX")...\n", ad->fts_ent->fts_accpath, (uintmax_t) ad->dev, (uintmax_t) ad->ino, ent->fts_accpath, (uintmax_t) ent->fts_statp->st_dev, (uintmax_t) ent->fts_statp->st_ino); } void fts_cross_check (FTS const *sp) { FTSENT const *ent = sp->fts_cur; FTSENT const *t; if ( ! ISSET (FTS_TIGHT_CYCLE_CHECK)) return; Dprintf (("fts-cross-check cur=%s\n", ent->fts_path)); /* Make sure every parent dir is in the tree. */ for (t = ent->fts_parent; t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent) { struct Active_dir ad; ad.ino = t->fts_statp->st_ino; ad.dev = t->fts_statp->st_dev; if ( ! hash_lookup (sp->fts_cycle.ht, &ad)) printf ("ERROR: active dir, %s, not in tree\n", t->fts_path); } /* Make sure every dir in the tree is an active dir. But ENT is not necessarily a directory. If so, just skip this part. */ if (ent->fts_parent->fts_level >= FTS_ROOTLEVEL && (ent->fts_info == FTS_DP || ent->fts_info == FTS_D)) { struct Active_dir *ad; for (ad = hash_get_first (sp->fts_cycle.ht); ad != NULL; ad = hash_get_next (sp->fts_cycle.ht, ad)) { find_matching_ancestor (ent, ad); } } } static bool same_fd (int fd1, int fd2) { struct stat sb1, sb2; return (fstat (fd1, &sb1) == 0 && fstat (fd2, &sb2) == 0 && SAME_INODE (sb1, sb2)); } static void fd_ring_print (FTS const *sp, FILE *stream, char const *msg) { I_ring const *fd_ring = &sp->fts_fd_ring; unsigned int i = fd_ring->fts_front; char *cwd = getcwdat (sp->fts_cwd_fd, NULL, 0); fprintf (stream, "=== %s ========== %s\n", msg, cwd); free (cwd); if (i_ring_empty (fd_ring)) return; while (true) { int fd = fd_ring->fts_fd_ring[i]; if (fd < 0) fprintf (stream, "%d: %d:\n", i, fd); else { char *wd = getcwdat (fd, NULL, 0); fprintf (stream, "%d: %d: %s\n", i, fd, wd); free (wd); } if (i == fd_ring->fts_back) break; i = (i + I_RING_SIZE - 1) % I_RING_SIZE; } } /* Ensure that each file descriptor on the fd_ring matches a parent, grandparent, etc. of the current working directory. */ static void fd_ring_check (FTS const *sp) { if (!fts_debug) return; /* Make a writable copy. */ I_ring fd_w = sp->fts_fd_ring; int cwd_fd = sp->fts_cwd_fd; cwd_fd = fcntl (cwd_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1); char *dot = getcwdat (cwd_fd, NULL, 0); error (0, 0, "===== check ===== cwd: %s", dot); free (dot); while ( ! i_ring_empty (&fd_w)) { int fd = i_ring_pop (&fd_w); if (0 <= fd) { int open_flags = O_SEARCH | O_CLOEXEC; int parent_fd = openat (cwd_fd, "..", open_flags); if (parent_fd < 0) { // Warn? break; } if (!same_fd (fd, parent_fd)) { char *cwd = getcwdat (fd, NULL, 0); error (0, errno, "ring : %s", cwd); char *c2 = getcwdat (parent_fd, NULL, 0); error (0, errno, "parent: %s", c2); free (cwd); free (c2); fts_assert (0); } close (cwd_fd); cwd_fd = parent_fd; } } close (cwd_fd); } #endif static unsigned short int internal_function fts_stat(FTS *sp, register FTSENT *p, bool follow) { struct stat *sbp = p->fts_statp; if (p->fts_level == FTS_ROOTLEVEL && ISSET(FTS_COMFOLLOW)) follow = true; /* * If doing a logical walk, or application requested FTS_FOLLOW, do * a stat(2). If that fails, check for a non-existent symlink. If * fail, set the errno from the stat call. */ if (ISSET(FTS_LOGICAL) || follow) { if (stat(p->fts_accpath, sbp)) { if (errno == ENOENT && lstat(p->fts_accpath, sbp) == 0) { __set_errno (0); return (FTS_SLNONE); } p->fts_errno = errno; goto err; } } else if (fstatat(sp->fts_cwd_fd, p->fts_accpath, sbp, AT_SYMLINK_NOFOLLOW)) { p->fts_errno = errno; err: memset(sbp, 0, sizeof(struct stat)); return (FTS_NS); } if (S_ISDIR(sbp->st_mode)) { if (ISDOT(p->fts_name)) { /* Command-line "." and ".." are real directories. */ return (p->fts_level == FTS_ROOTLEVEL ? FTS_D : FTS_DOT); } return (FTS_D); } if (S_ISLNK(sbp->st_mode)) return (FTS_SL); if (S_ISREG(sbp->st_mode)) return (FTS_F); return (FTS_DEFAULT); } static int fts_compar (void const *a, void const *b) { /* Convert A and B to the correct types, to pacify the compiler, and for portability to bizarre hosts where "void const *" and "FTSENT const **" differ in runtime representation. The comparison function cannot modify *a and *b, but there is no compile-time check for this. */ FTSENT const **pa = (FTSENT const **) a; FTSENT const **pb = (FTSENT const **) b; return pa[0]->fts_fts->fts_compar (pa, pb); } static FTSENT * internal_function fts_sort (FTS *sp, FTSENT *head, register size_t nitems) { register FTSENT **ap, *p; /* On most modern hosts, void * and FTSENT ** have the same run-time representation, and one can convert sp->fts_compar to the type qsort expects without problem. Use the heuristic that this is OK if the two pointer types are the same size, and if converting FTSENT ** to long int is the same as converting FTSENT ** to void * and then to long int. This heuristic isn't valid in general but we don't know of any counterexamples. */ FTSENT *dummy; int (*compare) (void const *, void const *) = ((sizeof &dummy == sizeof (void *) && (long int) &dummy == (long int) (void *) &dummy) ? (int (*) (void const *, void const *)) sp->fts_compar : fts_compar); /* * Construct an array of pointers to the structures and call qsort(3). * Reassemble the array in the order returned by qsort. If unable to * sort for memory reasons, return the directory entries in their * current order. Allocate enough space for the current needs plus * 40 so don't realloc one entry at a time. */ if (nitems > sp->fts_nitems) { FTSENT **a; sp->fts_nitems = nitems + 40; if (SIZE_MAX / sizeof *a < sp->fts_nitems || ! (a = realloc (sp->fts_array, sp->fts_nitems * sizeof *a))) { free(sp->fts_array); sp->fts_array = NULL; sp->fts_nitems = 0; return (head); } sp->fts_array = a; } for (ap = sp->fts_array, p = head; p; p = p->fts_link) *ap++ = p; qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), compare); for (head = *(ap = sp->fts_array); --nitems; ++ap) ap[0]->fts_link = ap[1]; ap[0]->fts_link = NULL; return (head); } static FTSENT * internal_function fts_alloc (FTS *sp, const char *name, register size_t namelen) { register FTSENT *p; size_t len; /* * The file name is a variable length array. Allocate the FTSENT * structure and the file name in one chunk. */ len = FLEXSIZEOF(FTSENT, fts_name, namelen + 1); if ((p = malloc(len)) == NULL) return (NULL); /* Copy the name and guarantee NUL termination. */ memcpy(p->fts_name, name, namelen); p->fts_name[namelen] = '\0'; p->fts_namelen = namelen; p->fts_fts = sp; p->fts_path = sp->fts_path; p->fts_errno = 0; p->fts_dirp = NULL; p->fts_flags = 0; p->fts_instr = FTS_NOINSTR; p->fts_number = 0; p->fts_pointer = NULL; return (p); } static void internal_function fts_lfree (register FTSENT *head) { register FTSENT *p; /* Free a linked list of structures. */ while ((p = head)) { head = head->fts_link; if (p->fts_dirp) closedir (p->fts_dirp); free(p); } } /* * Allow essentially unlimited file name lengths; find, rm, ls should * all work on any tree. Most systems will allow creation of file * names much longer than MAXPATHLEN, even though the kernel won't * resolve them. Add the size (not just what's needed) plus 256 bytes * so don't realloc the file name 2 bytes at a time. */ static bool internal_function fts_palloc (FTS *sp, size_t more) { char *p; size_t new_len = sp->fts_pathlen + more + 256; /* * See if fts_pathlen would overflow. */ if (new_len < sp->fts_pathlen) { free(sp->fts_path); sp->fts_path = NULL; __set_errno (ENAMETOOLONG); return false; } sp->fts_pathlen = new_len; p = realloc(sp->fts_path, sp->fts_pathlen); if (p == NULL) { free(sp->fts_path); sp->fts_path = NULL; return false; } sp->fts_path = p; return true; } /* * When the file name is realloc'd, have to fix all of the pointers in * structures already returned. */ static void internal_function fts_padjust (FTS *sp, FTSENT *head) { FTSENT *p; char *addr = sp->fts_path; #define ADJUST(p) do { \ if ((p)->fts_accpath != (p)->fts_name) { \ (p)->fts_accpath = \ (char *)addr + ((p)->fts_accpath - (p)->fts_path); \ } \ (p)->fts_path = addr; \ } while (0) /* Adjust the current set of children. */ for (p = sp->fts_child; p; p = p->fts_link) ADJUST(p); /* Adjust the rest of the tree, including the current level. */ for (p = head; p->fts_level >= FTS_ROOTLEVEL;) { ADJUST(p); p = p->fts_link ? p->fts_link : p->fts_parent; } } static size_t internal_function _GL_ATTRIBUTE_PURE fts_maxarglen (char * const *argv) { size_t len, max; for (max = 0; *argv; ++argv) if ((len = strlen(*argv)) > max) max = len; return (max + 1); } /* * Change to dir specified by fd or file name without getting * tricked by someone changing the world out from underneath us. * Assumes p->fts_statp->st_dev and p->fts_statp->st_ino are filled in. * If FD is non-negative, expect it to be used after this function returns, * and to be closed eventually. So don't pass e.g., 'dirfd(dirp)' and then * do closedir(dirp), because that would invalidate the saved FD. * Upon failure, close FD immediately and return nonzero. */ static int internal_function fts_safe_changedir (FTS *sp, FTSENT *p, int fd, char const *dir) { int ret; bool is_dotdot = dir && STREQ (dir, ".."); int newfd; /* This clause handles the unusual case in which FTS_NOCHDIR is specified, along with FTS_CWDFD. In that case, there is no need to change even the virtual cwd file descriptor. However, if FD is non-negative, we do close it here. */ if (ISSET (FTS_NOCHDIR)) { if (ISSET (FTS_CWDFD) && 0 <= fd) close (fd); return 0; } if (fd < 0 && is_dotdot && ISSET (FTS_CWDFD)) { /* When possible, skip the diropen and subsequent fstat+dev/ino comparison. I.e., when changing to parent directory (chdir ("..")), use a file descriptor from the ring and save the overhead of diropen+fstat, as well as avoiding failure when we lack "x" access to the virtual cwd. */ if ( ! i_ring_empty (&sp->fts_fd_ring)) { int parent_fd; fd_ring_print (sp, stderr, "pre-pop"); parent_fd = i_ring_pop (&sp->fts_fd_ring); if (0 <= parent_fd) { fd = parent_fd; dir = NULL; } } } newfd = fd; if (fd < 0 && (newfd = diropen (sp, dir)) < 0) return -1; /* The following dev/inode check is necessary if we're doing a "logical" traversal (through symlinks, a la chown -L), if the system lacks O_NOFOLLOW support, or if we're changing to ".." (but not via a popped file descriptor). When changing to the name "..", O_NOFOLLOW can't help. In general, when the target is not "..", diropen's use of O_NOFOLLOW ensures we don't mistakenly follow a symlink, so we can avoid the expense of this fstat. */ if (ISSET(FTS_LOGICAL) || ! HAVE_WORKING_O_NOFOLLOW || (dir && STREQ (dir, ".."))) { struct stat sb; if (fstat(newfd, &sb)) { ret = -1; goto bail; } if (p->fts_statp->st_dev != sb.st_dev || p->fts_statp->st_ino != sb.st_ino) { __set_errno (ENOENT); /* disinformation */ ret = -1; goto bail; } } if (ISSET(FTS_CWDFD)) { cwd_advance_fd (sp, newfd, ! is_dotdot); return 0; } ret = fchdir(newfd); bail: if (fd < 0) { int oerrno = errno; (void)close(newfd); __set_errno (oerrno); } return ret; } kbuild-3608/src/grep/lib/rawmemchr.c0000664000175000017500000001237614670377426017362 0ustar locutuslocutus/* Searching in a string. Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include /* A function definition is only needed if HAVE_RAWMEMCHR is not defined. */ #if !HAVE_RAWMEMCHR /* Find the first occurrence of C in S. */ void * rawmemchr (const void *s, int c_in) { /* On 32-bit hardware, choosing longword to be a 32-bit unsigned long instead of a 64-bit uintmax_t tends to give better performance. On 64-bit hardware, unsigned long is generally 64 bits already. Change this typedef to experiment with performance. */ typedef unsigned long int longword; const unsigned char *char_ptr; const longword *longword_ptr; longword repeated_one; longword repeated_c; unsigned char c; c = (unsigned char) c_in; /* Handle the first few bytes by reading one byte at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ for (char_ptr = (const unsigned char *) s; (size_t) char_ptr % sizeof (longword) != 0; ++char_ptr) if (*char_ptr == c) return (void *) char_ptr; longword_ptr = (const longword *) char_ptr; /* All these elucidatory comments refer to 4-byte longwords, but the theory applies equally well to any size longwords. */ /* Compute auxiliary longword values: repeated_one is a value which has a 1 in every byte. repeated_c has c in every byte. */ repeated_one = 0x01010101; repeated_c = c | (c << 8); repeated_c |= repeated_c << 16; if (0xffffffffU < (longword) -1) { repeated_one |= repeated_one << 31 << 1; repeated_c |= repeated_c << 31 << 1; if (8 < sizeof (longword)) { size_t i; for (i = 64; i < sizeof (longword) * 8; i *= 2) { repeated_one |= repeated_one << i; repeated_c |= repeated_c << i; } } } /* Instead of the traditional loop which tests each byte, we will test a longword at a time. The tricky part is testing if *any of the four* bytes in the longword in question are equal to NUL or c. We first use an xor with repeated_c. This reduces the task to testing whether *any of the four* bytes in longword1 is zero. We compute tmp = ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). That is, we perform the following operations: 1. Subtract repeated_one. 2. & ~longword1. 3. & a mask consisting of 0x80 in every byte. Consider what happens in each byte: - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, and step 3 transforms it into 0x80. A carry can also be propagated to more significant bytes. - If a byte of longword1 is nonzero, let its lowest 1 bit be at position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, the byte ends in a single bit of value 0 and k bits of value 1. After step 2, the result is just k bits of value 1: 2^k - 1. After step 3, the result is 0. And no carry is produced. So, if longword1 has only non-zero bytes, tmp is zero. Whereas if longword1 has a zero byte, call j the position of the least significant zero byte. Then the result has a zero at positions 0, ..., j-1 and a 0x80 at position j. We cannot predict the result at the more significant bytes (positions j+1..3), but it does not matter since we already have a non-zero bit at position 8*j+7. The test whether any byte in longword1 is zero is equivalent to testing whether tmp is nonzero. This test can read beyond the end of a string, depending on where C_IN is encountered. However, this is considered safe since the initialization phase ensured that the read will be aligned, therefore, the read will not cross page boundaries and will not cause a fault. */ while (1) { longword longword1 = *longword_ptr ^ repeated_c; if ((((longword1 - repeated_one) & ~longword1) & (repeated_one << 7)) != 0) break; longword_ptr++; } char_ptr = (const unsigned char *) longword_ptr; /* At this point, we know that one of the sizeof (longword) bytes starting at char_ptr is == c. On little-endian machines, we could determine the first such byte without any further memory accesses, just by looking at the tmp result from the last loop iteration. But this does not work on big-endian machines. Choose code that works in both cases. */ char_ptr = (unsigned char *) longword_ptr; while (*char_ptr != c) char_ptr++; return (void *) char_ptr; } #endif kbuild-3608/src/grep/lib/mbiter.c0000664000175000017500000000155714670377425016655 0ustar locutuslocutus/* Iterating through multibyte strings: macros for multi-byte encodings. Copyright (C) 2012-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #define MBITER_INLINE _GL_EXTERN_INLINE #include "mbiter.h" kbuild-3608/src/grep/lib/c-strcase.h0000664000175000017500000000405614670377422017256 0ustar locutuslocutus/* Case-insensitive string comparison functions in C locale. Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef C_STRCASE_H #define C_STRCASE_H #include /* The functions defined in this file assume the "C" locale and a character set without diacritics (ASCII-US or EBCDIC-US or something like that). Even if the "C" locale on a particular system is an extension of the ASCII character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it is ISO-8859-1), the functions in this file recognize only the ASCII characters. More precisely, one of the string arguments must be an ASCII string; the other one can also contain non-ASCII characters (but then the comparison result will be nonzero). */ #ifdef __cplusplus extern "C" { #endif /* Compare strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ extern int c_strcasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE; /* Compare no more than N characters of strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ extern int c_strncasecmp (const char *s1, const char *s2, size_t n) _GL_ATTRIBUTE_PURE; #ifdef __cplusplus } #endif #endif /* C_STRCASE_H */ kbuild-3608/src/grep/lib/xalloc-oversized.h0000664000175000017500000000512014670377426020661 0ustar locutuslocutus/* xalloc-oversized.h -- memory allocation size checking Copyright (C) 1990-2000, 2003-2004, 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef XALLOC_OVERSIZED_H_ #define XALLOC_OVERSIZED_H_ #include #include /* True if N * S does not fit into both ptrdiff_t and size_t. N and S should be nonnegative and free of side effects. This expands to a constant expression if N and S are both constants. By gnulib convention, SIZE_MAX represents overflow in size_t calculations, so the conservative size_t-based dividend to use here is SIZE_MAX - 1. */ #define __xalloc_oversized(n, s) \ ((s) != 0 \ && ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) \ < (n))) /* Return 1 if and only if an array of N objects, each of size S, cannot exist reliably because its total size in bytes would exceed MIN (PTRDIFF_MAX, SIZE_MAX - 1). N and S should be nonnegative and free of side effects. Warning: (xalloc_oversized (N, S) ? NULL : malloc (N * S)) can misbehave if N and S are both narrower than ptrdiff_t and size_t, and can be rewritten as (xalloc_oversized (N, S) ? NULL : malloc (N * (size_t) S)). This is a macro, not a function, so that it works even if an argument exceeds MAX (PTRDIFF_MAX, SIZE_MAX). */ #if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX # define xalloc_oversized(n, s) \ __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) #elif (5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ \ && PTRDIFF_MAX < SIZE_MAX) # define xalloc_oversized(n, s) \ (__builtin_constant_p (n) && __builtin_constant_p (s) \ ? __xalloc_oversized (n, s) \ : ({ ptrdiff_t __xalloc_count; \ __builtin_mul_overflow (n, s, &__xalloc_count); })) /* Other compilers use integer division; this may be slower but is more portable. */ #else # define xalloc_oversized(n, s) __xalloc_oversized (n, s) #endif #endif /* !XALLOC_OVERSIZED_H_ */ kbuild-3608/src/grep/lib/unitypes.in.h0000664000175000017500000000422214670377426017656 0ustar locutuslocutus/* Elementary types and macros for the GNU UniString library. Copyright (C) 2002, 2005-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _UNITYPES_H #define _UNITYPES_H /* Get uint8_t, uint16_t, uint32_t. */ #include /* Type representing a Unicode character. */ typedef uint32_t ucs4_t; /* Attribute of a function whose result depends only on the arguments (not pointers!) and which has no side effects. */ #ifndef _UC_ATTRIBUTE_CONST # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined __clang__ # define _UC_ATTRIBUTE_CONST __attribute__ ((__const__)) # else # define _UC_ATTRIBUTE_CONST # endif #endif /* Attribute of a function whose result depends only on the arguments (possibly pointers) and global memory, and which has no side effects. */ #ifndef _UC_ATTRIBUTE_PURE # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ # define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define _UC_ATTRIBUTE_PURE # endif #endif /* Qualifier in a function declaration, that asserts that the caller must pass a pointer to a different object in the specified pointer argument than in the other pointer arguments. */ #ifndef _UC_RESTRICT # if defined __restrict \ || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ || __clang_major__ >= 3 # define _UC_RESTRICT __restrict # elif 199901L <= __STDC_VERSION__ || defined restrict # define _UC_RESTRICT restrict # else # define _UC_RESTRICT # endif #endif #endif /* _UNITYPES_H */ kbuild-3608/src/grep/lib/mbtowc.c0000664000175000017500000000167014670377425016662 0ustar locutuslocutus/* Convert multibyte character to wide character. Copyright (C) 2011-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include #include #include #include #include "mbtowc-impl.h" kbuild-3608/src/grep/lib/reallocarray.c0000664000175000017500000000220114670377426020037 0ustar locutuslocutus/* reallocarray function that is glibc compatible. Copyright (C) 2017-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Darshit Shah */ #include #include #include #include "intprops.h" void * reallocarray (void *ptr, size_t nmemb, size_t size) { size_t nbytes; if (INT_MULTIPLY_WRAPV (nmemb, size, &nbytes)) { errno = ENOMEM; return NULL; } /* Rely on the semantics of GNU realloc. */ return realloc (ptr, nbytes); } kbuild-3608/src/grep/lib/getprogname.c0000664000175000017500000002232614670377423017676 0ustar locutuslocutus/* Program name management. Copyright (C) 2016-2021 Free Software Foundation, Inc. This program 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "getprogname.h" #include /* get program_invocation_name declaration */ #include /* get __argv declaration */ #ifdef _AIX # include # include # include #endif #ifdef __MVS__ # ifndef _OPEN_SYS # define _OPEN_SYS # endif # include # include #endif #ifdef __hpux # include # include # include # include #endif #if defined __sgi || defined __osf__ # include # include # include # include # include #endif #if defined __SCO_VERSION__ || defined __sysv5__ # include # include # include #endif #include "basename-lgpl.h" #ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */ char const * getprogname (void) { # if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* glibc, BeOS */ /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ return program_invocation_short_name; # elif HAVE_DECL_PROGRAM_INVOCATION_NAME /* glibc, BeOS */ /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ return last_component (program_invocation_name); # elif HAVE_GETEXECNAME /* Solaris */ /* https://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */ const char *p = getexecname (); if (!p) p = "?"; return last_component (p); # elif HAVE_DECL___ARGV /* mingw, MSVC */ /* https://docs.microsoft.com/en-us/cpp/c-runtime-library/argc-argv-wargv */ const char *p = __argv && __argv[0] ? __argv[0] : "?"; return last_component (p); # elif HAVE_VAR___PROGNAME /* OpenBSD, Android, QNX */ /* https://man.openbsd.org/style.9 */ /* http://www.qnx.de/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fp%2F__progname.html */ /* Be careful to declare this only when we absolutely need it (OpenBSD 5.1), rather than when it's available. Otherwise, its mere declaration makes program_invocation_short_name malfunction (have zero length) with Fedora 25's glibc. */ extern char *__progname; const char *p = __progname; # if defined __ANDROID__ return last_component (p); # else return p && p[0] ? p : "?"; # endif # elif _AIX /* AIX */ /* Idea by Bastien ROUCARIÈS, https://lists.gnu.org/r/bug-gnulib/2010-12/msg00095.html Reference: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_61/com.ibm.aix.basetrf1/getprocs.htm */ static char *p; static int first = 1; if (first) { first = 0; pid_t pid = getpid (); struct procentry64 procs; p = (0 < getprocs64 (&procs, sizeof procs, NULL, 0, &pid, 1) ? strdup (procs.pi_comm) : NULL); if (!p) p = "?"; } return p; # elif defined __hpux static char *p; static int first = 1; if (first) { first = 0; pid_t pid = getpid (); struct pst_status status; if (pstat_getproc (&status, sizeof status, 0, pid) > 0) { char *ucomm = status.pst_ucomm; char *cmd = status.pst_cmd; if (strlen (ucomm) < PST_UCOMMLEN - 1) p = ucomm; else { /* ucomm is truncated to length PST_UCOMMLEN - 1. Look at cmd instead. */ char *space = strchr (cmd, ' '); if (space != NULL) *space = '\0'; p = strrchr (cmd, '/'); if (p != NULL) p++; else p = cmd; if (strlen (p) > PST_UCOMMLEN - 1 && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0) /* p is less truncated than ucomm. */ ; else p = ucomm; } p = strdup (p); } else { # if !defined __LP64__ /* Support for 32-bit programs running in 64-bit HP-UX. The documented way to do this is to use the same source code as above, but in a compilation unit where '#define _PSTAT64 1' is in effect. I prefer a single compilation unit; the struct size and the offsets are not going to change. */ char status64[1216]; if (__pstat_getproc64 (status64, sizeof status64, 0, pid) > 0) { char *ucomm = status64 + 288; char *cmd = status64 + 168; if (strlen (ucomm) < PST_UCOMMLEN - 1) p = ucomm; else { /* ucomm is truncated to length PST_UCOMMLEN - 1. Look at cmd instead. */ char *space = strchr (cmd, ' '); if (space != NULL) *space = '\0'; p = strrchr (cmd, '/'); if (p != NULL) p++; else p = cmd; if (strlen (p) > PST_UCOMMLEN - 1 && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0) /* p is less truncated than ucomm. */ ; else p = ucomm; } p = strdup (p); } else # endif p = NULL; } if (!p) p = "?"; } return p; # elif __MVS__ /* z/OS */ /* https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/rtwgetp.htm */ static char *p = "?"; static int first = 1; if (first) { pid_t pid = getpid (); int token; W_PSPROC buf; first = 0; memset (&buf, 0, sizeof(buf)); buf.ps_cmdptr = (char *) malloc (buf.ps_cmdlen = PS_CMDBLEN_LONG); buf.ps_conttyptr = (char *) malloc (buf.ps_conttylen = PS_CONTTYBLEN); buf.ps_pathptr = (char *) malloc (buf.ps_pathlen = PS_PATHBLEN); if (buf.ps_cmdptr && buf.ps_conttyptr && buf.ps_pathptr) { for (token = 0; token >= 0; token = w_getpsent (token, &buf, sizeof(buf))) { if (token > 0 && buf.ps_pid == pid) { char *s = strdup (last_component (buf.ps_pathptr)); if (s) p = s; break; } } } free (buf.ps_cmdptr); free (buf.ps_conttyptr); free (buf.ps_pathptr); } return p; # elif defined __sgi || defined __osf__ /* IRIX or Tru64 */ char filename[50]; int fd; # if defined __sgi sprintf (filename, "/proc/pinfo/%d", (int) getpid ()); # else sprintf (filename, "/proc/%d", (int) getpid ()); # endif fd = open (filename, O_RDONLY | O_CLOEXEC); if (0 <= fd) { prpsinfo_t buf; int ioctl_ok = 0 <= ioctl (fd, PIOCPSINFO, &buf); close (fd); if (ioctl_ok) { char *name = buf.pr_fname; size_t namesize = sizeof buf.pr_fname; /* It may not be NUL-terminated. */ char *namenul = memchr (name, '\0', namesize); size_t namelen = namenul ? namenul - name : namesize; char *namecopy = malloc (namelen + 1); if (namecopy) { namecopy[namelen] = '\0'; return memcpy (namecopy, name, namelen); } } } return NULL; # elif defined __SCO_VERSION__ || defined __sysv5__ /* SCO OpenServer6/UnixWare */ char buf[80]; int fd; sprintf (buf, "/proc/%d/cmdline", getpid()); fd = open (buf, O_RDONLY); if (0 <= fd) { size_t n = read (fd, buf, 79); if (n > 0) { buf[n] = '\0'; /* Guarantee null-termination */ char *progname; progname = strrchr (buf, '/'); if (progname) { progname = progname + 1; /* Skip the '/' */ } else { progname = buf; } char *ret; ret = malloc (strlen (progname) + 1); if (ret) { strcpy (ret, progname); return ret; } } close (fd); } return "?"; # else # error "getprogname module not ported to this OS" # endif } #endif /* * Hey Emacs! * Local Variables: * coding: utf-8 * End: */ kbuild-3608/src/grep/lib/save-cwd.h0000664000175000017500000000204614670377426017104 0ustar locutuslocutus/* Save and restore current working directory. Copyright (C) 1995, 1997-1998, 2003, 2009-2021 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 . */ /* Written by Jim Meyering. */ #ifndef SAVE_CWD_H # define SAVE_CWD_H 1 struct saved_cwd { int desc; char *name; }; int save_cwd (struct saved_cwd *cwd); int restore_cwd (const struct saved_cwd *cwd); void free_cwd (struct saved_cwd *cwd); #endif /* SAVE_CWD_H */ kbuild-3608/src/grep/lib/iconv_open-osf.gperf0000664000175000017500000000337114670377423021172 0ustar locutuslocutus/* Character set conversion. Copyright (C) 2007, 2020-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ struct mapping { int standard_name; const char vendor_name[10 + 1]; }; %struct-type %language=ANSI-C %define slot-name standard_name %define hash-function-name mapping_hash %define lookup-function-name mapping_lookup %readonly-tables %global-table %define word-array-name mappings %pic %% # On OSF/1 5.1, look in /usr/lib/nls/loc/iconv. ISO-8859-1, "ISO8859-1" ISO-8859-2, "ISO8859-2" ISO-8859-3, "ISO8859-3" ISO-8859-4, "ISO8859-4" ISO-8859-5, "ISO8859-5" ISO-8859-6, "ISO8859-6" ISO-8859-7, "ISO8859-7" ISO-8859-8, "ISO8859-8" ISO-8859-9, "ISO8859-9" ISO-8859-15, "ISO8859-15" CP437, "cp437" CP775, "cp775" CP850, "cp850" CP852, "cp852" CP855, "cp855" CP857, "cp857" CP861, "cp861" CP862, "cp862" CP865, "cp865" CP866, "cp866" CP869, "cp869" CP874, "cp874" CP949, "KSC5601" CP1250, "cp1250" CP1251, "cp1251" CP1252, "cp1252" CP1253, "cp1253" CP1254, "cp1254" CP1255, "cp1255" CP1256, "cp1256" CP1257, "cp1257" CP1258, "cp1258" EUC-JP, "eucJP" EUC-KR, "eucKR" EUC-TW, "eucTW" BIG5, "big5" SHIFT_JIS, "SJIS" TIS-620, "TACTIS" kbuild-3608/src/grep/lib/ialloc.c0000664000175000017500000000150314670377424016624 0ustar locutuslocutus/* malloc with idx_t rather than size_t Copyright 2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #define IALLOC_INLINE _GL_EXTERN_INLINE #include "ialloc.h" kbuild-3608/src/grep/lib/openat-priv.h0000664000175000017500000000506414670377425017641 0ustar locutuslocutus/* Internals for openat-like functions. Copyright (C) 2005-2006, 2009-2021 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 . */ /* written by Jim Meyering */ #ifndef _GL_HEADER_OPENAT_PRIV #define _GL_HEADER_OPENAT_PRIV #include #include #include /* Maximum number of bytes that it is safe to allocate as a single array on the stack, and that is known as a compile-time constant. The assumption is that we'll touch the array very quickly, or a temporary very near the array, provoking an out-of-memory trap. On some operating systems, there is only one guard page for the stack, and a page size can be as small as 4096 bytes. Subtract 64 in the hope that this will let the compiler touch a nearby temporary and provoke a trap. */ #define SAFER_ALLOCA_MAX (4096 - 64) #define SAFER_ALLOCA(m) ((m) < SAFER_ALLOCA_MAX ? (m) : SAFER_ALLOCA_MAX) #if defined PATH_MAX # define OPENAT_BUFFER_SIZE SAFER_ALLOCA (PATH_MAX) #elif defined _XOPEN_PATH_MAX # define OPENAT_BUFFER_SIZE SAFER_ALLOCA (_XOPEN_PATH_MAX) #else # define OPENAT_BUFFER_SIZE SAFER_ALLOCA (1024) #endif char *openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file); /* Trying to access a BUILD_PROC_NAME file will fail on systems without /proc support, and even on systems *with* ProcFS support. Return nonzero if the failure may be legitimate, e.g., because /proc is not readable, or the particular .../fd/N directory is not present. */ #define EXPECTED_ERRNO(Errno) \ ((Errno) == ENOTDIR || (Errno) == ENOENT \ || (Errno) == EPERM || (Errno) == EACCES \ || (Errno) == ENOSYS /* Solaris 8 */ \ || (Errno) == EOPNOTSUPP /* FreeBSD */) /* Wrapper function shared among linkat and renameat. */ int at_func2 (int fd1, char const *file1, int fd2, char const *file2, int (*func) (char const *file1, char const *file2)); #endif /* _GL_HEADER_OPENAT_PRIV */ kbuild-3608/src/grep/lib/malloc/0000775000175000017500000000000014670377424016465 5ustar locutuslocutuskbuild-3608/src/grep/lib/malloc/dynarray.h0000664000175000017500000001424414670377424020474 0ustar locutuslocutus/* Type-safe arrays which grow dynamically. Shared definitions. Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* To use the dynarray facility, you need to include and define the parameter macros documented in that file. A minimal example which provides a growing list of integers can be defined like this: struct int_array { // Pointer to result array followed by its length, // as required by DYNARRAY_FINAL_TYPE. int *array; size_t length; }; #define DYNARRAY_STRUCT dynarray_int #define DYNARRAY_ELEMENT int #define DYNARRAY_PREFIX dynarray_int_ #define DYNARRAY_FINAL_TYPE struct int_array #include To create a three-element array with elements 1, 2, 3, use this code: struct dynarray_int dyn; dynarray_int_init (&dyn); for (int i = 1; i <= 3; ++i) { int *place = dynarray_int_emplace (&dyn); assert (place != NULL); *place = i; } struct int_array result; bool ok = dynarray_int_finalize (&dyn, &result); assert (ok); assert (result.length == 3); assert (result.array[0] == 1); assert (result.array[1] == 2); assert (result.array[2] == 3); free (result.array); If the elements contain resources which must be freed, define DYNARRAY_ELEMENT_FREE appropriately, like this: struct str_array { char **array; size_t length; }; #define DYNARRAY_STRUCT dynarray_str #define DYNARRAY_ELEMENT char * #define DYNARRAY_ELEMENT_FREE(ptr) free (*ptr) #define DYNARRAY_PREFIX dynarray_str_ #define DYNARRAY_FINAL_TYPE struct str_array #include Compared to scratch buffers, dynamic arrays have the following features: - They have an element type, and are not just an untyped buffer of bytes. - When growing, previously stored elements are preserved. (It is expected that scratch_buffer_grow_preserve and scratch_buffer_set_array_size eventually go away because all current users are moved to dynamic arrays.) - Scratch buffers have a more aggressive growth policy because growing them typically means a retry of an operation (across an NSS service module boundary), which is expensive. - For the same reason, scratch buffers have a much larger initial stack allocation. */ #ifndef _DYNARRAY_H #define _DYNARRAY_H #include #include #include struct dynarray_header { size_t used; size_t allocated; void *array; }; /* Marker used in the allocated member to indicate that an error was encountered. */ static inline size_t __dynarray_error_marker (void) { return -1; } /* Internal function. See the has_failed function in dynarray-skeleton.c. */ static inline bool __dynarray_error (struct dynarray_header *list) { return list->allocated == __dynarray_error_marker (); } /* Internal function. Enlarge the dynamically allocated area of the array to make room for one more element. SCRATCH is a pointer to the scratch area (which is not heap-allocated and must not be freed). ELEMENT_SIZE is the size, in bytes, of one element. Return false on failure, true on success. */ bool __libc_dynarray_emplace_enlarge (struct dynarray_header *, void *scratch, size_t element_size); /* Internal function. Enlarge the dynamically allocated area of the array to make room for at least SIZE elements (which must be larger than the existing used part of the dynamic array). SCRATCH is a pointer to the scratch area (which is not heap-allocated and must not be freed). ELEMENT_SIZE is the size, in bytes, of one element. Return false on failure, true on success. */ bool __libc_dynarray_resize (struct dynarray_header *, size_t size, void *scratch, size_t element_size); /* Internal function. Like __libc_dynarray_resize, but clear the new part of the dynamic array. */ bool __libc_dynarray_resize_clear (struct dynarray_header *, size_t size, void *scratch, size_t element_size); /* Internal type. */ struct dynarray_finalize_result { void *array; size_t length; }; /* Internal function. Copy the dynamically-allocated area to an explicitly-sized heap allocation. SCRATCH is a pointer to the embedded scratch space. ELEMENT_SIZE is the size, in bytes, of the element type. On success, true is returned, and pointer and length are written to *RESULT. On failure, false is returned. The caller has to take care of some of the memory management; this function is expected to be called from dynarray-skeleton.c. */ bool __libc_dynarray_finalize (struct dynarray_header *list, void *scratch, size_t element_size, struct dynarray_finalize_result *result); /* Internal function. Terminate the process after an index error. SIZE is the number of elements of the dynamic array. INDEX is the lookup index which triggered the failure. */ _Noreturn void __libc_dynarray_at_failure (size_t size, size_t index); #ifndef _ISOMAC libc_hidden_proto (__libc_dynarray_emplace_enlarge) libc_hidden_proto (__libc_dynarray_resize) libc_hidden_proto (__libc_dynarray_resize_clear) libc_hidden_proto (__libc_dynarray_finalize) libc_hidden_proto (__libc_dynarray_at_failure) #endif #endif /* _DYNARRAY_H */ kbuild-3608/src/grep/lib/malloc/dynarray_at_failure.c0000664000175000017500000000236614670377424022664 0ustar locutuslocutus/* Report an dynamic array index out of bounds condition. Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _LIBC # include #endif #include #include #include void __libc_dynarray_at_failure (size_t size, size_t index) { #ifdef _LIBC char buf[200]; __snprintf (buf, sizeof (buf), "Fatal glibc error: " "array index %zu not less than array length %zu\n", index, size); #else abort (); #endif } libc_hidden_def (__libc_dynarray_at_failure) kbuild-3608/src/grep/lib/malloc/dynarray-skeleton.c0000664000175000017500000004355114670377424022314 0ustar locutuslocutus/* Type-safe arrays which grow dynamically. Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* Pre-processor macros which act as parameters: DYNARRAY_STRUCT The struct tag of dynamic array to be defined. DYNARRAY_ELEMENT The type name of the element type. Elements are copied as if by memcpy, and can change address as the dynamic array grows. DYNARRAY_PREFIX The prefix of the functions which are defined. The following parameters are optional: DYNARRAY_ELEMENT_FREE DYNARRAY_ELEMENT_FREE (E) is evaluated to deallocate the contents of elements. E is of type DYNARRAY_ELEMENT *. DYNARRAY_ELEMENT_INIT DYNARRAY_ELEMENT_INIT (E) is evaluated to initialize a new element. E is of type DYNARRAY_ELEMENT *. If DYNARRAY_ELEMENT_FREE but not DYNARRAY_ELEMENT_INIT is defined, new elements are automatically zero-initialized. Otherwise, new elements have undefined contents. DYNARRAY_INITIAL_SIZE The size of the statically allocated array (default: at least 2, more elements if they fit into 128 bytes). Must be a preprocessor constant. If DYNARRAY_INITIAL_SIZE is 0, there is no statically allocated array at, and all non-empty arrays are heap-allocated. DYNARRAY_FINAL_TYPE The name of the type which holds the final array. If not defined, is PREFIX##finalize not provided. DYNARRAY_FINAL_TYPE must be a struct type, with members of type DYNARRAY_ELEMENT and size_t at the start (in this order). These macros are undefined after this header file has been included. The following types are provided (their members are private to the dynarray implementation): struct DYNARRAY_STRUCT The following functions are provided: void DYNARRAY_PREFIX##init (struct DYNARRAY_STRUCT *); void DYNARRAY_PREFIX##free (struct DYNARRAY_STRUCT *); bool DYNARRAY_PREFIX##has_failed (const struct DYNARRAY_STRUCT *); void DYNARRAY_PREFIX##mark_failed (struct DYNARRAY_STRUCT *); size_t DYNARRAY_PREFIX##size (const struct DYNARRAY_STRUCT *); DYNARRAY_ELEMENT *DYNARRAY_PREFIX##begin (const struct DYNARRAY_STRUCT *); DYNARRAY_ELEMENT *DYNARRAY_PREFIX##end (const struct DYNARRAY_STRUCT *); DYNARRAY_ELEMENT *DYNARRAY_PREFIX##at (struct DYNARRAY_STRUCT *, size_t); void DYNARRAY_PREFIX##add (struct DYNARRAY_STRUCT *, DYNARRAY_ELEMENT); DYNARRAY_ELEMENT *DYNARRAY_PREFIX##emplace (struct DYNARRAY_STRUCT *); bool DYNARRAY_PREFIX##resize (struct DYNARRAY_STRUCT *, size_t); void DYNARRAY_PREFIX##remove_last (struct DYNARRAY_STRUCT *); void DYNARRAY_PREFIX##clear (struct DYNARRAY_STRUCT *); The following functions are provided are provided if the prerequisites are met: bool DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *, DYNARRAY_FINAL_TYPE *); (if DYNARRAY_FINAL_TYPE is defined) DYNARRAY_ELEMENT *DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *, size_t *); (if DYNARRAY_FINAL_TYPE is not defined) */ #include #include #include #include #ifndef DYNARRAY_STRUCT # error "DYNARRAY_STRUCT must be defined" #endif #ifndef DYNARRAY_ELEMENT # error "DYNARRAY_ELEMENT must be defined" #endif #ifndef DYNARRAY_PREFIX # error "DYNARRAY_PREFIX must be defined" #endif #ifdef DYNARRAY_INITIAL_SIZE # if DYNARRAY_INITIAL_SIZE < 0 # error "DYNARRAY_INITIAL_SIZE must be non-negative" # endif # if DYNARRAY_INITIAL_SIZE > 0 # define DYNARRAY_HAVE_SCRATCH 1 # else # define DYNARRAY_HAVE_SCRATCH 0 # endif #else /* Provide a reasonable default which limits the size of DYNARRAY_STRUCT. */ # define DYNARRAY_INITIAL_SIZE \ (sizeof (DYNARRAY_ELEMENT) > 64 ? 2 : 128 / sizeof (DYNARRAY_ELEMENT)) # define DYNARRAY_HAVE_SCRATCH 1 #endif /* Public type definitions. */ /* All fields of this struct are private to the implementation. */ struct DYNARRAY_STRUCT { union { struct dynarray_header dynarray_abstract; struct { /* These fields must match struct dynarray_header. */ size_t used; size_t allocated; DYNARRAY_ELEMENT *array; } dynarray_header; } u; #if DYNARRAY_HAVE_SCRATCH /* Initial inline allocation. */ DYNARRAY_ELEMENT scratch[DYNARRAY_INITIAL_SIZE]; #endif }; /* Internal use only: Helper macros. */ /* Ensure macro-expansion of DYNARRAY_PREFIX. */ #define DYNARRAY_CONCAT0(prefix, name) prefix##name #define DYNARRAY_CONCAT1(prefix, name) DYNARRAY_CONCAT0(prefix, name) #define DYNARRAY_NAME(name) DYNARRAY_CONCAT1(DYNARRAY_PREFIX, name) /* Use DYNARRAY_FREE instead of DYNARRAY_NAME (free), so that Gnulib does not change 'free' to 'rpl_free'. */ #define DYNARRAY_FREE DYNARRAY_CONCAT1 (DYNARRAY_NAME (f), ree) /* Address of the scratch buffer if any. */ #if DYNARRAY_HAVE_SCRATCH # define DYNARRAY_SCRATCH(list) (list)->scratch #else # define DYNARRAY_SCRATCH(list) NULL #endif /* Internal use only: Helper functions. */ /* Internal function. Call DYNARRAY_ELEMENT_FREE with the array elements. Name mangling needed due to the DYNARRAY_ELEMENT_FREE macro expansion. */ static inline void DYNARRAY_NAME (free__elements__) (DYNARRAY_ELEMENT *__dynarray_array, size_t __dynarray_used) { #ifdef DYNARRAY_ELEMENT_FREE for (size_t __dynarray_i = 0; __dynarray_i < __dynarray_used; ++__dynarray_i) DYNARRAY_ELEMENT_FREE (&__dynarray_array[__dynarray_i]); #endif /* DYNARRAY_ELEMENT_FREE */ } /* Internal function. Free the non-scratch array allocation. */ static inline void DYNARRAY_NAME (free__array__) (struct DYNARRAY_STRUCT *list) { #if DYNARRAY_HAVE_SCRATCH if (list->u.dynarray_header.array != list->scratch) free (list->u.dynarray_header.array); #else free (list->u.dynarray_header.array); #endif } /* Public functions. */ /* Initialize a dynamic array object. This must be called before any use of the object. */ __attribute_nonnull__ ((1)) static void DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list) { list->u.dynarray_header.used = 0; list->u.dynarray_header.allocated = DYNARRAY_INITIAL_SIZE; list->u.dynarray_header.array = DYNARRAY_SCRATCH (list); } /* Deallocate the dynamic array and its elements. */ __attribute_maybe_unused__ __attribute_nonnull__ ((1)) static void DYNARRAY_FREE (struct DYNARRAY_STRUCT *list) { DYNARRAY_NAME (free__elements__) (list->u.dynarray_header.array, list->u.dynarray_header.used); DYNARRAY_NAME (free__array__) (list); DYNARRAY_NAME (init) (list); } /* Return true if the dynamic array is in an error state. */ __attribute_nonnull__ ((1)) static inline bool DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list) { return list->u.dynarray_header.allocated == __dynarray_error_marker (); } /* Mark the dynamic array as failed. All elements are deallocated as a side effect. */ __attribute_nonnull__ ((1)) static void DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list) { DYNARRAY_NAME (free__elements__) (list->u.dynarray_header.array, list->u.dynarray_header.used); DYNARRAY_NAME (free__array__) (list); list->u.dynarray_header.array = DYNARRAY_SCRATCH (list); list->u.dynarray_header.used = 0; list->u.dynarray_header.allocated = __dynarray_error_marker (); } /* Return the number of elements which have been added to the dynamic array. */ __attribute_nonnull__ ((1)) static inline size_t DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list) { return list->u.dynarray_header.used; } /* Return a pointer to the array element at INDEX. Terminate the process if INDEX is out of bounds. */ __attribute_nonnull__ ((1)) static inline DYNARRAY_ELEMENT * DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index) { if (__glibc_unlikely (index >= DYNARRAY_NAME (size) (list))) __libc_dynarray_at_failure (DYNARRAY_NAME (size) (list), index); return list->u.dynarray_header.array + index; } /* Return a pointer to the first array element, if any. For a zero-length array, the pointer can be NULL even though the dynamic array has not entered the failure state. */ __attribute_nonnull__ ((1)) static inline DYNARRAY_ELEMENT * DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list) { return list->u.dynarray_header.array; } /* Return a pointer one element past the last array element. For a zero-length array, the pointer can be NULL even though the dynamic array has not entered the failure state. */ __attribute_nonnull__ ((1)) static inline DYNARRAY_ELEMENT * DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list) { return list->u.dynarray_header.array + list->u.dynarray_header.used; } /* Internal function. Slow path for the add function below. */ static void DYNARRAY_NAME (add__) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) { if (__glibc_unlikely (!__libc_dynarray_emplace_enlarge (&list->u.dynarray_abstract, DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT)))) { DYNARRAY_NAME (mark_failed) (list); return; } /* Copy the new element and increase the array length. */ list->u.dynarray_header.array[list->u.dynarray_header.used++] = item; } /* Add ITEM at the end of the array, enlarging it by one element. Mark *LIST as failed if the dynamic array allocation size cannot be increased. */ __attribute_nonnull__ ((1)) static inline void DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) { /* Do nothing in case of previous error. */ if (DYNARRAY_NAME (has_failed) (list)) return; /* Enlarge the array if necessary. */ if (__glibc_unlikely (list->u.dynarray_header.used == list->u.dynarray_header.allocated)) { DYNARRAY_NAME (add__) (list, item); return; } /* Copy the new element and increase the array length. */ list->u.dynarray_header.array[list->u.dynarray_header.used++] = item; } /* Internal function. Building block for the emplace functions below. Assumes space for one more element in *LIST. */ static inline DYNARRAY_ELEMENT * DYNARRAY_NAME (emplace__tail__) (struct DYNARRAY_STRUCT *list) { DYNARRAY_ELEMENT *result = &list->u.dynarray_header.array[list->u.dynarray_header.used]; ++list->u.dynarray_header.used; #if defined (DYNARRAY_ELEMENT_INIT) DYNARRAY_ELEMENT_INIT (result); #elif defined (DYNARRAY_ELEMENT_FREE) memset (result, 0, sizeof (*result)); #endif return result; } /* Internal function. Slow path for the emplace function below. */ static DYNARRAY_ELEMENT * DYNARRAY_NAME (emplace__) (struct DYNARRAY_STRUCT *list) { if (__glibc_unlikely (!__libc_dynarray_emplace_enlarge (&list->u.dynarray_abstract, DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT)))) { DYNARRAY_NAME (mark_failed) (list); return NULL; } return DYNARRAY_NAME (emplace__tail__) (list); } /* Allocate a place for a new element in *LIST and return a pointer to it. The pointer can be NULL if the dynamic array cannot be enlarged due to a memory allocation failure. */ __attribute_maybe_unused__ __attribute_warn_unused_result__ __attribute_nonnull__ ((1)) static /* Avoid inlining with the larger initialization code. */ #if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE)) inline #endif DYNARRAY_ELEMENT * DYNARRAY_NAME (emplace) (struct DYNARRAY_STRUCT *list) { /* Do nothing in case of previous error. */ if (DYNARRAY_NAME (has_failed) (list)) return NULL; /* Enlarge the array if necessary. */ if (__glibc_unlikely (list->u.dynarray_header.used == list->u.dynarray_header.allocated)) return (DYNARRAY_NAME (emplace__) (list)); return DYNARRAY_NAME (emplace__tail__) (list); } /* Change the size of *LIST to SIZE. If SIZE is larger than the existing size, new elements are added (which can be initialized). Otherwise, the list is truncated, and elements are freed. Return false on memory allocation failure (and mark *LIST as failed). */ __attribute_maybe_unused__ __attribute_nonnull__ ((1)) static bool DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size) { if (size > list->u.dynarray_header.used) { bool ok; #if defined (DYNARRAY_ELEMENT_INIT) /* The new elements have to be initialized. */ size_t old_size = list->u.dynarray_header.used; ok = __libc_dynarray_resize (&list->u.dynarray_abstract, size, DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT)); if (ok) for (size_t i = old_size; i < size; ++i) { DYNARRAY_ELEMENT_INIT (&list->u.dynarray_header.array[i]); } #elif defined (DYNARRAY_ELEMENT_FREE) /* Zero initialization is needed so that the elements can be safely freed. */ ok = __libc_dynarray_resize_clear (&list->u.dynarray_abstract, size, DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT)); #else ok = __libc_dynarray_resize (&list->u.dynarray_abstract, size, DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT)); #endif if (__glibc_unlikely (!ok)) DYNARRAY_NAME (mark_failed) (list); return ok; } else { /* The list has shrunk in size. Free the removed elements. */ DYNARRAY_NAME (free__elements__) (list->u.dynarray_header.array + size, list->u.dynarray_header.used - size); list->u.dynarray_header.used = size; return true; } } /* Remove the last element of LIST if it is present. */ __attribute_maybe_unused__ __attribute_nonnull__ ((1)) static void DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list) { /* used > 0 implies that the array is the non-failed state. */ if (list->u.dynarray_header.used > 0) { size_t new_length = list->u.dynarray_header.used - 1; #ifdef DYNARRAY_ELEMENT_FREE DYNARRAY_ELEMENT_FREE (&list->u.dynarray_header.array[new_length]); #endif list->u.dynarray_header.used = new_length; } } /* Remove all elements from the list. The elements are freed, but the list itself is not. */ __attribute_maybe_unused__ __attribute_nonnull__ ((1)) static void DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list) { /* free__elements__ does nothing if the list is in the failed state. */ DYNARRAY_NAME (free__elements__) (list->u.dynarray_header.array, list->u.dynarray_header.used); list->u.dynarray_header.used = 0; } #ifdef DYNARRAY_FINAL_TYPE /* Transfer the dynamic array to a permanent location at *RESULT. Returns true on success on false on allocation failure. In either case, *LIST is re-initialized and can be reused. A NULL pointer is stored in *RESULT if LIST refers to an empty list. On success, the pointer in *RESULT is heap-allocated and must be deallocated using free. */ __attribute_maybe_unused__ __attribute_warn_unused_result__ __attribute_nonnull__ ((1, 2)) static bool DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, DYNARRAY_FINAL_TYPE *result) { struct dynarray_finalize_result res; if (__libc_dynarray_finalize (&list->u.dynarray_abstract, DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT), &res)) { /* On success, the result owns all the data. */ DYNARRAY_NAME (init) (list); *result = (DYNARRAY_FINAL_TYPE) { res.array, res.length }; return true; } else { /* On error, we need to free all data. */ DYNARRAY_FREE (list); errno = ENOMEM; return false; } } #else /* !DYNARRAY_FINAL_TYPE */ /* Transfer the dynamic array to a heap-allocated array and return a pointer to it. The pointer is NULL if memory allocation fails, or if the array is empty, so this function should be used only for arrays which are known not be empty (usually because they always have a sentinel at the end). If LENGTHP is not NULL, the array length is written to *LENGTHP. *LIST is re-initialized and can be reused. */ __attribute_maybe_unused__ __attribute_warn_unused_result__ __attribute_nonnull__ ((1)) static DYNARRAY_ELEMENT * DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp) { struct dynarray_finalize_result res; if (__libc_dynarray_finalize (&list->u.dynarray_abstract, DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT), &res)) { /* On success, the result owns all the data. */ DYNARRAY_NAME (init) (list); if (lengthp != NULL) *lengthp = res.length; return res.array; } else { /* On error, we need to free all data. */ DYNARRAY_FREE (list); errno = ENOMEM; return NULL; } } #endif /* !DYNARRAY_FINAL_TYPE */ /* Undo macro definitions. */ #undef DYNARRAY_CONCAT0 #undef DYNARRAY_CONCAT1 #undef DYNARRAY_NAME #undef DYNARRAY_SCRATCH #undef DYNARRAY_HAVE_SCRATCH #undef DYNARRAY_STRUCT #undef DYNARRAY_ELEMENT #undef DYNARRAY_PREFIX #undef DYNARRAY_ELEMENT_FREE #undef DYNARRAY_ELEMENT_INIT #undef DYNARRAY_INITIAL_SIZE #undef DYNARRAY_FINAL_TYPE kbuild-3608/src/grep/lib/malloc/dynarray_resize_clear.c0000664000175000017500000000266014670377424023215 0ustar locutuslocutus/* Increase the size of a dynamic array and clear the new part. Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _LIBC # include #endif #include #include bool __libc_dynarray_resize_clear (struct dynarray_header *list, size_t size, void *scratch, size_t element_size) { size_t old_size = list->used; if (!__libc_dynarray_resize (list, size, scratch, element_size)) return false; /* __libc_dynarray_resize already checked for overflow. */ char *array = list->array; memset (array + (old_size * element_size), 0, (size - old_size) * element_size); return true; } libc_hidden_def (__libc_dynarray_resize_clear) kbuild-3608/src/grep/lib/malloc/dynarray_emplace_enlarge.c0000664000175000017500000000452114670377424023647 0ustar locutuslocutus/* Increase the size of a dynamic array in preparation of an emplace operation. Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _LIBC # include #endif #include #include #include #include #include bool __libc_dynarray_emplace_enlarge (struct dynarray_header *list, void *scratch, size_t element_size) { size_t new_allocated; if (list->allocated == 0) { /* No scratch buffer provided. Choose a reasonable default size. */ if (element_size < 4) new_allocated = 16; else if (element_size < 8) new_allocated = 8; else new_allocated = 4; } else /* Increase the allocated size, using an exponential growth policy. */ { new_allocated = list->allocated + list->allocated / 2 + 1; if (new_allocated <= list->allocated) { /* Overflow. */ __set_errno (ENOMEM); return false; } } size_t new_size; if (INT_MULTIPLY_WRAPV (new_allocated, element_size, &new_size)) return false; void *new_array; if (list->array == scratch) { /* The previous array was not heap-allocated. */ new_array = malloc (new_size); if (new_array != NULL && list->array != NULL) memcpy (new_array, list->array, list->used * element_size); } else new_array = realloc (list->array, new_size); if (new_array == NULL) return false; list->array = new_array; list->allocated = new_allocated; return true; } libc_hidden_def (__libc_dynarray_emplace_enlarge) kbuild-3608/src/grep/lib/malloc/dynarray_finalize.c0000664000175000017500000000423014670377424022342 0ustar locutuslocutus/* Copy the dynamically-allocated area to an explicitly-sized heap allocation. Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _LIBC # include #endif #include #include #include bool __libc_dynarray_finalize (struct dynarray_header *list, void *scratch, size_t element_size, struct dynarray_finalize_result *result) { if (__dynarray_error (list)) /* The caller will reported the deferred error. */ return false; size_t used = list->used; /* Empty list. */ if (used == 0) { /* An empty list could still be backed by a heap-allocated array. Free it if necessary. */ if (list->array != scratch) free (list->array); *result = (struct dynarray_finalize_result) { NULL, 0 }; return true; } size_t allocation_size = used * element_size; void *heap_array = malloc (allocation_size); if (heap_array != NULL) { /* The new array takes ownership of the strings. */ if (list->array != NULL) memcpy (heap_array, list->array, allocation_size); if (list->array != scratch) free (list->array); *result = (struct dynarray_finalize_result) { .array = heap_array, .length = used }; return true; } else /* The caller will perform the freeing operation. */ return false; } libc_hidden_def (__libc_dynarray_finalize) kbuild-3608/src/grep/lib/malloc/dynarray_resize.c0000664000175000017500000000411214670377424022041 0ustar locutuslocutus/* Increase the size of a dynamic array. Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _LIBC # include #endif #include #include #include #include #include bool __libc_dynarray_resize (struct dynarray_header *list, size_t size, void *scratch, size_t element_size) { /* The existing allocation provides sufficient room. */ if (size <= list->allocated) { list->used = size; return true; } /* Otherwise, use size as the new allocation size. The caller is expected to provide the final size of the array, so there is no over-allocation here. */ size_t new_size_bytes; if (INT_MULTIPLY_WRAPV (size, element_size, &new_size_bytes)) { /* Overflow. */ __set_errno (ENOMEM); return false; } void *new_array; if (list->array == scratch) { /* The previous array was not heap-allocated. */ new_array = malloc (new_size_bytes); if (new_array != NULL && list->array != NULL) memcpy (new_array, list->array, list->used * element_size); } else new_array = realloc (list->array, new_size_bytes); if (new_array == NULL) return false; list->array = new_array; list->allocated = size; list->used = size; return true; } libc_hidden_def (__libc_dynarray_resize) kbuild-3608/src/grep/lib/dup2.c0000664000175000017500000000774214670377423016245 0ustar locutuslocutus/* Duplicate an open file descriptor to a specified file descriptor. Copyright (C) 1999, 2004-2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Paul Eggert */ #include /* Specification. */ #include #include #include #undef dup2 #if defined _WIN32 && ! defined __CYGWIN__ /* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include # if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" # endif /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include # endif # if HAVE_MSVC_INVALID_PARAMETER_HANDLER static int dup2_nothrow (int fd, int desired_fd) { int result; TRY_MSVC_INVAL { result = _dup2 (fd, desired_fd); } CATCH_MSVC_INVAL { errno = EBADF; result = -1; } DONE_MSVC_INVAL; return result; } # else # define dup2_nothrow _dup2 # endif static int ms_windows_dup2 (int fd, int desired_fd) { int result; /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open, dup2 (fd, fd) returns 0, but all further attempts to use fd in future dup2 calls will hang. */ if (fd == desired_fd) { if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE) { errno = EBADF; return -1; } return fd; } /* Wine 1.0.1 return 0 when desired_fd is negative but not -1: https://bugs.winehq.org/show_bug.cgi?id=21289 */ if (desired_fd < 0) { errno = EBADF; return -1; } result = dup2_nothrow (fd, desired_fd); if (result == 0) result = desired_fd; return result; } # define dup2 ms_windows_dup2 #elif defined __KLIBC__ # include static int klibc_dup2dirfd (int fd, int desired_fd) { int tempfd; int dupfd; tempfd = open ("NUL", O_RDONLY); if (tempfd == -1) return -1; if (tempfd == desired_fd) { close (tempfd); char path[_MAX_PATH]; if (__libc_Back_ioFHToPath (fd, path, sizeof (path))) return -1; return open(path, O_RDONLY); } dupfd = klibc_dup2dirfd (fd, desired_fd); close (tempfd); return dupfd; } static int klibc_dup2 (int fd, int desired_fd) { int dupfd; struct stat sbuf; dupfd = dup2 (fd, desired_fd); if (dupfd == -1 && errno == ENOTSUP \ && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) { close (desired_fd); return klibc_dup2dirfd (fd, desired_fd); } return dupfd; } # define dup2 klibc_dup2 #endif int rpl_dup2 (int fd, int desired_fd) { int result; #ifdef F_GETFL /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF. On Cygwin 1.5.x, dup2 (1, 1) returns 0. On Cygwin 1.7.17, dup2 (1, -1) dumps core. On Cygwin 1.7.25, dup2 (1, 256) can dump core. On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */ # if HAVE_SETDTABLESIZE setdtablesize (desired_fd + 1); # endif if (desired_fd < 0) fd = desired_fd; if (fd == desired_fd) return fcntl (fd, F_GETFL) == -1 ? -1 : fd; #endif result = dup2 (fd, desired_fd); /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */ if (result == -1 && errno == EMFILE) errno = EBADF; #if REPLACE_FCHDIR if (fd != desired_fd && result != -1) result = _gl_register_dup (fd, result); #endif return result; } kbuild-3608/src/grep/lib/xstriconv.h0000664000175000017500000000622314670377426017433 0ustar locutuslocutus/* Charset conversion with out-of-memory checking. Copyright (C) 2001-2004, 2006-2007, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. 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 . */ #ifndef _XSTRICONV_H #define _XSTRICONV_H #include #if HAVE_ICONV #include #endif #ifdef __cplusplus extern "C" { #endif #if HAVE_ICONV /* Convert an entire string from one encoding to another, using iconv. The original string is at [SRC,...,SRC+SRCLEN-1]. The conversion descriptor is passed as CD. *RESULTP and *LENGTH should initially be a scratch buffer and its size, or *RESULTP can initially be NULL. May erase the contents of the memory at *RESULTP. Upon memory allocation failure, report the error and exit. Return value: 0 if successful, otherwise -1 and errno set. If successful: The resulting string is stored in *RESULTP and its length in *LENGTHP. *RESULTP is set to a freshly allocated memory block, or is unchanged if no dynamic memory allocation was necessary. */ extern int xmem_cd_iconv (const char *src, size_t srclen, iconv_t cd, char **resultp, size_t *lengthp); /* Convert an entire string from one encoding to another, using iconv. The original string is the NUL-terminated string starting at SRC. The conversion descriptor is passed as CD. Both the "from" and the "to" encoding must use a single NUL byte at the end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32). Allocate a malloced memory block for the result. Upon memory allocation failure, report the error and exit. Return value: the freshly allocated resulting NUL-terminated string if successful, otherwise NULL and errno set. */ extern char * xstr_cd_iconv (const char *src, iconv_t cd) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; #endif /* Convert an entire string from one encoding to another, using iconv. The original string is the NUL-terminated string starting at SRC. Both the "from" and the "to" encoding must use a single NUL byte at the end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32). Allocate a malloced memory block for the result. Upon memory allocation failure, report the error and exit. Return value: the freshly allocated resulting NUL-terminated string if successful, otherwise NULL and errno set. */ extern char * xstr_iconv (const char *src, const char *from_codeset, const char *to_codeset) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; #ifdef __cplusplus } #endif #endif /* _XSTRICONV_H */ kbuild-3608/src/grep/lib/fpending.h0000664000175000017500000000167614670377423017172 0ustar locutuslocutus/* Declare __fpending. Copyright (C) 2000, 2003, 2005-2006, 2009-2021 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 . Written by Jim Meyering. */ #include #include #if HAVE_STDIO_EXT_H # include #endif #if !HAVE_DECL___FPENDING size_t __fpending (FILE *) _GL_ATTRIBUTE_PURE; #endif kbuild-3608/src/grep/lib/fcntl-safer.h0000664000175000017500000000173414670377423017577 0ustar locutuslocutus/* Invoke fcntl-like functions, but avoid some glitches. Copyright (C) 2005, 2009-2021 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 . */ /* Written by Paul Eggert. */ #include int open_safer (char const *, int, ...); int creat_safer (char const *, mode_t); #if GNULIB_OPENAT_SAFER int openat_safer (int, char const *, int, ...); #endif kbuild-3608/src/grep/lib/getopt.c0000664000175000017500000005711114670377423016670 0ustar locutuslocutus/* Getopt for GNU. Copyright (C) 1987-2021 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _LIBC # include #endif #include "getopt.h" #include #include #include #include #ifdef _LIBC /* When used as part of glibc, error printing must be done differently for standards compliance. getopt is not a cancellation point, so it must not call functions that are, and it is specified by an older standard than stdio locking, so it must not refer to functions in the "user namespace" related to stdio locking. Finally, it must use glibc's internal message translation so that the messages are looked up in the proper text domain. */ # include # define fprintf __fxprintf_nocancel # define flockfile(fp) _IO_flockfile (fp) # define funlockfile(fp) _IO_funlockfile (fp) #else # include "gettext.h" # define _(msgid) gettext (msgid) /* When used standalone, flockfile and funlockfile might not be available. */ # if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \ || (defined _WIN32 && ! defined __CYGWIN__)) # define flockfile(fp) /* nop */ # define funlockfile(fp) /* nop */ # endif /* When used standalone, do not attempt to use alloca. */ # define __libc_use_alloca(size) 0 # undef alloca # define alloca(size) (abort (), (void *)0) #endif /* This implementation of 'getopt' has three modes for handling options interspersed with non-option arguments. It can stop scanning for options at the first non-option argument encountered, as POSIX specifies. It can continue scanning for options after the first non-option argument, but permute 'argv' as it goes so that, after 'getopt' is done, all the options precede all the non-option arguments and 'optind' points to the first non-option argument. Or, it can report non-option arguments as if they were arguments to the option character '\x01'. The default behavior of 'getopt_long' is to permute the argument list. When this implementation is used standalone, the default behavior of 'getopt' is to stop at the first non-option argument, but when it is used as part of GNU libc it also permutes the argument list. In both cases, setting the environment variable POSIXLY_CORRECT to any value disables permutation. If the first character of the OPTSTRING argument to 'getopt' or 'getopt_long' is '+', both functions will stop at the first non-option argument. If it is '-', both functions will report non-option arguments as arguments to the option character '\x01'. */ #include "getopt_int.h" /* For communication from 'getopt' to the caller. When 'getopt' finds an option that takes an argument, the argument value is returned here. Also, when 'ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to 'getopt'. On entry to 'getopt', zero means this is the first call; initialize. When 'getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, 'optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Keep a global copy of all internal members of getopt_data. */ static struct _getopt_data getopt_data; /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. 'first_nonopt' and 'last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange (char **argv, struct _getopt_data *d) { int bottom = d->__first_nonopt; int middle = d->__last_nonopt; int top = d->optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ d->__first_nonopt += (d->optind - d->__last_nonopt); d->__last_nonopt = d->optind; } /* Process the argument starting with d->__nextchar as a long option. d->optind should *not* have been advanced over this argument. If the value returned is -1, it was not actually a long option, the state is unchanged, and the argument should be processed as a set of short options (this can only happen when long_only is true). Otherwise, the option (and its argument, if any) have been consumed and the return value is the value to return from _getopt_internal_r. */ static int process_long_option (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, struct _getopt_data *d, int print_errors, const char *prefix) { char *nameend; size_t namelen; const struct option *p; const struct option *pfound = NULL; int n_options; int option_index; for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; namelen = nameend - d->__nextchar; /* First look for an exact match, counting the options as a side effect. */ for (p = longopts, n_options = 0; p->name; p++, n_options++) if (!strncmp (p->name, d->__nextchar, namelen) && namelen == strlen (p->name)) { /* Exact match found. */ pfound = p; option_index = n_options; break; } if (pfound == NULL) { /* Didn't find an exact match, so look for abbreviations. */ unsigned char *ambig_set = NULL; int ambig_malloced = 0; int ambig_fallback = 0; int indfound = -1; for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, d->__nextchar, namelen)) { if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) { /* Second or later nonexact match found. */ if (!ambig_fallback) { if (!print_errors) /* Don't waste effort tracking the ambig set if we're not going to print it anyway. */ ambig_fallback = 1; else if (!ambig_set) { if (__libc_use_alloca (n_options)) ambig_set = alloca (n_options); else if ((ambig_set = malloc (n_options)) == NULL) /* Fall back to simpler error message. */ ambig_fallback = 1; else ambig_malloced = 1; if (ambig_set) { memset (ambig_set, 0, n_options); ambig_set[indfound] = 1; } } if (ambig_set) ambig_set[option_index] = 1; } } } if (ambig_set || ambig_fallback) { if (print_errors) { if (ambig_fallback) fprintf (stderr, _("%s: option '%s%s' is ambiguous\n"), argv[0], prefix, d->__nextchar); else { flockfile (stderr); fprintf (stderr, _("%s: option '%s%s' is ambiguous; possibilities:"), argv[0], prefix, d->__nextchar); for (option_index = 0; option_index < n_options; option_index++) if (ambig_set[option_index]) fprintf (stderr, " '%s%s'", prefix, longopts[option_index].name); /* This must use 'fprintf' even though it's only printing a single character, so that it goes through __fxprintf_nocancel when compiled as part of glibc. */ fprintf (stderr, "\n"); funlockfile (stderr); } } if (ambig_malloced) free (ambig_set); d->__nextchar += strlen (d->__nextchar); d->optind++; d->optopt = 0; return '?'; } option_index = indfound; } if (pfound == NULL) { /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. */ if (!long_only || argv[d->optind][1] == '-' || strchr (optstring, *d->__nextchar) == NULL) { if (print_errors) fprintf (stderr, _("%s: unrecognized option '%s%s'\n"), argv[0], prefix, d->__nextchar); d->__nextchar = NULL; d->optind++; d->optopt = 0; return '?'; } /* Otherwise interpret it as a short option. */ return -1; } /* We have found a matching long option. Consume it. */ d->optind++; d->__nextchar = NULL; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) d->optarg = nameend + 1; else { if (print_errors) fprintf (stderr, _("%s: option '%s%s' doesn't allow an argument\n"), argv[0], prefix, pfound->name); d->optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (d->optind < argc) d->optarg = argv[d->optind++]; else { if (print_errors) fprintf (stderr, _("%s: option '%s%s' requires an argument\n"), argv[0], prefix, pfound->name); d->optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Initialize internal data upon the first call to getopt. */ static const char * _getopt_initialize (int argc _GL_UNUSED, char **argv _GL_UNUSED, const char *optstring, struct _getopt_data *d, int posixly_correct) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ if (d->optind == 0) d->optind = 1; d->__first_nonopt = d->__last_nonopt = d->optind; d->__nextchar = NULL; /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { d->__ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { d->__ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct || !!getenv ("POSIXLY_CORRECT")) d->__ordering = REQUIRE_ORDER; else d->__ordering = PERMUTE; d->__initialized = 1; return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If 'getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If 'getopt' finds another option character, it returns that character, updating 'optind' and 'nextchar' so that the next call to 'getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, 'getopt' returns -1. Then 'optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set 'opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in 'optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in 'optarg', otherwise 'optarg' is set to zero. If OPTSTRING starts with '-' or '+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with '--' instead of '-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a '=', or else the in next ARGV-element. When 'getopt' finds a long-named option, it returns 0 if that option's 'flag' field is nonzero, the value of the option's 'val' field if the 'flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of 'struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal_r (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, struct _getopt_data *d, int posixly_correct) { int print_errors = d->opterr; if (argc < 1) return -1; d->optarg = NULL; if (d->optind == 0 || !d->__initialized) optstring = _getopt_initialize (argc, argv, optstring, d, posixly_correct); else if (optstring[0] == '-' || optstring[0] == '+') optstring++; if (optstring[0] == ':') print_errors = 0; /* Test whether ARGV[optind] points to a non-option argument. */ #define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') if (d->__nextchar == NULL || *d->__nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (d->__last_nonopt > d->optind) d->__last_nonopt = d->optind; if (d->__first_nonopt > d->optind) d->__first_nonopt = d->optind; if (d->__ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (d->__first_nonopt != d->__last_nonopt && d->__last_nonopt != d->optind) exchange (argv, d); else if (d->__last_nonopt != d->optind) d->__first_nonopt = d->optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (d->optind < argc && NONOPTION_P) d->optind++; d->__last_nonopt = d->optind; } /* The special ARGV-element '--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (d->optind != argc && !strcmp (argv[d->optind], "--")) { d->optind++; if (d->__first_nonopt != d->__last_nonopt && d->__last_nonopt != d->optind) exchange (argv, d); else if (d->__first_nonopt == d->__last_nonopt) d->__first_nonopt = d->optind; d->__last_nonopt = argc; d->optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (d->optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (d->__first_nonopt != d->__last_nonopt) d->optind = d->__first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (d->__ordering == REQUIRE_ORDER) return -1; d->optarg = argv[d->optind++]; return 1; } /* We have found another option-ARGV-element. Check whether it might be a long option. */ if (longopts) { if (argv[d->optind][1] == '-') { /* "--foo" is always a long option. The special option "--" was handled above. */ d->__nextchar = argv[d->optind] + 2; return process_long_option (argc, argv, optstring, longopts, longind, long_only, d, print_errors, "--"); } /* If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (long_only && (argv[d->optind][2] || !strchr (optstring, argv[d->optind][1]))) { int code; d->__nextchar = argv[d->optind] + 1; code = process_long_option (argc, argv, optstring, longopts, longind, long_only, d, print_errors, "-"); if (code != -1) return code; } } /* It is not a long option. Skip the initial punctuation. */ d->__nextchar = argv[d->optind] + 1; } /* Look at and handle the next short option-character. */ { char c = *d->__nextchar++; const char *temp = strchr (optstring, c); /* Increment 'optind' when we start to process its last character. */ if (*d->__nextchar == '\0') ++d->optind; if (temp == NULL || c == ':' || c == ';') { if (print_errors) fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c); d->optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';' && longopts != NULL) { /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') d->optarg = d->__nextchar; else if (d->optind == argc) { if (print_errors) fprintf (stderr, _("%s: option requires an argument -- '%c'\n"), argv[0], c); d->optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else d->optarg = argv[d->optind]; d->__nextchar = d->optarg; d->optarg = NULL; return process_long_option (argc, argv, optstring, longopts, longind, 0 /* long_only */, d, print_errors, "-W "); } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; d->optind++; } else d->optarg = NULL; d->__nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ d->optind++; } else if (d->optind == argc) { if (print_errors) fprintf (stderr, _("%s: option requires an argument -- '%c'\n"), argv[0], c); d->optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented 'optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; d->__nextchar = NULL; } } return c; } } int _getopt_internal (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, int posixly_correct) { int result; getopt_data.optind = optind; getopt_data.opterr = opterr; result = _getopt_internal_r (argc, argv, optstring, longopts, longind, long_only, &getopt_data, posixly_correct); optind = getopt_data.optind; optarg = getopt_data.optarg; optopt = getopt_data.optopt; return result; } /* glibc gets a LSB-compliant getopt and a POSIX-complaint __posix_getopt. Standalone applications just get a POSIX-compliant getopt. POSIX and LSB both require these functions to take 'char *const *argv' even though this is incorrect (because of the permutation). */ #define GETOPT_ENTRY(NAME, POSIXLY_CORRECT) \ int \ NAME (int argc, char *const *argv, const char *optstring) \ { \ return _getopt_internal (argc, (char **)argv, optstring, \ 0, 0, 0, POSIXLY_CORRECT); \ } #ifdef _LIBC GETOPT_ENTRY(getopt, 0) GETOPT_ENTRY(__posix_getopt, 1) #else GETOPT_ENTRY(getopt, 1) #endif #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of 'getopt'. */ int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value '%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ kbuild-3608/src/grep/lib/stddef.in.h0000664000175000017500000001203414670377426017247 0ustar locutuslocutus/* A substitute for POSIX 2008 , for platforms that have issues. Copyright (C) 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Eric Blake. */ /* * POSIX 2008 for platforms that have issues. * */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined __need_wchar_t || defined __need_size_t \ || defined __need_ptrdiff_t || defined __need_NULL \ || defined __need_wint_t /* Special invocation convention inside gcc header files. In particular, gcc provides a version of that blindly redefines NULL even when __need_wint_t was defined, even though wint_t is not normally provided by . Hence, we must remember if special invocation has ever been used to obtain wint_t, in which case we need to clean up NULL yet again. */ # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) # ifdef __need_wint_t # define _GL_STDDEF_WINT_T # endif # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ /* On TinyCC, make sure that the macros that indicate the special invocation convention get undefined. */ # undef __need_wchar_t # undef __need_size_t # undef __need_ptrdiff_t # undef __need_NULL # undef __need_wint_t # endif #else /* Normal invocation convention. */ # ifndef _@GUARD_PREFIX@_STDDEF_H /* On AIX 7.2, with xlc in 64-bit mode, defines max_align_t to a type with alignment 4, but 'long' has alignment 8. */ # if defined _AIX && defined __LP64__ # if !GNULIB_defined_max_align_t # ifdef _MAX_ALIGN_T /* /usr/include/stddef.h has already defined max_align_t. Override it. */ typedef long rpl_max_align_t; # define max_align_t rpl_max_align_t # else /* Prevent /usr/include/stddef.h from defining max_align_t. */ typedef long max_align_t; # define _MAX_ALIGN_T # endif # define GNULIB_defined_max_align_t 1 # endif # endif /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ # if (@REPLACE_NULL@ \ && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T)) # undef NULL # ifdef __cplusplus /* ISO C++ says that the macro NULL must expand to an integer constant expression, hence '((void *) 0)' is not allowed in C++. */ # if __GNUG__ >= 3 /* GNU C++ has a __null macro that behaves like an integer ('int' or 'long') but has the same size as a pointer. Use that, to avoid warnings. */ # define NULL __null # else # define NULL 0L # endif # else # define NULL ((void *) 0) # endif # endif # ifndef _@GUARD_PREFIX@_STDDEF_H # define _@GUARD_PREFIX@_STDDEF_H /* Some platforms lack wchar_t. */ #if !@HAVE_WCHAR_T@ # define wchar_t int #endif /* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is a hack in case the configure-time test was done with g++ even though we are currently compiling with gcc. On MSVC, max_align_t is defined only in C++ mode, after was included. Its definition is good since it has an alignment of 8 (on x86 and x86_64). Similarly on OS/2 kLIBC. */ #if (defined _MSC_VER || (defined __KLIBC__ && !defined __LIBCN__)) \ && defined __cplusplus # include #else # if ! (@HAVE_MAX_ALIGN_T@ || (defined _GCC_MAX_ALIGN_T && !defined __clang__)) # if !GNULIB_defined_max_align_t /* On the x86, the maximum storage alignment of double, long, etc. is 4, but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, and the C11 standard allows this. Work around this problem by using __alignof__ (which returns 8 for double) rather than _Alignof (which returns 4), and align each union member accordingly. */ # if defined __GNUC__ || (__clang_major__ >= 4) # define _GL_STDDEF_ALIGNAS(type) \ __attribute__ ((__aligned__ (__alignof__ (type)))) # else # define _GL_STDDEF_ALIGNAS(type) /* */ # endif typedef union { char *__p _GL_STDDEF_ALIGNAS (char *); double __d _GL_STDDEF_ALIGNAS (double); long double __ld _GL_STDDEF_ALIGNAS (long double); long int __i _GL_STDDEF_ALIGNAS (long int); } rpl_max_align_t; # define max_align_t rpl_max_align_t # define GNULIB_defined_max_align_t 1 # endif # endif #endif # endif /* _@GUARD_PREFIX@_STDDEF_H */ # endif /* _@GUARD_PREFIX@_STDDEF_H */ #endif /* __need_XXX */ kbuild-3608/src/grep/lib/propername.c0000664000175000017500000002344214670377426017541 0ustar locutuslocutus/* Localization of proper names. Copyright (C) 2006-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2006. 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 . */ /* Without this pragma, gcc 4.7.0 20111124 mistakenly suggests that the proper_name function might be candidate for attribute 'const' */ #if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ # pragma GCC diagnostic ignored "-Wsuggest-attribute=const" #endif #include /* Specification. */ #include "propername.h" #include #include #include #include #include #if HAVE_ICONV # include #endif #include "trim.h" #include "mbchar.h" #include "mbuiter.h" #include "localcharset.h" #include "c-strcase.h" #include "xstriconv.h" #include "xalloc.h" #include "gettext.h" /* Tests whether STRING contains trim (SUB), starting and ending at word boundaries. Here, instead of implementing Unicode Standard Annex #29 for determining word boundaries, we assume that trim (SUB) starts and ends with words and only test whether the part before it ends with a non-word and the part after it starts with a non-word. */ static bool mbsstr_trimmed_wordbounded (const char *string, const char *sub) { char *tsub = trim (sub); bool found = false; for (; *string != '\0';) { const char *tsub_in_string = mbsstr (string, tsub); if (tsub_in_string == NULL) break; else { if (MB_CUR_MAX > 1) { mbui_iterator_t string_iter; bool word_boundary_before; bool word_boundary_after; mbui_init (string_iter, string); word_boundary_before = true; if (mbui_cur_ptr (string_iter) < tsub_in_string) { mbchar_t last_char_before_tsub; do { if (!mbui_avail (string_iter)) abort (); last_char_before_tsub = mbui_cur (string_iter); mbui_advance (string_iter); } while (mbui_cur_ptr (string_iter) < tsub_in_string); if (mb_isalnum (last_char_before_tsub)) word_boundary_before = false; } mbui_init (string_iter, tsub_in_string); { mbui_iterator_t tsub_iter; for (mbui_init (tsub_iter, tsub); mbui_avail (tsub_iter); mbui_advance (tsub_iter)) { if (!mbui_avail (string_iter)) abort (); mbui_advance (string_iter); } } word_boundary_after = true; if (mbui_avail (string_iter)) { mbchar_t first_char_after_tsub = mbui_cur (string_iter); if (mb_isalnum (first_char_after_tsub)) word_boundary_after = false; } if (word_boundary_before && word_boundary_after) { found = true; break; } mbui_init (string_iter, tsub_in_string); if (!mbui_avail (string_iter)) break; string = tsub_in_string + mb_len (mbui_cur (string_iter)); } else { bool word_boundary_before; const char *p; bool word_boundary_after; word_boundary_before = true; if (string < tsub_in_string) if (isalnum ((unsigned char) tsub_in_string[-1])) word_boundary_before = false; p = tsub_in_string + strlen (tsub); word_boundary_after = true; if (*p != '\0') if (isalnum ((unsigned char) *p)) word_boundary_after = false; if (word_boundary_before && word_boundary_after) { found = true; break; } if (*tsub_in_string == '\0') break; string = tsub_in_string + 1; } } } free (tsub); return found; } /* Return the localization of NAME. NAME is written in ASCII. */ const char * proper_name (const char *name) { /* See whether there is a translation. */ const char *translation = gettext (name); if (translation != name) { /* See whether the translation contains the original name. */ if (mbsstr_trimmed_wordbounded (translation, name)) return translation; else { /* Return "TRANSLATION (NAME)". */ char *result = XNMALLOC (strlen (translation) + 2 + strlen (name) + 1 + 1, char); sprintf (result, "%s (%s)", translation, name); return result; } } else return name; } /* Return the localization of a name whose original writing is not ASCII. NAME_UTF8 is the real name, written in UTF-8 with octal or hexadecimal escape sequences. NAME_ASCII is a fallback written only with ASCII characters. */ const char * proper_name_utf8 (const char *name_ascii, const char *name_utf8) { /* See whether there is a translation. */ const char *translation = gettext (name_ascii); /* Try to convert NAME_UTF8 to the locale encoding. */ const char *locale_code = locale_charset (); char *alloc_name_converted = NULL; char *alloc_name_converted_translit = NULL; const char *name_converted = NULL; const char *name_converted_translit = NULL; const char *name; if (c_strcasecmp (locale_code, "UTF-8") != 0) { #if HAVE_ICONV name_converted = alloc_name_converted = xstr_iconv (name_utf8, "UTF-8", locale_code); # if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \ && !defined __UCLIBC__) \ || _LIBICONV_VERSION >= 0x0105 { char *converted_translit; size_t len = strlen (locale_code); char *locale_code_translit = XNMALLOC (len + 10 + 1, char); memcpy (locale_code_translit, locale_code, len); memcpy (locale_code_translit + len, "//TRANSLIT", 10 + 1); converted_translit = xstr_iconv (name_utf8, "UTF-8", locale_code_translit); free (locale_code_translit); if (converted_translit != NULL) { # if !_LIBICONV_VERSION /* Don't use the transliteration if it added question marks. glibc's transliteration falls back to question marks; libiconv's transliteration does not. mbschr is equivalent to strchr in this case. */ if (strchr (converted_translit, '?') != NULL) free (converted_translit); else # endif name_converted_translit = alloc_name_converted_translit = converted_translit; } } # endif #endif } else { name_converted = name_utf8; name_converted_translit = name_utf8; } /* The name in locale encoding. */ name = (name_converted != NULL ? name_converted : name_converted_translit != NULL ? name_converted_translit : name_ascii); /* See whether we have a translation. Some translators have not understood that they should use the UTF-8 form of the name, if possible. So if the translator provided a no-op translation, we ignore it. */ if (strcmp (translation, name_ascii) != 0) { /* See whether the translation contains the original name. */ if (mbsstr_trimmed_wordbounded (translation, name_ascii) || (name_converted != NULL && mbsstr_trimmed_wordbounded (translation, name_converted)) || (name_converted_translit != NULL && mbsstr_trimmed_wordbounded (translation, name_converted_translit))) { if (alloc_name_converted != NULL) free (alloc_name_converted); if (alloc_name_converted_translit != NULL) free (alloc_name_converted_translit); return translation; } else { /* Return "TRANSLATION (NAME)". */ char *result = XNMALLOC (strlen (translation) + 2 + strlen (name) + 1 + 1, char); sprintf (result, "%s (%s)", translation, name); if (alloc_name_converted != NULL) free (alloc_name_converted); if (alloc_name_converted_translit != NULL) free (alloc_name_converted_translit); return result; } } else { if (alloc_name_converted != NULL && alloc_name_converted != name) free (alloc_name_converted); if (alloc_name_converted_translit != NULL && alloc_name_converted_translit != name) free (alloc_name_converted_translit); return name; } } #ifdef TEST1 # include int main (int argc, char *argv[]) { setlocale (LC_ALL, ""); if (mbsstr_trimmed_wordbounded (argv[1], argv[2])) printf("found\n"); return 0; } #endif #ifdef TEST2 # include # include int main (int argc, char *argv[]) { setlocale (LC_ALL, ""); printf ("%s\n", proper_name_utf8 ("Franc,ois Pinard", "Fran\303\247ois Pinard")); return 0; } #endif kbuild-3608/src/grep/lib/nl_langinfo-lock.c0000664000175000017500000001044514670377426020604 0ustar locutuslocutus/* Return the internal lock used by nl_langinfo. Copyright (C) 2019-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2019-2020. */ #include /* When it is known that the gl_get_nl_langinfo_lock function is defined by a dependency library, it should not be defined here. */ #if OMIT_NL_LANGINFO_LOCK /* This declaration is solely to ensure that after preprocessing this file is never empty. */ typedef int dummy; #else /* This file defines the internal lock used by nl_langinfo. It is a separate compilation unit, so that only one copy of it is present when linking statically. */ /* Prohibit renaming this symbol. */ # undef gl_get_nl_langinfo_lock /* Macro for exporting a symbol (function, not variable) defined in this file, when compiled into a shared library. */ # ifndef DLL_EXPORTED # if HAVE_VISIBILITY /* Override the effect of the compiler option '-fvisibility=hidden'. */ # define DLL_EXPORTED __attribute__((__visibility__("default"))) # elif defined _WIN32 || defined __CYGWIN__ # define DLL_EXPORTED __declspec(dllexport) # else # define DLL_EXPORTED # endif # endif # if defined _WIN32 && !defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # include "windows-initguard.h" /* The return type is a 'CRITICAL_SECTION *', not a 'glwthread_mutex_t *', because the latter is not guaranteed to be a stable ABI in the future. */ /* Make sure the function gets exported from DLLs. */ DLL_EXPORTED CRITICAL_SECTION *gl_get_nl_langinfo_lock (void); static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT; static CRITICAL_SECTION lock; /* Returns the internal lock used by nl_langinfo. */ CRITICAL_SECTION * gl_get_nl_langinfo_lock (void) { if (!guard.done) { if (InterlockedIncrement (&guard.started) == 0) { /* This thread is the first one to need the lock. Initialize it. */ InitializeCriticalSection (&lock); guard.done = 1; } else { /* Don't let guard.started grow and wrap around. */ InterlockedDecrement (&guard.started); /* Yield the CPU while waiting for another thread to finish initializing this mutex. */ while (!guard.done) Sleep (0); } } return &lock; } # elif HAVE_PTHREAD_API # include static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Make sure the function gets exported from shared libraries. */ DLL_EXPORTED pthread_mutex_t *gl_get_nl_langinfo_lock (void); /* Returns the internal lock used by nl_langinfo. */ pthread_mutex_t * gl_get_nl_langinfo_lock (void) { return &mutex; } # elif HAVE_THREADS_H # include # include static int volatile init_needed = 1; static once_flag init_once = ONCE_FLAG_INIT; static mtx_t mutex; static void atomic_init (void) { if (mtx_init (&mutex, mtx_plain) != thrd_success) abort (); init_needed = 0; } /* Make sure the function gets exported from shared libraries. */ DLL_EXPORTED mtx_t *gl_get_nl_langinfo_lock (void); /* Returns the internal lock used by nl_langinfo. */ mtx_t * gl_get_nl_langinfo_lock (void) { if (init_needed) call_once (&init_once, atomic_init); return &mutex; } # endif # if (defined _WIN32 || defined __CYGWIN__) && !defined _MSC_VER /* Make sure the '__declspec(dllimport)' in nl_langinfo.c does not cause a link failure when no DLLs are involved. */ # if defined _WIN64 || defined _LP64 # define IMP(x) __imp_##x # else # define IMP(x) _imp__##x # endif void * IMP(gl_get_nl_langinfo_lock) = &gl_get_nl_langinfo_lock; # endif #endif kbuild-3608/src/grep/lib/mbsrtowcs-impl.h0000664000175000017500000000714314670377425020357 0ustar locutuslocutus/* Convert string to wide string. Copyright (C) 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ size_t FUNC (DCHAR_T *dest, const char **srcp, size_t len, mbstate_t *ps) { if (ps == NULL) ps = &INTERNAL_STATE; { const char *src = *srcp; if (dest != NULL) { DCHAR_T *destptr = dest; for (; len > 0; destptr++, len--) { size_t src_avail; size_t ret; /* An optimized variant of src_avail = strnlen1 (src, MB_LEN_MAX); */ if (src[0] == '\0') src_avail = 1; else if (src[1] == '\0') src_avail = 2; else if (src[2] == '\0') src_avail = 3; else if (MB_LEN_MAX <= 4 || src[3] == '\0') src_avail = 4; else src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4); /* Parse the next multibyte character. */ ret = MBRTOWC (destptr, src, src_avail, ps); if (ret == (size_t)(-2)) /* Encountered a multibyte character that extends past a '\0' byte or that is longer than MB_LEN_MAX bytes. Cannot happen. */ abort (); if (ret == (size_t)(-1)) goto bad_input; if (ret == 0) { src = NULL; /* Here mbsinit (ps). */ break; } src += ret; } *srcp = src; return destptr - dest; } else { /* Ignore dest and len, don't store *srcp at the end, and don't clobber *ps. */ mbstate_t state = *ps; size_t totalcount = 0; for (;; totalcount++) { size_t src_avail; size_t ret; /* An optimized variant of src_avail = strnlen1 (src, MB_LEN_MAX); */ if (src[0] == '\0') src_avail = 1; else if (src[1] == '\0') src_avail = 2; else if (src[2] == '\0') src_avail = 3; else if (MB_LEN_MAX <= 4 || src[3] == '\0') src_avail = 4; else src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4); /* Parse the next multibyte character. */ ret = MBRTOWC (NULL, src, src_avail, &state); if (ret == (size_t)(-2)) /* Encountered a multibyte character that extends past a '\0' byte or that is longer than MB_LEN_MAX bytes. Cannot happen. */ abort (); if (ret == (size_t)(-1)) goto bad_input2; if (ret == 0) { /* Here mbsinit (&state). */ break; } src += ret; } return totalcount; } bad_input: *srcp = src; bad_input2: errno = EILSEQ; return (size_t)(-1); } } kbuild-3608/src/grep/lib/xbinary-io.c0000664000175000017500000000223414670377426017446 0ustar locutuslocutus/* Binary mode I/O with checking Copyright 2017-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #define XBINARY_IO_INLINE _GL_EXTERN_INLINE #include "xbinary-io.h" #include #include #include #include "exitfail.h" #include "verify.h" #include "gettext.h" #define _(msgid) gettext (msgid) #if O_BINARY _Noreturn void xset_binary_mode_error (void) { error (exit_failure, errno, _("failed to set file descriptor text/binary mode")); assume (false); } #endif kbuild-3608/src/grep/lib/fstatat.c0000664000175000017500000001121514670377423017027 0ustar locutuslocutus/* Work around an fstatat bug on Solaris 9. Copyright (C) 2006, 2009-2021 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 . */ /* Written by Paul Eggert and Jim Meyering. */ /* If the user's config.h happens to include , let it include only the system's here, so that orig_fstatat doesn't recurse to rpl_fstatat. */ #define __need_system_sys_stat_h #include /* Get the original definition of fstatat. It might be defined as a macro. */ #include #include #undef __need_system_sys_stat_h #if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG static int orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) { return fstatat (fd, filename, buf, flags); } #endif #ifdef __osf__ /* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include above. */ # include "sys/stat.h" #else # include #endif #include "stat-time.h" #include #include #include #include #if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG # ifndef LSTAT_FOLLOWS_SLASHED_SYMLINK # define LSTAT_FOLLOWS_SLASHED_SYMLINK 0 # endif static int normal_fstatat (int fd, char const *file, struct stat *st, int flag) { return stat_time_normalize (orig_fstatat (fd, file, st, flag), st); } /* fstatat should always follow symbolic links that end in /, but on Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified. Likewise, trailing slash on a non-directory should be an error. These are the same problems that lstat.c and stat.c address, so solve it in a similar way. AIX 7.1 fstatat (AT_FDCWD, ..., 0) always fails, which is a bug. Work around this bug if FSTATAT_AT_FDCWD_0_BROKEN is nonzero. */ int rpl_fstatat (int fd, char const *file, struct stat *st, int flag) { int result = normal_fstatat (fd, file, st, flag); size_t len; if (LSTAT_FOLLOWS_SLASHED_SYMLINK || result != 0) return result; len = strlen (file); if (flag & AT_SYMLINK_NOFOLLOW) { /* Fix lstat behavior. */ if (file[len - 1] != '/' || S_ISDIR (st->st_mode)) return 0; if (!S_ISLNK (st->st_mode)) { errno = ENOTDIR; return -1; } result = normal_fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW); } /* Fix stat behavior. */ if (result == 0 && !S_ISDIR (st->st_mode) && file[len - 1] == '/') { errno = ENOTDIR; return -1; } return result; } #else /* ! (HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG) */ /* On mingw, the gnulib defines 'stat' as a function-like macro; but using it in AT_FUNC_F2 causes compilation failure because the preprocessor sees a use of a macro that requires two arguments but is only given one. Hence, we need an inline forwarder to get past the preprocessor. */ static int stat_func (char const *name, struct stat *st) { return stat (name, st); } /* Likewise, if there is no native 'lstat', then the gnulib defined it as stat, which also needs adjustment. */ # if !HAVE_LSTAT # undef lstat # define lstat stat_func # endif /* Replacement for Solaris' function by the same name. First, try to simulate it via l?stat ("/proc/self/fd/FD/FILE"). Failing that, simulate it via save_cwd/fchdir/(stat|lstat)/restore_cwd. If either the save_cwd or the restore_cwd fails (relatively unlikely), then give a diagnostic and exit nonzero. Otherwise, this function works just like Solaris' fstatat. */ # define AT_FUNC_NAME fstatat # define AT_FUNC_F1 lstat # define AT_FUNC_F2 stat_func # define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW # define AT_FUNC_POST_FILE_PARAM_DECLS , struct stat *st, int flag # define AT_FUNC_POST_FILE_ARGS , st # include "at-func.c" # undef AT_FUNC_NAME # undef AT_FUNC_F1 # undef AT_FUNC_F2 # undef AT_FUNC_USE_F1_COND # undef AT_FUNC_POST_FILE_PARAM_DECLS # undef AT_FUNC_POST_FILE_ARGS #endif /* !HAVE_FSTATAT */ kbuild-3608/src/grep/lib/stdlib.in.h0000664000175000017500000015030714670377426017265 0ustar locutuslocutus/* A GNU-like . Copyright (C) 1995, 2001-2004, 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc /* Special invocation conventions inside some gnulib header files, and inside some glibc header files, respectively. */ #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_STDLIB_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ #ifndef _@GUARD_PREFIX@_STDLIB_H #define _@GUARD_PREFIX@_STDLIB_H /* NetBSD 5.0 mis-defines NULL. */ #include /* MirBSD 10 defines WEXITSTATUS in , not in . */ #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS # include #endif /* Solaris declares getloadavg() in . */ #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ /* OpenIndiana has a bug: must be included before . */ # include # include #endif /* Native Windows platforms declare _mktemp() in . */ #if defined _WIN32 && !defined __CYGWIN__ # include #endif #if @GNULIB_RANDOM_R@ /* OSF/1 5.1 declares 'struct random_data' in , which is included from if _REENTRANT is defined. Include it whenever we need 'struct random_data'. */ # if @HAVE_RANDOM_H@ # include # endif # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ # include # endif # if !@HAVE_STRUCT_RANDOM_DATA@ /* Define 'struct random_data'. But allow multiple gnulib generated replacements to coexist. */ # if !GNULIB_defined_struct_random_data struct random_data { int32_t *fptr; /* Front pointer. */ int32_t *rptr; /* Rear pointer. */ int32_t *state; /* Array of state values. */ int rand_type; /* Type of random number generator. */ int rand_deg; /* Degree of random number generator. */ int rand_sep; /* Distance between front and rear. */ int32_t *end_ptr; /* Pointer behind state table. */ }; # define GNULIB_defined_struct_random_data 1 # endif # endif #endif #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__) /* On Mac OS X 10.3, only declares mkstemp. */ /* On Mac OS X 10.5, only declares mkstemps. */ /* On Mac OS X 10.13, only declares mkostemp and mkostemps. */ /* On Cygwin 1.7.1, only declares getsubopt. */ /* But avoid namespace pollution on glibc systems and native Windows. */ # include #endif /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ #ifndef _GL_ATTRIBUTE_PURE # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define _GL_ATTRIBUTE_PURE /* empty */ # endif #endif /* The definition of _Noreturn is copied here. */ /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Some systems do not define EXIT_*, despite otherwise supporting C89. */ #ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 #endif /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere with proper operation of xargs. */ #ifndef EXIT_FAILURE # define EXIT_FAILURE 1 #elif EXIT_FAILURE != 1 # undef EXIT_FAILURE # define EXIT_FAILURE 1 #endif #if @GNULIB__EXIT@ /* Terminate the current process with the given return code, without running the 'atexit' handlers. */ # if !@HAVE__EXIT@ _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); # endif _GL_CXXALIAS_SYS (_Exit, void, (int status)); _GL_CXXALIASWARN (_Exit); #elif defined GNULIB_POSIXCHECK # undef _Exit # if HAVE_RAW_DECL__EXIT _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " "use gnulib module _Exit for portability"); # endif #endif #if @GNULIB_FREE_POSIX@ # if @REPLACE_FREE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef free # define free rpl_free # endif _GL_FUNCDECL_RPL (free, void, (void *ptr)); _GL_CXXALIAS_RPL (free, void, (void *ptr)); # else _GL_CXXALIAS_SYS (free, void, (void *ptr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (free); # endif #elif defined GNULIB_POSIXCHECK # undef free /* Assume free is always declared. */ _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " "use gnulib module free for portability"); #endif /* Allocate memory with indefinite extent and specified alignment. */ #if @GNULIB_ALIGNED_ALLOC@ # if @REPLACE_ALIGNED_ALLOC@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef aligned_alloc # define aligned_alloc rpl_aligned_alloc # endif _GL_FUNCDECL_RPL (aligned_alloc, void *, (size_t alignment, size_t size) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); # else # if @HAVE_ALIGNED_ALLOC@ # if __GNUC__ >= 11 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ _GL_FUNCDECL_SYS (aligned_alloc, void *, (size_t alignment, size_t size) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); # endif # endif # if @HAVE_ALIGNED_ALLOC@ _GL_CXXALIASWARN (aligned_alloc); # endif #else # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ _GL_FUNCDECL_SYS (aligned_alloc, void *, (size_t alignment, size_t size) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # if defined GNULIB_POSIXCHECK # undef aligned_alloc # if HAVE_RAW_DECL_ALIGNED_ALLOC _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " "use gnulib module aligned_alloc for portability"); # endif # endif #endif #if @GNULIB_ATOLL@ /* Parse a signed decimal integer. Returns the value of the integer. Errors are not detected. */ # if !@HAVE_ATOLL@ _GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); _GL_CXXALIASWARN (atoll); #elif defined GNULIB_POSIXCHECK # undef atoll # if HAVE_RAW_DECL_ATOLL _GL_WARN_ON_USE (atoll, "atoll is unportable - " "use gnulib module atoll for portability"); # endif #endif #if @GNULIB_CALLOC_POSIX@ # if @REPLACE_CALLOC@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef calloc # define calloc rpl_calloc # endif _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); # else # if __GNUC__ >= 11 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ _GL_FUNCDECL_SYS (calloc, void *, (size_t nmemb, size_t size) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (calloc); # endif #else # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ _GL_FUNCDECL_SYS (calloc, void *, (size_t nmemb, size_t size) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # if defined GNULIB_POSIXCHECK # undef calloc /* Assume calloc is always declared. */ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " "use gnulib module calloc-posix for portability"); # endif #endif #if @GNULIB_CANONICALIZE_FILE_NAME@ # if @REPLACE_CANONICALIZE_FILE_NAME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define canonicalize_file_name rpl_canonicalize_file_name # endif _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); # else # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); # endif # ifndef GNULIB_defined_canonicalize_file_name # define GNULIB_defined_canonicalize_file_name \ (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@) # endif _GL_CXXALIASWARN (canonicalize_file_name); #else # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or rpl_free. */ _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # if defined GNULIB_POSIXCHECK # undef canonicalize_file_name # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME _GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - " "use gnulib module canonicalize-lgpl for portability"); # endif # endif #endif #if @GNULIB_MDA_ECVT@ /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have it. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ecvt # define ecvt _ecvt # endif _GL_CXXALIAS_MDA (ecvt, char *, (double number, int ndigits, int *decptp, int *signp)); # else # if @HAVE_DECL_ECVT@ _GL_CXXALIAS_SYS (ecvt, char *, (double number, int ndigits, int *decptp, int *signp)); # endif # endif # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@ _GL_CXXALIASWARN (ecvt); # endif #endif #if @GNULIB_MDA_FCVT@ /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have it. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fcvt # define fcvt _fcvt # endif _GL_CXXALIAS_MDA (fcvt, char *, (double number, int ndigits, int *decptp, int *signp)); # else # if @HAVE_DECL_FCVT@ _GL_CXXALIAS_SYS (fcvt, char *, (double number, int ndigits, int *decptp, int *signp)); # endif # endif # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@ _GL_CXXALIASWARN (fcvt); # endif #endif #if @GNULIB_MDA_GCVT@ /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have it. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gcvt # define gcvt _gcvt # endif _GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf)); # else # if @HAVE_DECL_GCVT@ _GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf)); # endif # endif # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@ _GL_CXXALIASWARN (gcvt); # endif #endif #if @GNULIB_GETLOADAVG@ /* Store max(NELEM,3) load average numbers in LOADAVG[]. The three numbers are the load average of the last 1 minute, the last 5 minutes, and the last 15 minutes, respectively. LOADAVG is an array of NELEM numbers. */ # if !@HAVE_DECL_GETLOADAVG@ _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); _GL_CXXALIASWARN (getloadavg); #elif defined GNULIB_POSIXCHECK # undef getloadavg # if HAVE_RAW_DECL_GETLOADAVG _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " "use gnulib module getloadavg for portability"); # endif #endif #if @GNULIB_GETSUBOPT@ /* Assuming *OPTIONP is a comma separated list of elements of the form "token" or "token=value", getsubopt parses the first of these elements. If the first element refers to a "token" that is member of the given NULL-terminated array of tokens: - It replaces the comma with a NUL byte, updates *OPTIONP to point past the first option and the comma, sets *VALUEP to the value of the element (or NULL if it doesn't contain an "=" sign), - It returns the index of the "token" in the given array of tokens. Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. For more details see the POSIX specification. https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ # if !@HAVE_GETSUBOPT@ _GL_FUNCDECL_SYS (getsubopt, int, (char **optionp, char *const *tokens, char **valuep) _GL_ARG_NONNULL ((1, 2, 3))); # endif _GL_CXXALIAS_SYS (getsubopt, int, (char **optionp, char *const *tokens, char **valuep)); _GL_CXXALIASWARN (getsubopt); #elif defined GNULIB_POSIXCHECK # undef getsubopt # if HAVE_RAW_DECL_GETSUBOPT _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " "use gnulib module getsubopt for portability"); # endif #endif #if @GNULIB_GRANTPT@ /* Change the ownership and access permission of the slave side of the pseudo-terminal whose master side is specified by FD. */ # if !@HAVE_GRANTPT@ _GL_FUNCDECL_SYS (grantpt, int, (int fd)); # endif _GL_CXXALIAS_SYS (grantpt, int, (int fd)); _GL_CXXALIASWARN (grantpt); #elif defined GNULIB_POSIXCHECK # undef grantpt # if HAVE_RAW_DECL_GRANTPT _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " "use gnulib module grantpt for portability"); # endif #endif /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not rely on GNU or POSIX semantics for malloc and realloc (for example, by never specifying a zero size), so it does not need malloc or realloc to be redefined. */ #if @GNULIB_MALLOC_POSIX@ # if @REPLACE_MALLOC@ # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ || _GL_USE_STDLIB_ALLOC) # undef malloc # define malloc rpl_malloc # endif _GL_FUNCDECL_RPL (malloc, void *, (size_t size) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); # else # if __GNUC__ >= 11 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ _GL_FUNCDECL_SYS (malloc, void *, (size_t size) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (malloc); # endif #else # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ _GL_FUNCDECL_SYS (malloc, void *, (size_t size) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC # undef malloc /* Assume malloc is always declared. */ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " "use gnulib module malloc-posix for portability"); # endif #endif /* Convert a multibyte character to a wide character. */ #if @GNULIB_MBTOWC@ # if @REPLACE_MBTOWC@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mbtowc # define mbtowc rpl_mbtowc # endif _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *restrict pwc, const char *restrict s, size_t n)); _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *restrict pwc, const char *restrict s, size_t n)); # else # if !@HAVE_MBTOWC@ _GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *restrict pwc, const char *restrict s, size_t n)); # endif _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *restrict pwc, const char *restrict s, size_t n)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbtowc); # endif #elif defined GNULIB_POSIXCHECK # undef mbtowc # if HAVE_RAW_DECL_MBTOWC _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " "use gnulib module mbtowc for portability"); # endif #endif #if @GNULIB_MKDTEMP@ /* Create a unique temporary directory from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the directory name unique. Returns TEMPLATE, or a null pointer if it cannot get a unique name. The directory is created mode 700. */ # if !@HAVE_MKDTEMP@ _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); _GL_CXXALIASWARN (mkdtemp); #elif defined GNULIB_POSIXCHECK # undef mkdtemp # if HAVE_RAW_DECL_MKDTEMP _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " "use gnulib module mkdtemp for portability"); # endif #endif #if @GNULIB_MKOSTEMP@ /* Create a unique temporary file from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the file name unique. The flags are a bitmask, possibly including O_CLOEXEC (defined in ) and O_TEXT, O_BINARY (defined in "binary-io.h"). The file is then created, with the specified flags, ensuring it didn't exist before. The file is created read-write (mask at least 0600 & ~umask), but it may be world-readable and world-writable (mask 0666 & ~umask), depending on the implementation. Returns the open file descriptor if successful, otherwise -1 and errno set. */ # if !@HAVE_MKOSTEMP@ _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); _GL_CXXALIASWARN (mkostemp); #elif defined GNULIB_POSIXCHECK # undef mkostemp # if HAVE_RAW_DECL_MKOSTEMP _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " "use gnulib module mkostemp for portability"); # endif #endif #if @GNULIB_MKOSTEMPS@ /* Create a unique temporary file from TEMPLATE. The last six characters of TEMPLATE before a suffix of length SUFFIXLEN must be "XXXXXX"; they are replaced with a string that makes the file name unique. The flags are a bitmask, possibly including O_CLOEXEC (defined in ) and O_TEXT, O_BINARY (defined in "binary-io.h"). The file is then created, with the specified flags, ensuring it didn't exist before. The file is created read-write (mask at least 0600 & ~umask), but it may be world-readable and world-writable (mask 0666 & ~umask), depending on the implementation. Returns the open file descriptor if successful, otherwise -1 and errno set. */ # if !@HAVE_MKOSTEMPS@ _GL_FUNCDECL_SYS (mkostemps, int, (char * /*template*/, int /*suffixlen*/, int /*flags*/) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (mkostemps, int, (char * /*template*/, int /*suffixlen*/, int /*flags*/)); _GL_CXXALIASWARN (mkostemps); #elif defined GNULIB_POSIXCHECK # undef mkostemps # if HAVE_RAW_DECL_MKOSTEMPS _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " "use gnulib module mkostemps for portability"); # endif #endif #if @GNULIB_MKSTEMP@ /* Create a unique temporary file from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the file name unique. The file is then created, ensuring it didn't exist before. The file is created read-write (mask at least 0600 & ~umask), but it may be world-readable and world-writable (mask 0666 & ~umask), depending on the implementation. Returns the open file descriptor if successful, otherwise -1 and errno set. */ # if @REPLACE_MKSTEMP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mkstemp rpl_mkstemp # endif _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); # else # if ! @HAVE_MKSTEMP@ _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); # endif _GL_CXXALIASWARN (mkstemp); #elif defined GNULIB_POSIXCHECK # undef mkstemp # if HAVE_RAW_DECL_MKSTEMP _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " "use gnulib module mkstemp for portability"); # endif #endif #if @GNULIB_MKSTEMPS@ /* Create a unique temporary file from TEMPLATE. The last six characters of TEMPLATE prior to a suffix of length SUFFIXLEN must be "XXXXXX"; they are replaced with a string that makes the file name unique. The file is then created, ensuring it didn't exist before. The file is created read-write (mask at least 0600 & ~umask), but it may be world-readable and world-writable (mask 0666 & ~umask), depending on the implementation. Returns the open file descriptor if successful, otherwise -1 and errno set. */ # if !@HAVE_MKSTEMPS@ _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); _GL_CXXALIASWARN (mkstemps); #elif defined GNULIB_POSIXCHECK # undef mkstemps # if HAVE_RAW_DECL_MKSTEMPS _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " "use gnulib module mkstemps for portability"); # endif #endif #if @GNULIB_MDA_MKTEMP@ /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::mktemp always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mktemp # define mktemp _mktemp # endif _GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/)); # else _GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/)); # endif _GL_CXXALIASWARN (mktemp); #endif /* Allocate memory with indefinite extent and specified alignment. */ #if @GNULIB_POSIX_MEMALIGN@ # if @REPLACE_POSIX_MEMALIGN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef posix_memalign # define posix_memalign rpl_posix_memalign # endif _GL_FUNCDECL_RPL (posix_memalign, int, (void **memptr, size_t alignment, size_t size) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (posix_memalign, int, (void **memptr, size_t alignment, size_t size)); # else # if @HAVE_POSIX_MEMALIGN@ _GL_CXXALIAS_SYS (posix_memalign, int, (void **memptr, size_t alignment, size_t size)); # endif # endif # if @HAVE_POSIX_MEMALIGN@ _GL_CXXALIASWARN (posix_memalign); # endif #elif defined GNULIB_POSIXCHECK # undef posix_memalign # if HAVE_RAW_DECL_POSIX_MEMALIGN _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " "use gnulib module posix_memalign for portability"); # endif #endif #if @GNULIB_POSIX_OPENPT@ /* Return an FD open to the master side of a pseudo-terminal. Flags should include O_RDWR, and may also include O_NOCTTY. */ # if !@HAVE_POSIX_OPENPT@ _GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); # endif _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); _GL_CXXALIASWARN (posix_openpt); #elif defined GNULIB_POSIXCHECK # undef posix_openpt # if HAVE_RAW_DECL_POSIX_OPENPT _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " "use gnulib module posix_openpt for portability"); # endif #endif #if @GNULIB_PTSNAME@ /* Return the pathname of the pseudo-terminal slave associated with the master FD is open on, or NULL on errors. */ # if @REPLACE_PTSNAME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ptsname # define ptsname rpl_ptsname # endif _GL_FUNCDECL_RPL (ptsname, char *, (int fd)); _GL_CXXALIAS_RPL (ptsname, char *, (int fd)); # else # if !@HAVE_PTSNAME@ _GL_FUNCDECL_SYS (ptsname, char *, (int fd)); # endif _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); # endif _GL_CXXALIASWARN (ptsname); #elif defined GNULIB_POSIXCHECK # undef ptsname # if HAVE_RAW_DECL_PTSNAME _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " "use gnulib module ptsname for portability"); # endif #endif #if @GNULIB_PTSNAME_R@ /* Set the pathname of the pseudo-terminal slave associated with the master FD is open on and return 0, or set errno and return non-zero on errors. */ # if @REPLACE_PTSNAME_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ptsname_r # define ptsname_r rpl_ptsname_r # endif _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); # else # if !@HAVE_PTSNAME_R@ _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); # endif _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); # endif # ifndef GNULIB_defined_ptsname_r # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@) # endif _GL_CXXALIASWARN (ptsname_r); #elif defined GNULIB_POSIXCHECK # undef ptsname_r # if HAVE_RAW_DECL_PTSNAME_R _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " "use gnulib module ptsname_r for portability"); # endif #endif #if @GNULIB_PUTENV@ # if @REPLACE_PUTENV@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putenv # define putenv rpl_putenv # endif _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (putenv, int, (char *string)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putenv # define putenv _putenv # endif _GL_CXXALIAS_MDA (putenv, int, (char *string)); # else _GL_CXXALIAS_SYS (putenv, int, (char *string)); # endif _GL_CXXALIASWARN (putenv); #elif @GNULIB_MDA_PUTENV@ /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::putenv always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putenv # define putenv _putenv # endif /* Need to cast, because on mingw, the parameter is either 'const char *string' or 'char *string'. */ _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string)); # else _GL_CXXALIAS_SYS (putenv, int, (char *string)); # endif _GL_CXXALIASWARN (putenv); #endif #if @GNULIB_QSORT_R@ /* Sort an array of NMEMB elements, starting at address BASE, each element occupying SIZE bytes, in ascending order according to the comparison function COMPARE. */ # if @REPLACE_QSORT_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef qsort_r # define qsort_r rpl_qsort_r # endif _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, int (*compare) (void const *, void const *, void *), void *arg) _GL_ARG_NONNULL ((1, 4))); _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, int (*compare) (void const *, void const *, void *), void *arg)); # else # if !@HAVE_QSORT_R@ _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, int (*compare) (void const *, void const *, void *), void *arg) _GL_ARG_NONNULL ((1, 4))); # endif _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, int (*compare) (void const *, void const *, void *), void *arg)); # endif _GL_CXXALIASWARN (qsort_r); #elif defined GNULIB_POSIXCHECK # undef qsort_r # if HAVE_RAW_DECL_QSORT_R _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " "use gnulib module qsort_r for portability"); # endif #endif #if @GNULIB_RANDOM_R@ # if !@HAVE_RANDOM_R@ # ifndef RAND_MAX # define RAND_MAX 2147483647 # endif # endif #endif #if @GNULIB_RANDOM@ # if @REPLACE_RANDOM@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef random # define random rpl_random # endif _GL_FUNCDECL_RPL (random, long, (void)); _GL_CXXALIAS_RPL (random, long, (void)); # else # if !@HAVE_RANDOM@ _GL_FUNCDECL_SYS (random, long, (void)); # endif /* Need to cast, because on Haiku, the return type is int. */ _GL_CXXALIAS_SYS_CAST (random, long, (void)); # endif _GL_CXXALIASWARN (random); #elif defined GNULIB_POSIXCHECK # undef random # if HAVE_RAW_DECL_RANDOM _GL_WARN_ON_USE (random, "random is unportable - " "use gnulib module random for portability"); # endif #endif #if @GNULIB_RANDOM@ # if @REPLACE_RANDOM@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef srandom # define srandom rpl_srandom # endif _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); # else # if !@HAVE_RANDOM@ _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); # endif /* Need to cast, because on FreeBSD, the first parameter is unsigned long seed. */ _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); # endif _GL_CXXALIASWARN (srandom); #elif defined GNULIB_POSIXCHECK # undef srandom # if HAVE_RAW_DECL_SRANDOM _GL_WARN_ON_USE (srandom, "srandom is unportable - " "use gnulib module random for portability"); # endif #endif #if @GNULIB_RANDOM@ # if @REPLACE_INITSTATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef initstate # define initstate rpl_initstate # endif _GL_FUNCDECL_RPL (initstate, char *, (unsigned int seed, char *buf, size_t buf_size) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (initstate, char *, (unsigned int seed, char *buf, size_t buf_size)); # else # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ _GL_FUNCDECL_SYS (initstate, char *, (unsigned int seed, char *buf, size_t buf_size) _GL_ARG_NONNULL ((2))); # endif /* Need to cast, because on FreeBSD, the first parameter is unsigned long seed. */ _GL_CXXALIAS_SYS_CAST (initstate, char *, (unsigned int seed, char *buf, size_t buf_size)); # endif _GL_CXXALIASWARN (initstate); #elif defined GNULIB_POSIXCHECK # undef initstate # if HAVE_RAW_DECL_INITSTATE _GL_WARN_ON_USE (initstate, "initstate is unportable - " "use gnulib module random for portability"); # endif #endif #if @GNULIB_RANDOM@ # if @REPLACE_SETSTATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef setstate # define setstate rpl_setstate # endif _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); # else # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); # endif /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter is const char *arg_state. */ _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); # endif _GL_CXXALIASWARN (setstate); #elif defined GNULIB_POSIXCHECK # undef setstate # if HAVE_RAW_DECL_SETSTATE _GL_WARN_ON_USE (setstate, "setstate is unportable - " "use gnulib module random for portability"); # endif #endif #if @GNULIB_RANDOM_R@ # if @REPLACE_RANDOM_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef random_r # define random_r rpl_random_r # endif _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); # else # if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); # endif _GL_CXXALIASWARN (random_r); #elif defined GNULIB_POSIXCHECK # undef random_r # if HAVE_RAW_DECL_RANDOM_R _GL_WARN_ON_USE (random_r, "random_r is unportable - " "use gnulib module random_r for portability"); # endif #endif #if @GNULIB_RANDOM_R@ # if @REPLACE_RANDOM_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef srandom_r # define srandom_r rpl_srandom_r # endif _GL_FUNCDECL_RPL (srandom_r, int, (unsigned int seed, struct random_data *rand_state) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (srandom_r, int, (unsigned int seed, struct random_data *rand_state)); # else # if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (srandom_r, int, (unsigned int seed, struct random_data *rand_state) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (srandom_r, int, (unsigned int seed, struct random_data *rand_state)); # endif _GL_CXXALIASWARN (srandom_r); #elif defined GNULIB_POSIXCHECK # undef srandom_r # if HAVE_RAW_DECL_SRANDOM_R _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " "use gnulib module random_r for portability"); # endif #endif #if @GNULIB_RANDOM_R@ # if @REPLACE_RANDOM_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef initstate_r # define initstate_r rpl_initstate_r # endif _GL_FUNCDECL_RPL (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, struct random_data *rand_state) _GL_ARG_NONNULL ((2, 4))); _GL_CXXALIAS_RPL (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, struct random_data *rand_state)); # else # if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, struct random_data *rand_state) _GL_ARG_NONNULL ((2, 4))); # endif /* Need to cast, because on Haiku, the third parameter is unsigned long buf_size. */ _GL_CXXALIAS_SYS_CAST (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, struct random_data *rand_state)); # endif _GL_CXXALIASWARN (initstate_r); #elif defined GNULIB_POSIXCHECK # undef initstate_r # if HAVE_RAW_DECL_INITSTATE_R _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " "use gnulib module random_r for portability"); # endif #endif #if @GNULIB_RANDOM_R@ # if @REPLACE_RANDOM_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef setstate_r # define setstate_r rpl_setstate_r # endif _GL_FUNCDECL_RPL (setstate_r, int, (char *arg_state, struct random_data *rand_state) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (setstate_r, int, (char *arg_state, struct random_data *rand_state)); # else # if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (setstate_r, int, (char *arg_state, struct random_data *rand_state) _GL_ARG_NONNULL ((1, 2))); # endif /* Need to cast, because on Haiku, the first parameter is void *arg_state. */ _GL_CXXALIAS_SYS_CAST (setstate_r, int, (char *arg_state, struct random_data *rand_state)); # endif _GL_CXXALIASWARN (setstate_r); #elif defined GNULIB_POSIXCHECK # undef setstate_r # if HAVE_RAW_DECL_SETSTATE_R _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " "use gnulib module random_r for portability"); # endif #endif #if @GNULIB_REALLOC_POSIX@ # if @REPLACE_REALLOC@ # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ || _GL_USE_STDLIB_ALLOC) # undef realloc # define realloc rpl_realloc # endif _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); # else # if __GNUC__ >= 11 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) _GL_ATTRIBUTE_DEALLOC_FREE); # endif _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (realloc); # endif #else # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) _GL_ATTRIBUTE_DEALLOC_FREE); # endif # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC # undef realloc /* Assume realloc is always declared. */ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " "use gnulib module realloc-posix for portability"); # endif #endif #if @GNULIB_REALLOCARRAY@ # if @REPLACE_REALLOCARRAY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef reallocarray # define reallocarray rpl_reallocarray # endif _GL_FUNCDECL_RPL (reallocarray, void *, (void *ptr, size_t nmemb, size_t size)); _GL_CXXALIAS_RPL (reallocarray, void *, (void *ptr, size_t nmemb, size_t size)); # else # if ! @HAVE_REALLOCARRAY@ _GL_FUNCDECL_SYS (reallocarray, void *, (void *ptr, size_t nmemb, size_t size)); # endif _GL_CXXALIAS_SYS (reallocarray, void *, (void *ptr, size_t nmemb, size_t size)); # endif _GL_CXXALIASWARN (reallocarray); #elif defined GNULIB_POSIXCHECK # undef reallocarray # if HAVE_RAW_DECL_REALLOCARRAY _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " "use gnulib module reallocarray for portability"); # endif #endif #if @GNULIB_REALPATH@ # if @REPLACE_REALPATH@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define realpath rpl_realpath # endif _GL_FUNCDECL_RPL (realpath, char *, (const char *restrict name, char *restrict resolved) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (realpath, char *, (const char *restrict name, char *restrict resolved)); # else # if !@HAVE_REALPATH@ _GL_FUNCDECL_SYS (realpath, char *, (const char *restrict name, char *restrict resolved) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (realpath, char *, (const char *restrict name, char *restrict resolved)); # endif _GL_CXXALIASWARN (realpath); #elif defined GNULIB_POSIXCHECK # undef realpath # if HAVE_RAW_DECL_REALPATH _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " "canonicalize or canonicalize-lgpl for portability"); # endif #endif #if @GNULIB_RPMATCH@ /* Test a user response to a question. Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ # if !@HAVE_RPMATCH@ _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); _GL_CXXALIASWARN (rpmatch); #elif defined GNULIB_POSIXCHECK # undef rpmatch # if HAVE_RAW_DECL_RPMATCH _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " "use gnulib module rpmatch for portability"); # endif #endif #if @GNULIB_SECURE_GETENV@ /* Look up NAME in the environment, returning 0 in insecure situations. */ # if !@HAVE_SECURE_GETENV@ _GL_FUNCDECL_SYS (secure_getenv, char *, (char const *name) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); _GL_CXXALIASWARN (secure_getenv); #elif defined GNULIB_POSIXCHECK # undef secure_getenv # if HAVE_RAW_DECL_SECURE_GETENV _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " "use gnulib module secure_getenv for portability"); # endif #endif #if @GNULIB_SETENV@ /* Set NAME to VALUE in the environment. If REPLACE is nonzero, overwrite an existing value. */ # if @REPLACE_SETENV@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef setenv # define setenv rpl_setenv # endif _GL_FUNCDECL_RPL (setenv, int, (const char *name, const char *value, int replace) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (setenv, int, (const char *name, const char *value, int replace)); # else # if !@HAVE_DECL_SETENV@ _GL_FUNCDECL_SYS (setenv, int, (const char *name, const char *value, int replace) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (setenv, int, (const char *name, const char *value, int replace)); # endif # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@) _GL_CXXALIASWARN (setenv); # endif #elif defined GNULIB_POSIXCHECK # undef setenv # if HAVE_RAW_DECL_SETENV _GL_WARN_ON_USE (setenv, "setenv is unportable - " "use gnulib module setenv for portability"); # endif #endif #if @GNULIB_STRTOD@ /* Parse a double from STRING, updating ENDP if appropriate. */ # if @REPLACE_STRTOD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strtod rpl_strtod # endif # define GNULIB_defined_strtod_function 1 _GL_FUNCDECL_RPL (strtod, double, (const char *restrict str, char **restrict endp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtod, double, (const char *restrict str, char **restrict endp)); # else # if !@HAVE_STRTOD@ _GL_FUNCDECL_SYS (strtod, double, (const char *restrict str, char **restrict endp) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtod, double, (const char *restrict str, char **restrict endp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (strtod); # endif #elif defined GNULIB_POSIXCHECK # undef strtod # if HAVE_RAW_DECL_STRTOD _GL_WARN_ON_USE (strtod, "strtod is unportable - " "use gnulib module strtod for portability"); # endif #endif #if @GNULIB_STRTOLD@ /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ # if @REPLACE_STRTOLD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strtold rpl_strtold # endif # define GNULIB_defined_strtold_function 1 _GL_FUNCDECL_RPL (strtold, long double, (const char *restrict str, char **restrict endp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtold, long double, (const char *restrict str, char **restrict endp)); # else # if !@HAVE_STRTOLD@ _GL_FUNCDECL_SYS (strtold, long double, (const char *restrict str, char **restrict endp) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtold, long double, (const char *restrict str, char **restrict endp)); # endif _GL_CXXALIASWARN (strtold); #elif defined GNULIB_POSIXCHECK # undef strtold # if HAVE_RAW_DECL_STRTOLD _GL_WARN_ON_USE (strtold, "strtold is unportable - " "use gnulib module strtold for portability"); # endif #endif #if @GNULIB_STRTOL@ /* Parse a signed integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, it may be decimal or octal (with prefix "0") or hexadecimal (with prefix "0x"). If ENDPTR is not NULL, the address of the first byte after the integer is stored in *ENDPTR. Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set to ERANGE. */ # if @REPLACE_STRTOL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strtol rpl_strtol # endif # define GNULIB_defined_strtol_function 1 _GL_FUNCDECL_RPL (strtol, long, (const char *restrict string, char **restrict endptr, int base) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtol, long, (const char *restrict string, char **restrict endptr, int base)); # else # if !@HAVE_STRTOL@ _GL_FUNCDECL_SYS (strtol, long, (const char *restrict string, char **restrict endptr, int base) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtol, long, (const char *restrict string, char **restrict endptr, int base)); # endif _GL_CXXALIASWARN (strtol); #elif defined GNULIB_POSIXCHECK # undef strtol # if HAVE_RAW_DECL_STRTOL _GL_WARN_ON_USE (strtol, "strtol is unportable - " "use gnulib module strtol for portability"); # endif #endif #if @GNULIB_STRTOLL@ /* Parse a signed integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, it may be decimal or octal (with prefix "0") or hexadecimal (with prefix "0x"). If ENDPTR is not NULL, the address of the first byte after the integer is stored in *ENDPTR. Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set to ERANGE. */ # if @REPLACE_STRTOLL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strtoll rpl_strtoll # endif # define GNULIB_defined_strtoll_function 1 _GL_FUNCDECL_RPL (strtoll, long long, (const char *restrict string, char **restrict endptr, int base) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtoll, long long, (const char *restrict string, char **restrict endptr, int base)); # else # if !@HAVE_STRTOLL@ _GL_FUNCDECL_SYS (strtoll, long long, (const char *restrict string, char **restrict endptr, int base) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoll, long long, (const char *restrict string, char **restrict endptr, int base)); # endif _GL_CXXALIASWARN (strtoll); #elif defined GNULIB_POSIXCHECK # undef strtoll # if HAVE_RAW_DECL_STRTOLL _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " "use gnulib module strtoll for portability"); # endif #endif #if @GNULIB_STRTOUL@ /* Parse an unsigned integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, it may be decimal or octal (with prefix "0") or hexadecimal (with prefix "0x"). If ENDPTR is not NULL, the address of the first byte after the integer is stored in *ENDPTR. Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */ # if @REPLACE_STRTOUL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strtoul rpl_strtoul # endif # define GNULIB_defined_strtoul_function 1 _GL_FUNCDECL_RPL (strtoul, unsigned long, (const char *restrict string, char **restrict endptr, int base) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtoul, unsigned long, (const char *restrict string, char **restrict endptr, int base)); # else # if !@HAVE_STRTOUL@ _GL_FUNCDECL_SYS (strtoul, unsigned long, (const char *restrict string, char **restrict endptr, int base) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoul, unsigned long, (const char *restrict string, char **restrict endptr, int base)); # endif _GL_CXXALIASWARN (strtoul); #elif defined GNULIB_POSIXCHECK # undef strtoul # if HAVE_RAW_DECL_STRTOUL _GL_WARN_ON_USE (strtoul, "strtoul is unportable - " "use gnulib module strtoul for portability"); # endif #endif #if @GNULIB_STRTOULL@ /* Parse an unsigned integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, it may be decimal or octal (with prefix "0") or hexadecimal (with prefix "0x"). If ENDPTR is not NULL, the address of the first byte after the integer is stored in *ENDPTR. Upon overflow, the return value is ULLONG_MAX, and errno is set to ERANGE. */ # if @REPLACE_STRTOULL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strtoull rpl_strtoull # endif # define GNULIB_defined_strtoull_function 1 _GL_FUNCDECL_RPL (strtoull, unsigned long long, (const char *restrict string, char **restrict endptr, int base) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtoull, unsigned long long, (const char *restrict string, char **restrict endptr, int base)); # else # if !@HAVE_STRTOULL@ _GL_FUNCDECL_SYS (strtoull, unsigned long long, (const char *restrict string, char **restrict endptr, int base) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoull, unsigned long long, (const char *restrict string, char **restrict endptr, int base)); # endif _GL_CXXALIASWARN (strtoull); #elif defined GNULIB_POSIXCHECK # undef strtoull # if HAVE_RAW_DECL_STRTOULL _GL_WARN_ON_USE (strtoull, "strtoull is unportable - " "use gnulib module strtoull for portability"); # endif #endif #if @GNULIB_UNLOCKPT@ /* Unlock the slave side of the pseudo-terminal whose master side is specified by FD, so that it can be opened. */ # if !@HAVE_UNLOCKPT@ _GL_FUNCDECL_SYS (unlockpt, int, (int fd)); # endif _GL_CXXALIAS_SYS (unlockpt, int, (int fd)); _GL_CXXALIASWARN (unlockpt); #elif defined GNULIB_POSIXCHECK # undef unlockpt # if HAVE_RAW_DECL_UNLOCKPT _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " "use gnulib module unlockpt for portability"); # endif #endif #if @GNULIB_UNSETENV@ /* Remove the variable NAME from the environment. */ # if @REPLACE_UNSETENV@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef unsetenv # define unsetenv rpl_unsetenv # endif _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); # else # if !@HAVE_DECL_UNSETENV@ _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); # endif # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@) _GL_CXXALIASWARN (unsetenv); # endif #elif defined GNULIB_POSIXCHECK # undef unsetenv # if HAVE_RAW_DECL_UNSETENV _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " "use gnulib module unsetenv for portability"); # endif #endif /* Convert a wide character to a multibyte character. */ #if @GNULIB_WCTOMB@ # if @REPLACE_WCTOMB@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wctomb # define wctomb rpl_wctomb # endif _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); # else _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wctomb); # endif #endif #endif /* _@GUARD_PREFIX@_STDLIB_H */ #endif /* _@GUARD_PREFIX@_STDLIB_H */ #endif kbuild-3608/src/grep/lib/wctob.c0000664000175000017500000000230414670377426016501 0ustar locutuslocutus/* Convert wide character to unibyte character. Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include int wctob (wint_t wc) { char buf[64]; if (!(MB_CUR_MAX <= sizeof (buf))) abort (); /* Handle the case where WEOF is a value that does not fit in a wchar_t. */ if (wc == (wchar_t)wc) if (wctomb (buf, (wchar_t)wc) == 1) return (unsigned char) buf[0]; return EOF; } kbuild-3608/src/grep/lib/strnlen.c0000664000175000017500000000222614670377426017053 0ustar locutuslocutus/* Find the length of STRING, but scan at most MAXLEN characters. Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. Written by Simon Josefsson. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include /* Find the length of STRING, but scan at most MAXLEN characters. If no '\0' terminator is found in that many characters, return MAXLEN. */ size_t strnlen (const char *string, size_t maxlen) { const char *end = memchr (string, '\0', maxlen); return end ? (size_t) (end - string) : maxlen; } kbuild-3608/src/grep/lib/strtol.c0000664000175000017500000002374014670377426016721 0ustar locutuslocutus/* Convert string representation of a number into an integer value. Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2021 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifdef _LIBC # define USE_NUMBER_GROUPING #else # include #endif #include #include #ifndef __set_errno # define __set_errno(Val) errno = (Val) #endif #include #include #include #include #ifdef USE_NUMBER_GROUPING # include "../locale/localeinfo.h" #endif /* Nonzero if we are defining 'strtoul' or 'strtoull', operating on unsigned integers. */ #ifndef UNSIGNED # define UNSIGNED 0 # define INT LONG int #else # define INT unsigned LONG int #endif /* Determine the name. */ #ifdef USE_IN_EXTENDED_LOCALE_MODEL # undef strtol # if UNSIGNED # ifdef USE_WIDE_CHAR # ifdef QUAD # define strtol __wcstoull_l # else # define strtol __wcstoul_l # endif # else # ifdef QUAD # define strtol __strtoull_l # else # define strtol __strtoul_l # endif # endif # else # ifdef USE_WIDE_CHAR # ifdef QUAD # define strtol __wcstoll_l # else # define strtol __wcstol_l # endif # else # ifdef QUAD # define strtol __strtoll_l # else # define strtol __strtol_l # endif # endif # endif #else # if UNSIGNED # undef strtol # ifdef USE_WIDE_CHAR # ifdef QUAD # define strtol wcstoull # else # define strtol wcstoul # endif # else # ifdef QUAD # define strtol strtoull # else # define strtol strtoul # endif # endif # else # ifdef USE_WIDE_CHAR # undef strtol # ifdef QUAD # define strtol wcstoll # else # define strtol wcstol # endif # else # ifdef QUAD # undef strtol # define strtol strtoll # endif # endif # endif #endif /* If QUAD is defined, we are defining 'strtoll' or 'strtoull', operating on 'long long int's. */ #ifdef QUAD # define LONG long long # define STRTOL_LONG_MIN LLONG_MIN # define STRTOL_LONG_MAX LLONG_MAX # define STRTOL_ULONG_MAX ULLONG_MAX # if __GNUC__ == 2 && __GNUC_MINOR__ < 7 /* Work around gcc bug with using this constant. */ static const unsigned long long int maxquad = ULLONG_MAX; # undef STRTOL_ULONG_MAX # define STRTOL_ULONG_MAX maxquad # endif #else # define LONG long # define STRTOL_LONG_MIN LONG_MIN # define STRTOL_LONG_MAX LONG_MAX # define STRTOL_ULONG_MAX ULONG_MAX #endif #ifdef USE_NUMBER_GROUPING # define GROUP_PARAM_PROTO , int group #else # define GROUP_PARAM_PROTO #endif /* We use this code also for the extended locale handling where the function gets as an additional argument the locale which has to be used. To access the values we have to redefine the _NL_CURRENT macro. */ #ifdef USE_IN_EXTENDED_LOCALE_MODEL # undef _NL_CURRENT # define _NL_CURRENT(category, item) \ (current->values[_NL_ITEM_INDEX (item)].string) # define LOCALE_PARAM , loc # define LOCALE_PARAM_PROTO , __locale_t loc #else # define LOCALE_PARAM # define LOCALE_PARAM_PROTO #endif #ifdef USE_WIDE_CHAR # include # include # define L_(Ch) L##Ch # define UCHAR_TYPE wint_t # define STRING_TYPE wchar_t # ifdef USE_IN_EXTENDED_LOCALE_MODEL # define ISSPACE(Ch) __iswspace_l ((Ch), loc) # define ISALPHA(Ch) __iswalpha_l ((Ch), loc) # define TOUPPER(Ch) __towupper_l ((Ch), loc) # else # define ISSPACE(Ch) iswspace (Ch) # define ISALPHA(Ch) iswalpha (Ch) # define TOUPPER(Ch) towupper (Ch) # endif #else # define L_(Ch) Ch # define UCHAR_TYPE unsigned char # define STRING_TYPE char # ifdef USE_IN_EXTENDED_LOCALE_MODEL # define ISSPACE(Ch) __isspace_l ((unsigned char) (Ch), loc) # define ISALPHA(Ch) __isalpha_l ((unsigned char) (Ch), loc) # define TOUPPER(Ch) __toupper_l ((unsigned char) (Ch), loc) # else # define ISSPACE(Ch) isspace ((unsigned char) (Ch)) # define ISALPHA(Ch) isalpha ((unsigned char) (Ch)) # define TOUPPER(Ch) toupper ((unsigned char) (Ch)) # endif #endif #ifdef USE_NUMBER_GROUPING # define INTERNAL(X) INTERNAL1(X) # define INTERNAL1(X) __##X##_internal # define WEAKNAME(X) WEAKNAME1(X) #else # define INTERNAL(X) X #endif #ifdef USE_NUMBER_GROUPING /* This file defines a function to check for correct grouping. */ # include "grouping.h" #endif /* Convert NPTR to an 'unsigned long int' or 'long int' in base BASE. If BASE is 0 the base is determined by the presence of a leading zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal. If BASE is < 2 or > 36, it is reset to 10. If ENDPTR is not NULL, a pointer to the character after the last one converted is stored in *ENDPTR. */ INT INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr, int base GROUP_PARAM_PROTO LOCALE_PARAM_PROTO) { int negative; register unsigned LONG int cutoff; register unsigned int cutlim; register unsigned LONG int i; register const STRING_TYPE *s; register UCHAR_TYPE c; const STRING_TYPE *save, *end; int overflow; #ifdef USE_NUMBER_GROUPING # ifdef USE_IN_EXTENDED_LOCALE_MODEL struct locale_data *current = loc->__locales[LC_NUMERIC]; # endif /* The thousands character of the current locale. */ wchar_t thousands = L'\0'; /* The numeric grouping specification of the current locale, in the format described in . */ const char *grouping; if (group) { grouping = _NL_CURRENT (LC_NUMERIC, GROUPING); if (*grouping <= 0 || *grouping == CHAR_MAX) grouping = NULL; else { /* Figure out the thousands separator character. */ # if defined _LIBC || defined _HAVE_BTOWC thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)); if (thousands == WEOF) thousands = L'\0'; # endif if (thousands == L'\0') grouping = NULL; } } else grouping = NULL; #endif if (base < 0 || base == 1 || base > 36) { __set_errno (EINVAL); return 0; } save = s = nptr; /* Skip white space. */ while (ISSPACE (*s)) ++s; if (*s == L_('\0')) goto noconv; /* Check for a sign. */ if (*s == L_('-')) { negative = 1; ++s; } else if (*s == L_('+')) { negative = 0; ++s; } else negative = 0; /* Recognize number prefix and if BASE is zero, figure it out ourselves. */ if (*s == L_('0')) { if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X')) { s += 2; base = 16; } else if (base == 0) base = 8; } else if (base == 0) base = 10; /* Save the pointer so we can check later if anything happened. */ save = s; #ifdef USE_NUMBER_GROUPING if (group) { /* Find the end of the digit string and check its grouping. */ end = s; for (c = *end; c != L_('\0'); c = *++end) if ((wchar_t) c != thousands && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9')) && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base)) break; if (*s == thousands) end = s; else end = correctly_grouped_prefix (s, end, thousands, grouping); } else #endif end = NULL; cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base; cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base; overflow = 0; i = 0; for (c = *s; c != L_('\0'); c = *++s) { if (s == end) break; if (c >= L_('0') && c <= L_('9')) c -= L_('0'); else if (ISALPHA (c)) c = TOUPPER (c) - L_('A') + 10; else break; if ((int) c >= base) break; /* Check for overflow. */ if (i > cutoff || (i == cutoff && c > cutlim)) overflow = 1; else { i *= (unsigned LONG int) base; i += c; } } /* Check if anything actually happened. */ if (s == save) goto noconv; /* Store in ENDPTR the address of one character past the last character we converted. */ if (endptr != NULL) *endptr = (STRING_TYPE *) s; #if !UNSIGNED /* Check for a value that is within the range of 'unsigned LONG int', but outside the range of 'LONG int'. */ if (overflow == 0 && i > (negative ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1 : (unsigned LONG int) STRTOL_LONG_MAX)) overflow = 1; #endif if (overflow) { __set_errno (ERANGE); #if UNSIGNED return STRTOL_ULONG_MAX; #else return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX; #endif } /* Return the result of the appropriate sign. */ return negative ? -i : i; noconv: /* We must handle a special case here: the base is 0 or 16 and the first two characters are '0' and 'x', but the rest are no hexadecimal digits. This is no error case. We return 0 and ENDPTR points to the 'x'. */ if (endptr != NULL) { if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X') && save[-2] == L_('0')) *endptr = (STRING_TYPE *) &save[-1]; else /* There was no number to convert. */ *endptr = (STRING_TYPE *) nptr; } return 0L; } #ifdef USE_NUMBER_GROUPING /* External user entry point. */ INT # ifdef weak_function weak_function # endif strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr, int base LOCALE_PARAM_PROTO) { return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM); } #endif kbuild-3608/src/grep/lib/memrchr.c0000664000175000017500000001311514670377425017021 0ustar locutuslocutus/* memrchr -- find the last occurrence of a byte in a memory block Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2021 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), with help from Dan Sahlin (dan@sics.se) and commentary by Jim Blandy (jimb@ai.mit.edu); adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), and implemented by Roland McGrath (roland@ai.mit.edu). 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if defined _LIBC # include #else # include # define reg_char char #endif #include #include #undef __memrchr #ifdef _LIBC # undef memrchr #endif #ifndef weak_alias # define __memrchr memrchr #endif /* Search no more than N bytes of S for C. */ void * __memrchr (void const *s, int c_in, size_t n) { /* On 32-bit hardware, choosing longword to be a 32-bit unsigned long instead of a 64-bit uintmax_t tends to give better performance. On 64-bit hardware, unsigned long is generally 64 bits already. Change this typedef to experiment with performance. */ typedef unsigned long int longword; const unsigned char *char_ptr; const longword *longword_ptr; longword repeated_one; longword repeated_c; unsigned reg_char c; c = (unsigned char) c_in; /* Handle the last few bytes by reading one byte at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ for (char_ptr = (const unsigned char *) s + n; n > 0 && (size_t) char_ptr % sizeof (longword) != 0; --n) if (*--char_ptr == c) return (void *) char_ptr; longword_ptr = (const void *) char_ptr; /* All these elucidatory comments refer to 4-byte longwords, but the theory applies equally well to any size longwords. */ /* Compute auxiliary longword values: repeated_one is a value which has a 1 in every byte. repeated_c has c in every byte. */ repeated_one = 0x01010101; repeated_c = c | (c << 8); repeated_c |= repeated_c << 16; if (0xffffffffU < (longword) -1) { repeated_one |= repeated_one << 31 << 1; repeated_c |= repeated_c << 31 << 1; if (8 < sizeof (longword)) { size_t i; for (i = 64; i < sizeof (longword) * 8; i *= 2) { repeated_one |= repeated_one << i; repeated_c |= repeated_c << i; } } } /* Instead of the traditional loop which tests each byte, we will test a longword at a time. The tricky part is testing if *any of the four* bytes in the longword in question are equal to c. We first use an xor with repeated_c. This reduces the task to testing whether *any of the four* bytes in longword1 is zero. We compute tmp = ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). That is, we perform the following operations: 1. Subtract repeated_one. 2. & ~longword1. 3. & a mask consisting of 0x80 in every byte. Consider what happens in each byte: - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, and step 3 transforms it into 0x80. A carry can also be propagated to more significant bytes. - If a byte of longword1 is nonzero, let its lowest 1 bit be at position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, the byte ends in a single bit of value 0 and k bits of value 1. After step 2, the result is just k bits of value 1: 2^k - 1. After step 3, the result is 0. And no carry is produced. So, if longword1 has only non-zero bytes, tmp is zero. Whereas if longword1 has a zero byte, call j the position of the least significant zero byte. Then the result has a zero at positions 0, ..., j-1 and a 0x80 at position j. We cannot predict the result at the more significant bytes (positions j+1..3), but it does not matter since we already have a non-zero bit at position 8*j+7. So, the test whether any byte in longword1 is zero is equivalent to testing whether tmp is nonzero. */ while (n >= sizeof (longword)) { longword longword1 = *--longword_ptr ^ repeated_c; if ((((longword1 - repeated_one) & ~longword1) & (repeated_one << 7)) != 0) { longword_ptr++; break; } n -= sizeof (longword); } char_ptr = (const unsigned char *) longword_ptr; /* At this point, we know that either n < sizeof (longword), or one of the sizeof (longword) bytes starting at char_ptr is == c. On little-endian machines, we could determine the first such byte without any further memory accesses, just by looking at the tmp result from the last loop iteration. But this does not work on big-endian machines. Choose code that works in both cases. */ while (n-- > 0) { if (*--char_ptr == c) return (void *) char_ptr; } return NULL; } #ifdef weak_alias weak_alias (__memrchr, memrchr) #endif kbuild-3608/src/grep/lib/regex_internal.c0000664000175000017500000014046114670377426020400 0ustar locutuslocutus/* Extended regular expression matching and search library. Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ static void re_string_construct_common (const char *str, Idx len, re_string_t *pstr, RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa); static re_dfastate_t *create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes, re_hashval_t hash); static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes, unsigned int context, re_hashval_t hash); static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len); #ifdef RE_ENABLE_I18N static void build_wcs_buffer (re_string_t *pstr); static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr); #endif /* RE_ENABLE_I18N */ static void build_upper_buffer (re_string_t *pstr); static void re_string_translate_buffer (re_string_t *pstr); static unsigned int re_string_context_at (const re_string_t *input, Idx idx, int eflags) __attribute__ ((pure)); /* Functions for string operation. */ /* This function allocate the buffers. It is necessary to call re_string_reconstruct before using the object. */ static reg_errcode_t __attribute_warn_unused_result__ re_string_allocate (re_string_t *pstr, const char *str, Idx len, Idx init_len, RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa) { reg_errcode_t ret; Idx init_buf_len; /* Ensure at least one character fits into the buffers. */ if (init_len < dfa->mb_cur_max) init_len = dfa->mb_cur_max; init_buf_len = (len + 1 < init_len) ? len + 1: init_len; re_string_construct_common (str, len, pstr, trans, icase, dfa); ret = re_string_realloc_buffers (pstr, init_buf_len); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; pstr->word_char = dfa->word_char; pstr->word_ops_used = dfa->word_ops_used; pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str; pstr->valid_len = (pstr->mbs_allocated || dfa->mb_cur_max > 1) ? 0 : len; pstr->valid_raw_len = pstr->valid_len; return REG_NOERROR; } /* This function allocate the buffers, and initialize them. */ static reg_errcode_t __attribute_warn_unused_result__ re_string_construct (re_string_t *pstr, const char *str, Idx len, RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa) { reg_errcode_t ret; memset (pstr, '\0', sizeof (re_string_t)); re_string_construct_common (str, len, pstr, trans, icase, dfa); if (len > 0) { ret = re_string_realloc_buffers (pstr, len + 1); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; } pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str; if (icase) { #ifdef RE_ENABLE_I18N if (dfa->mb_cur_max > 1) { while (1) { ret = build_wcs_upper_buffer (pstr); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; if (pstr->valid_raw_len >= len) break; if (pstr->bufs_len > pstr->valid_len + dfa->mb_cur_max) break; ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; } } else #endif /* RE_ENABLE_I18N */ build_upper_buffer (pstr); } else { #ifdef RE_ENABLE_I18N if (dfa->mb_cur_max > 1) build_wcs_buffer (pstr); else #endif /* RE_ENABLE_I18N */ { if (trans != NULL) re_string_translate_buffer (pstr); else { pstr->valid_len = pstr->bufs_len; pstr->valid_raw_len = pstr->bufs_len; } } } return REG_NOERROR; } /* Helper functions for re_string_allocate, and re_string_construct. */ static reg_errcode_t __attribute_warn_unused_result__ re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len) { #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1) { wint_t *new_wcs; /* Avoid overflow in realloc. */ const size_t max_object_size = MAX (sizeof (wint_t), sizeof (Idx)); if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_buf_len)) return REG_ESPACE; new_wcs = re_realloc (pstr->wcs, wint_t, new_buf_len); if (__glibc_unlikely (new_wcs == NULL)) return REG_ESPACE; pstr->wcs = new_wcs; if (pstr->offsets != NULL) { Idx *new_offsets = re_realloc (pstr->offsets, Idx, new_buf_len); if (__glibc_unlikely (new_offsets == NULL)) return REG_ESPACE; pstr->offsets = new_offsets; } } #endif /* RE_ENABLE_I18N */ if (pstr->mbs_allocated) { unsigned char *new_mbs = re_realloc (pstr->mbs, unsigned char, new_buf_len); if (__glibc_unlikely (new_mbs == NULL)) return REG_ESPACE; pstr->mbs = new_mbs; } pstr->bufs_len = new_buf_len; return REG_NOERROR; } static void re_string_construct_common (const char *str, Idx len, re_string_t *pstr, RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa) { pstr->raw_mbs = (const unsigned char *) str; pstr->len = len; pstr->raw_len = len; pstr->trans = trans; pstr->icase = icase; pstr->mbs_allocated = (trans != NULL || icase); pstr->mb_cur_max = dfa->mb_cur_max; pstr->is_utf8 = dfa->is_utf8; pstr->map_notascii = dfa->map_notascii; pstr->stop = pstr->len; pstr->raw_stop = pstr->stop; } #ifdef RE_ENABLE_I18N /* Build wide character buffer PSTR->WCS. If the byte sequence of the string are: (0), (1), (0), (1), Then wide character buffer will be: , WEOF , , WEOF , We use WEOF for padding, they indicate that the position isn't a first byte of a multibyte character. Note that this function assumes PSTR->VALID_LEN elements are already built and starts from PSTR->VALID_LEN. */ static void build_wcs_buffer (re_string_t *pstr) { #ifdef _LIBC unsigned char buf[MB_LEN_MAX]; DEBUG_ASSERT (MB_LEN_MAX >= pstr->mb_cur_max); #else unsigned char buf[64]; #endif mbstate_t prev_st; Idx byte_idx, end_idx, remain_len; size_t mbclen; /* Build the buffers from pstr->valid_len to either pstr->len or pstr->bufs_len. */ end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; for (byte_idx = pstr->valid_len; byte_idx < end_idx;) { wchar_t wc; const char *p; remain_len = end_idx - byte_idx; prev_st = pstr->cur_state; /* Apply the translation if we need. */ if (__glibc_unlikely (pstr->trans != NULL)) { int i, ch; for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) { ch = pstr->raw_mbs [pstr->raw_mbs_idx + byte_idx + i]; buf[i] = pstr->mbs[byte_idx + i] = pstr->trans[ch]; } p = (const char *) buf; } else p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx; mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state); if (__glibc_unlikely (mbclen == (size_t) -1 || mbclen == 0 || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))) { /* We treat these cases as a singlebyte character. */ mbclen = 1; wc = (wchar_t) pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]; if (__glibc_unlikely (pstr->trans != NULL)) wc = pstr->trans[wc]; pstr->cur_state = prev_st; } else if (__glibc_unlikely (mbclen == (size_t) -2)) { /* The buffer doesn't have enough space, finish to build. */ pstr->cur_state = prev_st; break; } /* Write wide character and padding. */ pstr->wcs[byte_idx++] = wc; /* Write paddings. */ for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;) pstr->wcs[byte_idx++] = WEOF; } pstr->valid_len = byte_idx; pstr->valid_raw_len = byte_idx; } /* Build wide character buffer PSTR->WCS like build_wcs_buffer, but for REG_ICASE. */ static reg_errcode_t __attribute_warn_unused_result__ build_wcs_upper_buffer (re_string_t *pstr) { mbstate_t prev_st; Idx src_idx, byte_idx, end_idx, remain_len; size_t mbclen; #ifdef _LIBC char buf[MB_LEN_MAX]; DEBUG_ASSERT (pstr->mb_cur_max <= MB_LEN_MAX); #else char buf[64]; #endif byte_idx = pstr->valid_len; end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; /* The following optimization assumes that ASCII characters can be mapped to wide characters with a simple cast. */ if (! pstr->map_notascii && pstr->trans == NULL && !pstr->offsets_needed) { while (byte_idx < end_idx) { wchar_t wc; unsigned char ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]; if (isascii (ch) && mbsinit (&pstr->cur_state)) { /* The next step uses the assumption that wchar_t is encoded ASCII-safe: all ASCII values can be converted like this. */ wchar_t wcu = __towupper (ch); if (isascii (wcu)) { pstr->mbs[byte_idx] = wcu; pstr->wcs[byte_idx] = wcu; byte_idx++; continue; } } remain_len = end_idx - byte_idx; prev_st = pstr->cur_state; mbclen = __mbrtowc (&wc, ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx), remain_len, &pstr->cur_state); if (__glibc_likely (0 < mbclen && mbclen < (size_t) -2)) { wchar_t wcu = __towupper (wc); if (wcu != wc) { size_t mbcdlen; mbcdlen = __wcrtomb (buf, wcu, &prev_st); if (__glibc_likely (mbclen == mbcdlen)) memcpy (pstr->mbs + byte_idx, buf, mbclen); else { src_idx = byte_idx; goto offsets_needed; } } else memcpy (pstr->mbs + byte_idx, pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx, mbclen); pstr->wcs[byte_idx++] = wcu; /* Write paddings. */ for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;) pstr->wcs[byte_idx++] = WEOF; } else if (mbclen == (size_t) -1 || mbclen == 0 || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len)) { /* It is an invalid character, an incomplete character at the end of the string, or '\0'. Just use the byte. */ pstr->mbs[byte_idx] = ch; /* And also cast it to wide char. */ pstr->wcs[byte_idx++] = (wchar_t) ch; if (__glibc_unlikely (mbclen == (size_t) -1)) pstr->cur_state = prev_st; } else { /* The buffer doesn't have enough space, finish to build. */ pstr->cur_state = prev_st; break; } } pstr->valid_len = byte_idx; pstr->valid_raw_len = byte_idx; return REG_NOERROR; } else for (src_idx = pstr->valid_raw_len; byte_idx < end_idx;) { wchar_t wc; const char *p; offsets_needed: remain_len = end_idx - byte_idx; prev_st = pstr->cur_state; if (__glibc_unlikely (pstr->trans != NULL)) { int i, ch; for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) { ch = pstr->raw_mbs [pstr->raw_mbs_idx + src_idx + i]; buf[i] = pstr->trans[ch]; } p = (const char *) buf; } else p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx; mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state); if (__glibc_likely (0 < mbclen && mbclen < (size_t) -2)) { wchar_t wcu = __towupper (wc); if (wcu != wc) { size_t mbcdlen; mbcdlen = __wcrtomb ((char *) buf, wcu, &prev_st); if (__glibc_likely (mbclen == mbcdlen)) memcpy (pstr->mbs + byte_idx, buf, mbclen); else if (mbcdlen != (size_t) -1) { size_t i; if (byte_idx + mbcdlen > pstr->bufs_len) { pstr->cur_state = prev_st; break; } if (pstr->offsets == NULL) { pstr->offsets = re_malloc (Idx, pstr->bufs_len); if (pstr->offsets == NULL) return REG_ESPACE; } if (!pstr->offsets_needed) { for (i = 0; i < (size_t) byte_idx; ++i) pstr->offsets[i] = i; pstr->offsets_needed = 1; } memcpy (pstr->mbs + byte_idx, buf, mbcdlen); pstr->wcs[byte_idx] = wcu; pstr->offsets[byte_idx] = src_idx; for (i = 1; i < mbcdlen; ++i) { pstr->offsets[byte_idx + i] = src_idx + (i < mbclen ? i : mbclen - 1); pstr->wcs[byte_idx + i] = WEOF; } pstr->len += mbcdlen - mbclen; if (pstr->raw_stop > src_idx) pstr->stop += mbcdlen - mbclen; end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; byte_idx += mbcdlen; src_idx += mbclen; continue; } else memcpy (pstr->mbs + byte_idx, p, mbclen); } else memcpy (pstr->mbs + byte_idx, p, mbclen); if (__glibc_unlikely (pstr->offsets_needed != 0)) { size_t i; for (i = 0; i < mbclen; ++i) pstr->offsets[byte_idx + i] = src_idx + i; } src_idx += mbclen; pstr->wcs[byte_idx++] = wcu; /* Write paddings. */ for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;) pstr->wcs[byte_idx++] = WEOF; } else if (mbclen == (size_t) -1 || mbclen == 0 || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len)) { /* It is an invalid character or '\0'. Just use the byte. */ int ch = pstr->raw_mbs[pstr->raw_mbs_idx + src_idx]; if (__glibc_unlikely (pstr->trans != NULL)) ch = pstr->trans [ch]; pstr->mbs[byte_idx] = ch; if (__glibc_unlikely (pstr->offsets_needed != 0)) pstr->offsets[byte_idx] = src_idx; ++src_idx; /* And also cast it to wide char. */ pstr->wcs[byte_idx++] = (wchar_t) ch; if (__glibc_unlikely (mbclen == (size_t) -1)) pstr->cur_state = prev_st; } else { /* The buffer doesn't have enough space, finish to build. */ pstr->cur_state = prev_st; break; } } pstr->valid_len = byte_idx; pstr->valid_raw_len = src_idx; return REG_NOERROR; } /* Skip characters until the index becomes greater than NEW_RAW_IDX. Return the index. */ static Idx re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc) { mbstate_t prev_st; Idx rawbuf_idx; size_t mbclen; wint_t wc = WEOF; /* Skip the characters which are not necessary to check. */ for (rawbuf_idx = pstr->raw_mbs_idx + pstr->valid_raw_len; rawbuf_idx < new_raw_idx;) { wchar_t wc2; Idx remain_len = pstr->raw_len - rawbuf_idx; prev_st = pstr->cur_state; mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx, remain_len, &pstr->cur_state); if (__glibc_unlikely (mbclen == (size_t) -2 || mbclen == (size_t) -1 || mbclen == 0)) { /* We treat these cases as a single byte character. */ if (mbclen == 0 || remain_len == 0) wc = L'\0'; else wc = *(unsigned char *) (pstr->raw_mbs + rawbuf_idx); mbclen = 1; pstr->cur_state = prev_st; } else wc = wc2; /* Then proceed the next character. */ rawbuf_idx += mbclen; } *last_wc = wc; return rawbuf_idx; } #endif /* RE_ENABLE_I18N */ /* Build the buffer PSTR->MBS, and apply the translation if we need. This function is used in case of REG_ICASE. */ static void build_upper_buffer (re_string_t *pstr) { Idx char_idx, end_idx; end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; for (char_idx = pstr->valid_len; char_idx < end_idx; ++char_idx) { int ch = pstr->raw_mbs[pstr->raw_mbs_idx + char_idx]; if (__glibc_unlikely (pstr->trans != NULL)) ch = pstr->trans[ch]; pstr->mbs[char_idx] = toupper (ch); } pstr->valid_len = char_idx; pstr->valid_raw_len = char_idx; } /* Apply TRANS to the buffer in PSTR. */ static void re_string_translate_buffer (re_string_t *pstr) { Idx buf_idx, end_idx; end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; for (buf_idx = pstr->valid_len; buf_idx < end_idx; ++buf_idx) { int ch = pstr->raw_mbs[pstr->raw_mbs_idx + buf_idx]; pstr->mbs[buf_idx] = pstr->trans[ch]; } pstr->valid_len = buf_idx; pstr->valid_raw_len = buf_idx; } /* This function re-construct the buffers. Concretely, convert to wide character in case of pstr->mb_cur_max > 1, convert to upper case in case of REG_ICASE, apply translation. */ static reg_errcode_t __attribute_warn_unused_result__ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) { Idx offset; if (__glibc_unlikely (pstr->raw_mbs_idx <= idx)) offset = idx - pstr->raw_mbs_idx; else { /* Reset buffer. */ #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1) memset (&pstr->cur_state, '\0', sizeof (mbstate_t)); #endif /* RE_ENABLE_I18N */ pstr->len = pstr->raw_len; pstr->stop = pstr->raw_stop; pstr->valid_len = 0; pstr->raw_mbs_idx = 0; pstr->valid_raw_len = 0; pstr->offsets_needed = 0; pstr->tip_context = ((eflags & REG_NOTBOL) ? CONTEXT_BEGBUF : CONTEXT_NEWLINE | CONTEXT_BEGBUF); if (!pstr->mbs_allocated) pstr->mbs = (unsigned char *) pstr->raw_mbs; offset = idx; } if (__glibc_likely (offset != 0)) { /* Should the already checked characters be kept? */ if (__glibc_likely (offset < pstr->valid_raw_len)) { /* Yes, move them to the front of the buffer. */ #ifdef RE_ENABLE_I18N if (__glibc_unlikely (pstr->offsets_needed)) { Idx low = 0, high = pstr->valid_len, mid; do { mid = (high + low) / 2; if (pstr->offsets[mid] > offset) high = mid; else if (pstr->offsets[mid] < offset) low = mid + 1; else break; } while (low < high); if (pstr->offsets[mid] < offset) ++mid; pstr->tip_context = re_string_context_at (pstr, mid - 1, eflags); /* This can be quite complicated, so handle specially only the common and easy case where the character with different length representation of lower and upper case is present at or after offset. */ if (pstr->valid_len > offset && mid == offset && pstr->offsets[mid] == offset) { memmove (pstr->wcs, pstr->wcs + offset, (pstr->valid_len - offset) * sizeof (wint_t)); memmove (pstr->mbs, pstr->mbs + offset, pstr->valid_len - offset); pstr->valid_len -= offset; pstr->valid_raw_len -= offset; for (low = 0; low < pstr->valid_len; low++) pstr->offsets[low] = pstr->offsets[low + offset] - offset; } else { /* Otherwise, just find out how long the partial multibyte character at offset is and fill it with WEOF/255. */ pstr->len = pstr->raw_len - idx + offset; pstr->stop = pstr->raw_stop - idx + offset; pstr->offsets_needed = 0; while (mid > 0 && pstr->offsets[mid - 1] == offset) --mid; while (mid < pstr->valid_len) if (pstr->wcs[mid] != WEOF) break; else ++mid; if (mid == pstr->valid_len) pstr->valid_len = 0; else { pstr->valid_len = pstr->offsets[mid] - offset; if (pstr->valid_len) { for (low = 0; low < pstr->valid_len; ++low) pstr->wcs[low] = WEOF; memset (pstr->mbs, 255, pstr->valid_len); } } pstr->valid_raw_len = pstr->valid_len; } } else #endif { pstr->tip_context = re_string_context_at (pstr, offset - 1, eflags); #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1) memmove (pstr->wcs, pstr->wcs + offset, (pstr->valid_len - offset) * sizeof (wint_t)); #endif /* RE_ENABLE_I18N */ if (__glibc_unlikely (pstr->mbs_allocated)) memmove (pstr->mbs, pstr->mbs + offset, pstr->valid_len - offset); pstr->valid_len -= offset; pstr->valid_raw_len -= offset; DEBUG_ASSERT (pstr->valid_len > 0); } } else { #ifdef RE_ENABLE_I18N /* No, skip all characters until IDX. */ Idx prev_valid_len = pstr->valid_len; if (__glibc_unlikely (pstr->offsets_needed)) { pstr->len = pstr->raw_len - idx + offset; pstr->stop = pstr->raw_stop - idx + offset; pstr->offsets_needed = 0; } #endif pstr->valid_len = 0; #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1) { Idx wcs_idx; wint_t wc = WEOF; if (pstr->is_utf8) { const unsigned char *raw, *p, *end; /* Special case UTF-8. Multi-byte chars start with any byte other than 0x80 - 0xbf. */ raw = pstr->raw_mbs + pstr->raw_mbs_idx; end = raw + (offset - pstr->mb_cur_max); if (end < pstr->raw_mbs) end = pstr->raw_mbs; p = raw + offset - 1; #ifdef _LIBC /* We know the wchar_t encoding is UCS4, so for the simple case, ASCII characters, skip the conversion step. */ if (isascii (*p) && __glibc_likely (pstr->trans == NULL)) { memset (&pstr->cur_state, '\0', sizeof (mbstate_t)); /* pstr->valid_len = 0; */ wc = (wchar_t) *p; } else #endif for (; p >= end; --p) if ((*p & 0xc0) != 0x80) { mbstate_t cur_state; wchar_t wc2; Idx mlen = raw + pstr->len - p; unsigned char buf[6]; size_t mbclen; const unsigned char *pp = p; if (__glibc_unlikely (pstr->trans != NULL)) { int i = mlen < 6 ? mlen : 6; while (--i >= 0) buf[i] = pstr->trans[p[i]]; pp = buf; } /* XXX Don't use mbrtowc, we know which conversion to use (UTF-8 -> UCS4). */ memset (&cur_state, 0, sizeof (cur_state)); mbclen = __mbrtowc (&wc2, (const char *) pp, mlen, &cur_state); if (raw + offset - p <= mbclen && mbclen < (size_t) -2) { memset (&pstr->cur_state, '\0', sizeof (mbstate_t)); pstr->valid_len = mbclen - (raw + offset - p); wc = wc2; } break; } } if (wc == WEOF) pstr->valid_len = re_string_skip_chars (pstr, idx, &wc) - idx; if (wc == WEOF) pstr->tip_context = re_string_context_at (pstr, prev_valid_len - 1, eflags); else pstr->tip_context = ((__glibc_unlikely (pstr->word_ops_used != 0) && IS_WIDE_WORD_CHAR (wc)) ? CONTEXT_WORD : ((IS_WIDE_NEWLINE (wc) && pstr->newline_anchor) ? CONTEXT_NEWLINE : 0)); if (__glibc_unlikely (pstr->valid_len)) { for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx) pstr->wcs[wcs_idx] = WEOF; if (pstr->mbs_allocated) memset (pstr->mbs, 255, pstr->valid_len); } pstr->valid_raw_len = pstr->valid_len; } else #endif /* RE_ENABLE_I18N */ { int c = pstr->raw_mbs[pstr->raw_mbs_idx + offset - 1]; pstr->valid_raw_len = 0; if (pstr->trans) c = pstr->trans[c]; pstr->tip_context = (bitset_contain (pstr->word_char, c) ? CONTEXT_WORD : ((IS_NEWLINE (c) && pstr->newline_anchor) ? CONTEXT_NEWLINE : 0)); } } if (!__glibc_unlikely (pstr->mbs_allocated)) pstr->mbs += offset; } pstr->raw_mbs_idx = idx; pstr->len -= offset; pstr->stop -= offset; /* Then build the buffers. */ #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1) { if (pstr->icase) { reg_errcode_t ret = build_wcs_upper_buffer (pstr); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; } else build_wcs_buffer (pstr); } else #endif /* RE_ENABLE_I18N */ if (__glibc_unlikely (pstr->mbs_allocated)) { if (pstr->icase) build_upper_buffer (pstr); else if (pstr->trans != NULL) re_string_translate_buffer (pstr); } else pstr->valid_len = pstr->len; pstr->cur_idx = 0; return REG_NOERROR; } static unsigned char __attribute__ ((pure)) re_string_peek_byte_case (const re_string_t *pstr, Idx idx) { int ch; Idx off; /* Handle the common (easiest) cases first. */ if (__glibc_likely (!pstr->mbs_allocated)) return re_string_peek_byte (pstr, idx); #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1 && ! re_string_is_single_byte_char (pstr, pstr->cur_idx + idx)) return re_string_peek_byte (pstr, idx); #endif off = pstr->cur_idx + idx; #ifdef RE_ENABLE_I18N if (pstr->offsets_needed) off = pstr->offsets[off]; #endif ch = pstr->raw_mbs[pstr->raw_mbs_idx + off]; #ifdef RE_ENABLE_I18N /* Ensure that e.g. for tr_TR.UTF-8 BACKSLASH DOTLESS SMALL LETTER I this function returns CAPITAL LETTER I instead of first byte of DOTLESS SMALL LETTER I. The latter would confuse the parser, since peek_byte_case doesn't advance cur_idx in any way. */ if (pstr->offsets_needed && !isascii (ch)) return re_string_peek_byte (pstr, idx); #endif return ch; } static unsigned char re_string_fetch_byte_case (re_string_t *pstr) { if (__glibc_likely (!pstr->mbs_allocated)) return re_string_fetch_byte (pstr); #ifdef RE_ENABLE_I18N if (pstr->offsets_needed) { Idx off; int ch; /* For tr_TR.UTF-8 [[:islower:]] there is [[: CAPITAL LETTER I WITH DOT lower:]] in mbs. Skip in that case the whole multi-byte character and return the original letter. On the other side, with [[: DOTLESS SMALL LETTER I return [[:I, as doing anything else would complicate things too much. */ if (!re_string_first_byte (pstr, pstr->cur_idx)) return re_string_fetch_byte (pstr); off = pstr->offsets[pstr->cur_idx]; ch = pstr->raw_mbs[pstr->raw_mbs_idx + off]; if (! isascii (ch)) return re_string_fetch_byte (pstr); re_string_skip_bytes (pstr, re_string_char_size_at (pstr, pstr->cur_idx)); return ch; } #endif return pstr->raw_mbs[pstr->raw_mbs_idx + pstr->cur_idx++]; } static void re_string_destruct (re_string_t *pstr) { #ifdef RE_ENABLE_I18N re_free (pstr->wcs); re_free (pstr->offsets); #endif /* RE_ENABLE_I18N */ if (pstr->mbs_allocated) re_free (pstr->mbs); } /* Return the context at IDX in INPUT. */ static unsigned int re_string_context_at (const re_string_t *input, Idx idx, int eflags) { int c; if (__glibc_unlikely (idx < 0)) /* In this case, we use the value stored in input->tip_context, since we can't know the character in input->mbs[-1] here. */ return input->tip_context; if (__glibc_unlikely (idx == input->len)) return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF : CONTEXT_NEWLINE | CONTEXT_ENDBUF); #ifdef RE_ENABLE_I18N if (input->mb_cur_max > 1) { wint_t wc; Idx wc_idx = idx; while(input->wcs[wc_idx] == WEOF) { DEBUG_ASSERT (wc_idx >= 0); --wc_idx; if (wc_idx < 0) return input->tip_context; } wc = input->wcs[wc_idx]; if (__glibc_unlikely (input->word_ops_used != 0) && IS_WIDE_WORD_CHAR (wc)) return CONTEXT_WORD; return (IS_WIDE_NEWLINE (wc) && input->newline_anchor ? CONTEXT_NEWLINE : 0); } else #endif { c = re_string_byte_at (input, idx); if (bitset_contain (input->word_char, c)) return CONTEXT_WORD; return IS_NEWLINE (c) && input->newline_anchor ? CONTEXT_NEWLINE : 0; } } /* Functions for set operation. */ static reg_errcode_t __attribute_warn_unused_result__ re_node_set_alloc (re_node_set *set, Idx size) { set->alloc = size; set->nelem = 0; set->elems = re_malloc (Idx, size); if (__glibc_unlikely (set->elems == NULL) && (MALLOC_0_IS_NONNULL || size != 0)) return REG_ESPACE; return REG_NOERROR; } static reg_errcode_t __attribute_warn_unused_result__ re_node_set_init_1 (re_node_set *set, Idx elem) { set->alloc = 1; set->nelem = 1; set->elems = re_malloc (Idx, 1); if (__glibc_unlikely (set->elems == NULL)) { set->alloc = set->nelem = 0; return REG_ESPACE; } set->elems[0] = elem; return REG_NOERROR; } static reg_errcode_t __attribute_warn_unused_result__ re_node_set_init_2 (re_node_set *set, Idx elem1, Idx elem2) { set->alloc = 2; set->elems = re_malloc (Idx, 2); if (__glibc_unlikely (set->elems == NULL)) return REG_ESPACE; if (elem1 == elem2) { set->nelem = 1; set->elems[0] = elem1; } else { set->nelem = 2; if (elem1 < elem2) { set->elems[0] = elem1; set->elems[1] = elem2; } else { set->elems[0] = elem2; set->elems[1] = elem1; } } return REG_NOERROR; } static reg_errcode_t __attribute_warn_unused_result__ re_node_set_init_copy (re_node_set *dest, const re_node_set *src) { dest->nelem = src->nelem; if (src->nelem > 0) { dest->alloc = dest->nelem; dest->elems = re_malloc (Idx, dest->alloc); if (__glibc_unlikely (dest->elems == NULL)) { dest->alloc = dest->nelem = 0; return REG_ESPACE; } memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx)); } else re_node_set_init_empty (dest); return REG_NOERROR; } /* Calculate the intersection of the sets SRC1 and SRC2. And merge it to DEST. Return value indicate the error code or REG_NOERROR if succeeded. Note: We assume dest->elems is NULL, when dest->alloc is 0. */ static reg_errcode_t __attribute_warn_unused_result__ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, const re_node_set *src2) { Idx i1, i2, is, id, delta, sbase; if (src1->nelem == 0 || src2->nelem == 0) return REG_NOERROR; /* We need dest->nelem + 2 * elems_in_intersection; this is a conservative estimate. */ if (src1->nelem + src2->nelem + dest->nelem > dest->alloc) { Idx new_alloc = src1->nelem + src2->nelem + dest->alloc; Idx *new_elems = re_realloc (dest->elems, Idx, new_alloc); if (__glibc_unlikely (new_elems == NULL)) return REG_ESPACE; dest->elems = new_elems; dest->alloc = new_alloc; } /* Find the items in the intersection of SRC1 and SRC2, and copy into the top of DEST those that are not already in DEST itself. */ sbase = dest->nelem + src1->nelem + src2->nelem; i1 = src1->nelem - 1; i2 = src2->nelem - 1; id = dest->nelem - 1; for (;;) { if (src1->elems[i1] == src2->elems[i2]) { /* Try to find the item in DEST. Maybe we could binary search? */ while (id >= 0 && dest->elems[id] > src1->elems[i1]) --id; if (id < 0 || dest->elems[id] != src1->elems[i1]) dest->elems[--sbase] = src1->elems[i1]; if (--i1 < 0 || --i2 < 0) break; } /* Lower the highest of the two items. */ else if (src1->elems[i1] < src2->elems[i2]) { if (--i2 < 0) break; } else { if (--i1 < 0) break; } } id = dest->nelem - 1; is = dest->nelem + src1->nelem + src2->nelem - 1; delta = is - sbase + 1; /* Now copy. When DELTA becomes zero, the remaining DEST elements are already in place; this is more or less the same loop that is in re_node_set_merge. */ dest->nelem += delta; if (delta > 0 && id >= 0) for (;;) { if (dest->elems[is] > dest->elems[id]) { /* Copy from the top. */ dest->elems[id + delta--] = dest->elems[is--]; if (delta == 0) break; } else { /* Slide from the bottom. */ dest->elems[id + delta] = dest->elems[id]; if (--id < 0) break; } } /* Copy remaining SRC elements. */ memcpy (dest->elems, dest->elems + sbase, delta * sizeof (Idx)); return REG_NOERROR; } /* Calculate the union set of the sets SRC1 and SRC2. And store it to DEST. Return value indicate the error code or REG_NOERROR if succeeded. */ static reg_errcode_t __attribute_warn_unused_result__ re_node_set_init_union (re_node_set *dest, const re_node_set *src1, const re_node_set *src2) { Idx i1, i2, id; if (src1 != NULL && src1->nelem > 0 && src2 != NULL && src2->nelem > 0) { dest->alloc = src1->nelem + src2->nelem; dest->elems = re_malloc (Idx, dest->alloc); if (__glibc_unlikely (dest->elems == NULL)) return REG_ESPACE; } else { if (src1 != NULL && src1->nelem > 0) return re_node_set_init_copy (dest, src1); else if (src2 != NULL && src2->nelem > 0) return re_node_set_init_copy (dest, src2); else re_node_set_init_empty (dest); return REG_NOERROR; } for (i1 = i2 = id = 0 ; i1 < src1->nelem && i2 < src2->nelem ;) { if (src1->elems[i1] > src2->elems[i2]) { dest->elems[id++] = src2->elems[i2++]; continue; } if (src1->elems[i1] == src2->elems[i2]) ++i2; dest->elems[id++] = src1->elems[i1++]; } if (i1 < src1->nelem) { memcpy (dest->elems + id, src1->elems + i1, (src1->nelem - i1) * sizeof (Idx)); id += src1->nelem - i1; } else if (i2 < src2->nelem) { memcpy (dest->elems + id, src2->elems + i2, (src2->nelem - i2) * sizeof (Idx)); id += src2->nelem - i2; } dest->nelem = id; return REG_NOERROR; } /* Calculate the union set of the sets DEST and SRC. And store it to DEST. Return value indicate the error code or REG_NOERROR if succeeded. */ static reg_errcode_t __attribute_warn_unused_result__ re_node_set_merge (re_node_set *dest, const re_node_set *src) { Idx is, id, sbase, delta; if (src == NULL || src->nelem == 0) return REG_NOERROR; if (dest->alloc < 2 * src->nelem + dest->nelem) { Idx new_alloc = 2 * (src->nelem + dest->alloc); Idx *new_buffer = re_realloc (dest->elems, Idx, new_alloc); if (__glibc_unlikely (new_buffer == NULL)) return REG_ESPACE; dest->elems = new_buffer; dest->alloc = new_alloc; } if (__glibc_unlikely (dest->nelem == 0)) { /* Although we already guaranteed above that dest->alloc != 0 and therefore dest->elems != NULL, add a debug assertion to pacify GCC 11.2.1's -fanalyzer. */ DEBUG_ASSERT (dest->elems); dest->nelem = src->nelem; memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx)); return REG_NOERROR; } /* Copy into the top of DEST the items of SRC that are not found in DEST. Maybe we could binary search in DEST? */ for (sbase = dest->nelem + 2 * src->nelem, is = src->nelem - 1, id = dest->nelem - 1; is >= 0 && id >= 0; ) { if (dest->elems[id] == src->elems[is]) is--, id--; else if (dest->elems[id] < src->elems[is]) dest->elems[--sbase] = src->elems[is--]; else /* if (dest->elems[id] > src->elems[is]) */ --id; } if (is >= 0) { /* If DEST is exhausted, the remaining items of SRC must be unique. */ sbase -= is + 1; memcpy (dest->elems + sbase, src->elems, (is + 1) * sizeof (Idx)); } id = dest->nelem - 1; is = dest->nelem + 2 * src->nelem - 1; delta = is - sbase + 1; if (delta == 0) return REG_NOERROR; /* Now copy. When DELTA becomes zero, the remaining DEST elements are already in place. */ dest->nelem += delta; for (;;) { if (dest->elems[is] > dest->elems[id]) { /* Copy from the top. */ dest->elems[id + delta--] = dest->elems[is--]; if (delta == 0) break; } else { /* Slide from the bottom. */ dest->elems[id + delta] = dest->elems[id]; if (--id < 0) { /* Copy remaining SRC elements. */ memcpy (dest->elems, dest->elems + sbase, delta * sizeof (Idx)); break; } } } return REG_NOERROR; } /* Insert the new element ELEM to the re_node_set* SET. SET should not already have ELEM. Return true if successful. */ static bool __attribute_warn_unused_result__ re_node_set_insert (re_node_set *set, Idx elem) { Idx idx; /* In case the set is empty. */ if (set->alloc == 0) return __glibc_likely (re_node_set_init_1 (set, elem) == REG_NOERROR); if (__glibc_unlikely (set->nelem) == 0) { /* Although we already guaranteed above that set->alloc != 0 and therefore set->elems != NULL, add a debug assertion to pacify GCC 11.2 -fanalyzer. */ DEBUG_ASSERT (set->elems); set->elems[0] = elem; ++set->nelem; return true; } /* Realloc if we need. */ if (set->alloc == set->nelem) { Idx *new_elems; set->alloc = set->alloc * 2; new_elems = re_realloc (set->elems, Idx, set->alloc); if (__glibc_unlikely (new_elems == NULL)) return false; set->elems = new_elems; } /* Move the elements which follows the new element. Test the first element separately to skip a check in the inner loop. */ if (elem < set->elems[0]) { for (idx = set->nelem; idx > 0; idx--) set->elems[idx] = set->elems[idx - 1]; } else { for (idx = set->nelem; set->elems[idx - 1] > elem; idx--) set->elems[idx] = set->elems[idx - 1]; DEBUG_ASSERT (set->elems[idx - 1] < elem); } /* Insert the new element. */ set->elems[idx] = elem; ++set->nelem; return true; } /* Insert the new element ELEM to the re_node_set* SET. SET should not already have any element greater than or equal to ELEM. Return true if successful. */ static bool __attribute_warn_unused_result__ re_node_set_insert_last (re_node_set *set, Idx elem) { /* Realloc if we need. */ if (set->alloc == set->nelem) { Idx *new_elems; set->alloc = (set->alloc + 1) * 2; new_elems = re_realloc (set->elems, Idx, set->alloc); if (__glibc_unlikely (new_elems == NULL)) return false; set->elems = new_elems; } /* Insert the new element. */ set->elems[set->nelem++] = elem; return true; } /* Compare two node sets SET1 and SET2. Return true if SET1 and SET2 are equivalent. */ static bool __attribute__ ((pure)) re_node_set_compare (const re_node_set *set1, const re_node_set *set2) { Idx i; if (set1 == NULL || set2 == NULL || set1->nelem != set2->nelem) return false; for (i = set1->nelem ; --i >= 0 ; ) if (set1->elems[i] != set2->elems[i]) return false; return true; } /* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */ static Idx __attribute__ ((pure)) re_node_set_contains (const re_node_set *set, Idx elem) { __re_size_t idx, right, mid; if (set->nelem <= 0) return 0; /* Binary search the element. */ idx = 0; right = set->nelem - 1; while (idx < right) { mid = (idx + right) / 2; if (set->elems[mid] < elem) idx = mid + 1; else right = mid; } return set->elems[idx] == elem ? idx + 1 : 0; } static void re_node_set_remove_at (re_node_set *set, Idx idx) { if (idx < 0 || idx >= set->nelem) return; --set->nelem; for (; idx < set->nelem; idx++) set->elems[idx] = set->elems[idx + 1]; } /* Add the token TOKEN to dfa->nodes, and return the index of the token. Or return -1 if an error occurred. */ static Idx re_dfa_add_node (re_dfa_t *dfa, re_token_t token) { if (__glibc_unlikely (dfa->nodes_len >= dfa->nodes_alloc)) { size_t new_nodes_alloc = dfa->nodes_alloc * 2; Idx *new_nexts, *new_indices; re_node_set *new_edests, *new_eclosures; re_token_t *new_nodes; /* Avoid overflows in realloc. */ const size_t max_object_size = MAX (sizeof (re_token_t), MAX (sizeof (re_node_set), sizeof (Idx))); if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_nodes_alloc)) return -1; new_nodes = re_realloc (dfa->nodes, re_token_t, new_nodes_alloc); if (__glibc_unlikely (new_nodes == NULL)) return -1; dfa->nodes = new_nodes; new_nexts = re_realloc (dfa->nexts, Idx, new_nodes_alloc); new_indices = re_realloc (dfa->org_indices, Idx, new_nodes_alloc); new_edests = re_realloc (dfa->edests, re_node_set, new_nodes_alloc); new_eclosures = re_realloc (dfa->eclosures, re_node_set, new_nodes_alloc); if (__glibc_unlikely (new_nexts == NULL || new_indices == NULL || new_edests == NULL || new_eclosures == NULL)) { re_free (new_nexts); re_free (new_indices); re_free (new_edests); re_free (new_eclosures); return -1; } dfa->nexts = new_nexts; dfa->org_indices = new_indices; dfa->edests = new_edests; dfa->eclosures = new_eclosures; dfa->nodes_alloc = new_nodes_alloc; } dfa->nodes[dfa->nodes_len] = token; dfa->nodes[dfa->nodes_len].constraint = 0; #ifdef RE_ENABLE_I18N dfa->nodes[dfa->nodes_len].accept_mb = ((token.type == OP_PERIOD && dfa->mb_cur_max > 1) || token.type == COMPLEX_BRACKET); #endif dfa->nexts[dfa->nodes_len] = -1; re_node_set_init_empty (dfa->edests + dfa->nodes_len); re_node_set_init_empty (dfa->eclosures + dfa->nodes_len); return dfa->nodes_len++; } static re_hashval_t calc_state_hash (const re_node_set *nodes, unsigned int context) { re_hashval_t hash = nodes->nelem + context; Idx i; for (i = 0 ; i < nodes->nelem ; i++) hash += nodes->elems[i]; return hash; } /* Search for the state whose node_set is equivalent to NODES. Return the pointer to the state, if we found it in the DFA. Otherwise create the new one and return it. In case of an error return NULL and set the error code in ERR. Note: - We assume NULL as the invalid state, then it is possible that return value is NULL and ERR is REG_NOERROR. - We never return non-NULL value in case of any errors, it is for optimization. */ static re_dfastate_t * __attribute_warn_unused_result__ re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa, const re_node_set *nodes) { re_hashval_t hash; re_dfastate_t *new_state; struct re_state_table_entry *spot; Idx i; #if defined GCC_LINT || defined lint /* Suppress bogus uninitialized-variable warnings. */ *err = REG_NOERROR; #endif if (__glibc_unlikely (nodes->nelem == 0)) { *err = REG_NOERROR; return NULL; } hash = calc_state_hash (nodes, 0); spot = dfa->state_table + (hash & dfa->state_hash_mask); for (i = 0 ; i < spot->num ; i++) { re_dfastate_t *state = spot->array[i]; if (hash != state->hash) continue; if (re_node_set_compare (&state->nodes, nodes)) return state; } /* There are no appropriate state in the dfa, create the new one. */ new_state = create_ci_newstate (dfa, nodes, hash); if (__glibc_unlikely (new_state == NULL)) *err = REG_ESPACE; return new_state; } /* Search for the state whose node_set is equivalent to NODES and whose context is equivalent to CONTEXT. Return the pointer to the state, if we found it in the DFA. Otherwise create the new one and return it. In case of an error return NULL and set the error code in ERR. Note: - We assume NULL as the invalid state, then it is possible that return value is NULL and ERR is REG_NOERROR. - We never return non-NULL value in case of any errors, it is for optimization. */ static re_dfastate_t * __attribute_warn_unused_result__ re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa, const re_node_set *nodes, unsigned int context) { re_hashval_t hash; re_dfastate_t *new_state; struct re_state_table_entry *spot; Idx i; #if defined GCC_LINT || defined lint /* Suppress bogus uninitialized-variable warnings. */ *err = REG_NOERROR; #endif if (nodes->nelem == 0) { *err = REG_NOERROR; return NULL; } hash = calc_state_hash (nodes, context); spot = dfa->state_table + (hash & dfa->state_hash_mask); for (i = 0 ; i < spot->num ; i++) { re_dfastate_t *state = spot->array[i]; if (state->hash == hash && state->context == context && re_node_set_compare (state->entrance_nodes, nodes)) return state; } /* There are no appropriate state in 'dfa', create the new one. */ new_state = create_cd_newstate (dfa, nodes, context, hash); if (__glibc_unlikely (new_state == NULL)) *err = REG_ESPACE; return new_state; } /* Finish initialization of the new state NEWSTATE, and using its hash value HASH put in the appropriate bucket of DFA's state table. Return value indicates the error code if failed. */ static reg_errcode_t __attribute_warn_unused_result__ register_state (const re_dfa_t *dfa, re_dfastate_t *newstate, re_hashval_t hash) { struct re_state_table_entry *spot; reg_errcode_t err; Idx i; newstate->hash = hash; err = re_node_set_alloc (&newstate->non_eps_nodes, newstate->nodes.nelem); if (__glibc_unlikely (err != REG_NOERROR)) return REG_ESPACE; for (i = 0; i < newstate->nodes.nelem; i++) { Idx elem = newstate->nodes.elems[i]; if (!IS_EPSILON_NODE (dfa->nodes[elem].type)) if (! re_node_set_insert_last (&newstate->non_eps_nodes, elem)) return REG_ESPACE; } spot = dfa->state_table + (hash & dfa->state_hash_mask); if (__glibc_unlikely (spot->alloc <= spot->num)) { Idx new_alloc = 2 * spot->num + 2; re_dfastate_t **new_array = re_realloc (spot->array, re_dfastate_t *, new_alloc); if (__glibc_unlikely (new_array == NULL)) return REG_ESPACE; spot->array = new_array; spot->alloc = new_alloc; } spot->array[spot->num++] = newstate; return REG_NOERROR; } static void free_state (re_dfastate_t *state) { re_node_set_free (&state->non_eps_nodes); re_node_set_free (&state->inveclosure); if (state->entrance_nodes != &state->nodes) { re_node_set_free (state->entrance_nodes); re_free (state->entrance_nodes); } re_node_set_free (&state->nodes); re_free (state->word_trtable); re_free (state->trtable); re_free (state); } /* Create the new state which is independent of contexts. Return the new state if succeeded, otherwise return NULL. */ static re_dfastate_t * __attribute_warn_unused_result__ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes, re_hashval_t hash) { Idx i; reg_errcode_t err; re_dfastate_t *newstate; newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); if (__glibc_unlikely (newstate == NULL)) return NULL; err = re_node_set_init_copy (&newstate->nodes, nodes); if (__glibc_unlikely (err != REG_NOERROR)) { re_free (newstate); return NULL; } newstate->entrance_nodes = &newstate->nodes; for (i = 0 ; i < nodes->nelem ; i++) { re_token_t *node = dfa->nodes + nodes->elems[i]; re_token_type_t type = node->type; if (type == CHARACTER && !node->constraint) continue; #ifdef RE_ENABLE_I18N newstate->accept_mb |= node->accept_mb; #endif /* RE_ENABLE_I18N */ /* If the state has the halt node, the state is a halt state. */ if (type == END_OF_RE) newstate->halt = 1; else if (type == OP_BACK_REF) newstate->has_backref = 1; else if (type == ANCHOR || node->constraint) newstate->has_constraint = 1; } err = register_state (dfa, newstate, hash); if (__glibc_unlikely (err != REG_NOERROR)) { free_state (newstate); newstate = NULL; } return newstate; } /* Create the new state which is depend on the context CONTEXT. Return the new state if succeeded, otherwise return NULL. */ static re_dfastate_t * __attribute_warn_unused_result__ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes, unsigned int context, re_hashval_t hash) { Idx i, nctx_nodes = 0; reg_errcode_t err; re_dfastate_t *newstate; newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); if (__glibc_unlikely (newstate == NULL)) return NULL; err = re_node_set_init_copy (&newstate->nodes, nodes); if (__glibc_unlikely (err != REG_NOERROR)) { re_free (newstate); return NULL; } newstate->context = context; newstate->entrance_nodes = &newstate->nodes; for (i = 0 ; i < nodes->nelem ; i++) { re_token_t *node = dfa->nodes + nodes->elems[i]; re_token_type_t type = node->type; unsigned int constraint = node->constraint; if (type == CHARACTER && !constraint) continue; #ifdef RE_ENABLE_I18N newstate->accept_mb |= node->accept_mb; #endif /* RE_ENABLE_I18N */ /* If the state has the halt node, the state is a halt state. */ if (type == END_OF_RE) newstate->halt = 1; else if (type == OP_BACK_REF) newstate->has_backref = 1; if (constraint) { if (newstate->entrance_nodes == &newstate->nodes) { re_node_set *entrance_nodes = re_malloc (re_node_set, 1); if (__glibc_unlikely (entrance_nodes == NULL)) { free_state (newstate); return NULL; } newstate->entrance_nodes = entrance_nodes; if (re_node_set_init_copy (newstate->entrance_nodes, nodes) != REG_NOERROR) { free_state (newstate); return NULL; } nctx_nodes = 0; newstate->has_constraint = 1; } if (NOT_SATISFY_PREV_CONSTRAINT (constraint,context)) { re_node_set_remove_at (&newstate->nodes, i - nctx_nodes); ++nctx_nodes; } } } err = register_state (dfa, newstate, hash); if (__glibc_unlikely (err != REG_NOERROR)) { free_state (newstate); newstate = NULL; } return newstate; } kbuild-3608/src/grep/lib/idx.h0000664000175000017500000001025314670377424016154 0ustar locutuslocutus/* A type for indices and sizes. Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _IDX_H #define _IDX_H /* Get ptrdiff_t. */ #include /* Get PTRDIFF_MAX. */ #include /* The type 'idx_t' holds an (array) index or an (object) size. Its implementation promotes to a signed integer type, which can hold the values 0..2^63-1 (on 64-bit platforms) or 0..2^31-1 (on 32-bit platforms). Why a signed integer type? * Security: Signed types can be checked for overflow via '-fsanitize=undefined', but unsigned types cannot. * Comparisons without surprises: ISO C99 § 6.3.1.8 specifies a few surprising results for comparisons, such as (int) -3 < (unsigned long) 7 => false (int) -3 < (unsigned int) 7 => false and on 32-bit machines: (long) -3 < (unsigned int) 7 => false This is surprising because the natural comparison order is by value in the realm of infinite-precision signed integers (ℤ). The best way to get rid of such surprises is to use signed types for numerical integer values, and use unsigned types only for bit masks and enums. Why not use 'size_t' directly? * Because 'size_t' is an unsigned type, and a signed type is better. See above. Why not use 'ptrdiff_t' directly? * Maintainability: When reading and modifying code, it helps to know that a certain variable cannot have negative values. For example, when you have a loop int n = ...; for (int i = 0; i < n; i++) ... or ptrdiff_t n = ...; for (ptrdiff_t i = 0; i < n; i++) ... you have to ask yourself "what if n < 0?". Whereas in idx_t n = ...; for (idx_t i = 0; i < n; i++) ... you know that this case cannot happen. Similarly, when a programmer writes idx_t = ptr2 - ptr1; there is an implied assertion that ptr1 and ptr2 point into the same object and that ptr1 <= ptr2. * Being future-proof: In the future, range types (integers which are constrained to a certain range of values) may be added to C compilers or to the C standard. Several programming languages (Ada, Haskell, Common Lisp, Pascal) already have range types. Such range types may help producing good code and good warnings. The type 'idx_t' could then be typedef'ed to a range type that is signed after promotion. */ /* In the future, idx_t could be typedef'ed to a signed range type. The clang "extended integer types", supported in Clang 11 or newer , are a special case of range types. However, these types don't support binary operators with plain integer types (e.g. expressions such as x > 1). Therefore, they don't behave like signed types (and not like unsigned types either). So, we cannot use them here. */ /* Use the signed type 'ptrdiff_t'. */ /* Note: ISO C does not mandate that 'size_t' and 'ptrdiff_t' have the same size, but it is so on all platforms we have seen since 1990. */ typedef ptrdiff_t idx_t; /* IDX_MAX is the maximum value of an idx_t. */ #define IDX_MAX PTRDIFF_MAX /* So far no need has been found for an IDX_WIDTH macro. Perhaps there should be another macro IDX_VALUE_BITS that does not count the sign bit and is therefore one less than PTRDIFF_WIDTH. */ #endif /* _IDX_H */ kbuild-3608/src/grep/lib/iconv_open-irix.gperf0000664000175000017500000000275314670377423021361 0ustar locutuslocutus/* Character set conversion. Copyright (C) 2007, 2020-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ struct mapping { int standard_name; const char vendor_name[10 + 1]; }; %struct-type %language=ANSI-C %define slot-name standard_name %define hash-function-name mapping_hash %define lookup-function-name mapping_lookup %readonly-tables %global-table %define word-array-name mappings %pic %% # On IRIX 6.5, look in /usr/lib/iconv and /usr/lib/international/encodings. ISO-8859-1, "ISO8859-1" ISO-8859-2, "ISO8859-2" ISO-8859-3, "ISO8859-3" ISO-8859-4, "ISO8859-4" ISO-8859-5, "ISO8859-5" ISO-8859-6, "ISO8859-6" ISO-8859-7, "ISO8859-7" ISO-8859-8, "ISO8859-8" ISO-8859-9, "ISO8859-9" ISO-8859-15, "ISO8859-15" KOI8-R, "KOI8" CP855, "DOS855" CP1251, "WIN1251" GB2312, "eucCN" EUC-JP, "eucJP" EUC-KR, "eucKR" EUC-TW, "eucTW" SHIFT_JIS, "sjis" TIS-620, "TIS620" kbuild-3608/src/grep/lib/windows-mutex.c0000664000175000017500000000524014670377426020217 0ustar locutuslocutus/* Plain mutexes (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-win32.h. */ #include /* Specification. */ #include "windows-mutex.h" #include void glwthread_mutex_init (glwthread_mutex_t *mutex) { InitializeCriticalSection (&mutex->lock); mutex->guard.done = 1; } int glwthread_mutex_lock (glwthread_mutex_t *mutex) { if (!mutex->guard.done) { if (InterlockedIncrement (&mutex->guard.started) == 0) /* This thread is the first one to need this mutex. Initialize it. */ glwthread_mutex_init (mutex); else { /* Don't let mutex->guard.started grow and wrap around. */ InterlockedDecrement (&mutex->guard.started); /* Yield the CPU while waiting for another thread to finish initializing this mutex. */ while (!mutex->guard.done) Sleep (0); } } EnterCriticalSection (&mutex->lock); return 0; } int glwthread_mutex_trylock (glwthread_mutex_t *mutex) { if (!mutex->guard.done) { if (InterlockedIncrement (&mutex->guard.started) == 0) /* This thread is the first one to need this mutex. Initialize it. */ glwthread_mutex_init (mutex); else { /* Don't let mutex->guard.started grow and wrap around. */ InterlockedDecrement (&mutex->guard.started); /* Let another thread finish initializing this mutex, and let it also lock this mutex. */ return EBUSY; } } if (!TryEnterCriticalSection (&mutex->lock)) return EBUSY; return 0; } int glwthread_mutex_unlock (glwthread_mutex_t *mutex) { if (!mutex->guard.done) return EINVAL; LeaveCriticalSection (&mutex->lock); return 0; } int glwthread_mutex_destroy (glwthread_mutex_t *mutex) { if (!mutex->guard.done) return EINVAL; DeleteCriticalSection (&mutex->lock); mutex->guard.done = 0; return 0; } kbuild-3608/src/grep/lib/creat-safer.c0000664000175000017500000000172314670377423017560 0ustar locutuslocutus/* Invoke creat, but avoid some glitches. Copyright (C) 2005-2006, 2009-2021 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 . */ /* Written by Jim Meyering. */ #include #include "fcntl-safer.h" #include #include "unistd-safer.h" int creat_safer (char const *file, mode_t mode) { return fd_safer (creat (file, mode)); } kbuild-3608/src/grep/lib/malloc.c0000664000175000017500000000243014670377426016632 0ustar locutuslocutus/* malloc() function that is glibc compatible. Copyright (C) 1997-1998, 2006-2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Jim Meyering and Bruno Haible */ #define _GL_USE_STDLIB_ALLOC 1 #include #include #include #include "xalloc-oversized.h" /* Allocate an N-byte block of memory from the heap, even if N is 0. */ void * rpl_malloc (size_t n) { if (n == 0) n = 1; if (xalloc_oversized (n, 1)) { errno = ENOMEM; return NULL; } void *result = malloc (n); #if !HAVE_MALLOC_POSIX if (result == NULL) errno = ENOMEM; #endif return result; } kbuild-3608/src/grep/lib/memchr2.c0000664000175000017500000001457114670377425016730 0ustar locutuslocutus/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2021 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), with help from Dan Sahlin (dan@sics.se) and commentary by Jim Blandy (jimb@ai.mit.edu); adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), and implemented in glibc by Roland McGrath (roland@ai.mit.edu). Extension to memchr2 implemented by Eric Blake (ebb9@byu.net). 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include "memchr2.h" #include #include #include /* Return the first address of either C1 or C2 (treated as unsigned char) that occurs within N bytes of the memory region S. If neither byte appears, return NULL. */ void * memchr2 (void const *s, int c1_in, int c2_in, size_t n) { /* On 32-bit hardware, choosing longword to be a 32-bit unsigned long instead of a 64-bit uintmax_t tends to give better performance. On 64-bit hardware, unsigned long is generally 64 bits already. Change this typedef to experiment with performance. */ typedef unsigned long int longword; const unsigned char *char_ptr; void const *void_ptr; const longword *longword_ptr; longword repeated_one; longword repeated_c1; longword repeated_c2; unsigned char c1; unsigned char c2; c1 = (unsigned char) c1_in; c2 = (unsigned char) c2_in; if (c1 == c2) return memchr (s, c1, n); /* Handle the first few bytes by reading one byte at a time. Do this until VOID_PTR is aligned on a longword boundary. */ for (void_ptr = s; n > 0 && (uintptr_t) void_ptr % sizeof (longword) != 0; --n) { char_ptr = void_ptr; if (*char_ptr == c1 || *char_ptr == c2) return (void *) void_ptr; void_ptr = char_ptr + 1; } longword_ptr = void_ptr; /* All these elucidatory comments refer to 4-byte longwords, but the theory applies equally well to any size longwords. */ /* Compute auxiliary longword values: repeated_one is a value which has a 1 in every byte. repeated_c1 has c1 in every byte. repeated_c2 has c2 in every byte. */ repeated_one = 0x01010101; repeated_c1 = c1 | (c1 << 8); repeated_c2 = c2 | (c2 << 8); repeated_c1 |= repeated_c1 << 16; repeated_c2 |= repeated_c2 << 16; if (0xffffffffU < (longword) -1) { repeated_one |= repeated_one << 31 << 1; repeated_c1 |= repeated_c1 << 31 << 1; repeated_c2 |= repeated_c2 << 31 << 1; if (8 < sizeof (longword)) { size_t i; for (i = 64; i < sizeof (longword) * 8; i *= 2) { repeated_one |= repeated_one << i; repeated_c1 |= repeated_c1 << i; repeated_c2 |= repeated_c2 << i; } } } /* Instead of the traditional loop which tests each byte, we will test a longword at a time. The tricky part is testing if *any of the four* bytes in the longword in question are equal to c1 or c2. We first use an xor with repeated_c1 and repeated_c2, respectively. This reduces the task to testing whether *any of the four* bytes in longword1 or longword2 is zero. Let's consider longword1. We compute tmp1 = ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). That is, we perform the following operations: 1. Subtract repeated_one. 2. & ~longword1. 3. & a mask consisting of 0x80 in every byte. Consider what happens in each byte: - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, and step 3 transforms it into 0x80. A carry can also be propagated to more significant bytes. - If a byte of longword1 is nonzero, let its lowest 1 bit be at position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, the byte ends in a single bit of value 0 and k bits of value 1. After step 2, the result is just k bits of value 1: 2^k - 1. After step 3, the result is 0. And no carry is produced. So, if longword1 has only non-zero bytes, tmp1 is zero. Whereas if longword1 has a zero byte, call j the position of the least significant zero byte. Then the result has a zero at positions 0, ..., j-1 and a 0x80 at position j. We cannot predict the result at the more significant bytes (positions j+1..3), but it does not matter since we already have a non-zero bit at position 8*j+7. Similarly, we compute tmp2 = ((longword2 - repeated_one) & ~longword2) & (repeated_one << 7). The test whether any byte in longword1 or longword2 is zero is equivalent to testing whether tmp1 is nonzero or tmp2 is nonzero. We can combine this into a single test, whether (tmp1 | tmp2) is nonzero. */ while (n >= sizeof (longword)) { longword longword1 = *longword_ptr ^ repeated_c1; longword longword2 = *longword_ptr ^ repeated_c2; if (((((longword1 - repeated_one) & ~longword1) | ((longword2 - repeated_one) & ~longword2)) & (repeated_one << 7)) != 0) break; longword_ptr++; n -= sizeof (longword); } char_ptr = (const unsigned char *) longword_ptr; /* At this point, we know that either n < sizeof (longword), or one of the sizeof (longword) bytes starting at char_ptr is == c1 or == c2. On little-endian machines, we could determine the first such byte without any further memory accesses, just by looking at the (tmp1 | tmp2) result from the last loop iteration. But this does not work on big-endian machines. Choose code that works in both cases. */ for (; n > 0; --n, ++char_ptr) { if (*char_ptr == c1 || *char_ptr == c2) return (void *) char_ptr; } return NULL; } kbuild-3608/src/grep/lib/quotearg.h0000664000175000017500000004243314670377426017226 0ustar locutuslocutus/* quotearg.h - quote arguments for output Copyright (C) 1998-2002, 2004, 2006, 2008-2021 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 . */ /* Written by Paul Eggert */ #ifndef QUOTEARG_H_ # define QUOTEARG_H_ 1 # include /* Basic quoting styles. For each style, an example is given on the input strings "simple", "\0 \t\n'\"\033?""?/\\", and "a:b", using quotearg_buffer, quotearg_mem, and quotearg_colon_mem with that style and the default flags and quoted characters. Note that the examples are shown here as valid C strings rather than what displays on a terminal (with "??/" as a trigraph for "\\"). */ enum quoting_style { /* Output names as-is (ls --quoting-style=literal). Can result in embedded null bytes if QA_ELIDE_NULL_BYTES is not in effect. quotearg_buffer: "simple", "\0 \t\n'\"\033??/\\", "a:b" quotearg: "simple", " \t\n'\"\033??/\\", "a:b" quotearg_colon: "simple", " \t\n'\"\033??/\\", "a:b" */ literal_quoting_style, /* Quote names for the shell if they contain shell metacharacters or would cause ambiguous output (ls --quoting-style=shell). Can result in embedded null bytes if QA_ELIDE_NULL_BYTES is not in effect. quotearg_buffer: "simple", "'\0 \t\n'\\''\"\033??/\\'", "a:b" quotearg: "simple", "' \t\n'\\''\"\033??/\\'", "a:b" quotearg_colon: "simple", "' \t\n'\\''\"\033??/\\'", "'a:b'" */ shell_quoting_style, /* Quote names for the shell, even if they would normally not require quoting (ls --quoting-style=shell-always). Can result in embedded null bytes if QA_ELIDE_NULL_BYTES is not in effect. Behaves like shell_quoting_style if QA_ELIDE_OUTER_QUOTES is in effect. quotearg_buffer: "'simple'", "'\0 \t\n'\\''\"\033??/\\'", "'a:b'" quotearg: "'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'" quotearg_colon: "'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'" */ shell_always_quoting_style, /* Quote names for the shell if they contain shell metacharacters or other problematic characters (ls --quoting-style=shell-escape). Non printable characters are quoted using the $'...' syntax, which originated in ksh93 and is widely supported by most shells, and proposed for inclusion in POSIX. quotearg_buffer: "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "a:b" quotearg: "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "a:b" quotearg_colon: "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "'a:b'" */ shell_escape_quoting_style, /* Quote names for the shell even if they would normally not require quoting (ls --quoting-style=shell-escape). Non printable characters are quoted using the $'...' syntax, which originated in ksh93 and is widely supported by most shells, and proposed for inclusion in POSIX. Behaves like shell_escape_quoting_style if QA_ELIDE_OUTER_QUOTES is in effect. quotearg_buffer: "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "a:b" quotearg: "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "a:b" quotearg_colon: "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "'a:b'" */ shell_escape_always_quoting_style, /* Quote names as for a C language string (ls --quoting-style=c). Behaves like c_maybe_quoting_style if QA_ELIDE_OUTER_QUOTES is in effect. Split into consecutive strings if QA_SPLIT_TRIGRAPHS. quotearg_buffer: "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" quotearg: "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" quotearg_colon: "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\"" */ c_quoting_style, /* Like c_quoting_style except omit the surrounding double-quote characters if no quoted characters are encountered. quotearg_buffer: "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b" quotearg: "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b" quotearg_colon: "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" */ c_maybe_quoting_style, /* Like c_quoting_style except always omit the surrounding double-quote characters and ignore QA_SPLIT_TRIGRAPHS (ls --quoting-style=escape). quotearg_buffer: "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b" quotearg: "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b" quotearg_colon: "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a\\:b" */ escape_quoting_style, /* Like clocale_quoting_style, but use single quotes in the default C locale or if the program does not use gettext (ls --quoting-style=locale). For UTF-8 locales, quote characters will use Unicode. LC_MESSAGES=C quotearg_buffer: "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a:b'" quotearg: "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a:b'" quotearg_colon: "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a\\:b'" LC_MESSAGES=pt_PT.utf8 quotearg_buffer: "\302\253simple\302\273", "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" quotearg: "\302\253simple\302\273", "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" quotearg_colon: "\302\253simple\302\273", "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273" */ locale_quoting_style, /* Like c_quoting_style except use quotation marks appropriate for the locale and ignore QA_SPLIT_TRIGRAPHS (ls --quoting-style=clocale). LC_MESSAGES=C quotearg_buffer: "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" quotearg: "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" quotearg_colon: "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\"" LC_MESSAGES=pt_PT.utf8 quotearg_buffer: "\302\253simple\302\273", "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" quotearg: "\302\253simple\302\273", "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" quotearg_colon: "\302\253simple\302\273", "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273" */ clocale_quoting_style, /* Like clocale_quoting_style except use the custom quotation marks set by set_custom_quoting. If custom quotation marks are not set, the behavior is undefined. left_quote = right_quote = "'" quotearg_buffer: "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a:b'" quotearg: "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a:b'" quotearg_colon: "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a\\:b'" left_quote = "(" and right_quote = ")" quotearg_buffer: "(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a:b)" quotearg: "(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a:b)" quotearg_colon: "(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a\\:b)" left_quote = ":" and right_quote = " " quotearg_buffer: ":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a:b " quotearg: ":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a:b " quotearg_colon: ":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a\\:b " left_quote = "\"'" and right_quote = "'\"" Notice that this is treated as a single level of quotes or two levels where the outer quote need not be escaped within the inner quotes. For two levels where the outer quote must be escaped within the inner quotes, you must use separate quotearg invocations. quotearg_buffer: "\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a:b'\"" quotearg: "\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a:b'\"" quotearg_colon: "\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a\\:b'\"" */ custom_quoting_style }; /* Flags for use in set_quoting_flags. */ enum quoting_flags { /* Always elide null bytes from styles that do not quote them, even when the length of the result is available to the caller. */ QA_ELIDE_NULL_BYTES = 0x01, /* Omit the surrounding quote characters if no escaped characters are encountered. Note that if no other character needs escaping, then neither does the escape character. */ QA_ELIDE_OUTER_QUOTES = 0x02, /* In the c_quoting_style and c_maybe_quoting_style, split ANSI trigraph sequences into concatenated strings (for example, "?""?/" rather than "??/", which could be confused with "\\"). */ QA_SPLIT_TRIGRAPHS = 0x04 }; /* For now, --quoting-style=literal is the default, but this may change. */ # ifndef DEFAULT_QUOTING_STYLE # define DEFAULT_QUOTING_STYLE literal_quoting_style # endif /* Names of quoting styles and their corresponding values. */ extern char const *const quoting_style_args[]; extern enum quoting_style const quoting_style_vals[]; struct quoting_options; /* The functions listed below set and use a hidden variable that contains the default quoting style options. */ /* Allocate a new set of quoting options, with contents initially identical to O if O is not null, or to the default if O is null. It is the caller's responsibility to free the result. */ struct quoting_options *clone_quoting_options (struct quoting_options *o) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; /* Get the value of O's quoting style. If O is null, use the default. */ enum quoting_style get_quoting_style (struct quoting_options const *o); /* In O (or in the default if O is null), set the value of the quoting style to S. */ void set_quoting_style (struct quoting_options *o, enum quoting_style s); /* In O (or in the default if O is null), set the value of the quoting options for character C to I. Return the old value. Currently, the only values defined for I are 0 (the default) and 1 (which means to quote the character even if it would not otherwise be quoted). C must never be a digit or a letter that has special meaning after a backslash (for example, "\t" for tab). */ int set_char_quoting (struct quoting_options *o, char c, int i); /* In O (or in the default if O is null), set the value of the quoting options flag to I, which can be a bitwise combination of enum quoting_flags, or 0 for default behavior. Return the old value. */ int set_quoting_flags (struct quoting_options *o, int i); /* In O (or in the default if O is null), set the value of the quoting style to custom_quoting_style, set the left quote to LEFT_QUOTE, and set the right quote to RIGHT_QUOTE. Each of LEFT_QUOTE and RIGHT_QUOTE must be null-terminated and can be the empty string. Because backslashes are used for escaping, it does not make sense for RIGHT_QUOTE to contain a backslash. RIGHT_QUOTE must not begin with a digit or a letter that has special meaning after a backslash (for example, "\t" for tab). */ void set_custom_quoting (struct quoting_options *o, char const *left_quote, char const *right_quote); /* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of argument ARG (of size ARGSIZE), using O to control quoting. If O is null, use the default. Terminate the output with a null character, and return the written size of the output, not counting the terminating null. If BUFFERSIZE is too small to store the output string, return the value that would have been returned had BUFFERSIZE been large enough. If ARGSIZE is -1, use the string length of the argument for ARGSIZE. On output, BUFFER might contain embedded null bytes if ARGSIZE was not -1, the style of O does not use backslash escapes, and the flags of O do not request elision of null bytes.*/ size_t quotearg_buffer (char *restrict buffer, size_t buffersize, char const *arg, size_t argsize, struct quoting_options const *o); /* Like quotearg_buffer, except return the result in a newly allocated buffer. It is the caller's responsibility to free the result. The result will not contain embedded null bytes. */ char *quotearg_alloc (char const *arg, size_t argsize, struct quoting_options const *o) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; /* Like quotearg_alloc, except that the length of the result, excluding the terminating null byte, is stored into SIZE if it is non-NULL. The result might contain embedded null bytes if ARGSIZE was not -1, SIZE was not NULL, the style of O does not use backslash escapes, and the flags of O do not request elision of null bytes.*/ char *quotearg_alloc_mem (char const *arg, size_t argsize, size_t *size, struct quoting_options const *o) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; /* Use storage slot N to return a quoted version of the string ARG. Use the default quoting options. The returned value points to static storage that can be reused by the next call to this function with the same value of N. N must be nonnegative. The output of all functions in the quotearg_n family are guaranteed to not contain embedded null bytes.*/ char *quotearg_n (int n, char const *arg); /* Equivalent to quotearg_n (0, ARG). */ char *quotearg (char const *arg); /* Use storage slot N to return a quoted version of the argument ARG of size ARGSIZE. This is like quotearg_n (N, ARG), except it can quote null bytes. */ char *quotearg_n_mem (int n, char const *arg, size_t argsize); /* Equivalent to quotearg_n_mem (0, ARG, ARGSIZE). */ char *quotearg_mem (char const *arg, size_t argsize); /* Use style S and storage slot N to return a quoted version of the string ARG. This is like quotearg_n (N, ARG), except that it uses S with no other options to specify the quoting method. */ char *quotearg_n_style (int n, enum quoting_style s, char const *arg); /* Use style S and storage slot N to return a quoted version of the argument ARG of size ARGSIZE. This is like quotearg_n_style (N, S, ARG), except it can quote null bytes. */ char *quotearg_n_style_mem (int n, enum quoting_style s, char const *arg, size_t argsize); /* Equivalent to quotearg_n_style (0, S, ARG). */ char *quotearg_style (enum quoting_style s, char const *arg); /* Equivalent to quotearg_n_style_mem (0, S, ARG, ARGSIZE). */ char *quotearg_style_mem (enum quoting_style s, char const *arg, size_t argsize); /* Like quotearg (ARG), except also quote any instances of CH. See set_char_quoting for a description of acceptable CH values. */ char *quotearg_char (char const *arg, char ch); /* Like quotearg_char (ARG, CH), except it can quote null bytes. */ char *quotearg_char_mem (char const *arg, size_t argsize, char ch); /* Equivalent to quotearg_char (ARG, ':'). */ char *quotearg_colon (char const *arg); /* Like quotearg_colon (ARG), except it can quote null bytes. */ char *quotearg_colon_mem (char const *arg, size_t argsize); /* Like quotearg_n_style, except with ':' quoting enabled. */ char *quotearg_n_style_colon (int n, enum quoting_style s, char const *arg); /* Like quotearg_n_style (N, S, ARG) but with S as custom_quoting_style with left quote as LEFT_QUOTE and right quote as RIGHT_QUOTE. See set_custom_quoting for a description of acceptable LEFT_QUOTE and RIGHT_QUOTE values. */ char *quotearg_n_custom (int n, char const *left_quote, char const *right_quote, char const *arg); /* Like quotearg_n_custom (N, LEFT_QUOTE, RIGHT_QUOTE, ARG) except it can quote null bytes. */ char *quotearg_n_custom_mem (int n, char const *left_quote, char const *right_quote, char const *arg, size_t argsize); /* Equivalent to quotearg_n_custom (0, LEFT_QUOTE, RIGHT_QUOTE, ARG). */ char *quotearg_custom (char const *left_quote, char const *right_quote, char const *arg); /* Equivalent to quotearg_n_custom_mem (0, LEFT_QUOTE, RIGHT_QUOTE, ARG, ARGSIZE). */ char *quotearg_custom_mem (char const *left_quote, char const *right_quote, char const *arg, size_t argsize); /* Free any dynamically allocated memory. */ void quotearg_free (void); #endif /* !QUOTEARG_H_ */ kbuild-3608/src/grep/lib/strnlen1.c0000664000175000017500000000240714670377426017135 0ustar locutuslocutus/* Find the length of STRING + 1, but scan at most MAXLEN bytes. Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "strnlen1.h" #include /* Find the length of STRING + 1, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many characters, return MAXLEN. */ /* This is the same as strnlen (string, maxlen - 1) + 1. */ size_t strnlen1 (const char *string, size_t maxlen) { const char *end = (const char *) memchr (string, '\0', maxlen); if (end != NULL) return end - string + 1; else return maxlen; } kbuild-3608/src/grep/lib/sys_stat.in.h0000664000175000017500000006265314670377426017663 0ustar locutuslocutus/* Provide a more complete sys/stat.h header file. Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ /* This file is supposed to be used on platforms where is incomplete. It is intended to provide definitions and prototypes needed by an application. Start with what the system provides. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined __need_system_sys_stat_h /* Special invocation convention. */ #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_SYS_STAT_H /* Get nlink_t. May also define off_t to a 64-bit type on native Windows. */ #include /* Get struct timespec. */ #include /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ #ifndef _@GUARD_PREFIX@_SYS_STAT_H #define _@GUARD_PREFIX@_SYS_STAT_H /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Before doing "#define mknod rpl_mknod" below, we need to include all headers that may declare mknod(). OS/2 kLIBC declares mknod() in , not in . */ #ifdef __KLIBC__ # include #endif /* Before doing "#define mkdir rpl_mkdir" below, we need to include all headers that may declare mkdir(). Native Windows platforms declare mkdir in and/or , not in . */ #if defined _WIN32 && ! defined __CYGWIN__ # include /* mingw32, mingw64 */ # include /* mingw64, MSVC 9 */ #endif /* Native Windows platforms declare umask() in . */ #if 0 && (defined _WIN32 && ! defined __CYGWIN__) # include #endif /* Large File Support on native Windows. */ #if @WINDOWS_64_BIT_ST_SIZE@ # define stat _stati64 #endif /* Optionally, override 'struct stat' on native Windows. */ #if @GNULIB_OVERRIDES_STRUCT_STAT@ # undef stat # if @GNULIB_STAT@ # define stat rpl_stat # else /* Provoke a clear link error if stat() is used as a function and module 'stat' is not in use. */ # define stat stat_used_without_requesting_gnulib_module_stat # endif # if !GNULIB_defined_struct_stat struct stat { dev_t st_dev; ino_t st_ino; mode_t st_mode; nlink_t st_nlink; # if 0 uid_t st_uid; # else /* uid_t is not defined by default on native Windows. */ short st_uid; # endif # if 0 gid_t st_gid; # else /* gid_t is not defined by default on native Windows. */ short st_gid; # endif dev_t st_rdev; off_t st_size; # if 0 blksize_t st_blksize; blkcnt_t st_blocks; # endif # if @WINDOWS_STAT_TIMESPEC@ struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; # else time_t st_atime; time_t st_mtime; time_t st_ctime; # endif }; # if @WINDOWS_STAT_TIMESPEC@ # define st_atime st_atim.tv_sec # define st_mtime st_mtim.tv_sec # define st_ctime st_ctim.tv_sec /* Indicator, for gnulib internal purposes. */ # define _GL_WINDOWS_STAT_TIMESPEC 1 # endif # define GNULIB_defined_struct_stat 1 # endif /* Other possible values of st_mode. */ # if 0 # define _S_IFBLK 0x6000 # endif # if 0 # define _S_IFLNK 0xA000 # endif # if 0 # define _S_IFSOCK 0xC000 # endif #endif #ifndef S_IFIFO # ifdef _S_IFIFO # define S_IFIFO _S_IFIFO # endif #endif #ifndef S_IFMT # define S_IFMT 0170000 #endif #if STAT_MACROS_BROKEN # undef S_ISBLK # undef S_ISCHR # undef S_ISDIR # undef S_ISFIFO # undef S_ISLNK # undef S_ISNAM # undef S_ISMPB # undef S_ISMPC # undef S_ISNWK # undef S_ISREG # undef S_ISSOCK #endif #ifndef S_ISBLK # ifdef S_IFBLK # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) # else # define S_ISBLK(m) 0 # endif #endif #ifndef S_ISCHR # ifdef S_IFCHR # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) # else # define S_ISCHR(m) 0 # endif #endif #ifndef S_ISDIR # ifdef S_IFDIR # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) # else # define S_ISDIR(m) 0 # endif #endif #ifndef S_ISDOOR /* Solaris 2.5 and up */ # define S_ISDOOR(m) 0 #endif #ifndef S_ISFIFO # ifdef S_IFIFO # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) # else # define S_ISFIFO(m) 0 # endif #endif #ifndef S_ISLNK # ifdef S_IFLNK # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) # else # define S_ISLNK(m) 0 # endif #endif #ifndef S_ISMPB /* V7 */ # ifdef S_IFMPB # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) # else # define S_ISMPB(m) 0 # define S_ISMPC(m) 0 # endif #endif #ifndef S_ISMPX /* AIX */ # define S_ISMPX(m) 0 #endif #ifndef S_ISNAM /* Xenix */ # ifdef S_IFNAM # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) # else # define S_ISNAM(m) 0 # endif #endif #ifndef S_ISNWK /* HP/UX */ # ifdef S_IFNWK # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) # else # define S_ISNWK(m) 0 # endif #endif #ifndef S_ISPORT /* Solaris 10 and up */ # define S_ISPORT(m) 0 #endif #ifndef S_ISREG # ifdef S_IFREG # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) # else # define S_ISREG(m) 0 # endif #endif #ifndef S_ISSOCK # ifdef S_IFSOCK # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) # else # define S_ISSOCK(m) 0 # endif #endif #ifndef S_TYPEISMQ # define S_TYPEISMQ(p) 0 #endif #ifndef S_TYPEISTMO # define S_TYPEISTMO(p) 0 #endif #ifndef S_TYPEISSEM # ifdef S_INSEM # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) # else # define S_TYPEISSEM(p) 0 # endif #endif #ifndef S_TYPEISSHM # ifdef S_INSHD # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) # else # define S_TYPEISSHM(p) 0 # endif #endif /* high performance ("contiguous data") */ #ifndef S_ISCTG # define S_ISCTG(p) 0 #endif /* Cray DMF (data migration facility): off line, with data */ #ifndef S_ISOFD # define S_ISOFD(p) 0 #endif /* Cray DMF (data migration facility): off line, with no data */ #ifndef S_ISOFL # define S_ISOFL(p) 0 #endif /* 4.4BSD whiteout */ #ifndef S_ISWHT # define S_ISWHT(m) 0 #endif /* If any of the following are undefined, define them to their de facto standard values. */ #if !S_ISUID # define S_ISUID 04000 #endif #if !S_ISGID # define S_ISGID 02000 #endif /* S_ISVTX is a common extension to POSIX. */ #ifndef S_ISVTX # define S_ISVTX 01000 #endif #if !S_IRUSR && S_IREAD # define S_IRUSR S_IREAD #endif #if !S_IRUSR # define S_IRUSR 00400 #endif #if !S_IRGRP # define S_IRGRP (S_IRUSR >> 3) #endif #if !S_IROTH # define S_IROTH (S_IRUSR >> 6) #endif #if !S_IWUSR && S_IWRITE # define S_IWUSR S_IWRITE #endif #if !S_IWUSR # define S_IWUSR 00200 #endif #if !S_IWGRP # define S_IWGRP (S_IWUSR >> 3) #endif #if !S_IWOTH # define S_IWOTH (S_IWUSR >> 6) #endif #if !S_IXUSR && S_IEXEC # define S_IXUSR S_IEXEC #endif #if !S_IXUSR # define S_IXUSR 00100 #endif #if !S_IXGRP # define S_IXGRP (S_IXUSR >> 3) #endif #if !S_IXOTH # define S_IXOTH (S_IXUSR >> 6) #endif #if !S_IRWXU # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) #endif #if !S_IRWXG # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) #endif #if !S_IRWXO # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) #endif /* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are not implemented in GNU/Linux, some Gnulib-using apps use the macros. */ #if !S_IXUGO # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) #endif #ifndef S_IRWXUGO # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) #endif /* Macros for futimens and utimensat. */ #ifndef UTIME_NOW # define UTIME_NOW (-1) # define UTIME_OMIT (-2) #endif #if @GNULIB_MDA_CHMOD@ /* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::chmod always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef chmod # define chmod _chmod # endif /* Need to cast, because in mingw the last argument is 'int mode'. */ _GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode)); # else _GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode)); # endif _GL_CXXALIASWARN (chmod); #endif #if @GNULIB_FCHMODAT@ # if @REPLACE_FCHMODAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fchmodat # define fchmodat rpl_fchmodat # endif _GL_FUNCDECL_RPL (fchmodat, int, (int fd, char const *file, mode_t mode, int flag) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (fchmodat, int, (int fd, char const *file, mode_t mode, int flag)); # else # if !@HAVE_FCHMODAT@ _GL_FUNCDECL_SYS (fchmodat, int, (int fd, char const *file, mode_t mode, int flag) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (fchmodat, int, (int fd, char const *file, mode_t mode, int flag)); # endif _GL_CXXALIASWARN (fchmodat); #elif defined GNULIB_POSIXCHECK # undef fchmodat # if HAVE_RAW_DECL_FCHMODAT _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " "use gnulib module openat for portability"); # endif #endif #if @GNULIB_FSTAT@ # if @REPLACE_FSTAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fstat # define fstat rpl_fstat # endif _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); # else _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fstat); # endif #elif @GNULIB_OVERRIDES_STRUCT_STAT@ # undef fstat # define fstat fstat_used_without_requesting_gnulib_module_fstat #elif @WINDOWS_64_BIT_ST_SIZE@ /* Above, we define stat to _stati64. */ # define fstat _fstati64 #elif defined GNULIB_POSIXCHECK # undef fstat # if HAVE_RAW_DECL_FSTAT _GL_WARN_ON_USE (fstat, "fstat has portability problems - " "use gnulib module fstat for portability"); # endif #endif #if @GNULIB_FSTATAT@ # if @REPLACE_FSTATAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fstatat # define fstatat rpl_fstatat # endif _GL_FUNCDECL_RPL (fstatat, int, (int fd, char const *restrict name, struct stat *restrict st, int flags) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (fstatat, int, (int fd, char const *restrict name, struct stat *restrict st, int flags)); # else # if !@HAVE_FSTATAT@ _GL_FUNCDECL_SYS (fstatat, int, (int fd, char const *restrict name, struct stat *restrict st, int flags) _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (fstatat, int, (int fd, char const *restrict name, struct stat *restrict st, int flags)); # endif _GL_CXXALIASWARN (fstatat); #elif @GNULIB_OVERRIDES_STRUCT_STAT@ # undef fstatat # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat #elif defined GNULIB_POSIXCHECK # undef fstatat # if HAVE_RAW_DECL_FSTATAT _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " "use gnulib module openat for portability"); # endif #endif #if @GNULIB_FUTIMENS@ /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens implementation relies on futimesat, which on Solaris 10 makes an invocation to futimens that is meant to invoke the libc's futimens(), not gnulib's futimens(). */ # if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef futimens # define futimens rpl_futimens # endif _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); # else # if !@HAVE_FUTIMENS@ _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); # endif _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); # endif # if @HAVE_FUTIMENS@ _GL_CXXALIASWARN (futimens); # endif #elif defined GNULIB_POSIXCHECK # undef futimens # if HAVE_RAW_DECL_FUTIMENS _GL_WARN_ON_USE (futimens, "futimens is not portable - " "use gnulib module futimens for portability"); # endif #endif #if @GNULIB_GETUMASK@ # if !@HAVE_GETUMASK@ _GL_FUNCDECL_SYS (getumask, mode_t, (void)); # endif _GL_CXXALIAS_SYS (getumask, mode_t, (void)); # if @HAVE_GETUMASK@ _GL_CXXALIASWARN (getumask); # endif #elif defined GNULIB_POSIXCHECK # undef getumask # if HAVE_RAW_DECL_GETUMASK _GL_WARN_ON_USE (getumask, "getumask is not portable - " "use gnulib module getumask for portability"); # endif #endif #if @GNULIB_LCHMOD@ /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME denotes a symbolic link. */ # if !@HAVE_LCHMOD@ || defined __hpux _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); _GL_CXXALIASWARN (lchmod); #elif defined GNULIB_POSIXCHECK # undef lchmod # if HAVE_RAW_DECL_LCHMOD _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " "use gnulib module lchmod for portability"); # endif #endif #if @GNULIB_LSTAT@ # if ! @HAVE_LSTAT@ /* mingw does not support symlinks, therefore it does not have lstat. But without links, stat does just fine. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lstat stat # endif _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *restrict name, struct stat *restrict buf)); # elif @REPLACE_LSTAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef lstat # define lstat rpl_lstat # endif _GL_FUNCDECL_RPL (lstat, int, (const char *restrict name, struct stat *restrict buf) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (lstat, int, (const char *restrict name, struct stat *restrict buf)); # else _GL_CXXALIAS_SYS (lstat, int, (const char *restrict name, struct stat *restrict buf)); # endif # if @HAVE_LSTAT@ _GL_CXXALIASWARN (lstat); # endif #elif @GNULIB_OVERRIDES_STRUCT_STAT@ # undef lstat # define lstat lstat_used_without_requesting_gnulib_module_lstat #elif defined GNULIB_POSIXCHECK # undef lstat # if HAVE_RAW_DECL_LSTAT _GL_WARN_ON_USE (lstat, "lstat is unportable - " "use gnulib module lstat for portability"); # endif #endif #if @GNULIB_MKDIR@ # if @REPLACE_MKDIR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mkdir # define mkdir rpl_mkdir # endif _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); # elif defined _WIN32 && !defined __CYGWIN__ /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. Additionally, it declares _mkdir (and depending on compile flags, an alias mkdir), only in the nonstandard includes and , which are included above. */ # if !GNULIB_defined_rpl_mkdir static int rpl_mkdir (char const *name, mode_t mode) { return _mkdir (name); } # define GNULIB_defined_rpl_mkdir 1 # endif # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mkdir # define mkdir rpl_mkdir # endif _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); # else _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); # endif _GL_CXXALIASWARN (mkdir); #elif defined GNULIB_POSIXCHECK # undef mkdir # if HAVE_RAW_DECL_MKDIR _GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - " "use gnulib module mkdir for portability"); # endif #elif @GNULIB_MDA_MKDIR@ /* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::mkdir always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !GNULIB_defined_rpl_mkdir static int rpl_mkdir (char const *name, mode_t mode) { return _mkdir (name); } # define GNULIB_defined_rpl_mkdir 1 # endif # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mkdir # define mkdir rpl_mkdir # endif _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); # else _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); # endif _GL_CXXALIASWARN (mkdir); #endif #if @GNULIB_MKDIRAT@ # if !@HAVE_MKDIRAT@ _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); _GL_CXXALIASWARN (mkdirat); #elif defined GNULIB_POSIXCHECK # undef mkdirat # if HAVE_RAW_DECL_MKDIRAT _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " "use gnulib module openat for portability"); # endif #endif #if @GNULIB_MKFIFO@ # if @REPLACE_MKFIFO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mkfifo # define mkfifo rpl_mkfifo # endif _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); # else # if !@HAVE_MKFIFO@ _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); # endif _GL_CXXALIASWARN (mkfifo); #elif defined GNULIB_POSIXCHECK # undef mkfifo # if HAVE_RAW_DECL_MKFIFO _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " "use gnulib module mkfifo for portability"); # endif #endif #if @GNULIB_MKFIFOAT@ # if @REPLACE_MKFIFOAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mkfifoat # define mkfifoat rpl_mkfifoat # endif _GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)); # else # if !@HAVE_MKFIFOAT@ _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); # endif _GL_CXXALIASWARN (mkfifoat); #elif defined GNULIB_POSIXCHECK # undef mkfifoat # if HAVE_RAW_DECL_MKFIFOAT _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " "use gnulib module mkfifoat for portability"); # endif #endif #if @GNULIB_MKNOD@ # if @REPLACE_MKNOD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mknod # define mknod rpl_mknod # endif _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); # else # if !@HAVE_MKNOD@ _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) _GL_ARG_NONNULL ((1))); # endif /* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev)); # endif _GL_CXXALIASWARN (mknod); #elif defined GNULIB_POSIXCHECK # undef mknod # if HAVE_RAW_DECL_MKNOD _GL_WARN_ON_USE (mknod, "mknod is not portable - " "use gnulib module mknod for portability"); # endif #endif #if @GNULIB_MKNODAT@ # if @REPLACE_MKNODAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mknodat # define mknodat rpl_mknodat # endif _GL_FUNCDECL_RPL (mknodat, int, (int fd, char const *file, mode_t mode, dev_t dev) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mknodat, int, (int fd, char const *file, mode_t mode, dev_t dev)); # else # if !@HAVE_MKNODAT@ _GL_FUNCDECL_SYS (mknodat, int, (int fd, char const *file, mode_t mode, dev_t dev) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (mknodat, int, (int fd, char const *file, mode_t mode, dev_t dev)); # endif _GL_CXXALIASWARN (mknodat); #elif defined GNULIB_POSIXCHECK # undef mknodat # if HAVE_RAW_DECL_MKNODAT _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " "use gnulib module mkfifoat for portability"); # endif #endif #if @GNULIB_STAT@ # if @REPLACE_STAT@ # if !@GNULIB_OVERRIDES_STRUCT_STAT@ /* We can't use the object-like #define stat rpl_stat, because of struct stat. This means that rpl_stat will not be used if the user does (stat)(a,b). Oh well. */ # if defined _AIX && defined stat && defined _LARGE_FILES /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, so we have to replace stat64() instead of stat(). */ # undef stat64 # define stat64(name, st) rpl_stat (name, st) # elif @WINDOWS_64_BIT_ST_SIZE@ /* Above, we define stat to _stati64. */ # if defined __MINGW32__ && defined _stati64 # ifndef _USE_32BIT_TIME_T /* The system headers define _stati64 to _stat64. */ # undef _stat64 # define _stat64(name, st) rpl_stat (name, st) # endif # elif defined _MSC_VER && defined _stati64 # ifdef _USE_32BIT_TIME_T /* The system headers define _stati64 to _stat32i64. */ # undef _stat32i64 # define _stat32i64(name, st) rpl_stat (name, st) # else /* The system headers define _stati64 to _stat64. */ # undef _stat64 # define _stat64(name, st) rpl_stat (name, st) # endif # else # undef _stati64 # define _stati64(name, st) rpl_stat (name, st) # endif # elif defined __MINGW32__ && defined stat # ifdef _USE_32BIT_TIME_T /* The system headers define stat to _stat32i64. */ # undef _stat32i64 # define _stat32i64(name, st) rpl_stat (name, st) # else /* The system headers define stat to _stat64. */ # undef _stat64 # define _stat64(name, st) rpl_stat (name, st) # endif # elif defined _MSC_VER && defined stat # ifdef _USE_32BIT_TIME_T /* The system headers define stat to _stat32. */ # undef _stat32 # define _stat32(name, st) rpl_stat (name, st) # else /* The system headers define stat to _stat64i32. */ # undef _stat64i32 # define _stat64i32(name, st) rpl_stat (name, st) # endif # else /* !(_AIX || __MINGW32__ || _MSC_VER) */ # undef stat # define stat(name, st) rpl_stat (name, st) # endif /* !_LARGE_FILES */ # endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */ _GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf) _GL_ARG_NONNULL ((1, 2)); # endif #elif @GNULIB_OVERRIDES_STRUCT_STAT@ /* see above: #define stat stat_used_without_requesting_gnulib_module_stat */ #elif defined GNULIB_POSIXCHECK # undef stat # if HAVE_RAW_DECL_STAT _GL_WARN_ON_USE (stat, "stat is unportable - " "use gnulib module stat for portability"); # endif #endif #if @GNULIB_MDA_UMASK@ /* On native Windows, map 'umask' to '_umask', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::umask always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef umask # define umask _umask # endif /* Need to cast, because in mingw the last argument is 'int mode'. */ _GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask)); # else _GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask)); # endif _GL_CXXALIASWARN (umask); #endif #if @GNULIB_UTIMENSAT@ /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat implementation relies on futimesat, which on Solaris 10 makes an invocation to utimensat that is meant to invoke the libc's utimensat(), not gnulib's utimensat(). */ # if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef utimensat # define utimensat rpl_utimensat # endif _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, struct timespec const times[2], int flag) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, struct timespec const times[2], int flag)); # else # if !@HAVE_UTIMENSAT@ _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, struct timespec const times[2], int flag) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, struct timespec const times[2], int flag)); # endif # if @HAVE_UTIMENSAT@ _GL_CXXALIASWARN (utimensat); # endif #elif defined GNULIB_POSIXCHECK # undef utimensat # if HAVE_RAW_DECL_UTIMENSAT _GL_WARN_ON_USE (utimensat, "utimensat is not portable - " "use gnulib module utimensat for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_SYS_STAT_H */ #endif /* _@GUARD_PREFIX@_SYS_STAT_H */ #endif kbuild-3608/src/grep/lib/signal.in.h0000664000175000017500000003630314670377426017260 0ustar locutuslocutus/* A GNU-like . Copyright (C) 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T) /* Special invocation convention: - Inside glibc header files. - On glibc systems we have a sequence of nested includes -> -> . In this situation, the functions are not yet declared, therefore we cannot provide the C++ aliases. - On glibc systems with GCC 4.3 we have a sequence of nested includes -> -> -> . In this situation, some of the functions are not yet declared, therefore we cannot provide the C++ aliases. */ # @INCLUDE_NEXT@ @NEXT_SIGNAL_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_SIGNAL_H #define _GL_ALREADY_INCLUDING_SIGNAL_H /* Define pid_t, uid_t. Also, mingw defines sigset_t not in , but in . On Solaris 10, includes , which eventually includes us; so include now, before the second inclusion guard. */ #include /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_SIGNAL_H@ #undef _GL_ALREADY_INCLUDING_SIGNAL_H #ifndef _@GUARD_PREFIX@_SIGNAL_H #define _@GUARD_PREFIX@_SIGNAL_H /* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android, OS/2 kLIBC declare pthread_sigmask in , not in . But avoid namespace pollution on glibc systems.*/ #if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \ && ((defined __APPLE__ && defined __MACH__) \ || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \ || defined __sun || defined __ANDROID__ || defined __KLIBC__) \ && ! defined __GLIBC__ # include #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* On AIX, sig_atomic_t already includes volatile. C99 requires that 'volatile sig_atomic_t' ignore the extra modifier, but C89 did not. Hence, redefine this to a non-volatile type as needed. */ #if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ # if !GNULIB_defined_sig_atomic_t typedef int rpl_sig_atomic_t; # undef sig_atomic_t # define sig_atomic_t rpl_sig_atomic_t # define GNULIB_defined_sig_atomic_t 1 # endif #endif /* A set or mask of signals. */ #if !@HAVE_SIGSET_T@ # if !GNULIB_defined_sigset_t typedef unsigned int sigset_t; # define GNULIB_defined_sigset_t 1 # endif #endif /* Define sighandler_t, the type of signal handlers. A GNU extension. */ #if !@HAVE_SIGHANDLER_T@ # ifdef __cplusplus extern "C" { # endif # if !GNULIB_defined_sighandler_t typedef void (*sighandler_t) (int); # define GNULIB_defined_sighandler_t 1 # endif # ifdef __cplusplus } # endif #endif #if @GNULIB_SIGNAL_H_SIGPIPE@ # ifndef SIGPIPE /* Define SIGPIPE to a value that does not overlap with other signals. */ # define SIGPIPE 13 # define GNULIB_defined_SIGPIPE 1 /* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask', 'write', 'stdio'. */ # endif #endif /* Maximum signal number + 1. */ #ifndef NSIG # if defined __TANDEM # define NSIG 32 # endif #endif #if @GNULIB_PTHREAD_SIGMASK@ # if @REPLACE_PTHREAD_SIGMASK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_sigmask # define pthread_sigmask rpl_pthread_sigmask # endif _GL_FUNCDECL_RPL (pthread_sigmask, int, (int how, const sigset_t *restrict new_mask, sigset_t *restrict old_mask)); _GL_CXXALIAS_RPL (pthread_sigmask, int, (int how, const sigset_t *restrict new_mask, sigset_t *restrict old_mask)); # else # if !(@HAVE_PTHREAD_SIGMASK@ || defined pthread_sigmask) _GL_FUNCDECL_SYS (pthread_sigmask, int, (int how, const sigset_t *restrict new_mask, sigset_t *restrict old_mask)); # endif _GL_CXXALIAS_SYS (pthread_sigmask, int, (int how, const sigset_t *restrict new_mask, sigset_t *restrict old_mask)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_sigmask); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_sigmask # if HAVE_RAW_DECL_PTHREAD_SIGMASK _GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - " "use gnulib module pthread_sigmask for portability"); # endif #endif #if @GNULIB_RAISE@ # if @REPLACE_RAISE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef raise # define raise rpl_raise # endif _GL_FUNCDECL_RPL (raise, int, (int sig)); _GL_CXXALIAS_RPL (raise, int, (int sig)); # else # if !@HAVE_RAISE@ _GL_FUNCDECL_SYS (raise, int, (int sig)); # endif _GL_CXXALIAS_SYS (raise, int, (int sig)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (raise); # endif #elif defined GNULIB_POSIXCHECK # undef raise /* Assume raise is always declared. */ _GL_WARN_ON_USE (raise, "raise can crash on native Windows - " "use gnulib module raise for portability"); #endif #if @GNULIB_SIGPROCMASK@ # if !@HAVE_POSIX_SIGNALBLOCKING@ # ifndef GNULIB_defined_signal_blocking # define GNULIB_defined_signal_blocking 1 # endif /* Maximum signal number + 1. */ # ifndef NSIG # define NSIG 32 # endif /* This code supports only 32 signals. */ # if !GNULIB_defined_verify_NSIG_constraint typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1]; # define GNULIB_defined_verify_NSIG_constraint 1 # endif # endif /* When also using extern inline, suppress the use of static inline in standard headers of problematic Apple configurations, as Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., . Perhaps Apple will fix this some day. */ #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ && (defined __i386__ || defined __x86_64__)) # undef sigaddset # undef sigdelset # undef sigemptyset # undef sigfillset # undef sigismember #endif /* Test whether a given signal is contained in a signal set. */ # if @HAVE_POSIX_SIGNALBLOCKING@ /* This function is defined as a macro on Mac OS X. */ # if defined __cplusplus && defined GNULIB_NAMESPACE # undef sigismember # endif # else _GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig)); _GL_CXXALIASWARN (sigismember); /* Initialize a signal set to the empty set. */ # if @HAVE_POSIX_SIGNALBLOCKING@ /* This function is defined as a macro on Mac OS X. */ # if defined __cplusplus && defined GNULIB_NAMESPACE # undef sigemptyset # endif # else _GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set)); _GL_CXXALIASWARN (sigemptyset); /* Add a signal to a signal set. */ # if @HAVE_POSIX_SIGNALBLOCKING@ /* This function is defined as a macro on Mac OS X. */ # if defined __cplusplus && defined GNULIB_NAMESPACE # undef sigaddset # endif # else _GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig)); _GL_CXXALIASWARN (sigaddset); /* Remove a signal from a signal set. */ # if @HAVE_POSIX_SIGNALBLOCKING@ /* This function is defined as a macro on Mac OS X. */ # if defined __cplusplus && defined GNULIB_NAMESPACE # undef sigdelset # endif # else _GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig)); _GL_CXXALIASWARN (sigdelset); /* Fill a signal set with all possible signals. */ # if @HAVE_POSIX_SIGNALBLOCKING@ /* This function is defined as a macro on Mac OS X. */ # if defined __cplusplus && defined GNULIB_NAMESPACE # undef sigfillset # endif # else _GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set)); _GL_CXXALIASWARN (sigfillset); /* Return the set of those blocked signals that are pending. */ # if !@HAVE_POSIX_SIGNALBLOCKING@ _GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set)); _GL_CXXALIASWARN (sigpending); /* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET. Then, if SET is not NULL, affect the current set of blocked signals by combining it with *SET as indicated in OPERATION. In this implementation, you are not allowed to change a signal handler while the signal is blocked. */ # if !@HAVE_POSIX_SIGNALBLOCKING@ # define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */ # define SIG_SETMASK 1 /* blocked_set = *set; */ # define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */ _GL_FUNCDECL_SYS (sigprocmask, int, (int operation, const sigset_t *restrict set, sigset_t *restrict old_set)); # endif _GL_CXXALIAS_SYS (sigprocmask, int, (int operation, const sigset_t *restrict set, sigset_t *restrict old_set)); _GL_CXXALIASWARN (sigprocmask); /* Install the handler FUNC for signal SIG, and return the previous handler. */ # ifdef __cplusplus extern "C" { # endif # if !GNULIB_defined_function_taking_int_returning_void_t typedef void (*_gl_function_taking_int_returning_void_t) (int); # define GNULIB_defined_function_taking_int_returning_void_t 1 # endif # ifdef __cplusplus } # endif # if !@HAVE_POSIX_SIGNALBLOCKING@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define signal rpl_signal # endif _GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t, (int sig, _gl_function_taking_int_returning_void_t func)); _GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t, (int sig, _gl_function_taking_int_returning_void_t func)); # else /* On OpenBSD, the declaration of 'signal' may not be present at this point, because it occurs in , not directly. */ # if defined __OpenBSD__ _GL_FUNCDECL_SYS (signal, _gl_function_taking_int_returning_void_t, (int sig, _gl_function_taking_int_returning_void_t func)); # endif _GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t, (int sig, _gl_function_taking_int_returning_void_t func)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (signal); # endif # if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE /* Raise signal SIGPIPE. */ _GL_EXTERN_C int _gl_raise_SIGPIPE (void); # endif #elif defined GNULIB_POSIXCHECK # undef sigaddset # if HAVE_RAW_DECL_SIGADDSET _GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - " "use the gnulib module sigprocmask for portability"); # endif # undef sigdelset # if HAVE_RAW_DECL_SIGDELSET _GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - " "use the gnulib module sigprocmask for portability"); # endif # undef sigemptyset # if HAVE_RAW_DECL_SIGEMPTYSET _GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - " "use the gnulib module sigprocmask for portability"); # endif # undef sigfillset # if HAVE_RAW_DECL_SIGFILLSET _GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - " "use the gnulib module sigprocmask for portability"); # endif # undef sigismember # if HAVE_RAW_DECL_SIGISMEMBER _GL_WARN_ON_USE (sigismember, "sigismember is unportable - " "use the gnulib module sigprocmask for portability"); # endif # undef sigpending # if HAVE_RAW_DECL_SIGPENDING _GL_WARN_ON_USE (sigpending, "sigpending is unportable - " "use the gnulib module sigprocmask for portability"); # endif # undef sigprocmask # if HAVE_RAW_DECL_SIGPROCMASK _GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - " "use the gnulib module sigprocmask for portability"); # endif #endif /* @GNULIB_SIGPROCMASK@ */ #if @GNULIB_SIGACTION@ # if !@HAVE_SIGACTION@ # if !@HAVE_SIGINFO_T@ # if !GNULIB_defined_siginfo_types /* Present to allow compilation, but unsupported by gnulib. */ union sigval { int sival_int; void *sival_ptr; }; /* Present to allow compilation, but unsupported by gnulib. */ struct siginfo_t { int si_signo; int si_code; int si_errno; pid_t si_pid; uid_t si_uid; void *si_addr; int si_status; long si_band; union sigval si_value; }; typedef struct siginfo_t siginfo_t; # define GNULIB_defined_siginfo_types 1 # endif # endif /* !@HAVE_SIGINFO_T@ */ /* We assume that platforms which lack the sigaction() function also lack the 'struct sigaction' type, and vice versa. */ # if !GNULIB_defined_struct_sigaction struct sigaction { union { void (*_sa_handler) (int); /* Present to allow compilation, but unsupported by gnulib. POSIX says that implementations may, but not must, make sa_sigaction overlap with sa_handler, but we know of no implementation where they do not overlap. */ void (*_sa_sigaction) (int, siginfo_t *, void *); } _sa_func; sigset_t sa_mask; /* Not all POSIX flags are supported. */ int sa_flags; }; # define sa_handler _sa_func._sa_handler # define sa_sigaction _sa_func._sa_sigaction /* Unsupported flags are not present. */ # define SA_RESETHAND 1 # define SA_NODEFER 2 # define SA_RESTART 4 # define GNULIB_defined_struct_sigaction 1 # endif _GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict, struct sigaction *restrict)); # elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ # define sa_sigaction sa_handler # endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */ _GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict, struct sigaction *restrict)); _GL_CXXALIASWARN (sigaction); #elif defined GNULIB_POSIXCHECK # undef sigaction # if HAVE_RAW_DECL_SIGACTION _GL_WARN_ON_USE (sigaction, "sigaction is unportable - " "use the gnulib module sigaction for portability"); # endif #endif /* Some systems don't have SA_NODEFER. */ #ifndef SA_NODEFER # define SA_NODEFER 0 #endif #endif /* _@GUARD_PREFIX@_SIGNAL_H */ #endif /* _@GUARD_PREFIX@_SIGNAL_H */ #endif kbuild-3608/src/grep/lib/arg-nonnull.h0000664000175000017500000000235314670377423017625 0ustar locutuslocutus/* A C macro for declaring that specific arguments must not be NULL. Copyright (C) 2009-2021 Free Software Foundation, Inc. This program 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 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools that the values passed as arguments n, ..., m must be non-NULL pointers. n = 1 stands for the first argument, n = 2 for the second argument etc. */ #ifndef _GL_ARG_NONNULL # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) # else # define _GL_ARG_NONNULL(params) # endif #endif kbuild-3608/src/grep/lib/error.h0000664000175000017500000000446014670377423016523 0ustar locutuslocutus/* Declaration for error-reporting function Copyright (C) 1995-1997, 2003, 2006, 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _ERROR_H #define _ERROR_H 1 /* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM. */ #include #ifdef __cplusplus extern "C" { #endif /* Print a message with 'fprintf (stderr, FORMAT, ...)'; if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) #if GNULIB_VFPRINTF_POSIX _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 4)) #else _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 3, 4)) #endif ; extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) #if GNULIB_VFPRINTF_POSIX _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 5, 6)) #else _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 5, 6)) #endif ; /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ extern void (*error_print_progname) (void); /* This variable is incremented each time 'error' is called. */ extern unsigned int error_message_count; /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ extern int error_one_per_line; #ifdef __cplusplus } #endif #endif /* error.h */ kbuild-3608/src/grep/lib/dirent-private.h0000664000175000017500000000316114670377422020323 0ustar locutuslocutus/* Private details of the DIR type. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _DIRENT_PRIVATE_H #define _DIRENT_PRIVATE_H 1 #define WIN32_LEAN_AND_MEAN #include /* Don't assume that UNICODE is not defined. */ #undef WIN32_FIND_DATA #define WIN32_FIND_DATA WIN32_FIND_DATAA struct gl_directory { /* Status, or error code to produce in next readdir() call. -2 means the end of the directory is already reached, -1 means the entry was already filled by FindFirstFile, 0 means the entry needs to be filled using FindNextFile. A positive value is an error code. */ int status; /* Handle, reading the directory, at current position. */ HANDLE current; /* Found directory entry. */ WIN32_FIND_DATA entry; /* Argument to pass to FindFirstFile. It consists of the absolutized directory name, followed by a directory separator and the wildcards. */ char dir_name_mask[1]; }; #endif /* _DIRENT_PRIVATE_H */ kbuild-3608/src/grep/lib/fcntl--.h0000664000175000017500000000175314670377422016633 0ustar locutuslocutus/* Like fcntl.h, but redefine some names to avoid glitches. Copyright (C) 2005, 2009-2021 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 . */ /* Written by Paul Eggert. */ #include #include "fcntl-safer.h" #undef open #define open open_safer #undef creat #define creat creat_safer #if GNULIB_OPENAT_SAFER # undef openat # define openat openat_safer #endif kbuild-3608/src/grep/lib/c-ctype.c0000664000175000017500000000151314670377422016724 0ustar locutuslocutus/* Character handling in C locale. Copyright (C) 2003-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #define C_CTYPE_INLINE _GL_EXTERN_INLINE #include "c-ctype.h" kbuild-3608/src/grep/lib/dfa.h0000664000175000017500000001331414670377422016121 0ustar locutuslocutus/* dfa.h - declarations for GNU deterministic regexp compiler Copyright (C) 1988, 1998, 2007, 2009-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA */ /* Written June, 1988 by Mike Haertel */ #ifndef DFA_H_ #define DFA_H_ #include #include #include #include #ifdef __cplusplus extern "C" { #endif struct localeinfo; /* See localeinfo.h. */ /* Element of a list of strings, at least one of which is known to appear in any R.E. matching the DFA. */ struct dfamust { bool exact; bool begline; bool endline; char must[FLEXIBLE_ARRAY_MEMBER]; }; /* The dfa structure. It is completely opaque. */ struct dfa; /* Needed when Gnulib is not used. */ #ifndef _GL_ATTRIBUTE_MALLOC # define _GL_ATTRIBUTE_MALLOC # define _GL_ATTRIBUTE_DEALLOC_FREE # define _GL_ATTRIBUTE_RETURNS_NONNULL #endif /* Entry points. */ /* Allocate a struct dfa. The struct dfa is completely opaque. It should be initialized via dfasyntax or dfacopysyntax before other use. The returned pointer should be passed directly to free() after calling dfafree() on it. */ extern struct dfa *dfaalloc (void) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; /* DFA options that can be ORed together, for dfasyntax's 4th arg. */ enum { /* ^ and $ match only the start and end of data, and do not match end-of-line within data. This is always false for grep, but possibly true for other apps. */ DFA_ANCHOR = 1 << 0, /* '\0' in data is end-of-line, instead of the traditional '\n'. */ DFA_EOL_NUL = 1 << 1 }; /* Initialize or reinitialize a DFA. The arguments are: 1. The DFA to operate on. 2. Information about the current locale. 3. Syntax bits described in regex.h. 4. Additional DFA options described above. */ extern void dfasyntax (struct dfa *, struct localeinfo const *, reg_syntax_t, int); /* Initialize or reinitialize a DFA from an already-initialized DFA. */ extern void dfacopysyntax (struct dfa *, struct dfa const *); /* Parse the given string of given length into the given struct dfa. */ extern void dfaparse (char const *, ptrdiff_t, struct dfa *); struct dfamust; /* Free the storage held by the components of a struct dfamust. */ extern void dfamustfree (struct dfamust *); /* Allocate and return a struct dfamust from a struct dfa that was initialized by dfaparse and not yet given to dfacomp. */ extern struct dfamust *dfamust (struct dfa const *) _GL_ATTRIBUTE_DEALLOC (dfamustfree, 1); /* Compile the given string of the given length into the given struct dfa. The last argument says whether to build a searching or an exact matcher. A null first argument means the struct dfa has already been initialized by dfaparse; the second argument is ignored. */ extern void dfacomp (char const *, ptrdiff_t, struct dfa *, bool); /* Search through a buffer looking for a match to the given struct dfa. Find the first occurrence of a string matching the regexp in the buffer, and the shortest possible version thereof. Return a pointer to the first character after the match, or NULL if none is found. BEGIN points to the beginning of the buffer, and END points to the first byte after its end. Note however that we store a sentinel byte (usually newline) in *END, so the actual buffer must be one byte longer. When ALLOW_NL is true, newlines may appear in the matching string. If COUNT is non-NULL, increment *COUNT once for each newline processed. Finally, if BACKREF is non-NULL set *BACKREF to indicate whether we encountered a back-reference. The caller can use this to decide whether to fall back on a backtracking matcher. */ extern char *dfaexec (struct dfa *d, char const *begin, char *end, bool allow_nl, ptrdiff_t *count, bool *backref); /* Return a superset for D. The superset matches everything that D matches, along with some other strings (though the latter should be rare, for efficiency reasons). Return a null pointer if no useful superset is available. */ extern struct dfa *dfasuperset (struct dfa const *d) _GL_ATTRIBUTE_PURE; /* The DFA is likely to be fast. */ extern bool dfaisfast (struct dfa const *) _GL_ATTRIBUTE_PURE; /* Return true if every construct in D is supported by this DFA matcher. */ extern bool dfasupported (struct dfa const *) _GL_ATTRIBUTE_PURE; /* Free the storage held by the components of a struct dfa. */ extern void dfafree (struct dfa *); /* Error handling. */ /* dfawarn() is called by the regexp routines whenever a regex is compiled that likely doesn't do what the user wanted. It takes a single argument, a NUL-terminated string describing the situation. The user must supply a dfawarn. */ extern void dfawarn (const char *); /* dfaerror() is called by the regexp routines whenever an error occurs. It takes a single argument, a NUL-terminated string describing the error. The user must supply a dfaerror. */ extern _Noreturn void dfaerror (const char *); #ifdef __cplusplus } #endif #endif /* dfa.h */ kbuild-3608/src/grep/lib/memchr.valgrind0000664000175000017500000000216314670377425020224 0ustar locutuslocutus# Suppress a valgrind message about use of uninitialized memory in memchr(). # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # 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. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # POSIX states that when the character is found, memchr must not read extra # bytes in an overestimated length (for example, where memchr is used to # implement strnlen). However, we use a safe word read to provide a speedup. { memchr-value4 Memcheck:Value4 fun:rpl_memchr } { memchr-value8 Memcheck:Value8 fun:rpl_memchr } kbuild-3608/src/grep/lib/mbchar.h0000664000175000017500000003311314670377426016626 0ustar locutuslocutus/* Multibyte character data type. Copyright (C) 2001, 2005-2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible . */ /* A multibyte character is a short subsequence of a char* string, representing a single wide character. We use multibyte characters instead of wide characters because of the following goals: 1) correct multibyte handling, i.e. operate according to the LC_CTYPE locale, 2) ease of maintenance, i.e. the maintainer needs not know all details of the ISO C 99 standard, 3) don't fail grossly if the input is not in the encoding set by the locale, because often different encodings are in use in the same countries (ISO-8859-1/UTF-8, EUC-JP/Shift_JIS, ...), 4) fast in the case of ASCII characters, 5) portability, i.e. don't make unportable assumptions about wchar_t. Multibyte characters are only accessed through the mb* macros. mb_ptr (mbc) return a pointer to the beginning of the multibyte sequence. mb_len (mbc) returns the number of bytes occupied by the multibyte sequence. Always > 0. mb_iseq (mbc, sc) returns true if mbc is the standard ASCII character sc. mb_isnul (mbc) returns true if mbc is the nul character. mb_cmp (mbc1, mbc2) returns a positive, zero, or negative value depending on whether mbc1 sorts after, same or before mbc2. mb_casecmp (mbc1, mbc2) returns a positive, zero, or negative value depending on whether mbc1 sorts after, same or before mbc2, modulo upper/lowercase conversion. mb_equal (mbc1, mbc2) returns true if mbc1 and mbc2 are equal. mb_caseequal (mbc1, mbc2) returns true if mbc1 and mbc2 are equal modulo upper/lowercase conversion. mb_isalnum (mbc) returns true if mbc is alphanumeric. mb_isalpha (mbc) returns true if mbc is alphabetic. mb_isascii(mbc) returns true if mbc is plain ASCII. mb_isblank (mbc) returns true if mbc is a blank. mb_iscntrl (mbc) returns true if mbc is a control character. mb_isdigit (mbc) returns true if mbc is a decimal digit. mb_isgraph (mbc) returns true if mbc is a graphic character. mb_islower (mbc) returns true if mbc is lowercase. mb_isprint (mbc) returns true if mbc is a printable character. mb_ispunct (mbc) returns true if mbc is a punctuation character. mb_isspace (mbc) returns true if mbc is a space character. mb_isupper (mbc) returns true if mbc is uppercase. mb_isxdigit (mbc) returns true if mbc is a hexadecimal digit. mb_width (mbc) returns the number of columns on the output device occupied by mbc. Always >= 0. mb_putc (mbc, stream) outputs mbc on stream, a byte oriented FILE stream opened for output. mb_setascii (&mbc, sc) assigns the standard ASCII character sc to mbc. mb_copy (&destmbc, &srcmbc) copies srcmbc to destmbc. Here are the function prototypes of the macros. extern const char * mb_ptr (const mbchar_t mbc); extern size_t mb_len (const mbchar_t mbc); extern bool mb_iseq (const mbchar_t mbc, char sc); extern bool mb_isnul (const mbchar_t mbc); extern int mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2); extern int mb_casecmp (const mbchar_t mbc1, const mbchar_t mbc2); extern bool mb_equal (const mbchar_t mbc1, const mbchar_t mbc2); extern bool mb_caseequal (const mbchar_t mbc1, const mbchar_t mbc2); extern bool mb_isalnum (const mbchar_t mbc); extern bool mb_isalpha (const mbchar_t mbc); extern bool mb_isascii (const mbchar_t mbc); extern bool mb_isblank (const mbchar_t mbc); extern bool mb_iscntrl (const mbchar_t mbc); extern bool mb_isdigit (const mbchar_t mbc); extern bool mb_isgraph (const mbchar_t mbc); extern bool mb_islower (const mbchar_t mbc); extern bool mb_isprint (const mbchar_t mbc); extern bool mb_ispunct (const mbchar_t mbc); extern bool mb_isspace (const mbchar_t mbc); extern bool mb_isupper (const mbchar_t mbc); extern bool mb_isxdigit (const mbchar_t mbc); extern int mb_width (const mbchar_t mbc); extern void mb_putc (const mbchar_t mbc, FILE *stream); extern void mb_setascii (mbchar_t *new, char sc); extern void mb_copy (mbchar_t *new, const mbchar_t *old); */ #ifndef _MBCHAR_H #define _MBCHAR_H 1 #include #include #include #include #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef MBCHAR_INLINE # define MBCHAR_INLINE _GL_INLINE #endif #define MBCHAR_BUF_SIZE 24 struct mbchar { const char *ptr; /* pointer to current character */ size_t bytes; /* number of bytes of current character, > 0 */ bool wc_valid; /* true if wc is a valid wide character */ wchar_t wc; /* if wc_valid: the current character */ char buf[MBCHAR_BUF_SIZE]; /* room for the bytes, used for file input only */ }; /* EOF (not a real character) is represented with bytes = 0 and wc_valid = false. */ typedef struct mbchar mbchar_t; /* Access the current character. */ #define mb_ptr(mbc) ((mbc).ptr) #define mb_len(mbc) ((mbc).bytes) /* Comparison of characters. */ #define mb_iseq(mbc, sc) ((mbc).wc_valid && (mbc).wc == (sc)) #define mb_isnul(mbc) ((mbc).wc_valid && (mbc).wc == 0) #define mb_cmp(mbc1, mbc2) \ ((mbc1).wc_valid \ ? ((mbc2).wc_valid \ ? (int) (mbc1).wc - (int) (mbc2).wc \ : -1) \ : ((mbc2).wc_valid \ ? 1 \ : (mbc1).bytes == (mbc2).bytes \ ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \ : (mbc1).bytes < (mbc2).bytes \ ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \ : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1))) #define mb_casecmp(mbc1, mbc2) \ ((mbc1).wc_valid \ ? ((mbc2).wc_valid \ ? (int) towlower ((mbc1).wc) - (int) towlower ((mbc2).wc) \ : -1) \ : ((mbc2).wc_valid \ ? 1 \ : (mbc1).bytes == (mbc2).bytes \ ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \ : (mbc1).bytes < (mbc2).bytes \ ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \ : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1))) #define mb_equal(mbc1, mbc2) \ ((mbc1).wc_valid && (mbc2).wc_valid \ ? (mbc1).wc == (mbc2).wc \ : (mbc1).bytes == (mbc2).bytes \ && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0) #define mb_caseequal(mbc1, mbc2) \ ((mbc1).wc_valid && (mbc2).wc_valid \ ? towlower ((mbc1).wc) == towlower ((mbc2).wc) \ : (mbc1).bytes == (mbc2).bytes \ && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0) /* , classification. */ #define mb_isascii(mbc) \ ((mbc).wc_valid && (mbc).wc >= 0 && (mbc).wc <= 127) #define mb_isalnum(mbc) ((mbc).wc_valid && iswalnum ((mbc).wc)) #define mb_isalpha(mbc) ((mbc).wc_valid && iswalpha ((mbc).wc)) #define mb_isblank(mbc) ((mbc).wc_valid && iswblank ((mbc).wc)) #define mb_iscntrl(mbc) ((mbc).wc_valid && iswcntrl ((mbc).wc)) #define mb_isdigit(mbc) ((mbc).wc_valid && iswdigit ((mbc).wc)) #define mb_isgraph(mbc) ((mbc).wc_valid && iswgraph ((mbc).wc)) #define mb_islower(mbc) ((mbc).wc_valid && iswlower ((mbc).wc)) #define mb_isprint(mbc) ((mbc).wc_valid && iswprint ((mbc).wc)) #define mb_ispunct(mbc) ((mbc).wc_valid && iswpunct ((mbc).wc)) #define mb_isspace(mbc) ((mbc).wc_valid && iswspace ((mbc).wc)) #define mb_isupper(mbc) ((mbc).wc_valid && iswupper ((mbc).wc)) #define mb_isxdigit(mbc) ((mbc).wc_valid && iswxdigit ((mbc).wc)) /* Extra function. */ /* Unprintable characters appear as a small box of width 1. */ #define MB_UNPRINTABLE_WIDTH 1 MBCHAR_INLINE int mb_width_aux (wint_t wc) { int w = wcwidth (wc); /* For unprintable characters, arbitrarily return 0 for control characters and MB_UNPRINTABLE_WIDTH otherwise. */ return (w >= 0 ? w : iswcntrl (wc) ? 0 : MB_UNPRINTABLE_WIDTH); } #define mb_width(mbc) \ ((mbc).wc_valid ? mb_width_aux ((mbc).wc) : MB_UNPRINTABLE_WIDTH) /* Output. */ #define mb_putc(mbc, stream) fwrite ((mbc).ptr, 1, (mbc).bytes, (stream)) /* Assignment. */ #define mb_setascii(mbc, sc) \ ((mbc)->ptr = (mbc)->buf, (mbc)->bytes = 1, (mbc)->wc_valid = 1, \ (mbc)->wc = (mbc)->buf[0] = (sc)) /* Copying a character. */ MBCHAR_INLINE void mb_copy (mbchar_t *new_mbc, const mbchar_t *old_mbc) { if (old_mbc->ptr == &old_mbc->buf[0]) { memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes); new_mbc->ptr = &new_mbc->buf[0]; } else new_mbc->ptr = old_mbc->ptr; new_mbc->bytes = old_mbc->bytes; if ((new_mbc->wc_valid = old_mbc->wc_valid)) new_mbc->wc = old_mbc->wc; } /* is_basic(c) tests whether the single-byte character c is in the ISO C "basic character set". This is a convenience function, and is in this file only to share code between mbiter_multi.h and mbfile_multi.h. */ #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) /* The character set is ISO-646, not EBCDIC. */ # define IS_BASIC_ASCII 1 extern const unsigned int is_basic_table[]; MBCHAR_INLINE bool is_basic (char c) { return (is_basic_table [(unsigned char) c >> 5] >> ((unsigned char) c & 31)) & 1; } #else MBCHAR_INLINE bool is_basic (char c) { switch (c) { case '\t': case '\v': case '\f': 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 '~': return 1; default: return 0; } } #endif _GL_INLINE_HEADER_END #endif /* _MBCHAR_H */ kbuild-3608/src/grep/lib/memchr.c0000664000175000017500000001345514670377426016647 0ustar locutuslocutus/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2021 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), with help from Dan Sahlin (dan@sics.se) and commentary by Jim Blandy (jimb@ai.mit.edu); adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), and implemented by Roland McGrath (roland@ai.mit.edu). NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _LIBC # include #endif #include #include #if defined _LIBC # include #else # define reg_char char #endif #include #if HAVE_BP_SYM_H || defined _LIBC # include #else # define BP_SYM(sym) sym #endif #undef __memchr #ifdef _LIBC # undef memchr #endif #ifndef weak_alias # define __memchr memchr #endif /* Search no more than N bytes of S for C. */ void * __memchr (void const *s, int c_in, size_t n) { /* On 32-bit hardware, choosing longword to be a 32-bit unsigned long instead of a 64-bit uintmax_t tends to give better performance. On 64-bit hardware, unsigned long is generally 64 bits already. Change this typedef to experiment with performance. */ typedef unsigned long int longword; const unsigned char *char_ptr; const longword *longword_ptr; longword repeated_one; longword repeated_c; unsigned reg_char c; c = (unsigned char) c_in; /* Handle the first few bytes by reading one byte at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ for (char_ptr = (const unsigned char *) s; n > 0 && (size_t) char_ptr % sizeof (longword) != 0; --n, ++char_ptr) if (*char_ptr == c) return (void *) char_ptr; longword_ptr = (const longword *) char_ptr; /* All these elucidatory comments refer to 4-byte longwords, but the theory applies equally well to any size longwords. */ /* Compute auxiliary longword values: repeated_one is a value which has a 1 in every byte. repeated_c has c in every byte. */ repeated_one = 0x01010101; repeated_c = c | (c << 8); repeated_c |= repeated_c << 16; if (0xffffffffU < (longword) -1) { repeated_one |= repeated_one << 31 << 1; repeated_c |= repeated_c << 31 << 1; if (8 < sizeof (longword)) { size_t i; for (i = 64; i < sizeof (longword) * 8; i *= 2) { repeated_one |= repeated_one << i; repeated_c |= repeated_c << i; } } } /* Instead of the traditional loop which tests each byte, we will test a longword at a time. The tricky part is testing if *any of the four* bytes in the longword in question are equal to c. We first use an xor with repeated_c. This reduces the task to testing whether *any of the four* bytes in longword1 is zero. We compute tmp = ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). That is, we perform the following operations: 1. Subtract repeated_one. 2. & ~longword1. 3. & a mask consisting of 0x80 in every byte. Consider what happens in each byte: - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, and step 3 transforms it into 0x80. A carry can also be propagated to more significant bytes. - If a byte of longword1 is nonzero, let its lowest 1 bit be at position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, the byte ends in a single bit of value 0 and k bits of value 1. After step 2, the result is just k bits of value 1: 2^k - 1. After step 3, the result is 0. And no carry is produced. So, if longword1 has only non-zero bytes, tmp is zero. Whereas if longword1 has a zero byte, call j the position of the least significant zero byte. Then the result has a zero at positions 0, ..., j-1 and a 0x80 at position j. We cannot predict the result at the more significant bytes (positions j+1..3), but it does not matter since we already have a non-zero bit at position 8*j+7. So, the test whether any byte in longword1 is zero is equivalent to testing whether tmp is nonzero. */ while (n >= sizeof (longword)) { longword longword1 = *longword_ptr ^ repeated_c; if ((((longword1 - repeated_one) & ~longword1) & (repeated_one << 7)) != 0) break; longword_ptr++; n -= sizeof (longword); } char_ptr = (const unsigned char *) longword_ptr; /* At this point, we know that either n < sizeof (longword), or one of the sizeof (longword) bytes starting at char_ptr is == c. On little-endian machines, we could determine the first such byte without any further memory accesses, just by looking at the tmp result from the last loop iteration. But this does not work on big-endian machines. Choose code that works in both cases. */ for (; n > 0; --n, ++char_ptr) { if (*char_ptr == c) return (void *) char_ptr; } return NULL; } #ifdef weak_alias weak_alias (__memchr, BP_SYM (memchr)) #endif kbuild-3608/src/grep/lib/xstrtoul.c0000664000175000017500000000164514670377426017276 0ustar locutuslocutus/* Convert string to 'unsigned long', with error checking. Copyright (C) 1994-2021 Free Software Foundation, Inc. This file 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 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. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #define __strtol strtoul #define __strtol_t unsigned long int #define __xstrtol xstrtoul #define STRTOL_T_MINIMUM 0 #define STRTOL_T_MAXIMUM ULONG_MAX #include "xstrtol.c" kbuild-3608/src/grep/lib/open.c0000664000175000017500000001537714670377425016341 0ustar locutuslocutus/* Open a descriptor to a file. Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2007. */ /* If the user's config.h happens to include , let it include only the system's here, so that orig_open doesn't recurse to rpl_open. */ #define __need_system_fcntl_h #include /* Get the original definition of open. It might be defined as a macro. */ #include #include #undef __need_system_fcntl_h static int orig_open (const char *filename, int flags, mode_t mode) { #if defined _WIN32 && !defined __CYGWIN__ return _open (filename, flags, mode); #else return open (filename, flags, mode); #endif } /* Specification. */ /* Write "fcntl.h" here, not , otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include above. */ #include "fcntl.h" #include "cloexec.h" #include #include #include #include #include #include #ifndef REPLACE_OPEN_DIRECTORY # define REPLACE_OPEN_DIRECTORY 0 #endif int open (const char *filename, int flags, ...) { /* 0 = unknown, 1 = yes, -1 = no. */ #if GNULIB_defined_O_CLOEXEC int have_cloexec = -1; #else static int have_cloexec; #endif mode_t mode; int fd; mode = 0; if (flags & O_CREAT) { va_list arg; va_start (arg, flags); /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 creates crashing code when 'mode_t' is smaller than 'int'. */ mode = va_arg (arg, PROMOTED_MODE_T); va_end (arg); } #if GNULIB_defined_O_NONBLOCK /* The only known platform that lacks O_NONBLOCK is mingw, but it also lacks named pipes and Unix sockets, which are the only two file types that require non-blocking handling in open(). Therefore, it is safe to ignore O_NONBLOCK here. It is handy that mingw also lacks openat(), so that is also covered here. */ flags &= ~O_NONBLOCK; #endif #if defined _WIN32 && ! defined __CYGWIN__ if (strcmp (filename, "/dev/null") == 0) filename = "NUL"; #endif #if OPEN_TRAILING_SLASH_BUG /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename ends in a slash, as POSIX says such a filename must name a directory : "A pathname that contains at least one non- character and that ends with one or more trailing characters shall not be resolved successfully unless the last pathname component before the trailing characters names an existing directory" If the named file already exists as a directory, then - if O_CREAT is specified, open() must fail because of the semantics of O_CREAT, - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX says that it fails with errno = EISDIR in this case. If the named file does not exist or does not name a directory, then - if O_CREAT is specified, open() must fail since open() cannot create directories, - if O_WRONLY or O_RDWR is specified, open() must fail because the file does not contain a '.' directory. */ if ((flags & O_CREAT) || (flags & O_ACCMODE) == O_RDWR || (flags & O_ACCMODE) == O_WRONLY) { size_t len = strlen (filename); if (len > 0 && filename[len - 1] == '/') { errno = EISDIR; return -1; } } #endif fd = orig_open (filename, flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode); if (flags & O_CLOEXEC) { if (! have_cloexec) { if (0 <= fd) have_cloexec = 1; else if (errno == EINVAL) { fd = orig_open (filename, flags & ~O_CLOEXEC, mode); have_cloexec = -1; } } if (have_cloexec < 0 && 0 <= fd) set_cloexec_flag (fd, true); } #if REPLACE_FCHDIR /* Implementing fchdir and fdopendir requires the ability to open a directory file descriptor. If open doesn't support that (as on mingw), we use a dummy file that behaves the same as directories on Linux (ie. always reports EOF on attempts to read()), and override fstat() in fchdir.c to hide the fact that we have a dummy. */ if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES && ((flags & O_ACCMODE) == O_RDONLY || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH))) { struct stat statbuf; if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) { /* Maximum recursion depth of 1. */ fd = open ("/dev/null", flags, mode); if (0 <= fd) fd = _gl_register_fd (fd, filename); } else errno = EACCES; } #endif #if OPEN_TRAILING_SLASH_BUG /* If the filename ends in a slash and fd does not refer to a directory, then fail. Rationale: POSIX says such a filename must name a directory : "A pathname that contains at least one non- character and that ends with one or more trailing characters shall not be resolved successfully unless the last pathname component before the trailing characters names an existing directory" If the named file without the slash is not a directory, open() must fail with ENOTDIR. */ if (fd >= 0) { /* We know len is positive, since open did not fail with ENOENT. */ size_t len = strlen (filename); if (filename[len - 1] == '/') { struct stat statbuf; if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) { close (fd); errno = ENOTDIR; return -1; } } } #endif #if REPLACE_FCHDIR if (!REPLACE_OPEN_DIRECTORY && 0 <= fd) fd = _gl_register_fd (fd, filename); #endif return fd; } kbuild-3608/src/grep/lib/ignore-value.h0000664000175000017500000000436214670377424017771 0ustar locutuslocutus/* ignore a function return without a compiler warning. -*- coding: utf-8 -*- Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Jim Meyering, Eric Blake and Pádraig Brady. */ /* Use "ignore_value" to avoid a warning when using a function declared with gcc's warn_unused_result attribute, but for which you really do want to ignore the result. Traditionally, people have used a "(void)" cast to indicate that a function's return value is deliberately unused. However, if the function is declared with __attribute__((warn_unused_result)), gcc issues a warning even with the cast. Caution: most of the time, you really should heed gcc's warning, and check the return value. However, in those exceptional cases in which you're sure you know what you're doing, use this function. For the record, here's one of the ignorable warnings: "copy.c:233: warning: ignoring return value of 'fchown', declared with attribute warn_unused_result". */ #ifndef _GL_IGNORE_VALUE_H #define _GL_IGNORE_VALUE_H /* Normally casting an expression to void discards its value, but GCC versions 3.4 and newer have __attribute__ ((__warn_unused_result__)) which may cause unwanted diagnostics in that case. Use __typeof__ and __extension__ to work around the problem, if the workaround is known to be needed. The workaround is not needed with clang. */ #if (3 < __GNUC__ + (4 <= __GNUC_MINOR__)) && !defined __clang__ # define ignore_value(x) \ (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; })) #else # define ignore_value(x) ((void) (x)) #endif #endif kbuild-3608/src/grep/lib/stdio-impl.h0000664000175000017500000001755314670377426017465 0ustar locutuslocutus/* Implementation details of FILE streams. Copyright (C) 2007-2008, 2010-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Many stdio implementations have the same logic and therefore can share the same implementation of stdio extension API, except that some fields have different naming conventions, or their access requires some casts. */ /* Glibc 2.28 made _IO_UNBUFFERED and _IO_IN_BACKUP private. For now, work around this problem by defining them ourselves. FIXME: Do not rely on glibc internals. */ #if defined _IO_EOF_SEEN # if !defined _IO_UNBUFFERED # define _IO_UNBUFFERED 0x2 # endif # if !defined _IO_IN_BACKUP # define _IO_IN_BACKUP 0x100 # endif #endif /* BSD stdio derived implementations. */ #if defined __NetBSD__ /* NetBSD */ /* Get __NetBSD_Version__. */ # include #endif #include /* For detecting Plan9. */ #if defined __sferror || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __DragonFly__ /* DragonFly */ /* See . */ # define fp_ ((struct { struct __FILE_public pub; \ struct { unsigned char *_base; int _size; } _bf; \ void *cookie; \ void *_close; \ void *_read; \ void *_seek; \ void *_write; \ struct { unsigned char *_base; int _size; } _ub; \ int _ur; \ unsigned char _ubuf[3]; \ unsigned char _nbuf[1]; \ struct { unsigned char *_base; int _size; } _lb; \ int _blksize; \ fpos_t _offset; \ /* More fields, not relevant here. */ \ } *) fp) /* See . */ # define _p pub._p # define _flags pub._flags # define _r pub._r # define _w pub._w # elif defined __ANDROID__ /* Android */ # ifdef __LP64__ # define _gl_flags_file_t int # else # define _gl_flags_file_t short # endif /* Up to this commit from 2015-10-12 the innards of FILE were public, and fp_ub could be defined like for OpenBSD, see and . After this commit, the innards of FILE are hidden. */ # define fp_ ((struct { unsigned char *_p; \ int _r; \ int _w; \ _gl_flags_file_t _flags; \ _gl_flags_file_t _file; \ struct { unsigned char *_base; size_t _size; } _bf; \ int _lbfsize; \ void *_cookie; \ void *_close; \ void *_read; \ void *_seek; \ void *_write; \ struct { unsigned char *_base; size_t _size; } _ext; \ unsigned char *_up; \ int _ur; \ unsigned char _ubuf[3]; \ unsigned char _nbuf[1]; \ struct { unsigned char *_base; size_t _size; } _lb; \ int _blksize; \ fpos_t _offset; \ /* More fields, not relevant here. */ \ } *) fp) # else # define fp_ fp # endif # if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix /* NetBSD >= 1.5ZA, OpenBSD, Minix 3 */ /* See and and */ struct __sfileext { struct __sbuf _ub; /* ungetc buffer */ /* More fields, not relevant here. */ }; # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub # elif defined __ANDROID__ /* Android */ struct __sfileext { struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */ /* More fields, not relevant here. */ }; # define fp_ub ((struct __sfileext *) fp_->_ext._base)->_ub # else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin */ # define fp_ub fp_->_ub # endif # define HASUB(fp) (fp_ub._base != NULL) # if defined __ANDROID__ /* Android */ /* Needed after this commit from 2016-01-25 */ # ifndef __SEOF # define __SLBF 1 # define __SNBF 2 # define __SRD 4 # define __SWR 8 # define __SRW 0x10 # define __SEOF 0x20 # define __SERR 0x40 # endif # ifndef __SOFF # define __SOFF 0x1000 # endif # endif #endif /* SystemV derived implementations. */ #ifdef __TANDEM /* NonStop Kernel */ # ifndef _IOERR /* These values were determined by the program 'stdioext-flags' at . */ # define _IOERR 0x40 # define _IOREAD 0x80 # define _IOWRT 0x4 # define _IORW 0x100 # endif #endif #if defined _IOERR # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ # define fp_ ((struct { unsigned char *_ptr; \ unsigned char *_base; \ unsigned char *_end; \ long _cnt; \ int _file; \ unsigned int _flag; \ } *) fp) # elif defined __VMS /* OpenVMS */ # define fp_ ((struct _iobuf *) fp) # else # define fp_ fp # endif # if defined _SCO_DS || (defined __SCO_VERSION__ || defined __sysv5__) /* OpenServer 5, OpenServer 6, UnixWare 7 */ # define _cnt __cnt # define _ptr __ptr # define _base __base # define _flag __flag # endif #elif defined _WIN32 && ! defined __CYGWIN__ /* newer Windows with MSVC */ /* does not define the innards of FILE any more. */ # define WINDOWS_OPAQUE_FILE struct _gl_real_FILE { /* Note: Compared to older Windows and to mingw, it has the fields _base and _cnt swapped. */ unsigned char *_ptr; unsigned char *_base; int _cnt; int _flag; int _file; int _charbuf; int _bufsiz; }; # define fp_ ((struct _gl_real_FILE *) fp) /* These values were determined by a program similar to the one at . */ # define _IOREAD 0x1 # define _IOWRT 0x2 # define _IORW 0x4 # define _IOEOF 0x8 # define _IOERR 0x10 #endif kbuild-3608/src/grep/lib/regex.c0000664000175000017500000000615514670377426016505 0ustar locutuslocutus/* Extended regular expression matching and search library. Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #define __STDC_WANT_IEC_60559_BFP_EXT__ #ifndef _LIBC # include # if __GNUC_PREREQ (4, 6) # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" # endif # if __GNUC_PREREQ (4, 3) # pragma GCC diagnostic ignored "-Wold-style-definition" # pragma GCC diagnostic ignored "-Wtype-limits" # endif #endif /* Make sure no one compiles this code with a C++ compiler. */ #if defined __cplusplus && defined _LIBC # error "This is C code, use a C compiler" #endif #ifdef _LIBC /* We have to keep the namespace clean. */ # define regfree(preg) __regfree (preg) # define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef) # define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags) # define regerror(errcode, preg, errbuf, errbuf_size) \ __regerror(errcode, preg, errbuf, errbuf_size) # define re_set_registers(bu, re, nu, st, en) \ __re_set_registers (bu, re, nu, st, en) # define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \ __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) # define re_match(bufp, string, size, pos, regs) \ __re_match (bufp, string, size, pos, regs) # define re_search(bufp, string, size, startpos, range, regs) \ __re_search (bufp, string, size, startpos, range, regs) # define re_compile_pattern(pattern, length, bufp) \ __re_compile_pattern (pattern, length, bufp) # define re_set_syntax(syntax) __re_set_syntax (syntax) # define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \ __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop) # define re_compile_fastmap(bufp) __re_compile_fastmap (bufp) # include "../locale/localeinfo.h" #endif /* On some systems, limits.h sets RE_DUP_MAX to a lower value than GNU regex allows. Include it before , which correctly #undefs RE_DUP_MAX and sets it to the right value. */ #include #include #include "regex_internal.h" #include "regex_internal.c" #include "regcomp.c" #include "regexec.c" /* Binary backward compatibility. */ #if _LIBC # include # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3) link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.") int re_max_failures = 2000; # endif #endif kbuild-3608/src/grep/lib/stdalign.in.h0000664000175000017500000001155714670377426017614 0ustar locutuslocutus/* A substitute for ISO C11 . Copyright 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert and Bruno Haible. */ #ifndef _GL_STDALIGN_H #define _GL_STDALIGN_H /* ISO C11 for platforms that lack it. References: ISO C11 (latest free draft ) sections 6.5.3.4, 6.7.5, 7.15. C++11 (latest free draft ) section 18.10. */ /* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment requirement of a structure member (i.e., slot or field) that is of type TYPE, as an integer constant expression. This differs from GCC's and clang's __alignof__ operator, which can yield a better-performing alignment for an object of that type. For example, on x86 with GCC and on Linux/x86 with clang, __alignof__ (double) and __alignof__ (long long) are 8, whereas alignof (double) and alignof (long long) are 4 unless the option '-malign-double' is used. The result cannot be used as a value for an 'enum' constant, if you want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. Include for offsetof. */ #include /* FreeBSD 9.1 , included by and lots of other standard headers, defines conflicting implementations of _Alignas and _Alignof that are no better than ours; override them. */ #undef _Alignas #undef _Alignof /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 . clang versions < 8.0.0 have the same bug. */ #if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ && !defined __clang__) \ || (defined __clang__ && __clang_major__ < 8)) # ifdef __cplusplus # if 201103 <= __cplusplus # define _Alignof(type) alignof (type) # else template struct __alignof_helper { char __a; __t __b; }; # define _Alignof(type) offsetof (__alignof_helper, __b) # endif # else # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) # endif #endif #if ! (defined __cplusplus && 201103 <= __cplusplus) # define alignof _Alignof #endif #define __alignof_is_defined 1 /* alignas (A), also known as _Alignas (A), aligns a variable or type to the alignment A, where A is an integer constant expression. For example: int alignas (8) foo; struct s { int a; int alignas (8) bar; }; aligns the address of FOO and the offset of BAR to be multiples of 8. A should be a power of two that is at least the type's alignment and at most the implementation's alignment limit. This limit is 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable to MSVC through at least version 10.0, A should be an integer constant, as MSVC does not support expressions such as 1 << 3. To be portable to Sun C 5.11, do not align auto variables to anything stricter than their default alignment. The following C11 requirements are not supported here: - If A is zero, alignas has no effect. - alignas can be used multiple times; the strictest one wins. - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). */ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 # if defined __cplusplus && 201103 <= __cplusplus # define _Alignas(a) alignas (a) # elif (!defined __attribute__ \ && ((defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ : __GNUC__ && !defined __ibmxl__) \ || (4 <= __clang_major__) \ || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) # define _Alignas(a) __attribute__ ((__aligned__ (a))) # elif 1300 <= _MSC_VER # define _Alignas(a) __declspec (align (a)) # endif #endif #if ((defined _Alignas && ! (defined __cplusplus && 201103 <= __cplusplus)) \ || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) # define alignas _Alignas #endif #if defined alignas || (defined __cplusplus && 201103 <= __cplusplus) # define __alignas_is_defined 1 #endif #endif /* _GL_STDALIGN_H */ kbuild-3608/src/grep/lib/windows-once.c0000664000175000017500000000441614670377426020005 0ustar locutuslocutus/* Once-only control (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-win32.h. */ #include /* Specification. */ #include "windows-once.h" #include void glwthread_once (glwthread_once_t *once_control, void (*initfunction) (void)) { if (once_control->inited <= 0) { if (InterlockedIncrement (&once_control->started) == 0) { /* This thread is the first one to come to this once_control. */ InitializeCriticalSection (&once_control->lock); EnterCriticalSection (&once_control->lock); once_control->inited = 0; initfunction (); once_control->inited = 1; LeaveCriticalSection (&once_control->lock); } else { /* Don't let once_control->started grow and wrap around. */ InterlockedDecrement (&once_control->started); /* Some other thread has already started the initialization. Yield the CPU while waiting for the other thread to finish initializing and taking the lock. */ while (once_control->inited < 0) Sleep (0); if (once_control->inited <= 0) { /* Take the lock. This blocks until the other thread has finished calling the initfunction. */ EnterCriticalSection (&once_control->lock); LeaveCriticalSection (&once_control->lock); if (!(once_control->inited > 0)) abort (); } } } } kbuild-3608/src/grep/lib/bitrotate.c0000664000175000017500000000151014670377422017352 0ustar locutuslocutus/* Rotate bits in integers. Copyright (C) 2012-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #define BITROTATE_INLINE _GL_EXTERN_INLINE #include "bitrotate.h" kbuild-3608/src/grep/lib/fcntl.in.h0000664000175000017500000003116514670377422017106 0ustar locutuslocutus/* Like , but with non-working flags defined to 0. Copyright (C) 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Paul Eggert */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined __need_system_fcntl_h /* Special invocation convention. */ /* Needed before . May also define off_t to a 64-bit type on native Windows. */ #include /* On some systems other than glibc, is a prerequisite of . On glibc systems, we would like to avoid namespace pollution. But on glibc systems, includes inside an extern "C" { ... } block, which leads to errors in C++ mode with the overridden from gnulib. These errors are known to be gone with g++ version >= 4.3. */ #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) # include #endif #@INCLUDE_NEXT@ @NEXT_FCNTL_H@ /* Native Windows platforms declare open(), creat() in . */ #if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ && (defined _WIN32 && ! defined __CYGWIN__) # include #endif #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_FCNTL_H /* Needed before . May also define off_t to a 64-bit type on native Windows. */ #include /* On some systems other than glibc, is a prerequisite of . On glibc systems, we would like to avoid namespace pollution. But on glibc systems, includes inside an extern "C" { ... } block, which leads to errors in C++ mode with the overridden from gnulib. These errors are known to be gone with g++ version >= 4.3. */ #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) # include #endif /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_FCNTL_H@ /* Native Windows platforms declare open(), creat() in . */ #if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ && (defined _WIN32 && ! defined __CYGWIN__) # include #endif #ifndef _@GUARD_PREFIX@_FCNTL_H #define _@GUARD_PREFIX@_FCNTL_H #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */ # include #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Declare overridden functions. */ #if @GNULIB_CREAT@ # if @REPLACE_CREAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef creat # define creat rpl_creat # endif _GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef creat # define creat _creat # endif _GL_CXXALIAS_MDA (creat, int, (const char *filename, mode_t mode)); # else _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); # endif _GL_CXXALIASWARN (creat); #elif defined GNULIB_POSIXCHECK # undef creat /* Assume creat is always declared. */ _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " "use gnulib module creat for portability"); #elif @GNULIB_MDA_CREAT@ /* On native Windows, map 'creat' to '_creat', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::creat always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef creat # define creat _creat # endif /* Need to cast, because in mingw the last argument is 'int mode'. */ _GL_CXXALIAS_MDA_CAST (creat, int, (const char *filename, mode_t mode)); # else _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); # endif _GL_CXXALIASWARN (creat); #endif #if @GNULIB_FCNTL@ # if @REPLACE_FCNTL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fcntl # define fcntl rpl_fcntl # endif _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); # if !GNULIB_defined_rpl_fcntl # define GNULIB_defined_rpl_fcntl 1 # endif # else # if !@HAVE_FCNTL@ _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); # if !GNULIB_defined_fcntl # define GNULIB_defined_fcntl 1 # endif # endif _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); # endif _GL_CXXALIASWARN (fcntl); #elif defined GNULIB_POSIXCHECK # undef fcntl # if HAVE_RAW_DECL_FCNTL _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " "use gnulib module fcntl for portability"); # endif #endif #if @GNULIB_OPEN@ # if @REPLACE_OPEN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef open # define open rpl_open # endif _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef open # define open _open # endif _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); # else _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); # endif /* On HP-UX 11, in C++ mode, open() is defined as an inline function with a default argument. _GL_CXXALIASWARN does not work in this case. */ # if !defined __hpux _GL_CXXALIASWARN (open); # endif #elif defined GNULIB_POSIXCHECK # undef open /* Assume open is always declared. */ _GL_WARN_ON_USE (open, "open is not always POSIX compliant - " "use gnulib module open for portability"); #elif @GNULIB_MDA_OPEN@ /* On native Windows, map 'open' to '_open', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::open always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef open # define open _open # endif _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); # else _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); # endif # if !defined __hpux _GL_CXXALIASWARN (open); # endif #endif #if @GNULIB_OPENAT@ # if @REPLACE_OPENAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef openat # define openat rpl_openat # endif _GL_FUNCDECL_RPL (openat, int, (int fd, char const *file, int flags, /* mode_t mode */ ...) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (openat, int, (int fd, char const *file, int flags, /* mode_t mode */ ...)); # else # if !@HAVE_OPENAT@ _GL_FUNCDECL_SYS (openat, int, (int fd, char const *file, int flags, /* mode_t mode */ ...) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (openat, int, (int fd, char const *file, int flags, /* mode_t mode */ ...)); # endif _GL_CXXALIASWARN (openat); #elif defined GNULIB_POSIXCHECK # undef openat # if HAVE_RAW_DECL_OPENAT _GL_WARN_ON_USE (openat, "openat is not portable - " "use gnulib module openat for portability"); # endif #endif /* Fix up the FD_* macros, only known to be missing on mingw. */ #ifndef FD_CLOEXEC # define FD_CLOEXEC 1 #endif /* Fix up the supported F_* macros. Intentionally leave other F_* macros undefined. Only known to be missing on mingw. */ #ifndef F_DUPFD_CLOEXEC # define F_DUPFD_CLOEXEC 0x40000000 /* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */ # define GNULIB_defined_F_DUPFD_CLOEXEC 1 #else # define GNULIB_defined_F_DUPFD_CLOEXEC 0 #endif #ifndef F_DUPFD # define F_DUPFD 1 #endif #ifndef F_GETFD # define F_GETFD 2 #endif /* Fix up the O_* macros. */ /* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT to values outside 'int' range, so omit these misdefinitions. But avoid namespace pollution on non-AIX systems. */ #ifdef _AIX # include # if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX) # undef O_CLOEXEC # endif # if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX) # undef O_NOFOLLOW # endif # if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX) # undef O_TTY_INIT # endif #endif #if !defined O_DIRECT && defined O_DIRECTIO /* Tru64 spells it 'O_DIRECTIO'. */ # define O_DIRECT O_DIRECTIO #endif #if !defined O_CLOEXEC && defined O_NOINHERIT /* Mingw spells it 'O_NOINHERIT'. */ # define O_CLOEXEC O_NOINHERIT #endif #ifndef O_CLOEXEC # define O_CLOEXEC 0x40000000 /* Try to not collide with system O_* flags. */ # define GNULIB_defined_O_CLOEXEC 1 #else # define GNULIB_defined_O_CLOEXEC 0 #endif #ifndef O_DIRECT # define O_DIRECT 0 #endif #ifndef O_DIRECTORY # define O_DIRECTORY 0 #endif #ifndef O_DSYNC # define O_DSYNC 0 #endif #ifndef O_EXEC # define O_EXEC O_RDONLY /* This is often close enough in older systems. */ #endif #ifndef O_IGNORE_CTTY # define O_IGNORE_CTTY 0 #endif #ifndef O_NDELAY # define O_NDELAY 0 #endif #ifndef O_NOATIME # define O_NOATIME 0 #endif #ifndef O_NONBLOCK # define O_NONBLOCK O_NDELAY #endif /* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY or to 0 as fallback. */ #if @GNULIB_NONBLOCKING@ # if O_NONBLOCK # define GNULIB_defined_O_NONBLOCK 0 # else # define GNULIB_defined_O_NONBLOCK 1 # undef O_NONBLOCK # define O_NONBLOCK 0x40000000 # endif #endif #ifndef O_NOCTTY # define O_NOCTTY 0 #endif #ifndef O_NOFOLLOW # define O_NOFOLLOW 0 #endif #ifndef O_NOLINK # define O_NOLINK 0 #endif #ifndef O_NOLINKS # define O_NOLINKS 0 #endif #ifndef O_NOTRANS # define O_NOTRANS 0 #endif #ifndef O_RSYNC # define O_RSYNC 0 #endif #ifndef O_SEARCH # define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ #endif #ifndef O_SYNC # define O_SYNC 0 #endif #ifndef O_TTY_INIT # define O_TTY_INIT 0 #endif #if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) # undef O_ACCMODE # define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) #endif /* For systems that distinguish between text and binary I/O. O_BINARY is usually declared in fcntl.h */ #if !defined O_BINARY && defined _O_BINARY /* For MSC-compatible compilers. */ # define O_BINARY _O_BINARY # define O_TEXT _O_TEXT #endif #if defined __BEOS__ || defined __HAIKU__ /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ # undef O_BINARY # undef O_TEXT #endif #ifndef O_BINARY # define O_BINARY 0 # define O_TEXT 0 #endif /* Fix up the AT_* macros. */ /* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its value exceeds INT_MAX, so its use as an int doesn't conform to the C standard, and GCC and Sun C complain in some cases. If the bug is present, undef AT_FDCWD here, so it can be redefined below. */ #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553 # undef AT_FDCWD #endif /* Use the same bit pattern as Solaris 9, but with the proper signedness. The bit pattern is important, in case this actually is Solaris with the above workaround. */ #ifndef AT_FDCWD # define AT_FDCWD (-3041965) #endif /* Use the same values as Solaris 9. This shouldn't matter, but there's no real reason to differ. */ #ifndef AT_SYMLINK_NOFOLLOW # define AT_SYMLINK_NOFOLLOW 4096 #endif #ifndef AT_REMOVEDIR # define AT_REMOVEDIR 1 #endif /* Solaris 9 lacks these two, so just pick unique values. */ #ifndef AT_SYMLINK_FOLLOW # define AT_SYMLINK_FOLLOW 2 #endif #ifndef AT_EACCESS # define AT_EACCESS 4 #endif #endif /* _@GUARD_PREFIX@_FCNTL_H */ #endif /* _@GUARD_PREFIX@_FCNTL_H */ #endif kbuild-3608/src/grep/lib/windows-recmutex.h0000664000175000017500000000367514670377426020730 0ustar locutuslocutus/* Plain recursive mutexes (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-win32.h. */ #ifndef _WINDOWS_RECMUTEX_H #define _WINDOWS_RECMUTEX_H #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include #include "windows-initguard.h" /* The native Windows documentation says that CRITICAL_SECTION already implements a recursive lock. But we need not rely on it: It's easy to implement a recursive lock without this assumption. */ typedef struct { glwthread_initguard_t guard; /* protects the initialization */ DWORD owner; unsigned long depth; CRITICAL_SECTION lock; } glwthread_recmutex_t; #define GLWTHREAD_RECMUTEX_INIT { GLWTHREAD_INITGUARD_INIT, 0, 0 } #ifdef __cplusplus extern "C" { #endif extern void glwthread_recmutex_init (glwthread_recmutex_t *mutex); extern int glwthread_recmutex_lock (glwthread_recmutex_t *mutex); extern int glwthread_recmutex_trylock (glwthread_recmutex_t *mutex); extern int glwthread_recmutex_unlock (glwthread_recmutex_t *mutex); extern int glwthread_recmutex_destroy (glwthread_recmutex_t *mutex); #ifdef __cplusplus } #endif #endif /* _WINDOWS_RECMUTEX_H */ kbuild-3608/src/grep/lib/c-strcaseeq.h0000664000175000017500000001052614670377423017604 0ustar locutuslocutus/* Optimized case-insensitive string comparison in C locale. Copyright (C) 2001-2002, 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible . */ #include "c-strcase.h" #include "c-ctype.h" /* STRCASEEQ allows to optimize string comparison with a small literal string. STRCASEEQ (s, "UTF-8", 'U','T','F','-','8',0,0,0,0) is semantically equivalent to c_strcasecmp (s, "UTF-8") == 0 just faster. */ /* Help GCC to generate good code for string comparisons with immediate strings. */ #if (defined __GNUC__ || defined __clang__) && defined __OPTIMIZE__ /* Case insensitive comparison of ASCII characters. */ # if C_CTYPE_ASCII # define CASEEQ(other,upper) \ (c_isupper (upper) ? ((other) & ~0x20) == (upper) : (other) == (upper)) # else # define CASEEQ(other,upper) \ (c_toupper (other) == (upper)) # endif static inline int strcaseeq9 (const char *s1, const char *s2) { return c_strcasecmp (s1 + 9, s2 + 9) == 0; } static inline int strcaseeq8 (const char *s1, const char *s2, char s28) { if (CASEEQ (s1[8], s28)) { if (s28 == 0) return 1; else return strcaseeq9 (s1, s2); } else return 0; } static inline int strcaseeq7 (const char *s1, const char *s2, char s27, char s28) { if (CASEEQ (s1[7], s27)) { if (s27 == 0) return 1; else return strcaseeq8 (s1, s2, s28); } else return 0; } static inline int strcaseeq6 (const char *s1, const char *s2, char s26, char s27, char s28) { if (CASEEQ (s1[6], s26)) { if (s26 == 0) return 1; else return strcaseeq7 (s1, s2, s27, s28); } else return 0; } static inline int strcaseeq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28) { if (CASEEQ (s1[5], s25)) { if (s25 == 0) return 1; else return strcaseeq6 (s1, s2, s26, s27, s28); } else return 0; } static inline int strcaseeq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28) { if (CASEEQ (s1[4], s24)) { if (s24 == 0) return 1; else return strcaseeq5 (s1, s2, s25, s26, s27, s28); } else return 0; } static inline int strcaseeq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28) { if (CASEEQ (s1[3], s23)) { if (s23 == 0) return 1; else return strcaseeq4 (s1, s2, s24, s25, s26, s27, s28); } else return 0; } static inline int strcaseeq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28) { if (CASEEQ (s1[2], s22)) { if (s22 == 0) return 1; else return strcaseeq3 (s1, s2, s23, s24, s25, s26, s27, s28); } else return 0; } static inline int strcaseeq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28) { if (CASEEQ (s1[1], s21)) { if (s21 == 0) return 1; else return strcaseeq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28); } else return 0; } static inline int strcaseeq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28) { if (CASEEQ (s1[0], s20)) { if (s20 == 0) return 1; else return strcaseeq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28); } else return 0; } #define STRCASEEQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \ strcaseeq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28) #else #define STRCASEEQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \ (c_strcasecmp (s1, s2) == 0) #endif kbuild-3608/src/grep/lib/wctomb.c0000664000175000017500000000164514670377426016665 0ustar locutuslocutus/* Convert wide character to multibyte character. Copyright (C) 2011-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include #include #include #include "wctomb-impl.h" kbuild-3608/src/grep/lib/wcwidth.c0000664000175000017500000000417414670377426017043 0ustar locutuslocutus/* Determine the number of screen columns needed for a character. Copyright (C) 2006-2007, 2010-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include /* Get iswprint. */ #include #include "localcharset.h" #include "streq.h" #include "uniwidth.h" /* Returns 1 if the current locale is an UTF-8 locale, 0 otherwise. */ static inline int is_locale_utf8 (void) { const char *encoding = locale_charset (); return STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0); } #if GNULIB_WCHAR_SINGLE_LOCALE /* When we know that the locale does not change, provide a speedup by caching the value of is_locale_utf8. */ static int cached_is_locale_utf8 = -1; static inline int is_locale_utf8_cached (void) { if (cached_is_locale_utf8 < 0) cached_is_locale_utf8 = is_locale_utf8 (); return cached_is_locale_utf8; } #else /* By default, don't make assumptions, hence no caching. */ # define is_locale_utf8_cached is_locale_utf8 #endif int wcwidth (wchar_t wc) #undef wcwidth { /* In UTF-8 locales, use a Unicode aware width function. */ if (is_locale_utf8_cached ()) { /* We assume that in a UTF-8 locale, a wide character is the same as a Unicode character. */ return uc_width (wc, "UTF-8"); } else { /* Otherwise, fall back to the system's wcwidth function. */ #if HAVE_WCWIDTH return wcwidth (wc); #else return wc == 0 ? 0 : iswprint (wc) ? 1 : -1; #endif } } kbuild-3608/src/grep/lib/streq.h0000664000175000017500000000770314670377426016536 0ustar locutuslocutus/* Optimized string comparison. Copyright (C) 2001-2002, 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible . */ #ifndef _GL_STREQ_H #define _GL_STREQ_H #include /* STREQ_OPT allows to optimize string comparison with a small literal string. STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) is semantically equivalent to strcmp (s, "EUC-KR") == 0 just faster. */ /* Help GCC to generate good code for string comparisons with immediate strings. */ #if (defined __GNUC__ || defined __clang__) && defined __OPTIMIZE__ static inline int streq9 (const char *s1, const char *s2) { return strcmp (s1 + 9, s2 + 9) == 0; } static inline int streq8 (const char *s1, const char *s2, char s28) { if (s1[8] == s28) { if (s28 == 0) return 1; else return streq9 (s1, s2); } else return 0; } static inline int streq7 (const char *s1, const char *s2, char s27, char s28) { if (s1[7] == s27) { if (s27 == 0) return 1; else return streq8 (s1, s2, s28); } else return 0; } static inline int streq6 (const char *s1, const char *s2, char s26, char s27, char s28) { if (s1[6] == s26) { if (s26 == 0) return 1; else return streq7 (s1, s2, s27, s28); } else return 0; } static inline int streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28) { if (s1[5] == s25) { if (s25 == 0) return 1; else return streq6 (s1, s2, s26, s27, s28); } else return 0; } static inline int streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28) { if (s1[4] == s24) { if (s24 == 0) return 1; else return streq5 (s1, s2, s25, s26, s27, s28); } else return 0; } static inline int streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28) { if (s1[3] == s23) { if (s23 == 0) return 1; else return streq4 (s1, s2, s24, s25, s26, s27, s28); } else return 0; } static inline int streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28) { if (s1[2] == s22) { if (s22 == 0) return 1; else return streq3 (s1, s2, s23, s24, s25, s26, s27, s28); } else return 0; } static inline int streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28) { if (s1[1] == s21) { if (s21 == 0) return 1; else return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28); } else return 0; } static inline int streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28) { if (s1[0] == s20) { if (s20 == 0) return 1; else return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28); } else return 0; } #define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \ streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28) #else #define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \ (strcmp (s1, s2) == 0) #endif #endif /* _GL_STREQ_H */ kbuild-3608/src/grep/lib/closeout.h0000664000175000017500000000204314670377423017222 0ustar locutuslocutus/* Close standard output and standard error. Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2021 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 . */ #ifndef CLOSEOUT_H # define CLOSEOUT_H 1 # include # ifdef __cplusplus extern "C" { # endif void close_stdout_set_file_name (const char *file); void close_stdout_set_ignore_EPIPE (bool ignore); void close_stdout (void); # ifdef __cplusplus } # endif #endif kbuild-3608/src/grep/lib/mbiter.h0000664000175000017500000001644214670377425016661 0ustar locutuslocutus/* Iterating through multibyte strings: macros for multi-byte encodings. Copyright (C) 2001, 2005, 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible . */ /* The macros in this file implement forward iteration through a multi-byte string. With these macros, an iteration loop that looks like char *iter; for (iter = buf; iter < buf + buflen; iter++) { do_something (*iter); } becomes mbi_iterator_t iter; for (mbi_init (iter, buf, buflen); mbi_avail (iter); mbi_advance (iter)) { do_something (mbi_cur_ptr (iter), mb_len (mbi_cur (iter))); } The benefit of these macros over plain use of mbrtowc is: - Handling of invalid multibyte sequences is possible without making the code more complicated, while still preserving the invalid multibyte sequences. mbi_iterator_t is a type usable for variable declarations. mbi_init (iter, startptr, length) initializes the iterator, starting at startptr and crossing length bytes. mbi_avail (iter) returns true if there are more multibyte characters available before the end of string is reached. In this case, mbi_cur (iter) is initialized to the next multibyte character. mbi_advance (iter) advances the iterator by one multibyte character. mbi_cur (iter) returns the current multibyte character, of type mbchar_t. All the macros defined in mbchar.h can be used on it. mbi_cur_ptr (iter) return a pointer to the beginning of the current multibyte character. mbi_reloc (iter, ptrdiff) relocates iterator when the string is moved by ptrdiff bytes. mbi_copy (&destiter, &srciter) copies srciter to destiter. Here are the function prototypes of the macros. extern void mbi_init (mbi_iterator_t iter, const char *startptr, size_t length); extern bool mbi_avail (mbi_iterator_t iter); extern void mbi_advance (mbi_iterator_t iter); extern mbchar_t mbi_cur (mbi_iterator_t iter); extern const char * mbi_cur_ptr (mbi_iterator_t iter); extern void mbi_reloc (mbi_iterator_t iter, ptrdiff_t ptrdiff); extern void mbi_copy (mbi_iterator_t *new, const mbi_iterator_t *old); */ #ifndef _MBITER_H #define _MBITER_H 1 #include #include #include #include #include #include "mbchar.h" #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef MBITER_INLINE # define MBITER_INLINE _GL_INLINE #endif struct mbiter_multi { const char *limit; /* pointer to end of string */ bool in_shift; /* true if next byte may not be interpreted as ASCII */ mbstate_t state; /* if in_shift: current shift state */ bool next_done; /* true if mbi_avail has already filled the following */ struct mbchar cur; /* the current character: const char *cur.ptr pointer to current character The following are only valid after mbi_avail. size_t cur.bytes number of bytes of current character bool cur.wc_valid true if wc is a valid wide character wchar_t cur.wc if wc_valid: the current character */ }; MBITER_INLINE void mbiter_multi_next (struct mbiter_multi *iter) { if (iter->next_done) return; if (iter->in_shift) goto with_shift; /* Handle most ASCII characters quickly, without calling mbrtowc(). */ if (is_basic (*iter->cur.ptr)) { /* These characters are part of the basic character set. ISO C 99 guarantees that their wide character code is identical to their char code. */ iter->cur.bytes = 1; iter->cur.wc = *iter->cur.ptr; iter->cur.wc_valid = true; } else { assert (mbsinit (&iter->state)); iter->in_shift = true; with_shift: iter->cur.bytes = mbrtowc (&iter->cur.wc, iter->cur.ptr, iter->limit - iter->cur.ptr, &iter->state); if (iter->cur.bytes == (size_t) -1) { /* An invalid multibyte sequence was encountered. */ iter->cur.bytes = 1; iter->cur.wc_valid = false; /* Whether to set iter->in_shift = false and reset iter->state or not is not very important; the string is bogus anyway. */ } else if (iter->cur.bytes == (size_t) -2) { /* An incomplete multibyte character at the end. */ iter->cur.bytes = iter->limit - iter->cur.ptr; iter->cur.wc_valid = false; /* Whether to set iter->in_shift = false and reset iter->state or not is not important; the string end is reached anyway. */ } else { if (iter->cur.bytes == 0) { /* A null wide character was encountered. */ iter->cur.bytes = 1; assert (*iter->cur.ptr == '\0'); assert (iter->cur.wc == 0); } iter->cur.wc_valid = true; /* When in the initial state, we can go back treating ASCII characters more quickly. */ if (mbsinit (&iter->state)) iter->in_shift = false; } } iter->next_done = true; } MBITER_INLINE void mbiter_multi_reloc (struct mbiter_multi *iter, ptrdiff_t ptrdiff) { iter->cur.ptr += ptrdiff; iter->limit += ptrdiff; } MBITER_INLINE void mbiter_multi_copy (struct mbiter_multi *new_iter, const struct mbiter_multi *old_iter) { new_iter->limit = old_iter->limit; if ((new_iter->in_shift = old_iter->in_shift)) memcpy (&new_iter->state, &old_iter->state, sizeof (mbstate_t)); else memset (&new_iter->state, 0, sizeof (mbstate_t)); new_iter->next_done = old_iter->next_done; mb_copy (&new_iter->cur, &old_iter->cur); } /* Iteration macros. */ typedef struct mbiter_multi mbi_iterator_t; #define mbi_init(iter, startptr, length) \ ((iter).cur.ptr = (startptr), (iter).limit = (iter).cur.ptr + (length), \ (iter).in_shift = false, memset (&(iter).state, '\0', sizeof (mbstate_t)), \ (iter).next_done = false) #define mbi_avail(iter) \ ((iter).cur.ptr < (iter).limit && (mbiter_multi_next (&(iter)), true)) #define mbi_advance(iter) \ ((iter).cur.ptr += (iter).cur.bytes, (iter).next_done = false) /* Access to the current character. */ #define mbi_cur(iter) (iter).cur #define mbi_cur_ptr(iter) (iter).cur.ptr /* Relocation. */ #define mbi_reloc(iter, ptrdiff) mbiter_multi_reloc (&iter, ptrdiff) /* Copying an iterator. */ #define mbi_copy mbiter_multi_copy _GL_INLINE_HEADER_END #endif /* _MBITER_H */ kbuild-3608/src/grep/lib/strtoimax.c0000664000175000017500000000360614670377426017423 0ustar locutuslocutus/* Convert string representation of a number into an intmax_t value. Copyright (C) 1999, 2001-2004, 2006, 2009-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ #include /* Verify interface. */ #include #include #include "verify.h" #ifdef UNSIGNED # ifndef HAVE_DECL_STRTOULL "this configure-time declaration test was not run" # endif # if !HAVE_DECL_STRTOULL unsigned long long int strtoull (char const *, char **, int); # endif #else # ifndef HAVE_DECL_STRTOLL "this configure-time declaration test was not run" # endif # if !HAVE_DECL_STRTOLL long long int strtoll (char const *, char **, int); # endif #endif #ifdef UNSIGNED # define Int uintmax_t # define Strtoimax strtoumax # define Strtol strtoul # define Strtoll strtoull # define Unsigned unsigned #else # define Int intmax_t # define Strtoimax strtoimax # define Strtol strtol # define Strtoll strtoll # define Unsigned #endif Int Strtoimax (char const *ptr, char **endptr, int base) { verify (sizeof (Int) == sizeof (Unsigned long int) || sizeof (Int) == sizeof (Unsigned long long int)); if (sizeof (Int) != sizeof (Unsigned long int)) return Strtoll (ptr, endptr, base); return Strtol (ptr, endptr, base); } kbuild-3608/src/grep/lib/version-etc.h0000664000175000017500000000522714670377426017635 0ustar locutuslocutus/* Print --version and bug-reporting information in a consistent format. Copyright (C) 1999, 2003, 2005, 2009-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Jim Meyering. */ #ifndef VERSION_ETC_H # define VERSION_ETC_H 1 # include # include extern const char version_etc_copyright[]; /* The three functions below display the --version information in the standard way: command and package names, package version, followed by a short GPLv3+ notice and a list of up to 10 author names. If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of the program. The formats are therefore: PACKAGE VERSION or COMMAND_NAME (PACKAGE) VERSION. The functions differ in the way they are passed author names: */ /* N_AUTHORS names are supplied in array AUTHORS. */ extern void version_etc_arn (FILE *stream, const char *command_name, const char *package, const char *version, const char * const * authors, size_t n_authors); /* Names are passed in the NULL-terminated array AUTHORS. */ extern void version_etc_ar (FILE *stream, const char *command_name, const char *package, const char *version, const char * const * authors); /* Names are passed in the NULL-terminated va_list. */ extern void version_etc_va (FILE *stream, const char *command_name, const char *package, const char *version, va_list authors); /* Names are passed as separate arguments, with an additional NULL argument at the end. */ extern void version_etc (FILE *stream, const char *command_name, const char *package, const char *version, /* const char *author1, ..., NULL */ ...) _GL_ATTRIBUTE_SENTINEL ((0)); /* Display the usual "Report bugs to" stanza. */ extern void emit_bug_reporting_address (void); #endif /* VERSION_ETC_H */ kbuild-3608/src/grep/lib/w32-initialize-main.c0000664000175000017500000000044114670377422021053 0ustar locutuslocutus #include "config.h" #include void w32_initialize_main(int *pcArgs, char ***ppapszArgs) { if (!getenv("KMK_GREP_NO_EXPANSION")) { _configure_narrow_argv(_crt_argv_expanded_arguments); *pcArgs = __argc; *ppapszArgs = __argv; } } kbuild-3608/src/grep/lib/attribute.h0000664000175000017500000002042714670377422017375 0ustar locutuslocutus/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers Copyright 2020-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ /* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_* macros used within Gnulib. */ /* These attributes can be placed in two ways: - At the start of a declaration (i.e. even before storage-class specifiers!); then they apply to all entities that are declared by the declaration. - Immediately after the name of an entity being declared by the declaration; then they apply to that entity only. */ #ifndef _GL_ATTRIBUTE_H #define _GL_ATTRIBUTE_H /* This file defines two types of attributes: * C2x standard attributes. These have macro names that do not begin with 'ATTRIBUTE_'. * Selected GCC attributes; see: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html These names begin with 'ATTRIBUTE_' to avoid name clashes. */ /* =============== Attributes for specific kinds of functions =============== */ /* Attributes for functions that should not be used. */ /* Warn if the entity is used. */ /* Applies to: - function, variable, - struct, union, struct/union member, - enumeration, enumeration item, - typedef, in C++ also: namespace, class, template specialization. */ #define DEPRECATED _GL_ATTRIBUTE_DEPRECATED /* If a function call is not optimized way, warn with MSG. */ /* Applies to: functions. */ #define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING (msg) /* If a function call is not optimized way, report an error with MSG. */ /* Applies to: functions. */ #define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR (msg) /* Attributes for memory-allocating functions. */ /* The function returns a pointer to freshly allocated memory. */ /* Applies to: functions. */ #define ATTRIBUTE_MALLOC _GL_ATTRIBUTE_MALLOC /* ATTRIBUTE_ALLOC_SIZE ((N)) - The Nth argument of the function is the size of the returned memory block. ATTRIBUTE_ALLOC_SIZE ((M, N)) - Multiply the Mth and Nth arguments to determine the size of the returned memory block. */ /* Applies to: function, pointer to function, function types. */ #define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args) /* Attributes for variadic functions. */ /* The variadic function expects a trailing NULL argument. ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99). ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */ /* Applies to: functions. */ #define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL (pos) /* ================== Attributes for compiler diagnostics ================== */ /* Attributes that help the compiler diagnose programmer mistakes. Some of them may also help for some compiler optimizations. */ /* ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)) - The STRING-INDEXth function argument is a format string of style ARCHETYPE, which is one of: printf, gnu_printf scanf, gnu_scanf, strftime, gnu_strftime, strfmon, or the same thing prefixed and suffixed with '__'. If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK are suitable for the format string. */ /* Applies to: functions. */ #define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT (spec) /* ATTRIBUTE_NONNULL ((N1, N2,...)) - Arguments N1, N2,... must not be NULL. ATTRIBUTE_NONNULL () - All pointer arguments must not be null. */ /* Applies to: functions. */ #define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL (args) /* The function's return value is a non-NULL pointer. */ /* Applies to: functions. */ #define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL /* Warn if the caller does not use the return value, unless the caller uses something like ignore_value. */ /* Applies to: function, enumeration, class. */ #define NODISCARD _GL_ATTRIBUTE_NODISCARD /* Attributes that disable false alarms when the compiler diagnoses programmer "mistakes". */ /* Do not warn if the entity is not used. */ /* Applies to: - function, variable, - struct, union, struct/union member, - enumeration, enumeration item, - typedef, in C++ also: class. */ #define MAYBE_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED /* The contents of a character array is not meant to be NUL-terminated. */ /* Applies to: struct/union members and variables that are arrays of element type '[[un]signed] char'. */ #define ATTRIBUTE_NONSTRING _GL_ATTRIBUTE_NONSTRING /* Do not warn if control flow falls through to the immediately following 'case' or 'default' label. */ /* Applies to: Empty statement (;), inside a 'switch' statement. */ #define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH /* ================== Attributes for debugging information ================== */ /* Attributes regarding debugging information emitted by the compiler. */ /* Omit the function from stack traces when debugging. */ /* Applies to: function. */ #define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL /* Make the entity visible to debuggers etc., even with '-fwhole-program'. */ /* Applies to: functions, variables. */ #define ATTRIBUTE_EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE /* ========== Attributes that mainly direct compiler optimizations ========== */ /* The function does not throw exceptions. */ /* Applies to: functions. */ #define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW /* Do not inline the function. */ /* Applies to: functions. */ #define ATTRIBUTE_NOINLINE _GL_ATTRIBUTE_NOINLINE /* Always inline the function, and report an error if the compiler cannot inline. */ /* Applies to: function. */ #define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE /* It is OK for a compiler to omit duplicate calls with the same arguments. This attribute is safe for a function that neither depends on nor affects observable state, and always returns exactly once - e.g., does not loop forever, and does not call longjmp. (This attribute is stricter than ATTRIBUTE_PURE.) */ /* Applies to: functions. */ #define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST /* It is OK for a compiler to omit duplicate calls with the same arguments if observable state is not changed between calls. This attribute is safe for a function that does not affect observable state, and always returns exactly once. (This attribute is looser than ATTRIBUTE_CONST.) */ /* Applies to: functions. */ #define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE /* The function is rarely executed. */ /* Applies to: functions. */ #define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD /* If called from some other compilation unit, the function executes code from that unit only by return or by exception handling, letting the compiler optimize that unit more aggressively. */ /* Applies to: functions. */ #define ATTRIBUTE_LEAF _GL_ATTRIBUTE_LEAF /* For struct members: The member has the smallest possible alignment. For struct, union, class: All members have the smallest possible alignment, minimizing the memory required. */ /* Applies to: struct members, struct, union, in C++ also: class. */ #define ATTRIBUTE_PACKED _GL_ATTRIBUTE_PACKED /* ================ Attributes that make invalid code valid ================ */ /* Attributes that prevent fatal compiler optimizations for code that is not fully ISO C compliant. */ /* Pointers to the type may point to the same storage as pointers to other types, thus disabling strict aliasing optimization. */ /* Applies to: types. */ #define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS #endif /* _GL_ATTRIBUTE_H */ kbuild-3608/src/grep/lib/cycle-check.h0000664000175000017500000000371314670377423017544 0ustar locutuslocutus/* help detect directory cycles efficiently Copyright (C) 2003-2004, 2006, 2009-2021 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 . */ /* Written by Jim Meyering */ #ifndef CYCLE_CHECK_H # define CYCLE_CHECK_H 1 # include # include # include "dev-ino.h" # include "same-inode.h" struct cycle_check_state { struct dev_ino dev_ino; uintmax_t chdir_counter; int magic; }; void cycle_check_init (struct cycle_check_state *state); bool cycle_check (struct cycle_check_state *state, struct stat const *sb); # define CYCLE_CHECK_REFLECT_CHDIR_UP(State, SB_dir, SB_subdir) \ do \ { \ /* You must call cycle_check at least once before using this macro. */ \ if ((State)->chdir_counter == 0) \ abort (); \ if (SAME_INODE ((State)->dev_ino, SB_subdir)) \ { \ (State)->dev_ino.st_dev = (SB_dir).st_dev; \ (State)->dev_ino.st_ino = (SB_dir).st_ino; \ } \ } \ while (0) #endif kbuild-3608/src/grep/lib/c-strncasecmp.c0000664000175000017500000000313014670377423020120 0ustar locutuslocutus/* c-strncasecmp.c -- case insensitive string comparator in C locale Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "c-strcase.h" #include #include "c-ctype.h" int c_strncasecmp (const char *s1, const char *s2, size_t n) { register const unsigned char *p1 = (const unsigned char *) s1; register const unsigned char *p2 = (const unsigned char *) s2; unsigned char c1, c2; if (p1 == p2 || n == 0) return 0; do { c1 = c_tolower (*p1); c2 = c_tolower (*p2); if (--n == 0 || c1 == '\0') break; ++p1; ++p2; } while (c1 == c2); if (UCHAR_MAX <= INT_MAX) return c1 - c2; else /* On machines where 'char' and 'int' are types of the same size, the difference of two 'unsigned char' values - including the sign bit - doesn't fit in an 'int'. */ return _GL_CMP (c1, c2); } kbuild-3608/src/grep/lib/wmemchr.c0000664000175000017500000000162614670377426017033 0ustar locutuslocutus/* Search wide character array for a wide character. Copyright (C) 2011-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include "wmemchr-impl.h" kbuild-3608/src/grep/lib/string.in.h0000664000175000017500000013237714670377426017321 0ustar locutuslocutus/* A GNU-like . Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined _GL_ALREADY_INCLUDING_STRING_H /* Special invocation convention: - On OS X/NetBSD we have a sequence of nested includes -> -> "string.h" In this situation system _chk variants due to -D_FORTIFY_SOURCE might be used after any replacements defined here. */ #@INCLUDE_NEXT@ @NEXT_STRING_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_STRING_H #define _GL_ALREADY_INCLUDING_STRING_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STRING_H@ #undef _GL_ALREADY_INCLUDING_STRING_H #ifndef _@GUARD_PREFIX@_STRING_H #define _@GUARD_PREFIX@_STRING_H /* NetBSD 5.0 mis-defines NULL. */ #include /* Get free(). */ #include /* MirBSD defines mbslen as a macro. */ #if @GNULIB_MBSLEN@ && defined __MirBSD__ # include #endif /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ #ifndef _GL_ATTRIBUTE_PURE # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define _GL_ATTRIBUTE_PURE /* empty */ # endif #endif /* NetBSD 5.0 declares strsignal in , not in . */ /* But in any case avoid namespace pollution on glibc systems. */ #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ && ! defined __GLIBC__ # include #endif /* AIX 7.2 declares ffsl and ffsll in , not in . */ /* But in any case avoid namespace pollution on glibc systems. */ #if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \ && defined _AIX) \ && ! defined __GLIBC__ # include #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Clear a block of memory. The compiler will not delete a call to this function, even if the block is dead after the call. */ #if @GNULIB_EXPLICIT_BZERO@ # if ! @HAVE_EXPLICIT_BZERO@ _GL_FUNCDECL_SYS (explicit_bzero, void, (void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); _GL_CXXALIASWARN (explicit_bzero); #elif defined GNULIB_POSIXCHECK # undef explicit_bzero # if HAVE_RAW_DECL_EXPLICIT_BZERO _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " "use gnulib module explicit_bzero for portability"); # endif #endif /* Find the index of the least-significant set bit. */ #if @GNULIB_FFSL@ # if !@HAVE_FFSL@ _GL_FUNCDECL_SYS (ffsl, int, (long int i)); # endif _GL_CXXALIAS_SYS (ffsl, int, (long int i)); _GL_CXXALIASWARN (ffsl); #elif defined GNULIB_POSIXCHECK # undef ffsl # if HAVE_RAW_DECL_FFSL _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); # endif #endif /* Find the index of the least-significant set bit. */ #if @GNULIB_FFSLL@ # if @REPLACE_FFSLL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define ffsll rpl_ffsll # endif _GL_FUNCDECL_RPL (ffsll, int, (long long int i)); _GL_CXXALIAS_RPL (ffsll, int, (long long int i)); # else # if !@HAVE_FFSLL@ _GL_FUNCDECL_SYS (ffsll, int, (long long int i)); # endif _GL_CXXALIAS_SYS (ffsll, int, (long long int i)); # endif _GL_CXXALIASWARN (ffsll); #elif defined GNULIB_POSIXCHECK # undef ffsll # if HAVE_RAW_DECL_FFSLL _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); # endif #endif #if @GNULIB_MDA_MEMCCPY@ /* On native Windows, map 'memccpy' to '_memccpy', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::memccpy always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef memccpy # define memccpy _memccpy # endif _GL_CXXALIAS_MDA (memccpy, void *, (void *dest, const void *src, int c, size_t n)); # else _GL_CXXALIAS_SYS (memccpy, void *, (void *dest, const void *src, int c, size_t n)); # endif _GL_CXXALIASWARN (memccpy); #endif /* Return the first instance of C within N bytes of S, or NULL. */ #if @GNULIB_MEMCHR@ # if @REPLACE_MEMCHR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef memchr # define memchr rpl_memchr # endif _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); # else /* On some systems, this function is defined as an overloaded function: extern "C" { const void * std::memchr (const void *, int, size_t); } extern "C++" { void * std::memchr (void *, int, size_t); } */ _GL_CXXALIAS_SYS_CAST2 (memchr, void *, (void const *__s, int __c, size_t __n), void const *, (void const *__s, int __c, size_t __n)); # endif # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); _GL_CXXALIASWARN1 (memchr, void const *, (void const *__s, int __c, size_t __n)); # elif __GLIBC__ >= 2 _GL_CXXALIASWARN (memchr); # endif #elif defined GNULIB_POSIXCHECK # undef memchr /* Assume memchr is always declared. */ _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " "use gnulib module memchr for portability" ); #endif /* Return the first occurrence of NEEDLE in HAYSTACK. */ #if @GNULIB_MEMMEM@ # if @REPLACE_MEMMEM@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define memmem rpl_memmem # endif _GL_FUNCDECL_RPL (memmem, void *, (void const *__haystack, size_t __haystack_len, void const *__needle, size_t __needle_len) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 3))); _GL_CXXALIAS_RPL (memmem, void *, (void const *__haystack, size_t __haystack_len, void const *__needle, size_t __needle_len)); # else # if ! @HAVE_DECL_MEMMEM@ _GL_FUNCDECL_SYS (memmem, void *, (void const *__haystack, size_t __haystack_len, void const *__needle, size_t __needle_len) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 3))); # endif _GL_CXXALIAS_SYS (memmem, void *, (void const *__haystack, size_t __haystack_len, void const *__needle, size_t __needle_len)); # endif _GL_CXXALIASWARN (memmem); #elif defined GNULIB_POSIXCHECK # undef memmem # if HAVE_RAW_DECL_MEMMEM _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " "use gnulib module memmem-simple for portability, " "and module memmem for speed" ); # endif #endif /* Copy N bytes of SRC to DEST, return pointer to bytes after the last written byte. */ #if @GNULIB_MEMPCPY@ # if ! @HAVE_MEMPCPY@ _GL_FUNCDECL_SYS (mempcpy, void *, (void *restrict __dest, void const *restrict __src, size_t __n) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (mempcpy, void *, (void *restrict __dest, void const *restrict __src, size_t __n)); _GL_CXXALIASWARN (mempcpy); #elif defined GNULIB_POSIXCHECK # undef mempcpy # if HAVE_RAW_DECL_MEMPCPY _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " "use gnulib module mempcpy for portability"); # endif #endif /* Search backwards through a block for a byte (specified as an int). */ #if @GNULIB_MEMRCHR@ # if ! @HAVE_DECL_MEMRCHR@ _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const void * std::memrchr (const void *, int, size_t); } extern "C++" { void * std::memrchr (void *, int, size_t); } */ _GL_CXXALIAS_SYS_CAST2 (memrchr, void *, (void const *, int, size_t), void const *, (void const *, int, size_t)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); # else _GL_CXXALIASWARN (memrchr); # endif #elif defined GNULIB_POSIXCHECK # undef memrchr # if HAVE_RAW_DECL_MEMRCHR _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " "use gnulib module memrchr for portability"); # endif #endif /* Find the first occurrence of C in S. More efficient than memchr(S,C,N), at the expense of undefined behavior if C does not occur within N bytes. */ #if @GNULIB_RAWMEMCHR@ # if ! @HAVE_RAWMEMCHR@ _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const void * std::rawmemchr (const void *, int); } extern "C++" { void * std::rawmemchr (void *, int); } */ _GL_CXXALIAS_SYS_CAST2 (rawmemchr, void *, (void const *__s, int __c_in), void const *, (void const *__s, int __c_in)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); _GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); # else _GL_CXXALIASWARN (rawmemchr); # endif #elif defined GNULIB_POSIXCHECK # undef rawmemchr # if HAVE_RAW_DECL_RAWMEMCHR _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " "use gnulib module rawmemchr for portability"); # endif #endif /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ #if @GNULIB_STPCPY@ # if ! @HAVE_STPCPY@ _GL_FUNCDECL_SYS (stpcpy, char *, (char *restrict __dst, char const *restrict __src) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (stpcpy, char *, (char *restrict __dst, char const *restrict __src)); _GL_CXXALIASWARN (stpcpy); #elif defined GNULIB_POSIXCHECK # undef stpcpy # if HAVE_RAW_DECL_STPCPY _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " "use gnulib module stpcpy for portability"); # endif #endif /* Copy no more than N bytes of SRC to DST, returning a pointer past the last non-NUL byte written into DST. */ #if @GNULIB_STPNCPY@ # if @REPLACE_STPNCPY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef stpncpy # define stpncpy rpl_stpncpy # endif _GL_FUNCDECL_RPL (stpncpy, char *, (char *restrict __dst, char const *restrict __src, size_t __n) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (stpncpy, char *, (char *restrict __dst, char const *restrict __src, size_t __n)); # else # if ! @HAVE_STPNCPY@ _GL_FUNCDECL_SYS (stpncpy, char *, (char *restrict __dst, char const *restrict __src, size_t __n) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (stpncpy, char *, (char *restrict __dst, char const *restrict __src, size_t __n)); # endif _GL_CXXALIASWARN (stpncpy); #elif defined GNULIB_POSIXCHECK # undef stpncpy # if HAVE_RAW_DECL_STPNCPY _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " "use gnulib module stpncpy for portability"); # endif #endif #if defined GNULIB_POSIXCHECK /* strchr() does not work with multibyte strings if the locale encoding is GB18030 and the character to be searched is a digit. */ # undef strchr /* Assume strchr is always declared. */ _GL_WARN_ON_USE_CXX (strchr, const char *, char *, (const char *, int), "strchr cannot work correctly on character strings " "in some multibyte locales - " "use mbschr if you care about internationalization"); #endif /* Find the first occurrence of C in S or the final NUL byte. */ #if @GNULIB_STRCHRNUL@ # if @REPLACE_STRCHRNUL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strchrnul rpl_strchrnul # endif _GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strchrnul, char *, (const char *str, int ch)); # else # if ! @HAVE_STRCHRNUL@ _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const char * std::strchrnul (const char *, int); } extern "C++" { char * std::strchrnul (char *, int); } */ _GL_CXXALIAS_SYS_CAST2 (strchrnul, char *, (char const *__s, int __c_in), char const *, (char const *__s, int __c_in)); # endif # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); _GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); # else _GL_CXXALIASWARN (strchrnul); # endif #elif defined GNULIB_POSIXCHECK # undef strchrnul # if HAVE_RAW_DECL_STRCHRNUL _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " "use gnulib module strchrnul for portability"); # endif #endif /* Duplicate S, returning an identical malloc'd string. */ #if @GNULIB_STRDUP@ # if @REPLACE_STRDUP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strdup # define strdup rpl_strdup # endif _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strdup # define strdup _strdup # endif _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); # else # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup /* strdup exists as a function and as a macro. Get rid of the macro. */ # undef strdup # endif # if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup _GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); # endif _GL_CXXALIASWARN (strdup); #else # if __GNUC__ >= 11 && !defined strdup /* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ _GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # if defined GNULIB_POSIXCHECK # undef strdup # if HAVE_RAW_DECL_STRDUP _GL_WARN_ON_USE (strdup, "strdup is unportable - " "use gnulib module strdup for portability"); # endif # elif @GNULIB_MDA_STRDUP@ /* On native Windows, map 'creat' to '_creat', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::strdup always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strdup # define strdup _strdup # endif _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); # else # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup # undef strdup # endif _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); # endif _GL_CXXALIASWARN (strdup); # endif #endif /* Append no more than N characters from SRC onto DEST. */ #if @GNULIB_STRNCAT@ # if @REPLACE_STRNCAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strncat # define strncat rpl_strncat # endif _GL_FUNCDECL_RPL (strncat, char *, (char *restrict dest, const char *restrict src, size_t n) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (strncat, char *, (char *restrict dest, const char *restrict src, size_t n)); # else _GL_CXXALIAS_SYS (strncat, char *, (char *restrict dest, const char *restrict src, size_t n)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (strncat); # endif #elif defined GNULIB_POSIXCHECK # undef strncat # if HAVE_RAW_DECL_STRNCAT _GL_WARN_ON_USE (strncat, "strncat is unportable - " "use gnulib module strncat for portability"); # endif #endif /* Return a newly allocated copy of at most N bytes of STRING. */ #if @GNULIB_STRNDUP@ # if @REPLACE_STRNDUP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strndup # define strndup rpl_strndup # endif _GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); # else # if ! @HAVE_DECL_STRNDUP@ _GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); # endif _GL_CXXALIASWARN (strndup); #elif defined GNULIB_POSIXCHECK # undef strndup # if HAVE_RAW_DECL_STRNDUP _GL_WARN_ON_USE (strndup, "strndup is unportable - " "use gnulib module strndup for portability"); # endif #endif /* Find the length (number of bytes) of STRING, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many bytes, return MAXLEN. */ #if @GNULIB_STRNLEN@ # if @REPLACE_STRNLEN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strnlen # define strnlen rpl_strnlen # endif _GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); # else # if ! @HAVE_DECL_STRNLEN@ _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)); # endif _GL_CXXALIASWARN (strnlen); #elif defined GNULIB_POSIXCHECK # undef strnlen # if HAVE_RAW_DECL_STRNLEN _GL_WARN_ON_USE (strnlen, "strnlen is unportable - " "use gnulib module strnlen for portability"); # endif #endif #if defined GNULIB_POSIXCHECK /* strcspn() assumes the second argument is a list of single-byte characters. Even in this simple case, it does not work with multibyte strings if the locale encoding is GB18030 and one of the characters to be searched is a digit. */ # undef strcspn /* Assume strcspn is always declared. */ _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " "in multibyte locales - " "use mbscspn if you care about internationalization"); #endif /* Find the first occurrence in S of any character in ACCEPT. */ #if @GNULIB_STRPBRK@ # if ! @HAVE_STRPBRK@ _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # endif /* On some systems, this function is defined as an overloaded function: extern "C" { const char * strpbrk (const char *, const char *); } extern "C++" { char * strpbrk (char *, const char *); } */ _GL_CXXALIAS_SYS_CAST2 (strpbrk, char *, (char const *__s, char const *__accept), const char *, (char const *__s, char const *__accept)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); _GL_CXXALIASWARN1 (strpbrk, char const *, (char const *__s, char const *__accept)); # elif __GLIBC__ >= 2 _GL_CXXALIASWARN (strpbrk); # endif # if defined GNULIB_POSIXCHECK /* strpbrk() assumes the second argument is a list of single-byte characters. Even in this simple case, it does not work with multibyte strings if the locale encoding is GB18030 and one of the characters to be searched is a digit. */ # undef strpbrk _GL_WARN_ON_USE_CXX (strpbrk, const char *, char *, (const char *, const char *), "strpbrk cannot work correctly on character strings " "in multibyte locales - " "use mbspbrk if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK # undef strpbrk # if HAVE_RAW_DECL_STRPBRK _GL_WARN_ON_USE_CXX (strpbrk, const char *, char *, (const char *, const char *), "strpbrk is unportable - " "use gnulib module strpbrk for portability"); # endif #endif #if defined GNULIB_POSIXCHECK /* strspn() assumes the second argument is a list of single-byte characters. Even in this simple case, it cannot work with multibyte strings. */ # undef strspn /* Assume strspn is always declared. */ _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " "in multibyte locales - " "use mbsspn if you care about internationalization"); #endif #if defined GNULIB_POSIXCHECK /* strrchr() does not work with multibyte strings if the locale encoding is GB18030 and the character to be searched is a digit. */ # undef strrchr /* Assume strrchr is always declared. */ _GL_WARN_ON_USE_CXX (strrchr, const char *, char *, (const char *, int), "strrchr cannot work correctly on character strings " "in some multibyte locales - " "use mbsrchr if you care about internationalization"); #endif /* Search the next delimiter (char listed in DELIM) starting at *STRINGP. If one is found, overwrite it with a NUL, and advance *STRINGP to point to the next char after it. Otherwise, set *STRINGP to NULL. If *STRINGP was already NULL, nothing happens. Return the old value of *STRINGP. This is a variant of strtok() that is multithread-safe and supports empty fields. Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. Caveat: The identity of the delimiting character is lost. Caveat: It doesn't work with multibyte strings unless all of the delimiter characters are ASCII characters < 0x30. See also strtok_r(). */ #if @GNULIB_STRSEP@ # if ! @HAVE_STRSEP@ _GL_FUNCDECL_SYS (strsep, char *, (char **restrict __stringp, char const *restrict __delim) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (strsep, char *, (char **restrict __stringp, char const *restrict __delim)); _GL_CXXALIASWARN (strsep); # if defined GNULIB_POSIXCHECK # undef strsep _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " "in multibyte locales - " "use mbssep if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK # undef strsep # if HAVE_RAW_DECL_STRSEP _GL_WARN_ON_USE (strsep, "strsep is unportable - " "use gnulib module strsep for portability"); # endif #endif #if @GNULIB_STRSTR@ # if @REPLACE_STRSTR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strstr rpl_strstr # endif _GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); # else /* On some systems, this function is defined as an overloaded function: extern "C++" { const char * strstr (const char *, const char *); } extern "C++" { char * strstr (char *, const char *); } */ _GL_CXXALIAS_SYS_CAST2 (strstr, char *, (const char *haystack, const char *needle), const char *, (const char *haystack, const char *needle)); # endif # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); _GL_CXXALIASWARN1 (strstr, const char *, (const char *haystack, const char *needle)); # elif __GLIBC__ >= 2 _GL_CXXALIASWARN (strstr); # endif #elif defined GNULIB_POSIXCHECK /* strstr() does not work with multibyte strings if the locale encoding is different from UTF-8: POSIX says that it operates on "strings", and "string" in POSIX is defined as a sequence of bytes, not of characters. */ # undef strstr /* Assume strstr is always declared. */ _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " "work correctly on character strings in most " "multibyte locales - " "use mbsstr if you care about internationalization, " "or use strstr if you care about speed"); #endif /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive comparison. */ #if @GNULIB_STRCASESTR@ # if @REPLACE_STRCASESTR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strcasestr rpl_strcasestr # endif _GL_FUNCDECL_RPL (strcasestr, char *, (const char *haystack, const char *needle) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (strcasestr, char *, (const char *haystack, const char *needle)); # else # if ! @HAVE_STRCASESTR@ _GL_FUNCDECL_SYS (strcasestr, char *, (const char *haystack, const char *needle) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const char * strcasestr (const char *, const char *); } extern "C++" { char * strcasestr (char *, const char *); } */ _GL_CXXALIAS_SYS_CAST2 (strcasestr, char *, (const char *haystack, const char *needle), const char *, (const char *haystack, const char *needle)); # endif # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); _GL_CXXALIASWARN1 (strcasestr, const char *, (const char *haystack, const char *needle)); # else _GL_CXXALIASWARN (strcasestr); # endif #elif defined GNULIB_POSIXCHECK /* strcasestr() does not work with multibyte strings: It is a glibc extension, and glibc implements it only for unibyte locales. */ # undef strcasestr # if HAVE_RAW_DECL_STRCASESTR _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " "strings in multibyte locales - " "use mbscasestr if you care about " "internationalization, or use c-strcasestr if you want " "a locale independent function"); # endif #endif /* Parse S into tokens separated by characters in DELIM. If S is NULL, the saved pointer in SAVE_PTR is used as the next starting point. For example: char s[] = "-abc-=-def"; char *sp; x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL x = strtok_r(NULL, "=", &sp); // x = NULL // s = "abc\0-def\0" This is a variant of strtok() that is multithread-safe. For the POSIX documentation for this function, see: https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. Caveat: The identity of the delimiting character is lost. Caveat: It doesn't work with multibyte strings unless all of the delimiter characters are ASCII characters < 0x30. See also strsep(). */ #if @GNULIB_STRTOK_R@ # if @REPLACE_STRTOK_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strtok_r # define strtok_r rpl_strtok_r # endif _GL_FUNCDECL_RPL (strtok_r, char *, (char *restrict s, char const *restrict delim, char **restrict save_ptr) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (strtok_r, char *, (char *restrict s, char const *restrict delim, char **restrict save_ptr)); # else # if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK # undef strtok_r # endif # if ! @HAVE_DECL_STRTOK_R@ _GL_FUNCDECL_SYS (strtok_r, char *, (char *restrict s, char const *restrict delim, char **restrict save_ptr) _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (strtok_r, char *, (char *restrict s, char const *restrict delim, char **restrict save_ptr)); # endif _GL_CXXALIASWARN (strtok_r); # if defined GNULIB_POSIXCHECK _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " "strings in multibyte locales - " "use mbstok_r if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK # undef strtok_r # if HAVE_RAW_DECL_STRTOK_R _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " "use gnulib module strtok_r for portability"); # endif #endif /* The following functions are not specified by POSIX. They are gnulib extensions. */ #if @GNULIB_MBSLEN@ /* Return the number of multibyte characters in the character string STRING. This considers multibyte characters, unlike strlen, which counts bytes. */ # ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ # undef mbslen # endif # if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbslen rpl_mbslen # endif _GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); # else _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); # endif _GL_CXXALIASWARN (mbslen); #endif #if @GNULIB_MBSNLEN@ /* Return the number of multibyte characters in the character string starting at STRING and ending at STRING + LEN. */ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1)); #endif #if @GNULIB_MBSCHR@ /* Locate the first single-byte character C in the character string STRING, and return a pointer to it. Return NULL if C is not found in STRING. Unlike strchr(), this function works correctly in multibyte locales with encodings such as GB18030. */ # if defined __hpux # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbschr rpl_mbschr /* avoid collision with HP-UX function */ # endif _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); # else _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); # endif _GL_CXXALIASWARN (mbschr); #endif #if @GNULIB_MBSRCHR@ /* Locate the last single-byte character C in the character string STRING, and return a pointer to it. Return NULL if C is not found in STRING. Unlike strrchr(), this function works correctly in multibyte locales with encodings such as GB18030. */ # if defined __hpux || defined __INTERIX # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbsrchr rpl_mbsrchr /* avoid collision with system function */ # endif _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); # else _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); # endif _GL_CXXALIASWARN (mbsrchr); #endif #if @GNULIB_MBSSTR@ /* Find the first occurrence of the character string NEEDLE in the character string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. Unlike strstr(), this function works correctly in multibyte locales with encodings different from UTF-8. */ _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSCASECMP@ /* Compare the character strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function may, in multibyte locales, return 0 for strings of different lengths! Unlike strcasecmp(), this function works correctly in multibyte locales. */ _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSNCASECMP@ /* Compare the initial segment of the character string S1 consisting of at most N characters with the initial segment of the character string S2 consisting of at most N characters, ignoring case, returning less than, equal to or greater than zero if the initial segment of S1 is lexicographically less than, equal to or greater than the initial segment of S2. Note: This function may, in multibyte locales, return 0 for initial segments of different lengths! Unlike strncasecmp(), this function works correctly in multibyte locales. But beware that N is not a byte count but a character count! */ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSPCASECMP@ /* Compare the initial segment of the character string STRING consisting of at most mbslen (PREFIX) characters with the character string PREFIX, ignoring case. If the two match, return a pointer to the first byte after this prefix in STRING. Otherwise, return NULL. Note: This function may, in multibyte locales, return non-NULL if STRING is of smaller length than PREFIX! Unlike strncasecmp(), this function works correctly in multibyte locales. */ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSCASESTR@ /* Find the first occurrence of the character string NEEDLE in the character string HAYSTACK, using case-insensitive comparison. Note: This function may, in multibyte locales, return success even if strlen (haystack) < strlen (needle) ! Unlike strcasestr(), this function works correctly in multibyte locales. */ _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSCSPN@ /* Find the first occurrence in the character string STRING of any character in the character string ACCEPT. Return the number of bytes from the beginning of the string to this occurrence, or to the end of the string if none exists. Unlike strcspn(), this function works correctly in multibyte locales. */ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSPBRK@ /* Find the first occurrence in the character string STRING of any character in the character string ACCEPT. Return the pointer to it, or NULL if none exists. Unlike strpbrk(), this function works correctly in multibyte locales. */ # if defined __hpux # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ # endif _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); # else _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); # endif _GL_CXXALIASWARN (mbspbrk); #endif #if @GNULIB_MBSSPN@ /* Find the first occurrence in the character string STRING of any character not in the character string REJECT. Return the number of bytes from the beginning of the string to this occurrence, or to the end of the string if none exists. Unlike strspn(), this function works correctly in multibyte locales. */ _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSSEP@ /* Search the next delimiter (multibyte character listed in the character string DELIM) starting at the character string *STRINGP. If one is found, overwrite it with a NUL, and advance *STRINGP to point to the next multibyte character after it. Otherwise, set *STRINGP to NULL. If *STRINGP was already NULL, nothing happens. Return the old value of *STRINGP. This is a variant of mbstok_r() that supports empty fields. Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. Caveat: The identity of the delimiting character is lost. See also mbstok_r(). */ _GL_EXTERN_C char * mbssep (char **stringp, const char *delim) _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSTOK_R@ /* Parse the character string STRING into tokens separated by characters in the character string DELIM. If STRING is NULL, the saved pointer in SAVE_PTR is used as the next starting point. For example: char s[] = "-abc-=-def"; char *sp; x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL x = mbstok_r(NULL, "=", &sp); // x = NULL // s = "abc\0-def\0" Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. Caveat: The identity of the delimiting character is lost. See also mbssep(). */ _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim, char **save_ptr) _GL_ARG_NONNULL ((2, 3)); #endif /* Map any int, typically from errno, into an error message. */ #if @GNULIB_STRERROR@ # if @REPLACE_STRERROR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strerror # define strerror rpl_strerror # endif _GL_FUNCDECL_RPL (strerror, char *, (int)); _GL_CXXALIAS_RPL (strerror, char *, (int)); # else _GL_CXXALIAS_SYS (strerror, char *, (int)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (strerror); # endif #elif defined GNULIB_POSIXCHECK # undef strerror /* Assume strerror is always declared. */ _GL_WARN_ON_USE (strerror, "strerror is unportable - " "use gnulib module strerror to guarantee non-NULL result"); #endif /* Map any int, typically from errno, into an error message. Multithread-safe. Uses the POSIX declaration, not the glibc declaration. */ #if @GNULIB_STRERROR_R@ # if @REPLACE_STRERROR_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strerror_r # define strerror_r rpl_strerror_r # endif _GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); # else # if !@HAVE_DECL_STRERROR_R@ _GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); # endif # if @HAVE_DECL_STRERROR_R@ _GL_CXXALIASWARN (strerror_r); # endif #elif defined GNULIB_POSIXCHECK # undef strerror_r # if HAVE_RAW_DECL_STRERROR_R _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " "use gnulib module strerror_r-posix for portability"); # endif #endif /* Return the name of the system error code ERRNUM. */ #if @GNULIB_STRERRORNAME_NP@ # if @REPLACE_STRERRORNAME_NP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strerrorname_np # define strerrorname_np rpl_strerrorname_np # endif _GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum)); _GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum)); # else # if !@HAVE_STRERRORNAME_NP@ _GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum)); # endif _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); # endif _GL_CXXALIASWARN (strerrorname_np); #elif defined GNULIB_POSIXCHECK # undef strerrorname_np # if HAVE_RAW_DECL_STRERRORNAME_NP _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - " "use gnulib module strerrorname_np for portability"); # endif #endif /* Return an abbreviation string for the signal number SIG. */ #if @GNULIB_SIGABBREV_NP@ # if ! @HAVE_SIGABBREV_NP@ _GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig)); # endif _GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); _GL_CXXALIASWARN (sigabbrev_np); #elif defined GNULIB_POSIXCHECK # undef sigabbrev_np # if HAVE_RAW_DECL_SIGABBREV_NP _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - " "use gnulib module sigabbrev_np for portability"); # endif #endif /* Return an English description string for the signal number SIG. */ #if @GNULIB_SIGDESCR_NP@ # if ! @HAVE_SIGDESCR_NP@ _GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig)); # endif _GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig)); _GL_CXXALIASWARN (sigdescr_np); #elif defined GNULIB_POSIXCHECK # undef sigdescr_np # if HAVE_RAW_DECL_SIGDESCR_NP _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - " "use gnulib module sigdescr_np for portability"); # endif #endif #if @GNULIB_STRSIGNAL@ # if @REPLACE_STRSIGNAL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strsignal rpl_strsignal # endif _GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); _GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); # else # if ! @HAVE_DECL_STRSIGNAL@ _GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); # endif /* Need to cast, because on Cygwin 1.5.x systems, the return type is 'const char *'. */ _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); # endif _GL_CXXALIASWARN (strsignal); #elif defined GNULIB_POSIXCHECK # undef strsignal # if HAVE_RAW_DECL_STRSIGNAL _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " "use gnulib module strsignal for portability"); # endif #endif #if @GNULIB_STRVERSCMP@ # if !@HAVE_STRVERSCMP@ _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); _GL_CXXALIASWARN (strverscmp); #elif defined GNULIB_POSIXCHECK # undef strverscmp # if HAVE_RAW_DECL_STRVERSCMP _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " "use gnulib module strverscmp for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_STRING_H */ #endif /* _@GUARD_PREFIX@_STRING_H */ #endif kbuild-3608/src/grep/lib/isatty.c0000664000175000017500000001351414670377424016703 0ustar locutuslocutus/* isatty() replacement. Copyright (C) 2012-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include /* This replacement is enabled on native Windows. */ #include #include /* Get declarations of the Win32 API functions. */ #define WIN32_LEAN_AND_MEAN #include #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" #endif /* Get _get_osfhandle(). */ #if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" #else # include #endif /* Don't assume that UNICODE is not defined. */ #undef LoadLibrary #define LoadLibrary LoadLibraryA #undef QueryFullProcessImageName #define QueryFullProcessImageName QueryFullProcessImageNameA #if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA) /* Avoid warnings from gcc -Wcast-function-type. */ # define GetProcAddress \ (void *) GetProcAddress /* GetNamedPipeClientProcessId was introduced only in Windows Vista. */ typedef BOOL (WINAPI * GetNamedPipeClientProcessIdFuncType) (HANDLE hPipe, PULONG pClientProcessId); static GetNamedPipeClientProcessIdFuncType GetNamedPipeClientProcessIdFunc = NULL; /* QueryFullProcessImageName was introduced only in Windows Vista. */ typedef BOOL (WINAPI * QueryFullProcessImageNameFuncType) (HANDLE hProcess, DWORD dwFlags, LPSTR lpExeName, PDWORD pdwSize); static QueryFullProcessImageNameFuncType QueryFullProcessImageNameFunc = NULL; static BOOL initialized = FALSE; static void initialize (void) { HMODULE kernel32 = LoadLibrary ("kernel32.dll"); if (kernel32 != NULL) { GetNamedPipeClientProcessIdFunc = (GetNamedPipeClientProcessIdFuncType) GetProcAddress (kernel32, "GetNamedPipeClientProcessId"); QueryFullProcessImageNameFunc = (QueryFullProcessImageNameFuncType) GetProcAddress (kernel32, "QueryFullProcessImageNameA"); } initialized = TRUE; } #else # define GetNamedPipeClientProcessIdFunc GetNamedPipeClientProcessId # define QueryFullProcessImageNameFunc QueryFullProcessImageName #endif static BOOL IsConsoleHandle (HANDLE h) { DWORD mode; /* GetConsoleMode */ return GetConsoleMode (h, &mode) != 0; } static BOOL IsCygwinConsoleHandle (HANDLE h) { /* A handle to a Cygwin console is in fact a named pipe whose client process and server process is \bin\mintty.exe. */ BOOL result = FALSE; ULONG processId; #if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA) if (!initialized) initialize (); #endif /* GetNamedPipeClientProcessId It requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ if (GetNamedPipeClientProcessIdFunc && QueryFullProcessImageNameFunc && GetNamedPipeClientProcessIdFunc (h, &processId)) { /* OpenProcess */ HANDLE processHandle = OpenProcess (PROCESS_QUERY_LIMITED_INFORMATION, FALSE, processId); if (processHandle != NULL) { char buf[1024]; DWORD bufsize = sizeof (buf); /* The file name can be determined through GetProcessImageFileName or QueryFullProcessImageName The former returns a file name in non-standard notation (it starts with '\Device\') and may require linking with psapi.dll. The latter is better, but requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ if (QueryFullProcessImageNameFunc (processHandle, 0, buf, &bufsize)) { if (strlen (buf) >= 11 && strcmp (buf + strlen (buf) - 11, "\\mintty.exe") == 0) result = TRUE; } CloseHandle (processHandle); } } return result; } #if HAVE_MSVC_INVALID_PARAMETER_HANDLER static int _isatty_nothrow (int fd) { int result; TRY_MSVC_INVAL { result = _isatty (fd); } CATCH_MSVC_INVAL { result = 0; } DONE_MSVC_INVAL; return result; } #else # define _isatty_nothrow _isatty #endif /* Determine whether FD refers to a console device. Return 1 if yes. Return 0 and set errno if no. (ptsname_r relies on the errno value.) */ int isatty (int fd) { HANDLE h = (HANDLE) _get_osfhandle (fd); if (h == INVALID_HANDLE_VALUE) { errno = EBADF; return 0; } /* _isatty (fd) tests whether GetFileType of the handle is FILE_TYPE_CHAR. But it does not set errno when it returns 0. */ if (_isatty_nothrow (fd)) { if (IsConsoleHandle (h)) return 1; } if (IsCygwinConsoleHandle (h)) return 1; errno = ENOTTY; return 0; } kbuild-3608/src/grep/lib/close-stream.c0000664000175000017500000000574714670377423017774 0ustar locutuslocutus/* Close a stream, with nicer error checking than fclose's. Copyright (C) 1998-2002, 2004, 2006-2021 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 . */ #include #include "close-stream.h" #include #include #include "fpending.h" #if USE_UNLOCKED_IO # include "unlocked-io.h" #endif /* Close STREAM. Return 0 if successful, EOF (setting errno) otherwise. A failure might set errno to 0 if the error number cannot be determined. A failure with errno set to EPIPE may or may not indicate an error situation worth signaling to the user. See the documentation of the close_stdout_set_ignore_EPIPE function for details. If a program writes *anything* to STREAM, that program should close STREAM and make sure that it succeeds before exiting. Otherwise, suppose that you go to the extreme of checking the return status of every function that does an explicit write to STREAM. The last printf can succeed in writing to the internal stream buffer, and yet the fclose(STREAM) could still fail (due e.g., to a disk full error) when it tries to write out that buffered data. Thus, you would be left with an incomplete output file and the offending program would exit successfully. Even calling fflush is not always sufficient, since some file systems (NFS and CODA) buffer written/flushed data until an actual close call. Besides, it's wasteful to check the return value from every call that writes to STREAM -- just let the internal stream state record the failure. That's what the ferror test is checking below. */ int close_stream (FILE *stream) { const bool some_pending = (__fpending (stream) != 0); const bool prev_fail = (ferror (stream) != 0); const bool fclose_fail = (fclose (stream) != 0); /* Return an error indication if there was a previous failure or if fclose failed, with one exception: ignore an fclose failure if there was no previous error, no data remains to be flushed, and fclose failed with EBADF. That can happen when a program like cp is invoked like this 'cp a b >&-' (i.e., with standard output closed) and doesn't generate any output (hence no previous error and nothing to be flushed). */ if (prev_fail || (fclose_fail && (some_pending || errno != EBADF))) { if (! fclose_fail) errno = 0; return EOF; } return 0; } kbuild-3608/src/grep/lib/safe-read.c0000664000175000017500000000351114670377426017213 0ustar locutuslocutus/* An interface to read and write that retries after interrupts. Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #ifdef SAFE_WRITE # include "safe-write.h" #else # include "safe-read.h" #endif /* Get ssize_t. */ #include #include #include #ifdef EINTR # define IS_EINTR(x) ((x) == EINTR) #else # define IS_EINTR(x) 0 #endif #include "sys-limits.h" #ifdef SAFE_WRITE # define safe_rw safe_write # define rw write #else # define safe_rw safe_read # define rw read # undef const # define const /* empty */ #endif /* Read(write) up to COUNT bytes at BUF from(to) descriptor FD, retrying if interrupted. Return the actual number of bytes read(written), zero for EOF, or SAFE_READ_ERROR(SAFE_WRITE_ERROR) upon error. */ size_t safe_rw (int fd, void const *buf, size_t count) { for (;;) { ssize_t result = rw (fd, buf, count); if (0 <= result) return result; else if (IS_EINTR (errno)) continue; else if (errno == EINVAL && SYS_BUFSIZE_MAX < count) count = SYS_BUFSIZE_MAX; else return result; } } kbuild-3608/src/grep/lib/sys_types.in.h0000664000175000017500000000617114670377426020045 0ustar locutuslocutus/* Provide a more complete sys/types.h. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined _WIN32 && !defined __CYGWIN__ \ && (defined __need_off_t || defined __need___off64_t \ || defined __need_ssize_t || defined __need_time_t) /* Special invocation convention inside mingw header files. */ #@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_SYS_TYPES_H /* The include_next requires a split double-inclusion guard. */ # define _GL_INCLUDING_SYS_TYPES_H #@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ # undef _GL_INCLUDING_SYS_TYPES_H #ifndef _@GUARD_PREFIX@_SYS_TYPES_H #define _@GUARD_PREFIX@_SYS_TYPES_H /* Override off_t if Large File Support is requested on native Windows. */ #if @WINDOWS_64_BIT_OFF_T@ /* Same as int64_t in . */ # if defined _MSC_VER # define off_t __int64 # else # define off_t long long int # endif /* Indicator, for gnulib internal purposes. */ # define _GL_WINDOWS_64_BIT_OFF_T 1 #endif /* Override dev_t and ino_t if distinguishable inodes support is requested on native Windows. */ #if @WINDOWS_STAT_INODES@ # if @WINDOWS_STAT_INODES@ == 2 /* Experimental, not useful in Windows 10. */ /* Define dev_t to a 64-bit type. */ # if !defined GNULIB_defined_dev_t typedef unsigned long long int rpl_dev_t; # undef dev_t # define dev_t rpl_dev_t # define GNULIB_defined_dev_t 1 # endif /* Define ino_t to a 128-bit type. */ # if !defined GNULIB_defined_ino_t /* MSVC does not have a 128-bit integer type. GCC has a 128-bit integer type __int128, but only on 64-bit targets. */ typedef struct { unsigned long long int _gl_ino[2]; } rpl_ino_t; # undef ino_t # define ino_t rpl_ino_t # define GNULIB_defined_ino_t 1 # endif # else /* @WINDOWS_STAT_INODES@ == 1 */ /* Define ino_t to a 64-bit type. */ # if !defined GNULIB_defined_ino_t typedef unsigned long long int rpl_ino_t; # undef ino_t # define ino_t rpl_ino_t # define GNULIB_defined_ino_t 1 # endif # endif /* Indicator, for gnulib internal purposes. */ # define _GL_WINDOWS_STAT_INODES @WINDOWS_STAT_INODES@ #endif /* MSVC 9 defines size_t in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if (defined _WIN32 && ! defined __CYGWIN__) && ! defined __GLIBC__ # include #endif #endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ #endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ #endif /* __need_XXX */ kbuild-3608/src/grep/lib/realloc.c0000664000175000017500000000313114670377426017003 0ustar locutuslocutus/* realloc() function that is glibc compatible. Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Jim Meyering and Bruno Haible */ #include #include #include #include "xalloc-oversized.h" /* Call the system's realloc below. This file does not define _GL_USE_STDLIB_ALLOC because it needs Gnulib's malloc if present. */ #undef realloc /* Change the size of an allocated block of memory P to N bytes, with error checking. If P is NULL, use malloc. Otherwise if N is zero, free P and return NULL. */ void * rpl_realloc (void *p, size_t n) { if (p == NULL) return malloc (n); if (n == 0) { free (p); return NULL; } if (xalloc_oversized (n, 1)) { errno = ENOMEM; return NULL; } void *result = realloc (p, n); #if !HAVE_MALLOC_POSIX if (result == NULL) errno = ENOMEM; #endif return result; } kbuild-3608/src/grep/lib/ialloc.h0000664000175000017500000000445414670377423016640 0ustar locutuslocutus/* ialloc.h -- malloc with idx_t rather than size_t Copyright 2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef IALLOC_H_ #define IALLOC_H_ #include "idx.h" #include #include #include #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef IALLOC_INLINE # define IALLOC_INLINE _GL_INLINE #endif #ifdef __cplusplus extern "C" { #endif IALLOC_INLINE void * _GL_ATTRIBUTE_COLD _gl_alloc_nomem (void) { errno = ENOMEM; return NULL; } IALLOC_INLINE _GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/ void * imalloc (idx_t s) { return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem (); } IALLOC_INLINE /*_GL_ATTRIBUTE_DEALLOC_FREE*/ void * irealloc (void *p, idx_t s) { /* Work around GNU realloc glitch by treating a zero size as if it were 1, so that returning NULL is equivalent to failing. */ return s <= SIZE_MAX ? realloc (p, s | !s) : _gl_alloc_nomem (); } IALLOC_INLINE _GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/ void * icalloc (idx_t n, idx_t s) { if (SIZE_MAX < n) { if (s != 0) return _gl_alloc_nomem (); n = 0; } if (SIZE_MAX < s) { if (n != 0) return _gl_alloc_nomem (); s = 0; } return calloc (n, s); } IALLOC_INLINE void * ireallocarray (void *p, idx_t n, idx_t s) { /* Work around GNU reallocarray glitch by treating a zero size as if it were 1, so that returning NULL is equivalent to failing. */ if (n == 0 || s == 0) n = s = 1; return (n <= SIZE_MAX && s <= SIZE_MAX ? reallocarray (p, n, s) : _gl_alloc_nomem ()); } #ifdef __cplusplus } #endif #endif kbuild-3608/src/grep/lib/uniwidth/0000775000175000017500000000000014670377426017053 5ustar locutuslocutuskbuild-3608/src/grep/lib/uniwidth/width.c0000664000175000017500000006556214670377426020354 0ustar locutuslocutus/* Determine display width of Unicode character. Copyright (C) 2001-2002, 2006-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2002. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "uniwidth.h" #include "cjk.h" /* * Non-spacing attribute table. * Consists of: * - Non-spacing characters; generated from PropList.txt or * "grep '^[^;]*;[^;]*;[^;]*;[^;]*;NSM;' UnicodeData.txt" * - Format control characters; generated from * "grep '^[^;]*;[^;]*;Cf;' UnicodeData.txt" * - Zero width characters; generated from * "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt" */ static const unsigned char nonspacing_table_data[38*64] = { /* 0x0000-0x01ff */ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */ 0xff, 0xff, 0xff, 0xff, 0x00, 0x20, 0x00, 0x00, /* 0x0080-0x00bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00c0-0x00ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0100-0x013f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0140-0x017f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0180-0x01bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x01c0-0x01ff */ /* 0x0200-0x03ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0200-0x023f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0240-0x027f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0280-0x02bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x02c0-0x02ff */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x0300-0x033f */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* 0x0340-0x037f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0380-0x03bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x03c0-0x03ff */ /* 0x0400-0x05ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0400-0x043f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0440-0x047f */ 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0480-0x04bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04c0-0x04ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0500-0x053f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0540-0x057f */ 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xbf, /* 0x0580-0x05bf */ 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x05c0-0x05ff */ /* 0x0600-0x07ff */ 0x3f, 0x00, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */ 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0680-0x06bf */ 0x00, 0x00, 0xc0, 0xbf, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */ 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x0700-0x073f */ 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0740-0x077f */ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, /* 0x0780-0x07bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x07c0-0x07ff */ /* 0x0800-0x09ff */ 0x00, 0x00, 0xc0, 0xfb, 0xef, 0x3e, 0x00, 0x00, /* 0x0800-0x083f */ 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */ 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x08c0-0x08ff */ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, /* 0x0900-0x093f */ 0xfe, 0x21, 0xfe, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */ 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x09c0-0x09ff */ /* 0x0a00-0x0bff */ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a00-0x0a3f */ 0x86, 0x39, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, /* 0x0a40-0x0a7f */ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a80-0x0abf */ 0xbe, 0x21, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0ac0-0x0aff */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0x0b00-0x0b3f */ 0x1e, 0x20, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0b40-0x0b7f */ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b80-0x0bbf */ 0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0bc0-0x0bff */ /* 0x0c00-0x0dff */ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, /* 0x0c00-0x0c3f */ 0xc1, 0x3d, 0x60, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0c40-0x0c7f */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0c80-0x0cbf */ 0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0cc0-0x0cff */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d00-0x0d3f */ 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0d40-0x0d7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d80-0x0dbf */ 0x00, 0x04, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0dc0-0x0dff */ /* 0x0e00-0x0fff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x07, /* 0x0e00-0x0e3f */ 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0e40-0x0e7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x1b, /* 0x0e80-0x0ebf */ 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0ec0-0x0eff */ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xa0, 0x02, /* 0x0f00-0x0f3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, /* 0x0f40-0x0f7f */ 0xdf, 0xe0, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x1f, /* 0x0f80-0x0fbf */ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0fc0-0x0fff */ /* 0x1000-0x11ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xfd, 0x66, /* 0x1000-0x103f */ 0x00, 0x00, 0x00, 0xc3, 0x01, 0x00, 0x1e, 0x00, /* 0x1040-0x107f */ 0x64, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c0-0x10ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1100-0x113f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1140-0x117f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1180-0x11bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c0-0x11ff */ /* 0x1200-0x13ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1200-0x123f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1240-0x127f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1280-0x12bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x12c0-0x12ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1300-0x133f */ 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, /* 0x1340-0x137f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1380-0x13bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13c0-0x13ff */ /* 0x1600-0x17ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1600-0x163f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1640-0x167f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1680-0x16bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16c0-0x16ff */ 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, /* 0x1700-0x173f */ 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1740-0x177f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x3f, /* 0x1780-0x17bf */ 0x40, 0xfe, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x17c0-0x17ff */ /* 0x1800-0x19ff */ 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1840-0x187f */ 0x60, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18c0-0x18ff */ 0x00, 0x00, 0x00, 0x00, 0x87, 0x01, 0x04, 0x0e, /* 0x1900-0x193f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1940-0x197f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1980-0x19bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x19c0-0x19ff */ /* 0x1a00-0x1bff */ 0x00, 0x00, 0x80, 0x09, 0x00, 0x00, 0x00, 0x00, /* 0x1a00-0x1a3f */ 0x00, 0x00, 0x40, 0x7f, 0xe5, 0x1f, 0xf8, 0x9f, /* 0x1a40-0x1a7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, /* 0x1a80-0x1abf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ac0-0x1aff */ 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x17, /* 0x1b00-0x1b3f */ 0x04, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x1b40-0x1b7f */ 0x03, 0x00, 0x00, 0x00, 0x3c, 0x3b, 0x00, 0x00, /* 0x1b80-0x1bbf */ 0x00, 0x00, 0x00, 0x00, 0x40, 0xa3, 0x03, 0x00, /* 0x1bc0-0x1bff */ /* 0x1c00-0x1dff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xcf, 0x00, /* 0x1c00-0x1c3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c40-0x1c7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c80-0x1cbf */ 0x00, 0x00, 0xf7, 0xff, 0xfd, 0x21, 0x10, 0x03, /* 0x1cc0-0x1cff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d00-0x1d3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d40-0x1d7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d80-0x1dbf */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf8, /* 0x1dc0-0x1dff */ /* 0x2000-0x21ff */ 0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */ 0x00, 0x00, 0x00, 0x00, 0xdf, 0xff, 0x00, 0x00, /* 0x2040-0x207f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2080-0x20bf */ 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, /* 0x20c0-0x20ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2100-0x213f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2140-0x217f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2180-0x21bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x21c0-0x21ff */ /* 0x2c00-0x2dff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c00-0x2c3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c40-0x2c7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c80-0x2cbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, /* 0x2cc0-0x2cff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d00-0x2d3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x2d40-0x2d7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d80-0x2dbf */ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x2dc0-0x2dff */ /* 0x3000-0x31ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x3000-0x303f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3040-0x307f */ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, /* 0x3080-0x30bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30c0-0x30ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3100-0x313f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3140-0x317f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3180-0x31bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x31c0-0x31ff */ /* 0xa600-0xa7ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa600-0xa63f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xf7, 0x3f, /* 0xa640-0xa67f */ 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, /* 0xa680-0xa6bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0xa6c0-0xa6ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa700-0xa73f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa740-0xa77f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa780-0xa7bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa7c0-0xa7ff */ /* 0xa800-0xa9ff */ 0x44, 0x08, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0xa800-0xa83f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa840-0xa87f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa880-0xa8bf */ 0x30, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, /* 0xa8c0-0xa8ff */ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, /* 0xa900-0xa93f */ 0x80, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa940-0xa97f */ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x13, /* 0xa980-0xa9bf */ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, /* 0xa9c0-0xa9ff */ /* 0xaa00-0xabff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x66, 0x00, /* 0xaa00-0xaa3f */ 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0xaa40-0xaa7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0xc1, /* 0xaa80-0xaabf */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x30, 0x40, 0x00, /* 0xaac0-0xaaff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab00-0xab3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab40-0xab7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab80-0xabbf */ 0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x00, 0x00, /* 0xabc0-0xabff */ /* 0xfa00-0xfbff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa00-0xfa3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa40-0xfa7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa80-0xfabf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfac0-0xfaff */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0xfb00-0xfb3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb40-0xfb7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb80-0xfbbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfbc0-0xfbff */ /* 0xfe00-0xffff */ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, /* 0xfe00-0xfe3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe40-0xfe7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe80-0xfebf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0xfec0-0xfeff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff00-0xff3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff40-0xff7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff80-0xffbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, /* 0xffc0-0xffff */ /* 0x10000-0x101ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10000-0x1003f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10040-0x1007f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10080-0x100bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x100c0-0x100ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10100-0x1013f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10140-0x1017f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10180-0x101bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, /* 0x101c0-0x101ff */ /* 0x10200-0x103ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10200-0x1023f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10240-0x1027f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10280-0x102bf */ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* 0x102c0-0x102ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10300-0x1033f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, /* 0x10340-0x1037f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10380-0x103bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x103c0-0x103ff */ /* 0x10a00-0x10bff */ 0x6e, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, /* 0x10a00-0x10a3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a40-0x10a7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a80-0x10abf */ 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0x10ac0-0x10aff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b00-0x10b3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b40-0x10b7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b80-0x10bbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10bc0-0x10bff */ /* 0x11000-0x111ff */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11000-0x1103f */ 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x11040-0x1107f */ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x26, /* 0x11080-0x110bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x110c0-0x110ff */ 0x07, 0x00, 0x00, 0x00, 0x80, 0xef, 0x1f, 0x00, /* 0x11100-0x1113f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, /* 0x11140-0x1117f */ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x7f, /* 0x11180-0x111bf */ 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x111c0-0x111ff */ /* 0x11200-0x113ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd3, 0x40, /* 0x11200-0x1123f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11240-0x1127f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11280-0x112bf */ 0x00, 0x00, 0x00, 0x80, 0xf8, 0x07, 0x00, 0x00, /* 0x112c0-0x112ff */ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x11300-0x1133f */ 0x01, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x1f, 0x00, /* 0x11340-0x1137f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11380-0x113bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x113c0-0x113ff */ /* 0x11400-0x115ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11400-0x1143f */ 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11440-0x1147f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x85, /* 0x11480-0x114bf */ 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x114c0-0x114ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11500-0x1153f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11540-0x1157f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xb0, /* 0x11580-0x115bf */ 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, /* 0x115c0-0x115ff */ /* 0x11600-0x117ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xa7, /* 0x11600-0x1163f */ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11640-0x1167f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0xbf, 0x00, /* 0x11680-0x116bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x116c0-0x116ff */ 0x00, 0x00, 0x00, 0xe0, 0xbc, 0x0f, 0x00, 0x00, /* 0x11700-0x1173f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11740-0x1177f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11780-0x117bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x117c0-0x117ff */ /* 0x11c00-0x11dff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x3f, /* 0x11c00-0x11c3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c40-0x11c7f */ 0x00, 0x00, 0xfc, 0xff, 0xff, 0xfc, 0x6d, 0x00, /* 0x11c80-0x11cbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11cc0-0x11cff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d00-0x11d3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d40-0x11d7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d80-0x11dbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11dc0-0x11dff */ /* 0x16a00-0x16bff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a00-0x16a3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a40-0x16a7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a80-0x16abf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, /* 0x16ac0-0x16aff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, /* 0x16b00-0x16b3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16b40-0x16b7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16b80-0x16bbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16bc0-0x16bff */ /* 0x16e00-0x16fff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e00-0x16e3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e40-0x16e7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e80-0x16ebf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16ec0-0x16eff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f00-0x16f3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f40-0x16f7f */ 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f80-0x16fbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16fc0-0x16fff */ /* 0x1bc00-0x1bdff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc00-0x1bc3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc40-0x1bc7f */ 0x00, 0x00, 0x00, 0x60, 0x0f, 0x00, 0x00, 0x00, /* 0x1bc80-0x1bcbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bcc0-0x1bcff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd00-0x1bd3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd40-0x1bd7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd80-0x1bdbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bdc0-0x1bdff */ /* 0x1d000-0x1d1ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d000-0x1d03f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d040-0x1d07f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d080-0x1d0bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d0c0-0x1d0ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d100-0x1d13f */ 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xf8, 0xff, /* 0x1d140-0x1d17f */ 0xe7, 0x0f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x1d180-0x1d1bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d1c0-0x1d1ff */ /* 0x1d200-0x1d3ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d200-0x1d23f */ 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d240-0x1d27f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d280-0x1d2bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d2c0-0x1d2ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d300-0x1d33f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d340-0x1d37f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d380-0x1d3bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d3c0-0x1d3ff */ /* 0x1da00-0x1dbff */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf8, /* 0x1da00-0x1da3f */ 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x20, 0x00, /* 0x1da40-0x1da7f */ 0x10, 0x00, 0x00, 0xf8, 0xfe, 0xff, 0x00, 0x00, /* 0x1da80-0x1dabf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dac0-0x1daff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db00-0x1db3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db40-0x1db7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db80-0x1dbbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dbc0-0x1dbff */ /* 0x1e000-0x1e1ff */ 0x7f, 0xff, 0xff, 0xf9, 0xdb, 0x07, 0x00, 0x00, /* 0x1e000-0x1e03f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e040-0x1e07f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e080-0x1e0bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e0c0-0x1e0ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e100-0x1e13f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e140-0x1e17f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e180-0x1e1bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e1c0-0x1e1ff */ /* 0x1e800-0x1e9ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e800-0x1e83f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e840-0x1e87f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e880-0x1e8bf */ 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e8c0-0x1e8ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e900-0x1e93f */ 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e940-0x1e97f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e980-0x1e9bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x1e9c0-0x1e9ff */ }; static const signed char nonspacing_table_ind[248] = { 0, 1, 2, 3, 4, 5, 6, 7, /* 0x0000-0x0fff */ 8, 9, -1, 10, 11, 12, 13, -1, /* 0x1000-0x1fff */ 14, -1, -1, -1, -1, -1, 15, -1, /* 0x2000-0x2fff */ 16, -1, -1, -1, -1, -1, -1, -1, /* 0x3000-0x3fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x4000-0x4fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x5000-0x5fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x6000-0x6fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x7000-0x7fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x8000-0x8fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x9000-0x9fff */ -1, -1, -1, 17, 18, 19, -1, -1, /* 0xa000-0xafff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb000-0xbfff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0xc000-0xcfff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0xd000-0xdfff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */ -1, -1, -1, -1, -1, 20, -1, 21, /* 0xf000-0xffff */ 22, 23, -1, -1, -1, 24, -1, -1, /* 0x10000-0x10fff */ 25, 26, 27, 28, -1, -1, 29, -1, /* 0x11000-0x11fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */ -1, -1, -1, -1, -1, 30, -1, 31, /* 0x16000-0x16fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */ -1, -1, -1, -1, -1, -1, 32, -1, /* 0x1b000-0x1bfff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1c000-0x1cfff */ 33, 34, -1, -1, -1, 35, -1, -1, /* 0x1d000-0x1dfff */ 36, -1, -1, -1, 37, -1, -1, -1 /* 0x1e000-0x1efff */ }; /* Determine number of column positions required for UC. */ int uc_width (ucs4_t uc, const char *encoding) { /* Test for non-spacing or control character. */ if ((uc >> 9) < 248) { int ind = nonspacing_table_ind[uc >> 9]; if (ind >= 0) if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1) { if (uc > 0 && uc < 0xa0) return -1; else return 0; } } else if ((uc >> 9) == (0xe0000 >> 9)) { if (uc >= 0xe0100) { if (uc <= 0xe01ef) return 0; } else { if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001) return 0; } } /* Test for double-width character. * Generated from "grep '^[^;]\{4,5\};[WF]' EastAsianWidth.txt" * and "grep '^[^;]\{4,5\};[^WF]' EastAsianWidth.txt" */ if (uc >= 0x1100 && ((uc < 0x1160) /* Hangul Jamo */ || (uc >= 0x2329 && uc < 0x232b) /* Angle Brackets */ || (uc >= 0x2e80 && uc < 0xa4d0 /* CJK ... Yi */ && !(uc == 0x303f) && !(uc >= 0x4dc0 && uc < 0x4e00)) || (uc >= 0xac00 && uc < 0xd7a4) /* Hangul Syllables */ || (uc >= 0xf900 && uc < 0xfb00) /* CJK Compatibility Ideographs */ || (uc >= 0xfe10 && uc < 0xfe20) /* Presentation Forms for Vertical */ || (uc >= 0xfe30 && uc < 0xfe70) /* CJK Compatibility Forms */ || (uc >= 0xff00 && uc < 0xff61) /* Fullwidth Forms */ || (uc >= 0xffe0 && uc < 0xffe7) /* Fullwidth Signs */ || (uc >= 0x20000 && uc <= 0x2ffff) /* Supplementary Ideographic Plane */ || (uc >= 0x30000 && uc <= 0x3ffff) /* Tertiary Ideographic Plane */ ) ) return 2; /* In ancient CJK encodings, Cyrillic and most other characters are double-width as well. */ if (uc >= 0x00A1 && uc < 0xFF61 && uc != 0x20A9 && is_cjk_encoding (encoding)) return 2; return 1; } kbuild-3608/src/grep/lib/uniwidth/cjk.h0000664000175000017500000000316714670377426020002 0ustar locutuslocutus/* Test for CJK encoding. Copyright (C) 2001-2002, 2005-2007, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2002. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include "streq.h" static int is_cjk_encoding (const char *encoding) { if (0 /* Legacy Japanese encodings */ || STREQ_OPT (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0) /* Legacy Chinese encodings */ || STREQ_OPT (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) || STREQ_OPT (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0) || STREQ_OPT (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0) || STREQ_OPT (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0) /* Legacy Korean encodings */ || STREQ_OPT (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) || STREQ_OPT (encoding, "CP949", 'C', 'P', '9', '4', '9', 0, 0, 0, 0) || STREQ_OPT (encoding, "JOHAB", 'J', 'O', 'H', 'A', 'B', 0, 0, 0, 0)) return 1; return 0; } kbuild-3608/src/grep/lib/iswblank.c0000664000175000017500000000157314670377424017202 0ustar locutuslocutus/* Test wide character for being blank. Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include int iswblank (wint_t wc) { return wc == ' ' || wc == '\t'; } kbuild-3608/src/grep/lib/iconv_open-zos.gperf0000664000175000017500000000363414670377424021221 0ustar locutuslocutus/* Character set conversion. Copyright (C) 2019-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ struct mapping { int standard_name; const char vendor_name[10 + 1]; }; %struct-type %language=ANSI-C %define slot-name standard_name %define hash-function-name mapping_hash %define lookup-function-name mapping_lookup %readonly-tables %global-table %define word-array-name mappings %pic %% ASCII, "00367" ISO-8859-1, "ISO8859-1" ISO-8859-2, "ISO8859-2" ISO-8859-3, "00913" ISO-8859-4, "ISO8859-4" ISO-8859-5, "ISO8859-5" ISO-8859-6, "ISO8859-6" ISO-8859-7, "ISO8859-7" ISO-8859-8, "05012" ISO-8859-9, "ISO8859-9" ISO-8859-13, "ISO8859-13" ISO-8859-15, "ISO8859-15" KOI8-R, "00878" KOI8-U, "01168" CP437, "IBM-437" CP775, "00775" CP850, "09042" CP852, "IBM-852" CP855, "13143" CP856, "IBM-856" CP857, "00857" CP861, "IBM-861" CP862, "IBM-862" CP864, "IBM-864" CP865, "00865" CP866, "04962" CP869, "IBM-869" CP874, "TIS-620" CP922, "IBM-922" CP932, "IBM-943" CP943, "IBM-943" CP949, "IBM-1363" CP1046, "IBM-1046" CP1124, "IBM-1124" CP1125, "IBM-1125" CP1129, "01129" CP1131, "01131" CP1250, "IBM-5346" CP1251, "IBM-5347" CP1252, "IBM-5348" CP1253, "IBM-5349" CP1254, "IBM-5350" CP1255, "09447" CP1256, "09448" CP1257, "09449" GB2312, "IBM-eucCN" EUC-JP, "01350" EUC-KR, "IBM-eucKR" GBK, "IBM-1386" kbuild-3608/src/grep/lib/cycle-check.c0000664000175000017500000000520114670377422017530 0ustar locutuslocutus/* help detect directory cycles efficiently Copyright (C) 2003-2006, 2009-2021 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 . */ /* Written by Jim Meyering */ #include #include "cycle-check.h" #include #include #include #include #include #include "assure.h" #define CC_MAGIC 9827862 /* Return true if I is a power of 2, or is zero. */ static bool is_zero_or_power_of_two (uintmax_t i) { return (i & (i - 1)) == 0; } void cycle_check_init (struct cycle_check_state *state) { state->chdir_counter = 0; state->magic = CC_MAGIC; } /* In traversing a directory hierarchy, call this function once for each descending chdir call, with SB corresponding to the chdir operand. If SB corresponds to a directory that has already been seen, return true to indicate that there is a directory cycle. Note that this is done "lazily", which means that some of the directories in the cycle may be processed twice before the cycle is detected. */ bool cycle_check (struct cycle_check_state *state, struct stat const *sb) { assure (state->magic == CC_MAGIC); /* If the current directory ever happens to be the same as the one we last recorded for the cycle detection, then it's obviously part of a cycle. */ if (state->chdir_counter && SAME_INODE (*sb, state->dev_ino)) return true; /* If the number of "descending" chdir calls is a power of two, record the dev/ino of the current directory. */ if (is_zero_or_power_of_two (++(state->chdir_counter))) { /* On all architectures that we know about, if the counter overflows then there is a directory cycle here somewhere, even if we haven't detected it yet. Typically this happens only after the counter is incremented 2**64 times, so it's a fairly theoretical point. */ if (state->chdir_counter == 0) return true; state->dev_ino.st_dev = sb->st_dev; state->dev_ino.st_ino = sb->st_ino; } return false; } kbuild-3608/src/grep/lib/xbinary-io.h0000664000175000017500000000263514670377426017460 0ustar locutuslocutus/* Binary mode I/O with checking Copyright 2017-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _XBINARY_IO_H #define _XBINARY_IO_H #include "binary-io.h" #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef XBINARY_IO_INLINE # define XBINARY_IO_INLINE _GL_INLINE #endif #if O_BINARY extern _Noreturn void xset_binary_mode_error (void); #else XBINARY_IO_INLINE void xset_binary_mode_error (void) {} #endif /* Set the mode of FD to MODE, which should be either O_TEXT or O_BINARY. Report an error and exit if this fails. */ XBINARY_IO_INLINE void xset_binary_mode (int fd, int mode) { if (set_binary_mode (fd, mode) < 0) xset_binary_mode_error (); } _GL_INLINE_HEADER_END #endif /* _XBINARY_IO_H */ kbuild-3608/src/grep/lib/close.c0000664000175000017500000000314314670377422016466 0ustar locutuslocutus/* close replacement. Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include "fd-hook.h" #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" #endif #undef close #if defined _WIN32 && !defined __CYGWIN__ # if HAVE_MSVC_INVALID_PARAMETER_HANDLER static int close_nothrow (int fd) { int result; TRY_MSVC_INVAL { result = _close (fd); } CATCH_MSVC_INVAL { result = -1; errno = EBADF; } DONE_MSVC_INVAL; return result; } # else # define close_nothrow _close # endif #else # define close_nothrow close #endif /* Override close() to call into other gnulib modules. */ int rpl_close (int fd) { #if WINDOWS_SOCKETS int retval = execute_all_close_hooks (close_nothrow, fd); #else int retval = close_nothrow (fd); #endif #if REPLACE_FCHDIR if (retval >= 0) _gl_unregister_fd (fd); #endif return retval; } kbuild-3608/src/grep/lib/gettext.h0000664000175000017500000002502514670377423017056 0ustar locutuslocutus/* Convenience header for conditional use of GNU . Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 /* NLS can be disabled through the configure --disable-nls option or through "#define ENABLE NLS 0" before including this file. */ #if defined ENABLE_NLS && ENABLE_NLS /* Get declarations of GNU message catalog functions. */ # include /* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by the gettext() and ngettext() macros. This is an alternative to calling textdomain(), and is useful for libraries. */ # ifdef DEFAULT_TEXT_DOMAIN # undef gettext # define gettext(Msgid) \ dgettext (DEFAULT_TEXT_DOMAIN, Msgid) # undef ngettext # define ngettext(Msgid1, Msgid2, N) \ dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) # endif #else /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of a NOP. We don't include as well because people using "gettext.h" will not include , and also including would fail on SunOS 4, whereas is OK. */ #if defined(__sun) # include #endif /* Many header files from the libstdc++ coming with g++ 3.3 or newer include , which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of a NOP. */ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) # include # if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H # include # endif #endif /* Disabled NLS. The casts to 'const char *' serve the purpose of producing warnings for invalid uses of the value returned from these functions. On pre-ANSI systems without 'const', the config.h file is supposed to contain "#define const". */ # undef gettext # define gettext(Msgid) ((const char *) (Msgid)) # undef dgettext # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) # undef dcgettext # define dcgettext(Domainname, Msgid, Category) \ ((void) (Category), dgettext (Domainname, Msgid)) # undef ngettext # define ngettext(Msgid1, Msgid2, N) \ ((N) == 1 \ ? ((void) (Msgid2), (const char *) (Msgid1)) \ : ((void) (Msgid1), (const char *) (Msgid2))) # undef dngettext # define dngettext(Domainname, Msgid1, Msgid2, N) \ ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) # undef dcngettext # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) # undef textdomain # define textdomain(Domainname) ((const char *) (Domainname)) # undef bindtextdomain # define bindtextdomain(Domainname, Dirname) \ ((void) (Domainname), (const char *) (Dirname)) # undef bind_textdomain_codeset # define bind_textdomain_codeset(Domainname, Codeset) \ ((void) (Domainname), (const char *) (Codeset)) #endif /* Prefer gnulib's setlocale override over libintl's setlocale override. */ #ifdef GNULIB_defined_setlocale # undef setlocale # define setlocale rpl_setlocale #endif /* A pseudo function call that serves as a marker for the automated extraction of messages, but does not call gettext(). The run-time translation is done at a different place in the code. The argument, String, should be a literal string. Concatenated strings and other string expressions won't work. The macro's expansion is not parenthesized, so that it is suitable as initializer for static 'char[]' or 'const char[]' variables. */ #define gettext_noop(String) String /* The separator between msgctxt and msgid in a .mo file. */ #define GETTEXT_CONTEXT_GLUE "\004" /* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be short and rarely need to change. The letter 'p' stands for 'particular' or 'special'. */ #ifdef DEFAULT_TEXT_DOMAIN # define pgettext(Msgctxt, Msgid) \ pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #else # define pgettext(Msgctxt, Msgid) \ pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #endif #define dpgettext(Domainname, Msgctxt, Msgid) \ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) #ifdef DEFAULT_TEXT_DOMAIN # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #else # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #endif #define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * pgettext_aux (const char *domain, const char *msg_ctxt_id, const char *msgid, int category) { const char *translation = dcgettext (domain, msg_ctxt_id, category); if (translation == msg_ctxt_id) return msgid; else return translation; } #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * npgettext_aux (const char *domain, const char *msg_ctxt_id, const char *msgid, const char *msgid_plural, unsigned long int n, int category) { const char *translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); if (translation == msg_ctxt_id || translation == msgid_plural) return (n == 1 ? msgid : msgid_plural); else return translation; } /* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID can be arbitrary expressions. But for string literals these macros are less efficient than those above. */ #include /* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported. This relates to the -Wvla and -Wvla-larger-than warnings, enabled in the default GCC many warnings set. This allows programs to disable use of VLAs, which may be unintended, or may be awkward to support portably, or may have security implications due to non-deterministic stack usage. */ #if (!defined GNULIB_NO_VLA \ && (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc) || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )) # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 #else # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 #endif #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #include #endif #define pgettext_expr(Msgctxt, Msgid) \ dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) #define dpgettext_expr(Domainname, Msgctxt, Msgid) \ dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * dcpgettext_expr (const char *domain, const char *msgctxt, const char *msgid, int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; const char *translation; #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS char msg_ctxt_id[msgctxt_len + msgid_len]; #else char buf[1024]; char *msg_ctxt_id = (msgctxt_len + msgid_len <= sizeof (buf) ? buf : (char *) malloc (msgctxt_len + msgid_len)); if (msg_ctxt_id != NULL) #endif { int found_translation; memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcgettext (domain, msg_ctxt_id, category); found_translation = (translation != msg_ctxt_id); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif if (found_translation) return translation; } return msgid; } #define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) #define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * dcnpgettext_expr (const char *domain, const char *msgctxt, const char *msgid, const char *msgid_plural, unsigned long int n, int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; const char *translation; #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS char msg_ctxt_id[msgctxt_len + msgid_len]; #else char buf[1024]; char *msg_ctxt_id = (msgctxt_len + msgid_len <= sizeof (buf) ? buf : (char *) malloc (msgctxt_len + msgid_len)); if (msg_ctxt_id != NULL) #endif { int found_translation; memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif if (found_translation) return translation; } return (n == 1 ? msgid : msgid_plural); } #endif /* _LIBGETTEXT_H */ kbuild-3608/src/grep/lib/unistd.c0000664000175000017500000000154114670377426016673 0ustar locutuslocutus/* Inline functions for . Copyright (C) 2012-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #define _GL_UNISTD_INLINE _GL_EXTERN_INLINE #include "unistd.h" typedef int dummy; kbuild-3608/src/grep/lib/stdio.in.h0000664000175000017500000017141614670377426017132 0ustar locutuslocutus/* A GNU-like . Copyright (C) 2004, 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H /* Special invocation convention: - Inside glibc header files. - On OSF/1 5.1 we have a sequence of nested includes -> -> -> -> -> -> -> . In this situation, the functions are not yet declared, therefore we cannot provide the C++ aliases. */ #@INCLUDE_NEXT@ @NEXT_STDIO_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_STDIO_H #define _GL_ALREADY_INCLUDING_STDIO_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STDIO_H@ #undef _GL_ALREADY_INCLUDING_STDIO_H #ifndef _@GUARD_PREFIX@_STDIO_H #define _@GUARD_PREFIX@_STDIO_H /* Get va_list. Needed on many systems, including glibc 2.8. */ #include #include /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 and eglibc 2.11.2. May also define off_t to a 64-bit type on native Windows. */ #include /* The __attribute__ feature is available in gcc versions 2.5 and later. The __-protected variants of the attributes 'format' and 'printf' are accepted by gcc versions 2.6.4 (effectively 2.7) and later. We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because gnulib and libintl do '#define printf __printf__' when they override the 'printf' function. */ #ifndef _GL_ATTRIBUTE_FORMAT # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__ # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) # else # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ # endif #endif /* An __attribute__ __format__ specifier for a function that takes a format string and arguments, where the format string directives are the ones standardized by ISO C99 and POSIX. _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */ /* __gnu_printf__ is supported in GCC >= 4.4. */ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) # define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__ #else # define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__ #endif /* An __attribute__ __format__ specifier for a function that takes a format string and arguments, where the format string directives are the ones of the system printf(), rather than the ones standardized by ISO C99 and POSIX. _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM */ /* On mingw, Gnulib sets __USE_MINGW_ANSI_STDIO in order to get closer to the standards. The macro GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU indicates whether this change is effective. On older mingw, it is not. */ #if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU # define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD #else # define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM __printf__ #endif /* _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD indicates to GCC that the function takes a format string and arguments, where the format string directives are the ones standardized by ISO C99 and POSIX. */ #define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument)) /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD, except that it indicates to GCC that the supported format string directives are the ones of the system printf(), rather than the ones standardized by ISO C99 and POSIX. */ #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, formatstring_parameter, first_argument)) /* _GL_ATTRIBUTE_FORMAT_SCANF indicates to GCC that the function takes a format string and arguments, where the format string directives are the ones standardized by ISO C99 and POSIX. */ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument)) #else # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) #endif /* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF, except that it indicates to GCC that the supported format string directives are the ones of the system scanf(), rather than the ones standardized by ISO C99 and POSIX. */ #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) /* Solaris 10 and NetBSD 7.0 declare renameat in , not in . */ /* But in any case avoid namespace pollution on glibc systems. */ #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ && ! defined __GLIBC__ # include #endif /* Android 4.3 declares renameat in , not in . */ /* But in any case avoid namespace pollution on glibc systems. */ #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ && ! defined __GLIBC__ # include #endif /* MSVC declares 'perror' in , not in . We must include it before we #define perror rpl_perror. */ /* But in any case avoid namespace pollution on glibc systems. */ #if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \ && (defined _WIN32 && ! defined __CYGWIN__) \ && ! defined __GLIBC__ # include #endif /* MSVC declares 'remove' in , not in . We must include it before we #define remove rpl_remove. */ /* MSVC declares 'rename' in , not in . We must include it before we #define rename rpl_rename. */ /* But in any case avoid namespace pollution on glibc systems. */ #if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \ && (defined _WIN32 && ! defined __CYGWIN__) \ && ! defined __GLIBC__ # include #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Macros for stringification. */ #define _GL_STDIO_STRINGIZE(token) #token #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) /* When also using extern inline, suppress the use of static inline in standard headers of problematic Apple configurations, as Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., . Perhaps Apple will fix this some day. */ #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ && defined __GNUC__ && defined __STDC__) # undef putc_unlocked #endif #if @GNULIB_DPRINTF@ # if @REPLACE_DPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dprintf rpl_dprintf # endif _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); # else # if !@HAVE_DPRINTF@ _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); # endif _GL_CXXALIASWARN (dprintf); #elif defined GNULIB_POSIXCHECK # undef dprintf # if HAVE_RAW_DECL_DPRINTF _GL_WARN_ON_USE (dprintf, "dprintf is unportable - " "use gnulib module dprintf for portability"); # endif #endif #if @GNULIB_FCLOSE@ /* Close STREAM and its underlying file descriptor. */ # if @REPLACE_FCLOSE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fclose rpl_fclose # endif _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fclose); # endif #elif defined GNULIB_POSIXCHECK # undef fclose /* Assume fclose is always declared. */ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " "use gnulib module fclose for portable POSIX compliance"); #endif #if @GNULIB_MDA_FCLOSEALL@ /* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have it. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fcloseall # define fcloseall _fcloseall # endif _GL_CXXALIAS_MDA (fcloseall, int, (void)); # else # if @HAVE_DECL_FCLOSEALL@ # if defined __FreeBSD__ || defined __DragonFly__ _GL_CXXALIAS_SYS (fcloseall, void, (void)); # else _GL_CXXALIAS_SYS (fcloseall, int, (void)); # endif # endif # endif # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@ _GL_CXXALIASWARN (fcloseall); # endif #endif #if @GNULIB_FDOPEN@ # if @REPLACE_FDOPEN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fdopen # define fdopen rpl_fdopen # endif _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fdopen # define fdopen _fdopen # endif _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); # else # if __GNUC__ >= 11 /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ _GL_FUNCDECL_SYS (fdopen, FILE *, (int fd, const char *mode) _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); # endif _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); # endif _GL_CXXALIASWARN (fdopen); #else # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ _GL_FUNCDECL_SYS (fdopen, FILE *, (int fd, const char *mode) _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); # endif # if defined GNULIB_POSIXCHECK # undef fdopen /* Assume fdopen is always declared. */ _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " "use gnulib module fdopen for portability"); # elif @GNULIB_MDA_FDOPEN@ /* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::fdopen always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fdopen # define fdopen _fdopen # endif _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); # else _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); # endif _GL_CXXALIASWARN (fdopen); # endif #endif #if @GNULIB_FFLUSH@ /* Flush all pending data on STREAM according to POSIX rules. Both output and seekable input streams are supported. Note! LOSS OF DATA can occur if fflush is applied on an input stream that is _not_seekable_ or on an update stream that is _not_seekable_ and in which the most recent operation was input. Seekability can be tested with lseek(fileno(fp),0,SEEK_CUR). */ # if @REPLACE_FFLUSH@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fflush rpl_fflush # endif _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); # else _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fflush); # endif #elif defined GNULIB_POSIXCHECK # undef fflush /* Assume fflush is always declared. */ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " "use gnulib module fflush for portable POSIX compliance"); #endif #if @GNULIB_FGETC@ # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fgetc # define fgetc rpl_fgetc # endif _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fgetc); # endif #endif #if @GNULIB_FGETS@ # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fgets # define fgets rpl_fgets # endif _GL_FUNCDECL_RPL (fgets, char *, (char *restrict s, int n, FILE *restrict stream) _GL_ARG_NONNULL ((1, 3))); _GL_CXXALIAS_RPL (fgets, char *, (char *restrict s, int n, FILE *restrict stream)); # else _GL_CXXALIAS_SYS (fgets, char *, (char *restrict s, int n, FILE *restrict stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fgets); # endif #endif #if @GNULIB_MDA_FILENO@ /* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::fileno always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fileno # define fileno _fileno # endif _GL_CXXALIAS_MDA (fileno, int, (FILE *restrict stream)); # else _GL_CXXALIAS_SYS (fileno, int, (FILE *restrict stream)); # endif _GL_CXXALIASWARN (fileno); #endif #if @GNULIB_FOPEN@ # if @REPLACE_FOPEN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fopen # define fopen rpl_fopen # endif _GL_FUNCDECL_RPL (fopen, FILE *, (const char *restrict filename, const char *restrict mode) _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); _GL_CXXALIAS_RPL (fopen, FILE *, (const char *restrict filename, const char *restrict mode)); # else # if __GNUC__ >= 11 /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ _GL_FUNCDECL_SYS (fopen, FILE *, (const char *restrict filename, const char *restrict mode) _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); # endif _GL_CXXALIAS_SYS (fopen, FILE *, (const char *restrict filename, const char *restrict mode)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fopen); # endif #else # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ _GL_FUNCDECL_SYS (fopen, FILE *, (const char *restrict filename, const char *restrict mode) _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); # endif # if defined GNULIB_POSIXCHECK # undef fopen /* Assume fopen is always declared. */ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " "use gnulib module fopen for portability"); # endif #endif #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fprintf rpl_fprintf # endif # define GNULIB_overrides_fprintf 1 # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL (fprintf, int, (FILE *restrict fp, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((1, 2))); # else _GL_FUNCDECL_RPL (fprintf, int, (FILE *restrict fp, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_RPL (fprintf, int, (FILE *restrict fp, const char *restrict format, ...)); # else _GL_CXXALIAS_SYS (fprintf, int, (FILE *restrict fp, const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fprintf); # endif #endif #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_fprintf # undef fprintf # endif /* Assume fprintf is always declared. */ _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " "use gnulib module fprintf-posix for portable " "POSIX compliance"); #endif #if @GNULIB_FPURGE@ /* Discard all pending buffered I/O data on STREAM. STREAM must not be wide-character oriented. When discarding pending output, the file position is set back to where it was before the write calls. When discarding pending input, the file position is advanced to match the end of the previously read input. Return 0 if successful. Upon error, return -1 and set errno. */ # if @REPLACE_FPURGE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fpurge rpl_fpurge # endif _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); # else # if !@HAVE_DECL_FPURGE@ _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); # endif _GL_CXXALIASWARN (fpurge); #elif defined GNULIB_POSIXCHECK # undef fpurge # if HAVE_RAW_DECL_FPURGE _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " "use gnulib module fpurge for portability"); # endif #endif #if @GNULIB_FPUTC@ # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fputc # define fputc rpl_fputc # endif _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); # else _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fputc); # endif #endif #if @GNULIB_FPUTS@ # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fputs # define fputs rpl_fputs # endif _GL_FUNCDECL_RPL (fputs, int, (const char *restrict string, FILE *restrict stream) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (fputs, int, (const char *restrict string, FILE *restrict stream)); # else _GL_CXXALIAS_SYS (fputs, int, (const char *restrict string, FILE *restrict stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fputs); # endif #endif #if @GNULIB_FREAD@ # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fread # define fread rpl_fread # endif _GL_FUNCDECL_RPL (fread, size_t, (void *restrict ptr, size_t s, size_t n, FILE *restrict stream) _GL_ARG_NONNULL ((4))); _GL_CXXALIAS_RPL (fread, size_t, (void *restrict ptr, size_t s, size_t n, FILE *restrict stream)); # else _GL_CXXALIAS_SYS (fread, size_t, (void *restrict ptr, size_t s, size_t n, FILE *restrict stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fread); # endif #endif #if @GNULIB_FREOPEN@ # if @REPLACE_FREOPEN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef freopen # define freopen rpl_freopen # endif _GL_FUNCDECL_RPL (freopen, FILE *, (const char *restrict filename, const char *restrict mode, FILE *restrict stream) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (freopen, FILE *, (const char *restrict filename, const char *restrict mode, FILE *restrict stream)); # else _GL_CXXALIAS_SYS (freopen, FILE *, (const char *restrict filename, const char *restrict mode, FILE *restrict stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (freopen); # endif #elif defined GNULIB_POSIXCHECK # undef freopen /* Assume freopen is always declared. */ _GL_WARN_ON_USE (freopen, "freopen on native Windows platforms is not POSIX compliant - " "use gnulib module freopen for portability"); #endif #if @GNULIB_FSCANF@ # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fscanf # define fscanf rpl_fscanf # endif _GL_FUNCDECL_RPL (fscanf, int, (FILE *restrict stream, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (fscanf, int, (FILE *restrict stream, const char *restrict format, ...)); # else _GL_CXXALIAS_SYS (fscanf, int, (FILE *restrict stream, const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fscanf); # endif #endif /* Set up the following warnings, based on which modules are in use. GNU Coding Standards discourage the use of fseek, since it imposes an arbitrary limitation on some 32-bit hosts. Remember that the fseek module depends on the fseeko module, so we only have three cases to consider: 1. The developer is not using either module. Issue a warning under GNULIB_POSIXCHECK for both functions, to remind them that both functions have bugs on some systems. _GL_NO_LARGE_FILES has no impact on this warning. 2. The developer is using both modules. They may be unaware of the arbitrary limitations of fseek, so issue a warning under GNULIB_POSIXCHECK. On the other hand, they may be using both modules intentionally, so the developer can define _GL_NO_LARGE_FILES in the compilation units where the use of fseek is safe, to silence the warning. 3. The developer is using the fseeko module, but not fseek. Gnulib guarantees that fseek will still work around platform bugs in that case, but we presume that the developer is aware of the pitfalls of fseek and was trying to avoid it, so issue a warning even when GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be defined to silence the warning in particular compilation units. In C++ compilations with GNULIB_NAMESPACE, in order to avoid that fseek gets defined as a macro, it is recommended that the developer uses the fseek module, even if he is not calling the fseek function. Most gnulib clients that perform stream operations should fall into category 3. */ #if @GNULIB_FSEEK@ # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES # define _GL_FSEEK_WARN /* Category 2, above. */ # undef fseek # endif # if @REPLACE_FSEEK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fseek # define fseek rpl_fseek # endif _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); # else _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fseek); # endif #endif #if @GNULIB_FSEEKO@ # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES # define _GL_FSEEK_WARN /* Category 3, above. */ # undef fseek # endif # if @REPLACE_FSEEKO@ /* Provide an fseeko function that is aware of a preceding fflush(), and which detects pipes. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fseeko # define fseeko rpl_fseeko # endif _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); # else # if ! @HAVE_DECL_FSEEKO@ _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); # endif _GL_CXXALIASWARN (fseeko); #elif defined GNULIB_POSIXCHECK # define _GL_FSEEK_WARN /* Category 1, above. */ # undef fseek # undef fseeko # if HAVE_RAW_DECL_FSEEKO _GL_WARN_ON_USE (fseeko, "fseeko is unportable - " "use gnulib module fseeko for portability"); # endif #endif #ifdef _GL_FSEEK_WARN # undef _GL_FSEEK_WARN /* Here, either fseek is undefined (but C89 guarantees that it is declared), or it is defined as rpl_fseek (declared above). */ _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB " "on 32-bit platforms - " "use fseeko function for handling of large files"); #endif /* ftell, ftello. See the comments on fseek/fseeko. */ #if @GNULIB_FTELL@ # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES # define _GL_FTELL_WARN /* Category 2, above. */ # undef ftell # endif # if @REPLACE_FTELL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ftell # define ftell rpl_ftell # endif _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); # else _GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (ftell); # endif #endif #if @GNULIB_FTELLO@ # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES # define _GL_FTELL_WARN /* Category 3, above. */ # undef ftell # endif # if @REPLACE_FTELLO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ftello # define ftello rpl_ftello # endif _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); # else # if ! @HAVE_DECL_FTELLO@ _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); # endif _GL_CXXALIASWARN (ftello); #elif defined GNULIB_POSIXCHECK # define _GL_FTELL_WARN /* Category 1, above. */ # undef ftell # undef ftello # if HAVE_RAW_DECL_FTELLO _GL_WARN_ON_USE (ftello, "ftello is unportable - " "use gnulib module ftello for portability"); # endif #endif #ifdef _GL_FTELL_WARN # undef _GL_FTELL_WARN /* Here, either ftell is undefined (but C89 guarantees that it is declared), or it is defined as rpl_ftell (declared above). */ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " "on 32-bit platforms - " "use ftello function for handling of large files"); #endif #if @GNULIB_FWRITE@ # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fwrite # define fwrite rpl_fwrite # endif _GL_FUNCDECL_RPL (fwrite, size_t, (const void *restrict ptr, size_t s, size_t n, FILE *restrict stream) _GL_ARG_NONNULL ((1, 4))); _GL_CXXALIAS_RPL (fwrite, size_t, (const void *restrict ptr, size_t s, size_t n, FILE *restrict stream)); # else _GL_CXXALIAS_SYS (fwrite, size_t, (const void *restrict ptr, size_t s, size_t n, FILE *restrict stream)); /* Work around bug 11959 when fortifying glibc 2.4 through 2.15 , which sometimes causes an unwanted diagnostic for fwrite calls. This affects only function declaration attributes under certain versions of gcc and clang, and is not needed for C++. */ # if (0 < __USE_FORTIFY_LEVEL \ && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ && !defined __cplusplus) # undef fwrite # undef fwrite_unlocked extern size_t __REDIRECT (rpl_fwrite, (const void *__restrict, size_t, size_t, FILE *__restrict), fwrite); extern size_t __REDIRECT (rpl_fwrite_unlocked, (const void *__restrict, size_t, size_t, FILE *__restrict), fwrite_unlocked); # define fwrite rpl_fwrite # define fwrite_unlocked rpl_fwrite_unlocked # endif # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fwrite); # endif #endif #if @GNULIB_GETC@ # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getc # define getc rpl_fgetc # endif _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (getc, int, (FILE *stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (getc); # endif #endif #if @GNULIB_GETCHAR@ # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getchar # define getchar rpl_getchar # endif _GL_FUNCDECL_RPL (getchar, int, (void)); _GL_CXXALIAS_RPL (getchar, int, (void)); # else _GL_CXXALIAS_SYS (getchar, int, (void)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (getchar); # endif #endif #if @GNULIB_GETDELIM@ /* Read input, up to (and including) the next occurrence of DELIMITER, from STREAM, store it in *LINEPTR (and NUL-terminate it). *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE bytes of space. It is realloc'd as necessary. Return the number of bytes read and stored at *LINEPTR (not including the NUL terminator), or -1 on error or EOF. */ # if @REPLACE_GETDELIM@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getdelim # define getdelim rpl_getdelim # endif _GL_FUNCDECL_RPL (getdelim, ssize_t, (char **restrict lineptr, size_t *restrict linesize, int delimiter, FILE *restrict stream) _GL_ARG_NONNULL ((1, 2, 4))); _GL_CXXALIAS_RPL (getdelim, ssize_t, (char **restrict lineptr, size_t *restrict linesize, int delimiter, FILE *restrict stream)); # else # if !@HAVE_DECL_GETDELIM@ _GL_FUNCDECL_SYS (getdelim, ssize_t, (char **restrict lineptr, size_t *restrict linesize, int delimiter, FILE *restrict stream) _GL_ARG_NONNULL ((1, 2, 4))); # endif _GL_CXXALIAS_SYS (getdelim, ssize_t, (char **restrict lineptr, size_t *restrict linesize, int delimiter, FILE *restrict stream)); # endif _GL_CXXALIASWARN (getdelim); #elif defined GNULIB_POSIXCHECK # undef getdelim # if HAVE_RAW_DECL_GETDELIM _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " "use gnulib module getdelim for portability"); # endif #endif #if @GNULIB_GETLINE@ /* Read a line, up to (and including) the next newline, from STREAM, store it in *LINEPTR (and NUL-terminate it). *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE bytes of space. It is realloc'd as necessary. Return the number of bytes read and stored at *LINEPTR (not including the NUL terminator), or -1 on error or EOF. */ # if @REPLACE_GETLINE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getline # define getline rpl_getline # endif _GL_FUNCDECL_RPL (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, FILE *restrict stream) _GL_ARG_NONNULL ((1, 2, 3))); _GL_CXXALIAS_RPL (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, FILE *restrict stream)); # else # if !@HAVE_DECL_GETLINE@ _GL_FUNCDECL_SYS (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, FILE *restrict stream) _GL_ARG_NONNULL ((1, 2, 3))); # endif _GL_CXXALIAS_SYS (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, FILE *restrict stream)); # endif # if @HAVE_DECL_GETLINE@ _GL_CXXALIASWARN (getline); # endif #elif defined GNULIB_POSIXCHECK # undef getline # if HAVE_RAW_DECL_GETLINE _GL_WARN_ON_USE (getline, "getline is unportable - " "use gnulib module getline for portability"); # endif #endif /* It is very rare that the developer ever has full control of stdin, so any use of gets warrants an unconditional warning; besides, C11 removed it. */ #undef gets #if HAVE_RAW_DECL_GETS && !defined __cplusplus _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); #endif #if @GNULIB_MDA_GETW@ /* On native Windows, map 'getw' to '_getw', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::getw always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getw # define getw _getw # endif _GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream)); # else _GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream)); # endif _GL_CXXALIASWARN (getw); #endif #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ struct obstack; /* Grow an obstack with formatted output. Return the number of bytes added to OBS. No trailing nul byte is added, and the object should be closed with obstack_finish before use. Upon memory allocation error, call obstack_alloc_failed_handler. Upon other error, return -1. */ # if @REPLACE_OBSTACK_PRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define obstack_printf rpl_obstack_printf # endif _GL_FUNCDECL_RPL (obstack_printf, int, (struct obstack *obs, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (obstack_printf, int, (struct obstack *obs, const char *format, ...)); # else # if !@HAVE_DECL_OBSTACK_PRINTF@ _GL_FUNCDECL_SYS (obstack_printf, int, (struct obstack *obs, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (obstack_printf, int, (struct obstack *obs, const char *format, ...)); # endif _GL_CXXALIASWARN (obstack_printf); # if @REPLACE_OBSTACK_PRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define obstack_vprintf rpl_obstack_vprintf # endif _GL_FUNCDECL_RPL (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args)); # else # if !@HAVE_DECL_OBSTACK_PRINTF@ _GL_FUNCDECL_SYS (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args)); # endif _GL_CXXALIASWARN (obstack_vprintf); #endif #if @GNULIB_PCLOSE@ # if !@HAVE_PCLOSE@ _GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); _GL_CXXALIASWARN (pclose); #elif defined GNULIB_POSIXCHECK # undef pclose # if HAVE_RAW_DECL_PCLOSE _GL_WARN_ON_USE (pclose, "pclose is unportable - " "use gnulib module pclose for more portability"); # endif #endif #if @GNULIB_PERROR@ /* Print a message to standard error, describing the value of ERRNO, (if STRING is not NULL and not empty) prefixed with STRING and ": ", and terminated with a newline. */ # if @REPLACE_PERROR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define perror rpl_perror # endif _GL_FUNCDECL_RPL (perror, void, (const char *string)); _GL_CXXALIAS_RPL (perror, void, (const char *string)); # else _GL_CXXALIAS_SYS (perror, void, (const char *string)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (perror); # endif #elif defined GNULIB_POSIXCHECK # undef perror /* Assume perror is always declared. */ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " "use gnulib module perror for portability"); #endif #if @GNULIB_POPEN@ # if @REPLACE_POPEN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef popen # define popen rpl_popen # endif _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); # else # if !@HAVE_POPEN@ || __GNUC__ >= 11 _GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); # endif _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); # endif _GL_CXXALIASWARN (popen); #else # if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen /* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ _GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); # endif # if defined GNULIB_POSIXCHECK # undef popen # if HAVE_RAW_DECL_POPEN _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " "use gnulib module popen or pipe for more portability"); # endif # endif #endif #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if defined __GNUC__ || defined __clang__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) /* Don't break __attribute__((format(printf,M,N))). */ # define printf __printf__ # endif # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL_1 (__printf__, int, (const char *restrict format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) _GL_ARG_NONNULL ((1))); # else _GL_FUNCDECL_RPL_1 (__printf__, int, (const char *restrict format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); # else # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define printf rpl_printf # endif _GL_FUNCDECL_RPL (printf, int, (const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); # endif # define GNULIB_overrides_printf 1 # else _GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (printf); # endif #endif #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_printf # undef printf # endif /* Assume printf is always declared. */ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " "use gnulib module printf-posix for portable " "POSIX compliance"); #endif #if @GNULIB_PUTC@ # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putc # define putc rpl_fputc # endif _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); # else _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (putc); # endif #endif #if @GNULIB_PUTCHAR@ # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putchar # define putchar rpl_putchar # endif _GL_FUNCDECL_RPL (putchar, int, (int c)); _GL_CXXALIAS_RPL (putchar, int, (int c)); # else _GL_CXXALIAS_SYS (putchar, int, (int c)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (putchar); # endif #endif #if @GNULIB_PUTS@ # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef puts # define puts rpl_puts # endif _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (puts, int, (const char *string)); # else _GL_CXXALIAS_SYS (puts, int, (const char *string)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (puts); # endif #endif #if @GNULIB_MDA_PUTW@ /* On native Windows, map 'putw' to '_putw', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::putw always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putw # define putw _putw # endif _GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream)); # else _GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream)); # endif _GL_CXXALIASWARN (putw); #endif #if @GNULIB_REMOVE@ # if @REPLACE_REMOVE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef remove # define remove rpl_remove # endif _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (remove, int, (const char *name)); # else _GL_CXXALIAS_SYS (remove, int, (const char *name)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (remove); # endif #elif defined GNULIB_POSIXCHECK # undef remove /* Assume remove is always declared. */ _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " "use gnulib module remove for more portability"); #endif #if @GNULIB_RENAME@ # if @REPLACE_RENAME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef rename # define rename rpl_rename # endif _GL_FUNCDECL_RPL (rename, int, (const char *old_filename, const char *new_filename) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (rename, int, (const char *old_filename, const char *new_filename)); # else _GL_CXXALIAS_SYS (rename, int, (const char *old_filename, const char *new_filename)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (rename); # endif #elif defined GNULIB_POSIXCHECK # undef rename /* Assume rename is always declared. */ _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " "use gnulib module rename for more portability"); #endif #if @GNULIB_RENAMEAT@ # if @REPLACE_RENAMEAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef renameat # define renameat rpl_renameat # endif _GL_FUNCDECL_RPL (renameat, int, (int fd1, char const *file1, int fd2, char const *file2) _GL_ARG_NONNULL ((2, 4))); _GL_CXXALIAS_RPL (renameat, int, (int fd1, char const *file1, int fd2, char const *file2)); # else # if !@HAVE_RENAMEAT@ _GL_FUNCDECL_SYS (renameat, int, (int fd1, char const *file1, int fd2, char const *file2) _GL_ARG_NONNULL ((2, 4))); # endif _GL_CXXALIAS_SYS (renameat, int, (int fd1, char const *file1, int fd2, char const *file2)); # endif _GL_CXXALIASWARN (renameat); #elif defined GNULIB_POSIXCHECK # undef renameat # if HAVE_RAW_DECL_RENAMEAT _GL_WARN_ON_USE (renameat, "renameat is not portable - " "use gnulib module renameat for portability"); # endif #endif #if @GNULIB_SCANF@ # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ # if defined __GNUC__ || defined __clang__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef scanf /* Don't break __attribute__((format(scanf,M,N))). */ # define scanf __scanf__ # endif _GL_FUNCDECL_RPL_1 (__scanf__, int, (const char *restrict format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); # else # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef scanf # define scanf rpl_scanf # endif _GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); # endif # else _GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (scanf); # endif #endif #if @GNULIB_SNPRINTF@ # if @REPLACE_SNPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define snprintf rpl_snprintf # endif # define GNULIB_overrides_snprintf 1 _GL_FUNCDECL_RPL (snprintf, int, (char *restrict str, size_t size, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (snprintf, int, (char *restrict str, size_t size, const char *restrict format, ...)); # else # if !@HAVE_DECL_SNPRINTF@ _GL_FUNCDECL_SYS (snprintf, int, (char *restrict str, size_t size, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (snprintf, int, (char *restrict str, size_t size, const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (snprintf); # endif #elif defined GNULIB_POSIXCHECK # undef snprintf # if HAVE_RAW_DECL_SNPRINTF _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " "use gnulib module snprintf for portability"); # endif #endif /* Some people would argue that all sprintf uses should be warned about (for example, OpenBSD issues a link warning for it), since it can cause security holes due to buffer overruns. However, we believe that sprintf can be used safely, and is more efficient than snprintf in those safe cases; and as proof of our belief, we use sprintf in several gnulib modules. So this header intentionally avoids adding a warning to sprintf except when GNULIB_POSIXCHECK is defined. */ #if @GNULIB_SPRINTF_POSIX@ # if @REPLACE_SPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define sprintf rpl_sprintf # endif # define GNULIB_overrides_sprintf 1 _GL_FUNCDECL_RPL (sprintf, int, (char *restrict str, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (sprintf, int, (char *restrict str, const char *restrict format, ...)); # else _GL_CXXALIAS_SYS (sprintf, int, (char *restrict str, const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (sprintf); # endif #elif defined GNULIB_POSIXCHECK # undef sprintf /* Assume sprintf is always declared. */ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " "use gnulib module sprintf-posix for portable " "POSIX compliance"); #endif #if @GNULIB_MDA_TEMPNAM@ /* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::tempnam always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef tempnam # define tempnam _tempnam # endif _GL_CXXALIAS_MDA (tempnam, char *, (const char *dir, const char *prefix)); # else _GL_CXXALIAS_SYS (tempnam, char *, (const char *dir, const char *prefix)); # endif _GL_CXXALIASWARN (tempnam); #endif #if @GNULIB_TMPFILE@ # if @REPLACE_TMPFILE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define tmpfile rpl_tmpfile # endif _GL_FUNCDECL_RPL (tmpfile, FILE *, (void) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); # else # if __GNUC__ >= 11 /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ _GL_FUNCDECL_SYS (tmpfile, FILE *, (void) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); # endif _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (tmpfile); # endif #else # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ _GL_FUNCDECL_SYS (tmpfile, FILE *, (void) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); # endif # if defined GNULIB_POSIXCHECK # undef tmpfile # if HAVE_RAW_DECL_TMPFILE _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " "use gnulib module tmpfile for portability"); # endif # endif #endif #if @GNULIB_VASPRINTF@ /* Write formatted output to a string dynamically allocated with malloc(). If the memory allocation succeeds, store the address of the string in *RESULT and return the number of resulting bytes, excluding the trailing NUL. Upon memory allocation error, or some other error, return -1. */ # if @REPLACE_VASPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define asprintf rpl_asprintf # endif # define GNULIB_overrides_asprintf _GL_FUNCDECL_RPL (asprintf, int, (char **result, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (asprintf, int, (char **result, const char *format, ...)); # else # if !@HAVE_VASPRINTF@ _GL_FUNCDECL_SYS (asprintf, int, (char **result, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (asprintf, int, (char **result, const char *format, ...)); # endif _GL_CXXALIASWARN (asprintf); # if @REPLACE_VASPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vasprintf rpl_vasprintf # endif # define GNULIB_overrides_vasprintf 1 _GL_FUNCDECL_RPL (vasprintf, int, (char **result, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vasprintf, int, (char **result, const char *format, va_list args)); # else # if !@HAVE_VASPRINTF@ _GL_FUNCDECL_SYS (vasprintf, int, (char **result, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (vasprintf, int, (char **result, const char *format, va_list args)); # endif _GL_CXXALIASWARN (vasprintf); #endif #if @GNULIB_VDPRINTF@ # if @REPLACE_VDPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vdprintf rpl_vdprintf # endif _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *restrict format, va_list args)); # else # if !@HAVE_VDPRINTF@ _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((2))); # endif /* Need to cast, because on Solaris, the third parameter will likely be __va_list args. */ _GL_CXXALIAS_SYS_CAST (vdprintf, int, (int fd, const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vdprintf); # endif #elif defined GNULIB_POSIXCHECK # undef vdprintf # if HAVE_RAW_DECL_VDPRINTF _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " "use gnulib module vdprintf for portability"); # endif #endif #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vfprintf rpl_vfprintf # endif # define GNULIB_overrides_vfprintf 1 # if @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL (vfprintf, int, (FILE *restrict fp, const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((1, 2))); # else _GL_FUNCDECL_RPL (vfprintf, int, (FILE *restrict fp, const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_RPL (vfprintf, int, (FILE *restrict fp, const char *restrict format, va_list args)); # else /* Need to cast, because on Solaris, the third parameter is __va_list args and GCC's fixincludes did not change this to __gnuc_va_list. */ _GL_CXXALIAS_SYS_CAST (vfprintf, int, (FILE *restrict fp, const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vfprintf); # endif #endif #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_vfprintf # undef vfprintf # endif /* Assume vfprintf is always declared. */ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " "use gnulib module vfprintf-posix for portable " "POSIX compliance"); #endif #if @GNULIB_VFSCANF@ # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef vfscanf # define vfscanf rpl_vfscanf # endif _GL_FUNCDECL_RPL (vfscanf, int, (FILE *restrict stream, const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vfscanf, int, (FILE *restrict stream, const char *restrict format, va_list args)); # else _GL_CXXALIAS_SYS (vfscanf, int, (FILE *restrict stream, const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vfscanf); # endif #endif #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vprintf rpl_vprintf # endif # define GNULIB_overrides_vprintf 1 # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) _GL_ARG_NONNULL ((1))); # else _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args)); # else /* Need to cast, because on Solaris, the second parameter is __va_list args and GCC's fixincludes did not change this to __gnuc_va_list. */ _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vprintf); # endif #endif #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_vprintf # undef vprintf # endif /* Assume vprintf is always declared. */ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " "use gnulib module vprintf-posix for portable " "POSIX compliance"); #endif #if @GNULIB_VSCANF@ # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef vscanf # define vscanf rpl_vscanf # endif _GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); # else _GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vscanf); # endif #endif #if @GNULIB_VSNPRINTF@ # if @REPLACE_VSNPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vsnprintf rpl_vsnprintf # endif # define GNULIB_overrides_vsnprintf 1 _GL_FUNCDECL_RPL (vsnprintf, int, (char *restrict str, size_t size, const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (vsnprintf, int, (char *restrict str, size_t size, const char *restrict format, va_list args)); # else # if !@HAVE_DECL_VSNPRINTF@ _GL_FUNCDECL_SYS (vsnprintf, int, (char *restrict str, size_t size, const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (vsnprintf, int, (char *restrict str, size_t size, const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vsnprintf); # endif #elif defined GNULIB_POSIXCHECK # undef vsnprintf # if HAVE_RAW_DECL_VSNPRINTF _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " "use gnulib module vsnprintf for portability"); # endif #endif #if @GNULIB_VSPRINTF_POSIX@ # if @REPLACE_VSPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vsprintf rpl_vsprintf # endif # define GNULIB_overrides_vsprintf 1 _GL_FUNCDECL_RPL (vsprintf, int, (char *restrict str, const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vsprintf, int, (char *restrict str, const char *restrict format, va_list args)); # else /* Need to cast, because on Solaris, the third parameter is __va_list args and GCC's fixincludes did not change this to __gnuc_va_list. */ _GL_CXXALIAS_SYS_CAST (vsprintf, int, (char *restrict str, const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vsprintf); # endif #elif defined GNULIB_POSIXCHECK # undef vsprintf /* Assume vsprintf is always declared. */ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " "use gnulib module vsprintf-posix for portable " "POSIX compliance"); #endif #endif /* _@GUARD_PREFIX@_STDIO_H */ #endif /* _@GUARD_PREFIX@_STDIO_H */ #endif kbuild-3608/src/grep/lib/ctype.in.h0000664000175000017500000000346514670377422017126 0ustar locutuslocutus/* A substitute for ISO C99 , for platforms on which it is incomplete. Copyright (C) 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible. */ /* * ISO C 99 for platforms on which it is incomplete. * */ #ifndef _@GUARD_PREFIX@_CTYPE_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* Include the original . */ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_CTYPE_H@ #ifndef _@GUARD_PREFIX@_CTYPE_H #define _@GUARD_PREFIX@_CTYPE_H /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Return non-zero if c is a blank, i.e. a space or tab character. */ #if @GNULIB_ISBLANK@ # if !@HAVE_ISBLANK@ _GL_EXTERN_C int isblank (int c); # endif #elif defined GNULIB_POSIXCHECK # undef isblank # if HAVE_RAW_DECL_ISBLANK _GL_WARN_ON_USE (isblank, "isblank is unportable - " "use gnulib module isblank for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_CTYPE_H */ #endif /* _@GUARD_PREFIX@_CTYPE_H */ kbuild-3608/src/grep/lib/filenamecat.h0000664000175000017500000000231714670377423017641 0ustar locutuslocutus/* Concatenate two arbitrary file names. Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Jim Meyering. */ #include #if GNULIB_FILENAMECAT char *file_name_concat (char const *dir, char const *base, char **base_in_result) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; #endif char *mfile_name_concat (char const *dir, char const *base, char **base_in_result) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; kbuild-3608/src/grep/lib/binary-io.h0000664000175000017500000000473014670377422017262 0ustar locutuslocutus/* Binary mode I/O. Copyright (C) 2001, 2003, 2005, 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _BINARY_H #define _BINARY_H /* For systems that distinguish between text and binary I/O. O_BINARY is guaranteed by the gnulib . */ #include /* The MSVC7 doesn't like to be included after '#define fileno ...', so we include it here first. */ #include #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef BINARY_IO_INLINE # define BINARY_IO_INLINE _GL_INLINE #endif #if O_BINARY # if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ # include /* declares setmode() */ # define __gl_setmode setmode # else # ifdef KMK_GREP # include /* declares _setmode() */ # endif # define __gl_setmode _setmode # undef fileno # define fileno _fileno # endif #else /* On reasonable systems, binary I/O is the only choice. */ /* Use a function rather than a macro, to avoid gcc warnings "warning: statement with no effect". */ BINARY_IO_INLINE int __gl_setmode (int fd _GL_UNUSED, int mode _GL_UNUSED) { return O_BINARY; } #endif /* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. Return the old mode if successful, -1 (setting errno) on failure. Ordinarily this function would be called 'setmode', since that is its old name on MS-Windows, but it is called 'set_binary_mode' here to avoid colliding with a BSD function of another name. */ #if defined __DJGPP__ || defined __EMX__ extern int set_binary_mode (int fd, int mode); #else BINARY_IO_INLINE int set_binary_mode (int fd, int mode) { return __gl_setmode (fd, mode); } #endif /* This macro is obsolescent. */ #define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) _GL_INLINE_HEADER_END #endif /* _BINARY_H */ kbuild-3608/src/grep/lib/version-etc-fsf.c0000664000175000017500000000222214670377426020374 0ustar locutuslocutus/* Variable with FSF copyright information, for version-etc. Copyright (C) 1999-2006, 2009-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Jim Meyering. */ #include /* Specification. */ #include "version-etc.h" /* Default copyright goes to the FSF. */ const char version_etc_copyright[] = /* Do *not* mark this string for translation. %s is a copyright symbol suitable for this locale, and %d is the copyright year. */ "Copyright %s %d Free Software Foundation, Inc."; kbuild-3608/src/grep/lib/fopen.c0000664000175000017500000001454414670377423016500 0ustar locutuslocutus/* Open a stream to a file. Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2007. */ /* If the user's config.h happens to include , let it include only the system's here, so that orig_fopen doesn't recurse to rpl_fopen. */ #define _GL_ALREADY_INCLUDING_STDIO_H #include /* Get the original definition of fopen. It might be defined as a macro. */ #include #undef _GL_ALREADY_INCLUDING_STDIO_H static FILE * orig_fopen (const char *filename, const char *mode) { return fopen (filename, mode); } /* Specification. */ /* Write "stdio.h" here, not , otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include above. */ #include "stdio.h" #include #include #include #include #include #include #include FILE * rpl_fopen (const char *filename, const char *mode) { int open_direction; int open_flags; #if GNULIB_FOPEN_GNU bool open_flags_gnu; # define BUF_SIZE 80 char fdopen_mode_buf[BUF_SIZE + 1]; #endif #if defined _WIN32 && ! defined __CYGWIN__ if (strcmp (filename, "/dev/null") == 0) filename = "NUL"; #endif /* Parse the mode. */ open_direction = 0; open_flags = 0; #if GNULIB_FOPEN_GNU open_flags_gnu = false; #endif { const char *p = mode; #if GNULIB_FOPEN_GNU char *q = fdopen_mode_buf; #endif for (; *p != '\0'; p++) { switch (*p) { case 'r': open_direction = O_RDONLY; #if GNULIB_FOPEN_GNU if (q < fdopen_mode_buf + BUF_SIZE) *q++ = *p; #endif continue; case 'w': open_direction = O_WRONLY; open_flags |= O_CREAT | O_TRUNC; #if GNULIB_FOPEN_GNU if (q < fdopen_mode_buf + BUF_SIZE) *q++ = *p; #endif continue; case 'a': open_direction = O_WRONLY; open_flags |= O_CREAT | O_APPEND; #if GNULIB_FOPEN_GNU if (q < fdopen_mode_buf + BUF_SIZE) *q++ = *p; #endif continue; case 'b': /* While it is non-standard, O_BINARY is guaranteed by gnulib . We can also assume that orig_fopen supports the 'b' flag. */ open_flags |= O_BINARY; #if GNULIB_FOPEN_GNU if (q < fdopen_mode_buf + BUF_SIZE) *q++ = *p; #endif continue; case '+': open_direction = O_RDWR; #if GNULIB_FOPEN_GNU if (q < fdopen_mode_buf + BUF_SIZE) *q++ = *p; #endif continue; #if GNULIB_FOPEN_GNU case 'x': open_flags |= O_EXCL; open_flags_gnu = true; continue; case 'e': open_flags |= O_CLOEXEC; open_flags_gnu = true; continue; #endif default: break; } #if GNULIB_FOPEN_GNU /* The rest of the mode string can be a platform-dependent extension. Copy it unmodified. */ { size_t len = strlen (p); if (len > fdopen_mode_buf + BUF_SIZE - q) len = fdopen_mode_buf + BUF_SIZE - q; memcpy (q, p, len); q += len; } #endif break; } #if GNULIB_FOPEN_GNU *q = '\0'; #endif } #if FOPEN_TRAILING_SLASH_BUG /* Fail if the mode requires write access and the filename ends in a slash, as POSIX says such a filename must name a directory : "A pathname that contains at least one non- character and that ends with one or more trailing characters shall not be resolved successfully unless the last pathname component before the trailing characters names an existing directory" If the named file already exists as a directory, then if a mode that requires write access is specified, fopen() must fail because POSIX says that it fails with errno = EISDIR in this case. If the named file does not exist or does not name a directory, then fopen() must fail since the file does not contain a '.' directory. */ { size_t len = strlen (filename); if (len > 0 && filename[len - 1] == '/') { int fd; struct stat statbuf; FILE *fp; if (open_direction != O_RDONLY) { errno = EISDIR; return NULL; } fd = open (filename, open_direction | open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if (fd < 0) return NULL; if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) { close (fd); errno = ENOTDIR; return NULL; } # if GNULIB_FOPEN_GNU fp = fdopen (fd, fdopen_mode_buf); # else fp = fdopen (fd, mode); # endif if (fp == NULL) { int saved_errno = errno; close (fd); errno = saved_errno; } return fp; } } #endif #if GNULIB_FOPEN_GNU if (open_flags_gnu) { int fd; FILE *fp; fd = open (filename, open_direction | open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if (fd < 0) return NULL; fp = fdopen (fd, fdopen_mode_buf); if (fp == NULL) { int saved_errno = errno; close (fd); errno = saved_errno; } return fp; } #endif return orig_fopen (filename, mode); } kbuild-3608/src/grep/lib/fts-cycle.c0000664000175000017500000001026614670377423017257 0ustar locutuslocutus/* Detect cycles in file tree walks. Copyright (C) 2003-2006, 2009-2021 Free Software Foundation, Inc. Written by Jim Meyering. 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 . */ #include "cycle-check.h" #include "hash.h" /* Use each of these to map a device/inode pair to an FTSENT. */ struct Active_dir { dev_t dev; ino_t ino; FTSENT *fts_ent; }; static bool AD_compare (void const *x, void const *y) { struct Active_dir const *ax = x; struct Active_dir const *ay = y; return ax->ino == ay->ino && ax->dev == ay->dev; } static size_t AD_hash (void const *x, size_t table_size) { struct Active_dir const *ax = x; return (uintmax_t) ax->ino % table_size; } /* Set up the cycle-detection machinery. */ static bool setup_dir (FTS *fts) { if (fts->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL)) { enum { HT_INITIAL_SIZE = 31 }; fts->fts_cycle.ht = hash_initialize (HT_INITIAL_SIZE, NULL, AD_hash, AD_compare, free); if (! fts->fts_cycle.ht) return false; } else { fts->fts_cycle.state = malloc (sizeof *fts->fts_cycle.state); if (! fts->fts_cycle.state) return false; cycle_check_init (fts->fts_cycle.state); } return true; } /* Enter a directory during a file tree walk. */ static bool enter_dir (FTS *fts, FTSENT *ent) { if (fts->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL)) { struct stat const *st = ent->fts_statp; struct Active_dir *ad = malloc (sizeof *ad); struct Active_dir *ad_from_table; if (!ad) return false; ad->dev = st->st_dev; ad->ino = st->st_ino; ad->fts_ent = ent; /* See if we've already encountered this directory. This can happen when following symlinks as well as with a corrupted directory hierarchy. */ ad_from_table = hash_insert (fts->fts_cycle.ht, ad); if (ad_from_table != ad) { free (ad); if (!ad_from_table) return false; /* There was an entry with matching dev/inode already in the table. Record the fact that we've found a cycle. */ ent->fts_cycle = ad_from_table->fts_ent; ent->fts_info = FTS_DC; } } else { if (cycle_check (fts->fts_cycle.state, ent->fts_statp)) { /* FIXME: setting fts_cycle like this isn't proper. To do what the documentation requires, we'd have to go around the cycle again and find the right entry. But no callers in coreutils use the fts_cycle member. */ ent->fts_cycle = ent; ent->fts_info = FTS_DC; } } return true; } /* Leave a directory during a file tree walk. */ static void leave_dir (FTS *fts, FTSENT *ent) { struct stat const *st = ent->fts_statp; if (fts->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL)) { struct Active_dir obj; void *found; obj.dev = st->st_dev; obj.ino = st->st_ino; found = hash_remove (fts->fts_cycle.ht, &obj); if (!found) abort (); free (found); } else { FTSENT *parent = ent->fts_parent; if (parent != NULL && 0 <= parent->fts_level) CYCLE_CHECK_REFLECT_CHDIR_UP (fts->fts_cycle.state, *(parent->fts_statp), *st); } } /* Free any memory used for cycle detection. */ static void free_dir (FTS *sp) { if (sp->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL)) { if (sp->fts_cycle.ht) hash_free (sp->fts_cycle.ht); } else free (sp->fts_cycle.state); } kbuild-3608/src/grep/lib/mbuiter.c0000664000175000017500000000155614670377425017041 0ustar locutuslocutus/* Iterating through multibyte strings: macros for multi-byte encodings. Copyright (C) 2012-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #define MBUITER_INLINE _GL_EXTERN_INLINE #include "mbuiter.h" kbuild-3608/src/grep/lib/lseek.c0000664000175000017500000000363514670377424016474 0ustar locutuslocutus/* An lseek() function that detects pipes. Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #if defined _WIN32 && ! defined __CYGWIN__ /* Windows platforms. */ /* Get GetFileType. */ # include /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include # endif #else # include #endif #include #undef lseek off_t rpl_lseek (int fd, off_t offset, int whence) { #if defined _WIN32 && ! defined __CYGWIN__ /* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */ HANDLE h = (HANDLE) _get_osfhandle (fd); if (h == INVALID_HANDLE_VALUE) { errno = EBADF; return -1; } if (GetFileType (h) != FILE_TYPE_DISK) { errno = ESPIPE; return -1; } #else /* BeOS lseek mistakenly succeeds on pipes... */ struct stat statbuf; if (fstat (fd, &statbuf) < 0) return -1; if (!S_ISREG (statbuf.st_mode)) { errno = ESPIPE; return -1; } #endif #if _GL_WINDOWS_64_BIT_OFF_T || (defined __MINGW32__ && defined _FILE_OFFSET_BITS && (_FILE_OFFSET_BITS == 64)) return _lseeki64 (fd, offset, whence); #else return lseek (fd, offset, whence); #endif } kbuild-3608/src/grep/lib/xalloc.h0000664000175000017500000001506514670377426016662 0ustar locutuslocutus/* xalloc.h -- malloc with out-of-memory checking Copyright (C) 1990-2000, 2003-2004, 2006-2021 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 . */ #ifndef XALLOC_H_ #define XALLOC_H_ #include #include #include #if GNULIB_XALLOC # include "idx.h" # include "intprops.h" #endif #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef XALLOC_INLINE # define XALLOC_INLINE _GL_INLINE #endif #ifdef __cplusplus extern "C" { #endif #if GNULIB_XALLOC_DIE /* This function is always triggered when memory is exhausted. It must be defined by the application, either explicitly or by using gnulib's xalloc-die module. This is the function to call when one wants the program to die because of a memory allocation failure. */ /*extern*/ _Noreturn void xalloc_die (void); #endif /* GNULIB_XALLOC_DIE */ #if GNULIB_XALLOC void *xmalloc (size_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL; void *ximalloc (idx_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL; void *xzalloc (size_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL; void *xizalloc (idx_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL; void *xcalloc (size_t n, size_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)) _GL_ATTRIBUTE_RETURNS_NONNULL; void *xicalloc (idx_t n, idx_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)) _GL_ATTRIBUTE_RETURNS_NONNULL; void *xrealloc (void *p, size_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2)); void *xirealloc (void *p, idx_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2)) _GL_ATTRIBUTE_RETURNS_NONNULL; void *xreallocarray (void *p, size_t n, size_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)); void *xireallocarray (void *p, idx_t n, idx_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)) _GL_ATTRIBUTE_RETURNS_NONNULL; void *x2realloc (void *p, size_t *ps) /* superseded by xpalloc */ _GL_ATTRIBUTE_RETURNS_NONNULL; void *x2nrealloc (void *p, size_t *pn, size_t s) /* superseded by xpalloc */ _GL_ATTRIBUTE_RETURNS_NONNULL; void *xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s) _GL_ATTRIBUTE_RETURNS_NONNULL; void *xmemdup (void const *p, size_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_ALLOC_SIZE ((2)) _GL_ATTRIBUTE_RETURNS_NONNULL; void *ximemdup (void const *p, idx_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_ALLOC_SIZE ((2)) _GL_ATTRIBUTE_RETURNS_NONNULL; char *ximemdup0 (void const *p, idx_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; char *xstrdup (char const *str) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; /* In the following macros, T must be an elementary or structure/union or typedef'ed type, or a pointer to such a type. To apply one of the following macros to a function pointer or array type, you need to typedef it first and use the typedef name. */ /* Allocate an object of type T dynamically, with error checking. */ /* extern t *XMALLOC (typename t); */ # define XMALLOC(t) ((t *) xmalloc (sizeof (t))) /* Allocate memory for N elements of type T, with error checking. */ /* extern t *XNMALLOC (size_t n, typename t); */ # define XNMALLOC(n, t) \ ((t *) (sizeof (t) == 1 ? xmalloc (n) : xnmalloc (n, sizeof (t)))) /* Allocate an object of type T dynamically, with error checking, and zero it. */ /* extern t *XZALLOC (typename t); */ # define XZALLOC(t) ((t *) xzalloc (sizeof (t))) /* Allocate memory for N elements of type T, with error checking, and zero it. */ /* extern t *XCALLOC (size_t n, typename t); */ # define XCALLOC(n, t) \ ((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t)))) /* Allocate an array of N objects, each with S bytes of memory, dynamically, with error checking. S must be nonzero. */ void *xnmalloc (size_t n, size_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)) _GL_ATTRIBUTE_RETURNS_NONNULL; /* FIXME: Deprecate this in favor of xreallocarray? */ /* Change the size of an allocated block of memory P to an array of N objects each of S bytes, with error checking. S must be nonzero. */ XALLOC_INLINE void *xnrealloc (void *p, size_t n, size_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)); XALLOC_INLINE void * xnrealloc (void *p, size_t n, size_t s) { return xreallocarray (p, n, s); } /* Return a pointer to a new buffer of N bytes. This is like xmalloc, except it returns char *. */ char *xcharalloc (size_t n) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL; #endif /* GNULIB_XALLOC */ #ifdef __cplusplus } #endif #if GNULIB_XALLOC && defined __cplusplus /* C++ does not allow conversions from void * to other pointer types without a cast. Use templates to work around the problem when possible. */ template inline T * xrealloc (T *p, size_t s) { return (T *) xrealloc ((void *) p, s); } template inline T * xreallocarray (T *p, size_t n, size_t s) { return (T *) xreallocarray ((void *) p, n, s); } /* FIXME: Deprecate this in favor of xreallocarray? */ template inline T * xnrealloc (T *p, size_t n, size_t s) { return xreallocarray (p, n, s); } template inline T * x2realloc (T *p, size_t *pn) { return (T *) x2realloc ((void *) p, pn); } template inline T * x2nrealloc (T *p, size_t *pn, size_t s) { return (T *) x2nrealloc ((void *) p, pn, s); } template inline T * xmemdup (T const *p, size_t s) { return (T *) xmemdup ((void const *) p, s); } #endif /* GNULIB_XALLOC && C++ */ _GL_INLINE_HEADER_END #endif /* !XALLOC_H_ */ kbuild-3608/src/grep/lib/setlocale_null.h0000664000175000017500000000666414670377426020412 0ustar locutuslocutus/* Query the name of the current global locale. Copyright (C) 2019-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2019. */ #ifndef _SETLOCALE_NULL_H #define _SETLOCALE_NULL_H #include #include "arg-nonnull.h" #ifdef __cplusplus extern "C" { #endif /* Recommended size of a buffer for a locale name for a single category. On glibc systems, you can have locale names that are relative file names; assume a maximum length 256. In native Windows, in 2018 the longest locale name was of length 58 ("FYRO Macedonian_Former Yugoslav Republic of Macedonia.1251"). */ #define SETLOCALE_NULL_MAX (256+1) /* Recommended size of a buffer for a locale name with all categories. On glibc systems, you can have locale names that are relative file names; assume maximum length 256 for each. There are 12 categories; so, the maximum total length is 148+12*256. In native Windows, there are 5 categories, and the maximum total length is 55+5*58. */ #define SETLOCALE_NULL_ALL_MAX (148+12*256+1) /* setlocale_null_r (CATEGORY, BUF, BUFSIZE) is like setlocale (CATEGORY, NULL), except that - it is guaranteed to be multithread-safe, - it returns the resulting locale category name or locale name in the user-supplied buffer BUF, which must be BUFSIZE bytes long. The recommended minimum buffer size is - SETLOCALE_NULL_MAX for CATEGORY != LC_ALL, and - SETLOCALE_NULL_ALL_MAX for CATEGORY == LC_ALL. The return value is an error code: 0 if the call is successful, EINVAL if CATEGORY is invalid, or ERANGE if BUFSIZE is smaller than the length needed size (including the trailing NUL byte). In the latter case, a truncated result is returned in BUF, but still NUL-terminated if BUFSIZE > 0. For this call to be multithread-safe, *all* calls to setlocale (CATEGORY, NULL) in all other threads must have been converted to use setlocale_null_r or setlocale_null as well, and the other threads must not make other setlocale invocations (since changing the global locale has side effects on all threads). */ extern int setlocale_null_r (int category, char *buf, size_t bufsize) _GL_ARG_NONNULL ((2)); /* setlocale_null (CATEGORY) is like setlocale (CATEGORY, NULL), except that it is guaranteed to be multithread-safe. The return value is NULL if CATEGORY is invalid. For this call to be multithread-safe, *all* calls to setlocale (CATEGORY, NULL) in all other threads must have been converted to use setlocale_null_r or setlocale_null as well, and the other threads must not make other setlocale invocations (since changing the global locale has side effects on all threads). */ extern const char *setlocale_null (int category); #ifdef __cplusplus } #endif #endif /* _SETLOCALE_NULL_H */ kbuild-3608/src/grep/lib/iswxdigit.c0000664000175000017500000000215414670377424017377 0ustar locutuslocutus/* Test wide character for being a hexadecimal digit. Copyright (C) 2020-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include int iswxdigit (wint_t wc) { return ((wc >= '0' && wc <= '9') #if 'A' == 0x41 && 'a' == 0x61 /* Optimization, assuming ASCII */ || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F') #else || (wc >= 'A' && wc <= 'F') || (wc >= 'a' && wc <= 'f') #endif ); } kbuild-3608/src/grep/lib/localeinfo.c0000664000175000017500000001206114670377424017475 0ustar locutuslocutus/* locale information Copyright 2016-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Paul Eggert. */ #include #include #include #include #include #include #include #include /* The sbclen implementation relies on this. */ verify (MB_LEN_MAX <= SCHAR_MAX); /* Return true if the locale uses UTF-8. */ static bool is_using_utf8 (void) { wchar_t wc; mbstate_t mbs = {0}; return mbrtowc (&wc, "\xc4\x80", 2, &mbs) == 2 && wc == 0x100; } /* Return true if the locale is compatible enough with the C locale so that the locale is single-byte, bytes are in collating-sequence order, and there are no multi-character collating elements. */ static bool using_simple_locale (bool multibyte) { /* The native character set is known to be compatible with the C locale. The following test isn't perfect, but it's good enough in practice, as only ASCII and EBCDIC are in common use and this test correctly accepts ASCII and rejects EBCDIC. */ enum { native_c_charset = ('\b' == 8 && '\t' == 9 && '\n' == 10 && '\v' == 11 && '\f' == 12 && '\r' == 13 && ' ' == 32 && '!' == 33 && '"' == 34 && '#' == 35 && '%' == 37 && '&' == 38 && '\'' == 39 && '(' == 40 && ')' == 41 && '*' == 42 && '+' == 43 && ',' == 44 && '-' == 45 && '.' == 46 && '/' == 47 && '0' == 48 && '9' == 57 && ':' == 58 && ';' == 59 && '<' == 60 && '=' == 61 && '>' == 62 && '?' == 63 && 'A' == 65 && 'Z' == 90 && '[' == 91 && '\\' == 92 && ']' == 93 && '^' == 94 && '_' == 95 && 'a' == 97 && 'z' == 122 && '{' == 123 && '|' == 124 && '}' == 125 && '~' == 126) }; if (!native_c_charset || multibyte) return false; /* As a heuristic, use strcoll to compare native character order. If this agrees with byte order the locale should be simple. This heuristic should work for all known practical locales, although it would be invalid for artificially-constructed locales where the native order is the collating-sequence order but there are multi-character collating elements. */ for (int i = 0; i < UCHAR_MAX; i++) if (0 <= strcoll (((char []) {i, 0}), ((char []) {i + 1, 0}))) return false; return true; } /* Initialize *LOCALEINFO from the current locale. */ void init_localeinfo (struct localeinfo *localeinfo) { localeinfo->multibyte = MB_CUR_MAX > 1; localeinfo->simple = using_simple_locale (localeinfo->multibyte); localeinfo->using_utf8 = is_using_utf8 (); for (int i = CHAR_MIN; i <= CHAR_MAX; i++) { char c = i; unsigned char uc = i; mbstate_t s = {0}; wchar_t wc; size_t len = mbrtowc (&wc, &c, 1, &s); localeinfo->sbclen[uc] = len <= 1 ? 1 : - (int) - len; localeinfo->sbctowc[uc] = len <= 1 ? wc : WEOF; } } /* The set of wchar_t values C such that there's a useful locale somewhere where C != towupper (C) && C != towlower (towupper (C)). For example, 0x00B5 (U+00B5 MICRO SIGN) is in this table, because towupper (0x00B5) == 0x039C (U+039C GREEK CAPITAL LETTER MU), and towlower (0x039C) == 0x03BC (U+03BC GREEK SMALL LETTER MU). */ static short const lonesome_lower[] = { 0x00B5, 0x0131, 0x017F, 0x01C5, 0x01C8, 0x01CB, 0x01F2, 0x0345, 0x03C2, 0x03D0, 0x03D1, 0x03D5, 0x03D6, 0x03F0, 0x03F1, /* U+03F2 GREEK LUNATE SIGMA SYMBOL lacks a specific uppercase counterpart in locales predating Unicode 4.0.0 (April 2003). */ 0x03F2, 0x03F5, 0x1E9B, 0x1FBE, }; /* Verify that the worst case fits. This is 1 for towupper, 1 for towlower, and 1 for each entry in LONESOME_LOWER. */ verify (1 + 1 + sizeof lonesome_lower / sizeof *lonesome_lower <= CASE_FOLDED_BUFSIZE); /* Find the characters equal to C after case-folding, other than C itself, and store them into FOLDED. Return the number of characters stored; this is zero if C is WEOF. */ int case_folded_counterparts (wint_t c, wchar_t folded[CASE_FOLDED_BUFSIZE]) { int i; int n = 0; wint_t uc = towupper (c); wint_t lc = towlower (uc); if (uc != c) folded[n++] = uc; if (lc != uc && lc != c && towupper (lc) == uc) folded[n++] = lc; for (i = 0; i < sizeof lonesome_lower / sizeof *lonesome_lower; i++) { wint_t li = lonesome_lower[i]; if (li != lc && li != uc && li != c && towupper (li) == uc) folded[n++] = li; } return n; } kbuild-3608/src/grep/lib/openat-proc.c0000664000175000017500000001003014670377426017605 0ustar locutuslocutus/* Create /proc/self/fd-related names for subfiles of open directories. Copyright (C) 2006, 2009-2021 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 . */ /* Written by Paul Eggert. */ #include #include "openat-priv.h" #include #include #include #include #include #include #include #ifdef __KLIBC__ # include #endif #include "intprops.h" /* Set BUF to the name of the subfile of the directory identified by FD, where the subfile is named FILE. If successful, return BUF if the result fits in BUF, dynamically allocated memory otherwise. Return NULL (setting errno) on error. */ char * openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file) { char *result = buf; int dirlen; /* Make sure the caller gets ENOENT when appropriate. */ if (!*file) { buf[0] = '\0'; return buf; } #ifndef __KLIBC__ # define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/" { enum { PROC_SELF_FD_DIR_SIZE_BOUND = (sizeof PROC_SELF_FD_FORMAT - (sizeof "%d" - 1) + INT_STRLEN_BOUND (int)) }; static int proc_status = 0; if (! proc_status) { /* Set PROC_STATUS to a positive value if /proc/self/fd is reliable, and a negative value otherwise. Solaris 10 /proc/self/fd mishandles "..", and any file name might expand to ".." after symbolic link expansion, so avoid /proc/self/fd if it mishandles "..". Solaris 10 has openat, but this problem is exhibited on code that built on Solaris 8 and running on Solaris 10. */ int proc_self_fd = open ("/proc/self/fd", O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK | O_CLOEXEC); if (proc_self_fd < 0) proc_status = -1; else { /* Detect whether /proc/self/fd/%i/../fd exists, where %i is the number of a file descriptor open on /proc/self/fd. On Linux, that name resolves to /proc/self/fd, which was opened above. However, on Solaris, it may resolve to /proc/self/fd/fd, which cannot exist, since all names in /proc/self/fd are numeric. */ char dotdot_buf[PROC_SELF_FD_DIR_SIZE_BOUND + sizeof "../fd" - 1]; sprintf (dotdot_buf, PROC_SELF_FD_FORMAT "../fd", proc_self_fd); proc_status = access (dotdot_buf, F_OK) ? -1 : 1; close (proc_self_fd); } } if (proc_status < 0) return NULL; else { size_t bufsize = PROC_SELF_FD_DIR_SIZE_BOUND + strlen (file); if (OPENAT_BUFFER_SIZE < bufsize) { result = malloc (bufsize); if (! result) return NULL; } dirlen = sprintf (result, PROC_SELF_FD_FORMAT, fd); } } #else /* OS/2 kLIBC provides a function to retrieve a path from a fd. */ { char dir[_MAX_PATH]; size_t bufsize; if (__libc_Back_ioFHToPath (fd, dir, sizeof dir)) return NULL; dirlen = strlen (dir); bufsize = dirlen + 1 + strlen (file) + 1; /* 1 for '/', 1 for null */ if (OPENAT_BUFFER_SIZE < bufsize) { result = malloc (bufsize); if (! result) return NULL; } strcpy (result, dir); result[dirlen++] = '/'; } #endif strcpy (result + dirlen, file); return result; } kbuild-3608/src/grep/lib/unistd--.h0000664000175000017500000000174414670377426017037 0ustar locutuslocutus/* Like unistd.h, but redefine some names to avoid glitches. Copyright (C) 2005, 2009-2021 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 . */ /* Written by Paul Eggert. */ #include #include "unistd-safer.h" #undef dup #define dup dup_safer #undef pipe #define pipe pipe_safer #if GNULIB_PIPE2_SAFER # undef pipe2 # define pipe2 pipe2_safer #endif kbuild-3608/src/grep/lib/quote.h0000664000175000017500000000350314670377426016527 0ustar locutuslocutus/* quote.h - prototypes for quote.c Copyright (C) 1998-2001, 2003, 2009-2021 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 . */ #ifndef QUOTE_H_ # define QUOTE_H_ 1 # include /* The quoting options used by quote_n and quote. Its type is incomplete, so it's useful only in expressions like '"e_quoting_options'. */ extern struct quoting_options quote_quoting_options; /* Return an unambiguous printable representation of ARG (of size ARGSIZE), allocated in slot N, suitable for diagnostics. If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE. */ char const *quote_n_mem (int n, char const *arg, size_t argsize); /* Return an unambiguous printable representation of ARG (of size ARGSIZE), suitable for diagnostics. If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE. */ char const *quote_mem (char const *arg, size_t argsize); /* Return an unambiguous printable representation of ARG, allocated in slot N, suitable for diagnostics. */ char const *quote_n (int n, char const *arg); /* Return an unambiguous printable representation of ARG, suitable for diagnostics. */ char const *quote (char const *arg); #endif /* !QUOTE_H_ */ kbuild-3608/src/grep/lib/uniwidth.in.h0000664000175000017500000000413314670377426017632 0ustar locutuslocutus/* Display width functions. Copyright (C) 2001-2002, 2005, 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _UNIWIDTH_H #define _UNIWIDTH_H #include "unitypes.h" /* Get size_t. */ #include /* Get locale_charset() declaration. */ #include "localcharset.h" #ifdef __cplusplus extern "C" { #endif /* Display width. */ /* These functions are locale dependent. The encoding argument identifies the encoding (e.g. "ISO-8859-2" for Polish). */ /* Determine number of column positions required for UC. */ extern int uc_width (ucs4_t uc, const char *encoding) _UC_ATTRIBUTE_PURE; /* Determine number of column positions required for first N units (or fewer if S ends before this) in S. */ extern int u8_width (const uint8_t *s, size_t n, const char *encoding) _UC_ATTRIBUTE_PURE; extern int u16_width (const uint16_t *s, size_t n, const char *encoding) _UC_ATTRIBUTE_PURE; extern int u32_width (const uint32_t *s, size_t n, const char *encoding) _UC_ATTRIBUTE_PURE; /* Determine number of column positions required for S. */ extern int u8_strwidth (const uint8_t *s, const char *encoding) _UC_ATTRIBUTE_PURE; extern int u16_strwidth (const uint16_t *s, const char *encoding) _UC_ATTRIBUTE_PURE; extern int u32_strwidth (const uint32_t *s, const char *encoding) _UC_ATTRIBUTE_PURE; #ifdef __cplusplus } #endif #endif /* _UNIWIDTH_H */ kbuild-3608/src/grep/lib/free.c0000664000175000017500000000277214670377423016312 0ustar locutuslocutus/* Make free() preserve errno. Copyright (C) 2003, 2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Paul Eggert */ #include /* Specification. */ #include /* A function definition is only needed if HAVE_FREE_POSIX is not defined. */ #if !HAVE_FREE_POSIX # include void rpl_free (void *p) # undef free { # if defined __GNUC__ && !defined __clang__ /* An invalid GCC optimization would optimize away the assignments in the code below, when link-time optimization (LTO) is enabled. Make the code more complicated, so that GCC does not grok how to optimize it. */ int err[2]; err[0] = errno; err[1] = errno; errno = 0; free (p); errno = err[errno == 0]; # else int err = errno; free (p); errno = err; # endif } #endif kbuild-3608/src/grep/lib/lstat.c0000664000175000017500000000723614670377424016521 0ustar locutuslocutus/* Work around a bug of lstat on some systems Copyright (C) 1997-2006, 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Jim Meyering */ /* If the user's config.h happens to include , let it include only the system's here, so that orig_lstat doesn't recurse to rpl_lstat. */ #define __need_system_sys_stat_h #include #if !HAVE_LSTAT /* On systems that lack symlinks, our replacement already defined lstat as stat, so there is nothing further to do other than avoid an empty file. */ typedef int dummy; #else /* HAVE_LSTAT */ /* Get the original definition of lstat. It might be defined as a macro. */ # include # include # undef __need_system_sys_stat_h static int orig_lstat (const char *filename, struct stat *buf) { return lstat (filename, buf); } /* Specification. */ # ifdef __osf__ /* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include above. */ # include "sys/stat.h" # else # include # endif # include "stat-time.h" # include # include /* lstat works differently on Linux and Solaris systems. POSIX (see "pathname resolution" in the glossary) requires that programs like 'ls' take into consideration the fact that FILE has a trailing slash when FILE is a symbolic link. On Linux and Solaris 10 systems, the lstat function already has the desired semantics (in treating 'lstat ("symlink/", sbuf)' just like 'lstat ("symlink/.", sbuf)', but on Solaris 9 and earlier it does not. If FILE has a trailing slash and specifies a symbolic link, then use stat() to get more info on the referent of FILE. If the referent is a non-directory, then set errno to ENOTDIR and return -1. Otherwise, return stat's result. */ int rpl_lstat (const char *file, struct stat *sbuf) { int result = orig_lstat (file, sbuf); /* This replacement file can blindly check against '/' rather than using the ISSLASH macro, because all platforms with '\\' either lack symlinks (mingw) or have working lstat (cygwin) and thus do not compile this file. 0 len should have already been filtered out above, with a failure return of ENOENT. */ if (result == 0) { if (S_ISDIR (sbuf->st_mode) || file[strlen (file) - 1] != '/') result = stat_time_normalize (result, sbuf); else { /* At this point, a trailing slash is permitted only on symlink-to-dir; but it should have found information on the directory, not the symlink. Call 'stat' to get info about the link's referent. Our replacement stat guarantees valid results, even if the symlink is not pointing to a directory. */ if (!S_ISLNK (sbuf->st_mode)) { errno = ENOTDIR; return -1; } result = stat (file, sbuf); } } return result; } #endif /* HAVE_LSTAT */ kbuild-3608/src/grep/lib/nl_langinfo.c0000664000175000017500000003654414670377425017665 0ustar locutuslocutus/* nl_langinfo() replacement: query locale dependent information. Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include #include #if defined _WIN32 && ! defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # include #endif #if REPLACE_NL_LANGINFO && !NL_LANGINFO_MTSAFE # if defined _WIN32 && !defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # elif HAVE_PTHREAD_API # include # if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS # include # pragma weak thrd_exit # define c11_threads_in_use() (thrd_exit != NULL) # else # define c11_threads_in_use() 0 # endif # elif HAVE_THREADS_H # include # endif #endif /* nl_langinfo() must be multithread-safe. To achieve this without using thread-local storage: 1. We use a specific static buffer for each possible argument. So that different threads can call nl_langinfo with different arguments, without interfering. 2. We use a simple strcpy or memcpy to fill this static buffer. Filling it through, for example, strcpy + strcat would not be guaranteed to leave the buffer's contents intact if another thread is currently accessing it. If necessary, the contents is first assembled in a stack-allocated buffer. */ #if !REPLACE_NL_LANGINFO || GNULIB_defined_CODESET /* Return the codeset of the current locale, if this is easily deducible. Otherwise, return "". */ static char * ctype_codeset (void) { static char result[2 + 10 + 1]; char buf[2 + 10 + 1]; char locale[SETLOCALE_NULL_MAX]; char *codeset; size_t codesetlen; if (setlocale_null_r (LC_CTYPE, locale, sizeof (locale))) locale[0] = '\0'; codeset = buf; codeset[0] = '\0'; if (locale[0]) { /* If the locale name contains an encoding after the dot, return it. */ char *dot = strchr (locale, '.'); if (dot) { /* Look for the possible @... trailer and remove it, if any. */ char *codeset_start = dot + 1; char const *modifier = strchr (codeset_start, '@'); if (! modifier) codeset = codeset_start; else { codesetlen = modifier - codeset_start; if (codesetlen < sizeof buf) { codeset = memcpy (buf, codeset_start, codesetlen); codeset[codesetlen] = '\0'; } } } } # if defined _WIN32 && ! defined __CYGWIN__ /* If setlocale is successful, it returns the number of the codepage, as a string. Otherwise, fall back on Windows API GetACP, which returns the locale's codepage as a number (although this doesn't change according to what the 'setlocale' call specified). Either way, prepend "CP" to make it a valid codeset name. */ codesetlen = strlen (codeset); if (0 < codesetlen && codesetlen < sizeof buf - 2) memmove (buf + 2, codeset, codesetlen + 1); else sprintf (buf + 2, "%u", GetACP ()); /* For a locale name such as "French_France.65001", in Windows 10, setlocale now returns "French_France.utf8" instead. */ if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0) return (char *) "UTF-8"; else { memcpy (buf, "CP", 2); strcpy (result, buf); return result; } # else strcpy (result, codeset); return result; #endif } #endif #if REPLACE_NL_LANGINFO /* Override nl_langinfo with support for added nl_item values. */ # undef nl_langinfo /* Without locking, on Solaris 11.3, test-nl_langinfo-mt fails, with message "thread5 disturbed by threadN!", even when threadN invokes only nl_langinfo (CODESET); nl_langinfo (CRNCYSTR); Similarly on Solaris 10. */ # if !NL_LANGINFO_MTSAFE /* Solaris */ # define ITEMS (MAXSTRMSG + 1) # define MAX_RESULT_LEN 80 static char * nl_langinfo_unlocked (nl_item item) { static char result[ITEMS][MAX_RESULT_LEN]; /* The result of nl_langinfo is in storage that can be overwritten by other calls to nl_langinfo. */ char *tmp = nl_langinfo (item); if (item >= 0 && item < ITEMS && tmp != NULL) { size_t tmp_len = strlen (tmp); if (tmp_len < MAX_RESULT_LEN) strcpy (result[item], tmp); else { /* Produce a truncated result. Oh well... */ result[item][MAX_RESULT_LEN - 1] = '\0'; memcpy (result[item], tmp, MAX_RESULT_LEN - 1); } return result[item]; } else return tmp; } /* Use a lock, so that no two threads can invoke nl_langinfo_unlocked at the same time. */ /* Prohibit renaming this symbol. */ # undef gl_get_nl_langinfo_lock # if defined _WIN32 && !defined __CYGWIN__ extern __declspec(dllimport) CRITICAL_SECTION *gl_get_nl_langinfo_lock (void); static char * nl_langinfo_with_lock (nl_item item) { CRITICAL_SECTION *lock = gl_get_nl_langinfo_lock (); char *ret; EnterCriticalSection (lock); ret = nl_langinfo_unlocked (item); LeaveCriticalSection (lock); return ret; } # elif HAVE_PTHREAD_API extern # if defined _WIN32 || defined __CYGWIN__ __declspec(dllimport) # endif pthread_mutex_t *gl_get_nl_langinfo_lock (void); # if HAVE_WEAK_SYMBOLS /* musl libc, FreeBSD, NetBSD, OpenBSD, Haiku */ /* Avoid the need to link with '-lpthread'. */ # pragma weak pthread_mutex_lock # pragma weak pthread_mutex_unlock /* Determine whether libpthread is in use. */ # pragma weak pthread_mutexattr_gettype /* See the comments in lock.h. */ # define pthread_in_use() \ (pthread_mutexattr_gettype != NULL || c11_threads_in_use ()) # else # define pthread_in_use() 1 # endif static char * nl_langinfo_with_lock (nl_item item) { if (pthread_in_use()) { pthread_mutex_t *lock = gl_get_nl_langinfo_lock (); char *ret; if (pthread_mutex_lock (lock)) abort (); ret = nl_langinfo_unlocked (item); if (pthread_mutex_unlock (lock)) abort (); return ret; } else return nl_langinfo_unlocked (item); } # elif HAVE_THREADS_H extern mtx_t *gl_get_nl_langinfo_lock (void); static char * nl_langinfo_with_lock (nl_item item) { mtx_t *lock = gl_get_nl_langinfo_lock (); char *ret; if (mtx_lock (lock) != thrd_success) abort (); ret = nl_langinfo_unlocked (item); if (mtx_unlock (lock) != thrd_success) abort (); return ret; } # endif # else /* On other platforms, no lock is needed. */ # define nl_langinfo_with_lock nl_langinfo # endif char * rpl_nl_langinfo (nl_item item) { switch (item) { # if GNULIB_defined_CODESET case CODESET: return ctype_codeset (); # endif # if GNULIB_defined_T_FMT_AMPM case T_FMT_AMPM: return (char *) "%I:%M:%S %p"; # endif # if GNULIB_defined_ALTMON case ALTMON_1: case ALTMON_2: case ALTMON_3: case ALTMON_4: case ALTMON_5: case ALTMON_6: case ALTMON_7: case ALTMON_8: case ALTMON_9: case ALTMON_10: case ALTMON_11: case ALTMON_12: /* We don't ship the appropriate localizations with gnulib. Therefore, treat ALTMON_i like MON_i. */ item = item - ALTMON_1 + MON_1; break; # endif # if GNULIB_defined_ERA case ERA: /* The format is not standardized. In glibc it is a sequence of strings of the form "direction:offset:start_date:end_date:era_name:era_format" with an empty string at the end. */ return (char *) ""; case ERA_D_FMT: /* The %Ex conversion in strftime behaves like %x if the locale does not have an alternative time format. */ item = D_FMT; break; case ERA_D_T_FMT: /* The %Ec conversion in strftime behaves like %c if the locale does not have an alternative time format. */ item = D_T_FMT; break; case ERA_T_FMT: /* The %EX conversion in strftime behaves like %X if the locale does not have an alternative time format. */ item = T_FMT; break; case ALT_DIGITS: /* The format is not standardized. In glibc it is a sequence of 10 strings, appended in memory. */ return (char *) "\0\0\0\0\0\0\0\0\0\0"; # endif # if GNULIB_defined_YESEXPR || !FUNC_NL_LANGINFO_YESEXPR_WORKS case YESEXPR: return (char *) "^[yY]"; case NOEXPR: return (char *) "^[nN]"; # endif default: break; } return nl_langinfo_with_lock (item); } #else /* Provide nl_langinfo from scratch, either for native MS-Windows, or for old Unix platforms without locales, such as Linux libc5 or BeOS. */ # include char * nl_langinfo (nl_item item) { char buf[100]; struct tm tmm = { 0 }; switch (item) { /* nl_langinfo items of the LC_CTYPE category */ case CODESET: { char *codeset = ctype_codeset (); if (*codeset) return codeset; } # ifdef __BEOS__ return (char *) "UTF-8"; # else return (char *) "ISO-8859-1"; # endif /* nl_langinfo items of the LC_NUMERIC category */ case RADIXCHAR: return localeconv () ->decimal_point; case THOUSEP: return localeconv () ->thousands_sep; # ifdef GROUPING case GROUPING: return localeconv () ->grouping; # endif /* nl_langinfo items of the LC_TIME category. TODO: Really use the locale. */ case D_T_FMT: case ERA_D_T_FMT: return (char *) "%a %b %e %H:%M:%S %Y"; case D_FMT: case ERA_D_FMT: return (char *) "%m/%d/%y"; case T_FMT: case ERA_T_FMT: return (char *) "%H:%M:%S"; case T_FMT_AMPM: return (char *) "%I:%M:%S %p"; case AM_STR: { static char result[80]; if (!strftime (buf, sizeof result, "%p", &tmm)) return (char *) "AM"; strcpy (result, buf); return result; } case PM_STR: { static char result[80]; tmm.tm_hour = 12; if (!strftime (buf, sizeof result, "%p", &tmm)) return (char *) "PM"; strcpy (result, buf); return result; } case DAY_1: case DAY_2: case DAY_3: case DAY_4: case DAY_5: case DAY_6: case DAY_7: { static char result[7][50]; static char const days[][sizeof "Wednesday"] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; tmm.tm_wday = item - DAY_1; if (!strftime (buf, sizeof result[0], "%A", &tmm)) return (char *) days[item - DAY_1]; strcpy (result[item - DAY_1], buf); return result[item - DAY_1]; } case ABDAY_1: case ABDAY_2: case ABDAY_3: case ABDAY_4: case ABDAY_5: case ABDAY_6: case ABDAY_7: { static char result[7][30]; static char const abdays[][sizeof "Sun"] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; tmm.tm_wday = item - ABDAY_1; if (!strftime (buf, sizeof result[0], "%a", &tmm)) return (char *) abdays[item - ABDAY_1]; strcpy (result[item - ABDAY_1], buf); return result[item - ABDAY_1]; } { static char const months[][sizeof "September"] = { "January", "February", "March", "April", "May", "June", "July", "September", "October", "November", "December" }; case MON_1: case MON_2: case MON_3: case MON_4: case MON_5: case MON_6: case MON_7: case MON_8: case MON_9: case MON_10: case MON_11: case MON_12: { static char result[12][50]; tmm.tm_mon = item - MON_1; if (!strftime (buf, sizeof result[0], "%B", &tmm)) return (char *) months[item - MON_1]; strcpy (result[item - MON_1], buf); return result[item - MON_1]; } case ALTMON_1: case ALTMON_2: case ALTMON_3: case ALTMON_4: case ALTMON_5: case ALTMON_6: case ALTMON_7: case ALTMON_8: case ALTMON_9: case ALTMON_10: case ALTMON_11: case ALTMON_12: { static char result[12][50]; tmm.tm_mon = item - ALTMON_1; /* The platforms without nl_langinfo() don't support strftime with %OB. We don't even need to try. */ #if 0 if (!strftime (buf, sizeof result[0], "%OB", &tmm)) #endif if (!strftime (buf, sizeof result[0], "%B", &tmm)) return (char *) months[item - ALTMON_1]; strcpy (result[item - ALTMON_1], buf); return result[item - ALTMON_1]; } } case ABMON_1: case ABMON_2: case ABMON_3: case ABMON_4: case ABMON_5: case ABMON_6: case ABMON_7: case ABMON_8: case ABMON_9: case ABMON_10: case ABMON_11: case ABMON_12: { static char result[12][30]; static char const abmonths[][sizeof "Jan"] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Sep", "Oct", "Nov", "Dec" }; tmm.tm_mon = item - ABMON_1; if (!strftime (buf, sizeof result[0], "%b", &tmm)) return (char *) abmonths[item - ABMON_1]; strcpy (result[item - ABMON_1], buf); return result[item - ABMON_1]; } case ERA: return (char *) ""; case ALT_DIGITS: return (char *) "\0\0\0\0\0\0\0\0\0\0"; /* nl_langinfo items of the LC_MONETARY category. */ case CRNCYSTR: return localeconv () ->currency_symbol; # ifdef INT_CURR_SYMBOL case INT_CURR_SYMBOL: return localeconv () ->int_curr_symbol; case MON_DECIMAL_POINT: return localeconv () ->mon_decimal_point; case MON_THOUSANDS_SEP: return localeconv () ->mon_thousands_sep; case MON_GROUPING: return localeconv () ->mon_grouping; case POSITIVE_SIGN: return localeconv () ->positive_sign; case NEGATIVE_SIGN: return localeconv () ->negative_sign; case FRAC_DIGITS: return & localeconv () ->frac_digits; case INT_FRAC_DIGITS: return & localeconv () ->int_frac_digits; case P_CS_PRECEDES: return & localeconv () ->p_cs_precedes; case N_CS_PRECEDES: return & localeconv () ->n_cs_precedes; case P_SEP_BY_SPACE: return & localeconv () ->p_sep_by_space; case N_SEP_BY_SPACE: return & localeconv () ->n_sep_by_space; case P_SIGN_POSN: return & localeconv () ->p_sign_posn; case N_SIGN_POSN: return & localeconv () ->n_sign_posn; # endif /* nl_langinfo items of the LC_MESSAGES category TODO: Really use the locale. */ case YESEXPR: return (char *) "^[yY]"; case NOEXPR: return (char *) "^[nN]"; default: return (char *) ""; } } #endif kbuild-3608/src/grep/lib/regcomp.c0000664000175000017500000033761014670377422017026 0ustar locutuslocutus/* Extended regular expression matching and search library. Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifdef _LIBC # include #endif static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, size_t length, reg_syntax_t syntax); static void re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, char *fastmap); static reg_errcode_t init_dfa (re_dfa_t *dfa, size_t pat_len); #ifdef RE_ENABLE_I18N static void free_charset (re_charset_t *cset); #endif /* RE_ENABLE_I18N */ static void free_workarea_compile (regex_t *preg); static reg_errcode_t create_initial_state (re_dfa_t *dfa); #ifdef RE_ENABLE_I18N static void optimize_utf8 (re_dfa_t *dfa); #endif static reg_errcode_t analyze (regex_t *preg); static reg_errcode_t preorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)), void *extra); static reg_errcode_t postorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)), void *extra); static reg_errcode_t optimize_subexps (void *extra, bin_tree_t *node); static reg_errcode_t lower_subexps (void *extra, bin_tree_t *node); static bin_tree_t *lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node); static reg_errcode_t calc_first (void *extra, bin_tree_t *node); static reg_errcode_t calc_next (void *extra, bin_tree_t *node); static reg_errcode_t link_nfa_nodes (void *extra, bin_tree_t *node); static Idx duplicate_node (re_dfa_t *dfa, Idx org_idx, unsigned int constraint); static Idx search_duplicated_node (const re_dfa_t *dfa, Idx org_node, unsigned int constraint); static reg_errcode_t calc_eclosure (re_dfa_t *dfa); static reg_errcode_t calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root); static reg_errcode_t calc_inveclosure (re_dfa_t *dfa); static Idx fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax); static int peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax); static bin_tree_t *parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax, reg_errcode_t *err); static bin_tree_t *parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err); static bin_tree_t *parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err); static bin_tree_t *parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err); static bin_tree_t *parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err); static bin_tree_t *parse_dup_op (bin_tree_t *dup_elem, re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, reg_syntax_t syntax, reg_errcode_t *err); static bin_tree_t *parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, reg_syntax_t syntax, reg_errcode_t *err); static reg_errcode_t parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp, re_token_t *token, int token_len, re_dfa_t *dfa, reg_syntax_t syntax, bool accept_hyphen); static reg_errcode_t parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp, re_token_t *token); #ifdef RE_ENABLE_I18N static reg_errcode_t build_equiv_class (bitset_t sbcset, re_charset_t *mbcset, Idx *equiv_class_alloc, const unsigned char *name); static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, re_charset_t *mbcset, Idx *char_class_alloc, const char *class_name, reg_syntax_t syntax); #else /* not RE_ENABLE_I18N */ static reg_errcode_t build_equiv_class (bitset_t sbcset, const unsigned char *name); static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, const char *class_name, reg_syntax_t syntax); #endif /* not RE_ENABLE_I18N */ static bin_tree_t *build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, const char *class_name, const char *extra, bool non_match, reg_errcode_t *err); static bin_tree_t *create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, re_token_type_t type); static bin_tree_t *create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, const re_token_t *token); static bin_tree_t *duplicate_tree (const bin_tree_t *src, re_dfa_t *dfa); static void free_token (re_token_t *node); static reg_errcode_t free_tree (void *extra, bin_tree_t *node); static reg_errcode_t mark_opt_subexp (void *extra, bin_tree_t *node); /* This table gives an error message for each of the error codes listed in regex.h. Obviously the order here has to be same as there. POSIX doesn't require that we do anything for REG_NOERROR, but why not be nice? */ static const char __re_error_msgid[] = { #define REG_NOERROR_IDX 0 gettext_noop ("Success") /* REG_NOERROR */ "\0" #define REG_NOMATCH_IDX (REG_NOERROR_IDX + sizeof "Success") gettext_noop ("No match") /* REG_NOMATCH */ "\0" #define REG_BADPAT_IDX (REG_NOMATCH_IDX + sizeof "No match") gettext_noop ("Invalid regular expression") /* REG_BADPAT */ "\0" #define REG_ECOLLATE_IDX (REG_BADPAT_IDX + sizeof "Invalid regular expression") gettext_noop ("Invalid collation character") /* REG_ECOLLATE */ "\0" #define REG_ECTYPE_IDX (REG_ECOLLATE_IDX + sizeof "Invalid collation character") gettext_noop ("Invalid character class name") /* REG_ECTYPE */ "\0" #define REG_EESCAPE_IDX (REG_ECTYPE_IDX + sizeof "Invalid character class name") gettext_noop ("Trailing backslash") /* REG_EESCAPE */ "\0" #define REG_ESUBREG_IDX (REG_EESCAPE_IDX + sizeof "Trailing backslash") gettext_noop ("Invalid back reference") /* REG_ESUBREG */ "\0" #define REG_EBRACK_IDX (REG_ESUBREG_IDX + sizeof "Invalid back reference") gettext_noop ("Unmatched [, [^, [:, [., or [=") /* REG_EBRACK */ "\0" #define REG_EPAREN_IDX (REG_EBRACK_IDX + sizeof "Unmatched [, [^, [:, [., or [=") gettext_noop ("Unmatched ( or \\(") /* REG_EPAREN */ "\0" #define REG_EBRACE_IDX (REG_EPAREN_IDX + sizeof "Unmatched ( or \\(") gettext_noop ("Unmatched \\{") /* REG_EBRACE */ "\0" #define REG_BADBR_IDX (REG_EBRACE_IDX + sizeof "Unmatched \\{") gettext_noop ("Invalid content of \\{\\}") /* REG_BADBR */ "\0" #define REG_ERANGE_IDX (REG_BADBR_IDX + sizeof "Invalid content of \\{\\}") gettext_noop ("Invalid range end") /* REG_ERANGE */ "\0" #define REG_ESPACE_IDX (REG_ERANGE_IDX + sizeof "Invalid range end") gettext_noop ("Memory exhausted") /* REG_ESPACE */ "\0" #define REG_BADRPT_IDX (REG_ESPACE_IDX + sizeof "Memory exhausted") gettext_noop ("Invalid preceding regular expression") /* REG_BADRPT */ "\0" #define REG_EEND_IDX (REG_BADRPT_IDX + sizeof "Invalid preceding regular expression") gettext_noop ("Premature end of regular expression") /* REG_EEND */ "\0" #define REG_ESIZE_IDX (REG_EEND_IDX + sizeof "Premature end of regular expression") gettext_noop ("Regular expression too big") /* REG_ESIZE */ "\0" #define REG_ERPAREN_IDX (REG_ESIZE_IDX + sizeof "Regular expression too big") gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */ }; static const size_t __re_error_msgid_idx[] = { REG_NOERROR_IDX, REG_NOMATCH_IDX, REG_BADPAT_IDX, REG_ECOLLATE_IDX, REG_ECTYPE_IDX, REG_EESCAPE_IDX, REG_ESUBREG_IDX, REG_EBRACK_IDX, REG_EPAREN_IDX, REG_EBRACE_IDX, REG_BADBR_IDX, REG_ERANGE_IDX, REG_ESPACE_IDX, REG_BADRPT_IDX, REG_EEND_IDX, REG_ESIZE_IDX, REG_ERPAREN_IDX }; /* Entry points for GNU code. */ /* re_compile_pattern is the GNU regular expression compiler: it compiles PATTERN (of length LENGTH) and puts the result in BUFP. Returns 0 if the pattern was valid, otherwise an error string. Assumes the 'allocated' (and perhaps 'buffer') and 'translate' fields are set in BUFP on entry. */ const char * re_compile_pattern (const char *pattern, size_t length, struct re_pattern_buffer *bufp) { reg_errcode_t ret; /* And GNU code determines whether or not to get register information by passing null for the REGS argument to re_match, etc., not by setting no_sub, unless RE_NO_SUB is set. */ bufp->no_sub = !!(re_syntax_options & RE_NO_SUB); /* Match anchors at newline. */ bufp->newline_anchor = 1; ret = re_compile_internal (bufp, pattern, length, re_syntax_options); if (!ret) return NULL; return gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]); } weak_alias (__re_compile_pattern, re_compile_pattern) /* Set by 're_set_syntax' to the current regexp syntax to recognize. Can also be assigned to arbitrarily: each pattern buffer stores its own syntax, so it can be changed between regex compilations. */ /* This has no initializer because initialized variables in Emacs become read-only after dumping. */ reg_syntax_t re_syntax_options; /* Specify the precise syntax of regexps for compilation. This provides for compatibility for various utilities which historically have different, incompatible syntaxes. The argument SYNTAX is a bit mask comprised of the various bits defined in regex.h. We return the old syntax. */ reg_syntax_t re_set_syntax (reg_syntax_t syntax) { reg_syntax_t ret = re_syntax_options; re_syntax_options = syntax; return ret; } weak_alias (__re_set_syntax, re_set_syntax) int re_compile_fastmap (struct re_pattern_buffer *bufp) { re_dfa_t *dfa = bufp->buffer; char *fastmap = bufp->fastmap; memset (fastmap, '\0', sizeof (char) * SBC_MAX); re_compile_fastmap_iter (bufp, dfa->init_state, fastmap); if (dfa->init_state != dfa->init_state_word) re_compile_fastmap_iter (bufp, dfa->init_state_word, fastmap); if (dfa->init_state != dfa->init_state_nl) re_compile_fastmap_iter (bufp, dfa->init_state_nl, fastmap); if (dfa->init_state != dfa->init_state_begbuf) re_compile_fastmap_iter (bufp, dfa->init_state_begbuf, fastmap); bufp->fastmap_accurate = 1; return 0; } weak_alias (__re_compile_fastmap, re_compile_fastmap) static inline void __attribute__ ((always_inline)) re_set_fastmap (char *fastmap, bool icase, int ch) { fastmap[ch] = 1; if (icase) fastmap[tolower (ch)] = 1; } /* Helper function for re_compile_fastmap. Compile fastmap for the initial_state INIT_STATE. */ static void re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, char *fastmap) { re_dfa_t *dfa = bufp->buffer; Idx node_cnt; bool icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE)); for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt) { Idx node = init_state->nodes.elems[node_cnt]; re_token_type_t type = dfa->nodes[node].type; if (type == CHARACTER) { re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c); #ifdef RE_ENABLE_I18N if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1) { unsigned char buf[MB_LEN_MAX]; unsigned char *p; wchar_t wc; mbstate_t state; p = buf; *p++ = dfa->nodes[node].opr.c; while (++node < dfa->nodes_len && dfa->nodes[node].type == CHARACTER && dfa->nodes[node].mb_partial) *p++ = dfa->nodes[node].opr.c; memset (&state, '\0', sizeof (state)); if (__mbrtowc (&wc, (const char *) buf, p - buf, &state) == p - buf && (__wcrtomb ((char *) buf, __towlower (wc), &state) != (size_t) -1)) re_set_fastmap (fastmap, false, buf[0]); } #endif } else if (type == SIMPLE_BRACKET) { int i, ch; for (i = 0, ch = 0; i < BITSET_WORDS; ++i) { int j; bitset_word_t w = dfa->nodes[node].opr.sbcset[i]; for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch) if (w & ((bitset_word_t) 1 << j)) re_set_fastmap (fastmap, icase, ch); } } #ifdef RE_ENABLE_I18N else if (type == COMPLEX_BRACKET) { re_charset_t *cset = dfa->nodes[node].opr.mbcset; Idx i; # ifdef _LIBC /* See if we have to try all bytes which start multiple collation elements. e.g. In da_DK, we want to catch 'a' since "aa" is a valid collation element, and don't catch 'b' since 'b' is the only collation element which starts from 'b' (and it is caught by SIMPLE_BRACKET). */ if (_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES) != 0 && (cset->ncoll_syms || cset->nranges)) { const int32_t *table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB); for (i = 0; i < SBC_MAX; ++i) if (table[i] < 0) re_set_fastmap (fastmap, icase, i); } # endif /* _LIBC */ /* See if we have to start the match at all multibyte characters, i.e. where we would not find an invalid sequence. This only applies to multibyte character sets; for single byte character sets, the SIMPLE_BRACKET again suffices. */ if (dfa->mb_cur_max > 1 && (cset->nchar_classes || cset->non_match || cset->nranges # ifdef _LIBC || cset->nequiv_classes # endif /* _LIBC */ )) { unsigned char c = 0; do { mbstate_t mbs; memset (&mbs, 0, sizeof (mbs)); if (__mbrtowc (NULL, (char *) &c, 1, &mbs) == (size_t) -2) re_set_fastmap (fastmap, false, (int) c); } while (++c != 0); } else { /* ... Else catch all bytes which can start the mbchars. */ for (i = 0; i < cset->nmbchars; ++i) { char buf[256]; mbstate_t state; memset (&state, '\0', sizeof (state)); if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1) re_set_fastmap (fastmap, icase, *(unsigned char *) buf); if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1) { if (__wcrtomb (buf, __towlower (cset->mbchars[i]), &state) != (size_t) -1) re_set_fastmap (fastmap, false, *(unsigned char *) buf); } } } } #endif /* RE_ENABLE_I18N */ else if (type == OP_PERIOD #ifdef RE_ENABLE_I18N || type == OP_UTF8_PERIOD #endif /* RE_ENABLE_I18N */ || type == END_OF_RE) { memset (fastmap, '\1', sizeof (char) * SBC_MAX); if (type == END_OF_RE) bufp->can_be_null = 1; return; } } } /* Entry point for POSIX code. */ /* regcomp takes a regular expression as a string and compiles it. PREG is a regex_t *. We do not expect any fields to be initialized, since POSIX says we shouldn't. Thus, we set 'buffer' to the compiled pattern; 'used' to the length of the compiled pattern; 'syntax' to RE_SYNTAX_POSIX_EXTENDED if the REG_EXTENDED bit in CFLAGS is set; otherwise, to RE_SYNTAX_POSIX_BASIC; 'newline_anchor' to REG_NEWLINE being set in CFLAGS; 'fastmap' to an allocated space for the fastmap; 'fastmap_accurate' to zero; 're_nsub' to the number of subexpressions in PATTERN. PATTERN is the address of the pattern string. CFLAGS is a series of bits which affect compilation. If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we use POSIX basic syntax. If REG_NEWLINE is set, then . and [^...] don't match newline. Also, regexec will try a match beginning after every newline. If REG_ICASE is set, then we considers upper- and lowercase versions of letters to be equivalent when matching. If REG_NOSUB is set, then when PREG is passed to regexec, that routine will report only success or failure, and nothing about the registers. It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for the return codes and their meanings.) */ int regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags) { reg_errcode_t ret; reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC); preg->buffer = NULL; preg->allocated = 0; preg->used = 0; /* Try to allocate space for the fastmap. */ preg->fastmap = re_malloc (char, SBC_MAX); if (__glibc_unlikely (preg->fastmap == NULL)) return REG_ESPACE; syntax |= (cflags & REG_ICASE) ? RE_ICASE : 0; /* If REG_NEWLINE is set, newlines are treated differently. */ if (cflags & REG_NEWLINE) { /* REG_NEWLINE implies neither . nor [^...] match newline. */ syntax &= ~RE_DOT_NEWLINE; syntax |= RE_HAT_LISTS_NOT_NEWLINE; /* It also changes the matching behavior. */ preg->newline_anchor = 1; } else preg->newline_anchor = 0; preg->no_sub = !!(cflags & REG_NOSUB); preg->translate = NULL; ret = re_compile_internal (preg, pattern, strlen (pattern), syntax); /* POSIX doesn't distinguish between an unmatched open-group and an unmatched close-group: both are REG_EPAREN. */ if (ret == REG_ERPAREN) ret = REG_EPAREN; /* We have already checked preg->fastmap != NULL. */ if (__glibc_likely (ret == REG_NOERROR)) /* Compute the fastmap now, since regexec cannot modify the pattern buffer. This function never fails in this implementation. */ (void) re_compile_fastmap (preg); else { /* Some error occurred while compiling the expression. */ re_free (preg->fastmap); preg->fastmap = NULL; } return (int) ret; } libc_hidden_def (__regcomp) weak_alias (__regcomp, regcomp) /* Returns a message corresponding to an error code, ERRCODE, returned from either regcomp or regexec. We don't use PREG here. */ size_t regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf, size_t errbuf_size) { const char *msg; size_t msg_size; int nerrcodes = sizeof __re_error_msgid_idx / sizeof __re_error_msgid_idx[0]; if (__glibc_unlikely (errcode < 0 || errcode >= nerrcodes)) /* Only error codes returned by the rest of the code should be passed to this routine. If we are given anything else, or if other regex code generates an invalid error code, then the program has a bug. Dump core so we can fix it. */ abort (); msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); msg_size = strlen (msg) + 1; /* Includes the null. */ if (__glibc_likely (errbuf_size != 0)) { size_t cpy_size = msg_size; if (__glibc_unlikely (msg_size > errbuf_size)) { cpy_size = errbuf_size - 1; errbuf[cpy_size] = '\0'; } memcpy (errbuf, msg, cpy_size); } return msg_size; } weak_alias (__regerror, regerror) #ifdef RE_ENABLE_I18N /* This static array is used for the map to single-byte characters when UTF-8 is used. Otherwise we would allocate memory just to initialize it the same all the time. UTF-8 is the preferred encoding so this is a worthwhile optimization. */ static const bitset_t utf8_sb_map = { /* Set the first 128 bits. */ # if (defined __GNUC__ || __clang_major__ >= 4) && !defined __STRICT_ANSI__ [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX # else # if 4 * BITSET_WORD_BITS < ASCII_CHARS # error "bitset_word_t is narrower than 32 bits" # elif 3 * BITSET_WORD_BITS < ASCII_CHARS BITSET_WORD_MAX, BITSET_WORD_MAX, BITSET_WORD_MAX, # elif 2 * BITSET_WORD_BITS < ASCII_CHARS BITSET_WORD_MAX, BITSET_WORD_MAX, # elif 1 * BITSET_WORD_BITS < ASCII_CHARS BITSET_WORD_MAX, # endif (BITSET_WORD_MAX >> (SBC_MAX % BITSET_WORD_BITS == 0 ? 0 : BITSET_WORD_BITS - SBC_MAX % BITSET_WORD_BITS)) # endif }; #endif static void free_dfa_content (re_dfa_t *dfa) { Idx i, j; if (dfa->nodes) for (i = 0; i < dfa->nodes_len; ++i) free_token (dfa->nodes + i); re_free (dfa->nexts); for (i = 0; i < dfa->nodes_len; ++i) { if (dfa->eclosures != NULL) re_node_set_free (dfa->eclosures + i); if (dfa->inveclosures != NULL) re_node_set_free (dfa->inveclosures + i); if (dfa->edests != NULL) re_node_set_free (dfa->edests + i); } re_free (dfa->edests); re_free (dfa->eclosures); re_free (dfa->inveclosures); re_free (dfa->nodes); if (dfa->state_table) for (i = 0; i <= dfa->state_hash_mask; ++i) { struct re_state_table_entry *entry = dfa->state_table + i; for (j = 0; j < entry->num; ++j) { re_dfastate_t *state = entry->array[j]; free_state (state); } re_free (entry->array); } re_free (dfa->state_table); #ifdef RE_ENABLE_I18N if (dfa->sb_char != utf8_sb_map) re_free (dfa->sb_char); #endif re_free (dfa->subexp_map); #ifdef DEBUG re_free (dfa->re_str); #endif re_free (dfa); } /* Free dynamically allocated space used by PREG. */ void regfree (regex_t *preg) { re_dfa_t *dfa = preg->buffer; if (__glibc_likely (dfa != NULL)) { lock_fini (dfa->lock); free_dfa_content (dfa); } preg->buffer = NULL; preg->allocated = 0; re_free (preg->fastmap); preg->fastmap = NULL; re_free (preg->translate); preg->translate = NULL; } libc_hidden_def (__regfree) weak_alias (__regfree, regfree) /* Entry points compatible with 4.2 BSD regex library. We don't define them unless specifically requested. */ #if defined _REGEX_RE_COMP || defined _LIBC /* BSD has one and only one pattern buffer. */ static struct re_pattern_buffer re_comp_buf; char * # ifdef _LIBC /* Make these definitions weak in libc, so POSIX programs can redefine these names if they don't use our functions, and still use regcomp/regexec above without link errors. */ weak_function # endif re_comp (const char *s) { reg_errcode_t ret; char *fastmap; if (!s) { if (!re_comp_buf.buffer) return gettext ("No previous regular expression"); return 0; } if (re_comp_buf.buffer) { fastmap = re_comp_buf.fastmap; re_comp_buf.fastmap = NULL; __regfree (&re_comp_buf); memset (&re_comp_buf, '\0', sizeof (re_comp_buf)); re_comp_buf.fastmap = fastmap; } if (re_comp_buf.fastmap == NULL) { re_comp_buf.fastmap = re_malloc (char, SBC_MAX); if (re_comp_buf.fastmap == NULL) return (char *) gettext (__re_error_msgid + __re_error_msgid_idx[(int) REG_ESPACE]); } /* Since 're_exec' always passes NULL for the 'regs' argument, we don't need to initialize the pattern buffer fields which affect it. */ /* Match anchors at newlines. */ re_comp_buf.newline_anchor = 1; ret = re_compile_internal (&re_comp_buf, s, strlen (s), re_syntax_options); if (!ret) return NULL; /* Yes, we're discarding 'const' here if !HAVE_LIBINTL. */ return (char *) gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]); } #ifdef _LIBC libc_freeres_fn (free_mem) { __regfree (&re_comp_buf); } #endif #endif /* _REGEX_RE_COMP */ /* Internal entry point. Compile the regular expression PATTERN, whose length is LENGTH. SYNTAX indicate regular expression's syntax. */ static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, size_t length, reg_syntax_t syntax) { reg_errcode_t err = REG_NOERROR; re_dfa_t *dfa; re_string_t regexp; /* Initialize the pattern buffer. */ preg->fastmap_accurate = 0; preg->syntax = syntax; preg->not_bol = preg->not_eol = 0; preg->used = 0; preg->re_nsub = 0; preg->can_be_null = 0; preg->regs_allocated = REGS_UNALLOCATED; /* Initialize the dfa. */ dfa = preg->buffer; if (__glibc_unlikely (preg->allocated < sizeof (re_dfa_t))) { /* If zero allocated, but buffer is non-null, try to realloc enough space. This loses if buffer's address is bogus, but that is the user's responsibility. If ->buffer is NULL this is a simple allocation. */ dfa = re_realloc (preg->buffer, re_dfa_t, 1); if (dfa == NULL) return REG_ESPACE; preg->allocated = sizeof (re_dfa_t); preg->buffer = dfa; } preg->used = sizeof (re_dfa_t); err = init_dfa (dfa, length); if (__glibc_unlikely (err == REG_NOERROR && lock_init (dfa->lock) != 0)) err = REG_ESPACE; if (__glibc_unlikely (err != REG_NOERROR)) { free_dfa_content (dfa); preg->buffer = NULL; preg->allocated = 0; return err; } #ifdef DEBUG /* Note: length+1 will not overflow since it is checked in init_dfa. */ dfa->re_str = re_malloc (char, length + 1); strncpy (dfa->re_str, pattern, length + 1); #endif err = re_string_construct (®exp, pattern, length, preg->translate, (syntax & RE_ICASE) != 0, dfa); if (__glibc_unlikely (err != REG_NOERROR)) { re_compile_internal_free_return: free_workarea_compile (preg); re_string_destruct (®exp); lock_fini (dfa->lock); free_dfa_content (dfa); preg->buffer = NULL; preg->allocated = 0; return err; } /* Parse the regular expression, and build a structure tree. */ preg->re_nsub = 0; dfa->str_tree = parse (®exp, preg, syntax, &err); if (__glibc_unlikely (dfa->str_tree == NULL)) goto re_compile_internal_free_return; /* Analyze the tree and create the nfa. */ err = analyze (preg); if (__glibc_unlikely (err != REG_NOERROR)) goto re_compile_internal_free_return; #ifdef RE_ENABLE_I18N /* If possible, do searching in single byte encoding to speed things up. */ if (dfa->is_utf8 && !(syntax & RE_ICASE) && preg->translate == NULL) optimize_utf8 (dfa); #endif /* Then create the initial state of the dfa. */ err = create_initial_state (dfa); /* Release work areas. */ free_workarea_compile (preg); re_string_destruct (®exp); if (__glibc_unlikely (err != REG_NOERROR)) { lock_fini (dfa->lock); free_dfa_content (dfa); preg->buffer = NULL; preg->allocated = 0; } return err; } /* Initialize DFA. We use the length of the regular expression PAT_LEN as the initial length of some arrays. */ static reg_errcode_t init_dfa (re_dfa_t *dfa, size_t pat_len) { __re_size_t table_size; #ifndef _LIBC const char *codeset_name; #endif #ifdef RE_ENABLE_I18N size_t max_i18n_object_size = MAX (sizeof (wchar_t), sizeof (wctype_t)); #else size_t max_i18n_object_size = 0; #endif size_t max_object_size = MAX (sizeof (struct re_state_table_entry), MAX (sizeof (re_token_t), MAX (sizeof (re_node_set), MAX (sizeof (regmatch_t), max_i18n_object_size)))); memset (dfa, '\0', sizeof (re_dfa_t)); /* Force allocation of str_tree_storage the first time. */ dfa->str_tree_storage_idx = BIN_TREE_STORAGE_SIZE; /* Avoid overflows. The extra "/ 2" is for the table_size doubling calculation below, and for similar doubling calculations elsewhere. And it's <= rather than <, because some of the doubling calculations add 1 afterwards. */ if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / max_object_size) / 2 <= pat_len)) return REG_ESPACE; dfa->nodes_alloc = pat_len + 1; dfa->nodes = re_malloc (re_token_t, dfa->nodes_alloc); /* table_size = 2 ^ ceil(log pat_len) */ for (table_size = 1; ; table_size <<= 1) if (table_size > pat_len) break; dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size); dfa->state_hash_mask = table_size - 1; dfa->mb_cur_max = MB_CUR_MAX; #ifdef _LIBC if (dfa->mb_cur_max == 6 && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0) dfa->is_utf8 = 1; dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII) != 0); #else # ifdef _MSC_VER (void)codeset_name; if (get_crt_codepage() == CP_UTF8) # else codeset_name = nl_langinfo (CODESET); if ((codeset_name[0] == 'U' || codeset_name[0] == 'u') && (codeset_name[1] == 'T' || codeset_name[1] == 't') && (codeset_name[2] == 'F' || codeset_name[2] == 'f') && strcmp (codeset_name + 3 + (codeset_name[3] == '-'), "8") == 0) # endif dfa->is_utf8 = 1; /* We check exhaustively in the loop below if this charset is a superset of ASCII. */ dfa->map_notascii = 0; #endif #ifdef RE_ENABLE_I18N if (dfa->mb_cur_max > 1) { if (dfa->is_utf8) dfa->sb_char = (re_bitset_ptr_t) utf8_sb_map; else { int i, j, ch; dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); if (__glibc_unlikely (dfa->sb_char == NULL)) return REG_ESPACE; /* Set the bits corresponding to single byte chars. */ for (i = 0, ch = 0; i < BITSET_WORDS; ++i) for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch) { wint_t wch = __btowc (ch); if (wch != WEOF) dfa->sb_char[i] |= (bitset_word_t) 1 << j; # ifndef _LIBC if (isascii (ch) && wch != ch) dfa->map_notascii = 1; # endif } } } #endif if (__glibc_unlikely (dfa->nodes == NULL || dfa->state_table == NULL)) return REG_ESPACE; return REG_NOERROR; } /* Initialize WORD_CHAR table, which indicate which character is "word". In this case "word" means that it is the word construction character used by some operators like "\<", "\>", etc. */ static void init_word_char (re_dfa_t *dfa) { int i = 0; int j; int ch = 0; dfa->word_ops_used = 1; if (__glibc_likely (dfa->map_notascii == 0)) { /* Avoid uint32_t and uint64_t as some non-GCC platforms lack them, an issue when this code is used in Gnulib. */ bitset_word_t bits0 = 0x00000000; bitset_word_t bits1 = 0x03ff0000; bitset_word_t bits2 = 0x87fffffe; bitset_word_t bits3 = 0x07fffffe; if (BITSET_WORD_BITS == 64) { /* Pacify gcc -Woverflow on 32-bit platformns. */ dfa->word_char[0] = bits1 << 31 << 1 | bits0; dfa->word_char[1] = bits3 << 31 << 1 | bits2; i = 2; } else if (BITSET_WORD_BITS == 32) { dfa->word_char[0] = bits0; dfa->word_char[1] = bits1; dfa->word_char[2] = bits2; dfa->word_char[3] = bits3; i = 4; } else goto general_case; ch = 128; if (__glibc_likely (dfa->is_utf8)) { memset (&dfa->word_char[i], '\0', (SBC_MAX - ch) / 8); return; } } general_case: for (; i < BITSET_WORDS; ++i) for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch) if (isalnum (ch) || ch == '_') dfa->word_char[i] |= (bitset_word_t) 1 << j; } /* Free the work area which are only used while compiling. */ static void free_workarea_compile (regex_t *preg) { re_dfa_t *dfa = preg->buffer; bin_tree_storage_t *storage, *next; for (storage = dfa->str_tree_storage; storage; storage = next) { next = storage->next; re_free (storage); } dfa->str_tree_storage = NULL; dfa->str_tree_storage_idx = BIN_TREE_STORAGE_SIZE; dfa->str_tree = NULL; re_free (dfa->org_indices); dfa->org_indices = NULL; } /* Create initial states for all contexts. */ static reg_errcode_t create_initial_state (re_dfa_t *dfa) { Idx first, i; reg_errcode_t err; re_node_set init_nodes; /* Initial states have the epsilon closure of the node which is the first node of the regular expression. */ first = dfa->str_tree->first->node_idx; dfa->init_node = first; err = re_node_set_init_copy (&init_nodes, dfa->eclosures + first); if (__glibc_unlikely (err != REG_NOERROR)) return err; /* The back-references which are in initial states can epsilon transit, since in this case all of the subexpressions can be null. Then we add epsilon closures of the nodes which are the next nodes of the back-references. */ if (dfa->nbackref > 0) for (i = 0; i < init_nodes.nelem; ++i) { Idx node_idx = init_nodes.elems[i]; re_token_type_t type = dfa->nodes[node_idx].type; Idx clexp_idx; if (type != OP_BACK_REF) continue; for (clexp_idx = 0; clexp_idx < init_nodes.nelem; ++clexp_idx) { re_token_t *clexp_node; clexp_node = dfa->nodes + init_nodes.elems[clexp_idx]; if (clexp_node->type == OP_CLOSE_SUBEXP && clexp_node->opr.idx == dfa->nodes[node_idx].opr.idx) break; } if (clexp_idx == init_nodes.nelem) continue; if (type == OP_BACK_REF) { Idx dest_idx = dfa->edests[node_idx].elems[0]; if (!re_node_set_contains (&init_nodes, dest_idx)) { reg_errcode_t merge_err = re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx); if (merge_err != REG_NOERROR) return merge_err; i = 0; } } } /* It must be the first time to invoke acquire_state. */ dfa->init_state = re_acquire_state_context (&err, dfa, &init_nodes, 0); /* We don't check ERR here, since the initial state must not be NULL. */ if (__glibc_unlikely (dfa->init_state == NULL)) return err; if (dfa->init_state->has_constraint) { dfa->init_state_word = re_acquire_state_context (&err, dfa, &init_nodes, CONTEXT_WORD); dfa->init_state_nl = re_acquire_state_context (&err, dfa, &init_nodes, CONTEXT_NEWLINE); dfa->init_state_begbuf = re_acquire_state_context (&err, dfa, &init_nodes, CONTEXT_NEWLINE | CONTEXT_BEGBUF); if (__glibc_unlikely (dfa->init_state_word == NULL || dfa->init_state_nl == NULL || dfa->init_state_begbuf == NULL)) return err; } else dfa->init_state_word = dfa->init_state_nl = dfa->init_state_begbuf = dfa->init_state; re_node_set_free (&init_nodes); return REG_NOERROR; } #ifdef RE_ENABLE_I18N /* If it is possible to do searching in single byte encoding instead of UTF-8 to speed things up, set dfa->mb_cur_max to 1, clear is_utf8 and change DFA nodes where needed. */ static void optimize_utf8 (re_dfa_t *dfa) { Idx node; int i; bool mb_chars = false; bool has_period = false; for (node = 0; node < dfa->nodes_len; ++node) switch (dfa->nodes[node].type) { case CHARACTER: if (dfa->nodes[node].opr.c >= ASCII_CHARS) mb_chars = true; break; case ANCHOR: switch (dfa->nodes[node].opr.ctx_type) { case LINE_FIRST: case LINE_LAST: case BUF_FIRST: case BUF_LAST: break; default: /* Word anchors etc. cannot be handled. It's okay to test opr.ctx_type since constraints (for all DFA nodes) are created by ORing one or more opr.ctx_type values. */ return; } break; case OP_PERIOD: has_period = true; break; case OP_BACK_REF: case OP_ALT: case END_OF_RE: case OP_DUP_ASTERISK: case OP_OPEN_SUBEXP: case OP_CLOSE_SUBEXP: break; case COMPLEX_BRACKET: return; case SIMPLE_BRACKET: /* Just double check. */ { int rshift = (ASCII_CHARS % BITSET_WORD_BITS == 0 ? 0 : BITSET_WORD_BITS - ASCII_CHARS % BITSET_WORD_BITS); for (i = ASCII_CHARS / BITSET_WORD_BITS; i < BITSET_WORDS; ++i) { if (dfa->nodes[node].opr.sbcset[i] >> rshift != 0) return; rshift = 0; } } break; default: abort (); } if (mb_chars || has_period) for (node = 0; node < dfa->nodes_len; ++node) { if (dfa->nodes[node].type == CHARACTER && dfa->nodes[node].opr.c >= ASCII_CHARS) dfa->nodes[node].mb_partial = 0; else if (dfa->nodes[node].type == OP_PERIOD) dfa->nodes[node].type = OP_UTF8_PERIOD; } /* The search can be in single byte locale. */ dfa->mb_cur_max = 1; dfa->is_utf8 = 0; dfa->has_mb_node = dfa->nbackref > 0 || has_period; } #endif /* Analyze the structure tree, and calculate "first", "next", "edest", "eclosure", and "inveclosure". */ static reg_errcode_t analyze (regex_t *preg) { re_dfa_t *dfa = preg->buffer; reg_errcode_t ret; /* Allocate arrays. */ dfa->nexts = re_malloc (Idx, dfa->nodes_alloc); dfa->org_indices = re_malloc (Idx, dfa->nodes_alloc); dfa->edests = re_malloc (re_node_set, dfa->nodes_alloc); dfa->eclosures = re_malloc (re_node_set, dfa->nodes_alloc); if (__glibc_unlikely (dfa->nexts == NULL || dfa->org_indices == NULL || dfa->edests == NULL || dfa->eclosures == NULL)) return REG_ESPACE; dfa->subexp_map = re_malloc (Idx, preg->re_nsub); if (dfa->subexp_map != NULL) { Idx i; for (i = 0; i < preg->re_nsub; i++) dfa->subexp_map[i] = i; preorder (dfa->str_tree, optimize_subexps, dfa); for (i = 0; i < preg->re_nsub; i++) if (dfa->subexp_map[i] != i) break; if (i == preg->re_nsub) { re_free (dfa->subexp_map); dfa->subexp_map = NULL; } } ret = postorder (dfa->str_tree, lower_subexps, preg); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; ret = postorder (dfa->str_tree, calc_first, dfa); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; preorder (dfa->str_tree, calc_next, dfa); ret = preorder (dfa->str_tree, link_nfa_nodes, dfa); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; ret = calc_eclosure (dfa); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; /* We only need this during the prune_impossible_nodes pass in regexec.c; skip it if p_i_n will not run, as calc_inveclosure can be quadratic. */ if ((!preg->no_sub && preg->re_nsub > 0 && dfa->has_plural_match) || dfa->nbackref) { dfa->inveclosures = re_malloc (re_node_set, dfa->nodes_len); if (__glibc_unlikely (dfa->inveclosures == NULL)) return REG_ESPACE; ret = calc_inveclosure (dfa); } return ret; } /* Our parse trees are very unbalanced, so we cannot use a stack to implement parse tree visits. Instead, we use parent pointers and some hairy code in these two functions. */ static reg_errcode_t postorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)), void *extra) { bin_tree_t *node, *prev; for (node = root; ; ) { /* Descend down the tree, preferably to the left (or to the right if that's the only child). */ while (node->left || node->right) if (node->left) node = node->left; else node = node->right; do { reg_errcode_t err = fn (extra, node); if (__glibc_unlikely (err != REG_NOERROR)) return err; if (node->parent == NULL) return REG_NOERROR; prev = node; node = node->parent; } /* Go up while we have a node that is reached from the right. */ while (node->right == prev || node->right == NULL); node = node->right; } } static reg_errcode_t preorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)), void *extra) { bin_tree_t *node; for (node = root; ; ) { reg_errcode_t err = fn (extra, node); if (__glibc_unlikely (err != REG_NOERROR)) return err; /* Go to the left node, or up and to the right. */ if (node->left) node = node->left; else { bin_tree_t *prev = NULL; while (node->right == prev || node->right == NULL) { prev = node; node = node->parent; if (!node) return REG_NOERROR; } node = node->right; } } } /* Optimization pass: if a SUBEXP is entirely contained, strip it and tell re_search_internal to map the inner one's opr.idx to this one's. Adjust backreferences as well. Requires a preorder visit. */ static reg_errcode_t optimize_subexps (void *extra, bin_tree_t *node) { re_dfa_t *dfa = (re_dfa_t *) extra; if (node->token.type == OP_BACK_REF && dfa->subexp_map) { int idx = node->token.opr.idx; node->token.opr.idx = dfa->subexp_map[idx]; dfa->used_bkref_map |= 1 << node->token.opr.idx; } else if (node->token.type == SUBEXP && node->left && node->left->token.type == SUBEXP) { Idx other_idx = node->left->token.opr.idx; node->left = node->left->left; if (node->left) node->left->parent = node; dfa->subexp_map[other_idx] = dfa->subexp_map[node->token.opr.idx]; if (other_idx < BITSET_WORD_BITS) dfa->used_bkref_map &= ~((bitset_word_t) 1 << other_idx); } return REG_NOERROR; } /* Lowering pass: Turn each SUBEXP node into the appropriate concatenation of OP_OPEN_SUBEXP, the body of the SUBEXP (if any) and OP_CLOSE_SUBEXP. */ static reg_errcode_t lower_subexps (void *extra, bin_tree_t *node) { regex_t *preg = (regex_t *) extra; reg_errcode_t err = REG_NOERROR; if (node->left && node->left->token.type == SUBEXP) { node->left = lower_subexp (&err, preg, node->left); if (node->left) node->left->parent = node; } if (node->right && node->right->token.type == SUBEXP) { node->right = lower_subexp (&err, preg, node->right); if (node->right) node->right->parent = node; } return err; } static bin_tree_t * lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node) { re_dfa_t *dfa = preg->buffer; bin_tree_t *body = node->left; bin_tree_t *op, *cls, *tree1, *tree; if (preg->no_sub /* We do not optimize empty subexpressions, because otherwise we may have bad CONCAT nodes with NULL children. This is obviously not very common, so we do not lose much. An example that triggers this case is the sed "script" /\(\)/x. */ && node->left != NULL && (node->token.opr.idx >= BITSET_WORD_BITS || !(dfa->used_bkref_map & ((bitset_word_t) 1 << node->token.opr.idx)))) return node->left; /* Convert the SUBEXP node to the concatenation of an OP_OPEN_SUBEXP, the contents, and an OP_CLOSE_SUBEXP. */ op = create_tree (dfa, NULL, NULL, OP_OPEN_SUBEXP); cls = create_tree (dfa, NULL, NULL, OP_CLOSE_SUBEXP); tree1 = body ? create_tree (dfa, body, cls, CONCAT) : cls; tree = create_tree (dfa, op, tree1, CONCAT); if (__glibc_unlikely (tree == NULL || tree1 == NULL || op == NULL || cls == NULL)) { *err = REG_ESPACE; return NULL; } op->token.opr.idx = cls->token.opr.idx = node->token.opr.idx; op->token.opt_subexp = cls->token.opt_subexp = node->token.opt_subexp; return tree; } /* Pass 1 in building the NFA: compute FIRST and create unlinked automaton nodes. Requires a postorder visit. */ static reg_errcode_t calc_first (void *extra, bin_tree_t *node) { re_dfa_t *dfa = (re_dfa_t *) extra; if (node->token.type == CONCAT) { node->first = node->left->first; node->node_idx = node->left->node_idx; } else { node->first = node; node->node_idx = re_dfa_add_node (dfa, node->token); if (__glibc_unlikely (node->node_idx == -1)) return REG_ESPACE; if (node->token.type == ANCHOR) dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type; } return REG_NOERROR; } /* Pass 2: compute NEXT on the tree. Preorder visit. */ static reg_errcode_t calc_next (void *extra, bin_tree_t *node) { switch (node->token.type) { case OP_DUP_ASTERISK: node->left->next = node; break; case CONCAT: node->left->next = node->right->first; node->right->next = node->next; break; default: if (node->left) node->left->next = node->next; if (node->right) node->right->next = node->next; break; } return REG_NOERROR; } /* Pass 3: link all DFA nodes to their NEXT node (any order will do). */ static reg_errcode_t link_nfa_nodes (void *extra, bin_tree_t *node) { re_dfa_t *dfa = (re_dfa_t *) extra; Idx idx = node->node_idx; reg_errcode_t err = REG_NOERROR; switch (node->token.type) { case CONCAT: break; case END_OF_RE: DEBUG_ASSERT (node->next == NULL); break; case OP_DUP_ASTERISK: case OP_ALT: { Idx left, right; dfa->has_plural_match = 1; if (node->left != NULL) left = node->left->first->node_idx; else left = node->next->node_idx; if (node->right != NULL) right = node->right->first->node_idx; else right = node->next->node_idx; DEBUG_ASSERT (left > -1); DEBUG_ASSERT (right > -1); err = re_node_set_init_2 (dfa->edests + idx, left, right); } break; case ANCHOR: case OP_OPEN_SUBEXP: case OP_CLOSE_SUBEXP: err = re_node_set_init_1 (dfa->edests + idx, node->next->node_idx); break; case OP_BACK_REF: dfa->nexts[idx] = node->next->node_idx; if (node->token.type == OP_BACK_REF) err = re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]); break; default: DEBUG_ASSERT (!IS_EPSILON_NODE (node->token.type)); dfa->nexts[idx] = node->next->node_idx; break; } return err; } /* Duplicate the epsilon closure of the node ROOT_NODE. Note that duplicated nodes have constraint INIT_CONSTRAINT in addition to their own constraint. */ static reg_errcode_t duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node, Idx root_node, unsigned int init_constraint) { Idx org_node, clone_node; bool ok; unsigned int constraint = init_constraint; for (org_node = top_org_node, clone_node = top_clone_node;;) { Idx org_dest, clone_dest; if (dfa->nodes[org_node].type == OP_BACK_REF) { /* If the back reference epsilon-transit, its destination must also have the constraint. Then duplicate the epsilon closure of the destination of the back reference, and store it in edests of the back reference. */ org_dest = dfa->nexts[org_node]; re_node_set_empty (dfa->edests + clone_node); clone_dest = duplicate_node (dfa, org_dest, constraint); if (__glibc_unlikely (clone_dest == -1)) return REG_ESPACE; dfa->nexts[clone_node] = dfa->nexts[org_node]; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (__glibc_unlikely (! ok)) return REG_ESPACE; } else if (dfa->edests[org_node].nelem == 0) { /* In case of the node can't epsilon-transit, don't duplicate the destination and store the original destination as the destination of the node. */ dfa->nexts[clone_node] = dfa->nexts[org_node]; break; } else if (dfa->edests[org_node].nelem == 1) { /* In case of the node can epsilon-transit, and it has only one destination. */ org_dest = dfa->edests[org_node].elems[0]; re_node_set_empty (dfa->edests + clone_node); /* If the node is root_node itself, it means the epsilon closure has a loop. Then tie it to the destination of the root_node. */ if (org_node == root_node && clone_node != org_node) { ok = re_node_set_insert (dfa->edests + clone_node, org_dest); if (__glibc_unlikely (! ok)) return REG_ESPACE; break; } /* In case the node has another constraint, append it. */ constraint |= dfa->nodes[org_node].constraint; clone_dest = duplicate_node (dfa, org_dest, constraint); if (__glibc_unlikely (clone_dest == -1)) return REG_ESPACE; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (__glibc_unlikely (! ok)) return REG_ESPACE; } else /* dfa->edests[org_node].nelem == 2 */ { /* In case of the node can epsilon-transit, and it has two destinations. In the bin_tree_t and DFA, that's '|' and '*'. */ org_dest = dfa->edests[org_node].elems[0]; re_node_set_empty (dfa->edests + clone_node); /* Search for a duplicated node which satisfies the constraint. */ clone_dest = search_duplicated_node (dfa, org_dest, constraint); if (clone_dest == -1) { /* There is no such duplicated node, create a new one. */ reg_errcode_t err; clone_dest = duplicate_node (dfa, org_dest, constraint); if (__glibc_unlikely (clone_dest == -1)) return REG_ESPACE; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (__glibc_unlikely (! ok)) return REG_ESPACE; err = duplicate_node_closure (dfa, org_dest, clone_dest, root_node, constraint); if (__glibc_unlikely (err != REG_NOERROR)) return err; } else { /* There is a duplicated node which satisfies the constraint, use it to avoid infinite loop. */ ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (__glibc_unlikely (! ok)) return REG_ESPACE; } org_dest = dfa->edests[org_node].elems[1]; clone_dest = duplicate_node (dfa, org_dest, constraint); if (__glibc_unlikely (clone_dest == -1)) return REG_ESPACE; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (__glibc_unlikely (! ok)) return REG_ESPACE; } org_node = org_dest; clone_node = clone_dest; } return REG_NOERROR; } /* Search for a node which is duplicated from the node ORG_NODE, and satisfies the constraint CONSTRAINT. */ static Idx search_duplicated_node (const re_dfa_t *dfa, Idx org_node, unsigned int constraint) { Idx idx; for (idx = dfa->nodes_len - 1; dfa->nodes[idx].duplicated && idx > 0; --idx) { if (org_node == dfa->org_indices[idx] && constraint == dfa->nodes[idx].constraint) return idx; /* Found. */ } return -1; /* Not found. */ } /* Duplicate the node whose index is ORG_IDX and set the constraint CONSTRAINT. Return the index of the new node, or -1 if insufficient storage is available. */ static Idx duplicate_node (re_dfa_t *dfa, Idx org_idx, unsigned int constraint) { Idx dup_idx = re_dfa_add_node (dfa, dfa->nodes[org_idx]); if (__glibc_likely (dup_idx != -1)) { dfa->nodes[dup_idx].constraint = constraint; dfa->nodes[dup_idx].constraint |= dfa->nodes[org_idx].constraint; dfa->nodes[dup_idx].duplicated = 1; /* Store the index of the original node. */ dfa->org_indices[dup_idx] = org_idx; } return dup_idx; } static reg_errcode_t calc_inveclosure (re_dfa_t *dfa) { Idx src, idx; bool ok; for (idx = 0; idx < dfa->nodes_len; ++idx) re_node_set_init_empty (dfa->inveclosures + idx); for (src = 0; src < dfa->nodes_len; ++src) { Idx *elems = dfa->eclosures[src].elems; for (idx = 0; idx < dfa->eclosures[src].nelem; ++idx) { ok = re_node_set_insert_last (dfa->inveclosures + elems[idx], src); if (__glibc_unlikely (! ok)) return REG_ESPACE; } } return REG_NOERROR; } /* Calculate "eclosure" for all the node in DFA. */ static reg_errcode_t calc_eclosure (re_dfa_t *dfa) { Idx node_idx; bool incomplete; DEBUG_ASSERT (dfa->nodes_len > 0); incomplete = false; /* For each nodes, calculate epsilon closure. */ for (node_idx = 0; ; ++node_idx) { reg_errcode_t err; re_node_set eclosure_elem; if (node_idx == dfa->nodes_len) { if (!incomplete) break; incomplete = false; node_idx = 0; } DEBUG_ASSERT (dfa->eclosures[node_idx].nelem != -1); /* If we have already calculated, skip it. */ if (dfa->eclosures[node_idx].nelem != 0) continue; /* Calculate epsilon closure of 'node_idx'. */ err = calc_eclosure_iter (&eclosure_elem, dfa, node_idx, true); if (__glibc_unlikely (err != REG_NOERROR)) return err; if (dfa->eclosures[node_idx].nelem == 0) { incomplete = true; re_node_set_free (&eclosure_elem); } } return REG_NOERROR; } /* Calculate epsilon closure of NODE. */ static reg_errcode_t calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) { reg_errcode_t err; Idx i; re_node_set eclosure; bool incomplete = false; err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1); if (__glibc_unlikely (err != REG_NOERROR)) return err; /* An epsilon closure includes itself. */ eclosure.elems[eclosure.nelem++] = node; /* This indicates that we are calculating this node now. We reference this value to avoid infinite loop. */ dfa->eclosures[node].nelem = -1; /* If the current node has constraints, duplicate all nodes since they must inherit the constraints. */ if (dfa->nodes[node].constraint && dfa->edests[node].nelem && !dfa->nodes[dfa->edests[node].elems[0]].duplicated) { err = duplicate_node_closure (dfa, node, node, node, dfa->nodes[node].constraint); if (__glibc_unlikely (err != REG_NOERROR)) return err; } /* Expand each epsilon destination nodes. */ if (IS_EPSILON_NODE(dfa->nodes[node].type)) for (i = 0; i < dfa->edests[node].nelem; ++i) { re_node_set eclosure_elem; Idx edest = dfa->edests[node].elems[i]; /* If calculating the epsilon closure of 'edest' is in progress, return intermediate result. */ if (dfa->eclosures[edest].nelem == -1) { incomplete = true; continue; } /* If we haven't calculated the epsilon closure of 'edest' yet, calculate now. Otherwise use calculated epsilon closure. */ if (dfa->eclosures[edest].nelem == 0) { err = calc_eclosure_iter (&eclosure_elem, dfa, edest, false); if (__glibc_unlikely (err != REG_NOERROR)) return err; } else eclosure_elem = dfa->eclosures[edest]; /* Merge the epsilon closure of 'edest'. */ err = re_node_set_merge (&eclosure, &eclosure_elem); if (__glibc_unlikely (err != REG_NOERROR)) return err; /* If the epsilon closure of 'edest' is incomplete, the epsilon closure of this node is also incomplete. */ if (dfa->eclosures[edest].nelem == 0) { incomplete = true; re_node_set_free (&eclosure_elem); } } if (incomplete && !root) dfa->eclosures[node].nelem = 0; else dfa->eclosures[node] = eclosure; *new_set = eclosure; return REG_NOERROR; } /* Functions for token which are used in the parser. */ /* Fetch a token from INPUT. We must not use this function inside bracket expressions. */ static void fetch_token (re_token_t *result, re_string_t *input, reg_syntax_t syntax) { re_string_skip_bytes (input, peek_token (result, input, syntax)); } /* Peek a token from INPUT, and return the length of the token. We must not use this function inside bracket expressions. */ static int peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax) { unsigned char c; if (re_string_eoi (input)) { token->type = END_OF_RE; return 0; } c = re_string_peek_byte (input, 0); token->opr.c = c; token->word_char = 0; #ifdef RE_ENABLE_I18N token->mb_partial = 0; if (input->mb_cur_max > 1 && !re_string_first_byte (input, re_string_cur_idx (input))) { token->type = CHARACTER; token->mb_partial = 1; return 1; } #endif if (c == '\\') { unsigned char c2; if (re_string_cur_idx (input) + 1 >= re_string_length (input)) { token->type = BACK_SLASH; return 1; } c2 = re_string_peek_byte_case (input, 1); token->opr.c = c2; token->type = CHARACTER; #ifdef RE_ENABLE_I18N if (input->mb_cur_max > 1) { wint_t wc = re_string_wchar_at (input, re_string_cur_idx (input) + 1); token->word_char = IS_WIDE_WORD_CHAR (wc) != 0; } else #endif token->word_char = IS_WORD_CHAR (c2) != 0; switch (c2) { case '|': if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_NO_BK_VBAR)) token->type = OP_ALT; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (!(syntax & RE_NO_BK_REFS)) { token->type = OP_BACK_REF; token->opr.idx = c2 - '1'; } break; case '<': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = WORD_FIRST; } break; case '>': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = WORD_LAST; } break; case 'b': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = WORD_DELIM; } break; case 'B': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = NOT_WORD_DELIM; } break; case 'w': if (!(syntax & RE_NO_GNU_OPS)) token->type = OP_WORD; break; case 'W': if (!(syntax & RE_NO_GNU_OPS)) token->type = OP_NOTWORD; break; case 's': if (!(syntax & RE_NO_GNU_OPS)) token->type = OP_SPACE; break; case 'S': if (!(syntax & RE_NO_GNU_OPS)) token->type = OP_NOTSPACE; break; case '`': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = BUF_FIRST; } break; case '\'': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = BUF_LAST; } break; case '(': if (!(syntax & RE_NO_BK_PARENS)) token->type = OP_OPEN_SUBEXP; break; case ')': if (!(syntax & RE_NO_BK_PARENS)) token->type = OP_CLOSE_SUBEXP; break; case '+': if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_BK_PLUS_QM)) token->type = OP_DUP_PLUS; break; case '?': if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_BK_PLUS_QM)) token->type = OP_DUP_QUESTION; break; case '{': if ((syntax & RE_INTERVALS) && (!(syntax & RE_NO_BK_BRACES))) token->type = OP_OPEN_DUP_NUM; break; case '}': if ((syntax & RE_INTERVALS) && (!(syntax & RE_NO_BK_BRACES))) token->type = OP_CLOSE_DUP_NUM; break; default: break; } return 2; } token->type = CHARACTER; #ifdef RE_ENABLE_I18N if (input->mb_cur_max > 1) { wint_t wc = re_string_wchar_at (input, re_string_cur_idx (input)); token->word_char = IS_WIDE_WORD_CHAR (wc) != 0; } else #endif token->word_char = IS_WORD_CHAR (token->opr.c); switch (c) { case '\n': if (syntax & RE_NEWLINE_ALT) token->type = OP_ALT; break; case '|': if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_NO_BK_VBAR)) token->type = OP_ALT; break; case '*': token->type = OP_DUP_ASTERISK; break; case '+': if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_BK_PLUS_QM)) token->type = OP_DUP_PLUS; break; case '?': if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_BK_PLUS_QM)) token->type = OP_DUP_QUESTION; break; case '{': if ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) token->type = OP_OPEN_DUP_NUM; break; case '}': if ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) token->type = OP_CLOSE_DUP_NUM; break; case '(': if (syntax & RE_NO_BK_PARENS) token->type = OP_OPEN_SUBEXP; break; case ')': if (syntax & RE_NO_BK_PARENS) token->type = OP_CLOSE_SUBEXP; break; case '[': token->type = OP_OPEN_BRACKET; break; case '.': token->type = OP_PERIOD; break; case '^': if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) && re_string_cur_idx (input) != 0) { char prev = re_string_peek_byte (input, -1); if (!(syntax & RE_NEWLINE_ALT) || prev != '\n') break; } token->type = ANCHOR; token->opr.ctx_type = LINE_FIRST; break; case '$': if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) && re_string_cur_idx (input) + 1 != re_string_length (input)) { re_token_t next; re_string_skip_bytes (input, 1); peek_token (&next, input, syntax); re_string_skip_bytes (input, -1); if (next.type != OP_ALT && next.type != OP_CLOSE_SUBEXP) break; } token->type = ANCHOR; token->opr.ctx_type = LINE_LAST; break; default: break; } return 1; } /* Peek a token from INPUT, and return the length of the token. We must not use this function out of bracket expressions. */ static int peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax) { unsigned char c; if (re_string_eoi (input)) { token->type = END_OF_RE; return 0; } c = re_string_peek_byte (input, 0); token->opr.c = c; #ifdef RE_ENABLE_I18N if (input->mb_cur_max > 1 && !re_string_first_byte (input, re_string_cur_idx (input))) { token->type = CHARACTER; return 1; } #endif /* RE_ENABLE_I18N */ if (c == '\\' && (syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && re_string_cur_idx (input) + 1 < re_string_length (input)) { /* In this case, '\' escape a character. */ unsigned char c2; re_string_skip_bytes (input, 1); c2 = re_string_peek_byte (input, 0); token->opr.c = c2; token->type = CHARACTER; return 1; } if (c == '[') /* '[' is a special char in a bracket exps. */ { unsigned char c2; int token_len; if (re_string_cur_idx (input) + 1 < re_string_length (input)) c2 = re_string_peek_byte (input, 1); else c2 = 0; token->opr.c = c2; token_len = 2; switch (c2) { case '.': token->type = OP_OPEN_COLL_ELEM; break; case '=': token->type = OP_OPEN_EQUIV_CLASS; break; case ':': if (syntax & RE_CHAR_CLASSES) { token->type = OP_OPEN_CHAR_CLASS; break; } FALLTHROUGH; default: token->type = CHARACTER; token->opr.c = c; token_len = 1; break; } return token_len; } switch (c) { case '-': token->type = OP_CHARSET_RANGE; break; case ']': token->type = OP_CLOSE_BRACKET; break; case '^': token->type = OP_NON_MATCH_LIST; break; default: token->type = CHARACTER; } return 1; } /* Functions for parser. */ /* Entry point of the parser. Parse the regular expression REGEXP and return the structure tree. If an error occurs, ERR is set by error code, and return NULL. This function build the following tree, from regular expression : CAT / \ / \ EOR CAT means concatenation. EOR means end of regular expression. */ static bin_tree_t * parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax, reg_errcode_t *err) { re_dfa_t *dfa = preg->buffer; bin_tree_t *tree, *eor, *root; re_token_t current_token; dfa->syntax = syntax; fetch_token (¤t_token, regexp, syntax | RE_CARET_ANCHORS_HERE); tree = parse_reg_exp (regexp, preg, ¤t_token, syntax, 0, err); if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL)) return NULL; eor = create_tree (dfa, NULL, NULL, END_OF_RE); if (tree != NULL) root = create_tree (dfa, tree, eor, CONCAT); else root = eor; if (__glibc_unlikely (eor == NULL || root == NULL)) { *err = REG_ESPACE; return NULL; } return root; } /* This function build the following tree, from regular expression |: ALT / \ / \ ALT means alternative, which represents the operator '|'. */ static bin_tree_t * parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { re_dfa_t *dfa = preg->buffer; bin_tree_t *tree, *branch = NULL; bitset_word_t initial_bkref_map = dfa->completed_bkref_map; tree = parse_branch (regexp, preg, token, syntax, nest, err); if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL)) return NULL; while (token->type == OP_ALT) { fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE); if (token->type != OP_ALT && token->type != END_OF_RE && (nest == 0 || token->type != OP_CLOSE_SUBEXP)) { bitset_word_t accumulated_bkref_map = dfa->completed_bkref_map; dfa->completed_bkref_map = initial_bkref_map; branch = parse_branch (regexp, preg, token, syntax, nest, err); if (__glibc_unlikely (*err != REG_NOERROR && branch == NULL)) { if (tree != NULL) postorder (tree, free_tree, NULL); return NULL; } dfa->completed_bkref_map |= accumulated_bkref_map; } else branch = NULL; tree = create_tree (dfa, tree, branch, OP_ALT); if (__glibc_unlikely (tree == NULL)) { *err = REG_ESPACE; return NULL; } } return tree; } /* This function build the following tree, from regular expression : CAT / \ / \ CAT means concatenation. */ static bin_tree_t * parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { bin_tree_t *tree, *expr; re_dfa_t *dfa = preg->buffer; tree = parse_expression (regexp, preg, token, syntax, nest, err); if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL)) return NULL; while (token->type != OP_ALT && token->type != END_OF_RE && (nest == 0 || token->type != OP_CLOSE_SUBEXP)) { expr = parse_expression (regexp, preg, token, syntax, nest, err); if (__glibc_unlikely (*err != REG_NOERROR && expr == NULL)) { if (tree != NULL) postorder (tree, free_tree, NULL); return NULL; } if (tree != NULL && expr != NULL) { bin_tree_t *newtree = create_tree (dfa, tree, expr, CONCAT); if (newtree == NULL) { postorder (expr, free_tree, NULL); postorder (tree, free_tree, NULL); *err = REG_ESPACE; return NULL; } tree = newtree; } else if (tree == NULL) tree = expr; /* Otherwise expr == NULL, we don't need to create new tree. */ } return tree; } /* This function build the following tree, from regular expression a*: * | a */ static bin_tree_t * parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { re_dfa_t *dfa = preg->buffer; bin_tree_t *tree; switch (token->type) { case CHARACTER: tree = create_token_tree (dfa, NULL, NULL, token); if (__glibc_unlikely (tree == NULL)) { *err = REG_ESPACE; return NULL; } #ifdef RE_ENABLE_I18N if (dfa->mb_cur_max > 1) { while (!re_string_eoi (regexp) && !re_string_first_byte (regexp, re_string_cur_idx (regexp))) { bin_tree_t *mbc_remain; fetch_token (token, regexp, syntax); mbc_remain = create_token_tree (dfa, NULL, NULL, token); tree = create_tree (dfa, tree, mbc_remain, CONCAT); if (__glibc_unlikely (mbc_remain == NULL || tree == NULL)) { *err = REG_ESPACE; return NULL; } } } #endif break; case OP_OPEN_SUBEXP: tree = parse_sub_exp (regexp, preg, token, syntax, nest + 1, err); if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL)) return NULL; break; case OP_OPEN_BRACKET: tree = parse_bracket_exp (regexp, dfa, token, syntax, err); if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL)) return NULL; break; case OP_BACK_REF: if (!__glibc_likely (dfa->completed_bkref_map & (1 << token->opr.idx))) { *err = REG_ESUBREG; return NULL; } dfa->used_bkref_map |= 1 << token->opr.idx; tree = create_token_tree (dfa, NULL, NULL, token); if (__glibc_unlikely (tree == NULL)) { *err = REG_ESPACE; return NULL; } ++dfa->nbackref; dfa->has_mb_node = 1; break; case OP_OPEN_DUP_NUM: if (syntax & RE_CONTEXT_INVALID_DUP) { *err = REG_BADRPT; return NULL; } FALLTHROUGH; case OP_DUP_ASTERISK: case OP_DUP_PLUS: case OP_DUP_QUESTION: if (syntax & RE_CONTEXT_INVALID_OPS) { *err = REG_BADRPT; return NULL; } else if (syntax & RE_CONTEXT_INDEP_OPS) { fetch_token (token, regexp, syntax); return parse_expression (regexp, preg, token, syntax, nest, err); } FALLTHROUGH; case OP_CLOSE_SUBEXP: if ((token->type == OP_CLOSE_SUBEXP) && !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)) { *err = REG_ERPAREN; return NULL; } FALLTHROUGH; case OP_CLOSE_DUP_NUM: /* We treat it as a normal character. */ /* Then we can these characters as normal characters. */ token->type = CHARACTER; /* mb_partial and word_char bits should be initialized already by peek_token. */ tree = create_token_tree (dfa, NULL, NULL, token); if (__glibc_unlikely (tree == NULL)) { *err = REG_ESPACE; return NULL; } break; case ANCHOR: if ((token->opr.ctx_type & (WORD_DELIM | NOT_WORD_DELIM | WORD_FIRST | WORD_LAST)) && dfa->word_ops_used == 0) init_word_char (dfa); if (token->opr.ctx_type == WORD_DELIM || token->opr.ctx_type == NOT_WORD_DELIM) { bin_tree_t *tree_first, *tree_last; if (token->opr.ctx_type == WORD_DELIM) { token->opr.ctx_type = WORD_FIRST; tree_first = create_token_tree (dfa, NULL, NULL, token); token->opr.ctx_type = WORD_LAST; } else { token->opr.ctx_type = INSIDE_WORD; tree_first = create_token_tree (dfa, NULL, NULL, token); token->opr.ctx_type = INSIDE_NOTWORD; } tree_last = create_token_tree (dfa, NULL, NULL, token); tree = create_tree (dfa, tree_first, tree_last, OP_ALT); if (__glibc_unlikely (tree_first == NULL || tree_last == NULL || tree == NULL)) { *err = REG_ESPACE; return NULL; } } else { tree = create_token_tree (dfa, NULL, NULL, token); if (__glibc_unlikely (tree == NULL)) { *err = REG_ESPACE; return NULL; } } /* We must return here, since ANCHORs can't be followed by repetition operators. eg. RE"^*" is invalid or "", it must not be "". */ fetch_token (token, regexp, syntax); return tree; case OP_PERIOD: tree = create_token_tree (dfa, NULL, NULL, token); if (__glibc_unlikely (tree == NULL)) { *err = REG_ESPACE; return NULL; } if (dfa->mb_cur_max > 1) dfa->has_mb_node = 1; break; case OP_WORD: case OP_NOTWORD: tree = build_charclass_op (dfa, regexp->trans, "alnum", "_", token->type == OP_NOTWORD, err); if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL)) return NULL; break; case OP_SPACE: case OP_NOTSPACE: tree = build_charclass_op (dfa, regexp->trans, "space", "", token->type == OP_NOTSPACE, err); if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL)) return NULL; break; case OP_ALT: case END_OF_RE: return NULL; case BACK_SLASH: *err = REG_EESCAPE; return NULL; default: /* Must not happen? */ DEBUG_ASSERT (false); return NULL; } fetch_token (token, regexp, syntax); while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS || token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM) { bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token, syntax, err); if (__glibc_unlikely (*err != REG_NOERROR && dup_tree == NULL)) { if (tree != NULL) postorder (tree, free_tree, NULL); return NULL; } tree = dup_tree; /* In BRE consecutive duplications are not allowed. */ if ((syntax & RE_CONTEXT_INVALID_DUP) && (token->type == OP_DUP_ASTERISK || token->type == OP_OPEN_DUP_NUM)) { if (tree != NULL) postorder (tree, free_tree, NULL); *err = REG_BADRPT; return NULL; } } return tree; } /* This function build the following tree, from regular expression (): SUBEXP | */ static bin_tree_t * parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { re_dfa_t *dfa = preg->buffer; bin_tree_t *tree; size_t cur_nsub; cur_nsub = preg->re_nsub++; fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE); /* The subexpression may be a null string. */ if (token->type == OP_CLOSE_SUBEXP) tree = NULL; else { tree = parse_reg_exp (regexp, preg, token, syntax, nest, err); if (__glibc_unlikely (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP)) { if (tree != NULL) postorder (tree, free_tree, NULL); *err = REG_EPAREN; } if (__glibc_unlikely (*err != REG_NOERROR)) return NULL; } if (cur_nsub <= '9' - '1') dfa->completed_bkref_map |= 1 << cur_nsub; tree = create_tree (dfa, tree, NULL, SUBEXP); if (__glibc_unlikely (tree == NULL)) { *err = REG_ESPACE; return NULL; } tree->token.opr.idx = cur_nsub; return tree; } /* This function parse repetition operators like "*", "+", "{1,3}" etc. */ static bin_tree_t * parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, reg_syntax_t syntax, reg_errcode_t *err) { bin_tree_t *tree = NULL, *old_tree = NULL; Idx i, start, end, start_idx = re_string_cur_idx (regexp); re_token_t start_token = *token; if (token->type == OP_OPEN_DUP_NUM) { end = 0; start = fetch_number (regexp, token, syntax); if (start == -1) { if (token->type == CHARACTER && token->opr.c == ',') start = 0; /* We treat "{,m}" as "{0,m}". */ else { *err = REG_BADBR; /* {} is invalid. */ return NULL; } } if (__glibc_likely (start != -2)) { /* We treat "{n}" as "{n,n}". */ end = ((token->type == OP_CLOSE_DUP_NUM) ? start : ((token->type == CHARACTER && token->opr.c == ',') ? fetch_number (regexp, token, syntax) : -2)); } if (__glibc_unlikely (start == -2 || end == -2)) { /* Invalid sequence. */ if (__glibc_unlikely (!(syntax & RE_INVALID_INTERVAL_ORD))) { if (token->type == END_OF_RE) *err = REG_EBRACE; else *err = REG_BADBR; return NULL; } /* If the syntax bit is set, rollback. */ re_string_set_index (regexp, start_idx); *token = start_token; token->type = CHARACTER; /* mb_partial and word_char bits should be already initialized by peek_token. */ return elem; } if (__glibc_unlikely ((end != -1 && start > end) || token->type != OP_CLOSE_DUP_NUM)) { /* First number greater than second. */ *err = REG_BADBR; return NULL; } if (__glibc_unlikely (RE_DUP_MAX < (end == -1 ? start : end))) { *err = REG_ESIZE; return NULL; } } else { start = (token->type == OP_DUP_PLUS) ? 1 : 0; end = (token->type == OP_DUP_QUESTION) ? 1 : -1; } fetch_token (token, regexp, syntax); if (__glibc_unlikely (elem == NULL)) return NULL; if (__glibc_unlikely (start == 0 && end == 0)) { postorder (elem, free_tree, NULL); return NULL; } /* Extract "{n,m}" to "...{0,}". */ if (__glibc_unlikely (start > 0)) { tree = elem; for (i = 2; i <= start; ++i) { elem = duplicate_tree (elem, dfa); tree = create_tree (dfa, tree, elem, CONCAT); if (__glibc_unlikely (elem == NULL || tree == NULL)) goto parse_dup_op_espace; } if (start == end) return tree; /* Duplicate ELEM before it is marked optional. */ elem = duplicate_tree (elem, dfa); if (__glibc_unlikely (elem == NULL)) goto parse_dup_op_espace; old_tree = tree; } else old_tree = NULL; if (elem->token.type == SUBEXP) { uintptr_t subidx = elem->token.opr.idx; postorder (elem, mark_opt_subexp, (void *) subidx); } tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT)); if (__glibc_unlikely (tree == NULL)) goto parse_dup_op_espace; /* This loop is actually executed only when end != -1, to rewrite {0,n} as ((...?)?)?... We have already created the start+1-th copy. */ if (TYPE_SIGNED (Idx) || end != -1) for (i = start + 2; i <= end; ++i) { elem = duplicate_tree (elem, dfa); tree = create_tree (dfa, tree, elem, CONCAT); if (__glibc_unlikely (elem == NULL || tree == NULL)) goto parse_dup_op_espace; tree = create_tree (dfa, tree, NULL, OP_ALT); if (__glibc_unlikely (tree == NULL)) goto parse_dup_op_espace; } if (old_tree) tree = create_tree (dfa, old_tree, tree, CONCAT); return tree; parse_dup_op_espace: *err = REG_ESPACE; return NULL; } /* Size of the names for collating symbol/equivalence_class/character_class. I'm not sure, but maybe enough. */ #define BRACKET_NAME_BUF_SIZE 32 #ifndef _LIBC # ifdef RE_ENABLE_I18N /* Convert the byte B to the corresponding wide character. In a unibyte locale, treat B as itself. In a multibyte locale, return WEOF if B is an encoding error. */ static wint_t parse_byte (unsigned char b, re_charset_t *mbcset) { return mbcset == NULL ? b : __btowc (b); } # endif /* Local function for parse_bracket_exp only used in case of NOT _LIBC. Build the range expression which starts from START_ELEM, and ends at END_ELEM. The result are written to MBCSET and SBCSET. RANGE_ALLOC is the allocated size of mbcset->range_starts, and mbcset->range_ends, is a pointer argument since we may update it. */ static reg_errcode_t # ifdef RE_ENABLE_I18N build_range_exp (const reg_syntax_t syntax, bitset_t sbcset, re_charset_t *mbcset, Idx *range_alloc, const bracket_elem_t *start_elem, const bracket_elem_t *end_elem) # else /* not RE_ENABLE_I18N */ build_range_exp (const reg_syntax_t syntax, bitset_t sbcset, const bracket_elem_t *start_elem, const bracket_elem_t *end_elem) # endif /* not RE_ENABLE_I18N */ { unsigned int start_ch, end_ch; /* Equivalence Classes and Character Classes can't be a range start/end. */ if (__glibc_unlikely (start_elem->type == EQUIV_CLASS || start_elem->type == CHAR_CLASS || end_elem->type == EQUIV_CLASS || end_elem->type == CHAR_CLASS)) return REG_ERANGE; /* We can handle no multi character collating elements without libc support. */ if (__glibc_unlikely ((start_elem->type == COLL_SYM && strlen ((char *) start_elem->opr.name) > 1) || (end_elem->type == COLL_SYM && strlen ((char *) end_elem->opr.name) > 1))) return REG_ECOLLATE; # ifdef RE_ENABLE_I18N { wchar_t wc; wint_t start_wc; wint_t end_wc; start_ch = ((start_elem->type == SB_CHAR) ? start_elem->opr.ch : ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0] : 0)); end_ch = ((end_elem->type == SB_CHAR) ? end_elem->opr.ch : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0] : 0)); start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM) ? parse_byte (start_ch, mbcset) : start_elem->opr.wch); end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM) ? parse_byte (end_ch, mbcset) : end_elem->opr.wch); if (start_wc == WEOF || end_wc == WEOF) return REG_ECOLLATE; else if (__glibc_unlikely ((syntax & RE_NO_EMPTY_RANGES) && start_wc > end_wc)) return REG_ERANGE; /* Got valid collation sequence values, add them as a new entry. However, for !_LIBC we have no collation elements: if the character set is single byte, the single byte character set that we build below suffices. parse_bracket_exp passes no MBCSET if dfa->mb_cur_max == 1. */ if (mbcset) { /* Check the space of the arrays. */ if (__glibc_unlikely (*range_alloc == mbcset->nranges)) { /* There is not enough space, need realloc. */ wchar_t *new_array_start, *new_array_end; Idx new_nranges; /* +1 in case of mbcset->nranges is 0. */ new_nranges = 2 * mbcset->nranges + 1; /* Use realloc since mbcset->range_starts and mbcset->range_ends are NULL if *range_alloc == 0. */ new_array_start = re_realloc (mbcset->range_starts, wchar_t, new_nranges); new_array_end = re_realloc (mbcset->range_ends, wchar_t, new_nranges); if (__glibc_unlikely (new_array_start == NULL || new_array_end == NULL)) { re_free (new_array_start); re_free (new_array_end); return REG_ESPACE; } mbcset->range_starts = new_array_start; mbcset->range_ends = new_array_end; *range_alloc = new_nranges; } mbcset->range_starts[mbcset->nranges] = start_wc; mbcset->range_ends[mbcset->nranges++] = end_wc; } /* Build the table for single byte characters. */ for (wc = 0; wc < SBC_MAX; ++wc) { if (start_wc <= wc && wc <= end_wc) bitset_set (sbcset, wc); } } # else /* not RE_ENABLE_I18N */ { unsigned int ch; start_ch = ((start_elem->type == SB_CHAR ) ? start_elem->opr.ch : ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0] : 0)); end_ch = ((end_elem->type == SB_CHAR ) ? end_elem->opr.ch : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0] : 0)); if (start_ch > end_ch) return REG_ERANGE; /* Build the table for single byte characters. */ for (ch = 0; ch < SBC_MAX; ++ch) if (start_ch <= ch && ch <= end_ch) bitset_set (sbcset, ch); } # endif /* not RE_ENABLE_I18N */ return REG_NOERROR; } #endif /* not _LIBC */ #ifndef _LIBC /* Helper function for parse_bracket_exp only used in case of NOT _LIBC.. Build the collating element which is represented by NAME. The result are written to MBCSET and SBCSET. COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a pointer argument since we may update it. */ static reg_errcode_t # ifdef RE_ENABLE_I18N build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset, Idx *coll_sym_alloc, const unsigned char *name) # else /* not RE_ENABLE_I18N */ build_collating_symbol (bitset_t sbcset, const unsigned char *name) # endif /* not RE_ENABLE_I18N */ { size_t name_len = strlen ((const char *) name); if (__glibc_unlikely (name_len != 1)) return REG_ECOLLATE; else { bitset_set (sbcset, name[0]); return REG_NOERROR; } } #endif /* not _LIBC */ /* This function parse bracket expression like "[abc]", "[a-c]", "[[.a-a.]]" etc. */ static bin_tree_t * parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, reg_syntax_t syntax, reg_errcode_t *err) { #ifdef _LIBC const unsigned char *collseqmb; const char *collseqwc; uint32_t nrules; int32_t table_size; const int32_t *symb_table; const unsigned char *extra; /* Local function for parse_bracket_exp used in _LIBC environment. Seek the collating symbol entry corresponding to NAME. Return the index of the symbol in the SYMB_TABLE, or -1 if not found. */ auto inline int32_t __attribute__ ((always_inline)) seek_collating_symbol_entry (const unsigned char *name, size_t name_len) { int32_t elem; for (elem = 0; elem < table_size; elem++) if (symb_table[2 * elem] != 0) { int32_t idx = symb_table[2 * elem + 1]; /* Skip the name of collating element name. */ idx += 1 + extra[idx]; if (/* Compare the length of the name. */ name_len == extra[idx] /* Compare the name. */ && memcmp (name, &extra[idx + 1], name_len) == 0) /* Yep, this is the entry. */ return elem; } return -1; } /* Local function for parse_bracket_exp used in _LIBC environment. Look up the collation sequence value of BR_ELEM. Return the value if succeeded, UINT_MAX otherwise. */ auto inline unsigned int __attribute__ ((always_inline)) lookup_collation_sequence_value (bracket_elem_t *br_elem) { if (br_elem->type == SB_CHAR) { /* if (MB_CUR_MAX == 1) */ if (nrules == 0) return collseqmb[br_elem->opr.ch]; else { wint_t wc = __btowc (br_elem->opr.ch); return __collseq_table_lookup (collseqwc, wc); } } else if (br_elem->type == MB_CHAR) { if (nrules != 0) return __collseq_table_lookup (collseqwc, br_elem->opr.wch); } else if (br_elem->type == COLL_SYM) { size_t sym_name_len = strlen ((char *) br_elem->opr.name); if (nrules != 0) { int32_t elem, idx; elem = seek_collating_symbol_entry (br_elem->opr.name, sym_name_len); if (elem != -1) { /* We found the entry. */ idx = symb_table[2 * elem + 1]; /* Skip the name of collating element name. */ idx += 1 + extra[idx]; /* Skip the byte sequence of the collating element. */ idx += 1 + extra[idx]; /* Adjust for the alignment. */ idx = (idx + 3) & ~3; /* Skip the multibyte collation sequence value. */ idx += sizeof (unsigned int); /* Skip the wide char sequence of the collating element. */ idx += sizeof (unsigned int) * (1 + *(unsigned int *) (extra + idx)); /* Return the collation sequence value. */ return *(unsigned int *) (extra + idx); } else if (sym_name_len == 1) { /* No valid character. Match it as a single byte character. */ return collseqmb[br_elem->opr.name[0]]; } } else if (sym_name_len == 1) return collseqmb[br_elem->opr.name[0]]; } return UINT_MAX; } /* Local function for parse_bracket_exp used in _LIBC environment. Build the range expression which starts from START_ELEM, and ends at END_ELEM. The result are written to MBCSET and SBCSET. RANGE_ALLOC is the allocated size of mbcset->range_starts, and mbcset->range_ends, is a pointer argument since we may update it. */ auto inline reg_errcode_t __attribute__ ((always_inline)) build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc, bracket_elem_t *start_elem, bracket_elem_t *end_elem) { unsigned int ch; uint32_t start_collseq; uint32_t end_collseq; /* Equivalence Classes and Character Classes can't be a range start/end. */ if (__glibc_unlikely (start_elem->type == EQUIV_CLASS || start_elem->type == CHAR_CLASS || end_elem->type == EQUIV_CLASS || end_elem->type == CHAR_CLASS)) return REG_ERANGE; /* FIXME: Implement rational ranges here, too. */ start_collseq = lookup_collation_sequence_value (start_elem); end_collseq = lookup_collation_sequence_value (end_elem); /* Check start/end collation sequence values. */ if (__glibc_unlikely (start_collseq == UINT_MAX || end_collseq == UINT_MAX)) return REG_ECOLLATE; if (__glibc_unlikely ((syntax & RE_NO_EMPTY_RANGES) && start_collseq > end_collseq)) return REG_ERANGE; /* Got valid collation sequence values, add them as a new entry. However, if we have no collation elements, and the character set is single byte, the single byte character set that we build below suffices. */ if (nrules > 0 || dfa->mb_cur_max > 1) { /* Check the space of the arrays. */ if (__glibc_unlikely (*range_alloc == mbcset->nranges)) { /* There is not enough space, need realloc. */ uint32_t *new_array_start; uint32_t *new_array_end; Idx new_nranges; /* +1 in case of mbcset->nranges is 0. */ new_nranges = 2 * mbcset->nranges + 1; new_array_start = re_realloc (mbcset->range_starts, uint32_t, new_nranges); new_array_end = re_realloc (mbcset->range_ends, uint32_t, new_nranges); if (__glibc_unlikely (new_array_start == NULL || new_array_end == NULL)) return REG_ESPACE; mbcset->range_starts = new_array_start; mbcset->range_ends = new_array_end; *range_alloc = new_nranges; } mbcset->range_starts[mbcset->nranges] = start_collseq; mbcset->range_ends[mbcset->nranges++] = end_collseq; } /* Build the table for single byte characters. */ for (ch = 0; ch < SBC_MAX; ch++) { uint32_t ch_collseq; /* if (MB_CUR_MAX == 1) */ if (nrules == 0) ch_collseq = collseqmb[ch]; else ch_collseq = __collseq_table_lookup (collseqwc, __btowc (ch)); if (start_collseq <= ch_collseq && ch_collseq <= end_collseq) bitset_set (sbcset, ch); } return REG_NOERROR; } /* Local function for parse_bracket_exp used in _LIBC environment. Build the collating element which is represented by NAME. The result are written to MBCSET and SBCSET. COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a pointer argument since we may update it. */ auto inline reg_errcode_t __attribute__ ((always_inline)) build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset, Idx *coll_sym_alloc, const unsigned char *name) { int32_t elem, idx; size_t name_len = strlen ((const char *) name); if (nrules != 0) { elem = seek_collating_symbol_entry (name, name_len); if (elem != -1) { /* We found the entry. */ idx = symb_table[2 * elem + 1]; /* Skip the name of collating element name. */ idx += 1 + extra[idx]; } else if (name_len == 1) { /* No valid character, treat it as a normal character. */ bitset_set (sbcset, name[0]); return REG_NOERROR; } else return REG_ECOLLATE; /* Got valid collation sequence, add it as a new entry. */ /* Check the space of the arrays. */ if (__glibc_unlikely (*coll_sym_alloc == mbcset->ncoll_syms)) { /* Not enough, realloc it. */ /* +1 in case of mbcset->ncoll_syms is 0. */ Idx new_coll_sym_alloc = 2 * mbcset->ncoll_syms + 1; /* Use realloc since mbcset->coll_syms is NULL if *alloc == 0. */ int32_t *new_coll_syms = re_realloc (mbcset->coll_syms, int32_t, new_coll_sym_alloc); if (__glibc_unlikely (new_coll_syms == NULL)) return REG_ESPACE; mbcset->coll_syms = new_coll_syms; *coll_sym_alloc = new_coll_sym_alloc; } mbcset->coll_syms[mbcset->ncoll_syms++] = idx; return REG_NOERROR; } else { if (__glibc_unlikely (name_len != 1)) return REG_ECOLLATE; else { bitset_set (sbcset, name[0]); return REG_NOERROR; } } } #endif re_token_t br_token; re_bitset_ptr_t sbcset; #ifdef RE_ENABLE_I18N re_charset_t *mbcset; Idx coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0; Idx equiv_class_alloc = 0, char_class_alloc = 0; #endif /* not RE_ENABLE_I18N */ bool non_match = false; bin_tree_t *work_tree; int token_len; bool first_round = true; #ifdef _LIBC collseqmb = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB); nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules) { /* if (MB_CUR_MAX > 1) */ collseqwc = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQWC); table_size = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_SYMB_HASH_SIZEMB); symb_table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_TABLEMB); extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB); } #endif sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); #ifdef RE_ENABLE_I18N mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); #endif /* RE_ENABLE_I18N */ #ifdef RE_ENABLE_I18N if (__glibc_unlikely (sbcset == NULL || mbcset == NULL)) #else if (__glibc_unlikely (sbcset == NULL)) #endif /* RE_ENABLE_I18N */ { re_free (sbcset); #ifdef RE_ENABLE_I18N re_free (mbcset); #endif *err = REG_ESPACE; return NULL; } token_len = peek_token_bracket (token, regexp, syntax); if (__glibc_unlikely (token->type == END_OF_RE)) { *err = REG_BADPAT; goto parse_bracket_exp_free_return; } if (token->type == OP_NON_MATCH_LIST) { #ifdef RE_ENABLE_I18N mbcset->non_match = 1; #endif /* not RE_ENABLE_I18N */ non_match = true; if (syntax & RE_HAT_LISTS_NOT_NEWLINE) bitset_set (sbcset, '\n'); re_string_skip_bytes (regexp, token_len); /* Skip a token. */ token_len = peek_token_bracket (token, regexp, syntax); if (__glibc_unlikely (token->type == END_OF_RE)) { *err = REG_BADPAT; goto parse_bracket_exp_free_return; } } /* We treat the first ']' as a normal character. */ if (token->type == OP_CLOSE_BRACKET) token->type = CHARACTER; while (1) { bracket_elem_t start_elem, end_elem; unsigned char start_name_buf[BRACKET_NAME_BUF_SIZE]; unsigned char end_name_buf[BRACKET_NAME_BUF_SIZE]; reg_errcode_t ret; int token_len2 = 0; bool is_range_exp = false; re_token_t token2; start_elem.opr.name = start_name_buf; start_elem.type = COLL_SYM; ret = parse_bracket_element (&start_elem, regexp, token, token_len, dfa, syntax, first_round); if (__glibc_unlikely (ret != REG_NOERROR)) { *err = ret; goto parse_bracket_exp_free_return; } first_round = false; /* Get information about the next token. We need it in any case. */ token_len = peek_token_bracket (token, regexp, syntax); /* Do not check for ranges if we know they are not allowed. */ if (start_elem.type != CHAR_CLASS && start_elem.type != EQUIV_CLASS) { if (__glibc_unlikely (token->type == END_OF_RE)) { *err = REG_EBRACK; goto parse_bracket_exp_free_return; } if (token->type == OP_CHARSET_RANGE) { re_string_skip_bytes (regexp, token_len); /* Skip '-'. */ token_len2 = peek_token_bracket (&token2, regexp, syntax); if (__glibc_unlikely (token2.type == END_OF_RE)) { *err = REG_EBRACK; goto parse_bracket_exp_free_return; } if (token2.type == OP_CLOSE_BRACKET) { /* We treat the last '-' as a normal character. */ re_string_skip_bytes (regexp, -token_len); token->type = CHARACTER; } else is_range_exp = true; } } if (is_range_exp == true) { end_elem.opr.name = end_name_buf; end_elem.type = COLL_SYM; ret = parse_bracket_element (&end_elem, regexp, &token2, token_len2, dfa, syntax, true); if (__glibc_unlikely (ret != REG_NOERROR)) { *err = ret; goto parse_bracket_exp_free_return; } token_len = peek_token_bracket (token, regexp, syntax); #ifdef _LIBC *err = build_range_exp (sbcset, mbcset, &range_alloc, &start_elem, &end_elem); #else # ifdef RE_ENABLE_I18N *err = build_range_exp (syntax, sbcset, dfa->mb_cur_max > 1 ? mbcset : NULL, &range_alloc, &start_elem, &end_elem); # else *err = build_range_exp (syntax, sbcset, &start_elem, &end_elem); # endif #endif /* RE_ENABLE_I18N */ if (__glibc_unlikely (*err != REG_NOERROR)) goto parse_bracket_exp_free_return; } else { switch (start_elem.type) { case SB_CHAR: bitset_set (sbcset, start_elem.opr.ch); break; #ifdef RE_ENABLE_I18N case MB_CHAR: /* Check whether the array has enough space. */ if (__glibc_unlikely (mbchar_alloc == mbcset->nmbchars)) { wchar_t *new_mbchars; /* Not enough, realloc it. */ /* +1 in case of mbcset->nmbchars is 0. */ mbchar_alloc = 2 * mbcset->nmbchars + 1; /* Use realloc since array is NULL if *alloc == 0. */ new_mbchars = re_realloc (mbcset->mbchars, wchar_t, mbchar_alloc); if (__glibc_unlikely (new_mbchars == NULL)) goto parse_bracket_exp_espace; mbcset->mbchars = new_mbchars; } mbcset->mbchars[mbcset->nmbchars++] = start_elem.opr.wch; break; #endif /* RE_ENABLE_I18N */ case EQUIV_CLASS: *err = build_equiv_class (sbcset, #ifdef RE_ENABLE_I18N mbcset, &equiv_class_alloc, #endif /* RE_ENABLE_I18N */ start_elem.opr.name); if (__glibc_unlikely (*err != REG_NOERROR)) goto parse_bracket_exp_free_return; break; case COLL_SYM: *err = build_collating_symbol (sbcset, #ifdef RE_ENABLE_I18N mbcset, &coll_sym_alloc, #endif /* RE_ENABLE_I18N */ start_elem.opr.name); if (__glibc_unlikely (*err != REG_NOERROR)) goto parse_bracket_exp_free_return; break; case CHAR_CLASS: *err = build_charclass (regexp->trans, sbcset, #ifdef RE_ENABLE_I18N mbcset, &char_class_alloc, #endif /* RE_ENABLE_I18N */ (const char *) start_elem.opr.name, syntax); if (__glibc_unlikely (*err != REG_NOERROR)) goto parse_bracket_exp_free_return; break; default: DEBUG_ASSERT (false); break; } } if (__glibc_unlikely (token->type == END_OF_RE)) { *err = REG_EBRACK; goto parse_bracket_exp_free_return; } if (token->type == OP_CLOSE_BRACKET) break; } re_string_skip_bytes (regexp, token_len); /* Skip a token. */ /* If it is non-matching list. */ if (non_match) bitset_not (sbcset); #ifdef RE_ENABLE_I18N /* Ensure only single byte characters are set. */ if (dfa->mb_cur_max > 1) bitset_mask (sbcset, dfa->sb_char); if (mbcset->nmbchars || mbcset->ncoll_syms || mbcset->nequiv_classes || mbcset->nranges || (dfa->mb_cur_max > 1 && (mbcset->nchar_classes || mbcset->non_match))) { bin_tree_t *mbc_tree; int sbc_idx; /* Build a tree for complex bracket. */ dfa->has_mb_node = 1; br_token.type = COMPLEX_BRACKET; br_token.opr.mbcset = mbcset; mbc_tree = create_token_tree (dfa, NULL, NULL, &br_token); if (__glibc_unlikely (mbc_tree == NULL)) goto parse_bracket_exp_espace; for (sbc_idx = 0; sbc_idx < BITSET_WORDS; ++sbc_idx) if (sbcset[sbc_idx]) break; /* If there are no bits set in sbcset, there is no point of having both SIMPLE_BRACKET and COMPLEX_BRACKET. */ if (sbc_idx < BITSET_WORDS) { /* Build a tree for simple bracket. */ br_token.type = SIMPLE_BRACKET; br_token.opr.sbcset = sbcset; work_tree = create_token_tree (dfa, NULL, NULL, &br_token); if (__glibc_unlikely (work_tree == NULL)) goto parse_bracket_exp_espace; /* Then join them by ALT node. */ work_tree = create_tree (dfa, work_tree, mbc_tree, OP_ALT); if (__glibc_unlikely (work_tree == NULL)) goto parse_bracket_exp_espace; } else { re_free (sbcset); work_tree = mbc_tree; } } else #endif /* not RE_ENABLE_I18N */ { #ifdef RE_ENABLE_I18N free_charset (mbcset); #endif /* Build a tree for simple bracket. */ br_token.type = SIMPLE_BRACKET; br_token.opr.sbcset = sbcset; work_tree = create_token_tree (dfa, NULL, NULL, &br_token); if (__glibc_unlikely (work_tree == NULL)) goto parse_bracket_exp_espace; } return work_tree; parse_bracket_exp_espace: *err = REG_ESPACE; parse_bracket_exp_free_return: re_free (sbcset); #ifdef RE_ENABLE_I18N free_charset (mbcset); #endif /* RE_ENABLE_I18N */ return NULL; } /* Parse an element in the bracket expression. */ static reg_errcode_t parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp, re_token_t *token, int token_len, re_dfa_t *dfa, reg_syntax_t syntax, bool accept_hyphen) { #ifdef RE_ENABLE_I18N int cur_char_size; cur_char_size = re_string_char_size_at (regexp, re_string_cur_idx (regexp)); if (cur_char_size > 1) { elem->type = MB_CHAR; elem->opr.wch = re_string_wchar_at (regexp, re_string_cur_idx (regexp)); re_string_skip_bytes (regexp, cur_char_size); return REG_NOERROR; } #endif /* RE_ENABLE_I18N */ re_string_skip_bytes (regexp, token_len); /* Skip a token. */ if (token->type == OP_OPEN_COLL_ELEM || token->type == OP_OPEN_CHAR_CLASS || token->type == OP_OPEN_EQUIV_CLASS) return parse_bracket_symbol (elem, regexp, token); if (__glibc_unlikely (token->type == OP_CHARSET_RANGE) && !accept_hyphen) { /* A '-' must only appear as anything but a range indicator before the closing bracket. Everything else is an error. */ re_token_t token2; (void) peek_token_bracket (&token2, regexp, syntax); if (token2.type != OP_CLOSE_BRACKET) /* The actual error value is not standardized since this whole case is undefined. But ERANGE makes good sense. */ return REG_ERANGE; } elem->type = SB_CHAR; elem->opr.ch = token->opr.c; return REG_NOERROR; } /* Parse a bracket symbol in the bracket expression. Bracket symbols are such as [::], [..], and [==]. */ static reg_errcode_t parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp, re_token_t *token) { unsigned char ch, delim = token->opr.c; int i = 0; if (re_string_eoi(regexp)) return REG_EBRACK; for (;; ++i) { if (i >= BRACKET_NAME_BUF_SIZE) return REG_EBRACK; if (token->type == OP_OPEN_CHAR_CLASS) ch = re_string_fetch_byte_case (regexp); else ch = re_string_fetch_byte (regexp); if (re_string_eoi(regexp)) return REG_EBRACK; if (ch == delim && re_string_peek_byte (regexp, 0) == ']') break; elem->opr.name[i] = ch; } re_string_skip_bytes (regexp, 1); elem->opr.name[i] = '\0'; switch (token->type) { case OP_OPEN_COLL_ELEM: elem->type = COLL_SYM; break; case OP_OPEN_EQUIV_CLASS: elem->type = EQUIV_CLASS; break; case OP_OPEN_CHAR_CLASS: elem->type = CHAR_CLASS; break; default: break; } return REG_NOERROR; } /* Helper function for parse_bracket_exp. Build the equivalence class which is represented by NAME. The result are written to MBCSET and SBCSET. EQUIV_CLASS_ALLOC is the allocated size of mbcset->equiv_classes, is a pointer argument since we may update it. */ static reg_errcode_t #ifdef RE_ENABLE_I18N build_equiv_class (bitset_t sbcset, re_charset_t *mbcset, Idx *equiv_class_alloc, const unsigned char *name) #else /* not RE_ENABLE_I18N */ build_equiv_class (bitset_t sbcset, const unsigned char *name) #endif /* not RE_ENABLE_I18N */ { #ifdef _LIBC uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules != 0) { const int32_t *table, *indirect; const unsigned char *weights, *extra, *cp; unsigned char char_buf[2]; int32_t idx1, idx2; unsigned int ch; size_t len; /* Calculate the index for equivalence class. */ cp = name; table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB); weights = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB); extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); idx1 = findidx (table, indirect, extra, &cp, -1); if (__glibc_unlikely (idx1 == 0 || *cp != '\0')) /* This isn't a valid character. */ return REG_ECOLLATE; /* Build single byte matching table for this equivalence class. */ len = weights[idx1 & 0xffffff]; for (ch = 0; ch < SBC_MAX; ++ch) { char_buf[0] = ch; cp = char_buf; idx2 = findidx (table, indirect, extra, &cp, 1); /* idx2 = table[ch]; */ if (idx2 == 0) /* This isn't a valid character. */ continue; /* Compare only if the length matches and the collation rule index is the same. */ if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24) && memcmp (weights + (idx1 & 0xffffff) + 1, weights + (idx2 & 0xffffff) + 1, len) == 0) bitset_set (sbcset, ch); } /* Check whether the array has enough space. */ if (__glibc_unlikely (*equiv_class_alloc == mbcset->nequiv_classes)) { /* Not enough, realloc it. */ /* +1 in case of mbcset->nequiv_classes is 0. */ Idx new_equiv_class_alloc = 2 * mbcset->nequiv_classes + 1; /* Use realloc since the array is NULL if *alloc == 0. */ int32_t *new_equiv_classes = re_realloc (mbcset->equiv_classes, int32_t, new_equiv_class_alloc); if (__glibc_unlikely (new_equiv_classes == NULL)) return REG_ESPACE; mbcset->equiv_classes = new_equiv_classes; *equiv_class_alloc = new_equiv_class_alloc; } mbcset->equiv_classes[mbcset->nequiv_classes++] = idx1; } else #endif /* _LIBC */ { if (__glibc_unlikely (strlen ((const char *) name) != 1)) return REG_ECOLLATE; bitset_set (sbcset, *name); } return REG_NOERROR; } /* Helper function for parse_bracket_exp. Build the character class which is represented by NAME. The result are written to MBCSET and SBCSET. CHAR_CLASS_ALLOC is the allocated size of mbcset->char_classes, is a pointer argument since we may update it. */ static reg_errcode_t #ifdef RE_ENABLE_I18N build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, re_charset_t *mbcset, Idx *char_class_alloc, const char *class_name, reg_syntax_t syntax) #else /* not RE_ENABLE_I18N */ build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, const char *class_name, reg_syntax_t syntax) #endif /* not RE_ENABLE_I18N */ { int i; const char *name = class_name; /* In case of REG_ICASE "upper" and "lower" match the both of upper and lower cases. */ if ((syntax & RE_ICASE) && (strcmp (name, "upper") == 0 || strcmp (name, "lower") == 0)) name = "alpha"; #ifdef RE_ENABLE_I18N /* Check the space of the arrays. */ if (__glibc_unlikely (*char_class_alloc == mbcset->nchar_classes)) { /* Not enough, realloc it. */ /* +1 in case of mbcset->nchar_classes is 0. */ Idx new_char_class_alloc = 2 * mbcset->nchar_classes + 1; /* Use realloc since array is NULL if *alloc == 0. */ wctype_t *new_char_classes = re_realloc (mbcset->char_classes, wctype_t, new_char_class_alloc); if (__glibc_unlikely (new_char_classes == NULL)) return REG_ESPACE; mbcset->char_classes = new_char_classes; *char_class_alloc = new_char_class_alloc; } mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name); #endif /* RE_ENABLE_I18N */ #define BUILD_CHARCLASS_LOOP(ctype_func) \ do { \ if (__glibc_unlikely (trans != NULL)) \ { \ for (i = 0; i < SBC_MAX; ++i) \ if (ctype_func (i)) \ bitset_set (sbcset, trans[i]); \ } \ else \ { \ for (i = 0; i < SBC_MAX; ++i) \ if (ctype_func (i)) \ bitset_set (sbcset, i); \ } \ } while (0) if (strcmp (name, "alnum") == 0) BUILD_CHARCLASS_LOOP (isalnum); else if (strcmp (name, "cntrl") == 0) BUILD_CHARCLASS_LOOP (iscntrl); else if (strcmp (name, "lower") == 0) BUILD_CHARCLASS_LOOP (islower); else if (strcmp (name, "space") == 0) BUILD_CHARCLASS_LOOP (isspace); else if (strcmp (name, "alpha") == 0) BUILD_CHARCLASS_LOOP (isalpha); else if (strcmp (name, "digit") == 0) BUILD_CHARCLASS_LOOP (isdigit); else if (strcmp (name, "print") == 0) BUILD_CHARCLASS_LOOP (isprint); else if (strcmp (name, "upper") == 0) BUILD_CHARCLASS_LOOP (isupper); else if (strcmp (name, "blank") == 0) BUILD_CHARCLASS_LOOP (isblank); else if (strcmp (name, "graph") == 0) BUILD_CHARCLASS_LOOP (isgraph); else if (strcmp (name, "punct") == 0) BUILD_CHARCLASS_LOOP (ispunct); else if (strcmp (name, "xdigit") == 0) BUILD_CHARCLASS_LOOP (isxdigit); else return REG_ECTYPE; return REG_NOERROR; } static bin_tree_t * build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, const char *class_name, const char *extra, bool non_match, reg_errcode_t *err) { re_bitset_ptr_t sbcset; #ifdef RE_ENABLE_I18N re_charset_t *mbcset; Idx alloc = 0; #endif /* not RE_ENABLE_I18N */ reg_errcode_t ret; bin_tree_t *tree; sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); if (__glibc_unlikely (sbcset == NULL)) { *err = REG_ESPACE; return NULL; } #ifdef RE_ENABLE_I18N mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); if (__glibc_unlikely (mbcset == NULL)) { re_free (sbcset); *err = REG_ESPACE; return NULL; } mbcset->non_match = non_match; #endif /* RE_ENABLE_I18N */ /* We don't care the syntax in this case. */ ret = build_charclass (trans, sbcset, #ifdef RE_ENABLE_I18N mbcset, &alloc, #endif /* RE_ENABLE_I18N */ class_name, 0); if (__glibc_unlikely (ret != REG_NOERROR)) { re_free (sbcset); #ifdef RE_ENABLE_I18N free_charset (mbcset); #endif /* RE_ENABLE_I18N */ *err = ret; return NULL; } /* \w match '_' also. */ for (; *extra; extra++) bitset_set (sbcset, *extra); /* If it is non-matching list. */ if (non_match) bitset_not (sbcset); #ifdef RE_ENABLE_I18N /* Ensure only single byte characters are set. */ if (dfa->mb_cur_max > 1) bitset_mask (sbcset, dfa->sb_char); #endif /* Build a tree for simple bracket. */ re_token_t br_token = { .type = SIMPLE_BRACKET, .opr.sbcset = sbcset }; tree = create_token_tree (dfa, NULL, NULL, &br_token); if (__glibc_unlikely (tree == NULL)) goto build_word_op_espace; #ifdef RE_ENABLE_I18N if (dfa->mb_cur_max > 1) { bin_tree_t *mbc_tree; /* Build a tree for complex bracket. */ br_token.type = COMPLEX_BRACKET; br_token.opr.mbcset = mbcset; dfa->has_mb_node = 1; mbc_tree = create_token_tree (dfa, NULL, NULL, &br_token); if (__glibc_unlikely (mbc_tree == NULL)) goto build_word_op_espace; /* Then join them by ALT node. */ tree = create_tree (dfa, tree, mbc_tree, OP_ALT); if (__glibc_likely (mbc_tree != NULL)) return tree; } else { free_charset (mbcset); return tree; } #else /* not RE_ENABLE_I18N */ return tree; #endif /* not RE_ENABLE_I18N */ build_word_op_espace: re_free (sbcset); #ifdef RE_ENABLE_I18N free_charset (mbcset); #endif /* RE_ENABLE_I18N */ *err = REG_ESPACE; return NULL; } /* This is intended for the expressions like "a{1,3}". Fetch a number from 'input', and return the number. Return -1 if the number field is empty like "{,1}". Return RE_DUP_MAX + 1 if the number field is too large. Return -2 if an error occurred. */ static Idx fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax) { Idx num = -1; unsigned char c; while (1) { fetch_token (token, input, syntax); c = token->opr.c; if (__glibc_unlikely (token->type == END_OF_RE)) return -2; if (token->type == OP_CLOSE_DUP_NUM || c == ',') break; num = ((token->type != CHARACTER || c < '0' || '9' < c || num == -2) ? -2 : num == -1 ? c - '0' : MIN (RE_DUP_MAX + 1, num * 10 + c - '0')); } return num; } #ifdef RE_ENABLE_I18N static void free_charset (re_charset_t *cset) { re_free (cset->mbchars); # ifdef _LIBC re_free (cset->coll_syms); re_free (cset->equiv_classes); # endif re_free (cset->range_starts); re_free (cset->range_ends); re_free (cset->char_classes); re_free (cset); } #endif /* RE_ENABLE_I18N */ /* Functions for binary tree operation. */ /* Create a tree node. */ static bin_tree_t * create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, re_token_type_t type) { re_token_t t = { .type = type }; return create_token_tree (dfa, left, right, &t); } static bin_tree_t * create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, const re_token_t *token) { bin_tree_t *tree; if (__glibc_unlikely (dfa->str_tree_storage_idx == BIN_TREE_STORAGE_SIZE)) { bin_tree_storage_t *storage = re_malloc (bin_tree_storage_t, 1); if (storage == NULL) return NULL; storage->next = dfa->str_tree_storage; dfa->str_tree_storage = storage; dfa->str_tree_storage_idx = 0; } tree = &dfa->str_tree_storage->data[dfa->str_tree_storage_idx++]; tree->parent = NULL; tree->left = left; tree->right = right; tree->token = *token; tree->token.duplicated = 0; tree->token.opt_subexp = 0; tree->first = NULL; tree->next = NULL; tree->node_idx = -1; if (left != NULL) left->parent = tree; if (right != NULL) right->parent = tree; return tree; } /* Mark the tree SRC as an optional subexpression. To be called from preorder or postorder. */ static reg_errcode_t mark_opt_subexp (void *extra, bin_tree_t *node) { Idx idx = (uintptr_t) extra; if (node->token.type == SUBEXP && node->token.opr.idx == idx) node->token.opt_subexp = 1; return REG_NOERROR; } /* Free the allocated memory inside NODE. */ static void free_token (re_token_t *node) { #ifdef RE_ENABLE_I18N if (node->type == COMPLEX_BRACKET && node->duplicated == 0) free_charset (node->opr.mbcset); else #endif /* RE_ENABLE_I18N */ if (node->type == SIMPLE_BRACKET && node->duplicated == 0) re_free (node->opr.sbcset); } /* Worker function for tree walking. Free the allocated memory inside NODE and its children. */ static reg_errcode_t free_tree (void *extra, bin_tree_t *node) { free_token (&node->token); return REG_NOERROR; } /* Duplicate the node SRC, and return new node. This is a preorder visit similar to the one implemented by the generic visitor, but we need more infrastructure to maintain two parallel trees --- so, it's easier to duplicate. */ static bin_tree_t * duplicate_tree (const bin_tree_t *root, re_dfa_t *dfa) { const bin_tree_t *node; bin_tree_t *dup_root; bin_tree_t **p_new = &dup_root, *dup_node = root->parent; for (node = root; ; ) { /* Create a new tree and link it back to the current parent. */ *p_new = create_token_tree (dfa, NULL, NULL, &node->token); if (*p_new == NULL) return NULL; (*p_new)->parent = dup_node; (*p_new)->token.duplicated = 1; dup_node = *p_new; /* Go to the left node, or up and to the right. */ if (node->left) { node = node->left; p_new = &dup_node->left; } else { const bin_tree_t *prev = NULL; while (node->right == prev || node->right == NULL) { prev = node; node = node->parent; dup_node = dup_node->parent; if (!node) return dup_root; } node = node->right; p_new = &dup_node->right; } } } kbuild-3608/src/grep/lib/dev-ino.h0000664000175000017500000000164214670377423016732 0ustar locutuslocutus/* A simple (device, inode) struct. Copyright (C) 2003-2021 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 . */ /* Written by Jim Meyering, 2003. */ #ifndef DEV_INO_H # define DEV_INO_H 1 # include # include struct dev_ino { ino_t st_ino; dev_t st_dev; }; #endif kbuild-3608/src/grep/lib/memchr2.valgrind0000664000175000017500000000214414670377426020306 0ustar locutuslocutus# Suppress a valgrind message about use of uninitialized memory in memchr2(). # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # 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. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # Like memchr, it is safe to overestimate the length when the terminator # is guaranteed to be found. In this case, we may end up reading a word # that is partially uninitialized, but this use is OK for a speedup. { memchr2-value4 Memcheck:Value4 fun:memchr2 } { memchr2-value8 Memcheck:Value8 fun:memchr2 } kbuild-3608/src/grep/lib/xstrtoimax.c0000664000175000017500000000163014670377426017606 0ustar locutuslocutus/* A more useful interface to strtoimax. Copyright (C) 2001-2021 Free Software Foundation, Inc. This file 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 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. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #define __strtol strtoimax #define __strtol_t intmax_t #define __xstrtol xstrtoimax #define STRTOL_T_MINIMUM INTMAX_MIN #define STRTOL_T_MAXIMUM INTMAX_MAX #include "xstrtol.c" kbuild-3608/src/grep/lib/dup.c0000664000175000017500000000363714670377423016162 0ustar locutuslocutus/* Duplicate an open file descriptor. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" #endif #undef dup #if defined _WIN32 && !defined __CYGWIN__ # if HAVE_MSVC_INVALID_PARAMETER_HANDLER static int dup_nothrow (int fd) { int result; TRY_MSVC_INVAL { result = _dup (fd); } CATCH_MSVC_INVAL { result = -1; errno = EBADF; } DONE_MSVC_INVAL; return result; } # else # define dup_nothrow _dup # endif #elif defined __KLIBC__ # include # include # include static int dup_nothrow (int fd) { int dupfd; struct stat sbuf; dupfd = dup (fd); if (dupfd == -1 && errno == ENOTSUP \ && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) { char path[_MAX_PATH]; /* Get a path from fd */ if (!__libc_Back_ioFHToPath (fd, path, sizeof (path))) dupfd = open (path, O_RDONLY); } return dupfd; } #else # define dup_nothrow dup #endif int rpl_dup (int fd) { int result = dup_nothrow (fd); #if REPLACE_FCHDIR if (result >= 0) result = _gl_register_dup (fd, result); #endif return result; } kbuild-3608/src/grep/lib/stat-time.h0000664000175000017500000001702414670377426017304 0ustar locutuslocutus/* stat-related time functions. Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ #ifndef STAT_TIME_H #define STAT_TIME_H 1 #include "intprops.h" #include #include #include #include #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_STAT_TIME_INLINE # define _GL_STAT_TIME_INLINE _GL_INLINE #endif #ifdef __cplusplus extern "C" { #endif /* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST, ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST, if available. ST_XTIM can be st_atim, st_ctim, st_mtim, or st_birthtim for access, status change, data modification, or birth (creation) time respectively. These macros are private to stat-time.h. */ #if _GL_WINDOWS_STAT_TIMESPEC || defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC # if _GL_WINDOWS_STAT_TIMESPEC || defined TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) # else # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec) # endif #elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim##espec) #elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim##ensec) #elif defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.st__tim.tv_nsec) #endif /* Return the nanosecond component of *ST's access time. */ _GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE get_stat_atime_ns (struct stat const *st) { # if defined STAT_TIMESPEC return STAT_TIMESPEC (st, st_atim).tv_nsec; # elif defined STAT_TIMESPEC_NS return STAT_TIMESPEC_NS (st, st_atim); # else return 0; # endif } /* Return the nanosecond component of *ST's status change time. */ _GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE get_stat_ctime_ns (struct stat const *st) { # if defined STAT_TIMESPEC return STAT_TIMESPEC (st, st_ctim).tv_nsec; # elif defined STAT_TIMESPEC_NS return STAT_TIMESPEC_NS (st, st_ctim); # else return 0; # endif } /* Return the nanosecond component of *ST's data modification time. */ _GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE get_stat_mtime_ns (struct stat const *st) { # if defined STAT_TIMESPEC return STAT_TIMESPEC (st, st_mtim).tv_nsec; # elif defined STAT_TIMESPEC_NS return STAT_TIMESPEC_NS (st, st_mtim); # else return 0; # endif } /* Return the nanosecond component of *ST's birth time. */ _GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE get_stat_birthtime_ns (struct stat const *st _GL_UNUSED) { # if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC return STAT_TIMESPEC (st, st_birthtim).tv_nsec; # elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC return STAT_TIMESPEC_NS (st, st_birthtim); # else return 0; # endif } /* Return *ST's access time. */ _GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE get_stat_atime (struct stat const *st) { #ifdef STAT_TIMESPEC return STAT_TIMESPEC (st, st_atim); #else struct timespec t; t.tv_sec = st->st_atime; t.tv_nsec = get_stat_atime_ns (st); return t; #endif } /* Return *ST's status change time. */ _GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE get_stat_ctime (struct stat const *st) { #ifdef STAT_TIMESPEC return STAT_TIMESPEC (st, st_ctim); #else struct timespec t; t.tv_sec = st->st_ctime; t.tv_nsec = get_stat_ctime_ns (st); return t; #endif } /* Return *ST's data modification time. */ _GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE get_stat_mtime (struct stat const *st) { #ifdef STAT_TIMESPEC return STAT_TIMESPEC (st, st_mtim); #else struct timespec t; t.tv_sec = st->st_mtime; t.tv_nsec = get_stat_mtime_ns (st); return t; #endif } /* Return *ST's birth time, if available; otherwise return a value with tv_sec and tv_nsec both equal to -1. */ _GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE get_stat_birthtime (struct stat const *st _GL_UNUSED) { struct timespec t; #if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC) t = STAT_TIMESPEC (st, st_birthtim); #elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC t.tv_sec = st->st_birthtime; t.tv_nsec = st->st_birthtimensec; #elif defined _WIN32 && ! defined __CYGWIN__ /* Native Windows platforms (but not Cygwin) put the "file creation time" in st_ctime (!). See . */ # if _GL_WINDOWS_STAT_TIMESPEC t = st->st_ctim; # else t.tv_sec = st->st_ctime; t.tv_nsec = 0; # endif #else /* Birth time is not supported. */ t.tv_sec = -1; t.tv_nsec = -1; #endif #if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC \ || defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC) /* FreeBSD and NetBSD sometimes signal the absence of knowledge by using zero. Attempt to work around this problem. Alas, this can report failure even for valid timestamps. Also, NetBSD sometimes returns junk in the birth time fields; work around this bug if it is detected. */ if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) { t.tv_sec = -1; t.tv_nsec = -1; } #endif return t; } /* If a stat-like function returned RESULT, normalize the timestamps in *ST, in case this platform suffers from the Solaris 11 bug where tv_nsec might be negative. Return the adjusted RESULT, setting errno to EOVERFLOW if normalization overflowed. This function is intended to be private to this .h file. */ _GL_STAT_TIME_INLINE int stat_time_normalize (int result, struct stat *st _GL_UNUSED) { #if defined __sun && defined STAT_TIMESPEC if (result == 0) { long int timespec_hz = 1000000000; short int const ts_off[] = { offsetof (struct stat, st_atim), offsetof (struct stat, st_mtim), offsetof (struct stat, st_ctim) }; int i; for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++) { struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]); long int q = ts->tv_nsec / timespec_hz; long int r = ts->tv_nsec % timespec_hz; if (r < 0) { r += timespec_hz; q--; } ts->tv_nsec = r; /* Overflow is possible, as Solaris 11 stat can yield tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000. INT_ADD_WRAPV is OK, since time_t is signed on Solaris. */ if (INT_ADD_WRAPV (q, ts->tv_sec, &ts->tv_sec)) { errno = EOVERFLOW; return -1; } } } #endif return result; } #ifdef __cplusplus } #endif _GL_INLINE_HEADER_END #endif kbuild-3608/src/grep/lib/opendirat.c0000664000175000017500000000330014670377425017344 0ustar locutuslocutus/* Open a directory relative to another directory. Copyright 2006-2021 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 . Written by Jim Meyering and Paul Eggert. */ #include #include #include #include #include /* Relative to DIR_FD, open the directory DIR, passing EXTRA_FLAGS to the underlying openat call. On success, store into *PNEW_FD the underlying file descriptor of the newly opened directory and return the directory stream. On failure, return NULL and set errno. On success, *PNEW_FD is at least 3, so this is a "safer" function. */ DIR * opendirat (int dir_fd, char const *dir, int extra_flags, int *pnew_fd) { int open_flags = (O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_NOCTTY | O_NONBLOCK | extra_flags); int new_fd = openat (dir_fd, dir, open_flags); if (new_fd < 0) return NULL; DIR *dirp = fdopendir (new_fd); if (dirp) *pnew_fd = new_fd; else { int fdopendir_errno = errno; close (new_fd); errno = fdopendir_errno; } return dirp; } kbuild-3608/src/grep/lib/strtoumax.c0000664000175000017500000000150214670377426017430 0ustar locutuslocutus/* Convert string representation of a number into a uintmax_t value. Copyright (C) 1999-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #define UNSIGNED 1 #include "strtoimax.c" kbuild-3608/src/grep/lib/stackvma.c0000664000175000017500000016663014670377426017211 0ustar locutuslocutus/* Determine the virtual memory area of a given address. Copyright (C) 2002-2021 Free Software Foundation, Inc. Copyright (C) 2003-2006 Paolo Bonzini 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 2 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 . */ /* Written by Bruno Haible and Paolo Bonzini. */ #include /* On Solaris in 32-bit mode, when gnulib module 'largefile' is in use, prevent a compilation error "Cannot use procfs in the large file compilation environment" On Android, when targeting Android 4.4 or older with a GCC toolchain, prevent a compilation error "error: call to 'mmap' declared with attribute error: mmap is not available with _FILE_OFFSET_BITS=64 when using GCC until android-21. Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or switch to Clang." The files that we access in this compilation unit are less than 2 GB large. */ #if defined __sun || defined __ANDROID__ # undef _FILE_OFFSET_BITS #endif /* Specification. */ #include "stackvma.h" #include #include /* =========================== stackvma-simple.c =========================== */ #if defined __linux__ || defined __ANDROID__ \ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \ || defined __NetBSD__ \ || (defined __APPLE__ && defined __MACH__) \ || defined __sgi || defined __sun \ || defined __CYGWIN__ || defined __HAIKU__ /* This file contains the proximity test function for the simple cases, where the OS has an API for enumerating the mapped ranges of virtual memory. */ # if STACK_DIRECTION < 0 /* Info about the gap between this VMA and the previous one. addr must be < vma->start. */ static int simple_is_near_this (uintptr_t addr, struct vma_struct *vma) { return (vma->start - addr <= (vma->start - vma->prev_end) / 2); } # endif # if STACK_DIRECTION > 0 /* Info about the gap between this VMA and the next one. addr must be > vma->end - 1. */ static int simple_is_near_this (uintptr_t addr, struct vma_struct *vma) { return (addr - vma->end < (vma->next_start - vma->end) / 2); } # endif #endif /* =========================== stackvma-rofile.c =========================== */ /* Buffered read-only streams. */ #if defined __linux__ || defined __ANDROID__ \ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \ || defined __NetBSD__ \ || defined __CYGWIN__ # include /* errno, EINTR */ # include /* open, O_RDONLY */ # include /* size_t */ # include /* getpagesize, lseek, read, close */ # include # include /* mmap, munmap */ # if defined __linux__ || defined __ANDROID__ # include /* PATH_MAX */ # endif /* Buffered read-only streams. We cannot use here, because fopen() calls malloc(), and a malloc() call may have been interrupted. Also, we cannot use multiple read() calls, because if the buffer size is smaller than the file's contents: - On NetBSD, the second read() call would return 0, thus making the file appear truncated. - On DragonFly BSD, the first read() call would fail with errno = EFBIG. - On all platforms, if some other thread is doing memory allocations or deallocations between two read() calls, there is a high risk that the result of these two read() calls don't fit together, and as a consequence we will parse gargage and either omit some VMAs or return VMAs with nonsensical addresses. So use mmap(), and ignore the resulting VMA. The stack-allocated buffer cannot be too large, because this can be called when we are in the context of an alternate stack of just SIGSTKSZ bytes. */ # if defined __linux__ || defined __ANDROID__ /* On Linux, if the file does not entirely fit into the buffer, the read() function stops before the line that would come out truncated. The maximum size of such a line is 73 + PATH_MAX bytes. To be sure that we have read everything, we must verify that at least that many bytes are left when read() returned. */ # define MIN_LEFTOVER (73 + PATH_MAX) # else # define MIN_LEFTOVER 1 # endif # if MIN_LEFTOVER < 1024 # define STACK_ALLOCATED_BUFFER_SIZE 1024 # else /* There is no point in using a stack-allocated buffer if it is too small anyway. */ # define STACK_ALLOCATED_BUFFER_SIZE 1 # endif struct rofile { size_t position; size_t filled; int eof_seen; /* These fields deal with allocation of the buffer. */ char *buffer; char *auxmap; size_t auxmap_length; uintptr_t auxmap_start; uintptr_t auxmap_end; char stack_allocated_buffer[STACK_ALLOCATED_BUFFER_SIZE]; }; /* Open a read-only file stream. */ static int rof_open (struct rofile *rof, const char *filename) { int fd; uintptr_t pagesize; size_t size; fd = open (filename, O_RDONLY); if (fd < 0) return -1; rof->position = 0; rof->eof_seen = 0; /* Try the static buffer first. */ pagesize = 0; rof->buffer = rof->stack_allocated_buffer; size = sizeof (rof->stack_allocated_buffer); rof->auxmap = NULL; rof->auxmap_start = 0; rof->auxmap_end = 0; for (;;) { /* Attempt to read the contents in a single system call. */ if (size > MIN_LEFTOVER) { int n = read (fd, rof->buffer, size); if (n < 0 && errno == EINTR) goto retry; # if defined __DragonFly__ if (!(n < 0 && errno == EFBIG)) # endif { if (n <= 0) /* Empty file. */ goto fail1; if (n + MIN_LEFTOVER <= size) { /* The buffer was sufficiently large. */ rof->filled = n; # if defined __linux__ || defined __ANDROID__ /* On Linux, the read() call may stop even if the buffer was large enough. We need the equivalent of full_read(). */ for (;;) { n = read (fd, rof->buffer + rof->filled, size - rof->filled); if (n < 0 && errno == EINTR) goto retry; if (n < 0) /* Some error. */ goto fail1; if (n + MIN_LEFTOVER > size - rof->filled) /* Allocate a larger buffer. */ break; if (n == 0) { /* Reached the end of file. */ close (fd); return 0; } rof->filled += n; } # else close (fd); return 0; # endif } } } /* Allocate a larger buffer. */ if (pagesize == 0) { pagesize = getpagesize (); size = pagesize; while (size <= MIN_LEFTOVER) size = 2 * size; } else { size = 2 * size; if (size == 0) /* Wraparound. */ goto fail1; if (rof->auxmap != NULL) munmap (rof->auxmap, rof->auxmap_length); } rof->auxmap = (void *) mmap ((void *) 0, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (rof->auxmap == (void *) -1) { close (fd); return -1; } rof->auxmap_length = size; rof->auxmap_start = (uintptr_t) rof->auxmap; rof->auxmap_end = rof->auxmap_start + size; rof->buffer = (char *) rof->auxmap; retry: /* Restart. */ if (lseek (fd, 0, SEEK_SET) < 0) { close (fd); fd = open (filename, O_RDONLY); if (fd < 0) goto fail2; } } fail1: close (fd); fail2: if (rof->auxmap != NULL) munmap (rof->auxmap, rof->auxmap_length); return -1; } /* Return the next byte from a read-only file stream without consuming it, or -1 at EOF. */ static int rof_peekchar (struct rofile *rof) { if (rof->position == rof->filled) { rof->eof_seen = 1; return -1; } return (unsigned char) rof->buffer[rof->position]; } /* Return the next byte from a read-only file stream, or -1 at EOF. */ static int rof_getchar (struct rofile *rof) { int c = rof_peekchar (rof); if (c >= 0) rof->position++; return c; } /* Parse an unsigned hexadecimal number from a read-only file stream. */ static int rof_scanf_lx (struct rofile *rof, uintptr_t *valuep) { uintptr_t value = 0; unsigned int numdigits = 0; for (;;) { int c = rof_peekchar (rof); if (c >= '0' && c <= '9') value = (value << 4) + (c - '0'); else if (c >= 'A' && c <= 'F') value = (value << 4) + (c - 'A' + 10); else if (c >= 'a' && c <= 'f') value = (value << 4) + (c - 'a' + 10); else break; rof_getchar (rof); numdigits++; } if (numdigits == 0) return -1; *valuep = value; return 0; } /* Close a read-only file stream. */ static void rof_close (struct rofile *rof) { if (rof->auxmap != NULL) munmap (rof->auxmap, rof->auxmap_length); } #endif /* ========================== stackvma-vma-iter.c ========================== */ /* Iterate through the virtual memory areas of the current process, by reading from the /proc file system. */ /* This code is a simplified copy (no handling of protection flags) of the code in gnulib's lib/vma-iter.c. */ #if defined __linux__ || defined __ANDROID__ \ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \ || defined __NetBSD__ \ || defined __CYGWIN__ /* Forward declarations. */ struct callback_locals; static int callback (struct callback_locals *locals, uintptr_t start, uintptr_t end); # if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __CYGWIN__ /* GNU/kFreeBSD mounts /proc as linprocfs, which looks like a Linux /proc file system. */ static int vma_iterate_proc (struct callback_locals *locals) { struct rofile rof; /* Open the current process' maps file. It describes one VMA per line. */ if (rof_open (&rof, "/proc/self/maps") >= 0) { uintptr_t auxmap_start = rof.auxmap_start; uintptr_t auxmap_end = rof.auxmap_end; for (;;) { uintptr_t start, end; int c; /* Parse one line. First start and end. */ if (!(rof_scanf_lx (&rof, &start) >= 0 && rof_getchar (&rof) == '-' && rof_scanf_lx (&rof, &end) >= 0)) break; while (c = rof_getchar (&rof), c != -1 && c != '\n') ; if (start <= auxmap_start && auxmap_end - 1 <= end - 1) { /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1] = [start,auxmap_start-1] u [auxmap_end,end-1]. */ if (start < auxmap_start) if (callback (locals, start, auxmap_start)) break; if (auxmap_end - 1 < end - 1) if (callback (locals, auxmap_end, end)) break; } else { if (callback (locals, start, end)) break; } } rof_close (&rof); return 0; } return -1; } # elif defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ static int vma_iterate_proc (struct callback_locals *locals) { struct rofile rof; /* Open the current process' maps file. It describes one VMA per line. On FreeBSD: Cf. On NetBSD, there are two such files: - /proc/curproc/map in near-FreeBSD syntax, - /proc/curproc/maps in Linux syntax. Cf. */ if (rof_open (&rof, "/proc/curproc/map") >= 0) { uintptr_t auxmap_start = rof.auxmap_start; uintptr_t auxmap_end = rof.auxmap_end; for (;;) { uintptr_t start, end; int c; /* Parse one line. First start. */ if (!(rof_getchar (&rof) == '0' && rof_getchar (&rof) == 'x' && rof_scanf_lx (&rof, &start) >= 0)) break; while (c = rof_peekchar (&rof), c == ' ' || c == '\t') rof_getchar (&rof); /* Then end. */ if (!(rof_getchar (&rof) == '0' && rof_getchar (&rof) == 'x' && rof_scanf_lx (&rof, &end) >= 0)) break; while (c = rof_getchar (&rof), c != -1 && c != '\n') ; if (start <= auxmap_start && auxmap_end - 1 <= end - 1) { /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1] = [start,auxmap_start-1] u [auxmap_end,end-1]. */ if (start < auxmap_start) if (callback (locals, start, auxmap_start)) break; if (auxmap_end - 1 < end - 1) if (callback (locals, auxmap_end, end)) break; } else { if (callback (locals, start, end)) break; } } rof_close (&rof); return 0; } return -1; } # endif # if (defined __FreeBSD_kernel__ || defined __FreeBSD__) && defined KERN_PROC_VMMAP /* FreeBSD >= 7.1 */ # include /* struct kinfo_vmentry */ # include /* sysctl */ static int vma_iterate_bsd (struct callback_locals *locals) { /* Documentation: https://www.freebsd.org/cgi/man.cgi?sysctl(3) */ int info_path[] = { CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid () }; size_t len; size_t pagesize; size_t memneed; void *auxmap; unsigned long auxmap_start; unsigned long auxmap_end; char *mem; char *p; char *p_end; len = 0; if (sysctl (info_path, 4, NULL, &len, NULL, 0) < 0) return -1; /* Allow for small variations over time. In a multithreaded program new VMAs can be allocated at any moment. */ len = 2 * len + 200; /* Allocate memneed bytes of memory. We cannot use alloca here, because not much stack space is guaranteed. We also cannot use malloc here, because a malloc() call may call mmap() and thus pre-allocate available memory. So use mmap(), and ignore the resulting VMA. */ pagesize = getpagesize (); memneed = len; memneed = ((memneed - 1) / pagesize + 1) * pagesize; auxmap = (void *) mmap ((void *) 0, memneed, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (auxmap == (void *) -1) return -1; auxmap_start = (unsigned long) auxmap; auxmap_end = auxmap_start + memneed; mem = (char *) auxmap; if (sysctl (info_path, 4, mem, &len, NULL, 0) < 0) { munmap (auxmap, memneed); return -1; } p = mem; p_end = mem + len; while (p < p_end) { struct kinfo_vmentry *kve = (struct kinfo_vmentry *) p; unsigned long start = kve->kve_start; unsigned long end = kve->kve_end; if (start <= auxmap_start && auxmap_end - 1 <= end - 1) { /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1] = [start,auxmap_start-1] u [auxmap_end,end-1]. */ if (start < auxmap_start) if (callback (locals, start, auxmap_start)) break; if (auxmap_end - 1 < end - 1) if (callback (locals, auxmap_end, end)) break; } else { if (callback (locals, start, end)) break; } p += kve->kve_structsize; } munmap (auxmap, memneed); return 0; } # else # define vma_iterate_bsd(locals) (-1) # endif /* Iterate over the virtual memory areas of the current process. If such iteration is supported, the callback is called once for every virtual memory area, in ascending order, with the following arguments: - LOCALS is the same argument as passed to vma_iterate. - START is the address of the first byte in the area, page-aligned. - END is the address of the last byte in the area plus 1, page-aligned. Note that it may be 0 for the last area in the address space. If the callback returns 0, the iteration continues. If it returns 1, the iteration terminates prematurely. This function may open file descriptors, but does not call malloc(). Return 0 if all went well, or -1 in case of error. */ static int vma_iterate (struct callback_locals *locals) { # if defined __FreeBSD__ /* On FreeBSD with procfs (but not GNU/kFreeBSD, which uses linprocfs), the function vma_iterate_proc does not return the virtual memory areas that were created by anonymous mmap. See So use vma_iterate_proc only as a fallback. */ int retval = vma_iterate_bsd (locals); if (retval == 0) return 0; return vma_iterate_proc (locals); # else /* On the other platforms, try the /proc approach first, and the sysctl() as a fallback. */ int retval = vma_iterate_proc (locals); if (retval == 0) return 0; return vma_iterate_bsd (locals); # endif } #endif /* =========================== stackvma-mincore.c =========================== */ /* mincore() is a system call that allows to inquire the status of a range of pages of virtual memory. In particular, it allows to inquire whether a page is mapped at all (except on Mac OS X, where mincore returns 0 even for unmapped addresses). As of 2006, mincore() is supported by: possible bits: - Linux, since Linux 2.4 and glibc 2.2, 1 - Solaris, since Solaris 9, 1 - MacOS X, since MacOS X 10.3 (at least), 1 - FreeBSD, since FreeBSD 6.0, MINCORE_{INCORE,REFERENCED,MODIFIED} - NetBSD, since NetBSD 3.0 (at least), 1 - OpenBSD, since OpenBSD 2.6 (at least), 1 - AIX, since AIX 5.3, 1 As of 2019, also on - Hurd. However, while the API allows to easily determine the bounds of mapped virtual memory, it does not make it easy to find the bounds of _unmapped_ virtual memory ranges. We try to work around this, but it may still be slow. */ #if defined __linux__ || defined __ANDROID__ \ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \ || defined __NetBSD__ /* || defined __OpenBSD__ */ \ /* || (defined __APPLE__ && defined __MACH__) */ \ || defined _AIX || defined __sun # include /* getpagesize, mincore */ # include # include /* mincore */ /* The AIX declaration of mincore() uses 'caddr_t', whereas the other platforms use 'void *'. */ # ifdef _AIX typedef caddr_t MINCORE_ADDR_T; # else typedef void* MINCORE_ADDR_T; # endif /* The glibc and musl declaration of mincore() uses 'unsigned char *', whereas the BSD declaration uses 'char *'. */ # if __GLIBC__ >= 2 || defined __linux__ || defined __ANDROID__ typedef unsigned char pageinfo_t; # else typedef char pageinfo_t; # endif /* Cache for getpagesize(). */ static uintptr_t pagesize; /* Initialize pagesize. */ static void init_pagesize (void) { pagesize = getpagesize (); } /* Test whether the page starting at ADDR is among the address range. ADDR must be a multiple of pagesize. */ static int is_mapped (uintptr_t addr) { pageinfo_t vec[1]; return mincore ((MINCORE_ADDR_T) addr, pagesize, vec) >= 0; } /* Assuming that the page starting at ADDR is among the address range, return the start of its virtual memory range. ADDR must be a multiple of pagesize. */ static uintptr_t mapped_range_start (uintptr_t addr) { /* Use a moderately sized VEC here, small enough that it fits on the stack (without requiring malloc). */ pageinfo_t vec[1024]; uintptr_t stepsize = sizeof (vec); for (;;) { uintptr_t max_remaining; if (addr == 0) return addr; max_remaining = addr / pagesize; if (stepsize > max_remaining) stepsize = max_remaining; if (mincore ((MINCORE_ADDR_T) (addr - stepsize * pagesize), stepsize * pagesize, vec) < 0) /* Time to search in smaller steps. */ break; /* The entire range exists. Continue searching in large steps. */ addr -= stepsize * pagesize; } for (;;) { uintptr_t halfstepsize1; uintptr_t halfstepsize2; if (stepsize == 1) return addr; /* Here we know that less than stepsize pages exist starting at addr. */ halfstepsize1 = (stepsize + 1) / 2; halfstepsize2 = stepsize / 2; /* halfstepsize1 + halfstepsize2 = stepsize. */ if (mincore ((MINCORE_ADDR_T) (addr - halfstepsize1 * pagesize), halfstepsize1 * pagesize, vec) < 0) stepsize = halfstepsize1; else { addr -= halfstepsize1 * pagesize; stepsize = halfstepsize2; } } } /* Assuming that the page starting at ADDR is among the address range, return the end of its virtual memory range + 1. ADDR must be a multiple of pagesize. */ static uintptr_t mapped_range_end (uintptr_t addr) { /* Use a moderately sized VEC here, small enough that it fits on the stack (without requiring malloc). */ pageinfo_t vec[1024]; uintptr_t stepsize = sizeof (vec); addr += pagesize; for (;;) { uintptr_t max_remaining; if (addr == 0) /* wrapped around? */ return addr; max_remaining = (- addr) / pagesize; if (stepsize > max_remaining) stepsize = max_remaining; if (mincore ((MINCORE_ADDR_T) addr, stepsize * pagesize, vec) < 0) /* Time to search in smaller steps. */ break; /* The entire range exists. Continue searching in large steps. */ addr += stepsize * pagesize; } for (;;) { uintptr_t halfstepsize1; uintptr_t halfstepsize2; if (stepsize == 1) return addr; /* Here we know that less than stepsize pages exist starting at addr. */ halfstepsize1 = (stepsize + 1) / 2; halfstepsize2 = stepsize / 2; /* halfstepsize1 + halfstepsize2 = stepsize. */ if (mincore ((MINCORE_ADDR_T) addr, halfstepsize1 * pagesize, vec) < 0) stepsize = halfstepsize1; else { addr += halfstepsize1 * pagesize; stepsize = halfstepsize2; } } } /* Determine whether an address range [ADDR1..ADDR2] is completely unmapped. ADDR1 must be <= ADDR2. */ static int is_unmapped (uintptr_t addr1, uintptr_t addr2) { uintptr_t count; uintptr_t stepsize; /* Round addr1 down. */ addr1 = (addr1 / pagesize) * pagesize; /* Round addr2 up and turn it into an exclusive bound. */ addr2 = ((addr2 / pagesize) + 1) * pagesize; /* This is slow: mincore() does not provide a way to determine the bounds of the gaps directly. So we have to use mincore() on individual pages over and over again. Only after we've verified that all pages are unmapped, we know that the range is completely unmapped. If we were to traverse the pages from bottom to top or from top to bottom, it would be slow even in the average case. To speed up the search, we exploit the fact that mapped memory ranges are larger than one page on average, therefore we have good chances of hitting a mapped area if we traverse only every second, or only fourth page, etc. This doesn't decrease the worst-case runtime, only the average runtime. */ count = (addr2 - addr1) / pagesize; /* We have to test is_mapped (addr1 + i * pagesize) for 0 <= i < count. */ for (stepsize = 1; stepsize < count; ) stepsize = 2 * stepsize; for (;;) { uintptr_t addr_stepsize; uintptr_t i; uintptr_t addr; stepsize = stepsize / 2; if (stepsize == 0) break; addr_stepsize = stepsize * pagesize; for (i = stepsize, addr = addr1 + addr_stepsize; i < count; i += 2 * stepsize, addr += 2 * addr_stepsize) /* Here addr = addr1 + i * pagesize. */ if (is_mapped (addr)) return 0; } return 1; } # if STACK_DIRECTION < 0 /* Info about the gap between this VMA and the previous one. addr must be < vma->start. */ static int mincore_is_near_this (uintptr_t addr, struct vma_struct *vma) { /* vma->start - addr <= (vma->start - vma->prev_end) / 2 is mathematically equivalent to vma->prev_end <= 2 * addr - vma->start <==> is_unmapped (2 * addr - vma->start, vma->start - 1). But be careful about overflow: if 2 * addr - vma->start is negative, we consider a tiny "guard page" mapping [0, 0] to be present around NULL; it intersects the range (2 * addr - vma->start, vma->start - 1), therefore return false. */ uintptr_t testaddr = addr - (vma->start - addr); if (testaddr > addr) /* overflow? */ return 0; /* Here testaddr <= addr < vma->start. */ return is_unmapped (testaddr, vma->start - 1); } # endif # if STACK_DIRECTION > 0 /* Info about the gap between this VMA and the next one. addr must be > vma->end - 1. */ static int mincore_is_near_this (uintptr_t addr, struct vma_struct *vma) { /* addr - vma->end < (vma->next_start - vma->end) / 2 is mathematically equivalent to vma->next_start > 2 * addr - vma->end <==> is_unmapped (vma->end, 2 * addr - vma->end). But be careful about overflow: if 2 * addr - vma->end is > ~0UL, we consider a tiny "guard page" mapping [0, 0] to be present around NULL; it intersects the range (vma->end, 2 * addr - vma->end), therefore return false. */ uintptr_t testaddr = addr + (addr - vma->end); if (testaddr < addr) /* overflow? */ return 0; /* Here vma->end - 1 < addr <= testaddr. */ return is_unmapped (vma->end, testaddr); } # endif static int mincore_get_vma (uintptr_t address, struct vma_struct *vma) { if (pagesize == 0) init_pagesize (); address = (address / pagesize) * pagesize; vma->start = mapped_range_start (address); vma->end = mapped_range_end (address); vma->is_near_this = mincore_is_near_this; return 0; } #endif /* ========================================================================== */ /* ---------------------------- stackvma-linux.c ---------------------------- */ #if defined __linux__ || defined __ANDROID__ /* Linux */ struct callback_locals { uintptr_t address; struct vma_struct *vma; # if STACK_DIRECTION < 0 uintptr_t prev; # else int stop_at_next_vma; # endif int retval; }; static int callback (struct callback_locals *locals, uintptr_t start, uintptr_t end) { # if STACK_DIRECTION < 0 if (locals->address >= start && locals->address <= end - 1) { locals->vma->start = start; locals->vma->end = end; locals->vma->prev_end = locals->prev; locals->retval = 0; return 1; } locals->prev = end; # else if (locals->stop_at_next_vma) { locals->vma->next_start = start; locals->stop_at_next_vma = 0; return 1; } if (locals->address >= start && locals->address <= end - 1) { locals->vma->start = start; locals->vma->end = end; locals->retval = 0; locals->stop_at_next_vma = 1; return 0; } # endif return 0; } int sigsegv_get_vma (uintptr_t address, struct vma_struct *vma) { struct callback_locals locals; locals.address = address; locals.vma = vma; # if STACK_DIRECTION < 0 locals.prev = 0; # else locals.stop_at_next_vma = 0; # endif locals.retval = -1; vma_iterate (&locals); if (locals.retval == 0) { # if !(STACK_DIRECTION < 0) if (locals.stop_at_next_vma) vma->next_start = 0; # endif vma->is_near_this = simple_is_near_this; return 0; } return mincore_get_vma (address, vma); } /* --------------------------- stackvma-freebsd.c --------------------------- */ #elif defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ /* GNU/kFreeBSD, FreeBSD */ struct callback_locals { uintptr_t address; struct vma_struct *vma; /* The stack appears as multiple adjacents segments, therefore we merge adjacent segments. */ uintptr_t curr_start, curr_end; # if STACK_DIRECTION < 0 uintptr_t prev_end; # else int stop_at_next_vma; # endif int retval; }; static int callback (struct callback_locals *locals, uintptr_t start, uintptr_t end) { if (start == locals->curr_end) { /* Merge adjacent segments. */ locals->curr_end = end; return 0; } # if STACK_DIRECTION < 0 if (locals->curr_start < locals->curr_end && locals->address >= locals->curr_start && locals->address <= locals->curr_end - 1) { locals->vma->start = locals->curr_start; locals->vma->end = locals->curr_end; locals->vma->prev_end = locals->prev_end; locals->retval = 0; return 1; } locals->prev_end = locals->curr_end; # else if (locals->stop_at_next_vma) { locals->vma->next_start = locals->curr_start; locals->stop_at_next_vma = 0; return 1; } if (locals->curr_start < locals->curr_end && locals->address >= locals->curr_start && locals->address <= locals->curr_end - 1) { locals->vma->start = locals->curr_start; locals->vma->end = locals->curr_end; locals->retval = 0; locals->stop_at_next_vma = 1; return 0; } # endif locals->curr_start = start; locals->curr_end = end; return 0; } int sigsegv_get_vma (uintptr_t address, struct vma_struct *vma) { struct callback_locals locals; locals.address = address; locals.vma = vma; locals.curr_start = 0; locals.curr_end = 0; # if STACK_DIRECTION < 0 locals.prev_end = 0; # else locals.stop_at_next_vma = 0; # endif locals.retval = -1; vma_iterate (&locals); if (locals.retval < 0) { if (locals.curr_start < locals.curr_end && address >= locals.curr_start && address <= locals.curr_end - 1) { vma->start = locals.curr_start; vma->end = locals.curr_end; # if STACK_DIRECTION < 0 vma->prev_end = locals.prev_end; # else vma->next_start = 0; # endif locals.retval = 0; } } if (locals.retval == 0) { # if !(STACK_DIRECTION < 0) if (locals.stop_at_next_vma) vma->next_start = 0; # endif vma->is_near_this = simple_is_near_this; return 0; } /* FreeBSD 6.[01] doesn't allow to distinguish unmapped pages from mapped but swapped-out pages. See whether it's fixed. */ if (!is_mapped (0)) /* OK, mincore() appears to work as expected. */ return mincore_get_vma (address, vma); return -1; } /* --------------------------- stackvma-netbsd.c --------------------------- */ #elif defined __NetBSD__ /* NetBSD */ struct callback_locals { uintptr_t address; struct vma_struct *vma; /* The stack appears as multiple adjacents segments, therefore we merge adjacent segments. */ uintptr_t curr_start, curr_end; # if STACK_DIRECTION < 0 uintptr_t prev_end; # else int stop_at_next_vma; # endif int retval; }; static int callback (struct callback_locals *locals, uintptr_t start, uintptr_t end) { if (start == locals->curr_end) { /* Merge adjacent segments. */ locals->curr_end = end; return 0; } # if STACK_DIRECTION < 0 if (locals->curr_start < locals->curr_end && locals->address >= locals->curr_start && locals->address <= locals->curr_end - 1) { locals->vma->start = locals->curr_start; locals->vma->end = locals->curr_end; locals->vma->prev_end = locals->prev_end; locals->retval = 0; return 1; } locals->prev_end = locals->curr_end; # else if (locals->stop_at_next_vma) { locals->vma->next_start = locals->curr_start; locals->stop_at_next_vma = 0; return 1; } if (locals->curr_start < locals->curr_end && locals->address >= locals->curr_start && locals->address <= locals->curr_end - 1) { locals->vma->start = locals->curr_start; locals->vma->end = locals->curr_end; locals->retval = 0; locals->stop_at_next_vma = 1; return 0; } # endif locals->curr_start = start; locals->curr_end = end; return 0; } int sigsegv_get_vma (uintptr_t address, struct vma_struct *vma) { struct callback_locals locals; locals.address = address; locals.vma = vma; locals.curr_start = 0; locals.curr_end = 0; # if STACK_DIRECTION < 0 locals.prev_end = 0; # else locals.stop_at_next_vma = 0; # endif locals.retval = -1; vma_iterate (&locals); if (locals.retval < 0) { if (locals.curr_start < locals.curr_end && address >= locals.curr_start && address <= locals.curr_end - 1) { vma->start = locals.curr_start; vma->end = locals.curr_end; # if STACK_DIRECTION < 0 vma->prev_end = locals.prev_end; # else vma->next_start = 0; # endif locals.retval = 0; } } if (locals.retval == 0) { # if !(STACK_DIRECTION < 0) if (locals.stop_at_next_vma) vma->next_start = 0; # endif vma->is_near_this = simple_is_near_this; return 0; } return mincore_get_vma (address, vma); } /* --------------------------- stackvma-mquery.c --------------------------- */ /* mquery() is a system call that allows to inquire the status of a range of pages of virtual memory. In particular, it allows to inquire whether a page is mapped at all, and where is the next unmapped page after a given address. As of 2021, mquery() is supported by: - OpenBSD, since OpenBSD 3.4. Note that this file can give different results. For example, on OpenBSD 4.4 / i386 the stack segment (which starts around 0xcdbfe000) ends at 0xcfbfdfff according to mincore, but at 0xffffffff according to mquery. */ #elif defined __OpenBSD__ /* OpenBSD */ # include /* getpagesize, mincore */ # include # include /* mincore */ /* Cache for getpagesize(). */ static uintptr_t pagesize; /* Initialize pagesize. */ static void init_pagesize (void) { pagesize = getpagesize (); } /* Test whether the page starting at ADDR is among the address range. ADDR must be a multiple of pagesize. */ static int is_mapped (uintptr_t addr) { /* Avoid calling mquery with a NULL first argument, because this argument value has a specific meaning. We know the NULL page is unmapped. */ if (addr == 0) return 0; return mquery ((void *) addr, pagesize, 0, MAP_FIXED, -1, 0) == (void *) -1; } /* Assuming that the page starting at ADDR is among the address range, return the start of its virtual memory range. ADDR must be a multiple of pagesize. */ static uintptr_t mapped_range_start (uintptr_t addr) { uintptr_t stepsize; uintptr_t known_unmapped_page; /* Look at smaller addresses, in larger and larger steps, to minimize the number of mquery() calls. */ stepsize = pagesize; for (;;) { uintptr_t hole; if (addr == 0) abort (); if (addr <= stepsize) { known_unmapped_page = 0; break; } hole = (uintptr_t) mquery ((void *) (addr - stepsize), pagesize, 0, 0, -1, 0); if (!(hole == (uintptr_t) (void *) -1 || hole >= addr)) { /* Some part of [addr - stepsize, addr - 1] is unmapped. */ known_unmapped_page = hole; break; } /* The entire range [addr - stepsize, addr - 1] is mapped. */ addr -= stepsize; if (2 * stepsize > stepsize && 2 * stepsize < addr) stepsize = 2 * stepsize; } /* Now reduce the step size again. We know that the page at known_unmapped_page is unmapped and that 0 < addr - known_unmapped_page <= stepsize. */ while (stepsize > pagesize && stepsize / 2 >= addr - known_unmapped_page) stepsize = stepsize / 2; /* Still 0 < addr - known_unmapped_page <= stepsize. */ while (stepsize > pagesize) { uintptr_t hole; stepsize = stepsize / 2; hole = (uintptr_t) mquery ((void *) (addr - stepsize), pagesize, 0, 0, -1, 0); if (!(hole == (uintptr_t) (void *) -1 || hole >= addr)) /* Some part of [addr - stepsize, addr - 1] is unmapped. */ known_unmapped_page = hole; else /* The entire range [addr - stepsize, addr - 1] is mapped. */ addr -= stepsize; /* Still 0 < addr - known_unmapped_page <= stepsize. */ } return addr; } /* Assuming that the page starting at ADDR is among the address range, return the end of its virtual memory range + 1. ADDR must be a multiple of pagesize. */ static uintptr_t mapped_range_end (uintptr_t addr) { uintptr_t end; if (addr == 0) abort (); end = (uintptr_t) mquery ((void *) addr, pagesize, 0, 0, -1, 0); if (end == (uintptr_t) (void *) -1) end = 0; /* wrap around */ return end; } /* Determine whether an address range [ADDR1..ADDR2] is completely unmapped. ADDR1 must be <= ADDR2. */ static int is_unmapped (uintptr_t addr1, uintptr_t addr2) { /* Round addr1 down. */ addr1 = (addr1 / pagesize) * pagesize; /* Round addr2 up and turn it into an exclusive bound. */ addr2 = ((addr2 / pagesize) + 1) * pagesize; /* Avoid calling mquery with a NULL first argument, because this argument value has a specific meaning. We know the NULL page is unmapped. */ if (addr1 == 0) addr1 = pagesize; if (addr1 < addr2) { if (mquery ((void *) addr1, addr2 - addr1, 0, MAP_FIXED, -1, 0) == (void *) -1) /* Not all the interval [addr1 .. addr2 - 1] is unmapped. */ return 0; else /* The interval [addr1 .. addr2 - 1] is unmapped. */ return 1; } return 1; } # if STACK_DIRECTION < 0 /* Info about the gap between this VMA and the previous one. addr must be < vma->start. */ static int mquery_is_near_this (uintptr_t addr, struct vma_struct *vma) { /* vma->start - addr <= (vma->start - vma->prev_end) / 2 is mathematically equivalent to vma->prev_end <= 2 * addr - vma->start <==> is_unmapped (2 * addr - vma->start, vma->start - 1). But be careful about overflow: if 2 * addr - vma->start is negative, we consider a tiny "guard page" mapping [0, 0] to be present around NULL; it intersects the range (2 * addr - vma->start, vma->start - 1), therefore return false. */ uintptr_t testaddr = addr - (vma->start - addr); if (testaddr > addr) /* overflow? */ return 0; /* Here testaddr <= addr < vma->start. */ return is_unmapped (testaddr, vma->start - 1); } # endif # if STACK_DIRECTION > 0 /* Info about the gap between this VMA and the next one. addr must be > vma->end - 1. */ static int mquery_is_near_this (uintptr_t addr, struct vma_struct *vma) { /* addr - vma->end < (vma->next_start - vma->end) / 2 is mathematically equivalent to vma->next_start > 2 * addr - vma->end <==> is_unmapped (vma->end, 2 * addr - vma->end). But be careful about overflow: if 2 * addr - vma->end is > ~0UL, we consider a tiny "guard page" mapping [0, 0] to be present around NULL; it intersects the range (vma->end, 2 * addr - vma->end), therefore return false. */ uintptr_t testaddr = addr + (addr - vma->end); if (testaddr < addr) /* overflow? */ return 0; /* Here vma->end - 1 < addr <= testaddr. */ return is_unmapped (vma->end, testaddr); } # endif int sigsegv_get_vma (uintptr_t address, struct vma_struct *vma) { if (pagesize == 0) init_pagesize (); address = (address / pagesize) * pagesize; vma->start = mapped_range_start (address); vma->end = mapped_range_end (address); vma->is_near_this = mquery_is_near_this; return 0; } /* ---------------------------- stackvma-mach.c ---------------------------- */ #elif (defined __APPLE__ && defined __MACH__) /* macOS */ #include #include #include #include int sigsegv_get_vma (uintptr_t req_address, struct vma_struct *vma) { uintptr_t prev_address = 0, prev_size = 0; uintptr_t join_address = 0, join_size = 0; int more = 1; vm_address_t address; vm_size_t size; task_t task = mach_task_self (); for (address = VM_MIN_ADDRESS; more; address += size) { mach_port_t object_name; /* In MacOS X 10.5, the types vm_address_t, vm_offset_t, vm_size_t have 32 bits in 32-bit processes and 64 bits in 64-bit processes. Whereas mach_vm_address_t and mach_vm_size_t are always 64 bits large. MacOS X 10.5 has three vm_region like methods: - vm_region. It has arguments that depend on whether the current process is 32-bit or 64-bit. When linking dynamically, this function exists only in 32-bit processes. Therefore we use it only in 32-bit processes. - vm_region_64. It has arguments that depend on whether the current process is 32-bit or 64-bit. It interprets a flavor VM_REGION_BASIC_INFO as VM_REGION_BASIC_INFO_64, which is dangerous since 'struct vm_region_basic_info_64' is larger than 'struct vm_region_basic_info'; therefore let's write VM_REGION_BASIC_INFO_64 explicitly. - mach_vm_region. It has arguments that are 64-bit always. This function is useful when you want to access the VM of a process other than the current process. In 64-bit processes, we could use vm_region_64 or mach_vm_region. I choose vm_region_64 because it uses the same types as vm_region, resulting in less conditional code. */ # if defined __aarch64__ || defined __ppc64__ || defined __x86_64__ struct vm_region_basic_info_64 info; mach_msg_type_number_t info_count = VM_REGION_BASIC_INFO_COUNT_64; more = (vm_region_64 (task, &address, &size, VM_REGION_BASIC_INFO_64, (vm_region_info_t)&info, &info_count, &object_name) == KERN_SUCCESS); # else struct vm_region_basic_info info; mach_msg_type_number_t info_count = VM_REGION_BASIC_INFO_COUNT; more = (vm_region (task, &address, &size, VM_REGION_BASIC_INFO, (vm_region_info_t)&info, &info_count, &object_name) == KERN_SUCCESS); # endif if (!more) { address = join_address + join_size; size = 0; } if ((uintptr_t) address == join_address + join_size) join_size += size; else { prev_address = join_address; prev_size = join_size; join_address = (uintptr_t) address; join_size = size; } if (object_name != MACH_PORT_NULL) mach_port_deallocate (mach_task_self (), object_name); # if STACK_DIRECTION < 0 if (join_address <= req_address && join_address + join_size > req_address) { vma->start = join_address; vma->end = join_address + join_size; vma->prev_end = prev_address + prev_size; vma->is_near_this = simple_is_near_this; return 0; } # else if (prev_address <= req_address && prev_address + prev_size > req_address) { vma->start = prev_address; vma->end = prev_address + prev_size; vma->next_start = join_address; vma->is_near_this = simple_is_near_this; return 0; } # endif } # if STACK_DIRECTION > 0 if (join_address <= req_address && join_address + size > req_address) { vma->start = prev_address; vma->end = prev_address + prev_size; vma->next_start = ~0UL; vma->is_near_this = simple_is_near_this; return 0; } # endif return -1; } /* -------------------------------------------------------------------------- */ #elif defined _AIX /* AIX */ int sigsegv_get_vma (uintptr_t address, struct vma_struct *vma) { return mincore_get_vma (address, vma); } /* --------------------------- stackvma-procfs.h --------------------------- */ #elif defined __sgi || defined __sun /* IRIX, Solaris */ # include /* errno, EINTR */ # include /* open, O_RDONLY */ # include /* size_t */ # include /* getpagesize, getpid, read, close */ # include # include /* mmap, munmap */ # include /* fstat */ # include /* memcpy */ /* Try to use the newer ("structured") /proc filesystem API, if supported. */ # define _STRUCTURED_PROC 1 # include /* prmap_t, optionally PIOC* */ # if !defined __sun /* Cache for getpagesize(). */ static uintptr_t pagesize; /* Initialize pagesize. */ static void init_pagesize (void) { pagesize = getpagesize (); } # endif struct callback_locals { uintptr_t address; struct vma_struct *vma; # if STACK_DIRECTION < 0 uintptr_t prev; # else int stop_at_next_vma; # endif int retval; }; static int callback (struct callback_locals *locals, uintptr_t start, uintptr_t end) { # if STACK_DIRECTION < 0 if (locals->address >= start && locals->address <= end - 1) { locals->vma->start = start; locals->vma->end = end; locals->vma->prev_end = locals->prev; locals->retval = 0; return 1; } locals->prev = end; # else if (locals->stop_at_next_vma) { locals->vma->next_start = start; locals->stop_at_next_vma = 0; return 1; } if (locals->address >= start && locals->address <= end - 1) { locals->vma->start = start; locals->vma->end = end; locals->retval = 0; locals->stop_at_next_vma = 1; return 0; } # endif return 0; } /* Iterate over the virtual memory areas of the current process. If such iteration is supported, the callback is called once for every virtual memory area, in ascending order, with the following arguments: - LOCALS is the same argument as passed to vma_iterate. - START is the address of the first byte in the area, page-aligned. - END is the address of the last byte in the area plus 1, page-aligned. Note that it may be 0 for the last area in the address space. If the callback returns 0, the iteration continues. If it returns 1, the iteration terminates prematurely. This function may open file descriptors, but does not call malloc(). Return 0 if all went well, or -1 in case of error. */ /* This code is a simplified copy (no handling of protection flags) of the code in gnulib's lib/vma-iter.c. */ static int vma_iterate (struct callback_locals *locals) { /* Note: Solaris defines a different type prmap_t with _STRUCTURED_PROC than without! Here's a table of sizeof(prmap_t): 32-bit 64-bit _STRUCTURED_PROC = 0 32 56 _STRUCTURED_PROC = 1 96 104 Therefore, if the include files provide the newer API, prmap_t has the bigger size, and thus you MUST use the newer API. And if the include files provide the older API, prmap_t has the smaller size, and thus you MUST use the older API. */ # if defined PIOCNMAP && defined PIOCMAP /* We must use the older /proc interface. */ char fnamebuf[6+10+1]; char *fname; int fd; int nmaps; size_t memneed; # if HAVE_MAP_ANONYMOUS # define zero_fd -1 # define map_flags MAP_ANONYMOUS # else /* !HAVE_MAP_ANONYMOUS */ int zero_fd; # define map_flags 0 # endif void *auxmap; uintptr_t auxmap_start; uintptr_t auxmap_end; prmap_t* maps; prmap_t* mp; if (pagesize == 0) init_pagesize (); /* Construct fname = sprintf (fnamebuf+i, "/proc/%u", getpid ()). */ fname = fnamebuf + sizeof (fnamebuf) - 1; *fname = '\0'; { unsigned int value = getpid (); do *--fname = (value % 10) + '0'; while ((value = value / 10) > 0); } fname -= 6; memcpy (fname, "/proc/", 6); fd = open (fname, O_RDONLY); if (fd < 0) return -1; if (ioctl (fd, PIOCNMAP, &nmaps) < 0) goto fail2; memneed = (nmaps + 10) * sizeof (prmap_t); /* Allocate memneed bytes of memory. We cannot use alloca here, because not much stack space is guaranteed. We also cannot use malloc here, because a malloc() call may call mmap() and thus pre-allocate available memory. So use mmap(), and ignore the resulting VMA. */ memneed = ((memneed - 1) / pagesize + 1) * pagesize; # if !HAVE_MAP_ANONYMOUS zero_fd = open ("/dev/zero", O_RDONLY, 0644); if (zero_fd < 0) goto fail2; # endif auxmap = (void *) mmap ((void *) 0, memneed, PROT_READ | PROT_WRITE, map_flags | MAP_PRIVATE, zero_fd, 0); # if !HAVE_MAP_ANONYMOUS close (zero_fd); # endif if (auxmap == (void *) -1) goto fail2; auxmap_start = (uintptr_t) auxmap; auxmap_end = auxmap_start + memneed; maps = (prmap_t *) auxmap; if (ioctl (fd, PIOCMAP, maps) < 0) goto fail1; for (mp = maps;;) { uintptr_t start, end; start = (uintptr_t) mp->pr_vaddr; end = start + mp->pr_size; if (start == 0 && end == 0) break; mp++; if (start <= auxmap_start && auxmap_end - 1 <= end - 1) { /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1] = [start,auxmap_start-1] u [auxmap_end,end-1]. */ if (start < auxmap_start) if (callback (locals, start, auxmap_start)) break; if (auxmap_end - 1 < end - 1) if (callback (locals, auxmap_end, end)) break; } else { if (callback (locals, start, end)) break; } } munmap (auxmap, memneed); close (fd); return 0; fail1: munmap (auxmap, memneed); fail2: close (fd); return -1; # else /* We must use the newer /proc interface. Documentation: https://docs.oracle.com/cd/E23824_01/html/821-1473/proc-4.html The contents of /proc//map consists of records of type prmap_t. These are different in 32-bit and 64-bit processes, but here we are fortunately accessing only the current process. */ char fnamebuf[6+10+4+1]; char *fname; int fd; int nmaps; size_t memneed; # if HAVE_MAP_ANONYMOUS # define zero_fd -1 # define map_flags MAP_ANONYMOUS # else /* !HAVE_MAP_ANONYMOUS */ int zero_fd; # define map_flags 0 # endif void *auxmap; uintptr_t auxmap_start; uintptr_t auxmap_end; prmap_t* maps; prmap_t* maps_end; prmap_t* mp; if (pagesize == 0) init_pagesize (); /* Construct fname = sprintf (fnamebuf+i, "/proc/%u/map", getpid ()). */ fname = fnamebuf + sizeof (fnamebuf) - 1 - 4; memcpy (fname, "/map", 4 + 1); { unsigned int value = getpid (); do *--fname = (value % 10) + '0'; while ((value = value / 10) > 0); } fname -= 6; memcpy (fname, "/proc/", 6); fd = open (fname, O_RDONLY); if (fd < 0) return -1; { struct stat statbuf; if (fstat (fd, &statbuf) < 0) goto fail2; nmaps = statbuf.st_size / sizeof (prmap_t); } memneed = (nmaps + 10) * sizeof (prmap_t); /* Allocate memneed bytes of memory. We cannot use alloca here, because not much stack space is guaranteed. We also cannot use malloc here, because a malloc() call may call mmap() and thus pre-allocate available memory. So use mmap(), and ignore the resulting VMA. */ memneed = ((memneed - 1) / pagesize + 1) * pagesize; # if !HAVE_MAP_ANONYMOUS zero_fd = open ("/dev/zero", O_RDONLY, 0644); if (zero_fd < 0) goto fail2; # endif auxmap = (void *) mmap ((void *) 0, memneed, PROT_READ | PROT_WRITE, map_flags | MAP_PRIVATE, zero_fd, 0); # if !HAVE_MAP_ANONYMOUS close (zero_fd); # endif if (auxmap == (void *) -1) goto fail2; auxmap_start = (uintptr_t) auxmap; auxmap_end = auxmap_start + memneed; maps = (prmap_t *) auxmap; /* Read up to memneed bytes from fd into maps. */ { size_t remaining = memneed; size_t total_read = 0; char *ptr = (char *) maps; do { size_t nread = read (fd, ptr, remaining); if (nread == (size_t)-1) { if (errno == EINTR) continue; goto fail1; } if (nread == 0) /* EOF */ break; total_read += nread; ptr += nread; remaining -= nread; } while (remaining > 0); nmaps = (memneed - remaining) / sizeof (prmap_t); maps_end = maps + nmaps; } for (mp = maps; mp < maps_end; mp++) { uintptr_t start, end; start = (uintptr_t) mp->pr_vaddr; end = start + mp->pr_size; if (start <= auxmap_start && auxmap_end - 1 <= end - 1) { /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1] = [start,auxmap_start-1] u [auxmap_end,end-1]. */ if (start < auxmap_start) if (callback (locals, start, auxmap_start)) break; if (auxmap_end - 1 < end - 1) if (callback (locals, auxmap_end, end)) break; } else { if (callback (locals, start, end)) break; } } munmap (auxmap, memneed); close (fd); return 0; fail1: munmap (auxmap, memneed); fail2: close (fd); return -1; # endif } int sigsegv_get_vma (uintptr_t address, struct vma_struct *vma) { struct callback_locals locals; locals.address = address; locals.vma = vma; # if STACK_DIRECTION < 0 locals.prev = 0; # else locals.stop_at_next_vma = 0; # endif locals.retval = -1; vma_iterate (&locals); if (locals.retval == 0) { # if !(STACK_DIRECTION < 0) if (locals.stop_at_next_vma) vma->next_start = 0; # endif vma->is_near_this = simple_is_near_this; return 0; } # if defined __sun return mincore_get_vma (address, vma); # else return -1; # endif } /* -------------------------------------------------------------------------- */ #elif defined __CYGWIN__ /* Cygwin */ struct callback_locals { uintptr_t address; struct vma_struct *vma; /* The stack appears as three adjacents segments, therefore we merge adjacent segments. */ uintptr_t curr_start, curr_end; # if STACK_DIRECTION < 0 uintptr_t prev_end; # else int stop_at_next_vma; # endif int retval; }; static int callback (struct callback_locals *locals, uintptr_t start, uintptr_t end) { if (start == locals->curr_end) { /* Merge adjacent segments. */ locals->curr_end = end; return 0; } # if STACK_DIRECTION < 0 if (locals->curr_start < locals->curr_end && locals->address >= locals->curr_start && locals->address <= locals->curr_end - 1) { locals->vma->start = locals->curr_start; locals->vma->end = locals->curr_end; locals->vma->prev_end = locals->prev_end; locals->retval = 0; return 1; } locals->prev_end = locals->curr_end; # else if (locals->stop_at_next_vma) { locals->vma->next_start = locals->curr_start; locals->stop_at_next_vma = 0; return 1; } if (locals->curr_start < locals->curr_end && locals->address >= locals->curr_start && locals->address <= locals->curr_end - 1) { locals->vma->start = locals->curr_start; locals->vma->end = locals->curr_end; locals->retval = 0; locals->stop_at_next_vma = 1; return 0; } # endif locals->curr_start = start; locals->curr_end = end; return 0; } int sigsegv_get_vma (uintptr_t address, struct vma_struct *vma) { struct callback_locals locals; locals.address = address; locals.vma = vma; locals.curr_start = 0; locals.curr_end = 0; # if STACK_DIRECTION < 0 locals.prev_end = 0; # else locals.stop_at_next_vma = 0; # endif locals.retval = -1; vma_iterate (&locals); if (locals.retval < 0) { if (locals.curr_start < locals.curr_end && address >= locals.curr_start && address <= locals.curr_end - 1) { vma->start = locals.curr_start; vma->end = locals.curr_end; # if STACK_DIRECTION < 0 vma->prev_end = locals.prev_end; # else vma->next_start = 0; # endif locals.retval = 0; } } if (locals.retval == 0) { # if !(STACK_DIRECTION < 0) if (locals.stop_at_next_vma) vma->next_start = 0; # endif vma->is_near_this = simple_is_near_this; return 0; } return -1; } /* ---------------------------- stackvma-beos.h ---------------------------- */ #elif defined __HAIKU__ /* Haiku */ # include /* get_next_area_info */ struct callback_locals { uintptr_t address; struct vma_struct *vma; # if STACK_DIRECTION < 0 uintptr_t prev; # else int stop_at_next_vma; # endif int retval; }; static int callback (struct callback_locals *locals, uintptr_t start, uintptr_t end) { # if STACK_DIRECTION < 0 if (locals->address >= start && locals->address <= end - 1) { locals->vma->start = start; locals->vma->end = end; locals->vma->prev_end = locals->prev; locals->retval = 0; return 1; } locals->prev = end; # else if (locals->stop_at_next_vma) { locals->vma->next_start = start; locals->stop_at_next_vma = 0; return 1; } if (locals->address >= start && locals->address <= end - 1) { locals->vma->start = start; locals->vma->end = end; locals->retval = 0; locals->stop_at_next_vma = 1; return 0; } # endif return 0; } /* Iterate over the virtual memory areas of the current process. If such iteration is supported, the callback is called once for every virtual memory area, in ascending order, with the following arguments: - LOCALS is the same argument as passed to vma_iterate. - START is the address of the first byte in the area, page-aligned. - END is the address of the last byte in the area plus 1, page-aligned. Note that it may be 0 for the last area in the address space. If the callback returns 0, the iteration continues. If it returns 1, the iteration terminates prematurely. This function may open file descriptors, but does not call malloc(). Return 0 if all went well, or -1 in case of error. */ /* This code is a simplified copy (no handling of protection flags) of the code in gnulib's lib/vma-iter.c. */ static int vma_iterate (struct callback_locals *locals) { area_info info; ssize_t cookie; cookie = 0; while (get_next_area_info (0, &cookie, &info) == B_OK) { uintptr_t start, end; start = (uintptr_t) info.address; end = start + info.size; if (callback (locals, start, end)) break; } return 0; } int sigsegv_get_vma (uintptr_t address, struct vma_struct *vma) { struct callback_locals locals; locals.address = address; locals.vma = vma; # if STACK_DIRECTION < 0 locals.prev = 0; # else locals.stop_at_next_vma = 0; # endif locals.retval = -1; vma_iterate (&locals); if (locals.retval == 0) { # if !(STACK_DIRECTION < 0) if (locals.stop_at_next_vma) vma->next_start = 0; # endif vma->is_near_this = simple_is_near_this; return 0; } return -1; } /* -------------------------------------------------------------------------- */ #else /* Hurd, Minix, ... */ int sigsegv_get_vma (uintptr_t address, struct vma_struct *vma) { /* No way. */ return -1; } #endif kbuild-3608/src/grep/lib/localeinfo.h0000664000175000017500000000412714670377424017506 0ustar locutuslocutus/* locale information Copyright 2016-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Paul Eggert. */ #include #include #include struct localeinfo { /* MB_CUR_MAX > 1. */ bool multibyte; /* The locale is simple, like the C locale. These locales can be processed more efficiently, as they are single-byte, their native character set is in collating-sequence order, and they do not have multi-character collating elements. */ bool simple; /* The locale uses UTF-8. */ bool using_utf8; /* An array indexed by byte values B that contains 1 if B is a single-byte character, -1 if B is an encoding error, and -2 if B is the leading byte of a multibyte character that contains more than one byte. */ signed char sbclen[UCHAR_MAX + 1]; /* An array indexed by byte values B that contains the corresponding wide character (if any) for B if sbclen[B] == 1. WEOF means the byte is not a valid single-byte character, i.e., sbclen[B] == -1 or -2. */ wint_t sbctowc[UCHAR_MAX + 1]; }; extern void init_localeinfo (struct localeinfo *); /* Maximum number of characters that can be the case-folded counterparts of a single character, not counting the character itself. This is a generous upper bound. */ enum { CASE_FOLDED_BUFSIZE = 32 }; extern int case_folded_counterparts (wint_t, wchar_t[CASE_FOLDED_BUFSIZE]); kbuild-3608/src/grep/lib/assure.h0000664000175000017500000000362114670377423016672 0ustar locutuslocutus/* Run-time assert-like macros. Copyright (C) 2014-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ #ifndef _GL_ASSURE_H #define _GL_ASSURE_H #include #include "verify.h" /* Evaluate an assertion E that is guaranteed to be true. If NDEBUG is not defined, abort the program if E is false. If NDEBUG is defined, the compiler can assume E and behavior is undefined if E is false, fails to evaluate, or has side effects. Unlike standard 'assert', this macro evaluates E even when NDEBUG is defined, so as to catch typos, avoid some GCC warnings, and improve performance when E is simple enough. Also see the documentation for 'assume' in verify.h. */ #ifdef NDEBUG # define affirm(E) assume (E) #else # define affirm(E) assert (E) #endif /* Check E's value at runtime, and report an error and abort if not. However, do nothing if NDEBUG is defined. Unlike standard 'assert', this macro compiles E even when NDEBUG is defined, so as to catch typos and avoid some GCC warnings. Unlike 'affirm', it is OK for E to use hard-to-optimize features, since E is not executed if NDEBUG is defined. */ #ifdef NDEBUG # define assure(E) ((void) (0 && (E))) #else # define assure(E) assert (E) #endif #endif kbuild-3608/src/grep/lib/filenamecat-lgpl.c0000664000175000017500000000541114670377423020566 0ustar locutuslocutus/* Concatenate two arbitrary file names. Copyright (C) 1996-2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Jim Meyering. */ #include /* Specification. */ #include "filenamecat.h" #include #include #include "basename-lgpl.h" #include "filename.h" #if ! HAVE_MEMPCPY && ! defined mempcpy # define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N))) #endif /* Concatenate two file name components, DIR and BASE, in newly-allocated storage and return the result. The resulting file name F is such that the commands "ls F" and "(cd DIR; ls ./BASE)" refer to the same file. If necessary, put a separator between DIR and BASE in the result. Typically this separator is "/", but in rare cases it might be ".". In any case, if BASE_IN_RESULT is non-NULL, set *BASE_IN_RESULT to point to the copy of BASE at the end of the returned concatenation. If malloc fails, return NULL with errno set. */ char * mfile_name_concat (char const *dir, char const *base, char **base_in_result) { char const *dirbase = last_component (dir); size_t dirbaselen = base_len (dirbase); size_t dirlen = dirbase - dir + dirbaselen; size_t baselen = strlen (base); char sep = '\0'; if (dirbaselen) { /* DIR is not a file system root, so separate with / if needed. */ if (! ISSLASH (dir[dirlen - 1]) && ! ISSLASH (*base)) sep = '/'; } else if (ISSLASH (*base)) { /* DIR is a file system root and BASE begins with a slash, so separate with ".". For example, if DIR is "/" and BASE is "/foo" then return "/./foo", as "//foo" would be wrong on some POSIX systems. A fancier algorithm could omit "." in some cases but is not worth the trouble. */ sep = '.'; } char *p_concat = malloc (dirlen + (sep != '\0') + baselen + 1); if (p_concat == NULL) return NULL; { char *p; p = mempcpy (p_concat, dir, dirlen); *p = sep; p += sep != '\0'; if (base_in_result) *base_in_result = p; p = mempcpy (p, base, baselen); *p = '\0'; } return p_concat; } kbuild-3608/src/grep/lib/mbrtowc.c0000664000175000017500000000716514670377425017051 0ustar locutuslocutus/* Convert multibyte character to wide character. Copyright (C) 1999-2002, 2005-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #if GNULIB_defined_mbstate_t /* Implement mbrtowc() on top of mbtowc() for the non-UTF-8 locales and directly for the UTF-8 locales. */ # include # include # include # if defined _WIN32 && !defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # elif HAVE_PTHREAD_API # include # if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS # include # pragma weak thrd_exit # define c11_threads_in_use() (thrd_exit != NULL) # else # define c11_threads_in_use() 0 # endif # elif HAVE_THREADS_H # include # endif # include "attribute.h" # include "verify.h" # include "lc-charset-dispatch.h" # include "mbtowc-lock.h" verify (sizeof (mbstate_t) >= 4); static char internal_state[4]; size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { # define FITS_IN_CHAR_TYPE(wc) ((wc) <= WCHAR_MAX) # include "mbrtowc-impl.h" } #else /* Override the system's mbrtowc() function. */ # if MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ # include "hard-locale.h" # include # endif # undef mbrtowc size_t rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { size_t ret; wchar_t wc; # if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG || MBRTOWC_EMPTY_INPUT_BUG if (s == NULL) { pwc = NULL; s = ""; n = 1; } # endif # if MBRTOWC_EMPTY_INPUT_BUG if (n == 0) return (size_t) -2; # endif if (! pwc) pwc = &wc; # if MBRTOWC_RETVAL_BUG { static mbstate_t internal_state; /* Override mbrtowc's internal state. We cannot call mbsinit() on the hidden internal state, but we can call it on our variable. */ if (ps == NULL) ps = &internal_state; if (!mbsinit (ps)) { /* Parse the rest of the multibyte character byte for byte. */ size_t count = 0; for (; n > 0; s++, n--) { ret = mbrtowc (&wc, s, 1, ps); if (ret == (size_t)(-1)) return (size_t)(-1); count++; if (ret != (size_t)(-2)) { /* The multibyte character has been completed. */ *pwc = wc; return (wc == 0 ? 0 : count); } } return (size_t)(-2); } } # endif # if MBRTOWC_STORES_INCOMPLETE_BUG ret = mbrtowc (&wc, s, n, ps); if (ret < (size_t) -2 && pwc != NULL) *pwc = wc; # else ret = mbrtowc (pwc, s, n, ps); # endif # if MBRTOWC_NUL_RETVAL_BUG if (ret < (size_t) -2 && !*pwc) return 0; # endif # if MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ if ((size_t) -2 <= ret && n != 0 && ! hard_locale (LC_CTYPE)) { unsigned char uc = *s; *pwc = uc; return 1; } # endif return ret; } #endif kbuild-3608/src/grep/lib/mbtowc-impl.h0000664000175000017500000000265014670377425017625 0ustar locutuslocutus/* Convert multibyte character to wide character. Copyright (C) 2011-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* We don't need a static internal state, because the encoding is not state dependent, and when mbrtowc returns (size_t)(-2). we throw the result away. */ int mbtowc (wchar_t *pwc, const char *s, size_t n) { if (s == NULL) return 0; else { mbstate_t state; wchar_t wc; size_t result; memset (&state, 0, sizeof (mbstate_t)); result = mbrtowc (&wc, s, n, &state); if (result == (size_t)-1 || result == (size_t)-2) { errno = EILSEQ; return -1; } if (pwc != NULL) *pwc = wc; return (wc == 0 ? 0 : result); } } kbuild-3608/src/grep/lib/iconv_close.c0000664000175000017500000000250114670377424017663 0ustar locutuslocutus/* Character set conversion. Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include int rpl_iconv_close (iconv_t cd) #undef iconv_close { #if REPLACE_ICONV_UTF switch ((uintptr_t) cd) { case (uintptr_t) _ICONV_UTF8_UTF16BE: case (uintptr_t) _ICONV_UTF8_UTF16LE: case (uintptr_t) _ICONV_UTF8_UTF32BE: case (uintptr_t) _ICONV_UTF8_UTF32LE: case (uintptr_t) _ICONV_UTF16BE_UTF8: case (uintptr_t) _ICONV_UTF16LE_UTF8: case (uintptr_t) _ICONV_UTF32BE_UTF8: case (uintptr_t) _ICONV_UTF32LE_UTF8: return 0; } #endif return iconv_close (cd); } kbuild-3608/src/grep/lib/opendirat.h0000664000175000017500000000156114670377426017361 0ustar locutuslocutus/* Open a directory relative to another directory. Copyright (C) 2018-2021 Free Software Foundation, Inc. This file 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 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. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include DIR *opendirat (int, char const *, int, int *) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1); kbuild-3608/src/grep/lib/basename-lgpl.c0000664000175000017500000000346514670377422020077 0ustar locutuslocutus/* basename.c -- return the last element in a file name Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "basename-lgpl.h" #include #include #include "filename.h" char * last_component (char const *name) { char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); char const *p; bool last_was_slash = false; while (ISSLASH (*base)) base++; for (p = base; *p; p++) { if (ISSLASH (*p)) last_was_slash = true; else if (last_was_slash) { base = p; last_was_slash = false; } } return (char *) base; } size_t base_len (char const *name) { size_t len; size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) continue; if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1 && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) return 2; if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len && len == prefix_len && ISSLASH (name[prefix_len])) return prefix_len + 1; return len; } kbuild-3608/src/grep/lib/wcrtomb.c0000664000175000017500000000441414670377426017044 0ustar locutuslocutus/* Convert wide character to multibyte character. Copyright (C) 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps) #undef wcrtomb { /* This implementation of wcrtomb supports only stateless encodings. ps must be in the initial state. */ if (ps != NULL && !mbsinit (ps)) { errno = EINVAL; return (size_t)(-1); } #if !HAVE_WCRTOMB /* IRIX 6.5 */ \ || WCRTOMB_RETVAL_BUG /* Solaris 11.3, MSVC */ \ || WCRTOMB_C_LOCALE_BUG /* Android */ if (s == NULL) /* We know the NUL wide character corresponds to the NUL character. */ return 1; else #endif { #if HAVE_WCRTOMB # if WCRTOMB_C_LOCALE_BUG /* Android */ /* Implement consistently with mbrtowc(): through a 1:1 correspondence, as in ISO-8859-1. */ if (wc >= 0 && wc <= 0xff) { *s = (unsigned char) wc; return 1; } else { errno = EILSEQ; return (size_t)(-1); } # else return wcrtomb (s, wc, ps); # endif #else /* IRIX 6.5 */ /* Fallback for platforms that don't have wcrtomb(). Implement on top of wctomb(). This code is not multithread-safe. */ int ret = wctomb (s, wc); if (ret >= 0) return ret; else { errno = EILSEQ; return (size_t)(-1); } #endif } } kbuild-3608/src/grep/lib/propername.h0000664000175000017500000000616714670377426017553 0ustar locutuslocutus/* Localization of proper names. -*- coding: utf-8 -*- Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2006. 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 . */ /* INTRODUCTION What do Torbjörn Granlund (coreutils) François Pinard (coreutils) Danilo Å egan (gettext) have in common? A non-ASCII name. This causes trouble in the --version output. The simple "solution" unfortunately mutilates the name. $ du --version | grep Granlund Écrit par Torbjorn Granlund, David MacKenzie, Paul Eggert et Jim Meyering. $ ptx --version | grep Pinard Écrit par F. Pinard. What is desirable, is to print the full name if the output character set allows it, and the ASCIIfied name only as a fallback. $ recode-sr-latin --version ... Written by Danilo Å egan and Bruno Haible. $ LC_ALL=C recode-sr-latin --version ... Written by Danilo Segan and Bruno Haible. The 'propername' module does exactly this. Plus, for languages that use a different writing system than the Latin alphabet, it allows a translator to write the name using that different writing system. In that case the output will look like this: () To use the 'propername' module requires two simple steps: 1) Add it to the list of gnulib modules to import, 2) Change the arguments of version_etc(), from "Paul Eggert" to proper_name ("Paul Eggert") from "Torbjorn Granlund" to proper_name_utf8 ("Torbjorn Granlund", "Torbj\303\266rn Granlund") from "F. Pinard" to proper_name_utf8 ("Franc,ois Pinard", "Fran\303\247ois Pinard") (Optionally, here you can also add / * TRANSLATORS: ... * / comments explaining how the name is written or pronounced.) */ #ifndef _PROPERNAME_H #define _PROPERNAME_H #ifdef __cplusplus extern "C" { #endif /* Return the localization of NAME. NAME is written in ASCII. */ extern const char * proper_name (const char *name) /* NOT attribute const */; /* Return the localization of a name whose original writing is not ASCII. NAME_UTF8 is the real name, written in UTF-8 with octal or hexadecimal escape sequences. NAME_ASCII is a fallback written only with ASCII characters. */ extern const char * proper_name_utf8 (const char *name_ascii, const char *name_utf8); #ifdef __cplusplus } #endif #endif /* _PROPERNAME_H */ kbuild-3608/src/grep/lib/strstr.c0000664000175000017500000000573514670377426016737 0ustar locutuslocutus/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* This particular implementation was written by Eric Blake, 2008. */ #ifndef _LIBC # include #endif /* Specification of strstr. */ #include #include #define RETURN_TYPE char * #define AVAILABLE(h, h_l, j, n_l) \ (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ && ((h_l) = (j) + (n_l))) #include "str-two-way.h" /* Return the first occurrence of NEEDLE in HAYSTACK. Return HAYSTACK if NEEDLE is empty, otherwise NULL if NEEDLE is not found in HAYSTACK. */ char * strstr (const char *haystack_start, const char *needle_start) { const char *haystack = haystack_start; const char *needle = needle_start; size_t needle_len; /* Length of NEEDLE. */ size_t haystack_len; /* Known minimum length of HAYSTACK. */ bool ok = true; /* True if NEEDLE is prefix of HAYSTACK. */ /* Determine length of NEEDLE, and in the process, make sure HAYSTACK is at least as long (no point processing all of a long NEEDLE if HAYSTACK is too short). */ while (*haystack && *needle) ok &= *haystack++ == *needle++; if (*needle) return NULL; if (ok) return (char *) haystack_start; /* Reduce the size of haystack using strchr, since it has a smaller linear coefficient than the Two-Way algorithm. */ needle_len = needle - needle_start; haystack = strchr (haystack_start + 1, *needle_start); if (!haystack || __builtin_expect (needle_len == 1, 0)) return (char *) haystack; needle -= needle_len; haystack_len = (haystack > haystack_start + needle_len ? 1 : needle_len + haystack_start - haystack); /* Perform the search. Abstract memory is considered to be an array of 'unsigned char' values, not an array of 'char' values. See ISO C 99 section 6.2.6.1. */ if (needle_len < LONG_NEEDLE_THRESHOLD) return two_way_short_needle ((const unsigned char *) haystack, haystack_len, (const unsigned char *) needle, needle_len); return two_way_long_needle ((const unsigned char *) haystack, haystack_len, (const unsigned char *) needle, needle_len); } #undef LONG_NEEDLE_THRESHOLD kbuild-3608/src/grep/lib/windows-rwlock.c0000664000175000017500000002727314670377426020370 0ustar locutuslocutus/* Read-write locks (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-win32.h. */ #include /* Specification. */ #include "windows-rwlock.h" #include #include /* Don't assume that UNICODE is not defined. */ #undef CreateEvent #define CreateEvent CreateEventA /* In this file, the waitqueues are implemented as circular arrays. */ #define glwthread_waitqueue_t glwthread_carray_waitqueue_t static void glwthread_waitqueue_init (glwthread_waitqueue_t *wq) { wq->array = NULL; wq->count = 0; wq->alloc = 0; wq->offset = 0; } /* Enqueues the current thread, represented by an event, in a wait queue. Returns INVALID_HANDLE_VALUE if an allocation failure occurs. */ static HANDLE glwthread_waitqueue_add (glwthread_waitqueue_t *wq) { HANDLE event; unsigned int index; if (wq->count == wq->alloc) { unsigned int new_alloc = 2 * wq->alloc + 1; HANDLE *new_array = (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE)); if (new_array == NULL) /* No more memory. */ return INVALID_HANDLE_VALUE; /* Now is a good opportunity to rotate the array so that its contents starts at offset 0. */ if (wq->offset > 0) { unsigned int old_count = wq->count; unsigned int old_alloc = wq->alloc; unsigned int old_offset = wq->offset; unsigned int i; if (old_offset + old_count > old_alloc) { unsigned int limit = old_offset + old_count - old_alloc; for (i = 0; i < limit; i++) new_array[old_alloc + i] = new_array[i]; } for (i = 0; i < old_count; i++) new_array[i] = new_array[old_offset + i]; wq->offset = 0; } wq->array = new_array; wq->alloc = new_alloc; } /* Whether the created event is a manual-reset one or an auto-reset one, does not matter, since we will wait on it only once. */ event = CreateEvent (NULL, TRUE, FALSE, NULL); if (event == INVALID_HANDLE_VALUE) /* No way to allocate an event. */ return INVALID_HANDLE_VALUE; index = wq->offset + wq->count; if (index >= wq->alloc) index -= wq->alloc; wq->array[index] = event; wq->count++; return event; } /* Notifies the first thread from a wait queue and dequeues it. */ static void glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq) { SetEvent (wq->array[wq->offset + 0]); wq->offset++; wq->count--; if (wq->count == 0 || wq->offset == wq->alloc) wq->offset = 0; } /* Notifies all threads from a wait queue and dequeues them all. */ static void glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq) { unsigned int i; for (i = 0; i < wq->count; i++) { unsigned int index = wq->offset + i; if (index >= wq->alloc) index -= wq->alloc; SetEvent (wq->array[index]); } wq->count = 0; wq->offset = 0; } void glwthread_rwlock_init (glwthread_rwlock_t *lock) { InitializeCriticalSection (&lock->lock); glwthread_waitqueue_init (&lock->waiting_readers); glwthread_waitqueue_init (&lock->waiting_writers); lock->runcount = 0; lock->guard.done = 1; } int glwthread_rwlock_rdlock (glwthread_rwlock_t *lock) { if (!lock->guard.done) { if (InterlockedIncrement (&lock->guard.started) == 0) /* This thread is the first one to need this lock. Initialize it. */ glwthread_rwlock_init (lock); else { /* Don't let lock->guard.started grow and wrap around. */ InterlockedDecrement (&lock->guard.started); /* Yield the CPU while waiting for another thread to finish initializing this lock. */ while (!lock->guard.done) Sleep (0); } } EnterCriticalSection (&lock->lock); /* Test whether only readers are currently running, and whether the runcount field will not overflow, and whether no writer is waiting. The latter condition is because POSIX recommends that "write locks shall take precedence over read locks", to avoid "writer starvation". */ if (!(lock->runcount + 1 > 0 && lock->waiting_writers.count == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_readers. */ HANDLE event = glwthread_waitqueue_add (&lock->waiting_readers); if (event != INVALID_HANDLE_VALUE) { DWORD result; LeaveCriticalSection (&lock->lock); /* Wait until another thread signals this event. */ result = WaitForSingleObject (event, INFINITE); if (result == WAIT_FAILED || result == WAIT_TIMEOUT) abort (); CloseHandle (event); /* The thread which signalled the event already did the bookkeeping: removed us from the waiting_readers, incremented lock->runcount. */ if (!(lock->runcount > 0)) abort (); return 0; } else { /* Allocation failure. Weird. */ do { LeaveCriticalSection (&lock->lock); Sleep (1); EnterCriticalSection (&lock->lock); } while (!(lock->runcount + 1 > 0)); } } lock->runcount++; LeaveCriticalSection (&lock->lock); return 0; } int glwthread_rwlock_wrlock (glwthread_rwlock_t *lock) { if (!lock->guard.done) { if (InterlockedIncrement (&lock->guard.started) == 0) /* This thread is the first one to need this lock. Initialize it. */ glwthread_rwlock_init (lock); else { /* Don't let lock->guard.started grow and wrap around. */ InterlockedDecrement (&lock->guard.started); /* Yield the CPU while waiting for another thread to finish initializing this lock. */ while (!lock->guard.done) Sleep (0); } } EnterCriticalSection (&lock->lock); /* Test whether no readers or writers are currently running. */ if (!(lock->runcount == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_writers. */ HANDLE event = glwthread_waitqueue_add (&lock->waiting_writers); if (event != INVALID_HANDLE_VALUE) { DWORD result; LeaveCriticalSection (&lock->lock); /* Wait until another thread signals this event. */ result = WaitForSingleObject (event, INFINITE); if (result == WAIT_FAILED || result == WAIT_TIMEOUT) abort (); CloseHandle (event); /* The thread which signalled the event already did the bookkeeping: removed us from the waiting_writers, set lock->runcount = -1. */ if (!(lock->runcount == -1)) abort (); return 0; } else { /* Allocation failure. Weird. */ do { LeaveCriticalSection (&lock->lock); Sleep (1); EnterCriticalSection (&lock->lock); } while (!(lock->runcount == 0)); } } lock->runcount--; /* runcount becomes -1 */ LeaveCriticalSection (&lock->lock); return 0; } int glwthread_rwlock_tryrdlock (glwthread_rwlock_t *lock) { if (!lock->guard.done) { if (InterlockedIncrement (&lock->guard.started) == 0) /* This thread is the first one to need this lock. Initialize it. */ glwthread_rwlock_init (lock); else { /* Don't let lock->guard.started grow and wrap around. */ InterlockedDecrement (&lock->guard.started); /* Yield the CPU while waiting for another thread to finish initializing this lock. */ while (!lock->guard.done) Sleep (0); } } /* It's OK to wait for this critical section, because it is never taken for a long time. */ EnterCriticalSection (&lock->lock); /* Test whether only readers are currently running, and whether the runcount field will not overflow, and whether no writer is waiting. The latter condition is because POSIX recommends that "write locks shall take precedence over read locks", to avoid "writer starvation". */ if (!(lock->runcount + 1 > 0 && lock->waiting_writers.count == 0)) { /* This thread would have to wait for a while. Return instead. */ LeaveCriticalSection (&lock->lock); return EBUSY; } lock->runcount++; LeaveCriticalSection (&lock->lock); return 0; } int glwthread_rwlock_trywrlock (glwthread_rwlock_t *lock) { if (!lock->guard.done) { if (InterlockedIncrement (&lock->guard.started) == 0) /* This thread is the first one to need this lock. Initialize it. */ glwthread_rwlock_init (lock); else { /* Don't let lock->guard.started grow and wrap around. */ InterlockedDecrement (&lock->guard.started); /* Yield the CPU while waiting for another thread to finish initializing this lock. */ while (!lock->guard.done) Sleep (0); } } /* It's OK to wait for this critical section, because it is never taken for a long time. */ EnterCriticalSection (&lock->lock); /* Test whether no readers or writers are currently running. */ if (!(lock->runcount == 0)) { /* This thread would have to wait for a while. Return instead. */ LeaveCriticalSection (&lock->lock); return EBUSY; } lock->runcount--; /* runcount becomes -1 */ LeaveCriticalSection (&lock->lock); return 0; } int glwthread_rwlock_unlock (glwthread_rwlock_t *lock) { if (!lock->guard.done) return EINVAL; EnterCriticalSection (&lock->lock); if (lock->runcount < 0) { /* Drop a writer lock. */ if (!(lock->runcount == -1)) abort (); lock->runcount = 0; } else { /* Drop a reader lock. */ if (!(lock->runcount > 0)) { LeaveCriticalSection (&lock->lock); return EPERM; } lock->runcount--; } if (lock->runcount == 0) { /* POSIX recommends that "write locks shall take precedence over read locks", to avoid "writer starvation". */ if (lock->waiting_writers.count > 0) { /* Wake up one of the waiting writers. */ lock->runcount--; glwthread_waitqueue_notify_first (&lock->waiting_writers); } else { /* Wake up all waiting readers. */ lock->runcount += lock->waiting_readers.count; glwthread_waitqueue_notify_all (&lock->waiting_readers); } } LeaveCriticalSection (&lock->lock); return 0; } int glwthread_rwlock_destroy (glwthread_rwlock_t *lock) { if (!lock->guard.done) return EINVAL; if (lock->runcount != 0) return EBUSY; DeleteCriticalSection (&lock->lock); if (lock->waiting_readers.array != NULL) free (lock->waiting_readers.array); if (lock->waiting_writers.array != NULL) free (lock->waiting_writers.array); lock->guard.done = 0; return 0; } kbuild-3608/src/grep/lib/gnulib.mk0000664000175000017500000033213314670377423017033 0ustar locutuslocutus## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file 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 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. # # You should have received a copy of the GNU General Public License # along with this file. If not, see . # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that # contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. # Reproduce by: # gnulib-tool --import --local-dir=gl \ # --lib=libgreputils \ # --source-base=lib \ # --m4-base=m4 \ # --doc-base=doc \ # --tests-base=gnulib-tests \ # --aux-dir=build-aux \ # --with-tests \ # --makefile-name=gnulib.mk \ # --no-conditional-dependencies \ # --no-libtool \ # --macro-prefix=gl \ # --avoid=lock-tests \ # --avoid=mbrtowc-tests \ # --avoid=update-copyright-tests \ # alloca \ # announce-gen \ # argmatch \ # c-ctype \ # c-stack \ # c-strcase \ # closeout \ # configmake \ # dfa \ # dirname-lgpl \ # do-release-commit-and-tag \ # error \ # exclude \ # fcntl-h \ # fdl \ # fnmatch \ # fstatat \ # fts \ # getopt-gnu \ # getpagesize \ # getprogname \ # gettext-h \ # git-version-gen \ # gitlog-to-changelog \ # gnu-web-doc-update \ # gnupload \ # hash \ # ignore-value \ # intprops \ # inttypes \ # isatty \ # isblank \ # iswctype \ # largefile \ # locale \ # lseek \ # maintainer-makefile \ # malloc-gnu \ # manywarnings \ # mbrlen \ # mbrtowc \ # memchr \ # memchr2 \ # mempcpy \ # minmax \ # obstack \ # openat-safer \ # perl \ # propername \ # rawmemchr \ # readme-release \ # realloc-gnu \ # regex \ # safe-read \ # same-inode \ # ssize_t \ # stddef \ # stdlib \ # stpcpy \ # strerror \ # string \ # strstr \ # strtoull \ # strtoumax \ # sys_stat \ # unistd \ # unlocked-io \ # update-copyright \ # useless-if-before-free \ # verify \ # version-etc-fsf \ # wchar \ # wcrtomb \ # wctob \ # wctype-h \ # windows-stat-inodes \ # xalloc \ # xbinary-io \ # xstrtoimax MOSTLYCLEANFILES += core *.stackdump # No GNU Make output. noinst_LIBRARIES += libgreputils.a libgreputils_a_SOURCES = libgreputils_a_LIBADD = $(gl_LIBOBJS) libgreputils_a_DEPENDENCIES = $(gl_LIBOBJS) EXTRA_libgreputils_a_SOURCES = ## begin gnulib module absolute-header # Use this preprocessor expression to decide whether #include_next works. # Do not rely on a 'configure'-time test for this, since the expression # might appear in an installed header, which is used by some other compiler. HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER) ## end gnulib module absolute-header ## begin gnulib module alignof EXTRA_DIST += alignof.h ## end gnulib module alignof ## begin gnulib module alloca libgreputils_a_LIBADD += @ALLOCA@ libgreputils_a_DEPENDENCIES += @ALLOCA@ EXTRA_DIST += alloca.c EXTRA_libgreputils_a_SOURCES += alloca.c ## end gnulib module alloca ## begin gnulib module alloca-opt BUILT_SOURCES += $(ALLOCA_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. if GL_GENERATE_ALLOCA_H alloca.h: alloca.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < $(srcdir)/alloca.in.h; \ } > $@-t && \ mv -f $@-t $@ else alloca.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += alloca.h alloca.h-t EXTRA_DIST += alloca.in.h ## end gnulib module alloca-opt ## begin gnulib module announce-gen EXTRA_DIST += $(top_srcdir)/build-aux/announce-gen ## end gnulib module announce-gen ## begin gnulib module argmatch libgreputils_a_SOURCES += argmatch.c EXTRA_DIST += argmatch.h ## end gnulib module argmatch ## begin gnulib module assure EXTRA_DIST += assure.h ## end gnulib module assure ## begin gnulib module at-internal libgreputils_a_SOURCES += openat-priv.h openat-proc.c ## end gnulib module at-internal ## begin gnulib module attribute EXTRA_DIST += attribute.h ## end gnulib module attribute ## begin gnulib module basename-lgpl libgreputils_a_SOURCES += basename-lgpl.c EXTRA_DIST += basename-lgpl.h ## end gnulib module basename-lgpl ## begin gnulib module binary-io libgreputils_a_SOURCES += binary-io.h binary-io.c ## end gnulib module binary-io ## begin gnulib module bitrotate libgreputils_a_SOURCES += bitrotate.h bitrotate.c ## end gnulib module bitrotate ## begin gnulib module btowc EXTRA_DIST += btowc.c EXTRA_libgreputils_a_SOURCES += btowc.c ## end gnulib module btowc ## begin gnulib module c-ctype libgreputils_a_SOURCES += c-ctype.h c-ctype.c ## end gnulib module c-ctype ## begin gnulib module c-stack libgreputils_a_SOURCES += c-stack.h c-stack.c ## end gnulib module c-stack ## begin gnulib module c-strcase libgreputils_a_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c ## end gnulib module c-strcase ## begin gnulib module c-strcaseeq EXTRA_DIST += c-strcaseeq.h ## end gnulib module c-strcaseeq ## begin gnulib module calloc-gnu EXTRA_DIST += calloc.c EXTRA_libgreputils_a_SOURCES += calloc.c ## end gnulib module calloc-gnu ## begin gnulib module calloc-posix EXTRA_DIST += calloc.c EXTRA_libgreputils_a_SOURCES += calloc.c ## end gnulib module calloc-posix ## begin gnulib module chdir-long EXTRA_DIST += chdir-long.c chdir-long.h EXTRA_libgreputils_a_SOURCES += chdir-long.c ## end gnulib module chdir-long ## begin gnulib module cloexec libgreputils_a_SOURCES += cloexec.c EXTRA_DIST += cloexec.h ## end gnulib module cloexec ## begin gnulib module close EXTRA_DIST += close.c EXTRA_libgreputils_a_SOURCES += close.c ## end gnulib module close ## begin gnulib module close-stream libgreputils_a_SOURCES += close-stream.c EXTRA_DIST += close-stream.h ## end gnulib module close-stream ## begin gnulib module closedir EXTRA_DIST += closedir.c dirent-private.h EXTRA_libgreputils_a_SOURCES += closedir.c ## end gnulib module closedir ## begin gnulib module closeout libgreputils_a_SOURCES += closeout.c EXTRA_DIST += closeout.h ## end gnulib module closeout ## begin gnulib module configmake # Listed in the same order as the GNU makefile conventions, and # provided by autoconf 2.59c+ or 2.70. # The Automake-defined pkg* macros are appended, in the order # listed in the Automake 1.10a+ documentation. configmake.h: Makefile $(AM_V_GEN)rm -f $@-t && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ echo '#if HAVE_WINSOCK2_H'; \ echo '# include /* avoid mingw pollution on DATADIR */'; \ echo '#endif'; \ echo '#define PREFIX "$(prefix)"'; \ echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ echo '#define BINDIR "$(bindir)"'; \ echo '#define SBINDIR "$(sbindir)"'; \ echo '#define LIBEXECDIR "$(libexecdir)"'; \ echo '#define DATAROOTDIR "$(datarootdir)"'; \ echo '#define DATADIR "$(datadir)"'; \ echo '#define SYSCONFDIR "$(sysconfdir)"'; \ echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \ echo '#define LOCALSTATEDIR "$(localstatedir)"'; \ echo '#define RUNSTATEDIR "$(runstatedir)"'; \ echo '#define INCLUDEDIR "$(includedir)"'; \ echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \ echo '#define DOCDIR "$(docdir)"'; \ echo '#define INFODIR "$(infodir)"'; \ echo '#define HTMLDIR "$(htmldir)"'; \ echo '#define DVIDIR "$(dvidir)"'; \ echo '#define PDFDIR "$(pdfdir)"'; \ echo '#define PSDIR "$(psdir)"'; \ echo '#define LIBDIR "$(libdir)"'; \ echo '#define LISPDIR "$(lispdir)"'; \ echo '#define LOCALEDIR "$(localedir)"'; \ echo '#define MANDIR "$(mandir)"'; \ echo '#define MANEXT "$(manext)"'; \ echo '#define PKGDATADIR "$(pkgdatadir)"'; \ echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \ echo '#define PKGLIBDIR "$(pkglibdir)"'; \ echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ } | sed '/""/d' > $@-t && \ mv -f $@-t $@ BUILT_SOURCES += configmake.h CLEANFILES += configmake.h configmake.h-t ## end gnulib module configmake ## begin gnulib module ctype BUILT_SOURCES += ctype.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. ctype.h: ctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \ -e 's/@''GNULIB_ISBLANK''@/$(GL_GNULIB_ISBLANK)/g' \ -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/ctype.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += ctype.h ctype.h-t EXTRA_DIST += ctype.in.h ## end gnulib module ctype ## begin gnulib module cycle-check libgreputils_a_SOURCES += cycle-check.c EXTRA_DIST += cycle-check.h ## end gnulib module cycle-check ## begin gnulib module dev-ino EXTRA_DIST += dev-ino.h ## end gnulib module dev-ino ## begin gnulib module dfa libgreputils_a_SOURCES += dfa.c localeinfo.c EXTRA_DIST += dfa.h localeinfo.h ## end gnulib module dfa ## begin gnulib module dirent BUILT_SOURCES += dirent.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_DIRENT_H''@|$(HAVE_DIRENT_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \ -e 's/@''GNULIB_OPENDIR''@/$(GL_GNULIB_OPENDIR)/g' \ -e 's/@''GNULIB_READDIR''@/$(GL_GNULIB_READDIR)/g' \ -e 's/@''GNULIB_REWINDDIR''@/$(GL_GNULIB_REWINDDIR)/g' \ -e 's/@''GNULIB_CLOSEDIR''@/$(GL_GNULIB_CLOSEDIR)/g' \ -e 's/@''GNULIB_DIRFD''@/$(GL_GNULIB_DIRFD)/g' \ -e 's/@''GNULIB_FDOPENDIR''@/$(GL_GNULIB_FDOPENDIR)/g' \ -e 's/@''GNULIB_SCANDIR''@/$(GL_GNULIB_SCANDIR)/g' \ -e 's/@''GNULIB_ALPHASORT''@/$(GL_GNULIB_ALPHASORT)/g' \ -e 's/@''HAVE_OPENDIR''@/$(HAVE_OPENDIR)/g' \ -e 's/@''HAVE_READDIR''@/$(HAVE_READDIR)/g' \ -e 's/@''HAVE_REWINDDIR''@/$(HAVE_REWINDDIR)/g' \ -e 's/@''HAVE_CLOSEDIR''@/$(HAVE_CLOSEDIR)/g' \ -e 's|@''HAVE_DECL_DIRFD''@|$(HAVE_DECL_DIRFD)|g' \ -e 's|@''HAVE_DECL_FDOPENDIR''@|$(HAVE_DECL_FDOPENDIR)|g' \ -e 's|@''HAVE_FDOPENDIR''@|$(HAVE_FDOPENDIR)|g' \ -e 's|@''HAVE_SCANDIR''@|$(HAVE_SCANDIR)|g' \ -e 's|@''HAVE_ALPHASORT''@|$(HAVE_ALPHASORT)|g' \ -e 's|@''REPLACE_OPENDIR''@|$(REPLACE_OPENDIR)|g' \ -e 's|@''REPLACE_CLOSEDIR''@|$(REPLACE_CLOSEDIR)|g' \ -e 's|@''REPLACE_DIRFD''@|$(REPLACE_DIRFD)|g' \ -e 's|@''REPLACE_FDOPENDIR''@|$(REPLACE_FDOPENDIR)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/dirent.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += dirent.h dirent.h-t EXTRA_DIST += dirent.in.h ## end gnulib module dirent ## begin gnulib module dirfd EXTRA_DIST += dirfd.c EXTRA_libgreputils_a_SOURCES += dirfd.c ## end gnulib module dirfd ## begin gnulib module dirname-lgpl libgreputils_a_SOURCES += dirname-lgpl.c stripslash.c EXTRA_DIST += dirname.h ## end gnulib module dirname-lgpl ## begin gnulib module do-release-commit-and-tag EXTRA_DIST += $(top_srcdir)/build-aux/do-release-commit-and-tag ## end gnulib module do-release-commit-and-tag ## begin gnulib module dup EXTRA_DIST += dup.c EXTRA_libgreputils_a_SOURCES += dup.c ## end gnulib module dup ## begin gnulib module dup2 EXTRA_DIST += dup2.c EXTRA_libgreputils_a_SOURCES += dup2.c ## end gnulib module dup2 ## begin gnulib module dynarray BUILT_SOURCES += malloc/dynarray.gl.h malloc/dynarray-skeleton.gl.h malloc/dynarray.gl.h: malloc/dynarray.h $(AM_V_at)$(MKDIR_P) malloc $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e '/libc_hidden_proto/d' < $(srcdir)/malloc/dynarray.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += malloc/dynarray.gl.h malloc/dynarray.gl.h-t malloc/dynarray-skeleton.gl.h: malloc/dynarray-skeleton.c $(AM_V_at)$(MKDIR_P) malloc $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|||g' \ -e 's|__attribute_maybe_unused__|_GL_ATTRIBUTE_MAYBE_UNUSED|g' \ -e 's|__attribute_nonnull__|_GL_ATTRIBUTE_NONNULL|g' \ -e 's|__attribute_warn_unused_result__|_GL_ATTRIBUTE_NODISCARD|g' \ -e 's|__glibc_likely|_GL_LIKELY|g' \ -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \ < $(srcdir)/malloc/dynarray-skeleton.c; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += malloc/dynarray-skeleton.gl.h malloc/dynarray-skeleton.gl.h-t libgreputils_a_SOURCES += malloc/dynarray_at_failure.c malloc/dynarray_emplace_enlarge.c malloc/dynarray_finalize.c malloc/dynarray_resize.c malloc/dynarray_resize_clear.c EXTRA_DIST += dynarray.h malloc/dynarray-skeleton.c malloc/dynarray.h EXTRA_libgreputils_a_SOURCES += malloc/dynarray-skeleton.c ## end gnulib module dynarray ## begin gnulib module errno BUILT_SOURCES += $(ERRNO_H) # We need the following in order to create when the system # doesn't have one that is POSIX compliant. if GL_GENERATE_ERRNO_H errno.h: errno.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ < $(srcdir)/errno.in.h; \ } > $@-t && \ mv $@-t $@ else errno.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += errno.h errno.h-t EXTRA_DIST += errno.in.h ## end gnulib module errno ## begin gnulib module error EXTRA_DIST += error.c error.h EXTRA_libgreputils_a_SOURCES += error.c ## end gnulib module error ## begin gnulib module exclude libgreputils_a_SOURCES += exclude.c EXTRA_DIST += exclude.h ## end gnulib module exclude ## begin gnulib module exitfail libgreputils_a_SOURCES += exitfail.c EXTRA_DIST += exitfail.h ## end gnulib module exitfail ## begin gnulib module fchdir EXTRA_DIST += fchdir.c EXTRA_libgreputils_a_SOURCES += fchdir.c ## end gnulib module fchdir ## begin gnulib module fcntl EXTRA_DIST += fcntl.c EXTRA_libgreputils_a_SOURCES += fcntl.c ## end gnulib module fcntl ## begin gnulib module fcntl-h BUILT_SOURCES += fcntl.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ -e 's/@''GNULIB_CREAT''@/$(GL_GNULIB_CREAT)/g' \ -e 's/@''GNULIB_FCNTL''@/$(GL_GNULIB_FCNTL)/g' \ -e 's/@''GNULIB_NONBLOCKING''@/$(GL_GNULIB_NONBLOCKING)/g' \ -e 's/@''GNULIB_OPEN''@/$(GL_GNULIB_OPEN)/g' \ -e 's/@''GNULIB_OPENAT''@/$(GL_GNULIB_OPENAT)/g' \ -e 's/@''GNULIB_MDA_CREAT''@/$(GL_GNULIB_MDA_CREAT)/g' \ -e 's/@''GNULIB_MDA_OPEN''@/$(GL_GNULIB_MDA_OPEN)/g' \ -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/fcntl.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += fcntl.h fcntl.h-t EXTRA_DIST += fcntl.in.h ## end gnulib module fcntl-h ## begin gnulib module fcntl-safer libgreputils_a_SOURCES += creat-safer.c open-safer.c EXTRA_DIST += fcntl--.h fcntl-safer.h ## end gnulib module fcntl-safer ## begin gnulib module fd-hook libgreputils_a_SOURCES += fd-hook.c EXTRA_DIST += fd-hook.h ## end gnulib module fd-hook ## begin gnulib module fd-safer-flag libgreputils_a_SOURCES += fd-safer-flag.c dup-safer-flag.c ## end gnulib module fd-safer-flag ## begin gnulib module fdopendir EXTRA_DIST += fdopendir.c EXTRA_libgreputils_a_SOURCES += fdopendir.c ## end gnulib module fdopendir ## begin gnulib module filename EXTRA_DIST += filename.h ## end gnulib module filename ## begin gnulib module filenamecat-lgpl libgreputils_a_SOURCES += filenamecat-lgpl.c EXTRA_DIST += filenamecat.h ## end gnulib module filenamecat-lgpl ## begin gnulib module flexmember EXTRA_DIST += flexmember.h ## end gnulib module flexmember ## begin gnulib module fnmatch EXTRA_DIST += fnmatch.c fnmatch_loop.c EXTRA_libgreputils_a_SOURCES += fnmatch.c fnmatch_loop.c ## end gnulib module fnmatch ## begin gnulib module fnmatch-h BUILT_SOURCES += $(FNMATCH_H) # We need the following in order to create . if GL_GENERATE_FNMATCH_H fnmatch.h: fnmatch.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_FNMATCH_H''@|$(HAVE_FNMATCH_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FNMATCH_H''@|$(NEXT_FNMATCH_H)|g' \ -e 's/@''GNULIB_FNMATCH''@/$(GL_GNULIB_FNMATCH)/g' \ -e 's|@''HAVE_FNMATCH''@|$(HAVE_FNMATCH)|g' \ -e 's|@''REPLACE_FNMATCH''@|$(REPLACE_FNMATCH)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/fnmatch.in.h; \ } > $@-t && \ mv $@-t $@ else fnmatch.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t EXTRA_DIST += fnmatch.in.h ## end gnulib module fnmatch-h ## begin gnulib module fopen EXTRA_DIST += fopen.c EXTRA_libgreputils_a_SOURCES += fopen.c ## end gnulib module fopen ## begin gnulib module fopen-gnu EXTRA_DIST += fopen.c EXTRA_libgreputils_a_SOURCES += fopen.c ## end gnulib module fopen-gnu ## begin gnulib module fpending EXTRA_DIST += fpending.c fpending.h stdio-impl.h EXTRA_libgreputils_a_SOURCES += fpending.c ## end gnulib module fpending ## begin gnulib module free-posix EXTRA_DIST += free.c EXTRA_libgreputils_a_SOURCES += free.c ## end gnulib module free-posix ## begin gnulib module fstat EXTRA_DIST += fstat.c stat-w32.c stat-w32.h EXTRA_libgreputils_a_SOURCES += fstat.c stat-w32.c ## end gnulib module fstat ## begin gnulib module fstatat EXTRA_DIST += at-func.c fstatat.c EXTRA_libgreputils_a_SOURCES += at-func.c fstatat.c ## end gnulib module fstatat ## begin gnulib module fts EXTRA_DIST += fts-cycle.c fts.c fts_.h EXTRA_libgreputils_a_SOURCES += fts-cycle.c fts.c ## end gnulib module fts ## begin gnulib module gendocs EXTRA_DIST += $(top_srcdir)/build-aux/gendocs.sh ## end gnulib module gendocs ## begin gnulib module getcwd-lgpl EXTRA_DIST += getcwd-lgpl.c EXTRA_libgreputils_a_SOURCES += getcwd-lgpl.c ## end gnulib module getcwd-lgpl ## begin gnulib module getdtablesize EXTRA_DIST += getdtablesize.c EXTRA_libgreputils_a_SOURCES += getdtablesize.c ## end gnulib module getdtablesize ## begin gnulib module getopt-posix BUILT_SOURCES += $(GETOPT_H) $(GETOPT_CDEFS_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ < $(srcdir)/getopt.in.h; \ } > $@-t && \ mv -f $@-t $@ getopt-cdefs.h: getopt-cdefs.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ < $(srcdir)/getopt-cdefs.in.h; \ } > $@-t && \ mv -f $@-t $@ MOSTLYCLEANFILES += getopt.h getopt.h-t getopt-cdefs.h getopt-cdefs.h-t EXTRA_DIST += getopt-cdefs.in.h getopt-core.h getopt-ext.h getopt-pfx-core.h getopt-pfx-ext.h getopt.c getopt.in.h getopt1.c getopt_int.h EXTRA_libgreputils_a_SOURCES += getopt.c getopt1.c ## end gnulib module getopt-posix ## begin gnulib module getpagesize EXTRA_DIST += getpagesize.c EXTRA_libgreputils_a_SOURCES += getpagesize.c ## end gnulib module getpagesize ## begin gnulib module getprogname libgreputils_a_SOURCES += getprogname.h getprogname.c ## end gnulib module getprogname ## begin gnulib module gettext-h libgreputils_a_SOURCES += gettext.h ## end gnulib module gettext-h ## begin gnulib module git-version-gen EXTRA_DIST += $(top_srcdir)/build-aux/git-version-gen ## end gnulib module git-version-gen ## begin gnulib module gitlog-to-changelog EXTRA_DIST += $(top_srcdir)/build-aux/gitlog-to-changelog ## end gnulib module gitlog-to-changelog ## begin gnulib module gnu-web-doc-update EXTRA_DIST += $(top_srcdir)/build-aux/gnu-web-doc-update ## end gnulib module gnu-web-doc-update ## begin gnulib module gnumakefile EXTRA_DIST += $(top_srcdir)/GNUmakefile distclean-local: clean-GNUmakefile clean-GNUmakefile: test '$(srcdir)' = . || rm -f $(top_builddir)/GNUmakefile ## end gnulib module gnumakefile ## begin gnulib module gnupload EXTRA_DIST += $(top_srcdir)/build-aux/gnupload ## end gnulib module gnupload ## begin gnulib module gperf GPERF = gperf V_GPERF = $(V_GPERF_@AM_V@) V_GPERF_ = $(V_GPERF_@AM_DEFAULT_V@) V_GPERF_0 = @echo " GPERF " $@; ## end gnulib module gperf ## begin gnulib module hard-locale libgreputils_a_SOURCES += hard-locale.c EXTRA_DIST += hard-locale.h ## end gnulib module hard-locale ## begin gnulib module hash libgreputils_a_SOURCES += hash.c EXTRA_DIST += hash.h ## end gnulib module hash ## begin gnulib module havelib EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath ## end gnulib module havelib ## begin gnulib module i-ring libgreputils_a_SOURCES += i-ring.c EXTRA_DIST += i-ring.h ## end gnulib module i-ring ## begin gnulib module ialloc libgreputils_a_SOURCES += ialloc.c EXTRA_DIST += ialloc.h ## end gnulib module ialloc ## begin gnulib module iconv-h BUILT_SOURCES += $(ICONV_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. if GL_GENERATE_ICONV_H iconv.h: iconv.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_ICONV_H''@|$(NEXT_ICONV_H)|g' \ -e 's/@''GNULIB_ICONV''@/$(GL_GNULIB_ICONV)/g' \ -e 's|@''ICONV_CONST''@|$(ICONV_CONST)|g' \ -e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \ -e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \ -e 's|@''REPLACE_ICONV_UTF''@|$(REPLACE_ICONV_UTF)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/iconv.in.h; \ } > $@-t && \ mv $@-t $@ else iconv.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += iconv.h iconv.h-t EXTRA_DIST += iconv.in.h ## end gnulib module iconv-h ## begin gnulib module iconv_open $(srcdir)/iconv_open-aix.h: $(srcdir)/iconv_open-aix.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-aix.gperf > $(srcdir)/iconv_open-aix.h-t && \ mv $(srcdir)/iconv_open-aix.h-t $(srcdir)/iconv_open-aix.h $(srcdir)/iconv_open-hpux.h: $(srcdir)/iconv_open-hpux.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-hpux.gperf > $(srcdir)/iconv_open-hpux.h-t && \ mv $(srcdir)/iconv_open-hpux.h-t $(srcdir)/iconv_open-hpux.h $(srcdir)/iconv_open-irix.h: $(srcdir)/iconv_open-irix.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-irix.gperf > $(srcdir)/iconv_open-irix.h-t && \ mv $(srcdir)/iconv_open-irix.h-t $(srcdir)/iconv_open-irix.h $(srcdir)/iconv_open-osf.h: $(srcdir)/iconv_open-osf.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-osf.gperf > $(srcdir)/iconv_open-osf.h-t && \ mv $(srcdir)/iconv_open-osf.h-t $(srcdir)/iconv_open-osf.h $(srcdir)/iconv_open-solaris.h: $(srcdir)/iconv_open-solaris.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-solaris.gperf > $(srcdir)/iconv_open-solaris.h-t && \ mv $(srcdir)/iconv_open-solaris.h-t $(srcdir)/iconv_open-solaris.h $(srcdir)/iconv_open-zos.h: $(srcdir)/iconv_open-zos.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-zos.gperf > $(srcdir)/iconv_open-zos.h-t && \ mv $(srcdir)/iconv_open-zos.h-t $(srcdir)/iconv_open-zos.h BUILT_SOURCES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h iconv_open-zos.h MOSTLYCLEANFILES += iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h-t iconv_open-osf.h-t iconv_open-solaris.h-t iconv_open-zos.h-t MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h iconv_open-zos.h EXTRA_DIST += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h iconv_open-zos.h EXTRA_DIST += iconv.c iconv_close.c iconv_open-aix.gperf iconv_open-hpux.gperf iconv_open-irix.gperf iconv_open-osf.gperf iconv_open-solaris.gperf iconv_open-zos.gperf iconv_open.c EXTRA_libgreputils_a_SOURCES += iconv.c iconv_close.c iconv_open.c ## end gnulib module iconv_open ## begin gnulib module idx libgreputils_a_SOURCES += idx.h ## end gnulib module idx ## begin gnulib module ignore-value EXTRA_DIST += ignore-value.h ## end gnulib module ignore-value ## begin gnulib module intprops EXTRA_DIST += intprops.h ## end gnulib module intprops ## begin gnulib module inttypes-incomplete BUILT_SOURCES += inttypes.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \ -e 's/@''GNULIB_IMAXABS''@/$(GL_GNULIB_IMAXABS)/g' \ -e 's/@''GNULIB_IMAXDIV''@/$(GL_GNULIB_IMAXDIV)/g' \ -e 's/@''GNULIB_STRTOIMAX''@/$(GL_GNULIB_STRTOIMAX)/g' \ -e 's/@''GNULIB_STRTOUMAX''@/$(GL_GNULIB_STRTOUMAX)/g' \ -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \ -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ -e 's/@''HAVE_IMAXDIV_T''@/$(HAVE_IMAXDIV_T)/g' \ -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \ -e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \ -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \ -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \ -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/inttypes.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += inttypes.h inttypes.h-t EXTRA_DIST += inttypes.in.h ## end gnulib module inttypes-incomplete ## begin gnulib module isatty EXTRA_DIST += isatty.c EXTRA_libgreputils_a_SOURCES += isatty.c ## end gnulib module isatty ## begin gnulib module isblank EXTRA_DIST += isblank.c EXTRA_libgreputils_a_SOURCES += isblank.c ## end gnulib module isblank ## begin gnulib module iswblank EXTRA_DIST += iswblank.c EXTRA_libgreputils_a_SOURCES += iswblank.c ## end gnulib module iswblank ## begin gnulib module iswctype EXTRA_DIST += iswctype-impl.h iswctype.c EXTRA_libgreputils_a_SOURCES += iswctype.c ## end gnulib module iswctype ## begin gnulib module iswdigit EXTRA_DIST += iswdigit.c EXTRA_libgreputils_a_SOURCES += iswdigit.c ## end gnulib module iswdigit ## begin gnulib module iswxdigit EXTRA_DIST += iswxdigit.c EXTRA_libgreputils_a_SOURCES += iswxdigit.c ## end gnulib module iswxdigit ## begin gnulib module langinfo BUILT_SOURCES += langinfo.h # We need the following in order to create an empty placeholder for # when the system doesn't have one. langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \ -e 's/@''GNULIB_NL_LANGINFO''@/$(GL_GNULIB_NL_LANGINFO)/g' \ -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \ -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \ -e 's|@''HAVE_LANGINFO_ALTMON''@|$(HAVE_LANGINFO_ALTMON)|g' \ -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \ -e 's|@''HAVE_LANGINFO_YESEXPR''@|$(HAVE_LANGINFO_YESEXPR)|g' \ -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \ -e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/langinfo.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += langinfo.h langinfo.h-t EXTRA_DIST += langinfo.in.h ## end gnulib module langinfo ## begin gnulib module libc-config EXTRA_DIST += cdefs.h libc-config.h ## end gnulib module libc-config ## begin gnulib module limits-h BUILT_SOURCES += $(LIMITS_H) # We need the following in order to create when the system # doesn't have one that is compatible with GNU. if GL_GENERATE_LIMITS_H limits.h: limits.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ < $(srcdir)/limits.in.h; \ } > $@-t && \ mv $@-t $@ else limits.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += limits.h limits.h-t EXTRA_DIST += limits.in.h ## end gnulib module limits-h ## begin gnulib module localcharset libgreputils_a_SOURCES += localcharset.c EXTRA_DIST += localcharset.h ## end gnulib module localcharset ## begin gnulib module locale BUILT_SOURCES += locale.h # We need the following in order to create when the system # doesn't have one that provides all definitions. locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ -e 's/@''GNULIB_LOCALECONV''@/$(GL_GNULIB_LOCALECONV)/g' \ -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \ -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \ -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \ -e 's/@''GNULIB_LOCALENAME''@/$(GL_GNULIB_LOCALENAME)/g' \ -e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \ -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ -e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \ -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \ -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \ -e 's|@''REPLACE_NEWLOCALE''@|$(REPLACE_NEWLOCALE)|g' \ -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ -e 's|@''REPLACE_FREELOCALE''@|$(REPLACE_FREELOCALE)|g' \ -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \ -e 's|@''LOCALENAME_ENHANCE_LOCALE_FUNCS''@|$(LOCALENAME_ENHANCE_LOCALE_FUNCS)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/locale.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += locale.h locale.h-t EXTRA_DIST += locale.in.h ## end gnulib module locale ## begin gnulib module localeconv EXTRA_DIST += localeconv.c EXTRA_libgreputils_a_SOURCES += localeconv.c ## end gnulib module localeconv ## begin gnulib module lock libgreputils_a_SOURCES += glthread/lock.h glthread/lock.c ## end gnulib module lock ## begin gnulib module lseek EXTRA_DIST += lseek.c EXTRA_libgreputils_a_SOURCES += lseek.c ## end gnulib module lseek ## begin gnulib module lstat EXTRA_DIST += lstat.c EXTRA_libgreputils_a_SOURCES += lstat.c ## end gnulib module lstat ## begin gnulib module maintainer-makefile EXTRA_DIST += $(top_srcdir)/maint.mk ## end gnulib module maintainer-makefile ## begin gnulib module malloc-gnu EXTRA_DIST += malloc.c EXTRA_libgreputils_a_SOURCES += malloc.c ## end gnulib module malloc-gnu ## begin gnulib module malloc-posix EXTRA_DIST += malloc.c EXTRA_libgreputils_a_SOURCES += malloc.c ## end gnulib module malloc-posix ## begin gnulib module malloca libgreputils_a_SOURCES += malloca.c EXTRA_DIST += malloca.h ## end gnulib module malloca ## begin gnulib module mbchar libgreputils_a_SOURCES += mbchar.c EXTRA_DIST += mbchar.h ## end gnulib module mbchar ## begin gnulib module mbiter libgreputils_a_SOURCES += mbiter.h mbiter.c ## end gnulib module mbiter ## begin gnulib module mbrlen EXTRA_DIST += mbrlen.c EXTRA_libgreputils_a_SOURCES += mbrlen.c ## end gnulib module mbrlen ## begin gnulib module mbrtowc EXTRA_DIST += lc-charset-dispatch.c lc-charset-dispatch.h mbrtowc-impl-utf8.h mbrtowc-impl.h mbrtowc.c mbtowc-lock.c mbtowc-lock.h windows-initguard.h EXTRA_libgreputils_a_SOURCES += lc-charset-dispatch.c mbrtowc.c mbtowc-lock.c ## end gnulib module mbrtowc ## begin gnulib module mbscasecmp libgreputils_a_SOURCES += mbscasecmp.c ## end gnulib module mbscasecmp ## begin gnulib module mbsinit EXTRA_DIST += mbsinit.c EXTRA_libgreputils_a_SOURCES += mbsinit.c ## end gnulib module mbsinit ## begin gnulib module mbslen libgreputils_a_SOURCES += mbslen.c ## end gnulib module mbslen ## begin gnulib module mbsrtowcs EXTRA_DIST += mbsrtowcs-impl.h mbsrtowcs-state.c mbsrtowcs.c EXTRA_libgreputils_a_SOURCES += mbsrtowcs-state.c mbsrtowcs.c ## end gnulib module mbsrtowcs ## begin gnulib module mbsstr libgreputils_a_SOURCES += mbsstr.c EXTRA_DIST += str-kmp.h ## end gnulib module mbsstr ## begin gnulib module mbtowc EXTRA_DIST += mbtowc-impl.h mbtowc.c EXTRA_libgreputils_a_SOURCES += mbtowc.c ## end gnulib module mbtowc ## begin gnulib module mbuiter libgreputils_a_SOURCES += mbuiter.h mbuiter.c ## end gnulib module mbuiter ## begin gnulib module memchr EXTRA_DIST += memchr.c memchr.valgrind EXTRA_libgreputils_a_SOURCES += memchr.c ## end gnulib module memchr ## begin gnulib module memchr2 libgreputils_a_SOURCES += memchr2.h memchr2.c EXTRA_DIST += memchr2.valgrind ## end gnulib module memchr2 ## begin gnulib module mempcpy EXTRA_DIST += mempcpy.c EXTRA_libgreputils_a_SOURCES += mempcpy.c ## end gnulib module mempcpy ## begin gnulib module memrchr EXTRA_DIST += memrchr.c EXTRA_libgreputils_a_SOURCES += memrchr.c ## end gnulib module memrchr ## begin gnulib module minmax libgreputils_a_SOURCES += minmax.h ## end gnulib module minmax ## begin gnulib module msvc-inval EXTRA_DIST += msvc-inval.c msvc-inval.h EXTRA_libgreputils_a_SOURCES += msvc-inval.c ## end gnulib module msvc-inval ## begin gnulib module msvc-nothrow EXTRA_DIST += msvc-nothrow.c msvc-nothrow.h EXTRA_libgreputils_a_SOURCES += msvc-nothrow.c ## end gnulib module msvc-nothrow ## begin gnulib module nl_langinfo EXTRA_DIST += nl_langinfo-lock.c nl_langinfo.c windows-initguard.h EXTRA_libgreputils_a_SOURCES += nl_langinfo-lock.c nl_langinfo.c ## end gnulib module nl_langinfo ## begin gnulib module obstack EXTRA_DIST += obstack.c obstack.h EXTRA_libgreputils_a_SOURCES += obstack.c ## end gnulib module obstack ## begin gnulib module open EXTRA_DIST += open.c EXTRA_libgreputils_a_SOURCES += open.c ## end gnulib module open ## begin gnulib module openat EXTRA_DIST += openat.c EXTRA_libgreputils_a_SOURCES += openat.c ## end gnulib module openat ## begin gnulib module openat-die libgreputils_a_SOURCES += openat-die.c ## end gnulib module openat-die ## begin gnulib module openat-h EXTRA_DIST += openat.h ## end gnulib module openat-h ## begin gnulib module openat-safer libgreputils_a_SOURCES += openat-safer.c EXTRA_DIST += fcntl--.h fcntl-safer.h ## end gnulib module openat-safer ## begin gnulib module opendir EXTRA_DIST += dirent-private.h opendir.c EXTRA_libgreputils_a_SOURCES += opendir.c ## end gnulib module opendir ## begin gnulib module opendirat libgreputils_a_SOURCES += opendirat.c EXTRA_DIST += opendirat.h ## end gnulib module opendirat ## begin gnulib module pathmax EXTRA_DIST += pathmax.h ## end gnulib module pathmax ## begin gnulib module pipe-posix EXTRA_DIST += pipe.c EXTRA_libgreputils_a_SOURCES += pipe.c ## end gnulib module pipe-posix ## begin gnulib module propername libgreputils_a_SOURCES += propername.h propername.c ## end gnulib module propername ## begin gnulib module quote EXTRA_DIST += quote.h ## end gnulib module quote ## begin gnulib module quotearg libgreputils_a_SOURCES += quotearg.c EXTRA_DIST += quote.h quotearg.h ## end gnulib module quotearg ## begin gnulib module raise EXTRA_DIST += raise.c EXTRA_libgreputils_a_SOURCES += raise.c ## end gnulib module raise ## begin gnulib module rawmemchr EXTRA_DIST += rawmemchr.c rawmemchr.valgrind EXTRA_libgreputils_a_SOURCES += rawmemchr.c ## end gnulib module rawmemchr ## begin gnulib module read EXTRA_DIST += read.c EXTRA_libgreputils_a_SOURCES += read.c ## end gnulib module read ## begin gnulib module readdir EXTRA_DIST += dirent-private.h readdir.c EXTRA_libgreputils_a_SOURCES += readdir.c ## end gnulib module readdir ## begin gnulib module realloc-gnu EXTRA_DIST += realloc.c EXTRA_libgreputils_a_SOURCES += realloc.c ## end gnulib module realloc-gnu ## begin gnulib module realloc-posix EXTRA_DIST += realloc.c EXTRA_libgreputils_a_SOURCES += realloc.c ## end gnulib module realloc-posix ## begin gnulib module reallocarray EXTRA_DIST += reallocarray.c EXTRA_libgreputils_a_SOURCES += reallocarray.c ## end gnulib module reallocarray ## begin gnulib module regex EXTRA_DIST += regcomp.c regex.c regex.h regex_internal.c regex_internal.h regexec.c EXTRA_libgreputils_a_SOURCES += regcomp.c regex.c regex_internal.c regexec.c ## end gnulib module regex ## begin gnulib module safe-read libgreputils_a_SOURCES += safe-read.c EXTRA_DIST += safe-read.h sys-limits.h ## end gnulib module safe-read ## begin gnulib module same-inode EXTRA_DIST += same-inode.h ## end gnulib module same-inode ## begin gnulib module save-cwd libgreputils_a_SOURCES += save-cwd.c EXTRA_DIST += save-cwd.h ## end gnulib module save-cwd ## begin gnulib module setlocale-null libgreputils_a_SOURCES += setlocale_null.c EXTRA_DIST += setlocale-lock.c setlocale_null.h windows-initguard.h EXTRA_libgreputils_a_SOURCES += setlocale-lock.c ## end gnulib module setlocale-null ## begin gnulib module signal-h BUILT_SOURCES += signal.h # We need the following in order to create when the system # doesn't have a complete one. signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GL_GNULIB_PTHREAD_SIGMASK)/g' \ -e 's/@''GNULIB_RAISE''@/$(GL_GNULIB_RAISE)/g' \ -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GL_GNULIB_SIGNAL_H_SIGPIPE)/g' \ -e 's/@''GNULIB_SIGPROCMASK''@/$(GL_GNULIB_SIGPROCMASK)/g' \ -e 's/@''GNULIB_SIGACTION''@/$(GL_GNULIB_SIGACTION)/g' \ -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \ -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \ -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \ -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \ -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \ -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \ -e 's|@''REPLACE_RAISE''@|$(REPLACE_RAISE)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/signal.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += signal.h signal.h-t EXTRA_DIST += signal.in.h ## end gnulib module signal-h ## begin gnulib module sigsegv BUILT_SOURCES += $(SIGSEGV_H) if GL_GENERATE_SIGSEGV_H sigsegv.h: sigsegv.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/sigsegv.in.h; \ } > $@-t && \ mv $@-t $@ else sigsegv.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += sigsegv.h sigsegv.h-t if GL_GENERATE_SIGSEGV_H libgreputils_a_SOURCES += sigsegv.c stackvma.c endif EXTRA_DIST += sigsegv.in.h stackvma.h ## end gnulib module sigsegv ## begin gnulib module snippet/_Noreturn # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. _NORETURN_H=$(srcdir)/_Noreturn.h EXTRA_DIST += _Noreturn.h ## end gnulib module snippet/_Noreturn ## begin gnulib module snippet/arg-nonnull # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. ARG_NONNULL_H=$(srcdir)/arg-nonnull.h EXTRA_DIST += arg-nonnull.h ## end gnulib module snippet/arg-nonnull ## begin gnulib module snippet/c++defs # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. CXXDEFS_H=$(srcdir)/c++defs.h EXTRA_DIST += c++defs.h ## end gnulib module snippet/c++defs ## begin gnulib module snippet/warn-on-use # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. WARN_ON_USE_H=$(srcdir)/warn-on-use.h EXTRA_DIST += warn-on-use.h ## end gnulib module snippet/warn-on-use ## begin gnulib module stat EXTRA_DIST += stat-w32.c stat-w32.h stat.c EXTRA_libgreputils_a_SOURCES += stat-w32.c stat.c ## end gnulib module stat ## begin gnulib module stat-time libgreputils_a_SOURCES += stat-time.c EXTRA_DIST += stat-time.h ## end gnulib module stat-time ## begin gnulib module stdalign BUILT_SOURCES += $(STDALIGN_H) # We need the following in order to create when the system # doesn't have one that works. if GL_GENERATE_STDALIGN_H stdalign.h: stdalign.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/stdalign.in.h; \ } > $@-t && \ mv $@-t $@ else stdalign.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += stdalign.h stdalign.h-t EXTRA_DIST += stdalign.in.h ## end gnulib module stdalign ## begin gnulib module stdarg BUILT_SOURCES += $(STDARG_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. if GL_GENERATE_STDARG_H stdarg.h: stdarg.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \ < $(srcdir)/stdarg.in.h; \ } > $@-t && \ mv $@-t $@ else stdarg.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += stdarg.h stdarg.h-t EXTRA_DIST += stdarg.in.h ## end gnulib module stdarg ## begin gnulib module stdbool BUILT_SOURCES += $(STDBOOL_H) # We need the following in order to create when the system # doesn't have one that works. if GL_GENERATE_STDBOOL_H stdbool.h: stdbool.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ } > $@-t && \ mv $@-t $@ else stdbool.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += stdbool.h stdbool.h-t EXTRA_DIST += stdbool.in.h ## end gnulib module stdbool ## begin gnulib module stddef BUILT_SOURCES += $(STDDEF_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. if GL_GENERATE_STDDEF_H stddef.h: stddef.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ < $(srcdir)/stddef.in.h; \ } > $@-t && \ mv $@-t $@ else stddef.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += stddef.h stddef.h-t EXTRA_DIST += stddef.in.h ## end gnulib module stddef ## begin gnulib module stdint BUILT_SOURCES += $(STDINT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. if GL_GENERATE_STDINT_H stdint.h: stdint.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ < $(srcdir)/stdint.in.h; \ } > $@-t && \ mv $@-t $@ else stdint.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += stdint.h stdint.h-t EXTRA_DIST += stdint.in.h ## end gnulib module stdint ## begin gnulib module stdio BUILT_SOURCES += stdio.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \ -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \ -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \ -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \ -e 's/@''GNULIB_FGETC''@/$(GL_GNULIB_FGETC)/g' \ -e 's/@''GNULIB_FGETS''@/$(GL_GNULIB_FGETS)/g' \ -e 's/@''GNULIB_FOPEN''@/$(GL_GNULIB_FOPEN)/g' \ -e 's/@''GNULIB_FPRINTF''@/$(GL_GNULIB_FPRINTF)/g' \ -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GL_GNULIB_FPRINTF_POSIX)/g' \ -e 's/@''GNULIB_FPURGE''@/$(GL_GNULIB_FPURGE)/g' \ -e 's/@''GNULIB_FPUTC''@/$(GL_GNULIB_FPUTC)/g' \ -e 's/@''GNULIB_FPUTS''@/$(GL_GNULIB_FPUTS)/g' \ -e 's/@''GNULIB_FREAD''@/$(GL_GNULIB_FREAD)/g' \ -e 's/@''GNULIB_FREOPEN''@/$(GL_GNULIB_FREOPEN)/g' \ -e 's/@''GNULIB_FSCANF''@/$(GL_GNULIB_FSCANF)/g' \ -e 's/@''GNULIB_FSEEK''@/$(GL_GNULIB_FSEEK)/g' \ -e 's/@''GNULIB_FSEEKO''@/$(GL_GNULIB_FSEEKO)/g' \ -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \ -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \ -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \ -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \ -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \ -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \ -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \ -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \ -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \ -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \ -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \ -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \ -e 's/@''GNULIB_PRINTF''@/$(GL_GNULIB_PRINTF)/g' \ -e 's/@''GNULIB_PRINTF_POSIX''@/$(GL_GNULIB_PRINTF_POSIX)/g' \ -e 's/@''GNULIB_PUTC''@/$(GL_GNULIB_PUTC)/g' \ -e 's/@''GNULIB_PUTCHAR''@/$(GL_GNULIB_PUTCHAR)/g' \ -e 's/@''GNULIB_PUTS''@/$(GL_GNULIB_PUTS)/g' \ -e 's/@''GNULIB_REMOVE''@/$(GL_GNULIB_REMOVE)/g' \ -e 's/@''GNULIB_RENAME''@/$(GL_GNULIB_RENAME)/g' \ -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \ -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \ -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \ -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \ -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \ -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \ -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \ -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \ -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \ -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \ -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \ -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \ -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \ -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \ -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \ -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \ -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \ -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \ -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \ -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \ -e 's/@''GNULIB_MDA_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \ -e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \ -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/g' \ < $(srcdir)/stdio.in.h | \ sed -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \ -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \ -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ -e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \ -e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \ -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \ -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \ -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ -e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \ -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ -e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \ -e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \ -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \ -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \ -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \ -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ -e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += stdio.h stdio.h-t EXTRA_DIST += stdio.in.h ## end gnulib module stdio ## begin gnulib module stdlib BUILT_SOURCES += stdlib.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \ -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \ -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \ -e 's/@''GNULIB_CALLOC_POSIX''@/$(GL_GNULIB_CALLOC_POSIX)/g' \ -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GL_GNULIB_CANONICALIZE_FILE_NAME)/g' \ -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ -e 's/@''GNULIB_GETLOADAVG''@/$(GL_GNULIB_GETLOADAVG)/g' \ -e 's/@''GNULIB_GETSUBOPT''@/$(GL_GNULIB_GETSUBOPT)/g' \ -e 's/@''GNULIB_GRANTPT''@/$(GL_GNULIB_GRANTPT)/g' \ -e 's/@''GNULIB_MALLOC_POSIX''@/$(GL_GNULIB_MALLOC_POSIX)/g' \ -e 's/@''GNULIB_MBTOWC''@/$(GL_GNULIB_MBTOWC)/g' \ -e 's/@''GNULIB_MKDTEMP''@/$(GL_GNULIB_MKDTEMP)/g' \ -e 's/@''GNULIB_MKOSTEMP''@/$(GL_GNULIB_MKOSTEMP)/g' \ -e 's/@''GNULIB_MKOSTEMPS''@/$(GL_GNULIB_MKOSTEMPS)/g' \ -e 's/@''GNULIB_MKSTEMP''@/$(GL_GNULIB_MKSTEMP)/g' \ -e 's/@''GNULIB_MKSTEMPS''@/$(GL_GNULIB_MKSTEMPS)/g' \ -e 's/@''GNULIB_POSIX_MEMALIGN''@/$(GL_GNULIB_POSIX_MEMALIGN)/g' \ -e 's/@''GNULIB_POSIX_OPENPT''@/$(GL_GNULIB_POSIX_OPENPT)/g' \ -e 's/@''GNULIB_PTSNAME''@/$(GL_GNULIB_PTSNAME)/g' \ -e 's/@''GNULIB_PTSNAME_R''@/$(GL_GNULIB_PTSNAME_R)/g' \ -e 's/@''GNULIB_PUTENV''@/$(GL_GNULIB_PUTENV)/g' \ -e 's/@''GNULIB_QSORT_R''@/$(GL_GNULIB_QSORT_R)/g' \ -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \ -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GL_GNULIB_REALLOC_POSIX)/g' \ -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \ -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \ -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \ -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ -e 's/@''GNULIB_STRTOLD''@/$(GL_GNULIB_STRTOLD)/g' \ -e 's/@''GNULIB_STRTOLL''@/$(GL_GNULIB_STRTOLL)/g' \ -e 's/@''GNULIB_STRTOUL''@/$(GL_GNULIB_STRTOUL)/g' \ -e 's/@''GNULIB_STRTOULL''@/$(GL_GNULIB_STRTOULL)/g' \ -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GL_GNULIB_SYSTEM_POSIX)/g' \ -e 's/@''GNULIB_UNLOCKPT''@/$(GL_GNULIB_UNLOCKPT)/g' \ -e 's/@''GNULIB_UNSETENV''@/$(GL_GNULIB_UNSETENV)/g' \ -e 's/@''GNULIB_WCTOMB''@/$(GL_GNULIB_WCTOMB)/g' \ -e 's/@''GNULIB_MDA_ECVT''@/$(GL_GNULIB_MDA_ECVT)/g' \ -e 's/@''GNULIB_MDA_FCVT''@/$(GL_GNULIB_MDA_FCVT)/g' \ -e 's/@''GNULIB_MDA_GCVT''@/$(GL_GNULIB_MDA_GCVT)/g' \ -e 's/@''GNULIB_MDA_MKTEMP''@/$(GL_GNULIB_MDA_MKTEMP)/g' \ -e 's/@''GNULIB_MDA_PUTENV''@/$(GL_GNULIB_MDA_PUTENV)/g' \ < $(srcdir)/stdlib.in.h | \ sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ -e 's|@''HAVE_ALIGNED_ALLOC''@|$(HAVE_ALIGNED_ALLOC)|g' \ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''HAVE_DECL_ECVT''@|$(HAVE_DECL_ECVT)|g' \ -e 's|@''HAVE_DECL_FCVT''@|$(HAVE_DECL_FCVT)|g' \ -e 's|@''HAVE_DECL_GCVT''@|$(HAVE_DECL_GCVT)|g' \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ -e 's|@''HAVE_INITSTATE''@|$(HAVE_INITSTATE)|g' \ -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \ -e 's|@''HAVE_MBTOWC''@|$(HAVE_MBTOWC)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ -e 's|@''HAVE_POSIX_MEMALIGN''@|$(HAVE_POSIX_MEMALIGN)|g' \ -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \ -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \ -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \ -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ -e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -e 's|@''HAVE_STRTOL''@|$(HAVE_STRTOL)|g' \ -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOUL''@|$(HAVE_STRTOUL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \ -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e 's|@''REPLACE_POSIX_MEMALIGN''@|$(REPLACE_POSIX_MEMALIGN)|g' \ -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ -e 's|@''REPLACE_STRTOL''@|$(REPLACE_STRTOL)|g' \ -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ -e 's|@''REPLACE_STRTOLL''@|$(REPLACE_STRTOLL)|g' \ -e 's|@''REPLACE_STRTOUL''@|$(REPLACE_STRTOUL)|g' \ -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _Noreturn/r $(_NORETURN_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += stdlib.h stdlib.h-t EXTRA_DIST += stdlib.in.h ## end gnulib module stdlib ## begin gnulib module stpcpy EXTRA_DIST += stpcpy.c EXTRA_libgreputils_a_SOURCES += stpcpy.c ## end gnulib module stpcpy ## begin gnulib module strdup-posix EXTRA_DIST += strdup.c EXTRA_libgreputils_a_SOURCES += strdup.c ## end gnulib module strdup-posix ## begin gnulib module streq EXTRA_DIST += streq.h ## end gnulib module streq ## begin gnulib module strerror EXTRA_DIST += strerror.c EXTRA_libgreputils_a_SOURCES += strerror.c ## end gnulib module strerror ## begin gnulib module strerror-override EXTRA_DIST += strerror-override.c strerror-override.h EXTRA_libgreputils_a_SOURCES += strerror-override.c ## end gnulib module strerror-override ## begin gnulib module striconv libgreputils_a_SOURCES += striconv.h striconv.c if GL_COND_LIBTOOL endif ## end gnulib module striconv ## begin gnulib module string BUILT_SOURCES += string.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GL_GNULIB_EXPLICIT_BZERO)/g' \ -e 's/@''GNULIB_FFSL''@/$(GL_GNULIB_FFSL)/g' \ -e 's/@''GNULIB_FFSLL''@/$(GL_GNULIB_FFSLL)/g' \ -e 's/@''GNULIB_MBSLEN''@/$(GL_GNULIB_MBSLEN)/g' \ -e 's/@''GNULIB_MBSNLEN''@/$(GL_GNULIB_MBSNLEN)/g' \ -e 's/@''GNULIB_MBSCHR''@/$(GL_GNULIB_MBSCHR)/g' \ -e 's/@''GNULIB_MBSRCHR''@/$(GL_GNULIB_MBSRCHR)/g' \ -e 's/@''GNULIB_MBSSTR''@/$(GL_GNULIB_MBSSTR)/g' \ -e 's/@''GNULIB_MBSCASECMP''@/$(GL_GNULIB_MBSCASECMP)/g' \ -e 's/@''GNULIB_MBSNCASECMP''@/$(GL_GNULIB_MBSNCASECMP)/g' \ -e 's/@''GNULIB_MBSPCASECMP''@/$(GL_GNULIB_MBSPCASECMP)/g' \ -e 's/@''GNULIB_MBSCASESTR''@/$(GL_GNULIB_MBSCASESTR)/g' \ -e 's/@''GNULIB_MBSCSPN''@/$(GL_GNULIB_MBSCSPN)/g' \ -e 's/@''GNULIB_MBSPBRK''@/$(GL_GNULIB_MBSPBRK)/g' \ -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \ -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \ -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \ -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \ -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \ -e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \ -e 's/@''GNULIB_RAWMEMCHR''@/$(GL_GNULIB_RAWMEMCHR)/g' \ -e 's/@''GNULIB_STPCPY''@/$(GL_GNULIB_STPCPY)/g' \ -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \ -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \ -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \ -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \ -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \ -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \ -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \ -e 's/@''GNULIB_STRSEP''@/$(GL_GNULIB_STRSEP)/g' \ -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \ -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \ -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \ -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \ -e 's/@''GNULIB_STRSIGNAL''@/$(GL_GNULIB_STRSIGNAL)/g' \ -e 's/@''GNULIB_STRVERSCMP''@/$(GL_GNULIB_STRVERSCMP)/g' \ -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GL_GNULIB_MDA_MEMCCPY)/g' \ -e 's/@''GNULIB_MDA_STRDUP''@/$(GL_GNULIB_MDA_STRDUP)/g' \ < $(srcdir)/string.in.h | \ sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \ -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \ -e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ -e 's|@''REPLACE_FFSLL''@|$(REPLACE_FFSLL)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ < $(srcdir)/string.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += string.h string.h-t EXTRA_DIST += string.in.h ## end gnulib module string ## begin gnulib module strnlen EXTRA_DIST += strnlen.c EXTRA_libgreputils_a_SOURCES += strnlen.c ## end gnulib module strnlen ## begin gnulib module strnlen1 libgreputils_a_SOURCES += strnlen1.h strnlen1.c ## end gnulib module strnlen1 ## begin gnulib module strstr EXTRA_DIST += strstr.c EXTRA_libgreputils_a_SOURCES += strstr.c ## end gnulib module strstr ## begin gnulib module strstr-simple EXTRA_DIST += str-two-way.h strstr.c EXTRA_libgreputils_a_SOURCES += strstr.c ## end gnulib module strstr-simple ## begin gnulib module strtoimax EXTRA_DIST += strtoimax.c EXTRA_libgreputils_a_SOURCES += strtoimax.c ## end gnulib module strtoimax ## begin gnulib module strtoll EXTRA_DIST += strtol.c strtoll.c EXTRA_libgreputils_a_SOURCES += strtol.c strtoll.c ## end gnulib module strtoll ## begin gnulib module strtoull EXTRA_DIST += strtol.c strtoul.c strtoull.c EXTRA_libgreputils_a_SOURCES += strtol.c strtoul.c strtoull.c ## end gnulib module strtoull ## begin gnulib module strtoumax EXTRA_DIST += strtoimax.c strtoumax.c EXTRA_libgreputils_a_SOURCES += strtoimax.c strtoumax.c ## end gnulib module strtoumax ## begin gnulib module sys_stat BUILT_SOURCES += sys/stat.h # We need the following in order to create when the system # has one that is incomplete. sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ -e 's/@''GNULIB_FCHMODAT''@/$(GL_GNULIB_FCHMODAT)/g' \ -e 's/@''GNULIB_FSTAT''@/$(GL_GNULIB_FSTAT)/g' \ -e 's/@''GNULIB_FSTATAT''@/$(GL_GNULIB_FSTATAT)/g' \ -e 's/@''GNULIB_FUTIMENS''@/$(GL_GNULIB_FUTIMENS)/g' \ -e 's/@''GNULIB_GETUMASK''@/$(GL_GNULIB_GETUMASK)/g' \ -e 's/@''GNULIB_LCHMOD''@/$(GL_GNULIB_LCHMOD)/g' \ -e 's/@''GNULIB_LSTAT''@/$(GL_GNULIB_LSTAT)/g' \ -e 's/@''GNULIB_MKDIR''@/$(GL_GNULIB_MKDIR)/g' \ -e 's/@''GNULIB_MKDIRAT''@/$(GL_GNULIB_MKDIRAT)/g' \ -e 's/@''GNULIB_MKFIFO''@/$(GL_GNULIB_MKFIFO)/g' \ -e 's/@''GNULIB_MKFIFOAT''@/$(GL_GNULIB_MKFIFOAT)/g' \ -e 's/@''GNULIB_MKNOD''@/$(GL_GNULIB_MKNOD)/g' \ -e 's/@''GNULIB_MKNODAT''@/$(GL_GNULIB_MKNODAT)/g' \ -e 's/@''GNULIB_STAT''@/$(GL_GNULIB_STAT)/g' \ -e 's/@''GNULIB_UTIMENSAT''@/$(GL_GNULIB_UTIMENSAT)/g' \ -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GL_GNULIB_OVERRIDES_STRUCT_STAT)/g' \ -e 's/@''GNULIB_MDA_CHMOD''@/$(GL_GNULIB_MDA_CHMOD)/g' \ -e 's/@''GNULIB_MDA_MKDIR''@/$(GL_GNULIB_MDA_MKDIR)/g' \ -e 's/@''GNULIB_MDA_UMASK''@/$(GL_GNULIB_MDA_UMASK)/g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ -e 's|@''HAVE_GETUMASK''@|$(HAVE_GETUMASK)|g' \ -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ -e 's|@''REPLACE_FCHMODAT''@|$(REPLACE_FCHMODAT)|g' \ -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ -e 's|@''REPLACE_MKFIFOAT''@|$(REPLACE_MKFIFOAT)|g' \ -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ -e 's|@''REPLACE_MKNODAT''@|$(REPLACE_MKNODAT)|g' \ -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_stat.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t MOSTLYCLEANDIRS += sys EXTRA_DIST += sys_stat.in.h ## end gnulib module sys_stat ## begin gnulib module sys_types BUILT_SOURCES += sys/types.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. sys/types.h: sys_types.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ < $(srcdir)/sys_types.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += sys/types.h sys/types.h-t EXTRA_DIST += sys_types.in.h ## end gnulib module sys_types ## begin gnulib module threadlib libgreputils_a_SOURCES += glthread/threadlib.c ## end gnulib module threadlib ## begin gnulib module time BUILT_SOURCES += time.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ -e 's/@''GNULIB_CTIME''@/$(GL_GNULIB_CTIME)/g' \ -e 's/@''GNULIB_LOCALTIME''@/$(GL_GNULIB_LOCALTIME)/g' \ -e 's/@''GNULIB_MKTIME''@/$(GL_GNULIB_MKTIME)/g' \ -e 's/@''GNULIB_NANOSLEEP''@/$(GL_GNULIB_NANOSLEEP)/g' \ -e 's/@''GNULIB_STRFTIME''@/$(GL_GNULIB_STRFTIME)/g' \ -e 's/@''GNULIB_STRPTIME''@/$(GL_GNULIB_STRPTIME)/g' \ -e 's/@''GNULIB_TIMEGM''@/$(GL_GNULIB_TIMEGM)/g' \ -e 's/@''GNULIB_TIMESPEC_GET''@/$(GL_GNULIB_TIMESPEC_GET)/g' \ -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \ -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \ -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \ -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \ -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''TIME_H_DEFINES_TIME_UTC''@|$(TIME_H_DEFINES_TIME_UTC)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/time.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += time.h time.h-t EXTRA_DIST += time.in.h ## end gnulib module time ## begin gnulib module trim libgreputils_a_SOURCES += trim.c EXTRA_DIST += trim.h ## end gnulib module trim ## begin gnulib module unistd BUILT_SOURCES += unistd.h libgreputils_a_SOURCES += unistd.c # We need the following in order to create an empty placeholder for # when the system doesn't have one. unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ -e 's/@''GNULIB_ACCESS''@/$(GL_GNULIB_ACCESS)/g' \ -e 's/@''GNULIB_CHDIR''@/$(GL_GNULIB_CHDIR)/g' \ -e 's/@''GNULIB_CHOWN''@/$(GL_GNULIB_CHOWN)/g' \ -e 's/@''GNULIB_CLOSE''@/$(GL_GNULIB_CLOSE)/g' \ -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GL_GNULIB_COPY_FILE_RANGE)/g' \ -e 's/@''GNULIB_DUP''@/$(GL_GNULIB_DUP)/g' \ -e 's/@''GNULIB_DUP2''@/$(GL_GNULIB_DUP2)/g' \ -e 's/@''GNULIB_DUP3''@/$(GL_GNULIB_DUP3)/g' \ -e 's/@''GNULIB_ENVIRON''@/$(GL_GNULIB_ENVIRON)/g' \ -e 's/@''GNULIB_EUIDACCESS''@/$(GL_GNULIB_EUIDACCESS)/g' \ -e 's/@''GNULIB_EXECL''@/$(GL_GNULIB_EXECL)/g' \ -e 's/@''GNULIB_EXECLE''@/$(GL_GNULIB_EXECLE)/g' \ -e 's/@''GNULIB_EXECLP''@/$(GL_GNULIB_EXECLP)/g' \ -e 's/@''GNULIB_EXECV''@/$(GL_GNULIB_EXECV)/g' \ -e 's/@''GNULIB_EXECVE''@/$(GL_GNULIB_EXECVE)/g' \ -e 's/@''GNULIB_EXECVP''@/$(GL_GNULIB_EXECVP)/g' \ -e 's/@''GNULIB_EXECVPE''@/$(GL_GNULIB_EXECVPE)/g' \ -e 's/@''GNULIB_FACCESSAT''@/$(GL_GNULIB_FACCESSAT)/g' \ -e 's/@''GNULIB_FCHDIR''@/$(GL_GNULIB_FCHDIR)/g' \ -e 's/@''GNULIB_FCHOWNAT''@/$(GL_GNULIB_FCHOWNAT)/g' \ -e 's/@''GNULIB_FDATASYNC''@/$(GL_GNULIB_FDATASYNC)/g' \ -e 's/@''GNULIB_FSYNC''@/$(GL_GNULIB_FSYNC)/g' \ -e 's/@''GNULIB_FTRUNCATE''@/$(GL_GNULIB_FTRUNCATE)/g' \ -e 's/@''GNULIB_GETCWD''@/$(GL_GNULIB_GETCWD)/g' \ -e 's/@''GNULIB_GETDOMAINNAME''@/$(GL_GNULIB_GETDOMAINNAME)/g' \ -e 's/@''GNULIB_GETDTABLESIZE''@/$(GL_GNULIB_GETDTABLESIZE)/g' \ -e 's/@''GNULIB_GETENTROPY''@/$(GL_GNULIB_GETENTROPY)/g' \ -e 's/@''GNULIB_GETGROUPS''@/$(GL_GNULIB_GETGROUPS)/g' \ -e 's/@''GNULIB_GETHOSTNAME''@/$(GL_GNULIB_GETHOSTNAME)/g' \ -e 's/@''GNULIB_GETLOGIN''@/$(GL_GNULIB_GETLOGIN)/g' \ -e 's/@''GNULIB_GETLOGIN_R''@/$(GL_GNULIB_GETLOGIN_R)/g' \ -e 's/@''GNULIB_GETOPT_POSIX''@/$(GL_GNULIB_GETOPT_POSIX)/g' \ -e 's/@''GNULIB_GETPAGESIZE''@/$(GL_GNULIB_GETPAGESIZE)/g' \ -e 's/@''GNULIB_GETPASS''@/$(GL_GNULIB_GETPASS)/g' \ -e 's/@''GNULIB_GETUSERSHELL''@/$(GL_GNULIB_GETUSERSHELL)/g' \ -e 's/@''GNULIB_GROUP_MEMBER''@/$(GL_GNULIB_GROUP_MEMBER)/g' \ -e 's/@''GNULIB_ISATTY''@/$(GL_GNULIB_ISATTY)/g' \ -e 's/@''GNULIB_LCHOWN''@/$(GL_GNULIB_LCHOWN)/g' \ -e 's/@''GNULIB_LINK''@/$(GL_GNULIB_LINK)/g' \ -e 's/@''GNULIB_LINKAT''@/$(GL_GNULIB_LINKAT)/g' \ -e 's/@''GNULIB_LSEEK''@/$(GL_GNULIB_LSEEK)/g' \ -e 's/@''GNULIB_PIPE''@/$(GL_GNULIB_PIPE)/g' \ -e 's/@''GNULIB_PIPE2''@/$(GL_GNULIB_PIPE2)/g' \ -e 's/@''GNULIB_PREAD''@/$(GL_GNULIB_PREAD)/g' \ -e 's/@''GNULIB_PWRITE''@/$(GL_GNULIB_PWRITE)/g' \ -e 's/@''GNULIB_READ''@/$(GL_GNULIB_READ)/g' \ -e 's/@''GNULIB_READLINK''@/$(GL_GNULIB_READLINK)/g' \ -e 's/@''GNULIB_READLINKAT''@/$(GL_GNULIB_READLINKAT)/g' \ -e 's/@''GNULIB_RMDIR''@/$(GL_GNULIB_RMDIR)/g' \ -e 's/@''GNULIB_SETHOSTNAME''@/$(GL_GNULIB_SETHOSTNAME)/g' \ -e 's/@''GNULIB_SLEEP''@/$(GL_GNULIB_SLEEP)/g' \ -e 's/@''GNULIB_SYMLINK''@/$(GL_GNULIB_SYMLINK)/g' \ -e 's/@''GNULIB_SYMLINKAT''@/$(GL_GNULIB_SYMLINKAT)/g' \ -e 's/@''GNULIB_TRUNCATE''@/$(GL_GNULIB_TRUNCATE)/g' \ -e 's/@''GNULIB_TTYNAME_R''@/$(GL_GNULIB_TTYNAME_R)/g' \ -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GL_GNULIB_UNISTD_H_GETOPT)/g' \ -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GL_GNULIB_UNISTD_H_NONBLOCKING)/g' \ -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GL_GNULIB_UNISTD_H_SIGPIPE)/g' \ -e 's/@''GNULIB_UNLINK''@/$(GL_GNULIB_UNLINK)/g' \ -e 's/@''GNULIB_UNLINKAT''@/$(GL_GNULIB_UNLINKAT)/g' \ -e 's/@''GNULIB_USLEEP''@/$(GL_GNULIB_USLEEP)/g' \ -e 's/@''GNULIB_WRITE''@/$(GL_GNULIB_WRITE)/g' \ -e 's/@''GNULIB_MDA_ACCESS''@/$(GL_GNULIB_MDA_ACCESS)/g' \ -e 's/@''GNULIB_MDA_CHDIR''@/$(GL_GNULIB_MDA_CHDIR)/g' \ -e 's/@''GNULIB_MDA_CLOSE''@/$(GL_GNULIB_MDA_CLOSE)/g' \ -e 's/@''GNULIB_MDA_DUP''@/$(GL_GNULIB_MDA_DUP)/g' \ -e 's/@''GNULIB_MDA_DUP2''@/$(GL_GNULIB_MDA_DUP2)/g' \ -e 's/@''GNULIB_MDA_EXECL''@/$(GL_GNULIB_MDA_EXECL)/g' \ -e 's/@''GNULIB_MDA_EXECLE''@/$(GL_GNULIB_MDA_EXECLE)/g' \ -e 's/@''GNULIB_MDA_EXECLP''@/$(GL_GNULIB_MDA_EXECLP)/g' \ -e 's/@''GNULIB_MDA_EXECV''@/$(GL_GNULIB_MDA_EXECV)/g' \ -e 's/@''GNULIB_MDA_EXECVE''@/$(GL_GNULIB_MDA_EXECVE)/g' \ -e 's/@''GNULIB_MDA_EXECVP''@/$(GL_GNULIB_MDA_EXECVP)/g' \ -e 's/@''GNULIB_MDA_EXECVPE''@/$(GL_GNULIB_MDA_EXECVPE)/g' \ -e 's/@''GNULIB_MDA_GETCWD''@/$(GL_GNULIB_MDA_GETCWD)/g' \ -e 's/@''GNULIB_MDA_GETPID''@/$(GL_GNULIB_MDA_GETPID)/g' \ -e 's/@''GNULIB_MDA_ISATTY''@/$(GL_GNULIB_MDA_ISATTY)/g' \ -e 's/@''GNULIB_MDA_LSEEK''@/$(GL_GNULIB_MDA_LSEEK)/g' \ -e 's/@''GNULIB_MDA_READ''@/$(GL_GNULIB_MDA_READ)/g' \ -e 's/@''GNULIB_MDA_RMDIR''@/$(GL_GNULIB_MDA_RMDIR)/g' \ -e 's/@''GNULIB_MDA_SWAB''@/$(GL_GNULIB_MDA_SWAB)/g' \ -e 's/@''GNULIB_MDA_UNLINK''@/$(GL_GNULIB_MDA_UNLINK)/g' \ -e 's/@''GNULIB_MDA_WRITE''@/$(GL_GNULIB_MDA_WRITE)/g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ -e 's|@''HAVE_EXECVPE''@|$(HAVE_EXECVPE)|g' \ -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ -e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETENTROPY''@|$(HAVE_GETENTROPY)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_GETPASS''@|$(HAVE_GETPASS)|g' \ -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ -e 's|@''HAVE_PIPE''@|$(HAVE_PIPE)|g' \ -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_EXECVPE''@|$(HAVE_DECL_EXECVPE)|g' \ -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ -e 's|@''HAVE_DECL_GETLOGIN''@|$(HAVE_DECL_GETLOGIN)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \ -e 's|@''HAVE_DECL_TRUNCATE''@|$(HAVE_DECL_TRUNCATE)|g' \ -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ | \ sed -e 's|@''REPLACE_ACCESS''@|$(REPLACE_ACCESS)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ -e 's|@''REPLACE_EXECL''@|$(REPLACE_EXECL)|g' \ -e 's|@''REPLACE_EXECLE''@|$(REPLACE_EXECLE)|g' \ -e 's|@''REPLACE_EXECLP''@|$(REPLACE_EXECLP)|g' \ -e 's|@''REPLACE_EXECV''@|$(REPLACE_EXECV)|g' \ -e 's|@''REPLACE_EXECVE''@|$(REPLACE_EXECVE)|g' \ -e 's|@''REPLACE_EXECVP''@|$(REPLACE_EXECVP)|g' \ -e 's|@''REPLACE_EXECVPE''@|$(REPLACE_EXECVPE)|g' \ -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \ -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ -e 's|@''REPLACE_TRUNCATE''@|$(REPLACE_TRUNCATE)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \ -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ -e 's|@''UNISTD_H_HAVE_SYS_RANDOM_H''@|$(UNISTD_H_HAVE_SYS_RANDOM_H)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += unistd.h unistd.h-t EXTRA_DIST += unistd.in.h ## end gnulib module unistd ## begin gnulib module unistd-safer libgreputils_a_SOURCES += dup-safer.c fd-safer.c pipe-safer.c EXTRA_DIST += unistd--.h unistd-safer.h ## end gnulib module unistd-safer ## begin gnulib module unistr/base BUILT_SOURCES += $(LIBUNISTRING_UNISTR_H) unistr.h: unistr.in.h $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/unistr.in.h; \ } > $@-t && \ mv -f $@-t $@ MOSTLYCLEANFILES += unistr.h unistr.h-t EXTRA_DIST += unistr.in.h ## end gnulib module unistr/base ## begin gnulib module unistr/u8-mbtoucr if LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR libgreputils_a_SOURCES += unistr/u8-mbtoucr.c endif ## end gnulib module unistr/u8-mbtoucr ## begin gnulib module unistr/u8-uctomb if LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB libgreputils_a_SOURCES += unistr/u8-uctomb.c unistr/u8-uctomb-aux.c endif ## end gnulib module unistr/u8-uctomb ## begin gnulib module unitypes BUILT_SOURCES += $(LIBUNISTRING_UNITYPES_H) unitypes.h: unitypes.in.h $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/unitypes.in.h; \ } > $@-t && \ mv -f $@-t $@ MOSTLYCLEANFILES += unitypes.h unitypes.h-t EXTRA_DIST += unitypes.in.h ## end gnulib module unitypes ## begin gnulib module uniwidth/base BUILT_SOURCES += $(LIBUNISTRING_UNIWIDTH_H) uniwidth.h: uniwidth.in.h $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/uniwidth.in.h; \ } > $@-t && \ mv -f $@-t $@ MOSTLYCLEANFILES += uniwidth.h uniwidth.h-t EXTRA_DIST += localcharset.h uniwidth.in.h ## end gnulib module uniwidth/base ## begin gnulib module uniwidth/width if LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH libgreputils_a_SOURCES += uniwidth/width.c endif EXTRA_DIST += uniwidth/cjk.h ## end gnulib module uniwidth/width ## begin gnulib module unlocked-io-internal EXTRA_DIST += unlocked-io.h ## end gnulib module unlocked-io-internal ## begin gnulib module update-copyright EXTRA_DIST += $(top_srcdir)/build-aux/update-copyright ## end gnulib module update-copyright ## begin gnulib module useless-if-before-free EXTRA_DIST += $(top_srcdir)/build-aux/useless-if-before-free ## end gnulib module useless-if-before-free ## begin gnulib module vc-list-files EXTRA_DIST += $(top_srcdir)/build-aux/vc-list-files ## end gnulib module vc-list-files ## begin gnulib module verify EXTRA_DIST += verify.h ## end gnulib module verify ## begin gnulib module version-etc libgreputils_a_SOURCES += version-etc.h version-etc.c ## end gnulib module version-etc ## begin gnulib module version-etc-fsf libgreputils_a_SOURCES += version-etc-fsf.c ## end gnulib module version-etc-fsf ## begin gnulib module wchar BUILT_SOURCES += wchar.h # We need the following in order to create when the system # version does not work standalone. wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ -e 's/@''GNULIB_BTOWC''@/$(GL_GNULIB_BTOWC)/g' \ -e 's/@''GNULIB_WCTOB''@/$(GL_GNULIB_WCTOB)/g' \ -e 's/@''GNULIB_MBSINIT''@/$(GL_GNULIB_MBSINIT)/g' \ -e 's/@''GNULIB_MBRTOWC''@/$(GL_GNULIB_MBRTOWC)/g' \ -e 's/@''GNULIB_MBRLEN''@/$(GL_GNULIB_MBRLEN)/g' \ -e 's/@''GNULIB_MBSRTOWCS''@/$(GL_GNULIB_MBSRTOWCS)/g' \ -e 's/@''GNULIB_MBSNRTOWCS''@/$(GL_GNULIB_MBSNRTOWCS)/g' \ -e 's/@''GNULIB_WCRTOMB''@/$(GL_GNULIB_WCRTOMB)/g' \ -e 's/@''GNULIB_WCSRTOMBS''@/$(GL_GNULIB_WCSRTOMBS)/g' \ -e 's/@''GNULIB_WCSNRTOMBS''@/$(GL_GNULIB_WCSNRTOMBS)/g' \ -e 's/@''GNULIB_WCWIDTH''@/$(GL_GNULIB_WCWIDTH)/g' \ -e 's/@''GNULIB_WMEMCHR''@/$(GL_GNULIB_WMEMCHR)/g' \ -e 's/@''GNULIB_WMEMCMP''@/$(GL_GNULIB_WMEMCMP)/g' \ -e 's/@''GNULIB_WMEMCPY''@/$(GL_GNULIB_WMEMCPY)/g' \ -e 's/@''GNULIB_WMEMMOVE''@/$(GL_GNULIB_WMEMMOVE)/g' \ -e 's/@''GNULIB_WMEMPCPY''@/$(GL_GNULIB_WMEMPCPY)/g' \ -e 's/@''GNULIB_WMEMSET''@/$(GL_GNULIB_WMEMSET)/g' \ -e 's/@''GNULIB_WCSLEN''@/$(GL_GNULIB_WCSLEN)/g' \ -e 's/@''GNULIB_WCSNLEN''@/$(GL_GNULIB_WCSNLEN)/g' \ -e 's/@''GNULIB_WCSCPY''@/$(GL_GNULIB_WCSCPY)/g' \ -e 's/@''GNULIB_WCPCPY''@/$(GL_GNULIB_WCPCPY)/g' \ -e 's/@''GNULIB_WCSNCPY''@/$(GL_GNULIB_WCSNCPY)/g' \ -e 's/@''GNULIB_WCPNCPY''@/$(GL_GNULIB_WCPNCPY)/g' \ -e 's/@''GNULIB_WCSCAT''@/$(GL_GNULIB_WCSCAT)/g' \ -e 's/@''GNULIB_WCSNCAT''@/$(GL_GNULIB_WCSNCAT)/g' \ -e 's/@''GNULIB_WCSCMP''@/$(GL_GNULIB_WCSCMP)/g' \ -e 's/@''GNULIB_WCSNCMP''@/$(GL_GNULIB_WCSNCMP)/g' \ -e 's/@''GNULIB_WCSCASECMP''@/$(GL_GNULIB_WCSCASECMP)/g' \ -e 's/@''GNULIB_WCSNCASECMP''@/$(GL_GNULIB_WCSNCASECMP)/g' \ -e 's/@''GNULIB_WCSCOLL''@/$(GL_GNULIB_WCSCOLL)/g' \ -e 's/@''GNULIB_WCSXFRM''@/$(GL_GNULIB_WCSXFRM)/g' \ -e 's/@''GNULIB_WCSDUP''@/$(GL_GNULIB_WCSDUP)/g' \ -e 's/@''GNULIB_WCSCHR''@/$(GL_GNULIB_WCSCHR)/g' \ -e 's/@''GNULIB_WCSRCHR''@/$(GL_GNULIB_WCSRCHR)/g' \ -e 's/@''GNULIB_WCSCSPN''@/$(GL_GNULIB_WCSCSPN)/g' \ -e 's/@''GNULIB_WCSSPN''@/$(GL_GNULIB_WCSSPN)/g' \ -e 's/@''GNULIB_WCSPBRK''@/$(GL_GNULIB_WCSPBRK)/g' \ -e 's/@''GNULIB_WCSSTR''@/$(GL_GNULIB_WCSSTR)/g' \ -e 's/@''GNULIB_WCSTOK''@/$(GL_GNULIB_WCSTOK)/g' \ -e 's/@''GNULIB_WCSWIDTH''@/$(GL_GNULIB_WCSWIDTH)/g' \ -e 's/@''GNULIB_WCSFTIME''@/$(GL_GNULIB_WCSFTIME)/g' \ -e 's/@''GNULIB_MDA_WCSDUP''@/$(GL_GNULIB_MDA_WCSDUP)/g' \ < $(srcdir)/wchar.in.h | \ sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \ -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \ -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \ -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \ -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \ -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \ -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \ -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \ -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \ -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \ -e 's|@''HAVE_WMEMPCPY''@|$(HAVE_WMEMPCPY)|g' \ -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \ -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \ -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \ -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \ -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \ -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \ -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \ -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \ -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \ -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \ -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \ -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \ -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \ -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \ -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \ -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \ -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \ -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \ -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \ -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \ -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \ -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \ -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ -e 's|@''HAVE_WCSFTIME''@|$(HAVE_WCSFTIME)|g' \ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ -e 's|@''HAVE_DECL_WCSDUP''@|$(HAVE_DECL_WCSDUP)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ | \ sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \ -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \ -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \ -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \ -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \ -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \ -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \ -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \ -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += wchar.h wchar.h-t EXTRA_DIST += wchar.in.h ## end gnulib module wchar ## begin gnulib module wcrtomb EXTRA_DIST += wcrtomb.c EXTRA_libgreputils_a_SOURCES += wcrtomb.c ## end gnulib module wcrtomb ## begin gnulib module wctob EXTRA_DIST += wctob.c EXTRA_libgreputils_a_SOURCES += wctob.c ## end gnulib module wctob ## begin gnulib module wctomb EXTRA_DIST += wctomb-impl.h wctomb.c EXTRA_libgreputils_a_SOURCES += wctomb.c ## end gnulib module wctomb ## begin gnulib module wctype-h BUILT_SOURCES += wctype.h libgreputils_a_SOURCES += wctype-h.c # We need the following in order to create when the system # doesn't have one that works with the given compiler. wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ -e 's/@''GNULIB_ISWBLANK''@/$(GL_GNULIB_ISWBLANK)/g' \ -e 's/@''GNULIB_ISWDIGIT''@/$(GL_GNULIB_ISWDIGIT)/g' \ -e 's/@''GNULIB_ISWXDIGIT''@/$(GL_GNULIB_ISWXDIGIT)/g' \ -e 's/@''GNULIB_WCTYPE''@/$(GL_GNULIB_WCTYPE)/g' \ -e 's/@''GNULIB_ISWCTYPE''@/$(GL_GNULIB_ISWCTYPE)/g' \ -e 's/@''GNULIB_WCTRANS''@/$(GL_GNULIB_WCTRANS)/g' \ -e 's/@''GNULIB_TOWCTRANS''@/$(GL_GNULIB_TOWCTRANS)/g' \ -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \ -e 's/@''HAVE_WCTRANS_T''@/$(HAVE_WCTRANS_T)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \ -e 's/@''REPLACE_ISWDIGIT''@/$(REPLACE_ISWDIGIT)/g' \ -e 's/@''REPLACE_ISWXDIGIT''@/$(REPLACE_ISWXDIGIT)/g' \ -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ -e 's/@''REPLACE_TOWLOWER''@/$(REPLACE_TOWLOWER)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/wctype.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += wctype.h wctype.h-t EXTRA_DIST += wctype.in.h ## end gnulib module wctype-h ## begin gnulib module wcwidth EXTRA_DIST += wcwidth.c EXTRA_libgreputils_a_SOURCES += wcwidth.c ## end gnulib module wcwidth ## begin gnulib module windows-mutex EXTRA_DIST += windows-initguard.h windows-mutex.c windows-mutex.h EXTRA_libgreputils_a_SOURCES += windows-mutex.c ## end gnulib module windows-mutex ## begin gnulib module windows-once EXTRA_DIST += windows-once.c windows-once.h EXTRA_libgreputils_a_SOURCES += windows-once.c ## end gnulib module windows-once ## begin gnulib module windows-recmutex EXTRA_DIST += windows-initguard.h windows-recmutex.c windows-recmutex.h EXTRA_libgreputils_a_SOURCES += windows-recmutex.c ## end gnulib module windows-recmutex ## begin gnulib module windows-rwlock EXTRA_DIST += windows-initguard.h windows-rwlock.c windows-rwlock.h EXTRA_libgreputils_a_SOURCES += windows-rwlock.c ## end gnulib module windows-rwlock ## begin gnulib module wmemchr EXTRA_DIST += wmemchr-impl.h wmemchr.c EXTRA_libgreputils_a_SOURCES += wmemchr.c ## end gnulib module wmemchr ## begin gnulib module wmempcpy EXTRA_DIST += wmempcpy.c EXTRA_libgreputils_a_SOURCES += wmempcpy.c ## end gnulib module wmempcpy ## begin gnulib module xalloc libgreputils_a_SOURCES += xmalloc.c EXTRA_DIST += xalloc.h ## end gnulib module xalloc ## begin gnulib module xalloc-die libgreputils_a_SOURCES += xalloc-die.c EXTRA_DIST += xalloc.h ## end gnulib module xalloc-die ## begin gnulib module xalloc-oversized EXTRA_DIST += xalloc-oversized.h ## end gnulib module xalloc-oversized ## begin gnulib module xbinary-io libgreputils_a_SOURCES += xbinary-io.h xbinary-io.c ## end gnulib module xbinary-io ## begin gnulib module xstriconv libgreputils_a_SOURCES += xstriconv.h xstriconv.c ## end gnulib module xstriconv ## begin gnulib module xstrtoimax libgreputils_a_SOURCES += xstrtoimax.c ## end gnulib module xstrtoimax ## begin gnulib module xstrtol libgreputils_a_SOURCES += xstrtol.c xstrtoul.c EXTRA_DIST += xstrtol.h ## end gnulib module xstrtol mostlyclean-local: mostlyclean-generic @for dir in '' $(MOSTLYCLEANDIRS); do \ if test -n "$$dir" && test -d $$dir; then \ echo "rmdir $$dir"; rmdir $$dir; \ fi; \ done; \ : kbuild-3608/src/grep/lib/openat-safer.c0000664000175000017500000000254214670377425017752 0ustar locutuslocutus/* Invoke openat, but avoid some glitches. Copyright (C) 2005-2006, 2008-2021 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 . */ /* Written by Paul Eggert for open, ported by Eric Blake for openat. */ #include #include "fcntl-safer.h" #include #include #include "unistd-safer.h" int openat_safer (int fd, char const *file, int flags, ...) { mode_t mode = 0; if (flags & O_CREAT) { va_list ap; va_start (ap, flags); /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 creates crashing code when 'mode_t' is smaller than 'int'. */ mode = va_arg (ap, PROMOTED_MODE_T); va_end (ap); } return fd_safer (openat (fd, file, flags, mode)); } kbuild-3608/src/grep/lib/fnmatch_loop.c0000664000175000017500000013126014670377423020035 0ustar locutuslocutus/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifdef _LIBC # include #endif struct STRUCT { const CHAR *pattern; const CHAR *string; bool no_leading_period; }; /* Match STRING against the file name pattern PATTERN, returning zero if it matches, nonzero if not. */ static int FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, bool no_leading_period, int flags, struct STRUCT *ends, size_t alloca_used); static int EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, bool no_leading_period, int flags, size_t alloca_used); static const CHAR *END (const CHAR *patternp); static int FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, bool no_leading_period, int flags, struct STRUCT *ends, size_t alloca_used) { const CHAR *p = pattern, *n = string; UCHAR c; #ifdef _LIBC # if WIDE_CHAR_VERSION const char *collseq = (const char *) _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC); # else const UCHAR *collseq = (const UCHAR *) _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQMB); # endif #endif while ((c = *p++) != L_('\0')) { bool new_no_leading_period = false; c = FOLD (c); switch (c) { case L_('?'): if (__glibc_unlikely (flags & FNM_EXTMATCH) && *p == '(') { int res = EXT (c, p, n, string_end, no_leading_period, flags, alloca_used); if (res != -1) return res; } if (n == string_end) return FNM_NOMATCH; else if (*n == L_('/') && (flags & FNM_FILE_NAME)) return FNM_NOMATCH; else if (*n == L_('.') && no_leading_period) return FNM_NOMATCH; break; case L_('\\'): if (!(flags & FNM_NOESCAPE)) { c = *p++; if (c == L_('\0')) /* Trailing \ loses. */ return FNM_NOMATCH; c = FOLD (c); } if (n == string_end || FOLD ((UCHAR) *n) != c) return FNM_NOMATCH; break; case L_('*'): if (__glibc_unlikely (flags & FNM_EXTMATCH) && *p == '(') { int res = EXT (c, p, n, string_end, no_leading_period, flags, alloca_used); if (res != -1) return res; } else if (ends != NULL) { ends->pattern = p - 1; ends->string = n; ends->no_leading_period = no_leading_period; return 0; } if (n != string_end && *n == L_('.') && no_leading_period) return FNM_NOMATCH; for (c = *p++; c == L_('?') || c == L_('*'); c = *p++) { if (*p == L_('(') && (flags & FNM_EXTMATCH) != 0) { const CHAR *endp = END (p); if (endp != p) { /* This is a pattern. Skip over it. */ p = endp; continue; } } if (c == L_('?')) { /* A ? needs to match one character. */ if (n == string_end) /* There isn't another character; no match. */ return FNM_NOMATCH; else if (*n == L_('/') && __glibc_unlikely (flags & FNM_FILE_NAME)) /* A slash does not match a wildcard under FNM_FILE_NAME. */ return FNM_NOMATCH; else /* One character of the string is consumed in matching this ? wildcard, so *??? won't match if there are less than three characters. */ ++n; } } if (c == L_('\0')) /* The wildcard(s) is/are the last element of the pattern. If the name is a file name and contains another slash this means it cannot match, unless the FNM_LEADING_DIR flag is set. */ { int result = (flags & FNM_FILE_NAME) == 0 ? 0 : FNM_NOMATCH; if (flags & FNM_FILE_NAME) { if (flags & FNM_LEADING_DIR) result = 0; else { if (MEMCHR (n, L_('/'), string_end - n) == NULL) result = 0; } } return result; } else { const CHAR *endp; struct STRUCT end; end.pattern = NULL; endp = MEMCHR (n, (flags & FNM_FILE_NAME) ? L_('/') : L_('\0'), string_end - n); if (endp == NULL) endp = string_end; if (c == L_('[') || (__glibc_unlikely (flags & FNM_EXTMATCH) && (c == L_('@') || c == L_('+') || c == L_('!')) && *p == L_('('))) { int flags2 = ((flags & FNM_FILE_NAME) ? flags : (flags & ~FNM_PERIOD)); for (--p; n < endp; ++n, no_leading_period = false) if (FCT (p, n, string_end, no_leading_period, flags2, &end, alloca_used) == 0) goto found; } else if (c == L_('/') && (flags & FNM_FILE_NAME)) { while (n < string_end && *n != L_('/')) ++n; if (n < string_end && *n == L_('/') && (FCT (p, n + 1, string_end, flags & FNM_PERIOD, flags, NULL, alloca_used) == 0)) return 0; } else { int flags2 = ((flags & FNM_FILE_NAME) ? flags : (flags & ~FNM_PERIOD)); if (c == L_('\\') && !(flags & FNM_NOESCAPE)) c = *p; c = FOLD (c); for (--p; n < endp; ++n, no_leading_period = false) if (FOLD ((UCHAR) *n) == c && (FCT (p, n, string_end, no_leading_period, flags2, &end, alloca_used) == 0)) { found: if (end.pattern == NULL) return 0; break; } if (end.pattern != NULL) { p = end.pattern; n = end.string; no_leading_period = end.no_leading_period; continue; } } } /* If we come here no match is possible with the wildcard. */ return FNM_NOMATCH; case L_('['): { /* Nonzero if the sense of the character class is inverted. */ const CHAR *p_init = p; const CHAR *n_init = n; bool not; CHAR cold; UCHAR fn; if (posixly_correct == 0) posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; if (n == string_end) return FNM_NOMATCH; if (*n == L_('.') && no_leading_period) return FNM_NOMATCH; if (*n == L_('/') && (flags & FNM_FILE_NAME)) /* '/' cannot be matched. */ return FNM_NOMATCH; not = (*p == L_('!') || (posixly_correct < 0 && *p == L_('^'))); if (not) ++p; fn = FOLD ((UCHAR) *n); c = *p++; for (;;) { if (!(flags & FNM_NOESCAPE) && c == L_('\\')) { if (*p == L_('\0')) return FNM_NOMATCH; c = FOLD ((UCHAR) *p); ++p; goto normal_bracket; } else if (c == L_('[') && *p == L_(':')) { /* Leave room for the null. */ CHAR str[CHAR_CLASS_MAX_LENGTH + 1]; size_t c1 = 0; wctype_t wt; const CHAR *startp = p; for (;;) { if (c1 == CHAR_CLASS_MAX_LENGTH) /* The name is too long and therefore the pattern is ill-formed. */ return FNM_NOMATCH; c = *++p; if (c == L_(':') && p[1] == L_(']')) { p += 2; break; } if (c < L_('a') || c >= L_('z')) { /* This cannot possibly be a character class name. Match it as a normal range. */ p = startp; c = L_('['); goto normal_bracket; } str[c1++] = c; } str[c1] = L_('\0'); wt = IS_CHAR_CLASS (str); if (wt == 0) /* Invalid character class name. */ return FNM_NOMATCH; #if defined _LIBC && ! WIDE_CHAR_VERSION /* The following code is glibc specific but does there a good job in speeding up the code since we can avoid the btowc() call. */ if (_ISCTYPE ((UCHAR) *n, wt)) goto matched; #else if (iswctype (BTOWC ((UCHAR) *n), wt)) goto matched; #endif c = *p++; } #ifdef _LIBC else if (c == L_('[') && *p == L_('=')) { /* It's important that STR be a scalar variable rather than a one-element array, because GCC (at least 4.9.2 -O2 on x86-64) can be confused by the array and diagnose a "used initialized" in a dead branch in the findidx function. */ UCHAR str; uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); const CHAR *startp = p; c = *++p; if (c == L_('\0')) { p = startp; c = L_('['); goto normal_bracket; } str = c; c = *++p; if (c != L_('=') || p[1] != L_(']')) { p = startp; c = L_('['); goto normal_bracket; } p += 2; if (nrules == 0) { if ((UCHAR) *n == str) goto matched; } else { const int32_t *table; # if WIDE_CHAR_VERSION const int32_t *weights; const wint_t *extra; # else const unsigned char *weights; const unsigned char *extra; # endif const int32_t *indirect; int32_t idx; const UCHAR *cp = (const UCHAR *) &str; # if WIDE_CHAR_VERSION table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC); weights = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC); extra = (const wint_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC); # else table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB); weights = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB); extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); # endif idx = FINDIDX (table, indirect, extra, &cp, 1); if (idx != 0) { /* We found a table entry. Now see whether the character we are currently at has the same equivalence class value. */ int len = weights[idx & 0xffffff]; int32_t idx2; const UCHAR *np = (const UCHAR *) n; idx2 = FINDIDX (table, indirect, extra, &np, string_end - n); if (idx2 != 0 && (idx >> 24) == (idx2 >> 24) && len == weights[idx2 & 0xffffff]) { int cnt = 0; idx &= 0xffffff; idx2 &= 0xffffff; while (cnt < len && (weights[idx + 1 + cnt] == weights[idx2 + 1 + cnt])) ++cnt; if (cnt == len) goto matched; } } } c = *p++; } #endif else if (c == L_('\0')) { /* [ unterminated, treat as normal character. */ p = p_init; n = n_init; c = L_('['); goto normal_match; } else { bool is_range = false; #ifdef _LIBC bool is_seqval = false; if (c == L_('[') && *p == L_('.')) { uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); const CHAR *startp = p; size_t c1 = 0; while (1) { c = *++p; if (c == L_('.') && p[1] == L_(']')) { p += 2; break; } if (c == '\0') return FNM_NOMATCH; ++c1; } /* We have to handling the symbols differently in ranges since then the collation sequence is important. */ is_range = *p == L_('-') && p[1] != L_('\0'); if (nrules == 0) { /* There are no names defined in the collation data. Therefore we only accept the trivial names consisting of the character itself. */ if (c1 != 1) return FNM_NOMATCH; if (!is_range && *n == startp[1]) goto matched; cold = startp[1]; c = *p++; } else { int32_t table_size; const int32_t *symb_table; const unsigned char *extra; int32_t idx; int32_t elem; # if WIDE_CHAR_VERSION CHAR *wextra; # endif table_size = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_SYMB_HASH_SIZEMB); symb_table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_TABLEMB); extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB); for (elem = 0; elem < table_size; elem++) if (symb_table[2 * elem] != 0) { idx = symb_table[2 * elem + 1]; /* Skip the name of collating element. */ idx += 1 + extra[idx]; # if WIDE_CHAR_VERSION /* Skip the byte sequence of the collating element. */ idx += 1 + extra[idx]; /* Adjust for the alignment. */ idx = (idx + 3) & ~3; wextra = (CHAR *) &extra[idx + 4]; if (/* Compare the length of the sequence. */ c1 == wextra[0] /* Compare the wide char sequence. */ && (__wmemcmp (startp + 1, &wextra[1], c1) == 0)) /* Yep, this is the entry. */ break; # else if (/* Compare the length of the sequence. */ c1 == extra[idx] /* Compare the byte sequence. */ && memcmp (startp + 1, &extra[idx + 1], c1) == 0) /* Yep, this is the entry. */ break; # endif } if (elem < table_size) { /* Compare the byte sequence but only if this is not part of a range. */ if (! is_range # if WIDE_CHAR_VERSION && __wmemcmp (n, &wextra[1], c1) == 0 # else && memcmp (n, &extra[idx + 1], c1) == 0 # endif ) { n += c1 - 1; goto matched; } /* Get the collation sequence value. */ is_seqval = true; # if WIDE_CHAR_VERSION cold = wextra[1 + wextra[0]]; # else idx += 1 + extra[idx]; /* Adjust for the alignment. */ idx = (idx + 3) & ~3; cold = *((int32_t *) &extra[idx]); # endif c = *p++; } else if (c1 == 1) { /* No valid character. Match it as a single byte. */ if (!is_range && *n == startp[1]) goto matched; cold = startp[1]; c = *p++; } else return FNM_NOMATCH; } } else #endif { c = FOLD (c); normal_bracket: /* We have to handling the symbols differently in ranges since then the collation sequence is important. */ is_range = (*p == L_('-') && p[1] != L_('\0') && p[1] != L_(']')); if (!is_range && c == fn) goto matched; #if _LIBC /* This is needed if we goto normal_bracket; from outside of is_seqval's scope. */ is_seqval = false; #endif cold = c; c = *p++; } if (c == L_('-') && *p != L_(']')) { #if _LIBC /* We have to find the collation sequence value for C. Collation sequence is nothing we can regularly access. The sequence value is defined by the order in which the definitions of the collation values for the various characters appear in the source file. A strange concept, nowhere documented. */ uint32_t fcollseq; uint32_t lcollseq; UCHAR cend = *p++; # if WIDE_CHAR_VERSION /* Search in the 'names' array for the characters. */ fcollseq = __collseq_table_lookup (collseq, fn); if (fcollseq == ~((uint32_t) 0)) /* XXX We don't know anything about the character we are supposed to match. This means we are failing. */ goto range_not_matched; if (is_seqval) lcollseq = cold; else lcollseq = __collseq_table_lookup (collseq, cold); # else fcollseq = collseq[fn]; lcollseq = is_seqval ? cold : collseq[(UCHAR) cold]; # endif is_seqval = false; if (cend == L_('[') && *p == L_('.')) { uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); const CHAR *startp = p; size_t c1 = 0; while (1) { c = *++p; if (c == L_('.') && p[1] == L_(']')) { p += 2; break; } if (c == '\0') return FNM_NOMATCH; ++c1; } if (nrules == 0) { /* There are no names defined in the collation data. Therefore we only accept the trivial names consisting of the character itself. */ if (c1 != 1) return FNM_NOMATCH; cend = startp[1]; } else { int32_t table_size; const int32_t *symb_table; const unsigned char *extra; int32_t idx; int32_t elem; # if WIDE_CHAR_VERSION CHAR *wextra; # endif table_size = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_SYMB_HASH_SIZEMB); symb_table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_TABLEMB); extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB); for (elem = 0; elem < table_size; elem++) if (symb_table[2 * elem] != 0) { idx = symb_table[2 * elem + 1]; /* Skip the name of collating element. */ idx += 1 + extra[idx]; # if WIDE_CHAR_VERSION /* Skip the byte sequence of the collating element. */ idx += 1 + extra[idx]; /* Adjust for the alignment. */ idx = (idx + 3) & ~3; wextra = (CHAR *) &extra[idx + 4]; if (/* Compare the length of the sequence. */ c1 == wextra[0] /* Compare the wide char sequence. */ && (__wmemcmp (startp + 1, &wextra[1], c1) == 0)) /* Yep, this is the entry. */ break; # else if (/* Compare the length of the sequence. */ c1 == extra[idx] /* Compare the byte sequence. */ && memcmp (startp + 1, &extra[idx + 1], c1) == 0) /* Yep, this is the entry. */ break; # endif } if (elem < table_size) { /* Get the collation sequence value. */ is_seqval = true; # if WIDE_CHAR_VERSION cend = wextra[1 + wextra[0]]; # else idx += 1 + extra[idx]; /* Adjust for the alignment. */ idx = (idx + 3) & ~3; cend = *((int32_t *) &extra[idx]); # endif } else if (c1 == 1) { cend = startp[1]; c = *p++; } else return FNM_NOMATCH; } } else { if (!(flags & FNM_NOESCAPE) && cend == L_('\\')) cend = *p++; if (cend == L_('\0')) return FNM_NOMATCH; cend = FOLD (cend); } /* XXX It is not entirely clear to me how to handle characters which are not mentioned in the collation specification. */ if ( # if WIDE_CHAR_VERSION lcollseq == 0xffffffff || # endif lcollseq <= fcollseq) { /* We have to look at the upper bound. */ uint32_t hcollseq; if (is_seqval) hcollseq = cend; else { # if WIDE_CHAR_VERSION hcollseq = __collseq_table_lookup (collseq, cend); if (hcollseq == ~((uint32_t) 0)) { /* Hum, no information about the upper bound. The matching succeeds if the lower bound is matched exactly. */ if (lcollseq != fcollseq) goto range_not_matched; goto matched; } # else hcollseq = collseq[cend]; # endif } if (lcollseq <= hcollseq && fcollseq <= hcollseq) goto matched; } # if WIDE_CHAR_VERSION range_not_matched: # endif #else /* We use a boring value comparison of the character values. This is better than comparing using 'strcoll' since the latter would have surprising and sometimes fatal consequences. */ UCHAR cend = *p++; if (!(flags & FNM_NOESCAPE) && cend == L_('\\')) cend = *p++; if (cend == L_('\0')) return FNM_NOMATCH; /* It is a range. */ if ((UCHAR) cold <= fn && fn <= cend) goto matched; #endif c = *p++; } } if (c == L_(']')) break; } if (!not) return FNM_NOMATCH; break; matched: /* Skip the rest of the [...] that already matched. */ while ((c = *p++) != L_(']')) { if (c == L_('\0')) /* [... (unterminated) loses. */ return FNM_NOMATCH; if (!(flags & FNM_NOESCAPE) && c == L_('\\')) { if (*p == L_('\0')) return FNM_NOMATCH; /* XXX 1003.2d11 is unclear if this is right. */ ++p; } else if (c == L_('[') && *p == L_(':')) { int c1 = 0; const CHAR *startp = p; while (1) { c = *++p; if (++c1 == CHAR_CLASS_MAX_LENGTH) return FNM_NOMATCH; if (*p == L_(':') && p[1] == L_(']')) break; if (c < L_('a') || c >= L_('z')) { p = startp - 2; break; } } p += 2; } else if (c == L_('[') && *p == L_('=')) { c = *++p; if (c == L_('\0')) return FNM_NOMATCH; c = *++p; if (c != L_('=') || p[1] != L_(']')) return FNM_NOMATCH; p += 2; } else if (c == L_('[') && *p == L_('.')) { while (1) { c = *++p; if (c == L_('\0')) return FNM_NOMATCH; if (c == L_('.') && p[1] == L_(']')) break; } p += 2; } } if (not) return FNM_NOMATCH; } break; case L_('+'): case L_('@'): case L_('!'): if (__glibc_unlikely (flags & FNM_EXTMATCH) && *p == '(') { int res = EXT (c, p, n, string_end, no_leading_period, flags, alloca_used); if (res != -1) return res; } goto normal_match; case L_('/'): if (NO_LEADING_PERIOD (flags)) { if (n == string_end || c != (UCHAR) *n) return FNM_NOMATCH; new_no_leading_period = true; break; } FALLTHROUGH; default: normal_match: if (n == string_end || c != FOLD ((UCHAR) *n)) return FNM_NOMATCH; } no_leading_period = new_no_leading_period; ++n; } if (n == string_end) return 0; if ((flags & FNM_LEADING_DIR) && n != string_end && *n == L_('/')) /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */ return 0; return FNM_NOMATCH; } static const CHAR * END (const CHAR *pattern) { const CHAR *p = pattern; while (1) if (*++p == L_('\0')) /* This is an invalid pattern. */ return pattern; else if (*p == L_('[')) { /* Handle brackets special. */ if (posixly_correct == 0) posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; /* Skip the not sign. We have to recognize it because of a possibly following ']'. */ if (*++p == L_('!') || (posixly_correct < 0 && *p == L_('^'))) ++p; /* A leading ']' is recognized as such. */ if (*p == L_(']')) ++p; /* Skip over all characters of the list. */ while (*p != L_(']')) if (*p++ == L_('\0')) /* This is no valid pattern. */ return pattern; } else if ((*p == L_('?') || *p == L_('*') || *p == L_('+') || *p == L_('@') || *p == L_('!')) && p[1] == L_('(')) { p = END (p + 1); if (*p == L_('\0')) /* This is an invalid pattern. */ return pattern; } else if (*p == L_(')')) break; return p + 1; } static int EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, bool no_leading_period, int flags, size_t alloca_used) { const CHAR *startp; ptrdiff_t level; struct patternlist { struct patternlist *next; CHAR malloced; CHAR str __flexarr; } *list = NULL; struct patternlist **lastp = &list; size_t pattern_len = STRLEN (pattern); bool any_malloced = false; const CHAR *p; const CHAR *rs; int retval = 0; /* Parse the pattern. Store the individual parts in the list. */ level = 0; for (startp = p = pattern + 1; level >= 0; ++p) if (*p == L_('\0')) { /* This is an invalid pattern. */ retval = -1; goto out; } else if (*p == L_('[')) { /* Handle brackets special. */ if (posixly_correct == 0) posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; /* Skip the not sign. We have to recognize it because of a possibly following ']'. */ if (*++p == L_('!') || (posixly_correct < 0 && *p == L_('^'))) ++p; /* A leading ']' is recognized as such. */ if (*p == L_(']')) ++p; /* Skip over all characters of the list. */ while (*p != L_(']')) if (*p++ == L_('\0')) { /* This is no valid pattern. */ retval = -1; goto out; } } else if ((*p == L_('?') || *p == L_('*') || *p == L_('+') || *p == L_('@') || *p == L_('!')) && p[1] == L_('(')) /* Remember the nesting level. */ ++level; else if (*p == L_(')')) { if (level-- == 0) { /* This means we found the end of the pattern. */ #define NEW_PATTERN \ struct patternlist *newp; \ size_t plen = (opt == L_('?') || opt == L_('@') \ ? pattern_len : (p - startp + 1UL)); \ idx_t slen = FLEXSIZEOF (struct patternlist, str, 0); \ idx_t new_used = alloca_used + slen; \ idx_t plensize; \ if (INT_MULTIPLY_WRAPV (plen, sizeof (CHAR), &plensize) \ || INT_ADD_WRAPV (new_used, plensize, &new_used)) \ { \ retval = -2; \ goto out; \ } \ slen += plensize; \ bool malloced = ! __libc_use_alloca (new_used); \ if (__glibc_unlikely (malloced)) \ { \ newp = malloc (slen); \ if (newp == NULL) \ { \ retval = -2; \ goto out; \ } \ any_malloced = true; \ } \ else \ newp = alloca_account (slen, alloca_used); \ newp->next = NULL; \ newp->malloced = malloced; \ *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L_('\0'); \ *lastp = newp; \ lastp = &newp->next NEW_PATTERN; } } else if (*p == L_('|')) { if (level == 0) { NEW_PATTERN; startp = p + 1; } } assert (list != NULL); assert (p[-1] == L_(')')); #undef NEW_PATTERN switch (opt) { case L_('*'): if (FCT (p, string, string_end, no_leading_period, flags, NULL, alloca_used) == 0) goto success; FALLTHROUGH; case L_('+'): do { for (rs = string; rs <= string_end; ++rs) /* First match the prefix with the current pattern with the current pattern. */ if (FCT (list->str, string, rs, no_leading_period, flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, NULL, alloca_used) == 0 /* This was successful. Now match the rest with the rest of the pattern. */ && (FCT (p, rs, string_end, rs == string ? no_leading_period : rs[-1] == '/' && NO_LEADING_PERIOD (flags), flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, NULL, alloca_used) == 0 /* This didn't work. Try the whole pattern. */ || (rs != string && FCT (pattern - 1, rs, string_end, rs == string ? no_leading_period : rs[-1] == '/' && NO_LEADING_PERIOD (flags), flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, NULL, alloca_used) == 0))) /* It worked. Signal success. */ goto success; } while ((list = list->next) != NULL); /* None of the patterns lead to a match. */ retval = FNM_NOMATCH; break; case L_('?'): if (FCT (p, string, string_end, no_leading_period, flags, NULL, alloca_used) == 0) goto success; FALLTHROUGH; case L_('@'): do /* I cannot believe it but 'strcat' is actually acceptable here. Match the entire string with the prefix from the pattern list and the rest of the pattern following the pattern list. */ if (FCT (STRCAT (list->str, p), string, string_end, no_leading_period, flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, NULL, alloca_used) == 0) /* It worked. Signal success. */ goto success; while ((list = list->next) != NULL); /* None of the patterns lead to a match. */ retval = FNM_NOMATCH; break; case L_('!'): for (rs = string; rs <= string_end; ++rs) { struct patternlist *runp; for (runp = list; runp != NULL; runp = runp->next) if (FCT (runp->str, string, rs, no_leading_period, flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, NULL, alloca_used) == 0) break; /* If none of the patterns matched see whether the rest does. */ if (runp == NULL && (FCT (p, rs, string_end, rs == string ? no_leading_period : rs[-1] == '/' && NO_LEADING_PERIOD (flags), flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, NULL, alloca_used) == 0)) /* This is successful. */ goto success; } /* None of the patterns together with the rest of the pattern lead to a match. */ retval = FNM_NOMATCH; break; default: assert (! "Invalid extended matching operator"); retval = -1; break; } success: out: if (any_malloced) while (list != NULL) { struct patternlist *old = list; list = list->next; if (old->malloced) free (old); } return retval; } #undef FOLD #undef CHAR #undef UCHAR #undef INT #undef FCT #undef EXT #undef END #undef STRUCT #undef MEMPCPY #undef MEMCHR #undef STRLEN #undef STRCAT #undef L_ #undef BTOWC #undef WIDE_CHAR_VERSION #undef FINDIDX kbuild-3608/src/grep/lib/mbchar.c0000664000175000017500000000236214670377425016622 0ustar locutuslocutus/* Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #define MBCHAR_INLINE _GL_EXTERN_INLINE #include #include "mbchar.h" #if IS_BASIC_ASCII /* Bit table of characters in the ISO C "basic character set". */ const unsigned int is_basic_table [UCHAR_MAX / 32 + 1] = { 0x00001a00, /* '\t' '\v' '\f' */ 0xffffffef, /* ' '...'#' '%'...'?' */ 0xfffffffe, /* 'A'...'Z' '[' '\\' ']' '^' '_' */ 0x7ffffffe /* 'a'...'z' '{' '|' '}' '~' */ /* The remaining bits are 0. */ }; #endif /* IS_BASIC_ASCII */ kbuild-3608/src/grep/lib/wmempcpy.c0000664000175000017500000000210714670377426017225 0ustar locutuslocutus/* Copy wide character array, return pointer after last written wide character. Copyright (C) 2020-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include /* Copy N wide characters of SRC to DEST. Return pointer to wide characters after the last written wide character. */ wchar_t * wmempcpy (wchar_t *dest, const wchar_t *src, size_t n) { return wmemcpy (dest, src, n) + n; } kbuild-3608/src/grep/lib/wctomb-impl.h0000664000175000017500000000213414670377426017623 0ustar locutuslocutus/* Convert wide character to multibyte character. Copyright (C) 2011-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ int wctomb (char *s, wchar_t wc) { if (s == NULL) return 0; else { mbstate_t state; size_t result; memset (&state, 0, sizeof (mbstate_t)); result = wcrtomb (s, wc, &state); if (result == (size_t)-1) return -1; return result; } } kbuild-3608/src/grep/lib/c-strcasecmp.c0000664000175000017500000000306614670377422017751 0ustar locutuslocutus/* c-strcasecmp.c -- case insensitive string comparator in C locale Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "c-strcase.h" #include #include "c-ctype.h" int c_strcasecmp (const char *s1, const char *s2) { register const unsigned char *p1 = (const unsigned char *) s1; register const unsigned char *p2 = (const unsigned char *) s2; unsigned char c1, c2; if (p1 == p2) return 0; do { c1 = c_tolower (*p1); c2 = c_tolower (*p2); if (c1 == '\0') break; ++p1; ++p2; } while (c1 == c2); if (UCHAR_MAX <= INT_MAX) return c1 - c2; else /* On machines where 'char' and 'int' are types of the same size, the difference of two 'unsigned char' values - including the sign bit - doesn't fit in an 'int'. */ return _GL_CMP (c1, c2); } kbuild-3608/src/grep/lib/c-ctype.h0000664000175000017500000002246714670377422016744 0ustar locutuslocutus/* Character handling in C locale. These functions work like the corresponding functions in , except that they have the C (POSIX) locale hardwired, whereas the functions' behaviour depends on the current locale set via setlocale. Copyright (C) 2000-2003, 2006, 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef C_CTYPE_H #define C_CTYPE_H #include #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef C_CTYPE_INLINE # define C_CTYPE_INLINE _GL_INLINE #endif #ifdef __cplusplus extern "C" { #endif /* The functions defined in this file assume the "C" locale and a character set without diacritics (ASCII-US or EBCDIC-US or something like that). Even if the "C" locale on a particular system is an extension of the ASCII character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it is ISO-8859-1), the functions in this file recognize only the ASCII characters. */ #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) /* The character set is ASCII or one of its variants or extensions, not EBCDIC. Testing the value of '\n' and '\r' is not relevant. */ # define C_CTYPE_ASCII 1 #elif ! (' ' == '\x40' && '0' == '\xf0' \ && 'A' == '\xc1' && 'J' == '\xd1' && 'S' == '\xe2' \ && 'a' == '\x81' && 'j' == '\x91' && 's' == '\xa2') # error "Only ASCII and EBCDIC are supported" #endif #if 'A' < 0 # error "EBCDIC and char is signed -- not supported" #endif /* Cases for control characters. */ #define _C_CTYPE_CNTRL \ case '\a': case '\b': case '\f': case '\n': \ case '\r': case '\t': case '\v': \ _C_CTYPE_OTHER_CNTRL /* ASCII control characters other than those with \-letter escapes. */ #if C_CTYPE_ASCII # define _C_CTYPE_OTHER_CNTRL \ case '\x00': case '\x01': case '\x02': case '\x03': \ case '\x04': case '\x05': case '\x06': case '\x0e': \ case '\x0f': case '\x10': case '\x11': case '\x12': \ case '\x13': case '\x14': case '\x15': case '\x16': \ case '\x17': case '\x18': case '\x19': case '\x1a': \ case '\x1b': case '\x1c': case '\x1d': case '\x1e': \ case '\x1f': case '\x7f' #else /* Use EBCDIC code page 1047's assignments for ASCII control chars; assume all EBCDIC code pages agree about these assignments. */ # define _C_CTYPE_OTHER_CNTRL \ case '\x00': case '\x01': case '\x02': case '\x03': \ case '\x07': case '\x0e': case '\x0f': case '\x10': \ case '\x11': case '\x12': case '\x13': case '\x18': \ case '\x19': case '\x1c': case '\x1d': case '\x1e': \ case '\x1f': case '\x26': case '\x27': case '\x2d': \ case '\x2e': case '\x32': case '\x37': case '\x3c': \ case '\x3d': case '\x3f' #endif /* Cases for lowercase hex letters, and lowercase letters, all offset by N. */ #define _C_CTYPE_LOWER_A_THRU_F_N(N) \ case 'a' + (N): case 'b' + (N): case 'c' + (N): case 'd' + (N): \ case 'e' + (N): case 'f' + (N) #define _C_CTYPE_LOWER_N(N) \ _C_CTYPE_LOWER_A_THRU_F_N(N): \ case 'g' + (N): case 'h' + (N): case 'i' + (N): case 'j' + (N): \ case 'k' + (N): case 'l' + (N): case 'm' + (N): case 'n' + (N): \ case 'o' + (N): case 'p' + (N): case 'q' + (N): case 'r' + (N): \ case 's' + (N): case 't' + (N): case 'u' + (N): case 'v' + (N): \ case 'w' + (N): case 'x' + (N): case 'y' + (N): case 'z' + (N) /* Cases for hex letters, digits, lower, punct, and upper. */ #define _C_CTYPE_A_THRU_F \ _C_CTYPE_LOWER_A_THRU_F_N (0): \ _C_CTYPE_LOWER_A_THRU_F_N ('A' - 'a') #define _C_CTYPE_DIGIT \ case '0': case '1': case '2': case '3': \ case '4': case '5': case '6': case '7': \ case '8': case '9' #define _C_CTYPE_LOWER _C_CTYPE_LOWER_N (0) #define _C_CTYPE_PUNCT \ case '!': case '"': case '#': case '$': \ case '%': case '&': case '\'': case '(': \ case ')': case '*': case '+': case ',': \ case '-': case '.': case '/': case ':': \ case ';': case '<': case '=': case '>': \ case '?': case '@': case '[': case '\\': \ case ']': case '^': case '_': case '`': \ case '{': case '|': case '}': case '~' #define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a') /* Function definitions. */ /* Unlike the functions in , which require an argument in the range of the 'unsigned char' type, the functions here operate on values that are in the 'unsigned char' range or in the 'char' range. In other words, when you have a 'char' value, you need to cast it before using it as argument to a function: const char *s = ...; if (isalpha ((unsigned char) *s)) ... but you don't need to cast it for the functions defined in this file: const char *s = ...; if (c_isalpha (*s)) ... */ C_CTYPE_INLINE bool c_isalnum (int c) { switch (c) { _C_CTYPE_DIGIT: _C_CTYPE_LOWER: _C_CTYPE_UPPER: return true; default: return false; } } C_CTYPE_INLINE bool c_isalpha (int c) { switch (c) { _C_CTYPE_LOWER: _C_CTYPE_UPPER: return true; default: return false; } } /* The function isascii is not locale dependent. Its use in EBCDIC is questionable. */ C_CTYPE_INLINE bool c_isascii (int c) { switch (c) { case ' ': _C_CTYPE_CNTRL: _C_CTYPE_DIGIT: _C_CTYPE_LOWER: _C_CTYPE_PUNCT: _C_CTYPE_UPPER: return true; default: return false; } } C_CTYPE_INLINE bool c_isblank (int c) { return c == ' ' || c == '\t'; } C_CTYPE_INLINE bool c_iscntrl (int c) { switch (c) { _C_CTYPE_CNTRL: return true; default: return false; } } C_CTYPE_INLINE bool c_isdigit (int c) { switch (c) { _C_CTYPE_DIGIT: return true; default: return false; } } C_CTYPE_INLINE bool c_isgraph (int c) { switch (c) { _C_CTYPE_DIGIT: _C_CTYPE_LOWER: _C_CTYPE_PUNCT: _C_CTYPE_UPPER: return true; default: return false; } } C_CTYPE_INLINE bool c_islower (int c) { switch (c) { _C_CTYPE_LOWER: return true; default: return false; } } C_CTYPE_INLINE bool c_isprint (int c) { switch (c) { case ' ': _C_CTYPE_DIGIT: _C_CTYPE_LOWER: _C_CTYPE_PUNCT: _C_CTYPE_UPPER: return true; default: return false; } } C_CTYPE_INLINE bool c_ispunct (int c) { switch (c) { _C_CTYPE_PUNCT: return true; default: return false; } } C_CTYPE_INLINE bool c_isspace (int c) { switch (c) { case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': return true; default: return false; } } C_CTYPE_INLINE bool c_isupper (int c) { switch (c) { _C_CTYPE_UPPER: return true; default: return false; } } C_CTYPE_INLINE bool c_isxdigit (int c) { switch (c) { _C_CTYPE_DIGIT: _C_CTYPE_A_THRU_F: return true; default: return false; } } C_CTYPE_INLINE int c_tolower (int c) { switch (c) { _C_CTYPE_UPPER: return c - 'A' + 'a'; default: return c; } } C_CTYPE_INLINE int c_toupper (int c) { switch (c) { _C_CTYPE_LOWER: return c - 'a' + 'A'; default: return c; } } #ifdef __cplusplus } #endif _GL_INLINE_HEADER_END #endif /* C_CTYPE_H */ kbuild-3608/src/grep/lib/stat.c0000664000175000017500000003276514670377426016354 0ustar locutuslocutus/* Work around platform bugs in stat. Copyright (C) 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Eric Blake and Bruno Haible. */ /* If the user's config.h happens to include , let it include only the system's here, so that orig_stat doesn't recurse to rpl_stat. */ #define __need_system_sys_stat_h #include /* Get the original definition of stat. It might be defined as a macro. */ #include #include #undef __need_system_sys_stat_h #if defined _WIN32 && ! defined __CYGWIN__ # define WINDOWS_NATIVE #endif #if !defined WINDOWS_NATIVE static int orig_stat (const char *filename, struct stat *buf) { return stat (filename, buf); } #endif /* Specification. */ #ifdef __osf__ /* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include above. */ # include "sys/stat.h" #else # include #endif #include "stat-time.h" #include #include #include #include #include "filename.h" #include "malloca.h" #include "verify.h" #ifdef WINDOWS_NATIVE # define WIN32_LEAN_AND_MEAN # include # include "stat-w32.h" /* Don't assume that UNICODE is not defined. */ # undef WIN32_FIND_DATA # define WIN32_FIND_DATA WIN32_FIND_DATAA # undef CreateFile # define CreateFile CreateFileA # undef FindFirstFile # define FindFirstFile FindFirstFileA #endif #ifdef WINDOWS_NATIVE /* Return TRUE if the given file name denotes an UNC root. */ static BOOL is_unc_root (const char *rname) { /* Test whether it has the syntax '\\server\share'. */ if (ISSLASH (rname[0]) && ISSLASH (rname[1])) { /* It starts with two slashes. Find the next slash. */ const char *p = rname + 2; const char *q = p; while (*q != '\0' && !ISSLASH (*q)) q++; if (q > p && *q != '\0') { /* Found the next slash at q. */ q++; const char *r = q; while (*r != '\0' && !ISSLASH (*r)) r++; if (r > q && *r == '\0') return TRUE; } } return FALSE; } #endif /* Store information about NAME into ST. Work around bugs with trailing slashes. Mingw has other bugs (such as st_ino always being 0 on success) which this wrapper does not work around. But at least this implementation provides the ability to emulate fchdir correctly. */ int rpl_stat (char const *name, struct stat *buf) { #ifdef WINDOWS_NATIVE /* Fill the fields ourselves, because the original stat function returns values for st_atime, st_mtime, st_ctime that depend on the current time zone. See */ /* XXX Should we convert to wchar_t* and prepend '\\?\', in order to work around length limitations ? */ /* POSIX specifies: "More than two leading characters shall be treated as a single character." */ if (ISSLASH (name[0]) && ISSLASH (name[1]) && ISSLASH (name[2])) { name += 2; while (ISSLASH (name[1])) name++; } size_t len = strlen (name); size_t drive_prefix_len = (HAS_DEVICE (name) ? 2 : 0); /* Remove trailing slashes (except the very first one, at position drive_prefix_len), but remember their presence. */ size_t rlen; bool check_dir = false; rlen = len; while (rlen > drive_prefix_len && ISSLASH (name[rlen-1])) { check_dir = true; if (rlen == drive_prefix_len + 1) break; rlen--; } /* Handle '' and 'C:'. */ if (!check_dir && rlen == drive_prefix_len) { errno = ENOENT; return -1; } /* Handle '\\'. */ if (rlen == 1 && ISSLASH (name[0]) && len >= 2) { errno = ENOENT; return -1; } const char *rname; char *malloca_rname; if (rlen == len) { rname = name; malloca_rname = NULL; } else { malloca_rname = malloca (rlen + 1); if (malloca_rname == NULL) { errno = ENOMEM; return -1; } memcpy (malloca_rname, name, rlen); malloca_rname[rlen] = '\0'; rname = malloca_rname; } /* There are two ways to get at the requested information: - by scanning the parent directory and examining the relevant directory entry, - by opening the file directly. The first approach fails for root directories (e.g. 'C:\') and UNC root directories (e.g. '\\server\share'). The second approach fails for some system files (e.g. 'C:\pagefile.sys' and 'C:\hiberfil.sys'): ERROR_SHARING_VIOLATION. The second approach gives more information (in particular, correct st_dev, st_ino, st_nlink fields). So we use the second approach and, as a fallback except for root and UNC root directories, also the first approach. */ { int ret; { /* Approach based on the file. */ /* Open a handle to the file. CreateFile */ HANDLE h = CreateFile (rname, FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, /* FILE_FLAG_POSIX_SEMANTICS (treat file names that differ only in case as different) makes sense only when applied to *all* filesystem operations. */ FILE_FLAG_BACKUP_SEMANTICS /* | FILE_FLAG_POSIX_SEMANTICS */, NULL); if (h != INVALID_HANDLE_VALUE) { ret = _gl_fstat_by_handle (h, rname, buf); CloseHandle (h); goto done; } } /* Test for root and UNC root directories. */ if ((rlen == drive_prefix_len + 1 && ISSLASH (rname[drive_prefix_len])) || is_unc_root (rname)) goto failed; /* Fallback. */ { /* Approach based on the directory entry. */ if (strchr (rname, '?') != NULL || strchr (rname, '*') != NULL) { /* Other Windows API functions would fail with error ERROR_INVALID_NAME. */ if (malloca_rname != NULL) freea (malloca_rname); errno = ENOENT; return -1; } /* Get the details about the directory entry. This can be done through FindFirstFile or through FindFirstFileEx with argument FindExInfoBasic */ WIN32_FIND_DATA info; HANDLE h = FindFirstFile (rname, &info); if (h == INVALID_HANDLE_VALUE) goto failed; /* Test for error conditions before starting to fill *buf. */ if (sizeof (buf->st_size) <= 4 && info.nFileSizeHigh > 0) { FindClose (h); if (malloca_rname != NULL) freea (malloca_rname); errno = EOVERFLOW; return -1; } # if _GL_WINDOWS_STAT_INODES buf->st_dev = 0; # if _GL_WINDOWS_STAT_INODES == 2 buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0; # else /* _GL_WINDOWS_STAT_INODES == 1 */ buf->st_ino = 0; # endif # else /* st_ino is not wide enough for identifying a file on a device. Without st_ino, st_dev is pointless. */ buf->st_dev = 0; buf->st_ino = 0; # endif /* st_mode. */ unsigned int mode = /* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ? */ ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG) | S_IREAD_UGO | ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO); if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { /* Determine whether the file is executable by looking at the file name suffix. */ if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) { const char *last_dot = NULL; const char *p; for (p = info.cFileName; *p != '\0'; p++) if (*p == '.') last_dot = p; if (last_dot != NULL) { const char *suffix = last_dot + 1; if (_stricmp (suffix, "exe") == 0 || _stricmp (suffix, "bat") == 0 || _stricmp (suffix, "cmd") == 0 || _stricmp (suffix, "com") == 0) mode |= S_IEXEC_UGO; } } } buf->st_mode = mode; /* st_nlink. Ignore hard links here. */ buf->st_nlink = 1; /* There's no easy way to map the Windows SID concept to an integer. */ buf->st_uid = 0; buf->st_gid = 0; /* st_rdev is irrelevant for normal files and directories. */ buf->st_rdev = 0; /* st_size. */ if (sizeof (buf->st_size) <= 4) /* Range check already done above. */ buf->st_size = info.nFileSizeLow; else buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow; /* st_atime, st_mtime, st_ctime. */ # if _GL_WINDOWS_STAT_TIMESPEC buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime); buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime); buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime); # else buf->st_atime = _gl_convert_FILETIME_to_POSIX (&info.ftLastAccessTime); buf->st_mtime = _gl_convert_FILETIME_to_POSIX (&info.ftLastWriteTime); buf->st_ctime = _gl_convert_FILETIME_to_POSIX (&info.ftCreationTime); # endif FindClose (h); ret = 0; } done: if (ret >= 0 && check_dir && !S_ISDIR (buf->st_mode)) { errno = ENOTDIR; ret = -1; } if (malloca_rname != NULL) { int saved_errno = errno; freea (malloca_rname); errno = saved_errno; } return ret; } failed: { DWORD error = GetLastError (); #if 0 fprintf (stderr, "rpl_stat error 0x%x\n", (unsigned int) error); #endif if (malloca_rname != NULL) freea (malloca_rname); switch (error) { /* Some of these errors probably cannot happen with the specific flags that we pass to CreateFile. But who knows... */ case ERROR_FILE_NOT_FOUND: /* The last component of rname does not exist. */ case ERROR_PATH_NOT_FOUND: /* Some directory component in rname does not exist. */ case ERROR_BAD_PATHNAME: /* rname is such as '\\server'. */ case ERROR_BAD_NET_NAME: /* rname is such as '\\server\nonexistentshare'. */ case ERROR_INVALID_NAME: /* rname contains wildcards, misplaced colon, etc. */ case ERROR_DIRECTORY: errno = ENOENT; break; case ERROR_ACCESS_DENIED: /* rname is such as 'C:\System Volume Information\foo'. */ case ERROR_SHARING_VIOLATION: /* rname is such as 'C:\pagefile.sys' (second approach only). */ /* XXX map to EACCES or EPERM? */ errno = EACCES; break; case ERROR_OUTOFMEMORY: errno = ENOMEM; break; case ERROR_WRITE_PROTECT: errno = EROFS; break; case ERROR_WRITE_FAULT: case ERROR_READ_FAULT: case ERROR_GEN_FAILURE: errno = EIO; break; case ERROR_BUFFER_OVERFLOW: case ERROR_FILENAME_EXCED_RANGE: errno = ENAMETOOLONG; break; case ERROR_DELETE_PENDING: /* XXX map to EACCES or EPERM? */ errno = EPERM; break; default: errno = EINVAL; break; } return -1; } #else int result = orig_stat (name, buf); if (result == 0) { # if REPLACE_FUNC_STAT_FILE /* Solaris 9 mistakenly succeeds when given a non-directory with a trailing slash. */ if (!S_ISDIR (buf->st_mode)) { size_t len = strlen (name); if (ISSLASH (name[len - 1])) { errno = ENOTDIR; return -1; } } # endif /* REPLACE_FUNC_STAT_FILE */ result = stat_time_normalize (result, buf); } return result; #endif } kbuild-3608/src/grep/lib/dirname-lgpl.c0000664000175000017500000000614214670377422017736 0ustar locutuslocutus/* dirname.c -- return all but the last element in a file name Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include "dirname.h" #include #include /* Return the length of the prefix of FILE that will be used by dir_name. If FILE is in the working directory, this returns zero even though 'dir_name (FILE)' will return ".". Works properly even if there are trailing slashes (by effectively ignoring them). */ size_t dir_len (char const *file) { size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); size_t length; /* Advance prefix_length beyond important leading slashes. */ prefix_length += (prefix_length != 0 ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && ISSLASH (file[prefix_length])) : (ISSLASH (file[0]) ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT && ISSLASH (file[1]) && ! ISSLASH (file[2]) ? 2 : 1)) : 0)); /* Strip the basename and any redundant slashes before it. */ for (length = last_component (file) - file; prefix_length < length; length--) if (! ISSLASH (file[length - 1])) break; return length; } /* In general, we can't use the builtin 'dirname' function if available, since it has different meanings in different environments. In some environments the builtin 'dirname' modifies its argument. Return the leading directories part of FILE, allocated with malloc. Works properly even if there are trailing slashes (by effectively ignoring them). Return NULL on failure. If lstat (FILE) would succeed, then { chdir (dir_name (FILE)); lstat (base_name (FILE)); } will access the same file. Likewise, if the sequence { chdir (dir_name (FILE)); rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE to "foo" in the same directory FILE was in. */ char * mdir_name (char const *file) { size_t length = dir_len (file); bool append_dot = (length == 0 || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && length == FILE_SYSTEM_PREFIX_LEN (file) && file[2] != '\0' && ! ISSLASH (file[2]))); char *dir = malloc (length + append_dot + 1); if (!dir) return NULL; memcpy (dir, file, length); if (append_dot) dir[length++] = '.'; dir[length] = '\0'; return dir; } kbuild-3608/src/grep/lib/iswdigit.c0000664000175000017500000000157414670377424017214 0ustar locutuslocutus/* Test wide character for being a digit. Copyright (C) 2020-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include int iswdigit (wint_t wc) { return wc >= '0' && wc <= '9'; } kbuild-3608/src/grep/lib/iconv_open-irix.h0000664000175000017500000001715414670377423020506 0ustar locutuslocutus/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -m 10 ./iconv_open-irix.gperf */ /* Computed positions: -k'1,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 17 "./iconv_open-irix.gperf" struct mapping { int standard_name; const char vendor_name[10 + 1]; }; #define TOTAL_KEYWORDS 19 #define MIN_WORD_LENGTH 5 #define MAX_WORD_LENGTH 11 #define MIN_HASH_VALUE 5 #define MAX_HASH_VALUE 23 /* maximum key range = 19, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int mapping_hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 8, 2, 5, 12, 11, 0, 10, 9, 8, 7, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 24, 0, 24, 5, 24, 0, 24, 7, 24, 24, 24, 24, 7, 24, 1, 0, 8, 24, 24, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 }; return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; } struct stringpool_t { char stringpool_str5[sizeof("CP855")]; char stringpool_str6[sizeof("EUC-TW")]; char stringpool_str7[sizeof("EUC-KR")]; char stringpool_str8[sizeof("CP1251")]; char stringpool_str9[sizeof("SHIFT_JIS")]; char stringpool_str10[sizeof("ISO-8859-5")]; char stringpool_str11[sizeof("ISO-8859-15")]; char stringpool_str12[sizeof("ISO-8859-1")]; char stringpool_str13[sizeof("EUC-JP")]; char stringpool_str14[sizeof("KOI8-R")]; char stringpool_str15[sizeof("ISO-8859-2")]; char stringpool_str16[sizeof("GB2312")]; char stringpool_str17[sizeof("ISO-8859-9")]; char stringpool_str18[sizeof("ISO-8859-8")]; char stringpool_str19[sizeof("ISO-8859-7")]; char stringpool_str20[sizeof("ISO-8859-6")]; char stringpool_str21[sizeof("ISO-8859-4")]; char stringpool_str22[sizeof("ISO-8859-3")]; char stringpool_str23[sizeof("TIS-620")]; }; static const struct stringpool_t stringpool_contents = { "CP855", "EUC-TW", "EUC-KR", "CP1251", "SHIFT_JIS", "ISO-8859-5", "ISO-8859-15", "ISO-8859-1", "EUC-JP", "KOI8-R", "ISO-8859-2", "GB2312", "ISO-8859-9", "ISO-8859-8", "ISO-8859-7", "ISO-8859-6", "ISO-8859-4", "ISO-8859-3", "TIS-620" }; #define stringpool ((const char *) &stringpool_contents) static const struct mapping mappings[] = { {-1}, {-1}, {-1}, {-1}, {-1}, #line 40 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str5, "DOS855"}, #line 45 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "eucTW"}, #line 44 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, "eucKR"}, #line 41 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, "WIN1251"}, #line 46 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, "sjis"}, #line 33 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-5"}, #line 38 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "ISO8859-15"}, #line 29 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-1"}, #line 43 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "eucJP"}, #line 39 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "KOI8"}, #line 30 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "ISO8859-2"}, #line 42 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "eucCN"}, #line 37 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "ISO8859-9"}, #line 36 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "ISO8859-8"}, #line 35 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-7"}, #line 34 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, "ISO8859-6"}, #line 32 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, "ISO8859-4"}, #line 31 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, "ISO8859-3"}, #line 47 "./iconv_open-irix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, "TIS620"} }; const struct mapping * mapping_lookup (register const char *str, register size_t len) { if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = mapping_hash (str, len); if (key <= MAX_HASH_VALUE) { register int o = mappings[key].standard_name; if (o >= 0) { register const char *s = o + stringpool; if (*str == *s && !strcmp (str + 1, s + 1)) return &mappings[key]; } } } return 0; } kbuild-3608/src/grep/lib/iconv_open-solaris.h0000664000175000017500000001550714670377424021210 0ustar locutuslocutus/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -m 10 ./iconv_open-solaris.gperf */ /* Computed positions: -k'10' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 17 "./iconv_open-solaris.gperf" struct mapping { int standard_name; const char vendor_name[10 + 1]; }; #define TOTAL_KEYWORDS 13 #define MIN_WORD_LENGTH 5 #define MAX_WORD_LENGTH 11 #define MIN_HASH_VALUE 5 #define MAX_HASH_VALUE 19 /* maximum key range = 15, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int mapping_hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 9, 8, 7, 6, 5, 4, 3, 2, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 }; register unsigned int hval = len; switch (hval) { default: hval += asso_values[(unsigned char)str[9]]; /*FALLTHROUGH*/ case 9: case 8: case 7: case 6: case 5: break; } return hval; } struct stringpool_t { char stringpool_str5[sizeof("ASCII")]; char stringpool_str6[sizeof("CP1251")]; char stringpool_str7[sizeof("$ abc")]; char stringpool_str10[sizeof("ISO-8859-1")]; char stringpool_str11[sizeof("ISO-8859-15")]; char stringpool_str12[sizeof("ISO-8859-9")]; char stringpool_str13[sizeof("ISO-8859-8")]; char stringpool_str14[sizeof("ISO-8859-7")]; char stringpool_str15[sizeof("ISO-8859-6")]; char stringpool_str16[sizeof("ISO-8859-5")]; char stringpool_str17[sizeof("ISO-8859-4")]; char stringpool_str18[sizeof("ISO-8859-3")]; char stringpool_str19[sizeof("ISO-8859-2")]; }; static const struct stringpool_t stringpool_contents = { "ASCII", "CP1251", "$ abc", "ISO-8859-1", "ISO-8859-15", "ISO-8859-9", "ISO-8859-8", "ISO-8859-7", "ISO-8859-6", "ISO-8859-5", "ISO-8859-4", "ISO-8859-3", "ISO-8859-2" }; #define stringpool ((const char *) &stringpool_contents) static const struct mapping mappings[] = { {-1}, {-1}, {-1}, {-1}, {-1}, #line 35 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str5, "646"}, #line 46 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "ansi-1251"}, #line 34 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7}, {-1}, {-1}, #line 36 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-1"}, #line 45 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "ISO8859-15"}, #line 44 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-9"}, #line 43 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-8"}, #line 42 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "ISO8859-7"}, #line 41 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "ISO8859-6"}, #line 40 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "ISO8859-5"}, #line 39 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "ISO8859-4"}, #line 38 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "ISO8859-3"}, #line 37 "./iconv_open-solaris.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-2"} }; const struct mapping * mapping_lookup (register const char *str, register size_t len) { if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = mapping_hash (str, len); if (key <= MAX_HASH_VALUE) { register int o = mappings[key].standard_name; if (o >= 0) { register const char *s = o + stringpool; if (*str == *s && !strcmp (str + 1, s + 1)) return &mappings[key]; } } } return 0; } kbuild-3608/src/grep/lib/localcharset.c0000664000175000017500000011572214670377424020036 0ustar locutuslocutus/* Determine a canonical name for the current locale's character encoding. Copyright (C) 2000-2006, 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible . */ #include /* Specification. */ #include "localcharset.h" #include #include #include #include #if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET # define DARWIN7 /* Darwin 7 or newer, i.e. Mac OS X 10.3 or newer */ #endif #if defined _WIN32 && !defined __CYGWIN__ # define WINDOWS_NATIVE # include #endif #if defined __EMX__ /* Assume EMX program runs on OS/2, even if compiled under DOS. */ # ifndef OS2 # define OS2 # endif #endif #if !defined WINDOWS_NATIVE # if HAVE_LANGINFO_CODESET # include # else # if 0 /* see comment regarding use of setlocale(), below */ # include # endif # endif # ifdef __CYGWIN__ # define WIN32_LEAN_AND_MEAN # include # endif #elif defined WINDOWS_NATIVE # define WIN32_LEAN_AND_MEAN # include /* For the use of setlocale() below, the Gnulib override in setlocale.c is not needed; see the platform lists in setlocale_null.m4. */ # undef setlocale #endif #if defined OS2 # define INCL_DOS # include #endif /* For MB_CUR_MAX_L */ #if defined DARWIN7 # include #endif #if HAVE_LANGINFO_CODESET || defined WINDOWS_NATIVE || defined OS2 /* On these platforms, we use a mapping from non-canonical encoding name to GNU canonical encoding name. */ /* 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. */ # if !((defined __GNU_LIBRARY__ && __GLIBC__ >= 2) || defined __UCLIBC__) struct table_entry { const char alias[11+1]; const char canonical[11+1]; }; /* Table of platform-dependent mappings, sorted in ascending order. */ static const struct table_entry alias_table[] = { # if defined __FreeBSD__ /* FreeBSD */ /*{ "ARMSCII-8", "ARMSCII-8" },*/ { "Big5", "BIG5" }, { "C", "ASCII" }, /*{ "CP1131", "CP1131" },*/ /*{ "CP1251", "CP1251" },*/ /*{ "CP866", "CP866" },*/ /*{ "GB18030", "GB18030" },*/ /*{ "GB2312", "GB2312" },*/ /*{ "GBK", "GBK" },*/ /*{ "ISCII-DEV", "?" },*/ { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-13", "ISO-8859-13" }, { "ISO8859-15", "ISO-8859-15" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-7", "ISO-8859-7" }, { "ISO8859-9", "ISO-8859-9" }, /*{ "KOI8-R", "KOI8-R" },*/ /*{ "KOI8-U", "KOI8-U" },*/ { "SJIS", "SHIFT_JIS" }, { "US-ASCII", "ASCII" }, { "eucCN", "GB2312" }, { "eucJP", "EUC-JP" }, { "eucKR", "EUC-KR" } # define alias_table_defined # endif # if defined __NetBSD__ /* NetBSD */ { "646", "ASCII" }, /*{ "ARMSCII-8", "ARMSCII-8" },*/ /*{ "BIG5", "BIG5" },*/ { "Big5-HKSCS", "BIG5-HKSCS" }, /*{ "CP1251", "CP1251" },*/ /*{ "CP866", "CP866" },*/ /*{ "GB18030", "GB18030" },*/ /*{ "GB2312", "GB2312" },*/ { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-13", "ISO-8859-13" }, { "ISO8859-15", "ISO-8859-15" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-4", "ISO-8859-4" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-7", "ISO-8859-7" }, /*{ "KOI8-R", "KOI8-R" },*/ /*{ "KOI8-U", "KOI8-U" },*/ /*{ "PT154", "PT154" },*/ { "SJIS", "SHIFT_JIS" }, { "eucCN", "GB2312" }, { "eucJP", "EUC-JP" }, { "eucKR", "EUC-KR" }, { "eucTW", "EUC-TW" } # define alias_table_defined # endif # if defined __OpenBSD__ /* OpenBSD */ { "646", "ASCII" }, { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-13", "ISO-8859-13" }, { "ISO8859-15", "ISO-8859-15" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-4", "ISO-8859-4" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-7", "ISO-8859-7" }, { "US-ASCII", "ASCII" } # define alias_table_defined # endif # if defined __APPLE__ && defined __MACH__ /* Mac OS X */ /* Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is useless: - It returns the empty string when LANG is set to a locale of the form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8 LC_CTYPE file. - The environment variables LANG, LC_CTYPE, LC_ALL are not set by the system; nl_langinfo(CODESET) returns "US-ASCII" in this case. - The documentation says: "... all code that calls BSD system routines should ensure that the const *char parameters of these routines are in UTF-8 encoding. All BSD system functions expect their string parameters to be in UTF-8 encoding and nothing else." It also says "An additional caveat is that string parameters for files, paths, and other file-system entities must be in canonical UTF-8. In a canonical UTF-8 Unicode string, all decomposable characters are decomposed ..." but this is not true: You can pass non-decomposed UTF-8 strings to file system functions, and it is the OS which will convert them to decomposed UTF-8 before accessing the file system. - The Apple Terminal application displays UTF-8 by default. - However, other applications are free to use different encodings: - xterm uses ISO-8859-1 by default. - TextEdit uses MacRoman by default. We prefer UTF-8 over decomposed UTF-8-MAC because one should minimize the use of decomposed Unicode. Unfortunately, through the Darwin file system, decomposed UTF-8 strings are leaked into user space nevertheless. Then there are also the locales with encodings other than US-ASCII and UTF-8. These locales can be occasionally useful to users (e.g. when grepping through ISO-8859-1 encoded text files), when all their file names are in US-ASCII. */ { "ARMSCII-8", "ARMSCII-8" }, { "Big5", "BIG5" }, { "Big5HKSCS", "BIG5-HKSCS" }, { "CP1131", "CP1131" }, { "CP1251", "CP1251" }, { "CP866", "CP866" }, { "CP949", "CP949" }, { "GB18030", "GB18030" }, { "GB2312", "GB2312" }, { "GBK", "GBK" }, /*{ "ISCII-DEV", "?" },*/ { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-13", "ISO-8859-13" }, { "ISO8859-15", "ISO-8859-15" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-4", "ISO-8859-4" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-7", "ISO-8859-7" }, { "ISO8859-9", "ISO-8859-9" }, { "KOI8-R", "KOI8-R" }, { "KOI8-U", "KOI8-U" }, { "PT154", "PT154" }, { "SJIS", "SHIFT_JIS" }, { "eucCN", "GB2312" }, { "eucJP", "EUC-JP" }, { "eucKR", "EUC-KR" } # define alias_table_defined # endif # if defined _AIX /* AIX */ /*{ "GBK", "GBK" },*/ { "IBM-1046", "CP1046" }, { "IBM-1124", "CP1124" }, { "IBM-1129", "CP1129" }, { "IBM-1252", "CP1252" }, { "IBM-850", "CP850" }, { "IBM-856", "CP856" }, { "IBM-921", "ISO-8859-13" }, { "IBM-922", "CP922" }, { "IBM-932", "CP932" }, { "IBM-943", "CP943" }, { "IBM-eucCN", "GB2312" }, { "IBM-eucJP", "EUC-JP" }, { "IBM-eucKR", "EUC-KR" }, { "IBM-eucTW", "EUC-TW" }, { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-15", "ISO-8859-15" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-6", "ISO-8859-6" }, { "ISO8859-7", "ISO-8859-7" }, { "ISO8859-8", "ISO-8859-8" }, { "ISO8859-9", "ISO-8859-9" }, { "TIS-620", "TIS-620" }, /*{ "UTF-8", "UTF-8" },*/ { "big5", "BIG5" } # define alias_table_defined # endif # if defined __hpux /* HP-UX */ { "SJIS", "SHIFT_JIS" }, { "arabic8", "HP-ARABIC8" }, { "big5", "BIG5" }, { "cp1251", "CP1251" }, { "eucJP", "EUC-JP" }, { "eucKR", "EUC-KR" }, { "eucTW", "EUC-TW" }, { "gb18030", "GB18030" }, { "greek8", "HP-GREEK8" }, { "hebrew8", "HP-HEBREW8" }, { "hkbig5", "BIG5-HKSCS" }, { "hp15CN", "GB2312" }, { "iso88591", "ISO-8859-1" }, { "iso885913", "ISO-8859-13" }, { "iso885915", "ISO-8859-15" }, { "iso88592", "ISO-8859-2" }, { "iso88594", "ISO-8859-4" }, { "iso88595", "ISO-8859-5" }, { "iso88596", "ISO-8859-6" }, { "iso88597", "ISO-8859-7" }, { "iso88598", "ISO-8859-8" }, { "iso88599", "ISO-8859-9" }, { "kana8", "HP-KANA8" }, { "koi8r", "KOI8-R" }, { "roman8", "HP-ROMAN8" }, { "tis620", "TIS-620" }, { "turkish8", "HP-TURKISH8" }, { "utf8", "UTF-8" } # define alias_table_defined # endif # if defined __sgi /* IRIX */ { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-15", "ISO-8859-15" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-7", "ISO-8859-7" }, { "ISO8859-9", "ISO-8859-9" }, { "eucCN", "GB2312" }, { "eucJP", "EUC-JP" }, { "eucKR", "EUC-KR" }, { "eucTW", "EUC-TW" } # define alias_table_defined # endif # if defined __osf__ /* OSF/1 */ /*{ "GBK", "GBK" },*/ { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-15", "ISO-8859-15" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-4", "ISO-8859-4" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-7", "ISO-8859-7" }, { "ISO8859-8", "ISO-8859-8" }, { "ISO8859-9", "ISO-8859-9" }, { "KSC5601", "CP949" }, { "SJIS", "SHIFT_JIS" }, { "TACTIS", "TIS-620" }, /*{ "UTF-8", "UTF-8" },*/ { "big5", "BIG5" }, { "cp850", "CP850" }, { "dechanyu", "DEC-HANYU" }, { "dechanzi", "GB2312" }, { "deckanji", "DEC-KANJI" }, { "deckorean", "EUC-KR" }, { "eucJP", "EUC-JP" }, { "eucKR", "EUC-KR" }, { "eucTW", "EUC-TW" }, { "sdeckanji", "EUC-JP" } # define alias_table_defined # endif # if defined __sun /* Solaris */ { "5601", "EUC-KR" }, { "646", "ASCII" }, /*{ "BIG5", "BIG5" },*/ { "Big5-HKSCS", "BIG5-HKSCS" }, { "GB18030", "GB18030" }, /*{ "GBK", "GBK" },*/ { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-11", "TIS-620" }, { "ISO8859-13", "ISO-8859-13" }, { "ISO8859-15", "ISO-8859-15" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-3", "ISO-8859-3" }, { "ISO8859-4", "ISO-8859-4" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-6", "ISO-8859-6" }, { "ISO8859-7", "ISO-8859-7" }, { "ISO8859-8", "ISO-8859-8" }, { "ISO8859-9", "ISO-8859-9" }, { "PCK", "SHIFT_JIS" }, { "TIS620.2533", "TIS-620" }, /*{ "UTF-8", "UTF-8" },*/ { "ansi-1251", "CP1251" }, { "cns11643", "EUC-TW" }, { "eucJP", "EUC-JP" }, { "gb2312", "GB2312" }, { "koi8-r", "KOI8-R" } # define alias_table_defined # endif # if defined __minix /* Minix */ { "646", "ASCII" } # define alias_table_defined # endif # if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Windows */ { "CP1361", "JOHAB" }, { "CP20127", "ASCII" }, { "CP20866", "KOI8-R" }, { "CP20936", "GB2312" }, { "CP21866", "KOI8-RU" }, { "CP28591", "ISO-8859-1" }, { "CP28592", "ISO-8859-2" }, { "CP28593", "ISO-8859-3" }, { "CP28594", "ISO-8859-4" }, { "CP28595", "ISO-8859-5" }, { "CP28596", "ISO-8859-6" }, { "CP28597", "ISO-8859-7" }, { "CP28598", "ISO-8859-8" }, { "CP28599", "ISO-8859-9" }, { "CP28605", "ISO-8859-15" }, { "CP38598", "ISO-8859-8" }, { "CP51932", "EUC-JP" }, { "CP51936", "GB2312" }, { "CP51949", "EUC-KR" }, { "CP51950", "EUC-TW" }, { "CP54936", "GB18030" }, { "CP65001", "UTF-8" }, { "CP936", "GBK" } # define alias_table_defined # endif # if defined OS2 /* OS/2 */ /* The list of encodings is taken from "List of OS/2 Codepages" by Alex Taylor: . See also "__convcp() of kLIBC": . */ { "CP1004", "CP1252" }, /*{ "CP1041", "CP943" },*/ /*{ "CP1088", "CP949" },*/ { "CP1089", "ISO-8859-6" }, /*{ "CP1114", "CP950" },*/ /*{ "CP1115", "GB2312" },*/ { "CP1208", "UTF-8" }, /*{ "CP1380", "GB2312" },*/ { "CP1381", "GB2312" }, { "CP1383", "GB2312" }, { "CP1386", "GBK" }, /*{ "CP301", "CP943" },*/ { "CP3372", "EUC-JP" }, { "CP4946", "CP850" }, /*{ "CP5048", "JIS_X0208-1990" },*/ /*{ "CP5049", "JIS_X0212-1990" },*/ /*{ "CP5067", "KS_C_5601-1987" },*/ { "CP813", "ISO-8859-7" }, { "CP819", "ISO-8859-1" }, { "CP878", "KOI8-R" }, /*{ "CP897", "CP943" },*/ { "CP912", "ISO-8859-2" }, { "CP913", "ISO-8859-3" }, { "CP914", "ISO-8859-4" }, { "CP915", "ISO-8859-5" }, { "CP916", "ISO-8859-8" }, { "CP920", "ISO-8859-9" }, { "CP921", "ISO-8859-13" }, { "CP923", "ISO-8859-15" }, /*{ "CP941", "CP943" },*/ /*{ "CP947", "CP950" },*/ /*{ "CP951", "CP949" },*/ /*{ "CP952", "JIS_X0208-1990" },*/ /*{ "CP953", "JIS_X0212-1990" },*/ { "CP954", "EUC-JP" }, { "CP964", "EUC-TW" }, { "CP970", "EUC-KR" }, /*{ "CP971", "KS_C_5601-1987" },*/ { "IBM-1004", "CP1252" }, /*{ "IBM-1006", "?" },*/ /*{ "IBM-1008", "?" },*/ /*{ "IBM-1041", "CP943" },*/ /*{ "IBM-1051", "?" },*/ /*{ "IBM-1088", "CP949" },*/ { "IBM-1089", "ISO-8859-6" }, /*{ "IBM-1098", "?" },*/ /*{ "IBM-1114", "CP950" },*/ /*{ "IBM-1115", "GB2312" },*/ /*{ "IBM-1116", "?" },*/ /*{ "IBM-1117", "?" },*/ /*{ "IBM-1118", "?" },*/ /*{ "IBM-1119", "?" },*/ { "IBM-1124", "CP1124" }, { "IBM-1125", "CP1125" }, { "IBM-1131", "CP1131" }, { "IBM-1208", "UTF-8" }, { "IBM-1250", "CP1250" }, { "IBM-1251", "CP1251" }, { "IBM-1252", "CP1252" }, { "IBM-1253", "CP1253" }, { "IBM-1254", "CP1254" }, { "IBM-1255", "CP1255" }, { "IBM-1256", "CP1256" }, { "IBM-1257", "CP1257" }, /*{ "IBM-1275", "?" },*/ /*{ "IBM-1276", "?" },*/ /*{ "IBM-1277", "?" },*/ /*{ "IBM-1280", "?" },*/ /*{ "IBM-1281", "?" },*/ /*{ "IBM-1282", "?" },*/ /*{ "IBM-1283", "?" },*/ /*{ "IBM-1380", "GB2312" },*/ { "IBM-1381", "GB2312" }, { "IBM-1383", "GB2312" }, { "IBM-1386", "GBK" }, /*{ "IBM-301", "CP943" },*/ { "IBM-3372", "EUC-JP" }, { "IBM-367", "ASCII" }, { "IBM-437", "CP437" }, { "IBM-4946", "CP850" }, /*{ "IBM-5048", "JIS_X0208-1990" },*/ /*{ "IBM-5049", "JIS_X0212-1990" },*/ /*{ "IBM-5067", "KS_C_5601-1987" },*/ { "IBM-813", "ISO-8859-7" }, { "IBM-819", "ISO-8859-1" }, { "IBM-850", "CP850" }, /*{ "IBM-851", "?" },*/ { "IBM-852", "CP852" }, { "IBM-855", "CP855" }, { "IBM-856", "CP856" }, { "IBM-857", "CP857" }, /*{ "IBM-859", "?" },*/ { "IBM-860", "CP860" }, { "IBM-861", "CP861" }, { "IBM-862", "CP862" }, { "IBM-863", "CP863" }, { "IBM-864", "CP864" }, { "IBM-865", "CP865" }, { "IBM-866", "CP866" }, /*{ "IBM-868", "?" },*/ { "IBM-869", "CP869" }, { "IBM-874", "CP874" }, { "IBM-878", "KOI8-R" }, /*{ "IBM-895", "?" },*/ /*{ "IBM-897", "CP943" },*/ /*{ "IBM-907", "?" },*/ /*{ "IBM-909", "?" },*/ { "IBM-912", "ISO-8859-2" }, { "IBM-913", "ISO-8859-3" }, { "IBM-914", "ISO-8859-4" }, { "IBM-915", "ISO-8859-5" }, { "IBM-916", "ISO-8859-8" }, { "IBM-920", "ISO-8859-9" }, { "IBM-921", "ISO-8859-13" }, { "IBM-922", "CP922" }, { "IBM-923", "ISO-8859-15" }, { "IBM-932", "CP932" }, /*{ "IBM-941", "CP943" },*/ /*{ "IBM-942", "?" },*/ { "IBM-943", "CP943" }, /*{ "IBM-947", "CP950" },*/ { "IBM-949", "CP949" }, { "IBM-950", "CP950" }, /*{ "IBM-951", "CP949" },*/ /*{ "IBM-952", "JIS_X0208-1990" },*/ /*{ "IBM-953", "JIS_X0212-1990" },*/ { "IBM-954", "EUC-JP" }, /*{ "IBM-955", "?" },*/ { "IBM-964", "EUC-TW" }, { "IBM-970", "EUC-KR" }, /*{ "IBM-971", "KS_C_5601-1987" },*/ { "IBM-eucCN", "GB2312" }, { "IBM-eucJP", "EUC-JP" }, { "IBM-eucKR", "EUC-KR" }, { "IBM-eucTW", "EUC-TW" }, { "IBM33722", "EUC-JP" }, { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-3", "ISO-8859-3" }, { "ISO8859-4", "ISO-8859-4" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-6", "ISO-8859-6" }, { "ISO8859-7", "ISO-8859-7" }, { "ISO8859-8", "ISO-8859-8" }, { "ISO8859-9", "ISO-8859-9" }, /*{ "JISX0201-1976", "JISX0201-1976" },*/ /*{ "JISX0208-1978", "?" },*/ /*{ "JISX0208-1983", "JIS_X0208-1983" },*/ /*{ "JISX0208-1990", "JIS_X0208-1990" },*/ /*{ "JISX0212-1990", "JIS_X0212-1990" },*/ /*{ "KSC5601-1987", "KS_C_5601-1987" },*/ { "SJIS-1", "CP943" }, { "SJIS-2", "CP943" }, { "eucJP", "EUC-JP" }, { "eucKR", "EUC-KR" }, { "eucTW-1993", "EUC-TW" } # define alias_table_defined # endif # if defined VMS /* OpenVMS */ /* The list of encodings is taken from the OpenVMS 7.3-1 documentation "Compaq C Run-Time Library Reference Manual for OpenVMS systems" section 10.7 "Handling Different Character Sets". */ { "DECHANYU", "DEC-HANYU" }, { "DECHANZI", "GB2312" }, { "DECKANJI", "DEC-KANJI" }, { "DECKOREAN", "EUC-KR" }, { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-7", "ISO-8859-7" }, { "ISO8859-8", "ISO-8859-8" }, { "ISO8859-9", "ISO-8859-9" }, { "SDECKANJI", "EUC-JP" }, { "SJIS", "SHIFT_JIS" }, { "eucJP", "EUC-JP" }, { "eucTW", "EUC-TW" } # define alias_table_defined # endif # ifndef alias_table_defined /* Just a dummy entry, to avoid a C syntax error. */ { "", "" } # endif }; # endif #else /* On these platforms, we use a mapping from locale name to GNU canonical encoding name. */ struct table_entry { const char locale[17+1]; const char canonical[11+1]; }; /* Table of platform-dependent mappings, sorted in ascending order. */ static const struct table_entry locale_table[] = { # if defined __FreeBSD__ /* FreeBSD 4.2 */ { "cs_CZ.ISO_8859-2", "ISO-8859-2" }, { "da_DK.DIS_8859-15", "ISO-8859-15" }, { "da_DK.ISO_8859-1", "ISO-8859-1" }, { "de_AT.DIS_8859-15", "ISO-8859-15" }, { "de_AT.ISO_8859-1", "ISO-8859-1" }, { "de_CH.DIS_8859-15", "ISO-8859-15" }, { "de_CH.ISO_8859-1", "ISO-8859-1" }, { "de_DE.DIS_8859-15", "ISO-8859-15" }, { "de_DE.ISO_8859-1", "ISO-8859-1" }, { "en_AU.DIS_8859-15", "ISO-8859-15" }, { "en_AU.ISO_8859-1", "ISO-8859-1" }, { "en_CA.DIS_8859-15", "ISO-8859-15" }, { "en_CA.ISO_8859-1", "ISO-8859-1" }, { "en_GB.DIS_8859-15", "ISO-8859-15" }, { "en_GB.ISO_8859-1", "ISO-8859-1" }, { "en_US.DIS_8859-15", "ISO-8859-15" }, { "en_US.ISO_8859-1", "ISO-8859-1" }, { "es_ES.DIS_8859-15", "ISO-8859-15" }, { "es_ES.ISO_8859-1", "ISO-8859-1" }, { "fi_FI.DIS_8859-15", "ISO-8859-15" }, { "fi_FI.ISO_8859-1", "ISO-8859-1" }, { "fr_BE.DIS_8859-15", "ISO-8859-15" }, { "fr_BE.ISO_8859-1", "ISO-8859-1" }, { "fr_CA.DIS_8859-15", "ISO-8859-15" }, { "fr_CA.ISO_8859-1", "ISO-8859-1" }, { "fr_CH.DIS_8859-15", "ISO-8859-15" }, { "fr_CH.ISO_8859-1", "ISO-8859-1" }, { "fr_FR.DIS_8859-15", "ISO-8859-15" }, { "fr_FR.ISO_8859-1", "ISO-8859-1" }, { "hr_HR.ISO_8859-2", "ISO-8859-2" }, { "hu_HU.ISO_8859-2", "ISO-8859-2" }, { "is_IS.DIS_8859-15", "ISO-8859-15" }, { "is_IS.ISO_8859-1", "ISO-8859-1" }, { "it_CH.DIS_8859-15", "ISO-8859-15" }, { "it_CH.ISO_8859-1", "ISO-8859-1" }, { "it_IT.DIS_8859-15", "ISO-8859-15" }, { "it_IT.ISO_8859-1", "ISO-8859-1" }, { "ja_JP.EUC", "EUC-JP" }, { "ja_JP.SJIS", "SHIFT_JIS" }, { "ja_JP.Shift_JIS", "SHIFT_JIS" }, { "ko_KR.EUC", "EUC-KR" }, { "la_LN.ASCII", "ASCII" }, { "la_LN.DIS_8859-15", "ISO-8859-15" }, { "la_LN.ISO_8859-1", "ISO-8859-1" }, { "la_LN.ISO_8859-2", "ISO-8859-2" }, { "la_LN.ISO_8859-4", "ISO-8859-4" }, { "lt_LN.ASCII", "ASCII" }, { "lt_LN.DIS_8859-15", "ISO-8859-15" }, { "lt_LN.ISO_8859-1", "ISO-8859-1" }, { "lt_LN.ISO_8859-2", "ISO-8859-2" }, { "lt_LT.ISO_8859-4", "ISO-8859-4" }, { "nl_BE.DIS_8859-15", "ISO-8859-15" }, { "nl_BE.ISO_8859-1", "ISO-8859-1" }, { "nl_NL.DIS_8859-15", "ISO-8859-15" }, { "nl_NL.ISO_8859-1", "ISO-8859-1" }, { "no_NO.DIS_8859-15", "ISO-8859-15" }, { "no_NO.ISO_8859-1", "ISO-8859-1" }, { "pl_PL.ISO_8859-2", "ISO-8859-2" }, { "pt_PT.DIS_8859-15", "ISO-8859-15" }, { "pt_PT.ISO_8859-1", "ISO-8859-1" }, { "ru_RU.CP866", "CP866" }, { "ru_RU.ISO_8859-5", "ISO-8859-5" }, { "ru_RU.KOI8-R", "KOI8-R" }, { "ru_SU.CP866", "CP866" }, { "ru_SU.ISO_8859-5", "ISO-8859-5" }, { "ru_SU.KOI8-R", "KOI8-R" }, { "sl_SI.ISO_8859-2", "ISO-8859-2" }, { "sv_SE.DIS_8859-15", "ISO-8859-15" }, { "sv_SE.ISO_8859-1", "ISO-8859-1" }, { "uk_UA.KOI8-U", "KOI8-U" }, { "zh_CN.EUC", "GB2312" }, { "zh_TW.BIG5", "BIG5" }, { "zh_TW.Big5", "BIG5" } # define locale_table_defined # endif # if defined __DJGPP__ /* DOS / DJGPP 2.03 */ /* The encodings given here may not all be correct. If you find that the encoding given for your language and country is not the one your DOS machine actually uses, just correct it in this file, and send a mail to Juan Manuel Guerrero and . */ { "C", "ASCII" }, { "ar", "CP864" }, { "ar_AE", "CP864" }, { "ar_DZ", "CP864" }, { "ar_EG", "CP864" }, { "ar_IQ", "CP864" }, { "ar_IR", "CP864" }, { "ar_JO", "CP864" }, { "ar_KW", "CP864" }, { "ar_MA", "CP864" }, { "ar_OM", "CP864" }, { "ar_QA", "CP864" }, { "ar_SA", "CP864" }, { "ar_SY", "CP864" }, { "be", "CP866" }, { "be_BE", "CP866" }, { "bg", "CP866" }, /* not CP855 ?? */ { "bg_BG", "CP866" }, /* not CP855 ?? */ { "ca", "CP850" }, { "ca_ES", "CP850" }, { "cs", "CP852" }, { "cs_CZ", "CP852" }, { "da", "CP865" }, /* not CP850 ?? */ { "da_DK", "CP865" }, /* not CP850 ?? */ { "de", "CP850" }, { "de_AT", "CP850" }, { "de_CH", "CP850" }, { "de_DE", "CP850" }, { "el", "CP869" }, { "el_GR", "CP869" }, { "en", "CP850" }, { "en_AU", "CP850" }, /* not CP437 ?? */ { "en_CA", "CP850" }, { "en_GB", "CP850" }, { "en_NZ", "CP437" }, { "en_US", "CP437" }, { "en_ZA", "CP850" }, /* not CP437 ?? */ { "eo", "CP850" }, { "eo_EO", "CP850" }, { "es", "CP850" }, { "es_AR", "CP850" }, { "es_BO", "CP850" }, { "es_CL", "CP850" }, { "es_CO", "CP850" }, { "es_CR", "CP850" }, { "es_CU", "CP850" }, { "es_DO", "CP850" }, { "es_EC", "CP850" }, { "es_ES", "CP850" }, { "es_GT", "CP850" }, { "es_HN", "CP850" }, { "es_MX", "CP850" }, { "es_NI", "CP850" }, { "es_PA", "CP850" }, { "es_PE", "CP850" }, { "es_PY", "CP850" }, { "es_SV", "CP850" }, { "es_UY", "CP850" }, { "es_VE", "CP850" }, { "et", "CP850" }, { "et_EE", "CP850" }, { "eu", "CP850" }, { "eu_ES", "CP850" }, { "fi", "CP850" }, { "fi_FI", "CP850" }, { "fr", "CP850" }, { "fr_BE", "CP850" }, { "fr_CA", "CP850" }, { "fr_CH", "CP850" }, { "fr_FR", "CP850" }, { "ga", "CP850" }, { "ga_IE", "CP850" }, { "gd", "CP850" }, { "gd_GB", "CP850" }, { "gl", "CP850" }, { "gl_ES", "CP850" }, { "he", "CP862" }, { "he_IL", "CP862" }, { "hr", "CP852" }, { "hr_HR", "CP852" }, { "hu", "CP852" }, { "hu_HU", "CP852" }, { "id", "CP850" }, /* not CP437 ?? */ { "id_ID", "CP850" }, /* not CP437 ?? */ { "is", "CP861" }, /* not CP850 ?? */ { "is_IS", "CP861" }, /* not CP850 ?? */ { "it", "CP850" }, { "it_CH", "CP850" }, { "it_IT", "CP850" }, { "ja", "CP932" }, { "ja_JP", "CP932" }, { "kr", "CP949" }, /* not CP934 ?? */ { "kr_KR", "CP949" }, /* not CP934 ?? */ { "lt", "CP775" }, { "lt_LT", "CP775" }, { "lv", "CP775" }, { "lv_LV", "CP775" }, { "mk", "CP866" }, /* not CP855 ?? */ { "mk_MK", "CP866" }, /* not CP855 ?? */ { "mt", "CP850" }, { "mt_MT", "CP850" }, { "nb", "CP865" }, /* not CP850 ?? */ { "nb_NO", "CP865" }, /* not CP850 ?? */ { "nl", "CP850" }, { "nl_BE", "CP850" }, { "nl_NL", "CP850" }, { "nn", "CP865" }, /* not CP850 ?? */ { "nn_NO", "CP865" }, /* not CP850 ?? */ { "no", "CP865" }, /* not CP850 ?? */ { "no_NO", "CP865" }, /* not CP850 ?? */ { "pl", "CP852" }, { "pl_PL", "CP852" }, { "pt", "CP850" }, { "pt_BR", "CP850" }, { "pt_PT", "CP850" }, { "ro", "CP852" }, { "ro_RO", "CP852" }, { "ru", "CP866" }, { "ru_RU", "CP866" }, { "sk", "CP852" }, { "sk_SK", "CP852" }, { "sl", "CP852" }, { "sl_SI", "CP852" }, { "sq", "CP852" }, { "sq_AL", "CP852" }, { "sr", "CP852" }, /* CP852 or CP866 or CP855 ?? */ { "sr_CS", "CP852" }, /* CP852 or CP866 or CP855 ?? */ { "sr_YU", "CP852" }, /* CP852 or CP866 or CP855 ?? */ { "sv", "CP850" }, { "sv_SE", "CP850" }, { "th", "CP874" }, { "th_TH", "CP874" }, { "tr", "CP857" }, { "tr_TR", "CP857" }, { "uk", "CP1125" }, { "uk_UA", "CP1125" }, { "zh_CN", "GBK" }, { "zh_TW", "CP950" } /* not CP938 ?? */ # define locale_table_defined # endif # ifndef locale_table_defined /* Just a dummy entry, to avoid a C syntax error. */ { "", "" } # endif }; #endif /* Determine the current locale's character encoding, and canonicalize it into one of the canonical names listed below. The result must not be freed; it is statically allocated. The result becomes invalid when setlocale() is used to change the global locale, or when the value of one of the environment variables LC_ALL, LC_CTYPE, LANG is changed; threads in multithreaded programs should not do this. If the canonical name cannot be determined, the result is a non-canonical name. */ #ifdef STATIC STATIC #endif const char * locale_charset (void) { const char *codeset; /* This function must be multithread-safe. To achieve this without using thread-local storage, we use a simple strcpy or memcpy to fill this static buffer. Filling it through, for example, strcpy + strcat would not be guaranteed to leave the buffer's contents intact if another thread is currently accessing it. If necessary, the contents is first assembled in a stack-allocated buffer. */ #if HAVE_LANGINFO_CODESET || defined WINDOWS_NATIVE || defined OS2 # if HAVE_LANGINFO_CODESET /* Most systems support nl_langinfo (CODESET) nowadays. */ codeset = nl_langinfo (CODESET); # ifdef __CYGWIN__ /* Cygwin < 1.7 does not have locales. nl_langinfo (CODESET) always returns "US-ASCII". Return the suffix of the locale name from the environment variables (if present) or the codepage as a number. */ if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0) { const char *locale; static char resultbuf[2 + 10 + 1]; locale = getenv ("LC_ALL"); if (locale == NULL || locale[0] == '\0') { locale = getenv ("LC_CTYPE"); if (locale == NULL || locale[0] == '\0') locale = getenv ("LANG"); } if (locale != NULL && locale[0] != '\0') { /* If the locale name contains an encoding after the dot, return it. */ const char *dot = strchr (locale, '.'); if (dot != NULL) { const char *modifier; dot++; /* Look for the possible @... trailer and remove it, if any. */ modifier = strchr (dot, '@'); if (modifier == NULL) return dot; if (modifier - dot < sizeof (resultbuf)) { /* This way of filling resultbuf is multithread-safe. */ memcpy (resultbuf, dot, modifier - dot); resultbuf [modifier - dot] = '\0'; return resultbuf; } } } /* The Windows API has a function returning the locale's codepage as a number: GetACP(). This encoding is used by Cygwin, unless the user has set the environment variable CYGWIN=codepage:oem (which very few people do). Output directed to console windows needs to be converted (to GetOEMCP() if the console is using a raster font, or to GetConsoleOutputCP() if it is using a TrueType font). Cygwin does this conversion transparently (see winsup/cygwin/fhandler_console.cc), converting to GetConsoleOutputCP(). This leads to correct results, except when SetConsoleOutputCP has been called and a raster font is in use. */ { char buf[2 + 10 + 1]; sprintf (buf, "CP%u", GetACP ()); strcpy (resultbuf, buf); codeset = resultbuf; } } # endif if (codeset == NULL) /* The canonical name cannot be determined. */ codeset = ""; # elif defined WINDOWS_NATIVE char buf[2 + 10 + 1]; static char resultbuf[2 + 10 + 1]; /* The Windows API has a function returning the locale's codepage as a number, but the value doesn't change according to what the 'setlocale' call specified. So we use it as a last resort, in case the string returned by 'setlocale' doesn't specify the codepage. */ char *current_locale = setlocale (LC_CTYPE, NULL); char *pdot = strrchr (current_locale, '.'); if (pdot && 2 + strlen (pdot + 1) + 1 <= sizeof (buf)) sprintf (buf, "CP%s", pdot + 1); else { /* The Windows API has a function returning the locale's codepage as a number: GetACP(). When the output goes to a console window, it needs to be provided in GetOEMCP() encoding if the console is using a raster font, or in GetConsoleOutputCP() encoding if it is using a TrueType font. But in GUI programs and for output sent to files and pipes, GetACP() encoding is the best bet. */ sprintf (buf, "CP%u", GetACP ()); } /* For a locale name such as "French_France.65001", in Windows 10, setlocale now returns "French_France.utf8" instead. */ if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0) codeset = "UTF-8"; else { strcpy (resultbuf, buf); codeset = resultbuf; } # elif defined OS2 const char *locale; static char resultbuf[2 + 10 + 1]; ULONG cp[3]; ULONG cplen; codeset = NULL; /* Allow user to override the codeset, as set in the operating system, with standard language environment variables. */ locale = getenv ("LC_ALL"); if (locale == NULL || locale[0] == '\0') { locale = getenv ("LC_CTYPE"); if (locale == NULL || locale[0] == '\0') locale = getenv ("LANG"); } if (locale != NULL && locale[0] != '\0') { /* If the locale name contains an encoding after the dot, return it. */ const char *dot = strchr (locale, '.'); if (dot != NULL) { const char *modifier; dot++; /* Look for the possible @... trailer and remove it, if any. */ modifier = strchr (dot, '@'); if (modifier == NULL) return dot; if (modifier - dot < sizeof (resultbuf)) { /* This way of filling resultbuf is multithread-safe. */ memcpy (resultbuf, dot, modifier - dot); resultbuf [modifier - dot] = '\0'; return resultbuf; } } /* For the POSIX locale, don't use the system's codepage. */ if (strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0) codeset = ""; } if (codeset == NULL) { /* OS/2 has a function returning the locale's codepage as a number. */ if (DosQueryCp (sizeof (cp), cp, &cplen)) codeset = ""; else { char buf[2 + 10 + 1]; sprintf (buf, "CP%u", cp[0]); strcpy (resultbuf, buf); codeset = resultbuf; } } # else # error "Add code for other platforms here." # endif /* Resolve alias. */ { # ifdef alias_table_defined /* On some platforms, UTF-8 locales are the most frequently used ones. Speed up the common case and slow down the less common cases by testing for this case first. */ # if defined __OpenBSD__ || (defined __APPLE__ && defined __MACH__) || defined __sun || defined __CYGWIN__ if (strcmp (codeset, "UTF-8") == 0) goto done_table_lookup; else # endif { const struct table_entry * const table = alias_table; size_t const table_size = sizeof (alias_table) / sizeof (struct table_entry); /* The table is sorted. Perform a binary search. */ size_t hi = table_size; size_t lo = 0; while (lo < hi) { /* Invariant: for i < lo, strcmp (table[i].alias, codeset) < 0, for i >= hi, strcmp (table[i].alias, codeset) > 0. */ size_t mid = (hi + lo) >> 1; /* >= lo, < hi */ int cmp = strcmp (table[mid].alias, codeset); if (cmp < 0) lo = mid + 1; else if (cmp > 0) hi = mid; else { /* Found an i with strcmp (table[i].alias, codeset) == 0. */ codeset = table[mid].canonical; goto done_table_lookup; } } } if (0) done_table_lookup: ; else # endif { /* Did not find it in the table. */ /* On Mac OS X, all modern locales use the UTF-8 encoding. BeOS and Haiku have a single locale, and it has UTF-8 encoding. */ # if (defined __APPLE__ && defined __MACH__) || defined __BEOS__ || defined __HAIKU__ codeset = "UTF-8"; # else /* Don't return an empty string. GNU libc and GNU libiconv interpret the empty string as denoting "the locale's character encoding", thus GNU libiconv would call this function a second time. */ if (codeset[0] == '\0') codeset = "ASCII"; # endif } } #else /* On old systems which lack it, use setlocale or getenv. */ const char *locale = NULL; /* But most old systems don't have a complete set of locales. Some (like DJGPP) have only the C locale. Therefore we don't use setlocale here; it would return "C" when it doesn't support the locale name the user has set. */ # if 0 locale = setlocale (LC_CTYPE, NULL); # endif if (locale == NULL || locale[0] == '\0') { locale = getenv ("LC_ALL"); if (locale == NULL || locale[0] == '\0') { locale = getenv ("LC_CTYPE"); if (locale == NULL || locale[0] == '\0') locale = getenv ("LANG"); if (locale == NULL) locale = ""; } } /* Map locale name to canonical encoding name. */ { # ifdef locale_table_defined const struct table_entry * const table = locale_table; size_t const table_size = sizeof (locale_table) / sizeof (struct table_entry); /* The table is sorted. Perform a binary search. */ size_t hi = table_size; size_t lo = 0; while (lo < hi) { /* Invariant: for i < lo, strcmp (table[i].locale, locale) < 0, for i >= hi, strcmp (table[i].locale, locale) > 0. */ size_t mid = (hi + lo) >> 1; /* >= lo, < hi */ int cmp = strcmp (table[mid].locale, locale); if (cmp < 0) lo = mid + 1; else if (cmp > 0) hi = mid; else { /* Found an i with strcmp (table[i].locale, locale) == 0. */ codeset = table[mid].canonical; goto done_table_lookup; } } if (0) done_table_lookup: ; else # endif { /* Did not find it in the table. */ /* On Mac OS X, all modern locales use the UTF-8 encoding. BeOS and Haiku have a single locale, and it has UTF-8 encoding. */ # if (defined __APPLE__ && defined __MACH__) || defined __BEOS__ || defined __HAIKU__ codeset = "UTF-8"; # else /* The canonical name cannot be determined. */ /* Don't return an empty string. GNU libc and GNU libiconv interpret the empty string as denoting "the locale's character encoding", thus GNU libiconv would call this function a second time. */ codeset = "ASCII"; # endif } } #endif #ifdef DARWIN7 /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8" (the default codeset) does not work when MB_CUR_MAX is 1. */ if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX_L (uselocale (NULL)) <= 1) codeset = "ASCII"; #endif return codeset; } kbuild-3608/src/grep/lib/unistr/0000775000175000017500000000000014670377426016544 5ustar locutuslocutuskbuild-3608/src/grep/lib/unistr/u8-uctomb.c0000664000175000017500000000404014670377426020531 0ustar locutuslocutus/* Store a character in UTF-8 string. Copyright (C) 2002, 2005-2006, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2002. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #if defined IN_LIBUNISTRING /* Tell unistr.h to declare u8_uctomb as 'extern', not 'static inline'. */ # include "unistring-notinline.h" #endif /* Specification. */ #include "unistr.h" #include "attribute.h" #if !HAVE_INLINE int u8_uctomb (uint8_t *s, ucs4_t uc, ptrdiff_t n) { if (uc < 0x80) { if (n > 0) { s[0] = uc; return 1; } /* else return -2, below. */ } else { int count; if (uc < 0x800) count = 2; else if (uc < 0x10000) { if (uc < 0xd800 || uc >= 0xe000) count = 3; else return -1; } else if (uc < 0x110000) count = 4; else return -1; if (n >= count) { switch (count) /* note: code falls through cases! */ { case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000; FALLTHROUGH; case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800; FALLTHROUGH; case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0; /*case 1:*/ s[0] = uc; } return count; } } return -2; } #endif kbuild-3608/src/grep/lib/unistr/u8-uctomb-aux.c0000664000175000017500000000322214670377426021325 0ustar locutuslocutus/* Conversion UCS-4 to UTF-8. Copyright (C) 2002, 2006-2007, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2002. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "unistr.h" #include "attribute.h" int u8_uctomb_aux (uint8_t *s, ucs4_t uc, ptrdiff_t n) { int count; if (uc < 0x80) /* The case n >= 1 is already handled by the caller. */ return -2; else if (uc < 0x800) count = 2; else if (uc < 0x10000) { if (uc < 0xd800 || uc >= 0xe000) count = 3; else return -1; } else if (uc < 0x110000) count = 4; else return -1; if (n < count) return -2; switch (count) /* note: code falls through cases! */ { case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000; FALLTHROUGH; case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800; FALLTHROUGH; case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0; /*case 1:*/ s[0] = uc; } return count; } kbuild-3608/src/grep/lib/unistr/u8-mbtoucr.c0000664000175000017500000001075614670377426020726 0ustar locutuslocutus/* Look at first character in UTF-8 string, returning an error code. Copyright (C) 1999-2002, 2006-2007, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2001. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "unistr.h" int u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n) { uint8_t c = *s; if (c < 0x80) { *puc = c; return 1; } else if (c >= 0xc2) { if (c < 0xe0) { if (n >= 2) { if ((s[1] ^ 0x80) < 0x40) { *puc = ((unsigned int) (c & 0x1f) << 6) | (unsigned int) (s[1] ^ 0x80); return 2; } /* invalid multibyte character */ } else { /* incomplete multibyte character */ *puc = 0xfffd; return -2; } } else if (c < 0xf0) { if (n >= 2) { if ((s[1] ^ 0x80) < 0x40 && (c >= 0xe1 || s[1] >= 0xa0) && (c != 0xed || s[1] < 0xa0)) { if (n >= 3) { if ((s[2] ^ 0x80) < 0x40) { *puc = ((unsigned int) (c & 0x0f) << 12) | ((unsigned int) (s[1] ^ 0x80) << 6) | (unsigned int) (s[2] ^ 0x80); return 3; } /* invalid multibyte character */ } else { /* incomplete multibyte character */ *puc = 0xfffd; return -2; } } /* invalid multibyte character */ } else { /* incomplete multibyte character */ *puc = 0xfffd; return -2; } } else if (c < 0xf8) { if (n >= 2) { if ((s[1] ^ 0x80) < 0x40 && (c >= 0xf1 || s[1] >= 0x90) && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))) { if (n >= 3) { if ((s[2] ^ 0x80) < 0x40) { if (n >= 4) { if ((s[3] ^ 0x80) < 0x40) { *puc = ((unsigned int) (c & 0x07) << 18) | ((unsigned int) (s[1] ^ 0x80) << 12) | ((unsigned int) (s[2] ^ 0x80) << 6) | (unsigned int) (s[3] ^ 0x80); return 4; } /* invalid multibyte character */ } else { /* incomplete multibyte character */ *puc = 0xfffd; return -2; } } /* invalid multibyte character */ } else { /* incomplete multibyte character */ *puc = 0xfffd; return -2; } } /* invalid multibyte character */ } else { /* incomplete multibyte character */ *puc = 0xfffd; return -2; } } } /* invalid multibyte character */ *puc = 0xfffd; return -1; } kbuild-3608/src/grep/lib/hash.h0000664000175000017500000002677314670377423016330 0ustar locutuslocutus/* hash - hashing table processing. Copyright (C) 1998-1999, 2001, 2003, 2009-2021 Free Software Foundation, Inc. Written by Jim Meyering , 1998. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* A generic hash table package. */ /* Make sure USE_OBSTACK is defined to 1 if you want the allocator to use obstacks instead of malloc, and recompile 'hash.c' with same setting. */ #ifndef HASH_H_ # define HASH_H_ # include # include # ifdef __cplusplus extern "C" { # endif struct hash_tuning { /* This structure is mainly used for 'hash_initialize', see the block documentation of 'hash_reset_tuning' for more complete comments. */ float shrink_threshold; /* ratio of used buckets to trigger a shrink */ float shrink_factor; /* ratio of new smaller size to original size */ float growth_threshold; /* ratio of used buckets to trigger a growth */ float growth_factor; /* ratio of new bigger size to original size */ bool is_n_buckets; /* if CANDIDATE really means table size */ }; typedef struct hash_tuning Hash_tuning; struct hash_table; typedef struct hash_table Hash_table; /* * Information and lookup. */ /* The following few functions provide information about the overall hash table organization: the number of entries, number of buckets and maximum length of buckets. */ /* Return the number of buckets in the hash table. The table size, the total number of buckets (used plus unused), or the maximum number of slots, are the same quantity. */ extern size_t hash_get_n_buckets (const Hash_table *table) _GL_ATTRIBUTE_PURE; /* Return the number of slots in use (non-empty buckets). */ extern size_t hash_get_n_buckets_used (const Hash_table *table) _GL_ATTRIBUTE_PURE; /* Return the number of active entries. */ extern size_t hash_get_n_entries (const Hash_table *table) _GL_ATTRIBUTE_PURE; /* Return the length of the longest chain (bucket). */ extern size_t hash_get_max_bucket_length (const Hash_table *table) _GL_ATTRIBUTE_PURE; /* Do a mild validation of a hash table, by traversing it and checking two statistics. */ extern bool hash_table_ok (const Hash_table *table) _GL_ATTRIBUTE_PURE; extern void hash_print_statistics (const Hash_table *table, FILE *stream); /* If ENTRY matches an entry already in the hash table, return the entry from the table. Otherwise, return NULL. */ extern void *hash_lookup (const Hash_table *table, const void *entry); /* * Walking. */ /* The functions in this page traverse the hash table and process the contained entries. For the traversal to work properly, the hash table should not be resized nor modified while any particular entry is being processed. In particular, entries should not be added, and an entry may be removed only if there is no shrink threshold and the entry being removed has already been passed to hash_get_next. */ /* Return the first data in the table, or NULL if the table is empty. */ extern void *hash_get_first (const Hash_table *table) _GL_ATTRIBUTE_PURE; /* Return the user data for the entry following ENTRY, where ENTRY has been returned by a previous call to either 'hash_get_first' or 'hash_get_next'. Return NULL if there are no more entries. */ extern void *hash_get_next (const Hash_table *table, const void *entry); /* Fill BUFFER with pointers to active user entries in the hash table, then return the number of pointers copied. Do not copy more than BUFFER_SIZE pointers. */ extern size_t hash_get_entries (const Hash_table *table, void **buffer, size_t buffer_size); typedef bool (*Hash_processor) (void *entry, void *processor_data); /* Call a PROCESSOR function for each entry of a hash table, and return the number of entries for which the processor function returned success. A pointer to some PROCESSOR_DATA which will be made available to each call to the processor function. The PROCESSOR accepts two arguments: the first is the user entry being walked into, the second is the value of PROCESSOR_DATA as received. The walking continue for as long as the PROCESSOR function returns nonzero. When it returns zero, the walking is interrupted. */ extern size_t hash_do_for_each (const Hash_table *table, Hash_processor processor, void *processor_data); /* * Allocation and clean-up. */ /* Return a hash index for a NUL-terminated STRING between 0 and N_BUCKETS-1. This is a convenience routine for constructing other hashing functions. */ extern size_t hash_string (const char *string, size_t n_buckets) _GL_ATTRIBUTE_PURE; extern void hash_reset_tuning (Hash_tuning *tuning); typedef size_t (*Hash_hasher) (const void *entry, size_t table_size); typedef bool (*Hash_comparator) (const void *entry1, const void *entry2); typedef void (*Hash_data_freer) (void *entry); /* Reclaim all storage associated with a hash table. If a data_freer function has been supplied by the user when the hash table was created, this function applies it to the data of each entry before freeing that entry. */ extern void hash_free (Hash_table *table); /* Allocate and return a new hash table, or NULL upon failure. The initial number of buckets is automatically selected so as to _guarantee_ that you may insert at least CANDIDATE different user entries before any growth of the hash table size occurs. So, if have a reasonably tight a-priori upper bound on the number of entries you intend to insert in the hash table, you may save some table memory and insertion time, by specifying it here. If the IS_N_BUCKETS field of the TUNING structure is true, the CANDIDATE argument has its meaning changed to the wanted number of buckets. TUNING points to a structure of user-supplied values, in case some fine tuning is wanted over the default behavior of the hasher. If TUNING is NULL, the default tuning parameters are used instead. If TUNING is provided but the values requested are out of bounds or might cause rounding errors, return NULL. The user-supplied HASHER function, when not NULL, accepts two arguments ENTRY and TABLE_SIZE. It computes, by hashing ENTRY contents, a slot number for that entry which should be in the range 0..TABLE_SIZE-1. This slot number is then returned. The user-supplied COMPARATOR function, when not NULL, accepts two arguments pointing to user data, it then returns true for a pair of entries that compare equal, or false otherwise. This function is internally called on entries which are already known to hash to the same bucket index, but which are distinct pointers. The user-supplied DATA_FREER function, when not NULL, may be later called with the user data as an argument, just before the entry containing the data gets freed. This happens from within 'hash_free' or 'hash_clear'. You should specify this function only if you want these functions to free all of your 'data' data. This is typically the case when your data is simply an auxiliary struct that you have malloc'd to aggregate several values. */ _GL_ATTRIBUTE_NODISCARD extern Hash_table *hash_initialize (size_t candidate, const Hash_tuning *tuning, Hash_hasher hasher, Hash_comparator comparator, Hash_data_freer data_freer) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (hash_free, 1); /* Same as hash_initialize, but invokes xalloc_die on memory exhaustion. */ /* This function is defined by module 'xhash'. */ _GL_ATTRIBUTE_NODISCARD extern Hash_table *hash_xinitialize (size_t candidate, const Hash_tuning *tuning, Hash_hasher hasher, Hash_comparator comparator, Hash_data_freer data_freer) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (hash_free, 1) _GL_ATTRIBUTE_RETURNS_NONNULL; /* Make all buckets empty, placing any chained entries on the free list. Apply the user-specified function data_freer (if any) to the datas of any affected entries. */ extern void hash_clear (Hash_table *table); /* * Insertion and deletion. */ /* For an already existing hash table, change the number of buckets through specifying CANDIDATE. The contents of the hash table are preserved. The new number of buckets is automatically selected so as to _guarantee_ that the table may receive at least CANDIDATE different user entries, including those already in the table, before any other growth of the hash table size occurs. If TUNING->IS_N_BUCKETS is true, then CANDIDATE specifies the exact number of buckets desired. Return true iff the rehash succeeded. */ _GL_ATTRIBUTE_NODISCARD extern bool hash_rehash (Hash_table *table, size_t candidate); /* If ENTRY matches an entry already in the hash table, return the pointer to the entry from the table. Otherwise, insert ENTRY and return ENTRY. Return NULL if the storage required for insertion cannot be allocated. This implementation does not support duplicate entries or insertion of NULL. */ _GL_ATTRIBUTE_NODISCARD extern void *hash_insert (Hash_table *table, const void *entry); /* Same as hash_insert, but invokes xalloc_die on memory exhaustion. */ /* This function is defined by module 'xhash'. */ extern void *hash_xinsert (Hash_table *table, const void *entry); /* Insert ENTRY into hash TABLE if there is not already a matching entry. Return -1 upon memory allocation failure. Return 1 if insertion succeeded. Return 0 if there is already a matching entry in the table, and in that case, if MATCHED_ENT is non-NULL, set *MATCHED_ENT to that entry. This interface is easier to use than hash_insert when you must distinguish between the latter two cases. More importantly, hash_insert is unusable for some types of ENTRY values. When using hash_insert, the only way to distinguish those cases is to compare the return value and ENTRY. That works only when you can have two different ENTRY values that point to data that compares "equal". Thus, when the ENTRY value is a simple scalar, you must use hash_insert_if_absent. ENTRY must not be NULL. */ extern int hash_insert_if_absent (Hash_table *table, const void *entry, const void **matched_ent); /* If ENTRY is already in the table, remove it and return the just-deleted data (the user may want to deallocate its storage). If ENTRY is not in the table, don't modify the table and return NULL. */ extern void *hash_remove (Hash_table *table, const void *entry); /* Same as hash_remove. This interface is deprecated. FIXME: Remove in 2022. */ _GL_ATTRIBUTE_DEPRECATED extern void *hash_delete (Hash_table *table, const void *entry); # ifdef __cplusplus } # endif #endif kbuild-3608/src/grep/lib/pipe-safer.c0000664000175000017500000000262614670377426017425 0ustar locutuslocutus/* Invoke pipe, but avoid some glitches. Copyright (C) 2005-2006, 2009-2021 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 . */ /* Written by Jim Meyering. */ #include #include "unistd-safer.h" #include #include /* Like pipe, but ensure that neither of the file descriptors is STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. Fail with ENOSYS on platforms that lack pipe. */ int pipe_safer (int fd[2]) { if (pipe (fd) == 0) { int i; for (i = 0; i < 2; i++) { fd[i] = fd_safer (fd[i]); if (fd[i] < 0) { int saved_errno = errno; close (fd[1 - i]); errno = saved_errno; return -1; } } return 0; } return -1; } kbuild-3608/src/grep/lib/wchar.in.h0000664000175000017500000012150414670377426017105 0ustar locutuslocutus/* A substitute for ISO C99 , for platforms that have issues. Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Eric Blake. */ /* * ISO C 99 for platforms that have issues. * * * For now, this just ensures proper prerequisite inclusion order and * the declaration of wcwidth(). */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if (((defined __need_mbstate_t || defined __need_wint_t) \ && !defined __MINGW32__) \ || (defined __hpux \ && ((defined _INTTYPES_INCLUDED \ && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \ || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \ || defined _GL_ALREADY_INCLUDING_WCHAR_H) /* Special invocation convention: - Inside glibc and uClibc header files, but not MinGW. - On HP-UX 11.00 we have a sequence of nested includes -> -> , and the latter includes , once indirectly -> -> -> and once directly. In both situations 'wint_t' is not yet defined, therefore we cannot provide the function overrides; instead include only the system's . - With MinGW 3.22, when includes , only some part of is actually processed, and that doesn't include 'mbstate_t'. - On IRIX 6.5, similarly, we have an include -> , and the latter includes . But here, we have no way to detect whether is completely included or is still being included. */ #@INCLUDE_NEXT@ @NEXT_WCHAR_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_WCHAR_H #define _GL_ALREADY_INCLUDING_WCHAR_H #if @HAVE_FEATURES_H@ # include /* for __GLIBC__ */ #endif /* In some builds of uClibc, is nonexistent and wchar_t is defined by . But avoid namespace pollution on glibc systems. */ #if !(defined __GLIBC__ && !defined __UCLIBC__) # include #endif /* Get free(). */ #include /* Include the original if it exists. Some builds of uClibc lack it. */ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_WCHAR_H@ # @INCLUDE_NEXT@ @NEXT_WCHAR_H@ #endif #undef _GL_ALREADY_INCLUDING_WCHAR_H #ifndef _@GUARD_PREFIX@_WCHAR_H #define _@GUARD_PREFIX@_WCHAR_H /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ #ifndef _GL_ATTRIBUTE_PURE # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define _GL_ATTRIBUTE_PURE /* empty */ # endif #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Define wint_t and WEOF. (Also done in wctype.in.h.) */ #if !@HAVE_WINT_T@ && !defined wint_t # define wint_t int # ifndef WEOF # define WEOF -1 # endif #else /* mingw and MSVC define wint_t as 'unsigned short' in or . This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be "unchanged by default argument promotions". Override it. */ # if @GNULIBHEADERS_OVERRIDE_WINT_T@ # if !GNULIB_defined_wint_t # if @HAVE_CRTDEFS_H@ # include # else # include # endif typedef unsigned int rpl_wint_t; # undef wint_t # define wint_t rpl_wint_t # define GNULIB_defined_wint_t 1 # endif # endif # ifndef WEOF # define WEOF ((wint_t) -1) # endif #endif /* Override mbstate_t if it is too small. On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for implementing mbrtowc for encodings like UTF-8. On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is large enough and overriding it would cause problems in C++ mode. */ #if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ # if !GNULIB_defined_mbstate_t # if !(defined _AIX || defined _MSC_VER) typedef int rpl_mbstate_t; # undef mbstate_t # define mbstate_t rpl_mbstate_t # endif # define GNULIB_defined_mbstate_t 1 # endif #endif /* Convert a single-byte character to a wide character. */ #if @GNULIB_BTOWC@ # if @REPLACE_BTOWC@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef btowc # define btowc rpl_btowc # endif _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (btowc, wint_t, (int c)); # else # if !@HAVE_BTOWC@ _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); # endif /* Need to cast, because on mingw, the return type is 'unsigned short'. */ _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (btowc); # endif #elif defined GNULIB_POSIXCHECK # undef btowc # if HAVE_RAW_DECL_BTOWC _GL_WARN_ON_USE (btowc, "btowc is unportable - " "use gnulib module btowc for portability"); # endif #endif /* Convert a wide character to a single-byte character. */ #if @GNULIB_WCTOB@ # if @REPLACE_WCTOB@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wctob # define wctob rpl_wctob # endif _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); # else # if !defined wctob && !@HAVE_DECL_WCTOB@ /* wctob is provided by gnulib, or wctob exists but is not declared. */ _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wctob); # endif #elif defined GNULIB_POSIXCHECK # undef wctob # if HAVE_RAW_DECL_WCTOB _GL_WARN_ON_USE (wctob, "wctob is unportable - " "use gnulib module wctob for portability"); # endif #endif /* Test whether *PS is in the initial state. */ #if @GNULIB_MBSINIT@ # if @REPLACE_MBSINIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mbsinit # define mbsinit rpl_mbsinit # endif _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); # else # if !@HAVE_MBSINIT@ _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); # endif _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbsinit); # endif #elif defined GNULIB_POSIXCHECK # undef mbsinit # if HAVE_RAW_DECL_MBSINIT _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " "use gnulib module mbsinit for portability"); # endif #endif /* Convert a multibyte character to a wide character. */ #if @GNULIB_MBRTOWC@ # if @REPLACE_MBRTOWC@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mbrtowc # define mbrtowc rpl_mbrtowc # endif _GL_FUNCDECL_RPL (mbrtowc, size_t, (wchar_t *restrict pwc, const char *restrict s, size_t n, mbstate_t *restrict ps)); _GL_CXXALIAS_RPL (mbrtowc, size_t, (wchar_t *restrict pwc, const char *restrict s, size_t n, mbstate_t *restrict ps)); # else # if !@HAVE_MBRTOWC@ _GL_FUNCDECL_SYS (mbrtowc, size_t, (wchar_t *restrict pwc, const char *restrict s, size_t n, mbstate_t *restrict ps)); # endif _GL_CXXALIAS_SYS (mbrtowc, size_t, (wchar_t *restrict pwc, const char *restrict s, size_t n, mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbrtowc); # endif #elif defined GNULIB_POSIXCHECK # undef mbrtowc # if HAVE_RAW_DECL_MBRTOWC _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " "use gnulib module mbrtowc for portability"); # endif #endif /* Recognize a multibyte character. */ #if @GNULIB_MBRLEN@ # if @REPLACE_MBRLEN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mbrlen # define mbrlen rpl_mbrlen # endif _GL_FUNCDECL_RPL (mbrlen, size_t, (const char *restrict s, size_t n, mbstate_t *restrict ps)); _GL_CXXALIAS_RPL (mbrlen, size_t, (const char *restrict s, size_t n, mbstate_t *restrict ps)); # else # if !@HAVE_MBRLEN@ _GL_FUNCDECL_SYS (mbrlen, size_t, (const char *restrict s, size_t n, mbstate_t *restrict ps)); # endif _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *restrict s, size_t n, mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbrlen); # endif #elif defined GNULIB_POSIXCHECK # undef mbrlen # if HAVE_RAW_DECL_MBRLEN _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " "use gnulib module mbrlen for portability"); # endif #endif /* Convert a string to a wide string. */ #if @GNULIB_MBSRTOWCS@ # if @REPLACE_MBSRTOWCS@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mbsrtowcs # define mbsrtowcs rpl_mbsrtowcs # endif _GL_FUNCDECL_RPL (mbsrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t len, mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mbsrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t len, mbstate_t *restrict ps)); # else # if !@HAVE_MBSRTOWCS@ _GL_FUNCDECL_SYS (mbsrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t len, mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (mbsrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t len, mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbsrtowcs); # endif #elif defined GNULIB_POSIXCHECK # undef mbsrtowcs # if HAVE_RAW_DECL_MBSRTOWCS _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " "use gnulib module mbsrtowcs for portability"); # endif #endif /* Convert a string to a wide string. */ #if @GNULIB_MBSNRTOWCS@ # if @REPLACE_MBSNRTOWCS@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef mbsnrtowcs # define mbsnrtowcs rpl_mbsnrtowcs # endif _GL_FUNCDECL_RPL (mbsnrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t srclen, size_t len, mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mbsnrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t srclen, size_t len, mbstate_t *restrict ps)); # else # if !@HAVE_MBSNRTOWCS@ _GL_FUNCDECL_SYS (mbsnrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t srclen, size_t len, mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t srclen, size_t len, mbstate_t *restrict ps)); # endif _GL_CXXALIASWARN (mbsnrtowcs); #elif defined GNULIB_POSIXCHECK # undef mbsnrtowcs # if HAVE_RAW_DECL_MBSNRTOWCS _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " "use gnulib module mbsnrtowcs for portability"); # endif #endif /* Convert a wide character to a multibyte character. */ #if @GNULIB_WCRTOMB@ # if @REPLACE_WCRTOMB@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wcrtomb # define wcrtomb rpl_wcrtomb # endif _GL_FUNCDECL_RPL (wcrtomb, size_t, (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); _GL_CXXALIAS_RPL (wcrtomb, size_t, (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); # else # if !@HAVE_WCRTOMB@ _GL_FUNCDECL_SYS (wcrtomb, size_t, (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); # endif _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcrtomb); # endif #elif defined GNULIB_POSIXCHECK # undef wcrtomb # if HAVE_RAW_DECL_WCRTOMB _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " "use gnulib module wcrtomb for portability"); # endif #endif /* Convert a wide string to a string. */ #if @GNULIB_WCSRTOMBS@ # if @REPLACE_WCSRTOMBS@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wcsrtombs # define wcsrtombs rpl_wcsrtombs # endif _GL_FUNCDECL_RPL (wcsrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t len, mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (wcsrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t len, mbstate_t *restrict ps)); # else # if !@HAVE_WCSRTOMBS@ _GL_FUNCDECL_SYS (wcsrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t len, mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (wcsrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t len, mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsrtombs); # endif #elif defined GNULIB_POSIXCHECK # undef wcsrtombs # if HAVE_RAW_DECL_WCSRTOMBS _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " "use gnulib module wcsrtombs for portability"); # endif #endif /* Convert a wide string to a string. */ #if @GNULIB_WCSNRTOMBS@ # if @REPLACE_WCSNRTOMBS@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wcsnrtombs # define wcsnrtombs rpl_wcsnrtombs # endif _GL_FUNCDECL_RPL (wcsnrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t srclen, size_t len, mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (wcsnrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t srclen, size_t len, mbstate_t *restrict ps)); # else # if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun) _GL_FUNCDECL_SYS (wcsnrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t srclen, size_t len, mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (wcsnrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t srclen, size_t len, mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsnrtombs); # endif #elif defined GNULIB_POSIXCHECK # undef wcsnrtombs # if HAVE_RAW_DECL_WCSNRTOMBS _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " "use gnulib module wcsnrtombs for portability"); # endif #endif /* Return the number of screen columns needed for WC. */ #if @GNULIB_WCWIDTH@ # if @REPLACE_WCWIDTH@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wcwidth # define wcwidth rpl_wcwidth # endif _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); # else # if !@HAVE_DECL_WCWIDTH@ /* wcwidth exists but is not declared. */ _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcwidth); # endif #elif defined GNULIB_POSIXCHECK # undef wcwidth # if HAVE_RAW_DECL_WCWIDTH _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " "use gnulib module wcwidth for portability"); # endif #endif /* Search N wide characters of S for C. */ #if @GNULIB_WMEMCHR@ # if !@HAVE_WMEMCHR@ _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n) _GL_ATTRIBUTE_PURE); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t); wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t); } */ _GL_CXXALIAS_SYS_CAST2 (wmemchr, wchar_t *, (const wchar_t *, wchar_t, size_t), const wchar_t *, (const wchar_t *, wchar_t, size_t)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); _GL_CXXALIASWARN1 (wmemchr, const wchar_t *, (const wchar_t *s, wchar_t c, size_t n)); # elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemchr); # endif #elif defined GNULIB_POSIXCHECK # undef wmemchr # if HAVE_RAW_DECL_WMEMCHR _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " "use gnulib module wmemchr for portability"); # endif #endif /* Compare N wide characters of S1 and S2. */ #if @GNULIB_WMEMCMP@ # if !@HAVE_WMEMCMP@ _GL_FUNCDECL_SYS (wmemcmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wmemcmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemcmp); # endif #elif defined GNULIB_POSIXCHECK # undef wmemcmp # if HAVE_RAW_DECL_WMEMCMP _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " "use gnulib module wmemcmp for portability"); # endif #endif /* Copy N wide characters of SRC to DEST. */ #if @GNULIB_WMEMCPY@ # if !@HAVE_WMEMCPY@ _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); # endif _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemcpy); # endif #elif defined GNULIB_POSIXCHECK # undef wmemcpy # if HAVE_RAW_DECL_WMEMCPY _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " "use gnulib module wmemcpy for portability"); # endif #endif /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for overlapping memory areas. */ #if @GNULIB_WMEMMOVE@ # if !@HAVE_WMEMMOVE@ _GL_FUNCDECL_SYS (wmemmove, wchar_t *, (wchar_t *dest, const wchar_t *src, size_t n)); # endif _GL_CXXALIAS_SYS (wmemmove, wchar_t *, (wchar_t *dest, const wchar_t *src, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemmove); # endif #elif defined GNULIB_POSIXCHECK # undef wmemmove # if HAVE_RAW_DECL_WMEMMOVE _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " "use gnulib module wmemmove for portability"); # endif #endif /* Copy N wide characters of SRC to DEST. Return pointer to wide characters after the last written wide character. */ #if @GNULIB_WMEMPCPY@ # if !@HAVE_WMEMPCPY@ _GL_FUNCDECL_SYS (wmempcpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); # endif _GL_CXXALIAS_SYS (wmempcpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmempcpy); # endif #elif defined GNULIB_POSIXCHECK # undef wmempcpy # if HAVE_RAW_DECL_WMEMPCPY _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - " "use gnulib module wmempcpy for portability"); # endif #endif /* Set N wide characters of S to C. */ #if @GNULIB_WMEMSET@ # if !@HAVE_WMEMSET@ _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); # endif _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemset); # endif #elif defined GNULIB_POSIXCHECK # undef wmemset # if HAVE_RAW_DECL_WMEMSET _GL_WARN_ON_USE (wmemset, "wmemset is unportable - " "use gnulib module wmemset for portability"); # endif #endif /* Return the number of wide characters in S. */ #if @GNULIB_WCSLEN@ # if !@HAVE_WCSLEN@ _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcslen); # endif #elif defined GNULIB_POSIXCHECK # undef wcslen # if HAVE_RAW_DECL_WCSLEN _GL_WARN_ON_USE (wcslen, "wcslen is unportable - " "use gnulib module wcslen for portability"); # endif #endif /* Return the number of wide characters in S, but at most MAXLEN. */ #if @GNULIB_WCSNLEN@ # if !@HAVE_WCSNLEN@ _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); _GL_CXXALIASWARN (wcsnlen); #elif defined GNULIB_POSIXCHECK # undef wcsnlen # if HAVE_RAW_DECL_WCSNLEN _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " "use gnulib module wcsnlen for portability"); # endif #endif /* Copy SRC to DEST. */ #if @GNULIB_WCSCPY@ # if !@HAVE_WCSCPY@ _GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src)); # endif _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscpy); # endif #elif defined GNULIB_POSIXCHECK # undef wcscpy # if HAVE_RAW_DECL_WCSCPY _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " "use gnulib module wcscpy for portability"); # endif #endif /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ #if @GNULIB_WCPCPY@ # if !@HAVE_WCPCPY@ _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src)); # endif _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src)); _GL_CXXALIASWARN (wcpcpy); #elif defined GNULIB_POSIXCHECK # undef wcpcpy # if HAVE_RAW_DECL_WCPCPY _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " "use gnulib module wcpcpy for portability"); # endif #endif /* Copy no more than N wide characters of SRC to DEST. */ #if @GNULIB_WCSNCPY@ # if !@HAVE_WCSNCPY@ _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); # endif _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsncpy); # endif #elif defined GNULIB_POSIXCHECK # undef wcsncpy # if HAVE_RAW_DECL_WCSNCPY _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " "use gnulib module wcsncpy for portability"); # endif #endif /* Copy no more than N characters of SRC to DEST, returning the address of the last character written into DEST. */ #if @GNULIB_WCPNCPY@ # if !@HAVE_WCPNCPY@ _GL_FUNCDECL_SYS (wcpncpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); # endif _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); _GL_CXXALIASWARN (wcpncpy); #elif defined GNULIB_POSIXCHECK # undef wcpncpy # if HAVE_RAW_DECL_WCPNCPY _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " "use gnulib module wcpncpy for portability"); # endif #endif /* Append SRC onto DEST. */ #if @GNULIB_WCSCAT@ # if !@HAVE_WCSCAT@ _GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src)); # endif _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscat); # endif #elif defined GNULIB_POSIXCHECK # undef wcscat # if HAVE_RAW_DECL_WCSCAT _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " "use gnulib module wcscat for portability"); # endif #endif /* Append no more than N wide characters of SRC onto DEST. */ #if @GNULIB_WCSNCAT@ # if !@HAVE_WCSNCAT@ _GL_FUNCDECL_SYS (wcsncat, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); # endif _GL_CXXALIAS_SYS (wcsncat, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsncat); # endif #elif defined GNULIB_POSIXCHECK # undef wcsncat # if HAVE_RAW_DECL_WCSNCAT _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " "use gnulib module wcsncat for portability"); # endif #endif /* Compare S1 and S2. */ #if @GNULIB_WCSCMP@ # if !@HAVE_WCSCMP@ _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscmp); # endif #elif defined GNULIB_POSIXCHECK # undef wcscmp # if HAVE_RAW_DECL_WCSCMP _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " "use gnulib module wcscmp for portability"); # endif #endif /* Compare no more than N wide characters of S1 and S2. */ #if @GNULIB_WCSNCMP@ # if !@HAVE_WCSNCMP@ _GL_FUNCDECL_SYS (wcsncmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcsncmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsncmp); # endif #elif defined GNULIB_POSIXCHECK # undef wcsncmp # if HAVE_RAW_DECL_WCSNCMP _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " "use gnulib module wcsncmp for portability"); # endif #endif /* Compare S1 and S2, ignoring case. */ #if @GNULIB_WCSCASECMP@ # if !@HAVE_WCSCASECMP@ _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); _GL_CXXALIASWARN (wcscasecmp); #elif defined GNULIB_POSIXCHECK # undef wcscasecmp # if HAVE_RAW_DECL_WCSCASECMP _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " "use gnulib module wcscasecmp for portability"); # endif #endif /* Compare no more than N chars of S1 and S2, ignoring case. */ #if @GNULIB_WCSNCASECMP@ # if !@HAVE_WCSNCASECMP@ _GL_FUNCDECL_SYS (wcsncasecmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcsncasecmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); _GL_CXXALIASWARN (wcsncasecmp); #elif defined GNULIB_POSIXCHECK # undef wcsncasecmp # if HAVE_RAW_DECL_WCSNCASECMP _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " "use gnulib module wcsncasecmp for portability"); # endif #endif /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE category of the current locale. */ #if @GNULIB_WCSCOLL@ # if !@HAVE_WCSCOLL@ _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); # endif _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscoll); # endif #elif defined GNULIB_POSIXCHECK # undef wcscoll # if HAVE_RAW_DECL_WCSCOLL _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " "use gnulib module wcscoll for portability"); # endif #endif /* Transform S2 into array pointed to by S1 such that if wcscmp is applied to two transformed strings the result is the as applying 'wcscoll' to the original strings. */ #if @GNULIB_WCSXFRM@ # if !@HAVE_WCSXFRM@ _GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); # endif _GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsxfrm); # endif #elif defined GNULIB_POSIXCHECK # undef wcsxfrm # if HAVE_RAW_DECL_WCSXFRM _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " "use gnulib module wcsxfrm for portability"); # endif #endif /* Duplicate S, returning an identical malloc'd string. */ #if @GNULIB_WCSDUP@ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wcsdup # define wcsdup _wcsdup # endif _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s)); # else # if !@HAVE_WCSDUP@ || __GNUC__ >= 11 _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); # endif _GL_CXXALIASWARN (wcsdup); #else # if __GNUC__ >= 11 && !defined wcsdup /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */ _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # if defined GNULIB_POSIXCHECK # undef wcsdup # if HAVE_RAW_DECL_WCSDUP _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " "use gnulib module wcsdup for portability"); # endif # elif @GNULIB_MDA_WCSDUP@ /* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::wcsdup always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wcsdup # define wcsdup _wcsdup # endif _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s)); # else _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # if @HAVE_DECL_WCSDUP@ _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); # endif # endif # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@ _GL_CXXALIASWARN (wcsdup); # endif # endif #endif /* Find the first occurrence of WC in WCS. */ #if @GNULIB_WCSCHR@ # if !@HAVE_WCSCHR@ _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc) _GL_ATTRIBUTE_PURE); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const wchar_t * std::wcschr (const wchar_t *, wchar_t); wchar_t * std::wcschr (wchar_t *, wchar_t); } */ _GL_CXXALIAS_SYS_CAST2 (wcschr, wchar_t *, (const wchar_t *, wchar_t), const wchar_t *, (const wchar_t *, wchar_t)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); # elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wcschr); # endif #elif defined GNULIB_POSIXCHECK # undef wcschr # if HAVE_RAW_DECL_WCSCHR _GL_WARN_ON_USE (wcschr, "wcschr is unportable - " "use gnulib module wcschr for portability"); # endif #endif /* Find the last occurrence of WC in WCS. */ #if @GNULIB_WCSRCHR@ # if !@HAVE_WCSRCHR@ _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc) _GL_ATTRIBUTE_PURE); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const wchar_t * std::wcsrchr (const wchar_t *, wchar_t); wchar_t * std::wcsrchr (wchar_t *, wchar_t); } */ _GL_CXXALIAS_SYS_CAST2 (wcsrchr, wchar_t *, (const wchar_t *, wchar_t), const wchar_t *, (const wchar_t *, wchar_t)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); # elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsrchr); # endif #elif defined GNULIB_POSIXCHECK # undef wcsrchr # if HAVE_RAW_DECL_WCSRCHR _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " "use gnulib module wcsrchr for portability"); # endif #endif /* Return the length of the initial segmet of WCS which consists entirely of wide characters not in REJECT. */ #if @GNULIB_WCSCSPN@ # if !@HAVE_WCSCSPN@ _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscspn); # endif #elif defined GNULIB_POSIXCHECK # undef wcscspn # if HAVE_RAW_DECL_WCSCSPN _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " "use gnulib module wcscspn for portability"); # endif #endif /* Return the length of the initial segmet of WCS which consists entirely of wide characters in ACCEPT. */ #if @GNULIB_WCSSPN@ # if !@HAVE_WCSSPN@ _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsspn); # endif #elif defined GNULIB_POSIXCHECK # undef wcsspn # if HAVE_RAW_DECL_WCSSPN _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " "use gnulib module wcsspn for portability"); # endif #endif /* Find the first occurrence in WCS of any character in ACCEPT. */ #if @GNULIB_WCSPBRK@ # if !@HAVE_WCSPBRK@ _GL_FUNCDECL_SYS (wcspbrk, wchar_t *, (const wchar_t *wcs, const wchar_t *accept) _GL_ATTRIBUTE_PURE); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *); wchar_t * std::wcspbrk (wchar_t *, const wchar_t *); } */ _GL_CXXALIAS_SYS_CAST2 (wcspbrk, wchar_t *, (const wchar_t *, const wchar_t *), const wchar_t *, (const wchar_t *, const wchar_t *)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (wcspbrk, wchar_t *, (wchar_t *wcs, const wchar_t *accept)); _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, (const wchar_t *wcs, const wchar_t *accept)); # elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wcspbrk); # endif #elif defined GNULIB_POSIXCHECK # undef wcspbrk # if HAVE_RAW_DECL_WCSPBRK _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " "use gnulib module wcspbrk for portability"); # endif #endif /* Find the first occurrence of NEEDLE in HAYSTACK. */ #if @GNULIB_WCSSTR@ # if !@HAVE_WCSSTR@ _GL_FUNCDECL_SYS (wcsstr, wchar_t *, (const wchar_t *restrict haystack, const wchar_t *restrict needle) _GL_ATTRIBUTE_PURE); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); wchar_t * std::wcsstr (wchar_t *, const wchar_t *); } */ _GL_CXXALIAS_SYS_CAST2 (wcsstr, wchar_t *, (const wchar_t *restrict, const wchar_t *restrict), const wchar_t *, (const wchar_t *restrict, const wchar_t *restrict)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (wcsstr, wchar_t *, (wchar_t *restrict haystack, const wchar_t *restrict needle)); _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, (const wchar_t *restrict haystack, const wchar_t *restrict needle)); # elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsstr); # endif #elif defined GNULIB_POSIXCHECK # undef wcsstr # if HAVE_RAW_DECL_WCSSTR _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " "use gnulib module wcsstr for portability"); # endif #endif /* Divide WCS into tokens separated by characters in DELIM. */ #if @GNULIB_WCSTOK@ # if @REPLACE_WCSTOK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wcstok # define wcstok rpl_wcstok # endif _GL_FUNCDECL_RPL (wcstok, wchar_t *, (wchar_t *restrict wcs, const wchar_t *restrict delim, wchar_t **restrict ptr)); _GL_CXXALIAS_RPL (wcstok, wchar_t *, (wchar_t *restrict wcs, const wchar_t *restrict delim, wchar_t **restrict ptr)); # else # if !@HAVE_WCSTOK@ _GL_FUNCDECL_SYS (wcstok, wchar_t *, (wchar_t *restrict wcs, const wchar_t *restrict delim, wchar_t **restrict ptr)); # endif _GL_CXXALIAS_SYS (wcstok, wchar_t *, (wchar_t *restrict wcs, const wchar_t *restrict delim, wchar_t **restrict ptr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcstok); # endif #elif defined GNULIB_POSIXCHECK # undef wcstok # if HAVE_RAW_DECL_WCSTOK _GL_WARN_ON_USE (wcstok, "wcstok is unportable - " "use gnulib module wcstok for portability"); # endif #endif /* Determine number of column positions required for first N wide characters (or fewer if S ends before this) in S. */ #if @GNULIB_WCSWIDTH@ # if @REPLACE_WCSWIDTH@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wcswidth # define wcswidth rpl_wcswidth # endif _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n) _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); # else # if !@HAVE_WCSWIDTH@ _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcswidth); # endif #elif defined GNULIB_POSIXCHECK # undef wcswidth # if HAVE_RAW_DECL_WCSWIDTH _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " "use gnulib module wcswidth for portability"); # endif #endif /* Convert *TP to a date and time wide string. See . */ #if @GNULIB_WCSFTIME@ # if @REPLACE_WCSFTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef wcsftime # define wcsftime rpl_wcsftime # endif _GL_FUNCDECL_RPL (wcsftime, size_t, (wchar_t *restrict __buf, size_t __bufsize, const wchar_t *restrict __fmt, const struct tm *restrict __tp) _GL_ARG_NONNULL ((1, 3, 4))); _GL_CXXALIAS_RPL (wcsftime, size_t, (wchar_t *restrict __buf, size_t __bufsize, const wchar_t *restrict __fmt, const struct tm *restrict __tp)); # else # if !@HAVE_WCSFTIME@ _GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t *restrict __buf, size_t __bufsize, const wchar_t *restrict __fmt, const struct tm *restrict __tp) _GL_ARG_NONNULL ((1, 3, 4))); # endif _GL_CXXALIAS_SYS (wcsftime, size_t, (wchar_t *restrict __buf, size_t __bufsize, const wchar_t *restrict __fmt, const struct tm *restrict __tp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsftime); # endif #elif defined GNULIB_POSIXCHECK # undef wcsftime # if HAVE_RAW_DECL_WCSFTIME _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " "use gnulib module wcsftime for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_WCHAR_H */ #endif /* _@GUARD_PREFIX@_WCHAR_H */ #endif kbuild-3608/src/grep/lib/c-stack.c0000664000175000017500000001520014670377423016704 0ustar locutuslocutus/* Stack overflow handling. Copyright (C) 2002, 2004, 2006, 2008-2021 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 . */ /* Written by Paul Eggert. */ /* NOTES: A program that uses alloca, dynamic arrays, or large local variables may extend the stack by more than a page at a time. If so, when the stack overflows the operating system may not detect the overflow until the program uses the array, and this module may incorrectly report a program error instead of a stack overflow. To avoid this problem, allocate only small objects on the stack; a program should be OK if it limits single allocations to a page or less. Allocate larger arrays in static storage, or on the heap (e.g., with malloc). Yes, this is a pain, but we don't know of any better solution that is portable. No attempt has been made to deal with multithreaded applications. */ #include #include "c-stack.h" #include #include #include #include #include #include #include #if DEBUG # include #endif #include #include "exitfail.h" #include "getprogname.h" #include "idx.h" #include "ignore-value.h" #include "gettext.h" #define _(msgid) gettext (msgid) #if HAVE_STACK_OVERFLOW_RECOVERY /* Storage for the alternate signal stack. 64 KiB is not too large for Gnulib-using apps, and is large enough for all known platforms. Smaller sizes may run into trouble. For example, libsigsegv 2.6 through 2.8 have a bug where some architectures use more than the Linux default of an 8 KiB alternate stack when deciding if a fault was caused by stack overflow. */ static max_align_t alternate_signal_stack[(64 * 1024 + sizeof (max_align_t) - 1) / sizeof (max_align_t)]; /* The user-specified action to take when a SEGV-related program error or stack overflow occurs. */ static _GL_ASYNC_SAFE void (* volatile segv_action) (int); /* Translated messages for program errors and stack overflow. Do not translate them in the signal handler, since gettext is not async-signal-safe. */ static char const * volatile program_error_message; static char const * volatile stack_overflow_message; /* Output an error message, then exit with status EXIT_FAILURE if it appears to have been a stack overflow, or with a core dump otherwise. This function is async-signal-safe. */ static char const * volatile progname; static _GL_ASYNC_SAFE _Noreturn void die (int signo) { segv_action (signo); char const *message = signo ? program_error_message : stack_overflow_message; /* If the message is short, write it all at once to avoid interleaving with other messages. Avoid writev as it is not documented to be async-signal-safe. */ size_t prognamelen = strlen (progname); size_t messagelen = strlen (message); static char const separator[] = {':', ' '}; char buf[sizeof alternate_signal_stack / 16 + sizeof separator]; idx_t buflen; if (prognamelen + messagelen < sizeof buf - sizeof separator) { char *p = mempcpy (buf, progname, prognamelen); p = mempcpy (p, separator, sizeof separator); p = mempcpy (p, message, messagelen); *p++ = '\n'; buflen = p - buf; } else { ignore_value (write (STDERR_FILENO, progname, prognamelen)); ignore_value (write (STDERR_FILENO, separator, sizeof separator)); ignore_value (write (STDERR_FILENO, message, messagelen)); buf[0] = '\n'; buflen = 1; } ignore_value (write (STDERR_FILENO, buf, buflen)); if (! signo) _exit (exit_failure); raise (signo); abort (); } static _GL_ASYNC_SAFE void null_action (int signo _GL_UNUSED) { } /* Pacify GCC 9.3.1, which otherwise would complain about segv_handler. */ # if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" # endif /* Nonzero if general segv handler could not be installed. */ static volatile int segv_handler_missing; /* Handle a segmentation violation and exit if it cannot be stack overflow. This function is async-signal-safe. */ static _GL_ASYNC_SAFE int segv_handler (void *address _GL_UNUSED, int serious) { # if DEBUG { char buf[1024]; int saved_errno = errno; ignore_value (write (STDERR_FILENO, buf, sprintf (buf, "segv_handler serious=%d\n", serious))); errno = saved_errno; } # endif /* If this fault is not serious, return 0 to let the stack overflow handler take a shot at it. */ if (!serious) return 0; die (SIGSEGV); } /* Handle a segmentation violation that is likely to be a stack overflow and exit. This function is async-signal-safe. */ static _GL_ASYNC_SAFE _Noreturn void overflow_handler (int emergency, stackoverflow_context_t context _GL_UNUSED) { # if DEBUG { char buf[1024]; ignore_value (write (STDERR_FILENO, buf, sprintf (buf, ("overflow_handler emergency=%d" " segv_handler_missing=%d\n"), emergency, segv_handler_missing))); } # endif die ((!emergency || segv_handler_missing) ? 0 : SIGSEGV); } int c_stack_action (_GL_ASYNC_SAFE void (*action) (int)) { segv_action = action ? action : null_action; program_error_message = _("program error"); stack_overflow_message = _("stack overflow"); progname = getprogname (); /* Always install the overflow handler. */ if (stackoverflow_install_handler (overflow_handler, alternate_signal_stack, sizeof alternate_signal_stack)) { errno = ENOTSUP; return -1; } /* Try installing a general handler; if it fails, then treat all segv as stack overflow. */ segv_handler_missing = sigsegv_install_handler (segv_handler); return 0; } #else /* !HAVE_STACK_OVERFLOW_RECOVERY */ int c_stack_action (_GL_ASYNC_SAFE void (*action) (int) _GL_UNUSED) { errno = ENOTSUP; return -1; } #endif kbuild-3608/src/grep/lib/localeconv.c0000664000175000017500000000660414670377424017515 0ustar locutuslocutus/* Query locale dependent information for formatting numbers. Copyright (C) 2012-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #if HAVE_STRUCT_LCONV_DECIMAL_POINT /* Override for platforms where 'struct lconv' lacks the int_p_*, int_n_* members. */ struct lconv * localeconv (void) { static struct lconv result; # undef lconv # undef localeconv struct lconv *sys_result = localeconv (); result.decimal_point = sys_result->decimal_point; result.thousands_sep = sys_result->thousands_sep; result.grouping = sys_result->grouping; result.mon_decimal_point = sys_result->mon_decimal_point; result.mon_thousands_sep = sys_result->mon_thousands_sep; result.mon_grouping = sys_result->mon_grouping; result.positive_sign = sys_result->positive_sign; result.negative_sign = sys_result->negative_sign; result.currency_symbol = sys_result->currency_symbol; result.frac_digits = sys_result->frac_digits; result.p_cs_precedes = sys_result->p_cs_precedes; result.p_sign_posn = sys_result->p_sign_posn; result.p_sep_by_space = sys_result->p_sep_by_space; result.n_cs_precedes = sys_result->n_cs_precedes; result.n_sign_posn = sys_result->n_sign_posn; result.n_sep_by_space = sys_result->n_sep_by_space; result.int_curr_symbol = sys_result->int_curr_symbol; result.int_frac_digits = sys_result->int_frac_digits; result.int_p_cs_precedes = sys_result->p_cs_precedes; result.int_p_sign_posn = sys_result->p_sign_posn; result.int_p_sep_by_space = sys_result->p_sep_by_space; result.int_n_cs_precedes = sys_result->n_cs_precedes; result.int_n_sign_posn = sys_result->n_sign_posn; result.int_n_sep_by_space = sys_result->n_sep_by_space; return &result; } #else /* Override for platforms where 'struct lconv' is a dummy. */ # include struct lconv * localeconv (void) { static /*const*/ struct lconv result = { /* decimal_point */ ".", /* thousands_sep */ "", /* grouping */ "", /* mon_decimal_point */ "", /* mon_thousands_sep */ "", /* mon_grouping */ "", /* positive_sign */ "", /* negative_sign */ "", /* currency_symbol */ "", /* frac_digits */ CHAR_MAX, /* p_cs_precedes */ CHAR_MAX, /* p_sign_posn */ CHAR_MAX, /* p_sep_by_space */ CHAR_MAX, /* n_cs_precedes */ CHAR_MAX, /* n_sign_posn */ CHAR_MAX, /* n_sep_by_space */ CHAR_MAX, /* int_curr_symbol */ "", /* int_frac_digits */ CHAR_MAX, /* int_p_cs_precedes */ CHAR_MAX, /* int_p_sign_posn */ CHAR_MAX, /* int_p_sep_by_space */ CHAR_MAX, /* int_n_cs_precedes */ CHAR_MAX, /* int_n_sign_posn */ CHAR_MAX, /* int_n_sep_by_space */ CHAR_MAX }; return &result; } #endif kbuild-3608/src/grep/lib/getdtablesize.c0000664000175000017500000000656514670377423020223 0ustar locutuslocutus/* getdtablesize() function: Return maximum possible file descriptor value + 1. Copyright (C) 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #if defined _WIN32 && ! defined __CYGWIN__ # include # if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" # endif # if HAVE_MSVC_INVALID_PARAMETER_HANDLER static int _setmaxstdio_nothrow (int newmax) { int result; TRY_MSVC_INVAL { result = _setmaxstdio (newmax); } CATCH_MSVC_INVAL { result = -1; } DONE_MSVC_INVAL; return result; } # else # define _setmaxstdio_nothrow _setmaxstdio # endif /* Cache for the previous getdtablesize () result. Safe to cache because Windows also lacks setrlimit. */ static int dtablesize; int getdtablesize (void) { if (dtablesize == 0) { /* We are looking for the number N such that the valid file descriptors are 0..N-1. It can be obtained through a loop as follows: { int fd; for (fd = 3; fd < 65536; fd++) if (dup2 (0, fd) == -1) break; return fd; } On Windows XP, the result is 2048. The drawback of this loop is that it allocates memory for a libc internal array that is never freed. The number N can also be obtained as the upper bound for _getmaxstdio (). _getmaxstdio () returns the maximum number of open FILE objects. The sanity check in _setmaxstdio reveals the maximum number of file descriptors. This too allocates memory, but it is freed when we call _setmaxstdio with the original value. */ int orig_max_stdio = _getmaxstdio (); unsigned int bound; for (bound = 0x10000; _setmaxstdio_nothrow (bound) < 0; bound = bound / 2) ; _setmaxstdio_nothrow (orig_max_stdio); dtablesize = bound; } return dtablesize; } #else # include # include # ifndef RLIM_SAVED_CUR # define RLIM_SAVED_CUR RLIM_INFINITY # endif # ifndef RLIM_SAVED_MAX # define RLIM_SAVED_MAX RLIM_INFINITY # endif # ifdef __CYGWIN__ /* Cygwin 1.7.25 auto-increases the RLIMIT_NOFILE soft limit until it hits the compile-time constant hard limit of 3200. We might as well just report the hard limit. */ # define rlim_cur rlim_max # endif int getdtablesize (void) { struct rlimit lim; if (getrlimit (RLIMIT_NOFILE, &lim) == 0 && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX && lim.rlim_cur != RLIM_INFINITY && lim.rlim_cur != RLIM_SAVED_CUR && lim.rlim_cur != RLIM_SAVED_MAX) return lim.rlim_cur; return INT_MAX; } #endif kbuild-3608/src/grep/lib/iconv_open-aix.gperf0000664000175000017500000000331314670377423021160 0ustar locutuslocutus/* Character set conversion. Copyright (C) 2007, 2020-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ struct mapping { int standard_name; const char vendor_name[10 + 1]; }; %struct-type %language=ANSI-C %define slot-name standard_name %define hash-function-name mapping_hash %define lookup-function-name mapping_lookup %readonly-tables %global-table %define word-array-name mappings %pic %% # On AIX 5.1, look in /usr/lib/nls/loc/uconvTable. ISO-8859-1, "ISO8859-1" ISO-8859-2, "ISO8859-2" ISO-8859-3, "ISO8859-3" ISO-8859-4, "ISO8859-4" ISO-8859-5, "ISO8859-5" ISO-8859-6, "ISO8859-6" ISO-8859-7, "ISO8859-7" ISO-8859-8, "ISO8859-8" ISO-8859-9, "ISO8859-9" ISO-8859-15, "ISO8859-15" CP437, "IBM-437" CP850, "IBM-850" CP852, "IBM-852" CP856, "IBM-856" CP857, "IBM-857" CP861, "IBM-861" CP865, "IBM-865" CP869, "IBM-869" ISO-8859-13, "IBM-921" CP922, "IBM-922" CP932, "IBM-932" CP943, "IBM-943" CP1046, "IBM-1046" CP1124, "IBM-1124" CP1125, "IBM-1125" CP1129, "IBM-1129" CP1252, "IBM-1252" GB2312, "IBM-eucCN" EUC-JP, "IBM-eucJP" EUC-KR, "IBM-eucKR" EUC-TW, "IBM-eucTW" BIG5, "big5" kbuild-3608/src/grep/lib/_Noreturn.h0000664000175000017500000000415014670377423017341 0ustar locutuslocutus/* A C macro for declaring that a function does not return. Copyright (C) 2011-2021 Free Software Foundation, Inc. This program 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 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _Noreturn # if (defined __cplusplus \ && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ || (defined _MSC_VER && 1900 <= _MSC_VER)) \ && 0) /* [[noreturn]] is not practically usable, because with it the syntax extern _Noreturn void func (...); would not be valid; such a declaration would only be valid with 'extern' and '_Noreturn' swapped, or without the 'extern' keyword. However, some AIX system header files and several gnulib header files use precisely this syntax with 'extern'. */ # define _Noreturn [[noreturn]] # elif ((!defined __cplusplus || defined __clang__) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ || (!defined __STRICT_ANSI__ \ && (__4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ || (defined __apple_build_version__ \ ? 6000000 <= __apple_build_version__ \ : 3 < __clang_major__ + (5 <= __clang_minor__)))))) /* _Noreturn works as-is. */ # elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \ || 0x5110 <= __SUNPRO_C) # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) # else # define _Noreturn # endif #endif kbuild-3608/src/grep/lib/opendir.c0000664000175000017500000000772714670377426017041 0ustar locutuslocutus/* Start reading the entries of a directory. Copyright (C) 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include #if HAVE_OPENDIR /* Override opendir(), to keep track of the open file descriptors. Needed because there is a function dirfd(). */ #else # include # include "dirent-private.h" # include "filename.h" #endif #if REPLACE_FCHDIR # include #endif #ifdef __KLIBC__ # include # include #endif #if defined _WIN32 && ! defined __CYGWIN__ /* Don't assume that UNICODE is not defined. */ # undef WIN32_FIND_DATA # define WIN32_FIND_DATA WIN32_FIND_DATAA # undef GetFullPathName # define GetFullPathName GetFullPathNameA # undef FindFirstFile # define FindFirstFile FindFirstFileA #endif DIR * opendir (const char *dir_name) { #if HAVE_OPENDIR # undef opendir DIR *dirp; dirp = opendir (dir_name); if (dirp == NULL) return NULL; # ifdef __KLIBC__ { int fd = open (dir_name, O_RDONLY); if (fd == -1 || _gl_register_dirp_fd (fd, dirp)) { int saved_errno = errno; close (fd); closedir (dirp); errno = saved_errno; return NULL; } } # endif #else char dir_name_mask[MAX_PATH + 1 + 1 + 1]; int status; HANDLE current; WIN32_FIND_DATA entry; struct gl_directory *dirp; if (dir_name[0] == '\0') { errno = ENOENT; return NULL; } /* Make the dir_name absolute, so that we continue reading the same directory if the current directory changed between this opendir() call and a subsequent rewinddir() call. */ if (!GetFullPathName (dir_name, MAX_PATH, dir_name_mask, NULL)) { errno = EINVAL; return NULL; } /* Append the mask. "*" and "*.*" appear to be equivalent. */ { char *p; p = dir_name_mask + strlen (dir_name_mask); if (p > dir_name_mask && !ISSLASH (p[-1])) *p++ = '\\'; *p++ = '*'; *p = '\0'; } /* Start searching the directory. */ status = -1; current = FindFirstFile (dir_name_mask, &entry); if (current == INVALID_HANDLE_VALUE) { switch (GetLastError ()) { case ERROR_FILE_NOT_FOUND: status = -2; break; case ERROR_PATH_NOT_FOUND: errno = ENOENT; return NULL; case ERROR_DIRECTORY: errno = ENOTDIR; return NULL; case ERROR_ACCESS_DENIED: errno = EACCES; return NULL; default: errno = EIO; return NULL; } } /* Allocate the result. */ dirp = (struct gl_directory *) malloc (offsetof (struct gl_directory, dir_name_mask[0]) + strlen (dir_name_mask) + 1); if (dirp == NULL) { if (current != INVALID_HANDLE_VALUE) FindClose (current); errno = ENOMEM; return NULL; } dirp->status = status; dirp->current = current; if (status == -1) memcpy (&dirp->entry, &entry, sizeof (WIN32_FIND_DATA)); strcpy (dirp->dir_name_mask, dir_name_mask); #endif #if REPLACE_FCHDIR { int fd = dirfd (dirp); if (0 <= fd && _gl_register_fd (fd, dir_name) != fd) { int saved_errno = errno; closedir (dirp); errno = saved_errno; return NULL; } } #endif return dirp; } kbuild-3608/src/grep/lib/malloca.h0000664000175000017500000001077314670377424017007 0ustar locutuslocutus/* Safe automatic memory allocation. Copyright (C) 2003-2007, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2003. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _MALLOCA_H #define _MALLOCA_H #include #include #include #include #include "xalloc-oversized.h" #ifdef __cplusplus extern "C" { #endif /* safe_alloca(N) is equivalent to alloca(N) when it is safe to call alloca(N); otherwise it returns NULL. It either returns N bytes of memory allocated on the stack, that lasts until the function returns, or NULL. Use of safe_alloca should be avoided: - inside arguments of function calls - undefined behaviour, - in inline functions - the allocation may actually last until the calling function returns. */ #if HAVE_ALLOCA /* The OS usually guarantees only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely allocate anything larger than 4096 bytes. Also care for the possibility of a few compiler-allocated temporary stack slots. This must be a macro, not a function. */ # define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL) #else # define safe_alloca(N) ((void) (N), NULL) #endif /* Free a block of memory allocated through malloca(). */ #if HAVE_ALLOCA extern void freea (void *p); #else # define freea free #endif /* malloca(N) is a safe variant of alloca(N). It allocates N bytes of memory allocated on the stack, that must be freed using freea() before the function returns. Upon failure, it returns NULL. */ #if HAVE_ALLOCA # define malloca(N) \ ((N) < 4032 - (2 * sa_alignment_max - 1) \ ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \ + (2 * sa_alignment_max - 1)) \ & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ : mmalloca (N)) #else # define malloca(N) \ mmalloca (N) #endif extern void *mmalloca (size_t n) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (freea, 1) _GL_ATTRIBUTE_ALLOC_SIZE ((1)); /* nmalloca(N,S) is an overflow-safe variant of malloca (N * S). It allocates an array of N objects, each with S bytes of memory, on the stack. N and S should be nonnegative and free of side effects. The array must be freed using freea() before the function returns. */ #define nmalloca(n, s) \ (xalloc_oversized (n, s) ? NULL : malloca ((n) * (size_t) (s))) #ifdef __cplusplus } #endif /* ------------------- Auxiliary, non-public definitions ------------------- */ /* Determine the alignment of a type at compile time. */ #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ # define sa_alignof __alignof__ #elif defined __cplusplus template struct sa_alignof_helper { char __slot1; type __slot2; }; # define sa_alignof(type) offsetof (sa_alignof_helper, __slot2) #elif defined __hpux /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof values. */ # define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) #elif defined _AIX /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof values. */ # define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) #else # define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) #endif enum { /* The desired alignment of memory allocations is the maximum alignment among all elementary types. */ sa_alignment_long = sa_alignof (long), sa_alignment_double = sa_alignof (double), sa_alignment_longlong = sa_alignof (long long), sa_alignment_longdouble = sa_alignof (long double), sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) | (sa_alignment_longlong - 1) | (sa_alignment_longdouble - 1) ) + 1 }; #endif /* _MALLOCA_H */ kbuild-3608/src/grep/lib/mempcpy.c0000664000175000017500000000221314670377425017033 0ustar locutuslocutus/* Copy memory area and return pointer after last written byte. Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include /* A function definition is only needed if HAVE_MEMPCPY is not defined. */ #if !HAVE_MEMPCPY /* Copy N bytes of SRC to DEST, return pointer to bytes after the last written byte. */ void * mempcpy (void *dest, const void *src, size_t n) { return (char *) memcpy (dest, src, n) + n; } #endif kbuild-3608/src/grep/lib/i-ring.h0000664000175000017500000000321314670377423016552 0ustar locutuslocutus/* definitions for a simple ring buffer Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include "verify.h" enum { I_RING_SIZE = 4 }; verify (1 <= I_RING_SIZE); /* When ir_empty is true, the ring is empty. Otherwise, ir_data[B..F] are defined, where B..F is the contiguous range of indices, modulo I_RING_SIZE, from back to front, inclusive. Undefined elements of ir_data are always set to ir_default_val. Popping from an empty ring aborts. Pushing onto a full ring returns the displaced value. An empty ring has F==B and ir_empty == true. A ring with one entry still has F==B, but now ir_empty == false. */ struct I_ring { int ir_data[I_RING_SIZE]; int ir_default_val; unsigned int ir_front; unsigned int ir_back; bool ir_empty; }; typedef struct I_ring I_ring; void i_ring_init (I_ring *ir, int ir_default_val); int i_ring_push (I_ring *ir, int val); int i_ring_pop (I_ring *ir); bool i_ring_empty (I_ring const *ir) _GL_ATTRIBUTE_PURE; kbuild-3608/src/grep/lib/strtoul.c0000664000175000017500000000147014670377426017102 0ustar locutuslocutus/* Copyright (C) 1991, 1997, 2009-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #define UNSIGNED 1 #include "strtol.c" kbuild-3608/src/grep/lib/mbrtowc-impl.h0000664000175000017500000001624014670377425020007 0ustar locutuslocutus/* Convert multibyte character to wide character. Copyright (C) 1999-2002, 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2008. */ /* This file contains the body of the mbrtowc and mbrtoc32 functions, when GNULIB_defined_mbstate_t is defined. */ char *pstate = (char *)ps; if (s == NULL) { pwc = NULL; s = ""; n = 1; } if (n == 0) return (size_t)(-2); /* Here n > 0. */ if (pstate == NULL) pstate = internal_state; { size_t nstate = pstate[0]; char buf[4]; const char *p; size_t m; enc_t enc; int res; switch (nstate) { case 0: p = s; m = n; break; case 3: buf[2] = pstate[3]; FALLTHROUGH; case 2: buf[1] = pstate[2]; FALLTHROUGH; case 1: buf[0] = pstate[1]; p = buf; m = nstate; buf[m++] = s[0]; if (n >= 2 && m < 4) { buf[m++] = s[1]; if (n >= 3 && m < 4) buf[m++] = s[2]; } break; default: errno = EINVAL; return (size_t)(-1); } /* Here m > 0. */ enc = locale_encoding_classification (); if (enc == enc_utf8) /* UTF-8 */ { /* Achieve - multi-thread safety and - the ability to produce wide character values > WCHAR_MAX by not calling mbtowc() at all. */ #include "mbrtowc-impl-utf8.h" } else { /* The hidden internal state of mbtowc would make this function not multi-thread safe. Achieve multi-thread safety through a lock. */ wchar_t wc; res = mbtowc_with_lock (&wc, p, m); if (res >= 0) { if ((wc == 0) != (res == 0)) abort (); if (pwc != NULL) *pwc = wc; goto success; } /* mbtowc does not distinguish between invalid and incomplete multibyte sequences. But mbrtowc needs to make this distinction. There are two possible approaches: - Use iconv() and its return value. - Use built-in knowledge about the possible encodings. Given the low quality of implementation of iconv() on the systems that lack mbrtowc(), we use the second approach. The possible encodings are: - 8-bit encodings, - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS, - UTF-8 (already handled above). Use specialized code for each. */ if (m >= 4 || m >= MB_CUR_MAX) goto invalid; /* Here MB_CUR_MAX > 1 and 0 < m < 4. */ switch (enc) { /* As a reference for this code, you can use the GNU libiconv implementation. Look for uses of the RET_TOOFEW macro. */ case enc_eucjp: /* EUC-JP */ { if (m == 1) { unsigned char c = (unsigned char) p[0]; if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f) goto incomplete; } if (m == 2) { unsigned char c = (unsigned char) p[0]; if (c == 0x8f) { unsigned char c2 = (unsigned char) p[1]; if (c2 >= 0xa1 && c2 < 0xff) goto incomplete; } } goto invalid; } case enc_94: /* EUC-KR, GB2312, BIG5 */ { if (m == 1) { unsigned char c = (unsigned char) p[0]; if (c >= 0xa1 && c < 0xff) goto incomplete; } goto invalid; } case enc_euctw: /* EUC-TW */ { if (m == 1) { unsigned char c = (unsigned char) p[0]; if ((c >= 0xa1 && c < 0xff) || c == 0x8e) goto incomplete; } else /* m == 2 || m == 3 */ { unsigned char c = (unsigned char) p[0]; if (c == 0x8e) goto incomplete; } goto invalid; } case enc_gb18030: /* GB18030 */ { if (m == 1) { unsigned char c = (unsigned char) p[0]; if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe)) goto incomplete; } else /* m == 2 || m == 3 */ { unsigned char c = (unsigned char) p[0]; if (c >= 0x90 && c <= 0xe3) { unsigned char c2 = (unsigned char) p[1]; if (c2 >= 0x30 && c2 <= 0x39) { if (m == 2) goto incomplete; else /* m == 3 */ { unsigned char c3 = (unsigned char) p[2]; if (c3 >= 0x81 && c3 <= 0xfe) goto incomplete; } } } } goto invalid; } case enc_sjis: /* SJIS */ { if (m == 1) { unsigned char c = (unsigned char) p[0]; if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea) || (c >= 0xf0 && c <= 0xf9)) goto incomplete; } goto invalid; } default: /* An unknown multibyte encoding. */ goto incomplete; } } success: /* res >= 0 is the corrected return value of mbtowc_with_lock (&wc, p, m). */ if (nstate >= (res > 0 ? res : 1)) abort (); res -= nstate; pstate[0] = 0; return res; incomplete: { size_t k = nstate; /* Here 0 <= k < m < 4. */ pstate[++k] = s[0]; if (k < m) { pstate[++k] = s[1]; if (k < m) pstate[++k] = s[2]; } if (k != m) abort (); } pstate[0] = m; return (size_t)(-2); invalid: errno = EILSEQ; /* The conversion state is undefined, says POSIX. */ return (size_t)(-1); } kbuild-3608/src/grep/lib/fd-hook.c0000664000175000017500000000702514670377422016713 0ustar locutuslocutus/* Hook for making file descriptor functions close(), ioctl() extensible. Copyright (C) 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2009. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "fd-hook.h" #include /* Currently, this entire code is only needed for the handling of sockets on native Windows platforms. */ #if WINDOWS_SOCKETS /* The first and last link in the doubly linked list. Initially the list is empty. */ static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL }; int execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary, int fd) { if (remaining_list == &anchor) /* End of list reached. */ return primary (fd); else return remaining_list->private_close_fn (remaining_list->private_next, primary, fd); } int execute_all_close_hooks (gl_close_fn primary, int fd) { return execute_close_hooks (anchor.private_next, primary, fd); } int execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary, int fd, int request, void *arg) { if (remaining_list == &anchor) /* End of list reached. */ return primary (fd, request, arg); else return remaining_list->private_ioctl_fn (remaining_list->private_next, primary, fd, request, arg); } int execute_all_ioctl_hooks (gl_ioctl_fn primary, int fd, int request, void *arg) { return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg); } void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link) { if (close_hook == NULL) close_hook = execute_close_hooks; if (ioctl_hook == NULL) ioctl_hook = execute_ioctl_hooks; if (link->private_next == NULL && link->private_prev == NULL) { /* Add the link to the doubly linked list. */ link->private_next = anchor.private_next; link->private_prev = &anchor; link->private_close_fn = close_hook; link->private_ioctl_fn = ioctl_hook; anchor.private_next->private_prev = link; anchor.private_next = link; } else { /* The link is already in use. */ if (link->private_close_fn != close_hook || link->private_ioctl_fn != ioctl_hook) abort (); } } void unregister_fd_hook (struct fd_hook *link) { struct fd_hook *next = link->private_next; struct fd_hook *prev = link->private_prev; if (next != NULL && prev != NULL) { /* The link is in use. Remove it from the doubly linked list. */ prev->private_next = next; next->private_prev = prev; /* Clear the link, to mark it unused. */ link->private_next = NULL; link->private_prev = NULL; link->private_close_fn = NULL; link->private_ioctl_fn = NULL; } } #endif kbuild-3608/src/grep/lib/colorize.h0000664000175000017500000000173514670377423017222 0ustar locutuslocutus/* Output colorization. Copyright 2011-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ extern int should_colorize (void); extern void init_colorize (void); extern void print_start_colorize (char const *sgr_start, char const *sgr_seq); extern void print_end_colorize (char const *sgr_end); kbuild-3608/src/grep/lib/fpending.c0000664000175000017500000000512614670377423017157 0ustar locutuslocutus/* fpending.c -- return the number of pending output bytes on a stream Copyright (C) 2000, 2004, 2006-2007, 2009-2021 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 . */ /* Written by Jim Meyering. */ #include /* Specification. */ #include "fpending.h" #include "stdio-impl.h" /* This file is not used on systems that already have the __fpending function, namely glibc >= 2.2, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.34, Android API >= 23. */ /* Return the number of pending (aka buffered, unflushed) bytes on the stream, FP, that is open for writing. */ size_t __fpending (FILE *fp) { /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ #if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ return fp->_IO_write_ptr - fp->_IO_write_base; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ return fp->_p - fp->_bf._base; #elif defined __EMX__ /* emx+gcc */ return fp->_ptr - fp->_buffer; #elif defined __minix /* Minix */ return fp_->_ptr - fp_->_buf; #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ return (fp_->_ptr ? fp_->_ptr - fp_->_base : 0); #elif defined __UCLIBC__ /* uClibc */ return (fp->__modeflags & __FLAG_WRITING ? fp->__bufpos - fp->__bufstart : 0); #elif defined __QNX__ /* QNX */ return (fp->_Mode & 0x2000 /*_MWRITE*/ ? fp->_Next - fp->_Buf : 0); #elif defined __MINT__ /* Atari FreeMiNT */ return fp->__bufp - fp->__buffer; #elif defined EPLAN9 /* Plan9 */ return fp->wp - fp->buf; #else # error "Please port gnulib fpending.c to your platform!" return 1; #endif } kbuild-3608/src/grep/lib/mbscasecmp.c0000664000175000017500000000550414670377425017504 0ustar locutuslocutus/* Case-insensitive string comparison function. Copyright (C) 1998-1999, 2005-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2005, based on earlier glibc code. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include #include "mbuiter.h" #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) /* Compare the character strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function may, in multibyte locales, return 0 for strings of different lengths! */ int mbscasecmp (const char *s1, const char *s2) { if (s1 == s2) return 0; /* Be careful not to look at the entire extent of s1 or s2 until needed. This is useful because when two strings differ, the difference is most often already in the very few first characters. */ if (MB_CUR_MAX > 1) { mbui_iterator_t iter1; mbui_iterator_t iter2; mbui_init (iter1, s1); mbui_init (iter2, s2); while (mbui_avail (iter1) && mbui_avail (iter2)) { int cmp = mb_casecmp (mbui_cur (iter1), mbui_cur (iter2)); if (cmp != 0) return cmp; mbui_advance (iter1); mbui_advance (iter2); } if (mbui_avail (iter1)) /* s2 terminated before s1. */ return 1; if (mbui_avail (iter2)) /* s1 terminated before s2. */ return -1; return 0; } else { const unsigned char *p1 = (const unsigned char *) s1; const unsigned char *p2 = (const unsigned char *) s2; unsigned char c1, c2; do { c1 = TOLOWER (*p1); c2 = TOLOWER (*p2); if (c1 == '\0') break; ++p1; ++p2; } while (c1 == c2); if (UCHAR_MAX <= INT_MAX) return c1 - c2; else /* On machines where 'char' and 'int' are types of the same size, the difference of two 'unsigned char' values - including the sign bit - doesn't fit in an 'int'. */ return _GL_CMP (c1, c2); } } kbuild-3608/src/grep/lib/getopt_int.h0000664000175000017500000001011214670377423017535 0ustar locutuslocutus/* Internal declarations for getopt. Copyright (C) 1989-2021 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _GETOPT_INT_H #define _GETOPT_INT_H 1 #include extern int _getopt_internal (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct); /* Reentrant versions which can handle parsing multiple argument vectors at the same time. */ /* Describe how to deal with options that follow non-option ARGV-elements. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what POSIX specifies should happen. PERMUTE means permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. The special argument '--' forces an end of option-scanning regardless of the value of 'ordering'. In the case of RETURN_IN_ORDER, only '--' can cause 'getopt' to return -1 with 'optind' != ARGC. */ enum __ord { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER }; /* Data type for reentrant functions. */ struct _getopt_data { /* These have exactly the same meaning as the corresponding global variables, except that they are used for the reentrant versions of getopt. */ int optind; int opterr; int optopt; char *optarg; /* Internal members. */ /* True if the internal members have been initialized. */ int __initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ char *__nextchar; /* See __ord above. */ enum __ord __ordering; /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. 'first_nonopt' is the index in ARGV of the first of them; 'last_nonopt' is the index after the last of them. */ int __first_nonopt; int __last_nonopt; }; /* The initializer is necessary to set OPTIND and OPTERR to their default values and to clear the initialization flag. */ #define _GETOPT_DATA_INITIALIZER { 1, 1 } extern int _getopt_internal_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, struct _getopt_data *__data, int __posixly_correct); extern int _getopt_long_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); extern int _getopt_long_only_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); #endif /* getopt_int.h */ kbuild-3608/src/grep/lib/same-inode.h0000664000175000017500000000323714670377426017417 0ustar locutuslocutus/* Determine whether two stat buffers are known to refer to the same file. Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef SAME_INODE_H # define SAME_INODE_H 1 # include # if defined __VMS && __CRTL_VER < 80200000 # define SAME_INODE(a, b) \ ((a).st_ino[0] == (b).st_ino[0] \ && (a).st_ino[1] == (b).st_ino[1] \ && (a).st_ino[2] == (b).st_ino[2] \ && (a).st_dev == (b).st_dev) # elif defined _WIN32 && ! defined __CYGWIN__ /* Native Windows. */ # if _GL_WINDOWS_STAT_INODES /* stat() and fstat() set st_dev and st_ino to 0 if information about the inode is not available. */ # define SAME_INODE(a, b) \ (!((a).st_ino == 0 && (a).st_dev == 0) \ && (a).st_ino == (b).st_ino && (a).st_dev == (b).st_dev) # else /* stat() and fstat() set st_ino to 0 always. */ # define SAME_INODE(a, b) 0 # endif # else # define SAME_INODE(a, b) \ ((a).st_ino == (b).st_ino \ && (a).st_dev == (b).st_dev) # endif #endif kbuild-3608/src/grep/lib/mbsinit.c0000664000175000017500000000454714670377426017043 0ustar locutuslocutus/* Test for initial conversion state. Copyright (C) 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include "verify.h" #if GNULIB_defined_mbstate_t /* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs() and wcrtomb(), wcsrtombs(). We assume that - sizeof (mbstate_t) >= 4, - only stateless encodings are supported (such as UTF-8 and EUC-JP, but not ISO-2022 variants), - for each encoding, the number of bytes for a wide character is <= 4. (This maximum is attained for UTF-8, GB18030, EUC-TW.) We define the meaning of mbstate_t as follows: - In mb -> wc direction, mbstate_t's first byte contains the number of buffered bytes (in the range 0..3), followed by up to 3 buffered bytes. See mbrtowc.c. - In wc -> mb direction, mbstate_t contains no information. In other words, it is always in the initial state. */ verify (sizeof (mbstate_t) >= 4); int mbsinit (const mbstate_t *ps) { const char *pstate = (const char *)ps; return pstate == NULL || pstate[0] == 0; } #else int mbsinit (const mbstate_t *ps) { # if defined _WIN32 && !defined __CYGWIN__ /* Native Windows. */ /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4 bytes matter. On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined as an 8-byte struct, of which the first 4 bytes matter. */ return ps == NULL || *(const unsigned int *)ps == 0; # else /* Minix, HP-UX 11.00, Solaris 2.6, Interix, ... */ /* Maybe this definition works, maybe not... */ return ps == NULL || *(const char *)ps == 0; # endif } #endif kbuild-3608/src/grep/lib/openat.c0000664000175000017500000002232714670377425016657 0ustar locutuslocutus/* provide a replacement openat function Copyright (C) 2004-2021 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 . */ /* written by Jim Meyering */ /* If the user's config.h happens to include , let it include only the system's here, so that orig_openat doesn't recurse to rpl_openat. */ #define __need_system_fcntl_h #include /* Get the original definition of open. It might be defined as a macro. */ #include #include #undef __need_system_fcntl_h #if HAVE_OPENAT static int orig_openat (int fd, char const *filename, int flags, mode_t mode) { return openat (fd, filename, flags, mode); } #endif /* Write "fcntl.h" here, not , otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include above. */ #include "fcntl.h" #include "openat.h" #include "cloexec.h" #include #include #include #include #include #include #include #if HAVE_OPENAT /* Like openat, but support O_CLOEXEC and work around Solaris 9 bugs with trailing slash. */ int rpl_openat (int dfd, char const *filename, int flags, ...) { /* 0 = unknown, 1 = yes, -1 = no. */ #if GNULIB_defined_O_CLOEXEC int have_cloexec = -1; #else static int have_cloexec; #endif mode_t mode; int fd; mode = 0; if (flags & O_CREAT) { va_list arg; va_start (arg, flags); /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 creates crashing code when 'mode_t' is smaller than 'int'. */ mode = va_arg (arg, PROMOTED_MODE_T); va_end (arg); } # if OPEN_TRAILING_SLASH_BUG /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename ends in a slash, as POSIX says such a filename must name a directory : "A pathname that contains at least one non- character and that ends with one or more trailing characters shall not be resolved successfully unless the last pathname component before the trailing characters names an existing directory" If the named file already exists as a directory, then - if O_CREAT is specified, open() must fail because of the semantics of O_CREAT, - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX says that it fails with errno = EISDIR in this case. If the named file does not exist or does not name a directory, then - if O_CREAT is specified, open() must fail since open() cannot create directories, - if O_WRONLY or O_RDWR is specified, open() must fail because the file does not contain a '.' directory. */ if ((flags & O_CREAT) || (flags & O_ACCMODE) == O_RDWR || (flags & O_ACCMODE) == O_WRONLY) { size_t len = strlen (filename); if (len > 0 && filename[len - 1] == '/') { errno = EISDIR; return -1; } } # endif fd = orig_openat (dfd, filename, flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode); if (flags & O_CLOEXEC) { if (! have_cloexec) { if (0 <= fd) have_cloexec = 1; else if (errno == EINVAL) { fd = orig_openat (dfd, filename, flags & ~O_CLOEXEC, mode); have_cloexec = -1; } } if (have_cloexec < 0 && 0 <= fd) set_cloexec_flag (fd, true); } # if OPEN_TRAILING_SLASH_BUG /* If the filename ends in a slash and fd does not refer to a directory, then fail. Rationale: POSIX says such a filename must name a directory : "A pathname that contains at least one non- character and that ends with one or more trailing characters shall not be resolved successfully unless the last pathname component before the trailing characters names an existing directory" If the named file without the slash is not a directory, open() must fail with ENOTDIR. */ if (fd >= 0) { /* We know len is positive, since open did not fail with ENOENT. */ size_t len = strlen (filename); if (filename[len - 1] == '/') { struct stat statbuf; if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) { close (fd); errno = ENOTDIR; return -1; } } } # endif return fd; } #else /* !HAVE_OPENAT */ # include "filename.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ # include "openat-priv.h" # include "save-cwd.h" /* Replacement for Solaris' openat function. First, try to simulate it via open ("/proc/self/fd/FD/FILE"). Failing that, simulate it by doing save_cwd/fchdir/open/restore_cwd. If either the save_cwd or the restore_cwd fails (relatively unlikely), then give a diagnostic and exit nonzero. Otherwise, upon failure, set errno and return -1, as openat does. Upon successful completion, return a file descriptor. */ int openat (int fd, char const *file, int flags, ...) { mode_t mode = 0; if (flags & O_CREAT) { va_list arg; va_start (arg, flags); /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 creates crashing code when 'mode_t' is smaller than 'int'. */ mode = va_arg (arg, PROMOTED_MODE_T); va_end (arg); } return openat_permissive (fd, file, flags, mode, NULL); } /* Like openat (FD, FILE, FLAGS, MODE), but if CWD_ERRNO is nonnull, set *CWD_ERRNO to an errno value if unable to save or restore the initial working directory. This is needed only the first time remove.c's remove_dir opens a command-line directory argument. If a previous attempt to restore the current working directory failed, then we must not even try to access a '.'-relative name. It is the caller's responsibility not to call this function in that case. */ int openat_permissive (int fd, char const *file, int flags, mode_t mode, int *cwd_errno) { struct saved_cwd saved_cwd; int saved_errno; int err; bool save_ok; if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file)) return open (file, flags, mode); { char buf[OPENAT_BUFFER_SIZE]; char *proc_file = openat_proc_name (buf, fd, file); if (proc_file) { int open_result = open (proc_file, flags, mode); int open_errno = errno; if (proc_file != buf) free (proc_file); /* If the syscall succeeds, or if it fails with an unexpected errno value, then return right away. Otherwise, fall through and resort to using save_cwd/restore_cwd. */ if (0 <= open_result || ! EXPECTED_ERRNO (open_errno)) { errno = open_errno; return open_result; } } } save_ok = (save_cwd (&saved_cwd) == 0); if (! save_ok) { if (! cwd_errno) openat_save_fail (errno); *cwd_errno = errno; } if (0 <= fd && fd == saved_cwd.desc) { /* If saving the working directory collides with the user's requested fd, then the user's fd must have been closed to begin with. */ free_cwd (&saved_cwd); errno = EBADF; return -1; } err = fchdir (fd); saved_errno = errno; if (! err) { err = open (file, flags, mode); saved_errno = errno; if (save_ok && restore_cwd (&saved_cwd) != 0) { if (! cwd_errno) { /* Don't write a message to just-created fd 2. */ saved_errno = errno; if (err == STDERR_FILENO) close (err); openat_restore_fail (saved_errno); } *cwd_errno = errno; } } free_cwd (&saved_cwd); errno = saved_errno; return err; } /* Return true if our openat implementation must resort to using save_cwd and restore_cwd. */ bool openat_needs_fchdir (void) { bool needs_fchdir = true; int fd = open ("/", O_SEARCH | O_CLOEXEC); if (0 <= fd) { char buf[OPENAT_BUFFER_SIZE]; char *proc_file = openat_proc_name (buf, fd, "."); if (proc_file) { needs_fchdir = false; if (proc_file != buf) free (proc_file); } close (fd); } return needs_fchdir; } #endif /* !HAVE_OPENAT */ kbuild-3608/src/grep/lib/mbrlen.c0000664000175000017500000000203714670377425016644 0ustar locutuslocutus/* Recognize multibyte character. Copyright (C) 1999-2000, 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include static mbstate_t internal_state; size_t mbrlen (const char *s, size_t n, mbstate_t *ps) { if (ps == NULL) ps = &internal_state; return mbrtowc (NULL, s, n, ps); } kbuild-3608/src/grep/lib/mbsstr.c0000664000175000017500000003372414670377425016706 0ustar locutuslocutus/* Searching in a string. -*- coding: utf-8 -*- Copyright (C) 2005-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2005. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include /* for NULL, in case a nonstandard string.h lacks it */ #include #include "malloca.h" #include "mbuiter.h" /* Knuth-Morris-Pratt algorithm. */ #define UNIT unsigned char #define CANON_ELEMENT(c) c #include "str-kmp.h" /* Knuth-Morris-Pratt algorithm. See https://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm Return a boolean indicating success: Return true and set *RESULTP if the search was completed. Return false if it was aborted because not enough memory was available. */ static bool knuth_morris_pratt_multibyte (const char *haystack, const char *needle, const char **resultp) { size_t m = mbslen (needle); mbchar_t *needle_mbchars; size_t *table; /* Allocate room for needle_mbchars and the table. */ void *memory = nmalloca (m, sizeof (mbchar_t) + sizeof (size_t)); void *table_memory; if (memory == NULL) return false; needle_mbchars = memory; table_memory = needle_mbchars + m; table = table_memory; /* Fill needle_mbchars. */ { mbui_iterator_t iter; size_t j; j = 0; for (mbui_init (iter, needle); mbui_avail (iter); mbui_advance (iter), j++) mb_copy (&needle_mbchars[j], &mbui_cur (iter)); } /* Fill the table. For 0 < i < m: 0 < table[i] <= i is defined such that forall 0 < x < table[i]: needle[x..i-1] != needle[0..i-1-x], and table[i] is as large as possible with this property. This implies: 1) For 0 < i < m: If table[i] < i, needle[table[i]..i-1] = needle[0..i-1-table[i]]. 2) For 0 < i < m: rhaystack[0..i-1] == needle[0..i-1] and exists h, i <= h < m: rhaystack[h] != needle[h] implies forall 0 <= x < table[i]: rhaystack[x..x+m-1] != needle[0..m-1]. table[0] remains uninitialized. */ { size_t i, j; /* i = 1: Nothing to verify for x = 0. */ table[1] = 1; j = 0; for (i = 2; i < m; i++) { /* Here: j = i-1 - table[i-1]. The inequality needle[x..i-1] != needle[0..i-1-x] is known to hold for x < table[i-1], by induction. Furthermore, if j>0: needle[i-1-j..i-2] = needle[0..j-1]. */ mbchar_t *b = &needle_mbchars[i - 1]; for (;;) { /* Invariants: The inequality needle[x..i-1] != needle[0..i-1-x] is known to hold for x < i-1-j. Furthermore, if j>0: needle[i-1-j..i-2] = needle[0..j-1]. */ if (mb_equal (*b, needle_mbchars[j])) { /* Set table[i] := i-1-j. */ table[i] = i - ++j; break; } /* The inequality needle[x..i-1] != needle[0..i-1-x] also holds for x = i-1-j, because needle[i-1] != needle[j] = needle[i-1-x]. */ if (j == 0) { /* The inequality holds for all possible x. */ table[i] = i; break; } /* The inequality needle[x..i-1] != needle[0..i-1-x] also holds for i-1-j < x < i-1-j+table[j], because for these x: needle[x..i-2] = needle[x-(i-1-j)..j-1] != needle[0..j-1-(x-(i-1-j))] (by definition of table[j]) = needle[0..i-2-x], hence needle[x..i-1] != needle[0..i-1-x]. Furthermore needle[i-1-j+table[j]..i-2] = needle[table[j]..j-1] = needle[0..j-1-table[j]] (by definition of table[j]). */ j = j - table[j]; } /* Here: j = i - table[i]. */ } } /* Search, using the table to accelerate the processing. */ { size_t j; mbui_iterator_t rhaystack; mbui_iterator_t phaystack; *resultp = NULL; j = 0; mbui_init (rhaystack, haystack); mbui_init (phaystack, haystack); /* Invariant: phaystack = rhaystack + j. */ while (mbui_avail (phaystack)) if (mb_equal (needle_mbchars[j], mbui_cur (phaystack))) { j++; mbui_advance (phaystack); if (j == m) { /* The entire needle has been found. */ *resultp = mbui_cur_ptr (rhaystack); break; } } else if (j > 0) { /* Found a match of needle[0..j-1], mismatch at needle[j]. */ size_t count = table[j]; j -= count; for (; count > 0; count--) { if (!mbui_avail (rhaystack)) abort (); mbui_advance (rhaystack); } } else { /* Found a mismatch at needle[0] already. */ if (!mbui_avail (rhaystack)) abort (); mbui_advance (rhaystack); mbui_advance (phaystack); } } freea (memory); return true; } /* Find the first occurrence of the character string NEEDLE in the character string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. */ char * mbsstr (const char *haystack, const char *needle) { /* Be careful not to look at the entire extent of haystack or needle until needed. This is useful because of these two cases: - haystack may be very long, and a match of needle found early, - needle may be very long, and not even a short initial segment of needle may be found in haystack. */ if (MB_CUR_MAX > 1) { mbui_iterator_t iter_needle; mbui_init (iter_needle, needle); if (mbui_avail (iter_needle)) { /* Minimizing the worst-case complexity: Let n = mbslen(haystack), m = mbslen(needle). The naïve algorithm is O(n*m) worst-case. The Knuth-Morris-Pratt algorithm is O(n) worst-case but it needs a memory allocation. To achieve linear complexity and yet amortize the cost of the memory allocation, we activate the Knuth-Morris-Pratt algorithm only once the naïve algorithm has already run for some time; more precisely, when - the outer loop count is >= 10, - the average number of comparisons per outer loop is >= 5, - the total number of comparisons is >= m. But we try it only once. If the memory allocation attempt failed, we don't retry it. */ bool try_kmp = true; size_t outer_loop_count = 0; size_t comparison_count = 0; size_t last_ccount = 0; /* last comparison count */ mbui_iterator_t iter_needle_last_ccount; /* = needle + last_ccount */ mbui_iterator_t iter_haystack; mbui_init (iter_needle_last_ccount, needle); mbui_init (iter_haystack, haystack); for (;; mbui_advance (iter_haystack)) { if (!mbui_avail (iter_haystack)) /* No match. */ return NULL; /* See whether it's advisable to use an asymptotically faster algorithm. */ if (try_kmp && outer_loop_count >= 10 && comparison_count >= 5 * outer_loop_count) { /* See if needle + comparison_count now reaches the end of needle. */ size_t count = comparison_count - last_ccount; for (; count > 0 && mbui_avail (iter_needle_last_ccount); count--) mbui_advance (iter_needle_last_ccount); last_ccount = comparison_count; if (!mbui_avail (iter_needle_last_ccount)) { /* Try the Knuth-Morris-Pratt algorithm. */ const char *result; bool success = knuth_morris_pratt_multibyte (haystack, needle, &result); if (success) return (char *) result; try_kmp = false; } } outer_loop_count++; comparison_count++; if (mb_equal (mbui_cur (iter_haystack), mbui_cur (iter_needle))) /* The first character matches. */ { mbui_iterator_t rhaystack; mbui_iterator_t rneedle; memcpy (&rhaystack, &iter_haystack, sizeof (mbui_iterator_t)); mbui_advance (rhaystack); mbui_init (rneedle, needle); if (!mbui_avail (rneedle)) abort (); mbui_advance (rneedle); for (;; mbui_advance (rhaystack), mbui_advance (rneedle)) { if (!mbui_avail (rneedle)) /* Found a match. */ return (char *) mbui_cur_ptr (iter_haystack); if (!mbui_avail (rhaystack)) /* No match. */ return NULL; comparison_count++; if (!mb_equal (mbui_cur (rhaystack), mbui_cur (rneedle))) /* Nothing in this round. */ break; } } } } else return (char *) haystack; } else { if (*needle != '\0') { /* Minimizing the worst-case complexity: Let n = strlen(haystack), m = strlen(needle). The naïve algorithm is O(n*m) worst-case. The Knuth-Morris-Pratt algorithm is O(n) worst-case but it needs a memory allocation. To achieve linear complexity and yet amortize the cost of the memory allocation, we activate the Knuth-Morris-Pratt algorithm only once the naïve algorithm has already run for some time; more precisely, when - the outer loop count is >= 10, - the average number of comparisons per outer loop is >= 5, - the total number of comparisons is >= m. But we try it only once. If the memory allocation attempt failed, we don't retry it. */ bool try_kmp = true; size_t outer_loop_count = 0; size_t comparison_count = 0; size_t last_ccount = 0; /* last comparison count */ const char *needle_last_ccount = needle; /* = needle + last_ccount */ /* Speed up the following searches of needle by caching its first character. */ char b = *needle++; for (;; haystack++) { if (*haystack == '\0') /* No match. */ return NULL; /* See whether it's advisable to use an asymptotically faster algorithm. */ if (try_kmp && outer_loop_count >= 10 && comparison_count >= 5 * outer_loop_count) { /* See if needle + comparison_count now reaches the end of needle. */ if (needle_last_ccount != NULL) { needle_last_ccount += strnlen (needle_last_ccount, comparison_count - last_ccount); if (*needle_last_ccount == '\0') needle_last_ccount = NULL; last_ccount = comparison_count; } if (needle_last_ccount == NULL) { /* Try the Knuth-Morris-Pratt algorithm. */ const unsigned char *result; bool success = knuth_morris_pratt ((const unsigned char *) haystack, (const unsigned char *) (needle - 1), strlen (needle - 1), &result); if (success) return (char *) result; try_kmp = false; } } outer_loop_count++; comparison_count++; if (*haystack == b) /* The first character matches. */ { const char *rhaystack = haystack + 1; const char *rneedle = needle; for (;; rhaystack++, rneedle++) { if (*rneedle == '\0') /* Found a match. */ return (char *) haystack; if (*rhaystack == '\0') /* No match. */ return NULL; comparison_count++; if (*rhaystack != *rneedle) /* Nothing in this round. */ break; } } } } else return (char *) haystack; } } kbuild-3608/src/grep/lib/cloexec.h0000664000175000017500000000275514670377422017020 0ustar locutuslocutus/* cloexec.c - set or clear the close-on-exec descriptor flag Copyright (C) 2004, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, or clear the flag if VALUE is false. Return 0 on success, or -1 on error with 'errno' set. Note that on MingW, this function does NOT protect DESC from being inherited into spawned children. Instead, either use dup_cloexec followed by closing the original DESC, or use interfaces such as open or pipe2 that accept flags like O_CLOEXEC to create DESC non-inheritable in the first place. */ int set_cloexec_flag (int desc, bool value); /* Duplicates a file handle FD, while marking the copy to be closed prior to exec or spawn. Returns -1 and sets errno if FD could not be duplicated. */ int dup_cloexec (int fd); kbuild-3608/src/grep/lib/wctype.in.h0000664000175000017500000004327414670377426017323 0ustar locutuslocutus/* A substitute for ISO C99 , for platforms that lack it. Copyright (C) 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible and Paul Eggert. */ /* * ISO C 99 for platforms that lack it. * * * iswctype, towctrans, towlower, towupper, wctrans, wctype, * wctrans_t, and wctype_t are not yet implemented. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if (defined __MINGW32__ && defined __CTYPE_H_SOURCED__) /* Special invocation convention: - With MinGW 3.22, when includes , only some part of is being processed, which doesn't include the idempotency guard. */ #@INCLUDE_NEXT@ @NEXT_WCTYPE_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_WCTYPE_H #if @HAVE_WINT_T@ /* Solaris 2.5 has a bug: must be included before . */ # include #endif /* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and isw* functions in , as well as in . Include , in advance to avoid rpl_ prefix being added to the declarations. */ #if defined _WIN32 && ! defined __CYGWIN__ # include # include #endif /* Include the original if it exists. BeOS 5 has the functions but no . */ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_WCTYPE_H@ # @INCLUDE_NEXT@ @NEXT_WCTYPE_H@ #endif #ifndef _@GUARD_PREFIX@_WCTYPE_H #define _@GUARD_PREFIX@_WCTYPE_H #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_WCTYPE_INLINE # define _GL_WCTYPE_INLINE _GL_INLINE #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Solaris 2.6 includes which includes which #defines a number of identifiers in the application namespace. Revert these #defines. */ #ifdef __sun # undef multibyte # undef eucw1 # undef eucw2 # undef eucw3 # undef scrw1 # undef scrw2 # undef scrw3 #endif /* Define wint_t and WEOF. (Also done in wchar.in.h.) */ #if !@HAVE_WINT_T@ && !defined wint_t # define wint_t int # ifndef WEOF # define WEOF -1 # endif #else /* mingw and MSVC define wint_t as 'unsigned short' in or . This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be "unchanged by default argument promotions". Override it. */ # if @GNULIBHEADERS_OVERRIDE_WINT_T@ # if !GNULIB_defined_wint_t # if @HAVE_CRTDEFS_H@ # include # else # include # endif typedef unsigned int rpl_wint_t; # undef wint_t # define wint_t rpl_wint_t # define GNULIB_defined_wint_t 1 # endif # endif # ifndef WEOF # define WEOF ((wint_t) -1) # endif #endif #if !GNULIB_defined_wctype_functions /* FreeBSD 4.4 to 4.11 has but lacks the functions. Linux libc5 has and the functions but they are broken. mingw and MSVC have and the functions but they take a wchar_t as argument, not an rpl_wint_t. Assume all 11 functions (all isw* except iswblank) are implemented the same way, or not at all. */ # if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ # if @GNULIBHEADERS_OVERRIDE_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */ _GL_WCTYPE_INLINE int rpl_iswalnum (wint_t wc) { return ((wchar_t) wc == wc ? iswalnum ((wchar_t) wc) : 0); } _GL_WCTYPE_INLINE int rpl_iswalpha (wint_t wc) { return ((wchar_t) wc == wc ? iswalpha ((wchar_t) wc) : 0); } _GL_WCTYPE_INLINE int rpl_iswblank (wint_t wc) { return ((wchar_t) wc == wc ? iswblank ((wchar_t) wc) : 0); } _GL_WCTYPE_INLINE int rpl_iswcntrl (wint_t wc) { return ((wchar_t) wc == wc ? iswcntrl ((wchar_t) wc) : 0); } _GL_WCTYPE_INLINE int rpl_iswdigit (wint_t wc) { return ((wchar_t) wc == wc ? wc >= '0' && wc <= '9' : 0); } _GL_WCTYPE_INLINE int rpl_iswgraph (wint_t wc) { return ((wchar_t) wc == wc ? iswgraph ((wchar_t) wc) : 0); } _GL_WCTYPE_INLINE int rpl_iswlower (wint_t wc) { return ((wchar_t) wc == wc ? iswlower ((wchar_t) wc) : 0); } _GL_WCTYPE_INLINE int rpl_iswprint (wint_t wc) { return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0); } _GL_WCTYPE_INLINE int rpl_iswpunct (wint_t wc) { return ((wchar_t) wc == wc ? iswpunct ((wchar_t) wc) : 0); } _GL_WCTYPE_INLINE int rpl_iswspace (wint_t wc) { return ((wchar_t) wc == wc ? iswspace ((wchar_t) wc) : 0); } _GL_WCTYPE_INLINE int rpl_iswupper (wint_t wc) { return ((wchar_t) wc == wc ? iswupper ((wchar_t) wc) : 0); } _GL_WCTYPE_INLINE int rpl_iswxdigit (wint_t wc) { return ((wchar_t) wc == wc ? (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F') : 0); } _GL_WCTYPE_INLINE wint_t rpl_towlower (wint_t wc) { return ((wchar_t) wc == wc ? (wchar_t) towlower ((wchar_t) wc) : wc); } _GL_WCTYPE_INLINE wint_t rpl_towupper (wint_t wc) { return ((wchar_t) wc == wc ? (wchar_t) towupper ((wchar_t) wc) : wc); } # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef iswalnum # undef iswalpha # undef iswblank # undef iswcntrl # undef iswdigit # undef iswgraph # undef iswlower # undef iswprint # undef iswpunct # undef iswspace # undef iswupper # undef iswxdigit # undef towlower # undef towupper # define iswalnum rpl_iswalnum # define iswalpha rpl_iswalpha # define iswblank rpl_iswblank # define iswcntrl rpl_iswcntrl # define iswdigit rpl_iswdigit # define iswgraph rpl_iswgraph # define iswlower rpl_iswlower # define iswprint rpl_iswprint # define iswpunct rpl_iswpunct # define iswspace rpl_iswspace # define iswupper rpl_iswupper # define iswxdigit rpl_iswxdigit # define towlower rpl_towlower # define towupper rpl_towupper # endif # else /* IRIX 5.3 has macros but no functions, its isw* macros refer to an undefined variable _ctmp_ and to macros like _P, and they refer to system functions like _iswctype that are not in the standard C library. Rather than try to get ancient buggy implementations like this to work, just disable them. */ # undef iswalnum # undef iswalpha # undef iswblank # undef iswcntrl # undef iswdigit # undef iswgraph # undef iswlower # undef iswprint # undef iswpunct # undef iswspace # undef iswupper # undef iswxdigit # undef towlower # undef towupper /* Linux libc5 has and the functions but they are broken. */ # if @REPLACE_ISWCNTRL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define iswalnum rpl_iswalnum # define iswalpha rpl_iswalpha # define iswblank rpl_iswblank # define iswcntrl rpl_iswcntrl # define iswdigit rpl_iswdigit # define iswgraph rpl_iswgraph # define iswlower rpl_iswlower # define iswprint rpl_iswprint # define iswpunct rpl_iswpunct # define iswspace rpl_iswspace # define iswupper rpl_iswupper # define iswxdigit rpl_iswxdigit # endif # endif # if @REPLACE_TOWLOWER@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define towlower rpl_towlower # define towupper rpl_towupper # endif # endif _GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswalnum # else iswalnum # endif (wint_t wc) { return ((wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); } _GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswalpha # else iswalpha # endif (wint_t wc) { return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; } _GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswblank # else iswblank # endif (wint_t wc) { return wc == ' ' || wc == '\t'; } _GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswcntrl # else iswcntrl # endif (wint_t wc) { return (wc & ~0x1f) == 0 || wc == 0x7f; } _GL_WCTYPE_INLINE int # if @REPLACE_ISWDIGIT@ rpl_iswdigit # else iswdigit # endif (wint_t wc) { return wc >= '0' && wc <= '9'; } _GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswgraph # else iswgraph # endif (wint_t wc) { return wc >= '!' && wc <= '~'; } _GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswlower # else iswlower # endif (wint_t wc) { return wc >= 'a' && wc <= 'z'; } _GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswprint # else iswprint # endif (wint_t wc) { return wc >= ' ' && wc <= '~'; } _GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswpunct # else iswpunct # endif (wint_t wc) { return (wc >= '!' && wc <= '~' && !((wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); } _GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswspace # else iswspace # endif (wint_t wc) { return (wc == ' ' || wc == '\t' || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); } _GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswupper # else iswupper # endif (wint_t wc) { return wc >= 'A' && wc <= 'Z'; } _GL_WCTYPE_INLINE int # if @REPLACE_ISWXDIGIT@ rpl_iswxdigit # else iswxdigit # endif (wint_t wc) { return ((wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); } _GL_WCTYPE_INLINE wint_t # if @REPLACE_TOWLOWER@ rpl_towlower # else towlower # endif (wint_t wc) { return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc); } _GL_WCTYPE_INLINE wint_t # if @REPLACE_TOWLOWER@ rpl_towupper # else towupper # endif (wint_t wc) { return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc); } # endif # else /* Only some of the functions are missing or broken. */ # if @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@) /* Only the iswblank function is missing. */ # if @REPLACE_ISWBLANK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define iswblank rpl_iswblank # endif _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); # else _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); # endif # endif # if @GNULIB_ISWDIGIT@ # if @REPLACE_ISWDIGIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef iswdigit # define iswdigit rpl_iswdigit # endif _GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc)); # endif # endif # if @GNULIB_ISWXDIGIT@ # if @REPLACE_ISWXDIGIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef iswxdigit # define iswxdigit rpl_iswxdigit # endif _GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc)); # endif # endif # endif # if defined __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t. The functions towlower and towupper are implemented in the MSVCRT library to take a wchar_t argument and return a wchar_t result. mingw declares these functions to take a wint_t argument and return a wint_t result. This means that: 1. When the user passes an argument outside the range 0x0000..0xFFFF, the function will look only at the lower 16 bits. This is allowed according to POSIX. 2. The return value is returned in the lower 16 bits of the result register. The upper 16 bits are random: whatever happened to be in that part of the result register. We need to fix this by adding a zero-extend from wchar_t to wint_t after the call. */ _GL_WCTYPE_INLINE wint_t rpl_towlower (wint_t wc) { return (wint_t) (wchar_t) towlower (wc); } # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define towlower rpl_towlower # endif _GL_WCTYPE_INLINE wint_t rpl_towupper (wint_t wc) { return (wint_t) (wchar_t) towupper (wc); } # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define towupper rpl_towupper # endif # endif /* __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ */ # define GNULIB_defined_wctype_functions 1 #endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc)); #else _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc)); #endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc)); #else _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc)); #endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc)); #else _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc)); #endif #if @GNULIB_ISWDIGIT@ # if @REPLACE_ISWDIGIT@ _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc)); # else _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc)); # endif #endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc)); #else _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc)); #endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswlower, int, (wint_t wc)); #else _GL_CXXALIAS_SYS (iswlower, int, (wint_t wc)); #endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswprint, int, (wint_t wc)); #else _GL_CXXALIAS_SYS (iswprint, int, (wint_t wc)); #endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc)); #else _GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc)); #endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswspace, int, (wint_t wc)); #else _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc)); #endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswupper, int, (wint_t wc)); #else _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc)); #endif #if @GNULIB_ISWXDIGIT@ # if @REPLACE_ISWXDIGIT@ _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc)); # else _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc)); # endif #endif #if __GLIBC__ >= 2 _GL_CXXALIASWARN (iswalnum); _GL_CXXALIASWARN (iswalpha); _GL_CXXALIASWARN (iswcntrl); _GL_CXXALIASWARN (iswdigit); _GL_CXXALIASWARN (iswgraph); _GL_CXXALIASWARN (iswlower); _GL_CXXALIASWARN (iswprint); _GL_CXXALIASWARN (iswpunct); _GL_CXXALIASWARN (iswspace); _GL_CXXALIASWARN (iswupper); _GL_CXXALIASWARN (iswxdigit); #endif #if @GNULIB_ISWBLANK@ # if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@ _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); # else _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (iswblank); # endif #endif #if !@HAVE_WCTYPE_T@ # if !GNULIB_defined_wctype_t typedef void * wctype_t; # define GNULIB_defined_wctype_t 1 # endif #endif /* Get a descriptor for a wide character property. */ #if @GNULIB_WCTYPE@ # if !@HAVE_WCTYPE_T@ _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)); # endif _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wctype); # endif #elif defined GNULIB_POSIXCHECK # undef wctype # if HAVE_RAW_DECL_WCTYPE _GL_WARN_ON_USE (wctype, "wctype is unportable - " "use gnulib module wctype for portability"); # endif #endif /* Test whether a wide character has a given property. The argument WC must be either a wchar_t value or WEOF. The argument DESC must have been returned by the wctype() function. */ #if @GNULIB_ISWCTYPE@ # if @GNULIBHEADERS_OVERRIDE_WINT_T@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef iswctype # define iswctype rpl_iswctype # endif _GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc)); _GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc)); # else # if !@HAVE_WCTYPE_T@ _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); # endif _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (iswctype); # endif #elif defined GNULIB_POSIXCHECK # undef iswctype # if HAVE_RAW_DECL_ISWCTYPE _GL_WARN_ON_USE (iswctype, "iswctype is unportable - " "use gnulib module iswctype for portability"); # endif #endif #if @REPLACE_TOWLOWER@ || defined __MINGW32__ _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc)); _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc)); #else _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc)); _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc)); #endif #if __GLIBC__ >= 2 _GL_CXXALIASWARN (towlower); _GL_CXXALIASWARN (towupper); #endif #if !@HAVE_WCTRANS_T@ # if !GNULIB_defined_wctrans_t typedef void * wctrans_t; # define GNULIB_defined_wctrans_t 1 # endif #endif /* Get a descriptor for a wide character case conversion. */ #if @GNULIB_WCTRANS@ # if !@HAVE_WCTRANS_T@ _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)); # endif _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wctrans); # endif #elif defined GNULIB_POSIXCHECK # undef wctrans # if HAVE_RAW_DECL_WCTRANS _GL_WARN_ON_USE (wctrans, "wctrans is unportable - " "use gnulib module wctrans for portability"); # endif #endif /* Perform a given case conversion on a wide character. The argument WC must be either a wchar_t value or WEOF. The argument DESC must have been returned by the wctrans() function. */ #if @GNULIB_TOWCTRANS@ # if !@HAVE_WCTRANS_T@ _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); # endif _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (towctrans); # endif #elif defined GNULIB_POSIXCHECK # undef towctrans # if HAVE_RAW_DECL_TOWCTRANS _GL_WARN_ON_USE (towctrans, "towctrans is unportable - " "use gnulib module towctrans for portability"); # endif #endif _GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_WCTYPE_H */ #endif /* _@GUARD_PREFIX@_WCTYPE_H */ #endif kbuild-3608/src/grep/lib/obstack.c0000664000175000017500000002755214670377425017024 0ustar locutuslocutus/* obstack.c - subroutines used implicitly by object stack macros Copyright (C) 1988-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifdef _LIBC # include #else # include # include "obstack.h" #endif /* NOTE BEFORE MODIFYING THIS FILE: _OBSTACK_INTERFACE_VERSION in obstack.h must be incremented whenever callers compiled using an old obstack.h can no longer properly call the functions in this file. */ /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself, and the installed library supports the same library interface we do. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand 'configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 # include # if (_GNU_OBSTACK_INTERFACE_VERSION == _OBSTACK_INTERFACE_VERSION \ || (_GNU_OBSTACK_INTERFACE_VERSION == 1 \ && _OBSTACK_INTERFACE_VERSION == 2 \ && defined SIZEOF_INT && defined SIZEOF_SIZE_T \ && SIZEOF_INT == SIZEOF_SIZE_T)) # define _OBSTACK_ELIDE_CODE # endif #endif #ifndef _OBSTACK_ELIDE_CODE /* If GCC, or if an oddball (testing?) host that #defines __alignof__, use the already-supplied __alignof__. Otherwise, this must be Gnulib (as glibc assumes GCC); defer to Gnulib's alignof_type. */ # if !defined __GNUC__ && !defined __alignof__ # include # define __alignof__(type) alignof_type (type) # endif # include # include # ifndef MAX # define MAX(a,b) ((a) > (b) ? (a) : (b)) # endif /* Determine default alignment. */ /* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. But in fact it might be less smart and round addresses to as much as DEFAULT_ROUNDING. So we prepare for it to do that. DEFAULT_ALIGNMENT cannot be an enum constant; see gnulib's alignof.h. */ #define DEFAULT_ALIGNMENT MAX (__alignof__ (long double), \ MAX (__alignof__ (uintmax_t), \ __alignof__ (void *))) #define DEFAULT_ROUNDING MAX (sizeof (long double), \ MAX (sizeof (uintmax_t), \ sizeof (void *))) /* Call functions with either the traditional malloc/free calling interface, or the mmalloc/mfree interface (that adds an extra first argument), based on the value of use_extra_arg. */ static void * call_chunkfun (struct obstack *h, size_t size) { if (h->use_extra_arg) return h->chunkfun.extra (h->extra_arg, size); else return h->chunkfun.plain (size); } static void call_freefun (struct obstack *h, void *old_chunk) { if (h->use_extra_arg) h->freefun.extra (h->extra_arg, old_chunk); else h->freefun.plain (old_chunk); } /* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). Objects start on multiples of ALIGNMENT (0 means use default). Return nonzero if successful, calls obstack_alloc_failed_handler if allocation fails. */ static int _obstack_begin_worker (struct obstack *h, _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment) { struct _obstack_chunk *chunk; /* points to new chunk */ if (alignment == 0) alignment = DEFAULT_ALIGNMENT; if (size == 0) /* Default size is what GNU malloc can fit in a 4096-byte block. */ { /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. Use the values for range checking, because if range checking is off, the extra bytes won't be missed terribly, but if range checking is on and we used a larger request, a whole extra 4096 bytes would be allocated. These number are irrelevant to the new GNU malloc. I suspect it is less sensitive to the size of the request. */ int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + 4 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)); size = 4096 - extra; } h->chunk_size = size; h->alignment_mask = alignment - 1; chunk = h->chunk = call_chunkfun (h, h->chunk_size); if (!chunk) (*obstack_alloc_failed_handler) (); h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; /* The initial chunk now contains no empty object. */ h->maybe_empty_object = 0; h->alloc_failed = 0; return 1; } int _obstack_begin (struct obstack *h, _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, void *(*chunkfun) (size_t), void (*freefun) (void *)) { h->chunkfun.plain = chunkfun; h->freefun.plain = freefun; h->use_extra_arg = 0; return _obstack_begin_worker (h, size, alignment); } int _obstack_begin_1 (struct obstack *h, _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, void *(*chunkfun) (void *, size_t), void (*freefun) (void *, void *), void *arg) { h->chunkfun.extra = chunkfun; h->freefun.extra = freefun; h->extra_arg = arg; h->use_extra_arg = 1; return _obstack_begin_worker (h, size, alignment); } /* Allocate a new current chunk for the obstack *H on the assumption that LENGTH bytes need to be added to the current object, or a new object of length LENGTH allocated. Copies any partial object from the end of the old chunk to the beginning of the new one. */ void _obstack_newchunk (struct obstack *h, _OBSTACK_SIZE_T length) { struct _obstack_chunk *old_chunk = h->chunk; struct _obstack_chunk *new_chunk = 0; size_t obj_size = h->next_free - h->object_base; char *object_base; /* Compute size for new chunk. */ size_t sum1 = obj_size + length; size_t sum2 = sum1 + h->alignment_mask; size_t new_size = sum2 + (obj_size >> 3) + 100; if (new_size < sum2) new_size = sum2; if (new_size < h->chunk_size) new_size = h->chunk_size; /* Allocate and initialize the new chunk. */ if (obj_size <= sum1 && sum1 <= sum2) new_chunk = call_chunkfun (h, new_size); if (!new_chunk) (*obstack_alloc_failed_handler)(); h->chunk = new_chunk; new_chunk->prev = old_chunk; new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; /* Compute an aligned object_base in the new chunk */ object_base = __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask); /* Move the existing object to the new chunk. */ memcpy (object_base, h->object_base, obj_size); /* If the object just copied was the only data in OLD_CHUNK, free that chunk and remove it from the chain. But not if that chunk might contain an empty object. */ if (!h->maybe_empty_object && (h->object_base == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, h->alignment_mask))) { new_chunk->prev = old_chunk->prev; call_freefun (h, old_chunk); } h->object_base = object_base; h->next_free = h->object_base + obj_size; /* The new chunk certainly contains no empty object yet. */ h->maybe_empty_object = 0; } /* Return nonzero if object OBJ has been allocated from obstack H. This is here for debugging. If you use it in a program, you are probably losing. */ /* Suppress -Wmissing-prototypes warning. We don't want to declare this in obstack.h because it is just for debugging. */ int _obstack_allocated_p (struct obstack *h, void *obj) __attribute_pure__; int _obstack_allocated_p (struct obstack *h, void *obj) { struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ struct _obstack_chunk *plp; /* point to previous chunk if any */ lp = (h)->chunk; /* We use >= rather than > since the object cannot be exactly at the beginning of the chunk but might be an empty object exactly at the end of an adjacent chunk. */ while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) { plp = lp->prev; lp = plp; } return lp != 0; } /* Free objects in obstack H, including OBJ and everything allocate more recently than OBJ. If OBJ is zero, free everything in H. */ void _obstack_free (struct obstack *h, void *obj) { struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ struct _obstack_chunk *plp; /* point to previous chunk if any */ lp = h->chunk; /* We use >= because there cannot be an object at the beginning of a chunk. But there can be an empty object at that address at the end of another chunk. */ while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) { plp = lp->prev; call_freefun (h, lp); lp = plp; /* If we switch chunks, we can't tell whether the new current chunk contains an empty object, so assume that it may. */ h->maybe_empty_object = 1; } if (lp) { h->object_base = h->next_free = (char *) (obj); h->chunk_limit = lp->limit; h->chunk = lp; } else if (obj != 0) /* obj is not in any of the chunks! */ abort (); } _OBSTACK_SIZE_T _obstack_memory_used (struct obstack *h) { struct _obstack_chunk *lp; _OBSTACK_SIZE_T nbytes = 0; for (lp = h->chunk; lp != 0; lp = lp->prev) { nbytes += lp->limit - (char *) lp; } return nbytes; } # ifndef _OBSTACK_NO_ERROR_HANDLER /* Define the error handler. */ # include /* Exit value used when 'print_and_abort' is used. */ # ifdef _LIBC int obstack_exit_failure = EXIT_FAILURE; # else # include "exitfail.h" # define obstack_exit_failure exit_failure # endif # ifdef _LIBC # include # else # include "gettext.h" # endif # ifndef _ # define _(msgid) gettext (msgid) # endif # ifdef _LIBC # include # endif static __attribute_noreturn__ void print_and_abort (void) { /* Don't change any of these strings. Yes, it would be possible to add the newline to the string and use fputs or so. But this must not happen because the "memory exhausted" message appears in other places like this and the translation should be reused instead of creating a very similar string which requires a separate translation. */ # ifdef _LIBC (void) __fxprintf (NULL, "%s\n", _("memory exhausted")); # else fprintf (stderr, "%s\n", _("memory exhausted")); # endif exit (obstack_exit_failure); } /* The functions allocating more room by calling 'obstack_chunk_alloc' jump to the handler pointed to by 'obstack_alloc_failed_handler'. This can be set to a user defined function which should either abort gracefully or use longjump - but shouldn't return. This variable by default points to the internal function 'print_and_abort'. */ __attribute_noreturn__ void (*obstack_alloc_failed_handler) (void) = print_and_abort; # endif /* !_OBSTACK_NO_ERROR_HANDLER */ #endif /* !_OBSTACK_ELIDE_CODE */ kbuild-3608/src/grep/lib/hard-locale.c0000664000175000017500000000215014670377423017532 0ustar locutuslocutus/* hard-locale.c -- Determine whether a locale is hard. Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include "hard-locale.h" #include #include bool hard_locale (int category) { char locale[SETLOCALE_NULL_MAX]; if (setlocale_null_r (category, locale, sizeof (locale))) return false; return !(strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0); } kbuild-3608/src/grep/lib/mbtowc-lock.h0000664000175000017500000000630414670377426017615 0ustar locutuslocutus/* Use the internal lock used by mbrtowc and mbrtoc32. Copyright (C) 2019-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2019-2020. */ /* Use a lock, so that no two threads can invoke mbtowc at the same time. */ static inline int mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m) { /* Put the hidden internal state of mbtowc into its initial state. This is needed at least with glibc, uClibc, and MSVC CRT. See . */ mbtowc (NULL, NULL, 0); return mbtowc (pwc, p, m); } /* Prohibit renaming this symbol. */ #undef gl_get_mbtowc_lock #if GNULIB_MBRTOWC_SINGLE_THREAD /* All uses of this function are in a single thread. No locking needed. */ static int mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m) { return mbtowc_unlocked (pwc, p, m); } #elif defined _WIN32 && !defined __CYGWIN__ extern __declspec(dllimport) CRITICAL_SECTION *gl_get_mbtowc_lock (void); static int mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m) { CRITICAL_SECTION *lock = gl_get_mbtowc_lock (); int ret; EnterCriticalSection (lock); ret = mbtowc_unlocked (pwc, p, m); LeaveCriticalSection (lock); return ret; } #elif HAVE_PTHREAD_API /* AIX, IRIX, Cygwin */ extern # if defined _WIN32 || defined __CYGWIN__ __declspec(dllimport) # endif pthread_mutex_t *gl_get_mbtowc_lock (void); # if HAVE_WEAK_SYMBOLS /* IRIX */ /* Avoid the need to link with '-lpthread'. */ # pragma weak pthread_mutex_lock # pragma weak pthread_mutex_unlock /* Determine whether libpthread is in use. */ # pragma weak pthread_mutexattr_gettype /* See the comments in lock.h. */ # define pthread_in_use() \ (pthread_mutexattr_gettype != NULL || c11_threads_in_use ()) # else # define pthread_in_use() 1 # endif static int mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m) { if (pthread_in_use()) { pthread_mutex_t *lock = gl_get_mbtowc_lock (); int ret; if (pthread_mutex_lock (lock)) abort (); ret = mbtowc_unlocked (pwc, p, m); if (pthread_mutex_unlock (lock)) abort (); return ret; } else return mbtowc_unlocked (pwc, p, m); } #elif HAVE_THREADS_H extern mtx_t *gl_get_mbtowc_lock (void); static int mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m) { mtx_t *lock = gl_get_mbtowc_lock (); int ret; if (mtx_lock (lock) != thrd_success) abort (); ret = mbtowc_unlocked (pwc, p, m); if (mtx_unlock (lock) != thrd_success) abort (); return ret; } #endif kbuild-3608/src/grep/lib/iconv_open-aix.h0000664000175000017500000002351514670377423020312 0ustar locutuslocutus/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -m 10 ./iconv_open-aix.gperf */ /* Computed positions: -k'4,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 17 "./iconv_open-aix.gperf" struct mapping { int standard_name; const char vendor_name[10 + 1]; }; #define TOTAL_KEYWORDS 32 #define MIN_WORD_LENGTH 4 #define MAX_WORD_LENGTH 11 #define MIN_HASH_VALUE 6 #define MAX_HASH_VALUE 44 /* maximum key range = 39, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int mapping_hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 0, 4, 25, 0, 11, 24, 9, 17, 3, 14, 21, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 3, 45, 1, 45, 45, 45, 45, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 }; return len + asso_values[(unsigned char)str[3]+2] + asso_values[(unsigned char)str[len - 1]]; } struct stringpool_t { char stringpool_str6[sizeof("EUC-TW")]; char stringpool_str7[sizeof("EUC-KR")]; char stringpool_str8[sizeof("CP852")]; char stringpool_str9[sizeof("EUC-JP")]; char stringpool_str10[sizeof("ISO-8859-2")]; char stringpool_str11[sizeof("CP857")]; char stringpool_str12[sizeof("CP850")]; char stringpool_str13[sizeof("ISO-8859-7")]; char stringpool_str14[sizeof("CP932")]; char stringpool_str15[sizeof("GB2312")]; char stringpool_str16[sizeof("BIG5")]; char stringpool_str17[sizeof("CP437")]; char stringpool_str19[sizeof("ISO-8859-5")]; char stringpool_str20[sizeof("ISO-8859-15")]; char stringpool_str21[sizeof("ISO-8859-3")]; char stringpool_str22[sizeof("ISO-8859-13")]; char stringpool_str23[sizeof("CP1046")]; char stringpool_str24[sizeof("ISO-8859-8")]; char stringpool_str25[sizeof("CP856")]; char stringpool_str26[sizeof("CP1125")]; char stringpool_str27[sizeof("ISO-8859-6")]; char stringpool_str28[sizeof("CP865")]; char stringpool_str29[sizeof("CP922")]; char stringpool_str30[sizeof("CP1252")]; char stringpool_str31[sizeof("ISO-8859-9")]; char stringpool_str33[sizeof("CP943")]; char stringpool_str34[sizeof("ISO-8859-4")]; char stringpool_str35[sizeof("ISO-8859-1")]; char stringpool_str38[sizeof("CP1129")]; char stringpool_str40[sizeof("CP869")]; char stringpool_str41[sizeof("CP1124")]; char stringpool_str44[sizeof("CP861")]; }; static const struct stringpool_t stringpool_contents = { "EUC-TW", "EUC-KR", "CP852", "EUC-JP", "ISO-8859-2", "CP857", "CP850", "ISO-8859-7", "CP932", "GB2312", "BIG5", "CP437", "ISO-8859-5", "ISO-8859-15", "ISO-8859-3", "ISO-8859-13", "CP1046", "ISO-8859-8", "CP856", "CP1125", "ISO-8859-6", "CP865", "CP922", "CP1252", "ISO-8859-9", "CP943", "ISO-8859-4", "ISO-8859-1", "CP1129", "CP869", "CP1124", "CP861" }; #define stringpool ((const char *) &stringpool_contents) static const struct mapping mappings[] = { {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, #line 59 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "IBM-eucTW"}, #line 58 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, "IBM-eucKR"}, #line 41 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, "IBM-852"}, #line 57 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, "IBM-eucJP"}, #line 30 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-2"}, #line 43 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "IBM-857"}, #line 40 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "IBM-850"}, #line 35 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-7"}, #line 49 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "IBM-932"}, #line 56 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "IBM-eucCN"}, #line 60 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "big5"}, #line 39 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "IBM-437"}, {-1}, #line 33 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-5"}, #line 38 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, "ISO8859-15"}, #line 31 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, "ISO8859-3"}, #line 47 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, "IBM-921"}, #line 51 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, "IBM-1046"}, #line 36 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str24, "ISO8859-8"}, #line 42 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25, "IBM-856"}, #line 53 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, "IBM-1125"}, #line 34 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, "ISO8859-6"}, #line 45 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str28, "IBM-865"}, #line 48 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, "IBM-922"}, #line 55 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, "IBM-1252"}, #line 37 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, "ISO8859-9"}, {-1}, #line 50 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, "IBM-943"}, #line 32 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34, "ISO8859-4"}, #line 29 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, "ISO8859-1"}, {-1}, {-1}, #line 54 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, "IBM-1129"}, {-1}, #line 46 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str40, "IBM-869"}, #line 52 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41, "IBM-1124"}, {-1}, {-1}, #line 44 "./iconv_open-aix.gperf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str44, "IBM-861"} }; const struct mapping * mapping_lookup (register const char *str, register size_t len) { if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = mapping_hash (str, len); if (key <= MAX_HASH_VALUE) { register int o = mappings[key].standard_name; if (o >= 0) { register const char *s = o + stringpool; if (*str == *s && !strcmp (str + 1, s + 1)) return &mappings[key]; } } } return 0; } kbuild-3608/src/grep/lib/dup-safer-flag.c0000664000175000017500000000315214670377423020157 0ustar locutuslocutus/* Duplicate a file descriptor result, avoiding clobbering STD{IN,OUT,ERR}_FILENO, with specific flags. Copyright (C) 2001, 2004-2006, 2009-2021 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 . */ /* Written by Paul Eggert and Eric Blake. */ #include /* Specification. */ #include "unistd-safer.h" #include #include /* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. If FLAG contains O_CLOEXEC, behave like fcntl(F_DUPFD_CLOEXEC) rather than fcntl(F_DUPFD). */ int dup_safer_flag (int fd, int flag) { #if defined(KMK_GREP) && defined(_MSC_VER) int afd[STDERR_FILENO + 1]; int i; for (i = 0; ; i++) { int fdNew = _dup(fd); if (fdNew >= STDERR_FILENO + 1 || fdNew < 0) { while (i-- > 0) close(afd[i]); return fdNew; } afd[i] = fdNew; } #else return fcntl (fd, (flag & O_CLOEXEC) ? F_DUPFD_CLOEXEC : F_DUPFD, STDERR_FILENO + 1); #endif } kbuild-3608/src/grep/lib/errno.in.h0000664000175000017500000001644714670377422017133 0ustar locutuslocutus/* A POSIX-like . Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_ERRNO_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_ERRNO_H@ #ifndef _@GUARD_PREFIX@_ERRNO_H #define _@GUARD_PREFIX@_ERRNO_H /* On native Windows platforms, many macros are not defined. */ # if defined _WIN32 && ! defined __CYGWIN__ /* These are the same values as defined by MSVC 10, for interoperability. */ # ifndef ENOMSG # define ENOMSG 122 # define GNULIB_defined_ENOMSG 1 # endif # ifndef EIDRM # define EIDRM 111 # define GNULIB_defined_EIDRM 1 # endif # ifndef ENOLINK # define ENOLINK 121 # define GNULIB_defined_ENOLINK 1 # endif # ifndef EPROTO # define EPROTO 134 # define GNULIB_defined_EPROTO 1 # endif # ifndef EBADMSG # define EBADMSG 104 # define GNULIB_defined_EBADMSG 1 # endif # ifndef EOVERFLOW # define EOVERFLOW 132 # define GNULIB_defined_EOVERFLOW 1 # endif # ifndef ENOTSUP # define ENOTSUP 129 # define GNULIB_defined_ENOTSUP 1 # endif # ifndef ENETRESET # define ENETRESET 117 # define GNULIB_defined_ENETRESET 1 # endif # ifndef ECONNABORTED # define ECONNABORTED 106 # define GNULIB_defined_ECONNABORTED 1 # endif # ifndef ECANCELED # define ECANCELED 105 # define GNULIB_defined_ECANCELED 1 # endif # ifndef EOWNERDEAD # define EOWNERDEAD 133 # define GNULIB_defined_EOWNERDEAD 1 # endif # ifndef ENOTRECOVERABLE # define ENOTRECOVERABLE 127 # define GNULIB_defined_ENOTRECOVERABLE 1 # endif # ifndef EINPROGRESS # define EINPROGRESS 112 # define EALREADY 103 # define ENOTSOCK 128 # define EDESTADDRREQ 109 # define EMSGSIZE 115 # define EPROTOTYPE 136 # define ENOPROTOOPT 123 # define EPROTONOSUPPORT 135 # define EOPNOTSUPP 130 # define EAFNOSUPPORT 102 # define EADDRINUSE 100 # define EADDRNOTAVAIL 101 # define ENETDOWN 116 # define ENETUNREACH 118 # define ECONNRESET 108 # define ENOBUFS 119 # define EISCONN 113 # define ENOTCONN 126 # define ETIMEDOUT 138 # define ECONNREFUSED 107 # define ELOOP 114 # define EHOSTUNREACH 110 # define EWOULDBLOCK 140 # define GNULIB_defined_ESOCK 1 # endif # ifndef ETXTBSY # define ETXTBSY 139 # define ENODATA 120 /* not required by POSIX */ # define ENOSR 124 /* not required by POSIX */ # define ENOSTR 125 /* not required by POSIX */ # define ETIME 137 /* not required by POSIX */ # define EOTHER 131 /* not required by POSIX */ # define GNULIB_defined_ESTREAMS 1 # endif /* These are intentionally the same values as the WSA* error numbers, defined in . */ # define ESOCKTNOSUPPORT 10044 /* not required by POSIX */ # define EPFNOSUPPORT 10046 /* not required by POSIX */ # define ESHUTDOWN 10058 /* not required by POSIX */ # define ETOOMANYREFS 10059 /* not required by POSIX */ # define EHOSTDOWN 10064 /* not required by POSIX */ # define EPROCLIM 10067 /* not required by POSIX */ # define EUSERS 10068 /* not required by POSIX */ # define EDQUOT 10069 # define ESTALE 10070 # define EREMOTE 10071 /* not required by POSIX */ # define GNULIB_defined_EWINSOCK 1 # endif /* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */ # if @EMULTIHOP_HIDDEN@ # define EMULTIHOP @EMULTIHOP_VALUE@ # define GNULIB_defined_EMULTIHOP 1 # endif # if @ENOLINK_HIDDEN@ # define ENOLINK @ENOLINK_VALUE@ # define GNULIB_defined_ENOLINK 1 # endif # if @EOVERFLOW_HIDDEN@ # define EOVERFLOW @EOVERFLOW_VALUE@ # define GNULIB_defined_EOVERFLOW 1 # endif /* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK, EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined. Likewise, on NonStop Kernel, EDQUOT is not defined. Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151, HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133. Note: When one of these systems defines some of these macros some day, binaries will have to be recompiled so that they recognizes the new errno values from the system. */ # ifndef ENOMSG # define ENOMSG 2000 # define GNULIB_defined_ENOMSG 1 # endif # ifndef EIDRM # define EIDRM 2001 # define GNULIB_defined_EIDRM 1 # endif # ifndef ENOLINK # define ENOLINK 2002 # define GNULIB_defined_ENOLINK 1 # endif # ifndef EPROTO # define EPROTO 2003 # define GNULIB_defined_EPROTO 1 # endif # ifndef EMULTIHOP # define EMULTIHOP 2004 # define GNULIB_defined_EMULTIHOP 1 # endif # ifndef EBADMSG # define EBADMSG 2005 # define GNULIB_defined_EBADMSG 1 # endif # ifndef EOVERFLOW # define EOVERFLOW 2006 # define GNULIB_defined_EOVERFLOW 1 # endif # ifndef ENOTSUP # define ENOTSUP 2007 # define GNULIB_defined_ENOTSUP 1 # endif # ifndef ENETRESET # define ENETRESET 2011 # define GNULIB_defined_ENETRESET 1 # endif # ifndef ECONNABORTED # define ECONNABORTED 2012 # define GNULIB_defined_ECONNABORTED 1 # endif # ifndef ESTALE # define ESTALE 2009 # define GNULIB_defined_ESTALE 1 # endif # ifndef EDQUOT # define EDQUOT 2010 # define GNULIB_defined_EDQUOT 1 # endif # ifndef ECANCELED # define ECANCELED 2008 # define GNULIB_defined_ECANCELED 1 # endif /* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not defined. */ # ifndef EOWNERDEAD # if defined __sun /* Use the same values as defined for Solaris >= 8, for interoperability. */ # define EOWNERDEAD 58 # define ENOTRECOVERABLE 59 # elif defined _WIN32 && ! defined __CYGWIN__ /* We have a conflict here: pthreads-win32 defines these values differently than MSVC 10. It's hairy to decide which one to use. */ # if defined __MINGW32__ && !defined USE_WINDOWS_THREADS /* Use the same values as defined by pthreads-win32, for interoperability. */ # define EOWNERDEAD 43 # define ENOTRECOVERABLE 44 # else /* Use the same values as defined by MSVC 10, for interoperability. */ # define EOWNERDEAD 133 # define ENOTRECOVERABLE 127 # endif # else # define EOWNERDEAD 2013 # define ENOTRECOVERABLE 2014 # endif # define GNULIB_defined_EOWNERDEAD 1 # define GNULIB_defined_ENOTRECOVERABLE 1 # endif # ifndef EILSEQ # define EILSEQ 2015 # define GNULIB_defined_EILSEQ 1 # endif #endif /* _@GUARD_PREFIX@_ERRNO_H */ #endif /* _@GUARD_PREFIX@_ERRNO_H */ kbuild-3608/src/grep/lib/i-ring.c0000664000175000017500000000343014670377423016546 0ustar locutuslocutus/* a simple ring buffer Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Jim Meyering */ #include #include "i-ring.h" #include void i_ring_init (I_ring *ir, int default_val) { int i; ir->ir_empty = true; ir->ir_front = 0; ir->ir_back = 0; for (i = 0; i < I_RING_SIZE; i++) ir->ir_data[i] = default_val; ir->ir_default_val = default_val; } bool i_ring_empty (I_ring const *ir) { return ir->ir_empty; } int i_ring_push (I_ring *ir, int val) { unsigned int dest_idx = (ir->ir_front + !ir->ir_empty) % I_RING_SIZE; int old_val = ir->ir_data[dest_idx]; ir->ir_data[dest_idx] = val; ir->ir_front = dest_idx; if (dest_idx == ir->ir_back) ir->ir_back = (ir->ir_back + !ir->ir_empty) % I_RING_SIZE; ir->ir_empty = false; return old_val; } int i_ring_pop (I_ring *ir) { int top_val; if (i_ring_empty (ir)) abort (); top_val = ir->ir_data[ir->ir_front]; ir->ir_data[ir->ir_front] = ir->ir_default_val; if (ir->ir_front == ir->ir_back) ir->ir_empty = true; else ir->ir_front = ((ir->ir_front + I_RING_SIZE - 1) % I_RING_SIZE); return top_val; } kbuild-3608/src/grep/lib/striconv.h0000664000175000017500000000570614670377426017250 0ustar locutuslocutus/* Charset conversion. Copyright (C) 2001-2004, 2006-2007, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _STRICONV_H #define _STRICONV_H #include #if HAVE_ICONV #include #endif #ifdef __cplusplus extern "C" { #endif #if HAVE_ICONV /* Convert an entire string from one encoding to another, using iconv. The original string is at [SRC,...,SRC+SRCLEN-1]. The conversion descriptor is passed as CD. *RESULTP and *LENGTH should initially be a scratch buffer and its size, or *RESULTP can initially be NULL. May erase the contents of the memory at *RESULTP. Return value: 0 if successful, otherwise -1 and errno set. If successful: The resulting string is stored in *RESULTP and its length in *LENGTHP. *RESULTP is set to a freshly allocated memory block, or is unchanged if no dynamic memory allocation was necessary. */ extern int mem_cd_iconv (const char *src, size_t srclen, iconv_t cd, char **resultp, size_t *lengthp); /* Convert an entire string from one encoding to another, using iconv. The original string is the NUL-terminated string starting at SRC. The conversion descriptor is passed as CD. Both the "from" and the "to" encoding must use a single NUL byte at the end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32). Allocate a malloced memory block for the result. Return value: the freshly allocated resulting NUL-terminated string if successful, otherwise NULL and errno set. */ extern char * str_cd_iconv (const char *src, iconv_t cd) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; #endif /* Convert an entire string from one encoding to another, using iconv. The original string is the NUL-terminated string starting at SRC. Both the "from" and the "to" encoding must use a single NUL byte at the end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32). Allocate a malloced memory block for the result. Return value: the freshly allocated resulting NUL-terminated string if successful, otherwise NULL and errno set. */ extern char * str_iconv (const char *src, const char *from_codeset, const char *to_codeset) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; #ifdef __cplusplus } #endif #endif /* _STRICONV_H */ kbuild-3608/src/grep/lib/bitrotate.h0000664000175000017500000001103014670377422017355 0ustar locutuslocutus/* bitrotate.h - Rotate bits in integers Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Simon Josefsson , 2008. */ #ifndef _GL_BITROTATE_H #define _GL_BITROTATE_H #include #include #include #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef BITROTATE_INLINE # define BITROTATE_INLINE _GL_INLINE #endif #ifdef UINT64_MAX /* Given an unsigned 64-bit argument X, return the value corresponding to rotating the bits N steps to the left. N must be between 1 and 63 inclusive. */ BITROTATE_INLINE uint64_t rotl64 (uint64_t x, int n) { return ((x << n) | (x >> (64 - n))) & UINT64_MAX; } /* Given an unsigned 64-bit argument X, return the value corresponding to rotating the bits N steps to the right. N must be between 1 to 63 inclusive.*/ BITROTATE_INLINE uint64_t rotr64 (uint64_t x, int n) { return ((x >> n) | (x << (64 - n))) & UINT64_MAX; } #endif /* Given an unsigned 32-bit argument X, return the value corresponding to rotating the bits N steps to the left. N must be between 1 and 31 inclusive. */ BITROTATE_INLINE uint32_t rotl32 (uint32_t x, int n) { return ((x << n) | (x >> (32 - n))) & UINT32_MAX; } /* Given an unsigned 32-bit argument X, return the value corresponding to rotating the bits N steps to the right. N must be between 1 to 31 inclusive.*/ BITROTATE_INLINE uint32_t rotr32 (uint32_t x, int n) { return ((x >> n) | (x << (32 - n))) & UINT32_MAX; } /* Given a size_t argument X, return the value corresponding to rotating the bits N steps to the left. N must be between 1 and (CHAR_BIT * sizeof (size_t) - 1) inclusive. */ BITROTATE_INLINE size_t rotl_sz (size_t x, int n) { return ((x << n) | (x >> ((CHAR_BIT * sizeof x) - n))) & SIZE_MAX; } /* Given a size_t argument X, return the value corresponding to rotating the bits N steps to the right. N must be between 1 to (CHAR_BIT * sizeof (size_t) - 1) inclusive. */ BITROTATE_INLINE size_t rotr_sz (size_t x, int n) { return ((x >> n) | (x << ((CHAR_BIT * sizeof x) - n))) & SIZE_MAX; } /* Given an unsigned 16-bit argument X, return the value corresponding to rotating the bits N steps to the left. N must be between 1 to 15 inclusive, but on most relevant targets N can also be 0 and 16 because 'int' is at least 32 bits and the arguments must widen before shifting. */ BITROTATE_INLINE uint16_t rotl16 (uint16_t x, int n) { return (((unsigned int) x << n) | ((unsigned int) x >> (16 - n))) & UINT16_MAX; } /* Given an unsigned 16-bit argument X, return the value corresponding to rotating the bits N steps to the right. N must be in 1 to 15 inclusive, but on most relevant targets N can also be 0 and 16 because 'int' is at least 32 bits and the arguments must widen before shifting. */ BITROTATE_INLINE uint16_t rotr16 (uint16_t x, int n) { return (((unsigned int) x >> n) | ((unsigned int) x << (16 - n))) & UINT16_MAX; } /* Given an unsigned 8-bit argument X, return the value corresponding to rotating the bits N steps to the left. N must be between 1 to 7 inclusive, but on most relevant targets N can also be 0 and 8 because 'int' is at least 32 bits and the arguments must widen before shifting. */ BITROTATE_INLINE uint8_t rotl8 (uint8_t x, int n) { return (((unsigned int) x << n) | ((unsigned int) x >> (8 - n))) & UINT8_MAX; } /* Given an unsigned 8-bit argument X, return the value corresponding to rotating the bits N steps to the right. N must be in 1 to 7 inclusive, but on most relevant targets N can also be 0 and 8 because 'int' is at least 32 bits and the arguments must widen before shifting. */ BITROTATE_INLINE uint8_t rotr8 (uint8_t x, int n) { return (((unsigned int) x >> n) | ((unsigned int) x << (8 - n))) & UINT8_MAX; } _GL_INLINE_HEADER_END #endif /* _GL_BITROTATE_H */ kbuild-3608/src/grep/lib/exclude.c0000664000175000017500000004217514670377422017022 0ustar locutuslocutus/* exclude.c -- exclude file names Copyright (C) 1992-1994, 1997, 1999-2007, 2009-2021 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 . */ /* Written by Paul Eggert and Sergey Poznyakoff . Thanks to Phil Proudman for improvement suggestions. */ #include #include #include #include #include #include #include #include #include #include #include "exclude.h" #include "hash.h" #include "mbuiter.h" #include "fnmatch.h" #include "xalloc.h" #include "verify.h" #include "filename.h" #if GNULIB_EXCLUDE_SINGLE_THREAD # include "unlocked-io.h" #endif /* Non-GNU systems lack these options, so we don't need to check them. */ #ifndef FNM_CASEFOLD # define FNM_CASEFOLD 0 #endif #ifndef FNM_EXTMATCH # define FNM_EXTMATCH 0 #endif #ifndef FNM_LEADING_DIR # define FNM_LEADING_DIR 0 #endif verify (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS) & (FNM_PATHNAME | FNM_NOESCAPE | FNM_PERIOD | FNM_LEADING_DIR | FNM_CASEFOLD | FNM_EXTMATCH)) == 0); /* Exclusion patterns are grouped into a singly-linked list of "exclusion segments". Each segment represents a set of patterns that can be matches using the same algorithm. Non-wildcard patterns are kept in hash tables, to speed up searches. Wildcard patterns are stored as arrays of patterns. */ /* An exclude pattern-options pair. The options are fnmatch options ORed with EXCLUDE_* options. */ struct patopts { int options; union { char const *pattern; regex_t re; } v; }; /* An array of pattern-options pairs. */ struct exclude_pattern { struct patopts *exclude; idx_t exclude_alloc; idx_t exclude_count; }; enum exclude_type { exclude_hash, /* a hash table of excluded names */ exclude_pattern /* an array of exclude patterns */ }; struct exclude_segment { struct exclude_segment *next; /* next segment in list */ enum exclude_type type; /* type of this segment */ int options; /* common options for this segment */ union { Hash_table *table; /* for type == exclude_hash */ struct exclude_pattern pat; /* for type == exclude_pattern */ } v; }; struct pattern_buffer { struct pattern_buffer *next; char *base; }; /* The exclude structure keeps a singly-linked list of exclude segments, maintained in reverse order. */ struct exclude { struct exclude_segment *head; struct pattern_buffer *patbuf; }; /* Register BUF in the pattern buffer list of EX. ADD_FUNC (see add_exclude_file and add_exclude_fp below) can use this function if it modifies the pattern, to ensure the allocated memory will be properly reclaimed upon calling free_exclude. */ void exclude_add_pattern_buffer (struct exclude *ex, char *buf) { struct pattern_buffer *pbuf = xmalloc (sizeof *pbuf); pbuf->base = buf; pbuf->next = ex->patbuf; ex->patbuf = pbuf; } /* Return true if STR has or may have wildcards, when matched with OPTIONS. Return false if STR definitely does not have wildcards. */ bool fnmatch_pattern_has_wildcards (const char *str, int options) { while (1) { switch (*str++) { case '.': case '{': case '}': case '(': case ')': if (options & EXCLUDE_REGEX) return true; break; case '\\': if (options & EXCLUDE_REGEX) continue; else str += ! (options & FNM_NOESCAPE) && *str; break; case '+': case '@': case '!': if (options & FNM_EXTMATCH && *str == '(') return true; break; case '?': case '*': case '[': return true; case '\0': return false; } } } static void unescape_pattern (char *str) { char const *q = str; do q += *q == '\\' && q[1]; while ((*str++ = *q++)); } /* Return a newly allocated and empty exclude list. */ struct exclude * new_exclude (void) { return xzalloc (sizeof *new_exclude ()); } /* Calculate the hash of string. */ static size_t string_hasher (void const *data, size_t n_buckets) { char const *p = data; return hash_string (p, n_buckets); } /* Ditto, for case-insensitive hashes */ static size_t string_hasher_ci (void const *data, size_t n_buckets) { char const *p = data; mbui_iterator_t iter; size_t value = 0; for (mbui_init (iter, p); mbui_avail (iter); mbui_advance (iter)) { mbchar_t m = mbui_cur (iter); wchar_t wc; if (m.wc_valid) wc = towlower (m.wc); else wc = *m.ptr; value = value * 31 + wc; } return value % n_buckets; } /* compare two strings for equality */ static bool string_compare (void const *data1, void const *data2) { char const *p1 = data1; char const *p2 = data2; return strcmp (p1, p2) == 0; } /* compare two strings for equality, case-insensitive */ static bool string_compare_ci (void const *data1, void const *data2) { char const *p1 = data1; char const *p2 = data2; return mbscasecmp (p1, p2) == 0; } static void string_free (void *data) { free (data); } /* Create new exclude segment of given TYPE and OPTIONS, and attach it to the head of EX. */ static void new_exclude_segment (struct exclude *ex, enum exclude_type type, int options) { struct exclude_segment *sp = xzalloc (sizeof (struct exclude_segment)); sp->type = type; sp->options = options; switch (type) { case exclude_pattern: break; case exclude_hash: sp->v.table = hash_initialize (0, NULL, (options & FNM_CASEFOLD) ? string_hasher_ci : string_hasher, (options & FNM_CASEFOLD) ? string_compare_ci : string_compare, string_free); break; } sp->next = ex->head; ex->head = sp; } /* Free a single exclude segment */ static void free_exclude_segment (struct exclude_segment *seg) { switch (seg->type) { case exclude_pattern: for (idx_t i = 0; i < seg->v.pat.exclude_count; i++) { if (seg->v.pat.exclude[i].options & EXCLUDE_REGEX) regfree (&seg->v.pat.exclude[i].v.re); } free (seg->v.pat.exclude); break; case exclude_hash: hash_free (seg->v.table); break; } free (seg); } /* Free the storage associated with an exclude list. */ void free_exclude (struct exclude *ex) { struct exclude_segment *seg; struct pattern_buffer *pbuf; for (seg = ex->head; seg; ) { struct exclude_segment *next = seg->next; free_exclude_segment (seg); seg = next; } for (pbuf = ex->patbuf; pbuf; ) { struct pattern_buffer *next = pbuf->next; free (pbuf->base); free (pbuf); pbuf = next; } free (ex); } /* Return zero if PATTERN matches F, obeying OPTIONS, except that (unlike fnmatch) wildcards are disabled in PATTERN. */ static int fnmatch_no_wildcards (char const *pattern, char const *f, int options) { if (! (options & FNM_LEADING_DIR)) return ((options & FNM_CASEFOLD) ? mbscasecmp (pattern, f) : strcmp (pattern, f)); else if (! (options & FNM_CASEFOLD)) { size_t patlen = strlen (pattern); int r = strncmp (pattern, f, patlen); if (! r) { r = f[patlen]; if (r == '/') r = 0; } return r; } else { /* Walk through a copy of F, seeing whether P matches any prefix of F. FIXME: This is an O(N**2) algorithm; it should be O(N). Also, the copy should not be necessary. However, fixing this will probably involve a change to the mbs* API. */ char *fcopy = xstrdup (f); char *p; int r; for (p = fcopy; ; *p++ = '/') { p = strchr (p, '/'); if (p) *p = '\0'; r = mbscasecmp (pattern, fcopy); if (!p || r <= 0) break; } free (fcopy); return r; } } bool exclude_fnmatch (char const *pattern, char const *f, int options) { int (*matcher) (char const *, char const *, int) = (options & EXCLUDE_WILDCARDS ? fnmatch : fnmatch_no_wildcards); bool matched = ((*matcher) (pattern, f, options) == 0); char const *p; if (! (options & EXCLUDE_ANCHORED)) for (p = f; *p && ! matched; p++) if (*p == '/' && p[1] != '/') matched = ((*matcher) (pattern, p + 1, options) == 0); return matched; } static bool exclude_patopts (struct patopts const *opts, char const *f) { int options = opts->options; return (options & EXCLUDE_REGEX) ? regexec (&opts->v.re, f, 0, NULL, 0) == 0 : exclude_fnmatch (opts->v.pattern, f, options); } /* Return true if the exclude_pattern segment SEG matches F. */ static bool file_pattern_matches (struct exclude_segment const *seg, char const *f) { idx_t exclude_count = seg->v.pat.exclude_count; struct patopts const *exclude = seg->v.pat.exclude; for (idx_t i = 0; i < exclude_count; i++) { if (exclude_patopts (exclude + i, f)) return true; } return false; } /* Return true if the exclude_hash segment SEG matches F. BUFFER is an auxiliary storage of the same length as F (with nul terminator included) */ static bool file_name_matches (struct exclude_segment const *seg, char const *f, char *buffer) { int options = seg->options; Hash_table *table = seg->v.table; do { /* initialize the pattern */ strcpy (buffer, f); while (1) { if (hash_lookup (table, buffer)) return true; if (options & FNM_LEADING_DIR) { char *p = strrchr (buffer, '/'); if (p) { *p = 0; continue; } } break; } if (!(options & EXCLUDE_ANCHORED)) { f = strchr (f, '/'); if (f) f++; } else break; } while (f); return false; } /* Return true if EX excludes F. */ bool excluded_file_name (struct exclude const *ex, char const *f) { struct exclude_segment *seg; bool invert = false; char *filename = NULL; /* If no patterns are given, the default is to include. */ if (!ex->head) return false; /* Scan through the segments, reporting the status of the first match. The segments are in reverse order, so this reports the status of the last match in the original option list. */ for (seg = ex->head; ; seg = seg->next) { if (seg->type == exclude_hash) { if (!filename) filename = xmalloc (strlen (f) + 1); if (file_name_matches (seg, f, filename)) break; } else { if (file_pattern_matches (seg, f)) break; } if (! seg->next) { /* If patterns are given but none match, the default is the opposite of the last segment (i.e., the first in the original option list). For example, in the command 'grep -r --exclude="a*" --include="*b" pat dir', the first option is --exclude so any file name matching neither a* nor *b is included. */ invert = true; break; } } free (filename); return invert ^ ! (seg->options & EXCLUDE_INCLUDE); } /* Append to EX the exclusion PATTERN with OPTIONS. */ void add_exclude (struct exclude *ex, char const *pattern, int options) { struct exclude_segment *seg; struct exclude_pattern *pat; struct patopts *patopts; if ((options & (EXCLUDE_REGEX|EXCLUDE_WILDCARDS)) && fnmatch_pattern_has_wildcards (pattern, options)) { if (! (ex->head && ex->head->type == exclude_pattern && ((ex->head->options & EXCLUDE_INCLUDE) == (options & EXCLUDE_INCLUDE)))) new_exclude_segment (ex, exclude_pattern, options); seg = ex->head; pat = &seg->v.pat; if (pat->exclude_count == pat->exclude_alloc) pat->exclude = xpalloc (pat->exclude, &pat->exclude_alloc, 1, -1, sizeof *pat->exclude); patopts = &pat->exclude[pat->exclude_count++]; patopts->options = options; if (options & EXCLUDE_REGEX) { int rc; int cflags = REG_NOSUB|REG_EXTENDED| ((options & FNM_CASEFOLD) ? REG_ICASE : 0); if (options & FNM_LEADING_DIR) { char *tmp; idx_t len = strlen (pattern); while (len > 0 && ISSLASH (pattern[len-1])) --len; if (len == 0) rc = 1; else { tmp = ximalloc (len + 7); memcpy (tmp, pattern, len); strcpy (tmp + len, "(/.*)?"); rc = regcomp (&patopts->v.re, tmp, cflags); free (tmp); } } else rc = regcomp (&patopts->v.re, pattern, cflags); if (rc) { pat->exclude_count--; return; } } else { if (options & EXCLUDE_ALLOC) { pattern = xstrdup (pattern); exclude_add_pattern_buffer (ex, (char*) pattern); } patopts->v.pattern = pattern; } } else { char *str, *p; int exclude_hash_flags = (EXCLUDE_INCLUDE | EXCLUDE_ANCHORED | FNM_LEADING_DIR | FNM_CASEFOLD); if (! (ex->head && ex->head->type == exclude_hash && ((ex->head->options & exclude_hash_flags) == (options & exclude_hash_flags)))) new_exclude_segment (ex, exclude_hash, options); seg = ex->head; str = xstrdup (pattern); if ((options & (EXCLUDE_WILDCARDS | FNM_NOESCAPE)) == EXCLUDE_WILDCARDS) unescape_pattern (str); p = hash_insert (seg->v.table, str); if (p != str) free (str); } } /* Use ADD_FUNC to append to EX the patterns in FILE_NAME, each with OPTIONS. LINE_END terminates each pattern in the file. If LINE_END is a space character, ignore trailing spaces and empty lines in FP. Return -1 on failure, 0 on success. */ int add_exclude_fp (void (*add_func) (struct exclude *, char const *, int, void *), struct exclude *ex, FILE *fp, int options, char line_end, void *data) { char *buf = NULL; char *p; char *pattern; char const *lim; idx_t buf_alloc = 0; idx_t buf_count = 0; int c; int e = 0; while ((c = getc (fp)) != EOF) { if (buf_count == buf_alloc) buf = xpalloc (buf, &buf_alloc, 1, -1, 1); buf[buf_count++] = c; } if (ferror (fp)) e = errno; buf = xirealloc (buf, buf_count + 1); buf[buf_count] = line_end; lim = buf + buf_count + ! (buf_count == 0 || buf[buf_count - 1] == line_end); exclude_add_pattern_buffer (ex, buf); pattern = buf; for (p = buf; p < lim; p++) if (*p == line_end) { char *pattern_end = p; if (isspace ((unsigned char) line_end)) { for (; ; pattern_end--) if (pattern_end == pattern) goto next_pattern; else if (! isspace ((unsigned char) pattern_end[-1])) break; } *pattern_end = '\0'; (*add_func) (ex, pattern, options, data); next_pattern: pattern = p + 1; } errno = e; return e ? -1 : 0; } static void call_addfn (struct exclude *ex, char const *pattern, int options, void *data) { void (**addfnptr) (struct exclude *, char const *, int) = data; (*addfnptr) (ex, pattern, options); } int add_exclude_file (void (*add_func) (struct exclude *, char const *, int), struct exclude *ex, char const *file_name, int options, char line_end) { bool use_stdin = file_name[0] == '-' && !file_name[1]; FILE *in; int rc = 0; if (use_stdin) in = stdin; else if (! (in = fopen (file_name, "re"))) return -1; rc = add_exclude_fp (call_addfn, ex, in, options, line_end, &add_func); if (!use_stdin && fclose (in) != 0) rc = -1; return rc; } kbuild-3608/src/grep/lib/argmatch.h0000664000175000017500000004664514670377422017172 0ustar locutuslocutus/* argmatch.h -- definitions and prototypes for argmatch.c Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2021 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 . */ /* Written by David MacKenzie Modified by Akim Demaille */ #ifndef ARGMATCH_H_ # define ARGMATCH_H_ 1 # include # include # include # include # include /* memcmp */ # include "gettext.h" # include "quote.h" # include "verify.h" # ifdef __cplusplus extern "C" { # endif # define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) /* Assert there are as many real arguments as there are values (argument list ends with a NULL guard). */ # define ARGMATCH_VERIFY(Arglist, Vallist) \ verify (ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1) /* Return the index of the element of ARGLIST (NULL terminated) that matches with ARG. If VALLIST is not NULL, then use it to resolve false ambiguities (i.e., different matches of ARG but corresponding to the same values in VALLIST). */ ptrdiff_t argmatch (char const *arg, char const *const *arglist, void const *vallist, size_t valsize) _GL_ATTRIBUTE_PURE; # define ARGMATCH(Arg, Arglist, Vallist) \ argmatch (Arg, Arglist, (void const *) (Vallist), sizeof *(Vallist)) /* xargmatch calls this function when it fails. This function should not return. By default, this is a function that calls ARGMATCH_DIE which in turn defaults to 'exit (exit_failure)'. */ typedef void (*argmatch_exit_fn) (void); extern argmatch_exit_fn argmatch_die; /* Report on stderr why argmatch failed. Report correct values. */ void argmatch_invalid (char const *context, char const *value, ptrdiff_t problem); /* Left for compatibility with the old name invalid_arg */ # define invalid_arg(Context, Value, Problem) \ argmatch_invalid (Context, Value, Problem) /* Report on stderr the list of possible arguments. */ void argmatch_valid (char const *const *arglist, void const *vallist, size_t valsize); # define ARGMATCH_VALID(Arglist, Vallist) \ argmatch_valid (Arglist, (void const *) (Vallist), sizeof *(Vallist)) /* Same as argmatch, but upon failure, report an explanation of the failure, and exit using the function EXIT_FN. */ ptrdiff_t __xargmatch_internal (char const *context, char const *arg, char const *const *arglist, void const *vallist, size_t valsize, argmatch_exit_fn exit_fn); /* Programmer friendly interface to __xargmatch_internal. */ # define XARGMATCH(Context, Arg, Arglist, Vallist) \ ((Vallist) [__xargmatch_internal (Context, Arg, Arglist, \ (void const *) (Vallist), \ sizeof *(Vallist), \ argmatch_die)]) /* Convert a value into a corresponding argument. */ char const *argmatch_to_argument (void const *value, char const *const *arglist, void const *vallist, size_t valsize) _GL_ATTRIBUTE_PURE; # define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist) \ argmatch_to_argument (Value, Arglist, \ (void const *) (Vallist), sizeof *(Vallist)) # define ARGMATCH_DEFINE_GROUP(Name, Type) \ /* The type of the values of this group. */ \ typedef Type argmatch_##Name##_type; \ \ /* The size of the type of the values of this group. */ \ enum argmatch_##Name##_size_enum \ { \ argmatch_##Name##_size = sizeof (argmatch_##Name##_type) \ }; \ \ /* Argument mapping of this group. */ \ typedef struct \ { \ /* Argument (e.g., "simple"). */ \ const char *arg; \ /* Value (e.g., simple_backups). */ \ const argmatch_##Name##_type val; \ } argmatch_##Name##_arg; \ \ /* Documentation of this group. */ \ typedef struct \ { \ /* Argument (e.g., "simple"). */ \ const char *arg; \ /* Documentation (e.g., N_("always make simple backups")). */ \ const char *doc; \ } argmatch_##Name##_doc; \ \ /* All the features of an argmatch group. */ \ typedef struct \ { \ const argmatch_##Name##_arg* args; \ const argmatch_##Name##_doc* docs; \ \ /* Printed before the usage message. */ \ const char *doc_pre; \ /* Printed after the usage message. */ \ const char *doc_post; \ } argmatch_##Name##_group_type; \ \ /* The structure the user must build. */ \ extern const argmatch_##Name##_group_type argmatch_##Name##_group; \ \ /* Print the documentation of this group. */ \ void argmatch_##Name##_usage (FILE *out); \ \ /* If nonnegative, the index I of ARG in ARGS, i.e, \ ARGS[I] == ARG. \ Return -1 for invalid argument, -2 for ambiguous argument. */ \ ptrdiff_t argmatch_##Name##_choice (const char *arg); \ \ /* A pointer to the corresponding value if it exists, or \ report an error and exit with failure if the argument was \ not recognized. */ \ const argmatch_##Name##_type* \ argmatch_##Name##_value (const char *context, const char *arg); \ \ /* The first argument in ARGS that matches this value, or NULL. */ \ const char * \ argmatch_##Name##_argument (const argmatch_##Name##_type *val); \ \ ptrdiff_t \ argmatch_##Name##_choice (const char *arg) \ { \ const argmatch_##Name##_group_type *g = &argmatch_##Name##_group; \ size_t size = argmatch_##Name##_size; \ ptrdiff_t res = -1; /* Index of first nonexact match. */ \ bool ambiguous = false; /* Whether multiple nonexact match(es). */ \ size_t arglen = strlen (arg); \ \ /* Test all elements for either exact match or abbreviated \ matches. */ \ for (size_t i = 0; g->args[i].arg; i++) \ if (!strncmp (g->args[i].arg, arg, arglen)) \ { \ if (strlen (g->args[i].arg) == arglen) \ /* Exact match found. */ \ return i; \ else if (res == -1) \ /* First nonexact match found. */ \ res = i; \ else if (memcmp (&g->args[res].val, &g->args[i].val, size)) \ /* Second nonexact match found. */ \ /* There is a real ambiguity, or we could not \ disambiguate. */ \ ambiguous = true; \ } \ return ambiguous ? -2 : res; \ } \ \ const char * \ argmatch_##Name##_argument (const argmatch_##Name##_type *val) \ { \ const argmatch_##Name##_group_type *g = &argmatch_##Name##_group; \ size_t size = argmatch_##Name##_size; \ for (size_t i = 0; g->args[i].arg; i++) \ if (!memcmp (val, &g->args[i].val, size)) \ return g->args[i].arg; \ return NULL; \ } \ \ /* List the valid values of this group. */ \ static void \ argmatch_##Name##_valid (FILE *out) \ { \ const argmatch_##Name##_group_type *g = &argmatch_##Name##_group; \ size_t size = argmatch_##Name##_size; \ \ /* Try to put synonyms on the same line. Synonyms are expected \ to follow each other. */ \ fputs (gettext ("Valid arguments are:"), out); \ for (int i = 0; g->args[i].arg; i++) \ if (i == 0 \ || memcmp (&g->args[i-1].val, &g->args[i].val, size)) \ fprintf (out, "\n - %s", quote (g->args[i].arg)); \ else \ fprintf (out, ", %s", quote (g->args[i].arg)); \ putc ('\n', out); \ } \ \ const argmatch_##Name##_type* \ argmatch_##Name##_value (const char *context, const char *arg) \ { \ const argmatch_##Name##_group_type *g = &argmatch_##Name##_group; \ ptrdiff_t res = argmatch_##Name##_choice (arg); \ if (res < 0) \ { \ argmatch_invalid (context, arg, res); \ argmatch_##Name##_valid (stderr); \ argmatch_die (); \ } \ return &g->args[res].val; \ } \ \ /* The column in which the documentation is displayed. \ The leftmost possible, but no more than 20. */ \ static int \ argmatch_##Name##_doc_col (void) \ { \ const argmatch_##Name##_group_type *g = &argmatch_##Name##_group; \ size_t size = argmatch_##Name##_size; \ int res = 0; \ for (int i = 0; g->docs[i].arg; ++i) \ { \ int col = 4; \ int ival = argmatch_##Name##_choice (g->docs[i].arg); \ if (ival < 0) \ /* Pseudo argument, display it. */ \ col += strlen (g->docs[i].arg); \ else \ /* Genuine argument, display it with its synonyms. */ \ for (int j = 0; g->args[j].arg; ++j) \ if (! memcmp (&g->args[ival].val, &g->args[j].val, size)) \ col += (col == 4 ? 0 : 2) + strlen (g->args[j].arg); \ if (res <= col) \ res = col <= 20 ? col : 20; \ } \ return res ? res : 20; \ } \ \ void \ argmatch_##Name##_usage (FILE *out) \ { \ const argmatch_##Name##_group_type *g = &argmatch_##Name##_group; \ size_t size = argmatch_##Name##_size; \ /* Width of the screen. Help2man does not seem to support \ arguments on several lines, so in that case pretend a very \ large width. */ \ const int screen_width = getenv ("HELP2MAN") ? INT_MAX : 80; \ if (g->doc_pre) \ fprintf (out, "%s\n", gettext (g->doc_pre)); \ int doc_col = argmatch_##Name##_doc_col (); \ for (int i = 0; g->docs[i].arg; ++i) \ { \ int col = 0; \ bool first = true; \ int ival = argmatch_##Name##_choice (g->docs[i].arg); \ if (ival < 0) \ /* Pseudo argument, display it. */ \ col += fprintf (out, " %s", g->docs[i].arg); \ else \ /* Genuine argument, display it with its synonyms. */ \ for (int j = 0; g->args[j].arg; ++j) \ if (! memcmp (&g->args[ival].val, &g->args[j].val, size)) \ { \ if (!first \ && screen_width < col + 2 + strlen (g->args[j].arg)) \ { \ fprintf (out, ",\n"); \ col = 0; \ first = true; \ } \ if (first) \ { \ col += fprintf (out, " "); \ first = false; \ } \ else \ col += fprintf (out, ","); \ col += fprintf (out, " %s", g->args[j].arg); \ } \ /* The doc. Separated by at least two spaces. */ \ if (doc_col < col + 2) \ { \ fprintf (out, "\n"); \ col = 0; \ } \ fprintf (out, "%*s%s\n", \ doc_col - col, "", gettext (g->docs[i].doc)); \ } \ if (g->doc_post) \ fprintf (out, "%s\n", gettext (g->doc_post)); \ } # ifdef __cplusplus } # endif #endif /* ARGMATCH_H_ */ kbuild-3608/src/grep/lib/raise.c0000664000175000017500000000343514670377426016474 0ustar locutuslocutus/* Provide a non-threads replacement for the POSIX raise function. Copyright (C) 2002-2003, 2005-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Jim Meyering and Bruno Haible */ #include /* Specification. */ #include #if HAVE_RAISE /* Native Windows platform. */ # include # if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" # endif # if HAVE_MSVC_INVALID_PARAMETER_HANDLER /* Forward declaration. */ static int raise_nothrow (int sig); # else # define raise_nothrow raise # endif #else /* An old Unix platform. */ # include #endif int raise (int sig) #undef raise { #if GNULIB_defined_signal_blocking && GNULIB_defined_SIGPIPE if (sig == SIGPIPE) return _gl_raise_SIGPIPE (); #endif #if HAVE_RAISE return raise_nothrow (sig); #else return kill (getpid (), sig); #endif } #if HAVE_RAISE && HAVE_MSVC_INVALID_PARAMETER_HANDLER static int raise_nothrow (int sig) { int result; TRY_MSVC_INVAL { result = raise (sig); } CATCH_MSVC_INVAL { result = -1; errno = EINVAL; } DONE_MSVC_INVAL; return result; } #endif kbuild-3608/src/grep/lib/windows-mutex.h0000664000175000017500000000317514670377426020231 0ustar locutuslocutus/* Plain mutexes (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-win32.h. */ #ifndef _WINDOWS_MUTEX_H #define _WINDOWS_MUTEX_H #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include #include "windows-initguard.h" typedef struct { glwthread_initguard_t guard; /* protects the initialization */ CRITICAL_SECTION lock; } glwthread_mutex_t; #define GLWTHREAD_MUTEX_INIT { GLWTHREAD_INITGUARD_INIT } #ifdef __cplusplus extern "C" { #endif extern void glwthread_mutex_init (glwthread_mutex_t *mutex); extern int glwthread_mutex_lock (glwthread_mutex_t *mutex); extern int glwthread_mutex_trylock (glwthread_mutex_t *mutex); extern int glwthread_mutex_unlock (glwthread_mutex_t *mutex); extern int glwthread_mutex_destroy (glwthread_mutex_t *mutex); #ifdef __cplusplus } #endif #endif /* _WINDOWS_MUTEX_H */ kbuild-3608/src/grep/lib/verify.h0000664000175000017500000003053314670377426016701 0ustar locutuslocutus/* Compile-time assert-like macros. Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ #ifndef _GL_VERIFY_H #define _GL_VERIFY_H /* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert (R, DIAGNOSTIC) works as per C11. This is supported by GCC 4.6.0+ and by clang 4+. Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as per C2x. This is supported by GCC 9.1+. Support compilers claiming conformance to the relevant standard, and also support GCC when not pedantic. If we were willing to slow 'configure' down we could also use it with other compilers, but since this affects only the quality of diagnostics, why bother? */ #ifndef __cplusplus # if (201112L <= __STDC_VERSION__ \ || (!defined __STRICT_ANSI__ \ && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 4 <= __clang_major__))) # define _GL_HAVE__STATIC_ASSERT 1 # endif # if (202000L <= __STDC_VERSION__ \ || (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) # define _GL_HAVE__STATIC_ASSERT1 1 # endif #endif /* FreeBSD 9.1 , included by and lots of other system headers, defines a conflicting _Static_assert that is no better than ours; override it. */ #ifndef _GL_HAVE__STATIC_ASSERT # include # undef _Static_assert #endif /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. If _Static_assert works, verify (R) uses it directly. Similarly, _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct that is an operand of sizeof. The code below uses several ideas for C++ compilers, and for C compilers that do not support _Static_assert: * The first step is ((R) ? 1 : -1). Given an expression R, of integral or boolean or floating-point type, this yields an expression of integral type, whose value is later verified to be constant and nonnegative. * Next this expression W is wrapped in a type struct _gl_verify_type { unsigned int _gl_verify_error_if_negative: W; }. If W is negative, this yields a compile-time error. No compiler can deal with a bit-field of negative size. One might think that an array size check would have the same effect, that is, that the type struct { unsigned int dummy[W]; } would work as well. However, inside a function, some compilers (such as C++ compilers and GNU C) allow local parameters and variables inside array size expressions. With these compilers, an array size check would not properly diagnose this misuse of the verify macro: void function (int n) { verify (n < 0); } * For the verify macro, the struct _gl_verify_type will need to somehow be embedded into a declaration. To be portable, this declaration must declare an object, a constant, a function, or a typedef name. If the declared entity uses the type directly, such as in struct dummy {...}; typedef struct {...} dummy; extern struct {...} *dummy; extern void dummy (struct {...} *); extern struct {...} *dummy (void); two uses of the verify macro would yield colliding declarations if the entity names are not disambiguated. A workaround is to attach the current line number to the entity name: #define _GL_CONCAT0(x, y) x##y #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) extern struct {...} * _GL_CONCAT (dummy, __LINE__); But this has the problem that two invocations of verify from within the same macro would collide, since the __LINE__ value would be the same for both invocations. (The GCC __COUNTER__ macro solves this problem, but is not portable.) A solution is to use the sizeof operator. It yields a number, getting rid of the identity of the type. Declarations like extern int dummy [sizeof (struct {...})]; extern void dummy (int [sizeof (struct {...})]); extern int (*dummy (void)) [sizeof (struct {...})]; can be repeated. * Should the implementation use a named struct or an unnamed struct? Which of the following alternatives can be used? extern int dummy [sizeof (struct {...})]; extern int dummy [sizeof (struct _gl_verify_type {...})]; extern void dummy (int [sizeof (struct {...})]); extern void dummy (int [sizeof (struct _gl_verify_type {...})]); extern int (*dummy (void)) [sizeof (struct {...})]; extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})]; In the second and sixth case, the struct type is exported to the outer scope; two such declarations therefore collide. GCC warns about the first, third, and fourth cases. So the only remaining possibility is the fifth case: extern int (*dummy (void)) [sizeof (struct {...})]; * GCC warns about duplicate declarations of the dummy function if -Wredundant-decls is used. GCC 4.3 and later have a builtin __COUNTER__ macro that can let us generate unique identifiers for each dummy function, to suppress this warning. * This implementation exploits the fact that older versions of GCC, which do not support _Static_assert, also do not warn about the last declaration mentioned above. * GCC warns if -Wnested-externs is enabled and 'verify' is used within a function body; but inside a function, you can always arrange to use verify_expr instead. * In C++, any struct definition inside sizeof is invalid. Use a template type to work around the problem. */ /* Concatenate two preprocessor tokens. */ #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) #define _GL_CONCAT0(x, y) x##y /* _GL_COUNTER is an integer, preferably one that changes each time we use it. Use __COUNTER__ if it works, falling back on __LINE__ otherwise. __LINE__ isn't perfect, but it's better than a constant. */ #if defined __COUNTER__ && __COUNTER__ != __COUNTER__ # define _GL_COUNTER __COUNTER__ #else # define _GL_COUNTER __LINE__ #endif /* Generate a symbol with the given prefix, making it unique if possible. */ #define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) /* Verify requirement R at compile-time, as an integer constant expression that returns 1. If R is false, fail at compile-time, preferably with a diagnostic that includes the string-literal DIAGNOSTIC. */ #define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC))) #ifdef __cplusplus # if !GNULIB_defined_struct__gl_verify_type template struct _gl_verify_type { unsigned int _gl_verify_error_if_negative: w; }; # define GNULIB_defined_struct__gl_verify_type 1 # endif # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ _gl_verify_type<(R) ? 1 : -1> #elif defined _GL_HAVE__STATIC_ASSERT # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ struct { \ _Static_assert (R, DIAGNOSTIC); \ int _gl_dummy; \ } #else # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } #endif /* Verify requirement R at compile-time, as a declaration without a trailing ';'. If R is false, fail at compile-time. This macro requires three or more arguments but uses at most the first two, so that the _Static_assert macro optionally defined below supports both the C11 two-argument syntax and the C2x one-argument syntax. Unfortunately, unlike C11, this implementation must appear as an ordinary declaration, and cannot appear inside struct { ... }. */ #if 200410 <= __cpp_static_assert # define _GL_VERIFY(R, DIAGNOSTIC, ...) static_assert (R, DIAGNOSTIC) #elif defined _GL_HAVE__STATIC_ASSERT # define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) #else # define _GL_VERIFY(R, DIAGNOSTIC, ...) \ extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] #endif /* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ #ifdef _GL_STATIC_ASSERT_H # if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert # define _Static_assert(...) \ _GL_VERIFY (__VA_ARGS__, "static assertion failed", -) # endif # if __cpp_static_assert < 201411 && !defined static_assert # define static_assert _Static_assert /* C11 requires this #define. */ # endif #endif /* @assert.h omit start@ */ #if 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)) # define _GL_HAS_BUILTIN_TRAP 1 #elif defined __has_builtin # define _GL_HAS_BUILTIN_TRAP __has_builtin (__builtin_trap) #else # define _GL_HAS_BUILTIN_TRAP 0 #endif #if 4 < __GNUC__ + (5 <= __GNUC_MINOR__) # define _GL_HAS_BUILTIN_UNREACHABLE 1 #elif defined __has_builtin # define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) #else # define _GL_HAS_BUILTIN_UNREACHABLE 0 #endif /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. There are two macros, since no single macro can be used in all contexts in C. verify_expr (R, E) is for scalar contexts, including integer constant expression contexts. verify (R) is for declaration contexts, e.g., the top level. */ /* Verify requirement R at compile-time. Return the value of the expression E. */ #define verify_expr(R, E) \ (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E)) /* Verify requirement R at compile-time, as a declaration without a trailing ';'. verify (R) acts like static_assert (R) except that it is portable to C11/C++14 and earlier, it can issue better diagnostics, and its name is shorter and may be more convenient. */ #ifdef __PGI /* PGI barfs if R is long. */ # define verify(R) _GL_VERIFY (R, "verify (...)", -) #else # define verify(R) _GL_VERIFY (R, "verify (" #R ")", -) #endif /* Assume that R always holds. Behavior is undefined if R is false, fails to evaluate, or has side effects. 'assume (R)' is a directive from the programmer telling the compiler that R is true so the compiler needn't generate code to test R. This is why 'assume' is in verify.h: it's related to static checking (in this case, static checking done by the programmer), not dynamic checking. 'assume (R)' can affect compilation of all the code, not just code that happens to be executed after the assume (R) is "executed". For example, if the code mistakenly does 'assert (R); assume (R);' the compiler is entitled to optimize away the 'assert (R)'. Although assuming R can help a compiler generate better code or diagnostics, performance can suffer if R uses hard-to-optimize features such as function calls not inlined by the compiler. Avoid Clang's __builtin_assume, as it breaks GNU Emacs master as of 2020-08-23T21:09:49Z!eggert@cs.ucla.edu; see . It's not known whether this breakage is a Clang bug or an Emacs bug; play it safe for now. */ #if _GL_HAS_BUILTIN_UNREACHABLE # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) #elif 1200 <= _MSC_VER # define assume(R) __assume (R) #elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP /* Doing it this way helps various packages when configured with --enable-gcc-warnings, which compiles with -Dlint. It's nicer when 'assume' silences warnings even with older GCCs. */ # define assume(R) ((R) ? (void) 0 : __builtin_trap ()) #else /* Some tools grok NOTREACHED, e.g., Oracle Studio 12.6. */ # define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0) #endif /* @assert.h omit end@ */ #endif kbuild-3608/src/grep/lib/msvc-inval.h0000664000175000017500000002122614670377425017452 0ustar locutuslocutus/* Invalid parameter handler for MSVC runtime libraries. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _MSVC_INVAL_H #define _MSVC_INVAL_H /* With MSVC runtime libraries with the "invalid parameter handler" concept, functions like fprintf(), dup2(), or close() crash when the caller passes an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF) instead. This file defines macros that turn such an invalid parameter notification into a non-local exit. An error code can then be produced at the target of this exit. You can thus write code like TRY_MSVC_INVAL { } CATCH_MSVC_INVAL { } DONE_MSVC_INVAL; This entire block expands to a single statement. The handling of invalid parameters can be done in three ways: * The default way, which is reasonable for programs (not libraries): AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [DEFAULT_HANDLING]) * The way for libraries that make "hairy" calls (like close(-1), or fclose(fp) where fileno(fp) is closed, or simply getdtablesize()): AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [HAIRY_LIBRARY_HANDLING]) * The way for libraries that make no "hairy" calls: AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING]) */ #define DEFAULT_HANDLING 0 #define HAIRY_LIBRARY_HANDLING 1 #define SANE_LIBRARY_HANDLING 2 #if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING) /* A native Windows platform with the "invalid parameter handler" concept, and either DEFAULT_HANDLING or HAIRY_LIBRARY_HANDLING. */ # if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING /* Default handling. */ # ifdef __cplusplus extern "C" { # endif /* Ensure that the invalid parameter handler in installed that just returns. Because we assume no other part of the program installs a different invalid parameter handler, this solution is multithread-safe. */ extern void gl_msvc_inval_ensure_handler (void); # ifdef __cplusplus } # endif # define TRY_MSVC_INVAL \ do \ { \ gl_msvc_inval_ensure_handler (); \ if (1) # define CATCH_MSVC_INVAL \ else # define DONE_MSVC_INVAL \ } \ while (0) # else /* Handling for hairy libraries. */ # include /* Gnulib can define its own status codes, as described in the page "Raising Software Exceptions" on microsoft.com . Our status codes are composed of - 0xE0000000, mandatory for all user-defined status codes, - 0x474E550, a API identifier ("GNU"), - 0, 1, 2, ..., used to distinguish different status codes from the same API. */ # define STATUS_GNULIB_INVALID_PARAMETER (0xE0000000 + 0x474E550 + 0) # if defined _MSC_VER /* A compiler that supports __try/__except, as described in the page "try-except statement" on microsoft.com . With __try/__except, we can use the multithread-safe exception handling. */ # ifdef __cplusplus extern "C" { # endif /* Ensure that the invalid parameter handler in installed that raises a software exception with code STATUS_GNULIB_INVALID_PARAMETER. Because we assume no other part of the program installs a different invalid parameter handler, this solution is multithread-safe. */ extern void gl_msvc_inval_ensure_handler (void); # ifdef __cplusplus } # endif # define TRY_MSVC_INVAL \ do \ { \ gl_msvc_inval_ensure_handler (); \ __try # define CATCH_MSVC_INVAL \ __except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER \ ? EXCEPTION_EXECUTE_HANDLER \ : EXCEPTION_CONTINUE_SEARCH) # define DONE_MSVC_INVAL \ } \ while (0) # else /* Any compiler. We can only use setjmp/longjmp. */ # include # ifdef __cplusplus extern "C" { # endif struct gl_msvc_inval_per_thread { /* The restart that will resume execution at the code between CATCH_MSVC_INVAL and DONE_MSVC_INVAL. It is enabled only between TRY_MSVC_INVAL and CATCH_MSVC_INVAL. */ jmp_buf restart; /* Tells whether the contents of restart is valid. */ int restart_valid; }; /* Ensure that the invalid parameter handler in installed that passes control to the gl_msvc_inval_restart if it is valid, or raises a software exception with code STATUS_GNULIB_INVALID_PARAMETER otherwise. Because we assume no other part of the program installs a different invalid parameter handler, this solution is multithread-safe. */ extern void gl_msvc_inval_ensure_handler (void); /* Return a pointer to the per-thread data for the current thread. */ extern struct gl_msvc_inval_per_thread *gl_msvc_inval_current (void); # ifdef __cplusplus } # endif # define TRY_MSVC_INVAL \ do \ { \ struct gl_msvc_inval_per_thread *msvc_inval_current; \ gl_msvc_inval_ensure_handler (); \ msvc_inval_current = gl_msvc_inval_current (); \ /* First, initialize gl_msvc_inval_restart. */ \ if (setjmp (msvc_inval_current->restart) == 0) \ { \ /* Then, mark it as valid. */ \ msvc_inval_current->restart_valid = 1; # define CATCH_MSVC_INVAL \ /* Execution completed. \ Mark gl_msvc_inval_restart as invalid. */ \ msvc_inval_current->restart_valid = 0; \ } \ else \ { \ /* Execution triggered an invalid parameter notification. \ Mark gl_msvc_inval_restart as invalid. */ \ msvc_inval_current->restart_valid = 0; # define DONE_MSVC_INVAL \ } \ } \ while (0) # endif # endif #else /* A platform that does not need to the invalid parameter handler, or when SANE_LIBRARY_HANDLING is desired. */ /* The braces here avoid GCC warnings like "warning: suggest explicit braces to avoid ambiguous 'else'". */ # define TRY_MSVC_INVAL \ do \ { \ if (1) # define CATCH_MSVC_INVAL \ else # define DONE_MSVC_INVAL \ } \ while (0) #endif #endif /* _MSVC_INVAL_H */ kbuild-3608/src/grep/lib/msvc-inval.c0000664000175000017500000000755314670377426017455 0ustar locutuslocutus/* Invalid parameter handler for MSVC runtime libraries. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "msvc-inval.h" #if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING) /* Get _invalid_parameter_handler type and _set_invalid_parameter_handler declaration. */ # include # if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING static void __cdecl gl_msvc_invalid_parameter_handler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t dummy) { } # else /* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include # if defined _MSC_VER static void __cdecl gl_msvc_invalid_parameter_handler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t dummy) { RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL); } # else /* An index to thread-local storage. */ static DWORD tls_index; static int tls_initialized /* = 0 */; /* Used as a fallback only. */ static struct gl_msvc_inval_per_thread not_per_thread; struct gl_msvc_inval_per_thread * gl_msvc_inval_current (void) { if (!tls_initialized) { tls_index = TlsAlloc (); tls_initialized = 1; } if (tls_index == TLS_OUT_OF_INDEXES) /* TlsAlloc had failed. */ return ¬_per_thread; else { struct gl_msvc_inval_per_thread *pointer = (struct gl_msvc_inval_per_thread *) TlsGetValue (tls_index); if (pointer == NULL) { /* First call. Allocate a new 'struct gl_msvc_inval_per_thread'. */ pointer = (struct gl_msvc_inval_per_thread *) malloc (sizeof (struct gl_msvc_inval_per_thread)); if (pointer == NULL) /* Could not allocate memory. Use the global storage. */ pointer = ¬_per_thread; TlsSetValue (tls_index, pointer); } return pointer; } } static void __cdecl gl_msvc_invalid_parameter_handler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t dummy) { struct gl_msvc_inval_per_thread *current = gl_msvc_inval_current (); if (current->restart_valid) longjmp (current->restart, 1); else /* An invalid parameter notification from outside the gnulib code. Give the caller a chance to intervene. */ RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL); } # endif # endif static int gl_msvc_inval_initialized /* = 0 */; void gl_msvc_inval_ensure_handler (void) { if (gl_msvc_inval_initialized == 0) { _set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler); gl_msvc_inval_initialized = 1; } } #endif kbuild-3608/src/grep/lib/strerror.c0000664000175000017500000000407414670377426017253 0ustar locutuslocutus/* strerror.c --- POSIX compatible system error routine Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include #include #include #include "intprops.h" #include "strerror-override.h" #include "verify.h" /* Use the system functions, not the gnulib overrides in this file. */ #undef sprintf char * strerror (int n) #undef strerror { static char buf[STACKBUF_LEN]; size_t len; /* Cast away const, due to the historical signature of strerror; callers should not be modifying the string. */ const char *msg = strerror_override (n); if (msg) return (char *) msg; msg = strerror (n); /* Our strerror_r implementation might use the system's strerror buffer, so all other clients of strerror have to see the error copied into a buffer that we manage. This is not thread-safe, even if the system strerror is, but portable programs shouldn't be using strerror if they care about thread-safety. */ if (!msg || !*msg) { static char const fmt[] = "Unknown error %d"; verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n)); sprintf (buf, fmt, n); errno = EINVAL; return buf; } /* Fix STACKBUF_LEN if this ever aborts. */ len = strlen (msg); if (sizeof buf <= len) abort (); memcpy (buf, msg, len + 1); return buf; } kbuild-3608/src/grep/lib/wctype-h.c0000664000175000017500000000162614670377426017131 0ustar locutuslocutus/* Inline functions for . Copyright (C) 2012-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Normally this would be wctype.c, but that name's already taken. */ #include #define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE #include "wctype.h" kbuild-3608/src/grep/lib/cloexec.c0000664000175000017500000000445414670377422017011 0ustar locutuslocutus/* cloexec.c - set or clear the close-on-exec descriptor flag Copyright (C) 1991, 2004-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* The code is taken from glibc/manual/llio.texi */ #include #include "cloexec.h" #include #include #include /* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, or clear the flag if VALUE is false. Return 0 on success, or -1 on error with 'errno' set. Note that on MingW, this function does NOT protect DESC from being inherited into spawned children. Instead, either use dup_cloexec followed by closing the original DESC, or use interfaces such as open or pipe2 that accept flags like O_CLOEXEC to create DESC non-inheritable in the first place. */ int set_cloexec_flag (int desc, bool value) { #ifdef F_SETFD int flags = fcntl (desc, F_GETFD, 0); if (0 <= flags) { int newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC); if (flags == newflags || fcntl (desc, F_SETFD, newflags) != -1) return 0; } return -1; #else /* !F_SETFD */ /* Use dup2 to reject invalid file descriptors; the cloexec flag will be unaffected. */ if (desc < 0) { errno = EBADF; return -1; } if (dup2 (desc, desc) < 0) /* errno is EBADF here. */ return -1; /* There is nothing we can do on this kind of platform. Punt. */ return 0; #endif /* !F_SETFD */ } /* Duplicates a file handle FD, while marking the copy to be closed prior to exec or spawn. Returns -1 and sets errno if FD could not be duplicated. */ int dup_cloexec (int fd) { return fcntl (fd, F_DUPFD_CLOEXEC, 0); } kbuild-3608/src/grep/lib/lc-charset-dispatch.h0000664000175000017500000000257214670377424021217 0ustar locutuslocutus/* Dispatching based on the current locale's character encoding. Copyright (C) 2018-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2018. */ #include #if GNULIB_defined_mbstate_t /* A classification of special values of the encoding of the current locale. */ typedef enum { enc_other, /* other */ enc_utf8, /* UTF-8 */ enc_eucjp, /* EUC-JP */ enc_94, /* EUC-KR, GB2312, BIG5 */ enc_euctw, /* EUC-TW */ enc_gb18030, /* GB18030 */ enc_sjis /* SJIS */ } enc_t; /* Returns a classification of special values of the encoding of the current locale. */ extern enc_t locale_encoding_classification (void); #endif kbuild-3608/src/grep/lib/getpagesize.c0000664000175000017500000000226714670377423017677 0ustar locutuslocutus/* getpagesize emulation for systems where it cannot be done in a C macro. Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible and Martin Lambers. */ #include /* Specification. */ #include /* This implementation is only for native Windows systems. */ #if defined _WIN32 && ! defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN # include int getpagesize (void) { SYSTEM_INFO system_info; GetSystemInfo (&system_info); return system_info.dwPageSize; } #endif kbuild-3608/src/grep/lib/getopt1.c0000664000175000017500000000736014670377423016752 0ustar locutuslocutus/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987-2021 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _LIBC # include #endif #include "getopt.h" #include "getopt_int.h" int getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 0, 0); } int _getopt_long_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, 0, d, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 1, 0); } int _getopt_long_only_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, d, 0); } #ifdef TEST #include #include int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static const struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value '%s'\n", optarg); break; case 'd': printf ("option d with value '%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ kbuild-3608/src/grep/lib/hard-locale.h0000664000175000017500000000215314670377423017542 0ustar locutuslocutus/* Determine whether a locale is hard. Copyright (C) 1999, 2003-2004, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef HARD_LOCALE_H_ # define HARD_LOCALE_H_ 1 # include /* Return true if the specified CATEGORY of the current locale is hard, i.e. different from the C or POSIX locale that has a fixed behavior. CATEGORY must be one of the LC_* values, but not LC_ALL. */ extern bool hard_locale (int category); #endif /* HARD_LOCALE_H_ */ kbuild-3608/src/grep/lib/cdefs.h0000664000175000017500000005437214670377422016464 0ustar locutuslocutus/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _SYS_CDEFS_H #define _SYS_CDEFS_H 1 /* We are almost always included from features.h. */ #ifndef _FEATURES_H # include #endif /* The GNU libc does not support any K&R compilers or the traditional mode of ISO C compilers anymore. Check for some of the combinations not supported anymore. */ #if defined __GNUC__ && !defined __STDC__ # error "You need a ISO C conforming compiler to use the glibc headers" #endif /* Some user header file might have defined this before. */ #undef __P #undef __PMT /* Compilers that lack __has_attribute may object to #if defined __has_attribute && __has_attribute (...) even though they do not need to evaluate the right-hand side of the &&. Similarly for __has_builtin, etc. */ #if (defined __has_attribute \ && (!defined __clang_minor__ \ || 3 < __clang_major__ + (5 <= __clang_minor__))) # define __glibc_has_attribute(attr) __has_attribute (attr) #else # define __glibc_has_attribute(attr) 0 #endif #ifdef __has_builtin # define __glibc_has_builtin(name) __has_builtin (name) #else # define __glibc_has_builtin(name) 0 #endif #ifdef __has_extension # define __glibc_has_extension(ext) __has_extension (ext) #else # define __glibc_has_extension(ext) 0 #endif #if defined __GNUC__ || defined __clang__ /* All functions, except those with callbacks or those that synchronize memory, are leaf functions. */ # if __GNUC_PREREQ (4, 6) && !defined _LIBC # define __LEAF , __leaf__ # define __LEAF_ATTR __attribute__ ((__leaf__)) # else # define __LEAF # define __LEAF_ATTR # endif /* GCC can always grok prototypes. For C++ programs we add throw() to help it optimize the function calls. But this only works with gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions as non-throwing using a function attribute since programs can use the -fexceptions options for C code as well. */ # if !defined __cplusplus \ && (__GNUC_PREREQ (3, 4) || __glibc_has_attribute (__nothrow__)) # define __THROW __attribute__ ((__nothrow__ __LEAF)) # define __THROWNL __attribute__ ((__nothrow__)) # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct # else # if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) # if __cplusplus >= 201103L # define __THROW noexcept (true) # else # define __THROW throw () # endif # define __THROWNL __THROW # define __NTH(fct) __LEAF_ATTR fct __THROW # define __NTHNL(fct) fct __THROW # else # define __THROW # define __THROWNL # define __NTH(fct) fct # define __NTHNL(fct) fct # endif # endif #else /* Not GCC or clang. */ # if (defined __cplusplus \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) # define __inline inline # else # define __inline /* No inline functions. */ # endif # define __THROW # define __THROWNL # define __NTH(fct) fct #endif /* GCC || clang. */ /* These two macros are not used in glibc anymore. They are kept here only because some other projects expect the macros to be defined. */ #define __P(args) args #define __PMT(args) args /* For these things, GCC behaves the ANSI way normally, and the non-ANSI way under -traditional. */ #define __CONCAT(x,y) x ## y #define __STRING(x) #x /* This is not a typedef so `const __ptr_t' does the right thing. */ #define __ptr_t void * /* C++ needs to know that types and declarations are C, not C++. */ #ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } #else # define __BEGIN_DECLS # define __END_DECLS #endif /* Fortify support. */ #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) #define __bos0(ptr) __builtin_object_size (ptr, 0) /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ #if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0) # define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) # define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) #else # define __glibc_objsize0(__o) __bos0 (__o) # define __glibc_objsize(__o) __bos (__o) #endif #if __GNUC_PREREQ (4,3) # define __warnattr(msg) __attribute__((__warning__ (msg))) # define __errordecl(name, msg) \ extern void name (void) __attribute__((__error__ (msg))) #else # define __warnattr(msg) # define __errordecl(name, msg) extern void name (void) #endif /* Support for flexible arrays. Headers that should use flexible arrays only if they're "real" (e.g. only if they won't affect sizeof()) should test #if __glibc_c99_flexarr_available. */ #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc # define __flexarr [] # define __glibc_c99_flexarr_available 1 #elif __GNUC_PREREQ (2,97) || defined __clang__ /* GCC 2.97 and clang support C99 flexible array members as an extension, even when in C89 mode or compiling C++ (any version). */ # define __flexarr [] # define __glibc_c99_flexarr_available 1 #elif defined __GNUC__ /* Pre-2.97 GCC did not support C99 flexible arrays but did have an equivalent extension with slightly different notation. */ # define __flexarr [0] # define __glibc_c99_flexarr_available 1 #else /* Some other non-C99 compiler. Approximate with [1]. */ # define __flexarr [1] # define __glibc_c99_flexarr_available 0 #endif /* __asm__ ("xyz") is used throughout the headers to rename functions at the assembly language level. This is wrapped by the __REDIRECT macro, in order to support compilers that can do this some other way. When compilers don't support asm-names at all, we have to do preprocessor tricks instead (which don't have exactly the right semantics, but it's the best we can do). Example: int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ #if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4) # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) # ifdef __cplusplus # define __REDIRECT_NTH(name, proto, alias) \ name proto __THROW __asm__ (__ASMNAME (#alias)) # define __REDIRECT_NTHNL(name, proto, alias) \ name proto __THROWNL __asm__ (__ASMNAME (#alias)) # else # define __REDIRECT_NTH(name, proto, alias) \ name proto __asm__ (__ASMNAME (#alias)) __THROW # define __REDIRECT_NTHNL(name, proto, alias) \ name proto __asm__ (__ASMNAME (#alias)) __THROWNL # endif # define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) # define __ASMNAME2(prefix, cname) __STRING (prefix) cname /* #elif __SOME_OTHER_COMPILER__ # define __REDIRECT(name, proto, alias) name proto; \ _Pragma("let " #name " = " #alias) */ #endif /* GCC and clang have various useful declarations that can be made with the '__attribute__' syntax. All of the ways we use this do fine if they are omitted for compilers that don't understand it. */ #if !(defined __GNUC__ || defined __clang__) # define __attribute__(xyz) /* Ignore */ #endif /* At some point during the gcc 2.96 development the `malloc' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__) # define __attribute_malloc__ __attribute__ ((__malloc__)) #else # define __attribute_malloc__ /* Ignore */ #endif /* Tell the compiler which arguments to an allocation function indicate the size of the allocation. */ #if __GNUC_PREREQ (4, 3) # define __attribute_alloc_size__(params) \ __attribute__ ((__alloc_size__ params)) #else # define __attribute_alloc_size__(params) /* Ignore. */ #endif /* At some point during the gcc 2.96 development the `pure' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__pure__) # define __attribute_pure__ __attribute__ ((__pure__)) #else # define __attribute_pure__ /* Ignore */ #endif /* This declaration tells the compiler that the value is constant. */ #if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__) # define __attribute_const__ __attribute__ ((__const__)) #else # define __attribute_const__ /* Ignore */ #endif #if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) # define __attribute_maybe_unused__ __attribute__ ((__unused__)) /* Once the next version of the C standard comes out, we can do something like the following here: #elif defined __STDC_VERSION__ && 202???L <= __STDC_VERSION__ # define __attribute_maybe_unused__ [[__maybe_unused__]] */ #else # define __attribute_maybe_unused__ /* Ignore */ #endif /* At some point during the gcc 3.1 development the `used' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (3,1) || __glibc_has_attribute (__used__) # define __attribute_used__ __attribute__ ((__used__)) # define __attribute_noinline__ __attribute__ ((__noinline__)) #else # define __attribute_used__ __attribute__ ((__unused__)) # define __attribute_noinline__ /* Ignore */ #endif /* Since version 3.2, gcc allows marking deprecated functions. */ #if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__deprecated__) # define __attribute_deprecated__ __attribute__ ((__deprecated__)) #else # define __attribute_deprecated__ /* Ignore */ #endif /* Since version 4.5, gcc also allows one to specify the message printed when a deprecated function is used. clang claims to be gcc 4.2, but may also support this feature. */ #if __GNUC_PREREQ (4,5) \ || __glibc_has_extension (__attribute_deprecated_with_message__) # define __attribute_deprecated_msg__(msg) \ __attribute__ ((__deprecated__ (msg))) #else # define __attribute_deprecated_msg__(msg) __attribute_deprecated__ #endif /* At some point during the gcc 2.8 development the `format_arg' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. If several `format_arg' attributes are given for the same function, in gcc-3.0 and older, all but the last one are ignored. In newer gccs, all designated arguments are considered. */ #if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__) # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) #else # define __attribute_format_arg__(x) /* Ignore */ #endif /* At some point during the gcc 2.97 development the `strfmon' format attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__) # define __attribute_format_strfmon__(a,b) \ __attribute__ ((__format__ (__strfmon__, a, b))) #else # define __attribute_format_strfmon__(a,b) /* Ignore */ #endif /* The nonnull function attribute marks pointer parameters that must not be NULL. This has the name __nonnull in glibc, and __attribute_nonnull__ in files shared with Gnulib to avoid collision with a different __nonnull in DragonFlyBSD 5.9. */ #ifndef __attribute_nonnull__ # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) # define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params)) # else # define __attribute_nonnull__(params) # endif #endif #ifndef __nonnull # define __nonnull(params) __attribute_nonnull__ (params) #endif /* If fortification mode, we warn about unused results of certain function calls which can lead to problems. */ #if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__) # define __attribute_warn_unused_result__ \ __attribute__ ((__warn_unused_result__)) # if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0 # define __wur __attribute_warn_unused_result__ # endif #else # define __attribute_warn_unused_result__ /* empty */ #endif #ifndef __wur # define __wur /* Ignore */ #endif /* Forces a function to be always inlined. */ #if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__) /* The Linux kernel defines __always_inline in stddef.h (283d7573), and it conflicts with this definition. Therefore undefine it first to allow either header to be included first. */ # undef __always_inline # define __always_inline __inline __attribute__ ((__always_inline__)) #else # undef __always_inline # define __always_inline __inline #endif /* Associate error messages with the source location of the call site rather than with the source location inside the function. */ #if __GNUC_PREREQ (4,3) || __glibc_has_attribute (__artificial__) # define __attribute_artificial__ __attribute__ ((__artificial__)) #else # define __attribute_artificial__ /* Ignore */ #endif /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions older than 4.3 may define these macros and still not guarantee GNU inlining semantics. clang++ identifies itself as gcc-4.2, but has support for GNU inlining semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and __GNUC_GNU_INLINE__ macro definitions. */ #if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ || defined __GNUC_GNU_INLINE__))) # if defined __GNUC_STDC_INLINE__ || defined __cplusplus # define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) # define __extern_always_inline \ extern __always_inline __attribute__ ((__gnu_inline__)) # else # define __extern_inline extern __inline # define __extern_always_inline extern __always_inline # endif #endif #ifdef __extern_always_inline # define __fortify_function __extern_always_inline __attribute_artificial__ #endif /* GCC 4.3 and above allow passing all anonymous arguments of an __extern_always_inline function to some other vararg function. */ #if __GNUC_PREREQ (4,3) # define __va_arg_pack() __builtin_va_arg_pack () # define __va_arg_pack_len() __builtin_va_arg_pack_len () #endif /* It is possible to compile containing GCC extensions even if GCC is run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before version 2.8. */ #if !(__GNUC_PREREQ (2,8) || defined __clang__) # define __extension__ /* Ignore */ #endif /* __restrict is known in EGCS 1.2 and above, and in clang. It works also in C++ mode (outside of arrays), but only when spelled as '__restrict', not 'restrict'. */ #if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3) # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __restrict restrict # else # define __restrict /* Ignore */ # endif #endif /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is array_name[restrict] GCC 3.1 and clang support this. This syntax is not usable in C++ mode. */ #if (__GNUC_PREREQ (3,1) || __clang_major__ >= 3) && !defined __cplusplus # define __restrict_arr __restrict #else # ifdef __GNUC__ # define __restrict_arr /* Not supported in old GCC. */ # else # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __restrict_arr restrict # else /* Some other non-C99 compiler. */ # define __restrict_arr /* Not supported. */ # endif # endif #endif #if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect) # define __glibc_unlikely(cond) __builtin_expect ((cond), 0) # define __glibc_likely(cond) __builtin_expect ((cond), 1) #else # define __glibc_unlikely(cond) (cond) # define __glibc_likely(cond) (cond) #endif #if (!defined _Noreturn \ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ && !(__GNUC_PREREQ (4,7) \ || (3 < __clang_major__ + (5 <= __clang_minor__)))) # if __GNUC_PREREQ (2,8) # define _Noreturn __attribute__ ((__noreturn__)) # else # define _Noreturn # endif #endif #if __GNUC_PREREQ (8, 0) /* Describes a char array whose address can safely be passed as the first argument to strncpy and strncat, as the char array is not necessarily a NUL-terminated string. */ # define __attribute_nonstring__ __attribute__ ((__nonstring__)) #else # define __attribute_nonstring__ #endif /* Undefine (also defined in libc-symbols.h). */ #undef __attribute_copy__ #if __GNUC_PREREQ (9, 0) /* Copies attributes from the declaration or type referenced by the argument. */ # define __attribute_copy__(arg) __attribute__ ((__copy__ (arg))) #else # define __attribute_copy__(arg) #endif #if (!defined _Static_assert && !defined __cplusplus \ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \ || defined __STRICT_ANSI__)) # define _Static_assert(expr, diagnostic) \ extern int (*__Static_assert_function (void)) \ [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] #endif /* Gnulib avoids including these, as they don't work on non-glibc or older glibc platforms. */ #ifndef __GNULIB_CDEFS # include # include #endif #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # ifdef __REDIRECT /* Alias name defined automatically. */ # define __LDBL_REDIR(name, proto) ... unused__ldbl_redir # define __LDBL_REDIR_DECL(name) \ extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128")); /* Alias name defined automatically, with leading underscores. */ # define __LDBL_REDIR2_DECL(name) \ extern __typeof (__##name) __##name \ __asm (__ASMNAME ("__" #name "ieee128")); /* Alias name defined manually. */ # define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1 # define __LDBL_REDIR1_DECL(name, alias) \ extern __typeof (name) name __asm (__ASMNAME (#alias)); # define __LDBL_REDIR1_NTH(name, proto, alias) \ __REDIRECT_NTH (name, proto, alias) # define __REDIRECT_NTH_LDBL(name, proto, alias) \ __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128) /* Unused. */ # define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl # define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth # else _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform"); # endif #elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH # define __LDBL_COMPAT 1 # ifdef __REDIRECT # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) # define __LDBL_REDIR(name, proto) \ __LDBL_REDIR1 (name, proto, __nldbl_##name) # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) # define __LDBL_REDIR_NTH(name, proto) \ __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) # define __LDBL_REDIR2_DECL(name) \ extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name)); # define __LDBL_REDIR1_DECL(name, alias) \ extern __typeof (name) name __asm (__ASMNAME (#alias)); # define __LDBL_REDIR_DECL(name) \ extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); # define __REDIRECT_LDBL(name, proto, alias) \ __LDBL_REDIR1 (name, proto, __nldbl_##alias) # define __REDIRECT_NTH_LDBL(name, proto, alias) \ __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) # endif #endif #if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \ || !defined __REDIRECT # define __LDBL_REDIR1(name, proto, alias) name proto # define __LDBL_REDIR(name, proto) name proto # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW # define __LDBL_REDIR_NTH(name, proto) name proto __THROW # define __LDBL_REDIR2_DECL(name) # define __LDBL_REDIR_DECL(name) # ifdef __REDIRECT # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) # define __REDIRECT_NTH_LDBL(name, proto, alias) \ __REDIRECT_NTH (name, proto, alias) # endif #endif /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is intended for use in preprocessor macros. Note: MESSAGE must be a _single_ string; concatenation of string literals is not supported. */ #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5) # define __glibc_macro_warning1(message) _Pragma (#message) # define __glibc_macro_warning(message) \ __glibc_macro_warning1 (GCC warning message) #else # define __glibc_macro_warning(msg) #endif /* Generic selection (ISO C11) is a C-only feature, available in GCC since version 4.9. Previous versions do not provide generic selection, even though they might set __STDC_VERSION__ to 201112L, when in -std=c11 mode. Thus, we must check for !defined __GNUC__ when testing __STDC_VERSION__ for generic selection support. On the other hand, Clang also defines __GNUC__, so a clang-specific check is required to enable the use of generic selection. */ #if !defined __cplusplus \ && (__GNUC_PREREQ (4, 9) \ || __glibc_has_extension (c_generic_selections) \ || (!defined __GNUC__ && defined __STDC_VERSION__ \ && __STDC_VERSION__ >= 201112L)) # define __HAVE_GENERIC_SELECTION 1 #else # define __HAVE_GENERIC_SELECTION 0 #endif #if __GNUC_PREREQ (10, 0) /* Designates a 1-based positional argument ref-index of pointer type that can be used to access size-index elements of the pointed-to array according to access mode, or at least one element when size-index is not provided: access (access-mode, [, ]) */ #define __attr_access(x) __attribute__ ((__access__ x)) #else # define __attr_access(x) #endif /* Specify that a function such as setjmp or vfork may return twice. */ #if __GNUC_PREREQ (4, 1) # define __attribute_returns_twice__ __attribute__ ((__returns_twice__)) #else # define __attribute_returns_twice__ /* Ignore. */ #endif #endif /* sys/cdefs.h */ kbuild-3608/src/grep/lib/exitfail.c0000664000175000017500000000155514670377423017174 0ustar locutuslocutus/* Failure exit status Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include "exitfail.h" #include int volatile exit_failure = EXIT_FAILURE; kbuild-3608/src/grep/lib/getopt.in.h0000664000175000017500000000412114670377423017273 0ustar locutuslocutus/* Declarations for getopt. Copyright (C) 1989-2021 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library, which supplies a different version of this file. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_GETOPT_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. We must also inform the replacement unistd.h to not recursively use ; our definitions will be present soon enough. */ #if @HAVE_GETOPT_H@ # define _GL_SYSTEM_GETOPT # @INCLUDE_NEXT@ @NEXT_GETOPT_H@ # undef _GL_SYSTEM_GETOPT #endif #define _@GUARD_PREFIX@_GETOPT_H 1 /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables defined in getopt-core.h and getopt-ext.h. When this happens, include the headers that might declare getopt so that they will not cause confusion if included after this file (if the system had , we have already included it). */ #if defined __GETOPT_PREFIX # if !@HAVE_GETOPT_H@ # define __need_system_stdlib_h # include # undef __need_system_stdlib_h # include # include # endif #endif /* The definition of _GL_ARG_NONNULL is copied here. */ #include #include #include #endif /* _@GUARD_PREFIX@_GETOPT_H */ kbuild-3608/src/grep/lib/open-safer.c0000664000175000017500000000244614670377426017431 0ustar locutuslocutus/* Invoke open, but avoid some glitches. Copyright (C) 2005-2006, 2008-2021 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 . */ /* Written by Paul Eggert. */ #include #include "fcntl-safer.h" #include #include #include "unistd-safer.h" int open_safer (char const *file, int flags, ...) { mode_t mode = 0; if (flags & O_CREAT) { va_list ap; va_start (ap, flags); /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 creates crashing code when 'mode_t' is smaller than 'int'. */ mode = va_arg (ap, PROMOTED_MODE_T); va_end (ap); } return fd_safer (open (file, flags, mode)); } kbuild-3608/src/grep/lib/fchdir.c0000664000175000017500000001341214670377422016620 0ustar locutuslocutus/* fchdir replacement. Copyright (C) 2006-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include #include #include #include #include #include #include #include "assure.h" #include "filename.h" #include "filenamecat.h" #ifndef REPLACE_OPEN_DIRECTORY # define REPLACE_OPEN_DIRECTORY 0 #endif /* This replacement assumes that a directory is not renamed while opened through a file descriptor. FIXME: On mingw, this would be possible to enforce if we were to also open a HANDLE to each directory currently visited by a file descriptor, since mingw refuses to rename any in-use file system object. */ /* Array of file descriptors opened. If REPLACE_OPEN_DIRECTORY or if it points to a directory, it stores info about this directory. */ typedef struct { char *name; /* Absolute name of the directory, or NULL. */ /* FIXME - add a DIR* member to make dirfd possible on mingw? */ } dir_info_t; static dir_info_t *dirs; static size_t dirs_allocated; /* Try to ensure dirs has enough room for a slot at index fd; free any contents already in that slot. Return false and set errno to ENOMEM on allocation failure. */ static bool ensure_dirs_slot (size_t fd) { if (fd < dirs_allocated) free (dirs[fd].name); else { size_t new_allocated; dir_info_t *new_dirs; new_allocated = 2 * dirs_allocated + 1; if (new_allocated <= fd) new_allocated = fd + 1; new_dirs = (dirs != NULL ? (dir_info_t *) realloc (dirs, new_allocated * sizeof *dirs) : (dir_info_t *) malloc (new_allocated * sizeof *dirs)); if (new_dirs == NULL) return false; memset (new_dirs + dirs_allocated, 0, (new_allocated - dirs_allocated) * sizeof *dirs); dirs = new_dirs; dirs_allocated = new_allocated; } return true; } /* Return an absolute name of DIR in malloc'd storage. Upon failure, return NULL with errno set. */ static char * get_name (char const *dir) { char *cwd; char *result; if (IS_ABSOLUTE_FILE_NAME (dir)) return strdup (dir); /* We often encounter "."; treat it as a special case. */ cwd = getcwd (NULL, 0); if (!cwd || (dir[0] == '.' && dir[1] == '\0')) return cwd; result = mfile_name_concat (cwd, dir, NULL); free (cwd); return result; } /* Hook into the gnulib replacements for open() and close() to keep track of the open file descriptors. */ /* Close FD, cleaning up any fd to name mapping if fd was visiting a directory. */ void _gl_unregister_fd (int fd) { if (fd >= 0 && fd < dirs_allocated) { free (dirs[fd].name); dirs[fd].name = NULL; } } /* Mark FD as visiting FILENAME. FD must be non-negative, and refer to an open file descriptor. If REPLACE_OPEN_DIRECTORY is non-zero, this should only be called if FD is visiting a directory. Close FD and return -1 with errno set if there is insufficient memory to track the directory name; otherwise return FD. */ int _gl_register_fd (int fd, const char *filename) { struct stat statbuf; assure (0 <= fd); if (REPLACE_OPEN_DIRECTORY || (fstat (fd, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))) { if (!ensure_dirs_slot (fd) || (dirs[fd].name = get_name (filename)) == NULL) { int saved_errno = errno; close (fd); errno = saved_errno; return -1; } } return fd; } /* Mark NEWFD as a duplicate of OLDFD; useful from dup, dup2, dup3, and fcntl. Both arguments must be valid and distinct file descriptors. Close NEWFD and return -1 if OLDFD is tracking a directory, but there is insufficient memory to track the same directory in NEWFD; otherwise return NEWFD. */ int _gl_register_dup (int oldfd, int newfd) { assure (0 <= oldfd && 0 <= newfd && oldfd != newfd); if (oldfd < dirs_allocated && dirs[oldfd].name) { /* Duplicated a directory; must ensure newfd is allocated. */ if (!ensure_dirs_slot (newfd) || (dirs[newfd].name = strdup (dirs[oldfd].name)) == NULL) { int saved_errno = errno; close (newfd); errno = saved_errno; newfd = -1; } } else if (newfd < dirs_allocated) { /* Duplicated a non-directory; ensure newfd is cleared. */ free (dirs[newfd].name); dirs[newfd].name = NULL; } return newfd; } /* If FD is currently visiting a directory, then return the name of that directory. Otherwise, return NULL and set errno. */ const char * _gl_directory_name (int fd) { if (0 <= fd && fd < dirs_allocated && dirs[fd].name != NULL) return dirs[fd].name; /* At this point, fd is either invalid, or open but not a directory. If dup2 fails, errno is correctly EBADF. */ if (0 <= fd) { if (dup2 (fd, fd) == fd) errno = ENOTDIR; } else errno = EBADF; return NULL; } /* Implement fchdir() in terms of chdir(). */ int fchdir (int fd) { const char *name = _gl_directory_name (fd); return name ? chdir (name) : -1; } kbuild-3608/src/grep/lib/libc-config.h0000664000175000017500000001326214670377424017547 0ustar locutuslocutus/* System definitions for code taken from the GNU C Library Copyright 2017-2021 Free Software Foundation, Inc. This program 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ /* Written by Paul Eggert. */ /* This is intended to be a good-enough substitute for glibc system macros like those defined in , so that Gnulib code shared with glibc can do this as the first #include: #ifndef _LIBC # include #endif When compiled as part of glibc this is a no-op; when compiled as part of Gnulib this includes Gnulib's and defines macros that glibc library code would normally assume. Note: This header file MUST NOT be included by public header files of Gnulib. */ #include /* On glibc this includes and and #defines _FEATURES_H, __WORDSIZE, and __set_errno. On FreeBSD 11 and DragonFlyBSD 5.9 it includes which defines __nonnull. Elsewhere it is harmless. */ #include /* From glibc . */ #ifndef __set_errno # define __set_errno(val) (errno = (val)) #endif /* From glibc . */ #ifndef __GNUC_PREREQ # if defined __GNUC__ && defined __GNUC_MINOR__ # define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__)) # else # define __GNUC_PREREQ(maj, min) 0 # endif #endif #ifndef __glibc_clang_prereq # if defined __clang_major__ && defined __clang_minor__ # ifdef __apple_build_version__ /* Apple for some reason renumbers __clang_major__ and __clang_minor__. Gnulib code uses only __glibc_clang_prereq (3, 5); map it to 6000000 <= __apple_build_version__. Support for other calls to __glibc_clang_prereq can be added here as needed. */ # define __glibc_clang_prereq(maj, min) \ ((maj) == 3 && (min) == 5 ? 6000000 <= __apple_build_version__ : 0) # else # define __glibc_clang_prereq(maj, min) \ ((maj) < __clang_major__ + ((min) <= __clang_minor__)) # endif # else # define __glibc_clang_prereq(maj, min) 0 # endif #endif #ifndef __attribute_nonnull__ /* either does not exist, or is too old for Gnulib. Prepare to include , which is Gnulib's version of a more-recent glibc . */ /* Define _FEATURES_H so that does not include . */ # ifndef _FEATURES_H # define _FEATURES_H 1 # endif /* Define __GNULIB_CDEFS so that does not attempt to include nonexistent files. */ # define __GNULIB_CDEFS /* Undef the macros unconditionally defined by our copy of glibc , so that they do not clash with any system-defined versions. */ # undef _SYS_CDEFS_H # undef __ASMNAME # undef __ASMNAME2 # undef __BEGIN_DECLS # undef __CONCAT # undef __END_DECLS # undef __HAVE_GENERIC_SELECTION # undef __LDBL_COMPAT # undef __LDBL_REDIR # undef __LDBL_REDIR1 # undef __LDBL_REDIR1_DECL # undef __LDBL_REDIR1_NTH # undef __LDBL_REDIR2_DECL # undef __LDBL_REDIR_DECL # undef __LDBL_REDIR_NTH # undef __LEAF # undef __LEAF_ATTR # undef __NTH # undef __NTHNL # undef __REDIRECT # undef __REDIRECT_LDBL # undef __REDIRECT_NTH # undef __REDIRECT_NTHNL # undef __REDIRECT_NTH_LDBL # undef __STRING # undef __THROW # undef __THROWNL # undef __attr_access # undef __attribute__ # undef __attribute_alloc_size__ # undef __attribute_artificial__ # undef __attribute_const__ # undef __attribute_deprecated__ # undef __attribute_deprecated_msg__ # undef __attribute_format_arg__ # undef __attribute_format_strfmon__ # undef __attribute_malloc__ # undef __attribute_noinline__ # undef __attribute_nonstring__ # undef __attribute_pure__ # undef __attribute_returns_twice__ # undef __attribute_used__ # undef __attribute_warn_unused_result__ # undef __bos # undef __bos0 # undef __errordecl # undef __extension__ # undef __extern_always_inline # undef __extern_inline # undef __flexarr # undef __fortify_function # undef __glibc_c99_flexarr_available # undef __glibc_has_attribute # undef __glibc_has_builtin # undef __glibc_has_extension # undef __glibc_macro_warning # undef __glibc_macro_warning1 # undef __glibc_objsize # undef __glibc_objsize0 # undef __glibc_unlikely # undef __inline # undef __ptr_t # undef __restrict # undef __restrict_arr # undef __va_arg_pack # undef __va_arg_pack_len # undef __warnattr /* Include our copy of glibc . */ # include /* __inline is too pessimistic for non-GCC. */ # undef __inline # ifndef HAVE___INLINE # if 199901 <= __STDC_VERSION__ || defined inline # define __inline inline # else # define __inline # endif # endif #endif /* defined __glibc_likely */ /* A substitute for glibc , good enough for Gnulib. */ #define attribute_hidden #define libc_hidden_proto(name) #define libc_hidden_def(name) #define libc_hidden_weak(name) #define libc_hidden_ver(local, name) #define strong_alias(name, aliasname) #define weak_alias(name, aliasname) /* A substitute for glibc , good enough for Gnulib. */ #define SHLIB_COMPAT(lib, introduced, obsoleted) 0 #define compat_symbol(lib, local, symbol, version) extern int dummy #define versioned_symbol(lib, local, symbol, version) extern int dummy kbuild-3608/src/grep/lib/strtoull.c0000664000175000017500000000205714670377426017260 0ustar locutuslocutus/* Function to parse an 'unsigned long long int' from text. Copyright (C) 1995-1997, 1999, 2009-2021 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #define QUAD 1 #include "strtoul.c" #ifdef _LIBC strong_alias (__strtoull_internal, __strtouq_internal) weak_alias (strtoull, strtouq) #endif kbuild-3608/src/grep/lib/mbsrtowcs.c0000664000175000017500000000216214670377426017410 0ustar locutuslocutus/* Convert string to wide string. Copyright (C) 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include #include #include "strnlen1.h" extern mbstate_t _gl_mbsrtowcs_state; #define FUNC mbsrtowcs #define DCHAR_T wchar_t #define INTERNAL_STATE _gl_mbsrtowcs_state #define MBRTOWC mbrtowc #include "mbsrtowcs-impl.h" kbuild-3608/src/grep/lib/btowc.c0000664000175000017500000000213114670377423016474 0ustar locutuslocutus/* Convert unibyte character to wide character. Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include wint_t btowc (int c) { if (c != EOF) { char buf[1]; wchar_t wc; buf[0] = c; if (mbtowc (&wc, buf, 1) >= 0) return wc; } return WEOF; } kbuild-3608/src/grep/lib/c++defs.h0000664000175000017500000003557714670377423016621 0ustar locutuslocutus/* C++ compatible function declaration macros. Copyright (C) 2010-2021 Free Software Foundation, Inc. This program 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 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _GL_CXXDEFS_H #define _GL_CXXDEFS_H /* Begin/end the GNULIB_NAMESPACE namespace. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { # define _GL_END_NAMESPACE } #else # define _GL_BEGIN_NAMESPACE # define _GL_END_NAMESPACE #endif /* The three most frequent use cases of these macros are: * For providing a substitute for a function that is missing on some platforms, but is declared and works fine on the platforms on which it exists: #if @GNULIB_FOO@ # if !@HAVE_FOO@ _GL_FUNCDECL_SYS (foo, ...); # endif _GL_CXXALIAS_SYS (foo, ...); _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif * For providing a replacement for a function that exists on all platforms, but is broken/insufficient and needs to be replaced on some platforms: #if @GNULIB_FOO@ # if @REPLACE_FOO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef foo # define foo rpl_foo # endif _GL_FUNCDECL_RPL (foo, ...); _GL_CXXALIAS_RPL (foo, ...); # else _GL_CXXALIAS_SYS (foo, ...); # endif _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif * For providing a replacement for a function that exists on some platforms but is broken/insufficient and needs to be replaced on some of them and is additionally either missing or undeclared on some other platforms: #if @GNULIB_FOO@ # if @REPLACE_FOO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef foo # define foo rpl_foo # endif _GL_FUNCDECL_RPL (foo, ...); _GL_CXXALIAS_RPL (foo, ...); # else # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ _GL_FUNCDECL_SYS (foo, ...); # endif _GL_CXXALIAS_SYS (foo, ...); # endif _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif */ /* _GL_EXTERN_C declaration; performs the declaration with C linkage. */ #if defined __cplusplus # define _GL_EXTERN_C extern "C" #else # define _GL_EXTERN_C extern #endif /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); declares a replacement function, named rpl_func, with the given prototype, consisting of return type, parameters, and attributes. Example: _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); */ #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ _GL_EXTERN_C rettype rpl_func parameters_and_attributes /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); declares the system function, named func, with the given prototype, consisting of return type, parameters, and attributes. Example: _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); */ #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ _GL_EXTERN_C rettype func parameters_and_attributes /* _GL_CXXALIAS_RPL (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that redirects to rpl_func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); Wrapping rpl_func in an object with an inline conversion operator avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is actually used in the program. */ #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ \ inline operator type () const \ { \ return ::rpl_func; \ } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_MDA (func, rettype, parameters); is to be used when func is a Microsoft deprecated alias, on native Windows. It declares a C++ alias called GNULIB_NAMESPACE::func that redirects to _func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); */ #define _GL_CXXALIAS_MDA(func,rettype,parameters) \ _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); except that the C function rpl_func may have a slightly different declaration. A cast is used to silence the "invalid conversion" error that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ \ inline operator type () const \ { \ return reinterpret_cast(::rpl_func); \ } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); is like _GL_CXXALIAS_MDA (func, rettype, parameters); except that the C function func may have a slightly different declaration. A cast is used to silence the "invalid conversion" error that would otherwise occur. */ #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) /* _GL_CXXALIAS_SYS (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that redirects to the system provided function func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); Wrapping func in an object with an inline conversion operator avoids a reference to func unless GNULIB_NAMESPACE::func is actually used in the program. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ \ inline operator type () const \ { \ return ::func; \ } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); is like _GL_CXXALIAS_SYS (func, rettype, parameters); except that the C function func may have a slightly different declaration. A cast is used to silence the "invalid conversion" error that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ \ inline operator type () const \ { \ return reinterpret_cast(::func); \ } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); is like _GL_CXXALIAS_SYS (func, rettype, parameters); except that the C function is picked among a set of overloaded functions, namely the one with rettype2 and parameters2. Two consecutive casts are used to silence the "cannot find a match" and "invalid conversion" errors that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE /* The outer cast must be a reinterpret_cast. The inner cast: When the function is defined as a set of overloaded functions, it works as a static_cast<>, choosing the designated variant. When the function is defined as a single variant, it works as a reinterpret_cast<>. The parenthesized cast syntax works both ways. */ # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ namespace GNULIB_NAMESPACE \ { \ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ \ inline operator type () const \ { \ return reinterpret_cast((rettype2 (*) parameters2)(::func)); \ } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIASWARN (func); causes a warning to be emitted when ::func is used but not when GNULIB_NAMESPACE::func is used. func must be defined without overloaded variants. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIASWARN(func) \ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) # define _GL_CXXALIASWARN_1(func,namespace) \ _GL_CXXALIASWARN_2 (func, namespace) /* To work around GCC bug , we enable the warning only when not optimizing. */ # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) # define _GL_CXXALIASWARN_2(func,namespace) \ _GL_WARN_ON_USE (func, \ "The symbol ::" #func " refers to the system function. " \ "Use " #namespace "::" #func " instead.") # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING # define _GL_CXXALIASWARN_2(func,namespace) \ extern __typeof__ (func) func # else # define _GL_CXXALIASWARN_2(func,namespace) \ _GL_EXTERN_C int _gl_cxxalias_dummy # endif #else # define _GL_CXXALIASWARN(func) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); causes a warning to be emitted when the given overloaded variant of ::func is used but not when GNULIB_NAMESPACE::func is used. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ GNULIB_NAMESPACE) # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) /* To work around GCC bug , we enable the warning only when not optimizing. */ # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ "The symbol ::" #func " refers to the system function. " \ "Use " #namespace "::" #func " instead.") # else # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ _GL_EXTERN_C int _gl_cxxalias_dummy # endif #else # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif #endif /* _GL_CXXDEFS_H */ kbuild-3608/src/grep/lib/msvc-nothrow.c0000664000175000017500000000255614670377425020041 0ustar locutuslocutus/* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include "msvc-nothrow.h" /* Get declarations of the native Windows API functions. */ #define WIN32_LEAN_AND_MEAN #include #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" #endif #undef _get_osfhandle #if HAVE_MSVC_INVALID_PARAMETER_HANDLER intptr_t _gl_nothrow_get_osfhandle (int fd) { intptr_t result; TRY_MSVC_INVAL { result = _get_osfhandle (fd); } CATCH_MSVC_INVAL { result = (intptr_t) INVALID_HANDLE_VALUE; } DONE_MSVC_INVAL; return result; } #endif kbuild-3608/src/grep/lib/trim.c0000664000175000017500000000621214670377426016340 0ustar locutuslocutus/* Removes leading and/or trailing whitespaces Copyright (C) 2006-2021 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 . */ /* Written by Davide Angelocola */ #include /* Specification. */ #include "trim.h" #include #include #include #include #include "mbchar.h" #include "mbiter.h" #include "xalloc.h" /* Use this to suppress gcc's "...may be used before initialized" warnings. */ #if defined GCC_LINT || defined lint # define IF_LINT(Code) Code #else # define IF_LINT(Code) /* empty */ #endif char * trim2 (const char *s, int how) { char *d; d = strdup (s); if (!d) xalloc_die (); if (MB_CUR_MAX > 1) { mbi_iterator_t i; /* Trim leading whitespaces. */ if (how != TRIM_TRAILING) { mbi_init (i, d, strlen (d)); for (; mbi_avail (i) && mb_isspace (mbi_cur (i)); mbi_advance (i)) ; memmove (d, mbi_cur_ptr (i), strlen (mbi_cur_ptr (i)) + 1); } /* Trim trailing whitespaces. */ if (how != TRIM_LEADING) { unsigned int state = 0; char *r IF_LINT (= NULL); /* used only while state = 2 */ mbi_init (i, d, strlen (d)); for (; mbi_avail (i); mbi_advance (i)) { if (state == 0 && mb_isspace (mbi_cur (i))) continue; if (state == 0 && !mb_isspace (mbi_cur (i))) { state = 1; continue; } if (state == 1 && !mb_isspace (mbi_cur (i))) continue; if (state == 1 && mb_isspace (mbi_cur (i))) { state = 2; r = (char *) mbi_cur_ptr (i); } else if (state == 2 && mb_isspace (mbi_cur (i))) { /* empty */ } else { state = 1; } } if (state == 2) *r = '\0'; } } else { char *p; /* Trim leading whitespaces. */ if (how != TRIM_TRAILING) { for (p = d; *p && isspace ((unsigned char) *p); p++) ; memmove (d, p, strlen (p) + 1); } /* Trim trailing whitespaces. */ if (how != TRIM_LEADING) { for (p = d + strlen (d) - 1; p >= d && isspace ((unsigned char) *p); p--) *p = '\0'; } } return d; } kbuild-3608/src/grep/lib/fd-safer-flag.c0000664000175000017500000000335214670377423017762 0ustar locutuslocutus/* Adjust a file descriptor result so that it avoids clobbering STD{IN,OUT,ERR}_FILENO, with specific flags. Copyright (C) 2005-2006, 2009-2021 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 . */ /* Written by Paul Eggert and Eric Blake. */ #include /* Specification. */ #include "unistd-safer.h" #include #include /* Return FD, unless FD would be a copy of standard input, output, or error; in that case, return a duplicate of FD, closing FD. If FLAG contains O_CLOEXEC, the returned FD will have close-on-exec semantics. On failure to duplicate, close FD, set errno, and return -1. Preserve errno if FD is negative, so that the caller can always inspect errno when the returned value is negative. This function is usefully wrapped around functions that return file descriptors, e.g., fd_safer_flag (open ("file", O_RDONLY | flag), flag). */ int fd_safer_flag (int fd, int flag) { if (STDIN_FILENO <= fd && fd <= STDERR_FILENO) { int f = dup_safer_flag (fd, flag); int e = errno; close (fd); errno = e; fd = f; } return fd; } kbuild-3608/src/grep/lib/exclude.h0000664000175000017500000000460414670377422017022 0ustar locutuslocutus/* exclude.h -- declarations for excluding file names Copyright (C) 1992-1994, 1997, 1999, 2001-2003, 2005-2006, 2009-2021 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 . */ #ifndef _GL_EXCLUDE_H #define _GL_EXCLUDE_H 1 #include #include /* Written by Paul Eggert and Sergey Poznyakoff */ /* Exclude options, which can be ORed with fnmatch options. */ /* Patterns must match the start of file names, instead of matching anywhere after a '/'. */ #define EXCLUDE_ANCHORED (1 << 30) /* Include instead of exclude. */ #define EXCLUDE_INCLUDE (1 << 29) /* '?', '*', '[', and '\\' are special in patterns. Without this option, these characters are ordinary and fnmatch is not used. */ #define EXCLUDE_WILDCARDS (1 << 28) /* Patterns are POSIX extended regular expressions */ #define EXCLUDE_REGEX (1 << 27) /* Allocate storage for the pattern */ #define EXCLUDE_ALLOC (1 << 26) struct exclude; bool fnmatch_pattern_has_wildcards (const char *, int) _GL_ATTRIBUTE_PURE; void free_exclude (struct exclude *) _GL_ATTRIBUTE_NONNULL ((1)); struct exclude *new_exclude (void) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_DEALLOC (free_exclude, 1); void add_exclude (struct exclude *, char const *, int); int add_exclude_file (void (*) (struct exclude *, char const *, int), struct exclude *, char const *, int, char); int add_exclude_fp (void (*) (struct exclude *, char const *, int, void *), struct exclude *, FILE *, int, char, void *); bool excluded_file_name (struct exclude const *, char const *); void exclude_add_pattern_buffer (struct exclude *ex, char *buf); bool exclude_fnmatch (char const *, char const *, int); #endif /* _GL_EXCLUDE_H */ kbuild-3608/src/grep/lib/readdir.c0000664000175000017500000000607214670377426017003 0ustar locutuslocutus/* Read the next entry of a directory. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include #include "dirent-private.h" /* Don't assume that UNICODE is not defined. */ #undef FindNextFile #define FindNextFile FindNextFileA struct dirent * readdir (DIR *dirp) { char type; struct dirent *result; /* There is no need to add code to produce entries for "." and "..". According to the POSIX:2008 section "4.12 Pathname Resolution" "." and ".." are syntactic entities. POSIX also says: "If entries for dot or dot-dot exist, one entry shall be returned for dot and one entry shall be returned for dot-dot; otherwise, they shall not be returned." */ switch (dirp->status) { case -2: /* End of directory already reached. */ return NULL; case -1: break; case 0: if (!FindNextFile (dirp->current, &dirp->entry)) { switch (GetLastError ()) { case ERROR_NO_MORE_FILES: dirp->status = -2; return NULL; default: errno = EIO; return NULL; } } break; default: errno = dirp->status; return NULL; } dirp->status = 0; if (dirp->entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) type = DT_DIR; else if (dirp->entry.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) type = DT_LNK; else if ((dirp->entry.dwFileAttributes & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_SPARSE_FILE | FILE_ATTRIBUTE_COMPRESSED | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | FILE_ATTRIBUTE_ENCRYPTED)) == 0) /* Devices like COM1, LPT1, NUL would also have the attributes 0x20 but they cannot occur here. */ type = DT_REG; else type = DT_UNKNOWN; /* Reuse the memory of dirp->entry for the result. */ result = (struct dirent *) ((char *) dirp->entry.cFileName - offsetof (struct dirent, d_name[0])); result->d_type = type; return result; } kbuild-3608/src/grep/lib/iswctype.c0000664000175000017500000000210414670377424017226 0ustar locutuslocutus/* Test whether a wide character has a given property. Copyright (C) 2011-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #if GNULIB_defined_wint_t int iswctype (wint_t wc, wctype_t desc) # undef iswctype { return ((wchar_t) wc == wc ? iswctype ((wchar_t) wc, desc) : 0); } #else # include "iswctype-impl.h" #endif kbuild-3608/src/grep/lib/exitfail.h0000664000175000017500000000142414670377423017174 0ustar locutuslocutus/* Failure exit status Copyright (C) 2002, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ extern int volatile exit_failure; kbuild-3608/src/grep/lib/fdopendir.c0000664000175000017500000001503514670377423017337 0ustar locutuslocutus/* provide a replacement fdopendir function Copyright (C) 2004-2021 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 . */ /* written by Jim Meyering */ #include #include #include #include #if !HAVE_FDOPENDIR # include "openat.h" # include "openat-priv.h" # include "save-cwd.h" # if GNULIB_DIRENT_SAFER # include "dirent--.h" # endif # ifndef REPLACE_FCHDIR # define REPLACE_FCHDIR 0 # endif static DIR *fdopendir_with_dup (int, int, struct saved_cwd const *); static DIR *fd_clone_opendir (int, struct saved_cwd const *); /* Replacement for POSIX fdopendir. First, try to simulate it via opendir ("/proc/self/fd/..."). Failing that, simulate it by using fchdir metadata, or by doing save_cwd/fchdir/opendir(".")/restore_cwd. If either the save_cwd or the restore_cwd fails (relatively unlikely), then give a diagnostic and exit nonzero. If successful, the resulting stream is based on FD in implementations where streams are based on file descriptors and in applications where no other thread or signal handler allocates or frees file descriptors. In other cases, consult dirfd on the result to find out whether FD is still being used. Otherwise, this function works just like POSIX fdopendir. W A R N I N G: Unlike other fd-related functions, this one places constraints on FD. If this function returns successfully, FD is under control of the dirent.h system, and the caller should not close or modify the state of FD other than by the dirent.h functions. */ # ifdef __KLIBC__ # include DIR * fdopendir (int fd) { char path[_MAX_PATH]; DIR *dirp; /* Get a path from fd */ if (__libc_Back_ioFHToPath (fd, path, sizeof (path))) return NULL; dirp = opendir (path); if (!dirp) return NULL; /* Unregister fd registered by opendir() */ _gl_unregister_dirp_fd (dirfd (dirp)); /* Register our fd */ if (_gl_register_dirp_fd (fd, dirp)) { int saved_errno = errno; closedir (dirp); errno = saved_errno; dirp = NULL; } return dirp; } # else DIR * fdopendir (int fd) { DIR *dir = fdopendir_with_dup (fd, -1, NULL); if (! REPLACE_FCHDIR && ! dir) { int saved_errno = errno; if (EXPECTED_ERRNO (saved_errno)) { struct saved_cwd cwd; if (save_cwd (&cwd) != 0) openat_save_fail (errno); dir = fdopendir_with_dup (fd, -1, &cwd); saved_errno = errno; free_cwd (&cwd); errno = saved_errno; } } return dir; } # endif /* Like fdopendir, except that if OLDER_DUPFD is not -1, it is known to be a dup of FD which is less than FD - 1 and which will be closed by the caller and not otherwise used by the caller. This function makes sure that FD is closed and all file descriptors less than FD are open, and then calls fd_clone_opendir on a dup of FD. That way, barring race conditions, fd_clone_opendir returns a stream whose file descriptor is FD. If REPLACE_FCHDIR or CWD is null, use opendir ("/proc/self/fd/...", falling back on fchdir metadata. Otherwise, CWD is a saved version of the working directory; use fchdir/opendir(".")/restore_cwd(CWD). */ static DIR * fdopendir_with_dup (int fd, int older_dupfd, struct saved_cwd const *cwd) { int dupfd = dup (fd); if (dupfd < 0 && errno == EMFILE) dupfd = older_dupfd; if (dupfd < 0) return NULL; else { DIR *dir; int saved_errno; if (dupfd < fd - 1 && dupfd != older_dupfd) { dir = fdopendir_with_dup (fd, dupfd, cwd); saved_errno = errno; } else { close (fd); dir = fd_clone_opendir (dupfd, cwd); saved_errno = errno; if (! dir) { int fd1 = dup (dupfd); if (fd1 != fd) openat_save_fail (fd1 < 0 ? errno : EBADF); } } if (dupfd != older_dupfd) close (dupfd); errno = saved_errno; return dir; } } /* Like fdopendir, except the result controls a clone of FD. It is the caller's responsibility both to close FD and (if the result is not null) to closedir the result. */ static DIR * fd_clone_opendir (int fd, struct saved_cwd const *cwd) { if (REPLACE_FCHDIR || ! cwd) { DIR *dir = NULL; int saved_errno = EOPNOTSUPP; char buf[OPENAT_BUFFER_SIZE]; char *proc_file = openat_proc_name (buf, fd, "."); if (proc_file) { dir = opendir (proc_file); saved_errno = errno; if (proc_file != buf) free (proc_file); } # if REPLACE_FCHDIR if (! dir && EXPECTED_ERRNO (saved_errno)) { char const *name = _gl_directory_name (fd); DIR *dp = name ? opendir (name) : NULL; /* The caller has done an elaborate dance to arrange for opendir to consume just the right file descriptor. If dirfd returns -1, though, we're on a system like mingw where opendir does not consume a file descriptor. Consume it via 'dup' instead. */ if (dp && dirfd (dp) < 0) dup (fd); return dp; } # endif errno = saved_errno; return dir; } else { if (fchdir (fd) != 0) return NULL; else { DIR *dir = opendir ("."); int saved_errno = errno; if (restore_cwd (cwd) != 0) openat_restore_fail (errno); errno = saved_errno; return dir; } } } #else /* HAVE_FDOPENDIR */ # include # include # undef fdopendir /* Like fdopendir, but work around GNU/Hurd bug by validating FD. */ DIR * rpl_fdopendir (int fd) { struct stat st; if (fstat (fd, &st)) return NULL; if (!S_ISDIR (st.st_mode)) { errno = ENOTDIR; return NULL; } return fdopendir (fd); } #endif /* HAVE_FDOPENDIR */ kbuild-3608/src/grep/lib/iconv.c0000664000175000017500000002624214670377423016505 0ustar locutuslocutus/* Character set conversion. Copyright (C) 1999-2001, 2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #if REPLACE_ICONV_UTF # include # include # include # include "unistr.h" #endif #if REPLACE_ICONV_UTF /* UTF-{16,32}{BE,LE} converters taken from GNU libiconv 1.11. */ /* Return code if invalid. (xxx_mbtowc) */ # define RET_ILSEQ -1 /* Return code if no bytes were read. (xxx_mbtowc) */ # define RET_TOOFEW -2 /* Return code if invalid. (xxx_wctomb) */ # define RET_ILUNI -1 /* Return code if output buffer is too small. (xxx_wctomb, xxx_reset) */ # define RET_TOOSMALL -2 /* * UTF-16BE */ /* Specification: RFC 2781 */ static int utf16be_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n) { if (n >= 2) { ucs4_t wc = (s[0] << 8) + s[1]; if (wc >= 0xd800 && wc < 0xdc00) { if (n >= 4) { ucs4_t wc2 = (s[2] << 8) + s[3]; if (!(wc2 >= 0xdc00 && wc2 < 0xe000)) return RET_ILSEQ; *pwc = 0x10000 + ((wc - 0xd800) << 10) + (wc2 - 0xdc00); return 4; } } else if (wc >= 0xdc00 && wc < 0xe000) { return RET_ILSEQ; } else { *pwc = wc; return 2; } } return RET_TOOFEW; } static int utf16be_wctomb (unsigned char *r, ucs4_t wc, size_t n) { if (!(wc >= 0xd800 && wc < 0xe000)) { if (wc < 0x10000) { if (n >= 2) { r[0] = (unsigned char) (wc >> 8); r[1] = (unsigned char) wc; return 2; } else return RET_TOOSMALL; } else if (wc < 0x110000) { if (n >= 4) { ucs4_t wc1 = 0xd800 + ((wc - 0x10000) >> 10); ucs4_t wc2 = 0xdc00 + ((wc - 0x10000) & 0x3ff); r[0] = (unsigned char) (wc1 >> 8); r[1] = (unsigned char) wc1; r[2] = (unsigned char) (wc2 >> 8); r[3] = (unsigned char) wc2; return 4; } else return RET_TOOSMALL; } } return RET_ILUNI; } /* * UTF-16LE */ /* Specification: RFC 2781 */ static int utf16le_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n) { if (n >= 2) { ucs4_t wc = s[0] + (s[1] << 8); if (wc >= 0xd800 && wc < 0xdc00) { if (n >= 4) { ucs4_t wc2 = s[2] + (s[3] << 8); if (!(wc2 >= 0xdc00 && wc2 < 0xe000)) return RET_ILSEQ; *pwc = 0x10000 + ((wc - 0xd800) << 10) + (wc2 - 0xdc00); return 4; } } else if (wc >= 0xdc00 && wc < 0xe000) { return RET_ILSEQ; } else { *pwc = wc; return 2; } } return RET_TOOFEW; } static int utf16le_wctomb (unsigned char *r, ucs4_t wc, size_t n) { if (!(wc >= 0xd800 && wc < 0xe000)) { if (wc < 0x10000) { if (n >= 2) { r[0] = (unsigned char) wc; r[1] = (unsigned char) (wc >> 8); return 2; } else return RET_TOOSMALL; } else if (wc < 0x110000) { if (n >= 4) { ucs4_t wc1 = 0xd800 + ((wc - 0x10000) >> 10); ucs4_t wc2 = 0xdc00 + ((wc - 0x10000) & 0x3ff); r[0] = (unsigned char) wc1; r[1] = (unsigned char) (wc1 >> 8); r[2] = (unsigned char) wc2; r[3] = (unsigned char) (wc2 >> 8); return 4; } else return RET_TOOSMALL; } } return RET_ILUNI; } /* * UTF-32BE */ /* Specification: Unicode 3.1 Standard Annex #19 */ static int utf32be_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n) { if (n >= 4) { ucs4_t wc = (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3]; if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000)) { *pwc = wc; return 4; } else return RET_ILSEQ; } return RET_TOOFEW; } static int utf32be_wctomb (unsigned char *r, ucs4_t wc, size_t n) { if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000)) { if (n >= 4) { r[0] = 0; r[1] = (unsigned char) (wc >> 16); r[2] = (unsigned char) (wc >> 8); r[3] = (unsigned char) wc; return 4; } else return RET_TOOSMALL; } return RET_ILUNI; } /* * UTF-32LE */ /* Specification: Unicode 3.1 Standard Annex #19 */ static int utf32le_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n) { if (n >= 4) { ucs4_t wc = s[0] + (s[1] << 8) + (s[2] << 16) + (s[3] << 24); if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000)) { *pwc = wc; return 4; } else return RET_ILSEQ; } return RET_TOOFEW; } static int utf32le_wctomb (unsigned char *r, ucs4_t wc, size_t n) { if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000)) { if (n >= 4) { r[0] = (unsigned char) wc; r[1] = (unsigned char) (wc >> 8); r[2] = (unsigned char) (wc >> 16); r[3] = 0; return 4; } else return RET_TOOSMALL; } return RET_ILUNI; } #endif size_t rpl_iconv (iconv_t cd, ICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) #undef iconv { #if REPLACE_ICONV_UTF switch ((uintptr_t) cd) { { int (*xxx_wctomb) (unsigned char *, ucs4_t, size_t); case (uintptr_t) _ICONV_UTF8_UTF16BE: xxx_wctomb = utf16be_wctomb; goto loop_from_utf8; case (uintptr_t) _ICONV_UTF8_UTF16LE: xxx_wctomb = utf16le_wctomb; goto loop_from_utf8; case (uintptr_t) _ICONV_UTF8_UTF32BE: xxx_wctomb = utf32be_wctomb; goto loop_from_utf8; case (uintptr_t) _ICONV_UTF8_UTF32LE: xxx_wctomb = utf32le_wctomb; goto loop_from_utf8; loop_from_utf8: if (inbuf == NULL || *inbuf == NULL) return 0; { ICONV_CONST char *inptr = *inbuf; size_t inleft = *inbytesleft; char *outptr = *outbuf; size_t outleft = *outbytesleft; size_t res = 0; while (inleft > 0) { ucs4_t uc; int m = u8_mbtoucr (&uc, (const uint8_t *) inptr, inleft); if (m <= 0) { if (m == -1) { errno = EILSEQ; res = (size_t)(-1); break; } if (m == -2) { errno = EINVAL; res = (size_t)(-1); break; } abort (); } else { int n = xxx_wctomb ((uint8_t *) outptr, uc, outleft); if (n < 0) { if (n == RET_ILUNI) { errno = EILSEQ; res = (size_t)(-1); break; } if (n == RET_TOOSMALL) { errno = E2BIG; res = (size_t)(-1); break; } abort (); } else { inptr += m; inleft -= m; outptr += n; outleft -= n; } } } *inbuf = inptr; *inbytesleft = inleft; *outbuf = outptr; *outbytesleft = outleft; return res; } } { int (*xxx_mbtowc) (ucs4_t *, const unsigned char *, size_t); case (uintptr_t) _ICONV_UTF16BE_UTF8: xxx_mbtowc = utf16be_mbtowc; goto loop_to_utf8; case (uintptr_t) _ICONV_UTF16LE_UTF8: xxx_mbtowc = utf16le_mbtowc; goto loop_to_utf8; case (uintptr_t) _ICONV_UTF32BE_UTF8: xxx_mbtowc = utf32be_mbtowc; goto loop_to_utf8; case (uintptr_t) _ICONV_UTF32LE_UTF8: xxx_mbtowc = utf32le_mbtowc; goto loop_to_utf8; loop_to_utf8: if (inbuf == NULL || *inbuf == NULL) return 0; { ICONV_CONST char *inptr = *inbuf; size_t inleft = *inbytesleft; char *outptr = *outbuf; size_t outleft = *outbytesleft; size_t res = 0; while (inleft > 0) { ucs4_t uc; int m = xxx_mbtowc (&uc, (const uint8_t *) inptr, inleft); if (m <= 0) { if (m == RET_ILSEQ) { errno = EILSEQ; res = (size_t)(-1); break; } if (m == RET_TOOFEW) { errno = EINVAL; res = (size_t)(-1); break; } abort (); } else { int n = u8_uctomb ((uint8_t *) outptr, uc, outleft); if (n < 0) { if (n == -1) { errno = EILSEQ; res = (size_t)(-1); break; } if (n == -2) { errno = E2BIG; res = (size_t)(-1); break; } abort (); } else { inptr += m; inleft -= m; outptr += n; outleft -= n; } } } *inbuf = inptr; *inbytesleft = inleft; *outbuf = outptr; *outbytesleft = outleft; return res; } } } #endif return iconv (cd, inbuf, inbytesleft, outbuf, outbytesleft); } kbuild-3608/src/grep/lib/mbsrtowcs-state.c0000664000175000017500000000313414670377425020525 0ustar locutuslocutus/* Convert string to wide string. Copyright (C) 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs(). */ mbstate_t _gl_mbsrtowcs_state /* The state must initially be in the "initial state"; so, zero-initialize it. On most systems, putting it into BSS is sufficient. Not so on Mac OS X 10.3, see . When it needs an initializer, use 0 or {0} as initializer? 0 only works when mbstate_t is a scalar type (such as when gnulib defines it, or on AIX, IRIX, mingw). {0} works as an initializer in all cases: for a struct or union type, but also for a scalar type (ISO C 99, 6.7.8.(11)). */ #if defined __ELF__ /* On ELF systems, variables in BSS behave well. */ #else /* Use braces, to be on the safe side. */ = { 0 } #endif ; kbuild-3608/src/grep/lib/intprops.h0000664000175000017500000007071714670377424017261 0ustar locutuslocutus/* intprops.h -- properties of integer types Copyright (C) 2001-2021 Free Software Foundation, Inc. This program 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ #ifndef _GL_INTPROPS_H #define _GL_INTPROPS_H #include /* Return a value with the common real type of E and V and the value of V. Do not evaluate E. */ #define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) /* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see . */ #define _GL_INT_NEGATE_CONVERT(e, v) ((1 ? 0 : (e)) - (v)) /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ /* True if the arithmetic type T is an integer type. bool counts as an integer. */ #define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) /* True if the real type T is signed. */ #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) /* Return 1 if the real expression E, after promotion, has a signed or floating type. Do not evaluate E. */ #define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) /* Minimum and maximum values for integer types and expressions. */ /* The width in bits of the integer type or expression T. Do not evaluate T. T must not be a bit-field expression. Padding bits are not supported; this is checked at compile-time below. */ #define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) /* The maximum and minimum values for the integer type T. */ #define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t)) #define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) -1 \ : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) /* The maximum and minimum values for the type of the expression E, after integer promotion. E is not evaluated. */ #define _GL_INT_MINIMUM(e) \ (EXPR_SIGNED (e) \ ? ~ _GL_SIGNED_INT_MAXIMUM (e) \ : _GL_INT_CONVERT (e, 0)) #define _GL_INT_MAXIMUM(e) \ (EXPR_SIGNED (e) \ ? _GL_SIGNED_INT_MAXIMUM (e) \ : _GL_INT_NEGATE_CONVERT (e, 1)) #define _GL_SIGNED_INT_MAXIMUM(e) \ (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH (+ (e)) - 2)) - 1) * 2 + 1) /* Work around OpenVMS incompatibility with C99. */ #if !defined LLONG_MAX && defined __INT64_MAX # define LLONG_MAX __INT64_MAX # define LLONG_MIN __INT64_MIN #endif /* This include file assumes that signed types are two's complement without padding bits; the above macros have undefined behavior otherwise. If this is a problem for you, please let us know how to fix it for your host. This assumption is tested by the intprops-tests module. */ /* Does the __typeof__ keyword work? This could be done by 'configure', but for now it's easier to do it by hand. */ #if (2 <= __GNUC__ \ || (4 <= __clang_major__) \ || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ || (0x5110 <= __SUNPRO_C && !__STDC__)) # define _GL_HAVE___TYPEOF__ 1 #else # define _GL_HAVE___TYPEOF__ 0 #endif /* Return 1 if the integer type or expression T might be signed. Return 0 if it is definitely unsigned. T must not be a bit-field expression. This macro does not evaluate its argument, and expands to an integer constant expression. */ #if _GL_HAVE___TYPEOF__ # define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t)) #else # define _GL_SIGNED_TYPE_OR_EXPR(t) 1 #endif /* Bound on length of the string representing an unsigned integer value representable in B bits. log10 (2.0) < 146/485. The smallest value of B where this bound is not tight is 2621. */ #define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) /* Bound on length of the string representing an integer type or expression T. T must not be a bit-field expression. Subtract 1 for the sign bit if T is signed, and then add 1 more for a minus sign if needed. Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 1 when its argument is unsigned, this macro may overestimate the true bound by one byte when applied to unsigned types of size 2, 4, 16, ... bytes. */ #define INT_STRLEN_BOUND(t) \ (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + _GL_SIGNED_TYPE_OR_EXPR (t)) /* Bound on buffer size needed to represent an integer type or expression T, including the terminating null. T must not be a bit-field expression. */ #define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) /* Range overflow checks. The INT__RANGE_OVERFLOW macros return 1 if the corresponding C operators might not yield numerically correct answers due to arithmetic overflow. They do not rely on undefined or implementation-defined behavior. Their implementations are simple and straightforward, but they are harder to use and may be less efficient than the INT__WRAPV, INT__OK, and INT__OVERFLOW macros described below. Example usage: long int i = ...; long int j = ...; if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX)) printf ("multiply would overflow"); else printf ("product is %ld", i * j); Restrictions on *_RANGE_OVERFLOW macros: These macros do not check for all possible numerical problems or undefined or unspecified behavior: they do not check for division by zero, for bad shift counts, or for shifting negative numbers. These macros may evaluate their arguments zero or multiple times, so the arguments should not have side effects. The arithmetic arguments (including the MIN and MAX arguments) must be of the same integer type after the usual arithmetic conversions, and the type must have minimum value MIN and maximum MAX. Unsigned types should use a zero MIN of the proper type. Because all arguments are subject to integer promotions, these macros typically do not work on types narrower than 'int'. These macros are tuned for constant MIN and MAX. For commutative operations such as A + B, they are also tuned for constant B. */ /* Return 1 if A + B would overflow in [MIN,MAX] arithmetic. See above for restrictions. */ #define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \ ((b) < 0 \ ? (a) < (min) - (b) \ : (max) - (b) < (a)) /* Return 1 if A - B would overflow in [MIN,MAX] arithmetic. See above for restrictions. */ #define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \ ((b) < 0 \ ? (max) + (b) < (a) \ : (a) < (min) + (b)) /* Return 1 if - A would overflow in [MIN,MAX] arithmetic. See above for restrictions. */ #define INT_NEGATE_RANGE_OVERFLOW(a, min, max) \ ((min) < 0 \ ? (a) < - (max) \ : 0 < (a)) /* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. See above for restrictions. Avoid && and || as they tickle bugs in Sun C 5.11 2010/08/13 and other compilers; see . */ #define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ ((b) < 0 \ ? ((a) < 0 \ ? (a) < (max) / (b) \ : (b) == -1 \ ? 0 \ : (min) / (b) < (a)) \ : (b) == 0 \ ? 0 \ : ((a) < 0 \ ? (a) < (min) / (b) \ : (max) / (b) < (a))) /* Return 1 if A / B would overflow in [MIN,MAX] arithmetic. See above for restrictions. Do not check for division by zero. */ #define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \ ((min) < 0 && (b) == -1 && (a) < - (max)) /* Return 1 if A % B would overflow in [MIN,MAX] arithmetic. See above for restrictions. Do not check for division by zero. Mathematically, % should never overflow, but on x86-like hosts INT_MIN % -1 traps, and the C standard permits this, so treat this as an overflow too. */ #define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \ INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max) /* Return 1 if A << B would overflow in [MIN,MAX] arithmetic. See above for restrictions. Here, MIN and MAX are for A only, and B need not be of the same type as the other arguments. The C standard says that behavior is undefined for shifts unless 0 <= B < wordwidth, and that when A is negative then A << B has undefined behavior and A >> B has implementation-defined behavior, but do not check these other restrictions. */ #define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \ ((a) < 0 \ ? (a) < (min) >> (b) \ : (max) >> (b) < (a)) /* True if __builtin_add_overflow (A, B, P) and __builtin_sub_overflow (A, B, P) work when P is non-null. */ /* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x, see . */ #if 7 <= __GNUC__ && !defined __ICC # define _GL_HAS_BUILTIN_ADD_OVERFLOW 1 #elif defined __has_builtin # define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow) #else # define _GL_HAS_BUILTIN_ADD_OVERFLOW 0 #endif /* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */ #ifdef __clang__ /* Work around Clang bug . */ # define _GL_HAS_BUILTIN_MUL_OVERFLOW 0 #else # define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW #endif /* True if __builtin_add_overflow_p (A, B, C) works, and similarly for __builtin_sub_overflow_p and __builtin_mul_overflow_p. */ #if defined __clang__ || defined __ICC /* Clang 11 lacks __builtin_mul_overflow_p, and even if it did it would presumably run afoul of Clang bug 16404. ICC 2021.1's __builtin_add_overflow_p etc. are not treated as integral constant expressions even when all arguments are. */ # define _GL_HAS_BUILTIN_OVERFLOW_P 0 #elif defined __has_builtin # define _GL_HAS_BUILTIN_OVERFLOW_P __has_builtin (__builtin_mul_overflow_p) #else # define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__) #endif /* The _GL*_OVERFLOW macros have the same restrictions as the *_RANGE_OVERFLOW macros, except that they do not assume that operands (e.g., A and B) have the same type as MIN and MAX. Instead, they assume that the result (e.g., A + B) has that type. */ #if _GL_HAS_BUILTIN_OVERFLOW_P # define _GL_ADD_OVERFLOW(a, b, min, max) \ __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) # define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0) # define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0) #else # define _GL_ADD_OVERFLOW(a, b, min, max) \ ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ : (a) < 0 ? (b) <= (a) + (b) \ : (b) < 0 ? (a) <= (a) + (b) \ : (a) + (b) < (b)) # define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ : (a) < 0 ? 1 \ : (b) < 0 ? (a) - (b) <= (a) \ : (a) < (b)) # define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) #endif #define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ : (a) < 0 ? (b) <= (a) + (b) - 1 \ : (b) < 0 && (a) + (b) <= (a)) #define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \ : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max)) /* Return a nonzero value if A is a mathematical multiple of B, where A is unsigned, B is negative, and MAX is the maximum value of A's type. A's type must be the same as (A % B)'s type. Normally (A % -B == 0) suffices, but things get tricky if -B would overflow. */ #define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \ (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \ ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \ ? (a) \ : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \ : (a) % - (b)) \ == 0) /* Check for integer overflow, and report low order bits of answer. The INT__OVERFLOW macros return 1 if the corresponding C operators might not yield numerically correct answers due to arithmetic overflow. The INT__WRAPV macros compute the low-order bits of the sum, difference, and product of two C integers, and return 1 if these low-order bits are not numerically correct. These macros work correctly on all known practical hosts, and do not rely on undefined behavior due to signed arithmetic overflow. Example usage, assuming A and B are long int: if (INT_MULTIPLY_OVERFLOW (a, b)) printf ("result would overflow\n"); else printf ("result is %ld (no overflow)\n", a * b); Example usage with WRAPV flavor: long int result; bool overflow = INT_MULTIPLY_WRAPV (a, b, &result); printf ("result is %ld (%s)\n", result, overflow ? "after overflow" : "no overflow"); Restrictions on these macros: These macros do not check for all possible numerical problems or undefined or unspecified behavior: they do not check for division by zero, for bad shift counts, or for shifting negative numbers. These macros may evaluate their arguments zero or multiple times, so the arguments should not have side effects. The WRAPV macros are not constant expressions. They support only +, binary -, and *. Because the WRAPV macros convert the result, they report overflow in different circumstances than the OVERFLOW macros do. For example, in the typical case with 16-bit 'short' and 32-bit 'int', if A, B and R are all of type 'short' then INT_ADD_OVERFLOW (A, B) returns false because the addition cannot overflow after A and B are converted to 'int', whereas INT_ADD_WRAPV (A, B, &R) returns true or false depending on whether the sum fits into 'short'. These macros are tuned for their last input argument being a constant. Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, A % B, and A << B would overflow, respectively. */ #define INT_ADD_OVERFLOW(a, b) \ _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) #define INT_SUBTRACT_OVERFLOW(a, b) \ _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) #if _GL_HAS_BUILTIN_OVERFLOW_P # define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) #else # define INT_NEGATE_OVERFLOW(a) \ INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) #endif #define INT_MULTIPLY_OVERFLOW(a, b) \ _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW) #define INT_DIVIDE_OVERFLOW(a, b) \ _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW) #define INT_REMAINDER_OVERFLOW(a, b) \ _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW) #define INT_LEFT_SHIFT_OVERFLOW(a, b) \ INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \ _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) /* Return 1 if the expression A B would overflow, where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test, assuming MIN and MAX are the minimum and maximum for the result type. Arguments should be free of side effects. */ #define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \ op_result_overflow (a, b, \ _GL_INT_MINIMUM (_GL_INT_CONVERT (a, b)), \ _GL_INT_MAXIMUM (_GL_INT_CONVERT (a, b))) /* Store the low-order bits of A + B, A - B, A * B, respectively, into *R. Return 1 if the result overflows. See above for restrictions. */ #if _GL_HAS_BUILTIN_ADD_OVERFLOW # define INT_ADD_WRAPV(a, b, r) __builtin_add_overflow (a, b, r) # define INT_SUBTRACT_WRAPV(a, b, r) __builtin_sub_overflow (a, b, r) #else # define INT_ADD_WRAPV(a, b, r) \ _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW) # define INT_SUBTRACT_WRAPV(a, b, r) \ _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW) #endif #if _GL_HAS_BUILTIN_MUL_OVERFLOW # if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \ || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \ && !defined __ICC) # define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) # else /* Work around GCC bug 91450. */ # define INT_MULTIPLY_WRAPV(a, b, r) \ ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \ && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \ ? ((void) __builtin_mul_overflow (a, b, r), 1) \ : __builtin_mul_overflow (a, b, r)) # endif #else # define INT_MULTIPLY_WRAPV(a, b, r) \ _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) #endif /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 https://llvm.org/bugs/show_bug.cgi?id=25390 For now, assume all versions of GCC-like compilers generate bogus warnings for _Generic. This matters only for compilers that lack relevant builtins. */ #if __GNUC__ || defined __clang__ # define _GL__GENERIC_BOGUS 1 #else # define _GL__GENERIC_BOGUS 0 #endif /* Store the low-order bits of A B into *R, where OP specifies the operation and OVERFLOW the overflow predicate. Return 1 if the result overflows. See above for restrictions. */ #if 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS # define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ (_Generic \ (*(r), \ signed char: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ signed char, SCHAR_MIN, SCHAR_MAX), \ unsigned char: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ unsigned char, 0, UCHAR_MAX), \ short int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ short int, SHRT_MIN, SHRT_MAX), \ unsigned short int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ unsigned short int, 0, USHRT_MAX), \ int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ int, INT_MIN, INT_MAX), \ unsigned int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ unsigned int, 0, UINT_MAX), \ long int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ long int, LONG_MIN, LONG_MAX), \ unsigned long int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ unsigned long int, 0, ULONG_MAX), \ long long int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ long long int, LLONG_MIN, LLONG_MAX), \ unsigned long long int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ unsigned long long int, 0, ULLONG_MAX))) #else /* Store the low-order bits of A B into *R, where OP specifies the operation and OVERFLOW the overflow predicate. If *R is signed, its type is ST with bounds SMIN..SMAX; otherwise its type is UT with bounds U..UMAX. ST and UT are narrower than int. Return 1 if the result overflows. See above for restrictions. */ # if _GL_HAVE___TYPEOF__ # define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ (TYPE_SIGNED (__typeof__ (*(r))) \ ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, st, smin, smax) \ : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, ut, 0, umax)) # else # define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ (overflow (a, b, smin, smax) \ ? (overflow (a, b, 0, umax) \ ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 1) \ : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) < 0) \ : (overflow (a, b, 0, umax) \ ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) >= 0 \ : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 0))) # endif # define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ (sizeof *(r) == sizeof (signed char) \ ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \ signed char, SCHAR_MIN, SCHAR_MAX, \ unsigned char, UCHAR_MAX) \ : sizeof *(r) == sizeof (short int) \ ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \ short int, SHRT_MIN, SHRT_MAX, \ unsigned short int, USHRT_MAX) \ : sizeof *(r) == sizeof (int) \ ? (EXPR_SIGNED (*(r)) \ ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ int, INT_MIN, INT_MAX) \ : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ unsigned int, 0, UINT_MAX)) \ : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow)) # ifdef LLONG_MAX # define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ (sizeof *(r) == sizeof (long int) \ ? (EXPR_SIGNED (*(r)) \ ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ long int, LONG_MIN, LONG_MAX) \ : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ unsigned long int, 0, ULONG_MAX)) \ : (EXPR_SIGNED (*(r)) \ ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ long long int, LLONG_MIN, LLONG_MAX) \ : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ unsigned long long int, 0, ULLONG_MAX))) # else # define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ (EXPR_SIGNED (*(r)) \ ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ long int, LONG_MIN, LONG_MAX) \ : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ unsigned long int, 0, ULONG_MAX)) # endif #endif /* Store the low-order bits of A B into *R, where the operation is given by OP. Use the unsigned type UT for calculation to avoid overflow problems. *R's type is T, with extrema TMIN and TMAX. T must be a signed integer type. Return 1 if the result overflows. */ #define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ (overflow (a, b, tmin, tmax) \ ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \ : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0)) /* Return the low-order bits of A B, where the operation is given by OP. Use the unsigned type UT for calculation to avoid undefined behavior on signed integer overflow, and convert the result to type T. UT is at least as wide as T and is no narrower than unsigned int, T is two's complement, and there is no padding or trap representations. Assume that converting UT to T yields the low-order bits, as is done in all known two's-complement C compilers. E.g., see: https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html According to the C standard, converting UT to T yields an implementation-defined result or signal for values outside T's range. However, code that works around this theoretical problem runs afoul of a compiler bug in Oracle Studio 12.3 x86. See: https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html As the compiler bug is real, don't try to work around the theoretical problem. */ #define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \ ((t) ((ut) (a) op (ut) (b))) /* Return true if the numeric values A + B, A - B, A * B fall outside the range TMIN..TMAX. Arguments should be integer expressions without side effects. TMIN should be signed and nonpositive. TMAX should be positive, and should be signed unless TMIN is zero. */ #define _GL_INT_ADD_RANGE_OVERFLOW(a, b, tmin, tmax) \ ((b) < 0 \ ? (((tmin) \ ? ((EXPR_SIGNED (_GL_INT_CONVERT (a, (tmin) - (b))) || (b) < (tmin)) \ && (a) < (tmin) - (b)) \ : (a) <= -1 - (b)) \ || ((EXPR_SIGNED (a) ? 0 <= (a) : (tmax) < (a)) && (tmax) < (a) + (b))) \ : (a) < 0 \ ? (((tmin) \ ? ((EXPR_SIGNED (_GL_INT_CONVERT (b, (tmin) - (a))) || (a) < (tmin)) \ && (b) < (tmin) - (a)) \ : (b) <= -1 - (a)) \ || ((EXPR_SIGNED (_GL_INT_CONVERT (a, b)) || (tmax) < (b)) \ && (tmax) < (a) + (b))) \ : (tmax) < (b) || (tmax) - (b) < (a)) #define _GL_INT_SUBTRACT_RANGE_OVERFLOW(a, b, tmin, tmax) \ (((a) < 0) == ((b) < 0) \ ? ((a) < (b) \ ? !(tmin) || -1 - (tmin) < (b) - (a) - 1 \ : (tmax) < (a) - (b)) \ : (a) < 0 \ ? ((!EXPR_SIGNED (_GL_INT_CONVERT ((a) - (tmin), b)) && (a) - (tmin) < 0) \ || (a) - (tmin) < (b)) \ : ((! (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ && EXPR_SIGNED (_GL_INT_CONVERT ((tmax) + (b), a))) \ && (tmax) <= -1 - (b)) \ || (tmax) + (b) < (a))) #define _GL_INT_MULTIPLY_RANGE_OVERFLOW(a, b, tmin, tmax) \ ((b) < 0 \ ? ((a) < 0 \ ? (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ ? (a) < (tmax) / (b) \ : ((INT_NEGATE_OVERFLOW (b) \ ? _GL_INT_CONVERT (b, tmax) >> (TYPE_WIDTH (+ (b)) - 1) \ : (tmax) / -(b)) \ <= -1 - (a))) \ : INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (b, tmin)) && (b) == -1 \ ? (EXPR_SIGNED (a) \ ? 0 < (a) + (tmin) \ : 0 < (a) && -1 - (tmin) < (a) - 1) \ : (tmin) / (b) < (a)) \ : (b) == 0 \ ? 0 \ : ((a) < 0 \ ? (INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (a, tmin)) && (a) == -1 \ ? (EXPR_SIGNED (b) ? 0 < (b) + (tmin) : -1 - (tmin) < (b) - 1) \ : (tmin) / (a) < (b)) \ : (tmax) / (b) < (a))) /* The following macros compute A + B, A - B, and A * B, respectively. If no overflow occurs, they set *R to the result and return 1; otherwise, they return 0 and may modify *R. Example usage: long int result; if (INT_ADD_OK (a, b, &result)) printf ("result is %ld\n", result); else printf ("overflow\n"); A, B, and *R should be integers; they need not be the same type, and they need not be all signed or all unsigned. These macros work correctly on all known practical hosts, and do not rely on undefined behavior due to signed arithmetic overflow. These macros are not constant expressions. These macros may evaluate their arguments zero or multiple times, so the arguments should not have side effects. These macros are tuned for B being a constant. */ #define INT_ADD_OK(a, b, r) ! INT_ADD_WRAPV (a, b, r) #define INT_SUBTRACT_OK(a, b, r) ! INT_SUBTRACT_WRAPV (a, b, r) #define INT_MULTIPLY_OK(a, b, r) ! INT_MULTIPLY_WRAPV (a, b, r) #endif /* _GL_INTPROPS_H */ kbuild-3608/src/grep/lib/basename-lgpl.h0000664000175000017500000000532414670377423020101 0ustar locutuslocutus/* Extract the last component (base name) of a file name. Copyright (C) 1998, 2001, 2003-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _BASENAME_LGPL_H #define _BASENAME_LGPL_H #include #ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 #endif #ifdef __cplusplus extern "C" { #endif /* Return the address of the last file name component of FILENAME. If FILENAME has some trailing slash(es), they are considered to be part of the last component. If FILENAME has no relative file name components because it is a file system root, return the empty string. Examples: FILENAME RESULT "foo.c" "foo.c" "foo/bar.c" "bar.c" "/foo/bar.c" "bar.c" "foo/bar/" "bar/" "foo/bar//" "bar//" "/" "" "//" "" "" "" The return value is a tail of the given FILENAME; do NOT free() it! */ /* This function was traditionally called 'basename', but we avoid this function name because * Various platforms have different functions in their libc. In particular, the glibc basename(), defined in , does not consider trailing slashes to be part of the component: FILENAME RESULT "foo/bar/" "" "foo/bar//" "" * The 'basename' command eliminates trailing slashes and for a root produces a non-empty result: FILENAME RESULT "foo/bar/" "bar" "foo/bar//" "bar" "/" "/" "//" "/" */ extern char *last_component (char const *filename) _GL_ATTRIBUTE_PURE; /* Return the length of the basename FILENAME. Typically FILENAME is the value returned by base_name or last_component. Act like strlen (FILENAME), except omit all trailing slashes. */ extern size_t base_len (char const *filename) _GL_ATTRIBUTE_PURE; #ifdef __cplusplus } /* extern "C" */ #endif #endif /* _BASENAME_LGPL_H */ kbuild-3608/src/grep/lib/fnmatch.c0000664000175000017500000002604314670377423017006 0ustar locutuslocutus/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _LIBC # include #endif /* Enable GNU extensions in fnmatch.h. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #include #include #include #include #include #include #if defined _LIBC || HAVE_ALLOCA # include #endif #include #include #include #include /* We need some of the locale data (the collation sequence information) but there is no interface to get this information in general. Therefore we support a correct implementation only in glibc. */ #ifdef _LIBC # include "../locale/localeinfo.h" # include "../locale/coll-lookup.h" # include # define CONCAT(a,b) __CONCAT(a,b) # define btowc __btowc # define iswctype __iswctype # define mbsrtowcs __mbsrtowcs # define mempcpy __mempcpy # define strnlen __strnlen # define towlower __towlower # define wcscat __wcscat # define wcslen __wcslen # define wctype __wctype # define wmemchr __wmemchr # define wmempcpy __wmempcpy # define fnmatch __fnmatch extern int fnmatch (const char *pattern, const char *string, int flags); #endif #ifdef _LIBC # if __GNUC__ >= 7 # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) # endif #else # include "attribute.h" #endif #include #include #ifdef _LIBC typedef ptrdiff_t idx_t; #else # include "idx.h" #endif /* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set. */ #define NO_LEADING_PERIOD(flags) \ ((flags & (FNM_FILE_NAME | FNM_PERIOD)) == (FNM_FILE_NAME | FNM_PERIOD)) #ifndef _LIBC # if HAVE_ALLOCA /* The OS usually guarantees only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely allocate anything larger than 4096 bytes. Also care for the possibility of a few compiler-allocated temporary stack slots. */ # define __libc_use_alloca(n) ((n) < 4032) # else /* Just use malloc. */ # define __libc_use_alloca(n) false # undef alloca # define alloca(n) malloc (n) # endif # define alloca_account(size, avar) ((avar) += (size), alloca (size)) #endif /* Provide support for user-defined character classes, based on the functions from ISO C 90 amendment 1. */ #ifdef CHARCLASS_NAME_MAX # define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX #else /* This shouldn't happen but some implementation might still have this problem. Use a reasonable default value. */ # define CHAR_CLASS_MAX_LENGTH 256 #endif #define IS_CHAR_CLASS(string) wctype (string) /* Avoid depending on library functions or files whose names are inconsistent. */ /* Global variable. */ static int posixly_correct; /* Note that this evaluates C many times. */ #define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c)) #define CHAR char #define UCHAR unsigned char #define INT int #define FCT internal_fnmatch #define EXT ext_match #define END end_pattern #define STRUCT fnmatch_struct #define L_(CS) CS #define BTOWC(C) btowc (C) #define STRLEN(S) strlen (S) #define STRCAT(D, S) strcat (D, S) #define MEMPCPY(D, S, N) mempcpy (D, S, N) #define MEMCHR(S, C, N) memchr (S, C, N) #define WIDE_CHAR_VERSION 0 #ifdef _LIBC # include # define FINDIDX findidx #endif #include "fnmatch_loop.c" #define FOLD(c) ((flags & FNM_CASEFOLD) ? towlower (c) : (c)) #define CHAR wchar_t #define UCHAR wint_t #define INT wint_t #define FCT internal_fnwmatch #define EXT ext_wmatch #define END end_wpattern #define L_(CS) L##CS #define BTOWC(C) (C) #define STRLEN(S) wcslen (S) #define STRCAT(D, S) wcscat (D, S) #define MEMPCPY(D, S, N) wmempcpy (D, S, N) #define MEMCHR(S, C, N) wmemchr (S, C, N) #define WIDE_CHAR_VERSION 1 #ifdef _LIBC /* Change the name the header defines so it doesn't conflict with the version included above. */ # define findidx findidxwc # include # undef findidx # define FINDIDX findidxwc #endif #undef IS_CHAR_CLASS /* We have to convert the wide character string in a multibyte string. But we know that the character class names consist of alphanumeric characters from the portable character set, and since the wide character encoding for a member of the portable character set is the same code point as its single-byte encoding, we can use a simplified method to convert the string to a multibyte character string. */ static wctype_t is_char_class (const wchar_t *wcs) { char s[CHAR_CLASS_MAX_LENGTH + 1]; char *cp = s; do { /* Test for a printable character from the portable character set. */ #ifdef _LIBC if (*wcs < 0x20 || *wcs > 0x7e || *wcs == 0x24 || *wcs == 0x40 || *wcs == 0x60) return (wctype_t) 0; #else switch (*wcs) { 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'~': break; default: return (wctype_t) 0; } #endif /* Avoid overrunning the buffer. */ if (cp == s + CHAR_CLASS_MAX_LENGTH) return (wctype_t) 0; *cp++ = (char) *wcs++; } while (*wcs != L'\0'); *cp = '\0'; return wctype (s); } #define IS_CHAR_CLASS(string) is_char_class (string) #include "fnmatch_loop.c" int fnmatch (const char *pattern, const char *string, int flags) { if (__glibc_unlikely (MB_CUR_MAX != 1)) { mbstate_t ps; size_t n; const char *p; wchar_t *wpattern_malloc = NULL; wchar_t *wpattern; wchar_t *wstring_malloc = NULL; wchar_t *wstring; size_t alloca_used = 0; /* Convert the strings into wide characters. */ memset (&ps, '\0', sizeof (ps)); p = pattern; n = strnlen (pattern, 1024); if (__glibc_likely (n < 1024)) { wpattern = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t), alloca_used); n = mbsrtowcs (wpattern, &p, n + 1, &ps); if (__glibc_unlikely (n == (size_t) -1)) /* Something wrong. XXX Do we have to set 'errno' to something which mbsrtows hasn't already done? */ return -1; if (p) { memset (&ps, '\0', sizeof (ps)); goto prepare_wpattern; } } else { prepare_wpattern: n = mbsrtowcs (NULL, &pattern, 0, &ps); if (__glibc_unlikely (n == (size_t) -1)) /* Something wrong. XXX Do we have to set 'errno' to something which mbsrtows hasn't already done? */ return -1; if (__glibc_unlikely (n >= (size_t) -1 / sizeof (wchar_t))) { __set_errno (ENOMEM); return -2; } wpattern_malloc = wpattern = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t)); assert (mbsinit (&ps)); if (wpattern == NULL) return -2; (void) mbsrtowcs (wpattern, &pattern, n + 1, &ps); } assert (mbsinit (&ps)); n = strnlen (string, 1024); p = string; if (__glibc_likely (n < 1024)) { wstring = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t), alloca_used); n = mbsrtowcs (wstring, &p, n + 1, &ps); if (__glibc_unlikely (n == (size_t) -1)) { /* Something wrong. XXX Do we have to set 'errno' to something which mbsrtows hasn't already done? */ free_return: free (wpattern_malloc); return -1; } if (p) { memset (&ps, '\0', sizeof (ps)); goto prepare_wstring; } } else { prepare_wstring: n = mbsrtowcs (NULL, &string, 0, &ps); if (__glibc_unlikely (n == (size_t) -1)) /* Something wrong. XXX Do we have to set 'errno' to something which mbsrtows hasn't already done? */ goto free_return; if (__glibc_unlikely (n >= (size_t) -1 / sizeof (wchar_t))) { free (wpattern_malloc); __set_errno (ENOMEM); return -2; } wstring_malloc = wstring = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t)); if (wstring == NULL) { free (wpattern_malloc); return -2; } assert (mbsinit (&ps)); (void) mbsrtowcs (wstring, &string, n + 1, &ps); } int res = internal_fnwmatch (wpattern, wstring, wstring + n, flags & FNM_PERIOD, flags, NULL, alloca_used); free (wstring_malloc); free (wpattern_malloc); return res; } return internal_fnmatch (pattern, string, string + strlen (string), flags & FNM_PERIOD, flags, NULL, 0); } #undef fnmatch versioned_symbol (libc, __fnmatch, fnmatch, GLIBC_2_2_3); #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_3) strong_alias (__fnmatch, __fnmatch_old) compat_symbol (libc, __fnmatch_old, fnmatch, GLIBC_2_0); #endif libc_hidden_ver (__fnmatch, fnmatch) kbuild-3608/src/grep/lib/stat-w32.h0000664000175000017500000000310714670377426016756 0ustar locutuslocutus/* Core of implementation of fstat and stat for native Windows. Copyright (C) 2017-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _STAT_W32_H #define _STAT_W32_H 1 /* Converts a FILETIME to GMT time since 1970-01-01 00:00:00. */ #if _GL_WINDOWS_STAT_TIMESPEC extern struct timespec _gl_convert_FILETIME_to_timespec (const FILETIME *ft); #else extern time_t _gl_convert_FILETIME_to_POSIX (const FILETIME *ft); #endif /* Fill *BUF with information about the file designated by H. PATH is the file name, if known, otherwise NULL. Return 0 if successful, or -1 with errno set upon failure. */ extern int _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf); /* Bitmasks for st_mode. */ #define S_IREAD_UGO (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6)) #define S_IWRITE_UGO (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6)) #define S_IEXEC_UGO (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6)) #endif /* _STAT_W32_H */ kbuild-3608/src/grep/lib/localcharset.h0000664000175000017500000001431614670377424020040 0ustar locutuslocutus/* Determine a canonical name for the current locale's character encoding. Copyright (C) 2000-2003, 2009-2021 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _LOCALCHARSET_H #define _LOCALCHARSET_H #ifdef __cplusplus extern "C" { #endif /* Determine the current locale's character encoding, and canonicalize it into one of the canonical names listed below. The result must not be freed; it is statically allocated. The result becomes invalid when setlocale() is used to change the global locale, or when the value of one of the environment variables LC_ALL, LC_CTYPE, LANG is changed; threads in multithreaded programs should not do this. If the canonical name cannot be determined, the result is a non-canonical name. */ extern const char * locale_charset (void); /* About GNU canonical names for character encodings: Every canonical name must be supported by GNU libiconv. Support by GNU libc is also desirable. The name is case insensitive. Usually an upper case MIME charset name is preferred. The current list of these GNU canonical names is: name MIME? used by which systems (darwin = Mac OS X, windows = native Windows) ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin minix cygwin ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos ISO-8859-3 Y glibc solaris cygwin ISO-8859-4 Y hpux osf solaris freebsd netbsd openbsd darwin ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos ISO-8859-6 Y glibc aix hpux solaris cygwin ISO-8859-7 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos ISO-8859-8 Y glibc aix hpux osf solaris cygwin zos ISO-8859-9 Y glibc aix hpux irix osf solaris freebsd darwin cygwin zos ISO-8859-13 glibc hpux solaris freebsd netbsd openbsd darwin cygwin ISO-8859-14 glibc cygwin ISO-8859-15 glibc aix irix osf solaris freebsd netbsd openbsd darwin cygwin KOI8-R Y glibc hpux solaris freebsd netbsd openbsd darwin KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin 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 netbsd openbsd darwin dos CP869 dos CP874 windows dos CP922 aix CP932 aix cygwin windows dos CP943 aix zos CP949 osf darwin windows dos CP950 windows dos CP1046 aix CP1124 aix CP1125 dos CP1129 aix CP1131 freebsd darwin CP1250 windows CP1251 glibc hpux solaris freebsd netbsd openbsd darwin cygwin windows CP1252 aix windows CP1253 windows CP1254 windows CP1255 glibc windows CP1256 windows CP1257 windows GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin cygwin zos EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin zos EUC-TW glibc aix hpux irix osf solaris netbsd BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin zos BIG5-HKSCS glibc hpux solaris netbsd darwin GBK glibc aix osf solaris freebsd darwin cygwin windows dos GB18030 glibc hpux solaris freebsd netbsd darwin SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin JOHAB glibc solaris windows TIS-620 glibc aix hpux osf solaris cygwin zos VISCII Y glibc TCVN5712-1 glibc ARMSCII-8 glibc freebsd netbsd darwin GEORGIAN-PS glibc cygwin PT154 glibc netbsd cygwin 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 Y glibc aix hpux osf solaris netbsd darwin cygwin zos 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. */ #ifdef __cplusplus } #endif #endif /* _LOCALCHARSET_H */ kbuild-3608/src/grep/lib/windows-rwlock.h0000664000175000017500000000513414670377426020365 0ustar locutuslocutus/* Read-write locks (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-win32.h. */ #ifndef _WINDOWS_RWLOCK_H #define _WINDOWS_RWLOCK_H #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include #include "windows-initguard.h" /* It is impossible to implement read-write locks using plain locks, without introducing an extra thread dedicated to managing read-write locks. Therefore here we need to use the low-level Event type. */ typedef struct { HANDLE *array; /* array of waiting threads, each represented by an event */ unsigned int count; /* number of waiting threads */ unsigned int alloc; /* length of allocated array */ unsigned int offset; /* index of first waiting thread in array */ } glwthread_carray_waitqueue_t; typedef struct { glwthread_initguard_t guard; /* protects the initialization */ CRITICAL_SECTION lock; /* protects the remaining fields */ glwthread_carray_waitqueue_t waiting_readers; /* waiting readers */ glwthread_carray_waitqueue_t waiting_writers; /* waiting writers */ int runcount; /* number of readers running, or -1 when a writer runs */ } glwthread_rwlock_t; #define GLWTHREAD_RWLOCK_INIT { GLWTHREAD_INITGUARD_INIT } #ifdef __cplusplus extern "C" { #endif extern void glwthread_rwlock_init (glwthread_rwlock_t *lock); extern int glwthread_rwlock_rdlock (glwthread_rwlock_t *lock); extern int glwthread_rwlock_wrlock (glwthread_rwlock_t *lock); extern int glwthread_rwlock_tryrdlock (glwthread_rwlock_t *lock); extern int glwthread_rwlock_trywrlock (glwthread_rwlock_t *lock); extern int glwthread_rwlock_unlock (glwthread_rwlock_t *lock); extern int glwthread_rwlock_destroy (glwthread_rwlock_t *lock); #ifdef __cplusplus } #endif #endif /* _WINDOWS_RWLOCK_H */ kbuild-3608/src/grep/lib/strerror-override.c0000664000175000017500000002164614670377426021074 0ustar locutuslocutus/* strerror-override.c --- POSIX compatible system error routine Copyright (C) 2010-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2010. */ #include #include "strerror-override.h" #include #if GNULIB_defined_EWINSOCK /* native Windows platforms */ # if HAVE_WINSOCK2_H # include # endif #endif #if !GNULIB_defined_strerror_override_macro /* If ERRNUM maps to an errno value defined by gnulib, return a string describing the error. Otherwise return NULL. */ const char * strerror_override (int errnum) { /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ switch (errnum) { # if REPLACE_STRERROR_0 case 0: return "Success"; # endif # if GNULIB_defined_ESOCK /* native Windows platforms with older */ case EINPROGRESS: return "Operation now in progress"; case EALREADY: return "Operation already in progress"; case ENOTSOCK: return "Socket operation on non-socket"; case EDESTADDRREQ: return "Destination address required"; case EMSGSIZE: return "Message too long"; case EPROTOTYPE: return "Protocol wrong type for socket"; case ENOPROTOOPT: return "Protocol not available"; case EPROTONOSUPPORT: return "Protocol not supported"; case EOPNOTSUPP: return "Operation not supported"; case EAFNOSUPPORT: return "Address family not supported by protocol"; case EADDRINUSE: return "Address already in use"; case EADDRNOTAVAIL: return "Cannot assign requested address"; case ENETDOWN: return "Network is down"; case ENETUNREACH: return "Network is unreachable"; case ECONNRESET: return "Connection reset by peer"; case ENOBUFS: return "No buffer space available"; case EISCONN: return "Transport endpoint is already connected"; case ENOTCONN: return "Transport endpoint is not connected"; case ETIMEDOUT: return "Connection timed out"; case ECONNREFUSED: return "Connection refused"; case ELOOP: return "Too many levels of symbolic links"; case EHOSTUNREACH: return "No route to host"; case EWOULDBLOCK: return "Operation would block"; # endif # if GNULIB_defined_ESTREAMS /* native Windows platforms with older */ case ETXTBSY: return "Text file busy"; case ENODATA: return "No data available"; case ENOSR: return "Out of streams resources"; case ENOSTR: return "Device not a stream"; case ETIME: return "Timer expired"; case EOTHER: return "Other error"; # endif # if GNULIB_defined_EWINSOCK /* native Windows platforms */ case ESOCKTNOSUPPORT: return "Socket type not supported"; case EPFNOSUPPORT: return "Protocol family not supported"; case ESHUTDOWN: return "Cannot send after transport endpoint shutdown"; case ETOOMANYREFS: return "Too many references: cannot splice"; case EHOSTDOWN: return "Host is down"; case EPROCLIM: return "Too many processes"; case EUSERS: return "Too many users"; case EDQUOT: return "Disk quota exceeded"; case ESTALE: return "Stale NFS file handle"; case EREMOTE: return "Object is remote"; # if HAVE_WINSOCK2_H /* WSA_INVALID_HANDLE maps to EBADF */ /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ /* WSA_INVALID_PARAMETER maps to EINVAL */ case WSA_OPERATION_ABORTED: return "Overlapped operation aborted"; case WSA_IO_INCOMPLETE: return "Overlapped I/O event object not in signaled state"; case WSA_IO_PENDING: return "Overlapped operations will complete later"; /* WSAEINTR maps to EINTR */ /* WSAEBADF maps to EBADF */ /* WSAEACCES maps to EACCES */ /* WSAEFAULT maps to EFAULT */ /* WSAEINVAL maps to EINVAL */ /* WSAEMFILE maps to EMFILE */ /* WSAEWOULDBLOCK maps to EWOULDBLOCK */ /* WSAEINPROGRESS maps to EINPROGRESS */ /* WSAEALREADY maps to EALREADY */ /* WSAENOTSOCK maps to ENOTSOCK */ /* WSAEDESTADDRREQ maps to EDESTADDRREQ */ /* WSAEMSGSIZE maps to EMSGSIZE */ /* WSAEPROTOTYPE maps to EPROTOTYPE */ /* WSAENOPROTOOPT maps to ENOPROTOOPT */ /* WSAEPROTONOSUPPORT maps to EPROTONOSUPPORT */ /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */ /* WSAEOPNOTSUPP maps to EOPNOTSUPP */ /* WSAEPFNOSUPPORT is EPFNOSUPPORT */ /* WSAEAFNOSUPPORT maps to EAFNOSUPPORT */ /* WSAEADDRINUSE maps to EADDRINUSE */ /* WSAEADDRNOTAVAIL maps to EADDRNOTAVAIL */ /* WSAENETDOWN maps to ENETDOWN */ /* WSAENETUNREACH maps to ENETUNREACH */ /* WSAENETRESET maps to ENETRESET */ /* WSAECONNABORTED maps to ECONNABORTED */ /* WSAECONNRESET maps to ECONNRESET */ /* WSAENOBUFS maps to ENOBUFS */ /* WSAEISCONN maps to EISCONN */ /* WSAENOTCONN maps to ENOTCONN */ /* WSAESHUTDOWN is ESHUTDOWN */ /* WSAETOOMANYREFS is ETOOMANYREFS */ /* WSAETIMEDOUT maps to ETIMEDOUT */ /* WSAECONNREFUSED maps to ECONNREFUSED */ /* WSAELOOP maps to ELOOP */ /* WSAENAMETOOLONG maps to ENAMETOOLONG */ /* WSAEHOSTDOWN is EHOSTDOWN */ /* WSAEHOSTUNREACH maps to EHOSTUNREACH */ /* WSAENOTEMPTY maps to ENOTEMPTY */ /* WSAEPROCLIM is EPROCLIM */ /* WSAEUSERS is EUSERS */ /* WSAEDQUOT is EDQUOT */ /* WSAESTALE is ESTALE */ /* WSAEREMOTE is EREMOTE */ case WSASYSNOTREADY: return "Network subsystem is unavailable"; case WSAVERNOTSUPPORTED: return "Winsock.dll version out of range"; case WSANOTINITIALISED: return "Successful WSAStartup not yet performed"; case WSAEDISCON: return "Graceful shutdown in progress"; case WSAENOMORE: case WSA_E_NO_MORE: return "No more results"; case WSAECANCELLED: case WSA_E_CANCELLED: return "Call was canceled"; case WSAEINVALIDPROCTABLE: return "Procedure call table is invalid"; case WSAEINVALIDPROVIDER: return "Service provider is invalid"; case WSAEPROVIDERFAILEDINIT: return "Service provider failed to initialize"; case WSASYSCALLFAILURE: return "System call failure"; case WSASERVICE_NOT_FOUND: return "Service not found"; case WSATYPE_NOT_FOUND: return "Class type not found"; case WSAEREFUSED: return "Database query was refused"; case WSAHOST_NOT_FOUND: return "Host not found"; case WSATRY_AGAIN: return "Nonauthoritative host not found"; case WSANO_RECOVERY: return "Nonrecoverable error"; case WSANO_DATA: return "Valid name, no data record of requested type"; /* WSA_QOS_* omitted */ # endif # endif # if GNULIB_defined_ENOMSG case ENOMSG: return "No message of desired type"; # endif # if GNULIB_defined_EIDRM case EIDRM: return "Identifier removed"; # endif # if GNULIB_defined_ENOLINK case ENOLINK: return "Link has been severed"; # endif # if GNULIB_defined_EPROTO case EPROTO: return "Protocol error"; # endif # if GNULIB_defined_EMULTIHOP case EMULTIHOP: return "Multihop attempted"; # endif # if GNULIB_defined_EBADMSG case EBADMSG: return "Bad message"; # endif # if GNULIB_defined_EOVERFLOW case EOVERFLOW: return "Value too large for defined data type"; # endif # if GNULIB_defined_ENOTSUP case ENOTSUP: return "Not supported"; # endif # if GNULIB_defined_ENETRESET case ENETRESET: return "Network dropped connection on reset"; # endif # if GNULIB_defined_ECONNABORTED case ECONNABORTED: return "Software caused connection abort"; # endif # if GNULIB_defined_ESTALE case ESTALE: return "Stale NFS file handle"; # endif # if GNULIB_defined_EDQUOT case EDQUOT: return "Disk quota exceeded"; # endif # if GNULIB_defined_ECANCELED case ECANCELED: return "Operation canceled"; # endif # if GNULIB_defined_EOWNERDEAD case EOWNERDEAD: return "Owner died"; # endif # if GNULIB_defined_ENOTRECOVERABLE case ENOTRECOVERABLE: return "State not recoverable"; # endif # if GNULIB_defined_EILSEQ case EILSEQ: return "Invalid or incomplete multibyte or wide character"; # endif default: return NULL; } } #endif kbuild-3608/src/grep/lib/lc-charset-dispatch.c0000664000175000017500000000522014670377424021203 0ustar locutuslocutus/* Dispatching based on the current locale's character encoding. Copyright (C) 2018-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2018. */ #include /* Specification. */ #include "lc-charset-dispatch.h" #if GNULIB_defined_mbstate_t # include "localcharset.h" # include "streq.h" # if GNULIB_WCHAR_SINGLE_LOCALE /* When we know that the locale does not change, provide a speedup by caching the value of locale_encoding_classification. */ # define locale_encoding_classification_cached locale_encoding_classification # else /* By default, don't make assumptions, hence no caching. */ # define locale_encoding_classification_uncached locale_encoding_classification # endif # if GNULIB_WCHAR_SINGLE_LOCALE static inline # endif enc_t locale_encoding_classification_uncached (void) { const char *encoding = locale_charset (); if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) return enc_utf8; if (STREQ_OPT (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)) return enc_eucjp; if (STREQ_OPT (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) || STREQ_OPT (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) || STREQ_OPT (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)) return enc_94; if (STREQ_OPT (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)) return enc_euctw; if (STREQ_OPT (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0)) return enc_gb18030; if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) return enc_sjis; return enc_other; } # if GNULIB_WCHAR_SINGLE_LOCALE static int cached_locale_enc = -1; enc_t locale_encoding_classification_cached (void) { if (cached_locale_enc < 0) cached_locale_enc = locale_encoding_classification_uncached (); return cached_locale_enc; } # endif #else /* This declaration is solely to ensure that after preprocessing this file is never empty. */ typedef int dummy; #endif kbuild-3608/src/grep/lib/stat-w32.c0000664000175000017500000004422414670377426016756 0ustar locutuslocutus/* Core of implementation of fstat and stat for native Windows. Copyright (C) 2017-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible. */ #include #if defined _WIN32 && ! defined __CYGWIN__ /* Attempt to make define FILE_ID_INFO. But ensure that the redefinition of _WIN32_WINNT does not make us assume Windows Vista or newer when building for an older version of Windows. */ #if HAVE_SDKDDKVER_H # include # if _WIN32_WINNT >= _WIN32_WINNT_VISTA # define WIN32_ASSUME_VISTA 1 # else # define WIN32_ASSUME_VISTA 0 # endif # if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8) # undef _WIN32_WINNT # define _WIN32_WINNT _WIN32_WINNT_WIN8 # endif #else # define WIN32_ASSUME_VISTA (_WIN32_WINNT >= _WIN32_WINNT_VISTA) #endif #include #include #include #include #include #include #include /* Specification. */ #include "stat-w32.h" #include "pathmax.h" #include "verify.h" /* Don't assume that UNICODE is not defined. */ #undef LoadLibrary #define LoadLibrary LoadLibraryA #undef GetFinalPathNameByHandle #define GetFinalPathNameByHandle GetFinalPathNameByHandleA /* Older mingw headers do not define VOLUME_NAME_NONE. */ #ifndef VOLUME_NAME_NONE # define VOLUME_NAME_NONE 4 #endif #if !WIN32_ASSUME_VISTA /* Avoid warnings from gcc -Wcast-function-type. */ # define GetProcAddress \ (void *) GetProcAddress # if _GL_WINDOWS_STAT_INODES == 2 /* GetFileInformationByHandleEx was introduced only in Windows Vista. */ typedef DWORD (WINAPI * GetFileInformationByHandleExFuncType) (HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS fiClass, LPVOID lpBuffer, DWORD dwBufferSize); static GetFileInformationByHandleExFuncType GetFileInformationByHandleExFunc = NULL; # endif /* GetFinalPathNameByHandle was introduced only in Windows Vista. */ typedef DWORD (WINAPI * GetFinalPathNameByHandleFuncType) (HANDLE hFile, LPSTR lpFilePath, DWORD lenFilePath, DWORD dwFlags); static GetFinalPathNameByHandleFuncType GetFinalPathNameByHandleFunc = NULL; static BOOL initialized = FALSE; static void initialize (void) { HMODULE kernel32 = LoadLibrary ("kernel32.dll"); if (kernel32 != NULL) { # if _GL_WINDOWS_STAT_INODES == 2 GetFileInformationByHandleExFunc = (GetFileInformationByHandleExFuncType) GetProcAddress (kernel32, "GetFileInformationByHandleEx"); # endif GetFinalPathNameByHandleFunc = (GetFinalPathNameByHandleFuncType) GetProcAddress (kernel32, "GetFinalPathNameByHandleA"); } initialized = TRUE; } #else # define GetFileInformationByHandleExFunc GetFileInformationByHandleEx # define GetFinalPathNameByHandleFunc GetFinalPathNameByHandle #endif /* Converts a FILETIME to GMT time since 1970-01-01 00:00:00. */ #if _GL_WINDOWS_STAT_TIMESPEC struct timespec _gl_convert_FILETIME_to_timespec (const FILETIME *ft) { struct timespec result; /* FILETIME: */ unsigned long long since_1601 = ((unsigned long long) ft->dwHighDateTime << 32) | (unsigned long long) ft->dwLowDateTime; if (since_1601 == 0) { result.tv_sec = 0; result.tv_nsec = 0; } else { /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 leap years, in total 134774 days. */ unsigned long long since_1970 = since_1601 - (unsigned long long) 134774 * (unsigned long long) 86400 * (unsigned long long) 10000000; result.tv_sec = since_1970 / (unsigned long long) 10000000; result.tv_nsec = (unsigned long) (since_1970 % (unsigned long long) 10000000) * 100; } return result; } #else time_t _gl_convert_FILETIME_to_POSIX (const FILETIME *ft) { /* FILETIME: */ unsigned long long since_1601 = ((unsigned long long) ft->dwHighDateTime << 32) | (unsigned long long) ft->dwLowDateTime; if (since_1601 == 0) return 0; else { /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 leap years, in total 134774 days. */ unsigned long long since_1970 = since_1601 - (unsigned long long) 134774 * (unsigned long long) 86400 * (unsigned long long) 10000000; return since_1970 / (unsigned long long) 10000000; } } #endif /* Fill *BUF with information about the file designated by H. PATH is the file name, if known, otherwise NULL. Return 0 if successful, or -1 with errno set upon failure. */ int _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf) { /* GetFileType */ DWORD type = GetFileType (h); if (type == FILE_TYPE_DISK) { #if !WIN32_ASSUME_VISTA if (!initialized) initialize (); #endif /* st_mode can be determined through GetFileAttributesEx or through GetFileInformationByHandle or through GetFileInformationByHandleEx with argument FileBasicInfo The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ BY_HANDLE_FILE_INFORMATION info; if (! GetFileInformationByHandle (h, &info)) goto failed; /* Test for error conditions before starting to fill *buf. */ if (sizeof (buf->st_size) <= 4 && info.nFileSizeHigh > 0) { errno = EOVERFLOW; return -1; } #if _GL_WINDOWS_STAT_INODES /* st_ino can be determined through GetFileInformationByHandle as 64 bits, or through GetFileInformationByHandleEx with argument FileIdInfo as 128 bits. The latter requires -D_WIN32_WINNT=_WIN32_WINNT_WIN8 or higher. */ /* Experiments show that GetFileInformationByHandleEx does not provide much more information than GetFileInformationByHandle: * The dwVolumeSerialNumber from GetFileInformationByHandle is equal to the low 32 bits of the 64-bit VolumeSerialNumber from GetFileInformationByHandleEx, and is apparently sufficient for identifying the device. * The nFileIndex from GetFileInformationByHandle is equal to the low 64 bits of the 128-bit FileId from GetFileInformationByHandleEx, and the high 64 bits of this 128-bit FileId are zero. * On a FAT file system, GetFileInformationByHandleEx fails with error ERROR_INVALID_PARAMETER, whereas GetFileInformationByHandle succeeds. * On a CIFS/SMB file system, GetFileInformationByHandleEx fails with error ERROR_INVALID_LEVEL, whereas GetFileInformationByHandle succeeds. */ # if _GL_WINDOWS_STAT_INODES == 2 if (GetFileInformationByHandleExFunc != NULL) { FILE_ID_INFO id; if (GetFileInformationByHandleExFunc (h, FileIdInfo, &id, sizeof (id))) { buf->st_dev = id.VolumeSerialNumber; verify (sizeof (ino_t) == sizeof (id.FileId)); memcpy (&buf->st_ino, &id.FileId, sizeof (ino_t)); goto ino_done; } else { switch (GetLastError ()) { case ERROR_INVALID_PARAMETER: /* older Windows version, or FAT */ case ERROR_INVALID_LEVEL: /* CIFS/SMB file system */ goto fallback; default: goto failed; } } } fallback: ; /* Fallback for older Windows versions. */ buf->st_dev = info.dwVolumeSerialNumber; buf->st_ino._gl_ino[0] = ((ULONGLONG) info.nFileIndexHigh << 32) | (ULONGLONG) info.nFileIndexLow; buf->st_ino._gl_ino[1] = 0; ino_done: ; # else /* _GL_WINDOWS_STAT_INODES == 1 */ buf->st_dev = info.dwVolumeSerialNumber; buf->st_ino = ((ULONGLONG) info.nFileIndexHigh << 32) | (ULONGLONG) info.nFileIndexLow; # endif #else /* st_ino is not wide enough for identifying a file on a device. Without st_ino, st_dev is pointless. */ buf->st_dev = 0; buf->st_ino = 0; #endif /* st_mode. */ unsigned int mode = /* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ? */ ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG) | S_IREAD_UGO | ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO); if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { /* Determine whether the file is executable by looking at the file name suffix. If the file name is already known, use it. Otherwise, for non-empty files, it can be determined through GetFinalPathNameByHandle or through GetFileInformationByHandleEx with argument FileNameInfo Both require -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) { char fpath[PATH_MAX]; if (path != NULL || (GetFinalPathNameByHandleFunc != NULL && GetFinalPathNameByHandleFunc (h, fpath, sizeof (fpath), VOLUME_NAME_NONE) < sizeof (fpath) && (path = fpath, 1))) { const char *last_dot = NULL; const char *p; for (p = path; *p != '\0'; p++) if (*p == '.') last_dot = p; if (last_dot != NULL) { const char *suffix = last_dot + 1; if (_stricmp (suffix, "exe") == 0 || _stricmp (suffix, "bat") == 0 || _stricmp (suffix, "cmd") == 0 || _stricmp (suffix, "com") == 0) mode |= S_IEXEC_UGO; } } else /* Cannot determine file name. Pretend that it is executable. */ mode |= S_IEXEC_UGO; } } buf->st_mode = mode; /* st_nlink can be determined through GetFileInformationByHandle or through GetFileInformationByHandleEx with argument FileStandardInfo The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ buf->st_nlink = (info.nNumberOfLinks > SHRT_MAX ? SHRT_MAX : info.nNumberOfLinks); /* There's no easy way to map the Windows SID concept to an integer. */ buf->st_uid = 0; buf->st_gid = 0; /* st_rdev is irrelevant for normal files and directories. */ buf->st_rdev = 0; /* st_size can be determined through GetFileSizeEx or through GetFileAttributesEx or through GetFileInformationByHandle or through GetFileInformationByHandleEx with argument FileStandardInfo The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ if (sizeof (buf->st_size) <= 4) /* Range check already done above. */ buf->st_size = info.nFileSizeLow; else buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow; /* st_atime, st_mtime, st_ctime can be determined through GetFileTime or through GetFileAttributesEx or through GetFileInformationByHandle or through GetFileInformationByHandleEx with argument FileBasicInfo The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ #if _GL_WINDOWS_STAT_TIMESPEC buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime); buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime); buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime); #else buf->st_atime = _gl_convert_FILETIME_to_POSIX (&info.ftLastAccessTime); buf->st_mtime = _gl_convert_FILETIME_to_POSIX (&info.ftLastWriteTime); buf->st_ctime = _gl_convert_FILETIME_to_POSIX (&info.ftCreationTime); #endif return 0; } else if (type == FILE_TYPE_CHAR || type == FILE_TYPE_PIPE) { buf->st_dev = 0; #if _GL_WINDOWS_STAT_INODES == 2 buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0; #else buf->st_ino = 0; #endif buf->st_mode = (type == FILE_TYPE_PIPE ? _S_IFIFO : _S_IFCHR); buf->st_nlink = 1; buf->st_uid = 0; buf->st_gid = 0; buf->st_rdev = 0; if (type == FILE_TYPE_PIPE) { /* PeekNamedPipe */ DWORD bytes_available; if (PeekNamedPipe (h, NULL, 0, NULL, &bytes_available, NULL)) buf->st_size = bytes_available; else buf->st_size = 0; } else buf->st_size = 0; #if _GL_WINDOWS_STAT_TIMESPEC buf->st_atim.tv_sec = 0; buf->st_atim.tv_nsec = 0; buf->st_mtim.tv_sec = 0; buf->st_mtim.tv_nsec = 0; buf->st_ctim.tv_sec = 0; buf->st_ctim.tv_nsec = 0; #else buf->st_atime = 0; buf->st_mtime = 0; buf->st_ctime = 0; #endif return 0; } else { errno = ENOENT; return -1; } failed: { DWORD error = GetLastError (); #if 0 fprintf (stderr, "_gl_fstat_by_handle error 0x%x\n", (unsigned int) error); #endif switch (error) { case ERROR_ACCESS_DENIED: case ERROR_SHARING_VIOLATION: errno = EACCES; break; case ERROR_OUTOFMEMORY: errno = ENOMEM; break; case ERROR_WRITE_FAULT: case ERROR_READ_FAULT: case ERROR_GEN_FAILURE: errno = EIO; break; default: errno = EINVAL; break; } return -1; } } #else /* This declaration is solely to ensure that after preprocessing this file is never empty. */ typedef int dummy; #endif kbuild-3608/src/grep/lib/mbslen.c0000664000175000017500000000242514670377425016646 0ustar locutuslocutus/* Counting the multibyte characters in a string. Copyright (C) 2007-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2007. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include /* Specification. */ #include #include #include "mbuiter.h" /* Return the number of multibyte characters in the character string STRING. */ size_t mbslen (const char *string) { if (MB_CUR_MAX > 1) { size_t count; mbui_iterator_t iter; count = 0; for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter)) count++; return count; } else return strlen (string); } kbuild-3608/src/grep/lib/pathmax.h0000664000175000017500000000563014670377425017036 0ustar locutuslocutus/* Define PATH_MAX somehow. Requires sys/types.h. Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _PATHMAX_H # define _PATHMAX_H /* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename, including the terminating NUL byte. PATH_MAX is not defined on systems which have no limit on filename length, such as GNU/Hurd. This file does *not* define PATH_MAX always. Programs that use this file can handle the GNU/Hurd case in several ways: - Either with a package-wide handling, or with a per-file handling, - Either through a #ifdef PATH_MAX or through a fallback like #ifndef PATH_MAX # define PATH_MAX 8192 #endif or through a fallback like #ifndef PATH_MAX # define PATH_MAX pathconf ("/", _PC_PATH_MAX) #endif */ # include # include # ifndef _POSIX_PATH_MAX # define _POSIX_PATH_MAX 256 # endif /* Don't include sys/param.h if it already has been. */ # if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN # include # endif # if !defined PATH_MAX && defined MAXPATHLEN # define PATH_MAX MAXPATHLEN # endif # ifdef __hpux /* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename, *not* including the terminating NUL byte, and is set to 1023. Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is not defined at all any more. */ # undef PATH_MAX # define PATH_MAX 1024 # endif # if defined _WIN32 && ! defined __CYGWIN__ /* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com, section "Maximum Path Length Limitation", explains that the maximum size of a filename, including the terminating NUL byte, is 260 = 3 + 256 + 1. This is the same value as - FILENAME_MAX in , - _MAX_PATH in , - MAX_PATH in . Undefine the original value, because mingw's gets it wrong. */ # undef PATH_MAX # define PATH_MAX 260 # endif #endif /* _PATHMAX_H */ kbuild-3608/src/grep/lib/calloc.c0000664000175000017500000000267214670377422016624 0ustar locutuslocutus/* calloc() function that is glibc compatible. This wrapper function is required at least on Tru64 UNIX 5.1 and mingw. Copyright (C) 2004-2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Jim Meyering and Bruno Haible */ #include /* Specification. */ #include #include #include "xalloc-oversized.h" /* Call the system's calloc below. */ #undef calloc /* Allocate and zero-fill an NxS-byte block of memory from the heap, even if N or S is zero. */ void * rpl_calloc (size_t n, size_t s) { if (n == 0 || s == 0) n = s = 1; if (xalloc_oversized (n, s)) { errno = ENOMEM; return NULL; } void *result = calloc (n, s); #if !HAVE_MALLOC_POSIX if (result == NULL) errno = ENOMEM; #endif return result; } kbuild-3608/src/grep/lib/memchr2.h0000664000175000017500000000213514670377425016726 0ustar locutuslocutus/* Scan memory for the first of two bytes. Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #ifdef __cplusplus extern "C" { #endif /* Return the first address of either C1 or C2 (treated as unsigned char) that occurs within N bytes of the memory region S. If neither byte appears, return NULL. */ extern void *memchr2 (void const *s, int c1, int c2, size_t n) _GL_ATTRIBUTE_PURE; #ifdef __cplusplus } #endif kbuild-3608/src/grep/lib/setlocale_null.c0000664000175000017500000002522314670377426020375 0ustar locutuslocutus/* Query the name of the current global locale. Copyright (C) 2019-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2019. */ #include /* Specification. */ #include "setlocale_null.h" #include #include #include #include #if defined _WIN32 && !defined __CYGWIN__ # include #endif #if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE) # if defined _WIN32 && !defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # elif HAVE_PTHREAD_API # include # if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS # include # pragma weak thrd_exit # define c11_threads_in_use() (thrd_exit != NULL) # else # define c11_threads_in_use() 0 # endif # elif HAVE_THREADS_H # include # endif #endif /* Use the system's setlocale() function, not the gnulib override, here. */ #undef setlocale static const char * setlocale_null_androidfix (int category) { const char *result = setlocale (category, NULL); #ifdef __ANDROID__ if (result == NULL) switch (category) { case LC_CTYPE: case LC_NUMERIC: case LC_TIME: case LC_COLLATE: case LC_MONETARY: case LC_MESSAGES: case LC_ALL: case LC_PAPER: case LC_NAME: case LC_ADDRESS: case LC_TELEPHONE: case LC_MEASUREMENT: result = "C"; break; default: break; } #endif return result; } static int setlocale_null_unlocked (int category, char *buf, size_t bufsize) { #if defined _WIN32 && !defined __CYGWIN__ && defined _MSC_VER /* On native Windows, nowadays, the setlocale() implementation is based on _wsetlocale() and uses malloc() for the result. We are better off using _wsetlocale() directly. */ const wchar_t *result = _wsetlocale (category, NULL); if (result == NULL) { /* CATEGORY is invalid. */ if (bufsize > 0) /* Return an empty string in BUF. This is a convenience for callers that don't want to write explicit code for handling EINVAL. */ buf[0] = '\0'; return EINVAL; } else { size_t length = wcslen (result); if (length < bufsize) { size_t i; /* Convert wchar_t[] -> char[], assuming plain ASCII. */ for (i = 0; i <= length; i++) buf[i] = result[i]; return 0; } else { if (bufsize > 0) { /* Return a truncated result in BUF. This is a convenience for callers that don't want to write explicit code for handling ERANGE. */ size_t i; /* Convert wchar_t[] -> char[], assuming plain ASCII. */ for (i = 0; i < bufsize; i++) buf[i] = result[i]; buf[bufsize - 1] = '\0'; } return ERANGE; } } #else const char *result = setlocale_null_androidfix (category); if (result == NULL) { /* CATEGORY is invalid. */ if (bufsize > 0) /* Return an empty string in BUF. This is a convenience for callers that don't want to write explicit code for handling EINVAL. */ buf[0] = '\0'; return EINVAL; } else { size_t length = strlen (result); if (length < bufsize) { memcpy (buf, result, length + 1); return 0; } else { if (bufsize > 0) { /* Return a truncated result in BUF. This is a convenience for callers that don't want to write explicit code for handling ERANGE. */ memcpy (buf, result, bufsize - 1); buf[bufsize - 1] = '\0'; } return ERANGE; } } #endif } #if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE) /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin */ /* Use a lock, so that no two threads can invoke setlocale_null_unlocked at the same time. */ /* Prohibit renaming this symbol. */ # undef gl_get_setlocale_null_lock # if defined _WIN32 && !defined __CYGWIN__ extern __declspec(dllimport) CRITICAL_SECTION *gl_get_setlocale_null_lock (void); static int setlocale_null_with_lock (int category, char *buf, size_t bufsize) { CRITICAL_SECTION *lock = gl_get_setlocale_null_lock (); int ret; EnterCriticalSection (lock); ret = setlocale_null_unlocked (category, buf, bufsize); LeaveCriticalSection (lock); return ret; } # elif HAVE_PTHREAD_API /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin */ extern # if defined _WIN32 || defined __CYGWIN__ __declspec(dllimport) # endif pthread_mutex_t *gl_get_setlocale_null_lock (void); # if HAVE_WEAK_SYMBOLS /* musl libc, FreeBSD, NetBSD, OpenBSD, Haiku */ /* Avoid the need to link with '-lpthread'. */ # pragma weak pthread_mutex_lock # pragma weak pthread_mutex_unlock /* Determine whether libpthread is in use. */ # pragma weak pthread_mutexattr_gettype /* See the comments in lock.h. */ # define pthread_in_use() \ (pthread_mutexattr_gettype != NULL || c11_threads_in_use ()) # else # define pthread_in_use() 1 # endif static int setlocale_null_with_lock (int category, char *buf, size_t bufsize) { if (pthread_in_use()) { pthread_mutex_t *lock = gl_get_setlocale_null_lock (); int ret; if (pthread_mutex_lock (lock)) abort (); ret = setlocale_null_unlocked (category, buf, bufsize); if (pthread_mutex_unlock (lock)) abort (); return ret; } else return setlocale_null_unlocked (category, buf, bufsize); } # elif HAVE_THREADS_H extern mtx_t *gl_get_setlocale_null_lock (void); static int setlocale_null_with_lock (int category, char *buf, size_t bufsize) { mtx_t *lock = gl_get_setlocale_null_lock (); int ret; if (mtx_lock (lock) != thrd_success) abort (); ret = setlocale_null_unlocked (category, buf, bufsize); if (mtx_unlock (lock) != thrd_success) abort (); return ret; } # endif #endif int setlocale_null_r (int category, char *buf, size_t bufsize) { #if SETLOCALE_NULL_ALL_MTSAFE # if SETLOCALE_NULL_ONE_MTSAFE return setlocale_null_unlocked (category, buf, bufsize); # else if (category == LC_ALL) return setlocale_null_unlocked (category, buf, bufsize); else return setlocale_null_with_lock (category, buf, bufsize); # endif #else # if SETLOCALE_NULL_ONE_MTSAFE if (category == LC_ALL) return setlocale_null_with_lock (category, buf, bufsize); else return setlocale_null_unlocked (category, buf, bufsize); # else return setlocale_null_with_lock (category, buf, bufsize); # endif #endif } const char * setlocale_null (int category) { #if SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE return setlocale_null_androidfix (category); #else /* This call must be multithread-safe. To achieve this without using thread-local storage: 1. We use a specific static buffer for each possible CATEGORY argument. So that different threads can call setlocale_mtsafe with different CATEGORY arguments, without interfering. 2. We use a simple strcpy or memcpy to fill this static buffer. Filling it through, for example, strcpy + strcat would not be guaranteed to leave the buffer's contents intact if another thread is currently accessing it. If necessary, the contents is first assembled in a stack-allocated buffer. */ if (category == LC_ALL) { # if SETLOCALE_NULL_ALL_MTSAFE return setlocale_null_androidfix (LC_ALL); # else char buf[SETLOCALE_NULL_ALL_MAX]; static char resultbuf[SETLOCALE_NULL_ALL_MAX]; if (setlocale_null_r (LC_ALL, buf, sizeof (buf))) return "C"; strcpy (resultbuf, buf); return resultbuf; # endif } else { # if SETLOCALE_NULL_ONE_MTSAFE return setlocale_null_androidfix (category); # else enum { LC_CTYPE_INDEX, LC_NUMERIC_INDEX, LC_TIME_INDEX, LC_COLLATE_INDEX, LC_MONETARY_INDEX, LC_MESSAGES_INDEX, # ifdef LC_PAPER LC_PAPER_INDEX, # endif # ifdef LC_NAME LC_NAME_INDEX, # endif # ifdef LC_ADDRESS LC_ADDRESS_INDEX, # endif # ifdef LC_TELEPHONE LC_TELEPHONE_INDEX, # endif # ifdef LC_MEASUREMENT LC_MEASUREMENT_INDEX, # endif # ifdef LC_IDENTIFICATION LC_IDENTIFICATION_INDEX, # endif LC_INDICES_COUNT } i; char buf[SETLOCALE_NULL_MAX]; static char resultbuf[LC_INDICES_COUNT][SETLOCALE_NULL_MAX]; int err; err = setlocale_null_r (category, buf, sizeof (buf)); if (err == EINVAL) return NULL; if (err) return "C"; switch (category) { case LC_CTYPE: i = LC_CTYPE_INDEX; break; case LC_NUMERIC: i = LC_NUMERIC_INDEX; break; case LC_TIME: i = LC_TIME_INDEX; break; case LC_COLLATE: i = LC_COLLATE_INDEX; break; case LC_MONETARY: i = LC_MONETARY_INDEX; break; case LC_MESSAGES: i = LC_MESSAGES_INDEX; break; # ifdef LC_PAPER case LC_PAPER: i = LC_PAPER_INDEX; break; # endif # ifdef LC_NAME case LC_NAME: i = LC_NAME_INDEX; break; # endif # ifdef LC_ADDRESS case LC_ADDRESS: i = LC_ADDRESS_INDEX; break; # endif # ifdef LC_TELEPHONE case LC_TELEPHONE: i = LC_TELEPHONE_INDEX; break; # endif # ifdef LC_MEASUREMENT case LC_MEASUREMENT: i = LC_MEASUREMENT_INDEX; break; # endif # ifdef LC_IDENTIFICATION case LC_IDENTIFICATION: i = LC_IDENTIFICATION_INDEX; break; # endif default: /* If you get here, a #ifdef LC_xxx is missing. */ abort (); } strcpy (resultbuf[i], buf); return resultbuf[i]; # endif } #endif } kbuild-3608/src/grep/lib/dirfd.c0000664000175000017500000000444714670377423016462 0ustar locutuslocutus/* dirfd.c -- return the file descriptor associated with an open DIR* Copyright (C) 2001, 2006, 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Jim Meyering. */ #include #include #include #ifdef __KLIBC__ # include # include static struct dirp_fd_list { DIR *dirp; int fd; struct dirp_fd_list *next; } *dirp_fd_start = NULL; /* Register fd associated with dirp to dirp_fd_list. */ int _gl_register_dirp_fd (int fd, DIR *dirp) { struct dirp_fd_list *new_dirp_fd = malloc (sizeof *new_dirp_fd); if (!new_dirp_fd) return -1; new_dirp_fd->dirp = dirp; new_dirp_fd->fd = fd; new_dirp_fd->next = dirp_fd_start; dirp_fd_start = new_dirp_fd; return 0; } /* Unregister fd from dirp_fd_list with closing it */ void _gl_unregister_dirp_fd (int fd) { struct dirp_fd_list *dirp_fd; struct dirp_fd_list *dirp_fd_prev; for (dirp_fd_prev = NULL, dirp_fd = dirp_fd_start; dirp_fd; dirp_fd_prev = dirp_fd, dirp_fd = dirp_fd->next) { if (dirp_fd->fd == fd) { if (dirp_fd_prev) dirp_fd_prev->next = dirp_fd->next; else /* dirp_fd == dirp_fd_start */ dirp_fd_start = dirp_fd_start->next; close (fd); free (dirp_fd); break; } } } #endif int dirfd (DIR *dir_p) { int fd = DIR_TO_FD (dir_p); if (fd == -1) #ifndef __KLIBC__ errno = ENOTSUP; #else { struct dirp_fd_list *dirp_fd; for (dirp_fd = dirp_fd_start; dirp_fd; dirp_fd = dirp_fd->next) if (dirp_fd->dirp == dir_p) return dirp_fd->fd; errno = EINVAL; } #endif return fd; } kbuild-3608/src/grep/lib/hash.c0000664000175000017500000010012714670377424016306 0ustar locutuslocutus/* hash - hashing table processing. Copyright (C) 1998-2004, 2006-2007, 2009-2021 Free Software Foundation, Inc. Written by Jim Meyering, 1992. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* A generic hash table package. */ /* Define USE_OBSTACK to 1 if you want the allocator to use obstacks instead of malloc. If you change USE_OBSTACK, you have to recompile! */ #include #include "hash.h" #include "bitrotate.h" #include "xalloc-oversized.h" #include #include #include #if USE_OBSTACK # include "obstack.h" # ifndef obstack_chunk_alloc # define obstack_chunk_alloc malloc # endif # ifndef obstack_chunk_free # define obstack_chunk_free free # endif #endif struct hash_entry { void *data; struct hash_entry *next; }; struct hash_table { /* The array of buckets starts at BUCKET and extends to BUCKET_LIMIT-1, for a possibility of N_BUCKETS. Among those, N_BUCKETS_USED buckets are not empty, there are N_ENTRIES active entries in the table. */ struct hash_entry *bucket; struct hash_entry const *bucket_limit; size_t n_buckets; size_t n_buckets_used; size_t n_entries; /* Tuning arguments, kept in a physically separate structure. */ const Hash_tuning *tuning; /* Three functions are given to 'hash_initialize', see the documentation block for this function. In a word, HASHER randomizes a user entry into a number up from 0 up to some maximum minus 1; COMPARATOR returns true if two user entries compare equally; and DATA_FREER is the cleanup function for a user entry. */ Hash_hasher hasher; Hash_comparator comparator; Hash_data_freer data_freer; /* A linked list of freed struct hash_entry structs. */ struct hash_entry *free_entry_list; #if USE_OBSTACK /* Whenever obstacks are used, it is possible to allocate all overflowed entries into a single stack, so they all can be freed in a single operation. It is not clear if the speedup is worth the trouble. */ struct obstack entry_stack; #endif }; /* A hash table contains many internal entries, each holding a pointer to some user-provided data (also called a user entry). An entry indistinctly refers to both the internal entry and its associated user entry. A user entry contents may be hashed by a randomization function (the hashing function, or just "hasher" for short) into a number (or "slot") between 0 and the current table size. At each slot position in the hash table, starts a linked chain of entries for which the user data all hash to this slot. A bucket is the collection of all entries hashing to the same slot. A good "hasher" function will distribute entries rather evenly in buckets. In the ideal case, the length of each bucket is roughly the number of entries divided by the table size. Finding the slot for a data is usually done in constant time by the "hasher", and the later finding of a precise entry is linear in time with the size of the bucket. Consequently, a larger hash table size (that is, a larger number of buckets) is prone to yielding shorter chains, *given* the "hasher" function behaves properly. Long buckets slow down the lookup algorithm. One might use big hash table sizes in hope to reduce the average length of buckets, but this might become inordinate, as unused slots in the hash table take some space. The best bet is to make sure you are using a good "hasher" function (beware that those are not that easy to write! :-), and to use a table size larger than the actual number of entries. */ /* If an insertion makes the ratio of nonempty buckets to table size larger than the growth threshold (a number between 0.0 and 1.0), then increase the table size by multiplying by the growth factor (a number greater than 1.0). The growth threshold defaults to 0.8, and the growth factor defaults to 1.414, meaning that the table will have doubled its size every second time 80% of the buckets get used. */ #define DEFAULT_GROWTH_THRESHOLD 0.8f #define DEFAULT_GROWTH_FACTOR 1.414f /* If a deletion empties a bucket and causes the ratio of used buckets to table size to become smaller than the shrink threshold (a number between 0.0 and 1.0), then shrink the table by multiplying by the shrink factor (a number greater than the shrink threshold but smaller than 1.0). The shrink threshold and factor default to 0.0 and 1.0, meaning that the table never shrinks. */ #define DEFAULT_SHRINK_THRESHOLD 0.0f #define DEFAULT_SHRINK_FACTOR 1.0f /* Use this to initialize or reset a TUNING structure to some sensible values. */ static const Hash_tuning default_tuning = { DEFAULT_SHRINK_THRESHOLD, DEFAULT_SHRINK_FACTOR, DEFAULT_GROWTH_THRESHOLD, DEFAULT_GROWTH_FACTOR, false }; /* Information and lookup. */ size_t hash_get_n_buckets (const Hash_table *table) { return table->n_buckets; } size_t hash_get_n_buckets_used (const Hash_table *table) { return table->n_buckets_used; } size_t hash_get_n_entries (const Hash_table *table) { return table->n_entries; } size_t hash_get_max_bucket_length (const Hash_table *table) { struct hash_entry const *bucket; size_t max_bucket_length = 0; for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) { if (bucket->data) { struct hash_entry const *cursor = bucket; size_t bucket_length = 1; while (cursor = cursor->next, cursor) bucket_length++; if (bucket_length > max_bucket_length) max_bucket_length = bucket_length; } } return max_bucket_length; } bool hash_table_ok (const Hash_table *table) { struct hash_entry const *bucket; size_t n_buckets_used = 0; size_t n_entries = 0; for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) { if (bucket->data) { struct hash_entry const *cursor = bucket; /* Count bucket head. */ n_buckets_used++; n_entries++; /* Count bucket overflow. */ while (cursor = cursor->next, cursor) n_entries++; } } if (n_buckets_used == table->n_buckets_used && n_entries == table->n_entries) return true; return false; } void hash_print_statistics (const Hash_table *table, FILE *stream) { size_t n_entries = hash_get_n_entries (table); size_t n_buckets = hash_get_n_buckets (table); size_t n_buckets_used = hash_get_n_buckets_used (table); size_t max_bucket_length = hash_get_max_bucket_length (table); fprintf (stream, "# entries: %lu\n", (unsigned long int) n_entries); fprintf (stream, "# buckets: %lu\n", (unsigned long int) n_buckets); fprintf (stream, "# buckets used: %lu (%.2f%%)\n", (unsigned long int) n_buckets_used, (100.0 * n_buckets_used) / n_buckets); fprintf (stream, "max bucket length: %lu\n", (unsigned long int) max_bucket_length); } /* Hash KEY and return a pointer to the selected bucket. If TABLE->hasher misbehaves, abort. */ static struct hash_entry * safe_hasher (const Hash_table *table, const void *key) { size_t n = table->hasher (key, table->n_buckets); if (! (n < table->n_buckets)) abort (); return table->bucket + n; } void * hash_lookup (const Hash_table *table, const void *entry) { struct hash_entry const *bucket = safe_hasher (table, entry); struct hash_entry const *cursor; if (bucket->data == NULL) return NULL; for (cursor = bucket; cursor; cursor = cursor->next) if (entry == cursor->data || table->comparator (entry, cursor->data)) return cursor->data; return NULL; } /* Walking. */ void * hash_get_first (const Hash_table *table) { struct hash_entry const *bucket; if (table->n_entries == 0) return NULL; for (bucket = table->bucket; ; bucket++) if (! (bucket < table->bucket_limit)) abort (); else if (bucket->data) return bucket->data; } void * hash_get_next (const Hash_table *table, const void *entry) { struct hash_entry const *bucket = safe_hasher (table, entry); struct hash_entry const *cursor; /* Find next entry in the same bucket. */ cursor = bucket; do { if (cursor->data == entry && cursor->next) return cursor->next->data; cursor = cursor->next; } while (cursor != NULL); /* Find first entry in any subsequent bucket. */ while (++bucket < table->bucket_limit) if (bucket->data) return bucket->data; /* None found. */ return NULL; } size_t hash_get_entries (const Hash_table *table, void **buffer, size_t buffer_size) { size_t counter = 0; struct hash_entry const *bucket; struct hash_entry const *cursor; for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) { if (bucket->data) { for (cursor = bucket; cursor; cursor = cursor->next) { if (counter >= buffer_size) return counter; buffer[counter++] = cursor->data; } } } return counter; } size_t hash_do_for_each (const Hash_table *table, Hash_processor processor, void *processor_data) { size_t counter = 0; struct hash_entry const *bucket; struct hash_entry const *cursor; for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) { if (bucket->data) { for (cursor = bucket; cursor; cursor = cursor->next) { if (! processor (cursor->data, processor_data)) return counter; counter++; } } } return counter; } /* Allocation and clean-up. */ #if USE_DIFF_HASH /* About hashings, Paul Eggert writes to me (FP), on 1994-01-01: "Please see B. J. McKenzie, R. Harries & T. Bell, Selecting a hashing algorithm, Software--practice & experience 20, 2 (Feb 1990), 209-224. Good hash algorithms tend to be domain-specific, so what's good for [diffutils'] io.c may not be good for your application." */ size_t hash_string (const char *string, size_t n_buckets) { # define HASH_ONE_CHAR(Value, Byte) \ ((Byte) + rotl_sz (Value, 7)) size_t value = 0; unsigned char ch; for (; (ch = *string); string++) value = HASH_ONE_CHAR (value, ch); return value % n_buckets; # undef HASH_ONE_CHAR } #else /* not USE_DIFF_HASH */ /* This one comes from 'recode', and performs a bit better than the above as per a few experiments. It is inspired from a hashing routine found in the very old Cyber 'snoop', itself written in typical Greg Mansfield style. (By the way, what happened to this excellent man? Is he still alive?) */ size_t hash_string (const char *string, size_t n_buckets) { size_t value = 0; unsigned char ch; for (; (ch = *string); string++) value = (value * 31 + ch) % n_buckets; return value; } #endif /* not USE_DIFF_HASH */ /* Return true if CANDIDATE is a prime number. CANDIDATE should be an odd number at least equal to 11. */ static bool _GL_ATTRIBUTE_CONST is_prime (size_t candidate) { size_t divisor = 3; size_t square = divisor * divisor; while (square < candidate && (candidate % divisor)) { divisor++; square += 4 * divisor; divisor++; } return (candidate % divisor ? true : false); } /* Round a given CANDIDATE number up to the nearest prime, and return that prime. Primes lower than 10 are merely skipped. */ static size_t _GL_ATTRIBUTE_CONST next_prime (size_t candidate) { /* Skip small primes. */ if (candidate < 10) candidate = 10; /* Make it definitely odd. */ candidate |= 1; while (SIZE_MAX != candidate && !is_prime (candidate)) candidate += 2; return candidate; } void hash_reset_tuning (Hash_tuning *tuning) { *tuning = default_tuning; } /* If the user passes a NULL hasher, we hash the raw pointer. */ static size_t raw_hasher (const void *data, size_t n) { /* When hashing unique pointers, it is often the case that they were generated by malloc and thus have the property that the low-order bits are 0. As this tends to give poorer performance with small tables, we rotate the pointer value before performing division, in an attempt to improve hash quality. */ size_t val = rotr_sz ((size_t) data, 3); return val % n; } /* If the user passes a NULL comparator, we use pointer comparison. */ static bool raw_comparator (const void *a, const void *b) { return a == b; } /* For the given hash TABLE, check the user supplied tuning structure for reasonable values, and return true if there is no gross error with it. Otherwise, definitively reset the TUNING field to some acceptable default in the hash table (that is, the user loses the right of further modifying tuning arguments), and return false. */ static bool check_tuning (Hash_table *table) { const Hash_tuning *tuning = table->tuning; float epsilon; if (tuning == &default_tuning) return true; /* Be a bit stricter than mathematics would require, so that rounding errors in size calculations do not cause allocations to fail to grow or shrink as they should. The smallest allocation is 11 (due to next_prime's algorithm), so an epsilon of 0.1 should be good enough. */ epsilon = 0.1f; if (epsilon < tuning->growth_threshold && tuning->growth_threshold < 1 - epsilon && 1 + epsilon < tuning->growth_factor && 0 <= tuning->shrink_threshold && tuning->shrink_threshold + epsilon < tuning->shrink_factor && tuning->shrink_factor <= 1 && tuning->shrink_threshold + epsilon < tuning->growth_threshold) return true; table->tuning = &default_tuning; return false; } /* Compute the size of the bucket array for the given CANDIDATE and TUNING, or return 0 if there is no possible way to allocate that many entries. */ static size_t _GL_ATTRIBUTE_PURE compute_bucket_size (size_t candidate, const Hash_tuning *tuning) { if (!tuning->is_n_buckets) { float new_candidate = candidate / tuning->growth_threshold; if ((float) SIZE_MAX <= new_candidate) return 0; candidate = new_candidate; } candidate = next_prime (candidate); if (xalloc_oversized (candidate, sizeof (struct hash_entry *))) return 0; return candidate; } Hash_table * hash_initialize (size_t candidate, const Hash_tuning *tuning, Hash_hasher hasher, Hash_comparator comparator, Hash_data_freer data_freer) { Hash_table *table; if (hasher == NULL) hasher = raw_hasher; if (comparator == NULL) comparator = raw_comparator; table = malloc (sizeof *table); if (table == NULL) return NULL; if (!tuning) tuning = &default_tuning; table->tuning = tuning; if (!check_tuning (table)) { /* Fail if the tuning options are invalid. This is the only occasion when the user gets some feedback about it. Once the table is created, if the user provides invalid tuning options, we silently revert to using the defaults, and ignore further request to change the tuning options. */ goto fail; } table->n_buckets = compute_bucket_size (candidate, tuning); if (!table->n_buckets) goto fail; table->bucket = calloc (table->n_buckets, sizeof *table->bucket); if (table->bucket == NULL) goto fail; table->bucket_limit = table->bucket + table->n_buckets; table->n_buckets_used = 0; table->n_entries = 0; table->hasher = hasher; table->comparator = comparator; table->data_freer = data_freer; table->free_entry_list = NULL; #if USE_OBSTACK obstack_init (&table->entry_stack); #endif return table; fail: free (table); return NULL; } void hash_clear (Hash_table *table) { struct hash_entry *bucket; for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) { if (bucket->data) { struct hash_entry *cursor; struct hash_entry *next; /* Free the bucket overflow. */ for (cursor = bucket->next; cursor; cursor = next) { if (table->data_freer) table->data_freer (cursor->data); cursor->data = NULL; next = cursor->next; /* Relinking is done one entry at a time, as it is to be expected that overflows are either rare or short. */ cursor->next = table->free_entry_list; table->free_entry_list = cursor; } /* Free the bucket head. */ if (table->data_freer) table->data_freer (bucket->data); bucket->data = NULL; bucket->next = NULL; } } table->n_buckets_used = 0; table->n_entries = 0; } void hash_free (Hash_table *table) { struct hash_entry *bucket; struct hash_entry *cursor; struct hash_entry *next; /* Call the user data_freer function. */ if (table->data_freer && table->n_entries) { for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) { if (bucket->data) { for (cursor = bucket; cursor; cursor = cursor->next) table->data_freer (cursor->data); } } } #if USE_OBSTACK obstack_free (&table->entry_stack, NULL); #else /* Free all bucket overflowed entries. */ for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) { for (cursor = bucket->next; cursor; cursor = next) { next = cursor->next; free (cursor); } } /* Also reclaim the internal list of previously freed entries. */ for (cursor = table->free_entry_list; cursor; cursor = next) { next = cursor->next; free (cursor); } #endif /* Free the remainder of the hash table structure. */ free (table->bucket); free (table); } /* Insertion and deletion. */ /* Get a new hash entry for a bucket overflow, possibly by recycling a previously freed one. If this is not possible, allocate a new one. */ static struct hash_entry * allocate_entry (Hash_table *table) { struct hash_entry *new; if (table->free_entry_list) { new = table->free_entry_list; table->free_entry_list = new->next; } else { #if USE_OBSTACK new = obstack_alloc (&table->entry_stack, sizeof *new); #else new = malloc (sizeof *new); #endif } return new; } /* Free a hash entry which was part of some bucket overflow, saving it for later recycling. */ static void free_entry (Hash_table *table, struct hash_entry *entry) { entry->data = NULL; entry->next = table->free_entry_list; table->free_entry_list = entry; } /* This private function is used to help with insertion and deletion. When ENTRY matches an entry in the table, return a pointer to the corresponding user data and set *BUCKET_HEAD to the head of the selected bucket. Otherwise, return NULL. When DELETE is true and ENTRY matches an entry in the table, unlink the matching entry. */ static void * hash_find_entry (Hash_table *table, const void *entry, struct hash_entry **bucket_head, bool delete) { struct hash_entry *bucket = safe_hasher (table, entry); struct hash_entry *cursor; *bucket_head = bucket; /* Test for empty bucket. */ if (bucket->data == NULL) return NULL; /* See if the entry is the first in the bucket. */ if (entry == bucket->data || table->comparator (entry, bucket->data)) { void *data = bucket->data; if (delete) { if (bucket->next) { struct hash_entry *next = bucket->next; /* Bump the first overflow entry into the bucket head, then save the previous first overflow entry for later recycling. */ *bucket = *next; free_entry (table, next); } else { bucket->data = NULL; } } return data; } /* Scan the bucket overflow. */ for (cursor = bucket; cursor->next; cursor = cursor->next) { if (entry == cursor->next->data || table->comparator (entry, cursor->next->data)) { void *data = cursor->next->data; if (delete) { struct hash_entry *next = cursor->next; /* Unlink the entry to delete, then save the freed entry for later recycling. */ cursor->next = next->next; free_entry (table, next); } return data; } } /* No entry found. */ return NULL; } /* Internal helper, to move entries from SRC to DST. Both tables must share the same free entry list. If SAFE, only move overflow entries, saving bucket heads for later, so that no allocations will occur. Return false if the free entry list is exhausted and an allocation fails. */ static bool transfer_entries (Hash_table *dst, Hash_table *src, bool safe) { struct hash_entry *bucket; struct hash_entry *cursor; struct hash_entry *next; for (bucket = src->bucket; bucket < src->bucket_limit; bucket++) if (bucket->data) { void *data; struct hash_entry *new_bucket; /* Within each bucket, transfer overflow entries first and then the bucket head, to minimize memory pressure. After all, the only time we might allocate is when moving the bucket head, but moving overflow entries first may create free entries that can be recycled by the time we finally get to the bucket head. */ for (cursor = bucket->next; cursor; cursor = next) { data = cursor->data; new_bucket = safe_hasher (dst, data); next = cursor->next; if (new_bucket->data) { /* Merely relink an existing entry, when moving from a bucket overflow into a bucket overflow. */ cursor->next = new_bucket->next; new_bucket->next = cursor; } else { /* Free an existing entry, when moving from a bucket overflow into a bucket header. */ new_bucket->data = data; dst->n_buckets_used++; free_entry (dst, cursor); } } /* Now move the bucket head. Be sure that if we fail due to allocation failure that the src table is in a consistent state. */ data = bucket->data; bucket->next = NULL; if (safe) continue; new_bucket = safe_hasher (dst, data); if (new_bucket->data) { /* Allocate or recycle an entry, when moving from a bucket header into a bucket overflow. */ struct hash_entry *new_entry = allocate_entry (dst); if (new_entry == NULL) return false; new_entry->data = data; new_entry->next = new_bucket->next; new_bucket->next = new_entry; } else { /* Move from one bucket header to another. */ new_bucket->data = data; dst->n_buckets_used++; } bucket->data = NULL; src->n_buckets_used--; } return true; } bool hash_rehash (Hash_table *table, size_t candidate) { Hash_table storage; Hash_table *new_table; size_t new_size = compute_bucket_size (candidate, table->tuning); if (!new_size) return false; if (new_size == table->n_buckets) return true; new_table = &storage; new_table->bucket = calloc (new_size, sizeof *new_table->bucket); if (new_table->bucket == NULL) return false; new_table->n_buckets = new_size; new_table->bucket_limit = new_table->bucket + new_size; new_table->n_buckets_used = 0; new_table->n_entries = 0; new_table->tuning = table->tuning; new_table->hasher = table->hasher; new_table->comparator = table->comparator; new_table->data_freer = table->data_freer; /* In order for the transfer to successfully complete, we need additional overflow entries when distinct buckets in the old table collide into a common bucket in the new table. The worst case possible is a hasher that gives a good spread with the old size, but returns a constant with the new size; if we were to guarantee table->n_buckets_used-1 free entries in advance, then the transfer would be guaranteed to not allocate memory. However, for large tables, a guarantee of no further allocation introduces a lot of extra memory pressure, all for an unlikely corner case (most rehashes reduce, rather than increase, the number of overflow entries needed). So, we instead ensure that the transfer process can be reversed if we hit a memory allocation failure mid-transfer. */ /* Merely reuse the extra old space into the new table. */ #if USE_OBSTACK new_table->entry_stack = table->entry_stack; #endif new_table->free_entry_list = table->free_entry_list; if (transfer_entries (new_table, table, false)) { /* Entries transferred successfully; tie up the loose ends. */ free (table->bucket); table->bucket = new_table->bucket; table->bucket_limit = new_table->bucket_limit; table->n_buckets = new_table->n_buckets; table->n_buckets_used = new_table->n_buckets_used; table->free_entry_list = new_table->free_entry_list; /* table->n_entries and table->entry_stack already hold their value. */ return true; } /* We've allocated new_table->bucket (and possibly some entries), exhausted the free list, and moved some but not all entries into new_table. We must undo the partial move before returning failure. The only way to get into this situation is if new_table uses fewer buckets than the old table, so we will reclaim some free entries as overflows in the new table are put back into distinct buckets in the old table. There are some pathological cases where a single pass through the table requires more intermediate overflow entries than using two passes. Two passes give worse cache performance and takes longer, but at this point, we're already out of memory, so slow and safe is better than failure. */ table->free_entry_list = new_table->free_entry_list; if (! (transfer_entries (table, new_table, true) && transfer_entries (table, new_table, false))) abort (); /* table->n_entries already holds its value. */ free (new_table->bucket); return false; } int hash_insert_if_absent (Hash_table *table, void const *entry, void const **matched_ent) { void *data; struct hash_entry *bucket; /* The caller cannot insert a NULL entry, since hash_lookup returns NULL to indicate "not found", and hash_find_entry uses "bucket->data == NULL" to indicate an empty bucket. */ if (! entry) abort (); /* If there's a matching entry already in the table, return that. */ if ((data = hash_find_entry (table, entry, &bucket, false)) != NULL) { if (matched_ent) *matched_ent = data; return 0; } /* If the growth threshold of the buckets in use has been reached, increase the table size and rehash. There's no point in checking the number of entries: if the hashing function is ill-conditioned, rehashing is not likely to improve it. */ if (table->n_buckets_used > table->tuning->growth_threshold * table->n_buckets) { /* Check more fully, before starting real work. If tuning arguments became invalid, the second check will rely on proper defaults. */ check_tuning (table); if (table->n_buckets_used > table->tuning->growth_threshold * table->n_buckets) { const Hash_tuning *tuning = table->tuning; float candidate = (tuning->is_n_buckets ? (table->n_buckets * tuning->growth_factor) : (table->n_buckets * tuning->growth_factor * tuning->growth_threshold)); if ((float) SIZE_MAX <= candidate) return -1; /* If the rehash fails, arrange to return NULL. */ if (!hash_rehash (table, candidate)) return -1; /* Update the bucket we are interested in. */ if (hash_find_entry (table, entry, &bucket, false) != NULL) abort (); } } /* ENTRY is not matched, it should be inserted. */ if (bucket->data) { struct hash_entry *new_entry = allocate_entry (table); if (new_entry == NULL) return -1; /* Add ENTRY in the overflow of the bucket. */ new_entry->data = (void *) entry; new_entry->next = bucket->next; bucket->next = new_entry; table->n_entries++; return 1; } /* Add ENTRY right in the bucket head. */ bucket->data = (void *) entry; table->n_entries++; table->n_buckets_used++; return 1; } void * hash_insert (Hash_table *table, void const *entry) { void const *matched_ent; int err = hash_insert_if_absent (table, entry, &matched_ent); return (err == -1 ? NULL : (void *) (err == 0 ? matched_ent : entry)); } void * hash_remove (Hash_table *table, const void *entry) { void *data; struct hash_entry *bucket; data = hash_find_entry (table, entry, &bucket, true); if (!data) return NULL; table->n_entries--; if (!bucket->data) { table->n_buckets_used--; /* If the shrink threshold of the buckets in use has been reached, rehash into a smaller table. */ if (table->n_buckets_used < table->tuning->shrink_threshold * table->n_buckets) { /* Check more fully, before starting real work. If tuning arguments became invalid, the second check will rely on proper defaults. */ check_tuning (table); if (table->n_buckets_used < table->tuning->shrink_threshold * table->n_buckets) { const Hash_tuning *tuning = table->tuning; size_t candidate = (tuning->is_n_buckets ? table->n_buckets * tuning->shrink_factor : (table->n_buckets * tuning->shrink_factor * tuning->growth_threshold)); if (!hash_rehash (table, candidate)) { /* Failure to allocate memory in an attempt to shrink the table is not fatal. But since memory is low, we can at least be kind and free any spare entries, rather than keeping them tied up in the free entry list. */ #if ! USE_OBSTACK struct hash_entry *cursor = table->free_entry_list; struct hash_entry *next; while (cursor) { next = cursor->next; free (cursor); cursor = next; } table->free_entry_list = NULL; #endif } } } } return data; } void * hash_delete (Hash_table *table, const void *entry) { return hash_remove (table, entry); } /* Testing. */ #if TESTING void hash_print (const Hash_table *table) { struct hash_entry *bucket = (struct hash_entry *) table->bucket; for ( ; bucket < table->bucket_limit; bucket++) { struct hash_entry *cursor; if (bucket) printf ("%lu:\n", (unsigned long int) (bucket - table->bucket)); for (cursor = bucket; cursor; cursor = cursor->next) { char const *s = cursor->data; /* FIXME */ if (s) printf (" %s\n", s); } } } #endif /* TESTING */ kbuild-3608/src/grep/lib/wmemchr-impl.h0000664000175000017500000000174714670377426020003 0ustar locutuslocutus/* Search wide character array for a wide character. Copyright (C) 1999, 2011-2021 Free Software Foundation, Inc. Written by Bruno Haible , 1999. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ wchar_t * wmemchr (const wchar_t *s, wchar_t c, size_t n) { for (; n > 0; s++, n--) { if (*s == c) return (wchar_t *) s; } return NULL; } kbuild-3608/src/grep/lib/sigsegv.c0000664000175000017500000013154414670377426017043 0ustar locutuslocutus/* Page fault handling library. Copyright (C) 1993-2021 Free Software Foundation, Inc. Copyright (C) 2018 Nylon Chen 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 2 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 . */ /* Written by Bruno Haible and Nylon Chen. */ #include /* Specification. */ #include "sigsegv.h" #include #include /* declares perror */ #include /* defines uintptr_t */ #include #include #if HAVE_GETRLIMIT # include /* declares struct rlimit */ #endif #ifdef __OpenBSD__ # include /* defines macro OpenBSD */ #endif /* Version number. */ int libsigsegv_version = LIBSIGSEGV_VERSION; /* ======================= Fault handler information ======================= */ /* Define: SIGSEGV_FAULT_HANDLER_ARGLIST is the argument list for the actual fault handler. and if available (optional): SIGSEGV_FAULT_ADDRESS is a macro for fetching the fault address. SIGSEGV_FAULT_CONTEXT is a macro giving a pointer to the entire fault context (i.e. the register set etc.). SIGSEGV_FAULT_STACKPOINTER is a macro for fetching the stackpointer at the moment the fault occurred. */ #if defined __linux__ || defined __ANDROID__ /* Linux */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *ucp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT ((ucontext_t *) ucp) # define SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO # if defined __alpha__ /* See glibc/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h and the 'struct sigcontext' defined in are actually the same. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.sc_regs[30] # elif defined __arm64__ /* 64-bit */ /* See glibc/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h and the 'struct sigcontext' defined in are actually the same. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.sp # elif defined __arm__ || defined __armhf__ /* 32-bit */ /* See glibc/sysdeps/unix/sysv/linux/arm/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/arm/sys/ucontext.h and the 'struct sigcontext' defined in are actually the same. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.arm_sp # elif defined __cris__ /* See glibc-ports/sysdeps/unix/sysv/linux/cris/sys/ucontext.h. Note that the 'mcontext_t' defined in glibc-ports/sysdeps/unix/sysv/linux/cris/sys/ucontext.h and the 'struct sigcontext' defined in are actually the same. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.usp # elif defined __hppa__ /* See glibc/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h and the 'struct sigcontext' defined in are actually the same. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.sc_gr[30] # elif defined __x86_64__ /* 64 bit registers */ /* See glibc/sysdeps/unix/sysv/linux/x86/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/x86/sys/ucontext.h and the 'struct sigcontext' defined in glibc/sysdeps/unix/sysv/linux/x86/bits/sigcontext.h (see also ) are effectively the same. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[REG_RSP] # elif defined __i386__ /* 32 bit registers */ /* See glibc/sysdeps/unix/sysv/linux/x86/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/i386/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/x86/sys/ucontext.h and the 'struct sigcontext_ia32' defined in are effectively the same. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[REG_ESP] /* same value as ((ucontext_t *) ucp)->uc_mcontext.gregs[REG_UESP] */ # elif defined __ia64__ /* See glibc/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h and the 'struct sigcontext' defined in glibc/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h (see also ) are actually the same. */ /* IA-64 has two stack pointers, one that grows down, called $r12, and one that grows up, called $bsp/$bspstore. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.sc_gr[12] /* It would be better to access $bspstore instead of $bsp but I don't know where to find it in 'struct sigcontext'. Anyway, it doesn't matter because $bsp and $bspstore never differ by more than ca. 1 KB. */ # define SIGSEGV_FAULT_BSP_POINTER ((ucontext_t *) ucp)->uc_mcontext.sc_ar_bsp # elif defined __m68k__ /* See glibc/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h and the 'struct sigcontext' defined in are quite different types. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[R_SP] # elif defined __mips__ || defined __mipsn32__ || defined __mips64__ /* See glibc/sysdeps/unix/sysv/linux/mips/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/mips/sys/ucontext.h and the 'struct sigcontext' defined in glibc/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h (see also ) are effectively the same. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[29] # elif defined __nds32__ /* See glibc/sysdeps/unix/sysv/linux/nds32/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/nds32/sigcontextinfo.h. Both are found in part 08/11 . */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.nds32_sp # elif defined __powerpc__ || defined __powerpc64__ || defined __powerpc64_elfv2__ /* See glibc/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h, the 'struct sigcontext' defined in , and the 'struct pt_regs' defined in are quite different types. */ # if defined __powerpc64__ || defined __powerpc64_elfv2__ /* 64-bit */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gp_regs[1] # else /* 32-bit */ /* both should be equivalent */ # if 0 # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.regs->gpr[1] # else # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1] # endif # endif # elif defined __riscv32__ || __riscv64__ /* See glibc/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h and the 'struct sigcontext' defined in glibc/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h start with the same block of 32 general-purpose registers. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.__gregs[REG_SP] # elif defined __s390__ || defined __s390x__ /* See glibc/sysdeps/unix/sysv/linux/s390/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/s390/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/s390/sys/ucontext.h and the '_sigregs' type, indirect part of 'struct sigcontext', defined in , are effectively the same. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[15] # elif defined __sh__ /* See glibc/sysdeps/unix/sysv/linux/sh/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/sh/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/sh/sys/ucontext.h and the 'struct sigcontext' defined in are effectively the same. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[15] # elif defined __sparc__ || defined __sparc64__ /* See glibc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h and the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux/sparc/{sparc32,sparc64}/sigcontextinfo.h. Note that the 'mcontext_t' defined in glibc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h and the 'struct sigcontext' defined in glibc/sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h (see also ) are quite different types. */ # if defined __sparc64__/* 64-bit */ /* From linux-4.8.1/arch/sparc/kernel/signal_64.c, function setup_rt_frame, we see that ucp is not an 'ucontext_t *' but rather a 'struct sigcontext *' that happens to have the same value as sip (which is possible because a 'struct sigcontext' starts with 128 bytes room for the siginfo_t). */ # define SIGSEGV_FAULT_STACKPOINTER (((struct sigcontext *) ucp)->sigc_regs.u_regs[14] + 2047) # else /* 32-bit */ /* From linux-4.8.1/arch/sparc/kernel/signal_32.c, function setup_rt_frame, and linux-4.8.1/arch/sparc/kernel/signal32.c, function setup_rt_frame32, we see that ucp is a 'struct pt_regs *' or 'struct pt_regs32 *', respectively. In userland, this is a 'struct sigcontext *'. */ # define SIGSEGV_FAULT_STACKPOINTER ((struct sigcontext *) ucp)->si_regs.u_regs[14] # endif /* The sip->si_addr field is correct for a normal fault, but unusable in case of a stack overflow. What I observe (when running tests/test-sigsegv-catch-stackoverflow1, with a printf right at the beginning of sigsegv_handler) is that sip->si_addr is near 0: - in 64-bit mode: sip->si_addr = 0x000000000000030F, and gdb shows me that the fault occurs in an instruction 'stx %o3,[%fp+0x30f]' and %fp is 0. In fact, all registers %l0..%l7 and %i0..%i7 are 0. - in 32-bit mode: sip->si_addr = 0xFFFFFA64, and gdb shows me that the fault occurs in an instruction 'st %g2,[%fp-1436]' and %fp is 0. In fact, all registers %l0..%l7 and %i0..%i7 are 0. Apparently when the stack overflow occurred, some trap has tried to move the contents of the registers %l0..%l7 and %i0..%i7 (a "window" in SPARC terminology) to the stack, did not succeed in doing this, replaced all these register values with 0, and resumed execution at the fault location. This time, due to %fp = 0, a different fault was triggered. Now it is impossible to determine the real (previous) fault address because, even if know the faulting instruction, the previous register values have been lost. */ # define BOGUS_FAULT_ADDRESS_UPON_STACK_OVERFLOW # else /* When adding support for other CPUs here: */ /* For SIGSEGV_FAULT_HANDLER_ARGLIST, see the definition of SIGCONTEXT in glibc/sysdeps/unix/sysv/linux//sigcontextinfo.h. */ /* For SIGSEGV_FAULT_STACKPOINTER, see the definition of GET_STACK in glibc/sysdeps/unix/sysv/linux//sigcontextinfo.h. */ # endif #endif #if defined __GNU__ /* Hurd */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp # define SIGSEGV_FAULT_ADDRESS (unsigned long) code # define SIGSEGV_FAULT_CONTEXT scp # if defined __i386__ /* scp points to a 'struct sigcontext' (defined in glibc/sysdeps/mach/hurd/i386/bits/sigcontext.h). The registers of this struct get pushed on the stack through gnumach/i386/i386/locore.S:trapall. */ /* Both sc_esp and sc_uesp appear to have the same value. It appears more reliable to use sc_uesp because it is labelled as "old esp, if trapped from user". */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_uesp # endif #endif #if defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ /* GNU/kFreeBSD, FreeBSD */ # if defined __arm__ || defined __armhf__ || defined __arm64__ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *ucp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT ((ucontext_t *) ucp) # if defined __arm64__ /* 64-bit */ /* See sys/arm64/include/ucontext.h. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.mc_gpregs.gp_sp # elif defined __arm__ || defined __armhf__ /* 32-bit */ /* See sys/arm/include/ucontext.h. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.__gregs[_REG_SP] # endif # else /* On FreeBSD 12, both of these approaches work. On FreeBSD derivatives, the first one has more chances to work. */ # if 1 /* Use signal handlers without SA_SIGINFO. */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp, void *addr # define SIGSEGV_FAULT_ADDRESS addr # define SIGSEGV_FAULT_CONTEXT scp /* See sys/x86/include/signal.h. */ # if defined __x86_64__ /* 64 bit registers */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_rsp # elif defined __i386__ /* 32 bit registers */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_esp # endif # else /* Use signal handlers with SA_SIGINFO. */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *scp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT ((struct sigcontext *) scp) # define SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO /* See sys/x86/include/signal.h. */ # if defined __x86_64__ /* 64 bit registers */ # define SIGSEGV_FAULT_STACKPOINTER ((struct sigcontext *) scp)->sc_rsp # elif defined __i386__ /* 32 bit registers */ # define SIGSEGV_FAULT_STACKPOINTER ((struct sigcontext *) scp)->sc_esp # endif # endif # endif #endif #if defined __NetBSD__ /* NetBSD */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *ucp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT ((ucontext_t *) ucp) # define SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO /* _UC_MACHINE_SP is a platform independent macro. Defined in , see http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/$arch/include/mcontext.h Supported on alpha, amd64, i386, ia64, m68k, mips, powerpc, sparc since NetBSD 2.0. On i386, _UC_MACHINE_SP is the same as ->uc_mcontext.__gregs[_REG_UESP], and apparently the same value as ->uc_mcontext.__gregs[_REG_ESP]. */ # ifdef _UC_MACHINE_SP # define SIGSEGV_FAULT_STACKPOINTER _UC_MACHINE_SP ((ucontext_t *) ucp) # endif #endif #if defined __OpenBSD__ /* OpenBSD */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, struct sigcontext *scp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT scp # define SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO # if defined __alpha__ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/alpha/include/signal.h. */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_regs[30] # elif defined __arm__ || defined __armhf__ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/arm/include/signal.h. */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_usr_sp # elif defined __hppa__ || defined __hppa64__ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/hppa/include/signal.h and openbsd-src/sys/arch/hppa64/include/signal.h. */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_regs[30] # elif defined __x86_64__ /* 64 bit registers */ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/amd64/include/signal.h. */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_rsp # elif defined __i386__ /* 32 bit registers */ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/i386/include/signal.h. */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_esp # elif defined __m68k__ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/m68k/include/signal.h. */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_sp # elif defined __m88k__ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/m88k/include/signal.h and the definition of 'struct reg' in openbsd-src/sys/arch/m88k/include/reg.h. */ # if OpenBSD >= 201211 /* OpenBSD version >= 5.2 */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_regs[31] # else # define SIGSEGV_FAULT_STACKPOINTER scp->sc_regs.r[31] # endif # elif defined __mips__ || defined __mipsn32__ || defined __mips64__ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/mips64/include/signal.h. */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_regs[29] # elif defined __powerpc__ || defined __powerpc64__ /* See the definition of 'struct sigcontext' and 'struct trapframe' in openbsd-src/sys/arch/powerpc/include/signal.h. */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_frame.fixreg[1] # elif defined __sh__ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/sh/include/signal.h and the definition of 'struct reg' in openbsd-src/sys/arch/sh/include/reg.h. */ # if OpenBSD >= 201211 /* OpenBSD version >= 5.2 */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_reg[20-15] # else # define SIGSEGV_FAULT_STACKPOINTER scp->sc_reg.r_r15 # endif # elif defined __sparc__ || defined __sparc64__ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/sparc/include/signal.h and openbsd-src/sys/arch/sparc64/include/signal.h. */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_sp # elif defined __vax__ /* See the definition of 'struct sigcontext' in openbsd-src/sys/arch/vax/include/signal.h. */ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_sp # endif #endif #if (defined __APPLE__ && defined __MACH__) /* macOS */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *ucp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT ((ucontext_t *) ucp) # define SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO # if defined __x86_64__ /* See the definitions of - 'ucontext_t' and 'struct __darwin_ucontext' in , - 'struct __darwin_mcontext64' in , and - 'struct __darwin_x86_thread_state64' in . */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext->__ss.__rsp # elif defined __i386__ /* See the definitions of - 'ucontext_t' and 'struct __darwin_ucontext' in , - 'struct __darwin_mcontext32' in , and - 'struct __darwin_i386_thread_state' in . */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext->__ss.__esp # elif defined __arm64__ /* See the definitions of - 'ucontext_t' and 'struct __darwin_ucontext' in , - 'struct __darwin_mcontext64' in , and - 'struct __darwin_arm_thread_state64' in . */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext->__ss.__sp # elif defined __powerpc__ /* See the definitions of - 'ucontext_t' and 'struct __darwin_ucontext' in , - 'struct __darwin_mcontext' in , and - 'struct __darwin_ppc_thread_state' in . */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext->__ss.__r1 # endif #endif #if defined _AIX /* AIX */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *ucp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT ((ucontext_t *) ucp) # define SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO # if defined __powerpc__ || defined __powerpc64__ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.jmp_context.gpr[1] # endif #endif #if defined __sgi /* IRIX */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp # define SIGSEGV_FAULT_ADDRESS (unsigned long) scp->sc_badvaddr # define SIGSEGV_FAULT_CONTEXT scp # if defined __mips__ || defined __mipsn32__ || defined __mips64__ # define SIGSEGV_FAULT_STACKPOINTER scp->sc_regs[29] # endif #endif #if defined __sun /* Solaris */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *ucp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT ((ucontext_t *) ucp) # define SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO # if defined __x86_64__ /* 64 bit registers */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[REG_RSP] # elif defined __i386__ /* 32 bit registers */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[ESP] # elif defined __sparc__ || defined __sparc64__ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[REG_O6] # if SOLARIS11 /* On Solaris 11.3/SPARC, both in 32-bit and 64-bit mode, when catching stack overflow, the fault address is correct the first time, but is zero or near zero the second time. 'truss tests/test-sigsegv-catch-stackoverflow1' shows it: In 32-bit mode: Incurred fault #6, FLTBOUNDS %pc = 0x000116E8 siginfo: SIGSEGV SEGV_MAPERR addr=0xFFB00000 Received signal #11, SIGSEGV [caught] siginfo: SIGSEGV SEGV_MAPERR addr=0xFFB00000 then Incurred fault #6, FLTBOUNDS %pc = 0x000116E8 siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008 Received signal #11, SIGSEGV [caught] siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008 In 64-bit mode: Incurred fault #6, FLTBOUNDS %pc = 0x100001C58 siginfo: SIGSEGV SEGV_MAPERR addr=0xFFFFFFFF7FF00000 Received signal #11, SIGSEGV [caught] siginfo: SIGSEGV SEGV_MAPERR addr=0xFFFFFFFF7FF00000 then Incurred fault #6, FLTBOUNDS %pc = 0x100001C58 siginfo: SIGSEGV SEGV_MAPERR addr=0x00000000 Received signal #11, SIGSEGV [caught] siginfo: SIGSEGV SEGV_MAPERR addr=0x00000000 */ # define BOGUS_FAULT_ADDRESS_UPON_STACK_OVERFLOW # endif # endif #endif #if defined __CYGWIN__ /* Cygwin */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *ucp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT ((ucontext_t *) ucp) # define SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO /* See the definition of 'ucontext_t' in and of 'struct __mcontext' in . */ # if defined __x86_64__ /* 64 bit registers */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.rsp # elif defined __i386__ /* 32 bit registers */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.esp # endif #endif #if defined __HAIKU__ /* Haiku */ # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *ucp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT ((ucontext_t *) ucp) # define SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO # if defined __x86_64__ /* 64 bit registers */ /* See the definition of 'ucontext_t' in and of 'struct vregs' in . */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.rsp # elif defined __i386__ /* 32 bit registers */ /* See the definition of 'ucontext_t' in and of 'struct vregs' in . */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.esp # endif #endif /* ========================================================================== */ /* List of signals that are sent when an invalid virtual memory address is accessed, or when the stack overflows. */ #if defined __GNU__ \ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \ || defined __NetBSD__ || defined __OpenBSD__ \ || (defined __APPLE__ && defined __MACH__) # define SIGSEGV_FOR_ALL_SIGNALS(var,body) \ { int var; var = SIGSEGV; { body } var = SIGBUS; { body } } #else # define SIGSEGV_FOR_ALL_SIGNALS(var,body) \ { int var; var = SIGSEGV; { body } } #endif /* ========================================================================== */ /* Determine the virtual memory area of a given address. */ #include "stackvma.h" /* ========================================================================== */ /* On the average Unix platform, we define HAVE_SIGSEGV_RECOVERY if there is a fault-*.h include file which defines SIGSEGV_FAULT_HANDLER_ARGLIST and SIGSEGV_FAULT_ADDRESS. HAVE_STACK_OVERFLOW_RECOVERY if HAVE_SIGALTSTACK is set and at least two of the following are true: A) There is a fault-*.h include file which defines SIGSEGV_FAULT_HANDLER_ARGLIST and SIGSEGV_FAULT_ADDRESS. B) There is a fault-*.h include file which defines SIGSEGV_FAULT_HANDLER_ARGLIST and SIGSEGV_FAULT_STACKPOINTER. C) There is a stackvma-*.c, other than stackvma-none.c, which defines sigsegv_get_vma. Why? Obviously, to catch stack overflow, we need an alternate signal stack; this requires kernel support. But we also need to distinguish (with a reasonable confidence) a stack overflow from a regular SIGSEGV. If we have A) and B), we use the Heuristic AB: If the fault address is near the stack pointer, it's a stack overflow. If we have A) and C), we use the Heuristic AC: If the fault address is near and beyond the bottom of the stack's virtual memory area, it's a stack overflow. If we have B) and C), we use the Heuristic BC: If the stack pointer is near the bottom of the stack's virtual memory area, it's a stack overflow. This heuristic comes in two flavours: On OSes which let the stack's VMA grow continuously, we determine the bottom by use of getrlimit(). On OSes which preallocate the stack's VMA with its maximum size (like BeOS), we use the stack's VMA directly. */ #if HAVE_SIGSEGV_RECOVERY \ && !(defined SIGSEGV_FAULT_HANDLER_ARGLIST && defined SIGSEGV_FAULT_ADDRESS) # error "You need to define SIGSEGV_FAULT_HANDLER_ARGLIST and SIGSEGV_FAULT_ADDRESS before you can define HAVE_SIGSEGV_RECOVERY." #endif #if !HAVE_SIGSEGV_RECOVERY \ && (defined SIGSEGV_FAULT_HANDLER_ARGLIST && defined SIGSEGV_FAULT_ADDRESS) \ && !(defined __FreeBSD__ && (defined __sparc__ || defined __sparc64__)) # if __GNUC__ || (__clang_major__ >= 4) # warning "You can define HAVE_SIGSEGV_RECOVERY on this platform." # else # error "You can define HAVE_SIGSEGV_RECOVERY on this platform." # endif #endif #if HAVE_STACK_OVERFLOW_RECOVERY \ && !(defined SIGSEGV_FAULT_ADDRESS + defined SIGSEGV_FAULT_STACKPOINTER + HAVE_STACKVMA >= 2) # error "You need to define two of SIGSEGV_FAULT_ADDRESS, SIGSEGV_FAULT_STACKPOINTER, HAVE_STACKVMA, before you can define HAVE_STACK_OVERFLOW_RECOVERY." #endif #if !HAVE_STACK_OVERFLOW_RECOVERY \ && (defined SIGSEGV_FAULT_ADDRESS + defined SIGSEGV_FAULT_STACKPOINTER + HAVE_STACKVMA >= 2) \ && !(defined __FreeBSD__ && (defined __sparc__ || defined __sparc64__)) \ && !(defined __NetBSD__ && (defined __sparc__ || defined __sparc64__)) # if __GNUC__ || (__clang_major__ >= 4) # warning "You can define HAVE_STACK_OVERFLOW_RECOVERY on this platform." # else # error "You can define HAVE_STACK_OVERFLOW_RECOVERY on this platform." # endif #endif /* ========================================================================== */ #if HAVE_STACK_OVERFLOW_RECOVERY /* ======= Leaving a signal handler executing on the alternate stack ======= */ /* Platform dependent: Leaving a signal handler executing on the alternate stack. */ static void sigsegv_reset_onstack_flag (void); /* -------------------------- leave-sigaltstack.c -------------------------- */ # if defined __GNU__ \ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \ || defined __NetBSD__ || defined __OpenBSD__ static void sigsegv_reset_onstack_flag (void) { stack_t ss; if (sigaltstack (NULL, &ss) >= 0) { ss.ss_flags &= ~SS_ONSTACK; sigaltstack (&ss, NULL); } } /* --------------------------- leave-setcontext.c --------------------------- */ # elif defined __sgi || defined __sun /* IRIX, Solaris */ # include static void sigsegv_reset_onstack_flag (void) { ucontext_t uc; if (getcontext (&uc) >= 0) /* getcontext returns twice. We are interested in the returned context only the first time, i.e. when the SS_ONSTACK bit is set. */ if (uc.uc_stack.ss_flags & SS_ONSTACK) { uc.uc_stack.ss_flags &= ~SS_ONSTACK; /* Note that setcontext() does not refill uc. Therefore if setcontext() keeps SS_ONSTACK set in the kernel, either setcontext() will return -1 or getcontext() will return a second time, with the SS_ONSTACK bit being cleared. */ setcontext (&uc); } } /* ------------------------------ leave-nop.c ------------------------------ */ # else static void sigsegv_reset_onstack_flag (void) { /* Nothing to do. sigaltstack() simply looks at the stack pointer, therefore SS_ONSTACK is not sticky. */ } # endif /* ========================================================================== */ # if HAVE_STACKVMA /* Address of the last byte belonging to the stack vma. */ static uintptr_t stack_top = 0; /* Needs to be called once only. */ static void remember_stack_top (void *some_variable_on_stack) { struct vma_struct vma; if (sigsegv_get_vma ((uintptr_t) some_variable_on_stack, &vma) >= 0) stack_top = vma.end - 1; } # endif /* HAVE_STACKVMA */ static stackoverflow_handler_t stk_user_handler = (stackoverflow_handler_t)NULL; static uintptr_t stk_extra_stack; static size_t stk_extra_stack_size; #endif /* HAVE_STACK_OVERFLOW_RECOVERY */ #if HAVE_SIGSEGV_RECOVERY /* User's SIGSEGV handler. */ static sigsegv_handler_t user_handler = (sigsegv_handler_t)NULL; #endif /* HAVE_SIGSEGV_RECOVERY */ /* Our SIGSEGV handler, with OS dependent argument list. */ #if HAVE_SIGSEGV_RECOVERY static void sigsegv_handler (SIGSEGV_FAULT_HANDLER_ARGLIST) { void *address = (void *) (SIGSEGV_FAULT_ADDRESS); # if HAVE_STACK_OVERFLOW_RECOVERY # if !(HAVE_STACKVMA || defined SIGSEGV_FAULT_STACKPOINTER) #error "Insufficient heuristics for detecting a stack overflow. Either define CFG_STACKVMA and HAVE_STACKVMA correctly, or define SIGSEGV_FAULT_STACKPOINTER correctly, or undefine HAVE_STACK_OVERFLOW_RECOVERY!" # endif /* Call user's handler. */ if (user_handler && (*user_handler) (address, 0)) { /* Handler successful. */ } else { /* Handler declined responsibility. */ /* Did the user install a stack overflow handler? */ if (stk_user_handler) { /* See whether it was a stack overflow. If so, longjump away. */ # ifdef SIGSEGV_FAULT_STACKPOINTER uintptr_t old_sp = (uintptr_t) (SIGSEGV_FAULT_STACKPOINTER); # ifdef __ia64 uintptr_t old_bsp = (uintptr_t) (SIGSEGV_FAULT_BSP_POINTER); # endif # endif # if HAVE_STACKVMA /* Were we able to determine the stack top? */ if (stack_top) { /* Determine stack bounds. */ int saved_errno; struct vma_struct vma; int ret; saved_errno = errno; ret = sigsegv_get_vma (stack_top, &vma); errno = saved_errno; if (ret >= 0) { # ifndef BOGUS_FAULT_ADDRESS_UPON_STACK_OVERFLOW /* Heuristic AC: If the fault_address is nearer to the stack segment's [start,end] than to the previous segment, we consider it a stack overflow. In the case of IA-64, we know that the previous segment is the up-growing bsp segment, and either of the two stacks can overflow. */ uintptr_t addr = (uintptr_t) address; # ifdef __ia64 if (addr >= vma.prev_end && addr <= vma.end - 1) # else # if STACK_DIRECTION < 0 if (addr >= vma.start ? (addr <= vma.end - 1) : vma.is_near_this (addr, &vma)) # else if (addr <= vma.end - 1 ? (addr >= vma.start) : vma.is_near_this (addr, &vma)) # endif # endif { # else /* BOGUS_FAULT_ADDRESS_UPON_STACK_OVERFLOW */ # if HAVE_GETRLIMIT && defined RLIMIT_STACK /* Heuristic BC: If the stack size has reached its maximal size, and old_sp is near the low end, we consider it a stack overflow. */ struct rlimit rl; saved_errno = errno; ret = getrlimit (RLIMIT_STACK, &rl); errno = saved_errno; if (ret >= 0) { uintptr_t current_stack_size = vma.end - vma.start; uintptr_t max_stack_size = rl.rlim_cur; if (current_stack_size <= max_stack_size + 4096 && max_stack_size <= current_stack_size + 4096 # else { if (1 # endif # ifdef SIGSEGV_FAULT_STACKPOINTER /* Heuristic BC: If we know old_sp, and it is neither near the low end, nor in the alternate stack, then it's probably not a stack overflow. */ && ((old_sp >= stk_extra_stack && old_sp <= stk_extra_stack + stk_extra_stack_size) # if STACK_DIRECTION < 0 || (old_sp <= vma.start + 4096 && vma.start <= old_sp + 4096)) # else || (old_sp <= vma.end + 4096 && vma.end <= old_sp + 4096)) # endif # endif ) # endif /* BOGUS_FAULT_ADDRESS_UPON_STACK_OVERFLOW */ # else /* !HAVE_STACKVMA */ /* Heuristic AB: If the fault address is near the stack pointer, it's a stack overflow. */ uintptr_t addr = (uintptr_t) address; if ((addr <= old_sp + 4096 && old_sp <= addr + 4096) # ifdef __ia64 || (addr <= old_bsp + 4096 && old_bsp <= addr + 4096) # endif ) { { { # endif /* !HAVE_STACKVMA */ { # ifdef SIGSEGV_FAULT_STACKPOINTER int emergency = (old_sp >= stk_extra_stack && old_sp <= stk_extra_stack + stk_extra_stack_size); stackoverflow_context_t context = (SIGSEGV_FAULT_CONTEXT); # else int emergency = 0; stackoverflow_context_t context = (void *) 0; # endif /* Call user's handler. */ (*stk_user_handler) (emergency, context); } } } } } # endif /* HAVE_STACK_OVERFLOW_RECOVERY */ if (user_handler && (*user_handler) (address, 1)) { /* Handler successful. */ } else { /* Handler declined responsibility for real. */ /* Remove ourselves and dump core. */ SIGSEGV_FOR_ALL_SIGNALS (signo, signal (signo, SIG_DFL);) } # if HAVE_STACK_OVERFLOW_RECOVERY } # endif /* HAVE_STACK_OVERFLOW_RECOVERY */ } #elif HAVE_STACK_OVERFLOW_RECOVERY static void # ifdef SIGSEGV_FAULT_STACKPOINTER sigsegv_handler (SIGSEGV_FAULT_HANDLER_ARGLIST) # else sigsegv_handler (int sig) # endif { # if !((HAVE_GETRLIMIT && defined RLIMIT_STACK) || defined SIGSEGV_FAULT_STACKPOINTER) # error "Insufficient heuristics for detecting a stack overflow. Either define SIGSEGV_FAULT_STACKPOINTER correctly, or undefine HAVE_STACK_OVERFLOW_RECOVERY!" # endif /* Did the user install a handler? */ if (stk_user_handler) { /* See whether it was a stack overflow. If so, longjump away. */ # ifdef SIGSEGV_FAULT_STACKPOINTER uintptr_t old_sp = (uintptr_t) (SIGSEGV_FAULT_STACKPOINTER); # endif /* Were we able to determine the stack top? */ if (stack_top) { /* Determine stack bounds. */ int saved_errno; struct vma_struct vma; int ret; saved_errno = errno; ret = sigsegv_get_vma (stack_top, &vma); errno = saved_errno; if (ret >= 0) { # if HAVE_GETRLIMIT && defined RLIMIT_STACK /* Heuristic BC: If the stack size has reached its maximal size, and old_sp is near the low end, we consider it a stack overflow. */ struct rlimit rl; saved_errno = errno; ret = getrlimit (RLIMIT_STACK, &rl); errno = saved_errno; if (ret >= 0) { uintptr_t current_stack_size = vma.end - vma.start; uintptr_t max_stack_size = rl.rlim_cur; if (current_stack_size <= max_stack_size + 4096 && max_stack_size <= current_stack_size + 4096 # else { if (1 # endif # ifdef SIGSEGV_FAULT_STACKPOINTER /* Heuristic BC: If we know old_sp, and it is neither near the low end, nor in the alternate stack, then it's probably not a stack overflow. */ && ((old_sp >= stk_extra_stack && old_sp <= stk_extra_stack + stk_extra_stack_size) # if STACK_DIRECTION < 0 || (old_sp <= vma.start + 4096 && vma.start <= old_sp + 4096)) # else || (old_sp <= vma.end + 4096 && vma.end <= old_sp + 4096)) # endif # endif ) { # ifdef SIGSEGV_FAULT_STACKPOINTER int emergency = (old_sp >= stk_extra_stack && old_sp <= stk_extra_stack + stk_extra_stack_size); stackoverflow_context_t context = (SIGSEGV_FAULT_CONTEXT); # else int emergency = 0; stackoverflow_context_t context = (void *) 0; # endif /* Call user's handler. */ (*stk_user_handler)(emergency,context); } } } } } /* Remove ourselves and dump core. */ SIGSEGV_FOR_ALL_SIGNALS (signo, signal (signo, SIG_DFL);) } #endif #if HAVE_SIGSEGV_RECOVERY || HAVE_STACK_OVERFLOW_RECOVERY static void install_for (int sig) { struct sigaction action; # ifdef SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO action.sa_sigaction = &sigsegv_handler; # else action.sa_handler = (void (*) (int)) &sigsegv_handler; # endif /* Block most signals while SIGSEGV is being handled. */ /* Signals SIGKILL, SIGSTOP cannot be blocked. */ /* Signals SIGCONT, SIGTSTP, SIGTTIN, SIGTTOU are not blocked because dealing with these signals seems dangerous. */ /* Signals SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGTRAP, SIGIOT, SIGEMT, SIGBUS, SIGSYS, SIGSTKFLT are not blocked because these are synchronous signals, which may require immediate intervention, otherwise the process may starve. */ sigemptyset (&action.sa_mask); # ifdef SIGHUP sigaddset (&action.sa_mask,SIGHUP); # endif # ifdef SIGINT sigaddset (&action.sa_mask,SIGINT); # endif # ifdef SIGQUIT sigaddset (&action.sa_mask,SIGQUIT); # endif # ifdef SIGPIPE sigaddset (&action.sa_mask,SIGPIPE); # endif # ifdef SIGALRM sigaddset (&action.sa_mask,SIGALRM); # endif # ifdef SIGTERM sigaddset (&action.sa_mask,SIGTERM); # endif # ifdef SIGUSR1 sigaddset (&action.sa_mask,SIGUSR1); # endif # ifdef SIGUSR2 sigaddset (&action.sa_mask,SIGUSR2); # endif # ifdef SIGCHLD sigaddset (&action.sa_mask,SIGCHLD); # endif # ifdef SIGCLD sigaddset (&action.sa_mask,SIGCLD); # endif # ifdef SIGURG sigaddset (&action.sa_mask,SIGURG); # endif # ifdef SIGIO sigaddset (&action.sa_mask,SIGIO); # endif # ifdef SIGPOLL sigaddset (&action.sa_mask,SIGPOLL); # endif # ifdef SIGXCPU sigaddset (&action.sa_mask,SIGXCPU); # endif # ifdef SIGXFSZ sigaddset (&action.sa_mask,SIGXFSZ); # endif # ifdef SIGVTALRM sigaddset (&action.sa_mask,SIGVTALRM); # endif # ifdef SIGPROF sigaddset (&action.sa_mask,SIGPROF); # endif # ifdef SIGPWR sigaddset (&action.sa_mask,SIGPWR); # endif # ifdef SIGLOST sigaddset (&action.sa_mask,SIGLOST); # endif # ifdef SIGWINCH sigaddset (&action.sa_mask,SIGWINCH); # endif /* Note that sigaction() implicitly adds sig itself to action.sa_mask. */ /* Ask the OS to provide a structure siginfo_t to the handler. */ # ifdef SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO action.sa_flags = SA_SIGINFO; # else action.sa_flags = 0; # endif # if HAVE_STACK_OVERFLOW_RECOVERY && HAVE_SIGALTSTACK /* not BeOS */ /* Work around Linux 2.2.5 bug: If SA_ONSTACK is specified but sigaltstack() has not been called, the kernel will busy loop, eating CPU time. So avoid setting SA_ONSTACK until the user has requested stack overflow handling. */ if (stk_user_handler) action.sa_flags |= SA_ONSTACK; # endif sigaction (sig, &action, (struct sigaction *) NULL); } #endif /* HAVE_SIGSEGV_RECOVERY || HAVE_STACK_OVERFLOW_RECOVERY */ int sigsegv_install_handler (sigsegv_handler_t handler) { #if HAVE_SIGSEGV_RECOVERY user_handler = handler; SIGSEGV_FOR_ALL_SIGNALS (sig, install_for (sig);) return 0; #else return -1; #endif } void sigsegv_deinstall_handler (void) { #if HAVE_SIGSEGV_RECOVERY user_handler = (sigsegv_handler_t)NULL; # if HAVE_STACK_OVERFLOW_RECOVERY if (!stk_user_handler) # endif { SIGSEGV_FOR_ALL_SIGNALS (sig, signal (sig, SIG_DFL);) } #endif } int sigsegv_leave_handler (void (*continuation) (void*, void*, void*), void* cont_arg1, void* cont_arg2, void* cont_arg3) { #if HAVE_STACK_OVERFLOW_RECOVERY /* * Reset the system's knowledge that we are executing on the alternate * stack. If we didn't do that, siglongjmp would be needed instead of * longjmp to leave the signal handler. */ sigsegv_reset_onstack_flag (); #endif (*continuation) (cont_arg1, cont_arg2, cont_arg3); return 1; } int stackoverflow_install_handler (stackoverflow_handler_t handler, void *extra_stack, size_t extra_stack_size) { #if HAVE_STACK_OVERFLOW_RECOVERY # if HAVE_STACKVMA if (!stack_top) { int dummy; remember_stack_top (&dummy); if (!stack_top) return -1; } # endif stk_user_handler = handler; stk_extra_stack = (uintptr_t) extra_stack; stk_extra_stack_size = extra_stack_size; { stack_t ss; # if SIGALTSTACK_SS_REVERSED ss.ss_sp = (char *) extra_stack + extra_stack_size - sizeof (void *); ss.ss_size = extra_stack_size - sizeof (void *); # else ss.ss_sp = extra_stack; ss.ss_size = extra_stack_size; # endif ss.ss_flags = 0; /* no SS_DISABLE */ if (sigaltstack (&ss, (stack_t*)0) < 0) return -1; } /* Install the signal handlers with SA_ONSTACK. */ SIGSEGV_FOR_ALL_SIGNALS (sig, install_for (sig);) return 0; #else return -1; #endif } void stackoverflow_deinstall_handler (void) { #if HAVE_STACK_OVERFLOW_RECOVERY stk_user_handler = (stackoverflow_handler_t) NULL; # if HAVE_SIGSEGV_RECOVERY if (user_handler) { /* Reinstall the signal handlers without SA_ONSTACK, to avoid Linux bug. */ SIGSEGV_FOR_ALL_SIGNALS (sig, install_for (sig);) } else # endif { SIGSEGV_FOR_ALL_SIGNALS (sig, signal (sig, SIG_DFL);) } { stack_t ss; ss.ss_flags = SS_DISABLE; if (sigaltstack (&ss, (stack_t *) 0) < 0) perror ("gnulib sigsegv (stackoverflow_deinstall_handler)"); } #endif } kbuild-3608/src/grep/lib/argmatch.c0000664000175000017500000001726014670377422017154 0ustar locutuslocutus/* argmatch.c -- find a match for a string in an array Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2021 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 . */ /* Written by David MacKenzie Modified by Akim Demaille */ #include /* Specification. */ #include "argmatch.h" #include #include #include #include #define _(msgid) gettext (msgid) #include "error.h" #include "quotearg.h" #include "getprogname.h" #if USE_UNLOCKED_IO # include "unlocked-io.h" #endif /* When reporting an invalid argument, show nonprinting characters by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use literal_quoting_style. */ #ifndef ARGMATCH_QUOTING_STYLE # define ARGMATCH_QUOTING_STYLE locale_quoting_style #endif /* Non failing version of argmatch call this function after failing. */ #ifndef ARGMATCH_DIE # include "exitfail.h" # define ARGMATCH_DIE exit (exit_failure) #endif #ifdef ARGMATCH_DIE_DECL ARGMATCH_DIE_DECL; #endif static void __argmatch_die (void) { ARGMATCH_DIE; } /* Used by XARGMATCH and XARGCASEMATCH. See description in argmatch.h. Default to __argmatch_die, but allow caller to change this at run-time. */ argmatch_exit_fn argmatch_die = __argmatch_die; /* If ARG is an unambiguous match for an element of the NULL-terminated array ARGLIST, return the index in ARGLIST of the matched element, else -1 if it does not match any element or -2 if it is ambiguous (is a prefix of more than one element). If VALLIST is none null, use it to resolve ambiguities limited to synonyms, i.e., for "yes", "yop" -> 0 "no", "nope" -> 1 "y" is a valid argument, for 0, and "n" for 1. */ ptrdiff_t argmatch (const char *arg, const char *const *arglist, const void *vallist, size_t valsize) { size_t i; /* Temporary index in ARGLIST. */ size_t arglen; /* Length of ARG. */ ptrdiff_t matchind = -1; /* Index of first nonexact match. */ bool ambiguous = false; /* If true, multiple nonexact match(es). */ arglen = strlen (arg); /* Test all elements for either exact match or abbreviated matches. */ for (i = 0; arglist[i]; i++) { if (!strncmp (arglist[i], arg, arglen)) { if (strlen (arglist[i]) == arglen) /* Exact match found. */ return i; else if (matchind == -1) /* First nonexact match found. */ matchind = i; else { /* Second nonexact match found. */ if (vallist == NULL || memcmp ((char const *) vallist + valsize * matchind, (char const *) vallist + valsize * i, valsize)) { /* There is a real ambiguity, or we could not disambiguate. */ ambiguous = true; } } } } if (ambiguous) return -2; else return matchind; } /* Error reporting for argmatch. CONTEXT is a description of the type of entity that was being matched. VALUE is the invalid value that was given. PROBLEM is the return value from argmatch. */ void argmatch_invalid (const char *context, const char *value, ptrdiff_t problem) { char const *format = (problem == -1 ? _("invalid argument %s for %s") : _("ambiguous argument %s for %s")); error (0, 0, format, quotearg_n_style (0, ARGMATCH_QUOTING_STYLE, value), quote_n (1, context)); } /* List the valid arguments for argmatch. ARGLIST is the same as in argmatch. VALLIST is a pointer to an array of values. VALSIZE is the size of the elements of VALLIST */ void argmatch_valid (const char *const *arglist, const void *vallist, size_t valsize) { size_t i; const char *last_val = NULL; /* We try to put synonyms on the same line. The assumption is that synonyms follow each other */ fputs (_("Valid arguments are:"), stderr); for (i = 0; arglist[i]; i++) if ((i == 0) || memcmp (last_val, (char const *) vallist + valsize * i, valsize)) { fprintf (stderr, "\n - %s", quote (arglist[i])); last_val = (char const *) vallist + valsize * i; } else { fprintf (stderr, ", %s", quote (arglist[i])); } putc ('\n', stderr); } /* Never failing versions of the previous functions. CONTEXT is the context for which argmatch is called (e.g., "--version-control", or "$VERSION_CONTROL" etc.). Upon failure, calls the (supposed never to return) function EXIT_FN. */ ptrdiff_t __xargmatch_internal (const char *context, const char *arg, const char *const *arglist, const void *vallist, size_t valsize, argmatch_exit_fn exit_fn) { ptrdiff_t res = argmatch (arg, arglist, vallist, valsize); if (res >= 0) /* Success. */ return res; /* We failed. Explain why. */ argmatch_invalid (context, arg, res); argmatch_valid (arglist, vallist, valsize); (*exit_fn) (); return -1; /* To please the compilers. */ } /* Look for VALUE in VALLIST, an array of objects of size VALSIZE and return the first corresponding argument in ARGLIST */ const char * argmatch_to_argument (const void *value, const char *const *arglist, const void *vallist, size_t valsize) { size_t i; for (i = 0; arglist[i]; i++) if (!memcmp (value, (char const *) vallist + valsize * i, valsize)) return arglist[i]; return NULL; } #ifdef TEST /* * Based on "getversion.c" by David MacKenzie */ /* When to make backup files. */ enum backup_type { /* Never make backups. */ no_backups, /* Make simple backups of every file. */ simple_backups, /* Make numbered backups of files that already have numbered backups, and simple backups of the others. */ numbered_existing_backups, /* Make numbered backups of every file. */ numbered_backups }; /* Two tables describing arguments (keys) and their corresponding values */ static const char *const backup_args[] = { "no", "none", "off", "simple", "never", "existing", "nil", "numbered", "t", 0 }; static const enum backup_type backup_vals[] = { no_backups, no_backups, no_backups, simple_backups, simple_backups, numbered_existing_backups, numbered_existing_backups, numbered_backups, numbered_backups }; int main (int argc, const char *const *argv) { const char *cp; enum backup_type backup_type = no_backups; if (argc > 2) { fprintf (stderr, "Usage: %s [VERSION_CONTROL]\n", getprogname ()); exit (1); } if ((cp = getenv ("VERSION_CONTROL"))) backup_type = XARGMATCH ("$VERSION_CONTROL", cp, backup_args, backup_vals); if (argc == 2) backup_type = XARGMATCH (getprogname (), argv[1], backup_args, backup_vals); printf ("The version control is '%s'\n", ARGMATCH_TO_ARGUMENT (&backup_type, backup_args, backup_vals)); return 0; } #endif kbuild-3608/src/grep/lib/fd-hook.h0000664000175000017500000001136414670377423016722 0ustar locutuslocutus/* Hook for making file descriptor functions close(), ioctl() extensible. Copyright (C) 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef FD_HOOK_H #define FD_HOOK_H #ifdef __cplusplus extern "C" { #endif /* Currently, this entire code is only needed for the handling of sockets on native Windows platforms. */ #if WINDOWS_SOCKETS /* Type of function that closes FD. */ typedef int (*gl_close_fn) (int fd); /* Type of function that applies a control request to FD. */ typedef int (*gl_ioctl_fn) (int fd, int request, void *arg); /* An element of the list of file descriptor hooks. In CLOS (Common Lisp Object System) speak, it consists of an "around" method for the close() function and an "around" method for the ioctl() function. The fields of this structure are considered private. */ struct fd_hook { /* Doubly linked list. */ struct fd_hook *private_next; struct fd_hook *private_prev; /* Function that treats the types of FD that it knows about and calls execute_close_hooks (REMAINING_LIST, PRIMARY, FD) as a fallback. */ int (*private_close_fn) (const struct fd_hook *remaining_list, gl_close_fn primary, int fd); /* Function that treats the types of FD that it knows about and calls execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) as a fallback. */ int (*private_ioctl_fn) (const struct fd_hook *remaining_list, gl_ioctl_fn primary, int fd, int request, void *arg); }; /* This type of function closes FD, applying special knowledge for the FD types it knows about, and calls execute_close_hooks (REMAINING_LIST, PRIMARY, FD) for the other FD types. In CLOS speak, REMAINING_LIST is the remaining list of "around" methods, and PRIMARY is the "primary" method for close(). */ typedef int (*close_hook_fn) (const struct fd_hook *remaining_list, gl_close_fn primary, int fd); /* Execute the close hooks in REMAINING_LIST, with PRIMARY as "primary" method. Return 0 or -1, like close() would do. */ extern int execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary, int fd); /* Execute all close hooks, with PRIMARY as "primary" method. Return 0 or -1, like close() would do. */ extern int execute_all_close_hooks (gl_close_fn primary, int fd); /* This type of function applies a control request to FD, applying special knowledge for the FD types it knows about, and calls execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) for the other FD types. In CLOS speak, REMAINING_LIST is the remaining list of "around" methods, and PRIMARY is the "primary" method for ioctl(). */ typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list, gl_ioctl_fn primary, int fd, int request, void *arg); /* Execute the ioctl hooks in REMAINING_LIST, with PRIMARY as "primary" method. Return 0 or -1, like ioctl() would do. */ extern int execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary, int fd, int request, void *arg); /* Execute all ioctl hooks, with PRIMARY as "primary" method. Return 0 or -1, like ioctl() would do. */ extern int execute_all_ioctl_hooks (gl_ioctl_fn primary, int fd, int request, void *arg); /* Add a function pair to the list of file descriptor hooks. CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change. The LINK variable points to a piece of memory which is guaranteed to be accessible until the corresponding call to unregister_fd_hook. */ extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link); /* Removes a hook from the list of file descriptor hooks. */ extern void unregister_fd_hook (struct fd_hook *link); #endif #ifdef __cplusplus } #endif #endif /* FD_HOOK_H */ kbuild-3608/src/grep/lib/regex.h0000664000175000017500000006044514670377426016514 0ustar locutuslocutus/* Definitions for data structures and routines for the regular expression library. Copyright (C) 1985, 1989-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _REGEX_H #define _REGEX_H 1 #include /* Allow the use in C++ code. */ #ifdef __cplusplus extern "C" { #endif /* Define __USE_GNU to declare GNU extensions that violate the POSIX name space rules. */ #ifdef _GNU_SOURCE # define __USE_GNU 1 #endif #ifdef _REGEX_LARGE_OFFSETS /* Use types and values that are wide enough to represent signed and unsigned byte offsets in memory. This currently works only when the regex code is used outside of the GNU C library; it is not yet supported within glibc itself, and glibc users should not define _REGEX_LARGE_OFFSETS. */ /* The type of object sizes. */ typedef size_t __re_size_t; /* The type of object sizes, in places where the traditional code uses unsigned long int. */ typedef size_t __re_long_size_t; #else /* The traditional GNU regex implementation mishandles strings longer than INT_MAX. */ typedef unsigned int __re_size_t; typedef unsigned long int __re_long_size_t; #endif /* The following two types have to be signed and unsigned integer type wide enough to hold a value of a pointer. For most ANSI compilers ptrdiff_t and size_t should be likely OK. Still size of these two types is 2 for Microsoft C. Ugh... */ typedef long int s_reg_t; typedef unsigned long int active_reg_t; /* The following bits are used to determine the regexp syntax we recognize. The set/not-set meanings are chosen so that Emacs syntax remains the value 0. The bits are given in alphabetical order, and the definitions shifted by one from the previous bit; thus, when we add or remove a bit, only one other definition need change. */ typedef unsigned long int reg_syntax_t; #ifdef __USE_GNU /* If this bit is not set, then \ inside a bracket expression is literal. If set, then such a \ quotes the following character. */ # define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) /* If this bit is not set, then + and ? are operators, and \+ and \? are literals. If set, then \+ and \? are operators and + and ? are literals. */ # define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) /* If this bit is set, then character classes are supported. They are: [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:], [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:]. If not set, then character classes are not supported. */ # define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1) /* If this bit is set, then ^ and $ are always anchors (outside bracket expressions, of course). If this bit is not set, then it depends: ^ is an anchor if it is at the beginning of a regular expression or after an open-group or an alternation operator; $ is an anchor if it is at the end of a regular expression, or before a close-group or an alternation operator. This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because POSIX draft 11.2 says that * etc. in leading positions is undefined. We already implemented a previous draft which made those constructs invalid, though, so we haven't changed the code back. */ # define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1) /* If this bit is set, then special characters are always special regardless of where they are in the pattern. If this bit is not set, then special characters are special only in some contexts; otherwise they are ordinary. Specifically, * + ? and intervals are only special when not after the beginning, open-group, or alternation operator. */ # define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) /* If this bit is set, then *, +, ?, and { cannot be first in an re or immediately after an alternation or begin-group operator. */ # define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1) /* If this bit is set, then . matches newline. If not set, then it doesn't. */ # define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1) /* If this bit is set, then . doesn't match NUL. If not set, then it does. */ # define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1) /* If this bit is set, nonmatching lists [^...] do not match newline. If not set, they do. */ # define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) /* If this bit is set, either \{...\} or {...} defines an interval, depending on RE_NO_BK_BRACES. If not set, \{, \}, {, and } are literals. */ # define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) /* If this bit is set, +, ? and | aren't recognized as operators. If not set, they are. */ # define RE_LIMITED_OPS (RE_INTERVALS << 1) /* If this bit is set, newline is an alternation operator. If not set, newline is literal. */ # define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1) /* If this bit is set, then '{...}' defines an interval, and \{ and \} are literals. If not set, then '\{...\}' defines an interval. */ # define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1) /* If this bit is set, (...) defines a group, and \( and \) are literals. If not set, \(...\) defines a group, and ( and ) are literals. */ # define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1) /* If this bit is set, then \ matches . If not set, then \ is a back-reference. */ # define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) /* If this bit is set, then | is an alternation operator, and \| is literal. If not set, then \| is an alternation operator, and | is literal. */ # define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) /* If this bit is set, then an ending range point collating higher than the starting range point, as in [z-a], is invalid. If not set, then when ending range point collates higher than the starting range point, the range is ignored. */ # define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) /* If this bit is set, then an unmatched ) is ordinary. If not set, then an unmatched ) is invalid. */ # define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) /* If this bit is set, succeed as soon as we match the whole pattern, without further backtracking. */ # define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1) /* If this bit is set, do not process the GNU regex operators. If not set, then the GNU regex operators are recognized. */ # define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1) /* If this bit is set, turn on internal regex debugging. If not set, and debugging was on, turn it off. This only works if regex.c is compiled -DDEBUG. We define this bit always, so that all that's needed to turn on debugging is to recompile regex.c; the calling code can always have this bit set, and it won't affect anything in the normal case. */ # define RE_DEBUG (RE_NO_GNU_OPS << 1) /* If this bit is set, a syntactically invalid interval is treated as a string of ordinary characters. For example, the ERE 'a{1' is treated as 'a\{1'. */ # define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1) /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ # define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1) /* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only for ^, because it is difficult to scan the regex backwards to find whether ^ should be special. */ # define RE_CARET_ANCHORS_HERE (RE_ICASE << 1) /* If this bit is set, then \{ cannot be first in a regex or immediately after an alternation, open-group or \} operator. */ # define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1) /* If this bit is set, then no_sub will be set to 1 during re_compile_pattern. */ # define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1) #endif /* This global variable defines the particular regexp syntax to use (for some interfaces). When a regexp is compiled, the syntax used is stored in the pattern buffer, so changing this does not affect already-compiled regexps. */ extern reg_syntax_t re_syntax_options; #ifdef __USE_GNU /* Define combinations of the above bits for the standard possibilities. (The [[[ comments delimit what gets put into the Texinfo file, so don't delete them!) */ /* [[[begin syntaxes]]] */ # define RE_SYNTAX_EMACS 0 # define RE_SYNTAX_AWK \ (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ | RE_NO_BK_PARENS | RE_NO_BK_REFS \ | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ | RE_CHAR_CLASSES \ | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS) # define RE_SYNTAX_GNU_AWK \ ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ | RE_INVALID_INTERVAL_ORD) \ & ~(RE_DOT_NOT_NULL | RE_CONTEXT_INDEP_OPS \ | RE_CONTEXT_INVALID_OPS )) # define RE_SYNTAX_POSIX_AWK \ (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ | RE_INTERVALS | RE_NO_GNU_OPS \ | RE_INVALID_INTERVAL_ORD) # define RE_SYNTAX_GREP \ ((RE_SYNTAX_POSIX_BASIC | RE_NEWLINE_ALT) \ & ~(RE_CONTEXT_INVALID_DUP | RE_DOT_NOT_NULL)) # define RE_SYNTAX_EGREP \ ((RE_SYNTAX_POSIX_EXTENDED | RE_INVALID_INTERVAL_ORD | RE_NEWLINE_ALT) \ & ~(RE_CONTEXT_INVALID_OPS | RE_DOT_NOT_NULL)) /* POSIX grep -E behavior is no longer incompatible with GNU. */ # define RE_SYNTAX_POSIX_EGREP \ RE_SYNTAX_EGREP /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ # define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC # define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC /* Syntax bits common to both basic and extended POSIX regex syntax. */ # define _RE_SYNTAX_POSIX_COMMON \ (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ | RE_INTERVALS | RE_NO_EMPTY_RANGES) # define RE_SYNTAX_POSIX_BASIC \ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP) /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this isn't minimal, since other operators, such as \`, aren't disabled. */ # define RE_SYNTAX_POSIX_MINIMAL_BASIC \ (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS) # define RE_SYNTAX_POSIX_EXTENDED \ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD) /* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is removed and RE_NO_BK_REFS is added. */ # define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ | RE_NO_BK_PARENS | RE_NO_BK_REFS \ | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) /* [[[end syntaxes]]] */ /* Maximum number of duplicates an interval can allow. POSIX-conforming systems might define this in , but we want our value, so remove any previous define. */ # ifdef _REGEX_INCLUDE_LIMITS_H # include # endif # ifdef RE_DUP_MAX # undef RE_DUP_MAX # endif /* RE_DUP_MAX is 2**15 - 1 because an earlier implementation stored the counter as a 2-byte signed integer. This is no longer true, so RE_DUP_MAX could be increased to (INT_MAX / 10 - 1), or to ((SIZE_MAX - 9) / 10) if _REGEX_LARGE_OFFSETS is defined. However, there would be a huge performance problem if someone actually used a pattern like a\{214748363\}, so RE_DUP_MAX retains its historical value. */ # define RE_DUP_MAX (0x7fff) #endif /* POSIX 'cflags' bits (i.e., information for 'regcomp'). */ /* If this bit is set, then use extended regular expression syntax. If not set, then use basic regular expression syntax. */ #define REG_EXTENDED 1 /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ #define REG_ICASE (1 << 1) /* If this bit is set, then anchors do not match at newline characters in the string. If not set, then anchors do match at newlines. */ #define REG_NEWLINE (1 << 2) /* If this bit is set, then report only success or fail in regexec. If not set, then returns differ between not matching and errors. */ #define REG_NOSUB (1 << 3) /* POSIX 'eflags' bits (i.e., information for regexec). */ /* If this bit is set, then the beginning-of-line operator doesn't match the beginning of the string (presumably because it's not the beginning of a line). If not set, then the beginning-of-line operator does match the beginning of the string. */ #define REG_NOTBOL 1 /* Like REG_NOTBOL, except for the end-of-line. */ #define REG_NOTEOL (1 << 1) /* Use PMATCH[0] to delimit the start and end of the search in the buffer. */ #define REG_STARTEND (1 << 2) /* If any error codes are removed, changed, or added, update the '__re_error_msgid' table in regcomp.c. */ typedef enum { _REG_ENOSYS = -1, /* This will never happen for this implementation. */ _REG_NOERROR = 0, /* Success. */ _REG_NOMATCH, /* Didn't find a match (for regexec). */ /* POSIX regcomp return error codes. (In the order listed in the standard.) */ _REG_BADPAT, /* Invalid pattern. */ _REG_ECOLLATE, /* Invalid collating element. */ _REG_ECTYPE, /* Invalid character class name. */ _REG_EESCAPE, /* Trailing backslash. */ _REG_ESUBREG, /* Invalid back reference. */ _REG_EBRACK, /* Unmatched left bracket. */ _REG_EPAREN, /* Parenthesis imbalance. */ _REG_EBRACE, /* Unmatched \{. */ _REG_BADBR, /* Invalid contents of \{\}. */ _REG_ERANGE, /* Invalid range end. */ _REG_ESPACE, /* Ran out of memory. */ _REG_BADRPT, /* No preceding re for repetition op. */ /* Error codes we've added. */ _REG_EEND, /* Premature end. */ _REG_ESIZE, /* Too large (e.g., repeat count too large). */ _REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ } reg_errcode_t; #if defined _XOPEN_SOURCE || defined __USE_XOPEN2K # define REG_ENOSYS _REG_ENOSYS #endif #define REG_NOERROR _REG_NOERROR #define REG_NOMATCH _REG_NOMATCH #define REG_BADPAT _REG_BADPAT #define REG_ECOLLATE _REG_ECOLLATE #define REG_ECTYPE _REG_ECTYPE #define REG_EESCAPE _REG_EESCAPE #define REG_ESUBREG _REG_ESUBREG #define REG_EBRACK _REG_EBRACK #define REG_EPAREN _REG_EPAREN #define REG_EBRACE _REG_EBRACE #define REG_BADBR _REG_BADBR #define REG_ERANGE _REG_ERANGE #define REG_ESPACE _REG_ESPACE #define REG_BADRPT _REG_BADRPT #define REG_EEND _REG_EEND #define REG_ESIZE _REG_ESIZE #define REG_ERPAREN _REG_ERPAREN /* This data structure represents a compiled pattern. Before calling the pattern compiler, the fields 'buffer', 'allocated', 'fastmap', and 'translate' can be set. After the pattern has been compiled, the fields 're_nsub', 'not_bol' and 'not_eol' are available. All other fields are private to the regex routines. */ #ifndef RE_TRANSLATE_TYPE # define __RE_TRANSLATE_TYPE unsigned char * # ifdef __USE_GNU # define RE_TRANSLATE_TYPE __RE_TRANSLATE_TYPE # endif #endif #ifdef __USE_GNU # define __REPB_PREFIX(name) name #else # define __REPB_PREFIX(name) __##name #endif struct re_pattern_buffer { /* Space that holds the compiled pattern. The type 'struct re_dfa_t' is private and is not declared here. */ struct re_dfa_t *__REPB_PREFIX(buffer); /* Number of bytes to which 'buffer' points. */ __re_long_size_t __REPB_PREFIX(allocated); /* Number of bytes actually used in 'buffer'. */ __re_long_size_t __REPB_PREFIX(used); /* Syntax setting with which the pattern was compiled. */ reg_syntax_t __REPB_PREFIX(syntax); /* Pointer to a fastmap, if any, otherwise zero. re_search uses the fastmap, if there is one, to skip over impossible starting points for matches. */ char *__REPB_PREFIX(fastmap); /* Either a translate table to apply to all characters before comparing them, or zero for no translation. The translation is applied to a pattern when it is compiled and to a string when it is matched. */ __RE_TRANSLATE_TYPE __REPB_PREFIX(translate); /* Number of subexpressions found by the compiler. */ size_t re_nsub; /* Zero if this pattern cannot match the empty string, one else. Well, in truth it's used only in 're_search_2', to see whether or not we should use the fastmap, so we don't set this absolutely perfectly; see 're_compile_fastmap' (the "duplicate" case). */ unsigned __REPB_PREFIX(can_be_null) : 1; /* If REGS_UNALLOCATED, allocate space in the 'regs' structure for 'max (RE_NREGS, re_nsub + 1)' groups. If REGS_REALLOCATE, reallocate space if necessary. If REGS_FIXED, use what's there. */ #ifdef __USE_GNU # define REGS_UNALLOCATED 0 # define REGS_REALLOCATE 1 # define REGS_FIXED 2 #endif unsigned __REPB_PREFIX(regs_allocated) : 2; /* Set to zero when 're_compile_pattern' compiles a pattern; set to one by 're_compile_fastmap' if it updates the fastmap. */ unsigned __REPB_PREFIX(fastmap_accurate) : 1; /* If set, 're_match_2' does not return information about subexpressions. */ unsigned __REPB_PREFIX(no_sub) : 1; /* If set, a beginning-of-line anchor doesn't match at the beginning of the string. */ unsigned __REPB_PREFIX(not_bol) : 1; /* Similarly for an end-of-line anchor. */ unsigned __REPB_PREFIX(not_eol) : 1; /* If true, an anchor at a newline matches. */ unsigned __REPB_PREFIX(newline_anchor) : 1; }; typedef struct re_pattern_buffer regex_t; /* Type for byte offsets within the string. POSIX mandates this. */ #ifdef _REGEX_LARGE_OFFSETS /* POSIX 1003.1-2008 requires that regoff_t be at least as wide as ptrdiff_t and ssize_t. We don't know of any hosts where ptrdiff_t is wider than ssize_t, so ssize_t is safe. ptrdiff_t is not visible here, so use ssize_t. */ typedef ssize_t regoff_t; #else /* The traditional GNU regex implementation mishandles strings longer than INT_MAX. */ typedef int regoff_t; #endif #ifdef __USE_GNU /* This is the structure we store register match data in. See regex.texinfo for a full description of what registers match. */ struct re_registers { __re_size_t num_regs; regoff_t *start; regoff_t *end; }; /* If 'regs_allocated' is REGS_UNALLOCATED in the pattern buffer, 're_match_2' returns information about at least this many registers the first time a 'regs' structure is passed. */ # ifndef RE_NREGS # define RE_NREGS 30 # endif #endif /* POSIX specification for registers. Aside from the different names than 're_registers', POSIX uses an array of structures, instead of a structure of arrays. */ typedef struct { regoff_t rm_so; /* Byte offset from string's start to substring's start. */ regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ } regmatch_t; /* Declarations for routines. */ #ifdef __USE_GNU /* Sets the current default syntax to SYNTAX, and return the old syntax. You can also simply assign to the 're_syntax_options' variable. */ extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax); /* Compile the regular expression PATTERN, with length LENGTH and syntax given by the global 're_syntax_options', into the buffer BUFFER. Return NULL if successful, and an error string if not. To free the allocated storage, you must call 'regfree' on BUFFER. Note that the translate table must either have been initialized by 'regcomp', with a malloc'ed value, or set to NULL before calling 'regfree'. */ extern const char *re_compile_pattern (const char *__pattern, size_t __length, struct re_pattern_buffer *__buffer); /* Compile a fastmap for the compiled pattern in BUFFER; used to accelerate searches. Return 0 if successful and -2 if was an internal error. */ extern int re_compile_fastmap (struct re_pattern_buffer *__buffer); /* Search in the string STRING (with length LENGTH) for the pattern compiled into BUFFER. Start searching at position START, for RANGE characters. Return the starting position of the match, -1 for no match, or -2 for an internal error. Also return register information in REGS (if REGS and BUFFER->no_sub are nonzero). */ extern regoff_t re_search (struct re_pattern_buffer *__buffer, const char *__String, regoff_t __length, regoff_t __start, regoff_t __range, struct re_registers *__regs); /* Like 're_search', but search in the concatenation of STRING1 and STRING2. Also, stop searching at index START + STOP. */ extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer, const char *__string1, regoff_t __length1, const char *__string2, regoff_t __length2, regoff_t __start, regoff_t __range, struct re_registers *__regs, regoff_t __stop); /* Like 're_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ extern regoff_t re_match (struct re_pattern_buffer *__buffer, const char *__String, regoff_t __length, regoff_t __start, struct re_registers *__regs); /* Relates to 're_match' as 're_search_2' relates to 're_search'. */ extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer, const char *__string1, regoff_t __length1, const char *__string2, regoff_t __length2, regoff_t __start, struct re_registers *__regs, regoff_t __stop); /* Set REGS to hold NUM_REGS registers, storing them in STARTS and ENDS. Subsequent matches using BUFFER and REGS will use this memory for recording register information. STARTS and ENDS must be allocated with malloc, and must each be at least 'NUM_REGS * sizeof (regoff_t)' bytes long. If NUM_REGS == 0, then subsequent matches should allocate their own register data. Unless this function is called, the first search or match using BUFFER will allocate its own register data, without freeing the old data. */ extern void re_set_registers (struct re_pattern_buffer *__buffer, struct re_registers *__regs, __re_size_t __num_regs, regoff_t *__starts, regoff_t *__ends); #endif /* Use GNU */ #if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_MISC) /* 4.2 bsd compatibility. */ extern char *re_comp (const char *); extern int re_exec (const char *); #endif /* For plain 'restrict', use glibc's __restrict if defined. Otherwise, GCC 2.95 and later have "__restrict"; C99 compilers have "restrict", and "configure" may have defined "restrict". Other compilers use __restrict, __restrict__, and _Restrict, and 'configure' might #define 'restrict' to those words, so pick a different name. */ #ifndef _Restrict_ # if defined __restrict \ || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ || __clang_major__ >= 3 # define _Restrict_ __restrict # elif 199901L <= __STDC_VERSION__ || defined restrict # define _Restrict_ restrict # else # define _Restrict_ # endif #endif /* For the ISO C99 syntax array_name[restrict] use glibc's __restrict_arr if available. Otherwise, GCC 3.1 and clang support this syntax (but not in C++ mode). Other ISO C99 compilers support it as well. */ #ifndef _Restrict_arr_ # ifdef __restrict_arr # define _Restrict_arr_ __restrict_arr # elif ((199901L <= __STDC_VERSION__ \ || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \ || __clang_major__ >= 3) \ && !defined __cplusplus) # define _Restrict_arr_ _Restrict_ # else # define _Restrict_arr_ # endif #endif /* POSIX compatibility. */ extern int regcomp (regex_t *_Restrict_ __preg, const char *_Restrict_ __pattern, int __cflags); extern int regexec (const regex_t *_Restrict_ __preg, const char *_Restrict_ __String, size_t __nmatch, regmatch_t __pmatch[_Restrict_arr_], int __eflags); extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg, char *_Restrict_ __errbuf, size_t __errbuf_size); extern void regfree (regex_t *__preg); #ifdef __cplusplus } #endif /* C++ */ #endif /* regex.h */ kbuild-3608/src/grep/lib/time.in.h0000664000175000017500000004002014670377426016730 0ustar locutuslocutus/* A more-standard . Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* Don't get in the way of glibc when it includes time.h merely to declare a few standard symbols, rather than to declare all the symbols. (However, skip this for MinGW as it treats __need_time_t incompatibly.) Also, Solaris 8 eventually includes itself recursively; if that is happening, just include the system without adding our own declarations. */ #if (((defined __need_time_t || defined __need_clock_t \ || defined __need_timespec) \ && !defined __MINGW32__) \ || defined _@GUARD_PREFIX@_TIME_H) # @INCLUDE_NEXT@ @NEXT_TIME_H@ #else # define _@GUARD_PREFIX@_TIME_H /* mingw's provides the functions asctime_r, ctime_r, gmtime_r, localtime_r only if or has been included before. */ # if defined __MINGW32__ # include # endif # @INCLUDE_NEXT@ @NEXT_TIME_H@ /* NetBSD 5.0 mis-defines NULL. */ # include /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Some systems don't define struct timespec (e.g., AIX 4.1). Or they define it with the wrong member names or define it in (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, but the pthreads-win32 library defines it in . */ # if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ # if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ # include # elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ # include # elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ # include # else # ifdef __cplusplus extern "C" { # endif # if !GNULIB_defined_struct_timespec # undef timespec # define timespec rpl_timespec struct timespec { time_t tv_sec; long int tv_nsec; }; # define GNULIB_defined_struct_timespec 1 # endif # ifdef __cplusplus } # endif # endif # endif # if !GNULIB_defined_struct_time_t_must_be_integral /* https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html requires time_t to be an integer type, even though C99 permits floating point. We don't know of any implementation that uses floating point, and it is much easier to write code that doesn't have to worry about that corner case, so we force the issue. */ struct __time_t_must_be_integral { unsigned int __floating_time_t_unsupported : (time_t) 1; }; # define GNULIB_defined_struct_time_t_must_be_integral 1 # endif /* Define TIME_UTC, a positive integer constant used for timespec_get(). */ # if ! @TIME_H_DEFINES_TIME_UTC@ # if !GNULIB_defined_TIME_UTC # define TIME_UTC 1 # define GNULIB_defined_TIME_UTC 1 # endif # endif /* Set *TS to the current time, and return BASE. Upon failure, return 0. */ # if @GNULIB_TIMESPEC_GET@ # if ! @HAVE_TIMESPEC_GET@ _GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); _GL_CXXALIASWARN (timespec_get); # endif /* Sleep for at least RQTP seconds unless interrupted, If interrupted, return -1 and store the remaining time into RMTP. See . */ # if @GNULIB_NANOSLEEP@ # if @REPLACE_NANOSLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define nanosleep rpl_nanosleep # endif _GL_FUNCDECL_RPL (nanosleep, int, (struct timespec const *__rqtp, struct timespec *__rmtp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (nanosleep, int, (struct timespec const *__rqtp, struct timespec *__rmtp)); # else # if ! @HAVE_NANOSLEEP@ _GL_FUNCDECL_SYS (nanosleep, int, (struct timespec const *__rqtp, struct timespec *__rmtp) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (nanosleep, int, (struct timespec const *__rqtp, struct timespec *__rmtp)); # endif _GL_CXXALIASWARN (nanosleep); # endif /* Initialize time conversion information. */ # if @GNULIB_TZSET@ # if @REPLACE_TZSET@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef tzset # define tzset rpl_tzset # endif _GL_FUNCDECL_RPL (tzset, void, (void)); _GL_CXXALIAS_RPL (tzset, void, (void)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef tzset # define tzset _tzset # endif _GL_CXXALIAS_MDA (tzset, void, (void)); # else _GL_CXXALIAS_SYS (tzset, void, (void)); # endif _GL_CXXALIASWARN (tzset); # elif @GNULIB_MDA_TZSET@ /* On native Windows, map 'tzset' to '_tzset', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::tzset always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef tzset # define tzset _tzset # endif _GL_CXXALIAS_MDA (tzset, void, (void)); # else _GL_CXXALIAS_SYS (tzset, void, (void)); # endif _GL_CXXALIASWARN (tzset); # endif /* Return the 'time_t' representation of TP and normalize TP. */ # if @GNULIB_MKTIME@ # if @REPLACE_MKTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mktime rpl_mktime # endif _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); # else _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mktime); # endif # endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See and . */ # if @GNULIB_TIME_R@ # if @REPLACE_LOCALTIME_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef localtime_r # define localtime_r rpl_localtime_r # endif _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # else # if ! @HAVE_DECL_LOCALTIME_R@ _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # endif # if @HAVE_DECL_LOCALTIME_R@ _GL_CXXALIASWARN (localtime_r); # endif # if @REPLACE_LOCALTIME_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gmtime_r # define gmtime_r rpl_gmtime_r # endif _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # else # if ! @HAVE_DECL_LOCALTIME_R@ _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # endif # if @HAVE_DECL_LOCALTIME_R@ _GL_CXXALIASWARN (gmtime_r); # endif # endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See and . */ # if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@ # if @REPLACE_LOCALTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef localtime # define localtime rpl_localtime # endif _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); # else _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (localtime); # endif # endif # if 0 || @REPLACE_GMTIME@ # if @REPLACE_GMTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gmtime # define gmtime rpl_gmtime # endif _GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); # else _GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); # endif _GL_CXXALIASWARN (gmtime); # endif /* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store the resulting broken-down time into TM. See . */ # if @GNULIB_STRPTIME@ # if ! @HAVE_STRPTIME@ _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, char const *restrict __format, struct tm *restrict __tm) _GL_ARG_NONNULL ((1, 2, 3))); # endif _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, char const *restrict __format, struct tm *restrict __tm)); _GL_CXXALIASWARN (strptime); # endif /* Convert *TP to a date and time string. See . */ # if @GNULIB_CTIME@ # if @REPLACE_CTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define ctime rpl_ctime # endif _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); # else _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (ctime); # endif # endif /* Convert *TP to a date and time string. See . */ # if @GNULIB_STRFTIME@ # if @REPLACE_STRFTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strftime rpl_strftime # endif _GL_FUNCDECL_RPL (strftime, size_t, (char *restrict __buf, size_t __bufsize, const char *restrict __fmt, const struct tm *restrict __tp) _GL_ARG_NONNULL ((1, 3, 4))); _GL_CXXALIAS_RPL (strftime, size_t, (char *restrict __buf, size_t __bufsize, const char *restrict __fmt, const struct tm *restrict __tp)); # else _GL_CXXALIAS_SYS (strftime, size_t, (char *restrict __buf, size_t __bufsize, const char *restrict __fmt, const struct tm *restrict __tp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (strftime); # endif # endif # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ /* Functions that use a first-class time zone data type, instead of relying on an implicit global time zone. Inspired by NetBSD. */ /* Represents a time zone. (timezone_t) NULL stands for UTC. */ typedef struct tm_zone *timezone_t; /* tzalloc (name) Returns a time zone object for the given time zone NAME. This object represents the time zone that other functions would use it the TZ environment variable was set to NAME. If NAME is NULL, the result represents the time zone that other functions would use it the TZ environment variable was unset. May return NULL if NAME is invalid (this is platform dependent) or upon memory allocation failure. */ _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); /* tzfree (tz) Frees a time zone object. The argument must have been returned by tzalloc(). */ _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); /* localtime_rz (tz, &t, &result) Converts an absolute time T to a broken-down time RESULT, assuming the time zone TZ. This function is like 'localtime_r', but relies on the argument TZ instead of an implicit global time zone. */ _GL_FUNCDECL_SYS (localtime_rz, struct tm *, (timezone_t __tz, time_t const *restrict __timer, struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_SYS (localtime_rz, struct tm *, (timezone_t __tz, time_t const *restrict __timer, struct tm *restrict __result)); /* mktime_z (tz, &tm) Normalizes the broken-down time TM and converts it to an absolute time, assuming the time zone TZ. Returns the absolute time. This function is like 'mktime', but relies on the argument TZ instead of an implicit global time zone. */ _GL_FUNCDECL_SYS (mktime_z, time_t, (timezone_t __tz, struct tm *restrict __tm) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_SYS (mktime_z, time_t, (timezone_t __tz, struct tm *restrict __tm)); /* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' in the 'tm_zone' member of 'struct tm') are valid as long as - the 'struct tm' argument is not destroyed or overwritten, and - the 'timezone_t' argument is not freed through tzfree(). */ # endif /* Convert TM to a time_t value, assuming UTC. */ # if @GNULIB_TIMEGM@ # if @REPLACE_TIMEGM@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef timegm # define timegm rpl_timegm # endif _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); # else # if ! @HAVE_TIMEGM@ _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); # endif _GL_CXXALIASWARN (timegm); # endif /* Encourage applications to avoid unsafe functions that can overrun buffers when given outlandish struct tm values. Portable applications should use strftime (or even sprintf) instead. */ # if defined GNULIB_POSIXCHECK # undef asctime _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # if defined GNULIB_POSIXCHECK # undef asctime_r _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # if defined GNULIB_POSIXCHECK # undef ctime _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # if defined GNULIB_POSIXCHECK # undef ctime_r _GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif #endif kbuild-3608/src/grep/lib/filename.h0000664000175000017500000001112114670377423017142 0ustar locutuslocutus/* Basic filename support macros. Copyright (C) 2001-2004, 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* From Paul Eggert and Jim Meyering. */ #ifndef _FILENAME_H #define _FILENAME_H #include #ifdef __cplusplus extern "C" { #endif /* Filename support. ISSLASH(C) tests whether C is a directory separator character. HAS_DEVICE(Filename) tests whether Filename contains a device specification. FILE_SYSTEM_PREFIX_LEN(Filename) length of the device specification at the beginning of Filename, index of the part consisting of alternating components and slashes. FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 when a non-empty device specification can be followed by an empty or relative part, 0 when a non-empty device specification must be followed by a slash, 0 when device specification don't exist. IS_ABSOLUTE_FILE_NAME(Filename) tests whether Filename is independent of any notion of "current directory". IS_RELATIVE_FILE_NAME(Filename) tests whether Filename may be concatenated to a directory filename. Note: On native Windows, OS/2, DOS, "c:" is neither an absolute nor a relative file name! IS_FILE_NAME_WITH_DIR(Filename) tests whether Filename contains a device or directory specification. */ #if defined _WIN32 || defined __CYGWIN__ \ || defined __EMX__ || defined __MSDOS__ || defined __DJGPP__ /* Native Windows, Cygwin, OS/2, DOS */ # define ISSLASH(C) ((C) == '/' || (C) == '\\') /* Internal macro: Tests whether a character is a drive letter. */ # define _IS_DRIVE_LETTER(C) \ (((C) >= 'A' && (C) <= 'Z') || ((C) >= 'a' && (C) <= 'z')) /* Help the compiler optimizing it. This assumes ASCII. */ # undef _IS_DRIVE_LETTER # define _IS_DRIVE_LETTER(C) \ (((unsigned int) (C) | ('a' - 'A')) - 'a' <= 'z' - 'a') # define HAS_DEVICE(Filename) \ (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':') # define FILE_SYSTEM_PREFIX_LEN(Filename) (HAS_DEVICE (Filename) ? 2 : 0) # ifdef __CYGWIN__ # define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 # else /* On native Windows, OS/2, DOS, the system has the notion of a "current directory" on each drive. */ # define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 # endif # if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE # define IS_ABSOLUTE_FILE_NAME(Filename) \ ISSLASH ((Filename)[FILE_SYSTEM_PREFIX_LEN (Filename)]) # else # define IS_ABSOLUTE_FILE_NAME(Filename) \ (ISSLASH ((Filename)[0]) || HAS_DEVICE (Filename)) # endif # define IS_RELATIVE_FILE_NAME(Filename) \ (! (ISSLASH ((Filename)[0]) || HAS_DEVICE (Filename))) # define IS_FILE_NAME_WITH_DIR(Filename) \ (strchr ((Filename), '/') != NULL || strchr ((Filename), '\\') != NULL \ || HAS_DEVICE (Filename)) #else /* Unix */ # define ISSLASH(C) ((C) == '/') # define HAS_DEVICE(Filename) ((void) (Filename), 0) # define FILE_SYSTEM_PREFIX_LEN(Filename) ((void) (Filename), 0) # define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 # define IS_ABSOLUTE_FILE_NAME(Filename) ISSLASH ((Filename)[0]) # define IS_RELATIVE_FILE_NAME(Filename) (! ISSLASH ((Filename)[0])) # define IS_FILE_NAME_WITH_DIR(Filename) (strchr ((Filename), '/') != NULL) #endif /* Deprecated macros. For backward compatibility with old users of the 'filename' module. */ #define IS_ABSOLUTE_PATH IS_ABSOLUTE_FILE_NAME #define IS_PATH_WITH_DIR IS_FILE_NAME_WITH_DIR #ifdef __cplusplus } #endif #endif /* _FILENAME_H */ kbuild-3608/src/grep/lib/warn-on-use.h0000664000175000017500000001547114670377426017554 0ustar locutuslocutus/* A C macro for emitting warnings if a function is used. Copyright (C) 2010-2021 Free Software Foundation, Inc. This program 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 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* _GL_WARN_ON_USE (function, "literal string") issues a declaration for FUNCTION which will then trigger a compiler warning containing the text of "literal string" anywhere that function is called, if supported by the compiler. If the compiler does not support this feature, the macro expands to an unused extern declaration. _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the attribute used in _GL_WARN_ON_USE. If the compiler does not support this feature, it expands to empty. These macros are useful for marking a function as a potential portability trap, with the intent that "literal string" include instructions on the replacement function that should be used instead. _GL_WARN_ON_USE is for functions with 'extern' linkage. _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' linkage. However, one of the reasons that a function is a portability trap is if it has the wrong signature. Declaring FUNCTION with a different signature in C is a compilation error, so this macro must use the same type as any existing declaration so that programs that avoid the problematic FUNCTION do not fail to compile merely because they included a header that poisoned the function. But this implies that _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already have a declaration. Use of this macro implies that there must not be any other macro hiding the declaration of FUNCTION; but undefining FUNCTION first is part of the poisoning process anyway (although for symbols that are provided only via a macro, the result is a compilation error rather than a warning containing "literal string"). Also note that in C++, it is only safe to use if FUNCTION has no overloads. For an example, it is possible to poison 'getline' by: - adding a call to gl_WARN_ON_USE_PREPARE([[#include ]], [getline]) in configure.ac, which potentially defines HAVE_RAW_DECL_GETLINE - adding this code to a header that wraps the system : #undef getline #if HAVE_RAW_DECL_GETLINE _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" "not universally present; use the gnulib module getline"); #endif It is not possible to directly poison global variables. But it is possible to write a wrapper accessor function, and poison that (less common usage, like &environ, will cause a compilation error rather than issue the nice warning, but the end result of informing the developer about their portability problem is still achieved): #if HAVE_RAW_DECL_ENVIRON static char *** rpl_environ (void) { return &environ; } _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); # undef environ # define environ (*rpl_environ ()) #endif or better (avoiding contradictory use of 'static' and 'extern'): #if HAVE_RAW_DECL_ENVIRON static char *** _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") rpl_environ (void) { return &environ; } # undef environ # define environ (*rpl_environ ()) #endif */ #ifndef _GL_WARN_ON_USE # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function __attribute__ ((__warning__ (message))) # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ __attribute__ ((__warning__ (message))) # elif __clang_major__ >= 4 /* Another compiler attribute is available in clang. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function \ __attribute__ ((__diagnose_if__ (1, message, "warning"))) # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ __attribute__ ((__diagnose_if__ (1, message, "warning"))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function # define _GL_WARN_ON_USE_ATTRIBUTE(message) # else /* Unsupported. */ # define _GL_WARN_ON_USE(function, message) \ _GL_WARN_EXTERN_C int _gl_warn_on_use # define _GL_WARN_ON_USE_ATTRIBUTE(message) # endif #endif /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the function is declared with the given prototype, consisting of return type, parameters, and attributes. This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does not work in this case. */ #ifndef _GL_WARN_ON_USE_CXX # if !defined __cplusplus # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ _GL_WARN_ON_USE (function, msg) # else # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ extern rettype_gcc function parameters_and_attributes \ __attribute__ ((__warning__ (msg))) # elif __clang_major__ >= 4 /* Another compiler attribute is available in clang. */ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ extern rettype_clang function parameters_and_attributes \ __attribute__ ((__diagnose_if__ (1, msg, "warning"))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ extern rettype_gcc function parameters_and_attributes # else /* Unsupported. */ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ _GL_WARN_EXTERN_C int _gl_warn_on_use # endif # endif #endif /* _GL_WARN_EXTERN_C declaration; performs the declaration with C linkage. */ #ifndef _GL_WARN_EXTERN_C # if defined __cplusplus # define _GL_WARN_EXTERN_C extern "C" # else # define _GL_WARN_EXTERN_C extern # endif #endif kbuild-3608/src/grep/lib/getopt-ext.h0000664000175000017500000000575314670377423017500 0ustar locutuslocutus/* Declarations for getopt (GNU extensions). Copyright (C) 1989-2021 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _GETOPT_EXT_H #define _GETOPT_EXT_H 1 /* This header should not be used directly; include getopt.h instead. Unlike most bits headers, it does not have a protective #error, because the guard macro for getopt.h in gnulib is not fixed. */ __BEGIN_DECLS /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of 'struct option' terminated by an element containing a name which is zero. The field 'has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field 'flag' is not NULL, it points to a variable that is set to the value given in the field 'val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an 'int' to a compiled-in constant, such as set a value from 'optarg', set the option's 'flag' field to zero and its 'val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero 'flag' field, 'getopt' returns the contents of the 'val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the 'has_arg' field of 'struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW _GL_ARG_NONNULL ((2, 3)); extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW _GL_ARG_NONNULL ((2, 3)); __END_DECLS #endif /* _GETOPT_EXT_H */ kbuild-3608/src/grep/lib/minmax.h0000664000175000017500000000453214670377425016665 0ustar locutuslocutus/* MIN, MAX macros. Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _MINMAX_H #define _MINMAX_H /* Note: MIN, MAX are also defined in on some systems (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about MIN, MAX macro redefinitions on some systems; the workaround is to #include this file as the last one among the #include list. */ /* Before we define the following symbols we get the file since otherwise we get redefinitions on some systems if is included after this file. Likewise for . If more than one of these system headers define MIN and MAX, pick just one of the headers (because the definitions most likely are the same). */ #if HAVE_MINMAX_IN_LIMITS_H # include #elif HAVE_MINMAX_IN_SYS_PARAM_H # include #endif /* Note: MIN and MAX should be used with two arguments of the same type. They might not return the minimum and maximum of their two arguments, if the arguments have different types or have unusual floating-point values. For example, on a typical host with 32-bit 'int', 64-bit 'long long', and 64-bit IEEE 754 'double' types: MAX (-1, 2147483648) returns 4294967295. MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0. MAX (NaN, 0.0) returns 0.0. MAX (+0.0, -0.0) returns -0.0. and in each case the answer is in some sense bogus. */ /* MAX(a,b) returns the maximum of A and B. */ #ifndef MAX # define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif /* MIN(a,b) returns the minimum of A and B. */ #ifndef MIN # define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif #endif /* _MINMAX_H */ kbuild-3608/src/grep/lib/fstat.c0000664000175000017500000000515314670377423016506 0ustar locutuslocutus/* fstat() replacement. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* If the user's config.h happens to include , let it include only the system's here, so that orig_fstat doesn't recurse to rpl_fstat. */ #define __need_system_sys_stat_h #include /* Get the original definition of fstat. It might be defined as a macro. */ #include #include #undef __need_system_sys_stat_h #if defined _WIN32 && ! defined __CYGWIN__ # define WINDOWS_NATIVE #endif #if !defined WINDOWS_NATIVE static int orig_fstat (int fd, struct stat *buf) { return fstat (fd, buf); } #endif /* Specification. */ #ifdef __osf__ /* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include above. */ # include "sys/stat.h" #else # include #endif #include "stat-time.h" #include #include #ifdef WINDOWS_NATIVE # define WIN32_LEAN_AND_MEAN # include # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include # endif # include "stat-w32.h" #endif int rpl_fstat (int fd, struct stat *buf) { #if REPLACE_FCHDIR && REPLACE_OPEN_DIRECTORY /* Handle the case when rpl_open() used a dummy file descriptor to work around an open() that can't normally visit directories. */ const char *name = _gl_directory_name (fd); if (name != NULL) return stat (name, buf); #endif #ifdef WINDOWS_NATIVE /* Fill the fields ourselves, because the original fstat function returns values for st_atime, st_mtime, st_ctime that depend on the current time zone. See */ HANDLE h = (HANDLE) _get_osfhandle (fd); if (h == INVALID_HANDLE_VALUE) { errno = EBADF; return -1; } return _gl_fstat_by_handle (h, NULL, buf); #else return stat_time_normalize (orig_fstat (fd, buf), buf); #endif } kbuild-3608/src/grep/lib/mbrtowc-impl-utf8.h0000664000175000017500000001225514670377426020676 0ustar locutuslocutus/* Convert multibyte character to wide character. Copyright (C) 1999-2002, 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2008. */ /* This file contains the part of the body of the mbrtowc and mbrtoc32 functions that handles the special case of the UTF-8 encoding. */ /* Cf. unistr/u8-mbtouc.c. */ unsigned char c = (unsigned char) p[0]; if (c < 0x80) { if (pwc != NULL) *pwc = c; res = (c == 0 ? 0 : 1); goto success; } if (c >= 0xc2) { if (c < 0xe0) { if (m == 1) goto incomplete; else /* m >= 2 */ { unsigned char c2 = (unsigned char) p[1]; if ((c2 ^ 0x80) < 0x40) { if (pwc != NULL) *pwc = ((unsigned int) (c & 0x1f) << 6) | (unsigned int) (c2 ^ 0x80); res = 2; goto success; } } } else if (c < 0xf0) { if (m == 1) goto incomplete; else { unsigned char c2 = (unsigned char) p[1]; if ((c2 ^ 0x80) < 0x40 && (c >= 0xe1 || c2 >= 0xa0) && (c != 0xed || c2 < 0xa0)) { if (m == 2) goto incomplete; else /* m >= 3 */ { unsigned char c3 = (unsigned char) p[2]; if ((c3 ^ 0x80) < 0x40) { unsigned int wc = (((unsigned int) (c & 0x0f) << 12) | ((unsigned int) (c2 ^ 0x80) << 6) | (unsigned int) (c3 ^ 0x80)); if (FITS_IN_CHAR_TYPE (wc)) { if (pwc != NULL) *pwc = wc; res = 3; goto success; } } } } } } else if (c <= 0xf4) { if (m == 1) goto incomplete; else { unsigned char c2 = (unsigned char) p[1]; if ((c2 ^ 0x80) < 0x40 && (c >= 0xf1 || c2 >= 0x90) && (c < 0xf4 || (/* c == 0xf4 && */ c2 < 0x90))) { if (m == 2) goto incomplete; else { unsigned char c3 = (unsigned char) p[2]; if ((c3 ^ 0x80) < 0x40) { if (m == 3) goto incomplete; else /* m >= 4 */ { unsigned char c4 = (unsigned char) p[3]; if ((c4 ^ 0x80) < 0x40) { unsigned int wc = (((unsigned int) (c & 0x07) << 18) | ((unsigned int) (c2 ^ 0x80) << 12) | ((unsigned int) (c3 ^ 0x80) << 6) | (unsigned int) (c4 ^ 0x80)); if (FITS_IN_CHAR_TYPE (wc)) { if (pwc != NULL) *pwc = wc; res = 4; goto success; } } } } } } } } } goto invalid; kbuild-3608/src/grep/lib/fts_.h0000664000175000017500000003077114670377423016331 0ustar locutuslocutus/* Traverse a file hierarchy. Copyright (C) 2004-2021 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 . */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)fts.h 8.3 (Berkeley) 8/14/94 */ #ifndef _FTS_H # define _FTS_H 1 # ifdef _LIBC # include # if __STDC_VERSION__ < 199901L # define __FLEXIBLE_ARRAY_MEMBER 1 # else # define __FLEXIBLE_ARRAY_MEMBER # endif # else # define __FLEXIBLE_ARRAY_MEMBER FLEXIBLE_ARRAY_MEMBER # undef __THROW # define __THROW # undef __BEGIN_DECLS # undef __END_DECLS # ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } # else # define __BEGIN_DECLS # define __END_DECLS # endif # endif # include # include # include # include # include "i-ring.h" typedef struct { struct _ftsent *fts_cur; /* current node */ struct _ftsent *fts_child; /* linked list of children */ struct _ftsent **fts_array; /* sort array */ dev_t fts_dev; /* starting device # */ char *fts_path; /* file name for this descent */ int fts_rfd; /* fd for root */ int fts_cwd_fd; /* the file descriptor on which the virtual cwd is open, or AT_FDCWD */ size_t fts_pathlen; /* sizeof(path) */ size_t fts_nitems; /* elements in the sort array */ int (*fts_compar) (struct _ftsent const **, struct _ftsent const **); /* compare fn */ # define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */ # define FTS_LOGICAL 0x0002 /* logical walk */ # define FTS_NOCHDIR 0x0004 /* don't change directories */ # define FTS_NOSTAT 0x0008 /* don't get stat info */ # define FTS_PHYSICAL 0x0010 /* physical walk */ # define FTS_SEEDOT 0x0020 /* return dot and dot-dot */ # define FTS_XDEV 0x0040 /* don't cross devices */ # define FTS_WHITEOUT 0x0080 /* return whiteout information */ /* There are two ways to detect cycles. The lazy way (which works only with FTS_PHYSICAL), with which one may process a directory that is a part of the cycle several times before detecting the cycle. The "tight" way, whereby fts uses more memory (proportional to number of "active" directories, aka distance from root of current tree to current directory -- see active_dir_ht) to detect any cycle right away. For example, du must use this option to avoid counting disk space in a cycle multiple times, but chown -R need not. The default is to use the constant-memory lazy way, when possible (see below). However, with FTS_LOGICAL (when following symlinks, e.g., chown -L) using lazy cycle detection is inadequate. For example, traversing a directory containing a symbolic link to a peer directory, it is possible to encounter the same directory twice even though there is no cycle: dir ... slink -> dir So, when FTS_LOGICAL is selected, we have to use a different mode of cycle detection: FTS_TIGHT_CYCLE_CHECK. */ # define FTS_TIGHT_CYCLE_CHECK 0x0100 /* Use this flag to enable semantics with which the parent application may be made both more efficient and more robust. Whereas the default is to visit each directory in a recursive traversal (via chdir), using this flag makes it so the initial working directory is never changed. Instead, these functions perform the traversal via a virtual working directory, maintained through the file descriptor member, fts_cwd_fd. */ # define FTS_CWDFD 0x0200 /* Historically, for each directory that fts initially encounters, it would open it, read all entries, and stat each entry, storing the results, and then it would process the first entry. But that behavior is bad for locality of reference, and also causes trouble with inode-simulating file systems like FAT, CIFS, FUSE-based ones, etc., when entries from their name/inode cache are flushed too early. Use this flag to make fts_open and fts_read defer the stat/lstat/fststat of each entry until it is actually processed. However, note that if you use this option and also specify a comparison function, that function may not examine any data via fts_statp. However, when fts_statp->st_mode is nonzero, the S_IFMT type bits are valid, with mapped dirent.d_type data. Of course, that happens only on file systems that provide useful dirent.d_type data. */ # define FTS_DEFER_STAT 0x0400 /* Use this flag to disable stripping of trailing slashes from input path names during fts_open initialization. */ # define FTS_VERBATIM 0x0800 # define FTS_OPTIONMASK 0x0fff /* valid user option mask */ # define FTS_NAMEONLY 0x1000 /* (private) child names only */ # define FTS_STOP 0x2000 /* (private) unrecoverable error */ int fts_options; /* fts_open options, global flags */ /* Map a directory's device number to a boolean. The boolean is true if for that file system (type determined by a single fstatfs call per FS) st_nlink can be used to calculate the number of sub-directory entries in a directory. Using this table is an optimization that permits us to look up file system type on a per-inode basis at the minimal cost of calling fstatfs only once per traversed device. */ struct hash_table *fts_leaf_optimization_works_ht; union { /* This data structure is used if FTS_TIGHT_CYCLE_CHECK is specified. It records the directories between a starting point and the current directory. I.e., a directory is recorded here IFF we have visited it once, but we have not yet completed processing of all its entries. Every time we visit a new directory, we add that directory to this set. When we finish with a directory (usually by visiting it a second time), we remove it from this set. Each entry in this data structure is a device/inode pair. This data structure is used to detect directory cycles efficiently and promptly even when the depth of a hierarchy is in the tens of thousands. */ struct hash_table *ht; /* FIXME: rename these two members to have the fts_ prefix */ /* This data structure uses a lazy cycle-detection algorithm, as done by rm via cycle-check.c. It's the default, but it's not appropriate for programs like du. */ struct cycle_check_state *state; } fts_cycle; /* A stack of the file descriptors corresponding to the most-recently traversed parent directories. Currently used only in FTS_CWDFD mode. */ I_ring fts_fd_ring; } FTS; typedef struct _ftsent { struct _ftsent *fts_cycle; /* cycle node */ struct _ftsent *fts_parent; /* parent directory */ struct _ftsent *fts_link; /* next file in directory */ DIR *fts_dirp; /* Dir pointer for any directory containing more entries than we read at one time. */ long fts_number; /* local numeric value */ void *fts_pointer; /* local address value */ char *fts_accpath; /* access file name */ char *fts_path; /* root name; == fts_fts->fts_path */ int fts_errno; /* errno for this node */ int fts_symfd; /* fd for symlink */ size_t fts_pathlen; /* strlen(fts_path) */ FTS *fts_fts; /* the file hierarchy itself */ # define FTS_ROOTPARENTLEVEL (-1) # define FTS_ROOTLEVEL 0 ptrdiff_t fts_level; /* depth (-1 to N) */ size_t fts_namelen; /* strlen(fts_name) */ # define FTS_D 1 /* preorder directory */ # define FTS_DC 2 /* directory that causes cycles */ # define FTS_DEFAULT 3 /* none of the above */ # define FTS_DNR 4 /* unreadable directory */ # define FTS_DOT 5 /* dot or dot-dot */ # define FTS_DP 6 /* postorder directory */ # define FTS_ERR 7 /* error; errno is set */ # define FTS_F 8 /* regular file */ # define FTS_INIT 9 /* initialized only */ # define FTS_NS 10 /* stat(2) failed */ # define FTS_NSOK 11 /* no stat(2) requested */ # define FTS_SL 12 /* symbolic link */ # define FTS_SLNONE 13 /* symbolic link without target */ # define FTS_W 14 /* whiteout object */ unsigned short int fts_info; /* user flags for FTSENT structure */ # define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ # define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ unsigned short int fts_flags; /* private flags for FTSENT structure */ # define FTS_AGAIN 1 /* read node again */ # define FTS_FOLLOW 2 /* follow symbolic link */ # define FTS_NOINSTR 3 /* no instructions */ # define FTS_SKIP 4 /* discard node */ unsigned short int fts_instr; /* fts_set() instructions */ struct stat fts_statp[1]; /* stat(2) information */ char fts_name[__FLEXIBLE_ARRAY_MEMBER]; /* file name */ } FTSENT; __BEGIN_DECLS _GL_ATTRIBUTE_NODISCARD FTSENT *fts_children (FTS *, int) __THROW; _GL_ATTRIBUTE_NODISCARD int fts_close (FTS *) __THROW; _GL_ATTRIBUTE_NODISCARD FTS *fts_open (char * const *, int, int (*)(const FTSENT **, const FTSENT **)) _GL_ATTRIBUTE_DEALLOC (fts_close, 1) __THROW; _GL_ATTRIBUTE_NODISCARD FTSENT *fts_read (FTS *) __THROW; int fts_set (FTS *, FTSENT *, int) __THROW; __END_DECLS #endif /* fts.h */ kbuild-3608/src/grep/lib/windows-initguard.h0000664000175000017500000000231614670377426021051 0ustar locutuslocutus/* Init guards, somewhat like spinlocks (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-win32.h. */ #ifndef _WINDOWS_INITGUARD_H #define _WINDOWS_INITGUARD_H #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include typedef struct { volatile int done; volatile LONG started; } glwthread_initguard_t; #define GLWTHREAD_INITGUARD_INIT { 0, -1 } #endif /* _WINDOWS_INITGUARD_H */ kbuild-3608/src/grep/lib/stdint.in.h0000664000175000017500000005475414670377426017322 0ustar locutuslocutus/* Copyright (C) 2001-2002, 2004-2021 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* * ISO C 99 for platforms that lack it. * */ #ifndef _@GUARD_PREFIX@_STDINT_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* When including a system file that in turn includes , use the system , not our substitute. This avoids problems with (for example) VMS, whose includes . */ #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* On Android (Bionic libc), includes this file before having defined 'time_t'. Therefore in this case avoid including other system header files; just include the system's . Ideally we should test __BIONIC__ here, but it is only defined after has been included; hence test __ANDROID__ instead. */ #if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H # @INCLUDE_NEXT@ @NEXT_STDINT_H@ #else /* Get those types that are already defined in other system include files, so that we can "#define int8_t signed char" below without worrying about a later system include file containing a "typedef signed char int8_t;" that will get messed up by our macro. Our macros should all be consistent with the system versions, except for the "fast" types and macros, which we recommend against using in public interfaces due to compiler differences. */ #if @HAVE_STDINT_H@ # if defined __sgi && ! defined __c99 /* Bypass IRIX's if in C89 mode, since it merely annoys users with "This header file is to be used only for c99 mode compilations" diagnostics. */ # define __STDINT_H__ # endif /* Some pre-C++11 implementations need this. */ # ifdef __cplusplus # ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS 1 # endif # ifndef __STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS 1 # endif # endif /* Other systems may have an incomplete or buggy . Include it before , since any "#include " in would reinclude us, skipping our contents because _@GUARD_PREFIX@_STDINT_H is defined. The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_STDINT_H@ #endif #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H #define _@GUARD_PREFIX@_STDINT_H /* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ #include /* Override WINT_MIN and WINT_MAX if gnulib's or overrides wint_t. */ #if @GNULIBHEADERS_OVERRIDE_WINT_T@ # undef WINT_MIN # undef WINT_MAX # define WINT_MIN 0x0U # define WINT_MAX 0xffffffffU #endif #if ! @HAVE_C99_STDINT_H@ /* defines some of the stdint.h types as well, on glibc, IRIX 6.5, and OpenBSD 3.8 (via ). AIX 5.2 isn't needed and causes troubles. Mac OS X 10.4.6 includes (which is us), but relies on the system definitions, so include after @NEXT_STDINT_H@. */ # if @HAVE_SYS_TYPES_H@ && ! defined _AIX # include # endif # if @HAVE_INTTYPES_H@ /* In OpenBSD 3.8, includes , which defines int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. also defines intptr_t and uintptr_t. */ # include # elif @HAVE_SYS_INTTYPES_H@ /* Solaris 7 has the types except the *_fast*_t types, and the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ # include # endif # if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ /* Linux libc4 >= 4.6.7 and libc5 have a that defines int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is included by . */ # include # endif # undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* Minimum and maximum values for an integer type under the usual assumption. Return an unspecified value if BITS == 0, adding a check to pacify picky compilers. */ /* These are separate macros, because if you try to merge these macros into a single one, HP-UX cc rejects the resulting expression in constant expressions. */ # define _STDINT_UNSIGNED_MIN(bits, zero) \ (zero) # define _STDINT_SIGNED_MIN(bits, zero) \ (~ _STDINT_MAX (1, bits, zero)) # define _STDINT_MAX(signed, bits, zero) \ (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) #if !GNULIB_defined_stdint_types /* 7.18.1.1. Exact-width integer types */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. */ # undef int8_t # undef uint8_t typedef signed char gl_int8_t; typedef unsigned char gl_uint8_t; # define int8_t gl_int8_t # define uint8_t gl_uint8_t # undef int16_t # undef uint16_t typedef short int gl_int16_t; typedef unsigned short int gl_uint16_t; # define int16_t gl_int16_t # define uint16_t gl_uint16_t # undef int32_t # undef uint32_t typedef int gl_int32_t; typedef unsigned int gl_uint32_t; # define int32_t gl_int32_t # define uint32_t gl_uint32_t /* If the system defines INT64_MAX, assume int64_t works. That way, if the underlying platform defines int64_t to be a 64-bit long long int, the code below won't mistakenly define it to be a 64-bit long int, which would mess up C++ name mangling. We must use #ifdef rather than #if, to avoid an error with HP-UX 10.20 cc. */ # ifdef INT64_MAX # define GL_INT64_T # else /* Do not undefine int64_t if gnulib is not being used with 64-bit types, since otherwise it breaks platforms like Tandem/NSK. */ # if LONG_MAX >> 31 >> 31 == 1 # undef int64_t typedef long int gl_int64_t; # define int64_t gl_int64_t # define GL_INT64_T # elif defined _MSC_VER # undef int64_t typedef __int64 gl_int64_t; # define int64_t gl_int64_t # define GL_INT64_T # else # undef int64_t typedef long long int gl_int64_t; # define int64_t gl_int64_t # define GL_INT64_T # endif # endif # ifdef UINT64_MAX # define GL_UINT64_T # else # if ULONG_MAX >> 31 >> 31 >> 1 == 1 # undef uint64_t typedef unsigned long int gl_uint64_t; # define uint64_t gl_uint64_t # define GL_UINT64_T # elif defined _MSC_VER # undef uint64_t typedef unsigned __int64 gl_uint64_t; # define uint64_t gl_uint64_t # define GL_UINT64_T # else # undef uint64_t typedef unsigned long long int gl_uint64_t; # define uint64_t gl_uint64_t # define GL_UINT64_T # endif # endif /* Avoid collision with Solaris 2.5.1 etc. */ # define _UINT8_T # define _UINT32_T # define _UINT64_T /* 7.18.1.2. Minimum-width integer types */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types are the same as the corresponding N_t types. */ # undef int_least8_t # undef uint_least8_t # undef int_least16_t # undef uint_least16_t # undef int_least32_t # undef uint_least32_t # undef int_least64_t # undef uint_least64_t # define int_least8_t int8_t # define uint_least8_t uint8_t # define int_least16_t int16_t # define uint_least16_t uint16_t # define int_least32_t int32_t # define uint_least32_t uint32_t # ifdef GL_INT64_T # define int_least64_t int64_t # endif # ifdef GL_UINT64_T # define uint_least64_t uint64_t # endif /* 7.18.1.3. Fastest minimum-width integer types */ /* Note: Other substitutes may define these types differently. It is not recommended to use these types in public header files. */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types are taken from the same list of types. The following code normally uses types consistent with glibc, as that lessens the chance of incompatibility with older GNU hosts. */ # undef int_fast8_t # undef uint_fast8_t # undef int_fast16_t # undef uint_fast16_t # undef int_fast32_t # undef uint_fast32_t # undef int_fast64_t # undef uint_fast64_t typedef signed char gl_int_fast8_t; typedef unsigned char gl_uint_fast8_t; # ifdef __sun /* Define types compatible with SunOS 5.10, so that code compiled under earlier SunOS versions works with code compiled under SunOS 5.10. */ typedef int gl_int_fast32_t; typedef unsigned int gl_uint_fast32_t; # else typedef long int gl_int_fast32_t; typedef unsigned long int gl_uint_fast32_t; # endif typedef gl_int_fast32_t gl_int_fast16_t; typedef gl_uint_fast32_t gl_uint_fast16_t; # define int_fast8_t gl_int_fast8_t # define uint_fast8_t gl_uint_fast8_t # define int_fast16_t gl_int_fast16_t # define uint_fast16_t gl_uint_fast16_t # define int_fast32_t gl_int_fast32_t # define uint_fast32_t gl_uint_fast32_t # ifdef GL_INT64_T # define int_fast64_t int64_t # endif # ifdef GL_UINT64_T # define uint_fast64_t uint64_t # endif /* 7.18.1.4. Integer types capable of holding object pointers */ /* kLIBC's defines _INTPTR_T_DECLARED and needs its own definitions of intptr_t and uintptr_t (which use int and unsigned) to avoid clashes with declarations of system functions like sbrk. Similarly, MinGW WSL-5.4.1 needs its own intptr_t and uintptr_t to avoid conflicting declarations of system functions like _findclose in . */ # if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \ || defined __MINGW32__) # undef intptr_t # undef uintptr_t # ifdef _WIN64 typedef long long int gl_intptr_t; typedef unsigned long long int gl_uintptr_t; # else typedef long int gl_intptr_t; typedef unsigned long int gl_uintptr_t; # endif # define intptr_t gl_intptr_t # define uintptr_t gl_uintptr_t # endif /* 7.18.1.5. Greatest-width integer types */ /* Note: These types are compiler dependent. It may be unwise to use them in public header files. */ /* If the system defines INTMAX_MAX, assume that intmax_t works, and similarly for UINTMAX_MAX and uintmax_t. This avoids problems with assuming one type where another is used by the system. */ # ifndef INTMAX_MAX # undef INTMAX_C # undef intmax_t # if LONG_MAX >> 30 == 1 typedef long long int gl_intmax_t; # define intmax_t gl_intmax_t # elif defined GL_INT64_T # define intmax_t int64_t # else typedef long int gl_intmax_t; # define intmax_t gl_intmax_t # endif # endif # ifndef UINTMAX_MAX # undef UINTMAX_C # undef uintmax_t # if ULONG_MAX >> 31 == 1 typedef unsigned long long int gl_uintmax_t; # define uintmax_t gl_uintmax_t # elif defined GL_UINT64_T # define uintmax_t uint64_t # else typedef unsigned long int gl_uintmax_t; # define uintmax_t gl_uintmax_t # endif # endif /* Verify that intmax_t and uintmax_t have the same size. Too much code breaks if this is not the case. If this check fails, the reason is likely to be found in the autoconf macros. */ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) ? 1 : -1]; # define GNULIB_defined_stdint_types 1 # endif /* !GNULIB_defined_stdint_types */ /* 7.18.2. Limits of specified-width integer types */ /* 7.18.2.1. Limits of exact-width integer types */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. */ # undef INT8_MIN # undef INT8_MAX # undef UINT8_MAX # define INT8_MIN (~ INT8_MAX) # define INT8_MAX 127 # define UINT8_MAX 255 # undef INT16_MIN # undef INT16_MAX # undef UINT16_MAX # define INT16_MIN (~ INT16_MAX) # define INT16_MAX 32767 # define UINT16_MAX 65535 # undef INT32_MIN # undef INT32_MAX # undef UINT32_MAX # define INT32_MIN (~ INT32_MAX) # define INT32_MAX 2147483647 # define UINT32_MAX 4294967295U # if defined GL_INT64_T && ! defined INT64_MAX /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 evaluates the latter incorrectly in preprocessor expressions. */ # define INT64_MIN (- INTMAX_C (1) << 63) # define INT64_MAX INTMAX_C (9223372036854775807) # endif # if defined GL_UINT64_T && ! defined UINT64_MAX # define UINT64_MAX UINTMAX_C (18446744073709551615) # endif /* 7.18.2.2. Limits of minimum-width integer types */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types are the same as the corresponding N_t types. */ # undef INT_LEAST8_MIN # undef INT_LEAST8_MAX # undef UINT_LEAST8_MAX # define INT_LEAST8_MIN INT8_MIN # define INT_LEAST8_MAX INT8_MAX # define UINT_LEAST8_MAX UINT8_MAX # undef INT_LEAST16_MIN # undef INT_LEAST16_MAX # undef UINT_LEAST16_MAX # define INT_LEAST16_MIN INT16_MIN # define INT_LEAST16_MAX INT16_MAX # define UINT_LEAST16_MAX UINT16_MAX # undef INT_LEAST32_MIN # undef INT_LEAST32_MAX # undef UINT_LEAST32_MAX # define INT_LEAST32_MIN INT32_MIN # define INT_LEAST32_MAX INT32_MAX # define UINT_LEAST32_MAX UINT32_MAX # undef INT_LEAST64_MIN # undef INT_LEAST64_MAX # ifdef GL_INT64_T # define INT_LEAST64_MIN INT64_MIN # define INT_LEAST64_MAX INT64_MAX # endif # undef UINT_LEAST64_MAX # ifdef GL_UINT64_T # define UINT_LEAST64_MAX UINT64_MAX # endif /* 7.18.2.3. Limits of fastest minimum-width integer types */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types are taken from the same list of types. */ # undef INT_FAST8_MIN # undef INT_FAST8_MAX # undef UINT_FAST8_MAX # define INT_FAST8_MIN SCHAR_MIN # define INT_FAST8_MAX SCHAR_MAX # define UINT_FAST8_MAX UCHAR_MAX # undef INT_FAST16_MIN # undef INT_FAST16_MAX # undef UINT_FAST16_MAX # define INT_FAST16_MIN INT_FAST32_MIN # define INT_FAST16_MAX INT_FAST32_MAX # define UINT_FAST16_MAX UINT_FAST32_MAX # undef INT_FAST32_MIN # undef INT_FAST32_MAX # undef UINT_FAST32_MAX # ifdef __sun # define INT_FAST32_MIN INT_MIN # define INT_FAST32_MAX INT_MAX # define UINT_FAST32_MAX UINT_MAX # else # define INT_FAST32_MIN LONG_MIN # define INT_FAST32_MAX LONG_MAX # define UINT_FAST32_MAX ULONG_MAX # endif # undef INT_FAST64_MIN # undef INT_FAST64_MAX # ifdef GL_INT64_T # define INT_FAST64_MIN INT64_MIN # define INT_FAST64_MAX INT64_MAX # endif # undef UINT_FAST64_MAX # ifdef GL_UINT64_T # define UINT_FAST64_MAX UINT64_MAX # endif /* 7.18.2.4. Limits of integer types capable of holding object pointers */ # undef INTPTR_MIN # undef INTPTR_MAX # undef UINTPTR_MAX # ifdef _WIN64 # define INTPTR_MIN LLONG_MIN # define INTPTR_MAX LLONG_MAX # define UINTPTR_MAX ULLONG_MAX # else # define INTPTR_MIN LONG_MIN # define INTPTR_MAX LONG_MAX # define UINTPTR_MAX ULONG_MAX # endif /* 7.18.2.5. Limits of greatest-width integer types */ # ifndef INTMAX_MAX # undef INTMAX_MIN # ifdef INT64_MAX # define INTMAX_MIN INT64_MIN # define INTMAX_MAX INT64_MAX # else # define INTMAX_MIN INT32_MIN # define INTMAX_MAX INT32_MAX # endif # endif # ifndef UINTMAX_MAX # ifdef UINT64_MAX # define UINTMAX_MAX UINT64_MAX # else # define UINTMAX_MAX UINT32_MAX # endif # endif /* 7.18.3. Limits of other integer types */ /* ptrdiff_t limits */ # undef PTRDIFF_MIN # undef PTRDIFF_MAX # if @APPLE_UNIVERSAL_BUILD@ # ifdef _LP64 # define PTRDIFF_MIN _STDINT_SIGNED_MIN (64, 0l) # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) # else # define PTRDIFF_MIN _STDINT_SIGNED_MIN (32, 0) # define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) # endif # else # define PTRDIFF_MIN \ _STDINT_SIGNED_MIN (@BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) # define PTRDIFF_MAX \ _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) # endif /* sig_atomic_t limits */ # undef SIG_ATOMIC_MIN # undef SIG_ATOMIC_MAX # if @HAVE_SIGNED_SIG_ATOMIC_T@ # define SIG_ATOMIC_MIN \ _STDINT_SIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@) # else # define SIG_ATOMIC_MIN \ _STDINT_UNSIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@) # endif # define SIG_ATOMIC_MAX \ _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ 0@SIG_ATOMIC_T_SUFFIX@) /* size_t limit */ # undef SIZE_MAX # if @APPLE_UNIVERSAL_BUILD@ # ifdef _LP64 # define SIZE_MAX _STDINT_MAX (0, 64, 0ul) # else # define SIZE_MAX _STDINT_MAX (0, 32, 0ul) # endif # else # define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) # endif /* wchar_t limits */ /* Get WCHAR_MIN, WCHAR_MAX. This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested includes -> -> -> , and the latter includes and assumes its types are already defined. */ # if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H # include # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H # endif # undef WCHAR_MIN # undef WCHAR_MAX # if @HAVE_SIGNED_WCHAR_T@ # define WCHAR_MIN \ _STDINT_SIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) # else # define WCHAR_MIN \ _STDINT_UNSIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) # endif # define WCHAR_MAX \ _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) /* wint_t limits */ /* If gnulib's or overrides wint_t, @WINT_T_SUFFIX@ is not accurate, therefore use the definitions from above. */ # if !@GNULIBHEADERS_OVERRIDE_WINT_T@ # undef WINT_MIN # undef WINT_MAX # if @HAVE_SIGNED_WINT_T@ # define WINT_MIN \ _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) # else # define WINT_MIN \ _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) # endif # define WINT_MAX \ _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) # endif /* 7.18.4. Macros for integer constants */ /* 7.18.4.1. Macros for minimum-width integer constants */ /* According to ISO C 99 Technical Corrigendum 1 */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ # undef INT8_C # undef UINT8_C # define INT8_C(x) x # define UINT8_C(x) x # undef INT16_C # undef UINT16_C # define INT16_C(x) x # define UINT16_C(x) x # undef INT32_C # undef UINT32_C # define INT32_C(x) x # define UINT32_C(x) x ## U # undef INT64_C # undef UINT64_C # if LONG_MAX >> 31 >> 31 == 1 # define INT64_C(x) x##L # elif defined _MSC_VER # define INT64_C(x) x##i64 # else # define INT64_C(x) x##LL # endif # if ULONG_MAX >> 31 >> 31 >> 1 == 1 # define UINT64_C(x) x##UL # elif defined _MSC_VER # define UINT64_C(x) x##ui64 # else # define UINT64_C(x) x##ULL # endif /* 7.18.4.2. Macros for greatest-width integer constants */ # ifndef INTMAX_C # if LONG_MAX >> 30 == 1 # define INTMAX_C(x) x##LL # elif defined GL_INT64_T # define INTMAX_C(x) INT64_C(x) # else # define INTMAX_C(x) x##L # endif # endif # ifndef UINTMAX_C # if ULONG_MAX >> 31 == 1 # define UINTMAX_C(x) x##ULL # elif defined GL_UINT64_T # define UINTMAX_C(x) UINT64_C(x) # else # define UINTMAX_C(x) x##UL # endif # endif #endif /* !@HAVE_C99_STDINT_H@ */ /* Macros specified by ISO/IEC TS 18661-1:2014. */ #if (!defined UINTMAX_WIDTH \ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) # ifdef INT8_MAX # define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX) # endif # ifdef UINT8_MAX # define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX) # endif # ifdef INT16_MAX # define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX) # endif # ifdef UINT16_MAX # define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX) # endif # ifdef INT32_MAX # define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX) # endif # ifdef UINT32_MAX # define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX) # endif # ifdef INT64_MAX # define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX) # endif # ifdef UINT64_MAX # define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX) # endif # define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX) # define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX) # define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX) # define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX) # define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX) # define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX) # define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX) # define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX) # define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX) # define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX) # define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX) # define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX) # define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX) # define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX) # define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX) # define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX) # define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX) # define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX) # define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX) # define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX) # define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX) # define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX) # define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX) # ifdef WINT_MAX # define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX) # endif # ifdef SIG_ATOMIC_MAX # define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX) # endif #endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ #endif /* _@GUARD_PREFIX@_STDINT_H */ #endif /* !(defined __ANDROID__ && ...) */ #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ kbuild-3608/src/grep/lib/xalloc-die.c0000664000175000017500000000243514670377426017411 0ustar locutuslocutus/* Report a memory allocation failure and exit. Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2021 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 . */ #include #include "xalloc.h" #include #include "error.h" #include "exitfail.h" #include "gettext.h" #define _(msgid) gettext (msgid) void xalloc_die (void) { error (exit_failure, 0, "%s", _("memory exhausted")); /* _Noreturn cannot be given to error, since it may return if its first argument is 0. To help compilers understand the xalloc_die does not return, call abort. Also, the abort is a safety feature if exit_failure is 0 (which shouldn't happen). */ abort (); } kbuild-3608/src/grep/lib/mbuiter.h0000664000175000017500000001721014670377425017040 0ustar locutuslocutus/* Iterating through multibyte strings: macros for multi-byte encodings. Copyright (C) 2001, 2005, 2007, 2009-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible . */ /* The macros in this file implement forward iteration through a multi-byte string, without knowing its length a-priori. With these macros, an iteration loop that looks like char *iter; for (iter = buf; *iter != '\0'; iter++) { do_something (*iter); } becomes mbui_iterator_t iter; for (mbui_init (iter, buf); mbui_avail (iter); mbui_advance (iter)) { do_something (mbui_cur_ptr (iter), mb_len (mbui_cur (iter))); } The benefit of these macros over plain use of mbrtowc is: - Handling of invalid multibyte sequences is possible without making the code more complicated, while still preserving the invalid multibyte sequences. Compared to mbiter.h, the macros here don't need to know the string's length a-priori. The downside is that at each step, the look-ahead that guards against overrunning the terminating '\0' is more expensive. The mbui_* macros are therefore suitable when there is a high probability that only the first few multibyte characters need to be inspected. Whereas the mbi_* macros are better if usually the iteration runs through the entire string. mbui_iterator_t is a type usable for variable declarations. mbui_init (iter, startptr) initializes the iterator, starting at startptr. mbui_avail (iter) returns true if there are more multibyte characters available before the end of string is reached. In this case, mbui_cur (iter) is initialized to the next multibyte character. mbui_advance (iter) advances the iterator by one multibyte character. mbui_cur (iter) returns the current multibyte character, of type mbchar_t. All the macros defined in mbchar.h can be used on it. mbui_cur_ptr (iter) return a pointer to the beginning of the current multibyte character. mbui_reloc (iter, ptrdiff) relocates iterator when the string is moved by ptrdiff bytes. mbui_copy (&destiter, &srciter) copies srciter to destiter. Here are the function prototypes of the macros. extern void mbui_init (mbui_iterator_t iter, const char *startptr); extern bool mbui_avail (mbui_iterator_t iter); extern void mbui_advance (mbui_iterator_t iter); extern mbchar_t mbui_cur (mbui_iterator_t iter); extern const char * mbui_cur_ptr (mbui_iterator_t iter); extern void mbui_reloc (mbui_iterator_t iter, ptrdiff_t ptrdiff); extern void mbui_copy (mbui_iterator_t *new, const mbui_iterator_t *old); */ #ifndef _MBUITER_H #define _MBUITER_H 1 #include #include #include #include #include #include #include "mbchar.h" #include "strnlen1.h" #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef MBUITER_INLINE # define MBUITER_INLINE _GL_INLINE #endif struct mbuiter_multi { bool in_shift; /* true if next byte may not be interpreted as ASCII */ mbstate_t state; /* if in_shift: current shift state */ bool next_done; /* true if mbui_avail has already filled the following */ struct mbchar cur; /* the current character: const char *cur.ptr pointer to current character The following are only valid after mbui_avail. size_t cur.bytes number of bytes of current character bool cur.wc_valid true if wc is a valid wide character wchar_t cur.wc if wc_valid: the current character */ }; MBUITER_INLINE void mbuiter_multi_next (struct mbuiter_multi *iter) { if (iter->next_done) return; if (iter->in_shift) goto with_shift; /* Handle most ASCII characters quickly, without calling mbrtowc(). */ if (is_basic (*iter->cur.ptr)) { /* These characters are part of the basic character set. ISO C 99 guarantees that their wide character code is identical to their char code. */ iter->cur.bytes = 1; iter->cur.wc = *iter->cur.ptr; iter->cur.wc_valid = true; } else { assert (mbsinit (&iter->state)); iter->in_shift = true; with_shift: iter->cur.bytes = mbrtowc (&iter->cur.wc, iter->cur.ptr, strnlen1 (iter->cur.ptr, MB_CUR_MAX), &iter->state); if (iter->cur.bytes == (size_t) -1) { /* An invalid multibyte sequence was encountered. */ iter->cur.bytes = 1; iter->cur.wc_valid = false; /* Whether to set iter->in_shift = false and reset iter->state or not is not very important; the string is bogus anyway. */ } else if (iter->cur.bytes == (size_t) -2) { /* An incomplete multibyte character at the end. */ iter->cur.bytes = strlen (iter->cur.ptr); iter->cur.wc_valid = false; /* Whether to set iter->in_shift = false and reset iter->state or not is not important; the string end is reached anyway. */ } else { if (iter->cur.bytes == 0) { /* A null wide character was encountered. */ iter->cur.bytes = 1; assert (*iter->cur.ptr == '\0'); assert (iter->cur.wc == 0); } iter->cur.wc_valid = true; /* When in the initial state, we can go back treating ASCII characters more quickly. */ if (mbsinit (&iter->state)) iter->in_shift = false; } } iter->next_done = true; } MBUITER_INLINE void mbuiter_multi_reloc (struct mbuiter_multi *iter, ptrdiff_t ptrdiff) { iter->cur.ptr += ptrdiff; } MBUITER_INLINE void mbuiter_multi_copy (struct mbuiter_multi *new_iter, const struct mbuiter_multi *old_iter) { if ((new_iter->in_shift = old_iter->in_shift)) memcpy (&new_iter->state, &old_iter->state, sizeof (mbstate_t)); else memset (&new_iter->state, 0, sizeof (mbstate_t)); new_iter->next_done = old_iter->next_done; mb_copy (&new_iter->cur, &old_iter->cur); } /* Iteration macros. */ typedef struct mbuiter_multi mbui_iterator_t; #define mbui_init(iter, startptr) \ ((iter).cur.ptr = (startptr), \ (iter).in_shift = false, memset (&(iter).state, '\0', sizeof (mbstate_t)), \ (iter).next_done = false) #define mbui_avail(iter) \ (mbuiter_multi_next (&(iter)), !mb_isnul ((iter).cur)) #define mbui_advance(iter) \ ((iter).cur.ptr += (iter).cur.bytes, (iter).next_done = false) /* Access to the current character. */ #define mbui_cur(iter) (iter).cur #define mbui_cur_ptr(iter) (iter).cur.ptr /* Relocation. */ #define mbui_reloc(iter, ptrdiff) mbuiter_multi_reloc (&iter, ptrdiff) /* Copying an iterator. */ #define mbui_copy mbuiter_multi_copy _GL_INLINE_HEADER_END #endif /* _MBUITER_H */ kbuild-3608/src/grep/lib/getprogname.h0000664000175000017500000000222314670377423017675 0ustar locutuslocutus/* Program name management. Copyright (C) 2016-2021 Free Software Foundation, Inc. This program 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _GL_GETPROGNAME_H #define _GL_GETPROGNAME_H #include #ifdef __cplusplus extern "C" { #endif /* Return the base name of the executing program. On native Windows this will usually end in ".exe" or ".EXE". */ #ifndef HAVE_GETPROGNAME extern char const *getprogname (void) # ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME _GL_ATTRIBUTE_PURE # endif ; #endif #ifdef __cplusplus } #endif #endif kbuild-3608/src/grep/lib/regexec.c0000664000175000017500000037402214670377426017016 0ustar locutuslocutus/* Extended regular expression matching and search library. Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . The GNU C Library 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. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, Idx n); static void match_ctx_clean (re_match_context_t *mctx); static void match_ctx_free (re_match_context_t *cache); static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, Idx node, Idx str_idx, Idx from, Idx to); static Idx search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx); static reg_errcode_t match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx); static re_sub_match_last_t * match_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx); static void sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts, re_dfastate_t **limited_sts, Idx last_node, Idx last_str_idx); static reg_errcode_t re_search_internal (const regex_t *preg, const char *string, Idx length, Idx start, Idx last_start, Idx stop, size_t nmatch, regmatch_t pmatch[], int eflags); static regoff_t re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, Idx length1, const char *string2, Idx length2, Idx start, regoff_t range, struct re_registers *regs, Idx stop, bool ret_len); static regoff_t re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, regoff_t range, Idx stop, struct re_registers *regs, bool ret_len); static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, int regs_allocated); static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx); static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match, Idx *p_match_first); static Idx check_halt_state_context (const re_match_context_t *mctx, const re_dfastate_t *state, Idx idx); static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, regmatch_t *prev_idx_match, Idx cur_node, Idx cur_idx, Idx nmatch); static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, Idx nregs, regmatch_t *regs, regmatch_t *prevregs, re_node_set *eps_via_nodes); static reg_errcode_t set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, regmatch_t *pmatch, bool fl_backtrack); static reg_errcode_t free_fail_stack_return (struct re_fail_stack_t *fs); #ifdef RE_ENABLE_I18N static int sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx node_idx, Idx str_idx, Idx max_str_idx); #endif /* RE_ENABLE_I18N */ static reg_errcode_t sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx); static reg_errcode_t build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, re_node_set *cur_dest); static reg_errcode_t update_cur_sifted_state (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, re_node_set *dest_nodes); static reg_errcode_t add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates); static bool check_dst_limits (const re_match_context_t *mctx, const re_node_set *limits, Idx dst_node, Idx dst_idx, Idx src_node, Idx src_idx); static int check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries, Idx subexp_idx, Idx from_node, Idx bkref_idx); static int check_dst_limits_calc_pos (const re_match_context_t *mctx, Idx limit, Idx subexp_idx, Idx node, Idx str_idx, Idx bkref_idx); static reg_errcode_t check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates, re_node_set *limits, struct re_backref_cache_entry *bkref_ents, Idx str_idx); static reg_errcode_t sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, const re_node_set *candidates); static reg_errcode_t merge_state_array (const re_dfa_t *dfa, re_dfastate_t **dst, re_dfastate_t **src, Idx num); static re_dfastate_t *find_recover_state (reg_errcode_t *err, re_match_context_t *mctx); static re_dfastate_t *transit_state (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *state); static re_dfastate_t *merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *next_state); static reg_errcode_t check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes, Idx str_idx); #if 0 static re_dfastate_t *transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *pstate); #endif #ifdef RE_ENABLE_I18N static reg_errcode_t transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate); #endif /* RE_ENABLE_I18N */ static reg_errcode_t transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes); static reg_errcode_t get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx); static reg_errcode_t get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top, re_sub_match_last_t *sub_last, Idx bkref_node, Idx bkref_str); static Idx find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, Idx subexp_idx, int type); static reg_errcode_t check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, Idx top_str, Idx last_node, Idx last_str, int type); static reg_errcode_t check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx, re_node_set *cur_nodes, re_node_set *next_nodes); static reg_errcode_t check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes, Idx ex_subexp, int type); static reg_errcode_t check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes, Idx target, Idx ex_subexp, int type); static reg_errcode_t expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes, Idx cur_str, Idx subexp_num, int type); static bool build_trtable (const re_dfa_t *dfa, re_dfastate_t *state); #ifdef RE_ENABLE_I18N static int check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, const re_string_t *input, Idx idx); # ifdef _LIBC static unsigned int find_collation_sequence_value (const unsigned char *mbs, size_t name_len); # endif /* _LIBC */ #endif /* RE_ENABLE_I18N */ static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, re_node_set *states_node, bitset_t *states_ch); static bool check_node_accept (const re_match_context_t *mctx, const re_token_t *node, Idx idx); static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len); /* Entry point for POSIX code. */ /* regexec searches for a given pattern, specified by PREG, in the string STRING. If NMATCH is zero or REG_NOSUB was set in the cflags argument to 'regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at least NMATCH elements, and we set them to the offsets of the corresponding matched substrings. EFLAGS specifies "execution flags" which affect matching: if REG_NOTBOL is set, then ^ does not match at the beginning of the string; if REG_NOTEOL is set, then $ does not match at the end. Return 0 if a match is found, REG_NOMATCH if not, REG_BADPAT if EFLAGS is invalid. */ int regexec (const regex_t *__restrict preg, const char *__restrict string, size_t nmatch, regmatch_t pmatch[], int eflags) { reg_errcode_t err; Idx start, length; re_dfa_t *dfa = preg->buffer; if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND)) return REG_BADPAT; if (eflags & REG_STARTEND) { start = pmatch[0].rm_so; length = pmatch[0].rm_eo; } else { start = 0; length = strlen (string); } lock_lock (dfa->lock); if (preg->no_sub) err = re_search_internal (preg, string, length, start, length, length, 0, NULL, eflags); else err = re_search_internal (preg, string, length, start, length, length, nmatch, pmatch, eflags); lock_unlock (dfa->lock); return err != REG_NOERROR; } #ifdef _LIBC libc_hidden_def (__regexec) # include versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4); # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) __typeof__ (__regexec) __compat_regexec; int attribute_compat_text_section __compat_regexec (const regex_t *__restrict preg, const char *__restrict string, size_t nmatch, regmatch_t pmatch[], int eflags) { return regexec (preg, string, nmatch, pmatch, eflags & (REG_NOTBOL | REG_NOTEOL)); } compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0); # endif #endif /* Entry points for GNU code. */ /* re_match, re_search, re_match_2, re_search_2 The former two functions operate on STRING with length LENGTH, while the later two operate on concatenation of STRING1 and STRING2 with lengths LENGTH1 and LENGTH2, respectively. re_match() matches the compiled pattern in BUFP against the string, starting at index START. re_search() first tries matching at index START, then it tries to match starting from index START + 1, and so on. The last start position tried is START + RANGE. (Thus RANGE = 0 forces re_search to operate the same way as re_match().) The parameter STOP of re_{match,search}_2 specifies that no match exceeding the first STOP characters of the concatenation of the strings should be concerned. If REGS is not NULL, and BUFP->no_sub is not set, the offsets of the match and all groups is stored in REGS. (For the "_2" variants, the offsets are computed relative to the concatenation, not relative to the individual strings.) On success, re_match* functions return the length of the match, re_search* return the position of the start of the match. They return -1 on match failure, -2 on error. */ regoff_t re_match (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, struct re_registers *regs) { return re_search_stub (bufp, string, length, start, 0, length, regs, true); } #ifdef _LIBC weak_alias (__re_match, re_match) #endif regoff_t re_search (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, regoff_t range, struct re_registers *regs) { return re_search_stub (bufp, string, length, start, range, length, regs, false); } #ifdef _LIBC weak_alias (__re_search, re_search) #endif regoff_t re_match_2 (struct re_pattern_buffer *bufp, const char *string1, Idx length1, const char *string2, Idx length2, Idx start, struct re_registers *regs, Idx stop) { return re_search_2_stub (bufp, string1, length1, string2, length2, start, 0, regs, stop, true); } #ifdef _LIBC weak_alias (__re_match_2, re_match_2) #endif regoff_t re_search_2 (struct re_pattern_buffer *bufp, const char *string1, Idx length1, const char *string2, Idx length2, Idx start, regoff_t range, struct re_registers *regs, Idx stop) { return re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, stop, false); } #ifdef _LIBC weak_alias (__re_search_2, re_search_2) #endif static regoff_t re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, Idx length1, const char *string2, Idx length2, Idx start, regoff_t range, struct re_registers *regs, Idx stop, bool ret_len) { const char *str; regoff_t rval; Idx len; char *s = NULL; if (__glibc_unlikely ((length1 < 0 || length2 < 0 || stop < 0 || INT_ADD_WRAPV (length1, length2, &len)))) return -2; /* Concatenate the strings. */ if (length2 > 0) if (length1 > 0) { s = re_malloc (char, len); if (__glibc_unlikely (s == NULL)) return -2; #ifdef _LIBC memcpy (__mempcpy (s, string1, length1), string2, length2); #else memcpy (s, string1, length1); memcpy (s + length1, string2, length2); #endif str = s; } else str = string2; else str = string1; rval = re_search_stub (bufp, str, len, start, range, stop, regs, ret_len); re_free (s); return rval; } /* The parameters have the same meaning as those of re_search. Additional parameters: If RET_LEN is true the length of the match is returned (re_match style); otherwise the position of the match is returned. */ static regoff_t re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, regoff_t range, Idx stop, struct re_registers *regs, bool ret_len) { reg_errcode_t result; regmatch_t *pmatch; Idx nregs; regoff_t rval; int eflags = 0; re_dfa_t *dfa = bufp->buffer; Idx last_start = start + range; /* Check for out-of-range. */ if (__glibc_unlikely (start < 0 || start > length)) return -1; if (__glibc_unlikely (length < last_start || (0 <= range && last_start < start))) last_start = length; else if (__glibc_unlikely (last_start < 0 || (range < 0 && start <= last_start))) last_start = 0; lock_lock (dfa->lock); eflags |= (bufp->not_bol) ? REG_NOTBOL : 0; eflags |= (bufp->not_eol) ? REG_NOTEOL : 0; /* Compile fastmap if we haven't yet. */ if (start < last_start && bufp->fastmap != NULL && !bufp->fastmap_accurate) re_compile_fastmap (bufp); if (__glibc_unlikely (bufp->no_sub)) regs = NULL; /* We need at least 1 register. */ if (regs == NULL) nregs = 1; else if (__glibc_unlikely (bufp->regs_allocated == REGS_FIXED && regs->num_regs <= bufp->re_nsub)) { nregs = regs->num_regs; if (__glibc_unlikely (nregs < 1)) { /* Nothing can be copied to regs. */ regs = NULL; nregs = 1; } } else nregs = bufp->re_nsub + 1; pmatch = re_malloc (regmatch_t, nregs); if (__glibc_unlikely (pmatch == NULL)) { rval = -2; goto out; } result = re_search_internal (bufp, string, length, start, last_start, stop, nregs, pmatch, eflags); rval = 0; /* I hope we needn't fill their regs with -1's when no match was found. */ if (result != REG_NOERROR) rval = result == REG_NOMATCH ? -1 : -2; else if (regs != NULL) { /* If caller wants register contents data back, copy them. */ bufp->regs_allocated = re_copy_regs (regs, pmatch, nregs, bufp->regs_allocated); if (__glibc_unlikely (bufp->regs_allocated == REGS_UNALLOCATED)) rval = -2; } if (__glibc_likely (rval == 0)) { if (ret_len) { DEBUG_ASSERT (pmatch[0].rm_so == start); rval = pmatch[0].rm_eo - start; } else rval = pmatch[0].rm_so; } re_free (pmatch); out: lock_unlock (dfa->lock); return rval; } static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, int regs_allocated) { int rval = REGS_REALLOCATE; Idx i; Idx need_regs = nregs + 1; /* We need one extra element beyond 'num_regs' for the '-1' marker GNU code uses. */ /* Have the register data arrays been allocated? */ if (regs_allocated == REGS_UNALLOCATED) { /* No. So allocate them with malloc. */ regs->start = re_malloc (regoff_t, need_regs); if (__glibc_unlikely (regs->start == NULL)) return REGS_UNALLOCATED; regs->end = re_malloc (regoff_t, need_regs); if (__glibc_unlikely (regs->end == NULL)) { re_free (regs->start); return REGS_UNALLOCATED; } regs->num_regs = need_regs; } else if (regs_allocated == REGS_REALLOCATE) { /* Yes. If we need more elements than were already allocated, reallocate them. If we need fewer, just leave it alone. */ if (__glibc_unlikely (need_regs > regs->num_regs)) { regoff_t *new_start = re_realloc (regs->start, regoff_t, need_regs); regoff_t *new_end; if (__glibc_unlikely (new_start == NULL)) return REGS_UNALLOCATED; new_end = re_realloc (regs->end, regoff_t, need_regs); if (__glibc_unlikely (new_end == NULL)) { re_free (new_start); return REGS_UNALLOCATED; } regs->start = new_start; regs->end = new_end; regs->num_regs = need_regs; } } else { DEBUG_ASSERT (regs_allocated == REGS_FIXED); /* This function may not be called with REGS_FIXED and nregs too big. */ DEBUG_ASSERT (nregs <= regs->num_regs); rval = REGS_FIXED; } /* Copy the regs. */ for (i = 0; i < nregs; ++i) { regs->start[i] = pmatch[i].rm_so; regs->end[i] = pmatch[i].rm_eo; } for ( ; i < regs->num_regs; ++i) regs->start[i] = regs->end[i] = -1; return rval; } /* Set REGS to hold NUM_REGS registers, storing them in STARTS and ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use this memory for recording register information. STARTS and ENDS must be allocated using the malloc library routine, and must each be at least NUM_REGS * sizeof (regoff_t) bytes long. If NUM_REGS == 0, then subsequent matches should allocate their own register data. Unless this function is called, the first search or match using PATTERN_BUFFER will allocate its own register data, without freeing the old data. */ void re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs, __re_size_t num_regs, regoff_t *starts, regoff_t *ends) { if (num_regs) { bufp->regs_allocated = REGS_REALLOCATE; regs->num_regs = num_regs; regs->start = starts; regs->end = ends; } else { bufp->regs_allocated = REGS_UNALLOCATED; regs->num_regs = 0; regs->start = regs->end = NULL; } } #ifdef _LIBC weak_alias (__re_set_registers, re_set_registers) #endif /* Entry points compatible with 4.2 BSD regex library. We don't define them unless specifically requested. */ #if defined _REGEX_RE_COMP || defined _LIBC int # ifdef _LIBC weak_function # endif re_exec (const char *s) { return 0 == regexec (&re_comp_buf, s, 0, NULL, 0); } #endif /* _REGEX_RE_COMP */ /* Internal entry point. */ /* Searches for a compiled pattern PREG in the string STRING, whose length is LENGTH. NMATCH, PMATCH, and EFLAGS have the same meaning as with regexec. LAST_START is START + RANGE, where START and RANGE have the same meaning as with re_search. Return REG_NOERROR if we find a match, and REG_NOMATCH if not, otherwise return the error code. Note: We assume front end functions already check ranges. (0 <= LAST_START && LAST_START <= LENGTH) */ static reg_errcode_t __attribute_warn_unused_result__ re_search_internal (const regex_t *preg, const char *string, Idx length, Idx start, Idx last_start, Idx stop, size_t nmatch, regmatch_t pmatch[], int eflags) { reg_errcode_t err; const re_dfa_t *dfa = preg->buffer; Idx left_lim, right_lim; int incr; bool fl_longest_match; int match_kind; Idx match_first; Idx match_last = -1; Idx extra_nmatch; bool sb; int ch; re_match_context_t mctx = { .dfa = dfa }; char *fastmap = ((preg->fastmap != NULL && preg->fastmap_accurate && start != last_start && !preg->can_be_null) ? preg->fastmap : NULL); RE_TRANSLATE_TYPE t = preg->translate; extra_nmatch = (nmatch > preg->re_nsub) ? nmatch - (preg->re_nsub + 1) : 0; nmatch -= extra_nmatch; /* Check if the DFA haven't been compiled. */ if (__glibc_unlikely (preg->used == 0 || dfa->init_state == NULL || dfa->init_state_word == NULL || dfa->init_state_nl == NULL || dfa->init_state_begbuf == NULL)) return REG_NOMATCH; /* We assume front-end functions already check them. */ DEBUG_ASSERT (0 <= last_start && last_start <= length); /* If initial states with non-begbuf contexts have no elements, the regex must be anchored. If preg->newline_anchor is set, we'll never use init_state_nl, so do not check it. */ if (dfa->init_state->nodes.nelem == 0 && dfa->init_state_word->nodes.nelem == 0 && (dfa->init_state_nl->nodes.nelem == 0 || !preg->newline_anchor)) { if (start != 0 && last_start != 0) return REG_NOMATCH; start = last_start = 0; } /* We must check the longest matching, if nmatch > 0. */ fl_longest_match = (nmatch != 0 || dfa->nbackref); err = re_string_allocate (&mctx.input, string, length, dfa->nodes_len + 1, preg->translate, (preg->syntax & RE_ICASE) != 0, dfa); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; mctx.input.stop = stop; mctx.input.raw_stop = stop; mctx.input.newline_anchor = preg->newline_anchor; err = match_ctx_init (&mctx, eflags, dfa->nbackref * 2); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; /* We will log all the DFA states through which the dfa pass, if nmatch > 1, or this dfa has "multibyte node", which is a back-reference or a node which can accept multibyte character or multi character collating element. */ if (nmatch > 1 || dfa->has_mb_node) { /* Avoid overflow. */ if (__glibc_unlikely ((MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) <= mctx.input.bufs_len))) { err = REG_ESPACE; goto free_return; } mctx.state_log = re_malloc (re_dfastate_t *, mctx.input.bufs_len + 1); if (__glibc_unlikely (mctx.state_log == NULL)) { err = REG_ESPACE; goto free_return; } } match_first = start; mctx.input.tip_context = (eflags & REG_NOTBOL) ? CONTEXT_BEGBUF : CONTEXT_NEWLINE | CONTEXT_BEGBUF; /* Check incrementally whether the input string matches. */ incr = (last_start < start) ? -1 : 1; left_lim = (last_start < start) ? last_start : start; right_lim = (last_start < start) ? start : last_start; sb = dfa->mb_cur_max == 1; match_kind = (fastmap ? ((sb || !(preg->syntax & RE_ICASE || t) ? 4 : 0) | (start <= last_start ? 2 : 0) | (t != NULL ? 1 : 0)) : 8); for (;; match_first += incr) { err = REG_NOMATCH; if (match_first < left_lim || right_lim < match_first) goto free_return; /* Advance as rapidly as possible through the string, until we find a plausible place to start matching. This may be done with varying efficiency, so there are various possibilities: only the most common of them are specialized, in order to save on code size. We use a switch statement for speed. */ switch (match_kind) { case 8: /* No fastmap. */ break; case 7: /* Fastmap with single-byte translation, match forward. */ while (__glibc_likely (match_first < right_lim) && !fastmap[t[(unsigned char) string[match_first]]]) ++match_first; goto forward_match_found_start_or_reached_end; case 6: /* Fastmap without translation, match forward. */ while (__glibc_likely (match_first < right_lim) && !fastmap[(unsigned char) string[match_first]]) ++match_first; forward_match_found_start_or_reached_end: if (__glibc_unlikely (match_first == right_lim)) { ch = match_first >= length ? 0 : (unsigned char) string[match_first]; if (!fastmap[t ? t[ch] : ch]) goto free_return; } break; case 4: case 5: /* Fastmap without multi-byte translation, match backwards. */ while (match_first >= left_lim) { ch = match_first >= length ? 0 : (unsigned char) string[match_first]; if (fastmap[t ? t[ch] : ch]) break; --match_first; } if (match_first < left_lim) goto free_return; break; default: /* In this case, we can't determine easily the current byte, since it might be a component byte of a multibyte character. Then we use the constructed buffer instead. */ for (;;) { /* If MATCH_FIRST is out of the valid range, reconstruct the buffers. */ __re_size_t offset = match_first - mctx.input.raw_mbs_idx; if (__glibc_unlikely (offset >= (__re_size_t) mctx.input.valid_raw_len)) { err = re_string_reconstruct (&mctx.input, match_first, eflags); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; offset = match_first - mctx.input.raw_mbs_idx; } /* If MATCH_FIRST is out of the buffer, leave it as '\0'. Note that MATCH_FIRST must not be smaller than 0. */ ch = (match_first >= length ? 0 : re_string_byte_at (&mctx.input, offset)); if (fastmap[ch]) break; match_first += incr; if (match_first < left_lim || match_first > right_lim) { err = REG_NOMATCH; goto free_return; } } break; } /* Reconstruct the buffers so that the matcher can assume that the matching starts from the beginning of the buffer. */ err = re_string_reconstruct (&mctx.input, match_first, eflags); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; #ifdef RE_ENABLE_I18N /* Don't consider this char as a possible match start if it part, yet isn't the head, of a multibyte character. */ if (!sb && !re_string_first_byte (&mctx.input, 0)) continue; #endif /* It seems to be appropriate one, then use the matcher. */ /* We assume that the matching starts from 0. */ mctx.state_log_top = mctx.nbkref_ents = mctx.max_mb_elem_len = 0; match_last = check_matching (&mctx, fl_longest_match, start <= last_start ? &match_first : NULL); if (match_last != -1) { if (__glibc_unlikely (match_last == -2)) { err = REG_ESPACE; goto free_return; } else { mctx.match_last = match_last; if ((!preg->no_sub && nmatch > 1) || dfa->nbackref) { re_dfastate_t *pstate = mctx.state_log[match_last]; mctx.last_node = check_halt_state_context (&mctx, pstate, match_last); } if ((!preg->no_sub && nmatch > 1 && dfa->has_plural_match) || dfa->nbackref) { err = prune_impossible_nodes (&mctx); if (err == REG_NOERROR) break; if (__glibc_unlikely (err != REG_NOMATCH)) goto free_return; match_last = -1; } else break; /* We found a match. */ } } match_ctx_clean (&mctx); } DEBUG_ASSERT (match_last != -1); DEBUG_ASSERT (err == REG_NOERROR); /* Set pmatch[] if we need. */ if (nmatch > 0) { Idx reg_idx; /* Initialize registers. */ for (reg_idx = 1; reg_idx < nmatch; ++reg_idx) pmatch[reg_idx].rm_so = pmatch[reg_idx].rm_eo = -1; /* Set the points where matching start/end. */ pmatch[0].rm_so = 0; pmatch[0].rm_eo = mctx.match_last; /* FIXME: This function should fail if mctx.match_last exceeds the maximum possible regoff_t value. We need a new error code REG_OVERFLOW. */ if (!preg->no_sub && nmatch > 1) { err = set_regs (preg, &mctx, nmatch, pmatch, dfa->has_plural_match && dfa->nbackref > 0); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; } /* At last, add the offset to each register, since we slid the buffers so that we could assume that the matching starts from 0. */ for (reg_idx = 0; reg_idx < nmatch; ++reg_idx) if (pmatch[reg_idx].rm_so != -1) { #ifdef RE_ENABLE_I18N if (__glibc_unlikely (mctx.input.offsets_needed != 0)) { pmatch[reg_idx].rm_so = (pmatch[reg_idx].rm_so == mctx.input.valid_len ? mctx.input.valid_raw_len : mctx.input.offsets[pmatch[reg_idx].rm_so]); pmatch[reg_idx].rm_eo = (pmatch[reg_idx].rm_eo == mctx.input.valid_len ? mctx.input.valid_raw_len : mctx.input.offsets[pmatch[reg_idx].rm_eo]); } #else DEBUG_ASSERT (mctx.input.offsets_needed == 0); #endif pmatch[reg_idx].rm_so += match_first; pmatch[reg_idx].rm_eo += match_first; } for (reg_idx = 0; reg_idx < extra_nmatch; ++reg_idx) { pmatch[nmatch + reg_idx].rm_so = -1; pmatch[nmatch + reg_idx].rm_eo = -1; } if (dfa->subexp_map) for (reg_idx = 0; reg_idx + 1 < nmatch; reg_idx++) if (dfa->subexp_map[reg_idx] != reg_idx) { pmatch[reg_idx + 1].rm_so = pmatch[dfa->subexp_map[reg_idx] + 1].rm_so; pmatch[reg_idx + 1].rm_eo = pmatch[dfa->subexp_map[reg_idx] + 1].rm_eo; } } free_return: re_free (mctx.state_log); if (dfa->nbackref) match_ctx_free (&mctx); re_string_destruct (&mctx.input); return err; } static reg_errcode_t __attribute_warn_unused_result__ prune_impossible_nodes (re_match_context_t *mctx) { const re_dfa_t *const dfa = mctx->dfa; Idx halt_node, match_last; reg_errcode_t ret; re_dfastate_t **sifted_states; re_dfastate_t **lim_states = NULL; re_sift_context_t sctx; DEBUG_ASSERT (mctx->state_log != NULL); match_last = mctx->match_last; halt_node = mctx->last_node; /* Avoid overflow. */ if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) <= match_last)) return REG_ESPACE; sifted_states = re_malloc (re_dfastate_t *, match_last + 1); if (__glibc_unlikely (sifted_states == NULL)) { ret = REG_ESPACE; goto free_return; } if (dfa->nbackref) { lim_states = re_malloc (re_dfastate_t *, match_last + 1); if (__glibc_unlikely (lim_states == NULL)) { ret = REG_ESPACE; goto free_return; } while (1) { memset (lim_states, '\0', sizeof (re_dfastate_t *) * (match_last + 1)); sift_ctx_init (&sctx, sifted_states, lim_states, halt_node, match_last); ret = sift_states_backward (mctx, &sctx); re_node_set_free (&sctx.limits); if (__glibc_unlikely (ret != REG_NOERROR)) goto free_return; if (sifted_states[0] != NULL || lim_states[0] != NULL) break; do { --match_last; if (match_last < 0) { ret = REG_NOMATCH; goto free_return; } } while (mctx->state_log[match_last] == NULL || !mctx->state_log[match_last]->halt); halt_node = check_halt_state_context (mctx, mctx->state_log[match_last], match_last); } ret = merge_state_array (dfa, sifted_states, lim_states, match_last + 1); re_free (lim_states); lim_states = NULL; if (__glibc_unlikely (ret != REG_NOERROR)) goto free_return; } else { sift_ctx_init (&sctx, sifted_states, lim_states, halt_node, match_last); ret = sift_states_backward (mctx, &sctx); re_node_set_free (&sctx.limits); if (__glibc_unlikely (ret != REG_NOERROR)) goto free_return; if (sifted_states[0] == NULL) { ret = REG_NOMATCH; goto free_return; } } re_free (mctx->state_log); mctx->state_log = sifted_states; sifted_states = NULL; mctx->last_node = halt_node; mctx->match_last = match_last; ret = REG_NOERROR; free_return: re_free (sifted_states); re_free (lim_states); return ret; } /* Acquire an initial state and return it. We must select appropriate initial state depending on the context, since initial states may have constraints like "\<", "^", etc.. */ static inline re_dfastate_t * __attribute__ ((always_inline)) acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, Idx idx) { const re_dfa_t *const dfa = mctx->dfa; if (dfa->init_state->has_constraint) { unsigned int context; context = re_string_context_at (&mctx->input, idx - 1, mctx->eflags); if (IS_WORD_CONTEXT (context)) return dfa->init_state_word; else if (IS_ORDINARY_CONTEXT (context)) return dfa->init_state; else if (IS_BEGBUF_CONTEXT (context) && IS_NEWLINE_CONTEXT (context)) return dfa->init_state_begbuf; else if (IS_NEWLINE_CONTEXT (context)) return dfa->init_state_nl; else if (IS_BEGBUF_CONTEXT (context)) { /* It is relatively rare case, then calculate on demand. */ return re_acquire_state_context (err, dfa, dfa->init_state->entrance_nodes, context); } else /* Must not happen? */ return dfa->init_state; } else return dfa->init_state; } /* Check whether the regular expression match input string INPUT or not, and return the index where the matching end. Return -1 if there is no match, and return -2 in case of an error. FL_LONGEST_MATCH means we want the POSIX longest matching. If P_MATCH_FIRST is not NULL, and the match fails, it is set to the next place where we may want to try matching. Note that the matcher assumes that the matching starts from the current index of the buffer. */ static Idx __attribute_warn_unused_result__ check_matching (re_match_context_t *mctx, bool fl_longest_match, Idx *p_match_first) { const re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; Idx match = 0; Idx match_last = -1; Idx cur_str_idx = re_string_cur_idx (&mctx->input); re_dfastate_t *cur_state; bool at_init_state = p_match_first != NULL; Idx next_start_idx = cur_str_idx; err = REG_NOERROR; cur_state = acquire_init_state_context (&err, mctx, cur_str_idx); /* An initial state must not be NULL (invalid). */ if (__glibc_unlikely (cur_state == NULL)) { DEBUG_ASSERT (err == REG_ESPACE); return -2; } if (mctx->state_log != NULL) { mctx->state_log[cur_str_idx] = cur_state; /* Check OP_OPEN_SUBEXP in the initial state in case that we use them later. E.g. Processing back references. */ if (__glibc_unlikely (dfa->nbackref)) { at_init_state = false; err = check_subexp_matching_top (mctx, &cur_state->nodes, 0); if (__glibc_unlikely (err != REG_NOERROR)) return err; if (cur_state->has_backref) { err = transit_state_bkref (mctx, &cur_state->nodes); if (__glibc_unlikely (err != REG_NOERROR)) return err; } } } /* If the RE accepts NULL string. */ if (__glibc_unlikely (cur_state->halt)) { if (!cur_state->has_constraint || check_halt_state_context (mctx, cur_state, cur_str_idx)) { if (!fl_longest_match) return cur_str_idx; else { match_last = cur_str_idx; match = 1; } } } while (!re_string_eoi (&mctx->input)) { re_dfastate_t *old_state = cur_state; Idx next_char_idx = re_string_cur_idx (&mctx->input) + 1; if ((__glibc_unlikely (next_char_idx >= mctx->input.bufs_len) && mctx->input.bufs_len < mctx->input.len) || (__glibc_unlikely (next_char_idx >= mctx->input.valid_len) && mctx->input.valid_len < mctx->input.len)) { err = extend_buffers (mctx, next_char_idx + 1); if (__glibc_unlikely (err != REG_NOERROR)) { DEBUG_ASSERT (err == REG_ESPACE); return -2; } } cur_state = transit_state (&err, mctx, cur_state); if (mctx->state_log != NULL) cur_state = merge_state_with_log (&err, mctx, cur_state); if (cur_state == NULL) { /* Reached the invalid state or an error. Try to recover a valid state using the state log, if available and if we have not already found a valid (even if not the longest) match. */ if (__glibc_unlikely (err != REG_NOERROR)) return -2; if (mctx->state_log == NULL || (match && !fl_longest_match) || (cur_state = find_recover_state (&err, mctx)) == NULL) break; } if (__glibc_unlikely (at_init_state)) { if (old_state == cur_state) next_start_idx = next_char_idx; else at_init_state = false; } if (cur_state->halt) { /* Reached a halt state. Check the halt state can satisfy the current context. */ if (!cur_state->has_constraint || check_halt_state_context (mctx, cur_state, re_string_cur_idx (&mctx->input))) { /* We found an appropriate halt state. */ match_last = re_string_cur_idx (&mctx->input); match = 1; /* We found a match, do not modify match_first below. */ p_match_first = NULL; if (!fl_longest_match) break; } } } if (p_match_first) *p_match_first += next_start_idx; return match_last; } /* Check NODE match the current context. */ static bool check_halt_node_context (const re_dfa_t *dfa, Idx node, unsigned int context) { re_token_type_t type = dfa->nodes[node].type; unsigned int constraint = dfa->nodes[node].constraint; if (type != END_OF_RE) return false; if (!constraint) return true; if (NOT_SATISFY_NEXT_CONSTRAINT (constraint, context)) return false; return true; } /* Check the halt state STATE match the current context. Return 0 if not match, if the node, STATE has, is a halt node and match the context, return the node. */ static Idx check_halt_state_context (const re_match_context_t *mctx, const re_dfastate_t *state, Idx idx) { Idx i; unsigned int context; DEBUG_ASSERT (state->halt); context = re_string_context_at (&mctx->input, idx, mctx->eflags); for (i = 0; i < state->nodes.nelem; ++i) if (check_halt_node_context (mctx->dfa, state->nodes.elems[i], context)) return state->nodes.elems[i]; return 0; } /* Compute the next node to which "NFA" transit from NODE("NFA" is a NFA corresponding to the DFA). Return the destination node, and update EPS_VIA_NODES; return -1 on match failure, -2 on error. */ static Idx proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, regmatch_t *prevregs, Idx *pidx, Idx node, re_node_set *eps_via_nodes, struct re_fail_stack_t *fs) { const re_dfa_t *const dfa = mctx->dfa; if (IS_EPSILON_NODE (dfa->nodes[node].type)) { re_node_set *cur_nodes = &mctx->state_log[*pidx]->nodes; re_node_set *edests = &dfa->edests[node]; if (! re_node_set_contains (eps_via_nodes, node)) { bool ok = re_node_set_insert (eps_via_nodes, node); if (__glibc_unlikely (! ok)) return -2; } /* Pick a valid destination, or return -1 if none is found. */ Idx dest_node = -1; for (Idx i = 0; i < edests->nelem; i++) { Idx candidate = edests->elems[i]; if (!re_node_set_contains (cur_nodes, candidate)) continue; if (dest_node == -1) dest_node = candidate; else { /* In order to avoid infinite loop like "(a*)*", return the second epsilon-transition if the first was already considered. */ if (re_node_set_contains (eps_via_nodes, dest_node)) return candidate; /* Otherwise, push the second epsilon-transition on the fail stack. */ else if (fs != NULL && push_fail_stack (fs, *pidx, candidate, nregs, regs, prevregs, eps_via_nodes)) return -2; /* We know we are going to exit. */ break; } } return dest_node; } else { Idx naccepted = 0; re_token_type_t type = dfa->nodes[node].type; #ifdef RE_ENABLE_I18N if (dfa->nodes[node].accept_mb) naccepted = check_node_accept_bytes (dfa, node, &mctx->input, *pidx); else #endif /* RE_ENABLE_I18N */ if (type == OP_BACK_REF) { Idx subexp_idx = dfa->nodes[node].opr.idx + 1; if (subexp_idx < nregs) naccepted = regs[subexp_idx].rm_eo - regs[subexp_idx].rm_so; if (fs != NULL) { if (subexp_idx >= nregs || regs[subexp_idx].rm_so == -1 || regs[subexp_idx].rm_eo == -1) return -1; else if (naccepted) { char *buf = (char *) re_string_get_buffer (&mctx->input); if (mctx->input.valid_len - *pidx < naccepted || (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, naccepted) != 0)) return -1; } } if (naccepted == 0) { Idx dest_node; bool ok = re_node_set_insert (eps_via_nodes, node); if (__glibc_unlikely (! ok)) return -2; dest_node = dfa->edests[node].elems[0]; if (re_node_set_contains (&mctx->state_log[*pidx]->nodes, dest_node)) return dest_node; } } if (naccepted != 0 || check_node_accept (mctx, dfa->nodes + node, *pidx)) { Idx dest_node = dfa->nexts[node]; *pidx = (naccepted == 0) ? *pidx + 1 : *pidx + naccepted; if (fs && (*pidx > mctx->match_last || mctx->state_log[*pidx] == NULL || !re_node_set_contains (&mctx->state_log[*pidx]->nodes, dest_node))) return -1; re_node_set_empty (eps_via_nodes); return dest_node; } } return -1; } static reg_errcode_t __attribute_warn_unused_result__ push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, Idx nregs, regmatch_t *regs, regmatch_t *prevregs, re_node_set *eps_via_nodes) { reg_errcode_t err; Idx num = fs->num++; if (fs->num == fs->alloc) { struct re_fail_stack_ent_t *new_array; new_array = re_realloc (fs->stack, struct re_fail_stack_ent_t, fs->alloc * 2); if (new_array == NULL) return REG_ESPACE; fs->alloc *= 2; fs->stack = new_array; } fs->stack[num].idx = str_idx; fs->stack[num].node = dest_node; fs->stack[num].regs = re_malloc (regmatch_t, 2 * nregs); if (fs->stack[num].regs == NULL) return REG_ESPACE; memcpy (fs->stack[num].regs, regs, sizeof (regmatch_t) * nregs); memcpy (fs->stack[num].regs + nregs, prevregs, sizeof (regmatch_t) * nregs); err = re_node_set_init_copy (&fs->stack[num].eps_via_nodes, eps_via_nodes); return err; } static Idx pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs, regmatch_t *regs, regmatch_t *prevregs, re_node_set *eps_via_nodes) { if (fs == NULL || fs->num == 0) return -1; Idx num = --fs->num; *pidx = fs->stack[num].idx; memcpy (regs, fs->stack[num].regs, sizeof (regmatch_t) * nregs); memcpy (prevregs, fs->stack[num].regs + nregs, sizeof (regmatch_t) * nregs); re_node_set_free (eps_via_nodes); re_free (fs->stack[num].regs); *eps_via_nodes = fs->stack[num].eps_via_nodes; DEBUG_ASSERT (0 <= fs->stack[num].node); return fs->stack[num].node; } #define DYNARRAY_STRUCT regmatch_list #define DYNARRAY_ELEMENT regmatch_t #define DYNARRAY_PREFIX regmatch_list_ #include /* Set the positions where the subexpressions are starts/ends to registers PMATCH. Note: We assume that pmatch[0] is already set, and pmatch[i].rm_so == pmatch[i].rm_eo == -1 for 0 < i < nmatch. */ static reg_errcode_t __attribute_warn_unused_result__ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, regmatch_t *pmatch, bool fl_backtrack) { const re_dfa_t *dfa = preg->buffer; Idx idx, cur_node; re_node_set eps_via_nodes; struct re_fail_stack_t *fs; struct re_fail_stack_t fs_body = { 0, 2, NULL }; struct regmatch_list prev_match; regmatch_list_init (&prev_match); DEBUG_ASSERT (nmatch > 1); DEBUG_ASSERT (mctx->state_log != NULL); if (fl_backtrack) { fs = &fs_body; fs->stack = re_malloc (struct re_fail_stack_ent_t, fs->alloc); if (fs->stack == NULL) return REG_ESPACE; } else fs = NULL; cur_node = dfa->init_node; re_node_set_init_empty (&eps_via_nodes); if (!regmatch_list_resize (&prev_match, nmatch)) { regmatch_list_free (&prev_match); free_fail_stack_return (fs); return REG_ESPACE; } regmatch_t *prev_idx_match = regmatch_list_begin (&prev_match); memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;) { update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch); if ((idx == pmatch[0].rm_eo && cur_node == mctx->last_node) || (fs && re_node_set_contains (&eps_via_nodes, cur_node))) { Idx reg_idx; cur_node = -1; if (fs) { for (reg_idx = 0; reg_idx < nmatch; ++reg_idx) if (pmatch[reg_idx].rm_so > -1 && pmatch[reg_idx].rm_eo == -1) { cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch, prev_idx_match, &eps_via_nodes); break; } } if (cur_node < 0) { re_node_set_free (&eps_via_nodes); regmatch_list_free (&prev_match); return free_fail_stack_return (fs); } } /* Proceed to next node. */ cur_node = proceed_next_node (mctx, nmatch, pmatch, prev_idx_match, &idx, cur_node, &eps_via_nodes, fs); if (__glibc_unlikely (cur_node < 0)) { if (__glibc_unlikely (cur_node == -2)) { re_node_set_free (&eps_via_nodes); regmatch_list_free (&prev_match); free_fail_stack_return (fs); return REG_ESPACE; } cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch, prev_idx_match, &eps_via_nodes); if (cur_node < 0) { re_node_set_free (&eps_via_nodes); regmatch_list_free (&prev_match); free_fail_stack_return (fs); return REG_NOMATCH; } } } re_node_set_free (&eps_via_nodes); regmatch_list_free (&prev_match); return free_fail_stack_return (fs); } static reg_errcode_t free_fail_stack_return (struct re_fail_stack_t *fs) { if (fs) { Idx fs_idx; for (fs_idx = 0; fs_idx < fs->num; ++fs_idx) { re_node_set_free (&fs->stack[fs_idx].eps_via_nodes); re_free (fs->stack[fs_idx].regs); } re_free (fs->stack); } return REG_NOERROR; } static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, regmatch_t *prev_idx_match, Idx cur_node, Idx cur_idx, Idx nmatch) { int type = dfa->nodes[cur_node].type; if (type == OP_OPEN_SUBEXP) { Idx reg_num = dfa->nodes[cur_node].opr.idx + 1; /* We are at the first node of this sub expression. */ if (reg_num < nmatch) { pmatch[reg_num].rm_so = cur_idx; pmatch[reg_num].rm_eo = -1; } } else if (type == OP_CLOSE_SUBEXP) { /* We are at the last node of this sub expression. */ Idx reg_num = dfa->nodes[cur_node].opr.idx + 1; if (reg_num < nmatch) { if (pmatch[reg_num].rm_so < cur_idx) { pmatch[reg_num].rm_eo = cur_idx; /* This is a non-empty match or we are not inside an optional subexpression. Accept this right away. */ memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); } else { if (dfa->nodes[cur_node].opt_subexp && prev_idx_match[reg_num].rm_so != -1) /* We transited through an empty match for an optional subexpression, like (a?)*, and this is not the subexp's first match. Copy back the old content of the registers so that matches of an inner subexpression are undone as well, like in ((a?))*. */ memcpy (pmatch, prev_idx_match, sizeof (regmatch_t) * nmatch); else /* We completed a subexpression, but it may be part of an optional one, so do not update PREV_IDX_MATCH. */ pmatch[reg_num].rm_eo = cur_idx; } } } } /* This function checks the STATE_LOG from the SCTX->last_str_idx to 0 and sift the nodes in each states according to the following rules. Updated state_log will be wrote to STATE_LOG. Rules: We throw away the Node 'a' in the STATE_LOG[STR_IDX] if... 1. When STR_IDX == MATCH_LAST(the last index in the state_log): If 'a' isn't the LAST_NODE and 'a' can't epsilon transit to the LAST_NODE, we throw away the node 'a'. 2. When 0 <= STR_IDX < MATCH_LAST and 'a' accepts string 's' and transit to 'b': i. If 'b' isn't in the STATE_LOG[STR_IDX+strlen('s')], we throw away the node 'a'. ii. If 'b' is in the STATE_LOG[STR_IDX+strlen('s')] but 'b' is thrown away, we throw away the node 'a'. 3. When 0 <= STR_IDX < MATCH_LAST and 'a' epsilon transit to 'b': i. If 'b' isn't in the STATE_LOG[STR_IDX], we throw away the node 'a'. ii. If 'b' is in the STATE_LOG[STR_IDX] but 'b' is thrown away, we throw away the node 'a'. */ #define STATE_NODE_CONTAINS(state,node) \ ((state) != NULL && re_node_set_contains (&(state)->nodes, node)) static reg_errcode_t sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx) { reg_errcode_t err; int null_cnt = 0; Idx str_idx = sctx->last_str_idx; re_node_set cur_dest; DEBUG_ASSERT (mctx->state_log != NULL && mctx->state_log[str_idx] != NULL); /* Build sifted state_log[str_idx]. It has the nodes which can epsilon transit to the last_node and the last_node itself. */ err = re_node_set_init_1 (&cur_dest, sctx->last_node); if (__glibc_unlikely (err != REG_NOERROR)) return err; err = update_cur_sifted_state (mctx, sctx, str_idx, &cur_dest); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; /* Then check each states in the state_log. */ while (str_idx > 0) { /* Update counters. */ null_cnt = (sctx->sifted_states[str_idx] == NULL) ? null_cnt + 1 : 0; if (null_cnt > mctx->max_mb_elem_len) { memset (sctx->sifted_states, '\0', sizeof (re_dfastate_t *) * str_idx); re_node_set_free (&cur_dest); return REG_NOERROR; } re_node_set_empty (&cur_dest); --str_idx; if (mctx->state_log[str_idx]) { err = build_sifted_states (mctx, sctx, str_idx, &cur_dest); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; } /* Add all the nodes which satisfy the following conditions: - It can epsilon transit to a node in CUR_DEST. - It is in CUR_SRC. And update state_log. */ err = update_cur_sifted_state (mctx, sctx, str_idx, &cur_dest); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; } err = REG_NOERROR; free_return: re_node_set_free (&cur_dest); return err; } static reg_errcode_t __attribute_warn_unused_result__ build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, re_node_set *cur_dest) { const re_dfa_t *const dfa = mctx->dfa; const re_node_set *cur_src = &mctx->state_log[str_idx]->non_eps_nodes; Idx i; /* Then build the next sifted state. We build the next sifted state on 'cur_dest', and update 'sifted_states[str_idx]' with 'cur_dest'. Note: 'cur_dest' is the sifted state from 'state_log[str_idx + 1]'. 'cur_src' points the node_set of the old 'state_log[str_idx]' (with the epsilon nodes pre-filtered out). */ for (i = 0; i < cur_src->nelem; i++) { Idx prev_node = cur_src->elems[i]; int naccepted = 0; bool ok; DEBUG_ASSERT (!IS_EPSILON_NODE (dfa->nodes[prev_node].type)); #ifdef RE_ENABLE_I18N /* If the node may accept "multi byte". */ if (dfa->nodes[prev_node].accept_mb) naccepted = sift_states_iter_mb (mctx, sctx, prev_node, str_idx, sctx->last_str_idx); #endif /* RE_ENABLE_I18N */ /* We don't check backreferences here. See update_cur_sifted_state(). */ if (!naccepted && check_node_accept (mctx, dfa->nodes + prev_node, str_idx) && STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + 1], dfa->nexts[prev_node])) naccepted = 1; if (naccepted == 0) continue; if (sctx->limits.nelem) { Idx to_idx = str_idx + naccepted; if (check_dst_limits (mctx, &sctx->limits, dfa->nexts[prev_node], to_idx, prev_node, str_idx)) continue; } ok = re_node_set_insert (cur_dest, prev_node); if (__glibc_unlikely (! ok)) return REG_ESPACE; } return REG_NOERROR; } /* Helper functions. */ static reg_errcode_t clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx) { Idx top = mctx->state_log_top; if ((next_state_log_idx >= mctx->input.bufs_len && mctx->input.bufs_len < mctx->input.len) || (next_state_log_idx >= mctx->input.valid_len && mctx->input.valid_len < mctx->input.len)) { reg_errcode_t err; err = extend_buffers (mctx, next_state_log_idx + 1); if (__glibc_unlikely (err != REG_NOERROR)) return err; } if (top < next_state_log_idx) { memset (mctx->state_log + top + 1, '\0', sizeof (re_dfastate_t *) * (next_state_log_idx - top)); mctx->state_log_top = next_state_log_idx; } return REG_NOERROR; } static reg_errcode_t merge_state_array (const re_dfa_t *dfa, re_dfastate_t **dst, re_dfastate_t **src, Idx num) { Idx st_idx; reg_errcode_t err; for (st_idx = 0; st_idx < num; ++st_idx) { if (dst[st_idx] == NULL) dst[st_idx] = src[st_idx]; else if (src[st_idx] != NULL) { re_node_set merged_set; err = re_node_set_init_union (&merged_set, &dst[st_idx]->nodes, &src[st_idx]->nodes); if (__glibc_unlikely (err != REG_NOERROR)) return err; dst[st_idx] = re_acquire_state (&err, dfa, &merged_set); re_node_set_free (&merged_set); if (__glibc_unlikely (err != REG_NOERROR)) return err; } } return REG_NOERROR; } static reg_errcode_t update_cur_sifted_state (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, re_node_set *dest_nodes) { const re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err = REG_NOERROR; const re_node_set *candidates; candidates = ((mctx->state_log[str_idx] == NULL) ? NULL : &mctx->state_log[str_idx]->nodes); if (dest_nodes->nelem == 0) sctx->sifted_states[str_idx] = NULL; else { if (candidates) { /* At first, add the nodes which can epsilon transit to a node in DEST_NODE. */ err = add_epsilon_src_nodes (dfa, dest_nodes, candidates); if (__glibc_unlikely (err != REG_NOERROR)) return err; /* Then, check the limitations in the current sift_context. */ if (sctx->limits.nelem) { err = check_subexp_limits (dfa, dest_nodes, candidates, &sctx->limits, mctx->bkref_ents, str_idx); if (__glibc_unlikely (err != REG_NOERROR)) return err; } } sctx->sifted_states[str_idx] = re_acquire_state (&err, dfa, dest_nodes); if (__glibc_unlikely (err != REG_NOERROR)) return err; } if (candidates && mctx->state_log[str_idx]->has_backref) { err = sift_states_bkref (mctx, sctx, str_idx, candidates); if (__glibc_unlikely (err != REG_NOERROR)) return err; } return REG_NOERROR; } static reg_errcode_t __attribute_warn_unused_result__ add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates) { reg_errcode_t err = REG_NOERROR; Idx i; re_dfastate_t *state = re_acquire_state (&err, dfa, dest_nodes); if (__glibc_unlikely (err != REG_NOERROR)) return err; if (!state->inveclosure.alloc) { err = re_node_set_alloc (&state->inveclosure, dest_nodes->nelem); if (__glibc_unlikely (err != REG_NOERROR)) return REG_ESPACE; for (i = 0; i < dest_nodes->nelem; i++) { err = re_node_set_merge (&state->inveclosure, dfa->inveclosures + dest_nodes->elems[i]); if (__glibc_unlikely (err != REG_NOERROR)) return REG_ESPACE; } } return re_node_set_add_intersect (dest_nodes, candidates, &state->inveclosure); } static reg_errcode_t sub_epsilon_src_nodes (const re_dfa_t *dfa, Idx node, re_node_set *dest_nodes, const re_node_set *candidates) { Idx ecl_idx; reg_errcode_t err; re_node_set *inv_eclosure = dfa->inveclosures + node; re_node_set except_nodes; re_node_set_init_empty (&except_nodes); for (ecl_idx = 0; ecl_idx < inv_eclosure->nelem; ++ecl_idx) { Idx cur_node = inv_eclosure->elems[ecl_idx]; if (cur_node == node) continue; if (IS_EPSILON_NODE (dfa->nodes[cur_node].type)) { Idx edst1 = dfa->edests[cur_node].elems[0]; Idx edst2 = ((dfa->edests[cur_node].nelem > 1) ? dfa->edests[cur_node].elems[1] : -1); if ((!re_node_set_contains (inv_eclosure, edst1) && re_node_set_contains (dest_nodes, edst1)) || (edst2 > 0 && !re_node_set_contains (inv_eclosure, edst2) && re_node_set_contains (dest_nodes, edst2))) { err = re_node_set_add_intersect (&except_nodes, candidates, dfa->inveclosures + cur_node); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&except_nodes); return err; } } } } for (ecl_idx = 0; ecl_idx < inv_eclosure->nelem; ++ecl_idx) { Idx cur_node = inv_eclosure->elems[ecl_idx]; if (!re_node_set_contains (&except_nodes, cur_node)) { Idx idx = re_node_set_contains (dest_nodes, cur_node) - 1; re_node_set_remove_at (dest_nodes, idx); } } re_node_set_free (&except_nodes); return REG_NOERROR; } static bool check_dst_limits (const re_match_context_t *mctx, const re_node_set *limits, Idx dst_node, Idx dst_idx, Idx src_node, Idx src_idx) { const re_dfa_t *const dfa = mctx->dfa; Idx lim_idx, src_pos, dst_pos; Idx dst_bkref_idx = search_cur_bkref_entry (mctx, dst_idx); Idx src_bkref_idx = search_cur_bkref_entry (mctx, src_idx); for (lim_idx = 0; lim_idx < limits->nelem; ++lim_idx) { Idx subexp_idx; struct re_backref_cache_entry *ent; ent = mctx->bkref_ents + limits->elems[lim_idx]; subexp_idx = dfa->nodes[ent->node].opr.idx; dst_pos = check_dst_limits_calc_pos (mctx, limits->elems[lim_idx], subexp_idx, dst_node, dst_idx, dst_bkref_idx); src_pos = check_dst_limits_calc_pos (mctx, limits->elems[lim_idx], subexp_idx, src_node, src_idx, src_bkref_idx); /* In case of: ( ) ( ) ( ) */ if (src_pos == dst_pos) continue; /* This is unrelated limitation. */ else return true; } return false; } static int check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries, Idx subexp_idx, Idx from_node, Idx bkref_idx) { const re_dfa_t *const dfa = mctx->dfa; const re_node_set *eclosures = dfa->eclosures + from_node; Idx node_idx; /* Else, we are on the boundary: examine the nodes on the epsilon closure. */ for (node_idx = 0; node_idx < eclosures->nelem; ++node_idx) { Idx node = eclosures->elems[node_idx]; switch (dfa->nodes[node].type) { case OP_BACK_REF: if (bkref_idx != -1) { struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx; do { Idx dst; int cpos; if (ent->node != node) continue; if (subexp_idx < BITSET_WORD_BITS && !(ent->eps_reachable_subexps_map & ((bitset_word_t) 1 << subexp_idx))) continue; /* Recurse trying to reach the OP_OPEN_SUBEXP and OP_CLOSE_SUBEXP cases below. But, if the destination node is the same node as the source node, don't recurse because it would cause an infinite loop: a regex that exhibits this behavior is ()\1*\1* */ dst = dfa->edests[node].elems[0]; if (dst == from_node) { if (boundaries & 1) return -1; else /* if (boundaries & 2) */ return 0; } cpos = check_dst_limits_calc_pos_1 (mctx, boundaries, subexp_idx, dst, bkref_idx); if (cpos == -1 /* && (boundaries & 1) */) return -1; if (cpos == 0 && (boundaries & 2)) return 0; if (subexp_idx < BITSET_WORD_BITS) ent->eps_reachable_subexps_map &= ~((bitset_word_t) 1 << subexp_idx); } while (ent++->more); } break; case OP_OPEN_SUBEXP: if ((boundaries & 1) && subexp_idx == dfa->nodes[node].opr.idx) return -1; break; case OP_CLOSE_SUBEXP: if ((boundaries & 2) && subexp_idx == dfa->nodes[node].opr.idx) return 0; break; default: break; } } return (boundaries & 2) ? 1 : 0; } static int check_dst_limits_calc_pos (const re_match_context_t *mctx, Idx limit, Idx subexp_idx, Idx from_node, Idx str_idx, Idx bkref_idx) { struct re_backref_cache_entry *lim = mctx->bkref_ents + limit; int boundaries; /* If we are outside the range of the subexpression, return -1 or 1. */ if (str_idx < lim->subexp_from) return -1; if (lim->subexp_to < str_idx) return 1; /* If we are within the subexpression, return 0. */ boundaries = (str_idx == lim->subexp_from); boundaries |= (str_idx == lim->subexp_to) << 1; if (boundaries == 0) return 0; /* Else, examine epsilon closure. */ return check_dst_limits_calc_pos_1 (mctx, boundaries, subexp_idx, from_node, bkref_idx); } /* Check the limitations of sub expressions LIMITS, and remove the nodes which are against limitations from DEST_NODES. */ static reg_errcode_t check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates, re_node_set *limits, struct re_backref_cache_entry *bkref_ents, Idx str_idx) { reg_errcode_t err; Idx node_idx, lim_idx; for (lim_idx = 0; lim_idx < limits->nelem; ++lim_idx) { Idx subexp_idx; struct re_backref_cache_entry *ent; ent = bkref_ents + limits->elems[lim_idx]; if (str_idx <= ent->subexp_from || ent->str_idx < str_idx) continue; /* This is unrelated limitation. */ subexp_idx = dfa->nodes[ent->node].opr.idx; if (ent->subexp_to == str_idx) { Idx ops_node = -1; Idx cls_node = -1; for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { Idx node = dest_nodes->elems[node_idx]; re_token_type_t type = dfa->nodes[node].type; if (type == OP_OPEN_SUBEXP && subexp_idx == dfa->nodes[node].opr.idx) ops_node = node; else if (type == OP_CLOSE_SUBEXP && subexp_idx == dfa->nodes[node].opr.idx) cls_node = node; } /* Check the limitation of the open subexpression. */ /* Note that (ent->subexp_to = str_idx != ent->subexp_from). */ if (ops_node >= 0) { err = sub_epsilon_src_nodes (dfa, ops_node, dest_nodes, candidates); if (__glibc_unlikely (err != REG_NOERROR)) return err; } /* Check the limitation of the close subexpression. */ if (cls_node >= 0) for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { Idx node = dest_nodes->elems[node_idx]; if (!re_node_set_contains (dfa->inveclosures + node, cls_node) && !re_node_set_contains (dfa->eclosures + node, cls_node)) { /* It is against this limitation. Remove it form the current sifted state. */ err = sub_epsilon_src_nodes (dfa, node, dest_nodes, candidates); if (__glibc_unlikely (err != REG_NOERROR)) return err; --node_idx; } } } else /* (ent->subexp_to != str_idx) */ { for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { Idx node = dest_nodes->elems[node_idx]; re_token_type_t type = dfa->nodes[node].type; if (type == OP_CLOSE_SUBEXP || type == OP_OPEN_SUBEXP) { if (subexp_idx != dfa->nodes[node].opr.idx) continue; /* It is against this limitation. Remove it form the current sifted state. */ err = sub_epsilon_src_nodes (dfa, node, dest_nodes, candidates); if (__glibc_unlikely (err != REG_NOERROR)) return err; } } } } return REG_NOERROR; } static reg_errcode_t __attribute_warn_unused_result__ sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, const re_node_set *candidates) { const re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; Idx node_idx, node; re_sift_context_t local_sctx; Idx first_idx = search_cur_bkref_entry (mctx, str_idx); if (first_idx == -1) return REG_NOERROR; local_sctx.sifted_states = NULL; /* Mark that it hasn't been initialized. */ for (node_idx = 0; node_idx < candidates->nelem; ++node_idx) { Idx enabled_idx; re_token_type_t type; struct re_backref_cache_entry *entry; node = candidates->elems[node_idx]; type = dfa->nodes[node].type; /* Avoid infinite loop for the REs like "()\1+". */ if (node == sctx->last_node && str_idx == sctx->last_str_idx) continue; if (type != OP_BACK_REF) continue; entry = mctx->bkref_ents + first_idx; enabled_idx = first_idx; do { Idx subexp_len; Idx to_idx; Idx dst_node; bool ok; re_dfastate_t *cur_state; if (entry->node != node) continue; subexp_len = entry->subexp_to - entry->subexp_from; to_idx = str_idx + subexp_len; dst_node = (subexp_len ? dfa->nexts[node] : dfa->edests[node].elems[0]); if (to_idx > sctx->last_str_idx || sctx->sifted_states[to_idx] == NULL || !STATE_NODE_CONTAINS (sctx->sifted_states[to_idx], dst_node) || check_dst_limits (mctx, &sctx->limits, node, str_idx, dst_node, to_idx)) continue; if (local_sctx.sifted_states == NULL) { local_sctx = *sctx; err = re_node_set_init_copy (&local_sctx.limits, &sctx->limits); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; } local_sctx.last_node = node; local_sctx.last_str_idx = str_idx; ok = re_node_set_insert (&local_sctx.limits, enabled_idx); if (__glibc_unlikely (! ok)) { err = REG_ESPACE; goto free_return; } cur_state = local_sctx.sifted_states[str_idx]; err = sift_states_backward (mctx, &local_sctx); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; if (sctx->limited_states != NULL) { err = merge_state_array (dfa, sctx->limited_states, local_sctx.sifted_states, str_idx + 1); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; } local_sctx.sifted_states[str_idx] = cur_state; re_node_set_remove (&local_sctx.limits, enabled_idx); /* mctx->bkref_ents may have changed, reload the pointer. */ entry = mctx->bkref_ents + enabled_idx; } while (enabled_idx++, entry++->more); } err = REG_NOERROR; free_return: if (local_sctx.sifted_states != NULL) { re_node_set_free (&local_sctx.limits); } return err; } #ifdef RE_ENABLE_I18N static int sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx node_idx, Idx str_idx, Idx max_str_idx) { const re_dfa_t *const dfa = mctx->dfa; int naccepted; /* Check the node can accept "multi byte". */ naccepted = check_node_accept_bytes (dfa, node_idx, &mctx->input, str_idx); if (naccepted > 0 && str_idx + naccepted <= max_str_idx && !STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted], dfa->nexts[node_idx])) /* The node can't accept the "multi byte", or the destination was already thrown away, then the node couldn't accept the current input "multi byte". */ naccepted = 0; /* Otherwise, it is sure that the node could accept 'naccepted' bytes input. */ return naccepted; } #endif /* RE_ENABLE_I18N */ /* Functions for state transition. */ /* Return the next state to which the current state STATE will transit by accepting the current input byte, and update STATE_LOG if necessary. Return NULL on failure. If STATE can accept a multibyte char/collating element/back reference update the destination of STATE_LOG. */ static re_dfastate_t * __attribute_warn_unused_result__ transit_state (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *state) { re_dfastate_t **trtable; unsigned char ch; #ifdef RE_ENABLE_I18N /* If the current state can accept multibyte. */ if (__glibc_unlikely (state->accept_mb)) { *err = transit_state_mb (mctx, state); if (__glibc_unlikely (*err != REG_NOERROR)) return NULL; } #endif /* RE_ENABLE_I18N */ /* Then decide the next state with the single byte. */ #if 0 if (0) /* don't use transition table */ return transit_state_sb (err, mctx, state); #endif /* Use transition table */ ch = re_string_fetch_byte (&mctx->input); for (;;) { trtable = state->trtable; if (__glibc_likely (trtable != NULL)) return trtable[ch]; trtable = state->word_trtable; if (__glibc_likely (trtable != NULL)) { unsigned int context; context = re_string_context_at (&mctx->input, re_string_cur_idx (&mctx->input) - 1, mctx->eflags); if (IS_WORD_CONTEXT (context)) return trtable[ch + SBC_MAX]; else return trtable[ch]; } if (!build_trtable (mctx->dfa, state)) { *err = REG_ESPACE; return NULL; } /* Retry, we now have a transition table. */ } } /* Update the state_log if we need */ static re_dfastate_t * merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *next_state) { const re_dfa_t *const dfa = mctx->dfa; Idx cur_idx = re_string_cur_idx (&mctx->input); if (cur_idx > mctx->state_log_top) { mctx->state_log[cur_idx] = next_state; mctx->state_log_top = cur_idx; } else if (mctx->state_log[cur_idx] == 0) { mctx->state_log[cur_idx] = next_state; } else { re_dfastate_t *pstate; unsigned int context; re_node_set next_nodes, *log_nodes, *table_nodes = NULL; /* If (state_log[cur_idx] != 0), it implies that cur_idx is the destination of a multibyte char/collating element/ back reference. Then the next state is the union set of these destinations and the results of the transition table. */ pstate = mctx->state_log[cur_idx]; log_nodes = pstate->entrance_nodes; if (next_state != NULL) { table_nodes = next_state->entrance_nodes; *err = re_node_set_init_union (&next_nodes, table_nodes, log_nodes); if (__glibc_unlikely (*err != REG_NOERROR)) return NULL; } else next_nodes = *log_nodes; /* Note: We already add the nodes of the initial state, then we don't need to add them here. */ context = re_string_context_at (&mctx->input, re_string_cur_idx (&mctx->input) - 1, mctx->eflags); next_state = mctx->state_log[cur_idx] = re_acquire_state_context (err, dfa, &next_nodes, context); /* We don't need to check errors here, since the return value of this function is next_state and ERR is already set. */ if (table_nodes != NULL) re_node_set_free (&next_nodes); } if (__glibc_unlikely (dfa->nbackref) && next_state != NULL) { /* Check OP_OPEN_SUBEXP in the current state in case that we use them later. We must check them here, since the back references in the next state might use them. */ *err = check_subexp_matching_top (mctx, &next_state->nodes, cur_idx); if (__glibc_unlikely (*err != REG_NOERROR)) return NULL; /* If the next state has back references. */ if (next_state->has_backref) { *err = transit_state_bkref (mctx, &next_state->nodes); if (__glibc_unlikely (*err != REG_NOERROR)) return NULL; next_state = mctx->state_log[cur_idx]; } } return next_state; } /* Skip bytes in the input that correspond to part of a multi-byte match, then look in the log for a state from which to restart matching. */ static re_dfastate_t * find_recover_state (reg_errcode_t *err, re_match_context_t *mctx) { re_dfastate_t *cur_state; do { Idx max = mctx->state_log_top; Idx cur_str_idx = re_string_cur_idx (&mctx->input); do { if (++cur_str_idx > max) return NULL; re_string_skip_bytes (&mctx->input, 1); } while (mctx->state_log[cur_str_idx] == NULL); cur_state = merge_state_with_log (err, mctx, NULL); } while (*err == REG_NOERROR && cur_state == NULL); return cur_state; } /* Helper functions for transit_state. */ /* From the node set CUR_NODES, pick up the nodes whose types are OP_OPEN_SUBEXP and which have corresponding back references in the regular expression. And register them to use them later for evaluating the corresponding back references. */ static reg_errcode_t check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes, Idx str_idx) { const re_dfa_t *const dfa = mctx->dfa; Idx node_idx; reg_errcode_t err; /* TODO: This isn't efficient. Because there might be more than one nodes whose types are OP_OPEN_SUBEXP and whose index is SUBEXP_IDX, we must check all nodes. E.g. RE: (a){2} */ for (node_idx = 0; node_idx < cur_nodes->nelem; ++node_idx) { Idx node = cur_nodes->elems[node_idx]; if (dfa->nodes[node].type == OP_OPEN_SUBEXP && dfa->nodes[node].opr.idx < BITSET_WORD_BITS && (dfa->used_bkref_map & ((bitset_word_t) 1 << dfa->nodes[node].opr.idx))) { err = match_ctx_add_subtop (mctx, node, str_idx); if (__glibc_unlikely (err != REG_NOERROR)) return err; } } return REG_NOERROR; } #if 0 /* Return the next state to which the current state STATE will transit by accepting the current input byte. Return NULL on failure. */ static re_dfastate_t * transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *state) { const re_dfa_t *const dfa = mctx->dfa; re_node_set next_nodes; re_dfastate_t *next_state; Idx node_cnt, cur_str_idx = re_string_cur_idx (&mctx->input); unsigned int context; *err = re_node_set_alloc (&next_nodes, state->nodes.nelem + 1); if (__glibc_unlikely (*err != REG_NOERROR)) return NULL; for (node_cnt = 0; node_cnt < state->nodes.nelem; ++node_cnt) { Idx cur_node = state->nodes.elems[node_cnt]; if (check_node_accept (mctx, dfa->nodes + cur_node, cur_str_idx)) { *err = re_node_set_merge (&next_nodes, dfa->eclosures + dfa->nexts[cur_node]); if (__glibc_unlikely (*err != REG_NOERROR)) { re_node_set_free (&next_nodes); return NULL; } } } context = re_string_context_at (&mctx->input, cur_str_idx, mctx->eflags); next_state = re_acquire_state_context (err, dfa, &next_nodes, context); /* We don't need to check errors here, since the return value of this function is next_state and ERR is already set. */ re_node_set_free (&next_nodes); re_string_skip_bytes (&mctx->input, 1); return next_state; } #endif #ifdef RE_ENABLE_I18N static reg_errcode_t transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate) { const re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; Idx i; for (i = 0; i < pstate->nodes.nelem; ++i) { re_node_set dest_nodes, *new_nodes; Idx cur_node_idx = pstate->nodes.elems[i]; int naccepted; Idx dest_idx; unsigned int context; re_dfastate_t *dest_state; if (!dfa->nodes[cur_node_idx].accept_mb) continue; if (dfa->nodes[cur_node_idx].constraint) { context = re_string_context_at (&mctx->input, re_string_cur_idx (&mctx->input), mctx->eflags); if (NOT_SATISFY_NEXT_CONSTRAINT (dfa->nodes[cur_node_idx].constraint, context)) continue; } /* How many bytes the node can accept? */ naccepted = check_node_accept_bytes (dfa, cur_node_idx, &mctx->input, re_string_cur_idx (&mctx->input)); if (naccepted == 0) continue; /* The node can accepts 'naccepted' bytes. */ dest_idx = re_string_cur_idx (&mctx->input) + naccepted; mctx->max_mb_elem_len = ((mctx->max_mb_elem_len < naccepted) ? naccepted : mctx->max_mb_elem_len); err = clean_state_log_if_needed (mctx, dest_idx); if (__glibc_unlikely (err != REG_NOERROR)) return err; DEBUG_ASSERT (dfa->nexts[cur_node_idx] != -1); new_nodes = dfa->eclosures + dfa->nexts[cur_node_idx]; dest_state = mctx->state_log[dest_idx]; if (dest_state == NULL) dest_nodes = *new_nodes; else { err = re_node_set_init_union (&dest_nodes, dest_state->entrance_nodes, new_nodes); if (__glibc_unlikely (err != REG_NOERROR)) return err; } context = re_string_context_at (&mctx->input, dest_idx - 1, mctx->eflags); mctx->state_log[dest_idx] = re_acquire_state_context (&err, dfa, &dest_nodes, context); if (dest_state != NULL) re_node_set_free (&dest_nodes); if (__glibc_unlikely (mctx->state_log[dest_idx] == NULL && err != REG_NOERROR)) return err; } return REG_NOERROR; } #endif /* RE_ENABLE_I18N */ static reg_errcode_t transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes) { const re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; Idx i; Idx cur_str_idx = re_string_cur_idx (&mctx->input); for (i = 0; i < nodes->nelem; ++i) { Idx dest_str_idx, prev_nelem, bkc_idx; Idx node_idx = nodes->elems[i]; unsigned int context; const re_token_t *node = dfa->nodes + node_idx; re_node_set *new_dest_nodes; /* Check whether 'node' is a backreference or not. */ if (node->type != OP_BACK_REF) continue; if (node->constraint) { context = re_string_context_at (&mctx->input, cur_str_idx, mctx->eflags); if (NOT_SATISFY_NEXT_CONSTRAINT (node->constraint, context)) continue; } /* 'node' is a backreference. Check the substring which the substring matched. */ bkc_idx = mctx->nbkref_ents; err = get_subexp (mctx, node_idx, cur_str_idx); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; /* And add the epsilon closures (which is 'new_dest_nodes') of the backreference to appropriate state_log. */ DEBUG_ASSERT (dfa->nexts[node_idx] != -1); for (; bkc_idx < mctx->nbkref_ents; ++bkc_idx) { Idx subexp_len; re_dfastate_t *dest_state; struct re_backref_cache_entry *bkref_ent; bkref_ent = mctx->bkref_ents + bkc_idx; if (bkref_ent->node != node_idx || bkref_ent->str_idx != cur_str_idx) continue; subexp_len = bkref_ent->subexp_to - bkref_ent->subexp_from; new_dest_nodes = (subexp_len == 0 ? dfa->eclosures + dfa->edests[node_idx].elems[0] : dfa->eclosures + dfa->nexts[node_idx]); dest_str_idx = (cur_str_idx + bkref_ent->subexp_to - bkref_ent->subexp_from); context = re_string_context_at (&mctx->input, dest_str_idx - 1, mctx->eflags); dest_state = mctx->state_log[dest_str_idx]; prev_nelem = ((mctx->state_log[cur_str_idx] == NULL) ? 0 : mctx->state_log[cur_str_idx]->nodes.nelem); /* Add 'new_dest_node' to state_log. */ if (dest_state == NULL) { mctx->state_log[dest_str_idx] = re_acquire_state_context (&err, dfa, new_dest_nodes, context); if (__glibc_unlikely (mctx->state_log[dest_str_idx] == NULL && err != REG_NOERROR)) goto free_return; } else { re_node_set dest_nodes; err = re_node_set_init_union (&dest_nodes, dest_state->entrance_nodes, new_dest_nodes); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&dest_nodes); goto free_return; } mctx->state_log[dest_str_idx] = re_acquire_state_context (&err, dfa, &dest_nodes, context); re_node_set_free (&dest_nodes); if (__glibc_unlikely (mctx->state_log[dest_str_idx] == NULL && err != REG_NOERROR)) goto free_return; } /* We need to check recursively if the backreference can epsilon transit. */ if (subexp_len == 0 && mctx->state_log[cur_str_idx]->nodes.nelem > prev_nelem) { err = check_subexp_matching_top (mctx, new_dest_nodes, cur_str_idx); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; err = transit_state_bkref (mctx, new_dest_nodes); if (__glibc_unlikely (err != REG_NOERROR)) goto free_return; } } } err = REG_NOERROR; free_return: return err; } /* Enumerate all the candidates which the backreference BKREF_NODE can match at BKREF_STR_IDX, and register them by match_ctx_add_entry(). Note that we might collect inappropriate candidates here. However, the cost of checking them strictly here is too high, then we delay these checking for prune_impossible_nodes(). */ static reg_errcode_t __attribute_warn_unused_result__ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) { const re_dfa_t *const dfa = mctx->dfa; Idx subexp_num, sub_top_idx; const char *buf = (const char *) re_string_get_buffer (&mctx->input); /* Return if we have already checked BKREF_NODE at BKREF_STR_IDX. */ Idx cache_idx = search_cur_bkref_entry (mctx, bkref_str_idx); if (cache_idx != -1) { const struct re_backref_cache_entry *entry = mctx->bkref_ents + cache_idx; do if (entry->node == bkref_node) return REG_NOERROR; /* We already checked it. */ while (entry++->more); } subexp_num = dfa->nodes[bkref_node].opr.idx; /* For each sub expression */ for (sub_top_idx = 0; sub_top_idx < mctx->nsub_tops; ++sub_top_idx) { reg_errcode_t err; re_sub_match_top_t *sub_top = mctx->sub_tops[sub_top_idx]; re_sub_match_last_t *sub_last; Idx sub_last_idx, sl_str, bkref_str_off; if (dfa->nodes[sub_top->node].opr.idx != subexp_num) continue; /* It isn't related. */ sl_str = sub_top->str_idx; bkref_str_off = bkref_str_idx; /* At first, check the last node of sub expressions we already evaluated. */ for (sub_last_idx = 0; sub_last_idx < sub_top->nlasts; ++sub_last_idx) { regoff_t sl_str_diff; sub_last = sub_top->lasts[sub_last_idx]; sl_str_diff = sub_last->str_idx - sl_str; /* The matched string by the sub expression match with the substring at the back reference? */ if (sl_str_diff > 0) { if (__glibc_unlikely (bkref_str_off + sl_str_diff > mctx->input.valid_len)) { /* Not enough chars for a successful match. */ if (bkref_str_off + sl_str_diff > mctx->input.len) break; err = clean_state_log_if_needed (mctx, bkref_str_off + sl_str_diff); if (__glibc_unlikely (err != REG_NOERROR)) return err; buf = (const char *) re_string_get_buffer (&mctx->input); } if (memcmp (buf + bkref_str_off, buf + sl_str, sl_str_diff) != 0) /* We don't need to search this sub expression any more. */ break; } bkref_str_off += sl_str_diff; sl_str += sl_str_diff; err = get_subexp_sub (mctx, sub_top, sub_last, bkref_node, bkref_str_idx); /* Reload buf, since the preceding call might have reallocated the buffer. */ buf = (const char *) re_string_get_buffer (&mctx->input); if (err == REG_NOMATCH) continue; if (__glibc_unlikely (err != REG_NOERROR)) return err; } if (sub_last_idx < sub_top->nlasts) continue; if (sub_last_idx > 0) ++sl_str; /* Then, search for the other last nodes of the sub expression. */ for (; sl_str <= bkref_str_idx; ++sl_str) { Idx cls_node; regoff_t sl_str_off; const re_node_set *nodes; sl_str_off = sl_str - sub_top->str_idx; /* The matched string by the sub expression match with the substring at the back reference? */ if (sl_str_off > 0) { if (__glibc_unlikely (bkref_str_off >= mctx->input.valid_len)) { /* If we are at the end of the input, we cannot match. */ if (bkref_str_off >= mctx->input.len) break; err = extend_buffers (mctx, bkref_str_off + 1); if (__glibc_unlikely (err != REG_NOERROR)) return err; buf = (const char *) re_string_get_buffer (&mctx->input); } if (buf [bkref_str_off++] != buf[sl_str - 1]) break; /* We don't need to search this sub expression any more. */ } if (mctx->state_log[sl_str] == NULL) continue; /* Does this state have a ')' of the sub expression? */ nodes = &mctx->state_log[sl_str]->nodes; cls_node = find_subexp_node (dfa, nodes, subexp_num, OP_CLOSE_SUBEXP); if (cls_node == -1) continue; /* No. */ if (sub_top->path == NULL) { sub_top->path = calloc (sizeof (state_array_t), sl_str - sub_top->str_idx + 1); if (sub_top->path == NULL) return REG_ESPACE; } /* Can the OP_OPEN_SUBEXP node arrive the OP_CLOSE_SUBEXP node in the current context? */ err = check_arrival (mctx, sub_top->path, sub_top->node, sub_top->str_idx, cls_node, sl_str, OP_CLOSE_SUBEXP); if (err == REG_NOMATCH) continue; if (__glibc_unlikely (err != REG_NOERROR)) return err; sub_last = match_ctx_add_sublast (sub_top, cls_node, sl_str); if (__glibc_unlikely (sub_last == NULL)) return REG_ESPACE; err = get_subexp_sub (mctx, sub_top, sub_last, bkref_node, bkref_str_idx); buf = (const char *) re_string_get_buffer (&mctx->input); if (err == REG_NOMATCH) continue; if (__glibc_unlikely (err != REG_NOERROR)) return err; } } return REG_NOERROR; } /* Helper functions for get_subexp(). */ /* Check SUB_LAST can arrive to the back reference BKREF_NODE at BKREF_STR. If it can arrive, register the sub expression expressed with SUB_TOP and SUB_LAST. */ static reg_errcode_t get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top, re_sub_match_last_t *sub_last, Idx bkref_node, Idx bkref_str) { reg_errcode_t err; Idx to_idx; /* Can the subexpression arrive the back reference? */ err = check_arrival (mctx, &sub_last->path, sub_last->node, sub_last->str_idx, bkref_node, bkref_str, OP_OPEN_SUBEXP); if (err != REG_NOERROR) return err; err = match_ctx_add_entry (mctx, bkref_node, bkref_str, sub_top->str_idx, sub_last->str_idx); if (__glibc_unlikely (err != REG_NOERROR)) return err; to_idx = bkref_str + sub_last->str_idx - sub_top->str_idx; return clean_state_log_if_needed (mctx, to_idx); } /* Find the first node which is '(' or ')' and whose index is SUBEXP_IDX. Search '(' if FL_OPEN, or search ')' otherwise. TODO: This function isn't efficient... Because there might be more than one nodes whose types are OP_OPEN_SUBEXP and whose index is SUBEXP_IDX, we must check all nodes. E.g. RE: (a){2} */ static Idx find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, Idx subexp_idx, int type) { Idx cls_idx; for (cls_idx = 0; cls_idx < nodes->nelem; ++cls_idx) { Idx cls_node = nodes->elems[cls_idx]; const re_token_t *node = dfa->nodes + cls_node; if (node->type == type && node->opr.idx == subexp_idx) return cls_node; } return -1; } /* Check whether the node TOP_NODE at TOP_STR can arrive to the node LAST_NODE at LAST_STR. We record the path onto PATH since it will be heavily reused. Return REG_NOERROR if it can arrive, REG_NOMATCH if it cannot, REG_ESPACE if memory is exhausted. */ static reg_errcode_t __attribute_warn_unused_result__ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, Idx top_str, Idx last_node, Idx last_str, int type) { const re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err = REG_NOERROR; Idx subexp_num, backup_cur_idx, str_idx, null_cnt; re_dfastate_t *cur_state = NULL; re_node_set *cur_nodes, next_nodes; re_dfastate_t **backup_state_log; unsigned int context; subexp_num = dfa->nodes[top_node].opr.idx; /* Extend the buffer if we need. */ if (__glibc_unlikely (path->alloc < last_str + mctx->max_mb_elem_len + 1)) { re_dfastate_t **new_array; Idx old_alloc = path->alloc; Idx incr_alloc = last_str + mctx->max_mb_elem_len + 1; Idx new_alloc; if (__glibc_unlikely (IDX_MAX - old_alloc < incr_alloc)) return REG_ESPACE; new_alloc = old_alloc + incr_alloc; if (__glibc_unlikely (SIZE_MAX / sizeof (re_dfastate_t *) < new_alloc)) return REG_ESPACE; new_array = re_realloc (path->array, re_dfastate_t *, new_alloc); if (__glibc_unlikely (new_array == NULL)) return REG_ESPACE; path->array = new_array; path->alloc = new_alloc; memset (new_array + old_alloc, '\0', sizeof (re_dfastate_t *) * (path->alloc - old_alloc)); } str_idx = path->next_idx ? path->next_idx : top_str; /* Temporary modify MCTX. */ backup_state_log = mctx->state_log; backup_cur_idx = mctx->input.cur_idx; mctx->state_log = path->array; mctx->input.cur_idx = str_idx; /* Setup initial node set. */ context = re_string_context_at (&mctx->input, str_idx - 1, mctx->eflags); if (str_idx == top_str) { err = re_node_set_init_1 (&next_nodes, top_node); if (__glibc_unlikely (err != REG_NOERROR)) return err; err = check_arrival_expand_ecl (dfa, &next_nodes, subexp_num, type); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&next_nodes); return err; } } else { cur_state = mctx->state_log[str_idx]; if (cur_state && cur_state->has_backref) { err = re_node_set_init_copy (&next_nodes, &cur_state->nodes); if (__glibc_unlikely (err != REG_NOERROR)) return err; } else re_node_set_init_empty (&next_nodes); } if (str_idx == top_str || (cur_state && cur_state->has_backref)) { if (next_nodes.nelem) { err = expand_bkref_cache (mctx, &next_nodes, str_idx, subexp_num, type); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&next_nodes); return err; } } cur_state = re_acquire_state_context (&err, dfa, &next_nodes, context); if (__glibc_unlikely (cur_state == NULL && err != REG_NOERROR)) { re_node_set_free (&next_nodes); return err; } mctx->state_log[str_idx] = cur_state; } for (null_cnt = 0; str_idx < last_str && null_cnt <= mctx->max_mb_elem_len;) { re_node_set_empty (&next_nodes); if (mctx->state_log[str_idx + 1]) { err = re_node_set_merge (&next_nodes, &mctx->state_log[str_idx + 1]->nodes); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&next_nodes); return err; } } if (cur_state) { err = check_arrival_add_next_nodes (mctx, str_idx, &cur_state->non_eps_nodes, &next_nodes); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&next_nodes); return err; } } ++str_idx; if (next_nodes.nelem) { err = check_arrival_expand_ecl (dfa, &next_nodes, subexp_num, type); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&next_nodes); return err; } err = expand_bkref_cache (mctx, &next_nodes, str_idx, subexp_num, type); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&next_nodes); return err; } } context = re_string_context_at (&mctx->input, str_idx - 1, mctx->eflags); cur_state = re_acquire_state_context (&err, dfa, &next_nodes, context); if (__glibc_unlikely (cur_state == NULL && err != REG_NOERROR)) { re_node_set_free (&next_nodes); return err; } mctx->state_log[str_idx] = cur_state; null_cnt = cur_state == NULL ? null_cnt + 1 : 0; } re_node_set_free (&next_nodes); cur_nodes = (mctx->state_log[last_str] == NULL ? NULL : &mctx->state_log[last_str]->nodes); path->next_idx = str_idx; /* Fix MCTX. */ mctx->state_log = backup_state_log; mctx->input.cur_idx = backup_cur_idx; /* Then check the current node set has the node LAST_NODE. */ if (cur_nodes != NULL && re_node_set_contains (cur_nodes, last_node)) return REG_NOERROR; return REG_NOMATCH; } /* Helper functions for check_arrival. */ /* Calculate the destination nodes of CUR_NODES at STR_IDX, and append them to NEXT_NODES. TODO: This function is similar to the functions transit_state*(), however this function has many additional works. Can't we unify them? */ static reg_errcode_t __attribute_warn_unused_result__ check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx, re_node_set *cur_nodes, re_node_set *next_nodes) { const re_dfa_t *const dfa = mctx->dfa; bool ok; Idx cur_idx; #ifdef RE_ENABLE_I18N reg_errcode_t err = REG_NOERROR; #endif re_node_set union_set; re_node_set_init_empty (&union_set); for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx) { int naccepted = 0; Idx cur_node = cur_nodes->elems[cur_idx]; DEBUG_ASSERT (!IS_EPSILON_NODE (dfa->nodes[cur_node].type)); #ifdef RE_ENABLE_I18N /* If the node may accept "multi byte". */ if (dfa->nodes[cur_node].accept_mb) { naccepted = check_node_accept_bytes (dfa, cur_node, &mctx->input, str_idx); if (naccepted > 1) { re_dfastate_t *dest_state; Idx next_node = dfa->nexts[cur_node]; Idx next_idx = str_idx + naccepted; dest_state = mctx->state_log[next_idx]; re_node_set_empty (&union_set); if (dest_state) { err = re_node_set_merge (&union_set, &dest_state->nodes); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&union_set); return err; } } ok = re_node_set_insert (&union_set, next_node); if (__glibc_unlikely (! ok)) { re_node_set_free (&union_set); return REG_ESPACE; } mctx->state_log[next_idx] = re_acquire_state (&err, dfa, &union_set); if (__glibc_unlikely (mctx->state_log[next_idx] == NULL && err != REG_NOERROR)) { re_node_set_free (&union_set); return err; } } } #endif /* RE_ENABLE_I18N */ if (naccepted || check_node_accept (mctx, dfa->nodes + cur_node, str_idx)) { ok = re_node_set_insert (next_nodes, dfa->nexts[cur_node]); if (__glibc_unlikely (! ok)) { re_node_set_free (&union_set); return REG_ESPACE; } } } re_node_set_free (&union_set); return REG_NOERROR; } /* For all the nodes in CUR_NODES, add the epsilon closures of them to CUR_NODES, however exclude the nodes which are: - inside the sub expression whose number is EX_SUBEXP, if FL_OPEN. - out of the sub expression whose number is EX_SUBEXP, if !FL_OPEN. */ static reg_errcode_t check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes, Idx ex_subexp, int type) { reg_errcode_t err; Idx idx, outside_node; re_node_set new_nodes; DEBUG_ASSERT (cur_nodes->nelem); err = re_node_set_alloc (&new_nodes, cur_nodes->nelem); if (__glibc_unlikely (err != REG_NOERROR)) return err; /* Create a new node set NEW_NODES with the nodes which are epsilon closures of the node in CUR_NODES. */ for (idx = 0; idx < cur_nodes->nelem; ++idx) { Idx cur_node = cur_nodes->elems[idx]; const re_node_set *eclosure = dfa->eclosures + cur_node; outside_node = find_subexp_node (dfa, eclosure, ex_subexp, type); if (outside_node == -1) { /* There are no problematic nodes, just merge them. */ err = re_node_set_merge (&new_nodes, eclosure); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&new_nodes); return err; } } else { /* There are problematic nodes, re-calculate incrementally. */ err = check_arrival_expand_ecl_sub (dfa, &new_nodes, cur_node, ex_subexp, type); if (__glibc_unlikely (err != REG_NOERROR)) { re_node_set_free (&new_nodes); return err; } } } re_node_set_free (cur_nodes); *cur_nodes = new_nodes; return REG_NOERROR; } /* Helper function for check_arrival_expand_ecl. Check incrementally the epsilon closure of TARGET, and if it isn't problematic append it to DST_NODES. */ static reg_errcode_t __attribute_warn_unused_result__ check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes, Idx target, Idx ex_subexp, int type) { Idx cur_node; for (cur_node = target; !re_node_set_contains (dst_nodes, cur_node);) { bool ok; if (dfa->nodes[cur_node].type == type && dfa->nodes[cur_node].opr.idx == ex_subexp) { if (type == OP_CLOSE_SUBEXP) { ok = re_node_set_insert (dst_nodes, cur_node); if (__glibc_unlikely (! ok)) return REG_ESPACE; } break; } ok = re_node_set_insert (dst_nodes, cur_node); if (__glibc_unlikely (! ok)) return REG_ESPACE; if (dfa->edests[cur_node].nelem == 0) break; if (dfa->edests[cur_node].nelem == 2) { reg_errcode_t err; err = check_arrival_expand_ecl_sub (dfa, dst_nodes, dfa->edests[cur_node].elems[1], ex_subexp, type); if (__glibc_unlikely (err != REG_NOERROR)) return err; } cur_node = dfa->edests[cur_node].elems[0]; } return REG_NOERROR; } /* For all the back references in the current state, calculate the destination of the back references by the appropriate entry in MCTX->BKREF_ENTS. */ static reg_errcode_t __attribute_warn_unused_result__ expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes, Idx cur_str, Idx subexp_num, int type) { const re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; Idx cache_idx_start = search_cur_bkref_entry (mctx, cur_str); struct re_backref_cache_entry *ent; if (cache_idx_start == -1) return REG_NOERROR; restart: ent = mctx->bkref_ents + cache_idx_start; do { Idx to_idx, next_node; /* Is this entry ENT is appropriate? */ if (!re_node_set_contains (cur_nodes, ent->node)) continue; /* No. */ to_idx = cur_str + ent->subexp_to - ent->subexp_from; /* Calculate the destination of the back reference, and append it to MCTX->STATE_LOG. */ if (to_idx == cur_str) { /* The backreference did epsilon transit, we must re-check all the node in the current state. */ re_node_set new_dests; reg_errcode_t err2, err3; next_node = dfa->edests[ent->node].elems[0]; if (re_node_set_contains (cur_nodes, next_node)) continue; err = re_node_set_init_1 (&new_dests, next_node); err2 = check_arrival_expand_ecl (dfa, &new_dests, subexp_num, type); err3 = re_node_set_merge (cur_nodes, &new_dests); re_node_set_free (&new_dests); if (__glibc_unlikely (err != REG_NOERROR || err2 != REG_NOERROR || err3 != REG_NOERROR)) { err = (err != REG_NOERROR ? err : (err2 != REG_NOERROR ? err2 : err3)); return err; } /* TODO: It is still inefficient... */ goto restart; } else { re_node_set union_set; next_node = dfa->nexts[ent->node]; if (mctx->state_log[to_idx]) { bool ok; if (re_node_set_contains (&mctx->state_log[to_idx]->nodes, next_node)) continue; err = re_node_set_init_copy (&union_set, &mctx->state_log[to_idx]->nodes); ok = re_node_set_insert (&union_set, next_node); if (__glibc_unlikely (err != REG_NOERROR || ! ok)) { re_node_set_free (&union_set); err = err != REG_NOERROR ? err : REG_ESPACE; return err; } } else { err = re_node_set_init_1 (&union_set, next_node); if (__glibc_unlikely (err != REG_NOERROR)) return err; } mctx->state_log[to_idx] = re_acquire_state (&err, dfa, &union_set); re_node_set_free (&union_set); if (__glibc_unlikely (mctx->state_log[to_idx] == NULL && err != REG_NOERROR)) return err; } } while (ent++->more); return REG_NOERROR; } /* Build transition table for the state. Return true if successful. */ static bool __attribute_noinline__ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) { reg_errcode_t err; Idx i, j; int ch; bool need_word_trtable = false; bitset_word_t elem, mask; Idx ndests; /* Number of the destination states from 'state'. */ re_dfastate_t **trtable; re_dfastate_t *dest_states[SBC_MAX]; re_dfastate_t *dest_states_word[SBC_MAX]; re_dfastate_t *dest_states_nl[SBC_MAX]; re_node_set follows; bitset_t acceptable; /* We build DFA states which corresponds to the destination nodes from 'state'. 'dests_node[i]' represents the nodes which i-th destination state contains, and 'dests_ch[i]' represents the characters which i-th destination state accepts. */ re_node_set dests_node[SBC_MAX]; bitset_t dests_ch[SBC_MAX]; /* Initialize transition table. */ state->word_trtable = state->trtable = NULL; /* At first, group all nodes belonging to 'state' into several destinations. */ ndests = group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch); if (__glibc_unlikely (ndests <= 0)) { /* Return false in case of an error, true otherwise. */ if (ndests == 0) { state->trtable = (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); if (__glibc_unlikely (state->trtable == NULL)) return false; return true; } return false; } err = re_node_set_alloc (&follows, ndests + 1); if (__glibc_unlikely (err != REG_NOERROR)) { out_free: re_node_set_free (&follows); for (i = 0; i < ndests; ++i) re_node_set_free (dests_node + i); return false; } bitset_empty (acceptable); /* Then build the states for all destinations. */ for (i = 0; i < ndests; ++i) { Idx next_node; re_node_set_empty (&follows); /* Merge the follows of this destination states. */ for (j = 0; j < dests_node[i].nelem; ++j) { next_node = dfa->nexts[dests_node[i].elems[j]]; if (next_node != -1) { err = re_node_set_merge (&follows, dfa->eclosures + next_node); if (__glibc_unlikely (err != REG_NOERROR)) goto out_free; } } dest_states[i] = re_acquire_state_context (&err, dfa, &follows, 0); if (__glibc_unlikely (dest_states[i] == NULL && err != REG_NOERROR)) goto out_free; /* If the new state has context constraint, build appropriate states for these contexts. */ if (dest_states[i]->has_constraint) { dest_states_word[i] = re_acquire_state_context (&err, dfa, &follows, CONTEXT_WORD); if (__glibc_unlikely (dest_states_word[i] == NULL && err != REG_NOERROR)) goto out_free; if (dest_states[i] != dest_states_word[i] && dfa->mb_cur_max > 1) need_word_trtable = true; dest_states_nl[i] = re_acquire_state_context (&err, dfa, &follows, CONTEXT_NEWLINE); if (__glibc_unlikely (dest_states_nl[i] == NULL && err != REG_NOERROR)) goto out_free; } else { dest_states_word[i] = dest_states[i]; dest_states_nl[i] = dest_states[i]; } bitset_merge (acceptable, dests_ch[i]); } if (!__glibc_unlikely (need_word_trtable)) { /* We don't care about whether the following character is a word character, or we are in a single-byte character set so we can discern by looking at the character code: allocate a 256-entry transition table. */ trtable = state->trtable = (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); if (__glibc_unlikely (trtable == NULL)) goto out_free; /* For all characters ch...: */ for (i = 0; i < BITSET_WORDS; ++i) for (ch = i * BITSET_WORD_BITS, elem = acceptable[i], mask = 1; elem; mask <<= 1, elem >>= 1, ++ch) if (__glibc_unlikely (elem & 1)) { /* There must be exactly one destination which accepts character ch. See group_nodes_into_DFAstates. */ for (j = 0; (dests_ch[j][i] & mask) == 0; ++j) ; /* j-th destination accepts the word character ch. */ if (dfa->word_char[i] & mask) trtable[ch] = dest_states_word[j]; else trtable[ch] = dest_states[j]; } } else { /* We care about whether the following character is a word character, and we are in a multi-byte character set: discern by looking at the character code: build two 256-entry transition tables, one starting at trtable[0] and one starting at trtable[SBC_MAX]. */ trtable = state->word_trtable = (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX); if (__glibc_unlikely (trtable == NULL)) goto out_free; /* For all characters ch...: */ for (i = 0; i < BITSET_WORDS; ++i) for (ch = i * BITSET_WORD_BITS, elem = acceptable[i], mask = 1; elem; mask <<= 1, elem >>= 1, ++ch) if (__glibc_unlikely (elem & 1)) { /* There must be exactly one destination which accepts character ch. See group_nodes_into_DFAstates. */ for (j = 0; (dests_ch[j][i] & mask) == 0; ++j) ; /* j-th destination accepts the word character ch. */ trtable[ch] = dest_states[j]; trtable[ch + SBC_MAX] = dest_states_word[j]; } } /* new line */ if (bitset_contain (acceptable, NEWLINE_CHAR)) { /* The current state accepts newline character. */ for (j = 0; j < ndests; ++j) if (bitset_contain (dests_ch[j], NEWLINE_CHAR)) { /* k-th destination accepts newline character. */ trtable[NEWLINE_CHAR] = dest_states_nl[j]; if (need_word_trtable) trtable[NEWLINE_CHAR + SBC_MAX] = dest_states_nl[j]; /* There must be only one destination which accepts newline. See group_nodes_into_DFAstates. */ break; } } re_node_set_free (&follows); for (i = 0; i < ndests; ++i) re_node_set_free (dests_node + i); return true; } /* Group all nodes belonging to STATE into several destinations. Then for all destinations, set the nodes belonging to the destination to DESTS_NODE[i] and set the characters accepted by the destination to DEST_CH[i]. Return the number of destinations if successful, -1 on internal error. */ static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, re_node_set *dests_node, bitset_t *dests_ch) { reg_errcode_t err; bool ok; Idx i, j, k; Idx ndests; /* Number of the destinations from 'state'. */ bitset_t accepts; /* Characters a node can accept. */ const re_node_set *cur_nodes = &state->nodes; bitset_empty (accepts); ndests = 0; /* For all the nodes belonging to 'state', */ for (i = 0; i < cur_nodes->nelem; ++i) { re_token_t *node = &dfa->nodes[cur_nodes->elems[i]]; re_token_type_t type = node->type; unsigned int constraint = node->constraint; /* Enumerate all single byte character this node can accept. */ if (type == CHARACTER) bitset_set (accepts, node->opr.c); else if (type == SIMPLE_BRACKET) { bitset_merge (accepts, node->opr.sbcset); } else if (type == OP_PERIOD) { #ifdef RE_ENABLE_I18N if (dfa->mb_cur_max > 1) bitset_merge (accepts, dfa->sb_char); else #endif bitset_set_all (accepts); if (!(dfa->syntax & RE_DOT_NEWLINE)) bitset_clear (accepts, '\n'); if (dfa->syntax & RE_DOT_NOT_NULL) bitset_clear (accepts, '\0'); } #ifdef RE_ENABLE_I18N else if (type == OP_UTF8_PERIOD) { if (ASCII_CHARS % BITSET_WORD_BITS == 0) memset (accepts, -1, ASCII_CHARS / CHAR_BIT); else bitset_merge (accepts, utf8_sb_map); if (!(dfa->syntax & RE_DOT_NEWLINE)) bitset_clear (accepts, '\n'); if (dfa->syntax & RE_DOT_NOT_NULL) bitset_clear (accepts, '\0'); } #endif else continue; /* Check the 'accepts' and sift the characters which are not match it the context. */ if (constraint) { if (constraint & NEXT_NEWLINE_CONSTRAINT) { bool accepts_newline = bitset_contain (accepts, NEWLINE_CHAR); bitset_empty (accepts); if (accepts_newline) bitset_set (accepts, NEWLINE_CHAR); else continue; } if (constraint & NEXT_ENDBUF_CONSTRAINT) { bitset_empty (accepts); continue; } if (constraint & NEXT_WORD_CONSTRAINT) { bitset_word_t any_set = 0; if (type == CHARACTER && !node->word_char) { bitset_empty (accepts); continue; } #ifdef RE_ENABLE_I18N if (dfa->mb_cur_max > 1) for (j = 0; j < BITSET_WORDS; ++j) any_set |= (accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j])); else #endif for (j = 0; j < BITSET_WORDS; ++j) any_set |= (accepts[j] &= dfa->word_char[j]); if (!any_set) continue; } if (constraint & NEXT_NOTWORD_CONSTRAINT) { bitset_word_t any_set = 0; if (type == CHARACTER && node->word_char) { bitset_empty (accepts); continue; } #ifdef RE_ENABLE_I18N if (dfa->mb_cur_max > 1) for (j = 0; j < BITSET_WORDS; ++j) any_set |= (accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j])); else #endif for (j = 0; j < BITSET_WORDS; ++j) any_set |= (accepts[j] &= ~dfa->word_char[j]); if (!any_set) continue; } } /* Then divide 'accepts' into DFA states, or create a new state. Above, we make sure that accepts is not empty. */ for (j = 0; j < ndests; ++j) { bitset_t intersec; /* Intersection sets, see below. */ bitset_t remains; /* Flags, see below. */ bitset_word_t has_intersec, not_subset, not_consumed; /* Optimization, skip if this state doesn't accept the character. */ if (type == CHARACTER && !bitset_contain (dests_ch[j], node->opr.c)) continue; /* Enumerate the intersection set of this state and 'accepts'. */ has_intersec = 0; for (k = 0; k < BITSET_WORDS; ++k) has_intersec |= intersec[k] = accepts[k] & dests_ch[j][k]; /* And skip if the intersection set is empty. */ if (!has_intersec) continue; /* Then check if this state is a subset of 'accepts'. */ not_subset = not_consumed = 0; for (k = 0; k < BITSET_WORDS; ++k) { not_subset |= remains[k] = ~accepts[k] & dests_ch[j][k]; not_consumed |= accepts[k] = accepts[k] & ~dests_ch[j][k]; } /* If this state isn't a subset of 'accepts', create a new group state, which has the 'remains'. */ if (not_subset) { bitset_copy (dests_ch[ndests], remains); bitset_copy (dests_ch[j], intersec); err = re_node_set_init_copy (dests_node + ndests, &dests_node[j]); if (__glibc_unlikely (err != REG_NOERROR)) goto error_return; ++ndests; } /* Put the position in the current group. */ ok = re_node_set_insert (&dests_node[j], cur_nodes->elems[i]); if (__glibc_unlikely (! ok)) goto error_return; /* If all characters are consumed, go to next node. */ if (!not_consumed) break; } /* Some characters remain, create a new group. */ if (j == ndests) { bitset_copy (dests_ch[ndests], accepts); err = re_node_set_init_1 (dests_node + ndests, cur_nodes->elems[i]); if (__glibc_unlikely (err != REG_NOERROR)) goto error_return; ++ndests; bitset_empty (accepts); } } assume (ndests <= SBC_MAX); return ndests; error_return: for (j = 0; j < ndests; ++j) re_node_set_free (dests_node + j); return -1; } #ifdef RE_ENABLE_I18N /* Check how many bytes the node 'dfa->nodes[node_idx]' accepts. Return the number of the bytes the node accepts. STR_IDX is the current index of the input string. This function handles the nodes which can accept one character, or one collating element like '.', '[a-z]', opposite to the other nodes can only accept one byte. */ # ifdef _LIBC # include # endif static int check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, const re_string_t *input, Idx str_idx) { const re_token_t *node = dfa->nodes + node_idx; int char_len, elem_len; Idx i; if (__glibc_unlikely (node->type == OP_UTF8_PERIOD)) { unsigned char c = re_string_byte_at (input, str_idx), d; if (__glibc_likely (c < 0xc2)) return 0; if (str_idx + 2 > input->len) return 0; d = re_string_byte_at (input, str_idx + 1); if (c < 0xe0) return (d < 0x80 || d > 0xbf) ? 0 : 2; else if (c < 0xf0) { char_len = 3; if (c == 0xe0 && d < 0xa0) return 0; } else if (c < 0xf8) { char_len = 4; if (c == 0xf0 && d < 0x90) return 0; } else if (c < 0xfc) { char_len = 5; if (c == 0xf8 && d < 0x88) return 0; } else if (c < 0xfe) { char_len = 6; if (c == 0xfc && d < 0x84) return 0; } else return 0; if (str_idx + char_len > input->len) return 0; for (i = 1; i < char_len; ++i) { d = re_string_byte_at (input, str_idx + i); if (d < 0x80 || d > 0xbf) return 0; } return char_len; } char_len = re_string_char_size_at (input, str_idx); if (node->type == OP_PERIOD) { if (char_len <= 1) return 0; /* FIXME: I don't think this if is needed, as both '\n' and '\0' are char_len == 1. */ /* '.' accepts any one character except the following two cases. */ if ((!(dfa->syntax & RE_DOT_NEWLINE) && re_string_byte_at (input, str_idx) == '\n') || ((dfa->syntax & RE_DOT_NOT_NULL) && re_string_byte_at (input, str_idx) == '\0')) return 0; return char_len; } elem_len = re_string_elem_size_at (input, str_idx); if ((elem_len <= 1 && char_len <= 1) || char_len == 0) return 0; if (node->type == COMPLEX_BRACKET) { const re_charset_t *cset = node->opr.mbcset; # ifdef _LIBC const unsigned char *pin = ((const unsigned char *) re_string_get_buffer (input) + str_idx); Idx j; uint32_t nrules; # endif /* _LIBC */ int match_len = 0; wchar_t wc = ((cset->nranges || cset->nchar_classes || cset->nmbchars) ? re_string_wchar_at (input, str_idx) : 0); /* match with multibyte character? */ for (i = 0; i < cset->nmbchars; ++i) if (wc == cset->mbchars[i]) { match_len = char_len; goto check_node_accept_bytes_match; } /* match with character_class? */ for (i = 0; i < cset->nchar_classes; ++i) { wctype_t wt = cset->char_classes[i]; if (__iswctype (wc, wt)) { match_len = char_len; goto check_node_accept_bytes_match; } } # ifdef _LIBC nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules != 0) { unsigned int in_collseq = 0; const int32_t *table, *indirect; const unsigned char *weights, *extra; const char *collseqwc; /* match with collating_symbol? */ if (cset->ncoll_syms) extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB); for (i = 0; i < cset->ncoll_syms; ++i) { const unsigned char *coll_sym = extra + cset->coll_syms[i]; /* Compare the length of input collating element and the length of current collating element. */ if (*coll_sym != elem_len) continue; /* Compare each bytes. */ for (j = 0; j < *coll_sym; j++) if (pin[j] != coll_sym[1 + j]) break; if (j == *coll_sym) { /* Match if every bytes is equal. */ match_len = j; goto check_node_accept_bytes_match; } } if (cset->nranges) { if (elem_len <= char_len) { collseqwc = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQWC); in_collseq = __collseq_table_lookup (collseqwc, wc); } else in_collseq = find_collation_sequence_value (pin, elem_len); } /* match with range expression? */ /* FIXME: Implement rational ranges here, too. */ for (i = 0; i < cset->nranges; ++i) if (cset->range_starts[i] <= in_collseq && in_collseq <= cset->range_ends[i]) { match_len = elem_len; goto check_node_accept_bytes_match; } /* match with equivalence_class? */ if (cset->nequiv_classes) { const unsigned char *cp = pin; table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB); weights = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB); extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); int32_t idx = findidx (table, indirect, extra, &cp, elem_len); int32_t rule = idx >> 24; idx &= 0xffffff; if (idx > 0) { size_t weight_len = weights[idx]; for (i = 0; i < cset->nequiv_classes; ++i) { int32_t equiv_class_idx = cset->equiv_classes[i]; int32_t equiv_class_rule = equiv_class_idx >> 24; equiv_class_idx &= 0xffffff; if (weights[equiv_class_idx] == weight_len && equiv_class_rule == rule && memcmp (weights + idx + 1, weights + equiv_class_idx + 1, weight_len) == 0) { match_len = elem_len; goto check_node_accept_bytes_match; } } } } } else # endif /* _LIBC */ { /* match with range expression? */ for (i = 0; i < cset->nranges; ++i) { if (cset->range_starts[i] <= wc && wc <= cset->range_ends[i]) { match_len = char_len; goto check_node_accept_bytes_match; } } } check_node_accept_bytes_match: if (!cset->non_match) return match_len; else { if (match_len > 0) return 0; else return (elem_len > char_len) ? elem_len : char_len; } } return 0; } # ifdef _LIBC static unsigned int find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len) { uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules == 0) { if (mbs_len == 1) { /* No valid character. Match it as a single byte character. */ const unsigned char *collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB); return collseq[mbs[0]]; } return UINT_MAX; } else { int32_t idx; const unsigned char *extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB); int32_t extrasize = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB + 1) - extra; for (idx = 0; idx < extrasize;) { int mbs_cnt; bool found = false; int32_t elem_mbs_len; /* Skip the name of collating element name. */ idx = idx + extra[idx] + 1; elem_mbs_len = extra[idx++]; if (mbs_len == elem_mbs_len) { for (mbs_cnt = 0; mbs_cnt < elem_mbs_len; ++mbs_cnt) if (extra[idx + mbs_cnt] != mbs[mbs_cnt]) break; if (mbs_cnt == elem_mbs_len) /* Found the entry. */ found = true; } /* Skip the byte sequence of the collating element. */ idx += elem_mbs_len; /* Adjust for the alignment. */ idx = (idx + 3) & ~3; /* Skip the collation sequence value. */ idx += sizeof (uint32_t); /* Skip the wide char sequence of the collating element. */ idx = idx + sizeof (uint32_t) * (*(int32_t *) (extra + idx) + 1); /* If we found the entry, return the sequence value. */ if (found) return *(uint32_t *) (extra + idx); /* Skip the collation sequence value. */ idx += sizeof (uint32_t); } return UINT_MAX; } } # endif /* _LIBC */ #endif /* RE_ENABLE_I18N */ /* Check whether the node accepts the byte which is IDX-th byte of the INPUT. */ static bool check_node_accept (const re_match_context_t *mctx, const re_token_t *node, Idx idx) { unsigned char ch; ch = re_string_byte_at (&mctx->input, idx); switch (node->type) { case CHARACTER: if (node->opr.c != ch) return false; break; case SIMPLE_BRACKET: if (!bitset_contain (node->opr.sbcset, ch)) return false; break; #ifdef RE_ENABLE_I18N case OP_UTF8_PERIOD: if (ch >= ASCII_CHARS) return false; FALLTHROUGH; #endif case OP_PERIOD: if ((ch == '\n' && !(mctx->dfa->syntax & RE_DOT_NEWLINE)) || (ch == '\0' && (mctx->dfa->syntax & RE_DOT_NOT_NULL))) return false; break; default: return false; } if (node->constraint) { /* The node has constraints. Check whether the current context satisfies the constraints. */ unsigned int context = re_string_context_at (&mctx->input, idx, mctx->eflags); if (NOT_SATISFY_NEXT_CONSTRAINT (node->constraint, context)) return false; } return true; } /* Extend the buffers, if the buffers have run out. */ static reg_errcode_t __attribute_warn_unused_result__ extend_buffers (re_match_context_t *mctx, int min_len) { reg_errcode_t ret; re_string_t *pstr = &mctx->input; /* Avoid overflow. */ if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) / 2 <= pstr->bufs_len)) return REG_ESPACE; /* Double the lengths of the buffers, but allocate at least MIN_LEN. */ ret = re_string_realloc_buffers (pstr, MAX (min_len, MIN (pstr->len, pstr->bufs_len * 2))); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; if (mctx->state_log != NULL) { /* And double the length of state_log. */ /* XXX We have no indication of the size of this buffer. If this allocation fail we have no indication that the state_log array does not have the right size. */ re_dfastate_t **new_array = re_realloc (mctx->state_log, re_dfastate_t *, pstr->bufs_len + 1); if (__glibc_unlikely (new_array == NULL)) return REG_ESPACE; mctx->state_log = new_array; } /* Then reconstruct the buffers. */ if (pstr->icase) { #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1) { ret = build_wcs_upper_buffer (pstr); if (__glibc_unlikely (ret != REG_NOERROR)) return ret; } else #endif /* RE_ENABLE_I18N */ build_upper_buffer (pstr); } else { #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1) build_wcs_buffer (pstr); else #endif /* RE_ENABLE_I18N */ { if (pstr->trans != NULL) re_string_translate_buffer (pstr); } } return REG_NOERROR; } /* Functions for matching context. */ /* Initialize MCTX. */ static reg_errcode_t __attribute_warn_unused_result__ match_ctx_init (re_match_context_t *mctx, int eflags, Idx n) { mctx->eflags = eflags; mctx->match_last = -1; if (n > 0) { /* Avoid overflow. */ size_t max_object_size = MAX (sizeof (struct re_backref_cache_entry), sizeof (re_sub_match_top_t *)); if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / max_object_size) < n)) return REG_ESPACE; mctx->bkref_ents = re_malloc (struct re_backref_cache_entry, n); mctx->sub_tops = re_malloc (re_sub_match_top_t *, n); if (__glibc_unlikely (mctx->bkref_ents == NULL || mctx->sub_tops == NULL)) return REG_ESPACE; } /* Already zero-ed by the caller. else mctx->bkref_ents = NULL; mctx->nbkref_ents = 0; mctx->nsub_tops = 0; */ mctx->abkref_ents = n; mctx->max_mb_elem_len = 1; mctx->asub_tops = n; return REG_NOERROR; } /* Clean the entries which depend on the current input in MCTX. This function must be invoked when the matcher changes the start index of the input, or changes the input string. */ static void match_ctx_clean (re_match_context_t *mctx) { Idx st_idx; for (st_idx = 0; st_idx < mctx->nsub_tops; ++st_idx) { Idx sl_idx; re_sub_match_top_t *top = mctx->sub_tops[st_idx]; for (sl_idx = 0; sl_idx < top->nlasts; ++sl_idx) { re_sub_match_last_t *last = top->lasts[sl_idx]; re_free (last->path.array); re_free (last); } re_free (top->lasts); if (top->path) { re_free (top->path->array); re_free (top->path); } re_free (top); } mctx->nsub_tops = 0; mctx->nbkref_ents = 0; } /* Free all the memory associated with MCTX. */ static void match_ctx_free (re_match_context_t *mctx) { /* First, free all the memory associated with MCTX->SUB_TOPS. */ match_ctx_clean (mctx); re_free (mctx->sub_tops); re_free (mctx->bkref_ents); } /* Add a new backreference entry to MCTX. Note that we assume that caller never call this function with duplicate entry, and call with STR_IDX which isn't smaller than any existing entry. */ static reg_errcode_t __attribute_warn_unused_result__ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from, Idx to) { if (mctx->nbkref_ents >= mctx->abkref_ents) { struct re_backref_cache_entry* new_entry; new_entry = re_realloc (mctx->bkref_ents, struct re_backref_cache_entry, mctx->abkref_ents * 2); if (__glibc_unlikely (new_entry == NULL)) { re_free (mctx->bkref_ents); return REG_ESPACE; } mctx->bkref_ents = new_entry; memset (mctx->bkref_ents + mctx->nbkref_ents, '\0', sizeof (struct re_backref_cache_entry) * mctx->abkref_ents); mctx->abkref_ents *= 2; } if (mctx->nbkref_ents > 0 && mctx->bkref_ents[mctx->nbkref_ents - 1].str_idx == str_idx) mctx->bkref_ents[mctx->nbkref_ents - 1].more = 1; mctx->bkref_ents[mctx->nbkref_ents].node = node; mctx->bkref_ents[mctx->nbkref_ents].str_idx = str_idx; mctx->bkref_ents[mctx->nbkref_ents].subexp_from = from; mctx->bkref_ents[mctx->nbkref_ents].subexp_to = to; /* This is a cache that saves negative results of check_dst_limits_calc_pos. If bit N is clear, means that this entry won't epsilon-transition to an OP_OPEN_SUBEXP or OP_CLOSE_SUBEXP for the N+1-th subexpression. If it is set, check_dst_limits_calc_pos_1 will recurse and try to find one such node. A backreference does not epsilon-transition unless it is empty, so set to all zeros if FROM != TO. */ mctx->bkref_ents[mctx->nbkref_ents].eps_reachable_subexps_map = (from == to ? -1 : 0); mctx->bkref_ents[mctx->nbkref_ents++].more = 0; if (mctx->max_mb_elem_len < to - from) mctx->max_mb_elem_len = to - from; return REG_NOERROR; } /* Return the first entry with the same str_idx, or -1 if none is found. Note that MCTX->BKREF_ENTS is already sorted by MCTX->STR_IDX. */ static Idx search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx) { Idx left, right, mid, last; last = right = mctx->nbkref_ents; for (left = 0; left < right;) { mid = (left + right) / 2; if (mctx->bkref_ents[mid].str_idx < str_idx) left = mid + 1; else right = mid; } if (left < last && mctx->bkref_ents[left].str_idx == str_idx) return left; else return -1; } /* Register the node NODE, whose type is OP_OPEN_SUBEXP, and which matches at STR_IDX. */ static reg_errcode_t __attribute_warn_unused_result__ match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx) { DEBUG_ASSERT (mctx->sub_tops != NULL); DEBUG_ASSERT (mctx->asub_tops > 0); if (__glibc_unlikely (mctx->nsub_tops == mctx->asub_tops)) { Idx new_asub_tops = mctx->asub_tops * 2; re_sub_match_top_t **new_array = re_realloc (mctx->sub_tops, re_sub_match_top_t *, new_asub_tops); if (__glibc_unlikely (new_array == NULL)) return REG_ESPACE; mctx->sub_tops = new_array; mctx->asub_tops = new_asub_tops; } mctx->sub_tops[mctx->nsub_tops] = calloc (1, sizeof (re_sub_match_top_t)); if (__glibc_unlikely (mctx->sub_tops[mctx->nsub_tops] == NULL)) return REG_ESPACE; mctx->sub_tops[mctx->nsub_tops]->node = node; mctx->sub_tops[mctx->nsub_tops++]->str_idx = str_idx; return REG_NOERROR; } /* Register the node NODE, whose type is OP_CLOSE_SUBEXP, and which matches at STR_IDX, whose corresponding OP_OPEN_SUBEXP is SUB_TOP. Return the new entry if successful, NULL if memory is exhausted. */ static re_sub_match_last_t * match_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx) { re_sub_match_last_t *new_entry; if (__glibc_unlikely (subtop->nlasts == subtop->alasts)) { Idx new_alasts = 2 * subtop->alasts + 1; re_sub_match_last_t **new_array = re_realloc (subtop->lasts, re_sub_match_last_t *, new_alasts); if (__glibc_unlikely (new_array == NULL)) return NULL; subtop->lasts = new_array; subtop->alasts = new_alasts; } new_entry = calloc (1, sizeof (re_sub_match_last_t)); if (__glibc_likely (new_entry != NULL)) { subtop->lasts[subtop->nlasts] = new_entry; new_entry->node = node; new_entry->str_idx = str_idx; ++subtop->nlasts; } return new_entry; } static void sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts, re_dfastate_t **limited_sts, Idx last_node, Idx last_str_idx) { sctx->sifted_states = sifted_sts; sctx->limited_states = limited_sts; sctx->last_node = last_node; sctx->last_str_idx = last_str_idx; re_node_set_init_empty (&sctx->limits); } kbuild-3608/src/grep/lib/strtoll.c0000664000175000017500000000213014670377426017063 0ustar locutuslocutus/* Function to parse a 'long long int' from text. Copyright (C) 1995-1997, 1999, 2001, 2009-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #define QUAD 1 #include #ifdef _LIBC # ifdef SHARED # include # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) compat_symbol (libc, __strtoll_internal, __strtoq_internal, GLIBC_2_0); # endif # endif weak_alias (strtoll, strtoq) #endif kbuild-3608/src/grep/lib/getopt-pfx-ext.h0000664000175000017500000000536514670377423020272 0ustar locutuslocutus/* getopt (GNU extensions) gnulib wrapper header. Copyright (C) 1989-2021 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _GETOPT_PFX_EXT_H #define _GETOPT_PFX_EXT_H 1 /* This header should not be used directly; include getopt.h instead. It does not have a protective #error, because the guard macro for getopt.h in gnulib is not fixed. */ /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables defined in getopt-core.h and getopt-ext.h. Systematically rename identifiers so that they do not collide with the system functions and variables. Renaming avoids problems with some compilers and linkers. */ #ifdef __GETOPT_PREFIX # ifndef __GETOPT_ID # define __GETOPT_CONCAT(x, y) x ## y # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) # endif # undef getopt_long # undef getopt_long_only # undef option # undef _getopt_internal # define getopt_long __GETOPT_ID (getopt_long) # define getopt_long_only __GETOPT_ID (getopt_long_only) # define option __GETOPT_ID (option) # define _getopt_internal __GETOPT_ID (getopt_internal) /* The system's getopt.h may have already included getopt-ext.h to declare the unprefixed identifiers. Undef _GETOPT_EXT_H so that getopt-ext.h declares them with prefixes. */ # undef _GETOPT_EXT_H #endif /* Standalone applications get correct prototypes for getopt_long and getopt_long_only; they declare "char **argv". For backward compatibility with old applications, if __GETOPT_PREFIX is not defined, we supply GNU-libc-compatible, but incorrect, prototypes using "char *const *argv". (GNU libc is stuck with the incorrect prototypes, as they are baked into older versions of LSB.) */ #ifndef __getopt_argv_const # if defined __GETOPT_PREFIX # define __getopt_argv_const /* empty */ # else # define __getopt_argv_const const # endif #endif #include #endif /* _GETOPT_PFX_EXT_H */ kbuild-3608/src/grep/lib/xstrtol.h0000664000175000017500000000324514670377426017114 0ustar locutuslocutus/* A more useful interface to strtol. Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2021 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 . */ #ifndef XSTRTOL_H_ # define XSTRTOL_H_ 1 # include # ifndef _STRTOL_ERROR enum strtol_error { LONGINT_OK = 0, /* These two values can be ORed together, to indicate that both errors occurred. */ LONGINT_OVERFLOW = 1, LONGINT_INVALID_SUFFIX_CHAR = 2, LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW = (LONGINT_INVALID_SUFFIX_CHAR | LONGINT_OVERFLOW), LONGINT_INVALID = 4 }; typedef enum strtol_error strtol_error; # endif # define _DECLARE_XSTRTOL(name, type) \ strtol_error name (const char *, char **, int, type *, const char *); _DECLARE_XSTRTOL (xstrtol, long int) _DECLARE_XSTRTOL (xstrtoul, unsigned long int) _DECLARE_XSTRTOL (xstrtoll, long long int) _DECLARE_XSTRTOL (xstrtoull, unsigned long long int) _DECLARE_XSTRTOL (xstrtoimax, intmax_t) _DECLARE_XSTRTOL (xstrtoumax, uintmax_t) #endif /* not XSTRTOL_H_ */ kbuild-3608/src/grep/lib/binary-io.c0000664000175000017500000000250014670377423017247 0ustar locutuslocutus/* Binary mode I/O. Copyright 2017-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #define BINARY_IO_INLINE _GL_EXTERN_INLINE #include "binary-io.h" #if defined __DJGPP__ || defined __EMX__ # include int set_binary_mode (int fd, int mode) { if (isatty (fd)) /* If FD refers to a console (not a pipe, not a regular file), O_TEXT is the only reasonable mode, both on input and on output. Silently ignore the request. If we were to return -1 here, all programs that use xset_binary_mode would fail when run with console input or console output. */ return O_TEXT; else return __gl_setmode (fd, mode); } #endif kbuild-3608/src/grep/lib/getopt-pfx-core.h0000664000175000017500000000502414670377423020412 0ustar locutuslocutus/* getopt (basic, portable features) gnulib wrapper header. Copyright (C) 1989-2021 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _GETOPT_PFX_CORE_H #define _GETOPT_PFX_CORE_H 1 /* This header should not be used directly; include getopt.h or unistd.h instead. It does not have a protective #error, because the guard macro for getopt.h in gnulib is not fixed. */ /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables defined in getopt-core.h and getopt-ext.h. Systematically rename identifiers so that they do not collide with the system functions and variables. Renaming avoids problems with some compilers and linkers. */ #ifdef __GETOPT_PREFIX # ifndef __GETOPT_ID # define __GETOPT_CONCAT(x, y) x ## y # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) # endif # undef getopt # undef optarg # undef opterr # undef optind # undef optopt # define getopt __GETOPT_ID (getopt) # define optarg __GETOPT_ID (optarg) # define opterr __GETOPT_ID (opterr) # define optind __GETOPT_ID (optind) # define optopt __GETOPT_ID (optopt) /* Work around a a problem on macOS, which declares getopt with a trailing __DARWIN_ALIAS(getopt) that would expand to something like __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following hack to suppress the macOS declaration . */ # ifdef __APPLE__ # define _GETOPT # endif /* The system's getopt.h may have already included getopt-core.h to declare the unprefixed identifiers. Undef _GETOPT_CORE_H so that getopt-core.h declares them with prefixes. */ # undef _GETOPT_CORE_H #endif #include #endif /* _GETOPT_PFX_CORE_H */ kbuild-3608/src/grep/lib/str-two-way.h0000664000175000017500000004223214670377426017611 0ustar locutuslocutus/* Byte-wise substring search, using the Two-Way algorithm. Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Eric Blake , 2008. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Before including this file, you need to include and , and define: RETURN_TYPE A macro that expands to the return type. AVAILABLE(h, h_l, j, n_l) A macro that returns nonzero if there are at least N_L bytes left starting at H[J]. H is 'unsigned char *', H_L, J, and N_L are 'size_t'; H_L is an lvalue. For NUL-terminated searches, H_L can be modified each iteration to avoid having to compute the end of H up front. For case-insensitivity, you may optionally define: CMP_FUNC(p1, p2, l) A macro that returns 0 iff the first L characters of P1 and P2 are equal. CANON_ELEMENT(c) A macro that canonicalizes an element right after it has been fetched from one of the two strings. The argument is an 'unsigned char'; the result must be an 'unsigned char' as well. This file undefines the macros documented above, and defines LONG_NEEDLE_THRESHOLD. */ #include #include /* We use the Two-Way string matching algorithm (also known as Chrochemore-Perrin), which guarantees linear complexity with constant space. Additionally, for long needles, we also use a bad character shift table similar to the Boyer-Moore algorithm to achieve improved (potentially sub-linear) performance. See https://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260, https://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm, https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf */ /* Point at which computing a bad-byte shift table is likely to be worthwhile. Small needles should not compute a table, since it adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a speedup no greater than a factor of NEEDLE_LEN. The larger the needle, the better the potential performance gain. On the other hand, on non-POSIX systems with CHAR_BIT larger than eight, the memory required for the table is prohibitive. */ #if CHAR_BIT < 10 # define LONG_NEEDLE_THRESHOLD 32U #else # define LONG_NEEDLE_THRESHOLD SIZE_MAX #endif #ifndef MAX # define MAX(a, b) ((a < b) ? (b) : (a)) #endif #ifndef CANON_ELEMENT # define CANON_ELEMENT(c) c #endif #ifndef CMP_FUNC # define CMP_FUNC memcmp #endif /* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN. Return the index of the first byte in the right half, and set *PERIOD to the global period of the right half. The global period of a string is the smallest index (possibly its length) at which all remaining bytes in the string are repetitions of the prefix (the last repetition may be a subset of the prefix). When NEEDLE is factored into two halves, a local period is the length of the smallest word that shares a suffix with the left half and shares a prefix with the right half. All factorizations of a non-empty NEEDLE have a local period of at least 1 and no greater than NEEDLE_LEN. A critical factorization has the property that the local period equals the global period. All strings have at least one critical factorization with the left half smaller than the global period. And while some strings have more than one critical factorization, it is provable that with an ordered alphabet, at least one of the critical factorizations corresponds to a maximal suffix. Given an ordered alphabet, a critical factorization can be computed in linear time, with 2 * NEEDLE_LEN comparisons, by computing the shorter of two ordered maximal suffixes. The ordered maximal suffixes are determined by lexicographic comparison while tracking periodicity. */ static size_t critical_factorization (const unsigned char *needle, size_t needle_len, size_t *period) { /* Index of last byte of left half, or SIZE_MAX. */ size_t max_suffix, max_suffix_rev; size_t j; /* Index into NEEDLE for current candidate suffix. */ size_t k; /* Offset into current period. */ size_t p; /* Intermediate period. */ unsigned char a, b; /* Current comparison bytes. */ /* Special case NEEDLE_LEN of 1 or 2 (all callers already filtered out 0-length needles. */ if (needle_len < 3) { *period = 1; return needle_len - 1; } /* Invariants: 0 <= j < NEEDLE_LEN - 1 -1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed) min(max_suffix, max_suffix_rev) < global period of NEEDLE 1 <= p <= global period of NEEDLE p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j] 1 <= k <= p */ /* Perform lexicographic search. */ max_suffix = SIZE_MAX; j = 0; k = p = 1; while (j + k < needle_len) { a = CANON_ELEMENT (needle[j + k]); b = CANON_ELEMENT (needle[max_suffix + k]); if (a < b) { /* Suffix is smaller, period is entire prefix so far. */ j += k; k = 1; p = j - max_suffix; } else if (a == b) { /* Advance through repetition of the current period. */ if (k != p) ++k; else { j += p; k = 1; } } else /* b < a */ { /* Suffix is larger, start over from current location. */ max_suffix = j++; k = p = 1; } } *period = p; /* Perform reverse lexicographic search. */ max_suffix_rev = SIZE_MAX; j = 0; k = p = 1; while (j + k < needle_len) { a = CANON_ELEMENT (needle[j + k]); b = CANON_ELEMENT (needle[max_suffix_rev + k]); if (b < a) { /* Suffix is smaller, period is entire prefix so far. */ j += k; k = 1; p = j - max_suffix_rev; } else if (a == b) { /* Advance through repetition of the current period. */ if (k != p) ++k; else { j += p; k = 1; } } else /* a < b */ { /* Suffix is larger, start over from current location. */ max_suffix_rev = j++; k = p = 1; } } /* Choose the shorter suffix. Return the index of the first byte of the right half, rather than the last byte of the left half. For some examples, 'banana' has two critical factorizations, both exposed by the two lexicographic extreme suffixes of 'anana' and 'nana', where both suffixes have a period of 2. On the other hand, with 'aab' and 'bba', both strings have a single critical factorization of the last byte, with the suffix having a period of 1. While the maximal lexicographic suffix of 'aab' is 'b', the maximal lexicographic suffix of 'bba' is 'ba', which is not a critical factorization. Conversely, the maximal reverse lexicographic suffix of 'a' works for 'bba', but not 'ab' for 'aab'. The shorter suffix of the two will always be a critical factorization. */ if (max_suffix_rev + 1 < max_suffix + 1) return max_suffix + 1; *period = p; return max_suffix_rev + 1; } /* Return the first location of non-empty NEEDLE within HAYSTACK, or NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD. Performance is guaranteed to be linear, with an initialization cost of 2 * NEEDLE_LEN comparisons. If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. */ static RETURN_TYPE two_way_short_needle (const unsigned char *haystack, size_t haystack_len, const unsigned char *needle, size_t needle_len) { size_t i; /* Index into current byte of NEEDLE. */ size_t j; /* Index into current window of HAYSTACK. */ size_t period; /* The period of the right half of needle. */ size_t suffix; /* The index of the right half of needle. */ /* Factor the needle into two halves, such that the left half is smaller than the global period, and the right half is periodic (with a period as large as NEEDLE_LEN - suffix). */ suffix = critical_factorization (needle, needle_len, &period); /* Perform the search. Each iteration compares the right half first. */ if (CMP_FUNC (needle, needle + period, suffix) == 0) { /* Entire needle is periodic; a mismatch in the left half can only advance by the period, so use memory to avoid rescanning known occurrences of the period in the right half. */ size_t memory = 0; j = 0; while (AVAILABLE (haystack, haystack_len, j, needle_len)) { /* Scan for matches in right half. */ i = MAX (suffix, memory); while (i < needle_len && (CANON_ELEMENT (needle[i]) == CANON_ELEMENT (haystack[i + j]))) ++i; if (needle_len <= i) { /* Scan for matches in left half. */ i = suffix - 1; while (memory < i + 1 && (CANON_ELEMENT (needle[i]) == CANON_ELEMENT (haystack[i + j]))) --i; if (i + 1 < memory + 1) return (RETURN_TYPE) (haystack + j); /* No match, so remember how many repetitions of period on the right half were scanned. */ j += period; memory = needle_len - period; } else { j += i - suffix + 1; memory = 0; } } } else { /* The two halves of needle are distinct; no extra memory is required, and any mismatch results in a maximal shift. */ period = MAX (suffix, needle_len - suffix) + 1; j = 0; while (AVAILABLE (haystack, haystack_len, j, needle_len)) { /* Scan for matches in right half. */ i = suffix; while (i < needle_len && (CANON_ELEMENT (needle[i]) == CANON_ELEMENT (haystack[i + j]))) ++i; if (needle_len <= i) { /* Scan for matches in left half. */ i = suffix - 1; while (i != SIZE_MAX && (CANON_ELEMENT (needle[i]) == CANON_ELEMENT (haystack[i + j]))) --i; if (i == SIZE_MAX) return (RETURN_TYPE) (haystack + j); j += period; } else j += i - suffix + 1; } } return NULL; } /* Return the first location of non-empty NEEDLE within HAYSTACK, or NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN. Performance is guaranteed to be linear, with an initialization cost of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations. If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible. If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and sublinear performance is not possible. */ static RETURN_TYPE two_way_long_needle (const unsigned char *haystack, size_t haystack_len, const unsigned char *needle, size_t needle_len) { size_t i; /* Index into current byte of NEEDLE. */ size_t j; /* Index into current window of HAYSTACK. */ size_t period; /* The period of the right half of needle. */ size_t suffix; /* The index of the right half of needle. */ size_t shift_table[1U << CHAR_BIT]; /* See below. */ /* Factor the needle into two halves, such that the left half is smaller than the global period, and the right half is periodic (with a period as large as NEEDLE_LEN - suffix). */ suffix = critical_factorization (needle, needle_len, &period); /* Populate shift_table. For each possible byte value c, shift_table[c] is the distance from the last occurrence of c to the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE. shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */ for (i = 0; i < 1U << CHAR_BIT; i++) shift_table[i] = needle_len; for (i = 0; i < needle_len; i++) shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1; /* Perform the search. Each iteration compares the right half first. */ if (CMP_FUNC (needle, needle + period, suffix) == 0) { /* Entire needle is periodic; a mismatch in the left half can only advance by the period, so use memory to avoid rescanning known occurrences of the period in the right half. */ size_t memory = 0; size_t shift; j = 0; while (AVAILABLE (haystack, haystack_len, j, needle_len)) { /* Check the last byte first; if it does not match, then shift to the next possible match location. */ shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])]; if (0 < shift) { if (memory && shift < period) { /* Since needle is periodic, but the last period has a byte out of place, there can be no match until after the mismatch. */ shift = needle_len - period; } memory = 0; j += shift; continue; } /* Scan for matches in right half. The last byte has already been matched, by virtue of the shift table. */ i = MAX (suffix, memory); while (i < needle_len - 1 && (CANON_ELEMENT (needle[i]) == CANON_ELEMENT (haystack[i + j]))) ++i; if (needle_len - 1 <= i) { /* Scan for matches in left half. */ i = suffix - 1; while (memory < i + 1 && (CANON_ELEMENT (needle[i]) == CANON_ELEMENT (haystack[i + j]))) --i; if (i + 1 < memory + 1) return (RETURN_TYPE) (haystack + j); /* No match, so remember how many repetitions of period on the right half were scanned. */ j += period; memory = needle_len - period; } else { j += i - suffix + 1; memory = 0; } } } else { /* The two halves of needle are distinct; no extra memory is required, and any mismatch results in a maximal shift. */ size_t shift; period = MAX (suffix, needle_len - suffix) + 1; j = 0; while (AVAILABLE (haystack, haystack_len, j, needle_len)) { /* Check the last byte first; if it does not match, then shift to the next possible match location. */ shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])]; if (0 < shift) { j += shift; continue; } /* Scan for matches in right half. The last byte has already been matched, by virtue of the shift table. */ i = suffix; while (i < needle_len - 1 && (CANON_ELEMENT (needle[i]) == CANON_ELEMENT (haystack[i + j]))) ++i; if (needle_len - 1 <= i) { /* Scan for matches in left half. */ i = suffix - 1; while (i != SIZE_MAX && (CANON_ELEMENT (needle[i]) == CANON_ELEMENT (haystack[i + j]))) --i; if (i == SIZE_MAX) return (RETURN_TYPE) (haystack + j); j += period; } else j += i - suffix + 1; } } return NULL; } #undef AVAILABLE #undef CANON_ELEMENT #undef CMP_FUNC #undef MAX #undef RETURN_TYPE kbuild-3608/src/grep/lib/iconv.in.h0000664000175000017500000001035614670377423017116 0ustar locutuslocutus/* A GNU-like . Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_ICONV_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_ICONV_H@ #ifndef _@GUARD_PREFIX@_ICONV_H #define _@GUARD_PREFIX@_ICONV_H /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ #if @GNULIB_ICONV@ # if @REPLACE_ICONV_OPEN@ /* An iconv_open wrapper that supports the IANA standardized encoding names ("ISO-8859-1" etc.) as far as possible. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define iconv_open rpl_iconv_open # endif _GL_FUNCDECL_RPL (iconv_open, iconv_t, (const char *tocode, const char *fromcode) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (iconv_open, iconv_t, (const char *tocode, const char *fromcode)); # else _GL_CXXALIAS_SYS (iconv_open, iconv_t, (const char *tocode, const char *fromcode)); # endif _GL_CXXALIASWARN (iconv_open); #elif defined GNULIB_POSIXCHECK # undef iconv_open # if HAVE_RAW_DECL_ICONV_OPEN _GL_WARN_ON_USE (iconv_open, "iconv_open is not working correctly everywhere - " "use gnulib module iconv for portability"); # endif #endif #if @REPLACE_ICONV_UTF@ /* Special constants for supporting UTF-{16,32}{BE,LE} encodings. Not public. */ # define _ICONV_UTF8_UTF16BE (iconv_t)(-161) # define _ICONV_UTF8_UTF16LE (iconv_t)(-162) # define _ICONV_UTF8_UTF32BE (iconv_t)(-163) # define _ICONV_UTF8_UTF32LE (iconv_t)(-164) # define _ICONV_UTF16BE_UTF8 (iconv_t)(-165) # define _ICONV_UTF16LE_UTF8 (iconv_t)(-166) # define _ICONV_UTF32BE_UTF8 (iconv_t)(-167) # define _ICONV_UTF32LE_UTF8 (iconv_t)(-168) #endif #if @GNULIB_ICONV@ # if @REPLACE_ICONV@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define iconv rpl_iconv # endif _GL_FUNCDECL_RPL (iconv, size_t, (iconv_t cd, @ICONV_CONST@ char **restrict inbuf, size_t *restrict inbytesleft, char **restrict outbuf, size_t *restrict outbytesleft)); _GL_CXXALIAS_RPL (iconv, size_t, (iconv_t cd, @ICONV_CONST@ char **restrict inbuf, size_t *restrict inbytesleft, char **restrict outbuf, size_t *restrict outbytesleft)); # else /* Need to cast, because on some versions of Solaris, ICONV_CONST does not have the right value for C++. */ _GL_CXXALIAS_SYS_CAST (iconv, size_t, (iconv_t cd, @ICONV_CONST@ char **restrict inbuf, size_t *restrict inbytesleft, char **restrict outbuf, size_t *restrict outbytesleft)); # endif _GL_CXXALIASWARN (iconv); # ifndef ICONV_CONST # define ICONV_CONST @ICONV_CONST@ # endif #elif defined GNULIB_POSIXCHECK # undef iconv # if HAVE_RAW_DECL_ICONV _GL_WARN_ON_USE (iconv, "iconv is not working correctly everywhere - " "use gnulib module iconv for portability"); # endif #endif #if @GNULIB_ICONV@ # if @REPLACE_ICONV@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define iconv_close rpl_iconv_close # endif _GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd)); _GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd)); # else _GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd)); # endif _GL_CXXALIASWARN (iconv_close); #endif #endif /* _@GUARD_PREFIX@_ICONV_H */ #endif /* _@GUARD_PREFIX@_ICONV_H */ kbuild-3608/src/grep/lib/fcntl.c0000664000175000017500000004462114670377423016476 0ustar locutuslocutus/* Provide file descriptor control. Copyright (C) 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Eric Blake . */ #include /* Specification. */ #include #include #include #include #include #include #ifdef __KLIBC__ # define INCL_DOS # include #endif #if defined _WIN32 && ! defined __CYGWIN__ /* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include # endif /* Upper bound on getdtablesize(). See lib/getdtablesize.c. */ # define OPEN_MAX_MAX 0x10000 /* Duplicate OLDFD into the first available slot of at least NEWFD, which must be positive, with FLAGS determining whether the duplicate will be inheritable. */ static int dupfd (int oldfd, int newfd, int flags) { /* Mingw has no way to create an arbitrary fd. Iterate until all file descriptors less than newfd are filled up. */ HANDLE curr_process = GetCurrentProcess (); HANDLE old_handle = (HANDLE) _get_osfhandle (oldfd); unsigned char fds_to_close[OPEN_MAX_MAX / CHAR_BIT]; unsigned int fds_to_close_bound = 0; int result; BOOL inherit = flags & O_CLOEXEC ? FALSE : TRUE; int mode; if (newfd < 0 || getdtablesize () <= newfd) { errno = EINVAL; return -1; } if (old_handle == INVALID_HANDLE_VALUE || (mode = _setmode (oldfd, O_BINARY)) == -1) { /* oldfd is not open, or is an unassigned standard file descriptor. */ errno = EBADF; return -1; } _setmode (oldfd, mode); flags |= mode; for (;;) { HANDLE new_handle; int duplicated_fd; unsigned int index; if (!DuplicateHandle (curr_process, /* SourceProcessHandle */ old_handle, /* SourceHandle */ curr_process, /* TargetProcessHandle */ (PHANDLE) &new_handle, /* TargetHandle */ (DWORD) 0, /* DesiredAccess */ inherit, /* InheritHandle */ DUPLICATE_SAME_ACCESS)) /* Options */ { switch (GetLastError ()) { case ERROR_TOO_MANY_OPEN_FILES: errno = EMFILE; break; case ERROR_INVALID_HANDLE: case ERROR_INVALID_TARGET_HANDLE: case ERROR_DIRECT_ACCESS_HANDLE: errno = EBADF; break; case ERROR_INVALID_PARAMETER: case ERROR_INVALID_FUNCTION: case ERROR_INVALID_ACCESS: errno = EINVAL; break; default: errno = EACCES; break; } result = -1; break; } duplicated_fd = _open_osfhandle ((intptr_t) new_handle, flags); if (duplicated_fd < 0) { CloseHandle (new_handle); result = -1; break; } if (newfd <= duplicated_fd) { result = duplicated_fd; break; } /* Set the bit duplicated_fd in fds_to_close[]. */ index = (unsigned int) duplicated_fd / CHAR_BIT; if (fds_to_close_bound <= index) { if (sizeof fds_to_close <= index) /* Need to increase OPEN_MAX_MAX. */ abort (); memset (fds_to_close + fds_to_close_bound, '\0', index + 1 - fds_to_close_bound); fds_to_close_bound = index + 1; } fds_to_close[index] |= 1 << ((unsigned int) duplicated_fd % CHAR_BIT); } /* Close the previous fds that turned out to be too small. */ { int saved_errno = errno; unsigned int duplicated_fd; for (duplicated_fd = 0; duplicated_fd < fds_to_close_bound * CHAR_BIT; duplicated_fd++) if ((fds_to_close[duplicated_fd / CHAR_BIT] >> (duplicated_fd % CHAR_BIT)) & 1) close (duplicated_fd); errno = saved_errno; } # if REPLACE_FCHDIR if (0 <= result) result = _gl_register_dup (oldfd, result); # endif return result; } #endif /* W32 */ /* Forward declarations, because we '#undef fcntl' in the middle of this compilation unit. */ /* Our implementation of fcntl (fd, F_DUPFD, target). */ static int rpl_fcntl_DUPFD (int fd, int target); /* Our implementation of fcntl (fd, F_DUPFD_CLOEXEC, target). */ static int rpl_fcntl_DUPFD_CLOEXEC (int fd, int target); #ifdef __KLIBC__ /* Adds support for fcntl on directories. */ static int klibc_fcntl (int fd, int action, /* arg */...); #endif /* Perform the specified ACTION on the file descriptor FD, possibly using the argument ARG further described below. This replacement handles the following actions, and forwards all others on to the native fcntl. An unrecognized ACTION returns -1 with errno set to EINVAL. F_DUPFD - duplicate FD, with int ARG being the minimum target fd. If successful, return the duplicate, which will be inheritable; otherwise return -1 and set errno. F_DUPFD_CLOEXEC - duplicate FD, with int ARG being the minimum target fd. If successful, return the duplicate, which will not be inheritable; otherwise return -1 and set errno. F_GETFD - ARG need not be present. If successful, return a non-negative value containing the descriptor flags of FD (only FD_CLOEXEC is portable, but other flags may be present); otherwise return -1 and set errno. */ int fcntl (int fd, int action, /* arg */...) #undef fcntl #ifdef __KLIBC__ # define fcntl klibc_fcntl #endif { va_list arg; int result = -1; va_start (arg, action); switch (action) { case F_DUPFD: { int target = va_arg (arg, int); result = rpl_fcntl_DUPFD (fd, target); break; } case F_DUPFD_CLOEXEC: { int target = va_arg (arg, int); result = rpl_fcntl_DUPFD_CLOEXEC (fd, target); break; } #if !HAVE_FCNTL case F_GETFD: { # if defined _WIN32 && ! defined __CYGWIN__ HANDLE handle = (HANDLE) _get_osfhandle (fd); DWORD flags; if (handle == INVALID_HANDLE_VALUE || GetHandleInformation (handle, &flags) == 0) errno = EBADF; else result = (flags & HANDLE_FLAG_INHERIT) ? 0 : FD_CLOEXEC; # else /* !W32 */ /* Use dup2 to reject invalid file descriptors. No way to access this information, so punt. */ if (0 <= dup2 (fd, fd)) result = 0; # endif /* !W32 */ break; } /* F_GETFD */ #endif /* !HAVE_FCNTL */ /* Implementing F_SETFD on mingw is not trivial - there is no API for changing the O_NOINHERIT bit on an fd, and merely changing the HANDLE_FLAG_INHERIT bit on the underlying handle can lead to odd state. It may be possible by duplicating the handle, using _open_osfhandle with the right flags, then using dup2 to move the duplicate onto the original, but that is not supported for now. */ default: { #if HAVE_FCNTL switch (action) { #ifdef F_BARRIERFSYNC /* macOS */ case F_BARRIERFSYNC: #endif #ifdef F_CHKCLEAN /* macOS */ case F_CHKCLEAN: #endif #ifdef F_CLOSEM /* NetBSD, HP-UX */ case F_CLOSEM: #endif #ifdef F_FLUSH_DATA /* macOS */ case F_FLUSH_DATA: #endif #ifdef F_FREEZE_FS /* macOS */ case F_FREEZE_FS: #endif #ifdef F_FULLFSYNC /* macOS */ case F_FULLFSYNC: #endif #ifdef F_GETCONFINED /* macOS */ case F_GETCONFINED: #endif #ifdef F_GETDEFAULTPROTLEVEL /* macOS */ case F_GETDEFAULTPROTLEVEL: #endif #ifdef F_GETFD /* POSIX */ case F_GETFD: #endif #ifdef F_GETFL /* POSIX */ case F_GETFL: #endif #ifdef F_GETLEASE /* Linux */ case F_GETLEASE: #endif #ifdef F_GETNOSIGPIPE /* macOS */ case F_GETNOSIGPIPE: #endif #ifdef F_GETOWN /* POSIX */ case F_GETOWN: #endif #ifdef F_GETPIPE_SZ /* Linux */ case F_GETPIPE_SZ: #endif #ifdef F_GETPROTECTIONCLASS /* macOS */ case F_GETPROTECTIONCLASS: #endif #ifdef F_GETPROTECTIONLEVEL /* macOS */ case F_GETPROTECTIONLEVEL: #endif #ifdef F_GET_SEALS /* Linux */ case F_GET_SEALS: #endif #ifdef F_GETSIG /* Linux */ case F_GETSIG: #endif #ifdef F_MAXFD /* NetBSD */ case F_MAXFD: #endif #ifdef F_RECYCLE /* macOS */ case F_RECYCLE: #endif #ifdef F_SETFIFOENH /* HP-UX */ case F_SETFIFOENH: #endif #ifdef F_THAW_FS /* macOS */ case F_THAW_FS: #endif /* These actions take no argument. */ result = fcntl (fd, action); break; #ifdef F_ADD_SEALS /* Linux */ case F_ADD_SEALS: #endif #ifdef F_BADFD /* Solaris */ case F_BADFD: #endif #ifdef F_CHECK_OPENEVT /* macOS */ case F_CHECK_OPENEVT: #endif #ifdef F_DUP2FD /* FreeBSD, AIX, Solaris */ case F_DUP2FD: #endif #ifdef F_DUP2FD_CLOEXEC /* FreeBSD, Solaris */ case F_DUP2FD_CLOEXEC: #endif #ifdef F_DUP2FD_CLOFORK /* Solaris */ case F_DUP2FD_CLOFORK: #endif #ifdef F_DUPFD /* POSIX */ case F_DUPFD: #endif #ifdef F_DUPFD_CLOEXEC /* POSIX */ case F_DUPFD_CLOEXEC: #endif #ifdef F_DUPFD_CLOFORK /* Solaris */ case F_DUPFD_CLOFORK: #endif #ifdef F_GETXFL /* Solaris */ case F_GETXFL: #endif #ifdef F_GLOBAL_NOCACHE /* macOS */ case F_GLOBAL_NOCACHE: #endif #ifdef F_MAKECOMPRESSED /* macOS */ case F_MAKECOMPRESSED: #endif #ifdef F_MOVEDATAEXTENTS /* macOS */ case F_MOVEDATAEXTENTS: #endif #ifdef F_NOCACHE /* macOS */ case F_NOCACHE: #endif #ifdef F_NODIRECT /* macOS */ case F_NODIRECT: #endif #ifdef F_NOTIFY /* Linux */ case F_NOTIFY: #endif #ifdef F_OPLKACK /* IRIX */ case F_OPLKACK: #endif #ifdef F_OPLKREG /* IRIX */ case F_OPLKREG: #endif #ifdef F_RDAHEAD /* macOS */ case F_RDAHEAD: #endif #ifdef F_SETBACKINGSTORE /* macOS */ case F_SETBACKINGSTORE: #endif #ifdef F_SETCONFINED /* macOS */ case F_SETCONFINED: #endif #ifdef F_SETFD /* POSIX */ case F_SETFD: #endif #ifdef F_SETFL /* POSIX */ case F_SETFL: #endif #ifdef F_SETLEASE /* Linux */ case F_SETLEASE: #endif #ifdef F_SETNOSIGPIPE /* macOS */ case F_SETNOSIGPIPE: #endif #ifdef F_SETOWN /* POSIX */ case F_SETOWN: #endif #ifdef F_SETPIPE_SZ /* Linux */ case F_SETPIPE_SZ: #endif #ifdef F_SETPROTECTIONCLASS /* macOS */ case F_SETPROTECTIONCLASS: #endif #ifdef F_SETSIG /* Linux */ case F_SETSIG: #endif #ifdef F_SINGLE_WRITER /* macOS */ case F_SINGLE_WRITER: #endif /* These actions take an 'int' argument. */ { int x = va_arg (arg, int); result = fcntl (fd, action, x); } break; default: /* Other actions take a pointer argument. */ { void *p = va_arg (arg, void *); result = fcntl (fd, action, p); } break; } #else errno = EINVAL; #endif break; } } va_end (arg); return result; } static int rpl_fcntl_DUPFD (int fd, int target) { int result; #if !HAVE_FCNTL result = dupfd (fd, target, 0); #elif FCNTL_DUPFD_BUGGY || REPLACE_FCHDIR /* Detect invalid target; needed for cygwin 1.5.x. */ if (target < 0 || getdtablesize () <= target) { result = -1; errno = EINVAL; } else { /* Haiku alpha 2 loses fd flags on original. */ int flags = fcntl (fd, F_GETFD); if (flags < 0) result = -1; else { result = fcntl (fd, F_DUPFD, target); if (0 <= result && fcntl (fd, F_SETFD, flags) == -1) { int saved_errno = errno; close (result); result = -1; errno = saved_errno; } # if REPLACE_FCHDIR if (0 <= result) result = _gl_register_dup (fd, result); # endif } } #else result = fcntl (fd, F_DUPFD, target); #endif return result; } static int rpl_fcntl_DUPFD_CLOEXEC (int fd, int target) { int result; #if !HAVE_FCNTL result = dupfd (fd, target, O_CLOEXEC); #else /* HAVE_FCNTL */ # if defined __NetBSD__ || defined __HAIKU__ /* On NetBSD 9.0, the system fcntl (fd, F_DUPFD_CLOEXEC, target) has only the same effect as fcntl (fd, F_DUPFD, target). */ /* On Haiku, the system fcntl (fd, F_DUPFD_CLOEXEC, target) sets the FD_CLOEXEC flag on fd, not on target. Therefore avoid the system fcntl in this case. */ # define have_dupfd_cloexec -1 # else /* Try the system call first, if the headers claim it exists (that is, if GNULIB_defined_F_DUPFD_CLOEXEC is 0), since we may be running with a glibc that has the macro but with an older kernel that does not support it. Cache the information on whether the system call really works, but avoid caching failure if the corresponding F_DUPFD fails for any reason. 0 = unknown, 1 = yes, -1 = no. */ static int have_dupfd_cloexec = GNULIB_defined_F_DUPFD_CLOEXEC ? -1 : 0; if (0 <= have_dupfd_cloexec) { result = fcntl (fd, F_DUPFD_CLOEXEC, target); if (0 <= result || errno != EINVAL) { have_dupfd_cloexec = 1; # if REPLACE_FCHDIR if (0 <= result) result = _gl_register_dup (fd, result); # endif } else { result = rpl_fcntl_DUPFD (fd, target); if (result >= 0) have_dupfd_cloexec = -1; } } else # endif result = rpl_fcntl_DUPFD (fd, target); if (0 <= result && have_dupfd_cloexec == -1) { int flags = fcntl (result, F_GETFD); if (flags < 0 || fcntl (result, F_SETFD, flags | FD_CLOEXEC) == -1) { int saved_errno = errno; close (result); errno = saved_errno; result = -1; } } #endif /* HAVE_FCNTL */ return result; } #undef fcntl #ifdef __KLIBC__ static int klibc_fcntl (int fd, int action, /* arg */...) { va_list arg_ptr; int arg; struct stat sbuf; int result; va_start (arg_ptr, action); arg = va_arg (arg_ptr, int); result = fcntl (fd, action, arg); /* EPERM for F_DUPFD, ENOTSUP for others */ if (result == -1 && (errno == EPERM || errno == ENOTSUP) && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) { ULONG ulMode; switch (action) { case F_DUPFD: /* Find available fd */ while (fcntl (arg, F_GETFL) != -1 || errno != EBADF) arg++; result = dup2 (fd, arg); break; /* Using underlying APIs is right ? */ case F_GETFD: if (DosQueryFHState (fd, &ulMode)) break; result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0; break; case F_SETFD: if (arg & ~FD_CLOEXEC) break; if (DosQueryFHState (fd, &ulMode)) break; if (arg & FD_CLOEXEC) ulMode |= OPEN_FLAGS_NOINHERIT; else ulMode &= ~OPEN_FLAGS_NOINHERIT; /* Filter supported flags. */ ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT); if (DosSetFHState (fd, ulMode)) break; result = 0; break; case F_GETFL: result = 0; break; case F_SETFL: if (arg != 0) break; result = 0; break; default: errno = EINVAL; break; } } va_end (arg_ptr); return result; } #endif kbuild-3608/src/grep/lib/alloca.in.h0000664000175000017500000000467414670377423017241 0ustar locutuslocutus/* Memory allocation on the stack. Copyright (C) 1995, 1999, 2001-2004, 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H means there is a real alloca function. */ #ifndef _GL_ALLOCA_H #define _GL_ALLOCA_H /* alloca (N) returns a pointer to N bytes of memory allocated on the stack, which will last until the function returns. Use of alloca should be avoided: - inside arguments of function calls - undefined behaviour, - in inline functions - the allocation may actually last until the calling function returns, - for huge N (say, N >= 65536) - you never know how large (or small) the stack is, and when the stack cannot fulfill the memory allocation request, the program just crashes. */ #ifndef alloca /* Some version of mingw have an that causes trouble when included after 'alloca' gets defined as a macro. As a workaround, include this first and define 'alloca' as a macro afterwards if needed. */ # if defined __GNUC__ && (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@ # include_next # endif #endif #ifndef alloca # if defined __GNUC__ || (__clang_major__ >= 4) # define alloca __builtin_alloca # elif defined _AIX # define alloca __alloca # elif defined _MSC_VER # include # define alloca _alloca # elif defined __DECC && defined __VMS # define alloca __ALLOCA # elif defined __TANDEM && defined _TNS_E_TARGET # ifdef __cplusplus extern "C" # endif void *_alloca (unsigned short); # pragma intrinsic (_alloca) # define alloca _alloca # elif defined __MVS__ # include # else # include # ifdef __cplusplus extern "C" # endif void *alloca (size_t); # endif #endif #endif /* _GL_ALLOCA_H */ kbuild-3608/src/grep/lib/close-stream.h0000664000175000017500000000145714670377423017773 0ustar locutuslocutus/* Close a stream, with nicer error checking than fclose's. Copyright (C) 2006-2021 Free Software Foundation, Inc. This file 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 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. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include int close_stream (FILE *stream); kbuild-3608/src/grep/lib/dup-safer.c0000664000175000017500000000253514670377422017253 0ustar locutuslocutus/* Invoke dup, but avoid some glitches. Copyright (C) 2001, 2004-2006, 2009-2021 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 . */ /* Written by Paul Eggert. */ #include #include "unistd-safer.h" #include #include /* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. */ int dup_safer (int fd) { #if defined(KMK_GREP) && defined(_MSC_VER) int afd[STDERR_FILENO + 1]; int i; for (i = 0; ; i++) { int fdNew = _dup(fd); if (fdNew >= STDERR_FILENO + 1 || fdNew < 0) { while (i-- > 0) close(afd[i]); return fdNew; } afd[i] = fdNew; } #else return fcntl (fd, F_DUPFD, STDERR_FILENO + 1); #endif } kbuild-3608/src/grep/lib/iconv_open-hpux.gperf0000664000175000017500000000353114670377423021365 0ustar locutuslocutus/* Character set conversion. Copyright (C) 2007, 2020-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ struct mapping { int standard_name; const char vendor_name[9 + 1]; }; %struct-type %language=ANSI-C %define slot-name standard_name %define hash-function-name mapping_hash %define lookup-function-name mapping_lookup %readonly-tables %global-table %define word-array-name mappings %pic %% # On HP-UX 11.11, look in /usr/lib/nls/iconv. ISO-8859-1, "iso88591" ISO-8859-2, "iso88592" ISO-8859-5, "iso88595" ISO-8859-6, "iso88596" ISO-8859-7, "iso88597" ISO-8859-8, "iso88598" ISO-8859-9, "iso88599" ISO-8859-15, "iso885915" CP437, "cp437" CP775, "cp775" CP850, "cp850" CP852, "cp852" CP855, "cp855" CP857, "cp857" CP861, "cp861" CP862, "cp862" CP864, "cp864" CP865, "cp865" CP866, "cp866" CP869, "cp869" CP874, "cp874" CP1250, "cp1250" CP1251, "cp1251" CP1252, "cp1252" CP1253, "cp1253" CP1254, "cp1254" CP1255, "cp1255" CP1256, "cp1256" CP1257, "cp1257" CP1258, "cp1258" HP-ROMAN8, "roman8" HP-ARABIC8, "arabic8" HP-GREEK8, "greek8" HP-HEBREW8, "hebrew8" HP-TURKISH8, "turkish8" HP-KANA8, "kana8" TIS-620, "tis620" GB2312, "hp15CN" EUC-JP, "eucJP" EUC-KR, "eucKR" EUC-TW, "eucTW" BIG5, "big5" SHIFT_JIS, "sjis" UTF-8, "utf8" kbuild-3608/src/grep/lib/strerror-override.h0000664000175000017500000000405014670377426021067 0ustar locutuslocutus/* strerror-override.h --- POSIX compatible system error routine Copyright (C) 2010-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _GL_STRERROR_OVERRIDE_H # define _GL_STRERROR_OVERRIDE_H # include # include /* Reasonable buffer size that should never trigger ERANGE; if this proves too small, we intentionally abort(), to remind us to fix this value. */ # define STACKBUF_LEN 256 /* If ERRNUM maps to an errno value defined by gnulib, return a string describing the error. Otherwise return NULL. */ # if REPLACE_STRERROR_0 \ || GNULIB_defined_ESOCK \ || GNULIB_defined_ESTREAMS \ || GNULIB_defined_EWINSOCK \ || GNULIB_defined_ENOMSG \ || GNULIB_defined_EIDRM \ || GNULIB_defined_ENOLINK \ || GNULIB_defined_EPROTO \ || GNULIB_defined_EMULTIHOP \ || GNULIB_defined_EBADMSG \ || GNULIB_defined_EOVERFLOW \ || GNULIB_defined_ENOTSUP \ || GNULIB_defined_ENETRESET \ || GNULIB_defined_ECONNABORTED \ || GNULIB_defined_ESTALE \ || GNULIB_defined_EDQUOT \ || GNULIB_defined_ECANCELED \ || GNULIB_defined_EOWNERDEAD \ || GNULIB_defined_ENOTRECOVERABLE \ || GNULIB_defined_EILSEQ extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST; # else # define strerror_override(ignored) NULL # define GNULIB_defined_strerror_override_macro 1 # endif #endif /* _GL_STRERROR_OVERRIDE_H */ kbuild-3608/src/grep/INSTALL0000664000175000017500000003662614670377426015520 0ustar locutuslocutusInstallation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command './configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the 'README' file for instructions specific to this package. Some packages provide this 'INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The 'configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a 'Makefile' in each directory of the package. It may also create one or more '.h' files containing system-dependent definitions. Finally, it creates a shell script 'config.status' that you can run in the future to recreate the current configuration, and a file 'config.log' containing compiler output (useful mainly for debugging 'configure'). It can also use an optional file (typically called 'config.cache' and enabled with '--cache-file=config.cache' or simply '-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how 'configure' could check whether to do them, and mail diffs or instructions to the address given in the 'README' so they can be considered for the next release. If you are using the cache, and at some point 'config.cache' contains results you don't want to keep, you may remove or edit it. The file 'configure.ac' (or 'configure.in') is used to create 'configure' by a program called 'autoconf'. You need 'configure.ac' if you want to change it or regenerate 'configure' using a newer version of 'autoconf'. The simplest way to compile this package is: 1. 'cd' to the directory containing the package's source code and type './configure' to configure the package for your system. Running 'configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type 'make' to compile the package. 3. Optionally, type 'make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type 'make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the 'make install' phase executed with root privileges. 5. Optionally, type 'make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior 'make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing 'make clean'. To also remove the files that 'configure' created (so you can compile the package for a different kind of computer), type 'make distclean'. There is also a 'make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type 'make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide 'make distcheck', which can by used by developers to test that all other targets like 'make install' and 'make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the 'configure' script does not know about. Run './configure --help' for details on some of the pertinent environment variables. You can give 'configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU 'make'. 'cd' to the directory where you want the object files and executables to go and run the 'configure' script. 'configure' automatically checks for the source code in the directory that 'configure' is in and in '..'. This is known as a "VPATH" build. With a non-GNU 'make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use 'make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple '-arch' options to the compiler but only a single '-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the 'lipo' tool if you have problems. Installation Names ================== By default, 'make install' installs the package's commands under '/usr/local/bin', include files under '/usr/local/include', etc. You can specify an installation prefix other than '/usr/local' by giving 'configure' the option '--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option '--exec-prefix=PREFIX' to 'configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like '--bindir=DIR' to specify different values for particular kinds of files. Run 'configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of '${prefix}', so that specifying just '--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to 'configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the 'make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, 'make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of '${prefix}'. Any directories that were specified during 'configure', but not in terms of '${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the 'DESTDIR' variable. For example, 'make install DESTDIR=/alternate/directory' will prepend '/alternate/directory' before all installation names. The approach of 'DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of '${prefix}' at 'configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving 'configure' the option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. Some packages pay attention to '--enable-FEATURE' options to 'configure', where FEATURE indicates an optional part of the package. They may also pay attention to '--with-PACKAGE' options, where PACKAGE is something like 'gnu-as' or 'x' (for the X Window System). The 'README' should mention any '--enable-' and '--with-' options that the package recognizes. For packages that use the X Window System, 'configure' can usually find the X include and library files automatically, but if it doesn't, you can use the 'configure' options '--x-includes=DIR' and '--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of 'make' will be. For these packages, running './configure --enable-silent-rules' sets the default to minimal output, which can be overridden with 'make V=1'; while running './configure --disable-silent-rules' sets the default to verbose, which can be overridden with 'make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX 'make' updates targets which have the same timestamps as their prerequisites, which makes it generally unusable when shipped generated files such as 'configure' are involved. Use GNU 'make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its '' header file. The option '-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put '/usr/ucb' early in your 'PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in '/usr/bin'. So, if you need '/usr/ucb' in your 'PATH', put it _after_ '/usr/bin'. On Haiku, software installed for all users goes in '/boot/common', not '/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features 'configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, 'configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the '--build=TYPE' option. TYPE can either be a short name for the system type, such as 'sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file 'config.sub' for the possible values of each field. If 'config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option '--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with '--host=TYPE'. Sharing Defaults ================ If you want to set default values for 'configure' scripts to share, you can create a site shell script called 'config.site' that gives default values for variables like 'CC', 'cache_file', and 'prefix'. 'configure' looks for 'PREFIX/share/config.site' if it exists, then 'PREFIX/etc/config.site' if it exists. Or, you can set the 'CONFIG_SITE' environment variable to the location of the site script. A warning: not all 'configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to 'configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the 'configure' command line, using 'VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified 'gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash 'configure' Invocation ====================== 'configure' recognizes the following options to control how it operates. '--help' '-h' Print a summary of all of the options to 'configure', and exit. '--help=short' '--help=recursive' Print a summary of the options unique to this package's 'configure', and exit. The 'short' variant lists options used only in the top level, while the 'recursive' variant lists options also present in any nested packages. '--version' '-V' Print the version of Autoconf used to generate the 'configure' script, and exit. '--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally 'config.cache'. FILE defaults to '/dev/null' to disable caching. '--config-cache' '-C' Alias for '--cache-file=config.cache'. '--quiet' '--silent' '-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to '/dev/null' (any error messages will still be shown). '--srcdir=DIR' Look for the package's source code in directory DIR. Usually 'configure' can determine that directory automatically. '--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. '--no-create' '-n' Run the configure checks, but stop before creating any output files. 'configure' also accepts some other, not widely useful, options. Run 'configure --help' for more details. kbuild-3608/src/grep/thanks-gen0000775000175000017500000000067114670377472016444 0ustar locutuslocutus#!/usr/bin/perl -nl # Use Perl's multi-byte alignment code, via sprintf, while # performing a rudimentary check for duplicate names and # removing duplicate name,email pairs. use Encode; BEGIN { my (%seen, %name) } chomp; my ($name, $email) = split '\0', decode ('UTF-8', $_); $seen{$name}++ and warn "$0: THANKS.in: duplicate name: $name\n"; print encode ('UTF-8', sprintf ('%-36s', $name)), $email unless $seen{"$name\0$email"}++; kbuild-3608/src/grep/src/0000775000175000017500000000000014670377427015242 5ustar locutuslocutuskbuild-3608/src/grep/src/Makefile.am0000664000175000017500000000457714670377426017312 0ustar locutuslocutus## Process this file with automake to create Makefile.in # Copyright 1997-1998, 2005-2021 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, 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 . LN = ln AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PCRE_CFLAGS) # Tell the linker to omit references to unused shared libraries. AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS) bin_PROGRAMS = grep bin_SCRIPTS = egrep fgrep grep_SOURCES = \ dfasearch.c \ die.h \ grep.c \ kwsearch.c \ kwset.c \ searchutils.c if USE_PCRE grep_SOURCES += pcresearch.c endif noinst_HEADERS = grep.h kwset.h search.h system.h # Sometimes, the expansion of $(LIBINTL) includes -lc which may # include modules defining variables like 'optind', so libgreputils.a # must precede $(LIBINTL) in order to ensure we use GNU getopt. # But libgreputils.a must also follow $(LIBINTL), since libintl uses # replacement functions defined in libgreputils.a. LDADD = \ ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a $(LIBICONV) \ $(LIBTHREAD) grep_LDADD = $(LDADD) $(PCRE_LIBS) $(LIBCSTACK) localedir = $(datadir)/locale AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib EXTRA_DIST = egrep.sh egrep fgrep: egrep.sh Makefile $(AM_V_GEN)grep=`echo grep | sed -e '$(transform)'` && \ case $@ in egrep) option=-E;; fgrep) option=-F;; esac && \ shell_does_substrings='set x/y && d=$${1%/*} && test "$$d" = x' && \ if $(SHELL) -c "$$shell_does_substrings" 2>/dev/null; then \ edit_substring='s,X,X,'; \ else \ edit_substring='s,\$${0%/\*},`expr "X$$0" : '\''X\\(.*\\)/'\''`,g'; \ fi && \ sed -e 's|[@]SHELL@|$(SHELL)|g' \ -e "$$edit_substring" \ -e "s|[@]grep@|$$grep|g" \ -e "s|[@]option@|$$option|g" <$(srcdir)/egrep.sh >$@-t $(AM_V_at)chmod +x $@-t $(AM_V_at)mv $@-t $@ CLEANFILES = egrep fgrep *-t kbuild-3608/src/grep/src/Makefile.in0000664000175000017500000023340114670377426017311 0ustar locutuslocutus# Makefile.in generated by automake 1.16d from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright 1997-1998, 2005-2021 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, 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 . VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = grep$(EXEEXT) @USE_PCRE_TRUE@am__append_1 = pcresearch.c subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/__inline.m4 \ $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \ $(top_srcdir)/m4/arpa_inet_h.m4 \ $(top_srcdir)/m4/asm-underscore.m4 $(top_srcdir)/m4/assert.m4 \ $(top_srcdir)/m4/btowc.m4 $(top_srcdir)/m4/builtin-expect.m4 \ $(top_srcdir)/m4/c-stack.m4 $(top_srcdir)/m4/calloc.m4 \ $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/close.m4 \ $(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/ctype_h.m4 \ $(top_srcdir)/m4/cycle-check.m4 $(top_srcdir)/m4/d-ino.m4 \ $(top_srcdir)/m4/d-type.m4 $(top_srcdir)/m4/dirent_h.m4 \ $(top_srcdir)/m4/dirfd.m4 \ $(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup.m4 \ $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exponentd.m4 \ $(top_srcdir)/m4/extensions.m4 \ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopen.m4 $(top_srcdir)/m4/fdopendir.m4 \ $(top_srcdir)/m4/filenamecat.m4 $(top_srcdir)/m4/flexmember.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fnmatch.m4 \ $(top_srcdir)/m4/fnmatch_h.m4 $(top_srcdir)/m4/fopen.m4 \ $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/fpieee.m4 \ $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/fstat.m4 \ $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/ftruncate.m4 \ $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \ $(top_srcdir)/m4/getpagesize.m4 \ $(top_srcdir)/m4/getprogname.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/iconv_h.m4 \ $(top_srcdir)/m4/iconv_open.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_pton.m4 \ $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intl-thread-locale.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax_t.m4 \ $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes.m4 \ $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/ioctl.m4 \ $(top_srcdir)/m4/isatty.m4 $(top_srcdir)/m4/isblank.m4 \ $(top_srcdir)/m4/iswblank.m4 $(top_srcdir)/m4/iswctype.m4 \ $(top_srcdir)/m4/iswdigit.m4 $(top_srcdir)/m4/iswxdigit.m4 \ $(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \ $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/libsigsegv.m4 \ $(top_srcdir)/m4/libunistring-base.m4 \ $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/localcharset.m4 \ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \ $(top_srcdir)/m4/locale-tr.m4 $(top_srcdir)/m4/locale-zh.m4 \ $(top_srcdir)/m4/locale_h.m4 $(top_srcdir)/m4/localeconv.m4 \ $(top_srcdir)/m4/localename.m4 $(top_srcdir)/m4/lock.m4 \ $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/lstat.m4 \ $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/malloca.m4 \ $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/mbchar.m4 \ $(top_srcdir)/m4/mbiter.m4 $(top_srcdir)/m4/mbrlen.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \ $(top_srcdir)/m4/mbslen.m4 $(top_srcdir)/m4/mbsrtowcs.m4 \ $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbtowc.m4 \ $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/minmax.m4 \ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/musl.m4 $(top_srcdir)/m4/nanosleep.m4 \ $(top_srcdir)/m4/netinet_in_h.m4 \ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/obstack.m4 \ $(top_srcdir)/m4/off_t.m4 $(top_srcdir)/m4/open-cloexec.m4 \ $(top_srcdir)/m4/open-slash.m4 $(top_srcdir)/m4/open.m4 \ $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/opendir.m4 \ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/pcre.m4 \ $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/perror.m4 \ $(top_srcdir)/m4/pipe.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/pthread-thread.m4 \ $(top_srcdir)/m4/pthread_h.m4 \ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \ $(top_srcdir)/m4/pthread_sigmask.m4 $(top_srcdir)/m4/putenv.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/rawmemchr.m4 \ $(top_srcdir)/m4/read.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/reallocarray.m4 \ $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/safe-read.m4 \ $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/sched_h.m4 \ $(top_srcdir)/m4/select.m4 $(top_srcdir)/m4/setenv.m4 \ $(top_srcdir)/m4/setlocale.m4 \ $(top_srcdir)/m4/setlocale_null.m4 \ $(top_srcdir)/m4/sigaction.m4 $(top_srcdir)/m4/sigaltstack.m4 \ $(top_srcdir)/m4/signal_h.m4 \ $(top_srcdir)/m4/signalblocking.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/sleep.m4 \ $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/socketlib.m4 \ $(top_srcdir)/m4/sockets.m4 $(top_srcdir)/m4/socklen.m4 \ $(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stack-direction.m4 \ $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \ $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdarg.m4 \ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/stpcpy.m4 $(top_srcdir)/m4/strdup.m4 \ $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/strerror_r.m4 \ $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strnlen.m4 \ $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtoimax.m4 \ $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoull.m4 \ $(top_srcdir)/m4/strtoumax.m4 $(top_srcdir)/m4/symlink.m4 \ $(top_srcdir)/m4/sys_ioctl_h.m4 \ $(top_srcdir)/m4/sys_select_h.m4 \ $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/sys_uio_h.m4 \ $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/unistd-safer.m4 \ $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/version-etc.m4 \ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/warn-on-use.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_h.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcrtomb.m4 \ $(top_srcdir)/m4/wctob.m4 $(top_srcdir)/m4/wctomb.m4 \ $(top_srcdir)/m4/wctype_h.m4 $(top_srcdir)/m4/wcwidth.m4 \ $(top_srcdir)/m4/windows-stat-inodes.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/wmemchr.m4 \ $(top_srcdir)/m4/wmempcpy.m4 $(top_srcdir)/m4/xalloc.m4 \ $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrtol.m4 \ $(top_srcdir)/m4/year2038.m4 $(top_srcdir)/m4/zzgnulib.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__grep_SOURCES_DIST = dfasearch.c die.h grep.c kwsearch.c kwset.c \ searchutils.c pcresearch.c @USE_PCRE_TRUE@am__objects_1 = pcresearch.$(OBJEXT) am_grep_OBJECTS = dfasearch.$(OBJEXT) grep.$(OBJEXT) \ kwsearch.$(OBJEXT) kwset.$(OBJEXT) searchutils.$(OBJEXT) \ $(am__objects_1) grep_OBJECTS = $(am_grep_OBJECTS) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = ../lib/libgreputils.a $(am__DEPENDENCIES_1) \ ../lib/libgreputils.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) grep_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/dfasearch.Po ./$(DEPDIR)/grep.Po \ ./$(DEPDIR)/kwsearch.Po ./$(DEPDIR)/kwset.Po \ ./$(DEPDIR)/pcresearch.Po ./$(DEPDIR)/searchutils.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(grep_SOURCES) DIST_SOURCES = $(am__grep_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in \ $(top_srcdir)/build-aux/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkglibexecdir = @pkglibexecdir@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ AR = @AR@ ARFLAGS = @ARFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ COLORIZE_SOURCE = @COLORIZE_SOURCE@ CONFIG_INCLUDE = @CONFIG_INCLUDE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ ENOLINK_VALUE = @ENOLINK_VALUE@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ FNMATCH_H = @FNMATCH_H@ GETOPT_CDEFS_H = @GETOPT_CDEFS_H@ GETOPT_H = @GETOPT_H@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@ GL_CXXFLAG_ALLOW_WARNINGS = @GL_CXXFLAG_ALLOW_WARNINGS@ GL_GNULIB_ACCEPT = @GL_GNULIB_ACCEPT@ GL_GNULIB_ACCEPT4 = @GL_GNULIB_ACCEPT4@ GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@ GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@ GL_GNULIB_ALPHASORT = @GL_GNULIB_ALPHASORT@ GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@ GL_GNULIB_BIND = @GL_GNULIB_BIND@ GL_GNULIB_BTOWC = @GL_GNULIB_BTOWC@ GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@ GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@ GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@ GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@ GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@ GL_GNULIB_CLOSEDIR = @GL_GNULIB_CLOSEDIR@ GL_GNULIB_CONNECT = @GL_GNULIB_CONNECT@ GL_GNULIB_COPY_FILE_RANGE = @GL_GNULIB_COPY_FILE_RANGE@ GL_GNULIB_CREAT = @GL_GNULIB_CREAT@ GL_GNULIB_CTIME = @GL_GNULIB_CTIME@ GL_GNULIB_DIRFD = @GL_GNULIB_DIRFD@ GL_GNULIB_DPRINTF = @GL_GNULIB_DPRINTF@ GL_GNULIB_DUP = @GL_GNULIB_DUP@ GL_GNULIB_DUP2 = @GL_GNULIB_DUP2@ GL_GNULIB_DUP3 = @GL_GNULIB_DUP3@ GL_GNULIB_DUPLOCALE = @GL_GNULIB_DUPLOCALE@ GL_GNULIB_ENVIRON = @GL_GNULIB_ENVIRON@ GL_GNULIB_EUIDACCESS = @GL_GNULIB_EUIDACCESS@ GL_GNULIB_EXECL = @GL_GNULIB_EXECL@ GL_GNULIB_EXECLE = @GL_GNULIB_EXECLE@ GL_GNULIB_EXECLP = @GL_GNULIB_EXECLP@ GL_GNULIB_EXECV = @GL_GNULIB_EXECV@ GL_GNULIB_EXECVE = @GL_GNULIB_EXECVE@ GL_GNULIB_EXECVP = @GL_GNULIB_EXECVP@ GL_GNULIB_EXECVPE = @GL_GNULIB_EXECVPE@ GL_GNULIB_EXPLICIT_BZERO = @GL_GNULIB_EXPLICIT_BZERO@ GL_GNULIB_FACCESSAT = @GL_GNULIB_FACCESSAT@ GL_GNULIB_FCHDIR = @GL_GNULIB_FCHDIR@ GL_GNULIB_FCHMODAT = @GL_GNULIB_FCHMODAT@ GL_GNULIB_FCHOWNAT = @GL_GNULIB_FCHOWNAT@ GL_GNULIB_FCLOSE = @GL_GNULIB_FCLOSE@ GL_GNULIB_FCNTL = @GL_GNULIB_FCNTL@ GL_GNULIB_FDATASYNC = @GL_GNULIB_FDATASYNC@ GL_GNULIB_FDOPEN = @GL_GNULIB_FDOPEN@ GL_GNULIB_FDOPENDIR = @GL_GNULIB_FDOPENDIR@ GL_GNULIB_FFLUSH = @GL_GNULIB_FFLUSH@ GL_GNULIB_FFSL = @GL_GNULIB_FFSL@ GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@ GL_GNULIB_FGETC = @GL_GNULIB_FGETC@ GL_GNULIB_FGETS = @GL_GNULIB_FGETS@ GL_GNULIB_FNMATCH = @GL_GNULIB_FNMATCH@ GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@ GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@ GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@ GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@ GL_GNULIB_FPUTC = @GL_GNULIB_FPUTC@ GL_GNULIB_FPUTS = @GL_GNULIB_FPUTS@ GL_GNULIB_FREAD = @GL_GNULIB_FREAD@ GL_GNULIB_FREE_POSIX = @GL_GNULIB_FREE_POSIX@ GL_GNULIB_FREOPEN = @GL_GNULIB_FREOPEN@ GL_GNULIB_FSCANF = @GL_GNULIB_FSCANF@ GL_GNULIB_FSEEK = @GL_GNULIB_FSEEK@ GL_GNULIB_FSEEKO = @GL_GNULIB_FSEEKO@ GL_GNULIB_FSTAT = @GL_GNULIB_FSTAT@ GL_GNULIB_FSTATAT = @GL_GNULIB_FSTATAT@ GL_GNULIB_FSYNC = @GL_GNULIB_FSYNC@ GL_GNULIB_FTELL = @GL_GNULIB_FTELL@ GL_GNULIB_FTELLO = @GL_GNULIB_FTELLO@ GL_GNULIB_FTRUNCATE = @GL_GNULIB_FTRUNCATE@ GL_GNULIB_FUTIMENS = @GL_GNULIB_FUTIMENS@ GL_GNULIB_FWRITE = @GL_GNULIB_FWRITE@ GL_GNULIB_GETC = @GL_GNULIB_GETC@ GL_GNULIB_GETCHAR = @GL_GNULIB_GETCHAR@ GL_GNULIB_GETCWD = @GL_GNULIB_GETCWD@ GL_GNULIB_GETDELIM = @GL_GNULIB_GETDELIM@ GL_GNULIB_GETDOMAINNAME = @GL_GNULIB_GETDOMAINNAME@ GL_GNULIB_GETDTABLESIZE = @GL_GNULIB_GETDTABLESIZE@ GL_GNULIB_GETENTROPY = @GL_GNULIB_GETENTROPY@ GL_GNULIB_GETGROUPS = @GL_GNULIB_GETGROUPS@ GL_GNULIB_GETHOSTNAME = @GL_GNULIB_GETHOSTNAME@ GL_GNULIB_GETLINE = @GL_GNULIB_GETLINE@ GL_GNULIB_GETLOADAVG = @GL_GNULIB_GETLOADAVG@ GL_GNULIB_GETLOGIN = @GL_GNULIB_GETLOGIN@ GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@ GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@ GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@ GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@ GL_GNULIB_GETPEERNAME = @GL_GNULIB_GETPEERNAME@ GL_GNULIB_GETSOCKNAME = @GL_GNULIB_GETSOCKNAME@ GL_GNULIB_GETSOCKOPT = @GL_GNULIB_GETSOCKOPT@ GL_GNULIB_GETSUBOPT = @GL_GNULIB_GETSUBOPT@ GL_GNULIB_GETTIMEOFDAY = @GL_GNULIB_GETTIMEOFDAY@ GL_GNULIB_GETUMASK = @GL_GNULIB_GETUMASK@ GL_GNULIB_GETUSERSHELL = @GL_GNULIB_GETUSERSHELL@ GL_GNULIB_GRANTPT = @GL_GNULIB_GRANTPT@ GL_GNULIB_GROUP_MEMBER = @GL_GNULIB_GROUP_MEMBER@ GL_GNULIB_ICONV = @GL_GNULIB_ICONV@ GL_GNULIB_IMAXABS = @GL_GNULIB_IMAXABS@ GL_GNULIB_IMAXDIV = @GL_GNULIB_IMAXDIV@ GL_GNULIB_INET_NTOP = @GL_GNULIB_INET_NTOP@ GL_GNULIB_INET_PTON = @GL_GNULIB_INET_PTON@ GL_GNULIB_IOCTL = @GL_GNULIB_IOCTL@ GL_GNULIB_ISATTY = @GL_GNULIB_ISATTY@ GL_GNULIB_ISBLANK = @GL_GNULIB_ISBLANK@ GL_GNULIB_ISWBLANK = @GL_GNULIB_ISWBLANK@ GL_GNULIB_ISWCTYPE = @GL_GNULIB_ISWCTYPE@ GL_GNULIB_ISWDIGIT = @GL_GNULIB_ISWDIGIT@ GL_GNULIB_ISWXDIGIT = @GL_GNULIB_ISWXDIGIT@ GL_GNULIB_LCHMOD = @GL_GNULIB_LCHMOD@ GL_GNULIB_LCHOWN = @GL_GNULIB_LCHOWN@ GL_GNULIB_LINK = @GL_GNULIB_LINK@ GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@ GL_GNULIB_LISTEN = @GL_GNULIB_LISTEN@ GL_GNULIB_LOCALECONV = @GL_GNULIB_LOCALECONV@ GL_GNULIB_LOCALENAME = @GL_GNULIB_LOCALENAME@ GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@ GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@ GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@ GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@ GL_GNULIB_MBRLEN = @GL_GNULIB_MBRLEN@ GL_GNULIB_MBRTOWC = @GL_GNULIB_MBRTOWC@ GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@ GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@ GL_GNULIB_MBSCHR = @GL_GNULIB_MBSCHR@ GL_GNULIB_MBSCSPN = @GL_GNULIB_MBSCSPN@ GL_GNULIB_MBSINIT = @GL_GNULIB_MBSINIT@ GL_GNULIB_MBSLEN = @GL_GNULIB_MBSLEN@ GL_GNULIB_MBSNCASECMP = @GL_GNULIB_MBSNCASECMP@ GL_GNULIB_MBSNLEN = @GL_GNULIB_MBSNLEN@ GL_GNULIB_MBSNRTOWCS = @GL_GNULIB_MBSNRTOWCS@ GL_GNULIB_MBSPBRK = @GL_GNULIB_MBSPBRK@ GL_GNULIB_MBSPCASECMP = @GL_GNULIB_MBSPCASECMP@ GL_GNULIB_MBSRCHR = @GL_GNULIB_MBSRCHR@ GL_GNULIB_MBSRTOWCS = @GL_GNULIB_MBSRTOWCS@ GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@ GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@ GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@ GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@ GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@ GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@ GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@ GL_GNULIB_MDA_CHMOD = @GL_GNULIB_MDA_CHMOD@ GL_GNULIB_MDA_CLOSE = @GL_GNULIB_MDA_CLOSE@ GL_GNULIB_MDA_CREAT = @GL_GNULIB_MDA_CREAT@ GL_GNULIB_MDA_DUP = @GL_GNULIB_MDA_DUP@ GL_GNULIB_MDA_DUP2 = @GL_GNULIB_MDA_DUP2@ GL_GNULIB_MDA_ECVT = @GL_GNULIB_MDA_ECVT@ GL_GNULIB_MDA_EXECL = @GL_GNULIB_MDA_EXECL@ GL_GNULIB_MDA_EXECLE = @GL_GNULIB_MDA_EXECLE@ GL_GNULIB_MDA_EXECLP = @GL_GNULIB_MDA_EXECLP@ GL_GNULIB_MDA_EXECV = @GL_GNULIB_MDA_EXECV@ GL_GNULIB_MDA_EXECVE = @GL_GNULIB_MDA_EXECVE@ GL_GNULIB_MDA_EXECVP = @GL_GNULIB_MDA_EXECVP@ GL_GNULIB_MDA_EXECVPE = @GL_GNULIB_MDA_EXECVPE@ GL_GNULIB_MDA_FCLOSEALL = @GL_GNULIB_MDA_FCLOSEALL@ GL_GNULIB_MDA_FCVT = @GL_GNULIB_MDA_FCVT@ GL_GNULIB_MDA_FDOPEN = @GL_GNULIB_MDA_FDOPEN@ GL_GNULIB_MDA_FILENO = @GL_GNULIB_MDA_FILENO@ GL_GNULIB_MDA_GCVT = @GL_GNULIB_MDA_GCVT@ GL_GNULIB_MDA_GETCWD = @GL_GNULIB_MDA_GETCWD@ GL_GNULIB_MDA_GETPID = @GL_GNULIB_MDA_GETPID@ GL_GNULIB_MDA_GETW = @GL_GNULIB_MDA_GETW@ GL_GNULIB_MDA_ISATTY = @GL_GNULIB_MDA_ISATTY@ GL_GNULIB_MDA_LSEEK = @GL_GNULIB_MDA_LSEEK@ GL_GNULIB_MDA_MEMCCPY = @GL_GNULIB_MDA_MEMCCPY@ GL_GNULIB_MDA_MKDIR = @GL_GNULIB_MDA_MKDIR@ GL_GNULIB_MDA_MKTEMP = @GL_GNULIB_MDA_MKTEMP@ GL_GNULIB_MDA_OPEN = @GL_GNULIB_MDA_OPEN@ GL_GNULIB_MDA_PUTENV = @GL_GNULIB_MDA_PUTENV@ GL_GNULIB_MDA_PUTW = @GL_GNULIB_MDA_PUTW@ GL_GNULIB_MDA_READ = @GL_GNULIB_MDA_READ@ GL_GNULIB_MDA_RMDIR = @GL_GNULIB_MDA_RMDIR@ GL_GNULIB_MDA_STRDUP = @GL_GNULIB_MDA_STRDUP@ GL_GNULIB_MDA_SWAB = @GL_GNULIB_MDA_SWAB@ GL_GNULIB_MDA_TEMPNAM = @GL_GNULIB_MDA_TEMPNAM@ GL_GNULIB_MDA_TZSET = @GL_GNULIB_MDA_TZSET@ GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@ GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@ GL_GNULIB_MDA_WCSDUP = @GL_GNULIB_MDA_WCSDUP@ GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@ GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@ GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@ GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@ GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@ GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@ GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@ GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@ GL_GNULIB_MKFIFO = @GL_GNULIB_MKFIFO@ GL_GNULIB_MKFIFOAT = @GL_GNULIB_MKFIFOAT@ GL_GNULIB_MKNOD = @GL_GNULIB_MKNOD@ GL_GNULIB_MKNODAT = @GL_GNULIB_MKNODAT@ GL_GNULIB_MKOSTEMP = @GL_GNULIB_MKOSTEMP@ GL_GNULIB_MKOSTEMPS = @GL_GNULIB_MKOSTEMPS@ GL_GNULIB_MKSTEMP = @GL_GNULIB_MKSTEMP@ GL_GNULIB_MKSTEMPS = @GL_GNULIB_MKSTEMPS@ GL_GNULIB_MKTIME = @GL_GNULIB_MKTIME@ GL_GNULIB_NANOSLEEP = @GL_GNULIB_NANOSLEEP@ GL_GNULIB_NL_LANGINFO = @GL_GNULIB_NL_LANGINFO@ GL_GNULIB_NONBLOCKING = @GL_GNULIB_NONBLOCKING@ GL_GNULIB_OBSTACK_PRINTF = @GL_GNULIB_OBSTACK_PRINTF@ GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@ GL_GNULIB_OPEN = @GL_GNULIB_OPEN@ GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@ GL_GNULIB_OPENDIR = @GL_GNULIB_OPENDIR@ GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@ GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@ GL_GNULIB_PERROR = @GL_GNULIB_PERROR@ GL_GNULIB_PIPE = @GL_GNULIB_PIPE@ GL_GNULIB_PIPE2 = @GL_GNULIB_PIPE2@ GL_GNULIB_POPEN = @GL_GNULIB_POPEN@ GL_GNULIB_POSIX_MEMALIGN = @GL_GNULIB_POSIX_MEMALIGN@ GL_GNULIB_POSIX_OPENPT = @GL_GNULIB_POSIX_OPENPT@ GL_GNULIB_PREAD = @GL_GNULIB_PREAD@ GL_GNULIB_PRINTF = @GL_GNULIB_PRINTF@ GL_GNULIB_PRINTF_POSIX = @GL_GNULIB_PRINTF_POSIX@ GL_GNULIB_PSELECT = @GL_GNULIB_PSELECT@ GL_GNULIB_PTHREAD_COND = @GL_GNULIB_PTHREAD_COND@ GL_GNULIB_PTHREAD_MUTEX = @GL_GNULIB_PTHREAD_MUTEX@ GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK = @GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK@ GL_GNULIB_PTHREAD_ONCE = @GL_GNULIB_PTHREAD_ONCE@ GL_GNULIB_PTHREAD_RWLOCK = @GL_GNULIB_PTHREAD_RWLOCK@ GL_GNULIB_PTHREAD_SIGMASK = @GL_GNULIB_PTHREAD_SIGMASK@ GL_GNULIB_PTHREAD_SPIN = @GL_GNULIB_PTHREAD_SPIN@ GL_GNULIB_PTHREAD_THREAD = @GL_GNULIB_PTHREAD_THREAD@ GL_GNULIB_PTHREAD_TSS = @GL_GNULIB_PTHREAD_TSS@ GL_GNULIB_PTSNAME = @GL_GNULIB_PTSNAME@ GL_GNULIB_PTSNAME_R = @GL_GNULIB_PTSNAME_R@ GL_GNULIB_PUTC = @GL_GNULIB_PUTC@ GL_GNULIB_PUTCHAR = @GL_GNULIB_PUTCHAR@ GL_GNULIB_PUTENV = @GL_GNULIB_PUTENV@ GL_GNULIB_PUTS = @GL_GNULIB_PUTS@ GL_GNULIB_PWRITE = @GL_GNULIB_PWRITE@ GL_GNULIB_QSORT_R = @GL_GNULIB_QSORT_R@ GL_GNULIB_RAISE = @GL_GNULIB_RAISE@ GL_GNULIB_RANDOM = @GL_GNULIB_RANDOM@ GL_GNULIB_RANDOM_R = @GL_GNULIB_RANDOM_R@ GL_GNULIB_RAWMEMCHR = @GL_GNULIB_RAWMEMCHR@ GL_GNULIB_READ = @GL_GNULIB_READ@ GL_GNULIB_READDIR = @GL_GNULIB_READDIR@ GL_GNULIB_READLINK = @GL_GNULIB_READLINK@ GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@ GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@ GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@ GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@ GL_GNULIB_RECV = @GL_GNULIB_RECV@ GL_GNULIB_RECVFROM = @GL_GNULIB_RECVFROM@ GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@ GL_GNULIB_RENAME = @GL_GNULIB_RENAME@ GL_GNULIB_RENAMEAT = @GL_GNULIB_RENAMEAT@ GL_GNULIB_REWINDDIR = @GL_GNULIB_REWINDDIR@ GL_GNULIB_RMDIR = @GL_GNULIB_RMDIR@ GL_GNULIB_RPMATCH = @GL_GNULIB_RPMATCH@ GL_GNULIB_SCANDIR = @GL_GNULIB_SCANDIR@ GL_GNULIB_SCANF = @GL_GNULIB_SCANF@ GL_GNULIB_SCHED_YIELD = @GL_GNULIB_SCHED_YIELD@ GL_GNULIB_SECURE_GETENV = @GL_GNULIB_SECURE_GETENV@ GL_GNULIB_SELECT = @GL_GNULIB_SELECT@ GL_GNULIB_SEND = @GL_GNULIB_SEND@ GL_GNULIB_SENDTO = @GL_GNULIB_SENDTO@ GL_GNULIB_SETENV = @GL_GNULIB_SETENV@ GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@ GL_GNULIB_SETLOCALE = @GL_GNULIB_SETLOCALE@ GL_GNULIB_SETLOCALE_NULL = @GL_GNULIB_SETLOCALE_NULL@ GL_GNULIB_SETSOCKOPT = @GL_GNULIB_SETSOCKOPT@ GL_GNULIB_SHUTDOWN = @GL_GNULIB_SHUTDOWN@ GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@ GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@ GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@ GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@ GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@ GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@ GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@ GL_GNULIB_SOCKET = @GL_GNULIB_SOCKET@ GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@ GL_GNULIB_STAT = @GL_GNULIB_STAT@ GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@ GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@ GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@ GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@ GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@ GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@ GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@ GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@ GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@ GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@ GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@ GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@ GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@ GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@ GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@ GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@ GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@ GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@ GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@ GL_GNULIB_STRTOLD = @GL_GNULIB_STRTOLD@ GL_GNULIB_STRTOLL = @GL_GNULIB_STRTOLL@ GL_GNULIB_STRTOUL = @GL_GNULIB_STRTOUL@ GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@ GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@ GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@ GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@ GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@ GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@ GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@ GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@ GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@ GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@ GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@ GL_GNULIB_TOWCTRANS = @GL_GNULIB_TOWCTRANS@ GL_GNULIB_TRUNCATE = @GL_GNULIB_TRUNCATE@ GL_GNULIB_TTYNAME_R = @GL_GNULIB_TTYNAME_R@ GL_GNULIB_TZSET = @GL_GNULIB_TZSET@ GL_GNULIB_UNISTD_H_GETOPT = @GL_GNULIB_UNISTD_H_GETOPT@ GL_GNULIB_UNISTD_H_NONBLOCKING = @GL_GNULIB_UNISTD_H_NONBLOCKING@ GL_GNULIB_UNISTD_H_SIGPIPE = @GL_GNULIB_UNISTD_H_SIGPIPE@ GL_GNULIB_UNLINK = @GL_GNULIB_UNLINK@ GL_GNULIB_UNLINKAT = @GL_GNULIB_UNLINKAT@ GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@ GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@ GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@ GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@ GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@ GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@ GL_GNULIB_VFPRINTF = @GL_GNULIB_VFPRINTF@ GL_GNULIB_VFPRINTF_POSIX = @GL_GNULIB_VFPRINTF_POSIX@ GL_GNULIB_VFSCANF = @GL_GNULIB_VFSCANF@ GL_GNULIB_VPRINTF = @GL_GNULIB_VPRINTF@ GL_GNULIB_VPRINTF_POSIX = @GL_GNULIB_VPRINTF_POSIX@ GL_GNULIB_VSCANF = @GL_GNULIB_VSCANF@ GL_GNULIB_VSNPRINTF = @GL_GNULIB_VSNPRINTF@ GL_GNULIB_VSPRINTF_POSIX = @GL_GNULIB_VSPRINTF_POSIX@ GL_GNULIB_WCPCPY = @GL_GNULIB_WCPCPY@ GL_GNULIB_WCPNCPY = @GL_GNULIB_WCPNCPY@ GL_GNULIB_WCRTOMB = @GL_GNULIB_WCRTOMB@ GL_GNULIB_WCSCASECMP = @GL_GNULIB_WCSCASECMP@ GL_GNULIB_WCSCAT = @GL_GNULIB_WCSCAT@ GL_GNULIB_WCSCHR = @GL_GNULIB_WCSCHR@ GL_GNULIB_WCSCMP = @GL_GNULIB_WCSCMP@ GL_GNULIB_WCSCOLL = @GL_GNULIB_WCSCOLL@ GL_GNULIB_WCSCPY = @GL_GNULIB_WCSCPY@ GL_GNULIB_WCSCSPN = @GL_GNULIB_WCSCSPN@ GL_GNULIB_WCSDUP = @GL_GNULIB_WCSDUP@ GL_GNULIB_WCSFTIME = @GL_GNULIB_WCSFTIME@ GL_GNULIB_WCSLEN = @GL_GNULIB_WCSLEN@ GL_GNULIB_WCSNCASECMP = @GL_GNULIB_WCSNCASECMP@ GL_GNULIB_WCSNCAT = @GL_GNULIB_WCSNCAT@ GL_GNULIB_WCSNCMP = @GL_GNULIB_WCSNCMP@ GL_GNULIB_WCSNCPY = @GL_GNULIB_WCSNCPY@ GL_GNULIB_WCSNLEN = @GL_GNULIB_WCSNLEN@ GL_GNULIB_WCSNRTOMBS = @GL_GNULIB_WCSNRTOMBS@ GL_GNULIB_WCSPBRK = @GL_GNULIB_WCSPBRK@ GL_GNULIB_WCSRCHR = @GL_GNULIB_WCSRCHR@ GL_GNULIB_WCSRTOMBS = @GL_GNULIB_WCSRTOMBS@ GL_GNULIB_WCSSPN = @GL_GNULIB_WCSSPN@ GL_GNULIB_WCSSTR = @GL_GNULIB_WCSSTR@ GL_GNULIB_WCSTOK = @GL_GNULIB_WCSTOK@ GL_GNULIB_WCSWIDTH = @GL_GNULIB_WCSWIDTH@ GL_GNULIB_WCSXFRM = @GL_GNULIB_WCSXFRM@ GL_GNULIB_WCTOB = @GL_GNULIB_WCTOB@ GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@ GL_GNULIB_WCTRANS = @GL_GNULIB_WCTRANS@ GL_GNULIB_WCTYPE = @GL_GNULIB_WCTYPE@ GL_GNULIB_WCWIDTH = @GL_GNULIB_WCWIDTH@ GL_GNULIB_WMEMCHR = @GL_GNULIB_WMEMCHR@ GL_GNULIB_WMEMCMP = @GL_GNULIB_WMEMCMP@ GL_GNULIB_WMEMCPY = @GL_GNULIB_WMEMCPY@ GL_GNULIB_WMEMMOVE = @GL_GNULIB_WMEMMOVE@ GL_GNULIB_WMEMPCPY = @GL_GNULIB_WMEMPCPY@ GL_GNULIB_WMEMSET = @GL_GNULIB_WMEMSET@ GL_GNULIB_WRITE = @GL_GNULIB_WRITE@ GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_TEST_WARN_CFLAGS = @GNULIB_TEST_WARN_CFLAGS@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ GREP = @GREP@ HAVE_ACCEPT4 = @HAVE_ACCEPT4@ HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@ HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@ HAVE_DECL_DIRFD = @HAVE_DECL_DIRFD@ HAVE_DECL_ECVT = @HAVE_DECL_ECVT@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXECVPE = @HAVE_DECL_EXECVPE@ HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ HAVE_DECL_FCLOSEALL = @HAVE_DECL_FCLOSEALL@ HAVE_DECL_FCVT = @HAVE_DECL_FCVT@ HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@ HAVE_DECL_FDOPENDIR = @HAVE_DECL_FDOPENDIR@ HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@ HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@ HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@ HAVE_DECL_GCVT = @HAVE_DECL_GCVT@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@ HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@ HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCSDUP = @HAVE_DECL_WCSDUP@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DIRENT_H = @HAVE_DIRENT_H@ HAVE_DPRINTF = @HAVE_DPRINTF@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_EXECVPE = @HAVE_EXECVPE@ HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHMODAT = @HAVE_FCHMODAT@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FCNTL = @HAVE_FCNTL@ HAVE_FDATASYNC = @HAVE_FDATASYNC@ HAVE_FDOPENDIR = @HAVE_FDOPENDIR@ HAVE_FEATURES_H = @HAVE_FEATURES_H@ HAVE_FFSL = @HAVE_FFSL@ HAVE_FFSLL = @HAVE_FFSLL@ HAVE_FNMATCH = @HAVE_FNMATCH@ HAVE_FNMATCH_H = @HAVE_FNMATCH_H@ HAVE_FREELOCALE = @HAVE_FREELOCALE@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FSTATAT = @HAVE_FSTATAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_FUTIMENS = @HAVE_FUTIMENS@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETENTROPY = @HAVE_GETENTROPY@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETPASS = @HAVE_GETPASS@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ HAVE_GETUMASK = @HAVE_GETUMASK@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISBLANK = @HAVE_ISBLANK@ HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LANGINFO_ALTMON = @HAVE_LANGINFO_ALTMON@ HAVE_LANGINFO_CODESET = @HAVE_LANGINFO_CODESET@ HAVE_LANGINFO_ERA = @HAVE_LANGINFO_ERA@ HAVE_LANGINFO_H = @HAVE_LANGINFO_H@ HAVE_LANGINFO_T_FMT_AMPM = @HAVE_LANGINFO_T_FMT_AMPM@ HAVE_LANGINFO_YESEXPR = @HAVE_LANGINFO_YESEXPR@ HAVE_LCHMOD = @HAVE_LCHMOD@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDIRAT = @HAVE_MKDIRAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ HAVE_MKFIFO = @HAVE_MKFIFO@ HAVE_MKFIFOAT = @HAVE_MKFIFOAT@ HAVE_MKNOD = @HAVE_MKNOD@ HAVE_MKNODAT = @HAVE_MKNODAT@ HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ HAVE_MKSTEMP = @HAVE_MKSTEMP@ HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@ HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@ HAVE_NEWLOCALE = @HAVE_NEWLOCALE@ HAVE_NL_LANGINFO = @HAVE_NL_LANGINFO@ HAVE_OPENAT = @HAVE_OPENAT@ HAVE_OPENDIR = @HAVE_OPENDIR@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PCLOSE = @HAVE_PCLOSE@ HAVE_PIPE = @HAVE_PIPE@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_POPEN = @HAVE_POPEN@ HAVE_POSIX_MEMALIGN = @HAVE_POSIX_MEMALIGN@ HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PSELECT = @HAVE_PSELECT@ HAVE_PTHREAD_ATTR_DESTROY = @HAVE_PTHREAD_ATTR_DESTROY@ HAVE_PTHREAD_ATTR_GETDETACHSTATE = @HAVE_PTHREAD_ATTR_GETDETACHSTATE@ HAVE_PTHREAD_ATTR_INIT = @HAVE_PTHREAD_ATTR_INIT@ HAVE_PTHREAD_ATTR_SETDETACHSTATE = @HAVE_PTHREAD_ATTR_SETDETACHSTATE@ HAVE_PTHREAD_CONDATTR_DESTROY = @HAVE_PTHREAD_CONDATTR_DESTROY@ HAVE_PTHREAD_CONDATTR_INIT = @HAVE_PTHREAD_CONDATTR_INIT@ HAVE_PTHREAD_COND_BROADCAST = @HAVE_PTHREAD_COND_BROADCAST@ HAVE_PTHREAD_COND_DESTROY = @HAVE_PTHREAD_COND_DESTROY@ HAVE_PTHREAD_COND_INIT = @HAVE_PTHREAD_COND_INIT@ HAVE_PTHREAD_COND_SIGNAL = @HAVE_PTHREAD_COND_SIGNAL@ HAVE_PTHREAD_COND_TIMEDWAIT = @HAVE_PTHREAD_COND_TIMEDWAIT@ HAVE_PTHREAD_COND_WAIT = @HAVE_PTHREAD_COND_WAIT@ HAVE_PTHREAD_CREATE = @HAVE_PTHREAD_CREATE@ HAVE_PTHREAD_CREATE_DETACHED = @HAVE_PTHREAD_CREATE_DETACHED@ HAVE_PTHREAD_DETACH = @HAVE_PTHREAD_DETACH@ HAVE_PTHREAD_EQUAL = @HAVE_PTHREAD_EQUAL@ HAVE_PTHREAD_EXIT = @HAVE_PTHREAD_EXIT@ HAVE_PTHREAD_GETSPECIFIC = @HAVE_PTHREAD_GETSPECIFIC@ HAVE_PTHREAD_H = @HAVE_PTHREAD_H@ HAVE_PTHREAD_JOIN = @HAVE_PTHREAD_JOIN@ HAVE_PTHREAD_KEY_CREATE = @HAVE_PTHREAD_KEY_CREATE@ HAVE_PTHREAD_KEY_DELETE = @HAVE_PTHREAD_KEY_DELETE@ HAVE_PTHREAD_MUTEXATTR_DESTROY = @HAVE_PTHREAD_MUTEXATTR_DESTROY@ HAVE_PTHREAD_MUTEXATTR_GETROBUST = @HAVE_PTHREAD_MUTEXATTR_GETROBUST@ HAVE_PTHREAD_MUTEXATTR_GETTYPE = @HAVE_PTHREAD_MUTEXATTR_GETTYPE@ HAVE_PTHREAD_MUTEXATTR_INIT = @HAVE_PTHREAD_MUTEXATTR_INIT@ HAVE_PTHREAD_MUTEXATTR_SETROBUST = @HAVE_PTHREAD_MUTEXATTR_SETROBUST@ HAVE_PTHREAD_MUTEXATTR_SETTYPE = @HAVE_PTHREAD_MUTEXATTR_SETTYPE@ HAVE_PTHREAD_MUTEX_DESTROY = @HAVE_PTHREAD_MUTEX_DESTROY@ HAVE_PTHREAD_MUTEX_INIT = @HAVE_PTHREAD_MUTEX_INIT@ HAVE_PTHREAD_MUTEX_LOCK = @HAVE_PTHREAD_MUTEX_LOCK@ HAVE_PTHREAD_MUTEX_RECURSIVE = @HAVE_PTHREAD_MUTEX_RECURSIVE@ HAVE_PTHREAD_MUTEX_ROBUST = @HAVE_PTHREAD_MUTEX_ROBUST@ HAVE_PTHREAD_MUTEX_TIMEDLOCK = @HAVE_PTHREAD_MUTEX_TIMEDLOCK@ HAVE_PTHREAD_MUTEX_TRYLOCK = @HAVE_PTHREAD_MUTEX_TRYLOCK@ HAVE_PTHREAD_MUTEX_UNLOCK = @HAVE_PTHREAD_MUTEX_UNLOCK@ HAVE_PTHREAD_ONCE = @HAVE_PTHREAD_ONCE@ HAVE_PTHREAD_PROCESS_SHARED = @HAVE_PTHREAD_PROCESS_SHARED@ HAVE_PTHREAD_RWLOCKATTR_DESTROY = @HAVE_PTHREAD_RWLOCKATTR_DESTROY@ HAVE_PTHREAD_RWLOCKATTR_INIT = @HAVE_PTHREAD_RWLOCKATTR_INIT@ HAVE_PTHREAD_RWLOCK_DESTROY = @HAVE_PTHREAD_RWLOCK_DESTROY@ HAVE_PTHREAD_RWLOCK_INIT = @HAVE_PTHREAD_RWLOCK_INIT@ HAVE_PTHREAD_RWLOCK_RDLOCK = @HAVE_PTHREAD_RWLOCK_RDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@ HAVE_PTHREAD_RWLOCK_TRYRDLOCK = @HAVE_PTHREAD_RWLOCK_TRYRDLOCK@ HAVE_PTHREAD_RWLOCK_TRYWRLOCK = @HAVE_PTHREAD_RWLOCK_TRYWRLOCK@ HAVE_PTHREAD_RWLOCK_UNLOCK = @HAVE_PTHREAD_RWLOCK_UNLOCK@ HAVE_PTHREAD_RWLOCK_WRLOCK = @HAVE_PTHREAD_RWLOCK_WRLOCK@ HAVE_PTHREAD_SELF = @HAVE_PTHREAD_SELF@ HAVE_PTHREAD_SETSPECIFIC = @HAVE_PTHREAD_SETSPECIFIC@ HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@ HAVE_PTHREAD_SPINLOCK_T = @HAVE_PTHREAD_SPINLOCK_T@ HAVE_PTHREAD_SPIN_DESTROY = @HAVE_PTHREAD_SPIN_DESTROY@ HAVE_PTHREAD_SPIN_INIT = @HAVE_PTHREAD_SPIN_INIT@ HAVE_PTHREAD_SPIN_LOCK = @HAVE_PTHREAD_SPIN_LOCK@ HAVE_PTHREAD_SPIN_TRYLOCK = @HAVE_PTHREAD_SPIN_TRYLOCK@ HAVE_PTHREAD_SPIN_UNLOCK = @HAVE_PTHREAD_SPIN_UNLOCK@ HAVE_PTHREAD_T = @HAVE_PTHREAD_T@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RAISE = @HAVE_RAISE@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READDIR = @HAVE_READDIR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RENAMEAT = @HAVE_RENAMEAT@ HAVE_REWINDDIR = @HAVE_REWINDDIR@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SA_FAMILY_T = @HAVE_SA_FAMILY_T@ HAVE_SCANDIR = @HAVE_SCANDIR@ HAVE_SCHED_H = @HAVE_SCHED_H@ HAVE_SCHED_YIELD = @HAVE_SCHED_YIELD@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ HAVE_SETSTATE = @HAVE_SETSTATE@ HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@ HAVE_SIGACTION = @HAVE_SIGACTION@ HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@ HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRTOL = @HAVE_STRTOL@ HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOUL = @HAVE_STRTOUL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRUCT_SCHED_PARAM = @HAVE_STRUCT_SCHED_PARAM@ HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@ HAVE_STRUCT_SOCKADDR_STORAGE = @HAVE_STRUCT_SOCKADDR_STORAGE@ HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = @HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_IOCTL_H = @HAVE_SYS_IOCTL_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@ HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_SYS_UIO_H = @HAVE_SYS_UIO_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@ HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_VDPRINTF = @HAVE_VDPRINTF@ HAVE_VISIBILITY = @HAVE_VISIBILITY@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCPCPY = @HAVE_WCPCPY@ HAVE_WCPNCPY = @HAVE_WCPNCPY@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ HAVE_WCSCASECMP = @HAVE_WCSCASECMP@ HAVE_WCSCAT = @HAVE_WCSCAT@ HAVE_WCSCHR = @HAVE_WCSCHR@ HAVE_WCSCMP = @HAVE_WCSCMP@ HAVE_WCSCOLL = @HAVE_WCSCOLL@ HAVE_WCSCPY = @HAVE_WCSCPY@ HAVE_WCSCSPN = @HAVE_WCSCSPN@ HAVE_WCSDUP = @HAVE_WCSDUP@ HAVE_WCSFTIME = @HAVE_WCSFTIME@ HAVE_WCSLEN = @HAVE_WCSLEN@ HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@ HAVE_WCSNCAT = @HAVE_WCSNCAT@ HAVE_WCSNCMP = @HAVE_WCSNCMP@ HAVE_WCSNCPY = @HAVE_WCSNCPY@ HAVE_WCSNLEN = @HAVE_WCSNLEN@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSPBRK = @HAVE_WCSPBRK@ HAVE_WCSRCHR = @HAVE_WCSRCHR@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCSSPN = @HAVE_WCSSPN@ HAVE_WCSSTR = @HAVE_WCSSTR@ HAVE_WCSTOK = @HAVE_WCSTOK@ HAVE_WCSWIDTH = @HAVE_WCSWIDTH@ HAVE_WCSXFRM = @HAVE_WCSXFRM@ HAVE_WCTRANS_T = @HAVE_WCTRANS_T@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WCTYPE_T = @HAVE_WCTYPE_T@ HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE_WMEMCHR = @HAVE_WMEMCHR@ HAVE_WMEMCMP = @HAVE_WMEMCMP@ HAVE_WMEMCPY = @HAVE_WMEMCPY@ HAVE_WMEMMOVE = @HAVE_WMEMMOVE@ HAVE_WMEMPCPY = @HAVE_WMEMPCPY@ HAVE_WMEMSET = @HAVE_WMEMSET@ HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@ HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HAVE__EXIT = @HAVE__EXIT@ HOST_CPU = @HOST_CPU@ HOST_CPU_C_ABI = @HOST_CPU_C_ABI@ ICONV_CONST = @ICONV_CONST@ ICONV_H = @ICONV_H@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INET_PTON_LIB = @INET_PTON_LIB@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBCSTACK = @LIBCSTACK@ LIBGREPUTILS_LIBDEPS = @LIBGREPUTILS_LIBDEPS@ LIBGREPUTILS_LTLIBDEPS = @LIBGREPUTILS_LTLIBDEPS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ LIBPMULTITHREAD = @LIBPMULTITHREAD@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBSIGSEGV = @LIBSIGSEGV@ LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@ LIBSOCKET = @LIBSOCKET@ LIBSTDTHREAD = @LIBSTDTHREAD@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ LIBTHREAD = @LIBTHREAD@ LIBUNISTRING_UNISTR_H = @LIBUNISTRING_UNISTR_H@ LIBUNISTRING_UNITYPES_H = @LIBUNISTRING_UNITYPES_H@ LIBUNISTRING_UNIWIDTH_H = @LIBUNISTRING_UNIWIDTH_H@ LIB_HARD_LOCALE = @LIB_HARD_LOCALE@ LIB_MBRTOWC = @LIB_MBRTOWC@ LIB_NANOSLEEP = @LIB_NANOSLEEP@ LIB_NL_LANGINFO = @LIB_NL_LANGINFO@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ LIB_SCHED_YIELD = @LIB_SCHED_YIELD@ LIB_SELECT = @LIB_SELECT@ LIB_SETLOCALE = @LIB_SETLOCALE@ LIB_SETLOCALE_NULL = @LIB_SETLOCALE_NULL@ LIMITS_H = @LIMITS_H@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALENAME_ENHANCE_LOCALE_FUNCS = @LOCALENAME_ENHANCE_LOCALE_FUNCS@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBCSTACK = @LTLIBCSTACK@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ LTLIBSIGSEGV = @LTLIBSIGSEGV@ LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ NETINET_IN_H = @NETINET_IN_H@ NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_CTYPE_H@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H = @NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@ NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@ NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H = @NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H@ NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H = @NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H@ NEXT_AS_FIRST_DIRECTIVE_SCHED_H = @NEXT_AS_FIRST_DIRECTIVE_SCHED_H@ NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@ NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_CTYPE_H = @NEXT_CTYPE_H@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_FNMATCH_H = @NEXT_FNMATCH_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ NEXT_LANGINFO_H = @NEXT_LANGINFO_H@ NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@ NEXT_PTHREAD_H = @NEXT_PTHREAD_H@ NEXT_SCHED_H = @NEXT_SCHED_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_IOCTL_H = @NEXT_SYS_IOCTL_H@ NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@ NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@ NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NEXT_WCHAR_H = @NEXT_WCHAR_H@ NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_LIBS = @PCRE_LIBS@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ PRAGMA_COLUMNS = @PRAGMA_COLUMNS@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ PRIPTR_PREFIX = @PRIPTR_PREFIX@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_ACCESS = @REPLACE_ACCESS@ REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@ REPLACE_BTOWC = @REPLACE_BTOWC@ REPLACE_CALLOC = @REPLACE_CALLOC@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@ REPLACE_CREAT = @REPLACE_CREAT@ REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ REPLACE_EXECL = @REPLACE_EXECL@ REPLACE_EXECLE = @REPLACE_EXECLE@ REPLACE_EXECLP = @REPLACE_EXECLP@ REPLACE_EXECV = @REPLACE_EXECV@ REPLACE_EXECVE = @REPLACE_EXECVE@ REPLACE_EXECVP = @REPLACE_EXECVP@ REPLACE_EXECVPE = @REPLACE_EXECVPE@ REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHMODAT = @REPLACE_FCHMODAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ REPLACE_FDOPEN = @REPLACE_FDOPEN@ REPLACE_FDOPENDIR = @REPLACE_FDOPENDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ REPLACE_FFSLL = @REPLACE_FFSLL@ REPLACE_FNMATCH = @REPLACE_FNMATCH@ REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ REPLACE_FPURGE = @REPLACE_FPURGE@ REPLACE_FREE = @REPLACE_FREE@ REPLACE_FREELOCALE = @REPLACE_FREELOCALE@ REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FSEEK = @REPLACE_FSEEK@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FSTAT = @REPLACE_FSTAT@ REPLACE_FSTATAT = @REPLACE_FSTATAT@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@ REPLACE_FUTIMENS = @REPLACE_FUTIMENS@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETDELIM = @REPLACE_GETDELIM@ REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ REPLACE_GETDTABLESIZE = @REPLACE_GETDTABLESIZE@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETLINE = @REPLACE_GETLINE@ REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETPASS = @REPLACE_GETPASS@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ REPLACE_GMTIME = @REPLACE_GMTIME@ REPLACE_ICONV = @REPLACE_ICONV@ REPLACE_ICONV_OPEN = @REPLACE_ICONV_OPEN@ REPLACE_ICONV_UTF = @REPLACE_ICONV_UTF@ REPLACE_INET_NTOP = @REPLACE_INET_NTOP@ REPLACE_INET_PTON = @REPLACE_INET_PTON@ REPLACE_INITSTATE = @REPLACE_INITSTATE@ REPLACE_IOCTL = @REPLACE_IOCTL@ REPLACE_ISATTY = @REPLACE_ISATTY@ REPLACE_ISWBLANK = @REPLACE_ISWBLANK@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_ISWDIGIT = @REPLACE_ISWDIGIT@ REPLACE_ISWXDIGIT = @REPLACE_ISWXDIGIT@ REPLACE_ITOLD = @REPLACE_ITOLD@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LOCALECONV = @REPLACE_LOCALECONV@ REPLACE_LOCALTIME = @REPLACE_LOCALTIME@ REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_LSTAT = @REPLACE_LSTAT@ REPLACE_MALLOC = @REPLACE_MALLOC@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ REPLACE_MBSINIT = @REPLACE_MBSINIT@ REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@ REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@ REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@ REPLACE_MBTOWC = @REPLACE_MBTOWC@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKDIR = @REPLACE_MKDIR@ REPLACE_MKFIFO = @REPLACE_MKFIFO@ REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@ REPLACE_MKNOD = @REPLACE_MKNOD@ REPLACE_MKNODAT = @REPLACE_MKNODAT@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_MKTIME = @REPLACE_MKTIME@ REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ REPLACE_NEWLOCALE = @REPLACE_NEWLOCALE@ REPLACE_NL_LANGINFO = @REPLACE_NL_LANGINFO@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ REPLACE_OPEN = @REPLACE_OPEN@ REPLACE_OPENAT = @REPLACE_OPENAT@ REPLACE_OPENDIR = @REPLACE_OPENDIR@ REPLACE_PERROR = @REPLACE_PERROR@ REPLACE_POPEN = @REPLACE_POPEN@ REPLACE_POSIX_MEMALIGN = @REPLACE_POSIX_MEMALIGN@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PRINTF = @REPLACE_PRINTF@ REPLACE_PSELECT = @REPLACE_PSELECT@ REPLACE_PTHREAD_ATTR_DESTROY = @REPLACE_PTHREAD_ATTR_DESTROY@ REPLACE_PTHREAD_ATTR_GETDETACHSTATE = @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@ REPLACE_PTHREAD_ATTR_INIT = @REPLACE_PTHREAD_ATTR_INIT@ REPLACE_PTHREAD_ATTR_SETDETACHSTATE = @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@ REPLACE_PTHREAD_CONDATTR_DESTROY = @REPLACE_PTHREAD_CONDATTR_DESTROY@ REPLACE_PTHREAD_CONDATTR_INIT = @REPLACE_PTHREAD_CONDATTR_INIT@ REPLACE_PTHREAD_COND_BROADCAST = @REPLACE_PTHREAD_COND_BROADCAST@ REPLACE_PTHREAD_COND_DESTROY = @REPLACE_PTHREAD_COND_DESTROY@ REPLACE_PTHREAD_COND_INIT = @REPLACE_PTHREAD_COND_INIT@ REPLACE_PTHREAD_COND_SIGNAL = @REPLACE_PTHREAD_COND_SIGNAL@ REPLACE_PTHREAD_COND_TIMEDWAIT = @REPLACE_PTHREAD_COND_TIMEDWAIT@ REPLACE_PTHREAD_COND_WAIT = @REPLACE_PTHREAD_COND_WAIT@ REPLACE_PTHREAD_CREATE = @REPLACE_PTHREAD_CREATE@ REPLACE_PTHREAD_DETACH = @REPLACE_PTHREAD_DETACH@ REPLACE_PTHREAD_EQUAL = @REPLACE_PTHREAD_EQUAL@ REPLACE_PTHREAD_EXIT = @REPLACE_PTHREAD_EXIT@ REPLACE_PTHREAD_GETSPECIFIC = @REPLACE_PTHREAD_GETSPECIFIC@ REPLACE_PTHREAD_JOIN = @REPLACE_PTHREAD_JOIN@ REPLACE_PTHREAD_KEY_CREATE = @REPLACE_PTHREAD_KEY_CREATE@ REPLACE_PTHREAD_KEY_DELETE = @REPLACE_PTHREAD_KEY_DELETE@ REPLACE_PTHREAD_MUTEXATTR_DESTROY = @REPLACE_PTHREAD_MUTEXATTR_DESTROY@ REPLACE_PTHREAD_MUTEXATTR_GETROBUST = @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@ REPLACE_PTHREAD_MUTEXATTR_GETTYPE = @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@ REPLACE_PTHREAD_MUTEXATTR_INIT = @REPLACE_PTHREAD_MUTEXATTR_INIT@ REPLACE_PTHREAD_MUTEXATTR_SETROBUST = @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@ REPLACE_PTHREAD_MUTEXATTR_SETTYPE = @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@ REPLACE_PTHREAD_MUTEX_DESTROY = @REPLACE_PTHREAD_MUTEX_DESTROY@ REPLACE_PTHREAD_MUTEX_INIT = @REPLACE_PTHREAD_MUTEX_INIT@ REPLACE_PTHREAD_MUTEX_LOCK = @REPLACE_PTHREAD_MUTEX_LOCK@ REPLACE_PTHREAD_MUTEX_TIMEDLOCK = @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@ REPLACE_PTHREAD_MUTEX_TRYLOCK = @REPLACE_PTHREAD_MUTEX_TRYLOCK@ REPLACE_PTHREAD_MUTEX_UNLOCK = @REPLACE_PTHREAD_MUTEX_UNLOCK@ REPLACE_PTHREAD_ONCE = @REPLACE_PTHREAD_ONCE@ REPLACE_PTHREAD_RWLOCKATTR_DESTROY = @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@ REPLACE_PTHREAD_RWLOCKATTR_INIT = @REPLACE_PTHREAD_RWLOCKATTR_INIT@ REPLACE_PTHREAD_RWLOCK_DESTROY = @REPLACE_PTHREAD_RWLOCK_DESTROY@ REPLACE_PTHREAD_RWLOCK_INIT = @REPLACE_PTHREAD_RWLOCK_INIT@ REPLACE_PTHREAD_RWLOCK_RDLOCK = @REPLACE_PTHREAD_RWLOCK_RDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@ REPLACE_PTHREAD_RWLOCK_TRYRDLOCK = @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@ REPLACE_PTHREAD_RWLOCK_TRYWRLOCK = @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@ REPLACE_PTHREAD_RWLOCK_UNLOCK = @REPLACE_PTHREAD_RWLOCK_UNLOCK@ REPLACE_PTHREAD_RWLOCK_WRLOCK = @REPLACE_PTHREAD_RWLOCK_WRLOCK@ REPLACE_PTHREAD_SELF = @REPLACE_PTHREAD_SELF@ REPLACE_PTHREAD_SETSPECIFIC = @REPLACE_PTHREAD_SETSPECIFIC@ REPLACE_PTHREAD_SIGMASK = @REPLACE_PTHREAD_SIGMASK@ REPLACE_PTHREAD_SPIN_DESTROY = @REPLACE_PTHREAD_SPIN_DESTROY@ REPLACE_PTHREAD_SPIN_INIT = @REPLACE_PTHREAD_SPIN_INIT@ REPLACE_PTHREAD_SPIN_LOCK = @REPLACE_PTHREAD_SPIN_LOCK@ REPLACE_PTHREAD_SPIN_TRYLOCK = @REPLACE_PTHREAD_SPIN_TRYLOCK@ REPLACE_PTHREAD_SPIN_UNLOCK = @REPLACE_PTHREAD_SPIN_UNLOCK@ REPLACE_PTSNAME = @REPLACE_PTSNAME@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RAISE = @REPLACE_RAISE@ REPLACE_RANDOM = @REPLACE_RANDOM@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SCHED_YIELD = @REPLACE_SCHED_YIELD@ REPLACE_SELECT = @REPLACE_SELECT@ REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SETLOCALE = @REPLACE_SETLOCALE@ REPLACE_SETSTATE = @REPLACE_SETSTATE@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ REPLACE_STAT = @REPLACE_STAT@ REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@ REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRTOL = @REPLACE_STRTOL@ REPLACE_STRTOLD = @REPLACE_STRTOLD@ REPLACE_STRTOLL = @REPLACE_STRTOLL@ REPLACE_STRTOUL = @REPLACE_STRTOUL@ REPLACE_STRTOULL = @REPLACE_STRTOULL@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TOWLOWER = @REPLACE_TOWLOWER@ REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_TZSET = @REPLACE_TZSET@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VDPRINTF = @REPLACE_VDPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ REPLACE_WCSTOK = @REPLACE_WCSTOK@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ REPLACE_WCTOMB = @REPLACE_WCTOMB@ REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIGSEGV_H = @SIGSEGV_H@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STDALIGN_H = @STDALIGN_H@ STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_IOCTL_H_HAVE_WINSOCK2_H = @SYS_IOCTL_H_HAVE_WINSOCK2_H@ SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@ UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WERROR_CFLAGS = @WERROR_CFLAGS@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@ WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_aux_dir = @abs_aux_dir@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localedir = $(datadir)/locale localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LN = ln AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PCRE_CFLAGS) # Tell the linker to omit references to unused shared libraries. AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS) bin_SCRIPTS = egrep fgrep grep_SOURCES = dfasearch.c die.h grep.c kwsearch.c kwset.c \ searchutils.c $(am__append_1) noinst_HEADERS = grep.h kwset.h search.h system.h # Sometimes, the expansion of $(LIBINTL) includes -lc which may # include modules defining variables like 'optind', so libgreputils.a # must precede $(LIBINTL) in order to ensure we use GNU getopt. # But libgreputils.a must also follow $(LIBINTL), since libintl uses # replacement functions defined in libgreputils.a. LDADD = \ ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a $(LIBICONV) \ $(LIBTHREAD) grep_LDADD = $(LDADD) $(PCRE_LIBS) $(LIBCSTACK) AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib EXTRA_DIST = egrep.sh CLEANFILES = egrep fgrep *-t all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) grep$(EXEEXT): $(grep_OBJECTS) $(grep_DEPENDENCIES) $(EXTRA_grep_DEPENDENCIES) @rm -f grep$(EXEEXT) $(AM_V_CCLD)$(LINK) $(grep_OBJECTS) $(grep_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfasearch.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grep.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kwsearch.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kwset.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcresearch.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/searchutils.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/dfasearch.Po -rm -f ./$(DEPDIR)/grep.Po -rm -f ./$(DEPDIR)/kwsearch.Po -rm -f ./$(DEPDIR)/kwset.Po -rm -f ./$(DEPDIR)/pcresearch.Po -rm -f ./$(DEPDIR)/searchutils.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-binSCRIPTS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/dfasearch.Po -rm -f ./$(DEPDIR)/grep.Po -rm -f ./$(DEPDIR)/kwsearch.Po -rm -f ./$(DEPDIR)/kwset.Po -rm -f ./$(DEPDIR)/pcresearch.Po -rm -f ./$(DEPDIR)/searchutils.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-binPROGRAMS install-binSCRIPTS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-binSCRIPTS .PRECIOUS: Makefile egrep fgrep: egrep.sh Makefile $(AM_V_GEN)grep=`echo grep | sed -e '$(transform)'` && \ case $@ in egrep) option=-E;; fgrep) option=-F;; esac && \ shell_does_substrings='set x/y && d=$${1%/*} && test "$$d" = x' && \ if $(SHELL) -c "$$shell_does_substrings" 2>/dev/null; then \ edit_substring='s,X,X,'; \ else \ edit_substring='s,\$${0%/\*},`expr "X$$0" : '\''X\\(.*\\)/'\''`,g'; \ fi && \ sed -e 's|[@]SHELL@|$(SHELL)|g' \ -e "$$edit_substring" \ -e "s|[@]grep@|$$grep|g" \ -e "s|[@]option@|$$option|g" <$(srcdir)/egrep.sh >$@-t $(AM_V_at)chmod +x $@-t $(AM_V_at)mv $@-t $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: kbuild-3608/src/grep/src/grep.c0000664000175000017500000030000014670377427016334 0ustar locutuslocutus/* grep.c - main driver file for grep. Copyright (C) 1992, 1997-2002, 2004-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written July 1992 by Mike Haertel. */ #include #include #include #include #include #include #include #include #include "system.h" #include "argmatch.h" #include "c-ctype.h" #include "c-stack.h" #include "closeout.h" #include "colorize.h" #include "die.h" #include "error.h" #include "exclude.h" #include "exitfail.h" #include "fcntl-safer.h" #if defined(KMK_GREP) && defined(KBUILD_OS_WINDOWS) # include "nt/fts-nt.h" /* Use NT optimized FTS implementation. */ #else #include "fts_.h" #endif #include "getopt.h" #include "getprogname.h" #include "grep.h" #include "hash.h" #include "intprops.h" #include "propername.h" #include "safe-read.h" #include "search.h" #include "c-strcase.h" #include "version-etc.h" #include "xalloc.h" #include "xbinary-io.h" #include "xstrtol.h" #if defined(KMK_GREP) && defined(KBUILD_OS_WINDOWS) # include "console.h" #endif enum { SEP_CHAR_SELECTED = ':' }; enum { SEP_CHAR_REJECTED = '-' }; static char const SEP_STR_GROUP[] = "--"; /* When stdout is connected to a regular file, save its stat information here, so that we can automatically skip it, thus avoiding a potential (racy) infinite loop. */ static struct stat out_stat; /* if non-zero, display usage information and exit */ static int show_help; /* Print the version on standard output and exit. */ static bool show_version; /* Suppress diagnostics for nonexistent or unreadable files. */ static bool suppress_errors; /* If nonzero, use color markers. */ static int color_option; /* Show only the part of a line matching the expression. */ static bool only_matching; /* If nonzero, make sure first content char in a line is on a tab stop. */ static bool align_tabs; /* Print width of line numbers and byte offsets. Nonzero if ALIGN_TABS. */ static int offset_width; /* An entry in the PATLOC array saying where patterns came from. */ struct patloc { /* Line number of the pattern in PATTERN_ARRAY. Line numbers start at 0, and each pattern is terminated by '\n'. */ ptrdiff_t lineno; /* Input location of the pattern. The FILENAME "-" represents standard input, and "" represents the command line. FILELINE is origin-1 for files and is irrelevant for the command line. */ char const *filename; ptrdiff_t fileline; }; /* The array of pattern locations. The concatenation of all patterns is stored in a single array, KEYS. Given the invocation 'grep -f <(seq 5) -f <(seq 6) -f <(seq 3)', there will initially be 28 bytes in KEYS. After duplicate patterns are removed, KEYS will have 12 bytes and PATLOC will be {0,x,1}, {10,y,1} where x, y and z are just place-holders for shell-generated names since and z is omitted as it contains only duplicates. Sometimes removing duplicates will grow PATLOC, since each run of removed patterns not at a file start or end requires another PATLOC entry for the first non-removed pattern. */ static struct patloc *patloc; static size_t patlocs_allocated, patlocs_used; /* Pointer to the array of patterns, each terminated by newline. */ static char *pattern_array; /* The number of unique patterns seen so far. */ static size_t n_patterns; /* Hash table of patterns seen so far. */ static Hash_table *pattern_table; /* Hash and compare newline-terminated patterns for textual equality. Patterns are represented by origin-1 offsets into PATTERN_ARRAY, cast to void *. The origin-1 is so that the first pattern offset does not appear to be a null pointer when cast to void *. */ static size_t _GL_ATTRIBUTE_PURE hash_pattern (void const *pat, size_t n_buckets) { size_t h = 0; intptr_t pat_offset = (intptr_t) pat - 1; unsigned char const *s = (unsigned char const *) pattern_array + pat_offset; for ( ; *s != '\n'; s++) h = h * 33 ^ *s; return h % n_buckets; } static bool _GL_ATTRIBUTE_PURE compare_patterns (void const *a, void const *b) { intptr_t a_offset = (intptr_t) a - 1; intptr_t b_offset = (intptr_t) b - 1; char const *p = pattern_array + a_offset; char const *q = pattern_array + b_offset; for (; *p == *q; p++, q++) if (*p == '\n') return true; return false; } /* Update KEYS to remove duplicate patterns, and return the number of bytes in the resulting KEYS. KEYS contains a sequence of patterns each terminated by '\n'. The first DUPFREE_SIZE bytes are a sequence of patterns with no duplicates; SIZE is the total number of bytes in KEYS. If some patterns past the first DUPFREE_SIZE bytes are not duplicates, update PATLOCS accordingly. */ static ptrdiff_t update_patterns (char *keys, ptrdiff_t dupfree_size, ptrdiff_t size, char const *filename) { char *dst = keys + dupfree_size; ptrdiff_t fileline = 1; int prev_inserted = 0; char const *srclim = keys + size; ptrdiff_t patsize; for (char const *src = keys + dupfree_size; src < srclim; src += patsize) { char const *patend = rawmemchr (src, '\n'); patsize = patend + 1 - src; memmove (dst, src, patsize); intptr_t dst_offset_1 = dst - keys + 1; int inserted = hash_insert_if_absent (pattern_table, (void *) dst_offset_1, NULL); if (inserted) { if (inserted < 0) xalloc_die (); dst += patsize; /* Add a PATLOCS entry unless this input line is simply the next one in the same file. */ if (!prev_inserted) { if (patlocs_used == patlocs_allocated) patloc = x2nrealloc (patloc, &patlocs_allocated, sizeof *patloc); patloc[patlocs_used++] = (struct patloc) { .lineno = n_patterns, .filename = filename, .fileline = fileline }; } n_patterns++; } prev_inserted = inserted; fileline++; } return dst - keys; } /* Map LINENO, the origin-0 line number of one of the input patterns, to the name of the file from which it came. Return "-" if it was read from stdin, "" if it was specified on the command line. Set *NEW_LINENO to the origin-1 line number of PATTERN in the file, or to an unspecified value if PATTERN came from the command line. */ char const * _GL_ATTRIBUTE_PURE pattern_file_name (size_t lineno, size_t *new_lineno) { ptrdiff_t i; for (i = 1; i < patlocs_used; i++) if (lineno < patloc[i].lineno) break; *new_lineno = lineno - patloc[i - 1].lineno + patloc[i - 1].fileline; return patloc[i - 1].filename; } #if HAVE_ASAN /* Record the starting address and length of the sole poisoned region, so that we can unpoison it later, just before each following read. */ static void const *poison_buf; static size_t poison_len; static void clear_asan_poison (void) { if (poison_buf) __asan_unpoison_memory_region (poison_buf, poison_len); } static void asan_poison (void const *addr, size_t size) { poison_buf = addr; poison_len = size; __asan_poison_memory_region (poison_buf, poison_len); } #else static void clear_asan_poison (void) { } static void asan_poison (void const volatile *addr, size_t size) { } #endif /* The group separator used when context is requested. */ static const char *group_separator = SEP_STR_GROUP; /* The context and logic for choosing default --color screen attributes (foreground and background colors, etc.) are the following. -- There are eight basic colors available, each with its own nominal luminosity to the human eye and foreground/background codes (black [0 %, 30/40], blue [11 %, 34/44], red [30 %, 31/41], magenta [41 %, 35/45], green [59 %, 32/42], cyan [70 %, 36/46], yellow [89 %, 33/43], and white [100 %, 37/47]). -- Sometimes, white as a background is actually implemented using a shade of light gray, so that a foreground white can be visible on top of it (but most often not). -- Sometimes, black as a foreground is actually implemented using a shade of dark gray, so that it can be visible on top of a background black (but most often not). -- Sometimes, more colors are available, as extensions. -- Other attributes can be selected/deselected (bold [1/22], underline [4/24], standout/inverse [7/27], blink [5/25], and invisible/hidden [8/28]). They are sometimes implemented by using colors instead of what their names imply; e.g., bold is often achieved by using brighter colors. In practice, only bold is really available to us, underline sometimes being mapped by the terminal to some strange color choice, and standout best being left for use by downstream programs such as less(1). -- We cannot assume that any of the extensions or special features are available for the purpose of choosing defaults for everyone. -- The most prevalent default terminal backgrounds are pure black and pure white, and are not necessarily the same shades of those as if they were selected explicitly with SGR sequences. Some terminals use dark or light pictures as default background, but those are covered over by an explicit selection of background color with an SGR sequence; their users will appreciate their background pictures not be covered like this, if possible. -- Some uses of colors attributes is to make some output items more understated (e.g., context lines); this cannot be achieved by changing the background color. -- For these reasons, the grep color defaults should strive not to change the background color from its default, unless it's for a short item that should be highlighted, not understated. -- The grep foreground color defaults (without an explicitly set background) should provide enough contrast to be readable on any terminal with either a black (dark) or white (light) background. This only leaves red, magenta, green, and cyan (and their bold counterparts) and possibly bold blue. */ /* The color strings used for matched text. The user can overwrite them using the deprecated environment variable GREP_COLOR or the new GREP_COLORS. */ static const char *selected_match_color = "01;31"; /* bold red */ static const char *context_match_color = "01;31"; /* bold red */ /* Other colors. Defaults look damn good. */ static const char *filename_color = "35"; /* magenta */ static const char *line_num_color = "32"; /* green */ static const char *byte_num_color = "32"; /* green */ static const char *sep_color = "36"; /* cyan */ static const char *selected_line_color = ""; /* default color pair */ static const char *context_line_color = ""; /* default color pair */ /* Select Graphic Rendition (SGR, "\33[...m") strings. */ /* Also Erase in Line (EL) to Right ("\33[K") by default. */ /* Why have EL to Right after SGR? -- The behavior of line-wrapping when at the bottom of the terminal screen and at the end of the current line is often such that a new line is introduced, entirely cleared with the current background color which may be different from the default one (see the boolean back_color_erase terminfo(5) capability), thus scrolling the display by one line. The end of this new line will stay in this background color even after reverting to the default background color with "\33[m', unless it is explicitly cleared again with "\33[K" (which is the behavior the user would instinctively expect from the whole thing). There may be some unavoidable background-color flicker at the end of this new line because of this (when timing with the monitor's redraw is just right). -- The behavior of HT (tab, "\t") is usually the same as that of Cursor Forward Tabulation (CHT) with a default parameter of 1 ("\33[I"), i.e., it performs pure movement to the next tab stop, without any clearing of either content or screen attributes (including background color); try printf 'asdfqwerzxcv\rASDF\tZXCV\n' in a bash(1) shell to demonstrate this. This is not what the user would instinctively expect of HT (but is ok for CHT). The instinctive behavior would include clearing the terminal cells that are skipped over by HT with blank cells in the current screen attributes, including background color; the boolean dest_tabs_magic_smso terminfo(5) capability indicates this saner behavior for HT, but only some rare terminals have it (although it also indicates a special glitch with standout mode in the Teleray terminal for which it was initially introduced). The remedy is to add "\33K" after each SGR sequence, be it START (to fix the behavior of any HT after that before another SGR) or END (to fix the behavior of an HT in default background color that would follow a line-wrapping at the bottom of the screen in another background color, and to complement doing it after START). Piping grep's output through a pager such as less(1) avoids any HT problems since the pager performs tab expansion. Generic disadvantages of this remedy are: -- Some very rare terminals might support SGR but not EL (nobody will use "grep --color" on a terminal that does not support SGR in the first place). -- Having these extra control sequences might somewhat complicate the task of any program trying to parse "grep --color" output in order to extract structuring information from it. A specific disadvantage to doing it after SGR START is: -- Even more possible background color flicker (when timing with the monitor's redraw is just right), even when not at the bottom of the screen. There are no additional disadvantages specific to doing it after SGR END. It would be impractical for GNU grep to become a full-fledged terminal program linked against ncurses or the like, so it will not detect terminfo(5) capabilities. */ static const char *sgr_start = "\33[%sm\33[K"; static const char *sgr_end = "\33[m\33[K"; /* SGR utility functions. */ static void pr_sgr_start (char const *s) { if (*s) print_start_colorize (sgr_start, s); } static void pr_sgr_end (char const *s) { if (*s) print_end_colorize (sgr_end); } static void pr_sgr_start_if (char const *s) { if (color_option) pr_sgr_start (s); } static void pr_sgr_end_if (char const *s) { if (color_option) pr_sgr_end (s); } struct color_cap { const char *name; const char **var; void (*fct) (void); }; static void color_cap_mt_fct (void) { /* Our caller just set selected_match_color. */ context_match_color = selected_match_color; } static void color_cap_rv_fct (void) { /* By this point, it was 1 (or already -1). */ color_option = -1; /* That's still != 0. */ } static void color_cap_ne_fct (void) { sgr_start = "\33[%sm"; sgr_end = "\33[m"; } /* For GREP_COLORS. */ static const struct color_cap color_dict[] = { { "mt", &selected_match_color, color_cap_mt_fct }, /* both ms/mc */ { "ms", &selected_match_color, NULL }, /* selected matched text */ { "mc", &context_match_color, NULL }, /* context matched text */ { "fn", &filename_color, NULL }, /* filename */ { "ln", &line_num_color, NULL }, /* line number */ { "bn", &byte_num_color, NULL }, /* byte (sic) offset */ { "se", &sep_color, NULL }, /* separator */ { "sl", &selected_line_color, NULL }, /* selected lines */ { "cx", &context_line_color, NULL }, /* context lines */ { "rv", NULL, color_cap_rv_fct }, /* -v reverses sl/cx */ { "ne", NULL, color_cap_ne_fct }, /* no EL on SGR_* */ { NULL, NULL, NULL } }; /* Saved errno value from failed output functions on stdout. */ static int stdout_errno; #ifdef KMK_GREP # ifdef KBUILD_OS_WINDOWS # include static void fwrite_errno (void const *, size_t, size_t); static int g_fStdOutIsConsole = -1; /* TRUE or FALSE; -1 if not initialize. */ #endif /* Attempts to set the code page, leave the rest of the locale as default. */ static void kmk_grep_set_codepage (const char *pszCodepage) { # ifdef KBUILD_OS_WINDOWS /* Make sure it starts with a dot: */ char szDot[256]; if (pszCodepage[0] != '.') { snprintf (szDot, sizeof(szDot), ".%s", pszCodepage); pszCodepage = szDot; } if (setlocale (LC_ALL, pszCodepage) == NULL) error (0, errno, _("warning: setlocale (LC_ALL, \"%s\") failed"), pszCodepage); g_fStdOutIsConsole = -1; /* ensure this is reinitialized. */ # endif } #endif /* KMK_GREP */ static void putchar_errno (int c) { #if defined(KMK_GREP) && defined(KBUILD_OS_WINDOWS) char ch = (char)c; fwrite_errno (&ch, 1, 1); #else if (putchar (c) < 0) stdout_errno = errno; #endif } static void fputs_errno (char const *s) { #if defined(KMK_GREP) && defined(KBUILD_OS_WINDOWS) fwrite_errno (s, 1, strlen (s)); #else if (fputs (s, stdout) < 0) stdout_errno = errno; #endif } static void _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) printf_errno (char const *format, ...) { va_list ap; va_start (ap, format); #if defined(KMK_GREP) && defined(KBUILD_OS_WINDOWS) char szBuf[1024]; /* Only really used for a PRIuMAX number and maybe a newline. */ int cch = vsnprintf (szBuf, sizeof (szBuf), format, ap); assert (cch < sizeof(szBuf)); fwrite_errno (szBuf, 1, cch); #else if (vfprintf (stdout, format, ap) < 0) stdout_errno = errno; #endif va_end (ap); } static void fwrite_errno (void const *ptr, size_t size, size_t nmemb) { #if defined(KMK_GREP) && defined(KBUILD_OS_WINDOWS) /* * This trick reduces the runtime of 'grep -r GNU .' in the grep source dir * from just above 11 seconds to around 0.8 seconds. * * The trouble with the microsoft CRTs (both the old and the new UCRT), is * that we end up writing one char at the time when writing to the console, * which is a total performance killer. write_double_translated_ansi_nolock() * and write_requires_double_translation_nolock() in lowio/write.cpp in the * UCRT sources have further details. */ static HANDLE s_hStdOut = INVALID_HANDLE_VALUE; if (g_fStdOutIsConsole != -1) { /* likely*/ } else { DWORD fModeIgnored; s_hStdOut = (HANDLE)_get_osfhandle (fileno (stdout)); g_fStdOutIsConsole = GetConsoleMode (s_hStdOut, &fModeIgnored) ? TRUE : FALSE; if (getenv ("KMK_GREP_CONSOLE_DEBUG")) fprintf (stderr, "kmk_grep: hStdOut=%p %sconsole codepage=%u ansi=%u\n", s_hStdOut, g_fStdOutIsConsole ? "" : "!", get_crt_codepage (), get_ansi_codepage ()); } if (g_fStdOutIsConsole == TRUE && size && nmemb) { size_t const cbToWrite = size * nmemb; if ( cbToWrite < (size_t)INT_MAX / 4 && cbToWrite >= size && cbToWrite >= nmemb) { /* ASSUME that one input byte won't be translated to more than one surrogate pair, or two compound UTF-16 codepoints. */ wchar_t awcBuf[1024]; wchar_t *pawcFree = NULL; wchar_t *pawcBuf; size_t cwcBuf = cbToWrite * 2 + 16; if (cwcBuf < sizeof(awcBuf) / sizeof(wchar_t)) { cwcBuf = sizeof(awcBuf) / sizeof(wchar_t); pawcBuf = awcBuf; } else pawcFree = pawcBuf = (wchar_t *)malloc(cwcBuf * sizeof(wchar_t)); if (pawcBuf) { int cwcToWrite = MultiByteToWideChar(get_crt_codepage(), 0 /*dwFlags*/, ptr, (int)cbToWrite, pawcBuf, (int)(cwcBuf - 1)); if (cwcToWrite > 0) { pawcBuf[cwcToWrite] = '\0'; /* Let the CRT do the rest. At least the Visual C++ 2010 CRT sources indicates _cputws will do the right thing. */ fflush(stdout); int rc = _cputws(pawcBuf); if (pawcFree) free(pawcFree); if (rc != 0) stdout_errno = errno; return; } free(pawcFree); } } } #endif if (fwrite (ptr, size, nmemb, stdout) != nmemb) stdout_errno = errno; } static void fflush_errno (void) { if (fflush (stdout) != 0) stdout_errno = errno; } static struct exclude *excluded_patterns[2]; static struct exclude *excluded_directory_patterns[2]; /* Short options. */ static char const short_options[] = "0123456789A:B:C:D:EFGHIPTUVX:abcd:e:f:hiLlm:noqRrsuvwxyZz"; /* Non-boolean long options that have no corresponding short equivalents. */ enum { BINARY_FILES_OPTION = CHAR_MAX + 1, COLOR_OPTION, EXCLUDE_DIRECTORY_OPTION, EXCLUDE_OPTION, EXCLUDE_FROM_OPTION, GROUP_SEPARATOR_OPTION, INCLUDE_OPTION, LINE_BUFFERED_OPTION, LABEL_OPTION, #ifdef KMK_GREP UTF8_OPTION, CODEPAGE_OPTION, #endif NO_IGNORE_CASE_OPTION }; /* Long options equivalences. */ static struct option const long_options[] = { {"basic-regexp", no_argument, NULL, 'G'}, {"extended-regexp", no_argument, NULL, 'E'}, {"fixed-regexp", no_argument, NULL, 'F'}, {"fixed-strings", no_argument, NULL, 'F'}, {"perl-regexp", no_argument, NULL, 'P'}, {"after-context", required_argument, NULL, 'A'}, {"before-context", required_argument, NULL, 'B'}, {"binary-files", required_argument, NULL, BINARY_FILES_OPTION}, {"byte-offset", no_argument, NULL, 'b'}, {"context", required_argument, NULL, 'C'}, {"color", optional_argument, NULL, COLOR_OPTION}, {"colour", optional_argument, NULL, COLOR_OPTION}, {"count", no_argument, NULL, 'c'}, {"devices", required_argument, NULL, 'D'}, {"directories", required_argument, NULL, 'd'}, {"exclude", required_argument, NULL, EXCLUDE_OPTION}, {"exclude-from", required_argument, NULL, EXCLUDE_FROM_OPTION}, {"exclude-dir", required_argument, NULL, EXCLUDE_DIRECTORY_OPTION}, {"file", required_argument, NULL, 'f'}, {"files-with-matches", no_argument, NULL, 'l'}, {"files-without-match", no_argument, NULL, 'L'}, {"group-separator", required_argument, NULL, GROUP_SEPARATOR_OPTION}, {"help", no_argument, &show_help, 1}, {"include", required_argument, NULL, INCLUDE_OPTION}, {"ignore-case", no_argument, NULL, 'i'}, {"no-ignore-case", no_argument, NULL, NO_IGNORE_CASE_OPTION}, {"initial-tab", no_argument, NULL, 'T'}, {"label", required_argument, NULL, LABEL_OPTION}, {"line-buffered", no_argument, NULL, LINE_BUFFERED_OPTION}, {"line-number", no_argument, NULL, 'n'}, {"line-regexp", no_argument, NULL, 'x'}, {"max-count", required_argument, NULL, 'm'}, {"no-filename", no_argument, NULL, 'h'}, {"no-group-separator", no_argument, NULL, GROUP_SEPARATOR_OPTION}, {"no-messages", no_argument, NULL, 's'}, {"null", no_argument, NULL, 'Z'}, {"null-data", no_argument, NULL, 'z'}, {"only-matching", no_argument, NULL, 'o'}, {"quiet", no_argument, NULL, 'q'}, {"recursive", no_argument, NULL, 'r'}, {"dereference-recursive", no_argument, NULL, 'R'}, {"regexp", required_argument, NULL, 'e'}, {"invert-match", no_argument, NULL, 'v'}, {"silent", no_argument, NULL, 'q'}, {"text", no_argument, NULL, 'a'}, {"binary", no_argument, NULL, 'U'}, {"unix-byte-offsets", no_argument, NULL, 'u'}, {"version", no_argument, NULL, 'V'}, {"with-filename", no_argument, NULL, 'H'}, {"word-regexp", no_argument, NULL, 'w'}, #ifdef KMK_GREP {"utf8", no_argument, NULL, UTF8_OPTION}, {"cp", required_argument, NULL, CODEPAGE_OPTION}, {"codepage", required_argument, NULL, CODEPAGE_OPTION}, #endif {0, 0, 0, 0} }; /* Define flags declared in grep.h. */ bool match_icase; bool match_words; bool match_lines; char eolbyte; /* For error messages. */ /* The input file name, or (if standard input) null or a --label argument. */ static char const *filename; /* Omit leading "./" from file names in diagnostics. */ static bool omit_dot_slash; static bool errseen; /* True if output from the current input file has been suppressed because an output line had an encoding error. */ static bool encoding_error_output; enum directories_type { READ_DIRECTORIES = 2, RECURSE_DIRECTORIES, SKIP_DIRECTORIES }; /* How to handle directories. */ static char const *const directories_args[] = { "read", "recurse", "skip", NULL }; static enum directories_type const directories_types[] = { READ_DIRECTORIES, RECURSE_DIRECTORIES, SKIP_DIRECTORIES }; ARGMATCH_VERIFY (directories_args, directories_types); static enum directories_type directories = READ_DIRECTORIES; enum { basic_fts_options = FTS_CWDFD | FTS_NOSTAT | FTS_TIGHT_CYCLE_CHECK }; static int fts_options = basic_fts_options | FTS_COMFOLLOW | FTS_PHYSICAL; /* How to handle devices. */ static enum { READ_COMMAND_LINE_DEVICES, READ_DEVICES, SKIP_DEVICES } devices = READ_COMMAND_LINE_DEVICES; static bool grepfile (int, char const *, bool, bool); static bool grepdesc (int, bool); static bool is_device_mode (mode_t m) { return S_ISCHR (m) || S_ISBLK (m) || S_ISSOCK (m) || S_ISFIFO (m); } static bool skip_devices (bool command_line) { return (devices == SKIP_DEVICES || ((devices == READ_COMMAND_LINE_DEVICES) & !command_line)); } /* Return if ST->st_size is defined. Assume the file is not a symbolic link. */ static bool usable_st_size (struct stat const *st) { return S_ISREG (st->st_mode) || S_TYPEISSHM (st) || S_TYPEISTMO (st); } /* Lame substitutes for SEEK_DATA and SEEK_HOLE on platforms lacking them. Do not rely on these finding data or holes if they equal SEEK_SET. */ #ifndef SEEK_DATA enum { SEEK_DATA = SEEK_SET }; #endif #ifndef SEEK_HOLE enum { SEEK_HOLE = SEEK_SET }; #endif /* True if lseek with SEEK_CUR or SEEK_DATA failed on the current input. */ static bool seek_failed; static bool seek_data_failed; /* Functions we'll use to search. */ typedef void *(*compile_fp_t) (char *, size_t, reg_syntax_t, bool); typedef size_t (*execute_fp_t) (void *, char const *, size_t, size_t *, char const *); static execute_fp_t execute; static void *compiled_pattern; char const * input_filename (void) { if (!filename) filename = _("(standard input)"); return filename; } /* Unless requested, diagnose an error about the input file. */ static void suppressible_error (int errnum) { if (! suppress_errors) error (0, errnum, "%s", input_filename ()); errseen = true; } /* If there has already been a write error, don't bother closing standard output, as that might elicit a duplicate diagnostic. */ static void clean_up_stdout (void) { if (! stdout_errno) close_stdout (); } /* A cast to TYPE of VAL. Use this when TYPE is a pointer type, VAL is properly aligned for TYPE, and 'gcc -Wcast-align' cannot infer the alignment and would otherwise complain about the cast. */ #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) # define CAST_ALIGNED(type, val) \ ({ __typeof__ (val) val_ = val; \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wcast-align\"") \ (type) val_; \ _Pragma ("GCC diagnostic pop") \ }) #else # define CAST_ALIGNED(type, val) ((type) (val)) #endif /* An unsigned type suitable for fast matching. */ typedef uintmax_t uword; static uword const uword_max = UINTMAX_MAX; struct localeinfo localeinfo; /* A mask to test for unibyte characters, with the pattern repeated to fill a uword. For a multibyte character encoding where all bytes are unibyte characters, this is 0. For UTF-8, this is 0x808080.... For encodings where unibyte characters have no discerned pattern, this is all 1s. The unsigned char C is a unibyte character if C & UNIBYTE_MASK is zero. If the uword W is the concatenation of bytes, the bytes are all unibyte characters if W & UNIBYTE_MASK is zero. */ static uword unibyte_mask; static void initialize_unibyte_mask (void) { /* For each encoding error I that MASK does not already match, accumulate I's most significant 1 bit by ORing it into MASK. Although any 1 bit of I could be used, in practice high-order bits work better. */ unsigned char mask = 0; int ms1b = 1; for (int i = 1; i <= UCHAR_MAX; i++) if ((localeinfo.sbclen[i] != 1) & ! (mask & i)) { while (ms1b * 2 <= i) ms1b *= 2; mask |= ms1b; } /* Now MASK will detect any encoding-error byte, although it may cry wolf and it may not be optimal. Build a uword-length mask by repeating MASK. */ unibyte_mask = uword_max / UCHAR_MAX * mask; } /* Skip the easy bytes in a buffer that is guaranteed to have a sentinel that is not easy, and return a pointer to the first non-easy byte. The easy bytes all have UNIBYTE_MASK off. */ static char const * _GL_ATTRIBUTE_PURE skip_easy_bytes (char const *buf) { /* Search a byte at a time until the pointer is aligned, then a uword at a time until a match is found, then a byte at a time to identify the exact byte. The uword search may go slightly past the buffer end, but that's benign. */ char const *p; uword const *s; for (p = buf; (uintptr_t) p % sizeof (uword) != 0; p++) if (to_uchar (*p) & unibyte_mask) return p; for (s = CAST_ALIGNED (uword const *, p); ! (*s & unibyte_mask); s++) continue; for (p = (char const *) s; ! (to_uchar (*p) & unibyte_mask); p++) continue; return p; } /* Return true if BUF, of size SIZE, has an encoding error. BUF must be followed by at least sizeof (uword) bytes, the first of which may be modified. */ static bool buf_has_encoding_errors (char *buf, size_t size) { if (! unibyte_mask) return false; mbstate_t mbs = { 0 }; size_t clen; buf[size] = -1; for (char const *p = buf; (p = skip_easy_bytes (p)) < buf + size; p += clen) { clen = mbrlen (p, buf + size - p, &mbs); if ((size_t) -2 <= clen) return true; } return false; } /* Return true if BUF, of size SIZE, has a null byte. BUF must be followed by at least one byte, which may be arbitrarily written to or read from. */ static bool buf_has_nulls (char *buf, size_t size) { buf[size] = 0; return strlen (buf) != size; } /* Return true if a file is known to contain null bytes. SIZE bytes have already been read from the file with descriptor FD and status ST. */ static bool file_must_have_nulls (size_t size, int fd, struct stat const *st) { /* If the file has holes, it must contain a null byte somewhere. */ if (SEEK_HOLE != SEEK_SET && !seek_failed && usable_st_size (st) && size < st->st_size) { off_t cur = size; if (O_BINARY || fd == STDIN_FILENO) { cur = lseek (fd, 0, SEEK_CUR); if (cur < 0) return false; } /* Look for a hole after the current location. */ off_t hole_start = lseek (fd, cur, SEEK_HOLE); if (0 <= hole_start) { if (lseek (fd, cur, SEEK_SET) < 0) suppressible_error (errno); if (hole_start < st->st_size) return true; } } return false; } /* Convert STR to a nonnegative integer, storing the result in *OUT. STR must be a valid context length argument; report an error if it isn't. Silently ceiling *OUT at the maximum value, as that is practically equivalent to infinity for grep's purposes. */ static void context_length_arg (char const *str, intmax_t *out) { switch (xstrtoimax (str, 0, 10, out, "")) { case LONGINT_OK: case LONGINT_OVERFLOW: if (0 <= *out) break; FALLTHROUGH; default: die (EXIT_TROUBLE, 0, "%s: %s", str, _("invalid context length argument")); } } /* Return the add_exclude options suitable for excluding a file name. If COMMAND_LINE, it is a command-line file name. */ static int exclude_options (bool command_line) { return EXCLUDE_WILDCARDS | (command_line ? 0 : EXCLUDE_ANCHORED); } /* Return true if the file with NAME should be skipped. If COMMAND_LINE, it is a command-line argument. If IS_DIR, it is a directory. */ static bool skipped_file (char const *name, bool command_line, bool is_dir) { struct exclude **pats; if (! is_dir) pats = excluded_patterns; else if (directories == SKIP_DIRECTORIES) return true; else if (command_line && omit_dot_slash) return false; else pats = excluded_directory_patterns; return pats[command_line] && excluded_file_name (pats[command_line], name); } /* Hairy buffering mechanism for grep. The intent is to keep all reads aligned on a page boundary and multiples of the page size, unless a read yields a partial page. */ static char *buffer; /* Base of buffer. */ static size_t bufalloc; /* Allocated buffer size, counting slop. */ static int bufdesc; /* File descriptor. */ static char *bufbeg; /* Beginning of user-visible stuff. */ static char *buflim; /* Limit of user-visible stuff. */ static size_t pagesize; /* alignment of memory pages */ static off_t bufoffset; /* Read offset. */ static off_t after_last_match; /* Pointer after last matching line that would have been output if we were outputting characters. */ static bool skip_nuls; /* Skip '\0' in data. */ static bool skip_empty_lines; /* Skip empty lines in data. */ static uintmax_t totalnl; /* Total newline count before lastnl. */ /* Initial buffer size, not counting slop. */ enum { INITIAL_BUFSIZE = 96 * 1024 }; /* Return VAL aligned to the next multiple of ALIGNMENT. VAL can be an integer or a pointer. Both args must be free of side effects. */ #define ALIGN_TO(val, alignment) \ ((uintptr_t) (val) % (alignment) == 0 \ ? (val) \ : (val) + ((alignment) - (uintptr_t) (val) % (alignment))) /* Add two numbers that count input bytes or lines, and report an error if the addition overflows. */ static uintmax_t add_count (uintmax_t a, uintmax_t b) { uintmax_t sum = a + b; if (sum < a) die (EXIT_TROUBLE, 0, _("input is too large to count")); return sum; } /* Return true if BUF (of size SIZE) is all zeros. */ static bool all_zeros (char const *buf, size_t size) { for (char const *p = buf; p < buf + size; p++) if (*p) return false; return true; } /* Reset the buffer for a new file, returning false if we should skip it. Initialize on the first time through. */ static bool reset (int fd, struct stat const *st) { bufbeg = buflim = ALIGN_TO (buffer + 1, pagesize); bufbeg[-1] = eolbyte; bufdesc = fd; bufoffset = fd == STDIN_FILENO ? lseek (fd, 0, SEEK_CUR) : 0; seek_failed = bufoffset < 0; /* Assume SEEK_DATA fails if SEEK_CUR does. */ seek_data_failed = seek_failed; if (seek_failed) { if (errno != ESPIPE) { suppressible_error (errno); return false; } bufoffset = 0; } return true; } /* Read new stuff into the buffer, saving the specified amount of old stuff. When we're done, 'bufbeg' points to the beginning of the buffer contents, and 'buflim' points just after the end. Return false if there's an error. */ static bool fillbuf (size_t save, struct stat const *st) { size_t fillsize; bool cc = true; char *readbuf; size_t readsize; if (pagesize <= buffer + bufalloc - sizeof (uword) - buflim) readbuf = buflim; else { size_t minsize = save + pagesize; size_t newsize; size_t newalloc; char *newbuf; /* Grow newsize until it is at least as great as minsize. */ for (newsize = bufalloc - pagesize - sizeof (uword); newsize < minsize; newsize *= 2) if ((SIZE_MAX - pagesize - sizeof (uword)) / 2 < newsize) xalloc_die (); /* Try not to allocate more memory than the file size indicates, as that might cause unnecessary memory exhaustion if the file is large. However, do not use the original file size as a heuristic if we've already read past the file end, as most likely the file is growing. */ if (usable_st_size (st)) { off_t to_be_read = st->st_size - bufoffset; off_t maxsize_off = save + to_be_read; if (0 <= to_be_read && to_be_read <= maxsize_off && maxsize_off == (size_t) maxsize_off && minsize <= (size_t) maxsize_off && (size_t) maxsize_off < newsize) newsize = maxsize_off; } /* Add enough room so that the buffer is aligned and has room for byte sentinels fore and aft, and so that a uword can be read aft. */ newalloc = newsize + pagesize + sizeof (uword); newbuf = bufalloc < newalloc ? xmalloc (bufalloc = newalloc) : buffer; readbuf = ALIGN_TO (newbuf + 1 + save, pagesize); size_t moved = save + 1; /* Move the preceding byte sentinel too. */ memmove (readbuf - moved, buflim - moved, moved); if (newbuf != buffer) { free (buffer); buffer = newbuf; } } bufbeg = readbuf - save; clear_asan_poison (); readsize = buffer + bufalloc - sizeof (uword) - readbuf; readsize -= readsize % pagesize; while (true) { fillsize = safe_read (bufdesc, readbuf, readsize); if (fillsize == SAFE_READ_ERROR) { fillsize = 0; cc = false; } bufoffset += fillsize; if (((fillsize == 0) | !skip_nuls) || !all_zeros (readbuf, fillsize)) break; totalnl = add_count (totalnl, fillsize); if (SEEK_DATA != SEEK_SET && !seek_data_failed) { /* Solaris SEEK_DATA fails with errno == ENXIO in a hole at EOF. */ off_t data_start = lseek (bufdesc, bufoffset, SEEK_DATA); if (data_start < 0 && errno == ENXIO && usable_st_size (st) && bufoffset < st->st_size) data_start = lseek (bufdesc, 0, SEEK_END); if (data_start < 0) seek_data_failed = true; else { totalnl = add_count (totalnl, data_start - bufoffset); bufoffset = data_start; } } } buflim = readbuf + fillsize; /* Initialize the following word, because skip_easy_bytes and some matchers read (but do not use) those bytes. This avoids false positive reports of these bytes being used uninitialized. */ memset (buflim, 0, sizeof (uword)); /* Mark the part of the buffer not filled by the read or set by the above memset call as ASAN-poisoned. */ asan_poison (buflim + sizeof (uword), bufalloc - (buflim - buffer) - sizeof (uword)); return cc; } /* Flags controlling the style of output. */ static enum { BINARY_BINARY_FILES, TEXT_BINARY_FILES, WITHOUT_MATCH_BINARY_FILES } binary_files; /* How to handle binary files. */ /* Options for output as a list of matching/non-matching files */ static enum { LISTFILES_NONE, LISTFILES_MATCHING, LISTFILES_NONMATCHING, } list_files; /* Whether to output filenames. 1 means yes, 0 means no, and -1 means 'grep -r PATTERN FILE' was used and it is not known yet whether FILE is a directory (which means yes) or not (which means no). */ static int out_file; static int filename_mask; /* If zero, output nulls after filenames. */ static bool out_quiet; /* Suppress all normal output. */ static bool out_invert; /* Print nonmatching stuff. */ static bool out_line; /* Print line numbers. */ static bool out_byte; /* Print byte offsets. */ static intmax_t out_before; /* Lines of leading context. */ static intmax_t out_after; /* Lines of trailing context. */ static bool count_matches; /* Count matching lines. */ static intmax_t max_count; /* Max number of selected lines from an input file. */ static bool line_buffered; /* Use line buffering. */ static char *label = NULL; /* Fake filename for stdin */ /* Internal variables to keep track of byte count, context, etc. */ static uintmax_t totalcc; /* Total character count before bufbeg. */ static char const *lastnl; /* Pointer after last newline counted. */ static char *lastout; /* Pointer after last character output; NULL if no character has been output or if it's conceptually before bufbeg. */ static intmax_t outleft; /* Maximum number of selected lines. */ static intmax_t pending; /* Pending lines of output. Always kept 0 if out_quiet is true. */ static bool done_on_match; /* Stop scanning file on first match. */ static bool exit_on_match; /* Exit on first match. */ static bool dev_null_output; /* Stdout is known to be /dev/null. */ static bool binary; /* Use binary rather than text I/O. */ static void nlscan (char const *lim) { size_t newlines = 0; for (char const *beg = lastnl; beg < lim; beg++) { beg = memchr (beg, eolbyte, lim - beg); if (!beg) break; newlines++; } totalnl = add_count (totalnl, newlines); lastnl = lim; } /* Print the current filename. */ static void print_filename (void) { pr_sgr_start_if (filename_color); fputs_errno (input_filename ()); pr_sgr_end_if (filename_color); } /* Print a character separator. */ static void print_sep (char sep) { pr_sgr_start_if (sep_color); putchar_errno (sep); pr_sgr_end_if (sep_color); } /* Print a line number or a byte offset. */ static void print_offset (uintmax_t pos, const char *color) { pr_sgr_start_if (color); printf_errno ("%*"PRIuMAX, offset_width, pos); pr_sgr_end_if (color); } /* Print a whole line head (filename, line, byte). The output data starts at BEG and contains LEN bytes; it is followed by at least sizeof (uword) bytes, the first of which may be temporarily modified. The output data comes from what is perhaps a larger input line that goes until LIM, where LIM[-1] is an end-of-line byte. Use SEP as the separator on output. Return true unless the line was suppressed due to an encoding error. */ static bool print_line_head (char *beg, size_t len, char const *lim, char sep) { if (binary_files != TEXT_BINARY_FILES) { char ch = beg[len]; bool encoding_errors = buf_has_encoding_errors (beg, len); beg[len] = ch; if (encoding_errors) { encoding_error_output = true; return false; } } if (out_file) { print_filename (); if (filename_mask) print_sep (sep); else putchar_errno (0); } if (out_line) { if (lastnl < lim) { nlscan (beg); totalnl = add_count (totalnl, 1); lastnl = lim; } print_offset (totalnl, line_num_color); print_sep (sep); } if (out_byte) { uintmax_t pos = add_count (totalcc, beg - bufbeg); print_offset (pos, byte_num_color); print_sep (sep); } if (align_tabs && (out_file | out_line | out_byte) && len != 0) putchar_errno ('\t'); return true; } static char * print_line_middle (char *beg, char *lim, const char *line_color, const char *match_color) { size_t match_size; size_t match_offset; char *cur; char *mid = NULL; char *b; for (cur = beg; (cur < lim && ((match_offset = execute (compiled_pattern, beg, lim - beg, &match_size, cur)) != (size_t) -1)); cur = b + match_size) { b = beg + match_offset; /* Avoid matching the empty line at the end of the buffer. */ if (b == lim) break; /* Avoid hanging on grep --color "" foo */ if (match_size == 0) { /* Make minimal progress; there may be further non-empty matches. */ /* XXX - Could really advance by one whole multi-octet character. */ match_size = 1; if (!mid) mid = cur; } else { /* This function is called on a matching line only, but is it selected or rejected/context? */ if (only_matching) { char sep = out_invert ? SEP_CHAR_REJECTED : SEP_CHAR_SELECTED; if (! print_line_head (b, match_size, lim, sep)) return NULL; } else { pr_sgr_start (line_color); if (mid) { cur = mid; mid = NULL; } fwrite_errno (cur, 1, b - cur); } pr_sgr_start_if (match_color); fwrite_errno (b, 1, match_size); pr_sgr_end_if (match_color); if (only_matching) putchar_errno (eolbyte); } } if (only_matching) cur = lim; else if (mid) cur = mid; return cur; } static char * print_line_tail (char *beg, const char *lim, const char *line_color) { size_t eol_size; size_t tail_size; eol_size = (lim > beg && lim[-1] == eolbyte); eol_size += (lim - eol_size > beg && lim[-(1 + eol_size)] == '\r'); tail_size = lim - eol_size - beg; if (tail_size > 0) { pr_sgr_start (line_color); fwrite_errno (beg, 1, tail_size); beg += tail_size; pr_sgr_end (line_color); } return beg; } static void prline (char *beg, char *lim, char sep) { bool matching; const char *line_color; const char *match_color; if (!only_matching) if (! print_line_head (beg, lim - beg - 1, lim, sep)) return; matching = (sep == SEP_CHAR_SELECTED) ^ out_invert; if (color_option) { line_color = (((sep == SEP_CHAR_SELECTED) ^ (out_invert && (color_option < 0))) ? selected_line_color : context_line_color); match_color = (sep == SEP_CHAR_SELECTED ? selected_match_color : context_match_color); } else line_color = match_color = NULL; /* Shouldn't be used. */ if ((only_matching && matching) || (color_option && (*line_color || *match_color))) { /* We already know that non-matching lines have no match (to colorize). */ if (matching && (only_matching || *match_color)) { beg = print_line_middle (beg, lim, line_color, match_color); if (! beg) return; } if (!only_matching && *line_color) { /* This code is exercised at least when grep is invoked like this: echo k| GREP_COLORS='sl=01;32' src/grep k --color=always */ beg = print_line_tail (beg, lim, line_color); } } if (!only_matching && lim > beg) fwrite_errno (beg, 1, lim - beg); if (line_buffered) fflush_errno (); if (stdout_errno) die (EXIT_TROUBLE, stdout_errno, _("write error")); lastout = lim; } /* Print pending lines of trailing context prior to LIM. */ static void prpending (char const *lim) { if (!lastout) lastout = bufbeg; for (; 0 < pending && lastout < lim; pending--) { char *nl = rawmemchr (lastout, eolbyte); prline (lastout, nl + 1, SEP_CHAR_REJECTED); } } /* Output the lines between BEG and LIM. Deal with context. */ static void prtext (char *beg, char *lim) { static bool used; /* Avoid printing SEP_STR_GROUP before any output. */ char eol = eolbyte; if (!out_quiet && pending > 0) prpending (beg); char *p = beg; if (!out_quiet) { /* Deal with leading context. */ char const *bp = lastout ? lastout : bufbeg; intmax_t i; for (i = 0; i < out_before; ++i) if (p > bp) do --p; while (p[-1] != eol); /* Print the group separator unless the output is adjacent to the previous output in the file. */ if ((0 <= out_before || 0 <= out_after) && used && p != lastout && group_separator) { pr_sgr_start_if (sep_color); fputs_errno (group_separator); pr_sgr_end_if (sep_color); putchar_errno ('\n'); } while (p < beg) { char *nl = rawmemchr (p, eol); nl++; prline (p, nl, SEP_CHAR_REJECTED); p = nl; } } intmax_t n; if (out_invert) { /* One or more lines are output. */ for (n = 0; p < lim && n < outleft; n++) { char *nl = rawmemchr (p, eol); nl++; if (!out_quiet) prline (p, nl, SEP_CHAR_SELECTED); p = nl; } } else { /* Just one line is output. */ if (!out_quiet) prline (beg, lim, SEP_CHAR_SELECTED); n = 1; p = lim; } after_last_match = bufoffset - (buflim - p); pending = out_quiet ? 0 : MAX (0, out_after); used = true; outleft -= n; } /* Replace all NUL bytes in buffer P (which ends at LIM) with EOL. This avoids running out of memory when binary input contains a long sequence of zeros, which would otherwise be considered to be part of a long line. P[LIM] should be EOL. */ static void zap_nuls (char *p, char *lim, char eol) { if (eol) while (true) { *lim = '\0'; p += strlen (p); *lim = eol; if (p == lim) break; do *p++ = eol; while (!*p); } } /* Scan the specified portion of the buffer, matching lines (or between matching lines if OUT_INVERT is true). Return a count of lines printed. Replace all NUL bytes with NUL_ZAPPER as we go. */ static intmax_t grepbuf (char *beg, char const *lim) { intmax_t outleft0 = outleft; char *endp; for (char *p = beg; p < lim; p = endp) { size_t match_size; size_t match_offset = execute (compiled_pattern, p, lim - p, &match_size, NULL); if (match_offset == (size_t) -1) { if (!out_invert) break; match_offset = lim - p; match_size = 0; } char *b = p + match_offset; endp = b + match_size; /* Avoid matching the empty line at the end of the buffer. */ if (!out_invert && b == lim) break; if (!out_invert || p < b) { char *prbeg = out_invert ? p : b; char *prend = out_invert ? b : endp; prtext (prbeg, prend); if (!outleft || done_on_match) { if (exit_on_match) exit (errseen ? exit_failure : EXIT_SUCCESS); break; } } } return outleft0 - outleft; } /* Search a given (non-directory) file. Return a count of lines printed. Set *INEOF to true if end-of-file reached. */ static intmax_t grep (int fd, struct stat const *st, bool *ineof) { intmax_t nlines, i; size_t residue, save; char oldc; char *beg; char *lim; char eol = eolbyte; char nul_zapper = '\0'; bool done_on_match_0 = done_on_match; bool out_quiet_0 = out_quiet; /* The value of NLINES when nulls were first deduced in the input; this is not necessarily the same as the number of matching lines before the first null. -1 if no input nulls have been deduced. */ intmax_t nlines_first_null = -1; if (! reset (fd, st)) return 0; totalcc = 0; lastout = 0; totalnl = 0; outleft = max_count; after_last_match = 0; pending = 0; skip_nuls = skip_empty_lines && !eol; encoding_error_output = false; nlines = 0; residue = 0; save = 0; if (! fillbuf (save, st)) { suppressible_error (errno); return 0; } offset_width = 0; if (align_tabs) { /* Width is log of maximum number. Line numbers are origin-1. */ uintmax_t num = usable_st_size (st) ? st->st_size : UINTMAX_MAX; num += out_line && num < UINTMAX_MAX; do offset_width++; while ((num /= 10) != 0); } for (bool firsttime = true; ; firsttime = false) { if (nlines_first_null < 0 && eol && binary_files != TEXT_BINARY_FILES && (buf_has_nulls (bufbeg, buflim - bufbeg) || (firsttime && file_must_have_nulls (buflim - bufbeg, fd, st)))) { if (binary_files == WITHOUT_MATCH_BINARY_FILES) return 0; if (!count_matches) done_on_match = out_quiet = true; nlines_first_null = nlines; nul_zapper = eol; skip_nuls = skip_empty_lines; } lastnl = bufbeg; if (lastout) lastout = bufbeg; beg = bufbeg + save; /* no more data to scan (eof) except for maybe a residue -> break */ if (beg == buflim) { *ineof = true; break; } zap_nuls (beg, buflim, nul_zapper); /* Determine new residue (the length of an incomplete line at the end of the buffer, 0 means there is no incomplete last line). */ oldc = beg[-1]; beg[-1] = eol; /* FIXME: use rawmemrchr if/when it exists, since we have ensured that this use of memrchr is guaranteed never to return NULL. */ lim = memrchr (beg - 1, eol, buflim - beg + 1); ++lim; beg[-1] = oldc; if (lim == beg) lim = beg - residue; beg -= residue; residue = buflim - lim; if (beg < lim) { if (outleft) nlines += grepbuf (beg, lim); if (pending) prpending (lim); if ((!outleft && !pending) || (done_on_match && MAX (0, nlines_first_null) < nlines)) goto finish_grep; } /* The last OUT_BEFORE lines at the end of the buffer will be needed as leading context if there is a matching line at the begin of the next data. Make beg point to their begin. */ i = 0; beg = lim; while (i < out_before && beg > bufbeg && beg != lastout) { ++i; do --beg; while (beg[-1] != eol); } /* Detect whether leading context is adjacent to previous output. */ if (beg != lastout) lastout = 0; /* Handle some details and read more data to scan. */ save = residue + lim - beg; if (out_byte) totalcc = add_count (totalcc, buflim - bufbeg - save); if (out_line) nlscan (beg); if (! fillbuf (save, st)) { suppressible_error (errno); goto finish_grep; } } if (residue) { *buflim++ = eol; if (outleft) nlines += grepbuf (bufbeg + save - residue, buflim); if (pending) prpending (buflim); } finish_grep: done_on_match = done_on_match_0; out_quiet = out_quiet_0; if (binary_files == BINARY_BINARY_FILES && ! (out_quiet | suppress_errors) && (encoding_error_output || (0 <= nlines_first_null && nlines_first_null < nlines))) error (0, 0, _("%s: binary file matches"), input_filename ()); return nlines; } static bool grepdirent (FTS *fts, FTSENT *ent, bool command_line) { bool follow; command_line &= ent->fts_level == FTS_ROOTLEVEL; if (ent->fts_info == FTS_DP) return true; if (!command_line && skipped_file (ent->fts_name, false, (ent->fts_info == FTS_D || ent->fts_info == FTS_DC || ent->fts_info == FTS_DNR))) { fts_set (fts, ent, FTS_SKIP); return true; } filename = ent->fts_path; if (omit_dot_slash && filename[1]) filename += 2; follow = (fts->fts_options & FTS_LOGICAL || (fts->fts_options & FTS_COMFOLLOW && command_line)); switch (ent->fts_info) { case FTS_D: if (directories == RECURSE_DIRECTORIES) return true; fts_set (fts, ent, FTS_SKIP); break; case FTS_DC: if (!suppress_errors) error (0, 0, _("%s: warning: recursive directory loop"), filename); return true; case FTS_DNR: case FTS_ERR: case FTS_NS: suppressible_error (ent->fts_errno); return true; case FTS_DEFAULT: case FTS_NSOK: if (skip_devices (command_line)) { struct stat *st = ent->fts_statp; #if !defined(KMK_GREP) || !defined(_MSC_VER) /** @todo revisit this */ struct stat st1; if (! st->st_mode) { /* The file type is not already known. Get the file status before opening, since opening might have side effects on a device. */ int flag = follow ? 0 : AT_SYMLINK_NOFOLLOW; if (fstatat (fts->fts_cwd_fd, ent->fts_accpath, &st1, flag) != 0) { suppressible_error (errno); return true; } st = &st1; } #endif if (is_device_mode (st->st_mode)) return true; } break; case FTS_F: case FTS_SLNONE: break; case FTS_SL: case FTS_W: return true; default: abort (); } return grepfile (fts->fts_cwd_fd, ent->fts_accpath, follow, command_line); } /* True if errno is ERR after 'open ("symlink", ... O_NOFOLLOW ...)'. POSIX specifies ELOOP, but it's EMLINK on FreeBSD and EFTYPE on NetBSD. */ static bool open_symlink_nofollow_error (int err) { if (err == ELOOP || err == EMLINK) return true; #ifdef EFTYPE if (err == EFTYPE) return true; #endif return false; } static bool grepfile (int dirdesc, char const *name, bool follow, bool command_line) { int oflag = (O_RDONLY | O_NOCTTY | (IGNORE_DUPLICATE_BRANCH_WARNING (binary ? O_BINARY : 0)) | (follow ? 0 : O_NOFOLLOW) | (skip_devices (command_line) ? O_NONBLOCK : 0)); int desc = openat_safer (dirdesc, name, oflag); if (desc < 0) { if (follow || ! open_symlink_nofollow_error (errno)) suppressible_error (errno); return true; } return grepdesc (desc, command_line); } /* Read all data from FD, with status ST. Return true if successful, false (setting errno) otherwise. */ static bool drain_input (int fd, struct stat const *st) { ssize_t nbytes; if (S_ISFIFO (st->st_mode) && dev_null_output) { #ifdef SPLICE_F_MOVE /* Should be faster, since it need not copy data to user space. */ nbytes = splice (fd, NULL, STDOUT_FILENO, NULL, INITIAL_BUFSIZE, SPLICE_F_MOVE); if (0 <= nbytes || errno != EINVAL) { while (0 < nbytes) nbytes = splice (fd, NULL, STDOUT_FILENO, NULL, INITIAL_BUFSIZE, SPLICE_F_MOVE); return nbytes == 0; } #endif } while ((nbytes = safe_read (fd, buffer, bufalloc))) if (nbytes == SAFE_READ_ERROR) return false; return true; } /* Finish reading from FD, with status ST and where end-of-file has been seen if INEOF. Typically this is a no-op, but when reading from standard input this may adjust the file offset or drain a pipe. */ static void finalize_input (int fd, struct stat const *st, bool ineof) { if (fd == STDIN_FILENO && (outleft ? (!ineof && (seek_failed || (lseek (fd, 0, SEEK_END) < 0 /* Linux proc file system has EINVAL (Bug#25180). */ && errno != EINVAL)) && ! drain_input (fd, st)) : (bufoffset != after_last_match && !seek_failed && lseek (fd, after_last_match, SEEK_SET) < 0))) suppressible_error (errno); } static bool grepdesc (int desc, bool command_line) { intmax_t count; bool status = true; bool ineof = false; struct stat st; /* Get the file status, possibly for the second time. This catches a race condition if the directory entry changes after the directory entry is read and before the file is opened. For example, normally DESC is a directory only at the top level, but there is an exception if some other process substitutes a directory for a non-directory while 'grep' is running. */ if (fstat (desc, &st) != 0) { suppressible_error (errno); goto closeout; } if (desc != STDIN_FILENO && skip_devices (command_line) && is_device_mode (st.st_mode)) goto closeout; if (desc != STDIN_FILENO && command_line && skipped_file (filename, true, S_ISDIR (st.st_mode) != 0)) goto closeout; /* Don't output file names if invoked as 'grep -r PATTERN NONDIRECTORY'. */ if (out_file < 0) out_file = !!S_ISDIR (st.st_mode); if (desc != STDIN_FILENO && directories == RECURSE_DIRECTORIES && S_ISDIR (st.st_mode)) { /* Traverse the directory starting with its full name, because unfortunately fts provides no way to traverse the directory starting from its file descriptor. */ FTS *fts; FTSENT *ent; int opts = fts_options & ~(command_line ? 0 : FTS_COMFOLLOW); char *fts_arg[2]; /* Close DESC now, to conserve file descriptors if the race condition occurs many times in a deep recursion. */ if (close (desc) != 0) suppressible_error (errno); fts_arg[0] = (char *) filename; fts_arg[1] = NULL; fts = fts_open (fts_arg, opts, NULL); if (!fts) xalloc_die (); while ((ent = fts_read (fts))) status &= grepdirent (fts, ent, command_line); if (errno) suppressible_error (errno); if (fts_close (fts) != 0) suppressible_error (errno); return status; } if (desc != STDIN_FILENO && ((directories == SKIP_DIRECTORIES && S_ISDIR (st.st_mode)) || ((devices == SKIP_DEVICES || (devices == READ_COMMAND_LINE_DEVICES && !command_line)) && is_device_mode (st.st_mode)))) goto closeout; /* If there is a regular file on stdout and the current file refers to the same i-node, we have to report the problem and skip it. Otherwise when matching lines from some other input reach the disk before we open this file, we can end up reading and matching those lines and appending them to the file from which we're reading. Then we'd have what appears to be an infinite loop that'd terminate only upon filling the output file system or reaching a quota. However, there is no risk of an infinite loop if grep is generating no output, i.e., with --silent, --quiet, -q. Similarly, with any of these: --max-count=N (-m) (for N >= 2) --files-with-matches (-l) --files-without-match (-L) there is no risk of trouble. For --max-count=1, grep stops after printing the first match, so there is no risk of malfunction. But even --max-count=2, with input==output, while there is no risk of infloop, there is a race condition that could result in "alternate" output. */ if (!out_quiet && list_files == LISTFILES_NONE && 1 < max_count && S_ISREG (st.st_mode) && SAME_INODE (st, out_stat)) { if (! suppress_errors) error (0, 0, _("%s: input file is also the output"), input_filename ()); errseen = true; goto closeout; } count = grep (desc, &st, &ineof); if (count_matches) { if (out_file) { print_filename (); if (filename_mask) print_sep (SEP_CHAR_SELECTED); else putchar_errno (0); } printf_errno ("%" PRIdMAX "\n", count); if (line_buffered) fflush_errno (); } status = !count; if (list_files == LISTFILES_NONE) finalize_input (desc, &st, ineof); else if (list_files == (status ? LISTFILES_NONMATCHING : LISTFILES_MATCHING)) { print_filename (); putchar_errno ('\n' & filename_mask); if (line_buffered) fflush_errno (); } closeout: if (desc != STDIN_FILENO && close (desc) != 0) suppressible_error (errno); return status; } static bool grep_command_line_arg (char const *arg) { if (STREQ (arg, "-")) { filename = label; if (binary) xset_binary_mode (STDIN_FILENO, O_BINARY); return grepdesc (STDIN_FILENO, true); } else { filename = arg; return grepfile (AT_FDCWD, arg, true, true); } } _Noreturn void usage (int); void usage (int status) { if (status != 0) { fprintf (stderr, _("Usage: %s [OPTION]... PATTERNS [FILE]...\n"), getprogname ()); fprintf (stderr, _("Try '%s --help' for more information.\n"), getprogname ()); } else { printf (_("Usage: %s [OPTION]... PATTERNS [FILE]...\n"), getprogname ()); printf (_("Search for PATTERNS in each FILE.\n")); printf (_("\ Example: %s -i 'hello world' menu.h main.c\n\ PATTERNS can contain multiple patterns separated by newlines.\n\ \n\ Pattern selection and interpretation:\n"), getprogname ()); printf (_("\ -E, --extended-regexp PATTERNS are extended regular expressions\n\ -F, --fixed-strings PATTERNS are strings\n\ -G, --basic-regexp PATTERNS are basic regular expressions\n\ -P, --perl-regexp PATTERNS are Perl regular expressions\n")); /* -X is deliberately undocumented. */ printf (_("\ -e, --regexp=PATTERNS use PATTERNS for matching\n\ -f, --file=FILE take PATTERNS from FILE\n\ -i, --ignore-case ignore case distinctions in patterns and data\n\ --no-ignore-case do not ignore case distinctions (default)\n\ -w, --word-regexp match only whole words\n\ -x, --line-regexp match only whole lines\n\ -z, --null-data a data line ends in 0 byte, not newline\n")); printf (_("\ \n\ Miscellaneous:\n\ -s, --no-messages suppress error messages\n\ -v, --invert-match select non-matching lines\n\ -V, --version display version information and exit\n\ --help display this help text and exit\n")); printf (_("\ \n\ Output control:\n\ -m, --max-count=NUM stop after NUM selected lines\n\ -b, --byte-offset print the byte offset with output lines\n\ -n, --line-number print line number with output lines\n\ --line-buffered flush output on every line\n\ -H, --with-filename print file name with output lines\n\ -h, --no-filename suppress the file name prefix on output\n\ --label=LABEL use LABEL as the standard input file name prefix\n\ ")); printf (_("\ -o, --only-matching show only nonempty parts of lines that match\n\ -q, --quiet, --silent suppress all normal output\n\ --binary-files=TYPE assume that binary files are TYPE;\n\ TYPE is 'binary', 'text', or 'without-match'\n\ -a, --text equivalent to --binary-files=text\n\ ")); printf (_("\ -I equivalent to --binary-files=without-match\n\ -d, --directories=ACTION how to handle directories;\n\ ACTION is 'read', 'recurse', or 'skip'\n\ -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n\ ACTION is 'read' or 'skip'\n\ -r, --recursive like --directories=recurse\n\ -R, --dereference-recursive likewise, but follow all symlinks\n\ ")); printf (_("\ --include=GLOB search only files that match GLOB (a file pattern)" "\n\ --exclude=GLOB skip files that match GLOB\n\ --exclude-from=FILE skip files that match any file pattern from FILE\n\ --exclude-dir=GLOB skip directories that match GLOB\n\ ")); printf (_("\ -L, --files-without-match print only names of FILEs with no selected lines\n\ -l, --files-with-matches print only names of FILEs with selected lines\n\ -c, --count print only a count of selected lines per FILE\n\ -T, --initial-tab make tabs line up (if needed)\n\ -Z, --null print 0 byte after FILE name\n")); printf (_("\ \n\ Context control:\n\ -B, --before-context=NUM print NUM lines of leading context\n\ -A, --after-context=NUM print NUM lines of trailing context\n\ -C, --context=NUM print NUM lines of output context\n\ ")); printf (_("\ -NUM same as --context=NUM\n\ --group-separator=SEP print SEP on line between matches with context\n\ --no-group-separator do not print separator for matches with context\n\ --color[=WHEN],\n\ --colour[=WHEN] use markers to highlight the matching strings;\n\ WHEN is 'always', 'never', or 'auto'\n\ -U, --binary do not strip CR characters at EOL (MSDOS/Windows)\n\ \n")); #ifdef KMK_GREP printf (_("\ kmk_grep extensions:\n\ --codepage=NUM switches the locale to the given codepage, \n\ affecting how input files are treated and outputted\n\ windows only, ignored elsewhere\n\ --utf8 shorthand for --codepage=UTF8\n\ \n")); #endif printf (_("\ When FILE is '-', read standard input. With no FILE, read '.' if\n\ recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n\ Exit status is 0 if any line is selected, 1 otherwise;\n\ if any error occurs and -q is not given, the exit status is 2.\n")); emit_bug_reporting_address (); } exit (status); } /* Pattern compilers and matchers. */ static struct { char name[12]; int syntax; /* used if compile == GEAcompile */ compile_fp_t compile; execute_fp_t execute; } const matchers[] = { { "grep", RE_SYNTAX_GREP, (compile_fp_t)GEAcompile, (execute_fp_t)EGexecute }, { "egrep", RE_SYNTAX_EGREP, (compile_fp_t)GEAcompile, (execute_fp_t)EGexecute }, { "fgrep", 0, (compile_fp_t)Fcompile, (execute_fp_t)Fexecute }, { "awk", RE_SYNTAX_AWK, (compile_fp_t)GEAcompile, (execute_fp_t)EGexecute }, { "gawk", RE_SYNTAX_GNU_AWK, (compile_fp_t)GEAcompile, (execute_fp_t)EGexecute }, { "posixawk", RE_SYNTAX_POSIX_AWK, (compile_fp_t)GEAcompile, (execute_fp_t)EGexecute }, #if HAVE_LIBPCRE { "perl", 0, (compile_fp_t)Pcompile, (execute_fp_t)Pexecute }, #endif }; /* Keep these in sync with the 'matchers' table. */ enum { E_MATCHER_INDEX = 1, F_MATCHER_INDEX = 2, G_MATCHER_INDEX = 0 }; /* Return the index of the matcher corresponding to M if available. MATCHER is the index of the previous matcher, or -1 if none. Exit in case of conflicts or if M is not available. */ static int setmatcher (char const *m, int matcher) { for (int i = 0; i < sizeof matchers / sizeof *matchers; i++) if (STREQ (m, matchers[i].name)) { if (0 <= matcher && matcher != i) die (EXIT_TROUBLE, 0, _("conflicting matchers specified")); return i; } #if !HAVE_LIBPCRE if (STREQ (m, "perl")) die (EXIT_TROUBLE, 0, _("Perl matching not supported in a --disable-perl-regexp build")); #endif die (EXIT_TROUBLE, 0, _("invalid matcher %s"), m); } /* Get the next non-digit option from ARGC and ARGV. Return -1 if there are no more options. Process any digit options that were encountered on the way, and store the resulting integer into *DEFAULT_CONTEXT. */ static int get_nondigit_option (int argc, char *const *argv, intmax_t *default_context) { static int prev_digit_optind = -1; int this_digit_optind; bool was_digit; char buf[INT_BUFSIZE_BOUND (intmax_t) + 4]; char *p = buf; int opt; was_digit = false; this_digit_optind = optind; while (true) { opt = getopt_long (argc, (char **) argv, short_options, long_options, NULL); if (! c_isdigit (opt)) break; if (prev_digit_optind != this_digit_optind || !was_digit) { /* Reset to start another context length argument. */ p = buf; } else { /* Suppress trivial leading zeros, to avoid incorrect diagnostic on strings like 00000000000. */ p -= buf[0] == '0'; } if (p == buf + sizeof buf - 4) { /* Too many digits. Append "..." to make context_length_arg complain about "X...", where X contains the digits seen so far. */ strcpy (p, "..."); p += 3; break; } *p++ = opt; was_digit = true; prev_digit_optind = this_digit_optind; this_digit_optind = optind; } if (p != buf) { *p = '\0'; context_length_arg (buf, default_context); } return opt; } /* Parse GREP_COLORS. The default would look like: GREP_COLORS='ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36' with boolean capabilities (ne and rv) unset (i.e., omitted). No character escaping is needed or supported. */ static void parse_grep_colors (void) { const char *p; char *q; char *name; char *val; p = getenv ("GREP_COLORS"); /* Plural! */ if (p == NULL || *p == '\0') return; /* Work off a writable copy. */ q = xstrdup (p); name = q; val = NULL; /* From now on, be well-formed or you're gone. */ for (;;) if (*q == ':' || *q == '\0') { char c = *q; struct color_cap const *cap; *q++ = '\0'; /* Terminate name or val. */ /* Empty name without val (empty cap) * won't match and will be ignored. */ for (cap = color_dict; cap->name; cap++) if (STREQ (cap->name, name)) break; /* If name unknown, go on for forward compatibility. */ if (cap->var && val) *(cap->var) = val; if (cap->fct) cap->fct (); if (c == '\0') return; name = q; val = NULL; } else if (*q == '=') { if (q == name || val) return; *q++ = '\0'; /* Terminate name. */ val = q; /* Can be the empty string. */ } else if (val == NULL) q++; /* Accumulate name. */ else if (*q == ';' || c_isdigit (*q)) q++; /* Accumulate val. Protect the terminal from being sent crap. */ else return; } /* Return true if PAT (of length PATLEN) contains an encoding error. */ static bool contains_encoding_error (char const *pat, size_t patlen) { mbstate_t mbs = { 0 }; size_t i, charlen; for (i = 0; i < patlen; i += charlen) { charlen = mb_clen (pat + i, patlen - i, &mbs); if ((size_t) -2 <= charlen) return true; } return false; } /* When ignoring case and (-E or -F or -G), then for each single-byte character I, ok_fold[I] is 1 if every case folded counterpart of I is also single-byte, and is -1 otherwise. */ static signed char ok_fold[NCHAR]; static void setup_ok_fold (void) { for (int i = 0; i < NCHAR; i++) { wint_t wi = localeinfo.sbctowc[i]; if (wi == WEOF) continue; int ok = 1; wchar_t folded[CASE_FOLDED_BUFSIZE]; for (int n = case_folded_counterparts (wi, folded); 0 <= --n; ) { char buf[MB_LEN_MAX]; mbstate_t s = { 0 }; if (wcrtomb (buf, folded[n], &s) != 1) { ok = -1; break; } } ok_fold[i] = ok; } } /* Return the number of bytes in the initial character of PAT, of size PATLEN, if Fcompile can handle that character. Return -1 if Fcompile cannot handle it. MBS is the multibyte conversion state. PATLEN must be nonzero. */ static int fgrep_icase_charlen (char const *pat, size_t patlen, mbstate_t *mbs) { unsigned char pat0 = pat[0]; /* If PAT starts with a single-byte character, Fcompile works if every case folded counterpart is also single-byte. */ if (localeinfo.sbctowc[pat0] != WEOF) return ok_fold[pat0]; wchar_t wc; size_t wn = mbrtowc (&wc, pat, patlen, mbs); /* If PAT starts with an encoding error, Fcompile does not work. */ if (MB_LEN_MAX < wn) return -1; /* PAT starts with a multibyte character. Fcompile works if the character has no case folded counterparts and toupper translates none of its encoding's bytes. */ wchar_t folded[CASE_FOLDED_BUFSIZE]; if (case_folded_counterparts (wc, folded)) return -1; for (int i = wn; 0 < --i; ) { unsigned char c = pat[i]; if (toupper (c) != c) return -1; } return wn; } /* Return true if the -F patterns PAT, of size PATLEN, contain only single-byte characters that case-fold only to single-byte characters, or multibyte characters not subject to case folding, and so can be processed by Fcompile. */ static bool fgrep_icase_available (char const *pat, size_t patlen) { mbstate_t mbs = {0,}; for (size_t i = 0; i < patlen; ) { int n = fgrep_icase_charlen (pat + i, patlen - i, &mbs); if (n < 0) return false; i += n; } return true; } /* Change the pattern *KEYS_P, of size *LEN_P, from fgrep to grep style. */ void fgrep_to_grep_pattern (char **keys_p, size_t *len_p) { size_t len = *len_p; char *keys = *keys_p; mbstate_t mb_state = { 0 }; char *new_keys = xnmalloc (len + 1, 2); char *p = new_keys; size_t n; for (; len; keys += n, len -= n) { n = mb_clen (keys, len, &mb_state); switch (n) { case (size_t) -2: n = len; FALLTHROUGH; default: p = mempcpy (p, keys, n); break; case (size_t) -1: memset (&mb_state, 0, sizeof mb_state); n = 1; FALLTHROUGH; case 1: switch (*keys) { case '$': case '*': case '.': case '[': case '\\': case '^': *p++ = '\\'; break; } *p++ = *keys; break; } } *p = '\n'; free (*keys_p); *keys_p = new_keys; *len_p = p - new_keys; } /* If it is easy, convert the MATCHER-style patterns KEYS (of size *LEN_P) to -F style, update *LEN_P to a possibly-smaller value, and return F_MATCHER_INDEX. If not, leave KEYS and *LEN_P alone and return MATCHER. This function is conservative and sometimes misses conversions, e.g., it does not convert the -E pattern "(a|a|[aa])" to the -F pattern "a". */ static int try_fgrep_pattern (int matcher, char *keys, size_t *len_p) { int result = matcher; size_t len = *len_p; char *new_keys = xmalloc (len + 1); char *p = new_keys; char const *q = keys; mbstate_t mb_state = { 0 }; while (len != 0) { switch (*q) { case '$': case '*': case '.': case '[': case '^': goto fail; case '(': case '+': case '?': case '{': case '|': /* There is no "case ')'" here, as "grep -E ')'" acts like "grep -E '\)'". */ if (matcher != G_MATCHER_INDEX) goto fail; break; case '\\': if (1 < len) switch (q[1]) { case '\n': case 'B': case 'S': case 'W': case'\'': case '<': case 'b': case 's': case 'w': case '`': case '>': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto fail; case '(': case '+': case '?': case '{': case '|': /* Pass '\)' to GEAcompile so it can complain. Otherwise, "grep '\)'" would act like "grep ')'" while "grep '.*\)' would be an error. */ case ')': if (matcher == G_MATCHER_INDEX) goto fail; FALLTHROUGH; default: q++, len--; break; } break; } { size_t n; if (match_icase) { int ni = fgrep_icase_charlen (q, len, &mb_state); if (ni < 0) goto fail; n = ni; } else { n = mb_clen (q, len, &mb_state); if (MB_LEN_MAX < n) goto fail; } p = mempcpy (p, q, n); q += n; len -= n; } } if (*len_p != p - new_keys) { *len_p = p - new_keys; char *keys_end = mempcpy (keys, new_keys, p - new_keys); *keys_end = '\n'; } result = F_MATCHER_INDEX; fail: free (new_keys); return result; } int main (int argc, char **argv) { char *keys = NULL; size_t keycc = 0, keyalloc = 0; int matcher = -1; int opt; int prev_optind, last_recursive; int fread_errno; intmax_t default_context; FILE *fp; exit_failure = EXIT_TROUBLE; initialize_main (&argc, &argv); /* Which command-line options have been specified for filename output. -1 for -h, 1 for -H, 0 for neither. */ int filename_option = 0; eolbyte = '\n'; filename_mask = ~0; max_count = INTMAX_MAX; /* The value -1 means to use DEFAULT_CONTEXT. */ out_after = out_before = -1; /* Default before/after context: changed by -C/-NUM options */ default_context = -1; /* Changed by -o option */ only_matching = false; /* Internationalization. */ #if defined HAVE_SETLOCALE # if defined(KMK_GREP) && defined(KBUILD_OS_WINDOWS) if (getenv ("KMK_GREP_CODEPAGE")) kmk_grep_set_codepage (getenv ("KMK_GREP_CODEPAGE")); else # endif setlocale (LC_ALL, ""); #endif #if defined ENABLE_NLS bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); #endif init_localeinfo (&localeinfo); atexit (clean_up_stdout); c_stack_action (NULL); last_recursive = 0; pattern_table = hash_initialize (0, 0, hash_pattern, compare_patterns, 0); if (!pattern_table) xalloc_die (); while (prev_optind = optind, (opt = get_nondigit_option (argc, argv, &default_context)) != -1) switch (opt) { case 'A': context_length_arg (optarg, &out_after); break; case 'B': context_length_arg (optarg, &out_before); break; case 'C': /* Set output match context, but let any explicit leading or trailing amount specified with -A or -B stand. */ context_length_arg (optarg, &default_context); break; case 'D': if (STREQ (optarg, "read")) devices = READ_DEVICES; else if (STREQ (optarg, "skip")) devices = SKIP_DEVICES; else die (EXIT_TROUBLE, 0, _("unknown devices method")); break; case 'E': matcher = setmatcher ("egrep", matcher); break; case 'F': matcher = setmatcher ("fgrep", matcher); break; case 'P': matcher = setmatcher ("perl", matcher); break; case 'G': matcher = setmatcher ("grep", matcher); break; case 'X': /* undocumented on purpose */ matcher = setmatcher (optarg, matcher); break; case 'H': filename_option = 1; break; case 'I': binary_files = WITHOUT_MATCH_BINARY_FILES; break; case 'T': align_tabs = true; break; case 'U': if (O_BINARY) binary = true; break; case 'u': /* Obsolete option; it had no effect; FIXME: remove in 2023 */ error (0, 0, _("warning: --unix-byte-offsets (-u) is obsolete")); break; case 'V': show_version = true; break; case 'a': binary_files = TEXT_BINARY_FILES; break; case 'b': out_byte = true; break; case 'c': count_matches = true; break; case 'd': directories = XARGMATCH ("--directories", optarg, directories_args, directories_types); if (directories == RECURSE_DIRECTORIES) last_recursive = prev_optind; break; case 'e': { ptrdiff_t cc = strlen (optarg); if (keyalloc < keycc + cc + 1) { keyalloc = keycc + cc + 1; pattern_array = keys = x2realloc (keys, &keyalloc); } char *keyend = mempcpy (keys + keycc, optarg, cc); *keyend = '\n'; keycc = update_patterns (keys, keycc, keycc + cc + 1, ""); } break; case 'f': { if (STREQ (optarg, "-")) { if (binary) xset_binary_mode (STDIN_FILENO, O_BINARY); fp = stdin; } else { fp = fopen (optarg, binary ? "rb" : "r"); if (!fp) die (EXIT_TROUBLE, errno, "%s", optarg); } ptrdiff_t newkeycc = keycc, cc; for (;; newkeycc += cc) { if (keyalloc <= newkeycc + 1) pattern_array = keys = x2realloc (keys, &keyalloc); cc = fread (keys + newkeycc, 1, keyalloc - (newkeycc + 1), fp); if (cc == 0) break; } fread_errno = errno; if (ferror (fp)) die (EXIT_TROUBLE, fread_errno, "%s", optarg); if (fp != stdin) fclose (fp); /* Append final newline if file ended in non-newline. */ if (newkeycc != keycc && keys[newkeycc - 1] != '\n') keys[newkeycc++] = '\n'; keycc = update_patterns (keys, keycc, newkeycc, optarg); } break; case 'h': filename_option = -1; break; case 'i': case 'y': /* For old-timers . . . */ match_icase = true; break; case NO_IGNORE_CASE_OPTION: match_icase = false; break; case 'L': /* Like -l, except list files that don't contain matches. Inspired by the same option in Hume's gre. */ list_files = LISTFILES_NONMATCHING; break; case 'l': list_files = LISTFILES_MATCHING; break; case 'm': switch (xstrtoimax (optarg, 0, 10, &max_count, "")) { case LONGINT_OK: case LONGINT_OVERFLOW: break; default: die (EXIT_TROUBLE, 0, _("invalid max count")); } break; case 'n': out_line = true; break; case 'o': only_matching = true; break; case 'q': exit_on_match = true; exit_failure = 0; break; case 'R': fts_options = basic_fts_options | FTS_LOGICAL; FALLTHROUGH; case 'r': directories = RECURSE_DIRECTORIES; last_recursive = prev_optind; break; case 's': suppress_errors = true; break; case 'v': out_invert = true; break; case 'w': wordinit (); match_words = true; break; case 'x': match_lines = true; break; case 'Z': filename_mask = 0; break; case 'z': eolbyte = '\0'; break; case BINARY_FILES_OPTION: if (STREQ (optarg, "binary")) binary_files = BINARY_BINARY_FILES; else if (STREQ (optarg, "text")) binary_files = TEXT_BINARY_FILES; else if (STREQ (optarg, "without-match")) binary_files = WITHOUT_MATCH_BINARY_FILES; else die (EXIT_TROUBLE, 0, _("unknown binary-files type")); break; case COLOR_OPTION: if (optarg) { if (!c_strcasecmp (optarg, "always") || !c_strcasecmp (optarg, "yes") || !c_strcasecmp (optarg, "force")) color_option = 1; else if (!c_strcasecmp (optarg, "never") || !c_strcasecmp (optarg, "no") || !c_strcasecmp (optarg, "none")) color_option = 0; else if (!c_strcasecmp (optarg, "auto") || !c_strcasecmp (optarg, "tty") || !c_strcasecmp (optarg, "if-tty")) color_option = 2; else show_help = 1; } else color_option = 2; break; case EXCLUDE_OPTION: case INCLUDE_OPTION: for (int cmd = 0; cmd < 2; cmd++) { if (!excluded_patterns[cmd]) excluded_patterns[cmd] = new_exclude (); add_exclude (excluded_patterns[cmd], optarg, ((opt == INCLUDE_OPTION ? EXCLUDE_INCLUDE : 0) | exclude_options (cmd))); } break; case EXCLUDE_FROM_OPTION: for (int cmd = 0; cmd < 2; cmd++) { if (!excluded_patterns[cmd]) excluded_patterns[cmd] = new_exclude (); if (add_exclude_file (add_exclude, excluded_patterns[cmd], optarg, exclude_options (cmd), '\n') != 0) die (EXIT_TROUBLE, errno, "%s", optarg); } break; case EXCLUDE_DIRECTORY_OPTION: strip_trailing_slashes (optarg); for (int cmd = 0; cmd < 2; cmd++) { if (!excluded_directory_patterns[cmd]) excluded_directory_patterns[cmd] = new_exclude (); add_exclude (excluded_directory_patterns[cmd], optarg, exclude_options (cmd)); } break; case GROUP_SEPARATOR_OPTION: group_separator = optarg; break; case LINE_BUFFERED_OPTION: line_buffered = true; break; case LABEL_OPTION: label = optarg; break; #ifdef KMK_GREP /* The --utf8 and --codepage options are mainly for windows where UCRT doesn't check any of the standard locale selecting environment variables and we have to give it directly to setlocale if we want any control beyond the Windows defaults. The UCRT setlocale has a nice feature of allowing us to set just the codepage, omitting the rest of the locale spec. */ case UTF8_OPTION: kmk_grep_set_codepage (".UTF-8"); break; case CODEPAGE_OPTION: kmk_grep_set_codepage (optarg); break; #endif case 0: /* long options */ break; default: usage (EXIT_TROUBLE); break; } if (show_version) { version_etc (stdout, getprogname (), PACKAGE_NAME, VERSION, (char *) NULL); puts (_("Written by Mike Haertel and others; see\n" ".")); return EXIT_SUCCESS; } if (show_help) usage (EXIT_SUCCESS); if (keys) { if (keycc == 0) { /* No keys were specified (e.g. -f /dev/null). Match nothing. */ out_invert ^= true; match_lines = match_words = false; keys[keycc++] = '\n'; } } else if (optind < argc) { /* Make a copy so that it can be reallocated or freed later. */ pattern_array = keys = xstrdup (argv[optind++]); ptrdiff_t patlen = strlen (keys); keys[patlen] = '\n'; keycc = update_patterns (keys, 0, patlen + 1, ""); } else usage (EXIT_TROUBLE); /* Strip trailing newline from keys. */ keycc--; hash_free (pattern_table); bool possibly_tty = false; struct stat tmp_stat; if (! exit_on_match && fstat (STDOUT_FILENO, &tmp_stat) == 0) { if (S_ISREG (tmp_stat.st_mode)) out_stat = tmp_stat; else if (S_ISCHR (tmp_stat.st_mode)) { struct stat null_stat; if (stat ("/dev/null", &null_stat) == 0 && SAME_INODE (tmp_stat, null_stat)) dev_null_output = true; else possibly_tty = true; } } /* POSIX says -c, -l and -q are mutually exclusive. In this implementation, -q overrides -l and -L, which in turn override -c. */ if (exit_on_match | dev_null_output) list_files = LISTFILES_NONE; if ((exit_on_match | dev_null_output) || list_files != LISTFILES_NONE) { count_matches = false; done_on_match = true; } out_quiet = count_matches | done_on_match; if (out_after < 0) out_after = default_context; if (out_before < 0) out_before = default_context; /* If it is easy to see that matching cannot succeed (e.g., 'grep -f /dev/null'), fail without reading the input. */ if ((max_count == 0 || (keycc == 0 && out_invert && !match_lines && !match_words)) && list_files != LISTFILES_NONMATCHING) return EXIT_FAILURE; if (color_option == 2) color_option = possibly_tty && should_colorize () && isatty (STDOUT_FILENO); init_colorize (); if (color_option) { /* Legacy. */ char *userval = getenv ("GREP_COLOR"); if (userval != NULL && *userval != '\0') selected_match_color = context_match_color = userval; /* New GREP_COLORS has priority. */ parse_grep_colors (); } initialize_unibyte_mask (); if (matcher < 0) matcher = G_MATCHER_INDEX; if (matcher == F_MATCHER_INDEX || matcher == E_MATCHER_INDEX || matcher == G_MATCHER_INDEX) { if (match_icase) setup_ok_fold (); /* In a single-byte locale, switch from -F to -G if it is a single pattern that matches words, where -G is typically faster. In a multibyte locale, switch if the patterns have an encoding error (where -F does not work) or if -i and the patterns will not work for -iF. */ if (matcher == F_MATCHER_INDEX) { if (! localeinfo.multibyte ? n_patterns == 1 && match_words : (contains_encoding_error (keys, keycc) || (match_icase && !fgrep_icase_available (keys, keycc)))) { fgrep_to_grep_pattern (&pattern_array, &keycc); keys = pattern_array; matcher = G_MATCHER_INDEX; } } /* With two or more patterns, if -F works then switch from either -E or -G, as -F is probably faster then. */ else if (1 < n_patterns) matcher = try_fgrep_pattern (matcher, keys, &keycc); } execute = matchers[matcher].execute; compiled_pattern = matchers[matcher].compile (keys, keycc, matchers[matcher].syntax, only_matching | color_option); /* We need one byte prior and one after. */ char eolbytes[3] = { 0, eolbyte, 0 }; size_t match_size; skip_empty_lines = ((execute (compiled_pattern, eolbytes + 1, 1, &match_size, NULL) == 0) == out_invert); int num_operands = argc - optind; out_file = (filename_option == 0 && num_operands <= 1 ? - (directories == RECURSE_DIRECTORIES) : 0 <= filename_option); if (binary) xset_binary_mode (STDOUT_FILENO, O_BINARY); /* Prefer sysconf for page size, as getpagesize typically returns int. */ #ifdef _SC_PAGESIZE long psize = sysconf (_SC_PAGESIZE); #else long psize = getpagesize (); #endif if (! (0 < psize && psize <= (SIZE_MAX - sizeof (uword)) / 2)) abort (); pagesize = psize; bufalloc = ALIGN_TO (INITIAL_BUFSIZE, pagesize) + pagesize + sizeof (uword); buffer = xmalloc (bufalloc); if (fts_options & FTS_LOGICAL && devices == READ_COMMAND_LINE_DEVICES) devices = READ_DEVICES; char *const *files; if (0 < num_operands) { files = argv + optind; } else if (directories == RECURSE_DIRECTORIES && 0 < last_recursive) { static char *const cwd_only[] = { (char *) ".", NULL }; files = cwd_only; omit_dot_slash = true; } else { static char *const stdin_only[] = { (char *) "-", NULL }; files = stdin_only; } bool status = true; do status &= grep_command_line_arg (*files++); while (*files != NULL); /* We register via atexit to test stdout. */ return errseen ? EXIT_TROUBLE : status; } kbuild-3608/src/grep/src/egrep.sh0000664000175000017500000000004414670377426016675 0ustar locutuslocutus#!@SHELL@ exec @grep@ @option@ "$@" kbuild-3608/src/grep/src/grep.h0000664000175000017500000000226314670377426016352 0ustar locutuslocutus/* grep.h - interface to grep driver for searching subroutines. Copyright (C) 1992, 1998, 2001, 2007, 2009-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef GREP_GREP_H #define GREP_GREP_H 1 #include /* The following flags are exported from grep for the matchers to look at. */ extern bool match_icase; /* -i */ extern bool match_words; /* -w */ extern bool match_lines; /* -x */ extern char eolbyte; /* -z */ extern char const *pattern_file_name (size_t, size_t *); #endif kbuild-3608/src/grep/src/pcresearch.c0000664000175000017500000002520714670377426017532 0ustar locutuslocutus/* pcresearch.c - searching subroutines using PCRE for grep. Copyright 2000, 2007, 2009-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written August 1992 by Mike Haertel. */ #include #include "search.h" #include "die.h" #include /* This must be at least 2; everything after that is for performance in pcre_exec. */ enum { NSUB = 300 }; #ifndef PCRE_EXTRA_MATCH_LIMIT_RECURSION # define PCRE_EXTRA_MATCH_LIMIT_RECURSION 0 #endif #ifndef PCRE_STUDY_JIT_COMPILE # define PCRE_STUDY_JIT_COMPILE 0 #endif #ifndef PCRE_STUDY_EXTRA_NEEDED # define PCRE_STUDY_EXTRA_NEEDED 0 #endif struct pcre_comp { /* Compiled internal form of a Perl regular expression. */ pcre *cre; /* Additional information about the pattern. */ pcre_extra *extra; #if PCRE_STUDY_JIT_COMPILE /* The JIT stack and its maximum size. */ pcre_jit_stack *jit_stack; int jit_stack_size; #endif /* Table, indexed by ! (flag & PCRE_NOTBOL), of whether the empty string matches when that flag is used. */ int empty_match[2]; }; /* Match the already-compiled PCRE pattern against the data in SUBJECT, of size SEARCH_BYTES and starting with offset SEARCH_OFFSET, with options OPTIONS, and storing resulting matches into SUB. Return the (nonnegative) match location or a (negative) error number. */ static int jit_exec (struct pcre_comp *pc, char const *subject, int search_bytes, int search_offset, int options, int *sub) { while (true) { int e = pcre_exec (pc->cre, pc->extra, subject, search_bytes, search_offset, options, sub, NSUB); #if PCRE_STUDY_JIT_COMPILE if (e == PCRE_ERROR_JIT_STACKLIMIT && 0 < pc->jit_stack_size && pc->jit_stack_size <= INT_MAX / 2) { int old_size = pc->jit_stack_size; int new_size = pc->jit_stack_size = old_size * 2; if (pc->jit_stack) pcre_jit_stack_free (pc->jit_stack); pc->jit_stack = pcre_jit_stack_alloc (old_size, new_size); if (!pc->jit_stack) die (EXIT_TROUBLE, 0, _("failed to allocate memory for the PCRE JIT stack")); pcre_assign_jit_stack (pc->extra, NULL, pc->jit_stack); continue; } #endif #if PCRE_EXTRA_MATCH_LIMIT_RECURSION if (e == PCRE_ERROR_RECURSIONLIMIT && (PCRE_STUDY_EXTRA_NEEDED || pc->extra)) { unsigned long lim = (pc->extra->flags & PCRE_EXTRA_MATCH_LIMIT_RECURSION ? pc->extra->match_limit_recursion : 0); if (lim <= ULONG_MAX / 2) { pc->extra->match_limit_recursion = lim ? 2 * lim : (1 << 24) - 1; pc->extra->flags |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; continue; } } #endif return e; } } /* Compile the -P style PATTERN, containing SIZE bytes that are followed by '\n'. Return a description of the compiled pattern. */ void * Pcompile (char *pattern, size_t size, reg_syntax_t ignored, bool exact) { int e; char const *ep; static char const wprefix[] = "(?cre = pcre_compile (re, flags, &ep, &e, pcre_maketables ()); if (!pc->cre) die (EXIT_TROUBLE, 0, "%s", ep); int pcre_study_flags = PCRE_STUDY_EXTRA_NEEDED | PCRE_STUDY_JIT_COMPILE; pc->extra = pcre_study (pc->cre, pcre_study_flags, &ep); if (ep) die (EXIT_TROUBLE, 0, "%s", ep); #if PCRE_STUDY_JIT_COMPILE if (pcre_fullinfo (pc->cre, pc->extra, PCRE_INFO_JIT, &e)) die (EXIT_TROUBLE, 0, _("internal error (should never happen)")); /* The PCRE documentation says that a 32 KiB stack is the default. */ if (e) pc->jit_stack_size = 32 << 10; #endif free (re); int sub[NSUB]; pc->empty_match[false] = pcre_exec (pc->cre, pc->extra, "", 0, 0, PCRE_NOTBOL, sub, NSUB); pc->empty_match[true] = pcre_exec (pc->cre, pc->extra, "", 0, 0, 0, sub, NSUB); return pc; } size_t Pexecute (void *vcp, char const *buf, size_t size, size_t *match_size, char const *start_ptr) { int sub[NSUB]; char const *p = start_ptr ? start_ptr : buf; bool bol = p[-1] == eolbyte; char const *line_start = buf; int e = PCRE_ERROR_NOMATCH; char const *line_end; struct pcre_comp *pc = vcp; /* The search address to pass to pcre_exec. This is the start of the buffer, or just past the most-recently discovered encoding error or line end. */ char const *subject = buf; do { /* Search line by line. Although this code formerly used PCRE_MULTILINE for performance, the performance wasn't always better and the correctness issues were too puzzling. See Bug#22655. */ line_end = rawmemchr (p, eolbyte); if (INT_MAX < line_end - p) die (EXIT_TROUBLE, 0, _("exceeded PCRE's line length limit")); for (;;) { /* Skip past bytes that are easily determined to be encoding errors, treating them as data that cannot match. This is faster than having pcre_exec check them. */ while (localeinfo.sbclen[to_uchar (*p)] == -1) { p++; subject = p; bol = false; } int search_offset = p - subject; /* Check for an empty match; this is faster than letting pcre_exec do it. */ if (p == line_end) { sub[0] = sub[1] = search_offset; e = pc->empty_match[bol]; break; } int options = 0; if (!bol) options |= PCRE_NOTBOL; e = jit_exec (pc, subject, line_end - subject, search_offset, options, sub); if (e != PCRE_ERROR_BADUTF8) break; int valid_bytes = sub[0]; if (search_offset <= valid_bytes) { /* Try to match the string before the encoding error. */ if (valid_bytes == 0) { /* Handle the empty-match case specially, for speed. This optimization is valid if VALID_BYTES is zero, which means SEARCH_OFFSET is also zero. */ sub[1] = 0; e = pc->empty_match[bol]; } else e = jit_exec (pc, subject, valid_bytes, search_offset, options | PCRE_NO_UTF8_CHECK | PCRE_NOTEOL, sub); if (e != PCRE_ERROR_NOMATCH) break; /* Treat the encoding error as data that cannot match. */ p = subject + valid_bytes + 1; bol = false; } subject += valid_bytes + 1; } if (e != PCRE_ERROR_NOMATCH) break; bol = true; p = subject = line_start = line_end + 1; } while (p < buf + size); if (e <= 0) { switch (e) { case PCRE_ERROR_NOMATCH: break; case PCRE_ERROR_NOMEMORY: die (EXIT_TROUBLE, 0, _("%s: memory exhausted"), input_filename ()); #if PCRE_STUDY_JIT_COMPILE case PCRE_ERROR_JIT_STACKLIMIT: die (EXIT_TROUBLE, 0, _("%s: exhausted PCRE JIT stack"), input_filename ()); #endif case PCRE_ERROR_MATCHLIMIT: die (EXIT_TROUBLE, 0, _("%s: exceeded PCRE's backtracking limit"), input_filename ()); case PCRE_ERROR_RECURSIONLIMIT: die (EXIT_TROUBLE, 0, _("%s: exceeded PCRE's recursion limit"), input_filename ()); default: /* For now, we lump all remaining PCRE failures into this basket. If anyone cares to provide sample grep usage that can trigger particular PCRE errors, we can add to the list (above) of more detailed diagnostics. */ die (EXIT_TROUBLE, 0, _("%s: internal PCRE error: %d"), input_filename (), e); } return -1; } else { char const *matchbeg = subject + sub[0]; char const *matchend = subject + sub[1]; char const *beg; char const *end; if (start_ptr) { beg = matchbeg; end = matchend; } else { beg = line_start; end = line_end + 1; } *match_size = end - beg; return beg - buf; } } kbuild-3608/src/grep/src/kwset.c0000664000175000017500000007110214670377427016544 0ustar locutuslocutus/* kwset.c - search for any of a set of keywords. Copyright (C) 1989, 1998, 2000, 2005, 2007, 2009-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written August 1989 by Mike Haertel. */ /* For the Aho-Corasick algorithm, see: Aho AV, Corasick MJ. Efficient string matching: an aid to bibliographic search. CACM 18, 6 (1975), 333-40 , which describes the failure function used below. For the Boyer-Moore algorithm, see: Boyer RS, Moore JS. A fast string searching algorithm. CACM 20, 10 (1977), 762-72 . For a survey of more-recent string matching algorithms that might help improve performance, see: Faro S, Lecroq T. The exact online string matching problem: a review of the most recent results. ACM Computing Surveys 45, 2 (2013), 13 . */ #include #include "kwset.h" #include #include #include "system.h" #include "intprops.h" #include "memchr2.h" #include "obstack.h" #include "xalloc.h" #include "verify.h" #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free static unsigned char U (char ch) { return to_uchar (ch); } /* Balanced tree of edges and labels leaving a given trie node. */ struct tree { struct tree *llink; /* Left link; MUST be first field. */ struct tree *rlink; /* Right link (to larger labels). */ struct trie *trie; /* Trie node pointed to by this edge. */ unsigned char label; /* Label on this edge. */ char balance; /* Difference in depths of subtrees. */ }; /* Node of a trie representing a set of keywords. */ struct trie { /* If an accepting node, this is either 2*W + 1 where W is the word index, or is SIZE_MAX if Aho-Corasick is in use and FAIL specifies where to look for more info. If not an accepting node, this is zero. */ size_t accepting; struct tree *links; /* Tree of edges leaving this node. */ struct trie *parent; /* Parent of this node. */ struct trie *next; /* List of all trie nodes in level order. */ struct trie *fail; /* Aho-Corasick failure function. */ ptrdiff_t depth; /* Depth of this node from the root. */ ptrdiff_t shift; /* Shift function for search failures. */ ptrdiff_t maxshift; /* Max shift of self and descendants. */ }; /* Structure returned opaquely to the caller, containing everything. */ struct kwset { struct obstack obstack; /* Obstack for node allocation. */ ptrdiff_t words; /* Number of words in the trie. */ struct trie *trie; /* The trie itself. */ ptrdiff_t mind; /* Minimum depth of an accepting node. */ ptrdiff_t maxd; /* Maximum depth of any node. */ unsigned char delta[NCHAR]; /* Delta table for rapid search. */ struct trie *next[NCHAR]; /* Table of children of the root. */ char *target; /* Target string if there's only one. */ ptrdiff_t *shift; /* Used in Boyer-Moore search for one string. */ char const *trans; /* Character translation table. */ /* This helps to match a terminal byte, which is the first byte for Aho-Corasick, and the last byte for Boyer-More. If all the patterns have the same terminal byte (after translation via TRANS if TRANS is nonnull), then this is that byte as an unsigned char. Otherwise this is -1 if there is disagreement among the strings about terminal bytes, and -2 if there are no terminal bytes and no disagreement because all the patterns are empty. */ int gc1; /* This helps to match a terminal byte. If 0 <= GC1HELP, B is terminal when B == GC1 || B == GC1HELP (note that GC1 == GCHELP is common here). This is typically faster than evaluating to_uchar (TRANS[B]) == GC1. */ int gc1help; /* If the string has two or more bytes, this is the penultimate byte, after translation via TRANS if TRANS is nonnull. This variable is used only by Boyer-Moore. */ char gc2; /* kwsexec implementation. */ ptrdiff_t (*kwsexec) (kwset_t, char const *, ptrdiff_t, struct kwsmatch *, bool); }; /* Use TRANS to transliterate C. A null TRANS does no transliteration. */ static inline char tr (char const *trans, char c) { return trans ? trans[U(c)] : c; } static ptrdiff_t acexec (kwset_t, char const *, ptrdiff_t, struct kwsmatch *, bool); static ptrdiff_t bmexec (kwset_t, char const *, ptrdiff_t, struct kwsmatch *, bool); /* Return a newly allocated keyword set. A nonnull TRANS specifies a table of character translations to be applied to all pattern and search text. */ kwset_t kwsalloc (char const *trans) { struct kwset *kwset = xmalloc (sizeof *kwset); obstack_init (&kwset->obstack); kwset->words = 0; kwset->trie = obstack_alloc (&kwset->obstack, sizeof *kwset->trie); kwset->trie->accepting = 0; kwset->trie->links = NULL; kwset->trie->parent = NULL; kwset->trie->next = NULL; kwset->trie->fail = NULL; kwset->trie->depth = 0; kwset->trie->shift = 0; kwset->mind = PTRDIFF_MAX; kwset->maxd = -1; kwset->target = NULL; kwset->trans = trans; kwset->kwsexec = acexec; return kwset; } /* This upper bound is valid for CHAR_BIT >= 4 and exact for CHAR_BIT in { 4..11, 13, 15, 17, 19 }. */ enum { DEPTH_SIZE = CHAR_BIT + CHAR_BIT / 2 }; /* Add the given string to the contents of the keyword set. */ void kwsincr (kwset_t kwset, char const *text, ptrdiff_t len) { assume (0 <= len); struct trie *trie = kwset->trie; char const *trans = kwset->trans; bool reverse = kwset->kwsexec == bmexec; if (reverse) text += len; /* Descend the trie (built of keywords) character-by-character, installing new nodes when necessary. */ while (len--) { unsigned char uc = reverse ? *--text : *text++; unsigned char label = trans ? trans[uc] : uc; /* Descend the tree of outgoing links for this trie node, looking for the current character and keeping track of the path followed. */ struct tree *cur = trie->links; struct tree *links[DEPTH_SIZE]; enum { L, R } dirs[DEPTH_SIZE]; links[0] = (struct tree *) &trie->links; dirs[0] = L; ptrdiff_t depth = 1; while (cur && label != cur->label) { links[depth] = cur; if (label < cur->label) dirs[depth++] = L, cur = cur->llink; else dirs[depth++] = R, cur = cur->rlink; } /* The current character doesn't have an outgoing link at this trie node, so build a new trie node and install a link in the current trie node's tree. */ if (!cur) { cur = obstack_alloc (&kwset->obstack, sizeof *cur); cur->llink = NULL; cur->rlink = NULL; cur->trie = obstack_alloc (&kwset->obstack, sizeof *cur->trie); cur->trie->accepting = 0; cur->trie->links = NULL; cur->trie->parent = trie; cur->trie->next = NULL; cur->trie->fail = NULL; cur->trie->depth = trie->depth + 1; cur->trie->shift = 0; cur->label = label; cur->balance = 0; /* Install the new tree node in its parent. */ if (dirs[--depth] == L) links[depth]->llink = cur; else links[depth]->rlink = cur; /* Back up the tree fixing the balance flags. */ while (depth && !links[depth]->balance) { if (dirs[depth] == L) --links[depth]->balance; else ++links[depth]->balance; --depth; } /* Rebalance the tree by pointer rotations if necessary. */ if (depth && ((dirs[depth] == L && --links[depth]->balance) || (dirs[depth] == R && ++links[depth]->balance))) { struct tree *t, *r, *l, *rl, *lr; switch (links[depth]->balance) { case (char) -2: switch (dirs[depth + 1]) { case L: r = links[depth], t = r->llink, rl = t->rlink; t->rlink = r, r->llink = rl; t->balance = r->balance = 0; break; case R: r = links[depth], l = r->llink, t = l->rlink; rl = t->rlink, lr = t->llink; t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl; l->balance = t->balance != 1 ? 0 : -1; r->balance = t->balance != (char) -1 ? 0 : 1; t->balance = 0; break; default: abort (); } break; case 2: switch (dirs[depth + 1]) { case R: l = links[depth], t = l->rlink, lr = t->llink; t->llink = l, l->rlink = lr; t->balance = l->balance = 0; break; case L: l = links[depth], r = l->rlink, t = r->llink; lr = t->llink, rl = t->rlink; t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl; l->balance = t->balance != 1 ? 0 : -1; r->balance = t->balance != (char) -1 ? 0 : 1; t->balance = 0; break; default: abort (); } break; default: abort (); } if (dirs[depth - 1] == L) links[depth - 1]->llink = t; else links[depth - 1]->rlink = t; } } trie = cur->trie; } /* Mark the node finally reached as accepting, encoding the index number of this word in the keyword set so far. */ if (!trie->accepting) { size_t words = kwset->words; trie->accepting = 2 * words + 1; } ++kwset->words; /* Keep track of the longest and shortest string of the keyword set. */ if (trie->depth < kwset->mind) kwset->mind = trie->depth; if (trie->depth > kwset->maxd) kwset->maxd = trie->depth; } ptrdiff_t kwswords (kwset_t kwset) { return kwset->words; } /* Enqueue the trie nodes referenced from the given tree in the given queue. */ static void enqueue (struct tree *tree, struct trie **last) { if (!tree) return; enqueue (tree->llink, last); enqueue (tree->rlink, last); (*last) = (*last)->next = tree->trie; } /* Compute the Aho-Corasick failure function for the trie nodes referenced from the given tree, given the failure function for their parent as well as a last resort failure node. */ static void treefails (struct tree const *tree, struct trie const *fail, struct trie *recourse, bool reverse) { struct tree *cur; if (!tree) return; treefails (tree->llink, fail, recourse, reverse); treefails (tree->rlink, fail, recourse, reverse); /* Find, in the chain of fails going back to the root, the first node that has a descendant on the current label. */ while (fail) { cur = fail->links; while (cur && tree->label != cur->label) if (tree->label < cur->label) cur = cur->llink; else cur = cur->rlink; if (cur) { tree->trie->fail = cur->trie; if (!reverse && cur->trie->accepting && !tree->trie->accepting) tree->trie->accepting = SIZE_MAX; return; } fail = fail->fail; } tree->trie->fail = recourse; } /* Set delta entries for the links of the given tree such that the preexisting delta value is larger than the current depth. */ static void treedelta (struct tree const *tree, ptrdiff_t depth, unsigned char delta[]) { if (!tree) return; treedelta (tree->llink, depth, delta); treedelta (tree->rlink, depth, delta); if (depth < delta[tree->label]) delta[tree->label] = depth; } /* Return true if A has every label in B. */ static bool _GL_ATTRIBUTE_PURE hasevery (struct tree const *a, struct tree const *b) { if (!b) return true; if (!hasevery (a, b->llink)) return false; if (!hasevery (a, b->rlink)) return false; while (a && b->label != a->label) if (b->label < a->label) a = a->llink; else a = a->rlink; return !!a; } /* Compute a vector, indexed by character code, of the trie nodes referenced from the given tree. */ static void treenext (struct tree const *tree, struct trie *next[]) { if (!tree) return; treenext (tree->llink, next); treenext (tree->rlink, next); next[tree->label] = tree->trie; } /* Prepare a built keyword set for use. */ void kwsprep (kwset_t kwset) { char const *trans = kwset->trans; ptrdiff_t i; unsigned char deltabuf[NCHAR]; unsigned char *delta = trans ? deltabuf : kwset->delta; struct trie *curr, *last; /* Use Boyer-Moore if just one pattern, Aho-Corasick otherwise. */ bool reverse = kwset->words == 1; if (reverse) { kwset_t new_kwset; /* Enqueue the immediate descendants in the level order queue. */ for (curr = last = kwset->trie; curr; curr = curr->next) enqueue (curr->links, &last); /* Looking for just one string. Extract it from the trie. */ kwset->target = obstack_alloc (&kwset->obstack, kwset->mind); for (i = 0, curr = kwset->trie; i < kwset->mind; ++i) { kwset->target[i] = curr->links->label; curr = curr->next; } new_kwset = kwsalloc (kwset->trans); new_kwset->kwsexec = bmexec; kwsincr (new_kwset, kwset->target, kwset->mind); obstack_free (&kwset->obstack, NULL); *kwset = *new_kwset; free (new_kwset); } /* Initial values for the delta table; will be changed later. The delta entry for a given character is the smallest depth of any node at which an outgoing edge is labeled by that character. */ memset (delta, MIN (kwset->mind, UCHAR_MAX), sizeof deltabuf); /* Traverse the nodes of the trie in level order, simultaneously computing the delta table, failure function, and shift function. */ for (curr = last = kwset->trie; curr; curr = curr->next) { /* Enqueue the immediate descendants in the level order queue. */ enqueue (curr->links, &last); /* Update the delta table for the descendants of this node. */ treedelta (curr->links, curr->depth, delta); /* Compute the failure function for the descendants of this node. */ treefails (curr->links, curr->fail, kwset->trie, reverse); if (reverse) { curr->shift = kwset->mind; curr->maxshift = kwset->mind; /* Update the shifts at each node in the current node's chain of fails back to the root. */ struct trie *fail; for (fail = curr->fail; fail; fail = fail->fail) { /* If the current node has some outgoing edge that the fail doesn't, then the shift at the fail should be no larger than the difference of their depths. */ if (!hasevery (fail->links, curr->links)) if (curr->depth - fail->depth < fail->shift) fail->shift = curr->depth - fail->depth; /* If the current node is accepting then the shift at the fail and its descendants should be no larger than the difference of their depths. */ if (curr->accepting && fail->maxshift > curr->depth - fail->depth) fail->maxshift = curr->depth - fail->depth; } } } if (reverse) { /* Traverse the trie in level order again, fixing up all nodes whose shift exceeds their inherited maxshift. */ for (curr = kwset->trie->next; curr; curr = curr->next) { if (curr->maxshift > curr->parent->maxshift) curr->maxshift = curr->parent->maxshift; if (curr->shift > curr->maxshift) curr->shift = curr->maxshift; } } /* Create a vector, indexed by character code, of the outgoing links from the root node. Accumulate GC1 and GC1HELP. */ struct trie *nextbuf[NCHAR]; struct trie **next = trans ? nextbuf : kwset->next; memset (next, 0, sizeof nextbuf); treenext (kwset->trie->links, next); int gc1 = -2; int gc1help = -1; for (i = 0; i < NCHAR; i++) { int ti = i; if (trans) { ti = U(trans[i]); kwset->next[i] = next[ti]; } if (kwset->next[i]) { if (gc1 < -1) { gc1 = ti; gc1help = i; } else if (gc1 == ti) gc1help = gc1help == ti ? i : -1; else if (i == ti && gc1 == gc1help) gc1help = i; else gc1 = -1; } } kwset->gc1 = gc1; kwset->gc1help = gc1help; if (reverse) { /* Looking for just one string. Extract it from the trie. */ kwset->target = obstack_alloc (&kwset->obstack, kwset->mind); for (i = kwset->mind - 1, curr = kwset->trie; i >= 0; --i) { kwset->target[i] = curr->links->label; curr = curr->next; } if (kwset->mind > 1) { /* Looking for the delta2 shift that might be made after a backwards match has failed. Extract it from the trie. */ kwset->shift = obstack_alloc (&kwset->obstack, sizeof *kwset->shift * (kwset->mind - 1)); for (i = 0, curr = kwset->trie->next; i < kwset->mind - 1; ++i) { kwset->shift[i] = curr->shift; curr = curr->next; } /* The penultimate byte. */ kwset->gc2 = tr (trans, kwset->target[kwset->mind - 2]); } } /* Fix things up for any translation table. */ if (trans) for (i = 0; i < NCHAR; ++i) kwset->delta[i] = delta[U(trans[i])]; } /* Delta2 portion of a Boyer-Moore search. *TP is the string text pointer; it is updated in place. EP is the end of the string text, and SP the end of the pattern. LEN is the pattern length; it must be at least 2. TRANS, if nonnull, is the input translation table. GC1 and GC2 are the last and second-from last bytes of the pattern, transliterated by TRANS; the caller precomputes them for efficiency. If D1 is nonnull, it is a delta1 table for shifting *TP when failing. KWSET->shift says how much to shift. */ static inline bool bm_delta2_search (char const **tpp, char const *ep, char const *sp, ptrdiff_t len, char const *trans, char gc1, char gc2, unsigned char const *d1, kwset_t kwset) { char const *tp = *tpp; ptrdiff_t d = len, skip = 0; while (true) { ptrdiff_t i = 2; if (tr (trans, tp[-2]) == gc2) { while (++i <= d) if (tr (trans, tp[-i]) != tr (trans, sp[-i])) break; if (i > d) { for (i = d + skip + 1; i <= len; ++i) if (tr (trans, tp[-i]) != tr (trans, sp[-i])) break; if (i > len) { *tpp = tp - len; return true; } } } tp += d = kwset->shift[i - 2]; if (tp > ep) break; if (tr (trans, tp[-1]) != gc1) { if (d1) tp += d1[U(tp[-1])]; break; } skip = i - 1; } *tpp = tp; return false; } /* Return the address of the first byte in the buffer S (of size N) that matches the terminal byte specified by KWSET, or NULL if there is no match. KWSET->gc1 should be nonnegative. */ static char const * memchr_kwset (char const *s, ptrdiff_t n, kwset_t kwset) { char const *slim = s + n; if (kwset->gc1help < 0) { for (; s < slim; s++) if (kwset->next[U(*s)]) return s; } else { int small_heuristic = 2; size_t small_bytes = small_heuristic * sizeof (unsigned long int); while (s < slim) { if (kwset->next[U(*s)]) return s; s++; if ((uintptr_t) s % small_bytes == 0) return memchr2 (s, kwset->gc1, kwset->gc1help, slim - s); } } return NULL; } /* Fast Boyer-Moore search (inlinable version). */ static inline ptrdiff_t _GL_ATTRIBUTE_PURE bmexec_trans (kwset_t kwset, char const *text, ptrdiff_t size) { assume (0 <= size); unsigned char const *d1; char const *ep, *sp, *tp; int d; ptrdiff_t len = kwset->mind; char const *trans = kwset->trans; if (len == 0) return 0; if (len > size) return -1; if (len == 1) { tp = memchr_kwset (text, size, kwset); return tp ? tp - text : -1; } d1 = kwset->delta; sp = kwset->target + len; tp = text + len; char gc1 = kwset->gc1; char gc2 = kwset->gc2; /* Significance of 12: 1 (initial offset) + 10 (skip loop) + 1 (md2). */ ptrdiff_t len12; if (!INT_MULTIPLY_WRAPV (len, 12, &len12) && len12 < size) /* 11 is not a bug, the initial offset happens only once. */ for (ep = text + size - 11 * len; tp <= ep; ) { char const *tp0 = tp; d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; if (d != 0) { d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; if (d != 0) { d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; if (d != 0) { d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; /* As a heuristic, prefer memchr to seeking by delta1 when the latter doesn't advance much. */ int advance_heuristic = 16 * sizeof (long); if (advance_heuristic <= tp - tp0) continue; tp--; tp = memchr_kwset (tp, text + size - tp, kwset); if (! tp) return -1; tp++; if (ep <= tp) break; } } } if (bm_delta2_search (&tp, ep, sp, len, trans, gc1, gc2, d1, kwset)) return tp - text; } /* Now only a few characters are left to search. Carefully avoid ever producing an out-of-bounds pointer. */ ep = text + size; d = d1[U(tp[-1])]; while (d <= ep - tp) { d = d1[U((tp += d)[-1])]; if (d != 0) continue; if (bm_delta2_search (&tp, ep, sp, len, trans, gc1, gc2, NULL, kwset)) return tp - text; } return -1; } /* Fast Boyer-Moore search. */ static ptrdiff_t bmexec (kwset_t kwset, char const *text, ptrdiff_t size, struct kwsmatch *kwsmatch, bool longest) { /* Help the compiler inline in two ways, depending on whether kwset->trans is null. */ ptrdiff_t ret = (IGNORE_DUPLICATE_BRANCH_WARNING (kwset->trans ? bmexec_trans (kwset, text, size) : bmexec_trans (kwset, text, size))); kwsmatch->index = 0; kwsmatch->offset = ret; kwsmatch->size = kwset->mind; return ret; } /* Hairy multiple string search with the Aho-Corasick algorithm. (inlinable version) */ static inline ptrdiff_t acexec_trans (kwset_t kwset, char const *text, ptrdiff_t len, struct kwsmatch *kwsmatch, bool longest) { struct trie const *trie, *accept; char const *tp, *left, *lim; struct tree const *tree; char const *trans; /* Initialize register copies and look for easy ways out. */ if (len < kwset->mind) return -1; trans = kwset->trans; trie = kwset->trie; lim = text + len; tp = text; if (!trie->accepting) { unsigned char c; int gc1 = kwset->gc1; while (true) { if (gc1 < 0) { while (! (trie = kwset->next[c = tr (trans, *tp++)])) if (tp >= lim) return -1; } else { tp = memchr_kwset (tp, lim - tp, kwset); if (!tp) return -1; c = tr (trans, *tp++); trie = kwset->next[c]; } while (true) { if (trie->accepting) goto match; if (tp >= lim) return -1; c = tr (trans, *tp++); for (tree = trie->links; c != tree->label; ) { tree = c < tree->label ? tree->llink : tree->rlink; if (! tree) { trie = trie->fail; if (!trie) { trie = kwset->next[c]; if (trie) goto have_trie; if (tp >= lim) return -1; goto next_c; } if (trie->accepting) { --tp; goto match; } tree = trie->links; } } trie = tree->trie; have_trie:; } next_c:; } } match: accept = trie; while (accept->accepting == SIZE_MAX) accept = accept->fail; left = tp - accept->depth; /* Try left-most longest match. */ if (longest) { while (tp < lim) { struct trie const *accept1; char const *left1; unsigned char c = tr (trans, *tp++); do { tree = trie->links; while (tree && c != tree->label) tree = c < tree->label ? tree->llink : tree->rlink; } while (!tree && (trie = trie->fail) && accept->depth <= trie->depth); if (!tree) break; trie = tree->trie; if (trie->accepting) { accept1 = trie; while (accept1->accepting == SIZE_MAX) accept1 = accept1->fail; left1 = tp - accept1->depth; if (left1 <= left) { left = left1; accept = accept1; } } } } kwsmatch->index = accept->accepting / 2; kwsmatch->offset = left - text; kwsmatch->size = accept->depth; return left - text; } /* Hairy multiple string search with Aho-Corasick algorithm. */ static ptrdiff_t acexec (kwset_t kwset, char const *text, ptrdiff_t size, struct kwsmatch *kwsmatch, bool longest) { assume (0 <= size); /* Help the compiler inline in two ways, depending on whether kwset->trans is null. */ return (IGNORE_DUPLICATE_BRANCH_WARNING (kwset->trans ? acexec_trans (kwset, text, size, kwsmatch, longest) : acexec_trans (kwset, text, size, kwsmatch, longest))); } /* Find the first instance of a KWSET member in TEXT, which has SIZE bytes. Return the offset (into TEXT) of the first byte of the matching substring, or -1 if no match is found. Upon a match, store details in *KWSMATCH: index of matched keyword, start offset (same as the return value), and length. If LONGEST, find the longest match; otherwise any match will do. */ ptrdiff_t kwsexec (kwset_t kwset, char const *text, ptrdiff_t size, struct kwsmatch *kwsmatch, bool longest) { return kwset->kwsexec (kwset, text, size, kwsmatch, longest); } /* Free the components of the given keyword set. */ void kwsfree (kwset_t kwset) { obstack_free (&kwset->obstack, NULL); free (kwset); } kbuild-3608/src/grep/src/kwset.h0000664000175000017500000000276614670377426016562 0ustar locutuslocutus/* kwset.h - header declaring the keyword set library. Copyright (C) 1989, 1998, 2005, 2007, 2009-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written August 1989 by Mike Haertel. */ #include #include struct kwsmatch { ptrdiff_t index; /* Index number of matching keyword. */ ptrdiff_t offset; /* Offset of match. */ ptrdiff_t size; /* Length of match. */ }; #include "arg-nonnull.h" struct kwset; typedef struct kwset *kwset_t; extern kwset_t kwsalloc (char const *); extern void kwsincr (kwset_t, char const *, ptrdiff_t); extern ptrdiff_t kwswords (kwset_t) _GL_ATTRIBUTE_PURE; extern void kwsprep (kwset_t); extern ptrdiff_t kwsexec (kwset_t, char const *, ptrdiff_t, struct kwsmatch *, bool) _GL_ARG_NONNULL ((4)); extern void kwsfree (kwset_t); kbuild-3608/src/grep/src/system.h0000664000175000017500000000763614670377426016752 0ustar locutuslocutus/* Portability cruft. Include after config.h and sys/types.h. Copyright 1996, 1998-2000, 2007, 2009-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef GREP_SYSTEM_H #define GREP_SYSTEM_H 1 #include #include #include #include "configmake.h" #include "dirname.h" #include "ignore-value.h" #include "minmax.h" #include "same-inode.h" #include #include #include #include #include enum { EXIT_TROUBLE = 2 }; enum { NCHAR = UCHAR_MAX + 1 }; #include #define N_(String) gettext_noop(String) #define _(String) gettext(String) #include #ifndef initialize_main # define initialize_main(argcp, argvp) #endif #include "unlocked-io.h" _GL_INLINE_HEADER_BEGIN #ifndef SYSTEM_INLINE # define SYSTEM_INLINE _GL_INLINE #endif #define STREQ(a, b) (strcmp (a, b) == 0) /* Convert a possibly-signed character to an unsigned character. This is a bit safer than casting to unsigned char, since it catches some type errors that the cast doesn't. */ SYSTEM_INLINE unsigned char to_uchar (char ch) { return ch; } _GL_INLINE_HEADER_END #ifndef __has_feature # define __has_feature(F) false #endif #if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer) # define HAVE_ASAN 1 #else # define HAVE_ASAN 0 #endif #if HAVE_ASAN /* Mark memory region [addr, addr+size) as unaddressable. This memory must be previously allocated by the user program. Accessing addresses in this region from instrumented code is forbidden until this region is unpoisoned. This function is not guaranteed to poison the whole region - it may poison only a subregion of [addr, addr+size) due to ASan alignment restrictions. Method is NOT thread-safe in the sense that no two threads can (un)poison memory in the same memory region simultaneously. */ void __asan_poison_memory_region (void const volatile *addr, size_t size); /* Mark memory region [addr, addr+size) as addressable. This memory must be previously allocated by the user program. Accessing addresses in this region is allowed until this region is poisoned again. This function may unpoison a superregion of [addr, addr+size) due to ASan alignment restrictions. Method is NOT thread-safe in the sense that no two threads can (un)poison memory in the same memory region simultaneously. */ void __asan_unpoison_memory_region (void const volatile *addr, size_t size); #else static _GL_UNUSED void __asan_poison_memory_region (void const volatile *addr, size_t size) { } static _GL_UNUSED void __asan_unpoison_memory_region (void const volatile *addr, size_t size) { } #endif #ifndef FALLTHROUGH # if __GNUC__ < 7 # define FALLTHROUGH ((void) 0) # else # define FALLTHROUGH __attribute__ ((__fallthrough__)) # endif #endif /* When we deliberately use duplicate branches, use this macro to disable gcc's -Wduplicated-branches in the containing expression. */ #if 7 <= __GNUC__ # define IGNORE_DUPLICATE_BRANCH_WARNING(exp) \ ({ \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wduplicated-branches\"") \ exp; \ _Pragma ("GCC diagnostic pop") \ }) #else # define IGNORE_DUPLICATE_BRANCH_WARNING(exp) exp #endif #endif kbuild-3608/src/grep/src/kwsearch.c0000664000175000017500000001667414670377426017232 0ustar locutuslocutus/* kwsearch.c - searching subroutines using kwset for grep. Copyright 1992, 1998, 2000, 2007, 2009-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written August 1992 by Mike Haertel. */ #include #include "search.h" /* A compiled -F pattern list. */ struct kwsearch { /* The kwset for this pattern list. */ kwset_t kwset; /* The number of user-specified patterns. This is less than 'kwswords (kwset)' when some extra one-character words have been appended, one for each troublesome character that will require a DFA search. */ ptrdiff_t words; /* The user's pattern and its size in bytes. */ char *pattern; size_t size; /* The user's pattern compiled as a regular expression, or null if it has not been compiled. */ void *re; }; /* Compile the -F style PATTERN, containing SIZE bytes that are followed by '\n'. Return a description of the compiled pattern. */ void * Fcompile (char *pattern, size_t size, reg_syntax_t ignored, bool exact) { kwset_t kwset; char *buf = NULL; size_t bufalloc = 0; kwset = kwsinit (true); char const *p = pattern; do { char const *sep = rawmemchr (p, '\n'); ptrdiff_t len = sep - p; if (match_lines) { if (eolbyte == '\n' && pattern < p) p--; else { if (bufalloc < len + 2) { free (buf); bufalloc = len + 2; buf = x2realloc (NULL, &bufalloc); buf[0] = eolbyte; } memcpy (buf + 1, p, len); buf[len + 1] = eolbyte; p = buf; } len += 2; } kwsincr (kwset, p, len); p = sep + 1; } while (p <= pattern + size); free (buf); ptrdiff_t words = kwswords (kwset); kwsprep (kwset); struct kwsearch *kwsearch = xmalloc (sizeof *kwsearch); kwsearch->kwset = kwset; kwsearch->words = words; kwsearch->pattern = pattern; kwsearch->size = size; kwsearch->re = NULL; return kwsearch; } /* Use the compiled pattern VCP to search the buffer BUF of size SIZE. If found, return the offset of the first match and store its size into *MATCH_SIZE. If not found, return SIZE_MAX. If START_PTR is nonnull, start searching there. */ size_t Fexecute (void *vcp, char const *buf, size_t size, size_t *match_size, char const *start_ptr) { char const *beg, *end, *mb_start; ptrdiff_t len; char eol = eolbyte; struct kwsearch *kwsearch = vcp; kwset_t kwset = kwsearch->kwset; bool mb_check = localeinfo.multibyte & !localeinfo.using_utf8 & !match_lines; bool longest = (mb_check | !!start_ptr | match_words) & !match_lines; for (mb_start = beg = start_ptr ? start_ptr : buf; beg <= buf + size; beg++) { struct kwsmatch kwsmatch; ptrdiff_t offset = kwsexec (kwset, beg - match_lines, buf + size - beg + match_lines, &kwsmatch, longest); if (offset < 0) break; len = kwsmatch.size - 2 * match_lines; size_t mbclen = 0; if (mb_check && mb_goback (&mb_start, &mbclen, beg + offset, buf + size) != 0) { /* We have matched a single byte that is not at the beginning of a multibyte character. mb_goback has advanced MB_START past that multibyte character. Now, we want to position BEG so that the next kwsexec search starts there. Thus, to compensate for the for-loop's BEG++, above, subtract one here. This code is unusually hard to reach, and exceptionally, let's show how to trigger it here: printf '\203AA\n'|LC_ALL=ja_JP.SHIFT_JIS src/grep -F A That assumes the named locale is installed. Note that your system's shift-JIS locale may have a different name, possibly including "sjis". */ beg = mb_start - 1; continue; } beg += offset; if (!!start_ptr & !match_words) goto success_in_beg_and_len; if (match_lines) { len += start_ptr == NULL; goto success_in_beg_and_len; } if (! match_words) goto success; /* We need a preceding mb_start pointer. Use the beginning of line if there is a preceding newline. */ if (mbclen == 0) { char const *nl = memrchr (mb_start, eol, beg - mb_start); if (nl) mb_start = nl + 1; } /* Succeed if neither the preceding nor the following character is a word constituent. If the preceding is not, yet the following character IS a word constituent, keep trying with shorter matches. */ if (mbclen > 0 ? ! wordchar_next (beg - mbclen, buf + size) : ! wordchar_prev (mb_start, beg, buf + size)) for (;;) { if (! wordchar_next (beg + len, buf + size)) { if (start_ptr) goto success_in_beg_and_len; else goto success; } if (!start_ptr && !localeinfo.multibyte) { if (! kwsearch->re) { fgrep_to_grep_pattern (&kwsearch->pattern, &kwsearch->size); kwsearch->re = GEAcompile (kwsearch->pattern, kwsearch->size, RE_SYNTAX_GREP, !!start_ptr); } if (beg + len < buf + size) { end = rawmemchr (beg + len, eol); end++; } else end = buf + size; if (EGexecute (kwsearch->re, beg, end - beg, match_size, NULL) != (size_t) -1) goto success_match_words; beg = end - 1; break; } if (!len) break; struct kwsmatch shorter_match; if (kwsexec (kwset, beg, --len, &shorter_match, true) != 0) break; len = shorter_match.size; } /* No word match was found at BEG. Skip past word constituents, since they cannot precede the next match and not skipping them could make things much slower. */ beg += wordchars_size (beg, buf + size); mb_start = beg; } return -1; success: if (beg + len < buf + size) { end = rawmemchr (beg + len, eol); end++; } else end = buf + size; success_match_words: beg = memrchr (buf, eol, beg - buf); beg = beg ? beg + 1 : buf; len = end - beg; success_in_beg_and_len:; *match_size = len; return beg - buf; } kbuild-3608/src/grep/src/searchutils.c0000664000175000017500000001265114670377427017741 0ustar locutuslocutus/* searchutils.c - helper subroutines for grep's matchers. Copyright 1992, 1998, 2000, 2007, 2009-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include #define SEARCH_INLINE _GL_EXTERN_INLINE #define SYSTEM_INLINE _GL_EXTERN_INLINE #include "search.h" /* For each byte B, sbwordchar[B] is true if B is a single-byte character that is a word constituent, and is false otherwise. */ static bool sbwordchar[NCHAR]; /* Whether -w considers WC to be a word constituent. */ static bool wordchar (wint_t wc) { return wc == L'_' || iswalnum (wc); } void wordinit (void) { for (int i = 0; i < NCHAR; i++) sbwordchar[i] = wordchar (localeinfo.sbctowc[i]); } kwset_t kwsinit (bool mb_trans) { char *trans = NULL; if (match_icase && (MB_CUR_MAX == 1 || mb_trans)) { trans = xmalloc (NCHAR); /* If I is a single-byte character that becomes a different single-byte character when uppercased, set trans[I] to that character. Otherwise, set trans[I] to I. */ for (int i = 0; i < NCHAR; i++) trans[i] = toupper (i); } return kwsalloc (trans); } /* In the buffer *MB_START, return the number of bytes needed to go back from CUR to the previous boundary, where a "boundary" is the start of a multibyte character or is an error-encoding byte. The buffer ends at END (i.e., one past the address of the buffer's last byte). If CUR is already at a boundary, return 0. If CUR is no larger than *MB_START, return CUR - *MB_START without modifying *MB_START or *MBCLEN. When returning zero, set *MB_START to CUR. When returning a positive value, set *MB_START to the next boundary after CUR, or to END if there is no such boundary, and set *MBCLEN to the length of the preceding character. */ ptrdiff_t mb_goback (char const **mb_start, size_t *mbclen, char const *cur, char const *end) { const char *p = *mb_start; const char *p0 = p; size_t clen; if (cur <= p) return cur - p; if (localeinfo.using_utf8) { p = cur; clen = 1; if (cur < end && (*cur & 0xc0) == 0x80) for (int i = 1; i <= 3; i++) if ((cur[-i] & 0xc0) != 0x80) { mbstate_t mbs = { 0 }; clen = mb_clen (cur - i, end - (cur - i), &mbs); if (i < clen && clen < (size_t) -2) { p0 = cur - i; p = p0 + clen; } break; } } else { mbstate_t mbs = { 0 }; do { clen = mb_clen (p, end - p, &mbs); if ((size_t) -2 <= clen) { /* An invalid sequence, or a truncated multibyte character. Treat it as a single byte character. */ clen = 1; memset (&mbs, 0, sizeof mbs); } p0 = p; p += clen; } while (p < cur); } *mb_start = p; if (mbclen) *mbclen = clen; return p == cur ? 0 : cur - p0; } /* Examine the start of BUF (which goes to END) for word constituents. If COUNTALL, examine as many as possible; otherwise, examine at most one. Return the total number of bytes in the examined characters. */ static size_t wordchars_count (char const *buf, char const *end, bool countall) { size_t n = 0; mbstate_t mbs = { 0 }; while (n < end - buf) { unsigned char b = buf[n]; if (sbwordchar[b]) n++; else if (localeinfo.sbclen[b] != -2) break; else { wchar_t wc = 0; size_t wcbytes = mbrtowc (&wc, buf + n, end - buf - n, &mbs); if (!wordchar (wc)) break; n += wcbytes + !wcbytes; } if (!countall) break; } return n; } /* Examine the start of BUF for the longest prefix containing just word constituents. Return the total number of bytes in the prefix. The buffer ends at END. */ size_t wordchars_size (char const *buf, char const *end) { return wordchars_count (buf, end, true); } /* If BUF starts with a word constituent, return the number of bytes used to represent it; otherwise, return zero. The buffer ends at END. */ size_t wordchar_next (char const *buf, char const *end) { return wordchars_count (buf, end, false); } /* In the buffer BUF, return nonzero if the character whose encoding contains the byte before CUR is a word constituent. The buffer ends at END. */ size_t wordchar_prev (char const *buf, char const *cur, char const *end) { if (buf == cur) return 0; unsigned char b = *--cur; if (! localeinfo.multibyte || (localeinfo.using_utf8 && localeinfo.sbclen[b] == 1)) return sbwordchar[b]; char const *p = buf; cur -= mb_goback (&p, NULL, cur, end); return wordchar_next (cur, end); } kbuild-3608/src/grep/src/die.h0000664000175000017500000000216514670377427016160 0ustar locutuslocutus/* Report an error and exit. Copyright 2016-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DIE_H #define DIE_H #include #include #include /* Like 'error (STATUS, ...)', except STATUS must be a nonzero constant. This may pacify the compiler or help it generate better code. */ #define die(status, ...) \ verify_expr (status, (error (status, __VA_ARGS__), assume (false))) #endif /* DIE_H */ kbuild-3608/src/grep/src/dfasearch.c0000664000175000017500000004614714670377426017341 0ustar locutuslocutus/* dfasearch.c - searching subroutines using dfa and regex for grep. Copyright 1992, 1998, 2000, 2007, 2009-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written August 1992 by Mike Haertel. */ #include #include "intprops.h" #include "search.h" #include "die.h" #include struct dfa_comp { /* KWset compiled pattern. For GEAcompile, we compile a list of strings, at least one of which is known to occur in any string matching the regexp. */ kwset_t kwset; /* DFA compiled regexp. */ struct dfa *dfa; /* Regex compiled regexps. */ struct re_pattern_buffer *patterns; size_t pcount; struct re_registers regs; /* Number of compiled fixed strings known to exactly match the regexp. If kwsexec returns < kwset_exact_matches, then we don't need to call the regexp matcher at all. */ ptrdiff_t kwset_exact_matches; bool begline; }; void dfaerror (char const *mesg) { die (EXIT_TROUBLE, 0, "%s", mesg); } /* For now, the sole dfawarn-eliciting condition (use of a regexp like '[:lower:]') is unequivocally an error, so treat it as such, when possible. */ void dfawarn (char const *mesg) { if (!getenv ("POSIXLY_CORRECT")) dfaerror (mesg); } /* If the DFA turns out to have some set of fixed strings one of which must occur in the match, then we build a kwset matcher to find those strings, and thus quickly filter out impossible matches. */ static void kwsmusts (struct dfa_comp *dc) { struct dfamust *dm = dfamust (dc->dfa); if (!dm) return; dc->kwset = kwsinit (false); if (dm->exact) { /* Prepare a substring whose presence implies a match. The kwset matcher will return the index of the matching string that it chooses. */ ++dc->kwset_exact_matches; ptrdiff_t old_len = strlen (dm->must); ptrdiff_t new_len = old_len + dm->begline + dm->endline; char *must = xmalloc (new_len); char *mp = must; *mp = eolbyte; mp += dm->begline; dc->begline |= dm->begline; memcpy (mp, dm->must, old_len); if (dm->endline) mp[old_len] = eolbyte; kwsincr (dc->kwset, must, new_len); free (must); } else { /* Otherwise, filtering with this substring should help reduce the search space, but we'll still have to use the regexp matcher. */ kwsincr (dc->kwset, dm->must, strlen (dm->must)); } kwsprep (dc->kwset); dfamustfree (dm); } /* Return true if KEYS, of length LEN, might contain a back-reference. Return false if KEYS cannot contain a back-reference. BS_SAFE is true of encodings where a backslash cannot appear as the last byte of a multibyte character. */ static bool _GL_ATTRIBUTE_PURE possible_backrefs_in_pattern (char const *keys, ptrdiff_t len, bool bs_safe) { /* Normally a backslash, but in an unsafe encoding this is a non-char value so that the comparison below always fails, because if there are two adjacent '\' bytes, the first might be the last byte of a multibyte character. */ int second_backslash = bs_safe ? '\\' : CHAR_MAX + 1; /* This code can return true even if KEYS lacks a back-reference, for patterns like [\2], or for encodings where '\' appears as the last byte of a multibyte character. However, false alarms should be rare and do not affect correctness. */ /* Do not look for a backslash in the pattern's last byte, since it can't be part of a back-reference and this streamlines the code. */ len--; if (0 <= len) { char const *lim = keys + len; for (char const *p = keys; (p = memchr (p, '\\', lim - p)); p++) { if ('1' <= p[1] && p[1] <= '9') return true; if (p[1] == second_backslash) { p++; if (p == lim) break; } } } return false; } static bool regex_compile (struct dfa_comp *dc, char const *p, ptrdiff_t len, ptrdiff_t pcount, ptrdiff_t lineno, reg_syntax_t syntax_bits, bool syntax_only) { struct re_pattern_buffer pat0; struct re_pattern_buffer *pat = syntax_only ? &pat0 : &dc->patterns[pcount]; pat->buffer = NULL; pat->allocated = 0; /* Do not use a fastmap with -i, to work around glibc Bug#20381. */ pat->fastmap = (syntax_only | match_icase) ? NULL : xmalloc (UCHAR_MAX + 1); pat->translate = NULL; if (syntax_only) re_set_syntax (syntax_bits | RE_NO_SUB); else re_set_syntax (syntax_bits); char const *err = re_compile_pattern (p, len, pat); if (!err) return true; /* Emit a filename:lineno: prefix for patterns taken from files. */ size_t pat_lineno; char const *pat_filename = lineno < 0 ? "" : pattern_file_name (lineno, &pat_lineno); if (*pat_filename == '\0') error (0, 0, "%s", err); else error (0, 0, "%s:%zu: %s", pat_filename, pat_lineno, err); return false; } /* Compile PATTERN, containing SIZE bytes that are followed by '\n'. SYNTAX_BITS specifies whether PATTERN uses style -G, -E, or -A. Return a description of the compiled pattern. */ void * GEAcompile (char *pattern, size_t size, reg_syntax_t syntax_bits, bool exact) { char *motif; struct dfa_comp *dc = xcalloc (1, sizeof (*dc)); dc->dfa = dfaalloc (); if (match_icase) syntax_bits |= RE_ICASE; int dfaopts = eolbyte ? 0 : DFA_EOL_NUL; dfasyntax (dc->dfa, &localeinfo, syntax_bits, dfaopts); bool bs_safe = !localeinfo.multibyte | localeinfo.using_utf8; /* For GNU regex, pass the patterns separately to detect errors like "[\nallo\n]\n", where the patterns are "[", "allo" and "]", and this should be a syntax error. The same for backref, where the backref should be local to each pattern. */ char const *p = pattern; char const *patlim = pattern + size; bool compilation_failed = false; dc->patterns = xmalloc (sizeof *dc->patterns); dc->patterns++; dc->pcount = 0; size_t palloc = 1; char const *prev = pattern; /* Buffer containing back-reference-free patterns. */ char *buf = NULL; ptrdiff_t buflen = 0; size_t bufalloc = 0; ptrdiff_t lineno = 0; do { char const *sep = rawmemchr (p, '\n'); ptrdiff_t len = sep - p; bool backref = possible_backrefs_in_pattern (p, len, bs_safe); if (backref && prev < p) { ptrdiff_t prevlen = p - prev; while (bufalloc < buflen + prevlen) buf = x2realloc (buf, &bufalloc); memcpy (buf + buflen, prev, prevlen); buflen += prevlen; } /* Ensure room for at least two more patterns. The extra one is for the regex_compile that may be executed after this loop exits, and its (unused) slot is patterns[-1] until then. */ while (palloc <= dc->pcount + 1) { dc->patterns = x2nrealloc (dc->patterns - 1, &palloc, sizeof *dc->patterns); dc->patterns++; } re_set_syntax (syntax_bits); if (!regex_compile (dc, p, len, dc->pcount, lineno, syntax_bits, !backref)) compilation_failed = true; p = sep + 1; lineno++; if (backref) { dc->pcount++; prev = p; } } while (p <= patlim); if (compilation_failed) exit (EXIT_TROUBLE); if (prev <= patlim) { if (pattern < prev) { ptrdiff_t prevlen = patlim - prev; buf = xrealloc (buf, buflen + prevlen); memcpy (buf + buflen, prev, prevlen); buflen += prevlen; } else { buf = pattern; buflen = size; } } /* In the match_words and match_lines cases, we use a different pattern for the DFA matcher that will quickly throw out cases that won't work. Then if DFA succeeds we do some hairy stuff using the regex matcher to decide whether the match should really count. */ if (match_words || match_lines) { static char const line_beg_no_bk[] = "^("; static char const line_end_no_bk[] = ")$"; static char const word_beg_no_bk[] = "(^|[^[:alnum:]_])("; static char const word_end_no_bk[] = ")([^[:alnum:]_]|$)"; static char const line_beg_bk[] = "^\\("; static char const line_end_bk[] = "\\)$"; static char const word_beg_bk[] = "\\(^\\|[^[:alnum:]_]\\)\\("; static char const word_end_bk[] = "\\)\\([^[:alnum:]_]\\|$\\)"; int bk = !(syntax_bits & RE_NO_BK_PARENS); char *n = xmalloc (sizeof word_beg_bk - 1 + size + sizeof word_end_bk); strcpy (n, match_lines ? (bk ? line_beg_bk : line_beg_no_bk) : (bk ? word_beg_bk : word_beg_no_bk)); size_t total = strlen (n); memcpy (n + total, pattern, size); total += size; strcpy (n + total, match_lines ? (bk ? line_end_bk : line_end_no_bk) : (bk ? word_end_bk : word_end_no_bk)); total += strlen (n + total); pattern = motif = n; size = total; } else motif = NULL; dfaparse (pattern, size, dc->dfa); kwsmusts (dc); dfacomp (NULL, 0, dc->dfa, 1); if (buf != NULL) { if (exact || !dfasupported (dc->dfa)) { dc->patterns--; dc->pcount++; if (!regex_compile (dc, buf, buflen, 0, -1, syntax_bits, false)) abort (); } if (buf != pattern) free (buf); } free (motif); return dc; } size_t EGexecute (void *vdc, char const *buf, size_t size, size_t *match_size, char const *start_ptr) { char const *buflim, *beg, *end, *ptr, *match, *best_match, *mb_start; char eol = eolbyte; regoff_t start; size_t len, best_len; struct kwsmatch kwsm; size_t i; struct dfa_comp *dc = vdc; struct dfa *superset = dfasuperset (dc->dfa); bool dfafast = dfaisfast (dc->dfa); mb_start = buf; buflim = buf + size; for (beg = end = buf; end < buflim; beg = end) { end = buflim; if (!start_ptr) { char const *next_beg, *dfa_beg = beg; ptrdiff_t count = 0; bool exact_kwset_match = false; bool backref = false; /* Try matching with KWset, if it's defined. */ if (dc->kwset) { char const *prev_beg; /* Find a possible match using the KWset matcher. */ ptrdiff_t offset = kwsexec (dc->kwset, beg - dc->begline, buflim - beg + dc->begline, &kwsm, true); if (offset < 0) return offset; match = beg + offset; prev_beg = beg; /* Narrow down to the line containing the possible match. */ beg = memrchr (buf, eol, match - buf); beg = beg ? beg + 1 : buf; dfa_beg = beg; /* Determine the end pointer to give the DFA next. Typically this is after the first newline after MATCH; but if the KWset match is not exact, the DFA is fast, and the offset from PREV_BEG is less than 64 or (MATCH - PREV_BEG), this is the greater of the latter two values; this temporarily prefers the DFA to KWset. */ exact_kwset_match = kwsm.index < dc->kwset_exact_matches; if (exact_kwset_match || !dfafast || MAX (16, match - beg) < (match - prev_beg) >> 2) { end = rawmemchr (match, eol); end++; } else if (MAX (16, match - beg) < (buflim - prev_beg) >> 2) { end = rawmemchr (prev_beg + 4 * MAX (16, match - beg), eol); end++; } else end = buflim; if (exact_kwset_match) { if (!localeinfo.multibyte | localeinfo.using_utf8) goto success; if (mb_start < beg) mb_start = beg; if (mb_goback (&mb_start, NULL, match, buflim) == 0) goto success; /* The matched line starts in the middle of a multibyte character. Perform the DFA search starting from the beginning of the next character. */ dfa_beg = mb_start; } } /* Try matching with the superset of DFA, if it's defined. */ if (superset && !exact_kwset_match) { /* Keep using the superset while it reports multiline potential matches; this is more likely to be fast than falling back to KWset would be. */ next_beg = dfaexec (superset, dfa_beg, (char *) end, 0, &count, NULL); if (next_beg == NULL || next_beg == end) continue; /* Narrow down to the line we've found. */ if (count != 0) { beg = memrchr (buf, eol, next_beg - buf); beg++; dfa_beg = beg; } end = rawmemchr (next_beg, eol); end++; count = 0; } /* Try matching with DFA. */ next_beg = dfaexec (dc->dfa, dfa_beg, (char *) end, 0, &count, &backref); /* If there's no match, or if we've matched the sentinel, we're done. */ if (next_beg == NULL || next_beg == end) continue; /* Narrow down to the line we've found. */ if (count != 0) { beg = memrchr (buf, eol, next_beg - buf); beg++; } end = rawmemchr (next_beg, eol); end++; /* Successful, no back-references encountered! */ if (!backref) goto success; ptr = beg; } else { /* We are looking for the leftmost (then longest) exact match. We will go through the outer loop only once. */ ptr = start_ptr; } /* If the "line" is longer than the maximum regexp offset, die as if we've run out of memory. */ if (TYPE_MAXIMUM (regoff_t) < end - beg - 1) xalloc_die (); /* Run the possible match through Regex. */ best_match = end; best_len = 0; for (i = 0; i < dc->pcount; i++) { dc->patterns[i].not_eol = 0; dc->patterns[i].newline_anchor = eolbyte == '\n'; start = re_search (&dc->patterns[i], beg, end - beg - 1, ptr - beg, end - ptr - 1, &dc->regs); if (start < -1) xalloc_die (); else if (0 <= start) { len = dc->regs.end[0] - start; match = beg + start; if (match > best_match) continue; if (start_ptr && !match_words) goto assess_pattern_match; if ((!match_lines && !match_words) || (match_lines && len == end - ptr - 1)) { match = ptr; len = end - ptr; goto assess_pattern_match; } /* If -w and not -x, check whether the match aligns with word boundaries. Do this iteratively because: (a) the line may contain more than one occurrence of the pattern, and (b) Several alternatives in the pattern might be valid at a given point, and we may need to consider a shorter one to find a word boundary. */ if (!match_lines && match_words) while (match <= best_match) { regoff_t shorter_len = 0; if (! wordchar_next (match + len, end - 1) && ! wordchar_prev (beg, match, end - 1)) goto assess_pattern_match; if (len > 0) { /* Try a shorter length anchored at the same place. */ --len; dc->patterns[i].not_eol = 1; shorter_len = re_match (&dc->patterns[i], beg, match + len - ptr, match - beg, &dc->regs); if (shorter_len < -1) xalloc_die (); } if (0 < shorter_len) len = shorter_len; else { /* Try looking further on. */ if (match == end - 1) break; match++; dc->patterns[i].not_eol = 0; start = re_search (&dc->patterns[i], beg, end - beg - 1, match - beg, end - match - 1, &dc->regs); if (start < 0) { if (start < -1) xalloc_die (); break; } len = dc->regs.end[0] - start; match = beg + start; } } /* while (match <= best_match) */ continue; assess_pattern_match: if (!start_ptr) { /* Good enough for a non-exact match. No need to look at further patterns, if any. */ goto success; } if (match < best_match || (match == best_match && len > best_len)) { /* Best exact match: leftmost, then longest. */ best_match = match; best_len = len; } } /* if re_search >= 0 */ } /* for Regex patterns. */ if (best_match < end) { /* We have found an exact match. We were just waiting for the best one (leftmost then longest). */ beg = best_match; len = best_len; goto success_in_len; } } /* for (beg = end ..) */ return -1; success: len = end - beg; success_in_len:; size_t off = beg - buf; *match_size = len; return off; } kbuild-3608/src/grep/src/search.h0000664000175000017500000000602114670377426016656 0ustar locutuslocutus/* search.c - searching subroutines using dfa, kwset and regex for grep. Copyright 1992, 1998, 2000, 2007, 2009-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef GREP_SEARCH_H #define GREP_SEARCH_H 1 #include #include #include #include #include #include #include "system.h" #include "grep.h" #include "dfa.h" #include "kwset.h" #include "xalloc.h" #include "localeinfo.h" _GL_INLINE_HEADER_BEGIN #ifndef SEARCH_INLINE # define SEARCH_INLINE _GL_INLINE #endif /* This must be a signed type. Each value is the difference in the size of a character (in bytes) induced by converting to lower case. The vast majority of values are 0, but a few are 1 or -1, so technically, two bits may be sufficient. */ typedef signed char mb_len_map_t; /* searchutils.c */ extern void wordinit (void); extern kwset_t kwsinit (bool); extern size_t wordchars_size (char const *, char const *) _GL_ATTRIBUTE_PURE; extern size_t wordchar_next (char const *, char const *) _GL_ATTRIBUTE_PURE; extern size_t wordchar_prev (char const *, char const *, char const *) _GL_ATTRIBUTE_PURE; extern ptrdiff_t mb_goback (char const **, size_t *, char const *, char const *); /* dfasearch.c */ extern void *GEAcompile (char *, size_t, reg_syntax_t, bool); extern size_t EGexecute (void *, char const *, size_t, size_t *, char const *); /* kwsearch.c */ extern void *Fcompile (char *, size_t, reg_syntax_t, bool); extern size_t Fexecute (void *, char const *, size_t, size_t *, char const *); /* pcresearch.c */ extern void *Pcompile (char *, size_t, reg_syntax_t, bool); extern size_t Pexecute (void *, char const *, size_t, size_t *, char const *); /* grep.c */ extern struct localeinfo localeinfo; extern void fgrep_to_grep_pattern (char **, size_t *); /* Return the number of bytes in the character at the start of S, which is of size N. N must be positive. MBS is the conversion state. This acts like mbrlen, except it returns 1 when mbrlen would return 0, and it is typically faster because of the cache. */ SEARCH_INLINE size_t mb_clen (char const *s, size_t n, mbstate_t *mbs) { size_t len = localeinfo.sbclen[to_uchar (*s)]; return len == (size_t) -2 ? mbrlen (s, n, mbs) : len; } extern char const *input_filename (void); _GL_INLINE_HEADER_END #endif /* GREP_SEARCH_H */ kbuild-3608/src/grep/configure.ac0000664000175000017500000001704414670377430016741 0ustar locutuslocutusdnl dnl autoconf input file for GNU grep dnl dnl Copyright (C) 1997-2006, 2009-2021 Free Software Foundation, Inc. dnl dnl This file is part of GNU grep. dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 3, or (at your option) dnl any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program. If not, see . AC_INIT([GNU grep], m4_esyscmd([build-aux/git-version-gen .tarball-version]), [bug-grep@gnu.org]) if test -n "$GREP" || test -n "$EGREP"; then AC_MSG_ERROR( [no working 'grep' found A working 'grep' command is needed to build GNU Grep. This 'grep' should support -e and long lines. On Solaris 10, install the package SUNWggrp or SUNWxcu4. On Solaris 11, install the package text/gnu-grep or system/xopen/xcu4.]) fi AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_SRCDIR([src/grep.c]) AC_DEFINE([GREP], 1, [We are building grep]) AC_PREREQ([2.64]) AC_CONFIG_MACRO_DIRS([m4]) dnl Automake stuff. AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests subdir-objects]) AM_SILENT_RULES([yes]) # make --enable-silent-rules the default. AC_CONFIG_HEADERS([config.h:config.hin]) dnl Checks for programs. AC_CANONICAL_HOST AC_PROG_AWK AC_PROG_INSTALL AC_PROG_CC gl_EARLY AC_PROG_RANLIB PKG_PROG_PKG_CONFIG([0.9.0]) # grep never invokes mbrtowc or mbrlen on empty input, # so don't worry about this common bug, # as working around it would merely slow grep down. gl_cv_func_mbrtowc_empty_input='assume yes' dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T AC_C_CONST gl_INIT # Ensure VLAs are not used. # Note -Wvla is implicitly added by gl_MANYWARN_ALL_GCC AC_DEFINE([GNULIB_NO_VLA], [1], [Define to 1 to disable use of VLAs]) # The test suite needs to know if we have a working perl. # FIXME: this is suboptimal. Ideally, we would be able to call gl_PERL # with an ACTION-IF-NOT-FOUND argument ... cu_have_perl=yes case $PERL in *"/missing "*) cu_have_perl=no;; esac AM_CONDITIONAL([HAVE_PERL], [test $cu_have_perl = yes]) AC_ARG_ENABLE([gcc-warnings], [AS_HELP_STRING([--enable-gcc-warnings], [turn on lots of GCC warnings (for developers)])], [case $enableval in yes|no) ;; *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; esac gl_gcc_warnings=$enableval], [gl_gcc_warnings=no if test "$GCC" = yes && test -d "$srcdir"/.git; then AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ #if ! (6 < __GNUC__ + (2 <= __GNUC_MINOR__)) #error "--enable-gcc-warnings defaults to 'no' on older GCC" #endif ]])], [gl_gcc_warnings=yes]) fi] ) if test "$gl_gcc_warnings" = yes; then gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) AC_SUBST([WERROR_CFLAGS]) nw= # This, $nw, is the list of warnings we disable. nw="$nw -Wdeclaration-after-statement" # too useful to forbid nw="$nw -Waggregate-return" # anachronistic nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h) nw="$nw -Wc++-compat" # We don't care about C++ compilers nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings nw="$nw -Wpadded" # Our structs are not padded nw="$nw -Wstack-protector" # generates false alarms for useful code nw="$nw -Wswitch-default" # Too many warnings for now nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations nw="$nw -Winline" # streq.h's streq4, streq6 and strcaseeq6 nw="$nw -Wstrict-overflow" # regexec.c gl_MANYWARN_ALL_GCC([ws]) gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw]) for w in $ws; do gl_WARN_ADD([$w]) done gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now gl_WARN_ADD([-Wno-cast-function-type]) # sig-handler.h's sa_handler_t cast # In spite of excluding -Wlogical-op above, it is enabled, as of # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c gl_WARN_ADD([-Wno-logical-op]) AC_SUBST([WARN_CFLAGS]) AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.]) AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks]) AH_VERBATIM([GNULIB_PORTCHECK_FORTIFY_SOURCE], [/* Enable compile-time and run-time bounds-checking, and some warnings, without upsetting glibc 2.15+. */ #if (defined GNULIB_PORTCHECK && !defined _FORTIFY_SOURCE \ && defined __OPTIMIZE__ && __OPTIMIZE__) # define _FORTIFY_SOURCE 2 #endif ]) # We use a slightly smaller set of warning options for lib/. # Remove the following and save the result in GNULIB_WARN_CFLAGS. nw= nw="$nw -Wunused-macros" gl_WARN_ADD([-Wno-format-nonliteral]) gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) AC_SUBST([GNULIB_WARN_CFLAGS]) # For gnulib-tests, the set is slightly smaller still. nw= nw="$nw -Wstrict-prototypes" # It's not worth being this picky about test programs. nw="$nw -Wsuggest-attribute=const" nw="$nw -Wsuggest-attribute=pure" nw="$nw -Wsuggest-attribute=format" nw="$nw -Wformat-truncation=2" # False alarm in strerror_r.c nw="$nw -Wold-style-definition" # Disable to avoid warnings in e.g., test-intprops.c and test-limits-h.c # due to overlong expansions like this: # test-intprops.c:147:5: error: string literal of length 9531 exceeds \ # maximum length 4095 that ISO C99 compilers are required to support nw="$nw -Woverlength-strings" gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS], [$GNULIB_WARN_CFLAGS], [$nw]) gl_WARN_ADD([-Wno-return-type], [GNULIB_TEST_WARN_CFLAGS]) AC_SUBST([GNULIB_TEST_WARN_CFLAGS]) fi # By default, argmatch should fail calling usage (EXIT_FAILURE). AC_DEFINE([ARGMATCH_DIE], [usage (EXIT_FAILURE)], [Define to the function xargmatch calls on failures.]) AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)], [Define to the declaration of the xargmatch failure function.]) dnl Checks for header files. AC_HEADER_DIRENT dnl Checks for functions. AC_FUNC_CLOSEDIR_VOID AC_CHECK_FUNCS_ONCE([isascii setlocale]) dnl I18N feature AM_GNU_GETTEXT_VERSION([0.18.2]) AM_GNU_GETTEXT([external]) dnl Some installers want to be informed if we do not use our regex. dnl For example, if the host platform uses dynamic linking and the installer dnl knows that the grep may be invoked on other hosts with buggy libraries, dnl then the installer should configure --with-included-regex. AM_CONDITIONAL([USE_INCLUDED_REGEX], [test "$ac_use_included_regex" = yes]) if test "$ac_use_included_regex" = no; then AC_MSG_WARN([Included lib/regex.c not used]) fi gl_FUNC_PCRE AM_CONDITIONAL([USE_PCRE], [test $use_pcre = yes]) case $host_os in mingw*) suffix=w32 ;; *) suffix=posix ;; esac COLORIZE_SOURCE=colorize-$suffix.c AC_SUBST([COLORIZE_SOURCE]) AC_CONFIG_FILES([ Makefile lib/Makefile src/Makefile tests/Makefile po/Makefile.in doc/Makefile gnulib-tests/Makefile ]) AC_OUTPUT kbuild-3608/src/grep/aclocal.m40000664000175000017500000013755414670377427016332 0ustar locutuslocutus# generated automatically by aclocal 1.16d -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, [m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16d], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16d])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi AC_SUBST([CTAGS]) if test -z "$ETAGS"; then ETAGS=etags fi AC_SUBST([ETAGS]) if test -z "$CSCOPE"; then CSCOPE=cscope fi AC_SUBST([CSCOPE]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/00gnulib.m4]) m4_include([m4/__inline.m4]) m4_include([m4/absolute-header.m4]) m4_include([m4/alloca.m4]) m4_include([m4/arpa_inet_h.m4]) m4_include([m4/asm-underscore.m4]) m4_include([m4/assert.m4]) m4_include([m4/btowc.m4]) m4_include([m4/builtin-expect.m4]) m4_include([m4/c-stack.m4]) m4_include([m4/calloc.m4]) m4_include([m4/chdir-long.m4]) m4_include([m4/close.m4]) m4_include([m4/closedir.m4]) m4_include([m4/codeset.m4]) m4_include([m4/configmake.m4]) m4_include([m4/ctype_h.m4]) m4_include([m4/cycle-check.m4]) m4_include([m4/d-ino.m4]) m4_include([m4/d-type.m4]) m4_include([m4/dirent_h.m4]) m4_include([m4/dirfd.m4]) m4_include([m4/double-slash-root.m4]) m4_include([m4/dup.m4]) m4_include([m4/dup2.m4]) m4_include([m4/eealloc.m4]) m4_include([m4/environ.m4]) m4_include([m4/errno_h.m4]) m4_include([m4/error.m4]) m4_include([m4/exponentd.m4]) m4_include([m4/extensions.m4]) m4_include([m4/extern-inline.m4]) m4_include([m4/fchdir.m4]) m4_include([m4/fcntl-o.m4]) m4_include([m4/fcntl-safer.m4]) m4_include([m4/fcntl.m4]) m4_include([m4/fcntl_h.m4]) m4_include([m4/fdopen.m4]) m4_include([m4/fdopendir.m4]) m4_include([m4/filenamecat.m4]) m4_include([m4/flexmember.m4]) m4_include([m4/float_h.m4]) m4_include([m4/fnmatch.m4]) m4_include([m4/fnmatch_h.m4]) m4_include([m4/fopen.m4]) m4_include([m4/fpending.m4]) m4_include([m4/fpieee.m4]) m4_include([m4/free.m4]) m4_include([m4/fstat.m4]) m4_include([m4/fstatat.m4]) m4_include([m4/ftruncate.m4]) m4_include([m4/fts.m4]) m4_include([m4/getcwd.m4]) m4_include([m4/getdtablesize.m4]) m4_include([m4/getopt.m4]) m4_include([m4/getpagesize.m4]) m4_include([m4/getprogname.m4]) m4_include([m4/gettext.m4]) m4_include([m4/gettimeofday.m4]) m4_include([m4/gnulib-common.m4]) m4_include([m4/gnulib-comp.m4]) m4_include([m4/host-cpu-c-abi.m4]) m4_include([m4/i-ring.m4]) m4_include([m4/iconv.m4]) m4_include([m4/iconv_h.m4]) m4_include([m4/iconv_open.m4]) m4_include([m4/include_next.m4]) m4_include([m4/inet_pton.m4]) m4_include([m4/inline.m4]) m4_include([m4/intl-thread-locale.m4]) m4_include([m4/intlmacosx.m4]) m4_include([m4/intmax_t.m4]) m4_include([m4/inttostr.m4]) m4_include([m4/inttypes.m4]) m4_include([m4/inttypes_h.m4]) m4_include([m4/ioctl.m4]) m4_include([m4/isatty.m4]) m4_include([m4/isblank.m4]) m4_include([m4/iswblank.m4]) m4_include([m4/iswctype.m4]) m4_include([m4/iswdigit.m4]) m4_include([m4/iswxdigit.m4]) m4_include([m4/langinfo_h.m4]) m4_include([m4/largefile.m4]) m4_include([m4/lcmessage.m4]) m4_include([m4/lib-ld.m4]) m4_include([m4/lib-link.m4]) m4_include([m4/lib-prefix.m4]) m4_include([m4/libsigsegv.m4]) m4_include([m4/libunistring-base.m4]) m4_include([m4/limits-h.m4]) m4_include([m4/localcharset.m4]) m4_include([m4/locale-fr.m4]) m4_include([m4/locale-ja.m4]) m4_include([m4/locale-tr.m4]) m4_include([m4/locale-zh.m4]) m4_include([m4/locale_h.m4]) m4_include([m4/localeconv.m4]) m4_include([m4/localename.m4]) m4_include([m4/lock.m4]) m4_include([m4/lseek.m4]) m4_include([m4/lstat.m4]) m4_include([m4/malloc.m4]) m4_include([m4/malloca.m4]) m4_include([m4/manywarnings.m4]) m4_include([m4/mbchar.m4]) m4_include([m4/mbiter.m4]) m4_include([m4/mbrlen.m4]) m4_include([m4/mbrtowc.m4]) m4_include([m4/mbsinit.m4]) m4_include([m4/mbslen.m4]) m4_include([m4/mbsrtowcs.m4]) m4_include([m4/mbstate_t.m4]) m4_include([m4/mbtowc.m4]) m4_include([m4/memchr.m4]) m4_include([m4/mempcpy.m4]) m4_include([m4/memrchr.m4]) m4_include([m4/minmax.m4]) m4_include([m4/mmap-anon.m4]) m4_include([m4/mode_t.m4]) m4_include([m4/msvc-inval.m4]) m4_include([m4/msvc-nothrow.m4]) m4_include([m4/multiarch.m4]) m4_include([m4/musl.m4]) m4_include([m4/nanosleep.m4]) m4_include([m4/netinet_in_h.m4]) m4_include([m4/nl_langinfo.m4]) m4_include([m4/nls.m4]) m4_include([m4/nocrash.m4]) m4_include([m4/obstack.m4]) m4_include([m4/off_t.m4]) m4_include([m4/open-cloexec.m4]) m4_include([m4/open-slash.m4]) m4_include([m4/open.m4]) m4_include([m4/openat.m4]) m4_include([m4/opendir.m4]) m4_include([m4/pathmax.m4]) m4_include([m4/pcre.m4]) m4_include([m4/perl.m4]) m4_include([m4/perror.m4]) m4_include([m4/pipe.m4]) m4_include([m4/pkg.m4]) m4_include([m4/po.m4]) m4_include([m4/printf.m4]) m4_include([m4/progtest.m4]) m4_include([m4/pthread-thread.m4]) m4_include([m4/pthread_h.m4]) m4_include([m4/pthread_rwlock_rdlock.m4]) m4_include([m4/pthread_sigmask.m4]) m4_include([m4/putenv.m4]) m4_include([m4/quote.m4]) m4_include([m4/quotearg.m4]) m4_include([m4/raise.m4]) m4_include([m4/rawmemchr.m4]) m4_include([m4/read.m4]) m4_include([m4/readdir.m4]) m4_include([m4/realloc.m4]) m4_include([m4/reallocarray.m4]) m4_include([m4/regex.m4]) m4_include([m4/safe-read.m4]) m4_include([m4/save-cwd.m4]) m4_include([m4/sched_h.m4]) m4_include([m4/select.m4]) m4_include([m4/setenv.m4]) m4_include([m4/setlocale.m4]) m4_include([m4/setlocale_null.m4]) m4_include([m4/sigaction.m4]) m4_include([m4/sigaltstack.m4]) m4_include([m4/signal_h.m4]) m4_include([m4/signalblocking.m4]) m4_include([m4/size_max.m4]) m4_include([m4/sleep.m4]) m4_include([m4/snprintf.m4]) m4_include([m4/socketlib.m4]) m4_include([m4/sockets.m4]) m4_include([m4/socklen.m4]) m4_include([m4/sockpfaf.m4]) m4_include([m4/ssize_t.m4]) m4_include([m4/stack-direction.m4]) m4_include([m4/stat-time.m4]) m4_include([m4/stat.m4]) m4_include([m4/stdalign.m4]) m4_include([m4/stdarg.m4]) m4_include([m4/stdbool.m4]) m4_include([m4/stddef_h.m4]) m4_include([m4/stdint.m4]) m4_include([m4/stdint_h.m4]) m4_include([m4/stdio_h.m4]) m4_include([m4/stdlib_h.m4]) m4_include([m4/stpcpy.m4]) m4_include([m4/strdup.m4]) m4_include([m4/strerror.m4]) m4_include([m4/strerror_r.m4]) m4_include([m4/string_h.m4]) m4_include([m4/strnlen.m4]) m4_include([m4/strstr.m4]) m4_include([m4/strtoimax.m4]) m4_include([m4/strtoll.m4]) m4_include([m4/strtoull.m4]) m4_include([m4/strtoumax.m4]) m4_include([m4/symlink.m4]) m4_include([m4/sys_ioctl_h.m4]) m4_include([m4/sys_select_h.m4]) m4_include([m4/sys_socket_h.m4]) m4_include([m4/sys_stat_h.m4]) m4_include([m4/sys_time_h.m4]) m4_include([m4/sys_types_h.m4]) m4_include([m4/sys_uio_h.m4]) m4_include([m4/thread.m4]) m4_include([m4/threadlib.m4]) m4_include([m4/time_h.m4]) m4_include([m4/unistd-safer.m4]) m4_include([m4/unistd_h.m4]) m4_include([m4/unlocked-io.m4]) m4_include([m4/vasnprintf.m4]) m4_include([m4/version-etc.m4]) m4_include([m4/visibility.m4]) m4_include([m4/warn-on-use.m4]) m4_include([m4/warnings.m4]) m4_include([m4/wchar_h.m4]) m4_include([m4/wchar_t.m4]) m4_include([m4/wcrtomb.m4]) m4_include([m4/wctob.m4]) m4_include([m4/wctomb.m4]) m4_include([m4/wctype_h.m4]) m4_include([m4/wcwidth.m4]) m4_include([m4/windows-stat-inodes.m4]) m4_include([m4/wint_t.m4]) m4_include([m4/wmemchr.m4]) m4_include([m4/wmempcpy.m4]) m4_include([m4/xalloc.m4]) m4_include([m4/xsize.m4]) m4_include([m4/xstrtol.m4]) m4_include([m4/year2038.m4]) m4_include([m4/zzgnulib.m4]) kbuild-3608/src/grep/Makefile.kmk0000664000175000017500000002377414670377422016704 0ustar locutuslocutus# $Id: Makefile.kmk 3548 2022-01-29 02:41:10Z bird $ ## @file # Sub-Makefile for kmk_grep. # # # Copyright (c) 2006-2010 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # SUB_DEPTH = ../.. include $(KBUILD_PATH)/subheader.kmk # # Grep uses C99 syntax, which isn't supported by older microsoft compilers, # so select a newer one if needed and do static linking. # TEMPLATE_BINC99 = Accept C99 syntax TEMPLATE_BINC99_EXTENDS = BIN if1of ($(KBUILD_TARGET), win nt) ifeq ($(TEMPLATE_BIN_TOOL),VCC100) TEMPLATE_BINC99_TOOL = VCC142 TEMPLATE_BINC99_TOOL.x86 = VCC142X86 TEMPLATE_BINC99_TOOL.amd64 = VCC142AMD64 TEMPLATE_BINC99_SDKS = WINSDK10-UM WINSDK10-UCRT-STATIC TEMPLATE_BINC99_CFLAGS = $(filter-out -MD,$(TEMPLATE_BIN_CFLAGS)) -MT -Gy -Gw -Zc:inline TEMPLATE_BINC99_LDFLAGS = $(TEMPLATE_BIN_LDFLAGS) /OPT:REF TEMPLATE_BINC99_LIBS = \ $(PATH_TOOL_$(TEMPLATE_BINC99_TOOL)_LIB.$(KBUILD_TARGET_ARCH))/vcruntime.lib \ $(PATH_TOOL_$(TEMPLATE_BINC99_TOOL)_LIB.$(KBUILD_TARGET_ARCH))/oldnames.lib \ $(PATH_TOOL_$(TEMPLATE_BINC99_TOOL)_LIB.$(KBUILD_TARGET_ARCH))/libcmt.lib \ $(PATH_TOOL_$(TEMPLATE_BINC99_TOOL)_LIB.$(KBUILD_TARGET_ARCH))/libcpmt.lib TEMPLATE_BINC99_LIBS.x86 = $(NO_SUCH_VARIABLE) TEMPLATE_BINC99_LIBS.amd64 = $(NO_SUCH_VARIABLE) endif endif # # kmk_grep # PROGRAMS += kmk_grep kmk_grep_TEMPLATE = BINC99 kmk_grep_DEFS = \ KMK_GREP \ HAVE_CONFIG_H kmk_grep_CFLAGS.solaris = -std=gnu99 kmk_grep_CFLAGS.win += -wd4018 # grep.c(797): warning C4018: '<': signed/unsigned mismatch [lots of size_t / ptrdiff_t mixups] kmk_grep_CFLAGS.win += -wd4244 # grep.c(1423): warning C4244: '=': conversion from '__int64' to 'off_t', possible loss of data kmk_grep_CFLAGS.win += -wd4267 # grep.c(2303): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data kmk_grep_CFLAGS.win += -wd4146 # fnmatch_loop.c(1067): warning C4146: unary minus operator applied to unsigned type, result still unsigned kmk_grep_CFLAGS.win += -wd4308 # fnmatch_loop.c(1067): warning C4308: negative integral constant converted to unsigned type ifdef KBUILD_SOLARIS_10 kmk_grep_CFLAGS += -std=gnu99 endif kmk_grep_INCS = \ $(kmk_grep_0_OUTDIR) \ . \ lib kmk_grep_SOURCES = \ src/grep.c \ src/dfasearch.c \ src/kwsearch.c \ src/kwset.c \ src/searchutils.c \ \ lib/regex.c \ lib/dfa.c \ \ lib/getopt1.c \ lib/getopt.c \ \ lib/xalloc-die.c \ lib/xmalloc.c \ lib/reallocarray.c \ lib/obstack.c \ lib/c-stack.c \ lib/malloc/dynarray_resize.c \ \ lib/stripslash.c \ lib/argmatch.c \ lib/quotearg.c \ lib/exclude.c \ lib/fnmatch.c \ lib/hash.c \ lib/error.c \ \ lib/openat-safer.c \ lib/fd-safer.c \ lib/fd-safer-flag.c \ lib/dup-safer.c \ lib/dup-safer-flag.c \ lib/closeout.c \ lib/close-stream.c \ lib/fpending.c \ lib/safe-read.c \ \ lib/c-strcasecmp.c \ lib/localeinfo.c \ lib/localcharset.c \ lib/mbchar.c \ lib/mbscasecmp.c \ lib/memrchr.c \ lib/memchr2.c \ lib/wmempcpy.c \ lib/strnlen1.c \ lib/xstrtoimax.c \ \ lib/exitfail.c \ lib/version-etc.c \ lib/version-etc-fsf.c \ kmk_grep_SOURCES.win = \ lib/w32-initialize-main.c \ lib/colorize-w32.c \ lib/basename-lgpl.c \ lib/getpagesize.c \ lib/getprogname-w32.c \ lib/xbinary-io.c \ lib/strerror.c \ \ ../lib/get_codepage.c \ ../lib/nt/ntstat.c \ ../lib/nt/ntdir.c \ ../lib/nt/nthlpcore.c \ ../lib/nt/nthlpfs.c \ ../lib/nt/ntopenat.c \ ../lib/nt/fts-nt.c #TODO use: ../lib/startuphacks-win.c # # We generate a few files. # kmk_grep_DEPS = \ $(kmk_grep_0_OUTDIR)/config.h \ $(kmk_grep_0_OUTDIR)/configmake.h kmk_grep_DEPS.win = \ $(kmk_grep_0_OUTDIR)/getopt-cdefs.h \ $(kmk_grep_0_OUTDIR)/getopt.h \ $(kmk_grep_0_OUTDIR)/unistd.h \ $(kmk_grep_0_OUTDIR)/sigsegv.h \ $(kmk_grep_0_OUTDIR)/fnmatch.h kmk_grep_CLEAN = $(kmk_grep_DEPS) kmk_grep_CLEAN.win = $(kmk_grep_DEPS.win) $(kmk_grep_LNK_DEPS.win) # Use checked in config.h instead of running ./configure for it. $$(kmk_grep_0_OUTDIR)/config.h: $(PATH_SUB_CURRENT)/config.$(KBUILD_TARGET).h | $$(call DIRDEP,$$(kmk_grep_0_OUTDIR)) $(CP) -f -- "$^" "$@" # This shouldn't be used with NLS disabled, so the paths doesn't matter I hope. $$(kmk_grep_0_OUTDIR)/configmake.h: $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(kmk_grep_0_OUTDIR)) $(APPEND) -tn "$@" \ '#define PREFIX "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define EXEC_PREFIX "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define BINDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define SBINDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define LIBEXECDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define DATAROOTDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define DATADIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define SYSCONFDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define SHAREDSTATEDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define LOCALSTATEDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define RUNSTATEDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define INCLUDEDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define OLDINCLUDEDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define DOCDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define INFODIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define HTMLDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define DVIDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define PDFDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define PSDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define LIBDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define LISPDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define LOCALEDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define MANDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define MANEXT "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define PKGDATADIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define PKGINCLUDEDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define PKGLIBDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; \ '#define PKGLIBEXECDIR "kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/"'; # Windows needs a few more things: $$(kmk_grep_0_OUTDIR)/getopt-cdefs.h: $(PATH_SUB_CURRENT)/lib/getopt-cdefs.in.h \ $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(kmk_grep_0_OUTDIR)) $(SED) \ -e 's,@HAVE_SYS_CDEFS_H@,0,' \ --output "$@" \ $(qdeps sh,$@,1) $$(kmk_grep_0_OUTDIR)/getopt.h: $(PATH_SUB_CURRENT)/lib/getopt.in.h \ $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(kmk_grep_0_OUTDIR)) $(SED) \ -e 's,@GUARD_PREFIX@,GNULIB,' \ -e '/@PRAGMA_SYSTEM_HEADER@/d' \ -e '/@PRAGMA_COLUMNS@/d' \ -e 's,@HAVE_SYS_CDEFS_H@,0,' \ -e '/@INCLUDE_NEXT@/d' \ -e '/@NEXT_GETOPT_H@/d' \ -e 's,@HAVE_GETOPT_H@,0,' \ --output "$@" \ $(qdeps sh,$@,1) $$(kmk_grep_0_OUTDIR)/fnmatch.h: $(PATH_SUB_CURRENT)/lib/fnmatch.in.h \ $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(kmk_grep_0_OUTDIR)) $(SED) \ -e 's,@GUARD_PREFIX@,GNULIB,' \ -e '/@PRAGMA_SYSTEM_HEADER@/d' \ -e '/@PRAGMA_COLUMNS@/d' \ -e 's,@HAVE_FNMATCH_H@,0,' \ -e 's,@REPLACE_FNMATCH@,0,' \ -e 's,@GNULIB_FNMATCH@,1,' \ -e 's,@HAVE_FNMATCH@,0,' \ -e '/@INCLUDE_NEXT@/d' \ --output "$@" \ $(qdeps sh,$@,1) $$(kmk_grep_0_OUTDIR)/unistd.h: $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(kmk_grep_0_OUTDIR)) $(APPEND) -tn "$@" \ 'extern int getpagesize(void);' \ 'extern int fchdir(int);' $$(kmk_grep_0_OUTDIR)/sigsegv.h: $(PATH_SUB_CURRENT)/lib/sigsegv.in.h | $$(call DIRDEP,$$(kmk_grep_0_OUTDIR)) $(CP) -f -- "$^" "$@" ifndef KBUILD_NEW_VCC # Add a manifest making UTF-8 as the active code page. kmk_grep_LNK_DEPS.win = \ $(kmk_grep_0_OUTDIR)/kmk_grep.manifest $$(kmk_grep_0_OUTDIR)/kmk_grep.manifest: $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(kmk_grep_0_OUTDIR)) $(APPEND) -tn "$@" \ '' \ '' \ ' ' \ ' ' \ ' ' \ ' UTF-8' \ ' ' \ ' ' \ '' # HACK ALERT! Using kmk_builting_redirect here to bypass some shell quoting # issue. Also, no idea why we need to escape the hash (\#1). kmk_grep_POST_CMDS.win = \ $(REDIRECT) -- $(PATH_SDK_WINSDK10-UM_BIN)/mt.exe \ -manifest "$(subst /,\\,$(kmk_grep_0_OUTDIR)/kmk_grep.manifest)" \ '-outputresource:$(subst /,\\,$(out));\#1' endif include $(FILE_KBUILD_SUB_FOOTER) kbuild-3608/src/grep/README0000664000175000017500000000453314670377426015337 0ustar locutuslocutus Copyright (C) 1992, 1997-2002, 2004-2021 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This is GNU grep, the "fastest grep in the west" (we hope). All bugs reported in previous releases have been fixed. Many exciting new bugs have probably been introduced in this revision. GNU grep is provided "as is" with no warranty. The exact terms under which you may use and (re)distribute this program are detailed in the GNU General Public License, in the file COPYING. GNU grep is based on a fast lazy-state deterministic matcher (about twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper search for a fixed string that eliminates impossible text from being considered by the full regexp matcher without necessarily having to look at every character. The result is typically many times faster than Unix grep or egrep. (Regular expressions containing back-references will run more slowly, however.) See the files AUTHORS and THANKS for a list of authors and other contributors. See the file INSTALL for compilation and installation instructions. If there is no INSTALL file, this copy of the source code is intended for expert hackers; please see the file README-hacking. See the file NEWS for a description of major changes in this release. See the file TODO for ideas on how you could help us improve grep. See the file README-alpha for information on grep development and the CVS repository. Send bug reports to bug-grep@gnu.org. KNOWN BUGS: Several tests in fmbtest.sh and foad1.sh fail under the cs_CZ.UTF-8 locale and have been disabled. The combination of -o and -i options is broken and the known failing cases are disabled in foad1.sh The option -i does not work properly in some multibyte locales such as tr_TR.UTF-8 where the upper case and lower case forms of a character are not necessarily of the same byte length. A list of outstanding and resolved bugs can be found at: https://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep You can also browse the bug-grep mailing list archive at: https://lists.gnu.org/r/bug-grep/ For any copyright year range specified as YYYY-ZZZZ in this package note that the range specifies every single year in that closed interval. kbuild-3608/src/grep/COPYING0000664000175000017500000010451514670377426015513 0ustar locutuslocutus GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . kbuild-3608/src/grep/TODO0000664000175000017500000002606114670377426015147 0ustar locutuslocutusThings to do for GNU grep Copyright (C) 1992, 1997-2002, 2004-2021 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. =============== Short term work =============== See where we are with UTF-8 performance. Merge Debian patches that seem relevant. Go through patches in Savannah. Fix --directories=read. Write better Texinfo documentation for grep. The manual page would be a good place to start, but Info documents are also supposed to contain a tutorial and examples. Some tests in tests/spencer2.tests should have failed! Need to filter out some bugs in dfa.[ch]/regex.[ch]. Multithreading? GNU grep originally did 32-bit arithmetic. Although it has moved to 64-bit on 64-bit platforms by using types like ptrdiff_t and size_t, this conversion has not been entirely systematic and should be checked. Lazy dynamic linking of libpcre. See Debian’s 03-397262-dlopen-pcre.patch. Check FreeBSD’s integration of zgrep (-Z) and bzgrep (-J) in one binary. Is there a possibility of doing even better by automatically checking the magic of binary files ourselves (0x1F 0x8B for gzip, 0x1F 0x9D for compress, and 0x42 0x5A 0x68 for bzip2)? Once what to do with libpcre is decided, do the same for libz and libbz2. =================== Matching algorithms =================== Take a look at these and consider opportunities for merging or cloning: -- http://osrd.org/projects/grep/global-regular-expression-print-tools-grep-variants -- ja-grep’s mlb2 patch (Japanese grep) -- lgrep (from lv, a Powerful Multilingual File Viewer / Grep) ; -- cgrep (Context grep) seems like nice work; -- sgrep (Struct grep) ; -- agrep (Approximate grep) , from glimpse; -- nr-grep (Nondeterministic reverse grep) ; -- ggrep (Grouse grep) ; -- freegrep ; Check some new algorithms for matching. See, for example, Faro & Lecroq (cited in kwset.c). Fix the DFA matcher to never use exponential space. (Fortunately, these cases are rare.) ============================ Standards: POSIX and Unicode ============================ For POSIX compliance issues, see POSIX 1003.1. Current support for the POSIX [= =] and [. .] constructs is limited to platforms whose regular expression matchers are sufficiently compatible with the GNU C library so that the --without-included-regex option of ‘configure’ is in effect. Extend this support to non-glibc platforms, where --with-included-regex is in effect, by modifying the included version of the regex code to defer to the native version when handling [= =] and [. .]. For Unicode, interesting things to check include the Unicode Standard and the Unicode Technical Standard #18 ( “Unicode Regular Expressionsâ€). Talk to Bruno Haible who’s maintaining GNU libunistring. See also Unicode Standard Annex #15 ( “Unicode Normalization Formsâ€), already implemented by GNU libunistring. In particular, --ignore-case needs to be evaluated against the standards. We may want to deviate from POSIX if Unicode provides better or clearer semantics. POSIX and --ignore-case ----------------------- For this issue, interesting things to check in POSIX include the Open Group Base Specifications, Chapter “Regular Expressionsâ€, in particular Section “Regular Expression General Requirements†and its paragraph about caseless matching (this may not have been fully thought through and that this text may be self-contradicting [specifically: “of either data or patterns†versus all the rest]). See: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_02 In particular, consider the following with POSIX’s approach to case folding in mind. Assume a non-Turkic locale with a character repertoire reduced to the following various forms of “LATIN LETTER Iâ€: 0049;LATIN CAPITAL LETTER I;Lu;0;L;;;;;N;;;;0069; 0069;LATIN SMALL LETTER I;Ll;0;L;;;;;N;;;0049;;0049 0130;LATIN CAPITAL LETTER I WITH DOT ABOVE;Lu;0;L;0049 0307;;;;N;\ LATIN CAPITAL LETTER I DOT;;;0069; 0131;LATIN SMALL LETTER DOTLESS I;Ll;0;L;;;;;N;;;0049;;0049 UTF-8 octet lengths differ between U+0049 (0x49) and U+0069 (0x69) versus U+0130 (0xC4 0xB0) and U+0131 (0xC4 0xB1). This implies that whole UTF-8 strings cannot be case-converted in place, using the same memory buffer, and that the needed octet-size of the new buffer cannot merely be guessed (although there’s a simple upper bound of five times the size of the input, as the longest UTF-8 encoding of any character is five bytes). We have lc(I) = i, uc(I) = I lc(i) = i, uc(i) = I lc(İ) = i, uc(İ) = İ lc(ı) = ı, uc(ı) = I where lc() and uc() denote lower-case and upper-case conversions. There are several candidate --ignore-case logics. Using the if (lc(input_wchar) == lc(pattern_wchar)) logic leads to the following matches: \in I i İ ı pat\ ---------- I | Y Y Y n i | Y Y Y n İ | Y Y Y n ı | n n n Y There is a lack of symmetry between CAPITAL and SMALL LETTERs with this. Using the if (uc(input_wchar) == uc(pattern_wchar)) logic (which is what GNU grep currently does although this is not documented or guaranteed in the future), leads to the following matches: \in I i İ ı pat\ ---------- I | Y Y n Y i | Y Y n Y İ | n n Y n ı | Y Y n Y There is a lack of symmetry between CAPITAL and SMALL LETTERs with this. Using the if (lc(input_wchar) == lc(pattern_wchar) || uc(input_wchar) == uc(pattern_wchar)) logic leads to the following matches: \in I i İ ı pat\ ---------- I | Y Y Y Y i | Y Y Y Y İ | Y Y Y n ı | Y Y n Y There is some elegance and symmetry with this. But there are potentially two conversions to be made per input character. If the pattern is pre-converted, two copies of it need to be kept and used in a mutually coherent fashion. Using the if (input_wchar == pattern_wchar || lc(input_wchar) == pattern_wchar || uc(input_wchar) == pattern_wchar) logic (a plausible interpretation of POSIX) leads to the following matches: \in I i İ ı pat\ ---------- I | Y Y n Y i | Y Y Y n İ | n n Y n ı | n n n Y There is a different CAPITAL/SMALL symmetry with this. But there’s also a loss of pattern/input symmetry that’s unique to it. Also there are potentially two conversions to be made per input character. Using the if (lc(uc(input_wchar)) == lc(uc(pattern_wchar))) logic leads to the following matches: \in I i İ ı pat\ ---------- I | Y Y Y Y i | Y Y Y Y İ | Y Y Y Y ı | Y Y Y Y This shows total symmetry and transitivity (at least in this example analysis). There are two conversions to be made per input character, but support could be added for having a single straight mapping performing a composition of the two conversions. Any optimization in the implementation of each logic must not change its basic semantic. Unicode and --ignore-case ------------------------- For this issue, interesting things to check in Unicode include: - The Unicode Standard, Chapter 3 ( “Conformanceâ€), Section 3.13 (“Default Case Algorithmsâ€) and the toCasefold() case conversion operation. - The Unicode Standard, Chapter 4 ( “Character Propertiesâ€), Section 4.2 (“Caseâ€) and the SpecialCasing.txt and CaseFolding.txt files. - The Unicode Standard, Chapter 5 ( “Implementation Guidelinesâ€), Section 5.18 (“Case Mappingsâ€), Subsection “Caseless Matchingâ€. - The Unicode case charts . Unicode uses the if (toCasefold(input_wchar_string) == toCasefold(pattern_wchar_string)) logic for caseless matching. Consider the “LATIN LETTER I†example mentioned above. In a non-Turkic locale, simple case folding yields toCasefold_simple(U+0049) = U+0069 toCasefold_simple(U+0069) = U+0069 toCasefold_simple(U+0130) = U+0130 toCasefold_simple(U+0131) = U+0131 which leads to the following matches: \in I i İ ı pat\ ---------- I | Y Y n n i | Y Y n n İ | n n Y n ı | n n n Y This is different from anything so far! In a non-Turkic locale, full case folding yields toCasefold_full(U+0049) = U+0069 toCasefold_full(U+0069) = U+0069 toCasefold_full(U+0130) = toCasefold_full(U+0131) = U+0131 with 0307;COMBINING DOT ABOVE;Mn;230;NSM;;;;;N;NON-SPACING DOT ABOVE;;;; which leads to the following matches: \in I i İ ı pat\ ---------- I | Y Y * n i | Y Y * n İ | n n Y n ı | n n n Y This is just sad! Having toCasefold(U+0131), simple or full, map to itself instead of U+0069 is in contradiction with the rules of Section 5.18 of the Unicode Standard since toUpperCase(U+0131) is U+0049. Same thing for toCasefold_simple(U+0130) since toLowerCase(U+0131) is U+0069. The justification for the weird toCasefold_full(U+0130) mapping is unknown; it doesn’t even make sense to add a dot (U+0307) to a letter that already has one (U+0069). It would have been so simple to put them all in the same equivalence class! Otherwise, also consider the following problem with Unicode’s approach on case folding in mind. Assume that we want to perform echo 'AßBC' | grep -i 'Sb' which corresponds to input: U+0041 U+00DF U+0042 U+0043 U+000A pattern: U+0053 U+0062 Following CaseFolding.txt, applying the toCasefold() transformation to these yields input: U+0061 U+0073 U+0073 U+0062 U+0063 U+000A pattern: U+0073 U+0062 so, according to this approach, the input should match the pattern. As long as the original input line is to be reported to the user as a whole, there is no problem (from the user’s point-of-view; implementation is complicated by this). However, consider both these GNU extensions: echo 'AßBC' | grep -i --only-matching 'Sb' echo 'AßBC' | grep -i --color=always 'Sb' What is to be reported in these cases, since the match begins in the *middle* of the original input character ‘ß’? Unicode’s toCasefold() cannot be implemented in terms of POSIX’s towctrans() since that can only return a single wint_t value per input wint_t value. kbuild-3608/src/grep/build-aux/0000775000175000017500000000000014670377427016345 5ustar locutuslocutuskbuild-3608/src/grep/build-aux/ar-lib0000775000175000017500000001330214670377426017437 0ustar locutuslocutus#! /bin/sh # Wrapper for Microsoft lib.exe me=ar-lib scriptversion=2012-03-01.08; # UTC # Copyright (C) 2010-2015 Free Software Foundation, Inc. # Written by Peter Rosin . # # 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 2, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # func_error message func_error () { echo "$me: $1" 1>&2 exit 1 } file_conv= # func_file_conv build_file # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv in mingw) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin) file=`cygpath -m "$file" || echo "$file"` ;; wine) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_at_file at_file operation archive # Iterate over all members in AT_FILE performing OPERATION on ARCHIVE # for each of them. # When interpreting the content of the @FILE, do NOT use func_file_conv, # since the user would need to supply preconverted file names to # binutils ar, at least for MinGW. func_at_file () { operation=$2 archive=$3 at_file_contents=`cat "$1"` eval set x "$at_file_contents" shift for member do $AR -NOLOGO $operation:"$member" "$archive" || exit $? done } case $1 in '') func_error "no command. Try '$0 --help' for more information." ;; -h | --h*) cat <. # Written by Jim Meyering ME=$(basename "$0") warn() { printf '%s: %s\n' "$ME" "$*" >&2; } die() { warn "$*"; exit 1; } help() { cat <. EOF exit } version() { year=$(echo "$VERSION" | sed 's/[^0-9].*//') cat < This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. EOF exit } ## ------ ## ## Main. ## ## ------ ## # Constants. noteworthy='* Noteworthy changes in release' noteworthy_stub="$noteworthy ?.? (????-??-??) [?]" # Variables. branch=$(git branch | sed -ne '/^\* /{s///;p;q;}') builddir=. while test $# != 0 do # Handle --option=value by splitting apart and putting back on argv. case $1 in --*=*) opt=$(echo "$1" | sed -e 's/=.*//') val=$(echo "$1" | sed -e 's/[^=]*=//') shift set dummy "$opt" "$val" "$@"; shift ;; esac case $1 in --help|--version) ${1#--};; --branch) shift; branch=$1; shift ;; -C|--builddir) shift; builddir=$1; shift ;; --*) die "unrecognized option: $1";; *) break;; esac done test $# = 2 \ || die "Usage: $ME [OPTION...] VERSION TYPE" ver=$1 type=$2 ## ---------------------- ## ## First, sanity checks. ## ## ---------------------- ## # Verify that $ver looks like a version number, and... echo "$ver"|grep -E '^[0-9][0-9.]*[0-9]$' > /dev/null \ || die "invalid version: $ver" prev_ver=$(cat .prev-version) \ || die 'failed to determine previous version number from .prev-version' # Verify that $ver is sensible (> .prev-version). case $(printf "$prev_ver\n$ver\n"|sort -V -u|tr '\n' ':') in "$prev_ver:$ver:") ;; *) die "invalid version: $ver (<= $prev_ver)";; esac case $type in alpha|beta|stable) ;; *) die "invalid release type: $type";; esac # No local modifications allowed. case $(git diff-index --name-only HEAD) in '') ;; *) die 'this tree is dirty; commit your changes first';; esac # Ensure the current branch name is correct: curr_br=$(git rev-parse --symbolic-full-name HEAD) test "$curr_br" = "refs/heads/$branch" || die not on branch $branch # Extract package name from Makefile. Makefile=$builddir/Makefile pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' "$Makefile") \ || die "failed to determine package name from $Makefile" # Check that line 3 of NEWS is the stub line about to be replaced. test "$(sed -n 3p NEWS)" = "$noteworthy_stub" \ || die "line 3 of NEWS must be exactly '$noteworthy_stub'" ## --------------- ## ## Then, changes. ## ## --------------- ## # Update NEWS to have today's date, plus desired version number and $type. perl -MPOSIX -ni -e 'my $today = strftime "%F", localtime time;' \ -e 'my ($type, $ver) = qw('"$type $ver"');' \ -e 'my $pfx = "'"$noteworthy"'";' \ -e 'print $.==3 ? "$pfx $ver ($today) [$type]\n" : $_' \ NEWS || die 'failed to update NEWS' printf "version $ver\n\n* NEWS: Record release date.\n" \ | git commit -F - -a || die 'git commit failed' git tag -s -m "$pkg $ver" v$ver HEAD || die 'git tag failed' # Local variables: # indent-tabs-mode: nil # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "VERSION=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: " # UTC" # End: kbuild-3608/src/grep/build-aux/compile0000775000175000017500000001635014670377426017727 0ustar locutuslocutus#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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 2, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: kbuild-3608/src/grep/build-aux/config.guess0000775000175000017500000014030414670377427020667 0ustar locutuslocutus#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2021 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2021-06-03' # This file 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 . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # Just in case it came from the environment. GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD=$driver break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #endif EOF cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$cc_set_libc" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl; then LIBC=musl fi # If the system lacks a compiler, then just pick glibc. # We could probably try harder. if [ "$LIBC" = unknown ]; then LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` case $UNAME_MACHINE_ARCH in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-unknown ;; *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case $UNAME_VERSION in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. GUESS=$machine-${os}${release}${abi-} ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE ;; *:SecBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE ;; *:MidnightBSD:*:*) GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE ;; *:ekkoBSD:*:*) GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE ;; *:SolidBSD:*:*) GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE ;; *:OS108:*:*) GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE ;; macppc:MirBSD:*:*) GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE ;; *:MirBSD:*:*) GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE ;; *:Sortix:*:*) GUESS=$UNAME_MACHINE-unknown-sortix ;; *:Twizzler:*:*) GUESS=$UNAME_MACHINE-unknown-twizzler ;; *:Redox:*:*) GUESS=$UNAME_MACHINE-unknown-redox ;; mips:OSF1:*.*) GUESS=mips-dec-osf1 ;; alpha:OSF1:*:*) # Reset EXIT trap before exiting to avoid spurious non-zero exit code. trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` GUESS=$UNAME_MACHINE-dec-osf$OSF_REL ;; Amiga*:UNIX_System_V:4.0:*) GUESS=m68k-unknown-sysv4 ;; *:[Aa]miga[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-amigaos ;; *:[Mm]orph[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-morphos ;; *:OS/390:*:*) GUESS=i370-ibm-openedition ;; *:z/VM:*:*) GUESS=s390-ibm-zvmoe ;; *:OS400:*:*) GUESS=powerpc-ibm-os400 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) GUESS=arm-acorn-riscix$UNAME_RELEASE ;; arm*:riscos:*:*|arm*:RISCOS:*:*) GUESS=arm-unknown-riscos ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) GUESS=hppa1.1-hitachi-hiuxmpp ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. case `(/bin/universe) 2>/dev/null` in att) GUESS=pyramid-pyramid-sysv3 ;; *) GUESS=pyramid-pyramid-bsd ;; esac ;; NILE*:*:*:dcosx) GUESS=pyramid-pyramid-svr4 ;; DRS?6000:unix:4.0:6*) GUESS=sparc-icl-nx6 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) GUESS=sparc-icl-nx7 ;; esac ;; s390x:SunOS:*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL ;; sun4H:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-hal-solaris2$SUN_REL ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris2$SUN_REL ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) GUESS=i386-pc-auroraux$UNAME_RELEASE ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$SUN_ARCH-pc-solaris2$SUN_REL ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris3$SUN_REL ;; sun4*:SunOS:*:*) case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; sun3*:SunOS:*:*) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case `/bin/arch` in sun3) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac ;; aushp:SunOS:*:*) GUESS=sparc-auspex-sunos$UNAME_RELEASE ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) GUESS=m68k-milan-mint$UNAME_RELEASE ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) GUESS=m68k-hades-mint$UNAME_RELEASE ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) GUESS=m68k-unknown-mint$UNAME_RELEASE ;; m68k:machten:*:*) GUESS=m68k-apple-machten$UNAME_RELEASE ;; powerpc:machten:*:*) GUESS=powerpc-apple-machten$UNAME_RELEASE ;; RISC*:Mach:*:*) GUESS=mips-dec-mach_bsd4.3 ;; RISC*:ULTRIX:*:*) GUESS=mips-dec-ultrix$UNAME_RELEASE ;; VAX*:ULTRIX*:*:*) GUESS=vax-dec-ultrix$UNAME_RELEASE ;; 2020:CLIX:*:* | 2430:CLIX:*:*) GUESS=clipper-intergraph-clix$UNAME_RELEASE ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } GUESS=mips-mips-riscos$UNAME_RELEASE ;; Motorola:PowerMAX_OS:*:*) GUESS=powerpc-motorola-powermax ;; Motorola:*:4.3:PL8-*) GUESS=powerpc-harris-powermax ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) GUESS=powerpc-harris-powermax ;; Night_Hawk:Power_UNIX:*:*) GUESS=powerpc-harris-powerunix ;; m88k:CX/UX:7*:*) GUESS=m88k-harris-cxux7 ;; m88k:*:4*:R4*) GUESS=m88k-motorola-sysv4 ;; m88k:*:3*:R3*) GUESS=m88k-motorola-sysv3 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then GUESS=m88k-dg-dgux$UNAME_RELEASE else GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else GUESS=i586-dg-dgux$UNAME_RELEASE fi ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) GUESS=m88k-dolphin-sysv3 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 GUESS=m88k-motorola-sysv3 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) GUESS=m88k-tektronix-sysv3 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) GUESS=m68k-tektronix-bsd ;; *:IRIX*:*:*) IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` GUESS=mips-sgi-irix$IRIX_REL ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) GUESS=i386-ibm-aix ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then GUESS=$SYSTEM_NAME else GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then GUESS=rs6000-ibm-aix3.2.4 else GUESS=rs6000-ibm-aix3.2 fi ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$IBM_ARCH-ibm-aix$IBM_REV ;; *:AIX:*:*) GUESS=rs6000-ibm-aix ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) GUESS=romp-ibm-bsd4.4 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) GUESS=rs6000-bull-bosx ;; DPX/2?00:B.O.S.:*:*) GUESS=m68k-bull-sysv3 ;; 9000/[34]??:4.3bsd:1.*:*) GUESS=m68k-hp-bsd ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) GUESS=m68k-hp-bsd4.4 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi GUESS=$HP_ARCH-hp-hpux$HPUX_REV ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` GUESS=ia64-hp-hpux$HPUX_REV ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } GUESS=unknown-hitachi-hiuxwe2 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) GUESS=hppa1.1-hp-bsd ;; 9000/8??:4.3bsd:*:*) GUESS=hppa1.0-hp-bsd ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) GUESS=hppa1.0-hp-mpeix ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) GUESS=hppa1.1-hp-osf ;; hp8??:OSF1:*:*) GUESS=hppa1.0-hp-osf ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then GUESS=$UNAME_MACHINE-unknown-osf1mk else GUESS=$UNAME_MACHINE-unknown-osf1 fi ;; parisc*:Lites*:*:*) GUESS=hppa1.1-hp-lites ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) GUESS=c1-convex-bsd ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) GUESS=c34-convex-bsd ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) GUESS=c38-convex-bsd ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) GUESS=c4-convex-bsd ;; CRAY*Y-MP:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=ymp-cray-unicos$CRAY_REL ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=t90-cray-unicos$CRAY_REL ;; CRAY*T3E:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=alphaev5-cray-unicosmk$CRAY_REL ;; CRAY*SV1:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=sv1-cray-unicos$CRAY_REL ;; *:UNICOS/mp:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=craynv-cray-unicosmp$CRAY_REL ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE ;; sparc*:BSD/OS:*:*) GUESS=sparc-unknown-bsdi$UNAME_RELEASE ;; *:BSD/OS:*:*) GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL ;; i*:CYGWIN*:*) GUESS=$UNAME_MACHINE-pc-cygwin ;; *:MINGW64*:*) GUESS=$UNAME_MACHINE-pc-mingw64 ;; *:MINGW*:*) GUESS=$UNAME_MACHINE-pc-mingw32 ;; *:MSYS*:*) GUESS=$UNAME_MACHINE-pc-msys ;; i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; *:Interix*:*) case $UNAME_MACHINE in x86) GUESS=i586-pc-interix$UNAME_RELEASE ;; authenticamd | genuineintel | EM64T) GUESS=x86_64-unknown-interix$UNAME_RELEASE ;; IA64) GUESS=ia64-unknown-interix$UNAME_RELEASE ;; esac ;; i*:UWIN*:*) GUESS=$UNAME_MACHINE-pc-uwin ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) GUESS=x86_64-pc-cygwin ;; prep*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=powerpcle-unknown-solaris2$SUN_REL ;; *:GNU:*:*) # the GNU system GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL ;; *:GNU/*:*:*) # other systems with GNU libc and userland GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi ;; avr32*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; cris:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; crisv32:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; e2k:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; frv:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; hexagon:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:Linux:*:*) GUESS=$UNAME_MACHINE-pc-linux-$LIBC ;; ia64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m68*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; openrisc*:Linux:*:*) GUESS=or1k-unknown-linux-$LIBC ;; or32:Linux:*:* | or1k*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; padre:Linux:*:*) GUESS=sparc-unknown-linux-$LIBC ;; parisc64:Linux:*:* | hppa64:Linux:*:*) GUESS=hppa64-unknown-linux-$LIBC ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; *) GUESS=hppa-unknown-linux-$LIBC ;; esac ;; ppc64:Linux:*:*) GUESS=powerpc64-unknown-linux-$LIBC ;; ppc:Linux:*:*) GUESS=powerpc-unknown-linux-$LIBC ;; ppc64le:Linux:*:*) GUESS=powerpc64le-unknown-linux-$LIBC ;; ppcle:Linux:*:*) GUESS=powerpcle-unknown-linux-$LIBC ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; s390:Linux:*:* | s390x:Linux:*:*) GUESS=$UNAME_MACHINE-ibm-linux-$LIBC ;; sh64*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sh*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sparc:Linux:*:* | sparc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; tile*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; vax:Linux:*:*) GUESS=$UNAME_MACHINE-dec-linux-$LIBC ;; x86_64:Linux:*:*) set_cc_for_build LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then LIBCABI=${LIBC}x32 fi fi GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. GUESS=i386-sequent-sysv4 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; i*86:XTS-300:*:STOP) GUESS=$UNAME_MACHINE-unknown-stop ;; i*86:atheos:*:*) GUESS=$UNAME_MACHINE-unknown-atheos ;; i*86:syllable:*:*) GUESS=$UNAME_MACHINE-pc-syllable ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) GUESS=i386-unknown-lynxos$UNAME_RELEASE ;; i*86:*DOS:*:*) GUESS=$UNAME_MACHINE-pc-msdosdjgpp ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv32 fi ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. GUESS=i586-pc-msdosdjgpp ;; Intel:Mach:3*:*) GUESS=i386-pc-mach3 ;; paragon:*:*:*) GUESS=i860-intel-osf1 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi ;; mini*:CTIX:SYS*5:*) # "miniframe" GUESS=m68010-convergent-sysv ;; mc68k:UNIX:SYSTEM5:3.51m) GUESS=m68k-convergent-sysv ;; M680?0:D-NIX:5.3:*) GUESS=m68k-diab-dnix ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) GUESS=m68k-unknown-lynxos$UNAME_RELEASE ;; mc68030:UNIX_System_V:4.*:*) GUESS=m68k-atari-sysv4 ;; TSUNAMI:LynxOS:2.*:*) GUESS=sparc-unknown-lynxos$UNAME_RELEASE ;; rs6000:LynxOS:2.*:*) GUESS=rs6000-unknown-lynxos$UNAME_RELEASE ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) GUESS=powerpc-unknown-lynxos$UNAME_RELEASE ;; SM[BE]S:UNIX_SV:*:*) GUESS=mips-dde-sysv$UNAME_RELEASE ;; RM*:ReliantUNIX-*:*:*) GUESS=mips-sni-sysv4 ;; RM*:SINIX-*:*:*) GUESS=mips-sni-sysv4 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` GUESS=$UNAME_MACHINE-sni-sysv4 else GUESS=ns32k-sni-sysv fi ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says GUESS=i586-unisys-sysv4 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm GUESS=hppa1.1-stratus-sysv4 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. GUESS=i860-stratus-sysv4 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. GUESS=$UNAME_MACHINE-stratus-vos ;; *:VOS:*:*) # From Paul.Green@stratus.com. GUESS=hppa1.1-stratus-vos ;; mc68*:A/UX:*:*) GUESS=m68k-apple-aux$UNAME_RELEASE ;; news*:NEWS-OS:6*:*) GUESS=mips-sony-newsos6 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then GUESS=mips-nec-sysv$UNAME_RELEASE else GUESS=mips-unknown-sysv$UNAME_RELEASE fi ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. GUESS=powerpc-be-beos ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. GUESS=powerpc-apple-beos ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. GUESS=i586-pc-beos ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; x86_64:Haiku:*:*) GUESS=x86_64-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE ;; SX-5:SUPER-UX:*:*) GUESS=sx5-nec-superux$UNAME_RELEASE ;; SX-6:SUPER-UX:*:*) GUESS=sx6-nec-superux$UNAME_RELEASE ;; SX-7:SUPER-UX:*:*) GUESS=sx7-nec-superux$UNAME_RELEASE ;; SX-8:SUPER-UX:*:*) GUESS=sx8-nec-superux$UNAME_RELEASE ;; SX-8R:SUPER-UX:*:*) GUESS=sx8r-nec-superux$UNAME_RELEASE ;; SX-ACE:SUPER-UX:*:*) GUESS=sxace-nec-superux$UNAME_RELEASE ;; Power*:Rhapsody:*:*) GUESS=powerpc-apple-rhapsody$UNAME_RELEASE ;; *:Rhapsody:*:*) GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE ;; arm64:Darwin:*:*) GUESS=aarch64-apple-darwin$UNAME_RELEASE ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE ;; *:QNX:*:4*) GUESS=i386-pc-qnx ;; NEO-*:NONSTOP_KERNEL:*:*) GUESS=neo-tandem-nsk$UNAME_RELEASE ;; NSE-*:NONSTOP_KERNEL:*:*) GUESS=nse-tandem-nsk$UNAME_RELEASE ;; NSR-*:NONSTOP_KERNEL:*:*) GUESS=nsr-tandem-nsk$UNAME_RELEASE ;; NSV-*:NONSTOP_KERNEL:*:*) GUESS=nsv-tandem-nsk$UNAME_RELEASE ;; NSX-*:NONSTOP_KERNEL:*:*) GUESS=nsx-tandem-nsk$UNAME_RELEASE ;; *:NonStop-UX:*:*) GUESS=mips-compaq-nonstopux ;; BS2000:POSIX*:*:*) GUESS=bs2000-siemens-sysv ;; DS/*:UNIX_System_V:*:*) GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "${cputype-}" = 386; then UNAME_MACHINE=i386 elif test "x${cputype-}" != x; then UNAME_MACHINE=$cputype fi GUESS=$UNAME_MACHINE-unknown-plan9 ;; *:TOPS-10:*:*) GUESS=pdp10-unknown-tops10 ;; *:TENEX:*:*) GUESS=pdp10-unknown-tenex ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) GUESS=pdp10-dec-tops20 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) GUESS=pdp10-xkl-tops20 ;; *:TOPS-20:*:*) GUESS=pdp10-unknown-tops20 ;; *:ITS:*:*) GUESS=pdp10-unknown-its ;; SEI:*:*:SEIUX) GUESS=mips-sei-seiux$UNAME_RELEASE ;; *:DragonFly:*:*) DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case $UNAME_MACHINE in A*) GUESS=alpha-dec-vms ;; I*) GUESS=ia64-dec-vms ;; V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) GUESS=i386-pc-xenix ;; i*86:skyos:*:*) SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL ;; i*86:rdos:*:*) GUESS=$UNAME_MACHINE-pc-rdos ;; *:AROS:*:*) GUESS=$UNAME_MACHINE-unknown-aros ;; x86_64:VMkernel:*:*) GUESS=$UNAME_MACHINE-unknown-esx ;; amd64:Isilon\ OneFS:*:*) GUESS=x86_64-unknown-onefs ;; *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; esac # Do we have a guess based on uname results? if test "x$GUESS" != x; then echo "$GUESS" exit fi # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: kbuild-3608/src/grep/build-aux/gitlog-to-changelog0000775000175000017500000004026014670377427022127 0ustar locutuslocutus#!/bin/sh #! -*-perl-*- # Convert git log output to ChangeLog format. # Copyright (C) 2008-2021 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 . # # Written by Jim Meyering # This is a prologue that allows to run a perl script as an executable # on systems that are compliant to a POSIX version before POSIX:2017. # On such systems, the usual invocation of an executable through execlp() # or execvp() fails with ENOEXEC if it is a script that does not start # with a #! line. The script interpreter mentioned in the #! line has # to be /bin/sh, because on GuixSD systems that is the only program that # has a fixed file name. The second line is essential for perl and is # also useful for editing this file in Emacs. The next two lines below # are valid code in both sh and perl. When executed by sh, they re-execute # the script through the perl program found in $PATH. The '-x' option # is essential as well; without it, perl would re-execute the script # through /bin/sh. When executed by perl, the next two lines are a no-op. eval 'exec perl -wSx "$0" "$@"' if 0; my $VERSION = '2021-02-24 23:42'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. use strict; use warnings; use Getopt::Long; use POSIX qw(strftime); (my $ME = $0) =~ s|.*/||; # use File::Coda; # https://meyering.net/code/Coda/ END { defined fileno STDOUT or return; close STDOUT and return; warn "$ME: failed to close standard output: $!\n"; $? ||= 1; } sub usage ($) { my ($exit_code) = @_; my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); if ($exit_code != 0) { print $STREAM "Try '$ME --help' for more information.\n"; } else { print $STREAM < ChangeLog $ME -- -n 5 foo > last-5-commits-to-branch-foo SPECIAL SYNTAX: The following types of strings are interpreted specially when they appear at the beginning of a log message line. They are not copied to the output. Copyright-paperwork-exempt: Yes Append the "(tiny change)" notation to the usual "date name email" ChangeLog header to mark a change that does not require a copyright assignment. Co-authored-by: Joe User List the specified name and email address on a second ChangeLog header, denoting a co-author. Signed-off-by: Joe User These lines are simply elided. In a FILE specified via --amend, comment lines (starting with "#") are ignored. FILE must consist of pairs where SHA is a 40-byte SHA1 (alone on a line) referring to a commit in the current project, and CODE refers to one or more consecutive lines of Perl code. Pairs must be separated by one or more blank line. Here is sample input for use with --amend=FILE, from coreutils: 3a169f4c5d9159283548178668d2fae6fced3030 # fix typo in title: s/all tile types/all file types/ 1379ed974f1fa39b12e2ffab18b3f7a607082202 # Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself. # Change the author to be Paul. Note the escaped "@": s,Jim .*>,Paul Eggert , EOF } exit $exit_code; } # If the string $S is a well-behaved file name, simply return it. # If it contains white space, quotes, etc., quote it, and return the new string. sub shell_quote($) { my ($s) = @_; if ($s =~ m![^\w+/.,-]!) { # Convert each single quote to '\'' $s =~ s/\'/\'\\\'\'/g; # Then single quote the string. $s = "'$s'"; } return $s; } sub quoted_cmd(@) { return join (' ', map {shell_quote $_} @_); } # Parse file F. # Comment lines (starting with "#") are ignored. # F must consist of pairs where SHA is a 40-byte SHA1 # (alone on a line) referring to a commit in the current project, and # CODE refers to one or more consecutive lines of Perl code. # Pairs must be separated by one or more blank line. sub parse_amend_file($) { my ($f) = @_; open F, '<', $f or die "$ME: $f: failed to open for reading: $!\n"; my $fail; my $h = {}; my $in_code = 0; my $sha; while (defined (my $line = )) { $line =~ /^\#/ and next; chomp $line; $line eq '' and $in_code = 0, next; if (!$in_code) { $line =~ /^([[:xdigit:]]{40})$/ or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"), $fail = 1, next; $sha = lc $1; $in_code = 1; exists $h->{$sha} and (warn "$ME: $f:$.: duplicate SHA1\n"), $fail = 1, next; } else { $h->{$sha} ||= ''; $h->{$sha} .= "$line\n"; } } close F; $fail and exit 1; return $h; } # git_dir_option $SRCDIR # # From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR # is undef). Return as a list (0 or 1 element). sub git_dir_option($) { my ($srcdir) = @_; my @res = (); if (defined $srcdir) { my $qdir = shell_quote $srcdir; my $cmd = "cd $qdir && git rev-parse --show-toplevel"; my $qcmd = shell_quote $cmd; my $git_dir = qx($cmd); defined $git_dir or die "$ME: cannot run $qcmd: $!\n"; $? == 0 or die "$ME: $qcmd had unexpected exit code or signal ($?)\n"; chomp $git_dir; push @res, "--git-dir=$git_dir/.git"; } @res; } { my $since_date; my $until_date; my $format_string = '%s%n%b%n'; my $amend_file; my $append_dot = 0; my $cluster = 1; my $ignore_matching; my $ignore_line; my $strip_tab = 0; my $strip_cherry_pick = 0; my $srcdir; GetOptions ( help => sub { usage 0 }, version => sub { print "$ME version $VERSION\n"; exit }, 'since=s' => \$since_date, 'until=s' => \$until_date, 'format=s' => \$format_string, 'amend=s' => \$amend_file, 'append-dot' => \$append_dot, 'cluster!' => \$cluster, 'ignore-matching=s' => \$ignore_matching, 'ignore-line=s' => \$ignore_line, 'strip-tab' => \$strip_tab, 'strip-cherry-pick' => \$strip_cherry_pick, 'srcdir=s' => \$srcdir, ) or usage 1; defined $since_date and unshift @ARGV, "--since=$since_date"; defined $until_date and unshift @ARGV, "--until=$until_date"; # This is a hash that maps an SHA1 to perl code (i.e., s/old/new/) # that makes a correction in the log or attribution of that commit. my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {}; my @cmd = ('git', git_dir_option $srcdir, qw(log --log-size), '--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV); open PIPE, '-|', @cmd or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n" . "(Is your Git too old? Version 1.5.1 or later is required.)\n"); my $prev_multi_paragraph; my $prev_date_line = ''; my @prev_coauthors = (); my @skipshas = (); while (1) { defined (my $in = ) or last; $in =~ /^log size (\d+)$/ or die "$ME:$.: Invalid line (expected log size):\n$in"; my $log_nbytes = $1; my $log; my $n_read = read PIPE, $log, $log_nbytes; $n_read == $log_nbytes or die "$ME:$.: unexpected EOF\n"; # Extract leading hash. my ($sha, $rest) = split ':', $log, 2; defined $sha or die "$ME:$.: malformed log entry\n"; $sha =~ /^[[:xdigit:]]{40}$/ or die "$ME:$.: invalid SHA1: $sha\n"; my $skipflag = 0; if (@skipshas) { foreach(@skipshas) { if ($sha =~ /^$_/) { $skipflag = $_; last; } } } # If this commit's log requires any transformation, do it now. my $code = $amend_code->{$sha}; if (defined $code) { eval 'use Safe'; my $s = new Safe; # Put the unpreprocessed entry into "$_". $_ = $rest; # Let $code operate on it, safely. my $r = $s->reval("$code") or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n"; # Note that we've used this entry. delete $amend_code->{$sha}; # Update $rest upon success. $rest = $_; } # Remove lines inserted by "git cherry-pick". if ($strip_cherry_pick) { $rest =~ s/^\s*Conflicts:\n.*//sm; $rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m; } my @line = split /[ \t]*\n/, $rest; my $author_line = shift @line; defined $author_line or die "$ME:$.: unexpected EOF\n"; $author_line =~ /^(\d+) (.*>)$/ or die "$ME:$.: Invalid line " . "(expected date/author/email):\n$author_line\n"; # Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog # `(tiny change)' annotation. my $tiny = (grep (/^(?:Copyright-paperwork-exempt|Tiny-change):\s+[Yy]es$/, @line) ? ' (tiny change)' : ''); my $date_line = sprintf "%s %s$tiny\n", strftime ("%Y-%m-%d", localtime ($1)), $2; my @coauthors = grep /^Co-authored-by:.*$/, @line; # Omit meta-data lines we've already interpreted. @line = grep !/^(?:Signed-off-by:[ ].*>$ |Co-authored-by:[ ] |Copyright-paperwork-exempt:[ ] |Tiny-change:[ ] )/x, @line; # Remove leading and trailing blank lines. if (@line) { while ($line[0] =~ /^\s*$/) { shift @line; } while ($line[$#line] =~ /^\s*$/) { pop @line; } } # Handle Emacs gitmerge.el "skipped" commits. # Yes, this should be controlled by an option. So sue me. if ( grep /^(; )?Merge from /, @line ) { my $found = 0; foreach (@line) { if (grep /^The following commit.*skipped:$/, $_) { $found = 1; ## Reset at each merge to reduce chance of false matches. @skipshas = (); next; } if ($found && $_ =~ /^([[:xdigit:]]{7,}) [^ ]/) { push ( @skipshas, $1 ); } } } # Ignore commits that match the --ignore-matching pattern, if specified. if (defined $ignore_matching && @line && $line[0] =~ /$ignore_matching/) { $skipflag = 1; } elsif ($skipflag) { ## Perhaps only warn if a pattern matches more than once? warn "$ME: warning: skipping $sha due to $skipflag\n"; } if (! $skipflag) { if (defined $ignore_line && @line) { @line = grep ! /$ignore_line/, @line; while ($line[$#line] =~ /^\s*$/) { pop @line; } } # Record whether there are two or more paragraphs. my $multi_paragraph = grep /^\s*$/, @line; # Format 'Co-authored-by: A U Thor ' lines in # standard multi-author ChangeLog format. for (@coauthors) { s/^Co-authored-by:\s*/\t /; s/\s*/ or warn "$ME: warning: missing email address for " . substr ($_, 5) . "\n"; } # If clustering of commit messages has been disabled, if this header # would be different from the previous date/name/etc. header, # or if this or the previous entry consists of two or more paragraphs, # then print the header. if ( ! $cluster || $date_line ne $prev_date_line || "@coauthors" ne "@prev_coauthors" || $multi_paragraph || $prev_multi_paragraph) { $prev_date_line eq '' or print "\n"; print $date_line; @coauthors and print join ("\n", @coauthors), "\n"; } $prev_date_line = $date_line; @prev_coauthors = @coauthors; $prev_multi_paragraph = $multi_paragraph; # If there were any lines if (@line == 0) { warn "$ME: warning: empty commit message:\n" . " commit $sha\n $date_line\n"; } else { if ($append_dot) { # If the first line of the message has enough room, then if (length $line[0] < 72) { # append a dot if there is no other punctuation or blank # at the end. $line[0] =~ /[[:punct:]\s]$/ or $line[0] .= '.'; } } # Remove one additional leading TAB from each line. $strip_tab and map { s/^\t// } @line; # Prefix each non-empty line with a TAB. @line = map { length $_ ? "\t$_" : '' } @line; print "\n", join ("\n", @line), "\n"; } } defined ($in = ) or last; $in ne "\n" and die "$ME:$.: unexpected line:\n$in"; } close PIPE or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n"; # FIXME-someday: include $PROCESS_STATUS in the diagnostic # Complain about any unused entry in the --amend=F specified file. my $fail = 0; foreach my $sha (keys %$amend_code) { warn "$ME:$amend_file: unused entry: $sha\n"; $fail = 1; } exit $fail; } # Local Variables: # mode: perl # indent-tabs-mode: nil # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-line-limit: 50 # time-stamp-start: "my $VERSION = '" # time-stamp-format: "%:y-%02m-%02d %02H:%02M" # time-stamp-time-zone: "UTC0" # time-stamp-end: "'; # UTC" # End: kbuild-3608/src/grep/build-aux/update-copyright0000775000175000017500000002513514670377427021571 0ustar locutuslocutus#!/bin/sh #! -*-perl-*- # Update an FSF copyright year list to include the current year. # Copyright (C) 2009-2021 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, 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 . # # Written by Jim Meyering and Joel E. Denny # This script updates an FSF copyright year list to include the current year. # Usage: update-copyright [FILE...] # # The arguments to this script should be names of files that contain # copyright statements to be updated. The copyright holder's name # defaults to "Free Software Foundation, Inc." but may be changed to # any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment # variable. # # For example, you might wish to use the update-copyright target rule # in maint.mk from gnulib's maintainer-makefile module. # # Iff a copyright statement is recognized in a file and the final # year is not the current year, then the statement is updated for the # new year and it is reformatted to: # # 1. Fit within 72 columns. # 2. Convert 2-digit years to 4-digit years by prepending "19". # 3. Expand copyright year intervals. (See "Environment variables" # below.) # # A warning is printed for every file for which no copyright # statement is recognized. # # Each file's copyright statement must be formatted correctly in # order to be recognized. For example, each of these is fine: # # Copyright @copyright{} 1990-2005, 2007-2009 Free Software # Foundation, Inc. # # # Copyright (C) 1990-2005, 2007-2009 Free Software # # Foundation, Inc. # # /* # * Copyright © 90,2005,2007-2009 # * Free Software Foundation, Inc. # */ # # However, the following format is not recognized because the line # prefix changes after the first line: # # ## Copyright (C) 1990-2005, 2007-2009 Free Software # # Foundation, Inc. # # However, any correctly formatted copyright statement following # a non-matching copyright statements would be recognized. # # The exact conditions that a file's copyright statement must meet # to be recognized are: # # 1. It is the first copyright statement that meets all of the # following conditions. Subsequent copyright statements are # ignored. # 2. Its format is "Copyright (C)", then a list of copyright years, # and then the name of the copyright holder. # 3. The "(C)" takes one of the following forms or is omitted # entirely: # # A. (C) # B. (c) # C. @copyright{} # D. © # E. © # # 4. The "Copyright" appears at the beginning of a line, except that it # may be prefixed by any sequence (e.g., a comment) of no more than # 5 characters -- including white space. # 5. Iff such a prefix is present, the same prefix appears at the # beginning of each remaining line within the FSF copyright # statement. There is one exception in order to support C-style # comments: if the first line's prefix contains nothing but # whitespace surrounding a "/*", then the prefix for all subsequent # lines is the same as the first line's prefix except with each of # "/" and possibly "*" replaced by a " ". The replacement of "*" # by " " is consistent throughout all subsequent lines. # 6. Blank lines, even if preceded by the prefix, do not appear # within the FSF copyright statement. # 7. Each copyright year is 2 or 4 digits, and years are separated by # commas, "-", or "--". Whitespace may appear after commas. # # Environment variables: # # 1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement # is reformatted even if it does not need updating for the new # year. If unset or set to 0, only updated FSF copyright # statements are reformatted. # 2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive # copyright years (such as 90, 1991, 1992-2007, 2008) in a # reformatted FSF copyright statement is collapsed to a single # interval (such as 1990-2008). If unset or set to 0, all existing # copyright year intervals in a reformatted FSF copyright statement # are expanded instead. # If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps # to the minimal containing range. For example, convert # 2000, 2004-2007, 2009 to 2000-2009. # 3. For testing purposes, you can set the assumed current year in # UPDATE_COPYRIGHT_YEAR. # 4. The default maximum line length for a copyright line is 72. # Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to use a different length. # 5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other # than "Free Software Foundation, Inc.". # This is a prologue that allows to run a perl script as an executable # on systems that are compliant to a POSIX version before POSIX:2017. # On such systems, the usual invocation of an executable through execlp() # or execvp() fails with ENOEXEC if it is a script that does not start # with a #! line. The script interpreter mentioned in the #! line has # to be /bin/sh, because on GuixSD systems that is the only program that # has a fixed file name. The second line is essential for perl and is # also useful for editing this file in Emacs. The next two lines below # are valid code in both sh and perl. When executed by sh, they re-execute # the script through the perl program found in $PATH. The '-x' option # is essential as well; without it, perl would re-execute the script # through /bin/sh. When executed by perl, the next two lines are a no-op. eval 'exec perl -wSx -0777 -pi "$0" "$@"' if 0; my $VERSION = '2020-04-04.15:07'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. use strict; use warnings; my $copyright_re = 'Copyright'; my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|©|©)'; my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER}; $holder ||= 'Free Software Foundation, Inc.'; my $prefix_max = 5; my $margin = $ENV{UPDATE_COPYRIGHT_MAX_LINE_LENGTH}; !$margin || $margin !~ m/^\d+$/ and $margin = 72; my $tab_width = 8; my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR}; if (!$this_year || $this_year !~ m/^\d{4}$/) { my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ()); $this_year = $year + 1900; } # Unless the file consistently uses "\r\n" as the EOL, use "\n" instead. my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n"; my $leading; my $prefix; my $ws_re; my $stmt_re; while (/(^|\n)(.{0,$prefix_max})$copyright_re/g) { $leading = "$1$2"; $prefix = $2; if ($prefix =~ /^(\s*\/)\*(\s*)$/) { $prefix =~ s,/, ,; my $prefix_ws = $prefix; $prefix_ws =~ s/\*/ /; # Only whitespace. if (/\G(?:[^*\n]|\*[^\/\n])*\*?\n$prefix_ws/) { $prefix = $prefix_ws; } } $ws_re = '[ \t\r\f]'; # \s without \n $ws_re = "(?:$ws_re*(?:$ws_re|\\n" . quotemeta($prefix) . ")$ws_re*)"; my $holder_re = $holder; $holder_re =~ s/\s/$ws_re/g; my $stmt_remainder_re = "(?:$ws_re$circle_c_re)?" . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|--?))*" . "((?:\\d\\d)?\\d\\d)$ws_re$holder_re"; if (/\G$stmt_remainder_re/) { $stmt_re = quotemeta($leading) . "($copyright_re$stmt_remainder_re)"; last; } } if (defined $stmt_re) { /$stmt_re/ or die; # Should never die. my $stmt = $1; my $final_year_orig = $2; # Handle two-digit year numbers like "98" and "99". my $final_year = $final_year_orig; $final_year <= 99 and $final_year += 1900; if ($final_year != $this_year) { # Update the year. $stmt =~ s/\b$final_year_orig\b/$final_year, $this_year/; } if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'}) { # Normalize all whitespace including newline-prefix sequences. $stmt =~ s/$ws_re/ /g; # Put spaces after commas. $stmt =~ s/, ?/, /g; # Convert 2-digit to 4-digit years. $stmt =~ s/(\b\d\d\b)/19$1/g; # Make the use of intervals consistent. if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS}) { $stmt =~ s/(\d{4})--?(\d{4})/join(', ', $1..$2)/eg; } else { my $ndash = $ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" : "-"; $stmt =~ s/ (\d{4}) (?: (,\ |--?) ((??{ if ($2 ne ', ') { '\d{4}'; } elsif (!$3) { $1 + 1; } else { $3 + 1; } })) )+ /$1$ndash$3/gx; # When it's 2, emit a single range encompassing all year numbers. $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2 and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1$ndash$2/; } # Format within margin. my $stmt_wrapped; my $text_margin = $margin - length($prefix); if ($prefix =~ /^(\t+)/) { $text_margin -= length($1) * ($tab_width - 1); } while (length $stmt) { if (($stmt =~ s/^(.{1,$text_margin})(?: |$)//) || ($stmt =~ s/^([\S]+)(?: |$)//)) { my $line = $1; $stmt_wrapped .= $stmt_wrapped ? "$eol$prefix" : $leading; $stmt_wrapped .= $line; } else { # Should be unreachable, but we don't want an infinite # loop if it can be reached. die; } } # Replace the old copyright statement. s/$stmt_re/$stmt_wrapped/; } } else { print STDERR "$ARGV: warning: copyright statement not found\n"; } # Hey Emacs! # Local variables: # coding: utf-8 # mode: perl # indent-tabs-mode: nil # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-line-limit: 200 # time-stamp-start: "my $VERSION = '" # time-stamp-format: "%:y-%02m-%02d.%02H:%02M" # time-stamp-time-zone: "UTC0" # time-stamp-end: "'; # UTC" # End: kbuild-3608/src/grep/build-aux/useless-if-before-free0000775000175000017500000001701614670377427022536 0ustar locutuslocutus#!/bin/sh #! -*-perl-*- # Detect instances of "if (p) free (p);". # Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces. # Copyright (C) 2008-2021 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 . # # Written by Jim Meyering # This is a prologue that allows to run a perl script as an executable # on systems that are compliant to a POSIX version before POSIX:2017. # On such systems, the usual invocation of an executable through execlp() # or execvp() fails with ENOEXEC if it is a script that does not start # with a #! line. The script interpreter mentioned in the #! line has # to be /bin/sh, because on GuixSD systems that is the only program that # has a fixed file name. The second line is essential for perl and is # also useful for editing this file in Emacs. The next two lines below # are valid code in both sh and perl. When executed by sh, they re-execute # the script through the perl program found in $PATH. The '-x' option # is essential as well; without it, perl would re-execute the script # through /bin/sh. When executed by perl, the next two lines are a no-op. eval 'exec perl -wSx "$0" "$@"' if 0; my $VERSION = '2021-04-11 10:11'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. my $copyright_year = '2021'; use strict; use warnings; use Getopt::Long; (my $ME = $0) =~ s|.*/||; # use File::Coda; # https://meyering.net/code/Coda/ END { defined fileno STDOUT or return; close STDOUT and return; warn "$ME: failed to close standard output: $!\n"; $? ||= 1; } sub usage ($) { my ($exit_code) = @_; my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); if ($exit_code != 0) { print $STREAM "Try '$ME --help' for more information.\n"; } else { print $STREAM < sub { usage 0 }, version => sub { print "$ME version $VERSION\n"; print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n"; print "License GPLv3+: GNU GPL version 3 or later .\n" . "This is free software: you are free to change and redistribute it.\n" . "There is NO WARRANTY, to the extent permitted by law.\n"; print "\n"; my $author = "Jim Meyering"; print "Written by $author.\n"; exit }, list => \$list, 'name=s@' => \@name, ) or usage 1; # Make sure we have the right number of non-option arguments. # Always tell the user why we fail. @ARGV < 1 and (warn "$ME: missing FILE argument\n"), usage EXIT_ERROR; my $or = join '|', @name; my $regexp = qr/(?:$or)/; # Set the input record separator. # Note: this makes it impractical to print line numbers. $/ = '"'; my $found_match = 0; FILE: foreach my $file (@ARGV) { open FH, '<', $file or (warn "$ME: can't open '$file' for reading: $!\n"), $err = EXIT_ERROR, next; while (defined (my $line = )) { # Skip non-matching lines early to save time $line =~ /\bif\b/ or next; while ($line =~ /\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\) # 1 2 3 (?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;| \s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg) { my $all = $1; my ($lhs, $rhs) = ($2, $3); my ($free_opnd, $braced_free_opnd) = ($4, $5); my $non_NULL; if (!defined $rhs) { $non_NULL = $lhs } elsif (is_NULL $rhs) { $non_NULL = $lhs } elsif (is_NULL $lhs) { $non_NULL = $rhs } else { next } # Compare the non-NULL part of the "if" expression and the # free'd expression, without regard to white space. $non_NULL =~ tr/ \t//d; my $e2 = defined $free_opnd ? $free_opnd : $braced_free_opnd; $e2 =~ tr/ \t//d; if ($non_NULL eq $e2) { $found_match = 1; $list and (print "$file\0"), next FILE; print "$file: $all\n"; } } } } continue { close FH; } $found_match && $err == EXIT_NO_MATCH and $err = EXIT_MATCH; exit $err; } my $foo = <<'EOF'; # The above is to *find* them. # This adjusts them, removing the unnecessary "if (p)" part. # FIXME: do something like this as an option (doesn't do braces): free=xfree git grep -l -z "$free *(" \ | xargs -0 useless-if-before-free -l --name="$free" \ | xargs -0 perl -0x3b -pi -e \ 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s' # Use the following to remove redundant uses of kfree inside braces. # Note that -0777 puts perl in slurp-whole-file mode; # but we have plenty of memory, these days... free=kfree git grep -l -z "$free *(" \ | xargs -0 useless-if-before-free -l --name="$free" \ | xargs -0 perl -0777 -pi -e \ 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s*\{\s*('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\);)\s*\}[^\n]*$/$2/gms' Be careful that the result of the above transformation is valid. If the matched string is followed by "else", then obviously, it won't be. When modifying files, refuse to process anything other than a regular file. EOF ## Local Variables: ## mode: perl ## indent-tabs-mode: nil ## eval: (add-hook 'before-save-hook 'time-stamp) ## time-stamp-line-limit: 50 ## time-stamp-start: "my $VERSION = '" ## time-stamp-format: "%:y-%02m-%02d %02H:%02M" ## time-stamp-time-zone: "UTC0" ## time-stamp-end: "'; # UTC" ## End: kbuild-3608/src/grep/build-aux/gnupload0000775000175000017500000003266614670377427020121 0ustar locutuslocutus#!/bin/sh # Sign files and upload them. scriptversion=2021-04-11.09; # UTC # Copyright (C) 2004-2021 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 2, 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 . # Originally written by Alexandre Duret-Lutz . # The master copy of this file is maintained in the gnulib Git repository. # Please send bug reports and feature requests to bug-gnulib@gnu.org. set -e GPG=gpg # Choose the proper version of gpg, so as to avoid a # "gpg-agent is not available in this session" error # when gpg-agent is version 2 but gpg is still version 1. # FIXME-2020: remove, once all major distros ship gpg version 2 as /usr/bin/gpg gpg_agent_version=`(gpg-agent --version) 2>/dev/null | sed -e '2,$d' -e 's/^[^0-9]*//'` case "$gpg_agent_version" in 2.*) gpg_version=`(gpg --version) 2>/dev/null | sed -e '2,$d' -e 's/^[^0-9]*//'` case "$gpg_version" in 1.*) if (type gpg2) >/dev/null 2>/dev/null; then # gpg2 is present. GPG=gpg2 else # gpg2 is missing. Ubuntu users should install the package 'gnupg2'. echo "WARNING: Using 'gpg', which is too old. You should install 'gpg2'." 1>&2 fi ;; esac ;; esac GPG="${GPG} --batch --no-tty" conffile=.gnuploadrc to= dry_run=false replace= symlink_files= delete_files= delete_symlinks= collect_var= dbg= nl=' ' usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...] Sign all FILES, and process them at the destinations specified with --to. If CMD is not given, it defaults to uploading. See examples below. Commands: --delete delete FILES from destination --symlink create symbolic links --rmsymlink remove symbolic links -- treat the remaining arguments as files to upload Options: --to DEST specify a destination DEST for FILES (multiple --to options are allowed) --user NAME sign with key NAME --replace allow replacements of existing files --symlink-regex[=EXPR] use sed script EXPR to compute symbolic link names -n, --dry-run do nothing, show what would have been done (including the constructed directive file) --version output version information and exit -h, --help print this help text and exit If --symlink-regex is given without EXPR, then the link target name is created by replacing the version information with '-latest', e.g.: foo-1.3.4.tar.gz -> foo-latest.tar.gz Recognized destinations are: alpha.gnu.org:DIRECTORY savannah.gnu.org:DIRECTORY savannah.nongnu.org:DIRECTORY ftp.gnu.org:DIRECTORY build directive files and upload files by FTP download.gnu.org.ua:{alpha|ftp}/DIRECTORY build directive files and upload files by SFTP [user@]host:DIRECTORY upload files with scp Options and commands are applied in order. If the file $conffile exists in the current working directory, its contents are prepended to the actual command line options. Use this to keep your defaults. Comments (#) and empty lines in $conffile are allowed. gives some further background. Examples: 1. Upload foobar-1.0.tar.gz to ftp.gnu.org: gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz 2. Upload foobar-1.0.tar.gz and foobar-1.0.tar.xz to ftp.gnu.org: gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz foobar-1.0.tar.xz 3. Same as above, and also create symbolic links to foobar-latest.tar.*: gnupload --to ftp.gnu.org:foobar \\ --symlink-regex \\ foobar-1.0.tar.gz foobar-1.0.tar.xz 4. Create a symbolic link foobar-latest.tar.gz -> foobar-1.0.tar.gz and likewise for the corresponding .sig file: gnupload --to ftp.gnu.org:foobar \\ --symlink foobar-1.0.tar.gz foobar-latest.tar.gz \\ foobar-1.0.tar.gz.sig foobar-latest.tar.gz.sig or (equivalent): gnupload --to ftp.gnu.org:foobar \\ --symlink foobar-1.0.tar.gz foobar-latest.tar.gz \\ --symlink foobar-1.0.tar.gz.sig foobar-latest.tar.gz.sig 5. Upload foobar-0.9.90.tar.gz to two sites: gnupload --to alpha.gnu.org:foobar \\ --to sources.redhat.com:~ftp/pub/foobar \\ foobar-0.9.90.tar.gz 6. Delete oopsbar-0.9.91.tar.gz and upload foobar-0.9.91.tar.gz (the -- terminates the list of files to delete): gnupload --to alpha.gnu.org:foobar \\ --to sources.redhat.com:~ftp/pub/foobar \\ --delete oopsbar-0.9.91.tar.gz \\ -- foobar-0.9.91.tar.gz gnupload executes a program ncftpput to do the transfers; if you don't happen to have an ncftp package installed, the ncftpput-ftp script in the build-aux/ directory of the gnulib package (https://savannah.gnu.org/projects/gnulib) may serve as a replacement. Send patches and bug reports to ." copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'` copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc. License GPLv2+: GNU GPL version 2 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." # Read local configuration file if test -r "$conffile"; then echo "$0: Reading configuration file $conffile" conf=`sed 's/#.*$//;/^$/d' "$conffile" | tr "\015$nl" ' '` eval set x "$conf \"\$@\"" shift fi while test -n "$1"; do case $1 in -*) collect_var= case $1 in -h | --help) echo "$usage" exit $? ;; --to) if test -z "$2"; then echo "$0: Missing argument for --to" 1>&2 exit 1 elif echo "$2" | grep 'ftp-upload\.gnu\.org' >/dev/null; then echo "$0: Use ftp.gnu.org:PKGNAME or alpha.gnu.org:PKGNAME" >&2 echo "$0: for the destination, not ftp-upload.gnu.org (which" >&2 echo "$0: is used for direct ftp uploads, not with gnupload)." >&2 echo "$0: See --help and its examples if need be." >&2 exit 1 else to="$to $2" shift fi ;; --user) if test -z "$2"; then echo "$0: Missing argument for --user" 1>&2 exit 1 else GPG="$GPG --local-user $2" shift fi ;; --delete) collect_var=delete_files ;; --replace) replace="replace: true" ;; --rmsymlink) collect_var=delete_symlinks ;; --symlink-regex=*) symlink_expr=`expr "$1" : '[^=]*=\(.*\)'` ;; --symlink-regex) symlink_expr='s|-[0-9][0-9\.]*\(-[0-9][0-9]*\)\{0,1\}\.|-latest.|' ;; --symlink) collect_var=symlink_files ;; -n | --dry-run) dry_run=: ;; --version) echo "gnupload $scriptversion" echo "$copyright" exit 0 ;; --) shift break ;; -*) echo "$0: Unknown option '$1', try '$0 --help'" 1>&2 exit 1 ;; esac ;; *) if test -z "$collect_var"; then break else eval "$collect_var=\"\$$collect_var $1\"" fi ;; esac shift done dprint() { echo "Running $* ..." } if $dry_run; then dbg=dprint fi if test -z "$to"; then echo "$0: Missing destination sites" >&2 exit 1 fi if test -n "$symlink_files"; then x=`echo "$symlink_files" | sed 's/[^ ]//g;s/ //g'` if test -n "$x"; then echo "$0: Odd number of symlink arguments" >&2 exit 1 fi fi if test $# = 0; then if test -z "${symlink_files}${delete_files}${delete_symlinks}"; then echo "$0: No file to upload" 1>&2 exit 1 fi else # Make sure all files exist. We don't want to ask # for the passphrase if the script will fail. for file do if test ! -f $file; then echo "$0: Cannot find '$file'" 1>&2 exit 1 elif test -n "$symlink_expr"; then linkname=`echo $file | sed "$symlink_expr"` if test -z "$linkname"; then echo "$0: symlink expression produces empty results" >&2 exit 1 elif test "$linkname" = $file; then echo "$0: symlink expression does not alter file name" >&2 exit 1 fi fi done fi # Make sure passphrase is not exported in the environment. unset passphrase unset passphrase_fd_0 GNUPGHOME=${GNUPGHOME:-$HOME/.gnupg} # Reset PATH to be sure that echo is a built-in. We will later use # 'echo $passphrase' to output the passphrase, so it is important that # it is a built-in (third-party programs tend to appear in 'ps' # listings with their arguments...). # Remember this script runs with 'set -e', so if echo is not built-in # it will exit now. if $dry_run || grep -q "^use-agent" $GNUPGHOME/gpg.conf; then :; else PATH=/empty echo -n "Enter GPG passphrase: " stty -echo read -r passphrase stty echo echo passphrase_fd_0="--passphrase-fd 0" fi if test $# -ne 0; then for file do echo "Signing $file ..." rm -f $file.sig echo "$passphrase" | $dbg $GPG $passphrase_fd_0 -ba -o $file.sig $file done fi # mkdirective DESTDIR BASE FILE STMT # Arguments: See upload, below mkdirective () { stmt="$4" if test -n "$3"; then stmt=" filename: $3$stmt" fi cat >${2}.directive<&2 fi $dbg ncftpput savannah.gnu.org /incoming/savannah/$destdir $files ;; savannah.nongnu.org:*) if test -z "$files"; then echo "$0: warning: standalone directives not applicable for $dest" >&2 fi $dbg ncftpput savannah.nongnu.org /incoming/savannah/$destdir $files ;; download.gnu.org.ua:alpha/*|download.gnu.org.ua:ftp/*) destdir_p1=`echo "$destdir" | sed 's,^[^/]*/,,'` destdir_topdir=`echo "$destdir" | sed 's,/.*,,'` mkdirective "$destdir_p1" "$base" "$file" "$stmt" echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive for f in $files $base.directive.asc do echo put $f done | $dbg sftp -b - puszcza.gnu.org.ua:/incoming/$destdir_topdir ;; /*) dest_host=`echo "$dest" | sed 's,:.*,,'` mkdirective "$destdir" "$base" "$file" "$stmt" echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive $dbg cp $files $base.directive.asc $dest_host ;; *) if test -z "$files"; then echo "$0: warning: standalone directives not applicable for $dest" >&2 fi $dbg scp $files $dest ;; esac rm -f $base.directive $base.directive.asc } ##### # Process any standalone directives stmt= if test -n "$symlink_files"; then stmt="$stmt `mksymlink $symlink_files`" fi for file in $delete_files do stmt="$stmt archive: $file" done for file in $delete_symlinks do stmt="$stmt rmsymlink: $file" done if test -n "$stmt"; then for dest in $to do destdir=`echo $dest | sed 's/[^:]*://'` upload "$dest" "$destdir" "`hostname`-$$" "" "$stmt" done fi # Process actual uploads for dest in $to do for file do echo "Uploading $file to $dest ..." stmt= # # allowing file replacement is all or nothing. if test -n "$replace"; then stmt="$stmt $replace" fi # files="$file $file.sig" destdir=`echo $dest | sed 's/[^:]*://'` if test -n "$symlink_expr"; then linkname=`echo $file | sed "$symlink_expr"` stmt="$stmt symlink: $file $linkname symlink: $file.sig $linkname.sig" fi upload "$dest" "$destdir" "$file" "$file" "$stmt" "$files" done done exit 0 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: kbuild-3608/src/grep/build-aux/gendocs.sh0000775000175000017500000004147314670377427020337 0ustar locutuslocutus#!/bin/sh -e # gendocs.sh -- generate a GNU manual in many formats. This script is # mentioned in maintain.texi. See the help message below for usage details. scriptversion=2021-07-19.18 # Copyright 2003-2021 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 . # # Original author: Mohit Agarwal. # Send bug reports and any other correspondence to bug-gnulib@gnu.org. # # The latest version of this script, and the companion template, is # available from the Gnulib repository: # # https://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/gendocs.sh # https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/gendocs_template # TODO: # - image importing was only implemented for HTML generated by # makeinfo. But it should be simple enough to adjust. # - images are not imported in the source tarball. All the needed # formats (PDF, PNG, etc.) should be included. prog=`basename "$0"` srcdir=`pwd` scripturl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh" templateurl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template" : ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="} : ${MAKEINFO="makeinfo"} : ${TEXI2DVI="texi2dvi"} : ${DOCBOOK2HTML="docbook2html"} : ${DOCBOOK2PDF="docbook2pdf"} : ${DOCBOOK2TXT="docbook2txt"} : ${GENDOCS_TEMPLATE_DIR="."} : ${PERL='perl'} : ${TEXI2HTML="texi2html"} unset CDPATH unset use_texi2html MANUAL_TITLE= PACKAGE= EMAIL=webmasters@gnu.org # please override with --email commonarg= # passed to all makeinfo/texi2html invcations. dirargs= # passed to all tools (-I dir). dirs= # -I directories. htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual" default_htmlarg=true infoarg=--no-split generate_ascii=true generate_html=true generate_info=true generate_tex=true outdir=manual source_extra= split=node srcfile= texarg="-t @finalout" version="gendocs.sh $scriptversion Copyright 2021 Free Software Foundation, Inc. There is NO warranty. You may redistribute this software under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING." usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE Generate output in various formats from PACKAGE.texinfo (or .texi or .txi) source. See the GNU Maintainers document for a more extensive discussion: https://www.gnu.org/prep/maintain_toc.html Options: --email ADR use ADR as contact in generated web pages; always give this. -s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi} -o OUTDIR write files into OUTDIR, instead of manual/. -I DIR append DIR to the Texinfo search path. --common ARG pass ARG in all invocations. --html ARG pass ARG to makeinfo or texi2html for HTML targets, instead of '$htmlarg'. --info ARG pass ARG to makeinfo for Info, instead of --no-split. --no-ascii skip generating the plain text output. --no-html skip generating the html output. --no-info skip generating the info output. --no-tex skip generating the dvi and pdf output. --source ARG include ARG in tar archive of sources. --split HOW make split HTML by node, section, chapter; default node. --tex ARG pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout. --texi2html use texi2html to make HTML target, with all split versions. --docbook convert through DocBook too (xml, txt, html, pdf). --help display this help and exit successfully. --version display version information and exit successfully. Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\" Typical sequence: cd PACKAGESOURCE/doc wget \"$scripturl\" wget \"$templateurl\" $prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\" Output will be in a new subdirectory \"manual\" (by default; use -o OUTDIR to override). Move all the new files into your web CVS tree, as explained in the Web Pages node of maintain.texi. Please use the --email ADDRESS option so your own bug-reporting address will be used in the generated HTML pages. MANUAL-TITLE is included as part of the HTML of the overall manual/index.html file. It should include the name of the package being documented. manual/index.html is created by substitution from the file $GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the generic template for your own purposes.) If you have several manuals, you'll need to run this script several times with different MANUAL values, specifying a different output directory with -o each time. Then write (by hand) an overall index.html with links to them all. If a manual's Texinfo sources are spread across several directories, first copy or symlink all Texinfo sources into a single directory. (Part of the script's work is to make a tar.gz of the sources.) As implied above, by default monolithic Info files are generated. If you want split Info, or other Info options, use --info to override. You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML, and PERL to control the programs that get executed, and GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is looked for. With --docbook, the environment variables DOCBOOK2HTML, DOCBOOK2PDF, and DOCBOOK2TXT are also consulted. By default, makeinfo and texi2dvi are run in the default (English) locale, since that's the language of most Texinfo manuals. If you happen to have a non-English manual and non-English web site, see the SETLANG setting in the source. Email bug reports or enhancement requests to bug-gnulib@gnu.org. " while test $# -gt 0; do case $1 in -s) shift; srcfile=$1;; -o) shift; outdir=$1;; -I) shift; dirargs="$dirargs -I '$1'"; dirs="$dirs $1";; --common) shift; commonarg=$1;; --docbook) docbook=yes;; --email) shift; EMAIL=$1;; --html) shift; default_htmlarg=false; htmlarg=$1;; --info) shift; infoarg=$1;; --no-ascii) generate_ascii=false;; --no-html) generate_ascii=false;; --no-info) generate_info=false;; --no-tex) generate_tex=false;; --source) shift; source_extra=$1;; --split) shift; split=$1;; --tex) shift; texarg=$1;; --texi2html) use_texi2html=1;; --help) echo "$usage"; exit 0;; --version) echo "$version"; exit 0;; -*) echo "$0: Unknown option \`$1'." >&2 echo "$0: Try \`--help' for more information." >&2 exit 1;; *) if test -z "$PACKAGE"; then PACKAGE=$1 elif test -z "$MANUAL_TITLE"; then MANUAL_TITLE=$1 else echo "$0: extra non-option argument \`$1'." >&2 exit 1 fi;; esac shift done # makeinfo uses the dirargs, but texi2dvi doesn't. commonarg=" $dirargs $commonarg" # For most of the following, the base name is just $PACKAGE base=$PACKAGE if $default_htmlarg && test -n "$use_texi2html"; then # The legacy texi2html doesn't support TOP_NODE_UP_URL htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css" fi if test -n "$srcfile"; then # but here, we use the basename of $srcfile base=`basename "$srcfile"` case $base in *.txi|*.texi|*.texinfo) base=`echo "$base"|sed 's/\.[texinfo]*$//'`;; esac PACKAGE=$base elif test -s "$srcdir/$PACKAGE.texinfo"; then srcfile=$srcdir/$PACKAGE.texinfo elif test -s "$srcdir/$PACKAGE.texi"; then srcfile=$srcdir/$PACKAGE.texi elif test -s "$srcdir/$PACKAGE.txi"; then srcfile=$srcdir/$PACKAGE.txi else echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2 exit 1 fi if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2 echo "$0: it is available from $templateurl." >&2 exit 1 fi # Function to return size of $1 in something resembling kilobytes. calcsize() { size=`ls -ksl $1 | awk '{print $1}'` echo $size } # copy_images OUTDIR HTML-FILE... # ------------------------------- # Copy all the images needed by the HTML-FILEs into OUTDIR. # Look for them in . and the -I directories; this is simpler than what # makeinfo supports with -I, but hopefully it will suffice. copy_images() { local odir odir=$1 shift $PERL -n -e " BEGIN { \$me = '$prog'; \$odir = '$odir'; @dirs = qw(. $dirs); } " -e ' /<img src="(.*?)"/g && ++$need{$1}; END { #print "$me: @{[keys %need]}\n"; # for debugging, show images found. FILE: for my $f (keys %need) { for my $d (@dirs) { if (-f "$d/$f") { use File::Basename; my $dest = dirname ("$odir/$f"); # use File::Path; -d $dest || mkpath ($dest) || die "$me: cannot mkdir $dest: $!\n"; # use File::Copy; copy ("$d/$f", $dest) || die "$me: cannot copy $d/$f to $dest: $!\n"; next FILE; } } die "$me: $ARGV: cannot find image $f\n"; } } ' -- "$@" || exit 1 } case $outdir in /*) abs_outdir=$outdir;; *) abs_outdir=$srcdir/$outdir;; esac echo "Making output for $srcfile" echo " in `pwd`" mkdir -p "$outdir/" # if $generate_info; then cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\"" echo "Generating info... ($cmd)" rm -f $PACKAGE.info* # get rid of any strays eval "$cmd" tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info* ls -l "$outdir/$PACKAGE.info.tar.gz" info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"` # do not mv the info files, there's no point in having them available # separately on the web. fi # end info # if $generate_tex; then cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\"" printf "\nGenerating dvi... ($cmd)\n" eval "$cmd" # compress/finish dvi: gzip -f -9 $PACKAGE.dvi dvi_gz_size=`calcsize $PACKAGE.dvi.gz` mv $PACKAGE.dvi.gz "$outdir/" ls -l "$outdir/$PACKAGE.dvi.gz" cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\"" printf "\nGenerating pdf... ($cmd)\n" eval "$cmd" pdf_size=`calcsize $PACKAGE.pdf` mv $PACKAGE.pdf "$outdir/" ls -l "$outdir/$PACKAGE.pdf" fi # end tex (dvi + pdf) # if $generate_ascii; then opt="-o $PACKAGE.txt --no-split --no-headers $commonarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\"" printf "\nGenerating ascii... ($cmd)\n" eval "$cmd" ascii_size=`calcsize $PACKAGE.txt` gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz" ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"` mv $PACKAGE.txt "$outdir/" ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz" fi # if $generate_html; then # Split HTML at level $1. Used for texi2html. html_split() { opt="--split=$1 --node-files $commonarg $htmlarg" cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\"" printf "\nGenerating html by $1... ($cmd)\n" eval "$cmd" split_html_dir=$PACKAGE.html ( cd ${split_html_dir} || exit 1 ln -sf ${PACKAGE}.html index.html tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html ) eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"` rm -f "$outdir"/html_$1/*.html mkdir -p "$outdir/html_$1/" mv ${split_html_dir}/*.html "$outdir/html_$1/" rmdir ${split_html_dir} } if test -z "$use_texi2html"; then opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\"" printf "\nGenerating monolithic html... ($cmd)\n" rm -rf $PACKAGE.html # in case a directory is left over eval "$cmd" html_mono_size=`calcsize $PACKAGE.html` gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz" html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"` copy_images "$outdir/" $PACKAGE.html mv $PACKAGE.html "$outdir/" ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz" # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option, # it just always split by node. So if we're splitting by node anyway, # leave it out. if test "x$split" = xnode; then split_arg= else split_arg=--split=$split fi # opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\"" printf "\nGenerating html by $split... ($cmd)\n" eval "$cmd" split_html_dir=$PACKAGE.html copy_images $split_html_dir/ $split_html_dir/*.html ( cd $split_html_dir || exit 1 tar -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- * ) eval \ html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"` rm -rf "$outdir/html_$split/" mv $split_html_dir "$outdir/html_$split/" du -s "$outdir/html_$split/" ls -l "$outdir/$PACKAGE.html_$split.tar.gz" else # use texi2html: opt="--output $PACKAGE.html $commonarg $htmlarg" cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\"" printf "\nGenerating monolithic html with texi2html... ($cmd)\n" rm -rf $PACKAGE.html # in case a directory is left over eval "$cmd" html_mono_size=`calcsize $PACKAGE.html` gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz" html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"` mv $PACKAGE.html "$outdir/" html_split node html_split chapter html_split section fi fi # end html # printf "\nMaking .tar.gz for sources...\n" d=`dirname $srcfile` ( cd "$d" srcfiles=`ls -d *.texinfo *.texi *.txi *.eps $source_extra 2>/dev/null` || true tar czfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles ls -l "$abs_outdir/$PACKAGE.texi.tar.gz" ) texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"` # # Do everything again through docbook. if test -n "$docbook"; then opt="-o - --docbook $commonarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml" printf "\nGenerating docbook XML... ($cmd)\n" eval "$cmd" docbook_xml_size=`calcsize $PACKAGE-db.xml` gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz" docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"` mv $PACKAGE-db.xml "$outdir/" split_html_db_dir=html_node_db opt="$commonarg -o $split_html_db_dir" cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\"" printf "\nGenerating docbook HTML... ($cmd)\n" eval "$cmd" ( cd ${split_html_db_dir} || exit 1 tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html ) html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"` rm -f "$outdir"/html_node_db/*.html mkdir -p "$outdir/html_node_db" mv ${split_html_db_dir}/*.html "$outdir/html_node_db/" rmdir ${split_html_db_dir} cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\"" printf "\nGenerating docbook ASCII... ($cmd)\n" eval "$cmd" docbook_ascii_size=`calcsize $PACKAGE-db.txt` mv $PACKAGE-db.txt "$outdir/" cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\"" printf "\nGenerating docbook PDF... ($cmd)\n" eval "$cmd" docbook_pdf_size=`calcsize $PACKAGE-db.pdf` mv $PACKAGE-db.pdf "$outdir/" fi # printf "\nMaking index.html for $PACKAGE...\n" if test -z "$use_texi2html"; then CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\ /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d" else # should take account of --split here. CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d" fi curdate=`$SETLANG date '+%B %d, %Y'` sed \ -e "s!%%TITLE%%!$MANUAL_TITLE!g" \ -e "s!%%EMAIL%%!$EMAIL!g" \ -e "s!%%PACKAGE%%!$PACKAGE!g" \ -e "s!%%DATE%%!$curdate!g" \ -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \ -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \ -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \ -e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \ -e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \ -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \ -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \ -e "s!%%PDF_SIZE%%!$pdf_size!g" \ -e "s!%%ASCII_SIZE%%!$ascii_size!g" \ -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \ -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \ -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \ -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \ -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \ -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \ -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \ -e "s,%%SCRIPTURL%%,$scripturl,g" \ -e "s!%%SCRIPTNAME%%!$prog!g" \ -e "$CONDS" \ $GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html" echo "Done, see $outdir/ subdirectory for new files." # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/build-aux/texinfo.tex����������������������������������������������������������0000664�0001750�0001750�00001332726�14670377427�020561� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������% texinfo.tex -- TeX macros to handle Texinfo files. % % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % \def\texinfoversion{2021-04-25.21} % % Copyright 1985, 1986, 1988, 1990-2021 Free Software Foundation, Inc. % % This texinfo.tex file 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 texinfo.tex 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. % % You should have received a copy of the GNU General Public License % along with this program. If not, see <https://www.gnu.org/licenses/>. % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without % restriction. This Exception is an additional permission under section 7 % of the GNU General Public License, version 3 ("GPLv3"). % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: % https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or % https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or % https://www.gnu.org/software/texinfo/ (the Texinfo home page) % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % % Send bug reports to bug-texinfo@gnu.org. Please include a % complete document in each bug report with which we can reproduce the % problem. Patches are, of course, greatly appreciated. % % To process a Texinfo manual with TeX, it's most reliable to use the % texi2dvi shell script that comes with the distribution. For a simple % manual foo.texi, however, you can get away with this: % tex foo.texi % texindex foo.?? % tex foo.texi % tex foo.texi % dvips foo.dvi -o # or whatever; this makes foo.ps. % The extra TeX runs get the cross-reference information correct. % Sometimes one run after texindex suffices, and sometimes you need more % than two; texi2dvi does it as many times as necessary. % % It is possible to adapt texinfo.tex for other languages, to some % extent. You can get the existing language-specific files from the % full Texinfo distribution. % % The GNU Texinfo home page is https://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} % If in a .fmt file, print the version number % and turn on active characters that we couldn't do earlier because % they might have appeared in the input file name. \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} % LaTeX's \typeout. This ensures that the messages it is used for % are identical in format to the corresponding ones from latex/pdflatex. \def\typeout{\immediate\write17}% \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. % For @tex, we can use \tabalign. \let\+ = \relax % Save some plain tex macros whose names we will redefine. \let\ptexb=\b \let\ptexbullet=\bullet \let\ptexc=\c \let\ptexcomma=\, \let\ptexdot=\. \let\ptexdots=\dots \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! \let\ptexfootnote=\footnote \let\ptexgtr=> \let\ptexhat=^ \let\ptexi=\i \let\ptexindent=\indent \let\ptexinsert=\insert \let\ptexlbrace=\{ \let\ptexless=< \let\ptexnewwrite\newwrite \let\ptexnoindent=\noindent \let\ptexplus=+ \let\ptexraggedright=\raggedright \let\ptexrbrace=\} \let\ptexslash=\/ \let\ptexsp=\sp \let\ptexstar=\* \let\ptexsup=\sup \let\ptext=\t \let\ptextop=\top {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode % If this character appears in an error message or help string, it % starts a new line in the output. \newlinechar = `^^J % Use TeX 3.0's \inputlineno to get the line number, for better error % messages, but if we're using an old version of TeX, don't do anything. % \ifx\inputlineno\thisisundefined \let\linenumber = \empty % Pre-3.0. \else \def\linenumber{l.\the\inputlineno:\space} \fi % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi \ifx\putworderror\undefined \gdef\putworderror{error}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi \ifx\putwordof\undefined \gdef\putwordof{of}\fi \ifx\putwordon\undefined \gdef\putwordon{on}\fi \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi % \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi % \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi % Give the space character the catcode for a space. \def\spaceisspace{\catcode`\ =10\relax} % Likewise for ^^M, the end of line character. \def\endlineisspace{\catcode13=10\relax} \chardef\dashChar = `\- \chardef\slashChar = `\/ \chardef\underChar = `\_ % Ignore a token. % \def\gobble#1{} % The following is used inside several \edef's. \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} % Hyphenation fixes. \hyphenation{ Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script ap-pen-dix bit-map bit-maps data-base data-bases eshell fall-ing half-way long-est man-u-script man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces spell-ing spell-ings stand-alone strong-est time-stamp time-stamps which-ever white-space wide-spread wrap-around } % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, % since that produces some useless output on the terminal. We also make % some effort to order the tracing commands to reduce output in the log % file; cf. trace.sty in LaTeX. % \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% \def\loggingall{% \tracingstats2 \tracingpages1 \tracinglostchars2 % 2 gives us more in etex \tracingparagraphs1 \tracingoutput1 \tracingmacros2 \tracingrestores1 \showboxbreadth\maxdimen \showboxdepth\maxdimen \ifx\eTeXversion\thisisundefined\else % etex gives us more logging \tracingscantokens1 \tracingifs1 \tracinggroups1 \tracingnesting2 \tracingassigns1 \fi \tracingcommands3 % 3 gives us more in etex \errorcontextlines16 }% % @errormsg{MSG}. Do the index-like expansions on MSG, but if things % aren't perfect, it's not the end of the world, being an error message, % after all. % \def\errormsg{\begingroup \indexnofonts \doerrormsg} \def\doerrormsg#1{\errmessage{#1}} % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. % \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount \removelastskip\penalty-50\smallskip\fi\fi} \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount \removelastskip\penalty-100\medskip\fi\fi} \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} % Output routine % % For a final copy, take out the rectangles % that mark overfull boxes (in case you have decided % that the text looks ok even though it passes the margin). % \def\finalout{\overfullrule=0pt } \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines \newdimen\topandbottommargin \topandbottommargin=.75in % Output a mark which sets \thischapter, \thissection and \thiscolor. % We dump everything together because we only have one kind of mark. % This works because we only use \botmark / \topmark, not \firstmark. % % A mark contains a subexpression of the \ifcase ... \fi construct. % \get*marks macros below extract the needed part using \ifcase. % % Another complication is to let the user choose whether \thischapter % (\thissection) refers to the chapter (section) in effect at the top % of a page, or that at the bottom of a page. % \domark is called twice inside \chapmacro, to add one % mark before the section break, and one after. % In the second call \prevchapterdefs is the same as \currentchapterdefs, % and \prevsectiondefs is the same as \currentsectiondefs. % Then if the page is not broken at the mark, some of the previous % section appears on the page, and we can get the name of this section % from \firstmark for @everyheadingmarks top. % @everyheadingmarks bottom uses \botmark. % % See page 260 of The TeXbook. \def\domark{% \toks0=\expandafter{\currentchapterdefs}% \toks2=\expandafter{\currentsectiondefs}% \toks4=\expandafter{\prevchapterdefs}% \toks6=\expandafter{\prevsectiondefs}% \toks8=\expandafter{\currentcolordefs}% \mark{% \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom \noexpand\else \the\toks8 % 2: color marks }% } % \gettopheadingmarks, \getbottomheadingmarks, % \getcolormarks - extract needed part of mark. % % \topmark doesn't work for the very first chapter (after the title % page or the contents), so we use \firstmark there -- this gets us % the mark with the chapter defs, unless the user sneaks in, e.g., % @setcolor (or @url, or @link, etc.) between @contents and the very % first @chapter. \def\gettopheadingmarks{% \ifcase0\the\savedtopmark\fi \ifx\thischapter\empty \ifcase0\firstmark\fi \fi } \def\getbottomheadingmarks{\ifcase1\botmark\fi} \def\getcolormarks{\ifcase2\the\savedtopmark\fi} % Avoid "undefined control sequence" errors. \def\currentchapterdefs{} \def\currentsectiondefs{} \def\currentsection{} \def\prevchapterdefs{} \def\prevsectiondefs{} \def\currentcolordefs{} % Margin to add to right of even pages, to left of odd pages. \newdimen\bindingoffset \newdimen\normaloffset \newdimen\txipagewidth \newdimen\txipageheight % Main output routine. % \chardef\PAGE = 255 \newtoks\defaultoutput \defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}} \output=\expandafter{\the\defaultoutput} \newbox\headlinebox \newbox\footlinebox % When outputting the double column layout for indices, an output routine % is run several times, which hides the original value of \topmark. This % can lead to a page heading being output and duplicating the chapter heading % of the index. Hence, save the contents of \topmark at the beginning of % the output routine. The saved contents are valid until we actually % \shipout a page. % % (We used to run a short output routine to actually set \topmark and % \firstmark to the right values, but if this was called with an empty page % containing whatsits for writing index entries, the whatsits would be thrown % away and the index auxiliary file would remain empty.) % \newtoks\savedtopmark \newif\iftopmarksaved \topmarksavedtrue \def\savetopmark{% \iftopmarksaved\else \global\savedtopmark=\expandafter{\topmark}% \global\topmarksavedtrue \fi } % \onepageout takes a vbox as an argument. % \shipout a vbox for a single page, adding an optional header, footer % and footnote. This also causes index entries for this page to be written % to the auxiliary files. % \def\onepageout#1{% \hoffset=\normaloffset % \ifodd\pageno \advance\hoffset by \bindingoffset \else \advance\hoffset by -\bindingoffset\fi % \checkchapterpage % % Retrieve the information for the headings from the marks in the page, % and call Plain TeX's \makeheadline and \makefootline, which use the % values in \headline and \footline. % % Common context changes for both heading and footing. % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars} % \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}% \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}% % {% % Set context for writing to auxiliary files like index files. % Have to do this stuff outside the \shipout because we want it to % take effect in \write's, yet the group defined by the \vbox ends % before the \shipout runs. % \atdummies % don't expand commands in the output. \turnoffactive \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi % \unvbox\headlinebox \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. \vskip 24pt \unvbox\footlinebox \fi % }% }% \global\topmarksavedfalse \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } \newinsert\margin \dimen\margin=\maxdimen % Main part of page, including any footnotes \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}} {\catcode`\@ =11 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi % marginal hacks, juha@viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi \dimen@=\dp#1\relax \unvbox#1\relax \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr@ggedbottom \kern-\dimen@ \vfil \fi} } % Check if we are on the first page of a chapter. Used for printing headings. \newif\ifchapterpage \def\checkchapterpage{% % Get the chapter that was current at the end of the last page \ifcase1\the\savedtopmark\fi \let\prevchaptername\thischaptername % \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \let\curchaptername\thischaptername % \ifx\curchaptername\prevchaptername \chapterpagefalse \else \chapterpagetrue \fi } % Argument parsing % Parse an argument, then pass it to #1. The argument is the rest of % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. % For example, \def\foo{\parsearg\fooxxx}. % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% \def\argtorun{#2}% \begingroup \obeylines \spaceisspace #1% \parseargline\empty% Insert the \empty token, see \finishparsearg below. } {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. \argremovecomment #1\comment\ArgTerm% }% } % First remove any @comment, then any @c comment. Pass the result on to % \argcheckspaces. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo % This space token undergoes the same procedure and is eventually removed % by \finishparsearg. % \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% \def\temp{#3}% \ifx\temp\empty % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: \let\temp\finishparsearg \else \let\temp\argcheckspaces \fi % Put the space token in: \temp#1 #3\ArgTerm } % If a _delimited_ argument is enclosed in braces, they get stripped; so % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, % just before passing the control to \argtorun. % (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % % But first, we have to remove the trailing space token. % \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} % \parseargdef - define a command taking an argument on the line % % \parseargdef\foo{...} % is roughly equivalent to % \def\foo{\parsearg\Xfoo} % \def\Xfoo#1{...} \def\parseargdef#1{% \expandafter \doparseargdef \csname\string#1\endcsname #1% } \def\doparseargdef#1#2{% \def#2{\parsearg#1}% \def#1##1% } % Several utility definitions with active space: { \obeyspaces \gdef\obeyedspace{ } % Make each space character in the input produce a normal interword % space in the output. Don't allow a line break at this space, as this % is used only in environments like @example, where each line of input % should produce a line of output anyway. % \gdef\sepspaces{\obeyspaces\let =\tie} % If an index command is used in an @example environment, any spaces % therein should become regular spaces in the raw index file, not the % expansion of \tie (\leavevmode \penalty \@M \ ). \gdef\unsepspaces{\let =\space} } \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} % Define the framework for environments in texinfo.tex. It's used like this: % % \envdef\foo{...} % \def\Efoo{...} % % It's the responsibility of \envdef to insert \begingroup before the % actual body; @end closes the group after calling \Efoo. \envdef also % defines \thisenv, so the current environment is known; @end checks % whether the environment name matches. The \checkenv macro can also be % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they % are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) % At run-time, environments start with this: \def\startenvironment#1{\begingroup\def\thisenv{#1}} % initialize \let\thisenv\empty % ... but they get defined via ``\envdef\foo{...}'': \long\def\envdef#1#2{\def#1{\startenvironment#1#2}} \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} % Check whether we're in the right environment: \def\checkenv#1{% \def\temp{#1}% \ifx\thisenv\temp \else \badenverr \fi } % Environment mismatch, #1 expected: \def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, not \inenvironment\thisenv}% } \def\inenvironment#1{% \ifx#1\empty outside of any environment% \else in environment \expandafter\string#1% \fi } % @end foo calls \checkenv and executes the definition of \Efoo. \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else % The general wording of \badenverr may not be ideal. \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup \fi } \newhelp\EMsimple{Press RETURN to continue.} % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and % since \penalty is valid in vertical mode, we'd end up putting the % penalty on the vertical list instead of in the new paragraph. {\catcode`@ = 11 % Avoid using \@M directly, because that causes trouble % if the definition is written into an index file. \global\let\tiepenalty = \@M \gdef\tie{\leavevmode\penalty\tiepenalty\ } } % @: forces normal size whitespace following. \def\:{\spacefactor=1000 } % @* forces a line break. \def\*{\unskip\hfil\break\hbox{}\ignorespaces} % @/ allows a line break. \let\/=\allowbreak % @. is an end-of-sentence period. \def\.{.\spacefactor=\endofsentencespacefactor\space} % @! is an end-of-sentence bang. \def\!{!\spacefactor=\endofsentencespacefactor\space} % @? is an end-of-sentence query. \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. % \def\onword{on} \def\offword{off} % \parseargdef\frenchspacing{% \def\temp{#1}% \ifx\temp\onword \plainfrenchspacing \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% \fi\fi } % @w prevents a word break. Without the \leavevmode, @w at the % beginning of a paragraph, when TeX is still in vertical mode, would % produce a whole line of output instead of starting the paragraph. \def\w#1{\leavevmode\hbox{#1}} % @group ... @end group forces ... to be all on one page, by enclosing % it in a TeX vbox. We use \vtop instead of \vbox to construct the box % to keep its height that of a normal line. According to the rules for % \topskip (p.114 of the TeXbook), the glue inserted is % max (\topskip - \ht (first item), 0). If that height is large, % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % % Another complication is that the group might be very large. This can % cause the glue on the previous page to be unduly stretched, because it % does not have much material. In this case, it's better to add an % explicit \vfill so that the extra space is at the bottom. The % threshold for doing this is if the group is more than \vfilllimit % percent of a page (\vfilllimit can be changed inside of @tex). % \newbox\groupbox \def\vfilllimit{0.7} % \envdef\group{% \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi \startsavinginserts % \setbox\groupbox = \vtop\bgroup % Do @comment since we are called inside an environment such as % @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after % the `@group' to put extra space in the output. Since @group % should appear on a line by itself (according to the Texinfo % manual), we don't worry about eating any user text. \comment } % % The \vtop produces a box with normal height and large depth; thus, TeX puts % \baselineskip glue before it, and (when the next line of text is done) % \lineskip glue after it. Thus, space below is not quite equal to space % above. But it's pretty close. \def\Egroup{% % To get correct interline space between the last line of the group % and the first line afterwards, we have to propagate \prevdepth. \endgraf % Not \par, as it may have been set to \lisppar. \global\dimen1 = \prevdepth \egroup % End the \vtop. \addgroupbox \prevdepth = \dimen1 \checkinserts } \def\addgroupbox{ % \dimen0 is the vertical size of the group's box. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox % \dimen2 is how much space is left on the page (more or less). \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal % if the group doesn't fit on the current page, and it's a big big % group, force a page break. \ifdim \dimen0 > \dimen2 \ifdim \pagetotal < \vfilllimit\txipageheight \page \fi \fi \box\groupbox } % % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. % \newhelp\groupinvalidhelp{% group can only be used in environments such as @example,^^J% where each line of input produces a line of output.} % @need space-in-mils % forces a page break if there is not space-in-mils remaining. \newdimen\mil \mil=0.001in \parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par % % If the @need value is less than one line space, it's useless. \dimen0 = #1\mil \dimen2 = \ht\strutbox \advance\dimen2 by \dp\strutbox \ifdim\dimen0 > \dimen2 % % Do a \strut just to make the height of this box be normal, so the % normal leading is inserted relative to the preceding line. % And a page break here is fine. \vtop to #1\mil{\strut\vfil}% % % TeX does not even consider page breaks if a penalty added to the % main vertical list is 10000 or more. But in order to see if the % empty box we just added fits on the page, we must make it consider % page breaks. On the other hand, we don't want to actually break the % page after the empty box. So we use a penalty of 9999. % % There is an extremely small chance that TeX will actually break the % page at this \penalty, if there are no other feasible breakpoints in % sight. (If the user is using lots of big @group commands, which % almost-but-not-quite fill up a page, TeX will have a hard time doing % good page breaking, for example.) However, I could not construct an % example where a page broke at this \penalty; if it happens in a real % document, then we can reconsider our strategy. \penalty9999 % % Back up by the size of the box, whether we did a page break or not. \kern -#1\mil % % Do not allow a page break right after this kern. \nobreak \fi } % @br forces paragraph break (and is undocumented). \let\br = \par % @page forces the start of a new page. % \def\page{\par\vfill\supereject} % @exdent text.... % outputs text on separate line in roman font, starting at standard page margin % This records the amount of indent in the innermost environment. % That's how much \exdent should take out. \newskip\exdentamount % This defn is used inside fill environments such as @defun. \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} % This defn is used inside nofill environments such as @example. \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount \leftline{\hskip\leftskip{\rm#1}}}} % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current % paragraph. For more general purposes, use the \margin insertion % class. WHICH is `l' or `r'. Not documented, written for gawk manual. % \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} % \def\doinmargin#1#2{\strut\vadjust{% \nobreak \kern-\strutdepth \vtop to \strutdepth{% \baselineskip=\strutdepth \vss % if you have multiple lines of stuff to put here, you'll need to % make the vbox yourself of the appropriate size. \ifx#1l% \llap{\ignorespaces #2\hskip\inmarginspacing}% \else \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% \fi \null }% }} \def\inleftmargin{\doinmargin l} \def\inrightmargin{\doinmargin r} % % @inmargin{TEXT [, RIGHT-TEXT]} % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; % else use TEXT for both). % \def\inmargin#1{\parseinmargin #1,,\finish} \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \def\lefttext{#1}% have both texts \def\righttext{#2}% \else \def\lefttext{#1}% have only one text \def\righttext{#1}% \fi % \ifodd\pageno \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin \else \def\temp{\inleftmargin\lefttext}% \fi \temp } % @include FILE -- \input text of FILE. % \def\include{\parseargusing\filenamecatcodes\includezzz} \def\includezzz#1{% \pushthisfilestack \def\thisfile{#1}% {% \makevalueexpandable % we want to expand any @value in FILE. \turnoffactive % and allow special characters in the expansion \indexnofonts % Allow `@@' and other weird things in file names. \wlog{texinfo.tex: doing @include of #1^^J}% \edef\temp{\noexpand\input #1 }% % % This trickery is to read FILE outside of a group, in case it makes % definitions, etc. \expandafter }\temp \popthisfilestack } \def\filenamecatcodes{% \catcode`\\=\other \catcode`~=\other \catcode`^=\other \catcode`_=\other \catcode`|=\other \catcode`<=\other \catcode`>=\other \catcode`+=\other \catcode`-=\other \catcode`\`=\other \catcode`\'=\other } \def\pushthisfilestack{% \expandafter\pushthisfilestackX\popthisfilestack\StackTerm } \def\pushthisfilestackX{% \expandafter\pushthisfilestackY\thisfile\StackTerm } \def\pushthisfilestackY #1\StackTerm #2\StackTerm {% \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% } \def\popthisfilestack{\errthisfilestackempty} \def\errthisfilestackempty{\errmessage{Internal error: the stack of filenames is empty.}} % \def\thisfile{} % @center line % outputs that line, centered. % \parseargdef\center{% \ifhmode \let\centersub\centerH \else \let\centersub\centerV \fi \centersub{\hfil \ignorespaces#1\unskip \hfil}% \let\centersub\relax % don't let the definition persist, just in case } \def\centerH#1{{% \hfil\break \advance\hsize by -\leftskip \advance\hsize by -\rightskip \line{#1}% \break }} % \newcount\centerpenalty \def\centerV#1{% % The idea here is the same as in \startdefun, \cartouche, etc.: if % @center is the first thing after a section heading, we need to wipe % out the negative parskip inserted by \sectionheading, but still % prevent a page break here. \centerpenalty = \lastpenalty \ifnum\centerpenalty>10000 \vskip\parskip \fi \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi \line{\kern\leftskip #1\kern\rightskip}% } % @sp n outputs n lines of vertical space % \parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment \def\c{\begingroup \catcode`\^^M=\active% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% \cxxx} {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}} % \let\comment\c % @paragraphindent NCHARS % We'll use ems for NCHARS, close enough. % NCHARS can also be the word `asis' or `none'. % We cannot feasibly implement @paragraphindent asis, though. % \def\asisword{asis} % no translation, these are keywords \def\noneword{none} % \parseargdef\paragraphindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \defaultparindent = 0pt \else \defaultparindent = #1em \fi \fi \parindent = \defaultparindent } % @exampleindent NCHARS % We'll use ems for NCHARS like @paragraphindent. % It seems @exampleindent asis isn't necessary, but % I preserve it to make it similar to @paragraphindent. \parseargdef\exampleindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \lispnarrowing = 0pt \else \lispnarrowing = #1em \fi \fi } % @firstparagraphindent WORD % If WORD is `none', then suppress indentation of the first paragraph % after a section heading. If WORD is `insert', then do indent at such % paragraphs. % % The paragraph indentation is suppressed or not by calling % \suppressfirstparagraphindent, which the sectioning commands do. % We switch the definition of this back and forth according to WORD. % By default, we suppress indentation. % \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} \def\insertword{insert} % \parseargdef\firstparagraphindent{% \def\temp{#1}% \ifx\temp\noneword \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent \else\ifx\temp\insertword \let\suppressfirstparagraphindent = \relax \else \errhelp = \EMsimple \errmessage{Unknown @firstparagraphindent option `\temp'}% \fi\fi } % Here is how we actually suppress indentation. Redefine \everypar to % \kern backwards by \parindent, and then reset itself to empty. % % We also make \indent itself not actually do anything until the next % paragraph. % \gdef\dosuppressfirstparagraphindent{% \gdef\indent {\restorefirstparagraphindent \indent}% \gdef\noindent{\restorefirstparagraphindent \noindent}% \global\everypar = {\kern -\parindent \restorefirstparagraphindent}% } % \gdef\restorefirstparagraphindent{% \global\let\indent = \ptexindent \global\let\noindent = \ptexnoindent \global\everypar = {}% } % leave vertical mode without cancelling any first paragraph indent \gdef\imageindent{% \toks0=\everypar \everypar={}% \ptexnoindent \global\everypar=\toks0 } % @refill is a no-op. \let\refill=\relax % @setfilename INFO-FILENAME - ignored \let\setfilename=\comment % @bye. \outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend} \message{pdf,} % adobe `portable' document format \newcount\tempnum \newcount\lnkcount \newtoks\filename \newcount\filenamelength \newcount\pgn \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD \newbox\boxA \newbox\boxB \newcount\countA \newif\ifpdf \newif\ifpdfmakepagedest % % For LuaTeX % \newif\iftxiuseunicodedestname \txiuseunicodedestnamefalse % For pdfTeX etc. \ifx\luatexversion\thisisundefined \else % Use Unicode destination names \txiuseunicodedestnametrue % Escape PDF strings with converting UTF-16 from UTF-8 \begingroup \catcode`\%=12 \directlua{ function UTF16oct(str) tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377') for c in string.utfvalues(str) do if c < 0x10000 then tex.sprint( string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. string.char(0x5c) .. string.char(0x25) .. '03o', math.floor(c / 256), math.floor(c % 256))) else c = c - 0x10000 local c_hi = c / 1024 + 0xd800 local c_lo = c % 1024 + 0xdc00 tex.sprint( string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. string.char(0x5c) .. string.char(0x25) .. '03o' .. string.char(0x5c) .. string.char(0x25) .. '03o' .. string.char(0x5c) .. string.char(0x25) .. '03o', math.floor(c_hi / 256), math.floor(c_hi % 256), math.floor(c_lo / 256), math.floor(c_lo % 256))) end end end } \endgroup \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}} % Escape PDF strings without converting \begingroup \directlua{ function PDFescstr(str) for c in string.bytes(str) do if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then tex.sprint(-2, string.format(string.char(0x5c) .. string.char(0x25) .. '03o', c)) else tex.sprint(-2, string.char(c)) end end end } % The -2 in the arguments here gives all the input to TeX catcode 12 % (other) or 10 (space), preventing undefined control sequence errors. See % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html % \endgroup \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}} \ifnum\luatexversion>84 % For LuaTeX >= 0.85 \def\pdfdest{\pdfextension dest} \let\pdfoutput\outputmode \def\pdfliteral{\pdfextension literal} \def\pdfcatalog{\pdfextension catalog} \def\pdftexversion{\numexpr\pdffeedback version\relax} \let\pdfximage\saveimageresource \let\pdfrefximage\useimageresource \let\pdflastximage\lastsavedimageresourceindex \def\pdfendlink{\pdfextension endlink\relax} \def\pdfoutline{\pdfextension outline} \def\pdfstartlink{\pdfextension startlink} \def\pdffontattr{\pdfextension fontattr} \def\pdfobj{\pdfextension obj} \def\pdflastobj{\numexpr\pdffeedback lastobj\relax} \let\pdfpagewidth\pagewidth \let\pdfpageheight\pageheight \edef\pdfhorigin{\pdfvariable horigin} \edef\pdfvorigin{\pdfvariable vorigin} \fi \fi % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 % can be set). So we test for \relax and 0 as well as being undefined. \ifx\pdfoutput\thisisundefined \else \ifx\pdfoutput\relax \else \ifcase\pdfoutput \else \pdftrue \fi \fi \fi \newif\ifpdforxetex \pdforxetexfalse \ifpdf \pdforxetextrue \fi \ifx\XeTeXrevision\thisisundefined\else \pdforxetextrue \fi % Output page labels information. % See PDF reference v.1.7 p.594, section 8.3.1. \ifpdf \def\pagelabels{% \def\title{0 << /P (T-) /S /D >>}% \edef\roman{\the\romancount << /S /r >>}% \edef\arabic{\the\arabiccount << /S /D >>}% % % Page label ranges must be increasing. Remove any duplicates. % (There is a slight chance of this being wrong if e.g. there is % a @contents but no @titlepage, etc.) % \ifnum\romancount=0 \def\roman{}\fi \ifnum\arabiccount=0 \def\title{}% \else \ifnum\romancount=\arabiccount \def\roman{}\fi \fi % \ifnum\romancount<\arabiccount \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax \else \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax \fi } \else \let\pagelabels\relax \fi \newcount\pagecount \pagecount=0 \newcount\romancount \romancount=0 \newcount\arabiccount \arabiccount=0 \ifpdf \let\ptxadvancepageno\advancepageno \def\advancepageno{% \ptxadvancepageno\global\advance\pagecount by 1 } \fi % PDF uses PostScript string constants for the names of xref targets, % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. % % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and % related messages. The final outcome is that it is up to the TeX user % to double the backslashes and otherwise make the string valid, so % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to % do this reliably, so we use it. % #1 is a control sequence in which to do the replacements, % which we \xdef. \def\txiescapepdf#1{% \ifx\pdfescapestring\thisisundefined % No primitive available; should we give a warning or log? % Many times it won't matter. \xdef#1{#1}% \else % The expandable \pdfescapestring primitive escapes parentheses, % backslashes, and other special chars. \xdef#1{\pdfescapestring{#1}}% \fi } \def\txiescapepdfutfsixteen#1{% \ifx\pdfescapestrutfsixteen\thisisundefined % No UTF-16 converting macro available. \txiescapepdf{#1}% \else \xdef#1{\pdfescapestrutfsixteen{#1}}% \fi } \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images with PDF output, and none of those formats could be found. (.eps cannot be supported due to the design of the PDF format; use regular TeX (DVI output) for that.)} \ifpdf % % Color manipulation macros using ideas from pdfcolor.tex, % except using rgb instead of cmyk; the latter is said to render as a % very dark gray on-screen and a very dark halftone in print, instead % of actual black. The dark red here is dark enough to print on paper as % nearly black, but still distinguishable for online viewing. We use % black by default, though. \def\rgbDarkRed{0.50 0.09 0.12} \def\rgbBlack{0 0 0} % % rg sets the color for filling (usual text, etc.); % RG sets the color for stroking (thin rules, e.g., normal _'s). \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} % % Set color, and create a mark which defines \thiscolor accordingly, % so that \makeheadline knows which color to restore. \def\setcolor#1{% \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% \domark \pdfsetcolor{#1}% } % \def\maincolor{\rgbBlack} \pdfsetcolor{\maincolor} \edef\thiscolor{\maincolor} \def\currentcolordefs{} % \def\makefootline{% \baselineskip24pt \line{\pdfsetcolor{\maincolor}\the\footline}% } % \def\makeheadline{% \vbox to 0pt{% \vskip-22.5pt \line{% \vbox to8.5pt{}% % Extract \thiscolor definition from the marks. \getcolormarks % Typeset the headline with \maincolor, then restore the color. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% }% \vss }% \nointerlineskip } % % \pdfcatalog{/PageMode /UseOutlines} % % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). \def\dopdfimage#1#2#3{% \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% % % pdftex (and the PDF format) support .pdf, .png, .jpg (among % others). Let's try in that order, PDF first since if % someone has a scalable image, presumably better to use that than a % bitmap. \let\pdfimgext=\empty \begingroup \openin 1 #1.pdf \ifeof 1 \openin 1 #1.PDF \ifeof 1 \openin 1 #1.png \ifeof 1 \openin 1 #1.jpg \ifeof 1 \openin 1 #1.jpeg \ifeof 1 \openin 1 #1.JPG \ifeof 1 \errhelp = \nopdfimagehelp \errmessage{Could not find image file #1 for pdf}% \else \gdef\pdfimgext{JPG}% \fi \else \gdef\pdfimgext{jpeg}% \fi \else \gdef\pdfimgext{jpg}% \fi \else \gdef\pdfimgext{png}% \fi \else \gdef\pdfimgext{PDF}% \fi \else \gdef\pdfimgext{pdf}% \fi \closein 1 \endgroup % % without \immediate, ancient pdftex seg faults when the same image is % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) \ifnum\pdftexversion < 14 \immediate\pdfimage \else \immediate\pdfximage \fi \ifdim \wd0 >0pt width \pdfimagewidth \fi \ifdim \wd2 >0pt height \pdfimageheight \fi \ifnum\pdftexversion<13 #1.\pdfimgext \else {#1.\pdfimgext}% \fi \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} % \def\setpdfdestname#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts \makevalueexpandable \turnoffactive \iftxiuseunicodedestname \ifx \declaredencoding \latone % Pass through Latin-1 characters. % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode. \else \ifx \declaredencoding \utfeight % Pass through Unicode characters. \else % Use ASCII approximations in destination names. \passthroughcharsfalse \fi \fi \else % Use ASCII approximations in destination names. \passthroughcharsfalse \fi \def\pdfdestname{#1}% \txiescapepdf\pdfdestname }} % \def\setpdfoutlinetext#1{{% \indexnofonts \makevalueexpandable \turnoffactive \ifx \declaredencoding \latone % The PDF format can use an extended form of Latin-1 in bookmark % strings. See Appendix D of the PDF Reference, Sixth Edition, for % the "PDFDocEncoding". \passthroughcharstrue % Pass through Latin-1 characters. % LuaTeX: Convert to Unicode % pdfTeX: Use Latin-1 as PDFDocEncoding \def\pdfoutlinetext{#1}% \else \ifx \declaredencoding \utfeight \ifx\luatexversion\thisisundefined % For pdfTeX with UTF-8. % TODO: the PDF format can use UTF-16 in bookmark strings, % but the code for this isn't done yet. % Use ASCII approximations. \passthroughcharsfalse \def\pdfoutlinetext{#1}% \else % For LuaTeX with UTF-8. % Pass through Unicode characters for title texts. \passthroughcharstrue \def\pdfoutlinetext{#1}% \fi \else % For non-Latin-1 or non-UTF-8 encodings. % Use ASCII approximations. \passthroughcharsfalse \def\pdfoutlinetext{#1}% \fi \fi % LuaTeX: Convert to UTF-16 % pdfTeX: Use Latin-1 as PDFDocEncoding \txiescapepdfutfsixteen\pdfoutlinetext }} % \def\pdfmkdest#1{% \setpdfdestname{#1}% \safewhatsit{\pdfdest name{\pdfdestname} xyz}% } % % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1} % % by default, use black for everything. \def\urlcolor{\rgbBlack} \def\linkcolor{\rgbBlack} \def\endlink{\setcolor{\maincolor}\pdfendlink} % % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \else \csname#1\endcsname \fi} \def\advancenumber#1{\tempnum=\expnumber{#1}\relax \advance\tempnum by 1 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} % % #1 is the section text, which is what will be displayed in the % outline by the pdf viewer. #2 is the pdf expression for the number % of subentries (or empty, for subsubsections). #3 is the node text, % which might be empty if this toc entry had no corresponding node. % #4 is the page number % \def\dopdfoutline#1#2#3#4{% % Generate a link to the node text if that exists; else, use the % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. \setpdfoutlinetext{#1} \setpdfdestname{#3} \ifx\pdfdestname\empty \def\pdfdestname{#4}% \fi % \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% \begingroup % Read toc silently, to get counts of subentries for \pdfoutline. \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% \def\thischapnum{##2}% \def\thissecnum{0}% \def\thissubsecnum{0}% }% \def\numsecentry##1##2##3##4{% \advancenumber{chap\thischapnum}% \def\thissecnum{##2}% \def\thissubsecnum{0}% }% \def\numsubsecentry##1##2##3##4{% \advancenumber{sec\thissecnum}% \def\thissubsecnum{##2}% }% \def\numsubsubsecentry##1##2##3##4{% \advancenumber{subsec\thissubsecnum}% }% \def\thischapnum{0}% \def\thissecnum{0}% \def\thissubsecnum{0}% % % use \def rather than \let here because we redefine \chapentry et % al. a second time, below. \def\appentry{\numchapentry}% \def\appsecentry{\numsecentry}% \def\appsubsecentry{\numsubsecentry}% \def\appsubsubsecentry{\numsubsubsecentry}% \def\unnchapentry{\numchapentry}% \def\unnsecentry{\numsecentry}% \def\unnsubsecentry{\numsubsecentry}% \def\unnsubsubsecentry{\numsubsubsecentry}% \readdatafile{toc}% % % Read toc second time, this time actually producing the outlines. % The `-' means take the \expnumber as the absolute number of % subentries, which we calculated on our first read of the .toc above. % % We use the node names as the destinations. % % Currently we prefix the section name with the section number % for chapter and appendix headings only in order to avoid too much % horizontal space being required in the PDF viewer. \def\numchapentry##1##2##3##4{% \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}% \def\unnchapentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% \def\numsubsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% \def\numsubsubsecentry##1##2##3##4{% count is always zero \dopdfoutline{##1}{}{##3}{##4}}% % % PDF outlines are displayed using system fonts, instead of % document fonts. Therefore we cannot use special characters, % since the encoding is unknown. For example, the eogonek from % Latin 2 (0xea) gets translated to a | character. Info from % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. % % TODO this right, we have to translate 8-bit characters to % their "best" equivalent, based on the @documentencoding. Too % much work for too little return. Just use the ASCII equivalents % we use for the index sort strings. % \indexnofonts \setupdatafile % We can have normal brace characters in the PDF outlines, unlike % Texinfo index files. So set that up. \def\{{\lbracecharliteral}% \def\}{\rbracecharliteral}% \catcode`\\=\active \otherbackslash \input \tocreadfilename \endgroup } {\catcode`[=1 \catcode`]=2 \catcode`{=\other \catcode`}=\other \gdef\lbracecharliteral[{]% \gdef\rbracecharliteral[}]% ] % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces \addtokens{\filename}{\PP}% \advance\filenamelength by 1 \fi \nextsp} \def\getfilename#1{% \filenamelength=0 % If we don't expand the argument now, \skipspaces will get % snagged on things like "@value{foo}". \edef\temp{#1}% \expandafter\skipspaces\temp|\relax } \ifnum\pdftexversion < 14 \let \startlink \pdfannotlink \else \let \startlink \pdfstartlink \fi % make a live url in pdf output. \def\pdfurl#1{% \begingroup % it seems we really need yet another set of dummies; have not % tried to figure out what each command should do in the context % of @url. for now, just make @/ a no-op, that's the only one % people have actually reported a problem with. % \normalturnoffactive \def\@{@}% \let\/=\empty \makevalueexpandable % do we want to go so far as to use \indexnofonts instead of just % special-casing \var here? \def\var##1{##1}% % \leavevmode\setcolor{\urlcolor}% \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% \endgroup} % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may % be a simple number, or a list of numbers in the case of an index % entry. \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} \def\maketoks{% \expandafter\poptoks\the\toksA|ENDTOKS|\relax \ifx\first0\adn0 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 \else \ifnum0=\countA\else\makelink\fi \ifx\first.\let\next=\done\else \let\next=\maketoks \addtokens{\toksB}{\the\toksD} \ifx\first,\addtokens{\toksB}{\space}\fi \fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next} \def\makelink{\addtokens{\toksB}% {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else % non-pdf mode \let\pdfmkdest = \gobble \let\pdfurl = \gobble \let\endlink = \relax \let\setcolor = \gobble \let\pdfsetcolor = \gobble \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput % % For XeTeX % \ifx\XeTeXrevision\thisisundefined \else % % XeTeX version check % \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307. % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941). % For avoiding PDF destination name replacement, we use this special % instead of xdvipdfmx's command line option `-C 0x0010'. \special{dvipdfmx:config C 0x0010} % XeTeX 0.99995+ comes with xdvipdfmx 20160307+. % It can handle Unicode destination names for PDF. \txiuseunicodedestnametrue \else % XeTeX < 0.99996 (TeX Live < 2016) cannot use the % `dvipdfmx:config' special. % So for avoiding PDF destination name replacement, % xdvipdfmx's command line option `-C 0x0010' is necessary. % % XeTeX < 0.99995 can not handle Unicode destination names for PDF % because xdvipdfmx 20150315 has a UTF-16 conversion issue. % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). \txiuseunicodedestnamefalse \fi % % Color support % \def\rgbDarkRed{0.50 0.09 0.12} \def\rgbBlack{0 0 0} % \def\pdfsetcolor#1{\special{pdf:scolor [#1]}} % % Set color, and create a mark which defines \thiscolor accordingly, % so that \makeheadline knows which color to restore. \def\setcolor#1{% \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% \domark \pdfsetcolor{#1}% } % \def\maincolor{\rgbBlack} \pdfsetcolor{\maincolor} \edef\thiscolor{\maincolor} \def\currentcolordefs{} % \def\makefootline{% \baselineskip24pt \line{\pdfsetcolor{\maincolor}\the\footline}% } % \def\makeheadline{% \vbox to 0pt{% \vskip-22.5pt \line{% \vbox to8.5pt{}% % Extract \thiscolor definition from the marks. \getcolormarks % Typeset the headline with \maincolor, then restore the color. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% }% \vss }% \nointerlineskip } % % PDF outline support % % Emulate pdfTeX primitive \def\pdfdest name#1 xyz{% \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}% } % \def\setpdfdestname#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts \makevalueexpandable \turnoffactive \iftxiuseunicodedestname % Pass through Unicode characters. \else % Use ASCII approximations in destination names. \passthroughcharsfalse \fi \def\pdfdestname{#1}% \txiescapepdf\pdfdestname }} % \def\setpdfoutlinetext#1{{% \turnoffactive % Always use Unicode characters in title texts. \def\pdfoutlinetext{#1}% % For XeTeX, xdvipdfmx converts to UTF-16. % So we do not convert. \txiescapepdf\pdfoutlinetext }} % \def\pdfmkdest#1{% \setpdfdestname{#1}% \safewhatsit{\pdfdest name{\pdfdestname} xyz}% } % % by default, use black for everything. \def\urlcolor{\rgbBlack} \def\linkcolor{\rgbBlack} \def\endlink{\setcolor{\maincolor}\pdfendlink} % \def\dopdfoutline#1#2#3#4{% \setpdfoutlinetext{#1} \setpdfdestname{#3} \ifx\pdfdestname\empty \def\pdfdestname{#4}% \fi % \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A << /S /GoTo /D (\pdfdestname) >> >> }% } % \def\pdfmakeoutlines{% \begingroup % % For XeTeX, counts of subentries are not necessary. % Therefore, we read toc only once. % % We use node names as destinations. % % Currently we prefix the section name with the section number % for chapter and appendix headings only in order to avoid too much % horizontal space being required in the PDF viewer. \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% \dopdfoutline{##2 ##1}{1}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{2}{##3}{##4}}% \def\numsubsecentry##1##2##3##4{% \dopdfoutline{##1}{3}{##3}{##4}}% \def\numsubsubsecentry##1##2##3##4{% \dopdfoutline{##1}{4}{##3}{##4}}% % \let\appentry\numchapentry% \let\appsecentry\numsecentry% \let\appsubsecentry\numsubsecentry% \let\appsubsubsecentry\numsubsubsecentry% \def\unnchapentry##1##2##3##4{% \dopdfoutline{##1}{1}{##3}{##4}}% \let\unnsecentry\numsecentry% \let\unnsubsecentry\numsubsecentry% \let\unnsubsubsecentry\numsubsubsecentry% % % For XeTeX, xdvipdfmx converts strings to UTF-16. % Therefore, the encoding and the language may not be considered. % \indexnofonts \setupdatafile % We can have normal brace characters in the PDF outlines, unlike % Texinfo index files. So set that up. \def\{{\lbracecharliteral}% \def\}{\rbracecharliteral}% \catcode`\\=\active \otherbackslash \input \tocreadfilename \endgroup } {\catcode`[=1 \catcode`]=2 \catcode`{=\other \catcode`}=\other \gdef\lbracecharliteral[{]% \gdef\rbracecharliteral[}]% ] \special{pdf:docview << /PageMode /UseOutlines >> } % ``\special{pdf:tounicode ...}'' is not necessary % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it. % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315, % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings. % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces \addtokens{\filename}{\PP}% \advance\filenamelength by 1 \fi \nextsp} \def\getfilename#1{% \filenamelength=0 % If we don't expand the argument now, \skipspaces will get % snagged on things like "@value{foo}". \edef\temp{#1}% \expandafter\skipspaces\temp|\relax } % make a live url in pdf output. \def\pdfurl#1{% \begingroup % it seems we really need yet another set of dummies; have not % tried to figure out what each command should do in the context % of @url. for now, just make @/ a no-op, that's the only one % people have actually reported a problem with. % \normalturnoffactive \def\@{@}% \let\/=\empty \makevalueexpandable % do we want to go so far as to use \indexnofonts instead of just % special-casing \var here? \def\var##1{##1}% % \leavevmode\setcolor{\urlcolor}% \special{pdf:bann << /Border [0 0 0] /Subtype /Link /A << /S /URI /URI (#1) >> >>}% \endgroup} \def\endlink{\setcolor{\maincolor}\special{pdf:eann}} \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} \def\maketoks{% \expandafter\poptoks\the\toksA|ENDTOKS|\relax \ifx\first0\adn0 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 \else \ifnum0=\countA\else\makelink\fi \ifx\first.\let\next=\done\else \let\next=\maketoks \addtokens{\toksB}{\the\toksD} \ifx\first,\addtokens{\toksB}{\space}\fi \fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next} \def\makelink{\addtokens{\toksB}% {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}% \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} % % % @image support % % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). \def\doxeteximage#1#2#3{% \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% % % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among % others). Let's try in that order, PDF first since if % someone has a scalable image, presumably better to use that than a % bitmap. \let\xeteximgext=\empty \begingroup \openin 1 #1.pdf \ifeof 1 \openin 1 #1.PDF \ifeof 1 \openin 1 #1.png \ifeof 1 \openin 1 #1.jpg \ifeof 1 \openin 1 #1.jpeg \ifeof 1 \openin 1 #1.JPG \ifeof 1 \errmessage{Could not find image file #1 for XeTeX}% \else \gdef\xeteximgext{JPG}% \fi \else \gdef\xeteximgext{jpeg}% \fi \else \gdef\xeteximgext{jpg}% \fi \else \gdef\xeteximgext{png}% \fi \else \gdef\xeteximgext{PDF}% \fi \else \gdef\xeteximgext{pdf}% \fi \closein 1 \endgroup % % Putting an \hbox around the image can prevent an over-long line % after the image. \hbox\bgroup \def\xetexpdfext{pdf}% \ifx\xeteximgext\xetexpdfext \XeTeXpdffile "#1".\xeteximgext "" \else \def\xetexpdfext{PDF}% \ifx\xeteximgext\xetexpdfext \XeTeXpdffile "#1".\xeteximgext "" \else \XeTeXpicfile "#1".\xeteximgext "" \fi \fi \ifdim \wd0 >0pt width \xeteximagewidth \fi \ifdim \wd2 >0pt height \xeteximageheight \fi \relax \egroup } \fi % \message{fonts,} % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers % used as factors; they just match (closely enough) what Knuth defined. % \def\lineskipfactor{.08333} \def\strutheightpercent{.70833} \def\strutdepthpercent {.29167} % % can get a sort of poor man's double spacing by redefining this. \def\baselinefactor{1} % \newdimen\textleading \def\setleading#1{% \dimen0 = #1\relax \normalbaselineskip = \baselinefactor\dimen0 \normallineskip = \lineskipfactor\normalbaselineskip \normalbaselines \setbox\strutbox =\hbox{% \vrule width0pt height\strutheightpercent\baselineskip depth \strutdepthpercent \baselineskip }% } % PDF CMaps. See also LaTeX's t1.cmap. % % do nothing with this by default. \expandafter\let\csname cmapOT1\endcsname\gobble \expandafter\let\csname cmapOT1IT\endcsname\gobble \expandafter\let\csname cmapOT1TT\endcsname\gobble % if we are producing pdf, and we have \pdffontattr, then define cmaps. % (\pdffontattr was introduced many years ago, but people still run % older pdftex's; it's easy to conditionalize, so we do.) \ifpdf \ifx\pdffontattr\thisisundefined \else \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1-0) %%Title: (TeX-OT1-0 TeX OT1 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1) /Supplement 0 >> def /CMapName /TeX-OT1-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 8 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <23> <26> <0023> <28> <3B> <0028> <3F> <5B> <003F> <5D> <5E> <005D> <61> <7A> <0061> <7B> <7C> <2013> endbfrange 40 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <00660066> <0C> <00660069> <0D> <0066006C> <0E> <006600660069> <0F> <00660066006C> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <21> <0021> <22> <201D> <27> <2019> <3C> <00A1> <3D> <003D> <3E> <00BF> <5C> <201C> <5F> <02D9> <60> <2018> <7D> <02DD> <7E> <007E> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% % % \cmapOT1IT \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1IT-0) %%Title: (TeX-OT1IT-0 TeX OT1IT 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1IT) /Supplement 0 >> def /CMapName /TeX-OT1IT-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 8 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <25> <26> <0025> <28> <3B> <0028> <3F> <5B> <003F> <5D> <5E> <005D> <61> <7A> <0061> <7B> <7C> <2013> endbfrange 42 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <00660066> <0C> <00660069> <0D> <0066006C> <0E> <006600660069> <0F> <00660066006C> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <21> <0021> <22> <201D> <23> <0023> <24> <00A3> <27> <2019> <3C> <00A1> <3D> <003D> <3E> <00BF> <5C> <201C> <5F> <02D9> <60> <2018> <7D> <02DD> <7E> <007E> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1IT\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% % % \cmapOT1TT \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1TT-0) %%Title: (TeX-OT1TT-0 TeX OT1TT 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1TT) /Supplement 0 >> def /CMapName /TeX-OT1TT-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 5 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <21> <26> <0021> <28> <5F> <0028> <61> <7E> <0061> endbfrange 32 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <2191> <0C> <2193> <0D> <0027> <0E> <00A1> <0F> <00BF> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <20> <2423> <27> <2019> <60> <2018> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1TT\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% \fi\fi % Set the font macro #1 to the font named \fontprefix#2. % #3 is the font's design size, #4 is a scale factor, #5 is the CMap % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). % Example: % #1 = \textrm % #2 = \rmshape % #3 = 10 % #4 = \mainmagstep % #5 = OT1 % \def\setfont#1#2#3#4#5{% \font#1=\fontprefix#2#3 scaled #4 \csname cmap#5\endcsname#1% } % This is what gets called when #5 of \setfont is empty. \let\cmap\gobble % % (end of cmaps) % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. \ifx\fontprefix\thisisundefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. \def\rmshape{r} \def\rmbshape{bx} % where the normal face is bold \def\bfshape{b} \def\bxshape{bx} \def\ttshape{tt} \def\ttbshape{tt} \def\ttslshape{sltt} \def\itshape{ti} \def\itbshape{bxti} \def\slshape{sl} \def\slbshape{bxsl} \def\sfshape{ss} \def\sfbshape{ss} \def\scshape{csc} \def\scbshape{csc} % Definitions for a main text size of 11pt. (The default in Texinfo.) % \def\definetextfontsizexi{% % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} \edef\mainmagstep{\magstephalf} \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} \setfont\textsl\slshape{10}{\mainmagstep}{OT1} \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} \setfont\textsc\scshape{10}{\mainmagstep}{OT1} \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep \def\textecsize{1095} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstep1}{OT1} \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} \setfont\defsl\slshape{10}{\magstep1}{OT1} \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} \def\df{\let\ttfont=\deftt \let\bffont = \defbf \let\ttslfont=\defttsl \let\slfont=\defsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000}{OT1} \setfont\smalltt\ttshape{9}{1000}{OT1TT} \setfont\smallbf\bfshape{10}{900}{OT1} \setfont\smallit\itshape{9}{1000}{OT1IT} \setfont\smallsl\slshape{9}{1000}{OT1} \setfont\smallsf\sfshape{9}{1000}{OT1} \setfont\smallsc\scshape{10}{900}{OT1} \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 \def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000}{OT1} \setfont\smallertt\ttshape{8}{1000}{OT1TT} \setfont\smallerbf\bfshape{10}{800}{OT1} \setfont\smallerit\itshape{8}{1000}{OT1IT} \setfont\smallersl\slshape{8}{1000}{OT1} \setfont\smallersf\sfshape{8}{1000}{OT1} \setfont\smallersc\scshape{10}{800}{OT1} \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 \def\smallerecsize{0800} % Fonts for math mode superscripts (7pt). \def\sevennominalsize{7pt} \setfont\sevenrm\rmshape{7}{1000}{OT1} \setfont\seventt\ttshape{10}{700}{OT1TT} \setfont\sevenbf\bfshape{10}{700}{OT1} \setfont\sevenit\itshape{7}{1000}{OT1IT} \setfont\sevensl\slshape{10}{700}{OT1} \setfont\sevensf\sfshape{10}{700}{OT1} \setfont\sevensc\scshape{10}{700}{OT1} \setfont\seventtsl\ttslshape{10}{700}{OT1TT} \font\seveni=cmmi7 \font\sevensy=cmsy7 \def\sevenecsize{0700} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} \setfont\titlesl\slbshape{10}{\magstep4}{OT1} \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\titleecsize{2074} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} \setfont\chaprm\rmbshape{12}{\magstep2}{OT1} \setfont\chapit\itbshape{10}{\magstep3}{OT1IT} \setfont\chapsl\slbshape{10}{\magstep3}{OT1} \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} \setfont\chapsf\sfbshape{17}{1000}{OT1} \let\chapbf=\chaprm \setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 \def\chapecsize{1728} % Section fonts (14.4pt). \def\secnominalsize{14pt} \setfont\secrm\rmbshape{12}{\magstep1}{OT1} \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1} \setfont\secit\itbshape{10}{\magstep2}{OT1IT} \setfont\secsl\slbshape{10}{\magstep2}{OT1} \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} \setfont\secsf\sfbshape{12}{\magstep1}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 \def\sececsize{1440} % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} \setfont\ssecit\itbshape{10}{1315}{OT1IT} \setfont\ssecsl\slbshape{10}{1315}{OT1} \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 \def\ssececsize{1200} % Reduced fonts for @acronym in text (10pt). \def\reducednominalsize{10pt} \setfont\reducedrm\rmshape{10}{1000}{OT1} \setfont\reducedtt\ttshape{10}{1000}{OT1TT} \setfont\reducedbf\bfshape{10}{1000}{OT1} \setfont\reducedit\itshape{10}{1000}{OT1IT} \setfont\reducedsl\slshape{10}{1000}{OT1} \setfont\reducedsf\sfshape{10}{1000}{OT1} \setfont\reducedsc\scshape{10}{1000}{OT1} \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 \def\reducedecsize{1000} \textleading = 13.2pt % line spacing for 11pt CM \textfonts % reset the current fonts \rm } % end of 11pt text font size definitions, \definetextfontsizexi % Definitions to make the main text be 10pt Computer Modern, with % section, chapter, etc., sizes following suit. This is for the GNU % Press printing of the Emacs 22 manual. Maybe other manuals in the % future. Used with @smallbook, which sets the leading to 12pt. % \def\definetextfontsizex{% % Text fonts (10pt). \def\textnominalsize{10pt} \edef\mainmagstep{1000} \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} \setfont\textsl\slshape{10}{\mainmagstep}{OT1} \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} \setfont\textsc\scshape{10}{\mainmagstep}{OT1} \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep \def\textecsize{1000} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstephalf}{OT1} \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} \setfont\defsl\slshape{10}{\magstephalf}{OT1} \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} \def\df{\let\ttfont=\deftt \let\bffont = \defbf \let\slfont=\defsl \let\ttslfont=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000}{OT1} \setfont\smalltt\ttshape{9}{1000}{OT1TT} \setfont\smallbf\bfshape{10}{900}{OT1} \setfont\smallit\itshape{9}{1000}{OT1IT} \setfont\smallsl\slshape{9}{1000}{OT1} \setfont\smallsf\sfshape{9}{1000}{OT1} \setfont\smallsc\scshape{10}{900}{OT1} \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 \def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000}{OT1} \setfont\smallertt\ttshape{8}{1000}{OT1TT} \setfont\smallerbf\bfshape{10}{800}{OT1} \setfont\smallerit\itshape{8}{1000}{OT1IT} \setfont\smallersl\slshape{8}{1000}{OT1} \setfont\smallersf\sfshape{8}{1000}{OT1} \setfont\smallersc\scshape{10}{800}{OT1} \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 \def\smallerecsize{0800} % Fonts for math mode superscripts (7pt). \def\sevennominalsize{7pt} \setfont\sevenrm\rmshape{7}{1000}{OT1} \setfont\seventt\ttshape{10}{700}{OT1TT} \setfont\sevenbf\bfshape{10}{700}{OT1} \setfont\sevenit\itshape{7}{1000}{OT1IT} \setfont\sevensl\slshape{10}{700}{OT1} \setfont\sevensf\sfshape{10}{700}{OT1} \setfont\sevensc\scshape{10}{700}{OT1} \setfont\seventtsl\ttslshape{10}{700}{OT1TT} \font\seveni=cmmi7 \font\sevensy=cmsy7 \def\sevenecsize{0700} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} \setfont\titlesl\slbshape{10}{\magstep4}{OT1} \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\titleecsize{2074} % Chapter fonts (14.4pt). \def\chapnominalsize{14pt} \setfont\chaprm\rmbshape{12}{\magstep1}{OT1} \setfont\chapit\itbshape{10}{\magstep2}{OT1IT} \setfont\chapsl\slbshape{10}{\magstep2}{OT1} \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} \setfont\chapsf\sfbshape{12}{\magstep1}{OT1} \let\chapbf\chaprm \setfont\chapsc\scbshape{10}{\magstep2}{OT1} \font\chapi=cmmi12 scaled \magstep1 \font\chapsy=cmsy10 scaled \magstep2 \def\chapecsize{1440} % Section fonts (12pt). \def\secnominalsize{12pt} \setfont\secrm\rmbshape{12}{1000}{OT1} \setfont\secit\itbshape{10}{\magstep1}{OT1IT} \setfont\secsl\slbshape{10}{\magstep1}{OT1} \setfont\sectt\ttbshape{12}{1000}{OT1TT} \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} \setfont\secsf\sfbshape{12}{1000}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep1}{OT1} \font\seci=cmmi12 \font\secsy=cmsy10 scaled \magstep1 \def\sececsize{1200} % Subsection fonts (10pt). \def\ssecnominalsize{10pt} \setfont\ssecrm\rmbshape{10}{1000}{OT1} \setfont\ssecit\itbshape{10}{1000}{OT1IT} \setfont\ssecsl\slbshape{10}{1000}{OT1} \setfont\ssectt\ttbshape{10}{1000}{OT1TT} \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} \setfont\ssecsf\sfbshape{10}{1000}{OT1} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1000}{OT1} \font\sseci=cmmi10 \font\ssecsy=cmsy10 \def\ssececsize{1000} % Reduced fonts for @acronym in text (9pt). \def\reducednominalsize{9pt} \setfont\reducedrm\rmshape{9}{1000}{OT1} \setfont\reducedtt\ttshape{9}{1000}{OT1TT} \setfont\reducedbf\bfshape{10}{900}{OT1} \setfont\reducedit\itshape{9}{1000}{OT1IT} \setfont\reducedsl\slshape{9}{1000}{OT1} \setfont\reducedsf\sfshape{9}{1000}{OT1} \setfont\reducedsc\scshape{10}{900}{OT1} \setfont\reducedttsl\ttslshape{10}{900}{OT1TT} \font\reducedi=cmmi9 \font\reducedsy=cmsy9 \def\reducedecsize{0900} \divide\parskip by 2 % reduce space between paragraphs \textleading = 12pt % line spacing for 10pt CM \textfonts % reset the current fonts \rm } % end of 10pt text font size definitions, \definetextfontsizex % Fonts for short table of contents. \setfont\shortcontrm\rmshape{12}{1000}{OT1} \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 \setfont\shortcontsl\slshape{12}{1000}{OT1} \setfont\shortconttt\ttshape{12}{1000}{OT1TT} % We provide the user-level command % @fonttextsize 10 % (or 11) to redefine the text font size. pt is assumed. % \def\xiword{11} \def\xword{10} \def\xwordpt{10pt} % \parseargdef\fonttextsize{% \def\textsizearg{#1}% %\wlog{doing @fonttextsize \textsizearg}% % % Set \globaldefs so that documents can use this inside @tex, since % makeinfo 4.8 does not support it, but we need it nonetheless. % \begingroup \globaldefs=1 \ifx\textsizearg\xword \definetextfontsizex \else \ifx\textsizearg\xiword \definetextfontsizexi \else \errhelp=\EMsimple \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} \fi\fi \endgroup } % % Change the current font style to #1, remembering it in \curfontstyle. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in % italics, not bold italics. % \def\setfontstyle#1{% \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. \csname #1font\endcsname % change the current font } \def\rm{\fam=0 \setfontstyle{rm}} \def\it{\fam=\itfam \setfontstyle{it}} \def\sl{\fam=\slfam \setfontstyle{sl}} \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} \def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt} % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. \newfam\sffam \def\sf{\fam=\sffam \setfontstyle{sf}} % We don't need math for this font style. \def\ttsl{\setfontstyle{ttsl}} % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. % We don't bother to reset \scriptscriptfont; awaiting user need. % \def\resetmathfonts{% \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont \textfont\ttfam=\ttfont \textfont\sffam=\sffont % % Fonts for superscript. Note that the 7pt fonts are used regardless % of the current font size. \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt \scriptfont\sffam=\sevensf } % % The font-changing commands (all called \...fonts) redefine the meanings % of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs % to also set the current \fam for math mode. Our \STYLE (e.g., \rm) % commands hardwire \STYLEfont to set the current font. % % The fonts used for \ifont are for "math italics" (\itfont is for italics % in regular text). \syfont is also used in math mode only. % % Each font-changing command also sets the names \lsize (one size lower) % and \lllsize (three sizes lower). These relative commands are used % in, e.g., the LaTeX logo and acronyms. % % This all needs generalizing, badly. % \def\assignfonts#1{% \expandafter\let\expandafter\rmfont\csname #1rm\endcsname \expandafter\let\expandafter\itfont\csname #1it\endcsname \expandafter\let\expandafter\slfont\csname #1sl\endcsname \expandafter\let\expandafter\bffont\csname #1bf\endcsname \expandafter\let\expandafter\ttfont\csname #1tt\endcsname \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname \expandafter\let\expandafter\sffont \csname #1sf\endcsname \expandafter\let\expandafter\ifont \csname #1i\endcsname \expandafter\let\expandafter\syfont \csname #1sy\endcsname \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname } \newif\ifrmisbold % Select smaller font size with the current style. Used to change font size % in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for % normal roman text, also use bold fonts for roman text in the smaller size. \def\switchtolllsize{% \expandafter\assignfonts\expandafter{\lllsize}% \ifrmisbold \let\rmfont\bffont \fi \csname\curfontstyle\endcsname }% \def\switchtolsize{% \expandafter\assignfonts\expandafter{\lsize}% \ifrmisbold \let\rmfont\bffont \fi \csname\curfontstyle\endcsname }% \def\definefontsetatsize#1#2#3#4#5{% \expandafter\def\csname #1fonts\endcsname{% \def\curfontsize{#1}% \def\lsize{#2}\def\lllsize{#3}% \csname rmisbold#5\endcsname \assignfonts{#1}% \resetmathfonts \setleading{#4}% }} \definefontsetatsize{text} {reduced}{smaller}{\textleading}{false} \definefontsetatsize{title} {chap} {subsec} {27pt} {true} \definefontsetatsize{chap} {sec} {text} {19pt} {true} \definefontsetatsize{sec} {subsec} {reduced}{17pt} {true} \definefontsetatsize{ssec} {text} {small} {15pt} {true} \definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false} \definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false} \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false} \def\titlefont#1{{\titlefonts\rm #1}} \let\subsecfonts = \ssecfonts \let\subsubsecfonts = \ssecfonts % Define these just so they can be easily changed for other fonts. \def\angleleft{$\langle$} \def\angleright{$\rangle$} % Set the fonts to use with the @small... environments. \let\smallexamplefonts = \smallfonts % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample % can fit this many characters: % 8.5x11=86 smallbook=72 a4=90 a5=69 % If we use \scriptfonts (8pt), then we can fit this many characters: % 8.5x11=90+ smallbook=80 a4=90+ a5=77 % For me, subjectively, the few extra characters that fit aren't worth % the additional smallness of 8pt. So I'm making the default 9pt. % % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 % --karl, 24jan03. % Set up the default fonts, so we can use them for creating boxes. % \definetextfontsizexi % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have % this property, we can check that font parameter. % \def\ifmonospace{\ifdim\fontdimen3\font=0pt } { \catcode`\'=\active \catcode`\`=\active \gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright} \gdef\setregularquotes{\let`\lq \let'\rq} } % Allow an option to not use regular directed right quote/apostrophe % (char 0x27), but instead the undirected quote from cmtt (char 0x0d). % The undirected quote is ugly, so don't make it the default, but it % works for pasting with more pdf viewers (at least evince), the % lilypond developers report. xpdf does work with the regular 0x27. % \def\codequoteright{% \ifmonospace \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax '% \else \char'15 \fi \else \char'15 \fi \else '% \fi } % % and a similar option for the left quote char vs. a grave accent. % Modern fonts display ASCII 0x60 as a grave accent, so some people like % the code environments to do likewise. % \def\codequoteleft{% \ifmonospace \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax % [Knuth] pp. 380,381,391 % \relax disables Spanish ligatures ?` and !` of \tt font. \relax`% \else \char'22 \fi \else \char'22 \fi \else \relax`% \fi } % Commands to set the quote options. % \parseargdef\codequoteundirected{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxicodequoteundirected\endcsname = t% \else\ifx\temp\offword \expandafter\let\csname SETtxicodequoteundirected\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% \fi\fi } % \parseargdef\codequotebacktick{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxicodequotebacktick\endcsname = t% \else\ifx\temp\offword \expandafter\let\csname SETtxicodequotebacktick\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% \fi\fi } % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. \def\noligaturesquoteleft{\relax\lq} % Count depth in font-changes, for error checks \newcount\fontdepth \fontdepth=0 % Font commands. % #1 is the font command (\sl or \it), #2 is the text to slant. % If we are in a monospaced environment, however, 1) always use \ttsl, % and 2) do not add an italic correction. \def\dosmartslant#1#2{% \ifusingtt {{\ttsl #2}\let\next=\relax}% {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% \next } \def\smartslanted{\dosmartslant\sl} \def\smartitalic{\dosmartslant\it} % Output an italic correction unless \next (presumed to be the following % character) is such as not to need one. \def\smartitaliccorrection{% \ifx\next,% \else\ifx\next-% \else\ifx\next.% \else\ifx\next\.% \else\ifx\next\comma% \else\ptexslash \fi\fi\fi\fi\fi \aftersmartic } % Unconditional use \ttsl, and no ic. @var is set to this for defuns. \def\ttslanted#1{{\ttsl #1}} % @cite is like \smartslanted except unconditionally use \sl. We never want % ttsl for book titles, do we? \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} \def\aftersmartic{} \def\var#1{% \let\saveaftersmartic = \aftersmartic \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% \smartslanted{#1}% } \let\i=\smartitalic \let\slanted=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic % Explicit font changes: @r, @sc, undocumented @ii. \def\r#1{{\rm #1}} % roman font \def\sc#1{{\smallcaps#1}} % smallcaps font \def\ii#1{{\it #1}} % italic font % @b, explicit bold. Also @strong. \def\b#1{{\bf #1}} \let\strong=\b % @sansserif, explicit sans. \def\sansserif#1{{\sf #1}} % We can't just use \exhyphenpenalty, because that only has effect at % the end of a paragraph. Restore normal hyphenation at the end of the % group within which \nohyphenation is presumably called. % \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } % Set sfcode to normal for the chars that usually have another value. % Can't use plain's \frenchspacing because it uses the `\x notation, and % sometimes \x has an active definition that messes things up. % \catcode`@=11 \def\plainfrenchspacing{% \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m \def\endofsentencespacefactor{1000}% for @. and friends } \def\plainnonfrenchspacing{% \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 \def\endofsentencespacefactor{3000}% for @. and friends } \catcode`@=\other \def\endofsentencespacefactor{3000}% default % @t, explicit typewriter. \def\t#1{% {\tt \plainfrenchspacing #1}% \null } % @samp. \def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}} % @indicateurl is \samp, that is, with quotes. \let\indicateurl=\samp % @code (and similar) prints in typewriter, but with spaces the same % size as normal in the surrounding text, without hyphenation, etc. % This is a subroutine for that. \def\tclose#1{% {% % Change normal interword space to be same as for the current font. \spaceskip = \fontdimen2\font % % Switch to typewriter. \tt % % But `\ ' produces the large typewriter interword space. \def\ {{\spaceskip = 0pt{} }}% % % Turn off hyphenation. \nohyphenation % \plainfrenchspacing #1% }% \null % reset spacefactor to 1000 } % We *must* turn on hyphenation at `-' and `_' in @code. % (But see \codedashfinish below.) % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. % % Unfortunately, TeX uses one parameter (\hyphenchar) to control % both hyphenation at - and hyphenation within words. % We must therefore turn them both off (\tclose does that) % and arrange explicitly to hyphenate at a dash. -- rms. { \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active \catcode`\`=\active \global\let'=\rq \global\let`=\lq % default definitions % \global\def\code{\begingroup \setcodequotes \catcode\dashChar=\active \catcode\underChar=\active \ifallowcodebreaks \let-\codedash \let_\codeunder \else \let-\normaldash \let_\realunder \fi % Given -foo (with a single dash), we do not want to allow a break % after the hyphen. \global\let\codedashprev=\codedash % \codex } % \gdef\codedash{\futurelet\next\codedashfinish} \gdef\codedashfinish{% \normaldash % always output the dash character itself. % % Now, output a discretionary to allow a line break, unless % (a) the next character is a -, or % (b) the preceding character is a -. % E.g., given --posix, we do not want to allow a break after either -. % Given --foo-bar, we do want to allow a break between the - and the b. \ifx\next\codedash \else \ifx\codedashprev\codedash \else \discretionary{}{}{}\fi \fi % we need the space after the = for the case when \next itself is a % space token; it would get swallowed otherwise. As in @code{- a}. \global\let\codedashprev= \next } } \def\normaldash{-} % \def\codex #1{\tclose{#1}\endgroup} \def\codeunder{% % this is all so @math{@code{var_name}+1} can work. In math mode, _ % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) % will therefore expand the active definition of _, which is us % (inside @code that is), therefore an endless loop. \ifusingtt{\ifmmode \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. \else\normalunderscore \fi \discretionary{}{}{}}% {\_}% } % An additional complication: the above will allow breaks after, e.g., % each of the four underscores in __typeof__. This is bad. % @allowcodebreaks provides a document-level way to turn breaking at - % and _ on and off. % \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} \def\keywordfalse{false} \parseargdef\allowcodebreaks{% \def\txiarg{#1}% \ifx\txiarg\keywordtrue \allowcodebreakstrue \else\ifx\txiarg\keywordfalse \allowcodebreaksfalse \else \errhelp = \EMsimple \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% \fi\fi } % For @command, @env, @file, @option quotes seem unnecessary, % so use \code rather than \samp. \let\command=\code \let\env=\code \let\file=\code \let\option=\code % @uref (abbreviation for `urlref') aka @url takes an optional % (comma-separated) second argument specifying the text to display and % an optional third arg as text to display instead of (rather than in % addition to) the url itself. First (mandatory) arg is the url. % TeX-only option to allow changing PDF output to show only the second % arg (if given), and not the url (which is then just the link target). \newif\ifurefurlonlylink % The default \pretolerance setting stops the penalty inserted in % \urefallowbreak being a discouragement to line breaking. Set it to % a negative value for this paragraph only. Hopefully this does not % conflict with redefinitions of \par done elsewhere. \def\nopretolerance{% \pretolerance=-1 \def\par{\endgraf\pretolerance=100 \let\par\endgraf}% } % The main macro is \urefbreak, which allows breaking at expected % places within the url. \def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak} \let\uref=\urefbreak % \def\dourefbreak#1{\urefbreakfinish #1,,,\finish} \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% look for second arg \ifdim\wd0 > 0pt \ifpdf % For pdfTeX and LuaTeX \ifurefurlonlylink % PDF plus option to not display url, show just arg \unhbox0 \else % PDF, normally display both arg and url for consistency, % visibility, if the pdf is eventually used to print, etc. \unhbox0\ (\urefcode{#1})% \fi \else \ifx\XeTeXrevision\thisisundefined \unhbox0\ (\urefcode{#1})% DVI, always show arg and url \else % For XeTeX \ifurefurlonlylink % PDF plus option to not display url, show just arg \unhbox0 \else % PDF, normally display both arg and url for consistency, % visibility, if the pdf is eventually used to print, etc. \unhbox0\ (\urefcode{#1})% \fi \fi \fi \else \urefcode{#1}% only url given, so show it \fi \fi \endlink \endgroup} % Allow line breaks around only a few characters (only). \def\urefcatcodes{% \catcode`\&=\active \catcode`\.=\active \catcode`\#=\active \catcode`\?=\active \catcode`\/=\active } { \urefcatcodes % \global\def\urefcode{\begingroup \setcodequotes \urefcatcodes \let&\urefcodeamp \let.\urefcodedot \let#\urefcodehash \let?\urefcodequest \let/\urefcodeslash \codex } % % By default, they are just regular characters. \global\def&{\normalamp} \global\def.{\normaldot} \global\def#{\normalhash} \global\def?{\normalquest} \global\def/{\normalslash} } \def\urefcodeamp{\urefprebreak \&\urefpostbreak} \def\urefcodedot{\urefprebreak .\urefpostbreak} \def\urefcodehash{\urefprebreak \#\urefpostbreak} \def\urefcodequest{\urefprebreak ?\urefpostbreak} \def\urefcodeslash{\futurelet\next\urefcodeslashfinish} { \catcode`\/=\active \global\def\urefcodeslashfinish{% \urefprebreak \slashChar % Allow line break only after the final / in a sequence of % slashes, to avoid line break between the slashes in http://. \ifx\next/\else \urefpostbreak \fi } } % By default we'll break after the special characters, but some people like to % break before the special chars, so allow that. Also allow no breaking at % all, for manual control. % \parseargdef\urefbreakstyle{% \def\txiarg{#1}% \ifx\txiarg\wordnone \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} \else\ifx\txiarg\wordbefore \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak} \else\ifx\txiarg\wordafter \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak} \else \errhelp = \EMsimple \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% \fi\fi\fi } \def\wordafter{after} \def\wordbefore{before} \def\wordnone{none} % Allow a ragged right output to aid breaking long URL's. There can % be a break at the \allowbreak with no extra glue (if the existing stretch in % the line is sufficient), a break at the \penalty with extra glue added % at the end of the line, or no break at all here. % Changing the value of the penalty and/or the amount of stretch affects how % preferable one choice is over the other. \def\urefallowbreak{% \penalty0\relax \hskip 0pt plus 2 em\relax \penalty1000\relax \hskip 0pt plus -2 em\relax } \urefbreakstyle after % @url synonym for @uref, since that's how everyone uses it. % \let\url=\uref % rms does not like angle brackets --karl, 17may97. % So now @email is just like @uref, unless we are pdf. % %\def\email#1{\angleleft{\tt #1}\angleright} \ifpdforxetex \def\email#1{\doemail#1,,\finish} \def\doemail#1,#2,#3\finish{\begingroup \unsepspaces \pdfurl{mailto:#1}% \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi \endlink \endgroup} \else \let\email=\uref \fi % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), % `example' (@kbd uses ttsl only inside of @example and friends), % or `code' (@kbd uses normal tty font always). \parseargdef\kbdinputstyle{% \def\txiarg{#1}% \ifx\txiarg\worddistinct \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% \else\ifx\txiarg\wordexample \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% \else\ifx\txiarg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% \else \errhelp = \EMsimple \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% \fi\fi\fi } \def\worddistinct{distinct} \def\wordexample{example} \def\wordcode{code} % Default is `distinct'. \kbdinputstyle distinct % @kbd is like @code, except that if the argument is just one @key command, % then @kbd has no effect. \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}} \def\xkey{\key} \def\kbdsub#1#2#3\par{% \def\one{#1}\def\three{#3}\def\threex{??}% \ifx\one\xkey\ifx\threex\three \key{#2}% \else{\tclose{\kbdfont\setcodequotes\look}}\fi \else{\tclose{\kbdfont\setcodequotes\look}}\fi } % definition of @key that produces a lozenge. Doesn't adjust to text size. %\setfont\keyrm\rmshape{8}{1000}{OT1} %\font\keysy=cmsy9 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% % \vbox{\hrule\kern-0.4pt % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% % \kern-0.4pt\hrule}% % \kern-.06em\raise0.4pt\hbox{\angleright}}}} % definition of @key with no lozenge. If the current font is already % monospace, don't change it; that way, we respect @kbdinputstyle. But % if it isn't monospace, then use \tt. % \def\key#1{{\setregularquotes \nohyphenation \ifmonospace\else\tt\fi #1}\null} % @clicksequence{File @click{} Open ...} \def\clicksequence#1{\begingroup #1\endgroup} % @clickstyle @arrow (by default) \parseargdef\clickstyle{\def\click{#1}} \def\click{\arrow} % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % \def\dmn#1{\thinspace #1} % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. % \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\switchtolsize #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi \null % reset \spacefactor=1000 } % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. % \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi \null % reset \spacefactor=1000 } % @asis just yields its argument. Used with @table, for example. % \def\asis#1{#1} % @math outputs its argument in math mode. % % One complication: _ usually means subscripts, but it could also mean % an actual _ character, as in @math{@var{some_variable} + 1}. So make % _ active, and distinguish by seeing if the current family is \slfam, % which is what @var uses. { \catcode`\_ = \active \gdef\mathunderscore{% \catcode`\_=\active \def_{\ifnum\fam=\slfam \_\else\sb\fi}% } } % Another complication: we want \\ (and @\) to output a math (or tt) \. % FYI, plain.tex uses \\ as a temporary control sequence (for no % particular reason), but this is not advertised and we don't care. % % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} % \def\math{% \ifmmode\else % only go into math if not in math mode already \tex \mathunderscore \let\\ = \mathbackslash \mathactive % make the texinfo accent commands work in math mode \let\"=\ddot \let\'=\acute \let\==\bar \let\^=\hat \let\`=\grave \let\u=\breve \let\v=\check \let\~=\tilde \let\dotaccent=\dot % have to provide another name for sup operator \let\mathopsup=\sup $\expandafter\finishmath\fi } \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. % Some active characters (such as <) are spaced differently in math. % We have to reset their definitions in case the @math was an argument % to a command which sets the catcodes (such as @item or @section). % { \catcode`^ = \active \catcode`< = \active \catcode`> = \active \catcode`+ = \active \catcode`' = \active \gdef\mathactive{% \let^ = \ptexhat \let< = \ptexless \let> = \ptexgtr \let+ = \ptexplus \let' = \ptexquoteright } } % for @sub and @sup, if in math mode, just do a normal sub/superscript. % If in text, use math to place as sub/superscript, but switch % into text mode, with smaller fonts. This is a different font than the % one used for real math sub/superscripts (8pt vs. 7pt), but let's not % fix it (significant additions to font machinery) until someone notices. % \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi} \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}% % \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi} \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}% % provide this command from LaTeX as it is very common \def\frac#1#2{{{#1}\over{#2}}} % @displaymath. % \globaldefs is needed to recognize the end lines in \tex and % \end tex. Set \thisenv as @end displaymath is seen before @end tex. {\obeylines \globaldefs=1 \envdef\displaymath{% \tex% \def\thisenv{\displaymath}% \begingroup\let\end\displaymathend% $$% } \def\displaymathend{$$\endgroup\end}% \def\Edisplaymath{% \def\thisenv{\tex}% \end tex }} % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex, % except specified as a normal braced arg, so no newlines to worry about. % \def\outfmtnametex{tex} % \long\def\inlinefmt#1{\doinlinefmt #1,\finish} \long\def\doinlinefmt#1,#2,\finish{% \def\inlinefmtname{#1}% \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi } % % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if % FMTNAME is tex, else ELSE-TEXT. \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish} \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{% \def\inlinefmtname{#1}% \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi } % % For raw, must switch into @tex before parsing the argument, to avoid % setting catcodes prematurely. Doing it this way means that, for % example, @inlineraw{html, foo{bar} gets a parse error instead of being % ignored. But this isn't important because if people want a literal % *right* brace they would have to use a command anyway, so they may as % well use a command to get a left brace too. We could re-use the % delimiter character idea from \verb, but it seems like overkill. % \long\def\inlineraw{\tex \doinlineraw} \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} \def\doinlinerawtwo#1,#2,\finish{% \def\inlinerawname{#1}% \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi \endgroup % close group opened by \tex. } % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set. % \long\def\inlineifset#1{\doinlineifset #1,\finish} \long\def\doinlineifset#1,#2,\finish{% \def\inlinevarname{#1}% \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \else\ignorespaces#2\fi } % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set. % \long\def\inlineifclear#1{\doinlineifclear #1,\finish} \long\def\doinlineifclear#1,#2,\finish{% \def\inlinevarname{#1}% \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi } \message{glyphs,} % and logos. % @@ prints an @, as does @atchar{}. \def\@{\char64 } \let\atchar=\@ % @{ @} @lbracechar{} @rbracechar{} all generate brace characters. \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}} \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}} \let\{=\lbracechar \let\}=\rbracechar % @comma{} to avoid , parsing problems. \let\comma = , % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \ptexc \let\dotaccent = \ptexdot \def\ringaccent#1{{\accent23 #1}} \let\tieaccent = \ptext \let\ubaraccent = \ptexb \let\udotaccent = \d % Other special characters: @questiondown @exclamdown @ordf @ordm % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}} \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}} % Dotless i and dotless j, used for accents. \def\imacro{i} \def\jmacro{j} \def\dotless#1{% \def\temp{#1}% \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi \else \errmessage{@dotless can be used only with i or j}% \fi\fi } % The \TeX{} logo, as in plain, but resetting the spacing so that a % period following counts as ending a sentence. (Idea found in latex.) % \edef\TeX{\TeX \spacefactor=1000 } % @LaTeX{} logo. Not quite the same results as the definition in % latex.ltx, since we use a different font for the raised A; it's most % convenient for us to use an explicitly smaller font, rather than using % the \scriptstyle font (since we don't reset \scriptstyle and % \scriptscriptstyle). % \def\LaTeX{% L\kern-.36em {\setbox0=\hbox{T}% \vbox to \ht0{\hbox{% \ifx\textnominalsize\xwordpt % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX. % Revert to plain's \scriptsize, which is 7pt. \count255=\the\fam $\fam\count255 \scriptstyle A$% \else % For 11pt, we can use our lllsize. \switchtolllsize A% \fi }% \vss }}% \kern-.15em \TeX } % Some math mode symbols. Define \ensuremath to switch into math mode % unless we are already there. Expansion tricks may not be needed here, % but safer, and can't hurt. \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi} \def\ensuredmath#1{$\relax#1$} % \def\bullet{\ensuremath\ptexbullet} \def\geq{\ensuremath\ge} \def\leq{\ensuremath\le} \def\minus{\ensuremath-} % @dots{} outputs an ellipsis using the current font. % We do .5em per period so that it has the same spacing in the cm % typewriter fonts as three actual period characters; on the other hand, % in other typewriter fonts three periods are wider than 1.5em. So do % whichever is larger. % \def\dots{% \leavevmode \setbox0=\hbox{...}% get width of three periods \ifdim\wd0 > 1.5em \dimen0 = \wd0 \else \dimen0 = 1.5em \fi \hbox to \dimen0{% \hskip 0pt plus.25fil .\hskip 0pt plus1fil .\hskip 0pt plus1fil .\hskip 0pt plus.5fil }% } % @enddots{} is an end-of-sentence ellipsis. % \def\enddots{% \dots \spacefactor=\endofsentencespacefactor } % @point{}, @result{}, @expansion{}, @print{}, @equiv{}. % % Since these characters are used in examples, they should be an even number of % \tt widths. Each \tt character is 1en, so two makes it 1em. % \def\point{$\star$} \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} % The @error{} command. % Adapted from the TeXbook's \boxit. % \newbox\errorbox % {\ttfont \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} % \setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. \advance\hsize by -2\dimen2 % Rules. \vbox{% \hrule height\dimen2 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. \kern3pt\vrule width\dimen2}% Space to right. \hrule height\dimen2} \hfil} % \def\error{\leavevmode\lower.7ex\copy\errorbox} % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % \def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi} % @euro{} comes from a separate font, depending on the current style. % We use the free feym* fonts from the eurosym package by Henrik % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. % % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. % % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted % % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. % % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. % % \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi \thiseurofont } % Glyphs from the EC fonts. We don't use \let for the aliases, because % sometimes we redefine the original macro, and the alias should reflect % the redefinition. % % Use LaTeX names for the Icelandic letters. \def\DH{{\ecfont \char"D0}} % Eth \def\dh{{\ecfont \char"F0}} % eth \def\TH{{\ecfont \char"DE}} % Thorn \def\th{{\ecfont \char"FE}} % thorn % \def\guillemetleft{{\ecfont \char"13}} \def\guillemotleft{\guillemetleft} \def\guillemetright{{\ecfont \char"14}} \def\guillemotright{\guillemetright} \def\guilsinglleft{{\ecfont \char"0E}} \def\guilsinglright{{\ecfont \char"0F}} \def\quotedblbase{{\ecfont \char"12}} \def\quotesinglbase{{\ecfont \char"0D}} % % This positioning is not perfect (see the ogonek LaTeX package), but % we have the precomposed glyphs for the most common cases. We put the % tests to use those glyphs in the single \ogonek macro so we have fewer % dummy definitions to worry about for index entries, etc. % % ogonek is also used with other letters in Lithuanian (IOU), but using % the precomposed glyphs for those is not so easy since they aren't in % the same EC font. \def\ogonek#1{{% \def\temp{#1}% \ifx\temp\macrocharA\Aogonek \else\ifx\temp\macrochara\aogonek \else\ifx\temp\macrocharE\Eogonek \else\ifx\temp\macrochare\eogonek \else \ecfont \setbox0=\hbox{#1}% \ifdim\ht0=1ex\accent"0C #1% \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% \fi \fi\fi\fi\fi }% } \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} % % Use the European Computer Modern fonts (cm-super in outline format) % for non-CM glyphs. That is ec* for regular text and tc* for the text % companion symbols (LaTeX TS1 encoding). Both are part of the ec % package and follow the same conventions. % \def\ecfont{\etcfont{e}} \def\tcfont{\etcfont{t}} % \def\etcfont#1{% % We can't distinguish serif/sans and italic/slanted, but this % is used for crude hacks anyway (like adding French and German % quotes to documents typeset with CM, where we lose kerning), so % hopefully nobody will notice/care. \edef\ecsize{\csname\curfontsize ecsize\endcsname}% \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% \ifmonospace % typewriter: \font\thisecfont = #1ctt\ecsize \space at \nominalsize \else \ifx\curfontstyle\bfstylename % bold: \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize \else % regular: \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize \fi \fi \thisecfont } % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. % \def\registeredsymbol{% $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}% \hfil\crcr\Orb}}% }$% } % @textdegree - the normal degrees sign. % \def\textdegree{$^\circ$} % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. % \ifx\Orb\thisisundefined \def\Orb{\mathhexbox20D} \fi % Quotes. \chardef\quoteleft=`\` \chardef\quoteright=`\' % only change font for tt for correct kerning and to avoid using % \ecfont unless necessary. \def\quotedblleft{% \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi } \def\quotedblright{% \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi } \message{page headings,} \newskip\titlepagetopglue \titlepagetopglue = 1.5in \newskip\titlepagebottomglue \titlepagebottomglue = 2pc % First the title page. Must do @settitle before @titlepage. \newif\ifseenauthor \newif\iffinishedtitlepage % @setcontentsaftertitlepage used to do an implicit @contents or % @shortcontents after @end titlepage, but it is now obsolete. \def\setcontentsaftertitlepage{% \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo command; move your @contents command if you want the contents after the title page.}}% \def\setshortcontentsaftertitlepage{% \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo command; move your @shortcontents and @contents commands if you want the contents after the title page.}}% \parseargdef\shorttitlepage{% \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% \endgroup\page\hbox{}\page} \envdef\titlepage{% % Open one extra group, as we want to close it in the middle of \Etitlepage. \begingroup \parindent=0pt \textfonts % Leave some space at the very top of the page. \vglue\titlepagetopglue % No rule at page bottom unless we print one at the top with @title. \finishedtitlepagetrue % % Most title ``pages'' are actually two pages long, with space % at the top of the second. We don't want the ragged left on the second. \let\oldpage = \page \def\page{% \iffinishedtitlepage\else \finishtitlepage \fi \let\page = \oldpage \page \null }% } \def\Etitlepage{% \iffinishedtitlepage\else \finishtitlepage \fi % It is important to do the page break before ending the group, % because the headline and footline are only empty inside the group. % If we use the new definition of \page, we always get a blank page % after the title page, which we certainly don't want. \oldpage \endgroup % % Need this before the \...aftertitlepage checks so that if they are % in effect the toc pages will come out with page numbers. \HEADINGSon } \def\finishtitlepage{% \vskip4pt \hrule height 2pt width \hsize \vskip\titlepagebottomglue \finishedtitlepagetrue } % Settings used for typesetting titles: no hyphenation, no indentation, % don't worry much about spacing, ragged right. This should be used % inside a \vbox, and fonts need to be set appropriately first. \par should % be specified before the end of the \vbox, since a vbox is a group. % \def\raggedtitlesettings{% \rm \hyphenpenalty=10000 \parindent=0pt \tolerance=5000 \ptexraggedright } % Macros to be used within @titlepage: \let\subtitlerm=\rmfont \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} \parseargdef\title{% \checkenv\titlepage \vbox{\titlefonts \raggedtitlesettings #1\par}% % print a rule at the page bottom also. \finishedtitlepagefalse \vskip4pt \hrule height 4pt width \hsize \vskip4pt } \parseargdef\subtitle{% \checkenv\titlepage {\subtitlefont \rightline{#1}}% } % @author should come last, but may come many times. % It can also be used inside @quotation. % \parseargdef\author{% \def\temp{\quotation}% \ifx\thisenv\temp \def\quotationauthor{#1}% printed in \Equotation. \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi {\secfonts\rm \leftline{#1}}% \fi } % Set up page headings and footings. \let\thispage=\folio \newtoks\evenheadline % headline on even pages \newtoks\oddheadline % headline on odd pages \newtoks\evenchapheadline% headline on even pages with a new chapter \newtoks\oddchapheadline % headline on odd pages with a new chapter \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages % Now make \makeheadline and \makefootline in Plain TeX use those variables \headline={{\textfonts\rm \ifchapterpage \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi \else \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}\HEADINGShook} \let\HEADINGShook=\relax % Commands to set those variables. % For example, this is what @headings on does % @evenheading @thistitle|@thispage|@thischapter % @oddheading @thischapter|@thispage|@thistitle % @evenfooting @thisfile|| % @oddfooting ||@thisfile \def\evenheading{\parsearg\evenheadingxxx} \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} \def\evenheadingyyy #1\|#2\|#3\|#4\finish{% \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}} \global\evenchapheadline=\evenheadline} \def\oddheading{\parsearg\oddheadingxxx} \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} \def\oddheadingyyy #1\|#2\|#3\|#4\finish{% \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}% \global\oddchapheadline=\oddheadline} \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% \def\evenfooting{\parsearg\evenfootingxxx} \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} \def\evenfootingyyy #1\|#2\|#3\|#4\finish{% \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddfooting{\parsearg\oddfootingxxx} \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} \def\oddfootingyyy #1\|#2\|#3\|#4\finish{% \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. \global\advance\txipageheight by -12pt \global\advance\vsize by -12pt } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} % @evenheadingmarks top \thischapter <- chapter at the top of a page % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page % % The same set of arguments for: % % @oddheadingmarks % @evenfootingmarks % @oddfootingmarks % @everyheadingmarks % @everyfootingmarks % These define \getoddheadingmarks, \getevenheadingmarks, % \getoddfootingmarks, and \getevenfootingmarks, each to one of % \gettopheadingmarks, \getbottomheadingmarks. % \def\evenheadingmarks{\headingmarks{even}{heading}} \def\oddheadingmarks{\headingmarks{odd}{heading}} \def\evenfootingmarks{\headingmarks{even}{footing}} \def\oddfootingmarks{\headingmarks{odd}{footing}} \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1} \headingmarks{odd}{heading}{#1} } \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1} \headingmarks{odd}{footing}{#1} } % #1 = even/odd, #2 = heading/footing, #3 = top/bottom. \def\headingmarks#1#2#3 {% \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname \global\expandafter\let\csname get#1#2marks\endcsname \temp } \everyheadingmarks bottom \everyfootingmarks bottom % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. % @headings off turns them off. % @headings on same as @headings double, retained for compatibility. % @headings after turns on double-sided headings after this page. % @headings doubleafter turns on double-sided headings after this page. % @headings singleafter turns on single-sided headings after this page. % By default, they are off at the start of a document, % and turned `on' after @end titlepage. \parseargdef\headings{\csname HEADINGS#1\endcsname} \def\headingsoff{% non-global headings elimination \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}% \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}% } \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting \HEADINGSoff % it's the default % When we turn headings on, set the page number to 1. \def\pageone{ \global\pageno=1 \global\arabiccount = \pagecount } % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document % title on inside top of left hand pages, and page numbers on outside top % edge of all pages. \def\HEADINGSdouble{% \pageone \HEADINGSdoublex } \let\contentsalignmacro = \chappager % For single-sided printing, chapter title goes across top left of page, % page number on top right. \def\HEADINGSsingle{% \pageone \HEADINGSsinglex } \def\HEADINGSon{\HEADINGSdouble} \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} \let\HEADINGSdoubleafter=\HEADINGSafter \def\HEADINGSdoublex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\evenchapheadline={\line{\folio\hfil}} \global\oddchapheadline={\line{\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} \def\HEADINGSsinglex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\evenchapheadline={\line{\hfil\folio}} \global\oddchapheadline={\line{\hfil\folio}} \global\let\contentsalignmacro = \chappager } % for @setchapternewpage off \def\HEADINGSsinglechapoff{% \pageone \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\evenchapheadline=\evenheadline \global\oddchapheadline=\oddheadline \global\let\contentsalignmacro = \chappager } % Subroutines used in generating headings % This produces Day Month Year style of output. % Only define if not already defined, in case a txi-??.tex file has set % up a different format (e.g., txi-cs.tex does this). \ifx\today\thisisundefined \def\today{% \number\day\space \ifcase\month \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec \fi \space\number\year} \fi % @settitle line... specifies the title of the document, for headings. % It generates no output of its own. \def\thistitle{\putwordNoTitle} \def\settitle{\parsearg{\gdef\thistitle}} \message{tables,} % Tables -- @table, @ftable, @vtable, @item(x). % default indentation of table text \newdimen\tableindent \tableindent=.8in % default indentation of @itemize and @enumerate text \newdimen\itemindent \itemindent=.3in % margin between end of table item and start of table text. \newdimen\itemmargin \itemmargin=.1in % used internally for \itemindent minus \itemmargin \newdimen\itemmax % Note @table, @ftable, and @vtable define @item, @itemx, etc., with % these defs. % They also define \itemindex % to index the item name in whatever manner is desired (perhaps none). \newif\ifitemxneedsnegativevskip \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} \def\internalBitem{\smallbreak \parsearg\itemzzz} \def\internalBitemx{\itemxpar \parsearg\itemzzz} \def\itemzzz #1{\begingroup % \advance\hsize by -\rightskip \advance\hsize by -\tableindent \setbox0=\hbox{\itemindicate{#1}}% \itemindex{#1}% \nobreak % This prevents a break before @itemx. % % If the item text does not fit in the space we have, put it on a line % by itself, and do not allow a page break either before or after that % line. We do not start a paragraph here because then if the next % command is, e.g., @kindex, the whatsit would get put into the % horizontal list on a line by itself, resulting in extra blank space. \ifdim \wd0>\itemmax % % Make this a paragraph so we get the \parskip glue and wrapping, % but leave it ragged-right. \begingroup \advance\leftskip by-\tableindent \advance\hsize by\tableindent \advance\rightskip by0pt plus1fil\relax \leavevmode\unhbox0\par \endgroup % % We're going to be starting a paragraph, but we don't want the % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % % Stop a page break at the \parskip glue coming up. However, if % what follows is an environment such as @example, there will be no % \parskip glue; then the negative vskip we just inserted would % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse \else % The item text fits into the space. Start a paragraph, so that the % following text (if any) will end up on the same line. \noindent % Do this with kerns and \unhbox so that if there is a footnote in % the item text, it can migrate to the main vertical list and % eventually be printed. \nobreak\kern-\tableindent \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 \unhbox0 \nobreak\kern\dimen0 \endgroup \itemxneedsnegativevskiptrue \fi } \def\item{\errmessage{@item while not in a list environment}} \def\itemx{\errmessage{@itemx while not in a list environment}} % @table, @ftable, @vtable. \envdef\table{% \let\itemindex\gobble \tablecheck{table}% } \envdef\ftable{% \def\itemindex ##1{\doind {fn}{\code{##1}}}% \tablecheck{ftable}% } \envdef\vtable{% \def\itemindex ##1{\doind {vr}{\code{##1}}}% \tablecheck{vtable}% } \def\tablecheck#1{% \ifnum \the\catcode`\^^M=\active \endgroup \errmessage{This command won't work in this context; perhaps the problem is that we are \inenvironment\thisenv}% \def\next{\doignore{#1}}% \else \let\next\tablex \fi \next } \def\tablex#1{% \def\itemindicate{#1}% \parsearg\tabley } \def\tabley#1{% {% \makevalueexpandable \edef\temp{\noexpand\tablez #1\space\space\space}% \expandafter }\temp \endtablez } \def\tablez #1 #2 #3 #4\endtablez{% \aboveenvbreak \ifnum 0#1>0 \advance \leftskip by #1\mil \fi \ifnum 0#2>0 \tableindent=#2\mil \fi \ifnum 0#3>0 \advance \rightskip by #3\mil \fi \itemmax=\tableindent \advance \itemmax by -\itemmargin \advance \leftskip by \tableindent \exdentamount=\tableindent \parindent = 0pt \parskip = \smallskipamount \ifdim \parskip=0pt \parskip=2pt \fi \let\item = \internalBitem \let\itemx = \internalBitemx } \def\Etable{\endgraf\afterenvbreak} \let\Eftable\Etable \let\Evtable\Etable \let\Eitemize\Etable \let\Eenumerate\Etable % This is the counter used by @enumerate, which is really @itemize \newcount \itemno \envdef\itemize{\parsearg\doitemize} \def\doitemize#1{% \aboveenvbreak \itemmax=\itemindent \advance\itemmax by -\itemmargin \advance\leftskip by \itemindent \exdentamount=\itemindent \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi % % Try typesetting the item mark so that if the document erroneously says % something like @itemize @samp (intending @table), there's an error % right away at the @itemize. It's not the best error message in the % world, but it's better than leaving it to the @item. This means if % the user wants an empty mark, they have to say @w{} not just @w. \def\itemcontents{#1}% \setbox0 = \hbox{\itemcontents}% % % @itemize with no arg is equivalent to @itemize @bullet. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi % \let\item=\itemizeitem } % Definition of @item while inside @itemize and @enumerate. % \def\itemizeitem{% \advance\itemno by 1 % for enumerations {\let\par=\endgraf \smallbreak}% reasonable place to break {% % If the document has an @itemize directly after a section title, a % \nobreak will be last on the list, and \sectionheading will have % done a \vskip-\parskip. In that case, we don't want to zero % parskip, or the item text will crash with the heading. On the % other hand, when there is normal text preceding the item (as there % usually is), we do want to zero parskip, or there would be too much % space. In that case, we won't have a \nobreak before. At least % that's the theory. \ifnum\lastpenalty<10000 \parskip=0in \fi \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% % \ifinner\else \vadjust{\penalty 1200}% not good to break after first line of item. \fi % We can be in inner vertical mode in a footnote, although an % @itemize looks awful there. }% \flushcr } % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. % \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% % Allow an optional argument of an uppercase letter, lowercase letter, % or number, to specify the first label in the enumerated list. No % argument is the same as `1'. % \envparseargdef\enumerate{\enumeratey #1 \endenumeratey} \def\enumeratey #1 #2\endenumeratey{% % If we were given no argument, pretend we were given `1'. \def\thearg{#1}% \ifx\thearg\empty \def\thearg{1}\fi % % Detect if the argument is a single token. If so, it might be a % letter. Otherwise, the only valid thing it can be is a number. % (We will always have one token, because of the test we just made. % This is a good thing, since \splitoff doesn't work given nothing at % all -- the first parameter is undelimited.) \expandafter\splitoff\thearg\endmark \ifx\rest\empty % Only one token in the argument. It could still be anything. % A ``lowercase letter'' is one whose \lccode is nonzero. % An ``uppercase letter'' is one whose \lccode is both nonzero, and % not equal to itself. % Otherwise, we assume it's a number. % % We need the \relax at the end of the \ifnum lines to stop TeX from % continuing to look for a <number>. % \ifnum\lccode\expandafter`\thearg=0\relax \numericenumerate % a number (we hope) \else % It's a letter. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax \lowercaseenumerate % lowercase letter \else \uppercaseenumerate % uppercase letter \fi \fi \else % Multiple tokens in the argument. We hope it's a number. \numericenumerate \fi } % An @enumerate whose labels are integers. The starting integer is % given in \thearg. % \def\numericenumerate{% \itemno = \thearg \startenumeration{\the\itemno}% } % The starting (lowercase) letter is in \thearg. \def\lowercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more lowercase letters in @enumerate; get a bigger alphabet}% \fi \char\lccode\itemno }% } % The starting (uppercase) letter is in \thearg. \def\uppercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more uppercase letters in @enumerate; get a bigger alphabet} \fi \char\uccode\itemno }% } % Call \doitemize, adding a period to the first argument and supplying the % common last two arguments. Also subtract one from the initial value in % \itemno, since @item increments \itemno. % \def\startenumeration#1{% \advance\itemno by -1 \doitemize{#1.}\flushcr } % @multitable macros % Macros used to set up halign preamble: % \let\endsetuptable\relax \def\xendsetuptable{\endsetuptable} \let\columnfractions\relax \def\xcolumnfractions{\columnfractions} \newif\ifsetpercent % #1 is the @columnfraction, usually a decimal number like .5, but might % be just 1. We just use it, whatever it is. % \def\pickupwholefraction#1 {% \global\advance\colcount by 1 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% \setuptable } \newcount\colcount \def\setuptable#1{% \def\firstarg{#1}% \ifx\firstarg\xendsetuptable \let\go = \relax \else \ifx\firstarg\xcolumnfractions \global\setpercenttrue \else \ifsetpercent \let\go\pickupwholefraction \else \global\advance\colcount by 1 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi \ifx\go\pickupwholefraction % Put the argument back for the \pickupwholefraction call, so % we'll always have a period there to be parsed. \def\go{\pickupwholefraction#1}% \else \let\go = \setuptable \fi% \fi \go } % @headitem starts a heading row, which we typeset in bold. Assignments % have to be global since we are inside the implicit group of an % alignment entry. \everycr below resets \everytab so we don't have to % undo it ourselves. \def\headitemfont{\b}% for people to use in the template row; not changeable \def\headitem{% \checkenv\multitable \crcr \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings \global\everytab={\bf}% can't use \headitemfont since the parsing differs \the\everytab % for the first item }% % % default for tables with no headings. \let\headitemcrhook=\relax % \def\tab{\checkenv\multitable &\the\everytab}% \newtoks\everytab % insert after every tab. % \envdef\multitable{% \vskip\parskip \startsavinginserts % % @item within a multitable starts a normal row. % We use \def instead of \let so that if one of the multitable entries % contains an @itemize, we don't choke on the \item (seen as \crcr aka % \endtemplate) expanding \doitemize. \def\item{\crcr}% % \tolerance=9500 \hbadness=9500 \parskip=0pt \parindent=6pt \overfullrule=0pt \global\colcount=0 % \everycr = {% \noalign{% \global\everytab={}% Reset from possible headitem. \global\colcount=0 % Reset the column counter. % % Check for saved footnotes, etc.: \checkinserts % % Perhaps a \nobreak, then reset: \headitemcrhook \global\let\headitemcrhook=\relax }% }% % \parsearg\domultitable } \def\domultitable#1{% % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable % % This preamble sets up a generic column definition, which will % be used as many times as user calls for columns. % \vtop will set a single line and will also let text wrap and % continue for many paragraphs if desired. \halign\bgroup &% \global\advance\colcount by 1 \strut \vtop{% \advance\hsize by -1\leftskip % Find the correct column width \hsize=\expandafter\csname col\the\colcount\endcsname % \rightskip=0pt \ifnum\colcount=1 \advance\hsize by\leftskip % Add indent of surrounding text \else % In order to keep entries from bumping into each other. \leftskip=12pt \ifsetpercent \else % If a template has been used \advance\hsize by \leftskip \fi \fi \noindent\ignorespaces##\unskip\strut }\cr } \def\Emultitable{% \crcr \egroup % end the \halign \global\setpercentfalse } \message{conditionals,} % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, % @ifnotxml always succeed. They currently do nothing; we don't % attempt to check whether the conditionals are properly nested. But we % have to remember that they are conditionals, so that @end doesn't % attempt to close an environment group. % \def\makecond#1{% \expandafter\let\csname #1\endcsname = \relax \expandafter\let\csname iscond.#1\endcsname = 1 } \makecond{iftex} \makecond{ifnotdocbook} \makecond{ifnothtml} \makecond{ifnotinfo} \makecond{ifnotplaintext} \makecond{ifnotxml} % Ignore @ignore, @ifhtml, @ifinfo, and the like. % \def\direntry{\doignore{direntry}} \def\documentdescription{\doignore{documentdescription}} \def\docbook{\doignore{docbook}} \def\html{\doignore{html}} \def\ifdocbook{\doignore{ifdocbook}} \def\ifhtml{\doignore{ifhtml}} \def\ifinfo{\doignore{ifinfo}} \def\ifnottex{\doignore{ifnottex}} \def\ifplaintext{\doignore{ifplaintext}} \def\ifxml{\doignore{ifxml}} \def\ignore{\doignore{ignore}} \def\menu{\doignore{menu}} \def\xml{\doignore{xml}} % Ignore text until a line `@end #1', keeping track of nested conditionals. % % A count to remember the depth of nesting. \newcount\doignorecount \def\doignore#1{\begingroup % Scan in ``verbatim'' mode: \obeylines \catcode`\@ = \other \catcode`\{ = \other \catcode`\} = \other % % Make sure that spaces turn into tokens that match what \doignoretext wants. \spaceisspace % % Count number of #1's that we've seen. \doignorecount = 0 % % Swallow text until we reach the matching `@end #1'. \dodoignore{#1}% } { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. \obeylines % % \gdef\dodoignore#1{% % #1 contains the command name as a string, e.g., `ifinfo'. % % Define a command to find the next `@end #1'. \long\def\doignoretext##1^^M@end #1{% \doignoretextyyy##1^^M@#1\_STOP_}% % % And this command to find another #1 command, at the beginning of a % line. (Otherwise, we would consider a line `@c @ifset', for % example, to count as an @ifset for nesting.) \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% % % And now expand that command. \doignoretext ^^M% }% } \def\doignoreyyy#1{% \def\temp{#1}% \ifx\temp\empty % Nothing found. \let\next\doignoretextzzz \else % Found a nested condition, ... \advance\doignorecount by 1 \let\next\doignoretextyyy % ..., look for another. % If we're here, #1 ends with ^^M\ifinfo (for example). \fi \next #1% the token \_STOP_ is present just after this macro. } % We have to swallow the remaining "\_STOP_". % \def\doignoretextzzz#1{% \ifnum\doignorecount = 0 % We have just found the outermost @end. \let\next\enddoignore \else % Still inside a nested condition. \advance\doignorecount by -1 \let\next\doignoretext % Look for the next @end. \fi \next } % Finish off ignored text. { \obeylines% % Ignore anything after the last `@end #1'; this matters in verbatim % environments, where otherwise the newline after an ignored conditional % would result in a blank line in the output. \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% } % @set VAR sets the variable VAR to an empty value. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. % % Since we want to separate VAR from REST-OF-LINE (which might be % empty), we can't just use \parsearg; we have to insert a space of our % own to delimit the rest of the line, and then take it out again if we % didn't need it. % We rely on the fact that \parsearg sets \catcode`\ =10. % \parseargdef\set{\setyyy#1 \endsetyyy} \def\setyyy#1 #2\endsetyyy{% {% \makevalueexpandable \def\temp{#2}% \edef\next{\gdef\makecsname{SET#1}}% \ifx\temp\empty \next{}% \else \setzzz#2\endsetzzz \fi }% } % Remove the trailing space \setxxx inserted. \def\setzzz#1 \endsetzzz{\next{#1}} % @clear VAR clears (i.e., unsets) the variable VAR. % \parseargdef\clear{% {% \makevalueexpandable \global\expandafter\let\csname SET#1\endcsname=\relax }% } % @value{foo} gets the text saved in variable foo. \def\value{\begingroup\makevalueexpandable\valuexxx} \def\valuexxx#1{\expandablevalue{#1}\endgroup} { \catcode`\-=\active \catcode`\_=\active % \gdef\makevalueexpandable{% \let\value = \expandablevalue % We don't want these characters active, ... \catcode`\-=\other \catcode`\_=\other % ..., but we might end up with active ones in the argument if % we're called from @code, as @code{@value{foo-bar_}}, though. % So \let them to their normal equivalents. \let-\normaldash \let_\normalunderscore } } \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% \message{Variable `#1', used in @value, is not set.}% \else \csname SET#1\endcsname \fi } % Like \expandablevalue, but completely expandable (the \message in the % definition above operates at the execution level of TeX). Used when % writing to auxiliary files, due to the expansion that \write does. % If flag is undefined, pass through an unexpanded @value command: maybe it % will be set by the time it is read back in. % % NB flag names containing - or _ may not work here. \def\dummyvalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax \string\value{#1}% \else \csname SET#1\endcsname \fi } % Used for @value's in index entries to form the sort key: expand the @value % if possible, otherwise sort late. \def\indexnofontsvalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax ZZZZZZZ% \else \csname SET#1\endcsname \fi } % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % % To get the special treatment we need for `@end ifset,' we call % \makecond and then redefine. % \makecond{ifset} \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} \def\doifset#1#2{% {% \makevalueexpandable \let\next=\empty \expandafter\ifx\csname SET#2\endcsname\relax #1% If not set, redefine \next. \fi \expandafter }\next } \def\ifsetfail{\doignore{ifset}} % @ifclear VAR ... @end executes the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % % The `\else' inside the `\doifset' parameter is a trick to reuse the % above code: if the variable is not set, do nothing, if it is set, % then redefine \next to \ifclearfail. % \makecond{ifclear} \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} \def\ifclearfail{\doignore{ifclear}} % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written % without the @) is in fact defined. We can only feasibly check at the % TeX level, so something like `mathcode' is going to considered % defined even though it is not a Texinfo command. % \makecond{ifcommanddefined} \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}} % \def\doifcmddefined#1#2{{% \makevalueexpandable \let\next=\empty \expandafter\ifx\csname #2\endcsname\relax #1% If not defined, \let\next as above. \fi \expandafter }\next } \def\ifcmddefinedfail{\doignore{ifcommanddefined}} % @ifcommandnotdefined CMD ... handled similar to @ifclear above. \makecond{ifcommandnotdefined} \def\ifcommandnotdefined{% \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}} \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}} % Set the `txicommandconditionals' variable, so documents have a way to % test if the @ifcommand...defined conditionals are available. \set txicommandconditionals % @dircategory CATEGORY -- specify a category of the dir file % which this file should belong to. Ignore this in TeX. \let\dircategory=\comment % @defininfoenclose. \let\definfoenclose=\comment \message{indexing,} % Index generation facilities % Define \newwrite to be identical to plain tex's \newwrite % except not \outer, so it can be used within macros and \if's. \edef\newwrite{\makecsname{ptexnewwrite}} % \newindex {foo} defines an index named IX. % It automatically defines \IXindex such that % \IXindex ...rest of line... puts an entry in the index IX. % It also defines \IXindfile to be the number of the output channel for % the file that accumulates this index. The file's extension is IX. % The name of an index should be no more than 2 characters long % for the sake of vms. % \def\newindex#1{% \expandafter\chardef\csname#1indfile\endcsname=0 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index \noexpand\doindex{#1}} } % @defindex foo == \newindex{foo} % \def\defindex{\parsearg\newindex} % Define @defcodeindex, like @defindex except put all entries in @code. % \def\defcodeindex{\parsearg\newcodeindex} % \def\newcodeindex#1{% \expandafter\chardef\csname#1indfile\endcsname=0 \expandafter\xdef\csname#1index\endcsname{% \noexpand\docodeindex{#1}}% } % The default indices: \newindex{cp}% concepts, \newcodeindex{fn}% functions, \newcodeindex{vr}% variables, \newcodeindex{tp}% types, \newcodeindex{ky}% keys \newcodeindex{pg}% and programs. % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. % % @syncodeindex foo bar similar, but put all entries made for index foo % inside @code. % \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), % #3 the target index (bar). \def\dosynindex#1#2#3{% \requireopenindexfile{#3}% % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname \expandafter\let\csname#2indfile\endcsname=\temp % redefine \fooindex: \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } % Define \doindex, the driver for all index macros. % Argument #1 is generated by the calling \fooindex macro, % and it is the two-letter name of the index. \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx} \def\doindexxxx #1{\doind{\indexname}{#1}} % like the previous two, but they put @code around the argument. \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx} \def\docodeindexxxx #1{\docind{\indexname}{#1}} % Used for the aux, toc and index files to prevent expansion of Texinfo % commands. % \def\atdummies{% \definedummyletter\@% \definedummyletter\ % \definedummyletter\{% \definedummyletter\}% \definedummyletter\&% % % Do the redefinitions. \definedummies \otherbackslash } % \definedummyword defines \#1 as \string\#1\space, thus effectively % preventing its expansion. This is used only for control words, % not control letters, because the \space would be incorrect for % control characters, but is needed to separate the control word % from whatever follows. % % These can be used both for control words that take an argument and % those that do not. If it is followed by {arg} in the input, then % that will dutifully get written to the index (or wherever). % % For control letters, we have \definedummyletter, which omits the % space. % \def\definedummyword #1{\def#1{\string#1\space}}% \def\definedummyletter#1{\def#1{\string#1}}% \let\definedummyaccent\definedummyletter % Called from \atdummies to prevent the expansion of commands. % \def\definedummies{% % \let\commondummyword\definedummyword \let\commondummyletter\definedummyletter \let\commondummyaccent\definedummyaccent \commondummiesnofonts % \definedummyletter\_% \definedummyletter\-% % % Non-English letters. \definedummyword\AA \definedummyword\AE \definedummyword\DH \definedummyword\L \definedummyword\O \definedummyword\OE \definedummyword\TH \definedummyword\aa \definedummyword\ae \definedummyword\dh \definedummyword\exclamdown \definedummyword\l \definedummyword\o \definedummyword\oe \definedummyword\ordf \definedummyword\ordm \definedummyword\questiondown \definedummyword\ss \definedummyword\th % % Although these internal commands shouldn't show up, sometimes they do. \definedummyword\bf \definedummyword\gtr \definedummyword\hat \definedummyword\less \definedummyword\sf \definedummyword\sl \definedummyword\tclose \definedummyword\tt % \definedummyword\LaTeX \definedummyword\TeX % % Assorted special characters. \definedummyword\ampchar \definedummyword\atchar \definedummyword\arrow \definedummyword\backslashchar \definedummyword\bullet \definedummyword\comma \definedummyword\copyright \definedummyword\registeredsymbol \definedummyword\dots \definedummyword\enddots \definedummyword\entrybreak \definedummyword\equiv \definedummyword\error \definedummyword\euro \definedummyword\expansion \definedummyword\geq \definedummyword\guillemetleft \definedummyword\guillemetright \definedummyword\guilsinglleft \definedummyword\guilsinglright \definedummyword\lbracechar \definedummyword\leq \definedummyword\mathopsup \definedummyword\minus \definedummyword\ogonek \definedummyword\pounds \definedummyword\point \definedummyword\print \definedummyword\quotedblbase \definedummyword\quotedblleft \definedummyword\quotedblright \definedummyword\quoteleft \definedummyword\quoteright \definedummyword\quotesinglbase \definedummyword\rbracechar \definedummyword\result \definedummyword\sub \definedummyword\sup \definedummyword\textdegree % \definedummyword\subentry % % We want to disable all macros so that they are not expanded by \write. \macrolist \let\value\dummyvalue % \normalturnoffactive } % \commondummiesnofonts: common to \definedummies and \indexnofonts. % Define \commondummyletter, \commondummyaccent and \commondummyword before % using. Used for accents, font commands, and various control letters. % \def\commondummiesnofonts{% % Control letters and accents. \commondummyletter\!% \commondummyaccent\"% \commondummyaccent\'% \commondummyletter\*% \commondummyaccent\,% \commondummyletter\.% \commondummyletter\/% \commondummyletter\:% \commondummyaccent\=% \commondummyletter\?% \commondummyaccent\^% \commondummyaccent\`% \commondummyaccent\~% \commondummyword\u \commondummyword\v \commondummyword\H \commondummyword\dotaccent \commondummyword\ogonek \commondummyword\ringaccent \commondummyword\tieaccent \commondummyword\ubaraccent \commondummyword\udotaccent \commondummyword\dotless % % Texinfo font commands. \commondummyword\b \commondummyword\i \commondummyword\r \commondummyword\sansserif \commondummyword\sc \commondummyword\slanted \commondummyword\t % % Commands that take arguments. \commondummyword\abbr \commondummyword\acronym \commondummyword\anchor \commondummyword\cite \commondummyword\code \commondummyword\command \commondummyword\dfn \commondummyword\dmn \commondummyword\email \commondummyword\emph \commondummyword\env \commondummyword\file \commondummyword\image \commondummyword\indicateurl \commondummyword\inforef \commondummyword\kbd \commondummyword\key \commondummyword\math \commondummyword\option \commondummyword\pxref \commondummyword\ref \commondummyword\samp \commondummyword\strong \commondummyword\tie \commondummyword\U \commondummyword\uref \commondummyword\url \commondummyword\var \commondummyword\verb \commondummyword\w \commondummyword\xref } \let\indexlbrace\relax \let\indexrbrace\relax \let\indexatchar\relax \let\indexbackslash\relax {\catcode`\@=0 \catcode`\\=13 @gdef@backslashdisappear{@def\{}} } { \catcode`\<=13 \catcode`\-=13 \catcode`\`=13 \gdef\indexnonalnumdisappear{% \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else % @set txiindexlquoteignore makes us ignore left quotes in the sort term. % (Introduced for FSFS 2nd ed.) \let`=\empty \fi % \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else \backslashdisappear \fi % \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else \def-{}% \fi \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else \def<{}% \fi \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else \def\@{}% \fi } \gdef\indexnonalnumreappear{% \let-\normaldash \let<\normalless } } % \indexnofonts is used when outputting the strings to sort the index % by, and when constructing control sequence names. It eliminates all % control sequences and just writes whatever the best ASCII sort string % would be for a given command (usually its argument). % \def\indexnofonts{% % Accent commands should become @asis. \def\commondummyaccent##1{\let##1\asis}% % We can just ignore other control letters. \def\commondummyletter##1{\let##1\empty}% % All control words become @asis by default; overrides below. \let\commondummyword\commondummyaccent \commondummiesnofonts % % Don't no-op \tt, since it isn't a user-level command % and is used in the definitions of the active chars like <, >, |, etc. % Likewise with the other plain tex font commands. %\let\tt=\asis % \def\ { }% \def\@{@}% \def\_{\normalunderscore}% \def\-{}% @- shouldn't affect sorting % \uccode`\1=`\{ \uppercase{\def\{{1}}% \uccode`\1=`\} \uppercase{\def\}{1}}% \let\lbracechar\{% \let\rbracechar\}% % % Non-English letters. \def\AA{AA}% \def\AE{AE}% \def\DH{DZZ}% \def\L{L}% \def\OE{OE}% \def\O{O}% \def\TH{TH}% \def\aa{aa}% \def\ae{ae}% \def\dh{dzz}% \def\exclamdown{!}% \def\l{l}% \def\oe{oe}% \def\ordf{a}% \def\ordm{o}% \def\o{o}% \def\questiondown{?}% \def\ss{ss}% \def\th{th}% % \let\do\indexnofontsdef % \do\LaTeX{LaTeX}% \do\TeX{TeX}% % % Assorted special characters. \do\atchar{@}% \do\arrow{->}% \do\bullet{bullet}% \do\comma{,}% \do\copyright{copyright}% \do\dots{...}% \do\enddots{...}% \do\equiv{==}% \do\error{error}% \do\euro{euro}% \do\expansion{==>}% \do\geq{>=}% \do\guillemetleft{<<}% \do\guillemetright{>>}% \do\guilsinglleft{<}% \do\guilsinglright{>}% \do\leq{<=}% \do\lbracechar{\{}% \do\minus{-}% \do\point{.}% \do\pounds{pounds}% \do\print{-|}% \do\quotedblbase{"}% \do\quotedblleft{"}% \do\quotedblright{"}% \do\quoteleft{`}% \do\quoteright{'}% \do\quotesinglbase{,}% \do\rbracechar{\}}% \do\registeredsymbol{R}% \do\result{=>}% \do\textdegree{o}% % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. % \macrolist \let\value\indexnofontsvalue } % Give the control sequence a definition that removes the {} that follows % its use, e.g. @AA{} -> AA \def\indexnofontsdef#1#2{\def#1##1{#2}}% % #1 is the index name, #2 is the entry text. \def\doind#1#2{% \iflinks {% % \requireopenindexfile{#1}% \edef\writeto{\csname#1indfile\endcsname}% % \def\indextext{#2}% \safewhatsit\doindwrite }% \fi } % Same as \doind, but for code indices \def\docind#1#2{% \iflinks {% % \requireopenindexfile{#1}% \edef\writeto{\csname#1indfile\endcsname}% % \def\indextext{#2}% \safewhatsit\docindwrite }% \fi } % Check if an index file has been opened, and if not, open it. \def\requireopenindexfile#1{% \ifnum\csname #1indfile\endcsname=0 \expandafter\newwrite \csname#1indfile\endcsname \edef\suffix{#1}% % A .fls suffix would conflict with the file extension for the output % of -recorder, so use .f1s instead. \ifx\suffix\indexisfl\def\suffix{f1}\fi % Open the file \immediate\openout\csname#1indfile\endcsname \jobname.\suffix % Using \immediate above here prevents an object entering into the current % box, which could confound checks such as those in \safewhatsit for % preceding skips. \typeout{Writing index file \jobname.\suffix}% \fi} \def\indexisfl{fl} % Definition for writing index entry sort key. { \catcode`\-=13 \gdef\indexwritesortas{% \begingroup \indexnonalnumreappear \indexwritesortasxxx} \gdef\indexwritesortasxxx#1{% \xdef\indexsortkey{#1}\endgroup} } \def\indexwriteseealso#1{ \gdef\pagenumbertext{\string\seealso{#1}}% } \def\indexwriteseeentry#1{ \gdef\pagenumbertext{\string\seeentry{#1}}% } % The default definitions \def\sortas#1{}% \def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only \def\putwordSeeAlso{See also} \def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}": % * Set \bracedtext to "{aaa}{bbb}" % * Set \fullindexsortkey to "aaa @subentry ZZZ" % * If @seealso occurs, set \pagenumbertext % \def\splitindexentry#1{% \gdef\fullindexsortkey{}% \xdef\bracedtext{}% \def\sep{}% \def\seealso##1{}% \def\seeentry##1{}% \expandafter\doindexsegment#1\subentry\finish\subentry } % append the results from the next segment \def\doindexsegment#1\subentry{% \def\segment{#1}% \ifx\segment\isfinish \else % % Fully expand the segment, throwing away any @sortas directives, and % trim spaces. \edef\trimmed{\segment}% \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% \ifincodeindex \edef\trimmed{\noexpand\code{\trimmed}}% \fi % \xdef\bracedtext{\bracedtext{\trimmed}}% % % Get the string to sort by. Process the segment with all % font commands turned off. \bgroup \let\sortas\indexwritesortas \let\seealso\indexwriteseealso \let\seeentry\indexwriteseeentry \indexnofonts % The braces around the commands are recognized by texindex. \def\lbracechar{{\string\indexlbrace}}% \def\rbracechar{{\string\indexrbrace}}% \let\{=\lbracechar \let\}=\rbracechar \def\@{{\string\indexatchar}}% \def\atchar##1{\@}% \def\backslashchar{{\string\indexbackslash}}% \uccode`\~=`\\ \uppercase{\let~\backslashchar}% % \let\indexsortkey\empty \global\let\pagenumbertext\empty % Execute the segment and throw away the typeset output. This executes % any @sortas or @seealso commands in this segment. \setbox\dummybox = \hbox{\segment}% \ifx\indexsortkey\empty{% \indexnonalnumdisappear \xdef\trimmed{\segment}% \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% \xdef\indexsortkey{\trimmed}% \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi }\fi % % Append to \fullindexsortkey. \edef\tmp{\gdef\noexpand\fullindexsortkey{% \fullindexsortkey\sep\indexsortkey}}% \tmp \egroup \def\sep{\subentry}% % \expandafter\doindexsegment \fi } \def\isfinish{\finish}% \newbox\dummybox % used above \let\subentry\relax % Use \ instead of @ in index files. To support old texi2dvi and texindex. % This works without changing the escape character used in the toc or aux % files because the index entries are fully expanded here, and \string uses % the current value of \escapechar. \def\escapeisbackslash{\escapechar=`\\} % Use \ in index files by default. texi2dvi didn't support @ as the escape % character (as it checked for "\entry" in the files, and not "@entry"). When % the new version of texi2dvi has had a chance to become more prevalent, then % the escape character can change back to @ again. This should be an easy % change to make now because both @ and \ are only used as escape characters in % index files, never standing for themselves. % \set txiindexescapeisbackslash % Write the entry in \indextext to the index file. % \newif\ifincodeindex \def\doindwrite{\incodeindexfalse\doindwritex} \def\docindwrite{\incodeindextrue\doindwritex} \def\doindwritex{% \maybemarginindex % \atdummies % \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax\else \escapeisbackslash \fi % % For texindex which always views { and } as separators. \def\{{\lbracechar{}}% \def\}{\rbracechar{}}% \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}% % % Split the entry into primary entry and any subentries, and get the index % sort key. \splitindexentry\indextext % % Set up the complete index entry, with both the sort key and % the original text, including any font commands. We write % three arguments to \entry to the .?? file (four in the % subentry case), texindex reduces to two when writing the .??s % sorted result. % \edef\temp{% \write\writeto{% \string\entry{\fullindexsortkey}% {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}% \bracedtext}% }% \temp } % Put the index entry in the margin if desired (undocumented). \def\maybemarginindex{% \ifx\SETmarginindex\relax\else \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}% \fi } \let\SETmarginindex=\relax % Take care of unwanted page breaks/skips around a whatsit: % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting % the skip again. Otherwise, the whatsit generated by the % \write or \pdfdest will make \lastskip zero. The result is that % sequences like this: % @end defun % @tindex whatever % @defun ... % will have extra space inserted, because the \medbreak in the % start of the @defun won't see the skip inserted by the @end of % the previous defun. % % But don't do any of this if we're not in vertical mode. We % don't want to do a \vskip and prematurely end a paragraph. % % Avoid page breaks due to these extra skips, too. % % But wait, there is a catch there: % We'll have to check whether \lastskip is zero skip. \ifdim is not % sufficient for this purpose, as it ignores stretch and shrink parts % of the skip. The only way seems to be to check the textual % representation of the skip. % % The following is almost like \def\zeroskipmacro{0.0pt} except that % the ``p'' and ``t'' characters have catcode \other, not 11 (letter). % \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} % \newskip\whatsitskip \newcount\whatsitpenalty % % ..., ready, GO: % \def\safewhatsit#1{\ifhmode #1% \else % \lastskip and \lastpenalty cannot both be nonzero simultaneously. \whatsitskip = \lastskip \edef\lastskipmacro{\the\lastskip}% \whatsitpenalty = \lastpenalty % % If \lastskip is nonzero, that means the last item was a % skip. And since a skip is discardable, that means this % -\whatsitskip glue we're inserting is preceded by a % non-discardable item, therefore it is not a potential % breakpoint, therefore no \nobreak needed. \ifx\lastskipmacro\zeroskipmacro \else \vskip-\whatsitskip \fi % #1% % \ifx\lastskipmacro\zeroskipmacro % If \lastskip was zero, perhaps the last item was a penalty, and % perhaps it was >=10000, e.g., a \nobreak. In that case, we want % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: % @deffn deffn-whatever % @vindex index-whatever % Description. % would allow a break between the index-whatever whatsit % and the "Description." paragraph. \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi \else % On the other hand, if we had a nonzero \lastskip, % this make-up glue would be preceded by a non-discardable item % (the whatsit from the \write), so we must insert a \nobreak. \nobreak\vskip\whatsitskip \fi \fi} % The index entry written in the file actually looks like % \entry {sortstring}{page}{topic} % or % \entry {sortstring}{page}{topic}{subtopic} % The texindex program reads in these files and writes files % containing these kinds of lines: % \initial {c} % before the first topic whose initial is c % \entry {topic}{pagelist} % for a topic that is used without subtopics % \primary {topic} % \entry {topic}{} % for the beginning of a topic that is used with subtopics % \secondary {subtopic}{pagelist} % for each subtopic. % \secondary {subtopic}{} % for a subtopic with sub-subtopics % \tertiary {subtopic}{subsubtopic}{pagelist} % for each sub-subtopic. % Define the user-accessible indexing commands % @findex, @vindex, @kindex, @cindex. \def\findex {\fnindex} \def\kindex {\kyindex} \def\cindex {\cpindex} \def\vindex {\vrindex} \def\tindex {\tpindex} \def\pindex {\pgindex} % Define the macros used in formatting output of the sorted index material. % @printindex causes a particular index (the ??s file) to get printed. % It does not print any chapter heading (usually an @unnumbered). % \parseargdef\printindex{\begingroup \dobreak \chapheadingskip{10000}% % \smallfonts \rm \tolerance = 9500 \plainfrenchspacing \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See comment in \requireopenindexfile. \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi % % See if the index file exists and is nonempty. \openin 1 \jobname.\indexname s \ifeof 1 % \enddoublecolumns gets confused if there is no text in the index, % and it loses the chapter title and the aux file entries for the % index. The easiest way to prevent this problem is to make sure % there is some text. \putwordIndexNonexistent \typeout{No file \jobname.\indexname s.}% \else % If the index file exists but is empty, then \openin leaves \ifeof % false. We have to make TeX try to read something from the file, so % it can discover if there is anything in it. \read 1 to \thisline \ifeof 1 \putwordIndexIsEmpty \else \expandafter\printindexzz\thisline\relax\relax\finish% \fi \fi \closein 1 \endgroup} % If the index file starts with a backslash, forgo reading the index % file altogether. If somebody upgrades texinfo.tex they may still have % old index files using \ as the escape character. Reading this would % at best lead to typesetting garbage, at worst a TeX syntax error. \def\printindexzz#1#2\finish{% \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1 \expandafter\ifx\csname SETtxiskipindexfileswithbackslash\endcsname\relax \errmessage{% ERROR: A sorted index file in an obsolete format was skipped. To fix this problem, please upgrade your version of 'texi2dvi' or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>. If you are using an old version of 'texindex' (part of the Texinfo distribution), you may also need to upgrade to a newer version (at least 6.0). You may be able to typeset the index if you run 'texindex \jobname.\indexname' yourself. You could also try setting the 'txiindexescapeisbackslash' flag by running a command like 'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'. If you do this, Texinfo will try to use index files in the old format. If you continue to have problems, deleting the index files and starting again might help (with 'rm \jobname.?? \jobname.??s')% }% \else (Skipped sorted index file in obsolete format) \fi \else \begindoublecolumns \input \jobname.\indexname s \enddoublecolumns \fi \else \begindoublecolumns \catcode`\\=0\relax % % Make @ an escape character to give macros a chance to work. This % should work because we (hopefully) don't otherwise use @ in index files. %\catcode`\@=12\relax \catcode`\@=0\relax \input \jobname.\indexname s \enddoublecolumns \fi } % These macros are used by the sorted index file itself. % Change them to control the appearance of the index. {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13 \catcode`\$=3 \gdef\initialglyphs{% % special control sequences used in the index sort key \let\indexlbrace\{% \let\indexrbrace\}% \let\indexatchar\@% \def\indexbackslash{\math{\backslash}}% % % Some changes for non-alphabetic characters. Using the glyphs from the % math fonts looks more consistent than the typewriter font used elsewhere % for these characters. \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}} % % In case @\ is used for backslash \uppercase{\let\\=~} % Can't get bold backslash so don't use bold forward slash \catcode`\/=13 \def/{{\secrmnotbold \normalslash}}% \def-{{\normaldash\normaldash}}% en dash `--' \def^{{\chapbf \normalcaret}}% \def~{{\chapbf \normaltilde}}% \def\_{% \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }% \def|{$\vert$}% \def<{$\less$}% \def>{$\gtr$}% \def+{$\normalplus$}% }} \def\initial{% \bgroup \initialglyphs \initialx } \def\initialx#1{% % Remove any glue we may have, we'll be inserting our own. \removelastskip % % We like breaks before the index initials, so insert a bonus. % The glue before the bonus allows a little bit of space at the % bottom of a column to reduce an increase in inter-line spacing. \nobreak \vskip 0pt plus 5\baselineskip \penalty -300 \vskip 0pt plus -5\baselineskip % % Typeset the initial. Making this add up to a whole number of % baselineskips increases the chance of the dots lining up from column % to column. It still won't often be perfect, because of the stretch % we need before each entry, but it's better. % % No shrink because it confuses \balancecolumns. \vskip 1.67\baselineskip plus 1\baselineskip \leftline{\secfonts \kern-0.05em \secbf #1}% % \secfonts is inside the argument of \leftline so that the change of % \baselineskip will not affect any glue inserted before the vbox that % \leftline creates. % Do our best not to break after the initial. \nobreak \vskip .33\baselineskip plus .1\baselineskip \egroup % \initialglyphs } \newdimen\entryrightmargin \entryrightmargin=0pt % \entry typesets a paragraph consisting of the text (#1), dot leaders, and % then page number (#2) flushed to the right margin. It is used for index % and table of contents entries. The paragraph is indented by \leftskip. % \def\entry{% \begingroup % % Start a new paragraph if necessary, so our assignments below can't % affect previous text. \par % % No extra space above this paragraph. \parskip = 0in % % When reading the text of entry, convert explicit line breaks % from @* into spaces. The user might give these in long section % titles, for instance. \def\*{\unskip\space\ignorespaces}% \def\entrybreak{\hfil\break}% An undocumented command % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = } \def\entrybreak{\unskip\space\ignorespaces}% \def\doentry{% % Save the text of the entry \global\setbox\boxA=\hbox\bgroup \bgroup % Instead of the swallowed brace. \noindent \aftergroup\finishentry % And now comes the text of the entry. % Not absorbing as a macro argument reduces the chance of problems % with catcodes occurring. } {\catcode`\@=11 \gdef\finishentry#1{% \egroup % end box A \dimen@ = \wd\boxA % Length of text of entry \global\setbox\boxA=\hbox\bgroup \unhbox\boxA % #1 is the page number. % % Get the width of the page numbers, and only use % leaders if they are present. \global\setbox\boxB = \hbox{#1}% \ifdim\wd\boxB = 0pt \null\nobreak\hfill\ % \else % \null\nobreak\indexdotfill % Have leaders before the page number. % \ifpdforxetex \pdfgettoks#1.% \hskip\skip\thinshrinkable\the\toksA \else \hskip\skip\thinshrinkable #1% \fi \fi \egroup % end \boxA \ifdim\wd\boxB = 0pt \noindent\unhbox\boxA\par \nobreak \else\bgroup % We want the text of the entries to be aligned to the left, and the % page numbers to be aligned to the right. % \parindent = 0pt \advance\leftskip by 0pt plus 1fil \advance\leftskip by 0pt plus -1fill \rightskip = 0pt plus -1fil \advance\rightskip by 0pt plus 1fill % Cause last line, which could consist of page numbers on their own % if the list of page numbers is long, to be aligned to the right. \parfillskip=0pt plus -1fill % \advance\rightskip by \entryrightmargin % Determine how far we can stretch into the margin. % This allows, e.g., "Appendix H GNU Free Documentation License" to % fit on one line in @letterpaper format. \ifdim\entryrightmargin>2.1em \dimen@i=2.1em \else \dimen@i=0em \fi \advance \parfillskip by 0pt minus 1\dimen@i % \dimen@ii = \hsize \advance\dimen@ii by -1\leftskip \advance\dimen@ii by -1\entryrightmargin \advance\dimen@ii by 1\dimen@i \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line \ifdim\dimen@ > 0.8\dimen@ii % due to long index text % Try to split the text roughly evenly. \dimen@ will be the length of % the first line. \dimen@ = 0.7\dimen@ \dimen@ii = \hsize \ifnum\dimen@>\dimen@ii % If the entry is too long (for example, if it needs more than % two lines), use all the space in the first line. \dimen@ = \dimen@ii \fi \advance\leftskip by 0pt plus 1fill % ragged right \advance \dimen@ by 1\rightskip \parshape = 2 0pt \dimen@ 0em \dimen@ii % Ideally we'd add a finite glue at the end of the first line only, % instead of using \parshape with explicit line lengths, but TeX % doesn't seem to provide a way to do such a thing. % % Indent all lines but the first one. \advance\leftskip by 1em \advance\parindent by -1em \fi\fi \indent % start paragraph \unhbox\boxA % % Do not prefer a separate line ending with a hyphen to fewer lines. \finalhyphendemerits = 0 % % Word spacing - no stretch \spaceskip=\fontdimen2\font minus \fontdimen4\font % \linepenalty=1000 % Discourage line breaks. \hyphenpenalty=5000 % Discourage hyphenation. % \par % format the paragraph \egroup % The \vbox \fi \endgroup }} \newskip\thinshrinkable \skip\thinshrinkable=.15em minus .15em % Like plain.tex's \dotfill, except uses up at least 1 em. % The filll stretch here overpowers both the fil and fill stretch to push % the page number to the right. \def\indexdotfill{\cleaders \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll} \def\primary #1{\line{#1\hfil}} \def\secondary{\indententry{0.5cm}} \def\tertiary{\indententry{1cm}} \def\indententry#1#2#3{% \bgroup \leftskip=#1 \entry{#2}{#3}% \egroup } % Define two-column mode, which we use to typeset indexes. % Adapted from the TeXbook, page 416, which is to say, % the manmac.tex format used to print the TeXbook itself. \catcode`\@=11 % private names \newbox\partialpage \newdimen\doublecolumnhsize \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns % If not much space left on page, start a new page. \ifdim\pagetotal>0.8\vsize\vfill\eject\fi % % Grab any single-column material above us. \output = {% \savetopmark % \global\setbox\partialpage = \vbox{% % Unvbox the main output page. \unvbox\PAGE \kern-\topskip \kern\baselineskip }% }% \eject % run that output routine to set \partialpage % % Use the double-column output routine for subsequent pages. \output = {\doublecolumnout}% % % Change the page size parameters. We could do this once outside this % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 % format, but then we repeat the same computation. Repeating a couple % of assignments once per index is clearly meaningless for the % execution time, so we may as well do it in one place. % % First we halve the line length, less a little for the gutter between % the columns. We compute the gutter based on the line length, so it % changes automatically with the paper format. The magic constant % below is chosen so that the gutter has the same value (well, +-<1pt) % as it did when we hard-coded it. % % We put the result in a separate register, \doublecolumhsize, so we % can restore it in \pagesofar, after \hsize itself has (potentially) % been clobbered. % \doublecolumnhsize = \hsize \advance\doublecolumnhsize by -.04154\hsize \divide\doublecolumnhsize by 2 \hsize = \doublecolumnhsize % % Get the available space for the double columns -- the normal % (undoubled) page height minus any material left over from the % previous page. \advance\vsize by -\ht\partialpage \vsize = 2\vsize % % For the benefit of balancing columns \advance\baselineskip by 0pt plus 0.5pt } % The double-column output routine for all double-column pages except % the last, which is done by \balancecolumns. % \def\doublecolumnout{% % \savetopmark \splittopskip=\topskip \splitmaxdepth=\maxdepth \dimen@ = \vsize \divide\dimen@ by 2 % % box0 will be the left-hand column, box2 the right. \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@ \global\advance\vsize by 2\ht\partialpage \onepageout\pagesofar % empty except for the first time we are called \unvbox\PAGE \penalty\outputpenalty } % % Re-output the contents of the output page -- any previous material, % followed by the two boxes we just split, in box0 and box2. \def\pagesofar{% \unvbox\partialpage % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize \hbox to\txipagewidth{\box0\hfil\box2}% } % Finished with double columns. \def\enddoublecolumns{% % The following penalty ensures that the page builder is exercised % _before_ we change the output routine. This is necessary in the % following situation: % % The last section of the index consists only of a single entry. % Before this section, \pagetotal is less than \pagegoal, so no % break occurs before the last section starts. However, the last % section, consisting of \initial and the single \entry, does not % fit on the page and has to be broken off. Without the following % penalty the page builder will not be exercised until \eject % below, and by that time we'll already have changed the output % routine to the \balancecolumns version, so the next-to-last % double-column page will be processed with \balancecolumns, which % is wrong: The two columns will go to the main vertical list, with % the broken-off section in the recent contributions. As soon as % the output routine finishes, TeX starts reconsidering the page % break. The two columns and the broken-off section both fit on the % page, because the two columns now take up only half of the page % goal. When TeX sees \eject from below which follows the final % section, it invokes the new output routine that we've set after % \balancecolumns below; \onepageout will try to fit the two columns % and the final section into the vbox of \txipageheight (see % \pagebody), causing an overfull box. % % Note that glue won't work here, because glue does not exercise the % page builder, unlike penalties (see The TeXbook, pp. 280-281). \penalty0 % \output = {% % Split the last of the double-column material. \savetopmark \balancecolumns }% \eject % call the \output just set \ifdim\pagetotal=0pt % Having called \balancecolumns once, we do not % want to call it again. Therefore, reset \output to its normal % definition right away. \global\output=\expandafter{\the\defaultoutput} % \endgroup % started in \begindoublecolumns % Leave the double-column material on the current page, no automatic % page break. \box\balancedcolumns % % \pagegoal was set to the doubled \vsize above, since we restarted % the current page. We're now back to normal single-column % typesetting, so reset \pagegoal to the normal \vsize. \global\vsize = \txipageheight % \pagegoal = \txipageheight % \else % We had some left-over material. This might happen when \doublecolumnout % is called in \balancecolumns. Try again. \expandafter\enddoublecolumns \fi } \newbox\balancedcolumns \setbox\balancedcolumns=\vbox{shouldnt see this}% % % Only called for the last of the double column material. \doublecolumnout % does the others. \def\balancecolumns{% \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \ifdim\dimen@<7\baselineskip % Don't split a short final column in two. \setbox2=\vbox{}% \global\setbox\balancedcolumns=\vbox{\pagesofar}% \else % double the leading vertical space \advance\dimen@ by \topskip \advance\dimen@ by-\baselineskip \divide\dimen@ by 2 % target to split to \dimen@ii = \dimen@ \splittopskip = \topskip % Loop until left column is at least as high as the right column. {% \vbadness = 10000 \loop \global\setbox3 = \copy0 \global\setbox1 = \vsplit3 to \dimen@ \ifdim\ht1<\ht3 \global\advance\dimen@ by 1pt \repeat }% % Now the left column is in box 1, and the right column in box 3. % % Check whether the left column has come out higher than the page itself. % (Note that we have doubled \vsize for the double columns, so % the actual height of the page is 0.5\vsize). \ifdim2\ht1>\vsize % It appears that we have been called upon to balance too much material. % Output some of it with \doublecolumnout, leaving the rest on the page. \setbox\PAGE=\box0 \doublecolumnout \else % Compare the heights of the two columns. \ifdim4\ht1>5\ht3 % Column heights are too different, so don't make their bottoms % flush with each other. \setbox2=\vbox to \ht1 {\unvbox3\vfill}% \setbox0=\vbox to \ht1 {\unvbox1\vfill}% \else % Make column bottoms flush with each other. \setbox2=\vbox to\ht1{\unvbox3\unskip}% \setbox0=\vbox to\ht1{\unvbox1\unskip}% \fi \global\setbox\balancedcolumns=\vbox{\pagesofar}% \fi \fi % } \catcode`\@ = \other \message{sectioning,} % Chapters, sections, etc. % Let's start with @part. \outer\parseargdef\part{\partzzz{#1}} \def\partzzz#1{% \chapoddpage \null \vskip.3\vsize % move it down on the page a bit \begingroup \noindent \titlefonts\rm #1\par % the text \let\lastnode=\empty % no node to associate with \writetocentry{part}{#1}{}% but put it in the toc \headingsoff % no headline or footline on the part page % This outputs a mark at the end of the page that clears \thischapter % and \thissection, as is done in \startcontents. \let\pchapsepmacro\relax \chapmacro{}{Yomitfromtoc}{}% \chapoddpage \endgroup } % \unnumberedno is an oxymoron. But we count the unnumbered % sections so that we can refer to them unambiguously in the pdf % outlines by their "section number". We avoid collisions with chapter % numbers by starting them at 10000. (If a document ever has 10000 % chapters, we're in trouble anyway, I'm sure.) \newcount\unnumberedno \unnumberedno = 10000 \newcount\chapno \newcount\secno \secno=0 \newcount\subsecno \subsecno=0 \newcount\subsubsecno \subsubsecno=0 % This counter is funny since it counts through charcodes of letters A, B, ... \newcount\appendixno \appendixno = `\@ % % \def\appendixletter{\char\the\appendixno} % We do the following ugly conditional instead of the above simple % construct for the sake of pdftex, which needs the actual % letter in the expansion, not just typeset. % \def\appendixletter{% \ifnum\appendixno=`A A% \else\ifnum\appendixno=`B B% \else\ifnum\appendixno=`C C% \else\ifnum\appendixno=`D D% \else\ifnum\appendixno=`E E% \else\ifnum\appendixno=`F F% \else\ifnum\appendixno=`G G% \else\ifnum\appendixno=`H H% \else\ifnum\appendixno=`I I% \else\ifnum\appendixno=`J J% \else\ifnum\appendixno=`K K% \else\ifnum\appendixno=`L L% \else\ifnum\appendixno=`M M% \else\ifnum\appendixno=`N N% \else\ifnum\appendixno=`O O% \else\ifnum\appendixno=`P P% \else\ifnum\appendixno=`Q Q% \else\ifnum\appendixno=`R R% \else\ifnum\appendixno=`S S% \else\ifnum\appendixno=`T T% \else\ifnum\appendixno=`U U% \else\ifnum\appendixno=`V V% \else\ifnum\appendixno=`W W% \else\ifnum\appendixno=`X X% \else\ifnum\appendixno=`Y Y% \else\ifnum\appendixno=`Z Z% % The \the is necessary, despite appearances, because \appendixletter is % expanded while writing the .toc file. \char\appendixno is not % expandable, thus it is written literally, thus all appendixes come out % with the same letter (or @) in the toc without it. \else\char\the\appendixno \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} % Each @chapter defines these (using marks) as the number+name, number % and name of the chapter. Page headings and footings can use % these. @section does likewise. \def\thischapter{} \def\thischapternum{} \def\thischaptername{} \def\thissection{} \def\thissectionnum{} \def\thissectionname{} \newcount\absseclevel % used to calculate proper heading level \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count % @raisesections: treat @section as chapter, @subsection as section, etc. \def\raisesections{\global\advance\secbase by -1} % @lowersections: treat @chapter as section, @section as subsection, etc. \def\lowersections{\global\advance\secbase by 1} % we only have subsub. \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. % To achieve this, remember the "biggest" unnum. sec. we are currently in: \chardef\unnlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: % \chapheadtype is "N" or "A", unnumbered chapters are ignored. \def\chapheadtype{N} % Choose a heading macro % #1 is heading type % #2 is heading level % #3 is text for heading \def\genhead#1#2#3{% % Compute the abs. sec. level: \absseclevel=#2 \advance\absseclevel by \secbase % Make sure \absseclevel doesn't fall outside the range: \ifnum \absseclevel < 0 \absseclevel = 0 \else \ifnum \absseclevel > 3 \absseclevel = 3 \fi \fi % The heading type: \def\headtype{#1}% \if \headtype U% \ifnum \absseclevel < \unnlevel \chardef\unnlevel = \absseclevel \fi \else % Check for appendix sections: \ifnum \absseclevel = 0 \edef\chapheadtype{\headtype}% \else \if \headtype A\if \chapheadtype N% \errmessage{@appendix... within a non-appendix chapter}% \fi\fi \fi % Check for numbered within unnumbered: \ifnum \absseclevel > \unnlevel \def\headtype{U}% \else \chardef\unnlevel = 3 \fi \fi % Now print the heading: \if \headtype U% \ifcase\absseclevel \unnumberedzzz{#3}% \or \unnumberedseczzz{#3}% \or \unnumberedsubseczzz{#3}% \or \unnumberedsubsubseczzz{#3}% \fi \else \if \headtype A% \ifcase\absseclevel \appendixzzz{#3}% \or \appendixsectionzzz{#3}% \or \appendixsubseczzz{#3}% \or \appendixsubsubseczzz{#3}% \fi \else \ifcase\absseclevel \chapterzzz{#3}% \or \seczzz{#3}% \or \numberedsubseczzz{#3}% \or \numberedsubsubseczzz{#3}% \fi \fi \fi \suppressfirstparagraphindent } % an interface: \def\numhead{\genhead N} \def\apphead{\genhead A} \def\unnmhead{\genhead U} % @chapter, @appendix, @unnumbered. Increment top-level counter, reset % all lower-level sectioning counters to zero. % % Also set \chaplevelprefix, which we prepend to @float sequence numbers % (e.g., figures), q.v. By default (before any chapter), that is empty. \let\chaplevelprefix = \empty % \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz \def\chapterzzz#1{% % section resetting is \global in case the chapter is in a group, such % as an @include file. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\chapno by 1 % % Used for \float. \gdef\chaplevelprefix{\the\chapno.}% \resetallfloatnos % % \putwordChapter can contain complex things in translations. \toks0=\expandafter{\putwordChapter}% \message{\the\toks0 \space \the\chapno}% % % Write the actual heading. \chapmacro{#1}{Ynumbered}{\the\chapno}% % % So @section and the like are numbered underneath this chapter. \global\let\section = \numberedsec \global\let\subsection = \numberedsubsec \global\let\subsubsection = \numberedsubsubsec } \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz % \def\appendixzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\appendixno by 1 \gdef\chaplevelprefix{\appendixletter.}% \resetallfloatnos % % \putwordAppendix can contain complex things in translations. \toks0=\expandafter{\putwordAppendix}% \message{\the\toks0 \space \appendixletter}% % \chapmacro{#1}{Yappendix}{\appendixletter}% % \global\let\section = \appendixsec \global\let\subsection = \appendixsubsec \global\let\subsubsection = \appendixsubsubsec } % normally unnmhead0 calls unnumberedzzz: \outer\parseargdef\unnumbered{\unnmhead0{#1}} \def\unnumberedzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\unnumberedno by 1 % % Since an unnumbered has no number, no prefix for figures. \global\let\chaplevelprefix = \empty \resetallfloatnos % % This used to be simply \message{#1}, but TeX fully expands the % argument to \message. Therefore, if #1 contained @-commands, TeX % expanded them. For example, in `@unnumbered The @cite{Book}', TeX % expanded @cite (which turns out to cause errors because \cite is meant % to be executed, not expanded). % % Anyway, we don't want the fully-expanded definition of @cite to appear % as a result of the \message, we just want `@cite' itself. We use % \the<toks register> to achieve this: TeX expands \the<toks> only once, % simply yielding the contents of <toks register>. (We also do this for % the toc entries.) \toks0 = {#1}% \message{(\the\toks0)}% % \chapmacro{#1}{Ynothing}{\the\unnumberedno}% % \global\let\section = \unnumberedsec \global\let\subsection = \unnumberedsubsec \global\let\subsubsection = \unnumberedsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. \outer\parseargdef\centerchap{% \let\centerparametersmaybe = \centerparameters \unnmhead0{#1}% \let\centerparametersmaybe = \relax } % @top is like @unnumbered. \let\top\unnumbered % Sections. % \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz \def\seczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } % normally calls appendixsectionzzz: \outer\parseargdef\appendixsection{\apphead1{#1}} \def\appendixsectionzzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } \let\appendixsec\appendixsection % normally calls unnumberedseczzz: \outer\parseargdef\unnumberedsec{\unnmhead1{#1}} \def\unnumberedseczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. % % normally calls numberedsubseczzz: \outer\parseargdef\numberedsubsec{\numhead2{#1}} \def\numberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } % normally calls appendixsubseczzz: \outer\parseargdef\appendixsubsec{\apphead2{#1}} \def\appendixsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno}% } % normally calls unnumberedsubseczzz: \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} \def\unnumberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno}% } % Subsubsections. % % normally numberedsubsubseczzz: \outer\parseargdef\numberedsubsubsec{\numhead3{#1}} \def\numberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynumbered}% {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } % normally appendixsubsubseczzz: \outer\parseargdef\appendixsubsubsec{\apphead3{#1}} \def\appendixsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } % normally unnumberedsubsubseczzz: \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} \def\unnumberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% } % These macros control what the section commands do, according % to what kind of chapter we are in (ordinary, appendix, or unnumbered). % Define them by default for a numbered chapter. \let\section = \numberedsec \let\subsection = \numberedsubsec \let\subsubsection = \numberedsubsubsec % Define @majorheading, @heading and @subheading \def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% \parsearg\chapheadingzzz } \def\chapheading{\chapbreak \parsearg\chapheadingzzz} \def\chapheadingzzz#1{% \vbox{\chapfonts \raggedtitlesettings #1\par}% \nobreak\bigskip \nobreak \suppressfirstparagraphindent } % @heading, @subheading, @subsubheading. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} % These macros generate a chapter, section, etc. heading only % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. % Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} % Parameter controlling skip before chapter headings (if needed) \newskip\chapheadingskip % Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} % Start a new page \def\chappager{\par\vfill\supereject} % \chapoddpage - start on an odd page for a new chapter % Because \domark is called before \chapoddpage, the filler page will % get the headings for the next chapter, which is wrong. But we don't % care -- we just disable all headings on the filler page. \def\chapoddpage{% \chappager \ifodd\pageno \else \begingroup \headingsoff \null \chappager \endgroup \fi } \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname} \def\CHAPPAGoff{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chapbreak \global\def\HEADINGSon{\HEADINGSsinglechapoff}} \def\CHAPPAGon{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} \def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage \global\def\HEADINGSon{\HEADINGSdouble}} \CHAPPAGon % \chapmacro - Chapter opening. % % #1 is the text, #2 is the section type (Ynumbered, Ynothing, % Yappendix, Yomitfromtoc), #3 the chapter number. % Not used for @heading series. % % To test against our argument. \def\Ynothingkeyword{Ynothing} \def\Yappendixkeyword{Yappendix} \def\Yomitfromtockeyword{Yomitfromtoc} % \def\chapmacro#1#2#3{% \expandafter\ifx\thisenv\titlepage\else \checkenv{}% chapters, etc., should not start inside an environment. \fi % Insert the first mark before the heading break (see notes for \domark). \let\prevchapterdefs=\currentchapterdefs \let\prevsectiondefs=\currentsectiondefs \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% \gdef\thissection{}}% % \def\temptype{#2}% \ifx\temptype\Ynothingkeyword \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{\thischaptername}}% \else\ifx\temptype\Yomitfromtockeyword \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{}}% \else\ifx\temptype\Yappendixkeyword \toks0={#1}% \xdef\currentchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\appendixletter}% % \noexpand\putwordAppendix avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} \noexpand\thischapternum: \noexpand\thischaptername}% }% \else \toks0={#1}% \xdef\currentchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\the\chapno}% % \noexpand\putwordChapter avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thischapter{\noexpand\putwordChapter{} \noexpand\thischapternum: \noexpand\thischaptername}% }% \fi\fi\fi % % Output the mark. Pass it through \safewhatsit, to take care of % the preceding space. \safewhatsit\domark % % Insert the chapter heading break. \pchapsepmacro % % Now the second mark, after the heading break. No break points % between here and the heading. \let\prevchapterdefs=\currentchapterdefs \let\prevsectiondefs=\currentsectiondefs \domark % {% \chapfonts \rm \let\footnote=\errfootnoteheading % give better error message % % Have to define \currentsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. \gdef\currentsection{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unnchap}% \else\ifx\temptype\Yomitfromtockeyword \setbox0 = \hbox{}% contents like unnumbered, but no toc entry \def\toctype{omit}% \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% \def\toctype{app}% \else \setbox0 = \hbox{#3\enspace}% \def\toctype{numchap}% \fi\fi\fi % % Write the toc entry for this chapter. Must come before the % \donoderef, because we include the current node name in the toc % entry, and \donoderef resets it to empty. \writetocentry{\toctype}{#1}{#3}% % % For pdftex, we have to write out the node definition (aka, make % the pdfdest) after any page break, but before the actual text has % been typeset. If the destination for the pdf outline is after the % text, then jumping from the outline may wind up with the text not % being visible, for instance under high magnification. \donoderef{#2}% % % Typeset the actual heading. \nobreak % Avoid page breaks at the interline glue. \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% \nobreak\bigskip % no page break after a chapter title \nobreak } % @centerchap -- centered and unnumbered. \let\centerparametersmaybe = \relax \def\centerparameters{% \advance\rightskip by 3\rightskip \leftskip = \rightskip \parfillskip = 0pt } % Section titles. These macros combine the section number parts and % call the generic \sectionheading to do the printing. % \newskip\secheadingskip \def\secheadingbreak{\dobreak \secheadingskip{-1000}} % Subsection titles. \newskip\subsecheadingskip \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} % Subsubsection titles. \def\subsubsecheadingskip{\subsecheadingskip} \def\subsubsecheadingbreak{\subsecheadingbreak} % Print any size, any type, section title. % % #1 is the text of the title, % #2 is the section level (sec/subsec/subsubsec), % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc), % #4 is the section number. % \def\seckeyword{sec} % \def\sectionheading#1#2#3#4{% {% \def\sectionlevel{#2}% \def\temptype{#3}% % % It is ok for the @heading series commands to appear inside an % environment (it's been historically allowed, though the logic is % dubious), but not the others. \ifx\temptype\Yomitfromtockeyword\else \checkenv{}% non-@*heading should not be in an environment. \fi \let\footnote=\errfootnoteheading % % Switch to the right set of fonts. \csname #2fonts\endcsname \rm % % Insert first mark before the heading break (see notes for \domark). \let\prevsectiondefs=\currentsectiondefs \ifx\temptype\Ynothingkeyword \ifx\sectionlevel\seckeyword \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% \gdef\thissection{\thissectionname}}% \fi \else\ifx\temptype\Yomitfromtockeyword % Don't redefine \thissection. \else\ifx\temptype\Yappendixkeyword \ifx\sectionlevel\seckeyword \toks0={#1}% \xdef\currentsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thissection{\noexpand\putwordSection{} \noexpand\thissectionnum: \noexpand\thissectionname}% }% \fi \else \ifx\sectionlevel\seckeyword \toks0={#1}% \xdef\currentsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thissection{\noexpand\putwordSection{} \noexpand\thissectionnum: \noexpand\thissectionname}% }% \fi \fi\fi\fi % % Go into vertical mode. Usually we'll already be there, but we % don't want the following whatsit to end up in a preceding paragraph % if the document didn't happen to have a blank line. \par % % Output the mark. Pass it through \safewhatsit, to take care of % the preceding space. \safewhatsit\domark % % Insert space above the heading. \csname #2headingbreak\endcsname % % Now the second mark, after the heading break. No break points % between here and the heading. \global\let\prevsectiondefs=\currentsectiondefs \domark % % Only insert the space after the number if we have a section number. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% \gdef\currentsection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, % and don't redefine \currentsection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% \gdef\currentsection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% \gdef\currentsection{#1}% \fi\fi\fi % % Write the toc entry (before \donoderef). See comments in \chapmacro. \writetocentry{\toctype\sectionlevel}{#1}{#4}% % % Write the node reference (= pdf destination for pdftex). % Again, see comments in \chapmacro. \donoderef{#3}% % % Interline glue will be inserted when the vbox is completed. % That glue will be a valid breakpoint for the page, since it'll be % preceded by a whatsit (usually from the \donoderef, or from the % \writetocentry if there was no node). We don't want to allow that % break, since then the whatsits could end up on page n while the % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. \nobreak % % Output the actual section heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 % zero if no section number \unhbox0 #1}% }% % Add extra space after the heading -- half of whatever came above it. % Don't allow stretch, though. \kern .5 \csname #2headingskip\endcsname % % Do not let the kern be a potential breakpoint, as it would be if it % was followed by glue. \nobreak % % We'll almost certainly start a paragraph next, so don't let that % glue accumulate. (Not a breakpoint because it's preceded by a % discardable item.) However, when a paragraph is not started next % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out % or the negative glue will cause weirdly wrong output, typically % obscuring the section heading with something else. \vskip-\parskip % % This is so the last item on the main vertical list is a known % \penalty > 10000, so \startdefun, etc., can recognize the situation % and do the needful. \penalty 10001 } \message{toc,} % Table of contents. \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. % Called from @chapter, etc. % % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} % We append the current node name (if any) and page number as additional % arguments for the \{chap,sec,...}entry macros which will eventually % read this. The node name is used in the pdf outlines as the % destination to jump to. % % We open the .toc file for writing here instead of at @setfilename (or % any other fixed time) so that @contents can be anywhere in the document. % But if #1 is `omit', then we don't do anything. This is used for the % table of contents chapter openings themselves. % \newif\iftocfileopened \def\omitkeyword{omit}% % \def\writetocentry#1#2#3{% \edef\writetoctype{#1}% \ifx\writetoctype\omitkeyword \else \iftocfileopened\else \immediate\openout\tocfile = \jobname.toc \global\tocfileopenedtrue \fi % \iflinks {\atdummies \edef\temp{% \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% \temp }% \fi \fi % % Tell \shipout to create a pdf destination on each page, if we're % writing pdf. These are used in the table of contents. We can't % just write one on every page because the title pages are numbered % 1 and 2 (the page numbers aren't printed), and so are the first % two pages of the document. Thus, we'd have two destinations named % `1', and two named `2'. \ifpdforxetex \global\pdfmakepagedesttrue \fi } % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. % \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active \catcode`\<=\active \catcode`\>=\active \catcode`\\=\active \catcode`\^=\active \catcode`\_=\active \catcode`\|=\active \catcode`\~=\active } % Read the toc file, which is essentially Texinfo input. \def\readtocfile{% \setupdatafile \activecatcodes \input \tocreadfilename } \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 % Prepare to read what we've written to \tocfile. % \def\startcontents#1{% % If @setchapternewpage on, and @headings double, the contents should % start on an odd page, unlike chapters. \contentsalignmacro \immediate\closeout\tocfile % % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. \chapmacro{#1}{Yomitfromtoc}{}% % \savepageno = \pageno \begingroup % Set up to handle contents files properly. \raggedbottom % Worry more about breakpoints than the bottom. \entryrightmargin=\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi \def\thistitle{}% no title in double-sided headings % Record where the Roman numerals started. \ifnum\romancount=0 \global\romancount=\pagecount \fi } % redefined for the two-volume lispref. We always output on % \jobname.toc even if this is redefined. % \def\tocreadfilename{\jobname.toc} % Normal (long) toc. % \def\contents{% \startcontents{\putwordTOC}% \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \ifeof 1 \else \pdfmakeoutlines \fi \closein 1 \endgroup \contentsendroman } % And just the chapters. \def\summarycontents{% \startcontents{\putwordShortTOC}% % \let\partentry = \shortpartentry \let\numchapentry = \shortchapentry \let\appentry = \shortchapentry \let\unnchapentry = \shortunnchapentry % We want a true roman here for the page numbers. \secfonts \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl \let\tt=\shortconttt \rm \hyphenpenalty = 10000 \advance\baselineskip by 1pt % Open it up a little. \def\numsecentry##1##2##3##4{} \let\appsecentry = \numsecentry \let\unnsecentry = \numsecentry \let\numsubsecentry = \numsecentry \let\appsubsecentry = \numsecentry \let\unnsubsecentry = \numsecentry \let\numsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi \closein 1 \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \endgroup \contentsendroman } \let\shortcontents = \summarycontents % Get ready to use Arabic numerals again \def\contentsendroman{% \lastnegativepageno = \pageno \global\pageno = \savepageno % % If \romancount > \arabiccount, the contents are at the end of the % document. Otherwise, advance where the Arabic numerals start for % the page numbers. \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi } % Typeset the label for a chapter or appendix for the short contents. % The arg is, e.g., `A' for an appendix, or `3' for a chapter. % \def\shortchaplabel#1{% % This space should be enough, since a single number is .5em, and the % widest letter (M) is 1em, at least in the Computer Modern fonts. % But use \hss just in case. % (This space doesn't include the extra space that gets added after % the label; that gets put in by \shortchapentry above.) % % We'd like to right-justify chapter numbers, but that looks strange % with appendix letters. And right-justifying numbers and % left-justifying letters looks strange when there is less than 10 % chapters. Have to read the whole toc once to know how many chapters % there are before deciding ... \hbox to 1em{#1\hss}% } % These macros generate individual entries in the table of contents. % The first argument is the chapter or section name. % The last argument is the page number. % The arguments in between are the chapter number, section number, ... % Parts, in the main contents. Replace the part number, which doesn't % exist, with an empty box. Let's hope all the numbers have the same width. % Also ignore the page number, which is conventionally not printed. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} \def\partentry#1#2#3#4{% % Add stretch and a bonus for breaking the page before the part heading. % This reduces the chance of the page being broken immediately after the % part heading, before a following chapter heading. \vskip 0pt plus 5\baselineskip \penalty-300 \vskip 0pt plus -5\baselineskip \dochapentry{\numeralbox\labelspace#1}{}% } % % Parts, in the short toc. \def\shortpartentry#1#2#3#4{% \penalty-300 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip \shortchapentry{{\bf #1}}{\numeralbox}{}{}% } % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} % Chapters, in the short toc. % See comments in \dochapentry re vbox and related settings. \def\shortchapentry#1#2#3#4{% \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% } % Appendices, in the main contents. % Need the word Appendix, and a fixed-size box. % \def\appendixbox#1{% % We use M since it's probably the widest letter. \setbox0 = \hbox{\putwordAppendix{} M}% \hbox to \wd0{\putwordAppendix{} #1\hss}} % \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}} % Unnumbered chapters. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} % Sections. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} \let\appsecentry=\numsecentry \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} \let\appsubsecentry=\numsubsecentry \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} % And subsubsections. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} \let\appsubsubsecentry=\numsubsubsecentry \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} % This parameter controls the indentation of the various levels. % Same as \defaultparindent. \newdimen\tocindent \tocindent = 15pt % Now for the actual typesetting. In all these, #1 is the text and #2 is the % page number. % % If the toc has to be broken over pages, we want it to be at chapters % if at all possible; hence the \penalty. \def\dochapentry#1#2{% \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup % Move the page numbers slightly to the right \advance\entryrightmargin by -0.05em \chapentryfonts \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup \nobreak\vskip .25\baselineskip plus.1\baselineskip } \def\dosecentry#1#2{\begingroup \secentryfonts \leftskip=\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsecentry#1#2{\begingroup \subsecentryfonts \leftskip=2\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsubsecentry#1#2{\begingroup \subsubsecentryfonts \leftskip=3\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} % We use the same \entry macro as for the index entries. \let\tocentry = \entry % Space between chapter (or whatever) number and the title. \def\labelspace{\hskip1em \relax} \def\dopageno#1{{\rm #1}} \def\doshortpageno#1{{\rm #1}} \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} \def\subsecentryfonts{\textfonts} \def\subsubsecentryfonts{\textfonts} \message{environments,} % @foo ... @end foo. % @tex ... @end tex escapes into raw TeX temporarily. % One exception: @ is still an escape character, so that @end tex works. % But \@ or @@ will get a plain @ character. \envdef\tex{% \setregularquotes \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 \catcode `\+=\other \catcode `\"=\other \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other \catcode `\`=\other \catcode `\'=\other % % ' is active in math mode (mathcode"8000). So reset it, and all our % other math active characters (just in case), to plain's definitions. \mathactive % % Inverse of the list at the beginning of the file. \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc \let\,=\ptexcomma \let\.=\ptexdot \let\dots=\ptexdots \let\equiv=\ptexequiv \let\!=\ptexexclam \let\i=\ptexi \let\indent=\ptexindent \let\noindent=\ptexnoindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace \let\/=\ptexslash \let\sp=\ptexsp \let\*=\ptexstar %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode \let\t=\ptext \expandafter \let\csname top\endcsname=\ptextop % we've made it outer \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% } % There is no need to define \Etex. % Define @lisp ... @end lisp. % @lisp environment forms a group so it can rebind things, % including the definition of @end lisp (which normally is erroneous). % Amount to narrow the margins by for @lisp. \newskip\lispnarrowing \lispnarrowing=0.4in % This is the definition that ^^M gets inside @lisp, @example, and other % such environments. \null is better than a space, since it doesn't % have any width. \def\lisppar{\null\endgraf} % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt % Make spacing and below environment symmetrical. We use \parskip here % to help in doing that, since in @example-like environments \parskip % is reset to zero; thus the \afterenvbreak inserts no space -- but the % start of the next paragraph will insert \parskip. % \def\aboveenvbreak{{% % =10000 instead of <10000 because of a special case in \itemzzz and % \sectionheading, q.v. \ifnum \lastpenalty=10000 \else \advance\envskipamount by \parskip \endgraf \ifdim\lastskip<\envskipamount \removelastskip \ifnum\lastpenalty<10000 % Penalize breaking before the environment, because preceding text % often leads into it. \penalty100 \fi \vskip\envskipamount \fi \fi }} \def\afterenvbreak{{% % =10000 instead of <10000 because of a special case in \itemzzz and % \sectionheading, q.v. \ifnum \lastpenalty=10000 \else \advance\envskipamount by \parskip \endgraf \ifdim\lastskip<\envskipamount \removelastskip % it's not a good place to break if the last penalty was \nobreak % or better ... \ifnum\lastpenalty<10000 \penalty-50 \fi \vskip\envskipamount \fi \fi }} % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will % also clear it, so that its embedded environments do the narrowing again. \let\nonarrowing=\relax % @cartouche ... @end cartouche: draw rectangle w/rounded corners around % environment contents. % \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth \def\ctr{{\hskip 6pt\circle\char'010}} \def\cbl{{\circle\char'012\hskip -6pt}} \def\cbr{{\hskip 6pt\circle\char'011}} \def\carttop{\hbox to \cartouter{\hskip\lskip \ctl\leaders\hrule height\circthick\hfil\ctr \hskip\rskip}} \def\cartbot{\hbox to \cartouter{\hskip\lskip \cbl\leaders\hrule height\circthick\hfil\cbr \hskip\rskip}} % \newskip\lskip\newskip\rskip % only require the font if @cartouche is actually used \def\cartouchefontdefs{% \font\circle=lcircle10\relax \circthick=\fontdimen8\circle } \newdimen\circthick \newdimen\cartouter\newdimen\cartinner \newskip\normbskip\newskip\normpskip\newskip\normlskip \envdef\cartouche{% \cartouchefontdefs \ifhmode\par\fi % can't be in the midst of a paragraph. \startsavinginserts \lskip=\leftskip \rskip=\rightskip \leftskip=0pt\rightskip=0pt % we want these *outside*. \cartinner=\hsize \advance\cartinner by-\lskip \advance\cartinner by-\rskip \cartouter=\hsize \advance\cartouter by 18.4pt % allow for 3pt kerns on either % side, and for 6pt waste from % each corner char, and rule thickness \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % % If this cartouche directly follows a sectioning command, we need the % \parskip glue (backspaced over by default) or the cartouche can % collide with the section heading. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi % \setbox\groupbox=\vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop \hbox\bgroup \hskip\lskip \vrule\kern3pt \vbox\bgroup \kern3pt \hsize=\cartinner \baselineskip=\normbskip \lineskip=\normlskip \parskip=\normpskip \vskip -\parskip \comment % For explanation, see the end of def\group. } \def\Ecartouche{% \ifhmode\par\fi \kern3pt \egroup \kern3pt\vrule \hskip\rskip \egroup \cartbot \egroup \addgroupbox \checkinserts } % This macro is called at the beginning of all the @example variants, % inside a group. \newdimen\nonfillparindent \def\nonfillstart{% \aboveenvbreak \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt % Turn off paragraph indentation but redefine \indent to emulate % the normal \indent. \nonfillparindent=\parindent \parindent = 0pt \let\indent\nonfillindent % \emergencystretch = 0pt % don't try to avoid overfull boxes \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing \exdentamount=\lispnarrowing \else \let\nonarrowing = \relax \fi \let\exdent=\nofillexdent } \begingroup \obeyspaces % We want to swallow spaces (but not other tokens) after the fake % @indent in our nonfill-environments, where spaces are normally % active and set to @tie, resulting in them not being ignored after % @indent. \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% \gdef\nonfillindentcheck{% \ifx\temp % \expandafter\nonfillindentgobble% \else% \leavevmode\nonfillindentbox% \fi% }% \endgroup \def\nonfillindentgobble#1{\nonfillindent} \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} % If you want all examples etc. small: @set dispenvsize small. % If you want even small examples the full size: @set dispenvsize nosmall. % This affects the following displayed environments: % @example, @display, @format, @lisp, @verbatim % \def\smallword{small} \def\nosmallword{nosmall} \let\SETdispenvsize\relax \def\setnormaldispenv{% \ifx\SETdispenvsize\smallword % end paragraph for sake of leading, in case document has no blank % line. This is redundant with what happens in \aboveenvbreak, but % we need to do it before changing the fonts, and it's inconvenient % to change the fonts afterward. \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } \def\setsmalldispenv{% \ifx\SETdispenvsize\nosmallword \else \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } % We often define two environments, @foo and @smallfoo. % Let's do it in one command. #1 is the env name, #2 the definition. \def\makedispenvdef#1#2{% \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% \expandafter\let\csname E#1\endcsname \afterenvbreak \expandafter\let\csname Esmall#1\endcsname \afterenvbreak } % Define two environment synonyms (#1 and #2) for an environment. \def\maketwodispenvdef#1#2#3{% \makedispenvdef{#1}{#3}% \makedispenvdef{#2}{#3}% } % % @lisp: indented, narrowed, typewriter font; % @example: same as @lisp. % % @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel@xerox. % \maketwodispenvdef{lisp}{example}{% \nonfillstart \tt\setcodequotes \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. \parsearg\gobble } % @display/@smalldisplay: same as @lisp except keep current font. % \makedispenvdef{display}{% \nonfillstart \gobble } % @format/@smallformat: same as @display except don't narrow margins. % \makedispenvdef{format}{% \let\nonarrowing = t% \nonfillstart \gobble } % @flushleft: same as @format, but doesn't obey \SETdispenvsize. \envdef\flushleft{% \let\nonarrowing = t% \nonfillstart \gobble } \let\Eflushleft = \afterenvbreak % @flushright. % \envdef\flushright{% \let\nonarrowing = t% \nonfillstart \advance\leftskip by 0pt plus 1fill\relax \gobble } \let\Eflushright = \afterenvbreak % @raggedright does more-or-less normal line breaking but no right % justification. From plain.tex. \envdef\raggedright{% \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax } \let\Eraggedright\par \envdef\raggedleft{% \parindent=0pt \leftskip0pt plus2em \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt \hbadness=10000 % Last line will usually be underfull, so turn off % badness reporting. } \let\Eraggedleft\par \envdef\raggedcenter{% \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt \hbadness=10000 % Last line will usually be underfull, so turn off % badness reporting. } \let\Eraggedcenter\par % @quotation does normal linebreaking (hence we can't use \nonfillstart) % and narrows the margins. We keep \parskip nonzero in general, since % we're doing normal filling. So, when using \aboveenvbreak and % \afterenvbreak, temporarily make \parskip 0. % \makedispenvdef{quotation}{\quotationstart} % \def\quotationstart{% \indentedblockstart % same as \indentedblock, but increase right margin too. \ifx\nonarrowing\relax \advance\rightskip by \lispnarrowing \fi \parsearg\quotationlabel } % We have retained a nonzero parskip for the environment, since we're % doing normal filling. % \def\Equotation{% \par \ifx\quotationauthor\thisisundefined\else % indent a bit. \leftline{\kern 2\leftskip \sl ---\quotationauthor}% \fi {\parskip=0pt \afterenvbreak}% } \def\Esmallquotation{\Equotation} % If we're given an argument, typeset it in bold with a colon after. \def\quotationlabel#1{% \def\temp{#1}% \ifx\temp\empty \else {\bf #1: }% \fi } % @indentedblock is like @quotation, but indents only on the left and % has no optional argument. % \makedispenvdef{indentedblock}{\indentedblockstart} % \def\indentedblockstart{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt % % @cartouche defines \nonarrowing to inhibit narrowing at next level down. \ifx\nonarrowing\relax \advance\leftskip by \lispnarrowing \exdentamount = \lispnarrowing \else \let\nonarrowing = \relax \fi } % Keep a nonzero parskip for the environment, since we're doing normal filling. % \def\Eindentedblock{% \par {\parskip=0pt \afterenvbreak}% } \def\Esmallindentedblock{\Eindentedblock} % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} % If we want to allow any <char> as delimiter, % we need the curly braces so that makeinfo sees the @verb command, eg: % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org % % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. % % [Knuth] p.344; only we need to do the other characters Texinfo sets % active too. Otherwise, they get lost as the first character on a % verbatim line. \def\dospecials{% \do\ \do\\\do\{\do\}\do\$\do\&% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% \do\<\do\>\do\|\do\@\do+\do\"% % Don't do the quotes -- if we do, @set txicodequoteundirected and % @set txicodequotebacktick will not have effect on @verb and % @verbatim, and ?` and !` ligatures won't get disabled. %\do\`\do\'% } % % [Knuth] p. 380 \def\uncatcodespecials{% \def\do##1{\catcode`##1=\other}\dospecials} % % Setup for the @verb command. % % Eight spaces for a tab \begingroup \catcode`\^^I=\active \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} \endgroup % \def\setupverb{% \tt % easiest (and conventionally used) font for verbatim \def\par{\leavevmode\endgraf}% \setcodequotes \tabeightspaces % Respect line breaks, % print special symbols as themselves, and % make each space count % must do in this order: \obeylines \uncatcodespecials \sepspaces } % Setup for the @verbatim environment % % Real tab expansion. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % % We typeset each line of the verbatim in an \hbox, so we can handle % tabs. \newbox\verbbox \def\starttabbox{\setbox\verbbox=\hbox\bgroup} % \begingroup \catcode`\^^I=\active \gdef\tabexpand{% \catcode`\^^I=\active \def^^I{\leavevmode\egroup \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab \divide\dimen\verbbox by\tabw \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw \wd\verbbox=\dimen\verbbox \leavevmode\box\verbbox \starttabbox }% } \endgroup % start the verbatim environment. \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart \tt % easiest (and conventionally used) font for verbatim \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}% \tabexpand \setcodequotes % Respect line breaks, % print special symbols as themselves, and % make each space count. % Must do in this order: \obeylines \uncatcodespecials \sepspaces } % Do the @verb magic: verbatim text is quoted by unique % delimiter characters. Before first delimiter expect a % right brace, after last delimiter expect closing brace: % % \def\doverb'{'<char>#1<char>'}'{#1} % % [Knuth] p. 382; only eat outer {} \begingroup \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] \endgroup % \def\verb{\begingroup\setupverb\doverb} % % % Do the @verbatim magic: define the macro \doverbatim so that % the (first) argument ends when '@end verbatim' is reached, ie: % % \def\doverbatim#1@end verbatim{#1} % % For Texinfo it's a lot easier than for LaTeX, % because texinfo's \verbatim doesn't stop at '\end{verbatim}': % we need not redefine '\', '{' and '}'. % % Inspired by LaTeX's verbatim command set [latex.ltx] % \begingroup \catcode`\ =\active \obeylines % % ignore everything up to the first ^^M, that's the newline at the end % of the @verbatim input line itself. Otherwise we get an extra blank % line in the output. \xdef\doverbatim#1^^M#2@end verbatim{% \starttabbox#2\egroup\noexpand\end\gobble verbatim}% % We really want {...\end verbatim} in the body of the macro, but % without the active space; thus we have to use \xdef and \gobble. % The \egroup ends the \verbbox started at the end of the last line in % the block. \endgroup % \envdef\verbatim{% \setnormaldispenv\setupverbatim\doverbatim } \let\Everbatim = \afterenvbreak % @verbatiminclude FILE - insert text of file in verbatim environment. % \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} % \def\doverbatiminclude#1{% {% \makevalueexpandable \setupverbatim {% \indexnofonts % Allow `@@' and other weird things in file names. \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% \edef\tmp{\noexpand\input #1 } \expandafter }\expandafter\starttabbox\tmp\egroup \afterenvbreak }% } % @copying ... @end copying. % Save the text away for @insertcopying later. % % We save the uninterpreted tokens, rather than creating a box. % Saving the text in a box would be much easier, but then all the % typesetting commands (@smallbook, font changes, etc.) have to be done % beforehand -- and a) we want @copying to be done first in the source % file; b) letting users define the frontmatter in as flexible order as % possible is desirable. % \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} % \def\insertcopying{% \begingroup \parindent = 0pt % paragraph indentation looks wrong on title page \scanexp\copyingtext \endgroup } \message{defuns,} % @defun etc. \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt \newcount\defunpenalty % Start the processing of @deffn: \def\startdefun{% \ifnum\lastpenalty<10000 \medbreak \defunpenalty=10003 % Will keep this @deffn together with the % following @def command, see below. \else % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we need to allow a % break somewhere. Check specifically for penalty 10002, inserted % by \printdefunline, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. % % As a further refinement, we avoid "club" headers by signalling % with penalty of 10003 after the very first @deffn in the % sequence (see above), and penalty of 10002 after any following % @def command. \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi % % Similarly, after a section heading, do not allow a break. % But do insert the glue. \medskip % preceded by discardable penalty, so not a breakpoint \fi % \parindent=0in \advance\leftskip by \defbodyindent \exdentamount=\defbodyindent } \def\dodefunx#1{% % First, check whether we are in the right environment: \checkenv#1% % % As above, allow line break if we have multiple x headers in a row. % It's not a great place, though. \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi % % And now, it's time to reuse the body of the original defun: \expandafter\gobbledefun#1% } \def\gobbledefun#1\startdefun{} % \printdefunline \deffnheader{text} % \def\printdefunline#1#2{% \begingroup % call \deffnheader: #1#2 \endheader % common ending: \interlinepenalty = 10000 \advance\rightskip by 0pt plus 1fil\relax \endgraf \nobreak\vskip -\parskip \penalty\defunpenalty % signal to \startdefun and \dodefunx % Some of the @defun-type tags do not enable magic parentheses, % rendering the following check redundant. But we don't optimize. \checkparencounts \endgroup } \def\Edefun{\endgraf\medbreak} % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; % the only thing remaining is to define \deffnheader. % \def\makedefun#1{% \expandafter\let\csname E#1\endcsname = \Edefun \edef\temp{\noexpand\domakedefun \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% \temp } % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) } % % Define \deffn and \deffnx, without parameters. % \deffnheader has to be defined explicitly. % \def\domakedefun#1#2#3{% \envdef#1{% \startdefun \doingtypefnfalse % distinguish typed functions from all else \parseargusing\activeparens{\printdefunline#3}% }% \def#2{\dodefunx#1}% \def#3% } \newif\ifdoingtypefn % doing typed function? \newif\ifrettypeownline % typeset return type on its own line? % @deftypefnnewline on|off says whether the return type of typed functions % are printed on their own line. This affects @deftypefn, @deftypefun, % @deftypeop, and @deftypemethod. % \parseargdef\deftypefnnewline{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxideftypefnnl\endcsname = \empty \else\ifx\temp\offword \expandafter\let\csname SETtxideftypefnnl\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @txideftypefnnl value `\temp', must be on|off}% \fi\fi } % \dosubind {index}{topic}{subtopic} % % If SUBTOPIC is present, precede it with a space, and call \doind. % (At some time during the 20th century, this made a two-level entry in an % index such as the operation index. Nobody seemed to notice the change in % behaviour though.) \def\dosubind#1#2#3{% \def\thirdarg{#3}% \ifx\thirdarg\empty \doind{#1}{#2}% \else \doind{#1}{#2\space#3}% \fi } % Untyped functions: % @deffn category name args \makedefun{deffn}{\deffngeneral{}} % @deffn category class name args \makedefun{defop}#1 {\defopon{#1\ \putwordon}} % \defopon {category on}class name args \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deffngeneral {subind}category name args % \def\deffngeneral#1#2 #3 #4\endheader{% \dosubind{fn}{\code{#3}}{#1}% \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } % Typed functions: % @deftypefn category type name args \makedefun{deftypefn}{\deftypefngeneral{}} % @deftypeop category class type name args \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} % \deftypeopon {category on}class type name args \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deftypefngeneral {subind}category type name args % \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% \dosubind{fn}{\code{#4}}{#1}% \doingtypefntrue \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } % Typed variables: % @deftypevr category type var args \makedefun{deftypevr}{\deftypecvgeneral{}} % @deftypecv category class type var args \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} % \deftypecvof {category of}class type var args \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } % \deftypecvgeneral {subind}category type var args % \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% \dosubind{vr}{\code{#4}}{#1}% \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } % Untyped variables: % @defvr category var args \makedefun{defvr}#1 {\deftypevrheader{#1} {} } % @defcv category class var args \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} % \defcvof {category of}class var args \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } % Types: % @deftp category name args \makedefun{deftp}#1 #2 #3\endheader{% \doind{tp}{\code{#2}}% \defname{#1}{}{#2}\defunargs{#3\unskip}% } % Remaining @defun-like shortcuts: \makedefun{defun}{\deffnheader{\putwordDeffunc} } \makedefun{defmac}{\deffnheader{\putwordDefmac} } \makedefun{defspec}{\deffnheader{\putwordDefspec} } \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } \makedefun{defvar}{\defvrheader{\putwordDefvar} } \makedefun{defopt}{\defvrheader{\putwordDefopt} } \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } \makedefun{defmethod}{\defopon\putwordMethodon} \makedefun{deftypemethod}{\deftypeopon\putwordMethodon} \makedefun{defivar}{\defcvof\putwordInstanceVariableof} \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} % \defname, which formats the name of the @def (not the args). % #1 is the category, such as "Function". % #2 is the return type, if any. % #3 is the function name. % % We are followed by (but not passed) the arguments, if any. % \def\defname#1#2#3{% \par % Get the values of \leftskip and \rightskip as they were outside the @def... \advance\leftskip by -\defbodyindent % % Determine if we are typesetting the return type of a typed function % on a line by itself. \rettypeownlinefalse \ifdoingtypefn % doing a typed function specifically? % then check user option for putting return type on its own line: \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else \rettypeownlinetrue \fi \fi % % How we'll format the category name. Putting it in brackets helps % distinguish it from the body text that may end up on the next line % just below it. \def\temp{#1}% \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} % % Figure out line sizes for the paragraph shape. We'll always have at % least two. \tempnum = 2 % % The first line needs space for \box0; but if \rightskip is nonzero, % we need only space for the part of \box0 which exceeds it: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip % % If doing a return type on its own line, we'll have another line. \ifrettypeownline \advance\tempnum by 1 \def\maybeshapeline{0in \hsize}% \else \def\maybeshapeline{}% \fi % % The continuations: \dimen2=\hsize \advance\dimen2 by -\defargsindent % % The final paragraph shape: \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 % % Put the category name at the right margin. \noindent \hbox to 0pt{% \hfil\box0 \kern-\hsize % \hsize has to be shortened this way: \kern\leftskip % Intentionally do not respect \rightskip, since we need the space. }% % % Allow all lines to be underfull without complaint: \tolerance=10000 \hbadness=10000 \exdentamount=\defbodyindent {% % defun fonts. We use typewriter by default (used to be bold) because: % . we're printing identifiers, they should be in tt in principle. % . in languages with many accents, such as Czech or French, it's % common to leave accents off identifiers. The result looks ok in % tt, but exceedingly strange in rm. % . we don't want -- and --- to be treated as ligatures. % . this still does not fix the ?` and !` ligatures, but so far no % one has made identifiers using them :). \df \tt \def\temp{#2}% text of the return type \ifx\temp\empty\else \tclose{\temp}% typeset the return type \ifrettypeownline % put return type on its own line; prohibit line break following: \hfil\vadjust{\nobreak}\break \else \space % type on same line, so just followed by a space \fi \fi % no return type #3% output function name }% {\rm\enskip}% hskip 0.5 em of \rmfont % \boldbrax % arguments will be output next, if any. } % Print arguments in slanted roman (not ttsl), inconsistently with using % tt for the name. This is because literal text is sometimes needed in % the argument list (groff manual), and ttsl and tt are not very % distinguishable. Prevent hyphenation at `-' chars. % \def\defunargs#1{% % use sl by default (not ttsl), % tt for the names. \df \sl \hyphenchar\font=0 % % On the other hand, if an argument has two dashes (for instance), we % want a way to get ttsl. We used to recommend @var for that, so % leave the code in, but it's strange for @var to lead to typewriter. % Nowadays we recommend @code, since the difference between a ttsl hyphen % and a tt hyphen is pretty tiny. @code also disables ?` !`. \def\var##1{{\setregularquotes\ttslanted{##1}}}% #1% \sl\hyphenchar\font=45 } % We want ()&[] to print specially on the defun line. % \def\activeparens{% \catcode`\(=\active \catcode`\)=\active \catcode`\[=\active \catcode`\]=\active \catcode`\&=\active } % Make control sequences which act like normal parenthesis chars. \let\lparen = ( \let\rparen = ) % Be sure that we always have a definition for `(', etc. For example, % if the fn name has parens in it, \boldbrax will not be in effect yet, % so TeX would otherwise complain about undefined control sequence. { \activeparens \global\let(=\lparen \global\let)=\rparen \global\let[=\lbrack \global\let]=\rbrack \global\let& = \& \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} \gdef\magicamp{\let&=\amprm} } \let\ampchar\& \newcount\parencount % If we encounter &foo, then turn on ()-hacking afterwards \newif\ifampseen \def\amprm#1 {\ampseentrue{\bf\ }} \def\parenfont{% \ifampseen % At the first level, print parens in roman, % otherwise use the default font. \ifnum \parencount=1 \rm \fi \else % The \sf parens (in \boldbrax) actually are a little bolder than % the contained text. This is especially needed for [ and ] . \sf \fi } \def\infirstlevel#1{% \ifampseen \ifnum\parencount=1 #1% \fi \fi } \def\bfafterword#1 {#1 \bf} \def\opnr{% \global\advance\parencount by 1 {\parenfont(}% \infirstlevel \bfafterword } \def\clnr{% {\parenfont)}% \infirstlevel \sl \global\advance\parencount by -1 } \newcount\brackcount \def\lbrb{% \global\advance\brackcount by 1 {\bf[}% } \def\rbrb{% {\bf]}% \global\advance\brackcount by -1 } \def\checkparencounts{% \ifnum\parencount=0 \else \badparencount \fi \ifnum\brackcount=0 \else \badbrackcount \fi } % these should not use \errmessage; the glibc manual, at least, actually % has such constructs (when documenting function pointers). \def\badparencount{% \message{Warning: unbalanced parentheses in @def...}% \global\parencount=0 } \def\badbrackcount{% \message{Warning: unbalanced square brackets in @def...}% \global\brackcount=0 } \message{macros,} % @macro. % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. \ifx\eTeXversion\thisisundefined \newwrite\macscribble \def\scantokens#1{% \toks0={#1}% \immediate\openout\macscribble=\jobname.tmp \immediate\write\macscribble{\the\toks0}% \immediate\closeout\macscribble \input \jobname.tmp } \fi \let\E=\expandafter % Used at the time of macro expansion. % Argument is macro body with arguments substituted \def\scanmacro#1{% \newlinechar`\^^M % expand the expansion of \eatleadingcr twice to maybe remove a leading % newline (and \else and \fi tokens), then call \eatspaces on the result. \def\xeatspaces##1{% \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1% }}% \def\xempty##1{}% % % Process the macro body under the current catcode regime. \scantokens{#1@comment}% % % The \comment is to remove the \newlinechar added by \scantokens, and % can be noticed by \parsearg. Note \c isn't used because this means cedilla % in math mode. } % Used for copying and captions \def\scanexp#1{% \expandafter\scanmacro\expandafter{#1}% } \newcount\paramno % Count of parameters \newtoks\macname % Macro name \newif\ifrecursive % Is it recursive? % List of all defined macros in the form % \commondummyword\macro1\commondummyword\macro2... % Currently is also contains all @aliases; the list can be split % if there is a need. \def\macrolist{} % Add the macro to \macrolist \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} \def\addtomacrolistxxx#1{% \toks0 = \expandafter{\macrolist\commondummyword#1}% \xdef\macrolist{\the\toks0}% } % Utility routines. % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). % \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname \csname#2\endcsname } % Trim leading and trailing spaces off a string. % Concepts from aro-bend problem 15 (see CTAN). {\catcode`\@=11 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} \def\unbrace#1{#1} \unbrace{\gdef\trim@@@ #1 } #2@{#1} } {\catcode`\^^M=\other% \gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}% % Warning: this won't work for a delimited argument % or for an empty argument % Trim a single trailing ^^M off a string. {\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% } % Macro bodies are absorbed as an argument in a context where % all characters are catcode 10, 11 or 12, except \ which is active % (as in normal texinfo). It is necessary to change the definition of \ % to recognize macro arguments; this is the job of \mbodybackslash. % % Non-ASCII encodings make 8-bit characters active, so un-activate % them to avoid their expansion. Must do this non-globally, to % confine the change to the current group. % % It's necessary to have hard CRs when the macro is executed. This is % done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. % \def\scanctxt{% used as subroutine \catcode`\"=\other \catcode`\+=\other \catcode`\<=\other \catcode`\>=\other \catcode`\^=\other \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other \passthroughcharstrue } \def\scanargctxt{% used for copying and captions, not macros. \scanctxt \catcode`\@=\other \catcode`\\=\other \catcode`\^^M=\other } \def\macrobodyctxt{% used for @macro definitions \scanctxt \catcode`\ =\other \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other \catcode`\^^M=\other \usembodybackslash } % Used when scanning braced macro arguments. Note, however, that catcode % changes here are ineffectual if the macro invocation was nested inside % an argument to another Texinfo command. \def\macroargctxt{% \scanctxt \catcode`\ =\active \catcode`\@=\other \catcode`\^^M=\other \catcode`\\=\active } \def\macrolineargctxt{% used for whole-line arguments without braces \scanctxt \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other } % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. % {\catcode`@=0 @catcode`@\=@active @gdef@usembodybackslash{@let\=@mbodybackslash} @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} } \expandafter\def\csname macarg.\endcsname{\realbackslash} \def\margbackslash#1{\char`\#1 } \def\macro{\recursivefalse\parsearg\macroxxx} \def\rmacro{\recursivetrue\parsearg\macroxxx} \def\macroxxx#1{% \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments \paramno=0\relax \else \expandafter\parsemargdef \argl;% \if\paramno>256\relax \ifx\eTeXversion\thisisundefined \errhelp = \EMsimple \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} \fi \fi \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% \else \expandafter\ifx\csname \the\macname\endcsname \relax \else \errmessage{Macro name \the\macname\space already defined}\fi \global\cslet{macsave.\the\macname}{\the\macname}% \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% \addtomacrolist{\the\macname}% \fi \begingroup \macrobodyctxt \ifrecursive \expandafter\parsermacbody \else \expandafter\parsemacbody \fi} \parseargdef\unmacro{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% % Remove the macro name from \macrolist: \begingroup \expandafter\let\csname#1\endcsname \relax \let\commondummyword\unmacrodo \xdef\macrolist{\macrolist}% \endgroup \else \errmessage{Macro #1 not defined}% \fi } % Called by \do from \dounmacro on each macro. The idea is to omit any % macro definitions that have been changed to \relax. % \def\unmacrodo#1{% \ifx #1\relax % remove this \else \noexpand\commondummyword \noexpand#1% \fi } % \getargs -- Parse the arguments to a @macro line. Set \macname to % the name of the macro, and \argl to the braced argument list. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} \def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} % This made use of the feature that if the last token of a % <parameter list> is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. % Parse the optional {params} list to @macro or @rmacro. % Set \paramno to the number of arguments, % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a % three-param macro.) Define \macarg.BLAH for each BLAH in the params % list to some hook where the argument is to be expanded. If there are % less than 10 arguments that hook is to be replaced by ##N where N % is the position in that list, that is to say the macro arguments are to be % defined `a la TeX in the macro body. % % That gets used by \mbodybackslash (above). % % If there are 10 or more arguments, a different technique is used: see % \parsemmanyargdef. % \def\parsemargdef#1;{% \paramno=0\def\paramlist{}% \let\hash\relax % \hash is redefined to `#' later to get it into definitions \let\xeatspaces\relax \let\xempty\relax \parsemargdefxxx#1,;,% \ifnum\paramno<10\relax\else \paramno0\relax \parsemmanyargdef@@#1,;,% 10 or more arguments \fi } \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax \else \let\next=\parsemargdefxxx \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} % the \xempty{} is to give \eatleadingcr an argument in the case of an % empty macro argument. % \parsemacbody, \parsermacbody % % Read recursive and nonrecursive macro bodies. (They're different since % rec and nonrec macros end differently.) % % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro % body to be transformed. % Set \macrobody to the body of the macro, and call \defmacro. % {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% % Make @ a letter, so that we can make private-to-Texinfo macro names. \edef\texiatcatcode{\the\catcode`\@} \catcode `@=11\relax %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%% % If there are 10 or more arguments, a different technique is used, where the % hook remains in the body, and when macro is to be expanded the body is % processed again to replace the arguments. % % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the % argument N value and then \edef the body (nothing else will expand because of % the catcode regime under which the body was input). % % If you compile with TeX (not eTeX), and you have macros with 10 or more % arguments, no macro can have more than 256 arguments (else error). % % In case that there are 10 or more arguments we parse again the arguments % list to set new definitions for the \macarg.BLAH macros corresponding to % each BLAH argument. It was anyhow needed to parse already once this list % in order to count the arguments, and as macros with at most 9 arguments % are by far more frequent than macro with 10 or more arguments, defining % twice the \macarg.BLAH macros does not cost too much processing power. \def\parsemmanyargdef@@#1,{% \if#1;\let\next=\relax \else \let\next=\parsemmanyargdef@@ \edef\tempb{\eatspaces{#1}}% \expandafter\def\expandafter\tempa \expandafter{\csname macarg.\tempb\endcsname}% % Note that we need some extra \noexpand\noexpand, this is because we % don't want \the to be expanded in the \parsermacbody as it uses an % \xdef . \expandafter\edef\tempa {\noexpand\noexpand\noexpand\the\toks\the\paramno}% \advance\paramno by 1\relax \fi\next} \let\endargs@\relax \let\nil@\relax \def\nilm@{\nil@}% \long\def\nillm@{\nil@}% % This macro is expanded during the Texinfo macro expansion, not during its % definition. It gets all the arguments' values and assigns them to macros % macarg.ARGNAME % % #1 is the macro name % #2 is the list of argument names % #3 is the list of argument values \def\getargvals@#1#2#3{% \def\macargdeflist@{}% \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. \def\paramlist{#2,\nil@}% \def\macroname{#1}% \begingroup \macroargctxt \def\argvaluelist{#3,\nil@}% \def\@tempa{#3}% \ifx\@tempa\empty \setemptyargvalues@ \else \getargvals@@ \fi } \def\getargvals@@{% \ifx\paramlist\nilm@ % Some sanity check needed here that \argvaluelist is also empty. \ifx\argvaluelist\nillm@ \else \errhelp = \EMsimple \errmessage{Too many arguments in macro `\macroname'!}% \fi \let\next\macargexpandinbody@ \else \ifx\argvaluelist\nillm@ % No more arguments values passed to macro. Set remaining named-arg % macros to empty. \let\next\setemptyargvalues@ \else % pop current arg name into \@tempb \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% \expandafter\@tempa\expandafter{\paramlist}% % pop current argument value into \@tempc \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% \expandafter\@tempa\expandafter{\argvaluelist}% % Here \@tempb is the current arg name and \@tempc is the current arg value. % First place the new argument macro definition into \@tempd \expandafter\macname\expandafter{\@tempc}% \expandafter\let\csname macarg.\@tempb\endcsname\relax \expandafter\def\expandafter\@tempe\expandafter{% \csname macarg.\@tempb\endcsname}% \edef\@tempd{\long\def\@tempe{\the\macname}}% \push@\@tempd\macargdeflist@ \let\next\getargvals@@ \fi \fi \next } \def\push@#1#2{% \expandafter\expandafter\expandafter\def \expandafter\expandafter\expandafter#2% \expandafter\expandafter\expandafter{% \expandafter#1#2}% } % Replace arguments by their values in the macro body, and place the result % in macro \@tempa. % \def\macvalstoargs@{% % To do this we use the property that token registers that are \the'ed % within an \edef expand only once. So we are going to place all argument % values into respective token registers. % % First we save the token context, and initialize argument numbering. \begingroup \paramno0\relax % Then, for each argument number #N, we place the corresponding argument % value into a new token list register \toks#N \expandafter\putargsintokens@\saveparamlist@,;,% % Then, we expand the body so that argument are replaced by their % values. The trick for values not to be expanded themselves is that they % are within tokens and that tokens expand only once in an \edef . \edef\@tempc{\csname mac.\macroname .body\endcsname}% % Now we restore the token stack pointer to free the token list registers % which we have used, but we make sure that expanded body is saved after % group. \expandafter \endgroup \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% } % Define the named-macro outside of this group and then close this group. % \def\macargexpandinbody@{% \expandafter \endgroup \macargdeflist@ % First the replace in body the macro arguments by their values, the result % is in \@tempa . \macvalstoargs@ % Then we point at the \norecurse or \gobble (for recursive) macro value % with \@tempb . \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname % Depending on whether it is recursive or not, we need some tailing % \egroup . \ifx\@tempb\gobble \let\@tempc\relax \else \let\@tempc\egroup \fi % And now we do the real job: \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% \@tempd } \def\putargsintokens@#1,{% \if#1;\let\next\relax \else \let\next\putargsintokens@ % First we allocate the new token list register, and give it a temporary % alias \@tempb . \toksdef\@tempb\the\paramno % Then we place the argument value into that token list register. \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname \expandafter\@tempb\expandafter{\@tempa}% \advance\paramno by 1\relax \fi \next } % Trailing missing arguments are set to empty. % \def\setemptyargvalues@{% \ifx\paramlist\nilm@ \let\next\macargexpandinbody@ \else \expandafter\setemptyargvaluesparser@\paramlist\endargs@ \let\next\setemptyargvalues@ \fi \next } \def\setemptyargvaluesparser@#1,#2\endargs@{% \expandafter\def\expandafter\@tempa\expandafter{% \expandafter\def\csname macarg.#1\endcsname{}}% \push@\@tempa\macargdeflist@ \def\paramlist{#2}% } % #1 is the element target macro % #2 is the list macro % #3,#4\endargs@ is the list value \def\pop@#1#2#3,#4\endargs@{% \def#1{#3}% \def#2{#4}% } \long\def\longpop@#1#2#3,#4\endargs@{% \long\def#1{#3}% \long\def#2{#4}% } %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%% % This defines a Texinfo @macro or @rmacro, called by \parsemacbody. % \macrobody has the body of the macro in it, with placeholders for % its parameters, looking like "\xeatspaces{\hash 1}". % \paramno is the number of parameters % \paramlist is a TeX parameter text, e.g. "#1,#2,#3," % There are four cases: macros of zero, one, up to nine, and many arguments. % \xdef is used so that macro definitions will survive the file % they're defined in: @include reads the file inside a group. % \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars \ifnum\paramno=1 \def\xeatspaces##1{##1}% % This removes the pair of braces around the argument. We don't % use \eatspaces, because this can cause ends of lines to be lost % when the argument to \eatspaces is read, leading to line-based % commands like "@itemize" not being read correctly. \else \let\xeatspaces\relax % suppress expansion \fi \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup \noexpand\spaceisspace \noexpand\endlineisspace \noexpand\expandafter % skip any whitespace after the macro name. \expandafter\noexpand\csname\the\macname @@@\endcsname}% \expandafter\xdef\csname\the\macname @@@\endcsname{% \egroup \noexpand\scanmacro{\macrobody}}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup \noexpand\braceorline \expandafter\noexpand\csname\the\macname @@@\endcsname}% \expandafter\xdef\csname\the\macname @@@\endcsname##1{% \egroup \noexpand\scanmacro{\macrobody}% }% \else % at most 9 \ifnum\paramno<10\relax % @MACNAME sets the context for reading the macro argument % @MACNAME@@ gets the argument, processes backslashes and appends a % comma. % @MACNAME@@@ removes braces surrounding the argument list. % @MACNAME@@@@ scans the macro body with arguments substituted. \expandafter\xdef\csname\the\macname\endcsname{% \bgroup \noexpand\expandafter % This \expandafter skip any spaces after the \noexpand\macroargctxt % macro before we change the catcode of space. \noexpand\expandafter \expandafter\noexpand\csname\the\macname @@\endcsname}% \expandafter\xdef\csname\the\macname @@\endcsname##1{% \noexpand\passargtomacro \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}% \expandafter\xdef\csname\the\macname @@@\endcsname##1{% \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname @@@@\endcsname\paramlist{% \egroup\noexpand\scanmacro{\macrobody}}% \else % 10 or more: \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% }% \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble \fi \fi} \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape @catcode`@_=11 % private names @catcode`@!=11 % used as argument separator % \passargtomacro#1#2 - % Call #1 with a list of tokens #2, with any doubled backslashes in #2 % compressed to one. % % This implementation works by expansion, and not execution (so we cannot use % \def or similar). This reduces the risk of this failing in contexts where % complete expansion is done with no execution (for example, in writing out to % an auxiliary file for an index entry). % % State is kept in the input stream: the argument passed to % @look_ahead, @gobble_and_check_finish and @add_segment is % % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input) % % where: % THE_MACRO - name of the macro we want to call % ARG_RESULT - argument list we build to pass to that macro % PENDING_BS - either a backslash or nothing % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next @gdef@passargtomacro#1#2{% @add_segment #1!{}@relax#2\@_finish\% } @gdef@_finish{@_finishx} @global@let@_finishx@relax % #1 - THE_MACRO ARG_RESULT % #2 - PENDING_BS % #3 - NEXT_TOKEN % #4 used to look ahead % % If the next token is not a backslash, process the rest of the argument; % otherwise, remove the next token. @gdef@look_ahead#1!#2#3#4{% @ifx#4\% @expandafter@gobble_and_check_finish @else @expandafter@add_segment @fi#1!{#2}#4#4% } % #1 - THE_MACRO ARG_RESULT % #2 - PENDING_BS % #3 - NEXT_TOKEN % #4 should be a backslash, which is gobbled. % #5 looks ahead % % Double backslash found. Add a single backslash, and look ahead. @gdef@gobble_and_check_finish#1!#2#3#4#5{% @add_segment#1\!{}#5#5% } @gdef@is_fi{@fi} % #1 - THE_MACRO ARG_RESULT % #2 - PENDING_BS % #3 - NEXT_TOKEN % #4 is input stream until next backslash % % Input stream is either at the start of the argument, or just after a % backslash sequence, either a lone backslash, or a doubled backslash. % NEXT_TOKEN contains the first token in the input stream: if it is \finish, % finish; otherwise, append to ARG_RESULT the segment of the argument up until % the next backslash. PENDING_BACKSLASH contains a backslash to represent % a backslash just before the start of the input stream that has not been % added to ARG_RESULT. @gdef@add_segment#1!#2#3#4\{% @ifx#3@_finish @call_the_macro#1!% @else % append the pending backslash to the result, followed by the next segment @expandafter@is_fi@look_ahead#1#2#4!{\}@fi % this @fi is discarded by @look_ahead. % we can't get rid of it with \expandafter because we don't know how % long #4 is. } % #1 - THE_MACRO % #2 - ARG_RESULT % #3 discards the res of the conditional in @add_segment, and @is_fi ends the % conditional. @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \braceorline MAC is used for a one-argument macro MAC. It checks % whether the next non-whitespace character is a {. It sets the context % for reading the argument (slightly different in the two cases). Then, % to read the argument, in the whole-line case, it then calls the regular % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC. % \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup \macroargctxt \expandafter\passargtomacro \else \macrolineargctxt\expandafter\parsearg \fi \macnamexxx} % @alias. % We need some trickery to remove the optional spaces around the equal % sign. Make them active and then expand them all to nothing. % \def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} \def\aliasyyy #1=#2\relax{% {% \expandafter\let\obeyedspace=\empty \addtomacrolist{#1}% \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% }% \next } \message{cross references,} \newwrite\auxfile \newif\ifhavexrefs % True if xref values are known. \newif\ifwarnedxrefs % True if we warned once that they aren't known. % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} \def\inforefzzz #1,#2,#3,#4**{% \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} % @node's only job in TeX is to define \lastnode, which is used in % cross-references. The @node line might or might not have commas, and % might or might not have spaces before the first comma, like: % @node foo , bar , ... % We don't want such trailing spaces in the node name. % \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} % % also remove a trailing comma, in case of something like this: % @node Help-Cross, , , Cross-refs \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode} % Used so that the @top node doesn't have to be wrapped in an @ifnottex % conditional. % \doignore goes to more effort to skip nested conditionals but we don't need % that here. \def\omittopnode{% \ifx\lastnode\wordTop \expandafter\ignorenode\fi } \def\wordTop{Top} % Until the next @node or @bye command, divert output to a box that is not % output. \def\ignorenode{\setbox\dummybox\vbox\bgroup\def\node{\egroup\node}% \ignorenodebye } {\let\bye\relax \gdef\ignorenodebye{\let\bye\ignorenodebyedef} \gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}} % The redefinition of \bye here is because it is declared \outer \let\lastnode=\empty % Write a cross-reference definition for the current node. #1 is the % type (Ynumbered, Yappendix, Ynothing). % \def\donoderef#1{% \ifx\lastnode\empty\else \setref{\lastnode}{#1}% \global\let\lastnode=\empty \fi } % @anchor{NAME} -- define xref target at arbitrary point. % \newcount\savesfregister % \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: % 1) NAME-title - the current sectioning name taken from \currentsection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. % 3) NAME-pg - the page number. % % This is called from \donoderef, \anchor, and \dofloat. In the case of % floats, there is an additional part, which is not written here: % 4) NAME-lof - the text as it should appear in a @listoffloats. % \def\setref#1#2{% \pdfmkdest{#1}% \iflinks {% \requireauxfile \atdummies % preserve commands, but don't expand them % match definition in \xrdef, \refx, \xrefX. \def\value##1{##1}% \edef\writexrdef##1##2{% \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% \toks0 = \expandafter{\currentsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout }% \fi } % @xrefautosectiontitle on|off says whether @section(ing) names are used % automatically in xrefs, if the third arg is not explicitly specified. % This was provided as a "secret" @set xref-automatic-section-title % variable, now it's official. % \parseargdef\xrefautomaticsectiontitle{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETxref-automatic-section-title\endcsname = \empty \else\ifx\temp\offword \expandafter\let\csname SETxref-automatic-section-title\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', must be on|off}% \fi\fi } % % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed % manual. All but the node name can be omitted. % \def\pxref{\putwordsee{} \xrefXX} \def\xref{\putwordSee{} \xrefXX} \def\ref{\xrefXX} \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX} \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]} % \newbox\toprefbox \newbox\printedrefnamebox \newbox\infofilenamebox \newbox\printedmanualbox % \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces % % Get args without leading/trailing spaces. \def\printedrefname{\ignorespaces #3}% \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% % \def\infofilename{\ignorespaces #4}% \setbox\infofilenamebox = \hbox{\infofilename\unskip}% % \def\printedmanual{\ignorespaces #5}% \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% % % If the printed reference name (arg #3) was not explicitly given in % the @xref, figure out what we want to use. \ifdim \wd\printedrefnamebox = 0pt % No printed node name was explicitly given. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax % Not auto section-title: use node name inside the square brackets. \def\printedrefname{\ignorespaces #1}% \else % Auto section-title: use chapter/section title inside % the square brackets if we have it. \ifdim \wd\printedmanualbox > 0pt % It is in another manual, so we don't have it; use node name. \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs % We (should) know the real title if we have the xref values. \def\printedrefname{\refx{#1-title}}% \else % Otherwise just copy the Info node name. \def\printedrefname{\ignorespaces #1}% \fi% \fi \fi \fi % % Make link in pdf output. \ifpdf % For pdfTeX and LuaTeX {\indexnofonts \makevalueexpandable \turnoffactive % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. This ignores all spaces in % #4, including (wrongly) those in the middle of the filename. \getfilename{#4}% % % This (wrongly) does not take account of leading or trailing % spaces in #1, which should be ignored. \setpdfdestname{#1}% % \ifx\pdfdestname\empty \def\pdfdestname{Top}% no empty targets \fi % \leavevmode \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 goto file{\the\filename.pdf} name{\pdfdestname}% \else goto name{\pdfmkpgn{\pdfdestname}}% \fi }% \setcolor{\linkcolor}% \else \ifx\XeTeXrevision\thisisundefined \else % For XeTeX {\indexnofonts \makevalueexpandable \turnoffactive % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. This ignores all spaces in % #4, including (wrongly) those in the middle of the filename. \getfilename{#4}% % % This (wrongly) does not take account of leading or trailing % spaces in #1, which should be ignored. \setpdfdestname{#1}% % \ifx\pdfdestname\empty \def\pdfdestname{Top}% no empty targets \fi % \leavevmode \ifnum\filenamelength>0 % With default settings, % XeTeX (xdvipdfmx) replaces link destination names with integers. % In this case, the replaced destination names of % remote PDFs are no longer known. In order to avoid a replacement, % you can use xdvipdfmx's command line option `-C 0x0010'. % If you use XeTeX 0.99996+ (TeX Live 2016+), % this command line option is no longer necessary % because we can use the `dvipdfmx:config' special. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}% \else \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A << /S /GoTo /D (\pdfdestname) >> >>}% \fi }% \setcolor{\linkcolor}% \fi \fi {% % Have to otherify everything special to allow the \csname to % include an _ in the xref name, etc. \indexnofonts \turnoffactive \def\value##1{##1}% \expandafter\global\expandafter\let\expandafter\Xthisreftitle \csname XR#1-title\endcsname }% % % Float references are printed completely differently: "Figure 1.2" % instead of "[somenode], p.3". \iffloat distinguishes them by % \Xthisreftitle being set to a magic string. \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". \ifdim\wd\printedrefnamebox = 0pt \refx{#1-snt}% \else \printedrefname \fi % % If the user also gave the printed manual name (fifth arg), append % "in MANUALNAME". \ifdim \wd\printedmanualbox > 0pt \space \putwordin{} \cite{\printedmanual}% \fi \else % node/anchor (non-float) references. % % If we use \unhbox to print the node names, TeX does not insert % empty discretionaries after hyphens, which means that it will not % find a line break at a hyphen in a node names. Since some manuals % are best written with fairly long node names, containing hyphens, % this is a loss. Therefore, we give the text of the node name % again, so it is as if TeX is seeing it for the first time. % \ifdim \wd\printedmanualbox > 0pt % Cross-manual reference with a printed manual name. % \crossmanualxref{\cite{\printedmanual\unskip}}% % \else\ifdim \wd\infofilenamebox > 0pt % Cross-manual reference with only an info filename (arg 4), no % printed manual name (arg 5). This is essentially the same as % the case above; we output the filename, since we have nothing else. % \crossmanualxref{\code{\infofilename\unskip}}% % \else % Reference within this manual. % % Only output a following space if the -snt ref is nonempty, as the ref % will be empty for @unnumbered and @anchor. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi % % output the `[mynode]' via the macro below so it can be overridden. \xrefprintnodename\printedrefname % \expandafter\ifx\csname SETtxiomitxrefpg\endcsname\relax % But we always want a comma and a space: ,\space % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}% % Add a , if xref followed by a space \if\space\noexpand\tokenafterxref ,% \else\ifx\ \tokenafterxref ,% @TAB \else\ifx\*\tokenafterxref ,% @* \else\ifx\ \tokenafterxref ,% @SPACE \else\ifx\ \tokenafterxref ,% @NL \else\ifx\tie\tokenafterxref ,% @tie \fi\fi\fi\fi\fi\fi \fi \fi\fi \fi \endlink \endgroup} % Output a cross-manual xref to #1. Used just above (twice). % % Only include the text "Section ``foo'' in" if the foo is neither % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply % "see The Foo Manual", the idea being to refer to the whole manual. % % But, this being TeX, we can't easily compare our node name against the % string "Top" while ignoring the possible spaces before and after in % the input. By adding the arbitrary 7sp below, we make it much less % likely that a real node name would have the same width as "Top" (e.g., % in a monospaced font). Hopefully it will never happen in practice. % % For the same basic reason, we retypeset the "Top" at every % reference, since the current font is indeterminate. % \def\crossmanualxref#1{% \setbox\toprefbox = \hbox{Top\kern7sp}% \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% \ifdim \wd2 > 7sp % nonempty? \ifdim \wd2 = \wd\toprefbox \else % same as Top? \putwordSection{} ``\printedrefname'' \putwordin{}\space \fi \fi #1% } % This macro is called from \xrefX for the `[nodename]' part of xref % output. It's a separate macro only so it can be changed more easily, % since square brackets don't work well in some documents. Particularly % one that Bob is working on :). % \def\xrefprintnodename#1{[#1]} % Things referred to by \setref. % \def\Ynothing{} \def\Yomitfromtoc{} \def\Ynumbered{% \ifnum\secno=0 \putwordChapter@tie \the\chapno \else \ifnum\subsecno=0 \putwordSection@tie \the\chapno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno \else \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } \def\Yappendix{% \ifnum\secno=0 \putwordAppendix@tie @char\the\appendixno{}% \else \ifnum\subsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno \else \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } % \refx{NAME} - reference a cross-reference string named NAME. \def\refx#1{% \requireauxfile {% \indexnofonts \turnoffactive \def\value##1{##1}% \expandafter\global\expandafter\let\expandafter\thisrefX \csname XR#1\endcsname }% \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks \ifhavexrefs {\toks0 = {#1}% avoid expansion of possibly-complex value \message{\linenumber Undefined cross reference `\the\toks0'.}}% \else \ifwarnedxrefs\else \global\warnedxrefstrue \message{Cross reference values unknown; you must run TeX again.}% \fi \fi \fi \else % It's defined, so just use it. \thisrefX \fi } % This is the macro invoked by entries in the aux file. Define a control % sequence for a cross-reference target (we prepend XR to the control sequence % name to avoid collisions). The value is the page number. If this is a float % type, we have more work to do. % \def\xrdef#1#2{% {% Expand the node or anchor name to remove control sequences. % \turnoffactive stops 8-bit characters being changed to commands % like @'e. \refx does the same to retrieve the value in the definition. \indexnofonts \turnoffactive \def\value##1{##1}% \xdef\safexrefname{#1}% }% % \bgroup \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% \egroup % We put the \gdef inside a group to avoid the definitions building up on % TeX's save stack, which can cause it to run out of space for aux files with % thousands of lines. \gdef doesn't use the save stack, but \csname does % when it defines an unknown control sequence as \relax. % % Was that xref control sequence that we just defined for a float? \expandafter\iffloat\csname XR\safexrefname\endcsname % it was a float, and we have the (safe) float type in \iffloattype. \expandafter\let\expandafter\floatlist \csname floatlist\iffloattype\endcsname % % Is this the first time we've seen this float type? \expandafter\ifx\floatlist\relax \toks0 = {\do}% yes, so just \do \else % had it before, so preserve previous elements in list. \toks0 = \expandafter{\floatlist\do}% \fi % % Remember this xref in the control sequence \floatlistFLOATTYPE, % for later use in \listoffloats. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 {\safexrefname}}% \fi } % If working on a large document in chapters, it is convenient to % be able to disable indexing, cross-referencing, and contents, for test runs. % This is done with @novalidate at the beginning of the file. % \newif\iflinks \linkstrue % by default we want the aux files. \let\novalidate = \linksfalse % Used when writing to the aux file, or when using data from it. \def\requireauxfile{% \iflinks \tryauxfile % Open the new aux file. TeX will close it automatically at exit. \immediate\openout\auxfile=\jobname.aux \fi \global\let\requireauxfile=\relax % Only do this once. } % Read the last existing aux file, if any. No error if none exists. % \def\tryauxfile{% \openin 1 \jobname.aux \ifeof 1 \else \readdatafile{aux}% \global\havexrefstrue \fi \closein 1 } \def\setupdatafile{% \catcode`\^^@=\other \catcode`\^^A=\other \catcode`\^^B=\other \catcode`\^^C=\other \catcode`\^^D=\other \catcode`\^^E=\other \catcode`\^^F=\other \catcode`\^^G=\other \catcode`\^^H=\other \catcode`\^^K=\other \catcode`\^^L=\other \catcode`\^^N=\other \catcode`\^^P=\other \catcode`\^^Q=\other \catcode`\^^R=\other \catcode`\^^S=\other \catcode`\^^T=\other \catcode`\^^U=\other \catcode`\^^V=\other \catcode`\^^W=\other \catcode`\^^X=\other \catcode`\^^Z=\other \catcode`\^^[=\other \catcode`\^^\=\other \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other \catcode`\^=\other % % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other \catcode`\"=\other \catcode`\_=\active \catcode`\|=\active \catcode`\<=\active \catcode`\>=\active \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off % \catcode`\\=\active % % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 \catcode`\@=0 } \def\readdatafile#1{% \begingroup \setupdatafile \input\jobname.#1 \endgroup} \message{insertions,} % including footnotes. \newcount \footnoteno % The trailing space in the following definition for supereject is % vital for proper filling; pages come out unaligned when you do a % pagealignmacro call if that space before the closing brace is % removed. (Generally, numeric constants should always be followed by a % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } % @footnotestyle is meaningful for Info output only. \let\footnotestyle=\comment {\catcode `\@=11 % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % % In case the footnote comes at the end of a sentence, preserve the % extra spacing after we do the footnote number. \let\@sf\empty \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi % % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf \dofootnote }% % Don't bother with the trickery in plain.tex to not require the % footnote text as a parameter. Our footnotes don't need to be so general. % % Oh yes, they do; otherwise, @ifset (and anything else that uses % \parseargline) fails inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % \gdef\dofootnote{% \insert\footins\bgroup % % Nested footnotes are not supported in TeX, that would take a lot % more work. (\startsavinginserts does not suffice.) \let\footnote=\errfootnotenest % % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. \hsize=\txipagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox \floatingpenalty\@MM \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip \parindent\defaultparindent % \smallfonts \rm % % Because we use hanging indentation in footnotes, a @noindent appears % to exdent this text, so make it be a no-op. makeinfo does not use % hanging indentation so @noindent can still be needed within footnote % text after an @example or the like (not that this is good style). \let\noindent = \relax % % Hang the footnote text off the number. Use \everypar in case the % footnote extends for more than one paragraph. \everypar = {\hang}% \textindent{\thisfootno}% % % Don't crash into the line above the footnote text. Since this % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut % % Invoke rest of plain TeX footnote routine. \futurelet\next\fo@t } }%end \catcode `\@=11 \def\errfootnotenest{% \errhelp=\EMsimple \errmessage{Nested footnotes not supported in texinfo.tex, even though they work in makeinfo; sorry} } \def\errfootnoteheading{% \errhelp=\EMsimple \errmessage{Footnotes in chapters, sections, etc., are not supported} } % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. % Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. % % Replace the \insert primitive by a cheating macro. % Deeper inside, just make sure that the saved insertions are not spilled % out prematurely. % \def\startsavinginserts{% \ifx \insert\ptexinsert \let\insert\saveinsert \else \let\checkinserts\relax \fi } % This \insert replacement works for both \insert\footins{foo} and % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. % \def\saveinsert#1{% \edef\next{\noexpand\savetobox \makeSAVEname#1}% \afterassignment\next % swallow the left brace \let\temp = } \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} \def\placesaveins#1{% \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname {\box#1}% } % eat @SAVE -- beware, all of them have catcode \other: { \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) \gdef\gobblesave @SAVE{} } % initialization: \def\newsaveins #1{% \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% \next } \def\newsaveinsX #1{% \csname newbox\endcsname #1% \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts \checksaveins #1}% } % initialize: \let\checkinserts\empty \newsaveins\footins \newsaveins\margin % @image. We use the macros from epsf.tex to support this. % If epsf.tex is not installed and @image is used, we complain. % % Check for and read epsf.tex up front. If we read it only at @image % time, we might be inside a group, and then its definitions would get % undone and the next image would fail. \openin 1 = epsf.tex \ifeof 1 \else % Do not bother showing banner with epsf.tex v2.7k (available in % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi \closein 1 % % We will only complain once about lack of epsf.tex. \newif\ifwarnednoepsf \newhelp\noepsfhelp{epsf.tex must be installed for images to work. It is also included in the Texinfo distribution, or you can get it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.} % \def\image#1{% \ifx\epsfbox\thisisundefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% \global\warnednoepsftrue \fi \else \imagexxx #1,,,,,\finish \fi } % % Arguments to @image: % #1 is (mandatory) image filename; we tack on .eps extension. % #2 is (optional) width, #3 is (optional) height. % #4 is (ignored optional) html alt text. % #5 is (ignored optional) extension. % #6 is just the usual extra ignored arg for parsing stuff. \newif\ifimagevmode \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example \normalturnoffactive % allow _ et al. in names \makevalueexpandable % If the image is by itself, center it. \ifvmode \imagevmodetrue \else \ifx\centersub\centerV % for @center @image, we need a vbox so we can have our vertical space \imagevmodetrue \vbox\bgroup % vbox has better behavior than vtop herev \fi\fi % \ifimagevmode \nobreak\medskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space % above and below. \nobreak\vskip\parskip \nobreak \fi % % Leave vertical mode so that indentation from an enclosing % environment such as @quotation is respected. % However, if we're at the top level, we don't want the % normal paragraph indentation. % On the other hand, if we are in the case of @center @image, we don't % want to start a paragraph, which will create a hsize-width box and % eradicate the centering. \ifx\centersub\centerV \else \imageindent \fi % % Output the image. \ifpdf % For pdfTeX and LuaTeX <= 0.80 \dopdfimage{#1}{#2}{#3}% \else \ifx\XeTeXrevision\thisisundefined % For epsf.tex % \epsfbox itself resets \epsf?size at each figure. \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi \epsfbox{#1.eps}% \else % For XeTeX \doxeteximage{#1}{#2}{#3}% \fi \fi % \ifimagevmode \medskip % space after a standalone image \fi \ifx\centersub\centerV \egroup \fi \endgroup} % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, % etc. We don't actually implement floating yet, we always include the % float "here". But it seemed the best name for the future. % \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} % There may be a space before second and/or third parameter; delete it. \def\eatcommaspace#1, {#1,} % #1 is the optional FLOATTYPE, the text label for this float, typically % "Figure", "Table", "Example", etc. Can't contain commas. If omitted, % this float will not be numbered and cannot be referred to. % % #2 is the optional xref label. Also must be present for the float to % be referable. % % #3 is the optional positioning argument; for now, it is ignored. It % will somehow specify the positions allowed to float to (here, top, bottom). % % We keep a separate counter for each FLOATTYPE, which we reset at each % chapter-level command. \let\resetallfloatnos=\empty % \def\dofloat#1,#2,#3,#4\finish{% \let\thiscaption=\empty \let\thisshortcaption=\empty % % don't lose footnotes inside @float. % % BEWARE: when the floats start float, we have to issue warning whenever an % insert appears inside a float which could possibly float. --kasal, 26may04 % \startsavinginserts % % We can't be used inside a paragraph. \par % \vtop\bgroup \def\floattype{#1}% \def\floatlabel{#2}% \def\floatloc{#3}% we do nothing with this yet. % \ifx\floattype\empty \let\safefloattype=\empty \else {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% \fi % % If label is given but no type, we handle that as the empty type. \ifx\floatlabel\empty \else % We want each FLOATTYPE to be numbered separately (Figure 1, % Table 1, Figure 2, ...). (And if no label, no number.) % \expandafter\getfloatno\csname\safefloattype floatno\endcsname \global\advance\floatno by 1 % {% % This magic value for \currentsection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % \edef\currentsection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi % % start with \parskip glue, I guess. \vskip\parskip % % Don't suppress indentation if a float happens to start a section. \restorefirstparagraphindent } % we have these possibilities: % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap % @float Foo,lbl & no caption: Foo 1.1 % @float Foo & @caption{Cap}: Foo: Cap % @float Foo & no caption: Foo % @float ,lbl & Caption{Cap}: 1.1: Cap % @float ,lbl & no caption: 1.1 % @float & @caption{Cap}: Cap % @float & no caption: % \def\Efloat{% \let\floatident = \empty % % In all cases, if we have a float type, it comes first. \ifx\floattype\empty \else \def\floatident{\floattype}\fi % % If we have an xref label, the number comes next. \ifx\floatlabel\empty \else \ifx\floattype\empty \else % if also had float type, need tie first. \appendtomacro\floatident{\tie}% \fi % the number. \appendtomacro\floatident{\chaplevelprefix\the\floatno}% \fi % % Start the printed caption with what we've constructed in % \floatident, but keep it separate; we need \floatident again. \let\captionline = \floatident % \ifx\thiscaption\empty \else \ifx\floatident\empty \else \appendtomacro\captionline{: }% had ident, so need a colon between \fi % % caption text. \appendtomacro\captionline{\scanexp\thiscaption}% \fi % % If we have anything to print, print it, with space before. % Eventually this needs to become an \insert. \ifx\captionline\empty \else \vskip.5\parskip \captionline % % Space below caption. \vskip\parskip \fi % % If have an xref label, write the list of floats info. Do this % after the caption, to avoid chance of it being a breakpoint. \ifx\floatlabel\empty \else % Write the text that goes in the lof to the aux file as % \floatlabel-lof. Besides \floatident, we include the short % caption if specified, else the full caption if specified, else nothing. {% \requireauxfile \atdummies % \ifx\thisshortcaption\empty \def\gtemp{\thiscaption}% \else \def\gtemp{\thisshortcaption}% \fi \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident \ifx\gtemp\empty \else : \gtemp \fi}}% }% \fi \egroup % end of \vtop % \checkinserts } % Append the tokens #2 to the definition of macro #1, not expanding either. % \def\appendtomacro#1#2{% \expandafter\def\expandafter#1\expandafter{#1#2}% } % @caption, @shortcaption % \def\caption{\docaption\thiscaption} \def\shortcaption{\docaption\thisshortcaption} \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} \def\defcaption#1#2{\egroup \def#1{#2}} % The parameter is the control sequence identifying the counter we are % going to use. Create it if it doesn't exist and assign it to \floatno. \def\getfloatno#1{% \ifx#1\relax % Haven't seen this figure type before. \csname newcount\endcsname #1% % % Remember to reset this floatno at the next chap. \expandafter\gdef\expandafter\resetallfloatnos \expandafter{\resetallfloatnos #1=0 }% \fi \let\floatno#1% } % \setref calls this to get the XREFLABEL-snt value. We want an @xref % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we % first read the @float command. % \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% % Magic string used for the XREFLABEL-title value, so \xrefX can % distinguish floats from other xref types. \def\floatmagic{!!float!!} % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic % \currentsection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} % % #1 is (maybe) the \floatmagic string. If so, #2 will be the % (safe) float type for this float. We set \iffloattype to #2. % \def\doiffloat#1=#2=#3\finish{% \def\temp{#1}% \def\iffloattype{#2}% \ifx\temp\floatmagic } % @listoffloats FLOATTYPE - print a list of floats like a table of contents. % \parseargdef\listoffloats{% \def\floattype{#1}% floattype {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% % % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax \ifhavexrefs % if the user said @listoffloats foo but never @float foo. \message{\linenumber No `\safefloattype' floats to list.}% \fi \else \begingroup \leftskip=\tocindent % indent these entries like a toc \let\do=\listoffloatsdo \csname floatlist\safefloattype\endcsname \endgroup \fi } % This is called on each entry in a list of floats. We're passed the % xref label, in the form LABEL-title, which is how we save it in the % aux file. We strip off the -title and look up \XRLABEL-lof, which % has the text we're supposed to typeset here. % % Figures without xref labels will not be included in the list (since % they won't appear in the aux file). % \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} \def\listoffloatsdoentry#1-title\finish{{% % Can't fully expand XR#1-lof because it can contain anything. Just % pass the control sequence. On the other hand, XR#1-pg is just the % page number, and we want to fully expand that so we can get a link % in pdf output. \toksA = \expandafter{\csname XR#1-lof\endcsname}% % % use the same \entry macro we use to generate the TOC and index. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% \writeentry }} \message{localization,} % For single-language documents, @documentlanguage is usually given very % early, just after @documentencoding. Single argument is the language % (de) or locale (de_DE) abbreviation. % { \catcode`\_ = \active \globaldefs=1 \parseargdef\documentlanguage{% \tex % read txi-??.tex file in plain TeX. % Read the file by the name they passed if it exists. \let_ = \normalunderscore % normal _ character for filename test \openin 1 txi-#1.tex \ifeof 1 \documentlanguagetrywithoutunderscore #1_\finish \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 \endgroup % end raw TeX } % % If they passed de_DE, and txi-de_DE.tex doesn't exist, % try txi-de.tex. % \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% \openin 1 txi-#1.tex \ifeof 1 \errhelp = \nolanghelp \errmessage{Cannot read language file txi-#1.tex}% \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 } }% end of special _ catcode % \newhelp\nolanghelp{The given language definition file cannot be found or is empty. Maybe you need to install it? Putting it in the current directory should work if nowhere else does.} % This macro is called from txi-??.tex files; the first argument is the % \language name to set (without the "\lang@" prefix), the second and % third args are \{left,right}hyphenmin. % % The language names to pass are determined when the format is built. % See the etex.log file created at that time, e.g., % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. % % With TeX Live 2008, etex now includes hyphenation patterns for all % available languages. This means we can support hyphenation in % Texinfo, at least to some extent. (This still doesn't solve the % accented characters problem.) % \catcode`@=11 \def\txisetlanguage#1#2#3{% % do not set the language if the name is undefined in the current TeX. \expandafter\ifx\csname lang@#1\endcsname \relax \message{no patterns for #1}% \else \global\language = \csname lang@#1\endcsname \fi % but there is no harm in adjusting the hyphenmin values regardless. \global\lefthyphenmin = #2\relax \global\righthyphenmin = #3\relax } % XeTeX and LuaTeX can handle Unicode natively. % Their default I/O uses UTF-8 sequences instead of a byte-wise operation. % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise. % \newif\iftxinativeunicodecapable \newif\iftxiusebytewiseio \ifx\XeTeXrevision\thisisundefined \ifx\luatexversion\thisisundefined \txinativeunicodecapablefalse \txiusebytewiseiotrue \else \txinativeunicodecapabletrue \txiusebytewiseiofalse \fi \else \txinativeunicodecapabletrue \txiusebytewiseiofalse \fi % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex % for non-UTF-8 (byte-wise) encodings. % \def\setbytewiseio{% \ifx\XeTeXrevision\thisisundefined \else \XeTeXdefaultencoding "bytes" % For subsequent files to be read \XeTeXinputencoding "bytes" % For document root file % Unfortunately, there seems to be no corresponding XeTeX command for % output encoding. This is a problem for auxiliary index and TOC files. % The only solution would be perhaps to write out @U{...} sequences in % place of non-ASCII characters. \fi \ifx\luatexversion\thisisundefined \else \directlua{ local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub local function convert_char (char) return utf8_char(byte(char)) end local function convert_line (line) return gsub(line, ".", convert_char) end callback.register("process_input_buffer", convert_line) local function convert_line_out (line) local line_out = "" for c in string.utfvalues(line) do line_out = line_out .. string.char(c) end return line_out end callback.register("process_output_buffer", convert_line_out) } \fi \txiusebytewiseiotrue } % Helpers for encodings. % Set the catcode of characters 128 through 255 to the specified number. % \def\setnonasciicharscatcode#1{% \count255=128 \loop\ifnum\count255<256 \global\catcode\count255=#1\relax \advance\count255 by 1 \repeat } \def\setnonasciicharscatcodenonglobal#1{% \count255=128 \loop\ifnum\count255<256 \catcode\count255=#1\relax \advance\count255 by 1 \repeat } % @documentencoding sets the definition of non-ASCII characters % according to the specified encoding. % \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz} \def\documentencodingzzz#1{% % % Encoding being declared for the document. \def\declaredencoding{\csname #1.enc\endcsname}% % % Supported encodings: names converted to tokens in order to be able % to compare them with \ifx. \def\ascii{\csname US-ASCII.enc\endcsname}% \def\latnine{\csname ISO-8859-15.enc\endcsname}% \def\latone{\csname ISO-8859-1.enc\endcsname}% \def\lattwo{\csname ISO-8859-2.enc\endcsname}% \def\utfeight{\csname UTF-8.enc\endcsname}% % \ifx \declaredencoding \ascii \asciichardefs % \else \ifx \declaredencoding \lattwo \iftxinativeunicodecapable \setbytewiseio \fi \setnonasciicharscatcode\active \lattwochardefs % \else \ifx \declaredencoding \latone \iftxinativeunicodecapable \setbytewiseio \fi \setnonasciicharscatcode\active \latonechardefs % \else \ifx \declaredencoding \latnine \iftxinativeunicodecapable \setbytewiseio \fi \setnonasciicharscatcode\active \latninechardefs % \else \ifx \declaredencoding \utfeight \iftxinativeunicodecapable % For native Unicode handling (XeTeX and LuaTeX) \nativeunicodechardefs \else % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX) \setnonasciicharscatcode\active % since we already invoked \utfeightchardefs at the top level % (below), do not re-invoke it, otherwise our check for duplicated % definitions gets triggered. Making non-ascii chars active is % sufficient. \fi % \else \message{Ignoring unknown document encoding: #1.}% % \fi % utfeight \fi % latnine \fi % latone \fi % lattwo \fi % ascii % \ifx\XeTeXrevision\thisisundefined \else \ifx \declaredencoding \utfeight \else \ifx \declaredencoding \ascii \else \message{Warning: XeTeX with non-UTF-8 encodings cannot handle % non-ASCII characters in auxiliary files.}% \fi \fi \fi } % emacs-page % A message to be logged when using a character that isn't available % the default font encoding (OT1). % \def\missingcharmsg#1{\message{Character missing, sorry: #1.}} % Take account of \c (plain) vs. \, (Texinfo) difference. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} % First, make active non-ASCII characters in order for them to be % correctly categorized when TeX reads the replacement text of % macros containing the character definitions. \setnonasciicharscatcode\active % \def\gdefchar#1#2{% \gdef#1{% \ifpassthroughchars \string#1% \else #2% \fi }} % Latin1 (ISO-8859-1) character definitions. \def\latonechardefs{% \gdefchar^^a0{\tie} \gdefchar^^a1{\exclamdown} \gdefchar^^a2{{\tcfont \char162}} % cent \gdefchar^^a3{\pounds{}} \gdefchar^^a4{{\tcfont \char164}} % currency \gdefchar^^a5{{\tcfont \char165}} % yen \gdefchar^^a6{{\tcfont \char166}} % broken bar \gdefchar^^a7{\S} \gdefchar^^a8{\"{}} \gdefchar^^a9{\copyright{}} \gdefchar^^aa{\ordf} \gdefchar^^ab{\guillemetleft{}} \gdefchar^^ac{\ensuremath\lnot} \gdefchar^^ad{\-} \gdefchar^^ae{\registeredsymbol{}} \gdefchar^^af{\={}} % \gdefchar^^b0{\textdegree} \gdefchar^^b1{$\pm$} \gdefchar^^b2{$^2$} \gdefchar^^b3{$^3$} \gdefchar^^b4{\'{}} \gdefchar^^b5{$\mu$} \gdefchar^^b6{\P} \gdefchar^^b7{\ensuremath\cdot} \gdefchar^^b8{\cedilla\ } \gdefchar^^b9{$^1$} \gdefchar^^ba{\ordm} \gdefchar^^bb{\guillemetright{}} \gdefchar^^bc{$1\over4$} \gdefchar^^bd{$1\over2$} \gdefchar^^be{$3\over4$} \gdefchar^^bf{\questiondown} % \gdefchar^^c0{\`A} \gdefchar^^c1{\'A} \gdefchar^^c2{\^A} \gdefchar^^c3{\~A} \gdefchar^^c4{\"A} \gdefchar^^c5{\ringaccent A} \gdefchar^^c6{\AE} \gdefchar^^c7{\cedilla C} \gdefchar^^c8{\`E} \gdefchar^^c9{\'E} \gdefchar^^ca{\^E} \gdefchar^^cb{\"E} \gdefchar^^cc{\`I} \gdefchar^^cd{\'I} \gdefchar^^ce{\^I} \gdefchar^^cf{\"I} % \gdefchar^^d0{\DH} \gdefchar^^d1{\~N} \gdefchar^^d2{\`O} \gdefchar^^d3{\'O} \gdefchar^^d4{\^O} \gdefchar^^d5{\~O} \gdefchar^^d6{\"O} \gdefchar^^d7{$\times$} \gdefchar^^d8{\O} \gdefchar^^d9{\`U} \gdefchar^^da{\'U} \gdefchar^^db{\^U} \gdefchar^^dc{\"U} \gdefchar^^dd{\'Y} \gdefchar^^de{\TH} \gdefchar^^df{\ss} % \gdefchar^^e0{\`a} \gdefchar^^e1{\'a} \gdefchar^^e2{\^a} \gdefchar^^e3{\~a} \gdefchar^^e4{\"a} \gdefchar^^e5{\ringaccent a} \gdefchar^^e6{\ae} \gdefchar^^e7{\cedilla c} \gdefchar^^e8{\`e} \gdefchar^^e9{\'e} \gdefchar^^ea{\^e} \gdefchar^^eb{\"e} \gdefchar^^ec{\`{\dotless i}} \gdefchar^^ed{\'{\dotless i}} \gdefchar^^ee{\^{\dotless i}} \gdefchar^^ef{\"{\dotless i}} % \gdefchar^^f0{\dh} \gdefchar^^f1{\~n} \gdefchar^^f2{\`o} \gdefchar^^f3{\'o} \gdefchar^^f4{\^o} \gdefchar^^f5{\~o} \gdefchar^^f6{\"o} \gdefchar^^f7{$\div$} \gdefchar^^f8{\o} \gdefchar^^f9{\`u} \gdefchar^^fa{\'u} \gdefchar^^fb{\^u} \gdefchar^^fc{\"u} \gdefchar^^fd{\'y} \gdefchar^^fe{\th} \gdefchar^^ff{\"y} } % Latin9 (ISO-8859-15) encoding character definitions. \def\latninechardefs{% % Encoding is almost identical to Latin1. \latonechardefs % \gdefchar^^a4{\euro{}} \gdefchar^^a6{\v S} \gdefchar^^a8{\v s} \gdefchar^^b4{\v Z} \gdefchar^^b8{\v z} \gdefchar^^bc{\OE} \gdefchar^^bd{\oe} \gdefchar^^be{\"Y} } % Latin2 (ISO-8859-2) character definitions. \def\lattwochardefs{% \gdefchar^^a0{\tie} \gdefchar^^a1{\ogonek{A}} \gdefchar^^a2{\u{}} \gdefchar^^a3{\L} \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}} \gdefchar^^a5{\v L} \gdefchar^^a6{\'S} \gdefchar^^a7{\S} \gdefchar^^a8{\"{}} \gdefchar^^a9{\v S} \gdefchar^^aa{\cedilla S} \gdefchar^^ab{\v T} \gdefchar^^ac{\'Z} \gdefchar^^ad{\-} \gdefchar^^ae{\v Z} \gdefchar^^af{\dotaccent Z} % \gdefchar^^b0{\textdegree{}} \gdefchar^^b1{\ogonek{a}} \gdefchar^^b2{\ogonek{ }} \gdefchar^^b3{\l} \gdefchar^^b4{\'{}} \gdefchar^^b5{\v l} \gdefchar^^b6{\'s} \gdefchar^^b7{\v{}} \gdefchar^^b8{\cedilla\ } \gdefchar^^b9{\v s} \gdefchar^^ba{\cedilla s} \gdefchar^^bb{\v t} \gdefchar^^bc{\'z} \gdefchar^^bd{\H{}} \gdefchar^^be{\v z} \gdefchar^^bf{\dotaccent z} % \gdefchar^^c0{\'R} \gdefchar^^c1{\'A} \gdefchar^^c2{\^A} \gdefchar^^c3{\u A} \gdefchar^^c4{\"A} \gdefchar^^c5{\'L} \gdefchar^^c6{\'C} \gdefchar^^c7{\cedilla C} \gdefchar^^c8{\v C} \gdefchar^^c9{\'E} \gdefchar^^ca{\ogonek{E}} \gdefchar^^cb{\"E} \gdefchar^^cc{\v E} \gdefchar^^cd{\'I} \gdefchar^^ce{\^I} \gdefchar^^cf{\v D} % \gdefchar^^d0{\DH} \gdefchar^^d1{\'N} \gdefchar^^d2{\v N} \gdefchar^^d3{\'O} \gdefchar^^d4{\^O} \gdefchar^^d5{\H O} \gdefchar^^d6{\"O} \gdefchar^^d7{$\times$} \gdefchar^^d8{\v R} \gdefchar^^d9{\ringaccent U} \gdefchar^^da{\'U} \gdefchar^^db{\H U} \gdefchar^^dc{\"U} \gdefchar^^dd{\'Y} \gdefchar^^de{\cedilla T} \gdefchar^^df{\ss} % \gdefchar^^e0{\'r} \gdefchar^^e1{\'a} \gdefchar^^e2{\^a} \gdefchar^^e3{\u a} \gdefchar^^e4{\"a} \gdefchar^^e5{\'l} \gdefchar^^e6{\'c} \gdefchar^^e7{\cedilla c} \gdefchar^^e8{\v c} \gdefchar^^e9{\'e} \gdefchar^^ea{\ogonek{e}} \gdefchar^^eb{\"e} \gdefchar^^ec{\v e} \gdefchar^^ed{\'{\dotless{i}}} \gdefchar^^ee{\^{\dotless{i}}} \gdefchar^^ef{\v d} % \gdefchar^^f0{\dh} \gdefchar^^f1{\'n} \gdefchar^^f2{\v n} \gdefchar^^f3{\'o} \gdefchar^^f4{\^o} \gdefchar^^f5{\H o} \gdefchar^^f6{\"o} \gdefchar^^f7{$\div$} \gdefchar^^f8{\v r} \gdefchar^^f9{\ringaccent u} \gdefchar^^fa{\'u} \gdefchar^^fb{\H u} \gdefchar^^fc{\"u} \gdefchar^^fd{\'y} \gdefchar^^fe{\cedilla t} \gdefchar^^ff{\dotaccent{}} } % UTF-8 character definitions. % % This code to support UTF-8 is based on LaTeX's utf8.def, with some % changes for Texinfo conventions. It is included here under the GPL by % permission from Frank Mittelbach and the LaTeX team. % \newcount\countUTFx \newcount\countUTFy \newcount\countUTFz \gdef\UTFviiiTwoOctets#1#2{\expandafter \UTFviiiDefined\csname u8:#1\string #2\endcsname} % \gdef\UTFviiiThreeOctets#1#2#3{\expandafter \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} % \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} \gdef\UTFviiiDefined#1{% \ifx #1\relax \message{\linenumber Unicode char \string #1 not defined for Texinfo}% \else \expandafter #1% \fi } % Give non-ASCII bytes the active definitions for processing UTF-8 sequences \begingroup \catcode`\~13 \catcode`\$12 \catcode`\"12 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp % substituting ~ and $ with a character token of that value. \def\UTFviiiLoop{% \global\catcode\countUTFx\active \uccode`\~\countUTFx \uccode`\$\countUTFx \uppercase\expandafter{\UTFviiiTmp}% \advance\countUTFx by 1 \ifnum\countUTFx < \countUTFy \expandafter\UTFviiiLoop \fi} % For bytes other than the first in a UTF-8 sequence. Not expected to % be expanded except when writing to auxiliary files. \countUTFx = "80 \countUTFy = "C2 \def\UTFviiiTmp{% \gdef~{% \ifpassthroughchars $\fi}}% \UTFviiiLoop \countUTFx = "C2 \countUTFy = "E0 \def\UTFviiiTmp{% \gdef~{% \ifpassthroughchars $% \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}% \UTFviiiLoop \countUTFx = "E0 \countUTFy = "F0 \def\UTFviiiTmp{% \gdef~{% \ifpassthroughchars $% \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}% \UTFviiiLoop \countUTFx = "F0 \countUTFy = "F4 \def\UTFviiiTmp{% \gdef~{% \ifpassthroughchars $% \else\expandafter\UTFviiiFourOctets\expandafter$\fi }}% \UTFviiiLoop \endgroup \def\globallet{\global\let} % save some \expandafter's below % @U{xxxx} to produce U+xxxx, if we support it. \def\U#1{% \expandafter\ifx\csname uni:#1\endcsname \relax \iftxinativeunicodecapable % All Unicode characters can be used if native Unicode handling is % active. However, if the font does not have the glyph, % letters are missing. \begingroup \uccode`\.="#1\relax \uppercase{.} \endgroup \else \errhelp = \EMsimple \errmessage{Unicode character U+#1 not supported, sorry}% \fi \else \csname uni:#1\endcsname \fi } % These macros are used here to construct the name of a control % sequence to be defined. \def\UTFviiiTwoOctetsName#1#2{% \csname u8:#1\string #2\endcsname}% \def\UTFviiiThreeOctetsName#1#2#3{% \csname u8:#1\string #2\string #3\endcsname}% \def\UTFviiiFourOctetsName#1#2#3#4{% \csname u8:#1\string #2\string #3\string #4\endcsname}% % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX), % provide a definition macro to replace a Unicode character; % this gets used by the @U command % \begingroup \catcode`\"=12 \catcode`\<=12 \catcode`\.=12 \catcode`\,=12 \catcode`\;=12 \catcode`\!=12 \catcode`\~=13 \gdef\DeclareUnicodeCharacterUTFviii#1#2{% \countUTFz = "#1\relax \begingroup \parseXMLCharref % Give \u8:... its definition. The sequence of seven \expandafter's % expands after the \gdef three times, e.g. % % 1. \UTFviiTwoOctetsName B1 B2 % 2. \csname u8:B1 \string B2 \endcsname % 3. \u8: B1 B2 (a single control sequence token) % \expandafter\expandafter \expandafter\expandafter \expandafter\expandafter \expandafter\gdef \UTFviiiTmp{#2}% % \expandafter\ifx\csname uni:#1\endcsname \relax \else \message{Internal error, already defined: #1}% \fi % % define an additional control sequence for this code point. \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp \endgroup} % % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp % to the corresponding UTF-8 sequence. \gdef\parseXMLCharref{% \ifnum\countUTFz < "A0\relax \errhelp = \EMsimple \errmessage{Cannot define Unicode char value < 00A0}% \else\ifnum\countUTFz < "800\relax \parseUTFviiiA,% \parseUTFviiiB C\UTFviiiTwoOctetsName.,% \else\ifnum\countUTFz < "10000\relax \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}% \else \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiA!% \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}% \fi\fi\fi } % Extract a byte from the end of the UTF-8 representation of \countUTFx. % It must be a non-initial byte in the sequence. % Change \uccode of #1 for it to be used in \parseUTFviiiB as one % of the bytes. \gdef\parseUTFviiiA#1{% \countUTFx = \countUTFz \divide\countUTFz by 64 \countUTFy = \countUTFz % Save to be the future value of \countUTFz. \multiply\countUTFz by 64 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract % in order to get the last five bits. \advance\countUTFx by -\countUTFz % Convert this to the byte in the UTF-8 sequence. \advance\countUTFx by 128 \uccode `#1\countUTFx \countUTFz = \countUTFy} % Used to put a UTF-8 byte sequence into \UTFviiiTmp % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8 % sequence. % #2 is one of the \UTFviii*OctetsName macros. % #3 is always a full stop (.) % #4 is a template for the other bytes in the sequence. The values for these % bytes is substituted in here with \uppercase using the \uccode's. \gdef\parseUTFviiiB#1#2#3#4{% \advance\countUTFz by "#10\relax \uccode `#3\countUTFz \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} \endgroup % For native Unicode handling (XeTeX and LuaTeX), % provide a definition macro that sets a catcode to `other' non-globally % \def\DeclareUnicodeCharacterNativeOther#1#2{% \catcode"#1=\other } % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block) % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block) % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B % % Many of our renditions are less than wonderful, and all the missing % characters are available somewhere. Loading the necessary fonts % awaits user request. We can't truly support Unicode without % reimplementing everything that's been done in LaTeX for many years, % plus probably using luatex or xetex, and who knows what else. % We won't be doing that here in this simple file. But we can try to at % least make most of the characters not bomb out. % \def\unicodechardefs{% \DeclareUnicodeCharacter{00A0}{\tie}% \DeclareUnicodeCharacter{00A1}{\exclamdown}% \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent \DeclareUnicodeCharacter{00A3}{\pounds{}}% \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar \DeclareUnicodeCharacter{00A7}{\S}% \DeclareUnicodeCharacter{00A8}{\"{ }}% \DeclareUnicodeCharacter{00A9}{\copyright{}}% \DeclareUnicodeCharacter{00AA}{\ordf}% \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}% \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}% \DeclareUnicodeCharacter{00AD}{\-}% \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}% \DeclareUnicodeCharacter{00AF}{\={ }}% % \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}% \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}% \DeclareUnicodeCharacter{00B2}{$^2$}% \DeclareUnicodeCharacter{00B3}{$^3$}% \DeclareUnicodeCharacter{00B4}{\'{ }}% \DeclareUnicodeCharacter{00B5}{$\mu$}% \DeclareUnicodeCharacter{00B6}{\P}% \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}% \DeclareUnicodeCharacter{00B8}{\cedilla{ }}% \DeclareUnicodeCharacter{00B9}{$^1$}% \DeclareUnicodeCharacter{00BA}{\ordm}% \DeclareUnicodeCharacter{00BB}{\guillemetright{}}% \DeclareUnicodeCharacter{00BC}{$1\over4$}% \DeclareUnicodeCharacter{00BD}{$1\over2$}% \DeclareUnicodeCharacter{00BE}{$3\over4$}% \DeclareUnicodeCharacter{00BF}{\questiondown}% % \DeclareUnicodeCharacter{00C0}{\`A}% \DeclareUnicodeCharacter{00C1}{\'A}% \DeclareUnicodeCharacter{00C2}{\^A}% \DeclareUnicodeCharacter{00C3}{\~A}% \DeclareUnicodeCharacter{00C4}{\"A}% \DeclareUnicodeCharacter{00C5}{\AA}% \DeclareUnicodeCharacter{00C6}{\AE}% \DeclareUnicodeCharacter{00C7}{\cedilla{C}}% \DeclareUnicodeCharacter{00C8}{\`E}% \DeclareUnicodeCharacter{00C9}{\'E}% \DeclareUnicodeCharacter{00CA}{\^E}% \DeclareUnicodeCharacter{00CB}{\"E}% \DeclareUnicodeCharacter{00CC}{\`I}% \DeclareUnicodeCharacter{00CD}{\'I}% \DeclareUnicodeCharacter{00CE}{\^I}% \DeclareUnicodeCharacter{00CF}{\"I}% % \DeclareUnicodeCharacter{00D0}{\DH}% \DeclareUnicodeCharacter{00D1}{\~N}% \DeclareUnicodeCharacter{00D2}{\`O}% \DeclareUnicodeCharacter{00D3}{\'O}% \DeclareUnicodeCharacter{00D4}{\^O}% \DeclareUnicodeCharacter{00D5}{\~O}% \DeclareUnicodeCharacter{00D6}{\"O}% \DeclareUnicodeCharacter{00D7}{\ensuremath\times}% \DeclareUnicodeCharacter{00D8}{\O}% \DeclareUnicodeCharacter{00D9}{\`U}% \DeclareUnicodeCharacter{00DA}{\'U}% \DeclareUnicodeCharacter{00DB}{\^U}% \DeclareUnicodeCharacter{00DC}{\"U}% \DeclareUnicodeCharacter{00DD}{\'Y}% \DeclareUnicodeCharacter{00DE}{\TH}% \DeclareUnicodeCharacter{00DF}{\ss}% % \DeclareUnicodeCharacter{00E0}{\`a}% \DeclareUnicodeCharacter{00E1}{\'a}% \DeclareUnicodeCharacter{00E2}{\^a}% \DeclareUnicodeCharacter{00E3}{\~a}% \DeclareUnicodeCharacter{00E4}{\"a}% \DeclareUnicodeCharacter{00E5}{\aa}% \DeclareUnicodeCharacter{00E6}{\ae}% \DeclareUnicodeCharacter{00E7}{\cedilla{c}}% \DeclareUnicodeCharacter{00E8}{\`e}% \DeclareUnicodeCharacter{00E9}{\'e}% \DeclareUnicodeCharacter{00EA}{\^e}% \DeclareUnicodeCharacter{00EB}{\"e}% \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}% \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}% \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}% \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}% % \DeclareUnicodeCharacter{00F0}{\dh}% \DeclareUnicodeCharacter{00F1}{\~n}% \DeclareUnicodeCharacter{00F2}{\`o}% \DeclareUnicodeCharacter{00F3}{\'o}% \DeclareUnicodeCharacter{00F4}{\^o}% \DeclareUnicodeCharacter{00F5}{\~o}% \DeclareUnicodeCharacter{00F6}{\"o}% \DeclareUnicodeCharacter{00F7}{\ensuremath\div}% \DeclareUnicodeCharacter{00F8}{\o}% \DeclareUnicodeCharacter{00F9}{\`u}% \DeclareUnicodeCharacter{00FA}{\'u}% \DeclareUnicodeCharacter{00FB}{\^u}% \DeclareUnicodeCharacter{00FC}{\"u}% \DeclareUnicodeCharacter{00FD}{\'y}% \DeclareUnicodeCharacter{00FE}{\th}% \DeclareUnicodeCharacter{00FF}{\"y}% % \DeclareUnicodeCharacter{0100}{\=A}% \DeclareUnicodeCharacter{0101}{\=a}% \DeclareUnicodeCharacter{0102}{\u{A}}% \DeclareUnicodeCharacter{0103}{\u{a}}% \DeclareUnicodeCharacter{0104}{\ogonek{A}}% \DeclareUnicodeCharacter{0105}{\ogonek{a}}% \DeclareUnicodeCharacter{0106}{\'C}% \DeclareUnicodeCharacter{0107}{\'c}% \DeclareUnicodeCharacter{0108}{\^C}% \DeclareUnicodeCharacter{0109}{\^c}% \DeclareUnicodeCharacter{010A}{\dotaccent{C}}% \DeclareUnicodeCharacter{010B}{\dotaccent{c}}% \DeclareUnicodeCharacter{010C}{\v{C}}% \DeclareUnicodeCharacter{010D}{\v{c}}% \DeclareUnicodeCharacter{010E}{\v{D}}% \DeclareUnicodeCharacter{010F}{d'}% % \DeclareUnicodeCharacter{0110}{\DH}% \DeclareUnicodeCharacter{0111}{\dh}% \DeclareUnicodeCharacter{0112}{\=E}% \DeclareUnicodeCharacter{0113}{\=e}% \DeclareUnicodeCharacter{0114}{\u{E}}% \DeclareUnicodeCharacter{0115}{\u{e}}% \DeclareUnicodeCharacter{0116}{\dotaccent{E}}% \DeclareUnicodeCharacter{0117}{\dotaccent{e}}% \DeclareUnicodeCharacter{0118}{\ogonek{E}}% \DeclareUnicodeCharacter{0119}{\ogonek{e}}% \DeclareUnicodeCharacter{011A}{\v{E}}% \DeclareUnicodeCharacter{011B}{\v{e}}% \DeclareUnicodeCharacter{011C}{\^G}% \DeclareUnicodeCharacter{011D}{\^g}% \DeclareUnicodeCharacter{011E}{\u{G}}% \DeclareUnicodeCharacter{011F}{\u{g}}% % \DeclareUnicodeCharacter{0120}{\dotaccent{G}}% \DeclareUnicodeCharacter{0121}{\dotaccent{g}}% \DeclareUnicodeCharacter{0122}{\cedilla{G}}% \DeclareUnicodeCharacter{0123}{\cedilla{g}}% \DeclareUnicodeCharacter{0124}{\^H}% \DeclareUnicodeCharacter{0125}{\^h}% \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}% \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}% \DeclareUnicodeCharacter{0128}{\~I}% \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}% \DeclareUnicodeCharacter{012A}{\=I}% \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}% \DeclareUnicodeCharacter{012C}{\u{I}}% \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}% \DeclareUnicodeCharacter{012E}{\ogonek{I}}% \DeclareUnicodeCharacter{012F}{\ogonek{i}}% % \DeclareUnicodeCharacter{0130}{\dotaccent{I}}% \DeclareUnicodeCharacter{0131}{\dotless{i}}% \DeclareUnicodeCharacter{0132}{IJ}% \DeclareUnicodeCharacter{0133}{ij}% \DeclareUnicodeCharacter{0134}{\^J}% \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}% \DeclareUnicodeCharacter{0136}{\cedilla{K}}% \DeclareUnicodeCharacter{0137}{\cedilla{k}}% \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}% \DeclareUnicodeCharacter{0139}{\'L}% \DeclareUnicodeCharacter{013A}{\'l}% \DeclareUnicodeCharacter{013B}{\cedilla{L}}% \DeclareUnicodeCharacter{013C}{\cedilla{l}}% \DeclareUnicodeCharacter{013D}{L'}% should kern \DeclareUnicodeCharacter{013E}{l'}% should kern \DeclareUnicodeCharacter{013F}{L\U{00B7}}% % \DeclareUnicodeCharacter{0140}{l\U{00B7}}% \DeclareUnicodeCharacter{0141}{\L}% \DeclareUnicodeCharacter{0142}{\l}% \DeclareUnicodeCharacter{0143}{\'N}% \DeclareUnicodeCharacter{0144}{\'n}% \DeclareUnicodeCharacter{0145}{\cedilla{N}}% \DeclareUnicodeCharacter{0146}{\cedilla{n}}% \DeclareUnicodeCharacter{0147}{\v{N}}% \DeclareUnicodeCharacter{0148}{\v{n}}% \DeclareUnicodeCharacter{0149}{'n}% \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}% \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}% \DeclareUnicodeCharacter{014C}{\=O}% \DeclareUnicodeCharacter{014D}{\=o}% \DeclareUnicodeCharacter{014E}{\u{O}}% \DeclareUnicodeCharacter{014F}{\u{o}}% % \DeclareUnicodeCharacter{0150}{\H{O}}% \DeclareUnicodeCharacter{0151}{\H{o}}% \DeclareUnicodeCharacter{0152}{\OE}% \DeclareUnicodeCharacter{0153}{\oe}% \DeclareUnicodeCharacter{0154}{\'R}% \DeclareUnicodeCharacter{0155}{\'r}% \DeclareUnicodeCharacter{0156}{\cedilla{R}}% \DeclareUnicodeCharacter{0157}{\cedilla{r}}% \DeclareUnicodeCharacter{0158}{\v{R}}% \DeclareUnicodeCharacter{0159}{\v{r}}% \DeclareUnicodeCharacter{015A}{\'S}% \DeclareUnicodeCharacter{015B}{\'s}% \DeclareUnicodeCharacter{015C}{\^S}% \DeclareUnicodeCharacter{015D}{\^s}% \DeclareUnicodeCharacter{015E}{\cedilla{S}}% \DeclareUnicodeCharacter{015F}{\cedilla{s}}% % \DeclareUnicodeCharacter{0160}{\v{S}}% \DeclareUnicodeCharacter{0161}{\v{s}}% \DeclareUnicodeCharacter{0162}{\cedilla{T}}% \DeclareUnicodeCharacter{0163}{\cedilla{t}}% \DeclareUnicodeCharacter{0164}{\v{T}}% \DeclareUnicodeCharacter{0165}{\v{t}}% \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}% \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}% \DeclareUnicodeCharacter{0168}{\~U}% \DeclareUnicodeCharacter{0169}{\~u}% \DeclareUnicodeCharacter{016A}{\=U}% \DeclareUnicodeCharacter{016B}{\=u}% \DeclareUnicodeCharacter{016C}{\u{U}}% \DeclareUnicodeCharacter{016D}{\u{u}}% \DeclareUnicodeCharacter{016E}{\ringaccent{U}}% \DeclareUnicodeCharacter{016F}{\ringaccent{u}}% % \DeclareUnicodeCharacter{0170}{\H{U}}% \DeclareUnicodeCharacter{0171}{\H{u}}% \DeclareUnicodeCharacter{0172}{\ogonek{U}}% \DeclareUnicodeCharacter{0173}{\ogonek{u}}% \DeclareUnicodeCharacter{0174}{\^W}% \DeclareUnicodeCharacter{0175}{\^w}% \DeclareUnicodeCharacter{0176}{\^Y}% \DeclareUnicodeCharacter{0177}{\^y}% \DeclareUnicodeCharacter{0178}{\"Y}% \DeclareUnicodeCharacter{0179}{\'Z}% \DeclareUnicodeCharacter{017A}{\'z}% \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}% \DeclareUnicodeCharacter{017C}{\dotaccent{z}}% \DeclareUnicodeCharacter{017D}{\v{Z}}% \DeclareUnicodeCharacter{017E}{\v{z}}% \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}% % \DeclareUnicodeCharacter{01C4}{D\v{Z}}% \DeclareUnicodeCharacter{01C5}{D\v{z}}% \DeclareUnicodeCharacter{01C6}{d\v{z}}% \DeclareUnicodeCharacter{01C7}{LJ}% \DeclareUnicodeCharacter{01C8}{Lj}% \DeclareUnicodeCharacter{01C9}{lj}% \DeclareUnicodeCharacter{01CA}{NJ}% \DeclareUnicodeCharacter{01CB}{Nj}% \DeclareUnicodeCharacter{01CC}{nj}% \DeclareUnicodeCharacter{01CD}{\v{A}}% \DeclareUnicodeCharacter{01CE}{\v{a}}% \DeclareUnicodeCharacter{01CF}{\v{I}}% % \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}% \DeclareUnicodeCharacter{01D1}{\v{O}}% \DeclareUnicodeCharacter{01D2}{\v{o}}% \DeclareUnicodeCharacter{01D3}{\v{U}}% \DeclareUnicodeCharacter{01D4}{\v{u}}% % \DeclareUnicodeCharacter{01E2}{\={\AE}}% \DeclareUnicodeCharacter{01E3}{\={\ae}}% \DeclareUnicodeCharacter{01E6}{\v{G}}% \DeclareUnicodeCharacter{01E7}{\v{g}}% \DeclareUnicodeCharacter{01E8}{\v{K}}% \DeclareUnicodeCharacter{01E9}{\v{k}}% % \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}% \DeclareUnicodeCharacter{01F1}{DZ}% \DeclareUnicodeCharacter{01F2}{Dz}% \DeclareUnicodeCharacter{01F3}{dz}% \DeclareUnicodeCharacter{01F4}{\'G}% \DeclareUnicodeCharacter{01F5}{\'g}% \DeclareUnicodeCharacter{01F8}{\`N}% \DeclareUnicodeCharacter{01F9}{\`n}% \DeclareUnicodeCharacter{01FC}{\'{\AE}}% \DeclareUnicodeCharacter{01FD}{\'{\ae}}% \DeclareUnicodeCharacter{01FE}{\'{\O}}% \DeclareUnicodeCharacter{01FF}{\'{\o}}% % \DeclareUnicodeCharacter{021E}{\v{H}}% \DeclareUnicodeCharacter{021F}{\v{h}}% % \DeclareUnicodeCharacter{0226}{\dotaccent{A}}% \DeclareUnicodeCharacter{0227}{\dotaccent{a}}% \DeclareUnicodeCharacter{0228}{\cedilla{E}}% \DeclareUnicodeCharacter{0229}{\cedilla{e}}% \DeclareUnicodeCharacter{022E}{\dotaccent{O}}% \DeclareUnicodeCharacter{022F}{\dotaccent{o}}% % \DeclareUnicodeCharacter{0232}{\=Y}% \DeclareUnicodeCharacter{0233}{\=y}% \DeclareUnicodeCharacter{0237}{\dotless{j}}% % \DeclareUnicodeCharacter{02BC}{'}% % \DeclareUnicodeCharacter{02DB}{\ogonek{ }}% % % Greek letters upper case \DeclareUnicodeCharacter{0391}{{\it A}}% \DeclareUnicodeCharacter{0392}{{\it B}}% \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}% \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}% \DeclareUnicodeCharacter{0395}{{\it E}}% \DeclareUnicodeCharacter{0396}{{\it Z}}% \DeclareUnicodeCharacter{0397}{{\it H}}% \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}% \DeclareUnicodeCharacter{0399}{{\it I}}% \DeclareUnicodeCharacter{039A}{{\it K}}% \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}% \DeclareUnicodeCharacter{039C}{{\it M}}% \DeclareUnicodeCharacter{039D}{{\it N}}% \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}% \DeclareUnicodeCharacter{039F}{{\it O}}% \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}% \DeclareUnicodeCharacter{03A1}{{\it P}}% %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}% \DeclareUnicodeCharacter{03A4}{{\it T}}% \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}% \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}% \DeclareUnicodeCharacter{03A7}{{\it X}}% \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}% \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}% % % Vowels with accents \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}% \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}% \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}% \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}% \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}% \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}% % % Standalone accent \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}% % % Greek letters lower case \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}% \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}% \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}% \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}% \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}% \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}% \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}% \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}% \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}% \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}% \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}% \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}% \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}% \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}% \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}% \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}% \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}% \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}% \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}% \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}% \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}% \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}% \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}% \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}% % % More Greek vowels with accents \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}% \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}% \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}% \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}% \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}% % % Variant Greek letters \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}% \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}% \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}% % \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}% \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}% \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}% \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}% \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}% \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}% \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}% \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}% \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}% \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}% \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}% \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}% % \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}% \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}% % \DeclareUnicodeCharacter{1E20}{\=G}% \DeclareUnicodeCharacter{1E21}{\=g}% \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}% \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}% \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}% \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}% \DeclareUnicodeCharacter{1E26}{\"H}% \DeclareUnicodeCharacter{1E27}{\"h}% % \DeclareUnicodeCharacter{1E30}{\'K}% \DeclareUnicodeCharacter{1E31}{\'k}% \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}% \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}% \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}% \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}% \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}% \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}% \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}% \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}% \DeclareUnicodeCharacter{1E3E}{\'M}% \DeclareUnicodeCharacter{1E3F}{\'m}% % \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}% \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}% \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}% \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}% \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}% \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}% \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}% \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}% \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}% \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}% % \DeclareUnicodeCharacter{1E54}{\'P}% \DeclareUnicodeCharacter{1E55}{\'p}% \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}% \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}% \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}% \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}% \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}% \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}% \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}% \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}% % \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}% \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}% \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}% \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}% \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}% \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}% \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}% \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}% \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}% \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}% % \DeclareUnicodeCharacter{1E7C}{\~V}% \DeclareUnicodeCharacter{1E7D}{\~v}% \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}% \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}% % \DeclareUnicodeCharacter{1E80}{\`W}% \DeclareUnicodeCharacter{1E81}{\`w}% \DeclareUnicodeCharacter{1E82}{\'W}% \DeclareUnicodeCharacter{1E83}{\'w}% \DeclareUnicodeCharacter{1E84}{\"W}% \DeclareUnicodeCharacter{1E85}{\"w}% \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}% \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}% \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}% \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}% \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}% \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}% \DeclareUnicodeCharacter{1E8C}{\"X}% \DeclareUnicodeCharacter{1E8D}{\"x}% \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}% \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}% % \DeclareUnicodeCharacter{1E90}{\^Z}% \DeclareUnicodeCharacter{1E91}{\^z}% \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}% \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}% \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}% \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}% \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}% \DeclareUnicodeCharacter{1E97}{\"t}% \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}% \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}% % \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}% \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}% % \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}% \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}% \DeclareUnicodeCharacter{1EBC}{\~E}% \DeclareUnicodeCharacter{1EBD}{\~e}% % \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}% \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}% \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}% \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}% % \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}% \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}% % \DeclareUnicodeCharacter{1EF2}{\`Y}% \DeclareUnicodeCharacter{1EF3}{\`y}% \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}% % \DeclareUnicodeCharacter{1EF8}{\~Y}% \DeclareUnicodeCharacter{1EF9}{\~y}% % % Punctuation \DeclareUnicodeCharacter{2013}{--}% \DeclareUnicodeCharacter{2014}{---}% \DeclareUnicodeCharacter{2018}{\quoteleft{}}% \DeclareUnicodeCharacter{2019}{\quoteright{}}% \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}% \DeclareUnicodeCharacter{201C}{\quotedblleft{}}% \DeclareUnicodeCharacter{201D}{\quotedblright{}}% \DeclareUnicodeCharacter{201E}{\quotedblbase{}}% \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}% \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}% \DeclareUnicodeCharacter{2022}{\bullet{}}% \DeclareUnicodeCharacter{202F}{\thinspace}% \DeclareUnicodeCharacter{2026}{\dots{}}% \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}% \DeclareUnicodeCharacter{203A}{\guilsinglright{}}% % \DeclareUnicodeCharacter{20AC}{\euro{}}% % \DeclareUnicodeCharacter{2192}{\expansion{}}% \DeclareUnicodeCharacter{21D2}{\result{}}% % % Mathematical symbols \DeclareUnicodeCharacter{2200}{\ensuremath\forall}% \DeclareUnicodeCharacter{2203}{\ensuremath\exists}% \DeclareUnicodeCharacter{2208}{\ensuremath\in}% \DeclareUnicodeCharacter{2212}{\minus{}}% \DeclareUnicodeCharacter{2217}{\ast}% \DeclareUnicodeCharacter{221E}{\ensuremath\infty}% \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}% \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}% \DeclareUnicodeCharacter{2229}{\ensuremath\cap}% \DeclareUnicodeCharacter{2261}{\equiv{}}% \DeclareUnicodeCharacter{2264}{\ensuremath\leq}% \DeclareUnicodeCharacter{2265}{\ensuremath\geq}% \DeclareUnicodeCharacter{2282}{\ensuremath\subset}% \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}% % \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}% \DeclareUnicodeCharacter{2032}{\ensuremath\prime}% \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}% \DeclareUnicodeCharacter{2111}{\ensuremath\Im}% \DeclareUnicodeCharacter{2113}{\ensuremath\ell}% \DeclareUnicodeCharacter{2118}{\ensuremath\wp}% \DeclareUnicodeCharacter{211C}{\ensuremath\Re}% \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}% \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}% \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}% \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}% \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}% \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}% \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}% \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}% \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}% \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}% \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}% \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}% \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}% \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}% \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}% \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}% \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}% \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}% \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}% \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}% \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}% \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}% \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}% \DeclareUnicodeCharacter{2202}{\ensuremath\partial}% \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}% \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}% \DeclareUnicodeCharacter{2209}{\ensuremath\notin}% \DeclareUnicodeCharacter{220B}{\ensuremath\owns}% \DeclareUnicodeCharacter{220F}{\ensuremath\prod}% \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}% \DeclareUnicodeCharacter{2211}{\ensuremath\sum}% \DeclareUnicodeCharacter{2213}{\ensuremath\mp}% \DeclareUnicodeCharacter{2218}{\ensuremath\circ}% \DeclareUnicodeCharacter{221A}{\ensuremath\surd}% \DeclareUnicodeCharacter{221D}{\ensuremath\propto}% \DeclareUnicodeCharacter{2220}{\ensuremath\angle}% \DeclareUnicodeCharacter{2223}{\ensuremath\mid}% \DeclareUnicodeCharacter{2228}{\ensuremath\vee}% \DeclareUnicodeCharacter{222A}{\ensuremath\cup}% \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}% \DeclareUnicodeCharacter{222E}{\ensuremath\oint}% \DeclareUnicodeCharacter{223C}{\ensuremath\sim}% \DeclareUnicodeCharacter{2240}{\ensuremath\wr}% \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}% \DeclareUnicodeCharacter{2245}{\ensuremath\cong}% \DeclareUnicodeCharacter{2248}{\ensuremath\approx}% \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}% \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}% \DeclareUnicodeCharacter{2260}{\ensuremath\neq}% \DeclareUnicodeCharacter{226A}{\ensuremath\ll}% \DeclareUnicodeCharacter{226B}{\ensuremath\gg}% \DeclareUnicodeCharacter{227A}{\ensuremath\prec}% \DeclareUnicodeCharacter{227B}{\ensuremath\succ}% \DeclareUnicodeCharacter{2283}{\ensuremath\supset}% \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}% \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}% \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}% \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}% \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}% \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}% \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}% \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}% \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}% \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}% \DeclareUnicodeCharacter{2299}{\ensuremath\odot}% \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}% \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}% \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}% \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}% \DeclareUnicodeCharacter{22A8}{\ensuremath\models}% \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}% \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}% \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}% \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}% \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}% \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}% \DeclareUnicodeCharacter{22C6}{\ensuremath\star}% \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}% \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}% \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}% \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}% \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}% \DeclareUnicodeCharacter{2322}{\ensuremath\frown}% \DeclareUnicodeCharacter{2323}{\ensuremath\smile}% % \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}% \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}% \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}% \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}% \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}% \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}% \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}% \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}% \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}% \DeclareUnicodeCharacter{266D}{\ensuremath\flat}% \DeclareUnicodeCharacter{266E}{\ensuremath\natural}% \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}% \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}% \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}% \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}% \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}% \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}% \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}% \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}% \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}% \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}% \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}% \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}% \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}% \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}% \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}% \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}% \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}% \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}% % \global\mathchardef\checkmark="1370% actually the square root sign \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}% }% end of \unicodechardefs % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command) % It makes the setting that replace UTF-8 byte sequence. \def\utfeightchardefs{% \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii \unicodechardefs } % Whether the active definitions of non-ASCII characters expand to % non-active tokens with the same character code. This is used to % write characters literally, instead of using active definitions for % printing the correct glyphs. \newif\ifpassthroughchars \passthroughcharsfalse % For native Unicode handling (XeTeX and LuaTeX), % provide a definition macro to replace/pass-through a Unicode character % \def\DeclareUnicodeCharacterNative#1#2{% \catcode"#1=\active \def\dodeclareunicodecharacternative##1##2##3{% \begingroup \uccode`\~="##2\relax \uppercase{\gdef~}{% \ifpassthroughchars ##1% \else ##3% \fi } \endgroup } \begingroup \uccode`\.="#1\relax \uppercase{\def\UTFNativeTmp{.}}% \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}% \endgroup } % Native Unicode handling (XeTeX and LuaTeX) character replacing definition. % It activates the setting that replaces Unicode characters. \def\nativeunicodechardefs{% \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative \unicodechardefs } % For native Unicode handling (XeTeX and LuaTeX), % make the character token expand % to the sequences given in \unicodechardefs for printing. \def\DeclareUnicodeCharacterNativeAtU#1#2{% \def\UTFAtUTmp{#2} \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp } % @U command definitions for native Unicode handling (XeTeX and LuaTeX). \def\nativeunicodechardefsatu{% \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU \unicodechardefs } % US-ASCII character definitions. \def\asciichardefs{% nothing need be done \relax } % Define all Unicode characters we know about. This makes UTF-8 the default % input encoding and allows @U to work. \iftxinativeunicodecapable \nativeunicodechardefsatu \else \utfeightchardefs \fi \message{formatting,} \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt \secheadingskip = 12pt plus 3pt minus 2pt \subsecheadingskip = 9pt plus 2pt minus 2pt % Prevent underfull vbox error messages. \vbadness = 10000 % Don't be very finicky about underfull hboxes, either. \hbadness = 6666 % Following George Bush, get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're % using an old version of TeX, don't do anything. We want the amount of % stretch added to depend on the line length, hence the dependence on % \hsize. We call this whenever the paper size is set. % \def\setemergencystretch{% \ifx\emergencystretch\thisisundefined % Allow us to assign to \emergencystretch anyway. \def\emergencystretch{\dimen0}% \else \emergencystretch = .15\hsize \fi } % Parameters in order: 1) textheight; 2) textwidth; % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; % 7) physical page height; 8) physical page width. % % We also call \setleading{\textleading}, so the caller should define % \textleading. The caller should also set \parskip. % \def\internalpagesizes#1#2#3#4#5#6#7#8{% \voffset = #3\relax \topskip = #6\relax \splittopskip = \topskip % \vsize = #1\relax \advance\vsize by \topskip \outervsize = \vsize \advance\outervsize by 2\topandbottommargin \txipageheight = \vsize % \hsize = #2\relax \outerhsize = \hsize \advance\outerhsize by 0.5in \txipagewidth = \hsize % \normaloffset = #4\relax \bindingoffset = #5\relax % \ifpdf \pdfpageheight #7\relax \pdfpagewidth #8\relax % if we don't reset these, they will remain at "1 true in" of % whatever layout pdftex was dumped with. \pdfhorigin = 1 true in \pdfvorigin = 1 true in \else \ifx\XeTeXrevision\thisisundefined \special{papersize=#8,#7}% \else \pdfpageheight #7\relax \pdfpagewidth #8\relax % XeTeX does not have \pdfhorigin and \pdfvorigin. \fi \fi % \setleading{\textleading} % \parindent = \defaultparindent \setemergencystretch } % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % If page is nothing but text, make it come out even. \internalpagesizes{607.2pt}{6in}% that's 46 lines {\voffset}{.25in}% {\bindingoffset}{36pt}% {11in}{8.5in}% }} % Use @smallbook to reset parameters for 7x9.25 trim size. \def\smallbook{{\globaldefs = 1 \parskip = 2pt plus 1pt \textleading = 12pt % \internalpagesizes{7.5in}{5in}% {-.2in}{0in}% {\bindingoffset}{16pt}% {9.25in}{7in}% % \lispnarrowing = 0.3in \tolerance = 700 \contentsrightmargin = 0pt \defbodyindent = .5cm }} % Use @smallerbook to reset parameters for 6x9 trim size. % (Just testing, parameters still in flux.) \def\smallerbook{{\globaldefs = 1 \parskip = 1.5pt plus 1pt \textleading = 12pt % \internalpagesizes{7.4in}{4.8in}% {-.2in}{-.4in}% {0pt}{14pt}% {9in}{6in}% % \lispnarrowing = 0.25in \tolerance = 700 \contentsrightmargin = 0pt \defbodyindent = .4cm }} % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % Double-side printing via postscript on Laserjet 4050 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. % To change the settings for a different printer or situation, adjust % \normaloffset until the front-side and back-side texts align. Then % do the same for \bindingoffset. You can set these for testing in % your texinfo source file like this: % @tex % \global\normaloffset = -6mm % \global\bindingoffset = 10mm % @end tex \internalpagesizes{673.2pt}{160mm}% that's 51 lines {\voffset}{\hoffset}% {\bindingoffset}{44pt}% {297mm}{210mm}% % \tolerance = 700 \contentsrightmargin = 0pt \defbodyindent = 5mm }} % Use @afivepaper to print on European A5 paper. % From romildo@urano.iceb.ufop.br, 2 July 2000. % He also recommends making @example and @lisp be small. \def\afivepaper{{\globaldefs = 1 \parskip = 2pt plus 1pt minus 0.1pt \textleading = 12.5pt % \internalpagesizes{160mm}{120mm}% {\voffset}{\hoffset}% {\bindingoffset}{8pt}% {210mm}{148mm}% % \lispnarrowing = 0.2in \tolerance = 800 \contentsrightmargin = 0pt \defbodyindent = 2mm \tableindent = 12mm }} % A specific text layout, 24x15cm overall, intended for A4 paper. \def\afourlatex{{\globaldefs = 1 \afourpaper \internalpagesizes{237mm}{150mm}% {\voffset}{4.6mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% % % Must explicitly reset to 0 because we call \afourpaper. \globaldefs = 0 }} % Use @afourwide to print on A4 paper in landscape format. \def\afourwide{{\globaldefs = 1 \afourpaper \internalpagesizes{241mm}{165mm}% {\voffset}{-2.95mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% \globaldefs = 0 }} \def\bsixpaper{{\globaldefs = 1 \afourpaper \internalpagesizes{140mm}{100mm}% {-6.35mm}{-12.7mm}% {\bindingoffset}{14pt}% {176mm}{125mm}% \let\SETdispenvsize=\smallword \lispnarrowing = 0.2in \globaldefs = 0 }} % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. % \parseargdef\pagesizes{\pagesizesyyy #1,,\finish} \def\pagesizesyyy#1,#2,#3\finish{{% \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi \globaldefs = 1 % \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % \dimen0 = #1\relax \advance\dimen0 by 2.5in % default 1in margin above heading line % and 1.5in to include heading, footing and % bottom margin % \dimen2 = \hsize \advance\dimen2 by 2in % default to 1 inch margin on each side % \internalpagesizes{#1}{\hsize}% {\voffset}{\normaloffset}% {\bindingoffset}{44pt}% {\dimen0}{\dimen2}% }} % Set default to letter. % \letterpaper % Default value of \hfuzz, for suppressing warnings about overfull hboxes. \hfuzz = 1pt \message{and turning on texinfo input format.} \def^^L{\par} % remove \outer, so ^L can appear in an @comment % DEL is a comment character, in case @c does not suffice. \catcode`\^^? = 14 % Define macros to output various characters with catcode for normal text. \catcode`\"=\other \def\normaldoublequote{"} \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix \catcode`\+=\other \def\normalplus{+} \catcode`\<=\other \def\normalless{<} \catcode`\>=\other \def\normalgreater{>} \catcode`\^=\other \def\normalcaret{^} \catcode`\_=\other \def\normalunderscore{_} \catcode`\|=\other \def\normalverticalbar{|} \catcode`\~=\other \def\normaltilde{~} % This macro is used to make a character print one way in \tt % (where it can probably be output as-is), and another way in other fonts, % where something hairier probably needs to be done. % % #1 is what to print if we are indeed using \tt; #2 is what to print % otherwise. Since all the Computer Modern typewriter fonts have zero % interword stretch (and shrink), and it is reasonable to expect all % typewriter fonts to have this, we can check that font parameter. % \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} % Same as above, but check for italic font. Actually this also catches % non-italic slanted fonts since it is impossible to distinguish them from % italic fonts. But since this is only used by $ and it uses \sl anyway % this is not a problem. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} % Set catcodes for Texinfo file % Active characters for printing the wanted glyph. % Most of these we simply print from the \tt font, but for some, we can % use math or other variants that look better in normal text. % \catcode`\"=\active \def\activedoublequote{{\tt\char34}} \let"=\activedoublequote \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde \chardef\hatchar=`\^ \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \let\realunder=_ \catcode`\|=\active \def|{{\tt\char124}} \chardef \less=`\< \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless \chardef \gtr=`\> \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr \catcode`\+=\active \def+{{\tt \char 43}} \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix \catcode`\-=\active \let-=\normaldash % used for headline/footline in the output routine, in case the page % breaks in the middle of an @tex block. \def\texinfochars{% \let< = \activeless \let> = \activegtr \let~ = \activetilde \let^ = \activehat \setregularquotes \let\b = \strong \let\i = \smartitalic % in principle, all other definitions in \tex have to be undone too. } % Used sometimes to turn off (effectively) the active characters even after % parsing them. \def\turnoffactive{% \normalturnoffactive \otherbackslash } \catcode`\@=0 % \backslashcurfont outputs one backslash character in current font, % as in \char`\\. \global\chardef\backslashcurfont=`\\ % \realbackslash is an actual character `\' with catcode other. {\catcode`\\=\other @gdef@realbackslash{\}} % In Texinfo, backslash is an active character; it prints the backslash % in fixed width font. \catcode`\\=\active % @ for escape char from now on. % Print a typewriter backslash. For math mode, we can't simply use % \backslashcurfont: the story here is that in math mode, the \char % of \backslashcurfont ends up printing the roman \ from the math symbol % font (because \char in math mode uses the \mathcode, and plain.tex % sets \mathcode`\\="026E). Hence we use an explicit \mathchar, % which is the decimal equivalent of "715c (class 7, e.g., use \fam; % ignored family value; char position "5C). We can't use " for the % usual hex value because it has already been made active. @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents. % \otherbackslash defines an active \ to be a literal `\' character with % catcode other. @gdef@otherbackslash{@let\=@realbackslash} % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of % the literal character `\'. % {@catcode`- = @active @gdef@normalturnoffactive{% @passthroughcharstrue @let-=@normaldash @let"=@normaldoublequote @let$=@normaldollar %$ font-lock fix @let+=@normalplus @let<=@normalless @let>=@normalgreater @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar @let~=@normaltilde @let\=@ttbackslash @setregularquotes @unsepspaces } } % If a .fmt file is being used, characters that might appear in a file % name cannot be active until we have parsed the command line. % So turn them off again, and have @fixbackslash turn them back on. @catcode`+=@other @catcode`@_=@other % \enablebackslashhack - allow file to begin `\input texinfo' % % If a .fmt file is being used, we don't want the `\input texinfo' to show up. % That is what \eatinput is for; after that, the `\' should revert to printing % a backslash. % If the file did not have a `\input texinfo', then it is turned off after % the first line; otherwise the first `\' in the file would cause an error. % This is used on the very last line of this file, texinfo.tex. % We also use @c to call @fixbackslash, in case ends of lines are hidden. { @catcode`@^=7 @catcode`@^^M=13@gdef@enablebackslashhack{% @global@let\ = @eatinput% @catcode`@^^M=13% @def@c{@fixbackslash@c}% % Definition for the newline at the end of this file. @def ^^M{@let^^M@secondlinenl}% % Definition for a newline in the main Texinfo file. @gdef @secondlinenl{@fixbackslash}% % In case the first line has a whole-line command on it @let@originalparsearg@parsearg @def@parsearg{@fixbackslash@originalparsearg} }} {@catcode`@^=7 @catcode`@^^M=13% @gdef@eatinput input texinfo#1^^M{@fixbackslash}} % Emergency active definition of newline, in case an active newline token % appears by mistake. {@catcode`@^=7 @catcode13=13% @gdef@enableemergencynewline{% @gdef^^M{% @par% %<warning: active newline>@par% }}} @gdef@fixbackslash{% @ifx\@eatinput @let\ = @ttbackslash @fi @catcode13=5 % regular end of line @enableemergencynewline @let@c=@comment @let@parsearg@originalparsearg % Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. @catcode`+=@active @catcode`@_=@active % % If texinfo.cnf is present on the system, read it. % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets % called at the beginning of every Texinfo file. Not opening texinfo.cnf % directly in this file, texinfo.tex, makes it possible to make a format % file for Texinfo. % @openin 1 texinfo.cnf @ifeof 1 @else @input texinfo.cnf @fi @closein 1 } % Say @foo, not \foo, in error messages. @escapechar = `@@ % These (along with & and #) are made active for url-breaking, so need % active definitions as the normal characters. @def@normaldot{.} @def@normalquest{?} @def@normalslash{/} % These look ok in all fonts, so just make them not special. % @hashchar{} gets its own user-level command, because of #line. @catcode`@& = @other @def@normalamp{&} @catcode`@# = @other @def@normalhash{#} @catcode`@% = @other @def@normalpercent{%} @let @hashchar = @normalhash @c Finally, make ` and ' active, so that txicodequoteundirected and @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we @c don't make ` and ' active, @code will not get them as active chars. @c Do this last of all since we use ` in the previous @catcode assignments. @catcode`@'=@active @catcode`@`=@active @setregularquotes @c Local variables: @c eval: (add-hook 'before-save-hook 'time-stamp) @c page-delimiter: "^\\\\message\\|emacs-page" @c time-stamp-start: "def\\\\texinfoversion{" @c time-stamp-format: "%:y-%02m-%02d.%02H" @c time-stamp-end: "}" @c End: @c vim:sw=2: @enablebackslashhack ������������������������������������������kbuild-3608/src/grep/build-aux/depcomp��������������������������������������������������������������0000775�0001750�0001750�00000056020�14670377426�017724� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 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 2, 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 <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to <bug-automake@gnu.org>. EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/build-aux/install-sh�����������������������������������������������������������0000775�0001750�0001750�00000035776�14670377427�020373� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ��kbuild-3608/src/grep/build-aux/git-version-gen������������������������������������������������������0000775�0001750�0001750�00000017635�14670377427�021324� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Print a version string. scriptversion=2019-10-13.15; # UTC # Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. # This script is derived from GIT-VERSION-GEN from GIT: https://git-scm.com/. # It may be run two ways: # - from a git repository in which the "git describe" command below # produces useful output (thus requiring at least one signed tag) # - from a non-git-repo directory containing a .tarball-version file, which # presumes this script is invoked like "./git-version-gen .tarball-version". # In order to use intra-version strings in your project, you will need two # separate generated version string files: # # .tarball-version - present only in a distribution tarball, and not in # a checked-out repository. Created with contents that were learned at # the last time autoconf was run, and used by git-version-gen. Must not # be present in either $(srcdir) or $(builddir) for git-version-gen to # give accurate answers during normal development with a checked out tree, # but must be present in a tarball when there is no version control system. # Therefore, it cannot be used in any dependencies. GNUmakefile has # hooks to force a reconfigure at distribution time to get the value # correct, without penalizing normal development with extra reconfigures. # # .version - present in a checked-out repository and in a distribution # tarball. Usable in dependencies, particularly for files that don't # want to depend on config.h but do want to track version changes. # Delete this file prior to any autoconf run where you want to rebuild # files to pick up a version string change; and leave it stale to # minimize rebuild time after unrelated changes to configure sources. # # As with any generated file in a VC'd directory, you should add # /.version to .gitignore, so that you don't accidentally commit it. # .tarball-version is never generated in a VC'd directory, so needn't # be listed there. # # Use the following line in your configure.ac, so that $(VERSION) will # automatically be up-to-date each time configure is run (and note that # since configure.ac no longer includes a version string, Makefile rules # should not depend on configure.ac for version updates). # # AC_INIT([GNU project], # m4_esyscmd([build-aux/git-version-gen .tarball-version]), # [bug-project@example]) # # Then use the following lines in your Makefile.am, so that .version # will be present for dependencies, and so that .version and # .tarball-version will exist in distribution tarballs. # # EXTRA_DIST = $(top_srcdir)/.version # BUILT_SOURCES = $(top_srcdir)/.version # $(top_srcdir)/.version: # echo $(VERSION) > $@-t && mv $@-t $@ # dist-hook: # echo $(VERSION) > $(distdir)/.tarball-version me=$0 year=`expr "$scriptversion" : '\([^-]*\)'` version="git-version-gen $scriptversion Copyright (C) ${year} Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." usage="\ Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT] Print a version string. Options: --prefix PREFIX prefix of git tags (default 'v') --fallback VERSION fallback version to use if \"git --version\" fails --help display this help and exit --version output version information and exit Running without arguments will suffice in most cases." prefix=v fallback= while test $# -gt 0; do case $1 in --help) echo "$usage"; exit 0;; --version) echo "$version"; exit 0;; --prefix) shift; prefix=${1?};; --fallback) shift; fallback=${1?};; -*) echo "$0: Unknown option '$1'." >&2 echo "$0: Try '--help' for more information." >&2 exit 1;; *) if test "x$tarball_version_file" = x; then tarball_version_file="$1" elif test "x$tag_sed_script" = x; then tag_sed_script="$1" else echo "$0: extra non-option argument '$1'." >&2 exit 1 fi;; esac shift done if test "x$tarball_version_file" = x; then echo "$usage" exit 1 fi tag_sed_script="${tag_sed_script:-s/x/x/}" nl=' ' # Avoid meddling by environment variable of the same name. v= v_from_git= # First see if there is a tarball-only version file. # then try "git describe", then default. if test -f $tarball_version_file then v=`cat $tarball_version_file` || v= case $v in *$nl*) v= ;; # reject multi-line output esac test "x$v" = x \ && echo "$0: WARNING: $tarball_version_file is damaged" 1>&2 fi if test "x$v" != x then : # use $v # Otherwise, if there is at least one git commit involving the working # directory, and "git describe" output looks sensible, use that to # derive a version string. elif test "`git log -1 --pretty=format:x . 2>&1`" = x \ && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \ || git describe --abbrev=4 HEAD 2>/dev/null` \ && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \ && case $v in $prefix[0-9]*) ;; *) (exit 1) ;; esac then # Is this a new git that lists number of commits since the last # tag or the previous older version that did not? # Newer: v6.10-77-g0f8faeb # Older: v6.10-g0f8faeb vprefix=`expr "X$v" : 'X\(.*\)-g[^-]*$'` || vprefix=$v case $vprefix in *-*) : git describe is probably okay three part flavor ;; *) : git describe is older two part flavor # Recreate the number of commits and rewrite such that the # result is the same as if we were using the newer version # of git describe. vtag=`echo "$v" | sed 's/-.*//'` commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \ || { commit_list=failed; echo "$0: WARNING: git rev-list failed" 1>&2; } numcommits=`echo "$commit_list" | wc -l` v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; test "$commit_list" = failed && v=UNKNOWN ;; esac # Change the penultimate "-" to ".", for version-comparing tools. # Remove the "g" to save a byte. v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.\1-\2/'`; v_from_git=1 elif test "x$fallback" = x || git --version >/dev/null 2>&1; then v=UNKNOWN else v=$fallback fi v=`echo "$v" |sed "s/^$prefix//"` # Test whether to append the "-dirty" suffix only if the version # string we're using came from git. I.e., skip the test if it's "UNKNOWN" # or if it came from .tarball-version. if test "x$v_from_git" != x; then # Don't declare a version "dirty" merely because a timestamp has changed. git update-index --refresh > /dev/null 2>&1 dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty= case "$dirty" in '') ;; *) # Append the suffix only if there isn't one already. case $v in *-dirty) ;; *) v="$v-dirty" ;; esac ;; esac fi # Omit the trailing newline, so that m4_esyscmd can use the result directly. printf %s "$v" # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ���������������������������������������������������������������������������������������������������kbuild-3608/src/grep/build-aux/missing��������������������������������������������������������������0000775�0001750�0001750�00000015336�14670377427�017754� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # 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 2, 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 <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to <bug-automake@gnu.org>." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/build-aux/gnu-web-doc-update���������������������������������������������������0000775�0001750�0001750�00000014103�14670377427�021661� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Run this after each non-alpha release, to update the web documentation at # https://www.gnu.org/software/$pkg/manual/ VERSION=2021-01-09.09; # UTC # Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. ME=$(basename "$0") warn() { printf '%s: %s\n' "$ME" "$*" >&2; } die() { warn "$*"; exit 1; } help() { cat <<EOF Usage: $ME Run this script from top_srcdir (no arguments) after each non-alpha release, to update the web documentation at https://www.gnu.org/software/\$pkg/manual/ This script assumes you're using git for revision control, and requires a .prev-version file as well as a Makefile, from which it extracts the version number and package name, respectively. Also, it assumes all documentation is in the doc/ sub-directory. Options: -C, --builddir=DIR location of (configured) Makefile (default: .) -n, --dry-run don't actually commit anything -m, --mirror remove out of date files from document server -u, --user the name of the CVS user on Savannah --help print this help, then exit --version print version number, then exit Report bugs and patches to <bug-gnulib@gnu.org>. EOF exit } version() { year=$(echo "$VERSION" | sed 's/[^0-9].*//') cat <<EOF $ME $VERSION Copyright (C) $year Free Software Foundation, Inc, License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. EOF exit } # find_tool ENVVAR NAMES... # ------------------------- # Search for a required program. Use the value of ENVVAR, if set, # otherwise find the first of the NAMES that can be run (i.e., # supports --version). If found, set ENVVAR to the program name, # die otherwise. # # FIXME: code duplication, see also bootstrap. find_tool () { find_tool_envvar=$1 shift find_tool_names=$@ eval "find_tool_res=\$$find_tool_envvar" if test x"$find_tool_res" = x; then for i do if ($i --version </dev/null) >/dev/null 2>&1; then find_tool_res=$i break fi done else find_tool_error_prefix="\$$find_tool_envvar: " fi test x"$find_tool_res" != x \ || die "one of these is required: $find_tool_names" ($find_tool_res --version </dev/null) >/dev/null 2>&1 \ || die "${find_tool_error_prefix}cannot run $find_tool_res --version" eval "$find_tool_envvar=\$find_tool_res" eval "export $find_tool_envvar" } ## ------ ## ## Main. ## ## ------ ## # Requirements: everything required to bootstrap your package, plus # these. find_tool CVS cvs find_tool GIT git find_tool RSYNC rsync find_tool XARGS gxargs xargs builddir=. dryrun= rm_stale='echo' cvs_user="$USER" while test $# != 0 do # Handle --option=value by splitting apart and putting back on argv. case $1 in --*=*) opt=$(echo "$1" | sed -e 's/=.*//') val=$(echo "$1" | sed -e 's/[^=]*=//') shift set dummy "$opt" "$val" "$@"; shift ;; esac case $1 in --help|--version) ${1#--};; -C|--builddir) shift; builddir=$1; shift ;; -n|--dry-run) dryrun=echo; shift;; -m|--mirror) rm_stale=''; shift;; -u|--user) shift; cvs_user=$1; shift ;; --*) die "unrecognized option: $1";; *) break;; esac done test $# = 0 \ || die "too many arguments" prev=.prev-version version=$(cat $prev) || die "no $prev file?" pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' $builddir/Makefile) \ || die "no Makefile?" tmp_branch=web-doc-$version-$$ current_branch=$($GIT branch | sed -ne '/^\* /{s///;p;q;}') cleanup() { __st=$? $dryrun rm -rf "$tmp" $GIT checkout "$current_branch" $GIT submodule update --recursive $GIT branch -d $tmp_branch exit $__st } trap cleanup 0 trap 'exit $?' 1 2 13 15 # We must build using sources for which --version reports the # just-released version number, not some string like 7.6.18-20761. # That version string propagates into all documentation. set -e $GIT checkout -b $tmp_branch v$version $GIT submodule update --recursive ./bootstrap srcdir=$(pwd) cd "$builddir" builddir=$(pwd) ./config.status --recheck ./config.status make make web-manual cd "$srcdir" set +e tmp=$(mktemp -d web-doc-update.XXXXXX) || exit 1 ( cd $tmp \ && $CVS -d $cvs_user@cvs.sv.gnu.org:/webcvs/$pkg co $pkg ) $RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual ( cd $tmp/$pkg/manual # Add all the files. This is simpler than trying to add only the # new ones because of new directories # First add non empty dirs individually find . -name CVS -prune -o -type d \! -empty -print \ | $XARGS -n1 --no-run-if-empty -- $dryrun $CVS add -ko # Now add all files find . -name CVS -prune -o -type f -print \ | $XARGS --no-run-if-empty -- $dryrun $CVS add -ko # Report/Remove stale files # excluding doc server specific files like CVS/* and .symlinks if test -n "$rm_stale"; then echo 'Consider the --mirror option if all of the manual is generated,' >&2 echo 'which will run `cvs remove` to remove stale files.' >&2 fi { find . \( -name CVS -o -type f -name '.*' \) -prune -o -type f -print (cd "$builddir"/doc/manual/ && find . -type f -print | sed p) } | sort | uniq -u \ | $XARGS --no-run-if-empty -- ${rm_stale:-$dryrun} $CVS remove -f $dryrun $CVS ci -m $version ) # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "VERSION=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/build-aux/mdate-sh�������������������������������������������������������������0000775�0001750�0001750�00000013732�14670377427�020003� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Get modification time of a file or directory and pretty-print it. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1995-2021 Free Software Foundation, Inc. # written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995 # # 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 2, 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 <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to <bug-automake@gnu.org> or send patches to # <automake-patches@gnu.org>. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST fi case $1 in '') echo "$0: No file. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: mdate-sh [--help] [--version] FILE Pretty-print the modification day of FILE, in the format: 1 January 1970 Report bugs to <bug-automake@gnu.org>. EOF exit $? ;; -v | --v*) echo "mdate-sh $scriptversion" exit $? ;; esac error () { echo "$0: $1" >&2 exit 1 } # Prevent date giving response in another language. LANG=C export LANG LC_ALL=C export LC_ALL LC_TIME=C export LC_TIME # Use UTC to get reproducible result. TZ=UTC0 export TZ # GNU ls changes its time format in response to the TIME_STYLE # variable. Since we cannot assume 'unset' works, revert this # variable to its documented default. if test "${TIME_STYLE+set}" = set; then TIME_STYLE=posix-long-iso export TIME_STYLE fi save_arg1=$1 # Find out how to get the extended ls output of a file or directory. if ls -L /dev/null 1>/dev/null 2>&1; then ls_command='ls -L -l -d' else ls_command='ls -l -d' fi # Avoid user/group names that might have spaces, when possible. if ls -n /dev/null 1>/dev/null 2>&1; then ls_command="$ls_command -n" fi # A 'ls -l' line looks as follows on OS/2. # drwxrwx--- 0 Aug 11 2001 foo # This differs from Unix, which adds ownership information. # drwxrwx--- 2 root root 4096 Aug 11 2001 foo # # To find the date, we split the line on spaces and iterate on words # until we find a month. This cannot work with files whose owner is a # user named "Jan", or "Feb", etc. However, it's unlikely that '/' # will be owned by a user whose name is a month. So we first look at # the extended ls output of the root directory to decide how many # words should be skipped to get the date. # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. set x`$ls_command /` # Find which argument is the month. month= command= until test $month do test $# -gt 0 || error "failed parsing '$ls_command /' output" shift # Add another shift to the command. command="$command shift;" case $1 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac done test -n "$month" || error "failed parsing '$ls_command /' output" # Get the extended ls output of the file or directory. set dummy x`eval "$ls_command \"\\\$save_arg1\""` # Remove all preceding arguments eval $command # Because of the dummy argument above, month is in $2. # # On a POSIX system, we should have # # $# = 5 # $1 = file size # $2 = month # $3 = day # $4 = year or time # $5 = filename # # On Darwin 7.7.0 and 7.6.0, we have # # $# = 4 # $1 = day # $2 = month # $3 = year or time # $4 = filename # Get the month. case $2 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac case $3 in ???*) day=$1;; *) day=$3; shift;; esac # Here we have to deal with the problem that the ls output gives either # the time of day or the year. case $3 in *:*) set `date`; eval year=\$$# case $2 in Jan) nummonthtod=1;; Feb) nummonthtod=2;; Mar) nummonthtod=3;; Apr) nummonthtod=4;; May) nummonthtod=5;; Jun) nummonthtod=6;; Jul) nummonthtod=7;; Aug) nummonthtod=8;; Sep) nummonthtod=9;; Oct) nummonthtod=10;; Nov) nummonthtod=11;; Dec) nummonthtod=12;; esac # For the first six month of the year the time notation can also # be used for files modified in the last year. if (expr $nummonth \> $nummonthtod) > /dev/null; then year=`expr $year - 1` fi;; *) year=$3;; esac # The result. echo $day $month $year # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ��������������������������������������kbuild-3608/src/grep/build-aux/config.sub�����������������������������������������������������������0000775�0001750�0001750�00000104342�14670377426�020333� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2021 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2021-07-03' # This file 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 <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to <config-patches@gnu.org>. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 IFS="-" read field1 field2 field3 field4 <<EOF $1 EOF # Separate into logical components for further validation case $1 in *-*-*-*-*) echo Invalid configuration \`"$1"\': more than four components >&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 basic_os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 basic_os= ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; convex-c1) basic_machine=c1-convex basic_os=bsd ;; convex-c2) basic_machine=c2-convex basic_os=bsd ;; convex-c32) basic_machine=c32-convex basic_os=bsd ;; convex-c34) basic_machine=c34-convex basic_os=bsd ;; convex-c38) basic_machine=c38-convex basic_os=bsd ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull basic_os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next case $basic_os in openstep*) ;; nextstep*) ;; ns2*) basic_os=nextstep2 ;; *) basic_os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162 IFS="-" read cpu vendor <<EOF $basic_machine EOF ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) cpu=$basic_machine vendor=pc ;; # These rules are duplicated from below for sake of the special case above; # i.e. things that normalized to x86 arches should also default to "pc" pc98) cpu=i386 vendor=pc ;; x64 | amd64) cpu=x86_64 vendor=pc ;; # Recognize the basic CPU types without company name. *) cpu=$basic_machine vendor=unknown ;; esac unset -v basic_machine # Decode basic machines in the full and proper CPU-Company form. case $cpu-$vendor in # Here we handle the default manufacturer of certain CPU types in canonical form. It is in # some cases the only manufacturer, in others, it is the most popular. craynv-unknown) vendor=cray basic_os=${basic_os:-unicosmp} ;; c90-unknown | c90-cray) vendor=cray basic_os=${Basic_os:-unicos} ;; fx80-unknown) vendor=alliant ;; romp-unknown) vendor=ibm ;; mmix-unknown) vendor=knuth ;; microblaze-unknown | microblazeel-unknown) vendor=xilinx ;; rs6000-unknown) vendor=ibm ;; vax-unknown) vendor=dec ;; pdp11-unknown) vendor=dec ;; we32k-unknown) vendor=att ;; cydra-unknown) vendor=cydrome ;; i370-ibm*) vendor=ibm ;; orion-unknown) vendor=highlevel ;; xps-unknown | xps100-unknown) cpu=xps100 vendor=honeywell ;; # Here we normalize CPU types with a missing or matching vendor dpx20-unknown | dpx20-bull) cpu=rs6000 vendor=bull basic_os=${basic_os:-bosx} ;; # Here we normalize CPU types irrespective of the vendor amd64-*) cpu=x86_64 ;; blackfin-*) cpu=bfin basic_os=linux ;; c54x-*) cpu=tic54x ;; c55x-*) cpu=tic55x ;; c6x-*) cpu=tic6x ;; e500v[12]-*) cpu=powerpc basic_os=${basic_os}"spe" ;; mips3*-*) cpu=mips64 ;; ms1-*) cpu=mt ;; m68knommu-*) cpu=m68k basic_os=linux ;; m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) cpu=s12z ;; openrisc-*) cpu=or32 ;; parisc-*) cpu=hppa basic_os=linux ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) cpu=i586 ;; pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*) cpu=i686 ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) cpu=i686 ;; pentium4-*) cpu=i786 ;; pc98-*) cpu=i386 ;; ppc-* | ppcbe-*) cpu=powerpc ;; ppcle-* | powerpclittle-*) cpu=powerpcle ;; ppc64-*) cpu=powerpc64 ;; ppc64le-* | powerpc64little-*) cpu=powerpc64le ;; sb1-*) cpu=mipsisa64sb1 ;; sb1el-*) cpu=mipsisa64sb1el ;; sh5e[lb]-*) cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` ;; spur-*) cpu=spur ;; strongarm-* | thumb-*) cpu=arm ;; tx39-*) cpu=mipstx39 ;; tx39el-*) cpu=mipstx39el ;; x64-*) cpu=x86_64 ;; xscale-* | xscalee[bl]-*) cpu=`echo "$cpu" | sed 's/^xscale/arm/'` ;; arm64-*) cpu=aarch64 ;; # Recognize the canonical CPU Types that limit and/or modify the # company names they are paired with. cr16-*) basic_os=${basic_os:-elf} ;; crisv32-* | etraxfs*-*) cpu=crisv32 vendor=axis ;; cris-* | etrax*-*) cpu=cris vendor=axis ;; crx-*) basic_os=${basic_os:-elf} ;; neo-tandem) cpu=neo vendor=tandem ;; nse-tandem) cpu=nse vendor=tandem ;; nsr-tandem) cpu=nsr vendor=tandem ;; nsv-tandem) cpu=nsv vendor=tandem ;; nsx-tandem) cpu=nsx vendor=tandem ;; mipsallegrexel-sony) cpu=mipsallegrexel vendor=sony ;; tile*-*) basic_os=${basic_os:-linux-gnu} ;; *) # Recognize the canonical CPU types that are allowed with any # company name. case $cpu in 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | abacus \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ | alphapca5[67] | alpha64pca5[67] \ | am33_2.0 \ | amdgcn \ | arc | arceb | arc32 | arc64 \ | arm | arm[lb]e | arme[lb] | armv* \ | avr | avr32 \ | asmjs \ | ba \ | be32 | be64 \ | bfin | bpf | bs2000 \ | c[123]* | c30 | [cjt]90 | c4x \ | c8051 | clipper | craynv | csky | cydra \ | d10v | d30v | dlx | dsp16xx \ | e2k | elxsi | epiphany \ | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ | h8300 | h8500 \ | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i*86 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | loongarch32 | loongarch64 | loongarchx32 \ | m32c | m32r | m32rle \ | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ | m88110 | m88k | maxq | mb | mcore | mep | metag \ | microblaze | microblazeel \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64eb | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r3 | mipsisa32r3el \ | mipsisa32r5 | mipsisa32r5el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r3 | mipsisa64r3el \ | mipsisa64r5 | mipsisa64r5el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mmix \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nfp \ | nios | nios2 | nios2eb | nios2el \ | none | np1 | ns16k | ns32k | nvptx \ | open8 \ | or1k* \ | or32 \ | orion \ | picochip \ | pdp10 | pdp11 | pj | pjl | pn | power \ | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ | pru \ | pyramid \ | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ | rl78 | romp | rs6000 | rx \ | s390 | s390x \ | score \ | sh | shl \ | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ | spu \ | tahoe \ | thumbv7* \ | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ | tron \ | ubicom32 \ | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ | vax \ | visium \ | w65 \ | wasm32 | wasm64 \ | we32k \ | x86 | x86_64 | xc16x | xgate | xps100 \ | xstormy16 | xtensa* \ | ymp \ | z8k | z80) ;; *) echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x$basic_os != x then # First recognize some ad-hoc caes, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) # shellcheck disable=SC2162 IFS="-" read kernel os <<EOF $basic_os EOF ;; # Default OS when just kernel was specified nto*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto|qnx|'` ;; linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|linux|gnu|'` ;; *) kernel= os=$basic_os ;; esac # Now, normalize the OS (knowing we just have one component, it's not a kernel, # etc.) case $os in # First match some system type aliases that might get confused # with valid system types. # solaris* is a basic system type, with this one exception. auroraux) os=auroraux ;; bluegene*) os=cnk ;; solaris1 | solaris1.*) os=`echo "$os" | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2 ;; unixware*) os=sysv4.2uw ;; # es1800 is here to avoid being matched by es* (a different OS) es1800*) os=ose ;; # Some version numbers need modification chorusos*) os=chorusos ;; isc) os=isc2.2 ;; sco6) os=sco5v6 ;; sco5) os=sco3.2v5 ;; sco4) os=sco3.2v4 ;; sco3.2.[4-9]*) os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` ;; sco*v* | scout) # Don't match below ;; sco*) os=sco3.2v2 ;; psos*) os=psos ;; qnx*) os=qnx ;; hiux*) os=hiuxwe2 ;; lynx*178) os=lynxos178 ;; lynx*5) os=lynxos5 ;; lynxos*) # don't get caught up in next wildcard ;; lynx*) os=lynxos ;; mac[0-9]*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition ;; os400*) os=os400 ;; sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince ;; utek*) os=bsd ;; dynix*) os=bsd ;; acis*) os=aos ;; atheos*) os=atheos ;; syllable*) os=syllable ;; 386bsd) os=bsd ;; ctix* | uts*) os=sysv ;; nova*) os=rtmk-nova ;; ns2) os=nextstep2 ;; # Preserve the version number of sinix5. sinix5.*) os=`echo "$os" | sed -e 's|sinix|sysv|'` ;; sinix*) os=sysv4 ;; tpf*) os=tpf ;; triton*) os=sysv3 ;; oss*) os=sysv3 ;; svr4*) os=sysv4 ;; svr3) os=sysv3 ;; sysvr4) os=sysv4 ;; ose*) os=ose ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) os=mint ;; dicos*) os=dicos ;; pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $cpu in arm*) os=eabi ;; *) os=elf ;; esac ;; *) # No normalization, but not necessarily accepted, that comes below. ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. kernel= case $cpu-$vendor in score-*) os=elf ;; spu-*) os=elf ;; *-acorn) os=riscix1.2 ;; arm*-rebel) kernel=linux os=gnu ;; arm*-semi) os=aout ;; c4x-* | tic4x-*) os=coff ;; c8051-*) os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) os=elf ;; tic54x-*) os=coff ;; tic55x-*) os=coff ;; tic6x-*) os=coff ;; # This must come before the *-dec entry. pdp10-*) os=tops20 ;; pdp11-*) os=none ;; *-dec | vax-*) os=ultrix4.2 ;; m68*-apollo) os=domain ;; i386-sun) os=sunos4.0.2 ;; m68000-sun) os=sunos3 ;; m68*-cisco) os=aout ;; mep-*) os=elf ;; mips*-cisco) os=elf ;; mips*-*) os=elf ;; or32-*) os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=sysv3 ;; sparc-* | *-sun) os=sunos4.1.1 ;; pru-*) os=elf ;; *-be) os=beos ;; *-ibm) os=aix ;; *-knuth) os=mmixware ;; *-wec) os=proelf ;; *-winbond) os=proelf ;; *-oki) os=proelf ;; *-hp) os=hpux ;; *-hitachi) os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=sysv ;; *-cbm) os=amigaos ;; *-dg) os=dgux ;; *-dolphin) os=sysv3 ;; m68k-ccur) os=rtu ;; m88k-omron*) os=luna ;; *-next) os=nextstep ;; *-sequent) os=ptx ;; *-crds) os=unos ;; *-ns) os=genix ;; i370-*) os=mvs ;; *-gould) os=sysv ;; *-highlevel) os=bsd ;; *-encore) os=bsd ;; *-sgi) os=irix ;; *-siemens) os=sysv4 ;; *-masscomp) os=rtu ;; f30[01]-fujitsu | f700-fujitsu) os=uxpv ;; *-rom68k) os=coff ;; *-*bug) os=coff ;; *-apple) os=macos ;; *-atari*) os=mint ;; *-wrs) os=vxworks ;; *) os=none ;; esac fi # Now, validate our (potentially fixed-up) OS. case $os in # Sometimes we do "kernel-libc", so those need to count as OSes. musl* | newlib* | uclibc*) ;; # Likewise for "kernel-abi" eabi* | gnueabi*) ;; # VxWorks passes extra cpu info in the 4th filed. simlinux | simwindows | spe) ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ | hiux* | abug | nacl* | netware* | windows* \ | os9* | macos* | osx* | ios* \ | mpw* | magic* | mmixware* | mon960* | lnews* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* | twizzler* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | mirbsd* | netbsd* | dicos* | openedition* | ose* \ | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* | serenity* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | mint* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \ | storm-chaos* | tops10* | tenex* | tops20* | its* \ | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) ;; # This one is extra strict with allowed versions sco3.2v2 | sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; none) ;; *) echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) ;; uclinux-uclibc* ) ;; -dietlibc* | -newlib* | -musl* | -uclibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 exit 1 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; vxworks-simlinux | vxworks-simwindows | vxworks-spe) ;; nto-qnx*) ;; os2-emx) ;; *-eabi* | *-gnueabi*) ;; -*) # Blank kernel with real OS is always fine. ;; *-*) echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/build-aux/vc-list-files��������������������������������������������������������0000775�0001750�0001750�00000007367�14670377427�020771� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # List version-controlled file names. # Print a version string. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2006-2021 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 <https://www.gnu.org/licenses/>. # List the specified version-controlled files. # With no argument, list them all. With a single DIRECTORY argument, # list the version-controlled files in that directory. # If there's an argument, it must be a single, "."-relative directory name. # cvsu is part of the cvsutils package: https://www.red-bean.com/cvsutils/ postprocess= case $1 in --help) cat <<EOF Usage: $0 [-C SRCDIR] [DIR...] Output a list of version-controlled files in DIR (default .), relative to SRCDIR (default .). SRCDIR must be the top directory of a checkout. Options: --help print this help, then exit --version print version number, then exit -C SRCDIR change directory to SRCDIR before generating list Report bugs and patches to <bug-gnulib@gnu.org>. EOF exit ;; --version) year=`echo "$scriptversion" | sed 's/[^0-9].*//'` cat <<EOF vc-list-files $scriptversion Copyright (C) $year Free Software Foundation, Inc, License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. EOF exit ;; -C) test "$2" = . || postprocess="| sed 's|^|$2/|'" cd "$2" || exit 1 shift; shift ;; esac test $# = 0 && set . for dir do if test -d .git || test -f .git; then test "x$dir" = x. \ && dir= sed_esc= \ || { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; } # Ignore git symlinks - either they point into the tree, in which case # we don't need to visit the target twice, or they point somewhere # else (often into a submodule), in which case the content does not # belong to this package. eval exec git ls-tree -r 'HEAD:"$dir"' \ \| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess elif test -d .hg; then eval exec hg locate '"$dir/*"' $postprocess elif test -d .bzr; then test "$postprocess" = '' && postprocess="| sed 's|^\./||'" eval exec bzr ls -R --versioned '"$dir"' $postprocess elif test -d CVS; then test "$postprocess" = '' && postprocess="| sed 's|^\./||'" if test -x build-aux/cvsu; then eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess elif (cvsu --help) >/dev/null 2>&1; then eval cvsu --find --types=AFGM '"$dir"' $postprocess else eval awk -F/ \''{ \ if (!$1 && $3 !~ /^-/) { \ f=FILENAME; \ if (f ~ /CVS\/Entries$/) \ f = substr(f, 1, length(f)-11); \ print f $2; \ }}'\'' \ `find "$dir" -name Entries -print` /dev/null' $postprocess fi elif test -d .svn; then eval exec svn list -R '"$dir"' $postprocess else echo "$0: Failed to determine type of version control used in `pwd`" 1>&2 exit 1 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/build-aux/announce-gen���������������������������������������������������������0000775�0001750�0001750�00000041357�14670377427�020662� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh #! -*-perl-*- # Generate a release announcement message. # Copyright (C) 2002-2021 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 <https://www.gnu.org/licenses/>. # # Written by Jim Meyering # This is a prologue that allows to run a perl script as an executable # on systems that are compliant to a POSIX version before POSIX:2017. # On such systems, the usual invocation of an executable through execlp() # or execvp() fails with ENOEXEC if it is a script that does not start # with a #! line. The script interpreter mentioned in the #! line has # to be /bin/sh, because on GuixSD systems that is the only program that # has a fixed file name. The second line is essential for perl and is # also useful for editing this file in Emacs. The next two lines below # are valid code in both sh and perl. When executed by sh, they re-execute # the script through the perl program found in $PATH. The '-x' option # is essential as well; without it, perl would re-execute the script # through /bin/sh. When executed by perl, the next two lines are a no-op. eval 'exec perl -wSx "$0" "$@"' if 0; my $VERSION = '2021-08-04 09:17'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. my $copyright_year = '2021'; use strict; use Getopt::Long; use POSIX qw(strftime); (my $ME = $0) =~ s|.*/||; my %valid_release_types = map {$_ => 1} qw (alpha beta stable); my @archive_suffixes = qw (tar.gz tar.bz2 tar.lz tar.lzma tar.xz); my $srcdir = '.'; sub usage ($) { my ($exit_code) = @_; my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); if ($exit_code != 0) { print $STREAM "Try '$ME --help' for more information.\n"; } else { my @types = sort keys %valid_release_types; print $STREAM <<EOF; Usage: $ME [OPTIONS] Generate an announcement message. Run this from builddir. OPTIONS: These options must be specified: --release-type=TYPE TYPE must be one of @types --package-name=PACKAGE_NAME --previous-version=VER --current-version=VER --gpg-key-id=ID The GnuPG ID of the key used to sign the tarballs --url-directory=URL_DIR The following are optional: --news=NEWS_FILE include the NEWS section about this release from this NEWS_FILE; accumulates. --srcdir=DIR where to find the NEWS_FILEs (default: $srcdir) --bootstrap-tools=TOOL_LIST a comma-separated list of tools, e.g., autoconf,automake,bison,gnulib --gnulib-version=VERSION report VERSION as the gnulib version, where VERSION is the result of running git describe in the gnulib source directory. required if gnulib is in TOOL_LIST. --no-print-checksums do not emit SHA1 or SHA256 checksums --archive-suffix=SUF add SUF to the list of archive suffixes --mail-headers=HEADERS a space-separated list of mail headers, e.g., To: x\@example.com Cc: y-announce\@example.com,... --help display this help and exit --version output version information and exit EOF } exit $exit_code; } =item C<%size> = C<sizes (@file)> Compute the sizes of the C<@file> and return them as a hash. Return C<undef> if one of the computation failed. =cut sub sizes (@) { my (@file) = @_; my $fail = 0; my %res; foreach my $f (@file) { my $cmd = "du -h $f"; my $t = `$cmd`; # FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS $@ and (warn "command failed: '$cmd'\n"), $fail = 1; chomp $t; $t =~ s/^\s*([\d.]+[MkK]).*/${1}B/; $res{$f} = $t; } return $fail ? undef : %res; } =item C<print_locations ($title, \@url, \%size, @file) Print a section C<$title> dedicated to the list of <@file>, which sizes are stored in C<%size>, and which are available from the C<@url>. =cut sub print_locations ($\@\%@) { my ($title, $url, $size, @file) = @_; print "Here are the $title:\n"; foreach my $url (@{$url}) { for my $file (@file) { print " $url/$file"; print " (", $$size{$file}, ")" if exists $$size{$file}; print "\n"; } } print "\n"; } =item C<print_checksums (@file) Print the SHA1 and SHA256 signature section for each C<@file>. =cut sub print_checksums (@) { my (@file) = @_; print "Here are the SHA1 and SHA256 checksums:\n"; print "\n"; use Digest::file qw(digest_file_hex digest_file_base64); foreach my $f (@file) { print digest_file_hex($f, "SHA-1"), " $f\n"; print digest_file_base64($f, "SHA-256"), " $f\n"; } print "\nThe SHA256 checksum is base64 encoded, instead of the\n"; print "hexadecimal encoding that most checksum tools default to.\n\n"; } =item C<print_news_deltas ($news_file, $prev_version, $curr_version) Print the section of the NEWS file C<$news_file> addressing changes between versions C<$prev_version> and C<$curr_version>. =cut sub print_news_deltas ($$$) { my ($news_file, $prev_version, $curr_version) = @_; my $news_name = $news_file; $news_name =~ s|^\Q$srcdir\E/||; print "\n$news_name\n\n"; # Print all lines from $news_file, starting with the first one # that mentions $curr_version up to but not including # the first occurrence of $prev_version. my $in_items; my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/; my $found_news; open NEWS, '<', $news_file or die "$ME: $news_file: cannot open for reading: $!\n"; while (defined (my $line = <NEWS>)) { if ( ! $in_items) { # Match lines like these: # * Major changes in release 5.0.1: # * Noteworthy changes in release 6.6 (2006-11-22) [stable] $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o or next; $in_items = 1; print $line; } else { # This regexp must not match version numbers in NEWS items. # For example, they might well say "introduced in 4.5.5", # and we don't want that to match. $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o and last; print $line; $line =~ /\S/ and $found_news = 1; } } close NEWS; $in_items or die "$ME: $news_file: no matching lines for '$curr_version'\n"; $found_news or die "$ME: $news_file: no news item found for '$curr_version'\n"; } sub print_changelog_deltas ($$) { my ($package_name, $prev_version) = @_; # Print new ChangeLog entries. # First find all CVS-controlled ChangeLog files. use File::Find; my @changelog; find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS' and push @changelog, $File::Find::name}}, '.'); # If there are no ChangeLog files, we're done. @changelog or return; my %changelog = map {$_ => 1} @changelog; # Reorder the list of files so that if there are ChangeLog # files in the specified directories, they're listed first, # in this order: my @dir = qw ( . src lib m4 config doc ); # A typical @changelog array might look like this: # ./ChangeLog # ./po/ChangeLog # ./m4/ChangeLog # ./lib/ChangeLog # ./doc/ChangeLog # ./config/ChangeLog my @reordered; foreach my $d (@dir) { my $dot_slash = $d eq '.' ? $d : "./$d"; my $target = "$dot_slash/ChangeLog"; delete $changelog{$target} and push @reordered, $target; } # Append any remaining ChangeLog files. push @reordered, sort keys %changelog; # Remove leading './'. @reordered = map { s!^\./!!; $_ } @reordered; print "\nChangeLog entries:\n\n"; # print join ("\n", @reordered), "\n"; $prev_version =~ s/\./_/g; my $prev_cvs_tag = "\U$package_name\E-$prev_version"; my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered"; open DIFF, '-|', $cmd or die "$ME: cannot run '$cmd': $!\n"; # Print two types of lines, making minor changes: # Lines starting with '+++ ', e.g., # +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247 # and those starting with '+'. # Don't print the others. my $prev_printed_line_empty = 1; while (defined (my $line = <DIFF>)) { if ($line =~ /^\+\+\+ /) { my $separator = "*"x70 ."\n"; $line =~ s///; $line =~ s/\s.*//; $prev_printed_line_empty or print "\n"; print $separator, $line, $separator; } elsif ($line =~ /^\+/) { $line =~ s///; print $line; $prev_printed_line_empty = ($line =~ /^$/); } } close DIFF; # The exit code should be 1. # Allow in case there are no modified ChangeLog entries. $? == 256 || $? == 128 or warn "warning: '$cmd' had unexpected exit code or signal ($?)\n"; } sub get_tool_versions ($$) { my ($tool_list, $gnulib_version) = @_; @$tool_list or return (); my $fail; my @tool_version_pair; foreach my $t (@$tool_list) { if ($t eq 'gnulib') { push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version; next; } # Assume that the last "word" on the first line of # 'tool --version' output is the version string. my ($first_line, undef) = split ("\n", `$t --version`); if ($first_line =~ /.* (\d[\w.-]+)$/) { $t = ucfirst $t; push @tool_version_pair, "$t $1"; } else { defined $first_line and $first_line = ''; warn "$t: unexpected --version output\n:$first_line"; $fail = 1; } } $fail and exit 1; return @tool_version_pair; } { # Use the C locale so that, for instance, "du" does not # print "1,2" instead of "1.2", which would confuse our regexps. $ENV{LC_ALL} = "C"; my $mail_headers; my $release_type; my $package_name; my $prev_version; my $curr_version; my $gpg_key_id; my @url_dir_list; my @news_file; my $bootstrap_tools; my $gnulib_version; my $print_checksums_p = 1; # Reformat the warnings before displaying them. local $SIG{__WARN__} = sub { my ($msg) = @_; # Warnings from GetOptions. $msg =~ s/Option (\w)/option --$1/; warn "$ME: $msg"; }; GetOptions ( 'mail-headers=s' => \$mail_headers, 'release-type=s' => \$release_type, 'package-name=s' => \$package_name, 'previous-version=s' => \$prev_version, 'current-version=s' => \$curr_version, 'gpg-key-id=s' => \$gpg_key_id, 'url-directory=s' => \@url_dir_list, 'news=s' => \@news_file, 'srcdir=s' => \$srcdir, 'bootstrap-tools=s' => \$bootstrap_tools, 'gnulib-version=s' => \$gnulib_version, 'print-checksums!' => \$print_checksums_p, 'archive-suffix=s' => \@archive_suffixes, help => sub { usage 0 }, version => sub { print "$ME version $VERSION\n"; print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n"; print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n" . "This is free software: you are free to change and redistribute it.\n" . "There is NO WARRANTY, to the extent permitted by law.\n"; print "\n"; my $author = "Jim Meyering"; print "Written by $author.\n"; exit }, ) or usage 1; my $fail = 0; # Ensure that each required option is specified. $release_type or (warn "release type not specified\n"), $fail = 1; $package_name or (warn "package name not specified\n"), $fail = 1; $prev_version or (warn "previous version string not specified\n"), $fail = 1; $curr_version or (warn "current version string not specified\n"), $fail = 1; $gpg_key_id or (warn "GnuPG key ID not specified\n"), $fail = 1; @url_dir_list or (warn "URL directory name(s) not specified\n"), $fail = 1; my @tool_list = split ',', $bootstrap_tools if $bootstrap_tools; grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version and (warn "when specifying gnulib as a tool, you must also specify\n" . "--gnulib-version=V, where V is the result of running git describe\n" . "in the gnulib source directory.\n"), $fail = 1; !$release_type || exists $valid_release_types{$release_type} or (warn "'$release_type': invalid release type\n"), $fail = 1; @ARGV and (warn "too many arguments:\n", join ("\n", @ARGV), "\n"), $fail = 1; $fail and usage 1; my $my_distdir = "$package_name-$curr_version"; my $xd = "$package_name-$prev_version-$curr_version.xdelta"; my @candidates = map { "$my_distdir.$_" } @archive_suffixes; my @tarballs = grep {-f $_} @candidates; @tarballs or die "$ME: none of " . join(', ', @candidates) . " were found\n"; my @sizable = @tarballs; -f $xd and push @sizable, $xd; my %size = sizes (@sizable); %size or exit 1; my $headers = ''; if (defined $mail_headers) { ($headers = $mail_headers) =~ s/\s+(\S+:)/\n$1/g; $headers .= "\n"; } # The markup is escaped as <\# so that when this script is sent by # mail (or part of a diff), Gnus is not triggered. print <<EOF; ${headers}Subject: $my_distdir released [$release_type] <\#secure method=pgpmime mode=sign> FIXME: put comments here EOF if (@url_dir_list == 1 && @tarballs == 1) { # When there's only one tarball and one URL, use a more concise form. my $m = "$url_dir_list[0]/$tarballs[0]"; print "Here are the compressed sources and a GPG detached signature[*]:\n" . " $m\n" . " $m.sig\n\n"; } else { print_locations ("compressed sources", @url_dir_list, %size, @tarballs); -f $xd and print_locations ("xdelta diffs (useful? if so, " . "please tell bug-gnulib\@gnu.org)", @url_dir_list, %size, $xd); my @sig_files = map { "$_.sig" } @tarballs; print_locations ("GPG detached signatures[*]", @url_dir_list, %size, @sig_files); } if ($url_dir_list[0] =~ "gnu\.org") { print "Use a mirror for higher download bandwidth:\n"; if (@tarballs == 1 && $url_dir_list[0] =~ m!https://ftp\.gnu\.org/gnu/!) { (my $m = "$url_dir_list[0]/$tarballs[0]") =~ s!https://ftp\.gnu\.org/gnu/!https://ftpmirror\.gnu\.org/!; print " $m\n" . " $m.sig\n\n"; } else { print " https://www.gnu.org/order/ftp.html\n\n"; } } $print_checksums_p and print_checksums (@sizable); print <<EOF; [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify $tarballs[0].sig If that command fails because you don't have the required public key, then run this command to import it: gpg --keyserver keys.gnupg.net --recv-keys $gpg_key_id and rerun the 'gpg --verify' command. EOF my @tool_versions = get_tool_versions (\@tool_list, $gnulib_version); @tool_versions and print "\nThis release was bootstrapped with the following tools:", join ('', map {"\n $_"} @tool_versions), "\n"; print_news_deltas ($_, $prev_version, $curr_version) foreach @news_file; $release_type eq 'stable' or print_changelog_deltas ($package_name, $prev_version); exit 0; } ### Setup "GNU" style for perl-mode and cperl-mode. ## Local Variables: ## mode: perl ## perl-indent-level: 2 ## perl-continued-statement-offset: 2 ## perl-continued-brace-offset: 0 ## perl-brace-offset: 0 ## perl-brace-imaginary-offset: 0 ## perl-label-offset: -2 ## perl-extra-newline-before-brace: t ## perl-merge-trailing-else: nil ## eval: (add-hook 'before-save-hook 'time-stamp) ## time-stamp-line-limit: 50 ## time-stamp-start: "my $VERSION = '" ## time-stamp-format: "%:y-%02m-%02d %02H:%02M" ## time-stamp-time-zone: "UTC0" ## time-stamp-end: "'; # UTC" ## End: ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/build-aux/config.rpath���������������������������������������������������������0000775�0001750�0001750�00000044254�14670377427�020666� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2021 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # The first argument passed to this file is the canonical host specification, # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld # should be set by the caller. # # The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer # than 256 bytes, otherwise the compiler driver will dump core. The only # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a shrext=.so host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Code taken from libtool.m4's _LT_CC_BASENAME. for cc_temp in $CC""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` # Code taken from libtool.m4's _LT_COMPILER_PIC. wl= if test "$GCC" = yes; then wl='-Wl,' else case "$host_os" in aix*) wl='-Wl,' ;; mingw* | cygwin* | pw32* | os2* | cegcc*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' ;; irix5* | irix6* | nonstopux*) wl='-Wl,' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in ecc*) wl='-Wl,' ;; icc* | ifort*) wl='-Wl,' ;; lf95*) wl='-Wl,' ;; nagfor*) wl='-Wl,-Wl,,' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) wl='-Wl,' ;; ccc*) wl='-Wl,' ;; xl* | bgxl* | bgf* | mpixl*) wl='-Wl,' ;; como) wl='-lopt=' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) wl= ;; *Sun\ C*) wl='-Wl,' ;; esac ;; esac ;; newsos6) ;; *nto* | *qnx*) ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; rdos*) ;; solaris*) case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) wl='-Qoption ld ' ;; *) wl='-Wl,' ;; esac ;; sunos4*) wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3*) wl='-Wl,' ;; sysv4*MP*) ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) wl='-Wl,' ;; unicos*) wl='-Wl,' ;; uts4*) ;; esac fi # Code taken from libtool.m4's _LT_LINKER_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no case "$host_os" in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. # Unlike libtool, we use -rpath here, not --rpath, since the documented # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' case "$host_os" in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) case "$host_cpu" in powerpc) ;; m68k) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then : else ld_shlibs=no fi ;; haiku*) ;; interix[3-9]*) hardcode_direct=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; netbsd*) ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' else ld_shlibs=no fi ;; esac ;; sunos4*) hardcode_direct=yes ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then hardcode_libdir_flag_spec= fi else case "$host_os" in aix3*) # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac fi hardcode_direct=yes hardcode_libdir_separator=':' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac fi # Begin _LT_AC_SYS_LIBPATH_AIX. echo 'int main () { return 0; }' > conftest.c ${CC} ${LDFLAGS} conftest.c -o conftest aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` fi if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib" fi rm -f conftest.c conftest # End _LT_AC_SYS_LIBPATH_AIX. if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" fi fi ;; amigaos*) case "$host_cpu" in powerpc) ;; m68k) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' libext=lib ;; darwin* | rhapsody*) hardcode_direct=no if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then : else ld_shlibs=no fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; freebsd2.[01]*) hardcode_direct=yes hardcode_minus_L=yes ;; freebsd* | dragonfly* | midnightbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; hpux9*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; hpux10*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no ;; *) hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; newsos6) hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then hardcode_libdir_flag_spec='${wl}-rpath,$libdir' else case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) hardcode_libdir_flag_spec='-R$libdir' ;; *) hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; osf3*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) if test "$GCC" = yes; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else # Both cc and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) hardcode_libdir_flag_spec='-R$libdir' ;; sunos4*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; sysv4) case $host_vendor in sni) hardcode_direct=yes # is this really true??? ;; siemens) hardcode_direct=no ;; motorola) hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac ;; sysv4.3*) ;; sysv4*MP*) if test -d /usr/nec; then ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) ;; sysv5* | sco3.2v5* | sco5v6*) hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' ;; uts4*) hardcode_libdir_flag_spec='-L$libdir' ;; *) ld_shlibs=no ;; esac fi # Check dynamic linker characteristics # Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. # Unlike libtool.m4, here we don't care about _all_ names of the library, but # only about the one the linker finds when passed -lNAME. This is the last # element of library_names_spec in libtool.m4, or possibly two of them if the # linker has special search rules. library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) library_names_spec='$libname.a' ;; aix[4-9]*) library_names_spec='$libname$shrext' ;; amigaos*) case "$host_cpu" in powerpc*) library_names_spec='$libname$shrext' ;; m68k) library_names_spec='$libname.a' ;; esac ;; beos*) library_names_spec='$libname$shrext' ;; bsdi[45]*) library_names_spec='$libname$shrext' ;; cygwin* | mingw* | pw32* | cegcc*) shrext=.dll library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib library_names_spec='$libname$shrext' ;; dgux*) library_names_spec='$libname$shrext' ;; freebsd[23].*) library_names_spec='$libname$shrext$versuffix' ;; freebsd* | dragonfly* | midnightbsd*) library_names_spec='$libname$shrext' ;; gnu*) library_names_spec='$libname$shrext' ;; haiku*) library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in ia64*) shrext=.so ;; hppa*64*) shrext=.sl ;; *) shrext=.sl ;; esac library_names_spec='$libname$shrext' ;; interix[3-9]*) library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; *) libsuff= shlibsuff= ;; esac ;; esac ;; linux*oldld* | linux*aout* | linux*coff*) ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) library_names_spec='$libname$shrext' ;; knetbsd*-gnu) library_names_spec='$libname$shrext' ;; netbsd*) library_names_spec='$libname$shrext' ;; newsos6) library_names_spec='$libname$shrext' ;; *nto* | *qnx*) library_names_spec='$libname$shrext' ;; openbsd*) library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) library_names_spec='$libname$shrext' ;; rdos*) ;; solaris*) library_names_spec='$libname$shrext' ;; sunos4*) library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) library_names_spec='$libname$shrext' ;; sysv4*MP*) library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) library_names_spec='$libname$shrext' ;; tpf*) library_names_spec='$libname$shrext' ;; uts4*) library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF # How to pass a linker flag through the compiler. wl="$escaped_wl" # Static library suffix (normally "a"). libext="$libext" # Shared library suffix (normally "so"). shlibext="$shlibext" # Format of library name prefix. libname_spec="$escaped_libname_spec" # Library names that the linker finds when passed -lNAME. library_names_spec="$escaped_library_names_spec" # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec" # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator="$hardcode_libdir_separator" # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. hardcode_direct="$hardcode_direct" # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L="$hardcode_minus_L" EOF ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/build-aux/test-driver����������������������������������������������������������0000775�0001750�0001750�00000011417�14670377427�020547� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2011-2021 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 2, 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 <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to <bug-automake@gnu.org> or send patches to # <automake-patches@gnu.org>. # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <<END Usage: test-driver --test-name NAME --log-file PATH --trs-file PATH [--expect-failure {yes|no}] [--color-tests {yes|no}] [--enable-hard-errors {yes|no}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] The '--test-name', '--log-file' and '--trs-file' options are mandatory. See the GNU Automake documentation for information. END } test_name= # Used for reporting. log_file= # Where to save the output of the test script. trs_file= # Where to save the metadata of the test run. expect_failure=no color_tests=no enable_hard_errors=yes while test $# -gt 0; do case $1 in --help) print_usage; exit $?;; --version) echo "test-driver $scriptversion"; exit $?;; --test-name) test_name=$2; shift;; --log-file) log_file=$2; shift;; --trs-file) trs_file=$2; shift;; --color-tests) color_tests=$2; shift;; --expect-failure) expect_failure=$2; shift;; --enable-hard-errors) enable_hard_errors=$2; shift;; --) shift; break;; -*) usage_error "invalid option: '$1'";; *) break;; esac shift done missing_opts= test x"$test_name" = x && missing_opts="$missing_opts --test-name" test x"$log_file" = x && missing_opts="$missing_opts --log-file" test x"$trs_file" = x && missing_opts="$missing_opts --trs-file" if test x"$missing_opts" != x; then usage_error "the following mandatory options are missing:$missing_opts" fi if test $# -eq 0; then usage_error "missing argument" fi if test $color_tests = yes; then # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'. red='' # Red. grn='' # Green. lgn='' # Light green. blu='' # Blue. mgn='' # Magenta. std='' # No color. else red= grn= lgn= blu= mgn= std= fi do_exit='rm -f $log_file $trs_file; (exit $st); exit $st' trap "st=129; $do_exit" 1 trap "st=130; $do_exit" 2 trap "st=141; $do_exit" 13 trap "st=143; $do_exit" 15 # Test script is run here. We create the file first, then append to it, # to ameliorate tests themselves also writing to the log file. Our tests # don't, but others can (automake bug#35762). : >"$log_file" "$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/README-alpha�������������������������������������������������������������������0000664�0001750�0001750�00000003031�14670377427�016413� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Copyright (C) 1992, 1997-2002, 2004-2021 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. The development source code is available via Git from Savannah: see <https://git.savannah.gnu.org/cgit/grep.git>. The main project page is at <https://savannah.gnu.org/projects/grep/>. The source code in the Git uses autotools to generate some files. Before following the instructions in the INSTALL file for compiling grep, you need to run the bootstrap script. Please submit bug reports to <bug-grep@gnu.org>. If you are interested in the development of GNU grep, you may want to subscribe to the development mailing list. To subscribe, send an email message to <bug-grep-request@gnu.org> with "subscribe" (without the quotation marks) in the subject header field (or in the body) of the email, or visit <https://lists.gnu.org/mailman/listinfo/bug-grep>. To follow development more closely, there is also the grep-commit mailing list to which log entries (one per commit) and diff output (one per modified file) from CVS are automatically sent. To subscribe, send an email message to <grep-commit-request@gnu.org> with "subscribe" (without the quotation marks) in the subject header field (or in the body) of the email, or visit <https://lists.gnu.org/mailman/listinfo/grep-commit>. A web page containing information for GNU grep developers is at <https://www.gnu.org/software/grep/devel.html>. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/ChangeLog����������������������������������������������������������������������0000664�0001750�0001750�00001663440�14670377427�016243� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������2021-08-14 Jim Meyering <meyering@fb.com> version 3.7 * NEWS: Record release date. 2021-08-09 Jim Meyering <meyering@fb.com> tests: provide an awk-based seq replacement ...so we can continue to use seq, but the wrapper when needed. * tests/init.cfg (seq): Some systems lask seq. Provide a replacement. * tests/hash-collision-perf: Use seq once again. * tests/long-pattern-perf: Likewise. And remove a comment about seq. 2021-08-09 Paul Eggert <eggert@cs.ucla.edu> grep: simplify EGexecute * src/dfasearch.c (EGexecute): Remove a label and goto. This also makes the machine code a bit shorter, on x86-64 gcc. grep: simplify data movement slightly * src/grep.c (fillbuf): Simplify movement of saved data. grep: pointer-integer cast nit * src/grep.c (ALIGN_TO): When converting pointers to unsigned integers, convert to uintptr_t not size_t, as size_t in theory might be too narrow. tests: use awk, not seq Portability problem reported by Dagobert Michelsen in: https://lists.gnu.org/r/grep-devel/2021-08/msg00004.html * tests/hash-collision-perf, tests/long-pattern-perf: Don’t assume seq is installed; use awk instead. 2021-08-08 Jim Meyering <meyering@fb.com> build: update gnulib to latest build: update gnulib to latest 2021-08-06 Kevin Locke <kevin@kevinlocke.name> doc: usage: --group-separator/--no-group-separator * src/grep.c (usage): Document --group-separator and --no-group-separator. doc: man: add --group-separator/--no-group-separator * doc/grep.in.1: Add copy of docs for --group-separator from doc/grep.texi. Add copy of docs for --no-group-separator from doc/grep.texi. 2021-08-06 Jim Meyering <meyering@fb.com> build: update gnulib to latest 2021-06-19 Mateusz Okulus <mmokulus@gmail.com> doc: note that -H is a GNU extension in man page, too * doc/grep.in.1 (-H): Mention that this is a GNU extension. 2021-06-13 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2021-06-11 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2021-06-10 Paul Eggert <eggert@cs.ucla.edu> doc: improve examples and wording * doc/grep.texi (The Backslash Character and Special Expressions) (Usage): Improve doc (Bug#48948). 2021-01-31 Jim Meyering <meyering@fb.com> doc: man: fix -L description and improve -l's * doc/grep.texi (-L): Remove erroneous sentence about stopping early. With -L, grep cannot stop scanning early. (-l): Tweak existing wording. * doc/grep.in.1: Remove the -L sentence here, too. (-l): Copy the sentence from grep.texi, to clarify: it's only per-file scanning that stops upon match. Reported by Robert Bruntz in http://debbugs.gnu.org/46179 2021-01-05 Jim Meyering <meyering@fb.com> build: avoid long-string warnings in gnulib tests * configure.ac (GNULIB_TEST_WARN_CFLAGS): Add -Woverlength-strings to avoid clang warnings. 2021-01-01 Paul Eggert <eggert@cs.ucla.edu> doc: further clarify regexp structure * doc/grep.texi (Fundamental Structure) (Back-references and Subexpressions, Basic vs Extended): Further clarifications. maint: copy bootstrap, tests/init.sh from Gnulib doc: update grep.texi cite to 2021 maint: run "make update-copyright" build: update gnulib submodule to latest 2020-12-30 Jim Meyering <meyering@fb.com> build: update gnulib to latest * gnulib: update for clang-10 warning warning-avoidance fixes in hash and regex-tests. maint: add parentheses to avoid new clang-10 warning * src/dfasearch.c (regex_compile): Parenthesize arith-OR vs ternary, to placate clang-10. 2020-12-29 Paul Eggert <eggert@cs.ucla.edu> doc: clarify special chars and } * doc/grep.texi (Fundamental Structure) (Character Classes and Bracket Expressions) (The Backslash Character and Special Expressions, Anchoring) (Basic vs Extended): Clarify which characters are special, and why \ is needed before } in grep even though } is not special. Use Posix terminology for ordinary and special characters and for interval expressions. 2020-12-29 Marek Suppa <mr@shu.io> doc: fix missing right curly brace * doc/grep.texi (Basic vs Extended Regular Expressions): Mention that the right curly brace (}) meta-character must be backslash-escaped. It had been omitted from the list. 2020-12-25 Jim Meyering <meyering@fb.com> build: update gnulib to latest grep: use of --unix-byte-offsets (-u) now elicits a warning * NEWS (Change in behavior): Mention this. * src/grep.c (main): Warn about each use of obsolete --unix-byte-offsets (-u). * doc/grep.in.1 (-u): Remove its documentation. 2020-12-23 Helge Kreutzmann <debian@helgefjell.de> doc: adjust man page syntax * doc/grep.in.1: Mark some manual names with B<...>. Mark PATTERNS with I<...>. Drop final period in SEE ALSO. With suggestions from of several members of the manpage-l10n translation community. This resolves https://bugs.gnu.org/45353 2020-11-26 Jim Meyering <meyering@fb.com> grep: avoid performance regression with many patterns * src/grep.c (hash_pattern): Switch from PJW to DJB2, to avoid an O(N) to O(N^2) performance regression due to hash collisions with patterns from e.g., seq 500000|tr 0-9 A-J Reported by Frank Heckenbach in https://bugs.gnu.org/44754 * NEWS (Bug fixes): Mention it. * tests/hash-collision-perf: New file. * tests/Makefile.am (TESTS): Add it. build: update gnulib to latest for warning fixes * gnulib: Update submodule to latest. * src/grep.c (printf_errno): Reflect gnulib's renaming: change _GL_ATTRIBUTE_FORMAT_PRINTF to _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD tests: enable warnings for the gnulib-tests subdir * gnulib-tests/Makefile.am (AM_CFLAGS): Enable gnulib warning options for these tests. * configure.ac (GNULIB_TEST_WARN_CFLAGS): Disable the same three warning options that coreutils does, and a few more for GCC11. 2020-11-08 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.6 * NEWS: Record release date. 2020-11-05 Jim Meyering <meyering@fb.com> build: update gnulib to latest for test improvements 2020-11-03 Jim Meyering <meyering@fb.com> build: update gnulib to latest for C++-ready dfa.h and test-verify.c fix 2020-11-03 Paul Eggert <eggert@cs.ucla.edu> grep: remove GREP_OPTIONS * NEWS: Mention this. * doc/grep.in.1: Remove GREP_OPTIONS documentation. * doc/grep.texi (Environment Variables): Move GREP_OPTIONS stuff into a “no longer implemented†paragraph. * src/grep.c (prepend_args, prepend_default_options): Remove. (main): Do not look at GREP_OPTIONS. * tests/Makefile.am (TESTS_ENVIRONMENTS): * tests/init.cfg (vars_): Remove GREP_OPTIONS. 2020-11-01 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: use RE_NO_SUB when calling regex solely to check syntax * src/dfasearch.c (regex_compile): New parameter. All callers changed. (GEAcompile): Move setting syntax for regex into regex_compile() function. This addresses a performance problem exposed by extreme regular expressions, as described in https://bugs.gnu.org/43862 . tests: add the test for bugfix in gnulib's dfa * tests/ere.tests: Add new test. 2020-11-01 Jim Meyering <meyering@fb.com> grep: avoid erroneous matches for e.g., a+a+a+ * gnulib: Update to latest, for dfa's invalid-merge fix. * NEWS (Bug fixes): Mention this. 2020-10-11 Jim Meyering <meyering@fb.com> grep: -P: report input filename upon PCRE execution failure Without this, it could be tedious to determine which input file evokes a PCRE-execution-time failure. * src/pcresearch.c (Pexecute): When failing, include the error-provoking file name in the diagnostic. * src/grep.c (input_filename): Make extern, since used above. * src/search.h (input_filename): Declare. * tests/filename-lineno.pl: Test for this. ($no_pcre): Factor out. * NEWS (Bug fixes): Mention this. 2020-10-11 Paul Eggert <eggert@cs.ucla.edu> grep: minor kwset cleanups * src/kwsearch.c (Fexecute): Assume C99 to put declarations nearer uses. * src/kwset.c (bmexec): Omit unnecessary test. * src/kwset.h (struct kwsmatch): Make OFFSET and SIZE individual elements, not arrays of size 1 (a revenant of an earlier API). All uses changed. 2020-10-11 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: remove unused code * src/kwsearch.c (Fcompile, Fexecute): Remove unused code. No longer these are used after commit 016e590a8198009bce0e1078f6d4c7e037e2df3c. 2020-10-05 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2020-10-05 Jim Meyering <meyering@fb.com> tests: correct filename-lineno.pl * tests/filename-lineno.pl: Remove a stray envvar that somehow slipped into expected output string. 2020-10-05 Paul Eggert <eggert@cs.ucla.edu> tests: fix tests when PCRE is not used * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH before setting PCRE_WORKS, so that the latter test uses the just-built grep. * tests/filename-lineno.pl (invalid-re-P-paren) (invalid-re-P-star-paren): Adjust non-PCRE case to match recently-changed behavior. build: update gnulib submodule to latest 2020-10-03 Paul Eggert <eggert@cs.ucla.edu> doc: document --include/--exclude better Problem reported by John Ruckstuhl (Bug#43782). * doc/grep.texi (File and Directory Selection): Document what happens if contradictory options are given, or if no option matches a file name. * doc/grep.in.1: 2020-10-01 Jim Meyering <meyering@fb.com> maint: add technically-required quotes * configure.ac: Quote args of AC_CONFIG_AUX_DIR, AC_CONFIG_SRCDIR and AC_CHECK_FUNCS_ONCE. 2020-09-28 Jim Meyering <meyering@fb.com> tests: restore deleted -P tests v3.4-almost-45-g8577dda deleted these two -P-using tests because a grep built without PCRE support would fail those tests. This sets an envvar with the equivalent of the result from the require_pcre_ function and restores the now-guarded tests. Tested by running this: ./configure --disable-perl-regexp && make check * tests/Makefile.am (PCRE_WORKS): Set this envvar. * tests/filename-lineno.pl: Restore invalid-re-P-paren and invalid-re-P-star-paren, now each with a guard. 2020-09-27 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.5 * NEWS: Record release date. maint: avoid autoconf warnings * configure.ac (AC_HEADER_STDC): Remove. It's been assumed for ages. * m4/pcre.m4 (gl_FUNC_PCRE): Use AS_HELP_STRING, not AC_HELP_STRING. build: update gnulib to latest 2020-09-26 Jim Meyering <meyering@fb.com> build: update gnulib to latest tests: skip stack-overflow test when built with ASAN * tests/stack-overflow: Skip this test when the binary was built with ASAN, to avoid spurious failures. 2020-09-25 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest build: update gnulib submodule to latest 2020-09-24 Jim Meyering <meyering@fb.com> tests: fix surrogate-pair test to work on 16-bit wchar_t systems * tests/surrogate-pair: Avoid new failure on systems with 16-bit wchar_t. Detect the condition and exit before the otherwise-failing tests. Remove the now-incorrect in-loop test for that alternate failure mode. This was exposed by testing on gcc119.fsffrance.org, a power8 AIX 7.2 system. 2020-09-23 Paul Eggert <eggert@cs.ucla.edu> grep: don't assume PCRE in tests * tests/filename-lineno.pl: Remove invalid-re-P-paren and invalid-re-P-star-paren as they assume PCRE support, which causes a false alarm "grep: Perl matching not supported in a --disable-perl-regexp build" on platforms without PCRE. grep: pacify Sun C 5.15 This suppresses a false alarm '"grep.c", line 720: warning: initializer will be sign-extended: -1'. * src/grep.c (uword_max): New static constant. (initialize_unibyte_mask): Use it. 2020-09-23 Paul Eggert <eggert@cs.ucla.edu> Norihiro Tanaka <noritnk@kcn.ne.jp> grep: fix more Turkish-eyes bugs Fix more bugs recently uncovered by Norihiro Tanaka (Bug#43577). * NEWS: Mention new bug report. * src/grep.c (ok_fold): New static var. (setup_ok_fold): New function. (fgrep_icase_charlen): Reject single-byte characters if they match some multibyte characters when ignoring case. This part of the patch is partly derived from <https://bugs.gnu.org/43577#14>, which means it is: (main): Call setup_ok_fold if ok_fold might be needed. * src/searchutils.c (kwsinit): With the grep.c changes, this code can now revert to classic 7th Edition Unix style; aborting would be wrong. * tests/turkish-eyes: Add tests for these bugs. 2020-09-23 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest * NEWS: Mention Bug#43577, which this fixes. grep: fix recently-introduced performance glitch * src/grep.c (main): Do not double-increment update_patterns. update_patterns increments n_patterns now; do not increment it again, as the incorrect count would hurt performance heuristics later. 2020-09-22 Paul Eggert <eggert@cs.ucla.edu> doc: improve --line-buffer doc * doc/grep.texi (Other Options): Document --line-buffered more carefully, and say what happens when it is not used. Problem reported by Dan Jacobson (Bug#35339). tests: port timeout test to Alpine Problem reported by Bruno Haible in: https://lists.gnu.org/r/grep-devel/2020-09/msg00080.html * tests/init.cfg (require_timeout_): Check that ‘timeout 0.01 sleep 0.02’ works as expected, to avoid spurious test failure on Alpine. 2020-09-22 Jim Meyering <meyering@fb.com> tests: test for many-regexp N^2 RSS regression * tests/many-regex-performance: New test for this performance regression. * tests/Makefile.am: Add it. * NEWS (Bug fixes): Describe it. 2020-09-22 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: avoid unnecessary regex compilation Grep resorts to using the regex engine when the precision of either -o or --color is required, or when the pattern is not supported by our DFA engine (e.g., backref). Otherwise, grep would perform regex compilation solely to check the syntax. This change makes grep skip that compilation in the common case for which it is unnecessary. The compilation we are avoiding is quite costly, consuming O(N^2) RSS for N regular expressions. * src/dfasearch.c (GEAcompile): Add new argument, and avoid unneeded compilation of regex. * src/grep.c (compile_fp_t): Update prototype. (main): Update caller. * src/kwsearch.c (Fcompile): Update caller and add new argument. * src/pcresearch.c (Pcompile): Add new argument. * src/search.h (GEAcompile, Fcompile, Pcompile): Update prototype. 2020-09-22 Jim Meyering <meyering@fb.com> build: update gnulib to latest tests: skip stack-overflow test on midnightbsd* * tests/stack-overflow: skip_ when run on this OS. See details in https://lists.gnu.org/r/grep-devel/2020-09/msg00062.html * tests/Makefile.am (host_triplet): Export. 2020-09-21 Paul Eggert <eggert@cs.ucla.edu> doc: say how to match chars by code From a suggestion in Bug#41004. * doc/grep.texi (Character Encoding, Matching Non-ASCII): New sections. Move some material from Environment Variables into these sections. 2020-09-18 Paul Eggert <eggert@cs.ucla.edu> * src/dfasearch.c (struct dfa_comp): Fix out-of-date comment. grep: "grep '\)'" reports an error again * src/grep.c (try_fgrep_pattern): With -G, pass \) through to GEAcompile so that it can complain. This fixes an unexpected change in behavior from grep 3.4 and earlier. * tests/filename-lineno.pl: Add tests for this sort of thing. grep: tweak by using mempcpy * src/grep.c (try_fgrep_pattern): Tweak previous change by using mempcpy. 2020-09-18 Jim Meyering <meyering@fb.com> grep: make echo .|grep '\.' match once again The same applied for many other backslash-escaped bytes, not just metacharacters. The switch to rawmemchr in v3.4-almost-10-g9393b97 made some parts of the code require the usually-guaranteed newline sentinel at the end of each pattern. Before, some consumers used a (correct) pattern length and did not care that try_fgrep_pattern could transform a pattern (with sentinel) like "\\.\n" to "..\n", thus violating that assumption. * src/grep.c (try_fgrep_pattern): Preserve the invariant that each regexp is newline-terminated. * tests/backslash-dot: New file. Test for this. * tests/Makefile.am (TESTS): Add it. tests: triple-backref: print a reference to glibc bug * tests/triple-backref (MALLOC_CHECK_): And tell glibc not to bother with a core dump. Suggested by Pádraig Brady. 2020-09-18 Paul Eggert <eggert@cs.ucla.edu> grep: be more consistent about diagnostic format * NEWS: Mention this. * bootstrap.conf (gnulib_modules): Remove 'quote'. * src/grep.c: Do not include quote.h. (grep, grepdirent, grepdesc): Put the three unusual diagnostics into the same "grep: FOO: message" form that grep uses elsewhere. * tests/binary-file-matches, tests/in-eq-out-infloop: Adjust tests to match new diagnostic format. 2020-09-17 Jim Meyering <meyering@fb.com> build: update gnulib to latest 2020-09-17 Paul Eggert <eggert@cs.ucla.edu> * tests/triple-backref: Add comment. 2020-09-17 Jim Meyering <meyering@fb.com> tests: make new test executable, to placate distcheck * tests/binary-file-matches: Make this executable. tests: add coverage for code that emits the new diagnostic * tests/binary-file-matches: New file. * tests/Makefile.am (TESTS): Add it. maint: avoid syntax-check failure * src/grep.c (grep): Lower-case the "B" in "Binary file... matches" diagnostic that we now emit to stderr. This avoids the following when running "make syntax-check": maint.mk: found capitalized error message make: *** [maint.mk:469: sc_error_message_uppercase] Error 1 2020-09-17 Paul Eggert <eggert@cs.ucla.edu> Send "Binary file FOO matches" to stderr * NEWS, doc/grep.texi: Mention this change (Bug#29668). * src/grep.c (grep): Send "Binary file FOO matches" to stderr instead of stdout. * tests/encoding-error, tests/invalid-multibyte-infloop: * tests/null-byte, tests/pcre-count, tests/surrogate-pair: * tests/symlink, tests/unibyte-binary: Adjust tests to match new behavior. In all cases this simplifies the tests, which is a good sign. Suppress "Binary file FOO matches" if -I Problem reported by Jason Franklin (Bug#33552). * NEWS: Mention this. * src/grep.c (grep): Do not output "Binary file FOO matches" if -I. * tests/encoding-error: Add test for this bug. 2020-09-15 Jim Meyering <meyering@fb.com> maint: keep two blank lines before each old Noteworthy line. * NEWS: Insert a blank line. 2020-09-15 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2020-09-13 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2020-09-12 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2020-09-11 Jim Meyering <meyering@fb.com> build: update gnulib to latest 2020-09-09 Paul Eggert <eggert@cs.ucla.edu> grep: fix logic for growing PCRE JIT stack * src/pcresearch.c (jit_exec) [PCRE_EXTRA_MATCH_LIMIT_RECURSION]: When growing the match_limit_recursion limit, do not use the old value if ! (flags & PCRE_EXTRA_MATCH_LIMIT_RECURSION), as it is uninitialized in that case. grep: fix PCRE JIT test when JIT not available Problem reported by Thomas Deutschmann (Bug#29446#23). * src/pcresearch.c (Pexecute): Diagnose PCRE_ERROR_RECURSIONLIMIT. * tests/pcre-jitstack: Treat recursion limit overflow like stack overflow. grep: fix -w bug in UTF-8 locales Problem reported by Mayo Fark (Bug#43225). * src/searchutils.c (wordchar_prev): In a UTF-8 locale, do not assume that an encoding-error byte cannot be part of a word constituent, as this assumption is incorrect for the last byte of a multibyte word constituent. * tests/word-delim-multibyte: Add a test for the bug. Distribute a gzip tarball again Requested by Issam E. Maghni in: https://lists.gnu.org/r/grep-devel/2020-09/msg00000.html * configure.ac (AM_INIT_AUTOMAKE): Remove no-dist-gzip. * README-prereq: Also mention xz. 2020-09-07 Paul Eggert <eggert@cs.ucla.edu> Prefer rawmemchr to memchr when it’s easy * bootstrap.conf (gnulib_modules): Add rawmemchr. * src/dfasearch.c (GEAcompile, EGexecute): * src/grep.c (update_patterns, prpending, prtext): * src/kwsearch.c (Fcompile, Fexecute): * src/pcresearch.c (Pcompile, Pexecute): Simplify (and presumably speed up a little) by using rawmemchr with a sentinel, instead of using memchr. Simplify pattern_file_name * src/grep.c (pattern_file_name): Make first argument origin-0, not origin-1, as this simplifies both caller and callee. All uses changed. Simplify regex_compile * src/dfasearch.c (regex_compile): "" suffices; we don’t need "\0". No need to initialize pat_lineno. Omit duplicate regexps Do not pass two copies of the same regexp to the regular-expression engine. Although the engines should perform nearly as well even with the copies, in practice they do not. Problem reported by Luca Borzacchiello (Bug#43040). * bootstrap.conf (gnulib_modules): Add hash. * src/grep.c: Include stdint.h, for SIZE_WIDTH. Include hash.h. (struct patloc, patloc, patlocs_allocated, patlocs_used): Rename from struct FL_pair, fl_pair, n_fl_pair_slots, n_pattern_files, respectively, since the data type is no longer a pair. All uses changed. (struct patloc): New member FILELINE. The lineno member is now ptrdiff_t since nowadays we prefer signed types. (pattern_array, patterns_table): New static vars. (count_nl_bytes, fl_add): Remove; no longer used. (hash_pattern, compare_patterns, update_patterns): New functions. update_patterns does what fl_add used to do, plus remove dups. (pattern_file_name): Adjust to change from fl_pair to patloc. (main): Move some variables to inner blocks for clarity. Maintain the pattern_table hash of all patterns. Update pattern_array to match keys, and use update_patterns instead of fl_add to remove duplicate keys. * tests/filename-lineno.pl (invalid-re-2-files) (invalid-re-2-files2, invalid-re-2e): Ensure regexps are unique in tests so that dups aren’t removed in diagnostics. (invalid-re-line-numbers): New test. 2020-08-23 Jim Meyering <meyering@fb.com> build: update gnulib to latest * gnulib: Update submodule to latest. * bootstrap.conf (gnulib_modules): Add explicit dependency on dirname-lgpl. Before, we pulled this in via a dependency. * bootstrap: Update from gnulib. build: require autoconf-2.64 * configure.ac: Require autoconf-2.64, up from 2.63, to align with gnulib. 2020-08-22 Paul Eggert <eggert@cs.ucla.edu> Revert -L exit status change introduced in grep 3.2 Problems reported by Antonio Diaz Diaz in: https://bugs.gnu.org/28105#29 * NEWS, doc/grep.texi (Exit Status), src/grep.c (usage): Adjust documentation accordingly. * src/grep.c (grepdesc, main): Go back to old behavior. * tests/skip-read: Adjust tests accordingly. 2020-01-20 Paul Eggert <eggert@cs.ucla.edu> tests: fix permission issue in previous change tests: work around GCC -fprofile-generate bug * tests/triple-backref: Add a 10 s timeout to work around what appears to be a GCC bug with -fprofile-generate. Problem reported by Martin LiÅ¡ka, with diagnosis by Andreas Schwab (Bug#21513). 2020-01-02 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.4 * NEWS: Record release date. build: update gnulib to latest, for mbrtowc-vs-Irix build fix 2020-01-02 Paul Eggert <eggert@cs.ucla.edu> doc: mention glibc bug 24269 * doc/grep.texi (Known Bugs): Mention glibc bug 24269. Merge formatting/URL changes from Gnulib regex.texi. doc: fix --exclude description in man page Problem reported by Duncan Moore (Bug#37212). * src/grep.c (usage): Fix incorrect statement about --exclude and directories. Standardize on “that match GLOB†instead of “matching GLOBâ€. doc: fix missing “more†in man page Problem reported by Philippe Schnoebelen (Bug#34078). * doc/grep.in.1: Add missing “moreâ€. 2020-01-01 Paul Eggert <eggert@cs.ucla.edu> doc: add [:blank:] to man page * doc/grep.in.1: Mention [:blank:] (Bug#33291). 2020-01-01 Jim Meyering <meyering@fb.com> maint: update all copyright year number ranges Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * doc/grep.in.1: Use "-" in copyright year ranges, not \en. 2019-12-31 Jim Meyering <meyering@fb.com> tests: avoid unwarranted failure in a netbsd 8.1 VM * tests/mb-non-UTF8-perf-Fw: Run twice, to avoid first-read penalty. Reported by Nelson H.F. Beebe. 2019-12-30 Jim Meyering <meyering@fb.com> build: update gnulib to latest (for localeinfo perf fix) maint: add syntax-check rule to prohibit "backreference" spelling * cfg.mk (sc_prohibit_backref): New rule. 2019-12-30 Paul Eggert <eggert@cs.ucla.edu> maint: remove too-long line from AUTHORS * AUTHORS: Remove URL that’s too long. maint: update AUTHORS * AUTHORS: Update to better reflect current authorship. 2019-12-30 Jim Meyering <meyering@fb.com> avoid new syntax-check failures * cfg.mk (old_NEWS_hash): Updating old news, we must also udpate this. 2019-12-30 Paul Eggert <eggert@cs.ucla.edu> doc: don’t encourage back-references * doc/grep.texi (Usage): Remove palindrome question. Bondioni’s RE makes grep issue a ‘grep: stack overflow’ diagnostic, and we shouldn’t be encouraging fancy back-references anyway, due to all the bugs in this area (Bug#26864). Plus, the allusion to “GNU extensions†doesn't seem to be correct here. doc: robustify some examples Prompted by suggestions by Stephane Chazelas (Bug#38792#20). * doc/grep.texi (Usage): Make examples more robust. doc: fix bug# typo doc: spell "back-reference" more consistently doc: mention back-reference bugs Inspired by Bug#26864. * doc/grep.texi (Known Bugs): New section. Mention back-reference issues. 2019-12-29 Paul Eggert <eggert@cs.ucla.edu> doc: Add -- to more-complex example Suggested by Stephane Chazelas (Bug#38792). * doc/grep.in.1, doc/grep.texi: Add ‘--’ to recently-added example. doc: improve subsection title (Bug#26132) * doc/grep.in.1: Rename "Matcher Selection" to "Pattern Syntax". doc: fix typo in previous patch doc: document quoting better Problem reported by Martin Simons (Bug#38792). * doc/grep.texi: Fix quoting used in examples. Say that patterns should be quoted, use quoting more consistently in examples, and give an example illustrating the difference between patterns and globbing. Don’t assume zgrep expertise in example. * doc/grep.in.1: Likewise. Also, reorder sections to match GNU/Linux man-pages style. 2019-12-26 Jim Meyering <meyering@fb.com> maint: tweak NEWS wording * NEWS: Minor wording change. build: update gnulib to latest; and sync tests/init.sh * gnulib: update * tests/init.sh: Sync from gnulib (this removes the LC_ALL=C setting). tests: avoid spurious failure due to 1-second timeout * tests/grep-dev-null-out: Use a 10-second timeout, rather than a 1-second one. This avoids false failure on slow systems. Reported by Assaf Gordon in https://lists.gnu.org/r/grep-devel/2019-12/msg00018.html 2019-12-26 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest maint: adjust surrogate-pair for 16-bit wchar_t * tests/surrogate-pair: Adjust to match fixed behavior on AIX 7.2, where wchar_t is 16 bits and cannot represent the test case data. 2019-12-25 Jim Meyering <meyering@fb.com> tests: fix typo in name of test file * tests/backslash-s-vs-invalid-multitype: Rename to... * tests/backslash-s-vs-invalid-multibyte: ...this. * tests/Makefile.am (TESTS): Reflect renaming. tests: ensure we use require_timeout_ when needed * cfg.mk (sc_timeout_prereq): New syntax-check rule. tests: require timeout * tests/mb-non-UTF8-perf-Fw: This test uses "timeout", so must first call require_timeout_. This avoids test spurious failure when running with no timeout program. Reported by Bruno Haible in https://lists.gnu.org/r/grep-devel/2019-12/msg00008.html 2019-12-25 Paul Eggert <eggert@cs.ucla.edu> tests: work around AIX 7.2 sh printf bug AIX 7.2 /bin/sh’s printf command mishandles octal escapes in multibyte locales: it treats them as characters, not bytes. * tests/backslash-s-vs-invalid-multitype, tests/encoding-error: Use the C locale when employing the printf command with an octal escape that AIX 7.2 sh might mishandle. * tests/init.sh (setup_): Use the C locale for tests. This has the side benefit of making them more reproducible. 2019-12-22 Jim Meyering <meyering@fb.com> maint: adjust new comments * src/dfasearch.c (possible_backrefs_in_pattern): Remove a duplicate "a", insert a "be" and a comma, and reformat. build: update gnulib to latest * gnulib: Update submodule to latest. * bootstrap: Copy from gnulib. * tests/init.sh: Likewise. 2019-12-22 Paul Eggert <eggert@cs.ucla.edu> grep: fix some bugs in pattern-grouping speedup This fixes some bugs in the previous commit, and should finish the fix for Bug#33249. * NEWS: Mention fix for Bug#33249. * src/dfasearch.c (possible_backrefs_in_pattern, regex_compile) (GEAcompile): In new code, prefer ptrdiff_t to size_t when either will do, since ptrdiff_t has better error checking. At some point we should adjust the old code too. (possible_backrefs_in_pattern): Rename from find_backref_in_pattern. New arg BS_SAFE. All uses changed. Fix false negative if a multibyte character ends in a single '\\' byte, followed by the two bytes '\\', '1'. (regex_compile): Simplify. (GEAcompile): Avoid quadratic behavior when reallocating growing buffers. Fix a couple of bugs in copying pattern data involving backreferences. Fix another bug in copying pattern metadata involving backreferences, by removing the need to copy it. 2019-12-22 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: grouping of a pattern with multiple lines When grep uses regex, it splits a pattern with multiple lines by newline character into fragments. Compilation and execution run for each fragment. That causes slowdown. By this change, each fragment is divided into groups by whether the fragment includes back references. A fragment with back references constitutes group, and all fragments that lack back references also constitute a group. This change extremely speeds-up following case. $ seq -f '%040g' 0 9999 | sed '1s/$/\\(0\\)\\1/' >pat $ yes 00000000000000000000000000000000000000000x | head -10000 >in $ time -p env LC_ALL=C src/grep -f pat in * src/dfasearch.c (find_backref_in_pattern, regex_compile): New functions. (GEAcompile): Use the new functions to group fragments as mentioned above. 2019-12-19 Paul Eggert <eggert@cs.ucla.edu> maint: add NEWS for Bug#34951 fix * NEWS: Mention Bug#34951. 2019-12-19 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: separate parse and compile phase DFAMUST() must be called after parse and before tokens re-order which is introduced in commit 5c7a0371823876cca7a1347fa09ca26bbbff0c98, but both are executed in compilation phase. * lib/dfa.c (dfaparse): Change it to global function. (dfacomp): If first argument is NULL, skip parse. * lib/dfa.h: (dfaparse): Add a prototype. 2019-12-19 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2019-12-19 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: speed up multiple word matching grep uses its KWset matcher for multiple word matching, but that is very slow when most of the parts matched to a pattern are not words. So, if the first match to a pattern is not a word, use the grep matcher to match for its line. Note that when START_PTR is set, the grep matcher uses the regex matcher which is very slow to match words. Therefore, we use the grep matcher when only START_PTR is NULL. * src/kwsearch.c (Fexecute): If an initial match is incomplete because not on a word boundary, use the grep matcher to find a matching line. 2019-12-18 Jim Meyering <meyering@fb.com> maint: sort test names * tests/Makefile.am (TESTS): Alphabetize the new addition, mb-non-UTF8-perf-Fw to placate syntax-check's sc_sorted_tests. 2019-12-18 Paul Eggert <eggert@cs.ucla.edu> maint: adjust to recent Gnulib change * po/POTFILES.in: Remove lib/xstrtol-error.c. 2019-12-17 Paul Eggert <eggert@cs.ucla.edu> grep: do not match invalid UTF-8 Update Gnulib to latest. Also: * src/dfasearch.c (EGexecute): Use ptrdiff_t, not size_t, to match new Gnulib API. * tests/Makefile.am (TESTS): Add dfa-invalid-utf8. * tests/dfa-invalid-utf8: New file. 2019-11-30 Jim Meyering <meyering@fb.com> tests: add test that would have detected -Fw perf regression * tests/mb-non-UTF8-perf-Fw: New file. Detect v3.3-22-g090a4db's performance regression. * tests/Makefile.am (TESTS): Add it. 2019-11-29 Jim Meyering <meyering@fb.com> maint: fix test comment * tests/mb-non-UTF8-word-boundary: Also correct "introduced-in" version number in a comment here. 2019-11-25 Jim Meyering <meyering@fb.com> maint: correct NEWS blurb * NEWS (Bug fixes): Correction: the -Fw bug was introduced in 2.28, not in 3.0. Reported by Paul Eggert. 2019-11-17 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: improve grep -Fw performance in non-UTF8 multibyte locales * src/searchutils.c (mb_goback): New parameter. All callers changed. * src/search.h (mb_goback): Update prototype. * src/kwsearch.c (Fexecute): Use mb_goback's MBCLEN to detect a word-boundary even more efficiently. grep: fix performance regression with previous patch * src/kwsearch.c (Fexecute): Avoid unnecessary back-up in non-UTF8 multibyte locales. 2019-11-16 Jim Meyering <meyering@fb.com> maint: rename a variable: bol -> nl * src/kwsearch.c (Fexecute): Change misleading name: s/bol/nl/ build: update gnulib to latest maint: correct and clarify a comment * src/kwsearch.c (Fexecute): Logic was reversed. grep: avoid false -Fw match in non-UTF8 multibyte locales For example, this command would erroneously print its input line: echo ab | LC_CTYPE=ja_JP.eucjp grep -Fw b This arose when the "memrchr" search for a preceding newline failed: in that case, MB_START was not adjusted and was initially the same as BEG, so wordchar_prev mistakenly returned 0. * src/kwsearch.c (Fexecute): Set MB_START also when there is no preceding newline. * NEWS (Bug fixes): Mention it. * tests/mb-non-UTF8-word-boundary: New file. Test for the bug. * tests/Makefile.am (TESTS): Add it. Reported by NIDE, Naoyuki in https://bugs.gnu.org/38223. 2019-11-08 Jim Meyering <meyering@fb.com> build: update gnulib to latest * po/POTFILES.in: Add lib/argmatch.h. 2019-11-05 Paul Eggert <eggert@cs.ucla.edu> grep: new --no-ignore-case option Suggested by Karl Berry and mostly implemented by Arnold Robbins (Bug#37907). * NEWS: * doc/grep.in.1: * doc/grep.texi (Matching Control): * src/grep.c (usage): Document the new option. * src/grep.c (NO_IGNORE_CASE_OPTION): New constant. (long_options, main): Support new option. grep: simplify previous patch * src/grep.c (main): Use an int rather than an enum for a local var, which is overkill here. grep: further simplify out_file handling * src/grep.c (print_filenames): Make this a local variable instead of static. Rename it to filename_option, to avoid confusion with the print_filename function, and rename the enum values for the same reason. All uses changed. (out_file): Now -1, 0, 1 to represent unknown, false, true. All uses changed. (single_command_line_arg): Remove. This static variable’s function is now accomplished by a local variable ‘num_operands’. (grepdesc): Simplify adjustment of out_file accordingly. (main): Initialize out_file to -1 if not known yet. 2019-11-05 Zev Weiss <zev@bewilderbeest.net> grep: simplify out_file handling * src/grep.c (print_filenames): New tristate enum (-H, -h, or neither); supplants with_filenames and no_filenames. (single_command_line_arg): New variable indicating if grep was run with a single command-line argument. (no_filenames): Remove variable. (grepdirent): Don't twiddle out_file back and forth during recursion. (grepdesc): Turn off out_file on 'grep -r foo nondirectory'. (main): Replace with_filenames and no_filenames with print_filenames. Enable out_file when both -r/-R and multiple arguments are given. 2019-10-12 Paul Eggert <eggert@cs.ucla.edu> grep: fix ‘grep -L ... >/dev/null’ bug Problem reported by Adam Sampson (Bug#37716). * NEWS: Mention this. * src/grep.c (grepdesc): Don’t assume that stdout being /dev/null means list_files == LISTFILES_NONE. (main): Do not change list_files merely because stdout is /dev/null. * tests/skip-read: Test for this bug. 2019-10-03 Paul Eggert <eggert@cs.ucla.edu> grep: tighten -i doc * doc/grep.in.1: * doc/grep.texi (Matching Control): * src/grep.c (usage): Make it clearer that -i affects patterns and data, but not file names (Bug#37604). 2019-03-10 Paul Eggert <eggert@cs.ucla.edu> maint: fix “/src/grep: No such file or directory†Problem reported by Jim Meyering in: https://lists.gnu.org/r/grep-devel/2019-02/msg00000.html * NEWS: Mention the change. * configure.ac (fn_grep): Remove. This old attempt to fix <https://savannah.gnu.org/bugs/?31646> wasn’t working anyway, since subprograms didn’t grok fn_grep. People building on Solaris will need a working grep, which is reasonably standard nowadays. (GREP, EGREP): Do not override. This way, we test the newly-built grep only when running ‘make test’ and suchlike. Instead, output a hopefully-helpful diagnostic if the system 'grep' does not work. 2019-02-18 Jim Meyering <meyering@fb.com> tests: avoid false positive upon stack overflow * tests/pcre-jitstack: Don't let a stack overflow evoke a false failure. This test is to ensure there is no internal PCRE error. Reported by Andreas Schwab in http://bugs.gnu.org/34370 2019-02-16 Jim Meyering <meyering@fb.com> build: avoid build failure with --enable-gcc-warnings * src/kwset.c (bmexec_trans): Define with _GL_ATTRIBUTE_PURE, per suggestion from recent gcc snapshot. 2019-02-03 Paul Eggert <eggert@cs.ucla.edu> doc: clarify --exclude globbing Problem reported by Paul Jackson. * doc/grep.in.1: * doc/grep.texi (File and Directory Selection): Clarify how --exclude globbing works. grep: parse --color arg independent of locale This is a better fix for Bug#34285. * bootstrap.conf (gnulib_modules): Add c-strcase. * src/grep.c: Include c-strcase.h, not strings.h. (main): Use c_strcasecmp, not strcasecmp. 2019-02-02 Paul Eggert <eggert@cs.ucla.edu> grep: fix grep.c includes * src/grep.c: Include strings.h; problem reported by David Monniaux (Bug#34285). Do not include fcntl.h, as system.h does that for us.h build: update gnulib submodule to latest 2019-01-20 Jim Meyering <meyering@fb.com> build: ensure no VLA is used Cause developer builds to fail for any use of a VLA. VLAs (variable length arrays) limit portability. * configure.ac (nw): Remove -Wvla from the list of disabled warnings, thus enabling the warning when configured with --enable-gcc-warnings. (GNULIB_NO_VLA) Define, disabling use of VLAs in gnulib. This commit is functionally equivalent to coreutils' v8.30-44-gd26dece5d. build: update gnulib to latest 2019-01-20 Paul Eggert <eggert@cs.ucla.edu> doc: --binary-files update in man page * doc/grep.in.1: Adjust --binary-files description to match that in doc/grep.texi. When I updated the documentation in 2016-09-09T01:33:14!eggert@cs.ucla.edu I forgot to update the man page accordingly (Bug#33898). grep: simplify pcresearch.c ifdefs This fixes a warning if PCRE is not used (Bug#34054). * configure.ac (USE_PCRE): New conditional. * src/Makefile.am (grep_SOURCES) [!USE_PCRE]: Omit pcresearch.c. * src/grep.c (matchers) [!HAVE_LIBPCRE]: Omit perl matcher. (setmatcher) [!HAVE_LIBPCRE]: If helpful, mention --disable-perl-regexp in diagnostic. * src/pcresearch.c: Simplify by assuming HAVE_LIBPCRE. 2019-01-01 Jim Meyering <meyering@fb.com> maint: update all copyright dates via "make update-copyright" * gnulib: Also update submodule for its copyright updates. 2018-12-20 Jim Meyering <meyering@fb.com> doc: fix the bug-introduced version in 3.3's announcement * NEWS: Correct bug-introduced version (s/2.3/3.2/). * cfg.mk (old_NEWS_hash): Updating old news, we must also udpate this. maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.3 * NEWS: Record release date. grep: fix \b DFA-bug in C locale Under some conditions, \b would mistakenly fail to match, e.g. echo 123-x|LC_ALL=C grep '.\bx' * NEWS (Bug fixes): Mention it * gnulib: Update to latest, for DFA regression fix. * tests/word-delim-multibyte: Add a test for the dfa.c regression. 2018-12-20 Paul Eggert <eggert@cs.ucla.edu> grep: fit --version authorship into 80 * src/grep.c (AUTHORS): Remove. (main): Output the authorship info ourselves instead of having version_etc do it. This is better for i18n anyway. build: update gnulib submodule to latest 2018-12-20 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.2 * NEWS: Record release date. 2018-12-18 Jim Meyering <meyering@fb.com> build: update gnulib for c-stack fix 2018-12-17 Bruno Haible <bruno@clisp.org> tests: stack-overflow: avoid unwarranted test failure on some hosts * tests/stack-overflow: Use ulimit to limit stack size. Otherwise, at least on gcc113, grep would fail to overflow its stack, so this test would fail to find the required diagnostic and would fail. 2018-12-16 Jim Meyering <meyering@fb.com> tests: reenable the surrogate-pair test This reverts commit bdb98cec2e7bf255e1d00eaf8be16299f7bf571e, but adding the comment changes suggested by Bruno Haible in https://lists.gnu.org/r/grep-devel/2018-12/msg00037.html * tests/surrogate-pair: New file. * tests/Makefile.am (TESTS): List it. 2018-12-16 Bruno Haible <bruno@clisp.org> tests: stackoverflow: fix test failure on HardenedBSD 11 * tests/stack-overflow: Try up to 10 million opening parentheses. 2018-12-16 Jim Meyering <meyering@fb.com> tests: remove stale surrogate-pair test The cygwin-specific code for surrogate pairs was first disconnected via v2.21-62-g936c904 and later removed as part of a then-unused function via v2.24-12-g704de87. So now I'm removing the test, too. If someone thinks it important and would like to revive it, please do. * tests/surrogate-pair: Remove file. * tests/Makefile.am (TESTS): Remove it. 2018-12-16 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2018-12-15 Jim Meyering <meyering@fb.com> tests: stack-overflow: handle the case of success without the diagnostic * tests/stack-overflow: Do not always require a stack overflow diagnostic. build: update gnulib to latest * gnulib: Update to latest, to pull in code that now compensates for a bug in glibc-2.27 and prior. build: make the autoconf-2.63 requirement explicit * configure.ac: AC_PREREQ: Require 2.63, not 2.59. And quote properly. Autoconf-2.63 has been required for some time via gnulib. This merely makes it explicit. 2018-12-15 Paul Eggert <eggert@cs.ucla.edu> tests: fix diagnostic typo Fix by Bruno Haible in: https://lists.gnu.org/r/grep-devel/2018-12/msg00003.html * tests/init.cfg (envvar_check_fail): Fix diagnostic. 2018-11-24 Jim Meyering <meyering@fb.com> tests: stack-overflow: avoid false failure * tests/stack-overflow: This test would fail to elicit a stack overflow diagnostic on some OS X systems. Rewrite to iterate, gradually increasing the size of the input regex, stopping when grep emits the desired diagnostic or the size reaches a reasonable limit. 2018-10-16 Jim Meyering <meyering@fb.com> tests: reduce the sole failing test * tests/backref-alt: Significantly reduce abort-inducing input. build: update gnulib to latest; also update bootstrap and init.sh 2018-10-13 Jim Meyering <meyering@fb.com> doc: NEWS: mention performance improvements * NEWS (Improvements): Mention them. 2018-10-13 Jim Meyering <meyering@fb.com> grep: triple initial buffer size: 32k->96k Changing 32k to 96k gives a 3-23% performance improvement. All timings ran with this diff on top of commit v3.1-39-g7179b21: for n in 32 64 96 128; do echo n=$n perl -pi -e 's/(INITIAL_BUFSIZE =) \d+/$1 '$n/ src/grep.c && make AM_CFLAGS=-O3 WERROR_CFLAGS= >& makerr-$n && for needle in 1f2 1f298lkjskjhahjklkj34; do echo " needle=$needle" for i in $(seq 10); do env MALLOC_PERTURB_= time -qf%e src/grep $needle w2000 done 2>&1 |sort -g | tee >(head -1|sed 's/^/ /') > .time-${n}KB-$needle done done Tested searchs: search for a short literal pattern that is not present in 9.3GB file containing 2000 copies of /usr/dict/words created via this: ln -s /usr/share/dict/words k && cat $(yes k|head -2000) > w2000 I ran this command: env MALLOC_PERTURB_= time src/grep 1f2 w2000 old(32k) vs new elapsed time, best of 10 trials (gcc-9.0.0 20180831, -O3): 32k 64k 96k(%incr) 128k CPU 1.25 1.18 1.16( 7.2) 1.20 i7-4770S@3.10GHz cache=8MB 1.21 1.16 1.17( 3.3) 1.19 Xeon(R) E3-1505M v5 @ 2.80GHz cache=8MB 2.36 2.29 2.29( 3.0) 2.36 Xeon(R) E5-2680 v4 @ 2.40GHz cache=32MB 1.40 1.32 1.31( 6.4) 1.33 i5-6260U @ 1.80GHz cache=4MB 1.31 1.26 1.24( 5.3) 1.23 AMD FX(tm)-4100 cache=2MB (with only 1000 copies) Searching for a longer string: 1f298lkjskjhahjklkj34 2.03 1.76 1.61(20.7) 1.53 i7-4770S@3.10GHz cache=8MB 1.95 1.70 1.56(20.0) 1.51 Xeon(R) E3-1505M v5 @ 2.80GHz 3.27 2.98 2.84(13.1) 3.02 Xeon(R) E5-2680 v4 @ 2.40GHz 2.48 2.12 1.91(23.0) 1.80 i5-6260U @ 1.80GHz cache=4MB 1.72 1.54 1.46(15.1) 1.41 AMD FX(tm)-4100 cache=2MB * src/grep.c (INITIAL_BUFSIZE): Triple it: 32kB -> 96kB 2018-09-28 Barret Rhoden <brho@cs.berkeley.edu> (tiny change) maint: fix cross-compiling problem * cfg.mk (PATH): Omit if cross-compiling (Bug#32866). 2018-09-28 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest grep: fix usage 80-column glitch * src/grep.c (usage): Do not go over 80 columns in the source code, to pacify "make dist". 2018-09-19 Paul Eggert <eggert@cs.ucla.edu> maint: update bootstrap * bootstrap: Copy from Gnulib. maint: fix build failure Problem found by OpenCSW buildbot; the bug also occurs on GNU/Linux build platforms. The symptom is “system.h:26:24: fatal error: configmake.h: No such file or directoryâ€. See: https://buildfarm.opencsw.org/buildbot/builders/ggrep-solaris10-sparc/builds/107 * bootstrap.conf: Add configmake, a dependency that was formerly brought in only by accident. 2018-09-18 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2018-08-09 Paul Eggert <eggert@cs.ucla.edu> tests: fix comment tests: backref-alt works with glibc 2.28 Problem reported by Jaroslav Skarvada (Bug#32409). * tests/Makefile.am (XFAIL_TESTS) [!USE_INCLUDED_REGEX]: Don’t add backref-alt, since this bug is fixed in glibc 2.28. 2018-05-11 Paul Eggert <eggert@cs.ucla.edu> doc: “pattern†vs “patterns†* doc/grep.in.1, doc/grep.texi, src/grep.c (usage): Be more careful about saying that an argument or option specifies one or more patterns, not just a single pattern. Problem reported by Kaz Kylheku (Bug#31400). build: update gnulib submodule to latest 2018-04-21 Jim Meyering <meyering@fb.com> maint: fix new syntax-check (sc_long_lines) failure * HACKING: Shorten line by one byte to fit in 80 columns. build: update gnulib to latest 2018-04-21 Paul Eggert <eggert@cs.ucla.edu> doc: fix font typo maint: update URLs Mostly this is just changing http: to https:. In one or two places it removes no-longer-useful URLs. doc: man-page format fixes * doc/grep.in.1: Fix minor formatting glitches, e.g., extra space after [...] because groff thought it was a sentence end. Problem reported by Ingo Schwarze (Bug#31228#11). 2018-04-20 Paul Eggert <eggert@cs.ucla.edu> doc: mention encoding errors This attempts to document the encoding-error problem more precisely (Bug#30326). * doc/grep.in.1, doc/grep.texi: Mention that the behavior of patterns like ‘.’ is not specified on encoding errors. doc: port better to mandoc * doc/grep.in.1: Check for groff and its macro packages independently, as groff can be used with non-groff macro packages. Use an-ext style macros rather than www.tmac style, as this should be more portable to mandoc. Problem reported by Laura Morales and Ingo Schwarze (Bug#31228). 2018-02-16 Jim Meyering <meyering@fb.com> maint: avoid new syntax-check failure * cfg.mk (old_NEWS_hash): Update, to accommodate v3.1-20-g63d4174's typo fix. doc: clarify that PCRE support is here to stay * doc/grep.texi (grep Programs): Clarify: it's not PCRE support that is experimental, but its combination with --null-data (-z). 2018-02-05 Paul Eggert <eggert@cs.ucla.edu> maint: fix typo 2018-01-06 Jim Meyering <meyering@fb.com> maint: update gnulib and copyright dates for 2018 * gnulib: Update to latest. * all files: Run "make update-copyright". * bootstrap: Update from gnulib. 2017-12-17 Jim Meyering <meyering@fb.com> build: link with -lsigsegv, when c-stack module requires it * src/Makefile.am (grep_LDADD): Add $(LIBCSTACK). Otherwise, on at least Debian and Arch-based systems, linking would fail with diagnostics like these: c-stack.c:207: undefined reference to `stackoverflow_install_handler' c-stack.c:216: undefined reference to `sigsegv_install_handler' Reported by Jeremy Feusi. build: suppress sig-handler.h's -Wcast-function-type warning * configure.ac (WERROR_CFLAGS): Add -Wno-cast-function-type to suppress warning about sig-handler.h's sa_handler_t cast: sig-handler.h: In function 'get_handler': sig-handler.h:47:12: error: cast between incompatible function\ types from 'void (* const)(int, siginfo_t *, void *)'\ {aka 'void (* const)(int, struct <anonymous> *, void *)'}\ to 'void (*)(int)' [-Werror=cast-function-type] return (sa_handler_t) a->sa_sigaction; 2017-12-16 Jim Meyering <meyering@fb.com> grep: diagnose stack overflow rather than segfaulting * bootstrap.conf (gnulib_modules): Add c-stack. * src/grep.c: Include "c-stack.h". (main): Call c_stack_action (NULL); * tests/stack-overflow: New file. * tests/Makefile.am (TESTS): Add name of new file. * NEWS (Improvements): Mention it. Interestingly, this bug does not afflict grep-2.5.4 or prior, so it appeared to have been introduced with grep-2.6. However, the origin is in glibc's regexp compiler, and I tracked it to stack-aware parsing that was removed from glibc's regexp in 2002. However, grep-2.5.4 was released in 2009. That version worked (and still works, now) because it included and (by default) used an old copy of glibc's regexp code. Jeremy Feusi reported the grep segfault in https://bugs.gnu.org/29666. I reported the glibc regexp bug in https://sourceware.org/bugzilla/show_bug.cgi?id=22620 2017-11-26 Stephan T. Lavavej <stl@nuwen.net> grep: fix directory recursion on MS-Windows gnulib recently gained a module, windows-stat-inodes, that fixes directory recursion on MS-Windows. No changes to grep's C sources are required; grep simply needs to request the module during configuration. When grep requests this module, its configure script will gain the behavior that was implemented in windows-stat-inodes.m4. This detects mingw and sets WINDOWS_STAT_INODES=1. All other platforms are unaffected, setting WINDOWS_STAT_INODES=0 (which is what's happening in the absence of this patch). * bootstrap.conf (gnulib_modules): Add windows-stat-inodes. * NEWS (Bug fixes): Mention it. Thanks to Pär Björklund who diagnosed the problem as involving inodes, and thanks to Václav Haisman who provided the bootstrap.conf patch. 2017-11-25 Paul Eggert <eggert@cs.ucla.edu> grep: port better to Adélie GNU/Linux 64-bit ppc Problem reported by A. Wilcox (Bug#29446). * src/pcresearch.c (PCRE_EXTRA_MATCH_LIMIT_RECURSION) (PCRE_STUDY_EXTRA_NEEDED): Default to 0. (jit_exec): If we run up against the recursion limit, double it (if possible) and try again. (Pcompile): Also specify PCRE_STUDY_EXTRA_NEEDED so that pc->extra is not null. 2017-11-03 Paul Eggert <eggert@cs.ucla.edu> grep: omit a dup 'const' * src/grep.c (matchers): Omit duplicate 'const'. 2017-10-13 Bernhard Voelker <mail@bernhard-voelker.de> doc: document the option delimiter '--' * doc/grep.texi (Other options): Do the above. Reported in https://lists.opensuse.org/opensuse/2017-03/msg00411.html This addresses http://bugs.gnu.org/26139 2017-08-21 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest Pacify GCC 5.4 * src/grep.c (grepdesc): Rework to pacify GCC 5.4 warning about logical not. 2017-08-20 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2017-08-17 Paul Eggert <eggert@cs.ucla.edu> grep: -L exits with status 0 if a file is selected Problem reported by Anthony Sottile (Bug#28105). * NEWS, doc/grep.texi (Exit Status), src/grep.c (usage): Document this. * src/grep.c (grepdesc): Implement it. * tests/skip-read: Test it. build: update gnulib submodule to latest 2017-08-13 Jim Meyering <meyering@fb.com> maint: avoid newly-introduced syntax-check failure * src/grep.c (usage): Shorten --help line to 80, so "make syntax-check" passes once again. 2017-08-03 Paul Eggert <eggert@cs.ucla.edu> doc: improve -o help * src/grep.c (usage): Document that -o outputs only nonempty matches (Bug#27931). 2017-07-26 Paul Eggert <eggert@cs.ucla.edu> tests: add Bug#27838 test case * tests/backref-alt: New test case from a fuzzer. 2017-07-25 Paul Eggert <eggert@cs.ucla.edu> doc: distinguish -w from \<...\> * doc/grep.texi (Matching Control): Give example of why -w differs from \<...\> (Bug#27813). 2017-07-11 Paul Eggert <eggert@cs.ucla.edu> doc: define Dt string in man page Problem reported by Bjarni I. Gislason via Santiago R.R. (Bug#27651). * doc/grep.in.1 (dT): New macro. (Dt): Define this string. 2017-07-02 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.1 * NEWS: Record release date. 2017-07-01 Jim Meyering <meyering@fb.com> tests: avoid false failures when run in qemu user mode * tests/filename-lineno.pl: Derive the program name that grep will use in diagnostics, based on a suggestion from Assaf Gordon. * tests/in-eq-out-infloop: Similar: accept an arbitrary "command_name: " prefix on checked diagnostics, rather than requiring "grep: ". * tests/reversed-range-endpoints: Likewise. * tests/write-error-msg: Likewise. Reported by Bruno Haible in http://bugs.gnu.org/27532 2017-06-25 Jim Meyering <meyering@fb.com> gnulib: update to latest * gnulib: Update to latest for these portability fixes: - stat: port to xlc 12.01 - xalloc-oversized: port to icc doc: fix another typo * doc/grep.texi (File and Directory Selection): Fix typo: s/afer/after/ 2017-06-24 Jim Meyering <meyering@fb.com> doc: stop calling --perl-regexp (-P) "highly" experimental Use wording that is less likely to make readers think that support for -P may be removed. * doc/grep.in.1: s/highly experimental/experimental/ * doc/grep.texi: Likewise. Suggested by Evan Sheahan. 2017-06-21 Jim Meyering <meyering@fb.com> doc: correct typo * doc/grep.texi (Performance): s/suprisingly/surprisingly/ gnulib: update to latest 2017-06-21 Paul Eggert <eggert@cs.ucla.edu> grep: -m no longer cuts off trailing context Problem reported by Markus Jochim (Bug#26254). * NEWS, doc/grep.texi (General Output Control): Document this. * src/grep.c (prpending): Selected lines no longer cut off context. (usage): Say "selected" instead of "matching", where appropriate. * tests/foad1, tests/max-count-vs-context, tests/yesno: Adjust to match new behavior. 2017-05-31 Paul Eggert <eggert@cs.ucla.edu> Document grep performance * doc/grep.texi (Performance): New section. build: update gnulib submodule to latest 2017-05-21 Jim Meyering <meyering@fb.com> maint: make the announcement template Cc the devel- list * cfg.mk (announcement_Cc_): Define. gnulib: update to latest; and update tests/init.sh maint: accommodate GCC7's -Werror=duplicated-branches * src/system.h (IGNORE_DUPLICATE_BRANCH_WARNING): Define. * src/grep.c (grepfile): Use it. * src/kwset.c (bmexec, acexec): Use it. maint: update to work with GCC7's -Werror=implicit-fallthrough= * src/system.h (FALLTHROUGH): Define. * src/grep.c (context_length_arg): Use new FALLTHROUGH macro in place of comments (fgrep_to_grep_pattern, try_fgrep_pattern, main): Likewise. 2017-05-13 Jim Meyering <meyering@fb.com> gnulib: update to latest and adapt src/kwset.c * gnulib: Update to latest. * src/kwset.c: Include "verify.h" for use of assume. 2017-03-22 Jim Meyering <meyering@fb.com> gnulib: update to latest for dfa [0-9] performance improvement This pulls in the following change that is very relevant to grep: commit 6afba02d7869d39ed7f61981045ddbdcb2814101 Author: Paul Eggert <eggert@cs.ucla.edu> dfa: make [0-9] faster in non-C locales * gnulib: Update to latest. * NEWS (Improvements): Describe the effect on grep. 2017-03-05 Jim Meyering <meyering@fb.com> build: use $(builddir), not $(srcdir) * cfg.mk (PATH): Use $(builddir), so this also takes effect in a non-srcdir build. Also, switch ${PATH} syntax to $(PATH). 2017-03-05 Juan Manuel Guerrero <juan.guerrero@gmx.de> build: use $(PATH_SEPARATOR), not ":" to augment PATH * cfg.mk (PATH): Use $(PATH_SEPARATOR), for those systems that use something other than ":". * THANKS.in: Remove name, to avoid syntax-check failure due to the duplicate, now that there is this commit. 2017-02-17 Jim Meyering <meyering@fb.com> maint: fix distcheck failure: remove stale dosbuf.c reference * src/Makefile.am (EXTRA_DIST): Do not attempt to distribute the recently deleted file, dosbuf.c. maint: fix new syntax-check errors * po/POTFILES.in: Add lib/xbinary-io.c. * cfg.mk (FILTER_LONG_LINES): Add TODO to the list of exempt files. 2017-02-16 Paul Eggert <eggert@cs.ucla.edu> Fix up recent -U patches Inspired by a suggestion by Eric Blake (Bug#25707#17). * bootstrap.conf (gnulib_modules): Add xbinary-io, and remove binary-io and xfreopen. * doc/grep.texi (Other Options): Fix typo and reword to be a bit more general. * src/grep.c: Include xbinary-io.h instead of xfreopen.h. (grepfile): Open with O_BINARY if binary. (grepdesc): No need for set_binary_mode now. (grep_command_line_arg, main): Set stdin to binary mode if binary. (main): Avoid unnecessary test of stdin == NULL. Use xsetmode instead of xfreopen. * src/system.h: Do not include binary-io.h. build: update gnulib submodule to latest Simplify -U on MS-Windows by removing guesswork Suggested by Eric Blake (Bug#25707#11). * NEWS, doc/grep.texi: Document this. * src/dosbuf.c: Remove. * bootstrap.conf (gnulib_modules): Add xfreopen. * src/grep.c: Include xfreopen.h, not dosbuf.c. (fillbuf, print_line_head): Do not undossify input. (binary): New static var. (grepdesc): Apply BINARY to input file. (usage): Remove -u help. (main): Set BINARY if -U, and apply it to stdout. Do nothing if -u. With -f, apply BINARY to input file. 2017-02-16 Eric Blake <eblake@redhat.com> grep: don't forcefully strip carriage returns Commit 5c92a54 made the mistaken assumption that using fopen("rt") on platforms where O_TEXT is non-zero makes sense. However, POSIX already requires fopen("r") to open a file in text mode, vs. fopen("rb") when binary mode is wanted, and at least on Cygwin, where it is possible to control whether a mount point is binary or text by default (using just "r"), the use of fopen("rt") actively breaks assumptions on a binary mount by silently corrupting any carriage returns that are supposed to be preserved. * src/grep.c (main): Never use fopen("rt") (Bug#25707). 2017-02-13 Paul Eggert <eggert@cs.ucla.edu> Update TODO and doc * TODO: Bring up-to-date and fix formatting glitches. * doc/grep.in.1, doc/grep.texi: Fix minor glitches. The above patches should address the same problems that recent Debian doc patches address, albeit in a different way. 2017-02-12 Paul Eggert <eggert@cs.ucla.edu> doc: clarify default input (Bug#25651) * doc/grep.in.1: * src/grep.c (usage): Clarify default input when -r. * src/grep.c (usage): Do not bother documenting egrep and fgrep; the manual is enough. 2017-02-09 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.0 * NEWS: Record release date. 2017-02-08 Paul Eggert <eggert@cs.ucla.edu> grep: do not mishandle \. in multiple patterns Problem reported by Lars Wendler (Bug#25655). * NEWS: Document this. * src/grep.c (try_fgrep_pattern): Fix typo that prevented keys from being properly updated. * tests/foad1: Test for the bug. 2017-02-07 Paul Eggert <eggert@cs.ucla.edu> Do not assume PCRE 8.20 or later Problem reported by Zube (Bug#25647) * NEWS: Document this. * src/pcresearch.c (struct pcre.com.jit_stack): Declare only if PCRE_STUDY_JIT_COMPILE. 2017-02-06 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.28 * NEWS: Record release date. 2017-02-02 Jim Meyering <meyering@fb.com> gnulib: update to latest 2017-02-01 Paul Eggert <eggert@cs.ucla.edu> grep: tune to avoid memchr2 sometimes Problem noted by Norihiro Tanaka in: http://lists.gnu.org/archive/html/grep-devel/2017-01/msg00027.html Although not enough to restore all the previous performance in the case he noted, it helps significantly. * src/kwset.c (memchr_kwset): Bring back small_heuristic, in a somewhat different form. 2017-01-29 Jim Meyering <meyering@fb.com> gnulib: update to latest 2017-01-23 Paul Eggert <eggert@cs.ucla.edu> grep: simplify recent kwset change * src/kwset.c (acexec_trans): Simplify. 2017-01-23 Jim Meyering <meyering@fb.com> tests: really add the new test name * tests/Makefile.am (TESTS): Add fgrep-longest. 2017-01-21 Norihiro Tanaka <noritnk@kcn.ne.jp> grep -Fo could report a match that is not the longest * src/kwset.c (acexec): Fix it. * tests/fgrep-longest: New test. * tests/Makefile.am: Add the test. * NEWS: Mention it. 2017-01-18 Paul Eggert <eggert@cs.ucla.edu> grep: speed up Aho-Corasick when at most 2 bytes When using Aho-Corasick and all matched strings either begin with the same byte, or begin with one of at most two bytes, use memchr2 to search for these matching bytes and apply the Aho-Corasick algorithm only when a memchr2 match is found. On my platform, this speeds up 'grep -F -e aa -e ba in' by a factor of 7, where the file 'in' was created by 'seq -f %040.0f 10000000 >in'. * src/kwset.c (struct kwset.gc1): Now int, not char. If negative, there is no single terminal byte. All uses changed. (struct kwset.gc1help): Now int, not char. If negative, memchr2 cannot be used. (kwsprep): Set up gc1 and gc1help from kwset->next, with the new (slightly changed) interpretation. (memchr_kwset): Use memchr2 if possible. Adjust to match new meaning of gc1, gc1help. (memoff2_kwset): Remove; no longer needed. (acexec_trans): Use memchr_kwset when possible, for speed. It now supersedes memoff2_kwset. grep: remove Commentz-Walter code This code was not being used, and complicated maintenance. We can bring it back from the repository if it turns out to be useful later. * src/kwset.c (struct kwset.reverse): Remove. All uses of FOO->reverse replaced by (FOO->kwsexec == bmexec). (kwsalloc): Remove 'reverse' arg, as callers outside this module do not care about algorithm choice. All callers changed. (kwsprep): When deciding whether to use Boyer-Moore, do not worry about being called twice on the same kwset, as that is not allowed. (cwexec): Remove; it was never called. All uses removed. 2017-01-17 Jim Meyering <meyering@fb.com> maint: avoid new syntax-check failures * src/kwset.c (struct kwset): Split a line longer than 80. * bootstrap: Update from gnulib. This fixes a new syntax-check failure due to its use of "time stamp". 2017-01-17 Paul Eggert <eggert@cs.ucla.edu> * NEWS: Fix typo. * src/kwset.c: Fix comment typo. Improve -i performance in typical UTF-8 searches Currently ‘grep -i i’ is slow in a UTF-8 locale, because ‘i’ in the pattern matches the two-byte character 'ı' (U+0131, LATIN SMALL LETTER DOTLESS I) in data, and kwset handles only single-byte character translations, so grep falls back on a slower DFA-based search for all searches. Improve -i performance in the typical case by using kwset when data are free of troublesome characters like 'ı', falling back on the DFA only when data contain troublesome characters. * src/dfasearch.c (GEAcompile): * src/grep.c (compile_fp_t): * src/kwsearch.c (Fcompile): * src/pcresearch.c (Pcompile): Pattern arg is now char *, not char const *, since Fcompile now reallocates it sometimes. * src/grep.c (all_single_byte_after_folding): Remove. All callers removed. (fgrep_icase_charlen): New function. (fgrep_icase_available, try_fgrep_pattern): Use it, for more-generous semantics. (fgrep_to_grep_pattern): Now extern. (main): Do not free keys, since Fexecute may use them. * src/kwsearch.c (struct kwsearch): New struct. (Fcompile): Return it. If -i, be more generous about patterns. (Fexecute): Use it. Fall back on DFA when the data contain troublesome characters; this should be rare in practice. * src/kwset.c, src/kwset.h (kwswords): New function. build: update gnulib submodule to latest 2017-01-15 Paul Eggert <eggert@cs.ucla.edu> dfa: prefer ptrdiff_t to size_t The code already cannot handle objects with size greater than SIZE_MAX / 2, so be more honest about it and use ptrdiff_t instead of size_t. ptrdiff_t arithmetic is signed, which allows for more checking via -fsanitize=undefined. It also makes the code a tad smaller on x86-64, since it can test for < 0 rather than for == SIZE_MAX. * src/dfasearch.c (struct dfa_comp.kwset_exact_matches): (kwsmusts, EGexecute): * src/kwsearch.c (Fcompile, Fexecute): * src/kwset.c (struct kwset.kwsexec, kwsincr, memchr_kwset) (memoff2_kwset, bmexec_trans, bmexec, cwexec, acexec_trans) (acexec, kwsexec): * src/kwset.h (struct kwsmatch.index, .offset, .size): Prefer ptrdiff_t to size_t where either will do. 2017-01-11 Paul Eggert <eggert@cs.ucla.edu> grep: improve comments, mostly in kwset Remove kwset.h comments that are obsolete and seemingly not maintained anyway; people can look in kwset.c instead. Update comments to reflect current behavior better. Cite Faro & Lecroq 2013. Use GNU style for end-of-sentence. 2017-01-01 Jim Meyering <meyering@fb.com> maint: update gnulib and copyright dates for 2017 * gnulib: Update to latest. * all files: Run "make update-copyright". 2016-12-31 Paul Eggert <eggert@cs.ucla.edu> grep: speed up -x with many patterns * src/kwsearch.c (Fcompile): Improve buffer allocation overhead with -x and multiple patterns. In the common case where '\n' is the end-of-line byte, avoid copying other than the first and last patterns. 2016-12-31 Jim Meyering <meyering@fb.com> gnulib: update to latest, fixing a parallel getopt test failure 2016-12-29 Paul Eggert <eggert@cs.ucla.edu> maint: space before paren grep: int cleanup in kwset.c This should affect only theoretical bugs with very large inputs. On my platform, this patch shrinks the grep text by 136 bytes. * src/kwset.c: Include intprops.h, for INT_MULTIPLY_WRAPV. (struct trie, struct kwset, kwsalloc, kwsincr, treedelta, kwsprep) (bm_delta2_search, bmexec_trans, cwexec): Prefer ptrdiff_t to int when counts can exceed INT_MAX in large inputs, at least in theory. (hasevery): Use bool for booleans. (bmexec_trans): Avoid undefined behavior on integer overflow. 2016-12-27 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: improve performance with multiple patterns * src/grep.c (main): Avoid fgrep-to-grep conversion for word matching with multiple patterns in single byte locales. 2016-12-27 Paul Eggert <eggert@cs.ucla.edu> * NEWS: Fix typo. grep: fix bug with '... | grep pat >> /dev/null' Problem reported by Benno Fünfstück (Bug#25283). * NEWS: Document this. * src/grep.c (drain_input) [SPLICE_F_MOVE]: Don't assume /dev/null is always acceptable output to splice. * tests/grep-dev-null-out: Test for the bug. 2016-12-26 Paul Eggert <eggert@cs.ucla.edu> grep: minor performance tweak for pure functions * src/search.h (wordchars_size, wordchar_next, wordchar_prev): Declare to be pure. 2016-12-25 Zev Weiss <zev@bewilderbeest.net> grep: move localeinfo to grep.c It's not really dfasearch-specific, and grep.c initializes it, so it seems like the most appropriate "owner". * src/dfasearch.c (localeinfo): Remove. * src/grep.c (localeinfo): Add. * src/search.h (localeinfo): Move to new commented section. 2016-12-25 Zev Weiss <zev@bewilderbeest.net> pcresearch: thread safety * src/pcresearch.c (pcre_comp): New struct to hold previously-global state. (jit_exec): Operate on a pcre_comp parameter instead of global state. (Pcompile): Allocate and return a pcre_comp instead of setting global variables. (Pexecute): Operate on a pcre_comp parameter instead of global state. kwsearch: thread safety * src/kwsearch.c (Fcompile): Return a kwset_t instead of setting a global variable. (Fexecute): Use a passed-in kwset_t instead of a global variable. (kwset): Remove global variable. dfasearch: thread safety * src/dfasearch.c (struct dfa_comp): New struct to hold previously-global variables. (dfawarn): Remove static variable. (kwsmusts): Operate on a dfa_comp parameter instead of global variables. (GEAcompile): Allocate and return a dfa_comp struct instead of setting global variables. (EGexecute): Operate on a dfa_comp parameter instead of global variables. * src/searchutils.c (kwsinit): Replace a static array with a dynamically-allocated one. 2016-12-25 Zev Weiss <zev@bewilderbeest.net> grep: prepare search backends for thread-safety To facilitate removing mutable global state from search backends, compile() functions will return an opaque pointer to backend-specific data, which must then be passed back into the corresponding execute() function. This is merely a preparatory step changing function signatures and call sites, so the pointers passed & returned are dummies for now and not (yet) actually used. * src/grep.c (compile_fp_t): Now returns an opaque pointer (the compiled pattern). (execute_fp_t): Now passed the pointer returned by a compile_fp_t. All call sites updated accordingly. (compiled_pattern): New static variable. * src/dfasearch.c (GEAcompile): Return a void pointer (dummy NULL). (EGexecute): Receive a void pointer argument (unused). * src/kwsearch.c (Fcompile): Return a void pointer (dummy NULL). (Fexecute): Receive a void pointer argument (unused). * src/pcresearch.c (Pcompile): Return a void pointer (dummy NULL). (Pexecute): Receive a void pointer argument (unused). * src/search.h: Update compile/execute function prototypes. 2016-12-24 Jim Meyering <meyering@fb.com> maint: fix "syntax-check" failure * src/grep.c (SEP_STR_GROUP): Declare "static". 2016-12-23 Paul Eggert <eggert@cs.ucla.edu> grep: fix comment in searchutils.c grep: improve word checking with UTF-8 * src/searchutils.c: Do not include <verify.h>. (word_start): Remove, replacing with ... (sbwordchar): New static var. All uses changed. (wordchar_prev): Return size_t, not bool, as this generates slightly better code. Go back faster if UTF-8. grep: standardize on localeinfo.multibyte * src/dfasearch.c (EGexecute): * src/grep.c (main): * src/kwsearch.c (Fexecute): * src/pcresearch.c (Pcompile): Prefer localeinfo.multibyte to (MB_CUR_MAX > 1). grep: speed up -wf in C locale Problem reported by Norihiro Tanaka (Bug#22357#100). This patch improves the performance on that benchmark on my platform so that grep is now only about 2x slower than grep 2.26, which means it is considerably faster than grep 2.25 and earlier. * src/kwsearch.c (Fexecute): Use wordchars_size to boost performance for this case. * src/search.h, src/searchutils.c (wordchars_size): New function. grep: specialize word-finding functions This improves performance a bit. * src/dfasearch.c, src/kwsearch.c (wordchar): Remove; now in searchutils.c. * src/grep.c (main): Call wordinit if -w. * src/search.h: Adjust. * src/searchutils.c: Include verify.h. (word_start): New static var. (wordchar): Move here from dfasearch.c and kwsearch.c. (wordinit, wordchars_count, wordchar_next, wordchar_prev): New functions. (mb_prev_wc, mb_next_wc): Remove. All callers changed to use the new functions instead. grep: simplify Fexecute * src/kwsearch.c (Fexecute): Avoid the need for a 'try' local or for a 'goto success'. Update mb_start to reflect newline found. grep: remove C label * src/kwsearch.c (Fexecute): Remove label. maint: rewrite to avoid some macros These days, the dangerous powers of C macros are not needed if constants or functions will do just as well. * src/grep.c (SEP_CHAR_SELECTED, SEP_CHAR_REJECTED, SEP_STR_GROUP) (INITIAL_BUFSIZE): * src/kwset.c (DEPTH_SIZE): Now constants, not macros. * src/kwset.c (link): Remove macro. Instead, rename local vars from 'link' to 'cur'. (malloc) [GREP]: Remove macro. All uses of malloc changed to xmalloc. Omit double-inclusion of xalloc.h. Do not depend on 'GREP'. (U): Now a function, not a macro. * src/kwset.c, src/searchutils.c (NCHAR): Move this macro to ... * src/system.h: ... here, and make it a constant. 2016-12-20 Paul Eggert <eggert@cs.ucla.edu> grep: fix performance with multiple patterns Problem reported by Jaroslav Skarvada (Bug#22357). * NEWS: Document this and other recent performance fixes. * src/grep.c (E_MATCHER_INDEX): New constant. (all_single_byte_after_folding): New function, split out from fgrep_icase_available. (fgrep_icase_available): Use it. (try_fgrep_pattern): New function, which also uses it. (main): With two or more patterns, use try_fgrep_pattern to fix performance regression. The number "two" here is just a heuristic. grep: simplify matcher configuration * src/grep.c (matcher, compile): Remove static vars. (compile_fp_t): Now takes a 3rd syntax argument. (Gcomppile, Ecompile, Acompile, GAcompile, PAcompile): Remove. (struct matcher): Now nameless, since it is used only once. Make 'name' a bit shorter. New member 'syntax'. (matchers): Initialize it, and change removed functions to GEAcompile. (F_MATCHER_INDEX, G_MATCHER_INDEX): New constants. (setmatcher): New arg MATCHER, and return new matcher index. Avoid unnecessary call to strcmp. (main): Keep matcher as a local int, not a global pointer. * src/kwsearch.c (Fcompile): * src/pcresearch.c (Pcompile): Ignore the 3rd syntax argument. grep: simplify line counting in patterns * src/grep.c (n_patterns): Rename from patfile_lineno, as it is now origin-zero. Now size_t, not uintmax_t. (count_nl_bytes, fl_add): Simplify to just buffer and size. All callers changed. 2016-12-19 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2016-12-18 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest build: update gnulib submodule to latest 2016-12-13 Jim Meyering <meyering@fb.com> tests: use just-built grep in more places * cfg.mk (PATH): Prepend $(srcdir)/src, so that we use the just- built grep also when running commands like those of "make distcheck". This would have avoided the recently-luckily-noticed infloop bug. Tested by running this in a just-built directory: f=src/grep; printf '%s\n' '#!/bin/sh' 'sleep 9h' > $f; chmod a+x $f and then verifying that nearly every "make syntax-check" rule hangs. maint: tell "syntax-check" not to worry about the NEWS update Whenever we change "old" NEWS, we have to update this checksum. Otherwise, a "make syntax-check" test that guards against a class of logical merge conflicts will fail. * cfg.mk (old_NEWS_hash): Update this hash to accommodate the recent clarification of a 2.27 NEWS entry. 2016-12-13 Arnold D. Robbins <arnold@skeeve.com> build: update gnulib submodule to latest * src/dfasearch.c (GEAcompile): Remove use of flag, RE_ICASE covers it. 2016-12-12 Paul Eggert <eggert@cs.ucla.edu> grep: work around proc lseek glitch Problem reported by Andreas Schwab (Bug#25180). * NEWS: Document this. * src/grep.c (finalize_input): Ignore EINVAL lseek failures. * tests/Makefile.am (TESTS): Add proc. * tests/proc: New file. 2016-12-07 Paul Eggert <eggert@cs.ucla.edu> grep: simplify finalize_input * src/grep.c (finalize_input): Simplify without changing behavior. It's still a bit of a rat's-nest, but it's a cozier rat's-nest. maint: clarify early-exit news for 2.27 * NEWS: Mention early-exit options to avoid confusion. See: http://lists.gnu.org/archive/html/grep-devel/2016-12/msg00007.html 2016-12-06 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.27 * NEWS: Record release date. 2016-11-29 Jim Meyering <meyering@fb.com> grep: fix DFA-induced infloop * gnulib: Update to latest, for the DFA infloop fix. * tests/dfa-infloop: New test, to trigger an infinite loop in the DFA matcher. * tests/Makefile.am (TESTS): Add it. 2016-11-28 Jim Meyering <meyering@fb.com> tests: use "returns_ N env VAR=val ..." rather than "VAR=val returns_ N ..." Some shells do not propagate envvar settings through our use of the "returns_" function, so set any envvar via use of "env". This was an issue at least on Ubuntu and Debian-based systems, presumably due to their common use of "dash" as /bin/sh. Reported by Assaf Gordon. * tests/char-class-multibyte: As above. * tests/euc-mb: Likewise. * tests/false-match-mb-non-utf8: Likewise. * tests/pcre-infloop: Likewise. * tests/pcre-jitstack: Likewise. * tests/sjis-mb: Likewise. * tests/warn-char-classes: Likewise. 2016-11-28 Paul Eggert <eggert@cs.ucla.edu> tests: revert check for unibyte French range bug The test wasn't portable, as it assumed that rational ranges were not in effect. Problem reported by Eric Blake (Bug#25048#8). There doesn't seem to be a portable way to do the test, so omit it. * tests/init.cfg, tests/unibyte-bracket-expr: Revert previous change. build: update gnulib submodule to latest 2016-11-27 Jim Meyering <meyering@fb.com> grep: avoid false matches in non-UTF8 multibyte locales * gnulib: Update to latest, for the dfa.c fix. * NEWS (Bug fixes): Mention it. * tests/false-match-mb-non-utf8: New file, with tests for this. Based on tests from Stephane Chazelas. * tests/Makefile.am (TESTS): Add it. Introduced by commit v2.18-54-g3ef4c8e, a change that made grep use its DFA matcher more aggressively. The malfunction arises only with the DFA matcher, not with regex. Reported by Stephane Chazelas in https://bugs.gnu.org/24975 2016-11-20 Paul Eggert <eggert@cs.ucla.edu> tests: check for unibyte French range bug Problem reported by Stephane Chazelas (Bug#24973). This bug was fixed in Gnulib. * NEWS: Document the fix. * tests/init.cfg (require_ru_RU_koi8_r): Remove. * tests/unibyte-bracket-expr: Add a test for the bug. Call get-mb-cur-max directly instead of bothering with require_ru_RU_koi8_r. build: update gnulib submodule to latest 2016-11-19 Paul Eggert <eggert@cs.ucla.edu> grep: further -P performance fix Problem reported by Stephane Chazelas in: http://bugs.gnu.org/22655#103 * src/pcresearch.c (Pexecute): Set the subject to the start of each line as it is found. grep: -P no longer uses PCRE_MULTILINE This reverts commit f6603c4e1e04dbb87a7232c4b44acc6afdf65fef, as the extra performance is not worth the trouble for PCRE users. Problem reported by Stephane Chazelas in: http://bugs.gnu.org/22655#103 * NEWS: Document this and the next patch. * src/dfasearch.c (EGexecute): * src/grep.c (execute_fp_t): * src/kwsearch.c (Fexecute): * src/pcresearch.c (Pexecute): First arg is now a const pointer again. * src/grep.c (buf_has_encoding_errors): Now static. * src/grep.h (buf_has_encoding_errors): Remove decl. * src/search.h: Adjust decls. * src/pcresearch.c (reflags): Remove. All uses removed. (Pcompile, Pexecute): Do not use PCRE_MULTILINE. 2016-11-19 Jim Meyering <meyering@fb.com> doc: fix a doubled "the" * doc/grep.texi (--perl-regexp): s/the\nthe/the/ 2016-11-19 Paul Eggert <eggert@cs.ucla.edu> grep: fix -zxP bug * NEWS: Document this. * src/pcresearch.c (Pcompile): Search a line at a time if -x is used, since -x uses ^ and $. * tests/pcre: Test this. grep: simplify by using PRIuMAX * configure.ac (HAVE_PRINTF_C99_SIZES): Remove; no longer needed. * src/grep.c (print_offset): Simplify (Bug#24451). grep: -T now adjusts number widths for worst case * NEWS, doc/grep.texi (Output Line Prefix Control): Document this (Bug#24451). * src/grep.c (offset_width): New static var. (print_offset): Use it instead of arg. All callers changed. (grep): Set it. * tests/initial-tab: Test this. grep: -T no longer outputs BS * NEWS: Document this (Bug#24451). * src/grep.c (print_line_head): Do not attempt to backspace output. * tests/initial-tab: New test. * tests/Makefile.am (TESTS): Add it. grep: document -oz better * doc/grep.texi (General Output Control, Usage): Tweak (Bug#24961). grep: fix performance typo with -P Reported by Zev Weiss in: http://bugs.gnu.org/22655#88 * src/pcresearch.c (Pcompile): Initialize reflags. tests: use "returns_" rather than "$?" * tests/grep-dev-null-out: Use "returns_ 124" rather than testing $? = 124. grep -f /dev/null -L PAT FILE outputs FILE * NEWS: Document this. * src/grep.c (main): Do not exit right away with -L. * tests/skip-read: Test for the fix. grep: tune -f /dev/null * src/grep.c (main): Do the -f /dev/null early-exit checks before more-expensive tests that involve syscalls. grep: treat -f /dev/null like -m0 * NEWS: Document this. * src/grep.c (main): With -f /dev/null, don't bother to read the input. This is what FreeBSD grep does. * tests/Makefile.am (TESTS): Add skip-read. * tests/skip-read: New file. grep: avoid O(N**2) buffer reallocation * src/grep.c (main): Use x2realloc to avoid O(N**2) performance as pattern buffers grow. grep: avoid unnecessary gettext call Translate "(standard input)" lazily. * src/grep.c (input_filename): New function. (suppressible_error): Remove 1st arg, since it is always input_filename (). All callers changed. (suppressible_error, print_filename, grep, grepdesc): Use it. (grep_command_line_arg): Set filename to NULL if standard input has no label. Often, this avoids all calls to gettext, which can be a win as the first call can be expensive. grep: drain the input pipe faster * src/grep.c (dev_null_output): Now static. (drain_input): New function, using 'splice' if that makes sense. (finalize_input): Use it. (main): Omit now-unnecessary initialization. grep: scale back /dev/null speedup The performance improvement when output is /dev/null (commit af6af288eac28951b5eee1eaaf373e22b2193b7b dated 2016-05-01) breaks scripts that run "PROGRAM | grep PATTERN >/dev/null" where PROGRAM dies when writing into a broken pipe. Suppress the improvement if standard input is not seekable. Problem reported by Gary Johnson (Bug#24941). * NEWS: Document this. * src/grep.c (seek_failed): New static var. (seek_data_failed): Move decl earlier, to be next to seek_failed. (file_must_have_nulls): Skip useless syscalls if seek_failed. Lessen source-code nesting. (reset): Set seek_failed and seek_data_failed. Try lseek even on non-regular files. (grep): New arg INEOF. All callers changed. Do not clear seek_data_failed here, since 'reset' now does this. (finalize_input): New static function. (grepdesc): Use it. (main): Do not exit on first match merely because output is /dev/null. * tests/grep-dev-null-out: Adjust to new behavior. grep: improve diagnostic on lseek failure * src/grep.c (reset): Mention the file name in the (unlikely) chance of an lseek failure. grep: avoid unnecessary isatty calls This fixes an inefficiency that was mistakenly introduced a while back, when the macro SET_BINARY became defined on all platforms. * src/grep.c (grepdesc, main): Do not unecessarily call isatty on POSIXish platforms. grep: -Pz no longer rejects ^, $ Problem reported by Stephane Chazelas (Bug#22655). * NEWS: Document this. * doc/grep.texi (grep Programs): Warn about -Pz. * src/pcresearch.c (reflags): New static var. (multibyte_locale): Remove static var; now local to Pcompile. (Pcompile): Check for (? and (* too. Set reflags instead of dying when problematic operators are found. (Pexecute): Use reflags to decide whether searches should be multiline. * tests/pcre: Test new behavior. 2016-11-14 Jim Meyering <meyering@fb.com> tests: use "returns_" rather than explicit comparison with "$?" * tests/sjis-mb (encode): Rearrange to emit desired input into a file, rather than piping directly into grep. That permits the use of returns_ 1 to verify timeout's exit status. * tests/euc-mb: Use "returns_ 1" rather than testing $? = 1 * tests/char-class-multibyte: Likewise. * tests/dfa-heap-overrun: Likewise. * tests/encoding-error: Likewise. * tests/fedora: Likewise. * tests/grep-dev-null: Likewise. * tests/init.cfg (envvar_check_fail): Likewise. * tests/kwset-abuse: Likewise. * tests/mb-non-UTF8-overrun: Likewise. * tests/multibyte-white-space: Likewise. * tests/pcre-infloop: Likewise. * tests/surrogate-pair: Likewise. * tests/warn-char-classes: Likewise. Do the same for other values: * tests/backref-multibyte-slow: Likewise. * tests/euc-mb: Likewise. * tests/pcre-abort: Likewise. * tests/pcre-jitstack: Likewise. * tests/repetition-overflow: Likewise. * tests/reversed-range-endpoints: Likewise. * tests/warn-char-classes: Likewise. 2016-10-26 Jim Meyering <meyering@fb.com> doc: grep builds on HP-UX once again * NEWS (Bug fixes): Mention the HP-UX fix. gnulib: update to latest, for getprogname HPUX port 2016-10-22 Mark Veltzer <mark.veltzer@gmail.com> ignore coverage generated files ignore ar-lib in build-aux 2016-10-20 Zev Weiss <zev@bewilderbeest.net> grep: use 'j' intmax_t printf length modifier if supported * configure.ac: Use gl_PRINTF_SIZES_C99 to test printf and (conditionally) define HAVE_PRINTF_C99_SIZES. * src/grep.c (print_offset): Use printf("%j...") for printing [u]intmax_t if HAVE_PRINTF_C99_SIZES is defined; otherwise continue using the existing hand-rolled loop. 2016-10-15 Jim Meyering <meyering@fb.com> build: distribute new file, die.h, so "make distcheck" passes * src/Makefile.am (grep_SOURCES): Add die.h. Also, sort these file names. 2016-10-10 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2016-10-09 Jim Meyering <meyering@fb.com> maint: die.h: add the "#define ..." part of double inclusion guard * src/die.h (DIE_H): Define to 1. 2016-10-04 Paul Eggert <eggert@cs.ucla.edu> grep: don't assume stdbool.h before die call * src/die.h: Include stdbool.h, since 'die' uses 'false' grep: die more systematically * src/die.h: New file. * src/dfasearch.c, src/grep.c, src/pcresearch.c: Include die.h. * src/dfasearch.c (dfaerror): * src/grep.c (context_length_arg, add_count, prline, setmatcher, main): * src/pcresearch.c (jit_exec, Pcompile, Pexecute): Use 'die' instead of 'error' when exiting. * src/pcresearch.c: Do not include verify.h. (die): Remove; now in die.h. * src/search.h: Do not include error.h here, since this file does not use anything defined in error.h. Instead, dfasearch.c, which uses error.h's symbols, now includes error.h directly. 2016-10-02 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.26 * NEWS: Record release date. 2016-10-01 Jim Meyering <meyering@fb.com> gnulib: update to latest; for getprogname fix 2016-10-01 Paul Eggert <eggert@cs.ucla.edu> tests/grep-dir: port to Solaris 10 * tests/grep-dir: Port to Solaris 10 'cat', which exits with status 0 even after 'read' fails from a directory. 2016-09-28 Jim Meyering <meyering@fb.com> build: placate GCC 7's -Wimplicit-fallthrough * src/pcresearch.c (die): New macro. (Pexecute): Use it in place of offending uses of error, to placate GCC 7's -Wimplicit-fallthrough. Include verify.h. Since this is grep's first explicit use of this gnulib module, ... * bootstrap.conf (gnulib_modules): Add verify. gnulib: update to latest; for ... This includes the following: - a getprogname-vs-openbsd-5.1 portability fix - "fallthru" comment-adding changes for dfa and unistr/u8-uctomb-aux.c - another getprograme fix to avoid breaking newer glibc 2016-09-27 Paul Eggert <eggert@cs.ucla.edu> build: reword .git old-GCC warning * configure.ac (gl_gcc_warnings): Reword diagnostic. Suggested by Assaf Gordon in: http://lists.gnu.org/archive/html/grep-devel/2016-09/msg00024.html build: port .git builds to newer GCC * configure.ac (gl_gcc_warnings): Omit duplicate copy of 'main'. Problem reported by Assaf Gordon in: http://lists.gnu.org/archive/html/grep-devel/2016-09/msg00024.html build: port .git builds to older GCC Problem reported by Dagobert Michelsen in: http://lists.gnu.org/archive/html/grep-devel/2016-09/msg00018.html * configure.ac (gl_gcc_warnings): Default to false if .git exists but GCC is too old. 2016-09-27 Jim Meyering <meyering@fb.com> tests/long-pattern-perf: avoid false-failure due to cache speed * tests/long-pattern-perf: This test would fail semi-consistently on some systems, probably because the smaller regexp fit well within cache, yet the larger one did not. In that case, there was a relative speed difference greater than 20x and the test would fail. Quadruple the sizes, to make that less likely. Also, construct the 10x larger regexp directly from the smaller, rather than relying on seq with endpoints to induce that approximate size ratio. Reported by Bruce Dubbs in https://lists.gnu.org/archive/html/grep-devel/2016-09/msg00013.html 2016-09-24 Jim Meyering <meyering@fb.com> build: avoid "./configure && make dist" missing-dep. failure * Makefile.am (run-syntax-check): Depend on "all", to avoid a parallel build failure due to a missing dependency. Reported by Paul Eggert in https://bugs.gnu.org/24256#50 2016-09-24 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2016-09-24 Jim Meyering <meyering@fb.com> tests/fmbtest: avoid false-failure due to reliance on MB-correct sed * tests/fmbtest: Several of these tests would mistakenly fail due to postprocessing with a combination of sed and locale support that failed to handle some multibyte characters in the cs_CZ.UTF-8 locale. Instead of relying on sed's multibyte support or anything locale-related to perform this simple filtering, just use this: tr -cs '0-9' '[ *]' Also, rather than exporting LC_ALL, just set it for each command. Reported by Nelson H. F. Beebe. https://bugs.gnu.org/24534 tests: revamp multibyte-white-space test to be more permissive This test elicits too many failures. Whether a system has accurate unicode "whitespace" attributes should not influence whether grep's test suite passes. In many cases, now you will see a warning that some multibyte characters do not pass whitespace-related tests, but this test no longer fails. However, if you run this test on a modern enough system, it does require that \s and \S do work properly with most of the listed characters. * tests/multibyte-white-space: Confirm that Fedora 24's locale tables still declare those four Unicode code points *not* whitespace. Honor a new column telling how to handle failure. Provide more information in each diagnostic. Reported by Nelson H. F. Beebe. https://bugs.gnu.org/24530 tests: avoid erroneous failure of pcre-jitstack test On some systems (*BSD), 'ulimit -s unlimited' would fail, yet the test for that mistakenly masked the failure, so the following grep command ended up failing with a segfault. * tests/pcre-jitstack: Don't mask the ulimit failure. Reported privately by Nelson H. F. Beebe. https://bugs.gnu.org/24524 2016-09-23 Jim Meyering <meyering@fb.com> grep: avoid unwarranted "input file 'F' is also the output" on *BSD On *BSD systems, any command like "echo y | grep x", where grep reads from a pipe and writes to standard output, would mistakenly emit this: grep: input file '(standard input)' is also the output * src/grep.c (grepdesc): Ensure that the file descriptor we're reading is a regular one before using SAME_INODE to test whether it is the same as the descriptor open on standard output. Nelson Beebe reported privately that the foad1 tests failed on many BSD systems. Exposed by commit v2.25-2-gaf6af28. https://bugs.gnu.org/24522 tests: avoid backref-multibyte-slow false failure * tests/backref-multibyte-slow (max_seconds): If we calculate a max duration of 1 second, use 5. Otherwise, on high-latency systems, it would be way too easy for the duration of the final test run to exceed that limit. Reported by Nelson H. F. Beebe. http://bugs.gnu.org/24516 2016-09-22 Jim Meyering <meyering@fb.com> gnulib: update to latest; for getprogname-vs-AIX fix 2016-09-18 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: add news entry for fix to bug#24233 * NEWS (Bug fixes): Add an entry describing bug#24233. The bug was fixed by commit v2.25-77-gad468bb, by chance. 2016-09-15 Jim Meyering <meyering@fb.com> gnulib: update to latest 2016-09-10 Jim Meyering <meyering@fb.com> dfa: reflect move of grep's DFA code to gnulib Now that the core DFA code and tests reside in gnulib, remove the copies here and use what gnulib provides. * bootstrap.conf: Use the dfa module. * cfg.mk: Remove settings involving files that have moved. (_gl_TS_unmarked_extern_functions): Add dfaerror and dfawarn. It is wrong/ugly to have to define these global symbols to use the dfa module, but we'll adjust that separately. * po/POTFILES.in: Apply s/src/lib/ to src/dfa.c. * src/Makefile.am: Remove mention of dfa.[ch] and localeinfo.[ch]. * tests/Makefile.am: Remove mention of the tests that we have moved to the gnulib module. * src/dfa.c: Remove file. * src/dfa.h: Likewise. * src/localeinfo.c: Likewise. * src/localeinfo.h: Likewise. * tests/dfa-match: Likewise. * tests/dfa-match-aux.c: Likewise. * tests/invalid-char-class: Likewise. gnulib: update to latest, for new dfa module 2016-09-08 Paul Eggert <eggert@cs.ucla.edu> grep: encoding errors suppress just their line From a suggestion by Marcello Perathoner (Bug#22838). * NEWS, doc/grep.texi (File and Directory Selection): Document this. * src/grep.c (print_line_head): Do not suppress later output lines merely because an earlier output line would have had an encoding error. * tests/encoding-error: Test for the new behavior. 2016-09-08 Jim Meyering <meyering@fb.com> gnulib: update to latest, for getprogname fixes 2016-09-08 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: additional change new option for anchored searches * src/dfa.c (dfaexec_main): Do it. 2016-09-07 Paul Eggert <eggert@cs.ucla.edu> doc: define "context lines" Reported by Igor Bogomazov via Santiago Ruano Rincón (Bug#24024). * doc/grep.texi (Context Line Control): Define "context lines". build: update gnulib submodule to latest 2016-09-05 Jim Meyering <meyering@fb.com> maint: switch from gnulib's progname to getprogname module * gnulib: Update to latest, for its new getprogname module. * bootstrap.conf (avoided_gnulib_modules): Include the getprogname module rather than the now-obsolescent progname. * src/grep.c: Include "getprogname.h" rather than "progname.h" and remove any use of set_program_name. * tests/dfa-match-aux.c (main): Likewise. * tests/get-mb-cur-max.c (main): Likewise. * src/grep.c (usage, main): Use getprogname() in place of program_name. 2016-09-02 Paul Eggert <eggert@cs.ucla.edu> dfa: minor cleanup of previous change * src/dfa.c (dfaexec_main): Omit redundant code and reindent. 2016-09-02 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: additional change new option for anchored searches * src/dfa.c (dfaexec_main): Do it. dfa: use single-byte algorithm even in non-UTF-8 * src/dfa.c (dfaexec_main): Do it. (This was inadvertently omitted in a recent patch.) 2016-09-02 Paul Eggert <eggert@cs.ucla.edu> dfa: merge xalloc.h changes from Gawk * src/dfa.h (_GL_ATTRIBUTE_MALLOC): Define here, as other Gnulib .h files do. This is more consistent with Gawk. * src/dfa.c: Include xalloc.h, since dfa.h no longer does so. Include localeinfo.h later; we don't care about order, but Gawk does. 2016-09-02 Arnold Robbins <arnold@skeeve.com> dfa: port to C90 * src/dfa.c (dfamust): Avoid declarations after statement (Bug#21486). 2016-09-02 Paul Eggert <eggert@cs.ucla.edu> dfa: new option for anchored searches This follows up on a suggestion by Norihiro Tanaka (Bug#24262). * src/dfa.c (struct regex_syntax): New member 'anchor'. (char_context): Use it. (dfasyntax): Change signature to specify it, along with the old FOLD and EOL args, as a single DFAOPTS arg. All uses changed. * src/dfa.h (DFA_ANCHOR, DFA_CASE_FOLD, DFA_EOL_NUL): New constants for dfasyntax new last arg. 2016-09-02 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: simplify and optimize at initial state in execution * src/dfa.c (skip_remains_mb): Remove argument *pwc. Update calller. (dfaexec_main): Simplify and optimize at initial state (Bug#24261). dfa: simplify to find state index for state 0 * src/dfa.c (dfastate): Simplify to find state index for state 0. 2016-09-01 Norihiro Tanaka <noritnk@kcn.ne.jp> tests: add a new test for SJIS locale * tests/sjis-mb: Add a new test. It fails in grep-2.25 or prior. 2016-09-01 Paul Eggert <eggert@cs.ucla.edu> grep: update NEWS * NEWS: Describe previous change. grep: use regex fastmap unless -i This builds on a suggestion by Norihiro Tanaka (Bug#24009). * src/dfasearch.c (GEAcompile): Use a fastmap unless -i. This improves performance 20x for me using the first benchmark given in Bug#24009. grep: improve dfasearch storage management This patch is mostly refactoring, with a bit of performance tweaking. It is done in preparation for a fix for Bug#24009. * src/dfasearch.c (patterns): Now of type struct re_pattern_buffer * instead of an anonymous struct pointer, since there is no longer any need to keep regs here. All uses changed. (GEAcompile): Use patlim instead of a hard-to-follow "total". Use x2nrealloc to avoid potential O(N**2) reallocation algorithm. Initialize just the pattern members that need clearing. (EGexecute): Put regs into a static variable, as this code did before 2001-02-18, as there is no need to have a separate set of regs for each pattern. Explain the "Q@#%!#" comment better. 2016-09-01 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: remove separation by context in transition in non-UTF8 multibyte locales * src/dfa.c (struct dfa): Remove member curr_dependent. All uses removed. 2016-09-01 Paul Eggert <eggert@cs.ucla.edu> dfa: document previous change * NEWS: Adjust to match previous change. 2016-09-01 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: avoid invalid character matching period * dfa.c (transit_state): Avoid invalid character matching period. dfa: use single-byte algorithm even in non-UTF-8 Even in non-UTF8 locales, if the current input character is single byte, we can use CSET to match ANYCHAR. * src/dfa.c (struct dfa): New member canychar. Cache index of CSET for ANYCHAR. (lex): Make CSET for ANYCHAR. (state_index): Simplify. (dfastate): Consider CSET for ANYCHAR. (transit_state_singlebyte, transit_state): Remove handling for eolbyte, as we assume that eolbyte does not appear at current position. (dfaexec_main): Use algorithm for single byte character to any single byte character in input text always. (dfasyntax): Initialize canychar. 2016-09-01 Paul Eggert <eggert@cs.ucla.edu> grep: avoid code duplication with -iF This follows up on the -iF performance improvement (Bug#23752). * NEWS: Simplify description of -iF improvement. * src/dfa.c: Do not include wctype.h. (lonesome_lower, case_folded_counterparts): Move to localeinfo.c. (CASE_FOLDED_BUFSIZE): Move to localeinfo.h. * src/grep.c: Do not include wctype.h. (lonesome_lower): Remove. (fgrep_icase_available): Use case_folded_counterparts instead. Do not call it for the same character twice. Return false on wcrtomb failures (which should never happen). (fgrep_to_grep_pattern, main): Simplify. Let fgrep_to_grep’s caller fiddle with the global variables. * src/localeinfo.c: Include <wctype.h> (lonesome_lower, case_folded_counterparts): Move here from src/dfa.c. Return int, not unsigned int. Verify that CASE_FOLDED_BUFSIZE is big enough. * src/localeinfo.h (CASE_FOLDED_BUFSIZE): Now 32, so that we don’t expose lonesome_lower’s size. * src/searchutils.c (kwsinit): Return new kwset instead of storing it via a pointer. All callers changed. Simplify a bit. 2016-09-01 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: speed up -iF in multibyte locales In a multibyte locale, if a pattern is composed of only single byte characters and their all counterparts are also single byte characters and the pattern does not have invalid sequences, grep -iF uses the fgrep matcher, the same as in a single byte locale (Bug#23752). * NEWS: Mention it. * src/grep.c (lonesome_lower): New constant. (fgrep_icase_available): New function. (fgrep_to_grep_pattern): Simplify it. (main): Use them. * src/searchutils.c (kwsinit): New arg MB_TRANS; all uses changed. Try fgrep matcher for case insensitive matching by grep -F in multibyte locale. 2016-08-31 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2016-08-31 Jim Meyering <meyering@fb.com> maint: avoid new 'make syntax-check' failure * src/dfa.c (using_simple_locale): Prefer STREQ(a,b) over strcmp(a,b) == 0. gnulib: update to latest 2016-08-31 Paul Eggert <eggert@cs.ucla.edu> dfa: make dfa.c fully thread-safe This follows up on Zev Weiss’s recent patches to make the DFA code thread-safe (Bug#24249). It removes the remaining static variables used by dfa.c. These variables are locale-dependent, so they would cause problems in multithreaded code where different threads are in different locales (e.g., via uselocale). I abstracted most of the variables into a new localeinfo module. * src/Makefile.am (grep_SOURCES): Add localeinfo.c. (noinst_HEADERS): Add localeinfo.h. * src/dfa.c: Include localeinfo.h. (struct dfa): Remove multibyte member, as it is now part of localeinfo. New members simple_locale and localeinfo. Put locale-related members at the end. (mbrtowc_cache): Remove; now part of dfa->localeinfo. (charclass_index): Rename back from dfa_charclass_index, since it's private. (unibyte_word_constituent): New arg DFA; use its sbctowc member. (using_utf8, dfa_using_utf8, init_mbrtowc_cache, check_utf8): Remove; now done by localeinfo members. All uses changed. (dfasyntax): New localeinfo arg. Move to end to avoid forward decls. Initialize the entire DFA. (unibyte_c, check_unibyte_c): Remove; now in simple_locale member. (using_simple_locale): Now takes bool instead of DFA. Do the locale check here, rather than in the caller, as the result is now cached in dfa->simple_locale. (dfaalloc): Just allocate the DFA. dfasyntax now initializes it. * src/dfa.h: Add forward decl of struct localeinfo. Adjust to new dfa.c API. * src/dfasearch.c (localeinfo): New var, replacing former static vars like mbrtowc_cache. * src/localeinfo.c, src/localeinfo.h: New files. * src/search.h: Include localeinfo.h. (localeinfo): New decl. * src/searchutils.c (mbclen_cache, build_mbclen_cache): Remove. All uses changed to localeinfo. * tests/Makefile.am (dfa_match_aux_LDADD): Add localeinfo.o. * tests/dfa-match-aux.c: Include localeinfo.h. (main): Adjust to changes in DFA API. 2016-08-28 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest This should fix Bug#24323 reported by Dennis Clarke, where grep does not build on Solaris 10 when compiled with Solaris Studio 12.4. 2016-08-23 Paul Eggert <eggert@cs.ucla.edu> dfa: minor thread-safety cleanups * src/dfa.c (struct lexer_state): Rename lexptr to ptr and lexleft to left, for brevity. All uses changed. (struct dfa): Rename lexstate to lex and parsestate to parse, for brevity. All uses changed. (using_simple_locale): Simplify boolean expression. (FETCH_WC): Parenthesize uses of dfa macro arg. (FETCH_WC, parse_bracket_exp, addtok_mb): Prefer suffix operators on structure members when possible, for clarity. (parse_bracket_exp): Check for buffer exhaustion before dereferencing buffer pointer. (struct lexptr): New type. (push_lex_state, pop_lex_state): Use it. Change from macros PUSH_LEX_STATE and POP_LEX_STATE to static functions, and add parameters to make them proper C functions. All uses changed. (lex): Simplify tests for \) and \|. Avoid some string duplication by using &"^..."[boolean]. (dfaalloc): Use xzalloc, not xcalloc with 1. 2016-08-21 Paul Eggert <eggert@cs.ucla.edu> grep: minor tweaks of initial buffer alloc * src/grep.c (main): Allocate input buffer only when about to do I/O. Avoid int overflow on systems with 2 GiB pages. Fix size_t overflow check. 2016-08-20 Zev Weiss <zev@bewilderbeest.net> dfa: constify some function parameters * src/dfa.c (char_context): Mark dfa parameter const. (charclass_context): Likewise. dfa: thread-safety: initialize mbrtowc_cache in dfa_init * src/dfa.c (dfasyntax): Remove initialization of mbrtowc_cache. (init_mbrtowc_cache): New function. (dfa_init): Call it. http://bugs.gnu.org/24259 dfa: thread-safety: eliminate static local variables * src/dfa.c: Replace utf8 and unibyte_c static local variables with static globals initialized by a new function dfa_init() which must be called before any other dfa*() functions. (dfa_using_utf8): Rename using_utf8() to dfa_using_utf8() for consistency with other exported functions. * src/dfa.h (dfa_using_utf8): Rename using_utf8() to dfa_using_utf8(); also add _GL_ATTRIBUTE_PURE. (dfa_init): New function. * src/grep.c (main), tests/dfa-match-aux.c (main): Call dfa_init(). * src/dfasearch.c (EGexecute): Replace using_utf8 with dfa_using_utf8. * src/kwsearch.c (Fexecute): Likewise. * src/pcresearch.c (Pcompile): Likewise. http://bugs.gnu.org/24259 dfa: thread-safety: move regex syntax configuration into struct dfa * src/dfa.c: move global variables holding regex syntax configuration into a new struct (`struct regex_syntax') and add an instance of it to struct dfa. All references to the globals are replaced with references to the dfa struct's new member. As a side effect, a `struct dfa' must be allocated with dfaalloc() and passed to dfasyntax(). * src/dfa.h (dfasyntax): Add new struct dfa* parameter. * src/dfasearch.c (GEAcompile): Allocate `dfa' earlier and pass it to dfasyntax(). * tests/dfa-match-aux.c (main): Pass `dfa' to dfasyntax(). http://bugs.gnu.org/24259 dfa: thread-safety: move parser state into struct dfa * src/dfa.c: move global variables holding parser state (`tok' and `depth') into a new struct (`struct parser_state') and add an instance of it to struct dfa. All references to the globals are replaced by references to the dfa struct's new member. http://bugs.gnu.org/24259 dfa: thread-safety: move lexer state into struct dfa * src/dfa.c: move global variables holding lexer state into a new struct (`struct lexer_state') and add an instance of this struct to struct dfa. All references to the globals are replaced with references to the dfa struct's new member. http://bugs.gnu.org/24259 2016-08-19 Zev Weiss <zev@bewilderbeest.net> dfa: thread-safety: remove dfa.c's "dfa" global Remove the global dfa struct. Instead, add a struct dfa pointer parameter to each function that had been using the global. * src/dfa.c (dfa): Remove file-scoped global. (charclass_index): Remove now-unnecessary function. (using_simple_locale): Add a dfa parameter and update all callers. (FETCH_WC, parse_bracket_exp, lex, addtok_mb, addtok): Likewise. (addtok_wc, add_utf8_anychar, atom, nsubtoks, copytoks): Likewise. (closure, branch, regexp): Likewise. (dfaparse): No longer set the global. http://bugs.gnu.org/24260 2016-08-18 Paul Eggert <eggert@cs.ucla.edu> grep: tune list_files conversion to enum * src/grep.c (grepdesc): Use a slightly more-efficient way to test list_files. grep: prefer bitwise to short-circuit when shorter * src/grep.c (skip_devices, initialize_unibyte_mask, fillbuf, main) * src/kwsearch.c (Fexecute): Prefer bitwise to short-circuit ops when they are logically equivalent and the bitwise ops generate shorter code on GCC 6.1 x86-64. * src/grep.c (get_nondigit_option, parse_grep_colors): Use c_isdigit instead of spelling it out with a short-circuit op. 2016-08-17 Paul Eggert <eggert@cs.ucla.edu> dfa: use 64-bit when ulong is at least that wide * src/dfa.c (charclass_word): Now unsigned long instead of unsigned. (CHARCLASS_WORD_BITS): Now 64 on 64-bit platforms. (CHARCLASS_PAIR, CHARCLASS_INIT): New macros. (CHARCLASS_WORD_MASK): Now a static const, since it no longer needs to be a macro. (equal): Open-code rather than calling memcmp. (add_utf8_anychar): Use CHARCLASS_INIT. dfa: avoid uninitialized constants Some compilers warn about 'static int const x;' on the grounds that X should have an initializer. Instead of worrying about this, rewrite to avoid this sort of thing. * src/dfa.c (emptyset): New function. (parse_bracket_exp): Use it instead of 'equal' and a zero constant. * src/dfasearch.c (struct patterns): Remove tag 'patterns'. (patterns0): Remove zero constant. (GEAcompile): Use memset instead of the zero constant. 2016-08-17 Jim Meyering <meyering@fb.com> maint: avoid new "make syntax-check" failure * src/dfa.c: Adjust comment not to go past column 80. tests: pcre-jitstack: avoid false failure without base64 -d support * tests/pcre-jitstack: Try harder to find a base64 decoder: try 'base64 -d', 'base64 -D', 'openssl base64 -d' and perl's MIME::Base64 decode_base64. The old code would fail at least on OS X, for which base64 expects -D or --decode. Reported by Jack Howarth in http://bugs.gnu.org/24243. 2016-08-16 Paul Eggert <eggert@cs.ucla.edu> dfa: minor refactoring and doc fixes * NEWS: Improve description of recent change. * src/dfa.c: Improve commentary. Indent new code (and some long-existing howlers) more in GNU style. (dfa_state): Reorder members to make struct smaller on x86. mb_trindex member is now state_num, not size_t, so that -1 is more natural; all uses changed. (struct dfa): Similarly for mb_trcount member. (state_index): Compute values for new state components before allocating the state, to make the code easier to understand. (state_index, dfastate): Prefer A & ~B to other forms like (A & B) != A. (dfastate, build_state, transit_state): In new code, prefer i++ to ++i in for-loop control. (build_state, transit_state): In new code, prefer < to >. (transit_state): Add to *PP in one assignment, rather than in a loop. Prefer !x to x == NULL. Use xmalloc instead of xnmalloc, since the size is a constant. Do the size calculation as a signed integer constant expression, so that the compiler diagnoses any overflow. (transit_state, free_mbdata): Tune by looping from -1 to N - 1, rather than from 0 to N - 1 with a separate instance for -1. (dfaexec_main): Rewrite to avoid side effects in if-part. (free_mbdata): Simplify. dfa: port to C90 * src/dfa.c (transit_state, dfa_supported, dfamust): Don't use declarations after statements. If I recall correctly, gawk still wants to port to C90. dfa: fix context newline confusion * src/dfa.c (transit_state): Fix "... & ~0" that was evidently intended to be "... & ~1". Do index calculation in a simpler way, that uses just addition (Bug#21486). 2016-08-16 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: improve leading "." with non-UTF8 multibyte In non-UTF8 multibyte locales, matching the dot expression is very slow, as the next state is calculated on demand. This change caches the result for the typical case (Bug#21486). Compare the run times of this command before and after this change, on a i5-4570 CPU @ 3.20GHz using rawhide (~fedora 22) and compiled with gcc 5.1.1 20150618: yes "$(printf 'a%38db\n' 0)" | head -1000000 >in env LC_ALL=ja_JP.eucJP time -p \ src/grep .......................................... in Before: 19.10 After : 0.55 * NEWS: Document this. * src/dfa.c: (struct dfa_state): New members curr_dependent, mb_trindex. (MAX_TRCOUNT): New constant. (struct dfa): New members mb_trans, mb_trcount. (state_index): Initialize new members of struct dfa_state and calculate dependency on context of next character for positions for dot. (dfastate): Calculate follows positions for dot if enabled. (realloc_trans_if_necessary): Allocate transition tables. (build_state): Use new constant and reset transition tables. (transit_state): Use cache for transition from a state with the dot expression. (free_mbdata): Deallocate transition tables. 2016-08-06 Jim Meyering <meyering@fb.com> tests: standardize on 10-second timeouts to avoid rare false failure In a parallel test run, it is not unusual to exceed a timeout of 1-3 seconds. Increase several from 3 or fewer to 10 seconds. * tests/skip-device: Increase timeout from 2 to 10 seconds. * tests/grep-dev-null-out: Likewise, but s/1/10/. * tests/pcre-invalid-utf8-input: Likewise, but s/3/10/. * tests/dfa-match: Likewise. * tests/pcre-invalid-utf8-infloop: Likewise. * tests/pcre-infloop: Likewise. * tests/max-count-overread: Likewise. * tests/invalid-multibyte-infloop: Likewise. Prompted by http://bugs.gnu.org/24159. tests/backref-multibyte-slow:: avoid false positive * tests/backref-multibyte-slow: When redirecting the "fast" LC_ALL=C run's output to /dev/null, we got an artificially low timing (of 0), due to grep's own stdout-vs-/dev/null optimization. With an initial timing of 0 on that first run, the derived timeout for the UTF-8 run (which redirects to a file) would be a mere 1 second. The fix: also redirect that first run's output to a file, not to /dev/null. 2016-08-05 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: minor fix for whether dfa is "fast" * src/dfa.c (dfaoptimize): When a UTF-8 optimization succeeds for a DFA (it can use single-byte code paths), record that by setting its ->fast flag. 2016-07-25 Jim Meyering <meyering@fb.com> grep: print "filename:lineno:" in invalid-regex diagnostic Determining the file name and line number is a little tricky because of the way the regular expressions are all concatenated onto a newline- separated list. By the time grep would compile regular expressions, the <filename,lineno> origin of each regexp was no longer available. This patch adds a list of filename,first_lineno pairs, one per input source, by which we can then map the ordinal regexp number to a filename,lineno pair for the diagnostic. * src/dfasearch.c (GEAcompile): When diagnosing an invalid regexp specified via -f FILE, include the "FILENAME:LINENO: " prefix. Also, when there are two or more lines with compilation failures, diagnose all of them, rather than stopping after the first. * src/grep.h (pattern_file_name): Declare it. * src/grep.c: (struct FL_pair): Define type. (fl_pair, n_fl_pair_slots, n_pattern_files, patfile_lineno): Define globals. (fl_add, pattern_file_name): Define functions. (main): Call fl_add for each type of the following: -e argument, -f argument, command-line-specified (without -e) regexp. * tests/filename-lineno.pl: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Improvements): Mention this. Initially reported by Gunnar Wolf in https://bugs.debian.org/525214 Forwarded to grep's bug list by Santiago Ruano Rincón as http://debbugs.gnu.org/23965 2016-07-24 Jim Meyering <meyering@fb.com> tests: add coreutils' perl-driven test framework * configure.ac: Set the AM_CONDITIONAL variable, HAVE_PERL. * tests/Coreutils.pm: New file. * tests/CuSkip.pm: New file. * tests/CuTmpdir.pm: New file. * tests/no-perl: New file. * tests/Makefile.am: Set up to use .pl tests: (TEST_EXTENSIONS, TESTSUITE_PERL, TESTSUITE_PERL_OPTIONS): Define. (SH_LOG_COMPILER, PL_LOG_COMPILER): Define. (EXTRA_DIST): Add the four new file names. doc: omit an excess word in HACKING 2016-07-21 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: always match single line only with DFA superset \n cannot occur inside a multibyte character. So an input always matches single line only with DFA superset. * src/dfasearch.c (EGexecute): Simplify it with above. 2016-07-15 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: fix whitespace problems * src/dfa.c: Use GNU style for pointer decls. 2016-07-15 Paul Eggert <eggert@cs.ucla.edu> maint: modernize HACKING a bit * HACKING: Remove some ancient history to simplify maintenance. 2016-07-14 Paul Eggert <eggert@cs.ucla.edu> grep: minor style changes for -F crash fix * src/kwset.c (memoff2_kwset): Use ?: instead of if-else. 2016-07-14 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: fix -F crash when alternating duplicates grep -F crashes with a pattern like 0\n0. This bug was introduced in 966f6586fbce3081ce6e5e2f9b55301b0ec3d2b4. * src/kwset.c (memoff2_kwset): If two characters are the same, use memchr instead of memchr2. * tests/two-chars: New test. * tests/Makefile.am (TESTS): Add it. 2016-07-07 Paul Eggert <eggert@cs.ucla.edu> dfa: fix comments to match code better * src/dfa.c: Fix comments. 2016-07-06 Paul Eggert <eggert@cs.ucla.edu> dfa: don't treat null bytes specially * src/dfa.c (transit_state): Do not treat null byte specially when eolbyte == '\n'. 2016-07-06 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: don't distingish letter in non-POSIX locales For non-POSIX locales, dfa does not support word delimiter support, so remove distinction between letters and non-letters. * src/dfa.c (struct dfa): Remove members initstate_letter, initstate_others. All uses removed. New member initstate_notbol. (dfaanalyze, dfaexec_main): Replace old members with new member. (wchar_context): Remove. Update callers. 2016-07-06 Paul Eggert <eggert@cs.ucla.edu> dfa: minor cleanups for non-POSIX simplification * src/dfa.c (transit_state_singlebyte): Remove unnecessary 'const' from arg; we usually don't bother with 'const' on locals. (transit_state_singlebyte): Omit '!= NULL' in boolean context. Use assert rather than abort. 2016-07-06 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: simplify for non-POSIX locales Simplify the dfa code, since it no longer supports ranges, collating elements, and equivalent classes in non-POSIX locales. * src/dfa.c (struct dfa): Remove mb_match_lens. (enum status_transit_state, match_anychar) (check_matching_with_multibyte_ops, transit_state_consume_1char): (State_transition): Remove. (transit_state_singlebyte): Accepts pointer-to-pointer position, instead of pointer, and no longer accept pointer to next state. Return next state instead of status_transit_state. All callers changed. (transit_state_singlebyte, transit_state): Simplify. (dfaexec_main): Now transit_state is called only when next character matches with ANYCHAR. 2016-06-14 Paul Eggert <eggert@cs.ucla.edu> doc: propagate more changes from grep.texi Problem reported by Björn Voigt in: http://bugs.gnu.org/23763#27 * doc/grep.in.1: Fix more inconsistencies with grep.texi. 2016-06-13 Paul Eggert <eggert@cs.ucla.edu> doc: remove obsolete MS-DOS mention * doc/grep.in.1: Remove obsolete discussion of MS-DOS heuristics. Problem reported by Björn Voigt in: http://bugs.gnu.org/23763 2016-06-09 Zev Weiss <zev@bewilderbeest.net> grep: do pagesize initialization and buffer allocation earlier * src/grep.c (reset, main): We're going to need pagesize and buffer initialized anyway, so we might as well do so unconditionally early on rather than checking on every call to reset(). http://bugs.gnu.org/23717 grep: remove unnecessary dirdesc variable. * src/grep.c (grepdirent): Remove dirdesc variable and just use fts_cwd_fd directly, since the fts_options test was guaranteed to succeed (and fts_cwd_fd was already being used directly in fstatat() anyway). http://bugs.gnu.org/23716 grep: convert list_files to an enum * src/grep.c: Make list_files a tristate enum instead of an int. http://bugs.gnu.org/23715 grep: correct a stale comment and remove dead code * src/grep.c (grepdesc): The `grep()' function no longer has special-case negative return values, since it no longer handles directories, so don't bother checking for them. http://bugs.gnu.org/23714 maint: replace bitwise with logical OR * src/grep.c (main): replace bitwise ORs with logical ORs where it makes sense (when dealing with boolean conditions as opposed to bitmasks). http://bugs.gnu.org/23713 maint: mark a couple of static variables const * src/dfa.c (parse_bracket_exp): mark zeroclass const. * src/dfasearch.c: mark patterns0 const. http://bugs.gnu.org/23712 2016-06-03 Paul Eggert <eggert@cs.ucla.edu> tests: fix similar bug in exit status test * tests/grep-dir (status_range): New shell function. Use it to fix bug where $? was not saved properly. 2016-06-03 Zev Weiss <zev@bewilderbeest.net> tests: fix bug in exit status test When checking $? against multiple values, save its value in another variable and check that so as to avoid tests beyond the first seeing a $? clobbered by earlier ones. * tests/status: save $? in a temporary variable before testing it. 2016-06-02 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: more simplification of dfaexec_main * src/dfa.c (dfaexec_main): Failure at an acceptable position and demand to build state is unlikely. So go next loop without checking them after a newline. This commit induces no semantic change. 2016-06-02 Paul Eggert <eggert@cs.ucla.edu> maint: correct attribution * build-aux/git-log-fix: Fix attribution of primary Aho-Corasick patch 2016-06-02 Paul Eggert <eggert@cs.ucla.edu> grep: simplify -F Aho-Corasick a bit This removes some tuning that complicates the code without providing performance benefits that I could measure (GCC 6.1, x86-64). (acexec_trans): Do not hand-unroll. Unduplicate the code for a transition step. * src/kwset.c (struct kwset.kwsexec, bmexec, acexec_trans, acexec) 2016-06-02 Paul Eggert <eggert@cs.ucla.edu> grep: minor cleanups for -F Aho-Corasick * NEWS: Don't claim 7x, as the value seems to be system-dependent. * src/kwset.c (struct kwset.kwsexec, bmexec, acexec_trans, acexec): * src/kwset.c, src/kwset.h (kwsalloc, kwsexec): Don't put 'const' into the declaration when that is irrelevant to the API. More generally, don't bother with 'const' when it's only a local so it is reasonably obvious to a reader that it is 'const' anyway. It would be overkill to add 'const' to all locals that never change. * src/kwset.c (U): Avoid unnecessary parens. (treefails, memoff2_kwset, bmexec_trans, bmexec, cwexec, acexec_trans): Prefer SIZE_MAX to (size_t) -1. (bmexec_trans, cwexec, acexec_trans): Remove attributes for static functions that no longer seem needed. (memoff2_kwset): Rename from memchr2_kwset, since it returns an offset, not a pointer. All uses changed. (cwexec, acexec_trans) [lint]: Remove initialization that is no longer needed; at least, GCC 6.1 x86-64 does not need it. (acexec_trans): Clarify code by using nesting rather than 'continue'. 2016-06-02 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: use memchr2 for two patterns of a character * src/kwset.c (memchr2_kwset): Add a new function. grep uses memchr2 to search just two letters. (cwexec, acexec_trans): Use it. grep: -F multiword longest match not always needed Searching multiple fixed words, grep immediately returns without longest match if not needed. Without this change, grep tries longest match for multiple words even if not needed. * src/kwset.c (kwsexec, acexec, cwexec, bmexec): Add a bool argument for whether longest match is needed. All callers changed. * src/kwset.h (kwsexec): Update prototype. 2016-06-02 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: use Aho-Corasick algorithm to search multiple fixed words Searching multiple fixed words, grep used the Commentz-Walter algorithm, but this was O(m*n) and was very slow in the worst case. For example: - input: yes `printf %040d` | head -10000000 - word1: x0000000000000000000 - word2: x This change instead uses the Aho-Corasick algorithm to search multiple fixed words. It uses a high-quality trie-building function that is already defined for Commentz-Walter in kwset.c. I see 7x speed-up even for a typical case on Fedora 21 with a 3.2GHz i5 by this change. Using best-of-5 trials for the benchmark: find /usr/share/doc/ -type f | LC_ALL=C time -p xargs.sh src/grep -Ff /usr/share/dict/linux.words >/dev/null The results were: real 11.37 user 11.03 sys 0.24 [without the change] real 1.49 user 1.31 sys 0.15 [with the change] * src/kwset.c (struct kwset): Add a new member 'mode'. (kwsalloc): Use it. All callers are changed. (kwsincr): Using Aho-Corasick algorithm, build tries in normal order. (acexec_trans, acexec): Add a new function. (kwsexec): Use it. * src/kwset.h (kwsalloc): Update a prototype. * NEWS (Improvements): Mention it. 2016-05-13 Jim Meyering <meyering@fb.com> maint: do not let a LANGUAGE envvar setting perturb tests E.g., running "LANGUAGE=eo make check" would provoke a failure of the encoding-error test, on systems that mistakenly let that envvar trump the setting of LC_ALL. * tests/envvar-check: New file, copied from coreutils. * tests/Makefile.am (EXTRA_DIST): Add it. (TESTS_ENVIRONMENT): Source it. Also select TMPDIR as we do for coreutils tests. Reported by Benno Schulenberg in http://bugs.gnu.org/23527. 2016-05-02 Jim Meyering <meyering@fb.com> maint: avoid NEWS syntax-check failure * NEWS: Move the mention of the /dev/null speed-up from the block for 2.25 into the current, in-preparation block. 2016-05-01 Paul Eggert <eggert@cs.ucla.edu> dfa: prefer bool for boolean * src/dfa.c (syntax_bits_set, dfasyntax, using_utf8, FETCH_WC) (POP_LEX_STATE, State_transition): * src/dfa.h (using_utf_8): Use bool for boolean. 2016-05-01 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: stop exporting internal functions * src/dfa.c, src/dfa.h (dfaparse, dfaanalyze, dfastate, dfainit): Now static. dfa: prefer bool at DFA interfaces * src/dfa.c (struct dfa, dfasyntax, dfaanalyze, dfaexec_main) (dfaexec_mb, dfaexec_sb, dfaexec_noop, dfaexec, dfacomp): * src/dfa.h (dfasyntax, dfacomp, dfaexec, dfaanalyze): * src/dfasearch.c (EGexecute): Use bool for boolean. 2016-05-01 Paul Eggert <eggert@cs.ucla.edu> dfa: speed up checking for character boundary This should help performance with gawk; not so much with grep. Suggested by Norihiro Tanaka in: http://bugs.gnu.org/18777 * src/dfa.c (never_trail): New static var. (dfasyntax): Initialize it. (skip_remains_mb): Use it to speed up a common case in Gawk. grep: /dev/null output speedup This sped up 'seq 10000000000 | grep . >/dev/null' by a factor of 380,000 on my platform (Fedora 23, x86-64, AMD Phenom II X4 910e, en_US.UTF-8 locale). * NEWS: Document this. * src/grep.c (grepbuf): exit_on_match no longer implies that -q was specified, so when a match is found, exit with exit_failure if an error was also found. (grepdesc): Omit unnecessary S_ISREG and st_ino checks. out_stat.st_ino is zero if stdout is not a regular file, and this cannot possibly equal st->st_ino. (main): Omit duplicate initialization of exit_failure. Do not bother with isatty unless -q is not used and stdout is a character special file and --color=auto and TERM says colorization is possible. Most importantly, set exit_on_match if the output is /dev/null. * tests/grep-dev-null-out: New test. * tests/Makefile.am (TESTS): Add it. * tests/status: Do not require grep to actually read all the input files when the output is /dev/null and a matching line has been found. 2016-04-21 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.25 * NEWS: Record release date. 2016-04-19 Paul Eggert <eggert@cs.ucla.edu> dfa: remove dependency on btowc MirOS BSD btowc is a macro that (when GCC is being used) hardcodes btowc (0x80) == WEOF regardless of locale, which contradicts future POSIX in the C locale. Instead of bothering to develop a Gnulib workaround for the btowc incompatibility, use mbrtowc, which we are using elsewhere and fixing anyway, and are caching so it is fast here. Problem reported by Nelson H. F. Beebe via Jim Meyering in: http://bugs.gnu.org/23269#14 * bootstrap.conf (gnulib_modules): Remove btowc. * src/dfa.c (struct dfa): Remove mbrtowc_cache member, replacing with ... (mbrtowc_cache): ... this new static var. All uses changed. (dfambcache): Remove; now done by setsyntax. Call removed. (is_valid_unibyte_character): Remove. (IS_WORD_CONSTITUENT): Remove this macro, replacing it with ... (unibyte_word_constituent): ... this new function. It uses mbrtowc_cache rather than btowc. (dfasyntax): Initialize mbrtowc_cache before using it. 2016-04-10 Paul Eggert <eggert@cs.ucla.edu> grep: minor doc tweaks inspired by Debian Problem reported by Santiago Ruano Rincón in: http://bugs.gnu.org/22911 * doc/grep.in.1: * doc/grep.texi (Matching Control, grep Programs) (Regular Expressions): Document -e, -f, and PCRE more carefully. 2016-04-10 Jim Meyering <meyering@fb.com> maint: remove unused mbtoupper function * src/searchutils.c (mbtoupper): Remove now-unused function. Also remove inclusion of <assert.h>, since this change removed the final use of assert. * src/search.h (mbtoupper): Remove declaration. 2016-04-10 Paul Eggert <eggert@cs.ucla.edu> grep: in C locale, all bytes are valid characters This works around glibc bug 19932: https://sourceware.org/bugzilla/show_bug.cgi?id=19932 The actual bug fix was the update to the current version of Gnulib. grep problem reported by Björn Jacke in: http://bugs.gnu.org/23234 * NEWS: Mention this. * doc/grep.texi (File and Directory Selection): Crossref to LC_* section. Suggest why -a or LC_ALL=C might be useful. (Environment Variables): Mention 'locale -a'. Say that LC_CTYPE also specifies encoding, and that every byte is a valid character in the C or POSIX locale. * tests/c-locale: New test. * tests/Makefile.am (TESTS): Add it. build: update gnulib submodule to latest 2016-04-05 Paul Eggert <eggert@cs.ucla.edu> Give another example of binary file processing Problem reported by Shlomi Fish * doc/grep.texi (File and Directory Selection): Document that 'q$' might match 'q' followed by a NUL if --binary-files=binary is in effect. 2016-04-03 Paul Eggert <eggert@cs.ucla.edu> tests: test egrep/fgrep help only if our grep Problem reported by Christian Weisgerber in: http://bugs.gnu.org/23146 * tests/Makefile.am (TESTS_ENVIRONMENT): Test egrep and fgrep only if they use our grep. 2016-03-29 Jim Meyering <meyering@fb.com> tests: remove spurious test of egrep * tests/reversed-range-endpoints: Do not test egrep here. There is already a test of grep -E. Prompted by http://bugs.gnu.org/23146 2016-03-23 Paul Eggert <eggert@cs.ucla.edu> grep: -Pz no longer misdiagnoses [^a] Problem reported by Michael Jess. * NEWS: Document this. * src/pcresearch.c (Pcompile): Do not diagnose [^ when [ is unescaped. * tests/pcre: Test for the bug. 2016-03-22 Jim Meyering <meyering@fb.com> maint: move new 'Improvements' blurb into proper section * NEWS (Improvements): Move this new section from within the block for the already-released 2.24 into the proper "next-release" block. Also, retain the 2-blank-line separator between blocks. 2016-03-18 Jim Meyering <meyering@fb.com> maint: avoid spurious "binary file ... matches" in generated THANKS * Makefile.am (THANKS): Don't apply grep to a stream containing NUL bytes. Sync this rule from the one in coreutils: it was missing some improvements. Reported by Bailes Magio in http://bugs.gnu.org/22899 2016-03-18 Paul Eggert <eggert@cs.ucla.edu> grep: -oz now outputs null bytes, not newlines * NEWS: Document this. * doc/grep.texi (Other Options): Clarify that -z affects output as well as input data. * src/grep.c (print_line_middle): Output eolbyte, not newline, if -o. * tests/null-byte: Test -o too. * tests/pcre-context: Adjust test to match new behavior. 2016-03-17 Paul Eggert <eggert@cs.ucla.edu> grep: use errno consistently in write diagnostics Feature request and initial version reported by Assaf Gordon in: http://bugs.gnu.org/23031 * NEWS: Document this. * src/grep.c: Include <stdarg.h>. (stdout_errno): New static var. (write_error_seen): Remove; superseded by stdout_errno. All uses changed. (putchar_errno, fputs_errno, printf_errno, fwrite_errno) (fflush_errno): New static functions. (print_filename, print_sep, print_offset, print_line_head) (print_line_middle, print_line_tail, prline, prtext, grep) (grepdesc): Use them. * tests/write-error-msg: New file. * tests/Makefile.am (TESTS): Add it. 2016-03-10 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.24 * NEWS: Record release date. 2016-02-28 Jim Meyering <meyering@fb.com> maint: add dist-check.mk This file augments "make distcheck" rules. * dist-check.mk: New file, from coreutils via gzip. * Makefile.am (EXTRA_DIST): Add it. * cfg.mk: Include it. 2016-02-21 Paul Eggert <eggert@cs.ucla.edu> grep: -Pz is incompatible with ^ and $ Problem reported by Sergei Trofimovich in: http://bugs.gnu.org/22655 * NEWS: Document this. * src/pcresearch.c (Pcompile): Warn with -Pz and anchors. * tests/pcre: Test new behavior. 2016-02-21 Jim Meyering <meyering@fb.com> tests: test cleanup * tests/z-anchor-newline: Remove test artifact that would write to /t/x. 2016-02-20 Jim Meyering <meyering@fb.com> grep -z: avoid erroneous match with regexp anchor and \n in text * src/dfasearch.c (EGexecute): Clear the newline_anchor bit when eolbyte is not '\n'. * tests/z-anchor-newline: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Describe it. Originally reported by Ulrich Mueller in https://bugs.gentoo.org/show_bug.cgi?id=574662 Reported to us by Sergei Trofimovich as http://debbugs.gnu.org/22655 tests: convert "cmd && fail=1" to "returns_ 1 cmd || fail=1" The latter is robust, while the former can silently ignore failure due to signals. * cfg.mk (sc_prohibit_and_fail_1): New rule, copied from coreutils. * tests/long-pattern-perf: Perform the above substitution. * tests/mb-non-UTF8-performance: Likewise. * tests/help-version: Merge from coreutils. 2016-02-09 Jim Meyering <meyering@fb.com> maint: add a check-very-expensive target * Makefile.am (check-very-expensive): New convenience rule, currently merely equivalent to check-expensive. 2016-02-04 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.23 * NEWS: Record release date. 2016-02-02 Jim Meyering <meyering@fb.com> gnulib: update to latest Update for this "make distcheck"-fixing change: > verify-tests: also remove stray test-verify.Tpo 2016-02-01 Jim Meyering <meyering@fb.com> tests/null-byte: test another code path * tests/null-byte: Also exercise the case in which there is a match in the block along with the NUL byte. 2016-01-31 Paul Eggert <eggert@cs.ucla.edu> Omit excess "Binary file ... matches" Problem reported in: http://bugs.gnu.org/22461 * src/grep.c (grep): Don't report "Binary file ... matches" merely because the file contained both matches and binary data. Insist that the binary data contained a match. * tests/null-byte: Add a test for this. 2016-01-28 Jim Meyering <meyering@fb.com> gnulib: update to latest 2016-01-23 Jim Meyering <meyering@fb.com> gnulib: update to latest maint: fix typo in NEWS: s/a/an/ 2016-01-15 Paul Eggert <eggert@cs.ucla.edu> grep: -x now supersedes -w more consistently * NEWS, doc/grep.texi (Matching Control): Mention this. * src/dfasearch.c (EGexecute): * src/pcresearch.c (Pcompile): Don't get confused by -w if -x is also present. * src/pcresearch.c (Pcompile): Remove misleading comment about non-UTF-8 multibyte locales, as PCRE doesn't support them. Calculate buffer sizes more carefully; the old method allocated a buffer slightly too big, seemingly due to luck. * tests/backref-word, tests/pcre: Add tests for this bug. tests: omit update-copyright-tests This test does not check how 'grep' itself operates, so it is out of place for grep's 'make check'. Problem reported by Sam Razavi in: http://bugs.gnu.org/22376 * bootstrap.conf (avoided_gnulib_modules): Add update-copyright-tests. 2016-01-11 Jim Meyering <meyering@fb.com> tests: do use "yes" but via an AWK replacement Also, use sed Nq in place of head -N * tests/init.cfg (yes): Define. Thanks to Paul Eggert for this definition. * tests/max-count-overread: Revert to using "yes". * tests/mb-non-UTF8-performance: Likewise, and use "sed Nq" in place of head -N. 2016-01-11 Paul Eggert <eggert@cs.ucla.edu> * tests/pcre-count: Don't assume the page size is 32kB. 2016-01-08 Paul Eggert <eggert@cs.ucla.edu> tests: port to other POSIXish platforms I tested this on Solaris 10 and AIX 7.1. * tests/max-count-overread: * tests/mb-non-UTF8-performance: Don't assume 'yes' exists, as 'yes' is not in POSIX. * tests/mb-non-UTF8-performance: Don't rely on 'head -1000', as that option syntax is not POSIX. * tests/pcre-count: Don't rely on "printf '\x0'". * tests/unibyte-binary: Don't assume \200 is an encoding error in every unibyte locale. 2016-01-08 Jim Meyering <meyering@fb.com> tests: fix encoding-error test failure to use of printf '\xHH' * tests/encoding-error: Don't rely on printf having support for \xHH hexadecimal. That is not portable. Use \OOO octal, instead. maint: fix typo in NEWS: s/a/an/ 2016-01-07 Jim Meyering <meyering@fb.com> mb-non-UTF8-performance: avoid FP test failure on fast hardware * tests/mb-non-UTF8-performance: Don't use a fixed size. Otherwise, on a fast system, the fixed-size unibyte test would complete in a nominal 0 ms, which might well be smaller than 1/30 of the multibyte duration, provoking a false positive test failure. Instead, increase the size of the input until we obtain a unibyte duration of at least 10ms. 2016-01-07 Paul Eggert <eggert@cs.ucla.edu> doc: mention unibyte encoding fix * NEWS: Document recent fix for encoding errors in unibyte locales. grep: improve unibyte -P performance This is a followon to the recent changes prompted by Bug#20526. In <http://bugs.gnu.org/bug=20526#86> Norihiro Tanaka pointed out that grep mistakenly assumed that unibyte locales cannot have encoding errors. Here, the mistake hurt performance significantly. On Fedora 23 x86-64 in the C locale, this patch improved grep's performance by a factor of 7 when run as "grep -P 'z.*a'" on the output of "yes $(printf '\200\n') | head -n 1000000000". * src/pcresearch.c (multibyte_locale) [HAVE_LIBPCRE]: New static var. (Pcompile): Set it. (Pexecute): Use it to avoid the need to call buf_has_encoding_errors in unibyte locales. 2016-01-06 Paul Eggert <eggert@cs.ucla.edu> Improve on fix for Bug#22181 * src/pcresearch.c (Pexecute): Update subject when skipping past easily-determined encoding errors, as this is faster than letting pcre_exec skip them. On my platform this improves performance 4.7x on a benchmark created via "yes $(printf '\200\200\200\200 \200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200x\n') | head -n 1000000 >j; grep -oP y j" in a UTF-8 locale. Rework code that deals with PCRE_ERROR_BADUTF8 return, to avoid an incorrect (albeit currently harmless) 'bol = false' assignment. grep: restore -P optimization (followup fix) * src/search.h (EGexecute, Fexecute, Pexecute): Change decls to match new implementations. I forgot to add this file to the previous commit. grep: restore -P PCRE_NO_UTF8_CHECK optimization On my platform in the en_US.utf8 locale, this makes 'grep -P "z.*a" k' 220x faster, where k is created by the shell command: yes 'abcdefg hijklmn opqrstu vwxyz' | head -n 10000000 >k * src/dfasearch.c (EGexecute): * src/grep.c (execute_fp_t): * src/kwsearch.c (Fexecute): * src/pcresearch.c (Pexecute): First arg is now char *, not char const *, since Pexecute now temporarily modifies this argument. * src/grep.c, src/grep.h (buf_has_encoding_errors): Now extern. * src/pcresearch.c (Pexecute): Use it. If the input is free of encoding errors, use a multiline search and the PCRE_NO_UTF8_CHECK option, as this is typically way faster. This restores an optimization that was removed with the recent changes for binary file detection. 2016-01-05 Paul Eggert <eggert@cs.ucla.edu> Fix calculation of unibyte_mask * src/grep.c (initialize_unibyte_mask): The old method worked for UTF-8 and other typical encodings, but did not work for weird encodings, e.g., one where all bytes other than 0x7f and 0x80 are unibyte characters. 2016-01-01 Paul Eggert <eggert@cs.ucla.edu> grep: fix bug with with invalid unibyte sequence This was introduced by the recent binary-data-detection changes. Problem reported by Norihiro Tanaka in: http://bugs.gnu.org/20526#86 * src/grep.c (HIBYTE, easy_encoding, init_easy_encoding): Remove, replacing with ... (uword_max, unibyte_mask, initialize_unibyte_mask): ... this new constant, static var, and function. All uses changed. The unibyte_mask var generalizes the old local var hibyte_mask, which worked only for encodings where every byte with 0x80 turned off is a single-byte character. (buf_has_encoding_errors): Return false immediately if unibyte_mask is zero, not whether the current encoding is unibyte. The old test was incorrect in unibyte locales in which some bytes were encoding errors. * tests/pcre-z: Require UTF-8 locale, since the grep -z . test now needs this. Use printf \0 rather than tr. Port the 'grep -z .' test to platforms where the C locale says '\200' is an encoding error. Use cmp rather than compare, as the file is binary and so non-GNU diff might not work. * tests/unibyte-binary: New file. * tests/Makefile.am (TESTS): Add it. 2016-01-01 Jim Meyering <meyering@fb.com> maint: update copyright year, bootstrap, init.sh Run "make update-copyright" and then... * gnulib: Update to latest. * tests/init.sh: Update from gnulib. * bootstrap: Likewise. 2015-12-31 Paul Eggert <eggert@cs.ucla.edu> doc: clarify text vs binary match output * NEWS: * doc/grep.texi (File and Directory Selection): Make it clearer that grep can now output matching text before reporting a binary match. Problem reported by Norihiro Tanaka in: http://bugs.gnu.org/20526#83 doc: minor clarifications * doc/grep.in.1, doc/grep.texi: Minor clarifications suggested by Debian documentation patches. Problem reported by Santiago Ruano Rincón in: http://bugs.gnu.org/18651 grep: fix -l --line-buffer bug Problem reported by Louis Sautier in: http://bugs.gnu.org/18750 * NEWS: Document this. * src/grep.c (grep, grepdesc): If --line-buffered, flush stdout after outputting newline (or null byte, if applicable). 2015-12-30 Paul Eggert <eggert@cs.ucla.edu> grep: remove duplicate init * src/grep.c (print_line_middle): Remove duplicate initialization. grep: report line-buffered write error right away * src/grep.c (prline): When line buffered, if there is a write error, report it immediately rather than waiting until the next line of output. grep: -c should keep counting after binary data Problem and fix reported by Jaroslav Å karvada, and test case reported by Norihiro Tanaka, in: http://bugs.gnu.org/22028 * NEWS: Document this. * src/grep.c (grep): Don't stop counting merely because nulls seen. * tests/pcre-count: New file. * tests/Makefile.am (TESTS): Add it. dfa: port to tinycc * src/dfa.c (add_utf8_anychar): Put 'const' after type. Problem reported by Aharon Robbins in: http://bugs.gnu.org/22260 grep: be less picky about encoding errors This fixes a longstanding problem introduced in grep 2.21, which is overly picky about binary files. * NEWS: * doc/grep.texi (File and Directory Selection): Document this. * src/grep.c (input_textbin, textbin_is_binary, buffer_textbin) (file_textbin): Remove. All uses removed. (encoding_error_output): New static var. (buf_has_encoding_errors, buf_has_nulls, file_must_have_nulls): New functions, which reuse bits and pieces of the removed functions. (lastout, print_line_head, print_line_middle, print_line_tail, prline) (prpending, prtext, grepbuf): Avoid use of const, now that we have functions that require modifying a sentinel. (print_line_head): New arg LEN. All uses changed. (print_line_head, print_line_tail): Return indicator whether the output line was printed. All uses changed. (print_line_middle): Exit early on encoding error. (grep): Use new method for determining whether file is binary. * src/grep.h (enum textbin, TEXTBIN_BINARY, TEXTBIN_UNKNOWN) (TEXTBIN_TEXT, input_textbin): Remove decls. All uses removed. * src/pcresearch.c (Pexecute): Remove multiline optimization, since the main program no longer checks for encoding errors on input. * tests/encoding-error: New file. * tests/Makefile.am (TESTS): Add it. 2015-12-29 Jim Meyering <meyering@fb.com> maint: correct (make sorted) order of test file names * tests/Makefile.am (TESTS): Insert new test name in sorted order. 2015-12-28 Paul Eggert <eggert@cs.ucla.edu> grep: --exclude matches trailing parts of args Problem reported by Vincent Lefevre in: http://bugs.gnu.org/22144 * NEWS: * doc/grep.texi (File and Directory Selection): Document this. * src/grep.c (excluded_patterns, excluded_directory_patterns): Now 2-element arrays, with one element for subfiles and another for command-line args. All uses changed. This implements the change. (exclude_options): New function. * tests/include-exclude: Test the change. 2015-12-18 Jim Meyering <meyering@fb.com> grep -oP: don't infloop when processing invalid UTF8 preceding a match * src/pcresearch.c (Pexecute): When advancing SUBJECT past an encoding error, don't blindly set P to that new value, since we will soon compute SEARCH_OFFSET = P - SUBJECT, and mistakenly making that difference too small would allow us to match some previously-processed text, resulting in an infinite loop. * NEWS (Bug fixes): Mention it. * THANKS.in: Add Christian's name and email address. * tests/pcre-invalid-utf8-infloop: New file. * tests/Makefile.am (TESTS): Add it. Reported by Christian Boltz in http://debbugs.gnu.org/22181 Introduced by commit, v2.21-37-g14f8e48. 2015-11-04 Jim Meyering <meyering@fb.com> tests: mark performance-related tests as expensive These performance-related tests are slightly failure prone due to varying system load during the two runs. Marking these tests as "expensive" makes it so they are no longer run via "make check". You can still run them via make "check-expensive". This makes them less likely to be run by regular users. * tests/long-pattern-perf: Use expensive_. * tests/mb-non-UTF8-performance: Likewise. Reported by Jaroslav Skarvada in http://debbugs.gnu.org/21826 and by Andreas Schwab in http://debbugs.gnu.org/21812. 2015-11-01 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.22 * NEWS: Record release date. tests: pcre-jitstack: upon failure, retry with no stack size limit * tests/pcre-jitstack: Don't let an example that provokes inordinate stack space use cause a test failure. Thanks to reports from and analysis by Bruce Dubbs; see http://debbugs.gnu.org/21755 2015-10-27 Jim Meyering <meyering@fb.com> maint: update THANKS.in * THANKS.in: Add name+email of those who found and reported the bug that made grep -E '^x|x$' match any "x". 2015-10-25 Zev Weiss <zev@bewilderbeest.net> dfa: plug a memory leak in dfamust * src/dfa.c (dfamust): Ensure MP is freed, by refraining from returning early when, at "done:" *RESULT is NULL. 2015-10-25 Jim Meyering <meyering@fb.com> gnulib: update to latest * gnulib: Pull in one more portability fix: stdalign: port to Sun C 5.9 2015-10-24 Jim Meyering <meyering@fb.com> gnulib: update to latest, for portability fixes * gnulib: Pull in changes like these: fts: port to C11 alignof stdalign: work around pre-4.9 GCC x86 bug maint: NEWS: correct/amend * NEWS: Move the long-regexp-performance-improvement from "Bug fixes" to "Improvements." Say more and include an example. The -Fw degradation was introduced in commit v2.18-125-g94555dd tests: avoid spurious failure on OpenBSD 5.8 * tests/fedora: Don't rely on "diff - FILE" reading from stdin. Reported privately by Nelson Beebe. 2015-10-17 Jim Meyering <meyering@fb.com> gnulib: update to latest; also bootstrap and tests/init.sh * bootstrap: Update from gnulib. * tests/init.sh: Likewise. * gnulib: Update submodule to latest. build: avoid spurious bootstrap failure involving pkg.m4 Running ./bootstrap could fail mistakenly at the very end in its attempt to obtain a copy of pkg.m4. It would search only $(aclocal --print-ac-dir) and some other directories, but not those listed in $(aclocal --print-ac-dir)/dirlist. * bootstrap.conf (bootstrap_post_import_hook): Also search the directories named in $(aclocal --print-ac-dir)/dirlist when that file exists with nonzero size. 2015-10-16 Paul Eggert <eggert@cs.ucla.edu> maint: add news item * NEWS: Document grep -Fw speedup. grep: simplify previous change * src/grep.c (main): Simplify recently-changed grep -Fw test. 2015-10-16 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: use grep matcher for grep -Fw when unibyte In single byte locales with grep -Fw, prefer the grep matcher to the kwset matcher, as the former uses KWset and a DFA, whereas the latter calls kwsexec many times until it matches a word. * src/grep.c (main): Change pattern for fgrep into grep for grep -Fw in single byte locales. 2015-10-16 Paul Eggert <eggert@cs.ucla.edu> grep: use memchr/memrchar * src/kwsearch.c (Fexecute): Prefer memchr and memrchr to doing it by hand. 2015-10-16 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: improve performance of grep -Fw * src/kwsearch.c (Fexecute): grep -Fw examined whether the previous character is a word character after matching from the head of the buffer. It is extremely slow. Now, if grep found a potential match, it looks for the previous newline, and examines from there. 2015-10-13 Jim Meyering <meyering@fb.com> maint: use single quote rather than UTF-8 multi-byte version * tests/backref-alt: Translate unnecessary non-ASCII in comment. 2015-10-13 Paul Eggert <eggert@cs.ucla.edu> dfa: make the executable a bit smaller * src/dfa.c (dfamust): Hoist MB_CUR_MAX calculation out of loops. 2015-10-13 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: fix bug in alternate of sub-patterns that differ only in constraints Fix a bug where a line incorrectly matches alternates of sub-patterns that differ only in the constraints, e.g., the ERE '^a|a$'. Reported by Greg Boyd in: http://debbugs.gnu.org/21670 * src/dfa.c (dfamust): For a pattern with constraints, check that it is matched including the constraints, to judge whether it is exact. dfa: fix off-by-one error * src/dfa.c (dfamust): Fix off-by-one error in computing 'must' length, which caused the 'must' to be too short. See: http://bugs.gnu.org/21670#28 2015-10-12 Jim Meyering <meyering@fb.com> doc: NEWS: mention a bug fix * NEWS (Bug fixes): Describe it. This bug was introduced by commit v2.18-85-g2c94326 and fixed by commit v2.21-51-g256a4b4. 2015-10-11 Paul Eggert <eggert@cs.ucla.edu> tests: add test case for Bug#21670 * tests/options: Add test #4 to catch Bug#21670. Also, do not overescape # in shell strings. 2015-09-19 Paul Eggert <eggert@cs.ucla.edu> Add test for pop_fail_stack bug Problem reported by Hanno Böck in: http://bugs.gnu.org/21513 If you use --with-included-regex the bug fix is in gnulib, here: http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=5513b40999149090987a0341c018d05d3eea1272 If you use glibc, the bug fix has not been installed yet. * tests/Makefile.am (XFAIL_TESTS): Add backref-alt if system matcher. (TESTS): Add backref-alt. * tests/backref-alt: New file. * tests/triple-backref: Remove unused var. Don't skip if tested with glibc, as Makefile.am now handles this. build: update gnulib submodule to latest 2015-08-19 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: avoid use of uninitialized variable EGexecute would use "backref" uninitialized. While that could have no bearing on correctness, it could impact performance, via an unnecessary use of regexp. * src/dfasearch.c (EGexecute): Initialize backref. Reported as http://debbugs.gnu.org/21273 Introduced by commit v2.21-55-gea0ebaa. 2015-08-12 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: remove fgrep code for case insensitive match The fgrep matcher is no longer called in case insensitive matching, so remove the code to support it. * src/kwsearch.c (mb_case_map_apply): Remove function. (Fexecute): Remove now-unused code. 2015-08-12 Paul Eggert <eggert@cs.ucla.edu> dfa: optimize [x-x] * src/dfa.c (parse_bracket_exp): Treat [x-x] as if it were [x]. This also pacifies GCC, which otherwise complains about wc2 being set but not used. 2015-08-12 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: remove unused multibyte support Now regex should be used for range, collating element, equivalent class in non POSIX locales. So remove code to support these features. * dfa.c (struct mb_char_classes): Remove members ch_classes, nch_classes, ranges, nranges, equivs, nequivs, coll_elems, ncoll_elems. All uses removed. (match_mb_charset): Remove function. 2015-08-01 Jim Meyering <meyering@fb.com> tests: mb-non-UTF8-performance: use new function * tests/mb-non-UTF8-performance: Rewrite to use the user-time measuring function in init.cfg. tests: long-pattern-perf: measure user time, not elapsed Measuring user time makes this test less prone to false positive failure, and also lets us use a tighter bound. * tests/long-pattern-perf: Measure elapsed user time rather than wall-clock time, to permit a tighter bound on the ratio of N-to-10N timings. Suggested by Giuseppe Ottaviano. Also, use regexps built from mostly 5-digit numbers, so that the 10:1 ratio applies to lines of "seq" output as well as to total bytes. tests: new function to measure elapsed user time * tests/init.cfg (user_time_): New function. 2015-07-25 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: remove word delimiter support for multibyte locales DFA supports word delimiter expressions, but it does not behave correctly for multibyte locales. Even if it were to be fixed, the DFA matcher's performance would be no better than that of regex. Thus, this change removes DFA support for word delimiter expressions in multibyte locales. * src/dfa.c (dfa_supported): Return false also when a pattern uses any word delimiter expression in a multibyte locale. 2015-07-25 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: avoid execution for a pattern including an unsupported expression If a pattern includes a construct unsupported by the DFA matcher, the DFA search would fail in most cases. Make dfaexec immediately return for any such pattern. * src/dfa.c (struct dfa_state) [has_backref, has_mbcset]: Remove members and all uses. (dfaexec_main): Remove 'backref' parameter. Update callers. (dfaexec_noop): New function. (dfa_supported): New function. (dfassbuild): Remove now-unused code. (dfacomp): When a pattern uses a DFA-unsupported construct, do not waste time performing any further analysis. 2015-07-19 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: DEBUG: print detail of DFA states When compiled with -DDEBUG, grep outputs tokens etc. With this change, also print DFA states and transitions. This change is very useful when debugging those. * src/dfa.c (prtok) [DEBUG]: Change `%c' to `%02x' in printf format. (state_index) [DEBUG]: Print detail of new state. (dfastate) [DEBUG]: Print detail of DFA states. Reported as http://debbugs.gnu.org/18707 2015-07-18 Norihiro Tanaka <noritnk@kcn.ne.jp> tests: sjis-mb: accept two more locales * tests/sjis-mb: Accept the ja_JP.SJIS and ja_JP.PCK locales as well as ja_JP.SHIFT_JIS, so this test is less likely to be skipped unnecessarily. Reported as http://bugs.gnu.org/18983 2015-07-18 Jim Meyering <meyering@fb.com> tests: add a test for the performance fix * tests/long-pattern-perf: New file. * tests/Makefile.am (TESTS): Add it. 2015-07-18 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: speed up handling of long pattern DFA tries to find a long sequence of characters that must appear in any matching line. However, when a pattern is long (length N), it is very slow, because it makes O(N^2) strstr calls. This change reduces that to O(N) by processing each sequence of adjacent "regular" characters as a group. Compare the run times of this command before and after this change: (on a i7-4770S CPU @ 3.10GHz using rawhide (~fedora 22) and compiled with gcc 6.0.0 20150627) : | env time -f %e grep -f <(seq -s '' 9999) Before: 0.85 After: 0.02 * src/dfa.c (dfamust): Process each string of concatenated normal characters as a unit. * NEWS (Improvement): Mention it. Prompted by a bug report and patch by Ivan Yanikov in http://bugs.gnu.org/15191#5 2015-07-17 Jim Meyering <meyering@fb.com> tests: fix mis-applied patch. * tests/include-exclude: I applied "|sort" to the wrong creation of "out", and didn't push the same patch that I'd tested. tests: avoid FS-dependent false-positive failure * tests/include-exclude: Sort file name list, so that this test is not sensitive to the order in which those names are returned via readdir. I noticed the failure on a Fedora 21 system using ext4. Also fix a typo: s/framework_failure+/framework_failure_/ 2015-07-13 Paul Eggert <eggert@cs.ucla.edu> grep: fix bug with --exclude-dir and command line Reported by Aron Griffis in: http://bugs.gnu.org/21027 * NEWS: Document this. * src/grep.c (grepdirent): Don't check whether the file is skipped when on the command line, as that's the caller's responsibility. (main): Anchor the exclude patterns. * tests/include-exclude: Adjust test case to match fixed behavior. Add some more test cases. tests: fix $? typo in null-byte * tests/null-byte: Don't assume $? survives an invocation of 'test'. 2015-07-05 Jim Meyering <meyering@fb.com> maint: dfa: used unsigned types where appropriate * src/dfa.c (case_folded_counterparts): Return unsigned int, not int. Change type of two locals to unsigned int, to reflect that their values are never negative. (parse_bracket_exp): Adjust type of result at each use, as well as that of related index variables. 2015-07-04 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: build struct dfamust on demand If we won't use KWset, do not build a "struct dfamust". Now it is built only when needed. * src/dfa.c (struct dfa) [musts]: Remove member. (dfacomp): Don't build dfamust here. (dfamustfree): New function to free a struct dfamust. (dfamust): Make it a global function, and make it return a pointer to a malloc'd struct dfamust. (dfamusts): Remove it. * src/dfa.h (struct dfamust) [next]: Remove member. In the implementation preceding this patch, there was never more than one of these in a given "struct dfa". (dfamustfree, dfamust): Add prototypes. (dfamusts): Remove prototype. (dfaalloc): Declare with _GL_ATTRIBUTE_MALLOC. To make that symbol usable there, move the inclusion of "xalloc.h" from dfa.c to this file, dfa.h. * src/dfasearch.c (kwsmusts): Adapt to use the new interface. Update the comments to reflect reality. This addresses http://bugs.gnu.org/17715 2015-07-04 Paul Eggert <eggert@cs.ucla.edu> grep: use recent gnulib syntax bits * src/grep.c (Gcompile, Ecompile): Use plain RE_SYNTAX_GREP and RE_SYNTAX_EGREP, now that we assume a recent-enough gnulib. maint: ignore gendocs_template_min * doc/.gitignore: Add '/gendocs_template_min'. build: update gnulib submodule to latest dfa: '.' and '[^x]' now consistently match newline * src/dfa.c (parse_bracket_exp, lex, add_utf8_anychar) (match_anychar): RE_DOT_NEWLINE and RE_HAT_LISTS_NOT_NEWLINE are about LF, not about eolbyte. This patch does not affect 'grep', but may affect other users of dfa.c. grep: -z '[^x]' now consistently matches newline Problem reported by Norihiro Tanaka in: http://bugs.gnu.org/20974#19 * NEWS: Document this. * src/grep.c (Gcompile, Ecompile): Clear RE_HAT_LISTS_NOT_NEWLINE. * tests/utf8-bracket: Test this. 2015-07-03 Paul Eggert <eggert@cs.ucla.edu> grep: -z '.' now consistently matches newline Problem reported by Balazs Kezes in: http://bugs.gnu.org/20974 * NEWS: Document this. * tests/utf8-bracket: New file, to test for this bug. * src/grep.c (Gcompile, Ecompile): Also specify RE_DOT_NEWLINE. * tests/Makefile.am (TESTS): Add it. grep: simplify print_line_middle slightly * src/grep.c (print_line_middle): Simplify. grep: don't mishandle left context in -P http://bugs.gnu.org/20957 * src/pcresearch.c (jit_exec): New arg SEARCH_OFFSET. Caller changed. (Pexecute): Pass the left context to pcre_exec, so that PCRE regular-expression matching can see it. * tests/pcre-context: New file, to test for this bug. * tests/Makefile.am (TESTS): Add it. 2015-06-28 Jim Meyering <meyering@fb.com> tests/case-fold-backref: factor test 2015-06-26 Paul Eggert <eggert@cs.ucla.edu> grep: don't hang on command-line fifo if -D skip * NEWS: Document this. * src/grep.c (skip_devices): New function, with code taken from grepdirent. (grepdirent): Use it. Avoid an unnecessary initialization. (grepfile): If skipping devices, open files with O_NONBLOCK. Throw in O_NOCTTY while we're at it. (grepdesc): Skip devices here, too. Not only does this fix the bug, it fixes an unlikely race condition if some other process renames a device between fstatat and openat. * tests/skip-device: Add a test for this bug. grep: minor tweaks * src/grep.c (main): Change recently-added static vars to be constants, which makes them sharable. Prefer 'return' to 'exit' when returning/exiting from 'main'. Move decl closer to first use and rename local from 'ok' (which was confusing) to 'status'. Prefer named constant STDOUT_FILENO to unnamed constant 1. 2015-06-26 Jim Meyering <meyering@fb.com> maint: unify three argv-processing calls * src/grep.c (main): Unify three calls to grep_commandline_arg. maint: alphabetize anonymous enum member names 2015-05-30 Paul Eggert <eggert@cs.ucla.edu> test: tighten tests for bracket exprs * tests/posix-bracket: Test '[a-a[.-.]--]'. Also, test that failures are with status 1 (nonmatching data), not status 2 (invalid expressions). 2015-04-26 Jim Meyering <meyering@fb.com> maint: update bootstrap from gnulib * bootstrap: Update from gnulib. maint: reword a diagnostic not to trigger leading capital check * src/pcresearch.c: Reword diagnostic to avoid "make syntax-check" failure. maint: sort test names in tests/Makefile.am and add syntax-check rule * cfg.mk (sc_sorted_tests): New rule. * tests/Makefile.am (TESTS): Alphabetize. 2015-04-25 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: make find_pred return NULL for an invalid predicate This could never happen when invoked via grep, but could have triggered a bug if dfa.c's find_pred function were invoked by some other program. * src/dfa.c (find_pred): Return NULL for an invalid predicate. * tests/invalid-char-class: New file to test for this. * tests/Makefile.am (TESTS): Add that new file name to the list. This addresses http://debbugs.gnu.org/18631 2015-04-06 Paul Eggert <eggert@cs.ucla.edu> build: improve pkg-config doc and error handling Error-handling improvement suggested by Mike Frysinger in: http://bugs.gnu.org/16757#29 * NEWS: Document pkg-config changes. * README-prereq: pkg-config is now a prereq when building from repository. * m4/pcre.m4 (gl_FUNC_PCRE): Report an error if pcre is explicitly requested but not available. Defer to user-supplied PCRE_CFLAGS and PCRE_LIBS. build: remove typo and don't bother with /usr/include/pcre Problem reported by Holger Bruenjes. * m4/pcre.m4: Remove test for /usr/include/libpng (a typo). Come to think of it, don't bother worrying about /usr/include/pcre, as hosts with that problem can use pkg-config or configure with CFLAGS by hand. build: use pkg-config (if available) to configure libpcre Problem reported by Mike Frysinger in: http://bugs.gnu.org/16757 * bootstrap.conf (bootstrap_post_import_hook): Copy pkg-config's pkg.m4. * configure.ac: Invoke PKG_PROG_PKG_CONFIG. * m4/pcre.m4 (gl_FUNC_PCRE): Rewrite to use pkg-config if available, and to test that pcre_compile can be linked to. * src/Makefile.am (AM_CFLAGS): Add PCRE_CFLAGS. (grep_LDADD): Add PCRE_LIBS. * src/pcresearch.c: Simply include <pcre.h> if HAVE_LIBPCRE, since 'configure' arranges for the appropriate -I option now. 2015-03-11 Paul Eggert <eggert@cs.ucla.edu> grep: output "." file name in diagnostic This is bug C as reported by David Grayson in: http://bugs.gnu.org/16444#18 This bug occurs only in obscure circumstances, and I didn't see how to write a reasonable test case for it. * src/grep.c (filename_prefix_len): Remove, replacing with ... (omit_dot_slash): New static var. All uses of the former replaced with uses of the latter. (grepdirent): Don't add 2 if the filename is just ".". egrep, fgrep: just use what's in PATH * src/egrep.sh: Don't monkey with PATH; just use whatever 'grep' is in the path. This is simpler, and lets the user specify default options with a script for only grep, with no need for egrep and fgrep scripts. Fixes: bug#19998 doc: give a script wrapper example * doc/grep.texi (Environment Variables): Give an example of a wrapper script, as an alternative to using GREP_OPTIONS. Fixes: bug#19998 doc: clarify how -a matches * doc/grep.in.1, doc/grep.texi (File and Directory Selection): Give an example of how non-text bytes affect pattern matching in binary files. Fixes: bug#20080 2015-02-23 Paul Eggert <eggert@cs.ucla.edu> Cover the non-INSTALL case * README: Mention what to do if there is no INSTALL file. Fixes: bug#19928 2015-02-11 Jim Meyering <meyering@fb.com> maint: use ASAN-poisoning more carefully The ASAN-poisoning instituted by commit v2.21-14-g1555185 was incomplete, since the poisoned tail of the read buffer could well be the target of a legitimate follow-on read. To accommodate that, we must unpoison each such region just before beginning fillbuf's read loop. * src/grep.c [HAVE_ASAN] (asan_poison): Define. (clear_asan_poison): Define. (fillbuf): Clear before reading, since we are likely to read into memory that was poisoned on the preceding iteration. * tests/two-files: New file, to test for this. * tests/Makefile.am (TESTS): Add it. 2015-02-10 Paul Eggert <eggert@cs.ucla.edu> Grow the JIT stack if it becomes exhausted Problem reported by Oliver Freyermuth in: http://bugs.gnu.org/19833 * NEWS: Document the fix. * tests/Makefile.am (TESTS): Add pcre-jitstack. * tests/pcre-jitstack: New file. * src/pcresearch.c (NSUB): Move decl earlier, since it's needed earlier now. (jit_stack_size) [PCRE_STUDY_JIT_COMPILE]: New static var. (jit_exec): New function. (Pcompile): Initialize jit_stack_size. (Pexecute): Use new jit_exec function. Report a useful diagnostic if the error is PCRE_ERROR_JIT_STACKLIMIT. 2015-02-01 Jim Meyering <meyering@fb.com> maint: reference CVE-2015-1345 from NEWS * NEWS: Mention the CVE that was addressed by v2.21-13-g83a95bd, "grep -F: fix a heap buffer (read) overrun". 2015-01-18 Jim Meyering <meyering@fb.com> maint: convert "goto" to "continue" and remove now-spurious label * src/kwset.c (bmexec_trans): Using "goto big_advance" here is equivalent to using "continue". Make that change and remove the now-unused label. 2015-01-10 Jim Meyering <meyering@fb.com> tests: add support for ASAN memory poisoning This lets us reliably detect with ASAN some UMR bugs that would otherwise be detectable only some of the time with MSAN. Use __asan_poison_memory_region to mark the unused portion of a read buffer as inaccessible. Then, with ASAN, any attempt to access those bytes results in an ASAN abort. * src/system.h: Include "ignore-value.h". (__has_feature): Define. (HAVE_ASAN): Define when address sanitizer is enabled. [HAVE_ASAN]: Declare these two __asan_* symbols. [!HAVE_ASAN] (__asan_poison_memory_region): Define stub. [!HAVE_ASAN] (__asan_unpoison_memory_region): Likewise. * src/grep.c: Use __asan_poison_memory_region. 2015-01-09 Yuliy Pisetsky <ypisetsky@fb.com> grep -F: fix a heap buffer (read) overrun grep's read buffer is often filled to its full size, except when reading the final buffer of a file. In that case, the number of bytes read may be far less than the size of the buffer. However, for certain unusual pattern/text combinations, grep -F would mistakenly examine bytes in that uninitialized region of memory when searching for a match. With carefully chosen inputs, one can cause grep -F to read beyond the end of that buffer altogether. This problem arose via commit v2.18-90-g73893ff with the introduction of a more efficient heuristic using what is now the memchr_kwset function. The use of that function in bmexec_trans could leave TP much larger than EP, and the subsequent call to bm_delta2_search would mistakenly access beyond end of the main input read buffer. * src/kwset.c (bmexec_trans): When TP reaches or exceeds EP, do not call bm_delta2_search. * tests/kwset-abuse: New file. * tests/Makefile.am (TESTS): Add it. * THANKS.in: Update. * NEWS (Bug fixes): Mention it. Prior to this patch, this command would trigger a UMR: printf %0360db 0 | valgrind src/grep -F $(printf %019dXb 0) Use of uninitialised value of size 8 at 0x4142BE: bmexec_trans (kwset.c:657) by 0x4143CA: bmexec (kwset.c:678) by 0x414973: kwsexec (kwset.c:848) by 0x414DC4: Fexecute (kwsearch.c:128) by 0x404E2E: grepbuf (grep.c:1238) by 0x4054BF: grep (grep.c:1417) by 0x405CEB: grepdesc (grep.c:1645) by 0x405EC1: grep_command_line_arg (grep.c:1692) by 0x4077D4: main (grep.c:2570) See the accompanying test for how to trigger the heap buffer overrun. Thanks to Nima Aghdaii for testing and finding numerous ways to break early iterations of this patch. 2015-01-08 Jim Meyering <meyering@fb.com> grep: avoid false-positive UMR For some inputs, valgrind would report an uninitialized memory read error, but it was harmless. * src/grep.c (fillbuf): Initialize those trailing bytes. 2015-01-01 Jim Meyering <meyering@fb.com> gnulib: update to latest maint: update copyright year ranges to include 2015 Run "make update-copyright". Also, ... * grep.texi: Update manually, converting each "--" to "-". 2014-12-15 Paul Eggert <eggert@cs.ucla.edu> doc: document binary-data heuristic better Problem reported by Martin Hoch in: http://bugs.gnu.org/19388 * doc/grep.texi (File and Directory Selection): Document what non-text bytes are. (Usage): Fix cross reference. 2014-12-12 Jim Meyering <meyering@fb.com> maint: fix a new "make syntax-check" failure * tests/dfa-match-aux.c: s/can not/cannot/ 2014-12-12 Norihiro Tanaka <noritnk@kcn.ne.jp> build: avoid build failure with --enable-gcc-warnings and no PCRE * src/pcresearch.c [HAVE_LIBPCRE] (empty_match): Guard the declaration of this PCRE-only variable. 2014-12-07 Paul Eggert <eggert@cs.ucla.edu> tests: port fmbtest to CentOS 6 and earlier * tests/fmbtest: Port to platforms where the 'sed' pattern '[^0-9]' does not match every non-digit character. Problem reported by Norihiro Tanaka in: http://bugs.gnu.org/19293 2014-12-06 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: simplify dfaexec * src/dfa.c (dfaexec): Simplify by rearrangement of IF conditions. This commit induces no semantic change, and reverts part of commit v2.5.4-144-gbafa134. 2014-12-06 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: avoid invalid match or infinite loop in unused matching mode Neither grep nor gawk uses this DFA code in its matching mode, since each always calls dfacomp with a nonzero final argument. However, when used in that mode, it had bug: After failing to match in matching mode, it should return NULL, but instead would either report a false match or enter an infinite loop. * src/dfa.c (dfaexec_main): After failing to match in matching mode return NULL, rather than transitioning to the next state. * tests/dfa-match: Add a new test. * tests/dfa-match-aux.c: Add a new program to exercise this otherwise-unused part of dfa.c. * tests/Makefile.am: Add a rule to build new test. (check_PROGRAMS): Add dfa-match-aux. (AM_CPPFLAGS): Add -I$(top_srcdir)/src. (TESTS): Add dfa-match. * cfg.mk (exclude_file_name_regexp--sc_bindtextdomain): (exclude_file_name_regexp--sc_prohibit_atoi_atof): Exempt the new test file from some syntax-check rules. 2014-12-04 Santiago Ruano Rincón <santiago@debian.org> doc: document grep-2.11 change in behavior of -r, --recursive * doc/grep.texi (--recursive, -r): Mention the new behavior of recursively searching "." when there is no FILE argument. * doc/grep.in.1: Likewise. That change first appeared in grep-2.11, released on 2012-03-02. 2014-11-24 Jim Meyering <meyering@fb.com> maint: correct for four Author: name misspellings * .mailmap: Correct for misspelling in Norihiro Tanaka's last name as listed in four commit Author: fields: s/Norihirio/Norihiro/ 2014-11-23 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.21 * NEWS: Record release date. 2014-11-21 Jim Meyering <meyering@fb.com> tests: sjis-mb: remove now-obsolete and failing sub-tests * tests/sjis-mb: Commit v2.18-123-geb3292b changed how grep handles patterns with encoding errors. These SJIS tests are skipped so often that we didn't notice until now that there were two tests of that changed behavior, and that on any system with the ja_JP.SHIFT_JIS locale, they would always fail. Remove those two tests, since this functionality is well tested separately, via tests/prefix-of-multibyte. 2014-11-20 Norihiro Tanaka <noritnk@kcn.ne.jp> grep -F could erroneously fail to match in non-UTF8 multibyte locales This fixes a bug that can strike only when using a non-UTF8 multibyte locale like ja_JP.SHIFT_JIS. Consider this example: it would mistakenly fail to match before this patch: printf '\203AA\n'|LC_ALL=ja_JP.SHIFT_JIS src/grep -F A When searching for a single byte that happens to be the latter byte of a multibyte character, and the target byte also follows that multibyte character, grep -F would advance an internal pointer by one byte too many, thus missing the target byte. A test case for this bug is already included in tests/sjis-mb. * src/kwsearch.c (Fexecute): Skip one byte less, after matched middle of a multi-byte character. Introduced by commit v2.18-119-gfb7d538. 2014-11-17 Jim Meyering <meyering@fb.com> tests: big-match: disable OOM-provoking subtest * tests/big-match: Our application of this regexp '^.*x\(\)\1' to a file containing a single matching line of length 2GiB+2 would cause inordinate memory consumption (over 100GB) via regexec.c, but no leak. That would cause disruption on most systems, so remove this subtest. Reported by Assaf Gordon. 2014-11-16 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: avoid undefined behavior * src/dfa.c (dfassbuild): Don't call memcpy with a second argument of NULL, even when the size (3rd argument) is 0. 2014-11-14 Jim Meyering <meyering@fb.com> gnulib: update to latest 2014-11-14 Norihiro Tanaka <noritnk@kcn.ne.jp> grep -F -x -o PAT would print an extra newline for each match * src/kwsearch.c (Fexecute): Correctly compute the length of a match by subtracting 2 (not 1) when match_lines is set. With -x, we augment the "line" by both prepending and appending an EOLBYTE to the search pattern. Here, we must correct for that. However, to compensate, when we are using -x (--line-regexp) and start_ptr is NULL, we have to add 1 to the length so that we still print the trailing EOLBYTE. Introduced by commit v2.18-85-g2c94326. * tests/match-lines: Add a new test. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. 2014-11-11 Paul Eggert <eggert@cs.ucla.edu> tests: port to Darwin The 'sed' command 's/.//' does not delete all bytes in the C locale. Problem reported by Nelson H. F. Beebe. * tests/fmbtest: Don't assume that sed treats bytes with the top bit set as valid characters in the C locale, as this is not true for Darwin. Use the cs_CZ.UTF-8 locale instead, and simplify the sed script. tests: fix recently-introduced stray output * tests/init.cfg (require_pcre_): Remove stray debugging output. build: port to GCC 4.6.4 + glibc 2.5 On platforms this old, building with _FORTIFY_SOURCE equal to 2 results in duplicate definitions of standard library functions. Problem reported by Nelson H. F. Beebe. * configure.ac (_FORTIFY_SOURCE): Sort after GNULIB_PORTCHECK. By default, do not enable this unless GNULIB_PORTCHECK is defined. This better matches the original intent, which as I recall was to enable these extra checks only with --enable-gcc-warnings. tests: port to libpcre sans UTF-8 support Problem reported by Nelson H. F. Beebe. * tests/pcre-infloop, tests/pcre-invalid-utf8-input, tests/pcre-utf8: Skip the test unless PCRE works in an en_US.UTF-8 locale. 2014-11-09 Jim Meyering <meyering@fb.com> tests: do not fail when the zh_CN.UTF-8 locale is not installed * tests/word-multibyte: This test would fail on a system with no zh_CN.UTF-8 locale. Use it only if it is installed. tests: avoid hex_printf_ portability problems * tests/init.cfg (hex_printf_): Spell out a-f and A-F, for non-C locales, ensure that the input to sed is newline-terminated, and quote the final octal format string. Suggestions from Paul Eggert. 2014-11-08 Jim Meyering <meyering@fb.com> tests: avoid a multibyte tr portability problem * tests/init.cfg (tr): New wrapper function. See comments for details. Reported by Norihiro Tanaka in http://debbugs.gnu.org/18991 maint: remove spurious LC_ALL setting from one test * tests/word-multibyte: Remove unnecessary setting of LC_ALL. tests: fix typo in previous change * tests/init.cfg (hex_printf_): Fix typo s/A-f/A-F/. For the record, I introduced that error, not Norihiro. 2014-11-08 Norihiro Tanaka <noritnk@kcn.ne.jp> tests: avoid awk+printf+\xHH portability trap * tests/init.cfg (hex_printf_): Rewrite in terms of printf and sed. Using awk's printf with \xHH in the format string was not portable to the awk of Solaris 10, AIX 7 or HP-UX 11.23, as reported in http://debbugs.gnu.org/18987. * tests/word-multibyte: Use printf rather than hex_printf_, and give the character we're printing a name: e_acute (rather than A-grave), since that is used in other tests. a trailing \n in the format string, adjust by removing it, and instead invoking echo. * tests/multibyte-white-space: Simply remove each trailing \n. They were not needed. 2014-11-07 Jim Meyering <meyering@fb.com> tests: avoid printf+\xHH portability trap * tests/word-multibyte: Using the bourne shell's printf function with strings like "\xHH\xHH" happens to work for most interactive shells, but not for dash. That is not portable. Use our hex_printf_ awk wrapper instead. Without this change, this test would fail on a Debian system for which /bin/sh is configured to be "dash". maint: move helper function, hex_printf to init.cfg * tests/init.cfg (hex_printf_): New function, from ... * tests/multibyte-white-space: ... here. Reflect the s/hex_print/hex_printf_/ renaming. 2014-11-02 Paul Eggert <eggert@cs.ucla.edu> grep: port O_NOFOLLOW errno checking to NetBSD Problem reported by Assaf Gordon in: http://bugs.gnu.org/18892 * NEWS: Document it. * src/grep.c (open_symlink_nofollow_error): New function, which does the right thing on NetBSD. (grepfile): Use it. 2014-10-31 Jim Meyering <meyering@fb.com> build: generate man pages even when existing targets are read-only * doc/Makefile.am (grep.1): Use mv -f to move temporary to target, in case the target is read-only. Also, always make the generated files read-only. (egrep.1 fgrep.1): Likewise. This avoids a build failure reported by Eric Blake in http://lists.gnu.org/archive/html/bug-grep/2014-10/msg00112.html 2014-10-30 Jim Meyering <meyering@fb.com> tests: avoid false-positive failure due to some zh_CN.* locales On some systems, and for some zh_CN.* locales (e.g., OpenBSD5.5) the E-acute pair of bytes do not qualify as a word-constituent character. * tests/word-multibyte: Use zh_CN.UTF-8, rather than "zh_CN". Reported by Assaf Gordon and Bruce Dubbs in http://debbugs.gnu.org/18892 2014-10-29 Jim Meyering <meyering@fb.com> gnulib: update to latest; bootstrap, too * gnulib: Update to latest. * bootstrap: Copy latest from gnulib. 2014-10-28 Jim Meyering <meyering@fb.com> tests: make new test script executable * tests/word-multibyte: Make this file executable. 2014-10-28 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: make \w and \W work in multibyte locales Reported by Jaroslav Skarvada in: http://bugs.gnu.org/18817 Now, \w and \W are supported in not only single byte locale but multibyte locale. * src/dfa.c (PUSH_LEX_STATE, POP_LEX_STATE): Move definitions "up", so they are not within the function. (lex): Make \w and \W work in a multibyte locale, the same way we made \s and \S work. * tests/word-multibyte: New test for this change. * tests/Makefile.am: Add a rule to build new test. * NEWS (Bug fixes): Mention it. 2014-10-26 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: avoid false match in a non-UTF8 multibyte locale This command should print nothing: printf '\263\244\263\244\n' \ | LC_ALL=ja_JP.eucJP grep -E "$(printf '^x|\244\263')" Before this patch, it would print its sole input line. * src/dfa.c (struct dfa): Add new members: min_trcount, initstate_letter, initstate_others. (dfaanalyze): Build states with not only a newline context but others. (build_state): Don't release initial states. (skip_remains_mb): Add a parameter. Add a comment describing all parameters. (dfaexec_main): When there are multiple start states, we are about to transition from one state to another and the current byte is not the first byte of a multibyte character, first advance past the current multibyte character. * tests/euc-mb: Add a new test. * NEWS (Bug fixes): Mention it. This addresses http://debbugs.gnu.org/18685 2014-10-25 Paul Eggert <eggert@cs.ucla.edu> tests: work around older libpcre bugs when testing -P and UTF-8 * tests/pcre-invalid-utf8-input: Add require_timeout_ and require_compiled_in_MB_support. Put a timeout of 3 seconds on grep, to avoid having this test case loop forever with older versions of libpcre, such as those found on RHEL 6.5. Reported by Jim Meyering in: http://bugs.gnu.org/18806#34 2014-10-24 Norihiro Tanaka <noritnk@kcn.ne.jp> tests: add test for grep -P fix * tests/pcre-o: New test for this change. * tests/Makefile.am (TESTS): Add it. 2014-10-24 Paul Eggert <eggert@cs.ucla.edu> grep: fix grep -P crash Reported by Shlomi Fish in: http://bugs.gnu.org/18806 Commit 9fa500407137f49f6edc3c6b4ee6c7096f0190c5 (2014-09-16) is a hack that I put in to speed up 'grep -P'. Unfortunately, not only is it violation of modularity, it's also a bug magnet, as we have found out with Bug#18738 and Bug#18806. Remove the optimization instead of applying more bandaids. Perhaps we can think of a better way of doing the optimization, or perhaps we can just live with a slower grep -P (as -P is inherently slower anyway...). * src/grep.c, src/grep.h (validated_boundary): Remove. All uses removed. * src/pcresearch.c (Pexecute): Do not worry about validated_boundary. 2014-10-19 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: remove two erroneous clauses from a now-unused function RE_DOT_NEWLINE and RE_DOT_NOT_NULL apply only to a dot that matches any character. Do not consider them when matching with a bracket expression. * src/dfa.c (match_mb_charset): Remove tests for RE_DOT_NEWLINE and RE_DOT_NOT_NULL. 2014-10-19 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: process all MBCSET constructs via glibc's matcher The DFA matcher does not support collating symbols or equivalence classes, so ensure that any MBCSET reference is handled by the glibc matcher. dfa.c already handled this in one case, but not the other, so that a command like "printf '\0' |src/grep -aE '^\s?$'" would mistakenly end up using dfa.c's match_mb_charset function rather than glibc's matcher. * src/dfa.c (dfaexec_main): Move that code into the State_transition macro. This renders the match_mb_charset unused by grep. * tests/multibyte-white-space: Add a test to exercise the just-rendered-inaccessible code path. 2014-10-15 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: initialize validation_boundary properly before use * src/grep.c (main): Initialize validation_boundary before pre-searching for an empty line. 2014-10-15 Paul Eggert <eggert@cs.ucla.edu> grep: fix off-by-one bug in -P optimization Reported by Norihiro Tanaka in: http://bugs.gnu.org/18738 * src/pcresearch.c (Pexecute): Fix off-by-one bug with validation_boundary. * tests/init.cfg (envvar_check_fail): Catch off-by-one bug. 2014-10-08 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: fix a theoretical bug * src/dfa.c (dfaexec_main): After searching for a match from the initial state, set the previous state, S1, to 0. So far, we have found no case in which this fix makes a difference. See http://debbugs.gnu.org/18645 2014-10-07 Paul Eggert <eggert@cs.ucla.edu> doc: modernize and simplify man page * doc/grep.in.1 (Tx, Id): Remove. All uses removed. (MTO, URL): New macros, used for email and URL. Use them when appropriate. In main text, omit chatty discussions of other implementations; the full manual suffices for this sort of thing. doc: clarify exit status Reported by Santiago Ruano Rincón in: http://bugs.gnu.org/18651 * doc/grep.in.1 (EXIT STATUS): * doc/grep.texi (Exit Status): Clarify. 2014-10-07 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: test for just-fixed bug * tests/mb-dot-newline: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. Bisection suggests that the bug was introduced by commit v2.18-123-geb3292b. Also see http://debbugs.gnu.org/cgi/bugreport.cgi?msg=17;bug=18580 2014-10-05 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: factor out a new nontrivial block of duplicated code * src/dfa.c (State_transition): New macro. (dfaexec_main): Use it twice. dfa: check end of input buffer after transition in non-UTF8 multibyte locale * src/dfa.c (dfaexec_main): Check for end of input buffer after each transition in a non-UTF8 multibyte locale. * tests/mb-non-UTF8-overrun: New test. * tests/Makefile.am (TESTS): Add it. * src/grep.c (main): With this fix, we no longer need the fourth byte of "eolbytes". 2014-10-04 Jim Meyering <meyering@fb.com> grep: avoid stack buffer read-underrun and overrun Testing binaries built with -fsanitize=address caused aborts due to stack underrun and overrun. * src/grep.c (main): Allocate a larger buffer for eolbytes: one byte before the beginning and one more after the end. For details, see http://debbugs.gnu.org/18580#44. 2014-10-04 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: fix subscript error when testing whether empty lines match src/grep.c (grep): When testing whether an empty line matches, make the input buffer one byte longer, as dfaexec uses that for a sentinel. 2014-09-27 Paul Eggert <eggert@cs.ucla.edu> dfa: minor tweaks, mostly to remove __attribute__ ((noinline)) That attribute isn't portable, and I found a way to get similar performance with standard C features. * NEWS: Document the recently-installed performance improvement. * src/dfa.c (struct dfa): New member dfaexec. (dfaexec_main): Remove unnecessary 'const'. (dfaexec_mb, dfaexec_sb): Remove __attribute__ ((noinline)); no longer needed. (dfaexec): Use new dfaexec member. (dfainit, dfaoptimize, dfassbuild): Initialize it. 2014-09-27 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: separate dfaexec function to help optimization by compiler * src/dfa.c (dfaexec_main): Rename from dfaexec, add inline attribute. (dfaexec_mb): New function. Run it when d->multibyte is true. For this function inlination must be avoided. (dfaexec_sb): New function. Run it when d->multibyte is false. For this function inlination must be avoided. (dfaexec): Call dfaexec_mb or dfaexec_sb accoding to d->multibyte. 2014-09-27 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: speed-up at initial state DFA state is always 0 until have found potential match. So we improve matching there by continuing to use the transition table. * src/dfa.c (skip_remains_mb): New function. (dfaexec): Speed-up at initial state. 2014-09-27 Paul Eggert <eggert@cs.ucla.edu> maint: generalize the -Wcast-align fix * src/grep.c (CAST_ALIGNED): New macro. (skip_easy_bytes): Use it. 2014-09-27 Jim Meyering <meyering@fb.com> maint: suppress a false-positive -Wcast-align warning Building with --enable-gcc-warnings and gcc-4.9.1 would provoke this: grep.c:499:12: error: cast from 'const char *' to 'const uword *'\ (aka 'const unsigned long *') increases required alignment from\ 1 to 8 [-Werror,-Wcast-align] for (s = (uword const *) p; ! (*s & hibyte_mask); s++) ^~~~~~~~~~~~~~~~~ * src/grep.c (skip_easy_bytes): Use a pragma to suppress gcc's false-positive cast-alignment warning. 2014-09-26 Paul Eggert <eggert@cs.ucla.edu> grep: don't check extensively for invalid prefix bytes unless -P Problem reported by Jim Meyering in: http://bugs.gnu.org/18454#56 * src/grep.c (grep): After the first buffer is checked, leave the file-type checker in TEXTBIN_UNKNOWN state only when -P is used. Only the -P matcher has performance problems with checking binary data that make it worthwhile to check every prefix input byte so the -P matcher's TEXTBIN_UNKNOWN optimizations can come into play. Other matchers can simply check the data directly, and using TEXTBIN_UNKNOWN with them slows 'grep' down for no benefit. grep: scan for valid multibyte strings more quickly Scan valid multibyte strings more quickly in the common case of encodings that are upward compatible with ASCII, such as UTF-8. You'd think there'd be a fast standard way to do this nowadays, but nooooo.... Problem reported by Jim Meyering in: http://bugs.gnu.org/18454#56 * src/grep.c (HIBYTE): New constant. (easy_encoding): New static var. (init_easy_encoding, skip_easy_bytes): New functions. (uword): New type. (buffer_textbin): Skip easy bytes quickly. Don't bother with mb_clen here, since skip_easy_bytes typically captures the easy cases; just use mbrlen directly. (buffer_textbin, file_textbin): First arg is no longer a const pointer, since the byte past the end is now an overwritten sentinel. (fillbuf): Make room for a uword after the buffer, for skip_easy_bytes. (main): Call init_easy_encoding. 2014-09-17 Paul Eggert <eggert@cs.ucla.edu> grep: speed up processing of holes before EOF on Solaris * src/grep.c (fillbuf): If SEEK_DATA fails with errno == ENXIO, skip over the hole at EOF. grep: port to platforms lacking SEEK_DATA Reported by Norihiro Tanaka in: http://bugs.gnu.org/18454#38 * src/grep.c (SEEK_DATA): Default to SEEK_SET if not defined. (SEEK_HOLE): Move to top level, and default it to SEEK_SET. (file_textbin): Adjust to new default. (fillbuf): Don't bother with SEEK_DATA if it defaults to SEEK_SET. grep: skip past holes efficiently Take advantage of the relaxed rules for treating non-text bytes in binary data, by efficiently skipping past holes on platforms supporting lseek's SEEK_DATA flag. On one test on a circa-2008 Sun Fire V40z running Solaris 11.2, 'grep x' took 0.009 real-time seconds to scan a holey file of size 9,223,372,036,854,775,802 bytes, for a nominal scan rate of 1 ZB/s. grep 2.20's scan rate on this platform was 843 MB/s, so this is a speedup by a factor of 1.2 trillion. The speedup factor is not as great on GNU/Linux hosts, due to what appear to be SEEK_DATA inefficiencies, but presumably this will be cleared up in time. * NEWS: Document this. * src/grep.c, src/grep.h (eolbyte): Now char, not unsigned char. This is for compatibility with the rest of the code. The old (performance?) reasons for 'unsigned char' are now moot. * src/grep.c (skip_nuls, skip_empty_lines, seek_data_failed): New static vars. (totalnl): Move up, since it's about input, not output, and fillbuf now uses it. (add_count): Move up, since fillbuf now uses it. (all_zeros): New function. (fillbuf): Use SEEK_DATA to skip past holes efficiently, on systems that support this. (grep, main): Set the new static vars. grep: improve -P performance in typical cases * src/grep.c, src/grep.h (enum textbin): Move to grep.h. (input_textbin, validated_boundary): New vars. * src/grep.c (grepbuf, grep): Initialize them. * src/pcresearch.c (Pexecute): Do a multiline search when the input is known to be free of encoding errors. Quickly discard bytes that are obviously encoding errors. Quickly match empty strings. grep: minor -P speedup with jit_stack * src/pcresearch.c (jit_stack): No longer static. grep: non-text bytes in binary data may be treated as line ends * NEWS, doc/grep.texi (File and Directory Selection): Document this change. * src/grep.c (zap_nuls): New function. (grep): Use it. * tests/null-byte: Relax to allow new behavior. grep: -z no longer considers '\200' to be binary data This avoids a problem when using grep -z in a Windows-1252 locale. Plus, it lets 'grep -z' run a bit faster. * NEWS: Document this. * src/grep.c (buffer_textbin): Don't look for '\200' if -z. * tests/pcre-z: Test for new behavior. grep: refactor binary-vs-unknown-vs-text flags for clarity * src/grep.c (enum textbin): New enum. (textbin_is_binary): New function. (buffer_textbin, file_textbin, grep): Use them, for clarity. 2014-09-16 Paul Eggert <eggert@cs.ucla.edu> grep: fix -P speedup bug with empty match * src/pcresearch.c (NSUB): New top-level constant, replacing 'nsub' within Pexecute. (Pcompile, Pexecute): Use it. (Pexecute): Don't assume sub[1] is zero after a PCRE_ERROR_BADUTF8 match failure. * tests/pcre-invalid-utf8-input: Test for this bug. grep: port -P speedup to hosts lacking PCRE_STUDY_JIT_COMPILE * src/pcresearch.c (Pcompile): Do not assume that PCRE_STUDY_JIT_COMPILE is defined. (empty_match): Define on all platforms. grep: use mbclen cache in one more place * src/grep.c (fgrep_to_grep_pattern): Use mb_clen here, too. grep: avoid false alarms for mb_clen and to_uchar * cfg.mk (_gl_TS_unmarked_extern_functions): New var, to bypass the tight_scope false alarms on mb_clen and to_uchar. grep: use mbclen cache more effectively * src/grep.c (buffer_textbin, contains_encoding_error): Use mb_clen for speed. (buffer_textbin): Bypass mb_clen in unibyte locales. (main): Always initialize the cache, since it's sometimes used in unibyte locales now. Initialize it before contains_encoding_error might be called. * src/search.h (SEARCH_INLINE): New macro. (mbclen_cache): Now extern decl. (mb_clen): New inline function. * src/searchutils.c (SEARCH_INLINE, SYSTEM_INLINE): Define. (mbclen_cache): Now extern. (build_mbclen_cache): Put 1 into the cache when mbrlen returns 0. (mb_goback): Use mb_len for speed, and rely on it returning nonzero. * src/system.h (SYSTEM_INLINE): New macro. (to_uchar): Use it. grep: improve performance for older glibc glibc has a bug where mbrlen and mbrtowc mishandle length-0 inputs. Working around it in gnulib slows grep down, so disable the tests for it and make sure grep works even if the bug is present. * bootstrap.conf (avoided_gnulib_modules): Add mbrtowc-tests. * configure.ac (gl_cv_func_mbrtowc_empty_input): Assume yes. * src/searchutils.c (mb_next_wc): Don't invoke mbrtowc on empty input. grep: treat a file as binary if its prefix contains encoding errors * NEWS: * doc/grep.texi (File and Directory Selection): Document this. * src/grep.c (buffer_encoding, buffer_textbin): New functions. (file_textbin): Rename from file_is_binary. Now returns 3-way value. All callers changed. (file_textbin, grep): Check the input more carefully for text vs binary data. (contains_encoding_error): Remove; use replaced by buffer_encoding. * tests/backref-multibyte-slow: * tests/high-bit-range: * tests/invalid-multibyte-infloop: Use -a, since the input is now considered to be binary. * tests/invalid-multibyte-infloop: Add a check for new behavior. grep: use bool for boolean in grep.c * src/grep.c (show_version, suppress_errors, only_matching) (align_tabs, match_icase, match_words, match_lines, errseen) (write_error_seen, is_device_mode, usable_st_size) (file_is_binary, skipped_file, reset, fillbuf, out_quiet) (out_line, out_byte, count_matches, no_filenames, line_buffered) (done_on_match, exit_on_match, print_line_head, prline, grep) (grepdirent, grepfile, grepdesc, grep_command_line_arg) (get_nondigit_option, main): Use bool for boolean. (print_line_head, prline): Use char for byte. * src/grep.h: Include <stdbool.h>, and adjust decls to match changes in grep.c. grep: speed up -P on files containing many multibyte errors * src/pcresearch.c (empty_match): New var. (Pcompile): Set it. (Pexecute): Use it. grep: remove/refactor unnecessary code about line splitting * src/grep.c (do_execute): Remove. Caller now uses 'execute'. * src/pcresearch.c (Pexecute): Improve comment about this. 2014-09-12 Paul Eggert <eggert@cs.ucla.edu> grep: diagnose -P in non-UTF-8 multibyte locale * src/pcresearch.c (Pcompile): libpcre supports only unibyte and UTF-8 locales, so report an error and exit if used in other locales. * NEWS: Mention this. * tests/euc-mb: Test this. 2014-09-12 Jim Meyering <meyering@fb.com> doc: move NEWS note about GREP_OPTIONS into proper section * NEWS (Changes in behavior): Move the note about GREP_OPTIONS from the 2.20 section into the section for the upcoming release. 2014-09-12 Paul Eggert <eggert@cs.ucla.edu> grep: make GREP_OPTIONS obsolescent * NEWS: * doc/grep.in.1 (ENVIRONMENT_VARIABLES): * doc/grep.texi (Environment Variables): Document that GREP_OPTIONS is obsolescent now. * src/grep.c (main): Warn if GREP_OPTIONS is used. * tests/r-dot, tests/skip-device: Don't use GREP_OPTIONS. 2014-09-11 Paul Eggert <eggert@cs.ucla.edu> doc: bug tracker has moved to debbugs.gnu.org * README (KNOWN BUGS): * doc/grep.in.1: * doc/grep.texi (Reporting Bugs): Document this. grep: fix false matches with -P '...$' and invalid UTF-8 * tests/pcre-invalid-utf8-input: Add a test for that. grep: fix false matches with -P '...$' and invalid UTF-8 * src/pcresearch.c (Pexecute): Use PCRE_NOTEOL when matching initial substrings of a line. 2014-09-10 Jim Meyering <meyering@fb.com> tests: add expect-to-fail test for a glibc regexp bug * tests/triple-backref: New file. * tests/Makefile.am (TESTS): Add it. (XFAIL_TESTS): List it as a known, always-failing test. Based on the bug report from Paul Eggert: https://sourceware.org/bugzilla/show_bug.cgi?id=17356 maint: avoid distcheck failure * Makefile.am (EXTRA_DIST): Add .mailmap. 2014-09-10 Paul Eggert <eggert@cs.ucla.edu> grep: port recent fix to older pcre version * src/pcresearch.c (Pexecute): Don't assume that a pcre_exec that returns PCRE_ERROR_NOMATCH leaves its sub argument alone. This assumption is false for libpcre-3 version 8.31-2ubuntu2. 2014-09-09 Paul Eggert <eggert@cs.ucla.edu> grep: -P now treats invalid UTF-8 input as non-matching Problem reported by Santiago Vila in: http://bugs.gnu.org/18266 * NEWS: Mention this. * src/pcresearch.c (Pexecute): Treat UTF-8 encoding errors as non-matching data, instead of exiting 'grep'. * tests/pcre-infloop: grep now exits with status 1, not 2. * tests/pcre-invalid-utf8-input: grep now exits with status 0, not 2. 2014-08-14 Paul Eggert <eggert@cs.ucla.edu> grep: fix integer-width bugs in undossify_input etc. undossify_input bug reported by Vincent Lefevre in: http://bugs.gnu.org/18269 * src/dosbuf.c (undossify_input): Return size_t, not int. * src/grep.c (fillbuf): Work portably even if safe_read returns a value greater than SSIZE_MAX, e.g., if there's an I/O error. 2014-08-03 Paul Eggert <eggert@cs.ucla.edu> doc: document LANGUAGE Reported by Benno Schulenberg in: http://bugs.gnu.org/18185 * doc/grep.texi (Environment Variables): Document LANGUAGE. doc: prefer @env to @code Reported by Benno Schulenberg in: http://bugs.gnu.org/18184 * doc/grep.texi: Avoid @code in favor of @env, or of nothing at all. 2014-07-11 Paul Eggert <eggert@cs.ucla.edu> doc: Document -r vs --exclude more carefully. Problem reported by Hugues Andreux in: http://bugs.gnu.org/17763 * doc/grep.texi (File and Directory Selection): Be more careful about documenting the interaction between recursive searching, --include, --exclude, and --exclude-dir. 2014-06-27 Jim Meyering <meyering@fb.com> maint: split long lines, and enforce the 80-column limit * cfg.mk (sc_long_lines): New rule, from coreutils; exempt tests/* * src/grep.c (usage): Tweak -F wording to shorten a line. Correct grammar in a comment. Split the --exclude-file=... description to fit within 80 columns. Use emit_bug_reporting_address, eliminating another long line. * src/dfa.c: Split long lines. No semantic change. * doc/grep.texi: Likewise. * tests/include-exclude: Split a long line. * tests/backref: Split long lines. * tests/empty: Likewise. * tests/fmbtest: Likewise. doc: update HACKING * HACKING: Update from coreutils. maint: generate distributed THANKS from VC'd THANKS.in * Makefile.am (THANKS): New rule. * THANKS.in: New file. * THANKS: Remove. Now it's generated from the combination of THANKS.in and git logs. * .mailmap: New file. * cfg.mk (sc_THANKS_in_duplicates): New syntax-check rule, from coreutils. * .gitignore: Add THANKS. * thanks-gen: New file, from coreutils. 2014-06-27 Paul Eggert <eggert@cs.ucla.edu> grep: with -E, unmatched ')' matches itself Problem reported by Nathan Weeks in: http://bugs.gnu.org/17856 * src/grep.c (Ecompile): Also specify RE_UNMATCHED_RIGHT_PAREN_ORD. * doc/grep.texi (Fundamental Structure), NEWS: Document this. * tests/ere.tests: Add a couple of tests for this. * tests/spencer1.tests: Fix exit status. 2014-06-17 Paul Eggert <eggert@cs.ucla.edu> build: avoid -Wstack-protector This allows the use of --enable-gcc-warnings on Gentoo and Ubuntu. See: http://bugs.gnu.org/17793 * configure.ac (WERROR_CFLAGS): Avoid -Wstack-protector. This can be worked around, but the cure is worse than the disease. 2014-06-17 Paul Eggert <eggert@cs.ucla.edu> build: don't make output files read-only This led to problems, such as the prompt "mv: try to overwrite 'egrep', overriding mode 0555 (r-xr-xr-x)? " during a build. It can be worked around, but the cure is worse than the disease; making output files read-only is more trouble than it's worth. * doc/Makefile.am (grep.1, egrep.1, fgrep.1): * lib/Makefile.am (colorize.c): * src/Makefile.am (egrep fgrep): Don't make output files read-only. Prefer separate commands to '&&' when either will do. 2014-06-08 Paul Eggert <eggert@cs.ucla.edu> maint: remove grep.spec * grep.spec: Remove; obsolete and evidently not used. 2014-06-07 Paul Eggert <eggert@cs.ucla.edu> doc: use gnulib fdl module * bootstrap.conf (gnulib_modules): Add fdl. * doc/fdl.texi: Remove, as this now comes from gnulib. * doc/.gitignore: Update to match current sources. 2014-06-06 Jim Meyering <meyering@fb.com> build: improve rule to generate egrep+fgrep scripts * src/Makefile.am (egrep fgrep): chmod a=rx generated files, and remove $@-t before attempting to redirect to it, in case it is read-only. build: don't redirect directly to $@ * lib/Makefile.am (colorize.c): Don't redirect directly to target, $@. Otherwise, we could create a corrupt colorize.c file with a timestamp that indicates it is up to date. Also, make the generated file read-only. 2014-06-05 Paul Eggert <eggert@cs.ucla.edu> grep: undo part of previous change * src/dfa.c (enlist): Undo part of previous change that doesn't look correct and doesn't help performance much anyway. grep: use system strstr if available and fast Problem reported by Norihiro Tanaka in: http://bugs.gnu.org/17700 * NEWS: Document this. * bootstrap.conf (gnulib_modules): Add strstr. * src/dfa.c (istrstr): Remove. (enlist): Use strstr instead. Wait until we need memory before allocating it; this can save an unnecessary allocate and free. build: update gnulib submodule to latest 2014-06-03 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.20 * NEWS: Record release date. 2014-05-30 Jim Meyering <meyering@fb.com> grep: fix --max-count=N (-m N) to stop reading after Nth match With --max-count=N (-m N), grep is supposed to stop reading input after it has found the Nth match. However, a recent context- related change made it so grep would always read to end of file. * src/grep.c (prtext): Don't let a negative "out_after" value make "pending" line count negative. * tests/max-count-overread: New test, for this. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. * THANKS: Add names of two recent bug reporters. This bug was introduced by commit v2.18-139-g5122195. Reported by Marc Aldorasi in http://bugs.gnu.org/17640. 2014-05-29 Jim Meyering <meyering@fb.com> dfa: fix off-by-one under-allocation from recent change Commit v2.19-10-gc32ff67 mistakenly made this change: -realloc_trans_if_necessary (d, 1); +realloc_trans_if_necessary (d, 0); which led to a heap buffer overflow. * src/dfa.c (dfaexec): Allocate space for one state, as before. 2014-05-28 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: fix bug with regex containing multiple begin/end-line constraints grep -E 'a(b$|c$)' would mistakenly match "aa". * src/dfa.c (dfamust): When resetting 'is' in OR, also reset 'begline' and 'endline' of 'must'. * NEWS (Bug fixes): Mention it. This bug was introduced via commit v2.18-85-g2c94326. Reported by Péter Radics in <http://bugs.gnu.org/17617>. 2014-05-26 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: simplify building initial state build_state_zero doesn't need the struct dfa to be initialized, so remove the initialization and simplify. * src/dfa.c (build_state_zero): Remove. (dfaexec): Call realloc_trans_if_necessary and build_state directly. dfa: revert "grep: do not count newline before the start of buffer" This reverts commit 5dc3af2806d21455b818be3f9da26c372e4a7f8d. The previous change renders that commit unnecessary. dfa: do not clear the first state of a transition table If number of DFA states reaches 1024, build_state clears transition tables to save memory. However, the initial state is always used, so clearing it just wastes time. * src/dfa.c (build_state): Do not clear the initial state's transition and failure tables. grep: remove unnecessary argument * src/grep.c (do_execute): Remove argument 'start_ptr'. It's always null. All uses changed. 2014-05-24 Paul Eggert <eggert@cs.ucla.edu> grep: --exclude-dir=FOO/ now ignores the trailing slash Problem reported by Khaled Ziyaeen; see: http://bugs.gnu.org/17481 * NEWS, doc/grep.texi (File and Directory Selection): Document this. * src/grep.c (main): Implement this. * tests/include-exclude: Test this. dist: don't distribute lib/colorize.c 'configure' creates this file, so it shouldn't be distributed; see: http://bugs.gnu.org/17480 * configure.ac (COLORIZE_SOURCE): New macro. Don't use AC_CONFIG_LINKS for lib/colorize.c. * lib/Makefile.am (nodist_libgreputils_a_SOURCES): New macro. (libgreputils_a_SOURCES): Remove colorize.c. (CLEANFILES): Add colorize.c (colorize.c): New rule. 2014-05-23 behoffski <behoffski@grouse.com.au> maint: uncapitalize first letter of two dfaerror message strings * dfa.c (lex): Make two message strings consistent with all of the others: do not capitalize the first letter of the first word. 2014-05-23 Jim Meyering <meyering@fb.com> maint: revert "grep: port mb_next_wc to RHEL 6.5 x86-64" This reverts commit v2.18-148-ga6ae68d. Now that we have gnulib change v0.1-131-g2a045bc, "mbrlen, mbrtowc: fix bug with empty input", this work-around is no longer needed. gnulib: update, for mbrlen/mbrtowc empty input bug fix 2014-05-22 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.19 * NEWS: Record release date. 2014-05-21 Jim Meyering <meyering@fb.com> maint: avoid new false-positive syntax-check failure * cfg.mk (exclude_file_name_regexp--sc_prohibit_doubled_word): Exempt new test file that contains legitimate use of "in in". 2014-05-17 Norihiro Tanaka <noritnk@kcn.ne.jp> tests: add test case for newline-count fix * tests/count-newline: New test. * tests/Makefile.am (TESTS): Add it. 2014-05-16 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: do not count newline before the start of buffer * src/dfa.c (build_state): When checking whether the previous character was a newline, do not count any newline before the start of the buffer. 2014-05-15 Paul Eggert <eggert@cs.ucla.edu> grep: port mb_next_wc to RHEL 6.5 x86-64 * src/searchutils.c (mb_next_wc): Work around glibc bug 16950; see: https://sourceware.org/bugzilla/show_bug.cgi?id=16950 This bug was masked in the other GNU/Linux tests I made. It was exposed on RHEL 6.5 x86-64, where the compiler (GCC Red Hat 4.4.7-4) happened to use temporaries in a different way. Also see recent changes to the Gnulib documentation in this area: http://lists.gnu.org/archive/html/bug-gnulib/2014-05/msg00013.html tests: port mb-non-UTF8-performance to RHEL 6.5 * tests/mb-non-UTF8-performance (timeout): Use an integer, as 'timeout 1.234' doesn't work in EUC locales. 2014-05-12 Paul Eggert <eggert@cs.ucla.edu> egrep, fgrep: port to Solaris 10 /bin/sh This old shell doesn't grok ${0%/*}; see: http://bugs.gnu.org/17471 * src/Makefile.am (egrep fgrep): Don't assume the shell does substrings. * src/egrep.sh (dir): New var, so that the substring calculation is done only once (which is a small win even with newer shells), and so that the calculation is easier to edit on older shells. 2014-05-10 Jim Meyering <meyering@fb.com> maint: NEWS: adjust wording to reflect move * NEWS (Improvements): Correct direction-relative wording, now that the referent is below, not above. maint: NEWS: move "Improvements" to the top * NEWS: Move the small "Improvements" section to precede the longer "Bug fixes" one. gnulib: update submodule to latest, and bootstrap * gnulib: Update submodule. * bootstrap: Update from gnulib. 2014-05-10 Paul Eggert <eggert@cs.ucla.edu> dfa: omit double includes * src/dfa.c: Don't include stddef.h or stdbool.h, as dfa.h includes them already, and it's the same module as we are. Suggested by Aharon Robbins in: http://bugs.gnu.org/17458 dfa: fix bug with \< etc in multibyte locales Problem reported by Stephane Chazelas in: http://bugs.gnu.org/16867 * NEWS: Document the fix. * src/dfa.c (dfaoptimize): Remove any superset if changing from UTF-8 to unibyte, and if the pattern has no backreferences. (dfassbuild): In multibyte locales, treat \< \> \b \B as backreferences in the DFA, since the DFA relies on unibyte tests to check them. (dfacomp): Optimize after building the superset, so that dfassbuild can depend on d->multibyte. A downside is that dfaoptimize must remove supersets that are likely slower than the DFA after optimization, but that's been done in the above-described change. * tests/Makefile.am (XFAIL_TESTS): Remove word-delim-multibyte, since the test works now. tests: add test case for -C 0 change * tests/context-0: New test. * tests/Makefile.am (TESTS): Add it. grep: -A 0, -B 0, -C 0 now output a separator Problem reported by Dan Jacobson in: http://bugs.gnu.org/17380 * NEWS: * doc/grep.texi (Context Line Control): Document this. * src/grep.c (prtext): Output a separator even if context is zero. (main): Default context is now -1, not 0. 2014-05-09 Paul Eggert <eggert@cs.ucla.edu> grep: minor improvements to retry-DFA-superset patch * src/dfasearch.c (EGexecute): Avoid unnecessary test in a context where memrchr cannot return a null pointer. 2014-05-09 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: retry DFA superset after matching multiple lines * src/dfasearch.c (EGexecute): Without this patch, the code reverts to KWset when the DFA superset matches multiple lines. However, if the DFA superset matches multiple lines, it most likely also matches a single line, and reverting to KWset means dfafast won't work effectively. Change the code so that it retries the DFA superset immediately after it matches multipline lines. On my platform this improves the performance of "LC_ALL=C grep '\(ab\)cd\1d' k" from 3.48 to 2.14 seconds realtime, where k contains the output of "yes abcdabc | head -50000000". dfa: fix inconsistency in multibyte locales * src/dfa.c (dfaexec): Use the same exit condition in multibyte locales as in unibyte. 2014-05-08 Jim Meyering <meyering@fb.com> maint: mark some breakless cases with /* fallthrough */ comment * src/dfa.c (addtok_mb, dfaanalyze): Add comment so that it is clear that the "break" statement is deliberately omitted. 2014-05-08 Paul Eggert <eggert@cs.ucla.edu> dfa: assume C89 for CHAR_BIT * src/dfa.c (CHARBITS): Remove. All uses replaced by CHAR_BIT. (NOTCHAR): Now an enum, since it need not be a macro. dfa: don't assume unsigned int is exactly 32 bits wide Sun C 5.12 (sparc) warns of the potential unportability. * src/dfa.c (charclass_word): New type, for clarity. All relevant uses of 'unsigned' changed. (CHARCLASS_WORD_BITS): Rename from INTBITS. All uses changed. Now an enum, since it needn't be a macro. (CHARCLASS_WORD_MASK): New macro. (CHARCLASS_WORDS): Rename from CHARCLASS_INTS. All uses changed. (setbit, clrbit): Cast 1 to charclass_word, for clarity. (notset, add_utf8_anychar, dfastats): Don't assume unsigned int is exactly 32 bits wide. (dfastate): Don't rely on implementation-defined conversion of greater-than-INT_MAX unsigned to int. Change bit test to resemble tstbit more. maint: fix indenting to pacify 'prohibit_tab_based_indentation' * src/dfa.c: Use spaces and not tabs to indent some lines. grep: simplify and clarify invert-related code * src/grep.c (out_invert, prtext): Use bool for booleans. (prline): Remove unnecessary '!!' on a value that is always 0 or 1. (prtext): Remove last arg NLINESP; use !out_invert instead. All uses changed. Move decls to nearer uses, since we can assume C99 here. Update 'outleft' and 'after_last_match' here; it's simpler. (grepbuf): Compute return value by subtracting new from old 'outleft', rather than by keeping a separate running total. Avoid code duplication by arranging for prtext to be called from one place, not three. 2014-05-08 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: improve performance of -v when combined with -L, -l or -q Problem reported by Jörn Hees in: http://bugs.gnu.org/17427 * src/grep.c (grepbuf, grep): When -v is combined with -L, -l, or -q, don't read data unnecessarily after a non-match is found. 2014-05-06 Paul Eggert <eggert@cs.ucla.edu> doc: mention performance changes * NEWS: Discuss recent performance improvements and downgrades. dfa: clarify use of "if" The phrase "Y is true if X" is logically equivalent to "X implies Y", but often "X if and only if Y" was intended. * src/dfa.c, src/dfa.h: Reword to avoid the incorrect use of "if". dfa: minor performance improvement for previous change * src/dfa.c (struct dfa): New member 'fast'. Remove 'has_backref'. All uses changed. 2014-05-06 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: speed up 'dfaisfast' * src/dfa.c (struct dfa): New member 'has_backref'. (addtok_mb): Set it. (dfaisfast): Use it. 2014-05-05 Paul Eggert <eggert@cs.ucla.edu> grep: fix -w match next to a multibyte letter * NEWS: Document this. * src/dfasearch.c, src/kwsearch.c (WCHAR): Remove. (wordchar): New static function. * src/dfasearch.c (EGexecute): * src/kwsearch.c (Fexecute): Use the new functions, so that the code works correctly if a multibyte character adjacent to the match has two or more bytes. * src/search.h, src/searchutils.c (mb_prev_wc, mb_next_wc): New functions. * tests/word-delim-multibyte: Add a test for grep -w (which now passes), and a test for \> (which still fails). The \< test also still fails. grep: improve internal API for multibyte boundary * src/search.h, src/searchutils.c (mb_goback): Rename from is_mb_middle. Omit last arg. Return number of bytes to go back, not just a boolean. All uses changed. * src/dfasearch.c (EGexecute): * src/kwsearch.c (Fexecute): Adjust to API change. * src/kwsearch.c (Fexecute): Eliminate common subexpression. grep: fix encoding-error incompatibilities among regex, DFA, KWset This follows up to http://bugs.gnu.org/17376 and fixes a different set of incompatibilities, namely between the regex matcher and the other matchers, when the pattern contains encoding errors. The GNU regex matcher is not consistent in this area: sometimes an encoding error matches only itself, and sometimes it matches part of a multibyte character. There is no documentation for grep's behavior in this area and users don't seem to care, and it's simpler to defer to the regex matcher for problematic cases like these. * NEWS: Document this. * src/dfa.c (ctok): Remove. All uses removed. (parse_bracket_exp, atom): Use BACKREF if a pattern contains an encoding error, so that the matcher will revert to regex. * src/dfasearch.c, src/grep.c, src/pcresearch.c, src/searchutils.c: Don't include dfa.h, since search.h now does that for us. * src/dfasearch.c (EGexecute): * src/kwsearch.c (Fexecute): In a UTF-8 locale, there's no need to worry about matching part of a multibyte character. * src/grep.c (contains_encoding_error): New static function. (main): Use it, so that grep -F is consistent with plain fgrep when the pattern contains an encoding error. * src/search.h: Include dfa.h, so that kwsearch.c can call using_utf8. * src/searchutils.c (is_mb_middle): Remove UTF-8-specific code. Callers now ensure that we are in a non-UTF-8 locale. The code was clearly wrong, anyway. * tests/fgrep-infloop, tests/invalid-multibyte-infloop: * tests/prefix-of-multibyte: Do not require that grep have a particular behavor for this test. It's OK to match (exit status 0), not match (exit status 1), or report an error (exit status 2), since the pattern contains an encoding error and grep's behavior is not specified for such patterns. Test only that KWset, DFA, and regex agree. * tests/prefix-of-multibyte: Add tests for ABCABC and __..._ABCABC___. 2014-05-04 Paul Eggert <eggert@cs.ucla.edu> dfa: minor simplification * src/dfa.c (parse_bracket_exp): Use enum, not macro, and move var to just the scope it's needed. grep: simplify and fix problems with KWset-DFA agreement patch * src/dfa.c (dfambcache, parse_bracket_exp): Simplify. (mbs_to_wchar, wctok, FETCH_WC, match_anychar, match_mb_charset) (check_matching_with_multibyte_ops, transit_state_consume_1char) (transit_state, dfaexec): Use wint_t, not wchar_t, so that WEOF is treated correctly on platforms where WEOF is not a valid wchar_t value. (ctok, lex): Use int, not unsigned int, for characters, so that EOF is treated more naturally. (parse_bracket_exp): Use NOTCHAR to mark uninitialized char, since FETCH_WC can now set the char to EOF. (lex): Remove unnecessary test for EOF. (parse_bracket_exp, atom): Swap then and else parts, to put the small one first; this is more readable here. * src/searchutils.c (is_mb_middle): Simplify. tests: improve coverage for prefix-of-multibyte * tests/prefix-of-multibyte: Also test the regex version. 2014-05-04 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: make KWset and DFA agree about invalid sequences in patterns See: http://bugs.gnu.org/17376 * src/dfa.c (dfambcache): Don't cache invalid sequences, because they can't be represented by wide characters. (dfambcache, mbs_to_wchar): Return WEOF for invalid sequences. (ctok): New global variable. (parse_bracket_exp, atom, match_anychar, match_mb_charset): Don't allow WEOF. (lex): Set 'ctok'. * src/kwsearch.c (Fexecute): * src/searchutils.c (is_mb_middle): Don't check here. * tests/invalid-multibyte-infloop: Adjust to fixed behavior. * tests/prefix-of-multibyte: Add test cases for this bug. 2014-05-03 Jim Meyering <meyering@fb.com> maint: make ChangeLog generation more robust * Makefile.am (gen-ChangeLog): Sync changes from GNU coreutils, to ensure exit status is propagated, and to support an optional git-log-fix file. 2014-05-03 Paul Eggert <eggert@cs.ucla.edu> grep: clarify EGexecute slightly * src/dfasearch.c (EGexecute): Change if-then-else to !if-else-then. 2014-05-03 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: fix the bug in previous patch. * src/dfasearch.c (EGexecute): Do it. 2014-04-30 Paul Eggert <eggert@cs.ucla.edu> grep: simplify EGexecute further * src/dfa.c, src/dfa.h (dfasuperset): Arg is now const pointer. Now pure. * src/dfasearch.c (EGexecute): Coalesce some duplicate code. Don't worry about memrchr returning NULL when that's impossible. 2014-04-30 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: adjust timing back to kwset when dfaisfast is true * src/dfasearch.c (EGexecute): If DFA fails after kwset succeeds, the code doesn't return to kwset until it reaches the end of the buffer or finds a match. Because of this, although some cases speed up, others slow down. Adjust the heuristic for switching to the DFA, so that it is more likely to switch at the right times. 2014-04-30 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: simplify superset * src/dfa.h (dfahint): Remove decl. (dfasuperset): New decl. * src/dfa.c (dfahint): Remove. (dfassbuild): Rename from dfasuperset. (dfasuperset): New function. It returns the superset of D. * src/dfasearch.c: Use dfasuperset instead of dfahint, and simplify. dfa: optimize memory allocation * src/dfa.c (epsclosure): get the value of 'visited' from the argument. (dfaanalyze): Define and allocate variable 'visited'. (dfastate): Use not 'insert' but 'merge' to insert positions for state 0 of DFA. 2014-04-29 Norihiro Tanaka <noritnk@kcn.ne.jp> kwset: improve performance by inlining tr Without this change, older versions of GCC won't inline 'tr', and this can hurt performance significantly. See: http://bugs.gnu.org/17229#64 * src/kwset.c (tr): Make it inline. 2014-04-27 Jim Meyering <meyering@fb.com> gnulib: update to latest * gnulib: This fixes a bug whereby running bootstrap would remove our build-aux/git-log-fix file. 2014-04-27 Paul Eggert <eggert@cs.ucla.edu> kwset: improve performance by inlining more Problem reported by Norihiro Tanaka in <http://bugs.gnu.org/17229#55>. * src/kwset.c (bmexec_trans): Rename from bmexec, and make it inline. (bmexec): New implementation, which calls bmexec_trans. This helps GCC inline more aggressively with the default optimization, and improves performance 25% with the reported benchmark on my host. 2014-04-26 Paul Eggert <eggert@cs.ucla.edu> kwset: speed up by using memchr2 Idea suggested by Eric Blake in: http://bugs.gnu.org/17229#43 * bootstrap.conf (gnulib_modules): Add memchr2. * src/kwset.c: Include stdint.h, for uintptr_t. Include memchr2.h. (struct kwset): New members gc1, gc2, gc1help. (tr): Move earlier, so it can be used earlier. (kwsprep): Initialize struct kwset's new members. (memchr_kwset): Rename from memchr_trans. Combine C and TRANS args into new arg KWSET. All uses changed. Use memchr2 when appropriate. (bmexec): Use new members instead of recomputing their values. Increase advance_heuristic; it's just a guess, but memchr2 probably makes it reasonable to increase it. kwset: improve performance when large Boyer-Moore key doesn't match * src/kwset.c (bmexec): As a heuristic, prefer memchr to seeking by delta1 only when the latter doesn't advance much. dfa: fix index bug in previous patch, and simplify * src/dfa.c, src/dfa.h (dfaisfast): Arg is const pointer. * src/dfa.c (dfaisfast): Simplify, since supersets never contain BACKREF. * src/dfa.h (dfaisfast): Declare to be pure. * src/dfasearch.c (EGexecute): Fix typo that could cause buffer read overrun when !dfafast. Hoist duplicate computation out of an if's then and else parts. 2014-04-26 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: speed up for a case to repeat failure in DFA after success in kwset A DFA is typically much faster if it is unibyte and does not set BACKREF. Skip kwset if the DFA is fast. For example: yes abcdabc | head -50000000 >k env LC_ALL=C time -p src/grep -i 'abcd.bd' k This improved real-time from 4.86 to 1.34 s. * src/dfa.c, src/dfa.h (dfaisfast): New function. * src/dfasearch.c (EGexecute): Use it. 2014-04-24 Paul Eggert <eggert@cs.ucla.edu> dfa: fix recently-introduced memory leak Problem reported by Aharon Robbins in: http://bugs.gnu.org/17341 * src/dfa.c (dfasuperset): free after dfafree. misc: fix doc and test bugs re grep -z Problem reported by Stephane Chazelas in: http://bugs.gnu.org/16871 * doc/grep.texi (Usage): Remove incorrect example with -P. * tests/pcre: Improve test so that it actually tests whether \s matches a newline. dfa: minor simplification of dfaexec * src/dfa.c (dfaexec): Streamline updating of returned values. Don't bother to check d->multibyte before updating mbp. Avoid duplicate p > end test. 2014-04-24 Paul Eggert <eggert@cs.ucla.edu> dfa: simplify and be more consistent about MB_CUR_MAX * src/dfa.c (struct dfa): New member 'multibyte', replacing 'mb_cur_max'. All uses changed. Use this new member consistently, instead of sometimes referring to MB_CUR_MAX directly. dfa: fix comment * src/dfa.c (maybe_realloc): Fix comment to match behavior better. 2014-04-24 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: skip checking of multibyte character boundary, reaching at eolbyte * src/dfa.c (dfaexec): Skip checking of multibyte character boundary, reaching at eolbyte. 2014-04-24 Paul Eggert <eggert@cs.ucla.edu> dfa: fix incorrect comment that led to heap overrun * dfa.c (maybe_realloc): Fix comment to match behavior. dfa: minor tuneup of dfamust memory savings patch * src/dfa.c (allocmust): Use xmalloc, not xzalloc. Initialize the must completely, so that the caller need not invoke resetmust. All callers changed. (dfamust): Omit asserts that aren't needed on typical machines where dereferencing NULL dumps core. Don't leak memory if the pattern contains a NUL byte. 2014-04-24 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: avoid wasting memory for large patterns in dfamust * src/dfa.c (struct must): New member 'prev'. It points to the previous must. (allocmust): New function. (freemust): New function. (dfamust): Use it. 2014-04-24 Jim Meyering <meyering@fb.com> grep: fix new heap write buffer overrun * src/dfa.c (parse_bracket_exp): Fix off-by-one allocation error. Exposed by running the tests with an ASAN-enabled binary (i.e., created using gcc's -fsanitize=address option). Introduced by commit v2.18-70-gd3d9612, "dfa: simplify range char allocation". 2014-04-24 Paul Eggert <eggert@cs.ucla.edu> build: suppress unsafe-loop-optimizations warnings I ran into one of these while trying out GCC 4.9.0's new -fsanitize=undefined option. The warning told me that GCC didn't do an unsafe optimization, but in 'grep' this is not typically a symptom of a programming error. * configure.ac (WERROR_CFLAGS): Suppress -Wunsafe-loop-optimizations. 2014-04-23 Paul Eggert <eggert@cs.ucla.edu> dfa: fix memory leak reintroduced by previous patch Reported by Norihiro Tanaka in <http://bugs.gnu.org/17328#16>. * src/dfa.c (dfaexec): Allocate mb_match_lens and mb_follows only if not already allocated. (free_mbdata): Null out mb_match_lens to mark it as being freed. 2014-04-23 Jim Meyering <meyering@fb.com> tests: use consistent spelling for locale name, en_US.UTF-8 * tests/pcre-infloop: Spell locale name, en_US.UTF-8, consistently, converting this one use from "en_US.utf8", which would provoke a test failure on OS/X. 2014-04-23 Paul Eggert <eggert@cs.ucla.edu> dfa: omit static variables that limited dfaexec to one struct dfa Problem reported by Aharon Robbins in: http://bugs.gnu.org/17328 * src/dfa.c (struct dfa): New member mbs. mb_follows is now a position_set, not a pointer to one; this simplifies memory allocation. All uses changed. (mbs_to_wchar): Put DFA arg at the end, in place of the mbstate_t *arg, since the DFA now contains an mbstate_t. All uses changed. (mbs): Remove static variable. (dfaexec): Remove static bool that attempted to optimize memory allocation, as this wasn't correct for Gawk. Perhaps we can think of a better way to optimize memory. 2014-04-22 Paul Eggert <eggert@cs.ucla.edu> kwset: simplify and speed up Boyer-Moore unibyte -i in some cases This improves the performance of, for example, yes jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj | head -10000000 | grep -i jk in a unibyte locale. * src/kwset.c (memchr_trans): New function. (bmexec): Use it. Simplify the code and remove some of the confusing gotos and breaks and labels. Do not treat glibc memchr as a special case; if non-glibc memchr is slow, that is lower priority and I suppose we can try to work around the problem in gnulib. 2014-04-22 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: speed-up by using memchr() in Boyer-Moore searching memchr() of glibc is faster than seeking by delta1 on some platforms. When there is no chance to match for a while, use it on them. * src/kwset.c (bmexec): Use memchr() in Boyer-Moore searching. 2014-04-22 Paul Eggert <eggert@cs.ucla.edu> kwset: simplify Boyer-Moore with unibyte -i This change doesn't significantly affect performance on my platform, and should make the code easier to maintain. * src/kwset.c (BM_DELTA2_SEARCH, LAST_SHIFT, TRANS): Remove these macros, in favor of ... (tr, bm_delta2_search): New functions. All uses changed. The latter function is inline because this improves code size and runtime CPU slightly on x86-64 with gcc -O2 (GCC 4.9.0). (bmexec): Prefer tr when that's simpler. 2014-04-22 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: may also use Boyer-Moore algorithm for case-insensitive matching * src/kwset.c (BM_DELTA2_SEARCH, LAST_SHIFT, TRANS): New macro. (bmexec): Use character translation table. (kwsexec): Call bmexec for case-insensitive matching. (kwsprep): Change the `if' condition. 2014-04-21 Paul Eggert <eggert@cs.ucla.edu> grep: -P now rejects invalid input sequences in UTF-8 locales See <http://bugs.gnu.org/17245> and <http://bugs.exim.org/1468>. * NEWS: Document this. * src/pcresearch.c (Pexecute): Do not use PCRE_NO_UTF8_CHECK, as this leads to undefined behavior when the input is not UTF-8. * tests/pcre-infloop, tests/pcre-invalid-utf8-input: Exit status is now 2, not 1, when grep -P is given invalid UTF-8 data in a UTF-8 locale. dfa: minor improvements to previous patch * src/dfa.c (dfamust): Use &=, not if-then. * src/dfa.h (struct dfamust): * src/dfasearch.c (begline, hwsmusts): Use bool for boolean. * src/dfasearch.c (kwsmusts): * src/kwsearch.c (Fcompile): Prefer decls after statements. * src/dfasearch.c (kwsmusts): Avoid conditional branch. * src/kwsearch.c (Fcompile): Unify the two calls to kwsincr. 2014-04-21 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: speed-up for exact matching with begline and endline constraints. dfamust turns on the flag when a state exactly matches the proposed one. However, when the state has begline and/or endline constraints, turns off it. This patch enables to match a state exactly, even if the state has begline and/or endline constraints. If a exact string has one of their constrations, the string adding eolbyte to a head and/or foot is pushed to kwsincr(). In addition, if it has begline constration, start searching from just before the position of the text. * src/dfa.c (variable must): New members `begline' and `endline'. (dfamust): Consideration of begline and endline constrations. * src/dfa.h (struct dfamust): New members `begline' and `endline'. * src/dfasearch.c (kwsmusts): If a exact string has begline constration, start searching from just before the position of the text. (EGexecute): Same as above. * src/kwsearch.c (Fexecute): Same as above. 2014-04-20 Paul Eggert <eggert@cs.ucla.edu> dfa: fix bug that caused NUL to be mishandled in patterns This bug was introduced in the early-2012 patches that fixed some context-handling bugs. Bisecting found commit d8951d3f4e1bbd564809aa8e713d8333bda2f802 (2012-02-05 18:00:43 +0100), but it apears the underlying problem was introduced in commit 8b47c4cf6556933f59226c234b0fe984f6c77dc7 (2012-01-03 11:22:09 +0100). * NEWS: Mention bug fix. * src/dfa.c (char_context): Consider NUL to be a newline only if -z. * tests/Makefile.am (TESTS): Add null-byte. * tests/null-byte: New file. 2014-04-19 Jim Meyering <meyering@fb.com> build: reenable some compiler warning options 2014-04-18 Paul Eggert <eggert@cs.ucla.edu> dfa: fix pointer type conversion bug The code converted between size_t * and ptrdiff_t *, which wasn't diagnosed by modern x86-64 GCC but isn't portable. Problem reported by Norihiro Tanaka in <http://bugs.gnu.org/17136#31>. * configure.ac (WERROR_CFLAGS): Don't add -Wno-pointer-sign. We want GCC to diagnose pointer signedness problems, as they violate the C standard and other compilers no doubt complain too. * src/dfa.c (struct dfa): Change type of salloc to size_t. (realloc_trans_if_necessary): Convert signed value to size_t before passing its address to x2nrealloc. Changing the type of tralloc to size_t might have led to problems elsewhere. 2014-04-18 Jim Meyering <meyering@fb.com> maint: Revert "dfa: avoid new NULL dereference" This reverts commit 5190041fe515743ef4545abf287d243bc025c701. It was only a bug if one neglected to update to the latest gnulib. With the newer xn2realloc, there is no problem. dfa: avoid new NULL dereference * src/dfa.c (dfa_charclass_index): Restore a "+ 1" mistakenly omitted during recent improvements. Introduced in v2.18-66-g6a60fd5. 2014-04-17 Paul Eggert <eggert@cs.ucla.edu> dfa: minor cleanup * src/dfa.c (MAX): Remove; no longer used. 2014-04-17 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: speed up by checking multibyte characters on demand If dfaexec() runs in non-UTF8 locales, length and wide character representation are checked for all characters of a line in a input string. However, if matched early in the line, results for remaining characters are wasted. This patch checks multibyte characters on demand. It should work faster for early matches, and reduces memory requirements. * src/dfa.c (struct dfa): Remove members mblen_buf, nmblen_buf, inputwcs, ninputwcs. All uses removed. (buf_begin, buf_end, prepare_wc_buf): Remove. All uses removed. (SKIP_REMAINS_MB_IF_INITIAL_STATE): Remove. This is now expanded when used. (match_anychar, match_mb_charset, check_matching_with_multibyte_ops): New arg wc, mbclen. Remove arg idx. All uses changed. (transit_state_consume_1char): New arg wc. All uses changed. (transit_state): New arg 'end'. All uses changed. 2014-04-17 Paul Eggert <eggert@cs.ucla.edu> dfa: trans reallocation microoptimization * src/dfa.c (realloc_trans_if_necessary): Help the compiler avoid unnecessary reloads. dfa: simplify dfmust initialization * src/dfa.c (dfamust): Don't initialize musts twice. Use zcalloc, not xmalloc followed by zeroing. Make result a const pointer. dfa: simplify freelist * src/dfa.c (freelist): Don't null out array while freeing its pointers; the caller can do that if needed. (resetmust): Null out zeroth entry of array. dfa: avoid duplicate strlen when allocating memory * src/dfa.c (dfamust): Use xstrdup, not strlen (twice) + xmemdup. dfa: simplify memory allocation * src/dfa.c (icatalloc, freelist, enlist, comsubs, addlists, inboth) (dfamust): Don't worry about null arguments or results, as memory allocators no longer can return null pointers. (dfamust): Invoke malloc just once when building a concatenated string. dfa: simplify position set and element count allocation * src/dfa.c (dfaanalyze): Allocation position set info all at one go, and similarly for element count info. dfa: simplify multibyte_prop allocation * src/dfa.c (struct dfa): Simplify by removing nmultibyte_prop; it should always be the same as talloc. All uses changed. dfa: simplify range char allocation * src/dfa.c (struct dfa): Simplify by allocating one array of ranges rather than one for range starts and another for range ends. All uses changed. dfa: simplify transition table allocation * src/dfa.c (struct dfa): Remove member 'realtrans', as it can be computed from 'trans'. All uses changed. (realloc_trans_if_necessary): Move earlier, to avoid a forward decl. Use x2nrealloc to compute new size, rather than doing it by hand, which omits a check for unlikely overflow. (realloc_trans_if_necessary, dfafree): Adjust to the fact that d->trans now might be either NULL, or 1 + the pointer to free. (build_state, build_state_zero): Use realloc_trans_if_necessary instead of duplicating its code. dfa: better size-overflow check * src/dfa.c (dfasuperset): Let xnmalloc do the multiplication, to check for size arithmetic overflow better. dfa: avoid unnecessary work and other initialization * src/dfa.c (dfaanalyze, dfainit): Don't bother allocating when x2nrealloc will do it for us. (dfastate): Allocate grps and labels on the stack, as their size is known at compile time. (build_state): Use xmalloc, not xnmalloc, since the multiplication can be done at compile-time. dfa: clarify memory allocation and port to IRIX This change was prompted by a porting problem: IRIX defines its own MALLOC macro, which clashes with ours. More generally, the MALLOC etc. macros are confusing, as they look like functions but do not have C-function semantics. A functional style makes the code easier to read, and though it lengthens the code a bit here it'll make other simplifications easier. * src/dfa.c (XNMALLOC, XCALLOC, CALLOC, MALLOC, REALLOC): Remove. All uses replaced by xnmalloc etc. (REALLOC_IF_NECESSARY): Remove; all uses replaced by .... (maybe_realloc): New function. (copy, merge): Free and allocate rather than realloc, as we needn't save the contents. 2014-04-14 Jim Meyering <meyering@fb.com> tests: detect an infloop-inducing bug in grep -P (pcre-8.35) * tests/pcre-infloop: New test. * tests/Makefile.am (TESTS): Add it. 2014-04-12 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2014-04-11 Paul Eggert <eggert@cs.ucla.edu> grep: improvements for the open-CSET patch * src/dfa.c (dfamust): Simplify by removing some duplicate code. Optimize patterns like [aaa] even when not case-folding. Avoid an unnecessary copy of the charclass. 2014-04-11 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: open CSET and transform into uppercase when MB_CUR_MAX == 1 In unibyte locales with -i, kwset matching isn't helpful, because dfamust doesn't extract the CSET entries. Fix dmamust so that it does that, and makes it possible to take out a longer fixed string from tokens. * src/dfa.c (dfamust): open CSET and transform into uppercase when MB_CUR_MAX == 1. 2014-04-11 Paul Eggert <eggert@cs.ucla.edu> grep: cleanup for HAS_DOS_FILE_CONTENTS issue While cleaning up the empty-string fix, I noticed that one part of the code worried about CRLF in pattern files whereas another part did not. Fix this by using the same approach in both places, and make the CRLF code more modular in the process. * src/dosbuf.c (dos_binary, dos_unix_byte_offsets): New functions. (undossify_input, dossified_pos): Do nothing if ! O_BINARY. * src/grep.c: Always include dosbuf.c so that the code is checked statically even on non-DOS hosts. (dos_binary, dos_unix_byte_offsets): New decls. (undossify_input): Declare unconditionally. * src/grep.c (fillbuf, print_line_head, main): * src/kwsearch.c (Fcompile): Simplify by not worrying about HAVE_DOS_FILE_CONTENTS. * src/grep.c (main): fopen with "rt" if O_TEXT; this is simpler than worrying about HAVE_DOS_FILE_CONTENTS elsewhere. * src/system.h (HAVE_DOS_FILE_CONTENTS): Remove. grep: cleanup for empty-string fix * NEWS: Document it. * src/dfasearch.c (GEAcompile): * src/kwsearch.c (Fcompile): Use C99-style decls to simplify. Avoid duplicate code. * tests/empty-line: Add some more tests like this. 2014-04-11 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: no match for the empty string included in multiple patterns * src/dfasearch.c (EGAcompile): Fix it. * src/kwsearch.c (Fcompile): Fix it. 2014-04-08 Paul Eggert <eggert@cs.ucla.edu> grep: remove bool_bf The extra complexity of this microoptimization wasn't ever much help, and currently it generated bigger code with gcc -O2 (x86-64). * src/dfa.c (bool_bf): Remove. All uses replaced by plain 'bool', without a bitfield. 2014-04-08 Jim Meyering <meyering@fb.com> maint: avoid sc_po_check syntax-check failure (kwset.c) * po/POTFILES.in: Remove kwset.c from this list, since it no longer contains a translatable diagnostic. 2014-04-08 Paul Eggert <eggert@cs.ucla.edu> grep: port better to hosts with nonstandard nl_langinfo On some hosts, nl_langinfo returns strings other than "UTF-8" when UTF-8 is used, and (worse) return "UTF-8" even if the encoding is single-byte. Work around these problems by trying a sample character instead. * src/dfa.c, src/pcresearch.c, src/searchutils.c: Don't include <langinfo.h>. * src/dfa.c (using_utf8): Test for UTF-8 by trying a character rather than by invoking nl_langinfo (CODESET); this is more portable in practice, and removes a dependency on HAVE_LANGINFO_CODESET. * src/pcresearch.c: Include dfa.h, for using_utf8. (Pcompile): Use using_utf8 rather than nl_langinfo. 2014-04-07 Paul Eggert <eggert@cs.ucla.edu> grep: prefer bool in DFA internals * src/dfa.c (bool_bf): New type. (dfa_state): Use it, as this seems to generate slightly better code with GCC. (struct mb_char_classes, struct dfa, equal, case_fold, dfasyntax) (laststart, parse_bracket_exp, lex, dfaparse, dfaanalyze, dfastate) (match_mb_charset, dfamust): Use bool for boolean. (using_utf8) [!HAVE_LANGINFO_CODESET]: Tune. (dfaanalyze): Prefer & to && and | to || on booleans; it's simpler here. (dfastate): Simplify charclass nonzero testing. Redo has_mbcset test so that the compiler's more likely to optimize it. 2014-04-07 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: prefer regex to DFA for ANYCHAR in multibyte locales * src/dfa.c (dfa_state): New member has_mbcset. Rename backref to has_backref, and make it of type bool too. All uses changed. (state_index, dfastate): Initialize new member. (dfaexec): Prefer regex to DFA for ANYCHAR in multibyte locales. 2014-04-07 Paul Eggert <eggert@cs.ucla.edu> grep: remove trival_case_ignore This optimization is no longer needed, given the other optimizations recently installed. Derived from a patch by Norihiro Tanaka; see <http://bugs.gnu.org/17019>. * bootstrap.conf (gnulib_modules): Remove assert-h. * src/dfa.c (CASE_FOLDED_BUFSIZE): Move here from dfa.h. Remove now-unnecessary static assert. (case_folded_counterparts): Now static. * src/dfa.h (CASE_FOLDED_BUFSIZE, case_folded_counterparts): Remove decls; no longer public. * src/dfasearch.c (kwsmusts): Use kwset even if fill MB_CUR_MAX > 1 and case-insensitive. * src/grep.c (MBRTOWC, WCRTOMB): Remove. (fgrep_to_grep_pattern): Use mbrtowc, not MBRTOWC. (trivial_case_ignore): Remove; this optimization is no longer needed. All uses removed. grep: simplify memory allocation in kwset * src/kwset.c: Include kwset.h first, to check its prereqs. Include xalloc.h, for xmalloc. (kwsalloc): Use xmalloc, not malloc, so that the caller need not worry about memory allocation failure. (kwsalloc, kwsincr, kwsprep): Do not worry about obstack_alloc returning NULL, as that's not possible. (kwsalloc, kwsincr, kwsprep, bmexec, cwexec, kwsexec, kwsfree): Omit unnecessary conversion between struct kwset * and kwset_t. (kwsincr, kwsprep): Return void since memory-allocation failure is not possible now. All uses changed. * src/kwset.h: Include <stddef.h>, for size_t, so that this include file doesn't require other files to be included first. grep: minor cleanups for Galil speedups * src/kwset.c: Update citations. Include stdbool.h. (kwsincr, kwsprep): Clarify by using C99 decls after statements. (kwsprep): Clarify by using MIN. Avoid a couple of buffer copies when !TRANS. (bmexec): Use bool for boolean. Prefer "continue;" to ";". 2014-04-07 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: use the Galil rule for Boyer-Moore algorithm in KWSet The Boyer-Moore algorithm is O(m*n), which means it may be much slower than the DFA. Its Galil rule variant is O(n) and increases efficiency in the typical case; it skips sections that are known to match and does not compare more than once for a position in the text. To use the Galil rule, look for the delta2 shift at each position from the trie instead of the 'mind2' value. * src/kwset.c (struct kwset): Replace member 'mind2' with 'shift'. (kwsprep): Look for the delta2 shift. (bmexec): Use it. 2014-04-06 Paul Eggert <eggert@cs.ucla.edu> grep: cleanup DFA superset optimization * src/dfa.c (dfa_charclass_index): New function, with body of old dfa_charclass but with an extra parameter D. (charclass_index): Reimplement in terms of dfa_charclass_index. (dfahint): Clarify. (dfasuperset): Do not assign to 'dfa' static variable. Instead, use a local, and use the new dfa_charclass_index function. This doesn't fix any bugs, but it's clearer. Initialize a few more members, to simplify dfafree. Copy the charclasses with just one memcpy call. Don't assign nonnull to D->superset until it's known to be valid; that's simpler. (dfafree, dfaalloc): Simplify based on dfasuperset initializations. * src/dfa.h (dfahint): Add comment. * src/dfasearch.c (EGexecute): Simplify use of memchr. Simplify by using memrchr. Fix typo that could cause a buffer read overrun. 2014-04-06 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: optimization with the superset of DFA The superset of a DFA is like the DFA, except that for speed ANYCHAR, MBCSET and BACKREF are replaced by (CSET full bits) STAR, and mb_cur_max is 1. For example, for 'a\(b\)c\1': original: a b CAT c CAT BACKREF CAT superset: a b CAT c CAT CSET STAR CAT (The CSET has all bits set.) If a string matches a DFA, it matches the DFA's superset. Using the superset to filter can dramatically improve performance, over 200x in some cases. See <http://bugs.gnu.org/16966>. * src/dfa.c (struct dfa): New member 'superset'. (dfahint, dfasuperset): New functions. (dfacomp): Create and analyze the superset. (dfafree): Free only non-NULL items. (dfaalloc): Initialize superset member. (dfaoptimize): If succeed in optimization for UTF-8 locale, don't use the superset. * src/dfa.h (dfahint): New decl. * src/dfasearch.c (EGexecute): Use dfahint. 2014-04-06 Jim Meyering <meyering@fb.com> build: avoid OS X 10.8.5 build failure due to lack of static_assert * bootstrap.conf (gnulib_modules): Add assert-h, to accommodate the new use of static_assert on systems lacking support for that construct. Without this change, compilation of dfa.c failed on OS X 10.8.5 with gcc-4.9.0 20140324. We should be using gnulib's assert-h module, regardless, for its nominal improved portability, since grep includes assert.h and uses assert. 2014-04-05 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: fix performance bug with regex in line-by-line mode * src/dfasearch.c (EGexecute): Match line-by-line with regex. 2014-04-05 Paul Eggert <eggert@cs.ucla.edu> grep: minor improvements to previous patch * src/dfa.c (MAX): New macro. (match_anychar, match_mb_charset, transit_state_consume_1char): Use it to simplify assignments. (SKIP_REMAINS_MB_IF_INITIAL_STATE): Prefer != 0 for unsigned. (free_mbdata): Omit an unnecessary 'free'. 2014-04-05 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: reuse multibyte DFA buffers in non-UTF8 locales * src/dfa.c (struct dfa): New members 'mblen_buf', 'nmblen_buf', 'inputwcs', 'ninputwcs', 'mb_follows' and 'mb_match_lens'. (mblen_buf, inputwcs): Remove static vars. (SKIP_REMAINS_MB_IF_INITIAL_STATE, match_anychar, match_mb_charset) (transit_state_consume_1char, transit_state, prepare_wc_buf): Use new members instead of global variables. (check_matching_with_multibyte_ops): Use new members instead of new allocation. (dfaexec): Initialize new members. (free_mbdata): Free new members. 2014-04-05 Paul Eggert <eggert@penguin.cs.ucla.edu> grep: simplify dfa.c by having it not include mbsupport.h directly * src/mbsupport.h: Remove. * src/Makefile.am (noinst_HEADERS): Remove mbsupport.h. * src/dfa.c, src/grep.c, src/search.h: Don't include mbsupport.h. * src/dfa.c: Include wchar.h and wctype.h unconditionally, as this simplifies the use of dfa.c in grep, and it does no harm in gawk. (setlocale, static_assert): Remove gawk-specific hacks, as gawk now does these itself. (struct dfa, dfambcache, mbs_to_wchar) (is_valid_unibyte_character, setbit_wc, using_utf8, FETCH_WC) (addtok_wc, add_utf8_anychar, atom, state_index, epsclosure) (dfaanalyze, dfastate, prepare_wc_buf, dfaoptimize, dfafree, dfamust): * src/dfasearch.c (EGexecute): * src/grep.c (main): * src/searchutils.c (mbtoupper): Assume MBS_SUPPORT. 2014-04-01 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: avoid re-building a state built previously * src/dfa.c (dfaexec): Avoid to re-build a state built previously. 2014-03-28 Paul Eggert <eggert@cs.ucla.edu> dfa: improve port to freestanding DJGPP Suggested by Aharon Robbins (Bug#17056). * src/dfa.c (setlocale) [!LC_ALL]: Return NULL, not "C", reverting part of a recent change. (using_simple_locale): Return true if setlocale returns null. 2014-03-28 Jim Meyering <meyering@fb.com> tests: placate "make syntax-check" re compare arg ordering * tests/euc-mb: Reverse order of arguments to compare. Be consistent in ordering compare arguments: expected followed by actual. 2014-03-28 Paul Eggert <eggert@cs.ucla.edu> dfa: avoid an indirection and port wint_t usage * src/dfa.c (struct dfa): Put mbrtowc_cache directly into struct dfa rather than having a pointer; this saves a malloc and an indirection. All uses changed. (dfambcache): Port to hosts where wint_t * can't be cast to wchar_t *. 2014-03-28 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: take mbrtowc_cache into new member of struct dfa When struct dfa more than one are used at the same time, mbrtowc cache may be conflict. So, take mbrtowc_cache into new member of struct dfa, and define each mbrtowc cache for them. * src/dfa.c (struct dfa): New member `mbrtowc_cache'. (dfambcache): Rename from build_mbrtowc_cache. Add dependency on struct dfa. (mbs_to_wchar): Add dependency on struct dfa. (FETCH_WC): Use it. (prepare_wc_buf): Use it. Add dependency on struct dfa. (dfacomp): Call it. (dfafree): Release it. 2014-03-28 Paul Eggert <eggert@cs.ucla.edu> dfa: cache results of mbrtowc for speed Idea suggested by Norihiro Tanaka in Bug#16842. * src/dfa.c (mbrtowc_cache): New static var. (build_mbrtowc_cache, mbs_to_wchar): New functions. (FETCH_WC) [MBS_SUPPORT]: Speed up by using mbs_to_wchar instead of mbrtowc and wctob. (FETCH_WC) [!MBS_SUPPORT]: Rewrite in terms of old FETCH macro. (FETCH): Remove; no longer used. (lex): Simplify by avoiding the need for FETCH. (prepare_wc_buf) [MBS_SUPPORT]: Speed up by using mbs_to_wchar. Simplify the loop. (dfacomp): Initialize the cache. 2014-03-27 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: perform the kwset-helping DFA match in narrower range When kwsexec gives us the offset of a potential match, we compute line begin/end and then run the DFA matcher to see if there really is a match on that line. When the beginning of the line, BEG, is not on a multibyte character boundary, advance BEG until it on such a boundary, before running the DFA search. * src/dfasearch.c (EGexecute): As above. Add a comment. * tests/euc-mb: Add a test case that exercises this code. This addresses http://debbugs.gnu.org/17095. 2014-03-26 Jim Meyering <meyering@fb.com> maint: fix "make dist" * src/Makefile.am (egrep fgrep): Specify egrep.sh via $(srcdir)/egrep.sh, so non-srcdir builds work once again. 2014-03-26 Paul Eggert <eggert@penguin.cs.ucla.edu> dfa: improve port to freestanding DJGPP * src/dfa.c (setlocale) [!LC_ALL]: Return "C", not NULL (Bug#17056). (using_simple_locale): Store setlocale result in a ptr-to-const. egrep, fgrep: improve diagnostics from shell scripts This should fix Bug#17098. * src/Makefile.am (EXTRA_DIST): Add egrep.sh. (egrep fgrep): Depend on egrep.sh and Makefile. Build from new file egrep.sh, as this makes the build process easier to follow. Arrange for $0 to look nicer in subgrep. * src/egrep.sh: New file. 2014-03-23 Paul Eggert <eggert@cs.ucla.edu> dfa: avoid undefined behavior * src/dfa.c (FETCH_WC, addtok_wc): Don't rely on undefined behavior when converting an out-of-range value to 'int'. (FETCH_WC, prepare_wc_buf): Don't rely on conversion state after mbrtowc returns a special value, as it's undefined for (size_t) -1. (prepare_wc_buf): Simplify test for valid character. grep: fix and simplify grep -iF optimization * src/grep.c (check_any_alphabets): Remove. (fgrep_to_grep_pattern): Fix problems when mbrtowc returns -1 or -2. Simplify a bit. (main): Don't bother optimizing 'grep -iF PAT' when PAT contains no alphabetics; it's so rare it's not worth the complexity. 2014-03-23 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: optimization for fgrep with changing the macher to grep macher. fgrep macher is only use kwset engine. However, it's very slow for case-insensitive matching in multibyte locales. And so, if the matcher is fgrep and case-insensitive and keys including any alphabets, change it into grep matcher by escape of keys. OTOH, if keys include no alphabet, turn match_icase flag off. I prepare following string to measure the performance. yes $(printf '%078dm' 0)| head -1000000 | tr 0 a > in A=`printf '\xef\xbc\xa1'` # FULLWIDTH LATIN CAPITAL LETTER A I run three tests with this patch (best-of-5 trials): env LC_ALL=en_US.UTF-8 time -p src/fgrep -i "$A" in real 8.54 user 7.13 sys 1.16 Back out that commit (temporarily), recompile, and rerun the experiment: env LC_ALL=en_US.UTF-8 time -p src/fgrep -i "$A" in real 0.07 user 0.02 sys 0.05 * src/fgrep.c (Gcompile) New function. * src/main.c (check_any_alphabets) New function. (fgrep_to_grep_pattern) New function. (main) Use them. 2014-03-23 Paul Eggert <eggert@cs.ucla.edu> egrep, fgrep: go back to shell scripts Although egrep's and fgrep's switch from shell scripts to executables may have made sense in 2005, it complicated maintenance and recently has caused subtle performance bugs. Go back to the old way of doing things, as it's simpler and more easily separated from the mainstream implementation. This should be good enough nowadays, as POSIX has withdrawn egrep/fgrep and portable applications should be using -E/-F anyway. * po/POTFILES.in: Remove src/egrep.c, src/fgrep.c, src/main.c. * src/Makefile.am (bin_PROGRAMS): Remove egrep, fgrep. (bin_SCRIPTS): New macro. (grep_SOURCES): Move searchutils.c, dfa.c, dfasearch.c, kwset.c, kwsearch.c, pcresearch.c here from libgrep_a_SOURCES. (egrep_SOURCES, fgrep_SOURCES, noinst_LIBRARIES, libgrep_a_SOURCES): Remove. (LDADD): Remove libgrep.a. (egrep, fgrep): New rules. (CLEANFILES): New macro. * src/grep.c: Rename from src/main.c. (usage, setmatcher, main): Simplify, since there's now just one executable. (Gcompile, Ecompile, Acompile, GAcompile, PAcompile, matchers): Move here from the (removed) src/grep.c. (compile_fp_t, execute_fp_t, struct matcher, matchers): Move here from src/grep.h, as they no longer need to be public. (struct matcher.name): Avoid one level of indirection/relocation. (do_execute, main): Fix a performance bug when it was compiled as 'fgrep', due to confusion about which matcher was which. (main): Fix a performance bug with -P, likewise. * src/grep.h (before_options, after_options): Remove. * src/egrep.c, src/fgrep.c, src/grep.c: Remove. dfa: port to freestanding DJGPP (Bug#17056) * src/dfa.c (setlocale) [!LC_ALL]: Define a dummy. 2014-03-16 Jim Meyering <meyering@fb.com> tests: avoid false-positive failure on some AMD CPUs * tests/mb-non-UTF8-performance: Avoid false-positive failure when run on certain AMD processors. 2014-03-10 Jim Meyering <meyering@fb.com> tests: make a performance-measuring test less system-sensitive Andreas Schwab reported in http://debbugs.gnu.org/16941 that this test would timeout and fail on m68k-suse-linux. Rather than testing absolute duration with a limit tuned to today's hardware, compare performance of grep with LC_ALL=C against that same command using LC_ALL=ja_JP.eucJP. * tests/init.cfg (require_hi_res_time_): New function. * tests/mb-non-UTF8-performance: Rewrite to use it: record absolute duration D of the first (normally much faster) command, and set a timeout of 8*D for the command running in an affected locale. 2014-03-09 Paul Eggert <eggert@cs.ucla.edu> maint: pacify 'make dist' * src/dfa.c (parse_bracket_exp): Reindent with spaces. * src/dfa.h (case_folded_counterparts): Prefix decl with 'extern'. * src/main.c: Don't include assert.h. 2014-03-07 Paul Eggert <eggert@cs.ucla.edu> fgrep: fix case-fold incompatibility with plain 'grep' fgrep converted to lowercase, whereas the regex code converted to uppercase. The resulting behaviors don't agree in offbeat cases like Greek sigmas and Turkish Is. Fix this by changing fgrep to agree with the regex code. * src/kwsearch.c (Fcompile, Fexecute): * src/searchutils.c (kwsinit, mbtoupper): Convert to uppercase, not to lowercase, for compatibility with plain 'grep'. * src/search.h, src/searchutils.c (mbtoupper): Rename from mbtolower, since it now converts to uppercase. All uses changed. * tests/case-fold-titlecase: Add tests for this. grep: fix case-fold mismatches between DFA and regex The DFA code and the regex code didn't use the same semantics for case-folding. The regex code says that the data char d matches the pattern char p if uc (d) == uc (p). POSIX is unclear in this area; the simplest fix for now is to change the DFA code to agree with the regex code. See <http://bugs.gnu.org/16919>. * src/dfa.c (static_assert): New macro, if not already defined. (setbit_case_fold_c): Assume MB_CUR_MAX is 1 and that case_fold is nonzero; all callers changed. (setbit_case_fold_c, parse_bracket_exp, lex, atom): Case-fold like the regex code does. (lonesome_lower): New constant. (case_folded_counterparts): New function. (parse_bracket_exp): Prefer plain setbit when case-folding is not needed. * src/dfa.h (CASE_FOLDED_BUFSIZE): New constant. (case_folded_counterparts): New function decl. * src/main.c (trivial_case_ignore): Case-fold like the regex code does. (main): Try to improve comment re trivial_case_ignore. * tests/case-fold-titlecase: Add lots more test cases. 2014-03-06 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest doc: do not overpromise --ignore-case's behavior * NEWS: Omit vague statement about titlecase that could be misinterpreted, and is more trouble than it's worth. * doc/grep.texi: Add @documentencoding. Fix copyright range to use endash not hyphen. (Matching Control): Do not overpromise what --ignore-case will do. Give examples of corner cases where the documentation does not specify behavior. 2014-03-05 Paul Eggert <eggert@cs.ucla.edu> maint: remove differences from gnulib regex code These don't seem to be needed with GCC 4.8.2, and are making maintenance harder. If we need to disable warnings with older compilers, we can add pragmas to the gnulib versions. See <http://bugs.gnu.org/16911#24>. * gl/lib/regcomp.c.diff, gl/lib/regex_internal.c.diff: * gl/lib/regex_internal.h.diff, gl/lib/regexec.c.diff: Remove. * cfg.mk (exclude_file_name_regexp--sc_prohibit_tab_based_indentation): Don't mention gl/* files. 2014-03-03 Paul Eggert <eggert@cs.ucla.edu> grep: fix comment * src/main.c (trivial_case_ignore): Fix comment typo. 2014-03-03 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: avoid to add same character to a bracket expression * src/main.c (trivial_ignore_case): Only when uppercase and/or lowercase is different from original character, add it to new pattern. 2014-03-02 Paul Eggert <eggert@cs.ucla.edu> grep: fix some unlikely bugs in trivial_case_ignore * src/main.c (MBRTOWC, WCRTOMB): Reformat as per usual GNU style. (trivial_case_ignore): Don't overrun buffer in the unusual case when a character has both lowercase and uppercase counterparts. Don't rely on undefined behavior when assigning out-of-range value to an 'int'. Simplify by avoiding unnecessary buffer copies. Work even with shift encodings, by using mbsinit to disable the optimization if we are not in the initial state when we replace B by [BCD]. 2014-03-02 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: revert removal of trivial_case_ignore Revive trivial_case_ignore function in order to be able to use kwset. * src/main.c (MBRTOWC, WCRTOMB): New macros. (trivial_case_ignore): New function. (main): Use it. 2014-03-02 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: optimization of bracket expression for non-UTF8 locales * src/dfa.c (addtok): Replace an MBCSET with a CSET even in non-UTF8 locales, and even when it has individual characters. 2014-03-01 Paul Eggert <eggert@cs.ucla.edu> doc: describe titlecase fix better * NEWS: Document behavior on lowercase text too. Suggested by Eric Blake in <http://bugs.gnu.org/16911#10>. * doc/grep.texi (Matching Control): Specify behavior of -i more precisely. 2014-02-28 Paul Eggert <eggert@cs.ucla.edu> grep: minor tuning for mb_case_map_apply * src/kwsearch.c (mb_case_map_apply): Avoid unnecessary widening of size_t to intmax_t. Avoid unnecessary reinitialization of k. grep: avoid 'inline' when it doesn't matter These days, compilers generally do just fine without advice from users about 'inline', and there's little need for 'static inline', just as there's little need for 'register'. * src/dfa.c (to_uchar): * src/dosbuf.c (guess_type, undossify_input, dossified_pos): * src/main.c (undossify_input): No longer inline. * src/search.h (mb_case_map_apply): Move from here ... * src/kwsearch.c (mb_case_map_apply): ... to here, and make it no longer 'inline'. grep: fix bugs with -i and titlecase * NEWS: Document this. * src/dfa.c (setbit_wc): Simplify. (setbit_c): Remove; no longer used. (setbit_case_fold_c, parse_bracket_exp, atom): Don't mishandle titlecase. For 'atom', this removes the need for the refactoring of Bug#16729. (lex): Use the slower approach only for letters that have a differing case. * tests/case-fold-titlecase: New file. * tests/Makefile.am (TESTS): Add it. grep: remove lint * src/main.c (MBRTOWC, WCRTOMB): Remove no-longer-used macros. 2014-02-28 Norihiro Tanaka <noritnk@kcn.ne.jp> grep: remove trivial_case_ignore * src/main.c (trivial_case_ignore): Remove. (main): Remove its use; this optimization is no longer needed. grep: don't match line-by-line for case-insensitive with grep and awk * src/main.c (matcher): Move decl up. (do_execute): With the grep or awk matchers, no need to match line by line. 2014-02-27 Jim Meyering <meyering@fb.com> maint: dfa: pass NULL, not 0, as 2nd arg to setlocale * src/dfa.c (using_simple_locale): Use NULL, not 0. 2014-02-27 Paul Eggert <eggert@cs.ucla.edu> * src/dfa.c (prednames): POSIX allows [[:xdigit:]] to match multibyte chars. * src/dfa.c (parse_bracket_exp): Parenthesize. grep: fix multiple bugs with bracket expressions * NEWS: Document this. * src/dfa.c (using_simple_locale): New function. (parse_bracket_exp): Handle bracket expressions like [a-[.z.]] correctly. Don't assume that dfaexec handles expressions like [^a-z] correctly, as they can match multiple characters in some locales. * tests/posix-bracket: New file. * tests/Makefile.am (TESTS): Add it. 2014-02-25 Stephane Chazelas <stephane.chazelas@gmail.com> align grep -Pw with grep -w For the -w option, with -P, we used to look for the pattern surrounded by word boundaries. That's different from what grep -w does and what the documentation describes. Now align with grep -w and the documentation by using PCRE look-behind and look-ahead operators to match the pattern if it is not surrounded by word constituents. * src/pcresearch.c (Pcompile): Use (?<!\w)(?:...)(?!\w) rather than \b(?:...)\b. * NEWS (Bug fixes): Mention it. * tests/pcre-w: New file. * tests/Makefile.am (TESTS): Add it. This complements the fix for http://debbugs.gnu.org/16865 2014-02-24 Stephane Chazelas <stephane.chazelas@gmail.com> grep -P: fix it so backreferences now work with -w and -x To implement -w and -x, we bracket the search term with parentheses. However, that set of parentheses had the default semantics of "capturing", i.e., creating a backreferenceable matched quantity. Instead, use (?:...), to create a non-capturing group. * src/pcresearch.c (Pcompile): Use (?:...) rather than (...). * NEWS (Bug fixes): Mention it. * tests/pcre-wx-backref: New file. * tests/Makefile.am (TESTS): Add it. This addresses http://debbugs.gnu.org/16865 2014-02-20 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.18 * NEWS: Record release date. tests: test for the non-UTF8 multi-byte performance regression Test for the just-fixed performance regression. With a 100-200x differential, it is reasonable to expect that a very slow system will be able to complete the designated task in a few seconds, while with the bug, even a very fast system would exceed the timeout. * tests/mb-non-UTF8-performance: New file. * tests/Makefile.am (TESTS): Add it. * tests/init.cfg (require_JP_EUC_locale_): New function. grep -i: avoid a performance regression in multibyte non-UTF8 locales * src/main.c: Include dfa.h. (trivial_case_ignore): Perform this optimization only for UTF8 locales. This rectifies a 100-200x performance regression in non-UTF8 multi-byte locales like ja_JP.eucJP. The regression was introduced by the 10x UTF8/grep-i speedup, commit v2.16-4-g97318f5. * NEWS (Bug fixes): Mention it. Reported by Norihiro Tanaka in http://debbugs.gnu.org/16232#50 maint: give dfa.c's using_utf8 function external scope * src/dfa.c (using_utf8): Remove "static inline". * src/dfa.h (using_utf8): Declare it. * src/searchutils.c (is_mb_middle): Use using_utf8 rather than rolling our own. 2014-02-20 Paul Eggert <eggert@cs.ucla.edu> tests: test [^^-^] in unibyte locales This is a bug in the current dfa.c, which was reintroduced by the recent reversion from RRI. * tests/unibyte-negated-circumflex: New file. * tests/Makefile.am (TESTS): Add it. * tests/init.cfg (require_unibyte_locale): New function. grep: fix bug with patterns like [^^-~] in unibyte locales * NEWS: Document this. * src/dfa.c (parse_bracket_exp): Escape patterns like [^^-~], or Awk patterns like [\^-\]], so that they are not misinterpreted by the system regex library. Check for system regex failure due to memory exhaustion. 2014-02-17 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.17 * NEWS: Record release date. 2014-02-17 Paolo Bonzini <bonzini@gnu.org> revert "grep: DFA now uses rational ranges in unibyte locales" The correct course of action for grep is to defer range interpretation to regex, because otherwise you can get mismatches between regexes with backreferences and those without. For example, [A-Z]. will use RRI but ([A-Z])\1 won't, with the confusing result that the first regex won't match a superset of the language described by the second regex. The source of the confusion is that, even though grep's dfa.c was changed to use range checking instead of strcoll, that code is only invoked if dfaexec is called with backref = NULL, and that never happens for grep! In the end, all that's needed for RRI is compiling --with-included-regex, and in that case the patch is almost a no-op. Almost, because there are corner cases that aren't handled correctly (e.g. [a-[.e.]], or regular expressions that include a NUL character), but this can be handled separately. * NEWS: Revert paragraph introduced by commit v2.16-7-g1078b64. * src/dfa.c (parse_bracket_exp): Revert back to regcomp/regexec. 2014-02-16 Mike Frysinger <vapier@gentoo.org> maint: ignore configure.lineno * .gitignore: Add configure.lineno. 2014-02-11 Benno Schulenberg <bensberg@justemail.net> help: remove surplus newline * src/main.c (usage): Remove inconsistent \n introduced by previous patch. 2014-02-10 Benno Schulenberg <bensberg@justemail.net> help: fix a line ending, and use the same word for similar things * src/main.c (usage): Change a stray 'n' to a newline, and use the word "display" for showing version info as for help text. 2014-02-09 Norihiro Tanaka <noritnk@kcn.ne.jp> speed up mb-boundary-detection after each preliminary match After each kwsexec or dfaexec match, we must determine whether the tentative match falls in the middle of a multi-byte character. That is what our is_mb_middle function does, but it was expensive, even when most input consisted of single-byte characters. The main cost was for each call to mbrlen. This change constructs and uses a cache of the lengths returned by mbrlen for unibyte values. The largest speed-up (3x to 7x, CPU-dependent) is when most lines contain a match, yet few are printed, e.g., when using grep -v common-pattern ... to filter out all but a few lines. * src/search.h (build_mbclen_cache): Declare it. * src/main.c: Include "search.h". [MBS_SUPPORT] (main): Call build_mbclen_cache in a multibyte locale. * src/searchutils.c [HAVE_LANGINFO_CODESET]: Include <langinfo.h>. (mbclen_cache): New global. (build_mbclen_cache): New function. (is_mb_middle) [HAVE_LANGINFO_CODESET]: Use it. * NEWS (Improvements): Mention it. 2014-02-01 Jim Meyering <meyering@fb.com> maint: use to_uchar function rather than explicit casts * src/system.h (to_uchar): Define function. * src/kwsearch.c (Fexecute): Use to_uchar twice in place of casts. * src/dfasearch.c (EGexecute): Likewise. * src/main.c (prepend_args): Likewise. * src/kwset.c (U): Define in terms of to_uchar. * src/dfa.c (match_mb_charset): Use to_uchar, not an explicit cast. 2014-01-27 Jim Meyering <meyering@fb.com> maint: remove vestiges of support for long-disabled --mmap option This option was disabled in March of 2010, and began to elicit a warning in January of 2012. Its time has come. * doc/grep.in.1: Remove mention. * doc/grep.texi: Likewise. * src/main.c (GROUP_SEPARATOR_OPTION, usage, MMAP_OPTION) (long_options, main): Remove all traces. * tests/Makefile.am (check_PROGRAMS): Remove mention of ignore-mmap. * tests/ignore-mmap: Remove file. * NEWS (Maintenance): Mention it. 2014-01-26 Jim Meyering <meyering@fb.com> maint: move two local variable declarations * src/dfasearch.c (kwsmusts): Move one declaration down to the point of definition. Move another into the sole scope where it is used. 2014-01-26 Norihiro Tanaka <noritnk@kcn.ne.jp> dfasearch: skip kwset optimization when multi-byte+case-insensitive Now that DFA searching works with multi-byte locales, the only remaining reason to case-convert the searched input is the kwset optimization. But multi-byte case-conversion is so expensive that it's not worthwhile even to attempt that optimization. * src/dfasearch.c (kwsmusts): Skip this function in ignore-case mode when the locale is multi-byte. (EGexecute): Now that this code need not handle multi-byte case-ignoring matches, remove the expensive copy/case-conversion code. With no case-converted buffer, there is no longer any need to call mb_case_map_apply, so remove it and associated code. (kwsincr_case): Remove function. Now, every use of this function is equivalent to a use of kwsincr. Replace all uses. * tests/turkish-eyes: Test all of -E, -F and -G. 2014-01-25 Norihiro Tanaka <noritnk@kcn.ne.jp> dfa: remove GREP-ifdef'd code in favor of code used by gawk For many years, gawk and grep have used different #ifdef'd bits of code relating to how the DFA matcher matches multibyte characters. Remove the GREP-specific code in favor of the code gawk uses. This permits us to avoid still more cases in which grep must resort to the expensive process of copying/case-converting each input line before matching against a case-converted regexp. * src/dfa.c (parse_bracket_exp, atom): As above. 2014-01-25 Jim Meyering <meyering@fb.com> gnulib: update to latest 2014-01-17 Paul Eggert <eggert@cs.ucla.edu> grep: DFA now uses rational ranges in unibyte locales Problem reported by Aharon Robbins in <http://bugs.gnu.org/16481>. * NEWS: * doc/grep.texi (Environment Variables) (Character Classes and Bracket Expressions): Document this. * src/dfa.c (parse_bracket_exp): Treat unibyte locales like multibyte. 2014-01-17 Aharon Robbins <arnold@skeeve.com> grep: add undocumented '-X gawk' and '-X posixawk' options See <http://bugs.gnu.org/16481>. * src/grep.c (GAcompile, PAcompile): New functions. (const): Use them. 2014-01-10 Pádraig Brady <P@draigBrady.com> tests: remove superfluous uses of printf * tests/turkish-eyes: Remove unnecessary uses of printf. 2014-01-09 Jim Meyering <meyering@fb.com> grep: make --ignore-case (-i) faster (sometimes 10x) in multibyte locales These days, nearly everyone uses a multibyte locale, and grep is often used with the --ignore-case (-i) option, but that option imposes a very high cost in order to handle some unusual cases in just a few multibyte locales. This change gets most of the performance of using LC_ALL=C without eliminating the ability to search for multibyte strings. With the following example, I see an 11x speed-up with a 2.3GHz i7: Generate a 10M-line file, with each line consisting of 40 'j's: yes jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj | head -10000000 > k Time searching it for the simple/noexistent string "foobar", first with this patch (best-of-5 trials): LC_ALL=en_US.UTF-8 env time src/grep -i foobar k 1.10 real 1.03 user 0.07 sys Back out that commit (temporarily), recompile, and rerun the experiment: git log -1 -p|patch -R -p1; make LC_ALL=en_US.UTF-8 env time src/grep -i foobar k 12.50 real 12.41 user 0.08 sys The trick is to realize that for some search strings, it is easy to convert to an equivalent one that is handled much more efficiently. E.g., convert this command: grep -i foobar k to this: grep '[fF][oO][oO][bB][aA][rR]' k That allows the matcher to search in buffer mode, rather than having to extract/case-convert/search each line separately. Currently, we perform this conversion only when search strings contain neither '\' nor '['. See the comments for more detail. * src/main.c (trivial_case_ignore): New function. (main): When possible, transform the regexp so we can drop the -i. * tests/turkish-eyes: New file. * tests/Makefile.am (TESTS): Use it. * NEWS (Improvements): Mention it. 2014-01-07 Paul Eggert <eggert@cs.ucla.edu> tests: port Solaris 10 /bin/sh patch back to GNU/Linux Problem reported by Jim Meyering. * tests/bre, tests/ere, tests/spencer1-locale: Prefer re_shell, not re_shell_. * tests/init.sh (re_shell): New var, which is exported instead of re_shell_. Port to Solaris 10 /bin/sh. Problem reported by Dagobert Michelsen in <http://bugs.gnu.org/16380>. * tests/bre, tests/ere, tests/spencer1-locale: Prefer re_shell_ to SHELL, if re_shell_ is set. * tests/init.sh (re_shell_): Export if it's used. 2014-01-01 Jim Meyering <meyering@fb.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.16 * NEWS: Record release date. gnulib: update to latest, for maint.mk fix maint: update copyright dates for 2014 Do that by running "make update-copyright". gnulib: update to latest 2013-12-31 Jim Meyering <meyering@fb.com> pcre: use PCRE_NO_UTF8_CHECK properly In order to obtain the behavior we want, i.e., to disable error-on-invalid-UTF-in-input, apply this PCRE option in pcre_exec, not when compiling. * src/pcresearch.c (Pexecute): Use PCRE_NO_UTF8_CHECK here, ... (Pcompile): ...rather than here. * tests/pcre-invalid-utf8-input: Adjust test case to test for this. 2013-12-26 Jim Meyering <meyering@fb.com> maint: fix inconsistent spacing in expression * src/main.c (prline): Fix inconsistent spacing in expression: s/ / /. 2013-12-26 behoffski <behoffski@grouse.com.au> maint: fix a garbled comment * src/dfa.c (XNMALLOC, etc.): Fix garbled comment wording. 2013-12-23 Jim Meyering <meyering@fb.com> maint: fix/improve a comment * src/main.c (prline): Replace untrue FIXME comment with one telling how the hard-to-reach code can be exercised. 2013-12-21 Santiago Ruano Rincón <santiago@debian.org> pcre: tell grep -P to relax its stance on invalid multibyte chars Do not exit-2 for invalid UTF-8 characters. Just prior to this change, this command would match no lines and fail like this: $ printf 'j\x82\nj\n'|LC_ALL=en_US.UTF-8 grep -P j|cat -A; echo $? grep: invalid UTF-8 byte sequence in input 2 After this change, the same command matches both lines, and succeeds: jM-^B$ j$ 0 * src/pcresearch.c (Pcompile): Use PCRE_NO_UTF8_CHECK, too, and add a comment. * tests/pcre-utf8: Add a test and a comment. This change did not work with Debian unstable pcre-8.31-2 or with some 8.33 and 8.34-based versions, but does work with Fedora 20's 8.33 and with a built-from-latest source library. Based on a patch by Santiago Ruano Rincón. See http://bugs.gnu.org/15758/ 2013-12-21 Jim Meyering <meyering@fb.com> tests: avoid FP failure due to exhausted memory * tests/long-line-vs-2GiB-read: Don't declare the test "failed" when running out of memory. In that case, skip it. 2013-12-18 Jim Meyering <meyering@fb.com> maint: add comments and split some long lines * src/main.c (do_execute): Add a comment. Split some lines longer than 80 bytes. pcre: avoid a nominal leak * src/pcresearch.c (Pcompile)[HAVE_LIBPCRE && !PCRE_STUDY_JIT_COMPILE]: We would leak "re" if built with HAVE_LIBPCRE but without PCRE_STUDY_JIT_COMPILE. Move the free out one level. maint: indent cpp directives to reflect nesting * src/pcresearch.c: Insert spaces after a few "#", to indent cpp directives to reflect their nesting. grep: handle lines longer than INT_MAX on more systems When trying to exercize some long-line-handling code, I ran these commands: $ dd bs=1 seek=2G of=big < /dev/null; grep -l x big; echo $? grep: big: Invalid argument 2 grep should not have issued that diagnostic, and it should have exited with status 1, not 2. What happened? grep read the 2GiB of NULs, doubled its buffer size, copied the 2GiB into the new 4GiB buffer, and proceeded to call "read" with a byte-count argument of 2^32. On at least Darwin 12.5.0, that makes read fail with EINVAL. The solution is to use gnulib's safe_read wrapper. * src/main.c: Include "safe-read.h" (fillbuf): Use safe_read, rather than bare read. The latter cannot handle a read size of 2^32 on some systems. * bootstrap.conf (gnulib_modules): Add safe-read. * tests/long-line-vs-2GiB-read: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. 2013-11-25 Jim Meyering <meyering@fb.com> tests: port to non-GNU sed * tests/multibyte-white-space (utf8_space_characters): The generation of test inputs relied on GNU sed's interpretation of \<, but that is not portable, and caused spurious test failures. Adjust the sed regexp to work on all versions. Reported by Karl Dubost in http://bugs.gnu.org/15953. 2013-11-22 Jim Meyering <meyering@fb.com> maint: minor cleanup: xmalloc+strcpy -> xmemdup * src/main.c (main): Replace an xmalloc+strcpy combination with an equivalent use of xmemdup. 2013-11-21 Jim Meyering <meyering@fb.com> Paul Eggert <eggert@cs.ucla.edu> dfa: avoid undefined behavior of "1 << 31" * src/dfa.c (charclass): Change type from "int" to "unsigned int". (tstbit): Rather than shifting "1" left to form a mask, shift the LHS bits the right and use "1" as the mask. Also, return bool, rather than "int". (setbit, clrbit, dfastate): Don't shift "1" (aka (int)1) left by 31 bits. Instead, use "1U" as the operand, to avoid undefined behavior. Spotted by gcc's new -fsanitize=undefined. 2013-11-02 Jim Meyering <meyering@fb.com> grep: fix regression with -P vs. invalid UTF-8 input * src/pcresearch.c (Pexecute): Don't abort upon unexpected PCRE-specific error code. Explicitly handle PCRE_ERROR_BADUTF8, and change the default to print a diagnostic including the unhandled integer PCRE error code and exit with status 2. * tests/pcre-invalid-utf8-input: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. * THANKS: Update. Reported by Dave Reisner in http://bugs.gnu.org/15758. grep: fix regression involving \s and \S Commit v2.14-40-g01ec90b made \s and \S work with multi-byte characters, but it made it so any use like \s*, \s+, \s?, \s{3} would malfunction in a multi-byte locale. * src/dfa.c (lex): Also reset laststart. * tests/backslash-s-and-repetition-operators: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. * THANKS: Update. Reported by Mirraz Mirraz in http://bugs.gnu.org/15773. 2013-11-01 Jim Meyering <meyering@fb.com> maint: NEWS: document a release-related bug fix * NEWS (Bug fixes): Add an entry for a fix pulled from gnulib. 2013-10-26 Jim Meyering <meyering@fb.com> build: update gnulib submodule to latest This pulls in a gnulib fix for maint.mk that ensures the procedure described in README-release actually does what we want. Before this change, that procedure resulted in a grep-2.15 tarball that would lead to a grep binary whose --version- reported version number was 2.14.51... rather than the expected 2.15. maint: avoid automake deprecation warning re ACLOCAL_AMFLAGS * Makefile.am (ACLOCAL_AMFLAGS): Don't use this deprecated variable. * configure.ac (AC_CONFIG_MACRO_DIRS): Use this instead. (AUTOMAKE_OPTIONS): Require automake-1.12. maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.15 * NEWS: Record release date. 2013-10-25 Paul Eggert <eggert@cs.ucla.edu> build: port to AIX Problem reported by Pavel Kharitonov in <http://bugs.gnu.org/15690#68>. * src/Makefile.am (LDADD): Add $(LIBTHREAD). build: avoid duplicate -funit-at-a-time etc. options * configure.ac (WERROR_CFLAGS): Don't add -fdiagnostics-show-option and -funit-at-a-time, as Gnulib does that for us now, and we're merely piling on duplicats. 2013-10-24 Jim Meyering <meyering@fb.com> tests: port more tests to bourne shells with hex-challenged printf * tests/pcre-utf8: Convert the hex \xHH literals for the euro symbol to octal \OOO. * tests/turkish-I: Likewise for "I with dot". * tests/turkish-I-without-dot: Likewise for another Turkish I: U+0131. maint: clean up an ugly 'while' condition * src/main.c (get_nondigit_option): Separate a slightly baroque "while" expression into two separate statements, both inside the loop. 2013-10-23 Jim Meyering <meyering@fb.com> tests: port to bourne shells whose printf doesn't grok hex Use octal escapes, not hex, in printf(1) format strings, and in one case, use $AWK's printf so we can continue to use the table of hex values. * tests/char-class-multibyte: Use printf octal escapes, not hex, for portability to shells like dash and Solaris 10's /bin/sh. * tests/backslash-s-vs-invalid-multitype: Likewise. * tests/surrogate-pair: Likewise. * tests/unibyte-bracket-expr: Count in decimal and convert to octal. * tests/multibyte-white-space (hex_printf): New function. Use it in place of printf so we can retain the table of hex digits without hitting the limitation of some bourne shells. Reported by Paul Eggert in http://bugs.gnu.org/15690#11 2013-10-21 Jim Meyering <meyering@fb.com> gnulib: update to latest maint: remove now-unused wcscoll module * bootstrap.conf (gnulib_modules): Remove wcscoll; no longer used. 2013-10-20 Paul Eggert <eggert@cs.ucla.edu> build: avoid chatter from Automake 1.14 * configure.ac (AM_INIT_AUTOMAKE): Add subdir-objects. build: port shell pattern to Solaris 10 * configure.ac: Don't use unquoted '^' in a pattern, as this breaks 'configure' on Solaris 10, whose /bin/sh complains about it, which causes 'configure' to exit even before it finds a decent shell. Unix 7th edition shell accepted '^' as an alias for '|'. build: port to platforms that predefine _FORTIFY_SOURCE Problem reported by Brenton Hoff (Bug#15663). * configure.ac (_FORTIFY_SOURCE): Don't define if already defined. This is what Emacs does. 2013-10-20 Jim Meyering <meyering@fb.com> build: update gnulib submodule to latest 2013-10-19 Jim Meyering <meyering@fb.com> tests: extend the multibyte-white-space test * tests/multibyte-white-space (utf8_space_characters): Add more single-byte whitespace characters. Align RHS hex values and make the sed substitution less rigid, to accommodate. Also, ensure that grep '\S' exits with status 1. maint: update bootstrap to latest from gnulib * bootstrap: Update from gnulib. maint: fix typo in NEWS * NEWS: Fix/improve example commands in most recent entry. The LC_ALL envvar setting goes before grep, not before printf. Don't reference src/ in the second example command, and do specify the locale. 2013-10-09 Jim Meyering <meyering@fb.com> tests: add a test for better coverage of some tricky code * tests/spencer1.tests: Add a non-range bracket expression representing the same regexp, to cover the alternate code path, the one that does not require a regcomp/exec call to interpret the regexp. 2013-10-01 Jim Meyering <meyering@fb.com> tests: ensure neither \s nor \S matches an invalid multibyte character * tests/backslash-S-vs-invalid-multitype: New file. Prompted by the bug report from Roman at http://savannah.gnu.org/bugs/?40009 * tests/Makefile.am (TESTS): Add it. dfa: fix \s and \S to work for multibyte * src/dfa.c (lex): In multibyte mode, we can't treat \s and \S as we do in single-byte mode. Map them to [[:space:]] and [^[:space:]] respectively, to make the DFA matcher use the regex-matcher for this term. * tests/multibyte-white-space: New file. Test for the bug. * tests/Makefile.am (TESTS): Add it. This bug was introduced with the addition of DFA support for \s and \S in commit v2.5.4-112-gf979ca0. 2013-09-30 Jim Meyering <meyering@fb.com> maint: change all references: s/POSIX\.2/POSIX/ There is no longer any point in referring to POSIX.N. POSIX is sufficient. * doc/grep.in.1: As above. * src/main.c (main): Likewise. * tests/file: Likewise. * tests/options: Likewise. * ChangeLog: Likewise. * NEWS: Likewise. * cfg.mk: Update, to match changed NEWS. Inspired by Glenn Golden's suggestion in http://bugs.gnu.org/15486 2013-09-22 Jim Meyering <meyering@fb.com> dfa: remove dead disjunct * src/dfa.c (parse_bracket_exp): Remove dead disjunct. At that point, we know MB_CUR_MAX <= 1, so the test, MB_CUR_MAX > 1 && ... is always false. Remove the disjunct. maint: dfa: improve comments and formatting * src/dfa.c (add_utf8_anychar): Correct wording/alignment of a comment. (dfaexec): Add curly braces around multi-line while statement within a "then" block. (ANYCHAR): Clarify comment: "." does not match an invalid UTF8 character. (parse_bracket_exp) Improve comment. 2013-09-08 Jim Meyering <meyering@fb.com> dfa: appease a static analyzer, and save 95 stack bytes * src/dfa.c (MAX_BRACKET_STRING_LEN): Rename from BRACKET_BUFFER_SIZE and decrease from 128 to 32. (parse_bracket_exp): Add one byte more than MAX_BRACKET_STRING_LEN to the length of "str" buffer, to avoid appearance that we may store the trailing NUL beyond the end of buffer. A string of length 32 or greater is rejected by earlier processing, so would never reach this code. Addresses http://bugs.gnu.org/15307 2013-09-01 Corinna Vinschen <vinschen@redhat.com> fix Cygwin UTF-16 surrogate-pair handling with -i grep -i would segfault on systems using UTF-16-based wchar_t (Cygwin) when converting an input string containing certain 4-byte UTF-8 sequences to lower case. The conversions to wchar_t and back to a UTF-8 multibyte string did not take surrogate pairs into account. * src/searchutils.c (mbtolower) [__CYGWIN__]: Detect and handle surrogate pairs when converting. * NEWS (Bug fixes): Mention it. * tests/surrogate-pair: New test. * tests/Makefile.am (TESTS): Add it. Reported by: Jim Burwell 2013-08-19 Paul Eggert <eggert@cs.ucla.edu> doc: mention how to use the latest gnulib * README-hacking: Steal some text from coreutils/README-hacking. 2013-08-10 Jim Meyering <meyering@fb.com> build: update gnulib-related code * gnulib: Update submodule to latest. * bootstrap: Update from gnulib. * gl/lib/regex_internal.h.diff: Update to reflect gnulib changes. * bootstrap.conf: Partial sync from coreutils. 2013-08-09 Jim Meyering <meyering@fb.com> tests: simplify and factor newest test * tests/char-class-multibyte2: Simplify file names. Factor out $e_acute, so that the grep argument representation is ascii (though the value is still UTF8). doc: NEWS: mention the DFA segfault fix * NEWS (Bug fixes): List the DFA segfault fix. 2013-07-05 Paul Eggert <eggert@cs.ucla.edu> Redo comments and white space to better approach GNU style. 2013-07-05 Paolo Bonzini <bonzini@gnu.org> tests: add testcase for previous change * tests/Makefile.am (TESTS): add char-class-multibyte2. * tests/char-class-multibyte2: New file. 2013-07-05 Mike Haertel <mike@ducky.net> dfa: fix multibyte character in brackets with repetition Let FOO stand for any multibyte (e.g. CJK character) in the regexp. It turns out the following much simpler regexp: ([^.]*[FOO]){1,2} is sufficient to cause the crash. In the first step of its parsing, DFA transforms regexp from human readable syntax into reverse-polish form. For regexps of the form a{m,n} repeat counts, it simply builds repeated copies of the representation of a, with appropriate inserted CAT and QMARK operators. For the above example with a regexp of the form a{1,2} it would build: <RPN representation for a> <RPN representation for a> QMARK CAT When building repeated copies of RPN representations, additional copies of the RPN representations are made by calling a function copytoks() with arguments consisting of the start position and length of the original copy. The problem is that the current code for copytoks() is simply incorrect. It operates by calling addtok() for each individual token in the source range being copied. But, in the particular case that the token being added is MBCSET, addtok(): (1) incorrectly assumes that the character set being added to be added is the one most (addtok has no argument to indicate which cset is being added, so it just uses the latest one) (2) attempts to do some token sequence expansion into more primitive operators so things like [FOO] are matched efficiently. Both of these assumptions are incorrect in the case that addtok() is being called from copytoks(): (1) is simply not true, and (2) is redundant--the expansion has already been done token sequence being copied, so there is no need to do the expansion again. The correct function to add exactly one token, without further expansion, is addtok_mb(). So here is my proposed fix, which is that copytoks() should never call addtok(), but instead directly call addtok_mb() (which is what addtok() eventually calls). * src/dfa.c (copytoks): Rewrite using addtok_mb directly. 2013-05-28 Jim Meyering <meyering@fb.com> maint: align backslashes consistently * tests/Makefile.am: Most backslashes were aligned with TABs, so adjust the few that used spaces to conform. grep -F: avoid an infinite loop with invalid multi-byte search string * src/kwsearch.c (Fexecute): Avoid an infinite loop when processing a fixed (-F) multibyte search string that is an invalid byte sequence in the current locale and that matches the bytes of the input twice on a line. Reported by Daisuke GOTO in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4773 * tests/invalid-multibyte-infloop: New test. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. 2013-04-18 Paul Eggert <eggert@cs.ucla.edu> * cfg.mk (old_NEWS_hash): Update. doc: document EREs like a{,10} Problem reported by Eric Blake in <http://lists.gnu.org/archive/html/bug-grep/2013-04/msg00005.html>. * NEWS: Document the bug fix. * doc/grep.in.1: Restore documentation for this feature, but mention that it is a GNU extension. * doc/grep.texi (Fundamental Structure): Mention that this feature is a GNU extension. 2013-04-02 Paul Eggert <eggert@cs.ucla.edu> build: make dfa.c closer to Gawk's * src/dfa.c: Include <stddef.h>, not <sys/types.h>. stddef.h is smaller and is all we need and is portable nowadays. Include <wchar.h> and <wctype.h> only if MBS_SUPPORT. 2013-01-15 Paul Eggert <eggert@cs.ucla.edu> grep: make dfa.h standalone Problem reported by Aharon Robbins in <http://lists.gnu.org/archive/html/bug-grep/2013-01/msg00007.html>. * src/dfa.c: Include dfa.h first, so that it's tested standalone. No need to include <regex.h>, since we are in charge of dfa.h and know that it includes <regex.h>. * src/dfa.h: Include <regex.h> and <stddef.h>, so that it's standalone. 2013-01-11 Stefano Lattarini <stefano.lattarini@gmail.com> build: update gettext version to 0.18.2 * configure.ac (AM_GNU_GETTEXT_VERSION): Update to 0.18.2. This is necessary to have the gettext-provided m4 files to use AC_PROG_MKDIR_P rather than AM_PROG_MKDIR_P. This latter macro, planned to disappear in Automake 1.14, has already been removed in the development version of Automake, so that, without this change, grep fails to bootstrap with bleeding-edge Automake. 2013-01-11 Paul Eggert <eggert@cs.ucla.edu> build: update gnulib submodule to latest 2013-01-11 Stefano Lattarini <stefano.lattarini@gmail.com> build: remove redundant use of $(INCLUDES) * lib/Makefile.am (INCLUDES): Remove. Automake automatically adds $(srcdir) and $(top_builddir) to the C preprocessor search path. INCLUDES is deprecated in Automake 1.13 (causing a runtime warning), and will be removed in Automake 1.14. 2013-01-04 Jim Meyering <jim@meyering.net> build: update gnulib submodule to latest maint: update all copyright year number ranges Run "make update-copyright". 2012-11-20 Paul Eggert <eggert@cs.ucla.edu> grep: normalize diagnostics * src/pcresearch.c (Pcompile): Use similar format diagnostics as elsewhere, and translate them. 2012-11-19 Paul Eggert <eggert@cs.ucla.edu> grep: diagnose read errors from -f dir, porting to Solaris Problem reported by Dennis Clarke for Solaris 10 in <http://lists.gnu.org/archive/html/bug-grep/2012-11/msg00009.html>. * src/main.c (main): For -f F, diagnose any read errors encountered when reading F. * tests/Makefile.am (XFAIL_TESTS): Remove grep-dir. * tests/grep-dir: Don't assume that directories cannot be read via fread, as POSIX allows this and it can happen on Solaris. 2012-11-09 Paolo Bonzini <bonzini@gnu.org> pcre: add PCRE-JIT support for grep * NEWS: Document new feature. * src/pcresearch.c [PCRE_STUDY_JIT_COMPILE] (jit_stack): New. [PCRE_STUDY_JIT_COMPILE] (Pcompile): JIT-compile the regular expression and allocate a stack for it. Based on a patch from Zoltan Herczeg. * THANKS: Add Zoltan to the list. 2012-10-24 Paul Eggert <eggert@cs.ucla.edu> build: go back to AC_PROG_CC * configure.ac: Go back to using AC_PROG_CC rather than AC_PROG_CC_STDC, as the latter is obsolescent and the Autoconf bug involving the former has been fixed. 2012-10-24 Jim Meyering <jim@meyering.net> build: use AC_PROG_CC_STDC rather than AC_PROG_CC * configure.ac: Use AC_PROG_CC_STDC rather than AC_PROG_CC, to accommodate autoconf-2.69-37+. build: update gnulib submodule to latest 2012-10-23 Eric Blake <eblake@redhat.com> build: default to --enable-gcc-warnings in a git tree Anyone building from cloned sources can be assumed to have a new enough environment, such that enabling gcc warnings by default will be useful. Tarballs still default to no warnings, and the default can still be overridden with --disable-gcc-warnings. * configure.ac (gl_gcc_warnings): Set default based on environment. 2012-10-03 Jim Meyering <meyering@redhat.com> maint: factor out STREQ definition * src/main.c (STREQ): Remove definition. * src/pcresearch.c: (STREQ): Likewise. * src/system.h (STREQ): Define it here instead. maint: correct syntax-check failures; adjust NEWS * tests/pcre-utf8: Reverse order of compare arguments. Remove all copyright year numbers except 2012. Use skip_ "diagnostic...", rather than a bare "exit 77". * NEWS: Start with a concise description of the bug. * src/pcresearch.c (STREQ): Define, so that we can... (Pcompile): use STREQ, not strcmp. 2012-10-03 Paolo Bonzini <bonzini@gnu.org> tests: include UTF-8 testcases for grep -P * tests/Makefile.am (TESTS): Add pcre-utf8. * tests/pcre-utf8: New file. 2012-10-03 Petr Pisar <ppisar@redhat.com> pcresearch: set UTF-8 flag correctly for UTF-8 locales Otherwise, Unicode properties (\p{XXX}) do not work with characters outside the 7-bit ASCII character set. * src/pcresearch.c (Pcompile): Look for UTF-8 locales and set PCRE_UTF8 if one is found. 2012-10-03 Jaroslav Å karvada <jskarvad@redhat.com> doc: fix a formatting bug in grep.1 template * doc/grep.in.1: Insert .TP before the paragraph describing --dereference-recursive (-R). 2012-10-03 Jim Meyering <meyering@redhat.com> maint: placate gcc's -Wjump-misses-init warning * src/kwsearch.c (Fexecute): Replace a "goto" and "return" with a simple return statement, eliminating the label, since that was the sole use. * src/dfasearch.c (EGexecute): Likewise. 2012-09-01 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest 2012-09-01 Eric Blake <eblake@redhat.com> build: work with new glibc when not optimizing Starting with glibc 2.15, the system headers refuse to compile unconditional use of FORTIFY_SOURCE if optimization is disabled but -Werror is in effect. * configure.ac (FORTIFY_SOURCE): Make conditional. 2012-08-19 Jim Meyering <meyering@redhat.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.14 * NEWS: Record release date. 2012-08-07 Jim Meyering <meyering@redhat.com> build: update gnulib and bootstrap tests: test for bug with -i and ^$ in a multi-byte locale * tests/empty-line-mb: New file. * tests/Makefile.am (TESTS): Add it. grep -i '^$' in a multi-byte locale could report a false match * src/dfasearch.c (EGexecute): Do not match the sentinel "newline" that is appended to each buffer. This bug may sound like a big deal (it certainly surprised me), but realize that only the empty-line-matching regular expression '^$' can trigger it, and then only when you add the unnecessary (and arguably superfluous) -i, *and* run the command in a multi-byte locale. Using a multi-byte locale for such a regular expression is also pointless, and hurts performance. * NEWS (Bug fixes): Mention it. Reported by Alexander Katassonov <katasso@gmx.de> 2012-08-06 Jim Meyering <meyering@redhat.com> tests: fix a skip diagnostic that mentioned the wrong locale * tests/init.cfg (require_tr_utf8_locale_): s/en_US/tr_TR/ 2012-08-02 Jim Meyering <meyering@redhat.com> tests: skip failing test on FS/system that lack SEEK_HOLE support * tests/big-hole: Test for SEEK_HOLE support. If not available, skip this test. Hence, this test is now skipped on linux-3.5.0 with ext4 or tmpfs. The test runs (and passes) with at least btrfs, xfs, or ocfs2. * bootstrap.conf (gnulib_modules): Use the perl module. 2012-07-30 Jim Meyering <meyering@redhat.com> maint: optimize long-line processing * src/main.c (grep): Use memrchr rather than an open-coded loop, reducing the cost of the replaced code by 50% when processing very long lines. If there were a rawmemrchr function (analogous to glibc's rawmemchr), then the performance improvement would be even greater. 2012-07-27 Paul Eggert <eggert@cs.ucla.edu> maint: remove stat-size * bootstrap.conf (gnulib_modules): Remove stat-size. * src/main.c: Don't include stat-size.h; no longer needed. grep: don't falsely report compressed text files as binary * NEWS: Document this. * src/main.c (file_is_binary): Remove the heuristic based on st_blocks, as it does not work for compressed file systems. On Solaris, it'd be cheap to test whether the file system is known to be uncompressed, which allow the heuristic, but Solaris has SEEK_HOLE so there's little point. grep: don't falsely report tiny text files as binary * NEWS: Document this. * src/main.c (file_is_binary): When we are already at apparent EOF, skip the file-size check, as some servers use zero blocks to store binary files. Reported by Martin Carroll in <http://lists.gnu.org/archive/html/bug-grep/2012-07/msg00016.html>. 2012-07-26 Paul Eggert <eggert@cs.ucla.edu> doc: document -r/-R in man page * doc/grep.in.1: Document -r vs. -R. 2012-07-21 Jim Meyering <meyering@redhat.com> tests: avoid false positive upon kernel OOM-kill * tests/big-match (skip_diagnostic): Handle case of 139 (SIGKILL) with no diagnostic. build: update gnulib and bootstrap maint: fix misspellings in old ChangeLog * ChangeLog-2009: Fix typos. 2012-07-19 Paul Eggert <eggert@cs.ucla.edu> grep: fix ptrdiff/size_t clash Reported by Jaroslav Å karvada in <http://savannah.gnu.org/bugs/?36883>. * src/dfasearch.c (EGexecute): Use size_t, not ptrdiff_t, for lengths. Use regoff_t to store re_match's output, and test it before converting it to size_t. 2012-07-06 Jim Meyering <meyering@redhat.com> maint: correct log typo, to reflect in generated ChangeLog * Makefile.am (gen-ChangeLog): Use --amend, now that we must make our first log correction. * build-aux/git-log-fix: New file. 2012-07-04 Jim Meyering <meyering@redhat.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.13 * NEWS: Record release date. build: update gnulib submodule, bootstrap, init.sh 2012-06-17 Jim Meyering <meyering@redhat.com> tests: add another turkish-I-related test case * tests/turkish-I-without-dot: Also exercise the case in which the original string and the lower-case buffer have precisely the same length (22 bytes here), yet internal offsets do differ. 2012-06-16 Jim Meyering <meyering@redhat.com> grep -i: work also when converting to lower-case inflates byte count Commit v2.12-16-g7aa698d addressed the case in which the lower-case representation of an input byte occupies fewer bytes than the original. However, even with commit v2.12-20-g074842d, grep -i would still misbehave when converting a character to lower-case increased its byte count. The map-manipulation code assumed that the case conversion could only shrink the byte count. With the consideration that it may also inflate it, the deltas recorded in the map array must be signed, and we must account for the one-to-two-or-more mapping when the original-to-lower-case conversion causes the byte count to increase. * src/searchutils.c (mbtolower): When a lower-case character occupies more than one byte, set its remaining map slots to zero. Change the type of the map to be signed, and compute the change in character byte count as new_length - old_length. * src/search.h: Include <stdint.h>, for decl of intmax_t. (mb_case_map_apply): Adjust for signed increments: each map entry is now signed. (mb_len_map_t): Define type. Thanks to Paul Eggert for noticing in review that using a bare "char" as the base type would be wrong on systems for which it is a signed type (as with gcc's -funsigned-char). * src/kwsearch.c (Fcompile, Fexecute): Likewise. * src/dfasearch.c (kwsincr_case, EGexecute): Likewise. * tests/turkish-I-without-dot: New test. Thanks to Paolo Bonzini for the tip that in the tr_TR.utf8 locale, mapping "I" to lower case increases the character's byte count. * tests/Makefile.am (TESTS): Add it. * tests/init.cfg (require_tr_utf8_locale_): New function. * NEWS (Bug fixes): Expand the existing entry. 2012-06-12 Paul Eggert <eggert@cs.ucla.edu> grep: handle -i when chars differ in length but line does not * src/searchutils.c (mbtolower): Return the map back to the caller if any input character's length differs from the corresponding output character's, not merely if the total string length differs. Problem reported by Johannes Meixner in <http://lists.gnu.org/archive/html/bug-grep/2012-06/msg00029.html>. 2012-06-07 Jim Meyering <meyering@redhat.com> tests: extend coverage of dfa.c's match_mb_charset Add a test case to increase test coverage of part of dfa.c (the DFA matcher used by grep and gawk). While thinking about removing the few remaining uses of strncpy in dfa.c, I found that none of the existing tests covered the 40+ lines of code at the end of match_mb_charset, so constructed this test case to demonstrate that it's not dead code * tests/dfa-coverage: New test, for improved coverage. * tests/Makefile.am (TESTS): Add it. 2012-06-05 Jim Meyering <meyering@redhat.com> build: fix a subtly twisted "make distcheck" failure "make distcheck" would fail when, during a test build, an attempt to overwrite the deliberately-write-protected $(srcdir)/grep.pot file would fail. * bootstrap.conf (bootstrap_epilogue): Don't let the existence of a large sparse file in the build directory induce "make distcheck" failure. The existence of a large sparse test file named 8T-or-so would make po/Makefile.in.in's use of grep (to search for "GNU grep" as an indication that this is a GNU package) exit 2 without generating any output, which made the first xgettext use --package-name=grep, while that same search for "GNU grep" would succeed when run from a pristine from-tarball build, thus making the second xgettext invocation use --package-name='GNU grep'. That mismatch: -"Project-Id-Version: grep 2.12.18-1080\n" +"Project-Id-Version: GNU grep 2.12.18-1080\n" led to the attempt by Makefile.in.in's grep.pot-update rule to overwrite ../../grep.pot in the read-only po/ source directory. 2012-06-03 Jim Meyering <meyering@redhat.com> build: update gnulib submodule, bootstrap and init.sh cfg.mk: Exempt dfa.c from the new no-strncpy test, for now. 2012-06-02 Jim Meyering <meyering@redhat.com> grep: fix how -i works with a match containing the Turkish I-with-dot Fix a long-standing problem in the way grep's -i interacts with data whose byte count changes when we convert it to lower case. For example, the UTF-8 Turkish I-with-dot (İ) occupies two bytes, but its lower case analog, i, occupies just one byte. The code converts both search string and the haystack data to lower case, and then searches for the modified string in the modified buffer. The trouble arose when using a lowercase buffer <offset,length> pair to manipulate the original (longer) buffer. The solution is to change mbtolower to return additional information: a malloc'd mapping vector. With that, the caller maps the lowercase- relative <offset,length> to numbers that refer to the original buffer. This mapping is used only when lengths actually differ, so the cost in general should be small. * src/searchutils.c (mbtolower): Add the new map parameter. * src/search.h (mb_case_map_apply): New function. * src/kwsearch.c (Fexecute): Update mbtolower caller, and upon success, apply the new map. * src/dfasearch.c (EGexecute): Likewise. * tests/Makefile.am (XFAIL_TESTS): Remove turkish-I from this list; that test is no longer expected to fail. * NEWS (Bug fixes): Mention it. Reported by Ilya Basin in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/3413 and later by Strahinja Kustudic in http://savannah.gnu.org/bugs/?36567 2012-06-01 Paul Eggert <eggert@cs.ucla.edu> grep: remove unnecessary "what-if-signal?" code * src/main.c (fillbuf): Don't worry about EINTR when closing -- not possible, since we're not catching signals. 2012-05-16 Paul Eggert <eggert@cs.ucla.edu> grep: avoid nominal integer overflow * src/dfa.c (add_utf8_anychar): Avoid signed integer overflow. Although this works on all platforms we know about, strictly speaking the behavior is undefined, and Sun C 5.8 warns about it. 2012-05-15 Jim Meyering <meyering@redhat.com> maint: avoid nit-picky syntax-check test failure; tweak big-hole test * NEWS: Restore deleted newline in "old" NEWS, to fix a syntax-check test failure. * tests/big-hole: Use awk, rather than a shell loop: saves 3000 lines of verbose shell output in the .log file. 2012-05-15 Paul Eggert <eggert@cs.ucla.edu> grep: sparse files are now considered binary * NEWS: Document this. * doc/grep.texi (File and Directory Selection): Likewise. * bootstrap.conf (gnulib_modules): Add stat-size. * src/main.c: Include stat-size.h. (usable_st_size): New function, mostly stolen from coreutils. (fillbuf): Use it. (file_is_binary): New function, which looks for holes too. (grep): Use it. * tests/Makefile.am (TESTS): Add big-hole. * tests/big-hole: New file. 2012-05-06 Paul Eggert <eggert@cs.ucla.edu> maint: quote 'like this' or "like this", not `like this' See <http://lists.gnu.org/archive/html/bug-grep/2012-01/msg00125.html>. * ChangeLog-2009, HACKING, NEWS, README-hacking, cfg.mk, configure.ac: * lib/colorize-w32.c, m4/pcre.m4: * src/Makefile.am, src/dfa.c, src/dosbuf.c, src/main.c: * tests/backref, tests/help-version, tests/tests: In commentary, quote 'like this' or "like this" rather than `like this' or ``like this''. * cfg.mk (old_NEWS_hash): Update due to changed old NEWS. * doc/grep.texi (General Output Control): Quote sample text with @samp, not with `...'. * src/main.c (usage): * tests/help-version: Quote 'like this' rather than `like this' in diagnostics. exclude: process exclude and include directives in order Also, change exclude and include directives so that they apply to command-line arguments too. This restores the pre-2.6 behavior, and fixes a bug reported by Quentin Arce in <http://lists.gnu.org/archive/html/bug-grep/2012-04/msg00056.html>. * NEWS: Document this. * src/main.c (included_patterns): Remove. All uses removed. (skipped_file): New function. (grepdirent): New arg command_line; all callers changed. This is needed because non-command-line files can invoke fts_open, and their directory entries need to be distinguished from top-level directory entries. Move code into the new skipped_file function. (grepdesc): Check whether a command-line argument should be skipped. (main): --include and --exclude options now share excluded_patterns rather than having separate variables included_patterns and excluded_patterns. * tests/include-exclude: Add a test to detect the fixed bug. build: update gnulib submodule to latest 2012-04-30 Jim Meyering <meyering@redhat.com> cosmetic: binary operator goes *after* the newline, when split * src/dfa.c (match_mb_charset): Join split lines. (parse_bracket_exp): Move "||" from end of first split line to the beginning of the continued line. * src/dosbuf.c (dossified_pos): Likewise, but for "&&". grep: -K is not an option: remove it from list The presence of "K" in the short-option string meant that an erroneous "grep -K ..." would fail with a bare Usage/Try... message, without the usual "invalid option -- 'K'". With this removal, now grep prints the expected invalid option diagnostic. * src/main.c (short_options): Remove "K". Reported by Петр ДоÑычев in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4488 2012-04-29 Paolo Bonzini <bonzini@gnu.org> dfa: small fixes to single-byte range computation * src/dfa.c (parse_bracket_exp): Do not call regexec with an invalid subject. Move declarations before all statements. 2012-04-27 Paolo Bonzini <bonzini@gnu.org> dfa: do not use hard-locale * bootstrap.conf (gnulib_modules): Remove hard-locale. * src/dfa.c (hard_LC_COLLATE): Remove. (dfaparse): Do not initialize it. (parse_bracket_exp): Always go through system regex matcher to find single byte characters matching a range. drop support for Makefile.boot * Makefile.am: Do not distribute README-boot and Makefile.boot. * NEWS: Mention this change. * README-alpha: Do not mention README-boot and Makefile.boot. * Makefile.boot: Remove. * README-boot: Remove. 2012-04-27 Aharon Robbins <arnold@skeeve.com> dfa: do not use strcoll to match multibyte characters in ranges This does not affect the behavior of grep, which always defers to glibc or gnulib when matching ranges. * src/dfa.c (match_mb_charset): Compare wc directly to the range endpoints. dfa: include stdbool.h explicitly * src/dfa.c: Include stdbool.h explicitly 2012-04-23 Jim Meyering <meyering@redhat.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.12 * NEWS: Record release date. build: update gnulib submodule to latest tests: skip annoyingly long gnulib lock tests * bootstrap.conf (avoided_gnulib_modules): Define. (gnulib_tool_option_extras): Use it. 2012-04-22 Jim Meyering <meyering@redhat.com> tests: avoid spurious quote-mismatch failure on OS/X * tests/in-eq-out-infloop: Simplify expected error output, eliminating expected quotes altogether, thus avoiding spurious OS/X-specific failure due to mismatch of multi-byte vs. single-byte quotes. 2012-04-17 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest * bootstrap: Also update this file. 2012-04-17 Jim Meyering <meyering@redhat.com> grep: fix --devices=ACTION (-D) so stdin is once again exempt An oversight in the 2.11 changes made it so "echo x|grep x" would fail for those who set GREP_OPTIONS=--devices=skip. * src/main.c (grepdesc): Ignore skip-related options when reading from standard input. * tests/skip-device: New file. Test for the above. * tests/Makefile.am (TESTS): Add it. * doc/grep.texi (File and Directory Selection): Clarify this point, documenting the stdin exemption. * NEWS (Bug fixes): Mention it, and add a few "[fixed in ...] notes. Reported by Tino Keitel in http://bugs.debian.org/669084, and forwarded to bug-grep by Aníbal Monsalve Salazar. 2012-04-13 Jim Meyering <meyering@redhat.com> maint: dfa: correct bogus formatting * src/dfa.c (transit_state, dfaexec): s/++ * VAR/++*VAR/ maint: dfa: add/improve comments * src/dfa.c (transit_state_consume_1char): Note always-ignored return value. Fix typos: s/equivalent class/equivalence class/. maint: dfa: avoid unnecessary uses of strcpy/strncpy * src/dfa.c (icatalloc): Use memcpy, not strcpy, given the length. (dfamust): Combine MALLOC+strcpy into cleaner xmemdup. (parse_bracket_exp): Likewise, but replace a use of strncpy. grep: handle symlinked directory loops as usual * src/main.c (grepfile): Treat EMLINK just like ELOOP, for systems like FreeBSD 9.0 on which we would otherwise report "Too many links" rather than ignoring that type of failure. E.g., "mkdir d; cd d; ln -s . a; grep -r ^" would print grep: a: Too many links and would exit with status 2. Now, it prints nothing and exits with status 1, as before. Reported by Nelson H. F. Beebe. tests: avoid spurious failure of the symlink test * tests/symlink: Ignore spurious "Binary file d matches" on systems for which reading from a directory actually succeeds. Reported by Bruno Haible and Nelson Beebe. 2012-04-09 Jim Meyering <meyering@redhat.com> tests: avoid syntax-check failure: reverse compare arguments * tests/repetition-overflow: Fix reversed compare arguments. build: update gnulib submodule to latest 2012-03-18 Paul Eggert <eggert@cs.ucla.edu> grep: report overflow for ERE a{1000000000} * NEWS: Document this. * src/dfa.c (MIN): New macro. (lex): Lexically analyze the repeat-count operator once, not twice; the double-scan complicated the code and made it harder to understand and fix. Adjust the repeat-count parsing so that it better matches the behavior of the regex code, in three ways: 1. Diagnose too-large repeat counts rather than treating them as literal characters. 2. Use RE_INVALID_INTERVAL_ORD, not RE_NO_BK_BRACES, to decide whether to treat invalid-syntax {...}s as literals. 3. Use the same wording for {...}-related diagnostics that the regex code uses. * tests/bre.tests, tests/ere.tests, tests/repetition-overflow: Adjust to match new behavior, and add a few tests. * cfg.mk (exclude_file_name_regexp--sc_error_message_uppercase): New macro, since the diagnostics start with uppercase letters. 2012-03-14 Paul Eggert <eggert@cs.ucla.edu> grep: -r no longer follows symlinks; use fts Change -r to follow only command-line symlinks, and by default to read only devices named on the command line. This is a simple way to get a more-useful behavior when searching random directories; the idea is to use 'find' if you want something fancy. -R acts as before and gets a new alias --dereference-recursive. The code now uses fts internally, so it is more robust and faster with large hierarchies. * .gitignore: Remove lib/savedir.c, lib/savedir.h. * tests/symlink: New file * Makefile.boot (LIB_OBJS_core): Remove isdir.o, savedir.o. Perhaps other changes are needed too, but I'm not sure what this makefile is for. * NEWS: Document changes. * doc/grep.texi (File and Directory Selection): Likewise. * bootstrap.conf (gnulib_modules): Remove dirent, dirname, isdir, open. Add fstatat, fts, openat-safer. * lib/Makefile.am (libgreputils_a_SOURCES): Remove savedir.c, savedir.h. * lib/savedir.c, lib/savedir.h: Remove. * po/POTFILES.in: Add lib/openat-die.c. * src/main.c: Include fcntl-safer.h, fts_.h. Don't include isdir.h, savedir.h. (struct stats, stats_base): Remove. (long_options, usage, main): Add --dereference-recursive and implement -r vs -R. (filename_prefix_len, fts_options): New static vars. (basic_fts_options, READ_COMMAND_LINE_DEVICES): New constants. (devices): Now defaults to READ_COMMAND_LINE_DEVICES. (reset, grep): Now takes just struct stat rather than file name and struct stats. All callers changed. (fillbuf): Now takes struct stat reather than struct stats. All callers changed. (grep): Don't worry about recursing too deeply; fts and grepdesc handle this now. (is_device_mode, grepdirent, grepdesc, grep_command_line_args): New functions. (grepfile): New args DIRDESC, FOLLOW, COMMAND_LINE. Remove struct stats arg. All callers changed. Use openat_safer rather than open. Use desc == STDIN_FILENO to tell whether we're reading "-". Don't worry about EINTR when closing -- not possible, since we're not catching signals. * tests/Makefile.am (TESTS): Add symlink. * tests/symlink: New file. 2012-03-12 Paul Eggert <eggert@cs.ucla.edu> tests: port big-match to non-GNU dd * tests/big-match: Don't assume GNU dd extension "bs=1M". tests: test for bug with -r --exclude-dir and no file operand * tests/include-exclude: Test for the bug and fix. 2012-03-12 Allan McRae <allan@archlinux.org> grep: fix segfault with -r --exclude-dir and no file operand * src/main.c (grepdir): Don't invoke excluded_file_name on NULL. * NEWS (Bug fixes): Mention it. 2012-03-09 Jim Meyering <meyering@redhat.com> tests: exercise two recently-fixed bugs * tests/repetition-overflow: New test for bugs fixed by commit v2.10-82-gcbbc1a4. * tests/Makefile.am (TESTS): Add it. 2012-03-03 Jim Meyering <meyering@redhat.com> maint: use an optimal-for-grep xz compression setting * cfg.mk (XZ_OPT): Use -6e (determined empirically, see comments). This sacrifices a meager 60 bytes of compressed tarball size for a 55-MiB decrease in the memory required during decompression. I.e., using -9e would shave off only 60 bytes from the tar.xz file, yet would force every decompression process to use 55 MiB more memory. build: update gnulib submodule to latest 2012-03-02 Jim Meyering <meyering@redhat.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.11 * NEWS: Record release date. tests: avoid failure when using Solaris 10's sed * tests/reversed-range-endpoints: Use a simpler sed expression to sanitize actual output, so it also works with Solaris 10's /bin/sed. 2012-03-01 Jim Meyering <meyering@redhat.com> maint: manually correct formatting in dfa.c's cpp definitions * src/dfa.c: Adjust formatting in cpp definitions. maint: indent dfa.c * src/dfa.c: Filter through indent like this: HOME=. indent -Tsize_t -l79 --leave-preprocessor-space \ --dont-format-comments --no-tabs < dfa.c > k && mv k dfa.c doc: correct grep.1's descriptions of \w and \W (they omitted "_") * doc/grep.in.1: Fix descriptions of \w and \W. They did not mention "_". * doc/grep.texi (The Backslash Character and Special Expressions): [\w, \W]: List the "_" before the char class, not after: [_[:alnum:]], for readability and to be consistent with the man page. 2012-03-01 Paul Eggert <eggert@cs.ucla.edu> maint: spelling fixes grep: fix integer-overflow issues in main program * NEWS: Document this. * bootstrap.conf (gnulib_modules): Add inttypes, xstrtoimax. Remove xstrtoumax. * src/main.c: Include <inttypes.h>, for INTMAX_MAX, PRIdMAX. (context_length_arg, prtext, grepbuf, grep, grepfile) (get_nondigit_option, main): Use intmax_t, not int, for line counts. (context_length_arg, main): Silently ceiling line counts to maximum value, since there's no practical difference between doing that and using infinite-precision arithmetic. (out_before, out_after, pending): Now intmax_t, not int. (max_count, outleft): Now intmax_t, not off_t. (prepend_args, prepend_default_options, main): Use size_t, not int, for sizes. (prepend_default_options): Check for int and size_t overflow. grep: avoid mishandling of long lines * src/pcresearch.c (Pexecute): Do not pass a line longer than INT_MAX to pcre_exec, since its API does not permit that. grep: remove no-longer-used setrlimit code This code has been unused and obsolescent ever since the regex code stopped using the stack for large regular expressions. * src/main.c [HAVE_SETRLIMIT]: Do not include <sys/time.h> or or <sys/resource.h>; no longer needed. (set_rlimits): Remove. All callers changed. grep: fix some core dumps with long lines etc. These problems mostly occur because the code attempts to stuff sizes into int or into unsigned int; this doesn't work on most 64-bit hosts and the errors can lead to core dumps. * NEWS: Document this. * src/dfa.c (token): Typedef to ptrdiff_t, since the enum's range could be as small as -128 .. 127 on practical hosts. (position.index): Now size_t, not unsigned int. (leaf_set.elems): Now size_t *, not unsigned int *. (dfa_state.hash, struct mb_char_classes.nchars, .nch_classes) (.nranges, .nequivs, .ncoll_elems, struct dfa.cindex, .calloc, .tindex) (.talloc, .depth, .nleaves, .nregexps, .nmultibyte_prop, .nmbcsets): (.mbcsets_alloc): Now size_t, not int. (dfa_state.first_end): Now token, not int. (state_num): New type. (struct mb_char_classes.cset): Now ptrdiff_t, not int. (struct dfa.utf8_anychar_classes): Now token[5], not int[5]. (struct dfa.sindex, .salloc, .tralloc): Now state_num, not int. (struct dfa.trans, .realtrans, .fails): Now state_num **, not int **. (struct dfa.newlines): Now state_num *, not int *. (prtok): Don't assume 'token' is no wider than int. (lexleft, parens, depth): Now size_t, not int. (charclass_index, nsubtoks) (parse_bracket_exp, addtok, copytoks, closure, insert, merge, delete) (state_index, epsclosure, state_separate_contexts) (dfaanalyze, dfastate, build_state, realloc_trans_if_necessary) (transit_state_singlebyte, match_anychar, match_mb_charset) (check_matching_with_multibyte_ops, transit_state_consume_1char) (transit_state, dfaexec, free_mbdata, dfaoptimize, dfafree) (freelist, enlist, addlists, inboth, dfamust): Don't assume indexes fit in 'int'. (lex): Avoid overflow in string-to-{hi,lo} conversions. (dfaanalyze): Redo indexing so that it works with size_t values, which cannot go negative. * src/dfa.h (dfaexec): Count argument is now size_t *, not int *. (dfastate): State numbers are now ptrdiff_t, not int. * src/dfasearch.c: Include "intprops.h", for TYPE_MAXIMUM. (kwset_exact_matches): Now size_t, not int. (EGexecute): Don't assume indexes fit in 'int'. Check for overflow before converting a ptrdiff_t to a regoff_t, as regoff_t is narrower than ptrdiff_t in 64-bit glibc (contra POSIX). Check for memory exhaustion in re_search rather than treating it merely as failure to match; use xalloc_die () to report any error. * src/kwset.c (struct trie.accepting): Now size_t, not unsigned int. (struct kwset.words): Now ptrdiff_t, not int. * src/kwset.h (struct kwsmatch.index): Now size_t, not int. tests: test for problems with long matches The new test is expensive, so add a category of expensive tests, which are normally not run, and put the new test in this new category. The idea of having expensive tests is taken from coreutils. * HACKING: Mention RUN_EXPENSIVE_TESTS and similar env vars. * Makefile.am (check-expensive): New rule. * tests/Makefile.am (TESTS): Add big-match. * tests/init.cfg (expensive_): New function, from coreutils. * tests/big-match: New file. 2012-02-29 Paul Eggert <eggert@cs.ucla.edu> maint: use gnulib _Noreturn rather than __attribute__ ((noreturn)) * src/grep.h (__attribute__): Remove. * src/dfa.h (__attribute__): Likewise. (dfaerror): Use noreturn rather than __attribute__ ((noreturn)). * src/main.c (usage): Likewise. 2012-02-26 Jim Meyering <meyering@redhat.com> build: update submodule, bootstrap, tests/init.sh from gnulib * gl/lib/regcomp.c.diff: Adjust. * bootstrap: Update from gnulib. * tests/init.sh: Update from gnulib. 2012-02-26 Paolo Bonzini <bonzini@gnu.org> dfa: merge calls to SUCCEEDS_IN_CONTEXT * src/dfa.c (state_index): use a single call to SUCCEEDS_IN_CONTEXT. dfa: fix a subtle constraint encoding bug * src/dfa.c (SUCCEEDS_IN_CONTEXT, PREV_NEWLINE_DEPENDENT, PREV_LETTER_DEPENDENT): Rewrite to handle all 3*3=9 possible combinations of previous and next character contexts. (MATCHES_NEWLINE_CONTEXT, MATCHES_LETTER_CONTEXT): Remove. (NO_CONSTRAINT, BEGLINE_CONSTRAINT, ENDLINE_CONSTRAINT, BEGWORD_CONSTRAINT, ENDWORD_CONSTRAINT, LIMWORD_CONSTRAINT, NOTLIMWORD_CONSTRAINT): Switch to new encoding. * NEWS: Document resulting bugfix. * tests/spencer1.tests: Add regression test. dfa: do not use MATCHES_*_CONTEXT directly * src/dfa.c (dfastate): Use SUCCEEDS_IN_CONTEXT. dfa: change meaning of a state context * src/dfa.c (MATCHES_NEWLINE_CONTEXT, MATCHES_LETTER_CONTEXT): New. (state_separate_contexts): Remove second argument. (state_index): Do not mask away CTX_NONE. (dfaanalyze): Adjust call to state_index and state_separate_contexts. (dfastate): Adjust calls to state_index and state_separate_contexts. 2012-02-13 Paul Eggert <eggert@cs.ucla.edu> tests: fix loop in epipe test * tests/epipe: Don't loop forever if the bug is present. Problem reported by Jaroslav Skarvada. 2012-02-08 Paul Eggert <eggert@cs.ucla.edu> tests: work portably even if SIGPIPE is ignored * tests/epipe: Don't rely on "trap - PIPE"; that's not portable. Problem reported by Eric Blake in <http://lists.gnu.org/archive/html/bug-grep/2012-02/msg00017.html>. Also, use "ls -al" rather than "echo", in case "echo" is done by a buggy shell that ignores write errors. And close grep's fd 3, as a sanity check. 2012-02-07 Paul Eggert <eggert@cs.ucla.edu> tests: work even if SIGPIPE is ignored * tests/epipe: Do not infinite-loop if SIGPIPE is already ignored. It could be that the invoker of 'make check' ignores SIGPIPE, for example. 2012-02-05 Jim Meyering <meyering@redhat.com> build: accommodate -Wshadow and -Werror=suggest-attribute=pure * src/dfa.c (state_separate_contexts): Add _GL_ATTRIBUTE_PURE. (dfaexec): Rename parameter, s/newline/allow_nl/, to avoid shadowing the global. 2012-02-05 Paolo Bonzini <bonzini@gnu.org> dfa: refactor common context computations * src/dfa.c (CTX_ANY, charclass_context, state_separate_contexts): New. (dfaanalyze): Use state_separate_contexts. (dfastate): Use charclass_context and state_separate_contexts. Rename prev_context to separate_contexts. dfa: change newline/letter to a single context value * src/dfa.c (MATCHES_NEWLINE_CONTEXT, MATCHES_LETTER_CONTEXT, SUCCEEDS_IN_CONTEXT, ACCEPTS_IN_CONTEXT): Take a single context value for prev and curr. (struct dfa_state): Replace newline and letter with context. (wchar_context): New. (state_index): Replace newline and letter with context. Compare context values in the state struct. Adjust calls to pass contexts. (wants_newline): Replace with wanted_context. Adjust calls to pass contexts. (dfastate): Replace wants_newline and wants_letter with wanted_context. Adjust calls to pass contexts. (build_state): Adjust calls to pass contexts. (match_anychar, match_mb_charset, transit_state): Use wchar_context. Adjust calls to pass contexts. 2012-02-05 Paolo Bonzini <bonzini@gnu.org> dfa: introduce contexts for the values in d->success Also initialize all tables in a single place in dfasyntax. * src/dfa.c (CTX_NONE, CTX_LETTER, CTX_NEWLINE, char_context): New. (sbit, letters, newline): New. (dfasyntax): Fill them. (dfastate): Remove letters, newline, initialized. (build_state): Use CTX_* constants. (dfaexec): Remove sbit and sbit_init. 2012-02-05 Paolo Bonzini <bonzini@gnu.org> dfa: remove useless check * src/dfa.c (state_index): There is nothing that is a newline *and* a letter. Remove redundant call to SUCCEEDS_IN_CONTEXT. 2012-01-22 Jim Meyering <meyering@redhat.com> build: update bootstrap from gnulib and adapt * bootstrap: Update from gnulib. * tests/init.sh: Update from gnulib. * bootstrap.conf (bootstrap_epilogue): Remove now-unnecessary, snippet that edited gnulib-tests/gnulib.mk. (gnulib_tool_option_extras): Add both --symlink and --makefile-name=gnulib.mk. Remove use of $bt. * lib/Makefile.am: Initialize numerous automake variables so that generated code in gnulib.mk may use += to append to them. maint: convert `this' to 'this' quoting style in diagnostics Now that gnulib's quote and quotearg modules use 'this' style, change the few explicit uses in diagnostics to conform. * src/egrep.c (after_options): Use 'this' style of quotes. * src/fgrep.c (after_options): Likewise. * src/grep.c (after_options): Likewise. * src/main.c (usage): Likewise. build: update gnulib to latest; adjust quoting in tests * gnulib: Update. * tests/in-eq-out-infloop: Convert expected diagnostics to match new quoting. 2012-01-22 Paul Eggert <eggert@cs.ucla.edu> doc: document recent diagnostics-related changes * NEWS: Document changes re diagnostics related to GREP_COLORS, directory loops, -s, "write error". grep: be quiet about GREP_COLORS syntax * src/main.c (struct color_cap): fct now returns void, since there's no longer need to use what it returns. (color_cap_mt_fct, color_cap_rv_fct, color_cap_ne_fct): Return void. (parse_grep_colors): Do not output diagnostics and then exit with status 0. Instead, ignore errors in GREP_COLORS. This is more consistent with programs that (e.g.) ignore errors in termcap entries, and it's more internally-consistent as some GREP_COLORS errors were ignored but not others. grep: exit with nonzero status if directory loop * src/main.c (grepdir): Exit with status 2 if a directory loop is found, since the output might not be "right" (i.e., infinite...). grep: suppress read errors if -s * src/main.c (reset, grep, grepfile): Do not report an input error if -s is given. grep: don't say "write error" over and over Problem reported by Travis Gummels in <https://bugzilla.redhat.com/show_bug.cgi?id=741452>. * src/main.c (write_error_seen): New static var. (clean_up_stdout): New function. (prline): Do not output 'write error' more than once; exit after the first one. Use the same wording for the diagnostic that close_stdout uses. (main): Clean up with clean_up_stdout, not close_stdout, so that grep doesn't output multiple "write error" diagnostics. * tests/Makefile.am (TESTS): Add epipe. * tests/epipe: New file. 2012-01-12 Paul Eggert <eggert@cs.ucla.edu> dfa: non-glibc word-constituent unibyte fix * src/dfa.c (is_valid_unibyte_character): Fix typo that caused this to incorrectly return 0 on unibyte non-glibc systems. Problem reported by Aharon Robbins in <http://lists.gnu.org/archive/html/bug-grep/2012-01/msg00084.html>. 2012-01-04 Paul Eggert <eggert@cs.ucla.edu> doc: document empty pattern better * doc/grep.texi (Top, Fundamental Structure, Usage): Explain how grep deals with the empty pattern. Problem spotted by Bernhard Voelker in <http://lists.gnu.org/archive/html/bug-grep/2012-01/msg00050.html>. grep: with no args, search "." only if command-line -r * NEWS: Document this. * doc/grep.texi (Environment Variables, grep Programs): Likewise. * src/main.c (usage): Likewise. (main): Implement this. (prepend_default_options): Return a count of prepended options. * tests/r-dot: Test the above. 2012-01-03 Jim Meyering <meyering@redhat.com> tests: adjust test to match code, now that --mmap writes to stderr * tests/ignore-mmap: Separate stdout and stderr; test both. deprecate the --mmap option * src/main.c (main): Deprecate the --mmap option: issue a warning when it is used. (usage): Change description. * doc/grep.texi (Other Options): Document the new behavior. * NEWS (Changes in behavior): Mention it. 2012-01-03 Paolo Bonzini <bonzini@gnu.org> dfa: fix incorrect comment * src/dfa.c (dfastate): Fix comment for newline. dfa: fix rebase conflict * src/dfa.c (dfaanalyze): Fix reference to nalloc. dfa: automatically resize position_sets * src/dfa.c (insert, copy, merge): Resize arrays here. (dfaanalyze): Do not track number of allocated elements here. (dfastate): Allocate mbps with only one element. dfa: change position_set nelem to size_t * src/dfa.c (REALLOC_IF_NECESSARY): Disable assertion, to avoid warnings from -Wtype-limits. (position_set): Change nelem to a size_t. dfa: move nalloc to position_set structure * src/dfa.c (position_set): Add alloc. (alloc_position_set): Initialize it. (dfaanalyze): Use it instead of the nalloc array or nelem. dfa: remove dead assignment * src/dfa.c (transit_state): transit_state_consume_1char will clear follows, do not do this ourselves. dfa: introduce alloc_position_set * src/dfa.c (alloc_position_set): New function, use it throughout. dfa: use a more compact data type for grps * src/dfa.c (leaf_set): New. (dfastate): Use the smaller type, leaf_set, for grps. Its prior type contained an unused constraint field. dfa: use MALLOC/REALLOC always src/dfa.c (dfastate, enlist, dfamust): Use MALLOC and REALLOC. dfa: remove unnecessary braces * src/dfa.c (dfastate): Remove unnecessary braces. dfa: x2nrealloc starting from a NULL pointer works * src/dfa.c (parse_bracket_exp): Do not MALLOC mbcset parts the first time they are encountered. Initialize chars_al correctly. 2012-01-03 Jim Meyering <meyering@redhat.com> build: avoid build failure with --enable-gcc-warnings and recent gcc * lib/colorize-posix.c: Disable -Wsuggest-attribute=const, to avoid warning about this empty init_colorize function. 2012-01-03 Paolo Bonzini <bonzini@gnu.org> remove lib/ms/ * configure.ac: Create lib/colorize.c as a symbolic link. * lib/colorize-posix.c: New name of lib/colorize-impl.c. * lib/colorize-w32.c: New name of lib/ms/colorize-impl.c. * lib/colorize.c: Delete. * lib/Makefile.am (EXTRA_DIST): Adjust. * .gitignore: Adjust. * cfg.mk: Adjust syntax-check exclusions. unify colorize.h headers * lib/Makefile.am (EXTRA_DIST): Adjust. * lib/colorize.h: Remove inline functions. * lib/colorize-impl.c: Move them here as functions. * lib/ms/colorize.h: Remove. * src/Makefile.am (DEFAULT_HEADERS): Remove. 2012-01-02 Paolo Bonzini <bonzini@gnu.org> colorize: use isatty module * bootstrap.conf: Add isatty module. * gnulib: Update to latest. * lib/colorize.h: Remove argument from should_colorize. * lib/ms/colorize.h: Likewise. * lib/colorize-impl.c: Factor isatty call out of here... * lib/ms/colorize-impl.c: ... and here... * src/main.c: ... into here. 2012-01-02 Jim Meyering <meyering@redhat.com> tests: avoid minor "make check" failure * tests/r-dot: Make executable, to avoid triggering a failed consistency test in "make check". 2012-01-02 Paul Eggert <eggert@cs.ucla.edu> grep: -r with no args now searches "." This is a patch I've been meaning to put in for years. When I added support for "grep -r", I forgot to have "grep -r PAT" search the working directory by default, instead of searching standard input (which makes no sense, even if stdin is a directory). This is not an upward compatible change, since "grep -r PAT <file" will no longer search standard input, but that's OK; nobody should be using "grep -r" that way anyway. * NEWS: Document this. * doc/grep.texi (File and Directory Selection, grep Programs, Usage): Likewise. * src/main.c (usage): Likewise. (grepdir): If DIR is null, search the working directory, but do not prepend "./" to the file names. (main): If recursing and no operands are given, search ".". * tests/Makefile.am (TESTS): Add r-dot. * tests/r-dot: New file. grep: prefer fgets to printf, _ to gettext * lib/colorize.h (print_end_colorize): * lib/ms/colorize-impl.c (print_end_colorize): Use fputs instead of printf. * src/main.c (usage): Likewise. Use _ instead of gettext. 2012-01-01 Paul Eggert <eggert@cs.ucla.edu> grep: check stdin like other files * NEWS: Document this. * src/main.c (grepfile): Revamp tests for input files so that standard input is tested like other files. For example, report an error if standard input equals standard output. Prefer open+fstat to stat+open if possible, as open+fstat is usually a bit faster and avoids a race condition. * tests/in-eq-out-infloop: Add tests for cases like 'grep pat <file >>file'. 2012-01-01 Jim Meyering <meyering@redhat.com> maint: update all copyright year number ranges Run "make update-copyright". 2011-12-31 Paul Eggert <eggert@cs.ucla.edu> grep: lower-case function names These names used to be macros, but they're functions now. All callers changed. * src/main.c (pr_sgr_start): Rename from PR_SGR_START. (pr_sgr_end): Rename from PR_SGR_END. (pr_sgr_start_if): Rename from PR_SGR_START_IF. (pr_sgr_end_if): Rename from PR_SGR_END_IF. ms: move Microsoft-specific stuff to lib/ms * cfg.mk (exclude_file_name_regexp--sc_prohibit_strcmp) (exclude_file_name_regexp--sc_require_config_h) (exclude_file_name_regexp--sc_require_config_h_first): New rules. * lib/colorize.c, lib/colorize.h, lib/colorize-impl.c: * lib/ms/colorize.h, lib/ms/colorize-impl.c: New files. * configure.ac (GREP_SRC_INCLUDES): New macro. * lib/Makefile.am (libgreputils_a_SOURCES): Add colorize.[ch]. (EXTRA_DIST): New macro. * src/Makefile.am (DEFAULT_INCLUDES): New macro. * src/main.c: Include colorize.h. (PR_SGR_START, PR_SGR_END, PR_SGR_START_IF, PR_SGR_END_IF): Now static functions, not macros. (hstdout, norm_attr, w32_console_init, w32_sgr2attr) (w32_clreol) [__MINGW32__]: Move to lib/ms/colorize-impl.c. (pr_sgr_start, pr_sgr_end): Remove; callers changed to use new print_start_colorize, print_end_colorize from colorize.h. (init_colorize): Rename from w32_console_init and move to colorize module; caller changed. (should_colorize): Move to colorize module. grep: do input==output check more like dir loop check * src/main.c (grepfile): Just use SAME_INODE; don't bother with SAME_REGULAR_FILE. This works better on properly-working POSIX hosts, since it handles the case where the file is changing as we grep it. It works worse on hosts that don't support st_ino properly, but in practice this isn't that much of a problem here. * src/system.h (same_file_attributes, SAME_REGULAR_FILE): Remove; no longer needed. build: update gnulib submodule to latest 2011-12-28 Paul Eggert <eggert@cs.ucla.edu> maint: remove now-unused/obsolete files * README.DOS: Remove file. * m4/djgpp.m4: Likewise. * .gitignore: Remove reference to m4/djgpp.m4. 2011-12-28 Jim Meyering <meyering@redhat.com> maint: distribute ChangeLog-2009 * Makefile.am (EXTRA_DIST): Add ChangeLog-2009. Spotted by Eli Zaretskii. 2011-12-28 Jim Meyering <meyering@redhat.com> main.c: add some 'const' directives * src/main.c (color_dict, fg_color, bg_color, cap): Declare const. No semantic change. 2011-12-28 Jim Meyering <meyering@redhat.com> main.c: correct indentation and formatting style * src/main.c: Correct many formatting inconsistencies. No semantic change. avoid new syntax-check failures * cfg.mk (old_NEWS_hash): Update, to accommodate old NEWS modification. * src/main.c: Indent solely with spaces, never with TABs. (should_colorize): Remove useless parens in #if directive. 2011-12-28 Eli Zaretskii <eliz@gnu.org> Fix whitespace, indentation and documentation * src/main.c (parse_grep_colors): Fix indentation. (usage): Mention MS-Windows in help text for -U and -u options. update NEWS for MS-Windows changes * NEWS: Mention MS-Windows related bugfixes and enhancements. Fix the test suite for MS-Windows. * tests/include-exclude: Use --directories=skip, to avoid gratuitous failures on systems that cannot grep directories. * tests/reversed-range-endpoints: Don't reject program names with leading directories and drive letters. * tests/warn-char-classes: Likewise. Support color highlighting on MS-Windows * src/main.c (SGR_START, SGR_END, PR_SGR_FMT, PR_SGR_FMT_IF): Remove. (PR_SGR_START, PR_SGR_START_IF): Replace with pr_sgr_start. (PR_SGR_END, PR_SGR_END_IF): Replace with pr_sgr_end. (pr_sgr_start, pr_sgr_end, should_colorize): New functions. (w32_console_init, w32_sgr2attr, w32_clreol) [__MINGW32__]: New functions. (main): Use should_colorize. Invoke w32_console_init. 2011-12-24 Paul Eggert <eggert@cs.ucla.edu> don't ignore errors when reading a directory grep no longer silently suppresses errors when reading a directory as if it were a text file. For example, "grep x ." now reports a read error on most systems; formerly, it ignored the error. Problem reported as an aside by Bob Proulx (Bug#10355). * NEWS: Document this. * src/main.c (grep, grepfile): Implement this. Simplify the code considerably. * src/system.h (is_EISDIR): Remove; no longer needed. --include etc. now work on command-line args more consistently --include and --exclude apply only to non-directories and --exclude-dir applies only to directories. "-" (standard input) is never excluded, since it is not a file name. This bug was discovered while fixing a read-directory bug (Bug#10355). * NEWS: Document this. * src/main.c (main): Implement this. * tests/include-exclude: Test for it. 2011-12-24 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest 2011-12-12 Arnold D. Robbins <arnold@skeeve.com> doc: improve grep.texi * doc/grep.texi: General editing for improved aesthetics. Also fix a few problems. 2011-12-12 Jim Meyering <meyering@redhat.com> build: use gnulib's iswctype wcscoll * bootstrap.conf (gnulib_modules): Add iswctype and wcscoll. * configure.ac: Remove explicit checks for those functions. * src/mbsupport.h (MBS_SUPPORT): Define to 1 if not already defined. Remove the conditional, now that we're guaranteed by gnulib to have wcscoll and iswctype. Suggested by Alan Hourihane in http://savannah.gnu.org/bugs/?34930 disable the new input==output guard for additional options * src/main.c (grepfile): Do not reject input == output also when using a few other options. * tests/in-eq-out-infloop: Test these new cases. * NEWS (Bug fixes): Mention it 2011-12-11 Nicolas Vigier <boklm@mars-attacks.org> do not reject "grep -qr . > out" The recent fix to avoid an infinite disk-filling loop, commit 5e20a38a, introduced a minor regression. If you use grep with -q and -r, and redirect output to a file that will be traversed, then grep would reject the command, even though it will generate no output. In that case, there is no risk of an infinite loop. * src/main.c (grepfile): Do not reject input == output when using --quiet/--silent (-q). Reported by J H Wilson in http://bugs.mageia.org/show_bug.cgi?id=3501 forwarded by Nicolas Vigier to https://savannah.gnu.org/bugs/?34917 2011-11-29 Arnold Robbins <arnold@skeeve.com> dfa: do not call nl_langinfo in !MBS_SUPPORT mode * src/dfa.c (using_utf8) [!MBS_SUPPORT]: Remove erroneous "defined" in cpp test for MBS_SUPPORT. Since commit a163349d, MBS_SUPPORT is 0/1. This error caused trouble only in the !MBS_SUPPORT case. dfa: avoid warning from deficient compiler in !MBS_SUPPORT mode * src/dfa.c (setbit_wc) [!MBS_SUPPORT]: Add explicit "return false;" after "abort ();", to avoid a warning from deficient compilers. 2011-11-29 Jim Meyering <meyering@redhat.com> tests: use "compare exp out", not "compare out exp" Likewise, when an empty file is expected, use "compare /dev/null out", not "compare out /dev/null". I.e., specify the expected/desired contents via the first file name. Prompted by a suggestion from Bruno Haible in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154 Run these commands: git grep -l -E 'compare [^ ]+ exp' \ |xargs perl -pi -e 's/(compare) (\S+) (exp\S*)/$1 $3 $2/' git grep -l -E 'compare [^ ]+ /dev/null' \ |xargs perl -pi -e 's/(compare) (\S+) (\/dev\/null)/$1 $3 $2/' 2011-11-29 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest 2011-11-28 Jim Meyering <meyering@redhat.com> build: accommodate -Werror=suggest-attribute=pure Now that we're using the latest manywarnings module from gnulib, accommodate gcc's -Werror=suggest-attribute=pure option by marking suggested functions with gnulib-defined _GL_ATTRIBUTE_PURE. * src/kwset.c (hasevery): Mark function with pure attribute. (bmexec): Likewise. * src/dfa.c (nsubtoks, istrstr, find_pred, dfamusts): Likewise. * configure.ac: Disable (for lib/) options that seem not to be worth the trouble: -Wunsuffixed-float-constants and -Wformat-nonliteral. 2011-11-21 Bruno Haible <bruno@clisp.org> build: fix "make check" error on OSF/1 * tests/Makefile.am (TESTS_ENVIRONMENT): Test the value of the variable BASH_VERSION, not the literal ASH_VERSION. 2011-11-21 Jim Meyering <meyering@redhat.com> portability: work consistently on *BSD systems * src/dfa.c (is_valid_unibyte_character): Define. (IS_WORD_CONSTITUENT): Use it here, to make grep work consistently even on *BSD systems, which use different tables for ctype macros like isalpha. http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4022 With help from Bruno Haible. 2011-11-20 Jim Meyering <meyering@redhat.com> maint: consistently use NULL, not 0, when comparing pointers * src/dfa.c (dfaanalyze): Compare trans[s] with NULL, not 0. maint: remove an avoidable #ifdef/#endif pair * src/dfa.c (dfaanalyze): Remove avoidable #ifdef around "{". tests: fix typo in last change * tests/word-delim-multibyte: Use double quotes around $e_acute, not single quotes. Spotted by Bruno Haible. This and the preceding change do not resolve the XPASS failure on OpenBSD 4.9 after all. See the explanation at http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4022 tests: avoid unwarranted test failure on *BSD-based systems * tests/word-delim-multibyte (e_acute): Use a more portable representation of e-acute. Reported by Bruno Haible. 2011-11-19 Jim Meyering <meyering@redhat.com> maint: accommodate -Wdeclaration-after-statement, but only in dfa.c, and because doing so does not impact readability/maintainability. This is solely to accommodate gawk users who are stuck with ancient gcc. This is no excuse to change any other code in grep. * src/dfa.c (dfaoptimize, parse_bracket_exp): Move declaration to precede first statement in block. 2011-11-16 Jim Meyering <meyering@redhat.com> maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.10 * NEWS: Record release date. build: update gnulib submodule to latest 2011-11-13 Jim Meyering <meyering@redhat.com> maint: update bootstrap and init.sh from gnulib * tests/init.sh: Update from gnulib. * bootstrap: Likewise. 2011-11-12 Jim Meyering <meyering@redhat.com> build: update gnulib for exclude-test fixes tests: make our "export" replacement efficient with modern shells * tests/Makefile.am (TESTS_ENVIRONMENT): Use a trivial and efficient implementation with a shell that supports "export var=val". Use the sed-invoking replacement only when necessary. Improved by Stefano Lattarini. tests: make the replacement export function more robust * tests/Makefile.am (sed_quote_value): Also quote single quotes. Remove sed's -e options. Not needed. 2011-11-12 Bruno Haible <bruno@clisp.org> tests: fix test suite execution failure on OSF/1 5.1 * tests/Makefile.am (TESTS_ENVIRONMENT): Use a shell function to ensure that we use only the portable form of the 'export' shell built-in. tests: don't assume that /bin/bash exists * tests/fedora: Run using /bin/sh, not /bin/bash. tests: avoid unwarranted failures due to SATAN's timeout * tests/init.cfg (require_timeout_): Also ensure that timeout exits with its child's exit status. build: fix compilation error on MSVC 9 to due Pexecute() declaration * src/pcresearch.c (WITHOUT_PCRE_NORETURN): Remove macro. (Pexecute): Replace abort() call with code that does not trigger GCC warnings. tests: fix high-bit-range test failure on OSF/1 5.1 * tests/high-bit-range: Use octal escape instead of hexadecimal escape sequence. 2011-11-11 Jim Meyering <meyering@redhat.com> build: update gnulib for solaris test fix 2011-11-10 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest maint: adjust the URL that will appear in the generated announcement * cfg.mk (url_dir_list): Use this http://ftp.gnu.org/gnu/$(PACKAGE) for the first link listed in the generated announcement. announce-gen now provides the faster mirror link automatically. 2011-11-06 Jim Meyering <meyering@redhat.com> build: stop distributing gzip'd releases; xz is enough * configure.ac (AM_INIT_AUTOMAKE): Add no-dist-gzip. * NEWS (Build-related): Mention that we're dropping .tar.gz. build: update gnulib submodule to latest 2011-10-14 Stefano Lattarini <stefano.lattarini@gmail.com> distcheck: ensure dist-hook fails if syntax-check fails * Makefile.am (run-syntax-check): Fix logic, to ensure that the recipe of this target returns a non-zero exit status if "make syntax-check" fails. 2011-10-12 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest This should fix a few portability problems, including one on HP-UX and a test-float failure on PPC, reported by Andreas Metzler. 2011-10-10 Stefano Lattarini <stefano.lattarini@gmail.com> gitignore: merge top-level and tests/ .gitignore files * tests/.gitignore: Remove; what little remained of its contents has been moved ... * .gitignore: ... here. tests: tiny simplification in TESTS_ENVIRONMENT definition * tests/Makefile.am (TESTS_ENVIRONMENT): Remove redundant use of `export'. 2011-10-10 Stefano Lattarini <stefano.lattarini@gmail.com> tests: support development version of automake too This change implements a more correct and idiomatic use of the features of the Automake-provided 'parallel-tests' harness. Moreover, this change is required in order for the testsuite to continue to work with the new testsuite harness that is planned to be introduced in Automake 1.12 (which, as of the writing date, is still under development and in late alpha state). * tests/Makefile.am (TESTS_ENVIRONMENT): The development version of automake dos not support setting the interpreter delegated to run the tests scripts in this variable; instead, use ... (LOG_COMPILER): ... this variable. * .gitignore: Ignore `.trs' files in directory `tests/'. * build-aux/.gitignore: Ignore `test-driver' script. 2011-10-03 Eli Zaretskii <eliz@gnu.org> dfa: don't mishandle high-bit bytes in a regexp with signed-char This appears to arise only on systems for which "char" is signed. * src/dfa.c (FETCH_WC, FETCH): Produce an unsigned value, rather than a sign-extended one. Fixes a bug on MS-Windows with compiling patterns that include characters with the 8-th bit set. (to_uchar): Define. From coreutils. Reported by David Millis <tvtronix@yahoo.com>. See http://thread.gmane.org/gmane.comp.gnu.grep.bugs/3893 * NEWS (Bug fixes): Mention it. 2011-09-16 Jim Meyering <meyering@redhat.com> maint: dfa: simplify multi-byte-related conditionals * src/dfa.c (setbit_case_fold_c, parse_bracket_exp, lex): (addtok_mb, dfaparse): Change each "MBS_SUPPORT && MB_CUR_MAX > 1" test to just "MB_CUR_MAX > 1". * src/dfasearch.c (kwsincr_case, EGexecute): Likewise. * src/kwsearch.c (Fcompile, Fexecute): Likewise. * src/searchutils.c (kwsinit): Likewise. * src/dfa.c (parse_bracket_exp): Convert "if (!MBS_SUPPORT || MB_CUR_MAX == 1)" to "if (MB_CUR_MAX == 1)" and do this: - assert(!MBS_SUPPORT || MB_CUR_MAX == 1); + assert(MB_CUR_MAX == 1); maint: dfa: simplify several expressions * src/dfa.c (dfainit): Set d->mb_cur_max unconditionally, now that MB_CUR_MAX is always usable. With that, simplify all "MBS_SUPPORT && d->mb_cur_max > 1" to simply "d->mb_cur_max > 1". (dfastate, dfaexec, dfainit, dfafree): Simplify, removing each now-unnecessary "MBS_SUPPORT &&". maint: dfa: avoid in-function "#if MBS_SUPPORT" tests * src/dfa.c (setbit_case_fold_c): Remove "#if MBS_SUPPORT" in favor of simple "if (MBS_SUPPORT ...". (dfaexec, addtok): Likewise. maint: ensure that MB_CUR_MAX is defined even when !MBS_SUPPORT * src/mbsupport.h [!MBS_SUPPORT] (MB_CUR_MAX): Define to 1. build: fix compilation failure when MBS_SUPPORT is 0 * src/dfa.c (add_utf8_anychar): Always compile this function, but when MBS_SUPPORT is 0, give it an empty body. (prepare_wc_buf): Likewise. [! MBS_SUPPORT] (setbit_wc): Define to always abort. maint: dfa: simplify dfaoptimize * src/dfa.c (dfaoptimize): Simplify. (dfacomp): Remove now-redundant "if (MBS_SUPPORT)" guard, since dfaoptimize does nothing if !MBS_SUPPORT. maint: dfa: remove some #if MBS_SUPPORT guards * src/dfa.c: Replace a few "#if MBS_SUPPORT" directives with "if (MBS_SUPPORT)". Remove some altogether. maint: dfa: convert #if-MBS_SUPPORT (dfastate) * src/dfa.c (dfastate): Use regular "if", not #if MBS_SUPPORT. maint: dfa: convert #if-MBS_SUPPORT (dfastate) * src/dfa.c (dfastate): Use regular "if", not #if MBS_SUPPORT. maint: dfa: convert #if-MBS_SUPPORT (state_index) * src/dfa.c (state_index): Use regular "if", not #if MBS_SUPPORT. maint: dfa: convert #if-MBS_SUPPORT (dfaparse) * src/dfa.c (dfaparse): Use regular "if", not #if MBS_SUPPORT.' maint: dfa: convert #if-MBS_SUPPORT (copytoks) * src/dfa.c (copytoks): Use regular "if", not #if MBS_SUPPORT.' maint: dfa: convert #if-MBS_SUPPORT (lex) * src/dfa.c (lex): Use regular "if", not #if MBS_SUPPORT.' maint: dfa: convert #if-MBS_SUPPORT (parse_bracket_exp) * src/dfa.c (parse_bracket_exp): Use regular "if", not #if MBS_SUPPORT. maint: dfa: convert #if-MBS_SUPPORT (parse_bracket_exp) * src/dfa.c (parse_bracket_exp): Use regular "if", not #if MBS_SUPPORT. maint: dfa: convert #if-MBS_SUPPORT (parse_bracket_exp) * src/dfa.c (parse_bracket_exp): Use regular "if", not #if MBS_SUPPORT. maint: dfa: convert #if-MBS_SUPPORT (dfaexec) * src/dfa.c (dfaexec): Use regular "if", not #if MBS_SUPPORT. maint: dfa: convert #if-MBS_SUPPORT (dfaexec) * src/dfa.c (dfaexec): Use regular "if", not #if MBS_SUPPORT. Also add curly braces around multi-line if/else blocks. maint: dfa: remove #if-MBS_SUPPORT (free_mbdata) * src/dfa.c (free_mbdata): Remove the #if guard altogether. maint: dfa: convert #if-MBS_SUPPORT (dfaoptimize, dfacomp) * src/dfa.c (dfaoptimize, dfacomp): Use regular "if", not #if MBS_SUPPORT. maint: dfa: convert #if-MBS_SUPPORT (dfafree) * src/dfa.c (dfafree): Use regular "if", not #if MBS_SUPPORT. maint: dfa: convert #if-MBS_SUPPORT (parse_bracket_exp, part1) * src/dfa.c (parse_bracket_exp): Remove in-function #if MBS_SUPPORT. maint: remove #if-MBS_SUPPORT declaration guards * src/search.h: Don't bother to #if-out declarations. maint: convert #if-MBS_SUPPORT (EGexecute) * src/dfasearch.c (EGexecute): Remove in-function #if MBS_SUPPORT. maint: convert #if-MBS_SUPPORT (kwsincr_case) * src/dfasearch.c (kwsincr_case): Remove in-function #if MBS_SUPPORT. Move decl's down. maint: convert #if-MBS_SUPPORT (Fcompile, etc.) * src/kwsearch.c (Fcompile, Fexecute): Remove in-function #if MBS_SUPPORT. (Fcompile): Rearrange some declarations. No semantic change. maint: convert #if-MBS_SUPPORT (kwsinit) * src/searchutils.c (kwsinit): Remove in-function #if MBS_SUPPORT. maint: dfa: remove case-guarding #if-MBS_SUPPORT * src/dfa.c [DEBUG] (prtok): Remove now-useless #if-MBS_SUPPORT. 2011-09-15 Jim Meyering <meyering@redhat.com> maint: remove #if MBS_SUPPORT around member declaration * src/dfa.c (dfastate): Don't #ifdef-out "mbps" position_set member. maint: dfa: remove #if MBS_SUPPORT around struct definition * src/dfa.c (struct mb_char_classes): Don't #ifdef-out declarations. build: avoid compilation failure when building without PCRE support * src/pcresearch.c [!HAVE_LIBPCRE] (WITHOUT_PCRE_NORETURN): Define to _Noreturn, not obsoleted-by-gnulib _GL_ATTRIBUTE_NORETURN. Reported by Eric Blake. tests: stop using skip_test_; use skip_ instead * tests/init.cfg (skip_test_): Remove definition. Use the improved skip_ function from init.sh, now that it has the same feature. * tests/euc-mb: s/skip_test_/skip_/ * tests/sjis-mb: Likewise. * tests/fmbtest: Likewise. tests: skip tests that require MBS support * tests/init.cfg (require_compiled_in_MB_support): New function. * tests/char-class-multibyte: Use it here, since this test cannot succeed without MBS support. * tests/equiv-classes: Likewise. * tests/euc-mb: Likewise. * tests/fgrep-infloop: Likewise. * tests/init.cfg: Likewise. * tests/prefix-of-multibyte: Likewise. * tests/turkish-I: Likewise. * tests/sjis-mb: Likewise. tests: make fmbtest explain (to stderr, not log) why it is skipped * tests/fmbtest: Use skip_ and fail_ to give better diagnostics. maint: dfa: improve comments * src/dfa.c (match_mb_charset, match_anychar): Improve comments. 2011-09-14 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to newer maint: correct indentation * src/dfa.c (dfaexec): Reposition curly braces to match indentation style. Remove useless comment. maint: move declaration "down" to inner scope where it is used * src/dfa.c (dfaexec): Move decl of local down into scope where used. 2011-09-07 Jim Meyering <meyering@redhat.com> doc: use "file name" consistently in grep's --help output * src/main.c (usage): Use "file name", not "filename" in descriptions of --with-filename (-H), --no-filename (-h) and --label=LABEL. Suggested by Sequoia McDowell. bug: requires ru_RU.KOI8-R". [bug introduced in grep-2.9] 2011-08-31 Matthew Burgess <matthew@linuxfromscratch.org> tests: remove debug code that would cp to /t * tests/unibyte-bracket-expr: Remove debug artifact introduced by 2011-06-02 commit de5f7000, "tests: exercise a uni-byte [...] bug: requires ru_RU.KOI8-R". [bug introduced in grep-2.9] 2011-08-20 Jim Meyering <meyering@redhat.com> build: use largefile module and update to latest gnulib * configure.ac: Remove AC_SYS_LARGEFILE, subsumed by ... * bootstrap.conf (gnulib_modules): ...this. Use largefile module. * gnulib: Update to latest. maint: clean up and plug a leak-on-OOM * src/dfa.c (icatalloc): Clean up; use xrealloc in place of malloc and realloc; remove conditionals that are unnecessary, now that failed allocation results in exit. (enlist): Use xrealloc in place of realloc; remove conditional. (comsubs): Avoid leak upon failed enlist call. (dfamust): Use xmalloc in place of malloc. Remove conditionals, now that icpyalloc and icatalloc never return NULL. maint: use x2nrealloc, not xrealloc * src/main.c (main): Use x2nrealloc, not xrealloc 2011-07-24 Jim Meyering <meyering@redhat.com> tests: add a test to trigger the bug * tests/Makefile.am (TESTS): Add it. * tests/in-eq-out-infloop: Exercise the bug/fix. exit 2 (rather than infloop) when an input file is also on stdout This avoids a potential "infinite" disk-filling loop. Reported in http://savannah.gnu.org/patch/?5316 and http://savannah.gnu.org/bugs/?17457. * src/main.c: Include "quote.h". (out_stat): New global. (grepfile): Compare each regular file's dev/ino/etc. with those from the file on stdout (if it too is regular). (main): Set out_stat, if stdout is a regular file. * src/system.h: Include "same-inode.h". (same_file_attributes): Define. From diffutils. (SAME_REGULAR_FILE): Define. * bootstrap.conf (gnulib_modules): Use quote, not quotearg. Use same-inode. * NEWS (Bug fixes): Mention it. 2011-07-15 Reuben Thomas <rrt@sc3d.org> doc: improve documentation of character classes in the man page * doc/grep.in.1: Reword documentation of character classes. 2011-07-12 Jim Meyering <meyering@redhat.com> dfa: remove unnecessary inclusion of verify.h * src/dfa.c: Don't include "verify.h". dfa: simplify use of *ALLOC macros * src/dfa.c (XNMALLOC, XCALLOC): Redefine without outer cast-to-(t *). (CALLOC, MALLOC, REALLOC): Remove type "t" parameter and adjust callers. dfa: change semantics of REALLOC_IF_NECESSARY's 3rd parameter * src/dfa.c (REALLOC_IF_NECESSARY): Change meaning of 3rd param, from "maximum index" to 1 greater than that: the required number of *P-sized elements. Note that only some of the uses of REALLOC_IF_NECESSARY needed to be adjusted, the others had already required an extra element. dfa: rename REALLOC_IF_NECESSARY param/local for clarity * src/dfa.c (REALLOC_IF_NECESSARY): Rename nalloc and new_nalloc to n_alloc and new_n_alloc. dfa: prepare for a semantic change in REALLOC_IF_NECESSARY * src/dfa.c (REALLOC_IF_NECESSARY): Remove "t" (type) parameter. Use (*p) instead. Adjust all callers. dfa: add braces to REALLOC_IF_NECESSARY definition * src/dfa.c (REALLOC_IF_NECESSARY): Add curly braces; use TABs to right-indent. 2011-06-28 Paolo Bonzini <bonzini@gnu.org> doc: improve documentation of character classes * doc/grep.texi (Character classes): Mention explicitly when examples refer to the C locale, explain better the general meaning of character classes. 2011-06-28 Jim Meyering <meyering@redhat.com> dfa: fix the root cause of the heap overrun dfa's "insert" function was supposed to be maintaining the position list sorted on *decreasing* index, but since the 2009-12-09 "Speed up insert" commit, 62458291, it was using code that assumed the data were sorted on *increasing* index. As such, sometimes it would no longer merge constraints (not finding a match) and would append entries that normally would have matched and been merged. Those erroneous append operations resulted in the heap overrun fixed by 2011-06-17 commit 0b91d692 by doubling the array size. * src/dfa.c (insert): Fix the comparison. (dfaanalyze): Now that that's fixed, revert commit 0b91d692, allocating space for only d->nleaves entries, not double that. As far as I can tell, this change has no effect other than decreased memory usage, although it may improve performance slightly, since the resulting list of positions is half as long as it used to be. 2011-06-28 Paolo Bonzini <bonzini@gnu.org> dfa: use memcpy to copy position_sets * src/dfa.c (copy): Use memcpy. dfa: use copyset to copy charclasses * src/dfa.c (add_utf8_anychar): Change memcpy to copyset. gnulib: Update Fixes mmap-anon.m4 conflict with fn_grep, reported by Rainer Orth. 2011-06-21 Jim Meyering <meyering@redhat.com> maint: update bootstrap from gnulib * bootstrap: Update to latest, so it no longer inserts empty lines in .gitignore files. * .gitignore: Let bootstrap move "!..." lines to end of file. post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.9 * NEWS: Record release date. build: avoid a warning when building with --disable-perl-regexp... and --enable-gcc-warnings. * src/pcresearch.c (WITHOUT_PCRE_NORETURN): Define. Remove the unreachable return statement. Reported by Eric Blake. tests: ensure that each test script is executable This adds a rule run at "make check" time to ensure that test scripts are consistently executable. This change is not required for "make check", but makes it easier for people to run scripts manually, but that is discouraged because doing so makes it easy to omit important variable settings that are normally provided via TESTS_ENVIRONMENT. This change also makes each of the existing TESTS executable. * tests/Makefile.am (check_executable_TESTS): New rule. (check): Depend on it. * tests/{all_scripts}: chmod 755. Prompted by a report from Eric Blake. maint: update bootstrap from gnulib * bootstrap: Update from gnulib. maint: update po/POTFILES.in * po/POTFILES.in: Remove dfasearch.c, now that it no longer contains a translatable diagnostic. tests: include-exclude: avoid false positive failure on FreeBSD * tests/include-exclude: Avoid false-positive failure due to matching "a" in a directory on FreeBSD, when searching a directory without "-r". Search for '^aaa$' rather than just 'a'. Adjust test inputs and expected output files accordingly. dfa: remove some useless casts * src/dfa.c (icatalloc): Change type of "old" parameter from "char const *" to "char *". Don't cast-away const on realloc argument. Remove now-unnecessary const-discarding cast. Don't (void)-cast strcpy result. * src/dosbuf.c (undossify_input): Remove anachronistic cast-to-"char *" of realloc argument. dfa: more heap-allocation-related overflow protection * src/dfa.c (enlist): Use xnrealloc, not realloc. Also, remove unnecessary cast-to-(char *). (dfamust): Use xnmalloc, not malloc. Before, this code would return upon malloc failure (xnmalloc exits upon failure), but later, via the *ALLOC macros, it could already exit, so this new potential exit point is nothing new. The same applies to enlist, since it is called only through dfamust. tests: update init.sh; simplify TESTS_ENVIRONMENT * tests/init.sh: Update from coreutils. * tests/Makefile.am (TESTS_ENVIRONMENT): Remove shell_or_perl_ function. Instead, just use $(SHELL), since grep has no test that starts with #!/usr/bin/perl. 2011-06-20 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest build: avoid configure/gnulib-related errors * bootstrap.conf: Remove now-unnecessary code to exclude gettext/intl-related m4 tests. 2011-06-19 Jim Meyering <meyering@redhat.com> maint: tighten up superfluous code * src/main.c (parse_grep_colors): Use xstrdup in place of xmalloc, a useless test, strlen, and strcpy. 2011-06-19 Paul Eggert <eggert@cs.ucla.edu> dfa: avoid possibility of overflow * src/dfa.c (REALLOC_IF_NECESSARY, CALLOC, MALLOC, REALLOC): Use functions from xalloc.h to avoid overflow. * src/dfasearch.c (GEAcompile): Use xnrealloc rather than realloc. * src/pcresearch.c (Pcompile): Use xnmalloc, not xmalloc. 2011-06-17 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest dfa: correct two uses of btowc * src/dfa.c (setbit_c, setbit_case_fold_c): Compare the btowc return value against WEOF, not EOF. Suggested by Eli Zaretskii. On a system like MinGW with unsigned wint_t, comparing a btowc return value against EOF (-1) would always be false. dfa: don't overrun a malloc'd buffer for certain regexps * src/dfa.c (dfaanalyze): Allocate space for twice as many positions as there are leaves. Before this change, for some regular expressions, DFA analysis would have inserted far more "positions" than dfa->nleaves (up to double). Reported by Raymond Russell in http://savannah.gnu.org/bugs/?33547 * tests/dfa-heap-overrun: Trigger the overrun. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. 2011-06-08 Jim Meyering <meyering@redhat.com> tests: don't ignore sjis-mb test failure I made changes that caused grep to segfault during "make check" -- as seen in dmesg output -- yet no test failed(!), and there was no trace of the segfault in the logs. * tests/sjis-mb (test_grep_reject): Ensure that output is empty. Don't ignore test failure. 2011-06-07 Paolo Bonzini <bonzini@gnu.org> dfa: optimize wide characters in a bracket expression * src/dfa.c (addtok): Compile characters to an alternation. Handle the case when nothing else remains in the MBCSET. dfa: refactor to prepare for upcoming optimizations * src/dfa.c (parse_bracket_exp): Move optimization of MBCSET from here... (addtok): ... to here. 2011-06-07 Paolo Bonzini <bonzini@gnu.org> dfa: correct handling of single-byte character ranges This provides a better fix for the unibyte-bracket-expr and high-bit-range testcases, and fixes the latent bug tested by bogus-wctob. * src/dfa.c (setbit_case_fold): Remove, replace with... (setbit_wc, setbit_c, setbit_case_fold_c): ... these. (parse_bracket_exp): Use setbit_case_fold_c when iterating over single-byte sequences. Use setbit_wc for multi-byte character sets, and setbit_case_fold_c for single-byte character sets. (lex): Use setbit_case_fold_c for single-byte character sets. 2011-06-07 Paolo Bonzini <bonzini@gnu.org> tests: exercise latent bug in character ranges * tests/bogus-wctob: New. * Makefile.am (TESTS): Add it. 2011-06-07 Jim Meyering <meyering@redhat.com> tests: exercise a uni-byte [...] bug: requires ru_RU.KOI8-R * tests/unibyte-bracket-expr: New file. * tests/Makefile.am (TESTS): Add it. * init.cfg (require_ru_RU_koi8_r): New function. fix the [...] bug also for relatively unusual uni-byte encodings * src/dfa.c (setbit_case_fold): Also handle uni-byte locales like the one mentioned in the original report: see 2011-05-07 commit d98338eb. Re-reported by Santiago Ruano Rincón. Note that most uni-byte locales are not affected. * NEWS (Bug fixes): Mention it. tests: use skip_test_, not skip_ Use skip_test_, not skip_. The former prints its message both to the log file and to FD 9 (redirected to tty via tests/Makefile.am), while skip_ prints only to stderr, which goes to the log file. * tests/init.cfg (skip_test_): New function. Use skip_test_ in place of skip_ everywhere. * tests/fmbtest: s/skip_/skip_test_/ * tests/sjis-mb: Likewise. * tests/euc-mb: Likewise. tests: fmbtest: factor * tests/fmbtest: Factor out locale-name duplication. tests: fix skip-inducing typo in fmbtest * tests/fmbtest: Fix locale name typo (s/cz_CZ/cs_CZ/) that would cause this test to be skipped every time. 2011-06-07 Paolo Bonzini <bonzini@gnu.org> gnulib: adjust included modules * bootstrap.conf (gnulib_modules): Drop strtoul, rename wctype to wctype-h. 2011-05-21 Jim Meyering <meyering@redhat.com> grep -P: don't abort upon exceeding PCRE's backtracking limit * src/pcresearch.c (Pexecute): Handle PCRE_ERROR_MATCHLIMIT. * tests/Makefile.am (XFAIL_TESTS): Remove pcre-abort. * tests/pcre-abort: Expect failure, no output, and increase the length of the input string, in case the backtracking limit is ever raised. Adjust comment. * NEWS (Bug fixes): Mention it. tests: show how to make grep -P abort * tests/pcre-abort: New file. Minimal testcase by Paolo Bonzini, derived from a report by www.beaver@list.ru. * tests/Makefile.am (TESTS): Add it. (XFAIL_TESTS): Add it here, too, since this test always fails, for now. tests: fix oddities in pcre-z * tests/pcre-z: Redirect stderr inside $(), not outside. Remove double quotes around $REGEX (which is just 'a') within double-quoted "$(...)". Split a long line. tests: factor out a new require_pcre_ function * tests/init.cfg (require_pcre_): New function, factored out of... * tests/pcre-z: ...here. Use the function. * tests/pcre: Likewise. tests: clean up pcre * tests/pcre: Skip (don't pass) the test when PCRE support is disabled. Don't redirect so much to /dev/null, now that all test output goes to pcre.log. Remove unnecessary braces and diagnostic about failing test. 2011-05-13 Jim Meyering <meyering@redhat.com> post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.8 * NEWS: Record release date. build: update gnulib, for fixed getcwd test build: update gnulib submodule to latest maint: remove syntax-checking sc_tight_scope rule * src/Makefile.am (sc_tight_scope): Remove rule. Now it's provided via gnulib's maint.mk. * cfg.mk (sc_tight_scope): Likewise. 2011-05-08 Jim Meyering <meyering@redhat.com> maint: use consistent declaration syntax * src/grep.h (matchers): Declare consistently, so the sc_tight_scope rule detects this as an extern-marked variable. 2011-05-07 Jim Meyering <meyering@redhat.com> maint: use gnulib's new readme-release module * bootstrap.conf (gnulib_modules): Add readme-release. (bootstrap_epilogue): Add the recommended perl one-liner. * README-release: Remove file; it is now generated from gnulib. * .gitignore: Add it. * gnulib: Update submodule to latest. tests: exercise bug with 0x80..0xff in [...] * tests/high-bit-range: New test, inspired by an example in the report by Igor O. Ladygin: http://bugs.debian.org/624387, via Santiago Ruano Rincón's http://savannah.gnu.org/bugs/?33198 * tests/Makefile.am (TESTS): Add it. fix a bug whereby echo c|grep '[c]' would fail for any c in 0x80..0xff * src/dfa.c (setbit_case_fold) [MBS_SUPPORT]: Set the bit also when wctob returns EOF. * NEWS (Bug fixes): Mention it. 2011-05-02 Reuben Thomas <rrt@sc3d.org> doc: correct comment about mmap * doc/grep.texi (Other Options) [--mmap]: This option is now ignored, so using it can have no effect on performance. 2011-05-02 Arnold D. Robbins <arnold@skeeve.com> build: move add_utf8_anychar into MBS ifdef 2011-05-01 Arnold D. Robbins <arnold@skeeve.com> maint: remove GAWK ifndef; no longer needed 2011-05-01 Jim Meyering <meyering@redhat.com> maint: remove now-unnecessary use of gnulib's strtol module * bootstrap.conf (gnulib_modules): Remove now-obsolete "strtol". 2011-04-29 Jim Meyering <meyering@redhat.com> maint: tweak README-release * README-release: Add note to check the NixOS/Hydra autobuilder results. 2011-04-28 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest maint: add the tight_scope syntax-checking rule This ensures that the only externally scoped symbols are ones that are explicitly marked as "extern" or white-listed like "main". * src/Makefile.am (sc_tight_scope): New rule, copied from coreutils. * cfg.mk (sc_tight_scope): Define, to hook to it from the top level. maint: mark some function declarations as extern * src/search.h: Add "extern" keyword to each function declaration. 2011-04-23 Jim Meyering <meyering@redhat.com> maint: fix doubled-word typos in comments * src/dfa.c (SUCCEEDS_IN_CONTEXT): Remove doubled "a". * src/dfa.c (BACKREF): s/it it/it is/ 2011-04-09 Jim Meyering <meyering@redhat.com> maint: fix typos in comments: s/can not/cannot/ * src/dfa.c (check_matching_with_multibyte_ops, dfastate): As above. 2011-03-19 Jim Meyering <meyering@redhat.com> maint: stop using .x-sc_* files to list syntax-check exemptions Instead, use the new mechanism with which you merely use a variable (derived from the rule name) defined in cfg.mk to an ERE matching the exempted file names. * gnulib: Update to latest, to get maint.mk that implements this. * .x-sc_bindtextdomain: Remove file. * .x-sc_prohibit_tab_based_indentation: Likewise. * .x-sc_prohibit_xalloc_without_use: Likewise. * .x-sc_space_tab: Likewise. * cfg.mk: Define variables to exempt the same files. build: correct my change of 2011-01-28 Do not override original dist-hook rule. * Makefile.am (run-syntax-check): Rename from overriding dist-hook. (dist-hook): Depend on run-syntax-check. 2011-02-27 Jim Meyering <meyering@redhat.com> maint: update from gnulib * bootstrap: Update from gnulib. * tests/init.sh: Likewise. * gnulib: Update to latest. 2011-01-27 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest build: run syntax-check rules as part of "make dist" * Makefile.am (dist-hook): Depend on syntax-check. Suggested by Reuben Thomas. 2011-01-26 Jim Meyering <meyering@redhat.com> maint: remove unneeded #include directives * lib/savedir.c: Don't include <stddef.h>. Not needed. * src/dfa.c: Likewise. 2011-01-22 Jim Meyering <meyering@redhat.com> build: avoid new syntax-check failures * .x-sc_bindtextdomain: New file, used to avoid a spurious failure from the new syntax-check rule. * NEWS: Remove a trailing space. 2011-01-19 Jim Meyering <meyering@redhat.com> tests: add a known-to-fail test * tests/turkish-I: New test. * tests/Makefile.am (TESTS): Add it. (XFAIL_TESTS): Add here, too. Reported by Ilya Basin. maint: sort test names in Makefile.am * tests/Makefile.am (TESTS): Sort test names. 2011-01-05 Jim Meyering <meyering@redhat.com> doc: remove erroneous "{,m}" item from grep man page * doc/grep.in.1: Remove item describing bogus {,m} regex notation. Reported by Fernando Basso. 2011-01-03 Jim Meyering <meyering@redhat.com> maint: update copyright year ranges to include 2011 Run "make update-copyright", so "make syntax-check" works in 2011. build: update gnulib submodule to latest 2010-12-20 Paolo Bonzini <bonzini@gnu.org> main: fix exit status on xmalloc failures * NEWS: Update. * src/main.c (main): Set exit_failure. Reported by Guy Shaw. add comment above fn_grep * configure.ac (fn_grep): Add comment suggested by Bruno Haible. 2010-11-14 Paolo Bonzini <bonzini@gnu.org> grep: add include guards * src/system.h: Add multiple inclusion guards. * src/grep.h: Likewise. configure: fix M4 quotation * configure.ac: Add extra brackets around [...] patterns. configure: remove dependency on grep that supports long lines and -e * configure.ac (fn_grep): New. Set GREP and EGREP to it, replace with newly-built grep before AC_OUTPUT. Reported by Florin Iucha <http://savannah.gnu.org/bugs/?31646>. 2010-11-04 Jim Meyering <meyering@redhat.com> build: update gnulib to latest tests: don't hard-code a 5-second timeout; that's not always enough Instead, time the command in the C locale and use 10 times that duration -- rounded up to whole seconds -- as the timeout when running it in the UTF-8 locale. * tests/backref-multibyte-slow: Compute a performance-relative timeout. Reported by Gilles Espinasse, regarding an imac 400. For more details, see http://thread.gmane.org/gmane.comp.gnu.grep.bugs/3360 2010-10-09 Jim Meyering <meyering@redhat.com> maint: describe policy on copyright year number ranges * README: Mention coreutils' long-standing policy on use of M-N ranges in copyright year lists. Requested by Richard Stallman. 2010-10-04 Dmitry V. Levin <ldv@altlinux.org> build: compile gnulib without -Wcast-align to avoid warnings on ARM * configure.ac (GNULIB_WARN_CFLAGS): Remove -Wcast-align. 2010-09-30 Jim Meyering <meyering@redhat.com> maint: don't define a gpg_key_ID. now it's obtained automatically * cfg.mk (gpg_key_ID): Remove definition. No longer needed. 2010-09-23 Paolo Bonzini <bonzini@gnu.org> tests: add testcase for previous fix * tests/inconsistent-ranges: New. * tests/Makefile.am (TESTS): Add it. 2010-09-23 Paolo Bonzini <bonzini@gnu.org> dfa: process range expressions consistently with system regex The actual meaning of range expressions in glibc is not exactly strcoll, which makes the behavior of grep hard to predict when compiled with the system regex. Leave to the system regex matcher the decision of which single-byte characters are matched by a range expression. This partially reverts a change made in commit 0d38a8bb (which made sense at the time, but not now that src/dfa.c is not doing multibyte character set matching anymore). * src/dfa.c (in_coll_range): Remove. (parse_bracket_exp): Use system regex to find which single-char bytes match a range expression. 2010-09-23 Bruno Haible <bruno@clisp.org> build: fix link error on systems that have libiconv but not libintl * src/Makefile.am (LDADD): Add $(LIBICONV). 2010-09-21 Jim Meyering <meyering@redhat.com> build: avoid compilation failure on the Hurd * src/dfasearch.c (dfawarn): Rename enum symbols to use DW_ prefix, so as not to collide with "GNU", which is defined by the Hurd. Reported by Matthias Lanzinger in http://savannah.gnu.org/bugs/?31096 2010-09-20 Jim Meyering <meyering@redhat.com> maint: avoid obsolete gnulib modules * bootstrap.conf (gnulib_modules): Don't use obsolete atexit module. Use malloc-gnu and realloc-gnu -- malloc and realloc are obsolete. maint: update README-release * README-release: Reflect changes in coreutils' version of this file. 2010-09-20 Aharon Robbins <arnold@skeeve.com> dfa: fix compilation when not using MBS * src/dfa.c (prepare_wc_buf) [!MBS_SUPPORT]: Do not compile this function. 2010-09-16 Jim Meyering <meyering@redhat.com> post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.7 * NEWS: Record release date. 2010-09-13 Paolo Bonzini <bonzini@gnu.org> tests: add equiv-classes * configure.ac (USE_INCLUDED_REGEX): Add Automake conditional. * tests/equiv-classes: New test. * tests/Makefile.am (TESTS): Add it. (XFAIL_TESTS) [USE_INCLUDED_REGEX]: Mark it as expected failure. 2010-09-13 Paolo Bonzini <bonzini@gnu.org> dfa: fall back to glibc matcher if a MBCSET is found This patch enables full support of equivalence classes and multicharacter collation symbols. It can also improve performance problems in some cases for multibyte grep. Both of these changes however depend on the glibc version installed in the system. For UTF-8 it will trigger only in the presence of MBCSET, e.g. [a-z]. For other character sets all brackets and `.` as well will trigger it. * NEWS: Document this. * src/dfa.c (dfaexec): Fall back to glibc for multibyte matches, if possible. 2010-09-13 Paolo Bonzini <bonzini@gnu.org> build: update gnulib submodule to latest This is done to include commit "regex: Pass the system regex if its only problem is 32-bit regoff_t". * gnulib: Update to e2b0e1a. 2010-09-12 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest tests: update init.sh from gnulib * tests/init.sh: Update from gnulib. 2010-09-08 Patrick Boyd <pboyd04@gmail.com> dfa: reduce stack usage * src/dfa.c (dfaanalyze): Allocate GRPS and LABELS arrays from heap, not on the stack. With this change, grep can now run in these UEFI simulators: http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EDK http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EDK2 2010-09-08 Jim Meyering <meyering@redhat.com> tests/portability: avoid spurious failure with OpenBSD's /bin/sh * tests/warn-char-classes: Don't use "set -x" here. It causes a spurious test failure on openbsd 4.7 when using its /bin/sh, since the command, /bin/sh -xc 'P=1 : 2> err' emits "P=1" into err. To enable set -x, run the test with "VERBOSE=yes", e.g., make check -C tests TESTS=warn-char-classes VERBOSE=yes 2010-09-07 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest 2010-09-03 Jim Meyering <meyering@redhat.com> tests: remove .sh suffix from remaining test scripts. * tests/backref: Rename from backref.sh. * tests/bre: Rename from bre.sh. * tests/ere: Rename from ere.sh. * tests/file: Rename from file.sh. * tests/khadafy: Rename from khadafy.sh. * tests/options: Rename from options.sh. * tests/pcre: Rename from pcre.sh. * tests/spencer1: Rename from spencer1.sh. * tests/spencer2: Rename from spencer2.sh. * tests/status: Rename from status.sh. * tests/yesno: Rename from yesno.sh. * tests/Makefile.am: Reflect renamings. tests: convert remaining tests to use init.sh * tests/file.sh: Use init.sh. Use Exit, not exit. Use grep, not ${GREP}. * tests/khadafy.sh: Likewise. * tests/options.sh: Likewise. * tests/spencer1.sh: Likewise. * tests/spencer2.sh: Likewise. * tests/status.sh: Likewise. * tests/spencer1.awk: Use grep, not ${GREP}. Don't ignore failure to generate intermediate shell script. * tests/Makefile.am (CLEANFILES): Remove altogether, now that all tests use init.sh. (TESTS_ENVIRONMENT): Don't set GREP. It's no longer used. tests: remove warning.sh * tests/warning.sh: Remove file. All it did was print a warning. * tests/Makefile.am (TESTS): Remove warning.sh. tests: convert pcre.sh to use init.sh * tests/pcre.sh: Use init.sh. Use Exit, not exit. Use grep, not ${GREP}. tests: convert bre.sh to use init.sh * tests/bre.sh: Use init.sh. Use Exit, not exit. Use "$abs_top_srcdir/tests/", not "$srcdir/" to specify inputs. Source generated bre.script, rather than invoking $SHELL. * tests/ere.sh: Likewise. * tests/bre.awk: Use grep, not ${GREP}. * tests/ere.awk: Likewise. * tests/Makefile.am (CLEANFILES): Remove bre.script and ere.script. tests: convert to use init.sh * tests/yesno.sh: Use init.sh. Use Exit, not exit. Use grep, not $GREP. * tests/backref.sh: Likewise. * tests/Makefile.am (CLEANFILES): Remove yesno.txt. build: update gnulib submodule to latest build: update build/test tools from gnulib * bootstrap: Update from gnulib. * tests/init.sh: Likewise. 2010-09-01 Jim Meyering <meyering@redhat.com> maint: add lib/version-etc.c to the list in POTFILES.in * po/POTFILES.in: Add lib/version-etc.c. 2010-09-01 Jim Meyering <meyering@redhat.com> grep: diagnose and exit-2 for bogus REs like [:space:], [:digit:], etc. When I make a mistake like this: grep '[:lower:]' ... be it in a script or on the command line, I want to know about it as soon as possible. I don't want grep to print a mere warning that it is interpreting this suspicious and almost guaranteed-wrong regular expression as a set of just 6 bytes. And I certainly don't want grep to silently do the wrong thing, even if that would be officially standards-conforming. It's obvious that I intended [[:lower:]], and I want my error to be diagnosed in a way that is most likely to get my attention. Thus, with this change, grep now prints a diagnostic and exits with status 2 the moment it encounters an offending [:char_class:] construct. This changes the way grep works by default, rather than putting this new behavior on an option. A new option would seldom be used in scripts (not portable), and would probably be used only rarely by those who need it the most. This new functionality provides a valuable safety measure and incurs truly negligible risk. For strict POSIX compliance, set POSIXLY_CORRECT in your environment. That disables this new feature. Revert the changes from commit 2cd3bcea, "grep: add --warnings={always,never,auto}.", and then do the following: * src/dfasearch.c (dfawarn): Call getenv("POSIXLY_CORRECT") here; Remove "warning: " from the diagnostic, now that it's more than a warning, and exit with status 2. * NEWS (New features): Describe the new semantics. * tests/warn-char-classes: Adjust one test to accommodate this change. * doc/grep.texi (Character Classes and Bracket Expressions): Document. (Environment Variables): Cross-reference it. Remove reference to obsolete getopt illegal vs. invalid difference. Thanks to Paul Eggert for suggestions and an initial prod. 2010-08-30 Jim Meyering <meyering@redhat.com> maint: use gnulib's standard --version-printing code This includes author names and keeps the copyright year up to date. * bootstrap.conf (gnulib_modules): Add propername and version-etc-fsf. * src/main.c (AUTHORS): Define. (main): Use version_etc, rather than hard-coding the copyright text. Prompted by a patch from Paolo Bonzini. 2010-08-27 Paolo Bonzini <bonzini@gnu.org> dfa: warn on [:space:] and similar * src/dfa.c (parse_bracket_exp): Warn on regular expressions such as [:space:]. * src/dfa.h (dfawarn): New prototype. * src/dfasearch.c (dfawarn): New. * NEWS: Document. tests: add test for warnings * tests/Makefile.am (TESTS): Add warn-char-class. * tests/warn-char-class: New. grep: add --warnings={always,never,auto}. * src/grep.h (no_warnings): New declaration. * src/main.c (no_warnings): New. (WARNINGS_OPTION): Add to enum. (main): Add --warnings. Handle color_option == 2 together with it. tests: add failing test for grep from a directory * tests/Makefile.am (TESTS, XFAIL_TESTS): Add grep-dir. * tests/grep-dir: New. tests: add test for previous commit * tests/Makefile.am (TESTS): Add grep-dev-null. * tests/grep-dev-null: New. search: fix "grep -Fif /dev/null" * bootstrap.conf: Include gnulib module minmax. * src/searchutils.c (mbtolower): Handle *N == 0 case. * src/system.h: Include minmax.h from gnulib. 2010-08-27 Adam Katz <savannah@kopis.com> Remove declaration after statement in dfa.c * dfa.c (dfaexec): Declare saved_end at the beginning of the function. 2010-08-13 Jim Meyering <meyering@redhat.com> make --include=FILE work once again The semantics of excluded_file_name changed (when operating on an "included" file name list). * src/main.c (main): Adjust for changed semantics of excluded_file_name simply by removing a negation. * NEWS (Bug fixes): Mention this fix. * tests/include-exclude: Add a test for this. Reported by Joe Perches in http://savannah.gnu.org/bugs/?29876. 2010-07-16 Paolo Bonzini <bonzini@gnu.org> doc: document \s and \S * doc/grep.texi (The Backslash Character and Special Expressions): Document \s and \S escapes. 2010-05-29 Karl Berry <karl@gnu.org> doc: discuss matches that span two or more lines * doc/grep.texi (Usage): Discuss matching across lines. (Character Classes and Bracket Expressions) <[:space:]>: refer to it. 2010-05-25 Jim Meyering <meyering@redhat.com> build: use latest gettext: 0.18 * configure.ac: Use gettext-0.18. * bootstrap.conf (gnulib_modules): Use gettext-h, not gettext. since the latter drags in a depedency on gettext 0.18. Suggested by Bruno Haible. maint: update helper scripts from gnulib * tests/init.sh: Update from gnulib. * bootstrap: Likewise. build: update gnulib submodule to latest maint: don't emit an extra newline in each of two diagnostics * src/main.c (context_length_arg, grepdir): Remove a stray \n in each of two diagnostics. 2010-05-24 Bruno Haible <bruno@clisp.org> search: Avoid out-of-bounds access. * src/dfasearch.c (EGexecute): Avoid access beyond end of buffer that could happen if start != beg - buf. 2010-05-23 Aharon Robbins <arnold@skeeve.com> dfa: fix signedness warnings * src/dfa.c (dfaexec): Cast p when passing it to prepare_wc_buf. 2010-05-09 Jim Meyering <meyering@redhat.com> tests: update init.sh * tests/init.sh: Update from gnulib. tests: normalize init.sh-sourcing code * tests/backref-multibyte-slow: Use one-line idiom. * tests/backref-word: Likewise. * tests/case-fold-backref: Likewise. * tests/case-fold-backslash-w: Likewise. * tests/case-fold-char-class: Likewise. * tests/case-fold-char-range: Likewise. * tests/case-fold-char-type: Likewise. * tests/char-class-multibyte: Likewise. * tests/dfaexec-multibyte: Likewise. * tests/empty: Likewise. * tests/euc-mb: Likewise. * tests/fedora: Likewise. * tests/fgrep-infloop: Likewise. * tests/fmbtest: Likewise. * tests/foad1: Likewise. * tests/ignore-mmap: Likewise. * tests/include-exclude: Likewise. * tests/max-count-vs-context: Likewise. * tests/pcre-z: Likewise. * tests/prefix-of-multibyte: Likewise. * tests/reversed-range-endpoints: Likewise. * tests/sjis-mb: Likewise. * tests/spencer1-locale: Likewise. * tests/word-delim-multibyte: Likewise. * tests/word-multi-file: Likewise. tests: update help-version * tests/help-version: Update from coreutils. 2010-05-06 Jim Meyering <meyering@redhat.com> tests: enable glibc's malloc-perturbing option * tests/Makefile.am (MALLOC_PERTURB_): Define, in case it's not already set in your environment. (TESTS_ENVIRONMENT): Propagate MALLOC_PERTURB_ setting to test scripts. 2010-05-06 Paolo Bonzini <bonzini@gnu.org> dfa: speed up [[:digit:]] and [[:xdigit:]] There's no "multibyte pain" in these two classes, since POSIX and ISO C99 mandate their contents. Time for "./grep -x '[[:digit:]]' /usr/share/dict/linux.words" Before: 1.5s, after: 0.07s. (sed manages only 0.5s). * src/dfa.c (predicates): Declare struct dfa_ctype separately from definition. Add sb_only. (find_pred): Return const struct dfa_ctype *. (parse_bracket_exp): Return const struct dfa_ctype *. Do not fill MBCSET for sb_only character types. 2010-05-05 Jim Meyering <meyering@redhat.com> tests: readability: use awk rather than obfuscated sed * tests/backref-multibyte-slow: Generate input using an awk for-loop rather than expensive and harder-to-read sed pipes. Remove stray "set -x" and "wc -l in". dfa: avoid segfault when processing an invalid multi-byte sequence * src/dfa.c (dfaexec): Handle the cases in which mbrtowc returns (size_t)-1 or (size_t)-2, rather than setting mblen_buf[i] to an outrageously large value. 2010-05-05 Paolo Bonzini <bonzini@gnu.org> grep: remove redundant syntax bit * grep.c (Gcompile): Remove RE_HAT_LISTS_NOT_NEWLINE. tests: add test for newly-fixed performance problem * tests/backref-multibyte-slow: New. * tests/Makefile.am: Add it. 2010-05-05 Paolo Bonzini <bonzini@gnu.org> dfa: convert to wide character line-by-line This provides a nice speedup for -m in general, but especially it avoids quadratic complexity in case we have to go to glibc. * NEWS: Document change. * src/dfa.c (prepare_wc_buf): Extract out of dfaexec. Convert only up to the next newline. (dfaexec): Exit multibyte processing loop if past buf_end. Call prepare_wc_buf again after processing a newline. 2010-05-01 Jim Meyering <meyering@redhat.com> maint: remove useless #if HAVE_STDLIB_H * src/mbsupport.h: Don't test HAVE_STDLIB_H. 2010-04-20 Jim Meyering <meyering@redhat.com> dfa: don't #ifdef-out member declarations * src/dfa.c (struct dfa): Remove "#if MBS_SUPPORT" guard that made several member declarations conditional on this cpp definition. (token): Likewise. Reported by Anders Wallin. tests: ensure that the --mmap option is ignored * tests/ignore-mmap: New file. * tests/Makefile.am (TESTS): Add it. Reported by Jaroslav Å karvada in <http://savannah.gnu.org/bugs/?29614> 2010-04-20 Paolo Bonzini <bonzini@gnu.org> dfa: honor RE_DOT_NEWLINE and RE_DOT_NOT_NULL in UTF-8 period optimization * src/dfa.c (add_utf8_anychar): Check for RE_DOT_NEWLINE and RE_DOT_NOT_NULL. grep: fix --mmap not being ignored * NEWS: Document bugfix. * main.c (main): Ignore MMAP_OPTION. 2010-04-19 Jim Meyering <meyering@redhat.com> maint: avoid syntax-check failure due to indentation via TABs * src/dfa.c (atom): Expand TABs in indentation. build: update gnulib submodule to latest maint: restrict scope of two globals to dfasearch.c * src/dfasearch.c (patterns, pcount): Declare these file-scoped globals to be static. 2010-04-19 Paolo Bonzini <bonzini@gnu.org> dfa: optimize UTF-8 period * NEWS: Document improvement. * src/dfa.c (struct dfa): Add utf8_anychar_classes. (add_utf8_anychar): New. (atom): Simplify if/else nesting. Call add_utf8_anychar for ANYCHAR in UTF-8 locales. (dfaoptimize): Abort on ANYCHAR. dfa: drop ORTOP * src/dfa.c (token, prtok, addtok_mb, nsubtoks, dfaanalyze, dfamust): Remove ORTOP. (regexp): Remove parameter, always add OR at the end, adjust callers. (atom): Adjust caller. (dfaparse): Adjust caller. Always add OR at the end. dfa: fix {0,0} * NEWS: Document change. * src/dfa.c (struct dfa): Remove "broken" field. (lex): Do not set it. (closure): On {0,0}, backup and lex another closure without adding a CAT. (dfabroken): Remove. * src/dfa.h (dfabroken): Remove. * tests/spencer1.tests: Add testcases for {m,n}. dfa: simplify dfainit * src/dfa.c (dfainit): Use memset. 2010-04-17 Jim Meyering <meyering@redhat.com> doc: fix a nit in HACKING * HACKING: Correct size of .git/ dir: 9MB, not 30MB. tests: add an expected-to-fail test using \< in a multi-byte locale * tests/word-delim-multibyte: New test. Currently failing. * tests/Makefile.am (TESTS): Add it. (XFAIL_TESTS): Define, temporarily. Reported by Jaroslav Å karvada in http://savannah.gnu.org/bugs/?29537. 2010-04-16 Paolo Bonzini <bonzini@gnu.org> test: cover just-fixed bug * tests/empty: Test -Fw too. grep: fix matching the empty string with grep -Fw * NEWS: Document fix. * src/kwsearch.c (Fexecute): The empty string is a valid match if it is a whole word. 2010-04-15 Jim Meyering <meyering@redhat.com> maint: update init.sh and HACKING * HACKING: Sync from coreutils. * tests/init.sh: Update from gnulib. 2010-04-13 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest; adapt * COPYING: Remove empty line. * README: Likewise. * doc/fdl.texi: Likewise. * tests/backref-word: Likewise. 2010-04-11 Stefano Lattarini <stefano.lattarini@gmail.com> tests: accept the Debian timeout program * tests/init.cfg: test timeout with `timeout 10s true' 2010-04-08 Jim Meyering <meyering@redhat.com> dfa: convert "cannot happen" code/comment to use assert * src/dfa.c (dfamust): There were numerous "cannot happen" comments, some associated with "if (expr) goto done;". Replace each with an equivalent "assert (!expr);". build: use gnulib's isblank module * bootstrap.conf (gnulib_modules): Use gnulib's isblank module, now that we rely on the function by that name. maint: undo TAB-conversion change to gl/lib/*.c.diff This fixes a bootstrap failure due to the patches not applying. * .x-sc_prohibit_tab_based_indentation: Add ^gl/lib/.*\.c\.diff$ * gl/lib/regcomp.c.diff: Revert today's TAB->space change. * gl/lib/regex_internal.c.diff: Likewise. * gl/lib/regexec.c.diff: Likewise. 2010-04-08 Arnold D. Robbins <arnold@skeeve.com> dfa: fix declaration of dfabroken in dfa.h * dfa.h (dfabroken) [GAWK]: Fix declaration to match that in dfa.c. 2010-04-08 Jim Meyering <meyering@redhat.com> maint: add syntax-check rule to enforce the new no-leading-TABs policy * cfg.mk (sc_prohibit_tab_based_indentation): New rule, from coreutils. (sc_prohibit_emacs__indent_tabs_mode__setting): Likewise. (old_NEWS_hash): Update. * .x-sc_prohibit_tab_based_indentation: List exempt files. 2010-04-08 Jim Meyering <meyering@redhat.com> convert all TABs to equivalent spaces in indentation Using this file, cat > leading-blank.exempt <<\EOF (?:^|\/)ChangeLog[^/]*$ (?:^|\/)(?:GNU)?[Mm]akefile[^/]*$ \.(?:am|mk)$ EOF run this command to convert all non-conforming leading white space to be all spaces: git ls-files \ | pcregrep -vf leading-blank.exempt \ | xargs pcregrep -l '^ *\t' \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_' 2010-04-08 Jim Meyering <meyering@redhat.com> build: include cfg.mk in the distribution tarball * Makefile.am (EXTRA_DIST): Add cfg.mk. 2010-04-08 Jim Meyering <meyering@redhat.com> maint: Makefile.am tweak (no semantic change) * Makefile.am (EXTRA_DIST): List one per line. Sort. build: include cfg.mk in the distribution tarball * Makefile.am (EXTRA_DIST): Add cfg.mk. 2010-04-08 Jim Meyering <meyering@redhat.com> dfa: move definition of __attribute__ back into dfa.h * src/dfa.c (__attribute__): Move definition back to... * src/dfa.h: ... this file. It is essential for non-gcc compilers. Reported by Arnold Robbins. 2010-04-07 Arnold D. Robbins <arnold@skeeve.com> dfa: move internals from dfa.h to dfa.c * src/dfa.h: Move internals into dfa.c. * src/dfa.c: The dfa internals are now totally local to this file. (dfaalloc, dfamusts, dfabroken): New functions to access features. * src/dfasearch.c (dfa): Change this global variable from struct to pointer. Adapt to that change, and use new functions, dfamusts and dfaalloc. 2010-04-07 Jim Meyering <meyering@redhat.com> mbtolower: avoid potential NULL-dereference * src/searchutils.c: Include <assert.h>. (mbtolower): Assert that 0 < *n, to avoid possibility of NULL-deref. Remove dead increment. maint: tell git to ignore more build products * .gitignore: Also ignore results of "make ID" and "make tags". build: update gnulib submodule to latest tests: use init.sh consistently * tests/euc-mb: Call "path_prepend_ ." on a line by itself, and with a comment. This makes it so all of the srcdir/init.sh lines are consistent, project-wide, and so that the addition of "." to PATH for this test is properly documented. * tests/sjis-mb: Likewise. maint: avoid new syntax-check failure, ... ...now that the sole use of xmalloc no longer matches the regular expression used by the syntax-check rule. * .x-sc_prohibit_xalloc_without_use: Exempt src/kwset.c. grep: make kwset's obstack use xmalloc, not malloc This insidious bug could make grep fail to diagnose a failed malloc, and then proceed to dereference the resulting NULL pointer. Note that this bug was unlikely ever to cause real trouble; without the fix, grep would segfault upon OOM, now it exits with a diagnostic. * src/kwset.c (malloc) [GREP]: Define without the "(s)" macro parameter, so that unadorned uses of malloc are also mapped to xmalloc. One such use is in the expansion of obstack_init. Report and patch by Nelson H. F. Beebe, in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/2995 tests: improve help-version (sync from gzip's version) * tests/help-version: Cross-check $VERSION and --version output. * tests/Makefile.am (TESTS_ENVIRONMENT): Export VERSION=$(VERSION). 2010-04-06 Jim Meyering <meyering@redhat.com> doc: update THANKS * THANKS: Update. 2010-04-06 Aharon Robbins <arnold@skeeve.com> build: avoid conflict with WCHAR definition from Cygwin's <windows.h> * src/dfa.h (enum token): Remove the definition from this file. Replace with a declaration and typedef. Moved to ... * src/dfa.c (enum token): ... here. Reported by Corinna Vinschen. 2010-04-06 Jim Meyering <meyering@redhat.com> doc: add HACKING * HACKING: New file. Copied from coreutils, with s/coreutils/grep/ and a few minor edits. 2010-04-05 Jim Meyering <meyering@redhat.com> tests: pull fixed init.sh from gnulib * tests/init.sh: Update from gnulib. maint: fix new argmatch-related syntax-check failures * configure.ac (ARGMATCH_DIE): Use usage(EXIT_FAILURE), not exit(1). * po/POTFILES.in: Add lib/argmatch.c. maint: update cfg.mk to work with gnulib's newer "make syntax-check" * cfg.mk: Update to use new _sc_search_regexp interface. Run this: perl -pi -e 's/\b_prohibit_regexp\b/_sc_search_regexp/;' -e 's/\bmsg=/halt=/; s/\bre=/prohibit=/;' cfg.mk and then adjust backslashes so they still line up. maint: update tests/init.sh from gnulib This ensures that the explanation for any skipped or failed test is printed on stderr, not buried in each .log file. * tests/init.sh: Update from gnulib. * tests/init.cfg (stderr_fileno_): Define to 9, to match the literal 2>&9 in tests/Makefile.am build: update gnulib submodule to latest 2010-04-04 Jim Meyering <meyering@redhat.com> maint: use argmatch, for better --directories=INVAL diagnostics Before, you'd see this: grep: unknown directories method Now, you'll see this: grep: invalid argument `INVAL' for `--directories' Valid arguments are: - `read' - `recurse' - `skip' Usage: src/grep [OPTION]... PATTERN [FILE]... Try `src/grep --help' for more information. * bootstrap.conf: Add argmatch. * configure.ac: Define ARGMATCH_DIE and ARGMATCH_DIE_DECL. * src/main.c (directories_type): Define. (directories_args, directories_types) Define. All of the above so we can... (main): Use XARGMATCH. (usage): Declare extern, now that argmatch calls it via ARGMATCH_DIE. 2010-04-04 Jim Meyering <meyering@redhat.com> dfa.c: const correctness; and remove useless casts of realloc and malloc * src/dfa.c (icatalloc, icpyalloc, istrstr, enlist): As above. (inboth, dfamust, comsubs): Likewise. dfa.c: use a better (unsigned) type for an index: int->unsigned int * src/dfa.c (dfaexec): Use "unsigned int" for a logically unsigned index. maint: style: use sizeof VAR, rather than sizeof TYPE, where possible * src/dfa.c (copyset, zeroset): Prefer sizeof EXPR, over sizeof TYPE, for improved readability/maintainability. (equal, parse_bracket_exp, addtok_wc, dfaparse, dfaexec): Likewise. 2010-04-02 Jim Meyering <meyering@redhat.com> dfa.c: use a better (unsigned) type for an index: int->size_t * src/dfa.c (parse_bracket_exp): Use size_t as type of index, not int. maint: const-correctness * src/dfa.c (tstbit, copyset, equal, charclass_index): Declare read-only "charclass" parameters to be "const". No semantic change. maint: include <wchar.h> and <wctype.h> unconditionally * src/main.c: Include <wchar.h> and <wctype.h> unconditionally. Their presence/usefulness are assured by gnulib. * src/dfa.c: Likewise. * src/search.h: Likewise. maint: MBS_SUPPORT: define to 0/1, not undef/1 Prepare to remove many of these #ifdefs. * src/mbsupport.h (MBS_SUPPORT): Define to 0/1, not undef/1. Change each "#ifdef MBS_SUPPORT" to "#if MBS_SUPPORT". Use this: perl -pi -e 's/ifdef (MBS_SUPPORT)/if $1/' $(g grep -l ifdef.MBS_SUPPO) * src/dfa.c: s/#ifdef MBS_SUPPORT/#if MBS_SUPPORT/ * src/dfa.h: Likewise. * src/dfasearch.c: Likewise. * src/kwsearch.c: Likewise. * src/main.c: Likewise. * src/search.h: Likewise. * src/searchutils.c: Likewise. 2010-04-02 Jim Meyering <meyering@redhat.com> maint: use STREQ in place of strcmp perl -pi -e 's/\bstrcmp *\((.*?)\) == 0/STREQ ($1)/' src/main.c perl -pi -e 's/\bstrcmp *\((.*?)\) != 0/!STREQ ($1)/' src/main.c * src/dfa.c (STREQ): Define. Use it instead of strcmp. * src/main.c (STREQ): Likewise. * cfg.mk (local-checks-to-skip): Remove sc_prohibit_strcmp, to enable the strcmp-prohibition. 2010-04-02 Jim Meyering <meyering@redhat.com> maint: enable the useless_cpp_parens syntax check * cfg.mk (local-checks-to-skip): Remove sc_useless_cpp_parens. * src/main.c (devices, fillbuf, exit_on_match): Remove useless parens. (print_line_head, grepfile, set_limits, main): Likewise. * src/vms_fab.h: Likewise. * vms/config_vms.h: Likewise. * src/mbsupport.h: Likewise. cleanup and improvement: parse command line arguments consistently * src/main.c: Include c-ctype.h, for this: (prepend_args): Use c_isspace, not ISSPACE. This is important so that we parse arguments consistently, and independently of the current locale. * bootstrap.conf (gnulib_modules): Add c-ctype. * src/system.h: Remove IS* definitions here, too. * src/dfasearch.c (WCHAR): Use isalnum, not ISALNUM. * src/kwsearch.c (WCHAR): Likewise. * src/searchutils.c (kwsinit): Use tolower, not TOLOWER. cleanup: rely on gnulib's ctype.h functions; remove IS* macros and is_* * src/dfa.c (setbit_case_fold, prednames): Use official names. (IS_WORD_CONSTITUENT, lex): Likewise. (ISALNUM, ISALPHA, ISCNTRL, ISDIGIT, ISGRAPH): Remove definitions. (ISLOWER, ISPRINT, ISPUNCT, ISSPACE, ISUPPER, ISXDIGIT): Likewise. (is_alnum, is_alpha, is_blank, is_cntrl, is_digit, is_graph): Likewise. (is_lower, is_print, is_punct, is_space, is_upper, is_xdigit): Likewise. (isgraph): Likewise. build: update gnulib submodule to latest, and adjust * src/main.c (parse_grep_colors): Adjust diagnostics not to trigger the sc_error_message_period and sc_error_message_uppercase syntax-check rules. maint: remove all VMS-related code * configure.ac (AC_CONFIG_FILES): Remove vms/Makefile * Makefile.am (SUBDIRS): Remove vms. * src/Makefile.am (EXTRA_DIST): Remove vms_fab.c and vms_fab.h. * src/vms_fab.c, src/vms_fab.h, vms/make.com: Remove files. * vms/Makefile.am, vms/README, vms/config_vms.h: Likewise. post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.6.3 * NEWS: Record release date. 2010-04-02 Jim Meyering <meyering@redhat.com> grep: avoid used-undefined error with truncated multibyte input * src/dfa.c (addtok_wc): Don't use buf[0] (it's undefined) when wcrtomb returns <= 0. MBS_SUPPORT-removal: * src/dfa.c (dfastate): 2010-04-01 Jim Meyering <meyering@redhat.com> maint: avoid unnecessary 2nd getenv("TERM") * src/main.c (main): Don't call getenv("TERM") twice -- in the same expression, even. tests: remove all unportable uses of echo * src/main.c: Use printf rather than echo -ne in a comment. * tests/fedora: Use printf (not echo) also in ok/fail functions. * cfg.mk (sc_prohibit_echo_minus_en): New rule, to prohibit any future introduction. tests: add explicit requirement for en_US.UTF-8 * tests/char-class-multibyte: Use require_en_utf8_locale_, rather than open-coding it. * tests/prefix-of-multibyte: Require the locale explicitly. * tests/fgrep-infloop: Likewise. This fixes test failures that would arise on systems without that particular locale. Reported by Ludovic Courtès. tests: new function, to require an en_US UTF8 locale * tests/init.cfg (require_en_utf8_locale_): New function. tests: use printf, not echo -n, echo -e, or any combination * tests/fedora: Using printf is more portable. grep: remove unnecessary code * src/main.c (print_line_middle): Now that we use RE_ICASE (enabled in commit 70e23616, "dfa: rewrite handling of multibyte case_fold lexing"), this case-conversion code is useless and wasteful. Remove it. doc: fix typo: s/AM_V_AT/AM_V_at/ * doc/Makefile.am (egrep.1 fgrep.1): The former has case consistent with its sister variable, AM_V_GEN, but the latter is the one that actually works. doc: generated files are best made read-only, ... ...to minimize risk of accidentally modifying the generated file rather than its template. These are tiny, so no risk, but it's a good to be consistent, so generated files are easier to spot. * doc/Makefile.am (egrep.1 fgrep.1): When generating these files, ensure that they too are created read-only. doc: generate grep.1 from template * doc/Makefile.am (grep.1): New rule. (CLEANFILES): Add grep.1 to the list. * .gitignore: Add /doc/grep.1 * doc/grep.in.1: Replace hard-coded "2.5.1-cvs" with @VERSION@. Update copyright year list. Omit the line-splitting \(co directive so that update-copyright will perform future updates automatically. Egmont Koblinger reported the outdated version string and copyright year list in the man page: http://savannah.gnu.org/bugs/?29390 doc: prepare to generate grep.1 * doc/grep.1: Rename to... * doc/grep.in.1: ...this. 2010-03-31 Eric Blake <eblake@redhat.com> build: avoid another warning Noticed on cygwin: get-mb-cur-max.c: In function 'main': get-mb-cur-max.c:27: error: unused parameter 'argc' [-Wunused-parameter] * tests/get-mb-cur-max.c (main): Use argc. 2010-03-31 Paolo Bonzini <bonzini@gnu.org> tests: fix on systems with broken sh * tests/Makefile.am (TESTS_ENVIRONMENT): Adjust coreutils remnants. * tests/bre.sh: Invoke script with $SHELL if defined. * tests/ere.sh: Likewise. * tests/spencer1-locale: Likewise. * tests/spencer1.sh: Likewise. tests: improve empty test * tests/empty: Add more tests, note expected failure. tests: improve empty test with respect to locales * tests/empty: Add tests for multiple locales. grep: fix grep -F against empty string * src/searchutils.c (is_mb_middle): Do not return true for empty matches when p == buf. tests: rename empty.sh to empty * tests/empty.sh: Rename to... * tests/empty: ... this. * tests/Makefile.am (TESTS): Adjust. tests: convert empty.sh to new style * tests/empty.sh: Convert to init.sh, add 10-second timeout. tests: use get-mb-cur-max in char-class-multibyte * tests/char-class-multibyte: Use get-mb-cur-max to detect UTF-8 support. Rewrite previous locale detection code as a grep test. tests: fix -Wformat failure * tests/get-mb-cur-max (main): Cast MB_CUR_MAX to int. 2010-03-30 Jim Meyering <meyering@redhat.com> doc: add a "Reply-To" to the suggested announcement mail header * README-release: Add "Reply-To" with the list address, to minimize risk of replies to the other announcement recipients. Suggestion from Eric Blake. 2010-03-29 Jim Meyering <meyering@redhat.com> build: avoid compiler warning when building test program * tests/Makefile.am (AM_CPPFLAGS, AM_CFLAGS, AM_LDFLAGS): Define, so that all the usual C compile-and-link machinery comes into play. * tests/get-mb-cur-max.c: Include "progname.h". Remove unnecessary inclusion of <ctype.h>. Mike Frysinger reported the "implicit decl of set_program_name" warning. build: detect PCRE support also when <pcre/pcre.h> is the header * m4/pcre.m4: Also check for <pcre/pcre.h>. * src/pcresearch.c: Include <pcre/pcre.h>, if needed. Guard inclusions with HAVE_PCRE_H and HAVE_PCRE_PCRE_H, not HAVE_LIBPCRE. * NEWS (Bug fixes): Mention it. Dmitry V. Levin reported that PCRE support was not detected on systems with <pcre.h> not in the default include path. post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.6.2 * NEWS: Record release date. 2010-03-29 Eric Blake <eblake@redhat.com> build: avoid warnings on cygwin * lib/savedir.c (isdir): Avoid shadowing a declaration. * src/main.c (get_nondigit_option): Cast away const to avoid compiler warning. maint: ignore new test executable * .gitignore: Enhance. 2010-03-29 Jim Meyering <meyering@redhat.com> doc: consolidate redundant-looking entries * NEWS: Consolidate the two --include/exclude-related entries. Suggested by Eric Blake. 2010-03-29 Paolo Bonzini <bonzini@gnu.org> tests: use $(...) consistently * tests/backref.sh: Use `...' instead of ``...'' in comments. * tests/bre.awk: Use $(...) instead of `...`. * tests/ere.awk: Use $(...) instead of `...`. * tests/euc-mb: Use $(...) instead of `...`. * tests/fmbtest: Use $(...) instead of `...`. * tests/foad1: Use $(...) instead of `...`. * tests/pcre-z: Use $(...) instead of `...`. Quote output of grep. * tests/spencer1-locale.awk: Use $(...) instead of `...`. * tests/spencer1.awk: Use $(...) instead of `...`. * tests/yesno.sh: Use $(...) instead of `...`. 2010-03-29 Jim Meyering <meyering@redhat.com> build: make doc/Makefile.am cleaner and more robust * doc/Makefile.am (egrep.1 fgrep.1): Generate robustly, i.e., do not redirect directly to $@. Use $(AM_V_GEN). Do not distribute intermediate files like fgrep.man and egrep.man. Likewise, do not use them to generate their %.1 images. Instead, generate the .1 files directly. 2010-03-29 Paolo Bonzini <bonzini@gnu.org> tests: add program to detect locales * tests/Makefile.am (check_PROGRAMS): Add get-mb-cur-max. * tests/get-mb-cur-max.c: New. * tests/euc-mb: Use it. Fail if the former detection test fails. * tests/sjis-mb: Use it. Fail if the former detection test fails. Expand comments. 2010-03-29 Paolo Bonzini <bonzini@gnu.org> tests: add tests for SJIS character sets The attached test will be skipped unless (on a glibc system) you run something like mkdir /usr/lib/locale/ja_JP.SHIFT_JIS zcat /usr/share/i18n/charmaps/SHIFT_JIS.gz | \ localedef \ -f - \ -i /usr/share/i18n/locales/ja_JP \ /usr/lib/locale/ja_JP.SHIFT_JIS * tests/Makefile.am: Add sjis-mb. * tests/sjis-mb: New. 2010-03-29 Paolo Bonzini <bonzini@gnu.org> grep -F: fix a bug with SJIS character sets Commit db9d6 would erroneously skip matches in SJIS character sets. In this character set low bytes (i.e. ASCII bytes) are also valid second bytes in a double-byte character, so you have to continue looking for a match, even if you match in the middle of a double-byte character. * src/kwsearch.c: Ensure that beg is advanced by at least one byte, but do not fail immediately after matching in the middle of a double-byte character. 2010-03-28 Bruno Haible <bruno@clisp.org> build: update after change in gnulib's lib-ignore module * src/Makefile.am (AM_LDFLAGS): Define. Use gnulib's new $(IGNORE_UNUSED_LIBRARIES_CFLAGS). 2010-03-28 Jim Meyering <meyering@redhat.com> tests: disable new texinfo-acronym syntax-check from gnulib * cfg.mk (local-checks-to-skip): Add new sc_texinfo_acronym, to skip it. 2010-03-28 Norihiro Tanaka <noritnk@kcn.ne.jp> tests: exercise fix for improper match of incomplete MB char prefix * tests/prefix-of-multibyte: New file. * tests/Makefile.am (TESTS): Add it. 2010-03-28 Jim Meyering <meyering@redhat.com> grep -F: fix a multi-byte erroneous-match-in-middle bug Just as Perl prints nothing in this case, printf '\357\274\241\n' | perl -CIO -lne '/\357/ and print' grep should also print nothing when used as follows. However, these would mistakenly match with grep prior to 2.6.2: printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\357' printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\357\274' * src/searchutils.c (is_mb_middle): New parameter: the length of the match, in bytes, as determined by kwsexec. Use this to detect when the nominal match found by kwsexec must be skipped because it is for an incomplete multi-byte character that is a prefix of a character in the input. * src/dfasearch.c (EGexecute): Update caller. * src/kwsearch.c (Fexecute): Likewise. * src/search.h: Update prototype. * NEWS (Bug fixes): Mention it. Report and analysis by Norihiro Tanaka. 2010-03-28 Norihiro Tanaka <noritnk@kcn.ne.jp> tests: add tests for the fgrep-infloop bug * tests/init.cfg (require_timeout_): New function. * tests/fgrep-infloop: New file. Test for the above fix. * tests/Makefile.am (TESTS): Add it. 2010-03-28 Jim Meyering <meyering@redhat.com> grep -F: avoid infinite loop when searching for incomplete MB character Searching for an incomplete non-prefix of a multi-byte character should find no match. Just as these print nothing, printf '\357\274\241\357\274\241\n' \ | perl -CIO -ne '/\241\357/ and print' printf '\357\274\241\n' | perl -CIO -ne '/\274\241/ and print' printf '\357\274\241\n' | perl -CIO -ne '/\241/ and print' printf '\357\274\241\n' | perl -CIO -ne '/\274/ and print' These should also print nothing, but with grep-2.6 and grep-2.6.1, they would infloop: printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\241' printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\274' printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\274\241' * src/kwsearch.c (Fexecute): Don't infloop when searching for an incomplete non-prefix part of a multi-byte character. * NEWS (Bug fixes): Mention it. Reported and diagnosed by Norihiro Tanaka. 2010-03-28 Jim Meyering <meyering@redhat.com> tests: rename: fmbtest.sh -> fmbtest * tests/fmbtest.sh: Rename to ... * tests/fmbtest: ...this, dropping the .sh suffix. * tests/Makefile.am (TESTS): Reflect renaming. tests: convert fmbtest.sh to use init.sh * tests/fmbtest.sh: Use init.sh and adapt accordingly: Use "grep", not ${GREP}. Use Exit, not exit. tests: also exercise the --include + glob path * tests/include-exclude: Exercise Javier's fix. 2010-03-28 Javier Villavicencio <the_paya@gentoo.org> grep -r: fix --include with globs, too The previous fix addressed only the non-glob case. * src/main.c (main): Use add_exclude's EXCLUDE_WILDCARDS option, to enable the use of fnmatch with --include=GLOB. gnulib: Update to latest, for the fixed exclude.c. 2010-03-28 Jim Meyering <meyering@redhat.com> grep -r: fix --include with non-globs * lib/savedir.c (savedir): Fix logic error. Introduced by commit bf3bd92c, "build: adapt to the newer exclude API we now get from gnulib" * tests/include-exclude: Test for this bug by exercising --include, too. * NEWS (Bug fixes): Mention it. Reported by Philipp Kohlbecher in http://savannah.gnu.org/bugs/?29358 2010-03-27 Jim Meyering <meyering@redhat.com> kwset: correct comments; require non-NULL kwsmatch argument * src/kwset.c (kwsexec): Correct comments. This function has been returning an offset, not a pointer, for 9 years. Do not test for kwsmatch == NULL. All callers pass non-NULL. (cwexec): Likewise. * src/kwset.h (kwsexec): Mark the 4th parameter, kwsmatch, as non-NULL. Include "arg-nonnull.h". build: add -I$(top_builddir)/lib so we also find generated .h files * src/Makefile.am (AM_CPPFLAGS): Rename from INCLUDES to avoid warning from automake -Wall. Add -I$(top_builddir)/lib, so we find generated .h files like getopt.h in a non-srcdir build. build: remove superfluous LOCALEDIR definition * src/Makefile.am (INCLUDES): Remove unnecessary definition of LOCALEDIR here. Now, it's defined via gnulib's configmake.h. * src/system.h: Include "configmake.h" for its LOCALEDIR definition. grep: don't segfault upon use of --include or --exclude* options * lib/savedir.c (isdir1): Fix fatal typo: deref "dir" argument, not the global (initially-NULL) "path". Reported by Standish Parsley. * tests/include-exclude: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. 2010-03-26 Jim Meyering <meyering@redhat.com> tests: rename: foad1.sh -> foad1 * tests/foad1.sh: Rename to ... * tests/foad1: ...this, dropping the .sh suffix. * tests/Makefile.am (TESTS): Reflect renaming. tests: convert foad1.sh to use init.sh This fixes a spurious test failure when "make check" is run with certain envvars set, e.g., "make check GREP_COLOR=always" * tests/foad1.sh: Use init.sh and adapt accordingly: Use "grep", not ${GREP}. Test VERBOSE against "yes", not "1", to be consistent with init.sh. Use Exit, not exit. Reported by Nelson H. F. Beebe. tests: insulate tests from envvar settings * tests/init.cfg (vars_): Unset each envvar that can affect how grep works. This protects only those tests that have been converted to use init.sh. 2010-03-25 Eric Blake <eblake@redhat.com> maint: ignore 'make dist pdf' droppings * .gitignore: Add more exemptions. 2010-03-25 Jim Meyering <meyering@redhat.com> tests: avoid spurious test failure due to lack of a French UTF8 locale * tests/init.cfg: New file. If either $LOCALE_FR or $LOCALE_FR_UTF8 is set to "none", reset it to the empty string. Reported by Mike Frysinger and Sven Joachim. * tests/Makefile.am (EXTRA_DIST): Add init.cfg. build: do not use pkg-config to test for PCRE support * configure.ac: Do not use PKG_PROG_PKG_CONFIG or PKG_CHECK_MODULES. Do not modify CPPFLAGS; that belongs to those who invoke make. Instead, use autoconf's AC_CHECK_HEADERS and AC_SEARCH_LIBS via the new macro, gl_FUNC_PCRE, defined in... * m4/pcre.m4 (gl_FUNC_PCRE): New macro, to handle pcre-related configure-time tests. * src/Makefile.am (grep_LDADD): Use LIB_PCRE, not PCRE_LIBS. * src/pcresearch.c: Test HAVE_LIBPCRE via "#if", not "#ifdef". All other cpp tests of this symbol used "#if". Prompted by a suggestion from Bruno Haible. * NEWS (Build-related): Mention this. doc: correct and amend NEWS entries for 2.6.1 * NEWS (Bug fixes): Correct character ranges bug description. Add an example from Dmitry V. Levin. Add that the word-with-backref bug was introduced in 2.5.1. * cfg.mk (old_NEWS_hash): Update to match. post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.6.1 * NEWS: Record release date. 2010-03-25 Tony Abou-Assaleh <taa@acm.org> tests: use awk's -v option more portably * tests/spencer1-locale: Add a space between awk's "-v" option and the following VAR=value string, to avoid test failure on Mac OS X. 2010-03-25 Norihirio Tanaka <noritnk@kcn.ne.jp> dfa/grep: fix compilation with MBS_SUPPORT * src/dfa.c (cur_mb_len): Initialize to 1 and always make it available. (setbit_case_fold): Do not use wint_t in prototype if !MBS_SUPPORT. (parse_bracket_exp): Fix compilation with !MBS_SUPPORT. * src/kwsearch.c (kwsinit): Do not use mbtolower and MB_CUR_MAX if !MBS_SUPPORT. * src/searchutils.c (kwsinit): Do not refer to MB_CUR_MAX if !MBS_SUPPORT. * tests/char-class-multibyte: Skip if UTF-8 matching does not work. * tests/fmbtest.sh: Likewise. 2010-03-25 Jim Meyering <meyering@redhat.com> build: avoid warnings about unnecessary use of "return" * src/grep.c (Gcompile, Ecompile, Acompile): Do not "return X" from a function returning void, not even when X itself is a function returning void. This avoids warnings from Sun Studio 11 reported by Dagobert Michelsen. * src/egrep.c (Ecompile): Likewise. 2010-03-25 Norihirio Tanaka <noritnk@kcn.ne.jp> grep: fix printing when -w is used and regex is needed for matching * NEWS: Document bugfix. * src/dfasearch.c (EGexecute): After assess_pattern_match len, is either invalid or end-beg; jump to success. * tests/Makefile.am (TESTS): Add new test. * tests/backref-word: New. 2010-03-25 Paolo Bonzini <bonzini@gnu.org> dfa: fix single byte character ranges * src/dfa.c (in_coll_range): Fix ordering for second strcoll. Reported by Dmitry V. Levin. * tests/spencer1-locale.awk: Also test single-byte character sets. * NEWS: Add a note about this bugfix. * THANKS: Add Dmitry. 2010-03-25 Norihirio Tanaka <noritnk@kcn.ne.jp> grep: reset state after truncated or invalid multibyte sequences * src/searchutils.c (is_mb_middle): When treating an invalid sequence or a truncated multibyte character as a single byte character, reset mbstate grep: do lowercase conversion in print_line_middle only for single-byte case * src/main.c (print_line_middle): Restrict match_icase code to MB_CUR_MAX == 1. Adjust comments. 2010-03-25 Jim Meyering <meyering@redhat.com> tests: provide framework_failure_ function The shell function "framework_failure" was called in the unusual event that some fundamental test set-up operation would fail. However it was not defined. Define it, but with a trailing underscore to impinge less on the test writer's name space. Adjust all uses. * tests/init.sh (framework_failure_): New function. * tests/case-fold-backref: s/framework_failure/framework_failure_/ * tests/case-fold-char-class: Likewise. * tests/case-fold-char-range: Likewise. * tests/case-fold-char-type: Likewise. * tests/char-class-multibyte: Likewise. * tests/dfaexec-multibyte: Likewise. * tests/max-count-vs-context: Likewise. * tests/word-multi-file: Likewise. 2010-03-24 Jim Meyering <meyering@redhat.com> doc: tweak THANKS * THANKS: Update Arnold's name and address, per request. portability: use gnulib's lseek wrapper * bootstrap.conf (gnulib_modules): Use gnulib's lseek wrapper, for improved portability. lseek does not fail with ESPIPE on pipes on some systems. build: avoid link failure on Solaris 8 * bootstrap.conf (gnulib_modules): Add wctob. * NEWS (Portability): Mention this. Reported by Dagobert Michelsen in <http://sv.gnu.org/bugs/?29325>. 2010-03-24 Petr PísaÅ™ <petr.pisar@atlas.cz> doc: translate new --help message * src/main.c: Translate "after_options". 2010-03-24 Jim Meyering <meyering@redhat.com> doc: NEWS make it clear that the bug was introduced in 2.6 * NEWS: Clarify. 2010-03-24 Paolo Bonzini <bonzini@gnu.org> tests: fix char-class-multibyte * tests/char-class-multibyte: Make it pass. 2010-03-23 Jim Meyering <meyering@redhat.com> build: avoid compilation failure when MBS_SUPPORT not defined * src/dfa.c (setbit_case_fold) [!MBS_SUPPORT]: Fix curly brace mismatch. 2010-03-23 Paolo Bonzini <bonzini@gnu.org> dfa: fix sigsegv on multibyte character classes Reported by Jaroslav Å karvada <jskarvad@redhat.com>. This is unfortunate. grep needs an automatic testcase generator. * NEWS: Document bug. * THANKS: Mention reporter. * src/dfa.c (set_bit_casefold): Change type of first argument for self-documentation. (parse_bracket_exp): Fix call. * tests/Makefile.am: Add new testcase. * tests/char-class-multibyte: New testcase. 2010-03-23 Jim Meyering <meyering@redhat.com> post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.6 * NEWS: Record release date. build: avoid warnings: tell gcc and clang that dfaerror never returns * src/dfa.h (__attribute__): Define. (dfaerror): Declare with the "noreturn" attribute. * src/dfasearch.c (dfaerror): Add an unreachable use of abort. 2010-03-22 Eric Blake <eblake@redhat.com> build: fix cygwin build Portions of gnulib depend on -lintl, and cygwin does not allow lazy linking. * src/Makefile.am (LDADD): Include libraries in correct order. 2010-03-22 Paolo Bonzini <bonzini@gnu.org> grep: remove --mmap mmap is a bad idea for sequentially accessed file because it will cause a page fault for every read page. Just consider it a failed experiment, and ignore --mmap while accepting it for backwards compatibility. * configure.ac (AC_FUNC_MMAP): Remove. * doc/grep.texi (Other options): Say --mmap is ignored. * src/grep.c (mmap_option): Remove. (long_options): Do not reference it. (bufmapped, initial_bufoffset): Remove. (reset, fillbuf): Remove HAVE_MMAP code. (grepfile): Remove bufmapped reference. (usage): Say --mmap is ignored. 2010-03-22 Paolo Bonzini <bonzini@gnu.org> grep: rename files for intuitiveness * Makefile.am (libgrep_a_SOURCES, grep_SOURCES, egrep_SOURCES, fgrep_SOURCES): Adjust. * grep.c: Rename to main.c. * esearch.c: Rename to egrep.c. * fsearch.c: Rename to fgrep.c. * gsearch.c: Rename to grep.c. grep: kill GREP_PROGRAM/EGREP_PROGRAM/FGREP_PROGRAM * NEWS: Document slight semantic change. * TODO: #ifdefs are gone. * po/POTFILES.in: Update. * src/Makefile.am (grep_SOURCES, egrep_SOURCES, fgrep_SOURCES): Remove grep.c/egrep.c/fgrep.c. (noinst_LIBRARIES): Change libsearch.a to libgrep.a. (libsearch_a_SOURCES): Rename to libgrep_a_SOURCES, add grep.c (LDADD): Change libsearch.a to libgrep.a. * src/esearch.c: Add before_options and after_options. * src/fsearch.c: Likewise. * src/gsearch.c: Likewise. * src/grep.c (short_options, long_options): Remove GREP_PROGRAM special-casing. (usage): Use before_options and after_options, look at matchers. (setmatcher): Merge with install_matcher. (main): Call setmatcher (NULL) instead of install_matcher. * src/grep.h (GREP_PROGRAM): Remove. (before_options, after_options): Add. thank Eric Blake * THANKS: Add Eric Blake, who reported the warning fixed by 774d0ee. grep: libify *search.c * src/Makefile.am (libsearch_a_SOURCES): Add dfasearch.c, kwsearch.c, pcresearch.c. * src/esearch.c, src/fsearch.c, * src/gsearch.c: Only include search.h. * src/dfasearch.c (GEAcompile, EGexecute): Export. * src/kwsearch.c (Fcompile, Fexecute): Export. * src/pcresearch.c (Pcompile, Pexecute): Export. * src/search.h: Add new exported functions. grep: prepare for libification of *search.c * src/dfasearch.c (Ecompile): Remove. * src/esearch.c: Place it here... * src/gsearch.c: ... and here. grep: split search.c * po/POTFILES.in: Update. * src/Makefile.am (grep_SOURCES, egrep_SOURCES, fgrep_SOURCES): Move kwset.c and dfa.c to libsearch.a. Add searchutils.c there too. * src/search.h, src/dfasearch.c, src/pcresearch.c, src/kwsearch.c, src/searchutils.c: New files, split out of src/search.c. * src/esearch.c, src/fsearch.c: Include the new files instead of search.c. * src/gsearch.c: Likewise, plus move Gcompile/Acompile here. grep: remove one #ifdef * search.c (GEAcompile) [EGREP_PROGRAM]: Use common code. Inline IF_BK. 2010-03-22 Paolo Bonzini <bonzini@gnu.org> grep: eliminate {COMPILE,EXECUTE}_{RET,ARGS,FCT} Modern compilers warn about type mismatches. * src/grep.c (do_execute): Write full declaration. * src/grep.h (COMPILE_RET, COMPILE_ARGS, COMPILE_FCT, EXECUTE_RET, EXECUTE_ARGS, EXECUTE_FCT): Remove. (compile_fp_t, execute_fp_t): Write full declaration. * src/search.c (GEAcompile, Gcompile, Acompile, Ecompile, EGexecute, Fcompile, Fexecute, Pcompile, Pexecute): Write full declaration. 2010-03-22 Paolo Bonzini <bonzini@gnu.org> grep: make egrep/fgrep use struct matcher * Makefile.am (grep_SOURCES): Add gsearch.c. (EXTRA_DIST): Add search.c. * esearch.c (matchers): New. * fsearch.c (matchers): New. * gsearch.c: New. * search.c (matchers): Remove. * grep.c: Always compile most !GREP_PROGRAM sections. (main): Use first matcher if none is explicitly provided. Remove "default" matcher. * grep.h (struct matcher): Adjust comments. grep: change struct matcher termination * src/grep.c (setmatcher): Look for NULL matchers[i].name. * src/grep.h (struct matcher): Change name to pointer. Adjust comments. * src/search.c (matchers): Terminate with three NULLs. grep: remove one #ifdef * search.c (Ecompile): Always go through GEAcompile to use same code path for both grep and egrep. grep: remove getpagesize.h * src/getpagesize.h: Remove. * src/Makefile.am (noinst_HEADERS): Remove getpagesize.h. 2010-03-21 Jim Meyering <meyering@redhat.com> build: use the fcntl-h module, not "fcntl" * bootstrap.conf (gnulib_modules): We might need fcntl.h somewhere, but don't use the fcntl function. Reported by Bruno Haible. build: avoid link failure on systems using gnulib's fcntl but not open * bootstrap.conf (gnulib_modules): Using gnulib's fcntl module and including <fcntl.h>, but not also using gnulib's "open" module would result in link failure due to references to rpl_open on systems requiring the replacement (e.g., Cygwin and Darwin). build: avoid compilation failure on systems using rpl_open This new build failure has arisen as a result of using gnulib's "fcntl" module. Now that an inadequate "open" syscall is replace by gnulib's wrapper, it is essential to include <fcntl.h>. * src/grep.c: Include <fcntl.h>. This is required, for grepfile's use of open, at least on Cygwin and Darwin. maint: use gnulib's fcntl module, just in case * bootstrap.conf (gnulib_modules): Add fcntl. Grep uses at least O_BINARY, which may be defined therein. maint: remove TYPE_* definitions from src/system.h * src/system.h (TYPE_MAXIMUM, TYPE_MINIMUM, TYPE_SIGNED): Remove definitions. They are provided by intprops.h. * src/grep.c: Include "intprops.h" * bootstrap.conf (gnulib_modules): Add intprops. maint: alphabetize #include directives * src/grep.c: Alphabetize #include directives. 2010-03-20 Jim Meyering <meyering@redhat.com> build: stop using gnulib's memmove module * bootstrap.conf (gnulib_modules): Remove obsolete module: memmove build: reinstate gnulib's fcntl-h-tests * bootstrap.conf (gnulib_tool_option_extras): Do not avoid the fcntl-h-tests. I cannot reproduce the failure. 2010-03-20 Eric Blake <eblake@redhat.com> build: allow compilation on cygwin Gnulib is incompatible with -Wunused-macros. Addtionally, cygwin 1.7.1 coupled with --enable-gcc-warnings tripped on: grep.c: In function 'print_line_middle': grep.c:805: error: array subscript has type 'char' [-Wchar-subscripts] grep.c: In function 'main': grep.c:1833: error: 'optarg' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] grep.c:1834: error: 'optind' redeclared without dllimport attribute after being referenced with dll linkage * configure.ac (GNULIB_WARN_FLAGS): Disable -Wunused-macros. * src/grep.c (print_line_middle): Use correct type to tolower. (main): Drop useless redeclarations. * .gitignore: Ignore more built files. 2010-03-20 Jim Meyering <meyering@redhat.com> tests: ensure that all programs handle [b-a] consistently * tests/reversed-range-endpoints: New test. * tests/Makefile.am (TESTS): Add it. 2010-03-20 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest This pulls in the latest regex module from gnulib, including a fix to make it honor the RE_NO_EMPTY_RANGES syntax bit. tests: temporarily disable irrelevant-to-grep failing C++ fcntl-h-tests * bootstrap.conf (gnulib_tool_option_extras): Temporarily add --avoid=fcntl-h-tests, until the C++ part of that test is fixed. 2010-03-20 Jim Meyering <meyering@redhat.com> reject reversed-endpoint ranges, with all regex variants * src/search.c: Add RE_NO_EMPTY_RANGES to the syntax bits in three places, so that all of grep, egrep, and grep -E reject a range with reversed endpoints like '[b-a]'. This is required, when using the latest version of gnulib's regex module, since it now honors the RE_NO_EMPTY_RANGES flag, rather than acting as if it were always set. Based on a change by Matthew Burgess. 2010-03-19 Jim Meyering <meyering@redhat.com> maint: correct macro parameter parentheses * src/dfa.c (FETCH_WC, FETCH): Parenthesize macro parameters. 2010-03-19 Paolo Bonzini <bonzini@gnu.org> tests: change help-version to per-program functions * help-version: Change each *_args variable to a *_setup function. dfa: fix wchar_t/wint_t type mismatch * src/dfa.c (FETCH_WC): Pass a local wchar_t variable to mbrtowc. (FETCH): Rename temporary second argument to FETCH_WC. (parse_bracket_exp): Always use FETCH_WC. 2010-03-19 Jim Meyering <meyering@redhat.com> doc: add README-prereq, referenced from README-hacking * README-prereq: New file. Cloned from coreutils, s/coreutils/grep/ Reported by Tony Abou-Assaleh. 2010-03-19 Arnold Robbins <arnold@skeeve.com> maint: sync dfa comments from gawk * src/dfa.h (struct dfa) [newlines]: Amend comment. * src/dfa.c: Update copyright year list to include gawk's. 2010-03-17 Jim Meyering <meyering@redhat.com> maint: remove obsolete "cvs-clean" make target * Makefile.am (cvs-clean): Remove obsolete target. 2010-03-17 Paolo Bonzini <bonzini@gnu.org> dfa: initialize struct mbcset using memset * src/dfa.c (parse_bracket_exp): Use memset to initialize workmbc. dfa: spell out "unsigned int" * dfa.c (setbit, tstbit, clrbit, setbit_case_fold, lex, dfaoptimize, free_mbdata): Put "int" after unsigned. * dfa.h (struct position, struct dfa): Likewise. 2010-03-17 Paolo Bonzini <bonzini@gnu.org> dfa: optimize simple character sets under UTF-8 charsets Only use a bitset when possible without involving MBCSET. Testcase: yes 'the quick brown fox jumps over the lazy dog' | sed 100000q | \ time grep -c [ABCDEFGHIJKLMNOPQRSTUVWXYZ,] Before: 51ms (best of three runs); after: 16ms(best of three runs). * src/dfa.c (parse_bracket_exp): For simple bracket expressions under UTF-8, use a CSET. 2010-03-17 Paolo Bonzini <bonzini@gnu.org> dfa: speed up handling of brackets This patch has two sides. One is to fold the parsing of brackets in the single- and multi-byte cases. The second is to leverage this change, and use a bitset to test for single-byte characters in the charset. Splitting the two would be very hard. Testcase: yes 'the quick brown fox jumps over the lazy dog' | sed 100000q | \ time grep -c [ABCDEFGHIJKLMNOPQRSTUVWXYZ,] Before: 59ms (best of three runs); after: 51ms (best of three runs). Nice, but mostly providing infrastructure for the next patch. * src/dfa.c (setbit_case_fold): Try applying towlower/towupper. (looking_at): Remove. (FETCH_WC): New. (fetch_wc): Merge into FETCH_WC [MBS_SUPPORT]. (FETCH) [MBS_SUPPORT]: Call FETCH_WC. (prednames, find_pred, is_blank and other predicates): Move above, remove K&R syntax support. (parse_bracket_exp): New name of parse_bracket_exp_mb, rewritten to include single-byte character set parsing of brackets. (lex): Adjust for fetch_wc->FETCH_WC change, remove single-byte character set parsing of brackets. (match_mb_charset): Test against work_mbc->cset. * src/dfa.h (struct mb_char_classes): Add cset. 2010-03-17 Paolo Bonzini <bonzini@gnu.org> syntax-check: remove space-tab exception * .x-sc_space_tab: Remove. * src/dfa.c: Fix space-tab occurrence. THANKS: fix Jim Meyering's email address * THANKS: Jim is now with Red Hat. dfa: add missing function * src/dfa.c (using_utf8): New. (addtok_wc, free_mbdata, dfaoptimize) [!MBS_SUPPORT]: Do not define. (dfacomp) [!MBS_SUPPORT]: Do not call dfaoptimize. tests: fix typo * fedora: Fix typo. tests: use Exit * euc-mb: exit with "Exit 0". grep: remove more register keywords * dosbuf.c: Remove register keywords. * grep.c: Remove register keywords. * kwset.c: Remove register keywords. * search.c: Remove register keywords. 2010-03-17 Paolo Bonzini <bonzini@gnu.org> dfa: run simple UTF-8 regexps as a single-byte character set This provides a speedup whenever fgrep is "almost" sufficient but not quite (e.g. grep ^abc). This affects test cases such as https://savannah.gnu.org/bugs/?29117, which are already worked around by the line-by-line matching patch c32c04; without that patch the speedup can reach 1000x even on non-contrived testcases. * src/dfa.c (dfaoptimize): New. (dfacomp): Call it. 2010-03-17 Paolo Bonzini <bonzini@gnu.org> tests: fix syntax-check failures * tests/case-fold-backref: Use "foo" instead of "the". * tests/dfaexec-multibyte: Remove trailing blanks. 2010-03-17 Paolo Bonzini <bonzini@gnu.org> grep: remove check_multibyte_string, fix non-UTF8 missed match Avoid computing ahead something that can be computed lazily as efficiently (or more efficiently in the case of UTF-8, though this is left as TODO). At the same time, "soften" the rejection condition for matching in the middle of a multibyte sequence to fix bug 23814. Multibyte "grep -i" would still be very slow if it wasn't for the workaround patch c32c042 (grep: match multibyte charsets line-by-line when using -i, 2010-03-08). * NEWS: Document bugfix. * src/search.c (check_multibyte_string): Rewrite as... (is_mb_middle): ... this. (EGexecute, Fexecute): Adjust. * tests/Makefile.am (TESTS): Add euc-mb. * tests/euc-mb: New testcase. 2010-03-17 Paolo Bonzini <bonzini@gnu.org> dfa: cache MB_CUR_MAX for dfaexec * src/dfa.c (state_index, dfaexec): Use d->mb_cur_max. (dfainit): Initialize it. (free_mbdata): New, extracted out of dfafree. (dfafree): Use it. dfa: improve documentation of struct dfa * src/dfa.h (struct dfa): Reword some comments. tests: factor name of output files into a variable * tests/case-fold-backref, tests/case-fold-char-class, tests/case-fold-char-range, tests/case-fold-char-type, tests/dfaexec-multibyte: Use a variable for the output filename, as it is common to the grep and compare invocations. tests: use different output files to simplify reading failed .log files * tests/case-fold-backref, tests/case-fold-char-class, tests/case-fold-char-range, tests/case-fold-char-type: Use a different name for each output file from grep. * tests/dfaexec-multibyte: Likewise, and merge some grep invocations. tests: add another grep -i testcase, from bug 16179 * tests/case-fold-backref: New. * tests/Makefile.am (TESTS): Add it. 2010-03-16 Paolo Bonzini <bonzini@gnu.org> dfa: rewrite handling of multibyte case_fold lexing Let dfacomp do the folding to lowercase of multibyte input strings, and remove it from grep.c. Input strings to kwset.c are still folded outside kwset.c, so we still need to do mbtolower in search.c. * NEWS: Document bugfixes. * .x-sc_cast_of_argument_to_free: Remove. * src/dfa.c (wctok, addtok_wc): New. (cur_mb_index, update_mb_len_index): Remove. (FETCH): Do not call it. (parse_bracket_exp_mb) [GREP]: Disable case-folding of ranges and characters. (addtok): Extract part to... (addtok_mb): ... this new function. (lex): Call fetch_wc in the main loop for MB_CUR_MAX > 1. Return WCHAR for normal characters if MB_CUR_MAX > 1. (atom): Handle WCHAR instead of treating multibyte characters specially. Do case folding of multibyte characters here. (dfacomp): Remove case_fold special casing. * src/dfa.h (WCHAR): New. * src/grep.c (mb_icase_keys): Remove. (main): Do not call it. * src/search.c (kwsinit): Init transition table only for MB_CUR_MAX == 1. (mbtolower): New. (kwsincr_case): New. (kwsmusts): Call it instead of kwsincr. (check_multibyte_string): Remove. (check_multibyte_string_no_icase): Rename to check_multibyte_string. (GEAcompile, EGexecute, Fcompile): Use mbtolower instead of the old check_multibyte_string. * tests/Makefile.am (TESTS): Add case-fold-backslash-w. * tests/foad1.sh: Enable fixed tests. * tests/case-fold-backslash-w: New. 2010-03-16 Paolo Bonzini <bonzini@gnu.org> grep: match multibyte charsets line-by-line when using -i The turtle combination -i + MB_CUR_MAX>1 requires case conversion ahead of time. Avoid doing this repeatedly when many matches succeed. Together with the previous changes, this fixes https://savannah.gnu.org/bugs/?29117 and https://savannah.gnu.org/bugs/?14472. * NEWS: Document new speedup. * src/grep.c (do_execute): New. (grepbuf): Use it. 2010-03-15 Paolo Bonzini <bonzini@gnu.org> dfa: fix handling of ranges in multibyte character sets * src/dfa.c (parse_bracket_exp_mb): Add separate ranges for lowercase and uppercase endpoints if folding case. * tests/Makefile.am (TESTS): Add case-fold-char-range. * tests/case-fold-char-range: New. tests: add more UTF-8 test cases * tests/Makefile.am (TESTS): Add spencer1-locale. (EXTRA_DIST): Add spencer1-locale.awk. * tests/spencer1-locale.awk: New. * tests/spencer1-locale: New. 2010-03-15 Jim Meyering <meyering@redhat.com> tests: complete the renaming fedora.sh -> fedora * tests/Makefile.am (TESTS): Rename fedora.sh -> fedora here, too. 2010-03-15 Jim Meyering <meyering@redhat.com> * tests/fedora.sh: Rename to... * tests/fedora: ...this, to reflect new convention: Use the lack of a suffix to indicate we've converted to the new init.sh-using test framework. tests: adjust fedora.sh to handle traps more portably 2010-03-15 Jim Meyering <meyering@redhat.com> tests: adjust fedora.sh to handle traps more portably * tests/fedora.sh: Use "Exit", not "exit". tests: for each test, set an envvar to its name * tests/Makefile.am (TESTS_ENVIRONMENT): Set GREP_TEST_NAME for each test. This is used to help make the output of hundreds of independent, often-parallel valgrind runs more manageable. 2010-03-14 Jim Meyering <meyering@redhat.com> tests: clean up fedora.sh * tests/fedora.sh: Use "grep", not ${GREP}. Use init.sh. Use timeout 10, not sleep 1 (three times). The latter would always sleep for 3 seconds, and the test would fail with a false positive on a slow system or with a heavily instrumented (valgrind) executable. 2010-03-12 Jim Meyering <meyering@redhat.com> build: avoid build failure with --enable-gcc-warnings * src/dfa.c: Don't include <assert.h>, now that it is not used. [DEBUG]: Remove #ifdef block. 2010-03-12 Paolo Bonzini <bonzini@gnu.org> syntax-check: enable space-tab * cfg.mk (local-checks-to-skip): Enable space-tab. * .x-sc_space_tab: Add exceptions. * tests/status.sh: Fix occurrence. syntax-check: enable m4-quote-check * cfg.mk (local-checks-to-skip): Enable m4-quote-check. * configure.ac: Fix occurrence. syntax-check: enable makefile-TAB-only-indentation * cfg.mk (local-checks-to-skip): Enable makefile-TAB-only-indentation. * Makefile.am: Fix only occurrence. grep: fix error-message-uppercase * cfg.mk (local-checks-to-skip): Enable error-message-uppercase. * src/dfa.c (parse_bracket_exp_mb, lex, dfaparse): Fix occurrences. * src/search.c (Pcompile, Pexecute): Fix occurrences. dfa, grep: cleanup if-before-free and cast-of-argument-to-free * .x-sc_avoid_if_before_free: Remove. * .x-sc_cast_of_alloca_return_value: Remove. * .x-sc_cast_of_x_alloc_return_value: Remove. * .x-sc_cast_of_argument_to_free: Temporarily add src/search.c. * cfg.mk (local-checks-to-skip): Remove sc_cast_of_argument_to_free. * src/dfa.c (ifree): Remove. (dfamust, build_state, transit_state, dfafree): Do not do if-before-free, do not cast free argument to ptr_t or char *. (freelist): Call free instead of ifree. * src/dfa.h (ptr_t): Remove. 2010-03-12 Paolo Bonzini <bonzini@gnu.org> dfa: remove CRANGE dead code The only use of CRANGE was removed by commit 193830d. In theory it is more correct to do what CRANGE did, but in practice it seems like it did not work. * src/dfa.h (token): Remove CRANGE. * src/dfa.c (atom): Do not handle CRANGE. (prtok): Likewise. 2010-03-12 Paolo Bonzini <bonzini@gnu.org> dfa: get rid of x*alloc * src/dfa.c: Include xalloc.h. (xmalloc, xrealloc, xcalloc): Remove. grep: cleanup one const cast * src/search.c (GEAcompile): Do not reuse motif when operating on the (const) pattern, so we can make it non-const. Remove cast from free. kwset/system: remove ptr_t * src/kwset.h: Declare kwset using an incomplete struct type. * src/system.h (ptr_t): Remove. 2010-03-12 Jim Meyering <meyering@redhat.com> tests: add test cases for dfaexec bug * tests/dfaexec-multibyte: New test. * tests/Makefile.am (TESTS): Add it. Reported by Paolo Bonzini in http://bugzilla.redhat.com/544407 and http://bugzilla.redhat.com/544406 . 2010-03-12 Jim Meyering <meyering@redhat.com> dfa: manually merge gawk's dfaexec * src/dfa.c (dfaexec): Adjust API: return pointer, not offset, and take an "end" pointer parameter, rather than integral "size". Adjust comment accordingly. (build_state): Maintain d->newlines. (copytoks): Update multibyte_prop indices. (SKIP_REMAINS_MB_IF_INITIAL_STATE): Update a cast. Return NULL, rather than (size_t) -1. (realloc_trans_if_necessary): Realloc d->newlines. * src/dfa.h (struct dfa): New member, "newlines". (struct dfa) [GAWK]: New member, "broken". (dfaexec): Update prototype and copy the new comment from dfa.c. dfa: make search.c use the new dfaexec API * src/search.c: Adjust to new dfaexec API. Now, dfaexec returns a pointer, not an integer, and the third parameter is END, not buffer size. * src/dfa.c (dfaexec): Rewrite the function's comment. Don't just clobber *END. While doing that happens to be fine for gawk's usage, in grep, *END usually points to the first byte of the next buffer. Save the initial value, and restore it just before returning. * src/dfa.h (dfaexec): Update comment; include parameter names. 2010-03-12 Jim Meyering <meyering@redhat.com> dfa: appease static analyzers * src/dfa.c (transit_state_singlebyte): Call abort rather than returning in a "can't happen" scenario. This stops clang from emitting a false-positive report (I think it was used-uninitialized) about a caller. 2010-03-11 Jim Meyering <meyering@redhat.com> dfa: do not accept [[:UPPER:]] or [[:LOWER:]] internally * src/dfa.c (parse_bracket_exp_mb): Those class names are not valid, and rejected elsewhere, so there is no point in allowing upper or mixed-case versions here. 2010-03-11 Jim Meyering <meyering@redhat.com> maint: remove a trailing space * src/search.c (EXECUTE_FCT): Remove trailing space. maint: remove all uses of PARAMS Remove most with this: git grep -lw PARAMS |xargs perl -pi -e 's/\bPARAMS *\((.*)\);/$1;/' Remove the remainder manually. 2010-03-11 Jim Meyering <meyering@redhat.com> maint: remove all uses of PARAMS * lib/savedir.h (PARAMS): Remove definitions manually. Remove the remaining ones via this command: git grep -l define.PARAMS |xargs perl -ni -e '/define PARAMS/ or print' * src/dfa.h (PARAMS): Remove definitions. * src/system.h (PARAMS): Likewise. Remove most uses with this: git grep -lw PARAMS |xargs perl -pi -e 's/\bPARAMS *\((.*)\);/$1;/' Remove the remainder manually. maint: remove now-useless prototypes * src/dfa.c: Remove the prototype of each static, non-recursive function whose definition precedes first use. grep: plug an inconsequential leak * src/grep.c (main): Plug a leak: free "keys". grep: avoid useless allocations for empty GREP_OPTIONS * src/grep.c (prepend_default_options): Ignore GREP_OPTIONS when it's empty, not just when it's undefined. There are still relatively harmless leaks when GREP_OPTIONS is set and non-empty. We'll address those, eventually. 2010-03-09 Jim Meyering <meyering@redhat.com> build: record build-from-clone tool requirements * bootstrap.conf (buildreq): This makes bootstrap fail with a clear explanation of the problem. Otherwise, you'd get into the build process and fail with something far more cryptic. dfa: remove a trailing blank * src/dfa.c (dfaexec): No trailing blanks allowed. dfa: sync a tiny change from gawk * src/dfa.c (state_index) [MBS_SUPPORT]: Initialize .mpbs.nelem member unconditionally. Also initialize .mbps.elems. dfa: avoid a leak (work_mbc->chars) * src/dfa.c (parse_bracket_exp_mb): Remove useless (and leaked MALLOC). doc+bootstrap: document build-from-git-clone process * bootstrap: Update from coreutils/gnulib. * README-hacking: New file, nearly identical to the one in coreutils. 2010-03-08 Paolo Bonzini <bonzini@gnu.org> more work on TODO * TODO: More work on the first section. Use clearer section headers. 2010-03-08 Reuben Thomas <rrt@sc3d.org> bring TODO up-to-date * TODO: merge with TODO section of http://www.gnu.org/software/grep/devel.html and remove done items. Some small bits of tidying also. 2010-03-07 Paolo Bonzini <bonzini@gnu.org> simplify parsing of [a-z] * src/dfa.c (in_coll_range): New. (lex): Use it instead of regcomp/regexec. Small refactoring in src/dfa.c * src/dfa.c (parse_bracket_exp_mb): Return MBCSET. (lex): Assign return value of parse_bracket_exp_mb to lasttok, return it. use do...while(0) idiom * dfa.c (FETCH): Wrap with do...while(0). 2010-03-06 Paolo Bonzini <bonzini@gnu.org> extract common code from if/else * dfa.c (dfaexec): Simplify logic for MB_CUR_MAX > 1 case. remove register variable hacks * dfa.c (dfaexec): We can extract the address of a variable without fearing performance problems, modern compilers know better. remove register keywords * dfa.c (dfaexec): Modern compilers just ignore it. allow grep -Pz * NEWS: Document grep -P improvements. * src/search.c (Pcompile): Remove restriction on grep -Pz. * tests/pcre-z: New. * tests/Makefile.am (TESTS): Add pcre-z. fix cross-line matching in PCRE backend * search.c (Pexecute): Split the buffer in lines and match each line separately. * tests/fedora.sh: Add regression testsuite. fix formatting of NEWS * NEWS: fix formatting of 2.6 entries. fix a bug in handling of -i and character type * dfa.c (parse_bracket_exp_mb): Convert [[:lower:]] and [[:upper]] to [[:alpha:]] when folding case. * tests/case-fold-char-type: New file. Test for the bug. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. fix previous test case change * tests/case-fold-char-class: Do not reset fail to 0 after first test. 2010-03-06 Mike Frysinger <vapier@gentoo.org> grep(1) man page: touchup --label option * doc/grep.1 (--label): Don't italicize ending period. Point to -H option. 2010-03-06 Paolo Bonzini <bonzini@gnu.org> augment case-fold-char-class test case * tests/case-fold-char-class: Test matching lowercase against uppercase as well as vice versa. 2010-03-05 Reuben Thomas <rrt@sc3d.org> doc: improve the discussion of PCRE * doc/grep.1: Add a sentence about Perl regular expressions, and point to pcresyntax(3) and pcrepattern(3). * doc/grep.texi: Likewise. 2010-03-05 Jim Meyering <meyering@redhat.com> maint: dfa-sync: comment and dead-to-grep code: no semantic change * src/dfa.c: Sync a comment and some #ifdef GAWK code. maint: dfa-sync: don't malloc zero * src/dfa.c (dfacomp): Skip case_fold logic when length is zero. This probably "no semantic change", but does improve efficiency in a degenerate case. maint: dfa-sync: use CALLOC rather than equiv. MALLOC+initialize-loop * src/dfa.c (dfaanalyze): Sync from gawk. No semantic change. dfa.c: add support for \s and \S * src/dfa.c (lex): Sync from gawk's dfa.c. maint: dfa-sync: add omitted array initializer * src/dfa.c (prednames): Add a "0" to final initializer. No semantic change. fix a bug in handling of -i and character classes * dfa.c (parse_bracket_exp_mb): Sync one part of this function from gawk's dfa.c, which was patched by Arnold D. Robbins. * tests/case-fold-char-class: New file. Test for the bug. * tests/Makefile.am (TESTS): Add it. (TESTS_ENVIRONMENT): Propagate LOCALE_FR and LOCALE_FR_UTF8 definitions into tests. * NEWS (Bug fixes): Mention it. 2010-03-05 Paolo Bonzini <pbonzini@redhat.com> Fedora Grep regression test suite * tests/Makefile.am (TESTS): Add fedora.sh. (CLEANFILES): Add several new files. * tests/fedora.sh: New file, originally by Lubomir Rintel but somewhat rewritten to avoid bashisms. 2010-03-05 Paolo Bonzini <bonzini@gnu.org> convert AUTHORS file to UTF-8 * AUTHORS: Convert to UTF-8. eliminate invalid "ptr += (ptr2 - ptr1)" * lib/savedir.c (savedir): new_name_space and name_space do not point into the same object, so computing their difference is invalid. Similarly, summing the difference to namep is invalid because namep and the result point into different objects. Avoid this. fix for bug 21276 * lib/savedir.c (isdir1): Use realloc instead of calloc. Remove dead code. (savedir): Do not leak name_space if allocation of new_name_space fails. 2010-03-04 Jim Meyering <meyering@redhat.com> tests: add a test based on an example from Paolo Bonzini * tests/word-multi-file: New test. * tests/Makefile.am (TESTS): Add it. doc: document release procedure * README-release: New file. build: update gnulib submodule to latest 2010-02-22 Paolo Bonzini <bonzini@gnu.org> add --group-separator=FOO and --no-group-separator * src/grep.c (group_separator): New. (long_options): Add --group-separator=FOO and --no-group-separator. (prtext): Print group_separator instead of SEP_STR_GROUP. Optionally suppress the separator altogether. (main) Handle GROUP_SEPARATOR_OPTION. * doc/grep.texi (Context control): Document it. * NEWS: Mention it. * tests/yesno.sh: Add testcases. 2010-02-21 Jim Meyering <meyering@redhat.com> tests: don't use "echo -n" * tests/foad1.sh: Use printf, not echo -n. The latter is not portable. Reported by Daniel Richman. 2010-02-08 Jim Meyering <meyering@redhat.com> remove useless DJGPP-specific code * src/grep.c (grepfile): Remove now-useless DJGPP-specific code. Now, all S_IS* macros are guaranteed to be defined via gnulib. 2010-02-07 Jim Meyering <meyering@redhat.com> tests: add help-version sanity tests from coreutils * tests/help-version: New test, from coreutils. * tests/Makefile.am (TESTS): Add it. (TESTS_ENVIRONMENT) [built_programs]: Define it. tests: correct TESTS_ENVIRONMENT's PATH setting * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH to start with $(abs_top_builddir)/src, so that we test the programs we've just built. grep: use the correct exit status (2) upon write failure, not 1 * src/grep.c (main): Initialize exit_failure to EXIT_TROUBLE. * NEWS (Bug fixes): Mention this fix. maint: enable the prohibit_magic_number_exit syntax check * cfg.mk (local-checks-to-skip): Remove sc_prohibit_magic_number_exit, to enable that check. * src/system.h (EXIT_TROUBLE): Define. * src/grep.c: Use symbolic names, EXIT_SUCCESS, EXIT_FAILURE, and EXIT_TROUBLE, not 0, 1, 2. * src/search.c: Likewise. * src/vms_fab.c (string): Likewise. 2010-02-04 Jim Meyering <meyering@redhat.com> doc: adjust NEWS item * NEWS: Correct a description. 2010-02-03 Jim Meyering <meyering@redhat.com> tests: exercise surprising -m1 vs. --context behavior * tests/max-count-vs-context: New test. Exercise the surprising, but documented, behavior reported by Markus Jochim in http://savannah.gnu.org/bugs/?28588. * tests/Makefile.am (TESTS): Add it. tests: use init.sh from gnulib * tests/init.sh: New file, from gnulib. * tests/Makefile.am (EXTRA_DIST): Add it. (TESTS_ENVIRONMENT): Add variables and features. (VERBOSE): Define. maint: remove unused Makefile rule * tests/Makefile.am (dist-hook): Remove rule. No longer needed. maint: adjust formatting in tests/Makefile.am * tests/Makefile.am (TESTS, CLEANFILES): Align and sort. build: avoid warnings in gnulib-supplied regex files Now that we enable more warnings in lib/, we choose to avoid some via patches applied by bootstrap, using files in the gl/ hierarchy. Other, less-important warnings are avoided simply by turning off the -Wold-style-definition option and using a slightly relaxed set of warnings $(GNULIB_WARN_CFLAGS) in lib/. * gl/lib/regcomp.c.diff: Avoid warnings. * gl/lib/regex_internal.c.diff: Likewise. * gl/lib/regex_internal.h.diff: Likewise. * gl/lib/regexec.c.diff: Likewise. * configure.ac (GNULIB_PORTCHECK): Disable only -Wold-style-definition. * lib/Makefile.am (AM_CFLAGS): Use $(GNULIB_WARN_CFLAGS) rather than the slightly more strict $(WARN_CFLAGS). tests: adjust spencer #37 to pass with gnulib's regex code * tests/spencer1.tests: Change #37 to expect an exit status of 2, not 1. grep 'a[b-a]' reports "Invalid range end". maint: use regex from gnulib, rather than our bit-rotting one * bootstrap.conf (gnulib_modules): Add regex. * configure.ac: Don't use jm_INCLUDED_REGEX. Update use of cache variable. * lib/regex.c: Remove file. * lib/regex.h: Likewise. * m4/regex.m4: Likewise. * POTFILES.in: Update to match. build: update gnulib submodule to latest 2010-01-28 Jim Meyering <meyering@redhat.com> maint: update to latest gnulib; adjust cfg.mk * gnulib: Update submodule to latest. * cfg.mk (old_NEWS_hash): Update to reflect NEWS Copyright line change. 2010-01-06 Jim Meyering <meyering@redhat.com> maint: avoid old jm_* macros There were jm_* macros here, until very recently. * cfg.mk (sc_prohibit_jm_in_m4): New rule, from coreutils. maint: remove decl.m4 * m4/decl.m4: Remove unused file. maint: rely on gnulib's new isdir.h * src/grep.c: Include "isdir.h". * src/system.h: Remove declaration of isdir. build: rename local to avoid shadowing global, dfa * src/dfa.c (dfamust): Rename parameter: s/dfa/d/. build: avoid warning from -Wmissing-prototypes * src/dfa.c (match_mb_charset): Declare to be static. build: avoid shadowing warning for "link" * src/kwset.c (link): Define to kwset_link, to avoid shadowing the function. build: avoid shadowing warning for unused "rs" * src/dfa.c (transit_state): Remove dead stores; move a declaration "down". Ignore transit_state_consume_1char return value. build: avoid shadowing warnings * src/dfa.c (match_mb_charset): Rename parameter: s/index/idx/. (check_matching_with_multibyte_ops, match_anychar): Likewise. build: avoid warning about unused definition of N_ * src/dfa.c (N_): Remove unused definition. build: avoid format-string warnings * src/search.c (dfaerror): Use literal "%s" as format string. (kwsmusts, GEAcompile): Likewise. (Pcompile): Likewise. build: add configure-time --enable-gcc-warnings option; avoid warnings * bootstrap.conf (gnulib_modules): Add "manywarnings" module. * configure.ac: Add --enable-gcc-warnings, derived from code in bison. * src/Makefile.am (AM_CFLAGS): Set to $(WARN_CFLAGS) $(WERROR_CFLAGS) * lib/Makefile.am (AM_CFLAGS): Likewise, but append. build: remove now-useless -I../intl option * src/Makefile.am (INCLUDES): Remove -I../intl, now that intl is gone. maint: avoid more warnings * src/grep.c (MAX): Remove definition of unused macro. (usage): Declare with __attribute__ ((noreturn)). Split long strings into chunks of length < 509. fix a possible bug: remove errant semicolon * src/grep.c (prline): Remove erroneous semicolon-after-if-expr. maint: avoid compilation warnings * bootstrap.conf (gnulib_modules): Add ignore-value. * src/search.c (check_multibyte_string_no_icase): A variant of check_multibyte_string that does *not* convert case, and hence does not modify its BUF parameter. (check_multibyte_string): Use xcalloc in place of xmalloc+memset. Use ignore_value to ignore the return value from wcrtomb. This is ok, since we know the input is a valid upper case wide character. (Fexecute, EGexecute): Update callers of check_multibyte_string to use both it and check_multibyte_string_no_icase. maint: avoid warnings about unused fwrite return value * bootstrap.conf (gnulib_modules): Add unlocked-io. * src/system.h: Include "unlocked-io.h". maint: remove {m4,lib}/.gitignore; they were undergoing too much churn * .gitignore: Ignore all of m4/* except m4/djgpp.m4 and all of lib/* except Makefile.am, savedir.c and savedir.h. * m4/.gitignore: Remove file. * lib/.gitignore: Remove file. 2010-01-05 Jim Meyering <meyering@redhat.com> build: run gnulib's tests, too * Makefile.am (SUBDIRS): Add gnulib-tests. * gnulib-tests/Makefile.am: New file. * bootstrap.conf (bootstrap_epilogue): New function, from coreutils. (gnulib_tool_option_extras): Define. * configure.ac: Add gnulib-tests/Makefile. 2010-01-03 Jim Meyering <meyering@redhat.com> maint: record update-copyright options for this package * cfg.mk: Next time, just run "make update-copyright". 2010-01-01 Jim Meyering <meyering@redhat.com> maint: update all FSF copyright year lists to include 2010 Use this command: git ls-files |grep -vE '^(\..*|COPYING|gnulib)$' |xargs \ env UPDATE_COPYRIGHT_USE_INTERVALS=1 build-aux/update-copyright 2009-12-23 Jim Meyering <meyering@redhat.com> fix multi-byte-locale read-beyond-end-of-buffer error Avoid read-beyond-end-of-buffer errors, evoked by running this: LC_ALL=en_US.UTF-8 valgrind src/grep -f <(printf 'a\nb\n') <(echo c) Conditional jump or move depends on uninitialised value(s) at 0x78136D: __gconv_transform_utf8_internal (in /lib/libc-2.11.so) by 0x7E7232: mbrtowc (in /lib/libc-2.11.so) by 0x8055773: dfaexec (dfa.c:2816) by 0x804D7B0: EGexecute (search.c:353) by 0x804ACD8: grepbuf (grep.c:1036) by 0x804B023: grep (grep.c:1156) by 0x804B460: grepfile (grep.c:1287) by 0x804CF0D: main (grep.c:2282) Conditional jump or move depends on uninitialised value(s) at 0x7E7248: mbrtowc (in /lib/libc-2.11.so) by 0x8055773: dfaexec (dfa.c:2816) by 0x804D7B0: EGexecute (search.c:353) by 0x804ACD8: grepbuf (grep.c:1036) by 0x804B023: grep (grep.c:1156) by 0x804B460: grepfile (grep.c:1287) by 0x804CF0D: main (grep.c:2282) * src/dfa.c (dfaexec) [MBS_SUPPORT]: Do not access one byte beyond end of buffer. 2009-12-23 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest 2009-12-23 Paolo Bonzini <bonzini@gnu.org> Speed up insert. Suggested by Johan Walles <johan.walles@gmail.com> (bug 23354). * src/dfa.c (insert): Use binary search. 2009-12-23 Johan Walles <johan.walles@gmail.com> Decrease epsclosure memory usage Fixes bug 23321. * src/dfa.c (epsclosure): Make visited an array of char. 2009-12-22 Paolo Bonzini <bonzini@gnu.org> Make 'grep -1 -2' and 'grep -1v2' equivalent to grep -2 Fixes bug 12128. * src/grep.c (get_nondigit_option): Reset the buffer every time a non-digit option is found or a new argument is started. 2009-12-22 Paolo Bonzini <bonzini@gnu.org> Improve description of --label Fixes bug 22681. * doc/grep.1 (--label): Use -H in the example, improve wording. * doc/grep.texi (Output Line Prefix Control): Likewise. 2009-12-22 Paolo Bonzini <bonzini@gnu.org> Avoid using an invalid memchr result. Related to bug 13161. I cannot find a testcase, but it is better to be defensive considering that these bug were found in the past. * src/search.c (EGexecute, Fexecute): Check for memchr return values. 2009-12-11 Jim Meyering <meyering@redhat.com> build: update gnulib submodule to latest 2009-12-04 Jim Meyering <meyering@redhat.com> maint: enable prohibit_have_config_h check * cfg.mk (local-checks-to-skip): Enable sc_prohibit_have_config_h * lib/regex.c: Remove useless cpp test of HAVE_CONFIG_H. * lib/savedir.c: Likewise. * src/grep.c: Likewise. * src/kwset.c: Likewise. * src/search.c: Likewise. maint: enable cast_of_x_alloc_return_value check * cfg.mk (local-checks-to-skip): Enable sc_cast_of_x_alloc_return_value. * .x-sc_cast_of_x_alloc_return_value: * src/dfa.c (CALLOC, MALLOC, REALLOC): Remove casts. * src/dosbuf.c (undossify_input): Likewise. * src/grep.c (print_line_middle, prepend_default_options): Likewise. maint: enable cast_of_alloca_return_value check * cfg.mk (local-checks-to-skip): Enable sc_cast_of_alloca_return_value. * .x-sc_cast_of_alloca_return_value: New file. 2009-12-04 Paolo Bonzini <bonzini@gnu.org> fix "grep -Ff" on CRLF-terminated files * src/search.c (Fcompile) [HAVE_DOS_FILE_CONTENTS]: Recognize \r\n as a line terminator. fix compilation with included regex * Makefile.am (libgreputils_a_DEPENDENCIES): New. switch to pkg-config for PCRE detection * configure.ac: use pkg-config to detect PCRE * src/Makefile.am (grep_LDADD): link grep with PCRE_LIBS 2009-12-04 Jim Meyering <meyering@redhat.com> maint: remove "missing" script * missing: Remove now-unused file. maint: make .gitignore ignore more * .gitignore: Ignore more. maint: enable useless-if-before-free check * cfg.mk (local-checks-to-skip): Enable sc_avoid_if_before_free. * .x-sc_avoid_if_before_free: New file. Exempt regex.c and dfa.c, in case anyone ever tries to merge their contents with other versions. * src/grep.c (print_line_middle, grepdir): Remove useless if-before-free. * src/search.c (IF_BK, EXECUTE_FCT): Likewise. maint: enable po-check * cfg.mk (local-checks-to-skip): Enable sc_po_check. * po/POTFILES.in: Sort and update. 2009-12-03 Paolo Bonzini <bonzini@gnu.org> update gnulib, fixing missing inclusion of stdbool.h * gnulib: Update. 2009-11-30 Jim Meyering <meyering@redhat.com> maint: enable two checks * cfg.mk (local-checks-to-skip): Enable two: sc_prohibit_xalloc_without_use sc_two_space_separator_in_usage * src/grep.c (usage): Conform: use two spaces, not 1. * src/kwset.c (malloc): Define as a function-macro so that the syntax-check rule sees that we are indeed using xmalloc here. maint: enable makefile_path_separator check * cfg.mk (local-checks-to-skip): Enable sc_makefile_path_separator_check, now that the sole offender, an old po/Makefile.in.in, is gone. maint: remove now-generated file: po/Makefile.in.in * po/Makefile.in.in: Remove file, now generated via bootstrap. maint: enable makefile @...@ check * cfg.mk (local-checks-to-skip): Enable sc_makefile_check. * lib/Makefile.am (libgreputils_a_LIBADD): Use $(...), rather than anachronistic @...@ notation. * src/Makefile.am (LDADD): Likewise. * tests/Makefile.am (AWK): Remove definition. maint: enable trailing_blank check * cfg.mk (local-checks-to-skip): Enable sc_trailing_blank. * AUTHORS: Remove trailing blanks. * COPYING: Likewise. * README: Likewise. * README-alpha: Likewise. * README-boot: Likewise. * THANKS: Likewise. * TODO: Likewise. * src/dfa.c: Likewise. * src/mbsupport.h: Likewise. * tests/backref.sh: Likewise. * tests/file.sh: Likewise. * tests/options.sh: Likewise. * tests/tests: Likewise. * vms/README: Likewise. * vms/make.com: Likewise. maint: enable unmarked_diagnostics check * cfg.mk (local-checks-to-skip): Enable sc_unmarked_diagnostics * src/grep.c (fillbuf): Mark a diagnostic for translation. (reset): Likewise. maint: enable require_config_h checks * cfg.mk (local-checks-to-skip): Enable sc_require_config_h and sc_require_config_h_first. * src/dosbuf.c: Include <config.h>. * src/vms_fab.c: Likewise. * .x-sc_require_config_h: New file: list the exceptions. * .x-sc_require_config_h_first: Likewise. maint: use gnulib's progname module; enable set_program_name check * bootstrap.conf (gnulib_modules): Add progname. * src/grep.c: Include "progname.h". (program_name): Remove declaration. (main): Call set_program_name. * cfg.mk (local-checks-to-skip): Add sc_program_name. maint: enable "file system" check * cfg.mk (local-checks-to-skip): Enable sc_file_system. * lib/savedir.c (savedir): Tweak spelling. Remove trailing blanks. maint: enable immutable_NEWS check * NEWS: Move copyright to the bottom. Use the format required by release-related tools. * .prev-version: New file. * cfg.mk (old_NEWS_hash): Define. (local-checks-to-skip): Enable check: sc_immutable_NEWS. maint: disable the many failing syntax-checks * cfg.mk: New file. (local-checks-to-skip): Define to the list of disabled rules. Subsequent change-sets will enable them, one by one. build: require automake-1.11, enable silent-rules, parallel tests, xz * configure.ac (AM_INIT_AUTOMAKE): Create xz-compressed tarballs, not bzip2-compressed ones. Enable automake's silent-rules, parallel tests, and test PASS/FAIL coloring options. Use AC_CONFIG_HEADERS, not AM_CONFIG_HEADER. Quote the argument. build: use git-version-gen for inter-release version strings * configure.ac (AC_INIT): Use git-version-gen. build: add several build- and release-related gnulib modules * bootstrap.conf (gnulib_modules): Add announce-gen update-copyright do-release-commit-and-tag git-version-gen gnu-web-doc-update gnupload maintainer-makefile useless-if-before-free build: adapt to the newer closeout module from gnulib * src/grep.c: Include "exitfail.h". (main) [-q]: Set the global variable, exit_failure, rather than calling the now-removed close_stdout_set_file_name function. build: adapt to the newer exclude API we now get from gnulib * src/grep.c (main): Adapt to newer exclude.c: add EXCLUDE_WILDCARDS as the new "option" argument in calls to add_exclude and add_exclude_file. build: get more lib/* files from gnulib, adjust savedir * bootstrap.conf (gnulib_modules): Add the following: closeout exclude hard-locale isdir strtoumax. * lib/.gitignore, m4/.gitignore: Update. * lib/closeout.c, lib/closeout.h: Remove. * lib/exclude.c, lib/exclude.h: Remove. * lib/hard-locale.c, lib/hard-locale.h: Remove. * lib/strtoumax.c: Remove. * lib/isdir.c: Remove. * lib/Makefile.am: Remove here, too. * lib/savedir.c: Adapt to new exclude module: s/excluded_filename/excluded_file_name/ and remove 3rd argument. build: update gnulib submodule to latest maint: generate ChangeLog from git logs * Makefile.am (dist-hook, gen-ChangeLog): New rules. * bootstrap.conf (gnulib_modules): Add gitlog-to-changelog. Ensure that ChangeLog exists. * ChangeLog-2009: Rename from ChangeLog * ChangeLog: Remove file. * .gitignore: Add ChangeLog. maint: list gnulib modules one per line * bootstrap.conf (gnulib_modules): List them one per line. 2009-11-29 Tony Abou-Assaleh <taa@acm.org> Acknowledge new maintainers, update README-alpha * AUTHORS: new maintainers added * THANKS: same * README-alpha: change CVS references to Git ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/.tarball-version���������������������������������������������������������������0000664�0001750�0001750�00000000004�14670377426�017551� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������3.7 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/NEWS���������������������������������������������������������������������������0000664�0001750�0001750�00000140725�14670377426�015162� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������GNU grep NEWS -*- outline -*- * Noteworthy changes in release 3.7 (2021-08-14) [stable] ** Changes in behavior Use of the --unix-byte-offsets (-u) option now evokes a warning. Since 3.1, this Windows-only option has had no effect. ** Bug fixes Preprocessing N patterns would take at least O(N^2) time when too many patterns hashed to too few buckets. This now takes seconds, not days: : | grep -Ff <(seq 6400000 | tr 0-9 A-J) [Bug#44754 introduced in grep 3.5] * Noteworthy changes in release 3.6 (2020-11-08) [stable] ** Changes in behavior The GREP_OPTIONS environment variable no longer affects grep's behavior. The variable was declared obsolescent in grep 2.21 (2014), and since then any use had caused grep to issue a diagnostic. ** Bug fixes grep's DFA matcher performed an invalid regex transformation that would convert an ERE like a+a+a+ to a+a+, which would make grep a+a+a+ mistakenly match "aa". [Bug#44351 introduced in grep 3.2] grep -P now reports the troublesome input filename upon PCRE execution failure. Before, searching many files for something rare might fail with just "exceeded PCRE's backtracking limit". Now, it also reports which file triggered the failure. * Noteworthy changes in release 3.5 (2020-09-27) [stable] ** Changes in behavior The message that a binary file matches is now sent to standard error and the message has been reworded from "Binary file FOO matches" to "grep: FOO: binary file matches", to avoid confusion with ordinary output or when file names contain spaces and the like, and to be more consistent with other diagnostics. For example, commands like 'grep PATTERN FILE | wc' no longer add 1 to the count of matching text lines due to the presence of the message. Like other stderr messages, the message is now omitted if the --no-messages (-s) option is given. Two other stderr messages now use the typical form too. They are now "grep: FOO: warning: recursive directory loop" and "grep: FOO: input file is also the output". The --files-without-match (-L) option has reverted to its behavior in grep 3.1 and earlier. That is, grep -L again succeeds when a line is selected, not when a file is listed. The behavior in grep 3.2 through 3.4 was causing compatibility problems. ** Bug fixes grep -I no longer issues a spurious "Binary file FOO matches" line. [Bug#33552 introduced in grep 2.23] In UTF-8 locales, grep -w no longer ignores a multibyte word constituent just before what would otherwise be a word match. [Bug#43225 introduced in grep 2.28] grep -i no longer mishandles ASCII characters that match multibyte characters. For example, 'LC_ALL=tr_TR.utf8 grep -i i' no longer dumps core merely because 'i' matches 'İ' (U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE) in Turkish when ignoring case. [Bug#43577 introduced partly in grep 2.28 and partly in grep 3.4] A performance regression with -E and many patterns has been mostly fixed. "Mostly" as there is a performance tradeoff between Bug#22357 and Bug#40634. [Bug#40634 introduced in grep 2.28] A performance regression with many duplicate patterns has been fixed. [Bug#43040 introduced in grep 3.4] An N^2 RSS performance regression with many patterns has been fixed in common cases (no backref, and no use of -o or --color). With only 80,000 lines of /usr/share/dict/linux.words, the following would use 100GB of RSS and take 3 minutes. With the fix, it used less than 400MB and took less than one second: head -80000 /usr/share/dict/linux.words > w; grep -vf w w [Bug#43527 introduced in grep 3.4] ** Build-related "make dist" builds .tar.gz files again, as they are still used in some barebones builds. * Noteworthy changes in release 3.4 (2020-01-02) [stable] ** New features The new --no-ignore-case option causes grep to observe case distinctions, overriding any previous -i (--ignore-case) option. ** Bug fixes '.' no longer matches some invalid byte sequences in UTF-8 locales. [bug introduced in grep 2.7] grep -Fw can no longer false match in non-UTF-8 multibyte locales For example, this command would erroneously print its input line: echo ab | LC_CTYPE=ja_JP.eucjp grep -Fw b [Bug#38223 introduced in grep 2.28] The exit status of 'grep -L' is no longer incorrect when standard output is /dev/null. [Bug#37716 introduced in grep 3.2] A performance bug has been fixed when grep is given many patterns, each with no back-reference. [Bug#33249 introduced in grep 2.5] A performance bug has been fixed for patterns like '01.2' that cause grep to reorder tokens internally. [Bug#34951 introduced in grep 3.2] ** Build-related The build procedure no longer relies on any already-built src/grep that might be absent or broken. Instead, it uses the system 'grep' to bootstrap, and uses src/grep only to test the build. On Solaris /usr/bin/grep is broken, but you can install GNU or XPG4 'grep' from the standard Solaris distribution before building GNU Grep yourself. [bug introduced in grep 2.8] * Noteworthy changes in release 3.3 (2018-12-20) [stable] ** Bug fixes Some uses of \b in the C locale and with the DFA matcher would fail, e.g., the following would print nothing (it should print the input line): echo 123-x|LC_ALL=C grep '.\bx' Using a multibyte locale, using certain regexp constructs (some ranges, back-references), or forcing use of the PCRE matcher via --perl-regexp (-P) would avoid the bug. [bug introduced in grep 3.2] * Noteworthy changes in release 3.2 (2018-12-20) [stable] ** Changes in behavior The --files-without-match (-L) option now causes grep to succeed when a file is listed, instead of when a line is selected. This resembles what git-grep does. ** Bug fixes The --recursive (-r) option no longer fails on MS-Windows. [bug introduced in grep 2.11] ** Improvements An over-30x performance improvement when many 'or'd expressions share a common prefix, thanks to improvements in gnulib's dfa.c, by Norihiro Tanaka. See gnulib commits v0.1-2110-ge648401be, v0.1-2111-g4299106ce, v0.1-2117-g617a60974 An additional 3-23% speed-up when searching large files, via increased initial buffer size. grep now diagnoses stack overflow. Before grep-2.6, the included regexp code would detect it. Since 2.6, grep defaulted to using glibc's regexp, which lost that capability. * Noteworthy changes in release 3.1 (2017-07-02) [stable] ** Improvements grep '[0-9]' is now just as fast as grep '[[:digit:]]' when run in a multi-byte locale. Before, it was several times slower. ** Changes in behavior Context no longer excludes selected lines omitted because of -m. For example, 'grep "^" -m1 -A1' now outputs the first two input lines, not just the first line. This fixes a glitch that has been present since -m was added in grep 2.5. The following changes affect only MS-Windows platforms. First, the --binary (-U) option now governs whether binary I/O is used, instead of a heuristic that was sometimes incorrect. Second, the --unix-byte-offsets (-u) option now has no effect on MS-Windows too. * Noteworthy changes in release 3.0 (2017-02-09) [stable] ** Bug fixes grep without -F no longer goes awry when given two or more patterns that contain no special characters other than '\' and also contain a subpattern like '\.' that escapes a character to make it ordinary. [bug introduced in grep 2.28] grep no longer fails to build on PCRE versions before 8.20. [bug introduced in grep 2.28] * Noteworthy changes in release 2.28 (2017-02-06) [stable] ** Bug fixes When grep -Fo finds matches of differing length, it could mistakenly print a shorter one. Now it prints a longest one. [bug introduced in grep-2.26] When standard output is /dev/null, grep no longer fails when standard input is a file in the Linux /proc file system, or when standard input is a pipe and standard output is in append mode. [bugs introduced in grep-2.27] Fix performance regression with multiple patterns, e.g., for -Fi in a multi-byte locale, or for -Fw in a single-byte locale. [bugs introduced in grep-2.19, grep-2.22 and grep-2.26] ** Improvements Improve performance for -E or -G pattern lists that are easily converted to -F format. * Noteworthy changes in release 2.27 (2016-12-06) [stable] ** Bug fixes grep no longer reports a false match in a multibyte, non-UTF8 locale like zh_CN.gb18030, with a regular expression like ".*7" that just happens to match the 4-byte representation of gb18030's \uC9, the final byte of which is the digit "7". [bug introduced in grep-2.19] Unless an early-exit option like -q, -l, -L, -m, or -f /dev/null is specified, grep now reads all of a non-seekable standard input, even if this cannot affect grep's output or exit status. This works better with nonportable scripts that run "PROGRAM | grep PATTERN >/dev/null" where PROGRAM dies when writing into a broken pipe. [bug introduced in grep-2.26] grep no longer mishandles ranges in nontrivial unibyte locales. [bug introduced in grep-2.26] grep -P no longer attempts multiline matches. This works more intuitively with unusual patterns, and means that grep -Pz no longer rejects patterns containing ^ and $ and works when combined with -x. [bugs introduced in grep-2.23] A downside is that grep -P is now significantly slower, albeit typically still faster than pcregrep. grep -m0 -L PAT FILE now outputs "FILE". [bug introduced in grep-2.5] To output ':' and tab-align the following character C, grep -T no longer outputs tab-backspace-':'-C, an approach that has problems if run inside an Emacs shell window. [bug introduced in grep-2.5.2] grep -T now uses worst-case widths of line numbers and byte offsets instead of guessing widths that might not work with larger files. [bug introduced in grep-2.5.2] grep's use of getprogname no longer causes a build failure on HP-UX. ** Improvements grep no longer reads the input in a few more cases when it is easy to see that matching cannot succeed, e.g., 'grep -f /dev/null'. * Noteworthy changes in release 2.26 (2016-10-02) [stable] ** Bug fixes Grep no longer omits output merely because it follows an output line suppressed due to encoding errors. [bug introduced in grep-2.21] In the Shift_JIS locale, grep no longer mistakenly matches in the middle of a multibyte character. [bug present since "the beginning"] ** Improvements grep can be much faster now when standard output is /dev/null. grep -F is now typically much faster when many patterns are given, as it now uses the Aho-Corasick algorithm instead of the Commentz-Walter algorithm in that case. grep -iF is typically much faster in a multibyte locale, if the pattern and its case counterparts contain only single byte characters. grep with complicated expressions (e.g., back-references) and without -i now uses the regex fastmap for better performance. In multibyte locales, grep now handles leading "." in patterns more efficiently. grep now prints a "FILENAME:LINENO: " prefix when diagnosing an invalid regular expression that was read from an '-f'-specified file. * Noteworthy changes in release 2.25 (2016-04-21) [stable] ** Bug fixes In the C or POSIX locale, grep now treats all bytes as valid characters even if the C runtime library says otherwise. The revised behavior is more compatible with the original intent of POSIX, and the next release of POSIX will likely make this official. [bug introduced in grep-2.23] grep -Pz no longer mistakenly diagnoses patterns like [^a] that use negated character classes. [bug introduced in grep-2.24] grep -oz now uses null bytes, not newlines, to terminate output lines. [bug introduced in grep-2.5] ** Improvements grep now outputs details more consistently when reporting a write error. E.g., "grep: write error: No space left on device" rather than just "grep: write error". * Noteworthy changes in release 2.24 (2016-03-10) [stable] ** Bug fixes grep -z would match strings it should not. To trigger the bug, you'd have to use a regular expression including an anchor (^ or $) and a feature like a range or a back-reference, causing grep to forego its DFA matcher and resort to using re_search. With a multibyte locale, that matcher could mistakenly match a string containing a newline. For example, this command: printf 'a\nb\0' | LC_ALL=en_US.utf-8 grep -z '^[a-b]*b' would mistakenly match and print all four input bytes. After the fix, there is no match, as expected. [bug introduced in grep-2.7] grep -Pz now diagnoses attempts to use patterns containing ^ and $, instead of mishandling these patterns. This problem seems to be inherent to the PCRE API; removing this limitation is on PCRE's maint/README wish list. Patterns can continue to match literal ^ and $ by escaping them with \ (now needed even inside [...]). [bug introduced in grep-2.5] * Noteworthy changes in release 2.23 (2016-02-04) [stable] ** Bug fixes Binary files are now less likely to generate diagnostics and more likely to yield text matches. grep now reports "Binary file FOO matches" and suppresses further output instead of outputting a line containing an encoding error; hence grep can now report matching text before a later binary match. Formerly, grep reported FOO to be binary when it found an encoding error in FOO before generating output for FOO, which meant it never reported both matching text and matching binary data; this was less useful for searching text containing encoding errors in non-matching lines. [bug introduced in grep-2.21] grep -c no longer stops counting when finding binary data. [bug introduced in grep-2.21] grep no longer outputs encoding errors in unibyte locales. For example, if the byte '\x81' is not a valid character in a unibyte locale, grep treats the byte as binary data. [bug introduced in grep-2.21] grep -oP is no longer susceptible to an infinite loop when processing invalid UTF8 just before a match. [bug introduced in grep-2.22] --exclude and related options are now matched against trailing parts of command-line arguments, not against the entire arguments. This partly reverts the --exclude-related change in 2.22. [bug introduced in grep-2.22] --line-buffer is no longer ineffective when combined with -l. [bug introduced in grep-2.5] -xw is now equivalent to -x more consistently, with -P and with backrefs. [bug only partially fixed in grep-2.19] * Noteworthy changes in release 2.22 (2015-11-01) [stable] ** Improvements Performance has improved for patterns containing very long strings, reducing preprocessing time for an N-byte regexp from O(N^2) to only slightly superlinear for most patterns. Before, a command like the following would take over a minute, but now, it takes less than a second: : | grep -f <(seq -s '' 99999) When building grep, 'configure' now uses PCRE's pkg-config module for configuration information, rather than attempting to guess it by hand. ** Bug fixes A DFA matcher bug made this command mistakenly print its input line: echo axb | grep -E '^x|x$' Likewise for this equivalent command: echo axb | grep -e '^x' -e 'x$' [bug introduced in grep-2.19 ] grep no longer reads from uninitialized memory or from beyond the end of the heap-allocated input buffer. This fix addressed CVE-2015-1345. [bug introduced in grep-2.19 ] With -z, '.' and '[^x]' in a pattern now consistently match newline. Previously, they sometimes matched newline, and sometimes did not. [bug introduced in grep-2.4] When the JIT stack is exhausted, grep -P now grows the stack rather than reporting an internal PCRE error. 'grep -D skip PATTERN FILE' no longer hangs if FILE is a fifo. [bug introduced in grep-2.12] --exclude and related options are now matched against entire command-line arguments, not against command-line components. [bug introduced in grep-2.6] Fix performance degradation of grep -Fw in unibyte locales. [bug introduced in grep-2.19 ] * Noteworthy changes in release 2.21 (2014-11-23) [stable] ** Improvements Performance has been greatly improved for searching files containing holes, on platforms where lseek's SEEK_DATA flag works efficiently. Performance has improved for rejecting data that cannot match even the first part of a nontrivial pattern. Performance has improved for very long strings in patterns. If a file contains data improperly encoded for the current locale, and this is discovered before any of the file's contents are output, grep now treats the file as binary. grep -P no longer reports an error and exits when given invalid UTF-8 data. Instead, it considers the data to be non-matching. ** Bug fixes grep no longer mishandles patterns that contain \w or \W in multibyte locales. grep would fail to count newlines internally when operating in non-UTF8 multibyte locales, leading it to print potentially many lines that did not match. E.g., the command, "seq 10 | env LC_ALL=zh_CN src/grep -n .." would print this: 1:1 2 3 4 5 6 7 8 9 10 implying that the match, "10" was on line 1. [bug introduced in grep-2.19] grep -F -x -o no longer prints an extra newline for each match. [bug introduced in grep-2.19] grep in a non-UTF8 multibyte locale could mistakenly match in the middle of a multibyte character when using a '^'-anchored alternate in a pattern, leading it to print non-matching lines. [bug present since "the beginning"] grep -F Y no longer fails to match in non-UTF8 multibyte locales like Shift-JIS, when the input contains a 2-byte character, XY, followed by the single-byte search pattern, Y. grep would find the first, middle- of-multibyte matching "Y", and then mistakenly advance an internal pointer one byte too far, skipping over the target "Y" just after that. [bug introduced in grep-2.19] grep -E rejected unmatched ')', instead of treating it like '\)'. [bug present since "the beginning"] On NetBSD, grep -r no longer reports "Inappropriate file type or format" when refusing to follow a symbolic link. [bug introduced in grep-2.12] ** Changes in behavior The GREP_OPTIONS environment variable is now obsolescent, and grep now warns if it is used. Please use an alias or script instead. In locales with multibyte character encodings other than UTF-8, grep -P now reports an error and exits instead of misbehaving. When searching binary data, grep now may treat non-text bytes as line terminators. This can boost performance significantly. grep -z no longer automatically treats the byte '\200' as binary data. * Noteworthy changes in release 2.20 (2014-06-03) [stable] ** Bug fixes grep --max-count=N FILE would no longer stop reading after the Nth match. I.e., while grep would still print the correct output, it would continue reading until end of input, and hence, potentially forever. [bug introduced in grep-2.19] A command like echo aa|grep -E 'a(b$|c$)' would mistakenly report the input as a matched line. [bug introduced in grep-2.19] ** Changes in behavior grep --exclude-dir='FOO/' now excludes the directory FOO. Previously, the trailing slash meant the option was ineffective. * Noteworthy changes in release 2.19 (2014-05-22) [stable] ** Improvements Performance has improved, typically by 10% and in some cases by a factor of 200. However, performance of grep -P in UTF-8 locales has gotten worse as part of the fix for the crashes mentioned below. ** Bug fixes grep no longer mishandles patterns like [a-[.z.]], and no longer mishandles patterns like [^a] in locales that have multicharacter collating sequences so that [^a] can match a string of two characters. grep no longer mishandles an empty pattern at the end of a pattern list. [bug introduced in grep-2.5] grep -C NUM now outputs separators consistently even when NUM is zero, and similarly for grep -A NUM and grep -B NUM. [bug present since "the beginning"] grep -f no longer mishandles patterns containing NUL bytes. [bug introduced in grep-2.11] Plain grep, grep -E, and grep -F now treat encoding errors in patterns the same way the GNU regular expression matcher treats them, with respect to whether the errors can match parts of multibyte characters in data. [bug present since "the beginning"] grep -w no longer mishandles a potential match adjacent to a letter that takes up two or more bytes in a multibyte encoding. Similarly, the patterns '\<', '\>', '\b', and '\B' no longer mishandle word-boundary matches in multibyte locales. [bug present since "the beginning"] grep -P now reports an error and exits when given invalid UTF-8 data. Previously it was unreliable, and sometimes crashed or looped. [bug introduced in grep-2.16] grep -P now works with -w and -x and back-references. Before, echo aa|grep -Pw '(.)\1' would fail to match, yet echo aa|grep -Pw '(.)\2' would match. grep -Pw now works like grep -w in that the matched string has to be preceded and followed by non-word components or the beginning and end of the line (as opposed to word boundaries before). Before, this echo a@@a| grep -Pw @@ would match, yet this echo a@@a| grep -w @@ would not. Now, they both fail to match, per the documentation on how grep's -w works. grep -i no longer mishandles patterns containing titlecase characters. For example, in a locale containing the titlecase character 'Lj' (U+01C8 LATIN CAPITAL LETTER L WITH SMALL LETTER J), 'grep -i Lj' now matches both 'LJ' (U+01C7 LATIN CAPITAL LETTER LJ) and 'lj' (U+01C9 LATIN SMALL LETTER LJ). * Noteworthy changes in release 2.18 (2014-02-20) [stable] ** Bug fixes grep no longer mishandles patterns like [^^-~] in unibyte locales. [bug introduced in grep-2.8] grep -i in a multibyte, non-UTF8 locale could be up to 200 times slower than in 2.16. [bug introduced in grep-2.17] * Noteworthy changes in release 2.17 (2014-02-17) [stable] ** Improvements grep -i in a multibyte locale is now typically 10 times faster for patterns that do not contain \ or [. grep (without -i) in a multibyte locale is now up to 7 times faster when processing many matched lines. ** Maintenance grep's --mmap option was disabled in March of 2010, and began to elicit a warning in January of 2012. Now it is completely gone. * Noteworthy changes in release 2.16 (2014-01-01) [stable] ** Bug fixes Fix gnulib-provided maint.mk so that the release procedure described in README-release actually does what we want. Before that fix, that procedure resulted in a grep-2.15 tarball that would lead to a grep binary whose --version-reported version number was 2.14.51... The fix to make \s and \S work with multi-byte white space broke the use of each shortcut whenever followed by a repetition operator. For example, \s*, \s+, \s? and \s{3} would all malfunction in a multi-byte locale. [bug introduced in grep-2.15] The fix to make grep -P work better with UTF-8 made it possible for grep to evoke a larger set of PCRE errors, some of which could trigger an abort. E.g., this would abort: printf '\x82'|LC_ALL=en_US.UTF-8 grep -P y Now grep handles arbitrary PCRE errors. [bug introduced in grep-2.15] Handle very long lines (2GiB and longer) on systems with a deficient read system call. * Noteworthy changes in release 2.15 (2013-10-26) [stable] ** Bug fixes grep's \s and \S failed to work with multi-byte white space characters. For example, \s would fail to match a non-breaking space, and this would print nothing: printf '\xc2\xa0' | LC_ALL=en_US.UTF-8 grep '\s' A related bug is that \S would mistakenly match an invalid multibyte character. For example, the following would match: printf '\x82\n' | LC_ALL=en_US.UTF-8 grep '^\S$' [bug present since grep-2.6] grep -i would segfault on systems using UTF-16-based wchar_t (Cygwin) when converting an input string containing certain 4-byte UTF-8 sequences to lower case. The conversions to wchar_t and back to a UTF-8 multibyte string did not take surrogate pairs into account. [bug present since at least grep-2.6, though the segfault is new with 2.13] grep -E would segfault when given a regexp like '([^.]*[M]){1,2}' for any multibyte character M. [bug introduced in grep-2.6, which would segfault, but 2.7 and 2.8 had no problem, and 2.9 through 2.14 would hit a failed assertion. ] grep -F would get stuck in an infinite loop when given a search string that is an invalid byte sequence in the current locale and that matches the bytes of the input twice on a line. Now grep fails with exit status 1. grep -P could misbehave. While multi-byte mode is only supported by PCRE with UTF-8 locales, grep did not activate it. This would cause failures to match multibyte characters against some regular expressions, especially those including the '.' or '\p' metacharacters. ** New features grep -P can now use a just-in-time compiler to greatly speed up matches, This feature is transparent to the user; no flag is required to enable it. It is only available if the corresponding support in the PCRE library is detected when grep is compiled. * Noteworthy changes in release 2.14 (2012-08-20) [stable] ** Bug fixes grep -i '^$' could exit 0 (i.e., report a match) in a multi-byte locale, even though there was no match, and the command generated no output. E.g., seq 2 | LC_ALL=en_US.utf8 grep -il '^$' would mistakenly print "(standard input)". Related, seq 9 | LC_ALL=en_US.utf8 grep -in '^$' would print "2:4:6:8:10:12:14:16" and exit 0. Now it prints nothing and exits with status of 1. [bug introduced in grep-2.6] 'grep' no longer falsely reports text files as being binary on file systems that compress contents or that store tiny contents in metadata. * Noteworthy changes in release 2.13 (2012-07-04) [stable] ** Bug fixes grep -i, in a multi-byte locale, when matching a line containing a character like the UTF-8 Turkish I-with-dot (U+0130) (whose lower-case representation occupies fewer bytes), would print an incomplete output line. Similarly, with a matched line containing a character (e.g., the Latin capital I in a Turkish UTF-8 locale), where the lower-case representation occupies more bytes, grep could print garbage. [bug introduced in grep-2.6] --include and --exclude can again be combined, and again apply to the command line, e.g., "grep --include='*.[ch]' --exclude='system.h' PATTERN *" again reads all *.c and *.h files except for system.h. [bug introduced in grep-2.6] ** New features 'grep' without -z now treats a sparse file as binary, if it can easily determine that the file is sparse. ** Dropped features Bootstrapping with Makefile.boot has been broken since grep 2.6, and was removed. * Noteworthy changes in release 2.12 (2012-04-23) [stable] ** Bug fixes "echo P|grep --devices=skip P" once again prints P, as it did in 2.10 [bug introduced in grep-2.11] grep no longer segfaults with -r --exclude-dir and no file operand. I.e., ":|grep -r --exclude-dir=D PAT" would segfault. [bug introduced in grep-2.11] Recursive grep now uses fts for directory traversal, so it can handle much-larger directories without reporting things like "File name too long", and it can run much faster when dealing with large directory hierarchies. [bug present since the beginning] grep -E 'a{1000000000}' now reports an overflow error rather than silently acting like grep -E 'a\{1000000000}'. grep -E 'a{,10}' was not treated equivalently to grep -E 'a{0,10}'. ** New features The -R option now has a long-option alias --dereference-recursive. ** Changes in behavior The -r (--recursive) option now follows only command-line symlinks. Also, by default -r now reads a device only if it is named on the command line; this can be overridden with --devices. -R acts as before, so use -R if you prefer the old behavior of following all symlinks and defaulting to reading all devices. * Noteworthy changes in release 2.11 (2012-03-02) [stable] ** Bug fixes grep no longer dumps core on lines whose lengths do not fit in 'int'. (e.g., lines longer than 2 GiB on a typical 64-bit host). Instead, grep either works as expected, or reports an error. An error can occur if not enough main memory is available, or if the GNU C library's regular expression functions cannot handle such long lines. [bug present since "the beginning"] The -m, -A, -B, and -C options no longer mishandle context line counts that do not fit in 'int'. Also, grep -c's counts are now limited by the type 'intmax_t' (typically less than 2**63) rather than 'int' (typically less than 2**31). grep no longer silently suppresses errors when reading a directory as if it were a text file. For example, "grep x ." now reports a read error on most systems; formerly, it ignored the error. [bug introduced in grep-2.5] grep now exits with status 2 if a directory loop is found, instead of possibly exiting with status 0 or 1. [bug introduced in grep-2.3] The -s option now suppresses certain input error diagnostics that it formerly failed to suppress. These include errors when closing the input, when lseeking the input, and when the input is also the output. [bug introduced in grep-2.4] On POSIX systems, commands like "grep PAT < FILE >> FILE" now report an error instead of looping. [bug present since "the beginning"] The --include, --exclude, and --exclude-dir options now handle command-line arguments more consistently. --include and --exclude apply only to non-directories and --exclude-dir applies only to directories. "-" (standard input) is never excluded, since it is not a file name. [bug introduced in grep-2.5] grep no longer rejects "grep -qr . > out", i.e., when run with -q and an input file is the same as the output file, since with -q grep generates no output, so there is no risk of infinite loop or of an output-affecting race condition. Thus, the use of the following options also disables the input-equals-output failure: --max-count=N (-m) (for N >= 2) --files-with-matches (-l) --files-without-match (-L) [bug introduced in grep-2.10] grep no longer emits an error message and quits on MS-Windows when invoked with the -r option. grep no longer misinterprets some alternations involving anchors (^, $, \< \> \B, \b). For example, grep -E "(^|\B)a" no longer reports a match for the string "x a". [bug present since "the beginning"] ** New features If no file operand is given, and a command-line -r or equivalent option is given, grep now searches the working directory. Formerly grep ignored the -r and searched standard input nonrecursively. An -r found in GREP_OPTIONS does not have this new effect. grep now supports color highlighting of matches on MS-Windows. ** Changes in behavior Use of the --mmap option now elicits a warning. It has been a no-op since March of 2010. grep no longer diagnoses write errors repeatedly; it exits after diagnosing the first write error. This is better behavior when writing to a dangling pipe. Syntax errors in GREP_COLORS are now ignored, instead of sometimes eliciting warnings. This is more consistent with programs that (e.g.) ignore errors in termcap entries. * Noteworthy changes in release 2.10 (2011-11-16) [stable] ** Bug fixes grep no longer mishandles high-bit-set pattern bytes on systems where "char" is a signed type. [bug appears to affect only MS-Windows] On POSIX systems, grep now rejects a command like "grep -r pattern . > out", in which the output file is also one of the inputs, because it can result in an "infinite" disk-filling loop. [bug present since "the beginning"] ** Build-related "make dist" no longer builds .tar.gz files. xz is portable enough and in wide-enough use that distributing only .tar.xz files is enough. * Noteworthy changes in release 2.9 (2011-06-21) [stable] ** Bug fixes grep no longer clobbers heap for an ERE like '(^| )*( |$)' [bug introduced in grep-2.6] grep is faster on regular expressions that match multibyte characters in brackets (such as '[áéíóú]'). echo c|grep '[c]' would fail for any c in 0x80..0xff, with a uni-byte encoding for which the byte-to-wide-char mapping is nontrivial. For example, the ISO-88591 locales are not affected, but ru_RU.KOI8-R is. [bug introduced in grep-2.6] grep -P no longer aborts when PCRE's backtracking limit is exceeded Before, echo aaaaaaaaaaaaaab |grep -P '((a+)*)+$' would abort. Now, it diagnoses the problem and exits with status 2. * Noteworthy changes in release 2.8 (2011-05-13) [stable] ** Bug fixes echo c|grep '[c]' would fail for any c in 0x80..0xff, and in many locales. E.g., printf '\xff\n'|grep "$(printf '[\xff]')" || echo FAIL would print FAIL rather than the required matching line. [bug introduced in grep-2.6] grep's interpretation of range expression is now more consistent with that of other tools. [bug present since multi-byte character set support was introduced in 2.5.2, though the steps needed to reproduce it changed in grep-2.6] grep erroneously returned with exit status 1 on some memory allocation failure. [bug present since "the beginning"] * Noteworthy changes in release 2.7 (2010-09-16) [stable] ** Bug fixes grep --include=FILE works once again, rather than working like --exclude=FILE [bug introduced in grep-2.6] Searching with grep -Fw for an empty string would not match an empty line. [bug present since "the beginning"] X{0,0} is implemented correctly. It used to be a synonym of X{0,1}. [bug present since "the beginning"] In multibyte locales, regular expressions including back-references no longer exhibit quadratic complexity (i.e., they are orders of magnitude faster). [bug present since multi-byte character set support was introduced in 2.5.2] In UTF-8 locales, regular expressions including "." can be orders of magnitude faster. For example, "grep ." is now twice as fast as "grep -v ^$", instead of being immensely slower. It remains slow in other multibyte locales. [bug present since multi-byte character set support was introduced in 2.5.2] --mmap was meant to be ignored in 2.6.x, but it was instead removed by mistake. [bug introduced in 2.6] ** New features grep now diagnoses (and fails with exit status 2) commonly mistyped regular expression like [:space:], [:digit:], etc. Before, those were silently interpreted as [ac:eps] and [dgit:] respectively. Virtually all who make that class of mistake should have used [[:space:]] or [[:digit:]]. This new behavior is disabled when the POSIXLY_CORRECT environment variable is set. On systems using glibc, grep can support equivalence classes. However, whether they actually work depends on glibc's locale definitions. * Noteworthy changes in release 2.6.3 (2010-04-02) [stable] ** Bug fixes Searching with grep -F for an empty string in a multibyte locale would hang grep. [bug introduced in 2.6.2] PCRE support is once again detected on systems with <pcre/pcre.h> [bug introduced in 2.6.2] * Noteworthy changes in release 2.6.2 (2010-03-29) [stable] ** Bug fixes grep -F no longer mistakenly reports a match when searching for an incomplete prefix of a multibyte character. [bug present since "the beginning"] grep -F no longer goes into an infinite loop when it finds a match for an incomplete (non-prefix of a) multibyte character. [bug introduced in 2.6] Using any of the --include or --exclude* options would cause a NULL dereference. [bugs introduced in 2.6] ** Build-related configure no longer relies on pkg-config to detect PCRE support. * Noteworthy changes in release 2.6.1 (2010-03-25) [stable] ** Bug fixes Character classes could cause a segmentation fault if they included a multibyte character. [bug introduced in 2.6] Character ranges would not work in single-byte character sets other than C (for example, ISO-8859-1 or KOI8-R) and some multi-byte locales. For example, this should print "1", but would find no match: $ echo 1 | env -i LC_COLLATE=en_US.UTF-8 grep '[0-9]' [bug introduced in 2.6] The output of grep was incorrect for whole-word (-w) matches if the patterns included a back-reference. [bug introduced in grep-2.5.2] ** Portability Avoid a link failure on Solaris 8. * Noteworthy changes in release 2.6 (2010-03-23) [stable] ** Speed improvements grep is much faster on multibyte character sets, especially (but not limited to) UTF-8 character sets. The speed improvement is also very pronounced with case-insensitive matches. ** Bug fixes Character classes would malfunction in multi-byte locales when using grep -i. Examples which would print nothing for LC_ALL=en_US.UTF-8 include: - for ranges, echo Z | grep -i '[a-z]' - for single characters, echo Y | grep -i '[y]' - for character types, echo Y | grep -i '[[:lower:]]' grep -i -o would fail to report some matches; grep -i --color, while not missing any line containing a match, would fail to color some matches. grep would fail to report a match in a multibyte character set other than UTF-8, if another match occurred earlier in the line but started in the middle of a multibyte character. Various bugs in grep -P, caused by expressions such as [^b] or \S matching newlines, were fixed. grep -P also supports the special sequences \Z and \z, and can be combined with the command-line option -z to perform searches on NUL-separated records. grep would mistakenly exit with status 1 upon error, rather than 2, as it is documented to do. Using options like -1 -2 or -1 -v -2 results in two lines of context (the last value that appears on the command line) instead twelve (the concatenation of all the values). This is consistent with the behavior of options -A/-B/-C. Two new command-line options, --group-separator=ARGUMENT and --no-group-separator, enable further customization of the output when -A, -B or -C is being used. ** Other changes egrep accepts the -E option and fgrep accepts the -F option. If egrep and fgrep are given another of the -E/-F/-G options, they print a more meaningful error message. * Noteworthy changes in release 2.5.4 (2009-02-10) [stable] - This is a bugfix release. No new features. Version 2.5.3 - The new option --exclude-dir allows to specify a directory pattern that will be excluded from recursive grep. - Numerous bug fixes Version 2.5.1 - This is a bugfix release. No new features. Version 2.5 - The new option --label allows to specify a different name for input from stdin. See the man or info pages for details. - The internal lib/getopt* files are no longer used on systems providing getopt functionality in their libc (e.g. glibc 2.2.x). If you need the old getopt files, use --with-included-getopt. - The new option --only-matching (-o) will print only the part of matching lines that matches the pattern. This is useful, for example, to extract IP addresses from log files. - i18n bug fixed ([A-Z0-9] wouldn't match A in locales other than C on systems using recent glibc builds - GNU grep can now be built with autoconf 2.52. - The new option --devices controls how grep handles device files. Its usage is analogous to --directories. - The new option --line-buffered fflush on everyline. There is a noticeable slow down when forcing line buffering. - Back-references are now local to the regex. grep -e '\(a\)\1' -e '\(b\)\1' The last backref \1 in the second expression refer to \(b\) - The new option --include=PATTERN will search only matching files when recursing in directories - The new option --exclude=PATTERN will skip matching files when recursing in directories. - The new option --color will use the environment variable GREP_COLOR (default is red) to highlight the matching string. --color takes an optional argument specifying when to colorize a line: --color=always, --color=tty, --color=never - The following changes are for POSIX conformance: . The -q or --quiet or --silent option now causes grep to exit with zero status when a input line is selected, even if an error also occurs. . The -s or --no-messages option no longer affects the exit status. . Bracket regular expressions like [a-z] are now locale-dependent. For example, many locales sort characters in dictionary order, and in these locales the regular expression [a-d] is not equivalent to [abcd]; it might be equivalent to [aBbCcDd], for example. To obtain the traditional interpretation of bracket expressions, you can use the C locale by setting the LC_ALL environment variable to the value "C". - The -C or --context option now requires an argument, partly for consistency, and partly because POSIX recommends against optional arguments. - The new -P or --perl-regexp option tells grep to interpret the pattern as a Perl regular expression. - The new option --max-count=num makes grep stop reading a file after num matching lines. New option -m; equivalent to --max-count. - Translations for bg, ca, da, nb and tr have been added. Version 2.4.2 - Added more check in configure to default the grep-${version}/src/regex.c instead of the one in GNU Lib C. Version 2.4.1 - If the final byte of an input file is not a newline, grep now silently supplies one. - The new option --binary-files=TYPE makes grep assume that a binary input file is of type TYPE. --binary-files='binary' (the default) outputs a 1-line summary of matches. --binary-files='without-match' assumes binary files do not match. --binary-files='text' treats binary files as text (equivalent to the -a or --text option). - New option -I; equivalent to --binary-files='without-match'. Version 2.4: - egrep is now equivalent to 'grep -E' as required by POSIX, removing a longstanding source of confusion and incompatibility. 'grep' is now more forgiving about stray '{'s, for backward compatibility with traditional egrep. - The lower bound of an interval is not optional. You must use an explicit zero, e.g. 'x{0,10}' instead of 'x{,10}'. (The old documentation incorrectly claimed that it was optional.) - The --revert-match option has been renamed to --invert-match. - The --fixed-regexp option has been renamed to --fixed-strings. - New option -H or --with-filename. - New option --mmap. By default, GNU grep now uses read instead of mmap. This is faster on some hosts, and is safer on all. - The new option -z or --null-data causes 'grep' to treat a zero byte (the ASCII NUL character) as a line terminator in input data, and to treat newlines as ordinary data. - The new option -Z or --null causes 'grep' to output a zero byte instead of the normal separator after a file name. - These two options can be used with commands like 'find -print0', 'perl -0', 'sort -z', and 'xargs -0' to process arbitrary file names, even those that contain newlines. - The environment variable GREP_OPTIONS specifies default options; e.g. GREP_OPTIONS='--directories=skip' reestablishes grep 2.1's behavior of silently skipping directories. - You can specify a matcher multiple times without error, e.g. 'grep -E -E' or 'fgrep -F'. It is still an error to specify conflicting matchers. - -u and -U are now allowed on non-DOS hosts, and have no effect. - Modifications of the tests scripts to go around the "Broken Pipe" errors from bash. See Bash FAQ. - New option -r or --recursive or --directories=recurse. (This option was also in grep 2.3, but wasn't announced here.) - --without-included-regex disable, was causing bogus reports .i.e doing more harm then good. Version 2.3: - When searching a binary file FOO, grep now just reports "Binary file FOO matches" instead of outputting binary data. This is typically more useful than the old behavior, and it is also more consistent with other utilities like 'diff'. A file is considered to be binary if it contains a NUL (i.e. zero) byte. The new -a or --text option causes 'grep' to assume that all input is text. (This option has the same meaning as with 'diff'.) Use it if you want binary data in your output. - 'grep' now searches directories just like ordinary files; it no longer silently skips directories. This is the traditional behavior of Unix text utilities (in particular, of traditional 'grep'). Hence 'grep PATTERN DIRECTORY' should report "grep: DIRECTORY: Is a directory" on hosts where the operating system does not permit programs to read directories directly, and "grep: DIRECTORY: Binary file matches" (or nothing) otherwise. The new -d ACTION or --directories=ACTION option affects directory handling. '-d skip' causes 'grep' to silently skip directories, as in grep 2.1; '-d read' (the default) causes 'grep' to read directories if possible, as in earlier versions of grep. - The MS-DOS and Microsoft Windows ports now behave identically to the GNU and Unix ports with respect to binary files and directories. Version 2.2: Bug fix release. - Status error number fix. - Skipping directories removed. - Many typos fix. - -f /dev/null fix(not to consider as an empty pattern). - Checks for wctype/wchar. - -E was using the wrong matcher fix. - bug in regex char class fix - Fixes for DJGPP Version 2.1: This is a bug fix release(see Changelog) i.e. no new features. - More compliance to GNU standard. - Long options. - Internationalization. - Use automake/autoconf. - Directory hierarchy change. - Sigvec with -e on Linux corrected. - Sigvec with -f on Linux corrected. - Sigvec with the mmap() corrected. - Bug in kwset corrected. - -q, -L and -l stop on first match. - New and improve regex.[ch] from Ulrich Drepper. - New and improve dfa.[ch] from Arnold Robbins. - Prototypes for over zealous C compiler. - Not scanning a file, if it's a directory (cause problems on Sun). - Ported to MS-DOS/MS-Windows with DJGPP tools. See Changelog for the full story and proper credits. Version 2.0: The most important user visible change is that egrep and fgrep have disappeared as separate programs into the single grep program mandated by POSIX 1003.2. New options -G, -E, and -F have been added, selecting grep, egrep, and fgrep behavior respectively. For compatibility with historical practice, hard links named egrep and fgrep are also provided. See the manual page for details. In addition, the regular expression facilities described in Posix draft 11.2 are now supported, except for internationalization features related to locale-dependent collating sequence information. There is a new option, -L, which is like -l except it lists files which don't contain matches. The reason this option was added is because '-l -v' doesn't do what you expect. Performance has been improved; the amount of improvement is platform dependent, but (for example) grep 2.0 typically runs at least 30% faster than grep 1.6 on a DECstation using the MIPS compiler. Where possible, grep now uses mmap() for file input; on a Sun 4 running SunOS 4.1 this may cut system time by as much as half, for a total reduction in running time by nearly 50%. On machines that don't use mmap(), the buffering code has been rewritten to choose more favorable alignments and buffer sizes for read(). Portability has been substantially cleaned up, and an automatic configure script is now provided. The internals have changed in ways too numerous to mention. People brave enough to reuse the DFA matcher in other programs will now have their bravery amply "rewarded", for the interface to that file has been completely changed. Some changes were necessary to track the evolution of the regex package, and since I was changing it anyway I decided to do a general cleanup. ======================================================================== Copyright (C) 1992, 1997-2002, 2004-2021 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the "GNU Free Documentation License" file as part of this distribution. �������������������������������������������kbuild-3608/src/grep/po/����������������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377471�015070� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/hu.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000030577�14670377450�016221� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����W������Ô�����Œ������ˆ��Ï���‰��÷���Y��Õ��Q ��ü���' ��¶��$ ��U��Û ��F��1�����x�����Œ��,���¨�����Õ��.���õ��'���$��(���L�����u�����•�����—�����›��*���¬�����×�����h����������œ�����¸��$���Ð�����õ����������"�����3�����<�����[�����k��#���€�����¤�����¿��"���Ö�����ù�������&��������;�����P�����b�����t�� ���“��)��� �����Ê�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J�����Z�����\��4���y�����®��!���Í��0���ï��-��� ��.���N�����}��$���™�����¾�����Ù�����ñ����� �����)�����<�����N�����_�� ���s����������œ��,���«��*���Ø�� ����� ����� ��������*�����>�����X�� ���o��Õ��{����Q�� ��j��B��x�� ��»��5��É ��¯��ÿ"��ª��¯$�����Z&��(���r&��9���›&��/���Õ&��>���'��8���D'��6���}'��)���´'�����Þ'�����â'�����å'��?���û'��“���;(�����Ï(��"���ï(��%���)�����8)��.���V)�����…)��#���¢)�����Æ)�����Û)��&���ê)�����*�����!*��/���6*��!���f*��,���ˆ*��%���µ*�� ���Û*�����å*��C���ö*�����:+�����R+�����k+��%���„+�����ª+��1���¼+��*���î+�����,��6���+,��.���b,��*���‘,��&���¼,��"���ã,�����-�����%-�����@-�� ���W-�����b-��E���f-��8���¬-��#���å-����� .��5���%.��9���[.��E���•.��(���Û.��-���/��6���2/�����i/�����ˆ/��/���¦/�����Ö/�����ò/�����0�����&0�� ���>0��!���J0�����l0��(���0��5���ª0�����à0�����ö0����� 1�����"1�� ���81�����Y1�� ���t1��������?���(��� ������8���N���<��������������E���6���4��� ���.������� �������;��������������5���>�������D���3���������������)�����������P���J���@����������$���V����������K�����������B���L����������C������U������/�������S�����������F���W���2���0����������:�����������7���R��� ���T�����������A�����������1���'���M���,�������+���������H������!���I����������������G�������*���������������������=���&��� ����������9���#�������O�������%������"���-������Q������������� ���������������������� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: invalid option -- '%c' �%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep 3.1.48 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2019-11-23 22:33+0100 Last-Translator: Balázs Úr <ur.balazs@fsf.hu> Language-Team: Hungarian <translation-team-hu@lists.sourceforge.net> Language: hu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Lokalize 19.04.3 Plural-Forms: nplurals=2; plural=(n != 1); � Szövegkörnyezet beállításai: -B, --before-context=SZÃM SZÃM db. sor kiírása a találat elÅ‘tti környezetbÅ‘l -A, --after-context=SZÃM SZÃM db. sor kiírása a találat utáni környezetbÅ‘l -C, -- context=SZÃM SZÃM darab sor kiírása a környezetbÅ‘l � Egyéb: -s, --no-messages hibaüzenetek elnémítása -v, --invert-match a nem illeszkedÅ‘ sorok kiválogatása -V, --version verzióinformációk kiírása és kilépés --help ezen súgó kiírása és kilépés � Kimenet beállításai: -m, --max-count=SZÃM megáll SZÃM kiválasztott sor után -b, --byte-offset a kimenetben szerepel a sor helye is (bájteltolás) -n, --line-number a kimenetben szerepel a sor száma is --line-buffered kimenet kiürítése minden sor után -H, --with-filename fájlnév kiírása a kimeneti sorokkal -h, --no-filename a kimenetbe nem írja ki a fájlnév elÅ‘tagot --label=CÃMKE a CÃMKE kiírása fájlnévként a szabványos bemenet használatakor � -E, --extended-regexp a MINTÃK kiterjesztett reguláris kifejezések -F, --fixed-strings a MINTÃK karakterláncok -G, --basic-regexp a MINTÃK alapvetÅ‘ reguláris kifejezések -P, --perl-regexp a MINTÃK Perl reguláris kifejezések � -I ugyanaz, mint a --binary-files=without-match -d, --directories=MŰVELET mi történjen a könyvtárakkal; a MŰVELET a „readâ€, „recurse†vagy „skip†egyike -D, --devices=MŰVELET mi történjen az eszközökkel, FIFO-kkal és foglalatokkal, a MŰVELET a „read†vagy „skip†egyike -r, --recursive ugyanaz, mint a --directories=recurse -R, --dereference-recursive hasonló, de követi az összes szimlinket � -L, --files-without-match csak a kiválasztott sorok nélküli fájlnevek kiírása -l, --files-with-matches csak a kiválasztott sorokat tartalmazó fájlnevek kiírása -c, --count csak a kiválasztott sorok számának kiírása, FÃJLONKÉNT -T, --initial-tab sorok feltöltése tabokkal (ha szükséges) -Z, --null 0 bájt írása a FÃJLNÉV után � -o, --only-matching az illeszkedÅ‘ soroknak csak a nem üres részeit jelenítse meg -q, --quiet, --silent minden szokványos kimenet elhagyása --binary-files=TÃPUS a bináris fájlokat adott TÃPUSÚNAK veszi, a TÃPUS a „binaryâ€, „text†vagy „without-match†egyike -a, --text ugyanaz, mint a --binary-files=text �A(z) %s honlapja: <%s> �%s: érvénytelen kapcsoló -- „%c†�%s: a(z) „%s%s†kapcsoló nem enged meg argumentumot �%s: a(z) „%s%s†kapcsoló nem egyértelmű �%s: a(z) „%s%s†kapcsoló nem egyértelmű, lehetÅ‘ségek:�%s: a(z) „%s%s†kapcsolóhoz argumentum szükséges �%s: a kapcsoló egy argumentumot igényel -- „%c†�%s: a(z) „%s%s†kapcsoló ismeretlen �â€�©�(szabványos bemenet)�a -P csak unibyte és UTF-8 területi beállításokat támogat�Példa: %s -i 'szia világ' menu.h main.c A MINTÃK tartalmazhat több mintát új sorokkal elválasztva. Minta kiválasztása és értelmezése: �Érvénytelen visszahivatkozás�Érvénytelen karakterosztálynév�Érvénytelen leválogatási karakter�A \{\} tartalma érvénytelen�Érvénytelen megelÅ‘zÅ‘ reguláris kifejezés�Érvénytelen tartományvég�Érvénytelen reguláris kifejezés�Elfogyott a memória�Nincs találat�Nincs megelÅ‘zÅ‘ reguláris kifejezés�Csomagolta: %s �Csomagolta: %s (%s) �A reguláris kifejezés túl korán véget ért�A reguláris kifejezés túl nagy�A(z) %s hibái a(z) %s címen jelenthetÅ‘k. �A MINTÃK keresése minden FÃJLBAN. �Sikerült�Záró visszaper�További információkért adja ki a(z) „%s --help†parancsot. �Ismeretlen rendszerhiba�Pár nélküli ( vagy \(�Pár nélküli ) vagy \)�Pár nélküli [, [^, [:, [., vagy [=�Pár nélküli \{�Használat: %s [KAPCSOLÓ]… MINTÃK [FÃJL]… �Az érvényes argumentumok a következÅ‘k:�Ãrta %s és %s. �Ãrta %s, %s, %s, %s, %s, %s, %s, %s, %s, és mások. �Ãrta %s, %s, %s, %s, %s, %s, %s, %s, és %s. �Ãrta %s, %s, %s, %s, %s, %s, %s, és %s. �Ãrta %s, %s, %s, %s, %s, %s, és %s. �Ãrta %s, %s, %s, %s, %s, és %s. �Ãrta %s, %s, %s, %s, és %s. �Ãrta %s, %s, %s, és %s. �Ãrta %s, %s, és %s. �Ãrta %s. �„�a(z) „%s†argumentum nem egyértelmű a következÅ‘höz: „%sâ€�a karakterosztály szintaxisa [[:space:]], nem [:space:]�ütközÅ‘ illesztÅ‘k lettek megadva�a PCRE sorhossza túllépve�nem sikerült memóriát foglalni a PCRE JIT veremnek�a visszatérés meghiúsult a kiinduló munkakönyvtárba�nem sikerült beállítani a fájlleíró szöveges/bináris módját�a bemenet túl nagy a megszámláláshoz�belsÅ‘ hiba (soha nem szabadna elÅ‘fordulnia)�a(z) %s argumentum érvénytelen a következÅ‘höz: %s�érvénytelen karakterosztály�a \{\} tartalma érvénytelen�érvénytelen szövegkörnyezethossz argumentum�érvénytelen illesztÅ‘: %s�érvénytelen maximális szám�elfogyott a memória�nincs szintaxis megadva�programhiba�a reguláris kifejezés túl nagy�verem túlcsordulás�a -P kapcsoló csak egy mintát támogat�az aktuális munkakönyvtár feljegyzése meghiúsult�kiegyensúlyozatlan (�kiegyensúlyozatlan )�kiegyensúlyozatlan [�befejezetlen \ escape�ismeretlen bináris fájl típus�ismeretlen eszközmódszer�íráshiba����������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/hr.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000041626�14670377471�016216� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"�� ��#��õ���%��é���&��ö��ñ&��è��è(��;��Ñ*��ê�� ,��Z��ø-��û��S/��Ö��O1��i��&3�����4�� ���®4��7���Ï4��7���5�����?5��%���_5�����…5��!���¢5�����Ä5��+���ß5��(��� 6��8���46��)���m6��*���—6��#���Â6��,���æ6�����7�����7�����7��(���,7��Ÿ���U7��3���õ7�����)8�����H8�����g8�����‡8��#���¡8�����Å8�����Ü8��Ÿ���ö8�����–9�����­9��!���¾9�� ���à9�����í9��L����:��4���M:�����‚:��5���œ:��h���Ò:��!���;;�����];�����d;��<���;�����¼;�����Ö;�����ö;��,���<�����C<��-���]<�����‹<��@��¡<�����â=��6���õ=��.���,>��*���[>��&���†>��"���­>�����Ð>�����ï>����� ?�� ���!?��Y���.?�����ˆ?�����Œ?��3���«?��(���ß?��1���@��/���:@��3���j@��A���ž@�����à@��-����A�����.A�����JA�����cA��$���}A�����¢A�����¿A�����ÙA�����ðA�����B�����B�����4B��%���HB��3���nB�����¢B�����»B�����ÔB�����íB��!��� C�����/C��8���IC�����‚C����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep-3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 16:49+0200 Last-Translator: Božidar Putanec <bozidarp@yahoo.com> Language-Team: Croatian <lokalizacija@linux.hr> Language: hr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); X-Generator: Poedit 3.0 � Kontrola konteksta: -B, --before-context=BROJ ispiÅ¡e BROJ redaka konteksta koji prethode -A, --after-context=BROJ ispiÅ¡e BROJ redaka konteksta koji slijede -C, --context=BROJ ispiÅ¡e BROJ redaka konteksta koji prethode/slijede � Razno: -s, --no-messages izostavi poruke o greÅ¡kama -v, --invert-match odabere redove koji se ne podudaraju -V, --version informacije o inaÄici ovog programa --help ova pomoć � Kontrola izlaza: -m, --max-count=BROJ prestane nakon BROJ naÄ‘enih redaka -b, --byte-offset uz retke ispiÅ¡e i poziciju u bajtovima -n, --line-number uz retke ispiÅ¡e broj retka --line-buffered izravno ispiÅ¡e svaki izlazni redak -H, --with-filename uz retke ispiÅ¡e ime datoteke za svako podudaranje -h, --no-filename bez ispisa imena datoteke za svako podudaranje --label=OZNAKA rabi OZNAKU kao ime datoteke na standardnom ulazu � --include=GLOB pretraži samo datoteke koje se podudaraju s GLOB-om (datoteka s uzorcima) --exclude=GLOB preskoÄi sve datoteke i direktorije koji se podudaraju s GLOB-om (datoteka s uzorcima) --exclude-from=DATOTEKA preskoÄi sve datoteke koje se podudaraju s bilo kojim uzorkom u DATOTEKA --exclude-dir=GLOB preskoÄi direktorije koji podudaraju GLOB � -E, --extended-regexp UZORAK je proÅ¡ireni regularni izraz (ERE) -F, --fixed-strings UZORAK je skup stringova odvojenih znakom novog retka (\n) -G, --basic-regexp UZORAK je osnovni regularni izraz (BRE) -P, --perl-regexp UZORAK je Perl regularni izraz � -I isto kao --binary-files=without-match -d, --directories=AKCIJA kako rukovati direktorijima; AKCIJA je „read“, „recurse“ ili „skip“ -D, --devices=AKCIJA kako rukovati ureÄ‘ajima, FIFO ureÄ‘ajima i utiÄnicama; AKCIJA je „read“ ili „skip“ -r, --recursive isto kao --directories=recurse -R, --dereference-recursive jednako, ali slijedi svaku simboliÄku vezu � -L, --files-without-match ispiÅ¡e samo imena DATOTEKA bez podudaranja -l, --files-with-matches ispiÅ¡e samo imena DATOTEKA s podudaranjima -c, --count ispiÅ¡e samo broj podudarnih redaka po DATOTECI -T, --initial-tab poravna tabove (ako je potrebno) -Z, --null ispiÅ¡e 0-bajt nakon imena DATOTEKE � -BROJ isto kao --context=BROJ --group-separator=SEP ispiÅ¡e SEP(arator) u retku izmeÄ‘u podudaranja s kontekstom --no-group-separator ne ispiÅ¡e separator za podudaranja s kontektsom --color[=KADA], --colour[=KADA] bojama istakne naÄ‘ene stringove i markere; KADA može biti „always“ ili „never“ ili „auto“ -U, --binary ne uklanja CqR znakove na EOL (MSDOS/Windows) � -e, --regexp=UZORCI koristi UZORKE kao regularni izraz -f, --file=DATOTEKA preuzmi UZORKE iz DATOTEKE -i, --ignore-case zanemari veliÄinu slova u uzorcima i podacima --no-ignore-case ne zanemaruje veliÄinu slova (zadano) -w, --word-regexp UZORAK podudara samo cijele rijeÄi -x, --line-regexp UZORAK podudara samo cijele redove -z, --null-data redak zavrÅ¡ava s 0-bajtom, a ne sa znakom novog retka � -o, --only-matching prikaže samo dio retka koji se podudara -q, --quiet, --silent izostavi svaki normalni izlaz (niÅ¡ta ne ispiÅ¡e) --binary-files=VRSTA pretpostavi binarne datoteke tipa VRSTA; VRSTA je „binary“, „text“ ili „without-match“ -a, --text isto kao --binary-files=text �Mrežna stranica za %s: <%s> �%s: binarna datoteka se podudara�%s: prekoraÄeno je ograniÄenje broja vraćanja PCRE-a�%s: prekoraÄeno je ograniÄenje broja rekurzija PCRE-a�%s: PCRE JIT stÈg je iscrpljen�%s: ulazna datoteka je ujedno i izlaz�%s: interna PCRE greÅ¡ka: %d�%s: nevaljana opcija -- „%c“ �%s: nema dovoljno memorije�%s: opcija „%s%s“ ne dopuÅ¡ta argument �%s: opcija „%s%s“ nije jednoznaÄna �%s: opcija „%s%s“ nije jednoznaÄna; mogućnosti su:�%s: opcija „%s%s“ zahtijeva argument �%s: opcija zahtijeva argument -- „%c“ �%s: neprepoznata opcija „%s%s“ �%s upozorenje: rekurzivna petlja direktorija�“�©�(standardni ulaz)�-P podržava samo unibyte i UTF-8 locale�Primjer: %s -i 'hello world' menu.h main.c UZORCI mogu sadržavati viÅ¡estruke mustre odijeljene sa znakom za novi redak (\n). Izbor uzorka i interpretacija: �Općenita pomoć za koriÅ¡tenje GNU softvera: <%s> �Nevaljana povratna referencija�Nevaljano ime za klasu znakova�Nevaljani znak za razvrstavanje�Nevaljani sadržaj u \{\}�Nevaljani prethodni regularni izraz�Nevaljani kraj raspona�Nevaljani regularni izraz�Licencija GPLv3+: GNU GPL inaÄica 3 ili novija <%s>. Ovo je slobodan softver: slobodno ga mijenjajte i dijelite. NEMA JAMSTVA do granica dopuÅ¡tenih zakonom. �Nema dovoljno memorije�Nema podudaranja�Nema prethodnog regularnog izraza�Spakirao %s �Spakirali %s (%s) �Kompiliranje s --disable-perl-regexp ne podržava podudaranje na Perl naÄin�NedovrÅ¡eni regularni izraz (preuranjeni zavrÅ¡etak)�Preveliki regularni izraz�PogreÅ¡ke %s javite (na engleskom, LC_ALL=C) na <%s> �GreÅ¡ke u programu javite na <%s>. Primjedbe i pogreÅ¡ke u prijevodu javite na <lokalizacija@linux.hr>. �Traži UZORKE u svakoj DATOTECI. �Uspjeh�Zaostala obratna kosa crta�PokuÅ¡ajte s „%s --help“ za pomoć i viÅ¡e informacija. �Nepoznata greÅ¡ka sustava�( ili \( nema odgovarajući par�) ili \) nema odgovarajući par�[, [^, [:, [., ili [= nema odgovarajući par�\{ nema odgovarajući par�Uporaba: %s [OPCIJA]... UZORCI [DATOTEKA]... �Valjani argumenti su:�Ako je DATOTEKA „-“ (spojnica), Äita standardni ulaz. Bez DATOTEKE, rekurzivno Äita „.“, inaÄe Äita „-“ (stdin). S manje od dvije navedene DATOTEKE implicira opciju -h. ZavrÅ¡i sa statusom 0 ako je naÄ‘en barem jedan redak, inaÄe s 1; ako ima greÅ¡aka, a nije navedena opcija -q, zavrÅ¡i sa statusom 2. �Napisali %s i %s. �Napisali %s, %s, %s, %s, %s, %s, %s, %s, %s i ostali. �Napisali %s, %s, %s, %s, %s, %s, %s, %s i %s. �Napisali %s, %s, %s, %s, %s, %s, %s i %s. �Napisali %s, %s, %s, %s, %s, %s i %s. �Napisali %s, %s, %s, %s, %s i %s. �Napisali %s, %s, %s, %s i %s. �Napisali %s, %s, %s i %s. �Napisali %s, %s i %s. �Napisao %s. �Napisali Mike Haertel i ostali; vidi <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�„�viÅ¡eznaÄni argument %s za %s�sintaksa znakovne klase je [[:space]], ne [:space:]�navedeni uzorci su meÄ‘usobno konfliktni�prekoraÄeno je ograniÄenje duljine retka PCRE-a�dodjela memorije za PCRE JIT stÈg nije uspjela�nije se uspjelo vratiti u poÄetni radni direktorij�nije uspjelo postaviti deskriptor datoteke u tekst/binarni naÄin�ulaz je prevelik da se prebroji�**interna greÅ¡ka** (nije se smjela dogoditi)�nevaljani argument %s za %s�nevaljana znakovna klasa�nevaljani sadržaj u \{\}�nevaljani kontekst duljine argumenta�nevaljana sintaksa uzorka %s�nevaljani maksimalni broj�nema dovoljno memorije�sintaksa nije navedena�greÅ¡ka u programu�preveliki regularni izraz�prelijevanje stÈga�opcija -P podržava samo jedan uzorak�nije moguće registrirati trenutni radni direktorij�( nema odgovarajući par�) nema odgovarajući par�[ nema odgovarajući par�nedovrÅ¡ena \ escape sekvencija�nepoznata vrsta binarnih datoteka�nepoznata metoda ureÄ‘aja�upozorenje: opcija--unix-byte-offsets (-u) je zastarjela�greÅ¡ka pri pisanju�����������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/nl.po�����������������������������������������������������������������������0000664�0001750�0001750�00000070243�14670377471�016047� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Dutch translations for GNU grep. # Copyright (C) 2021 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # "Keep your religious feelings to yourself." # # Benno Schulenberg <benno@vertaalt.nl>, 2005, 2007, 2008, 2010, 2011, 2012, 2013. # Benno Schulenberg <benno@vertaalt.nl>, 2014, 2015, 2016, 2018, 2019, 2020, 2021. # Erwin Poeze <erwin.poeze@gmail.com>, 2009. # Taco Witte <tcwitte@cs.uu.nl>, 2004. # Ivo Timmermans <itimmermans@bigfoot.com>, 2000. # Erick Branderhorst <branderh@debian.org>, 1996. msgid "" msgstr "" "Project-Id-Version: grep-3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-11 11:40+0200\n" "Last-Translator: Benno Schulenberg <vertaling@coevern.nl>\n" "Language-Team: Dutch <vertaling@vrijschrift.org>\n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "ongeldig argument %s van %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "argument %s van %s is niet eenduidig" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Geldige argumenten zijn:" #: lib/c-stack.c:187 msgid "program error" msgstr "programmafout" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "stack-overloop" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "schrijffout" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "ongepaarde [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "ongeldige tekenklasse" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "syntax van tekenklasse is [[:space:]], niet [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "onafgemaakte \\-stuurcode" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "ongeldige inhoud van \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "reguliere expressie is te groot" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "ongepaarde (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "geen syntax opgegeven" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "ongepaarde )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Onbekende systeemfout" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: optie '%s%s' is niet eenduidig\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: optie '%s%s' is niet eenduidig; mogelijkheden zijn:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: onbekende optie '%s%s'\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: optie '%s%s' staat geen argument toe\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: optie '%s%s' vereist een argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: ongeldige optie -- '%c'\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: optie vereist een argument -- '%c'\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "onvoldoende geheugen beschikbaar" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "kan de huidige werkmap niet vastleggen" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "kan niet terugkeren naar de oorspronkelijke werkmap" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "kan modus van bestandsdescriptor niet instellen op tekst of binair" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "‘" #: lib/quotearg.c:356 msgid "'" msgstr "’" #: lib/regcomp.c:135 msgid "Success" msgstr "Gelukt" #: lib/regcomp.c:138 msgid "No match" msgstr "Geen overeenkomsten" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Ongeldige reguliere expressie" # Zie http://mailman.vrijschrift.org/pipermail/vertaling/2005-August/004670.html #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Ongeldig samengesteld teken" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Ongeldige tekenklassenaam" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Backslash aan het eind" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Ongeldige terugverwijzing" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Ongepaarde [, [^, [:, [., of [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Ongepaarde ( of \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Ongepaarde \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Ongeldige inhoud van \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Ongeldig bereikeinde" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Onvoldoende geheugen beschikbaar" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Ongeldige voorafgaande reguliere expressie" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Voortijdig einde van reguliere expressie" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Reguliere expressie is te groot" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Ongepaarde ) of \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Geen eerdere reguliere expressie" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "In pakketvorm gebracht door %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "In pakketvorm gebracht door %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Dit is vrije software: u mag het vrijelijk wijzigen en verder verspreiden.\n" "De precieze licentie is GPL-3+: GNU General Public License versie 3 of " "later.\n" "Zie <%s> voor de volledige (Engelse) tekst.\n" "Deze software kent GEEN GARANTIE, voor zover de wet dit toestaat.\n" "\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Geschreven door %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Geschreven door %s en %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Geschreven door %s, %s en %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Geschreven door %s, %s, %s\n" "en %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Geschreven door %s, %s, %s,\n" "%s en %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Geschreven door %s, %s, %s,\n" "%s, %s en %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Geschreven door %s, %s, %s,\n" "%s, %s, %s en %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Geschreven door %s, %s, %s,\n" "%s, %s, %s, %s\n" "en %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Geschreven door %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s en %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Geschreven door %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s en anderen.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" "Rapporteer gebreken in het programma aan %s;\n" "meld fouten in de vertaling aan <vertaling@vrijschrift.org>.\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" "Rapporteer gebreken in het programma '%s' aan <%s>;\n" "meld fouten in de vertaling aan <vertaling@vrijschrift.org>.\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Webpagina van %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Algemene hulp bij gebruik van GNU-software: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(standaardinvoer)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "ongeldig argument voor contextlengte" #: src/grep.c:894 msgid "input is too large to count" msgstr "invoer is te groot om te kunnen tellen" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: binair bestand bevat de gezochte tekst" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: waarschuwing: recursieve lus in de mappen" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: invoerbestand is gelijk aan het uitvoerbestand" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Gebruik: %s [OPTIE...] PATRONEN [BESTAND...]\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Typ '%s --help' voor meer informatie.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "" " \n" "Zoekt naar PATRONEN in ieder gegeven BESTAND.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" " \n" " Voorbeeld: %s -i 'hallo wereld' menu.h main.c\n" "\n" "PATRONEN kan uit meerdere patronen op aparte regels bestaan.\n" "\n" "Keuze en interpretatie van PATRONEN:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp PATRONEN zijn uitgebreide reguliere expressies\n" " -F, --fixed-strings PATRONEN zijn tekenreeksen\n" " -G, --basic-regexp PATRONEN zijn gewone reguliere expressies\n" " -P, --perl-regexp PATRONEN zijn reguliere Perl-expressies\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=PATRONEN deze PATRONEN gebruiken bij het zoeken\n" " -f, --file=BESTAND patronen uit dit BESTAND halen\n" " -i, --ignore-case verschil tussen hoofd- en kleine letters " "negeren\n" " in de patronen en in de gegevens\n" " --no-ignore-case hoofd- van kleine letters onderscheiden " "(standaard)\n" " -w, --word-regexp patronen komen alleen overeen met een heel " "woord\n" " -x, --line-regexp patronen komen alleen overeen met een hele " "regel\n" " -z, --null-data regels eindigen op 0-byte, niet op LF-teken\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Diversen:\n" " -s, --no-messages foutmeldingen onderdrukken\n" " -v, --invert-match de niet-overeenkomende regels selecteren\n" " -V, --version programmaversie tonen en stoppen\n" " --help deze hulptekst tonen en stoppen\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Uitvoeropties:\n" " -m, --max-count=AANTAL na dit AANTAL overeenkomsten stoppen\n" " -b, --byte-offset bij de uitvoerregels het byte-adres tonen\n" " -n, --line-number bij de uitvoerregels het regelnummer tonen\n" " --line-buffered elke uitvoerregel direct tonen\n" " -H, --with-filename bij de uitvoerregels de bestandsnaam tonen\n" " -h, --no-filename nooit de bestandsnaam tonen\n" " --label=LABEL dit LABEL als naam voor standaardinvoer " "gebruiken\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching alleen overeenkomende niet-lege fragmenten " "tonen\n" " -q, --quiet, --silent alle normale uitvoer onderdrukken\n" " --binary-files=TYPE aannemen dat binaire bestanden van dit TYPE " "zijn;\n" " TYPE is 'binary' (binair), 'text' (als " "tekst),\n" " of 'without-match' (alsof geen " "overeenkomsten)\n" " -a, --text hetzelfde als '--binary-files=text'\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I hetzelfde als '--binary-files=without-match'\n" " -d, --directories=ACTIE mappen behandelen met deze ACTIE;\n" " ACTIE is 'read', 'recurse' of 'skip'\n" " (ofwel lezen, in-afdalen, of overslaan)\n" " -D, --devices=ACTIE apparaten, FIFO's en sockets behandelen met " "ACTIE;\n" " ACTIE is 'read' of 'skip' (lezen of " "overslaan)\n" " -r, --recursive afdalen in submappen (ofwel '--" "directories=recurse')\n" " -R, --dereference-recursive idem, maar alle symbolische koppelingen " "volgen\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=BESTANDSPATROON alleen bestanden doorzoeken die aan\n" " BESTANDSPATROON voldoen\n" " --exclude=BESTANDSPATROON bestanden overslaan die aan " "BESTANDSPATROON\n" " voldoen\n" " --exclude-from=BESTAND bestanden overslaan die aan een\n" " bestandspatroon in BESTAND voldoen\n" " --exclude-dir=BSTNDSPTRN mappen overslaan die aan BSTNDSPTRN " "voldoen\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match alleen namen van bestanden zonder overeenkomst " "tonen\n" " -l, --files-with-matches alleen namen van bestanden met overeenkomsten " "tonen\n" " -c, --count alleen het aantal overeenkomsten per bestand " "tonen\n" " -T, --initial-tab tabs uitlijnen (eventueel een tab-teken " "invoegen)\n" " -Z, --null een 0-byte invoegen na iedere bestandsnaam\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Contextbesturing:\n" " -B, --before-context=AANTAL dit AANTAL regels voorafgaande context " "tonen\n" " -A, --after-context=AANTAL dit AANTAL regels nakomende context tonen\n" " -C, --context=AANTAL dit AANTAL regels context tonen\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -AANTAL hetzelfde als '--context=AANTAL'\n" " --group-separator=TEKENS contexten scheiden met regel met deze " "tekens\n" " --no-group-separator geen scheiding weergeven tussen contexten\n" " --color[=WANNEER],\n" " --colour[=WANNEER] overeenkomende tekst gekleurd weergeven;\n" " WANNEER is 'always' (altijd), " "'never' (nooit),\n" " of 'auto' (gepast voor uitvoerdoel; " "standaard)\n" " -U, --binary geen CR-tekens weghalen bij regeleinde (MSDOS/" "Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Indien BESTAND '-' is, wordt standaardinvoer gelezen. Zonder een BESTAND\n" "wordt '.' gelezen indien in recursieve modus, anders wordt '-' gelezen.\n" "Bij minder dan twee BESTANDen wordt '-h' aangenomen.\n" "\n" "De afsluitwaarde is 0 in geval van overeenkomsten, anders 1; als er\n" "een fout optreedt en '-q' is niet gegeven, dan is de afsluitwaarde 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "conflicterende expressiesoorten" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "Perl-expressies worden door deze programmaversie niet ondersteund" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "ongeldige expressiesoort '%s'" #: src/grep.c:2538 msgid "unknown devices method" msgstr "onbekende apparaten-actie" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "waarschuwing: --unix-byte-offsets (-u) is verouderd" #: src/grep.c:2686 msgid "invalid max count" msgstr "ongeldig maximum aantal" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "onbekend binair bestandstype" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Geschreven door Mike Haertel en anderen; zie\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "onvoldoende geheugen beschikbaar voor de PCRE-JIT-stack" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "optie '-P' ondersteunt alleen enkelbytes- en UTF-8-taalregio's" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "optie '-P' accepteert slechts één patroon" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "**interne programmafout** (zou nooit mogen gebeuren)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "de regellengtegrens van PCRE is overschreden" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: onvoldoende geheugen beschikbaar" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: de PCRE-JIT-stack is volledig gebruikt" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: de terugverwijzingengrens van PCRE is overschreden" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: de recursiegrens van PCRE is overschreden" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: **interne programmafout** in PCRE: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "waarschuwing: GREP_OPTIONS is verouderd; gebruik een alias of een script" #~ msgid "warning: %s: %s" #~ msgstr "waarschuwing: %s: %s" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "Webpagina van '%s': <https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "ongeldig argument '%3$s' van %1$s%2$s" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "ongeldig achtervoegsel in argument '%3$s' van %1$s%2$s" #~ msgid "%s%s argument '%s' too large" #~ msgstr "argument '%3$s' van %1$s%2$s is te groot" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "**interne programmafout**" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: optie '--%s' staat geen argument toe\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: onbekende optie '--%s'\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: optie '-W %s' is niet eenduidig\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: optie '-W %s' staat geen argument toe\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: optie '-W %s' vereist een argument\n" #~ msgid "lseek failed" #~ msgstr "'lseek' is mislukt" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "PATROON is standaard een gewone reguliere expressie (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "Het gebruik van 'egrep' en 'fgrep' wordt ontraden;\n" #~ "'egrep' betekent 'grep -E'; 'fgrep' betekent 'grep -F'.\n" #~ "\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "een naakte ^ of $ wordt niet ondersteund met optie '-Pz'" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Webpagina van GNU grep: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "ongeldige UTF-8-bytereeks in invoer" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "PATROON is een uitgebreide reguliere expressie (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "" #~ "Gebruik van 'egrep' wordt ontraden; het is beter 'grep -E' te gebruiken.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "PATROON is een serie tekenreeksen, elk op een aparte regel.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "" #~ "Gebruik van 'fgrep' wordt ontraden; het is beter 'grep -F' te gebruiken.\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s kan alleen de patroonsyntax %s gebruiken" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "de optie '--mmap' doet niets meer sinds 2010" #~ msgid "unfinished repeat count" #~ msgstr "onafgemaakt herhalingsaantal" #~ msgid "malformed repeat count" #~ msgstr "onjuist herhalingsaantal" #~ msgid "writing output" #~ msgstr "schrijven van uitvoer..." #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "GREP_COLORS='%s' --\n" #~ " Kenmerk '%s' vereist een waarde ('=...'); genegeerd." #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "GREP_COLORS='%s' --\n" #~ " Kenmerk '%s' is booleaans en verwacht geen waarde ('=%s'); genegeerd." #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "" #~ "GREP_COLORS='%s' --\n" #~ " Kenmerk '%s': %s." #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "GREP_COLORS='%s' --\n" #~ " Tekenreeks is onjuist; verwerking is gestopt voor subreeks '%s'." #~ msgid "unknown directories method" #~ msgstr "onbekende mappen-actie" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/Makefile.in.in��������������������������������������������������������������0000664�0001750�0001750�00000040407�14670377450�017544� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Makefile for PO directory in any package using GNU gettext. # Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper <drepper@gnu.ai.mit.edu> # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU General Public # License but which still want to provide support for the GNU gettext # functionality. # Please note that the actual code of GNU gettext is covered by the GNU # General Public License and is *not* in the public domain. # # Origin: gettext-0.18.2 GETTEXT_MACRO_VERSION = 0.18 PACKAGE = @PACKAGE@ VERSION = @VERSION@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ SHELL = /bin/sh @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ datadir = @datadir@ localedir = @localedir@ gettextsrcdir = $(datadir)/gettext/po INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ # We use $(mkdir_p). # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, # @install_sh@ does not start with $(SHELL), so we add it. # In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake # versions, $(mkinstalldirs) and $(install_sh) are unused. mkinstalldirs = $(SHELL) @install_sh@ -d install_sh = $(SHELL) @install_sh@ MKDIR_P = @MKDIR_P@ mkdir_p = @mkdir_p@ GMSGFMT_ = @GMSGFMT@ GMSGFMT_no = @GMSGFMT@ GMSGFMT_yes = @GMSGFMT_015@ GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) MSGFMT_ = @MSGFMT@ MSGFMT_no = @MSGFMT@ MSGFMT_yes = @MSGFMT_015@ MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) XGETTEXT_ = @XGETTEXT@ XGETTEXT_no = @XGETTEXT@ XGETTEXT_yes = @XGETTEXT_015@ XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) MSGMERGE = msgmerge MSGMERGE_UPDATE = @MSGMERGE@ --update MSGINIT = msginit MSGCONV = msgconv MSGFILTER = msgfilter POFILES = @POFILES@ GMOFILES = @GMOFILES@ UPDATEPOFILES = @UPDATEPOFILES@ DUMMYPOFILES = @DUMMYPOFILES@ DISTFILES.common = Makefile.in.in remove-potcdate.sin \ $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ $(POFILES) $(GMOFILES) \ $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) POTFILES = \ CATALOGS = @CATALOGS@ # Makevars gets inserted here. (Don't remove this line!) .SUFFIXES: .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update .po.mo: @echo "$(MSGFMT) -c -o $@ $<"; \ $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ .po.gmo: @lang=`echo $* | sed -e 's,.*/,,'`; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \ cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo .sin.sed: sed -e '/^#/d' $< > t-$@ mv t-$@ $@ all: all-@USE_NLS@ all-yes: stamp-po all-no: # Ensure that the gettext macros and this Makefile.in.in are in sync. CHECK_MACRO_VERSION = \ test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \ || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \ exit 1; \ } # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because # we don't want to bother translators with empty POT files). We assume that # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. # In this case, stamp-po is a nop (i.e. a phony target). # stamp-po is a timestamp denoting the last time at which the CATALOGS have # been loosely updated. Its purpose is that when a developer or translator # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent # invocations of "make" will do nothing. This timestamp would not be necessary # if updating the $(CATALOGS) would always touch them; however, the rule for # $(POFILES) has been designed to not touch files that don't need to be # changed. stamp-po: $(srcdir)/$(DOMAIN).pot @$(CHECK_MACRO_VERSION) test ! -f $(srcdir)/$(DOMAIN).pot || \ test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) @test ! -f $(srcdir)/$(DOMAIN).pot || { \ echo "touch stamp-po" && \ echo timestamp > stamp-poT && \ mv stamp-poT stamp-po; \ } # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', # otherwise packages like GCC can not be built if only parts of the source # have been downloaded. # This target rebuilds $(DOMAIN).pot; it is an expensive operation. # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. # The determination of whether the package xyz is a GNU one is based on the # heuristic whether some file in the top level directory mentions "GNU xyz". # If GNU 'find' is available, we avoid grepping through monster files. $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \ LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \ else \ LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \ fi; \ } | grep -v 'libtool:' >/dev/null; then \ package_gnu='GNU '; \ else \ package_gnu=''; \ fi; \ if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ else \ msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ fi; \ case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ --files-from=$(srcdir)/POTFILES.in \ --copyright-holder='$(COPYRIGHT_HOLDER)' \ --msgid-bugs-address="$$msgid_bugs_address" \ ;; \ *) \ $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ --files-from=$(srcdir)/POTFILES.in \ --copyright-holder='$(COPYRIGHT_HOLDER)' \ --package-name="$${package_gnu}@PACKAGE@" \ --package-version='@VERSION@' \ --msgid-bugs-address="$$msgid_bugs_address" \ ;; \ esac test ! -f $(DOMAIN).po || { \ if test -f $(srcdir)/$(DOMAIN).pot; then \ sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ else \ rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ fi; \ else \ mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ fi; \ } # This rule has no dependencies: we don't need to update $(DOMAIN).pot at # every "make" invocation, only create it when it is missing. # Only "make $(DOMAIN).pot-update" or "make dist" will force an update. $(srcdir)/$(DOMAIN).pot: $(MAKE) $(DOMAIN).pot-update # This target rebuilds a PO file if $(DOMAIN).pot has changed. # Note that a PO file is not touched if it doesn't need to be changed. $(POFILES): $(srcdir)/$(DOMAIN).pot @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ if test -f "$(srcdir)/$${lang}.po"; then \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \ cd $(srcdir) \ && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \ *) \ $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \ esac; \ }; \ else \ $(MAKE) $${lang}.po-create; \ fi install: install-exec install-data install-exec: install-data: install-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ for file in $(DISTFILES.common) Makevars.template; do \ $(INSTALL_DATA) $(srcdir)/$$file \ $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ for file in Makevars; do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ : ; \ fi install-data-no: all install-data-yes: all @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ $(mkdir_p) $(DESTDIR)$$dir; \ if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ for file in *; do \ if test -f $$file; then \ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ fi; \ done); \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ else \ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ :; \ else \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ fi; \ fi; \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ fi; \ done; \ done install-strip: install installdirs: installdirs-exec installdirs-data installdirs-exec: installdirs-data: installdirs-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ else \ : ; \ fi installdirs-data-no: installdirs-data-yes: @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ $(mkdir_p) $(DESTDIR)$$dir; \ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ for file in *; do \ if test -f $$file; then \ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ fi; \ done); \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ else \ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ :; \ else \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ fi; \ fi; \ fi; \ done; \ done # Define this as empty until I found a useful application. installcheck: uninstall: uninstall-exec uninstall-data uninstall-exec: uninstall-data: uninstall-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ for file in $(DISTFILES.common) Makevars.template; do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ : ; \ fi uninstall-data-no: uninstall-data-yes: catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ done; \ done check: all info dvi ps pdf html tags TAGS ctags CTAGS ID: mostlyclean: rm -f remove-potcdate.sed rm -f stamp-poT rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po rm -fr *.o clean: mostlyclean distclean: clean rm -f Makefile Makefile.in POTFILES *.mo maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." rm -f stamp-po $(GMOFILES) distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) dist distdir: $(MAKE) update-po @$(MAKE) dist2 # This is a separate target because 'update-po' must be executed before. dist2: stamp-po $(DISTFILES) dists="$(DISTFILES)"; \ if test "$(PACKAGE)" = "gettext-tools"; then \ dists="$$dists Makevars.template"; \ fi; \ if test -f $(srcdir)/$(DOMAIN).pot; then \ dists="$$dists $(DOMAIN).pot stamp-po"; \ fi; \ if test -f $(srcdir)/ChangeLog; then \ dists="$$dists ChangeLog"; \ fi; \ for i in 0 1 2 3 4 5 6 7 8 9; do \ if test -f $(srcdir)/ChangeLog.$$i; then \ dists="$$dists ChangeLog.$$i"; \ fi; \ done; \ if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ for file in $$dists; do \ if test -f $$file; then \ cp -p $$file $(distdir) || exit 1; \ else \ cp -p $(srcdir)/$$file $(distdir) || exit 1; \ fi; \ done update-po: Makefile $(MAKE) $(DOMAIN).pot-update test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) $(MAKE) update-gmo # General rule for creating PO files. .nop.po-create: @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ exit 1 # General rule for updating PO files. .nop.po-update: @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ tmpdir=`pwd`; \ echo "$$lang:"; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ cd $(srcdir); \ if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ *) \ $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ esac; \ }; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ exit 1; \ fi; \ fi; \ else \ echo "msgmerge for $$lang.po failed!" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ fi $(DUMMYPOFILES): update-gmo: Makefile $(GMOFILES) @: # Recreate Makefile by invoking config.status. Explicitly invoke the shell, # because execution permission bits may not work on the current file system. # Use @SHELL@, which is the shell determined by autoconf for the use by its # scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient. Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ cd $(top_builddir) \ && @SHELL@ ./config.status $(subdir)/$@.in po-directories force: # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/Rules-quot������������������������������������������������������������������0000664�0001750�0001750�00000003406�14670377450�017073� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Special Makefile rules for English message catalogs with quotation marks. DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot .SUFFIXES: .insert-header .po-update-en en@quot.po-create: $(MAKE) en@quot.po-update en@boldquot.po-create: $(MAKE) en@boldquot.po-update en@quot.po-update: en@quot.po-update-en en@boldquot.po-update: en@boldquot.po-update-en .insert-header.po-update-en: @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ tmpdir=`pwd`; \ echo "$$lang:"; \ ll=`echo $$lang | sed -e 's/@.*//'`; \ LC_ALL=C; export LC_ALL; \ cd $(srcdir); \ if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ exit 1; \ fi; \ fi; \ else \ echo "creation of $$lang.po failed!" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ fi en@quot.insert-header: insert-header.sin sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header en@boldquot.insert-header: insert-header.sin sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header mostlyclean: mostlyclean-quot mostlyclean-quot: rm -f *.insert-header ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/insert-header.sin�����������������������������������������������������������0000664�0001750�0001750�00000001240�14670377450�020327� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Sed script that inserts the file called HEADER before the header entry. # # At each occurrence of a line starting with "msgid ", we execute the following # commands. At the first occurrence, insert the file. At the following # occurrences, do nothing. The distinction between the first and the following # occurrences is achieved by looking at the hold space. /^msgid /{ x # Test if the hold space is empty. s/m/m/ ta # Yes it was empty. First occurrence. Read the file. r HEADER # Output the file's contents by reading the next line. But don't lose the # current line while doing this. g N bb :a # The hold space was nonempty. Following occurrences. Do nothing. x :b } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/el.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000007242�14670377450�016176� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����"������,��/���<������ø�����ù����� ������������$���$�����I�����[�����v�����‡�������#���¯�����Ó�����î�������&��� �����4�����I�����^�����`��4���}�����²��-���Ñ�����ÿ����������6�����N�����n�����€��,���‘��*���¾�����é������� �����­��&��'���Ô�����ü�����ÿ��!�����G���%��"���m��*�����$���»��!���à��A��� ��B���D ��D���‡ ��)���Ì �����ö ��Y��� ��.���a ��9��� �����Ê ��2���Í ��d���� ��S���e ��Y���¹ ��O��� ��&���c ��2���Š ��D���½ ��5��� ��$���8 ��N���] ��n���¬ ��9�����.���U�����„�������� �������������������������������� �������������������� ������������������������������������������������"��� ������������������������� ���!��� ���������������%s home page: <%s> �'�(C)�(standard input)�Invalid preceding regular expression�Invalid range end�Invalid regular expression�Memory exhausted�No match�No previous regular expression�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Success�Try '%s --help' for more information. �Unknown system error�Valid arguments are:�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�failed to return to initial working directory�input is too large to count�invalid argument %s for %s�invalid character class�invalid context length argument�invalid max count�memory exhausted�the -P option only supports a single pattern�unable to record current working directory�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep 2.11.11-pre1 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2012-05-05 23:23+0100 Last-Translator: Savvas Radevic <vicedar@gmail.com> Language-Team: Greek <team@lists.gnome.gr> Language: el MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Poedit-Language: Greek X-Poedit-Country: GREECE �%s κεντÏική σελίδα: <%s> �»�(C)�(κανονική είσοδος)�ΆκυÏη Ï€ÏοηγοÏμενης κανονικής έκφÏασης�ΆκυÏο τέλος σειÏάς�ΆκυÏη κανονική έκφÏαση�Η μνήμη εξαντλήθηκε�Καμία αντιστοιχία�Καμία Ï€ÏοηγοÏμενη κανονική έκφÏαση�ΠÏόωÏο τέλος της κανονικής έκφÏασης�ΥπεÏβολικά μεγάλη η κανονική έκφÏαση�ΑναφοÏά %s σφαλμάτων: %s �Επιτυχία�Δοκιμάστε «%s --help» για πεÏισσότεÏες πληÏοφοÏίες. �Άγνωστο λάθος συστήματος�ΈγκυÏες επιλογές είναι οι εξής:�«�διφοÏοÏμενη επιλογή %s για %s�η σÏνταξη κατηγοÏίας χαÏακτήÏων είναι [[:space:]], όχι [:space:]�οÏίστηκαν αντικÏουόμενα στοιχεία αναζήτησης�αποτυχία επιστÏοφής στον αÏχικό φάκελο εÏγασίας�η είσοδος είναι Ï€Î¿Î»Ï Î¼ÎµÎ³Î¬Î»Î· για να μετÏηθεί�άκυÏη επιλογή %s για %s�άκυÏη κατηγοÏία χαÏακτήÏων�μη έγκυÏο ÏŒÏισμα μήκους πεÏιεχομένου�μη έγκυÏος μέγιστος μετÏητής�η μνήμη εξαντλήθηκε�Η επιλογή -P υποστηÏίζει μόνο ένα υπόδειγμα�δεν είναι δυνατή η καταγÏαφή του Ï„Ïέχοντος φακέλου εÏγασίας�άγνωστο είδος δυαδικών αÏχείων�άγνωστη μέθοδος συσκευών�σφάλμα εγγÏαφής���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/zh_CN.gmo�������������������������������������������������������������������0000664�0001750�0001750�00000035575�14670377471�016614� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����g������T��‰���Œ������°��Ï���±��÷��� ��Õ��y ����O ��ü���` ��¶��]��U����¤��j��F�������V�����j��&���‚��#���©�����Í��!���ê����� �����(�����D��,���Y�����†��.���¦��'���Õ��(���ý�����&��%���F�����l�����n�����r��*���ƒ�����®��&���?�����f�����}�����š�����¶��$���Î�����ó�������ª��� �����Ë�����Ü�����å������������<���)��#���f�����Š�����¥�����¼��"���Ð�����ó�����û��&��������5�����J�����\�����n�� �����)���š�����Ä��ù���Ù�����Ó��;���ê��3���&��/���Z��+���Š��'���¶��#���Þ����������"�����>��\���N�����«�����­��4���Ê�����ÿ��!�����0���@��-���q��.���Ÿ�����Î��$���ê����������*�����B�����Z�����z����������Ÿ�����°�� ���Ä�����Ò�����í��,���ü��*���) �� ���T �� ���a �� ���n �����{ ����� �����© �� ���À ��£��Ì ��½���p"��Ú���.#��Ô�� $����Þ%��ì���ú&��Ö��ç'��Z��¾)��á��+��J��û,�����F.�����W.�� ���u.�� ���–.�����·.��&���Õ.�����ü.�����/�����7/��(���I/�����r/��0���’/��(���Ã/��*���ì/��%���0�� ���=0�����^0�����b0�����e0��+���x0�����¤0�� ���51�����V1�����l1�����‚1�����˜1�����°1�����Ï1�����å1��È���þ1�� ���Ç2�� ���Ô2�����Þ2�����ý2����� 3��M��� 3�����n3�����3�����£3��T���Â3��,���4�����D4�����K4��2���^4�����‘4�����§4�����º4�����Í4�� ���ê4��*���÷4�����"5��|��35�����°6��>���Å6��1���7��-���67��)���d7��%���Ž7��!���´7�����Ö7�����ô7�� ��� 8��m���8�����‰8�����8��2���«8��$���Þ8�����9��%���"9�����H9��1���g9�����™9��'���²9�����Ú9�����õ9����� :�����:�����;:�����K:�� ���a:�����n:�� ���~:�����‹:�� ���¡:��$���«:�����Ð:�����ï:�����;�����;�����%;�����8;�����W;�� ���s;�����d���;���<���8������� ���4���)������*����������O������D�����������]���C���\���S���%���/��� ���L���2���,�����������_���>���H������U������Z������������������G����������������X����������=��������������`���^���N���J������6���?���M���R�������F���T���$���������������������7�����������������K���0�������P���9���#�����������3���������!���c���.��� ������E���W���e����������:���A���5���(��� ������ �������@�����������Y���"���a���-���f������ ���+������1���Q�������������g���'���V�����������b���I���&�������B�������������������[���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep 3.5.16 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2020-11-04 09:09-0500 Last-Translator: Boyuan Yang <073plan@gmail.com> Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com> Language: zh_CN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Poedit 2.4.1 � 文件控制: -B, --before-context=NUM æ‰“å°æ–‡æœ¬åŠå…¶å‰é¢NUM 行 -A, --after-context=NUM æ‰“å°æ–‡æœ¬åŠå…¶åŽé¢NUM 行 -C, --context=NUM 打å°NUM 行输出文本 � æ‚项: -s, --no-messages 䏿˜¾ç¤ºé”™è¯¯ä¿¡æ¯ -v, --invert-match 选中ä¸åŒ¹é…的行 -V, --version 显示版本信æ¯å¹¶é€€å‡º --help 显示此帮助并退出 � 输出控制: -m, --max-count=<次数> 得到给定<次数>次匹é…åŽåœæ­¢ -b, --byte-offset è¾“å‡ºçš„åŒæ—¶æ‰“å°å­—节åç§» -n, --line-number è¾“å‡ºçš„åŒæ—¶æ‰“å°è¡Œå· --line-buffered æ¯è¡Œè¾“出åŽåˆ·æ–°è¾“出缓冲区 -H, --with-filename ä¸ºè¾“å‡ºè¡Œæ‰“å°æ–‡ä»¶å -h, --no-filename è¾“å‡ºæ—¶ä¸æ˜¾ç¤ºæ–‡ä»¶åå‰ç¼€ --label=<标签> 将给定<标签>作为标准输入文件åå‰ç¼€ � --include=GLOB åªæŸ¥æ‰¾åŒ¹é… GLOB(文件模å¼ï¼‰çš„æ–‡ä»¶ --exclude=GLOB è·³è¿‡åŒ¹é… GLOB 的文件 --exclude-from=FILE 跳过所有匹é…ç»™å®šæ–‡ä»¶å†…å®¹ä¸­ä»»æ„æ¨¡å¼çš„æ–‡ä»¶ --exclude-dir=GLOB è·³è¿‡æ‰€æœ‰åŒ¹é… GLOB 的目录 � -E, --extended-regexp <模å¼> æ˜¯æ‰©å±•æ­£åˆ™è¡¨è¾¾å¼ -F, --fixed-strings <模å¼> 是字符串 -G, --basic-regexp <模å¼> æ˜¯åŸºæœ¬æ­£åˆ™è¡¨è¾¾å¼ -P, --perl-regexp <模å¼> 是 Perl æ­£åˆ™è¡¨è¾¾å¼ � -I ç­‰åŒäºŽ --binary-files=without-match -d, --directories=ACTION 读å–目录的方å¼ï¼› ACTION å¯ä»¥æ˜¯`read', `recurse',或`skip' -D, --devices=ACTION 读å–设备ã€å…ˆå…¥å…ˆå‡ºé˜Ÿåˆ—ã€å¥—接字的方å¼ï¼› ACTION å¯ä»¥æ˜¯`read'或`skip' -r, --recursive ç­‰åŒäºŽ--directories=recurse -R, --dereference-recursive åŒä¸Šï¼Œä½†é历所有符å·é“¾æŽ¥ � -L, --files-without-match åªæ‰“å°æ²¡æœ‰åŒ¹é…上的<文件>çš„åç§° -l, --files-with-matches åªæ‰“å°æœ‰åŒ¹é…çš„<文件>çš„åç§° -c, --count åªæ‰“å°æ¯ä¸ª<文件>中的匹é…行数目 -T, --initial-tab 行首制表符对é½ï¼ˆå¦‚有必è¦ï¼‰ -Z, --null 在<文件>åæœ€åŽæ‰“å°ç©ºå­—符 � -e, --regexp=<模å¼> 用指定的<模å¼>字符串æ¥è¿›è¡ŒåŒ¹é…æ“作 -f, --file=<文件> 从给定<文件>中å–å¾—<模å¼> -i, --ignore-case 在模å¼å’Œæ•°æ®ä¸­å¿½ç•¥å¤§å°å†™ --no-ignore-case ä¸è¦å¿½ç•¥å¤§å°å†™ï¼ˆé»˜è®¤ï¼‰ -w, --word-regexp 强制<模å¼>仅完全匹é…å­—è¯ -x, --line-regexp 强制<模å¼>ä»…å®Œå…¨åŒ¹é…æ•´è¡Œ -z, --null-data æ•°æ®è¡Œä»¥ä¸€ä¸ª 0 字节结æŸï¼Œè€Œéžæ¢è¡Œç¬¦ � -o, --only-matching åªæ˜¾ç¤ºè¡Œä¸­éžç©ºåŒ¹é…部分 -q, --quiet, --silent 䏿˜¾ç¤ºæ‰€æœ‰å¸¸è§„输出 --binary-files=TYPE 设定二进制文件的 TYPE(类型); TYPE å¯ä»¥æ˜¯ 'binary'ã€'text' 或 'without-match' -a, --text ç­‰åŒäºŽ --binary-files=text �%s 主页: <%s> �%s:匹é…到二进制文件�%s:超过 PCRE 的回溯é™åˆ¶�%s:超过 PCRE 的递归é™åˆ¶�%s:PCRE JIT 栈已ç»ç”¨å°½�%sï¼šè¾“å…¥æ–‡ä»¶åŒæ—¶ä¹Ÿä½œä¸ºè¾“出�%s:PCRE 内部错误:%d�%s:无效选项 -- “%c†�%s:内存耗尽�%s:选项“%s%sâ€ä¸å…è®¸å¸¦å‚æ•° �%s:选项“%s%sâ€æœ‰æ­§ä¹‰ �%s:选项“%s%sâ€æœ‰æ­§ä¹‰ï¼›å¯èƒ½åŽŸå› ï¼š�%s:选项“%s%sâ€éœ€è¦ä¸€ä¸ªå‚æ•° �%s:选项需è¦ä¸€ä¸ªå‚æ•° -- “%c†�%s:无法识别的选项“%s%s†�%s:警告:嵌套目录循环�’�©�(标准输入)�-P 仅支æŒå•å­—èŠ‚åŠ UTF-8 语言环境�例如:%s -i 'hello world' menu.h main.c <模å¼>å¯ä»¥åŒ…括多个模å¼å­—符串,使用æ¢è¡Œç¬¦è¿›è¡Œåˆ†éš”。 模å¼é€‰æ‹©ä¸Žè§£é‡Šï¼š �GNU 软件的通用帮助: <%s> �无效的回退索引�无效的字符类å�无效的冲çªå­—符�\{\} 中的内容无效�之å‰çš„æ­£åˆ™è¡¨è¾¾å¼æ— æ•ˆ�无效的结æŸåœ°å€�无效的正则表达å¼�GPLv3+ 许å¯è¯: GNU 通用公共许å¯è¯ç¬¬ä¸‰ç‰ˆæˆ–更高版本 <%s>。 这是自由软件: 您å¯è‡ªç”±æ›´æ”¹å¹¶é‡æ–°åˆ†å‘它。 在法律所å…许的范围内,ä¸é™„å¸¦ä»»ä½•æ‹…ä¿æ¡æ¬¾ã€‚ �内存耗尽�无匹é…�没有之å‰çš„æ­£åˆ™è¡¨è¾¾å¼�ç”± %s 打包 �ç”± %s (%s) 打包 �当å‰ä½¿ç”¨äº† --disable-perl-regexp çš„æž„å»ºæ— æ³•æ”¯æŒ Perl åŒ¹é…æ¨¡å¼�正则表达å¼éžæ­£å¸¸ç»“æŸ�正则表达å¼å¤ªå¤§�请将 %s 错误报告给: %s �请将错误报告给:%s。翻译问题请报告至 <i18n-zh@googlegroups.com>。 �在æ¯ä¸ª<文件>中查找给定<模å¼>。 �æˆåŠŸ�å¤šä½™çš„åæ–œæ �å°è¯•使用 '%s --help' æ¥èŽ·å¾—æ›´å¤šä¿¡æ¯ã€‚ �未知的系统错误�( 或 \( ä¸åŒ¹é…�) 或 \) ä¸åŒ¹é…�[, [^, [:, [.或[= ä¸åŒ¹é…�\{ ä¸åŒ¹é…�用法: %s [选项]... æ¨¡å¼ [文件]... �æœ‰æ•ˆå‚æ•°æ˜¯:�若给定文件为“-â€ï¼Œåˆ™ä»Žè¯»å–标准输入。 è‹¥æ— æ–‡ä»¶å‚æ•°ï¼Œåˆ™é™¤éžå¤„于 递归工作模å¼è§†ä¸ºä»Žâ€œ.â€è¯»å–之外,一律视为从“-â€è¯»å–。如果æä¾›äº†å°‘于 ä¸¤ä¸ªæ–‡ä»¶å‚æ•°ï¼Œåˆ™é»˜è®¤å¯ç”¨ -h 选项。如果有任æ„行被匹é…则退出状æ€ä¸º 0, å¦åˆ™ä¸º 1;如果有错误产生且未指定 -q 傿•°ï¼Œåˆ™é€€å‡ºçжæ€ä¸º 2。 �作者 %s å’Œ %s。 �作者 %s, %s, %s, %s, %s, %s, %s, %s, %s, 以åŠå…¶ä»–人。 �作者 %s, %s, %s, %s, %s, %s, %s, %s, åŠ %s。 �作者 %s, %s, %s, %s, %s, %s, %s, åŠ %s。 �作者 %s, %s, %s, %s, %s, %s, åŠ %s。 �作者 %s, %s, %s, %s, %s, åŠ %s。 �作者 %s, %s, %s, %s, åŠ %s。 �作者 %s, %s, %s, åŠ %s。 �作者 %s, %s åŠ %s。 �作者 %s。 �ç”± Mike Haerhtel 等人编写;作者信æ¯è¯·å‚è§ <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>。�‘�%2$s çš„å‚æ•° %1$s 有歧义�字符类的语法是 [[:space:]],è€Œéž [:space:]�指定了互相冲çªçš„æ¯”较程åº�超过 PCRE 的行长度é™åˆ¶�为 PCRE JIT 栈分é…内存时出错�无法返回起始工作目录�设置文件æè¿°ç¬¦æ–‡æœ¬/二进制模å¼å¤±è´¥�输入太多无法计数�内部错误(永远ä¸åº”该å‘生)�%2$s çš„å‚æ•° %1$s 无效�无效的字符类å�\{\}中内容无效�æ— æ•ˆçš„æ–‡æœ¬é•¿åº¦å‚æ•°�æ— æ•ˆåŒ¹é… %s�无效的最大计数�内存耗尽�未指定语法�程åºé”™è¯¯�正则表达å¼å¤ªé•¿�栈溢出�-P 选项仅支æŒå•一匹é…å­—è¯�无法记录当å‰å·¥ä½œç›®å½•�有未匹é…çš„ (�有未匹é…çš„ )�有未匹é…çš„ [�未åšå¥½ \ 转义�未知的二进制文件类型�æœªçŸ¥çš„è®¾å¤‡å¤„ç†æ–¹å¼�写错误������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/ja.po�����������������������������������������������������������������������0000664�0001750�0001750�00000141343�14670377450�016025� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Japanese messages for GNU grep # Copyright (C) 1996, 2014 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # IIDA Yosiaki <iida@gnu.org>, 1999, 2000, 2001, 2002. # Yasuyuki Furukawa <yasu@on.cs.keio.ac.jp>, 1997 # and taken over on 1999-09-24 by IIDA. # Special thanks to # Daisuke Yamashita <yamad@mb.infoweb.ne.jp>, 1999. # Masahito Yamaga <yamaga@ipc.chiba-u.ac.jp>, 2002. # GOTO Masanori <gotom@debian.or.jp>, 2006. # derived from the version by Yasuyuki Furukawa <yasu@on.cs.keio.ac.jp> 1998. # Jun Nishii <jun@flatout.org> 1999. # Daisuke Yamashita <yamad@mb.infoweb.ne.jp> 1999. # Yasuaki Taniguchi <yasuakit@gmail.com>, 2010, 2011, 2014, 2017. msgid "" msgstr "" "Project-Id-Version: GNU grep 3.0.23-b00\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2017-06-25 20:16+0900\n" "Last-Translator: Yasuaki Taniguchi <yasuakit@gmail.com>\n" "Language-Team: Japanese <translation-team-ja@lists.sourceforge.net>\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 2.0.2\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "%2$s ã«å¯¾ã™ã‚‹å¼•æ•° %1$s ãŒé–“é•ã£ã¦ã„ã¾ã™" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "%2$s ã«å¯¾ã™ã‚‹å¼•æ•° %1$s ãŒæ›–昧ã§ã™" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "有効ãªå¼•æ•°:" #: lib/c-stack.c:187 msgid "program error" msgstr "プログラムエラー" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "スタックオーãƒãƒ¼ãƒ•ロー" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "書ãè¾¼ã¿ã‚¨ãƒ©ãƒ¼" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "対応ãŒã¨ã‚Œã¦ã„ãªã„ [ ã§ã™" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "ç„¡åŠ¹ãªæ–‡å­—クラスåã§ã™" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "æ–‡å­—ã‚¯ãƒ©ã‚¹ã®æ§‹æ–‡ã¯ [[:space:]] ã§ã™ã€‚ [:space:] ã§ã¯ã‚りã¾ã›ã‚“" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "\\ エスケープãŒçµ‚了ã—ã¦ã„ã¾ã›ã‚“" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "\\{\\} ã®ä¸­èº«ãŒç„¡åйã§ã™" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "æ­£è¦è¡¨ç¾ãŒå¤§ãã™ãŽã¾ã™" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "対応ãŒã¨ã‚Œã¦ã„ãªã„ ( ã§ã™" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "æ§‹æ–‡ãŒæŒ‡å®šã•れã¦ã„ã¾ã›ã‚“" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "対応ãŒã¨ã‚Œã¦ã„ãªã„ ) ã§ã™" #: lib/error.c:195 msgid "Unknown system error" msgstr "䏿˜Žãªã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: オプション '%s%s' ã¯æ›–昧ã§ã™\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: オプション '%s%s' ã¯æ›–昧ã§ã™ã€‚次ã®ã‚‚ã®ãŒå¯èƒ½ã§ã™:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: オプション '%s%s' ã‚’èªè­˜ã§ãã¾ã›ã‚“\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: オプション '%s%s' ã¯å¼•æ•°ã‚’å–ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: オプション '%s%s' ã¯å¼•æ•°ãŒå¿…è¦ã§ã™\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: 無効ãªã‚ªãƒ—ション -- '%c'\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: オプションã«ã¯å¼•æ•°ãŒå¿…è¦ã§ã™ -- '%c'\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "ãƒ¡ãƒ¢ãƒªã‚’ä½¿ã„æžœãŸã—ã¾ã—ãŸ" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "ç¾åœ¨ã®ä½œæ¥­ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãƒ¼ã‚’記録ã™ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "åˆæœŸä½œæ¥­ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãƒ¼ã«æˆ»ã‚‹ã®ã«å¤±æ•—ã—ã¾ã—ãŸ" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "ファイル記述å­ã‚’テキスト/ãƒã‚¤ãƒŠãƒªãƒ¢ãƒ¼ãƒ‰ã«è¨­å®šã§ãã¾ã›ã‚“ã§ã—ãŸ" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "æˆåŠŸã§ã™" #: lib/regcomp.c:138 msgid "No match" msgstr "一致ã—ã¾ã›ã‚“" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "ç„¡åŠ¹ãªæ­£è¦è¡¨ç¾ã§ã™" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "無効ãªç…§åˆæ–‡å­—ã§ã™" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "ç„¡åŠ¹ãªæ–‡å­—クラスåã§ã™" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "終端ã®ãƒãƒƒã‚¯ã‚¹ãƒ©ãƒƒã‚·ãƒ¥" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "無効ãªå‰æ–¹å‚ç…§ã§ã™" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[ã€[^ã€[:ã€[.ã€ã¾ãŸã¯ [= ãŒä¸ä¸€è‡´ã§ã™" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( ã¾ãŸã¯ \\( ãŒä¸ä¸€è‡´ã§ã™" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ ãŒä¸ä¸€è‡´ã§ã™" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "\\{\\} ã®ä¸­èº«ãŒç„¡åйã§ã™" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "無効ãªç¯„囲終了ã§ã™" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "ãƒ¡ãƒ¢ãƒªã‚’ä½¿ã„æžœãŸã—ã¾ã—ãŸ" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "無効ãªå‰æ–¹æ­£è¦è¡¨ç¾ã§ã™" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "æ­£è¦è¡¨ç¾ãŒé€”中ã§çµ‚了ã—ã¾ã—ãŸ" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "æ­£è¦è¡¨ç¾ãŒå¤§ãã™ãŽã¾ã™" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") ã¾ãŸã¯ \\) ãŒä¸ä¸€è‡´ã§ã™" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "以å‰ã«æ­£è¦è¡¨ç¾ãŒã‚りã¾ã›ã‚“" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "パッケージ作æˆè€…: %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "パッケージ作æˆè€…: %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, fuzzy, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "\n" "ライセンス GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl." "html>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" "\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "作者 %s。\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "作者 %s ãŠã‚ˆã³ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "作者 %s〠%sã€ãŠã‚ˆã³ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "作者 %s〠%s〠%sã€\n" "ãŠã‚ˆã³ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "作者 %s〠%s〠%sã€\n" "%sã€ãŠã‚ˆã³ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "作者 %s〠%s〠%sã€\n" "%s〠%sã€ãŠã‚ˆã³ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "作者 %s〠%s〠%sã€\n" "%s〠%s〠%sã€ãŠã‚ˆã³ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "作者 %s〠%s〠%sã€\n" "%s〠%s〠%s〠%sã€\n" "ãŠã‚ˆã³ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "作者 %s〠%s〠%sã€\n" "%s〠%s〠%s〠%sã€\n" "%sã€ãŠã‚ˆã³ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "作者 %s〠%s〠%sã€\n" "%s〠%s〠%s〠%sã€\n" "%s〠%s〠ãŠã‚ˆã³ä»–ã®æ–¹ã€…。\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "ãƒã‚°ã‚’発見ã—ãŸã‚‰ <%s> ã«å ±å‘Šã—ã¦ä¸‹ã•ã„。\n" "翻訳ã«é–¢ã™ã‚‹ãƒã‚°ã¯<translation-team-ja@lists.sourceforge.net>ã«å ±å‘Šã—ã¦ãã ã•" "ã„。\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" "%s ã®ãƒã‚°ã‚’発見ã—ãŸã‚‰ <%s> ã«å ±å‘Šã—ã¦ä¸‹ã•ã„。\n" "翻訳ã«é–¢ã™ã‚‹ãƒã‚°ã¯<translation-team-ja@lists.sourceforge.net>ã«å ±å‘Šã—ã¦ãã ã•" "ã„。\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s ã®ãƒ›ãƒ¼ãƒ ãƒšãƒ¼ã‚¸: <%s>\n" #: lib/version-etc.c:260 #, fuzzy, c-format msgid "General help using GNU software: <%s>\n" msgstr "" "GNU ソフトウェアを使用ã™ã‚‹éš›ã®ä¸€èˆ¬çš„ãªãƒ˜ãƒ«ãƒ—: <http://www.gnu.org/gethelp/>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(標準入力)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "一致ã—ãŸå‰å¾Œã®è¡Œã®è¡¨ç¤ºã«é–¢ã™ã‚‹å¼•æ•°ãŒç„¡åйã§ã™" #: src/grep.c:894 msgid "input is too large to count" msgstr "入力ãŒå¤§ãã™ãŽã¦æ•°ãˆã‚‰ã‚Œã¾ã›ã‚“" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "ãƒã‚¤ãƒŠãƒªãƒ•ァイル %s ã«ä¸€è‡´ã—ã¾ã—ãŸ\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "ディレクトリーãŒå†å¸°çš„ループをã—ã¦ã„ã¾ã™" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "入力ファイル %s ãŒå‡ºåŠ›ã«ã‚‚ãªã£ã¦ã„ã¾ã™" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "使用法: %s [OPTION]... PATTERN [FILE]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "詳ã—ãã¯'%s --help'を実行ã—ã¦ãã ã•ã„。\n" #: src/grep.c:1969 #, fuzzy, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "å„ FILE 内㧠PATTERN を検索ã—ã¾ã™ã€‚\n" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "例: %s -i 'hello world' menu.h main.c\n" "\n" "パターンã®é¸æŠžãŠã‚ˆã³è§£é‡ˆ:\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp PATTERN を拡張正è¦è¡¨ç¾ã¨ã™ã‚‹\n" " -F, --fixed-strings PATTERN を改行ã§åŒºåˆ‡ã‚‰ã‚ŒãŸæ–‡å­—列ã®çµ„ã¨ã™ã‚‹\n" " -G, --basic-regexp PATTERN を基本正è¦è¡¨ç¾ã¨ã™ã‚‹(デフォルト)\n" " -P, --perl-regexp PATTERN ã‚’ Perl æ­£è¦è¡¨ç¾ã¨ã™ã‚‹\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=PATTERN 一致処ç†ã« PATTERN を使用ã™ã‚‹\n" " -f, --file=FILE FILE ã‹ã‚‰ PATTERN ã‚’å–å¾—ã™ã‚‹\n" " -i, --ignore-case 大文字ã¨å°æ–‡å­—を区別ã—ãªã„\n" " -w, --word-regexp 強制的ã«å˜èªžå…¨ä½“ã§ PATTERN ã®ä¸€è‡´å‡¦ç†ã‚’行ã†\n" " -x, --line-regexp 強制的ã«è¡Œå…¨ä½“ã§ PATTERN ã®ä¸€è‡´å‡¦ç†ã‚’行ã†\n" " -z, --null-data データã®è¡Œæœ«ã‚’改行ã§ã¯ãªã NULL ã¨ã™ã‚‹\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "ãã®ä»–:\n" " -s, --no-messages エラーメッセージを抑止ã™ã‚‹\n" " -v, --invert-match 一致ã—ãªã„è¡Œã‚’é¸æŠžã™ã‚‹\n" " -V, --version ãƒãƒ¼ã‚¸ãƒ§ãƒ³æƒ…報を表示ã—ã¦çµ‚了ã™ã‚‹\n" " --help ã“ã®ãƒ˜ãƒ«ãƒ—を表示ã—ã¦çµ‚了ã™ã‚‹\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "出力ã®åˆ¶å¾¡:\n" " -m, --max-count=NUM NUM 行一致後ã«ä¸­æ–­ã™ã‚‹\n" " -b, --byte-offset 出力行ã¨ä½µã›ã¦ãƒã‚¤ãƒˆã‚ªãƒ•セットを表示ã™ã‚‹\n" " -n, --line-number 出力行ã¨ä½µã›ã¦è¡Œç•ªå·ã‚’表示ã™ã‚‹\n" " --line-buffered 行ã”ã¨ã«å‡ºåŠ›ã‚’ flush ã™ã‚‹\n" " -H, --with-filename 出力行ã¨ä½µã›ã¦ãƒ•ァイルåを表示ã™ã‚‹\n" " -h, --no-filename 出力ã®å…ˆé ­ã«ãƒ•ァイルåを付ã‘ãªã„\n" " --label=LABEL 標準入力ã®ãƒ•ァイルåã®æŽ¥é ­è¾žã¨ã—㦠LABEL を使用ã™" "ã‚‹\n" #: src/grep.c:2007 #, fuzzy, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching 行ã®ä¸­ã§ PATTERN ã«ä¸€è‡´ã—ãŸéƒ¨åˆ†ã®ã¿è¡¨ç¤ºã™ã‚‹\n" " -q, --quiet, --silent é€šå¸¸å‡ºåŠ›ã‚’å…¨ã¦æŠ‘æ­¢ã™ã‚‹\n" " --binary-files=TYPE ãƒã‚¤ãƒŠãƒªãƒ•ァイルã®å½¢å¼ã‚’ TYPE ã¨ä»®å®šã™ã‚‹\n" " TYPE 㯠'binary'ã€'text' ã¾ãŸã¯ 'without-match'\n" " -a, --text --binary-files=text ã¨ç­‰ä¾¡\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I --binary-files=without-match ã¨ç­‰ä¾¡\n" " -d, --directories=ACTION ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãƒ¼ã®æ‰±ã„方を指定ã™ã‚‹\n" " ACTION 㯠'read'ã€'recurse' ã¾ãŸã¯ 'skip'\n" " -D, --devices=ACTION デãƒã‚¤ã‚¹ã€FIFO ãŠã‚ˆã³ã‚½ã‚±ãƒƒãƒˆã®æ‰±ã„方を指定ã™ã‚‹\n" " ACTION 㯠`read' ã¾ãŸã¯ `skip'\n" " -r, --recursive --directories=recurse ã¨ç­‰ä¾¡\n" " -R, --dereference-recursive 上ã¨åŒæ§˜ã ãŒã‚·ãƒ³ãƒœãƒªãƒƒã‚¯ãƒªãƒ³ã‚¯ã‚’辿る\n" #: src/grep.c:2023 #, fuzzy, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=FILE_PATTERN FILE_PATTERN ã«ä¸€è‡´ã—ãŸãƒ•ァイルã®ã¿æ¤œç´¢ã™ã‚‹\n" " --exclude=FILE_PATTERN FILE_PATTERN 一致ã—ãŸãƒ•ァイル・ディレクトリーを" "スキップã™ã‚‹\n" " --exclude-from=FILE FILE ã‹ã‚‰èª­ã¿è¾¼ã‚“ã ãƒ•ァイルåã®ãƒ‘ターンã«ä¸€è‡´ã™ã‚‹" "ファイルをスキップã™ã‚‹\n" " --exclude-dir=PATTERN PATTERN ã«ä¸€è‡´ã—ãŸãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãƒ¼ã‚’スキップã™ã‚‹\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match PATTERN ã«ä¸€è‡´ã—ãªã„ FILE ã®åå‰ã®ã¿è¡¨ç¤ºã™ã‚‹\n" " -l, --files-with-matches PATTERN ã«ä¸€è‡´ã™ã‚‹ FILE ã®åå‰ã®ã¿è¡¨ç¤ºã™ã‚‹\n" " -c, --count FILE ã”ã¨ã«ä¸€è‡´ã—ãŸè¡Œæ•°ã®ã¿è¡¨ç¤ºã™ã‚‹\n" " -T, --initial-tab タブを使用ã—ã¦æ•´åˆ—ã™ã‚‹ (å¿…è¦ãªå ´åˆ)\n" " -Z, --null FILE ã®åå‰ã‚’表示ã—ãŸå¾Œã«å€¤ãŒ 0 ã®ãƒã‚¤ãƒˆã‚’出力ã™" "ã‚‹\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "å‰å¾Œã®è¡¨ç¤ºã«é–¢ã™ã‚‹åˆ¶å¾¡:\n" " -B, --before-context=NUM 一致ã—ãŸå‰ã® NUM 行を表示ã™ã‚‹\n" " -A, --after-context=NUM 一致ã—ãŸå¾Œã® NUM 行を表示ã™ã‚‹\n" " -C, --context=NUM 一致ã—ãŸå‰å¾Œ NUM 行を表示ã™ã‚‹\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM --context=NUM ã¨ç­‰ä¾¡\n" " --color[=WHEN],\n" " --colour[=WHEN] 一致ã—ãŸæ–‡å­—列をãƒã‚¤ãƒ©ã‚¤ãƒˆã™ã‚‹ãŸã‚ã®å°ã‚’使用ã™" "る。\n" " WHEN 㯠'always'ã€'never' ã¾ãŸã¯ 'auto'\n" " -U, --binary 行末ã«ã‚ã‚‹ CR を削除ã—ãªã„ (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "FILE ㌠'-' ã®å ´åˆã€æ¨™æº–入力ã‹ã‚‰èª­ã¿è¾¼ã¿ã¾ã™ã€‚FILE を指定ã—ãªã„å ´åˆã€ãƒ‡ã‚£ãƒ¬ã‚¯" "トリーをå†å¸°çš„ã«\n" "処ç†ã™ã‚‹å ´åˆã¯ '.'ã€ãれ以外㯠'-' ã¨ãªã‚Šã¾ã™ã€‚FILE ã‚’1個ã ã‘指定ã—ãŸå ´åˆã¯ -" "h も有効ã«ãªã‚Šã¾ã™ã€‚\n" "終了コードã¯ã€è¡ŒãŒé¸æŠžã•れãŸå ´åˆã¯ 0ã€ãれ以外㯠1 ã§ã™ã€‚エラーãŒç™ºç”Ÿã—㦠-q " "を指定ã—ã¦ã„ãªã„\n" "å ´åˆã®çµ‚了コード㯠2 ã«ãªã‚Šã¾ã™ã€‚\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "指定ã—ãŸä¸€è‡´å‡¦ç†ç³»ãŒç«¶åˆã—ã¦ã„ã¾ã™" #: src/grep.c:2101 #, fuzzy msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "ã“ã®ãƒã‚¤ãƒŠãƒªã¯ --disable-perl-regexp 付ãã§ã‚³ãƒ³ãƒ‘イルã•れã¦ã„ã‚‹ãŸã‚ -P オプ" "ションã¯ã‚µãƒãƒ¼ãƒˆã—ã¾ã›ã‚“" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "%s ã¯ç„¡åйãªä¸€è‡´å‡¦ç†ç³»ã§ã™" #: src/grep.c:2538 msgid "unknown devices method" msgstr "デãƒã‚¤ã‚¹ã«å¯¾ã™ã‚‹ä¸æ˜Žãªæ“作ã§ã™" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "無効ãªä¸€è‡´å›žæ•°ã§ã™" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "䏿˜Žãªãƒã‚¤ãƒŠãƒªãƒ•ァイルã®å½¢å¼ã§ã™" #: src/grep.c:2829 #, fuzzy msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "ãã®ä»–ã®æ–¹ã€…㯠<http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS> ã‚’å‚ç…§ã—ã¦" "ãã ã•ã„" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "PCRE JIT スタックã¸ã®ãƒ¡ãƒ¢ãƒªå‰²ã‚Šå½“ã¦ã«å¤±æ•—ã—ã¾ã—ãŸ" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P ã¯1ãƒã‚¤ãƒˆã® UTF-8 ロケールã®ã¿ã‚µãƒãƒ¼ãƒˆã—ã¾ã™" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "-P オプションã¯å˜ä¸€ã®ãƒ‘ターンã—ã‹ã‚µãƒãƒ¼ãƒˆã—ã¾ã›ã‚“" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "内部エラー (決ã—ã¦ç™ºç”Ÿã—ãªã„ã¯ãš)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "PCRE ã®è¡Œé•·åˆ¶é™ã‚’è¶…éŽã—ã¾ã—ãŸ" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "ãƒ¡ãƒ¢ãƒªã‚’ä½¿ã„æžœãŸã—ã¾ã—ãŸ" #: src/pcresearch.c:310 #, fuzzy, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "PCRE JIT ã‚¹ã‚¿ãƒƒã‚¯ã‚’ä½¿ã„æžœãŸã—ã¾ã—ãŸ" #: src/pcresearch.c:315 #, fuzzy, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "PCRE ã®ãƒãƒƒã‚¯ã‚¹ãƒ©ãƒƒã‚·ãƒ¥åˆ¶é™ã‚’è¶…éŽã—ã¾ã—ãŸ" #: src/pcresearch.c:319 #, fuzzy, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "PCRE ã®ãƒãƒƒã‚¯ã‚¹ãƒ©ãƒƒã‚·ãƒ¥åˆ¶é™ã‚’è¶…éŽã—ã¾ã—ãŸ" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "PCRE 内部エラー: %d" #, c-format #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "警告: GREP_OPTIONS ã¯å»ƒæ­¢ã•れã¾ã—ãŸã€‚alias ã¾ãŸã¯ã‚¹ã‚¯ãƒªãƒ—トを使用ã—ã¦ãã " #~ "ã•ã„" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "警告: %s: %s" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "引数 '%3$s' ã«å¯¾ã—㦠%1$s%2$s ãŒç„¡åйã§ã™" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "引数 '%3$s' ã«å¯¾ã—ã¦ç„¡åŠ¹ãªæŽ¥å°¾è¾ž %1$s%2$s ã§ã™" #~ msgid "%s%s argument '%s' too large" #~ msgstr "引数 '%3$s' ã«å¯¾ã™ã‚‹ %1$s%2$s ãŒå¤§ãã™ãŽã¾ã™" #, fuzzy #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "%s ã®ãƒ›ãƒ¼ãƒ ãƒšãƒ¼ã‚¸: <http://www.gnu.org/software/%s/>\n" #~ msgid "internal error" #~ msgstr "内部エラー" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: オプション '--%s' ã¯å¼•æ•°ã‚’å–ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: オプション '--%s' ã‚’èªè­˜ã§ãã¾ã›ã‚“\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: オプション '-W %s' ã¯æ›–昧ã§ã™\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: オプション '-W %s' ã¯å¼•æ•°ã‚’å–ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: オプション '-W %s' ã«ã¯å¼•æ•°ãŒå¿…è¦ã§ã™\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "PATTERN ã¯ãƒ‡ãƒ•ォルトã§ã¯åŸºæœ¬æ­£è¦è¡¨ç¾ (BRE) ã§ã™ã€‚\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "'egrep' 㯠'grep -E' ã‚’æ„味ã—ã¾ã™ã€‚ 'fgrep' 㯠'grep -F' ã‚’æ„味ã—ã¾ã™ã€‚\n" #~ "'egrep' ã¾ãŸã¯ 'fgrep' ã«ã‚ˆã‚‹ç›´æŽ¥èµ·å‹•ã¯å»ƒæ­¢äºˆå®šã§ã™ã€‚\n" #~ msgid "lseek failed" #~ msgstr "lseek ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "unfinished repeat count" #~ msgstr "ç¹°è¿”ã—回数ãŒçµ‚了ã—ã¦ã„ã¾ã›ã‚“" #~ msgid "malformed repeat count" #~ msgstr "䏿­£ãªå½¢å¼ã®ç¹°ã‚Šè¿”ã—回数ã§ã™" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "PATTERN ã¯æ‹¡å¼µæ­£è¦è¡¨ç¾ (ERE) ã§ã™ã€‚\n" #~ msgid "Invocation as `egrep' is deprecated; use `grep -E' instead.\n" #~ msgstr "" #~ "`egrep' ã¨ã„ã†åå‰ã§ã®èµ·å‹•ã¯å»ƒæ­¢äºˆå®šã§ã™ã€‚代ã‚り㫠`grep -E' を使用ã—ã¦ã" #~ "ã ã•ã„。\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "PATTERN ã¯æ”¹è¡Œã§åŒºåˆ‡ã‚‰ã‚ŒãŸå›ºå®šæ–‡å­—列ã®çµ„ã§ã™ã€‚\n" #~ msgid "Invocation as `fgrep' is deprecated; use `grep -F' instead.\n" #~ msgstr "" #~ "`fgrep' ã¨ã„ã†åå‰ã§ã®èµ·å‹•ã¯å»ƒæ­¢äºˆå®šã§ã™ã€‚代ã‚り㫠`grep -F' を使用ã—ã¦ã" #~ "ã ã•ã„。\n" #~ msgid "writing output" #~ msgstr "å‡ºåŠ›ã®æ›¸è¾¼ã¿" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "GNU Grep ã®ãƒ›ãƒ¼ãƒ ãƒšãƒ¼ã‚¸: <%s>\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s 㯠%s ãƒ‘ã‚¿ãƒ¼ãƒ³æ§‹æ–‡ã®æ™‚ã®ã¿ä½¿ç”¨ã§ãã¾ã™" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "GREP_COLORS=\"%s\" ã«ãŠã„ã¦ã€\"%s\" ã«ã¯å€¤ã®ä»£å…¥ (\"=...\") ãŒå¿…è¦ã§ã™ã€‚ス" #~ "キップã—ã¾ã—ãŸ" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "GREP_COLORS=\"%s\" ã«ãŠã„ã¦ã€\"%s\" ã¯çœŸå½å€¤ã§ã‚り値を代入 (\"=%s\") ã™ã‚‹" #~ "ã“ã¨ã¯ã§ãã¾ã›ã‚“。スキップã—ã¾ã—ãŸ" #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "GREP_COLORS=\"%s\" ã«ãŠã„㦠\"%s\" 㯠%s ã§ã™" #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "GREP_COLORS=\"%s\" ã®å½¢å¼ã«èª¤ã‚ŠãŒã‚ã‚‹ãŸã‚処ç†ã‚’中止ã—ã¾ã—ãŸã€‚残りã®éƒ¨åˆ†æ–‡" #~ "字列㯠\"%s\" ã§ã™" #~ msgid "ARGP_HELP_FMT: %s value is less than or equal to %s" #~ msgstr "ARGP_HELP_FMT: %s ã®å€¤ã¯ %s ã®å€¤ä»¥ä¸‹ã§ã™" #~ msgid "%.*s: ARGP_HELP_FMT parameter requires a value" #~ msgstr "%.*s: ARGP_HELP_FMT パラメータã«ã¯å€¤ãŒå¿…è¦ã§ã™" #~ msgid "%.*s: ARGP_HELP_FMT parameter must be positive" #~ msgstr "%.*s: ARGP_HELP_FMT ãƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ã¯æ­£ã®å€¤ã§ãªã‘れã°ã„ã‘ã¾ã›ã‚“" #~ msgid "%.*s: Unknown ARGP_HELP_FMT parameter" #~ msgstr "%.*s: 䏿˜Žãª ARGP_HELP_FMT パラメータ" #~ msgid "Garbage in ARGP_HELP_FMT: %s" #~ msgstr "ARGP_HELP_FMT 中ã«ã”ã¿ãŒã‚りã¾ã™: %s" #~ msgid "" #~ "Mandatory or optional arguments to long options are also mandatory or " #~ "optional for any corresponding short options." #~ msgstr "" #~ "é•·ã„å½¢å¼ã®ã‚ªãƒ—ションã§å¿…é ˆã¾ãŸã¯ä»»æ„ã®å¼•æ•°ã¯ã€ãれã«å¯¾å¿œã™ã‚‹çŸ­ã„å½¢å¼ã®ã‚ªãƒ—" #~ "ションã§ã‚‚åŒæ§˜ã«å¿…é ˆã¾ãŸã¯ä»»æ„ã§ã™ã€‚" #~ msgid "Usage:" #~ msgstr "使用法:" #~ msgid " or: " #~ msgstr "ã¾ãŸã¯: " #~ msgid " [OPTION...]" #~ msgstr " [OPTION...]" #~ msgid "Report bugs to %s.\n" #~ msgstr "ãƒã‚°ã‚’発見ã—ãŸã‚‰ %s å®›ã«å ±å‘Šã—ã¦ä¸‹ã•ã„。\n" #~ msgid "give this help list" #~ msgstr "ã“ã®ãƒ˜ãƒ«ãƒ—を表示ã™ã‚‹" #~ msgid "give a short usage message" #~ msgstr "短ã„使用方法を表示ã™ã‚‹" #~ msgid "NAME" #~ msgstr "åå‰" #~ msgid "set the program name" #~ msgstr "プログラムåを設定ã™ã‚‹" #~ msgid "SECS" #~ msgstr "SECS" #~ msgid "hang for SECS seconds (default 3600)" #~ msgstr "SECS ç§’ã§ãƒãƒ³ã‚° (デフォルト 3600)" #~ msgid "print program version" #~ msgstr "プログラムã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã‚’表示ã™ã‚‹" #~ msgid "(PROGRAM ERROR) No version known!?" #~ msgstr "(プログラムエラー) 䏿˜Žãªãƒãƒ¼ã‚¸ãƒ§ãƒ³!?" #~ msgid "%s: Too many arguments\n" #~ msgstr "%s: 引数ãŒå¤šã™ãŽã¾ã™\n" #~ msgid "(PROGRAM ERROR) Option should have been recognized!?" #~ msgstr "(プログラムエラー) オプションã¯èªè­˜ã•れã¦ã„ã‚‹ã¹ãã§ã™!?" #~ msgid "cannot find a temporary directory, try setting $TMPDIR" #~ msgstr "一時ディレクトリを作æˆã§ãã¾ã›ã‚“。 $TMPDIR を設定ã—ã¦ã¿ã¦ãã ã•ã„" #~ msgid "cannot create a temporary directory using template \"%s\"" #~ msgstr "テンプレート \"%s\" を使用ã—ãŸä¸€æ™‚ディレクトリを作æˆã§ãã¾ã›ã‚“" #~ msgid "cannot remove temporary file %s" #~ msgstr "一時ファイル %s を削除ã§ãã¾ã›ã‚“" #~ msgid "cannot remove temporary directory %s" #~ msgstr "一時ディレクトリ %s を削除ã§ãã¾ã›ã‚“" #~ msgid "error closing file" #~ msgstr "ファイルクローズエラー" #~ msgid "preserving permissions for %s" #~ msgstr "%s ã®ãƒ‘ーミッションをä¿å­˜ã—ã¦ã„ã¾ã™" #~ msgid "error while opening \"%s\" for reading" #~ msgstr "\"%s\"を読込むãŸã‚é–‹ã„ã¦ã„ã‚‹éš›ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ" #~ msgid "cannot open backup file \"%s\" for writing" #~ msgstr "書込ã¿ç”¨ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ファイル\"%s\"ã‚’é–‹ãã“ã¨ãŒã§ãã¾ã›ã‚“" #~ msgid "error reading \"%s\"" #~ msgstr "\"%s\"ã®èª­è¾¼ã¿ä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ" #~ msgid "error writing \"%s\"" #~ msgstr "\"%s\"ã®æ›¸è¾¼ã¿ä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ" #~ msgid "error after reading \"%s\"" #~ msgstr "\"%s\"ã®èª­è¾¼ã¿å¾Œã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ" #~ msgid "fdopen() failed" #~ msgstr "fdopen()ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "C# compiler not found, try installing pnet" #~ msgstr "C# コンパイラãŒè¦‹ã¤ã‚Šã¾ã›ã‚“。pnet をインストールã—ã¦ã¿ã¦ãã ã•ã„" #~ msgid "C# virtual machine not found, try installing pnet" #~ msgstr "C# 仮想マシンãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“。pnet をインストールã—ã¦ã¿ã¦ãã ã•ã„" #~ msgid "%s subprocess failed" #~ msgstr "%s サブプロセスãŒå¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "regular empty file" #~ msgstr "通常ã®ç©ºãƒ•ァイル" #~ msgid "regular file" #~ msgstr "通常ファイル" #~ msgid "directory" #~ msgstr "ディレクトリ" #~ msgid "block special file" #~ msgstr "ブロックスペシャルファイル" #~ msgid "character special file" #~ msgstr "キャラクタスペシャルファイル" #~ msgid "fifo" #~ msgstr "fifo" #~ msgid "symbolic link" #~ msgstr "シンボリックリンク" #~ msgid "socket" #~ msgstr "ソケット" #~ msgid "message queue" #~ msgstr "メッセージキュー" #~ msgid "semaphore" #~ msgstr "セマフォ" #~ msgid "shared memory object" #~ msgstr "共有メモリオブジェクト" #~ msgid "typed memory object" #~ msgstr "型付メモリオブジェクト" #~ msgid "weird file" #~ msgstr "䏿˜Žãªãƒ•ァイル" #~ msgid "Address family for hostname not supported" #~ msgstr "ホストåã«å¯¾ã™ã‚‹ Address family ãŒã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“" #~ msgid "Temporary failure in name resolution" #~ msgstr "åå‰è§£æ±ºã«ä¸€æ™‚çš„ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "Bad value for ai_flags" #~ msgstr "ai_flags ã«å¯¾ã™ã‚‹èª¤ã£ãŸå€¤ã§ã™" #~ msgid "Non-recoverable failure in name resolution" #~ msgstr "åå‰è§£æ±ºã§ãƒªã‚«ãƒãƒªã§ããªã„失敗ãŒç™ºç”Ÿã—ã¾ã—ãŸ" #~ msgid "ai_family not supported" #~ msgstr "ai_family ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“" #~ msgid "Memory allocation failure" #~ msgstr "メモリé…ç½®ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "No address associated with hostname" #~ msgstr "ホストåã«ã‚¢ãƒ‰ãƒ¬ã‚¹ãŒå‰²ã‚Šå½“ã¦ã‚‰ã‚Œã¦ã„ã¾ã›ã‚“" #~ msgid "Name or service not known" #~ msgstr "åå‰ã¾ãŸã¯ã‚µãƒ¼ãƒ“スãŒä¸æ˜Žã§ã™" #~ msgid "Servname not supported for ai_socktype" #~ msgstr "ai_socktype ã«å¯¾ã—㦠Servname ãŒã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“" #~ msgid "ai_socktype not supported" #~ msgstr "ai_socktype ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“" #~ msgid "System error" #~ msgstr "システムエラー" #~ msgid "Argument buffer too small" #~ msgstr "引数ãƒãƒƒãƒ•ã‚¡ãŒå°ã•ã™ãŽã¾ã™" #~ msgid "Processing request in progress" #~ msgstr "è¦æ±‚ã•れãŸå‡¦ç†ã¯å®Ÿè¡Œä¸­ã§ã™" #~ msgid "Request canceled" #~ msgstr "è¦æ±‚ãŒã‚­ãƒ£ãƒ³ã‚»ãƒ«ã•れã¾ã—ãŸ" #~ msgid "Request not canceled" #~ msgstr "è¦æ±‚ãŒã‚­ãƒ£ãƒ³ã‚»ãƒ«ã•れã¾ã›ã‚“ã§ã—ãŸ" #~ msgid "All requests done" #~ msgstr "ã™ã¹ã¦ã®è¦æ±‚ãŒå®Œäº†ã—ã¾ã—ãŸ" #~ msgid "Interrupted by a signal" #~ msgstr "シグナル割り込ã¿ãŒç™ºç”Ÿã—ã¾ã—ãŸ" #~ msgid "Parameter string not correctly encoded" #~ msgstr "ãƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ãƒ¼æ–‡å­—åˆ—ãŒæ­£ã—ãエンコードã•れã¦ã„ã¾ã›ã‚“" #~ msgid "Unknown error" #~ msgstr "䏿˜Žãªã‚¨ãƒ©ãƒ¼" #~ msgid "invalid source_version argument to compile_java_class" #~ msgstr "compile_java_class ã¸ã® source_version 引数ãŒç„¡åйã§ã™" #~ msgid "invalid target_version argument to compile_java_class" #~ msgstr "compile_java_class ã¸ã® target_version 引数ãŒç„¡åйã§ã™" #~ msgid "failed to create \"%s\"" #~ msgstr "\"%s\" ã®ä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "error while writing \"%s\" file" #~ msgstr "\"%s\" ãƒ•ã‚¡ã‚¤ãƒ«ã®æ›¸ãè¾¼ã¿ä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ" #~ msgid "Java compiler not found, try installing gcj or set $JAVAC" #~ msgstr "" #~ "Java コンパイラãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“。 gcj をインストールã™ã‚‹ã‹ã€ã¾ãŸã¯t " #~ "$JAVAC を設定ã—ã¦ã¿ã¦ãã ã•ã„" #~ msgid "Java virtual machine not found, try installing gij or set $JAVA" #~ msgstr "" #~ "Java 仮想マシンãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“。 gij をインストールã™ã‚‹ã‹ã€ã¾ãŸã¯ $JAVA " #~ "を設定ã—ã¦ã¿ã¦ãã ã•ã„" #~ msgid "%s subprocess I/O error" #~ msgstr "%s サブプロセス I/O エラー" #~ msgid "cannot change permissions of %s" #~ msgstr "%s ã®ãƒ‘ーミッションを変更ã§ãã¾ã›ã‚“" #~ msgid "cannot create directory %s" #~ msgstr "ディレクトリ %s を作æˆã§ãã¾ã›ã‚“" #~ msgid "Failed to open /dev/zero for read" #~ msgstr "/dev/zeroを読込ã¿ç”¨ã«é–‹ã‘ã¾ã›ã‚“" #~ msgid "creation of reading thread failed" #~ msgstr "読ã¿è¾¼ã¿ã‚¹ãƒ¬ãƒƒãƒ‰ã®ä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "cannot set up nonblocking I/O to %s subprocess" #~ msgstr "%s å­ãƒ—ロセスã¸éžãƒ–ロック I/O を設定ã§ãã¾ã›ã‚“" #~ msgid "communication with %s subprocess failed" #~ msgstr "%s å­ãƒ—ロセスã¨ã®é€šä¿¡ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "write to %s subprocess failed" #~ msgstr "%s å­ãƒ—ロセスã¸ã®æ›¸ãè¾¼ã¿ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "read from %s subprocess failed" #~ msgstr "%s å­ãƒ—ロセスã‹ã‚‰ã®èª­ã¿è¾¼ã¿ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "subprocess %s terminated with exit code %d" #~ msgstr "å­ãƒ—ロセス %s ãŒçµ‚了コード %d ã§çµ‚了ã—ã¾ã—ãŸ" #~ msgid "creation of threads failed" #~ msgstr "スレッドã®ä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "%s subprocess terminated with exit code %d" #~ msgstr "%s å­ãƒ—ロセスãŒçµ‚了コード %d ã§çµ‚了ã—ã¾ã—ãŸ" #~ msgid "cannot create pipe" #~ msgstr "パイプを作æˆã§ãã¾ã›ã‚“" #~ msgid "^[yY]" #~ msgstr "^[yY]" #~ msgid "^[nN]" #~ msgstr "^[nN]" #~ msgid "setting permissions for %s" #~ msgstr "%s ã®ãƒ‘ーミッションを設定ã—ã¾ã™" #~ msgid "Hangup" #~ msgstr "Hangup" #~ msgid "Interrupt" #~ msgstr "割り込ã¿" #~ msgid "Quit" #~ msgstr "終了" #~ msgid "Illegal instruction" #~ msgstr "Illegal instruction" #~ msgid "Trace/breakpoint trap" #~ msgstr "Trace/breakpoint trap" #~ msgid "Aborted" #~ msgstr "中止" #~ msgid "Floating point exception" #~ msgstr "æµ®å‹•å°æ•°ç‚¹ä¾‹å¤–" #~ msgid "Killed" #~ msgstr "強制終了" #~ msgid "Bus error" #~ msgstr "ãƒã‚¹ã‚¨ãƒ©ãƒ¼" #~ msgid "Segmentation fault" #~ msgstr "Segmentation fault" #~ msgid "Broken pipe" #~ msgstr "Broken pipe" #~ msgid "Alarm clock" #~ msgstr "Alarm clock" #~ msgid "Terminated" #~ msgstr "Terminated" #~ msgid "Urgent I/O condition" #~ msgstr "緊急 I/O 状態" #~ msgid "Stopped (signal)" #~ msgstr "åœæ­¢ (シグナル)" #~ msgid "Stopped" #~ msgstr "åœæ­¢" #~ msgid "Continued" #~ msgstr "継続" #~ msgid "Child exited" #~ msgstr "å­ãƒ—ロセス終了" #~ msgid "Stopped (tty input)" #~ msgstr "åœæ­¢ (tty 入力)" #~ msgid "Stopped (tty output)" #~ msgstr "åœæ­¢ (tty 出力)" #~ msgid "I/O possible" #~ msgstr "I/O å¯èƒ½" #~ msgid "CPU time limit exceeded" #~ msgstr "CPU時間制é™ã‚’è¶…éŽã—ã¾ã—ãŸ" #~ msgid "File size limit exceeded" #~ msgstr "ファイルサイズ制é™ã‚’è¶…éŽã—ã¾ã—ãŸ" #~ msgid "Virtual timer expired" #~ msgstr "仮想タイマーãŒçµ‚了ã—ã¾ã—ãŸ" #~ msgid "Profiling timer expired" #~ msgstr "プロファイリングタイマーãŒçµ‚了ã—ã¾ã—ãŸ" #~ msgid "Window changed" #~ msgstr "Window ãŒå¤‰æ›´ã•れã¾ã—ãŸ" #~ msgid "User defined signal 1" #~ msgstr "ユーザー定義シグナル1" #~ msgid "User defined signal 2" #~ msgstr "ユーザー定義シグナル2" #~ msgid "EMT trap" #~ msgstr "EMT トラップ" #~ msgid "Bad system call" #~ msgstr "é–“é•ã£ãŸã‚·ã‚¹ãƒ†ãƒ ã‚³ãƒ¼ãƒ«" #~ msgid "Stack fault" #~ msgstr "スタックエラー" #~ msgid "Information request" #~ msgstr "æƒ…å ±è¦æ±‚" #~ msgid "Power failure" #~ msgstr "é›»æºã‚¨ãƒ©ãƒ¼" #~ msgid "Resource lost" #~ msgstr "リソースãŒç„¡ããªã‚Šã¾ã—ãŸ" #~ msgid "error writing to a closed pipe or socket" #~ msgstr "é–‰ã˜ãŸãƒ‘イプã¾ãŸã¯ã‚½ã‚±ãƒƒãƒˆã¸ã®æ›¸ãè¾¼ã¿ã§ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ" #~ msgid "Real-time signal %d" #~ msgstr "リアルタイムシグナル %d" #~ msgid "Unknown signal %d" #~ msgstr "䏿˜Žãªã‚·ã‚°ãƒŠãƒ« %d" #~ msgid "iconv function not usable" #~ msgstr "iconv 関数ãŒä½¿ãˆã¾ã›ã‚“" #~ msgid "iconv function not available" #~ msgstr "iconv é–¢æ•°ãŒæœ‰åйã§ã¯ã‚りã¾ã›ã‚“" #~ msgid "character out of range" #~ msgstr "ç¯„å›²å¤–ã®æ–‡å­—" #~ msgid "cannot convert U+%04X to local character set" #~ msgstr "U+%04X をローカル文字セットã«å¤‰æ›ã§ãã¾ã›ã‚“" #~ msgid "cannot convert U+%04X to local character set: %s" #~ msgstr "U+%04X をローカル文字セット %s ã«å¤‰æ›ã§ãã¾ã›ã‚“" #~ msgid "invalid spec" #~ msgstr "ç„¡åŠ¹ãªæŒ‡å®š" #~ msgid "unable to display error message" #~ msgstr "エラーメッセージを表示ã§ãã¾ã›ã‚“" #~ msgid "_open_osfhandle failed" #~ msgstr "_open_osfhandle ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "cannot restore fd %d: dup2 failed" #~ msgstr "ãƒ•ã‚¡ã‚¤ãƒ«è¨˜è¿°å­ (fd) %d をリストアã§ãã¾ã›ã‚“: dup2 ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "%s subprocess" #~ msgstr "%s å­ãƒ—ロセス" #~ msgid "%s subprocess got fatal signal %d" #~ msgstr "%s å­ãƒ—ロセスãŒè‡´å‘½çš„ãªã‚·ã‚°ãƒŠãƒ« %d ã‚’å—ä¿¡ã—ã¾ã—ãŸ" #~ msgid "stdin" #~ msgstr "標準入力" #~ msgid "stdout" #~ msgstr "標準出力" #~ msgid "stderr" #~ msgstr "標準エラー出力" #~ msgid "unknown stream" #~ msgstr "䏿˜Žãªã‚¹ãƒˆãƒªãƒ¼ãƒ " #~ msgid "failed to reopen %s with mode %s" #~ msgstr "%s をモード %s ã§å†åº¦é–‹ãã“ã¨ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "string comparison failed" #~ msgstr "æ–‡å­—åˆ—ã®æ¯”較ã«å¤±æ•—ã—ã¾ã—ãŸ" #~ msgid "Set LC_ALL='C' to work around the problem." #~ msgstr "å•題を回é¿ã™ã‚‹ãŸã‚ã« LC_ALL='C' を指定ã—ã¦ãã ã•ã„." #~ msgid "The strings compared were %s and %s." #~ msgstr "比較ã—ãŸæ–‡å­—列㯠%s 㨠%s ã§ã™." #~ msgid "cannot perform formatted output" #~ msgstr "書å¼è¨­å®šã‚’行ã£ãŸå‡ºåŠ›ã‚’å®Ÿè¡Œã™ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: 䏿­£ãªã‚ªãƒ—ション -- %c\n" #~ msgid "block size" #~ msgstr "ブロックサイズ" #~ msgid "%s exists but is not a directory" #~ msgstr "%s ã¯å­˜åœ¨ã—ã¾ã™ãŒãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã§ã¯ã‚りã¾ã›ã‚“" #~ msgid "cannot change owner and/or group of %s" #~ msgstr "%s ã®ã‚ªãƒ¼ãƒŠãƒ¼ã¨ã‚°ãƒ«ãƒ¼ãƒ—を変更ã§ãã¾ã›ã‚“" #~ msgid "cannot chdir to directory %s" #~ msgstr "ディレクトリ %s ã«ç§»å‹•ã§ãã¾ã›ã‚“" #~ msgid "cannot get the login group of a numeric UID" #~ msgstr "æ•°å­—ã®UIDã®ãƒ­ã‚°ã‚¤ãƒ³ã‚°ãƒ«ãƒ¼ãƒ—ã‚’å–å¾—ã§ãã¾ã›ã‚“" #~ msgid "" #~ "\n" #~ "This is free software. You may redistribute copies of it under the terms " #~ "of\n" #~ "the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.\n" #~ "There is NO WARRANTY, to the extent permitted by law.\n" #~ "\n" #~ msgstr "" #~ "\n" #~ "本プログラムã¯ãƒ•リーソフトウェアã§ã™. GNU一般公有使用許諾\n" #~ "<http://www.gnu.org/licenses/gpl.html> ã§å®šã‚ã‚‰ã‚ŒãŸæ¡é …ã®ä¸‹ã§æœ¬ãƒ—ログラ\n" #~ "ムã®ã‚³ãƒ”ーをå†é…布ã§ãã¾ã™. é©åˆ‡ãªæ³•ãŒèªã‚‹é™ã‚Šã«ãŠã„ã¦å…¨ãã®ç„¡ä¿è¨¼ã§ã™.\n" #~ "\n" #~ msgid "out of memory" #~ msgstr "メモリーãŒãªããªã‚Šã¾ã—ãŸ" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "使用法: %s [オプション]‥‥ パターン [ファイル] ‥‥\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "出力制御:\n" #~ " -m, --max-count=回数 指定ã—ãŸä¸€è‡´å›žæ•°ã®å¾Œã€çµ‚了ã™ã‚‹\n" #~ " -b, --byte-offset 出力行ã«ãƒã‚¤ãƒˆãƒ»ã‚ªãƒ•セットも表示ã™ã‚‹\n" #~ " -n, --line-number 出力行ã«è¡Œæ•°ã‚‚表示ã™ã‚‹\n" #~ " --line-buffered 行ã”ã¨ã«å‡ºåŠ›ã‚’æŽƒã出ã™\n" #~ " -H, --with-filename å„一致ã«ãŸã„ã—ã¦ãã®ãƒ•ァイルåも表示ã™ã‚‹\n" #~ " -h, --no-filename å‰ã®ãƒ•ァイルåを出力ã‹ã‚‰æŠ‘æ­¢ã™ã‚‹\n" #~ " --label=ラベル ラベルをファイルåã¨ã—ã¦æ¨™æº–出力ã«è¡¨ç¤ºã™ã‚‹\n" #~ " -o, --only-matching パターンã¨ä¸€è‡´ã™ã‚‹è¡Œã®éƒ¨åˆ†ã ã‘を示ã™\n" #~ " -q, --quiet, --silent 通常ã®å‡ºåŠ›ã‚’ã™ã¹ã¦æŠ‘æ­¢ã™ã‚‹\n" #~ " --binary-files=åž‹ ãƒã‚¤ãƒŠãƒªãƒ¼ãƒ»ãƒ•ァイルã®åž‹ã€‚「binaryã€\n" #~ " 「textã€ã€Œwithout-matchã€ã‚’指定\n" #~ " -a, --text --binary-files=textã¨åŒã˜\n" #~ " -I --binary-files=without-matchã¨åŒã˜\n" #~ " -d, --directories=æ“作 ディレクトリーã¸ã®æ“作\n" #~ " 「readã€(読込ã¿)ã€ã€Œrecurseã€(å†å¸°)ã€\n" #~ " 「skipã€(çœç•¥) ã®ã„ãšã‚Œã‹ã‚’指定\n" #~ " -D, --devices=æ“作 デãƒã‚¤ã‚¹ã€FIFOã€ã‚½ã‚±ãƒƒãƒˆã¸ã®æ“作\n" #~ " 「readã€ã‹ã€Œskipã€ã‚’指定\n" #~ " -R, -r, --recursive --directories=recurseã¨åŒã˜\n" #~ " --include=パターン パターンã¨ä¸€è‡´ã™ã‚‹ãƒ•ァイルを検査ã™ã‚‹\n" #~ " --exclude=パターン パターンã¨ä¸€è‡´ã™ã‚‹ãƒ•ァイルをçœç•¥ã™ã‚‹ã€‚\n" #~ " --exclude-from=ファイル 指定ã—ãŸãƒ•ァイル内ã®ãƒ‘ターンã¨\n" #~ " 一致ã™ã‚‹ãƒ•ァイルをçœç•¥ã™ã‚‹ã€‚\n" #~ " -L, --files-without-match 一致ã®ãªã‹ã£ãŸãƒ•ァイルåã®ã¿ã‚’表示ã™ã‚‹\n" #~ " -l, --files-with-matches 一致ã—ãŸãƒ•ァイルåã®ã¿ã‚’表示ã™ã‚‹\n" #~ " -c, --count ファイルã”ã¨ã«ä¸€è‡´ã—ãŸè¡Œæ•°ã®ã¿ã‚’表示ã™ã‚‹\n" #~ " -Z, --null ファイルåã®å¾Œã«ã€ãƒŒãƒ«å€¤ã®ãƒã‚¤ãƒˆã‚’表示\n" #~ msgid "" #~ "\n" #~ "Report bugs to <bug-gnu-utils@gnu.org>.\n" #~ msgstr "" #~ "\n" #~ "ãƒã‚°ã¯ <bug-gnu-utils@gnu.org> ã¸å ±å‘Šã—ã¦ãã ã•ã„。\n" #~ msgid "unknown directories method" #~ msgstr "未知ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãƒ¼æ“作ã§ã™" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "ã“れã¯ãƒ•リー・ソフトウェアã§ã™ã€‚複製ã«é–¢ã™ã‚‹æ¡ä»¶ã¯ã‚½ãƒ¼ã‚¹ã‚’ã”覧ãã ã•ã„。\n" #~ "ã“れã¯ç„¡ä¿è¨¼ã§ã™ã€‚営利目的やã‚る特定ã®ç›®çš„ã«ã‚€ã‘ãŸé©æ­£ã®ã‚‚ã®ã§ã‚‚ã‚りã¾ã›" #~ "ん。\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "-Pã¨-zã®ã‚ªãƒ—ションã®çµ„åˆã›ã¯ã§ãã¾ã›ã‚“" ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/sr.po�����������������������������������������������������������������������0000664�0001750�0001750�00000074477�14670377471�016077� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Serbian translation of grep # Copyright © 2020 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Danilo Segan <dsegan@gmx.net>, 2003. # МироÑлав Ðиколић <miroslavnikolic@rocketmail.com>, 2011—2020. msgid "" msgstr "" "Project-Id-Version: grep-3.5.16\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2020-11-05 13:11+0200\n" "Last-Translator: МироÑлав Ðиколић <miroslavnikolic@rocketmail.com>\n" "Language-Team: Serbian <(nothing)>\n" "Language: sr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "неиÑправан аргумент „%s“ за „%s“" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "нејаÑан аргумент „%s“ за „%s“" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "ИÑправни аргументи Ñу:" #: lib/c-stack.c:187 msgid "program error" msgstr "грешка програма" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "прекорачење Ñпремника" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "грешка пиÑања" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "неуравнотежена [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "неиÑправна клаÑа знака" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "ÑинтакÑа клаÑе знака је [[:размак:]], а не [:размак:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "недовршена \\ излазим" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "неиÑправан Ñадржај \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "регуларни израз је превелик" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "неуравнотежена (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "ÑинтакÑа није наведена" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "неуравнотежена )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Ðепозната ÑиÑтемÑка грешка" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: опција „%s%s“ је нејаÑна\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: опција „%s%s“ је нејаÑна; могућноÑти:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: непрепознатљива опција „%s%s“\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: опција „%s%s“ не дозвољава аргумент\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: опција „%s%s“ захтева аргумент\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: неиÑправна опција —— „%c“\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: опција захтева аргумент —— „%c“\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "меморија је потрошена" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "не могу да Ñнимим тренутни радни директоријум" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "не могу да Ñе вратим у почетни радни директоријум" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "ниÑам уÑпео да подеÑим текÑтуални/бинарни режим опиÑника датотеке" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "„" #: lib/quotearg.c:356 msgid "'" msgstr "“" #: lib/regcomp.c:135 msgid "Success" msgstr "УÑпешно" #: lib/regcomp.c:138 msgid "No match" msgstr "Ðема подударања" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "ÐеиÑправан регуларан израз" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "ÐеиÑправан знак поретка" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "ÐеиÑправан назив клаÑе знака" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Водећа контра коÑа црта" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "ÐеиÑправна повратна референца" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Ðе одговара [, [^, [:, [., или [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Ðе одговара ( или \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Ðе одговара \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "ÐеиÑправан Ñадржај \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "ÐеиÑправан крај опÑега" # иÑцрпљена? ;-) #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Меморија је потрошена" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "ÐеиÑправан регуларан израз који претходи" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Прерани крај регуларног израза" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Регуларни израз је превелик" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Ðе одговара ) или \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Ðема претходног регуларног израза" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Запаковао је %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Запаковао је %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Лиценца ОЈЛв3+: Гнуова ОЈЛ 3. издање или новије <%s>.\n" "Ово је Ñлободан Ñофтвер: Ñлободни Ñте да га мењате и раÑподељујете.\n" "Ðе поÑтоји ÐИКÐКВРГÐРÐÐЦИЈÐ, у оквирима дозвољеним законом.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "ÐапиÑао је %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "ÐапиÑали Ñу %s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "ÐапиÑали Ñу %s, %s, и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "ÐапиÑали Ñу %s, %s, %s,\n" "и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "ÐапиÑали Ñу %s, %s, %s,\n" "%s, и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "ÐапиÑали Ñу %s, %s, %s,\n" "%s, %s, и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "ÐапиÑали Ñу %s, %s, %s,\n" "%s, %s, %s, и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "ÐапиÑали Ñу %s, %s, %s,\n" "%s, %s, %s, %s,\n" "и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "ÐапиÑали Ñу %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "ÐапиÑали Ñу %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, и други.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Грешке пријавите на: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Грешке %s пријавите на: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s матична Ñтраница: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Општа помоћ за Гнуов Ñофтвер: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(Ñтандардни улаз)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "неиÑправан аргумент дужине контекÑта" #: src/grep.c:894 msgid "input is too large to count" msgstr "улаз је превелик за пребројавање" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: бинарна датотека одговара" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: дубинÑко вртење кроз директоријуме" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: улазна датотека је такође излаз" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Употреба: %s [ОПЦИЈÐ]... ШÐБЛОÐИ [ДÐТОТЕКÐ]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Пробајте „%s --help“ за више података.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Тражи наведене ШÐБЛОÐЕ у Ñвакој ДÐТОТЕЦИ.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Пример: %s -i „hello world“ menu.h main.c\n" "ШÐБЛОÐИ може да Ñадржи више шаблона раздвојених новим редовима.\n" "\n" "Одељак шаблона и тумачења:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp ШÐБЛОÐИ Ñу проширени регуларни изрази\n" " -F, --fixed-strings ШÐБЛОÐИ Ñу ниÑк\n" " -G, --basic-regexp ШÐБЛОÐИ Ñу оÑновни регуларни изрази\n" " -P, --perl-regexp ШÐБЛОÐИ Ñу регуларни изрази Перла\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=ШÐБЛОÐИ кориÑти ШÐБЛОÐЕ за подударање\n" " -f, --file=ДÐТОТЕКРпреузима ШÐБЛОÐЕ из ДÐТОТЕКЕ\n" " -i, --ignore-case занемарује разлике величине Ñлова у " "шаблонима и подацима\n" " --no-ignore-case не занемарује разлике величине Ñлова " "(оÑновно)\n" " -w, --word-regexp подудара једино целе речи\n" " -x, --line-regexp подудара једино целе редове\n" " -z, --null-data ред података Ñе завршава 0-бајтом, не " "новим редом\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Разно:\n" " -s, --no-messages иÑкључује поруке о грешкама\n" " -v, --invert-match бира не-одговарајуће редове\n" " -V, --version иÑпиÑује податке о издању и излази\n" " --help приказује ову помоћ и излази\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Излазне контроле:\n" " -m, --max-count=БРОЈ зауÑтавља након БРОЈРизабраних редова\n" " -b, --byte-offset иÑпиÑује померај бајта уз редове излаза\n" " -n, --line-number иÑпиÑује број реда уз редове излаза\n" " --line-buffered претаче излаз на Ñваком реду\n" " -H, --with-filename иÑпиÑује назив датотеке Ñа редовима " "излаза\n" " -h, --no-filename потиÑкује додавање префикÑа називу " "датотеке на излазу\n" " --label=ÐÐТПИС кориÑти ÐÐТПИС као Ð¿Ñ€ÐµÑ„Ð¸ÐºÑ Ð½Ð°Ð·Ð¸Ð²Ð° датотеке " "Ñтандардног улаза\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching приказује Ñамо непразне делове редова који " "одговарају\n" " -q, --quiet, --silent потиÑкује Ñве нормалне излазе\n" " --binary-files=ВРСТРÑматра да Ñу извршне датотеке ВРСТЕ;\n" " ВРСТРможе бити „binary“, „text“, или " "„without-match“\n" " -a, --text иÑто као и „--binary-files=text“\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I иÑто као и „--binary-files=without-match“\n" " -d, --directories=РÐДЊРкако да рукује директоријумима;\n" " РÐДЊРможе бити „read“, „recurse“, или " "„skip“\n" " -D, --devices=РÐДЊРкако да рукује уређајима, ФИФО-има и " "прикључницама;\n" " РÐДЊРможе бити „read“ или „skip“\n" " -r, --recursive иÑто као и „--directories=recurse“\n" " -R, --dereference-recursive Ñлично, али прати Ñве Ñимболичке везе\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=ОПШТЕ тражи Ñамо датотеке које Ñе поклапају Ñа " "ОПШТЕ (шаблон датотеке)\n" " --exclude=ОПШТЕ преÑкаче датотеке које Ñе поклапају Ñа " "ОПШТЕ\n" " --exclude-from=ДÐТОТЕКРпреÑкаче датотеке које Ñе поклапају Ñа " "било којим шаблоном из ДÐТОТЕКЕ\n" " --exclude-dir=ОПШТЕ преÑкаче директоријуме који Ñе поклапају " "Ñа ОПШТЕ\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match иÑпиÑује Ñамо називе ДÐТОТЕКРбез " "изабраних редова\n" " -l, --files-with-matches иÑпиÑује Ñамо називе ДÐТОТЕКРÑа изабраним " "редовима\n" " -c, --count иÑпиÑује Ñамо број изабраних редова по " "ДÐТОТЕЦИ\n" " -T, --initial-tab помера табове ред горе (ако је потребно)\n" " -Z, --null иÑпиÑује 0-ти бајт након назива ДÐТОТЕКЕ\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Контроле контекÑта:\n" " -B, --before-context=БРОЈ иÑпиÑује БРОЈ редова водећег контекÑта\n" " -A, --after-context=БРОЈ иÑпиÑује БРОЈ редова пратећег контекÑта\n" " -C, --context=БРОЈ иÑпиÑује БРОЈ редова излазног контекÑта\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -БРОЈ иÑто као „--context=БРОЈ“\n" " --color[=КÐДÐ],\n" " --colour[=КÐДÐ] кориÑти обележиваче за иÑтицање " "поклапајућих ниÑки\n" " КÐДРможе бити „always“, „never“ или " "„auto“.\n" " -U, --binary не иÑеца ЦР знакове на крају реда (МСДОС/" "Виндоуз)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Када је ДÐТОТЕКР„-“, чита Ñтандардни улаз. Без ДÐТОТЕКЕ, чита . ако је " "дубинÑки,\n" "у Ñупротном „-“. Са мање од две ДÐТОТЕКЕ, подразумева Ñе „-h“.\n" "Излазно Ñтање је 0 ако је изабран неки ред, у Ñупротном 1;\n" "ако је дошло до неке грешке а „-q“ није дато, онда је излазно Ñтање 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "наведени Ñу трагачи у Ñукобу" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "Поклапање за Перл није подржано у „--disable-perl-regexp“ извршној" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "неиÑправан трагач %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "непознат метод уређаја" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "неиÑправан највећи број" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "непозната врÑта бинарних датотека" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "ÐапиÑали Ñу Мајк Хиртел и други; погледајте\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "ниÑам уÑпео да доделим меморију за ПЦРЕ ÐИТ Ñпремник" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "„-P“ подржава Ñамо једнобајтне и УТФ-8 језике" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "опција „-P“ подржава Ñамо ÑамоÑталне шаблоне" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "унутрашња грешка (не треба никада да Ñе деÑи)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "прекорачено је ограничење дужине реда ПЦРЕ-а" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: меморија је потрошена" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: потрошени ПЦРЕ ЈИТ Ñпремник" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: прекорачено је ПЦРЕ-ово ограничење тражења уназад" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: прекорачено је ограничење ПЦРЕ дубачења" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: унутрашња грешка ПЦРЕ-а: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "упозорење: „GREP_OPTIONS“ је заÑтарело; кориÑтите Ð°Ð»Ð¸Ñ˜Ð°Ñ Ð¸Ð»Ð¸ Ñкрипту" #~ msgid "warning: %s: %s" #~ msgstr "упозорење: %s: %s" #~ msgid "%s home page: <http://www.gnu.org/software/%s/>\n" #~ msgstr "%s матична Ñтраница: <http://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "неиÑправан %s%s аргумент „%s“" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "неиÑправан ÑÑƒÑ„Ð¸ÐºÑ Ñƒ %s%s аргументу „%s“" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s аргумент „%s“ је превелик" #~ msgid "Mike Haertel" #~ msgstr "Мајк Хартел" #~ msgid "internal error" #~ msgstr "унутрашња грешка" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: опција „--%s“ не дозвољава аргумент\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: непрепознатљива опција „--%s“\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: опција „-W %s“ је двоÑмиÑлена\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: опција „-W %s“ не дозвољава аргумент\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: опција „-W %s“ захтева аргумент\n" #~ msgid "lseek failed" #~ msgstr "„lseek“ није уÑпело" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "ШÐБЛОРје, по оÑнови, оÑновни регуларан израз (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "„egrep“ значи „grep -E“. „fgrep“ значи „grep -F“.\n" #~ "Директно призивање као „egrep“ или „fgrep“ није одобрено.\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "непреÑпојено ^ или $ није подржано Ñа „-Pz“" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Матична Ñтраница ГÐУ Грепа: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "неиÑправан низ УТФ-8 бита у улазу" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "ШÐБЛОРје проширени регуларан израз (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "Позив као „egrep“ је заÑтарео; кориÑтите „grep -E“ умеÑто тога.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "ШÐБЛОРје Ñкуп Ñталних низова у новим редовима.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "Позив као „fgrep“ је заÑтарео; кориÑтите „grep -F“ умеÑто тога.\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s може да кориÑти Ñамо %s ÑинтакÑу шаблона" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/fr.po�����������������������������������������������������������������������0000664�0001750�0001750�00000060626�14670377450�016046� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Messages français pour GNU concernant grep. # Copyright © 2002, 2005, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # Michel Robitaille <robitail@IRO.UMontreal.CA>, 2002, 2005. # Nicolas Provost <nprovost@quadriv.com>, 2009, 2010. # Jean-Christophe Helary <jean.christophe.helary@gmail.com>, 2011. # David Prévot <david@tilapin.org>, 2012-2014. # Stéphane Aulery <lkppo@free.fr>, 2016, 2017, 2019, 2020. # msgid "" msgstr "" "Project-Id-Version: GNU grep 3.5.16\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2020-12-15 20:56+0100\n" "Last-Translator: Stéphane Aulery <lkppo@free.fr>\n" "Language-Team: French <traduc@traduc.org>\n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 2.4.2\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "argument %s incorrect pour %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "argument %s ambigu pour %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Les arguments valables sont :" #: lib/c-stack.c:187 msgid "program error" msgstr "erreur du programme" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "débordement de pile" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "erreur d'écriture" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ non apparié" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "classe de caractères incorrecte" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "la syntaxe d'une classe de caractères est [[:space:]], pas [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "séquence d'échappement \\ non terminée" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "contenu de \\{\\} incorrect" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "expression rationnelle trop grande" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( non appariée" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "aucune syntaxe indiquée" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") non appariée" #: lib/error.c:195 msgid "Unknown system error" msgstr "Erreur système inconnue" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s : l'option « %s%s » est ambiguë\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s : l'option « %s%s » est ambiguë ; possibilités :" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s : option « %s%s » non reconnue\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s : l'option « %s%s » n'accepte pas d'argument\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s : l'option « %s%s » nécessite un argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s : option incorrecte — « %c »\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s : l'option nécessite un argument — « %c »\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "mémoire épuisée" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "impossible d'enregistrer le répertoire de travail actuel" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "échec de retour au répertoire initial de travail" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" "l’obtention d’un descripteur de fichier en mode text / binaire a échoué" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "« " #: lib/quotearg.c:356 msgid "'" msgstr " »" #: lib/regcomp.c:135 msgid "Success" msgstr "Réussite" #: lib/regcomp.c:138 msgid "No match" msgstr "Pas de correspondance" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Expression rationnelle incorrecte" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Caractère de collation incorrect" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Nom de classe de caractères incorrect" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Barre oblique inverse finale" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Référence arrière incorrecte" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[, [^, [:, [. ou [= sans correspondance" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( ou \\( sans correspondance" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ sans correspondance" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Contenu de \\{\\} incorrect" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Fin d'intervalle incorrecte" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Mémoire épuisée" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Expression rationnelle précédente incorrecte" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Fin prématurée d'expression rationnelle" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Expression rationnelle trop grande" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") ou \\) sans correspondance" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Pas d'expression rationnelle précédente" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Empaqueté par %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Empaqueté par %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licence GPLv3+: GNU GPL version 3 ou ultérieure <%s>.\n" "Logiciel libre : vous êtes libre de le modifier ou de le redistribuer.\n" "Il n'y a AUCUNE GARANTIE, dans les limites autorisées par la loi.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Écrit par %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Écrit par %s et %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Écrit par %s, %s et %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Écrit par %s, %s, %s,\n" "et %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Écrit par %s, %s, %s,\n" "%s, et %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Écrit par %s, %s, %s,\n" "%s, %s, et %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Écrit par %s, %s, %s,\n" "%s, %s, %s, et %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Écrit par %s, %s, %s,\n" "%s, %s, %s, %s,\n" "et %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Écrit par %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, et %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Écrit par %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, et d'autres.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Signalez toute anomalie à : %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Signalez les anomalies de %s à : %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Page d'accueil de %s : <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Aide globale sur les logiciels GNU : <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(entrée standard)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "argument de longueur de contexte incorrect" #: src/grep.c:894 msgid "input is too large to count" msgstr "taille des données en entrée trop importante pour compter" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s : fichiers binaires correspondent" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s : attention : boucle de répertoire récursive" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s : le fichier d'entrée est aussi le fichier de sortie" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Usage : %s [OPTION]... MOTIFS [FICHIER]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "" "Exécutez « %s --help » pour obtenir des renseignements complémentaires.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Chercher des MOTIFS dans chaque FICHIER.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Exemple : %s -i 'Bonjour, le monde' menu.h main.c\n" "\n" "MOTIFS peut contenir plusieurs motifs séparés par des sauts de ligne.\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp MOTIFS sont des expressions rationnelles " "étendues\n" " -F, --fixed-regexp MOTIFS sont des chaînes\n" " -G, --basic-regexp MOTIFS sont des expressions rationnelles " "ordinaires\n" " -P, --perl-regexp MOTIFS sont des expressions rationnelles Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=MOTIFS utiliser MOTIFS pour la recherche\n" " -f, --file=FICHIER charger les MOTIFS depuis un FICHIER\n" " -i, --ignore-case ignorer la différence de casse des motifs et " "données\n" " -w, --word-regexp rechercher des mots entiers\n" " -x, --line-regexp rechercher des lignes entières\n" " -z, --null-data finir les lignes de données par un octet nul, " "pas une saut de ligne\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Divers :\n" " -s, --no-messages supprimer les messages d'erreur\n" " -v, --invert-match sélectionner les lignes sans correspondance\n" " -V, --version afficher le nom et la version du logiciel\n" " --help afficher l'aide et quitter\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Contrôle de la sortie :\n" " -m, --max-count=NOMBRE arrêter après NOMBRE de ligne sélectionnées\n" " -b, --byte-offset afficher la position en octet avec la sortie\n" " -n, --line-number afficher le numéro de ligne avec la sortie\n" " --line-buffered vider le tampon après chaque ligne\n" " -H, --with-filename afficher le nom de fichier avec les lignes\n" " -h, --no-filename supprimer le préfixe de nom de fichier en " "sortie\n" " --label=ÉTIQUETTE utiliser ÉTIQUETTE pour le préfixe d'entrée " "standard\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching n'afficher que la partie de ligne " "correspondante\n" " -q, --quiet, --silent supprimer tout affichage vers la sortie " "standard\n" " --binary-files=TYPE considérer que les fichiers binaires sont de " "type\n" " TYPE : « binary », « text » ou « without-" "match »\n" " -a, --text identique à --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I identique à --binary-files=without-match\n" " -d, --directories=ACTION la façon de traiter les répertoires ;\n" " ACTION est « read », « recurse » ou « skip »\n" " -D, --devices=ACTION la façon de traiter les périphériques, les " "FIFOS\n" " et les sockets ; ACTION est « read » ou " "« skip »\n" " -r, --recursive identique à --directories=recurse\n" " -R, --dereference-recursive similaire, mais avec suivi des liens " "symboliques\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB ne chercher que les fichiers correspondants à " "GLOB (motif de fichier)\n" " --exclude=GLOB ignorer les fichiers correspondants à GLOB\n" " --exclude-from=FICHIER ignorer les fichiers correspondants aux " "motifs contenus dans un FICHIER\n" " --exclude-dir=GLOB ignorer les répertoires correspondants à GLOB\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match n'afficher que les fichiers sans lignes " "sélectionnées\n" " -l, --files-with-matches n'afficher que les fichiers avec des lignes " "sélectionnées\n" " -c, --count n'afficher que le nombre de lignes sélectionnées " "par FICHIER\n" " -T, --initial-tab insérer des tabulations (si nécessaire)\n" " -Z, --null afficher l'octet nul après le nom de fichier\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Contrôle de contexte :\n" " -B, --before-context=NBRE afficher NBRE lignes de contexte avant\n" " -A, --after-context=NBRE afficher NBRE lignes de contexte après\n" " -C, --context=NBRE afficher NBRE lignes de contexte en sortie\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NOMBRE identique à --context=NOMBRE\n" " --color[=QUAND],\n" " --colour[=QUAND] mettre en évidence les correspondances ; QUAND " "est\n" " « always » (toujours) « never » (jamais) ou " "« auto »\n" " -U, --binary ne pas enlever les retours chariot en fin de " "ligne (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Si FICHIER vaut « - », lire l'entrée standard. Sans FICHIER, lire « . ».\n" "Si mode récursif, autrement « - »\n" "Si moins de deux fichiers sont indiqués, supposer -h.\n" "Le code d'erreur est 0 si une ligne est sélectionnée, 1 autrement ;\n" "en cas d'erreur et si l'option -q n'est pas présente, le code est 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "opérateurs de correspondance indiqués en conflit" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Correspondance Perl non prise en charge pour un binaire construit avec " "l'option --disable-perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "motif de correspondance incorrect %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "méthode d'examen des périphériques inconnue" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "décompte maximal incorrect" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "type de fichier binaire inconnu" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Écrit par Mike Haertel et d'autres ; voir\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "échec d’allocation mémoire pour la pile JIT PCRE" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P ne fonctionne qu’avec des paramètres régionaux monooctets ou UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "l'option -P ne permet d'utiliser qu'un seul motif" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "erreur interne (ça ne devrait jamais arriver)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "limite de longueur de ligne des PCRE dépassée" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s : mémoire épuisée" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s : pile PCRE JIT épuisée" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s : limite de retour arrière des PCRE dépassée" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s : limite de récursion PCRE dépassée" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s : erreur PCRE interne : %d" #~ msgid "warning: %s: %s" #~ msgstr "Avertissement : %s : %s" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "Avertissement : GREP_OPTIONS doit être abandonnée ; veuillez utiliser un " #~ "alias ou un script" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "Page d'accueil de %s : <https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "argument %s%s incorrect « %s »" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "suffixe incorrect dans l'argument %s%s « %s »" #~ msgid "%s%s argument '%s' too large" #~ msgstr "argument %s%s « %s » trop grand" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "erreur interne" ����������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/gl.po�����������������������������������������������������������������������0000664�0001750�0001750�00000102034�14670377450�016027� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Galician Translation of grep # Copyright (C) 2001 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Jacobo Tarrío Barreiro <jtarrio@iname.com>, 2001. # Francisco Diéguez <frandieguez@ubuntu.com>, 2012. # Leandro Regueiro <leandro.regueiro@gmail.com>, 2012. # Antón Méixome <meixome@certima.net>, 2018. # Francisco Javier Tsao Santín <tsao@members.fsf.org>, 2020. # Proxecto Trasno - Adaptación do software libre á lingua galega: Se desexas # colaborar connosco, podes atopar máis información en <http://trasno.gal> msgid "" msgstr "" "Project-Id-Version: grep 3.5.16\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2020-11-09 12:44+0100\n" "Last-Translator: Francisco Javier Tsao Santín <tsao@members.fsf.org>\n" "Language-Team: Galician <proxecto@trasno.gal>\n" "Language: gl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Virtaal 0.7.1\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "o argumento %s para %s é incorrecto" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "o argumento %s para %s é ambiguo" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Os argumentos correctos son:" #: lib/c-stack.c:187 msgid "program error" msgstr "erro de programa" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "desbordamento de pila" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "erro de escritura" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ desemparellado" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "clase de caracteres incorrecta" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "a sintaxe da clase de caracteres é [[:space:]], non [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "secuencia de escape \\ sen rematar" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "contido incorrecto de \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "expresión regular demasiado grande" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( desemparellado" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "no se especificou ningunha sintaxe" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") desemparellado" #: lib/error.c:195 msgid "Unknown system error" msgstr "Erro do sistema descoñecido" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: a opción '%s%s' é ambigua\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: a opción '%s%s' é ambigüa; posibilidades:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: non se recoñece a opción '%s%s'\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: a opción '%s%s' non admite ningún argumento\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: a opción '%s%s' require un argumento\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: a opción -- '%c' non é correcta\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: a opción require un argumento -- '%c'\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "memoria esgotada" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "non se puido rexistrar o cartafol de traballo activo" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "produciuse un fallo ao volver ao cartafol de traballo inicial" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "produciuse un fallo ao configurar o modo do descritor texto/binario" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "«" #: lib/quotearg.c:356 msgid "'" msgstr "»" #: lib/regcomp.c:135 msgid "Success" msgstr "Correcto" #: lib/regcomp.c:138 msgid "No match" msgstr "No hai ningunha coincidencia" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Expresión regular incorrecta" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Carácter de unión incorrecto" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Nome de clase de caracteres incorrecto" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Barra invertida ao final" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Referencia cara atrás incorrecta" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[, [^, [:, [., ou [= desemparellado" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( ou \\( desemparellado" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ desemparellado" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Contido incorrecto \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Final de intervalo incorrecto" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Memoria esgotada" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "A expresión regular precedente é incorrecta" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Final prematuro da expresión regular" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "A expresión regular é demasiado grande" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") ou \\) desemparellado" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "No hai ningunha expresión regular anterior" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Empaquetado por %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Empaquetado por %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licenza GPLv3+: GPL de GNU versión 3 ou posterior <%s>.\n" "Isto é software libre: vostede é libre de modificalo e redistribuílo.\n" "Non hai NINGUNHA GARANTÃA, ata onde o permite a lei.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Escrito por %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Escrito por %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Escrito por %s, %s, e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s,\n" "e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, e outros.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Comunicar erros no programa en: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Comunicar %s erros de programa en: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Páxina de web de %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Axuda xeral sobre o uso de software de GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(entrada estándar)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "argumento de lonxitude do contexto incorrecto" #: src/grep.c:894 msgid "input is too large to count" msgstr "a entrada é longa de máis para facer a conta" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: coincide o ficheiro binario" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: aviso: ciclo de cartafoles recursivo" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: o ficheiro de entrada tamén é o de saída" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Uso: %s [OPCIÓN]... PATRÓNS [FICHEIRO]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Consulte con '%s --help' para máis información.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Busca PATRÓNS en cada FICHERO.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Exemplo: %s -i 'hello world' menu.h main.c\n" "\n" "Selección de patróns e interpretación:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp O PATRÓNS son expresións regulares estendidas\n" " -F, --fixed-strings O PATRÓNS son conxuntos de cadeas\n" " -G, --basic-regexp O PATRÓNS son expresións regulares básicas\n" " -P, --perl-regexp O PATRÓNS son expresións regulares en Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=PATRÓN utiliza PATRÓNS para atopar coincidencias\n" " -f, --file=FICHEIRO obtén PATRÓNS de FICHEIRO\n" " -i, --ignore-case considera iguais as maiúsculas e as minúsculas " "en patróns e datos\n" " --no-ignore-case non considera iguais as maiúsculas e as " "minúsculas (por defecto)\n" " -w, --word-regexp obriga a que coincida só con palabras completas\n" " -x, --line-regexp obriga a que coincida só con liñas completas\n" " -z, --null-data unha liña de datos termina nun byte 0, non nun " "carácter de nova liña\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Variadas:\n" " -s, --no-messages suprime as mensaxes de erro\n" " -v, --invert-match selecciona as liñas que non coinciden\n" " -V, --version amosa a versión e finaliza\n" " --help amosa esta axuda e finaliza\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Control da saída como resultado:\n" " -m, --max-count=NUM detense despois do NUM de liñas seleccionadas\n" " -b, --byte-offset amosa o desprazamento en bytes xunto coas liñas " "de saí­da\n" " -n, --line-number amosa o número de liña xunto coas liñas de saí­" "da\n" " --line-buffered descarga o resultado para cada liña\n" " -H, --with-filename amosa o nome do ficheiro de cada coincidencia\n" " -h, --no-filename suprime os nomes dos ficheiros como prefixo no " "resultado\n" " --label=ETIQUETA utiliza ETIQUETA como prefixo estándar do nome " "de ficheiro\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching amosa só partes non baleiras de liñas que " "coinciden\n" " -q, --quiet, --silent suprime todo o resultado normal\n" " --binary-files=TIPO supón que os ficheros binarios son de TIPO;\n" " TIPO é 'binary', 'text', ou 'without-match'\n" " -a, --text equivalente a --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I equivalente a --binary-files=sen-coincidencia\n" " -d, --directories=ACCIÓN especifica como manexar os cartafoles\n" " ACCIÓN pode ser 'read', 'recurse', ou 'skip'\n" " -D, --devices=ACCIÓN especifica como manexar dispositivos, FIFO e\n" " «sockets», pode ser 'read' ou 'skip'\n" " -r, --recursive equivalente a --directories=recurse\n" " -R, --dereference-recursive equivalente, pero seguindo tódolas ligazóns " "simbólicas\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=PATRÓN_FICHEIRO busca só os ficheiros que coinciden con " "PATRÓN_FICHEIRO\n" " --exclude=PATRÓN_FICHEIRO omítense os ficheiros e cartafoles que " "coinciden con PATRÓN_FICHEIRO\n" " --exclude-from=FICHEIRO omítense os ficheiros que coinciden con " "calquera patrón de ficheiro de FICHEIRO\n" " --exclude-dir=PATRÓN omítense os cartafoles que coinciden con " "PATRÓN\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match amosa só os nomes dos FICHEIROS que no conteñen " "ningunha coincidencia\n" " -l, --files-with-matches amosa só os nomes de FICHEIROS que conteñen " "algunha coincidencia\n" " -c, --count amosa só resultado de liñas que coinciden de " "cada FICHEIRO\n" " -Z, --null imprime un byte 0 despois do nome do FICHEIRO\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Control do contexto:\n" " -B, --before-context=NÚM amosa o NÚM de liñas de contexto anterior\n" " -A, --after-context=NÚM amosa o NÚM de liñas de contexto posterior\n" " -C, --context=NÚM amosa o NÚM liñas de contexto\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM o mesmo que --context=NUM\n" " --color[=CANDO],\n" " --colour[=CANDO] distingue con marcadores a cadea que encaixa;\n" " CANDO pode ser 'always', 'never', ou 'auto'.\n" " -U, --binary non elimina os caracteres CR de retorno de liña " "(MSDOS/Windows)\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Cando o FICHEIRO é '-', le a entrada estándard. De non especificar FICHEIRO, " "le '.'\n" "se é recursivo, doutra maneira '-'. De se dar menos de dous FICHEIROS, " "suponse -h.\n" "O estado de saída é 0 se algunha liña é elixida, 1 se non as hai;\n" "de se producir algún erro e asemade non se especificou -q,\n" "o estado de saída é 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "especificáronse expresións conflitivas" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "A coincidencia compatible con Perl non está soportada nun compilado --" "disable-perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "a expresión %s non é correcta" #: src/grep.c:2538 msgid "unknown devices method" msgstr "método de dispositivos descoñecido" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "contador máximo incorrecto" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "tipo binary-files descoñecido" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Escrito por Mike Haertel e outros, véxase\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "ao tentar dispoñer de memoria produciuse un erro para a pila PCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P admite só locales unibyte e UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "a opción -P admite só un patrón" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "erro interno (non debería ocorrer nunca)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "excedeuse o tamaño límite das liñas PCRE" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: memoria esgotada" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: esgotouse a pila PCRE JIT" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: excedeuse o límite de volta atrás das PCREs" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: excedeuse o límite de recursividade das PCREs" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: erro interno de PCRE: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "aviso: GREP_OPTIONS está obsoleto; utilice un alias ou un script" #~ msgid "%s home page: <http://www.gnu.org/software/%s/>\n" #~ msgstr "Páxina de web de %s: <http://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "argumento %s%s incorrect '%s'" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "sufixo incorrecto no %s%s argumento «%s»" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s argumento «%s» demasiado grande" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "warning: %s: %s" #~ msgstr "atención: %s: %s" #~ msgid "internal error" #~ msgstr "erro interno" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: a opción '--%s' non admite ningíºn argumento\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: opción non recoñecida '--%s'\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: a opción '-W %s' non admite ningíºn argumento\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: a opción '-W %s' require un argumento\n" #~ msgid "unfinished repeat count" #~ msgstr "contador de repetición sen rematar" #~ msgid "malformed repeat count" #~ msgstr "contador de repetición erróneo" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "PATRÓN é una expresión regular estendida (ERE).\n" #~ msgid "Invocation as `egrep' is deprecated; use `grep -E' instead.\n" #~ msgstr "" #~ "A invocación como `egrep' está obsoleta; utilice `grep -E' no seu lugar.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "PATRÓN é un conxunto de cadenas fixas separadas por nova liña\n" #~ msgid "Invocation as `fgrep' is deprecated; use `grep -F' instead.\n" #~ msgstr "" #~ "A invocación como `fgrep' está obsoleta; utilice `grep -F' no seu lugar.\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "PATRÓN é, por omisión, unha expresión regular básica (BRE).\n" #~ msgid "" #~ "`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" #~ "Direct invocation as either `egrep' or `fgrep' is deprecated.\n" #~ msgstr "" #~ "`egrep' significa `grep -E'. `fgrep' significa `grep -F'.\n" #~ "A invocación directa como `egrep' ou `fgrep' está obsoleta.\n" #~ msgid "lseek failed" #~ msgstr "fallou a chamada ao sistema `lskeek'" #~ msgid "writing output" #~ msgstr "escribiendo o resultado" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Páxina web de GNU grep: <%s>\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s só puede usar a sintaxe de patrón %s" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "en GREP_COLORS=\"%s\", a capacidad \"%s\" necesita un valor (\"=...\"); " #~ "omitido." #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "en GREP_COLORS=\"%s\", a capacidad \"%s\" é booleana e non pode tener un " #~ "valor (\"=%s\"); omitido." #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "en GREP_COLORS=\"%s\", a capacidade \"%s\" %s." #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "o proceso do erróneo GREP_COLORS=\"%s\" detí­vose na subcadena \"%s\"." #~ msgid "out of memory" #~ msgstr "memoria esgotada" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Emprego: %s [OPCIN]... PATRN [FICHEIRO] ...\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Control de sada:\n" #~ " -m, --max-count=NM parar tras NM aparicins\n" #~ " -b, --byte-offset amosa o desprazamento do byte coas lias de " #~ "sada\n" #~ " -n, --line-number amosa o numero de lia coas lias de sada\n" #~ " --line-buffered baleira-lo buffer de sada con cada lia\n" #~ " -H, --with-filename amosa o nome do ficheiro de cada aparicin\n" #~ " -h, --no-filename suprime o prefixo de nome de ficheiro na " #~ "sada\n" #~ " --label=ETIQUETA amosa-la ETIQUETA coma o nome da entrada " #~ "estndar\n" #~ " -o, --only-matching amosar s a parte da lia que encaixa co PATRN\n" #~ " -q, --quiet, --silent suprime toda a sada normal\n" #~ " --binary-files=TIPO supoer que os ficheiros binarios son TIPO\n" #~ " TIPO 'binary', 'text' ou 'without-match'\n" #~ " ('binario', 'texto', ou 'sen aparicins')\n" #~ " -a, --text equivalente a --binary-files=text\n" #~ " -I equivalente a --binary-files=without-match\n" #~ " -d, --directories=ACCION como trata-los directorios\n" #~ " ACCION 'read', 'recurse', ou 'skip'.\n" #~ " ('ler', 'ascender recursivamente', ou " #~ "'omitir')\n" #~ " -D, --devices=ACCIN como trata-los dispositivos, FIFOs e sockets\n" #~ " ACCIN 'read' ou 'skip' ('ler' ou 'omitir')\n" #~ " -R, -r, --recursive equivalente a --directories=recurse.\n" #~ " --include=PATRN hanse examina-los ficheiros que encaixen no " #~ "PATRN\n" #~ " --exclude=PATRN hanse omiti-los ficheiros que encaixen no " #~ "PATRN\n" #~ " --exclude-from=FICH hanse omiti-los ficheiros que encaixen nos " #~ "patrns\n" #~ " armacenados no FICHeiro\n" #~ " -L, --files-without-match s amosa os FICHEIROS sen aparicins\n" #~ " -l, --files-with-matches s amosa os FICHEIROS con aparicins\n" #~ " -c, --count s amosa o nm. de lias coincidentes por " #~ "FICHEIRO\n" #~ " -Z, --null producir un byte 0 tralo nome do FICHEIRO\n" #~ msgid "" #~ "\n" #~ "Report bugs to <bug-gnu-utils@gnu.org>.\n" #~ msgstr "" #~ "\n" #~ "Informe dos erros no programa a <bug-gnu-utils@gnu.org>.\n" #~ "Informe dos erros na traduccin a <proxecto@trasno.net>.\n" #~ msgid "unknown directories method" #~ msgstr "mtodo de directorios descoecido" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Isto software libre; vexa o cdigo funte polas condicins de copia. NON " #~ "HAI\n" #~ "garanta; nin sequera de COMERCIABILIDADE ou APTITUDE PARA UN FIN " #~ "PARTICULAR.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "As opcins -P e -z non se poden combinar" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: opcin non permitida -- %c\n" #~ msgid "option %s" #~ msgstr "opcin %s" #~ msgid " with arg %s" #~ msgstr " con arg %s" #~ msgid "digits occur in two different argv-elements.\n" #~ msgstr "dixitos aparecen en dous argv-elementos diferentes.\n" #~ msgid "option %c\n" #~ msgstr "opcin %c\n" #~ msgid "option a\n" #~ msgstr "opcin a\n" #~ msgid "option b\n" #~ msgstr "opcin b\n" #~ msgid "option c with value `%s'\n" #~ msgstr "opcin c con valor `%s'\n" #~ msgid "option d with value `%s'\n" #~ msgstr "opcin d con valor `%s'\n" #~ msgid "?? getopt returned character code 0%o ??\n" #~ msgstr "?? getopt devolveu o cdigo de caracter 0%o ??\n" #~ msgid "non-option ARGV-elements: " #~ msgstr "ARGV-elementos no-opcin: " #~ msgid "you may specify only one of -E, -F, or -G" #~ msgstr "Debes especificar s un de -E, -F, ou -G" #~ msgid "memory exhausted\n" #~ msgstr "memoria esgotada\n" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/nb.po�����������������������������������������������������������������������0000664�0001750�0001750�00000074231�14670377450�016033� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Norwegian bokmÃ¥l translation of GNU Grep # Copyright (C) 1996 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Johnny A. Solbu <johnny@solbu.net>, 2020-2021 # Ã…ka Sikrom <a4@hush.com>, 2014-2020 # Eivind Tagseth <eivindt@multinet.no>, 1997, 2004 # Karl Anders Øygard <karl.oygard@fou.telenor.no>, 1996. # msgid "" msgstr "" "Project-Id-Version: grep-3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 14:11+0200\n" "Last-Translator: Johnny A. Solbu <johnny@solbu.net>\n" "Language-Team: Norwegian Bokmaal <l10n-no@lister.huftis.org>\n" "Language: nb\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Poedit 2.2.3\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "«%s» er et ugyldig argument for %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "«%s» er et tvetydig argument for %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Følgende argumenter er gyldige:" #: lib/c-stack.c:187 msgid "program error" msgstr "programfeil" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "stabel er full" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "skrivefeil" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "ubalansert [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "ugyldig tegnklasse" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "gjeldende tegnklasse-syntaks er [[:space:]], ikke [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "ufullstendig \\-skiftetegn" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "ugyldig innhold i \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "regulært uttrykk er for stort" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "ubalansert (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "ingen syntaks er valgt" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "ubalansert «)»" #: lib/error.c:195 msgid "Unknown system error" msgstr "Ukjent systemfeil" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: valget «%s%s» er flertydig\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: valget «%s%s» er flertydig, og kan bety følgende:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: valget «%s%s» er ukjent\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: valget «%s%s» tillater ikke argumenter\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: valget «%s%s» krever et argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: valget -- «%c» er ugyldig\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: valget -- «%c» krever et argument\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "minnet er oppbrukt" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "klarte ikke Ã¥ hente gjeldende arbeidsmappe" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "klarte ikke Ã¥ gÃ¥ tilbake til opprinnelig arbeidsmappe" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "klarte ikke Ã¥ endre fildeskriptor for tekst-/binærmodus" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "«" #: lib/quotearg.c:356 msgid "'" msgstr "»" #: lib/regcomp.c:135 msgid "Success" msgstr "Fullført" #: lib/regcomp.c:138 msgid "No match" msgstr "Ingen treff" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Ugyldig regulært uttrykk" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Ugyldig sorteringstegn" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Ugyldig tegnklassenavn" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Avsluttende omvendt skrÃ¥strek" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Ugyldig tilbakereferanse" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Ingen treff pÃ¥ «[», «[^», «[:», «[.» eller «[=»" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Ingen treff pÃ¥ ( eller \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Ingen treff pÃ¥ \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Ugyldig innhold i «\\{\\}»" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Ugyldig slutt pÃ¥ rekkevidde" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Minnet er oppbrukt" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Ugyldig foregÃ¥ende regulært uttrykk" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "For tidlig slutt pÃ¥ regulært uttrykk" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Regulært uttrykk er for stort" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Ingen treff pÃ¥ «)» eller «\\)»" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Intet tidligere regulært uttrykk" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Pakket av %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Pakket av %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Lisens GPLv3+: GNU GPL versjon 3 eller nyere <%s>.\n" "Dette er fri programvare. Du kan endre og dele den videre sÃ¥ mye du vil.\n" "Utgiveren stiller INGEN GARANTI, i den grad gjeldende lovverk tillater det.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Skrevet av %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Skrevet av %s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Skrevet av %s, %s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Skrevet av %s, %s, %s\n" "og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Skrevet av %s, %s, %s,\n" "%s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Skrevet av %s, %s, %s,\n" "%s, %s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Skrevet av %s, %s, %s,\n" "%s, %s, %s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Skrevet av %s, %s, %s,\n" "%s, %s, %s, %s\n" "og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Skrevet av %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Skrevet av %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s og andre.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Rapporter feil til: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Rapporter feil som oppstÃ¥r med %s til: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Nettside for %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Generell hjelp til bruk av GNU-programvare: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(standard inndata)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "ugyldig kontekstlengde" #: src/grep.c:894 msgid "input is too large to count" msgstr "for mye inndata Ã¥ telle" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: Binærfil samsvarer" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: advarsel: rekursiv mappeløkke" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: inndatafil er ogsÃ¥ brukt som utdata" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Bruk: %s [VALG] … MØNSTER [FIL] …\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Prøv Ã¥ skrive «%s --help» for mer informasjon.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Søk etter MØNSTER i valgt(e) FIL(er).\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Eksempel: %s -i 'hei verden' menu.h main.c\n" "MØNSTER kan inneholde flere mønstre adskilt med linjeskift.\n" "\n" "Reg.uttrykksutvalg og tolkning:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp MØNSTER er et utvidet regulært uttrykk\n" " -F, --fixed-strings MØNSTER er flere linje-adskilte strenger\n" " -G, --basic-regexp MØNSTER er et enkelt regulært uttrykk\n" " -P, --perl-regexp MØNSTER er et Perl-uttrykk\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=MØNSTER søk etter MØNSTER\n" " -f, --file=FIL hent MØNSTER fra valgt FIL\n" " -i, --ignore-case ikke skill mellom store og smÃ¥ bokstaver\n" " --no-ignore-case skill mellom store og smÃ¥ bokstaver (forvalgt)\n" " -w, --word-regexp søk etter hele ord\n" " -x, --line-regexp søk etter hele linjer\n" " -z, --null-data linjer slutter pÃ¥ 0-byte i stedet for " "linjeskift\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Diverse:\n" " -s, --no-messages ikke skriv ut feilmeldinger\n" " -v, --revert-match velg linjer som ikke passer\n" " -V, --version vis versjon og avslutt\n" " --help vis denne helpeteksten og avslutt\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Utdata-kontroll:\n" " -m, --max-count=ANT stopp ved valgt ANTall treff\n" " -b, --byte-offset skriv ut hvor søkeuttrykket ga treff per " "utdatalinje\n" " -n, --line-number skriv ut linjenummmer per utdatalinje\n" " --line-buffered tøm utdata pÃ¥ hver linje\n" " -H, --with-filename ta med filnavn pÃ¥ søketreff-linjer\n" " -h, --no-filename ikke ta med filnavn-prefiks i utdata\n" " --label=ETIKETT bruk valgt ETIKETT som prefiks pÃ¥ standard " "inndata-filnavn\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching bare vis den delen av linja som ga treff\n" " -q, --quiet, --silent ikke skriv ut noe vanlig utdata\n" " --binary-files=TYPE forvent at binærfiler er av valgt TYPE.\n" " TYPE er «binary» (binær), «text» (tekst) eller " "«without-match» (uten treff)\n" " -a, --text tilsvarer «--binary-files=text»\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I tilsvarer «--binary-files=without-match»\n" " -d, --directories=HANDLING hvordan mapper skal hÃ¥ndteres.\n" " HANDLING er «read» (les), «recurse» (søk i " "undermapper og -filer) eller «skip» (hopp over)\n" " -D, --devices=HANDLING hvordan enheter, FIFO-er og sokler skal " "behandles.\n" " HANDLING er «read» (les) eller «skip» (hopp " "over)\n" " -r, --recursive tilsvarer «--directories=recurse»\n" " -R, --dereference-recursive likner «-r», men følger symbolske lenker\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=MØNSTER bare søk gjennom filer som samsvarer med MØNSTER\n" " --exclude=MØNSTER hopp over filer som samsvarer med MØNSTER\n" " --exclude-from=FIL hopp over filer som samsvarer med mønstre nevnt i " "FIL\n" " --exclude-dir=MØNSTER hopp over mapper som samsvarer med MØNSTER.\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match bare skriv ut FILnavn som ikke inneholder " "søketreff\n" " -l, --files-with-matches bare skriv ut FILnavn som inneholder søketreff\n" " -c, --count bare skriv ut antall samsvarende linjer per FIL\n" " -T, --initial-tab still opp tabulatorer (hvis nødvendig)\n" " -Z, --null skriv ut 0-byte etter FILnavn\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Kontekstkontroll:\n" " -B, --before-context=ANT skriv ut valgt ANTall linjer med ledende " "kontekst\n" " -A, --after-context=ANT skriv ut valgt ANTall linjer med avsluttende " "kontekst\n" " -C, --context=ANT skriv ut valgt ANTall linjer med utdata-" "kontekst\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM tilsvarer «--context=NUM»\n" " --group-separator=SEP Skriv ut SEP pÃ¥ linje mellom treff med kontekst\n" " --no-group-separator ikke skriv ut skilletegn for treff med kontekst\n" " --color[=NÃ…R],\n" " --colour[=NÃ…R] bruk markører for Ã¥ fremheve strenger som " "samsvarer\n" " NÃ…R er enten «always» (alltid) , " "«never» (aldri), eller «auto»\n" " -U, --binary ikke fjern CR-tegn ved EOL (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Programmet leser standard inndata nÃ¥r FIL er «-». NÃ¥r FIL ikke er valgt, " "leses «.» i\n" "rekursiv modus, og ellers «-». Valget «-h» gjelder implisitt hvis færre enn " "to FILer er valgt.\n" "Avsluttende statuskode er 0 nÃ¥r søket gir treff, og ellers 1.\n" "Hvis det oppstÃ¥r feil og «-q» ikke er valgt, avslutter programmet med " "statuskode 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "søkeuttrykkene er i konflikt med hverandre" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "Søk støttes ikke i Perl nÃ¥r det er bygd med «--disable-perl-regexp»" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "«%s» er et ugyldig søkeuttrykk" #: src/grep.c:2538 msgid "unknown devices method" msgstr "ukjent enhetsmetode" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "advarsel: --unix-byte-offsets (-u) er avleggs" #: src/grep.c:2686 msgid "invalid max count" msgstr "ugyldig maksantall" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "ukjent binærfiltype" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Skrevet av Mike Haertel og andre. Se\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "klarte ikke Ã¥ tildele minne til PCRE JIT-stabelen" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P støtter bare regioner i unibyte- og UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "valget «-P» støtter bare ett mønster" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "intern feil (dette skal aldri skje)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "grensa for PCRE-linjelengde er overskredet" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: minnet er oppbrukt" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: PCRE JIT-stabel er oppbrukt" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: grensa for PCRE-tilbakegang er overskredet" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: PCREs rekursjonsgrense er overskredet" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: intern PCRE-feil: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "advarsel: GREP_OPTIONS er utdatert. Bruk et alias eller skript" #~ msgid "warning: %s: %s" #~ msgstr "advarsel: %s. %s" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "Nettside for %s: <http://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "%s%s-argumentet «%s» er ugyldig" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "ugyldig suffiks i %s%s-argument «%s»" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s-argumentet «%s» er for stort/langt" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "intern feil" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: valget «--%s» tillater ikke argumenter\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: valget «--%s» er ukjent\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: valget «-W %s» er flertydig\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: valget «-W %s» tillater ikke argumenter\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: valget «-W %s» krever et argument\n" #~ msgid "lseek failed" #~ msgstr "lseek mislyktes" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "MØNSTER er et enkelt regulært uttrykk (BRE) som standard. \n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "«egrep» betyr «grep -E». «fgrep» betyr «grep -F».\n" #~ "Direkte kjøring som «egrep» eller «fgrep» er foreldet.\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "ingen treff pÃ¥ «^», eller «$» støttes ikke med «-Pz»" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Nettside for GNU Grep: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "inndata inneholder en ugyldig UTF-8-bytesekvens" #~ msgid "unfinished repeat count" #~ msgstr "uferdig gjentagelsesantall" #~ msgid "malformed repeat count" #~ msgstr "feilaktig gjentagelsesantall" #~ msgid "out of memory" #~ msgstr "tomt for minne" #~ msgid "writing output" #~ msgstr "skriver utdata" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Bruk: %s [FLAGG]... MØNSTER [FIL] ...\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Utskriftskontroll:\n" #~ " -m, --max-count=ANT stopp etter ANT samsvar\n" #~ " -b, --byte-offset skriv byte-forskyvning sammen med " #~ "utskriftslinjer\n" #~ " -n, --line-number skriv linjenummer sammen med utskriftslinjer\n" #~ " --line-buffered tøm utskriftsbuffer for hver linje\n" #~ " -H, --with-filename skriv filnavnet for hvert samsvar\n" #~ " -h, --no-filename ikke skriv filnavnet for hvert samsvar\n" #~ " --label=NAVN skriv NAVN som filnavn for standard innkanal\n" #~ " -o, --only-matching vis bare den delen av en linje som samsvarer " #~ "med\n" #~ " MØNSTER.\n" #~ " -q, --quiet, --silent undertrykk all vanlig utskrift\n" #~ " --binary-files=TYPE anta at binære filer er TYPE\n" #~ " TYPE er «binary», «text» eller «without-" #~ "match»\n" #~ " -a, --text samme som binary-files=text\n" #~ " -I samme som --binary-files=without-match\n" #~ " -d, --directories=HANDLING hvordan hÃ¥ndtere kataloger\n" #~ " HANDLING er «read» eller «skip»\n" #~ " -D, --devices=HANDLING hvordan enheter, FIFOer og sockets skal " #~ "hÃ¥ndteres\n" #~ " HANDLING er «read» eller «skip»\n" #~ " -R, -r, --recursive samme som --directories=recurse\n" #~ " --include=MØNSTER undersøk filer som samsvarer med MØNSTER.\n" #~ " --exclude=MØNSTER hopp over filer som samsvarer med MØNSTER.\n" #~ " --exclude-from=FIL hopp over filer som samsvarer med MØNSTER i " #~ "FIL.\n" #~ " -L, --files-without-match bare skriv FIL-navn uten samsvar\n" #~ " -l, --files-with-matches bare skriv FIL-navnene som inneholder " #~ "samsvar\n" #~ " -c, --count bare skriv ut antall samsvarende linjer per " #~ "FIL\n" #~ " -Z, --null skriv 0-byte etter FIL-navn\n" #~ msgid "" #~ "\n" #~ "Report bugs to <bug-gnu-utils@gnu.org>.\n" #~ msgstr "" #~ "\n" #~ "Rapportér feil til <bug-gnu-utils@prep.ai.mit.edu>.\n" #~ msgid "unknown directories method" #~ msgstr "ukjent katalogmetode" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Dette er fri programvare, se kildekoden for kopieringsbetingelser. Det\n" #~ "er INGEN garanti, ikke en gang for SALGBARHET eller EGNETHET FOR NOEN \n" #~ "SPESIELL OPPGAVE.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "-P-flagget og -z-flagget kan ikke bli brukt sammen" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: ulovlig flagg -- %c\n" �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/lt.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000002550�14670377471�016215� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•���� ������„������ì�������0�����1�����3�����D�����U�����j�����l�����‹�����§�����Ç�����Ù�����ê������� �������'�����+�����D�����V�����p��+���t��#��� ��)���Ä��#���î�������$���$�����I�������� �������������������� ������� ������ ��� ��������������'�(standard input)�Memory exhausted�Unknown system error�`�conflicting matchers specified�input is too large to count�invalid context length argument�invalid max count�memory exhausted�unknown binary-files type�unknown devices method�Project-Id-Version: grep-2.5.4-pre3 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2008-07-09 13:28+0300 Last-Translator: Gintautas Miliauskas <gintas@akl.lt> Language-Team: Lithuanian <komp_lt@konferencijos.lt> Language: lt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: KBabel 1.11.4 Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2); �“�(standartinis įvedimas)�BaigÄ—si atmintis�Nežinoma sistemos klaida�„�nurodyti nesuderinami atitikimo mechanizmai�įvedimas per didelis skaiÄiavimui�netaisyklingas konteksto ilgio argumentas�netaisyklingas maksimalus skaiÄius�baigÄ—si atmintis�nežinomas dvejetainių failų tipas�nežinomas įrenginių metodas���������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/et.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000037336�14670377450�016215� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��w��#��Þ���~$��ë���]%��Ä��I&����(����&)��Æ��D*��e�� ,��¶��q-��’��(/��L��»0�����2�����2��)���02��)���Z2�����„2��&��� 2�����Ç2�����â2�����ü2��#���3�����33��(���O3��"���x3��#���›3�����¿3��.���Ú3����� 4����� 4�����4��/���4�����O4��)���à4����� 5�����5�����85�����Q5�����b5�����€5�����–5��ª���­5�����X6�� ���g6�����s6�����’6�����¡6��N���µ6�� ���7�����%7�����C7�����b7�����~7�����œ7�����£7��0���·7�����è7������8�����8��&���"8�� ���I8��-���S8�����8��û���˜8�����”9��:���ª9��2���å9��.���:��+���G:��&���s:��"���š:�����½:�����Ü:�����÷:��_���;�����g;�����i;��6���ˆ;�����¿;��%���Ý;��'���<��+���+<��4���W<��!���Œ<��'���®<�����Ö<�����õ<����� =��!���=�����==�����P=�����`=�����o=�����Š=�����™=�����·=��$���Ë=��.���ð=�����>�����0>�����A>�����R>�����h>�����†>��,���Ÿ>�����Ì>����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 11:00+0300 Last-Translator: Toomas Soome <tsoome@me.com> Language-Team: Estonian <linux-ee@lists.eenet.ee> Language: et MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8-bit X-Bugs: Report translation errors to the Language-Team address. � Konteksti kontroll: -B, --before-context=NUM väljasta NUM rida eelnevat konteksti -A, --after-context=NUM väljasta NUM rida järgnevat konteksti -C, --context=NUM väljasta NUM rida väljundi konteksti � Muud: -s, --no-messages blokeeri veateated -v, --invert-match vali mitte-sobivad read -V, --version esita versiooniinfo ja lõpeta töö --help esita see abiinfo ja lõpeta töö � Väljundi kontroll: -m, --max-count=NUM peatu peale NUM rida -b, --byte-offset väljasta koos ridadega ka baidi indeks -n, --line-number väljasta koos ridadega ka reanumber --line-buffered tühjenda väljund igal real -H, --with-filename väljasta iga leiuga failinimi -h, --no-filename blokeeri väljundis failinimi --label=MÄRGEND kasuta väljundis failinime asemel märgendit � --include=FAILI_MUSTER otsi alinult mustrile vastavaid faile --exclude=FAILI_MUSTER välista mustrile vastavad failid --exclude-from=FAIL välista failid vastavalt failist loetud mustrile --exclude-dir=MUSTER välista mustrile vastavad kataloogid. � -E, --extended-regexp MUSTRID on laiendatud regulaaravaldised -F, --fixed-strings MUSTRID on hulk reavahetustega eraldatud sõnesid -G, --basic-regexp MUSTRID on lihtsad regulaaravaldised (vaikimisi) -P, --perl-regexp MUSTRID on Perl regulaaravaldised � -I sama, kui --binary-files=without-match -d, --directories=TEGEVUS kuidas käsitleda katalooge; TEGEVUS on 'read', 'recurse' või 'skip' -D, --devices=TEGEVUS kuidas käsitleda seadmeid, FIFOsid ja pistikuid; TEGEVUS on 'read' või 'skip' -r, --recursive sama, kui --directories=recurse -R sama, aga järgib kõiki nimeviiteid � -L, --files-without-match väljasta ainult failide nimed, mis ei sobinud -l, --files-with-matches väljasta ainult leitud failide nimed -c, --count väljasta ainult leitud ridade arv faili kohta -T, --initial-tab kasuta vajadusel ridade joondamisel tabulaatorit -Z, --null väljasta faili nime järel bait 0 � -NUM sama, kui --context=NUM --group-separator=ER väljasta ER kontekstiga leidude vahel --no-group-separator leidude eraldajat ei väljastata --color[=MILLAL], --colour[=MILLAL] kasuta otsitava sõne eristamiseks markereid MILLAL võib olla 'always', 'never' või 'auto'. -U, --binary ära eemalda rea lõpust CR sümboleid (MSDOS/WINDOWS) � -e, --regexp=MUSTER kasuta regulaaravaldistena -f, --file=FAIL loe MUSTRID failist FAIL -i, --ignore-case tõstutundetu --no-ignore-case tõstutundlik (vaikimisi) -w, --word-regexp kasuta MUSTRIT sõnade leidmiseks -x, --line-regexp kasuta MUSTRIT ridade leidmiseks -z, --null-data andmerida lõppeb baidil 0, mitte reavahetusel � -o, --only-matching näita ainult mustriga sobivat mittetühja reaosa -q, --quiet, --silent blokeeri kogu tavaline väljund --binary-files=TÜÜP eelda binaarfailide tüüpi; TÜÜP on 'binary', 'text', või 'without-match' -a, --text sama, kui --binary-files=text �%s koduleht: <%s> �%s: binaarfail sobib�%s: PCRE tagasivaate piirang on ületatud�%s: PCRE rekursiooni piirang on ületatud�%s: PCRE JIT pinu sai täis�%s: sisendfail on ühtlasi ka väljund�%s: sisemine PCRE viga: %d�%s: vigane võti -- '%c' �%s: mälu on otsas�%s: võti '%s%s' ei luba argumenti �%s: võti '%s%s' on segane �%s: võti '%s%s' on segane; võimalused:�%s: võti '%s%s' nõuab argumenti �%s: võti nõuab argumenti -- '%c' �%s: tundmatu võti '%s%s' �%s: hoiatus: rekursiivne kataloogipuu tsükkel�'�©�(standardsisend)�-P toetab ainult ühebaidilisi ja UTF-8 lokaate�Näiteks: %s -i 'tere kõik' menu.h main.c MUSTRID võivad sisaldada mitut reavahetusega eraldatud mustrit. Mustri valik ja interpreteerimine: �Üldine abiinfo GNU tarkvara kohta: <%s> �Vigane tagasi viide�Vigane sümbolklassi nimi�Vigane sortimise sümbol�Vigane \{\} sisu�Vigane eelnev regulaaravaldis�Vigane vahemiku lõpp�Vigane regulaaravaldis�Litsents GPLv3+: GNU GPL versioon 3 või uuem <%s> See on vaba tarkvara: teil on lubatud seda muuta ja levitada. Garantii PUUDUB; vastavalt seadustega lubatud piiridele. �Mälu on otsas�Vastet pole�Eelnevat regulaaravaldist pole�Pakendanud %s �Pakendanud %s (%s) �Perl regulaaravaldisi ei toetata --disable-perl-regexp kompileerimise võtmega�Ootamatu reagulaaravaldise lõpp�Regulaaravaldis on liiga suur�Teatage palun %s vigadest: %s �Teatage palun vigadest: %s �Otsi MUSTREID igast FAIList. �Edukas�Lõpetav langkriips�Lisainfo saamiseks proovige võtit '%s --help'. �Tundmatu süsteemi viga�Puudub ( või \(�Puudub ) või \)�Puudub [, [^, [:, [. või [= paariline�Puudub \{�Kasutamine: %s [VÕTI]... MUSTRID [FAIL] ... �Lubatud argumendid on:�Kui fail on '-', loe standardsisendit. Kui faili ei antud ja kasutati võtit -r, loe '.', muidu '-'. Kui anti vähem kui kaks faili, eelda -h. Lõpetamise kood on 0, kui rida leiti, muidu 1; kui tekkis viga ja -q ei kasutatud, on lõpetamise kood 2. �Kirjutanud %s ja %s. �Kirjutanud %s, %s, %s, %s, %s, %s, %s, %s, %s, ja teised. �Kirjutanud %s, %s, %s, %s, %s, %s, %s, %s, ja %s. �Kirjutanud %s, %s, %s, %s, %s, %s, %s, ja %s. �Kirjuatanud %s, %s, %s, %s, %s, %s, ja %s. �Kirjutanud %s, %s, %s, %s, %s, ja %s. �Kirjutanud %s, %s, %s, %s, ja %s. �Kirjutanud %s, %s, %s, ja %s. �Kirjutanud %s, %s, ja %s. �Kirjutanud %s. �Kirjutanud Mike Haertel ja teised; vaadake <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�segane argument %s võtmele %s�sümbolklassi süntaks on [[:space:]], mitte [:space:]�määrati konfliktsed otsijad�PCRE rea pikkuse piirang on ületatud�PCRE JIT magasini jaoks ei jätku mälu�algsesse töökataloogi ei saa tagasi minna�failipideme tekst/binaar moodi muutmine ebaõnnestus�sisend on loendamiseks liiga suur�sisemine viga (ei peaks kunagi juhtuma)�vigane argument %s võtmele %s�vigane sümboliklass�vigane \{\} sisu�vigane konteksti pikkuse argument�vigane sobitaja %s�vigane maksimum�mälu on otsas�süntaksit pole määratud�programmi viga�regulaaravaldis on liiga suur�pinu ületäitumine�võti -P toetab ainult ühte mustrit�ei õnnestu salvestada jooksvat töökataloogi�balanseerimata (�balanseerimata )�balanseerimata [�lõpetamata \ paojada�tundmatu kahendfailide tüüp�tundmatu seadmete meetod�hoiatus: --unix-byte-offsets (-u) on aegunud�viga kirjutamisel���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/sk.po�����������������������������������������������������������������������0000664�0001750�0001750�00000077450�14670377471�016062� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Translation of grep to Slovak # Copyright (C) 1997-99, 2000, 2001, 2002 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Ivan Masár <helix84@centrum.sk>, 2007, 2008, 2009, 2010, 2011, 2012. # Ladislav MichnoviÄ <ladislav.michnovic@gmail.com>, 2020, 2021. # msgid "" msgstr "" "Project-Id-Version: grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 17:38+0200\n" "Last-Translator: Ladislav MichnoviÄ <ladislav.michnovic@gmail.com>\n" "Language-Team: Slovak <sk-i18n@lists.linux.sk>\n" "Language: sk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Poedit 2.4.1\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "neplatný argument %s pre %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "nejednoznaÄný argument %s pre %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Platné argumentu sú:" #: lib/c-stack.c:187 msgid "program error" msgstr "chyba programu" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "preteÄenie zásobníka" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "chyba zápisu" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ bez náprotivku" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "neplatná trieda znakov" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "syntax triedy znakov je [[:space:]], nie [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "nedokonÄená úniková klauzula \\" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "neplatný obsah \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "regulárny výraz je príliÅ¡ veľký" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( bez náprotivku" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "neuvedená syntax" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") bez náprotivku" #: lib/error.c:195 msgid "Unknown system error" msgstr "Neznáma systémová chyba" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: voľba „%s%s“ je nejednoznaÄná\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: voľba „%s%s“ je nejednoznaÄná; možnosti:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: nerozpoznaná voľba „%s%s“\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: voľba „%s%s“ nepripúšťa argument\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: voľba „%s%s“ vyžaduje argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: neplatná voľba -- %c\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: voľba vyžaduje argument -- %c\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "pamäť bola vyÄerpaná" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "nepodarilo sa zaznamenaÅ¥ aktuálny adresár" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "zlyhalo navrátenie do pôvodného aktuálneho adresára" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "zlyhalo nastaviÅ¥ deskriptor súboru do textového/binárneho módu" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "„" #: lib/quotearg.c:356 msgid "'" msgstr "“" #: lib/regcomp.c:135 msgid "Success" msgstr "ÚspeÅ¡ne vykonané" #: lib/regcomp.c:138 msgid "No match" msgstr "NiÄ nezodpovedá" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Neplatný regulárny výraz" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Neplatný radiaci znak" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Neplatný názov triedy znakov" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Spätná lomka na konci" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Neplatný spätný odkaz" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[, [^, [:, [., alebo [= bez náprotivku" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( alebo \\( bez náprotivku" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ bez náprotivku" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Neplatný obsah \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Neplatný koniec rozsahu" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Pamäť bola vyÄerpaná" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Neplatný predoÅ¡lý regulárny výraz" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Neplatný koniec regulárneho výrazu" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Regulárny výraz je príliÅ¡ veľký" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") alebo \\) bez náprotivku." #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Žiadny predoÅ¡lý regulárny výraz" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Balík vytvoril %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Balík vytvoril %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licencia GPLv3+: GNU GPL verzie 3 alebo neskorÅ¡ej <%s>\n" "Toto je slobodný softvér: môžete ho slobodne meniÅ¥ a šíriÅ¥.\n" "Nie je poskytovaná ŽIADNA ZÃRUKA do miery akú povoľuje aplikovateľné právo.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Napísal %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Napísali %s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Napísali %s, %s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Napísali %s, %s, %s a\n" "%s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Napísali %s, %s, %s,\n" "%s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Napísali %s, %s, %s,\n" "%s, %s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Napísali %s, %s, %s,\n" "%s, %s, %s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Napísali %s, %s, %s,\n" "%s, %s, %s, %s a\n" "%s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Napísali %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Napísali %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s a iní.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Chyby oznamujte na: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Chyby programu %s oznamujte na: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Domovská stránka %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "VÅ¡eobecná pomoc pri používaní softvéru GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(Å¡tandardný vstup)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "neplatný argument dĺžky kontextu" #: src/grep.c:894 msgid "input is too large to count" msgstr "vstup je príliÅ¡ veľký, aby sa dal spoÄítaÅ¥" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: zhoda v binárnom súbore" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: upozornenie: rekurzívna adresárová sluÄka" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "vstupný súbor %s je tiež uvedený ako výstupný" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Použitie: %s [VOĽBA]... VZORY [SÚBOR]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "ÄŽalÅ¡ie informácie získate príkazom „%s --help“.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "HľadaÅ¥ VZORY v každom SÚBORE.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Príklad: %s -i 'hello world' menu.h main.c\n" "VZORY môžu obsahovaÅ¥ niekoľko vzorov oddelených odriadkovaním.\n" "\n" "Výber a interpretácia vzoru:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp VZOR je rozšírený regular expression (ERE)\n" " -F, --fixed-strings VZOR je množina pevných reÅ¥azcov\n" " -G, --basic-regexp VZOR je základný regulárny výraz (BRE)\n" " -P, --perl-regexp VZOR je perlovský regulárny výraz\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=VZOR použiÅ¥ na hľadanie zhody VZOR\n" " -f, --file=SÚBOR získaÅ¥ VZOR zo SÚBORu\n" " -i, --ignore-case ignorovaÅ¥ rozdiely vo veľkosti písmen\n" " --no-ignore-case neignorovaÅ¥ rozdiely vo veľkosti písmen " "(predvolené)\n" " -w, --word-regexp vynútiÅ¥, aby VZOR zodpovedal len celým slovám\n" " -x, --line-regexp vynútiÅ¥, aby VZOR zodpovedal len celým riadkom\n" " -z, --null-data údaje konÄia bajtom 0, nie novým riadkom\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "RozliÄné:\n" " -s, --no-messages potlaÄiÅ¥ chybové správy\n" " -v, --invert-match vybraÅ¥ riadky, ktoré nemajú zhodu\n" " -V, --version vypísaÅ¥ informácie o verzii a skonÄiÅ¥\n" " --help zobraziÅ¥ tieto informácie a skonÄiÅ¥\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Riadenie výstupu:\n" " -m, --max-count=POÄŒ zastaviÅ¥ po POÄŒ zhodách\n" " -b, --byte-offset vypísaÅ¥ pri výstupných riadkoch ofset v bajtoch\n" " -n, --line-number vypísaÅ¥ pri výstupných riadkoch Äíslo riadka\n" " --line-buffered vypisovaÅ¥ (flush) výstup po každom riadku\n" " -H, --with-filename vypísaÅ¥ názov súboru pri každej zhode\n" " -h, --no-filename potlaÄiÅ¥ názov súboru ako predponu vo výstupe\n" " --label=NÃVESTIE použiÅ¥ NÃVESTIE ako predponu názvu súboru pre " "Å¡tand. vstup\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching zobrazovaÅ¥ iba neprázdne Äasti riadkov, ktoré " "zodpovedajú\n" " -q, --quiet, --silent potlaÄiÅ¥ vÅ¡etok bežný výstup\n" " --binary-files=TYP predpokladaÅ¥, že typ binárnych súborov je TYP;\n" " TYP zvoľte „binary“, „text“ alebo „without-" "match“\n" " -a, --text ekvivalentné s --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I ekvivalentné s --binary-files=without-match\n" " -d, --directories=OPERÃCIA ako pracovaÅ¥ s adresármi; kde OPERÃCIA je\n" " „read“ (ÄítaÅ¥), „recurse“ (prechádzaÅ¥) alebo\n" " „skip“ (preskoÄiÅ¥)\n" " -D, --devices=OPERÃCIA ako pracovaÅ¥ so zariadeniami, FIFO a socketmi;\n" " OPERÃCIA je „read“ (ÄítaÅ¥) alebo " "„skip“ (preskoÄiÅ¥)\n" " -r, --recursive ekvivalentné s --directories=recurse\n" " -R, --dereference-recursive podobné, ale nasleduje symbolické odkazy\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=VZOR_SÚBORU hľadaÅ¥ iba v súboroch zodpovedajúcich " "VZOR_SÚBORU\n" " --exclude=VZOR_SÚBORU preskoÄiÅ¥ súbory a adresáre zodpovedajúce " "VZOR_SÚBORU\n" " --exclude-from=SÚBOR preskoÄiÅ¥ súbory zodpovedajúce akémukoľvek " "vzoru súboru zo SÚBOR\n" " --exclude-dir=VZOR preskoÄiÅ¥ adresáre, ktoré zodpovedajú VZORu\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match vypísaÅ¥ iba názvy SÚBORov neobsahujúce zhodu\n" " -l, --files-with-matches vypísaÅ¥ iba názvy SÚBORov obsahujúce zhodu\n" " -c, --count vypísaÅ¥ iba poÄet riadkov obsahujúcich zhodu v " "SÚBORe\n" " -T, --initial-tab zarovnávaÅ¥ tabulátory (ak je to potrebné)\n" " -Z, --null vypísaÅ¥ za názvom SÚBORu bajt 0\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Riadenie kontextu:\n" " -B, --before-context=POÄŒ vytlaÄiÅ¥ POÄŒ riadkov kontextu pred\n" " -A, --after-context=POÄŒ vytlaÄiÅ¥ POÄŒ riadkov kontextu za\n" " -C, --context=POÄŒ vytlaÄiÅ¥ POÄŒ riadkov kontextu výstupu\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM rovnaké ako --context=NUM\n" " --group-separator=SEP vypíš oddeľovaÄ SEP na riadok medzi zhodami s " "kontextom\n" " --no-group-separator nevypisuj oddeľovaÄ pre zhody s kontextom\n" " --color[=KEDY],\n" " --colour[=KEDY] použiÅ¥ zvýrazňovanie zodpovedajúcich reÅ¥azcov;\n" " KEDY zvoľte „always“, „never“ alebo „auto“\n" " -U, --binary neodstraňovaÅ¥ znak CR na konci riadka (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Ak SÚBOR je -, Äíta sa zo Å¡tandardného vstupu. Bez SÚBORU Äíta sa . ak \n" "je rekurzia, v opaÄnom prípade -. Ak sú zadané menej ako dva SÚBORY " "predpokladá sa -h.\n" "Výstupný chybový kód je 0 ak bol vybraný nejaký riadok,inak je 1;\n" "ak sa vyskytne nejaká chyba a nebolo zadané -q, výstupný chybový kód je 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "boli zadané konfliktné Å¡pecifikátory" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Podpora Perlu nebola zakompilovaná do tejto binárky s --disable-perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "neplatný zástupný znak %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "neznáme metódy zariadení" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "Upozornenie: --unix-byte-offsets (-u) sa už nepoužíva" #: src/grep.c:2686 msgid "invalid max count" msgstr "neplatný maximálny poÄet" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "neznámy typ binárneho súboru" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Napísal Mike Haertel iní; pozri\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "chyba pri alokácii pamäte pre zásobník PCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P podporuje iba unibyte a UTF-8 locales" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "voľba -P podporuje iba jediný vzor" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "vnutorná chyba (nemalo by nikdy nastaÅ¥)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "prekroÄený limit dĺžky riadka PCRE" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: pamäť bola vyÄerpaná" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: vyÄerpaný zásobník PCRE JIT" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: prekroÄený limit backtrackingu PCRE" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: prekroÄený limit rekurzie PCRE" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: vnútorná chyba PCRE: %d" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: voľba „--%s“ nepripúšťa argument\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: nerozpoznaná voľba „--%s“\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: voľba „-W %s“ nepripúšťa argument\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: voľba „-W %s“ vyžaduje argument\n" #~ msgid "%s home page: <http://www.gnu.org/software/%s/>\n" #~ msgstr "Domovská stránka %s: <http://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "neplatný argument %s%s „%s“" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "neplatná prípona v argumente %s%s „%s“" #~ msgid "%s%s argument '%s' too large" #~ msgstr "argument %s%s „%s“ je príliÅ¡ veľký" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "VZORKA je rozšírený regulárny výraz (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "" #~ "Vyvolanie príkazu ako „egrep“ sa neodporúÄa; použite namiesto toho „grep -" #~ "E“.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "" #~ "VZORKA je množina pevných reÅ¥azcov oddelených znakom nového riadka.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "" #~ "Vyvolanie príkazu ako „fgrep“ sa neodporúÄa; použite namiesto toho „grep -" #~ "F“.\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "VZORKA je Å¡tandardne základný regulárny výraz (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "„egrep“ znamená „grep -E“. „fgrep“ znamená „grep -F“.\n" #~ "Priame vyvolanie príkazu ako „egrep“ Äi „fgrep“ sa neodporúÄa.\n" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "lseek failed" #~ msgstr "nepodarilo sa vykonaÅ¥ lseek()" #~ msgid "warning: %s: %s" #~ msgstr "upozornenie: %s: %s" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Domovská stránka GNU Grep: <%s>\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s môže používaÅ¥ iba syntax vzorky %s" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "voľba --mmap niÄ nerobí od roku 2010" #~ msgid "unfinished repeat count" #~ msgstr "NedokonÄený poÄet opakovaní" #~ msgid "malformed repeat count" #~ msgstr "Zle formulovaný poÄet opakovaní" #~ msgid "writing output" #~ msgstr "zapisuje sa výstup" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "V GREP_COLORS=\"%s\", potrebuje kapacita \"%s\" hodnotu (\"=...\"); " #~ "preskoÄené" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "V GREP_COLORS=\"%s\", je kapacita \"%s\" booleovského typu a nemôže " #~ "nadobúdaÅ¥ hodnotu (\"=%s\"); preskoÄené" #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "V GREP_COLORS=\"%s\", kapacita \"%s\" %s." #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "zastavené spracovanie zle utvoreného GREP_COLORS=\"%s\" na zvyÅ¡nom " #~ "podreÅ¥azci \"%s\"." #~ msgid "unknown directories method" #~ msgstr "neznáme metódy adresárov" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Riadenie výstupu:\n" #~ " -m, --max-count=POÄŒET zastaviÅ¥ po POÄŒET zhodách\n" #~ " -b, --byte-offset vypísaÅ¥ ofset v bajtoch pri riadkoch výstupu\n" #~ " -n, --line-number vypísaÅ¥ Äíslo riadka pri riadkoch výstupu\n" #~ " --line-buffered flush výstupu po každom riadku\n" #~ " -H, --with-filename vypísaÅ¥ názov súboru pri každej zhode\n" #~ " -h, --no-filename potlaÄiÅ¥ prefix názvu súboru na výstupe\n" #~ " --label=Å TÃTOK vypísaÅ¥ Å TÃTOK ako názov súboru pre Å¡tandard. " #~ "vstup\n" #~ " -o, --only-matching zobraziÅ¥ iba ÄasÅ¥ riadka zodpovedajúcu " #~ "VZORKE\n" #~ " -q, --quiet, --silent potlaÄiÅ¥ vÅ¡etok normálny výstup\n" #~ " --binary-files=TYP predpokladaÅ¥, že binárne súbory sú zadaného " #~ "TYPu;\n" #~ " TYP je „binary“, „text“ alebo „without-" #~ "match“\n" #~ " -a, --text ekvivalentné s --binary-files=text\n" #~ " -I ekvivalentné s --binary-files=without-match\n" #~ " -d, --directories=AKCIA ako zaobchádzaÅ¥ s adresármi;\n" #~ " AKCIA je „read“, „recurse“ alebo „skip“\n" #~ " -D, --devices=AKCIA ako zaobchádzaÅ¥ so zariadeniami, FIFO a " #~ "socketmi;\n" #~ " AKCIA je „read“ alebo „skip“\n" #~ " -R, -r, --recursive ekvivalentné s --directories=recurse\n" #~ " --include=SÚBOR_VZORKA hľadaÅ¥ iba v súboroch zodpoved. " #~ "SÚBOR_VZORKA\n" #~ " --exclude=SÚBOR_VZORKA preskoÄiÅ¥ súbory a adresáre zodp. " #~ "SÚBOR_VZORKA\n" #~ " --exclude-from=SÚBOR preskoÄiÅ¥ súbory zodp. akejkoľvek vzorke zo " #~ "SÚBORU\n" #~ " --exclude-dir=VZORKA preskoÄiÅ¥ adresáre zodpovedajúce VZORKE.\n" #~ " -L, --files-without-match vypísaÅ¥ iba názvy SÚBOROV, ktoré neobsahujú " #~ "zhodu\n" #~ " -l, --files-with-matches vypísaÅ¥ iba názvy SÚBOROV, ktoré obsahujú " #~ "zhodu\n" #~ " -c, --count vypísaÅ¥ iba poÄet zodpovedajúcich riadkov na " #~ "SÚBOR\n" #~ " -T, --initial-tab zarovnaÅ¥ tabulátory (ak je potrebné)\n" #~ " -Z, --null vytlaÄiÅ¥ bajt 0 po SÚBORE\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Voľby -P a -z nie je možné kombinovaÅ¥" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: neprípustná voľba -- %c\n" #~ msgid "Copyright (C) 2008 Free Software Foundation, Inc.\n" #~ msgstr "Copyright (C) 2008 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Tento program je slobodný softvér; podmienky šírenia si pozrite v " #~ "zdrojových\n" #~ "súboroch. Nie je poskytovaná ŽIADNA záruka; ani záruka PREDAJNOSTI Äi\n" #~ "VHODNOSTI NA DANà ÚČEL.\n" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/zh_CN.po��������������������������������������������������������������������0000664�0001750�0001750�00000074140�14670377471�016437� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Simplified Chinese(zh_CN) messages for grep. # This file is distributed under the same license as the grep package. # Copyright (C) 2008 Free Software Foundation, Inc. # Ji ZhengYu <zhengyuji@gmail.com>, 2016. # Boyuan Yang <073plan@gmail.com>, 2018, 2019, 2020. msgid "" msgstr "" "Project-Id-Version: grep 3.5.16\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2020-11-04 09:09-0500\n" "Last-Translator: Boyuan Yang <073plan@gmail.com>\n" "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Poedit 2.4.1\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "%2$s çš„å‚æ•° %1$s 无效" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "%2$s çš„å‚æ•° %1$s 有歧义" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "æœ‰æ•ˆå‚æ•°æ˜¯:" #: lib/c-stack.c:187 msgid "program error" msgstr "程åºé”™è¯¯" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "栈溢出" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "写错误" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "有未匹é…çš„ [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "无效的字符类å" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "字符类的语法是 [[:space:]],è€Œéž [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "未åšå¥½ \\ 转义" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "\\{\\}中内容无效" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "正则表达å¼å¤ªé•¿" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "有未匹é…çš„ (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "未指定语法" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "有未匹é…çš„ )" #: lib/error.c:195 msgid "Unknown system error" msgstr "未知的系统错误" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s:选项“%s%sâ€æœ‰æ­§ä¹‰\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s:选项“%s%sâ€æœ‰æ­§ä¹‰ï¼›å¯èƒ½åŽŸå› ï¼š" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s:无法识别的选项“%s%sâ€\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s:选项“%s%sâ€ä¸å…è®¸å¸¦å‚æ•°\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s:选项“%s%sâ€éœ€è¦ä¸€ä¸ªå‚æ•°\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s:无效选项 -- “%câ€\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s:选项需è¦ä¸€ä¸ªå‚æ•° -- “%câ€\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "内存耗尽" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "无法记录当å‰å·¥ä½œç›®å½•" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "无法返回起始工作目录" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "设置文件æè¿°ç¬¦æ–‡æœ¬/二进制模å¼å¤±è´¥" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "‘" #: lib/quotearg.c:356 msgid "'" msgstr "’" #: lib/regcomp.c:135 msgid "Success" msgstr "æˆåŠŸ" #: lib/regcomp.c:138 msgid "No match" msgstr "无匹é…" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "无效的正则表达å¼" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "无效的冲çªå­—符" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "无效的字符类å" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "å¤šä½™çš„åæ–œæ " #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "无效的回退索引" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[, [^, [:, [.或[= ä¸åŒ¹é…" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( 或 \\( ä¸åŒ¹é…" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ ä¸åŒ¹é…" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "\\{\\} 中的内容无效" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "无效的结æŸåœ°å€" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "内存耗尽" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "之å‰çš„æ­£åˆ™è¡¨è¾¾å¼æ— æ•ˆ" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "正则表达å¼éžæ­£å¸¸ç»“æŸ" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "正则表达å¼å¤ªå¤§" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") 或 \\) ä¸åŒ¹é…" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "没有之å‰çš„æ­£åˆ™è¡¨è¾¾å¼" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "ç”± %s (%s) 打包\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "ç”± %s 打包\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "GPLv3+ 许å¯è¯: GNU 通用公共许å¯è¯ç¬¬ä¸‰ç‰ˆæˆ–更高版本 <%s>。\n" "这是自由软件: 您å¯è‡ªç”±æ›´æ”¹å¹¶é‡æ–°åˆ†å‘它。\n" "在法律所å…许的范围内,ä¸é™„å¸¦ä»»ä½•æ‹…ä¿æ¡æ¬¾ã€‚\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "作者 %s。\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "作者 %s å’Œ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "作者 %s, %s åŠ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "作者 %s, %s, %s,\n" "åŠ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "作者 %s, %s, %s,\n" "%s, åŠ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "作者 %s, %s, %s,\n" "%s, %s, åŠ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "作者 %s, %s, %s,\n" "%s, %s, %s, åŠ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "作者 %s, %s, %s,\n" "%s, %s, %s, %s,\n" "åŠ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "作者 %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, åŠ %s。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "作者 %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, 以åŠå…¶ä»–人。\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "请将错误报告给:%s。翻译问题请报告至 <i18n-zh@googlegroups.com>。\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "请将 %s 错误报告给: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s 主页: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "GNU 软件的通用帮助: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(标准输入)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "æ— æ•ˆçš„æ–‡æœ¬é•¿åº¦å‚æ•°" #: src/grep.c:894 msgid "input is too large to count" msgstr "输入太多无法计数" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s:匹é…到二进制文件" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s:警告:嵌套目录循环" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%sï¼šè¾“å…¥æ–‡ä»¶åŒæ—¶ä¹Ÿä½œä¸ºè¾“出" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "用法: %s [选项]... æ¨¡å¼ [文件]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "å°è¯•使用 '%s --help' æ¥èŽ·å¾—æ›´å¤šä¿¡æ¯ã€‚\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "在æ¯ä¸ª<文件>中查找给定<模å¼>。\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "例如:%s -i 'hello world' menu.h main.c\n" "<模å¼>å¯ä»¥åŒ…括多个模å¼å­—符串,使用æ¢è¡Œç¬¦è¿›è¡Œåˆ†éš”。\n" "\n" "模å¼é€‰æ‹©ä¸Žè§£é‡Šï¼š\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp <模å¼> 是扩展正则表达å¼\n" " -F, --fixed-strings <模å¼> 是字符串\n" " -G, --basic-regexp <模å¼> 是基本正则表达å¼\n" " -P, --perl-regexp <模å¼> 是 Perl 正则表达å¼\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=<模å¼> 用指定的<模å¼>字符串æ¥è¿›è¡ŒåŒ¹é…æ“作\n" " -f, --file=<文件> 从给定<文件>中å–å¾—<模å¼>\n" " -i, --ignore-case 在模å¼å’Œæ•°æ®ä¸­å¿½ç•¥å¤§å°å†™\n" " --no-ignore-case ä¸è¦å¿½ç•¥å¤§å°å†™ï¼ˆé»˜è®¤ï¼‰\n" " -w, --word-regexp 强制<模å¼>仅完全匹é…å­—è¯\n" " -x, --line-regexp 强制<模å¼>ä»…å®Œå…¨åŒ¹é…æ•´è¡Œ\n" " -z, --null-data æ•°æ®è¡Œä»¥ä¸€ä¸ª 0 字节结æŸï¼Œè€Œéžæ¢è¡Œç¬¦\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "æ‚项:\n" " -s, --no-messages 䏿˜¾ç¤ºé”™è¯¯ä¿¡æ¯\n" " -v, --invert-match 选中ä¸åŒ¹é…的行\n" " -V, --version 显示版本信æ¯å¹¶é€€å‡º\n" " --help 显示此帮助并退出\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "输出控制:\n" " -m, --max-count=<次数> 得到给定<次数>次匹é…åŽåœæ­¢\n" " -b, --byte-offset è¾“å‡ºçš„åŒæ—¶æ‰“å°å­—节åç§»\n" " -n, --line-number è¾“å‡ºçš„åŒæ—¶æ‰“å°è¡Œå·\n" " --line-buffered æ¯è¡Œè¾“出åŽåˆ·æ–°è¾“出缓冲区\n" " -H, --with-filename ä¸ºè¾“å‡ºè¡Œæ‰“å°æ–‡ä»¶å\n" " -h, --no-filename è¾“å‡ºæ—¶ä¸æ˜¾ç¤ºæ–‡ä»¶åå‰ç¼€\n" " --label=<标签> 将给定<标签>作为标准输入文件åå‰ç¼€\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching åªæ˜¾ç¤ºè¡Œä¸­éžç©ºåŒ¹é…部分\n" " -q, --quiet, --silent 䏿˜¾ç¤ºæ‰€æœ‰å¸¸è§„输出\n" " --binary-files=TYPE 设定二进制文件的 TYPE(类型);\n" " TYPE å¯ä»¥æ˜¯ 'binary'ã€'text' 或 'without-match'\n" " -a, --text ç­‰åŒäºŽ --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I ç­‰åŒäºŽ --binary-files=without-match\n" " -d, --directories=ACTION 读å–目录的方å¼ï¼›\n" " ACTION å¯ä»¥æ˜¯`read', `recurse',或`skip'\n" " -D, --devices=ACTION 读å–设备ã€å…ˆå…¥å…ˆå‡ºé˜Ÿåˆ—ã€å¥—接字的方å¼ï¼›\n" " ACTION å¯ä»¥æ˜¯`read'或`skip'\n" " -r, --recursive ç­‰åŒäºŽ--directories=recurse\n" " -R, --dereference-recursive åŒä¸Šï¼Œä½†é历所有符å·é“¾æŽ¥\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB åªæŸ¥æ‰¾åŒ¹é… GLOB(文件模å¼ï¼‰çš„æ–‡ä»¶\n" " --exclude=GLOB è·³è¿‡åŒ¹é… GLOB 的文件\n" " --exclude-from=FILE 跳过所有匹é…ç»™å®šæ–‡ä»¶å†…å®¹ä¸­ä»»æ„æ¨¡å¼çš„æ–‡ä»¶\n" " --exclude-dir=GLOB è·³è¿‡æ‰€æœ‰åŒ¹é… GLOB 的目录\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match åªæ‰“å°æ²¡æœ‰åŒ¹é…上的<文件>çš„åç§°\n" " -l, --files-with-matches åªæ‰“å°æœ‰åŒ¹é…çš„<文件>çš„åç§°\n" " -c, --count åªæ‰“å°æ¯ä¸ª<文件>中的匹é…行数目\n" " -T, --initial-tab 行首制表符对é½ï¼ˆå¦‚有必è¦ï¼‰\n" " -Z, --null 在<文件>åæœ€åŽæ‰“å°ç©ºå­—符\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "文件控制:\n" " -B, --before-context=NUM æ‰“å°æ–‡æœ¬åŠå…¶å‰é¢NUM 行\n" " -A, --after-context=NUM æ‰“å°æ–‡æœ¬åŠå…¶åŽé¢NUM 行\n" " -C, --context=NUM 打å°NUM 行输出文本\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM ç­‰åŒäºŽ --context=NUM\n" " --color[=WHEN],\n" " --colour[=WHEN] 使用标记高亮匹é…字串;\n" " WHEN å¯ä»¥æ˜¯â€œalwaysâ€ã€â€œneverâ€æˆ–“autoâ€\n" " -U, --binary ä¸è¦æ¸…除行尾的 CR 字符(MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "若给定文件为“-â€ï¼Œåˆ™ä»Žè¯»å–标准输入。 è‹¥æ— æ–‡ä»¶å‚æ•°ï¼Œåˆ™é™¤éžå¤„于\n" "递归工作模å¼è§†ä¸ºä»Žâ€œ.â€è¯»å–之外,一律视为从“-â€è¯»å–。如果æä¾›äº†å°‘于\n" "ä¸¤ä¸ªæ–‡ä»¶å‚æ•°ï¼Œåˆ™é»˜è®¤å¯ç”¨ -h 选项。如果有任æ„行被匹é…则退出状æ€ä¸º 0,\n" "å¦åˆ™ä¸º 1;如果有错误产生且未指定 -q 傿•°ï¼Œåˆ™é€€å‡ºçжæ€ä¸º 2。\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "指定了互相冲çªçš„æ¯”较程åº" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "当å‰ä½¿ç”¨äº† --disable-perl-regexp çš„æž„å»ºæ— æ³•æ”¯æŒ Perl åŒ¹é…æ¨¡å¼" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "æ— æ•ˆåŒ¹é… %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "æœªçŸ¥çš„è®¾å¤‡å¤„ç†æ–¹å¼" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "无效的最大计数" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "未知的二进制文件类型" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "ç”± Mike Haerhtel 等人编写;作者信æ¯è¯·å‚è§\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>。" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "为 PCRE JIT 栈分é…内存时出错" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P 仅支æŒå•å­—èŠ‚åŠ UTF-8 语言环境" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "-P 选项仅支æŒå•一匹é…å­—è¯" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "内部错误(永远ä¸åº”该å‘生)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "超过 PCRE 的行长度é™åˆ¶" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s:内存耗尽" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s:PCRE JIT 栈已ç»ç”¨å°½" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s:超过 PCRE 的回溯é™åˆ¶" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s:超过 PCRE 的递归é™åˆ¶" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s:PCRE 内部错误:%d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "警告: GREP_OPTIONS å·²è¢«åºŸå¼ƒï¼›è¯·ä½¿ç”¨åˆ«åæˆ–脚本" #~ msgid "warning: %s: %s" #~ msgstr "警告: %s: %s" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "%s 主页: <https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "无效的 %s%s 傿•°'%s'" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "%s%s 傿•°'%s' çš„åŽç¼€æ— æ•ˆ" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s 傿•°â€œ%sâ€è¿‡å¤§" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "内部错误" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: 选项'--%s' ä¸å…è®¸å¸¦å‚æ•°\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: 未知选项'--%s' \n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: 选项'-W %s' 有歧义\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: 选项'-W %s' ä¸å…è®¸å¸¦å‚æ•°\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: 选项'-W %s' å¿…é¡»å¸¦å‚æ•°\n" #~ msgid "lseek failed" #~ msgstr "lseek 失败" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "默认的 PATTERN 是一个基本正则表达å¼(缩写为 BRE)。\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "'egrep' å³'grep -E'。'fgrep' å³'grep -F'。\n" #~ "直接调用'egrep' 或是'fgrep' å‡å·²è¢«åºŸå¼ƒã€‚\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "-Pz 䏿”¯æŒæœªç»è½¬ä¹‰çš„字符^ 或$" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "PATTERN æ˜¯ä¸€ä¸ªå¯æ‰©å±•的正则表达å¼(缩写为 ERE)。\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "‘egrep’已ä¸å†ä½¿ç”¨äº†ï¼›è¯·ç”¨â€˜grep -E’代替。\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "PATTERN 是一组由断行符分隔的定长字符串。\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "‘fgrep’已ä¸å†ä½¿ç”¨äº†ï¼›è¯·ç”¨ ‘grep -F’代替。\n" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "GNU Grep 主页: <%s>\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s åªèƒ½ä½¿ç”¨ %s 匹é…语法" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "--mmap 选项从2010 å¹´èµ·å·²ä¸å†æ˜¯æ“作符了" #~ msgid "unfinished repeat count" #~ msgstr "未定义é‡å¤æ¬¡æ•°" #~ msgid "malformed repeat count" #~ msgstr "é‡å¤æ¬¡æ•°å®šä¹‰åœ°ä¸å®Œæ•´" #~ msgid "writing output" #~ msgstr "正在写输出" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "在 GREP_COLORS=\"%s\"中, \"%s\" éœ€è¦æŒ‡å®šä¸€ä¸ªå€¼(\"=...\")ï¼›å·²å¿½ç•¥æ­¤å‚æ•°ã€‚" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "在 GREP_COLORS=\"%s\"中,\"%s\" è¦çš„æ˜¯ä¸€ä¸ª boolean(布尔值) 䏿˜¯ä¸€ä¸ªæ•°å€¼" #~ "(\"=%s\")ï¼›å·²å¿½ç•¥æ­¤å‚æ•°ã€‚" #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "在 GREP_COLORS=\"%s\"中,\"%s\" 是 %s。" #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "在余下的å­ä¸² \"%2$s\" ä¸­åœæ­¢å¤„ç†æ ¼å¼æœ‰è¯¯çš„ GREP_COLORS=\"%1$s\"。" #~ msgid "unknown directories method" #~ msgstr "æœªçŸ¥çš„ç›®å½•å¤„ç†æ–¹æ³•" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "输出控制:\n" #~ " -m, --max-count=NUM NUM 次匹é…åŽåœæ­¢\n" #~ " -b, --byte-offset 显示输出行的字节åç§»\n" #~ " -n, --line-number 显示输出行的行å·\n" #~ " --line-buffered æ¯è¡Œéƒ½æ¸…空输出\n" #~ " -H, --with-filename 为æ¯ä¸ªåŒ¹é…打å°å‡ºæ–‡ä»¶å\n" #~ " -h, --no-filename è¾“å‡ºæ—¶ä¸æ˜¾ç¤ºæ–‡ä»¶åå‰çš„路径å\n" #~ " --label=LABEL æ‰“å° LABEL 作为标准输入的文件å\n" #~ " -o, --only-matching ä»…æ˜¾ç¤ºåŒ¹é… PATTERN 的那一行\n" #~ " -q, --quiet, --silent 䏿˜¾ç¤ºæ‰€æœ‰æ™®é€šä¿¡æ¯\n" #~ " --binary-files=TYPE å‡å®šäºŒè¿›åˆ¶æ–‡ä»¶ç±»åž‹ä¸º TYPE;\n" #~ " TYPE å¯ä»¥æ˜¯â€˜binary’,‘text’或是‘without-" #~ "match’\n" #~ " -a, --text ç­‰åŒäºŽ --binary-files=text\n" #~ " -I ç­‰åŒäºŽ --binary-files=without-match\n" #~ " -d, --directories=ACTION 如何处ç†ç›®å½•åï¼›\n" #~ " ACTION 是‘read’,‘recurse’或是‘skip’\n" #~ " -D, --devices=ACTION 如何处ç†è®¾å¤‡å,FIFOs(队列) ä»¥åŠ sockets(套接" #~ "å­—)\n" #~ " ACTION 是‘read’或是‘skip’\n" #~ " -R, -r, --recursive ç­‰åŒäºŽ --directories=recurse\n" #~ " --include=FILE_PATTERN ä»…æŸ¥æ‰¾åŒ¹é… FILE_PATTERN 的文件\n" #~ " --exclude=FILE_PATTERN å¿½ç•¥åŒ¹é… FILE_PATTERN 的文件和目录\n" #~ " --exclude-from=FILE 忽略任何æ¥è‡ª FILE 的匹é…å­—è¯\n" #~ " --exclude-dir=PATTERN å¿½ç•¥åŒ¹é… PATTERN 的目录。\n" #~ " -L, --files-without-match 仅显示ä¸åŒ…å«åŒ¹é…å­—è¯çš„ FILE åç§°\n" #~ " -l, --files-with-matches 仅显示包å«åŒ¹é…å­—è¯çš„ FILE åç§°\n" #~ " -c, --count 仅显示æ¯ä¸ª FILE 中匹é…行的数目\n" #~ " -T, --initial-tab 以 tab 为行首(如果必è¦çš„è¯)\n" #~ " -Z, --null 在 FILE åŽæ‰“å° 0 字节\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "-P å’Œ -z 选项ä¸èƒ½ç»„åˆä½¿ç”¨" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: éžæ³•选项 -- %c\n" #~ msgid "Copyright (C) 2008 Free Software Foundation, Inc.\n" #~ msgstr "Copyright (C) 2008 Free Software Foundation, Inc.\n" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/da.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000032261�14670377450�016161� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����]�����������ì������è��Ï���é��÷���¹��Õ��± ��ü���‡ ��¶��„ ��U��;��¤��‘��F��6�����}�����‘��,���­�����Ú��.���ú��'���)��(���Q�����z�����š�����œ����� ��*���±�����Ü��&���m�����”�����«�����È�����ä��$���ü�����!�����3��ª���N�����ù����� ����������2�����B��<���W��#���”�����¸�����Ó�����ê��"���þ�����!�����)��&���<�����c�����x�����Š�����œ�� ���»��)���È�����ò�������;�����3���Z��/���Ž��+���¾��'���ê��#��������6�����V�����r��\���‚�����ß�����á��4���þ�����3��!���R��0���t��-���¥��.���Ó�������$��������C�����^�����v�����Ž�����®�����Á�����Ó�����ä�� ���ø����������!��,���0��*���]�� ���ˆ�� ���•�� ���¢�����¯�����Ã�����Ý�� ���ô�������ì���€��ò���m��ø��` ��ù���Y"��Ü��S#��c��0%��Ø��”&��B��m(�����°)�����É)��,���ä)�� ���*��,���2*��&���_*��'���†*�����®*�����Æ*�����È*�����Ë*��9���Þ*��Š���+��.���£+�����Ò+�����é+��(���,�����*,��&���C,�����j,�����…,��´���Ÿ,�����T-�����g-��"���w-�� ���š-�����¨-��J���»-��%���.�����,.�����J.�����h.�� ���.�����¢.�����©.��(���È.�����ñ.�����/�����/�����)/�� ���H/��%���S/�����y/�����/��8���¦/��1���ß/��-���0��)���?0��%���i0��!���0�����±0�����Ï0�����é0��Z���ù0�����T1�����V1��8���t1�� ���­1��(���Î1��3���÷1��;���+2��9���g2��%���¡2�����Ç2�����æ2�����3�����3�� ���.3�����O3�����b3�����€3�����“3�� ���©3�����µ3�� ���Ó3��.���à3��(���4�� ���84�� ���F4�� ���T4�����b4�����|4�����’4�� ���¦4��������E������#������=���T���B��������������-���;���9������3������� ���\���A��������������:���D���%���J���8�����������?���.�����������V���P���F����������(���)����������Q�����������H���R����������I������[������4�������Y���!�������L���]���7���5������� ���@�����������<���X��� ���Z�������K���G�����������6���,���S���1�������0���������N������$���O����������������M����������������������������C���+��� ����������>���'���/���U�������*������&���2������W������������� �������"����������� ���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: invalid option -- '%c' �%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep-3.3.42 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2019-12-27 00:28+0100 Last-Translator: Ask Hjorth Larsen <asklarsen@gmail.com> Language-Team: Danish <dansk@dansk-gruppen.dk> Language: da MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8-bit X-Bugs: Report translation errors to the Language-Team address. � Styring af kontekst: -B, --before-context=ANTAL udskriv ANTAL linjer af foregÃ¥ende tekst -A, --after-context=ANTAL udskriv ANTAL linjer af efterfølgende tekst -C, --context=ANTAL udskriv ANTAL linjer af omgivende tekst � Diverse: -s, --no-messages undertryk fejlmeddelser -v, --invert-match vælg linjer der ikke passer -V, --version vis versionsinformation og afslut --help vis denne hjælpetekst og afslut � Styring af udskrift: -m, --max-count=ANTAL stands efter ANTAL fundne linjer -b, --byte-offset udskriv startpunkt i byte sammen med fundne linjer -n, --line-number udskriv linjenummer sammen med linjerne --line-buffered tøm uddatabuffer for hver linje -H, --with-filename udskriv filnavn sammen med udlinjer -h, --no-filename undertryk indledende filnavn i udskrift --label=NAVN udskriv NAVN som filnavn for standard-inddata � -E, --extended-regexp MØNSTRE er udvidede regulære udtryk -F, --fixed-strings MØNSTRE er strenge -G, --basic-regexp MØNSTRE er elementære regulære udtryk -P, --perl-regexp MØNSTRE er regulære udtryk til Perl � -I svarer til --binary-files=without-match -d, --directories=HANDLING hvordan kataloger skal hÃ¥ndteres; HANDLING er "read", "recurse", eller "skip" -D, --devices=HANDLING hvordan enheder, FIFO'er og sokler skal hÃ¥ndteres; HANDLING er "read" eller "skip" -r, --recursive svarer til --directories=recurse -R, --dereference-recursive tilsvarende, men følg alle symlænker � -L, --files-without-match udskriv kun navne pÃ¥ FILer uden fundne linjer -l, --files-with-matches udskriv kun navne pÃ¥ FILer med fundne linjer -c, --count udskriv kun antallet af fundne linjer for hver FIL -T, --initial-tab arrangér tabulatortegn (om nødvendigt) -Z, --null udskriv 0-byte efter FILnavn � -e, --regexp=MØNSTRE brug MØNSTRE i søgning -f, --file=FIL tag MØNSTRE fra FIL -i, --ignore-case skeln ikke mellem store og smÃ¥ bogstaver i mønstre og data --no-ignore-case skeln mellem store/smÃ¥ bogstaver (standard) -w, --word-regexp match kun hele ord -x, --line-regexp match kun hele linjer -z, --null-data en datalinje slutter med en 0-byte, ikke linjeskift � -o, --only-matching vis kun ikketomme dele af matchende linjer -q, --quiet, --silent undertryk al normal udskrift --binary-files=TYPE antag at binære filer er TYPE; TYPE er "binary", "text" eller "without-match" -a, --text svarer til --binary-files=text �Hjemmeside for %s: <%s> �%s: ugyldigt flag -- "%c" �%s: flaget "%s%s" tillader ikke et argument �%s: flaget "%s%s" er flertydigt �%s: flaget "%s%s" er flertydigt; muligheder:�%s: flaget "%s%s" kræver et argument �%s: flaget kræver et argument -- "%c" �%s: ukendt flag "%s%s" �"�©�(standard-inddata)�-P understøtter kun unibyte- og UTF-8-sprogindstillinger�Eksempel: %s -i 'hej verden' menu.h main.c MØNSTRE kan indeholde flere mønstre adskilt af linjeskift. Valg af mønster og fortolkning: �Generel hjælp til brug af GNU-software: <%s> �Ugyldig bagudreference�Ugyldigt tegnklassenavn�Ugyldigt samletegn (collation character)�Ugyldigt indhold af \{\}�Ugyldigt foranstillet regulært udtryk�Ugyldig intervalafslutning�Ugyldigt regulært udtryk�GPLv3+-licens: GNU GPL version 3 eller senere <%s>. Dette er fri software: du kan frit ændre og videredistribuere det. Der gives INGEN GARANTI, i den grad som loven tillader det. �Hukommelse opbrugt�Ingen træffere�Intet foregÃ¥ende regulært udtryk�Pakket af %s �Pakket af %s (%s) �Perl-matching understøttes ikke hvis kompileret med --disable-perl-regexp�Utidig afslutning af regulært udtryk�Regulært udtryk er for stort�Rapportér fejl i %s til: %s �Rapportér fejl til: %s �Søg efter MØNSTRE i hver FIL. �Succes�Afsluttende omvendt skrÃ¥streg�Prøv "%s --help" for mere information. �Ukendt systemfejl�Uparret ( eller \(�Uparret ) eller \)�Uparret [, [^, [:, [. eller [=�Uparret \{�Brug: %s [FLAG]... MØNSTRE [FIL]... �Gyldige argumenter er:�Skrevet af %s og %s. �Skrevet af %s, %s, %s, %s, %s, %s, %s, %s, %s og andre. �Skrevet af %s, %s, %s, %s, %s, %s, %s, %s og %s. �Skrevet af %s, %s, %s, %s, %s, %s, %s og %s. �Skrevet af %s, %s, %s, %s, %s, %s og %s. �Skrevet af %s, %s, %s, %s, %s og %s. �Skrevet af %s, %s, %s, %s og %s. �Skrevet af %s, %s, %s og %s. �Skrevet af %s, %s og %s. �Skrevet af %s. �Skrevet af Mike Haertel med flere; se <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�"�flertydigt argument %s til %s�syntaksen for tegnklasser er [[:space:]], ikke [:space:]�modstridende søgeudtryk angivet�overskred maksimal linjelængde for PCRE�kunne ikke allokere hukommelse til PCRE JIT-stakken�kunne ikke vende tilbage til det oprindelige arbejdskatalog�kunne ikke angive tekst-/binærtilstand for fildeskriptor�inddata er for omfattende at optælle�intern fejl (burde aldrig ske)�ugyldigt argument %s til %s�ugyldig tegnklasse�ugyldigt indhold af \{\}�ugyldigt kontekstlængdeargument�ugyldig matcher %s�ugyldig angivelse af maksimum�hukommelse opbrugt�ingen syntaks angivet�programfejl�regulært udtryk er for stort�stakoverløb�flaget -P understøtter kun et enkelt mønster�kan ikke gemme nuværende arbejdskatalog�ubalanceret (�ubalanceret )�ubalanceret [�ufærdig \-undvigesekvens�ukendt binær filtype�ukendt enhedsmetode�skrivefejl������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/nl.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000042450�14670377471�016212� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��ª��#��ê���±$�����œ%��æ��&��Ì��„(�� ��Q*��L��^+��…��«-��$��1/��<��V1��³��“3�����G5��*���_5��6���Š5��-���Á5��*���ï5��2���6��)���M6�����w6��$���”6��)���¹6��#���ã6��7���7��&���?7��'���f7�����Ž7��-���ª7�����Ø7�����Ü7�����ß7��>���ñ7��š���08��1���Ë8�����ý8�����9�����19�����M9��*���g9�����’9�����§9����Å9�� ���Î:�����ï:�� ���;�����$;��$���D;��A���i;��(���«;�����Ô;��q���ô;��j���f<��1���Ñ<�����=����� =��&���!=�����H=�����^=�����q=�����„=�� ���¤=��.���²=�����á=��R��ú=�����M?��?���h?��6���¨?��2���ß?��.���@��*���A@��&���l@��"���“@�����¶@�����Õ@��a���ê@�����LA��$���PA��5���uA�����«A��,���ËA��7���øA��3���0B��B���dB��&���§B��4���ÎB�����C�����C�����5C��$���OC�����tC�����’C�� ���ªC�����ËC�� ���áC�����ïC�����D��+���D��&���JD�� ���qD�� ���~D�� ���‹D�����˜D�����±D�����ÎD��3���èD�� ���E����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep-3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-11 11:40+0200 Last-Translator: Benno Schulenberg <vertaling@coevern.nl> Language-Team: Dutch <vertaling@vrijschrift.org> Language: nl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=2; plural=n != 1; � Contextbesturing: -B, --before-context=AANTAL dit AANTAL regels voorafgaande context tonen -A, --after-context=AANTAL dit AANTAL regels nakomende context tonen -C, --context=AANTAL dit AANTAL regels context tonen � Diversen: -s, --no-messages foutmeldingen onderdrukken -v, --invert-match de niet-overeenkomende regels selecteren -V, --version programmaversie tonen en stoppen --help deze hulptekst tonen en stoppen � Uitvoeropties: -m, --max-count=AANTAL na dit AANTAL overeenkomsten stoppen -b, --byte-offset bij de uitvoerregels het byte-adres tonen -n, --line-number bij de uitvoerregels het regelnummer tonen --line-buffered elke uitvoerregel direct tonen -H, --with-filename bij de uitvoerregels de bestandsnaam tonen -h, --no-filename nooit de bestandsnaam tonen --label=LABEL dit LABEL als naam voor standaardinvoer gebruiken � --include=BESTANDSPATROON alleen bestanden doorzoeken die aan BESTANDSPATROON voldoen --exclude=BESTANDSPATROON bestanden overslaan die aan BESTANDSPATROON voldoen --exclude-from=BESTAND bestanden overslaan die aan een bestandspatroon in BESTAND voldoen --exclude-dir=BSTNDSPTRN mappen overslaan die aan BSTNDSPTRN voldoen � -E, --extended-regexp PATRONEN zijn uitgebreide reguliere expressies -F, --fixed-strings PATRONEN zijn tekenreeksen -G, --basic-regexp PATRONEN zijn gewone reguliere expressies -P, --perl-regexp PATRONEN zijn reguliere Perl-expressies � -I hetzelfde als '--binary-files=without-match' -d, --directories=ACTIE mappen behandelen met deze ACTIE; ACTIE is 'read', 'recurse' of 'skip' (ofwel lezen, in-afdalen, of overslaan) -D, --devices=ACTIE apparaten, FIFO's en sockets behandelen met ACTIE; ACTIE is 'read' of 'skip' (lezen of overslaan) -r, --recursive afdalen in submappen (ofwel '--directories=recurse') -R, --dereference-recursive idem, maar alle symbolische koppelingen volgen � -L, --files-without-match alleen namen van bestanden zonder overeenkomst tonen -l, --files-with-matches alleen namen van bestanden met overeenkomsten tonen -c, --count alleen het aantal overeenkomsten per bestand tonen -T, --initial-tab tabs uitlijnen (eventueel een tab-teken invoegen) -Z, --null een 0-byte invoegen na iedere bestandsnaam � -AANTAL hetzelfde als '--context=AANTAL' --group-separator=TEKENS contexten scheiden met regel met deze tekens --no-group-separator geen scheiding weergeven tussen contexten --color[=WANNEER], --colour[=WANNEER] overeenkomende tekst gekleurd weergeven; WANNEER is 'always' (altijd), 'never' (nooit), of 'auto' (gepast voor uitvoerdoel; standaard) -U, --binary geen CR-tekens weghalen bij regeleinde (MSDOS/Windows) � -e, --regexp=PATRONEN deze PATRONEN gebruiken bij het zoeken -f, --file=BESTAND patronen uit dit BESTAND halen -i, --ignore-case verschil tussen hoofd- en kleine letters negeren in de patronen en in de gegevens --no-ignore-case hoofd- van kleine letters onderscheiden (standaard) -w, --word-regexp patronen komen alleen overeen met een heel woord -x, --line-regexp patronen komen alleen overeen met een hele regel -z, --null-data regels eindigen op 0-byte, niet op LF-teken � -o, --only-matching alleen overeenkomende niet-lege fragmenten tonen -q, --quiet, --silent alle normale uitvoer onderdrukken --binary-files=TYPE aannemen dat binaire bestanden van dit TYPE zijn; TYPE is 'binary' (binair), 'text' (als tekst), of 'without-match' (alsof geen overeenkomsten) -a, --text hetzelfde als '--binary-files=text' �Webpagina van %s: <%s> �%s: binair bestand bevat de gezochte tekst�%s: de terugverwijzingengrens van PCRE is overschreden�%s: de recursiegrens van PCRE is overschreden�%s: de PCRE-JIT-stack is volledig gebruikt�%s: invoerbestand is gelijk aan het uitvoerbestand�%s: **interne programmafout** in PCRE: %d�%s: ongeldige optie -- '%c' �%s: onvoldoende geheugen beschikbaar�%s: optie '%s%s' staat geen argument toe �%s: optie '%s%s' is niet eenduidig �%s: optie '%s%s' is niet eenduidig; mogelijkheden zijn:�%s: optie '%s%s' vereist een argument �%s: optie vereist een argument -- '%c' �%s: onbekende optie '%s%s' �%s: waarschuwing: recursieve lus in de mappen�’�©�(standaardinvoer)�optie '-P' ondersteunt alleen enkelbytes- en UTF-8-taalregio's� Voorbeeld: %s -i 'hallo wereld' menu.h main.c PATRONEN kan uit meerdere patronen op aparte regels bestaan. Keuze en interpretatie van PATRONEN: �Algemene hulp bij gebruik van GNU-software: <%s> �Ongeldige terugverwijzing�Ongeldige tekenklassenaam�Ongeldig samengesteld teken�Ongeldige inhoud van \{\}�Ongeldige voorafgaande reguliere expressie�Ongeldig bereikeinde�Ongeldige reguliere expressie�Dit is vrije software: u mag het vrijelijk wijzigen en verder verspreiden. De precieze licentie is GPL-3+: GNU General Public License versie 3 of later. Zie <%s> voor de volledige (Engelse) tekst. Deze software kent GEEN GARANTIE, voor zover de wet dit toestaat. �Onvoldoende geheugen beschikbaar�Geen overeenkomsten�Geen eerdere reguliere expressie�In pakketvorm gebracht door %s �In pakketvorm gebracht door %s (%s) �Perl-expressies worden door deze programmaversie niet ondersteund�Voortijdig einde van reguliere expressie�Reguliere expressie is te groot�Rapporteer gebreken in het programma '%s' aan <%s>; meld fouten in de vertaling aan <vertaling@vrijschrift.org>. �Rapporteer gebreken in het programma aan %s; meld fouten in de vertaling aan <vertaling@vrijschrift.org>. � Zoekt naar PATRONEN in ieder gegeven BESTAND. �Gelukt�Backslash aan het eind�Typ '%s --help' voor meer informatie. �Onbekende systeemfout�Ongepaarde ( of \(�Ongepaarde ) of \)�Ongepaarde [, [^, [:, [., of [=�Ongepaarde \{�Gebruik: %s [OPTIE...] PATRONEN [BESTAND...] �Geldige argumenten zijn:�Indien BESTAND '-' is, wordt standaardinvoer gelezen. Zonder een BESTAND wordt '.' gelezen indien in recursieve modus, anders wordt '-' gelezen. Bij minder dan twee BESTANDen wordt '-h' aangenomen. De afsluitwaarde is 0 in geval van overeenkomsten, anders 1; als er een fout optreedt en '-q' is niet gegeven, dan is de afsluitwaarde 2. �Geschreven door %s en %s. �Geschreven door %s, %s, %s, %s, %s, %s, %s, %s, %s en anderen. �Geschreven door %s, %s, %s, %s, %s, %s, %s, %s en %s. �Geschreven door %s, %s, %s, %s, %s, %s, %s en %s. �Geschreven door %s, %s, %s, %s, %s, %s en %s. �Geschreven door %s, %s, %s, %s, %s en %s. �Geschreven door %s, %s, %s, %s en %s. �Geschreven door %s, %s, %s en %s. �Geschreven door %s, %s en %s. �Geschreven door %s. �Geschreven door Mike Haertel en anderen; zie <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�‘�argument %s van %s is niet eenduidig�syntax van tekenklasse is [[:space:]], niet [:space:]�conflicterende expressiesoorten�de regellengtegrens van PCRE is overschreden�onvoldoende geheugen beschikbaar voor de PCRE-JIT-stack�kan niet terugkeren naar de oorspronkelijke werkmap�kan modus van bestandsdescriptor niet instellen op tekst of binair�invoer is te groot om te kunnen tellen�**interne programmafout** (zou nooit mogen gebeuren)�ongeldig argument %s van %s�ongeldige tekenklasse�ongeldige inhoud van \{\}�ongeldig argument voor contextlengte�ongeldige expressiesoort '%s'�ongeldig maximum aantal�onvoldoende geheugen beschikbaar�geen syntax opgegeven�programmafout�reguliere expressie is te groot�stack-overloop�optie '-P' accepteert slechts één patroon�kan de huidige werkmap niet vastleggen�ongepaarde (�ongepaarde )�ongepaarde [�onafgemaakte \-stuurcode�onbekend binair bestandstype�onbekende apparaten-actie�waarschuwing: --unix-byte-offsets (-u) is verouderd�schrijffout�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/hr.po�����������������������������������������������������������������������0000664�0001750�0001750�00000101741�14670377450�016042� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# The Croatian translation of grep. # Copyright © 2016 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # bp, nekoliko noticija # ovo je ista verzija grep.po kao 2012. od TK. Samo je nekoliko rijeÄi # izmjenjeno. Dodani su novi msgid-ovi i popravljeni su fuzzies. # U sljedećoj verziji bit će viÅ¡e izmjena, nakon konzultacije s # lingvistima, i hrvatskim TP Älanovima. # Zahvaljujem prijaÅ¡njim prevoditeljima, jer je na njihovom trudu, # napravljena i ova dopuna. # Matej Vela <mvela@public.srce.hr>, 1999. # Hrvoje Niksic <hniksic@xemacs.org>, 2002. # Tomislav Krznar <tomislav.krznar@gmail.com>, 2012. # Božidar Putanec <bozidarp@yahoo.com>, 2016-2019, 2021. # bp, 2016-04-03. msgid "" msgstr "" "Project-Id-Version: grep-3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 16:49+0200\n" "Last-Translator: Božidar Putanec <bozidarp@yahoo.com>\n" "Language-Team: Croatian <lokalizacija@linux.hr>\n" "Language: hr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Generator: Poedit 3.0\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "nevaljani argument %s za %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "viÅ¡eznaÄni argument %s za %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Valjani argumenti su:" #: lib/c-stack.c:187 msgid "program error" msgstr "greÅ¡ka u programu" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "prelijevanje stÈga" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "greÅ¡ka pri pisanju" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ nema odgovarajući par" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "nevaljana znakovna klasa" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "sintaksa znakovne klase je [[:space]], ne [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "nedovrÅ¡ena \\ escape sekvencija" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "nevaljani sadržaj u \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "preveliki regularni izraz" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( nema odgovarajući par" # „zadano“ je Äesto „default“, pa radije „navedena“ ili „imenovana“ #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "sintaksa nije navedena" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") nema odgovarajući par" #: lib/error.c:195 msgid "Unknown system error" msgstr "Nepoznata greÅ¡ka sustava" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: opcija „%s%s“ nije jednoznaÄna\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: opcija „%s%s“ nije jednoznaÄna; mogućnosti su:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: neprepoznata opcija „%s%s“\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: opcija „%s%s“ ne dopuÅ¡ta argument\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: opcija „%s%s“ zahtijeva argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: nevaljana opcija -- „%c“\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: opcija zahtijeva argument -- „%c“\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "nema dovoljno memorije" # lingvisti: trenutni > trenutaÄni #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "nije moguće registrirati trenutni radni direktorij" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "nije se uspjelo vratiti u poÄetni radni direktorij" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "nije uspjelo postaviti deskriptor datoteke u tekst/binarni naÄin" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "„" #: lib/quotearg.c:356 msgid "'" msgstr "“" #: lib/regcomp.c:135 msgid "Success" msgstr "Uspjeh" # no match: _REG_NOMATCH, /* Didn't find a match (for regexec). */ #: lib/regcomp.c:138 msgid "No match" msgstr "Nema podudaranja" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Nevaljani regularni izraz" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Nevaljani znak za razvrstavanje" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Nevaljano ime za klasu znakova" # obrnuta > obratna #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Zaostala obratna kosa crta" # http://ihjj.hr/ referenca > referencija #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Nevaljana povratna referencija" # bp: fuzzy > popravljen # razmotri: nema para za [, [^, [:, [., ili [= #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[, [^, [:, [., ili [= nema odgovarajući par" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( ili \\( nema odgovarajući par" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ nema odgovarajući par" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Nevaljani sadržaj u \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Nevaljani kraj raspona" # nedostaje memorije #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Nema dovoljno memorije" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Nevaljani prethodni regularni izraz" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "NedovrÅ¡eni regularni izraz (preuranjeni zavrÅ¡etak)" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Preveliki regularni izraz" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") ili \\) nema odgovarajući par" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Nema prethodnog regularnog izraza" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Spakirali %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Spakirao %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licencija GPLv3+: GNU GPL inaÄica 3 ili novija <%s>.\n" "Ovo je slobodan softver: slobodno ga mijenjajte i dijelite.\n" "NEMA JAMSTVA do granica dopuÅ¡tenih zakonom.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Napisao %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Napisali %s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Napisali %s, %s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Napisali %s, %s, %s\n" "i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Napisali %s, %s, %s,\n" "%s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Napisali %s, %s, %s,\n" "%s, %s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Napisali %s, %s, %s,\n" "%s, %s, %s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Napisali %s, %s, %s,\n" "%s, %s, %s, %s\n" "i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Napisali %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Napisali %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s i ostali.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" "GreÅ¡ke u programu javite na <%s>.\n" "Primjedbe i pogreÅ¡ke u prijevodu javite na <lokalizacija@linux.hr>.\n" # prvi %s PACKAGE_PACKAGER, # drugi %s PACKAGE_PACKAGER_BUG_REPORTS #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "PogreÅ¡ke %s javite (na engleskom, LC_ALL=C) na <%s>\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Mrežna stranica za %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Općenita pomoć za koriÅ¡tenje GNU softvera: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(standardni ulaz)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "nevaljani kontekst duljine argumenta" #: src/grep.c:894 msgid "input is too large to count" msgstr "ulaz je prevelik da se prebroji" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: binarna datoteka se podudara" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s upozorenje: rekurzivna petlja direktorija" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: ulazna datoteka je ujedno i izlaz" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Uporaba: %s [OPCIJA]... UZORCI [DATOTEKA]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "PokuÅ¡ajte s „%s --help“ za pomoć i viÅ¡e informacija.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Traži UZORKE u svakoj DATOTECI.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Primjer: %s -i 'hello world' menu.h main.c\n" "UZORCI mogu sadržavati viÅ¡estruke mustre odijeljene sa znakom za novi redak " "(\\n).\n" "\n" "Izbor uzorka i interpretacija:\n" # engl. „string“ hrvatske mogućnosti: biseri, zrna i sl. nanizani na nit; niska. # Prijedlog je string > niska # vidi http://hjp.znanje.hr/index.php?show=search_by_id&id=eF1uXRg%3D # ili ostavimo string = string ! #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp UZORAK je proÅ¡ireni regularni izraz (ERE)\n" " -F, --fixed-strings UZORAK je skup stringova odvojenih\n" " znakom novog retka (\\n)\n" " -G, --basic-regexp UZORAK je osnovni regularni izraz (BRE)\n" " -P, --perl-regexp UZORAK je Perl regularni izraz\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=UZORCI koristi UZORKE kao regularni izraz\n" " -f, --file=DATOTEKA preuzmi UZORKE iz DATOTEKE\n" " -i, --ignore-case zanemari veliÄinu slova u uzorcima i podacima\n" " --no-ignore-case ne zanemaruje veliÄinu slova (zadano)\n" " -w, --word-regexp UZORAK podudara samo cijele rijeÄi\n" " -x, --line-regexp UZORAK podudara samo cijele redove\n" " -z, --null-data redak zavrÅ¡ava s 0-bajtom, a ne sa znakom novog " "retka\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Razno:\n" " -s, --no-messages izostavi poruke o greÅ¡kama\n" " -v, --invert-match odabere redove koji se ne podudaraju\n" " -V, --version informacije o inaÄici ovog programa\n" " --help ova pomoć\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Kontrola izlaza:\n" " -m, --max-count=BROJ prestane nakon BROJ naÄ‘enih redaka\n" " -b, --byte-offset uz retke ispiÅ¡e i poziciju u bajtovima\n" " -n, --line-number uz retke ispiÅ¡e broj retka\n" " --line-buffered izravno ispiÅ¡e svaki izlazni redak\n" " -H, --with-filename uz retke ispiÅ¡e ime datoteke za svako " "podudaranje\n" " -h, --no-filename bez ispisa imena datoteke za svako podudaranje\n" " --label=OZNAKA rabi OZNAKU kao ime datoteke na standardnom " "ulazu\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching prikaže samo dio retka koji se podudara\n" " -q, --quiet, --silent izostavi svaki normalni izlaz (niÅ¡ta ne ispiÅ¡e)\n" " --binary-files=VRSTA pretpostavi binarne datoteke tipa VRSTA;\n" " VRSTA je „binary“, „text“ ili „without-match“\n" " -a, --text isto kao --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I isto kao --binary-files=without-match\n" " -d, --directories=AKCIJA kako rukovati direktorijima;\n" " AKCIJA je „read“, „recurse“ ili „skip“\n" " -D, --devices=AKCIJA kako rukovati ureÄ‘ajima, FIFO ureÄ‘ajima\n" " i utiÄnicama; AKCIJA je „read“ ili „skip“\n" " -r, --recursive isto kao --directories=recurse\n" " -R, --dereference-recursive jednako, ali slijedi svaku simboliÄku vezu\n" # http://hjp.znanje.hr/index.php?show=kosi_oblici&id=eVxhWxI%3D # podudaran > koji je sukladan s Äim, koji se poklapa s kim/Äim #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB pretraži samo datoteke koje se podudaraju\n" " s GLOB-om (datoteka s uzorcima)\n" " --exclude=GLOB preskoÄi sve datoteke i direktorije koji se\n" " podudaraju s GLOB-om (datoteka s uzorcima)\n" " --exclude-from=DATOTEKA preskoÄi sve datoteke koje se podudaraju s\n" " bilo kojim uzorkom u DATOTEKA\n" " --exclude-dir=GLOB preskoÄi direktorije koji podudaraju GLOB\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match ispiÅ¡e samo imena DATOTEKA bez podudaranja\n" " -l, --files-with-matches ispiÅ¡e samo imena DATOTEKA s podudaranjima\n" " -c, --count ispiÅ¡e samo broj podudarnih redaka po DATOTECI\n" " -T, --initial-tab poravna tabove (ako je potrebno)\n" " -Z, --null ispiÅ¡e 0-bajt nakon imena DATOTEKE\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Kontrola konteksta:\n" " -B, --before-context=BROJ ispiÅ¡e BROJ redaka konteksta koji prethode\n" " -A, --after-context=BROJ ispiÅ¡e BROJ redaka konteksta koji slijede\n" " -C, --context=BROJ ispiÅ¡e BROJ redaka konteksta koji prethode/" "slijede\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -BROJ isto kao --context=BROJ\n" " --group-separator=SEP ispiÅ¡e SEP(arator) u retku izmeÄ‘u\n" " podudaranja s kontekstom\n" " --no-group-separator ne ispiÅ¡e separator za podudaranja s kontektsom\n" " --color[=KADA],\n" " --colour[=KADA] bojama istakne naÄ‘ene stringove i markere;\n" " KADA može biti „always“ ili „never“ ili „auto“\n" " -U, --binary ne uklanja CqR znakove na EOL (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Ako je DATOTEKA „-“ (spojnica), Äita standardni ulaz. Bez DATOTEKE,\n" "rekurzivno Äita „.“, inaÄe Äita „-“ (stdin).\n" "S manje od dvije navedene DATOTEKE implicira opciju -h.\n" "ZavrÅ¡i sa statusom 0 ako je naÄ‘en barem jedan redak, inaÄe s 1;\n" "ako ima greÅ¡aka, a nije navedena opcija -q, zavrÅ¡i sa statusom 2.\n" # matchers su tragaÄi (java, perl, itd.) #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "navedeni uzorci su meÄ‘usobno konfliktni" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Kompiliranje s --disable-perl-regexp ne podržava podudaranje na Perl naÄin" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "nevaljana sintaksa uzorka %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "nepoznata metoda ureÄ‘aja" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "upozorenje: opcija--unix-byte-offsets (-u) je zastarjela" #: src/grep.c:2686 msgid "invalid max count" msgstr "nevaljani maksimalni broj" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "nepoznata vrsta binarnih datoteka" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Napisali Mike Haertel i ostali; vidi\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." # bp: novi msgid #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "dodjela memorije za PCRE JIT stÈg nije uspjela" # bp: novi msgid #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P podržava samo unibyte i UTF-8 locale" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "opcija -P podržava samo jedan uzorak" # bp: novi msgid #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "**interna greÅ¡ka** (nije se smjela dogoditi)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "prekoraÄeno je ograniÄenje duljine retka PCRE-a" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: nema dovoljno memorije" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: PCRE JIT stÈg je iscrpljen" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: prekoraÄeno je ograniÄenje broja vraćanja PCRE-a" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: prekoraÄeno je ograniÄenje broja rekurzija PCRE-a" # bp:fuzzy popravljen #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: interna PCRE greÅ¡ka: %d" #~ msgid "warning: %s: %s" #~ msgstr "upozorenje: %s: %s" # bp: alias > pseudonim ? > nadimak ? # script > skripta #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "Upozorenje: upotreba GREP_OPTIONS je zastarjela ; rabite alias ili script" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "%s internetska stranica: <https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "nevaljani %s%s argument „%s“" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "nevaljani sufiks u %s%s argumentu „%s“" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s argument „%s“ je preveliki" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "interna greÅ¡ka" # http://ihjj.hr/ : dozvoljava > dopuÅ¡ta #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: opcija „--%s“ ne dopuÅ¡ta argument\n" # http://ihjj.hr/ : nepropoznat > nije prepoznat > nepoznat # neprepoznat: možda bi trebao biti prepoznat, ali nije #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: nepoznata opcija „--%s“\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: opcija „-W %s“ nije jednoznaÄna\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: opcija „-W %s“ ne dopuÅ¡ta argument\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: opcija „-W %s“ zahtijeva argument\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "UZORAK je (podrazumijeva se) osnovni regularni izraz (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "„egrep“ znaÄi „grep -E“. „fgrep“ znaÄi „grep -F“.\n" #~ "Izravno pozivanje „egrep“ i „fgrep“ je zastarjelo.\n" #~ msgid "lseek failed" #~ msgstr "lseek nije uspio" # bp: novi msgid # escape > cause (a subsequent character or characters) to be interpreted differently. #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "znakovi ^ ili $ bez prethodne ‘\\’ (unescaped) nisu podržani s -Pz" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "UZORAK je proÅ¡ireni regularni izraz (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "Pozivanje naredbom „egrep†je zastarjelo; koristite „grep -Eâ€.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "" #~ "UZORAK je skup fiksnih znakovnih nizova odvojenih znakom novog retka.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "Pozivanje naredbom „fgrep†je zastarjelo; koristite „grep -Fâ€.\n" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "GNU Grep poÄetna stranica: <%s>\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s može koristiti samo %s sintaksu uzoraka" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "opcija --map je prazna operacija (no-op) od 2010." #~ msgid "unfinished repeat count" #~ msgstr "nedovren broj ponavljanja" #~ msgid "malformed repeat count" #~ msgstr "izoblien broj ponavljanja" #~ msgid "out of memory" #~ msgstr "ponestalo memorije" #~ msgid "writing output" #~ msgstr "piem izlaz" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Koritenje: %s [OPCIJA]... UZORAK [SPIS] ...\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Kontrola izlaza:\n" #~ " -m, --max-count=BROJ zaustavi se nakon BROJA preklapanja\n" #~ " -b, --byte-offset ispii bajtovni offset uz brojeve linija\n" #~ " -n, --line-number ispii brojeve linija uz izlazne linije\n" #~ " --line-buffered poalji izlaz nakon svakog reda\n" #~ " -H, --with-filename ispii naziv spisa pri svakom poklapanju\n" #~ " -h, --no-filename ne ispisuj naziv spisa na izlazu\n" #~ " --label=LABELA ispii LABELU kao naziv spisa za standardni " #~ "izlaz\n" #~ " -o, --only-matching prikai samo dio retka koji se preklapa s " #~ "UZORKOM\n" #~ " -q, --quiet, --silent zatomi sav normalan izlaz\n" #~ " --binary-files=TIP pretpostavi da su binarni spisi TIPA\n" #~ " TIP je 'binary', 'text' ili 'without-match'\n" #~ " -a, --text ekvivalentno --binary-files=text\n" #~ " -I ekvivalentno --binary-files=without-match\n" #~ " -d, --directories=RADNJA to initi s direktorijima\n" #~ " RADNJA je 'read' (itaj), " #~ "'recurse' (rekurzivno\n" #~ " ui) ili 'skip' (preskoi)\n" #~ " -D, --devices=RADNJA to initi s deviceovima, FIFO-ima i socketima\n" #~ " RADNJA je 'read' (itaj) ili 'skip' (preskoi)\n" #~ " -R, -r, --recursive ekvivalentno --directories=recurse\n" #~ " --include=UZORAK obradi spise koji se poklapaju s UZORKOM\n" #~ " --exclude=UZORAK preskoi spise koji se poklapaju s UZORKOM\n" #~ " --exclude-from=SPIS preskoi spise koji se poklapaju s UZORKOM u " #~ "SPISU\n" #~ " -L, --files-without-match ispii samo nazive SPISA koji se nisu " #~ "poklopili\n" #~ " -l, --files-with-matches ispii samo nazive SPISA koji sadre " #~ "podudarnosti\n" #~ " -c, --count ispii samo broj podudarnih linija po SPISU\n" #~ " -Z, --null ispii 0-bajt nakon naziva SPISA\n" #~ msgid "" #~ "\n" #~ "Report bugs to <bug-gnu-utils@gnu.org>.\n" #~ msgstr "" #~ "\n" #~ "Bugove prijavljujte na <bug-gnu-utils@gnu.org>.\n" #~ msgid "unknown directories method" #~ msgstr "nepoznata metoda za direktorije" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Ovo je slobodan program; za uvjete kopiranja pogledajte izvorni kod. " #~ "NEMA\n" #~ "jamstva; ak ni za TRGOVINSKU PRIKLADNOST ili ODGOVARANJE ODREENOJ SVRSI.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Opcije -P i -z ne idu zajedno" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: nedoputena opcija -- %c\n" �������������������������������kbuild-3608/src/grep/po/id.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000040505�14670377471�016174� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��°��#��Ö���·$����Ž%�� ��‘&��8��›(��ö���Ô)��Ê��Ë*��q��–,��Ð��.����Ù/��]��ê1�����H3�����\3��"���s3�� ���–3�����·3��(���Ð3�����ù3�����4�����54��1���J4�����|4��$���”4��+���¹4��*���å4�����5��-���/5�����]5�����_5�����c5��+���u5��‡���¡5��,���)6�����V6�����r6�����’6�����®6��,���È6�����õ6�����7��Ö���,7�����8�����8��%���'8�����M8�����b8��F���{8�� ���Â8�����ã8�����9�����9�����19�����Q9�����X9��/���l9�����œ9�����»9�����Ô9��%���í9�����:��*���%:�����P:��#��k:�����;��@���¨;��5���é;��1���<��-���Q<��)���<��%���©<��!���Ï<�����ñ<�����=��`���!=�����‚=�����„=��:���Ÿ=��+���Ú=��"���>��0���)>��)���Z>��.���„>��$���³>��2���Ø>��$��� ?�����0?�����K?��#���e?�����‰?�����¡?�����¸?��!���É?�����ë?�����ý?�����@��+���+@��+���W@�����ƒ@�����”@�����¥@�����¶@�����Í@�����í@��*��� A�����5A����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-10 10:35+0700 Last-Translator: Andika Triwidada <andika@gmail.com> Language-Team: Indonesian <translation-team-id@lists.sourceforge.net> Language: id MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Poedit 2.4.3 � Kendali konteks: -B, --before-context=NUM cetak NUM baris yang mendahului konteks -A, --after-context=NUM cetak NUM baris yang mengikuti konteks -C, --context=NUM cetak NUM baris konteks keluaran � Lain-lain: -s, --no-messages sembunyikan pesan kesalahan -v, --invert-match pilih baris-baris yang tidak sesuai -V, --version tampilkan informasi versi dan keluar --help tampilkan bantuan ini dan keluar � Kendali keluaran: -m, --max-count=NUM berhenti setelah NUM kecocokan -b, --byte-offset cetak ofset byte dengan baris-baris keluaran -n, --line-number cetak nomor baris dengan baris-baris keluaran --line-buffered gelontor keluaran pada setiap baris -H, --with-filename cetak nama berkas dengan baris-baris keluaran -h, --no-filename sembunyikan prefiks nama berkas pada keluaran --label=LABEL pakai LABEL sebagai prefiks nama berkas masukan standar � --include=GLOB hanya cari berkas yang cocok dengan GLOB (suatu pola berkas) --exclude=GLOB lewati berkas yang cocok dengan GLOB --exclude-from=BERKAS lewati berkas yang cocok dengan sebarang pola dari BERKAS --exclude-dir=GLOB lewati direktori yang cocok dengan GLOB � -E, --extended-regexp POLA adalah ekspresi reguler diperluas -F, --fixed-string POLA adalah string -G, --basic-regexp POLA adalah ekspresi reguler dasar -P, --perl-regexp POLA adalah sebuah ekspresi reguler Perl � -I ekuivalen dengan --binary-files=without-match -d, --directories=AKSI bagaimana menangani direktori; AKSI adalah 'read', 'recurse', atau 'skip' -D, --devices=AKSI bagaimana menangani peranti, FIFO, dan soket; AKSI adalah 'read' atau 'skip' -r, --recursive seperti --directories=recurse -R, --dereference-recursive serupa, tapi ikut semua symlink � -L, --files-without-match hanya cetak nama BERKAS yang tidak memuat baris yang cocok -l, --files-with-matches hanya cetak nama BERKAS dengan baris yang cocok -c, --count hanya cetak cacah baris yang cocok per BERKAS -T, --initial-tab jadikan tab sejajar (bila diperlukan) -Z, --null cetak byte 0 setelah nama BERKAS � -NUM sama seperti --context=NUM --group-separator=SEP cetak SEP pada baris antara kecocokan dengan konteks --no-group-separator jangan cetak pemisah untuk kecocokan dengan konteks --color[=WHEN], --colour[=WHEN] gunakan penanda untuk membedakan string yang cocok WHEN dapat berupa 'always', 'never', atau 'auto' -U, --binary jangan hapus karakter CR di EOL (MSDOS) � -e, --regexp=POLA gunakan POLA untuk pencocokan -f, --file=BERKAS dapatkan POLA dari BERKAS -i, --ignore-case abaikan perbedaan besar kecil huruf dalam pola dan data --no-ignore-case jangan abaikan perbedaan besar kecil huruf (baku) -w, --word-regexp paksa POLA hanya untuk pencocokan dengan keseluruhan kata -x, --line-regexp paksa POLA hanya untuk pencocokan dengan keseluruhan baris -z, --null-data baris data berakhir dengan byte 0, bukan baris-baru � -o, --only-matching hanya tampilkan bagian dari baris yang cocok -q, --quiet, --silent sembunyikan semua keluaran normal --binary-files=TIPE asumsikan bahwa berkas biner adalah TIPE; TIPE adalah 'binary', 'text', atau 'without-match' -a, --text ekuivalen dengan --binary-files=text �Laman web %s: <%s> �%s: berkas biner cocok�%s: melampaui batas backtrack PCRE�%s: melampaui batas rekursi PCRE�%s: stack JIT PCRE habis�%s: berkas masukan juga sebagai keluaran�%s: kesalahan PCRE internal: %d�%s: opsi tidak valid -- %c �%s: kehabisan memori�%s: opsi '%s%s' tidak mengizinkan sebuah argumen �%s: opsi '%s%s' ambigu �%s: opsi '%s%s' ambigu; kemungkinan:�%s: opsi '%s%s' membutuhkan sebuah argumen �%s: opsi membutuhkan sebuah argumen -- %c �%s: opsi tidak dikenal '%s%s' �%s: peringatan: perulangan direktori rekursif�'�(C)�(masukan standar)�-P hanya mendukung unibyte dan locale UTF-8�Contoh: %s -i 'hello world' menu.h main.c POLA bisa memuat beberapa pola yang dipisah oleh baris baru. Seleksi dan interpretasi pola: �Bantuan umum menggunakan aplikasi GNU: <%s> �Referensi balik tidak valid�Nama kelas karakter tidak valid�Karakter kolasi tidak valid�Isi dari \{\} tidak valid�Ekspresi reguler yang mendahului tidak valid�Akhir rentang tidak valid�Ekspresi reguler tidak valid�Lisensi GPLv3+; GNU GPL versi 3 atau lebih lanjut <%s>. Ini adalah aplikasi bebas; Anda bebas untuk mengubah dan meredistribusikannya. TIDAK ADA GARANSI disini, sampai batas yang diijinkan oleh hukum yang berlaku. �Kehabisan memori�Tak ada yang cocok�Tidak ada ekspresi reguler sebelumnya�Dipaketkan oleh %s �Dipaketkan oleh %s (%s) �Pencocokan Perl tidak didukung dalam suatu build --disable-perl-regexp�Akhir dini dari ekspresi reguler�Ekspresi reguler terlalu besar�Laporkan kutu %s ke: %s �Laporkan kutu ke: %s �Cari POLA dalam setiap BERKAS. �Sukses�Kelebihan backslash�Coba '%s --help' untuk informasi lebih lanjut. �Kesalahan sistem tidak dikenal�( atau \( tanpa pasangan�) atau \) tanpa pasangan�[, [^, [:, [., atau [= tanpa pasangan�\{ tanpa pasangan�Penggunaan: %s [OPSI]... POLA [BERKAS]... �Argumen yang valid adalah:�Jika BERKAS adalah '-', baca masukan standar. Tanpa BERKAS, baca '.' bila rekursif, '-' jika tidak. Dengan kurang dari dua BERKAS, asumsikan -h. Status keluar adalah 0 jika baris apa pun dipilih, 1 jika tidak; jika ada kesalahan apapun dan opsi -q tidak diberikan, status keluar adalah 2. �Ditulis oleh %s dan %s. �Ditulis oleh %s, %s, %s, %s, %s, %s, %s, %s, %s, dan yang lain. �Ditulis oleh %s, %s, %s, %s, %s, %s, %s, %s, dan %s. �Ditulis oleh %s, %s, %s, %s, %s, %s, %s, dan %s. �Ditulis oleh %s, %s, %s, %s, %s, %s, dan %s. �Ditulis oleh %s, %s, %s, %s, %s, dan %s. �Ditulis oleh %s, %s, %s, %s, dan %s. �Ditulis oleh %s, %s, %s, dan %s. �Ditulis oleh %s, %s, and %s. �Ditulis oleh %s. �Ditulis oleh Mike Haertel dan lainnya, lihat <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�'�argumen %s ambigu untuk %s�sintaks kelas karakter adalah [[:space:]], bukan [:space:]�pencocok yang bertentangan dispesifikasikan�melampaui batas panjang baris PCRE�gagal mengalokasikan memori untuk stack JIT PCRE�gagal kembali ke direktori kerja sekarang�gagal menata mode teks/biner descriptor berkas�masukan terlalu besar untuk dihitung�kesalahan internal (mestinya tidak pernah terjadi)�argumen %s yang tidak valid untuk %s�kelas karakter tidak valid�isi dari \{\} tidak valid�argumen panjang konteks tidak valid�pencocok tidak valid %s�cacah maks tidak valid�kehabisan memori�tidak ada sintaks yang dinyatakan�kesalahan program�ekspresi reguler terlalu besar�stack overflow�opsi -P hanya mendukung sebuah pola tunggal�tidak bisa merekam direktori kerja sekarang�( tidak seimbang�) tidak seimbang�[ tidak seimbang�escape \ tidak selesai�tipe berkas biner tidak dikenal�metode peranti tidak dikenal�peringatan: --unix-byte-offsets (-u) usang�kesalahan tulis��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/tr.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000002341�14670377471�016221� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•���� ������„������ì�������0�����1�����3�����D�����U�����j�����l�����‹�����§�����Ç�����Ù�����ê�������ª�������Æ�����È�����Ù�����é�������1�����"���7��!���Z�����|�����—�����§�����Æ�������� �������������������� ������� ������ ��� ��������������'�(standard input)�Memory exhausted�Unknown system error�`�conflicting matchers specified�input is too large to count�invalid context length argument�invalid max count�memory exhausted�unknown binary-files type�unknown devices method�Project-Id-Version: grep 2.5.1a Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2005-03-04 16:37+0300 Last-Translator: Nilgün Belma Bugüner <nilgun@superonline.com> Language-Team: Turkish <gnu-tr-u12a@lists.sourceforge.net> Language: tr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: KBabel 1.0 �'�(standart girdi)�Bellek tükendi�Bilinmeyen sistem hatası�`�birbiriyle çatışan eÅŸleÅŸtiriciler belirtildi�girdi sayılamayacak kadar büyük�baÄŸlam uzunluk deÄŸeri geçersiz�en çok miktarı geçersiz�bellek tükendi�bilinmeyen ikilik dosya türü�bilinmeyen aygıt yöntemi������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/grep.pot��������������������������������������������������������������������0000664�0001750�0001750�00000036273�14670377450�016561� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Free Software Foundation, Inc. # This file is distributed under the same license as the GNU grep package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: GNU grep 3.7\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "" #: lib/error.c:195 msgid "Unknown system error" msgstr "" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "" #: lib/quotearg.c:356 msgid "'" msgstr "" #: lib/regcomp.c:135 msgid "Success" msgstr "" #: lib/regcomp.c:138 msgid "No match" msgstr "" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "" #: src/grep.c:649 msgid "(standard input)" msgstr "" #: src/grep.c:829 msgid "invalid context length argument" msgstr "" #: src/grep.c:894 msgid "input is too large to count" msgstr "" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "" #: src/grep.c:2538 msgid "unknown devices method" msgstr "" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/eo.po�����������������������������������������������������������������������0000664�0001750�0001750�00000077217�14670377450�016046� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Esperanto translations for GNU grep. # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013, 2014, 2015, 2016, 2018, 2020, 2021 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # “Jeder ist seines Glückes Schmied, # aber nicht jeder ist ein guter Schmied.†# # D. Dale Gulledge <dsplat@rochester.rr.com>, 1999. # Edmund GRIMLEY EVANS <edmundo@rano.org>, 2000-2009. # Benno Schulenberg <benno@vertaalt.nl>, 2013, 2014, 2015, 2016, 2018, 2020. # Felipe CASTRO <fefcas@gmail.com>, 2021. msgid "" msgstr "" "Project-Id-Version: GNU grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-10 21:36-0300\n" "Last-Translator: Felipe Castro <fefcas@gmail.com>\n" "Language-Team: Esperanto <translation-team-eo@lists.sourceforge.net>\n" "Language: eo\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Poedit 2.4.2\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "nevalida argumento %s por %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "ambigua argumento %s por %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Validaj argumentoj estas:" #: lib/c-stack.c:187 msgid "program error" msgstr "programeraro" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "staktroo" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "skrib-eraro" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "senpara [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "nevalida signoklaso" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "sintakso de signoklaso estas ekzemple [[:spaco:]], ne [:spaco:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "nefinita \\-eskapo" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "nevalida enhavo de \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "regulesprimo tro grandas" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "senpara (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "neniu sintakso indikatas" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "senpara )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Nekonata sistemeraro" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: opcio «%s%s» estas ambigua\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: opcio «%s%s» estas ambigua; eblaĵoj estas:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: nekonata opcio «%s%s»\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: opcio «%s%s» ne toleras argumenton\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: opcio «%s%s» bezonas argumenton\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: nevalida opcio -- «%c»\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: opcio bezonas argumenton -- «%c»\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "mankas sufiĉa memoro" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "ne eblas registri aktualan labordosierujon" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "malsukcesis reveni al komenca labordosierujo" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "malsukcesis agordi tekstan/duuman moduson de dosierpriaĵo" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "«" #: lib/quotearg.c:356 msgid "'" msgstr "»" #: lib/regcomp.c:135 msgid "Success" msgstr "Sukceso" #: lib/regcomp.c:138 msgid "No match" msgstr "Neniu trafo" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Nevalida regulesprimo" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Nevalida kunmetita signo" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Nevalida nomo de signoklaso" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Malsuprenstreko '\\' ĉe la fino" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Nevalida retroreferenco" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Senpara [, [^, [:, [., aÅ­ [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Senpara ( aÅ­ \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Senpara \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Nevalida enhavo de \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Nevalida fino de gamo" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Mankas sufiĉa memoro" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Nevalida antaÅ­a regulesprimo" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Neatendita fino de regulesprimo" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Regulesprimo tro grandas" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Senpara ) aÅ­ \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Mankas antaÅ­a regulesprimo" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Pakigita far %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Pakigita far %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Ĉi tiu estas libera programaro: vi rajtas Äin ÅanÄi kaj redistribui.\n" "La Äusta permesilo estas GPLv3+: GNU GPL versio 3 aÅ­ sekva;\n" "por la kompleta (angla) teksto vidu <%s>.\n" "Ĉi tiu programaro ne garantiatas, ene de la limoj de la leÄo.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Verkita de %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Verkita de %s kaj %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Verkita de %s, %s kaj %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Verkita de %s, %s, %s\n" "kaj %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Verkita de %s, %s, %s,\n" "%s kaj %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Verkita de %s, %s, %s,\n" "%s, %s kaj %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Verkita de %s, %s, %s,\n" "%s, %s, %s kaj %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Verkita de %s, %s, %s,\n" "%s, %s, %s, %s\n" "kaj %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Verkita de %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s kaj %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Verkita de %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s kaj aliaj.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" "Raportu programmisojn al <%s>;\n" "sciigu tradukerarojn al <translation-team-eo@lists.sourceforge.net>.\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Raportu programmisojn en %s al: <%s>\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "HejmpaÄo de «%s»: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Äœenerala helpo por uzi GNU-programojn: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(ĉefenigujo)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "nevalida kuntekstlongeca argumento" #: src/grep.c:894 msgid "input is too large to count" msgstr "enigo tro longas por nombri" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: duuma dosiero kongruas" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: averto: rikura ciklo de dosierujoj" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: eniga dosiero estas ankaÅ­ la eliga dosiero" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Uzmaniero: %s [OPCIO...] ÅœABLONOJ [DOSIERO...]\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Tajpu '%s --help' por pli da informoj.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Serĉas ÅœABLONOJn en ĉiu DOSIERO.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Ekzemplo: %s -i 'hello world' menu.h main.c\n" "ÅœABLONOJ povas esti pluraj Åablonoj disigitaj per linifinoj.\n" "\n" "Elekto kaj interpreto de Åablono:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp ÅœABLONOJ estas etenditaj regulesprimoj\n" " -F, --fixed-strings ÅœABLONOJ estas signoĉenoj\n" " -G, --basic-regexp ÅœABLONOJ estas bazaj regulesprimoj (defaÅ­lta)\n" " -P, --perl-regexp ÅœABLONOJ estas regulesprimoj de Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=ÅœABLONOJ uzi ÅœABLONOJn kiel regulesprimojn\n" " -f, --file=DOSIERO akiri la Åablonojn el DOSIERO\n" " -i, --ignore-case ignori diferencojn de uskleco, Åablone kaj " "datene\n" " --no-ignore-case ne ignori diferencojn de uskleco (defaÅ­lta)\n" " -w, --word-regexp kongrui nur kun tutaj vortoj\n" " -x, --line-regexp kongrui nur kun tutaj linioj\n" " -z, --null-data datenlinio finiÄas per bitoko 0, ne per " "linifino\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Diversaj:\n" " -s, --no-messages subpremi erarmesaÄojn\n" " -v, --invert-match elekti la nekongruajn liniojn\n" " -V, --version montri programversion kaj eliri\n" " --help montri ĉi tiun helpon kaj eliri\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Regado de la eligo:\n" " -m, --max-count==NOMBRO halti post NOMBRO da elektitaj linioj\n" " -b, --byte-offset montri la bitoknumeron kun eligataj linioj\n" " -n, --line-number montri la lininumeron kun eligataj linioj\n" " --line-buffered peli la eligon post ĉiu linio\n" " -H, --with-filename montri la dosiernomon antaÅ­ eligataj linioj\n" " -h, --no-filename subpremi la prefiksan dosiernomon ĉe eligo\n" " --label=ETIKEDO uzi ETIKEDOn kiel dosiernomon de ĉefenigujo\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching montri nur nevakajn kongruajn linipartojn\n" " -q, --quiet, --silent subpremi ĉian normalan eligadon\n" " --binary-files=SPECO supozi ke duumaj dosieroj estas de SPECO;\n" " SPECO estus 'binary' (duuma), " "'text' (teksta),\n" " aÅ­ 'without-match' (sen-trafa)\n" " -a, --text egalas al «--binary-files=text»\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I egalas al «--binary-files=without-match»\n" " -d, --directories=AGO kiel trakti dosierujojn; AGO estus " "'read' (legi),\n" " 'recurse' (rikure), aÅ­ 'skip' (ignori)\n" " -D, --devices=AGO kiel trakti specialajn dosierojn;\n" " AGO estus 'read' (legi), aÅ­ 'skip' (ignori)\n" " -R, -r, --recursive egalas al «--directories=recurse»\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=ÅœABLONO ekzameni nur dosierojn kiuj kongruas kun " "ÅœABLONO\n" " (dosiernomÅablonoj estas \"globbing\" " "Åablonoj)\n" " --exclude=ÅœABLONO ignori dosierojn kiuj kongruas kun ÅœABLONO\n" " --exclude-from=DSRO ignori dosierojn kiuj kongruas kun Åablono en " "DSRO\n" " --exclude-dir=ÅœABLONO ignori dosierujojn kiuj kongruas kun ÅœABLONO\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match montri nur nomojn de dosieroj sen trafo\n" " -l, --files-with-matches montri nur nomojn de dosieroj kun trafoj\n" " -c, --count montri nur la nombron de kongruaj linioj\n" " en ĉiu dosiero\n" " -T, --initial-tab rektigi la TAB-signojn (se necesas)\n" " -Z, --null eligi la bitokon «0» post dosiernomo\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Regado de la kunteksto:\n" " -B, --before-context=NOM montri NOM liniojn da antaÅ­a kunteksto\n" " -A, --after-context=NOM montri NOM liniojn da posta kunteksto\n" " -C, --context=NOMBRO egalas al «-A NOMBRO -B NOMBRO»\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NOMBRO egalas al «--context=NOMBRO»\n" " --group-separator=APT montri APT en linio inter kongruoj kun " "kunteksto\n" " --no-group-separator ne montri apartigilon por kongruoj kun " "kunteksto\n" " --color[=KIAM],\n" " --colour[=KIAM] uzi markilojn por distingi la kongruajn ĉenojn;\n" " KIAM estu 'always' (ĉiam), 'never' (neniam),\n" " aÅ­ 'auto'\n" " -U, --binary ne forigi \\r-signojn ĉe linifino (MSDOS/" "Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Kiam DOSIERO estas «-», ĉefenigujo legiÄas.\n" "Kiam DOSIERO mankas, «.» legiÄas se rikura, alie «-» legiÄas.\n" "Kiam malpli ol du DOSIEROj indikatas, «-h» supoziÄas.\n" "Elirstato estas 0 se iu linio elektiÄis, alie 1;\n" "se iu eraro okazis kaj «-q» ne indikatis, elirstato estas 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "pluraj esprimtipoj indikatas" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Perla kongruo ne funkcias ĉar ĉi tiu programo kompiliÄis kun «--disable-perl-" "regexp»" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "nevalida esprimtipo %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "nekonata ago por aparatoj" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "averto: --unix-byte-offsets (-u) malaktualas" #: src/grep.c:2686 msgid "invalid max count" msgstr "nevalida maksimuma nombro" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "nekonata ago por duumaj dosieroj" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Verkita de Majk HERTEL (Mike Haertel) kaj aliuloj; vidu\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "mankas sufiĉa memoro por la PCRE-JIT-stako" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "opcio «-P» subtenas nur unubajtajn kaj UTF-8-ajn lokaĵojn" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "opcio «-P» akceptas nur unuopan Åablonon" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "**interna eraro** (devus neniam okazi)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "transpasiÄis linilongecan limon de PCRE" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: mankas sufiĉa memoro" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: la PCRE-JIT-stako tute pleniÄis" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: transpasiÄis retroreferencan limon de PCRE" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: transpasiÄis rikuran limon de PCRE" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: interna eraro en PCRE: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "averto: GREP_OPTIONS evitindas; bonvolu uzi 'alias' aÅ­ skripton" #~ msgid "warning: %s: %s" #~ msgstr "averto: %s: %s" #~ msgid "%s home page: <http://www.gnu.org/software/%s/>\n" #~ msgstr "HejmpaÄo de «%s»: http://www.gnu.org/software/%s/\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "nevalida argumento de %s%s: «%s»" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "nevalida sufikso en argumento de %s%s: «%s»" #~ msgid "%s%s argument '%s' too large" #~ msgstr "argumento de %s%s tro grandas: «%s»" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: opcio «--%s» ne toleras argumenton\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: nekonata opcio «--%s»\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: opcio «-W %s» estas plursenca\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: opcio «-W %s» ne toleras argumenton\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: opcio «-W %s» bezonas argumenton\n" #~ msgid "lseek failed" #~ msgstr "malsukcesis 'lseek'" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "ÅœABLONO defaÅ­lte estas baza regulesprimo (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "Rekta alvoko kiel aÅ­ 'egrep' aÅ­ 'fgrep' malrekomendatas;\n" #~ "'egrep' signifas 'grep -E; 'fgrep' signifas 'grep -F'.\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "seneskapa ^ aÅ­ $ ne subtenatas kun opcio «-Pz»" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "nevalida UTF-8-a bajtsekvenco en enigo" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "ÅœABLONO estas etendita regulesprimo (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "Alvoko kiel 'egrep' malrekomendatas; uzu 'grep -E' anstataÅ­e.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "ÅœABLONO estas aro da fiksitaj signoĉenoj en apartaj linioj.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "Alvoko kiel 'fgrep' malrekomendatas; uzu 'grep -F' anstataÅ­e.\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s nur povas uzi sintakson de %s-Åablono" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "la opcio «--mmap» faras nenion, jam ekde 2010" #~ msgid "unfinished repeat count" #~ msgstr "nefinita ripetonombro" #~ msgid "malformed repeat count" #~ msgstr "misformita ripetonombro" #~ msgid "writing output" #~ msgstr "skribiÄas eligo" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Regado de la eligo:\n" #~ " -m, --max-count==NOMBRO halti post NOMBRO da trafoj\n" #~ " -b, --byte-offset presi la bitoknumeron kun eligataj linioj\n" #~ " -n, --line-number presi la lininumeron kun eligataj linioj\n" #~ " --line-buffered peli la eligon post ĉiu linio\n" #~ " -H, --with-filename presi la dosiernomon por ĉiu trafo\n" #~ " -h, --no-filename subpremi la prefiksan dosiernomon ĉe eligo\n" #~ " --label=ETIKEDO presi ETIKEDOn kiel dosiernomon de normala " #~ "enigo\n" #~ " -o, --only-matching montri nur la liniparton, kiu kongruas kun " #~ "ÅœABLONO\n" #~ " -q, --quiet, --silent subpremi ĉian normalan eligadon\n" #~ " --binary-files=SPECO supozi, ke binaraj dosieroj estas de SPECO\n" #~ " SPECO estas 'binary', 'text', aÅ­ 'without-" #~ "match'\n" #~ " -a, --text same kiel --binary-files=text\n" #~ " -I same kiel --binary-files=without-match\n" #~ " -d, --directories=AGO kiel trakti dosierujojn; AGO estas " #~ "'read' (legi),\n" #~ " 'recurse' (rekurse), aÅ­ 'skip' (ignori)\n" #~ " -D, --devices=AGO kiel trakti specialajn dosierojn;\n" #~ " AGO estas 'read' (legi), aÅ­ 'skip' (ignori)\n" #~ " -R, -r, --recursive same kiel --directories=recurse.\n" #~ " --include=ÅœABLONO ekzameni nur dosierojn, kiuj kongruas kun " #~ "ÅœABLONO\n" #~ " --exclude=ÅœABLONO ignori dosier(uj)ojn, kiuj kongruas kun " #~ "ÅœABLONO\n" #~ " --exclude-from=DOS ignori dosierojn, kiuj kongruas kun Åablono " #~ "en DOS\n" #~ " --exclude-dir=ÅœABLONO ignori dosierujojn, kiuj kongruas kun " #~ "ÅœABLONO\n" #~ " -L, --files-without-match presi nur dosiernomojn sen trafo\n" #~ " -l, --files-with-matches presi nur dosiernomojn kun trafoj\n" #~ " -c, --count presi nur nombron de kongruaj linioj en ĉiu " #~ "dosiero\n" #~ " -T, --initial-tab rektigi la TAB-signojn (se necese)\n" #~ " -Z, --null presi la bitokon 0 post dosiernomo\n" #~ msgid "" #~ "In GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped." #~ msgstr "En GREP_COLORS=\"%s\", \"%s\" bezonas valoron (\"=...\"); ignorite." #~ msgid "" #~ "In GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped." #~ msgstr "" #~ "En GREP_COLORS=\"%s\", \"%s\" estas bulea kaj ne povas alpreni valoron " #~ "(\"=%s\"); ignorite." #~ msgid "In GREP_COLORS=\"%s\", the \"%s\" capacity %s." #~ msgstr "En GREP_COLORS=\"%s\", \"%s\" %s." #~ msgid "" #~ "Stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"." #~ msgstr "" #~ "Ĉesis pritrakti malbone formitan GREP_COLORS=\"%s\" ĉe restanta subĉeno " #~ "\"%s\"." #~ msgid "unknown directories method" #~ msgstr "nekonata dosieruja metodo" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Ne eblas kombini la opciojn -P kaj -z" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: malpermesata opcio -- %c\n" #~ msgid "Copyright (C) 2008 Free Software Foundation, Inc.\n" #~ msgstr "Kopirajto (C) 2008 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Ĉi tiu estas libera programo; vidu la fonton por kopikondiĉoj. Estas\n" #~ "NENIA GARANTIO, eĉ ne pri KOMERCA KVALITO aÅ­ ADEKVATECO POR DIFINITA " #~ "CELO.\n" ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/sl.po�����������������������������������������������������������������������0000664�0001750�0001750�00000102376�14670377471�016057� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- mode: po; coding: utf-8; -*- Slovenian message catalogue for grep # Copyright (C) 1996, 1999, 2000, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2017 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Primož Peterlin <primozz.peterlin@gmail.com>, 1996, 1999, 2000, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2018. # # $Id: grep-3.0.23-b00.sl.po,v 1.2 2018/07/28 21:40:33 peterlin Exp $ # msgid "" msgstr "" "Project-Id-Version: GNU grep 3.0.23-b00\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2018-07-28 23:40+0200\n" "Last-Translator: Primož Peterlin <primozz.peterlin@gmail.com>\n" "Language-Team: Slovenian <translation-team-sl@lists.sourceforge.net>\n" "Language: sl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8-bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n" "%100==4 ? 3 : 0);\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "neveljavni argument %s za %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "dvoumni argument %s za %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Veljavni argumenti so:" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "napaka pri pisanju" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "uklepaj [ brez zaklepaja" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "neveljavno ime razreda znakov" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "skladnja imena razreda znakov je [[:space:]], ne [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "nedokonÄano ubežno zaporedje \\" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "neveljavna vsebina \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "regularni izraz je preobsežen" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "uklepaj ( brez zaklepaja" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "skladnja ni podana" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "zaklepaj ) brez uklepaja" #: lib/error.c:195 msgid "Unknown system error" msgstr "Neznana sistemska napaka" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: izbira »%s%s« ni enopomenska\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: izbira »%s%s« ni enopomenska; možnosti:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: neprepoznana izbira »%s%s«\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: izbira »%s%s« ne dovoljuje argumenta\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: izbira »%s%s« zahteva argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: neveljavna izbira -- »%c«\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: izbira zahteva argument -- »%c«\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "pomnilnik porabljen" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "trenutnega delovnega imenika ni mogoÄe zabeležiti" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "vrnitev v zaÄetni delovni imenik ni mogoÄa" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "nastavitev deskriptorja datoteke za tekstovni/binarni naÄin ni uspela" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "»" #: lib/quotearg.c:356 msgid "'" msgstr "«" #: lib/regcomp.c:135 msgid "Success" msgstr "UspeÅ¡no" #: lib/regcomp.c:138 msgid "No match" msgstr "Brez zadetkov" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Neveljaven regularen izraz" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Neveljaven razvrÅ¡Äevalni znak" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Neveljavno ime razreda znakov" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "ZakljuÄna obratna poÅ¡evnica" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Neveljaven povratni sklic" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Uklepaj [, [^, [:, [. ali [= brez para" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Uklepaj ( ali \\( brez para" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Uklepaj \\{ brez para" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Neveljavna vsebina \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Neveljaven konec razpona" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Pomnilnik porabljen" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Neveljaven predhodni regularni izraz" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "PredÄasen zakljuÄek regularnega izraza" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Regularni izraz je preobsežen" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Zaklepaj ) ali \\\\) brez para" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "ManjkajoÄ prejÅ¡nji regularni izraz" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Priprava paketa: %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Priprava paketa: %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, fuzzy, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "\n" "GPLv3+: GNU GPL, 3. izdaja ali poznejÅ¡a <http://www.gnu.org/licenses/gpl." "html>\n" "To je prosto programje; lahko ga redistribuirate in/ali spreminjate.\n" "Za izdelek ni NOBENEGA JAMSTVA, do z zakonom dovoljene meje.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Avtor(ica): %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Avtorja: %s in %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Avtorji: %s, %s in %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Avtorji: %s, %s, %s\n" "in %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Avtorji: %s, %s, %s,\n" "%s in %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Avtorji: %s, %s, %s,\n" "%s, %s in %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Avtorji: %s, %s, %s,\n" "%s, %s, %s in %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Avtorji: %s, %s, %s,\n" "%s, %s, %s, %s\n" "in %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Avtorji: %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s in %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Avtorji: %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s in drugi.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "PoroÄila o napakah: %s\n" "Napake v prevodu sporoÄite na <translation-team-sl@lists.sourceforge.net>.\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" "Napake v programu %s sporoÄite na %s.\n" "Napake v prevodu sporoÄite na <translation-team-sl@lists.sourceforge.net>.\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Spletna stran %s: <%s>\n" #: lib/version-etc.c:260 #, fuzzy, c-format msgid "General help using GNU software: <%s>\n" msgstr "SploÅ¡na pomoÄ za rabo programja GNU: <http://www.gnu.org/gethelp/>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(standardni vhod)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "velikost konteksta ni veljavna" #: src/grep.c:894 msgid "input is too large to count" msgstr "vhod je prevelik, da bi ga mogli preÅ¡teti" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Binarna datoteka %s ustreza\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "rekurzivna zanka imenikov" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "vhodna datoteka %s je tudi izhodna" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Uporaba: %s [IZBIRA]... VZOREC [DATOTEKA]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Poskusite »%s --help« za dodatna pojasnila.\n" #: src/grep.c:1969 #, fuzzy, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "V vsaki DATOTEKI se iÅ¡Äe VZOREC.\n" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Zgled: %s -i 'hello world' menu.h main.c\n" "\n" "Izbira in tolmaÄenje vzorcev:\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp VZOREC je razÅ¡irjeni regularni izraz\n" " -F, --fixed-strings VZOREC je množica nizov, vsak v svoji vrstici\n" " -G, --basic-regexp VZOREC je osnovni regularni izraz (privzeto)\n" " -P, --perl-regexp VZOREC je regularni izraz z razÅ¡iritvami perla\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=VZOREC uporabi VZOREC kot regularni izraz\n" " -f, --file=DATOTEKA preberi VZOREC iz podane DATOTEKE\n" " -i, --ignore-case velike in male Ärke obravnavaj enako\n" " -w, --word-regexp iskanje uspeÅ¡no le, Äe je VZOREC cela beseda\n" " -x, --line-regexp iskanje uspeÅ¡no le, Äe je VZOREC cela vrstica\n" " -z, --null-data vrstica podatkov je konÄana z znakom NUL, ne z\n" " znakom za skok v novo vrstico\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Razno:\n" " -s, --no-messages brez sporoÄil o napakah\n" " -v, --invert-match izberi vrstice, ki se ne ujemajo\n" " -V, --version verzija programa\n" " --help ta pomoÄ\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Nadzor izhoda:\n" " -m, --max-count=Å TEVILO odnehaj po danem Å TEVILU izbranih vrstic\n" " -b, --byte-offset z izpisom odmika (v zlogih)\n" " -n, --line-number z izpisom zaporedne Å¡tevilke vrstice\n" " --line-buffered izhodni medpomnilnik izpraznimo vsako vrstico\n" " -H, --with-filename z izpisom imena datoteke\n" " -h, --no-filename brez izpisa imena datoteke\n" " --label=OZNAKA z navedeno OZNAKO, kadar beremo s standardnega " "vhoda\n" #: src/grep.c:2007 #, fuzzy, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching izpis samo dela vrstice z VZORCEM\n" " -q, --quiet, --silent brez vsega obiÄajnega izpisa\n" " --binary-type=TIP privzemi izbrani TIP binarne datoteke\n" " TIP je lahko »binary«, »text« ali »without-" "match«\n" " -a, --text isto kot --binary-type=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I isto kot --binary-type=without-match\n" " -d, --directories=DEJANJE kako obravnavamo imenike\n" " DEJANJE je lahko »read«, »recurse« ali »skip«\n" " -D, --devices=DEJANJE kako obravnavamo datoteke naprav\n" " DEJANJE je lahko »read« ali »skip«\n" " -r, --recursive podobno kot --directories=recurse\n" " -R, --dereference-recursive podobno, vendar s sledenjem vseh simbolnih \n" " povezav\n" #: src/grep.c:2023 #, fuzzy, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=VZOREC preiÅ¡Äi le datoteke, ki ustrezajo VZORCU\n" " --exclude=VZOREC izpusti datoteke, ki ustrezajo VZORCU\n" " --exclude-from=DATOTEKA izpusti datoteke, ki ustrezajo vzorcu v " "DATOTEKI\n" " --exclude-dir=VZOREC izpusti imenike, ki ustrezajo VZORCU\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match le imena DATOTEK brez izbranih vrstic\n" " -l, --files-with-matches le imena DATOTEK z izbranimi vrsticami\n" " -c, --count le skupno Å¡tevilo izbranih vrstic v DATOTEKI\n" " -T, --initial-tab dodaj zaÄetni tabulator (Äe je potrebno)\n" " -Z, --null izpiÅ¡i znak NUL za imenom DATOTEKE\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Nadzor nad kontekstom:\n" " -B, --before-context=Å T Å T vrstic konteksta pred vrstico z VZORCEM\n" " -A, --after-context=Å T Å T vrstic konteksta za vrstico z VZORCEM\n" " -C, --context=Å T Å T vrstic konteksta pred in za vrstico z " "VZORCEM\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -Å T isto kot --context=Å T\n" " --color[=KDAJ],\n" " --colour[=KDAJ] ujemajoÄe nize barvno oznaÄimo; KDAJ je lahko\n" " »always«, »never« ali »auto«\n" " -U, --binary ne porežemo znakov CR na koncu vrstic \n" " (MS-DOS/Windows)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "ÄŒe je podana DATOTEKA enaka »-«, se bere s standardnega vhoda. ÄŒe\n" "DATOTEKA ni podana, se bere ».«, kadar je podana izbira »--recursive«,\n" "sicer »-«. ÄŒe sta podani manj kot dve DATOTEKI, se privzame izbira »-h«.\n" "Izhodna koda je 0 ob vsaj eni izbrani vrstici, sicer pa 1; Äe je\n" "priÅ¡lo do napake in ni bila podana izbira -q, program vrne kodo 2.\n" # SporoÄilo se pojavi pri nedokumentirani izbiri -X # grep.c:622 -> # opt = getopt(argc, argv, "0123456789A:B:CEFGVX:bce:f:hiLlnqsvwxy" # grep --help -> # usage: grep [-[[AB] ]<num>] [-[CEFGVchilnqsvwx]] [-[ef]] <expr> [<files...>] #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "podana navodila si nasprotujejo" #: src/grep.c:2101 #, fuzzy msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "podpora za izbiro -P ni bila vkljuÄena v ta prevedeni program (--disable-" "perl-regexp)" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "neveljaven ujemalnik %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "neznana metoda datotek naprav" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "neveljavno najveÄje Å¡tevilo" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "neznan tip binarne datoteke" #: src/grep.c:2829 #, fuzzy msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "drugi, glejte <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "pomnilnika za sklad PCRE JIT se ni uspelo dodeliti" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P podpira samo enobajtna kodiranja in UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "izbira -P podpira le en vzorec" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "interna napaka (to tega ne bi smelo priti)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "prekoraÄena meja PCRE za dolžino vrstice" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "pomnilnik porabljen" #: src/pcresearch.c:310 #, fuzzy, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "prekoraÄitev sklada PCRE JIT" #: src/pcresearch.c:315 #, fuzzy, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "prekoraÄena meja PCRE za iskanje s povratnim sledenjem" #: src/pcresearch.c:319 #, fuzzy, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "prekoraÄena meja PCRE za iskanje s povratnim sledenjem" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "interna napaka PCRE: %d" #, c-format #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "opozorilo: uporabo GREP_OPTIONS odsvetujemo; uporabite alias ali skript" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "opozorilo: %s: %s" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "neveljavni %s%s argument '%s'" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "neveljavna pripona pri %s%s argumentu '%s'" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s: argument '%s' je prevelik" #, fuzzy #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "Spletna stran %s: <http://www.gnu.org/software/%s/>\n" #~ msgid "internal error" #~ msgstr "interna napaka" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: izbira »--%s« ne dovoljuje argumenta\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: neprepoznana izbira »--%s«\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: izbira »-W %s« ni enopomenska\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: izbira »-W %s« ne dovoljuje argumenta\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: izbira »-W %s« zahteva argument\n" #~ msgid "lseek failed" #~ msgstr "klic lseek ni uspel" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "VZOREC je privzeto osnovni regularni izraz (ORI).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "Ukaz »egrep« pomeni isto kot »grep -E«, »fgrep« pa isto kot »grep -F«.\n" #~ "Neposredna raba ukazov »egrep« ali »fgrep« je odsvetovana.\n" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Spletna stran GNU Grep: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "neveljavno zaporedje bajtov UTF-8 na vhodu" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "VZOREC je razÅ¡irjeni regularni izraz (RRI).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "" #~ "Raba ukaza »egrep« je odsvetovana; namesto njega uporabite »grep -E«.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "VZOREC je množica nespremenljivih nizov, po eden v vrstici.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "" #~ "Raba ukaza »fgrep« je odsvetovana; namesto njega uporabite »grep -F«.\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s lahko uporablja le skladnjo vzorcev %s" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "izbira --mmap je neaktivna od leta 2010 " #~ msgid "unfinished repeat count" #~ msgstr "nedokonÄano Å¡tevilo ponovitev" #~ msgid "malformed repeat count" #~ msgstr "slabo doloÄeno Å¡tevilo ponovitev" #~ msgid "writing output" #~ msgstr "pisanje rezultatov" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "v GREP_COLORS=\"%s\" mora \"%s\" vsebovati vrednost (\"=...\"); " #~ "ignorirano." #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "v GREP_COLORS=\"%s\" je \"%s\" Boolova spremenljivka in ji ne moremo " #~ "doloÄiti vrednosti (\"=%s\"); ignorirano" #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "v GREP_COLORS=\"%s\", \"%s\" vsebuje %s." #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "prekinjena obdelava slabo formuliranega doloÄila GREP_COLORS=\"%s\" pri " #~ "preostalem podnizu \"%s\"." #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Nadzor izhoda:\n" #~ " -m, --max-count=Å TEVILO odnehamo, ko je doseženo Å TEVILO ujemanj\n" #~ " -b, --byte-offset z izpisom odmika (v zlogih)\n" #~ " -n, --line-number z izpisom zaporedne Å¡tevilke vrstice\n" #~ " --line-buffered izhodni medpomnilnik izpraznimo vsako " #~ "vrstico\n" #~ " -H, --with-filename z izpisom imena datoteke\n" #~ " -h, --no-filename brez izpisa imena datoteke\n" #~ " --label=OZNAKA z navedeno OZNAKO, kadar beremo s " #~ "standardnega vhoda\n" #~ " -o, --only-matching izpis samo dela vrstice z VZORCEM\n" #~ " -q, --quiet, --silent brez vsega obiÄajnega izpisa\n" #~ " --binary-type=TIP privzemi izbrani TIP binarne datoteke\n" #~ " TIP je lahko ,binary`, ,text` ali ,without-" #~ "match`\n" #~ " -a, --text isto kot --binary-type=text\n" #~ " -I isto kot --binary-type=without-match\n" #~ " -d, --directories=DEJANJE kako obravnavamo imenike\n" #~ " DEJANJE je lahko ,read`, ,recurse` ali ," #~ "skip`\n" #~ " -D, --devices=DEJANJE kako obravnavamo datoteke naprav\n" #~ " DEJANJE je lahko ,read` ali ,skip`\n" #~ " -R, -r, --recursive isto kot --directories=recurse\n" #~ " --include=VZOREC preiÅ¡Äemo le datoteke, ki ustrezajo VZORCU\n" #~ " --exclude=VZOREC izpustimo datoteke, ki ustrezajo VZORCU\n" #~ " --exclude-from=DATOTEKA izpustimo datoteke, ki ustrezajo vzorcu v " #~ "DATOTEKI\n" #~ " --exclude-dir=VZOREC izpustimo imenike, ki ustrezajo VZORCU\n" #~ " -L, --files-without-match le imena tistih DATOTEK, kjer VZORCA nismo " #~ "naÅ¡li\n" #~ " -l, --files-with-matches le imena tistih DATOTEK, kjer smo VZOREC " #~ "naÅ¡li\n" #~ " -c, --count le skupno Å¡tevilo vrstic v DATOTEKI, v " #~ "katerih se\n" #~ " pojavi VZOREC\n" #~ " -T, --initial-tab dodaj zaÄetni tabulator (Äe je potrebno)\n" #~ " -Z, --null izpiÅ¡i znak NUL za imenom DATOTEKE\n" #~ msgid "unknown directories method" #~ msgstr "neznana metoda imenikov" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Izbiri -P in -z se med seboj izkljuÄujeta" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: nedovoljena izbira -- %c\n" #~ msgid "Copyright (C) 2008 Free Software Foundation, Inc.\n" #~ msgstr "Copyright (C) 2008 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "To je prost program; pogoji, pod katerimi ga lahko uporabljate, " #~ "razmnožujete\n" #~ "in razÅ¡irjate so navedeni v izvorni kodi. Za program ni NOBENEGA " #~ "jamstva,\n" #~ "niti jamstev USTREZNOSTI ZA PRODAJO ali PRIMERNOSTI ZA UPORABO.\n" #~ msgid "out of memory" #~ msgstr "zmanjkalo pomnilnika" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Uporaba: %s [IZBIRA]... VZOREC [DATOTEKA] ...\n" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "option %s" #~ msgstr "izbira %s" #~ msgid " with arg %s" #~ msgstr " z argumentom %s" #~ msgid "digits occur in two different argv-elements.\n" #~ msgstr "Å¡tevke nastopajo pri dveh elementih ARGV.\n" #~ msgid "option %c\n" #~ msgstr "izbira %c\n" #~ msgid "option a\n" #~ msgstr "izbira a\n" #~ msgid "option b\n" #~ msgstr "izbira b\n" #~ msgid "option c with value `%s'\n" #~ msgstr "izbira c z vrednostjo ,%s`\n" #~ msgid "option d with value `%s'\n" #~ msgstr "izbira d z vrednostjo ,%s`\n" #~ msgid "?? getopt returned character code 0%o ??\n" #~ msgstr "?? funkcija getopt vrnila kodo znaka 0%o ??\n" #~ msgid "non-option ARGV-elements: " #~ msgstr "neizbirni elementi ARGV: " #~ msgid "memory exhausted\n" #~ msgstr "pomnilnik porabljen\n" #~ msgid "you may specify only one of -E, -F, or -G" #~ msgstr "izberete lahko samo eno od izbir: -E, -F ali -G" #~ msgid "GNU grep version 2.0" #~ msgstr "GNU grep verzija 2.0" #~ msgid "(standard input)\n" #~ msgstr "(standardni vhod)\n" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/nb.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000040601�14670377450�016171� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��¡��#�����¨$��ë���©%��ò��•&��/��ˆ(����¸)��1��À*��h��ò,��â��[.��¬��>0��s��ë1�����_3�����v3��.���Ž3��)���½3�����ç3��(���4�����04�� ���I4�����j4��-���4��!���¯4��8���Ñ4��'��� 5��(���25�����[5��"���z5�����5����� 5�����¤5��-���·5��Š���å5��1���p6�����¢6�����»6�����Ò6�����é6��%���7�����*7�����G7��É���a7�����+8�� ���>8��!���J8�� ���l8�����z8��H���8��&���Ö8�����ý8��+���9�����H9��(���`9�� ���‰9�����“9��3���²9�����æ9�����ø9��"���:��:���6:�����q:��'���„:�� ���¬:��W��Í:�����%<��8���;<��1���t<��-���¦<��)���Ô<��%���þ<��!���$=�����F=�����d=�����~=��Y���Ž=�����è=��%���ë=��;���>��+���M>��*���y>��2���¤>��7���×>��9���?�����I?��#���b?��$���†?�����«?�����¾?�����Õ?��!���ì?�����@�����!@�����4@�� ���K@�����W@�����v@��(���…@��+���®@�� ���Ú@�����ç@�� ���ø@�����A�����A�����4A��-���HA�� ���vA����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep-3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 14:11+0200 Last-Translator: Johnny A. Solbu <johnny@solbu.net> Language-Team: Norwegian Bokmaal <l10n-no@lister.huftis.org> Language: nb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Poedit 2.2.3 � Kontekstkontroll: -B, --before-context=ANT skriv ut valgt ANTall linjer med ledende kontekst -A, --after-context=ANT skriv ut valgt ANTall linjer med avsluttende kontekst -C, --context=ANT skriv ut valgt ANTall linjer med utdata-kontekst � Diverse: -s, --no-messages ikke skriv ut feilmeldinger -v, --revert-match velg linjer som ikke passer -V, --version vis versjon og avslutt --help vis denne helpeteksten og avslutt � Utdata-kontroll: -m, --max-count=ANT stopp ved valgt ANTall treff -b, --byte-offset skriv ut hvor søkeuttrykket ga treff per utdatalinje -n, --line-number skriv ut linjenummmer per utdatalinje --line-buffered tøm utdata pÃ¥ hver linje -H, --with-filename ta med filnavn pÃ¥ søketreff-linjer -h, --no-filename ikke ta med filnavn-prefiks i utdata --label=ETIKETT bruk valgt ETIKETT som prefiks pÃ¥ standard inndata-filnavn � --include=MØNSTER bare søk gjennom filer som samsvarer med MØNSTER --exclude=MØNSTER hopp over filer som samsvarer med MØNSTER --exclude-from=FIL hopp over filer som samsvarer med mønstre nevnt i FIL --exclude-dir=MØNSTER hopp over mapper som samsvarer med MØNSTER. � -E, --extended-regexp MØNSTER er et utvidet regulært uttrykk -F, --fixed-strings MØNSTER er flere linje-adskilte strenger -G, --basic-regexp MØNSTER er et enkelt regulært uttrykk -P, --perl-regexp MØNSTER er et Perl-uttrykk � -I tilsvarer «--binary-files=without-match» -d, --directories=HANDLING hvordan mapper skal hÃ¥ndteres. HANDLING er «read» (les), «recurse» (søk i undermapper og -filer) eller «skip» (hopp over) -D, --devices=HANDLING hvordan enheter, FIFO-er og sokler skal behandles. HANDLING er «read» (les) eller «skip» (hopp over) -r, --recursive tilsvarer «--directories=recurse» -R, --dereference-recursive likner «-r», men følger symbolske lenker � -L, --files-without-match bare skriv ut FILnavn som ikke inneholder søketreff -l, --files-with-matches bare skriv ut FILnavn som inneholder søketreff -c, --count bare skriv ut antall samsvarende linjer per FIL -T, --initial-tab still opp tabulatorer (hvis nødvendig) -Z, --null skriv ut 0-byte etter FILnavn � -NUM tilsvarer «--context=NUM» --group-separator=SEP Skriv ut SEP pÃ¥ linje mellom treff med kontekst --no-group-separator ikke skriv ut skilletegn for treff med kontekst --color[=NÃ…R], --colour[=NÃ…R] bruk markører for Ã¥ fremheve strenger som samsvarer NÃ…R er enten «always» (alltid) , «never» (aldri), eller «auto» -U, --binary ikke fjern CR-tegn ved EOL (MSDOS/Windows) � -e, --regexp=MØNSTER søk etter MØNSTER -f, --file=FIL hent MØNSTER fra valgt FIL -i, --ignore-case ikke skill mellom store og smÃ¥ bokstaver --no-ignore-case skill mellom store og smÃ¥ bokstaver (forvalgt) -w, --word-regexp søk etter hele ord -x, --line-regexp søk etter hele linjer -z, --null-data linjer slutter pÃ¥ 0-byte i stedet for linjeskift � -o, --only-matching bare vis den delen av linja som ga treff -q, --quiet, --silent ikke skriv ut noe vanlig utdata --binary-files=TYPE forvent at binærfiler er av valgt TYPE. TYPE er «binary» (binær), «text» (tekst) eller «without-match» (uten treff) -a, --text tilsvarer «--binary-files=text» �Nettside for %s: <%s> �%s: Binærfil samsvarer�%s: grensa for PCRE-tilbakegang er overskredet�%s: PCREs rekursjonsgrense er overskredet�%s: PCRE JIT-stabel er oppbrukt�%s: inndatafil er ogsÃ¥ brukt som utdata�%s: intern PCRE-feil: %d�%s: valget -- «%c» er ugyldig �%s: minnet er oppbrukt�%s: valget «%s%s» tillater ikke argumenter �%s: valget «%s%s» er flertydig �%s: valget «%s%s» er flertydig, og kan bety følgende:�%s: valget «%s%s» krever et argument �%s: valget -- «%c» krever et argument �%s: valget «%s%s» er ukjent �%s: advarsel: rekursiv mappeløkke�»�(C)�(standard inndata)�-P støtter bare regioner i unibyte- og UTF-8�Eksempel: %s -i 'hei verden' menu.h main.c MØNSTER kan inneholde flere mønstre adskilt med linjeskift. Reg.uttrykksutvalg og tolkning: �Generell hjelp til bruk av GNU-programvare: <%s> �Ugyldig tilbakereferanse�Ugyldig tegnklassenavn�Ugyldig sorteringstegn�Ugyldig innhold i «\{\}»�Ugyldig foregÃ¥ende regulært uttrykk�Ugyldig slutt pÃ¥ rekkevidde�Ugyldig regulært uttrykk�Lisens GPLv3+: GNU GPL versjon 3 eller nyere <%s>. Dette er fri programvare. Du kan endre og dele den videre sÃ¥ mye du vil. Utgiveren stiller INGEN GARANTI, i den grad gjeldende lovverk tillater det. �Minnet er oppbrukt�Ingen treff�Intet tidligere regulært uttrykk�Pakket av %s �Pakket av %s (%s) �Søk støttes ikke i Perl nÃ¥r det er bygd med «--disable-perl-regexp»�For tidlig slutt pÃ¥ regulært uttrykk�Regulært uttrykk er for stort�Rapporter feil som oppstÃ¥r med %s til: %s �Rapporter feil til: %s �Søk etter MØNSTER i valgt(e) FIL(er). �Fullført�Avsluttende omvendt skrÃ¥strek�Prøv Ã¥ skrive «%s --help» for mer informasjon. �Ukjent systemfeil�Ingen treff pÃ¥ ( eller \(�Ingen treff pÃ¥ «)» eller «\)»�Ingen treff pÃ¥ «[», «[^», «[:», «[.» eller «[=»�Ingen treff pÃ¥ \{�Bruk: %s [VALG] … MØNSTER [FIL] … �Følgende argumenter er gyldige:�Programmet leser standard inndata nÃ¥r FIL er «-». NÃ¥r FIL ikke er valgt, leses «.» i rekursiv modus, og ellers «-». Valget «-h» gjelder implisitt hvis færre enn to FILer er valgt. Avsluttende statuskode er 0 nÃ¥r søket gir treff, og ellers 1. Hvis det oppstÃ¥r feil og «-q» ikke er valgt, avslutter programmet med statuskode 2. �Skrevet av %s og %s. �Skrevet av %s, %s, %s, %s, %s, %s, %s, %s, %s og andre. �Skrevet av %s, %s, %s, %s, %s, %s, %s, %s og %s. �Skrevet av %s, %s, %s, %s, %s, %s, %s og %s. �Skrevet av %s, %s, %s, %s, %s, %s og %s. �Skrevet av %s, %s, %s, %s, %s og %s. �Skrevet av %s, %s, %s, %s og %s. �Skrevet av %s, %s, %s og %s. �Skrevet av %s, %s og %s. �Skrevet av %s. �Skrevet av Mike Haertel og andre. Se <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�«�«%s» er et tvetydig argument for %s�gjeldende tegnklasse-syntaks er [[:space:]], ikke [:space:]�søkeuttrykkene er i konflikt med hverandre�grensa for PCRE-linjelengde er overskredet�klarte ikke Ã¥ tildele minne til PCRE JIT-stabelen�klarte ikke Ã¥ gÃ¥ tilbake til opprinnelig arbeidsmappe�klarte ikke Ã¥ endre fildeskriptor for tekst-/binærmodus�for mye inndata Ã¥ telle�intern feil (dette skal aldri skje)�«%s» er et ugyldig argument for %s�ugyldig tegnklasse�ugyldig innhold i \{\}�ugyldig kontekstlengde�«%s» er et ugyldig søkeuttrykk�ugyldig maksantall�minnet er oppbrukt�ingen syntaks er valgt�programfeil�regulært uttrykk er for stort�stabel er full�valget «-P» støtter bare ett mønster�klarte ikke Ã¥ hente gjeldende arbeidsmappe�ubalansert (�ubalansert «)»�ubalansert [�ufullstendig \-skiftetegn�ukjent binærfiltype�ukjent enhetsmetode�advarsel: --unix-byte-offsets (-u) er avleggs�skrivefeil��������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/fr.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000037674�14670377471�016224� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����g������T��‰���Œ������°��Ï���±��÷��� ��Õ��y ����O ��ü���` ��¶��]��U����¤��j��F�������V�����j��&���‚��#���©�����Í��!���ê����� �����(�����D��,���Y�����†��.���¦��'���Õ��(���ý�����&��%���F�����l�����n�����r��*���ƒ�����®��&���?�����f�����}�����š�����¶��$���Î�����ó�������ª��� �����Ë�����Ü�����å������������<���)��#���f�����Š�����¥�����¼��"���Ð�����ó�����û��&��������5�����J�����\�����n�� �����)���š�����Ä��ù���Ù�����Ó��;���ê��3���&��/���Z��+���Š��'���¶��#���Þ����������"�����>��\���N�����«�����­��4���Ê�����ÿ��!�����0���@��-���q��.���Ÿ�����Î��$���ê����������*�����B�����Z�����z����������Ÿ�����°�� ���Ä�����Ò�����í��,���ü��*���) �� ���T �� ���a �� ���n �����{ ����� �����© �� ���À ��º��Ì ��è���‡"�� ��p#��"��~$��_��¡&����(���� )��—��6+��§��Î,��€��v.�����÷/��$���0��2���:0��)���m0�����—0��8���´0�����í0��'��� 1�����41��5���L1��)���‚1��<���¬1��3���é1��5���2��'���S2��1���{2�����­2�����²2�����µ2��I���È2��|���3��+���3�����»3��&���Û3��!���4�����$4��.���>4�����m4��!���‰4��Ã���«4�����o5�����‚5��)���˜5�����Â5�����Õ5��e���í5��)���S6��"���}6��&��� 6��!���Ç6��)���é6�� ���7�����7��N���:7�����‰7�����¢7�����¾7��'���Ú7�����8��,���8�����F8��6��e8�����œ9��<���²9��2���ï9��.���":��*���Q:��&���|:��"���£:�����Æ:�����å:�����ÿ:��_���;�����o;�����t;��E���;��2���Õ;��/���<��4���8<��2���m<��M��� <��;���î<��.���*=�����Y=�� ���w=�����˜=��*���²=��$���Ý=�����>�����>�����1>�����J>��"���^>�����>��1���–>��9���È>�����?�����?�����"?��(���1?�����Z?��.���z?�����©?�����d���;���<���8������� ���4���)������*����������O������D�����������]���C���\���S���%���/��� ���L���2���,�����������_���>���H������U������Z������������������G����������������X����������=��������������`���^���N���J������6���?���M���R�������F���T���$���������������������7�����������������K���0�������P���9���#�����������3���������!���c���.��� ������E���W���e����������:���A���5���(��� ������ �������@�����������Y���"���a���-���f������ ���+������1���Q�������������g���'���V�����������b���I���&�������B�������������������[���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: GNU grep 3.5.16 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2020-12-15 20:56+0100 Last-Translator: Stéphane Aulery <lkppo@free.fr> Language-Team: French <traduc@traduc.org> Language: fr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=2; plural=(n > 1); X-Generator: Poedit 2.4.2 � Contrôle de contexte : -B, --before-context=NBRE afficher NBRE lignes de contexte avant -A, --after-context=NBRE afficher NBRE lignes de contexte après -C, --context=NBRE afficher NBRE lignes de contexte en sortie � Divers : -s, --no-messages supprimer les messages d'erreur -v, --invert-match sélectionner les lignes sans correspondance -V, --version afficher le nom et la version du logiciel --help afficher l'aide et quitter � Contrôle de la sortie : -m, --max-count=NOMBRE arrêter après NOMBRE de ligne sélectionnées -b, --byte-offset afficher la position en octet avec la sortie -n, --line-number afficher le numéro de ligne avec la sortie --line-buffered vider le tampon après chaque ligne -H, --with-filename afficher le nom de fichier avec les lignes -h, --no-filename supprimer le préfixe de nom de fichier en sortie --label=ÉTIQUETTE utiliser ÉTIQUETTE pour le préfixe d'entrée standard � --include=GLOB ne chercher que les fichiers correspondants à GLOB (motif de fichier) --exclude=GLOB ignorer les fichiers correspondants à GLOB --exclude-from=FICHIER ignorer les fichiers correspondants aux motifs contenus dans un FICHIER --exclude-dir=GLOB ignorer les répertoires correspondants à GLOB � -E, --extended-regexp MOTIFS sont des expressions rationnelles étendues -F, --fixed-regexp MOTIFS sont des chaînes -G, --basic-regexp MOTIFS sont des expressions rationnelles ordinaires -P, --perl-regexp MOTIFS sont des expressions rationnelles Perl � -I identique à --binary-files=without-match -d, --directories=ACTION la façon de traiter les répertoires ; ACTION est « read », « recurse » ou « skip » -D, --devices=ACTION la façon de traiter les périphériques, les FIFOS et les sockets ; ACTION est « read » ou « skip » -r, --recursive identique à --directories=recurse -R, --dereference-recursive similaire, mais avec suivi des liens symboliques � -L, --files-without-match n'afficher que les fichiers sans lignes sélectionnées -l, --files-with-matches n'afficher que les fichiers avec des lignes sélectionnées -c, --count n'afficher que le nombre de lignes sélectionnées par FICHIER -T, --initial-tab insérer des tabulations (si nécessaire) -Z, --null afficher l'octet nul après le nom de fichier � -e, --regexp=MOTIFS utiliser MOTIFS pour la recherche -f, --file=FICHIER charger les MOTIFS depuis un FICHIER -i, --ignore-case ignorer la différence de casse des motifs et données -w, --word-regexp rechercher des mots entiers -x, --line-regexp rechercher des lignes entières -z, --null-data finir les lignes de données par un octet nul, pas une saut de ligne � -o, --only-matching n'afficher que la partie de ligne correspondante -q, --quiet, --silent supprimer tout affichage vers la sortie standard --binary-files=TYPE considérer que les fichiers binaires sont de type TYPE : « binary », « text » ou « without-match » -a, --text identique à --binary-files=text �Page d'accueil de %s : <%s> �%s : fichiers binaires correspondent�%s : limite de retour arrière des PCRE dépassée�%s : limite de récursion PCRE dépassée�%s : pile PCRE JIT épuisée�%s : le fichier d'entrée est aussi le fichier de sortie�%s : erreur PCRE interne : %d�%s : option incorrecte — « %c » �%s : mémoire épuisée�%s : l'option « %s%s » n'accepte pas d'argument �%s : l'option « %s%s » est ambiguë �%s : l'option « %s%s » est ambiguë ; possibilités :�%s : l'option « %s%s » nécessite un argument �%s : l'option nécessite un argument — « %c » �%s : option « %s%s » non reconnue �%s : attention : boucle de répertoire récursive� »�©�(entrée standard)�-P ne fonctionne qu’avec des paramètres régionaux monooctets ou UTF-8�Exemple : %s -i 'Bonjour, le monde' menu.h main.c MOTIFS peut contenir plusieurs motifs séparés par des sauts de ligne. �Aide globale sur les logiciels GNU : <%s> �Référence arrière incorrecte�Nom de classe de caractères incorrect�Caractère de collation incorrect�Contenu de \{\} incorrect�Expression rationnelle précédente incorrecte�Fin d'intervalle incorrecte�Expression rationnelle incorrecte�Licence GPLv3+: GNU GPL version 3 ou ultérieure <%s>. Logiciel libre : vous êtes libre de le modifier ou de le redistribuer. Il n'y a AUCUNE GARANTIE, dans les limites autorisées par la loi. �Mémoire épuisée�Pas de correspondance�Pas d'expression rationnelle précédente�Empaqueté par %s �Empaqueté par %s (%s) �Correspondance Perl non prise en charge pour un binaire construit avec l'option --disable-perl-regexp�Fin prématurée d'expression rationnelle�Expression rationnelle trop grande�Signalez les anomalies de %s à : %s �Signalez toute anomalie à : %s �Chercher des MOTIFS dans chaque FICHIER. �Réussite�Barre oblique inverse finale�Exécutez « %s --help » pour obtenir des renseignements complémentaires. �Erreur système inconnue�( ou \( sans correspondance�) ou \) sans correspondance�[, [^, [:, [. ou [= sans correspondance�\{ sans correspondance�Usage : %s [OPTION]... MOTIFS [FICHIER]... �Les arguments valables sont :�Si FICHIER vaut « - », lire l'entrée standard. Sans FICHIER, lire « . ». Si mode récursif, autrement « - » Si moins de deux fichiers sont indiqués, supposer -h. Le code d'erreur est 0 si une ligne est sélectionnée, 1 autrement ; en cas d'erreur et si l'option -q n'est pas présente, le code est 2. �Écrit par %s et %s. �Écrit par %s, %s, %s, %s, %s, %s, %s, %s, %s, et d'autres. �Écrit par %s, %s, %s, %s, %s, %s, %s, %s, et %s. �Écrit par %s, %s, %s, %s, %s, %s, %s, et %s. �Écrit par %s, %s, %s, %s, %s, %s, et %s. �Écrit par %s, %s, %s, %s, %s, et %s. �Écrit par %s, %s, %s, %s, et %s. �Écrit par %s, %s, %s, et %s. �Écrit par %s, %s et %s. �Écrit par %s. �Écrit par Mike Haertel et d'autres ; voir <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�« �argument %s ambigu pour %s�la syntaxe d'une classe de caractères est [[:space:]], pas [:space:]�opérateurs de correspondance indiqués en conflit�limite de longueur de ligne des PCRE dépassée�échec d’allocation mémoire pour la pile JIT PCRE�échec de retour au répertoire initial de travail�l’obtention d’un descripteur de fichier en mode text / binaire a échoué�taille des données en entrée trop importante pour compter�erreur interne (ça ne devrait jamais arriver)�argument %s incorrect pour %s�classe de caractères incorrecte�contenu de \{\} incorrect�argument de longueur de contexte incorrect�motif de correspondance incorrect %s�décompte maximal incorrect�mémoire épuisée�aucune syntaxe indiquée�erreur du programme�expression rationnelle trop grande�débordement de pile�l'option -P ne permet d'utiliser qu'un seul motif�impossible d'enregistrer le répertoire de travail actuel�( non appariée�) non appariée�[ non apparié�séquence d'échappement \ non terminée�type de fichier binaire inconnu�méthode d'examen des périphériques inconnue�erreur d'écriture���������������������������������������������������������������������kbuild-3608/src/grep/po/pt_BR.po��������������������������������������������������������������������0000664�0001750�0001750�00000101207�14670377471�016437� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# translation of grep-3.5.16.po to Brazilian Portuguese # This file is distributed under the same license as the grep package. # grep: translation to Brazilian Portuguese (pt_BR) # Copyright (C) 2002, 2007, 2008, 2009, 2011, 2012, 2014 Free Software Foundation, Inc. # # Enrique Melero Gómez <melero@eurolands.com>, 1996. # Rodrigo Stulzer Lopes <rodrigo@conectiva.com.br>, 1997. # Santiago Vila Doncel <sanvila@unex.es>, 1997, 1998, 1999, 2000, 2001, 2002. # Alexandre Folle de Menezes <afmenez@terra.com.br>, 2002. # Rodolfo Ribeiro Gomes <rodolforg@gmail.com>, 2007-2020. # msgid "" msgstr "" "Project-Id-Version: GNU grep-3.5.16\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2020-11-04 09:30-0300\n" "Last-Translator: Rodolfo Ribeiro Gomes <rodolforg@gmail.com>\n" "Language-Team: Brazilian Portuguese <ldpbr-translation@lists.sourceforge." "net>\n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Gtranslator 3.38.0\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "%s eÌ um argumento invaÌlido para %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "%s eÌ um argumento ambíguo para %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Os argumentos válidos são:" #: lib/c-stack.c:187 msgid "program error" msgstr "erro do programa" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "estouro de pilha" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "erro de escrita" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ sem correspondente" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "categoria de caracteres inválida" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "a sintaxe de categoria de caracteres é [[:space:]], e não [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "escape \\ não terminado" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "conteúdo inválido de \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "expressão regular grande demais" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( sem correspondente" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "nenhuma sintaxe especificada" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") sem correspondente" #: lib/error.c:195 msgid "Unknown system error" msgstr "Erro desconhecido de sistema" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: a opção \"%s%s\" é ambígua\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: a opção \"%s%s\" é ambígua; possibilidades:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: a opção \"%s%s\" é desconhecida\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: a opção \"%s%s\" não aceita argumentos\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: a opção \"%s%s\" requer um argumento\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: a opção é inválida -- \"%c\"\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: a opção exige um argumento -- \"%c\"\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "memória esgotada" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "incapaz de memorizar o diretório de trabalho atual" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "falhou em retornar ao diretório de trabalho inicial" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "falhou em definir o modo texto/binário do descritor de arquivo" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "\"" #: lib/quotearg.c:356 msgid "'" msgstr "\"" #: lib/regcomp.c:135 msgid "Success" msgstr "Sucesso" #: lib/regcomp.c:138 msgid "No match" msgstr "Nenhuma ocorrência do padrão" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Expressão regular inválida" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Caractere inválido de colagem" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Nome inválido de categoria de caracteres" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Barra invertida excedente ao final" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Retro-referência inválida" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Sem correspondência para [, [^, [:, [. ou [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( ou \\( sem correspondente" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ sem correspondente" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Conteúdo inválido de \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Fim inválido de intervalo" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Memória esgotada" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Expressão regular precedente é inválida" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Fim prematuro da expressão regular" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Expressão regular grande demais" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") ou \\) sem correspondente" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Nenhuma expressão regular anterior" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Empacotado por %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Empacotado por %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licença GPLv3+: GNU GPL versão 3 ou superior <%s>.\n" "Este é um software livre: você é livre para alterá-lo e redistribuí-lo.\n" "NÃO Hà GARANTIAS, na máxima extensão permitida por lei.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Escrito por %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Escrito por %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Escrito por %s, %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Escrito por %s, %s, %s\n" "e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s\n" "e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s e outros.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Relate os problemas para: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Relate os problemas de %s para: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "paÌgina de %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Ajuda geral sobre uso de software GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(entrada padrão)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "argumento inválido para comprimento do contexto" #: src/grep.c:894 msgid "input is too large to count" msgstr "entrada longa demais para contar" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: arquivo binário coincide com o padrão" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: aviso: recursão cíclica de diretório" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: o arquivo de entrada também é o de saída" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Uso: %s [OPÇÃO]... PADRÕES [ARQUIVO]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Experimente \"%s --help\" para mais informações.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Busca por PADRÕES em cada ARQUIVO.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Exemplo: %s -i \"olá, mundo\" menu.h main.c\n" "PADRÕES pode conter múltiplos padrões separados por nova-linha.\n" "\n" "Seleção e interpretação de padrão:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp PADRÕES são expressões regulares estendidas\n" " -F, --fixed-strings PADRÕES são textos\n" " -G, --basic-regexp PADRÕES são expressões regulares básicas\n" " -P, --perl-regexp PADRÕES são expressões regulares Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=PADRÕES usa PADRÕES para coincidir\n" " -f, --file=ARQUIVO obtém PADRÕES contidos no ARQUIVO\n" " -i, --ignore-case ignora diferenças entre maiúsculas/minúsculas " "nos\n" " padrões e dados\n" " --no-ignore-case não ignora diferença de maiusculizações " "(padrão)\n" " -w, --word-regexp coincide só com palavras completas\n" " -x, --line-regexp coincide só com linhas inteiras\n" " -z, --null-data uma linha de dados termina com byte 0, e não " "com\n" " caractere de nova linha\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Miscelânea:\n" " -s, --no-messages suprime mensagens de erro\n" " -v, --invert-match seleciona somente linhas não coincidentes\n" " -V, --version mostra informações sobre versão e sai\n" " --help exibe esta ajuda e sai\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Controle de saída:\n" " -m, --max-count=NÚM interrompe depois de NÚM ocorrências\n" " -b, --byte-offset emite a posição em bytes nas linhas de saída\n" " -n, --line-number emite o número da linha nas linhas de saída\n" " --line-buffered libera a saída a cada linha\n" " -H, --with-filename emite o nome do arquivo nas linhas de saída\n" " -h, --no-filename inibe o nome de arquivo na saída\n" " --label=RÓTULO usa RÓTULO como nome de arquivo para entrada " "padrão\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching mostra apenas as partes não-vazias das linhas " "que\n" " coincidem com os PADRÕES\n" " -q, --quiet, --silent inibe todas as mensagens normais de saída\n" " --binary-files=TIPO assume que arquivos binários são TIPO;\n" " TIPO pode ser \\\"binary\\\" (binário), \\\"text" "\\\" (texto),\n" " ou \\\"without-match\\\" (nunca coincide)\n" " -a, --text equivalente a --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I equivalente a --binary-files=without-match\n" " -d, --directories=AÇÃO como tratar diretórios;\n" " AÇÃO pode ser \\\"read\\\" (ler), \\\"recurse\\" "\" (recursivo),\n" " ou \\\"skip\\\" (ignorar)\n" " -D, --devices=AÇÃO como tratar dispositivos, FIFOs e soquetes;\n" " AÇÃO pode ser \\\"read\\\" (ler) ou \\\"skip\\" "\" (ignorar)\n" " -r, --recursive equivalente a --directories=recurse\n" " -R, --dereference-recursive similar, mas segue todas as ligações " "simbólicas\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=PADRÃO busca apenas em arquivos que casam com PADRÃO\n" " --exclude=PADRÃO ignora arquivos que casam com PADRÃO\n" " --exclude-from=ARQUI ignora arquivos que casam com algum padrão de\n" " arquivo contido em ARQUIvo\n" " --exclude-dir=PADRÃO ignora diretórios que casam com PADRÃO\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match emite apenas os nomes dos ARQUIVOs sem linhas\n" " selecionadas\n" " -l, --files-with-matches emite apenas os nomes dos ARQUIVOs com linhas\n" " selecionadas\n" " -c, --count emite apenas a contagem de linhas selecionadas\n" " por ARQUIVO\n" " -T, --initial-tab alinha por tabulação (se necessário)\n" " -Z, --null emite byte 0 depois do nome do ARQUIVO\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Controle de contexto:\n" " -B, --before-context=NÚM emite NÚM linhas de contexto anteriores\n" " -A, --after-context=NÚM emite NÚM linhas de contexto posteriores\n" " -C, --context=NÚM emite NÚM linhas de contexto de saída\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NÚM o mesmo que --context=NÚM\n" " --color[=QUANDO],\n" " --colour[=QUANDO] usa marcadores para destacar os textos " "coincidentes;\n" " QUANDO pode ser \"always\" (sempre), \"never" "\"\n" " (nunca) ou \"auto\" (automático).\n" " -U, --binary não exclui caracteres CR no fim de linha (MSDOS/" "Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Quando ARQUIVO é \"-\", lê da entrada padrão. Se ARQUIVO não é informado, lê " "\".\"\n" "se recursivo, senão lê \"-\". Se há menos que dois ARQUIVOs, assume-se -h.\n" "O estado de saída é 0 se alguma linha é selecionada, 1 em caso contrário;\n" "se ocorrer algum erro e -q não é especificado, o estado de saída é 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "especificou-se padrões de busca conflitantes" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "não há suporte para coincidir conforme Perl em uma compilação com --disable-" "perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "comparador inválido %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "método desconhecido de dispositivos" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "valor máximo inválido" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "tipo de arquivo binário desconhecido" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Escrito por Mike Haertel e outros; veja\n" "<http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "falhou em alocar memória para a pilha de PCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" "-P só oferece suporte a localidades unibyte (um caractere por byte) e UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "a opção -P só oferece suporte a apenas um único padrão" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "erro interno (nunca deveria acontecer)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "atingiu o limite de comprimento de linha das PCRE" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: memória esgotada" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: pilha PCRE JIT estourada" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: atingiu o limite de backtracking das PCRE" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: atingiu o limite de recursão das PCRE" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: erro interno de PCRE: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "aviso: a variável de ambiente GREP_OPTIONS está obsoleta; use um alias ou " #~ "script" #~ msgid "warning: %s: %s" #~ msgstr "aviso: %s: %s" #~ msgid "%s home page: <http://www.gnu.org/software/%s/>\n" #~ msgstr "paÌgina de %s: <http://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "argumento invaÌlido para %s%s: \"%s\"" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "sufixo invaÌlido no argumento para %s%s: \"%s\"" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s: argumento \"%s\" é grande demais" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "erro interno" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: a opção \"--%s\" não aceita argumentos\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: a opção \"--%s\" é desconhecida\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: a opção \"-W %s\" é ambígua\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: a opção \"-W %s\" não aceita argumentos\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: a opção \"-W %s\" requer um argumento\n" #~ msgid "lseek failed" #~ msgstr "a movimentação pelo arquivo (lseek) falhou" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "PADRÃO é, por padrão, uma expressão regular básica (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "\"egrep\" significa \"grep -E\". \"fgrep\" significa \"grep -F\".\n" #~ "A invocação direta tanto por \"egrep\" como por \"fgrep\" está obsoleta.\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "não há suporte para ^ ou $ sem escape ao usar -Pz" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "PADRÃO é uma expressão regular estendida (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "Invocar como \"egrep\" está obsoleto; use \"grep -E\".\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "" #~ "PADRÃO é um conjunto de textos fixos separados por caractere de nova " #~ "linha.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "Invocar como \"fgrep\" está obsoleto; use \"grep -F\".\n" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Página do GNU Grep: <%s>\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s só pode usar a sintaxe de padrão %s" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "a opção --mmap não faz nada desde 2010" #~ msgid "unfinished repeat count" #~ msgstr "contador de repetição não terminado" #~ msgid "malformed repeat count" #~ msgstr "contador de repetição mal formulado" #~ msgid "writing output" #~ msgstr "escrevendo na saída" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "em GREP_COLORS=\"%s\", o recurso \"%s\" precisa de um valor (\"=...\"); " #~ "ignorado" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "em GREP_COLORS=\"%s\", o recurso \"%s\" é booleano e não pode assumir um " #~ "valor (\"=%s\"); ignorado" #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "em GREP_COLORS=\"%s\", o recurso \"%s\" %s." #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "interrompido o processamento da variável mal formatada GREP_COLORS=\"%s\" " #~ "no trecho de texto restante \"%s\"" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Controle de saída:\n" #~ " -m, --max-count=NÚM interrompe depois de NÚM coincidências\n" #~ " -b, --byte-offset exibe a posição em bytes junto com a saída\n" #~ " -n, --line-number exibe o número da linha junto com a saída\n" #~ " --line-buffered libera a saída a cada linha\n" #~ " -H, --with-filename exibe o nome do arquivo para cada padrão " #~ "encontrado\n" #~ " -h, --no-filename inibe o nome de arquivo na saída\n" #~ " --label=RÓTULO mostra RÓTULO como o nome da entrada padrão\n" #~ " -o, --only-matching mostra apenas a parte da linha que coincide " #~ "com\n" #~ " o PADRÃO\n" #~ " -q, --quiet, --silent inibe todas as mensagens de saída normais\n" #~ " --binary-files=TIPO assume que arquivos binários são TIPO\n" #~ " TIPO pode ser \"binary\" (binário), \"text" #~ "\" (texto),\n" #~ " ou \"without-match\" (nunca coincide).\n" #~ " -a, --text equivalente a --binary-files=text\n" #~ " -I equivalente a --binary-files=without-match\n" #~ " -d, --directories=AÇÃO como tratar diretórios;\n" #~ " AÇÃO pode ser \"read\" (ler), \"recurse" #~ "\" (recursivo),\n" #~ " ou \"skip\" (ignorar).\n" #~ " -D, --devices=AÇÃO como tratar dispositivos, FIFOs e soquetes;\n" #~ " AÇÃO pode ser \"read\" (ler) ou \"skip" #~ "\" (ignorar)\n" #~ " -R, -r, --recursive equivalente a --directories=recurse.\n" #~ " --include=PADRÃO_ARQ busca apenas em arquivos que casam com " #~ "PADRÃO_ARQ\n" #~ " --exclude=PADRÃO_ARQ ignora arquivos que casam com PADRÃO_ARQ\n" #~ " --exclude-from=ARQUI ignora arquivos que casam com algum padrão " #~ "escrito\n" #~ " em ARQUIvo\n" #~ " --exclude-dir=PADRÃO diretórios que casam com PADRÃO serão " #~ "ignorados\n" #~ " -L, --files-without-match exibe os nomes somente dos arquivos não " #~ "casam\n" #~ " com o PADRÃO\n" #~ " -l, --files-with-matches exibe os nomes somente dos arquivos casam " #~ "com\n" #~ " o padrão\n" #~ " -c, --count exibe a contagem de linhas por aquivo que " #~ "casam\n" #~ " com o padrão\n" #~ " -T, --initial-tab alinha por tabulação (se necessário)\n" #~ " -Z, --null emite byte 0 depois do nome do ARQUIVO\n" #~ msgid "unknown directories method" #~ msgstr "método desconhecido de diretórios" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "As opções -P e -z não podem ser combinadas" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: opção ilegal -- %c\n" �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/af.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000002223�14670377450�016156� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•���� ������„������ì�������0�����1�����3�����D�����U�����j�����l�����‹�����§�����Ç�����Ù�����ê�������t������������’�����¥�����µ�����Ë��%���Í�����ó��"��������3�����J�����Z�����t�������� �������������������� ������� ������ ��� ��������������'�(standard input)�Memory exhausted�Unknown system error�`�conflicting matchers specified�input is too large to count�invalid context length argument�invalid max count�memory exhausted�unknown binary-files type�unknown devices method�Project-Id-Version: grep 2.5g Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2004-03-03 13:33+0200 Last-Translator: Petri Jooste <rkwjpj@puk.ac.za> Language-Team: Afrikaans <i18n@af.org.za> Language: af MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. �'�(standaardtoevoer)�Geheue uitgeput�Onbekende stelselfout�'�teenstrydige passers is gespesifiseer�toevoer is te veel om te tel�ongeldige konteks-lengte-parameter�ongeldige maks-telling�geheue uitgeput�onbekende binêre-lêertipe�onbekende metode vir toestelle������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/ru.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000053271�14670377471�016232� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"�����#��o��%��›��w&��¼��(��3��Ð+��k��.����p/��@��Ž2��i��Ï4��È��98��¼��;��+���¿<��0���ë<��:���=��8���W=��&���=��R���·=��.��� >��-���9>��#���g>��^���‹>��9���ê>��^���$?��K���ƒ?��B���Ï?��;���@��E���N@�����”@�����—@��!���›@��h���½@��ð���&A��E���B��6���]B��=���”B��8���ÒB��5��� C��]���AC��6���ŸC��@���ÖC��)��D�����AE�����aE��G���}E�����ÅE�����ÚE��b���ôE��]���WF��E���µF��B���ûF��=���>G��8���|G��!���µG��J���×G��m���"H��6���H�����ÇH�����äH��(���I�����*I��R���>I��(���‘I��¤��ºI��.���_L��X���ŽL��J���çL��F���2M��B���yM��>���¼M��:���ûM��6���6N��2���mN��&��� N��ƒ���ÇN�����KO��8���NO��P���‡O��6���ØO��F���P��G���VP��Z���žP��€���ùP��V���zQ��H���ÑQ��.���R��4���IR��5���~R��?���´R��"���ôR��k���S�����ƒS��$���£S�����ÈS��E���èS��#���.T��Y���RT��S���¬T��&����U��&���'U��&���NU��Z���uU��;���ÐU��;��� V��V���HV�����ŸV����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-10 06:59+0300 Last-Translator: Yuri Kozlov <yuray@komyakino.ru> Language-Team: Russian <gnu@d07.ru> Language: ru MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Lokalize 20.12.0 Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); � Управление контекÑтом: -B, --before-context=ЧИС печатать ЧИСЛО Ñтрок предшеÑтвующего контекÑта -A, --after-context=ЧИС печатать ЧИСЛО Ñтрок поÑледующего контекÑта -C, --context[=ЧИС] печатать ЧИСЛО Ñтрок контекÑта � Разное: -s, --no-messages не показывать ÑÐ¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ñ Ð¾Ð± ошибках -v, --invert-match выбирать не подходÑщие Ñтроки -V, --version показать информацию о верÑии и закончить работу --help показать Ñту Ñправку и закончить работу � Управление выводом: -m, --max-count=ЧИСЛО оÑтановитьÑÑ Ð¿Ð¾Ñле указанного ЧИСЛРÑовпавших Ñтрок -b, --byte-offset печатать вмеÑте Ñ Ð²Ñ‹Ñ…Ð¾Ð´Ð½Ñ‹Ð¼Ð¸ Ñтроками Ñмещение в байтах -n, --line-number печатать номер Ñтроки вмеÑте Ñ Ð²Ñ‹Ñ…Ð¾Ð´Ð½Ñ‹Ð¼Ð¸ Ñтроками --line-buffered ÑбраÑывать буфер поÑле каждой Ñтроки -H, --with-filename печатать Ð¸Ð¼Ñ Ñ„Ð°Ð¹Ð»Ð° Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð¹ выводимой Ñтроки -h, --no-filename не начинать вывод Ñ Ð¸Ð¼ÐµÐ½Ð¸ файла --label=МЕТКРиÑпользовать МЕТКУ в качеÑтве имени файла Ð´Ð»Ñ Ñтандартного ввода � --include=МÐСКРобработать только файлы, подпадающие под МÐСКУ (файловый шаблон) --exclude=МÐСКРпропуÑтить файлы, подпадающие под МÐСКУ --exclude-from=ФÐЙЛ пропуÑтить файлы, подпадающие под маÑку файлов из ФÐЙЛР--exclude-dir=МÐСКРпропуÑтить каталоги, подпадающие под МÐСКУ � -E, --extended-regexp ШÐБЛОÐЫ — раÑширенные регулÑрные Ð²Ñ‹Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ -F, --fixed-regexp ШÐБЛОÐЫ — Ñтроки -G, --basic-regexp ШÐБЛОÐЫ — проÑтые регулÑрные Ð²Ñ‹Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ -P, --perl-regexp ШÐБЛОÐЫ — регулÑрные Ð²Ñ‹Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñзыка Perl � -I то же, что и --binary-files=without-match -d, --directories=ДЕЙСТВ как обрабатывать каталоги ДЕЙСТВИЕ может быть «read» (читать), «recurse» (рекурÑивно) или «skip» (пропуÑкать). -D, --devices=ДЕЙСТВ как обрабатывать уÑтройÑтва, FIFO и Ñокеты ДЕЙСТВИЕ может быть «read» или «skip» -r, --recursive то же, что и --directories=recurse -R, --dereference-recursive тоже, но Ñ Ð¿ÐµÑ€ÐµÑ…Ð¾Ð´Ð¾Ð¼ по вÑем Ñимвольным ÑÑылкам � -L, --files-without-match печатать только имена ФÐЙЛОВ без выбранных Ñтрок -l, --files-with-matches печатать только имена ФÐЙЛОВ Ñ Ð²Ñ‹Ð±Ñ€Ð°Ð½Ð½Ñ‹Ð¼Ð¸ Ñтроками -c, --count печатать только количеÑтво выбранных Ñтрок на ФÐЙЛ -T, --initial-tab выравнивать табулÑцией (еÑли нужно) -Z, --null печатать байт 0 поÑле имени ФÐЙЛР� -ЧИСЛО то же, что и --context=ЧИСЛО --group-separator=SEP печатать SEP в Ñтроке между ÑовпадениÑми Ñ ÐºÐ¾Ð½Ñ‚ÐµÐºÑтом --no-group-separator не печатать разделитель между ÑовпадениÑми Ñ ÐºÐ¾Ð½Ñ‚ÐµÐºÑтом --color[=КОГДÐ], --colour[=КОГДÐ] иÑпользовать маркеры Ð´Ð»Ñ Ñ€Ð°Ð·Ð»Ð¸Ñ‡Ð¸Ñ Ñовпадающих Ñтрок; КОГДРможет быть «always» (вÑегда), «never» (никогда) или «auto» (автоматичеÑки) -U, --binary не удалÑть Ñимволы CR в конце Ñтроки (MSDOS/Windows) � -e, --regexp=ШÐБЛОÐЫ иÑпользовать ШÐБЛОÐЫ Ð´Ð»Ñ Ð¿Ð¾Ð¸Ñка -f, --file=ФÐЙЛ брать ШÐБЛОÐЫ из ФÐЙЛа -i, --ignore-case игнорировать различие региÑтра --no-ignore-case учитывать региÑтр (по умолчанию) -w, --word-regexp Ñовпадение обÑзательно Ñ Ñ†ÐµÐ»Ñ‹Ð¼ Ñловом -x, --line-regexp Ñовпадение обÑзательно Ñ Ñ†ÐµÐ»Ð¾Ð¹ Ñтрокой -z, --null-data Ñтроки разделÑÑŽÑ‚ÑÑ Ð±Ð°Ð¹Ñ‚Ð¾Ð¼ Ñ Ð½ÑƒÐ»ÐµÐ²Ñ‹Ð¼ значением, а не Ñимволом конца Ñтроки � -o, --only-matching показывать только Ñовпавшие непуÑтые чаÑти Ñтрок -q, --quiet, --silent подавлÑть веÑÑŒ обычный вывод --binary-files=ТИП Ñчитать, что двоичный файл имеет ТИП: «binary», «text» или «without-match». -a, --text тоже, что и --binary-files=text �ДомашнÑÑ Ñтраница %s: <%s> �%s: двоичный файл Ñовпадает�%s: иÑчерпан лимит возвратов в PCRE�%s: иÑчерпан лимит рекурÑии в PCRE�%s: иÑчерпан Ñтек PCRE JIT�%s: файл ввода также иÑпользуетÑÑ Ð¸ Ð´Ð»Ñ Ð²Ñ‹Ð²Ð¾Ð´Ð°�%s: внутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° PCRE: %d�%s: неверный параметр «%c» �%s: памÑть иÑчерпана�%s: Ð´Ð»Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ð° «%s%s» Ð½ÐµÐ»ÑŒÐ·Ñ Ð¸Ñпользовать аргумент �%s: двуÑмыÑленный параметр «%s%s» �%s: двуÑмыÑленный параметр «%s%s»; возможные варианты:�%s: Ð´Ð»Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ð° «%s%s» требуетÑÑ Ð°Ñ€Ð³ÑƒÐ¼ÐµÐ½Ñ‚ �%s: параметру требуетÑÑ Ð°Ñ€Ð³ÑƒÐ¼ÐµÐ½Ñ‚ «%c» �%s: нераÑпознанный параметр «%s%s» �%s: предупреждение: каталоги зациклены�»�(C)�(Ñтандартный ввод)�параметр -P поддерживает только однобайтовые локали и UTF-8�Пример: %s -i 'hello world' menu.h main.c ШÐБЛОÐОВ можно указать неÑколько, разделÑÑ Ð¸Ñ… Ñимволом новой Ñтроки. Шаблон выбора и его интерпретациÑ: �Справка по работе Ñ Ð¿Ñ€Ð¾Ð³Ñ€Ð°Ð¼Ð¼Ð°Ð¼Ð¸ GNU: <%s> �ÐÐµÐ¿Ñ€Ð°Ð²Ð¸Ð»ÑŒÐ½Ð°Ñ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð°Ñ ÑÑылка�Ðеправильное Ð¸Ð¼Ñ ÐºÐ»Ð°ÑÑа Ñимволов�Ðеправильный Ñимвол ÑравнениÑ�Ðеправильное Ñодержимое в \{\}�Ðеправильное предшеÑтвующее регулÑрное выражение�Ðеправильный конец диапазона�Ðеправильное регулÑрное выражение�Ð›Ð¸Ñ†ÐµÐ½Ð·Ð¸Ñ GPLv3+: GNU GPL верÑии 3 или новее <%s>. Это Ñвободное ПО: вы можете изменÑть и раÑпроÑтранÑть его. Ðет ÐИКÐКИХ ГÐРÐÐТИЙ в пределах дейÑтвующего законодательÑтва. �ПамÑть иÑчерпана�Ðет Ñовпадений�Ðет предыдущего регулÑрного выражениÑ�Упакован %s �Упакован %s (%s) �Шаблоны Perl не поддерживаютÑÑ Ð¿Ñ€Ð¸ Ñборке Ñ --disable-perl-regexp�Преждевременное завершение регулÑрного выражениÑ�РегулÑрное выражение Ñлишком большое�Об ошибках в %s Ñообщайте по адреÑу %s �Об ошибках Ñообщайте по адреÑу: %s �ПоиÑк ШÐБЛОÐОВ в каждом ФÐЙЛЕ. �Выполнено уÑпешно�Завершающий Ñимвол обратной коÑой черты�ЗапуÑтите «%s --help» Ð´Ð»Ñ Ð¿Ð¾Ð»ÑƒÑ‡ÐµÐ½Ð¸Ñ Ð±Ð¾Ð»ÐµÐµ подробного опиÑаниÑ. �ÐеизвеÑÑ‚Ð½Ð°Ñ ÑиÑÑ‚ÐµÐ¼Ð½Ð°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°�ÐÐµÐ¿Ð°Ñ€Ð½Ð°Ñ ( или \(�ÐÐµÐ¿Ð°Ñ€Ð½Ð°Ñ ) или \)�ÐÐµÐ¿Ð°Ñ€Ð½Ð°Ñ [, [^, [:, [. или [=�ÐÐµÐ¿Ð°Ñ€Ð½Ð°Ñ \{�ИÑпользование: %s [ПÐРÐМЕТР]… ШÐБЛОÐЫ [ФÐЙЛ]… �ДопуÑтимые аргументы:�ЕÑли в качеÑтве ФÐЙЛРуказан Ñимвол «-», то читаетÑÑ Ñтандартный ввод. ЕÑли ФÐЙЛ не указан, то читаетÑÑ Ñ‚ÐµÐºÑƒÑ‰Ð¸Ð¹ каталог «.» и «-» в противном Ñлучае. ЕÑли указано менее двух ФÐЙЛОВ, то предполагаетÑÑ -h. При нахождении Ñовпадений любой Ñтроки кодом Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð¸Ñ Ð±ÑƒÐ´ÐµÑ‚ 0 и 1, еÑли ничего не Ñовпало. При возникновении ошибок и еÑли не указан параметр -q, кодом Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð¸Ñ Ð±ÑƒÐ´ÐµÑ‚ 2. �Ðвторы программы — %s и %s. �Ðвторы программы — %s, %s, %s, %s, %s, %s, %s, %s, %s и другие. �Ðвторы программы — %s, %s, %s, %s, %s, %s, %s, %s и %s. �Ðвторы программы — %s, %s, %s, %s, %s, %s, %s и %s. �Ðвторы программы — %s, %s, %s, %s, %s, %s и %s. �Ðвторы программы — %s, %s, %s, %s, %s и %s. �Ðвторы программы — %s, %s, %s, %s и %s. �Ðвторы программы — %s, %s, %s и %s. �Ðвторы программы — %s, %s и %s. �Ðвтор программы — %s. �Ðвторы программы: Mike Haertel и другие; Ñмотрите <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>�«�двуÑмыÑленный аргумент %s Ð´Ð»Ñ %s�ÑинтакÑÐ¸Ñ ÐºÐ»Ð°ÑÑа Ñимволов: [[:space:]], а не [:space:]�заданы конфликтующие образцы�превышено ограничение длины Ñтроки PCRE�ошибка Ð²Ñ‹Ð´ÐµÐ»ÐµÐ½Ð¸Ñ Ð¿Ð°Ð¼Ñти Ð´Ð»Ñ Ñтека PCRE JIT�не удалоÑÑŒ вернутьÑÑ Ð² начальный рабочий каталог�не удалоÑÑŒ изменить текÑтовый/двоичный режим у файлового деÑкриптора�входные данные Ñлишком велики, чтобы ÑоÑчитать�внутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° (не должна возникать)�неверный аргумент %s Ð´Ð»Ñ %s�неправильный клаÑÑ Ñимволов�неправильное Ñодержимое в \{\}�неверный аргумент длины контекÑта�неверный образец %s�неверно задано чиÑло макÑимального количеÑтва Ñовпадений�памÑть иÑчерпана�не указан ÑинтакÑиÑ�ошибка программы�регулÑрное выражение Ñлишком большое�переполнение Ñтека�параметр -P поддерживает только одиночный шаблон�не удалоÑÑŒ запомнить текущий рабочий каталог�неÑбаланÑÐ¸Ñ€Ð¾Ð²Ð°Ð½Ð½Ð°Ñ (�неÑбаланÑÐ¸Ñ€Ð¾Ð²Ð°Ð½Ð½Ð°Ñ )�неÑбаланÑÐ¸Ñ€Ð¾Ð²Ð°Ð½Ð½Ð°Ñ [�Ð½ÐµÐ·Ð°Ð²ÐµÑ€ÑˆÑ‘Ð½Ð½Ð°Ñ \ ÑÐºÑ€Ð°Ð½Ð¸Ñ€ÑƒÑŽÑ‰Ð°Ñ Ð¿Ð¾ÑледовательноÑть�неизвеÑтный тип двоичных файлов�неизвеÑтный метод Ð´Ð»Ñ ÑƒÑтройÑтв�предупреждение: параметр --unix-byte-offsets (-u) уÑтарел�ошибка запиÑи����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/gl.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000037527�14670377471�016214� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����g������T��‰���Œ������°��Ï���±��÷��� ��Õ��y ����O ��ü���` ��¶��]��U����¤��j��F�������V�����j��&���‚��#���©�����Í��!���ê����� �����(�����D��,���Y�����†��.���¦��'���Õ��(���ý�����&��%���F�����l�����n�����r��*���ƒ�����®��&���?�����f�����}�����š�����¶��$���Î�����ó�������ª��� �����Ë�����Ü�����å������������<���)��#���f�����Š�����¥�����¼��"���Ð�����ó�����û��&��������5�����J�����\�����n�� �����)���š�����Ä��ù���Ù�����Ó��;���ê��3���&��/���Z��+���Š��'���¶��#���Þ����������"�����>��\���N�����«�����­��4���Ê�����ÿ��!�����0���@��-���q��.���Ÿ�����Î��$���ê����������*�����B�����Z�����z����������Ÿ�����°�� ���Ä�����Ò�����í��,���ü��*���) �� ���T �� ���a �� ���n �����{ ����� �����© �� ���À ��Ð��Ì ��æ���"��ö���„#��R��{$��Œ��Î&����[(��ý��z)��f��x+��<��ß,��^��/�����{0�����—0��1���·0��2���é0�����1��/���:1�����j1��&���‡1�����®1��2���Ã1�� ���ö1��0���2��*���H2��+���s2��&���Ÿ2��(���Æ2�����ï2�����ò2�����õ2��%��� 3��V���/3��1���†3��!���¸3��&���Ú3�����4����� 4��-���84�����f4�����„4��¸���¢4�����[5�����l5��+���‰5�����µ5�����É5��Z���â5��%���=6��(���c6��&���Œ6��#���³6�� ���×6�����ø6�����7��2���7�����M7�����j7�����7��#���˜7�����¼7��,���Î7�����û7��F��8�����_9��:���u9��2���°9��.���ã9��*���:��&���=:��"���d:�����‡:�����¦:�����Á:��^���Ò:�����1;��!���4;��>���V;��(���•;��+���¾;��F���ê;��=���1<��C���o<��.���³<��)���â<��$��� =�����1=�����P=��-���k=�����™=�����¹=�����Õ=��"���æ=����� >��#���>�����>>��"���T>��4���w>�����¬>�����½>�����Î>��!���ß>�����?��$��� ?�����E?�����d���;���<���8������� ���4���)������*����������O������D�����������]���C���\���S���%���/��� ���L���2���,�����������_���>���H������U������Z������������������G����������������X����������=��������������`���^���N���J������6���?���M���R�������F���T���$���������������������7�����������������K���0�������P���9���#�����������3���������!���c���.��� ������E���W���e����������:���A���5���(��� ������ �������@�����������Y���"���a���-���f������ ���+������1���Q�������������g���'���V�����������b���I���&�������B�������������������[���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep 3.5.16 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2020-11-09 12:44+0100 Last-Translator: Francisco Javier Tsao Santín <tsao@members.fsf.org> Language-Team: Galician <proxecto@trasno.gal> Language: gl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); X-Generator: Virtaal 0.7.1 X-Bugs: Report translation errors to the Language-Team address. � Control do contexto: -B, --before-context=NÚM amosa o NÚM de liñas de contexto anterior -A, --after-context=NÚM amosa o NÚM de liñas de contexto posterior -C, --context=NÚM amosa o NÚM liñas de contexto � Variadas: -s, --no-messages suprime as mensaxes de erro -v, --invert-match selecciona as liñas que non coinciden -V, --version amosa a versión e finaliza --help amosa esta axuda e finaliza � Control da saída como resultado: -m, --max-count=NUM detense despois do NUM de liñas seleccionadas -b, --byte-offset amosa o desprazamento en bytes xunto coas liñas de saí­da -n, --line-number amosa o número de liña xunto coas liñas de saí­da --line-buffered descarga o resultado para cada liña -H, --with-filename amosa o nome do ficheiro de cada coincidencia -h, --no-filename suprime os nomes dos ficheiros como prefixo no resultado --label=ETIQUETA utiliza ETIQUETA como prefixo estándar do nome de ficheiro � --include=PATRÓN_FICHEIRO busca só os ficheiros que coinciden con PATRÓN_FICHEIRO --exclude=PATRÓN_FICHEIRO omítense os ficheiros e cartafoles que coinciden con PATRÓN_FICHEIRO --exclude-from=FICHEIRO omítense os ficheiros que coinciden con calquera patrón de ficheiro de FICHEIRO --exclude-dir=PATRÓN omítense os cartafoles que coinciden con PATRÓN � -E, --extended-regexp O PATRÓNS son expresións regulares estendidas -F, --fixed-strings O PATRÓNS son conxuntos de cadeas -G, --basic-regexp O PATRÓNS son expresións regulares básicas -P, --perl-regexp O PATRÓNS son expresións regulares en Perl � -I equivalente a --binary-files=sen-coincidencia -d, --directories=ACCIÓN especifica como manexar os cartafoles ACCIÓN pode ser 'read', 'recurse', ou 'skip' -D, --devices=ACCIÓN especifica como manexar dispositivos, FIFO e «sockets», pode ser 'read' ou 'skip' -r, --recursive equivalente a --directories=recurse -R, --dereference-recursive equivalente, pero seguindo tódolas ligazóns simbólicas � -L, --files-without-match amosa só os nomes dos FICHEIROS que no conteñen ningunha coincidencia -l, --files-with-matches amosa só os nomes de FICHEIROS que conteñen algunha coincidencia -c, --count amosa só resultado de liñas que coinciden de cada FICHEIRO -Z, --null imprime un byte 0 despois do nome do FICHEIRO � -e, --regexp=PATRÓN utiliza PATRÓNS para atopar coincidencias -f, --file=FICHEIRO obtén PATRÓNS de FICHEIRO -i, --ignore-case considera iguais as maiúsculas e as minúsculas en patróns e datos --no-ignore-case non considera iguais as maiúsculas e as minúsculas (por defecto) -w, --word-regexp obriga a que coincida só con palabras completas -x, --line-regexp obriga a que coincida só con liñas completas -z, --null-data unha liña de datos termina nun byte 0, non nun carácter de nova liña � -o, --only-matching amosa só partes non baleiras de liñas que coinciden -q, --quiet, --silent suprime todo o resultado normal --binary-files=TIPO supón que os ficheros binarios son de TIPO; TIPO é 'binary', 'text', ou 'without-match' -a, --text equivalente a --binary-files=text �Páxina de web de %s: <%s> �%s: coincide o ficheiro binario�%s: excedeuse o límite de volta atrás das PCREs�%s: excedeuse o límite de recursividade das PCREs�%s: esgotouse a pila PCRE JIT�%s: o ficheiro de entrada tamén é o de saída�%s: erro interno de PCRE: %d�%s: a opción -- '%c' non é correcta �%s: memoria esgotada�%s: a opción '%s%s' non admite ningún argumento �%s: a opción '%s%s' é ambigua �%s: a opción '%s%s' é ambigüa; posibilidades:�%s: a opción '%s%s' require un argumento �%s: a opción require un argumento -- '%c' �%s: non se recoñece a opción '%s%s' �%s: aviso: ciclo de cartafoles recursivo�»�©�(entrada estándar)�-P admite só locales unibyte e UTF-8�Exemplo: %s -i 'hello world' menu.h main.c Selección de patróns e interpretación: �Axuda xeral sobre o uso de software de GNU: <%s> �Referencia cara atrás incorrecta�Nome de clase de caracteres incorrecto�Carácter de unión incorrecto�Contido incorrecto \{\}�A expresión regular precedente é incorrecta�Final de intervalo incorrecto�Expresión regular incorrecta�Licenza GPLv3+: GPL de GNU versión 3 ou posterior <%s>. Isto é software libre: vostede é libre de modificalo e redistribuílo. Non hai NINGUNHA GARANTÃA, ata onde o permite a lei. �Memoria esgotada�No hai ningunha coincidencia�No hai ningunha expresión regular anterior�Empaquetado por %s �Empaquetado por %s (%s) �A coincidencia compatible con Perl non está soportada nun compilado --disable-perl-regexp�Final prematuro da expresión regular�A expresión regular é demasiado grande�Comunicar %s erros de programa en: %s �Comunicar erros no programa en: %s �Busca PATRÓNS en cada FICHERO. �Correcto�Barra invertida ao final�Consulte con '%s --help' para máis información. �Erro do sistema descoñecido�( ou \( desemparellado�) ou \) desemparellado�[, [^, [:, [., ou [= desemparellado�\{ desemparellado�Uso: %s [OPCIÓN]... PATRÓNS [FICHEIRO]... �Os argumentos correctos son:�Cando o FICHEIRO é '-', le a entrada estándard. De non especificar FICHEIRO, le '.' se é recursivo, doutra maneira '-'. De se dar menos de dous FICHEIROS, suponse -h. O estado de saída é 0 se algunha liña é elixida, 1 se non as hai; de se producir algún erro e asemade non se especificou -q, o estado de saída é 2. �Escrito por %s e %s. �Escrito por %s, %s, %s, %s, %s, %s, %s, %s, %s, e outros. �Escrito por %s, %s, %s, %s, %s, %s, %s, %s, e %s. �Escrito por %s, %s, %s, %s, %s, %s, %s, e %s. �Escrito por %s, %s, %s, %s, %s, %s, e %s. �Escrito por %s, %s, %s, %s, %s, e %s. �Escrito por %s, %s, %s, %s, e %s. �Escrito por %s, %s, %s, e %s. �Escrito por %s, %s, e %s. �Escrito por %s. �Escrito por Mike Haertel e outros, véxase <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>�«�o argumento %s para %s é ambiguo�a sintaxe da clase de caracteres é [[:space:]], non [:space:]�especificáronse expresións conflitivas�excedeuse o tamaño límite das liñas PCRE�ao tentar dispoñer de memoria produciuse un erro para a pila PCRE JIT�produciuse un fallo ao volver ao cartafol de traballo inicial�produciuse un fallo ao configurar o modo do descritor texto/binario�a entrada é longa de máis para facer a conta�erro interno (non debería ocorrer nunca)�o argumento %s para %s é incorrecto�clase de caracteres incorrecta�contido incorrecto de \{\}�argumento de lonxitude do contexto incorrecto�a expresión %s non é correcta�contador máximo incorrecto�memoria esgotada�no se especificou ningunha sintaxe�erro de programa�expresión regular demasiado grande�desbordamento de pila�a opción -P admite só un patrón�non se puido rexistrar o cartafol de traballo activo�( desemparellado�) desemparellado�[ desemparellado�secuencia de escape \ sen rematar�tipo binary-files descoñecido�método de dispositivos descoñecido�erro de escritura��������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/quot.sed��������������������������������������������������������������������0000664�0001750�0001750�00000000231�14670377450�016546� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������s/"\([^"]*\)"/“\1â€/g s/`\([^`']*\)'/‘\1’/g s/ '\([^`']*\)' / ‘\1’ /g s/ '\([^`']*\)'$/ ‘\1’/g s/^'\([^`']*\)' /‘\1’ /g s/“â€/""/g �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/remove-potcdate.sin���������������������������������������������������������0000664�0001750�0001750�00000000660�14670377450�020700� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Sed script that remove the POT-Creation-Date line in the header entry # from a POT file. # # The distinction between the first and the following occurrences of the # pattern is achieved by looking at the hold space. /^"POT-Creation-Date: .*"$/{ x # Test if the hold space is empty. s/P/P/ ta # Yes it was empty. First occurrence. Remove the line. g d bb :a # The hold space was nonempty. Following occurrences. Do nothing. x :b } ��������������������������������������������������������������������������������kbuild-3608/src/grep/po/el.po�����������������������������������������������������������������������0000664�0001750�0001750�00000071354�14670377450�016037� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Greek messages for GNU grep # This file is distributed under the same license as the grep package. # Copyright (C) 1998, 2002 Free Software Foundation, Inc. # Simos Xenitellis <simos@hellug.gr>, 1998, 2002. # Savvas Radevic <vicedar@gmail.com>, 2012. # msgid "" msgstr "" "Project-Id-Version: grep 2.11.11-pre1\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2012-05-05 23:23+0100\n" "Last-Translator: Savvas Radevic <vicedar@gmail.com>\n" "Language-Team: Greek <team@lists.gnome.gr>\n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Poedit-Language: Greek\n" "X-Poedit-Country: GREECE\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "άκυÏη επιλογή %s για %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "διφοÏοÏμενη επιλογή %s για %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "ΈγκυÏες επιλογές είναι οι εξής:" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "σφάλμα εγγÏαφής" # src/dfa.c:652 src/dfa.c:655 src/dfa.c:682 src/dfa.c:686 src/dfa.c:687 # src/dfa.c:690 src/dfa.c:703 src/dfa.c:704 # src/dfa.c:660 src/dfa.c:663 src/dfa.c:690 src/dfa.c:694 src/dfa.c:695 # src/dfa.c:698 src/dfa.c:711 src/dfa.c:712 #: lib/dfa.c:896 #, fuzzy msgid "unbalanced [" msgstr "Μη ισοÏÏοπημένο [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "άκυÏη κατηγοÏία χαÏακτήÏων" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "η σÏνταξη κατηγοÏίας χαÏακτήÏων είναι [[:space:]], όχι [:space:]" # src/dfa.c:444 # src/dfa.c:452 #: lib/dfa.c:1210 #, fuzzy msgid "unfinished \\ escape" msgstr "Μη τεÏματισμένος χαÏακτήÏας διαφυγής \\" # src/dfa.c:556 src/dfa.c:562 src/dfa.c:573 src/dfa.c:584 # src/dfa.c:564 src/dfa.c:570 src/dfa.c:581 src/dfa.c:592 #: lib/dfa.c:1371 #, fuzzy msgid "invalid content of \\{\\}" msgstr "μη έγκυÏος μέγιστος μετÏητής" #: lib/dfa.c:1374 #, fuzzy msgid "regular expression too big" msgstr "ΥπεÏβολικά μεγάλη η κανονική έκφÏαση" # src/dfa.c:841 # src/dfa.c:849 #: lib/dfa.c:1858 #, fuzzy msgid "unbalanced (" msgstr "Μη ισοÏÏοπημένο (" # src/dfa.c:962 # src/dfa.c:970 #: lib/dfa.c:1975 #, fuzzy msgid "no syntax specified" msgstr "Δεν οÏίστηκε συντακτικό" # src/dfa.c:970 # src/dfa.c:978 #: lib/dfa.c:1986 #, fuzzy msgid "unbalanced )" msgstr "Μη ισοÏÏοπημένο )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Άγνωστο λάθος συστήματος" # src/getopt.c:813 # src/getopt.c:813 #: lib/getopt.c:278 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: η επιλογή «-W %s» είναι διφοÏοÏμενη\n" # src/getopt.c:628 # src/getopt.c:628 #: lib/getopt.c:284 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: η επιλογή «%s» είναι διφοÏοÏμενη\n" # src/getopt.c:707 # src/getopt.c:707 #: lib/getopt.c:319 #, fuzzy, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: μη αναγνωÏίσιμη επιλογή «%c%s»\n" # src/getopt.c:657 # src/getopt.c:657 #: lib/getopt.c:345 #, fuzzy, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: η επιλογή «%c%s» δεν επιτÏέπει οÏίσματα\n" # src/getopt.c:674 src/getopt.c:847 # src/getopt.c:674 src/getopt.c:847 #: lib/getopt.c:360 #, fuzzy, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: η επιλογή «%s» απαιτεί ÏŒÏισμα\n" # src/getopt.c:736 # src/getopt.c:736 #: lib/getopt.c:621 #, fuzzy, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: μη έγκυÏη επιλογή -- %c\n" # src/getopt.c:766 src/getopt.c:896 # src/getopt.c:766 src/getopt.c:896 #: lib/getopt.c:636 lib/getopt.c:682 #, fuzzy, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: η επιλογή απαιτεί ένα ÏŒÏισμα -- %c\n" # src/grep.c:144 src/grep.c:161 src/grep.c:222 src/grep.c:263 src/kwset.c:184 # src/kwset.c:190 # src/grep.c:164 src/grep.c:181 src/grep.c:283 src/grep.c:338 src/kwset.c:184 # src/kwset.c:190 #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "η μνήμη εξαντλήθηκε" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "δεν είναι δυνατή η καταγÏαφή του Ï„Ïέχοντος φακέλου εÏγασίας" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "αποτυχία επιστÏοφής στον αÏχικό φάκελο εÏγασίας" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "«" #: lib/quotearg.c:356 msgid "'" msgstr "»" #: lib/regcomp.c:135 msgid "Success" msgstr "Επιτυχία" #: lib/regcomp.c:138 msgid "No match" msgstr "Καμία αντιστοιχία" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "ΆκυÏη κανονική έκφÏαση" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "ΆκυÏο τέλος σειÏάς" # src/dfa.c:147 src/dfa.c:159 src/dfa.c:172 # src/dfa.c:155 src/dfa.c:167 src/dfa.c:180 src/grep.c:827 #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Η μνήμη εξαντλήθηκε" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "ΆκυÏη Ï€ÏοηγοÏμενης κανονικής έκφÏασης" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "ΠÏόωÏο τέλος της κανονικής έκφÏασης" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "ΥπεÏβολικά μεγάλη η κανονική έκφÏαση" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Καμία Ï€ÏοηγοÏμενη κανονική έκφÏαση" #: lib/version-etc.c:73 #, fuzzy, c-format msgid "Packaged by %s (%s)\n" msgstr "Συσκευάστηκε από %s (%s)\n" #: lib/version-etc.c:76 #, fuzzy, c-format msgid "Packaged by %s\n" msgstr "Συσκευάστηκε από %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, fuzzy, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "\n" "Άδεια χÏήσης GPLv3+: GNU GPL έκδοση 3 ή μεταγενέστεÏη <http://gnu.org/" "licenses/gpl.html>\n" "Αυτό είναι ελεÏθεÏο λογισμικό: Είστε ελεÏθεÏοι να το αλλάξετε και να το " "αναδιανέμετε.\n" "Δεν υπάÏχει ΚΑΜΙΑ ΕΓΓΥΗΣΗ στην έκταση που επιτÏέπεται από το νόμο.\n" "\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, fuzzy, c-format msgid "Written by %s.\n" msgstr "Συντάχθηκε από τον %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, fuzzy, c-format msgid "Written by %s and %s.\n" msgstr "Συντάχθηκε από τους %s και %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, fuzzy, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Συντάχθηκε από τους %s, %s, και %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, fuzzy, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Συντάχθηκε από τους %s, %s, %s,\n" "και %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, fuzzy, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Συντάχθηκε από τους %s, %s, %s,\n" "%s, και %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, fuzzy, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Συντάχθηκε από τον %s, %s, %s,\n" "%s, %s, and %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, fuzzy, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Συντάχθηκε από τους %s, %s, %s,\n" "%s, %s, %s, και %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, fuzzy, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Συντάχθηκε από τους %s, %s, %s,\n" "%s, %s, %s, %s,\n" "και %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, fuzzy, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Συντάχθηκε από τους %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, και %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, fuzzy, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Συντάχθηκε από τους %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, και άλλους.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "ΑναφοÏά σφαλμάτων: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "ΑναφοÏά %s σφαλμάτων: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s κεντÏική σελίδα: <%s>\n" #: lib/version-etc.c:260 #, fuzzy, c-format msgid "General help using GNU software: <%s>\n" msgstr "Γενική βοήθεια χÏήσης Î»Î¿Î³Î¹ÏƒÎ¼Î¹ÎºÎ¿Ï GNU: <http://www.gnu.org/gethelp/>\n" # src/grep.c:964 src/grep.c:1015 # src/grep.c:730 #: src/grep.c:649 msgid "(standard input)" msgstr "(κανονική είσοδος)" # src/grep.c:785 src/grep.c:792 # src/grep.c:1060 src/grep.c:1067 src/grep.c:1076 #: src/grep.c:829 msgid "invalid context length argument" msgstr "μη έγκυÏο ÏŒÏισμα μήκους πεÏιεχομένου" #: src/grep.c:894 msgid "input is too large to count" msgstr "η είσοδος είναι Ï€Î¿Î»Ï Î¼ÎµÎ³Î¬Î»Î· για να μετÏηθεί" # src/grep.c:715 #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Το δυαδικό αÏχείο %s ταιÏιάζει\n" # src/grep.c:844 #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "αναδÏομική αλληλοδιαδοχή καταλόγων" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "το αÏχείο εισαγωγής %s είναι επίσης το αÏχείο εξόδου" # src/grep.c:597 # src/grep.c:862 #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "ΧÏήση: %s [ΕΠΙΛΟΓΗ]... ΥΠΟΔΕΙΓΜΑ [ΑΡΧΕΙΟ]...\n" # src/grep.c:598 # src/grep.c:863 #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Δοκιμάστε «%s --help» για πεÏισσότεÏες πληÏοφοÏίες.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "ΕÏÏεση του ΥΠΟΔΕΙΓΜΑτος σε κάθε ΑΡΧΕΙΟ ή την κανονική είσοδο.\n" "ΠαÏάδειγμα: %s -i 'hello world' menu.h main.c\n" "\n" "Επιλογή κανονικής έκφÏασης και εÏμηνεία:\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp ΥΠΟΔΕΙΓΜΑ είναι μια εκτεταμένη κανονική έκφÏαση\n" " -F, --fixed-regexp ΥΠΟΔΕΙΓΜΑ είναι στατικό αλφαÏιθμητικό διαχωÏι-\n" " ζόμενο με χαÏακτήÏες αλλαγής γÏαμμής\n" " -G, --basic-regexp ΥΠΟΔΕΙΓΜΑ είναι απλή κανονική έκφÏαση\n" " -P, --perl-regexp ΥΠΟΔΕΙΓΜΑ είναι κανονική έκφÏαση Perl\n" # src/grep.c:603 # src/grep.c:868 #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=ΥΠΟΔΕΙΓΜΑ χÏήση ΥΠΟΔΕΙΓΜΑτος για κανονική έκφÏαση\n" " -f, --file=ΑΡΧΕΙΟ λήψη ΥΠΟΔΕΙΓΜΑτος από το αÏχείο ΑΡΧΕΙΟ\n" " -i, --ignore-case αγνόησε διαφοÏές πεζών/κεφαλαίων\n" " -w, --word-regexp επιβολή του ΥΠΟΔΕΙΓΜΑτος να ταιÏιάζει μόνο\n" " ολόκληÏες λέξεις\n" " -x, --line-regexp επιβολή του ΥΠΟΔΕΙΓΜΑτος να ταιÏιάζει μόνο\n" " ολόκληÏες γÏαμμές\n" " -z, --null-data η γÏαμμή δεδομένων τεÏματίζεται με byte 0\n" " και όχι με χαÏακτήÏα αλλαγής γÏαμμής\n" # src/grep.c:615 # src/grep.c:880 #: src/grep.c:1989 #, fuzzy, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Λοιπά:\n" " -s, --no-messages αποφυγή εμφάνισης μηνυμάτων σφαλμάτων\n" " -v, --revert-match επιλογή γÏαμμών που δεν ταιÏιάζουν\n" " -V, --version εμφάνισης πληÏοφοÏιών έκδοσης και έξοδος\n" " --help εμφάνισης αυτής της βοήθειας και έξοδος\n" " --mmap χÏήση εισόδου απεικονισμένη-στη-μνήμη αν\n" " υπάÏχει τέτοια δυνατότητα\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" #: src/grep.c:2036 #, fuzzy, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Έλεγχος βάσει του πεÏιεχομένου:\n" " -B, --before-context=ΑΡΙΘΜΟΣ εμφάνιση ΑΡΙΘΜΟΣ γÏαμμών με ακολουθοÏμενο\n" " πεÏιεχόμενο\n" " -A, --after-context=ΑΡΙΘΜΟΣ εμφάνιση ΑΡΙΘΜΟΣ γÏαμμών με Ï€ÏοποÏευόμενο\n" " πεÏιεχόμενο\n" " -C, --context=ΑΡΙΘΜΟΣ εμφάνιση ΑΡΙΘΜΟΣ (εξ οÏÎ¹ÏƒÎ¼Î¿Ï 2) γÏαμμών με\n" " πεÏιεχόμενο εξόδου\n" # src/grep.c:633 # src/grep.c:902 #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM το ίδιο με --context=ΑΡΙΘΜΟΣ\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to distinguish the matching string\n" " WHEN may be `always', `never' or `auto'.\n" " -U, --binary να μην απαλείφονται χαÏακτήÏες CR στο EOL " "(MSDOS)\n" " -u, --unix-byte-offsets αναφοÏά σχετικών θέσεων σα να μην υπήÏχαν\n" " χαÏακτήÏες CR (MSDOS)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "ΧωÏία ΑΡΧΕΙΟ, ή όταν το ΑΡΧΕΙΟ είναι -, διαβάζεται η κανονική είσοδος.\n" "Αν στα οÏίσματα υπάÏχουν λιγότεÏα από δÏο ΑΡΧΕΙΑ, τότε υποτίθεται ότι έχει\n" "δοθεί η επιλογή -h. Η κατάσταση εξόδου του Ï€ÏογÏάμματος είναι 0 αν βÏέθηκε\n" "το ΥΠΟΔΕΙΓΜΑ, 1 αν δεν βÏέθηκε και 2 αν Ï€Ïοέκυψε κάποιο Ï€Ïόβλημα.\n" # src/grep.c:829 # src/grep.c:1112 #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "οÏίστηκαν αντικÏουόμενα στοιχεία αναζήτησης" #: src/grep.c:2101 #, fuzzy msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "η υποστήÏιξη για την επιλογή -P δεν είναι μεταγλωττισμένη σε αυτό το --" "disable-perl-regexp δυαδικό [αÏχείο]" # src/dfa.c:556 src/dfa.c:562 src/dfa.c:573 src/dfa.c:584 # src/dfa.c:564 src/dfa.c:570 src/dfa.c:581 src/dfa.c:592 #: src/grep.c:2103 #, fuzzy, c-format msgid "invalid matcher %s" msgstr "μη έγκυÏος μέγιστος μετÏητής" # src/grep.c:1133 #: src/grep.c:2538 msgid "unknown devices method" msgstr "άγνωστη μέθοδος συσκευών" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" # src/dfa.c:556 src/dfa.c:562 src/dfa.c:573 src/dfa.c:584 # src/dfa.c:564 src/dfa.c:570 src/dfa.c:581 src/dfa.c:592 #: src/grep.c:2686 msgid "invalid max count" msgstr "μη έγκυÏος μέγιστος μετÏητής" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "άγνωστο είδος δυαδικών αÏχείων" #: src/grep.c:2829 #, fuzzy msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "άλλοι, κοιτάξτε τον σÏνδεσμο <http://git.sv.gnu.org/cgit/grep.git/tree/" "AUTHORS>" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "Η επιλογή -P υποστηÏίζει μόνο ένα υπόδειγμα" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "" # src/grep.c:144 src/grep.c:161 src/grep.c:222 src/grep.c:263 src/kwset.c:184 # src/kwset.c:190 # src/grep.c:164 src/grep.c:181 src/grep.c:283 src/grep.c:338 src/kwset.c:184 # src/kwset.c:190 #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "η μνήμη εξαντλήθηκε" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "εσωτεÏικό σφάλμα" # src/grep.c:293 # src/grep.c:366 #, fuzzy, c-format #~ msgid "warning: %s: %s" #~ msgstr "Ï€Ïοειδοποίηση: %s: %s\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "άκυÏη %s%s επιλογή «%s»" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "άκυÏη κατάληξη στην %s%s επιλογή «%s»" #~ msgid "%s%s argument '%s' too large" #~ msgstr "η %s%s επιλογή «%s» είναι υπεÏβολικά μεγάλη" #, fuzzy #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "%s κεντÏική σελίδα: <http://www.gnu.org/software/%s/>\n" #~ msgid "internal error" #~ msgstr "εσωτεÏικό σφάλμα" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" # src/getopt.c:652 # src/getopt.c:652 #, fuzzy #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: η επιλογή «--%s» δεν επιτÏέπει οÏίσματα\n" # src/getopt.c:703 # src/getopt.c:703 #, fuzzy #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: μη αναγνωÏίσιμη επιλογή «--%s»\n" # src/getopt.c:813 # src/getopt.c:813 #, fuzzy #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: η επιλογή «-W %s» είναι διφοÏοÏμενη\n" # src/getopt.c:831 # src/getopt.c:831 #, fuzzy #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: η επιλογή «-W %s» δεν δέχεται οÏίσματα\n" # src/getopt.c:674 src/getopt.c:847 # src/getopt.c:674 src/getopt.c:847 #, fuzzy #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: η επιλογή «%s» απαιτεί ÏŒÏισμα\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "To «egrep» είναι ισοδÏναμο του «grep -E». Το «fgrep» είναι ισοδÏναμο του\n" #~ "«grep -F».\n" #~ "Η άμεση επίκληση ως «egrep» ή «fgrep» έχει καταÏγηθεί.\n" #~ msgid "lseek failed" #~ msgstr "αποτυχία του lseek" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "Το ΠΡΟΤΥΠΟ είναι μια εκτεταμένη κανονική έκφÏαση (ΕΚΕ).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "" #~ "Η επίκληση ως «egrep» έχει καταÏγηθεί· χÏησιμοποιήστε το «grep -E».\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "" #~ "Η επίκληση ως «fgrep» έχει καταÏγηθεί· χÏησιμοποιήστε το «grep -F».\n" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "η επιλογή --mmap δεν λειτουÏγεί από το 2010" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/Makevars��������������������������������������������������������������������0000664�0001750�0001750�00000005275�14670377471�016575� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = $(PACKAGE) # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ \ \ --flag=_:1:pass-c-format\ --flag=N_:1:pass-c-format\ --flag=error:3:c-format --flag=error_at_line:5:c-format\ \ --flag=asnprintf:3:c-format\ --flag=asprintf:2:c-format\ --flag=error:3:c-format\ --flag=error_at_line:5:c-format\ --flag=vasnprintf:3:c-format\ --flag=vasprintf:2:c-format\ --flag=wrapf:1:c-format\ --from-code=UTF-8\ $${end_of_xgettext_options+} # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Free Software Foundation, Inc. # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: # - Strings which are not entire sentences, see the maintainer guidelines # in the GNU gettext documentation, section 'Preparing Strings'. # - Strings which use unclear terms or require additional context to be # understood. # - Strings which make invalid assumptions about notation of date, time or # money. # - Pluralisation problems. # - Incorrect English spelling. # - Incorrect formatting. # It can be your email address, or a mailing list address where translators # can write to without being subscribed, or the URL of a web page through # which the translators can contact you. MSGID_BUGS_ADDRESS = bug-grep@gnu.org # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' # context. Possible values are "yes" and "no". Set this to yes if the # package uses functions taking also a message context, like pgettext(), or # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. USE_MSGCTXT = no # These options get passed to msgmerge. # Useful options are in particular: # --previous to keep previous msgids of translated messages, # --quiet to reduce the verbosity. MSGMERGE_OPTIONS = �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/bg.po�����������������������������������������������������������������������0000664�0001750�0001750�00000071527�14670377471�016034� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Bulgarian translation of GNU grep po-file. # Copyright (C) 2002, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Pavel Mihaylov <avatarbg@bulgaria.com>, 2002. # Alexander Shopov <ash@kambanaria.org>, 2015, 2016, 2017, 2018, 2019, 2020, 2021. msgid "" msgstr "" "Project-Id-Version: grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 16:17+0300\n" "Last-Translator: Alexander Shopov <ash@kambanaria.org>\n" "Language-Team: Bulgarian <dict@ludost.net>\n" "Language: bg\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "аргументът „%s“ на опциÑта „%s“ е неправилен" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "аргументът „%s“ на опциÑта „%s“ не е еднозначен" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Възможните аргументи Ñа:" #: lib/c-stack.c:187 msgid "program error" msgstr "програмна грешка" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "препълване на Ñтека" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "грешка при запиÑ" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "„[“ без еш" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "неправилен ÐºÐ»Ð°Ñ Ð·Ð½Ð°Ñ†Ð¸" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "ÐºÐ»Ð°Ñ Ð·Ð½Ð°Ñ†Ð¸ Ñе указва чрез „[[:ИМЕ:]]“, а не „[:ИМЕ:]“" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "незавършена екранираща поÑледователноÑÑ‚ чрез „\\“" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "неправилно Ñъдържание в „\\{\\}“" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "прекалено голÑм регулÑрен израз" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "„(“ без еш" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "не е зададен ÑинтакÑиÑ" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "„)“ без еш" #: lib/error.c:195 msgid "Unknown system error" msgstr "ÐеизвеÑтна ÑиÑтемна грешка" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: опциÑта „%s%s“ не е еднозначна\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: опциÑта „%s%s“ не е еднозначна. ВъзможноÑти:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: непозната Ð¾Ð¿Ñ†Ð¸Ñ â€ž%s%s“\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: опциÑта „%s%s“ Ñе използва без аргументи\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: опциÑта „%s%s“ изиÑква аргумент\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: неправилна Ð¾Ð¿Ñ†Ð¸Ñ â€” „%c“\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: опциÑта изиÑква аргумент — „%c“\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "паметта е изчерпана" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "не може да Ñе запише ÐºÐ¾Ñ Ðµ текущата работна директориÑ" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "не може да Ñе върне към първоначалната работна директориÑ" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "неуÑпешно задаване на вид на файла като текÑтов/двоичен" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "„" #: lib/quotearg.c:356 msgid "'" msgstr "“" #: lib/regcomp.c:135 msgid "Success" msgstr "УÑпех" #: lib/regcomp.c:138 msgid "No match" msgstr "ÐÑма ÑъвпадениÑ" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Ðеправилен регулÑрен израз" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Ðеправилен знак за подредба" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Ðеправилно име на ÐºÐ»Ð°Ñ Ð·Ð½Ð°Ñ†Ð¸" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Самотна „\\“ накраÑ" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Ðеправилна препратка към Ñъвпадение" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "„[“, „[^“, „[:“, „[.“ или „[=“ без еш" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "„(“ или „\\(“ без еш" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "„\\{“ без еш" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Ðеправилно Ñъдържание в „\\{\\}“" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Ðеправилен край на диапазон" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Паметта Ñвърши" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "ПредхождащиÑÑ‚ регулÑрен израз е неправилен" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Ранен край на регулÑрен израз" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "РегулÑрниÑÑ‚ израз е прекалено голÑм" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "„)“ или „\\)“ без еш" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "ÐÑма предхождащ регулÑрен израз" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Пакетирано от %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Пакетирано от %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Лиценз — Общ публичен лиценз на GNU (GNU GPL), както е публикуван от " "ФондациÑта\n" "за Ñвободен Ñофтуер — верÑÐ¸Ñ 3 на лиценза или (по ваше решение) по-къÑна " "верÑиÑ.\n" "<%s>\n" "Тази програма е Ñвободен Ñофтуер. Можете да Ñ Ñ€Ð°Ð·Ð¿Ñ€Ð¾ÑтранÑвате и/или " "променÑте.\n" "Ð¢Ñ Ñе разпроÑтранÑва БЕЗ ÐИКÐКВИ ГÐРÐÐЦИИ доколкото е позволено от закона.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Създадено от %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Създадено от %s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Създадено от %s, %s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Създадено от %s, %s, %s\n" "и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Създадено от %s, %s, %s,\n" "%s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Създадено от %s, %s, %s,\n" "%s, %s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Създадено от %s, %s, %s,\n" "%s, %s, %s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Създадено от %s, %s, %s,\n" "%s, %s, %s, %s\n" "и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Създадено от %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Създадено от %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s и др.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" "Докладвайте грешки в програмата на адреÑ: %s\n" "Докладвайте грешки в превода на адреÑ: <dict@ludost.net>\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Докладвайте грешки в „%s“ на адреÑ: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Уеб Ñтраница на „%s“: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Обща помощ за програмите на GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(Ñтандартен вход)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "неправилен размер на контекÑта" #: src/grep.c:894 msgid "input is too large to count" msgstr "входните данни Ñа прекалено големи, за да бъдат преброени" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "„%s“: двоичниÑÑ‚ файл напаÑва" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "„%s“: зациклÑне при рекурÑивна обработка на директориите" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "„%s“: входниÑÑ‚ файл е и изходен" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Употреба: %s [ОПЦИЯ]… ШÐБЛОÐ… [ФÐЙЛ]…\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "За повече Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¸Ð·Ð¿ÑŠÐ»Ð½ÐµÑ‚Ðµ „%s --help“.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "ТърÑене на текÑÑ‚, напаÑващ Ñ Ð¨ÐБЛОÐите във вÑеки зададен ФÐЙЛ.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Пример: %s -i 'hello world' menu.h main.c\n" "Може да използвате по един ШÐБЛОРна ред.\n" "\n" "Избор на шаблона и интерпретациÑ:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp ШÐБЛОÐите Ñа разширени регулÑрни изрази\n" " -F, --fixed-regexp ШÐБЛОÐите Ñа доÑловни низове\n" " -G, --basic-regexp ШÐБЛОÐите Ñа оÑновни регулÑрни изрази " "(Ñтандартно)\n" " -P, --perl-regexp ШÐБЛОÐите Ñа регулÑрни изрази на Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=ШÐБЛОРШÐБЛОРза регулÑрен израз\n" " -f, --file=ФÐЙЛ изчитане на ШÐБЛОÐите от ФÐЙЛ\n" " -i, --ignore-case без разлика между главни и малки букви\n" " --no-ignore-case ÑÑŠÑ Ñ€Ð°Ð·Ð»Ð¸ÐºÐ° между главни и малки букви " "(Ñтандартно)\n" " -w, --word-regexp Ñъвпадане Ñамо Ñ Ñ†ÐµÐ»Ð¸ думи\n" " -x, --line-regexp Ñъвпадане Ñамо Ñ Ñ†ÐµÐ»Ð¸ редове\n" " -z, --null-data редовете завършват Ñ NULL, а не ÑÑŠÑ Ð·Ð½Ð°Ðº за нов " "ред\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Разни:\n" " -s, --no-messages без ÑÑŠÐ¾Ð±Ñ‰ÐµÐ½Ð¸Ñ Ð·Ð° грешки\n" " -v, --revert-match извеждане на неÑъвпадащите редове\n" " -V, --version извеждане на Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð·Ð° верÑиÑта и изход\n" " --help извеждане на помощна Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¸ изход\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Управление на резултата:\n" " -m, --max-count=БРОЙ Ñпиране Ñлед този БРОЙ избрани редове\n" " -b, --byte-offset извеждане на отмеÑтването в байтове за вÑеки " "ред\n" " -n, --line-number извеждане на номерата на редовете\n" " --line-buffered буфериране по редове\n" " -H, --with-filename извеждане на името на файла при вÑÑко " "Ñъвпадение\n" " -h, --no-filename без извеждане на името на файла за вÑÑко " "Ñъвпадение\n" " --label=ЕТИКЕТ използване на ЕТИКЕТ като име за ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð¸Ñ " "вход\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching извеждане Ñамо на Ñъвпадението, а не Ñ†ÐµÐ»Ð¸Ñ Ñ€ÐµÐ´\n" " -q, --quiet, --silent нищо не Ñе извежда, Ñамо Ñе задава изходен код\n" " --binary-files=ВИД двоичните файлове да Ñе третират като такъв ВИД\n" " ВИДът може да „binary“ (двоичен), " "„text“ (текÑтов),\n" " или „without-match“ (без Ñъвпадение).\n" " -a, --text Ñъщото като „--binary-files=text“\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I Ñъщото като „--binary-files=without-match“\n" " -d, --directories=ДЕЙСТВИЕ\n" " ДЕЙСТВИЕ при директориите. То може да е:\n" " „read“ (изчитане), „recurse“ (рекурÑивно " "търÑене)\n" " или „skip“ (пропуÑкане)\n" " -D, --devices=ДЕЙСТВИЕ ДЕЙСТВИЕ за Ñпециалните файлове, програмните " "канали\n" " и гнездата. То може да е „read“ (изчитане) или\n" " „skip“ (пропуÑкане)\n" " -R, -r, --recursive Ñъщото като „--directories=recurse“\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=ШÐБЛОÐ_ЗÐ_ИМЕ\n" " търÑене Ñамо във файлове Ñ Ð¸Ð¼ÐµÐ½Ð°, напаÑващи\n" " ШÐБЛОÐа_ЗÐ_ИМЕ\n" " --exclude=ШÐБЛОÐ_ЗÐ_ИМЕ\n" " пропуÑкане на файлове Ñ Ð¸Ð¼ÐµÐ½Ð°, напаÑващи\n" " ШÐБЛОÐа_ЗÐ_ИМЕ\n" " --exclude-from=ФÐЙЛ пропуÑкане на файлове Ñ Ð¸Ð¼ÐµÐ½Ð°, напаÑващи на\n" " шаблоните в този ФÐЙЛ\n" " --exclude-dir=ШÐБЛОÐ_ЗÐ_ИМЕ\n" " пропуÑкане на директории Ñ Ð¸Ð¼ÐµÐ½Ð°, напаÑващи\n" " ШÐБЛОÐа_ЗÐ_ИМЕ\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match извеждане Ñамо на имената на файлове без " "ÑъвпадениÑ\n" " -l, --files-with-matches извеждане Ñамо на имената на файлове ÑÑŠÑ " "ÑъвпадениÑ\n" " -c, --count извеждане Ñамо на Ð±Ñ€Ð¾Ñ Ñъвпадащи редове във " "файл\n" " -T, --initial-tab подравнÑване на табулациите при необходимоÑÑ‚\n" " -Z, --null извеждане на знак NULL Ñлед вÑÑко име на файл\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Контрол върху контекÑта:\n" " -B, --before-context=БРОЙ извеждане на този БРОЙ предхождащи редове\n" " -A, --after-context=БРОЙ извеждане на този БРОЙ Ñледващи редове\n" " -C, --context=БРОЙ извеждане на този БРОЙ предхождащи и Ñледващи\n" " редове\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -БРОЙ Ñъщото като --context=БРОЙ\n" " --group-separator=РÐЗД\n" " извеждане на този РÐЗДелител на отделен ред " "между\n" " ÑъвпадениÑта Ñ ÐºÐ¾Ð½Ñ‚ÐµÐºÑÑ‚\n" " --no-group-separator без извеждане на този РÐЗДелител между " "ÑъвпадениÑта\n" " --color[=КОГÐ]\n" " --colour[=КОГÐ] оцветÑване на Ñъвпадащите низове. КОГРе " "„always“\n" " (винаги), „never“ (никога) или " "„auto“ (автоматично)\n" " -U, --binary знаците „CR“ в ÐºÑ€Ð°Ñ Ð½Ð° реда да Ñе запазват\n" " (DOS/Windows)\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Когато ФÐЙЛът е „-“ Ñе чете ÑтандартниÑÑ‚ вход. Без ФÐЙЛ Ñе чете текущата\n" "Ð´Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ð¸Ñ â€ž.“. Ðко Ñа зададени по-малко от два ФÐЙЛа, Ñе предполага „-h“.\n" "ИзходниÑÑ‚ код на grep е 0 при поне един напаÑнат ред и 1 във вÑички " "оÑтанали\n" "Ñлучаи. Ðко не е зададена опциÑта „-q“ и възникне грешка, изходниÑÑ‚ код е " "2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "зададените изрази за Ñъвпадение Ñа в конфликт" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "ЛипÑва поддръжка на шаблони по Perl — текущата команда е компилирана Ñ\n" "опциÑта „--disable-perl-regexp“." #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "неправилен израз „%s“" #: src/grep.c:2538 msgid "unknown devices method" msgstr "неизвеÑтен метод за обработка на Ñпециалните файлове" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "ПРЕДУПРЕЖДЕÐИЕ: опциÑта „--unix-byte-offsets“ („-u“) е оÑтарÑла" #: src/grep.c:2686 msgid "invalid max count" msgstr "неправилен макÑимален брой" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "непознат вид двоичен файл" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Създадено от Mike Haertel и др., вижте\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" "неуÑпешно заделÑне на памет за Ñтека за изпълнение на шаблоните за „PCRE“" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "опциÑта „-P“ изиÑква локалът да е Ñ ÐµÐ´Ð½Ð¾Ð±Ð°Ð¹Ñ‚Ð¾Ð²Ð¾ кодиране или UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "опциÑта „-P“ поддържа Ñамо един шаблон" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "вътрешна грешка, коÑто не трÑбва да възниква — молим да Ñ Ð´Ð¾ÐºÐ»Ð°Ð´Ð²Ð°Ñ‚Ðµ" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "макÑималниÑÑ‚ размер на реда за „PCRE“ е превишен" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: паметта е изчерпана" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: паметта за Ñтека за изпълнение на шаблоните за „PCRE“ Ñвърши" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: макÑималниÑÑ‚ брой Ð²Ñ€ÑŠÑ‰Ð°Ð½Ð¸Ñ Ð¿Ñ€Ð¸ рекурÑÐ¸Ñ Ð½Ð° „PCRE“ е превишен" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: превишен е макÑимумът за рекурÑÐ¸Ñ Ð½Ð° „PCRE“" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: вътрешна грешка на „PCRE“: %d" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/fi.po�����������������������������������������������������������������������0000664�0001750�0001750�00000103331�14670377450�016024� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Finnish translation for GNU grep. # Copyright © 2002, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Sami J. Laine <sami.laine@iki.fi>, 2002. # Jorma Karvonen <karvonen.jorma@gmail.com>, 2007-2016, 2018. # Lauri Nurmi <lanurmi@iki.fi>, 2019-2021. # msgid "" msgstr "" "Project-Id-Version: grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 10:37+0300\n" "Last-Translator: Lauri Nurmi <lanurmi@iki.fi>\n" "Language-Team: Finnish <translation-team-fi@lists.sourceforge.net>\n" "Language: fi\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 3.0\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "virheellinen argumentti %s kohteelle %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "monimerkityksellinen argumentti %s kohteelle %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Kelvolliset argumentit ovat:" #: lib/c-stack.c:187 msgid "program error" msgstr "ohjelmavirhe" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "pinon ylivuoto" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "kirjoitusvirhe" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "pariton [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "virheellinen merkkiluokka" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "merkkiluokkasyntaksi on [[:space:]], ei [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "keskeneräinen \\-ohjaussarja" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "virheellinen \\{\\}:n sisältö" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "säännöllinen lauseke on liian suuri" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "pariton (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "syntaksia ei ole määritelty" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "pariton )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Tuntematon järjestelmävirhe" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: valitsin â€%s%s†on moniselitteinen\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: valitsin â€%s%s†on moniselitteinen; vaihtoehdot:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: tunnistamaton valitsin â€%s%sâ€\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: valitsin â€%s%s†ei salli argumenttia\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: valitsin â€%s%s†vaatii argumentin\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: virheellinen valitsin -- â€%câ€\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: valitsin vaatii argumentin -- â€%câ€\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "muisti loppui" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "nykyisen työhakemiston kirjaaminen ei onnistu" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "palaaminen alkuperäiseen työhakemistoon epäonnistui" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "tiedostokahvan teksti-/binääritilan asettaminen epäonnistui" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "â€" #: lib/quotearg.c:356 msgid "'" msgstr "â€" #: lib/regcomp.c:135 msgid "Success" msgstr "Onnistui" #: lib/regcomp.c:138 msgid "No match" msgstr "Ei täsmäävyyttä" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Virheellinen säännöllinen lauseke" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Virheellinen vertailumerkki" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Virheellinen merkkiluokan nimi" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Kenoviiva lopussa" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Virheellinen takaisinviittaus" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Pariton [, [^, [:, [. tai [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Pariton ( tai \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Pariton \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Virheellinen \\{\\}:n sisältö" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Virheellinen välin loppu" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Muisti loppui" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Virheellinen edeltävä säännöllinen lauseke" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Ennenaikainen säännöllisen lausekkeen loppu" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Säännöllinen lauseke on liian suuri" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Pariton ) tai \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Ei edeltävää säännöllistä lauseketta" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Paketoinut %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Paketoinut %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Lisenssi GPLv3+: GNU GPL versio 3 tai myöhäisempi <%s>.\n" "Tämä on vapaa ohjelma: voit vapaasti muuttaa ja jakaa sitä edelleen.\n" "Ohjelmalla EI OLE TAKUUTA siinä laajuudessa kuin laki sen sallii.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Kirjoittanut %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Kirjoittaneet %s ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Kirjoittaneet %s, %s ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Kirjoittaneet %s, %s,\n" "%s ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Kirjoittaneet %s, %s, %s,\n" "%s ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Kirjoittaneet %s, %s, %s,\n" "%s, %s ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Kirjoittaneet %s, %s, %s,\n" "%s, %s, %s ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Kirjoittaneet %s, %s,\n" "%s, %s, %s, %s,\n" "%s ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Kirjoittaneet %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Kirjoittaneet %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, %s ja muut.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Ilmoita ohjelmistovioista (englanniksi) osoitteeseen: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Ilmoita %s ohjelmistovioista (englanniksi) osoitteeseen %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s -kotisivu: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Yleisohjeita GNU-ohjelmistojen käyttöön: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(vakiosyöte)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "virheellinen kontekstin pituusargumentti" #: src/grep.c:894 msgid "input is too large to count" msgstr "syöte on liian suuri laskettavaksi" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: binääritiedosto täsmää" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: varoitus: rekursiivinen hakemistosilmukka" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: syötetiedosto on myös tuotostiedosto" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Käyttö: %s [VALITSIN]... HAHMOT [TIEDOSTO]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Komento â€%s --help†antaa lisää tietoa.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Hae HAHMOja kustakin TIEDOSTOsta.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Esimerkki: %s -i 'hei maailma' menu.h main.c\n" "HAHMOT voivat sisältää useita rivinvaihdoin\n" "eroteltuja hahmoja.\n" "\n" "Hahmojen valinta ja tulkinta:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp HAHMOT ovat laajennettuja säännöllisiä\n" " lausekkeita\n" " -F, --fixed-strings HAHMOT ovat merkkijonoja\n" " -G, --basic-regexp HAHMOT ovat tavallisia säännöllisiä\n" " lausekkeita (oletus)\n" " -P, --perl-regexp HAHMOT ovat Perl-tyyppisiä säännöllisiä\n" " lausekkeita\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=HAHMOT käytä HAHMOja täsmäämiseen\n" " -f, --file=TIEDOSTO ota HAHMOT TIEDOSTOsta\n" " -i, --ignore-case älä erottele pieniä ja suuria kirjaimia\n" " hahmoissa eikä datassa\n" " -w, --word-regexp täsmää vain kokonaisiin sanoihin\n" " -x, --line-regexp täsmää vain kokonaisiin riveihin\n" " -z, --null-data datarivi päättyy 0-tavuun, ei rivinvaihtoon\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Sekalaista:\n" " -s, --no-messages vaienna virheilmoitukset\n" " -v, --invert-match valitse täsmäämättömät rivit\n" " -V, --version näytä versiotiedot ja poistu\n" " --help näytä tämä ohje ja poistu\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Tulostehallinta:\n" " -m, --max-count=MÄÄRÄ pysäytä MÄÄRÄn täsmäävän rivin jälkeen\n" " -b, --byte-offset tulosta tavusiirros tulosteriveille\n" " -n, --line-number tulosta rivinumero tulosteriveille\n" " --line-buffered huuhtele tuloste joka rivillä\n" " -H, --with-filename tulosta tiedostonimi tulosteriveille\n" " -h, --no-filename vaienna tiedostonimet tulosteesta\n" " --label=NIMIÖ tulosta NIMIÖ tiedostonimenä vakiosyötteelle\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching näytä vain täsmäävien rivien epätyhjät osat\n" " -q, --quiet, --silent vaienna kaikki normaali tuloste\n" " --binary-files=TYYPPI otaksu, että binääritiedostot ovat TYYPPIä;\n" " TYYPPI on â€binaryâ€, â€textâ€, tai â€without-matchâ€\n" " -a, --text sama kuin --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I sama kuin --binary-files=without-match\n" " -d, --directories=TEKO kuinka käsitellä hakemistoja;\n" " TEKO on â€readâ€, â€recurseâ€, tai â€skipâ€\n" " -D, --devices=TEKO kuinka käsitellä laitteita, FIFOja ja " "pistokkeita;\n" " TEKO on â€read†tai â€skipâ€\n" " -r, --recursive sama kuin --directories=recurse\n" " -R, --dereference-recursive samoin, mutta seuraa kaikkia symlinkkejä\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB etsi vain GLOBiin (tiedostohahmo) täsmäävistä\n" " tiedostoista\n" " --exclude=GLOB ohita GLOBiin täsmäävät tiedostot ja hakemistot\n" " --exclude-from=TIED ohita mihin tahansa TIEDoston tiedostohahmoon\n" " täsmäävät tiedostot\n" " --exclude-dir=GLOB ohita GLOBiin täsmäävät hakemistot\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match tulosta vain TIEDOSTOjen nimet, joissa ei yhtään " "valittua riviä\n" " -l, --files-with-matches tulosta vain TIEDOSTOjen nimet, joissa on " "valittuja rivejä\n" " -c, --count tulosta vain valittujen rivien lukumäärä " "TIEDOSTOa kohden\n" " -T, --initial-tab kohdista sarkaimet (jos tarpeellista)\n" " -Z, --null tulosta 0-tavu TIEDOSTOnimen jälkeen\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Kontekstin hallinta:\n" " -B, --before-context=N tulosta N riviä edeltävää konteksia\n" " -A, --after-context=N tulosta N riviä seuraavaa kontekstia\n" " -C, --context=N tulosta N riviä tulostekonteksia\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -MÄÄRÄ sama kuin --context=MÄÄRÄ\n" " --group-separator=EROT tulosta EROTin kontekstillisten täsmäävyyksien\n" " välisille riveille\n" " --no-group-separator älä tulosta erotinta kontekstillisille\n" " täsmäävyyksille\n" " --color[=KUN],\n" " --colour[=KUN] korosta täsmäävyydet väreillä;\n" " KUN voi olla â€always†(aina), â€neverâ€\n" " (ei koskaan) tai â€autoâ€.\n" " -U, --binary jätä CR-merkit rivien loppuun (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Kun TIEDOSTO on â€-â€, lue vakiosyötettä. Ilman TIEDOSTOa lue â€.†jos\n" "haetaan rekursiivisesti, muuten â€-†. Jos alle kaksi TIEDOSTOa\n" "on annettu, oleta valitsin -h.\n" "Paluuarvo on 0, jos mikä tahansa rivi valitaan, muuten 1; jos\n" "tapahtuu mikä tahansa virhe ja -q on antamatta, paluuarvo on 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "määritelty ristiriitaiset täsmäimet" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Perl-täsmäystä ei tueta --disable-perl-regexp -valitsimellisessa käännöksessä" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "virheellinen täsmäin %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "tuntematon laitteiden käsittelytapa" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "varoitus: --unix-byte-offsets (-u) on vanhentunut" #: src/grep.c:2686 msgid "invalid max count" msgstr "virheellinen enimmäismäärä" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "tuntematon binääritiedostojen tyyppi" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Kirjoittaneet Mike Haertel ja muut; ks.\n" "<http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "muistin varaaminen PCRE JIT -pinolle epäonnistui" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P tukee vain yksitavu- ja UTF-8-maa-asetustoja" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "valitsin -P tukee vain yhtä hahmoa" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "sisäinen virhe (ei pitäisi koskaan tapahtua)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "ylitettiin PCRE:n rivipituusraja" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: muisti loppui" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: PCRE JIT -pino täyttyi" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: ylitettiin PCRE:n paluujäljitysraja" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: ylitettiin PCRE:n rekursioraja" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: sisäinen PCRE-virhe: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "varoitus: GREP_OPTIONS on vanhentunut; käytä aliasta tai skriptiä" #~ msgid "warning: %s: %s" #~ msgstr "varoitus: %s: %s" #~ msgid "Binary file %s matches\n" #~ msgstr "Binääritiedosto %s täsmää\n" #~ msgid "%s home page: <http://www.gnu.org/software/%s/>\n" #~ msgstr "%s kotisivu: <http://www.gnu.org/software/%s/>\n" # Ensimmäinen parametri on valitsimen väliviivat, toinen valitsin, kolmas argumentti #~ msgid "invalid %s%s argument '%s'" #~ msgstr "virheellinen valitsimen %s%s argumentti ’%s’" # Ensimmäinen parametri on valitsimen väliviivat, toinen valitsin ja kolmas sen argumentti #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "virheellinen loppuliite valitsimen %s%s argumentissa ’%s’" # Ensimmäinen parametri on valitsimen väliviivat, toinen valitsin ja kolmas sen argumentti #~ msgid "%s%s argument '%s' too large" #~ msgstr "valitsimen %s%s argumentti ’%s’ on liian iso" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "sisäinen virhe" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: valitsin ’--%s’ ei salli argumenttia\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: tuntematon valitsin ’--%s’\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: valitsin ’-W %s’ ei ole yksiselitteinen\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: valitsin ’-W %s’ ei salli argumenttia\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: valitsin ’-W %s’ tarvitsee argumentin\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "HAKULAUSEKE on oletuksena perussäännöllinen lauseke (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "Käsky ’egrep’ tarkoittaa ’grep -E’. Käsky ’fgrep’ tarkoittaa ’grep -F’.\n" #~ "Suora kutsuminen ’egrep’- ja ’fgrep’-käskyillä ei ole enää " #~ "suositeltavaa.\n" #~ msgid "lseek failed" #~ msgstr "lseek epäonnistui" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "GNU Grep-kotisivu: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "virheellinen UTF-8-tavusekvenssi syötteessä" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "HAKULAUSEKE on laajennettu säännöllinen lauseke (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "" #~ "Kutsuminen ’egrep’ käskyllä ei ole enää suositeltavaa, käytä sen sijaan " #~ "käskyä ’grep -E’.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "HAKULAUSEKE on rivinvaihdolla eroteltu kiinteä merkkijonojoukko.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "" #~ "Kutsuminen ’fgrep’ käskyllä ei ole enää suositeltavaa, käytä sen sijaan " #~ "käskyä ’grep -F’.\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s voi käyttää vain %s hakulausekesyntaksia" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "valitsin --mmap ei ole toiminut vuoden 2010 jälkeen" #~ msgid "unfinished repeat count" #~ msgstr "päättymätön toistomäärä" #~ msgid "malformed repeat count" #~ msgstr "virheellinen toistomäärä" # Tämä liittyy virheilmoitukseen, jossa alussa on ilmeisesti virhenumero #~ msgid "writing output" #~ msgstr "kirjoitettaessa tulostetta" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "kohteessa GREP_COLORS=â€%sâ€, â€%sâ€-kapasiteetti tarvitsee arvon (â€=...â€); " #~ "jätettiin väliin" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "kohteessa GREP_COLORS=â€%sâ€, â€%sâ€-kapasiteetti on boolean-tyyppinen ja se " #~ "ei voi saada arvoa (â€=%sâ€); jätettiin väliin" #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "kohteessa GREP_COLORS=â€%sâ€, â€%sâ€-kapasiteetti %s" #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "pysäytettiin vääränmuotoisen kohteen GREP_COLORS=â€%s†prosessointi " #~ "jäljelle jäävässä osamerkkijonossa â€%sâ€" #~ msgid "unknown directories method" #~ msgstr "tuntematon hakemistometodi" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Tulosteen hallinta:\n" #~ " -m, --max-count=N lopeta kun N täsmäystä on löytynyt\n" #~ " -b, --byte-offset tulosta tavuosoite tulosteriveille\n" #~ " -n, --line-number tulosta rivinumero tulosteriveille\n" #~ " --line-buffered tyhjennä puskuri jokaisella tulosterivillä\n" #~ " -H, --with-filename tulosta tiedostonimi jokaiselle täsmäykselle\n" #~ " -h, --no-filename vaienna tiedostonimen tulostaminen\n" #~ " --label=OTSIKKO tulosta OTSIKKO tiedostonimenä luettaessa\n" #~ " vakiosyöttettä\n" #~ " -o, --only-matching näytä vain HAKULAUSEKE-täsmäävä osa rivistä\n" #~ " -q, --quiet, --silent vaienna kaikki normaalit tulosteet\n" #~ " --binary-files=TYYPPI oleta binääristen tiedostojen olevan TYYPPIä\n" #~ " TYYPPI on â€binary†(binääri), " #~ "â€text†(teksti), tai\n" #~ " â€without-match†(täsmäämätön)\n" #~ " -a, --text sama kuin --binary-files=â€text†(teksti)\n" #~ " -I sama kuin --binary-files=â€without-" #~ "match†(täsmäämätön)\n" #~ " -d, --directories=TOIMI hakemistojen käsittelytapa\n" #~ " TOIMI on â€read†(lue), â€recurse†(itseensä " #~ "palautuva),\n" #~ " tai â€skip†(jätä väliin)\n" #~ " -D, --devices=TOIMI laitetiedostojen, FIFOjen ja pistokkeiden " #~ "käsittely\n" #~ " TOIMI on â€read†(lue) tai â€skip†(jätä " #~ "väliin)\n" #~ " -R, -r, --recursive sama kuin --directories=recurse\n" #~ " --include=TIEDOSTOKAAVA TIEDOSTOKAAVA-täsmäävät tiedostot " #~ "tutkitaan\n" #~ " --exclude=TIEDOSTOKAAVA TIEDOSTOKAAVA-täsmäävät tiedostot jätetään " #~ "tutkimatta\n" #~ " --exclude-from=TIEDOSTO TIEDOSTOKAAVA-täsmäävät tiedostot, joiden " #~ "nimet\n" #~ " luetaan TIEDOSTOsta, jätetään tutkimatta\n" #~ " -L, --files-without-match tulosta vain TIEDOSTOt, joista ei löydy " #~ "täsmäystä\n" #~ " -l, --files-with-matches tulosta vain TIEDOSTOt, joista löytyy " #~ "täsmäys\n" #~ " -c, --count tulosta vain täsmäysten määrä TIEDOSTOlle\n" #~ " -T, --initial-tab tee sarkaimet riveittäin (jos tarvitaan)\n" #~ " -Z, --null tulosta nollatavu TIEDOSTO-nimen jälkeen\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Valitsimia â€-P†ja â€-z†ei voida käyttää samanaikaisesti" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: epäkelpo valitsin -- %c\n" #~ msgid "Copyright (C) 2010 Free Software Foundation, Inc.\n" #~ msgstr "Copyright © 2010 Free Software Foundation, Inc.\n" #~ msgid "`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" #~ msgstr "â€egrep†tarkoittaa â€grep -Eâ€. â€fgrep†tarkoittaa â€grep -Fâ€.\n" #~ msgid "Direct invocation as either `egrep' or `fgrep' is deprecated.\n" #~ msgstr "" #~ "Suora kutsuminen joko komennolla â€egrep†tai â€fgrep†on vanhentunut.\n" #~ msgid "" #~ "\n" #~ "Miscellaneous:\n" #~ " -s, --no-messages suppress error messages\n" #~ " -v, --invert-match select non-matching lines\n" #~ " -V, --version print version information and exit\n" #~ " --help display this help and exit\n" #~ "\n" #~ msgstr "" #~ "\n" #~ "Sekalaista:\n" #~ " -s, --no-messages vaienna virheilmoitukset\n" #~ " -v, --invert-match valitse hakuun täsmäämättömät rivit\n" #~ " -V, --version tulosta versiotiedot ja poistu\n" #~ " --help tulosta tämä ohje ja poistu\n" #~ "\n" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/eu.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000002376�14670377471�016215� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•���� ������„������ì�������0�����1�����3�����D�����U�����j�����l�����‹�����§�����Ç�����Ù�����ê�������½�������Ù�����Û�����ð������������(��������H��+���g�� ���“�����´��!���Å�����ç�������� �������������������� ������� ������ ��� ��������������'�(standard input)�Memory exhausted�Unknown system error�`�conflicting matchers specified�input is too large to count�invalid context length argument�invalid max count�memory exhausted�unknown binary-files type�unknown devices method�Project-Id-Version: grep 2.5.1a Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2005-03-03 21:40+0100 Last-Translator: Mikel Olasagasti <hey_neken@mundurat.net> Language-Team: Basque <translation-team-eu@lists.sourceforge.net> Language: eu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=2; plural=(n == 1) �'�(sarrera estandarra)�Memoria agortuta�Sistemaren errore ezezaguna�`�espresio konfliktiboak espezifikatu dira�sarrera luzeegia da kontatzeko�balio gabeko testuinguru luzeera argumentua�baliogabeko gehienezko zenbaketa�memoria agortuta�fitxategi-binario moeta ezezaguna�gailu metodo ezezaguna�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/pt_BR.gmo�������������������������������������������������������������������0000664�0001750�0001750�00000040167�14670377471�016612� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����g������T��‰���Œ������°��Ï���±��÷��� ��Õ��y ����O ��ü���` ��¶��]��U����¤��j��F�������V�����j��&���‚��#���©�����Í��!���ê����� �����(�����D��,���Y�����†��.���¦��'���Õ��(���ý�����&��%���F�����l�����n�����r��*���ƒ�����®��&���?�����f�����}�����š�����¶��$���Î�����ó�������ª��� �����Ë�����Ü�����å������������<���)��#���f�����Š�����¥�����¼��"���Ð�����ó�����û��&��������5�����J�����\�����n�� �����)���š�����Ä��ù���Ù�����Ó��;���ê��3���&��/���Z��+���Š��'���¶��#���Þ����������"�����>��\���N�����«�����­��4���Ê�����ÿ��!�����0���@��-���q��.���Ÿ�����Î��$���ê����������*�����B�����Z�����z����������Ÿ�����°�� ���Ä�����Ò�����í��,���ü��*���) �� ���T �� ���a �� ���n �����{ ����� �����© �� ���À ��ò��Ì ��é���¿"����©#����­$��Y��°&�� �� (��5��)��æ��K+��L��2-��è��/�����h1��+���~1��-���ª1��*���Ø1�����2��/��� 2�����P2��#���m2�����‘2��,���§2��!���Ô2��1���ö2��)���(3��)���R3��%���|3��+���¢3�����Î3�����Ð3�����Ô3��L���æ3��—���34��,���Ë4�����ø4��)���5�����>5�����]5��*���y5�����¤5�����¿5��¾���Ü5�����›6�����­6��#���Ì6�����ð6�����7��[���7��#���w7�� ���›7��#���¼7�����à7��$���þ7�����#8��"���+8��1���N8�����€8�����8�����¸8��-���Ó8�����9��+���9�����C9��9��`9�����š:��9���°:��1���ê:��-���;��)���J;��%���t;��!���š;�����¼;�����Ú;�����ô;��Z���<�����`<��$���b<��E���‡<��-���Í<��1���û<��2���-=��4���`=��?���•=�� ���Õ=��&���ö=��&���>��!���D>�����f>��0���‚>�����³>�����Ë>�����ã>�����õ>�����?�� ���#?�����D?��;���U?��3���‘?�����Å?�����Ú?�����ï?�����@��%���@��$���B@�����g@�����d���;���<���8������� ���4���)������*����������O������D�����������]���C���\���S���%���/��� ���L���2���,�����������_���>���H������U������Z������������������G����������������X����������=��������������`���^���N���J������6���?���M���R�������F���T���$���������������������7�����������������K���0�������P���9���#�����������3���������!���c���.��� ������E���W���e����������:���A���5���(��� ������ �������@�����������Y���"���a���-���f������ ���+������1���Q�������������g���'���V�����������b���I���&�������B�������������������[���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: GNU grep-3.5.16 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2020-11-04 09:30-0300 Last-Translator: Rodolfo Ribeiro Gomes <rodolforg@gmail.com> Language-Team: Brazilian Portuguese <ldpbr-translation@lists.sourceforge.net> Language: pt_BR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=2; plural=(n > 1); X-Generator: Gtranslator 3.38.0 � Controle de contexto: -B, --before-context=NÚM emite NÚM linhas de contexto anteriores -A, --after-context=NÚM emite NÚM linhas de contexto posteriores -C, --context=NÚM emite NÚM linhas de contexto de saída � Miscelânea: -s, --no-messages suprime mensagens de erro -v, --invert-match seleciona somente linhas não coincidentes -V, --version mostra informações sobre versão e sai --help exibe esta ajuda e sai � Controle de saída: -m, --max-count=NÚM interrompe depois de NÚM ocorrências -b, --byte-offset emite a posição em bytes nas linhas de saída -n, --line-number emite o número da linha nas linhas de saída --line-buffered libera a saída a cada linha -H, --with-filename emite o nome do arquivo nas linhas de saída -h, --no-filename inibe o nome de arquivo na saída --label=RÓTULO usa RÓTULO como nome de arquivo para entrada padrão � --include=PADRÃO busca apenas em arquivos que casam com PADRÃO --exclude=PADRÃO ignora arquivos que casam com PADRÃO --exclude-from=ARQUI ignora arquivos que casam com algum padrão de arquivo contido em ARQUIvo --exclude-dir=PADRÃO ignora diretórios que casam com PADRÃO � -E, --extended-regexp PADRÕES são expressões regulares estendidas -F, --fixed-strings PADRÕES são textos -G, --basic-regexp PADRÕES são expressões regulares básicas -P, --perl-regexp PADRÕES são expressões regulares Perl � -I equivalente a --binary-files=without-match -d, --directories=AÇÃO como tratar diretórios; AÇÃO pode ser \"read\" (ler), \"recurse\" (recursivo), ou \"skip\" (ignorar) -D, --devices=AÇÃO como tratar dispositivos, FIFOs e soquetes; AÇÃO pode ser \"read\" (ler) ou \"skip\" (ignorar) -r, --recursive equivalente a --directories=recurse -R, --dereference-recursive similar, mas segue todas as ligações simbólicas � -L, --files-without-match emite apenas os nomes dos ARQUIVOs sem linhas selecionadas -l, --files-with-matches emite apenas os nomes dos ARQUIVOs com linhas selecionadas -c, --count emite apenas a contagem de linhas selecionadas por ARQUIVO -T, --initial-tab alinha por tabulação (se necessário) -Z, --null emite byte 0 depois do nome do ARQUIVO � -e, --regexp=PADRÕES usa PADRÕES para coincidir -f, --file=ARQUIVO obtém PADRÕES contidos no ARQUIVO -i, --ignore-case ignora diferenças entre maiúsculas/minúsculas nos padrões e dados --no-ignore-case não ignora diferença de maiusculizações (padrão) -w, --word-regexp coincide só com palavras completas -x, --line-regexp coincide só com linhas inteiras -z, --null-data uma linha de dados termina com byte 0, e não com caractere de nova linha � -o, --only-matching mostra apenas as partes não-vazias das linhas que coincidem com os PADRÕES -q, --quiet, --silent inibe todas as mensagens normais de saída --binary-files=TIPO assume que arquivos binários são TIPO; TIPO pode ser \"binary\" (binário), \"text\" (texto), ou \"without-match\" (nunca coincide) -a, --text equivalente a --binary-files=text �paÌgina de %s: <%s> �%s: arquivo binário coincide com o padrão�%s: atingiu o limite de backtracking das PCRE�%s: atingiu o limite de recursão das PCRE�%s: pilha PCRE JIT estourada�%s: o arquivo de entrada também é o de saída�%s: erro interno de PCRE: %d�%s: a opção é inválida -- "%c" �%s: memória esgotada�%s: a opção "%s%s" não aceita argumentos �%s: a opção "%s%s" é ambígua �%s: a opção "%s%s" é ambígua; possibilidades:�%s: a opção "%s%s" requer um argumento �%s: a opção exige um argumento -- "%c" �%s: a opção "%s%s" é desconhecida �%s: aviso: recursão cíclica de diretório�"�(C)�(entrada padrão)�-P só oferece suporte a localidades unibyte (um caractere por byte) e UTF-8�Exemplo: %s -i "olá, mundo" menu.h main.c PADRÕES pode conter múltiplos padrões separados por nova-linha. Seleção e interpretação de padrão: �Ajuda geral sobre uso de software GNU: <%s> �Retro-referência inválida�Nome inválido de categoria de caracteres�Caractere inválido de colagem�Conteúdo inválido de \{\}�Expressão regular precedente é inválida�Fim inválido de intervalo�Expressão regular inválida�Licença GPLv3+: GNU GPL versão 3 ou superior <%s>. Este é um software livre: você é livre para alterá-lo e redistribuí-lo. NÃO Hà GARANTIAS, na máxima extensão permitida por lei. �Memória esgotada�Nenhuma ocorrência do padrão�Nenhuma expressão regular anterior�Empacotado por %s �Empacotado por %s (%s) �não há suporte para coincidir conforme Perl em uma compilação com --disable-perl-regexp�Fim prematuro da expressão regular�Expressão regular grande demais�Relate os problemas de %s para: %s �Relate os problemas para: %s �Busca por PADRÕES em cada ARQUIVO. �Sucesso�Barra invertida excedente ao final�Experimente "%s --help" para mais informações. �Erro desconhecido de sistema�( ou \( sem correspondente�) ou \) sem correspondente�Sem correspondência para [, [^, [:, [. ou [=�\{ sem correspondente�Uso: %s [OPÇÃO]... PADRÕES [ARQUIVO]... �Os argumentos válidos são:�Quando ARQUIVO é "-", lê da entrada padrão. Se ARQUIVO não é informado, lê "." se recursivo, senão lê "-". Se há menos que dois ARQUIVOs, assume-se -h. O estado de saída é 0 se alguma linha é selecionada, 1 em caso contrário; se ocorrer algum erro e -q não é especificado, o estado de saída é 2. �Escrito por %s e %s. �Escrito por %s, %s, %s, %s, %s, %s, %s, %s, %s e outros. �Escrito por %s, %s, %s, %s, %s, %s, %s, %s e %s. �Escrito por %s, %s, %s, %s, %s, %s, %s e %s. �Escrito por %s, %s, %s, %s, %s, %s e %s. �Escrito por %s, %s, %s, %s, %s e %s. �Escrito por %s, %s, %s, %s e %s. �Escrito por %s, %s, %s e %s. �Escrito por %s, %s e %s. �Escrito por %s. �Escrito por Mike Haertel e outros; veja <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>�"�%s eÌ um argumento ambíguo para %s�a sintaxe de categoria de caracteres é [[:space:]], e não [:space:]�especificou-se padrões de busca conflitantes�atingiu o limite de comprimento de linha das PCRE�falhou em alocar memória para a pilha de PCRE JIT�falhou em retornar ao diretório de trabalho inicial�falhou em definir o modo texto/binário do descritor de arquivo�entrada longa demais para contar�erro interno (nunca deveria acontecer)�%s eÌ um argumento invaÌlido para %s�categoria de caracteres inválida�conteúdo inválido de \{\}�argumento inválido para comprimento do contexto�comparador inválido %s�valor máximo inválido�memória esgotada�nenhuma sintaxe especificada�erro do programa�expressão regular grande demais�estouro de pilha�a opção -P só oferece suporte a apenas um único padrão�incapaz de memorizar o diretório de trabalho atual�( sem correspondente�) sem correspondente�[ sem correspondente�escape \ não terminado�tipo de arquivo binário desconhecido�método desconhecido de dispositivos�erro de escrita����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/ky.po�����������������������������������������������������������������������0000664�0001750�0001750�00000075230�14670377450�016057� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Translation of grep-2.5.3 messages to Kirghiz/Kyrgyz # Copyright (C) 2007 Free Software Foundation, Inc. # This file is distributed under the same license as the GREP package. # Azilet Beishenaliev <aziletb@gmail.com>, 2007. # msgid "" msgstr "" "Project-Id-Version: grep 2.5.3\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2007-09-01 17:27+0100\n" "Last-Translator: Azilet Beishenaliev <aziletb@gmail.com>\n" "Language-Team: Kirghiz <i18n-team-ky-kyrgyz@lists.sourceforge.net>\n" "Language: ky\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Poedit-Language: Kyrgyz\n" "X-Poedit-Country: KYRGYZSTAN\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "" #: lib/dfa.c:896 #, fuzzy msgid "unbalanced [" msgstr "[ - мунун уйкашы жок" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" # escape - кыргызча??? #: lib/dfa.c:1210 #, fuzzy msgid "unfinished \\ escape" msgstr "Бүтпөй калган ÑÑкейп \\" #: lib/dfa.c:1371 #, fuzzy msgid "invalid content of \\{\\}" msgstr "макÑимум Ñан жарабайт" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "" #: lib/dfa.c:1858 #, fuzzy msgid "unbalanced (" msgstr "( - мунун уйкашы жок" # кайÑÑ‹ ÑинтакÑиÑ? грептин шаблонубу? #: lib/dfa.c:1975 #, fuzzy msgid "no syntax specified" msgstr "СинтакÑÐ¸Ñ Ð°Ñ‚Ð°Ð»Ð³Ð°Ð½ жок" #: lib/dfa.c:1986 #, fuzzy msgid "unbalanced )" msgstr ") - мунун уйкашы жок" #: lib/error.c:195 msgid "Unknown system error" msgstr "БелгиÑиз ÑиÑтема катаÑÑ‹" #: lib/getopt.c:278 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: `%s' опциÑÑÑ‹ так ÑмеÑ\n" #: lib/getopt.c:284 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: `%s' опциÑÑÑ‹ так ÑмеÑ\n" #: lib/getopt.c:319 #, fuzzy, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: бул Ð¾Ð¿Ñ†Ð¸Ñ Ñ‚Ò¯ÑˆÒ¯Ð½Ò¯ÐºÑүз `%c%s'\n" #: lib/getopt.c:345 #, fuzzy, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: `%c%s' опциÑÑÑ‹ менен аргумент колдонулбайт\n" #: lib/getopt.c:360 #, fuzzy, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: `%s' опциÑÑÑ‹ менен аргумент болуш керек\n" #: lib/getopt.c:621 #, fuzzy, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: жаракÑыз Ð¾Ð¿Ñ†Ð¸Ñ -- %c\n" #: lib/getopt.c:636 lib/getopt.c:682 #, fuzzy, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: бул опциÑнын аргументи болуш керек -- %c\n" # ПамÑтты Ñмне дейбиз ÑÑ? ;) #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "памÑть жетпей калды" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "\"" #: lib/quotearg.c:356 msgid "'" msgstr "\"" #: lib/regcomp.c:135 msgid "Success" msgstr "" #: lib/regcomp.c:138 msgid "No match" msgstr "" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "" # ПамÑтты Ñмне дейбиз ÑÑ? ;) #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "ПамÑть жетпей калды" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "Каталарды бул жерге жибергиле <%s>.\n" #: lib/version-etc.c:251 #, fuzzy, c-format msgid "Report %s bugs to: %s\n" msgstr "" "\n" "Каталарды бул жерге жибергиле <%s>.\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "" #: src/grep.c:649 msgid "(standard input)" msgstr "(Ñтандарт кирүү)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "контекÑÑ‚ узундугу жарабайт" #: src/grep.c:894 msgid "input is too large to count" msgstr "берилген данныйлардын Ñаны Ñаналбай турганча көп" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Экилик форматтагы %s файлы уйкашат\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "бирибирине кирген папка айлампаÑÑ‹ бар" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Колдонулушу: %s [ОПЦИЯ]... ШÐБЛОР[ФÐЙЛ]...\n" #: src/grep.c:1963 #, fuzzy, c-format msgid "Try '%s --help' for more information.\n" msgstr "Толук маалымат үчүн `%s --help' деп жазгыла.\n" #: src/grep.c:1969 #, fuzzy, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "ÐÑ€ ФÐЙЛда же Ñтандарт кирүүдө ШÐБЛОÐду изде.\n" # выражение дегендин кыргызчаÑын жазыш керек #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "МиÑалы: %s -i 'Ñалам дүйнө' menu.h main.c\n" "\n" "РегулÑрдуу выражение тандоо жана мааниÑи:\n" # выражение - кыргызчаÑын жаз!!!! #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp ШÐБЛОРкеңейтилген түрдөгү регулÑрдуу выражение\n" " -F, --fixed-strings ШÐБЛОРар Ñапта бир Ñөз болгон жыйын\n" " -G, --basic-regexp ШÐБЛОРнегизги түрдөгү регулÑрдуу выражение\n" " -P, --perl-regexp ШÐБЛОРPerl түрүндөгү регулÑрдуу выражение\n" # выражение!!!! #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=ШÐБЛОРШÐБЛОÐду регулÑрдуу выражение катары колдон\n" " -f, --file=ФÐЙЛ ШÐБЛОРФÐЙЛдан алынат\n" " -i, --ignore-case тамгалардын чоң-кичинеÑи айырмаланбайт\n" " -w, --word-regexp ШÐБЛОРтолук Ñөздөр менен гана уйкаштырылат\n" " -x, --line-regexp ШÐБЛОРтолук Ñап менен гана уйкаштырылат\n" " -z, --null-data дата(данный) Ñаптары 0 байты(EOL ÑмеÑ) менен " "бүтөт\n" #: src/grep.c:1989 #, fuzzy, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Түрдүү:\n" " -s, --no-messages каталарды көрÑөтпөйт\n" " -v, --invert-match уйкашы болбогон Ñаптар тандалат\n" " -V, --version верÑÐ¸Ñ Ð¼Ð°Ð°Ð»Ñ‹Ð¼Ð°Ñ‚Ñ‹Ð½ көрÑөтүп бүтүрөт\n" " --help бул жардам маалыматын көрÑөтүп бүтүрөт\n" " --mmap мүмкүнчүлүк болÑо mmap кирүүÑÒ¯ колдонулат\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" "\n" "КонтекÑти менен жыйынтык чыгаруу:\n" " -B, --before-context=N уйкаш болгон Ñаптан мурунку N Ñап да көрÑөтүлөт\n" " -A, --after-context=N уйкаш болгон Ñаптан кийинки N Ñап да көрÑөтүлөт\n" " -C, --context=N уйкаш болгон Ñаптан мурунку жана кийинки N Ñап " "да көрÑөтүлөт\n" " -N --context=NUM менен бирдей\n" " --color[=УЧУР],\n" " --colour[=УЧУР] уйкаш Ñөз кайÑÑ‹ учурда айырмаландырылат\n" " УЧУР - `always'(ардайым), `never'(Ñч качан) же " "`auto'(авто) боло алат.\n" " -U, --binary катар Ñоңунда (EOL) CR тамгаÑÑ‹ алынбайт (MSDOS)\n" " -u, --unix-byte-offsets орундарды CR жок болгондой кылып көрÑөтөт " "(MSDOS)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "ФÐЙЛ жазылбаÑа же ФÐЙЛ - (тире) болÑо, Ñтандарт кирүү колдонулат. Экиден аз " "ФÐЙЛ берилген болÑо -h опциÑÑÑ‹ бар болот. Эгер Ñап тандалган болÑо бүтүрүү " "ÑтатуÑу 0 болот, башка учурда 1; Ñгерде ката чыкÑа жана -q опциÑÑÑ‹ " "берилбеген болÑо бүтүрүү ÑтатуÑу 2 болот.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "уйкаштыруучуларда конфликттер табылды" #: src/grep.c:2101 #, fuzzy msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Бул --disable-perl-regexp опциÑÑÑ‹ менен жаÑалган, -P опциÑÑÑ‹ кошулуу ÑмеÑ" #: src/grep.c:2103 #, fuzzy, c-format msgid "invalid matcher %s" msgstr "макÑимум Ñан жарабайт" #: src/grep.c:2538 msgid "unknown devices method" msgstr "аÑпап методу белгиÑиз" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "макÑимум Ñан жарабайт" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "белгиÑиз файл түрү" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 #, fuzzy msgid "the -P option only supports a single pattern" msgstr "-P опциÑÑÑ‹ бир гана шаблон ала алат" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "" # ПамÑтты Ñмне дейбиз ÑÑ? ;) #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "памÑть жетпей калды" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "" #, fuzzy, c-format #~ msgid "warning: %s: %s" #~ msgstr "ÑÑкертүү: %s: %s\n" #, fuzzy #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: `--%s' опциÑÑÑ‹ менен аргумент колдонулбайт\n" #, fuzzy #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: бул Ð¾Ð¿Ñ†Ð¸Ñ Ñ‚Ò¯ÑˆÒ¯Ð½Ò¯ÐºÑүз `--%s'\n" #, fuzzy #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: `-W %s' опциÑÑÑ‹ так ÑмеÑ\n" #, fuzzy #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: `-W %s' опциÑÑÑ‹ менен аргумент колдонулбайт\n" #, fuzzy #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: `%s' опциÑÑÑ‹ менен аргумент болуш керек\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "" #~ "ШÐБЛОÐ, алдынала тандалгандай, негизги түрдөгү регулÑрдуу выражение " #~ "(BRE)\n" #, fuzzy #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "`egrep' деген `grep -E'. `fgrep' деген `grep -F'.\n" #~ "`egrep' же `fgrep' деп туз иштетуу колдонулбай калды.\n" #~ msgid "unfinished repeat count" #~ msgstr "кайталоо Ñаны толук ÑÐ¼ÐµÑ Ð¶Ð°Ð·Ñ‹Ð»Ð´Ñ‹" #~ msgid "malformed repeat count" #~ msgstr "кайталоо Ñаны туура ÑÐ¼ÐµÑ Ð¶Ð°Ð·Ñ‹Ð»Ð´Ñ‹" #~ msgid "writing output" #~ msgstr "жооп жазыбатат" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "ШÐБЛОРкеңейтилген түрдөгү регулÑрдуу выражение (ERE).\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "ШÐБЛОРар Ñапта бир Ñөз болгон жыйын.\n" # line - Ñап деп колдоном #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Жыйынтык берүү опциÑлары:\n" #~ " -m, --max-count=N N жолу уйкаш табылгандан кийин токтойт\n" #~ " -b, --byte-offset жыйынтыкта байт жайгашууÑу көрÑөтүлөт\n" #~ " -n, --line-number жыйынтыкта Ñаптын катар номери көрÑөтүлөт\n" #~ " --line-buffered табылган ар Ñаптан улам жыйынтык көрÑөтүлөт\n" #~ " -H, --with-filename ар уйкаш үчүн файлдын аты көрÑөтүлөт\n" #~ " -h, --no-filename жыйынтыкта файлдын аты көрÑөтүлбөйт\n" #~ " --label=ТÐМГРÑтандарт кирүүдөн келгендерди ТÐМГРфайлынан " #~ "деп көрÑөтөт\n" #~ " -o, --only-matching Ñапта ШÐБЛОРменен уйкаш болгон жер Ñле " #~ "көрÑөтүлөт\n" #~ " -q, --quiet, --silent жазылатурган баардык жыйынтык көрÑөтүлбөйт\n" #~ " --binary-files=ТҮР бинариктердин түрүн ТҮР катары алат\n" #~ " ТҮР - 'binary', 'text', же 'without-match' " #~ "боло алат\n" #~ " -a, --text --binary-files=text менен бирдей\n" #~ " -I --binary-files=without-match менен бирдей\n" #~ " -d, --directories=ACTION папкаларды кандай иштетерин билдирет\n" #~ " ACTION - 'read', 'recurse', же 'skip' боло " #~ "алат\n" #~ " -D, --devices=ACTION аÑпаптарды, FIFO жана Ñокеттерди кандай " #~ "иштетерин билдирет\n" #~ " ACTION - 'read' же 'skip' боло алат\n" #~ " -R, -r, --recursive --directories=recurse менен бирдей\n" #~ " --include=ФÐЙЛ_ШÐБЛОÐУ ФÐЙЛ_ШÐБЛОÐУ менен уйкашкан файлдар " #~ "гана каралат\n" #~ " --exclude=ФÐЙЛ_ШÐБЛОÐУ ФÐЙЛ_ШÐБЛОÐУ менен уйкашкан файл жана " #~ "папкалар каралбайт\n" #~ " --exclude-from=ФÐЙЛ ФÐЙЛдын ичиндеги шаблондор менен уйкашкан " #~ "файлдар каралбайт\n" #~ " --exclude-dir=ШÐБЛОРШÐБЛОРменен уйкашкан папкалар каралбайт\n" #~ " -L, --files-without-match Ñч уйкаш табылбаган файлдардын аты гана " #~ "көрÑөтүлөт\n" #~ " -l, --files-with-matches уйкаш табылган файлдардын аты гана жазылат\n" #~ " -c, --count ар файлда табылган уйкаш Ñаны гана жазылат\n" #~ " -T, --initial-tab табтарды түздөйт (керек болÑо)\n" #~ " -Z, --null файлдын атынан кийин 0 байты жазылат\n" #~ msgid "Invocation as `egrep' is deprecated; use `grep -E' instead.\n" #~ msgstr "" #~ "`egrep' деген колдонулбай калды; анын ордуна `grep -E' деп колдонунуз.\n" #~ msgid "Invocation as `fgrep' is deprecated; use `grep -F' instead.\n" #~ msgstr "" #~ "`fgrep' деген колдонулбай калды; анын ордуна `grep -F' деп колдонунуз.\n" # kandai koldpnulat bilbeim. #~ msgid "" #~ "In GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped." #~ msgstr "" #~ "GREP_COLORS=\"%s\" дегенде, \"%s\" көлөмүнө маани жазылыш керек (\"=..." #~ "\"); колдонулбайт." # kandai koldpnulat bilbeim. #~ msgid "" #~ "In GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped." #~ msgstr "" #~ "GREP_COLORS=\"%s\" дегенде, \"%s\" көлөмү булев түрүндө жана маани " #~ "алалбайт (\"=%s\"); колдонулбайт." # kandai koldpnulat bilbeim. #~ msgid "In GREP_COLORS=\"%s\", the \"%s\" capacity %s." #~ msgstr "GREP_COLORS=\"%s\" дегенде, \"%s\" көлөмү %s." #~ msgid "" #~ "Stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"." #~ msgstr "" #~ "Туура ÑÐ¼ÐµÑ Ð¶Ð°Ð·Ñ‹Ð»Ð³Ð°Ð½ GREP_COLORS=\"%s\", \"%s\" катарында ишке алынууÑу " #~ "токтоду." #~ msgid "unknown directories method" #~ msgstr "папка методу белгиÑиз" # FSF котормоÑу ;) #~ msgid "" #~ "Copyright (C) 1988, 1992-2002, 2004, 2005 Free Software Foundation, " #~ "Inc.\n" #~ msgstr "" #~ "Укуктары Ñакталган (C) 1988, 1992-2002, 2004, 2005 Эркин Программа Фонду " #~ "(FSF)\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Бул Ñркин колдонулуучу программа; копиÑÑын алуу үчүн коддордо жазылган\n" #~ "шарттарды караңыз. Бул программанын Ñч убадаÑÑ‹ ЖОК; керек болÑо СООДРже\n" #~ "БИР МÐКСÐТКРЫҢГÐЙЛУУ болууÑуна да убада жок.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "-P жана -z опциÑлары чогуу колдонулбайт" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: мындай Ð¾Ð¿Ñ†Ð¸Ñ ÐºÐ¾Ð»Ð´Ð¾Ð½ÑƒÐ»Ð±Ð°Ð¹Ñ‚ -- %c\n" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/pt.po�����������������������������������������������������������������������0000664�0001750�0001750�00000077000�14670377450�016054� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Portuguese (Portugal) translation for the grep package. # Copyright (C) 2018 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Pedro Albuquerque <pmra@protonmail.com>, 2018, 2019, 2020, 2021. # msgid "" msgstr "" "Project-Id-Version: grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 10:42+0100\n" "Last-Translator: Pedro Albuquerque <pmra@protonmail.com>\n" "Language-Team: Portuguese <translation-team-pt@lists.sourceforge.net>\n" "Language: pt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Poedit 2.3\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "argumento inválido %s para %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "argumento ambíguo %s para %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Os argumentos válidos são:" #: lib/c-stack.c:187 msgid "program error" msgstr "erro de programa" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "transporte da pilha" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "erro de escrita" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ sem par" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "classe de carácter inválida" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "a sintaxe da classe de carácter é [[:espaço:]], não [:espaço:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "não terminado\\escape" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "conteúdo inválido de \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "expressão regular muito grande" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( sem par" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "sintaxe não especificada" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") sem par" #: lib/error.c:195 msgid "Unknown system error" msgstr "Erro de sistema desconhecido" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: a opção \"%s%s\" é ambígua\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: a opção \"%s%s\" é ambígua; possibilidades:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: opção \"%s%s\" desconhecida\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: a opção \"%s%s\" não permite um argumento\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "\"%s: a opção \"%s%s\" requer um argumento\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: opção inválida -- \"%c\"\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: a opção requer um argumento -- \"%c\"\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "memória esgotada" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "impossível gravar a pasta de trabalho actual" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "falha ao voltar à pasta de trabalho inicial" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "falha ao definir modo texto/binário do descritor de ficheiro" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "\"" #: lib/quotearg.c:356 msgid "'" msgstr "\"" #: lib/regcomp.c:135 msgid "Success" msgstr "Sucesso" #: lib/regcomp.c:138 msgid "No match" msgstr "Sem par" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Expressão regular inválida" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Carácter de agrupamento inválido" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Nome de classe de carácter inválido" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Barra invertida final" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Referência de retorno inválida" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[, [^, [:, [., ou [= sem par" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( ou \\( sem par" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ sem par" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Conteúdo inválido de \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Final de intervalo inválido" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Memória esgotada" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Expressão regular precedente inválida" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Fim prematuro de expressão regular" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Expressão regular muito grande" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") ou \\) sem par" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Sem expressão regular prévia" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Empacotado por %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Empacotado por %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(©)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licença GPLv3+: GNU GPL versão 3 ou posterior <%s>\n" "Este é um programa grátis: pode alterá-lo e redistribuí-lo.\n" "Não há QUALQUER GARANTIA, até ao limite da Lei.\n" "\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Escrito por %s\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Escrito por %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Escrito por %s, %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Escrito por %s, %s, %s\n" "e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s\n" "e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s e outros.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Reportar erros a: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Reportar %s erros a: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Página inicial %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Ajuda geral para uso de programas GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(entrada padrão)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "argumento de tamanho de contexto inválido" #: src/grep.c:894 msgid "input is too large to count" msgstr "entrada muito grande para contar" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: ficheiro binário coincide" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: aviso: ciclo de pasta recursivo" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: ficheiro de entrada também é a saída" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Uso: %s [OPÇÃO]... PADRÕES [FICHEIRO]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Tente \"%s --help\" para mais informação.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Procurar por PADRÕES em cada FICHEIRO\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Exemplo: %s -i 'hello world' menu.h main.c\n" "PADRÕES pode conter múltiplos padrões separados por newline.\n" "\n" "Selecção e interpretação de padrão:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp PADRÕES são expressões regulares estendidas\n" " -F, --fixed-strings PADRÕES são cadeias\n" " -G, --basic-regexp PADRÕES são expressões regulares básicas\n" " -P, --perl-regexp PADRÕES são expressões regulares Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=PADRÕES usar PADRÕES para comparação\n" " -f, --file=FICHEIRO ler PADRÕES do FICHEIRO\n" " -i, --ignore-case ignorar diferenças entre maiúsculas e " "minúsculas\n" " --no-ignore-case não ignorar diferenças de maiúsculas " "(predefinição)\n" " -w, --word-regexp comparar só palavras completas\n" " -x, --line-regexp comparar só linhas completas\n" " -z, --null-data uma linha de dados termina com o byte 0, não com " "newline\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Diversos:\\n\"\n" " -s, --no-messages suprime mensagens de erro\n" " -v, --invert-match selecciona linhas que não contenham PADRÃO\n" " -V, --version mostra informação de versão e sai\n" " --help mostra esta mensagem e sai\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Controlo de saída:\n" " -m, --max-count=NUM pára após NUM linhas seleccionadas\n" " -b, --byte-offset imprime o desvio de byte com as linhas de saída\n" " -n, --line-number imprime o nº de linha com as linhas de saída\n" " --line-buffered limpa a saída em cada linha\n" " -H, --with-filename imprime o nome de ficheiro com as linhas de " "saída\n" " -h, --no-filename suprime o prefixo do nome de ficheiro na saída\n" " --label=RÓTULO usa RÓTULO como prefixo de nome de ficheiro de " "entrada padrão\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching mostra só partes não-vazias de linhas que " "coincidem\n" " -q, --quiet, --silent suprime toda a saída normal\n" " --binary-files=TYPE assume que ficheiros binários são TIPO;\n" " TIPO é \"binary\", \"text\" ou \"without-match" "\"\n" " -a, --text equivalente a --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I equivalente a --binary-files=without-match\n" " -d, --directories=ACÇÃO COMO GERIR PASTAS;\n" " ACÇÃO é 'read', 'recurse' ou 'skip'\n" " -D, --devices=ACÇÃO COMO GERIR DISPOSITIVOS, FIFOs e sockets;\n" " ACÇÃO é 'read' ou 'skip'\n" " -r, --recursive como --directories=recurse\n" " -R, --dereference-recursive igual, mas segue todas as symlinks\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB procura só em ficheiros que contêm GLOB (um " "padrão de ficheiro)\n" " --exclude=GLOB salta ficheiros e pastas que contêm GLOB\n" " --exclude-from=FICH salta ficheiros que contêm qualquer padrão de " "FICHEIRO\n" " --exclude-dir=GLOB salta pastas que contêm GLOB\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match imprime só nomes de FICHEIROs sem linhas " "seleccionadas\n" " -l, --files-with-matches imprime só nomes de FICHEIROs com linhas " "seleccionadas\n" " -c, --count imprime só um nº de linhas seleccionadas por " "FICHEIRO\n" " -T, --initial-tab alinha tabulações (se necessário)\n" " -Z, --null imprime byte 0 após o nome de FICHEIRO\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Context control:\n" " -B, --before-context=NUM imprime NUM linhas de contexto inicial\n" " -A, --after-context=NUM imprime NUM linhas de contexto final\n" " -C, --context=NUM imprime NUM linhas de contexto de saída\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM igual a --context=NUM\n" " --group-separator=SEP imprimir SEP na linha entre correspondências " "com contexto\n" " --no-group-separator não imprimir separador para correspondências com " "contexto\n" " --color[=QUANDO],\n" " --colour[=QUANDO] usar marcadores para realçar as cadeias " "coincidentes;\n" " QUANDO é \"always\", \"never\" ou \"auto\"\n" " -U, --binary não eliminar caracteres CR em EOL (MSDOS/" "Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Quando FICHEIRO é '-', lê a entrada padrão. Sem FICH, lê '.' se\n" "recursivo, senão lê '-'. Com menos de dois FICHs, assume -h.\n" "O estado da saída é 0 se qualquer linha for seleccionada, senão é 1;\n" "se ocorrer um erro e -q não for dado, o estado da saída é 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "especificou comparadores em conflito" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Comparação Perl não suportada numa compilação --disable-perl-regexp build" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "comparador %s inválido" #: src/grep.c:2538 msgid "unknown devices method" msgstr "método dispositivos desconhecidos" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "aviso: --unix-byte-offsets (-u) está obsoleto" #: src/grep.c:2686 msgid "invalid max count" msgstr "número máximo inválido" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "tipo de ficheiro binário desconhecido" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Escrito por Mike Haertel e outros; veja\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "falha ao alocar memória para a pilha PCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P só suporta idiomas unibyte e UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "a opção -P só suporta um padrão" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "erro interno (nunca devia acontecer)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "excedido o limite de tamanho da linha de PCRE" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: memória esgotada" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: pilha PCRE JIT esgotada" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: excedido o limite de retrocesso de PCRE" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: limite de recursividade de PCRE excedido" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: erro interno de PCRE: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "aviso: GREP_OPTIONS é obsoleto; por favor, use um aliás ou um script" #~ msgid "warning: %s: %s" #~ msgstr "aviso: %s: %s" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "Página inicial %s: <https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "Argumento \"%s\" de %s%s inválido" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "sufixo inválido no argumento \"%s\" de %s%s" #~ msgid "%s%s argument '%s' too large" #~ msgstr "argumento \"%s\" de %s%s muito grande" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "erro interno" #~ msgid "unfinished repeat count" #~ msgstr "contador de repetição não terminado" #~ msgid "malformed repeat count" #~ msgstr "contador de repetição mal formado" #~ msgid "out of memory" #~ msgstr "sem memória" #~ msgid "writing output" #~ msgstr "a escrever o resultado" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Utilização: %s [OPÇÃO]... PADRÃO [FICHEIRO] ...\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Controlo de resultados\n" #~ " -m, --max-count=NUM pára após NUM resultados\n" #~ " -b, --byte-offset apresenta o 'byte offset' nos resultados\n" #~ " -n, --line-number apresenta o número de linha nos resultados\n" #~ " --line-buffered 'flush output' em cada linha\n" #~ " -H, --with-filename apresenta o nome do ficheiro para cada " #~ "resultado\n" #~ " -h, --no-filename não apresenta o nome do ficheiro nos " #~ "resultados\n" #~ " --label=NOME utiliza NOME de ficheiro para o «standard " #~ "input»\n" #~ " -o, --only-matching apresenta só a parte da linha que satisfaz " #~ "PADRÃO\n" #~ " -q, --quiet, --silent suprime toda a apresentação de resultados\n" #~ " --binary-files=TIPO assume que ficheiros binários são do TIPO\n" #~ " TIPO pode ser 'binary', 'text', ou 'without-" #~ "match'\n" #~ " -a, --text equivalente a --binary-files=text\n" #~ " -I equivalente a --binary-files=without-match\n" #~ " -d, --directories=ACÇÃO como lidar com directorias\n" #~ " ACÇÃO pode ser 'read', 'recurse', ou 'skip'\n" #~ " -D, --devices=ACÇÃO como lidar com devices, FIFOs e sockets\\n\"\n" #~ " ACÇÃO pode ser 'read' ou 'skip'\n" #~ " -R, -r, --recursive equivalente a --directories=recurse\n" #~ " --include=PADRÃO ficheiros que satisfaçam PADRÃO serão " #~ "examinados\n" #~ " --exclude=PADRÃO ficheiros que satisfaçam PADRÃo serão " #~ "ignorados\n" #~ " --exclude-from=FICH ficheiros que satisfaçam PADRÃO indicado em " #~ "FICH\n" #~ " serão ignorados\n" #~ " -L, --files-without-match apresenta apenas FICHEIROS que não satisfaçam " #~ "PADRÃO\n" #~ " -l, --files-with-matches apresenta apenas FICHEIROS que satisfaçam o " #~ "PADRÃO\n" #~ " -c, --count apresenta para cada FICHEIRO um contador com " #~ "o\n" #~ " número de linhas que satisfazem PADRÃO\n" #~ " -Z, --null imprimir o byte 0 após cada nome de FICHEIRO\n" #~ msgid "" #~ "\n" #~ "Context control:\n" #~ " -B, --before-context=NUM print NUM lines of leading context\n" #~ " -A, --after-context=NUM print NUM lines of trailing context\n" #~ " -C, --context=NUM print NUM lines of output context\n" #~ " -NUM same as --context=NUM\n" #~ " --color[=WHEN],\n" #~ " --colour[=WHEN] use markers to distinguish the matching " #~ "string\n" #~ " WHEN may be `always', `never' or `auto'.\n" #~ " -U, --binary do not strip CR characters at EOL (MSDOS)\n" #~ " -u, --unix-byte-offsets report offsets as if CRs were not there " #~ "(MSDOS)\n" #~ "\n" #~ "`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" #~ "With no FILE, or when FILE is -, read standard input. If less than\n" #~ "two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" #~ "and 2 if trouble.\n" #~ msgstr "" #~ "\n" #~ "Controlo de contexto:\n" #~ " -B, --before-context=NUM apresenta NUM linhas de contexto anteriores a " #~ "PADRÃO\n" #~ " -A, --after-context=NUM apresenta NUM linhas de contexto a seguir a " #~ "PADRÃO\n" #~ " -C, --context=NUM apresenta NUM linhas de contexto no " #~ "resultado\n" #~ " -NUM equivalente a --context=NUM\n" #~ " --color[=QUANDO],\n" #~ " --colour[=QUANDO] utiliza marcadores para distinguir as partes " #~ "que\n" #~ " satisfazem o PADRÃO\n" #~ " QUANDO pode ser `always', `never' ou `auto'\n" #~ " -U, --binary não remover caracteres CR em EOL (MSDOS)\n" #~ " -u, --unix-byte-offsets reportar «offsets» como se não houvesse CRs " #~ "(MSDOS)\n" #~ "\n" #~ "`egrep' é equivalente a `grep -E'. `fgrep' é equivalente a `grep -F'\n" #~ "Sem FICHEIRO ou quando FICHEIRO é -, ler o «standard input». Se forem " #~ "dados\n" #~ "dois FICHEIROS, assume -h. Devolve 0 se encontrar pelo menos uma " #~ "occorência\n" #~ "de PADRÃO, 1 se não encontrar, 2 se tiver algum problema.\n" #~ msgid "" #~ "\n" #~ "Report bugs to <bug-gnu-utils@gnu.org>.\n" #~ msgstr "" #~ "\n" #~ "Reporte «bugs» para <bug-gnu-utils@gnu.org>.\n" #~ msgid "unknown directories method" #~ msgstr "método para acesso a directorias desconhecido" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ "Direitos de autor 1988, 1992-1999, 2000, 2001 Free Software Foundation, " #~ "Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Este software é software livre; leia o código fonte para saber as " #~ "condições.\n" #~ "NÃO existe qualquer garantia; nem mesmo sobre COMERCIALIZAÇÃO ou " #~ "CONFORMIDADE\n" #~ "PARA UM DETERMINADO FIM.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "A opção -P e -z não podem ser combinadas" #~ msgid "%s: option `--%s' doesn't allow an argument\n" #~ msgstr "%s: a opção `%s' não aceita um argumento\n" #~ msgid "%s: unrecognized option `--%s'\n" #~ msgstr "%s: opção `--%s' desconhecida\n" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: opção ilegal -- %c\n" #~ msgid "%s: option `-W %s' is ambiguous\n" #~ msgstr "%s: a opção `-W %s' é ambígua\n" #~ msgid "%s: option `-W %s' doesn't allow an argument\n" #~ msgstr "%s: a opção `-W %s' não aceita um argumento\n" kbuild-3608/src/grep/po/ja.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000026214�14670377450�016170� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����R������¬��m���<������ð��Ï���ñ��÷���Á��Õ��¹��¶�� ��U��F �����œ �����° ��,���Ì �����ù ��.�����'���H��(���p�����™�����¹�����»�����¿��*���Ð�����û����������/�����K��$���c�����ˆ�����š�����µ�����Æ�����Ï�����î�����þ��#��������7�����R�����i�����q��&���„�����«�����À�����Ò�����ä�� �������������%��;���<��3���x��/���¬��+���Ü��'�����#���0�����T�����t���������� �����¢��4���¿�����ô��!�����0���5��-���f��.���”�����Ã��$���ß���������������7�����O�����o�����‚�����”�����¥�� ���¹�����Ç�����â��,���ñ��*����� ���I�� ���V�� ���c�����p�����„�����ž�� ���µ��Ø��Á��ö���š��"��‘��3��´�� ��è��±��ö�����¨��%���È��F���î��+���5 ��I���a ��4���« ��7���à ��4���!�����M!�����O!�����S!��A���b!�����¤!��!���À!�����â!�����þ!��!���"�����>"�����Z"��$���v"�����›"��'���®"�����Ö"��"���ô"��*���#��!���B#��¥���d#�� ��� $��!���$��6���9$�����p$��!���$��!���±$��2���Ó$�����%�����%�����-%��V���H%��F���Ÿ%��A���æ%��:���(&��4���c&��.���˜&��)���Ç&��"���ñ&�� ���'�����"'��,���$'��Q���Q'��3���£'��)���×'��E���(��B���G(��[���Š(��-���æ(��0���)��5���E)��!���{)�����)��B���»)��$���þ)�����#*��$���?*��$���d*�����‰*��!���¢*��!���Ä*��H���æ*��K���/+��$���{+��$��� +��$���Å+��,���ê+��0���,��-���H,�����v,�����������&���!���<���A���2�������$���"���������� �������������������/�����������������,���*�������������.���G������Q�������?���3������������������I���:�������M�����������D���J���-���������B���O���P���7���4������0���K���)���������������������#���E���@���1���������+�������(��� ���������������H���L���;���8���������=���6���C������� �������'���������� ���9�������5��� ����������%���N���R��������������>���F��� ���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name �%s home page: <%s> �%s: invalid option -- '%c' �%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: GNU grep 3.0.23-b00 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2017-06-25 20:16+0900 Last-Translator: Yasuaki Taniguchi <yasuakit@gmail.com> Language-Team: Japanese <translation-team-ja@lists.sourceforge.net> Language: ja MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=1; plural=0; X-Generator: Poedit 2.0.2 � å‰å¾Œã®è¡¨ç¤ºã«é–¢ã™ã‚‹åˆ¶å¾¡: -B, --before-context=NUM 一致ã—ãŸå‰ã® NUM 行を表示ã™ã‚‹ -A, --after-context=NUM 一致ã—ãŸå¾Œã® NUM 行を表示ã™ã‚‹ -C, --context=NUM 一致ã—ãŸå‰å¾Œ NUM 行を表示ã™ã‚‹ � ãã®ä»–: -s, --no-messages エラーメッセージを抑止ã™ã‚‹ -v, --invert-match 一致ã—ãªã„è¡Œã‚’é¸æŠžã™ã‚‹ -V, --version ãƒãƒ¼ã‚¸ãƒ§ãƒ³æƒ…報を表示ã—ã¦çµ‚了ã™ã‚‹ --help ã“ã®ãƒ˜ãƒ«ãƒ—を表示ã—ã¦çµ‚了ã™ã‚‹ � 出力ã®åˆ¶å¾¡: -m, --max-count=NUM NUM 行一致後ã«ä¸­æ–­ã™ã‚‹ -b, --byte-offset 出力行ã¨ä½µã›ã¦ãƒã‚¤ãƒˆã‚ªãƒ•セットを表示ã™ã‚‹ -n, --line-number 出力行ã¨ä½µã›ã¦è¡Œç•ªå·ã‚’表示ã™ã‚‹ --line-buffered 行ã”ã¨ã«å‡ºåŠ›ã‚’ flush ã™ã‚‹ -H, --with-filename 出力行ã¨ä½µã›ã¦ãƒ•ァイルåを表示ã™ã‚‹ -h, --no-filename 出力ã®å…ˆé ­ã«ãƒ•ァイルåを付ã‘ãªã„ --label=LABEL 標準入力ã®ãƒ•ァイルåã®æŽ¥é ­è¾žã¨ã—㦠LABEL を使用ã™ã‚‹ � -I --binary-files=without-match ã¨ç­‰ä¾¡ -d, --directories=ACTION ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãƒ¼ã®æ‰±ã„方を指定ã™ã‚‹ ACTION 㯠'read'ã€'recurse' ã¾ãŸã¯ 'skip' -D, --devices=ACTION デãƒã‚¤ã‚¹ã€FIFO ãŠã‚ˆã³ã‚½ã‚±ãƒƒãƒˆã®æ‰±ã„方を指定ã™ã‚‹ ACTION 㯠`read' ã¾ãŸã¯ `skip' -r, --recursive --directories=recurse ã¨ç­‰ä¾¡ -R, --dereference-recursive 上ã¨åŒæ§˜ã ãŒã‚·ãƒ³ãƒœãƒªãƒƒã‚¯ãƒªãƒ³ã‚¯ã‚’辿る � -L, --files-without-match PATTERN ã«ä¸€è‡´ã—ãªã„ FILE ã®åå‰ã®ã¿è¡¨ç¤ºã™ã‚‹ -l, --files-with-matches PATTERN ã«ä¸€è‡´ã™ã‚‹ FILE ã®åå‰ã®ã¿è¡¨ç¤ºã™ã‚‹ -c, --count FILE ã”ã¨ã«ä¸€è‡´ã—ãŸè¡Œæ•°ã®ã¿è¡¨ç¤ºã™ã‚‹ -T, --initial-tab タブを使用ã—ã¦æ•´åˆ—ã™ã‚‹ (å¿…è¦ãªå ´åˆ) -Z, --null FILE ã®åå‰ã‚’表示ã—ãŸå¾Œã«å€¤ãŒ 0 ã®ãƒã‚¤ãƒˆã‚’出力ã™ã‚‹ �%s ã®ãƒ›ãƒ¼ãƒ ãƒšãƒ¼ã‚¸: <%s> �%s: 無効ãªã‚ªãƒ—ション -- '%c' �%s: オプション '%s%s' ã¯å¼•æ•°ã‚’å–ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“ �%s: オプション '%s%s' ã¯æ›–昧ã§ã™ �%s: オプション '%s%s' ã¯æ›–昧ã§ã™ã€‚次ã®ã‚‚ã®ãŒå¯èƒ½ã§ã™:�%s: オプション '%s%s' ã¯å¼•æ•°ãŒå¿…è¦ã§ã™ �%s: オプションã«ã¯å¼•æ•°ãŒå¿…è¦ã§ã™ -- '%c' �%s: オプション '%s%s' ã‚’èªè­˜ã§ãã¾ã›ã‚“ �'�(C)�(標準入力)�-P ã¯1ãƒã‚¤ãƒˆã® UTF-8 ロケールã®ã¿ã‚µãƒãƒ¼ãƒˆã—ã¾ã™�無効ãªå‰æ–¹å‚ç…§ã§ã™�ç„¡åŠ¹ãªæ–‡å­—クラスåã§ã™�無効ãªç…§åˆæ–‡å­—ã§ã™�\{\} ã®ä¸­èº«ãŒç„¡åйã§ã™�無効ãªå‰æ–¹æ­£è¦è¡¨ç¾ã§ã™�無効ãªç¯„囲終了ã§ã™�ç„¡åŠ¹ãªæ­£è¦è¡¨ç¾ã§ã™�ãƒ¡ãƒ¢ãƒªã‚’ä½¿ã„æžœãŸã—ã¾ã—ãŸ�一致ã—ã¾ã›ã‚“�以å‰ã«æ­£è¦è¡¨ç¾ãŒã‚りã¾ã›ã‚“�パッケージ作æˆè€…: %s �パッケージ作æˆè€…: %s (%s) �æ­£è¦è¡¨ç¾ãŒé€”中ã§çµ‚了ã—ã¾ã—ãŸ�æ­£è¦è¡¨ç¾ãŒå¤§ãã™ãŽã¾ã™�%s ã®ãƒã‚°ã‚’発見ã—ãŸã‚‰ <%s> ã«å ±å‘Šã—ã¦ä¸‹ã•ã„。 翻訳ã«é–¢ã™ã‚‹ãƒã‚°ã¯<translation-team-ja@lists.sourceforge.net>ã«å ±å‘Šã—ã¦ãã ã•ã„。 �æˆåŠŸã§ã™�終端ã®ãƒãƒƒã‚¯ã‚¹ãƒ©ãƒƒã‚·ãƒ¥�詳ã—ãã¯'%s --help'を実行ã—ã¦ãã ã•ã„。 �䏿˜Žãªã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼�( ã¾ãŸã¯ \( ãŒä¸ä¸€è‡´ã§ã™�) ã¾ãŸã¯ \) ãŒä¸ä¸€è‡´ã§ã™�[ã€[^ã€[:ã€[.ã€ã¾ãŸã¯ [= ãŒä¸ä¸€è‡´ã§ã™�\{ ãŒä¸ä¸€è‡´ã§ã™�有効ãªå¼•æ•°:�作者 %s ãŠã‚ˆã³ %s。 �作者 %s〠%s〠%s〠%s〠%s〠%s〠%s〠%s〠%s〠ãŠã‚ˆã³ä»–ã®æ–¹ã€…。 �作者 %s〠%s〠%s〠%s〠%s〠%s〠%s〠%sã€ãŠã‚ˆã³ %s。 �作者 %s〠%s〠%s〠%s〠%s〠%s〠%s〠ãŠã‚ˆã³ %s。 �作者 %s〠%s〠%s〠%s〠%s〠%sã€ãŠã‚ˆã³ %s。 �作者 %s〠%s〠%s〠%s〠%sã€ãŠã‚ˆã³ %s。 �作者 %s〠%s〠%s〠%sã€ãŠã‚ˆã³ %s。 �作者 %s〠%s〠%s〠ãŠã‚ˆã³ %s。 �作者 %s〠%sã€ãŠã‚ˆã³ %s。 �作者 %s。 �`�%2$s ã«å¯¾ã™ã‚‹å¼•æ•° %1$s ãŒæ›–昧ã§ã™�æ–‡å­—ã‚¯ãƒ©ã‚¹ã®æ§‹æ–‡ã¯ [[:space:]] ã§ã™ã€‚ [:space:] ã§ã¯ã‚りã¾ã›ã‚“�指定ã—ãŸä¸€è‡´å‡¦ç†ç³»ãŒç«¶åˆã—ã¦ã„ã¾ã™�PCRE ã®è¡Œé•·åˆ¶é™ã‚’è¶…éŽã—ã¾ã—ãŸ�PCRE JIT スタックã¸ã®ãƒ¡ãƒ¢ãƒªå‰²ã‚Šå½“ã¦ã«å¤±æ•—ã—ã¾ã—ãŸ�åˆæœŸä½œæ¥­ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãƒ¼ã«æˆ»ã‚‹ã®ã«å¤±æ•—ã—ã¾ã—ãŸ�ファイル記述å­ã‚’テキスト/ãƒã‚¤ãƒŠãƒªãƒ¢ãƒ¼ãƒ‰ã«è¨­å®šã§ãã¾ã›ã‚“ã§ã—ãŸ�入力ãŒå¤§ãã™ãŽã¦æ•°ãˆã‚‰ã‚Œã¾ã›ã‚“�内部エラー (決ã—ã¦ç™ºç”Ÿã—ãªã„ã¯ãš)�%2$s ã«å¯¾ã™ã‚‹å¼•æ•° %1$s ãŒé–“é•ã£ã¦ã„ã¾ã™�ç„¡åŠ¹ãªæ–‡å­—クラスåã§ã™�\{\} ã®ä¸­èº«ãŒç„¡åйã§ã™�一致ã—ãŸå‰å¾Œã®è¡Œã®è¡¨ç¤ºã«é–¢ã™ã‚‹å¼•æ•°ãŒç„¡åйã§ã™�%s ã¯ç„¡åйãªä¸€è‡´å‡¦ç†ç³»ã§ã™�無効ãªä¸€è‡´å›žæ•°ã§ã™�ãƒ¡ãƒ¢ãƒªã‚’ä½¿ã„æžœãŸã—ã¾ã—ãŸ�æ§‹æ–‡ãŒæŒ‡å®šã•れã¦ã„ã¾ã›ã‚“�プログラムエラー�æ­£è¦è¡¨ç¾ãŒå¤§ãã™ãŽã¾ã™�スタックオーãƒãƒ¼ãƒ•ロー�-P オプションã¯å˜ä¸€ã®ãƒ‘ターンã—ã‹ã‚µãƒãƒ¼ãƒˆã—ã¾ã›ã‚“�ç¾åœ¨ã®ä½œæ¥­ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãƒ¼ã‚’記録ã™ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“�対応ãŒã¨ã‚Œã¦ã„ãªã„ ( ã§ã™�対応ãŒã¨ã‚Œã¦ã„ãªã„ ) ã§ã™�対応ãŒã¨ã‚Œã¦ã„ãªã„ [ ã§ã™�\ エスケープãŒçµ‚了ã—ã¦ã„ã¾ã›ã‚“�䏿˜Žãªãƒã‚¤ãƒŠãƒªãƒ•ァイルã®å½¢å¼ã§ã™�デãƒã‚¤ã‚¹ã«å¯¾ã™ã‚‹ä¸æ˜Žãªæ“作ã§ã™�書ãè¾¼ã¿ã‚¨ãƒ©ãƒ¼�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/id.po�����������������������������������������������������������������������0000664�0001750�0001750�00000055742�14670377450�016036� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Pesan bahasa indonesia untuk grep # Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Tedi Heriyanto <tedi_h@gmx.net>, 1999, 2000, 2001, 2002. # Arif E. Nugroho <arif_endro@yahoo.com>, 2008, 2009, 2010, 2011, 2012, 2013, 2014. # Andika Triwidada <andika@gmail.com>, 2018, 2020, 2021. # msgid "" msgstr "" "Project-Id-Version: grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-10 10:35+0700\n" "Last-Translator: Andika Triwidada <andika@gmail.com>\n" "Language-Team: Indonesian <translation-team-id@lists.sourceforge.net>\n" "Language: id\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Poedit 2.4.3\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "argumen %s yang tidak valid untuk %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "argumen %s ambigu untuk %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Argumen yang valid adalah:" #: lib/c-stack.c:187 msgid "program error" msgstr "kesalahan program" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "stack overflow" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "kesalahan tulis" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ tidak seimbang" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "kelas karakter tidak valid" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "sintaks kelas karakter adalah [[:space:]], bukan [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "escape \\ tidak selesai" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "isi dari \\{\\} tidak valid" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "ekspresi reguler terlalu besar" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( tidak seimbang" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "tidak ada sintaks yang dinyatakan" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") tidak seimbang" #: lib/error.c:195 msgid "Unknown system error" msgstr "Kesalahan sistem tidak dikenal" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: opsi '%s%s' ambigu\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: opsi '%s%s' ambigu; kemungkinan:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: opsi tidak dikenal '%s%s'\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: opsi '%s%s' tidak mengizinkan sebuah argumen\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: opsi '%s%s' membutuhkan sebuah argumen\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: opsi tidak valid -- %c\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: opsi membutuhkan sebuah argumen -- %c\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "kehabisan memori" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "tidak bisa merekam direktori kerja sekarang" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "gagal kembali ke direktori kerja sekarang" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "gagal menata mode teks/biner descriptor berkas" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "'" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "Sukses" #: lib/regcomp.c:138 msgid "No match" msgstr "Tak ada yang cocok" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Ekspresi reguler tidak valid" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Karakter kolasi tidak valid" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Nama kelas karakter tidak valid" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Kelebihan backslash" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Referensi balik tidak valid" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[, [^, [:, [., atau [= tanpa pasangan" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( atau \\( tanpa pasangan" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ tanpa pasangan" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Isi dari \\{\\} tidak valid" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Akhir rentang tidak valid" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Kehabisan memori" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Ekspresi reguler yang mendahului tidak valid" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Akhir dini dari ekspresi reguler" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Ekspresi reguler terlalu besar" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") atau \\) tanpa pasangan" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Tidak ada ekspresi reguler sebelumnya" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Dipaketkan oleh %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Dipaketkan oleh %s \n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Lisensi GPLv3+; GNU GPL versi 3 atau lebih lanjut <%s>.\n" "Ini adalah aplikasi bebas; Anda bebas untuk mengubah dan " "meredistribusikannya.\n" "TIDAK ADA GARANSI disini, sampai batas yang diijinkan oleh hukum yang " "berlaku.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Ditulis oleh %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Ditulis oleh %s dan %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Ditulis oleh %s, %s, and %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Ditulis oleh %s, %s, %s,\n" "dan %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Ditulis oleh %s, %s, %s,\n" "%s, dan %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Ditulis oleh %s, %s, %s,\n" "%s, %s, dan %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Ditulis oleh %s, %s, %s,\n" "%s, %s, %s, dan %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Ditulis oleh %s, %s, %s,\n" "%s, %s, %s, %s,\n" "dan %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Ditulis oleh %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, dan %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Ditulis oleh %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, dan yang lain.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Laporkan kutu ke: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Laporkan kutu %s ke: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Laman web %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Bantuan umum menggunakan aplikasi GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(masukan standar)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "argumen panjang konteks tidak valid" #: src/grep.c:894 msgid "input is too large to count" msgstr "masukan terlalu besar untuk dihitung" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: berkas biner cocok" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: peringatan: perulangan direktori rekursif" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: berkas masukan juga sebagai keluaran" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Penggunaan: %s [OPSI]... POLA [BERKAS]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Coba '%s --help' untuk informasi lebih lanjut.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Cari POLA dalam setiap BERKAS.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Contoh: %s -i 'hello world' menu.h main.c\n" "POLA bisa memuat beberapa pola yang dipisah oleh baris baru.\n" "\n" "Seleksi dan interpretasi pola:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp POLA adalah ekspresi reguler diperluas\n" " -F, --fixed-string POLA adalah string\n" " -G, --basic-regexp POLA adalah ekspresi reguler dasar\n" " -P, --perl-regexp POLA adalah sebuah ekspresi reguler Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=POLA gunakan POLA untuk pencocokan\n" " -f, --file=BERKAS dapatkan POLA dari BERKAS\n" " -i, --ignore-case abaikan perbedaan besar kecil huruf dalam pola " "dan data\n" " --no-ignore-case jangan abaikan perbedaan besar kecil huruf " "(baku)\n" " -w, --word-regexp paksa POLA hanya untuk pencocokan dengan " "keseluruhan kata\n" " -x, --line-regexp paksa POLA hanya untuk pencocokan dengan " "keseluruhan baris\n" " -z, --null-data baris data berakhir dengan byte 0, bukan baris-" "baru\n" "\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Lain-lain:\n" " -s, --no-messages sembunyikan pesan kesalahan\n" " -v, --invert-match pilih baris-baris yang tidak sesuai\n" " -V, --version tampilkan informasi versi dan keluar\n" " --help tampilkan bantuan ini dan keluar\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Kendali keluaran:\n" " -m, --max-count=NUM berhenti setelah NUM kecocokan\n" " -b, --byte-offset cetak ofset byte dengan baris-baris keluaran\n" " -n, --line-number cetak nomor baris dengan baris-baris keluaran\n" " --line-buffered gelontor keluaran pada setiap baris\n" " -H, --with-filename cetak nama berkas dengan baris-baris keluaran\n" " -h, --no-filename sembunyikan prefiks nama berkas pada keluaran\n" " --label=LABEL pakai LABEL sebagai prefiks nama berkas masukan " "standar\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching hanya tampilkan bagian dari baris yang cocok\n" " -q, --quiet, --silent sembunyikan semua keluaran normal\n" " --binary-files=TIPE asumsikan bahwa berkas biner adalah TIPE;\n" " TIPE adalah 'binary', 'text', atau 'without-" "match'\n" " -a, --text ekuivalen dengan --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I ekuivalen dengan --binary-files=without-match\n" " -d, --directories=AKSI bagaimana menangani direktori;\n" " AKSI adalah 'read', 'recurse', atau 'skip'\n" " -D, --devices=AKSI bagaimana menangani peranti, FIFO, dan soket;\n" " AKSI adalah 'read' atau 'skip'\n" " -r, --recursive seperti --directories=recurse\n" " -R, --dereference-recursive serupa, tapi ikut semua symlink\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB hanya cari berkas yang cocok dengan GLOB (suatu " "pola berkas)\n" " --exclude=GLOB lewati berkas yang cocok dengan GLOB\n" " --exclude-from=BERKAS lewati berkas yang cocok dengan sebarang pola " "dari BERKAS\n" " --exclude-dir=GLOB lewati direktori yang cocok dengan GLOB\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match hanya cetak nama BERKAS yang tidak memuat baris " "yang cocok\n" " -l, --files-with-matches hanya cetak nama BERKAS dengan baris yang " "cocok\n" " -c, --count hanya cetak cacah baris yang cocok per BERKAS\n" " -T, --initial-tab jadikan tab sejajar (bila diperlukan)\n" " -Z, --null cetak byte 0 setelah nama BERKAS\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Kendali konteks:\n" " -B, --before-context=NUM cetak NUM baris yang mendahului konteks\n" " -A, --after-context=NUM cetak NUM baris yang mengikuti konteks\n" " -C, --context=NUM cetak NUM baris konteks keluaran\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM sama seperti --context=NUM\n" " --group-separator=SEP cetak SEP pada baris antara kecocokan dengan " "konteks\n" " --no-group-separator jangan cetak pemisah untuk kecocokan dengan " "konteks\n" " --color[=WHEN],\n" " --colour[=WHEN] gunakan penanda untuk membedakan string yang " "cocok\n" " WHEN dapat berupa 'always', 'never', atau " "'auto'\n" " -U, --binary jangan hapus karakter CR di EOL (MSDOS)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Jika BERKAS adalah '-', baca masukan standar. Tanpa BERKAS, baca '.'\n" "bila rekursif, '-' jika tidak. Dengan kurang dari dua BERKAS, asumsikan -" "h.\n" "Status keluar adalah 0 jika baris apa pun dipilih, 1 jika tidak;\n" "jika ada kesalahan apapun dan opsi -q tidak diberikan, status keluar adalah " "2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "pencocok yang bertentangan dispesifikasikan" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "Pencocokan Perl tidak didukung dalam suatu build --disable-perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "pencocok tidak valid %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "metode peranti tidak dikenal" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "peringatan: --unix-byte-offsets (-u) usang" #: src/grep.c:2686 msgid "invalid max count" msgstr "cacah maks tidak valid" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "tipe berkas biner tidak dikenal" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Ditulis oleh Mike Haertel dan lainnya, lihat\n" "<http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "gagal mengalokasikan memori untuk stack JIT PCRE" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P hanya mendukung unibyte dan locale UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "opsi -P hanya mendukung sebuah pola tunggal" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "kesalahan internal (mestinya tidak pernah terjadi)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "melampaui batas panjang baris PCRE" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: kehabisan memori" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: stack JIT PCRE habis" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: melampaui batas backtrack PCRE" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: melampaui batas rekursi PCRE" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: kesalahan PCRE internal: %d" ������������������������������kbuild-3608/src/grep/po/cs.po�����������������������������������������������������������������������0000664�0001750�0001750�00000103556�14670377450�016044� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Czech message catalog for grep. # Copyright (C) 1998 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Vladimir Michl <Vladimir.Michl@seznam.cz>, 1998. # Petr Pisar <petr.pisar@atlas.cz>, 2008, 2009, 2010, 2011, 2012, 2013. # Petr Pisar <petr.pisar@atlas.cz>, 2014, 2015, 2016, 2018, 2020, 2021. # # Thanks to Stanislav Brabec <utx@k332.feld.cvut.cz>. msgid "" msgstr "" "Project-Id-Version: grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 20:10+02:00\n" "Last-Translator: Petr Pisar <petr.pisar@atlas.cz>\n" "Language-Team: Czech <translation-team-cs@lists.sourceforge.net>\n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "neplatný argument %s u %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "nejednoznaÄný argument %s u %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Platné argumenty jsou:" #: lib/c-stack.c:187 msgid "program error" msgstr "chyba programu" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "pÅ™eteÄení zásobníku" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "chyba pÅ™i zápisu" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "nevyvážená [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "neplatný třída znaků" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "zápis třídy znaků je [[:space:]], ne [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "neukonÄená escape sekvence \\" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "neplatný obsah \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "regulární výraz je příliÅ¡ velký" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "nevyvážená (" # ? Není zadaná syntaxe #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "syntaxe není urÄena" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "nevyvážená )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Neznámá systémová chyba" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: pÅ™epínaÄ â€ž%s%s“ není jednoznaÄný\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: pÅ™epínaÄ â€ž%s%s“ není jednoznaÄný: možnosti:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: nerozpoznaný pÅ™epínaÄ â€ž%s%s“\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: pÅ™epínaÄ â€ž%s%s“ musí být zadán bez argumentu\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: pÅ™epínaÄ â€ž%s%s“ vyžaduje argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: neznámý pÅ™epínaÄ – „%c“\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: pÅ™epínaÄ vyžaduje argument – „%c“\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "paměť vyÄerpána" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "nelze zaznamenat aktuální pracovní adresář" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "návrat do prvotního pracovního adresáře se nezdaÅ™il" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "nastavení textového/binárního režimu deskriptoru souboru selhalo" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "„" #: lib/quotearg.c:356 msgid "'" msgstr "“" #: lib/regcomp.c:135 msgid "Success" msgstr "ÚspÄ›ch" #: lib/regcomp.c:138 msgid "No match" msgstr "Žádná shoda" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Neplatný regulární výraz" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Neplatný Å™adicí znak" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Neplatný název třídy znaků" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "ZávÄ›reÄné koncové lomítko" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Neplatný zpÄ›tný odkaz" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Nepárový [, [^, [:, [. nebo [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Nepárový ( nebo \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Nepárový \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Neplatný obsah \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Neplatný konec rozsahu" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Paměť vyÄerpána" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Neplatný pÅ™edchozí regulární výraz" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "PÅ™edÄasný konec regulárního výrazu" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Regulární výraz je příliÅ¡ velký" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Nepárový ) nebo \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Žádný pÅ™edchozí regulární výraz" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Zabaleno kým: %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Zabaleno kým: %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licence GPLv3+: GNU GPL verze 3 nebo novÄ›jší\n" "<%s>.\n" "Toto je volné programové vybavení: máte právo jej mÄ›nit a dále šířit.\n" "Není zde ŽÃDNà ZÃRUKA, jak jen zákon dovoluje.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Napsal(a) %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Napsali(y) %s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Napsali(y) %s, %s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Napsali(y) %s, %s, %s\n" "a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Napsali(y) %s, %s, %s,\n" "%s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Napsali(y) %s, %s, %s,\n" "%s, %s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Napsali(y) %s, %s, %s,\n" "%s, %s, %s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Napsali(y) %s, %s, %s,\n" "%s, %s, %s, %s\n" "a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Napsali(y) %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s a %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Napsali(y) %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s a další.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" "Chyby v programu oznamujte (anglicky) na adresu: <%s>\n" "PÅ™ipomínky k pÅ™ekladu na adresu: <translation-team-cs@lists.sourceforge." "net>\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Chyby distributora %s oznamujte (anglicky) na adresu: <%s>\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Domovská stránka programu %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Obecná pomoc s používáním GNU softwaru: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(standardní vstup)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "neplatný argument délky kontextu" #: src/grep.c:894 msgid "input is too large to count" msgstr "poÄet vstupních řádků nelze spoÄítat (je jich hodnÄ›)" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: binární soubor odpovídá" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: pozor: smyÄka rekurzivních adresářů" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: vstupní soubor je rovněž výstupem" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Použití: %s [PŘEPÃNAÄŒ]… VZORKY [SOUBOR]…\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Více informací získáte příkazem „%s --help“.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Každý SOUBOR prohledá na VZORKY.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Příklad: %s -i 'hello world' menu.h main.c\n" "VZORKY smí obsahovat více vzorků oddÄ›lených novým řádkem.\n" "\n" "VýbÄ›r a interpretace vzorku:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp VZORKY jsou rozšířené regulární výrazy\n" " -F, --fixed-strings VZORKY jsou Å™etÄ›zce\n" " -G, --basic-regexp VZORKY jsou základní regulární výrazy\n" " -P, --perl-regexp VZORKY jsou regulární výrazy jazyka Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=VZORKY použije VZORKY jako regulární výraz\n" " -f, --file=SOUBOR naÄte VZORKY ze SOUBORU\n" " -i, --ignore-case ignoruje rozdíly ve velikosti písmen ve " "vzorcích\n" " a datech\n" " --no-ignore-case neignoruje rozdíly ve velikosti písmen " "(výchozí)\n" " -w, --word-regexp hledá pouze na celá slova\n" " -x, --line-regexp hledá pouze celé řádky\n" " -z, --null-data řádek konÄí nulovým bajtem místo znaku nového " "řádku\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Různé:\n" " -s, --no-messages potlaÄí chybové zprávy\n" " -v, --invert-match vybere neodpovídající řádky\n" " -V, --version vypíše oznaÄení verze a skonÄí\n" " --help vypíše tuto nápovÄ›du a skonÄí\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Řízení výstupu:\n" " -m, --max-count=POÄŒET skonÄí po vybrání POÄŒTU řádků\n" " -b, --byte-offset s každým výstupním řádkem vypíše jeho pozici\n" " v souboru\n" " -n, --line-number s každým výstupním řádkem vypíše jeho Äíslo " "řádku\n" " --line-buffered vyprázdní výstup po každém řádku\n" " -H, --with-filename u výstupních řádků vypisuje název souboru\n" " -h, --no-filename potlaÄí pÅ™edÅ™azování jména souboru na výstupu\n" " --label=NÃZEV použije NÃZEV jako oznaÄení standardního\n" " vstupu na výstupu\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching zobrazí pouze neprázdné Äásti odpovídajících " "řádků\n" " -q, --quiet, --silent potlaÄí obvyklý výstup\n" " --binary-files=TYP definuje typ binárních souborů\n" " TYP může být: „binary“ (binární), " "„text“ (textový)\n" " nebo „without-match“ (bez vyhovÄ›ní vzorku)\n" " -a, --text jako --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I jako --binary-files=without-match\n" " -d, --directories=AKCE jak zpracovávat adresáře. AKCE může být:\n" " „read“ (Äíst), „recurse“ (rekurze),\n" " „skip“ (pÅ™eskoÄit)\n" " -D, --devices=AKCE jak zpracovávat zařízení, FIFO (roury) a " "sockety,\n" " AKCE může být: „read“ (Äíst) nebo " "„skip“ (pÅ™eskoÄit)\n" " -r, --recursive jako --directories=recurse\n" " -R, --dereference-recursive\n" " obdobnÄ›, jen následuje vÅ¡echny symbolické " "odkazy\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB prohledá pouze soubory, které vyhovují GLOBU\n" " --exclude=GLOB pÅ™eskoÄí soubory, které vyhovují GLOBU\n" " --exclude-from=SOUBOR pÅ™eskoÄí soubory, které vyhovují jakémukoliv " "vzorku\n" " ze SOUBORU\n" " --exclude-dir=GLOB pÅ™eskoÄí adresáře, které vyhovují GLOBU\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match vypíše pouze názvy souborů, ze kterých nebyly\n" " vybrány žádné řádky\n" " -l, --files-with-matches vypíše pouze názvy souborů, ze kterých byly " "vybrány\n" " řádky\n" " -c, --count vypíše pouze poÄet vyhovujících řádků na SOUBOR\n" " -T, --initial-tab zarovná zaÄátky řádků tabulátory (je-li tÅ™eba)\n" " -Z, --null vypíše nulový bajt za jménem SOUBORU\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Řízení kontextu:\n" " -B, --before-context=POÄŒET vypíše POÄŒET řádků pÅ™ed shodou\n" " -A, --after-context=POÄŒET vypíše POÄŒET řádků za shodou\n" " -C, --context=POÄŒET vypíše POÄŒET řádků kontextu (pÅ™ed i za shodou)\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -POÄŒET stejné jako --context=POÄŒET\n" " --group-separator=ODDÄšLOVAÄŒ\n" " vypisuje ODDÄšLOVAÄŒ na řádku mezi shodami\n" " s kontextem\n" " --no-group-separator nevypisuje oddÄ›lovaÄ shod s kontextem\n" " --color[=KDY],\n" " --colour[=KDY] použije barev k rozliÅ¡ení vyhovujících " "Å™etÄ›zců,\n" " KDY může být „always“ (vždy), „never“ (nikdy)\n" " nebo „auto“ (automaticky)\n" " -U, --binary neodstraňuje znak CR na konci řádku (MSDOS/" "Windows)\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Je-li SOUBOR -, Äte standardní vstup. Ne-li SOUBOR zadán, Äte „.“,\n" "je-li přítomen pÅ™epínaÄ -r, jinak Äte standardní vstup. Jestliže jsou\n" "zadány ménÄ› než dva SOUBORY, pak je výchozí pÅ™epínaÄ -h.\n" "Návratový kód je 0 pÅ™i nalezení vyhovujícího řádku, jinak 1.\n" "Vyskytne-li se chyba a není-li zadán pÅ™epínaÄ -q, bude vrácen kód 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "zadány kolidující vzorky" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "V programu pÅ™eloženém s pÅ™epínaÄem --disable-perl-regexp nejsou perlové " "výrazy podporovány" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "neplatný syntaxe vzorku %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "neznámá metoda obsluhy zařízení" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "pozor: pÅ™epínaÄ --unix-byte-offsets (-u) je zastaralý" #: src/grep.c:2686 msgid "invalid max count" msgstr "neplatný maximální poÄet" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "neznámý typ binárního souboru" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Napsal Mike Haertel a další, vizte\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "alokace pamÄ›ti pro JIT zásobník PCRE selhala" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P podporuje pouze jednobajtová a UTF-8 národní prostÅ™edí" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "pÅ™epínaÄ -P lze být použít pouze s jedním vzorkem" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "vnitÅ™ní chyba (to by se nikdy nemÄ›lo stát)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "pÅ™ekroÄeno omezení PCRE na délku řádku" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: paměť vyÄerpána" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: JIT zásobník knihovny PCRE vyÄerpán" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: pÅ™ekroÄeno omezení PCRE na délku návratu" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: pÅ™ekroÄeno omezení PCRE na hloubku zanoÅ™ení" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: vnitÅ™ní chyba PCRE: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "pozor: promÄ›nná GREP_OPTIONS je zastaralá, prosím, použijte alias nebo " #~ "skript" #~ msgid "warning: %s: %s" #~ msgstr "varování: %s: %s" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "Domovská stránka programu %s: <https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "neplatný argument „%3$s“ u %1$s%2$s" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "neplatná přípona argumentu „%3$s“ u %1$s%2$s" #~ msgid "%s%s argument '%s' too large" #~ msgstr "argument „%3$s“ u %1$s%2$s je příliÅ¡ dlouhý" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "vnitÅ™ní chyba" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: pÅ™epínaÄ â€ž--%s“ musí být zadán bez argumentu\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: neznámý pÅ™epínaÄ â€ž--%s“\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: pÅ™epínaÄ â€ž-W %s“ není jednoznaÄný\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: pÅ™epínaÄ â€ž-W %s“ musí být zadán bez argumentu\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: pÅ™epínaÄ â€ž-W %s“ vyžaduje argument\n" #~ msgid "lseek failed" #~ msgstr "posun v souboru (lseek) se nezdaÅ™il" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "" #~ "VZOREK pÅ™edstavuje základní regulární výraz (BRE), pokud není Å™eÄeno " #~ "jinak.\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "„egrep“ znamená „grep -E“. „fgrep“ znamená „grep -F“.\n" #~ "Přímé spouÅ¡tÄ›ní příkazem „egrep“ nebo „fgrep“ je zastaralé.\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "s pÅ™epínaÄi -Pz nejsou podporovány neescapované znaky ^ a $" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Domovská stránka GNU Grepu: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "neplatná posloupnost UTF-8 bajtů ve vstupu" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "VZOREK pÅ™edstavuje rozšířený regulární výraz (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "SpouÅ¡tÄ›ní programu jako „egrep“ je zastaralé; použijte „grep -E“.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "VZOREK pÅ™edstavuje množinu Å™etÄ›zců, každý na novém řádku.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "SpouÅ¡tÄ›ní programu jako „fgrep“ je zastaralé; použijte „grep -F“.\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s umí pouze syntaxi vzorků %s" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "pÅ™epínaÄ --map nic nedÄ›lá již od roku 2010" #~ msgid "unfinished repeat count" #~ msgstr "neukonÄený zápis poÄtu opakování" #~ msgid "malformed repeat count" #~ msgstr "deformovaný zápis poÄtu opakování" #~ msgid "writing output" #~ msgstr "zapisuje se výstup" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "Schopnost „%2$s“ v GREP_COLORS=\"%1$s\" potÅ™ebuje hodnotu („=…“); " #~ "pÅ™eskoÄena" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "Schopnost „%2$s“ v GREP_COLORS=\"%1$s\" je pravdivostního typu a nemůže " #~ "nést hodnotu („=%3$s“); pÅ™eskoÄena" #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "V GREP_COLORS=\"%s\" schopnost „%s“ %s" #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "Zpracování chybnÄ› utvoÅ™eného GREP_COLORS=\"%s\" zastaveno na zbývajícím " #~ "podÅ™etÄ›zci „%s“" #~ msgid "unknown directories method" #~ msgstr "neznámá metoda obsluhy adresářů" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Řízení výstupu:\n" #~ " -m, --max-count=ÄŒÃSLO skonÄí, pokud najde ÄŒÃSLO výrazů\n" #~ " -b, --byte-offset s každým výstupním řádkem vypíše jeho pozici\n" #~ " v souboru\n" #~ " -n, --line-number s každým výstupním řádkem vypíše jeho Äíslo " #~ "řádku\n" #~ " --line-buffered vyprázdní výstup po každém řádku\n" #~ " -H, --with-filename s každým výstupním řádkem vypíše jméno " #~ "souboru\n" #~ " -h, --no-filename potlaÄí vypisování jména souboru s výst. " #~ "řádkem\n" #~ " --label=NÃZEV zobrazí NÃZEV jako název souboru na " #~ "standardním\n" #~ " vstupu\n" #~ " -o, --only-matching zobrazí pouze tu Äást řádku odpovídající " #~ "VZORKU\n" #~ " -q, --quiet, --silent potlaÄí obvyklý výstup\n" #~ " --binary-files=TYP definuje typ binárních souborů\n" #~ " TYP může být: „binary“ (binární), " #~ "„text“ (textový)\n" #~ " nebo „without-match“ (bez vyhovÄ›ní vzorku)\n" #~ " -a, --text jako --binary-files=text\n" #~ " -I jako --binary-files=without-match\n" #~ " -d, --directories=AKCE jak zpracovávat adresáře. AKCE může být:\n" #~ " „read“ (Äíst), „recurse“ (rekurze),\n" #~ " „skip“ (pÅ™eskoÄit)\n" #~ " -D, --devices=AKCE jak zpracovávat zařízení, FIFO (roury) a " #~ "sockety,\n" #~ " AKCE může být: „read“ (Äíst) nebo " #~ "„skip“ (pÅ™eskoÄit)\n" #~ " -R, -r, --recursive jako --directories=recurse\n" #~ " --include=VZOREK soubory, které vyhovují vzorku, budou " #~ "zpracovány\n" #~ " --exclude=VZOREK soubory, které vyhovují vzorku, budou " #~ "pÅ™eskoÄeny\n" #~ " --exclude-from=SOUBOR soubory, které vyhovují vzorkům ze SOUBORu, " #~ "budou\n" #~ " pÅ™eskoÄeny\n" #~ " --exclude-dir=VZOREK adresáře, které vyhovují vzorku, budou " #~ "pÅ™eskoÄeny\n" #~ " -L, --files-without-match vypíše pouze jména souborů, ve kterých nebyl\n" #~ " VZOREK nalezen\n" #~ " -l, --files-with-matches vypíše pouze jména souborů, ve kterých byl " #~ "VZOREK\n" #~ " nalezen\n" #~ " -c, --count vypíše pouze poÄet vyhovujících řádků na " #~ "SOUBOR\n" #~ " -T, --initial-tab zarovnání zaÄátků řádků tabulátory (je-li " #~ "tÅ™eba)\n" #~ " -Z, --null vypíše nulový bajt za jménem SOUBORu\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "PÅ™epínaÄe -P a -z nemohou být kombinovány" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: neznámý pÅ™epínaÄ -- %c\n" #~ msgid "Copyright (C) 2008 Free Software Foundation, Inc.\n" #~ msgstr "Copyright © 2008 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Toto je volné programové vybavení; podmínky pro kopírování a rozÅ¡iÅ™ování\n" #~ "naleznete ve zdrojových textech. Toto programové vybavení je zcela BEZ " #~ "ZÃRUKY,\n" #~ "a to i bez záruky PRODEJNOSTI nebo VHODNOSTI PRO NÄšJAKà KONKRÉTNà ÚČEL.\n" ��������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/sl.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000023701�14670377471�016215� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����P������œ��k���������È��Ï���É��÷���™��Õ��‘��¶��g ��U�� �����t �����ˆ ��,���¤ �����Ñ ��.���ñ ��'��� ��(���H�����q�����‘�����“�����—��*���¨�����Ó�����ê����������#��$���;�����`�����r����������ž�����§�����Æ�����Ö��#���ë����������*�����A�����I��&���\�����ƒ�����˜�����ª�����¼�� ���Û�����è�����ý��;�����3���P��/���„��+���´��'���à��#��������,�����L�����h�����x�����z��4���—�����Ì��!���ë��0��� ��-���>��.���l�����›��$���·�����Ü�����÷����������'�����G�����Z�����l�����}�����‘��,���¬��*���Ù�� ����� ����� ��������+�����?�����Y�� ���p����|��÷�����Í���w��Ø��E��÷����V�������m�� ���…��+���¦��#���Ò��.���ö��%���%��&���K��!���r�����”�����—�����š��,���¬�����Ù�����ó����� �����1 ��$���I �����n �����‡ �����¢ �� ���¶ ��$���Ä �����é �����þ ��(���!�����A!��s���`!�����Ô!�����Ý!��/���û!�����+"�����D"�����_"��&���|"�����£"�����¸"�����Ï"��6���ã"��/���#��+���J#��'���v#��#���ž#�����Â#�����â#�����þ#�����$�����'$�����*$��:���D$�����$��*���Ÿ$��2���Ê$��,���ý$��F���*%��*���q%��*���œ%�����Ç%�����ä%�����&�����&�����9&�����Q&�����o&�����ƒ&�����–&�����µ&��3���Ô&�����'�����!'�����:'�� ���S'�����t'�����'�����®'����������������������������3���E���K�������������� ��������������#���%�����������9���8���!���D���L���/���-������ ���������M���.�������2���J���������'������6�������)���C���0���*��������������A�������:�������$���"���I���O�������������?���1���=���,������G��� ���7������������������B���H��� ���<����������������������������+���5���(������;�������>���F��� �������N��� ��������������������&�������P���@���4���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name �%s home page: <%s> �%s: invalid option -- '%c' �%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�regular expression too big�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: GNU grep 3.0.23-b00 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2018-07-28 23:40+0200 Last-Translator: Primož Peterlin <primozz.peterlin@gmail.com> Language-Team: Slovenian <translation-team-sl@lists.sourceforge.net> Language: sl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8-bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0); � Nadzor nad kontekstom: -B, --before-context=Å T Å T vrstic konteksta pred vrstico z VZORCEM -A, --after-context=Å T Å T vrstic konteksta za vrstico z VZORCEM -C, --context=Å T Å T vrstic konteksta pred in za vrstico z VZORCEM � Razno: -s, --no-messages brez sporoÄil o napakah -v, --invert-match izberi vrstice, ki se ne ujemajo -V, --version verzija programa --help ta pomoÄ � Nadzor izhoda: -m, --max-count=Å TEVILO odnehaj po danem Å TEVILU izbranih vrstic -b, --byte-offset z izpisom odmika (v zlogih) -n, --line-number z izpisom zaporedne Å¡tevilke vrstice --line-buffered izhodni medpomnilnik izpraznimo vsako vrstico -H, --with-filename z izpisom imena datoteke -h, --no-filename brez izpisa imena datoteke --label=OZNAKA z navedeno OZNAKO, kadar beremo s standardnega vhoda � -I isto kot --binary-type=without-match -d, --directories=DEJANJE kako obravnavamo imenike DEJANJE je lahko »read«, »recurse« ali »skip« -D, --devices=DEJANJE kako obravnavamo datoteke naprav DEJANJE je lahko »read« ali »skip« -r, --recursive podobno kot --directories=recurse -R, --dereference-recursive podobno, vendar s sledenjem vseh simbolnih povezav � -L, --files-without-match le imena DATOTEK brez izbranih vrstic -l, --files-with-matches le imena DATOTEK z izbranimi vrsticami -c, --count le skupno Å¡tevilo izbranih vrstic v DATOTEKI -T, --initial-tab dodaj zaÄetni tabulator (Äe je potrebno) -Z, --null izpiÅ¡i znak NUL za imenom DATOTEKE �Spletna stran %s: <%s> �%s: neveljavna izbira -- »%c« �%s: izbira »%s%s« ne dovoljuje argumenta �%s: izbira »%s%s« ni enopomenska �%s: izbira »%s%s« ni enopomenska; možnosti:�%s: izbira »%s%s« zahteva argument �%s: izbira zahteva argument -- »%c« �%s: neprepoznana izbira »%s%s« �«�©�(standardni vhod)�-P podpira samo enobajtna kodiranja in UTF-8�Neveljaven povratni sklic�Neveljavno ime razreda znakov�Neveljaven razvrÅ¡Äevalni znak�Neveljavna vsebina \{\}�Neveljaven predhodni regularni izraz�Neveljaven konec razpona�Neveljaven regularen izraz�Pomnilnik porabljen�Brez zadetkov�ManjkajoÄ prejÅ¡nji regularni izraz�Priprava paketa: %s �Priprava paketa: %s (%s) �PredÄasen zakljuÄek regularnega izraza�Regularni izraz je preobsežen�Napake v programu %s sporoÄite na %s. Napake v prevodu sporoÄite na <translation-team-sl@lists.sourceforge.net>. �UspeÅ¡no�ZakljuÄna obratna poÅ¡evnica�Poskusite »%s --help« za dodatna pojasnila. �Neznana sistemska napaka�Uklepaj ( ali \( brez para�Zaklepaj ) ali \\) brez para�Uklepaj [, [^, [:, [. ali [= brez para�Uklepaj \{ brez para�Veljavni argumenti so:�Avtorja: %s in %s. �Avtorji: %s, %s, %s, %s, %s, %s, %s, %s, %s in drugi. �Avtorji: %s, %s, %s, %s, %s, %s, %s, %s in %s. �Avtorji: %s, %s, %s, %s, %s, %s, %s in %s. �Avtorji: %s, %s, %s, %s, %s, %s in %s. �Avtorji: %s, %s, %s, %s, %s in %s. �Avtorji: %s, %s, %s, %s in %s. �Avtorji: %s, %s, %s in %s. �Avtorji: %s, %s in %s. �Avtor(ica): %s. �»�dvoumni argument %s za %s�skladnja imena razreda znakov je [[:space:]], ne [:space:]�podana navodila si nasprotujejo�prekoraÄena meja PCRE za dolžino vrstice�pomnilnika za sklad PCRE JIT se ni uspelo dodeliti�vrnitev v zaÄetni delovni imenik ni mogoÄa�nastavitev deskriptorja datoteke za tekstovni/binarni naÄin ni uspela�vhod je prevelik, da bi ga mogli preÅ¡teti�interna napaka (to tega ne bi smelo priti)�neveljavni argument %s za %s�neveljavno ime razreda znakov�neveljavna vsebina \{\}�velikost konteksta ni veljavna�neveljaven ujemalnik %s�neveljavno najveÄje Å¡tevilo�pomnilnik porabljen�skladnja ni podana�regularni izraz je preobsežen�izbira -P podpira le en vzorec�trenutnega delovnega imenika ni mogoÄe zabeležiti�uklepaj ( brez zaklepaja�zaklepaj ) brez uklepaja�uklepaj [ brez zaklepaja�nedokonÄano ubežno zaporedje \�neznan tip binarne datoteke�neznana metoda datotek naprav�napaka pri pisanju����������������������������������������������������������������kbuild-3608/src/grep/po/be.po�����������������������������������������������������������������������0000664�0001750�0001750�00000067771�14670377450�016035� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. # Ales Nyakhaychyk <nab@mail.by>, 2001-2003. msgid "" msgstr "" "Project-Id-Version: grep 2.5g\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2003-07-22 17:18+0300\n" "Last-Translator: Ales Nyakhaychyk <nab@mail.by>\n" "Language-Team: Belarusian <i18n@mova.org>\n" "Language: be\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: KBabel 0.9.6\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "" #: lib/dfa.c:896 #, fuzzy msgid "unbalanced [" msgstr "ÐÐµÑžÑ€Ð°ÑžÐ½Ð°Ð²Ð°Ð¶Ð°Ð½Ð°Ñ [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" #: lib/dfa.c:1210 #, fuzzy msgid "unfinished \\ escape" msgstr "ÐÐµÐ·Ð°Ð²ÐµÑ€ÑˆÐ°Ð½Ð°Ñ \\ ÐºÑ–Ñ€ÑƒÑŽÑ‡Ð°Ñ Ð¿Ð°ÑьлÑдоўнаÑьць" #: lib/dfa.c:1371 #, fuzzy msgid "invalid content of \\{\\}" msgstr "недапушчальны найбольшы лічыльнік" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "" #: lib/dfa.c:1858 #, fuzzy msgid "unbalanced (" msgstr "ÐÐµÑžÑ€Ð°Ð²Ð°Ð¶Ð°Ð½Ð°Ñ (" #: lib/dfa.c:1975 #, fuzzy msgid "no syntax specified" msgstr "СынтакÑÑ–Ñ Ð½Ñвызначаны" #: lib/dfa.c:1986 #, fuzzy msgid "unbalanced )" msgstr "ÐÐµÑžÑ€Ð°ÑžÐ½Ð°Ð²Ð°Ð¶Ð°Ð½Ð°Ñ )" #: lib/error.c:195 msgid "Unknown system error" msgstr "ÐевÑÐ´Ð¾Ð¼Ð°Ñ ÑÑ‹ÑÑ‚ÑÐ¼Ð½Ð°Ñ Ð¿Ð°Ð¼Ñ‹Ð»ÐºÐ°" #: lib/getopt.c:278 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: выбар \"%s\" неадназначны\n" #: lib/getopt.c:284 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: выбар \"%s\" неадназначны\n" #: lib/getopt.c:319 #, fuzzy, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: нераÑпазнаны выбар \"%c%s\n" #: lib/getopt.c:345 #, fuzzy, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: выбар \"%c%s\" не дазвалÑе довад\n" #: lib/getopt.c:360 #, fuzzy, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: выбар \"%s\" патрабуе довад\n" #: lib/getopt.c:621 #, fuzzy, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: нерÑчаіÑны выбар -- %c\n" #: lib/getopt.c:636 lib/getopt.c:682 #, fuzzy, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: выбар патрабуе довад -- %c\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "памÑць вычарпана" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "\"" #: lib/quotearg.c:356 msgid "'" msgstr "\"" #: lib/regcomp.c:135 msgid "Success" msgstr "" #: lib/regcomp.c:138 msgid "No match" msgstr "" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "ПамÑць вычарпана" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "" #: src/grep.c:649 msgid "(standard input)" msgstr "(Ñтандартны ўвод)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "недапушчальны довад даўжыні кантÑкÑту" #: src/grep.c:894 msgid "input is too large to count" msgstr "увод занадта вÑлікі Ð´Ð»Ñ Ð¿Ð°Ð´Ð»Ñ–ÐºÑƒ" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Супадзеньні двайковага файла %s\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "Ñ‚Ñчкі зацыклены" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "ВыкарыÑтаньне: %s [ВЫБÐР]... УЗОР [ФÐЙЛ]...\n" #: src/grep.c:1963 #, fuzzy, c-format msgid "Try '%s --help' for more information.\n" msgstr "ПаÑпрабуйце \"%s --help\" Ð´Ð»Ñ Ð±Ð¾Ð»ÑŒÑˆ падрабÑзных зьвеÑтак.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" " Шукае ўзор у файле ці Ñž Ñтандартным уводзе.\n" "Ðапрыклад: %s -i 'hello world' menu.h main.c\n" "\n" "Выбар Ñ– тлумачÑньне выразаў:\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp УЗОР - гÑта пашыраны Ñталы выраз.\n" " -F, --fixed-strings УЗОР - гÑта набор радкоў, падзеленых між Ñабой\n" " пераходамі на новы радок.\n" " -G, --basic-regexp УЗОР - гÑта аÑноўны Ñталы выраз.\n" " -P, --perl-regexp УЗОР - гÑта Ñталы выраз на Perl.\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=УЗОР ВыкарыÑтоваць УЗОР Ñк Ñталы выраз.\n" " -f, --file=ФÐЙЛ Ðтрымліваць узор з файла.\n" " -i, --ignore-case Ðе зьвÑртаць увагу на розьніцу між вÑлікімі й\n" " маленькімі літарамі.\n" " -w, --word-regexp Прымушае каб узор цалкам адпавÑдаў Ñлову.\n" " -x, --line-regexp Прымушае каб узор цалкам адпавÑдаў радку.\n" " -z, --null-data Радок даньнÑÑž павінен мець канчатак Ñž выглÑдзе\n" " нулÑвога байта, замеÑÑ‚ знака новага радка.\n" #: src/grep.c:1989 #, fuzzy, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "РазнаÑтайныÑ:\n" " -s, --no-messages ПадаўлÑць паведамленьні пра памылкі.\n" " -v, --invert-match Выбіраць нÑÑÑƒÐ¿Ð°ÑžÑˆÑ‹Ñ Ñ€Ð°Ð´ÐºÑ–.\n" " -V, --version Ðадрукаваць зьвеÑткі пра вÑÑ€Ñыю й выйÑьці.\n" " --help ÐдлюÑтраваць гÑтую даведку й выйÑьці.\n" " --mmap ВыкарыÑтоўваць memory-mapped, калі гÑта " "магчыма.\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" "\n" "Кіраваньне падтÑкÑтам:\n" " -B, --before-context=N Друкаваць N радкоў папÑÑ€ÑднÑга падтÑкÑту.\n" " -A, --after-context=N Друкаваць N радкоў наÑтупнага падтÑкÑту.\n" " -C, --context=N Друкаваць N радкоў падтÑкÑту.\n" " -N Раўназначна --context=N\n" " --color[=КÐЛІ],\n" " --colour[=КÐЛІ] ВыкарыÑтоўваць пазначальнікі, каб адрозьніваць\n" " ÑÑƒÐ¿Ð°ÑžÑˆÑ‹Ñ Ñ€Ð°Ð´ÐºÑ–. КÐЛІ можа быць: \"always\"\n" " (заўÑёды), \"never\" (ніколі) ці \"auto\".\n" " -U, --binary Ðе абразаць знакі CR на прыканцы радка (MSDOS).\n" " -u, --unix-byte-offsets ПаведамлÑць пра адлеглаÑьці такім чынам, нібыта\n" " знакі CR адÑутнічаюць наагул (MSDOS).\n" "\n" "\"egrep\" азначае \"grep -E\". \"fgrep\" азначае \"grep -F\".\n" "БÑз ФÐЙЛа, ці калі замеÑÑ‚ назвы ФÐЙЛа працÑжнік -, чытае Ñтандартны ўвод.\n" "Калі заданы менш чым два файла, працуе Ñк у выпадку выбара -h. Стан выхаду\n" "роўны 0, калі Ñ‘ Ñупадзеньні, 1, калі ÑупадзеньнÑÑž нÑма й 2 у выпадку " "памылкі.\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "заданы ÑупÑÑ€ÑÑ‡Ð»Ñ–Ð²Ñ‹Ñ Ñупадальнікі" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" #: src/grep.c:2103 #, fuzzy, c-format msgid "invalid matcher %s" msgstr "недапушчальны найбольшы лічыльнік" #: src/grep.c:2538 msgid "unknown devices method" msgstr "невÑдомы мÑтад пралад" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "недапушчальны найбольшы лічыльнік" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "невÑдомы від дваічнага файла" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 #, fuzzy msgid "the -P option only supports a single pattern" msgstr "Выбар -P непадтрымліваецца" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "памÑць вычарпана" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "" #, fuzzy, c-format #~ msgid "warning: %s: %s" #~ msgstr "Увага! %s: %s\n" #, fuzzy #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: выбар \"--%s\" не дазвалÑе довад\n" #, fuzzy #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: нераÑпазнаны выбар \"--%s\"\n" #, fuzzy #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: выбар \"-W %s\" неадназначны\n" #, fuzzy #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: выбар \"-W %s\" не дазвалÑе довады\n" #, fuzzy #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: выбар \"%s\" патрабуе довад\n" #~ msgid "unfinished repeat count" #~ msgstr "Ð½ÐµÐ·Ð°Ð²ÐµÑ€ÑˆÐ°Ð½Ð°Ñ ÐºÐ¾Ð»ÑŒÐºÐ°Ñьць паўтарÑньнÑÑž" #~ msgid "malformed repeat count" #~ msgstr "дрÑÐ½Ð½Ð°Ñ ÐºÐ¾Ð»ÑŒÐºÐ°Ñьць паўтарÑньнÑÑž" #~ msgid "out of memory" #~ msgstr "нехапае памÑці" #~ msgid "writing output" #~ msgstr "запіÑваецца вывад" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "ВыкарыÑтаньне: %s [ВЫБÐР]... УЗОР [ФÐЙЛ] ...\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Кіраваньне вывадам:\n" #~ " -m, --max-count=N Спыніцца паÑÑŒÐ»Ñ N ÑупадзеньнÑÑž.\n" #~ " -b, --byte-offset Друкаваць адлеглаÑьць байта разам з вывадам " #~ "радкоў.\n" #~ " -n, --line-number Друкаваць нумары радкоў побач з радкамі.\n" #~ " --line-buffered Скідаць вывад на кожным радку.\n" #~ " -H, --with-filename Друкаваць назву файла на кожнае Ñупадзеньне.\n" #~ " -h, --no-filename ПадаўлÑць назвы файлаў у вывадзе.\n" #~ " --label=МЕТКРДрукаваць метку Ñž ÑкаÑьці назвы файла длÑ\n" #~ " Ñтандартнага ўвода.\n" #~ " -o, --only-matching Паказываць толькі тую чаÑтку радка, ÑкаÑ\n" #~ " Ñупадае з узорам.\n" #~ " -q, --quiet, --silent ПадаўлÑць увеÑÑŒ звычайны вывад.\n" #~ " --binary-files=ВІД Задаць від двайковага файла. ÐаÑÑžÐ½Ñ‹Ñ Ð²Ñ–Ð´Ñ‹:\n" #~ " \"binary\" (двайковы), \"text\" (Ñ‚ÑкÑтавы) " #~ "ці\n" #~ " \"without-match\" (неіÑтотны).\n" #~ " -a, --text Раўназначна --binary-files=text.\n" #~ " -I Раўназначна --binary-files=without-match.\n" #~ " -d, --directories=ДЗЕЯÐЬÐЕ\n" #~ " Як апрацоўваць Ñ‚Ñчкі; ДЗЕЯÐЬÐЕ можа быць " #~ "\"read\"\n" #~ " (чытаць), \"recurse\" (Ñ€ÑкурÑыўна абходзіць) " #~ "ці\n" #~ " \"skip\" (абмінаць).\n" #~ " -D, --devices=ДЗЕЯÐЬÐЕ Як апрацоўваць прылады, FIFO й гнёзды;\n" #~ " ДЗЕЯÐЬÐЕ можа быць \"read\" (чытаць) ці\n" #~ " \"skip\" (абмінаць).\n" #~ " -R, -r, --recursive Раўназначна --directories=recurse.\n" #~ " --include=УЗОР Ðпрацоўваць файлы, Ñкі адпавÑдаюць узору.\n" #~ " --exclude=УЗОР Ðе апрацоўваць файлы, Ñкі адпавÑдаюць узору.\n" #~ " --exclude-from=ФÐЙЛ Ðбмінаць файлы, ÑÐºÑ–Ñ Ð°Ð´Ð¿Ð°Ð²Ñдаюць узору з " #~ "файла.\n" #~ " -L, --files-without-match Друкаваць толькі назвы тых файлаў, што нÑ\n" #~ " ўтрымліваюць Ñупадзеньні.\n" #~ " -l, --files-with-matches Друкаваць толькі назвы тых файлаў, што " #~ "ўтрымліваюць\n" #~ " Ñупадзеньні.\n" #~ " -c, --count Друкаваць толькі колькаÑьць Ñупаўшых радкоў " #~ "на файл.\n" #~ " -Z, --null Друкаваць 0-Ñ‹ байт паÑÑŒÐ»Ñ Ð½Ð°Ð·Ð²Ñ‹ файла.\n" #~ msgid "" #~ "\n" #~ "Report bugs to <bug-gnu-utils@gnu.org>.\n" #~ msgstr "" #~ "\n" #~ "ПаведамлÑйце пра памылкі на <bug-gnu-utils@gnu.org>.\n" #~ msgid "unknown directories method" #~ msgstr "невÑдомы мÑтад Ñ‚Ñчак" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ " ÐўтарÑÐºÑ–Ñ Ð¿Ñ€Ð°Ð²Ñ‹ © 1988, 1992-2001 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ " ГÑта вольнае праграмнае забеÑьпÑчÑньне. ГлÑдзіце зыходны Ñ‚ÑкÑÑ‚ длÑ\n" #~ "Ð¿Ð°Ð³Ð°Ð´Ð½ÐµÐ½ÑŒÐ½Ñ Ð°Ð± раÑпаўÑюджваньні. Ðе йÑнуе ÐІЯКÐЕ гарантыі, нават аб\n" #~ "магчымаÑьці выкарыÑÑ‚Ð°Ð½ÑŒÐ½Ñ Ð·ÑŒ Ñкой-небудзь мÑтай.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Выбары -P Ñ– -z Ð½Ñ Ð¼Ð¾Ð³ÑƒÑ†ÑŒ Ñ–Ñьці разам" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: недапушчальны выбар -- %c\n" �������kbuild-3608/src/grep/po/vi.po�����������������������������������������������������������������������0000664�0001750�0001750�00000072563�14670377471�016063� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Vietnamese Translation for Grep. # Bản dịch tiếng Việt dành cho Grep. # Copyright © 2016 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Clytie Siddall <clytie@riverland.net.au>, 2005-2010. # Trần Ngá»c Quân <vnwildman@gmail.com>, 2012-2014, 2015, 2016, 2017, 2018. # msgid "" msgstr "" "Project-Id-Version: grep 3.3.42\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2020-01-04 15:02+0700\n" "Last-Translator: Trần Ngá»c Quân <vnwildman@gmail.com>\n" "Language-Team: Vietnamese <translation-team-vi@lists.sourceforge.net>\n" "Language: vi\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 2.2.4\n" "X-Poedit-SourceCharset: UTF-8\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "đối số %s không hợp lệ đối vá»›i %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "đối số %s không rõ ràng đối vá»›i %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Các đối số hợp lệ là:" #: lib/c-stack.c:187 msgid "program error" msgstr "lá»—i chương trình" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "tràn ngăn xếp" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "lá»—i ghi" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "thiếu dấu ngoặc vuông mở [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "sai lá»›p ký tá»±" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "cú pháp lá»›p ký tá»± là [[:space:]], không phải [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "chưa kết thúc thoát chuá»—i \\" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "ná»™i dung cá»§a \\{\\} không hợp lệ" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "biểu thức chính quy quá lá»›n" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "thiếu dấu ngoặc đơn mở (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "chưa đưa ra cú pháp" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "thiếu dấu ngoặc đơn đóng )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Lá»—i hệ thống không rõ" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: tùy chá»n “%s%s†chưa rõ ràng\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: tùy chá»n “%s%s†chưa rõ ràng; khả năng là:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: không nhận ra tùy chá»n “%s%sâ€\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: tùy chá»n “%s%s†không không cho phép má»™t đối số\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: tùy chá»n “%s%s†cần má»™t đối số\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: tùy chá»n không hợp lệ -- “%câ€\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: tùy chá»n yêu cầu má»™t đối số -- “%câ€\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "hết bá»™ nhá»›" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "không thể ghi nhá»› được thư mục làm việc hiện thá»i" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "gặp lá»—i khi quay trở vá» thư mục làm việc khởi đầu" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "gặp lá»—i khi đặt chế độ văn bản/nhị phân cho bá»™ mô tả tập tin" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "“" #: lib/quotearg.c:356 msgid "'" msgstr "â€" #: lib/regcomp.c:135 msgid "Success" msgstr "Thành công" #: lib/regcomp.c:138 msgid "No match" msgstr "Không tìm thấy" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Biểu thức chính quy không hợp lệ" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Ký tá»± đối chiếu không hợp lệ" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Tên lá»›p ký tá»± không hợp lệ" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Dấu gạch ngược theo sau" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Tham chiếu ngược không hợp lệ" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Có ký tá»± [, [^, [:, [., hay [= lẻ cặp" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Có ký tá»± “(†hay “\\(†lẻ cặp" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Có ký tá»± “\\{†lẻ cặp" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Ná»™i dung cá»§a \\{\\} không hợp lệ" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Sai kết thúc phạm vi" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Hết bá»™ nhá»›" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Biểu thức chính quy có trước không hợp lệ" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Biểu thức chính quy kết thức quá sá»›m" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Biểu thức chính quy quá lá»›n" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Có ký tá»± “)†hay “\\)†lẻ cặp" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Không có biểu thức chính quy nằm trước" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Äóng gói bởi %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Äóng gói bởi %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Giấy phép GPL pb3+ : Giấy phép Công cá»™ng GNU phiên bản 3 hay sau <%s>.\n" "Äây là phần má»m tá»± do: bạn có quyá»n sá»­a đổi và phát hành lại nó.\n" "KHÔNG CÓ BẢO HÀNH GÃŒ CẢ, vá»›i Ä‘iá»u kiện được pháp luật cho phép.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Viết bởi %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Viết bởi %s và %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Viết bởi %s, %s và %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Viết bởi %s, %s, %s\n" "và %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Viết bởi %s, %s, %s,\n" "%s và %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Viết bởi %s, %s, %s,\n" "%s, %s và %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Viết bởi %s, %s, %s,\n" "%s, %s, %s và %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Viết bởi %s, %s, %s,\n" "%s, %s, %s, %s\n" "và %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Viết bởi %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s và %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Viết bởi %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s và má»™t số ngưá»i khác.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" "Hãy thông báo lá»—i cho: %s\n" "Hãy thông báo lá»—i dịch cho <http://translationproject.org/team/vi.html>.\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" "Hãy thông các báo lá»—i %s cho: %s\n" "Hãy thông báo lá»—i dịch cho <http://translationproject.org/team/vi.html>.\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Trang chá»§ cá»§a %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Trợ giúp chung vá» cách sá»­ dụng phần má»m GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(đầu vào tiêu chuẩn)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "đối số chiá»u dài ngữ cảnh không hợp lệ" #: src/grep.c:894 msgid "input is too large to count" msgstr "dữ liệu đầu vào quá lá»›n nên không thể đếm được" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Tập tin nhị phân “%s†khá»›p mẫu tìm kiếm\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "vòng lặp thư mục đệ quy" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "tập tin đầu vào “%s†cÅ©ng là kết xuất" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Cách dùng: %s [TÙY_CHỌN]… MẪU [TẬP_TIN]…\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Hãy chạy lệnh “%s --help†để biết thêm thông tin.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Tìm kiếm MẪU trong từng TẬP_TIN.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Ví dụ: %s -i \"chào thế giá»›i\" menu.h main.c\n" "MẪU có thể chứa nhiá»u mẫu ngăn cách nhau bằng ký tá»± dòng má»›i.\n" "\n" "Chá»n và biên dịch mẫu:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp MẪU là các biểu thức chính quy mở rá»™ng\n" " -F, --fixed-strings MẪU là các chuá»—i\n" " -G, --basic-regexp MẪU là các biểu thức chính quy cÆ¡ bản\n" " -P, --perl-regexp MẪU là các biểu thức chính quy Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=MẪU dùng MẪU để so khá»›p\n" " -f, --file=TẬP_TIN lấy MẪU từ TẬP_TIN\n" " -i, --ignore-case không phân biệt HOA/thưá»ng trong mẫu và dữ liệu\n" " --no-ignore-case phân biệt HOA/thưá»ng (mặc định)\n" " -w, --word-regexp chỉ khá»›p toàn bá»™ từ\n" " -x, --line-regexp chỉ khá»›p toàn bá»™ dòng\n" " -z, --null-data má»™t dòng dữ liệu kết thúc bằng byte 0,\n" " không phải ký tá»± dòng má»›i\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Há»—n tạp:\n" " -s, --no-messages chặn các thông báo lá»—i\n" " -v, --invert-match chá»n các dòng không khá»›p\n" " -V, --version in ra thông tin phiên bản rồi thoát\n" " --help hiển thị trợ giúp này rồi thoát\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Äiá»u khiển kết xuất:\n" " -m, --max-count=Sá» dừng sau khi khá»›p được Sá» lần\n" " -b, --byte-offset in ra vị trí tương đối tính theo byte\n" " cùng vá»›i dòng kết xuất\n" " -n, --line-number in ra số thứ tá»± dòng cùng vá»›i dòng kết xuất\n" " --line-buffered xóa sạch kết xuất trên từng dòng\n" " -H, --with-filename in ra tên tập tin cho từng dòng đầu ra\n" " -h, --no-filename chặn tiá»n tố tên tập tin khi xuất\n" " --label=NHÃN sá»­ dụng NHÃN này làm tiá»n tố cho tập tin\n" " cho đầu ra tiêu chuẩn\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching chỉ hiển thị phần dòng không rá»—ng khá»›p vá»›i MẪU\n" " -q, --quiet, --silent chặn má»i kết xuất bình thưá»ng\n" " --binary-files=KIỂU coi rằng tập tin nhị phân có KIỂU:\n" " * “binary†nhị phân\n" " * “text†dạng chữ\n" " * “without-match†không khá»›p\n" " -a, --text giống vá»›i tùy chá»n “--binary-files=textâ€\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I giống vá»›i “--binary-files=without-matchâ€\n" " -d, --directories=HÀNH_VI cách quản lý các thư mục. HÀNH_VI là:\n" " * “read†đá»c\n" " * “recurse†đệ quy\n" " * “skip†bá» qua\n" " -D, --devices=HÀNH_VI cách quản lý các thiết bị, FIFO và socket;\n" " HÀNH_VI:\n" " * “read†đá»c\n" " * “skip†bá» qua\n" " -r, --recursive giống vá»›i tùy chá»n “--directories=recurseâ€\n" " -R, --dereference-recursive cÅ©ng vậy nhưng cho phép cả các liên kết má»m\n" #: src/grep.c:2023 #, fuzzy, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB chỉ tìm kiếm những tập tin khá»›p vá»›i GLOB (mẫu " "tập tin)\n" " --exclude=GLOB bá» qua những tập tin và thư mục khá»›p vá»›i GLOB\n" " --exclude-from=TỆP bá» qua những tập tin khá»›p vá»›i bất cứ mẫu tập\n" " tin trong tập tin này\n" " --exclude-dir=GLOB thư mục nào khá»›p vá»›i mẫu này thì bị bá» qua\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match chỉ in ra tên cá»§a các TẬP TIN không khá»›p mẫu\n" " -l, --files-with-matches chỉ in ra tên cá»§a các TẬP TIN khá»›p mẫu\n" " -c, --count chỉ in ra số lượng dòng khá»›p trong má»—i TẬP TIN\n" " -T, --initial-tab sắp hàng cá»™t tab (nếu cần)\n" " -Z, --null in ra byte 0 (null) đằng sau tên TẬP TIN\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Äiá»u khiển ngữ cảnh:\n" " -B, --before-context=Sá» in ra Sá» dòng ngữ cảnh Ä‘i trước\n" " -A, --after-context=Sá» in ra Sá» dòng ngữ cảnh Ä‘i sau\n" " -C, --context=Sá» in ra Sá» dòng ngữ cảnh kết xuất\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM giống vá»›i “--context=Sá»â€\n" " --color[=KHI],\n" " --colour[=KHI] đánh dấu để tô sáng các chuá»—i khá»›p; KHI là:\n" " * “always†luôn luôn\n" " * “never†không bao giá»\n" " * “auto†tá»± động\n" " -U, --binary đừng gỡ bá» các ký tá»± CR ở kết thúc dòng (EOL)\n" " (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Khi TẬP_TIN là “-â€, thì Ä‘á»c từ đầu vào tiêu chuẩn. Không có TẬP_TIN, Ä‘á»c “.†" "nếu\n" "đệ quy, “-†nếu không phải vậy. Nếu ít hÆ¡n hai TẬP_TIN thì coi là “-hâ€.\n" "Trạng thái thoát là 0 nếu có dòng (hay tập tin nếu -L) nào khá»›p mẫu, không " "thì bằng 1;\n" "nếu có lá»—i phát sinh và “-q†không được đưa ra thì trạng thái thoát là 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "đã ghi rõ dữ liệu khá»›p mà xung đột" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "Không há»— trợ khá»›p mẫu perl khi biên dịch vá»›i --disable-perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "sai mẫu so khá»›p %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "không rõ phương thức thiết bị" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "số lượng tối Ä‘a không hợp lệ" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "không rõ kiểu tập tin nhị phân (binary-files)" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "ÄÆ°á»£c viết bởi Mike Haertel và nhiá»u ngưá»i khác, xem tại\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "gặp lá»—i khi cấp phát bá»™ nhá»› cho stack (ngăn xếp) PCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P chỉ há»— trợ miá»n địa phương unibyte và UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "tùy chá»n “-P†chỉ há»— trợ má»™t mẫu đơn lẻ" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "lá»—i ná»™i bá»™ (không nên xảy ra như thế)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "đã vượt quá giá»›i hạn chiá»u dài dòng cá»§a PCRE" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "hết bá»™ nhá»›" #: src/pcresearch.c:310 #, fuzzy, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "ngăn xếp “PCRE JIT†đã hết" #: src/pcresearch.c:315 #, fuzzy, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "đã vượt quá giá»›i hạn tìm ngược cá»§a PCRE" #: src/pcresearch.c:319 #, fuzzy, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "đã vượt quá giá»›i hạn tìm ngược cá»§a PCRE" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "lá»—i ná»™i bá»™ PCRE: %d" #, c-format #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "cảnh báo: GREP_OPTIONS đã lá»—i thá»i; vui lòng dòng má»™t bí danh hoặc văn " #~ "lệnh" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "cảnh báo: %s: %s" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "Trang chá»§ %s: <https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "đối số %s%s không hợp lệ “%sâ€" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "hậu tố không hợp lệ trong %s%s đối số “%sâ€" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s đối số “%s†quá lá»›n" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "lá»—i ná»™i bá»™" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: tùy chá»n “--%s†không cho phép có đối số\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: không nhận ra tùy chá»n “--%sâ€\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: tùy chá»n “-W %s†chưa rõ ràng\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: tùy chá»n “-W %s†không cho phép đối số\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: tùy chá»n “-W %s†yêu cầu má»™t đối số\n" #~ msgid "lseek failed" #~ msgstr "lseek gặp lá»—i" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "MẪU, theo mặc định, là má»™t biểu thức chính quy cÆ¡ bản (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "“egrep†nên là “grep -Eâ€, “fgrep†nên là “grep -Fâ€.\n" #~ "Không tán thành gá»i trá»±c tiếp “egrep†cÅ©ng như “fgrepâ€.\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "không thoát ^ hay $ không được há»— trợ vá»›i -Pz" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Trang chá»§ cá»§a GNU Grep: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "chuá»—i byte UTF-8 không hợp lệ ở đầu vào" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "MẪU là má»™t biểu thức chính quy mở rá»™ng (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "Không tán thành việc gá»i như “egrep†nên thay thế bằng “grep -Eâ€.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "" #~ "MẪU là má»™t tập hợp các chuá»—i cố định phân cách bằng ký tá»± dòng má»›i.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "Không tán thành việc gá»i như “fgrep†nên thay thế bằng “grep -Fâ€.\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s chỉ có khả năng sá»­ dụng cú pháp mẫu %s" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "tùy chá»n --mmap không còn được thá»±c thi kể từ năm 2010" #~ msgid "unfinished repeat count" #~ msgstr "chưa kết thúc sá»± đếm lặp lại" #~ msgid "malformed repeat count" #~ msgstr "sá»± đếm lặp lại dạng sai" #~ msgid "writing output" #~ msgstr "Ä‘ang ghi kết xuất" #~ msgid "" #~ "in GREP_COLORS='%s', the `%s' capacity needs a value ('=...'); skipped" #~ msgstr "" #~ "trong chuá»—i “GREP_COLORS=“%sâ€, khả năng “%s†cần giá trị (“=…â€); nên bá» " #~ "qua" #~ msgid "" #~ "in GREP_COLORS='%s', the `%s' capacity is boolean and cannot take a value " #~ "('=%s'); skipped" #~ msgstr "" #~ "trong chuá»—i “GREP_COLORS=“%sâ€, khả năng “%s†là luận lý thì không chấp " #~ "nhận được giá trị (“=%sâ€); nên bá» qua" #~ msgid "in GREP_COLORS='%s', the `%s' capacity %s" #~ msgstr "trong GREP_COLORS=“%sâ€, khả năng “%s†%s" #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS='%s' at remaining substring `" #~ "%s'" #~ msgstr "" #~ "đã dừng xá»­ lý chuá»—i GREP_COLORS=“%s†dạng sai ở chuá»—i con còn lại “%sâ€" ���������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/POTFILES.in�����������������������������������������������������������������0000664�0001750�0001750�00000001722�14670377450�016644� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# List of files which containing translatable strings. # # Copyright 1997-1998, 2005-2021 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, 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 <https://www.gnu.org/licenses/>. lib/argmatch.c lib/argmatch.h lib/c-stack.c lib/closeout.c lib/dfa.c lib/error.c lib/getopt.c lib/obstack.c lib/openat-die.c lib/xbinary-io.c lib/quotearg.c lib/regcomp.c lib/version-etc.c lib/xalloc-die.c src/grep.c src/pcresearch.c ����������������������������������������������kbuild-3608/src/grep/po/it.po�����������������������������������������������������������������������0000664�0001750�0001750�00000056450�14670377471�016056� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Italian translation of grep # Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2018 Free Software Foundation, Inc. # Copyright (C) 2020 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # Marco d'Itri <md@linux.it>, 1999, 2001. # Milo Casagrande <milo@milo.name>, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2018, 2020. # msgid "" msgstr "" "Project-Id-Version: grep-3.5.16\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2020-11-14 15:55+0100\n" "Last-Translator: Milo Casagrande <milo@milo.name>\n" "Language-Team: Italian <tp@lists.linux.it>\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" "X-Generator: Poedit 2.4.1\n" "X-Poedit-SourceCharset: UTF-8\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "argomento %s per %s non valido" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "argomento %s ambiguo per %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Gli argomenti validi sono:" #: lib/c-stack.c:187 msgid "program error" msgstr "errore del programma" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "overflow dello stack" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "errore di scrittura" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ non bilanciata" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "Classe del carattere non valido" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "La sintassi per la classe di caratteri è [[:space:]], non [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "Escape \\ incompleto" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "Contenuto di \\{\\} non valido" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "Espressione regolare troppo grande" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( non bilanciata" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "Nessuna sintassi specificata" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") non bilanciata" #: lib/error.c:195 msgid "Unknown system error" msgstr "Errore di sistema sconosciuto" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: l'opzione \"%s%s\" è ambigua\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: l'opzione \"%s%s\" è ambigua. Possibilità:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: opzione \"%s%s\" non riconosciuta\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: l'opzione \"%s%s\" non accetta argomenti\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: l'opzione \"%s%s\" richiede un argomento\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: opzione non valida -- \"%c\"\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: l'opzione richiede un argomento -- \"%c\"\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "memoria esaurita" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "impossibile registrare la directory di lavoro attuale" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "errore nel restituire la directory di lavoro iniziale" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" "impostazione del descrittore file in modalità testo/binario non riuscita" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "\"" #: lib/quotearg.c:356 msgid "'" msgstr "\"" #: lib/regcomp.c:135 msgid "Success" msgstr "Successo" #: lib/regcomp.c:138 msgid "No match" msgstr "Nessuna corrispondenza" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Espressione regolare non valida" # (ndt) http://en.wikipedia.org/wiki/Collation #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Carattere di collazione non valido" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Nome classe del carattere non valido" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Backslash finale" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Riferimento all'indietro non valido" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[, [^, [:, [., o [= senza corrispondenza" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( o \\( senza corrispondenza" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ senza corrispondenza" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Contenuto di \\{\\} non valido" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Limite massimo non valido" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Memoria esaurita" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Espressione regolare precedente non valida" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Fine prematura dell'espressione regolare" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Espressione regolare troppo grande" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") o \\) senza corrispondenza" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Nessuna espressione regolare precedente" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Pacchetto creato da %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Pacchetto creato da %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licenza GPLv3+: GNU GPL versione 3 o successiva <%s>.\n" "Questo programma è software libero: siete liberi di modificarlo e " "ridistribuirlo.\n" "Non c'è ALCUNA GARANZIA, per quanto consentito dalle vigenti normative.\n" "\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Scritto da %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Scritto da %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Scritto da %s, %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Scritto da %s, %s, %s\n" "e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Scritto da %s, %s, %s,\n" "%s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Scritto da %s, %s, %s,\n" "%s, %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Scritto da %s, %s, %s,\n" "%s, %s, %s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Scritto da %s, %s, %s,\n" "%s, %s, %s, %s\n" "e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Scritto da %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s e %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Scritto da %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s e altri.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Segnalare i bug a: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Segnalare i bug di %s a: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Sito web di %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Pagina di aiuto per l'utilizzo di software GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(standard input)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "argomento della lunghezza del contesto non valido" #: src/grep.c:894 msgid "input is too large to count" msgstr "l'input è troppo grande per essere contato" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: il file binario corrisponde" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: attenzione: ciclo ricorsivo di directory" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: il file di input è anche l'output" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Uso: %s [OPZIONE]... MODELLI [FILE]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Usare \"%s --help\" per ulteriori informazioni.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Cerca MODELLI in ogni FILE\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Esempio: %s -i \"ciao mondo\" menu.h main.c\n" "MODELLI può contenere diversi modelli separati da newline.\n" "\n" "Selezione e interpretazione del modello:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp MODELLI sono espressioni regolari estese\n" " -F, --fixed-strings MODELLI sono stringhe\n" " -G, --basic-regexp MODELLI sono espressioni regolari semplici\n" " -P, --perl-regexp MODELLI sono espressioni regolari Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=MODELLI Usa MODELLI per la corrispondenza\n" " -f, --file=FILE Ottiene i MODELLI dal FILE\n" " -i, --ignore-case Ignora la distinzione maiuscole/minuscole\n" " --no-ignore-case Non ignora la distinzione maiuscole/minuscole\n" " (predefinito)\n" " -w, --word-regexp Corrispondere solo a parole intere\n" " -x, --line-regexp Corrispondere solo a righe intere\n" " -z, --null-data Una riga di dati termina con il byte 0 invece " "che\n" " newline\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Varie:\n" " -s, --no-messages Elimina i messaggi di errore\n" " -v, --invert-match Seleziona le righe che non corrispondono\n" " -V, --version Stampa la versione ed esce\n" " --help Visualizza questo aiuto ed esce\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Controllo dell'output:\n" " -m, --max-count=NUM Si ferma dopo NUM righe selezionate\n" " -b, --byte-offset Stampa l'offset del byte con le righe di output\n" " -n, --line-number Stampa il numero della riga con le righe di " "output\n" " --line-buffered Esegue il flush dell'output con ogni riga\n" " -H, --with-filename Stampa il nome del file con le righe di output\n" " -h, --no-filename Elimina il nome del file dall'output\n" " --label=ETICH Usa ETICH come nome del file per lo standard " "input\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching Mostra solo la parte della riga che corrisponde\n" " -q, --quiet, --silent Elimina tutto l'output normale\n" " --binary-files=TIPO Suppone che i file binari siano del TIPO \"binary" "\",\n" " \"text\" oppure \"without-match\"\n" " -a, --text Equivale a --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I Equivale a --binary-files=without-match\n" " -d, --directories=AZIONE Come gestire le directory: AZIONE è \"read\",\n" " \"recurse\" o \"skip\"\n" " -D, --devices=AZIONE Come gestire device, FIFO e socket: AZIONE è\n" " \"read\" o \"skip\"\n" " -r, --recursive Equivale a --directories=recurse\n" " -R, --dereference-recursive\n" " Simile al precedente, ma segue i collegamenti\n" " simbolici\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB Esamina solo i file corrispondenti a GLOB " "(modello di file)\n" " --exclude=GLOB Salta file corrispondenti a GLOB\n" " --exclude-from=FILE Salta i file corrispondenti ai modelli nel FILE\n" " --exclude-dir=GLOB Salta le directory corrispondenti a GLOB\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match Stampa solo i nomi dei FILE senza righe " "selezionate\n" " -l, --files-with-matches Stampa solo i nomi dei FILE con righe " "selezionate\n" " -c, --count Stampa solo il conteggio delle righe selezionate " "in\n" " ogni FILE\n" " -T, --initial-tab Allinea le tabulazioni (se necessario)\n" " -Z, --null Stampa il byte 0 dopo ogni nome di FILE\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Controllo del contesto:\n" " -B, --before-context=NUM Stampa NUM righe di contesto precedente\n" " -A, --after-context=NUM Stampa NUM righe di contesto seguente\n" " -C, --context=NUM Stampa NUM righe di contesto dell'output\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM Come --context=NUM\n" " --color[=QUANDO],\n" " --colour[=QUANDO] Usa i colori per distinguere le stringhe\n" " corrispondenti; QUANDO può essere \"always\", " "\"never\"\n" " o \"auto\"\n" " -U, --binary Non rimuove i caratteri CR all'EOL (MSDOS/" "Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Se FILE è \"-\", legge lo standard input; se non c'è alcun FILE, legge \".\" " "se in\n" "modalità ricorsiva, altrimenti \"-\". Se sono stati specificati meno di due " "FILE\n" "presume -h. Esce con lo stato 0 se è stata selezionata almeno una riga,\n" "1 altrimenti. Se si verifica un errore e l'opzione -q non è\n" "stata usata, lo stato di uscita è 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "specificate corrispondenze in conflitto" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Corrispondenze Perl non supportate: questo binario è compilato con --disable-" "perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "corrispondenza %s non valida" #: src/grep.c:2538 msgid "unknown devices method" msgstr "metodo per i device sconosciuto" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "numero massimo non valido" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "tipo di file binario sconosciuto" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Creato da Mike Haertel e altri; consultare\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "impossibile allocare memoria per lo stack PCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P supporta solamente lingue unibyte e UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "l'opzione -P supporta un solo modello" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "errore interno (non si dovrebbe mai verificare)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "limite di lunghezza riga PCRE raggiunto" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: memoria esaurita" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: stack JIT PCRE esaurito" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: limite di backtrack PCRE raggiunto" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: limite di ricorsione PCRE superato" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: errore interno PCRE: %d" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/ro.po�����������������������������������������������������������������������0000664�0001750�0001750�00000077060�14670377471�016062� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Mesajele în limba română pentru grep. # This file is distributed under the same license as the grep package. # Copyright (C) 2003 Free Software Foundation, Inc. # Eugen Hoanca <eugenh@urban-grafx.ro>, 2003. # Florentina MuÈ™at <florentina.musat.28@gmail.com>, 2020. # msgid "" msgstr "" "Project-Id-Version: grep 3.3.42\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2020-06-24 11:09+0300\n" "Last-Translator: Florentina MuÈ™at <florentina.musat.28@gmail.com>\n" "Language-Team: Romanian <translation-team-ro@lists.sourceforge.net>\n" "Language: ro\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Poedit 2.3.1\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "argument nevalid %s pentru %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "argument ambiguu %s pentru %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Argumentele valide sunt:" #: lib/c-stack.c:187 msgid "program error" msgstr "eroare de program" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "supraplin de stivă" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "eroare de scriere" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ nebalansat" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "clasă de caractere nevalidă" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "sintaxa de clasă de caractere este [[:spaÈ›iu:]], nu [:spaÈ›iu]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "\\ escape neterminat" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "\\{\\} conÈ›inut nevalid" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "expresia regulată este prea mare" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( nebalansat" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "nu s-a specificat nicio sintaxă" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") nebalansat" #: lib/error.c:195 msgid "Unknown system error" msgstr "Eroare de sistem necunoscută" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: opÈ›iunea „%s%s†este ambiguă\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: opÈ›iunea „%s%s†este ambiguă; posibilități:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: opÈ›iunea nerecunoscută „%s%sâ€\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: opÈ›iunea „%s%s†nu permite un argument\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: opÈ›iunea „%s%s†necesită un argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: opÈ›iune nevalidă -- „%câ€\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: opÈ›iunea necesită un argument -- „%câ€\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "memorie plină" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "nu s-a putut înregistra directorul de lucru curent" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "nu s-a putut întoarce la directorul de lucru iniÈ›ial" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "nu s-a putut stabili modul de text/binar al descriptorului de fiÈ™ier" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "Succes" #: lib/regcomp.c:138 msgid "No match" msgstr "Nu există potrivire" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Expresie regulată nevalidă" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Caracter de ordine alfabetică nevalid" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Nume de clasă de caracter nevalid" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Linie oblică inversă de urmărire" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Referință înapoi nevalidă" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[, [^, [:, [., sau [= fără pereche" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( sau \\( fără pereche" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ fără pereche" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "ConÈ›inut nevalid al \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "SfârÈ™it de interval nevalid" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Memorie plină" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Expresie regulată precedentă nevalidă" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "SfârÈ™it prematur al expresiei regulate" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Expresie regulată prea mare" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") sau \\) fără pereche" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Nu există o expresie regulată anterioară" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "ÃŽmpachetat de %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "ÃŽmpachetat de %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "LicenÈ›a GPLv3+: GNU GPL versiunea 3 sau mai mare <%s>.\n" "Acesta este software liber: sunteÈ›i liber să îl modificaÈ›i È™i să îl " "redistribuiÈ›i.\n" "NU există NICIO GARANÈšIE, în măsura permisă de lege.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Scris de %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Scris de %s È™i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Scris de %s, %s È™i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Scris de %s, %s, %s,\n" "È™i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Scris de %s, %s, %s,\n" "%s, È™i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Scris de %s, %s, %s,\n" "%s, %s, È™i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Scris de %s, %s, %s,\n" "%s, %s, %s, È™i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Scris de %s, %s, %s,\n" "%s, %s, %s, %s,\n" "È™i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Scris de %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, È™i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Scris de %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, È™i alÈ›ii.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "RaportaÈ›i defecÈ›iunile la: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "RaportaÈ›i defecÈ›iunile %s la: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s pagină principală: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Ajutor general utilizând software GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(intrare standard)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "parametru lungime context invalid" #: src/grep.c:894 msgid "input is too large to count" msgstr "intrarea(input) este prea mare pentru numărare" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "FiÅŸierul binar %s corespunde\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "buclă recursivă de directoare" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "fiÈ™ierul de intrare %s este de asemenea È™i ieÈ™irea" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Utilizare: %s [OPÈšIUNE]... MODELE [FIȘIER]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "ÃŽncercaÈ›i „%s --help†pentru mai multe informaÈ›ii.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Caută pentru MODELE în fiecare FIȘIER.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Exemplu: %s -i 'hello world' menu.h main.c\n" "MODELELE pot conÈ›ine modele multiple separate prin linii noi.\n" "\n" "Selectarea modelelor È™i interpretarea:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp MODELELE sunt expresii regulate extinse\n" " -F, --fixed-strings MODELELE sunt È™iruri\n" " -G, --basic-regexp MODELELE sunt expresii regulate de bază\n" " -P, --perl-regexp MODELELE sunt expresii regulate PERL\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=MODELE utilizează MODELELE pentru potrivire\n" " -f, --file=FIȘIER ia MODELELE de la FIȘIER\n" " -i, --ignore-case ignoră distincÈ›iile de majuscule în modele È™i " "date\n" " --no-ignore-case nu ignora distincÈ›iile de majuscule (implicit)\n" " -w, --word-regexp potriveÈ™te doar cuvinte întregi\n" " -x, --line-regexp potriveÈ™te doar linii întregi\n" " -z, --null-data o linie de date se termină în octetul 0, nu în " "linie nouă\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Diverse:\n" " -s, --no-messages suprimă mesajele de eroare\n" " -v, --invert-match selectează liniile care nu se potrivesc\n" " -V, --version afiÈ™ează informaÈ›iile de versiune È™i ieÈ™i\n" " --help afiÈ™ează acest text de ajutor È™i ieÈ™i\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Control de ieÈ™ire:\n" " -m, --max-count=NUM opreÈ™te după NUM linii selectate\n" " -b, --byte-offset tipăreÈ™te decalajul de octet cu liniile de " "ieÈ™ire\n" " -n, --line-number tipăreÈ™te numărul liniei cu liniile de ieÈ™ire\n" " --line-buffered goleÈ™te ieÈ™irea la fiecare linie\n" " -H, --with-filename tipăreÈ™te numele fiÈ™ierului cu liniile de " "ieÈ™ire\n" " -h, --no-filename suprimă prefixul numelui de fiÈ™ier la ieÈ™ire\n" " --label=ETICHETÄ‚ utilizează ETICHETÄ‚ ca prefixul numelui de " "fiÈ™ier de intrare standard\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching arată doar părÈ›ile pline ale liniilor care se " "potrivesc\n" " -q, --quiet, --silent suprimă toată ieÈ™irea normală\n" " --binary-files=TIP presupune că fiÈ™ierele binare sunt TIP;\n" " TIP este „binarâ€, „text†sau „fără-potrivireâ€\n" " -a, --text echivalent cu --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I echivalent cu --binary-files=fără-potrivire\n" " -d, --directories=ACÈšIUNE cum să se manipuleze directoarele;\n" " ACÈšIUNE este „citeÈ™teâ€, „recursivitateâ€, sau " "„omiteâ€\n" " -D, --devices=ACÈšIUNE cum să se manipuleze dispozitive, FIFO-uri È™i " "socluri;\n" " ACÈšIUNE este „citeÈ™te†sau „omiteâ€\n" " -r, --recursive like --directories=recursivitate\n" " -R, --dereference-recursive de asemenea, dar urmăreÈ™te toate legăturile " "simbolice\n" #: src/grep.c:2023 #, fuzzy, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB caută doar fiÈ™iere care se potrivesc cu GLOB (un " "model de fiÈ™ier)\n" " --exclude=GLOB omite fiÈ™ierele È™i directoarele care se " "potrivesc cu GLOB\n" " --exclude-from=FIȘIER omite fiÈ™ierele care se potrivesc oricărui " "model de la FIȘIER\n" " --exclude-dir=GLOB omite directoarele care se potrivesc cu GLOB\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match tipăreÈ™te doar numele de FIȘIERE fără linii " "selectate\n" " -l, --files-with-matches tipăreÈ™te doar numele de FIȘIERE cu linii " "selectate\n" " -c, --count tipăreÈ™te doar un număr al liniilor selectate " "per FIȘIER\n" " -T, --initial-tab face ca tab-urile să fie aliniate (dacă este " "nevoie)\n" " -Z, --null tipăreÈ™te octetul 0 după numele de FIȘIER\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Control de context:\n" " -B, --before-context=NUM tipăreÈ™te NUM linii ale contextului de început\n" " -A, --after-context=NUM tipăreÈ™te NUM linii ale contextului de urmărire\n" " -C, --context=NUM tipăreÈ™te NUM linii al contextului de ieÈ™ire\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM la fel ca--context=NUM\n" " --color[=CÂND],\n" " --colour[=CÂND] utilizează markere pentru a evidenÈ›ia È™irurile " "care se potrivesc;\n" " CÂND este „totdeaunaâ€, „niciodată†sau „autoâ€\n" " -U, --binary nu elimina caracterele CR la EOL (MSDOS/" "Windows)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Când FILE este „-â€, citeÈ™te intrarea standard. Cu niciun FIȘIER, citeÈ™te " "„.†dacă\n" "este recursiv,„-†altfel. Cu mai puÈ›in de două FIȘIERE, presupune -h.\n" "Starea de ieÈ™ire este 0 dacă orice linie (sau fiÈ™ier dacă -L) este " "selectată, 1 altfel;\n" "dacă orice eroare se întâmplă -q nu este dat, starea de ieÈ™ire este 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "conflicte între căutătorii (matchers) specificaÅ£i" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Potrivirea Perl nu este suportată într-o generare --disable-perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "potrivire nevalidă %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "metodă dispozitive(devices) necunoscută" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "numărare maximă invalidă" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "tip fiÅŸiere-binare necunoscut" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Scris de Mike Haertel È™i alÈ›ii; consultaÈ›i\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "nu s-a putut aloca memorie pentru stiva PCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P suportă doar localizări unioctet È™i UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "opÈ›iunea -P suportă doar un singur model" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "eroare internă (nu ar trebui să se întâmple vreodată)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "s-a depășit limita de lungime a liniei al PCRE" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "memorie plină" #: src/pcresearch.c:310 #, fuzzy, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "s-a epuizat stiva PCRE JIT" #: src/pcresearch.c:315 #, fuzzy, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "s-a depășit limita de backtracking al PCRE" #: src/pcresearch.c:319 #, fuzzy, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "s-a depășit limita de backtracking al PCRE" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "eroare PCRE internă: %d" #, c-format #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "avertisment: GREP_OPTIONS este depășit; utilizaÈ›i un alias sau un script" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "avertisment: %s: %s" #~ msgid "unfinished repeat count" #~ msgstr "numărare repetată neterminată" #~ msgid "malformed repeat count" #~ msgstr "numărare repetată malformată" #~ msgid "out of memory" #~ msgstr "memorie plină" #~ msgid "writing output" #~ msgstr "scriere output" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Folosire: %s [OPÅ¢IUNE]... TIPAR [FIÅžIER]...\n" #~ msgid "" #~ "Search for PATTERN in each FILE or standard input.\n" #~ "Example: %s -i 'hello world' menu.h main.c\n" #~ "\n" #~ "Regexp selection and interpretation:\n" #~ msgstr "" #~ "Caută după TIPAR în fiecare FIÅŸIER sau de la intrare standard.\n" #~ "Exemplu: %s -i 'hello world' menu.h main.c\n" #~ "\n" #~ "SelecÅ£ie ÅŸi interpretare regexp:\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Control ieÅŸire (output)l:\n" #~ " -m, --max-count=NUM oprire după NUM potriviri\n" #~ " -b, --byte-offset tipăreÅŸte locaÅ£ia (byte offset) cu liniile " #~ "rezultate\n" #~ " -n, --line-number tipăreÅŸte numărul liniei cu liniile " #~ "rezultate\n" #~ " --line-buffered înnoieÅŸte (flush) outputul la fiecare linie\n" #~ " -H, --with-filename tipăreÅŸte numele de fiÅŸier care corespund\n" #~ " -h, --no-filename suprimă prefixarea cu nume de fiÅŸier la " #~ "output\n" #~ " --label=ETICHETÄ‚ tipăreÅŸte ETICHETÄ‚ ca nume fiÅŸier pentru " #~ "intrare standard\n" #~ " -o, --only-matching afiÅŸează doar o parte a unei linii " #~ "corespunzătoare TIPARului\n" #~ " -q, --quiet, --silent suprimă tot outputul\n" #~ " --binary-files=TiP presupune ca fiÅŸierele binare sunt TIP\n" #~ " unde TIP este 'binary', 'text', sau 'without-" #~ "match'\n" #~ " -a, --text echivalent cu --binary-files=text\n" #~ " -I echivalent cu --binary-files=without-match\n" #~ " -d, --directories=ACÅ¢IUNE mod de manipulare al directoarelor\n" #~ " ACÅ¢IUNE este 'read', 'recurse', sau 'skip'\n" #~ " -D, --devices=ACÅ¢IUNE mod de manipulare device-uri, FIFOuri ÅŸi " #~ "sockeÅ£i\n" #~ " ACÅ¢IUNE este 'read' sau 'skip'\n" #~ " -R, -r, --recursive echivalent cu --directories=recurse\n" #~ " --include=TIPAR fiÅŸierele potrivite TIPARului vor fi " #~ "examinate\n" #~ " --exclude=TIPAR fiÅŸierele potrivite TIPARului vor fi omise.\n" #~ " --exclude-from=FIÅžIER fiÅŸierele potrivite TIPARului în FIÅžIER vor " #~ "fi omise.\n" #~ " -L, --files-without-match afiÅŸează doar nume FIÅžIERe care nu corespund\n" #~ " -l, --files-with-matches afiÅŸează doar nume FIÅžIERe care corespund\n" #~ " -c, --count afiÅŸează doar numărul de potriviri per " #~ "FIÅžIER\n" #~ " -Z, --null tipăreÅŸte octet 0 după nume FIÅžIER\n" #~ msgid "" #~ "\n" #~ "Context control:\n" #~ " -B, --before-context=NUM print NUM lines of leading context\n" #~ " -A, --after-context=NUM print NUM lines of trailing context\n" #~ " -C, --context=NUM print NUM lines of output context\n" #~ " -NUM same as --context=NUM\n" #~ " --color[=WHEN],\n" #~ " --colour[=WHEN] use markers to distinguish the matching " #~ "string\n" #~ " WHEN may be `always', `never' or `auto'.\n" #~ " -U, --binary do not strip CR characters at EOL (MSDOS)\n" #~ " -u, --unix-byte-offsets report offsets as if CRs were not there " #~ "(MSDOS)\n" #~ "\n" #~ "`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" #~ "With no FILE, or when FILE is -, read standard input. If less than\n" #~ "two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" #~ "and 2 if trouble.\n" #~ msgstr "" #~ "\n" #~ "Control de context:\n" #~ " -B, --before-context=NUM tipăreÅŸte NUM linii dinainte de context\n" #~ " -A, --after-context=NUM tipăreÅŸte NUM linii de după context\n" #~ " -C, --context=NUM tipăreÅŸte NUM linii de context\n" #~ " -NUM la fel ca ÅŸi --context=NUM\n" #~ " --color[=CÂND],\n" #~ " --colour[=CÂND] foloseÅŸte marcaje pentru a deosebi ÅŸirurile " #~ "potrivite\n" #~ " CÂND poate fi `always', `never' sau `auto'.\n" #~ " -U, --binary nu renunÅ£a la caractere CR la EOL (MSDOS)\n" #~ " -u, --unix-byte-offsets declară offset ca ÅŸi cum CR n-ar fi " #~ "acolo(MSDOS)\n" #~ "\n" #~ "`egrep' înseamnă `grep -E'. `fgrep' înseamnă `grep -F'.\n" #~ "Fără FIÅžIER, sau când FIÅžIER este -, se citeÅŸte intrarea standard. Dacă " #~ "se dau\n" #~ "mai puÅ£in de 2 FIÅžIERe, se presupune -h. Starea de ieÅŸire e 0 pentru\n" #~ "corespunzător, 1 pentru necorespunzător, ÅŸi 2 pentru probleme.\n" #~ msgid "" #~ "\n" #~ "Report bugs to <bug-gnu-utils@gnu.org>.\n" #~ msgstr "" #~ "\n" #~ "RaportaÅ£i buguri la <bug-gnu-utils@gnu.org>.\n" #~ msgid "unknown directories method" #~ msgstr "metodă directoare necunoscută" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Acesta este software liber; vedeÅ£i sursele pentru condiÅ£ii de copiere. " #~ "NU\n" #~ "există nici o garanÅ£ie; nici măcar pentru VANDABILITATE sau POTRIVIRE\n" #~ "PENTRU UN SCOP ANUME.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "OpÅ£iunile -P ÅŸi -z nu pot fi combinate" #~ msgid "%s: option `--%s' doesn't allow an argument\n" #~ msgstr "%s: opÅ£iunea `--%s' nu permite un parametru\n" #~ msgid "%s: unrecognized option `--%s'\n" #~ msgstr "%s: opÅ£iune necunoscută `--%s'\n" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: opÅ£iune ilegală -- %c\n" #~ msgid "%s: option `-W %s' is ambiguous\n" #~ msgstr "%s: opÅ£iunea `-W %s' este ambiguă\n" #~ msgid "%s: option `-W %s' doesn't allow an argument\n" #~ msgstr "%s: opÅ£iunea `-W %s' nu permite un parametru\n" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/fi.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000041543�14670377450�016176� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��Ê��#��Ú���Ñ$��ö���¬%��è��£&��Œ��Œ(����*��á��ª+��”��Œ-��T��!/��¶��v1��i��-3�����—4�����«4��(���Ë4��"���ô4�����5��*���35�����^5��&���{5�����¢5��-���´5��+���â5��8���6��*���G6��+���r6��&���ž6��-���Å6�����ó6�����÷6�� ���ú6��/���7�����87��1���È7�����ú7�����8�����78�����S8��/���q8�����¡8��$���»8��Å���à8�� ���¦9�����´9��+���È9�����ô9�����:��T���:��.���l:��&���›:��;���Â:��9���þ:��"���8;�����[;�����d;��.���v;�����¥;�����Ã;�����Ô;�����å;�� ���<��0��� <�����><��0��[<�����Œ=��:���¥=��4���à=��0���>��,���F>��(���s>��$���œ>�� ���Á>�����â>�����ÿ>��[���?�����m?��/���q?��1���¡?��'���Ó?�� ���û?��1���@��6���N@��>���…@��#���Ä@��.���è@��'���A�����?A�����YA��(���wA����� A�����ºA�� ���ÙA�����çA�� ���B��&���B�����9B��#���HB��.���lB�� ���›B�� ���¥B�� ���¯B�����¹B��&���ÖB��$���ýB��1���"C�����TC����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 10:37+0300 Last-Translator: Lauri Nurmi <lanurmi@iki.fi> Language-Team: Finnish <translation-team-fi@lists.sourceforge.net> Language: fi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=2; plural=(n != 1); X-Generator: Poedit 3.0 � Kontekstin hallinta: -B, --before-context=N tulosta N riviä edeltävää konteksia -A, --after-context=N tulosta N riviä seuraavaa kontekstia -C, --context=N tulosta N riviä tulostekonteksia � Sekalaista: -s, --no-messages vaienna virheilmoitukset -v, --invert-match valitse täsmäämättömät rivit -V, --version näytä versiotiedot ja poistu --help näytä tämä ohje ja poistu � Tulostehallinta: -m, --max-count=MÄÄRÄ pysäytä MÄÄRÄn täsmäävän rivin jälkeen -b, --byte-offset tulosta tavusiirros tulosteriveille -n, --line-number tulosta rivinumero tulosteriveille --line-buffered huuhtele tuloste joka rivillä -H, --with-filename tulosta tiedostonimi tulosteriveille -h, --no-filename vaienna tiedostonimet tulosteesta --label=NIMIÖ tulosta NIMIÖ tiedostonimenä vakiosyötteelle � --include=GLOB etsi vain GLOBiin (tiedostohahmo) täsmäävistä tiedostoista --exclude=GLOB ohita GLOBiin täsmäävät tiedostot ja hakemistot --exclude-from=TIED ohita mihin tahansa TIEDoston tiedostohahmoon täsmäävät tiedostot --exclude-dir=GLOB ohita GLOBiin täsmäävät hakemistot � -E, --extended-regexp HAHMOT ovat laajennettuja säännöllisiä lausekkeita -F, --fixed-strings HAHMOT ovat merkkijonoja -G, --basic-regexp HAHMOT ovat tavallisia säännöllisiä lausekkeita (oletus) -P, --perl-regexp HAHMOT ovat Perl-tyyppisiä säännöllisiä lausekkeita � -I sama kuin --binary-files=without-match -d, --directories=TEKO kuinka käsitellä hakemistoja; TEKO on â€readâ€, â€recurseâ€, tai â€skip†-D, --devices=TEKO kuinka käsitellä laitteita, FIFOja ja pistokkeita; TEKO on â€read†tai â€skip†-r, --recursive sama kuin --directories=recurse -R, --dereference-recursive samoin, mutta seuraa kaikkia symlinkkejä � -L, --files-without-match tulosta vain TIEDOSTOjen nimet, joissa ei yhtään valittua riviä -l, --files-with-matches tulosta vain TIEDOSTOjen nimet, joissa on valittuja rivejä -c, --count tulosta vain valittujen rivien lukumäärä TIEDOSTOa kohden -T, --initial-tab kohdista sarkaimet (jos tarpeellista) -Z, --null tulosta 0-tavu TIEDOSTOnimen jälkeen � -MÄÄRÄ sama kuin --context=MÄÄRÄ --group-separator=EROT tulosta EROTin kontekstillisten täsmäävyyksien välisille riveille --no-group-separator älä tulosta erotinta kontekstillisille täsmäävyyksille --color[=KUN], --colour[=KUN] korosta täsmäävyydet väreillä; KUN voi olla â€always†(aina), â€never†(ei koskaan) tai â€autoâ€. -U, --binary jätä CR-merkit rivien loppuun (MSDOS/Windows) � -e, --regexp=HAHMOT käytä HAHMOja täsmäämiseen -f, --file=TIEDOSTO ota HAHMOT TIEDOSTOsta -i, --ignore-case älä erottele pieniä ja suuria kirjaimia hahmoissa eikä datassa -w, --word-regexp täsmää vain kokonaisiin sanoihin -x, --line-regexp täsmää vain kokonaisiin riveihin -z, --null-data datarivi päättyy 0-tavuun, ei rivinvaihtoon � -o, --only-matching näytä vain täsmäävien rivien epätyhjät osat -q, --quiet, --silent vaienna kaikki normaali tuloste --binary-files=TYYPPI otaksu, että binääritiedostot ovat TYYPPIä; TYYPPI on â€binaryâ€, â€textâ€, tai â€without-match†-a, --text sama kuin --binary-files=text �%s -kotisivu: <%s> �%s: binääritiedosto täsmää�%s: ylitettiin PCRE:n paluujäljitysraja�%s: ylitettiin PCRE:n rekursioraja�%s: PCRE JIT -pino täyttyi�%s: syötetiedosto on myös tuotostiedosto�%s: sisäinen PCRE-virhe: %d�%s: virheellinen valitsin -- â€%c†�%s: muisti loppui�%s: valitsin â€%s%s†ei salli argumenttia �%s: valitsin â€%s%s†on moniselitteinen �%s: valitsin â€%s%s†on moniselitteinen; vaihtoehdot:�%s: valitsin â€%s%s†vaatii argumentin �%s: valitsin vaatii argumentin -- â€%c†�%s: tunnistamaton valitsin â€%s%s†�%s: varoitus: rekursiivinen hakemistosilmukka�â€�©�(vakiosyöte)�-P tukee vain yksitavu- ja UTF-8-maa-asetustoja�Esimerkki: %s -i 'hei maailma' menu.h main.c HAHMOT voivat sisältää useita rivinvaihdoin eroteltuja hahmoja. Hahmojen valinta ja tulkinta: �Yleisohjeita GNU-ohjelmistojen käyttöön: <%s> �Virheellinen takaisinviittaus�Virheellinen merkkiluokan nimi�Virheellinen vertailumerkki�Virheellinen \{\}:n sisältö�Virheellinen edeltävä säännöllinen lauseke�Virheellinen välin loppu�Virheellinen säännöllinen lauseke�Lisenssi GPLv3+: GNU GPL versio 3 tai myöhäisempi <%s>. Tämä on vapaa ohjelma: voit vapaasti muuttaa ja jakaa sitä edelleen. Ohjelmalla EI OLE TAKUUTA siinä laajuudessa kuin laki sen sallii. �Muisti loppui�Ei täsmäävyyttä�Ei edeltävää säännöllistä lauseketta�Paketoinut %s �Paketoinut %s (%s) �Perl-täsmäystä ei tueta --disable-perl-regexp -valitsimellisessa käännöksessä�Ennenaikainen säännöllisen lausekkeen loppu�Säännöllinen lauseke on liian suuri�Ilmoita %s ohjelmistovioista (englanniksi) osoitteeseen %s �Ilmoita ohjelmistovioista (englanniksi) osoitteeseen: %s �Hae HAHMOja kustakin TIEDOSTOsta. �Onnistui�Kenoviiva lopussa�Komento â€%s --help†antaa lisää tietoa. �Tuntematon järjestelmävirhe�Pariton ( tai \(�Pariton ) tai \)�Pariton [, [^, [:, [. tai [=�Pariton \{�Käyttö: %s [VALITSIN]... HAHMOT [TIEDOSTO]... �Kelvolliset argumentit ovat:�Kun TIEDOSTO on â€-â€, lue vakiosyötettä. Ilman TIEDOSTOa lue â€.†jos haetaan rekursiivisesti, muuten â€-†. Jos alle kaksi TIEDOSTOa on annettu, oleta valitsin -h. Paluuarvo on 0, jos mikä tahansa rivi valitaan, muuten 1; jos tapahtuu mikä tahansa virhe ja -q on antamatta, paluuarvo on 2. �Kirjoittaneet %s ja %s. �Kirjoittaneet %s, %s, %s, %s, %s, %s, %s, %s, %s ja muut. �Kirjoittaneet %s, %s, %s, %s, %s, %s, %s, %s ja %s. �Kirjoittaneet %s, %s, %s, %s, %s, %s, %s ja %s. �Kirjoittaneet %s, %s, %s, %s, %s, %s ja %s. �Kirjoittaneet %s, %s, %s, %s, %s ja %s. �Kirjoittaneet %s, %s, %s, %s ja %s. �Kirjoittaneet %s, %s, %s ja %s. �Kirjoittaneet %s, %s ja %s. �Kirjoittanut %s. �Kirjoittaneet Mike Haertel ja muut; ks. <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�â€�monimerkityksellinen argumentti %s kohteelle %s�merkkiluokkasyntaksi on [[:space:]], ei [:space:]�määritelty ristiriitaiset täsmäimet�ylitettiin PCRE:n rivipituusraja�muistin varaaminen PCRE JIT -pinolle epäonnistui�palaaminen alkuperäiseen työhakemistoon epäonnistui�tiedostokahvan teksti-/binääritilan asettaminen epäonnistui�syöte on liian suuri laskettavaksi�sisäinen virhe (ei pitäisi koskaan tapahtua)�virheellinen argumentti %s kohteelle %s�virheellinen merkkiluokka�virheellinen \{\}:n sisältö�virheellinen kontekstin pituusargumentti�virheellinen täsmäin %s�virheellinen enimmäismäärä�muisti loppui�syntaksia ei ole määritelty�ohjelmavirhe�säännöllinen lauseke on liian suuri�pinon ylivuoto�valitsin -P tukee vain yhtä hahmoa�nykyisen työhakemiston kirjaaminen ei onnistu�pariton (�pariton )�pariton [�keskeneräinen \-ohjaussarja�tuntematon binääritiedostojen tyyppi�tuntematon laitteiden käsittelytapa�varoitus: --unix-byte-offsets (-u) on vanhentunut�kirjoitusvirhe��������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/he.po�����������������������������������������������������������������������0000664�0001750�0001750�00000060346�14670377471�016035� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Hebrew messages for GNU Grep # Copyright (C) 2002, 2005 Free Software Foundation, Inc. # Eli Zaretskii <eliz@gnu.org>, 2005. # msgid "" msgstr "" "Project-Id-Version: grep 2.5.1a\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2005-03-04 14:55+0200\n" "Last-Translator: Eli Zaretskii <eliz@gnu.org>\n" "Language-Team: Hebrew <eliz@gnu.org>\n" "Language: he\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "" #: lib/dfa.c:896 #, fuzzy msgid "unbalanced [" msgstr "âåæ-ïá åì ïéàù [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" #: lib/dfa.c:1210 #, fuzzy msgid "unfinished \\ escape" msgstr "äøåîâ-éúìá \\ äø÷á úøãñ" #: lib/dfa.c:1371 #, fuzzy msgid "invalid content of \\{\\}" msgstr "éåâù éáøéî øôñî" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "" #: lib/dfa.c:1858 #, fuzzy msgid "unbalanced (" msgstr "âåæ-ïá åì ïéàù (" #: lib/dfa.c:1975 #, fuzzy msgid "no syntax specified" msgstr "øéáçú úøãâä ïéà" #: lib/dfa.c:1986 #, fuzzy msgid "unbalanced )" msgstr "âåæ-ïá åì ïéàù )" #: lib/error.c:195 msgid "Unknown system error" msgstr "úøëåî-éúìá úëøòî úì÷ú" #: lib/getopt.c:278 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s úéðëú øåáò éòîùî-ãç åðéà `%s' ïééôàî\n" #: lib/getopt.c:284 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s úéðëú øåáò éòîùî-ãç åðéà `%s' ïééôàî\n" #: lib/getopt.c:319 #, fuzzy, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s úéðëú øåáò `%c%s' øëåî-éúìá ïééôàî\n" #: lib/getopt.c:345 #, fuzzy, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s úéðëú øåáò èðîåâøà ìá÷î åðéà `%c%s' ïééôàî\n" #: lib/getopt.c:360 #, fuzzy, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s úéðëú øåáò èðîåâøà áééçî `%s' ïééôàî\n" #: lib/getopt.c:621 #, fuzzy, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s úéðëú øåáò éåâù ïééôàî -- %c\n" #: lib/getopt.c:636 lib/getopt.c:682 #, fuzzy, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: èðîåâøà áééçî ïééôàî -- %c\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "ïåøëæä øîâð" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "" #: lib/regcomp.c:138 msgid "No match" msgstr "" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "ïåøëæä øîâð" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" ".<bug-grep@gnu.org> úáåúëì äì÷ú éçååéã çåìùì àð\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "" #: src/grep.c:649 msgid "(standard input)" msgstr "(éð÷ú èì÷ õåøò)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "øù÷ää èñ÷è êøåà ìù äéåâù äøãâä" #: src/grep.c:894 msgid "input is too large to count" msgstr "øåôñì éãëî ìåãâ èì÷" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "äîéàúî úæåøçî ìéëî %s éøàðéá õáå÷\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "äé÷éúá äéñøå÷ø úàìåì" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "%s [íéðééôàî]... PATTERN [õáå÷] :ùåîéùä ïôåà\n" #: src/grep.c:1963 #, fuzzy, c-format msgid "Try '%s --help' for more information.\n" msgstr ".øúåé áø òãéî úâöäì `%s --help' äñð\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" " .éð÷ú èì÷á åà ,åðéåöù íéöá÷äî ãçà ìëá úéðáúì úåîàúä ùôç\n" " %s -i 'hello world' menu.h main.c :àîâåã\n" "\n" " :íééøìåâøä íééèéáä âååéñå äøéçá\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " áçøåî éøìåâø éåèéá àåä PATTERN -E, --extended-regexp\n" " newline é\"ò úåãøôåîä úåæåøçîî áëøåî PATTERN -F, --fixed-strings\n" " éñéñá éøìåâø éåèéá àåä PATTERN -E, --extended-regexp\n" " Perl ïåðâñá éøìåâø éåèéá àåä PATTERN -P, --perl-regexp\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " PATTERN-á äðéä éøìåâø éåèéá úéðáú -e, --regexp=PATTERN\n" " FILE õáå÷ êåúî PATTERN úéðáúä úà àø÷ -f, --file=FILE\n" " úåðè÷å úåìåãâ úåéúåà ïéá íéìãáäî íìòúä -i, --ignore-case\n" " úåîìù íéìîì ÷øå êà íéàúäì PATTERN ìò -w, --word-regexp\n" " úåîìù úåøåùì ÷øå êà íéàúäì PATTERN ìò -x, --line-regexp\n" " newline-á àì ,0-úéáá úîééúñî èì÷ úøåù -z, --null-data\n" #: src/grep.c:1989 #, fuzzy, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" " :íéôñåð íéðééôàî\n" " äì÷ú úåàãåä âéöú ìà -s, --no-messages\n" " PATTERN-ì úåîéàúî ïðéàù úåøåù âöä -v, --invert-match\n" " àöå úéðëåúä úñøéâ ìò òãéî âöä -V, --version\n" " úéðëúäî àöå äæ äøæò êñî âöä --help\n" " ïåøëæì úåøéùé èì÷ éöá÷ éåôéîá ùîúùä ,øùôà íà --mmap\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" "\n" " :øù÷ä ìò äèéìù\n" " úîàåúä äøåùä éðôì øù÷ä ìù úåøåù NUM âöä -B, --before-context=NUM\n" " úîàåúä äøåùä éøçà øù÷ä ìù úåøåù NUM âöä -A, --after-context=NUM\n" " úîàåúä äøåùä éøçàå éðôì øù÷ä ìù úåøåù NUM âöä -C, --context=NUM\n" " --context=NUM-ì êøò-äååù -NUM\n" " --color[=WHEN],\n" " úîàåúä úæåøçîä úèìáäì òáö éðîéñ âöä --colour[=WHEN]\n" " `auto' åà ,`never' ,`always' úåéäì ìåëé WHEN\n" " (MSDOS) äøåù óåñá CR éåú ÷ìñú ìà -U, --binary\n" " (MSDOS) íéîéé÷ åéä àì CR éåú åìéàë íéèñéä çååã -u, --unix-byte-offsets\n" "\n" " .`grep -F' åùåøô `fgrep' .`grep -E' åùåøô `egrep'\n" " .éð÷ú èì÷ õåøòî àøå÷ ,- àåä õáå÷ä íù íà åà ,èì÷ õáå÷ ïåéö àìì\n" " .-h òîúùî ,íéöá÷ éðùî úåçô íéðåúð íà\n" " .úåì÷ú ìù äø÷îá 2 ,åàöîð àì íà 1 ,úåîàúä åàöîð íà 0 åðéä äàéöé ãå÷\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "äîàúää éâåñ ìù íéøúåñ íéðåéö" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" #: src/grep.c:2103 #, fuzzy, c-format msgid "invalid matcher %s" msgstr "éåâù éáøéî øôñî" #: src/grep.c:2538 msgid "unknown devices method" msgstr "íéð÷úäá ìåôéèì úøëåî-éúìá úèéù" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "éåâù éáøéî øôñî" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "íééøàðéá íéöá÷á ìåôéèì úøëåî-éúìá úèéù" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 #, fuzzy msgid "the -P option only supports a single pattern" msgstr "-P ïééôàîá äëéîú ïéà" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "ïåøëæä øîâð" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "" #, fuzzy, c-format #~ msgid "warning: %s: %s" #~ msgstr "%s %s :äøäæà\n" #, fuzzy #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s úéðëú øåáò èðîåâøà ìá÷î åðéà `--%s' ïééôàî\n" #, fuzzy #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s úéðëú øåáò `--%s' øëåî-éúìá ïééôàî\n" #, fuzzy #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s úéðëú øåáò éòîùî-ãç åðéà `-W %s' ïééôàî\n" #, fuzzy #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s úéðëú øåáò èðîåâøà ìá÷î åðéà `-W %s' ïééôàî\n" #, fuzzy #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s úéðëú øåáò èðîåâøà áééçî `%s' ïééôàî\n" #~ msgid "unfinished repeat count" #~ msgstr "äøåîâ-éúìá úåðùéä äðåî úøãâä" #~ msgid "malformed repeat count" #~ msgstr "úåðùéä äðåî úøãâäá éåâù øéáçú" #~ msgid "out of memory" #~ msgstr "ïåøëæä øîâð" #~ msgid "writing output" #~ msgstr "(èìô úáéúë úòá äì÷ú)" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "%s [íéðééôàî]... PATTERN [õáå÷] :ùåîéùä ïôåà\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ " :èìô ìò " #~ "äèéìù\n" #~ " úåîéàúî úåøåù NUM úâöä éøçà ÷ñôä -m, --max-count=NUM\n" #~ " èìô úøåù ìë ìù íéúáá èñéä âöä -b, --byte-offset\n" #~ " èìô úåøåù íò äøåù øôñî âöä -n, --line-number\n" #~ " äøåù ìë øåáò èìô õöåç ï÷åø --line-buffered\n" #~ " äîàúä ìë äàöîð åá õáå÷ íù âöä -H, --with-filename\n" #~ " èìôá íéöá÷ úåîù âéöú ìà -h, --no-filename\n" #~ " õáå÷ä íùë LABEL âöä ,éð÷ú èì÷ õåøòî èì÷ øåáò --label=LABEL\n" #~ " úéðáúä úà íàåúä äøåùä ÷ìç úà ÷ø âöä -o, --only-matching\n" #~ " íéìéâøä èìôä éâåñ ìë úà ìèá -q, --quiet, --silent\n" #~ " íééøàðéá íéöá÷ ãáòì ãöéë --binary-" #~ "files=HOW\n" #~ "'without-match' ,'text' ,'binary' úåéäì ìåëé HOW\n" #~ " --binary-files=text-ì êøò-äååù -a, --text\n" #~ " --binary-files=without-match-ì êøò-äååù -I\n" #~ " úåé÷éú ãáòì ãöéë -d, --directories=HOW\n" #~ " 'skip' åà ,'recurse' ,'read' úåéäì ìåëé HOW\n" #~ " íéð÷úä ãáòì ãöéë -D, --devices=HOW\n" #~ " 'skip' åà 'read' úåéäì ìåëé HOW\n" #~ " --directories=recurse-ì êøò-äååù -R, -r, --recursive\n" #~ " PATTERN íéîàåú íäéúåîùù íéöá÷á ùôç --include=PATTERN\n" #~ " PATTERN íéîàåú íäéúåîùù íéöá÷ ìò âìã --exclude=PATTERN\n" #~ " PATTERN íéîàåúù FILE-î íéöá÷ ìò âìã --exclude-" #~ "from=FILE\n" #~ " úçà äîàúä óà äúéä àì íäáù íéöá÷ úåîù âöä -L, --files-without-" #~ "match\n" #~ " úåîàúä åéä íäá íéöá÷ä úåîù úà ÷ø âöä -l, --files-with-" #~ "matches\n" #~ " õáå÷ ìëá úåîàåúä úåøåùä øôñî úà ÷ø âöä -c, --count\n" #~ " 0 úéáá õáå÷ íù ìë íééñ -Z, --null\n" #~ msgid "unknown directories method" #~ msgstr "úåé÷éúá ìåôéèì úøëåî-éúìá úèéù" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "áúë ïéà åæ äðëúì .øå÷î éöá÷á ïééò ,ä÷úòä úåéåëæì ;úéùôç äðëú äðéä åæ " #~ "äðëú\n" #~ " .úîéåñî úéìëú åæéàì äîàúä åà úåøéçñ íùì òîúùîá-úåéøçà àì åìéôà ;" #~ "úåéøçà\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "äæ úà äæ íéøúåñ -z-å -P íéðééôàî" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: é÷åç-éúìá ïééôàî -- %c\n" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/pl.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000042272�14670377471�016216� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��‘��#��Ï���˜$�� ��h%��í��v&��á��d(����F*��ª��X+��ž��.��Q��¢/��ç��ô1��Š��Ü3�����g5��!���}5��-���Ÿ5��$���Í5�����ò5��6���6�����F6�����f6�����†6��/���ž6��*���Î6��8���ù6��&���27��'���Y7��#���7��1���¥7�����×7�����Û7�����Þ7��4���õ7��Š���*8��)���µ8�����ß8�����ó8��-���9�����>9��,���X9�����…9�����9��½���»9�����y:�� ���:��(���˜:�����Á:�����Õ:��\���î:��*���K;�����v;��/���”;��,���Ä;�����ñ;�����<�����<��7���0<�����h<�����‚<�����š<��$���²<�����×<��+���è<�����=��}��.=�����¬>��<���Å>��4���?��0���7?��,���h?��(���•?��$���¾?�� ���ã?�����@�����!@��i���5@�����Ÿ@�����£@��5���Á@�����÷@��(���A��7���8A��4���pA��E���¥A��1���ëA��5���B�����SB�����oB�����ŒB��)���¦B�����ÐB��&���èB�����C�����#C�����>C�����NC�����lC��7���C��-���¹C�� ���çC�� ���õC�� ���D�����D�����,D��)���ID��8���sD�� ���¬D����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: GNU grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 11:35+0200 Last-Translator: RafaÅ‚ Maszkowski <rzm@icm.edu.pl> Language-Team: Polish <translation-team-pl@lists.sourceforge.net> Language: pl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8-bit X-Bugs: Report translation errors to the Language-Team address. � Sterowanie kontekstem: -B, --before-context=ILE wypisanie ILU linii kontekstu przed -A, --after-context=ILE wypisanie ILU linii kontekstu po -C, --context=ILE wypisanie ILU linii kontekstu � Różne: -s, --no-messages bez komunikatów o błędach -v, --invert-match wybranie nie pasujÄ…cych linii -V, --version wypisanie informacji o wersji i zakoÅ„czenie --help wypisanie tych informacji i zakoÅ„czenie � Sterowanie danymi wyjÅ›ciowymi: -m, --max-count=ILE zatrzymanie po ILU wybranych liniach -b, --byte-offset wypisanie pozycji bajtów w wyniku -n, --line-number wypisanie numerów linii w wyniku --line-buffered opróżnienie bufora po każdej linii -H, --with-filename wypisanie nazwy pliku dla każdej linii -h, --no-filename bez nazwy pliku w liniach wyjÅ›ciowych --label=ETYKIETA w wyniku ETYKIETA zastÄ™puje nazwe pliku � --include=WZORZEC_PLIKOWY przeszukiwane bÄ™dÄ… pliki pasujÄ…ce do WZORCA_PLIKOWEGO --exclude=WZORZEC_PLIKOWY pliki pasujÄ…ce do WZORCA_PLIKOWEGO bÄ™dÄ… pominiÄ™te --exclude-from=PLIK pominiÄ™cie plików pasujÄ…cych do wzorców plikowych w PLIKU --exclude-dir=WZORZEC_PLIKOWY katalogi pasujÄ…ce do WZORCA_PLIKOWEGO bÄ™dÄ… pominiÄ™te � -E, --extended-regexp WZORCE sÄ… rozszerzonymi wyrażeniami regularnymi -F, --fixed-strings WZORCE sÄ… napisami -G, --basic-regexp WZORCE sÄ… podstawowymi wyrażeniami regularnymi -P, --perl-regexp WZORCE sÄ… wyrażeniami regularnymi perla � -I równoważne --binary-files=without-match -d, --directories=DZIAÅANIE jak siÄ™ obchodzić z katalogami, DZIAÅANIE to „read†(czytanie), „recurse†(przeglÄ…danie rekurencujne) albo „skip†(pominiÄ™cie). -D, --devices=DZIAÅANIE jak odwoÅ‚ywać siÄ™ do urzÄ…dzeÅ„, FIFO i gniazd, DZIAÅANIE to „read†(czytaj) albo „skip†(pomiÅ„) -r, --recursive równoważne --directories=recurse -R, --dereference-recursive podobnie, ale z podążaniem za dowiÄ…zaniami symbolicznymi � -L, --files-without-match wypisanie tylko nazw PLIKÓW bez wybranych linii -l, --files-with-matches wypisanie tylko nazw PLIKÓW z wybranymi liniami -c, --count wypisanie tylko liczby wybranych linii w każdym PLIKU -T, --initial-tab wyrównanie linii przez TAB (jeżeli potrzebne) -Z, --null wypisanie bajtu 0 po każdej nazwie PLIKU � -ILE to samo co --context=ILE --group-separator=SEP wypisanie SEP miÄ™dzy dopasowaniami z kontekstem --no-group-separator bez wypisania separatora miÄ™dzy dopasowaniami z z kontekstem --color[=KIEDY], --colour[=KIEDY] oznaczanie pasujÄ…cych znaków, KIEDY to „always†(zawsze), „never†(nigdy) albo „auto†(automatycznie). -U, --binary bez usuwania znaków nowej linii na koÅ„cu (MSDOS/Windows) � -e, --regexp=WZORCE dopasowanie do WZORCOW -f, --file=PLIK użycie wzorców z PLIKU -i, --ignore-case ignorowanie rejestru liter --no-ignore-case bez ignorowania rejestru liter (domyÅ›lnie) -w, --word-regexp dopasowanie WZORCOW tylko do peÅ‚nych słów -x, --line-regexp dopasowanie WZORCOW tylko do caÅ‚ych linii -z, --null-data linie sÄ… zakoÅ„czone bajtem 0, nie znakiem nowej linii � -o, --only-matching pokazanie tylko niepustych części linii, które pasujÄ… -q, --quiet, --silent wyłączenie wypisywanie wyniku --binary-files=TYP zaÅ‚ożenie, że pliki binarne sÄ… typu TYP TYP to „binaryâ€, „text†lub „without-matchâ€. -a, --text równoważne --binary-files=text �Strona domowa %s: %s �%s: plik binarny pasuje do wzorca�%s: przekroczony limit analizy wstecznej PCRE�%s: przekroczony limit rekursji PCRE�%s: wyczerpany stos JIT PCRE�%s: plik wejÅ›ciowy jest również plikiem wyjÅ›ciowym�%s: błąd wewnÄ™trzny PCRE: %d�%s: błędna opcja -- „%c†�%s: pamięć wyczerpana�%s: opcja „%s%s†nie może mieć argumentu �%s: opcja „%s%s†jest niejednoznaczna �%s: opcja „%s%s†jest niejednoznaczna; możliwoÅ›ci:�%s: opcja „%s%s†wymaga argumentu �%s: opcja wymaga argumentu -- „%c†�%s: nierozpoznana opcja „%s%s†�%s: nieskoÅ„czona pÄ™tla przeglÄ…dania katalogów�â€�©�(standardowe wejÅ›cie)�-P dziaÅ‚a tylko kodowaniem jednobajtowym albo UTF-8�PrzykÅ‚ad: %s -i 'hello world' menu.h main.c WZORCE mogÄ… zawierać wiele wzorców w kolejnych liniach. Wybór i interpretacja wzorców: �Pomoc w używaniu oprogramowania GNU: %s �Błędne odwoÅ‚anie�Błędna nazwa klasy znaków�Znak błędny dla bieżącego uporzÄ…dkowania�Błędna zawartość \{\}�Błędne poprzedzajÄ…ce wyrażenie regularne�Błędny koniec zakresu�Błędne wyrażenie regularne�Licencja GPLv3+: GNU GPL wersja 3 albo późniejsza %s To jest wolne oprogramowanie: możesz je modyfikować i rozpowszechniać. Autorzy NIE DAJÄ„ GWARANCJI w granicach dozwolonych prawem. �Pamięć wyczerpana�Nie pasuje�Brak poprzedniego wyrażenia regularnego�Spakowane przez %s �Spakowane przez %s (%s) �Dopasowywanie wzorców w stylu perla nie dziaÅ‚a w wersji zbudowanej z --disable-perl-regexp�Przedwczesny koniec wyrażenia regularnego�Za duże wyrażenie regularne�Raporty o błędach %s należy wysyÅ‚ać do %s �Raporty o błędach należy wysyÅ‚ać do %s �Szukanie WZORCÓW w PLIKACH. �Udane�KoÅ„cowy ukoÅ›nik odwrotny�Napisz „%s --help†żeby dowiedzieć siÄ™ wiÄ™cej. �Nieznany błąd systemowy�Nie pasujÄ…cy ( albo \(�Nie pasujÄ…cy ) albo \)�Nie pasujÄ…cy [, [^, [:, [., albo [=�Nie pasujÄ…cy \{�SkÅ‚adnia: %s [OPCJA]... WZORCE [PLIK] ... �PrawidÅ‚owe agrumenty to:�Jeżeli PLIK to „-â€, czytane jest standardowe wejÅ›cie. Jeżeli PLIK nie jest podany i użyta jest opcja -r, czytany jest katalog ., natomiast - gdy -r nie jest podane. Jeżeli podano mniej niż dwa PLIKI, program włącza opcjÄ™ -h. ZakoÅ„czenie dziaÅ‚ania z kodem wyjÅ›ciowym 0, jeżeli pasuje jakaÅ› linia z 1, jeżeli nie; z 2, w razie błędów i gdy nie podano opcji -q. �Napisany przez %s i %s. �Napisany przez %s, %s, %s, %s, %s, %s, %s, %s, %s i innych. �Napisany przez %s, %s, %s, %s, %s, %s, %s, %s i %s. �Napisany przez %s, %s, %s, %s, %s, %s, %s i %s. �Napisany przez %s, %s, %s, %s, %s, %s i %s. �Napisany przez %s, %s, %s, %s, %s i %s. �Napisany przez %s, %s, %s, %s i %s. �Napisany przez %s, %s, %s i %s. �Napisany przez %s, %s i %s. �Napisany przez %s. �Program napisany przez Mike'a Haertela i innych, zobacz https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS�„�dwuznaczny argument %s dla %s�skÅ‚adnia klasy znaków to [[:space:]], nie [:space:]�podano sprzeczne wzorce�przekroczony limit dÅ‚ugoÅ›ci linii PCRE�nie udaÅ‚o siÄ™ zaalokować pamiÄ™ci dla stosu PCRE JIT�nie udaÅ‚o siÄ™ powrócić do poczÄ…tkowego katalogu�nie udaÅ‚o siÄ™ ustawić trybu tekstowego/binarnego deskryptora pliku�danych wejÅ›ciowych jest zbyt dużo do policzenia�błąd wewnÄ™trzny (nigdy nie powinien siÄ™ zdarzyć)�błędny argument %s dla %s�błędna nazwa klasy znaków�błędna zawartość \{\}�błędny argument dÅ‚ugoÅ›ci kontekstowej�błędna dopasowanie %s�błędna maksymalna liczba powtórzeÅ„�pamięć wyczerpana�brak specyfikacji skÅ‚adni�błąd programu�za duże wyrażenie regularne�przepeÅ‚nienie stosu�opcja -P może być użyta tylko do pojedynczego wzorca�nie udaÅ‚o siÄ™ zapisać bieżącego katalogu�( nie do pary�) nie do pary�[ nie do pary�niedokoÅ„czona sekwencja \�nieznany typ pliku binarnego�nieznany sposób przeglÄ…dania urzÄ…dzeÅ„�uwaga: opcja --unix-byte-offsets (-u( jest przestarzaÅ‚a�błąd zapisu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/sv.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000040437�14670377471�016234� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"�� ��#��Þ���§$��ú���†%��ð��&��$��r(����—)��å��*��l��ƒ,��ä��ð-��Ì��Õ/��Y��¢1�����ü2�����3��.���,3��(���[3�� ���„3��)���¥3�����Ï3�����è3�����4��0���4��$���M4��2���r4��-���¥4��.���Ó4�����5��!��� 5�����B5�����F5�� ���I5��,���W5��Œ���„5��*���6�����<6�����S6�����l6�����†6��%��� 6�����Æ6�����Ý6��³���ù6�����­7�� ���½7��!���Ê7�����ì7�����ý7��?���8��'���S8��!���{8��a���8��\���ÿ8��!���\9�����~9��!���‡9��2���©9�����Ü9�����í9�����:�����:�� ���5:��.���A:�����p:����†:�����—;��9���®;��2���è;��.���<��*���J<��&���u<��"���œ<�����¿<�����Þ<�����ù<��Z��� =�����d=�����h=��7���†=��!���¾=��$���à=��>���>��?���D>��C���„>��*���È>��#���ó>�����?�����4?�����H?��&���b?�����‰?��#���ž?�����Â?�����Ò?�� ���ç?��!���ò?�����@��-���$@��%���R@�� ���x@�� ���†@�� ���”@�����¢@�����¶@�����Ê@��1���ä@�����A����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 11:55+0200 Last-Translator: Anders Jonsson <anders.jonsson@norsjovallen.se> Language-Team: Swedish <tp-sv@listor.tp-sv.se> Language: sv MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Poedit 2.4.2 � Kontroll av sammanhang: -B, --before-context=ANTAL skriv ANTAL rader före träffad rad -A, --after-context=ANTAL skriv ANTAL rader efter träffad rad -C, --context=ANTAL skriv ANTAL rader runt träffad rad � Diverse: -s, --no-messages visa inga felmeddelanden -v, --invert-match välj rader utan träffar -V, --version visa versionsinformation och avsluta --help visa detta hjälpmeddelande och avsluta � Kontroll av utmatning: -m, --max-count=ANTAL avsluta efter ANTAL träffar -b, --byte-offset skriv ut byte-offset med utmatningsrader -n, --line-number skriv ut radnummer med utmatningsrader --line-buffered spola utmatning för varje rad -H, --with-filename skriv ut filnamn med utmatningsrader -h, --no-filename skriv inte ut filnamnets prefix vid utmatning --label=ETIKETT skriv ut ETIKETT som filnamnsprefix för standard in � --include=GLOB sök endast filer som matchar GLOB (ett filmönster) --exclude=GLOB hoppa över filer som matchar GLOB --exclude-from=FIL hoppa över filer som matchar filmönster frÃ¥n FIL --exclude-dir=GLOB kataloger som matchar GLOB hoppas över � -E, --extended-regexp MÖNSTER är utökade reguljära uttryck -F, --fixed-strings MÖNSTER är strängar -G, --basic-regexp MÖNSTER är enkla reguljära uttryck -P, --perl-regexp MÖNSTER är reguljära uttryck som i Perl � -I samma som --binary-files=without-match -d, --directories=Ã…TGÄRD hur kataloger ska hanteras; Ã…TGÄRD är â€readâ€, â€recurse†eller â€skip†-D, --devices=Ã…TGÄRD hur enheter, FIFO och uttag ska hanteras; Ã…TGÄRD är â€read†eller â€skip†-r, --recursive samma som --directories=recurse -R, --dereference-recursive detsamma, men följ alla symboliska länkar � -L, --files-without-match skriv endast ut namn pÃ¥ FILer utan valda rader -l, --files-with-matches skriv endast ut namn pÃ¥ FILer med valda rader -c, --count skriv endast ut antalet valda rader per FIL -T, --initial-tab gör sÃ¥ att tabulatorer radas upp (om det behövs) -Z, --null skriv ut 0-tecken efter FILnamn � -ANTAL samma som --context=ANTAL --group-separator=SEP skriv ut SEP pÃ¥ rad mellan matchningar med sammanhang --no-group-separator skriv inte ut separator för matchningar med sammanhang --color[=NÄR], --colour[=NÄR] använd markörer för att särskilja träff NÄR kan vara â€alwaysâ€, â€never†eller â€autoâ€. -U, --binary ta inte bort CR-tecken vid radslut (MSDOS/Windows) � -e, --regexp=MÖNSTER använd MÖNSTER som ett reguljärt uttryck -f, --file=FIL ta MÖNSTER frÃ¥n FIL -i, --ignore-case skilj ej pÃ¥ gemener och versaler i mönster och data --no-ignore-case skilj pÃ¥ gemener och versaler (standard) -w, --word-regexp matcha endast hela ord -x, --line-regexp matcha endast hela rader -z, --null-data en datarad slutar i 0 byte, inte nyradstecken � -o, --only-matching visa endast icke-tomma delar av rader som matchar -q, --quiet, --silent undertryck all normal utmatning --binary-files=TYP anta att binärfiler är av TYP; TYP är â€binaryâ€, â€text†eller â€without-match†-a, --text samma som --binary-files=text �Webbplats för %s: <%s> �%s: binär fil matchar�%s: översteg gräns för PCRE-bakÃ¥tspÃ¥rning�%s: översteg rekursionsgräns för PCRE�%s: fyllde JIT-stacken för PCRE�%s: inmatningsfilen är även utmatningen�%s: internt PCRE-fel: %d�%s: ogiltig flagga -- â€%c†�%s: minnet är slut�%s: flaggan â€%s%s†tillÃ¥ter inget argument �%s: flaggan â€%s%s†är tvetydig �%s: flaggan â€%s%s†är tvetydig. Möjligheter:�%s: flaggan â€%s%s†behöver ett argument �%s: flaggan behöver ett argument -- â€%c†�%s: okänd flagga â€%s%s†�%s: varning: rekursiv katalogloop�â€�©�(standard in)�-P stöder endast unibyte- och UTF-8-lokaler�Exempel: %s -i "hello world" menu.h main.c MÖNSTER kan innehÃ¥lla flera mönster Ã¥tskilda av nyradstecken. Val och tolkning av mönster: �Allmän hjälp för GNU-programvara: <%s> �Ogiltig bakÃ¥treferens�Ogiltigt teckenklassnamn�Ogiltigt sorteringstecken�Ogiltigt innehÃ¥ll i \{\}�Ogiltigt inledande reguljärt uttryck�Ogiltigt intervallslut�Ogiltigt reguljärt uttryck�Licens GPLv3+: GNU GPL version 3 eller senare <%s>. Det här är fri programvara: du fÃ¥r ändra och distribuera den. Det finns INGEN GARANTI, sÃ¥ lÃ¥ngt som tillÃ¥ts enligt lag. �Minnet är slut�Ingen träff�Inget tidigare reguljärt uttryck�Paketerad av %s �Paketerad av %s (%s) �Perlmatchning stöds inte i ett bygge med --disable-perl-regexp�För tidigt slut pÃ¥ reguljärt uttryck�Reguljärt uttryck är för stort�Rapportera fel i %s till: %s Skicka synpunkter pÃ¥ översättningen till <tp-sv@listor.tp-sv.se> �Rapportera fel till: %s Skicka synpunkter pÃ¥ översättningen till <tp-sv@listor.tp-sv.se> �Sök efter MÖNSTER i varje FIL. �Lyckades�Efterföljande omvänt snedstreck�Försök med â€%s --help†för mer information �Okänt systemfel�Omatchad ( eller \(�Omatchad ) eller \)�Omatchad [, [^, [:, [. eller [=�Omatchad \{�Användning: %s [FLAGGA]... MÖNSTER [FIL]... �Giltiga argument är:�När FIL är â€-â€, läs frÃ¥n standard in. Läs â€.†dÃ¥ FIL saknas om rekursiv, läs â€-†annars. Om färre än tvÃ¥ FILer anges, anta -h. Avslutningsstatus är 0 om nÃ¥gon rad, annars 1; om nÃ¥got fel inträffar och -q inte angavs, är avslutningsstatusen 2. �Skriven av %s och %s. �Skriven av %s, %s, %s, %s, %s, %s, %s, %s, %s och andra. �Skriven av %s, %s, %s, %s, %s, %s, %s, %s och %s. �Skriven av %s, %s, %s, %s, %s, %s, %s och %s. �Skriven av %s, %s, %s, %s, %s, %s och %s. �Skriven av %s, %s, %s, %s, %s och %s. �Skriven av %s, %s, %s, %s och %s. �Skriven av %s, %s, %s och %s. �Skriven av %s, %s och %s. �Skriven av %s. �Skrivet av Mike Haertel och andra, se <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�â€�tvetydigt argument %s för %s�syntax för teckenklass är [[:space:]], inte [:space:]�motstridiga söksträngar angivna�översteg radlängdsgräns för PCRE�misslyckades med att allokera minne för JIT-stacken för PCRE�misslyckades med att Ã¥tervända till ursprunglig arbetskatalog�misslyckades med att ställa in text/binärläge för filbeskrivare�det är för mycket indata för att räkna�internt fel (bör aldrig inträffa)�ogiltigt argument %s för %s�ogiltig teckenklass�ogiltigt innehÃ¥ll i \{\}�ogiltigt argument till -A, -B eller -C�ogiltig matchning %s�ogiltigt värde för antal träffar�minnet är slut�ingen syntax angiven�programfel�reguljärt uttryck är för stort�stacköverspill�flaggan -P har endast stöd för ett mönster�kan inte notera aktuell arbetskatalog�obalanserad (�obalanserad )�obalanserad [�oavslutad \-sekvens�okänd binärfiltyp�okänd metod för enheter�varning: --unix-byte-offsets (-u) är förÃ¥ldrat�skrivfel����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/sv.po�����������������������������������������������������������������������0000664�0001750�0001750�00000077733�14670377471�016101� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Swedish messages for GNU Grep # Copyright © 1996, 1998, 1999, 2000, 2001, 2006, 2007, 2008, 2009, 2010, 2011, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Thomas Olsson <cid95tho@student1.lu.se>, 1996. # Daniel Resare <daniel@resare.com>, 1998, 1999, 2000, 2001. # Daniel Nylander <po@danielnylander.se>, 2006, 2007, 2008, 2009, 2010, 2011. # Anders Jonsson <anders.jonsson@norsjovallen.se>, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021. # msgid "" msgstr "" "Project-Id-Version: grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 11:55+0200\n" "Last-Translator: Anders Jonsson <anders.jonsson@norsjovallen.se>\n" "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" "Language: sv\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Poedit 2.4.2\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "ogiltigt argument %s för %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "tvetydigt argument %s för %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Giltiga argument är:" #: lib/c-stack.c:187 msgid "program error" msgstr "programfel" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "stacköverspill" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "skrivfel" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "obalanserad [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "ogiltig teckenklass" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "syntax för teckenklass är [[:space:]], inte [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "oavslutad \\-sekvens" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "ogiltigt innehÃ¥ll i \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "reguljärt uttryck är för stort" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "obalanserad (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "ingen syntax angiven" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "obalanserad )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Okänt systemfel" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: flaggan â€%s%s†är tvetydig\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: flaggan â€%s%s†är tvetydig. Möjligheter:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: okänd flagga â€%s%sâ€\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: flaggan â€%s%s†tillÃ¥ter inget argument\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: flaggan â€%s%s†behöver ett argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: ogiltig flagga -- â€%câ€\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: flaggan behöver ett argument -- â€%câ€\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "minnet är slut" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "kan inte notera aktuell arbetskatalog" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "misslyckades med att Ã¥tervända till ursprunglig arbetskatalog" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "misslyckades med att ställa in text/binärläge för filbeskrivare" # DÃ¥ det skulle krävas att spara hela filen i UTF-8 för att kunna göra # detta rätt, känns det inte värt det. Speciellt eftersom funktionen # inte används i grep # #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "â€" #: lib/quotearg.c:356 msgid "'" msgstr "â€" #: lib/regcomp.c:135 msgid "Success" msgstr "Lyckades" #: lib/regcomp.c:138 msgid "No match" msgstr "Ingen träff" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Ogiltigt reguljärt uttryck" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Ogiltigt sorteringstecken" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Ogiltigt teckenklassnamn" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Efterföljande omvänt snedstreck" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Ogiltig bakÃ¥treferens" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Omatchad [, [^, [:, [. eller [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Omatchad ( eller \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Omatchad \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Ogiltigt innehÃ¥ll i \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Ogiltigt intervallslut" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Minnet är slut" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Ogiltigt inledande reguljärt uttryck" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "För tidigt slut pÃ¥ reguljärt uttryck" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Reguljärt uttryck är för stort" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Omatchad ) eller \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Inget tidigare reguljärt uttryck" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Paketerad av %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Paketerad av %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licens GPLv3+: GNU GPL version 3 eller senare <%s>.\n" "Det här är fri programvara: du fÃ¥r ändra och distribuera den.\n" "Det finns INGEN GARANTI, sÃ¥ lÃ¥ngt som tillÃ¥ts enligt lag.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Skriven av %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Skriven av %s och %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Skriven av %s, %s och %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Skriven av %s, %s, %s\n" "och %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Skriven av %s, %s, %s,\n" "%s och %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Skriven av %s, %s, %s,\n" "%s, %s och %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Skriven av %s, %s, %s,\n" "%s, %s, %s och %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Skriven av %s, %s, %s,\n" "%s, %s, %s, %s\n" "och %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Skriven av %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s och %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Skriven av %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s och andra.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" "Rapportera fel till: %s\n" "Skicka synpunkter pÃ¥ översättningen till <tp-sv@listor.tp-sv.se>\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" "Rapportera fel i %s till: %s\n" "Skicka synpunkter pÃ¥ översättningen till <tp-sv@listor.tp-sv.se>\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Webbplats för %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Allmän hjälp för GNU-programvara: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(standard in)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "ogiltigt argument till -A, -B eller -C" #: src/grep.c:894 msgid "input is too large to count" msgstr "det är för mycket indata för att räkna" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: binär fil matchar" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: varning: rekursiv katalogloop" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: inmatningsfilen är även utmatningen" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Användning: %s [FLAGGA]... MÖNSTER [FIL]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Försök med â€%s --help†för mer information\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Sök efter MÖNSTER i varje FIL.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Exempel: %s -i \"hello world\" menu.h main.c\n" "MÖNSTER kan innehÃ¥lla flera mönster Ã¥tskilda av nyradstecken.\n" "\n" "Val och tolkning av mönster:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp MÖNSTER är utökade reguljära uttryck\n" " -F, --fixed-strings MÖNSTER är strängar\n" " -G, --basic-regexp MÖNSTER är enkla reguljära uttryck\n" " -P, --perl-regexp MÖNSTER är reguljära uttryck som i Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=MÖNSTER använd MÖNSTER som ett reguljärt uttryck\n" " -f, --file=FIL ta MÖNSTER frÃ¥n FIL\n" " -i, --ignore-case skilj ej pÃ¥ gemener och versaler i mönster och " "data\n" " --no-ignore-case skilj pÃ¥ gemener och versaler (standard)\n" " -w, --word-regexp matcha endast hela ord\n" " -x, --line-regexp matcha endast hela rader\n" " -z, --null-data en datarad slutar i 0 byte, inte nyradstecken\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Diverse:\n" " -s, --no-messages visa inga felmeddelanden\n" " -v, --invert-match välj rader utan träffar\n" " -V, --version visa versionsinformation och avsluta\n" " --help visa detta hjälpmeddelande och avsluta\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Kontroll av utmatning:\n" " -m, --max-count=ANTAL avsluta efter ANTAL träffar\n" " -b, --byte-offset skriv ut byte-offset med utmatningsrader\n" " -n, --line-number skriv ut radnummer med utmatningsrader\n" " --line-buffered spola utmatning för varje rad\n" " -H, --with-filename skriv ut filnamn med utmatningsrader\n" " -h, --no-filename skriv inte ut filnamnets prefix vid utmatning\n" " --label=ETIKETT skriv ut ETIKETT som filnamnsprefix för standard " "in\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching visa endast icke-tomma delar av rader som " "matchar\n" " -q, --quiet, --silent undertryck all normal utmatning\n" " --binary-files=TYP anta att binärfiler är av TYP;\n" " TYP är â€binaryâ€, â€text†eller â€without-matchâ€\n" " -a, --text samma som --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I samma som --binary-files=without-match\n" " -d, --directories=Ã…TGÄRD hur kataloger ska hanteras;\n" " Ã…TGÄRD är â€readâ€, â€recurse†eller â€skipâ€\n" " -D, --devices=Ã…TGÄRD hur enheter, FIFO och uttag ska hanteras;\n" " Ã…TGÄRD är â€read†eller â€skipâ€\n" " -r, --recursive samma som --directories=recurse\n" " -R, --dereference-recursive detsamma, men följ alla symboliska länkar\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB sök endast filer som matchar GLOB (ett " "filmönster)\n" " --exclude=GLOB hoppa över filer som matchar GLOB\n" " --exclude-from=FIL hoppa över filer som matchar filmönster frÃ¥n " "FIL\n" " --exclude-dir=GLOB kataloger som matchar GLOB hoppas över\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match skriv endast ut namn pÃ¥ FILer utan valda rader\n" " -l, --files-with-matches skriv endast ut namn pÃ¥ FILer med valda rader\n" " -c, --count skriv endast ut antalet valda rader per FIL\n" " -T, --initial-tab gör sÃ¥ att tabulatorer radas upp (om det " "behövs)\n" " -Z, --null skriv ut 0-tecken efter FILnamn\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Kontroll av sammanhang:\n" " -B, --before-context=ANTAL skriv ANTAL rader före träffad rad\n" " -A, --after-context=ANTAL skriv ANTAL rader efter träffad rad\n" " -C, --context=ANTAL skriv ANTAL rader runt träffad rad\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -ANTAL samma som --context=ANTAL\n" " --group-separator=SEP skriv ut SEP pÃ¥ rad mellan matchningar med " "sammanhang\n" " --no-group-separator skriv inte ut separator för matchningar med " "sammanhang\n" " --color[=NÄR],\n" " --colour[=NÄR] använd markörer för att särskilja träff\n" " NÄR kan vara â€alwaysâ€, â€never†eller â€autoâ€.\n" " -U, --binary ta inte bort CR-tecken vid radslut (MSDOS/" "Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "När FIL är â€-â€, läs frÃ¥n standard in. Läs â€.†dÃ¥ FIL saknas om\n" "rekursiv, läs â€-†annars. Om färre än tvÃ¥ FILer anges, anta -h.\n" "Avslutningsstatus är 0 om nÃ¥gon rad, annars 1;\n" "om nÃ¥got fel inträffar och -q inte angavs, är avslutningsstatusen 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "motstridiga söksträngar angivna" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "Perlmatchning stöds inte i ett bygge med --disable-perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "ogiltig matchning %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "okänd metod för enheter" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "varning: --unix-byte-offsets (-u) är förÃ¥ldrat" #: src/grep.c:2686 msgid "invalid max count" msgstr "ogiltigt värde för antal träffar" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "okänd binärfiltyp" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Skrivet av Mike Haertel och andra, se <https://git.sv.gnu.org/cgit/grep.git/" "tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "misslyckades med att allokera minne för JIT-stacken för PCRE" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P stöder endast unibyte- och UTF-8-lokaler" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "flaggan -P har endast stöd för ett mönster" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "internt fel (bör aldrig inträffa)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "översteg radlängdsgräns för PCRE" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: minnet är slut" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: fyllde JIT-stacken för PCRE" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: översteg gräns för PCRE-bakÃ¥tspÃ¥rning" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: översteg rekursionsgräns för PCRE" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: internt PCRE-fel: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "warning: GREP_OPTIONS är förÃ¥ldrat; använd ett alias eller ett skript" #~ msgid "warning: %s: %s" #~ msgstr "varning: %s: %s" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "Webbplats för %s: <https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "ogiltigt %s%s-argument â€%sâ€" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "ogiltigt suffix i %s%s-argumentet â€%sâ€" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s-argumentet â€%s†är för stort" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "internt fel" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: flaggan â€--%s†tillÃ¥ter inget argument\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: okänd flagga â€--%sâ€\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: flaggan â€-W %s†är tvetydig\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: flaggan â€-W %s†tillÃ¥ter inget argument\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: flaggan â€-W %s†behöver ett argument\n" #~ msgid "lseek failed" #~ msgstr "lseek misslyckades" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "MÖNSTER är, som standard, ett enkelt reguljärt uttryck (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "â€egrep†betyder â€grep -Eâ€. â€fgrep†betyder â€grep -Fâ€.\n" #~ "Direktanrop som antingen â€egrep†eller â€fgrep†är förÃ¥ldrat.\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "oskyddat ^ eller $ stöds ej med -Pz" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Webbplats för GNU Grep: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "ogiltig UTF-8-bytesekvens i inmatning" #~ msgid "unfinished repeat count" #~ msgstr "oavslutad repetitionsräknare" #~ msgid "malformed repeat count" #~ msgstr "felformaterad repetionsräknare" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "MÖNSTER är ett utökat reguljärt uttryck (ERE).\n" #~ msgid "Invocation as `egrep' is deprecated; use `grep -E' instead.\n" #~ msgstr "Körning som \"egrep\" är förÃ¥ldrat; använd \"grep -E\" istället.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "MÖNSTER är en uppsättning nyradsseparerade fasta strängar.\n" #~ msgid "Invocation as `fgrep' is deprecated; use `grep -F' instead.\n" #~ msgstr "Körning som \"fgrep\" är förÃ¥ldrat; använd \"grep -F\" istället.\n" #~ msgid "writing output" #~ msgstr "skriver utdata" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s kan endast använda %s-mönstersyntax" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "i GREP_COLORS=\"%s\", \"%s\"-kapaciteten behöver ett värde (\"=...\"); " #~ "hoppades över" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "i GREP_COLORS=\"%s\", \"%s\"-kapaciteten är boolesk och kan inte ta ett " #~ "värde (\"=%s\"); hoppades över" #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "i GREP_COLORS=\"%s\", \"%s\"-kapaciteten %s" #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "stoppade behandling av felformulerad GREP_COLORS=\"%s\" pÃ¥ Ã¥terstÃ¥ende " #~ "understrängen \"%s\"" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Styrning av utskrift:\n" #~ " -m, --max-count=NUM skriv bara ut NUM träffar\n" #~ " -b, --byte-offset skriv position med visade rader\n" #~ " -n, --line-number skriv radnummer med visade rader\n" #~ " --line-buffered töm utskriftsbuffer efter varje rad\n" #~ " -H, --with-filename skriv filnamn vid varje träff\n" #~ " -h, --no-filename skriv inte filnamn vid varje visad rad\n" #~ " --label=ETIKETT skriv ut ETIKETT som filnamn för standard in\n" #~ " -o, --only-matching visa endast delen av en rad som matchar " #~ "MÖNSTER\n" #~ " -q, --quiet, --silent undvik all normal utskrift\n" #~ " --binary-files=TYP antag att binära filer är av TYP\n" #~ " TYP är \"binary\", \"text\" eller \"without-" #~ "match\"\n" #~ " -a, --text motsvarar --binary-files=text\n" #~ " -I motsvarar --binary-files=without-match\n" #~ " -d, --directories=Ã…TGÄRD hur kataloger skall hanteras\n" #~ " Ã…TGÄRD är \"read\", \"recurse\" eller \"skip" #~ "\".\n" #~ " -D, --devices=Ã…TGÄRD hur enheter hanteras, FIFO:er och uttag\n" #~ " Ã…TGÄRD är \"read\" eller \"skip\"\n" #~ " -R, -r, --recursive motsvarar --directories=recurse\n" #~ " --include=MÖNSTER filer som matchar MÖNSTER undersöks\n" #~ " --exclude=MÖNSTER filer som matchar MÖNSTER hoppas över\n" #~ " --exclude-from=FIL filer som matchar mönster i FIL hoppas över\n" #~ " --exclude-dir=MÖNSTER kataloger som matchar MÖNSTER hoppas över.\n" #~ " -L, --files-without-match skriv bara ut FILnamn utan träffar\n" #~ " -l, --files-with-matches skriv bara ut FILnamn med träffar\n" #~ " -c, --count skriv för varje FIL bara ut antal träffade " #~ "rader\n" #~ " -T, --initial-tab gör sÃ¥ tabulatorer radar upp (om det behövs)\n" #~ " -Z, --null skriv 0-byte efter FILnamn\n" #~ msgid "unknown directories method" #~ msgstr "okänd metod gällande kataloger" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Flaggorna -P och -z kan inte kombineras" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: otillÃ¥ten flagga -- %c\n" #~ msgid "Copyright (C) 2008 Free Software Foundation, Inc.\n" #~ msgstr "Copyright © 2008 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Det här är fri programvara, se källkoden för kopieringsvillkor. Det\n" #~ "finns INGEN garanti, inte ens för SÄLJBARHET eller LÄMPLIGHET FÖR NÃ…GOT\n" #~ "SPECIELLT ÄNDAMÃ…L.\n" #~ msgid "out of memory" #~ msgstr "minnet slut" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Användning: %s [FLAGGA]... MÖNSTER [FIL]...\n" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" �������������������������������������kbuild-3608/src/grep/po/af.po�����������������������������������������������������������������������0000664�0001750�0001750�00000061771�14670377471�016032� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# grep # Copyright (C) 2004 Free Software Foundation, Inc. # Petri Jooste <rkwjpj@puk.ac.za>, 2004. # msgid "" msgstr "" "Project-Id-Version: grep 2.5g\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2004-03-03 13:33+0200\n" "Last-Translator: Petri Jooste <rkwjpj@puk.ac.za>\n" "Language-Team: Afrikaans <i18n@af.org.za>\n" "Language: af\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "" #: lib/dfa.c:896 #, fuzzy msgid "unbalanced [" msgstr "Ongebalanseerde [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" #: lib/dfa.c:1210 #, fuzzy msgid "unfinished \\ escape" msgstr "Onbeëindigde \\-ontsnapstring" #: lib/dfa.c:1371 #, fuzzy msgid "invalid content of \\{\\}" msgstr "ongeldige maks-telling" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "" #: lib/dfa.c:1858 #, fuzzy msgid "unbalanced (" msgstr "Ongebalanseerde (" #: lib/dfa.c:1975 #, fuzzy msgid "no syntax specified" msgstr "Geen sintaks gespesifiseer" #: lib/dfa.c:1986 #, fuzzy msgid "unbalanced )" msgstr "Ongebalanseerde )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Onbekende stelselfout" #: lib/getopt.c:278 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: opsie `%s' is dubbelsinnig\n" #: lib/getopt.c:284 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: opsie `%s' is dubbelsinnig\n" # +option or -option #: lib/getopt.c:319 #, fuzzy, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: onbekende opsie `%c%s'\n" #: lib/getopt.c:345 #, fuzzy, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: opsie `%c%s' laat nie 'n parameter toe nie\n" #: lib/getopt.c:360 #, fuzzy, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: opsie `%s' benodig 'n parameter\n" #: lib/getopt.c:621 #, fuzzy, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: ongeldige opsie -- %c\n" # 1003.2 specifies the format of this message. #: lib/getopt.c:636 lib/getopt.c:682 #, fuzzy, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: opsie benodig 'n parameter -- %c\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "geheue uitgeput" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" # Get translations for open and closing quotation marks. # The message catalog should translate "`" to a left # quotation mark suitable for the locale, and similarly for # "'". If the catalog has no translation, # locale_quoting_style quotes `like this', and # clocale_quoting_style quotes "like this". # For example, an American English Unicode locale should # translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and # should translate "'" to U+201D (RIGHT DOUBLE QUOTATION # MARK). A British English Unicode locale should instead # translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and # U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "'" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "" #: lib/regcomp.c:138 msgid "No match" msgstr "" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Geheue uitgeput" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "" #: src/grep.c:649 msgid "(standard input)" msgstr "(standaardtoevoer)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "ongeldige konteks-lengte-parameter" #: src/grep.c:894 msgid "input is too large to count" msgstr "toevoer is te veel om te tel" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Binêre lêer %s pas\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "rekursiewe lus van gidsinskrywings" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Gebruik so: %s [OPSIE]... PATROON [LÊER]...\n" #: src/grep.c:1963 #, fuzzy, c-format msgid "Try '%s --help' for more information.\n" msgstr "Probeer `%s --help' vir meer inligting.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Soek vir PATROON in elke LÊER of in standaardtoevoer.\n" "Voorbeeld: %s -i 'hello world' menu.h main.c\n" "\n" "Reëlmatige uitdrukking-seleksie en -interpretasie:\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp PATROON is 'n uitgebreide reëlmatige " "uitdrukking\n" " -F, --fixed-strings PATROON is 'n reeks stringe geskei met " "nuwereëlkarakters\n" " -G, --basic-regexp PATROON is 'n basic regular expression\n" " -P, --perl-regexp PATROON is 'n Perl regular expression\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=PATROON gebruik PATROON as 'n reëlmatige uitdrukking\n" " -f, --file=FILE verkry PATROON vanaf LÊER\n" " -i, --ignore-case ignoreer kasverskille\n" " -w, --word-regexp dwing PATROON om slegs op hele woorde te pas\n" " -x, --line-regexp dwing PATROON om slegs op hele reëls te pas\n" " -z, --null-data elke datareël eindig met 'n 0-greep, nie 'n " "nuwereëlkarakter nie\n" #: src/grep.c:1989 #, fuzzy, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Verskeie:\n" " -s, --no-messages onderdruk foutboodskappe\n" " -v, --invert-match soek nie-passende reëls\n" " -V, --version wys weergaweinligting en stop\n" " --help wys hierdie hulpboodskap en stop\n" " --mmap gebruik geheue-gebonde toevoer indien moontlik\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" "\n" "Konteksbeheer:\n" " -B, --before-context=AANTAL wys AANTAL reëls voorafgaande konteks\n" " -A, --after-context=AANTAL wys AANTAL reëls daaropvolgende konteks\n" " -C, --context=AANTAL wys AANTAL reëls afvoerkonteks\n" " -AANTAL dieselfde as --context=AANTAL\n" " --color[=WHEN],\n" " --colour[=WHEN] gebruik merkers om die passende string uit te " "wys\n" " WHEN kan wees: `always', `never' of `auto'.\n" " -U, --binary moenie CR-karakters by reëleindes wegvat nie " "(MSDOS)\n" " -u, --unix-byte-offsets wys uitwyking asof die CR nie daar is nie " "(MSDOS)\n" "\n" "`egrep' beteken `grep -E'. `fgrep' beteken `grep -F'.\n" "Met geen LÊER, of wanneer LÊER 'n - is, lees standaardtoevoer. \n" "Indien minder as twee LÊERs gegee is, aanvaar -h. Uittreestatus is\n" " 0 vir passing, 1 vir geen passing, en 2 vir probleemgevalle.\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "teenstrydige passers is gespesifiseer" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" #: src/grep.c:2103 #, fuzzy, c-format msgid "invalid matcher %s" msgstr "ongeldige maks-telling" #: src/grep.c:2538 msgid "unknown devices method" msgstr "onbekende metode vir toestelle" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "ongeldige maks-telling" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "onbekende binêre-lêertipe" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 #, fuzzy msgid "the -P option only supports a single pattern" msgstr "Die -P opsie word nie ondersteun nie" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "geheue uitgeput" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "" #, fuzzy, c-format #~ msgid "warning: %s: %s" #~ msgstr "waarskuwing: %s: %s\n" #, fuzzy #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: opsie `--%s' laat nie 'n parameter toe nie\n" # --option #, fuzzy #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: onbekende opsie `--%s'\n" #, fuzzy #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: opsie `-W %s' is dubbelsinnig\n" #, fuzzy #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: opsie `-W %s' laat nie 'n parameter toe nie\n" #, fuzzy #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: opsie `%s' benodig 'n parameter\n" # Cases: # {M} - exact count # {M,} - minimum count, maximum is infinity # {M,N} - M through N #~ msgid "unfinished repeat count" #~ msgstr "onbeëindigde herhaaltelling" #~ msgid "malformed repeat count" #~ msgstr "wangevormde herhaaltelling" #~ msgid "out of memory" #~ msgstr "te min geheue" #~ msgid "writing output" #~ msgstr "afvoer word geskryf" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Gebruik so: %s [OPSIE]... PATROON [LÊER] ...\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Afvoerbeheer:\n" #~ " -m, --max-count=AANTAL stop na AANTAL passings\n" #~ " -b, --byte-offset wys die greep-uitwyking saam met elke " #~ "afvoerreël\n" #~ " -n, --line-number wys die reëlnommer saam met elke afvoerreël\n" #~ " --line-buffered maak elke keer die lynbuffer leeg\n" #~ " -H, --with-filename wys die lêernaam vir elke passing\n" #~ " -h, --no-filename onderdruk die vooraf-lêernaam in die afvoer\n" #~ " --label=ETIKET wys ETIKET as lêernaam vir standaardtoevoer\n" #~ " -o, --only-matching wys slegs die deel van 'n reël wat pas op die " #~ "PATROON\n" #~ " -q, --quiet, --silent onderdruk alle normale afvoer\n" #~ " --binary-files=TIPE aanvaar dat binêre lêers van hierdie TIPE " #~ "is.\n" #~ " TIPE kan wees: 'binary', 'text', of 'without-" #~ "match'\n" #~ " -a, --text dieselfde as --binary-files=text\n" #~ " -I dieselfde as --binary-files=without-match\n" #~ " -d, --directories=AKSIE hoe om gidse te hanteer\n" #~ " AKSIE kan wees: 'read', 'recurse', of 'skip'\n" #~ " -D, --devices=AKSIE hoe om toestelle te hanteer, FIFOs en sokke\n" #~ " AKSIE kan wees: 'read' of 'skip'\n" #~ " -R, -r, --recursive dieselfde as --directories=recurse\n" #~ " --include=PATROON lêers waarop PATROON pas sal ondersoek word.\n" #~ " --exclude=PATROON lêers waarop PATROON pas sal sal oorgeslaan " #~ "word.\n" #~ " --exclude-from=FILE lêers waarop PATROON in LÊER pas sal " #~ "oorgeslaan word.\n" #~ " -L, --files-without-match wys slegs lêername wat geen passing bevat " #~ "nie\n" #~ " -l, --files-with-matches wys slegs lêername wat wel passing(s) bevat\n" #~ " -c, --count wys slegs die aantal reëls in elke LÊER wat " #~ "passings bevat\n" #~ " -Z, --null wys die 0-greep na die LÊERnaam\n" #~ msgid "" #~ "\n" #~ "Report bugs to <bug-gnu-utils@gnu.org>.\n" #~ msgstr "" #~ "\n" #~ "Rapporteer foute aan <bug-gnu-utils@gnu.org>.\n" #~ msgid "unknown directories method" #~ msgstr "onbekende metode vir gidse" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Hierdie is vry programmatuur; kyk in die bronkode vir " #~ "kopieërvoorwaardes. Daar is GEEN\n" #~ "waarborg nie; selfs nie vir VERKOOPBAARHEID of GESKIKTHEID VIR 'N " #~ "SPESIFIEKE DOEL nie.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Die -P en -z opsies kan nie gekombineer word nie" # 1003.2 specifies the format of this message. #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: ongeldige opsie -- %c\n" �������kbuild-3608/src/grep/po/ca.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000030364�14670377450�016162� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����W������Ô�����Œ������ˆ��Ï���‰��÷���Y��Õ��Q ��ü���' ��¶��$ ��U��Û ��F��1�����x�����Œ��,���¨�����Õ��.���õ��'���$��(���L�����u�����•�����—�����›��*���¬�����×�����h����������œ�����¸��$���Ð�����õ����������"�����3�����<�����[�����k��#���€�����¤�����¿��"���Ö�����ù�������&��������;�����P�����b�����t�� ���“��)��� �����Ê�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J�����Z�����\��4���y�����®��!���Í��0���ï��-��� ��.���N�����}��$���™�����¾�����Ù�����ñ����� �����)�����<�����N�����_�� ���s����������œ��,���«��*���Ø�� ����� ����� ��������*�����>�����X�� ���o��Â��{����>����E��@��\��?����ü��Ý ��ª��Ú"��g��…$�����í%��&��� &��,���1&��"���^&��1���&��,���³&��-���à&��%���'�����4'�����7'�����;'��=���P'��—���Ž'��&���&(��0���M(��-���~(�� ���¬(��-���Í(�����û(��#���)�����5)�� ���H)��'���V)�����~)�����‘)��&���©)��#���Ð)��!���ô)��!���*�����8*�����>*��9���R*�����Œ*�����©*�����À*��$���×*�����ü*��1���+�����A+�����]+��9���r+��1���¬+��-���Þ+��)��� ,��%���6,��!���\,�����~,�����œ,�����µ,�����Å,�����È,��B���è,��*���+-��5���V-��8���Œ-��4���Å-��D���ú-��(���?.��&���h.��"���.��%���².�� ���Ø.��(���ù.�����"/��%���A/�����g/�����z/�����š/��#���­/�����Ñ/��(���é/��4���0�����G0�����V0�����e0�����t0��(���0��(���¸0�����á0��������?���(��� ������8���N���<��������������E���6���4��� ���.������� �������;��������������5���>�������D���3���������������)�����������P���J���@����������$���V����������K�����������B���L����������C������U������/�������S�����������F���W���2���0����������:�����������7���R��� ���T�����������A�����������1���'���M���,�������+���������H������!���I����������������G�������*���������������������=���&��� ����������9���#�������O�������%������"���-������Q������������� ���������������������� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: invalid option -- '%c' �%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: GNU grep-3.1.48 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2019-07-18 22:11+0200 Last-Translator: Àngel Mompó <mecatxis@mecatxis.cat> Language-Team: Catalan <ca@dodds.net> Language: ca MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=2; plural=(n != 1); X-Generator: Gtranslator 2.91.7 � Control del context: -B, --before-context=NOMBRE mostra un NOMBRE de línies del context anterior -A, --after-context=NOMBRE mostra un NOMBRE de línies del context posterior -C, --context=NOMBRE mostra un NOMBRE de línies del context de sortida � Miscel·lània: -s, --no-messages suprimeix els missatges d'error -v, --invert-match selecciona les línies que no coincideixen -V, --version mostra la informació sobre la versió i surt --help mostra aquesta ajuda i surt � Control de sortida: -m, --max-count=NUM s'atura després de NUM coincidències -b, --byte-offset mostra el byte de desplaçament amb les línies de sortida -n, --line-number mostra el número de lí­nia amb les línies de sortida --line-buffered bolca la sortida a cada línia -H, --with-filename mostra el nom del fitxer amb les línies de sortida -h, --no-filename elimina els noms dels fitxers de la sortida --label=ETIQUETA fes servir ETIQUETA com a prefix del nom del fitxer per l'entrada estàndard � -E, --extended-regexp PATRONS són expressions regulars ampliades -F, --fixed-strings PATRONS són conjunts de cadenes separades per salts de línia -G, --basic-regexp PATRONS són expressions regulars bàsiques (per defecte) -P, --perl-regexp PATRONS són expressions regulars de Perl � -I equivalent a --binary-files=without-match -d, --directories=ACCIÓ com cal tractar els directoris; ACCIÓ pot ser: «read», «recurse», o «skip» -D, --devices=ACCIÓ com tractar els dispositius, FIFOs i sòcols; ACCIÓ pot ser: «read» o «skip» -r, --recursive equivalent a --directories=recurse -R, --dereference-recursive igual que l'anterior, però segueix tots els enllaços simbòlics � -L, --files-without-match mostra només els noms dels FITXERs que no tinguin cap línia seleccionada -l, --files-with-matches mostra només els noms dels FITXERs que continguin alguna línia seleccionada -c, --count mostra només el nombre de línies selecionades per FITXER -T, --initial-tab alinea les tabulacions (si cal) -Z, --null mostra byte 0 després del nom de FITXER � -o, --only-matching mostra només la part de la línia que coincideixi -q, --quiet, --silent elimina la sortida normal --binary-files=TIPUS assumeix que els fitxers binaris són de tipus TIPUS; TIPUS pot ser «binary», «text» o «without-match» -a, --text equivalent a --binary-files=text �Pàgina inicial de %s: <%s> �%s: l'opció no és vàlida -- «%c» �%s: l'opció «%s%s» no permet un argument �%s: l'opció «%s%s» és ambigua �%s: l'opció «%s%s» és ambigua; possibilitats:�%s: l'opció «%s%s» necessita un argument �%s: l'opció necessita un argument -- «%c» �%s: no es reconeix l'opció «%s%s» �»�(C)�(entrada estàndard)�-P només permet la configuració local en unibyte i en UTF-8�Exemple: %s -i «hola món» menu.h main.c PATRONS pot contenir diversos patrons separats per salts de línia. Selecció i interpretació del patró: �La referència anterior no és vàlida�El nom de la classe del caràcter no és vàlida�La compaginació del caràcter no és vàlida�El context de \{\} no és vàlid�L'expressió regular precedent no és vàlida�L'abast no és vàlid�L'expressió regular no és vàlida�Memòria exhaurida�No coincideix�No hi ha una expressió regular prèvia�Empaquetat per %s �Empaquetat per %s (%s) �Final prematur de l'expressió regular�L'expressió regular és massa gran�Informeu dels errors de %s a: %s �Busca els PATRONS a cada FITXER. �Èxit�Barra inversa final�Feu servir «%s --help» per a obtenir més informació. �Error desconegut del sistema�falten o sobren ( o \(�Falten o sobren ) o \)�Falten o sobren [, [^, [:, [., o [=�Falten o sobren \{�Forma d'ús: %s [OPCIÓ]... PATRONS [FITXER] ... �Els arguments vàlids són:�Escrit per %s i %s. �Escrit per %s, %s, %s. %s, %s, %s, %s, %s, %s, i altres. �Escrit per %s, %s, %s. %s, %s, %s, %s, %s, i %s. �Escrit per %s, %s, %s. %s, %s, %s, %s, i %s. �Escrit per %s, %s, %s. %s, %s, %s, i %s. �Escrit per %s, %s, %s. %s, %s, i %s. �Escrit per %s, %s, %s. %s, i %s. �Escrit per %s, %s, %s. i %s. �Escrit per %s, %s i %s. �Escrit per %s. �«�l'argument %s és ambigu per %s�La sintaxi de la classe de caràcter és [[:espai:]], no [:espai:]�s'han especificat expressions conflictives�s'ha superat el límit de longitud de línia del PCRE�no s'ha pogut assignar memòria per la pila JIT del PCRE�no s'ha pogut tornar al directori de treball inicial�No s'ha pogut establir el mode del descriptor de fitxers text/binari�l'entrada és massa llarga per a comptar�error intern (no hauria de passar mai)�l'argument %s no és vàlid per %s�La classe de caràcter no és vàlida�el context de \{\} no és vàlid�la longitud de l'argument no és vàlida�l'expressió %s no és vàlida�el comptador de màxims no és vàlid�memòria exhaurida�no s'ha especificat cap sintaxi�error del programa�l'expressió regular és massa gran�desbordament de la pila�l'opció -P només suporta un sol patró�no es pot enregistrar el directori de treball actual�( desaparellat�) desaparellat�[ desaparellat�Codi d'escapada \ inacabat�el tipus de fitxer binari és desconegut�el mètode de dispositius és desconegut�error d'escriptura�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/bg.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000054215�14670377450�016170� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��£��#��£��ª$��„��N&����Ó'����ì*��‘��.����—/��J��¨2��>��ó4��˜��28��k��Ë:��,���7=��4���d=��r���™=��R��� >��q���_>��8���Ñ>��5��� ?��1���@?��(���r?��N���›?��;���ê?��S���&@��>���z@��@���¹@��-���ú@��i���(A�����’A�����–A�����™A��u���¹A��º���/B��=���êB��C���(C��4���lC��3���¡C��7���ÕC��P��� D��3���^D��2���’D��8��ÅD�����þF�����G��;���8G�����tG��"���’G��ª���µG��6���`H��B���—H��D���ÚH��©���I��r���ÉI�� ���<J��#���GJ��K���kJ��2���·J��#���êJ��#���K��A���2K�����tK��C���‰K��-���ÍK����ûK��"���N��D���:N��>���N��:���¾N��6���ùN��2���0O��.���cO��*���’O��&���½O�����äO��n���P�����pP��W���tP��[���ÌP��T���(Q��W���}Q��…���ÕQ��j���[R��f���ÆR��i���-S��}���—S��R���T��(���hT��7���‘T��9���ÉT��(���U��2���,U��$���_U��)���„U�����®U��;���ÎU��$��� V��G���/V��c���wV�����ÛV�����ïV�����W��]���W��/���uW��b���¥W��e���X�����nX����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 16:17+0300 Last-Translator: Alexander Shopov <ash@kambanaria.org> Language-Team: Bulgarian <dict@ludost.net> Language: bg MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=2; plural=(n != 1); � Контрол върху контекÑта: -B, --before-context=БРОЙ извеждане на този БРОЙ предхождащи редове -A, --after-context=БРОЙ извеждане на този БРОЙ Ñледващи редове -C, --context=БРОЙ извеждане на този БРОЙ предхождащи и Ñледващи редове � Разни: -s, --no-messages без ÑÑŠÐ¾Ð±Ñ‰ÐµÐ½Ð¸Ñ Ð·Ð° грешки -v, --revert-match извеждане на неÑъвпадащите редове -V, --version извеждане на Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð·Ð° верÑиÑта и изход --help извеждане на помощна Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¸ изход � Управление на резултата: -m, --max-count=БРОЙ Ñпиране Ñлед този БРОЙ избрани редове -b, --byte-offset извеждане на отмеÑтването в байтове за вÑеки ред -n, --line-number извеждане на номерата на редовете --line-buffered буфериране по редове -H, --with-filename извеждане на името на файла при вÑÑко Ñъвпадение -h, --no-filename без извеждане на името на файла за вÑÑко Ñъвпадение --label=ЕТИКЕТ използване на ЕТИКЕТ като име за ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð¸Ñ Ð²Ñ…Ð¾Ð´ � --include=ШÐБЛОÐ_ЗÐ_ИМЕ търÑене Ñамо във файлове Ñ Ð¸Ð¼ÐµÐ½Ð°, напаÑващи ШÐБЛОÐа_ЗÐ_ИМЕ --exclude=ШÐБЛОÐ_ЗÐ_ИМЕ пропуÑкане на файлове Ñ Ð¸Ð¼ÐµÐ½Ð°, напаÑващи ШÐБЛОÐа_ЗÐ_ИМЕ --exclude-from=ФÐЙЛ пропуÑкане на файлове Ñ Ð¸Ð¼ÐµÐ½Ð°, напаÑващи на шаблоните в този ФÐЙЛ --exclude-dir=ШÐБЛОÐ_ЗÐ_ИМЕ пропуÑкане на директории Ñ Ð¸Ð¼ÐµÐ½Ð°, напаÑващи ШÐБЛОÐа_ЗÐ_ИМЕ � -E, --extended-regexp ШÐБЛОÐите Ñа разширени регулÑрни изрази -F, --fixed-regexp ШÐБЛОÐите Ñа доÑловни низове -G, --basic-regexp ШÐБЛОÐите Ñа оÑновни регулÑрни изрази (Ñтандартно) -P, --perl-regexp ШÐБЛОÐите Ñа регулÑрни изрази на Perl � -I Ñъщото като „--binary-files=without-match“ -d, --directories=ДЕЙСТВИЕ ДЕЙСТВИЕ при директориите. То може да е: „read“ (изчитане), „recurse“ (рекурÑивно търÑене) или „skip“ (пропуÑкане) -D, --devices=ДЕЙСТВИЕ ДЕЙСТВИЕ за Ñпециалните файлове, програмните канали и гнездата. То може да е „read“ (изчитане) или „skip“ (пропуÑкане) -R, -r, --recursive Ñъщото като „--directories=recurse“ � -L, --files-without-match извеждане Ñамо на имената на файлове без ÑÑŠÐ²Ð¿Ð°Ð´ÐµÐ½Ð¸Ñ -l, --files-with-matches извеждане Ñамо на имената на файлове ÑÑŠÑ ÑÑŠÐ²Ð¿Ð°Ð´ÐµÐ½Ð¸Ñ -c, --count извеждане Ñамо на Ð±Ñ€Ð¾Ñ Ñъвпадащи редове във файл -T, --initial-tab подравнÑване на табулациите при необходимоÑÑ‚ -Z, --null извеждане на знак NULL Ñлед вÑÑко име на файл � -БРОЙ Ñъщото като --context=БРОЙ --group-separator=РÐЗД извеждане на този РÐЗДелител на отделен ред между ÑъвпадениÑта Ñ ÐºÐ¾Ð½Ñ‚ÐµÐºÑÑ‚ --no-group-separator без извеждане на този РÐЗДелител между ÑъвпадениÑта --color[=КОГÐ] --colour[=КОГÐ] оцветÑване на Ñъвпадащите низове. КОГРе „always“ (винаги), „never“ (никога) или „auto“ (автоматично) -U, --binary знаците „CR“ в ÐºÑ€Ð°Ñ Ð½Ð° реда да Ñе запазват (DOS/Windows) � -e, --regexp=ШÐБЛОРШÐБЛОРза регулÑрен израз -f, --file=ФÐЙЛ изчитане на ШÐБЛОÐите от ФÐЙЛ -i, --ignore-case без разлика между главни и малки букви --no-ignore-case ÑÑŠÑ Ñ€Ð°Ð·Ð»Ð¸ÐºÐ° между главни и малки букви (Ñтандартно) -w, --word-regexp Ñъвпадане Ñамо Ñ Ñ†ÐµÐ»Ð¸ думи -x, --line-regexp Ñъвпадане Ñамо Ñ Ñ†ÐµÐ»Ð¸ редове -z, --null-data редовете завършват Ñ NULL, а не ÑÑŠÑ Ð·Ð½Ð°Ðº за нов ред � -o, --only-matching извеждане Ñамо на Ñъвпадението, а не Ñ†ÐµÐ»Ð¸Ñ Ñ€ÐµÐ´ -q, --quiet, --silent нищо не Ñе извежда, Ñамо Ñе задава изходен код --binary-files=ВИД двоичните файлове да Ñе третират като такъв ВИД ВИДът може да „binary“ (двоичен), „text“ (текÑтов), или „without-match“ (без Ñъвпадение). -a, --text Ñъщото като „--binary-files=text“ �Уеб Ñтраница на „%s“: <%s> �„%s“: двоичниÑÑ‚ файл напаÑва�%s: макÑималниÑÑ‚ брой Ð²Ñ€ÑŠÑ‰Ð°Ð½Ð¸Ñ Ð¿Ñ€Ð¸ рекурÑÐ¸Ñ Ð½Ð° „PCRE“ е превишен�%s: превишен е макÑимумът за рекурÑÐ¸Ñ Ð½Ð° „PCRE“�%s: паметта за Ñтека за изпълнение на шаблоните за „PCRE“ Ñвърши�„%s“: входниÑÑ‚ файл е и изходен�%s: вътрешна грешка на „PCRE“: %d�%s: неправилна Ð¾Ð¿Ñ†Ð¸Ñ â€” „%c“ �%s: паметта е изчерпана�%s: опциÑта „%s%s“ Ñе използва без аргументи �%s: опциÑта „%s%s“ не е еднозначна �%s: опциÑта „%s%s“ не е еднозначна. ВъзможноÑти:�%s: опциÑта „%s%s“ изиÑква аргумент �%s: опциÑта изиÑква аргумент — „%c“ �%s: непозната Ð¾Ð¿Ñ†Ð¸Ñ â€ž%s%s“ �„%s“: зациклÑне при рекурÑивна обработка на директориите�“�©�(Ñтандартен вход)�опциÑта „-P“ изиÑква локалът да е Ñ ÐµÐ´Ð½Ð¾Ð±Ð°Ð¹Ñ‚Ð¾Ð²Ð¾ кодиране или UTF-8�Пример: %s -i 'hello world' menu.h main.c Може да използвате по един ШÐБЛОРна ред. Избор на шаблона и интерпретациÑ: �Обща помощ за програмите на GNU: <%s> �Ðеправилна препратка към Ñъвпадение�Ðеправилно име на ÐºÐ»Ð°Ñ Ð·Ð½Ð°Ñ†Ð¸�Ðеправилен знак за подредба�Ðеправилно Ñъдържание в „\{\}“�ПредхождащиÑÑ‚ регулÑрен израз е неправилен�Ðеправилен край на диапазон�Ðеправилен регулÑрен израз�Лиценз — Общ публичен лиценз на GNU (GNU GPL), както е публикуван от ФондациÑта за Ñвободен Ñофтуер — верÑÐ¸Ñ 3 на лиценза или (по ваше решение) по-къÑна верÑиÑ. <%s> Тази програма е Ñвободен Ñофтуер. Можете да Ñ Ñ€Ð°Ð·Ð¿Ñ€Ð¾ÑтранÑвате и/или променÑте. Ð¢Ñ Ñе разпроÑтранÑва БЕЗ ÐИКÐКВИ ГÐРÐÐЦИИ доколкото е позволено от закона. �Паметта Ñвърши�ÐÑма ÑъвпадениÑ�ÐÑма предхождащ регулÑрен израз�Пакетирано от %s �Пакетирано от %s (%s) �ЛипÑва поддръжка на шаблони по Perl — текущата команда е компилирана Ñ Ð¾Ð¿Ñ†Ð¸Ñта „--disable-perl-regexp“.�Ранен край на регулÑрен израз�РегулÑрниÑÑ‚ израз е прекалено голÑм�Докладвайте грешки в „%s“ на адреÑ: %s �Докладвайте грешки в програмата на адреÑ: %s Докладвайте грешки в превода на адреÑ: <dict@ludost.net> �ТърÑене на текÑÑ‚, напаÑващ Ñ Ð¨ÐБЛОÐите във вÑеки зададен ФÐЙЛ. �УÑпех�Самотна „\“ накраÑ�За повече Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¸Ð·Ð¿ÑŠÐ»Ð½ÐµÑ‚Ðµ „%s --help“. �ÐеизвеÑтна ÑиÑтемна грешка�„(“ или „\(“ без еш�„)“ или „\)“ без еш�„[“, „[^“, „[:“, „[.“ или „[=“ без еш�„\{“ без еш�Употреба: %s [ОПЦИЯ]… ШÐБЛОÐ… [ФÐЙЛ]… �Възможните аргументи Ñа:�Когато ФÐЙЛът е „-“ Ñе чете ÑтандартниÑÑ‚ вход. Без ФÐЙЛ Ñе чете текущата Ð´Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ð¸Ñ â€ž.“. Ðко Ñа зададени по-малко от два ФÐЙЛа, Ñе предполага „-h“. ИзходниÑÑ‚ код на grep е 0 при поне един напаÑнат ред и 1 във вÑички оÑтанали Ñлучаи. Ðко не е зададена опциÑта „-q“ и възникне грешка, изходниÑÑ‚ код е 2. �Създадено от %s и %s. �Създадено от %s, %s, %s, %s, %s, %s, %s, %s, %s и др. �Създадено от %s, %s, %s, %s, %s, %s, %s, %s и %s. �Създадено от %s, %s, %s, %s, %s, %s, %s и %s. �Създадено от %s, %s, %s, %s, %s, %s и %s. �Създадено от %s, %s, %s, %s, %s и %s. �Създадено от %s, %s, %s, %s и %s. �Създадено от %s, %s, %s и %s. �Създадено от %s, %s и %s. �Създадено от %s. �Създадено от Mike Haertel и др., вижте <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�„�аргументът „%s“ на опциÑта „%s“ не е еднозначен�ÐºÐ»Ð°Ñ Ð·Ð½Ð°Ñ†Ð¸ Ñе указва чрез „[[:ИМЕ:]]“, а не „[:ИМЕ:]“�зададените изрази за Ñъвпадение Ñа в конфликт�макÑималниÑÑ‚ размер на реда за „PCRE“ е превишен�неуÑпешно заделÑне на памет за Ñтека за изпълнение на шаблоните за „PCRE“�не може да Ñе върне към първоначалната работна директориÑ�неуÑпешно задаване на вид на файла като текÑтов/двоичен�входните данни Ñа прекалено големи, за да бъдат преброени�вътрешна грешка, коÑто не трÑбва да възниква — молим да Ñ Ð´Ð¾ÐºÐ»Ð°Ð´Ð²Ð°Ñ‚Ðµ�аргументът „%s“ на опциÑта „%s“ е неправилен�неправилен ÐºÐ»Ð°Ñ Ð·Ð½Ð°Ñ†Ð¸�неправилно Ñъдържание в „\{\}“�неправилен размер на контекÑта�неправилен израз „%s“�неправилен макÑимален брой�паметта е изчерпана�не е зададен ÑинтакÑиÑ�програмна грешка�прекалено голÑм регулÑрен израз�препълване на Ñтека�опциÑта „-P“ поддържа Ñамо един шаблон�не може да Ñе запише ÐºÐ¾Ñ Ðµ текущата работна директориÑ�„(“ без еш�„)“ без еш�„[“ без еш�незавършена екранираща поÑледователноÑÑ‚ чрез „\“�непознат вид двоичен файл�неизвеÑтен метод за обработка на Ñпециалните файлове�ПРЕДУПРЕЖДЕÐИЕ: опциÑта „--unix-byte-offsets“ („-u“) е оÑтарÑла�грешка при запиÑ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/uk.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000054336�14670377471�016226� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��Ç��#��¦��Î$����u&��Â��(��-��Ö+��w��.��£��|/��d�� 3����…5��î��8�� ��|;��)���‰=��A���³=��Z���õ=��I���P>��(���š>��]���Ã>��.���!?��7���P?��$���ˆ?��i���­?��=���@��Z���U@��B���°@��N���ó@��1���BA��m���tA�����âA�����åA��?���èA��k���(B����”B��•���©C��8���?D��;���xD��8���´D��&���íD��N���E��<���cE��5��� E��™��ÖE�� ���pG�����‘G��R���§G�����úG�����H��¬���5H��O���âH��>���2I��D���qI��?���¶I��:���öI�� ���1J��7���<J��W���tJ��0���ÌJ��C���ýJ��C���AK��I���…K��:���ÏK��P��� L��5���[L��O��‘L�����áN��@���úN��4���;O��1���pO��,���¢O��(���ÏO��$���øO�� ���P�����>P�����[P��”���oP�����Q��3���Q��”���;Q��P���ÐQ��K���!R��\���mR��h���ÊR��‰���3S��C���½S��i���T��/���kT��0���›T��&���ÌT��G���óT��9���;U��<���uU�� ���²U��&���ÓU�����úU��>���V��#���YV��[���}V��S���ÙV��)���-W��)���WW��)���W��3���«W��9���ßW��H���X��_���bX�����ÂX����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep-3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 11:00+0300 Last-Translator: Yuri Chornoivan <yurchor@ukr.net> Language-Team: Ukrainian <trans-uk@lists.fedoraproject.org> Language: uk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=1; plural=0; X-Generator: Lokalize 20.12.0 � ÐšÐµÑ€ÑƒÐ²Ð°Ð½Ð½Ñ ÐºÐ¾Ð½Ñ‚ÐµÐºÑтом: -B, --before-context=ЧИСЛО показати ЧИСЛО Ñ€Ñдків перед Ñ€Ñдком з відповідником -A, --after-context=ЧИСЛО показати ЧИСЛО Ñ€Ñдків піÑÐ»Ñ Ñ€Ñдка з відповідником -C, --context=ЧИСЛО показати ЧИСЛО Ñ€Ñдків контекÑту виведених даних � Інше: -s, --no-messages придушити Ð¿Ð¾Ð²Ñ–Ð´Ð¾Ð¼Ð»ÐµÐ½Ð½Ñ Ð¿Ñ€Ð¾ помилки -v, --invert-match вибирати Ñ€Ñдки без збіжноÑтей -V, --version показати дані щодо верÑÑ–Ñ— Ñ– завершити роботу --help показати ці довідкові дані Ñ– завершити роботу � ÐšÐµÑ€ÑƒÐ²Ð°Ð½Ð½Ñ Ð²Ð¸Ð²ÐµÐ´ÐµÐ½Ð½Ñм даних: -m, --max-count=ЧИСЛО зупинитиÑÑ Ð¿Ñ–ÑÐ»Ñ Ð²Ð¸ÑÐ²Ð»ÐµÐ½Ð½Ñ ÐºÑ–Ð»ÑŒÐºÐ¾Ñті Ñ€Ñдків, що дорівнює ЧИСЛУ -b, --byte-offset показувати позиції у байтах разом з виведеними Ñ€Ñдками -n, --line-number показувати номери Ñ€Ñдків разом з виведеними Ñ€Ñдками --line-buffered ÑпорожнÑти буфер піÑÐ»Ñ Ð²Ð¸Ð²ÐµÐ´ÐµÐ½Ð½Ñ ÐºÐ¾Ð¶Ð½Ð¾Ð³Ð¾ Ñ€Ñдка -H, --with-filename показувати Ð´Ð»Ñ ÐºÐ¾Ð¶Ð½Ð¾Ð³Ð¾ Ñ€Ñдка назву файла -h, --no-filename не показувати назв файлів у виведених даних --label=МІТКРпоказувати МІТКУ заміÑть назви файла Ð´Ð»Ñ Ñтандартного джерела вхідних даних � --include=ВЗІРЕЦЬ шукати лише у файлах, назви Ñких відповідають ВЗІРЦЮ --exclude=ВЗІРЕЦЬ не шукати у файлах, назви Ñких відповідають ВЗІРЦЮ --exclude-from=ФÐЙЛ пропуÑтити файли, назви Ñких відповідають будь-Ñкому з шаблонів з ФÐЙЛа --exclude-dir=ВЗІРЕЦЬ пропуÑтити каталоги, назви Ñких відповідають ВЗІРЦЮ. � -E, --extended-regexp ШÐБЛОÐИ Ñ” розширеним формальним виразом -F, --fixed-strings ШÐБЛОÐИ Ñ” набором Ñ€Ñдків -G, --basic-regexp ШÐБЛОÐИ Ñ” звичайними формальними виразами -P, --perl-regexp ШÐБЛОÐИ Ñ” формальними виразами Perl � -I те Ñаме, що Ñ– --binary-files=without-match -d, --directories=ДІЯ визначити ÑпоÑіб обробки каталогів; ДІЄЮ може бути `read' (прочитати), `recurse' (обробити рекурÑивно) або `skip' (пропуÑтити) -D, --devices=ДІЯ визначити ÑпоÑіб обробки файлів приÑтроїв, FIFO та Ñокетів; ДІЄЮ може бути `read' (прочитати) або `skip' (пропуÑтити) -r, --recursive те Ñаме, що Ñ– --directories=recurse -R, --dereference-recursive подібне, але з переходом за вÑіма Ñимволічними поÑиланнÑми � -L, --files-without-match показати назви лише тих файлів, у Ñких немає вибраних Ñ€Ñдків -l, --files-with-matches показати назви лише тих файлів, у Ñких Ñ” вибрані Ñ€Ñдки -c, --count показувати лише вказану кількіÑть вибраних Ñ€Ñдків на ФÐЙЛ -T, --initial-tab вирівнювати результати табулÑцією (Ñкщо потрібно) -Z, --null вивеÑти байти 0 піÑÐ»Ñ Ð½Ð°Ð·Ð²Ð¸ ФÐЙЛа � -ЧИСЛО те Ñаме, що Ñ– --context=ЧИСЛО --group-separator=РОЗД вивеÑти Ñимвол РОЗД у Ñ€Ñдку між відповідниками з контекÑтом --no-group-separator не виводити роздільник Ð´Ð»Ñ Ð²Ñ–Ð´Ð¿Ð¾Ð²Ñ–Ð´Ð½Ð¸ÐºÑ–Ð² із контекÑтом --color[=ДЕ], --colour[=ДЕ] викориÑтовувати маркери Ð´Ð»Ñ Ð¿Ð¾Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ñ€Ñдків з відповідниками ДЕ може приймати Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ "always", "never" чи "auto". -U, --binary не вилучати Ñимволи CR на кінці Ñ€Ñдка (MSDOS/Windows) � -e, --regexp=ШÐБЛОÐИ викориÑтовувати ШÐБЛОÐИ Ð´Ð»Ñ Ð²ÑÑ‚Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ð²Ñ–Ð´Ð¿Ð¾Ð²Ñ–Ð´Ð½Ð¾Ñті -f, --file=ФÐЙЛ взÑти ШÐБЛОÐИ із ФÐЙЛа -i, --ignore-case ігнорувати регіÑтр літер у шаблонах Ñ– даних --no-ignore-case не ігнорувати регіÑтр літер (типова поведінка) -w, --word-regexp шукати лише цілі Ñлова -x, --line-regexp шукати лише цілі Ñ€Ñдки -z, --null-data Ñ€Ñдки даних закінчуютьÑÑ Ð±Ð°Ð¹Ñ‚Ð¾Ð¼ "0", а не Ñимволом ÐºÑ–Ð½Ñ†Ñ Ñ€Ñдка (\n) � -o, --only-matching показувати лише непорожні чаÑтини відповідних Ñ€Ñдків -q, --quiet, --silent придушити Ð²Ð¸Ð²ÐµÐ´ÐµÐ½Ð½Ñ Ð²ÑÑ–Ñ… звичайних даних --binary-files=ТИП припуÑкати, що вÑÑ– бінарні файли належать до ТИПу; ТИПом може бути `binary', `text' або `without-match' -a, --text те Ñаме, що Ñ– --binary-files=text �Ð”Ð¾Ð¼Ð°ÑˆÐ½Ñ Ñторінка %s: <%s> �%s: двійковий файл міÑтить збіжніÑть�%s: перевищено Ð¾Ð±Ð¼ÐµÐ¶ÐµÐ½Ð½Ñ Ð½Ð° зворотне ÑÑ‚ÐµÐ¶ÐµÐ½Ð½Ñ Ñƒ PCRE�%s: перевищено Ð¾Ð±Ð¼ÐµÐ¶ÐµÐ½Ð½Ñ Ð½Ð° рекурÑÑ–ÑŽ у PCRE�%s: вичерпано Ñтек JIT PCRE�%s: файл вхідних даних Ñ” також файлом вихідних даних�%s: Ð²Ð½ÑƒÑ‚Ñ€Ñ–ÑˆÐ½Ñ Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ° PCRE: %d�%s: некоректний параметр — «%c» �%s: пам'Ñть вичерпано�%s: Ð´Ð¾Ð´Ð°Ð²Ð°Ð½Ð½Ñ Ð°Ñ€Ð³ÑƒÐ¼ÐµÐ½Ñ‚Ñ–Ð² до параметра «%s%s» не передбачено �%s: параметр «%s%s» не Ñ” однозначним �%s: неоднозначний параметр «%s%s»; можливі варіанти:�%s: параметр «%s%s» потребує аргументу �%s: до параметра Ñлід додати аргумент — «%c» �%s: невідомий параметр «%s%s» �%s: попередженнÑ: Ð·Ð°Ñ†Ð¸ÐºÐ»ÐµÐ½Ð½Ñ Ñ€ÐµÐºÑƒÑ€Ñивного проходу каталогів�»�©�(Ñтандартне джерело вхідних даних)�у -P передбачено підтримку лише однобайтових локалей та UTF-8�Приклад: %s -i 'hello world' menu.h main.c Ð—Ð°Ð¿Ð¸Ñ Ð¨ÐБЛОÐИ може міÑтити декілька шаблонів, Ñкі відокремлено Ñимволами нового Ñ€Ñдка. Вибір за взірцем та інтерпретаціÑ: �Загальна довідкова Ñ–Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ñ–Ñ Ñ‰Ð¾Ð´Ð¾ викориÑÑ‚Ð°Ð½Ð½Ñ Ð¿Ñ€Ð¾Ð³Ñ€Ð°Ð¼Ð½Ð¾Ð³Ð¾ Ð·Ð°Ð±ÐµÐ·Ð¿ÐµÑ‡ÐµÐ½Ð½Ñ GNU: <%s> �Ðекоректне зворотне поÑиланнÑ�Ðекоректна назва клаÑу Ñимволів�Ðекоректний Ñимвол порівнÑннÑ�Ðекоректний вміÑÑ‚ \{\}�Помилка у попередньому формальному виразі�Ðекоректне Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð½Ñ Ð´Ñ–Ð°Ð¿Ð°Ð·Ð¾Ð½Ñƒ�Помилка у формальному виразі�Умови Ð»Ñ–Ñ†ÐµÐ½Ð·ÑƒÐ²Ð°Ð½Ð½Ñ Ð²Ð¸ÐºÐ»Ð°Ð´ÐµÐ½Ð¾ у GPLv3+: GNU GPL верÑÑ–Ñ— 3 або новішій, <%s> Це вільне програмне забезпеченнÑ: ви можете вільно змінювати Ñ– поширювати його. Вам не надаєтьÑÑ Ð–ÐžÐ”ÐИХ ГÐРÐÐТІЙ, окрім гарантій передбачених законодавÑтвом. �Пам'Ñть вичерпано�Ðе знайдено�Ðе виÑвлено попереднього формального виразу�ÐŸÐ°ÐºÑƒÐ²Ð°Ð½Ð½Ñ â€” %s �ÐŸÐ°ÐºÑƒÐ²Ð°Ð½Ð½Ñ â€” %s (%s) �Підтримки вÑÑ‚Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ð²Ñ–Ð´Ð¿Ð¾Ð²Ñ–Ð´Ð½Ð¾Ñті за правилами Perl у збірках із --disable-perl-regexp не передбачено�Ðеочікуване Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð½Ñ Ñ„Ð¾Ñ€Ð¼Ð°Ð»ÑŒÐ½Ð¾Ð³Ð¾ виразу�Занадто об'ємний формальний вираз�Про вади у %s повідомлÑйте на адреÑу %s �ПовідомлÑйте про вади на адреÑу: %s �Шукати ШÐБЛОÐИ у кожному ФÐЙЛі. �УÑпіх�Кінцевий Ñимвол похилої риÑки�Віддайте команду «%s --help», щоб дізнатиÑÑ Ð±Ñ–Ð»ÑŒÑˆÐµ. �Ðевідома ÑиÑтемна помилка�Ðеврівноважена поÑлідовніÑть ( або \(�Ðеврівноважена поÑлідовніÑть ) або \)�Ðезавершена поÑлідовніÑть [, [^, [:, [. або [=�Ðеврівноважена поÑлідовніÑть \{�ВикориÑтаннÑ: %s [ПÐРÐМЕТР]... ШÐБЛОÐИ [ФÐЙЛ]... �СпиÑок коректних аргументів:�Якщо ФÐЙЛом Ñ” «-», читати дані зі Ñтандартного джерела вхідних даних. Якщо не вказано ФÐЙЛ, читати «.», Ñкщо режим рекурÑивний, Ñ– «-», Ñкщо ні. Якщо вказано менше ніж два ФÐЙЛи, буде викориÑтано -h. Код Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð½Ñ 0 — Ñкщо було виÑвлено відповідник Ñ€Ñдка, 1 — коли Ñ—Ñ… нема, 2 — Ñкщо ÑталаÑÑ Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ° Ñ– не було викориÑтано параметр -q. �Ðвтори: %s Ñ– %s. �Ðвтори: %s, %s, %s, %s, %s, %s, %s, %s, %s та інші. �Ðвтори: %s, %s, %s, %s, %s, %s, %s, %s Ñ– %s. �Ðвтори: %s, %s, %s, %s, %s, %s, %s, Ñ– %s. �Ðвтори: %s, %s, %s, %s, %s, %s Ñ– %s. �Ðвтори: %s, %s, %s, %s, %s Ñ– %s. �Ðвтори: %s, %s, %s, %s Ñ– %s. �Ðвтори: %s, %s, %s Ñ– %s. �Ðвтори: %s, %s Ñ– %s. �Ðвтор — %s. �Ðвторами програми Ñ” Mike Haertel та інші програміÑти; див. <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�«�неоднозначний аргумент, %s, %s�ÑинтакÑичну конÑтрукцію клаÑу Ñимволів Ñлід визначати так: [[:space:]], а не так: [:space:]�задані умови відповідноÑті Ñ” Ñуперечливими�перевищено Ð¾Ð±Ð¼ÐµÐ¶ÐµÐ½Ð½Ñ Ð½Ð° довжину Ñ€Ñдка PCRE�не вдалоÑÑ Ð¾Ñ‚Ñ€Ð¸Ð¼Ð°Ñ‚Ð¸ облаÑть пам’Ñті під Ñтек JIT PCRE�не вдалоÑÑ Ð¿Ð¾Ð²ÐµÑ€Ð½ÑƒÑ‚Ð¸ÑÑŒ до початкового робочого каталогу�не вдалоÑÑ Ð²Ñтановити текÑтовий або двійковий режим Ð´Ð»Ñ Ð´ÐµÑкриптора файла�вхідні дані занадто довгі Ð´Ð»Ñ Ð¾Ð±Ð»Ñ–ÐºÑƒ�Ð²Ð½ÑƒÑ‚Ñ€Ñ–ÑˆÐ½Ñ Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ° (такої помилки не повинно було ÑтатиÑÑ)�некоректний аргумент, %s, %s�некоректний ÐºÐ»Ð°Ñ Ñимволів�некоректний вміÑÑ‚ \{\}�помилковий аргумент довжини контекÑту�некоректний вираз порівнÑÐ½Ð½Ñ %s�помилкова макÑимальна кількіÑть�пам'Ñть вичерпано�не вказано ÑинтакÑиÑ�помилка програми�занадто об'ємний формальний вираз�Ð¿ÐµÑ€ÐµÐ¿Ð¾Ð²Ð½ÐµÐ½Ð½Ñ Ñтека�аргументом параметра -P може бути лише один шаблон�не вдалоÑÑ Ð·Ð±ÐµÑ€ÐµÐ³Ñ‚Ð¸ поточний робочий каталог�неврівноважена дужка (�неврівноважена дужка )�неврівноважена дужка [�незавершена \-поÑлідовніÑть�невідомий тип двійкових файлів�невідомий ÑпоÑіб обробки Ð´Ð»Ñ Ð¿Ñ€Ð¸Ñтроїв�попередженнÑ: --unix-byte-offsets (-u) Ñ” заÑтарілим параметром�помилка запиÑу���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/stamp-po��������������������������������������������������������������������0000664�0001750�0001750�00000000012�14670377471�016544� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������timestamp ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/en@boldquot.header����������������������������������������������������������0000664�0001750�0001750�00000002471�14670377471�020522� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# All this catalog "translates" are quotation characters. # The msgids must be ASCII and therefore cannot contain real quotation # characters, only substitutes like grave accent (0x60), apostrophe (0x27) # and double quote (0x22). These substitutes look strange; see # http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html # # This catalog translates grave accent (0x60) and apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019). # It also translates pairs of apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019) # and pairs of quotation mark (0x22) to # left double quotation mark (U+201C) and right double quotation mark (U+201D). # # When output to an UTF-8 terminal, the quotation characters appear perfectly. # When output to an ISO-8859-1 terminal, the single quotation marks are # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to # grave/acute accent (by libiconv), and the double quotation marks are # transliterated to 0x22. # When output to an ASCII terminal, the single quotation marks are # transliterated to apostrophes, and the double quotation marks are # transliterated to 0x22. # # This catalog furthermore displays the text between the quotation marks in # bold face, assuming the VT100/XTerm escape sequences. # �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/eo.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000040714�14670377450�016202� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��Ô��#��Ý���Û$��ñ���¹%��ù��«&����¥(�� ��'*��¤��3+����Ø,��ý��X.��Ô��V0��’��+2�����¾3�����Ù3��/���ô3��'���$4��$���L4��/���q4�����¡4�����¿4�����Ý4��)���÷4��!���!5��1���C5��&���u5��'���œ5�����Ä5��&���á5�����6����� 6�� ���6��<���6�����Y6��-���é6�����7�����/7�����K7�����d7�����|7�����š7�����°7��ñ���Æ7�����¸8�� ���Î8�����Ú8�����ö8�����9��Y���9�����w9�����—9��%���°9��d���Ö9��$���;:�����`:�����h:��'���ˆ:�����°:�����Å:�����Ö:�����ç:�� ���;��1���;�����B;����\;�����{<��9���’<��2���Ì<��.���ÿ<��*���.=��&���Y=��"���€=�����£=�����Â=�����Ý=��l���í=�����Z>�����]>��?���y>�����¹>��(���Ö>��+���ÿ>��,���+?��:���X?�����“?��&���¯?�����Ö?�����ó?�����@��"���@�����B@�����Y@�����s@�����‰@�� ���¢@�����¯@�����È@��+���Ñ@��*���ý@�� ���(A�� ���2A�� ���<A�����FA�� ���XA�����yA��,���“A�� ���ÀA����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: GNU grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-10 21:36-0300 Last-Translator: Felipe Castro <fefcas@gmail.com> Language-Team: Esperanto <translation-team-eo@lists.sourceforge.net> Language: eo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=2; plural=n != 1; X-Generator: Poedit 2.4.2 � Regado de la kunteksto: -B, --before-context=NOM montri NOM liniojn da antaÅ­a kunteksto -A, --after-context=NOM montri NOM liniojn da posta kunteksto -C, --context=NOMBRO egalas al «-A NOMBRO -B NOMBRO» � Diversaj: -s, --no-messages subpremi erarmesaÄojn -v, --invert-match elekti la nekongruajn liniojn -V, --version montri programversion kaj eliri --help montri ĉi tiun helpon kaj eliri � Regado de la eligo: -m, --max-count==NOMBRO halti post NOMBRO da elektitaj linioj -b, --byte-offset montri la bitoknumeron kun eligataj linioj -n, --line-number montri la lininumeron kun eligataj linioj --line-buffered peli la eligon post ĉiu linio -H, --with-filename montri la dosiernomon antaÅ­ eligataj linioj -h, --no-filename subpremi la prefiksan dosiernomon ĉe eligo --label=ETIKEDO uzi ETIKEDOn kiel dosiernomon de ĉefenigujo � --include=ÅœABLONO ekzameni nur dosierojn kiuj kongruas kun ÅœABLONO (dosiernomÅablonoj estas "globbing" Åablonoj) --exclude=ÅœABLONO ignori dosierojn kiuj kongruas kun ÅœABLONO --exclude-from=DSRO ignori dosierojn kiuj kongruas kun Åablono en DSRO --exclude-dir=ÅœABLONO ignori dosierujojn kiuj kongruas kun ÅœABLONO � -E, --extended-regexp ÅœABLONOJ estas etenditaj regulesprimoj -F, --fixed-strings ÅœABLONOJ estas signoĉenoj -G, --basic-regexp ÅœABLONOJ estas bazaj regulesprimoj (defaÅ­lta) -P, --perl-regexp ÅœABLONOJ estas regulesprimoj de Perl � -I egalas al «--binary-files=without-match» -d, --directories=AGO kiel trakti dosierujojn; AGO estus 'read' (legi), 'recurse' (rikure), aÅ­ 'skip' (ignori) -D, --devices=AGO kiel trakti specialajn dosierojn; AGO estus 'read' (legi), aÅ­ 'skip' (ignori) -R, -r, --recursive egalas al «--directories=recurse» � -L, --files-without-match montri nur nomojn de dosieroj sen trafo -l, --files-with-matches montri nur nomojn de dosieroj kun trafoj -c, --count montri nur la nombron de kongruaj linioj en ĉiu dosiero -T, --initial-tab rektigi la TAB-signojn (se necesas) -Z, --null eligi la bitokon «0» post dosiernomo � -NOMBRO egalas al «--context=NOMBRO» --group-separator=APT montri APT en linio inter kongruoj kun kunteksto --no-group-separator ne montri apartigilon por kongruoj kun kunteksto --color[=KIAM], --colour[=KIAM] uzi markilojn por distingi la kongruajn ĉenojn; KIAM estu 'always' (ĉiam), 'never' (neniam), aÅ­ 'auto' -U, --binary ne forigi \r-signojn ĉe linifino (MSDOS/Windows) � -e, --regexp=ÅœABLONOJ uzi ÅœABLONOJn kiel regulesprimojn -f, --file=DOSIERO akiri la Åablonojn el DOSIERO -i, --ignore-case ignori diferencojn de uskleco, Åablone kaj datene --no-ignore-case ne ignori diferencojn de uskleco (defaÅ­lta) -w, --word-regexp kongrui nur kun tutaj vortoj -x, --line-regexp kongrui nur kun tutaj linioj -z, --null-data datenlinio finiÄas per bitoko 0, ne per linifino � -o, --only-matching montri nur nevakajn kongruajn linipartojn -q, --quiet, --silent subpremi ĉian normalan eligadon --binary-files=SPECO supozi ke duumaj dosieroj estas de SPECO; SPECO estus 'binary' (duuma), 'text' (teksta), aÅ­ 'without-match' (sen-trafa) -a, --text egalas al «--binary-files=text» �HejmpaÄo de «%s»: <%s> �%s: duuma dosiero kongruas�%s: transpasiÄis retroreferencan limon de PCRE�%s: transpasiÄis rikuran limon de PCRE�%s: la PCRE-JIT-stako tute pleniÄis�%s: eniga dosiero estas ankaÅ­ la eliga dosiero�%s: interna eraro en PCRE: %d�%s: nevalida opcio -- «%c» �%s: mankas sufiĉa memoro�%s: opcio «%s%s» ne toleras argumenton �%s: opcio «%s%s» estas ambigua �%s: opcio «%s%s» estas ambigua; eblaĵoj estas:�%s: opcio «%s%s» bezonas argumenton �%s: opcio bezonas argumenton -- «%c» �%s: nekonata opcio «%s%s» �%s: averto: rikura ciklo de dosierujoj�»�©�(ĉefenigujo)�opcio «-P» subtenas nur unubajtajn kaj UTF-8-ajn lokaĵojn�Ekzemplo: %s -i 'hello world' menu.h main.c ÅœABLONOJ povas esti pluraj Åablonoj disigitaj per linifinoj. Elekto kaj interpreto de Åablono: �Äœenerala helpo por uzi GNU-programojn: <%s> �Nevalida retroreferenco�Nevalida nomo de signoklaso�Nevalida kunmetita signo�Nevalida enhavo de \{\}�Nevalida antaÅ­a regulesprimo�Nevalida fino de gamo�Nevalida regulesprimo�Ĉi tiu estas libera programaro: vi rajtas Äin ÅanÄi kaj redistribui. La Äusta permesilo estas GPLv3+: GNU GPL versio 3 aÅ­ sekva; por la kompleta (angla) teksto vidu <%s>. Ĉi tiu programaro ne garantiatas, ene de la limoj de la leÄo. �Mankas sufiĉa memoro�Neniu trafo�Mankas antaÅ­a regulesprimo�Pakigita far %s �Pakigita far %s (%s) �Perla kongruo ne funkcias ĉar ĉi tiu programo kompiliÄis kun «--disable-perl-regexp»�Neatendita fino de regulesprimo�Regulesprimo tro grandas�Raportu programmisojn en %s al: <%s> �Raportu programmisojn al <%s>; sciigu tradukerarojn al <translation-team-eo@lists.sourceforge.net>. �Serĉas ÅœABLONOJn en ĉiu DOSIERO. �Sukceso�Malsuprenstreko '\' ĉe la fino�Tajpu '%s --help' por pli da informoj. �Nekonata sistemeraro�Senpara ( aÅ­ \(�Senpara ) aÅ­ \)�Senpara [, [^, [:, [., aÅ­ [=�Senpara \{�Uzmaniero: %s [OPCIO...] ÅœABLONOJ [DOSIERO...] �Validaj argumentoj estas:�Kiam DOSIERO estas «-», ĉefenigujo legiÄas. Kiam DOSIERO mankas, «.» legiÄas se rikura, alie «-» legiÄas. Kiam malpli ol du DOSIEROj indikatas, «-h» supoziÄas. Elirstato estas 0 se iu linio elektiÄis, alie 1; se iu eraro okazis kaj «-q» ne indikatis, elirstato estas 2. �Verkita de %s kaj %s. �Verkita de %s, %s, %s, %s, %s, %s, %s, %s, %s kaj aliaj. �Verkita de %s, %s, %s, %s, %s, %s, %s, %s kaj %s. �Verkita de %s, %s, %s, %s, %s, %s, %s kaj %s. �Verkita de %s, %s, %s, %s, %s, %s kaj %s. �Verkita de %s, %s, %s, %s, %s kaj %s. �Verkita de %s, %s, %s, %s kaj %s. �Verkita de %s, %s, %s kaj %s. �Verkita de %s, %s kaj %s. �Verkita de %s. �Verkita de Majk HERTEL (Mike Haertel) kaj aliuloj; vidu <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�«�ambigua argumento %s por %s�sintakso de signoklaso estas ekzemple [[:spaco:]], ne [:spaco:]�pluraj esprimtipoj indikatas�transpasiÄis linilongecan limon de PCRE�mankas sufiĉa memoro por la PCRE-JIT-stako�malsukcesis reveni al komenca labordosierujo�malsukcesis agordi tekstan/duuman moduson de dosierpriaĵo�enigo tro longas por nombri�**interna eraro** (devus neniam okazi)�nevalida argumento %s por %s�nevalida signoklaso�nevalida enhavo de \{\}�nevalida kuntekstlongeca argumento�nevalida esprimtipo %s�nevalida maksimuma nombro�mankas sufiĉa memoro�neniu sintakso indikatas�programeraro�regulesprimo tro grandas�staktroo�opcio «-P» akceptas nur unuopan Åablonon�ne eblas registri aktualan labordosierujon�senpara (�senpara )�senpara [�nefinita \-eskapo�nekonata ago por duumaj dosieroj�nekonata ago por aparatoj�averto: --unix-byte-offsets (-u) malaktualas�skrib-eraro�����������������������������������������������������kbuild-3608/src/grep/po/ro.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000033661�14670377471�016225� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����]�����������ì������è��Ï���é��÷���¹��Õ��± ��ü���‡ ��¶��„ ��U��;��¤��‘��F��6�����}�����‘��,���­�����Ú��.���ú��'���)��(���Q�����z�����š�����œ����� ��*���±�����Ü��&���m�����”�����«�����È�����ä��$���ü�����!�����3��ª���N�����ù����� ����������2�����B��<���W��#���”�����¸�����Ó�����ê��"���þ�����!�����)��&���<�����c�����x�����Š�����œ�� ���»��)���È�����ò�������;�����3���Z��/���Ž��+���¾��'���ê��#��������6�����V�����r��\���‚�����ß�����á��4���þ�����3��!���R��0���t��-���¥��.���Ó�������$��������C�����^�����v�����Ž�����®�����Á�����Ó�����ä�� ���ø����������!��,���0��*���]�� ���ˆ�� ���•�� ���¢�����¯�����Ã�����Ý�� ���ô��·�����þ���¸����·��7��Ð ��ü���#�� ��$��¡��&&��ì��È'��p��µ)�����&+��#���D+��0���h+��'���™+��7���Á+��/���ù+��0���),��(���Z,�����ƒ,�����…,�����‰,��/���œ,��“���Ì,��-���`-�����Ž-��"���¬-��&���Ï-�����ö-��(���.�����9.�����W.��Í���t.�����B/�����Q/��+���f/�����’/�����¥/��I���½/��(���0�����00��#���M0�� ���q0��*���’0�����½0��#���Ä0��:���è0�����#1�����A1�����Y1��$���q1�����–1��0���¨1�����Ù1�����ò1��9���2��1���A2��-���s2��)���¡2��%���Ë2��!���ñ2�����3�����13�� ���J3��b���X3�����»3�����½3��@���Û3��5���4��0���R4��0���ƒ4��6���´4��E���ë4��/���15��:���a5�����œ5�����º5�����Ø5��!���ï5�����6�����(6�����D6�� ���S6�����t6��!���†6�����¨6��*���¼6��3���ç6�� ���7�� ���(7�� ���57�����B7�����V7��)���u7�����Ÿ7��������E������#������=���T���B��������������-���;���9������3������� ���\���A��������������:���D���%���J���8�����������?���.�����������V���P���F����������(���)����������Q�����������H���R����������I������[������4�������Y���!�������L���]���7���5������� ���@�����������<���X��� ���Z�������K���G�����������6���,���S���1�������0���������N������$���O����������������M����������������������������C���+��� ����������>���'���/���U�������*������&���2������W������������� �������"����������� ���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: invalid option -- '%c' �%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep 3.3.42 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2020-06-24 11:09+0300 Last-Translator: Florentina MuÈ™at <florentina.musat.28@gmail.com> Language-Team: Romanian <translation-team-ro@lists.sourceforge.net> Language: ro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Poedit 2.3.1 � Control de context: -B, --before-context=NUM tipăreÈ™te NUM linii ale contextului de început -A, --after-context=NUM tipăreÈ™te NUM linii ale contextului de urmărire -C, --context=NUM tipăreÈ™te NUM linii al contextului de ieÈ™ire � Diverse: -s, --no-messages suprimă mesajele de eroare -v, --invert-match selectează liniile care nu se potrivesc -V, --version afiÈ™ează informaÈ›iile de versiune È™i ieÈ™i --help afiÈ™ează acest text de ajutor È™i ieÈ™i � Control de ieÈ™ire: -m, --max-count=NUM opreÈ™te după NUM linii selectate -b, --byte-offset tipăreÈ™te decalajul de octet cu liniile de ieÈ™ire -n, --line-number tipăreÈ™te numărul liniei cu liniile de ieÈ™ire --line-buffered goleÈ™te ieÈ™irea la fiecare linie -H, --with-filename tipăreÈ™te numele fiÈ™ierului cu liniile de ieÈ™ire -h, --no-filename suprimă prefixul numelui de fiÈ™ier la ieÈ™ire --label=ETICHETÄ‚ utilizează ETICHETÄ‚ ca prefixul numelui de fiÈ™ier de intrare standard � -E, --extended-regexp MODELELE sunt expresii regulate extinse -F, --fixed-strings MODELELE sunt È™iruri -G, --basic-regexp MODELELE sunt expresii regulate de bază -P, --perl-regexp MODELELE sunt expresii regulate PERL � -I echivalent cu --binary-files=fără-potrivire -d, --directories=ACÈšIUNE cum să se manipuleze directoarele; ACÈšIUNE este „citeÈ™teâ€, „recursivitateâ€, sau „omite†-D, --devices=ACÈšIUNE cum să se manipuleze dispozitive, FIFO-uri È™i socluri; ACÈšIUNE este „citeÈ™te†sau „omite†-r, --recursive like --directories=recursivitate -R, --dereference-recursive de asemenea, dar urmăreÈ™te toate legăturile simbolice � -L, --files-without-match tipăreÈ™te doar numele de FIȘIERE fără linii selectate -l, --files-with-matches tipăreÈ™te doar numele de FIȘIERE cu linii selectate -c, --count tipăreÈ™te doar un număr al liniilor selectate per FIȘIER -T, --initial-tab face ca tab-urile să fie aliniate (dacă este nevoie) -Z, --null tipăreÈ™te octetul 0 după numele de FIȘIER � -e, --regexp=MODELE utilizează MODELELE pentru potrivire -f, --file=FIȘIER ia MODELELE de la FIȘIER -i, --ignore-case ignoră distincÈ›iile de majuscule în modele È™i date --no-ignore-case nu ignora distincÈ›iile de majuscule (implicit) -w, --word-regexp potriveÈ™te doar cuvinte întregi -x, --line-regexp potriveÈ™te doar linii întregi -z, --null-data o linie de date se termină în octetul 0, nu în linie nouă � -o, --only-matching arată doar părÈ›ile pline ale liniilor care se potrivesc -q, --quiet, --silent suprimă toată ieÈ™irea normală --binary-files=TIP presupune că fiÈ™ierele binare sunt TIP; TIP este „binarâ€, „text†sau „fără-potrivire†-a, --text echivalent cu --binary-files=text �%s pagină principală: <%s> �%s: opÈ›iune nevalidă -- „%c†�%s: opÈ›iunea „%s%s†nu permite un argument �%s: opÈ›iunea „%s%s†este ambiguă �%s: opÈ›iunea „%s%s†este ambiguă; posibilități:�%s: opÈ›iunea „%s%s†necesită un argument �%s: opÈ›iunea necesită un argument -- „%c†�%s: opÈ›iunea nerecunoscută „%s%s†�'�(C)�(intrare standard)�-P suportă doar localizări unioctet È™i UTF-8�Exemplu: %s -i 'hello world' menu.h main.c MODELELE pot conÈ›ine modele multiple separate prin linii noi. Selectarea modelelor È™i interpretarea: �Ajutor general utilizând software GNU: <%s> �Referință înapoi nevalidă�Nume de clasă de caracter nevalid�Caracter de ordine alfabetică nevalid�ConÈ›inut nevalid al \{\}�Expresie regulată precedentă nevalidă�SfârÈ™it de interval nevalid�Expresie regulată nevalidă�LicenÈ›a GPLv3+: GNU GPL versiunea 3 sau mai mare <%s>. Acesta este software liber: sunteÈ›i liber să îl modificaÈ›i È™i să îl redistribuiÈ›i. NU există NICIO GARANÈšIE, în măsura permisă de lege. �Memorie plină�Nu există potrivire�Nu există o expresie regulată anterioară�ÃŽmpachetat de %s �ÃŽmpachetat de %s (%s) �Potrivirea Perl nu este suportată într-o generare --disable-perl-regexp�SfârÈ™it prematur al expresiei regulate�Expresie regulată prea mare�RaportaÈ›i defecÈ›iunile %s la: %s �RaportaÈ›i defecÈ›iunile la: %s �Caută pentru MODELE în fiecare FIȘIER. �Succes�Linie oblică inversă de urmărire�ÃŽncercaÈ›i „%s --help†pentru mai multe informaÈ›ii. �Eroare de sistem necunoscută�( sau \( fără pereche�) sau \) fără pereche�[, [^, [:, [., sau [= fără pereche�\{ fără pereche�Utilizare: %s [OPÈšIUNE]... MODELE [FIȘIER]... �Argumentele valide sunt:�Scris de %s È™i %s. �Scris de %s, %s, %s, %s, %s, %s, %s, %s, %s, È™i alÈ›ii. �Scris de %s, %s, %s, %s, %s, %s, %s, %s, È™i %s. �Scris de %s, %s, %s, %s, %s, %s, %s, È™i %s. �Scris de %s, %s, %s, %s, %s, %s, È™i %s. �Scris de %s, %s, %s, %s, %s, È™i %s. �Scris de %s, %s, %s, %s, È™i %s. �Scris de %s, %s, %s, È™i %s. �Scris de %s, %s È™i %s. �Scris de %s. �Scris de Mike Haertel È™i alÈ›ii; consultaÈ›i <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�argument ambiguu %s pentru %s�sintaxa de clasă de caractere este [[:spaÈ›iu:]], nu [:spaÈ›iu]�conflicte între căutătorii (matchers) specificaÅ£i�s-a depășit limita de lungime a liniei al PCRE�nu s-a putut aloca memorie pentru stiva PCRE JIT�nu s-a putut întoarce la directorul de lucru iniÈ›ial�nu s-a putut stabili modul de text/binar al descriptorului de fiÈ™ier�intrarea(input) este prea mare pentru numărare�eroare internă (nu ar trebui să se întâmple vreodată)�argument nevalid %s pentru %s�clasă de caractere nevalidă�\{\} conÈ›inut nevalid�parametru lungime context invalid�potrivire nevalidă %s�numărare maximă invalidă�memorie plină�nu s-a specificat nicio sintaxă�eroare de program�expresia regulată este prea mare�supraplin de stivă�opÈ›iunea -P suportă doar un singur model�nu s-a putut înregistra directorul de lucru curent�( nebalansat�) nebalansat�[ nebalansat�\ escape neterminat�tip fiÅŸiere-binare necunoscut�metodă dispozitive(devices) necunoscută�eroare de scriere��������������������������������������������������������������������������������kbuild-3608/src/grep/po/ga.po�����������������������������������������������������������������������0000664�0001750�0001750�00000100640�14670377450�016015� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Irish translations for grep. # Copyright (C) 2003 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Kevin Patrick Scannell <scannell@SLU.EDU>, 2003, 2007, 2009, 2011, 2017. msgid "" msgstr "" "Project-Id-Version: grep 3.0.23-b00\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2017-06-25 05:18-0600\n" "Last-Translator: Kevin Scannell <kscanne@gmail.com>\n" "Language-Team: Irish <gaeilge-gnulinux@lists.sourceforge.net>\n" "Language: ga\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "argóint neamhbhailí %s le haghaidh %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "argóint dhébhríoch %s le haghaidh %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Na hargóintí bailí:" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "earráid sa scríobh" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ corr" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "Aicme charachtar neamhbhailí" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" "Is é [[:space:]] an chomhréir cheart in aicme carachtar, in ionad [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "Seicheamh éalúcháin \\ gan chríochnú" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "ábhar neamhbhailí laistigh de \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "slonn ionadaíochta rómhór" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( corr" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "níor sonraíodh aon chomhréir" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") corr" #: lib/error.c:195 msgid "Unknown system error" msgstr "Earráid anaithnid chórais" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: tá rogha '%s%s' débhríoch\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: tá rogha '%s%s' débhríoch; féidearthachtaí:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: rogha anaithnid '%s%s'\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: ní cheadaítear argóint i ndiaidh rogha '%s%s'\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: tá argóint de dhíth i ndiaidh rogha '%s%s'\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: rogha neamhbhailí -- '%c'\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: tá argóint de dhíth i ndiaidh na rogha -- '%c'\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "cuimhne ídithe" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "ní féidir an chomhadlann oibre a fháil" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "níorbh fhéidir filleadh ar an mbunchomhadlann oibre" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "níorbh fhéidir mód téacs/dénártha an tuairisceora comhaid a shocrú" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "D'éirigh leis" #: lib/regcomp.c:138 msgid "No match" msgstr "Níl a leithéid ann" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Slonn ionadaíochta neamhbhailí" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Carachtar neamhbhailí cóimheasa" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Ainm neamhbhailí ar aicme charachtar" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Cúlslais ag an deireadh" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Cúltagairt neamhbhailí" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "[, [^, [:, [., nó [= corr" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( nó \\( corr" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ corr" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Ãbhar neamhbhailí laistigh de \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Deireadh raoin neamhbhailí" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Cuimhne ídithe" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Tá an slonn ionadaíochta roimhe seo neamhbhailí" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Deireadh an tsloinn gan choinne" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Slonn ionadaíochta rómhór" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") nó \\) corr" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Níl aon slonn ionadaíochta roimhe seo" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Arna phacáistiú ag %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Arna phacáistiú ag %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, fuzzy, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "\n" "Ceadúnas GPLv3+: GNU GPL leagan 3 nó níos nuaí <http://gnu.org/licenses/gpl." "html>.\n" "Is saorbhogearra é seo: ceadaítear duit é a athrú agus a athdháileadh.\n" "Níl baránta AR BITH ann, an oiread atá ceadaithe de réir dlí.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Scríofa ag %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Scríofa ag %s agus %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Scríofa ag %s, %s, agus %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Scríofa ag %s, %s, %s,\n" "agus %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Scríofa ag %s, %s, %s,\n" "%s, agus %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Scríofa ag %s, %s, %s,\n" "%s, %s, agus %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Scríofa ag %s, %s, %s,\n" "%s, %s, %s, agus %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Scríofa ag %s, %s, %s,\n" "%s, %s, %s, %s,\n" "agus %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Scríofa ag %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, agus %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Scríofa ag %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, agus daoine eile nach iad.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "Seol tuairiscí ar fhabhtanna chuig: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Seol tuairiscí ar fhabhtanna i %s chuig: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Leathanach baile %s: <%s>\n" #: lib/version-etc.c:260 #, fuzzy, c-format msgid "General help using GNU software: <%s>\n" msgstr "" "Cabhair ghinearálta maidir le bogearraí GNU: <http://www.gnu.org/gethelp/>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(gnáth-ionchur)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "tá an argóint a shonraíonn fad an chomhthéacs neamhbhailí" #: src/grep.c:894 msgid "input is too large to count" msgstr "tá an t-ionchur rómhór le háireamh" # using lit. "matching string" throughout for "match" - KPS #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Teaghrán comhoiriúnach sa chomhad dhénártha %s\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "lúb athchúrsach i gcomhadlann" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "is ionann an t-inchomhad %s agus an t-aschomhad" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Úsáid: %s [ROGHA]... PATRÚN [COMHAD]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Bain triail as '%s --help' chun tuilleadh eolais a fháil.\n" #: src/grep.c:1969 #, fuzzy, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Déan cuardach ar PATRÚN i ngach COMHAD.\n" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Mar shampla: %s -i 'dia duit' rogha.h príomh.c\n" "\n" "Roghnú agus léirmhíniú patrún:\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp is slonn ionadaíochta breisithe é PATRÚN\n" " -F, --fixed-strings is tacar teaghrán é PATRÚN, línte nua eatarthu\n" " -G, --basic-regexp is slonn ion. bunúsach é PATRÚN (réamhshocrú)\n" " -P, --perl-regexp is slonn ionadaíochta Perl é PATRÚN\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=PATRÚN déan cuardach ar PATRÚN\n" " -f, --file=COMHAD faigh PATRÚN as COMHAD\n" " -i, --ignore-case déan neamhaird de chás na litreacha\n" " -w, --word-regexp meaitseálann PATRÚN focail iomlána amháin\n" " -x, --line-regexp meaitseálann PATRÚN línte iomlána amháin\n" " -z, --null-data léiríonn beart '0' deireadh na líne (vs. \\n)\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Roghanna éagsúla:\n" " -s, --no-messages ná taispeáin teachtaireachtaí earráide\n" " -v, --invert-match taispeáin na línte GAN teaghrán comhoiriúnach\n" " -V, --version taispeáin eolas faoin leagan agus scoir\n" " --help taispeáin an chabhair seo agus scoir\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Rialú aschurtha:\n" " -m, --max-count=UIMHIR stop i ndiaidh UIMHIR líne chomhoiriúnach\n" " -b, --byte-offset taispeáin an fritháireamh birt san aschur\n" " -n, --line-number taispeáin líne-uimhreacha san aschur\n" " --line-buffered sruthlú an aschuir i ndiaidh gach líne\n" " -H, --with-filename taispeáin ainm comhaid le línte comhoiriúnacha\n" " -h, --no-filename ná taispeáin ainmneacha comhad mar réimír\n" " --label=LIPÉAD úsáid LIPÉAD mar ainm ar an ngnáth-ionchur\n" #: src/grep.c:2007 #, fuzzy, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching ná taispeáin ach an teaghrán comhoiriúnach\n" " -q, --quiet, --silent múch an gnáth-aschur\n" " --binary-files=CINEÃL glac le comhaid dhénártha mar CINEÃL;\n" " CINEÃL = 'binary', 'text', nó 'without-match'\n" " -a, --text ar comhbhrí le '--binary-files=text'\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I ar comhbhrí le '--binary-files=without-match'\n" " -d, --directories=MODH modh oibre le haghaidh comhadlanna;\n" " MODH = 'read', 'recurse', nó 'skip'\n" " -D, --devices=MODH modh oibre le haghaidh gléasanna, FIFOnna,\n" " agus soicéid; MODH = 'read' nó 'skip'\n" " -r, --recursive ar comhbhrí le '--directories=recurse'\n" " -R, --dereference-recursive mar an gcéanna, ach lean naisc shiombalacha\n" #: src/grep.c:2023 #, fuzzy, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=PATRÚN déan cuardach i gcomhaid chomhoiriúnacha amháin\n" " --exclude=PATRÚN ná déan cuardach i gcomhaid chomhoiriúnacha\n" " --exclude-from=COMHAD ná déan cuardach i gcomhaid atá comhoiriúnach " "le\n" " haon phatrún i gCOMHAD\n" " --exclude-dir=PATRÚN ná déan cuardach i gcomhadlanna comhoiriúnacha.\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match ná taispeáin ach ainmneacha comhaid GAN\n" " teaghrán comhoiriúnach\n" " -l, --files-with-matches ná taispeáin ach ainmneacha comhaid LE\n" " teaghrán comhoiriúnach\n" " -c, --count ná taispeáin ach líon na dteaghrán " "comhoiriúnach\n" " i ngach comhad\n" " -T, --initial-tab Ailínigh na táib (más gá)\n" " -Z, --null priontáil beart '0' i ndiaidh ainm an chomhaid\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Rialú comhthéacs:\n" " -B, --before-context=UIMH taispeáin UIMH líne de chomhthéacs tosaigh\n" " -A, --after-context=UIMH taispeáin UIMH líne de chomhthéacs deiridh\n" " -C, --context=UIMHIR taispeáin UIMHIR líne de chomhthéacs\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -UIMHIR ar comhbhrí le --context=UIMHIR\n" " --color[=CATHAIN],\n" " --colour[=CATHAIN] aibhsigh na teaghráin chomhoiriúnacha;\n" " CATHAIN = 'always', 'never' nó 'auto'\n" " -U, --binary ná scrios carachtair CR (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Más é '-' an COMHAD, léigh ón ionchur caighdeánach. Gan COMHAD ar bith,\n" "léigh . má tá an rogha -r ann, agus - mura bhfuil. Má tá níos lú ná dhá\n" "chomhad ann, úsáid '-h'. Stádas scortha: 0 má roghnaíodh líne ar bith,\n" "1 murar roghnaíodh, agus 2 má tharlaíonn earráid ar bith gan rogha -q.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "sonraíodh patrúin chontrártha" #: src/grep.c:2101 #, fuzzy msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Tiomsaíodh an clár dénártha seo le --disable-perl-regexp agus gan tacaíocht " "do rogha -P" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "meaitseálaí neamhbhailí %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "modh anaithnid gléasanna" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "uasmhéid neamhbhailí" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "cineál anaithnid de chomhad dénártha" #: src/grep.c:2829 #, fuzzy msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "agus daoine eile, féach ar <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "níorbh fhéidir cuimhne a dháil le haghaidh na cruaiche PCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "Tacaíonn an rogha -P logchaighdeáin aonbhearta agus UTF-8 amháin" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "Ní thacaíonn rogha -P ach le patrún amháin" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "earráid inmheánach (ní tharlaíonn seo riamh)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "sáraíodh uasfhad líne PCRE" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "cuimhne ídithe" #: src/pcresearch.c:310 #, fuzzy, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "cruach PCRE JIT líonta" #: src/pcresearch.c:315 #, fuzzy, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "sáraíodh teorainn PCRE ar chúlú" #: src/pcresearch.c:319 #, fuzzy, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "sáraíodh teorainn PCRE ar chúlú" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "earráid inmheánach PCRE: %d" #, c-format #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "rabhadh: ní mholtar GREP_OPTIONS a úsáid a thuilleadh; bain úsáid as " #~ "ailias nó as script" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "rabhadh: %s: %s" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "argóint neamhbhailí %s%s '%s'" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "iarmhír neamhbhailí tar éis argóint %s%s '%s'" #~ msgid "%s%s argument '%s' too large" #~ msgstr "argóint %s%s rómhór: '%s'" #, fuzzy #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "Leathanach baile %s: <http://www.gnu.org/software/%s/>\n" #~ msgid "internal error" #~ msgstr "earráid inmheánach" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: ní cheadaítear argóint i ndiaidh rogha '--%s'\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: rogha anaithnid '--%s'\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: tá an rogha '-W %s' débhríoch\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: ní cheadaítear argóint i ndiaidh rogha '-W %s'\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: tá argóint de dhíth i ndiaidh rogha '-W %s'\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "" #~ "Is slonn ionadaíochta bunúsach (BRE) é PATRÚN, de réir réamhshocraithe.\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "'egrep' = 'grep -E', agus 'fgrep' = 'grep -F'.\n" #~ "Tá na horduithe 'egrep' agus 'fgrep' imithe i léig.\n" #~ msgid "unfinished repeat count" #~ msgstr "Tá líon na hathráite neamhiomlán" # more precisely, "the string indicating the repeat count" is malformed -- KPS #~ msgid "malformed repeat count" #~ msgstr "Tá líon na hathráite míchumtha" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "Is slonn ionadaíochta feabhsaithe (ERE) é PATRÚN.\n" #~ msgid "Invocation as `egrep' is deprecated; use `grep -E' instead.\n" #~ msgstr "Tá an t-ordú `egrep' imithe i léig; úsáid `grep -E' ina ionad.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "Is tacar teaghrán é PATRÚN, scartha le línte nua.\n" #~ msgid "Invocation as `fgrep' is deprecated; use `grep -F' instead.\n" #~ msgstr "Tá an t-ordú `fgrep' imithe i léig; úsáid `grep -F' ina ionad.\n" #~ msgid "lseek failed" #~ msgstr "theip ar lseek" #~ msgid "writing output" #~ msgstr "aschur á scríobh" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Leathanach baile GNU Grep: <%s>\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "Ní féidir le %s ach comhréir phatrúin %s a úsáid" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "I GREP_COLORS=\"%s\", tá luach (\"=...\") de dhíth i ndiaidh acmhainn \"%s" #~ "\"; rinneadh neamhaird de." #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "I GREP_COLORS=\"%s\", is den chineál boole é an acmhainn \"%s\" agus ní " #~ "cheadaítear luach (\"=%s\") ina dhiaidh; rinneadh neamhaird de." #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "I GREP_COLORS=\"%s\", an acmhainn \"%s\": %s" #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "Scoireadh ó phróiseáil teaghrán míchumtha GREP_COLORS=\"%s\" ag an " #~ "bhfotheaghrán atá fágtha: \"%s\"" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Rialú aschurtha:\n" #~ " -m, --max-count=UIMHIR stop i ndiaidh UIMHIR líne comhoiriúnach\n" #~ " -b, --byte-offset taispeáin an fritháireamh birt san aschur\n" #~ " -n, --line-number taispeáin líne-uimhreacha san aschur\n" #~ " --line-buffered déan sruthlú an aschuir i ndiaidh gach líne\n" #~ " -H, --with-filename taispeáin ainm comhaid le línte " #~ "comhoiriúnacha\n" #~ " -h, --no-filename ná taispeáin ainmneacha comhad\n" #~ " --label=LIPÉAD úsáid LIPÉAD mar ainm ar an ngnáth-ionchur\n" #~ " -o, --only-matching ná taispeáin ach an teaghrán comhoiriúnach\n" #~ " -q, --quiet, --silent múch an gnáth-aschur\n" #~ " --binary-files=CINEÃL glac le comhaid dhénártha mar CINEÃL;\n" #~ " CINEÃL = 'binary', 'text', nó 'without-" #~ "match'\n" #~ " -a, --text ar comhbhrí le '--binary-files=text'\n" #~ " -I ar comhbhrí le '--binary-files=without-" #~ "match'\n" #~ " -d, --directories=MODH modh oibre le haghaidh comhadlanna\n" #~ " MODH = 'read', 'recurse', nó 'skip'\n" #~ " -D, --devices=MODH modh oibre le haghaidh gléasanna, FIFOnna,\n" #~ " agus soicéid; MODH = 'read' nó 'skip'\n" #~ " -R, -r, --recursive ar comhbhrí le '--directories=recurse'\n" #~ " --include=PATRÚN déan cuardach i gcomhaid chomhoiriúnacha " #~ "amháin\n" #~ " --exclude=PATRÚN ná déan cuardach i gcomhaid chomhoiriúnacha\n" #~ " --exclude-from=COMHAD ná déan cuardach i gcomhaid atá comhoiriúnach " #~ "le\n" #~ " haon phatrún i gCOMHAD\n" #~ " --exclude-dir=PATRÚN ná déan cuardach i gcomhadlanna " #~ "comhoiriúnacha.\n" #~ " -L, --files-without-match ná taispeáin ach ainmneacha comhaid GAN\n" #~ " teaghrán comhoiriúnach\n" #~ " -l, --files-with-matches ná taispeáin ach ainmneacha comhaid LE\n" #~ " teaghrán comhoiriúnach\n" #~ " -c, --count ná taispeáin ach líon na teaghráin " #~ "chomhoiriúnacha\n" #~ " atá i ngach comhad\n" #~ " -T, --initial-tab Ailínigh na táib (más gá)\n" #~ " -Z, --null priontáil beart '0' i ndiaidh an ainm " #~ "comhaid\n" #~ msgid "unknown directories method" #~ msgstr "modh anaithnid comhadlann" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Tá na roghanna -P agus -z neamh-chomhoiriúnach le chéile" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: rogha neamhcheadaithe -- %c\n" #~ msgid "Copyright (C) 2008 Free Software Foundation, Inc.\n" #~ msgstr "Copyright © 2008 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Is saorbhogearra an ríomhchlár seo; féach ar an mbunchód le haghaidh\n" #~ "coinníollacha cóipeála. Níl baránta ar bith ann; go fiú níl baránta ann\n" #~ "d'INDÃOLTACHT nó FEILIÚNACHT D'FHEIDHM AR LEITH.\n" #~ msgid "out of memory" #~ msgstr "cuimhne ídithe" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Úsáid: %s [ROGHA]... PATRÚN [COMHAD] ...\n" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" ������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/be.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000002637�14670377450�016167� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•���� ������„������ì�������0�����1�����3�����D�����U�����j�����l�����‹�����§�����Ç�����Ù�����ê�������ˆ�������¤�����¦�����Æ��4���æ�������>�����:���\��G���—��@���ß����� ��5���@��(���v�������� �������������������� ������� ������ ��� ��������������'�(standard input)�Memory exhausted�Unknown system error�`�conflicting matchers specified�input is too large to count�invalid context length argument�invalid max count�memory exhausted�unknown binary-files type�unknown devices method�Project-Id-Version: grep 2.5g Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2003-07-22 17:18+0300 Last-Translator: Ales Nyakhaychyk <nab@mail.by> Language-Team: Belarusian <i18n@mova.org> Language: be MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: KBabel 0.9.6 �"�(Ñтандартны ўвод)�ПамÑць вычарпана�ÐевÑÐ´Ð¾Ð¼Ð°Ñ ÑÑ‹ÑÑ‚ÑÐ¼Ð½Ð°Ñ Ð¿Ð°Ð¼Ñ‹Ð»ÐºÐ°�"�заданы ÑупÑÑ€ÑÑ‡Ð»Ñ–Ð²Ñ‹Ñ Ñупадальнікі�увод занадта вÑлікі Ð´Ð»Ñ Ð¿Ð°Ð´Ð»Ñ–ÐºÑƒ�недапушчальны довад даўжыні кантÑкÑту�недапушчальны найбольшы лічыльнік�памÑць вычарпана�невÑдомы від дваічнага файла�невÑдомы мÑтад пралад��������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/es.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000016720�14670377471�016211� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����F������L��a���|���������Ï�����÷���Ñ��¶��É�����€ �����” ��(���° �����Ù �����Û �����ß �����ð ����� �����$ �����@ ��$���X �����} ����� �����ª �����» �����Ä �����ã �����ó ��#��� �����, �����G �����^ �����f ��&���y �����  �����µ �����Ç �� ���Ù �����æ �����û ��;��� ��3���N ��/���‚ ��+���² ��'���Þ ��#��� �����* �����J �����f �����v �����x ��4���• �����Ê ��!���é ��0��� ��-���<�����j��$���†�����«�����Æ�����Þ�����ö����������)�����;�����L�����`��,���{��*���¨�� ���Ó�� ���à�� ���í�����ú����������(�� ���?��z��K��ä���Æ����«��î��³�����¢�����¿��-���Þ����� ������������!���'��'���I�����q�������-���«�����Ù�����ò������������*���;�����f�����z��(���“��)���¼��!���æ������������+���(�����T�����r�����‡�����œ�����­�����Ê��9���à��2�����.���M��*���|��&���§��"���Î�����ñ����������+�����<�����?��B���\��,���Ÿ��<���Ì��1��� ��0���;��*���l��)���—�����Á�����Û�����ù����������4�����L�����g��&���w��)���ž��)���È��5���ò�����(�����8�����H��"���X�����{��#���™�����½�����+������,��� ��� �����������)����������F���B������.����������4���:�������������������������������-�������������������A����������$���5����������0����������������� ������� ���'���!���8���#��� ����������9���/������������������������>�������@���3���D���;��������������E���?���<����������1������C���*�����������%����������6���=�������&���7���������� ���2���"���(���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks �%s home page: <%s> �%s: invalid option -- '%c' �%s: option requires an argument -- '%c' �'�(C)�(standard input)�Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched \{�Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�regular expression too big�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: GNU grep 2.19.12 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2014-07-11 18:53+0200 Last-Translator: Santiago Vila Doncel <sanvila@unex.es> Language-Team: Spanish <es@tp.org.es> Language: es MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8-bit X-Bugs: Report translation errors to the Language-Team address. � Control del contexto: -B, --before-context=NÚM muestra NÚM líneas de contexto anterior -A, --after-context=NÚM muestra NÚM líneas de contexto posterior -C, --context=NÚM muestra NÚM líneas de contexto � Variadas: -s, --no-messages suprime los mensajes de error -v, --invert-match selecciona las líneas que no coinciden -V, --version muestra la versión y finaliza --help muestra este texto de ayuda y finaliza � -I equivalente a --binary-files=without-match -d, --directories=ACCIÓN especifica cómo manejar los directorios ACCIÓN es 'read', 'recurse', o 'skip' -D, --devices=ACCIÓN especifica cómo manejar dispositivos, FIFOs y `sockets', puede ser 'read' o 'skip' -r, --recursive equivalente a --directories=recurse -R, --dereference-recursive similar, pero sigue todos los enlaces simbólicos �Página inicial de %s: <%s> �%s: opción inválida -- '%c' �%s: la opción requiere un argumento -- '%c' �»�(C)�(entrada estándar)�Referencia hacia atrás inválida�Nombre de clase de caracteres inválido�Carácter de unión inválido�Contenido inválido de \{\}�La expresión regular precedente es inválida�Final de rango inválido�Expresión regular inválida�Memoria agotada�No hay ninguna coincidencia�No hay ninguna expresión regular anterior�Empaquetado por %s �Empaquetado por %s (%s) �Final prematuro de la expresión regular�La expresión regular es demasiado grande�Comunicar errores sobre %s a: %s �Éxito�Barra invertida al final�Pruebe '%s --help' para más información. �Error del sistema desconocido�( o \( desemparejado�) o \) desemparejado�\{ desemparejado�Los argumentos válidos son:�Escrito por %s y %s. �Escrito por %s, %s, %s, %s, %s, %s, %s, %s, %s, y otros. �Escrito por %s, %s, %s, %s, %s, %s, %s, %s, y %s. �Escrito por %s, %s, %s, %s, %s, %s, %s, y %s. �Escrito por %s, %s, %s, %s, %s, %s, y %s. �Escrito por %s, %s, %s, %s, %s, y %s. �Escrito por %s, %s, %s, %s, y %s. �Escrito por %s, %s, %s, y %s. �Escrito por %s, %s, y %s. �Escrito por %s. �«�argumento %s ambiguo para %s�la sintaxis de la clase de caracteres es [[:space:]], no [:space:]�se han especificado expresiones conflictivas�se ha excedido el límite de longitud de línea de las PCREs�fallo al asignar memoria para la pila JIT de PCRE�fallo al volver al directorio de trabajo inicial�la entrada es demasiado grande para contar�error interno (no debería ocurrir nunca)�argumento %s inválido %s�clase de caracteres inválida�contenido inválido de \{\}�longitud de contexto inválida�expresión inválida %s�contador máximo inválido�memoria agotada�no se ha especificado ninguna sintaxis�la expresión regular es demasiado grande�la opción -P solamente admite un patrón�no se puede registrar el directorio de trabajo actual�( desemparejado�) desemparejado�[ desemparejado�secuencia de escape \ sin terminar�tipo binary-files desconocido�método de dispositivos desconocido�error de escritura�������������������������������������������������kbuild-3608/src/grep/po/it.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000037164�14670377471�016223� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����g������T��‰���Œ������°��Ï���±��÷��� ��Õ��y ����O ��ü���` ��¶��]��U����¤��j��F�������V�����j��&���‚��#���©�����Í��!���ê����� �����(�����D��,���Y�����†��.���¦��'���Õ��(���ý�����&��%���F�����l�����n�����r��*���ƒ�����®��&���?�����f�����}�����š�����¶��$���Î�����ó�������ª��� �����Ë�����Ü�����å������������<���)��#���f�����Š�����¥�����¼��"���Ð�����ó�����û��&��������5�����J�����\�����n�� �����)���š�����Ä��ù���Ù�����Ó��;���ê��3���&��/���Z��+���Š��'���¶��#���Þ����������"�����>��\���N�����«�����­��4���Ê�����ÿ��!�����0���@��-���q��.���Ÿ�����Î��$���ê����������*�����B�����Z�����z����������Ÿ�����°�� ���Ä�����Ò�����í��,���ü��*���) �� ���T �� ���a �� ���n �����{ ����� �����© �� ���À ��Ô��Ì ��ä���¡"��ù���†#����€$��&��•&����¼'��ý��¾(��›��¼*����X,��K��w.�����Ã/�����Ù/��&���ù/��&��� 0�����G0��&���c0�����Š0�����¦0�����Æ0��+���Û0�� ���1��.���(1��+���W1��,���ƒ1��$���°1��,���Õ1�����2�����2�����2��,���2�����E2��5���Ö2��#��� 3��$���03��"���U3�����x3��*���•3�����À3�����Ú3��Ó���ú3�����Î4�����ß4��'���ö4�����5�����65��Y���S5��(���­5��"���Ö5�����ù5�����6�����-6�����I6�����R6��.���c6�����’6�����°6�����Ì6��(���è6�����7��'���)7�����Q7��M��l7�����º8��7���Ï8��0���9��,���89��(���e9��$���Ž9�� ���³9�����Ô9�����ñ9����� :��_���:�����z:�����|:��D���˜:��'���Ý:��'���;��2���-;��5���`;��I���–;��+���à;��/��� <�����<<�����[<�����{<��1���˜<�����Ê<�����ç<�����=�����=�����/=��"���D=�����g=��%���|=��5���¢=�����Ø=�����é=�����ú=����� >�� ���>�����@>�����`>�����d���;���<���8������� ���4���)������*����������O������D�����������]���C���\���S���%���/��� ���L���2���,�����������_���>���H������U������Z������������������G����������������X����������=��������������`���^���N���J������6���?���M���R�������F���T���$���������������������7�����������������K���0�������P���9���#�����������3���������!���c���.��� ������E���W���e����������:���A���5���(��� ������ �������@�����������Y���"���a���-���f������ ���+������1���Q�������������g���'���V�����������b���I���&�������B�������������������[���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep-3.5.16 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2020-11-14 15:55+0100 Last-Translator: Milo Casagrande <milo@milo.name> Language-Team: Italian <tp@lists.linux.it> Language: it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=2; plural=(n!=1); X-Generator: Poedit 2.4.1 X-Poedit-SourceCharset: UTF-8 � Controllo del contesto: -B, --before-context=NUM Stampa NUM righe di contesto precedente -A, --after-context=NUM Stampa NUM righe di contesto seguente -C, --context=NUM Stampa NUM righe di contesto dell'output � Varie: -s, --no-messages Elimina i messaggi di errore -v, --invert-match Seleziona le righe che non corrispondono -V, --version Stampa la versione ed esce --help Visualizza questo aiuto ed esce � Controllo dell'output: -m, --max-count=NUM Si ferma dopo NUM righe selezionate -b, --byte-offset Stampa l'offset del byte con le righe di output -n, --line-number Stampa il numero della riga con le righe di output --line-buffered Esegue il flush dell'output con ogni riga -H, --with-filename Stampa il nome del file con le righe di output -h, --no-filename Elimina il nome del file dall'output --label=ETICH Usa ETICH come nome del file per lo standard input � --include=GLOB Esamina solo i file corrispondenti a GLOB (modello di file) --exclude=GLOB Salta file corrispondenti a GLOB --exclude-from=FILE Salta i file corrispondenti ai modelli nel FILE --exclude-dir=GLOB Salta le directory corrispondenti a GLOB � -E, --extended-regexp MODELLI sono espressioni regolari estese -F, --fixed-strings MODELLI sono stringhe -G, --basic-regexp MODELLI sono espressioni regolari semplici -P, --perl-regexp MODELLI sono espressioni regolari Perl � -I Equivale a --binary-files=without-match -d, --directories=AZIONE Come gestire le directory: AZIONE è "read", "recurse" o "skip" -D, --devices=AZIONE Come gestire device, FIFO e socket: AZIONE è "read" o "skip" -r, --recursive Equivale a --directories=recurse -R, --dereference-recursive Simile al precedente, ma segue i collegamenti simbolici � -L, --files-without-match Stampa solo i nomi dei FILE senza righe selezionate -l, --files-with-matches Stampa solo i nomi dei FILE con righe selezionate -c, --count Stampa solo il conteggio delle righe selezionate in ogni FILE -T, --initial-tab Allinea le tabulazioni (se necessario) -Z, --null Stampa il byte 0 dopo ogni nome di FILE � -e, --regexp=MODELLI Usa MODELLI per la corrispondenza -f, --file=FILE Ottiene i MODELLI dal FILE -i, --ignore-case Ignora la distinzione maiuscole/minuscole --no-ignore-case Non ignora la distinzione maiuscole/minuscole (predefinito) -w, --word-regexp Corrispondere solo a parole intere -x, --line-regexp Corrispondere solo a righe intere -z, --null-data Una riga di dati termina con il byte 0 invece che newline � -o, --only-matching Mostra solo la parte della riga che corrisponde -q, --quiet, --silent Elimina tutto l'output normale --binary-files=TIPO Suppone che i file binari siano del TIPO "binary", "text" oppure "without-match" -a, --text Equivale a --binary-files=text �Sito web di %s: <%s> �%s: il file binario corrisponde�%s: limite di backtrack PCRE raggiunto�%s: limite di ricorsione PCRE superato�%s: stack JIT PCRE esaurito�%s: il file di input è anche l'output�%s: errore interno PCRE: %d�%s: opzione non valida -- "%c" �%s: memoria esaurita�%s: l'opzione "%s%s" non accetta argomenti �%s: l'opzione "%s%s" è ambigua �%s: l'opzione "%s%s" è ambigua. Possibilità:�%s: l'opzione "%s%s" richiede un argomento �%s: l'opzione richiede un argomento -- "%c" �%s: opzione "%s%s" non riconosciuta �%s: attenzione: ciclo ricorsivo di directory�"�©�(standard input)�-P supporta solamente lingue unibyte e UTF-8�Esempio: %s -i "ciao mondo" menu.h main.c MODELLI può contenere diversi modelli separati da newline. Selezione e interpretazione del modello: �Pagina di aiuto per l'utilizzo di software GNU: <%s> �Riferimento all'indietro non valido�Nome classe del carattere non valido�Carattere di collazione non valido�Contenuto di \{\} non valido�Espressione regolare precedente non valida�Limite massimo non valido�Espressione regolare non valida�Licenza GPLv3+: GNU GPL versione 3 o successiva <%s>. Questo programma è software libero: siete liberi di modificarlo e ridistribuirlo. Non c'è ALCUNA GARANZIA, per quanto consentito dalle vigenti normative. �Memoria esaurita�Nessuna corrispondenza�Nessuna espressione regolare precedente�Pacchetto creato da %s �Pacchetto creato da %s (%s) �Corrispondenze Perl non supportate: questo binario è compilato con --disable-perl-regexp�Fine prematura dell'espressione regolare�Espressione regolare troppo grande�Segnalare i bug di %s a: %s �Segnalare i bug a: %s �Cerca MODELLI in ogni FILE �Successo�Backslash finale�Usare "%s --help" per ulteriori informazioni. �Errore di sistema sconosciuto�( o \( senza corrispondenza�) o \) senza corrispondenza�[, [^, [:, [., o [= senza corrispondenza�\{ senza corrispondenza�Uso: %s [OPZIONE]... MODELLI [FILE]... �Gli argomenti validi sono:�Se FILE è "-", legge lo standard input; se non c'è alcun FILE, legge "." se in modalità ricorsiva, altrimenti "-". Se sono stati specificati meno di due FILE presume -h. Esce con lo stato 0 se è stata selezionata almeno una riga, 1 altrimenti. Se si verifica un errore e l'opzione -q non è stata usata, lo stato di uscita è 2. �Scritto da %s e %s. �Scritto da %s, %s, %s, %s, %s, %s, %s, %s, %s e altri. �Scritto da %s, %s, %s, %s, %s, %s, %s, %s e %s. �Scritto da %s, %s, %s, %s, %s, %s, %s e %s. �Scritto da %s, %s, %s, %s, %s, %s e %s. �Scritto da %s, %s, %s, %s, %s e %s. �Scritto da %s, %s, %s, %s e %s. �Scritto da %s, %s, %s e %s. �Scritto da %s, %s e %s. �Scritto da %s. �Creato da Mike Haertel e altri; consultare <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�"�argomento %s ambiguo per %s�La sintassi per la classe di caratteri è [[:space:]], non [:space:]�specificate corrispondenze in conflitto�limite di lunghezza riga PCRE raggiunto�impossibile allocare memoria per lo stack PCRE JIT�errore nel restituire la directory di lavoro iniziale�impostazione del descrittore file in modalità testo/binario non riuscita�l'input è troppo grande per essere contato�errore interno (non si dovrebbe mai verificare)�argomento %s per %s non valido�Classe del carattere non valido�Contenuto di \{\} non valido�argomento della lunghezza del contesto non valido�corrispondenza %s non valida�numero massimo non valido�memoria esaurita�Nessuna sintassi specificata�errore del programma�Espressione regolare troppo grande�overflow dello stack�l'opzione -P supporta un solo modello�impossibile registrare la directory di lavoro attuale�( non bilanciata�) non bilanciata�[ non bilanciata�Escape \ incompleto�tipo di file binario sconosciuto�metodo per i device sconosciuto�errore di scrittura�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/LINGUAS���������������������������������������������������������������������0000664�0001750�0001750�00000000212�14670377450�016105� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������af be bg ca cs da de el eo es et eu fi fr ga gl he hr hu id it ja ko ky lt nb nl pa pl pt pt_BR ro ru sk sl sr sv th tr uk vi zh_CN zh_TW ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/sr.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000046676�14670377471�016243� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����g������T��‰���Œ������°��Ï���±��÷��� ��Õ��y ����O ��ü���` ��¶��]��U����¤��j��F�������V�����j��&���‚��#���©�����Í��!���ê����� �����(�����D��,���Y�����†��.���¦��'���Õ��(���ý�����&��%���F�����l�����n�����r��*���ƒ�����®��&���?�����f�����}�����š�����¶��$���Î�����ó�������ª��� �����Ë�����Ü�����å������������<���)��#���f�����Š�����¥�����¼��"���Ð�����ó�����û��&��������5�����J�����\�����n�� �����)���š�����Ä��ù���Ù�����Ó��;���ê��3���&��/���Z��+���Š��'���¶��#���Þ����������"�����>��\���N�����«�����­��4���Ê�����ÿ��!�����0���@��-���q��.���Ÿ�����Î��$���ê����������*�����B�����Z�����z����������Ÿ�����°�� ���Ä�����Ò�����í��,���ü��*���) �� ���T �� ���a �� ���n �����{ ����� �����© �� ���À �����Ì ��w��Í"��r��E$��K��¸%��H��)��n��M+��¿��¼,��V��|/��è��Ó1����¼4��)���Ë6��4���õ6��`���*7��N���‹7��7���Ú7��>���8��3���Q8��6���…8��,���¼8��E���é8��0���/9��F���`9��<���§9��A���ä9��;���&:��E���b:�����¨:�����¬:�����¯:��R���Ï:��Ü���";��;���ÿ;��8���;<��5���t<��,���ª<��(���×<��L����=��*���M=��2���x=��D��«=��(���ð>�����?��?���7?�����w?�� ���“?��j���´?��9���@��3���Y@��,���@��)���º@��M���ä@�����2A��+���AA��A���mA��2���¯A��!���âA��!���B��.���&B�����UB��L���nB��)���»B��å��åB�� ���ËD��I���ìD��=���6E��9���tE��5���®E��1���äE��-���F��)���DF��%���nF�����”F��„���­F�����2G��6���6G��X���mG��4���ÆG��R���ûG��`���NH��Z���¯H��z��� I��<���…I��Q���ÂI��<���J��*���QJ��(���|J��E���¥J��$���ëJ��,���K��(���=K��*���fK�����‘K��3���¯K��)���ãK��S��� L��T���aL�����¶L�����ÕL�����ôL��%���M��?���9M��*���yM�����¤M�����d���;���<���8������� ���4���)������*����������O������D�����������]���C���\���S���%���/��� ���L���2���,�����������_���>���H������U������Z������������������G����������������X����������=��������������`���^���N���J������6���?���M���R�������F���T���$���������������������7�����������������K���0�������P���9���#�����������3���������!���c���.��� ������E���W���e����������:���A���5���(��� ������ �������@�����������Y���"���a���-���f������ ���+������1���Q�������������g���'���V�����������b���I���&�������B�������������������[���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep-3.5.16 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2020-11-05 13:11+0200 Last-Translator: МироÑлав Ðиколић <miroslavnikolic@rocketmail.com> Language-Team: Serbian <(nothing)> Language: sr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); X-Bugs: Report translation errors to the Language-Team address. � Контроле контекÑта: -B, --before-context=БРОЈ иÑпиÑује БРОЈ редова водећег контекÑта -A, --after-context=БРОЈ иÑпиÑује БРОЈ редова пратећег контекÑта -C, --context=БРОЈ иÑпиÑује БРОЈ редова излазног контекÑта � Разно: -s, --no-messages иÑкључује поруке о грешкама -v, --invert-match бира не-одговарајуће редове -V, --version иÑпиÑује податке о издању и излази --help приказује ову помоћ и излази � Излазне контроле: -m, --max-count=БРОЈ зауÑтавља након БРОЈРизабраних редова -b, --byte-offset иÑпиÑује померај бајта уз редове излаза -n, --line-number иÑпиÑује број реда уз редове излаза --line-buffered претаче излаз на Ñваком реду -H, --with-filename иÑпиÑује назив датотеке Ñа редовима излаза -h, --no-filename потиÑкује додавање префикÑа називу датотеке на излазу --label=ÐÐТПИС кориÑти ÐÐТПИС као Ð¿Ñ€ÐµÑ„Ð¸ÐºÑ Ð½Ð°Ð·Ð¸Ð²Ð° датотеке Ñтандардног улаза � --include=ОПШТЕ тражи Ñамо датотеке које Ñе поклапају Ñа ОПШТЕ (шаблон датотеке) --exclude=ОПШТЕ преÑкаче датотеке које Ñе поклапају Ñа ОПШТЕ --exclude-from=ДÐТОТЕКРпреÑкаче датотеке које Ñе поклапају Ñа било којим шаблоном из ДÐТОТЕКЕ --exclude-dir=ОПШТЕ преÑкаче директоријуме који Ñе поклапају Ñа ОПШТЕ � -E, --extended-regexp ШÐБЛОÐИ Ñу проширени регуларни изрази -F, --fixed-strings ШÐБЛОÐИ Ñу ниÑк -G, --basic-regexp ШÐБЛОÐИ Ñу оÑновни регуларни изрази -P, --perl-regexp ШÐБЛОÐИ Ñу регуларни изрази Перла � -I иÑто као и „--binary-files=without-match“ -d, --directories=РÐДЊРкако да рукује директоријумима; РÐДЊРможе бити „read“, „recurse“, или „skip“ -D, --devices=РÐДЊРкако да рукује уређајима, ФИФО-има и прикључницама; РÐДЊРможе бити „read“ или „skip“ -r, --recursive иÑто као и „--directories=recurse“ -R, --dereference-recursive Ñлично, али прати Ñве Ñимболичке везе � -L, --files-without-match иÑпиÑује Ñамо називе ДÐТОТЕКРбез изабраних редова -l, --files-with-matches иÑпиÑује Ñамо називе ДÐТОТЕКРÑа изабраним редовима -c, --count иÑпиÑује Ñамо број изабраних редова по ДÐТОТЕЦИ -T, --initial-tab помера табове ред горе (ако је потребно) -Z, --null иÑпиÑује 0-ти бајт након назива ДÐТОТЕКЕ � -e, --regexp=ШÐБЛОÐИ кориÑти ШÐБЛОÐЕ за подударање -f, --file=ДÐТОТЕКРпреузима ШÐБЛОÐЕ из ДÐТОТЕКЕ -i, --ignore-case занемарује разлике величине Ñлова у шаблонима и подацима --no-ignore-case не занемарује разлике величине Ñлова (оÑновно) -w, --word-regexp подудара једино целе речи -x, --line-regexp подудара једино целе редове -z, --null-data ред података Ñе завршава 0-бајтом, не новим редом � -o, --only-matching приказује Ñамо непразне делове редова који одговарају -q, --quiet, --silent потиÑкује Ñве нормалне излазе --binary-files=ВРСТРÑматра да Ñу извршне датотеке ВРСТЕ; ВРСТРможе бити „binary“, „text“, или „without-match“ -a, --text иÑто као и „--binary-files=text“ �%s матична Ñтраница: <%s> �%s: бинарна датотека одговара�%s: прекорачено је ПЦРЕ-ово ограничење тражења уназад�%s: прекорачено је ограничење ПЦРЕ дубачења�%s: потрошени ПЦРЕ ЈИТ Ñпремник�%s: улазна датотека је такође излаз�%s: унутрашња грешка ПЦРЕ-а: %d�%s: неиÑправна опција —— „%c“ �%s: меморија је потрошена�%s: опција „%s%s“ не дозвољава аргумент �%s: опција „%s%s“ је нејаÑна �%s: опција „%s%s“ је нејаÑна; могућноÑти:�%s: опција „%s%s“ захтева аргумент �%s: опција захтева аргумент —— „%c“ �%s: непрепознатљива опција „%s%s“ �%s: дубинÑко вртење кроз директоријуме�“�©�(Ñтандардни улаз)�„-P“ подржава Ñамо једнобајтне и УТФ-8 језике�Пример: %s -i „hello world“ menu.h main.c ШÐБЛОÐИ може да Ñадржи више шаблона раздвојених новим редовима. Одељак шаблона и тумачења: �Општа помоћ за Гнуов Ñофтвер: <%s> �ÐеиÑправна повратна референца�ÐеиÑправан назив клаÑе знака�ÐеиÑправан знак поретка�ÐеиÑправан Ñадржај \{\}�ÐеиÑправан регуларан израз који претходи�ÐеиÑправан крај опÑега�ÐеиÑправан регуларан израз�Лиценца ОЈЛв3+: Гнуова ОЈЛ 3. издање или новије <%s>. Ово је Ñлободан Ñофтвер: Ñлободни Ñте да га мењате и раÑподељујете. Ðе поÑтоји ÐИКÐКВРГÐРÐÐЦИЈÐ, у оквирима дозвољеним законом. �Меморија је потрошена�Ðема подударања�Ðема претходног регуларног израза�Запаковао је %s �Запаковао је %s (%s) �Поклапање за Перл није подржано у „--disable-perl-regexp“ извршној�Прерани крај регуларног израза�Регуларни израз је превелик�Грешке %s пријавите на: %s �Грешке пријавите на: %s �Тражи наведене ШÐБЛОÐЕ у Ñвакој ДÐТОТЕЦИ. �УÑпешно�Водећа контра коÑа црта�Пробајте „%s --help“ за више података. �Ðепозната ÑиÑтемÑка грешка�Ðе одговара ( или \(�Ðе одговара ) или \)�Ðе одговара [, [^, [:, [., или [=�Ðе одговара \{�Употреба: %s [ОПЦИЈÐ]... ШÐБЛОÐИ [ДÐТОТЕКÐ]... �ИÑправни аргументи Ñу:�Када је ДÐТОТЕКР„-“, чита Ñтандардни улаз. Без ДÐТОТЕКЕ, чита . ако је дубинÑки, у Ñупротном „-“. Са мање од две ДÐТОТЕКЕ, подразумева Ñе „-h“. Излазно Ñтање је 0 ако је изабран неки ред, у Ñупротном 1; ако је дошло до неке грешке а „-q“ није дато, онда је излазно Ñтање 2. �ÐапиÑали Ñу %s и %s. �ÐапиÑали Ñу %s, %s, %s, %s, %s, %s, %s, %s, %s, и други. �ÐапиÑали Ñу %s, %s, %s, %s, %s, %s, %s, %s, и %s. �ÐапиÑали Ñу %s, %s, %s, %s, %s, %s, %s, и %s. �ÐапиÑали Ñу %s, %s, %s, %s, %s, %s, и %s. �ÐапиÑали Ñу %s, %s, %s, %s, %s, и %s. �ÐапиÑали Ñу %s, %s, %s, %s, и %s. �ÐапиÑали Ñу %s, %s, %s, и %s. �ÐапиÑали Ñу %s, %s, и %s. �ÐапиÑао је %s. �ÐапиÑали Ñу Мајк Хиртел и други; погледајте <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�„�нејаÑан аргумент „%s“ за „%s“�ÑинтакÑа клаÑе знака је [[:размак:]], а не [:размак:]�наведени Ñу трагачи у Ñукобу�прекорачено је ограничење дужине реда ПЦРЕ-а�ниÑам уÑпео да доделим меморију за ПЦРЕ ÐИТ Ñпремник�не могу да Ñе вратим у почетни радни директоријум�ниÑам уÑпео да подеÑим текÑтуални/бинарни режим опиÑника датотеке�улаз је превелик за пребројавање�унутрашња грешка (не треба никада да Ñе деÑи)�неиÑправан аргумент „%s“ за „%s“�неиÑправна клаÑа знака�неиÑправан Ñадржај \{\}�неиÑправан аргумент дужине контекÑта�неиÑправан трагач %s�неиÑправан највећи број�меморија је потрошена�ÑинтакÑа није наведена�грешка програма�регуларни израз је превелик�прекорачење Ñпремника�опција „-P“ подржава Ñамо ÑамоÑталне шаблоне�не могу да Ñнимим тренутни радни директоријум�неуравнотежена (�неуравнотежена )�неуравнотежена [�недовршена \ излазим�непозната врÑта бинарних датотека�непознат метод уређаја�грешка пиÑања�������������������������������������������������������������������kbuild-3608/src/grep/po/lt.po�����������������������������������������������������������������������0000664�0001750�0001750�00000065003�14670377471�016053� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# translation of grep-2.5.4-pre3 to Lithuanian # Copyright (C) 2008 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # Gintautas Miliauskas <gintas@akl.lt>, 2008. msgid "" msgstr "" "Project-Id-Version: grep-2.5.4-pre3\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2008-07-09 13:28+0300\n" "Last-Translator: Gintautas Miliauskas <gintas@akl.lt>\n" "Language-Team: Lithuanian <komp_lt@konferencijos.lt>\n" "Language: lt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: KBabel 1.11.4\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n" "%100<10 || n%100>=20) ? 1 : 2);\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "" #: lib/dfa.c:896 #, fuzzy msgid "unbalanced [" msgstr "Nesubalansuotas [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" #: lib/dfa.c:1210 #, fuzzy msgid "unfinished \\ escape" msgstr "Nebaigta \\ kaitos seka" #: lib/dfa.c:1371 #, fuzzy msgid "invalid content of \\{\\}" msgstr "netaisyklingas maksimalus skaiÄius" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "" #: lib/dfa.c:1858 #, fuzzy msgid "unbalanced (" msgstr "Nesubalansuotas (" #: lib/dfa.c:1975 #, fuzzy msgid "no syntax specified" msgstr "Nenurodyta sintaksÄ—" #: lib/dfa.c:1986 #, fuzzy msgid "unbalanced )" msgstr "Nesubalansuotas )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Nežinoma sistemos klaida" #: lib/getopt.c:278 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: parametras `%s' dviprasmis\n" #: lib/getopt.c:284 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: parametras `%s' dviprasmis\n" #: lib/getopt.c:319 #, fuzzy, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: neatpažintas argumentas „%c%s“\n" #: lib/getopt.c:345 #, fuzzy, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: argumentas „%c%s“ neleidžia parametro\n" #: lib/getopt.c:360 #, fuzzy, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: parametrui „%s“ reikia argumento\n" #: lib/getopt.c:621 #, fuzzy, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: netaisyklingas argumentas -- %c\n" #: lib/getopt.c:636 lib/getopt.c:682 #, fuzzy, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: parametrui reikia argumento -- %c\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "baigÄ—si atmintis" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "„" #: lib/quotearg.c:356 msgid "'" msgstr "“" #: lib/regcomp.c:135 msgid "Success" msgstr "" #: lib/regcomp.c:138 msgid "No match" msgstr "" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "BaigÄ—si atmintis" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, fuzzy, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licencija GPLv3+: GNU GPL versija 3 arba vÄ—lesnÄ— <http://gnu.org/licenses/" "gpl.html>\n" "Å i programa laisva: galite jÄ… keisti ir platinti.\n" "NÄ—ra JOKIOS GARANTIJOS, kiek leidžia įstatymai.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "Apie klaidas praneÅ¡kite adresu <%s>.\n" #: lib/version-etc.c:251 #, fuzzy, c-format msgid "Report %s bugs to: %s\n" msgstr "" "\n" "Apie klaidas praneÅ¡kite adresu <%s>.\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "" #: src/grep.c:649 msgid "(standard input)" msgstr "(standartinis įvedimas)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "netaisyklingas konteksto ilgio argumentas" #: src/grep.c:894 msgid "input is too large to count" msgstr "įvedimas per didelis skaiÄiavimui" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Dvejetainis failas %s atitinka\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "rekursyvus aplankų ciklas" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Naudojimas: %s [ARGUMENTAS]... Å ABLONAS [FAILAS]...\n" #: src/grep.c:1963 #, fuzzy, c-format msgid "Try '%s --help' for more information.\n" msgstr "Pabandykite „%s --help“, jei norite gauti daugiau informacijos.\n" #: src/grep.c:1969 #, fuzzy, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "IeÅ¡koti Å ABLONO kiekviename faile arba standartiniame įėjime.\n" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Pavyzdys: %s -i 'labas pasauli' menu.h main.c\n" "\n" "Reguliariųjų iÅ¡raiÅ¡kų parinkimas ir interpretacija:\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp Å ABLONAS yra iÅ¡plÄ—stinÄ— reguliarioji iÅ¡r. (ERE)\n" " -F, --fixed-strings Å ABLONAS yra aibÄ— fiksuotų sekų atskirose " "eilutÄ—se\n" " -G, --basic-regexp Å ABLONAS yra įprasta reguliarioji iÅ¡raiÅ¡ka " "(BRE)\n" " -P, --perl-regexp Å ABLONAS yra Perl reguliarioji iÅ¡raiÅ¡ka\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=Å ABLONAS naudoti Å ABLONÄ„ paieÅ¡kai\n" " -f, --file=FAILAS gauti Å ABLONÄ„ iÅ¡ FAILO\n" " -i, --ignore-case ignoruoti raidžių registrÄ…\n" " -w, --word-regexp Å ABLONAS turi atitikti tik pilnus žodžius\n" " -x, --line-regexp Å ABLONAS turi atitikti tik pilnas eilutes\n" " -z, --null-data duomenų eilutÄ— baigiasi 0 baitu, o ne nauja " "eil.\n" #: src/grep.c:1989 #, fuzzy, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Kita:\n" " -s, --no-messages nerodyti klaidų\n" " -v, --invert-match iÅ¡rinkti neatitinkanÄias eilutes\n" " -V, --version spausdinti versijos informacijÄ… ir iÅ¡eiti\n" " --help parodyti Å¡iÄ… informacijÄ… ir iÅ¡eiti\n" " --mmap naudoti mmap įvedimÄ…, jei tai įmanoma\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" "\n" "Konteksto valdymas:\n" " -B, --before-context=NUM spausdinti NUM eiluÄių prieÅ¡ atitikimÄ…\n" " -A, --after-context=NUM spausdinti NUM eiluÄių po atitikimo\n" " -C, --context=NUM spausdinti NUM eiluÄių konteksto\n" " -NUM tas pats, kaip --context=NUM\n" " --color[=KADA],\n" " --colour[=KADA] naudoti markerius atitikimams pažymÄ—ti;\n" " KADA yra „always“, „never“ arba „auto“\n" " -U, --binary neÅ¡alinti CR simbolių eilutÄ—s pabaigoje (MSDOS)\n" " -u, --unix-byte-offsets praneÅ¡ti baitų pozicijas, tarsi nebÅ«tų CRų " "(MSDOS)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Jei FAILAS nenurodytas arba yra -, skaityti standartinį įvedimÄ…. Jei\n" "pateikti mažiau negu du failai, naudoti -h. Grąžinamas klaidos kodas\n" "0, jei rasta bent viena eilutÄ—, 1 kitais atvejais;\n" "jei įvyksta klaida ir nenurodytas -q, klaidos kodas yra 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "nurodyti nesuderinami atitikimo mechanizmai" #: src/grep.c:2101 #, fuzzy msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Parametro -P palaikymas neįkompiliuotas į Å¡iÄ… --disable-perl-regexp programÄ…" #: src/grep.c:2103 #, fuzzy, c-format msgid "invalid matcher %s" msgstr "netaisyklingas maksimalus skaiÄius" #: src/grep.c:2538 msgid "unknown devices method" msgstr "nežinomas įrenginių metodas" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "netaisyklingas maksimalus skaiÄius" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "nežinomas dvejetainių failų tipas" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 #, fuzzy msgid "the -P option only supports a single pattern" msgstr "Parametras -P leidžia tik vienÄ… Å¡ablonÄ…" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "baigÄ—si atmintis" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "" #, fuzzy, c-format #~ msgid "warning: %s: %s" #~ msgstr "įspÄ—jimas: %s: %s\n" #, fuzzy #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: argumentas „--%s“ neleidžia parametro\n" #, fuzzy #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: neatpažintas argumentas „--%s“\n" #, fuzzy #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: parametras „-W %s“ dviprasmis\n" #, fuzzy #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: parametras „-W %s“ nepriima argumento\n" #, fuzzy #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: parametrui „%s“ reikia argumento\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "" #~ "Å ABLONAS numatytuoju atveju yra paprasta reguliarioji iÅ¡raiÅ¡ka (BRE).\n" #, fuzzy #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "„egrep“ reiÅ¡kia „grep -E“. „fgrep“ reiÅ¡kia „grep -F“.\n" #~ "Tiesioginiai kvietimai vardais „egrep“ arba „fgrep“ nebenaudotini.\n" #~ msgid "unfinished repeat count" #~ msgstr "nebaigtas pakartojimų skaiÄius" #~ msgid "malformed repeat count" #~ msgstr "netaisyklingas pakartojimų skaiÄius" #~ msgid "writing output" #~ msgstr "raÅ¡omas iÅ¡vedimas" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "Å ABLONAS yra iÅ¡plÄ—stinÄ— reguliarioji iÅ¡raiÅ¡ka (ERE).\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "Å ABLONAS yra aibÄ— simbolių sekų atskirose eilutÄ—se.\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE;\n" #~ " TYPE is `binary', `text', or `without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories;\n" #~ " ACTION is `read', `recurse', or `skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" #~ " ACTION is `read' or `skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=FILE_PATTERN search only files that match FILE_PATTERN\n" #~ " --exclude=FILE_PATTERN skip files and directories matching " #~ "FILE_PATTERN\n" #~ " --exclude-from=FILE skip files matching any file pattern from " #~ "FILE\n" #~ " --exclude-dir=PATTERN directories that match PATTERN will be " #~ "skipped.\n" #~ " -L, --files-without-match print only names of FILEs containing no " #~ "match\n" #~ " -l, --files-with-matches print only names of FILEs containing matches\n" #~ " -c, --count print only a count of matching lines per " #~ "FILE\n" #~ " -T, --initial-tab make tabs line up (if needed)\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "IÅ¡vedimo valdymas:\n" #~ " -m, --max-count=NUM sustoti po NUM atitikimų\n" #~ " -b, --byte-offset iÅ¡vesti baito numerį iÅ¡vedant eilutes\n" #~ " -n, --line-number iÅ¡vesti eilutÄ—s numerį iÅ¡vedant eilutes\n" #~ " --line-buffered iÅ¡leisti (flush) iÅ¡vedimÄ… po kiekvienos " #~ "eilutÄ—s\n" #~ " -H, --with-filename iÅ¡spausdinti failo vardÄ… kiekvienam " #~ "atitikimui\n" #~ " -h, --no-filename nespausdinti failo vardo\n" #~ " --label=ŽYMÄ– spausdinti ŽYMĘ kaip failo vardÄ… stand. " #~ "įvedimui\n" #~ " -o, --only-matching rodyti tik tÄ… eilutÄ—s dalį, kuri atitinka " #~ "Å ABLONÄ„\n" #~ " -q, --quiet, --silent iÅ¡junti normalų iÅ¡vedimÄ…\n" #~ " --binary-files=TIPAS tarti, kad dvejetainiai failai yra Å¡io " #~ "TIPO;\n" #~ " TIPAS yra „binary“, „text“ arba „without-" #~ "match“\n" #~ " -a, --text tapatu --binary-files=text\n" #~ " -I tapatu --binary-files=without-match\n" #~ " -d, --directories=VEIKSMAS kaip ieÅ¡koti aplankuose;\n" #~ " VEIKSMAS yra „read“, „recurse“ arba „skip“\n" #~ " -D, --devices=VEIKSMAS kaip ieÅ¡koti įrenginiuose, FIFO ir lizduose;\n" #~ " VEIKSMAS yra „read“ arba „skip“\n" #~ " -R, -r, --recursive tapatu --directories=recurse\n" #~ " --include=FAILŲ_Å ABLONAS ieÅ¡koti failuose, kurių vardai atitinka " #~ "Å¡abl.\n" #~ " --exclude=FAILŲ_Å ABLONAS praleisti failus, kurių vardai atitinka " #~ "Å¡abl.\n" #~ " --exclude-from=FAILAS praleisti failus, kurių v. atitinka Å¡abl. iÅ¡ " #~ "FAILO\n" #~ " --exclude-dir=Å ABLONAS aplankai, atitinkantys Å ABLONÄ„, bus " #~ "praleisti.\n" #~ " -L, --files-without-match spausdinti tik neatitinkanÄių failų vardus\n" #~ " -l, --files-with-matches spausdinti tik atitinkanÄių Å¡ablonÄ… failų " #~ "vardus\n" #~ " -c, --count spausdinti tik atitinkanÄių eiluÄių faile " #~ "skaiÄių\n" #~ " -T, --initial-tab lygiuoti tabuliatorius (jei reikia)\n" #~ " -Z, --null spausdinti 0 baitÄ… po FAILO vardo\n" #~ msgid "Invocation as `egrep' is deprecated; use `grep -E' instead.\n" #~ msgstr "Kvietimas pavadinimu „egrep“ nebenaudotinas, naudokite „grep -E“.\n" #~ msgid "Invocation as `fgrep' is deprecated; use `grep -F' instead.\n" #~ msgstr "Kvietimas pavadinimu „fgrep“ nebenaudotinas, naudokite „grep -F“.\n" #~ msgid "" #~ "In GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped." #~ msgstr "" #~ "Kintamajame GREP_COLORS=„%s“, „%s“ reikia reikÅ¡mÄ—s („=...“); praleista." #~ msgid "" #~ "In GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped." #~ msgstr "" #~ "Kintamajame GREP_COLORS=„%s“, „%s“ dvejetainis, todÄ—l reikÅ¡mÄ— („=%s“) " #~ "netinkama; praleista." #~ msgid "In GREP_COLORS=\"%s\", the \"%s\" capacity %s." #~ msgstr "Kintamajame GREP_COLORS=„%s“, „%s“ talpumas %s." #~ msgid "" #~ "Stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"." #~ msgstr "" #~ "Sustabdytas netaisyklingo GREP_COLORS=„%s“ apdorojimas ties likusiu " #~ "posekiu „%s“." #~ msgid "unknown directories method" #~ msgstr "nežinomas aplankų metodas" #~ msgid "Copyright (C) 2008 Free Software Foundation, Inc.\n" #~ msgstr "AutorinÄ—s teisÄ—s (C) 2008 Free Software Foundation, Inc.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Parametrai -P ir -z negali bÅ«ti sujungti" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: neleistinas argumentas -- %c\n" �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/ru.po�����������������������������������������������������������������������0000664�0001750�0001750�00000103402�14670377450�016053� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# translation of grep-2.6.ru.po to Russian # Ð›Ð¾ÐºÐ°Ð»Ð¸Ð·Ð°Ñ†Ð¸Ñ Ð´Ð»Ñ grep. # Copyright (C) 1997, 1998, 1999, 2000, 2009, 2010 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # Denis Perchine <dyp@perchine.com>, 1998-2000. # Yuri Kozlov <yuray@komyakino.ru>, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021. msgid "" msgstr "" "Project-Id-Version: grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-10 06:59+0300\n" "Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n" "Language-Team: Russian <gnu@d07.ru>\n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Lokalize 20.12.0\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "неверный аргумент %s Ð´Ð»Ñ %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "двуÑмыÑленный аргумент %s Ð´Ð»Ñ %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "ДопуÑтимые аргументы:" #: lib/c-stack.c:187 msgid "program error" msgstr "ошибка программы" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "переполнение Ñтека" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "ошибка запиÑи" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "неÑбаланÑÐ¸Ñ€Ð¾Ð²Ð°Ð½Ð½Ð°Ñ [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "неправильный клаÑÑ Ñимволов" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "ÑинтакÑÐ¸Ñ ÐºÐ»Ð°ÑÑа Ñимволов: [[:space:]], а не [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "Ð½ÐµÐ·Ð°Ð²ÐµÑ€ÑˆÑ‘Ð½Ð½Ð°Ñ \\ ÑÐºÑ€Ð°Ð½Ð¸Ñ€ÑƒÑŽÑ‰Ð°Ñ Ð¿Ð¾ÑледовательноÑть" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "неправильное Ñодержимое в \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "регулÑрное выражение Ñлишком большое" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "неÑбаланÑÐ¸Ñ€Ð¾Ð²Ð°Ð½Ð½Ð°Ñ (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "не указан ÑинтакÑиÑ" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "неÑбаланÑÐ¸Ñ€Ð¾Ð²Ð°Ð½Ð½Ð°Ñ )" #: lib/error.c:195 msgid "Unknown system error" msgstr "ÐеизвеÑÑ‚Ð½Ð°Ñ ÑиÑÑ‚ÐµÐ¼Ð½Ð°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: двуÑмыÑленный параметр «%s%s»\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: двуÑмыÑленный параметр «%s%s»; возможные варианты:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: нераÑпознанный параметр «%s%s»\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: Ð´Ð»Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ð° «%s%s» Ð½ÐµÐ»ÑŒÐ·Ñ Ð¸Ñпользовать аргумент\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: Ð´Ð»Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ð° «%s%s» требуетÑÑ Ð°Ñ€Ð³ÑƒÐ¼ÐµÐ½Ñ‚\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: неверный параметр «%c»\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: параметру требуетÑÑ Ð°Ñ€Ð³ÑƒÐ¼ÐµÐ½Ñ‚ «%c»\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "памÑть иÑчерпана" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "не удалоÑÑŒ запомнить текущий рабочий каталог" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "не удалоÑÑŒ вернутьÑÑ Ð² начальный рабочий каталог" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "не удалоÑÑŒ изменить текÑтовый/двоичный режим у файлового деÑкриптора" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "«" #: lib/quotearg.c:356 msgid "'" msgstr "»" #: lib/regcomp.c:135 msgid "Success" msgstr "Выполнено уÑпешно" #: lib/regcomp.c:138 msgid "No match" msgstr "Ðет Ñовпадений" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Ðеправильное регулÑрное выражение" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Ðеправильный Ñимвол ÑравнениÑ" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Ðеправильное Ð¸Ð¼Ñ ÐºÐ»Ð°ÑÑа Ñимволов" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Завершающий Ñимвол обратной коÑой черты" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "ÐÐµÐ¿Ñ€Ð°Ð²Ð¸Ð»ÑŒÐ½Ð°Ñ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð°Ñ ÑÑылка" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "ÐÐµÐ¿Ð°Ñ€Ð½Ð°Ñ [, [^, [:, [. или [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "ÐÐµÐ¿Ð°Ñ€Ð½Ð°Ñ ( или \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "ÐÐµÐ¿Ð°Ñ€Ð½Ð°Ñ \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Ðеправильное Ñодержимое в \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Ðеправильный конец диапазона" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "ПамÑть иÑчерпана" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Ðеправильное предшеÑтвующее регулÑрное выражение" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Преждевременное завершение регулÑрного выражениÑ" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "РегулÑрное выражение Ñлишком большое" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "ÐÐµÐ¿Ð°Ñ€Ð½Ð°Ñ ) или \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Ðет предыдущего регулÑрного выражениÑ" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Упакован %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Упакован %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Ð›Ð¸Ñ†ÐµÐ½Ð·Ð¸Ñ GPLv3+: GNU GPL верÑии 3 или новее <%s>.\n" "Это Ñвободное ПО: вы можете изменÑть и раÑпроÑтранÑть его.\n" "Ðет ÐИКÐКИХ ГÐРÐÐТИЙ в пределах дейÑтвующего законодательÑтва.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Ðвтор программы — %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Ðвторы программы — %s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Ðвторы программы — %s, %s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Ðвторы программы — %s, %s, %s\n" "и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Ðвторы программы — %s, %s, %s,\n" "%s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Ðвторы программы — %s, %s, %s,\n" "%s, %s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Ðвторы программы — %s, %s, %s,\n" "%s, %s, %s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Ðвторы программы — %s, %s, %s,\n" "%s, %s, %s, %s\n" "и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Ðвторы программы — %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s и %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Ðвторы программы — %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s и другие.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Об ошибках Ñообщайте по адреÑу: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Об ошибках в %s Ñообщайте по адреÑу %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "ДомашнÑÑ Ñтраница %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Справка по работе Ñ Ð¿Ñ€Ð¾Ð³Ñ€Ð°Ð¼Ð¼Ð°Ð¼Ð¸ GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(Ñтандартный ввод)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "неверный аргумент длины контекÑта" #: src/grep.c:894 msgid "input is too large to count" msgstr "входные данные Ñлишком велики, чтобы ÑоÑчитать" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: двоичный файл Ñовпадает" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: предупреждение: каталоги зациклены" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: файл ввода также иÑпользуетÑÑ Ð¸ Ð´Ð»Ñ Ð²Ñ‹Ð²Ð¾Ð´Ð°" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "ИÑпользование: %s [ПÐРÐМЕТР]… ШÐБЛОÐЫ [ФÐЙЛ]…\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "ЗапуÑтите «%s --help» Ð´Ð»Ñ Ð¿Ð¾Ð»ÑƒÑ‡ÐµÐ½Ð¸Ñ Ð±Ð¾Ð»ÐµÐµ подробного опиÑаниÑ.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "ПоиÑк ШÐБЛОÐОВ в каждом ФÐЙЛЕ.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Пример: %s -i 'hello world' menu.h main.c\n" "ШÐБЛОÐОВ можно указать неÑколько, разделÑÑ Ð¸Ñ… Ñимволом новой Ñтроки.\n" "\n" "Шаблон выбора и его интерпретациÑ:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp ШÐБЛОÐЫ — раÑширенные регулÑрные выражениÑ\n" " -F, --fixed-regexp ШÐБЛОÐЫ — Ñтроки\n" " -G, --basic-regexp ШÐБЛОÐЫ — проÑтые регулÑрные выражениÑ\n" " -P, --perl-regexp ШÐБЛОÐЫ — регулÑрные Ð²Ñ‹Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñзыка Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=ШÐБЛОÐЫ иÑпользовать ШÐБЛОÐЫ Ð´Ð»Ñ Ð¿Ð¾Ð¸Ñка\n" " -f, --file=ФÐЙЛ брать ШÐБЛОÐЫ из ФÐЙЛа\n" " -i, --ignore-case игнорировать различие региÑтра\n" " --no-ignore-case учитывать региÑтр (по умолчанию)\n" " -w, --word-regexp Ñовпадение обÑзательно Ñ Ñ†ÐµÐ»Ñ‹Ð¼ Ñловом\n" " -x, --line-regexp Ñовпадение обÑзательно Ñ Ñ†ÐµÐ»Ð¾Ð¹ Ñтрокой\n" " -z, --null-data Ñтроки разделÑÑŽÑ‚ÑÑ Ð±Ð°Ð¹Ñ‚Ð¾Ð¼ Ñ Ð½ÑƒÐ»ÐµÐ²Ñ‹Ð¼ значением, а " "не\n" " Ñимволом конца Ñтроки\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Разное:\n" " -s, --no-messages не показывать ÑÐ¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ñ Ð¾Ð± ошибках\n" " -v, --invert-match выбирать не подходÑщие Ñтроки\n" " -V, --version показать информацию о верÑии и закончить работу\n" " --help показать Ñту Ñправку и закончить работу\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Управление выводом:\n" " -m, --max-count=ЧИСЛО оÑтановитьÑÑ Ð¿Ð¾Ñле указанного\n" " ЧИСЛРÑовпавших Ñтрок\n" " -b, --byte-offset печатать вмеÑте Ñ Ð²Ñ‹Ñ…Ð¾Ð´Ð½Ñ‹Ð¼Ð¸ Ñтроками Ñмещение в\n" " байтах\n" " -n, --line-number печатать номер Ñтроки вмеÑте Ñ Ð²Ñ‹Ñ…Ð¾Ð´Ð½Ñ‹Ð¼Ð¸ " "Ñтроками\n" " --line-buffered ÑбраÑывать буфер поÑле каждой Ñтроки\n" " -H, --with-filename печатать Ð¸Ð¼Ñ Ñ„Ð°Ð¹Ð»Ð° Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð¹ выводимой Ñтроки\n" " -h, --no-filename не начинать вывод Ñ Ð¸Ð¼ÐµÐ½Ð¸ файла\n" " --label=МЕТКРиÑпользовать МЕТКУ в качеÑтве имени файла длÑ\n" " Ñтандартного ввода\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching показывать только Ñовпавшие непуÑтые чаÑти " "Ñтрок\n" " -q, --quiet, --silent подавлÑть веÑÑŒ обычный вывод\n" " --binary-files=ТИП Ñчитать, что двоичный файл имеет ТИП:\n" " «binary», «text» или «without-match».\n" " -a, --text тоже, что и --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I то же, что и --binary-files=without-match\n" " -d, --directories=ДЕЙСТВ как обрабатывать каталоги\n" " ДЕЙСТВИЕ может быть «read» (читать),\n" " «recurse» (рекурÑивно) или «skip» (пропуÑкать).\n" " -D, --devices=ДЕЙСТВ как обрабатывать уÑтройÑтва, FIFO и Ñокеты\n" " ДЕЙСТВИЕ может быть «read» или «skip»\n" " -r, --recursive то же, что и --directories=recurse\n" " -R, --dereference-recursive тоже, но Ñ " "переходом\n" " по вÑем Ñимвольным ÑÑылкам\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=МÐСКРобработать только файлы, подпадающие под\n" " МÐСКУ (файловый шаблон)\n" " --exclude=МÐСКРпропуÑтить файлы, подпадающие под МÐСКУ\n" " --exclude-from=ФÐЙЛ пропуÑтить файлы, подпадающие под маÑку\n" " файлов из ФÐЙЛÐ\n" " --exclude-dir=МÐСКРпропуÑтить каталоги, подпадающие под МÐСКУ\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match печатать только имена ФÐЙЛОВ без выбранных " "Ñтрок\n" " -l, --files-with-matches печатать только имена ФÐЙЛОВ Ñ Ð²Ñ‹Ð±Ñ€Ð°Ð½Ð½Ñ‹Ð¼Ð¸ " "Ñтроками\n" " -c, --count печатать только количеÑтво выбранных\n" " Ñтрок на ФÐЙЛ\n" " -T, --initial-tab выравнивать табулÑцией (еÑли нужно)\n" " -Z, --null печатать байт 0 поÑле имени ФÐЙЛÐ\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Управление контекÑтом:\n" " -B, --before-context=ЧИС печатать ЧИСЛО Ñтрок предшеÑтвующего контекÑта\n" " -A, --after-context=ЧИС печатать ЧИСЛО Ñтрок поÑледующего контекÑта\n" " -C, --context[=ЧИС] печатать ЧИСЛО Ñтрок контекÑта\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -ЧИСЛО то же, что и --context=ЧИСЛО\n" " --group-separator=SEP печатать SEP в Ñтроке между ÑовпадениÑми\n" " Ñ ÐºÐ¾Ð½Ñ‚ÐµÐºÑтом\n" " --no-group-separator не печатать разделитель между ÑовпадениÑми\n" " Ñ ÐºÐ¾Ð½Ñ‚ÐµÐºÑтом\n" " --color[=КОГДÐ],\n" " --colour[=КОГДÐ] иÑпользовать маркеры Ð´Ð»Ñ Ñ€Ð°Ð·Ð»Ð¸Ñ‡Ð¸Ñ Ñовпадающих\n" " Ñтрок; КОГДРможет быть «always» (вÑегда),\n" " «never» (никогда) или «auto» (автоматичеÑки)\n" " -U, --binary не удалÑть Ñимволы CR в конце Ñтроки\n" " (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "ЕÑли в качеÑтве ФÐЙЛРуказан Ñимвол «-», то читаетÑÑ Ñтандартный ввод.\n" "ЕÑли ФÐЙЛ не указан, то читаетÑÑ Ñ‚ÐµÐºÑƒÑ‰Ð¸Ð¹ каталог «.» и «-» в противном\n" "Ñлучае. ЕÑли указано менее двух ФÐЙЛОВ, то предполагаетÑÑ -h.\n" "При нахождении Ñовпадений любой Ñтроки кодом Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð¸Ñ Ð±ÑƒÐ´ÐµÑ‚ 0\n" "и 1, еÑли ничего не Ñовпало. При возникновении ошибок и еÑли не указан\n" "параметр -q, кодом Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð¸Ñ Ð±ÑƒÐ´ÐµÑ‚ 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "заданы конфликтующие образцы" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "Шаблоны Perl не поддерживаютÑÑ Ð¿Ñ€Ð¸ Ñборке Ñ --disable-perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "неверный образец %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "неизвеÑтный метод Ð´Ð»Ñ ÑƒÑтройÑтв" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "предупреждение: параметр --unix-byte-offsets (-u) уÑтарел" #: src/grep.c:2686 msgid "invalid max count" msgstr "неверно задано чиÑло макÑимального количеÑтва Ñовпадений" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "неизвеÑтный тип двоичных файлов" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Ðвторы программы: Mike Haertel и другие; Ñмотрите\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "ошибка Ð²Ñ‹Ð´ÐµÐ»ÐµÐ½Ð¸Ñ Ð¿Ð°Ð¼Ñти Ð´Ð»Ñ Ñтека PCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "параметр -P поддерживает только однобайтовые локали и UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "параметр -P поддерживает только одиночный шаблон" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "внутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° (не должна возникать)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "превышено ограничение длины Ñтроки PCRE" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: памÑть иÑчерпана" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: иÑчерпан Ñтек PCRE JIT" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: иÑчерпан лимит возвратов в PCRE" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: иÑчерпан лимит рекурÑии в PCRE" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: внутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° PCRE: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "предупреждение: GREP_OPTIONS уÑтарел; иÑпользуйте пÑевдоним или Ñценарий" #~ msgid "warning: %s: %s" #~ msgstr "предупреждение: %s: %s" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "ДомашнÑÑ Ñтраница %s: <https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "неверный аргумент %s%s в «%s»" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "недопуÑтимый ÑÑƒÑ„Ñ„Ð¸ÐºÑ Ð² аргументе %s%s Ð´Ð»Ñ Â«%s»" #~ msgid "%s%s argument '%s' too large" #~ msgstr "аргумент %s%s Ñлишком велик Ð´Ð»Ñ Â«%s»" #~ msgid "Mike Haertel" #~ msgstr "Майк Гертель (Mike Haertel)" #~ msgid "internal error" #~ msgstr "внутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ°" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: у параметра «--%s» не может быть аргумента\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: неизвеÑтный параметр «--%s»\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: двуÑмыÑленный параметр «-W %s»\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: у параметра «-W %s» не может быть аргумента\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: Ð´Ð»Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ð° «-W %s» требуетÑÑ Ð°Ñ€Ð³ÑƒÐ¼ÐµÐ½Ñ‚\n" #~ msgid "lseek failed" #~ msgstr "Вызов lseek завершилÑÑ Ð½ÐµÑƒÐ´Ð°Ñ‡Ð½Ð¾" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "" #~ "По умолчанию, ШÐБЛОРпредÑтавлÑет Ñобой проÑтое регулÑрное выражение " #~ "(BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "ВмеÑто «egrep» предполагаетÑÑ Ð·Ð°Ð¿ÑƒÑк «grep -E». ВмеÑто «fgrep» " #~ "предполагаетÑÑ\n" #~ "«grep -F». ЗапуÑк под именами «egrep» или «fgrep» лучше не выполнÑть.\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "неÑкранированный Ñимвол ^ или $ не поддерживаетÑÑ Ð¿Ñ€Ð¸ указании -Pz" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "ДомашнÑÑ Ñтраница GNU Grep: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "недопуÑÑ‚Ð¸Ð¼Ð°Ñ Ð¿Ð¾ÑледовательноÑть байтов UTF-8 во входных данных" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "ШÐБЛОРпредÑтавлÑет Ñобой раÑширенное регулÑрное выражение (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "" #~ "ЗапуÑк под именем «egrep» уÑтарел; вмеÑто Ñтого иÑпользуйте «grep -E».\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "" #~ "ШÐБЛОРпредÑтавлÑет Ñтроки фикÑированной длины, разделённые Ñимволом " #~ "новой Ñтроки.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "" #~ "ЗапуÑк под именем «fgrep» уÑтарел; вмеÑто Ñтого иÑпользуйте «grep -F».\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "Ð’ %s можно иÑпользовать только шаблонный ÑинтакÑÐ¸Ñ %s" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "" #~ "Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ 2010 года при указании параметра --mmap ничего не выполнÑетÑÑ" #~ msgid "unfinished repeat count" #~ msgstr "незавершённое количеÑтво повторений" #~ msgid "malformed repeat count" #~ msgstr "некорректно указано количеÑтво повторений" #~ msgid "writing output" #~ msgstr "запиÑÑŒ выходных данных" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "в GREP_COLORS=\"%s\" Ð´Ð»Ñ ÑвойÑтва «%s» требуетÑÑ ÑƒÐºÐ°Ð·Ð°Ñ‚ÑŒ значение («=…»); " #~ "пропуÑкаетÑÑ" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "в GREP_COLORS=\"%s\" ÑвойÑтво «%s» ÑвлÑетÑÑ Ð»Ð¾Ð³Ð¸Ñ‡ÐµÑким и не требует " #~ "Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ («=%s»); пропуÑкаетÑÑ" #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "в GREP_COLORS=\"%s\" значение «%s» приÑвоено ÑвойÑтву %s" #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "прекращение обработки неправильной GREP_COLORS=\"%s\", Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ " #~ "оÑтавшейÑÑ Ð¿Ð¾Ð´Ñтроки «%s»" #~ msgid "unknown directories method" #~ msgstr "неизвеÑтный метод Ð´Ð»Ñ ÐºÐ°Ñ‚Ð°Ð»Ð¾Ð³Ð¾Ð²" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/da.po�����������������������������������������������������������������������0000664�0001750�0001750�00000062757�14670377450�016032� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Danish messages for GNU Grep # Copyright (C) 1996, 1997, 1998, 2009, 2012, 2015, 2017, 2019 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # Kenneth Christiansen <kenneth@gnome.org>, 1999. # Keld Simonsen <keld@dkuug.dk>, 2000 # Ask Hjorth Larsen <asklarsen@gmail.com>, 2009, 2010, 2012, 2015, 2017, 2019. # # Konventioner # ------------ # # escape -> undvigesekvens # standard input -> standard-inddata (etc.) # (basic/extended) regular expression -> (elementært/udvidet) regulært udtryk # match (n) -> træffer # match (v) -> matche (findes i RO) # # Specielt # -------- # # NUM -> ANTAL # # Strenge i retning af "%s%s argument `%s'" er i stil # med "--file argument `hello.txt'" eller "-f argument `hello.txt'". # msgid "" msgstr "" "Project-Id-Version: grep-3.3.42\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2019-12-27 00:28+0100\n" "Last-Translator: Ask Hjorth Larsen <asklarsen@gmail.com>\n" "Language-Team: Danish <dansk@dansk-gruppen.dk>\n" "Language: da\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8-bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "ugyldigt argument %s til %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "flertydigt argument %s til %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Gyldige argumenter er:" #: lib/c-stack.c:187 msgid "program error" msgstr "programfejl" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "stakoverløb" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "skrivefejl" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "ubalanceret [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "ugyldig tegnklasse" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "syntaksen for tegnklasser er [[:space:]], ikke [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "ufærdig \\-undvigesekvens" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "ugyldigt indhold af \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "regulært udtryk er for stort" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "ubalanceret (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "ingen syntaks angivet" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "ubalanceret )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Ukendt systemfejl" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: flaget \"%s%s\" er flertydigt\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: flaget \"%s%s\" er flertydigt; muligheder:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: ukendt flag \"%s%s\"\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: flaget \"%s%s\" tillader ikke et argument\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: flaget \"%s%s\" kræver et argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: ugyldigt flag -- \"%c\"\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: flaget kræver et argument -- \"%c\"\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "hukommelse opbrugt" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "kan ikke gemme nuværende arbejdskatalog" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "kunne ikke vende tilbage til det oprindelige arbejdskatalog" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "kunne ikke angive tekst-/binærtilstand for fildeskriptor" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "\"" #: lib/quotearg.c:356 msgid "'" msgstr "\"" #: lib/regcomp.c:135 msgid "Success" msgstr "Succes" #: lib/regcomp.c:138 msgid "No match" msgstr "Ingen træffere" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Ugyldigt regulært udtryk" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Ugyldigt samletegn (collation character)" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Ugyldigt tegnklassenavn" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Afsluttende omvendt skrÃ¥streg" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Ugyldig bagudreference" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Uparret [, [^, [:, [. eller [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Uparret ( eller \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Uparret \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Ugyldigt indhold af \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Ugyldig intervalafslutning" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Hukommelse opbrugt" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Ugyldigt foranstillet regulært udtryk" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Utidig afslutning af regulært udtryk" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Regulært udtryk er for stort" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Uparret ) eller \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Intet foregÃ¥ende regulært udtryk" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Pakket af %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Pakket af %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "GPLv3+-licens: GNU GPL version 3 eller senere <%s>.\n" "Dette er fri software: du kan frit ændre og videredistribuere det.\n" "Der gives INGEN GARANTI, i den grad som loven tillader det.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Skrevet af %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Skrevet af %s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Skrevet af %s, %s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Skrevet af %s, %s, %s\n" "og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Skrevet af %s, %s, %s,\n" "%s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Skrevet af %s, %s, %s,\n" "%s, %s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Skrevet af %s, %s, %s,\n" "%s, %s, %s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Skrevet af %s, %s, %s,\n" "%s, %s, %s, %s\n" "og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Skrevet af %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s og %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Skrevet af %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s og andre.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Rapportér fejl til: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Rapportér fejl i %s til: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Hjemmeside for %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Generel hjælp til brug af GNU-software: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(standard-inddata)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "ugyldigt kontekstlængdeargument" #: src/grep.c:894 msgid "input is too large to count" msgstr "inddata er for omfattende at optælle" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Binær fil %s stemmer\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "rekursiv katalogsløjfe" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "indfilen %s er ogsÃ¥ udfilen" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Brug: %s [FLAG]... MØNSTRE [FIL]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Prøv \"%s --help\" for mere information.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Søg efter MØNSTRE i hver FIL.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Eksempel: %s -i 'hej verden' menu.h main.c\n" "MØNSTRE kan indeholde flere mønstre adskilt af linjeskift.\n" "\n" "Valg af mønster og fortolkning:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp MØNSTRE er udvidede regulære udtryk\n" " -F, --fixed-strings MØNSTRE er strenge\n" " -G, --basic-regexp MØNSTRE er elementære regulære udtryk\n" " -P, --perl-regexp MØNSTRE er regulære udtryk til Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=MØNSTRE brug MØNSTRE i søgning\n" " -f, --file=FIL tag MØNSTRE fra FIL\n" " -i, --ignore-case skeln ikke mellem store og smÃ¥ bogstaver\n" " i mønstre og data\n" " --no-ignore-case skeln mellem store/smÃ¥ bogstaver (standard)\n" " -w, --word-regexp match kun hele ord\n" " -x, --line-regexp match kun hele linjer\n" " -z, --null-data en datalinje slutter med en 0-byte, ikke " "linjeskift\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Diverse:\n" " -s, --no-messages undertryk fejlmeddelser\n" " -v, --invert-match vælg linjer der ikke passer\n" " -V, --version vis versionsinformation og afslut\n" " --help vis denne hjælpetekst og afslut\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Styring af udskrift:\n" " -m, --max-count=ANTAL stands efter ANTAL fundne linjer\n" " -b, --byte-offset udskriv startpunkt i byte sammen med fundne " "linjer\n" " -n, --line-number udskriv linjenummer sammen med linjerne\n" " --line-buffered tøm uddatabuffer for hver linje\n" " -H, --with-filename udskriv filnavn sammen med udlinjer\n" " -h, --no-filename undertryk indledende filnavn i udskrift\n" " --label=NAVN udskriv NAVN som filnavn for standard-inddata\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching vis kun ikketomme dele af matchende linjer\n" " -q, --quiet, --silent undertryk al normal udskrift\n" " --binary-files=TYPE antag at binære filer er TYPE;\n" " TYPE er \"binary\", \"text\" eller \"without-" "match\"\n" " -a, --text svarer til --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I svarer til --binary-files=without-match\n" " -d, --directories=HANDLING hvordan kataloger skal hÃ¥ndteres;\n" " HANDLING er \"read\", \"recurse\", eller \"skip" "\"\n" " -D, --devices=HANDLING hvordan enheder, FIFO'er og sokler skal " "hÃ¥ndteres;\n" " HANDLING er \"read\" eller \"skip\"\n" " -r, --recursive svarer til --directories=recurse\n" " -R, --dereference-recursive tilsvarende, men følg alle symlænker\n" # 'spring over' er mÃ¥ske pænere end 'ignorér', men fylder mere, og det er rart at være pÃ¥ <80 kolonner #: src/grep.c:2023 #, fuzzy, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB søg kun i filer, der matcher GLOB (et " "filmønster)\n" " --exclude=GLOB ignorér filer og kataloger, der matcher GLOB\n" " --exclude-from=FIL ignorér filer, der matcher ethvert mønster fra " "FIL\n" " --exclude-dir=glob ignorér kataloger, der matcher GLOB\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match udskriv kun navne pÃ¥ FILer uden fundne linjer\n" " -l, --files-with-matches udskriv kun navne pÃ¥ FILer med fundne linjer\n" " -c, --count udskriv kun antallet af fundne linjer for hver " "FIL\n" " -T, --initial-tab arrangér tabulatortegn (om nødvendigt)\n" " -Z, --null udskriv 0-byte efter FILnavn\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Styring af kontekst:\n" " -B, --before-context=ANTAL udskriv ANTAL linjer af foregÃ¥ende tekst\n" " -A, --after-context=ANTAL udskriv ANTAL linjer af efterfølgende tekst\n" " -C, --context=ANTAL udskriv ANTAL linjer af omgivende tekst\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -ANTAL det samme som --context=ANTAL\n" " --color[=HVORNÃ…R],\n" " --colour[=HVORNÃ…R] brug farvemarkering til at fremhæve træffere;\n" " HVORNÃ…R er \"always\", \"never\", eller \"auto" "\"\n" " -U, --binary fjern ikke CR-tegn ved EOL (MSDOS/Windows)\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "NÃ¥r FIL er \"-\", læses standard-inddata. Uden FIL læses \".\" i\n" "rekursiv tilstand, ellers \"-\". Givet mindre end to FILer antages -h.\n" "Slutstatus er 0 hvis mindst én linje (eller fil med -L) blev valgt, ellers " "1;\n" "hvis der opstÃ¥r en fejl, og -q ikke blev givet, er afslutningsstatus 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "modstridende søgeudtryk angivet" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Perl-matching understøttes ikke hvis kompileret med --disable-perl-regexp" # en 'matcher' er tydeligvis et substantiv her... mystisk #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "ugyldig matcher %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "ukendt enhedsmetode" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "ugyldig angivelse af maksimum" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "ukendt binær filtype" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Skrevet af Mike Haertel med flere; se\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "kunne ikke allokere hukommelse til PCRE JIT-stakken" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P understøtter kun unibyte- og UTF-8-sprogindstillinger" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "flaget -P understøtter kun et enkelt mønster" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "intern fejl (burde aldrig ske)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "overskred maksimal linjelængde for PCRE" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "hukommelse opbrugt" #: src/pcresearch.c:310 #, fuzzy, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "PCRE JIT-stak tømt" #: src/pcresearch.c:315 #, fuzzy, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "overskred tilbagerækkevidde for PCRE" #: src/pcresearch.c:319 #, fuzzy, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "overskred tilbagerækkevidde for PCRE" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "intern PCRE-fejl: %d" #, c-format #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "advarsel: GREP_OPTIONS er forældet; brug venligst et alias eller skript" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "advarsel: %s: %s" #~ msgid "%s home page: <http://www.gnu.org/software/%s/>\n" #~ msgstr "Hjemmeside for %s: <http://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "ugyldigt %s%s-argument \"%s\"" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "ugyldigt suffiks i %s%s-argumentet \"%s\"" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s-argumentet \"%s\" er for stort" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "intern fejl" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: flaget \"--%s\" tillader ikke et argument\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: ukendt flag \"--%s\"\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: flaget \"-W %s\" er flertydigt\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: flaget \"-W %s\" tillader ikke et argument\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: flaget \"-W %s\" kræver et argument\n" #~ msgid "lseek failed" #~ msgstr "lseek mislykkedes" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "\"egrep\" betyder \"grep -E\". \"fgrep\" betyder \"grep -F\".\n" #~ "Direkte kørsel som enten \"egrep\" eller \"fgrep\" er forældet.\n" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "MØNSTER er et udvidet regulært udtryk (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "Kørsel som \"egrep\" er forældet; brug \"grep -E\" i stedet.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "MØNSTER er en mængde faste strenge adskilt af linjeskift.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "Kørsel som \"fgrep\" er forældet; brug \"grep -F\" i stedet.\n" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Hjemmeside for GNU Grep: <%s>\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s kan kun bruge %s-mønstersyntaksen" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "tilvalget --mmap har været no-op siden 2010" �����������������kbuild-3608/src/grep/po/pl.po�����������������������������������������������������������������������0000664�0001750�0001750�00000060631�14670377471�016051� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Polish translation of the GNU grep messages # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # RafaÅ‚ Maszkowski <rzm@icm.edu.pl>, 1996-2002, 2005, 2007-2017, 2019-2021. msgid "" msgstr "" "Project-Id-Version: GNU grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 11:35+0200\n" "Last-Translator: RafaÅ‚ Maszkowski <rzm@icm.edu.pl>\n" "Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n" "Language: pl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8-bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "błędny argument %s dla %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "dwuznaczny argument %s dla %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "PrawidÅ‚owe agrumenty to:" #: lib/c-stack.c:187 msgid "program error" msgstr "błąd programu" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "przepeÅ‚nienie stosu" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "błąd zapisu" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ nie do pary" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "błędna nazwa klasy znaków" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "skÅ‚adnia klasy znaków to [[:space:]], nie [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "niedokoÅ„czona sekwencja \\" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "błędna zawartość \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "za duże wyrażenie regularne" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( nie do pary" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "brak specyfikacji skÅ‚adni" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") nie do pary" #: lib/error.c:195 msgid "Unknown system error" msgstr "Nieznany błąd systemowy" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: opcja „%s%s†jest niejednoznaczna\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: opcja „%s%s†jest niejednoznaczna; możliwoÅ›ci:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: nierozpoznana opcja „%s%sâ€\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: opcja „%s%s†nie może mieć argumentu\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: opcja „%s%s†wymaga argumentu\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: błędna opcja -- „%câ€\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: opcja wymaga argumentu -- „%câ€\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "pamięć wyczerpana" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "nie udaÅ‚o siÄ™ zapisać bieżącego katalogu" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "nie udaÅ‚o siÄ™ powrócić do poczÄ…tkowego katalogu" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "nie udaÅ‚o siÄ™ ustawić trybu tekstowego/binarnego deskryptora pliku" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "„" #: lib/quotearg.c:356 msgid "'" msgstr "â€" #: lib/regcomp.c:135 msgid "Success" msgstr "Udane" #: lib/regcomp.c:138 msgid "No match" msgstr "Nie pasuje" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Błędne wyrażenie regularne" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Znak błędny dla bieżącego uporzÄ…dkowania" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Błędna nazwa klasy znaków" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "KoÅ„cowy ukoÅ›nik odwrotny" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Błędne odwoÅ‚anie" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Nie pasujÄ…cy [, [^, [:, [., albo [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Nie pasujÄ…cy ( albo \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Nie pasujÄ…cy \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Błędna zawartość \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Błędny koniec zakresu" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Pamięć wyczerpana" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Błędne poprzedzajÄ…ce wyrażenie regularne" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Przedwczesny koniec wyrażenia regularnego" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Za duże wyrażenie regularne" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Nie pasujÄ…cy ) albo \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Brak poprzedniego wyrażenia regularnego" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Spakowane przez %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Spakowane przez %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licencja GPLv3+: GNU GPL wersja 3 albo późniejsza %s\n" "To jest wolne oprogramowanie: możesz je modyfikować i rozpowszechniać.\n" "Autorzy NIE DAJÄ„ GWARANCJI w granicach dozwolonych prawem.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Napisany przez %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Napisany przez %s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Napisany przez %s, %s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Napisany przez %s, %s, %s\n" "i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Napisany przez %s, %s, %s,\n" "%s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Napisany przez %s, %s, %s,\n" "%s, %s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Napisany przez %s, %s, %s,\n" "%s, %s, %s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Napisany przez %s, %s, %s,\n" "%s, %s, %s, %s\n" "i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Napisany przez %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Napisany przez %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s i innych.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Raporty o błędach należy wysyÅ‚ać do %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Raporty o błędach %s należy wysyÅ‚ać do %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Strona domowa %s: %s\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Pomoc w używaniu oprogramowania GNU: %s\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(standardowe wejÅ›cie)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "błędny argument dÅ‚ugoÅ›ci kontekstowej" #: src/grep.c:894 msgid "input is too large to count" msgstr "danych wejÅ›ciowych jest zbyt dużo do policzenia" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: plik binarny pasuje do wzorca" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: nieskoÅ„czona pÄ™tla przeglÄ…dania katalogów" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: plik wejÅ›ciowy jest również plikiem wyjÅ›ciowym" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "SkÅ‚adnia: %s [OPCJA]... WZORCE [PLIK] ...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Napisz „%s --help†żeby dowiedzieć siÄ™ wiÄ™cej.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Szukanie WZORCÓW w PLIKACH.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "PrzykÅ‚ad: %s -i 'hello world' menu.h main.c\n" "WZORCE mogÄ… zawierać wiele wzorców w kolejnych liniach.\n" "\n" "Wybór i interpretacja wzorców:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp WZORCE sÄ… rozszerzonymi wyrażeniami regularnymi\n" " -F, --fixed-strings WZORCE sÄ… napisami\n" " -G, --basic-regexp WZORCE sÄ… podstawowymi wyrażeniami regularnymi\n" " -P, --perl-regexp WZORCE sÄ… wyrażeniami regularnymi perla\n" # synonimy: wielkie/maÅ‚e litery, majuskuÅ‚a/minuskuÅ‚a, górna/dolna kaszta, górny/dolny rejestr liter; ogólnie: kaszta, rejestr #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=WZORCE dopasowanie do WZORCOW\n" " -f, --file=PLIK użycie wzorców z PLIKU\n" " -i, --ignore-case ignorowanie rejestru liter\n" " --no-ignore-case bez ignorowania rejestru liter (domyÅ›lnie)\n" " -w, --word-regexp dopasowanie WZORCOW tylko do peÅ‚nych słów\n" " -x, --line-regexp dopasowanie WZORCOW tylko do caÅ‚ych linii\n" " -z, --null-data linie sÄ… zakoÅ„czone bajtem 0, nie znakiem\n" " nowej linii\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Różne:\n" " -s, --no-messages bez komunikatów o błędach\n" " -v, --invert-match wybranie nie pasujÄ…cych linii\n" " -V, --version wypisanie informacji o wersji i zakoÅ„czenie\n" " --help wypisanie tych informacji i zakoÅ„czenie\n" "\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Sterowanie danymi wyjÅ›ciowymi:\n" " -m, --max-count=ILE zatrzymanie po ILU wybranych liniach\n" " -b, --byte-offset wypisanie pozycji bajtów w wyniku\n" " -n, --line-number wypisanie numerów linii w wyniku\n" " --line-buffered opróżnienie bufora po każdej linii\n" " -H, --with-filename wypisanie nazwy pliku dla każdej linii\n" " -h, --no-filename bez nazwy pliku w liniach wyjÅ›ciowych\n" " --label=ETYKIETA w wyniku ETYKIETA zastÄ™puje nazwe pliku\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching pokazanie tylko niepustych części linii, które\n" " pasujÄ…\n" " -q, --quiet, --silent wyłączenie wypisywanie wyniku\n" " --binary-files=TYP zaÅ‚ożenie, że pliki binarne sÄ… typu TYP\n" " TYP to „binaryâ€, „text†lub „without-matchâ€.\n" " -a, --text równoważne --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I równoważne --binary-files=without-match\n" " -d, --directories=DZIAÅANIE jak siÄ™ obchodzić z katalogami,\n" " DZIAÅANIE to „read†(czytanie), „recurseâ€\n" " (przeglÄ…danie rekurencujne) albo „skipâ€\n" " (pominiÄ™cie).\n" " -D, --devices=DZIAÅANIE jak odwoÅ‚ywać siÄ™ do urzÄ…dzeÅ„, FIFO i gniazd,\n" " DZIAÅANIE to „read†(czytaj) albo " "„skip†(pomiÅ„)\n" " -r, --recursive równoważne --directories=recurse\n" " -R, --dereference-recursive podobnie, ale z podążaniem za dowiÄ…zaniami\n" " symbolicznymi\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=WZORZEC_PLIKOWY przeszukiwane bÄ™dÄ… pliki pasujÄ…ce do\n" " WZORCA_PLIKOWEGO\n" " --exclude=WZORZEC_PLIKOWY pliki pasujÄ…ce do WZORCA_PLIKOWEGO bÄ™dÄ…\n" " pominiÄ™te\n" " --exclude-from=PLIK pominiÄ™cie plików pasujÄ…cych do wzorców " "plikowych\n" " w PLIKU\n" " --exclude-dir=WZORZEC_PLIKOWY katalogi pasujÄ…ce do WZORCA_PLIKOWEGO\n" " bÄ™dÄ… pominiÄ™te\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match wypisanie tylko nazw PLIKÓW bez wybranych " "linii\n" " -l, --files-with-matches wypisanie tylko nazw PLIKÓW z wybranymi liniami\n" " -c, --count wypisanie tylko liczby wybranych linii w każdym\n" " PLIKU\n" " -T, --initial-tab wyrównanie linii przez TAB (jeżeli potrzebne)\n" " -Z, --null wypisanie bajtu 0 po każdej nazwie PLIKU\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Sterowanie kontekstem:\n" " -B, --before-context=ILE wypisanie ILU linii kontekstu przed\n" " -A, --after-context=ILE wypisanie ILU linii kontekstu po\n" " -C, --context=ILE wypisanie ILU linii kontekstu\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -ILE to samo co --context=ILE\n" " --group-separator=SEP wypisanie SEP miÄ™dzy dopasowaniami z " "kontekstem\n" " --no-group-separator bez wypisania separatora miÄ™dzy dopasowaniami z\n" " z kontekstem\n" " --color[=KIEDY],\n" " --colour[=KIEDY] oznaczanie pasujÄ…cych znaków,\n" " KIEDY to „always†(zawsze), „never†(nigdy)\n" " albo „auto†(automatycznie).\n" " -U, --binary bez usuwania znaków nowej linii na koÅ„cu\n" " (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Jeżeli PLIK to „-â€, czytane jest standardowe wejÅ›cie. Jeżeli PLIK nie jest\n" "podany i użyta jest opcja -r, czytany jest katalog ., natomiast - gdy -r " "nie\n" "jest podane. Jeżeli podano mniej niż dwa PLIKI, program włącza opcjÄ™ -h.\n" "ZakoÅ„czenie dziaÅ‚ania z kodem wyjÅ›ciowym 0, jeżeli pasuje jakaÅ› linia\n" "z 1, jeżeli nie; z 2, w razie błędów i gdy nie podano opcji -q.\n" # viendo los fuentes , hay varias opciones # que hay sin documentar. O quiza es que getopt() lo he entendido mal # Son las opciones X ( requiere argumento ) , switchs -c, -b, -L e -y # grep.c:622 -> # opt = getopt(argc, argv, "0123456789A:B:CEFGVX:bce:f:hiLlnqsvwxy" # grep --help -> # usage: grep [-[[AB] ]<num>] [-[CEFGVchilnqsvwx]] [-[ef]] <expr> [<files...>] # La opción -X es a la que corresponde esta línea. #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "podano sprzeczne wzorce" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Dopasowywanie wzorców w stylu perla nie dziaÅ‚a w wersji zbudowanej z --" "disable-perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "błędna dopasowanie %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "nieznany sposób przeglÄ…dania urzÄ…dzeÅ„" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "uwaga: opcja --unix-byte-offsets (-u( jest przestarzaÅ‚a" #: src/grep.c:2686 msgid "invalid max count" msgstr "błędna maksymalna liczba powtórzeÅ„" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "nieznany typ pliku binarnego" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Program napisany przez Mike'a Haertela i innych, zobacz\n" "https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "nie udaÅ‚o siÄ™ zaalokować pamiÄ™ci dla stosu PCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P dziaÅ‚a tylko kodowaniem jednobajtowym albo UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "opcja -P może być użyta tylko do pojedynczego wzorca" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "błąd wewnÄ™trzny (nigdy nie powinien siÄ™ zdarzyć)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "przekroczony limit dÅ‚ugoÅ›ci linii PCRE" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: pamięć wyczerpana" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: wyczerpany stos JIT PCRE" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: przekroczony limit analizy wstecznej PCRE" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: przekroczony limit rekursji PCRE" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: błąd wewnÄ™trzny PCRE: %d" �������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/ko.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000043544�14670377471�016217� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��«��#��M��²$��G���&��U��H'��r��ž)����+����,,��·��>.��'��ö/��g��2��¶��†4�����=6��!���U6��$���w6��$���œ6�����Á6��5���à6�����7�����17�����O7��9���j7��%���¤7��3���Ê7��/���þ7��4���.8��'���c8��&���‹8�����²8�����´8�����¸8��3���È8��š���ü8��2���—9�����Ê9��!���â9�����:�����:��!���2:�����T:�����i:��á���„:�����f;�����};�����’;�����±;�����Ë;��_���ê;��4���J<��$���<�����¤<�����Á<��D���Û<����� =��!���'=��7���I=�����=��&���¡=��&���È=��%���ï=�����>��3���3>��+���g>��ñ��“>��!���…@��<���§@��=���ä@��9���"A��5���\A��1���’A��.���ÄA��)���óA��%���B�����CB��‹���ZB�����æB��!���èB��J��� C��*���UC�����€C��9���žC��7���ØC��K���D��/���\D��#���ŒD��!���°D�����ÒD�����íD�����E�����"E�����=E�����UE��&���lE�����“E��$���§E�����ÌE��-���ãE��8���F�����JF�����hF�����†F��)���¤F��)���ÎF�����øF��@���G�� ���VG����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: GNU grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-10 10:17+0900 Last-Translator: Seong-ho Cho <darkcircle.0426@gmail.com> Language-Team: Korean <translation-team-ko@googlegroups.com> Language: ko MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Poedit 2.3.1 � 문맥 제어: -B, --before-context=<갯수> <갯수> 줄 ìˆ˜ë§Œí¼ ì¶œë ¥ ë‚´ìš©ì˜ ì•žë¶€ë¶„ì„ ì¶œë ¥í•©ë‹ˆë‹¤ -A, --after-context=<갯수> <갯수> 줄 ìˆ˜ë§Œí¼ ì¶œë ¥ ë‚´ìš©ì˜ ë’·ë¶€ë¶„ì„ ì¶œë ¥í•©ë‹ˆë‹¤ -C, --context=<갯수> <갯수> 줄 수 ë§Œí¼ ì¶œë ¥ ë‚´ìš© 앞 ë’¤ ë¶€ë¶„ì„ ëª¨ë‘ ì¶œë ¥í•©ë‹ˆë‹¤ � 기타: -s, --no-messages 오류 메시지 ì¶œë ¥ì„ ìƒëžµí•©ë‹ˆë‹¤ -v, --invert-match ì¡°ê±´ì— ì¼ì¹˜í•˜ì§€ 않는 í–‰ì„ ì„ íƒí•©ë‹ˆë‹¤ -V, --version 버전 정보를 나타내고 ë¹ ì ¸ 나갑니다 --help ì´ ë„ì›€ë§ í…스트를 나타내고 ë¹ ì ¸ 나갑니다 � 출력 제어: -m, --max-count=<횟수> <횟수> ë§Œí¼ í–‰ì„ ì°¾ì•„ë‚´ê³  나면 멈춤 -b, --byte-offset 출력 í–‰ì˜ ë°”ì´íЏ ì˜¤í”„ì…‹ì„ ì¶œë ¥í•©ë‹ˆë‹¤ -n, --line-number 출력 í–‰ì˜ í–‰ 번호를 출력합니다 --line-buffered 모든 í–‰ì˜ ì¶œë ¥ì„ í”ŒëŸ¬ì‹±í•©ë‹ˆë‹¤ -H, --with-filename 출력 í–‰ì— íŒŒì¼ ì´ë¦„ì„ ì¶œë ¥í•©ë‹ˆë‹¤ -h, --no-filename 출력 í–‰ ì•žë¶€ë¶„ì˜ íŒŒì¼ ì´ë¦„ 표시를 ìƒëžµí•©ë‹ˆë‹¤ --label=<ë ˆì´ë¸”> <ë ˆì´ë¸”>ì„ í‘œì¤€ ìž…ë ¥ ì•žë¶€ë¶„ì˜ íŒŒì¼ ì´ë¦„으로 사용합니다 � --include=<글롭> <글롭>(íŒŒì¼ íŒ¨í„´)ì— ì¼ì¹˜í•˜ëŠ” 파ì¼ë§Œ 검색합니다 --exclude=<글롭> <글롭>ì— ì¼ì¹˜í•˜ëŠ” 파ì¼ì„ 건너ëœë‹ˆë‹¤ --exclude-from=<파ì¼> <파ì¼>ê³¼ íŒŒì¼ íŒ¨í„´ì´ ì¼ì¹˜í•˜ëŠ” 파ì¼ì„ 건너ëœë‹ˆë‹¤ --exclude-dir=<글롭> <글롭>ê³¼ ì¼ì¹˜í•˜ëŠ” 디렉터리를 건너ëœë‹ˆë‹¤ � -E, --extended-regexp <패턴>ì€ í™•ìž¥ ì •ê·œ 표현ì‹ìž…니다 -F, --fixed-strings <패턴>ì€ ë‹¨ìˆœ 문ìžì—´ìž…니다 -G, --basic-regexp <패턴>ì€ ê¸°ë³¸ ì •ê·œ 표현ì‹ìž…니다 -P, --perl-regexp <패턴>ì€ íŽ„ ì •ê·œ 표현ì‹ìž…니다 � -I --binary-files=without-match 옵션과 ë™ì¼ -d, --directories=<ë™ìž‘> 디렉터리 처리 ë°©ì‹ <ë™ìž‘> ê°’ì€ 'read', 'recurse', 'skip' 중 하나입니다 -D, --devices=<ë™ìž‘> 장치, FIFO, 소켓 처리 ë°©ì‹ <ë™ìž‘> ê°’ì€ 'read', 'skip' 중 하나입니다 -r, --recursive --directories=recurse와 유사 -R, --dereference-recursive 위 옵션과 비슷하지만 모든 심볼릭 ë§í¬ë¥¼ ë”°ë¼ê°‘니다 � -L, --files-without-match ì¼ì¹˜í•˜ëŠ” í–‰ì´ ì—†ìœ¼ë©´ <파ì¼>ì˜ ì´ë¦„ë§Œ 출력합니다 -l, --files-with-matches ì¼ì¹˜í•˜ëŠ” í–‰ì´ ìžˆëŠ” <파ì¼>ì˜ ì´ë¦„ë§Œ 출력합니다 -c, --count <파ì¼>ì— ì¼ì¹˜í•˜ëŠ” í–‰ 갯수만 출력합니다 -T, --initial-tab (필요한 경우) í–‰ 별로 íƒ­ì„ í‘œì‹œí•©ë‹ˆë‹¤ -Z, --null <파ì¼> ì´ë¦„ ë’¤ì— 0 ë°”ì´íЏ ê°’ì„ ì¶œë ¥í•©ë‹ˆë‹¤ � -NUM --context=<갯수>와 ë™ì¼ --group-separator=<구분ìž> ë¬¸ë§¥ìƒ ì¼ì¹˜í•˜ëŠ” í–‰ì„ <구분ìž> 출력으로 구분 --no-group-separator ì¼ì¹˜ ë¬¸ë§¥ì— ëŒ€í•œ 구분ìžë¥¼ 출력하지 않습니다 --color[=<시기>], --colour[=<시기>] ì¼ì¹˜í•˜ëŠ” 문ìžì—´ 강조시 마커를 활용합니다 <시기>ì˜ ê°’ì€ 'always', 'never', 'auto' 중 하나입니다 -U, --binary 개행 문ìžì—서 CR 문ìžë¥¼ 빼내지 않ìŒ(MSDOS/윈ë„ìš°) � -e, --regexp=<패턴> ì¼ì¹˜í•˜ëŠ” ë¶€ë¶„ì„ ì°¾ì„ <패턴> ê¸°ì¤€ì„ í™œìš©í•©ë‹ˆë‹¤ -f, --file=<파ì¼> <파ì¼>ì—서 <패턴>ì— ì¼ì¹˜í•˜ëŠ” ë¶€ë¶„ì„ ì·¨í•©ë‹ˆë‹¤ -i, --ignore-case ëŒ€ì†Œë¬¸ìž êµ¬ë¶„ì„ ë¬´ì‹œí•©ë‹ˆë‹¤ --no-ignore-case ëŒ€ì†Œë¬¸ìž êµ¬ë¶„ì„ ìœ ì§€í•©ë‹ˆë‹¤(기본값) -w, --word-regexp 주어진 단어와 완벽하게 ì¼ì¹˜í•˜ëŠ” 부분만 -x, --line-regexp 주어진 í–‰ 내용과 완벽하게 ì¼ì¹˜í•˜ëŠ” 부분만 -z, --null-data ë°ì´í„° í–‰ì˜ ëì€ ê°œí–‰ 문ìžê°€ 아닌 0ë°”ì´íЏ 값으로 ë납니다 � -o, --only-matching ì¡°ê±´ì— ì¼ì¹˜í•˜ëŠ” í–‰ì´ ë¹„ì–´ìžˆì§€ ì•Šì€ ê²°ê³¼ë§Œ 나타냅니다 -q, --quiet, --silent 모든 ì¼ë°˜ 출력 ë™ìž‘ì„ ìƒëžµí•©ë‹ˆë‹¤ --binary-files=<형ì‹> ë°”ì´ë„ˆë¦¬ 파ì¼ì„ 지정한 <형ì‹>으로 간주합니다 <형ì‹> ê°’ì€ 'binary', 'text', 'without-match' 중 하나입니다 -a, --text --binary-files=text 옵션과 ë™ì¼ �%s 홈 페ì´ì§€: <%s> �%s: ë°”ì´ë„ˆë¦¬ íŒŒì¼ ì¼ì¹˜í•¨�%s: PCRE 후위 ì¶”ì  í•œê³„ 초과�%s: PCRE 후위 ì¶”ì  í•œê³„ 초과�%s: PCRE JIT ìŠ¤íƒ ê°€ë“ ì°¸�%s: ìž…ë ¥ 파ì¼ì€ 출력 대ìƒì´ê¸°ë„ 합니다�%s: ë‚´ë¶€ PCRE 오류: %d�%s: ìž˜ëª»ëœ ì˜µì…˜ -- '%c' �%s: 메모리가 바닥남�%s: '%s%s' ì˜µì…˜ì€ ì¸ìžë¥¼ 허용하지 않습니다 �%s: '%s%s' ì˜µì…˜ì´ ëª¨í˜¸í•©ë‹ˆë‹¤ �%s: '%s%s' ì˜µì…˜ì´ ëª¨í˜¸í•©ë‹ˆë‹¤ 가능한 ê°’:�%s: '%s%s' ì˜µì…˜ì€ ì¸ìžê°€ 필요합니다 �%s: ì´ ì˜µì…˜ì€ ì¸ìžê°€ 필요합니다 -- '%c' �%s: ì¸ì‹í•  수 없는 옵션 '%s%s' �%s: 경고: 재귀 디렉터리 순환�'�(C)�(표준 ìž…ë ¥)�-P 유니바ì´íЏ, UTF-8 로캘만 ì§€ì›í•©ë‹ˆë‹¤�예제: %s -i 'hello world' menu.h main.c <패턴>ì—는 개행 문ìžë¡œ 구분한 여러 íŒ¨í„´ì„ ë„£ì„ ìˆ˜ 있습니다. 패턴 ì„ íƒ ë° í•´ì„: �GNU 소프트웨어 활용 ì¼ë°˜ ë„움ë§: <%s> �ìž˜ëª»ëœ í›„ìœ„ 참조�ìž˜ëª»ëœ ë¬¸ìž í´ëž˜ìФ ì´ë¦„�ìž˜ëª»ëœ ì¡°í•© 문ìž�ìž˜ëª»ëœ \{\} ë‚´ìš©�ìž˜ëª»ëœ ì„ í–‰ ì •ê·œ 표현ì‹�ìž˜ëª»ëœ ë²”ìœ„ ë�ìž˜ëª»ëœ ì •ê·œ 표현ì‹�GPLv3+ ë¼ì´ì„ ìФ: GNU GPL 버전 3 ì´ìƒ <%s>. ì´ í”„ë¡œê·¸ëž¨ì€ ìžìœ  소프트웨어입니다: ìžìœ ë¡­ê²Œ 바꾸고 재배í¬í•  수 있습니다. ë²•ë¥ ì´ í—ˆìš©í•˜ëŠ” 모든 ë²”ìœ„ë‚´ì˜ ë³´ì¦ì€ 없습니다. �메모리가 바닥남�ì¼ì¹˜ 항목 ì—†ìŒ�ì´ì „ ì •ê·œ í‘œí˜„ì‹ ì—†ìŒ�%sì´(ê°€) 패키징 함 �%sì´(ê°€) 패키징 함 (%s) �--disable-perl-regexp 빌드ì—서는 Perl 문ìžì—´ ì¼ì¹˜ ê¸°ëŠ¥ì„ ì§€ì›í•˜ì§€ 않습니다�ì •ê·œ í‘œí˜„ì‹ ë§ˆê° í‘œí˜„ì´ ì•žì„œìžˆìŠµë‹ˆë‹¤�ì •ê·œ 표현ì‹ì´ 너무 ê¹ë‹ˆë‹¤�%s 버그 ë³´ê³  주소: %s �버그 ë³´ê³  주소: %s �ê° <파ì¼>ì—서 <패턴>ì— ì¼ì¹˜í•˜ëŠ” í–‰ì„ ê²€ìƒ‰í•©ë‹ˆë‹¤. �성공�ë°± 슬래시 문ìžê°€ ë”°ë¼ì˜´�ìžì„¸í•œ 정보는 '%s --help'를 입력하십시오. �알 수 없는 시스템 오류�ì¼ì¹˜í•˜ì§€ 않는 ( ë˜ëŠ” \( 괄호�ì¼ì¹˜í•˜ì§€ 않는 ) ë˜ëŠ” \) 괄호�ì¼ì¹˜í•˜ì§€ 않는 [, [^, [:, [., [=�ì¼ì¹˜í•˜ì§€ 않는 \{ 괄호�사용법: %s [<옵션>]... <패턴> [<파ì¼>]... �유효한 ì¸ìžëŠ” 다ìŒê³¼ 같습니다:�<파ì¼> ê°’ì´ '-' ì´ë©´, 표준 ìž…ë ¥ì„ ì½ìŠµë‹ˆë‹¤. <파ì¼>ì— ì•„ë¬´ëŸ° ê°’ì´ ì—†ë‹¤ë©´, 재귀 íƒìƒ‰ ì˜µì…˜ì„ ì£¼ì—ˆì„ ê²½ìš° 현재 디렉터리를, 그렇지 않으면 '-' ê°’ì„ ì„¤ì •í•¨ 으로 가정합니다. <파ì¼> 갯수가 í•œê°œì¼ ê²½ìš° -h ì˜µì…˜ì„ ì¤€ 것으로 가정합니다. ì¡°ê±´ ì¼ì¹˜ í–‰ì´ ë‚˜ì˜¤ë©´, ë내기 ìƒíƒœ ê°’ì€ 0ì„, 그렇지 않으면 1ì„ ë°˜í™˜í•©ë‹ˆë‹¤. 오류가 나타났거나 -q ì˜µì…˜ì„ ì£¼ì§€ 않았다면, 2를 반환합니다. �%s와(ê³¼) %sì´(ê°€) 작성함. �%s, %s, %s, %s, %s, %s, %s, %s, %s 외 다수가 작성함. �%s와(ê³¼) %s, %s, %s, %s, %s, %s, %s, %sì´(ê°€) 작성함. �%s와(ê³¼) %s, %s, %s, %s, %s, %s, %sì´(ê°€) 작성함. �%s와(ê³¼) %s, %s, %s, %s, %s, %sì´(ê°€) 작성함. �%s와(ê³¼) %s, %s, %s, %s, %sì´(ê°€) 작성함. �%s와(ê³¼) %s, %s, %s, %sì´(ê°€) 작성함. �%s와(ê³¼) %s, %s, %sì´(ê°€) 작성함. �%s와(ê³¼) %s, %sì´(ê°€) 작성함. �%sì´(ê°€) 작성함. �Mike Haertel ë“±ì´ ìž‘ì„±í•¨. 기타 ìž‘ì„±ìž ì •ë³´ëŠ” <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS> ë§í¬ë¥¼ 참고하십시오.�`�%2$s ëŒ€ìƒ ëª¨í˜¸í•œ ì¸ìž %1$s�ë¬¸ìž í´ëž˜ìФ 표기 ë°©ì‹ì€ [:space:]ê°€ 아닌 [[:space:]]입니다�ë¹„êµ ê¸°ì¤€ì„ ì¤‘ë³µ 지정했습니다�PCRE í–‰ ê¸¸ì´ í•œê³„ 초과�PCRE JIT 스íƒì˜ 메모리 í• ë‹¹ì— ì‹¤íŒ¨í–ˆìŠµë‹ˆë‹¤�초기 작업 디렉터리 ë°˜í™˜ì— ì‹¤íŒ¨í–ˆìŠµë‹ˆë‹¤�í…스트/ë°”ì´ë„ˆë¦¬ 모드 íŒŒì¼ ì„œìˆ ìž ì„¤ì •ì— ì‹¤íŒ¨í–ˆìŠµë‹ˆë‹¤�ìž…ë ¥ í–‰ 수를 ì„¸ê¸°ì— ë„ˆë¬´ 많습니다�ë‚´ë¶€ 오류 (나타나면 안ë¨)�%2$s ëŒ€ìƒ ìž˜ëª»ëœ ì¸ìž %1$s�ìž˜ëª»ëœ ë¬¸ìž í´ëž˜ìФ�ìž˜ëª»ëœ \{\} ë‚´ìš©�ìž˜ëª»ëœ ë‚´ìš© ê¸¸ì´ ì¸ìž�ìž˜ëª»ëœ ë¹„êµ ê¸°ì¤€ %s�ìž˜ëª»ëœ ìµœëŒ€ 갯수�메모리가 바닥남�ë¬¸ë²•ì„ ì§€ì •í•˜ì§€ 않았습니다�프로그램 오류�ì •ê·œ 표현ì‹ì´ 너무 ê¹ë‹ˆë‹¤�ìŠ¤íƒ ì˜¤ë²„í”Œë¡œìš°�-P ì˜µì…˜ì€ ë‹¨ì¼ íŒ¨í„´ë§Œ ì§€ì›í•©ë‹ˆë‹¤�현재 작업 디렉터리를 기ë¡í•  수 없습니다�ì§ì´ ë§žì§€ 않는 ( 괄호�ì§ì´ ë§žì§€ 않는 ) 괄호�ì§ì´ ë§žì§€ 않는 [ 괄호�ë나지 ì•Šì€ \ ì´ìŠ¤ì¼€ì´í”„ 문ìž�알 수 없는 ë°”ì´ë„ˆë¦¬ íŒŒì¼ í˜•ì‹�알 수 없는 장치 ë°©ì‹�경고: --unix-byte-offsets (-u) ì˜µì…˜ì€ ì˜¤ëž˜ë˜ì—ˆìŠµë‹ˆë‹¤�ê¸°ë¡ ì˜¤ë¥˜�������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/vi.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000036532�14670377471�016223� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����]�����������ì������è��Ï���é��÷���¹��Õ��± ��ü���‡ ��¶��„ ��U��;��¤��‘��F��6�����}�����‘��,���­�����Ú��.���ú��'���)��(���Q�����z�����š�����œ����� ��*���±�����Ü��&���m�����”�����«�����È�����ä��$���ü�����!�����3��ª���N�����ù����� ����������2�����B��<���W��#���”�����¸�����Ó�����ê��"���þ�����!�����)��&���<�����c�����x�����Š�����œ�� ���»��)���È�����ò�������;�����3���Z��/���Ž��+���¾��'���ê��#��������6�����V�����r��\���‚�����ß�����á��4���þ�����3��!���R��0���t��-���¥��.���Ó�������$��������C�����^�����v�����Ž�����®�����Á�����Ó�����ä�� ���ø����������!��,���0��*���]�� ���ˆ�� ���•�� ���¢�����¯�����Ã�����Ý�� ���ô��ó�����õ���ô����ê��°��ý ����®#��å��É$��Š��¯'����:)����P+�����a-��.���}-��E���¬-��+���ò-��<���.��3���[.��9���.��,���É.�����ö.�����ú.�����ý.��<���/��¦���V/��@���ý/��'���>0��%���f0��)���Œ0��'���¶0��7���Þ0�����1��*���01����[1�����`2�����q2��2���„2�����·2�����Í2��P���è2��0���93��#���j3��w���Ž3��o���4��*���v4�� ���¡4�����®4��B���Í4�����5��,���.5��,���[5��-���ˆ5�� ���¶5��6���×5�� ���6�����/6��O���H6��4���˜6��0���Í6��,���þ6��(���+7��$���T7�� ���y7�����š7�����·7��}���É7�����G8��/���K8��A���{8��/���½8��<���í8��G���*9��D���r9��U���·9��D��� :��2���R:��0���…:�����¶:��'���É:��7���ñ:�����);��)���@;�����j;�����{;�����”;��#���ª;�����Î;��<���à;��D���<��"���b<��$���…<��#���ª<��"���Î<��6���ñ<��'���(=�� ���P=��������E������#������=���T���B��������������-���;���9������3������� ���\���A��������������:���D���%���J���8�����������?���.�����������V���P���F����������(���)����������Q�����������H���R����������I������[������4�������Y���!�������L���]���7���5������� ���@�����������<���X��� ���Z�������K���G�����������6���,���S���1�������0���������N������$���O����������������M����������������������������C���+��� ����������>���'���/���U�������*������&���2������W������������� �������"����������� ���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: invalid option -- '%c' �%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep 3.3.42 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2020-01-04 15:02+0700 Last-Translator: Trần Ngá»c Quân <vnwildman@gmail.com> Language-Team: Vietnamese <translation-team-vi@lists.sourceforge.net> Language: vi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=1; plural=0; X-Generator: Poedit 2.2.4 X-Poedit-SourceCharset: UTF-8 � Äiá»u khiển ngữ cảnh: -B, --before-context=Sá» in ra Sá» dòng ngữ cảnh Ä‘i trước -A, --after-context=Sá» in ra Sá» dòng ngữ cảnh Ä‘i sau -C, --context=Sá» in ra Sá» dòng ngữ cảnh kết xuất � Há»—n tạp: -s, --no-messages chặn các thông báo lá»—i -v, --invert-match chá»n các dòng không khá»›p -V, --version in ra thông tin phiên bản rồi thoát --help hiển thị trợ giúp này rồi thoát � Äiá»u khiển kết xuất: -m, --max-count=Sá» dừng sau khi khá»›p được Sá» lần -b, --byte-offset in ra vị trí tương đối tính theo byte cùng vá»›i dòng kết xuất -n, --line-number in ra số thứ tá»± dòng cùng vá»›i dòng kết xuất --line-buffered xóa sạch kết xuất trên từng dòng -H, --with-filename in ra tên tập tin cho từng dòng đầu ra -h, --no-filename chặn tiá»n tố tên tập tin khi xuất --label=NHÃN sá»­ dụng NHÃN này làm tiá»n tố cho tập tin cho đầu ra tiêu chuẩn � -E, --extended-regexp MẪU là các biểu thức chính quy mở rá»™ng -F, --fixed-strings MẪU là các chuá»—i -G, --basic-regexp MẪU là các biểu thức chính quy cÆ¡ bản -P, --perl-regexp MẪU là các biểu thức chính quy Perl � -I giống vá»›i “--binary-files=without-match†-d, --directories=HÀNH_VI cách quản lý các thư mục. HÀNH_VI là: * “read†đá»c * “recurse†đệ quy * “skip†bá» qua -D, --devices=HÀNH_VI cách quản lý các thiết bị, FIFO và socket; HÀNH_VI: * “read†đá»c * “skip†bá» qua -r, --recursive giống vá»›i tùy chá»n “--directories=recurse†-R, --dereference-recursive cÅ©ng vậy nhưng cho phép cả các liên kết má»m � -L, --files-without-match chỉ in ra tên cá»§a các TẬP TIN không khá»›p mẫu -l, --files-with-matches chỉ in ra tên cá»§a các TẬP TIN khá»›p mẫu -c, --count chỉ in ra số lượng dòng khá»›p trong má»—i TẬP TIN -T, --initial-tab sắp hàng cá»™t tab (nếu cần) -Z, --null in ra byte 0 (null) đằng sau tên TẬP TIN � -e, --regexp=MẪU dùng MẪU để so khá»›p -f, --file=TẬP_TIN lấy MẪU từ TẬP_TIN -i, --ignore-case không phân biệt HOA/thưá»ng trong mẫu và dữ liệu --no-ignore-case phân biệt HOA/thưá»ng (mặc định) -w, --word-regexp chỉ khá»›p toàn bá»™ từ -x, --line-regexp chỉ khá»›p toàn bá»™ dòng -z, --null-data má»™t dòng dữ liệu kết thúc bằng byte 0, không phải ký tá»± dòng má»›i � -o, --only-matching chỉ hiển thị phần dòng không rá»—ng khá»›p vá»›i MẪU -q, --quiet, --silent chặn má»i kết xuất bình thưá»ng --binary-files=KIỂU coi rằng tập tin nhị phân có KIỂU: * “binary†nhị phân * “text†dạng chữ * “without-match†không khá»›p -a, --text giống vá»›i tùy chá»n “--binary-files=text†�Trang chá»§ cá»§a %s: <%s> �%s: tùy chá»n không hợp lệ -- “%c†�%s: tùy chá»n “%s%s†không không cho phép má»™t đối số �%s: tùy chá»n “%s%s†chưa rõ ràng �%s: tùy chá»n “%s%s†chưa rõ ràng; khả năng là:�%s: tùy chá»n “%s%s†cần má»™t đối số �%s: tùy chá»n yêu cầu má»™t đối số -- “%c†�%s: không nhận ra tùy chá»n “%s%s†�â€�©�(đầu vào tiêu chuẩn)�-P chỉ há»— trợ miá»n địa phương unibyte và UTF-8�Ví dụ: %s -i "chào thế giá»›i" menu.h main.c MẪU có thể chứa nhiá»u mẫu ngăn cách nhau bằng ký tá»± dòng má»›i. Chá»n và biên dịch mẫu: �Trợ giúp chung vá» cách sá»­ dụng phần má»m GNU: <%s> �Tham chiếu ngược không hợp lệ�Tên lá»›p ký tá»± không hợp lệ�Ký tá»± đối chiếu không hợp lệ�Ná»™i dung cá»§a \{\} không hợp lệ�Biểu thức chính quy có trước không hợp lệ�Sai kết thúc phạm vi�Biểu thức chính quy không hợp lệ�Giấy phép GPL pb3+ : Giấy phép Công cá»™ng GNU phiên bản 3 hay sau <%s>. Äây là phần má»m tá»± do: bạn có quyá»n sá»­a đổi và phát hành lại nó. KHÔNG CÓ BẢO HÀNH GÃŒ CẢ, vá»›i Ä‘iá»u kiện được pháp luật cho phép. �Hết bá»™ nhá»›�Không tìm thấy�Không có biểu thức chính quy nằm trước�Äóng gói bởi %s �Äóng gói bởi %s (%s) �Không há»— trợ khá»›p mẫu perl khi biên dịch vá»›i --disable-perl-regexp�Biểu thức chính quy kết thức quá sá»›m�Biểu thức chính quy quá lá»›n�Hãy thông các báo lá»—i %s cho: %s Hãy thông báo lá»—i dịch cho <http://translationproject.org/team/vi.html>. �Hãy thông báo lá»—i cho: %s Hãy thông báo lá»—i dịch cho <http://translationproject.org/team/vi.html>. �Tìm kiếm MẪU trong từng TẬP_TIN. �Thành công�Dấu gạch ngược theo sau�Hãy chạy lệnh “%s --help†để biết thêm thông tin. �Lá»—i hệ thống không rõ�Có ký tá»± “(†hay “\(†lẻ cặp�Có ký tá»± “)†hay “\)†lẻ cặp�Có ký tá»± [, [^, [:, [., hay [= lẻ cặp�Có ký tá»± “\{†lẻ cặp�Cách dùng: %s [TÙY_CHỌN]… MẪU [TẬP_TIN]… �Các đối số hợp lệ là:�Viết bởi %s và %s. �Viết bởi %s, %s, %s, %s, %s, %s, %s, %s, %s và má»™t số ngưá»i khác. �Viết bởi %s, %s, %s, %s, %s, %s, %s, %s và %s. �Viết bởi %s, %s, %s, %s, %s, %s, %s và %s. �Viết bởi %s, %s, %s, %s, %s, %s và %s. �Viết bởi %s, %s, %s, %s, %s và %s. �Viết bởi %s, %s, %s, %s và %s. �Viết bởi %s, %s, %s và %s. �Viết bởi %s, %s và %s. �Viết bởi %s. �ÄÆ°á»£c viết bởi Mike Haertel và nhiá»u ngưá»i khác, xem tại <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�“�đối số %s không rõ ràng đối vá»›i %s�cú pháp lá»›p ký tá»± là [[:space:]], không phải [:space:]�đã ghi rõ dữ liệu khá»›p mà xung đột�đã vượt quá giá»›i hạn chiá»u dài dòng cá»§a PCRE�gặp lá»—i khi cấp phát bá»™ nhá»› cho stack (ngăn xếp) PCRE JIT�gặp lá»—i khi quay trở vá» thư mục làm việc khởi đầu�gặp lá»—i khi đặt chế độ văn bản/nhị phân cho bá»™ mô tả tập tin�dữ liệu đầu vào quá lá»›n nên không thể đếm được�lá»—i ná»™i bá»™ (không nên xảy ra như thế)�đối số %s không hợp lệ đối vá»›i %s�sai lá»›p ký tá»±�ná»™i dung cá»§a \{\} không hợp lệ�đối số chiá»u dài ngữ cảnh không hợp lệ�sai mẫu so khá»›p %s�số lượng tối Ä‘a không hợp lệ�hết bá»™ nhá»›�chưa đưa ra cú pháp�lá»—i chương trình�biểu thức chính quy quá lá»›n�tràn ngăn xếp�tùy chá»n “-P†chỉ há»— trợ má»™t mẫu đơn lẻ�không thể ghi nhá»› được thư mục làm việc hiện thá»i�thiếu dấu ngoặc đơn mở (�thiếu dấu ngoặc đơn đóng )�thiếu dấu ngoặc vuông mở [�chưa kết thúc thoát chuá»—i \�không rõ kiểu tập tin nhị phân (binary-files)�không rõ phương thức thiết bị�lá»—i ghi�����������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/zh_TW.gmo�������������������������������������������������������������������0000664�0001750�0001750�00000037544�14670377471�016644� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��É��#��«���Ð$��Ý���|%��À��Z&����(����1)��|��3*��J��°+�����û,��¯��ü.��I��¬0�����ö1�����2��#���"2�� ���F2�����g2�� ���†2�����§2�����Ã2�����à2��%���ø2�����3��3���>3��%���r3��%���˜3��%���¾3�� ���ä3�����4�����4����� 4��(���4�����C4��'���Ô4�����ü4�����5�����+5�����A5�����W5�����v5�����Œ5��›���¥5�����A6�����Q6�����g6�����†6�����ž6��1���»6�����í6����� 7�����7�����67��%���L7�����r7�����y7��2���Œ7�����¿7�����Õ7�����î7��'���8�����/8��,���B8�����o8��t��…8�����ú9��C���:��=���W:��:���•:��2���Ð:��-���;��(���1;��%���Z;�����€;�����ž;��i���°;�����<�����<��3���:<��$���n<�����“<��1���²<��!���ä<��7���=�����>=��*���W=�����‚=�����=�����³=�����È=�����á=�����ú=�����>����� >�� ���6>�����C>�����Y>�����l>�����‹>�����ª>�����¹>�����È>�����×>�����í>����� ?��.���"?�����Q?����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-10 02:06+0800 Last-Translator: Yi-Jyun Pan <pan93412@gmail.com> Language-Team: Chinese (traditional) <zh-l10n@lists.linux.org.tw> Language: zh_TW MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=1; plural=0; X-Generator: Poedit 3.0 � 內容控制: -B, --before-context=NUM å°å‡º NUM åˆ—çš„å‰æ–‡ -A, --after-context=NUM å°å‡º NUM 列的後文 -C, --context=NUM å°å‡º NUM 列的內容 � 雜項: -s, --no-messages æŠ‘åˆ¶éŒ¯èª¤è¨Šæ¯ -v, --invert-match é¸å–ä¸ç¬¦åˆçš„列 -V, --version å°å‡ºç‰ˆæœ¬è³‡è¨Šç„¶å¾ŒçµæŸ --help é¡¯ç¤ºæ­¤èªªæ˜Žç„¶å¾ŒçµæŸ � 輸出控制: -m, --max-count=NUM 在第 NUM é¸å–åˆ—å¾Œåœæ­¢ -b, --byte-offset å°å‡ºæ¯å€‹è¼¸å‡ºåˆ—çš„ä½å…ƒçµ„åç§»é‡ -n, --line-number å°å‡ºæ¯å€‹è¼¸å‡ºåˆ—的列號 --line-buffered 輸出æ¯åˆ—後清除輸出 -H, --with-filename å°å‡ºè¼¸å‡ºåˆ—的檔案å稱 -h, --no-filename 抑制輸出列的檔åå‰ç¶´ --label=LABEL 以 LABEL 作標準輸入的檔åå‰ç¶´ � --include=GLOB åªæœå°‹ç¬¦åˆ GLOB (一種檔案模å¼) 的檔案 --exclude=GLOB è·³éŽç¬¦åˆ GLOB 的檔案 --exclude-from=檔案 è·³éŽç¬¦åˆ <檔案> 中任何檔案模å¼çš„æª”案 --exclude-dir=GLOB è·³éŽç¬¦åˆ GLOB 的資料夾。 � -E, --extended-regexp PATTERNS æ˜¯ä¸€å€‹å»¶ä¼¸æ­£å‰‡è¡¨ç¤ºå¼ -F, --fixed-strings PATTERNS 是一個字串 -G, --basic-regexp PATTERNS æ˜¯ä¸€å€‹åŸºæœ¬æ­£å‰‡è¡¨ç¤ºå¼ -P, --perl-regexp PATTERNS 是一個 Perl æ­£è¦è¡¨ç¤ºå¼ � -I ç­‰åŒæ–¼ --binary-files=without-matc -d, --directories=ACTION æª”æ¡ˆç›®éŒ„çš„è™•ç†æ–¹å¼; ACTION 為 "read"ã€"recurse" 或 "skip" -D, --devices=ACTION è£ç½®ã€FIFO å’Œé€šè¨Šç«¯çš„è™•ç†æ–¹å¼; ACTION 為 "read" 或 "skip" -R, -r, --recursive ç­‰åŒæ–¼ --directories=recurse � -L, --files-without-match åªå°å‡ºæœªé¸å–行的 檔案 å稱 -l, --files-with-matches åªå°å‡ºé¸å–行的 檔案 å稱 -c, --count åªå°å‡ºæ¯å€‹ 檔案 çš„é¸å–行項目 -T, --initial-tab (éœ€è¦æ™‚) å°é½Š Tab 符號 -Z, --null 在 檔案 å稱後å°å‡ºç©ºç™½ä½å…ƒçµ„ � -NUM ç­‰åŒæ–¼ --context=NUM --group-separator=SEP 在上一個和下一個符åˆçµæžœå’Œé„°è¿‘列 (context) 之間輸出 SEP 分隔字串 --no-group-separator ä¸è¦åœ¨ä¸Šä¸€å€‹å’Œä¸‹ä¸€å€‹ç¬¦åˆçµæžœå’Œé„°è¿‘列之間輸出分隔字串 --color[=WHEN], --colour[=WHEN] 用特殊é¡è‰²æ¨™ç¤ºç¬¦åˆå­—串; WHEN 為「alwaysã€ã€ã€Œneverã€æˆ–「auto〠-U, --binary ä¸è¦åˆªé™¤åˆ—å°¾ CR å­—å…ƒ (MSDOS/Windows) � -e, --regexp=æ¨¡å¼ ä½¿ç”¨ <模å¼> æ¯”å° -f, --file=檔案 自 <檔案> å–å¾— <模å¼> -i, --ignore-case 忽略模å¼åŠè³‡æ–™çš„大å°å¯«å·®ç•° --no-ignore-case ä¸å…許忽略大å°å¯«å·®ç•° (é è¨­å€¼) -w, --word-regexp 僅比較整個單字 -x, --line-regexp 僅比較整行 -z, --null-data 設定資料列çµå°¾ç‚ºç©ºç™½ä½å…ƒçµ„ï¼Œéžæ›åˆ—符號 � -o, --only-matching åªé¡¯ç¤ºç›¸ç¬¦è¡Œä¸­çš„éžç©ºç™½éƒ¨ä»½ -q, --quiet, --silent 抑制全部常態的輸出 --binary-files=TYPE 設定二進制檔案為 TYPE 的檔案; TYPE å¯ç‚º "binary"ã€"text" 或 "without-match" -a, --text ç­‰åŒæ–¼ --binary-files=text �%s 首é : <%s> �%sï¼šäºŒé€²ä½æª”案符åˆ�%sï¼šå·²è¶…éŽ PCRE 的回溯上é™�%sï¼šè¶…éŽ PCRE çš„éžè¿´ä¸Šé™�%s:已用盡 PCRE JIT 堆疊�%s:輸入檔亦為輸出å°è±¡�%s:內部 PCRE 錯誤: %d�%s: 無效的é¸é … -- "%c" �%s:已用盡記憶體�%s:「%s%sã€é¸é …䏿ޥå—引數 �%s:é¸é …「%s%sã€ä¸æ˜Žç¢º �%s:é¸é …「%s%sã€ä¸æ˜Žç¢ºï¼›å¯èƒ½é¸é …為:�%s:「%s%sã€é¸é …需è¦å€‹å¼•數 �%s: é¸é …需è¦ä¸€å€‹å¼•數 -- "%c" �%s:無法識別的é¸é …「%s%s〠�%s:警告:目錄é‡è¤‡éžè¿´�'�(C)�(標準輸入)�-P åªæ”¯æ´å–®ä½å…ƒçµ„å’Œ UTF-8 編碼�範例:%s -i 'hello world' menu.h main.c PATTERNS 也å¯ä»¥åŒ…å«å¤šå€‹ä»¥æ›è¡Œç¬¦è™Ÿåˆ†éš”的形樣。 形樣 (Pattern) 鏿“‡èˆ‡è§£é‡‹ï¼š �GNU 軟體用法的一般說明:<%s> �無效的å‘後引用�無效的字元類別å�無效的å°ç…§å­—å…ƒ�無效的 \{\} 內容�無效的å‰ç½®æ­£è¦è¡¨ç¤ºå¼�ç„¡æ•ˆçš„çµæŸç¯„åœ�無效的正è¦è¡¨ç¤ºå¼�æŽˆæ¬Šæ¢æ¬¾ GPLv3+:GNU GPL 第 3 版或更新版 <%s>。 這是自由軟體:您å¯è‡ªç”±ä¿®æ”¹æˆ–散布。 在法律准許範åœå…§ä¸é™„帶ä¿è­‰ã€‚ �記憶體用盡�沒有符åˆçš„é …ç›®�沒有先å‰çš„æ­£è¦è¡¨ç¤ºå¼�套件由 %s 所打包 �套件由 %s (%s) 所打包 �--disable-perl-regexp çµ„å»ºä¸æ”¯æ´ Perl 比å°�æ­£è¦è¡¨ç¤ºå¼éŽæ—©çµæŸ�æ­£è¦è¡¨ç¤ºå¼éŽé•·�回報 %s bug 到: %s �回報臭蟲至:%s �在æ¯å€‹æª”案中尋找 PATTERNS。 �æˆåŠŸ�æœ«ç«¯æœ‰åæ–œç·š�請使用 "%s --help" 以閱讀更多的資訊。 �未知的系統錯誤�æ²’æœ‰å°æ‡‰çš„ ( 或 \(�æ²’æœ‰å°æ‡‰çš„ ) 或 \)�æ²’æœ‰å°æ‡‰çš„ [,[^,[:,[. 或 [=�æ²’æœ‰å°æ‡‰çš„ \{�用法: %s [é¸é …]… PATTERNS [檔案]… �有效的引數為:�如果 <檔案> 為「-ã€ï¼Œå‰‡è®€å–標準輸入資料。 當沒有指定 <檔案> 時,如果使用éžè¿´æ¨¡å¼ï¼Œ 則讀å–「.ã€å¦å‰‡è®€å–「-ã€ã€‚當指定的 <檔案> 數目少於兩個時,則å‡è¨­æ˜¯ -h。 如果有é¸åˆ°ä»»ä½•ä¸€åˆ—ï¼Œå‰‡å›žå‚³çµæŸç‹€æ…‹ 0,å¦å‰‡å›žå‚³ 1ï¼› 如果發生任何錯誤且沒有傳入 -q é¸é …ï¼ŒçµæŸç‹€æ…‹å‰‡ç‚º 2。 �ç”± %s å’Œ %s 編寫。 �ç”± %sã€%sã€%s〠%sã€%sã€%sã€%s〠%s å’Œ %s 等人編寫。 �ç”± %sã€%sã€%s〠%sã€%sã€%sã€%s〠%s å’Œ %s 編寫。 �ç”± %sã€%sã€%s〠%sã€%sã€%sã€%s〠和 %s 編寫。 �ç”± %sã€%sã€%s〠%sã€%sã€%s å’Œ %s 編寫。 �ç”± %sã€%sã€%s〠%sã€%s å’Œ %s 編寫。 �ç”± %sã€%sã€%s〠%s å’Œ %s 編寫。 �ç”± %sã€%sã€%s〠和 %s 編寫。 �ç”± %sã€%s å’Œ %s 編寫。 �ç”± %s 編寫。 �ç”± Mike Haertel åŠå…¶ä»–人撰寫而æˆï¼›è«‹è¦‹ <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>。�`�%2$s 的引數 %1$s 䏿˜Žç¢º�字元類別的語法為 [[:space:]], éž [:space:]�指定了互相è¡çªçš„é…å°é¸é …�å·²è¶…éŽ PCRE 的字數上é™�為 PCRE JIT 堆疊分é…記憶體時出ç¾éŒ¯èª¤�無法返回原本的工作目錄�無法設定檔案æè¿°ç¬¦è™Ÿçš„æ–‡å­—/äºŒé€²ä½æ¨¡å¼�輸入éŽé•·ç„¡æ³•計數�內部錯誤 (䏿‡‰è©²å‡ºç¾é€™å€‹éŒ¯èª¤)�%2$s 的引數 %1$s 無效�無效的字元類別�\{\} 的內容無效�無效的內容列數值�無效的é…å°é¸é … %s�無效的最大計次�記憶體用盡�沒有指定的語法�程å¼éŒ¯èª¤�æ­£è¦è¡¨ç¤ºå¼éŽé•·�堆疊超出容é‡�-P é¸é …åªæ”¯æ´å–®ä¸€æ¨£å¼�無法記錄ç¾è¡Œå·¥ä½œç›®éŒ„�ä¸å°ç¨±çš„ (�ä¸å°ç¨±çš„ )�ä¸å°ç¨±çš„ [�ä¸å®Œæ•´çš„ \ 逸出�æœªçŸ¥çš„äºŒé€²ä½æª”案類別�未知的è£ç½®æ–¹æ³•�警告:--unix-byte-offsets (-u) 已經廢棄�寫入發生錯誤�������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/de.po�����������������������������������������������������������������������0000664�0001750�0001750�00000060644�14670377450�016027� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Deutsche Übersetzungen für Meldungen von GNU grep. # Copyright © 1997-99, 2000, 2001, 2002 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Martin von Löwis <martin@mira.isdn.cs.tu-berlin.de>, 1997-99, 2000-2002. # Philipp Thomas <pth@suse.de>, 2012-2013, 2015-2016. # Mario Blättermann <mario.blaettermann@gmail.com>, 2014, 2019-2021. msgid "" msgstr "" "Project-Id-Version: GNU grep 3.5.16\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-01-27 18:27+0100\n" "Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n" "Language-Team: German <translation-team-de@lists.sourceforge.net>\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Lokalize 20.12.1\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "ungültiges Argument %s für %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "mehrdeutiges Argument %s für %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Gültige Argumente sind:" #: lib/c-stack.c:187 msgid "program error" msgstr "Programmfehler" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "Stack-Überlauf" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "Schreibfehler" # Is this message used only for [ without matching ], # or for ] without [ as well? #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ ohne schließendes Gegenstück" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "Ungültige Zeichenklasse" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "die Syntax für Zeichenklassen ist [[:space:]], nicht [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "unbeendete \\-Escape-Sequenz" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "Ungültiger Inhalt von \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "Der reguläre Ausdruck ist zu groß" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( ohne schließendes Gegenstück" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "es wurde keine Syntax angegeben" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "Schließende ) ohne öffnendes Gegenstück" #: lib/error.c:195 msgid "Unknown system error" msgstr "Unbekannter Systemfehler" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: Option „%s%s“ ist mehrdeutig\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: die Option „%s%s“ ist mehrdeutig; Mögliche Bedeutungen:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: unbekannte Option „%s%s“\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: Option „%s%s“ erlaubt kein Argument\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: Option „%s%s“ benötigt ein Argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: ungültige Option -- „%c“\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: Option erfordert ein Argument -- „%c“\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "Speicher ausgeschöpft" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "das aktuelle Verzeichnis kann nicht aufgezeichnet werden" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "die Rückkehr in das ursprüngliche Arbeitsverzeichnis war nicht möglich" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "Text-/Binärmodus des Dateideskriptors konnte nicht gesetzt werden" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "„" #: lib/quotearg.c:356 msgid "'" msgstr "“" #: lib/regcomp.c:135 msgid "Success" msgstr "Erfolg" #: lib/regcomp.c:138 msgid "No match" msgstr "Keine Übereinstimmung" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Ungültiger regulärer Ausdruck" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Ungültiges Suchzeichen" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Ungültiger Zeichenklassenname" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Rückschrägstrich am Ende" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Ungültige Rückwärtsreferenz" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Kein Gegenstück für [, [^, [:, [., oder [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Kein Gegenstück für ( oder \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Kein Gegenstück für \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Ungültiger Inhalt von \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Ungültiges Bereichsende" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Speicher ausgeschöpft" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Ungültiger vorhergehender regulärer Ausdruck" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Vorzeitiges Ende des regulären Ausdrucks" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Der reguläre Ausdruck ist zu groß" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Kein Gegenstück für ) oder \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Kein vorhergehender regulärer Ausdruck" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Gepackt von %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Gepackt von %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Lizenz GPLv3+: GNU GPL Version 3 oder neuer <%s>.\n" "Dies ist freie Software: Sie können sie ändern und weitergeben.\n" "Es gibt keinerlei Garantien, soweit gesetzlich zulässig.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Geschrieben von %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Geschrieben von %s und %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Geschrieben von %s, %s und %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Geschrieben von %s, %s, %s\n" "und %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Geschrieben von %s, %s, %s,\n" "%s und %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Geschrieben von %s, %s, %s,\n" "%s, %s und %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Geschrieben von %s, %s, %s,\n" "%s, %s, %s und %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Geschrieben von %s, %s, %s,\n" "%s, %s, %s, %s\n" "und %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Geschrieben von %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s und %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Geschrieben von %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s und anderen.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "" "Melden Sie Übersetzungsfehler an <translation-team-de@lists.sourceforge." "net>,\n" "Programmfehler dagegen (auf Englisch, mit LC_ALL=C) an %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Melden Sie Programmfehler für %s (auf Englisch, mit LC_ALL=C) an %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s Homepage: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Allgemeine Hilfe zur Benutzung von GNU-Software: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(Standardeingabe)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "ungültiges Argument für die Kontextlänge" #: src/grep.c:894 msgid "input is too large to count" msgstr "die Eingabe ist zu groß, um gezählt zu werden" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: Übereinstimmungen in Binärdatei" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: Warnung: rekursive Verzeichnisschleife" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: die Eingabedatei ist auch die Ausgabedatei" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Aufruf: %s [OPTION]… MUSTER [DATEI]…\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "„%s --help“ liefert weitere Informationen.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Nach MUSTER in jeder DATEI oder der Standardeingabe suchen.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Beispiel: %s -i 'Hallo Welt' menu.h main.c\n" "MUSTER kann mehrere durch Zeilenumbruch getrennte Muster enthalten.\n" "\n" "Auswahl und Interpretation von Mustern:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp MUSTER sind erweiterte reguläre Ausdrücke\n" " -F, --fixed-strings MUSTER sind Zeichenketten\n" " -G, --basic-regexp MUSTER sind reguläre Standardausdrücke\n" " -P, --perl-regexp MUSTER sind reguläre Ausdrücke, wie Perl\n" " sie akzeptiert\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=MUSTER MUSTER zur Treffersuche verwenden\n" " -f, --file=DATEI MUSTER aus DATEI lesen\n" " -i, --ignore-case Unterschied zwischen Groß- und Kleinschreibung\n" " ignorieren\n" " --no-ignore-case Festlegung zur Groß- oder Kleinschreibung\n" " nicht ignorieren\n" " -w, --word-regexp MUSTER passt nur auf ganze Wörter\n" " -x, --line-regexp MUSTER passt nur auf ganze Zeilen\n" " -z, --null-data Eine Zeile endet mit Nullbyte, nicht Newline\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Verschiedenes:\n" " -s, --no-messages Fehlermeldungen unterdrücken\n" " -v, --invert-match Nicht-passende Zeilen anzeigen\n" " -V, --version Versionsnummer ausgeben und beenden\n" " --help Diese Hilfe ausgeben und beenden\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Steuerung der Ausgabe:\n" " -m, --max-count=ANZAHL stoppt nach ANZAHL ausgewählter Zeilen\n" " -b, --byte-offset gibt mit den Zeilen auch den Abstand in Bytes " "an\n" " -n, --line-number gibt mit den Zeilen auch die Zeilennummer an\n" " --line-buffered leert den Puffer nach jeder Zeile\n" " -H, --with-filename gibt den Dateinamen für jede Übereinstimmung " "aus\n" " -h, --no-filename unterdrückt die Ausgabe des vorangehenden\n" " Dateinamens\n" " --label=BEZEICHNUNG verwendet BEZEICHNUNG als Präfix für Dateinamen\n" " der Standardeingabe\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching zeigt nur den nicht-leeren Teil einer Zeile,\n" " der zu MUSTER passt\n" " -q, --quiet, --silent unterdrückt alle normalen Ausgaben\n" " --binary-files=TYP alle binären Dateien sind vom Typ TYP;\n" " TYP kann „binary“, „text“ oder „without-match“\n" " sein\n" " -a, --text gleichbedeutend mit --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I gleichbedeutend mit --binary-files=without-" "match\n" " -d, --directories=AKTION beschreibt, wie Verzeichnisse zu behandeln " "sind;\n" " AKTION kann „read“, „recurse“ oder „skip“ " "sein\n" " -D, --devices=AKTION Behandlung von Geräten, FIFOs oder Sockets;\n" " AKTION kann „read“ oder „skip“ sein\n" " -r, --recursive wie --directories=recurse\n" " -R, --dereference-recursive\n" " ebenso, folgt aber allen symbolischen Links\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=DATEIMUSTER durchsucht nur Dateien, die DATEIMUSTER\n" " entsprechen\n" " --exclude=DATEIMUSTER überspringt Dateien, die\n" " DATEIMUSTER entsprechen\n" " --exclude-from=DATEI überspringt Dateien, die einem Dateimuster\n" " in DATEI entsprechen.\n" " --exclude-dir=MUSTER überspringt Verzeichnisse, die MUSTER\n" " entsprechen\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match nur die Namen von Dateien ausgeben, die keinen\n" " passenden Inhalt haben\n" " -l, --files-with-matches nur die Namen von Dateien mit passendem Inhalt\n" " ausgeben\n" " -c, --count nur die Anzahl der passenden Zeilen pro DATEI\n" " ausgeben\n" " -T, --initial-tab Tabulatoren (wenn nötig) ausrichten\n" " -Z, --null ein 0-Byte nach einem Dateinamen ausgeben\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Kontextsteuerung:\n" " -B, --before-context=ANZAHL ANZAHL Zeilen vorausgehenden Kontextes\n" " ausgeben\n" " -A, --after-context=ANZAHL ANZAHL Zeilen nachfolgenden Kontextes\n" " ausgeben\n" " -C, --context=ANZAHL ANZAHL Zeilen Kontext ausgeben\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -ANZAHL Wie --context=ANZAHL\n" " --color[=WANN], \n" " --colour=[WANN] Passende Textfragmente markieren\n" " WANN kann „always“, „never“ oder „auto“ sein\n" " -U, --binary CR-Zeichen am Zeilenende belassen\n" " (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Wenn DATEI „-“ ist, wird die Standardeingabe gelesen. Ohne DATEI wird „.“\n" "gelesen, wenn -r auf der Befehlszeile angegeben wurde, ansonsten „-“.\n" "Wenn weniger als zwei DATEIen angegeben wurden, wird -h angenommen.\n" "Der Rückgabewert ist 0, wenn eine Zeile passte, ansonsten 1. Wenn ein\n" "Fehler auftrat und -q nicht angegeben wurde, ist der Rückgabewert 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "die angegebenen Suchmuster stehen in Konflikt zueinander" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Perl-basierte Treffersuche wurde in dieses --disable-perl-regexp-Binary " "nicht einkompiliert" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "ungültige Entsprechung %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "Unbekannte Methode für Gerätedateien" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "ungültige Maximalanzahl" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "unbekannter Typ für Binärdateien" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Geschrieben von Mike Haertel und anderen; siehe\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "es konnte kein Speicher für den PCRE-JIT-Stack reserviert werden" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P unterstützt nur Unibyte- oder UTF-8-Locales" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "Die Option -P unterstützt nur ein einzelnes Suchmuster" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "Interner Fehler (sollte nie vorkommen)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "Überschreitung der zulässigen Zeilenlänge von PCREs" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: Speicher ausgeschöpft" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: Kellerspeicher für PCRE JIT ist erschöpft" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: Überschreitung der Zurückverfolgungsbeschränkung des PCREs" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: Überschreitung der Rekursionsbeschränkung des PCREs" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: interner PCRE-Fehler: %d" ��������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/sk.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000041420�14670377471�016212� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��£��#��ß���ª$����Š%��(��œ&��h��Å(����.*��V��A+��|��˜-��Õ��/��ï��ë0��„��Û2�����`4�����}4��)���›4��$���Å4��#���ê4��3���5�����B5�����`5�����|5��-���™5��)���Ç5��4���ñ5��)���&6��$���P6��$���u6��1���š6�����Ì6�����Ð6�����Ô6��(���é6��‘���7��7���¤7�����Ü7�����õ7�����8�����+8��&���@8�����g8�����€8��Ð���œ8�����m9�����†9��$���˜9�����½9�����Ñ9��M���ê9��%���8:��%���^:��#���„:�����¨:��"���À:�����ã:�����÷:��9���;�����I;�����d;�����;��'���›;�����Ã;��,���Ö;�����<��F��<�����a=��5���u=��/���«=��+���Û=��'���>��#���/>�����S>�����s>�����>�� ���§>��V���µ>����� ?��"���?��2���3?��(���f?��&���?��3���¶?��8���ê?��C���#@��1���g@��)���™@�����Ã@�����à@�����ø@��#��� A�����1A�����NA�����jA�����ƒA�����•A��%���¤A�����ÊA��$���âA��,���B�����4B�����FB�����XB��"���jB�����B�����­B��8���ÉB�� ���C����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 17:38+0200 Last-Translator: Ladislav MichnoviÄ <ladislav.michnovic@gmail.com> Language-Team: Slovak <sk-i18n@lists.linux.sk> Language: sk MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Poedit 2.4.1 � Riadenie kontextu: -B, --before-context=POÄŒ vytlaÄiÅ¥ POÄŒ riadkov kontextu pred -A, --after-context=POÄŒ vytlaÄiÅ¥ POÄŒ riadkov kontextu za -C, --context=POÄŒ vytlaÄiÅ¥ POÄŒ riadkov kontextu výstupu � RozliÄné: -s, --no-messages potlaÄiÅ¥ chybové správy -v, --invert-match vybraÅ¥ riadky, ktoré nemajú zhodu -V, --version vypísaÅ¥ informácie o verzii a skonÄiÅ¥ --help zobraziÅ¥ tieto informácie a skonÄiÅ¥ � Riadenie výstupu: -m, --max-count=POÄŒ zastaviÅ¥ po POÄŒ zhodách -b, --byte-offset vypísaÅ¥ pri výstupných riadkoch ofset v bajtoch -n, --line-number vypísaÅ¥ pri výstupných riadkoch Äíslo riadka --line-buffered vypisovaÅ¥ (flush) výstup po každom riadku -H, --with-filename vypísaÅ¥ názov súboru pri každej zhode -h, --no-filename potlaÄiÅ¥ názov súboru ako predponu vo výstupe --label=NÃVESTIE použiÅ¥ NÃVESTIE ako predponu názvu súboru pre Å¡tand. vstup � --include=VZOR_SÚBORU hľadaÅ¥ iba v súboroch zodpovedajúcich VZOR_SÚBORU --exclude=VZOR_SÚBORU preskoÄiÅ¥ súbory a adresáre zodpovedajúce VZOR_SÚBORU --exclude-from=SÚBOR preskoÄiÅ¥ súbory zodpovedajúce akémukoľvek vzoru súboru zo SÚBOR --exclude-dir=VZOR preskoÄiÅ¥ adresáre, ktoré zodpovedajú VZORu � -E, --extended-regexp VZOR je rozšírený regular expression (ERE) -F, --fixed-strings VZOR je množina pevných reÅ¥azcov -G, --basic-regexp VZOR je základný regulárny výraz (BRE) -P, --perl-regexp VZOR je perlovský regulárny výraz � -I ekvivalentné s --binary-files=without-match -d, --directories=OPERÃCIA ako pracovaÅ¥ s adresármi; kde OPERÃCIA je „read“ (ÄítaÅ¥), „recurse“ (prechádzaÅ¥) alebo „skip“ (preskoÄiÅ¥) -D, --devices=OPERÃCIA ako pracovaÅ¥ so zariadeniami, FIFO a socketmi; OPERÃCIA je „read“ (ÄítaÅ¥) alebo „skip“ (preskoÄiÅ¥) -r, --recursive ekvivalentné s --directories=recurse -R, --dereference-recursive podobné, ale nasleduje symbolické odkazy � -L, --files-without-match vypísaÅ¥ iba názvy SÚBORov neobsahujúce zhodu -l, --files-with-matches vypísaÅ¥ iba názvy SÚBORov obsahujúce zhodu -c, --count vypísaÅ¥ iba poÄet riadkov obsahujúcich zhodu v SÚBORe -T, --initial-tab zarovnávaÅ¥ tabulátory (ak je to potrebné) -Z, --null vypísaÅ¥ za názvom SÚBORu bajt 0 � -NUM rovnaké ako --context=NUM --group-separator=SEP vypíš oddeľovaÄ SEP na riadok medzi zhodami s kontextom --no-group-separator nevypisuj oddeľovaÄ pre zhody s kontextom --color[=KEDY], --colour[=KEDY] použiÅ¥ zvýrazňovanie zodpovedajúcich reÅ¥azcov; KEDY zvoľte „always“, „never“ alebo „auto“ -U, --binary neodstraňovaÅ¥ znak CR na konci riadka (MSDOS/Windows) � -e, --regexp=VZOR použiÅ¥ na hľadanie zhody VZOR -f, --file=SÚBOR získaÅ¥ VZOR zo SÚBORu -i, --ignore-case ignorovaÅ¥ rozdiely vo veľkosti písmen --no-ignore-case neignorovaÅ¥ rozdiely vo veľkosti písmen (predvolené) -w, --word-regexp vynútiÅ¥, aby VZOR zodpovedal len celým slovám -x, --line-regexp vynútiÅ¥, aby VZOR zodpovedal len celým riadkom -z, --null-data údaje konÄia bajtom 0, nie novým riadkom � -o, --only-matching zobrazovaÅ¥ iba neprázdne Äasti riadkov, ktoré zodpovedajú -q, --quiet, --silent potlaÄiÅ¥ vÅ¡etok bežný výstup --binary-files=TYP predpokladaÅ¥, že typ binárnych súborov je TYP; TYP zvoľte „binary“, „text“ alebo „without-match“ -a, --text ekvivalentné s --binary-files=text �Domovská stránka %s: <%s> �%s: zhoda v binárnom súbore�%s: prekroÄený limit backtrackingu PCRE�%s: prekroÄený limit rekurzie PCRE�%s: vyÄerpaný zásobník PCRE JIT�vstupný súbor %s je tiež uvedený ako výstupný�%s: vnútorná chyba PCRE: %d�%s: neplatná voľba -- %c �%s: pamäť bola vyÄerpaná�%s: voľba „%s%s“ nepripúšťa argument �%s: voľba „%s%s“ je nejednoznaÄná �%s: voľba „%s%s“ je nejednoznaÄná; možnosti:�%s: voľba „%s%s“ vyžaduje argument �%s: voľba vyžaduje argument -- %c �%s: nerozpoznaná voľba „%s%s“ �%s: upozornenie: rekurzívna adresárová sluÄka�“�(C)�(Å¡tandardný vstup)�-P podporuje iba unibyte a UTF-8 locales�Príklad: %s -i 'hello world' menu.h main.c VZORY môžu obsahovaÅ¥ niekoľko vzorov oddelených odriadkovaním. Výber a interpretácia vzoru: �VÅ¡eobecná pomoc pri používaní softvéru GNU: <%s> �Neplatný spätný odkaz�Neplatný názov triedy znakov�Neplatný radiaci znak�Neplatný obsah \{\}�Neplatný predoÅ¡lý regulárny výraz�Neplatný koniec rozsahu�Neplatný regulárny výraz�Licencia GPLv3+: GNU GPL verzie 3 alebo neskorÅ¡ej <%s> Toto je slobodný softvér: môžete ho slobodne meniÅ¥ a šíriÅ¥. Nie je poskytovaná ŽIADNA ZÃRUKA do miery akú povoľuje aplikovateľné právo. �Pamäť bola vyÄerpaná�NiÄ nezodpovedá�Žiadny predoÅ¡lý regulárny výraz�Balík vytvoril %s �Balík vytvoril %s (%s) �Podpora Perlu nebola zakompilovaná do tejto binárky s --disable-perl-regexp�Neplatný koniec regulárneho výrazu�Regulárny výraz je príliÅ¡ veľký�Chyby programu %s oznamujte na: %s �Chyby oznamujte na: %s �HľadaÅ¥ VZORY v každom SÚBORE. �ÚspeÅ¡ne vykonané�Spätná lomka na konci�ÄŽalÅ¡ie informácie získate príkazom „%s --help“. �Neznáma systémová chyba�( alebo \( bez náprotivku�) alebo \) bez náprotivku.�[, [^, [:, [., alebo [= bez náprotivku�\{ bez náprotivku�Použitie: %s [VOĽBA]... VZORY [SÚBOR]... �Platné argumentu sú:�Ak SÚBOR je -, Äíta sa zo Å¡tandardného vstupu. Bez SÚBORU Äíta sa . ak je rekurzia, v opaÄnom prípade -. Ak sú zadané menej ako dva SÚBORY predpokladá sa -h. Výstupný chybový kód je 0 ak bol vybraný nejaký riadok,inak je 1; ak sa vyskytne nejaká chyba a nebolo zadané -q, výstupný chybový kód je 2. �Napísali %s a %s. �Napísali %s, %s, %s, %s, %s, %s, %s, %s, %s a iní. �Napísali %s, %s, %s, %s, %s, %s, %s, %s a %s. �Napísali %s, %s, %s, %s, %s, %s, %s a %s. �Napísali %s, %s, %s, %s, %s, %s a %s. �Napísali %s, %s, %s, %s, %s a %s. �Napísali %s, %s, %s, %s a %s. �Napísali %s, %s, %s a %s. �Napísali %s, %s a %s. �Napísal %s. �Napísal Mike Haertel iní; pozri <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�„�nejednoznaÄný argument %s pre %s�syntax triedy znakov je [[:space:]], nie [:space:]�boli zadané konfliktné Å¡pecifikátory�prekroÄený limit dĺžky riadka PCRE�chyba pri alokácii pamäte pre zásobník PCRE JIT�zlyhalo navrátenie do pôvodného aktuálneho adresára�zlyhalo nastaviÅ¥ deskriptor súboru do textového/binárneho módu�vstup je príliÅ¡ veľký, aby sa dal spoÄítaÅ¥�vnutorná chyba (nemalo by nikdy nastaÅ¥)�neplatný argument %s pre %s�neplatná trieda znakov�neplatný obsah \{\}�neplatný argument dĺžky kontextu�neplatný zástupný znak %s�neplatný maximálny poÄet�pamäť bola vyÄerpaná�neuvedená syntax�chyba programu�regulárny výraz je príliÅ¡ veľký�preteÄenie zásobníka�voľba -P podporuje iba jediný vzor�nepodarilo sa zaznamenaÅ¥ aktuálny adresár�( bez náprotivku�) bez náprotivku�[ bez náprotivku�nedokonÄená úniková klauzula \�neznámy typ binárneho súboru�neznáme metódy zariadení�Upozornenie: --unix-byte-offsets (-u) sa už nepoužíva�chyba zápisu�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/eu.po�����������������������������������������������������������������������0000664�0001750�0001750�00000060710�14670377450�016042� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Basque translation of grep. # Copyright (C) 2004 Free Software Foundation, Inc. # Mikel Olasagasti <hey_neken@mundurat.net>, 2004, 2005. # , fuzzy # # msgid "" msgstr "" "Project-Id-Version: grep 2.5.1a\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2005-03-03 21:40+0100\n" "Last-Translator: Mikel Olasagasti <hey_neken@mundurat.net>\n" "Language-Team: Basque <translation-team-eu@lists.sourceforge.net>\n" "Language: eu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=2; plural=(n == 1)\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "" #: lib/dfa.c:896 #, fuzzy msgid "unbalanced [" msgstr "Parekatu gabeko [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" #: lib/dfa.c:1210 #, fuzzy msgid "unfinished \\ escape" msgstr "Amaitu gabeko \\ eskapea" #: lib/dfa.c:1371 #, fuzzy msgid "invalid content of \\{\\}" msgstr "baliogabeko gehienezko zenbaketa" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "" #: lib/dfa.c:1858 #, fuzzy msgid "unbalanced (" msgstr "Parekatu gabeko (" #: lib/dfa.c:1975 #, fuzzy msgid "no syntax specified" msgstr "Ez da sintaxirik zehaztu" #: lib/dfa.c:1986 #, fuzzy msgid "unbalanced )" msgstr "Parekatu gabeko )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Sistemaren errore ezezaguna" #: lib/getopt.c:278 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: `%s' aukera anbiguoa da\n" #: lib/getopt.c:284 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: `%s' aukera anbiguoa da\n" #: lib/getopt.c:319 #, fuzzy, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: aukera ezezaguna `%c%s'\n" #: lib/getopt.c:345 #, fuzzy, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: `%c%s' aukerak ez du argumenturik onartzen\n" #: lib/getopt.c:360 #, fuzzy, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: `%s' aukerak argumentu bat behar du\n" #: lib/getopt.c:621 #, fuzzy, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: balio gabeko aukera -- %c\n" #: lib/getopt.c:636 lib/getopt.c:682 #, fuzzy, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: aukerak argumentu bat behar du -- %c\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "memoria agortuta" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "" #: lib/regcomp.c:138 msgid "No match" msgstr "" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Memoria agortuta" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "Programa-erroreen berri emateko idatzi hona <bug-grep@gnu.org>.\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "" #: src/grep.c:649 msgid "(standard input)" msgstr "(sarrera estandarra)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "balio gabeko testuinguru luzeera argumentua" #: src/grep.c:894 msgid "input is too large to count" msgstr "sarrera luzeegia da kontatzeko" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "%s fitxategi binarioa bat dator\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "direktorio bukle errekurtsiboa" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Erabilera: %s [AUKERA]... EREDUA [FITXATEGIA]...\n" #: src/grep.c:1963 #, fuzzy, c-format msgid "Try '%s --help' for more information.\n" msgstr "Saiatu `%s --help' informazio gehiagorako.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "EREDUA bilatzen du FITXATEGI bakoitzean edo sarrera estandarrean.\n" "Adibidez: %s -i 'kaixo mundu' menu.h main.c\n" "\n" "Regexp aukera eta interpretazioa:\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp EREDUA espresio erregular zabaldu bat da\n" " -F, --fixed-strings EREDUA lerro berri batekin banatutako kate " "multzo bat da\n" " -G, --basic-regexp EREDUA oinarrizko espresio erregular bat da\n" " -P, --perl-regexp EREDUA Perl espresio erregular bat da\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=EREDUA erabili EREDUA espresio erregular bezala\n" " -f, --file=FITXATEGIA lortu EREDUA FITXATEGITIK\n" " -i, --ignore-case ez ezberdindu letra larri eta xeheak\n" " -w, --word-regexp behartu EREDUA hitz osoekin bakarrik bat " "etortzea\n" " -x, --line-regexp behartu EREDUA lerro osoekin bakarrik bat " "etortzea\n" " -z, --null-data datu lerroa 0 byte-arekin amaitzen da, eta ez " "lerro berriarekin\n" #: src/grep.c:1989 #, fuzzy, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Hainbat:\n" " -s, --no-messages errore mezuak kentzen ditu\n" " -v, --invert-match bat ez datozen lerroak aukeratzen ditu\n" " -V, --version bertsioaren informazioa inprimatu eta irten\n" " --help laguntza hau erakutsi eta irten\n" " --mmap erabili asignatutako memoria sarrera posible " "bada\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" "\n" "Kontestu kontrola:\n" " -B, --before-context=KOPURUA inprimatu kontestuaren aurretiko lerro " "KOPURUA\n" " -A, --after-context=KOPURUA inprimatu kontestuaren ondorengo lerro " "KOPURUA\n" " -C, --context=KOPURUA inprimatu kontestuaren lerro KOPURUA\n" " -KOPURUA --context=KOPURUA bezala\n" " --color[=NOIZ],\n" " --colour[=NOIZ] erabili markak bat datozen kateak ezberdintzeko\n" " NOIZ `always', `never' edo `auto' izan daiteke.\n" " -U, --binary ez kendu CR karaktereak lerro bukaeran (MSDOS)\n" " -u, --unix-byte-offsets hartu kontutan offsetak CRak bertan egongo ez " "balira bezala (MSDOS)\n" "\n" "`egrep'-ek`grep -E' esan nahi du. `fgrep'-ek `grep -F' esan nahi du.\n" "Fitxategirik gabe, edo FITXATEGIA - denean, sarrera estandarra irakurtzen " "da. BI fitxategi\n" "baina gutxiago ematen badira, -h ulertzen da. Irteera egoera 0 da bat " "badator, 1 ez badator,\n" "eta 2 arazorik badago.\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "espresio konfliktiboak espezifikatu dira" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" #: src/grep.c:2103 #, fuzzy, c-format msgid "invalid matcher %s" msgstr "baliogabeko gehienezko zenbaketa" #: src/grep.c:2538 msgid "unknown devices method" msgstr "gailu metodo ezezaguna" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "baliogabeko gehienezko zenbaketa" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "fitxategi-binario moeta ezezaguna" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 #, fuzzy msgid "the -P option only supports a single pattern" msgstr "-P aukerak ez du euskarririk" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "memoria agortuta" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "" #, fuzzy, c-format #~ msgid "warning: %s: %s" #~ msgstr "abisua: %s: %s\n" #, fuzzy #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: `--%s' aukerak ez du argumenturik onartzen\n" #, fuzzy #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: aukera ezezaguna `--%s'\n" #, fuzzy #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: `-W %s' aukera ambiguoa da\n" #, fuzzy #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: `-W %s' aukerak ez du argumenturik onartzen\n" #, fuzzy #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: `%s' aukerak argumentu bat behar du\n" #~ msgid "unfinished repeat count" #~ msgstr "amaitu gabeko errepikapen zenbatzailea" #~ msgid "malformed repeat count" #~ msgstr "gaizki eratutako errepikapen zenbatzailea" #~ msgid "out of memory" #~ msgstr "memoriatik kanpo" #~ msgid "writing output" #~ msgstr "irteera idazten" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Erabilera: %s [AUKERA]... EREDUA [FITXATEGIA] ...\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Irteera kontrola:\n" #~ " -m, --max-count=KOPURUA gelditu KOPURUA bilatzean\n" #~ " -b, --byte-offset inprimatu offset byte-a lerro irteerekin\n" #~ " -n, --line-number inprimatu lerro zenbakia lerro irteerekin\n" #~ " --line-buffered irauli irteera lerro bakoitzean\n" #~ " -H, --with-filename inprimatu fitxategi-izena bat datorren " #~ "aurkiketa bakoitzean\n" #~ " -h, --no-filename fitxategi-izena kendu irteeran\n" #~ " --label=ETIKETA inprimatu ETIKETA fitxategi-izen bezala " #~ "sarrera estandarrean\n" #~ " -o, --only-matching erakutsi EREDUAREKIN bat datorren lerroaren " #~ "zatia bakarrik\n" #~ " -q, --quiet, --silent kendu irteera normal guztiak\n" #~ " --binary-files=MOETA fitxategi binarioak MOETA bezala direlakoan " #~ "hartu\n" #~ " MOETA 'binary', 'text', edo 'without-match' " #~ "izan daiteke\n" #~ " -a, --text --binary-files=text bezala\n" #~ " -I --binary-files=without-match bezala\n" #~ " -d, --directories=EKINTZA nola erabili direktorioak\n" #~ " EKINTZA 'read', 'recurse', edo 'skip' izan " #~ "daiteke\n" #~ " -D, --devices=EKINTZA nola erabili gailuak, FIFO eta socketak\n" #~ " EKINTZA 'read' edo 'skip' izan daiteke\n" #~ " -R, -r, --recursive --directories=recurse bezala\n" #~ " --include=EREDUA EREDUAREKIN bat datozen fitxategiak aztertu\n" #~ " --exclude=EREDUA EREDUAREKIN bat datozen fitxategiak utzi.\n" #~ " --exclude-from=FITXATEGIA EREDUA betetzen duten fitxategiak " #~ "FITXATEGIAN utzi.\n" #~ " -L, --files-without-match inprimatu bateraketarik ez duten FITXATEGIAK " #~ "bakarrik\n" #~ " -l, --files-with-matches inprimatu bateraketaren bat duten FITXATEGIAK " #~ "bakarrik\n" #~ " -c, --count inprimatu bateraketa kopurua FITXATEGI " #~ "bakoitzeko bakarrik\n" #~ " -Z, --null inprimatu 0 byte-a FITXATEGIAREN izenaren " #~ "ondoren\n" #~ msgid "unknown directories method" #~ msgstr "direktorio metodo ezezaguna" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Software librea da, ikusi programa-kodea kopiatzeko baldintzentzat. EZ " #~ "dago inolako bermerik;\n" #~ "ez KOMERTZIO ez ASMO ZEHATZ BATEN EGOKITASUNERAKO.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "-P eta -z aukerak ezin dira konbinatu" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: ezinezko aukera -- %c\n" ��������������������������������������������������������kbuild-3608/src/grep/po/ky.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000002756�14670377450�016226� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•���� ������„������ì�������0�����1�����3�����D�����U�����j�����l�����‹�����§�����Ç�����Ù�����ê�������ì������������ ��$���(��,���M�����z��H���|��[���Å��2���!��(���T��$���}��"���¢��(���Å�������� �������������������� ������� ������ ��� ��������������'�(standard input)�Memory exhausted�Unknown system error�`�conflicting matchers specified�input is too large to count�invalid context length argument�invalid max count�memory exhausted�unknown binary-files type�unknown devices method�Project-Id-Version: grep 2.5.3 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2007-09-01 17:27+0100 Last-Translator: Azilet Beishenaliev <aziletb@gmail.com> Language-Team: Kirghiz <i18n-team-ky-kyrgyz@lists.sourceforge.net> Language: ky MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=1; plural=0; X-Poedit-Language: Kyrgyz X-Poedit-Country: KYRGYZSTAN �"�(Ñтандарт кирүү)�ПамÑть жетпей калды�БелгиÑиз ÑиÑтема катаÑÑ‹�"�уйкаштыруучуларда конфликттер табылды�берилген данныйлардын Ñаны Ñаналбай турганча көп�контекÑÑ‚ узундугу жарабайт�макÑимум Ñан жарабайт�памÑть жетпей калды�белгиÑиз файл түрү�аÑпап методу белгиÑиз�������������������kbuild-3608/src/grep/po/es.po�����������������������������������������������������������������������0000664�0001750�0001750�00000074507�14670377450�016051� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Mensajes en español para GNU grep. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Enrique Melero Gómez <melero@eurolands.com>, 1996. # Santiago Vila Doncel <sanvila@unex.es>, 1997-2002, 2010, 2011, 2013, 2014. # msgid "" msgstr "" "Project-Id-Version: GNU grep 2.19.12\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2014-07-11 18:53+0200\n" "Last-Translator: Santiago Vila Doncel <sanvila@unex.es>\n" "Language-Team: Spanish <es@tp.org.es>\n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8-bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "argumento %s inválido %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "argumento %s ambiguo para %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Los argumentos válidos son:" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "error de escritura" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ desemparejado" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "clase de caracteres inválida" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "la sintaxis de la clase de caracteres es [[:space:]], no [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "secuencia de escape \\ sin terminar" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "contenido inválido de \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "la expresión regular es demasiado grande" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( desemparejado" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "no se ha especificado ninguna sintaxis" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") desemparejado" #: lib/error.c:195 msgid "Unknown system error" msgstr "Error del sistema desconocido" #: lib/getopt.c:278 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: la opción '-W %s' es ambigua\n" #: lib/getopt.c:284 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: la opción '%s' es ambigua; posibilidades:" #: lib/getopt.c:319 #, fuzzy, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: opción no reconocida '%c%s'\n" #: lib/getopt.c:345 #, fuzzy, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: la opción '%c%s' no admite ningún argumento\n" #: lib/getopt.c:360 #, fuzzy, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: la opción '--%s' requiere un argumento\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: opción inválida -- '%c'\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: la opción requiere un argumento -- '%c'\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "memoria agotada" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "no se puede registrar el directorio de trabajo actual" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "fallo al volver al directorio de trabajo inicial" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "«" #: lib/quotearg.c:356 msgid "'" msgstr "»" #: lib/regcomp.c:135 msgid "Success" msgstr "Éxito" #: lib/regcomp.c:138 msgid "No match" msgstr "No hay ninguna coincidencia" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Expresión regular inválida" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Carácter de unión inválido" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Nombre de clase de caracteres inválido" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Barra invertida al final" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Referencia hacia atrás inválida" #: lib/regcomp.c:156 #, fuzzy msgid "Unmatched [, [^, [:, [., or [=" msgstr "[ o [^ desemparejado" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "( o \\( desemparejado" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "\\{ desemparejado" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Contenido inválido de \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Final de rango inválido" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Memoria agotada" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "La expresión regular precedente es inválida" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Final prematuro de la expresión regular" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "La expresión regular es demasiado grande" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr ") o \\) desemparejado" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "No hay ninguna expresión regular anterior" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Empaquetado por %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Empaquetado por %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, fuzzy, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "\n" "Licencia GPLv3+: GPL de GNU versión 3 o posterior\n" "<http://gnu.org/licenses/gpl.html>\n" "Esto es software libre: usted es libre de cambiarlo y redistribuirlo.\n" "No hay NINGUNA GARANTÃA, hasta donde permite la ley.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Escrito por %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Escrito por %s y %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Escrito por %s, %s, y %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "y %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, y %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, y %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, y %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s,\n" "y %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, y %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Escrito por %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, y otros.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "Comunicar errores en el programa a: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Comunicar errores sobre %s a: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Página inicial de %s: <%s>\n" #: lib/version-etc.c:260 #, fuzzy, c-format msgid "General help using GNU software: <%s>\n" msgstr "" "Ayuda general sobre el uso de software de GNU: <http://www.gnu.org/gethelp/" ">\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(entrada estándar)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "longitud de contexto inválida" #: src/grep.c:894 msgid "input is too large to count" msgstr "la entrada es demasiado grande para contar" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Coincidencia en el fichero binario %s\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "bucle de directorio recursivo" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "el fichero de entrada %s también es el de salida" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Modo de empleo: %s [OPCIÓN]... PATRÓN [FICHERO]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Pruebe '%s --help' para más información.\n" #: src/grep.c:1969 #, fuzzy, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Busca PATRÓN en cada FICHERO o en la entrada estándar.\n" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Ejemplo: %s -i 'hello world' menu.h main.c\n" "\n" "Selección e interpretación de Expreg:\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp PATRÓN es una expresión regular extendida (ERE)\n" " -F, --fixed-strings PATRÓN es un conjunto de cadenas separadas por\n" " caracteres de nueva línea\n" " -G, --basic-regexp PATRÓN es una expresión regular básica (BRE)\n" " -P, --perl-regexp PATRÓN es una expresión regular en Perl\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=PATRÓN utiliza PATRÓN como expresión regular\n" " -f, --file=FICHERO obtiene PATRÓN de FICHERO\n" " -i, --ignore-case considera iguales mayúsculas y minúsculas\n" " -w, --word-regexp obliga a que PATRÓN coincida solamente\n" " con palabras completas\n" " -x, --line-regexp obliga a que PATRÓN coincida solamente\n" " con líneas completas\n" " -z, --null-data una línea de datos termina en un byte 0, no\n" " en un carácter de nueva línea\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Variadas:\n" " -s, --no-messages suprime los mensajes de error\n" " -v, --invert-match selecciona las líneas que no coinciden\n" " -V, --version muestra la versión y finaliza\n" " --help muestra este texto de ayuda y finaliza\n" #: src/grep.c:1996 #, fuzzy, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Control del resultado:\n" " -m, --max-count=NÚM se detiene después de NÚM coincidencias\n" " -b, --byte-offset muestra el desplazamiento en bytes junto\n" " con las líneas de salida\n" " -n, --line-number muestra el número de línea junto con\n" " las líneas de salida\n" " --line-buffered descarga el resultado para cada línea\n" " -H, --with-filename muestra el nombre del fichero para cada\n" " coincidencia\n" " -h, --no-filename suprime los nombres de los ficheros como " "prefijo\n" " en el resultado\n" " --label=ETIQUETA utiliza ETIQUETA como nombre de fichero prefijo\n" " para la entrada estándar\n" #: src/grep.c:2007 #, fuzzy, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching muestra solamente la parte de una línea que\n" " encaja con PATRÓN\n" " -q, --quiet, --silent suprime todo el resultado normal\n" " --binary-files=TIPO supone que los ficheros binarios son TIPO\n" " TIPO es 'binary', 'text', o 'without-match'\n" " -a, --text equivalente a --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I equivalente a --binary-files=without-match\n" " -d, --directories=ACCIÓN especifica cómo manejar los directorios\n" " ACCIÓN es 'read', 'recurse', o 'skip'\n" " -D, --devices=ACCIÓN especifica cómo manejar dispositivos, FIFOs y\n" " `sockets', puede ser 'read' o 'skip'\n" " -r, --recursive equivalente a --directories=recurse\n" " -R, --dereference-recursive similar, pero sigue todos los enlaces " "simbólicos\n" #: src/grep.c:2023 #, fuzzy, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=PATRÓN examina los ficheros que encajan con PATRÓN\n" " --exclude=PATRÓN se salta los ficheros que encajan con PATRÓN\n" " --exclude-from=FICHERO se salta los ficheros que encajan con los " "patrones\n" " de FICHERO\n" " --exclude-dir=PATRÓN se salta los directorios que encajan con PATRÓN\n" #: src/grep.c:2030 #, fuzzy, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match muestra solamente los nombres de FICHEROs\n" " que no contienen ninguna coincidencia\n" " -l, --files-with-matches muestra solamente los nombres de FICHEROs\n" " que contienen alguna coincidencia\n" " -c, --count muestra solamente el total de líneas que " "coinciden\n" " por cada FICHERO\n" " -Z, --null imprime un byte 0 después del nombre del " "FICHERO\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Control del contexto:\n" " -B, --before-context=NÚM muestra NÚM líneas de contexto anterior\n" " -A, --after-context=NÚM muestra NÚM líneas de contexto posterior\n" " -C, --context=NÚM muestra NÚM líneas de contexto\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NÚM lo mismo que --context=NÚM\n" " --color[=CUÃNDO],\n" " --colour[=CUÃNDO] distingue con marcadores la cadena que encaja\n" " CUÃNDO puede ser 'always', 'never' o 'auto'.\n" " -U, --binary no elimina los caracteres de retorno de carro\n" " finales de línea (MSDOS/Windows)\n" " -u, --unix-byte-offsets cuenta los desplazamientos como si no hubiera\n" " retornos de carro (MSDOS/Windows)\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Cuando FICHERO es -, lee la entrada estándar. Si no se especifica\n" "ningún FICHERO, lee . si se especifica -r en la línea de órdenes, o -\n" "en caso contrario. Si se dan menos de dos FICHEROs, se supone -h. El\n" "estado de salida es 0 si hay coincidencias, 1 si no las hay; si ocurre\n" "algún error y no se especificó -q, el estado de salida es 2.\n" # viendo los fuentes , hay varias opciones # que hay sin documentar. O quizá es que getopt() lo he entendido mal # Son las opciones X ( requiere argumento ) , switchs -c, -b, -L e -y # grep.c:622 -> # opt = getopt(argc, argv, "0123456789A:B:CEFGVX:bce:f:hiLlnqsvwxy" # grep --help -> # usage: grep [-[[AB] ]<num>] [-[CEFGVchilnqsvwx]] [-[ef]] <expr> [<files...>] # La opción -X es a la que corresponde esta línea. # # No me gusta nada lo de opción "a buscar". # Se admiten sugerencias. sv #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "se han especificado expresiones conflictivas" #: src/grep.c:2101 #, fuzzy msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "el soporte para la opción -P no está compilado en este ejecutable --disable-" "perl-regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "expresión inválida %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "método de dispositivos desconocido" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "contador máximo inválido" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "tipo binary-files desconocido" #: src/grep.c:2829 #, fuzzy msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "otros, véase <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "fallo al asignar memoria para la pila JIT de PCRE" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "la opción -P solamente admite un patrón" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "error interno (no debería ocurrir nunca)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "se ha excedido el límite de longitud de línea de las PCREs" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "memoria agotada" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, fuzzy, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "se ha excedido el límite de vuelta atrás de las PCREs" #: src/pcresearch.c:319 #, fuzzy, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "se ha excedido el límite de vuelta atrás de las PCREs" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "error interno de PCRE: %d" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "atención: %s: %s" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "argumento %s%s inválido '%s'" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "sufijo inválido en el argumento %s%s '%s'" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s argumento '%s' demasiado grande" #, fuzzy #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "página inicial de %s: <http://www.gnu.org/software/%s/>\n" #~ msgid "internal error" #~ msgstr "error interno" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: la opción '--%s' no admite ningún argumento\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: opción no reconocida '--%s'\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: la opción '-W %s' es ambigua\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: la opción '-W %s' no admite ningún argumento\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: la opción '-W %s' requiere un argumento\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "PATRÓN es, por omisión, una expresión regular básica (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "'egrep' significa 'grep -E'. 'fgrep' significa 'grep -F'.\n" #~ "La invocación directa como 'egrep' o 'fgrep' está obsoleta.\n" #~ msgid "lseek failed" #~ msgstr "falló la llamada al sistema `lskeek'" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Página inicial de GNU grep: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "secuencia de bytes UTF-8 inválida en la entrada" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "PATRÓN es una expresión regular extendida (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "" #~ "La invocación como 'egrep' está obsoleta; utilice 'grep -E' en su lugar.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "PATRÓN es un conjunto de cadenas fijas separadas por nueva línea\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "" #~ "La invocación como 'fgrep' está obsoleta; utilice 'grep -F' en su lugar.\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s solamente puede usar la sintaxis de patrón %s" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "la opcion --mmap no hace nada desde 2010" #~ msgid "unfinished repeat count" #~ msgstr "contador de repetición sin terminar" #~ msgid "malformed repeat count" #~ msgstr "contador de repetición erróneo" #~ msgid "writing output" #~ msgstr "escribiendo el resultado" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "en GREP_COLORS=\"%s\", la capacidad \"%s\" necesita un valor (\"=...\"); " #~ "saltado." #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "en GREP_COLORS=\"%s\", la capacidad \"%s\" es booleana y no puede tener " #~ "un valor (\"=%s\"); saltado." #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "en GREP_COLORS=\"%s\", la capacidad \"%s\" %s." #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "el proceso del erróneo GREP_COLORS=\"%s\" se detuvo en la subcadena \"%s" #~ "\"." # Nota: Se refiere a la opción --directories=ACCIÓN cuando ACCIÓN # no es `read', `recurse' o `skip'. #~ msgid "unknown directories method" #~ msgstr "método de directorios desconocido" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Esto es software libre; vea el código fuente para las condiciones de " #~ "copia.\n" #~ "No hay NINGUNA garantía; ni siquiera de COMERCIABILIDAD o IDONEIDAD PARA " #~ "UN\n" #~ "FIN DETERMINADO.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "Las opciones -P y -z no se pueden combinar" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: opción ilegal -- %c\n" # FIXME. Comunicar al autor que esto es repetición... #~ msgid "out of memory" #~ msgstr "memoria agotada" # FIXME: Dice [FILE] ... en vez de [FILE]... ¿Será un error? #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Modo de empleo: %s [OPCIÓN]... PATRÓN [FICHERO] ...\n" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "option %s" #~ msgstr "opción %s" #~ msgid " with arg %s" #~ msgstr " con argumento %s" #~ msgid "digits occur in two different argv-elements.\n" #~ msgstr "aparecen dígitos en dos elementos de argv diferentes.\n" #~ msgid "option %c\n" #~ msgstr "opción %c\n" #~ msgid "option a\n" #~ msgstr "opción a\n" #~ msgid "option b\n" #~ msgstr "opción b\n" #~ msgid "option c with value `%s'\n" #~ msgstr "la opción c tiene el valor `%s'\n" #~ msgid "option d with value `%s'\n" #~ msgstr "la opción d tiene el valor `%s'\n" #~ msgid "?? getopt returned character code 0%o ??\n" #~ msgstr "?? getopt ha devuelto el carácter código 0%o ??\n" #~ msgid "non-option ARGV-elements: " #~ msgstr "elementos de ARGV que no son opciones: " #~ msgid "you may specify only one of -E, -F, or -G" #~ msgstr "sólo se puede especificar una de las opciones -E, -F, o -G" # Prefiero dejarlo en solamente un patrón # Pero entonces no queda claro que *debe haber uno*, y parece que # es uno como máximo (siendo el mínimo 0). sv #~ msgid "" #~ "There should be one and only one PATTERN, `-e PATTERN' or `-f FILE'.\n" #~ msgstr "Debe haber un y solamente un PATRÓN, `-e PATRÓN', o `-f FICHERO'.\n" #~ msgid "If no -[GEF], then -G is assumed.\n" #~ msgstr "Si no se especifica ninguna de las opciones -[GEF], se supone -G.\n" �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/boldquot.sed����������������������������������������������������������������0000664�0001750�0001750�00000000331�14670377450�017410� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������s/"\([^"]*\)"/“\1â€/g s/`\([^`']*\)'/‘\1’/g s/ '\([^`']*\)' / ‘\1’ /g s/ '\([^`']*\)'$/ ‘\1’/g s/^'\([^`']*\)' /‘\1’ /g s/“â€/""/g s/“/“/g s/â€/â€/g s/‘/‘/g s/’/’/g �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/pt.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000040477�14670377450�016230� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��Ø��#��Û���ß$����»%����Á&��4��á(�� ��*��´��"+��‚��×,��á��Z.��ã��<0��W�� 2�����x3�����’3��+���±3��,���Ý3����� 4��+���&4�����R4�����o4�����Ž4��/���¤4��!���Ô4��1���ö4��*���(5��*���S5�� ���~5��#���Ÿ5�����Ã5�����Å5�����Ê5��&���Ü5��•���6��,���™6�� ���Æ6��%���ç6��"��� 7�����07��'���L7�����t7�����‘7��©���®7�����X8�����j8�����r8�����‘8�����¤8��N���¼8��#��� 9�����/9�����O9�����h9��'���~9�����¦9�����®9��*���Ä9�����ï9����� :�����:�����,:�� ���I:��,���T:�����:�� ��ž:�����«;��9���Á;��1���û;��-���-<��)���[<��%���…<��!���«<�����Í<�����ë<�����=��\���=�����r=�����t=��C���’=��$���Ö=��-���û=��.���)>��,���X>��=���…>�� ���Ã>��$���ä>����� ?�����(?�����F?��*���b?�����?�����¥?�����¿?�����Ñ?�����ë?�����ü?�����@��#���0@��-���T@�� ���‚@�� ���Œ@�� ���–@����� @��&���¶@��"���Ý@��.����A�����/A����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 10:42+0100 Last-Translator: Pedro Albuquerque <pmra@protonmail.com> Language-Team: Portuguese <translation-team-pt@lists.sourceforge.net> Language: pt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Poedit 2.3 Plural-Forms: nplurals=2; plural=(n != 1); � Context control: -B, --before-context=NUM imprime NUM linhas de contexto inicial -A, --after-context=NUM imprime NUM linhas de contexto final -C, --context=NUM imprime NUM linhas de contexto de saída � Diversos:\n" -s, --no-messages suprime mensagens de erro -v, --invert-match selecciona linhas que não contenham PADRÃO -V, --version mostra informação de versão e sai --help mostra esta mensagem e sai � Controlo de saída: -m, --max-count=NUM pára após NUM linhas seleccionadas -b, --byte-offset imprime o desvio de byte com as linhas de saída -n, --line-number imprime o nº de linha com as linhas de saída --line-buffered limpa a saída em cada linha -H, --with-filename imprime o nome de ficheiro com as linhas de saída -h, --no-filename suprime o prefixo do nome de ficheiro na saída --label=RÓTULO usa RÓTULO como prefixo de nome de ficheiro de entrada padrão � --include=GLOB procura só em ficheiros que contêm GLOB (um padrão de ficheiro) --exclude=GLOB salta ficheiros e pastas que contêm GLOB --exclude-from=FICH salta ficheiros que contêm qualquer padrão de FICHEIRO --exclude-dir=GLOB salta pastas que contêm GLOB � -E, --extended-regexp PADRÕES são expressões regulares estendidas -F, --fixed-strings PADRÕES são cadeias -G, --basic-regexp PADRÕES são expressões regulares básicas -P, --perl-regexp PADRÕES são expressões regulares Perl � -I equivalente a --binary-files=without-match -d, --directories=ACÇÃO COMO GERIR PASTAS; ACÇÃO é 'read', 'recurse' ou 'skip' -D, --devices=ACÇÃO COMO GERIR DISPOSITIVOS, FIFOs e sockets; ACÇÃO é 'read' ou 'skip' -r, --recursive como --directories=recurse -R, --dereference-recursive igual, mas segue todas as symlinks � -L, --files-without-match imprime só nomes de FICHEIROs sem linhas seleccionadas -l, --files-with-matches imprime só nomes de FICHEIROs com linhas seleccionadas -c, --count imprime só um nº de linhas seleccionadas por FICHEIRO -T, --initial-tab alinha tabulações (se necessário) -Z, --null imprime byte 0 após o nome de FICHEIRO � -NUM igual a --context=NUM --group-separator=SEP imprimir SEP na linha entre correspondências com contexto --no-group-separator não imprimir separador para correspondências com contexto --color[=QUANDO], --colour[=QUANDO] usar marcadores para realçar as cadeias coincidentes; QUANDO é "always", "never" ou "auto" -U, --binary não eliminar caracteres CR em EOL (MSDOS/Windows) � -e, --regexp=PADRÕES usar PADRÕES para comparação -f, --file=FICHEIRO ler PADRÕES do FICHEIRO -i, --ignore-case ignorar diferenças entre maiúsculas e minúsculas --no-ignore-case não ignorar diferenças de maiúsculas (predefinição) -w, --word-regexp comparar só palavras completas -x, --line-regexp comparar só linhas completas -z, --null-data uma linha de dados termina com o byte 0, não com newline � -o, --only-matching mostra só partes não-vazias de linhas que coincidem -q, --quiet, --silent suprime toda a saída normal --binary-files=TYPE assume que ficheiros binários são TIPO; TIPO é "binary", "text" ou "without-match" -a, --text equivalente a --binary-files=text �Página inicial %s: <%s> �%s: ficheiro binário coincide�%s: excedido o limite de retrocesso de PCRE�%s: limite de recursividade de PCRE excedido�%s: pilha PCRE JIT esgotada�%s: ficheiro de entrada também é a saída�%s: erro interno de PCRE: %d�%s: opção inválida -- "%c" �%s: memória esgotada�%s: a opção "%s%s" não permite um argumento �%s: a opção "%s%s" é ambígua �%s: a opção "%s%s" é ambígua; possibilidades:�"%s: a opção "%s%s" requer um argumento �%s: a opção requer um argumento -- "%c" �%s: opção "%s%s" desconhecida �%s: aviso: ciclo de pasta recursivo�"�(©)�(entrada padrão)�-P só suporta idiomas unibyte e UTF-8�Exemplo: %s -i 'hello world' menu.h main.c PADRÕES pode conter múltiplos padrões separados por newline. Selecção e interpretação de padrão: �Ajuda geral para uso de programas GNU: <%s> �Referência de retorno inválida�Nome de classe de carácter inválido�Carácter de agrupamento inválido�Conteúdo inválido de \{\}�Expressão regular precedente inválida�Final de intervalo inválido�Expressão regular inválida�Licença GPLv3+: GNU GPL versão 3 ou posterior <%s> Este é um programa grátis: pode alterá-lo e redistribuí-lo. Não há QUALQUER GARANTIA, até ao limite da Lei. �Memória esgotada�Sem par�Sem expressão regular prévia�Empacotado por %s �Empacotado por %s (%s) �Comparação Perl não suportada numa compilação --disable-perl-regexp build�Fim prematuro de expressão regular�Expressão regular muito grande�Reportar %s erros a: %s �Reportar erros a: %s �Procurar por PADRÕES em cada FICHEIRO �Sucesso�Barra invertida final�Tente "%s --help" para mais informação. �Erro de sistema desconhecido�( ou \( sem par�) ou \) sem par�[, [^, [:, [., ou [= sem par�\{ sem par�Uso: %s [OPÇÃO]... PADRÕES [FICHEIRO]... �Os argumentos válidos são:�Quando FICHEIRO é '-', lê a entrada padrão. Sem FICH, lê '.' se recursivo, senão lê '-'. Com menos de dois FICHs, assume -h. O estado da saída é 0 se qualquer linha for seleccionada, senão é 1; se ocorrer um erro e -q não for dado, o estado da saída é 2. �Escrito por %s e %s. �Escrito por %s, %s, %s, %s, %s, %s, %s, %s, %s e outros. �Escrito por %s, %s, %s, %s, %s, %s, %s, %s e %s. �Escrito por %s, %s, %s, %s, %s, %s, %s e %s. �Escrito por %s, %s, %s, %s, %s, %s e %s. �Escrito por %s, %s, %s, %s, %s e %s. �Escrito por %s, %s, %s, %s e %s. �Escrito por %s, %s, %s e %s. �Escrito por %s, %s e %s. �Escrito por %s �Escrito por Mike Haertel e outros; veja <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�"�argumento ambíguo %s para %s�a sintaxe da classe de carácter é [[:espaço:]], não [:espaço:]�especificou comparadores em conflito�excedido o limite de tamanho da linha de PCRE�falha ao alocar memória para a pilha PCRE JIT�falha ao voltar à pasta de trabalho inicial�falha ao definir modo texto/binário do descritor de ficheiro�entrada muito grande para contar�erro interno (nunca devia acontecer)�argumento inválido %s para %s�classe de carácter inválida�conteúdo inválido de \{\}�argumento de tamanho de contexto inválido�comparador %s inválido�número máximo inválido�memória esgotada�sintaxe não especificada�erro de programa�expressão regular muito grande�transporte da pilha�a opção -P só suporta um padrão�impossível gravar a pasta de trabalho actual�( sem par�) sem par�[ sem par�não terminado\escape�tipo de ficheiro binário desconhecido�método dispositivos desconhecidos�aviso: --unix-byte-offsets (-u) está obsoleto�erro de escrita��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/zh_TW.po��������������������������������������������������������������������0000664�0001750�0001750�00000074302�14670377471�016471� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Traditional Chinese Translation of grep. # Copyright (C) 2004, 2012, 2013, 2016, 2018, 2021 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # Yuan-Chen Cheng <ycheng@sinica.edu.tw>, 2004. # Webber Liao <wpliao@gmail.com>, 2012, 2016. # Wei-Lun Chao <bluebat@member.fsf.org>, 2013. # pan93412 <pan93412@gmail.com>, 2018, 2019, 2020, 2021. msgid "" msgstr "" "Project-Id-Version: grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-10 02:06+0800\n" "Last-Translator: Yi-Jyun Pan <pan93412@gmail.com>\n" "Language-Team: Chinese (traditional) <zh-l10n@lists.linux.org.tw>\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 3.0\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "%2$s 的引數 %1$s 無效" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "%2$s 的引數 %1$s 䏿˜Žç¢º" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "有效的引數為:" #: lib/c-stack.c:187 msgid "program error" msgstr "程å¼éŒ¯èª¤" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "堆疊超出容é‡" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "寫入發生錯誤" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "ä¸å°ç¨±çš„ [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "無效的字元類別" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "字元類別的語法為 [[:space:]], éž [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "ä¸å®Œæ•´çš„ \\ 逸出" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "\\{\\} 的內容無效" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "æ­£è¦è¡¨ç¤ºå¼éŽé•·" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "ä¸å°ç¨±çš„ (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "沒有指定的語法" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "ä¸å°ç¨±çš„ )" #: lib/error.c:195 msgid "Unknown system error" msgstr "未知的系統錯誤" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s:é¸é …「%s%sã€ä¸æ˜Žç¢º\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s:é¸é …「%s%sã€ä¸æ˜Žç¢ºï¼›å¯èƒ½é¸é …為:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s:無法識別的é¸é …「%s%sã€\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s:「%s%sã€é¸é …䏿ޥå—引數\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s:「%s%sã€é¸é …需è¦å€‹å¼•數\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: 無效的é¸é … -- \"%c\"\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: é¸é …需è¦ä¸€å€‹å¼•數 -- \"%c\"\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "記憶體用盡" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "無法記錄ç¾è¡Œå·¥ä½œç›®éŒ„" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "無法返回原本的工作目錄" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "無法設定檔案æè¿°ç¬¦è™Ÿçš„æ–‡å­—/äºŒé€²ä½æ¨¡å¼" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "æˆåŠŸ" #: lib/regcomp.c:138 msgid "No match" msgstr "沒有符åˆçš„é …ç›®" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "無效的正è¦è¡¨ç¤ºå¼" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "無效的å°ç…§å­—å…ƒ" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "無效的字元類別å" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "æœ«ç«¯æœ‰åæ–œç·š" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "無效的å‘後引用" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "æ²’æœ‰å°æ‡‰çš„ [,[^,[:,[. 或 [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "æ²’æœ‰å°æ‡‰çš„ ( 或 \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "æ²’æœ‰å°æ‡‰çš„ \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "無效的 \\{\\} 內容" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "ç„¡æ•ˆçš„çµæŸç¯„åœ" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "記憶體用盡" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "無效的å‰ç½®æ­£è¦è¡¨ç¤ºå¼" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "æ­£è¦è¡¨ç¤ºå¼éŽæ—©çµæŸ" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "æ­£è¦è¡¨ç¤ºå¼éŽé•·" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "æ²’æœ‰å°æ‡‰çš„ ) 或 \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "沒有先å‰çš„æ­£è¦è¡¨ç¤ºå¼" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "套件由 %s (%s) 所打包\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "套件由 %s 所打包\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "æŽˆæ¬Šæ¢æ¬¾ GPLv3+:GNU GPL 第 3 版或更新版 <%s>。\n" "這是自由軟體:您å¯è‡ªç”±ä¿®æ”¹æˆ–散布。\n" "在法律准許範åœå…§ä¸é™„帶ä¿è­‰ã€‚\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "ç”± %s 編寫。\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "ç”± %s å’Œ %s 編寫。\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "ç”± %sã€%s å’Œ %s 編寫。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "ç”± %sã€%sã€%sã€\n" "å’Œ %s 編寫。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "ç”± %sã€%sã€%sã€\n" "%s å’Œ %s 編寫。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "ç”± %sã€%sã€%sã€\n" "%sã€%s å’Œ %s 編寫。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "ç”± %sã€%sã€%sã€\n" "%sã€%sã€%s å’Œ %s 編寫。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "ç”± %sã€%sã€%sã€\n" "%sã€%sã€%sã€%sã€\n" "å’Œ %s 編寫。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "ç”± %sã€%sã€%sã€\n" "%sã€%sã€%sã€%sã€\n" "%s å’Œ %s 編寫。\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "ç”± %sã€%sã€%sã€\n" "%sã€%sã€%sã€%sã€\n" "%s å’Œ %s 等人編寫。\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "回報臭蟲至:%s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "回報 %s bug 到: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s 首é : <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "GNU 軟體用法的一般說明:<%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(標準輸入)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "無效的內容列數值" #: src/grep.c:894 msgid "input is too large to count" msgstr "輸入éŽé•·ç„¡æ³•計數" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%sï¼šäºŒé€²ä½æª”案符åˆ" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s:警告:目錄é‡è¤‡éžè¿´" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s:輸入檔亦為輸出å°è±¡" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "用法: %s [é¸é …]… PATTERNS [檔案]…\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "請使用 \"%s --help\" 以閱讀更多的資訊。\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "在æ¯å€‹æª”案中尋找 PATTERNS。\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "範例:%s -i 'hello world' menu.h main.c\n" "PATTERNS 也å¯ä»¥åŒ…å«å¤šå€‹ä»¥æ›è¡Œç¬¦è™Ÿåˆ†éš”的形樣。\n" "\n" "形樣 (Pattern) 鏿“‡èˆ‡è§£é‡‹ï¼š\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp PATTERNS 是一個延伸正則表示å¼\n" " -F, --fixed-strings PATTERNS 是一個字串\n" " -G, --basic-regexp PATTERNS 是一個基本正則表示å¼\n" " -P, --perl-regexp PATTERNS 是一個 Perl æ­£è¦è¡¨ç¤ºå¼\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=æ¨¡å¼ ä½¿ç”¨ <模å¼> 比å°\n" " -f, --file=檔案 自 <檔案> å–å¾— <模å¼>\n" " -i, --ignore-case 忽略模å¼åŠè³‡æ–™çš„大å°å¯«å·®ç•°\n" " --no-ignore-case ä¸å…許忽略大å°å¯«å·®ç•° (é è¨­å€¼)\n" " -w, --word-regexp 僅比較整個單字\n" " -x, --line-regexp 僅比較整行\n" " -z, --null-data 設定資料列çµå°¾ç‚ºç©ºç™½ä½å…ƒçµ„ï¼Œéžæ›åˆ—符號\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "雜項:\n" " -s, --no-messages 抑制錯誤訊æ¯\n" " -v, --invert-match é¸å–ä¸ç¬¦åˆçš„列\n" " -V, --version å°å‡ºç‰ˆæœ¬è³‡è¨Šç„¶å¾ŒçµæŸ\n" " --help é¡¯ç¤ºæ­¤èªªæ˜Žç„¶å¾ŒçµæŸ\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "輸出控制:\n" " -m, --max-count=NUM 在第 NUM é¸å–åˆ—å¾Œåœæ­¢\n" " -b, --byte-offset å°å‡ºæ¯å€‹è¼¸å‡ºåˆ—çš„ä½å…ƒçµ„åç§»é‡\n" " -n, --line-number å°å‡ºæ¯å€‹è¼¸å‡ºåˆ—的列號\n" " --line-buffered 輸出æ¯åˆ—後清除輸出\n" " -H, --with-filename å°å‡ºè¼¸å‡ºåˆ—的檔案å稱\n" " -h, --no-filename 抑制輸出列的檔åå‰ç¶´\n" " --label=LABEL 以 LABEL 作標準輸入的檔åå‰ç¶´\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching åªé¡¯ç¤ºç›¸ç¬¦è¡Œä¸­çš„éžç©ºç™½éƒ¨ä»½\n" " -q, --quiet, --silent 抑制全部常態的輸出\n" " --binary-files=TYPE 設定二進制檔案為 TYPE 的檔案;\n" " TYPE å¯ç‚º \"binary\"ã€\"text\" 或 \"without-match" "\"\n" " -a, --text ç­‰åŒæ–¼ --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I ç­‰åŒæ–¼ --binary-files=without-matc\n" " -d, --directories=ACTION æª”æ¡ˆç›®éŒ„çš„è™•ç†æ–¹å¼;\n" " ACTION 為 \"read\"ã€\"recurse\" 或 \"skip\"\n" " -D, --devices=ACTION è£ç½®ã€FIFO å’Œé€šè¨Šç«¯çš„è™•ç†æ–¹å¼;\n" " ACTION 為 \"read\" 或 \"skip\"\n" " -R, -r, --recursive ç­‰åŒæ–¼ --directories=recurse\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB åªæœå°‹ç¬¦åˆ GLOB (一種檔案模å¼) 的檔案\n" " --exclude=GLOB è·³éŽç¬¦åˆ GLOB 的檔案\n" " --exclude-from=檔案 è·³éŽç¬¦åˆ <檔案> 中任何檔案模å¼çš„æª”案\n" " --exclude-dir=GLOB è·³éŽç¬¦åˆ GLOB 的資料夾。\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match åªå°å‡ºæœªé¸å–行的 檔案 å稱\n" " -l, --files-with-matches åªå°å‡ºé¸å–行的 檔案 å稱\n" " -c, --count åªå°å‡ºæ¯å€‹ 檔案 çš„é¸å–行項目\n" " -T, --initial-tab (éœ€è¦æ™‚) å°é½Š Tab 符號\n" " -Z, --null 在 檔案 å稱後å°å‡ºç©ºç™½ä½å…ƒçµ„\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "內容控制:\n" " -B, --before-context=NUM å°å‡º NUM åˆ—çš„å‰æ–‡\n" " -A, --after-context=NUM å°å‡º NUM 列的後文\n" " -C, --context=NUM å°å‡º NUM 列的內容\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM ç­‰åŒæ–¼ --context=NUM\n" " --group-separator=SEP 在上一個和下一個符åˆçµæžœå’Œé„°è¿‘列 (context) 之間輸" "出 SEP 分隔字串\n" " --no-group-separator ä¸è¦åœ¨ä¸Šä¸€å€‹å’Œä¸‹ä¸€å€‹ç¬¦åˆçµæžœå’Œé„°è¿‘列之間輸出分隔" "字串\n" " --color[=WHEN],\n" " --colour[=WHEN] 用特殊é¡è‰²æ¨™ç¤ºç¬¦åˆå­—串;\n" " WHEN 為「alwaysã€ã€ã€Œneverã€æˆ–「autoã€\n" " -U, --binary ä¸è¦åˆªé™¤åˆ—å°¾ CR å­—å…ƒ (MSDOS/Windows)\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "如果 <檔案> 為「-ã€ï¼Œå‰‡è®€å–標準輸入資料。 當沒有指定 <檔案> 時,如果使用éžè¿´" "模å¼ï¼Œ\n" "則讀å–「.ã€å¦å‰‡è®€å–「-ã€ã€‚當指定的 <檔案> 數目少於兩個時,則å‡è¨­æ˜¯ -h。\n" "如果有é¸åˆ°ä»»ä½•ä¸€åˆ—ï¼Œå‰‡å›žå‚³çµæŸç‹€æ…‹ 0,å¦å‰‡å›žå‚³ 1ï¼›\n" "如果發生任何錯誤且沒有傳入 -q é¸é …ï¼ŒçµæŸç‹€æ…‹å‰‡ç‚º 2。\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "指定了互相è¡çªçš„é…å°é¸é …" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "--disable-perl-regexp çµ„å»ºä¸æ”¯æ´ Perl 比å°" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "無效的é…å°é¸é … %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "未知的è£ç½®æ–¹æ³•" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "警告:--unix-byte-offsets (-u) 已經廢棄" #: src/grep.c:2686 msgid "invalid max count" msgstr "無效的最大計次" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "æœªçŸ¥çš„äºŒé€²ä½æª”案類別" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "ç”± Mike Haertel åŠå…¶ä»–人撰寫而æˆï¼›è«‹è¦‹\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>。" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "為 PCRE JIT 堆疊分é…記憶體時出ç¾éŒ¯èª¤" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P åªæ”¯æ´å–®ä½å…ƒçµ„å’Œ UTF-8 編碼" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "-P é¸é …åªæ”¯æ´å–®ä¸€æ¨£å¼" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "內部錯誤 (䏿‡‰è©²å‡ºç¾é€™å€‹éŒ¯èª¤)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "å·²è¶…éŽ PCRE 的字數上é™" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s:已用盡記憶體" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s:已用盡 PCRE JIT 堆疊" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%sï¼šå·²è¶…éŽ PCRE 的回溯上é™" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%sï¼šè¶…éŽ PCRE çš„éžè¿´ä¸Šé™" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s:內部 PCRE 錯誤: %d" #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "警告:已經廢除 GREP_OPTIONSï¼›è«‹ä½¿ç”¨åˆ¥åæˆ–文稿" #~ msgid "warning: %s: %s" #~ msgstr "警告: %s: %s" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "%s 首é ï¼š<https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "無效 %s%s 引數 \"%s\"" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "%s%s 引數 \"%s\" 中有無效的尾綴" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s 引數 \"%s\" éŽå¤§" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "內部錯誤" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: é¸é … \"--%s\" 䏿ޥå—引數\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: 未知的é¸é … \"--%s\"\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: é¸é … \"-W %s\" 䏿˜Žç¢º\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: é¸é … \"-W %s\" 䏿ޥå—引數\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: é¸é … \"-W %s\" 需è¦ä¸€å€‹å¼•數\n" #~ msgid "lseek failed" #~ msgstr "lseek 失敗" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "PATTERN 原則上是一個基本正è¦è¡¨ç¤ºå¼ (BRE)。\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "\"egrep\" ç­‰åŒæ–¼ \"grep -E\". \"fgrep\" ç­‰åŒæ–¼ \"grep -F\"。\n" #~ "ç›´æŽ¥å‘¼å« \"egrep\" 或 \"fgrep\" çš„åšæ³•已被廢除。\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "-Pz 䏿”¯æ´æœªé€¸å‡ºçš„ ^ 或 $ " #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "PATTERN 是一個延伸正è¦è¡¨ç¤ºå¼ (ERE)。\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "\"egrep\" çš„å‘¼å«æ–¹å¼å·²è¢«å»¢é™¤; 請用 \"grep -E\" 代替。\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "PATTERN 是一組以æ›åˆ—分隔開的固定字串。\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "\"fgrep\" çš„å‘¼å«æ–¹å¼å·²è¢«å»¢é™¤; 請用 \"grep -F\" 代替。\n" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "GNU Grep 首é : <%s>\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s åªèƒ½ä½¿ç”¨ %s 樣å¼çš„語法" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "--mmap é¸é …自 2010 年起已經沒有任何效用" #~ msgid "unfinished repeat count" #~ msgstr "未完æˆçš„é‡è¤‡è¨ˆæ¬¡" #~ msgid "malformed repeat count" #~ msgstr "æ ¼å¼éŒ¯èª¤çš„é‡è¤‡æ¬¡æ•¸" #~ msgid "out of memory" #~ msgstr "記憶體用盡" #~ msgid "writing output" #~ msgstr "正在輸出" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "用法: %s [é¸é …]… æ¨£æ¿ [檔案]…\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "輸出控制:\n" #~ " -m, --max-count=NUM 在顯示 NUM å€‹çµæžœå¾Œåœæ­¢\n" #~ " -b, --byte-offset åªé¡¯ç¤ºåˆä¹Žæ¢ä»¶è³‡æ–™ä»¥ byte 為記數單ä½çš„ä½ç½®\n" #~ " -n, --line-number åªé¡¯ç¤ºåˆä¹Žæ¢ä»¶çš„行列編號\n" #~ " --line-buffered æ¯ä¸€åˆ—輸出後都立å³é¡¯ç¤º\n" #~ " -H, --with-filename æ¯åˆ—çµæžœéƒ½å°å‡ºæª”案å稱\n" #~ " -h, --no-filename 輸出時ä¸é¡¯ç¤ºå‰ç½®çš„æª”案å稱\n" #~ " --label=LABEL å°æ–¼æ¨™æº–輸入, 在顯示檔å處顯示 LABEL\n" #~ " -o, --only-matching åªé¡¯ç¤ºä¸€åˆ—è³‡æ–™ä¸­èˆ‡æ¨£æ¿æ¢ä»¶ç›¸ç¬¦çš„部分\n" #~ " -q, --quiet, --silent 關閉所有一般輸出的\n" #~ " --binary-files=TYPE è¨­å®šäºŒé€²ä½æª”案型別為 TYPE\n" #~ " TYPE 是 'binary', 'text', 或 'without-match' " #~ "之一\n" #~ " -a, --text ç­‰åŒæ–¼ --binary-files=text\n" #~ " -I ç­‰åŒæ–¼ --binary-files=without-match\n" #~ " -d, --directories=ACTION 處ç†ç›®éŒ„的方å¼\n" #~ " ACTION 是 'read', 'recurse', 或 'skip' 之一\n" #~ " -D, --devices=ACTION 處ç†è£ç½®æª”案, FIFO ä»¥åŠ socket 的方å¼\n" #~ " ACTION 是 'read' 或 'skip'之一\n" #~ " -R, -r, --recursive ç­‰åŒæ–¼ --directories=recurse\n" #~ " --include=PATTERN 檔å與 PATTERN 相符的將會被檢驗\n" #~ " --exclude=PATTERN 檔å與 PATTERN 相符的將會被略éŽ\n" #~ " --exclude-from=FILE 檔å與 FILE 檔案中的 PATTERN 相符的將會被略" #~ "éŽ\n" #~ " -L, --files-without-match åªåˆ—出找ä¸åˆ°ç›¸ç¬¦çš„æª”案å稱\n" #~ " -l, --files-with-matches åªåˆ—出有發ç¾èˆ‡æ¨£æ¿ç›¸ç¬¦çš„æª”案\n" #~ " -c, --count åªé‡å°æ¯çš„æª”案列出該檔案相符個數\n" #~ " -Z, --null 在檔å之後輸出一個值為 0 çš„ä½å…ƒ\n" #~ msgid "" #~ "\n" #~ "Report bugs to <bug-gnu-utils@gnu.org>.\n" #~ msgstr "" #~ "\n" #~ "請將發ç¾çš„錯誤,以電å­éƒµä»¶å¯„到 <bug-gnu-utils@gnu.org>\n" #~ msgid "unknown directories method" #~ msgstr "未知的目錄方法" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "版權所有 1988, 1992-1999, 2000, 2001 自由軟體基金會.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "é€™å€‹ç¨‹å¼æ˜¯è‡ªç”±è»Ÿé«”; è«‹åƒé–±å…¶ç‰ˆæ¬Šæ¢æ¬¾. 此軟體沒有\n" #~ "沒有任何ä¿è¨¼; 也沒有任何ä¿è¨¼å®ƒä½¿ç”¨æ–¼æŸä¸€ç‰¹å®šç›®çš„.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "åƒæ•¸ -P ä»¥åŠ åƒæ•¸ -z 並ä¸èƒ½çµåˆä½¿ç”¨" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s; ä¸é©ç”¨çš„é¸é … -- %c\n" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/de.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000041355�14670377471�016174� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����g������T��‰���Œ������°��Ï���±��÷��� ��Õ��y ����O ��ü���` ��¶��]��U����¤��j��F�������V�����j��&���‚��#���©�����Í��!���ê����� �����(�����D��,���Y�����†��.���¦��'���Õ��(���ý�����&��%���F�����l�����n�����r��*���ƒ�����®��&���?�����f�����}�����š�����¶��$���Î�����ó�������ª��� �����Ë�����Ü�����å������������<���)��#���f�����Š�����¥�����¼��"���Ð�����ó�����û��&��������5�����J�����\�����n�� �����)���š�����Ä��ù���Ù�����Ó��;���ê��3���&��/���Z��+���Š��'���¶��#���Þ����������"�����>��\���N�����«�����­��4���Ê�����ÿ��!�����0���@��-���q��.���Ÿ�����Î��$���ê����������*�����B�����Z�����z����������Ÿ�����°�� ���Ä�����Ò�����í��,���ü��*���) �� ���T �� ���a �� ���n �����{ ����� �����© �� ���À ��è��Ì ��.��µ"����ä#��m��ç$��Ç��U'��5��)��"��S*��ï��v,��!��f.��º��ˆ0�����C2��%���V2��A���|2��9���¾2��/���ø2��.���(3�����W3��"���t3�����—3��,���²3��%���ß3��@���4��-���F4��.���t4��!���£4��*���Å4�����ð4�����ô4�����÷4��/��� 5��˜���95��6���Ò5����� 6�����(6�����G6�����_6��.���{6�����ª6�����Ã6��®���ã6�����’7�����©7��'���À7�����è7�����ø7��[��� 8��)���i8��#���“8��E���·8��‰���ý8��<���‡9�����Ä9�����Ë9��/���æ9�����:�����/:�����O:��,���o:�����œ:��)���µ:�����ß:��m��ø:�����f<��@���‚<��7���Ã<��3���û<��/���/=��+���_=��'���‹=��#���³=�����×=�����÷=��d��� >�����q>�� ���u>��?���–>��8���Ö>��6���?��A���F?��I���ˆ?��B���Ò?��/���@��&���E@�����l@�����Œ@�����¥@��+���Á@�����í@�����A�����!A�����8A�����XA��#���gA�����‹A��7���›A��8���ÓA�� ��� B��*���-B�� ���XB�����yB��"���•B��&���¸B�� ���ßB�����d���;���<���8������� ���4���)������*����������O������D�����������]���C���\���S���%���/��� ���L���2���,�����������_���>���H������U������Z������������������G����������������X����������=��������������`���^���N���J������6���?���M���R�������F���T���$���������������������7�����������������K���0�������P���9���#�����������3���������!���c���.��� ������E���W���e����������:���A���5���(��� ������ �������@�����������Y���"���a���-���f������ ���+������1���Q�������������g���'���V�����������b���I���&�������B�������������������[���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: GNU grep 3.5.16 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-01-27 18:27+0100 Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com> Language-Team: German <translation-team-de@lists.sourceforge.net> Language: de MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. X-Generator: Lokalize 20.12.1 Plural-Forms: nplurals=2; plural=(n != 1); � Kontextsteuerung: -B, --before-context=ANZAHL ANZAHL Zeilen vorausgehenden Kontextes ausgeben -A, --after-context=ANZAHL ANZAHL Zeilen nachfolgenden Kontextes ausgeben -C, --context=ANZAHL ANZAHL Zeilen Kontext ausgeben � Verschiedenes: -s, --no-messages Fehlermeldungen unterdrücken -v, --invert-match Nicht-passende Zeilen anzeigen -V, --version Versionsnummer ausgeben und beenden --help Diese Hilfe ausgeben und beenden � Steuerung der Ausgabe: -m, --max-count=ANZAHL stoppt nach ANZAHL ausgewählter Zeilen -b, --byte-offset gibt mit den Zeilen auch den Abstand in Bytes an -n, --line-number gibt mit den Zeilen auch die Zeilennummer an --line-buffered leert den Puffer nach jeder Zeile -H, --with-filename gibt den Dateinamen für jede Übereinstimmung aus -h, --no-filename unterdrückt die Ausgabe des vorangehenden Dateinamens --label=BEZEICHNUNG verwendet BEZEICHNUNG als Präfix für Dateinamen der Standardeingabe � --include=DATEIMUSTER durchsucht nur Dateien, die DATEIMUSTER entsprechen --exclude=DATEIMUSTER überspringt Dateien, die DATEIMUSTER entsprechen --exclude-from=DATEI überspringt Dateien, die einem Dateimuster in DATEI entsprechen. --exclude-dir=MUSTER überspringt Verzeichnisse, die MUSTER entsprechen � -E, --extended-regexp MUSTER sind erweiterte reguläre Ausdrücke -F, --fixed-strings MUSTER sind Zeichenketten -G, --basic-regexp MUSTER sind reguläre Standardausdrücke -P, --perl-regexp MUSTER sind reguläre Ausdrücke, wie Perl sie akzeptiert � -I gleichbedeutend mit --binary-files=without-match -d, --directories=AKTION beschreibt, wie Verzeichnisse zu behandeln sind; AKTION kann „read“, „recurse“ oder „skip“ sein -D, --devices=AKTION Behandlung von Geräten, FIFOs oder Sockets; AKTION kann „read“ oder „skip“ sein -r, --recursive wie --directories=recurse -R, --dereference-recursive ebenso, folgt aber allen symbolischen Links � -L, --files-without-match nur die Namen von Dateien ausgeben, die keinen passenden Inhalt haben -l, --files-with-matches nur die Namen von Dateien mit passendem Inhalt ausgeben -c, --count nur die Anzahl der passenden Zeilen pro DATEI ausgeben -T, --initial-tab Tabulatoren (wenn nötig) ausrichten -Z, --null ein 0-Byte nach einem Dateinamen ausgeben � -e, --regexp=MUSTER MUSTER zur Treffersuche verwenden -f, --file=DATEI MUSTER aus DATEI lesen -i, --ignore-case Unterschied zwischen Groß- und Kleinschreibung ignorieren --no-ignore-case Festlegung zur Groß- oder Kleinschreibung nicht ignorieren -w, --word-regexp MUSTER passt nur auf ganze Wörter -x, --line-regexp MUSTER passt nur auf ganze Zeilen -z, --null-data Eine Zeile endet mit Nullbyte, nicht Newline � -o, --only-matching zeigt nur den nicht-leeren Teil einer Zeile, der zu MUSTER passt -q, --quiet, --silent unterdrückt alle normalen Ausgaben --binary-files=TYP alle binären Dateien sind vom Typ TYP; TYP kann „binary“, „text“ oder „without-match“ sein -a, --text gleichbedeutend mit --binary-files=text �%s Homepage: <%s> �%s: Übereinstimmungen in Binärdatei�%s: Überschreitung der Zurückverfolgungsbeschränkung des PCREs�%s: Überschreitung der Rekursionsbeschränkung des PCREs�%s: Kellerspeicher für PCRE JIT ist erschöpft�%s: die Eingabedatei ist auch die Ausgabedatei�%s: interner PCRE-Fehler: %d�%s: ungültige Option -- „%c“ �%s: Speicher ausgeschöpft�%s: Option „%s%s“ erlaubt kein Argument �%s: Option „%s%s“ ist mehrdeutig �%s: die Option „%s%s“ ist mehrdeutig; Mögliche Bedeutungen:�%s: Option „%s%s“ benötigt ein Argument �%s: Option erfordert ein Argument -- „%c“ �%s: unbekannte Option „%s%s“ �%s: Warnung: rekursive Verzeichnisschleife�“�©�(Standardeingabe)�-P unterstützt nur Unibyte- oder UTF-8-Locales�Beispiel: %s -i 'Hallo Welt' menu.h main.c MUSTER kann mehrere durch Zeilenumbruch getrennte Muster enthalten. Auswahl und Interpretation von Mustern: �Allgemeine Hilfe zur Benutzung von GNU-Software: <%s> �Ungültige Rückwärtsreferenz�Ungültiger Zeichenklassenname�Ungültiges Suchzeichen�Ungültiger Inhalt von \{\}�Ungültiger vorhergehender regulärer Ausdruck�Ungültiges Bereichsende�Ungültiger regulärer Ausdruck�Lizenz GPLv3+: GNU GPL Version 3 oder neuer <%s>. Dies ist freie Software: Sie können sie ändern und weitergeben. Es gibt keinerlei Garantien, soweit gesetzlich zulässig. �Speicher ausgeschöpft�Keine Übereinstimmung�Kein vorhergehender regulärer Ausdruck�Gepackt von %s �Gepackt von %s (%s) �Perl-basierte Treffersuche wurde in dieses --disable-perl-regexp-Binary nicht einkompiliert�Vorzeitiges Ende des regulären Ausdrucks�Der reguläre Ausdruck ist zu groß�Melden Sie Programmfehler für %s (auf Englisch, mit LC_ALL=C) an %s �Melden Sie Übersetzungsfehler an <translation-team-de@lists.sourceforge.net>, Programmfehler dagegen (auf Englisch, mit LC_ALL=C) an %s �Nach MUSTER in jeder DATEI oder der Standardeingabe suchen. �Erfolg�Rückschrägstrich am Ende�„%s --help“ liefert weitere Informationen. �Unbekannter Systemfehler�Kein Gegenstück für ( oder \(�Kein Gegenstück für ) oder \)�Kein Gegenstück für [, [^, [:, [., oder [=�Kein Gegenstück für \{�Aufruf: %s [OPTION]… MUSTER [DATEI]… �Gültige Argumente sind:�Wenn DATEI „-“ ist, wird die Standardeingabe gelesen. Ohne DATEI wird „.“ gelesen, wenn -r auf der Befehlszeile angegeben wurde, ansonsten „-“. Wenn weniger als zwei DATEIen angegeben wurden, wird -h angenommen. Der Rückgabewert ist 0, wenn eine Zeile passte, ansonsten 1. Wenn ein Fehler auftrat und -q nicht angegeben wurde, ist der Rückgabewert 2. �Geschrieben von %s und %s. �Geschrieben von %s, %s, %s, %s, %s, %s, %s, %s, %s und anderen. �Geschrieben von %s, %s, %s, %s, %s, %s, %s, %s und %s. �Geschrieben von %s, %s, %s, %s, %s, %s, %s und %s. �Geschrieben von %s, %s, %s, %s, %s, %s und %s. �Geschrieben von %s, %s, %s, %s, %s und %s. �Geschrieben von %s, %s, %s, %s und %s. �Geschrieben von %s, %s, %s und %s. �Geschrieben von %s, %s und %s. �Geschrieben von %s. �Geschrieben von Mike Haertel und anderen; siehe <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�„�mehrdeutiges Argument %s für %s�die Syntax für Zeichenklassen ist [[:space:]], nicht [:space:]�die angegebenen Suchmuster stehen in Konflikt zueinander�Überschreitung der zulässigen Zeilenlänge von PCREs�es konnte kein Speicher für den PCRE-JIT-Stack reserviert werden�die Rückkehr in das ursprüngliche Arbeitsverzeichnis war nicht möglich�Text-/Binärmodus des Dateideskriptors konnte nicht gesetzt werden�die Eingabe ist zu groß, um gezählt zu werden�Interner Fehler (sollte nie vorkommen)�ungültiges Argument %s für %s�Ungültige Zeichenklasse�Ungültiger Inhalt von \{\}�ungültiges Argument für die Kontextlänge�ungültige Entsprechung %s�ungültige Maximalanzahl�Speicher ausgeschöpft�es wurde keine Syntax angegeben�Programmfehler�Der reguläre Ausdruck ist zu groß�Stack-Überlauf�Die Option -P unterstützt nur ein einzelnes Suchmuster�das aktuelle Verzeichnis kann nicht aufgezeichnet werden�( ohne schließendes Gegenstück�Schließende ) ohne öffnendes Gegenstück�[ ohne schließendes Gegenstück�unbeendete \-Escape-Sequenz�unbekannter Typ für Binärdateien�Unbekannte Methode für Gerätedateien�Schreibfehler������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/ca.po�����������������������������������������������������������������������0000664�0001750�0001750�00000067155�14670377450�016026� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Traducció missatges de GNU grep al català. # Copyright (C) 2002 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Enric Alberola Rosell <enricalberola@wanadoo.es>, 2002, 2010. # Àngel Mompó <mecatxis@mecatxis.cat>, 2010, 2011, 2012, 2014, 2017, 2019. # msgid "" msgstr "" "Project-Id-Version: GNU grep-3.1.48\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2019-07-18 22:11+0200\n" "Last-Translator: Àngel Mompó <mecatxis@mecatxis.cat>\n" "Language-Team: Catalan <ca@dodds.net>\n" "Language: ca\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Gtranslator 2.91.7\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "l'argument %s no és vàlid per %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "l'argument %s és ambigu per %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Els arguments vàlids són:" #: lib/c-stack.c:187 msgid "program error" msgstr "error del programa" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "desbordament de la pila" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "error d'escriptura" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ desaparellat" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "La classe de caràcter no és vàlida" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "La sintaxi de la classe de caràcter és [[:espai:]], no [:espai:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "Codi d'escapada \\ inacabat" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "el context de \\{\\} no és vàlid" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "l'expressió regular és massa gran" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( desaparellat" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "no s'ha especificat cap sintaxi" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") desaparellat" #: lib/error.c:195 msgid "Unknown system error" msgstr "Error desconegut del sistema" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: l'opció «%s%s» és ambigua\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: l'opció «%s%s» és ambigua; possibilitats:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: no es reconeix l'opció «%s%s»\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: l'opció «%s%s» no permet un argument\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: l'opció «%s%s» necessita un argument\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: l'opció no és vàlida -- «%c»\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: l'opció necessita un argument -- «%c»\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "memòria exhaurida" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "no es pot enregistrar el directori de treball actual" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "no s'ha pogut tornar al directori de treball inicial" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "No s'ha pogut establir el mode del descriptor de fitxers text/binari" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "«" #: lib/quotearg.c:356 msgid "'" msgstr "»" #: lib/regcomp.c:135 msgid "Success" msgstr "Èxit" #: lib/regcomp.c:138 msgid "No match" msgstr "No coincideix" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "L'expressió regular no és vàlida" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "La compaginació del caràcter no és vàlida" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "El nom de la classe del caràcter no és vàlida" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Barra inversa final" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "La referència anterior no és vàlida" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Falten o sobren [, [^, [:, [., o [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "falten o sobren ( o \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Falten o sobren \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "El context de \\{\\} no és vàlid" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "L'abast no és vàlid" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Memòria exhaurida" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "L'expressió regular precedent no és vàlida" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Final prematur de l'expressió regular" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "L'expressió regular és massa gran" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Falten o sobren ) o \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "No hi ha una expressió regular prèvia" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Empaquetat per %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Empaquetat per %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, fuzzy, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "\n" "Llicència GPLv3+: GNU GPL versió 3 o posterior <http://gnu.org/licenses/gpl." "html>.\n" "Aquest programari és lliure: podeu modificar-lo i redistribuir-lo si voleu.\n" "No hi ha CAP GARANTIA, en la mesura que ho permeti la llei.\n" "\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Escrit per %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Escrit per %s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Escrit per %s, %s i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Escrit per %s, %s, %s.\n" "i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Escrit per %s, %s, %s.\n" "%s, i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Escrit per %s, %s, %s.\n" "%s, %s, i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Escrit per %s, %s, %s.\n" "%s, %s, %s, i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Escrit per %s, %s, %s.\n" "%s, %s, %s, %s,\n" "i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Escrit per %s, %s, %s.\n" "%s, %s, %s, %s,\n" "%s, i %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Escrit per %s, %s, %s.\n" "%s, %s, %s, %s,\n" "%s, %s, i altres.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "Informeu dels errors a: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Informeu dels errors de %s a: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Pàgina inicial de %s: <%s>\n" #: lib/version-etc.c:260 #, fuzzy, c-format msgid "General help using GNU software: <%s>\n" msgstr "" "Ajuda general d'utilització del programari de GNU: <https://www.gnu.org/" "gethelp/>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(entrada estàndard)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "la longitud de l'argument no és vàlida" #: src/grep.c:894 msgid "input is too large to count" msgstr "l'entrada és massa llarga per a comptar" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "Hi ha coincidències en el fitxer binari %s\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "bucle de directori recursiu" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "el fitxer d'entrada %s és també la sortida" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Forma d'ús: %s [OPCIÓ]... PATRONS [FITXER] ...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Feu servir «%s --help» per a obtenir més informació.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Busca els PATRONS a cada FITXER.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Exemple: %s -i «hola món» menu.h main.c\n" "PATRONS pot contenir diversos patrons separats per salts de línia.\n" "\n" "Selecció i interpretació del patró:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp PATRONS són expressions regulars ampliades\n" " -F, --fixed-strings PATRONS són conjunts de cadenes separades per " "salts de línia\n" " -G, --basic-regexp PATRONS són expressions regulars bàsiques (per " "defecte)\n" " -P, --perl-regexp PATRONS són expressions regulars de Perl\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=PATRONS utilitza els PATRONS per la comparació\n" " -f, --file=FITXER obté els PATRONS del FITXER\n" " -i, --ignore-case no diferencia entre majúscules i minúscules\n" " -w, --word-regexp força la concordança amb paraules completes\n" " -x, --line-regexp força la concordança amb línies completes\n" " -z, --null-data una línia de dades acaba amb byte 0 i no amb un " "salt de línia\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Miscel·lània:\n" " -s, --no-messages suprimeix els missatges d'error\n" " -v, --invert-match selecciona les línies que no coincideixen\n" " -V, --version mostra la informació sobre la versió i surt\n" " --help mostra aquesta ajuda i surt\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Control de sortida:\n" " -m, --max-count=NUM s'atura després de NUM coincidències\n" " -b, --byte-offset mostra el byte de desplaçament amb les línies de " "sortida\n" " -n, --line-number mostra el número de lí­nia amb les línies de " "sortida\n" " --line-buffered bolca la sortida a cada línia\n" " -H, --with-filename mostra el nom del fitxer amb les línies de " "sortida\n" " -h, --no-filename elimina els noms dels fitxers de la sortida\n" " --label=ETIQUETA fes servir ETIQUETA com a prefix del nom del " "fitxer per l'entrada estàndard\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching mostra només la part de la línia que " "coincideixi\n" " -q, --quiet, --silent elimina la sortida normal\n" " --binary-files=TIPUS assumeix que els fitxers binaris són de tipus " "TIPUS;\n" " TIPUS pot ser «binary», «text» o «without-" "match»\n" " -a, --text equivalent a --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I equivalent a --binary-files=without-match\n" " -d, --directories=ACCIÓ com cal tractar els directoris;\n" " ACCIÓ pot ser: «read», «recurse», o «skip»\n" " -D, --devices=ACCIÓ com tractar els dispositius, FIFOs i sòcols;\n" " ACCIÓ pot ser: «read» o «skip»\n" " -r, --recursive equivalent a --directories=recurse\n" " -R, --dereference-recursive igual que l'anterior, però segueix tots els " "enllaços simbòlics\n" #: src/grep.c:2023 #, fuzzy, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB........ busca els fitxers que coincideixin amb GLOB " "(un fitxer patró)\n" " --exclude=GLOB ........ salta els fitxers i directoris que " "coincideixin amb GLOB\n" " --exclude-from=FITXER salta els fitxers que coincideixin amb " "qualsevol fitxer patró del FITXER\n" " --exclude-dir=GLOB ...salta els directoris que coincideixin amb " "GLOB.\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match mostra només els noms dels FITXERs que no " "tinguin cap línia seleccionada\n" " -l, --files-with-matches mostra només els noms dels FITXERs que " "continguin alguna línia seleccionada\n" " -c, --count mostra només el nombre de línies selecionades " "per FITXER\n" " -T, --initial-tab alinea les tabulacions (si cal)\n" " -Z, --null mostra byte 0 després del nom de FITXER\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Control del context:\n" " -B, --before-context=NOMBRE mostra un NOMBRE de línies del context " "anterior\n" " -A, --after-context=NOMBRE mostra un NOMBRE de línies del context " "posterior\n" " -C, --context=NOMBRE mostra un NOMBRE de línies del context de " "sortida\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM el mateix que --context=NUM\n" " --color[=QUAN],\n" " --colour[=QUAN] ressalta amb marcadors les cadenes " "coincidents;\n" " QUAN pot ser: «always», «never» o «auto»\n" " -U, --binary no elimina els caràcters CR als EOL (MSDOS/" "Windows)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Quan el FITXER és «-», llegeix l'entrada estàndard. Si no s'indica el " "FITXER, llegeix «.» \n" "si és recursiu i «-» si no ho és. Si s'indiquen menys de dos FITXERs, " "assumeix -h.\n" "L'estat de sortida és 0 si s'havia seleccionat alguna línia (o algun fitxer " "si -L), si no 1.\n" "Si hi ha algun error i no s'ha indicat -q, l'estat de sortida és 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "s'han especificat expressions conflictives" #: src/grep.c:2101 #, fuzzy msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "el suport per l'opció -P no està  compilat a aquest binari --disable-perl-" "regexp" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "l'expressió %s no és vàlida" #: src/grep.c:2538 msgid "unknown devices method" msgstr "el mètode de dispositius és desconegut" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "el comptador de màxims no és vàlid" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "el tipus de fitxer binari és desconegut" #: src/grep.c:2829 #, fuzzy msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "la resta, vegeu <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "no s'ha pogut assignar memòria per la pila JIT del PCRE" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P només permet la configuració local en unibyte i en UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "l'opció -P només suporta un sol patró" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "error intern (no hauria de passar mai)" # PCRE is 'Perl Compatible Regular Expression' #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "s'ha superat el límit de longitud de línia del PCRE" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "memòria exhaurida" #: src/pcresearch.c:310 #, fuzzy, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "S'ha acabat la pila del PCRE JIT" # PCRE is 'Perl Compatible Regular Expression' #: src/pcresearch.c:315 #, fuzzy, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "s'ha superat el límit de l'estratègia «tornada enrere» del PCRE" # PCRE is 'Perl Compatible Regular Expression' #: src/pcresearch.c:319 #, fuzzy, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "s'ha superat el límit de l'estratègia «tornada enrere» del PCRE" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "error intern del PCRE: %d" #, c-format #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "avís: GREP_OPTIONS està desfasat; feu servir un alies o un script" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "aví­s: %s: %s" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "l'argument «%s» de %s%s no és vàlid" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "el sufix «%s» de %s%s no és vàlid" #~ msgid "%s%s argument '%s' too large" #~ msgstr "l'argument «%s» de %s%s és massa gran" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "Pàgina inicial de %s: <https://www.gnu.org/software/%s/>\n" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "error intern" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: l'opció «--%s» no permet un argument\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: l'opció és desconeguda «--%s»\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: l'opció «-W %s» és ambigua\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: l'opció «-W %s» no permet un argument\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: l'opció «-W %s» necessita un argument\n" #~ msgid "lseek failed" #~ msgstr "l'lseek ha fallat" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "El PATRÓ és, per defecte, una expressió regular bàsica (ERB).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "«egrep» ara és «grep -E». «fgrep» ara és «grep -F».\n" #~ "La crida directa tant de «egrep» com de «fgrep» és obsoleta.\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "falta el caràcter d'escapada de ^ o no es permet $ amb -Pz" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "Pàgina principal del Grep de GNU: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "la seqüència d'entrada UTF-8 byte no és vàlida" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "El PATRÓ és una expressió regular ampliada (ERA).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "La crida com a «egrep» està desfasada; feu servir «grep -E».\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "" #~ "El PATRÓ és un conjunt de cadenes fixes separades per salts de línia.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "La crida com a «fgrep» està desfasada; feu servir «grep -F».\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "%s només pot fer servir la sintaxis de patró %s" #~ msgid "the --mmap option has been a no-op since 2010" #~ msgstr "la opció --mmap no fa res des del 2010" #~ msgid "unfinished repeat count" #~ msgstr "comptador de repeticions inacabat" #~ msgid "malformed repeat count" #~ msgstr "comptador de repeticions defectuós" #~ msgid "writing output" #~ msgstr "s'escriu a la sortida" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity needs a value (\"=...\"); " #~ "skipped" #~ msgstr "" #~ "a GREP_COLORS=\"%s\", la capacitat \"%s\" necessita un valor (\"=..\"). " #~ "S'ha omés" #~ msgid "" #~ "in GREP_COLORS=\"%s\", the \"%s\" capacity is boolean and cannot take a " #~ "value (\"=%s\"); skipped" #~ msgstr "" #~ "a GREP_COLORS=\"%s\", la capacitat \"%s\" és booleana i no pot tenir el " #~ "valor (\"=%s\"). S'ha omés" #~ msgid "in GREP_COLORS=\"%s\", the \"%s\" capacity %s" #~ msgstr "a GREP_COLORS=\"%s\", la capacitat \"%s\" %s" #~ msgid "" #~ "stopped processing of ill-formed GREP_COLORS=\"%s\" at remaining " #~ "substring \"%s\"" #~ msgstr "" #~ "s'ha deixat de processar de les subcadenes GREP_COLORS=\"%s\" mal " #~ "formades \"%s\"" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/hu.po�����������������������������������������������������������������������0000664�0001750�0001750�00000065432�14670377471�016056� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Hungarian translation for grep. # Copyright (C) 2002, 2009, 2010, 2014, 2015, 2016, 2017, 2019 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # Emese Kovács <emese@instantweb.hu>, 2002, 2010. # Gabor Kelemen <kelemeng@gnome.hu>, 2009, 2010, 2014, 2016, 2017. # Balázs Úr <ur.balazs@fsf.hu>, 2014, 2015, 2019. msgid "" msgstr "" "Project-Id-Version: grep 3.1.48\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2019-11-23 22:33+0100\n" "Last-Translator: Balázs Úr <ur.balazs@fsf.hu>\n" "Language-Team: Hungarian <translation-team-hu@lists.sourceforge.net>\n" "Language: hu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Lokalize 19.04.3\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "a(z) %s argumentum érvénytelen a következÅ‘höz: %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "a(z) „%s†argumentum nem egyértelmű a következÅ‘höz: „%sâ€" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Az érvényes argumentumok a következÅ‘k:" #: lib/c-stack.c:187 msgid "program error" msgstr "programhiba" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "verem túlcsordulás" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "íráshiba" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "kiegyensúlyozatlan [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "érvénytelen karakterosztály" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "a karakterosztály szintaxisa [[:space:]], nem [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "befejezetlen \\ escape" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "a \\{\\} tartalma érvénytelen" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "a reguláris kifejezés túl nagy" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "kiegyensúlyozatlan (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "nincs szintaxis megadva" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "kiegyensúlyozatlan )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Ismeretlen rendszerhiba" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: a(z) „%s%s†kapcsoló nem egyértelmű\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: a(z) „%s%s†kapcsoló nem egyértelmű, lehetÅ‘ségek:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: a(z) „%s%s†kapcsoló ismeretlen\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: a(z) „%s%s†kapcsoló nem enged meg argumentumot\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: a(z) „%s%s†kapcsolóhoz argumentum szükséges\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: érvénytelen kapcsoló -- „%câ€\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: a kapcsoló egy argumentumot igényel -- „%câ€\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "elfogyott a memória" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "az aktuális munkakönyvtár feljegyzése meghiúsult" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "a visszatérés meghiúsult a kiinduló munkakönyvtárba" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "nem sikerült beállítani a fájlleíró szöveges/bináris módját" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "„" #: lib/quotearg.c:356 msgid "'" msgstr "â€" #: lib/regcomp.c:135 msgid "Success" msgstr "Sikerült" #: lib/regcomp.c:138 msgid "No match" msgstr "Nincs találat" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Érvénytelen reguláris kifejezés" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Érvénytelen leválogatási karakter" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Érvénytelen karakterosztálynév" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Záró visszaper" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Érvénytelen visszahivatkozás" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Pár nélküli [, [^, [:, [., vagy [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Pár nélküli ( vagy \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Pár nélküli \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "A \\{\\} tartalma érvénytelen" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Érvénytelen tartományvég" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Elfogyott a memória" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Érvénytelen megelÅ‘zÅ‘ reguláris kifejezés" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "A reguláris kifejezés túl korán véget ért" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "A reguláris kifejezés túl nagy" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Pár nélküli ) vagy \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Nincs megelÅ‘zÅ‘ reguláris kifejezés" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Csomagolta: %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Csomagolta: %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, fuzzy, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "\n" "A licenc GPLv3+: a GNU GPL 3. vagy újabb változata <https://gnu.org/licenses/" "gpl.html>\n" "Ez egy szabad szoftver, terjesztheti és/vagy módosíthatja.\n" "NINCS GARANCIA, a törvény által engedélyezett mértékig.\n" "\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Ãrta %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Ãrta %s és %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Ãrta %s, %s, és %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Ãrta %s, %s, %s,\n" "és %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Ãrta %s, %s, %s,\n" "%s, és %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Ãrta %s, %s, %s,\n" "%s, %s, és %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Ãrta %s, %s, %s,\n" "%s, %s, %s, és %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Ãrta %s, %s, %s,\n" "%s, %s, %s, %s,\n" "és %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Ãrta %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, és %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Ãrta %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, és mások.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "A hibák a(z) %s címen jelenthetÅ‘k.\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "A(z) %s hibái a(z) %s címen jelenthetÅ‘k.\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "A(z) %s honlapja: <%s>\n" #: lib/version-etc.c:260 #, fuzzy, c-format msgid "General help using GNU software: <%s>\n" msgstr "" "Ãltalános segítség a GNU szoftverek használatához: <https://www.gnu.org/" "gethelp/>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(szabványos bemenet)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "érvénytelen szövegkörnyezethossz argumentum" #: src/grep.c:894 msgid "input is too large to count" msgstr "a bemenet túl nagy a megszámláláshoz" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "%s bináris fájl illeszkedik\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "rekurzív könyvtárhurok" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "%s bemeneti fájl a kimenet is" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Használat: %s [KAPCSOLÓ]… MINTÃK [FÃJL]…\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "További információkért adja ki a(z) „%s --help†parancsot.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "A MINTÃK keresése minden FÃJLBAN.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Példa: %s -i 'szia világ' menu.h main.c\n" "A MINTÃK tartalmazhat több mintát új sorokkal elválasztva.\n" "\n" "Minta kiválasztása és értelmezése:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp a MINTÃK kiterjesztett reguláris kifejezések\n" " -F, --fixed-strings a MINTÃK karakterláncok\n" " -G, --basic-regexp a MINTÃK alapvetÅ‘ reguláris kifejezések\n" " -P, --perl-regexp a MINTÃK Perl reguláris kifejezések\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=MINTÃK a MINTÃK használata illesztésre\n" " -f, --file=FÃJL a MINTÃK beolvasása a FÃJLBÓL\n" " -i, --ignore-case a kis- és nagybetűk megegyeznek\n" " -w, --word-regexp csak egész szavakra illesztés\n" " -x, --line-regexp csak egész sorokra illesztés\n" " -z, --null-data az adat sorai 0 bájtra végzÅ‘dnek, nem újsorra\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Egyéb:\n" " -s, --no-messages hibaüzenetek elnémítása\n" " -v, --invert-match a nem illeszkedÅ‘ sorok kiválogatása\n" " -V, --version verzióinformációk kiírása és kilépés\n" " --help ezen súgó kiírása és kilépés\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Kimenet beállításai:\n" " -m, --max-count=SZÃM megáll SZÃM kiválasztott sor után\n" " -b, --byte-offset a kimenetben szerepel a sor helye is " "(bájteltolás)\n" " -n, --line-number a kimenetben szerepel a sor száma is\n" " --line-buffered kimenet kiürítése minden sor után\n" " -H, --with-filename fájlnév kiírása a kimeneti sorokkal\n" " -h, --no-filename a kimenetbe nem írja ki a fájlnév elÅ‘tagot\n" " --label=CÃMKE a CÃMKE kiírása fájlnévként a szabványos " "bemenet\n" " használatakor\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching az illeszkedÅ‘ soroknak csak a nem üres részeit\n" " jelenítse meg\n" " -q, --quiet, --silent minden szokványos kimenet elhagyása\n" " --binary-files=TÃPUS a bináris fájlokat adott TÃPUSÚNAK veszi, a " "TÃPUS\n" " a „binaryâ€, „text†vagy „without-match†" "egyike\n" " -a, --text ugyanaz, mint a --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I ugyanaz, mint a --binary-files=without-match\n" " -d, --directories=MŰVELET mi történjen a könyvtárakkal; a MŰVELET\n" " a „readâ€, „recurse†vagy „skip†egyike\n" " -D, --devices=MŰVELET mi történjen az eszközökkel, FIFO-kkal és\n" " foglalatokkal, a MŰVELET a „read†vagy „skipâ€\n" " egyike\n" " -r, --recursive ugyanaz, mint a --directories=recurse\n" " -R, --dereference-recursive hasonló, de követi az összes szimlinket\n" #: src/grep.c:2023 #, fuzzy, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB csak a GLOBRA (fájlmintára) illeszkedÅ‘ fájlok\n" " keresése\n" " --exclude=GLOB a GLOBRA (fájlmintára) illeszkedÅ‘ fájlok és\n" " könyvtárak kihagyása\n" " --exclude-from=FÃJL a FÃJLBAN található fájlmintákra illeszkedÅ‘\n" " fájlok kihagyása\n" " --exclude-dir=GLOB a GLOBRA (fájlmintára) illeszkedÅ‘ könyvtárak\n" " kihagyása\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match csak a kiválasztott sorok nélküli fájlnevek " "kiírása\n" " -l, --files-with-matches csak a kiválasztott sorokat tartalmazó " "fájlnevek\n" " kiírása\n" " -c, --count csak a kiválasztott sorok számának kiírása, " "FÃJLONKÉNT\n" " -T, --initial-tab sorok feltöltése tabokkal (ha szükséges)\n" " -Z, --null 0 bájt írása a FÃJLNÉV után\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Szövegkörnyezet beállításai:\n" " -B, --before-context=SZÃM SZÃM db. sor kiírása a találat elÅ‘tti " "környezetbÅ‘l\n" " -A, --after-context=SZÃM SZÃM db. sor kiírása a találat utáni " "környezetbÅ‘l\n" " -C, -- context=SZÃM SZÃM darab sor kiírása a környezetbÅ‘l\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -SZÃM ugyanaz, mint a --context=SZÃM\n" " --color[=EKKOR],\n" " --colour[=EKKOR] az illeszkedÅ‘ karakterláncot beszínezi\n" " az EKKOR lehet „alwaysâ€, „never†vagy „autoâ€\n" " -U, --binary nem vágja le a CR karaktereket sor végén\n" " (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Ha a FÃJL a „-â€, akkor a szabványos bemenetrÅ‘l olvas. Ha nincs megadva " "FÃJL,\n" "rekurzív működéskor a „.†egyébként a „-†olvasása. KettÅ‘nél kevesebb FÃJL\n" "megadásakor a -h kapcsolót feltételezi. A kilépési állapot 0, ha bármely " "sor\n" "(vagy fájl a -L kapcsolónál) kiválasztásra kerül, egyébként 1. Ha hiba\n" "történt és a -q nincs megadva, akkor a kilépési állapot 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "ütközÅ‘ illesztÅ‘k lettek megadva" #: src/grep.c:2101 #, fuzzy msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "a -P kapcsoló támogatása nincs belefordítva ebbe a --disable-perl-regexp " "binárisba" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "érvénytelen illesztÅ‘: %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "ismeretlen eszközmódszer" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "érvénytelen maximális szám" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "ismeretlen bináris fájl típus" #: src/grep.c:2829 #, fuzzy msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "mások, lásd: <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "nem sikerült memóriát foglalni a PCRE JIT veremnek" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "a -P csak unibyte és UTF-8 területi beállításokat támogat" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "a -P kapcsoló csak egy mintát támogat" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "belsÅ‘ hiba (soha nem szabadna elÅ‘fordulnia)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "a PCRE sorhossza túllépve" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "elfogyott a memória" #: src/pcresearch.c:310 #, fuzzy, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "kifogyott a PCRE JIT verem" #: src/pcresearch.c:315 #, fuzzy, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "a PCRE visszakövetési korlátja túllépve" #: src/pcresearch.c:319 #, fuzzy, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "a PCRE visszakövetési korlátja túllépve" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "belsÅ‘ PCRE hiba: %d" #, c-format #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "" #~ "figyelem: a GREP_OPTIONS elavult; használjon álnevet vagy parancsfájlt" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "figyelmeztetés: %s: %s" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "A %s honlapja: <https://www.gnu.org/software/%s/>\n" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "érvénytelen %s%s argumentum: „%sâ€" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "érvénytelen utótag a(z) %s%s argumentumban: „%sâ€" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s: a(z) „%s†argumentum túl nagy" #~ msgid "Mike Haertel" #~ msgstr "Mike Haertel" #~ msgid "internal error" #~ msgstr "belsÅ‘ hiba" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: a(z) „--%s†kapcsoló nem enged meg argumentumot\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: a(z) „--%s†kapcsoló ismeretlen\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: a „-W %s†kapcsoló nem egyértelmű\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: a „-W %s†kapcsoló nem enged meg argumentumot\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: a(z) „-W%s†kapcsolóhoz argumentum szükséges\n" #~ msgid "lseek failed" #~ msgstr "az lseek meghiúsult" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "A MINTA egy alapszintű reguláris kifejezés (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "Az „egrep†jelentése „grep -Eâ€. Az „fgrep†jelentése „grep -Fâ€.\n" #~ "A közvetlen hívás „egrep†vagy „fgrep†formában elavult.\n" #~ msgid "unescaped ^ or $ not supported with -Pz" #~ msgstr "a nem escapelt ^ vagy $ nem támogatott a -Pz kapcsolóval" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "A GNU Grep honlapja: <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "érvénytelen UTF-8 bájtsorozat a bemenetben" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "A MINTA egy bÅ‘vített reguláris kifejezés (ERE).\n" #~ msgid "Invocation as 'egrep' is deprecated; use 'grep -E' instead.\n" #~ msgstr "" #~ "A hívás „egrep†formában elavult, használja helyette a „grep -E†alakot.\n" #~ msgid "PATTERN is a set of newline-separated fixed strings.\n" #~ msgstr "A MINTA egy újsorokkal elválasztott rögzített karakterlánc.\n" #~ msgid "Invocation as 'fgrep' is deprecated; use 'grep -F' instead.\n" #~ msgstr "" #~ "A hívás „fgrep†formában elavult, használja helyette a „grep -F†alakot.\n" #~ msgid "%s can only use the %s pattern syntax" #~ msgstr "a(z) %s csak a(z) %s mintaszintaxist tudja használni" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/ga.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000024416�14670377450�016167� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����P������œ��k���������È��Ï���É��÷���™��Õ��‘��¶��g ��U�� �����t �����ˆ ��,���¤ �����Ñ ��.���ñ ��'��� ��(���H�����q�����‘�����“�����—��*���¨�����Ó�����ê����������#��$���;�����`�����r����������ž�����§�����Æ�����Ö��#���ë����������*�����A�����I��&���\�����ƒ�����˜�����ª�����¼�� ���Û�����è�����ý��;�����3���P��/���„��+���´��'���à��#��������,�����L�����h�����x�����z��4���—�����Ì��!���ë��0��� ��-���>��.���l�����›��$���·�����Ü�����÷����������'�����G�����Z�����l�����}�����‘��,���¬��*���Ù�� ����� ����� ��������+�����?�����Y�� ���p��Œ��|��í��� ��1��÷����)��ê��9��þ��$�����#�����>��5���^��!���”��4���¶��2���ë��6��� �����U �����q �����s �����v ��C���‡ �����Ë ��%���ä ��!��� !��$���,!��2���Q!�����„!�� ��� !�����Á!�����Ñ!��'���æ!�����"�����'"�����E"�����e"��-���‚"�����°"�����¿"��;���Ø"�����#�� ���0#�� ���>#�����L#�����g#�����o#�����†#��K���Ÿ#��5���ë#��1���!$��-���S$��)���$��%���«$��!���Ñ$�����ó$�����%�����"%��'���$%��M���L%�� ���š%�����»%��B���Ù%��5���&��I���R&��&���œ&��0���Ã&��'���ô&�����'��$���:'��>���_'�����ž'�����¼'�����Ó'�����ã'�����(��.��� (��)���O(�����y(�����€(�����‡(��(���Ž(��'���·(�����ß(�����ù(����������������������������3���E���K�������������� ��������������#���%�����������9���8���!���D���L���/���-������ ���������M���.�������2���J���������'������6�������)���C���0���*��������������A�������:�������$���"���I���O�������������?���1���=���,������G��� ���7������������������B���H��� ���<����������������������������+���5���(������;�������>���F��� �������N��� ��������������������&�������P���@���4���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name �%s home page: <%s> �%s: invalid option -- '%c' �%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�regular expression too big�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep 3.0.23-b00 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2017-06-25 05:18-0600 Last-Translator: Kevin Scannell <kscanne@gmail.com> Language-Team: Irish <gaeilge-gnulinux@lists.sourceforge.net> Language: ga MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. � Rialú comhthéacs: -B, --before-context=UIMH taispeáin UIMH líne de chomhthéacs tosaigh -A, --after-context=UIMH taispeáin UIMH líne de chomhthéacs deiridh -C, --context=UIMHIR taispeáin UIMHIR líne de chomhthéacs � Roghanna éagsúla: -s, --no-messages ná taispeáin teachtaireachtaí earráide -v, --invert-match taispeáin na línte GAN teaghrán comhoiriúnach -V, --version taispeáin eolas faoin leagan agus scoir --help taispeáin an chabhair seo agus scoir � Rialú aschurtha: -m, --max-count=UIMHIR stop i ndiaidh UIMHIR líne chomhoiriúnach -b, --byte-offset taispeáin an fritháireamh birt san aschur -n, --line-number taispeáin líne-uimhreacha san aschur --line-buffered sruthlú an aschuir i ndiaidh gach líne -H, --with-filename taispeáin ainm comhaid le línte comhoiriúnacha -h, --no-filename ná taispeáin ainmneacha comhad mar réimír --label=LIPÉAD úsáid LIPÉAD mar ainm ar an ngnáth-ionchur � -I ar comhbhrí le '--binary-files=without-match' -d, --directories=MODH modh oibre le haghaidh comhadlanna; MODH = 'read', 'recurse', nó 'skip' -D, --devices=MODH modh oibre le haghaidh gléasanna, FIFOnna, agus soicéid; MODH = 'read' nó 'skip' -r, --recursive ar comhbhrí le '--directories=recurse' -R, --dereference-recursive mar an gcéanna, ach lean naisc shiombalacha � -L, --files-without-match ná taispeáin ach ainmneacha comhaid GAN teaghrán comhoiriúnach -l, --files-with-matches ná taispeáin ach ainmneacha comhaid LE teaghrán comhoiriúnach -c, --count ná taispeáin ach líon na dteaghrán comhoiriúnach i ngach comhad -T, --initial-tab Ailínigh na táib (más gá) -Z, --null priontáil beart '0' i ndiaidh ainm an chomhaid �Leathanach baile %s: <%s> �%s: rogha neamhbhailí -- '%c' �%s: ní cheadaítear argóint i ndiaidh rogha '%s%s' �%s: tá rogha '%s%s' débhríoch �%s: tá rogha '%s%s' débhríoch; féidearthachtaí:�%s: tá argóint de dhíth i ndiaidh rogha '%s%s' �%s: tá argóint de dhíth i ndiaidh na rogha -- '%c' �%s: rogha anaithnid '%s%s' �'�©�(gnáth-ionchur)�Tacaíonn an rogha -P logchaighdeáin aonbhearta agus UTF-8 amháin�Cúltagairt neamhbhailí�Ainm neamhbhailí ar aicme charachtar�Carachtar neamhbhailí cóimheasa�Ãbhar neamhbhailí laistigh de \{\}�Tá an slonn ionadaíochta roimhe seo neamhbhailí�Deireadh raoin neamhbhailí�Slonn ionadaíochta neamhbhailí�Cuimhne ídithe�Níl a leithéid ann�Níl aon slonn ionadaíochta roimhe seo�Arna phacáistiú ag %s �Arna phacáistiú ag %s (%s) �Deireadh an tsloinn gan choinne�Slonn ionadaíochta rómhór�Seol tuairiscí ar fhabhtanna i %s chuig: %s �D'éirigh leis�Cúlslais ag an deireadh�Bain triail as '%s --help' chun tuilleadh eolais a fháil. �Earráid anaithnid chórais�( nó \( corr�) nó \) corr�[, [^, [:, [., nó [= corr�\{ corr�Na hargóintí bailí:�Scríofa ag %s agus %s. �Scríofa ag %s, %s, %s, %s, %s, %s, %s, %s, %s, agus daoine eile nach iad. �Scríofa ag %s, %s, %s, %s, %s, %s, %s, %s, agus %s. �Scríofa ag %s, %s, %s, %s, %s, %s, %s, agus %s. �Scríofa ag %s, %s, %s, %s, %s, %s, agus %s. �Scríofa ag %s, %s, %s, %s, %s, agus %s. �Scríofa ag %s, %s, %s, %s, agus %s. �Scríofa ag %s, %s, %s, agus %s. �Scríofa ag %s, %s, agus %s. �Scríofa ag %s. �`�argóint dhébhríoch %s le haghaidh %s�Is é [[:space:]] an chomhréir cheart in aicme carachtar, in ionad [:space:]�sonraíodh patrúin chontrártha�sáraíodh uasfhad líne PCRE�níorbh fhéidir cuimhne a dháil le haghaidh na cruaiche PCRE JIT�níorbh fhéidir filleadh ar an mbunchomhadlann oibre�níorbh fhéidir mód téacs/dénártha an tuairisceora comhaid a shocrú�tá an t-ionchur rómhór le háireamh�earráid inmheánach (ní tharlaíonn seo riamh)�argóint neamhbhailí %s le haghaidh %s�Aicme charachtar neamhbhailí�ábhar neamhbhailí laistigh de \{\}�tá an argóint a shonraíonn fad an chomhthéacs neamhbhailí�meaitseálaí neamhbhailí %s�uasmhéid neamhbhailí�cuimhne ídithe�níor sonraíodh aon chomhréir�slonn ionadaíochta rómhór�Ní thacaíonn rogha -P ach le patrún amháin�ní féidir an chomhadlann oibre a fháil�( corr�) corr�[ corr�Seicheamh éalúcháin \ gan chríochnú�cineál anaithnid de chomhad dénártha�modh anaithnid gléasanna�earráid sa scríobh���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/ko.po�����������������������������������������������������������������������0000664�0001750�0001750�00000060641�14670377471�016050� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Korean messages for GNU grep. # This file is distributed under the same license as the grep package. # Copyright (C) 1996, 1997, 2019 Free Software Foundation, Inc. # Bang Jun-Young <bangjy@geocities.com>, 1996-1997. # Seong-ho Cho <darkcircle.0426@gmail.com>, 2019-2021. # msgid "" msgstr "" "Project-Id-Version: GNU grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-10 10:17+0900\n" "Last-Translator: Seong-ho Cho <darkcircle.0426@gmail.com>\n" "Language-Team: Korean <translation-team-ko@googlegroups.com>\n" "Language: ko\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: Poedit 2.3.1\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "%2$s ëŒ€ìƒ ìž˜ëª»ëœ ì¸ìž %1$s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "%2$s ëŒ€ìƒ ëª¨í˜¸í•œ ì¸ìž %1$s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "유효한 ì¸ìžëŠ” 다ìŒê³¼ 같습니다:" #: lib/c-stack.c:187 msgid "program error" msgstr "프로그램 오류" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "ìŠ¤íƒ ì˜¤ë²„í”Œë¡œìš°" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "ê¸°ë¡ ì˜¤ë¥˜" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "ì§ì´ ë§žì§€ 않는 [ 괄호" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "ìž˜ëª»ëœ ë¬¸ìž í´ëž˜ìФ" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "ë¬¸ìž í´ëž˜ìФ 표기 ë°©ì‹ì€ [:space:]ê°€ 아닌 [[:space:]]입니다" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "ë나지 ì•Šì€ \\ ì´ìŠ¤ì¼€ì´í”„ 문ìž" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "ìž˜ëª»ëœ \\{\\} ë‚´ìš©" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "ì •ê·œ 표현ì‹ì´ 너무 ê¹ë‹ˆë‹¤" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "ì§ì´ ë§žì§€ 않는 ( 괄호" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "ë¬¸ë²•ì„ ì§€ì •í•˜ì§€ 않았습니다" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "ì§ì´ ë§žì§€ 않는 ) 괄호" #: lib/error.c:195 msgid "Unknown system error" msgstr "알 수 없는 시스템 오류" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: '%s%s' ì˜µì…˜ì´ ëª¨í˜¸í•©ë‹ˆë‹¤\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: '%s%s' ì˜µì…˜ì´ ëª¨í˜¸í•©ë‹ˆë‹¤ 가능한 ê°’:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: ì¸ì‹í•  수 없는 옵션 '%s%s'\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: '%s%s' ì˜µì…˜ì€ ì¸ìžë¥¼ 허용하지 않습니다\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: '%s%s' ì˜µì…˜ì€ ì¸ìžê°€ 필요합니다\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: ìž˜ëª»ëœ ì˜µì…˜ -- '%c'\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: ì´ ì˜µì…˜ì€ ì¸ìžê°€ 필요합니다 -- '%c'\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "메모리가 바닥남" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "현재 작업 디렉터리를 기ë¡í•  수 없습니다" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "초기 작업 디렉터리 ë°˜í™˜ì— ì‹¤íŒ¨í–ˆìŠµë‹ˆë‹¤" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "í…스트/ë°”ì´ë„ˆë¦¬ 모드 íŒŒì¼ ì„œìˆ ìž ì„¤ì •ì— ì‹¤íŒ¨í–ˆìŠµë‹ˆë‹¤" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "성공" #: lib/regcomp.c:138 msgid "No match" msgstr "ì¼ì¹˜ 항목 ì—†ìŒ" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "ìž˜ëª»ëœ ì •ê·œ 표현ì‹" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "ìž˜ëª»ëœ ì¡°í•© 문ìž" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "ìž˜ëª»ëœ ë¬¸ìž í´ëž˜ìФ ì´ë¦„" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "ë°± 슬래시 문ìžê°€ ë”°ë¼ì˜´" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "ìž˜ëª»ëœ í›„ìœ„ 참조" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "ì¼ì¹˜í•˜ì§€ 않는 [, [^, [:, [., [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "ì¼ì¹˜í•˜ì§€ 않는 ( ë˜ëŠ” \\( 괄호" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "ì¼ì¹˜í•˜ì§€ 않는 \\{ 괄호" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "ìž˜ëª»ëœ \\{\\} ë‚´ìš©" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "ìž˜ëª»ëœ ë²”ìœ„ ë" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "메모리가 바닥남" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "ìž˜ëª»ëœ ì„ í–‰ ì •ê·œ 표현ì‹" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "ì •ê·œ í‘œí˜„ì‹ ë§ˆê° í‘œí˜„ì´ ì•žì„œìžˆìŠµë‹ˆë‹¤" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "ì •ê·œ 표현ì‹ì´ 너무 ê¹ë‹ˆë‹¤" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "ì¼ì¹˜í•˜ì§€ 않는 ) ë˜ëŠ” \\) 괄호" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "ì´ì „ ì •ê·œ í‘œí˜„ì‹ ì—†ìŒ" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "%sì´(ê°€) 패키징 함 (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "%sì´(ê°€) 패키징 함\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "GPLv3+ ë¼ì´ì„ ìФ: GNU GPL 버전 3 ì´ìƒ <%s>.\n" "ì´ í”„ë¡œê·¸ëž¨ì€ ìžìœ  소프트웨어입니다: ìžìœ ë¡­ê²Œ 바꾸고 재배í¬í•  수 있습니다.\n" "ë²•ë¥ ì´ í—ˆìš©í•˜ëŠ” 모든 ë²”ìœ„ë‚´ì˜ ë³´ì¦ì€ 없습니다.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "%sì´(ê°€) 작성함.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "%s와(ê³¼) %sì´(ê°€) 작성함.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "%s와(ê³¼) %s, %sì´(ê°€) 작성함.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "%s와(ê³¼) %s, %s,\n" "%sì´(ê°€) 작성함.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "%s와(ê³¼) %s, %s,\n" "%s, %sì´(ê°€) 작성함.\n" "\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "%s와(ê³¼) %s, %s,\n" "%s, %s, %sì´(ê°€) 작성함.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "%s와(ê³¼) %s, %s,\n" "%s, %s, %s,\n" "%sì´(ê°€) 작성함.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "%s와(ê³¼) %s, %s,\n" "%s, %s, %s,\n" "%s, %sì´(ê°€) 작성함.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "%s와(ê³¼) %s, %s,\n" "%s, %s, %s,\n" "%s, %s, %sì´(ê°€) 작성함.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "%s, %s, %s,\n" "%s, %s, %s,\n" "%s, %s, %s\n" "외 다수가 작성함.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "버그 ë³´ê³  주소: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "%s 버그 ë³´ê³  주소: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s 홈 페ì´ì§€: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "GNU 소프트웨어 활용 ì¼ë°˜ ë„움ë§: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(표준 ìž…ë ¥)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "ìž˜ëª»ëœ ë‚´ìš© ê¸¸ì´ ì¸ìž" #: src/grep.c:894 msgid "input is too large to count" msgstr "ìž…ë ¥ í–‰ 수를 ì„¸ê¸°ì— ë„ˆë¬´ 많습니다" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: ë°”ì´ë„ˆë¦¬ íŒŒì¼ ì¼ì¹˜í•¨" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: 경고: 재귀 디렉터리 순환" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: ìž…ë ¥ 파ì¼ì€ 출력 대ìƒì´ê¸°ë„ 합니다" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "사용법: %s [<옵션>]... <패턴> [<파ì¼>]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "ìžì„¸í•œ 정보는 '%s --help'를 입력하십시오.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "ê° <파ì¼>ì—서 <패턴>ì— ì¼ì¹˜í•˜ëŠ” í–‰ì„ ê²€ìƒ‰í•©ë‹ˆë‹¤.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "예제: %s -i 'hello world' menu.h main.c\n" "<패턴>ì—는 개행 문ìžë¡œ 구분한 여러 íŒ¨í„´ì„ ë„£ì„ ìˆ˜ 있습니다.\n" "\n" "패턴 ì„ íƒ ë° í•´ì„:\n" "\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp <패턴>ì€ í™•ìž¥ ì •ê·œ 표현ì‹ìž…니다\n" " -F, --fixed-strings <패턴>ì€ ë‹¨ìˆœ 문ìžì—´ìž…니다\n" " -G, --basic-regexp <패턴>ì€ ê¸°ë³¸ ì •ê·œ 표현ì‹ìž…니다\n" " -P, --perl-regexp <패턴>ì€ íŽ„ ì •ê·œ 표현ì‹ìž…니다\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=<패턴> ì¼ì¹˜í•˜ëŠ” ë¶€ë¶„ì„ ì°¾ì„ <패턴> ê¸°ì¤€ì„ í™œìš©í•©ë‹ˆë‹¤\n" " -f, --file=<파ì¼> <파ì¼>ì—서 <패턴>ì— ì¼ì¹˜í•˜ëŠ” ë¶€ë¶„ì„ ì·¨í•©ë‹ˆë‹¤\n" " -i, --ignore-case ëŒ€ì†Œë¬¸ìž êµ¬ë¶„ì„ ë¬´ì‹œí•©ë‹ˆë‹¤\n" " --no-ignore-case ëŒ€ì†Œë¬¸ìž êµ¬ë¶„ì„ ìœ ì§€í•©ë‹ˆë‹¤(기본값)\n" " -w, --word-regexp 주어진 단어와 완벽하게 ì¼ì¹˜í•˜ëŠ” 부분만\n" " -x, --line-regexp 주어진 í–‰ 내용과 완벽하게 ì¼ì¹˜í•˜ëŠ” 부분만\n" " -z, --null-data ë°ì´í„° í–‰ì˜ ëì€ ê°œí–‰ 문ìžê°€ 아닌 0ë°”ì´íЏ 값으로 " "ë납니다\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "기타:\n" " -s, --no-messages 오류 메시지 ì¶œë ¥ì„ ìƒëžµí•©ë‹ˆë‹¤\n" " -v, --invert-match ì¡°ê±´ì— ì¼ì¹˜í•˜ì§€ 않는 í–‰ì„ ì„ íƒí•©ë‹ˆë‹¤\n" " -V, --version 버전 정보를 나타내고 ë¹ ì ¸ 나갑니다\n" " --help ì´ ë„ì›€ë§ í…스트를 나타내고 ë¹ ì ¸ 나갑니다\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "출력 제어:\n" " -m, --max-count=<횟수> <횟수> ë§Œí¼ í–‰ì„ ì°¾ì•„ë‚´ê³  나면 멈춤\n" " -b, --byte-offset 출력 í–‰ì˜ ë°”ì´íЏ ì˜¤í”„ì…‹ì„ ì¶œë ¥í•©ë‹ˆë‹¤\n" " -n, --line-number 출력 í–‰ì˜ í–‰ 번호를 출력합니다\n" " --line-buffered 모든 í–‰ì˜ ì¶œë ¥ì„ í”ŒëŸ¬ì‹±í•©ë‹ˆë‹¤\n" " -H, --with-filename 출력 í–‰ì— íŒŒì¼ ì´ë¦„ì„ ì¶œë ¥í•©ë‹ˆë‹¤\n" " -h, --no-filename 출력 í–‰ ì•žë¶€ë¶„ì˜ íŒŒì¼ ì´ë¦„ 표시를 ìƒëžµí•©ë‹ˆë‹¤ \n" " --label=<ë ˆì´ë¸”> <ë ˆì´ë¸”>ì„ í‘œì¤€ ìž…ë ¥ ì•žë¶€ë¶„ì˜ íŒŒì¼ ì´ë¦„으로 사용" "합니다\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching ì¡°ê±´ì— ì¼ì¹˜í•˜ëŠ” í–‰ì´ ë¹„ì–´ìžˆì§€ ì•Šì€ ê²°ê³¼ë§Œ 나타냅" "니다\n" " -q, --quiet, --silent 모든 ì¼ë°˜ 출력 ë™ìž‘ì„ ìƒëžµí•©ë‹ˆë‹¤\n" " --binary-files=<형ì‹> ë°”ì´ë„ˆë¦¬ 파ì¼ì„ 지정한 <형ì‹>으로 간주합니다\n" " <형ì‹> ê°’ì€ 'binary', 'text', 'without-match' 중 " "하나입니다\n" " -a, --text --binary-files=text 옵션과 ë™ì¼\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I --binary-files=without-match 옵션과 ë™ì¼\n" " -d, --directories=<ë™ìž‘> 디렉터리 처리 ë°©ì‹\n" " <ë™ìž‘> ê°’ì€ 'read', 'recurse', 'skip' 중 하나입니" "다\n" " -D, --devices=<ë™ìž‘> 장치, FIFO, 소켓 처리 ë°©ì‹\n" " <ë™ìž‘> ê°’ì€ 'read', 'skip' 중 하나입니다\n" " -r, --recursive --directories=recurse와 유사\n" " -R, --dereference-recursive 위 옵션과 비슷하지만 모든 심볼릭 ë§í¬ë¥¼ ë”°ë¼ê°‘" "니다\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=<글롭> <글롭>(íŒŒì¼ íŒ¨í„´)ì— ì¼ì¹˜í•˜ëŠ” 파ì¼ë§Œ 검색합니" "다\n" " --exclude=<글롭> <글롭>ì— ì¼ì¹˜í•˜ëŠ” 파ì¼ì„ 건너ëœë‹ˆë‹¤\n" " --exclude-from=<파ì¼> <파ì¼>ê³¼ íŒŒì¼ íŒ¨í„´ì´ ì¼ì¹˜í•˜ëŠ” 파ì¼ì„ 건너ëœë‹ˆ" "다\n" " --exclude-dir=<글롭> <글롭>ê³¼ ì¼ì¹˜í•˜ëŠ” 디렉터리를 건너ëœë‹ˆë‹¤\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match ì¼ì¹˜í•˜ëŠ” í–‰ì´ ì—†ìœ¼ë©´ <파ì¼>ì˜ ì´ë¦„ë§Œ 출력합니다\n" " -l, --files-with-matches ì¼ì¹˜í•˜ëŠ” í–‰ì´ ìžˆëŠ” <파ì¼>ì˜ ì´ë¦„ë§Œ 출력합니다\n" " -c, --count <파ì¼>ì— ì¼ì¹˜í•˜ëŠ” í–‰ 갯수만 출력합니다\n" " -T, --initial-tab (필요한 경우) í–‰ 별로 íƒ­ì„ í‘œì‹œí•©ë‹ˆë‹¤\n" " -Z, --null <파ì¼> ì´ë¦„ ë’¤ì— 0 ë°”ì´íЏ ê°’ì„ ì¶œë ¥í•©ë‹ˆë‹¤\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "문맥 제어:\n" " -B, --before-context=<갯수> <갯수> 줄 ìˆ˜ë§Œí¼ ì¶œë ¥ ë‚´ìš©ì˜ ì•žë¶€ë¶„ì„ ì¶œë ¥í•©ë‹ˆ" "다\n" " -A, --after-context=<갯수> <갯수> 줄 ìˆ˜ë§Œí¼ ì¶œë ¥ ë‚´ìš©ì˜ ë’·ë¶€ë¶„ì„ ì¶œë ¥í•©ë‹ˆ" "다\n" " -C, --context=<갯수> <갯수> 줄 수 ë§Œí¼ ì¶œë ¥ ë‚´ìš© 앞 ë’¤ ë¶€ë¶„ì„ ëª¨ë‘ " "출력합니다 \n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM --context=<갯수>와 ë™ì¼\n" " --group-separator=<구분ìž> ë¬¸ë§¥ìƒ ì¼ì¹˜í•˜ëŠ” í–‰ì„ <구분ìž> 출력으로 구" "ë¶„\n" " --no-group-separator ì¼ì¹˜ ë¬¸ë§¥ì— ëŒ€í•œ 구분ìžë¥¼ 출력하지 않습니다\n" " --color[=<시기>],\n" " --colour[=<시기>] ì¼ì¹˜í•˜ëŠ” 문ìžì—´ 강조시 마커를 활용합니다\n" " <시기>ì˜ ê°’ì€ 'always', 'never', 'auto' 중 하나입" "니다\n" " -U, --binary 개행 문ìžì—서 CR 문ìžë¥¼ 빼내지 않ìŒ(MSDOS/윈ë„" "ìš°)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "<파ì¼> ê°’ì´ '-' ì´ë©´, 표준 ìž…ë ¥ì„ ì½ìŠµë‹ˆë‹¤. <파ì¼>ì— ì•„ë¬´ëŸ° ê°’ì´ ì—†ë‹¤ë©´,\n" "재귀 íƒìƒ‰ ì˜µì…˜ì„ ì£¼ì—ˆì„ ê²½ìš° 현재 디렉터리를, 그렇지 않으면 '-' ê°’ì„ ì„¤ì •" "함\n" "으로 가정합니다. <파ì¼> 갯수가 í•œê°œì¼ ê²½ìš° -h ì˜µì…˜ì„ ì¤€ 것으로 가정합니다.\n" "ì¡°ê±´ ì¼ì¹˜ í–‰ì´ ë‚˜ì˜¤ë©´, ë내기 ìƒíƒœ ê°’ì€ 0ì„, 그렇지 않으면 1ì„ ë°˜í™˜í•©ë‹ˆë‹¤.\n" "오류가 나타났거나 -q ì˜µì…˜ì„ ì£¼ì§€ 않았다면, 2를 반환합니다.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "ë¹„êµ ê¸°ì¤€ì„ ì¤‘ë³µ 지정했습니다" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "--disable-perl-regexp 빌드ì—서는 Perl 문ìžì—´ ì¼ì¹˜ ê¸°ëŠ¥ì„ ì§€ì›í•˜ì§€ 않습니다" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "ìž˜ëª»ëœ ë¹„êµ ê¸°ì¤€ %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "알 수 없는 장치 ë°©ì‹" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "경고: --unix-byte-offsets (-u) ì˜µì…˜ì€ ì˜¤ëž˜ë˜ì—ˆìŠµë‹ˆë‹¤" #: src/grep.c:2686 msgid "invalid max count" msgstr "ìž˜ëª»ëœ ìµœëŒ€ 갯수" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "알 수 없는 ë°”ì´ë„ˆë¦¬ íŒŒì¼ í˜•ì‹" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Mike Haertel ë“±ì´ ìž‘ì„±í•¨. 기타 ìž‘ì„±ìž ì •ë³´ëŠ”\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS> ë§í¬ë¥¼ 참고하십시오." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "PCRE JIT 스íƒì˜ 메모리 í• ë‹¹ì— ì‹¤íŒ¨í–ˆìŠµë‹ˆë‹¤" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P 유니바ì´íЏ, UTF-8 로캘만 ì§€ì›í•©ë‹ˆë‹¤" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "-P ì˜µì…˜ì€ ë‹¨ì¼ íŒ¨í„´ë§Œ ì§€ì›í•©ë‹ˆë‹¤" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "ë‚´ë¶€ 오류 (나타나면 안ë¨)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "PCRE í–‰ ê¸¸ì´ í•œê³„ 초과" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: 메모리가 바닥남" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: PCRE JIT ìŠ¤íƒ ê°€ë“ ì°¸" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: PCRE 후위 ì¶”ì  í•œê³„ 초과" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: PCRE 후위 ì¶”ì  í•œê³„ 초과" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: ë‚´ë¶€ PCRE 오류: %d" �����������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/th.po�����������������������������������������������������������������������0000664�0001750�0001750�00000100305�14670377471�016042� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Translation of grep messages to Thai. # Copyright (C) 2018 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # Seksan Poltree <seksan.poltree@gmail.com>, 2009-2018. # msgid "" msgstr "" "Project-Id-Version: grep-3.1.48\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2018-12-17 01:11+0700\n" "Last-Translator: Seksan Poltree <seksan.poltree@gmail.com>\n" "Language-Team: Thai <thai-l10n@googlegroups.com>\n" "Language: th\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "อาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ %s ไม่ถูà¸à¸•้องสำหรับ %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "อาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ %s à¸à¸³à¸à¸§à¸¡à¹„ม่ชัดเจน สำหรับ %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "อาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ที่ใช้ได้ ได้à¹à¸à¹ˆ:" #: lib/c-stack.c:187 msgid "program error" msgstr "โปรà¹à¸à¸£à¸¡à¸œà¸´à¸”พลาด" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "stack overflow" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "à¸à¸²à¸£à¹€à¸‚ียนผิดพลาด" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "[ ไม่สมดุลà¸à¸±à¸™" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "ชื่อà¸à¸¥à¸¸à¹ˆà¸¡à¸Šà¸¸à¸”อัà¸à¸‚ระไม่ถูà¸à¸•้อง" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "วาà¸à¸¢à¸ªà¸±à¸¡à¸žà¸±à¸™à¸˜à¹Œà¸‚องà¸à¸¥à¸¸à¹ˆà¸¡à¸Šà¸¸à¸”อัà¸à¸‚ระ คือ [[:space:]], ไม่ใช่ [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "เครื่องหมายหลีภ\\ ไม่จบ" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "เนื้อหาของ \\{\\} ไม่ถูà¸à¸•้อง" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "นิพจน์ปà¸à¸•ิใหà¸à¹ˆà¹€à¸à¸´à¸™à¹„ป" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "( ไม่สมดุลà¸à¸±à¸™" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "ไม่ระบุวาà¸à¸¢à¸ªà¸±à¸¡à¸žà¸±à¸™à¸˜à¹Œ" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr ") ไม่สมดุลà¸à¸±à¸™" #: lib/error.c:195 msgid "Unknown system error" msgstr "ข้อผิดพลาดของระบบที่ไม่รู้จัà¸" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: ตัวเลือภ'%s%s' คลุมเครือไม่ชัดเจน\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: ตัวเลือภ'%s%s' คลุมเครือไม่ชัดเจน; เป็นไปได้ที่จะเป็น:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: ตัวเลือà¸à¸—ี่ไม่รู้จัภ'%s%s'\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: ตัวเลือภ'%s%s' ไม่อนุà¸à¸²à¸•ให้มีอาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: ตัวเลือภ'%s%s' ต้องà¸à¸²à¸£à¸­à¸²à¸£à¹Œà¸à¸´à¸§à¹€à¸¡à¸™à¸•์\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: ตัวเลือà¸à¹„ม่ถูà¸à¸•้อง -- '%c'\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: ตัวเลือà¸à¸•้องà¸à¸²à¸£à¸­à¸²à¸£à¹Œà¸à¸´à¸§à¹€à¸¡à¸™à¸•์ -- '%c'\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "หน่วยความจำถูà¸à¹ƒà¸Šà¹‰à¸ˆà¸™à¸«à¸¡à¸”" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "ไม่สามารถบันทีà¸à¹„ดเรà¸à¸—อรีที่ทำงานปัจจุบัน" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "ล้มเหลวในà¸à¸²à¸£à¸à¸¥à¸±à¸šà¹„ปยังไดเรà¸à¸—อรีทำงานเริ่มต้น" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "ล้มเหลวในà¸à¸²à¸£à¸•ั้งค่าตัวอธิบายไฟล์ในโหมดข้อความ/ไบนารี" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "สำเร็จ" #: lib/regcomp.c:138 msgid "No match" msgstr "ไม่ตรงà¸à¸±à¸™" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "นิพจน์ปà¸à¸•ิไม่ถูà¸à¸•้อง" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "ผลà¸à¸²à¸£à¹€à¸—ียบà¸à¸±à¸™à¸‚องอัà¸à¸‚ระผิดพลาด" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "ชื่อà¸à¸¥à¸¸à¹ˆà¸¡à¸Šà¸¸à¸”อัà¸à¸‚ระไม่ถูà¸à¸•้อง" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "เครื่องหมายà¹à¸šà¹‡à¸„สà¹à¸¥à¸Šà¸•ามท้าย" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "à¸à¸²à¸£à¸­à¹‰à¸²à¸‡à¸­à¸´à¸‡à¸à¸¥à¸±à¸šà¹„ม่ถูà¸à¸•้อง" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "ไม่ตรงà¸à¸±à¸™à¸à¸±à¸š [, [^, [:, [., หรือ [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "ไม่ตรงà¸à¸±à¸™à¸à¸±à¸š ( หรือ \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "ไม่ตรงà¸à¸±à¸™à¸à¸±à¸š \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "เนื้อหาของ \\{\\} ไม่ถูà¸à¸•้อง" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "ช่วงจบไม่ถูà¸à¸•้อง" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "หน่วยความจำถูà¸à¹ƒà¸Šà¹‰à¸ˆà¸™à¸«à¸¡à¸”" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "นิพจน์ปà¸à¸•ิà¸à¹ˆà¸­à¸™à¸«à¸™à¹‰à¸²à¹„ม่ถูà¸à¸•้อง" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "นิพจน์ปà¸à¸•ิจบโดยยังไม่สมบูรณ์" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "นิพจน์ปà¸à¸•ิใหà¸à¹ˆà¹€à¸à¸´à¸™à¹„ป" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "ไม่ตรงà¸à¸±à¸™à¸à¸±à¸š ) หรือ \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "ไม่มีนิพจน์ปà¸à¸•ิà¸à¹ˆà¸­à¸™à¸«à¸™à¹‰à¸²" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "สร้างà¹à¸žà¸à¹€à¸à¸ˆà¹‚ดย %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "สร้างà¹à¸žà¸à¹€à¸à¸ˆà¹‚ดย %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, fuzzy, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "\n" "สัà¸à¸à¸²à¸­à¸™à¸¸à¸à¸²à¸• GPLv3+: GNU GPL รุ่น 3 หรือใหม่à¸à¸§à¹ˆà¸² <http://www.gnu.org/licenses/gpl." "html>\n" "นี่เป็นซอฟต์à¹à¸§à¸£à¹Œà¹€à¸ªà¸£à¸µ: คุณมีเสรีในà¸à¸²à¸£à¸›à¸£à¸±à¸šà¹€à¸›à¸¥à¸µà¹ˆà¸¢à¸™à¹à¸¥à¸°à¸à¸²à¸£à¸ªà¹ˆà¸‡à¸•่อมัน.\n" "มีà¸à¸²à¸£à¹„ม่รับประà¸à¸±à¸™, จาà¸à¸‚อบเขตที่อนุà¸à¸²à¸•โดยà¸à¸Žà¸«à¸¡à¸²à¸¢.\n" "\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "เขียนโดย %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "เขียนโดย %s à¹à¸¥à¸° %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "เขียนโดย %s, %s, à¹à¸¥à¸° %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "เขียนโดย %s, %s, %s,\n" "à¹à¸¥à¸° %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "เขียนโดย %s, %s, %s,\n" "%s, à¹à¸¥à¸° %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "เขียนโดย %s, %s, %s,\n" "%s, %s, à¹à¸¥à¸° %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "เขียนโดย %s, %s, %s,\n" "%s, %s, %s, à¹à¸¥à¸° %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "เขียนโดย %s, %s, %s,\n" "%s, %s, %s, %s,\n" "à¹à¸¥à¸° %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "เขียนโดย %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, à¹à¸¥à¸° %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "เขียนโดย %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, à¹à¸¥à¸°à¸„ณะ.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "รายงานข้อผิดพลาดไปยัง: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "รายงานข้อผิดพลาดของ %s ไปยัง: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "โฮมเพจของ %s : <%s>\n" #: lib/version-etc.c:260 #, fuzzy, c-format msgid "General help using GNU software: <%s>\n" msgstr "ความช่วยเหลือทั่วไปในà¸à¸²à¸£à¹ƒà¸Šà¹‰à¸‹à¸­à¸Ÿà¸•์à¹à¸§à¸£à¹Œ GNU: <https://www.gnu.org/gethelp/>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(นำเข้ามาตรà¸à¸²à¸™)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "ความยาวบริบทอาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ไม่ถูà¸à¸•้อง" #: src/grep.c:894 msgid "input is too large to count" msgstr "ข้อมูลเข้ายาวเà¸à¸´à¸™à¸à¸§à¹ˆà¸²à¸ˆà¸°à¸™à¸±à¸šà¹„ด้" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "ตรงà¸à¸±à¸™à¸à¸±à¸™à¸à¸±à¸šà¹à¸Ÿà¹‰à¸¡à¸à¸²à¸™à¸ªà¸­à¸‡ %s\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "เรียà¸à¸‹à¹‰à¸³à¹„ดเรà¸à¸—อรีเป็นวงวน" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "à¹à¸Ÿà¹‰à¸¡à¸™à¸³à¹€à¸‚้า %s เป็นà¹à¸Ÿà¹‰à¸¡à¸ªà¹ˆà¸‡à¸­à¸­à¸à¸”้วยเหมือนà¸à¸±à¸™" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "วิธีใช้: %s [OPTION]… PATTERNS [FILE]…\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "ลองใช้ '%s --help' เพื่อข้อมูลเพิ่มเติม.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "ค้นหาสำหรับ PATTERNS ในà¹à¸•่ละ FILE.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "ตัวอย่าง: %s -i 'hello world' menu.h main.c\n" "PATTERNS สามารถประà¸à¸­à¸šà¸”้วยหลายรูปà¹à¸šà¸šà¹‚ดยà¹à¸¢à¸à¸”้วยตัวขึ้นบรรทัดใหม่\n" "\n" "à¸à¸²à¸£à¹€à¸¥à¸·à¸­à¸à¸™à¸´à¸žà¸ˆà¸™à¹Œà¸›à¸à¸•ิà¹à¸¥à¸°à¸à¸²à¸£à¹à¸›à¸¥à¸„วามหมาย:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp PATTERNS เป็นส่วนขยายนิพจน์ปà¸à¸•ิ\n" " -F, --fixed-strings PATTERNS เป็นชุดสายอัà¸à¸‚ระ\n" " -G, --basic-regexp PATTERNS เป็นนิพจน์ปà¸à¸•ิพื้นà¸à¸²à¸™ (BRE)\n" " -P, --perl-regexp PATTERNS เป็นนิพจน์ปà¸à¸•ิภาษา Perl\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=PATTERN ใช้ PATTERNS สำหรับà¸à¸²à¸£à¸ˆà¸±à¸šà¸„ู่à¸à¸±à¸™\n" " -f, --file=FILE รับ PATTERNS มาจาภFILE\n" " -i, --ignore-case เพิà¸à¹€à¸‰à¸¢à¸•่อความà¹à¸•à¸à¸•่างอัà¸à¸©à¸£à¹ƒà¸«à¸à¹ˆà¹€à¸¥à¹‡à¸\n" " -w, --word-regexp บังคับให้จับคู่เฉพาะที่ตรงà¸à¸±à¸™à¸—ั้งคำเท่านั้น\n" " -x, --line-regexp บังคับให้จับคู่เฉพาะที่ตรงà¸à¸±à¸™à¸—ั้งบรรทัดเท่าทั้น\n" " -z, --null-data ข้อมูลบรรทัดจบด้วยขนาด 0 ไบต์, ไม่มีตัวขึ้นบรรทัดใหม่\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "เบ็ดเตล็ด:\n" " -s, --no-messages ระงับข้อความà¹à¸ªà¸”งข้อผิดพลาด\n" " -v, --invert-match เลือà¸à¸šà¸£à¸£à¸—ัดที่ไม่ตรงà¸à¸±à¸™\n" " -V, --version พิมพ์ข้อมูลรุ่นà¹à¸¥à¹‰à¸§à¸­à¸­à¸\n" " --help à¹à¸ªà¸”งความช่วยเหลือนี้à¹à¸¥à¹‰à¸§à¸­à¸­à¸\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "ควบคุมà¸à¸²à¸£à¸™à¸³à¸­à¸­à¸:\n" " -m, --max-count=NUM หยุดหลังจาà¸à¸¡à¸µ NUM บรรทัดที่ถูà¸à¹€à¸¥à¸·à¸­à¸\n" " -b, --byte-offset พิมพ์à¸à¸²à¸£à¸Šà¸”เชยไบต์à¸à¸±à¸šà¸šà¸£à¸£à¸—ัดนำออà¸\n" " -n, --line-number พิมพ์หมายเลขบรรทัดà¸à¸±à¸šà¸šà¸£à¸£à¸—ัดนำออà¸\n" " --line-buffered ล้างนำออà¸à¸šà¸™à¸—ุภๆ บรรทัด\n" " -H, --with-filename พิมพ์ชื่อà¹à¸Ÿà¹‰à¸¡à¸à¸±à¸šà¸šà¸£à¸£à¸—ัดนำออà¸\n" " -h, --no-filename ระงับคำนำหน้าชื่อà¹à¸Ÿà¹‰à¸¡à¹ƒà¸™à¸à¸²à¸£à¸™à¸³à¸­à¸­à¸\n" " --label=LABEL ใช้ LABEL เป็นชื่อคำนำหน้าà¹à¸Ÿà¹‰à¸¡à¸ªà¸³à¸«à¸£à¸±à¸šà¸™à¸³à¹€à¸‚้ามาตรà¸à¸²à¸™\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching à¹à¸ªà¸”งเพียงà¹à¸•่ส่วนของบรรทัดที่ไม่ว่างเปล่าของบรรทัดที่ตรงà¸à¸±à¸™\n" " -q, --quiet, --silent ระงับนำออà¸à¸›à¸à¸•ิทั้งหมด\n" " --binary-files=TYPE ทึà¸à¸—ัà¸à¹€à¸­à¸²à¸§à¹ˆà¸²à¹à¸Ÿà¹‰à¸¡à¸à¸²à¸™à¸ªà¸­à¸‡à¹€à¸›à¹‡à¸™ TYPE;\n" " TYPE เป็น 'binary', 'text', หรือ 'without-match'\n" " -a, --text มีค่าเท่าà¸à¸±à¸™à¸à¸±à¸š --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I มีค่าเท่าà¸à¸±à¸™à¸à¸±à¸š --binary-files=without-match\n" " -d, --directories=ACTION จะทำà¸à¸²à¸£à¸ˆà¸±à¸”à¸à¸²à¸£à¹„ดเรà¸à¸—อรีอย่างไร;\n" " ACTION เป็น 'read', 'recurse', หรือ 'skip'\n" " -D, --devices=ACTION จะทำà¸à¸²à¸£à¸ˆà¸±à¸”à¸à¸²à¸£à¸­à¸¸à¸›à¸à¸£à¸“์อย่างไร, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive เหมือนà¸à¸±à¸š --directories=recurse\n" " -R, --dereference-recursive เช่นà¸à¸±à¸™, à¹à¸•่ตาม symlink ทั้งหมด\n" #: src/grep.c:2023 #, fuzzy, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=GLOB ค้นหาเพียงà¹à¸•่à¹à¸Ÿà¹‰à¸¡à¸—ี่ตรงà¸à¸±à¸™à¸à¸±à¸š GLOB(รูปà¹à¸šà¸šà¸Šà¸·à¹ˆà¸­à¹„ฟล์)\n" " --exclude=GLOB ข้ามà¹à¸Ÿà¹‰à¸¡à¹à¸¥à¸°à¹„ดเร็à¸à¸—อรีที่ตรงà¸à¸±à¸™à¸à¸±à¸š GLOB\n" " --exclude-from=FILE ข้ามà¹à¸Ÿà¹‰à¸¡à¸—ี่ตรงà¸à¸±à¸™à¸à¸±à¸šà¹à¸šà¸šà¹à¸œà¸™à¹à¸Ÿà¹‰à¸¡à¸ˆà¸²à¸ FILE\n" " --exclude-dir=GLOB ข้ามไดเร็à¸à¸—อรีที่ตรงà¸à¸±à¸™à¸à¸±à¸š GLOB\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match พิมพ์เพียงà¹à¸„่ชื่อของ FILEs ที่ไม่ตรงà¸à¸±à¸™à¸à¸±à¸šà¸šà¸£à¸£à¸—ัดที่ถูà¸à¹€à¸¥à¸·à¸­à¸\n" " -l, --files-with-matches พิมพ์เพียงà¹à¸„่ชื่อของ FILEs à¸à¸±à¸šà¸šà¸£à¸£à¸—ัดที่ถูà¸à¹€à¸¥à¸·à¸­à¸\n" " -c, --count พิมพ์เพียงà¹à¸•่จำนวนบรรทัดที่ตรงà¸à¸±à¸™à¸—ี่นับได้ในà¹à¸•่ละ FILE\n" " -T, --initial-tab ทำà¸à¸²à¸£à¸ˆà¸±à¸”เตรียมà¹à¸—็บ (ถ้าจำเป็น)\n" " -Z, --null พิมพ์ 0 ไบต์หลังชื่อ FILE\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "ควบคุมบริบท:\n" " -B, --before-context=NUM พิมพ์ NUM บรรทัดของบริบทส่วนนำ\n" " -A, --after-context=NUM พิมพ์ NUM บรรทัดของบริบทส่วนตาม\n" " -C, --context=NUM พิมพ์ NUM บรรทัดของบริบทส่งออà¸\n" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM เหมือนà¸à¸±à¸š --context=NUM\n" " --color[=WHEN],\n" " --colour[=WHEN] ใช้เครื่องหมายà¸à¸³à¸à¸±à¸šà¹€à¸žà¸·à¹ˆà¸­à¹€à¸™à¹‰à¸™à¸ªà¸²à¸¢à¸­à¸±à¸à¸‚ระที่ตรงà¸à¸±à¸™;\n" " เมื่อ WHEN ได้à¹à¸à¹ˆ 'always', 'never', หรือ 'auto'\n" " -U, --binary ไม่ต้องถอดอัà¸à¸‚ระ CR ที่ EOL (MSDOS/Windows)\n" "\n" #: src/grep.c:2052 #, fuzzy, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "เมื่อ FILE เป็น -, อ่านจาà¸à¸™à¸³à¹€à¸‚้ามาตรà¸à¸²à¸™. à¸à¸±à¸šà¹„ม่มี FILE อ่าน. ถ้าเรียà¸à¸‹à¹‰à¸³\n" ", - à¹à¸—น. ถ้าให้ FILE มาน้อยà¸à¸§à¹ˆà¸²à¸ªà¸­à¸‡. ทึà¸à¸—ัà¸à¹€à¸­à¸²à¸§à¹ˆà¸²à¹€à¸›à¹‡à¸™ -h\n" "สถานะà¸à¸²à¸£à¸­à¸­à¸à¹€à¸›à¹‡à¸™ 0 เมื่อบรรทัดใด ๆ (หรือ ไฟล์ถ้า -L)ถูà¸à¹€à¸¥à¸·à¸­à¸, 1à¹à¸—น ;\n" "ถ้าเà¸à¸´à¸”ข้อผิดพลาดขึ้นà¹à¸¥à¸° -q ไม่ได้ถูà¸à¹ƒà¸«à¹‰à¸¡à¸², สถานะà¸à¸²à¸£à¸­à¸­à¸à¹€à¸›à¹‡à¸™ 2\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "à¸à¸²à¸£à¸‚ัดà¹à¸¢à¹‰à¸‡à¸‚องà¸à¸²à¸£à¸•รงà¸à¸±à¸™à¹„ด้รับà¸à¸²à¸£à¸£à¸°à¸šà¸¸" #: src/grep.c:2101 #, fuzzy msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "à¸à¸²à¸£à¸ªà¸™à¸±à¸šà¸ªà¸™à¸¸à¸™à¸•ัวเลือภ-P ไม่ได้ถูà¸à¸£à¸§à¸šà¸£à¸§à¸¡à¹„ปยังà¹à¸Ÿà¹‰à¸¡à¸à¸²à¸™à¸ªà¸­à¸‡ --disable-perl-regexp นี้" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "ตัวจับคู่ไม่ถูà¸à¸•้อง %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "ไม่รู้จัà¸à¸à¸£à¸°à¸šà¸§à¸™à¸à¸²à¸£à¸­à¸¸à¸›à¸à¸£à¸“์" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "ตัวนับสูงสุดไม่ถูà¸à¸•้อง" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "ชนิดà¹à¸Ÿà¹‰à¸¡à¹„บนารีที่ไม่รู้จัà¸" #: src/grep.c:2829 #, fuzzy msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "อื่น ๆ , ดูที่ <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "ล้มเหลวที่จะจัดสรรหน่วยความจำสำหรับสà¹à¸•็ภPCRE JIT" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P สนับสนุนเฉพาะโลà¹à¸„ล unibyte à¹à¸¥à¸° UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "ตัวเลือภ-P สนับสนุนรูปà¹à¸šà¸šà¹€à¸”ียวเท่านั้น" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "ข้อผิดพลาดภายใน (ไม่ควรเà¸à¸´à¸”ขึ้นมาà¸à¹ˆà¸­à¸™)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "ขอบเขตความยาวบรรทัด PCRE เà¸à¸´à¸™à¸ˆà¸²à¸à¸‚้อจำà¸à¸±à¸”" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "หน่วยความจำถูà¸à¹ƒà¸Šà¹‰à¸ˆà¸™à¸«à¸¡à¸”" #: src/pcresearch.c:310 #, fuzzy, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "à¹à¸ªà¸•็ภPCRE JIT ถูà¸à¹ƒà¸Šà¹‰à¸ˆà¸™à¸«à¸¡à¸”à¹à¸¥à¹‰à¸§" #: src/pcresearch.c:315 #, fuzzy, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "ขอบเขตà¸à¸²à¸£ backtrack ของ PCRE เà¸à¸´à¸™à¸ˆà¸²à¸à¸‚้อจำà¸à¸±à¸”" #: src/pcresearch.c:319 #, fuzzy, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "ขอบเขตà¸à¸²à¸£ backtrack ของ PCRE เà¸à¸´à¸™à¸ˆà¸²à¸à¸‚้อจำà¸à¸±à¸”" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "ข้อผิดพลาด PCRE ภายใน: %d" #, c-format #~ msgid "warning: GREP_OPTIONS is deprecated; please use an alias or script" #~ msgstr "คำเตือน: GREP_OPTIONS ไม่สนับสนุนให้ใช้ ; à¸à¸£à¸¸à¸“าใช้นามà¹à¸à¸‡à¸«à¸£à¸·à¸­à¸ªà¸„ริปต์" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "คำเตือน: %s: %s" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "%s%s รับอาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ที่ไม่ถูà¸à¸•้อง '%s'" #~ msgid "invalid suffix in %s%s argument '%s'" #~ msgstr "คำเสริมท้ายไม่ถูà¸à¸•้องใน %s%s อาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ '%s'" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s อาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ '%s' ใหà¸à¹ˆà¸¡à¸²à¸à¹€à¸à¸´à¸™à¹„ป" #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "โฮมเพจของ %s : <http://www.gnu.org/software/%s/>\n" #~ msgid "internal error" #~ msgstr "ข้อผิดพลาดภายใน" #~ msgid "Mike Haertel" #~ msgstr "ไมค์ ฮาเออร์เทล" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: ตัวเลือภ'--%s' ไม่อนุà¸à¸²à¸•ให้มีอาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: ตัวเลือà¸à¸—ี่ไม่รู้จัภ'--%s'\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: ตัวเลือภ'-W %s' คลุมเครือไม่ชัดเจน\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: ตัวเลือภ'-W %s' ไม่อนุà¸à¸²à¸•ให้มีอาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์\n" #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: ตัวเลือภ'-W %s' ต้องà¸à¸²à¸£à¸­à¸²à¸£à¹Œà¸à¸´à¸§à¹€à¸¡à¸™à¸•์\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "PATTERN โดยมาตรà¸à¸²à¸™à¹€à¸›à¹‡à¸™à¸™à¸´à¸žà¸ˆà¸™à¹Œà¸›à¸à¸•ิพื้นà¸à¸²à¸™ (BRE).\n" #~ msgid "" #~ "'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.\n" #~ "Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n" #~ msgstr "" #~ "'egrep' หมายถึง 'grep -E'. 'fgrep' หมายถึง 'grep -F'.\n" #~ "à¸à¸²à¸£à¸£à¹‰à¸­à¸‡à¸‚อโดยตรงทั้ง 'egrep' หรือ 'fgrep' ไม่à¹à¸™à¸°à¸™à¸³à¹ƒà¸«à¹‰à¹ƒà¸Šà¹‰.\n" #~ msgid "lseek failed" #~ msgstr "lseek ล้มเหลว" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "โฮมเพจ GNU Grep : <%s>\n" #~ msgid "invalid UTF-8 byte sequence in input" #~ msgstr "ลำดับไบต์ UTF-8 ที่นำเข้าไม่ถูà¸à¸•้อง" ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/et.po�����������������������������������������������������������������������0000664�0001750�0001750�00000054237�14670377450�016050� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is distributed under the same license as the grep package. # Estonian translations for grep # Copyright (C) 2000 Free Software Foundation, Inc. # Toomas Soome <tsoome@me.com>, 2021. # msgid "" msgstr "" "Project-Id-Version: grep 3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 11:00+0300\n" "Last-Translator: Toomas Soome <tsoome@me.com>\n" "Language-Team: Estonian <linux-ee@lists.eenet.ee>\n" "Language: et\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8-bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "vigane argument %s võtmele %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "segane argument %s võtmele %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "Lubatud argumendid on:" #: lib/c-stack.c:187 msgid "program error" msgstr "programmi viga" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "pinu ületäitumine" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "viga kirjutamisel" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "balanseerimata [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "vigane sümboliklass" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "sümbolklassi süntaks on [[:space:]], mitte [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "lõpetamata \\ paojada" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "vigane \\{\\} sisu" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "regulaaravaldis on liiga suur" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "balanseerimata (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "süntaksit pole määratud" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "balanseerimata )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Tundmatu süsteemi viga" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: võti '%s%s' on segane\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: võti '%s%s' on segane; võimalused:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: tundmatu võti '%s%s'\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: võti '%s%s' ei luba argumenti\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: võti '%s%s' nõuab argumenti\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: vigane võti -- '%c'\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: võti nõuab argumenti -- '%c'\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "mälu on otsas" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "ei õnnestu salvestada jooksvat töökataloogi" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "algsesse töökataloogi ei saa tagasi minna" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "failipideme tekst/binaar moodi muutmine ebaõnnestus" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "Edukas" #: lib/regcomp.c:138 msgid "No match" msgstr "Vastet pole" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Vigane regulaaravaldis" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Vigane sortimise sümbol" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Vigane sümbolklassi nimi" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Lõpetav langkriips" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Vigane tagasi viide" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Puudub [, [^, [:, [. või [= paariline" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Puudub ( või \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Puudub \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Vigane \\{\\} sisu" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Vigane vahemiku lõpp" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Mälu on otsas" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Vigane eelnev regulaaravaldis" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Ootamatu reagulaaravaldise lõpp" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Regulaaravaldis on liiga suur" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Puudub ) või \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Eelnevat regulaaravaldist pole" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "Pakendanud %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "Pakendanud %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Litsents GPLv3+: GNU GPL versioon 3 või uuem <%s>\n" "See on vaba tarkvara: teil on lubatud seda muuta ja levitada.\n" "Garantii PUUDUB; vastavalt seadustega lubatud piiridele.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Kirjutanud %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Kirjutanud %s ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Kirjutanud %s, %s, ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Kirjutanud %s, %s, %s,\n" "ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Kirjutanud %s, %s, %s,\n" "%s, ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Kirjutanud %s, %s, %s,\n" "%s, %s, ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Kirjuatanud %s, %s, %s,\n" "%s, %s, %s, ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Kirjutanud %s, %s, %s,\n" "%s, %s, %s, %s,\n" "ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Kirjutanud %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, ja %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Kirjutanud %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, ja teised.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "Teatage palun vigadest: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Teatage palun %s vigadest: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s koduleht: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "Üldine abiinfo GNU tarkvara kohta: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(standardsisend)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "vigane konteksti pikkuse argument" #: src/grep.c:894 msgid "input is too large to count" msgstr "sisend on loendamiseks liiga suur" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: binaarfail sobib" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: hoiatus: rekursiivne kataloogipuu tsükkel" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: sisendfail on ühtlasi ka väljund" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Kasutamine: %s [VÕTI]... MUSTRID [FAIL] ...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Lisainfo saamiseks proovige võtit '%s --help'.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Otsi MUSTREID igast FAIList.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Näiteks: %s -i 'tere kõik' menu.h main.c\n" "MUSTRID võivad sisaldada mitut reavahetusega eraldatud mustrit.\n" "\n" "Mustri valik ja interpreteerimine:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp MUSTRID on laiendatud regulaaravaldised\n" " -F, --fixed-strings MUSTRID on hulk reavahetustega eraldatud " "sõnesid\n" " -G, --basic-regexp MUSTRID on lihtsad regulaaravaldised " "(vaikimisi)\n" " -P, --perl-regexp MUSTRID on Perl regulaaravaldised\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=MUSTER kasuta regulaaravaldistena\n" " -f, --file=FAIL loe MUSTRID failist FAIL\n" " -i, --ignore-case tõstutundetu\n" " --no-ignore-case tõstutundlik (vaikimisi)\n" " -w, --word-regexp kasuta MUSTRIT sõnade leidmiseks\n" " -x, --line-regexp kasuta MUSTRIT ridade leidmiseks\n" " -z, --null-data andmerida lõppeb baidil 0, mitte reavahetusel\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Muud:\n" " -s, --no-messages blokeeri veateated\n" " -v, --invert-match vali mitte-sobivad read\n" " -V, --version esita versiooniinfo ja lõpeta töö\n" " --help esita see abiinfo ja lõpeta töö\n" "\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "Väljundi kontroll:\n" " -m, --max-count=NUM peatu peale NUM rida\n" " -b, --byte-offset väljasta koos ridadega ka baidi indeks\n" " -n, --line-number väljasta koos ridadega ka reanumber\n" " --line-buffered tühjenda väljund igal real\n" " -H, --with-filename väljasta iga leiuga failinimi\n" " -h, --no-filename blokeeri väljundis failinimi\n" " --label=MÄRGEND kasuta väljundis failinime asemel märgendit\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching näita ainult mustriga sobivat mittetühja reaosa\n" " -q, --quiet, --silent blokeeri kogu tavaline väljund\n" " --binary-files=TÜÜP eelda binaarfailide tüüpi;\n" " TÜÜP on 'binary', 'text', või 'without-match'\n" " -a, --text sama, kui --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I sama, kui --binary-files=without-match\n" " -d, --directories=TEGEVUS kuidas käsitleda katalooge;\n" " TEGEVUS on 'read', 'recurse' või 'skip'\n" " -D, --devices=TEGEVUS kuidas käsitleda seadmeid, FIFOsid ja " "pistikuid;\n" " TEGEVUS on 'read' või 'skip'\n" " -r, --recursive sama, kui --directories=recurse\n" " -R sama, aga järgib kõiki nimeviiteid\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=FAILI_MUSTER otsi alinult mustrile vastavaid faile\n" " --exclude=FAILI_MUSTER välista mustrile vastavad failid\n" " --exclude-from=FAIL välista failid vastavalt failist loetud " "mustrile\n" " --exclude-dir=MUSTER välista mustrile vastavad kataloogid.\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match väljasta ainult failide nimed, mis ei sobinud\n" " -l, --files-with-matches väljasta ainult leitud failide nimed\n" " -c, --count väljasta ainult leitud ridade arv faili kohta\n" " -T, --initial-tab kasuta vajadusel ridade joondamisel " "tabulaatorit\n" " -Z, --null väljasta faili nime järel bait 0\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "Konteksti kontroll:\n" " -B, --before-context=NUM väljasta NUM rida eelnevat konteksti\n" " -A, --after-context=NUM väljasta NUM rida järgnevat konteksti\n" " -C, --context=NUM väljasta NUM rida väljundi konteksti\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -NUM sama, kui --context=NUM\n" " --group-separator=ER väljasta ER kontekstiga leidude vahel\n" " --no-group-separator leidude eraldajat ei väljastata\n" " --color[=MILLAL],\n" " --colour[=MILLAL] kasuta otsitava sõne eristamiseks markereid\n" " MILLAL võib olla 'always', 'never' või 'auto'.\n" " -U, --binary ära eemalda rea lõpust CR sümboleid (MSDOS/" "WINDOWS)\n" "\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Kui fail on '-', loe standardsisendit. Kui faili ei antud ja kasutati võtit -" "r,\n" "loe '.', muidu '-'. Kui anti vähem kui kaks faili, eelda -h. \n" "Lõpetamise kood on 0, kui rida leiti, muidu 1;\n" "kui tekkis viga ja -q ei kasutatud, on lõpetamise kood 2.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "määrati konfliktsed otsijad" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Perl regulaaravaldisi ei toetata --disable-perl-regexp kompileerimise võtmega" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "vigane sobitaja %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "tundmatu seadmete meetod" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "hoiatus: --unix-byte-offsets (-u) on aegunud" #: src/grep.c:2686 msgid "invalid max count" msgstr "vigane maksimum" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "tundmatu kahendfailide tüüp" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Kirjutanud Mike Haertel ja teised; vaadake\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "PCRE JIT magasini jaoks ei jätku mälu" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "-P toetab ainult ühebaidilisi ja UTF-8 lokaate" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "võti -P toetab ainult ühte mustrit" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "sisemine viga (ei peaks kunagi juhtuma)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "PCRE rea pikkuse piirang on ületatud" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: mälu on otsas" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: PCRE JIT pinu sai täis" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: PCRE tagasivaate piirang on ületatud" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: PCRE rekursiooni piirang on ületatud" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: sisemine PCRE viga: %d" �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/cs.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000042703�14670377471�016207� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����i������d��•���¬������� ��Ï��� ��÷���Ñ ��Õ��É ����Ÿ ��ü���° ��¶��­��U��d��»��º��¤��v��F�������b�����v��&���Ž��#���µ�����Ù��!���ö����������4�����P��,���e�����’��.���²��'���á��(��� �����2��%���R�����x�����z�����~��*��������º��&���K�����r�����‰�����¦�����Â��$���Ú�����ÿ�������ª���,�����×�����è�����ñ���������� ��<���5��#���r�����–�����±�����È��"���Ü�����ÿ�������&��������A�����V�����h�����z�� ���™��)���¦�����Ð��ù���å�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J��\���Z�����·�����¹��4���Ö����� ��!���* ��0���L ��-���} ��.���« �����Ú ��$���ö �����!�����6!�����N!�����f!�����†!�����™!�����«!�����¼!�� ���Ð!�����Þ!�����ù!��,���"��*���5"�� ���`"�� ���m"�� ���z"�����‡"�����›"�����µ"��-���Ì"�� ���ú"��Š��#��î���‘$��ÿ���€%��†��€&��\��)�� ��d*��`��p+��ë��Ñ-��i��½/����'2��®��/4��%���Þ5�����6��1���$6��4���V6��+���‹6��)���·6�����á6��(���þ6�����'7��;���?7��/���{7��:���«7��.���æ7��1���8��)���G8��,���q8�����ž8�����¢8�����¥8��>���¹8�����ø8��3���ˆ9�����¼9�����Õ9�����õ9����� :��(���":�����K:�����c:��»���€:�����<;�����P;��'���_;�����‡;�����š;��d���²;��(���<��&���@<��;���g<��‡���£<��$���+=�����P=�����Y=��7���y=�����±=�����Í=�����â=�� ���÷=�� ���>��2���&>�����Y>��m��q>�����ß?��9���ô?��0���.@��,���_@��(���Œ@��$���µ@�� ���Ú@�����û@�����A�����1A��Y���@A�����šA��!���žA��2���ÀA�����óA��,���B��/���<B��9���lB��E���¦B��<���ìB��.���)C�����XC�����tC�����C��"���¢C�����ÅC�����áC�����þC�����D�����(D��&���7D�����^D��8���wD��/���°D�����àD�����ðD������E�����E��!���/E��$���QE��9���vE�����°E����������������8�������@���+���,���J�������6��������������`�����������R������Y������I���e���:��������������;������D���[�������a���^���L����������=�����������������g������������<�����������#����������.��� �����������G���������� ����������&�����������S���c����������B���0���i���(���4���3���5����������-���\���h�������H������/������X�������Z���M����������)���b��� ���K�������C���O�������"���9�������A��� ������V�������2�������$���P����������W������U���1���%���Q���!���]���?���������������T���>�������E������*��� ���_�������f�������F������ ���7�������'���N���������������d���� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � --include=GLOB search only files that match GLOB (a file pattern) --exclude=GLOB skip files that match GLOB --exclude-from=FILE skip files that match any file pattern from FILE --exclude-dir=GLOB skip directories that match GLOB � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -NUM same as --context=NUM --group-separator=SEP print SEP on line between matches with context --no-group-separator do not print separator for matches with context --color[=WHEN], --colour[=WHEN] use markers to highlight the matching strings; WHEN is 'always', 'never', or 'auto' -U, --binary do not strip CR characters at EOL (MSDOS/Windows) � -e, --regexp=PATTERNS use PATTERNS for matching -f, --file=FILE take PATTERNS from FILE -i, --ignore-case ignore case distinctions in patterns and data --no-ignore-case do not ignore case distinctions (default) -w, --word-regexp match only whole words -x, --line-regexp match only whole lines -z, --null-data a data line ends in 0 byte, not newline � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: binary file matches�%s: exceeded PCRE's backtracking limit�%s: exceeded PCRE's recursion limit�%s: exhausted PCRE JIT stack�%s: input file is also the output�%s: internal PCRE error: %d�%s: invalid option -- '%c' �%s: memory exhausted�%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �%s: warning: recursive directory loop�'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �General help using GNU software: <%s> �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�License GPLv3+: GNU GPL version 3 or later <%s>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. �Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Perl matching not supported in a --disable-perl-regexp build�Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Report bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�When FILE is '-', read standard input. With no FILE, read '.' if recursive, '-' otherwise. With fewer than two FILEs, assume -h. Exit status is 0 if any line is selected, 1 otherwise; if any error occurs and -q is not given, the exit status is 2. �Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �Written by Mike Haertel and others; see <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�warning: --unix-byte-offsets (-u) is obsolete�write error�Project-Id-Version: grep 3.6.27 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2021-08-09 20:10+02:00 Last-Translator: Petr Pisar <petr.pisar@atlas.cz> Language-Team: Czech <translation-team-cs@lists.sourceforge.net> Language: cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. � Řízení kontextu: -B, --before-context=POÄŒET vypíše POÄŒET řádků pÅ™ed shodou -A, --after-context=POÄŒET vypíše POÄŒET řádků za shodou -C, --context=POÄŒET vypíše POÄŒET řádků kontextu (pÅ™ed i za shodou) � Různé: -s, --no-messages potlaÄí chybové zprávy -v, --invert-match vybere neodpovídající řádky -V, --version vypíše oznaÄení verze a skonÄí --help vypíše tuto nápovÄ›du a skonÄí � Řízení výstupu: -m, --max-count=POÄŒET skonÄí po vybrání POÄŒTU řádků -b, --byte-offset s každým výstupním řádkem vypíše jeho pozici v souboru -n, --line-number s každým výstupním řádkem vypíše jeho Äíslo řádku --line-buffered vyprázdní výstup po každém řádku -H, --with-filename u výstupních řádků vypisuje název souboru -h, --no-filename potlaÄí pÅ™edÅ™azování jména souboru na výstupu --label=NÃZEV použije NÃZEV jako oznaÄení standardního vstupu na výstupu � --include=GLOB prohledá pouze soubory, které vyhovují GLOBU --exclude=GLOB pÅ™eskoÄí soubory, které vyhovují GLOBU --exclude-from=SOUBOR pÅ™eskoÄí soubory, které vyhovují jakémukoliv vzorku ze SOUBORU --exclude-dir=GLOB pÅ™eskoÄí adresáře, které vyhovují GLOBU � -E, --extended-regexp VZORKY jsou rozšířené regulární výrazy -F, --fixed-strings VZORKY jsou Å™etÄ›zce -G, --basic-regexp VZORKY jsou základní regulární výrazy -P, --perl-regexp VZORKY jsou regulární výrazy jazyka Perl � -I jako --binary-files=without-match -d, --directories=AKCE jak zpracovávat adresáře. AKCE může být: „read“ (Äíst), „recurse“ (rekurze), „skip“ (pÅ™eskoÄit) -D, --devices=AKCE jak zpracovávat zařízení, FIFO (roury) a sockety, AKCE může být: „read“ (Äíst) nebo „skip“ (pÅ™eskoÄit) -r, --recursive jako --directories=recurse -R, --dereference-recursive obdobnÄ›, jen následuje vÅ¡echny symbolické odkazy � -L, --files-without-match vypíše pouze názvy souborů, ze kterých nebyly vybrány žádné řádky -l, --files-with-matches vypíše pouze názvy souborů, ze kterých byly vybrány řádky -c, --count vypíše pouze poÄet vyhovujících řádků na SOUBOR -T, --initial-tab zarovná zaÄátky řádků tabulátory (je-li tÅ™eba) -Z, --null vypíše nulový bajt za jménem SOUBORU � -POÄŒET stejné jako --context=POÄŒET --group-separator=ODDÄšLOVAÄŒ vypisuje ODDÄšLOVAÄŒ na řádku mezi shodami s kontextem --no-group-separator nevypisuje oddÄ›lovaÄ shod s kontextem --color[=KDY], --colour[=KDY] použije barev k rozliÅ¡ení vyhovujících Å™etÄ›zců, KDY může být „always“ (vždy), „never“ (nikdy) nebo „auto“ (automaticky) -U, --binary neodstraňuje znak CR na konci řádku (MSDOS/Windows) � -e, --regexp=VZORKY použije VZORKY jako regulární výraz -f, --file=SOUBOR naÄte VZORKY ze SOUBORU -i, --ignore-case ignoruje rozdíly ve velikosti písmen ve vzorcích a datech --no-ignore-case neignoruje rozdíly ve velikosti písmen (výchozí) -w, --word-regexp hledá pouze na celá slova -x, --line-regexp hledá pouze celé řádky -z, --null-data řádek konÄí nulovým bajtem místo znaku nového řádku � -o, --only-matching zobrazí pouze neprázdné Äásti odpovídajících řádků -q, --quiet, --silent potlaÄí obvyklý výstup --binary-files=TYP definuje typ binárních souborů TYP může být: „binary“ (binární), „text“ (textový) nebo „without-match“ (bez vyhovÄ›ní vzorku) -a, --text jako --binary-files=text �Domovská stránka programu %s: <%s> �%s: binární soubor odpovídá�%s: pÅ™ekroÄeno omezení PCRE na délku návratu�%s: pÅ™ekroÄeno omezení PCRE na hloubku zanoÅ™ení�%s: JIT zásobník knihovny PCRE vyÄerpán�%s: vstupní soubor je rovněž výstupem�%s: vnitÅ™ní chyba PCRE: %d�%s: neznámý pÅ™epínaÄ – „%c“ �%s: paměť vyÄerpána�%s: pÅ™epínaÄ â€ž%s%s“ musí být zadán bez argumentu �%s: pÅ™epínaÄ â€ž%s%s“ není jednoznaÄný �%s: pÅ™epínaÄ â€ž%s%s“ není jednoznaÄný: možnosti:�%s: pÅ™epínaÄ â€ž%s%s“ vyžaduje argument �%s: pÅ™epínaÄ vyžaduje argument – „%c“ �%s: nerozpoznaný pÅ™epínaÄ â€ž%s%s“ �%s: pozor: smyÄka rekurzivních adresářů�“�©�(standardní vstup)�-P podporuje pouze jednobajtová a UTF-8 národní prostÅ™edí�Příklad: %s -i 'hello world' menu.h main.c VZORKY smí obsahovat více vzorků oddÄ›lených novým řádkem. VýbÄ›r a interpretace vzorku: �Obecná pomoc s používáním GNU softwaru: <%s> �Neplatný zpÄ›tný odkaz�Neplatný název třídy znaků�Neplatný Å™adicí znak�Neplatný obsah \{\}�Neplatný pÅ™edchozí regulární výraz�Neplatný konec rozsahu�Neplatný regulární výraz�Licence GPLv3+: GNU GPL verze 3 nebo novÄ›jší <%s>. Toto je volné programové vybavení: máte právo jej mÄ›nit a dále šířit. Není zde ŽÃDNà ZÃRUKA, jak jen zákon dovoluje. �Paměť vyÄerpána�Žádná shoda�Žádný pÅ™edchozí regulární výraz�Zabaleno kým: %s �Zabaleno kým: %s (%s) �V programu pÅ™eloženém s pÅ™epínaÄem --disable-perl-regexp nejsou perlové výrazy podporovány�PÅ™edÄasný konec regulárního výrazu�Regulární výraz je příliÅ¡ velký�Chyby distributora %s oznamujte (anglicky) na adresu: <%s> �Chyby v programu oznamujte (anglicky) na adresu: <%s> PÅ™ipomínky k pÅ™ekladu na adresu: <translation-team-cs@lists.sourceforge.net> �Každý SOUBOR prohledá na VZORKY. �ÚspÄ›ch�ZávÄ›reÄné koncové lomítko�Více informací získáte příkazem „%s --help“. �Neznámá systémová chyba�Nepárový ( nebo \(�Nepárový ) nebo \)�Nepárový [, [^, [:, [. nebo [=�Nepárový \{�Použití: %s [PŘEPÃNAÄŒ]… VZORKY [SOUBOR]… �Platné argumenty jsou:�Je-li SOUBOR -, Äte standardní vstup. Ne-li SOUBOR zadán, Äte „.“, je-li přítomen pÅ™epínaÄ -r, jinak Äte standardní vstup. Jestliže jsou zadány ménÄ› než dva SOUBORY, pak je výchozí pÅ™epínaÄ -h. Návratový kód je 0 pÅ™i nalezení vyhovujícího řádku, jinak 1. Vyskytne-li se chyba a není-li zadán pÅ™epínaÄ -q, bude vrácen kód 2. �Napsali(y) %s a %s. �Napsali(y) %s, %s, %s, %s, %s, %s, %s, %s, %s a další. �Napsali(y) %s, %s, %s, %s, %s, %s, %s, %s a %s. �Napsali(y) %s, %s, %s, %s, %s, %s, %s a %s. �Napsali(y) %s, %s, %s, %s, %s, %s a %s. �Napsali(y) %s, %s, %s, %s, %s a %s. �Napsali(y) %s, %s, %s, %s a %s. �Napsali(y) %s, %s, %s a %s. �Napsali(y) %s, %s a %s. �Napsal(a) %s. �Napsal Mike Haertel a další, vizte <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.�„�nejednoznaÄný argument %s u %s�zápis třídy znaků je [[:space:]], ne [:space:]�zadány kolidující vzorky�pÅ™ekroÄeno omezení PCRE na délku řádku�alokace pamÄ›ti pro JIT zásobník PCRE selhala�návrat do prvotního pracovního adresáře se nezdaÅ™il�nastavení textového/binárního režimu deskriptoru souboru selhalo�poÄet vstupních řádků nelze spoÄítat (je jich hodnÄ›)�vnitÅ™ní chyba (to by se nikdy nemÄ›lo stát)�neplatný argument %s u %s�neplatný třída znaků�neplatný obsah \{\}�neplatný argument délky kontextu�neplatný syntaxe vzorku %s�neplatný maximální poÄet�paměť vyÄerpána�syntaxe není urÄena�chyba programu�regulární výraz je příliÅ¡ velký�pÅ™eteÄení zásobníku�pÅ™epínaÄ -P lze být použít pouze s jedním vzorkem�nelze zaznamenat aktuální pracovní adresář�nevyvážená (�nevyvážená )�nevyvážená [�neukonÄená escape sekvence \�neznámý typ binárního souboru�neznámá metoda obsluhy zařízení�pozor: pÅ™epínaÄ --unix-byte-offsets (-u) je zastaralý�chyba pÅ™i zápisu��������������������������������������������������������������kbuild-3608/src/grep/po/th.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000041013�14670377471�016206� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����W������Ô�����Œ������ˆ��Ï���‰��÷���Y��Õ��Q ��ü���' ��¶��$ ��U��Û ��F��1�����x�����Œ��,���¨�����Õ��.���õ��'���$��(���L�����u�����•�����—�����›��*���¬�����×�����h����������œ�����¸��$���Ð�����õ����������"�����3�����<�����[�����k��#���€�����¤�����¿��"���Ö�����ù�������&��������;�����P�����b�����t�� ���“��)��� �����Ê�����ß��;���ö��3���2��/���f��+���–��'���Â��#���ê����������.�����J�����Z�����\��4���y�����®��!���Í��0���ï��-��� ��.���N�����}��$���™�����¾�����Ù�����ñ����� �����)�����<�����N�����_�� ���s����������œ��,���«��*���Ø�� ����� ����� ��������*�����>�����X�� ���o��‚��{��n��þ��¸��m��ˆ��&��Š��¯!��¡��:#��Û��Ü%��S��¸(��&��� +��C���3+��s���w+��[���ë+��“���G,��^���Û,��^���:-��H���™-�����â-�����ä-��)���è-��Q���.��Q��d.��H���¶/��T���ÿ/��W���T0��B���¬0��T���ï0��0���D1��<���u1��B���²1�����õ1��E���2��.���W2��3���†2��T���º2��<���3��Q���L3��G���ž3�����æ3��N���ù3��]���H4��W���¦4��6���þ4��6���55��C���l5��'���°5��9���Ø5��S���6��+���f6��R���’6��H���å6��D���.7��@���s7��<���´7��8���ñ7��4���*8��0���_8�����8�����®8��h���°8��‹���9��i���¥9��l���:�����|:�����þ:��š���€;��W���<��l���s<��[���à<��T���<=��B���‘=��f���Ô=��<���;>��B���x>��B���»>��9���þ>��*���8?��<���c?����� ?��m���¯?��x���@��#���–@��#���º@��#���Þ@��?���A��N���BA��K���‘A��-���ÝA��������?���(��� ������8���N���<��������������E���6���4��� ���.������� �������;��������������5���>�������D���3���������������)�����������P���J���@����������$���V����������K�����������B���L����������C������U������/�������S�����������F���W���2���0����������:�����������7���R��� ���T�����������A�����������1���'���M���,�������+���������H������!���I����������������G�������*���������������������=���&��� ����������9���#�������O�������%������"���-������Q������������� ���������������������� Context control: -B, --before-context=NUM print NUM lines of leading context -A, --after-context=NUM print NUM lines of trailing context -C, --context=NUM print NUM lines of output context � Miscellaneous: -s, --no-messages suppress error messages -v, --invert-match select non-matching lines -V, --version display version information and exit --help display this help text and exit � Output control: -m, --max-count=NUM stop after NUM selected lines -b, --byte-offset print the byte offset with output lines -n, --line-number print line number with output lines --line-buffered flush output on every line -H, --with-filename print file name with output lines -h, --no-filename suppress the file name prefix on output --label=LABEL use LABEL as the standard input file name prefix � -E, --extended-regexp PATTERNS are extended regular expressions -F, --fixed-strings PATTERNS are strings -G, --basic-regexp PATTERNS are basic regular expressions -P, --perl-regexp PATTERNS are Perl regular expressions � -I equivalent to --binary-files=without-match -d, --directories=ACTION how to handle directories; ACTION is 'read', 'recurse', or 'skip' -D, --devices=ACTION how to handle devices, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive like --directories=recurse -R, --dereference-recursive likewise, but follow all symlinks � -L, --files-without-match print only names of FILEs with no selected lines -l, --files-with-matches print only names of FILEs with selected lines -c, --count print only a count of selected lines per FILE -T, --initial-tab make tabs line up (if needed) -Z, --null print 0 byte after FILE name � -o, --only-matching show only nonempty parts of lines that match -q, --quiet, --silent suppress all normal output --binary-files=TYPE assume that binary files are TYPE; TYPE is 'binary', 'text', or 'without-match' -a, --text equivalent to --binary-files=text �%s home page: <%s> �%s: invalid option -- '%c' �%s: option '%s%s' doesn't allow an argument �%s: option '%s%s' is ambiguous �%s: option '%s%s' is ambiguous; possibilities:�%s: option '%s%s' requires an argument �%s: option requires an argument -- '%c' �%s: unrecognized option '%s%s' �'�(C)�(standard input)�-P supports only unibyte and UTF-8 locales�Example: %s -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: �Invalid back reference�Invalid character class name�Invalid collation character�Invalid content of \{\}�Invalid preceding regular expression�Invalid range end�Invalid regular expression�Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Premature end of regular expression�Regular expression too big�Report %s bugs to: %s �Search for PATTERNS in each FILE. �Success�Trailing backslash�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched [, [^, [:, [., or [=�Unmatched \{�Usage: %s [OPTION]... PATTERNS [FILE]... �Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �`�ambiguous argument %s for %s�character class syntax is [[:space:]], not [:space:]�conflicting matchers specified�exceeded PCRE's line length limit�failed to allocate memory for the PCRE JIT stack�failed to return to initial working directory�failed to set file descriptor text/binary mode�input is too large to count�internal error (should never happen)�invalid argument %s for %s�invalid character class�invalid content of \{\}�invalid context length argument�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�program error�regular expression too big�stack overflow�the -P option only supports a single pattern�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unfinished \ escape�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep-3.1.48 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2018-12-17 01:11+0700 Last-Translator: Seksan Poltree <seksan.poltree@gmail.com> Language-Team: Thai <thai-l10n@googlegroups.com> Language: th MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. � ควบคุมบริบท: -B, --before-context=NUM พิมพ์ NUM บรรทัดของบริบทส่วนนำ -A, --after-context=NUM พิมพ์ NUM บรรทัดของบริบทส่วนตาม -C, --context=NUM พิมพ์ NUM บรรทัดของบริบทส่งออภ� เบ็ดเตล็ด: -s, --no-messages ระงับข้อความà¹à¸ªà¸”งข้อผิดพลาด -v, --invert-match เลือà¸à¸šà¸£à¸£à¸—ัดที่ไม่ตรงà¸à¸±à¸™ -V, --version พิมพ์ข้อมูลรุ่นà¹à¸¥à¹‰à¸§à¸­à¸­à¸ --help à¹à¸ªà¸”งความช่วยเหลือนี้à¹à¸¥à¹‰à¸§à¸­à¸­à¸ � ควบคุมà¸à¸²à¸£à¸™à¸³à¸­à¸­à¸: -m, --max-count=NUM หยุดหลังจาà¸à¸¡à¸µ NUM บรรทัดที่ถูà¸à¹€à¸¥à¸·à¸­à¸ -b, --byte-offset พิมพ์à¸à¸²à¸£à¸Šà¸”เชยไบต์à¸à¸±à¸šà¸šà¸£à¸£à¸—ัดนำออภ-n, --line-number พิมพ์หมายเลขบรรทัดà¸à¸±à¸šà¸šà¸£à¸£à¸—ัดนำออภ--line-buffered ล้างนำออà¸à¸šà¸™à¸—ุภๆ บรรทัด -H, --with-filename พิมพ์ชื่อà¹à¸Ÿà¹‰à¸¡à¸à¸±à¸šà¸šà¸£à¸£à¸—ัดนำออภ-h, --no-filename ระงับคำนำหน้าชื่อà¹à¸Ÿà¹‰à¸¡à¹ƒà¸™à¸à¸²à¸£à¸™à¸³à¸­à¸­à¸ --label=LABEL ใช้ LABEL เป็นชื่อคำนำหน้าà¹à¸Ÿà¹‰à¸¡à¸ªà¸³à¸«à¸£à¸±à¸šà¸™à¸³à¹€à¸‚้ามาตรà¸à¸²à¸™ � -E, --extended-regexp PATTERNS เป็นส่วนขยายนิพจน์ปà¸à¸•ิ -F, --fixed-strings PATTERNS เป็นชุดสายอัà¸à¸‚ระ -G, --basic-regexp PATTERNS เป็นนิพจน์ปà¸à¸•ิพื้นà¸à¸²à¸™ (BRE) -P, --perl-regexp PATTERNS เป็นนิพจน์ปà¸à¸•ิภาษา Perl � -I มีค่าเท่าà¸à¸±à¸™à¸à¸±à¸š --binary-files=without-match -d, --directories=ACTION จะทำà¸à¸²à¸£à¸ˆà¸±à¸”à¸à¸²à¸£à¹„ดเรà¸à¸—อรีอย่างไร; ACTION เป็น 'read', 'recurse', หรือ 'skip' -D, --devices=ACTION จะทำà¸à¸²à¸£à¸ˆà¸±à¸”à¸à¸²à¸£à¸­à¸¸à¸›à¸à¸£à¸“์อย่างไร, FIFOs and sockets; ACTION is 'read' or 'skip' -r, --recursive เหมือนà¸à¸±à¸š --directories=recurse -R, --dereference-recursive เช่นà¸à¸±à¸™, à¹à¸•่ตาม symlink ทั้งหมด � -L, --files-without-match พิมพ์เพียงà¹à¸„่ชื่อของ FILEs ที่ไม่ตรงà¸à¸±à¸™à¸à¸±à¸šà¸šà¸£à¸£à¸—ัดที่ถูà¸à¹€à¸¥à¸·à¸­à¸ -l, --files-with-matches พิมพ์เพียงà¹à¸„่ชื่อของ FILEs à¸à¸±à¸šà¸šà¸£à¸£à¸—ัดที่ถูà¸à¹€à¸¥à¸·à¸­à¸ -c, --count พิมพ์เพียงà¹à¸•่จำนวนบรรทัดที่ตรงà¸à¸±à¸™à¸—ี่นับได้ในà¹à¸•่ละ FILE -T, --initial-tab ทำà¸à¸²à¸£à¸ˆà¸±à¸”เตรียมà¹à¸—็บ (ถ้าจำเป็น) -Z, --null พิมพ์ 0 ไบต์หลังชื่อ FILE � -o, --only-matching à¹à¸ªà¸”งเพียงà¹à¸•่ส่วนของบรรทัดที่ไม่ว่างเปล่าของบรรทัดที่ตรงà¸à¸±à¸™ -q, --quiet, --silent ระงับนำออà¸à¸›à¸à¸•ิทั้งหมด --binary-files=TYPE ทึà¸à¸—ัà¸à¹€à¸­à¸²à¸§à¹ˆà¸²à¹à¸Ÿà¹‰à¸¡à¸à¸²à¸™à¸ªà¸­à¸‡à¹€à¸›à¹‡à¸™ TYPE; TYPE เป็น 'binary', 'text', หรือ 'without-match' -a, --text มีค่าเท่าà¸à¸±à¸™à¸à¸±à¸š --binary-files=text �โฮมเพจของ %s : <%s> �%s: ตัวเลือà¸à¹„ม่ถูà¸à¸•้อง -- '%c' �%s: ตัวเลือภ'%s%s' ไม่อนุà¸à¸²à¸•ให้มีอาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ �%s: ตัวเลือภ'%s%s' คลุมเครือไม่ชัดเจน �%s: ตัวเลือภ'%s%s' คลุมเครือไม่ชัดเจน; เป็นไปได้ที่จะเป็น:�%s: ตัวเลือภ'%s%s' ต้องà¸à¸²à¸£à¸­à¸²à¸£à¹Œà¸à¸´à¸§à¹€à¸¡à¸™à¸•์ �%s: ตัวเลือà¸à¸•้องà¸à¸²à¸£à¸­à¸²à¸£à¹Œà¸à¸´à¸§à¹€à¸¡à¸™à¸•์ -- '%c' �%s: ตัวเลือà¸à¸—ี่ไม่รู้จัภ'%s%s' �'�(C)�(นำเข้ามาตรà¸à¸²à¸™)�-P สนับสนุนเฉพาะโลà¹à¸„ล unibyte à¹à¸¥à¸° UTF-8�ตัวอย่าง: %s -i 'hello world' menu.h main.c PATTERNS สามารถประà¸à¸­à¸šà¸”้วยหลายรูปà¹à¸šà¸šà¹‚ดยà¹à¸¢à¸à¸”้วยตัวขึ้นบรรทัดใหม่ à¸à¸²à¸£à¹€à¸¥à¸·à¸­à¸à¸™à¸´à¸žà¸ˆà¸™à¹Œà¸›à¸à¸•ิà¹à¸¥à¸°à¸à¸²à¸£à¹à¸›à¸¥à¸„วามหมาย: �à¸à¸²à¸£à¸­à¹‰à¸²à¸‡à¸­à¸´à¸‡à¸à¸¥à¸±à¸šà¹„ม่ถูà¸à¸•้อง�ชื่อà¸à¸¥à¸¸à¹ˆà¸¡à¸Šà¸¸à¸”อัà¸à¸‚ระไม่ถูà¸à¸•้อง�ผลà¸à¸²à¸£à¹€à¸—ียบà¸à¸±à¸™à¸‚องอัà¸à¸‚ระผิดพลาด�เนื้อหาของ \{\} ไม่ถูà¸à¸•้อง�นิพจน์ปà¸à¸•ิà¸à¹ˆà¸­à¸™à¸«à¸™à¹‰à¸²à¹„ม่ถูà¸à¸•้อง�ช่วงจบไม่ถูà¸à¸•้อง�นิพจน์ปà¸à¸•ิไม่ถูà¸à¸•้อง�หน่วยความจำถูà¸à¹ƒà¸Šà¹‰à¸ˆà¸™à¸«à¸¡à¸”�ไม่ตรงà¸à¸±à¸™�ไม่มีนิพจน์ปà¸à¸•ิà¸à¹ˆà¸­à¸™à¸«à¸™à¹‰à¸²�สร้างà¹à¸žà¸à¹€à¸à¸ˆà¹‚ดย %s �สร้างà¹à¸žà¸à¹€à¸à¸ˆà¹‚ดย %s (%s) �นิพจน์ปà¸à¸•ิจบโดยยังไม่สมบูรณ์�นิพจน์ปà¸à¸•ิใหà¸à¹ˆà¹€à¸à¸´à¸™à¹„ป�รายงานข้อผิดพลาดของ %s ไปยัง: %s �ค้นหาสำหรับ PATTERNS ในà¹à¸•่ละ FILE. �สำเร็จ�เครื่องหมายà¹à¸šà¹‡à¸„สà¹à¸¥à¸Šà¸•ามท้าย�ลองใช้ '%s --help' เพื่อข้อมูลเพิ่มเติม. �ข้อผิดพลาดของระบบที่ไม่รู้จัà¸�ไม่ตรงà¸à¸±à¸™à¸à¸±à¸š ( หรือ \(�ไม่ตรงà¸à¸±à¸™à¸à¸±à¸š ) หรือ \)�ไม่ตรงà¸à¸±à¸™à¸à¸±à¸š [, [^, [:, [., หรือ [=�ไม่ตรงà¸à¸±à¸™à¸à¸±à¸š \{�วิธีใช้: %s [OPTION]… PATTERNS [FILE]… �อาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ที่ใช้ได้ ได้à¹à¸à¹ˆ:�เขียนโดย %s à¹à¸¥à¸° %s. �เขียนโดย %s, %s, %s, %s, %s, %s, %s, %s, %s, à¹à¸¥à¸°à¸„ณะ. �เขียนโดย %s, %s, %s, %s, %s, %s, %s, %s, à¹à¸¥à¸° %s. �เขียนโดย %s, %s, %s, %s, %s, %s, %s, à¹à¸¥à¸° %s. �เขียนโดย %s, %s, %s, %s, %s, %s, à¹à¸¥à¸° %s. �เขียนโดย %s, %s, %s, %s, %s, à¹à¸¥à¸° %s. �เขียนโดย %s, %s, %s, %s, à¹à¸¥à¸° %s. �เขียนโดย %s, %s, %s, à¹à¸¥à¸° %s. �เขียนโดย %s, %s, à¹à¸¥à¸° %s. �เขียนโดย %s. �`�อาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ %s à¸à¸³à¸à¸§à¸¡à¹„ม่ชัดเจน สำหรับ %s�วาà¸à¸¢à¸ªà¸±à¸¡à¸žà¸±à¸™à¸˜à¹Œà¸‚องà¸à¸¥à¸¸à¹ˆà¸¡à¸Šà¸¸à¸”อัà¸à¸‚ระ คือ [[:space:]], ไม่ใช่ [:space:]�à¸à¸²à¸£à¸‚ัดà¹à¸¢à¹‰à¸‡à¸‚องà¸à¸²à¸£à¸•รงà¸à¸±à¸™à¹„ด้รับà¸à¸²à¸£à¸£à¸°à¸šà¸¸�ขอบเขตความยาวบรรทัด PCRE เà¸à¸´à¸™à¸ˆà¸²à¸à¸‚้อจำà¸à¸±à¸”�ล้มเหลวที่จะจัดสรรหน่วยความจำสำหรับสà¹à¸•็ภPCRE JIT�ล้มเหลวในà¸à¸²à¸£à¸à¸¥à¸±à¸šà¹„ปยังไดเรà¸à¸—อรีทำงานเริ่มต้น�ล้มเหลวในà¸à¸²à¸£à¸•ั้งค่าตัวอธิบายไฟล์ในโหมดข้อความ/ไบนารี�ข้อมูลเข้ายาวเà¸à¸´à¸™à¸à¸§à¹ˆà¸²à¸ˆà¸°à¸™à¸±à¸šà¹„ด้�ข้อผิดพลาดภายใน (ไม่ควรเà¸à¸´à¸”ขึ้นมาà¸à¹ˆà¸­à¸™)�อาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ %s ไม่ถูà¸à¸•้องสำหรับ %s�ชื่อà¸à¸¥à¸¸à¹ˆà¸¡à¸Šà¸¸à¸”อัà¸à¸‚ระไม่ถูà¸à¸•้อง�เนื้อหาของ \{\} ไม่ถูà¸à¸•้อง�ความยาวบริบทอาร์à¸à¸´à¸§à¹€à¸¡à¸™à¸•์ไม่ถูà¸à¸•้อง�ตัวจับคู่ไม่ถูà¸à¸•้อง %s�ตัวนับสูงสุดไม่ถูà¸à¸•้อง�หน่วยความจำถูà¸à¹ƒà¸Šà¹‰à¸ˆà¸™à¸«à¸¡à¸”�ไม่ระบุวาà¸à¸¢à¸ªà¸±à¸¡à¸žà¸±à¸™à¸˜à¹Œ�โปรà¹à¸à¸£à¸¡à¸œà¸´à¸”พลาด�นิพจน์ปà¸à¸•ิใหà¸à¹ˆà¹€à¸à¸´à¸™à¹„ป�stack overflow�ตัวเลือภ-P สนับสนุนรูปà¹à¸šà¸šà¹€à¸”ียวเท่านั้น�ไม่สามารถบันทีà¸à¹„ดเรà¸à¸—อรีที่ทำงานปัจจุบัน�( ไม่สมดุลà¸à¸±à¸™�) ไม่สมดุลà¸à¸±à¸™�[ ไม่สมดุลà¸à¸±à¸™�เครื่องหมายหลีภ\ ไม่จบ�ชนิดà¹à¸Ÿà¹‰à¸¡à¹„บนารีที่ไม่รู้จัà¸�ไม่รู้จัà¸à¸à¸£à¸°à¸šà¸§à¸™à¸à¸²à¸£à¸­à¸¸à¸›à¸à¸£à¸“์�à¸à¸²à¸£à¹€à¸‚ียนผิดพลาด����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/he.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000002162�14670377450�016166� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•���� ������„������ì�������0�����1�����3�����D�����U�����j�����l�����‹�����§�����Ç�����Ù�����ê�������n�������Š�����Œ�� ���œ�����¨�����¾�����À�����Ý�����ñ������� ��� ��&���,�����S�������� �������������������� ������� ������ ��� ��������������'�(standard input)�Memory exhausted�Unknown system error�`�conflicting matchers specified�input is too large to count�invalid context length argument�invalid max count�memory exhausted�unknown binary-files type�unknown devices method�Project-Id-Version: grep 2.5.1a Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2005-03-04 14:55+0200 Last-Translator: Eli Zaretskii <eliz@gnu.org> Language-Team: Hebrew <eliz@gnu.org> Language: he MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. �'�(éð÷ú èì÷ õåøò)�ïåøëæä øîâð�úøëåî-éúìá úëøòî úì÷ú�`�äîàúää éâåñ ìù íéøúåñ íéðåéö�øåôñì éãëî ìåãâ èì÷�øù÷ää èñ÷è êøåà ìù äéåâù äøãâä�éåâù éáøéî øôñî�ïåøëæä øîâð�íééøàðéá íéöá÷á ìåôéèì úøëåî-éúìá úèéù�íéð÷úäá ìåôéèì úøëåî-éúìá úèéù���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/en@quot.header��������������������������������������������������������������0000664�0001750�0001750�00000002263�14670377450�017655� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# All this catalog "translates" are quotation characters. # The msgids must be ASCII and therefore cannot contain real quotation # characters, only substitutes like grave accent (0x60), apostrophe (0x27) # and double quote (0x22). These substitutes look strange; see # http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html # # This catalog translates grave accent (0x60) and apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019). # It also translates pairs of apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019) # and pairs of quotation mark (0x22) to # left double quotation mark (U+201C) and right double quotation mark (U+201D). # # When output to an UTF-8 terminal, the quotation characters appear perfectly. # When output to an ISO-8859-1 terminal, the single quotation marks are # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to # grave/acute accent (by libiconv), and the double quotation marks are # transliterated to 0x22. # When output to an ASCII terminal, the single quotation marks are # transliterated to apostrophes, and the double quotation marks are # transliterated to 0x22. # ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/uk.po�����������������������������������������������������������������������0000664�0001750�0001750�00000071705�14670377471�016061� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# grep -- Ukrainian translation. # Copyright (C) 2003 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # Volodymyr M. Lisivka <lvm@mystery.lviv.net>, 2001-2002. # Dmytro O. Redchuk <dor@kiev-online.net>, 2002. # Yuri Chornoivan <yurchor@ukr.net>, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021. msgid "" msgstr "" "Project-Id-Version: grep-3.6.27\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2021-08-09 11:00+0300\n" "Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n" "Language-Team: Ukrainian <trans-uk@lists.fedoraproject.org>\n" "Language: uk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Lokalize 20.12.0\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "некоректний аргумент, %s, %s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "неоднозначний аргумент, %s, %s" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "СпиÑок коректних аргументів:" #: lib/c-stack.c:187 msgid "program error" msgstr "помилка програми" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "Ð¿ÐµÑ€ÐµÐ¿Ð¾Ð²Ð½ÐµÐ½Ð½Ñ Ñтека" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "помилка запиÑу" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "неврівноважена дужка [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "некоректний ÐºÐ»Ð°Ñ Ñимволів" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" "ÑинтакÑичну конÑтрукцію клаÑу Ñимволів Ñлід визначати так: [[:space:]], а не " "так: [:space:]" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "незавершена \\-поÑлідовніÑть" #: lib/dfa.c:1371 msgid "invalid content of \\{\\}" msgstr "некоректний вміÑÑ‚ \\{\\}" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "занадто об'ємний формальний вираз" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "неврівноважена дужка (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "не вказано ÑинтакÑиÑ" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "неврівноважена дужка )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Ðевідома ÑиÑтемна помилка" #: lib/getopt.c:278 #, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: параметр «%s%s» не Ñ” однозначним\n" #: lib/getopt.c:284 #, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: неоднозначний параметр «%s%s»; можливі варіанти:" #: lib/getopt.c:319 #, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: невідомий параметр «%s%s»\n" #: lib/getopt.c:345 #, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: Ð´Ð¾Ð´Ð°Ð²Ð°Ð½Ð½Ñ Ð°Ñ€Ð³ÑƒÐ¼ÐµÐ½Ñ‚Ñ–Ð² до параметра «%s%s» не передбачено\n" #: lib/getopt.c:360 #, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: параметр «%s%s» потребує аргументу\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: некоректний параметр — «%c»\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: до параметра Ñлід додати аргумент — «%c»\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "пам'Ñть вичерпано" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "не вдалоÑÑ Ð·Ð±ÐµÑ€ÐµÐ³Ñ‚Ð¸ поточний робочий каталог" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "не вдалоÑÑ Ð¿Ð¾Ð²ÐµÑ€Ð½ÑƒÑ‚Ð¸ÑÑŒ до початкового робочого каталогу" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" "не вдалоÑÑ Ð²Ñтановити текÑтовий або двійковий режим Ð´Ð»Ñ Ð´ÐµÑкриптора файла" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "«" #: lib/quotearg.c:356 msgid "'" msgstr "»" #: lib/regcomp.c:135 msgid "Success" msgstr "УÑпіх" #: lib/regcomp.c:138 msgid "No match" msgstr "Ðе знайдено" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "Помилка у формальному виразі" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "Ðекоректний Ñимвол порівнÑннÑ" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "Ðекоректна назва клаÑу Ñимволів" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "Кінцевий Ñимвол похилої риÑки" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "Ðекоректне зворотне поÑиланнÑ" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "Ðезавершена поÑлідовніÑть [, [^, [:, [. або [=" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "Ðеврівноважена поÑлідовніÑть ( або \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "Ðеврівноважена поÑлідовніÑть \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "Ðекоректний вміÑÑ‚ \\{\\}" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "Ðекоректне Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð½Ñ Ð´Ñ–Ð°Ð¿Ð°Ð·Ð¾Ð½Ñƒ" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Пам'Ñть вичерпано" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "Помилка у попередньому формальному виразі" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "Ðеочікуване Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð½Ñ Ñ„Ð¾Ñ€Ð¼Ð°Ð»ÑŒÐ½Ð¾Ð³Ð¾ виразу" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "Занадто об'ємний формальний вираз" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "Ðеврівноважена поÑлідовніÑть ) або \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "Ðе виÑвлено попереднього формального виразу" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "ÐŸÐ°ÐºÑƒÐ²Ð°Ð½Ð½Ñ â€” %s (%s)\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "ÐŸÐ°ÐºÑƒÐ²Ð°Ð½Ð½Ñ â€” %s\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "©" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Умови Ð»Ñ–Ñ†ÐµÐ½Ð·ÑƒÐ²Ð°Ð½Ð½Ñ Ð²Ð¸ÐºÐ»Ð°Ð´ÐµÐ½Ð¾ у GPLv3+: GNU GPL верÑÑ–Ñ— 3 або новішій, <%s>\n" "Це вільне програмне забезпеченнÑ: ви можете вільно змінювати Ñ– поширювати " "його.\n" "Вам не надаєтьÑÑ Ð–ÐžÐ”ÐИХ ГÐРÐÐТІЙ, окрім гарантій передбачених " "законодавÑтвом.\n" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "Ðвтор — %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "Ðвтори: %s Ñ– %s.\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "Ðвтори: %s, %s Ñ– %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "Ðвтори: %s, %s, %s\n" "Ñ– %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Ðвтори: %s, %s, %s,\n" "%s Ñ– %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "Ðвтори: %s, %s, %s,\n" "%s, %s Ñ– %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "Ðвтори: %s, %s, %s,\n" "%s, %s, %s Ñ– %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "Ðвтори: %s, %s, %s,\n" "%s, %s, %s, %s,\n" "Ñ– %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "Ðвтори: %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s Ñ– %s.\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "Ðвтори: %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s та інші.\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, c-format msgid "Report bugs to: %s\n" msgstr "ПовідомлÑйте про вади на адреÑу: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "Про вади у %s повідомлÑйте на адреÑу %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "Ð”Ð¾Ð¼Ð°ÑˆÐ½Ñ Ñторінка %s: <%s>\n" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "" "Загальна довідкова Ñ–Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ñ–Ñ Ñ‰Ð¾Ð´Ð¾ викориÑÑ‚Ð°Ð½Ð½Ñ Ð¿Ñ€Ð¾Ð³Ñ€Ð°Ð¼Ð½Ð¾Ð³Ð¾ Ð·Ð°Ð±ÐµÐ·Ð¿ÐµÑ‡ÐµÐ½Ð½Ñ " "GNU: <%s>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(Ñтандартне джерело вхідних даних)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "помилковий аргумент довжини контекÑту" #: src/grep.c:894 msgid "input is too large to count" msgstr "вхідні дані занадто довгі Ð´Ð»Ñ Ð¾Ð±Ð»Ñ–ÐºÑƒ" #: src/grep.c:1641 #, c-format msgid "%s: binary file matches" msgstr "%s: двійковий файл міÑтить збіжніÑть" #: src/grep.c:1679 #, c-format msgid "%s: warning: recursive directory loop" msgstr "%s: попередженнÑ: Ð·Ð°Ñ†Ð¸ÐºÐ»ÐµÐ½Ð½Ñ Ñ€ÐµÐºÑƒÑ€Ñивного проходу каталогів" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "%s: файл вхідних даних Ñ” також файлом вихідних даних" #: src/grep.c:1961 src/grep.c:1968 #, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "ВикориÑтаннÑ: %s [ПÐРÐМЕТР]... ШÐБЛОÐИ [ФÐЙЛ]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "Віддайте команду «%s --help», щоб дізнатиÑÑ Ð±Ñ–Ð»ÑŒÑˆÐµ.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "Шукати ШÐБЛОÐИ у кожному ФÐЙЛі.\n" #: src/grep.c:1970 #, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Приклад: %s -i 'hello world' menu.h main.c\n" "Ð—Ð°Ð¿Ð¸Ñ Ð¨ÐБЛОÐИ може міÑтити декілька шаблонів, Ñкі відокремлено Ñимволами " "нового Ñ€Ñдка.\n" "\n" "Вибір за взірцем та інтерпретаціÑ:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp ШÐБЛОÐИ Ñ” розширеним формальним виразом\n" " -F, --fixed-strings ШÐБЛОÐИ Ñ” набором Ñ€Ñдків\n" " -G, --basic-regexp ШÐБЛОÐИ Ñ” звичайними формальними виразами\n" " -P, --perl-regexp ШÐБЛОÐИ Ñ” формальними виразами Perl\n" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=ШÐБЛОÐИ викориÑтовувати ШÐБЛОÐИ Ð´Ð»Ñ Ð²ÑÑ‚Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ " "відповідноÑті\n" " -f, --file=ФÐЙЛ взÑти ШÐБЛОÐИ із ФÐЙЛа\n" " -i, --ignore-case ігнорувати регіÑтр літер у шаблонах Ñ– даних\n" " --no-ignore-case не ігнорувати регіÑтр літер (типова поведінка)\n" " -w, --word-regexp шукати лише цілі Ñлова\n" " -x, --line-regexp шукати лише цілі Ñ€Ñдки\n" " -z, --null-data Ñ€Ñдки даних закінчуютьÑÑ Ð±Ð°Ð¹Ñ‚Ð¾Ð¼ \"0\", а не " "Ñимволом\n" " ÐºÑ–Ð½Ñ†Ñ Ñ€Ñдка (\\n)\n" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "Інше:\n" " -s, --no-messages придушити Ð¿Ð¾Ð²Ñ–Ð´Ð¾Ð¼Ð»ÐµÐ½Ð½Ñ Ð¿Ñ€Ð¾ помилки\n" " -v, --invert-match вибирати Ñ€Ñдки без збіжноÑтей\n" " -V, --version показати дані щодо верÑÑ–Ñ— Ñ– завершити роботу\n" " --help показати ці довідкові дані Ñ– завершити роботу\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" "\n" "ÐšÐµÑ€ÑƒÐ²Ð°Ð½Ð½Ñ Ð²Ð¸Ð²ÐµÐ´ÐµÐ½Ð½Ñм даних:\n" " -m, --max-count=ЧИСЛО зупинитиÑÑ Ð¿Ñ–ÑÐ»Ñ Ð²Ð¸ÑÐ²Ð»ÐµÐ½Ð½Ñ ÐºÑ–Ð»ÑŒÐºÐ¾Ñті Ñ€Ñдків, що " "дорівнює ЧИСЛУ\n" " -b, --byte-offset показувати позиції у байтах разом з виведеними " "Ñ€Ñдками\n" " -n, --line-number показувати номери Ñ€Ñдків разом з виведеними " "Ñ€Ñдками\n" " --line-buffered ÑпорожнÑти буфер піÑÐ»Ñ Ð²Ð¸Ð²ÐµÐ´ÐµÐ½Ð½Ñ ÐºÐ¾Ð¶Ð½Ð¾Ð³Ð¾ Ñ€Ñдка\n" " -H, --with-filename показувати Ð´Ð»Ñ ÐºÐ¾Ð¶Ð½Ð¾Ð³Ð¾ Ñ€Ñдка назву файла\n" " -h, --no-filename не показувати назв файлів у виведених даних\n" " --label=МІТКРпоказувати МІТКУ заміÑть назви файла Ð´Ð»Ñ " "Ñтандартного джерела вхідних даних\n" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" " -o, --only-matching показувати лише непорожні чаÑтини відповідних " "Ñ€Ñдків\n" " -q, --quiet, --silent придушити Ð²Ð¸Ð²ÐµÐ´ÐµÐ½Ð½Ñ Ð²ÑÑ–Ñ… звичайних даних\n" " --binary-files=ТИП припуÑкати, що вÑÑ– бінарні файли належать до " "ТИПу;\n" " ТИПом може бути `binary', `text' або `without-" "match'\n" " -a, --text те Ñаме, що Ñ– --binary-files=text\n" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" " -I те Ñаме, що Ñ– --binary-files=without-match\n" " -d, --directories=ДІЯ визначити ÑпоÑіб обробки каталогів;\n" " ДІЄЮ може бути `read' (прочитати), `recurse'\n" " (обробити рекурÑивно) або `skip' (пропуÑтити)\n" " -D, --devices=ДІЯ визначити ÑпоÑіб обробки файлів приÑтроїв, FIFO\n" " та Ñокетів;\n" " ДІЄЮ може бути `read' (прочитати) або `skip'\n" " (пропуÑтити)\n" " -r, --recursive те Ñаме, що Ñ– --directories=recurse\n" " -R, --dereference-recursive подібне, але з переходом за вÑіма " "Ñимволічними\n" " поÑиланнÑми\n" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" " --include=ВЗІРЕЦЬ шукати лише у файлах, назви Ñких відповідають " "ВЗІРЦЮ\n" " --exclude=ВЗІРЕЦЬ не шукати у файлах, назви Ñких відповідають " "ВЗІРЦЮ\n" " --exclude-from=ФÐЙЛ пропуÑтити файли, назви Ñких відповідають будь-" "Ñкому з шаблонів з ФÐЙЛа\n" " --exclude-dir=ВЗІРЕЦЬ пропуÑтити каталоги, назви Ñких відповідають " "ВЗІРЦЮ.\n" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" " -L, --files-without-match показати назви лише тих файлів, у Ñких немає " "вибраних Ñ€Ñдків\n" " -l, --files-with-matches показати назви лише тих файлів, у Ñких Ñ” вибрані " "Ñ€Ñдки\n" " -c, --count показувати лише вказану кількіÑть вибраних " "Ñ€Ñдків на ФÐЙЛ\n" " -T, --initial-tab вирівнювати результати табулÑцією (Ñкщо " "потрібно)\n" " -Z, --null вивеÑти байти 0 піÑÐ»Ñ Ð½Ð°Ð·Ð²Ð¸ ФÐЙЛа\n" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" "\n" "ÐšÐµÑ€ÑƒÐ²Ð°Ð½Ð½Ñ ÐºÐ¾Ð½Ñ‚ÐµÐºÑтом:\n" " -B, --before-context=ЧИСЛО показати ЧИСЛО Ñ€Ñдків перед Ñ€Ñдком з " "відповідником\n" " -A, --after-context=ЧИСЛО показати ЧИСЛО Ñ€Ñдків піÑÐ»Ñ Ñ€Ñдка з " "відповідником\n" " -C, --context=ЧИСЛО показати ЧИСЛО Ñ€Ñдків контекÑту виведених " "даних\n" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" " -ЧИСЛО те Ñаме, що Ñ– --context=ЧИСЛО\n" " --group-separator=РОЗД вивеÑти Ñимвол РОЗД у Ñ€Ñдку між відповідниками " "з контекÑтом\n" " --no-group-separator не виводити роздільник Ð´Ð»Ñ Ð²Ñ–Ð´Ð¿Ð¾Ð²Ñ–Ð´Ð½Ð¸ÐºÑ–Ð² із " "контекÑтом\n" " --color[=ДЕ],\n" " --colour[=ДЕ] викориÑтовувати маркери Ð´Ð»Ñ Ð¿Ð¾Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ\n" " Ñ€Ñдків з відповідниками\n" " ДЕ може приймати Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ \"always\", \"never\" " "чи \"auto\".\n" " -U, --binary не вилучати Ñимволи CR на кінці Ñ€Ñдка (MSDOS/" "Windows)\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" "Якщо ФÐЙЛом Ñ” «-», читати дані зі Ñтандартного джерела вхідних\n" "даних. Якщо не вказано ФÐЙЛ, читати «.», Ñкщо режим рекурÑивний, Ñ–\n" "«-», Ñкщо ні. Якщо вказано менше ніж два ФÐЙЛи, буде викориÑтано -h.\n" "Код Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð½Ñ 0 — Ñкщо було виÑвлено відповідник Ñ€Ñдка,\n" "1 — коли Ñ—Ñ… нема, 2 — Ñкщо ÑталаÑÑ Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ° Ñ– не було викориÑтано\n" "параметр -q.\n" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "задані умови відповідноÑті Ñ” Ñуперечливими" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" "Підтримки вÑÑ‚Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ð²Ñ–Ð´Ð¿Ð¾Ð²Ñ–Ð´Ð½Ð¾Ñті за правилами Perl у збірках із --" "disable-perl-regexp не передбачено" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "некоректний вираз порівнÑÐ½Ð½Ñ %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "невідомий ÑпоÑіб обробки Ð´Ð»Ñ Ð¿Ñ€Ð¸Ñтроїв" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "попередженнÑ: --unix-byte-offsets (-u) Ñ” заÑтарілим параметром" #: src/grep.c:2686 msgid "invalid max count" msgstr "помилкова макÑимальна кількіÑть" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "невідомий тип двійкових файлів" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" "Ðвторами програми Ñ” Mike Haertel та інші програміÑти; див.\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "не вдалоÑÑ Ð¾Ñ‚Ñ€Ð¸Ð¼Ð°Ñ‚Ð¸ облаÑть пам’Ñті під Ñтек JIT PCRE" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "у -P передбачено підтримку лише однобайтових локалей та UTF-8" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "аргументом параметра -P може бути лише один шаблон" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "Ð²Ð½ÑƒÑ‚Ñ€Ñ–ÑˆÐ½Ñ Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ° (такої помилки не повинно було ÑтатиÑÑ)" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "перевищено Ð¾Ð±Ð¼ÐµÐ¶ÐµÐ½Ð½Ñ Ð½Ð° довжину Ñ€Ñдка PCRE" #: src/pcresearch.c:306 #, c-format msgid "%s: memory exhausted" msgstr "%s: пам'Ñть вичерпано" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "%s: вичерпано Ñтек JIT PCRE" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "%s: перевищено Ð¾Ð±Ð¼ÐµÐ¶ÐµÐ½Ð½Ñ Ð½Ð° зворотне ÑÑ‚ÐµÐ¶ÐµÐ½Ð½Ñ Ñƒ PCRE" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "%s: перевищено Ð¾Ð±Ð¼ÐµÐ¶ÐµÐ½Ð½Ñ Ð½Ð° рекурÑÑ–ÑŽ у PCRE" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "%s: Ð²Ð½ÑƒÑ‚Ñ€Ñ–ÑˆÐ½Ñ Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ° PCRE: %d" �����������������������������������������������������������kbuild-3608/src/grep/po/tr.po�����������������������������������������������������������������������0000664�0001750�0001750�00000060512�14670377471�016061� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Turkish translations for GNU grep messages. # Copyright (C) 2005 Free Software Foundation, Inc. # Nilgün Belma Bugüner <nilgun@superonline.com>, 2001, ..., 2005 # msgid "" msgstr "" "Project-Id-Version: grep 2.5.1a\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2005-03-04 16:37+0300\n" "Last-Translator: Nilgün Belma Bugüner <nilgun@superonline.com>\n" "Language-Team: Turkish <gnu-tr-u12a@lists.sourceforge.net>\n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "X-Generator: KBabel 1.0\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "" #: lib/dfa.c:896 #, fuzzy msgid "unbalanced [" msgstr "Karşılıksız [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" #: lib/dfa.c:1210 #, fuzzy msgid "unfinished \\ escape" msgstr "Tamamlanmamış \\ öncelemi" #: lib/dfa.c:1371 #, fuzzy msgid "invalid content of \\{\\}" msgstr "en çok miktarı geçersiz" #: lib/dfa.c:1374 msgid "regular expression too big" msgstr "" #: lib/dfa.c:1858 #, fuzzy msgid "unbalanced (" msgstr "Karşılıksız (" #: lib/dfa.c:1975 #, fuzzy msgid "no syntax specified" msgstr "Sözdizimi belirtilmemiÅŸ" #: lib/dfa.c:1986 #, fuzzy msgid "unbalanced )" msgstr "Karşılıksız )" #: lib/error.c:195 msgid "Unknown system error" msgstr "Bilinmeyen sistem hatası" #: lib/getopt.c:278 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: `%s' seçeneÄŸi belirsiz\n" #: lib/getopt.c:284 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: `%s' seçeneÄŸi belirsiz\n" #: lib/getopt.c:319 #, fuzzy, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: `%c%s' seçeneÄŸi bilinmiyor\n" #: lib/getopt.c:345 #, fuzzy, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: seçenek `%c%s' argümansız kullanılır\n" #: lib/getopt.c:360 #, fuzzy, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: `%s' seçeneÄŸi bir argümanla kullanılır\n" #: lib/getopt.c:621 #, fuzzy, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: geçersiz seçenek -- %c\n" #: lib/getopt.c:636 lib/getopt.c:682 #, fuzzy, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: seçenek bir argümanla kullanılır -- %c\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "bellek tükendi" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "" #: lib/regcomp.c:138 msgid "No match" msgstr "" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "" #: lib/regcomp.c:156 msgid "Unmatched [, [^, [:, [., or [=" msgstr "" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "Bellek tükendi" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "Yazılım hatalarını <bug-grep@gnu.org> adresine,\n" "çeviri hatalarını <gnu-tr-u12a@lists.sourceforge.net> adresine bildirin.\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "" #: lib/version-etc.c:260 #, c-format msgid "General help using GNU software: <%s>\n" msgstr "" #: src/grep.c:649 msgid "(standard input)" msgstr "(standart girdi)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "baÄŸlam uzunluk deÄŸeri geçersiz" #: src/grep.c:894 msgid "input is too large to count" msgstr "girdi sayılamayacak kadar büyük" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "İkilik dosya %s eÅŸleÅŸir\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "ardışık dizin çevrimi" #: src/grep.c:1899 #, c-format msgid "%s: input file is also the output" msgstr "" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "Kullanımı: %s [SEÇENEK]... MASKE [DOSYA]...\n" #: src/grep.c:1963 #, fuzzy, c-format msgid "Try '%s --help' for more information.\n" msgstr "Daha fazla bilgi için `%s --help' yazın.\n" #: src/grep.c:1969 #, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "Standart girdi ya da her DOSYA içinde KALIP için arama yapar.\n" "ÖrneÄŸin: %s -i 'merhaba dunya' menu.h main.c\n" "\n" "Düzenli ifade seçimi ve yorumlanması:\n" #: src/grep.c:1975 #, fuzzy, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" " -E, --extended-regexp KALIP bir geniÅŸletilmiÅŸ düzenli ifadedir\n" " -F, --fixed-strings KALIP satır satır ayrılmış bir dizgedir\n" " -G, --basic-regexp KALIP bir temel düzenli ifadedir\n" " -P, --perl-regexp KALIP bir Perl düzenli ifadesidir\n" #: src/grep.c:1981 #, fuzzy, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" " -e, --regexp=KALIP KALIP bir düzenli ifade olarak kullanılır\n" " -f, --file=DOSYA KALIP DOSYA dan alınır\n" " -i, --ignore-case harf büyüklüklerini bir ayrım olarak görmez\n" " -w, --word-regexp KALIP bir deyim olarak ele alınır\n" " -x, --line-regexp KALIP bir bütün satır olarak ele alınır\n" " -z, --null-data satır sonu içermeyen 0 baytlık satır\n" #: src/grep.c:1989 #, fuzzy, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" "\n" "ÇeÅŸitli:\n" " -s, --no-messages hata iletileri gösterilmez\n" " -v, --invert-match eÅŸleÅŸmeyen satırlar seçilir\n" " -V, --version sürümü gösterir ve çıkar\n" " --help bu iletileri gösterir ve çıkar\n" " --mmap mümkünse bellek-eÅŸlemli girdi kullanılır\n" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" #: src/grep.c:2043 #, fuzzy, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" "\n" "BaÄŸlamsal denetim:\n" " -B, --before-context=SAYI baÄŸlamdan önceki SAYI satır gösterilir\n" " -A, --after-context=SAYI baÄŸlamdan sonraki SAYI satır gösterilir\n" " -C, --context=SAYI çıktı olarak SAYI satır gösterilir\n" " -SAYI --context=SAYI ile aynı\n" " --color[=SÜREÇ],\n" " --colour[=SÜREÇ] eÅŸleÅŸen dizgeleri ayırt etmede renk kullanılır\n" " SÜREÇ: daima 'always', hiç 'never', 'auto' -U, " "--binary satır sonlarındaki satırbaşı (CR) karakterlerini\n" " kaldırmaz\n" " -u, --unix-byte-offsets satırbaşı karakterlerine bakmaz\n" "\n" "`egrep' ile `grep -E', `fgrep' ile `grep -F' aynı iÅŸi yapar.\n" "DOSYA verilmeksizin ya da yerine - verilirse standart girdi okunur.\n" "İki DOSYAdan az verilmiÅŸse -h varsayılır.\n" "Çıkışta durum eÅŸleÅŸme varsa 0, yoksa 1, belirsizlik varsa 2 dir.\n" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "birbiriyle çatışan eÅŸleÅŸtiriciler belirtildi" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" #: src/grep.c:2103 #, fuzzy, c-format msgid "invalid matcher %s" msgstr "en çok miktarı geçersiz" #: src/grep.c:2538 msgid "unknown devices method" msgstr "bilinmeyen aygıt yöntemi" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "en çok miktarı geçersiz" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "bilinmeyen ikilik dosya türü" #: src/grep.c:2829 msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 #, fuzzy msgid "the -P option only supports a single pattern" msgstr "-P seçeneÄŸi desteklenmiyor" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "bellek tükendi" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "" #: src/pcresearch.c:327 #, c-format msgid "%s: internal PCRE error: %d" msgstr "" #, fuzzy, c-format #~ msgid "warning: %s: %s" #~ msgstr "uyarı: %s: %s\n" #, fuzzy #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: `--%s' seçeneÄŸi argümansız kullanılır\n" #, fuzzy #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: `--%s' seçeneÄŸi bilinmiyor\n" #, fuzzy #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: `-W %s' seçeneÄŸi belirsiz\n" #, fuzzy #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: `-W %s' seçeneÄŸi argümansız kullanılır\n" #, fuzzy #~ msgid "%s: option '-W %s' requires an argument\n" #~ msgstr "%s: `%s' seçeneÄŸi bir argümanla kullanılır\n" #~ msgid "unfinished repeat count" #~ msgstr "Tamamlanmamış tekrar sayısı" #~ msgid "malformed repeat count" #~ msgstr "Tekrar sayısı hatalı" #~ msgid "out of memory" #~ msgstr "bellek yetersiz" #~ msgid "writing output" #~ msgstr "çıktıyı yazıyor" #~ msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" #~ msgstr "Kullanımı: %s [SEÇENEK]... KALIP [DOSYA] ...\n" #~ msgid "" #~ "\n" #~ "Output control:\n" #~ " -m, --max-count=NUM stop after NUM matches\n" #~ " -b, --byte-offset print the byte offset with output lines\n" #~ " -n, --line-number print line number with output lines\n" #~ " --line-buffered flush output on every line\n" #~ " -H, --with-filename print the filename for each match\n" #~ " -h, --no-filename suppress the prefixing filename on output\n" #~ " --label=LABEL print LABEL as filename for standard input\n" #~ " -o, --only-matching show only the part of a line matching " #~ "PATTERN\n" #~ " -q, --quiet, --silent suppress all normal output\n" #~ " --binary-files=TYPE assume that binary files are TYPE\n" #~ " TYPE is 'binary', 'text', or 'without-match'\n" #~ " -a, --text equivalent to --binary-files=text\n" #~ " -I equivalent to --binary-files=without-match\n" #~ " -d, --directories=ACTION how to handle directories\n" #~ " ACTION is 'read', 'recurse', or 'skip'\n" #~ " -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" #~ " ACTION is 'read' or 'skip'\n" #~ " -R, -r, --recursive equivalent to --directories=recurse\n" #~ " --include=PATTERN files that match PATTERN will be examined\n" #~ " --exclude=PATTERN files that match PATTERN will be skipped.\n" #~ " --exclude-from=FILE files that match PATTERN in FILE will be " #~ "skipped.\n" #~ " -L, --files-without-match only print FILE names containing no match\n" #~ " -l, --files-with-matches only print FILE names containing matches\n" #~ " -c, --count only print a count of matching lines per " #~ "FILE\n" #~ " -Z, --null print 0 byte after FILE name\n" #~ msgstr "" #~ "\n" #~ "Çıktı denetimi:\n" #~ " -m, --max-count=SAYI SAYI eÅŸleÅŸmeden sonra durur\n" #~ " -b, --byte-offset çıktı satırlarında bayt adresi de gösterilir\n" #~ " -n, --line-number çıktı satırlarında satır no.ları da " #~ "gösterilir\n" #~ " --line-buffered her satırda tüm çıktı gösterilir\n" #~ " -H, --with-filename her eÅŸleÅŸmede dosya ismi de gösterilir\n" #~ " -h, --no-filename dosya ismi gösterilmez\n" #~ " --label=ETİKET standar girdi dosyası olarak ETİKET " #~ "gösterirlir\n" #~ " -o, --only-matching sadece satırın KALIPla eÅŸleÅŸen bölümü " #~ "gösterilir\n" #~ " -q, --quiet, --silent çıktı verilmez\n" #~ " --binary-files=TÜR ikilik dosyalar TÜR türünde varsayılır\n" #~ " TÜR: 'binary', 'text', ya da 'without-match'\n" #~ " -a, --text --binary-files=text ile aynı\n" #~ " -I --binary-files=without-match ile aynı\n" #~ " -d, --directories=EYLEM dizinlerin ele alınma ÅŸekli\n" #~ " EYLEM: 'read', 'recurse', ya da 'skip'\n" #~ " -D, --devices=EYLEM aygıtların ele alınma ÅŸekli, FIFO ve " #~ "soketler\n" #~ " için EYLEM: 'read' ya da 'skip'\n" #~ " -R, -r, --recursive --directories=recurse ile aynı (ardışık)\n" #~ " --include=KALIP KALIP ile eÅŸleÅŸen dosyalar gösterilir\n" #~ " --exclude=KALIP KALIP ile eÅŸleÅŸen dosyalar atlanır\n" #~ " --exclude-from=DOSYA DOSYA içindeki dosyalardan KALIP ile " #~ "eÅŸleÅŸenler atlanır.\n" #~ " -L, --files-without-match sadece eÅŸleÅŸmeyen DOSYA isimleri gösterilir\n" #~ " -l, --files-with-matches sadece eÅŸleÅŸen DOSYA isimleri gösterilir\n" #~ " -c, --count her DOSYAdaki eÅŸleÅŸen satır sayısı " #~ "gösterilir\n" #~ " -Z, --null DOSYA isminin arkasına null ekler\n" #~ msgid "unknown directories method" #~ msgstr "bilinmeyen dizin yöntemi" #~ msgid "%s (GNU grep) %s\n" #~ msgstr "%s (GNU grep) %s\n" #~ msgid "" #~ "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgstr "" #~ "Telif Hakkı 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" #~ msgid "" #~ "This is free software; see the source for copying conditions. There is " #~ "NO\n" #~ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " #~ "PURPOSE.\n" #~ msgstr "" #~ "Bu serbest yazılımdır; kopyalama koÅŸulları için kaynak koduna bakınız.\n" #~ "Hiçbir garantisi yoktur; hatta SATILABİLİRLİĞİ veya ÅžAHSİ KULLANIMINIZA\n" #~ "UYGUNLUÄžU için bile garanti verilmez.\n" #~ msgid "The -P and -z options cannot be combined" #~ msgstr "-P ve -z seçenekleri birlikte olamaz" #~ msgid "%s: illegal option -- %c\n" #~ msgstr "%s: kuraldışı seçenek -- %c\n" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/pa.po�����������������������������������������������������������������������0000664�0001750�0001750�00000051430�14670377450�016030� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Punjabi Translation for grep # Copyright (C) 2012 Free Software Foundation, Inc. # This file is distributed under the same license as the grep package. # # A S Alam <aalam@users.sf.net>, 2012. msgid "" msgstr "" "Project-Id-Version: grep 2.11.11-pre1\n" "Report-Msgid-Bugs-To: bug-grep@gnu.org\n" "POT-Creation-Date: 2021-08-14 12:54-0700\n" "PO-Revision-Date: 2012-05-19 17:52+0530\n" "Last-Translator: A S Alam <aalam@users.sf.net>\n" "Language-Team: Punjabi <punjabi-l10n@lists.sourceforge.net>\n" "Language: pa\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Bugs: Report translation errors to the Language-Team address.\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Lokalize 1.4\n" #: lib/argmatch.c:132 #, c-format msgid "invalid argument %s for %s" msgstr "%2$s ਲਈ ਗਲਤ ਆਰਗੂਮੈਂਟ %1$s" #: lib/argmatch.c:133 #, c-format msgid "ambiguous argument %s for %s" msgstr "" #: lib/argmatch.c:152 lib/argmatch.h:223 msgid "Valid arguments are:" msgstr "ਠੀਕ ਆਰਗੂਮੈਂਟ ਹਨ:" #: lib/c-stack.c:187 msgid "program error" msgstr "" #: lib/c-stack.c:188 msgid "stack overflow" msgstr "" #: lib/closeout.c:122 src/grep.c:1336 msgid "write error" msgstr "ਲਿਖਣ ਗਲਤੀ" #: lib/dfa.c:896 msgid "unbalanced [" msgstr "ਅਧੂਰੀ [" #: lib/dfa.c:1017 msgid "invalid character class" msgstr "ਗਲਤ ਕਰੈਕਟਰ ਕਲਾਸ" #: lib/dfa.c:1143 msgid "character class syntax is [[:space:]], not [:space:]" msgstr "" #: lib/dfa.c:1210 msgid "unfinished \\ escape" msgstr "" #: lib/dfa.c:1371 #, fuzzy msgid "invalid content of \\{\\}" msgstr "ਗਲਤ ਵੱਧ ਤੋਂ ਵੱਧ ਗਿਣਤੀ" #: lib/dfa.c:1374 #, fuzzy msgid "regular expression too big" msgstr "ਨਿਯਮਤ ਸਮੀਕਰਨ ਬਹà©à¨¤ ਵੱਡੀ ਹੈ" #: lib/dfa.c:1858 msgid "unbalanced (" msgstr "ਅਧੂਰੀ (" #: lib/dfa.c:1975 msgid "no syntax specified" msgstr "ਕੋਈ ਸੰਟੈਕਸ ਨਹੀਂ ਦਿੱਤਾ" #: lib/dfa.c:1986 msgid "unbalanced )" msgstr "ਅਧੂਰੀ )" #: lib/error.c:195 msgid "Unknown system error" msgstr "ਅਣਜਾਣ ਸਿਸਟਮ ਗਲਤੀ" #: lib/getopt.c:278 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous\n" msgstr "%s: ਚੋਣ '-W %s' ਸਧਾਰਨ ਹੈ।\n" #: lib/getopt.c:284 #, fuzzy, c-format msgid "%s: option '%s%s' is ambiguous; possibilities:" msgstr "%s: ਚੋਣ '-W %s' ਸਧਾਰਨ ਹੈ।\n" #: lib/getopt.c:319 #, fuzzy, c-format msgid "%s: unrecognized option '%s%s'\n" msgstr "%s: ਬੇ-ਪਛਾਣ ਚੋਣ '%c%s'\n" #: lib/getopt.c:345 #, fuzzy, c-format msgid "%s: option '%s%s' doesn't allow an argument\n" msgstr "%s: ਚੋਣ '%c%s' ਇੱਕ ਆਰਗੂਮੈਂਟ ਨਹੀਂ ਲੈਂਦੀ\n" #: lib/getopt.c:360 #, fuzzy, c-format msgid "%s: option '%s%s' requires an argument\n" msgstr "%s: ਚੋਣ '--%s' ਲਈ ਇੱਕ ਆਰਗੂਮੈਂਟ ਚਾਹੀਦਾ\n" #: lib/getopt.c:621 #, c-format msgid "%s: invalid option -- '%c'\n" msgstr "%s: ਗਲਤ ਚੋਣ -- '%c'\n" #: lib/getopt.c:636 lib/getopt.c:682 #, c-format msgid "%s: option requires an argument -- '%c'\n" msgstr "%s: ਚੋਣ ਲਈ ਆਰਗੂਮੈਂਟ ਚਾਹੀਦਾ ਹੈ --'%c'\n" #: lib/obstack.c:337 lib/obstack.c:339 lib/xalloc-die.c:34 msgid "memory exhausted" msgstr "ਮੈਮੋਰੀ ਖਤਮ ਹੋਈ" #: lib/openat-die.c:38 #, c-format msgid "unable to record current working directory" msgstr "ਮੌਜੂਦਾ ਕਾਰਜਕਾਰੀ ਡਾਇਰੈਕਟਰੀ ਰਿਕਾਰਡ ਕਰਨ ਲਈ ਅਸਮਰੱਥ" #: lib/openat-die.c:57 #, c-format msgid "failed to return to initial working directory" msgstr "ਸ਼à©à¨°à©‚ਆਤੀ ਕਾਰਜਕਾਰੀ ਡਾਇਰੈਕਟਰੀ ਦੇਣ ਲਈ ਫੇਲà©à¨¹" #: lib/xbinary-io.c:37 #, c-format msgid "failed to set file descriptor text/binary mode" msgstr "" #. TRANSLATORS: #. Get translations for open and closing quotation marks. #. The message catalog should translate "`" to a left #. quotation mark suitable for the locale, and similarly for #. "'". For example, a French Unicode local should translate #. these to U+00AB (LEFT-POINTING DOUBLE ANGLE #. QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE #. QUOTATION MARK), respectively. #. #. If the catalog has no translation, we will try to #. use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and #. Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the #. current locale is not Unicode, locale_quoting_style #. will quote 'like this', and clocale_quoting_style will #. quote "like this". You should always include translations #. for "`" and "'" even if U+2018 and U+2019 are appropriate #. for your locale. #. #. If you don't know what to put here, please see #. <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> #. and use glyphs suitable for your language. #: lib/quotearg.c:355 msgid "`" msgstr "`" #: lib/quotearg.c:356 msgid "'" msgstr "'" #: lib/regcomp.c:135 msgid "Success" msgstr "ਸਫ਼ਲ" #: lib/regcomp.c:138 msgid "No match" msgstr "ਕੋਈ ਮੇਲ ਨਹੀਂ" #: lib/regcomp.c:141 msgid "Invalid regular expression" msgstr "ਗਲਤ ਰੈਗੂਲਰ ਸਮੀਕਰਨ" #: lib/regcomp.c:144 msgid "Invalid collation character" msgstr "" #: lib/regcomp.c:147 msgid "Invalid character class name" msgstr "ਗਲਤ ਕਰੈਕਟਰ ਕਲਾਸ ਨਾਂ" #: lib/regcomp.c:150 msgid "Trailing backslash" msgstr "" #: lib/regcomp.c:153 msgid "Invalid back reference" msgstr "" #: lib/regcomp.c:156 #, fuzzy msgid "Unmatched [, [^, [:, [., or [=" msgstr "ਨਾ ਮਿਲਦੇ [ ਜਾਂ [^" #: lib/regcomp.c:159 msgid "Unmatched ( or \\(" msgstr "ਨਾ ਮਿਲਦੇ ( ਜਾਂ \\(" #: lib/regcomp.c:162 msgid "Unmatched \\{" msgstr "ਨਾ-ਮਿਲਦੇ \\{" #: lib/regcomp.c:165 msgid "Invalid content of \\{\\}" msgstr "" #: lib/regcomp.c:168 msgid "Invalid range end" msgstr "ਗਲਤ ਅੰਤ ਰੇਜ਼" #: lib/regcomp.c:171 msgid "Memory exhausted" msgstr "ਮੈਮੋਰੀ ਖਤਮ ਹੋਈ" #: lib/regcomp.c:174 msgid "Invalid preceding regular expression" msgstr "" #: lib/regcomp.c:177 msgid "Premature end of regular expression" msgstr "" #: lib/regcomp.c:180 msgid "Regular expression too big" msgstr "ਨਿਯਮਤ ਸਮੀਕਰਨ ਬਹà©à¨¤ ਵੱਡੀ ਹੈ" #: lib/regcomp.c:183 msgid "Unmatched ) or \\)" msgstr "ਨਾ ਮਿਲਦੇ ) ਜਾਂ \\)" #: lib/regcomp.c:676 msgid "No previous regular expression" msgstr "ਕੋਈ ਪਿਛਲਾ ਨਿਯਮਤ ਸਮੀਕਰਨ ਨਹੀਂ" #: lib/version-etc.c:73 #, c-format msgid "Packaged by %s (%s)\n" msgstr "%s (%s) ਵਲੋਂ ਪੈਕ ਕੀਤਾ\n" #: lib/version-etc.c:76 #, c-format msgid "Packaged by %s\n" msgstr "%s ਵਲੋਂ ਪੈਕੇਜ ਬਣਾਇਆ\n" #. TRANSLATORS: Translate "(C)" to the copyright symbol #. (C-in-a-circle), if this symbol is available in the user's #. locale. Otherwise, do not translate "(C)"; leave it as-is. #: lib/version-etc.c:83 msgid "(C)" msgstr "(C)" #. TRANSLATORS: The %s placeholder is the web address of the GPL license. #: lib/version-etc.c:88 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later <%s>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" #. TRANSLATORS: %s denotes an author name. #: lib/version-etc.c:105 #, c-format msgid "Written by %s.\n" msgstr "%s ਨੇ ਲਿਖਿਆ।\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:109 #, c-format msgid "Written by %s and %s.\n" msgstr "%s ਅਤੇ %s ਨੇ ਲਿਖਿਆ\n" #. TRANSLATORS: Each %s denotes an author name. #: lib/version-etc.c:113 #, c-format msgid "Written by %s, %s, and %s.\n" msgstr "%s, %s, ਅਤੇ %s ਨੇ ਲਿਖਿਆ।\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:120 #, c-format msgid "" "Written by %s, %s, %s,\n" "and %s.\n" msgstr "" "%s, %s, %s,\n" "ਅਤੇ %s ਨੇ ਲਿਖਿਆ\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:127 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "%s, %s, %s, %s,\n" "ਅਤੇ %s ਨੇ ਲਿਖਿਆ।\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:134 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, and %s.\n" msgstr "" "%s, %s, %s, %s, %s\n" "ਅਤੇ %s ਨੇ ਲਿਖਿਆ।\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:142 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, and %s.\n" msgstr "" "%s, %s, %s, %s, %s,\n" "%s ਅਤੇ %s ਨੇ ਲਿਖਿਆ।\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:150 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "and %s.\n" msgstr "" "%s. %s, %s, %s,\n" "%s, %s, %s ਅਤੇ %s\n" "ਨੇ ਲਿਖਿਆ।\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:159 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, and %s.\n" msgstr "" "%s. %s, %s, %s,\n" "%s, %s, %s, %s\n" "ਅਤੇ %s ਨੇ ਲਿਖਿਆ।\n" #. TRANSLATORS: Each %s denotes an author name. #. You can use line breaks, estimating that each author name occupies #. ca. 16 screen columns and that a screen line has ca. 80 columns. #: lib/version-etc.c:170 #, c-format msgid "" "Written by %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, %s, and others.\n" msgstr "" "%s, %s, %s, %s,\n" "%s, %s, %s, %s,\n" "%s, ਅਤੇ ਹੋਰਾਂ ਨੇ ਲਿਖਿਆ।\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: lib/version-etc.c:249 #, fuzzy, c-format msgid "Report bugs to: %s\n" msgstr "" "\n" "ਬੱਗ ਰਿਪੋਰਟ ਦਿਉ: %s\n" #: lib/version-etc.c:251 #, c-format msgid "Report %s bugs to: %s\n" msgstr "%s ਬੱਗ ਬਾਰੇ ਰਿਪੋਰਟ ਦਿਓ: %s\n" #: lib/version-etc.c:255 lib/version-etc.c:257 #, c-format msgid "%s home page: <%s>\n" msgstr "%s ਮà©à©±à¨– ਪੇਜ਼: <%s>\n" #: lib/version-etc.c:260 #, fuzzy, c-format msgid "General help using GNU software: <%s>\n" msgstr "ਗਨੂ ਸਾਫਟਵੇਅਰ ਦੀ ਵਰਤੋਂ ਲਈ ਆਮ ਮੱਦਦ ਵਾਸਤੇ: <http://www.gnu.org/gethelp/>\n" #: src/grep.c:649 msgid "(standard input)" msgstr "(ਸਟੈਂਡਰਡ ਆਉਟਪà©à©±à¨Ÿ)" #: src/grep.c:829 msgid "invalid context length argument" msgstr "" #: src/grep.c:894 msgid "input is too large to count" msgstr "ਇੰਪà©à©±à¨Ÿ ਗਿਣਤੀ ਕਰਨ ਲਈ ਬਹà©à¨¤ ਵੱਡੀ ਹੈ" #: src/grep.c:1641 #, fuzzy, c-format msgid "%s: binary file matches" msgstr "ਬਾਈਨਰੀ ਫਾਇਲ %s ਮਿਲਦੀ ਹੈ\n" #: src/grep.c:1679 #, fuzzy, c-format msgid "%s: warning: recursive directory loop" msgstr "ਲਗਾਤਾਰ ਡਾਇਰੈਕਟਰੀ ਲੂਪ" #: src/grep.c:1899 #, fuzzy, c-format msgid "%s: input file is also the output" msgstr "ਇੰਪà©à©±à¨Ÿ ਫਾਇਲ %s ਆਉਟਪà©à©±à¨Ÿ ਫਾਇਲ ਵੀ ਹੈ" #: src/grep.c:1961 src/grep.c:1968 #, fuzzy, c-format msgid "Usage: %s [OPTION]... PATTERNS [FILE]...\n" msgstr "ਵਰਤੋਂ: %s [ਚੋਣਾਂ]... ਪੈਟਰਨ [ਫਾਇਲ]...\n" #: src/grep.c:1963 #, c-format msgid "Try '%s --help' for more information.\n" msgstr "ਹੋਰ ਜਾਣਕਾਰੀ ਲਈ '%s --help' ਨਾਲ ਕੋਸ਼ਿਸ਼ ਕਰੋ।\n" #: src/grep.c:1969 #, fuzzy, c-format msgid "Search for PATTERNS in each FILE.\n" msgstr "ਹਰੇਕ ਫਾਇਲ (FILE) ਜਾਂ ਸਟੈਂਡਰਡ ਆਉਟਪà©à©±à¨Ÿ ਲਈ ਪੈਟਰਨ ਦੀ ਖੋਜ।\n" #: src/grep.c:1970 #, fuzzy, c-format msgid "" "Example: %s -i 'hello world' menu.h main.c\n" "PATTERNS can contain multiple patterns separated by newlines.\n" "\n" "Pattern selection and interpretation:\n" msgstr "" "ਉਦਾਹਰਨ: %s -i 'hello world' menu.h main.c\n" "\n" "ਨਿਯਮਤ-ਸਮੀਕਰਨ (Regexp) ਚੋਣ ਅਤੇ ਚਲਾਉਣਾ:\n" #: src/grep.c:1975 #, c-format msgid "" " -E, --extended-regexp PATTERNS are extended regular expressions\n" " -F, --fixed-strings PATTERNS are strings\n" " -G, --basic-regexp PATTERNS are basic regular expressions\n" " -P, --perl-regexp PATTERNS are Perl regular expressions\n" msgstr "" #: src/grep.c:1981 #, c-format msgid "" " -e, --regexp=PATTERNS use PATTERNS for matching\n" " -f, --file=FILE take PATTERNS from FILE\n" " -i, --ignore-case ignore case distinctions in patterns and data\n" " --no-ignore-case do not ignore case distinctions (default)\n" " -w, --word-regexp match only whole words\n" " -x, --line-regexp match only whole lines\n" " -z, --null-data a data line ends in 0 byte, not newline\n" msgstr "" #: src/grep.c:1989 #, c-format msgid "" "\n" "Miscellaneous:\n" " -s, --no-messages suppress error messages\n" " -v, --invert-match select non-matching lines\n" " -V, --version display version information and exit\n" " --help display this help text and exit\n" msgstr "" #: src/grep.c:1996 #, c-format msgid "" "\n" "Output control:\n" " -m, --max-count=NUM stop after NUM selected lines\n" " -b, --byte-offset print the byte offset with output lines\n" " -n, --line-number print line number with output lines\n" " --line-buffered flush output on every line\n" " -H, --with-filename print file name with output lines\n" " -h, --no-filename suppress the file name prefix on output\n" " --label=LABEL use LABEL as the standard input file name " "prefix\n" msgstr "" #: src/grep.c:2007 #, c-format msgid "" " -o, --only-matching show only nonempty parts of lines that match\n" " -q, --quiet, --silent suppress all normal output\n" " --binary-files=TYPE assume that binary files are TYPE;\n" " TYPE is 'binary', 'text', or 'without-match'\n" " -a, --text equivalent to --binary-files=text\n" msgstr "" #: src/grep.c:2014 #, c-format msgid "" " -I equivalent to --binary-files=without-match\n" " -d, --directories=ACTION how to handle directories;\n" " ACTION is 'read', 'recurse', or 'skip'\n" " -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n" " ACTION is 'read' or 'skip'\n" " -r, --recursive like --directories=recurse\n" " -R, --dereference-recursive likewise, but follow all symlinks\n" msgstr "" #: src/grep.c:2023 #, c-format msgid "" " --include=GLOB search only files that match GLOB (a file " "pattern)\n" " --exclude=GLOB skip files that match GLOB\n" " --exclude-from=FILE skip files that match any file pattern from " "FILE\n" " --exclude-dir=GLOB skip directories that match GLOB\n" msgstr "" #: src/grep.c:2030 #, c-format msgid "" " -L, --files-without-match print only names of FILEs with no selected " "lines\n" " -l, --files-with-matches print only names of FILEs with selected lines\n" " -c, --count print only a count of selected lines per FILE\n" " -T, --initial-tab make tabs line up (if needed)\n" " -Z, --null print 0 byte after FILE name\n" msgstr "" #: src/grep.c:2036 #, c-format msgid "" "\n" "Context control:\n" " -B, --before-context=NUM print NUM lines of leading context\n" " -A, --after-context=NUM print NUM lines of trailing context\n" " -C, --context=NUM print NUM lines of output context\n" msgstr "" #: src/grep.c:2043 #, c-format msgid "" " -NUM same as --context=NUM\n" " --group-separator=SEP print SEP on line between matches with context\n" " --no-group-separator do not print separator for matches with context\n" " --color[=WHEN],\n" " --colour[=WHEN] use markers to highlight the matching strings;\n" " WHEN is 'always', 'never', or 'auto'\n" " -U, --binary do not strip CR characters at EOL (MSDOS/" "Windows)\n" "\n" msgstr "" #: src/grep.c:2052 #, c-format msgid "" "When FILE is '-', read standard input. With no FILE, read '.' if\n" "recursive, '-' otherwise. With fewer than two FILEs, assume -h.\n" "Exit status is 0 if any line is selected, 1 otherwise;\n" "if any error occurs and -q is not given, the exit status is 2.\n" msgstr "" #: src/grep.c:2094 msgid "conflicting matchers specified" msgstr "" #: src/grep.c:2101 msgid "Perl matching not supported in a --disable-perl-regexp build" msgstr "" #: src/grep.c:2103 #, c-format msgid "invalid matcher %s" msgstr "ਗਲਤ ਮੈਚਰ %s" #: src/grep.c:2538 msgid "unknown devices method" msgstr "ਅਣਜਾਣ ਜੰਤਰ ਢੰਗ" #: src/grep.c:2580 #, c-format msgid "warning: --unix-byte-offsets (-u) is obsolete" msgstr "" #: src/grep.c:2686 msgid "invalid max count" msgstr "ਗਲਤ ਵੱਧ ਤੋਂ ਵੱਧ ਗਿਣਤੀ" #: src/grep.c:2744 msgid "unknown binary-files type" msgstr "ਅਣਜਾਣ ਬਾਈਨਰੀ-ਫਾਇਲ ਕਿਸਮ" #: src/grep.c:2829 #, fuzzy msgid "" "Written by Mike Haertel and others; see\n" "<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>." msgstr "ਹੋਰਾਂ ਲਈ <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS> ਵੇਖੋ" #: src/pcresearch.c:85 msgid "failed to allocate memory for the PCRE JIT stack" msgstr "" #: src/pcresearch.c:137 msgid "-P supports only unibyte and UTF-8 locales" msgstr "" #: src/pcresearch.c:143 msgid "the -P option only supports a single pattern" msgstr "" #: src/pcresearch.c:187 msgid "internal error (should never happen)" msgstr "" #: src/pcresearch.c:230 msgid "exceeded PCRE's line length limit" msgstr "" #: src/pcresearch.c:306 #, fuzzy, c-format msgid "%s: memory exhausted" msgstr "ਮੈਮੋਰੀ ਖਤਮ ਹੋਈ" #: src/pcresearch.c:310 #, c-format msgid "%s: exhausted PCRE JIT stack" msgstr "" #: src/pcresearch.c:315 #, c-format msgid "%s: exceeded PCRE's backtracking limit" msgstr "" #: src/pcresearch.c:319 #, c-format msgid "%s: exceeded PCRE's recursion limit" msgstr "" #: src/pcresearch.c:327 #, fuzzy, c-format msgid "%s: internal PCRE error: %d" msgstr "ਅੰਦਰੂਨੀ ਗਲਤੀ" #, c-format #~ msgid "warning: %s: %s" #~ msgstr "ਸਾਵਧਾਨ: %s: %s" #~ msgid "invalid %s%s argument '%s'" #~ msgstr "ਗਲਤ %s%s ਆਰਗੂਮੈਂਟ '%s'" #~ msgid "%s%s argument '%s' too large" #~ msgstr "%s%s ਆਰਗੂਮੈਂਟ '%s' ਬਹà©à¨¤ ਵੱਡਾ ਹੈ" #, fuzzy #~ msgid "%s home page: <https://www.gnu.org/software/%s/>\n" #~ msgstr "%s ਮà©à©±à¨– ਪੇਜ਼: <http://www.gnu.org/software/%s/>\n" #~ msgid "internal error" #~ msgstr "ਅੰਦਰੂਨੀ ਗਲਤੀ" #~ msgid "Mike Haertel" #~ msgstr "ਮਾਈਕ ਹਾਇਰਟੇਲ" #~ msgid "%s: option '--%s' doesn't allow an argument\n" #~ msgstr "%s: ਚੋਣ '--%s' ਇੱਕ ਆਰਗੂਮੈਂਟ ਨਹੀਂ ਲੈਂਦੀ\n" #~ msgid "%s: unrecognized option '--%s'\n" #~ msgstr "%s: ਬੇ-ਪਛਾਣ ਚੋਣ '--%s'\n" #~ msgid "%s: option '-W %s' is ambiguous\n" #~ msgstr "%s: ਚੋਣ '-W %s' ਸਧਾਰਨ ਹੈ।\n" #~ msgid "%s: option '-W %s' doesn't allow an argument\n" #~ msgstr "%s: ਚੋਣ '-W %s' ਲਈ ਕੋਈ ਆਰਗੂਮੈਂਟ ਨਹੀਂ ਚਾਹੀਦਾ\n" #~ msgid "PATTERN is, by default, a basic regular expression (BRE).\n" #~ msgstr "ਪੈਟਰਨ (PATTERN) ਮੂਲ ਰੂਪ ਵਿੱਚ ਇੱਕ ਨਿਯਮਤ ਸਕਰੀਨ (BRE) ਹà©à©°à¨¦à¨¾ ਹੈ।\n" #~ msgid "lseek failed" #~ msgstr "lseek ਫੇਲà©à¨¹ ਹੈ" #~ msgid "PATTERN is an extended regular expression (ERE).\n" #~ msgstr "ਪੈਟਰਨ ਇੱਕ ਵਾਧੂ ਨਿਯਮਤ ਸਮੀਕਰਨ ਹੈ (ERE) ਹੈ।\n" #~ msgid "GNU Grep home page: <%s>\n" #~ msgstr "ਗਨੂ Grep ਮà©à©±à¨– ਪੇਜ਼: <%s>\n" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/po/pa.gmo����������������������������������������������������������������������0000664�0001750�0001750�00000011734�14670377450�016177� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Þ•����2������¬��C���<������H�����I�����]��(���y�����¢�����¤�����¨�����¹�����Ö�����è��������������������<�����L�����a�����|�����“��&���›�����Â�����×�����é�� ���û������������;���4��3���p��/���¤��+���Ô��'������#���(�����L�����l�����ˆ�����˜��-���š�����È�����ä�����ÿ����������*�����<�����M��*���a�� ���Œ�� ���™�� ���¦�����³�����Í�� ���ä��Ê��ð�� ���» �� ���Ü ��O���ý �����M �����O ��-���S ��3��� �����µ ��/���Ó ��&��� �� ���* ��I���K ��0���• ��,���Æ ��C���ó ��;���7 �� ���s ��Z���€ ��,���Û ��%�����%���.�����T��*���n��'���™��X���Á��F�����B���a��>���¤��:���ã��7�����0���V��/���‡�����·�����Õ��k���×��T���C��3���˜��)���Ì�����ö��7�����&���H��9���o��~���©�����(�����:�����L��<���^��&���›�����Â���������&����������������������������/�����������������1�������!���������2���-���(���)�������������������� ������.���,����������������*���%���������0��� ����������������'����������� ���"���$���������������������#��� ������ ���������+������ ����%s home page: <%s> �%s: invalid option -- '%c' �%s: option requires an argument -- '%c' �'�(C)�(standard input)�Invalid character class name�Invalid range end�Invalid regular expression�Memory exhausted�No match�No previous regular expression�Packaged by %s �Packaged by %s (%s) �Regular expression too big�Report %s bugs to: %s �Success�Try '%s --help' for more information. �Unknown system error�Unmatched ( or \(�Unmatched ) or \)�Unmatched \{�Valid arguments are:�Written by %s and %s. �Written by %s, %s, %s, %s, %s, %s, %s, %s, %s, and others. �Written by %s, %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, %s, and %s. �Written by %s, %s, %s, %s, and %s. �Written by %s, %s, %s, and %s. �Written by %s, %s, and %s. �Written by %s. �`�failed to return to initial working directory�input is too large to count�invalid argument %s for %s�invalid character class�invalid matcher %s�invalid max count�memory exhausted�no syntax specified�unable to record current working directory�unbalanced (�unbalanced )�unbalanced [�unknown binary-files type�unknown devices method�write error�Project-Id-Version: grep 2.11.11-pre1 Report-Msgid-Bugs-To: bug-grep@gnu.org PO-Revision-Date: 2012-05-19 17:52+0530 Last-Translator: A S Alam <aalam@users.sf.net> Language-Team: Punjabi <punjabi-l10n@lists.sourceforge.net> Language: pa MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bugs: Report translation errors to the Language-Team address. Plural-Forms: nplurals=2; plural=n != 1; X-Generator: Lokalize 1.4 �%s ਮà©à©±à¨– ਪੇਜ਼: <%s> �%s: ਗਲਤ ਚੋਣ -- '%c' �%s: ਚੋਣ ਲਈ ਆਰਗੂਮੈਂਟ ਚਾਹੀਦਾ ਹੈ --'%c' �'�(C)�(ਸਟੈਂਡਰਡ ਆਉਟਪà©à©±à¨Ÿ)�ਗਲਤ ਕਰੈਕਟਰ ਕਲਾਸ ਨਾਂ�ਗਲਤ ਅੰਤ ਰੇਜ਼�ਗਲਤ ਰੈਗੂਲਰ ਸਮੀਕਰਨ�ਮੈਮੋਰੀ ਖਤਮ ਹੋਈ�ਕੋਈ ਮੇਲ ਨਹੀਂ�ਕੋਈ ਪਿਛਲਾ ਨਿਯਮਤ ਸਮੀਕਰਨ ਨਹੀਂ�%s ਵਲੋਂ ਪੈਕੇਜ ਬਣਾਇਆ �%s (%s) ਵਲੋਂ ਪੈਕ ਕੀਤਾ �ਨਿਯਮਤ ਸਮੀਕਰਨ ਬਹà©à¨¤ ਵੱਡੀ ਹੈ�%s ਬੱਗ ਬਾਰੇ ਰਿਪੋਰਟ ਦਿਓ: %s �ਸਫ਼ਲ�ਹੋਰ ਜਾਣਕਾਰੀ ਲਈ '%s --help' ਨਾਲ ਕੋਸ਼ਿਸ਼ ਕਰੋ। �ਅਣਜਾਣ ਸਿਸਟਮ ਗਲਤੀ�ਨਾ ਮਿਲਦੇ ( ਜਾਂ \(�ਨਾ ਮਿਲਦੇ ) ਜਾਂ \)�ਨਾ-ਮਿਲਦੇ \{�ਠੀਕ ਆਰਗੂਮੈਂਟ ਹਨ:�%s ਅਤੇ %s ਨੇ ਲਿਖਿਆ �%s, %s, %s, %s, %s, %s, %s, %s, %s, ਅਤੇ ਹੋਰਾਂ ਨੇ ਲਿਖਿਆ। �%s. %s, %s, %s, %s, %s, %s, %s ਅਤੇ %s ਨੇ ਲਿਖਿਆ। �%s. %s, %s, %s, %s, %s, %s ਅਤੇ %s ਨੇ ਲਿਖਿਆ। �%s, %s, %s, %s, %s, %s ਅਤੇ %s ਨੇ ਲਿਖਿਆ। �%s, %s, %s, %s, %s ਅਤੇ %s ਨੇ ਲਿਖਿਆ। �%s, %s, %s, %s, ਅਤੇ %s ਨੇ ਲਿਖਿਆ। �%s, %s, %s, ਅਤੇ %s ਨੇ ਲਿਖਿਆ �%s, %s, ਅਤੇ %s ਨੇ ਲਿਖਿਆ। �%s ਨੇ ਲਿਖਿਆ। �`�ਸ਼à©à¨°à©‚ਆਤੀ ਕਾਰਜਕਾਰੀ ਡਾਇਰੈਕਟਰੀ ਦੇਣ ਲਈ ਫੇਲà©à¨¹�ਇੰਪà©à©±à¨Ÿ ਗਿਣਤੀ ਕਰਨ ਲਈ ਬਹà©à¨¤ ਵੱਡੀ ਹੈ�%2$s ਲਈ ਗਲਤ ਆਰਗੂਮੈਂਟ %1$s�ਗਲਤ ਕਰੈਕਟਰ ਕਲਾਸ�ਗਲਤ ਮੈਚਰ %s�ਗਲਤ ਵੱਧ ਤੋਂ ਵੱਧ ਗਿਣਤੀ�ਮੈਮੋਰੀ ਖਤਮ ਹੋਈ�ਕੋਈ ਸੰਟੈਕਸ ਨਹੀਂ ਦਿੱਤਾ�ਮੌਜੂਦਾ ਕਾਰਜਕਾਰੀ ਡਾਇਰੈਕਟਰੀ ਰਿਕਾਰਡ ਕਰਨ ਲਈ ਅਸਮਰੱਥ�ਅਧੂਰੀ (�ਅਧੂਰੀ )�ਅਧੂਰੀ [�ਅਣਜਾਣ ਬਾਈਨਰੀ-ਫਾਇਲ ਕਿਸਮ�ਅਣਜਾਣ ਜੰਤਰ ਢੰਗ�ਲਿਖਣ ਗਲਤੀ�������������������������������������kbuild-3608/src/grep/GNUmakefile��������������������������������������������������������������������0000664�0001750�0001750�00000010741�14670377426�016527� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Having a separate GNUmakefile lets me 'include' the dynamically # generated rules created via cfg.mk (package-local configuration) # as well as maint.mk (generic maintainer rules). # This makefile is used only if you run GNU Make. # It is necessary if you want to build targets usually of interest # only to the maintainer. # Copyright (C) 2001, 2003, 2006-2021 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 <https://www.gnu.org/licenses/>. # If the user runs GNU make but has not yet run ./configure, # give them a diagnostic. _gl-Makefile := $(wildcard [M]akefile) ifneq ($(_gl-Makefile),) # Make tar archive easier to reproduce. export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner # Allow the user to add to this in the Makefile. ALL_RECURSIVE_TARGETS = include Makefile # Some projects override e.g., _autoreconf here. -include $(srcdir)/cfg.mk # Allow cfg.mk to override these. _build-aux ?= build-aux _autoreconf ?= autoreconf -v include $(srcdir)/maint.mk # Ensure that $(VERSION) is up to date for dist-related targets, but not # for others: rerunning autoreconf and recompiling everything isn't cheap. _have-git-version-gen := \ $(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes) ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL)) _is-dist-target ?= $(filter-out %clean, \ $(filter maintainer-% dist% alpha beta stable,$(MAKECMDGOALS))) _is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS))) ifneq (,$(_is-dist-target)$(_is-install-target)) _curr-ver := $(shell cd $(srcdir) \ && $(_build-aux)/git-version-gen \ .tarball-version \ $(git-version-gen-tag-sed-script)) ifneq ($(_curr-ver),$(VERSION)) ifeq ($(_curr-ver),UNKNOWN) $(info WARNING: unable to verify if $(VERSION) is the correct version) else ifneq (,$(_is-install-target)) # GNU Coding Standards state that 'make install' should not cause # recompilation after 'make all'. But as long as changing the version # string alters config.h, the cost of having 'make all' always have an # up-to-date version is prohibitive. So, as a compromise, we merely # warn when installing a version string that is out of date; the user # should run 'autoreconf' (or something like 'make distcheck') to # fix the version, 'make all' to propagate it, then 'make install'. $(info WARNING: version string $(VERSION) is out of date;) $(info run '$(MAKE) _version' to fix it) else $(info INFO: running autoreconf for new version string: $(_curr-ver)) GNUmakefile: _version touch GNUmakefile endif endif endif endif endif .PHONY: _version _version: cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf) $(MAKE) $(AM_MAKEFLAGS) Makefile else .DEFAULT_GOAL := abort-due-to-no-makefile srcdir = . # The package can override .DEFAULT_GOAL to run actions like autoreconf. -include ./cfg.mk # Allow cfg.mk to override these. _build-aux ?= build-aux _autoreconf ?= autoreconf -v include ./maint.mk ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile) $(MAKECMDGOALS): abort-due-to-no-makefile endif abort-due-to-no-makefile: @echo There seems to be no Makefile in this directory. 1>&2 @echo "You must run ./configure before running '$(MAKE)'." 1>&2 @exit 1 endif # Tell version 3.79 and up of GNU make to not build goals in this # directory in parallel, in case someone tries to build multiple # targets, and one of them can cause a recursive target to be invoked. # Only set this if Automake doesn't provide it. AM_RECURSIVE_TARGETS ?= $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) \ dist distcheck tags ctags ALL_RECURSIVE_TARGETS += $(AM_RECURSIVE_TARGETS) ifneq ($(word 2, $(MAKECMDGOALS)), ) ifneq ($(filter $(ALL_RECURSIVE_TARGETS), $(MAKECMDGOALS)), ) .NOTPARALLEL: endif endif �������������������������������kbuild-3608/src/grep/THANKS.in����������������������������������������������������������������������0000664�0001750�0001750�00000012654�14670377426�016002� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������These people have contributed to the GNU grep. Those contributions are described in the version control logs. If your name has been left out, if you'd rather not be listed, or if you'd prefer a different address be used, please send a note to the bug-report mailing list (as seen at end of e.g., grep --help). ## ## There is no need to list here any name that appears as an Author in ## "git log" output. Those are automatically added when this template ## is used to generate the THANKS file. Note that numerous people listed ## here would have been listed as commit authors if we had been using git ## for version control when they contributed. Akim Demaille akim@epita.fr Andreas Schwab schwab@suse.de Andreas Ley andy@rz.uni-karlsruhe.de Bastiaan "Darquan" Stougie darquan@zonnet.nl Ben Elliston bje@cygnus.com Bernd Strieder strieder@student.uni-kl.de Bob Proulx rwp@hprwp.fc.hp.com Brian Youmans 3diff@gnu.org Christian Boltz grep-bug@cboltz.de Christian Groessler cpg@aladdin.de Dagobert Michelsen dam@opencsw.org Daisuke GOTO gotoh@m-design.com Dave Reisner d@falconindy.com David Clissold cliss@austin.ibm.com David J MacKenzie djm@catapult.va.pubnix.com David O'Brien obrien@freebsd.org 'Drake' Daham Wang drakewang@gmail.com Egmont Koblinger egmont@gmail.com Fernando Basso fernandobasso.br@gmail.com Florian La Roche laroche@redhat.com François Pinard pinard@iro.umontreal.ca Gerald Stoller gerald_stoller@hotmail.com Grant McDorman grant@isgtec.com Greg Boyd gboyd.ccsf@gmail.com Greg Louis glouis@dynamicro.on.ca Guglielmo 'bond' Bondioni g.bondioni@libero.it H. Merijn Brand h.m.brand@hccnet.nl Harald Hanche-Olsen hanche@math.ntnu.no Hans-Bernhard Broeker broeker@physik.rwth-aachen.de Heikki Korpela heko@iki.fi Igor O. Ladygin assa@zabtrans.ru Ilya Basin basinilya@gmail.com Isamu Hasegawa isamu@yamato.ibm.com Jeff Bailey jbailey@nisa.net Jim Hand jhand@austx.tandem.com Jochen Hein jochen.hein@delphi.central.de Joel N. Weber II devnull@gnu.org John Hughes john@nitelite.calvacom.fr Jorge Stolfi stolfi@dcc.unicamp.br Karl Heuer kwzh@gnu.org Kaveh R. Ghazi ghazi@caip.rutgers.edu Kazuro Furukawa furukawa@apricot.kek.jp Keith Bostic bostic@bsdi.com Krishna Sethuraman krishna@sgihub.corp.sgi.com Kurt D Schwehr kdschweh@insci14.ucsd.edu Ludovic Courtès ludo@gnu.org Marc Aldorasi m101010a@gmail.com Mark Waite markw@mddmew.fc.hp.com Martin P.J. Zinser zinser@decus.de Martin Rex martin.rex@sap-ag.de Michael Aichlmayr mikla@nx.com Miles Bader miles@ccs.mt.nec.co.jp Mirraz Mirraz mirraz1@rambler.ru Nelson H. F. Beebe beebe@math.utah.edu Nima Aghdaii naghdaii@fb.com Olaf Kirch okir@ns.lst.de Paul Kimoto kimoto@spacenet.tn.cornell.edu Péter Radics mitchnull@gmail.com Phillip C. Brisco phillip.craig.brisco@ccmail.census.gov Philipp Kohlbecher xt28@gmx.de Philippe Defert Philippe.Defert@cern.ch Philippe De Muyter phdm@info.ucl.ac.be Philip Hazel ph10@cus.cam.ac.uk Rainer Orth ro@cebitec.uni-bielefeld.de Roland Roberts rroberts@muller.com Ruslan Ermilov ru@freebsd.org Santiago Vila sanvila@unex.es Shannon Hill hill@synnet.com Sotiris Vassilopoulos Sotiris.Vassilopoulos@betatech.gr Standish Parsley adsspamtrap01@yahoo.com Stewart Levin stew@sep.stanford.edu Strahinja Kustudic kustodian@gmail.com Sven Joachim svenjoac@gmx.de Sydoruk Stepan step@unitex.kiev.ua Tapani Tarvainen tt@mit.jyu.fi Tim Waugh twaugh@redhat.com Tom 'moof' Spindler dogcow@ccs.neu.edu Tom Tromey tromey@creche.cygnus.com Ulrich Drepper drepper@cygnus.com UEBAYASHI Masao masao@nf.enveng.titech.ac.jp Uwe H. Steinfeld usteinfeld@gmx.net Volker Borchert bt@teknon.de Wichert Akkerman wichert@cistron.nl William Bader william@nscs.fast.net Wolfgang Schludi schludi@syscomp.de Zoltan Herczeg hzmester@freemail.hu ;; Local Variables: ;; coding: utf-8 ;; End: ������������������������������������������������������������������������������������kbuild-3608/src/grep/doc/���������������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377431�015213� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/doc/Makefile.am����������������������������������������������������������������0000664�0001750�0001750�00000002366�14670377427�017263� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Process this file with automake to create Makefile.in # Makefile.am for grep/doc. # # Copyright 2008-2021 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, 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 <https://www.gnu.org/licenses/>. info_TEXINFOS = grep.texi grep_TEXINFOS = fdl.texi man_MANS = grep.1 fgrep.1 egrep.1 EXTRA_DIST = grep.in.1 CLEANFILES = grep.1 egrep.1 fgrep.1 grep.1: grep.in.1 $(AM_V_GEN)rm -f $@-t $@ $(AM_V_at)sed 's/@''VERSION@/$(VERSION)/' $(srcdir)/grep.in.1 > $@-t $(AM_V_at)chmod a=r $@-t $(AM_V_at)mv -f $@-t $@ egrep.1 fgrep.1: Makefile.am $(AM_V_GEN)rm -f $@-t $@ $(AM_V_at)inst=`echo grep | sed '$(transform)'`.1 \ && echo ".so man1/$$inst" > $@-t $(AM_V_at)chmod a=r $@-t $(AM_V_at)mv -f $@-t $@ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/doc/Makefile.in����������������������������������������������������������������0000664�0001750�0001750�00000241342�14670377431�017266� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Makefile.in generated by automake 1.16d from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Process this file with automake to create Makefile.in # Makefile.am for grep/doc. # # Copyright 2008-2021 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, 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 <https://www.gnu.org/licenses/>. VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/__inline.m4 \ $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \ $(top_srcdir)/m4/arpa_inet_h.m4 \ $(top_srcdir)/m4/asm-underscore.m4 $(top_srcdir)/m4/assert.m4 \ $(top_srcdir)/m4/btowc.m4 $(top_srcdir)/m4/builtin-expect.m4 \ $(top_srcdir)/m4/c-stack.m4 $(top_srcdir)/m4/calloc.m4 \ $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/close.m4 \ $(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/ctype_h.m4 \ $(top_srcdir)/m4/cycle-check.m4 $(top_srcdir)/m4/d-ino.m4 \ $(top_srcdir)/m4/d-type.m4 $(top_srcdir)/m4/dirent_h.m4 \ $(top_srcdir)/m4/dirfd.m4 \ $(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup.m4 \ $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exponentd.m4 \ $(top_srcdir)/m4/extensions.m4 \ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopen.m4 $(top_srcdir)/m4/fdopendir.m4 \ $(top_srcdir)/m4/filenamecat.m4 $(top_srcdir)/m4/flexmember.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fnmatch.m4 \ $(top_srcdir)/m4/fnmatch_h.m4 $(top_srcdir)/m4/fopen.m4 \ $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/fpieee.m4 \ $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/fstat.m4 \ $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/ftruncate.m4 \ $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \ $(top_srcdir)/m4/getpagesize.m4 \ $(top_srcdir)/m4/getprogname.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/iconv_h.m4 \ $(top_srcdir)/m4/iconv_open.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_pton.m4 \ $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intl-thread-locale.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax_t.m4 \ $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes.m4 \ $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/ioctl.m4 \ $(top_srcdir)/m4/isatty.m4 $(top_srcdir)/m4/isblank.m4 \ $(top_srcdir)/m4/iswblank.m4 $(top_srcdir)/m4/iswctype.m4 \ $(top_srcdir)/m4/iswdigit.m4 $(top_srcdir)/m4/iswxdigit.m4 \ $(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \ $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/libsigsegv.m4 \ $(top_srcdir)/m4/libunistring-base.m4 \ $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/localcharset.m4 \ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \ $(top_srcdir)/m4/locale-tr.m4 $(top_srcdir)/m4/locale-zh.m4 \ $(top_srcdir)/m4/locale_h.m4 $(top_srcdir)/m4/localeconv.m4 \ $(top_srcdir)/m4/localename.m4 $(top_srcdir)/m4/lock.m4 \ $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/lstat.m4 \ $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/malloca.m4 \ $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/mbchar.m4 \ $(top_srcdir)/m4/mbiter.m4 $(top_srcdir)/m4/mbrlen.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \ $(top_srcdir)/m4/mbslen.m4 $(top_srcdir)/m4/mbsrtowcs.m4 \ $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbtowc.m4 \ $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/minmax.m4 \ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/musl.m4 $(top_srcdir)/m4/nanosleep.m4 \ $(top_srcdir)/m4/netinet_in_h.m4 \ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/obstack.m4 \ $(top_srcdir)/m4/off_t.m4 $(top_srcdir)/m4/open-cloexec.m4 \ $(top_srcdir)/m4/open-slash.m4 $(top_srcdir)/m4/open.m4 \ $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/opendir.m4 \ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/pcre.m4 \ $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/perror.m4 \ $(top_srcdir)/m4/pipe.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/pthread-thread.m4 \ $(top_srcdir)/m4/pthread_h.m4 \ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \ $(top_srcdir)/m4/pthread_sigmask.m4 $(top_srcdir)/m4/putenv.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/rawmemchr.m4 \ $(top_srcdir)/m4/read.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/reallocarray.m4 \ $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/safe-read.m4 \ $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/sched_h.m4 \ $(top_srcdir)/m4/select.m4 $(top_srcdir)/m4/setenv.m4 \ $(top_srcdir)/m4/setlocale.m4 \ $(top_srcdir)/m4/setlocale_null.m4 \ $(top_srcdir)/m4/sigaction.m4 $(top_srcdir)/m4/sigaltstack.m4 \ $(top_srcdir)/m4/signal_h.m4 \ $(top_srcdir)/m4/signalblocking.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/sleep.m4 \ $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/socketlib.m4 \ $(top_srcdir)/m4/sockets.m4 $(top_srcdir)/m4/socklen.m4 \ $(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stack-direction.m4 \ $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \ $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdarg.m4 \ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/stpcpy.m4 $(top_srcdir)/m4/strdup.m4 \ $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/strerror_r.m4 \ $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strnlen.m4 \ $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtoimax.m4 \ $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoull.m4 \ $(top_srcdir)/m4/strtoumax.m4 $(top_srcdir)/m4/symlink.m4 \ $(top_srcdir)/m4/sys_ioctl_h.m4 \ $(top_srcdir)/m4/sys_select_h.m4 \ $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/sys_uio_h.m4 \ $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/unistd-safer.m4 \ $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/version-etc.m4 \ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/warn-on-use.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_h.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcrtomb.m4 \ $(top_srcdir)/m4/wctob.m4 $(top_srcdir)/m4/wctomb.m4 \ $(top_srcdir)/m4/wctype_h.m4 $(top_srcdir)/m4/wcwidth.m4 \ $(top_srcdir)/m4/windows-stat-inodes.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/wmemchr.m4 \ $(top_srcdir)/m4/wmempcpy.m4 $(top_srcdir)/m4/xalloc.m4 \ $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrtol.m4 \ $(top_srcdir)/m4/year2038.m4 $(top_srcdir)/m4/zzgnulib.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/version.texi \ $(srcdir)/stamp-vti $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = AM_V_DVIPS = $(am__v_DVIPS_@AM_V@) am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@) am__v_DVIPS_0 = @echo " DVIPS " $@; am__v_DVIPS_1 = AM_V_MAKEINFO = $(am__v_MAKEINFO_@AM_V@) am__v_MAKEINFO_ = $(am__v_MAKEINFO_@AM_DEFAULT_V@) am__v_MAKEINFO_0 = @echo " MAKEINFO" $@; am__v_MAKEINFO_1 = AM_V_INFOHTML = $(am__v_INFOHTML_@AM_V@) am__v_INFOHTML_ = $(am__v_INFOHTML_@AM_DEFAULT_V@) am__v_INFOHTML_0 = @echo " INFOHTML" $@; am__v_INFOHTML_1 = AM_V_TEXI2DVI = $(am__v_TEXI2DVI_@AM_V@) am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_@AM_DEFAULT_V@) am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@; am__v_TEXI2DVI_1 = AM_V_TEXI2PDF = $(am__v_TEXI2PDF_@AM_V@) am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_@AM_DEFAULT_V@) am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@; am__v_TEXI2PDF_1 = AM_V_texinfo = $(am__v_texinfo_@AM_V@) am__v_texinfo_ = $(am__v_texinfo_@AM_DEFAULT_V@) am__v_texinfo_0 = -q am__v_texinfo_1 = AM_V_texidevnull = $(am__v_texidevnull_@AM_V@) am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@) am__v_texidevnull_0 = > /dev/null am__v_texidevnull_1 = INFO_DEPS = $(srcdir)/grep.info TEXINFO_TEX = $(top_srcdir)/build-aux/texinfo.tex am__TEXINFO_TEX_DIR = $(top_srcdir)/build-aux DVIS = grep.dvi PDFS = grep.pdf PSS = grep.ps HTMLS = grep.html TEXINFOS = grep.texi TEXI2DVI = texi2dvi TEXI2PDF = $(TEXI2DVI) --pdf --batch MAKEINFOHTML = $(MAKEINFO) --html AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) DVIPS = dvips am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(grep_TEXINFOS) $(srcdir)/Makefile.in \ $(top_srcdir)/build-aux/mdate-sh \ $(top_srcdir)/build-aux/texinfo.tex DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkglibexecdir = @pkglibexecdir@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ AR = @AR@ ARFLAGS = @ARFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ COLORIZE_SOURCE = @COLORIZE_SOURCE@ CONFIG_INCLUDE = @CONFIG_INCLUDE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ ENOLINK_VALUE = @ENOLINK_VALUE@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ FNMATCH_H = @FNMATCH_H@ GETOPT_CDEFS_H = @GETOPT_CDEFS_H@ GETOPT_H = @GETOPT_H@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@ GL_CXXFLAG_ALLOW_WARNINGS = @GL_CXXFLAG_ALLOW_WARNINGS@ GL_GNULIB_ACCEPT = @GL_GNULIB_ACCEPT@ GL_GNULIB_ACCEPT4 = @GL_GNULIB_ACCEPT4@ GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@ GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@ GL_GNULIB_ALPHASORT = @GL_GNULIB_ALPHASORT@ GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@ GL_GNULIB_BIND = @GL_GNULIB_BIND@ GL_GNULIB_BTOWC = @GL_GNULIB_BTOWC@ GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@ GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@ GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@ GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@ GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@ GL_GNULIB_CLOSEDIR = @GL_GNULIB_CLOSEDIR@ GL_GNULIB_CONNECT = @GL_GNULIB_CONNECT@ GL_GNULIB_COPY_FILE_RANGE = @GL_GNULIB_COPY_FILE_RANGE@ GL_GNULIB_CREAT = @GL_GNULIB_CREAT@ GL_GNULIB_CTIME = @GL_GNULIB_CTIME@ GL_GNULIB_DIRFD = @GL_GNULIB_DIRFD@ GL_GNULIB_DPRINTF = @GL_GNULIB_DPRINTF@ GL_GNULIB_DUP = @GL_GNULIB_DUP@ GL_GNULIB_DUP2 = @GL_GNULIB_DUP2@ GL_GNULIB_DUP3 = @GL_GNULIB_DUP3@ GL_GNULIB_DUPLOCALE = @GL_GNULIB_DUPLOCALE@ GL_GNULIB_ENVIRON = @GL_GNULIB_ENVIRON@ GL_GNULIB_EUIDACCESS = @GL_GNULIB_EUIDACCESS@ GL_GNULIB_EXECL = @GL_GNULIB_EXECL@ GL_GNULIB_EXECLE = @GL_GNULIB_EXECLE@ GL_GNULIB_EXECLP = @GL_GNULIB_EXECLP@ GL_GNULIB_EXECV = @GL_GNULIB_EXECV@ GL_GNULIB_EXECVE = @GL_GNULIB_EXECVE@ GL_GNULIB_EXECVP = @GL_GNULIB_EXECVP@ GL_GNULIB_EXECVPE = @GL_GNULIB_EXECVPE@ GL_GNULIB_EXPLICIT_BZERO = @GL_GNULIB_EXPLICIT_BZERO@ GL_GNULIB_FACCESSAT = @GL_GNULIB_FACCESSAT@ GL_GNULIB_FCHDIR = @GL_GNULIB_FCHDIR@ GL_GNULIB_FCHMODAT = @GL_GNULIB_FCHMODAT@ GL_GNULIB_FCHOWNAT = @GL_GNULIB_FCHOWNAT@ GL_GNULIB_FCLOSE = @GL_GNULIB_FCLOSE@ GL_GNULIB_FCNTL = @GL_GNULIB_FCNTL@ GL_GNULIB_FDATASYNC = @GL_GNULIB_FDATASYNC@ GL_GNULIB_FDOPEN = @GL_GNULIB_FDOPEN@ GL_GNULIB_FDOPENDIR = @GL_GNULIB_FDOPENDIR@ GL_GNULIB_FFLUSH = @GL_GNULIB_FFLUSH@ GL_GNULIB_FFSL = @GL_GNULIB_FFSL@ GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@ GL_GNULIB_FGETC = @GL_GNULIB_FGETC@ GL_GNULIB_FGETS = @GL_GNULIB_FGETS@ GL_GNULIB_FNMATCH = @GL_GNULIB_FNMATCH@ GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@ GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@ GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@ GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@ GL_GNULIB_FPUTC = @GL_GNULIB_FPUTC@ GL_GNULIB_FPUTS = @GL_GNULIB_FPUTS@ GL_GNULIB_FREAD = @GL_GNULIB_FREAD@ GL_GNULIB_FREE_POSIX = @GL_GNULIB_FREE_POSIX@ GL_GNULIB_FREOPEN = @GL_GNULIB_FREOPEN@ GL_GNULIB_FSCANF = @GL_GNULIB_FSCANF@ GL_GNULIB_FSEEK = @GL_GNULIB_FSEEK@ GL_GNULIB_FSEEKO = @GL_GNULIB_FSEEKO@ GL_GNULIB_FSTAT = @GL_GNULIB_FSTAT@ GL_GNULIB_FSTATAT = @GL_GNULIB_FSTATAT@ GL_GNULIB_FSYNC = @GL_GNULIB_FSYNC@ GL_GNULIB_FTELL = @GL_GNULIB_FTELL@ GL_GNULIB_FTELLO = @GL_GNULIB_FTELLO@ GL_GNULIB_FTRUNCATE = @GL_GNULIB_FTRUNCATE@ GL_GNULIB_FUTIMENS = @GL_GNULIB_FUTIMENS@ GL_GNULIB_FWRITE = @GL_GNULIB_FWRITE@ GL_GNULIB_GETC = @GL_GNULIB_GETC@ GL_GNULIB_GETCHAR = @GL_GNULIB_GETCHAR@ GL_GNULIB_GETCWD = @GL_GNULIB_GETCWD@ GL_GNULIB_GETDELIM = @GL_GNULIB_GETDELIM@ GL_GNULIB_GETDOMAINNAME = @GL_GNULIB_GETDOMAINNAME@ GL_GNULIB_GETDTABLESIZE = @GL_GNULIB_GETDTABLESIZE@ GL_GNULIB_GETENTROPY = @GL_GNULIB_GETENTROPY@ GL_GNULIB_GETGROUPS = @GL_GNULIB_GETGROUPS@ GL_GNULIB_GETHOSTNAME = @GL_GNULIB_GETHOSTNAME@ GL_GNULIB_GETLINE = @GL_GNULIB_GETLINE@ GL_GNULIB_GETLOADAVG = @GL_GNULIB_GETLOADAVG@ GL_GNULIB_GETLOGIN = @GL_GNULIB_GETLOGIN@ GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@ GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@ GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@ GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@ GL_GNULIB_GETPEERNAME = @GL_GNULIB_GETPEERNAME@ GL_GNULIB_GETSOCKNAME = @GL_GNULIB_GETSOCKNAME@ GL_GNULIB_GETSOCKOPT = @GL_GNULIB_GETSOCKOPT@ GL_GNULIB_GETSUBOPT = @GL_GNULIB_GETSUBOPT@ GL_GNULIB_GETTIMEOFDAY = @GL_GNULIB_GETTIMEOFDAY@ GL_GNULIB_GETUMASK = @GL_GNULIB_GETUMASK@ GL_GNULIB_GETUSERSHELL = @GL_GNULIB_GETUSERSHELL@ GL_GNULIB_GRANTPT = @GL_GNULIB_GRANTPT@ GL_GNULIB_GROUP_MEMBER = @GL_GNULIB_GROUP_MEMBER@ GL_GNULIB_ICONV = @GL_GNULIB_ICONV@ GL_GNULIB_IMAXABS = @GL_GNULIB_IMAXABS@ GL_GNULIB_IMAXDIV = @GL_GNULIB_IMAXDIV@ GL_GNULIB_INET_NTOP = @GL_GNULIB_INET_NTOP@ GL_GNULIB_INET_PTON = @GL_GNULIB_INET_PTON@ GL_GNULIB_IOCTL = @GL_GNULIB_IOCTL@ GL_GNULIB_ISATTY = @GL_GNULIB_ISATTY@ GL_GNULIB_ISBLANK = @GL_GNULIB_ISBLANK@ GL_GNULIB_ISWBLANK = @GL_GNULIB_ISWBLANK@ GL_GNULIB_ISWCTYPE = @GL_GNULIB_ISWCTYPE@ GL_GNULIB_ISWDIGIT = @GL_GNULIB_ISWDIGIT@ GL_GNULIB_ISWXDIGIT = @GL_GNULIB_ISWXDIGIT@ GL_GNULIB_LCHMOD = @GL_GNULIB_LCHMOD@ GL_GNULIB_LCHOWN = @GL_GNULIB_LCHOWN@ GL_GNULIB_LINK = @GL_GNULIB_LINK@ GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@ GL_GNULIB_LISTEN = @GL_GNULIB_LISTEN@ GL_GNULIB_LOCALECONV = @GL_GNULIB_LOCALECONV@ GL_GNULIB_LOCALENAME = @GL_GNULIB_LOCALENAME@ GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@ GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@ GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@ GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@ GL_GNULIB_MBRLEN = @GL_GNULIB_MBRLEN@ GL_GNULIB_MBRTOWC = @GL_GNULIB_MBRTOWC@ GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@ GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@ GL_GNULIB_MBSCHR = @GL_GNULIB_MBSCHR@ GL_GNULIB_MBSCSPN = @GL_GNULIB_MBSCSPN@ GL_GNULIB_MBSINIT = @GL_GNULIB_MBSINIT@ GL_GNULIB_MBSLEN = @GL_GNULIB_MBSLEN@ GL_GNULIB_MBSNCASECMP = @GL_GNULIB_MBSNCASECMP@ GL_GNULIB_MBSNLEN = @GL_GNULIB_MBSNLEN@ GL_GNULIB_MBSNRTOWCS = @GL_GNULIB_MBSNRTOWCS@ GL_GNULIB_MBSPBRK = @GL_GNULIB_MBSPBRK@ GL_GNULIB_MBSPCASECMP = @GL_GNULIB_MBSPCASECMP@ GL_GNULIB_MBSRCHR = @GL_GNULIB_MBSRCHR@ GL_GNULIB_MBSRTOWCS = @GL_GNULIB_MBSRTOWCS@ GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@ GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@ GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@ GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@ GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@ GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@ GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@ GL_GNULIB_MDA_CHMOD = @GL_GNULIB_MDA_CHMOD@ GL_GNULIB_MDA_CLOSE = @GL_GNULIB_MDA_CLOSE@ GL_GNULIB_MDA_CREAT = @GL_GNULIB_MDA_CREAT@ GL_GNULIB_MDA_DUP = @GL_GNULIB_MDA_DUP@ GL_GNULIB_MDA_DUP2 = @GL_GNULIB_MDA_DUP2@ GL_GNULIB_MDA_ECVT = @GL_GNULIB_MDA_ECVT@ GL_GNULIB_MDA_EXECL = @GL_GNULIB_MDA_EXECL@ GL_GNULIB_MDA_EXECLE = @GL_GNULIB_MDA_EXECLE@ GL_GNULIB_MDA_EXECLP = @GL_GNULIB_MDA_EXECLP@ GL_GNULIB_MDA_EXECV = @GL_GNULIB_MDA_EXECV@ GL_GNULIB_MDA_EXECVE = @GL_GNULIB_MDA_EXECVE@ GL_GNULIB_MDA_EXECVP = @GL_GNULIB_MDA_EXECVP@ GL_GNULIB_MDA_EXECVPE = @GL_GNULIB_MDA_EXECVPE@ GL_GNULIB_MDA_FCLOSEALL = @GL_GNULIB_MDA_FCLOSEALL@ GL_GNULIB_MDA_FCVT = @GL_GNULIB_MDA_FCVT@ GL_GNULIB_MDA_FDOPEN = @GL_GNULIB_MDA_FDOPEN@ GL_GNULIB_MDA_FILENO = @GL_GNULIB_MDA_FILENO@ GL_GNULIB_MDA_GCVT = @GL_GNULIB_MDA_GCVT@ GL_GNULIB_MDA_GETCWD = @GL_GNULIB_MDA_GETCWD@ GL_GNULIB_MDA_GETPID = @GL_GNULIB_MDA_GETPID@ GL_GNULIB_MDA_GETW = @GL_GNULIB_MDA_GETW@ GL_GNULIB_MDA_ISATTY = @GL_GNULIB_MDA_ISATTY@ GL_GNULIB_MDA_LSEEK = @GL_GNULIB_MDA_LSEEK@ GL_GNULIB_MDA_MEMCCPY = @GL_GNULIB_MDA_MEMCCPY@ GL_GNULIB_MDA_MKDIR = @GL_GNULIB_MDA_MKDIR@ GL_GNULIB_MDA_MKTEMP = @GL_GNULIB_MDA_MKTEMP@ GL_GNULIB_MDA_OPEN = @GL_GNULIB_MDA_OPEN@ GL_GNULIB_MDA_PUTENV = @GL_GNULIB_MDA_PUTENV@ GL_GNULIB_MDA_PUTW = @GL_GNULIB_MDA_PUTW@ GL_GNULIB_MDA_READ = @GL_GNULIB_MDA_READ@ GL_GNULIB_MDA_RMDIR = @GL_GNULIB_MDA_RMDIR@ GL_GNULIB_MDA_STRDUP = @GL_GNULIB_MDA_STRDUP@ GL_GNULIB_MDA_SWAB = @GL_GNULIB_MDA_SWAB@ GL_GNULIB_MDA_TEMPNAM = @GL_GNULIB_MDA_TEMPNAM@ GL_GNULIB_MDA_TZSET = @GL_GNULIB_MDA_TZSET@ GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@ GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@ GL_GNULIB_MDA_WCSDUP = @GL_GNULIB_MDA_WCSDUP@ GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@ GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@ GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@ GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@ GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@ GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@ GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@ GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@ GL_GNULIB_MKFIFO = @GL_GNULIB_MKFIFO@ GL_GNULIB_MKFIFOAT = @GL_GNULIB_MKFIFOAT@ GL_GNULIB_MKNOD = @GL_GNULIB_MKNOD@ GL_GNULIB_MKNODAT = @GL_GNULIB_MKNODAT@ GL_GNULIB_MKOSTEMP = @GL_GNULIB_MKOSTEMP@ GL_GNULIB_MKOSTEMPS = @GL_GNULIB_MKOSTEMPS@ GL_GNULIB_MKSTEMP = @GL_GNULIB_MKSTEMP@ GL_GNULIB_MKSTEMPS = @GL_GNULIB_MKSTEMPS@ GL_GNULIB_MKTIME = @GL_GNULIB_MKTIME@ GL_GNULIB_NANOSLEEP = @GL_GNULIB_NANOSLEEP@ GL_GNULIB_NL_LANGINFO = @GL_GNULIB_NL_LANGINFO@ GL_GNULIB_NONBLOCKING = @GL_GNULIB_NONBLOCKING@ GL_GNULIB_OBSTACK_PRINTF = @GL_GNULIB_OBSTACK_PRINTF@ GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@ GL_GNULIB_OPEN = @GL_GNULIB_OPEN@ GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@ GL_GNULIB_OPENDIR = @GL_GNULIB_OPENDIR@ GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@ GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@ GL_GNULIB_PERROR = @GL_GNULIB_PERROR@ GL_GNULIB_PIPE = @GL_GNULIB_PIPE@ GL_GNULIB_PIPE2 = @GL_GNULIB_PIPE2@ GL_GNULIB_POPEN = @GL_GNULIB_POPEN@ GL_GNULIB_POSIX_MEMALIGN = @GL_GNULIB_POSIX_MEMALIGN@ GL_GNULIB_POSIX_OPENPT = @GL_GNULIB_POSIX_OPENPT@ GL_GNULIB_PREAD = @GL_GNULIB_PREAD@ GL_GNULIB_PRINTF = @GL_GNULIB_PRINTF@ GL_GNULIB_PRINTF_POSIX = @GL_GNULIB_PRINTF_POSIX@ GL_GNULIB_PSELECT = @GL_GNULIB_PSELECT@ GL_GNULIB_PTHREAD_COND = @GL_GNULIB_PTHREAD_COND@ GL_GNULIB_PTHREAD_MUTEX = @GL_GNULIB_PTHREAD_MUTEX@ GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK = @GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK@ GL_GNULIB_PTHREAD_ONCE = @GL_GNULIB_PTHREAD_ONCE@ GL_GNULIB_PTHREAD_RWLOCK = @GL_GNULIB_PTHREAD_RWLOCK@ GL_GNULIB_PTHREAD_SIGMASK = @GL_GNULIB_PTHREAD_SIGMASK@ GL_GNULIB_PTHREAD_SPIN = @GL_GNULIB_PTHREAD_SPIN@ GL_GNULIB_PTHREAD_THREAD = @GL_GNULIB_PTHREAD_THREAD@ GL_GNULIB_PTHREAD_TSS = @GL_GNULIB_PTHREAD_TSS@ GL_GNULIB_PTSNAME = @GL_GNULIB_PTSNAME@ GL_GNULIB_PTSNAME_R = @GL_GNULIB_PTSNAME_R@ GL_GNULIB_PUTC = @GL_GNULIB_PUTC@ GL_GNULIB_PUTCHAR = @GL_GNULIB_PUTCHAR@ GL_GNULIB_PUTENV = @GL_GNULIB_PUTENV@ GL_GNULIB_PUTS = @GL_GNULIB_PUTS@ GL_GNULIB_PWRITE = @GL_GNULIB_PWRITE@ GL_GNULIB_QSORT_R = @GL_GNULIB_QSORT_R@ GL_GNULIB_RAISE = @GL_GNULIB_RAISE@ GL_GNULIB_RANDOM = @GL_GNULIB_RANDOM@ GL_GNULIB_RANDOM_R = @GL_GNULIB_RANDOM_R@ GL_GNULIB_RAWMEMCHR = @GL_GNULIB_RAWMEMCHR@ GL_GNULIB_READ = @GL_GNULIB_READ@ GL_GNULIB_READDIR = @GL_GNULIB_READDIR@ GL_GNULIB_READLINK = @GL_GNULIB_READLINK@ GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@ GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@ GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@ GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@ GL_GNULIB_RECV = @GL_GNULIB_RECV@ GL_GNULIB_RECVFROM = @GL_GNULIB_RECVFROM@ GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@ GL_GNULIB_RENAME = @GL_GNULIB_RENAME@ GL_GNULIB_RENAMEAT = @GL_GNULIB_RENAMEAT@ GL_GNULIB_REWINDDIR = @GL_GNULIB_REWINDDIR@ GL_GNULIB_RMDIR = @GL_GNULIB_RMDIR@ GL_GNULIB_RPMATCH = @GL_GNULIB_RPMATCH@ GL_GNULIB_SCANDIR = @GL_GNULIB_SCANDIR@ GL_GNULIB_SCANF = @GL_GNULIB_SCANF@ GL_GNULIB_SCHED_YIELD = @GL_GNULIB_SCHED_YIELD@ GL_GNULIB_SECURE_GETENV = @GL_GNULIB_SECURE_GETENV@ GL_GNULIB_SELECT = @GL_GNULIB_SELECT@ GL_GNULIB_SEND = @GL_GNULIB_SEND@ GL_GNULIB_SENDTO = @GL_GNULIB_SENDTO@ GL_GNULIB_SETENV = @GL_GNULIB_SETENV@ GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@ GL_GNULIB_SETLOCALE = @GL_GNULIB_SETLOCALE@ GL_GNULIB_SETLOCALE_NULL = @GL_GNULIB_SETLOCALE_NULL@ GL_GNULIB_SETSOCKOPT = @GL_GNULIB_SETSOCKOPT@ GL_GNULIB_SHUTDOWN = @GL_GNULIB_SHUTDOWN@ GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@ GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@ GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@ GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@ GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@ GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@ GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@ GL_GNULIB_SOCKET = @GL_GNULIB_SOCKET@ GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@ GL_GNULIB_STAT = @GL_GNULIB_STAT@ GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@ GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@ GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@ GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@ GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@ GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@ GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@ GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@ GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@ GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@ GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@ GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@ GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@ GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@ GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@ GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@ GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@ GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@ GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@ GL_GNULIB_STRTOLD = @GL_GNULIB_STRTOLD@ GL_GNULIB_STRTOLL = @GL_GNULIB_STRTOLL@ GL_GNULIB_STRTOUL = @GL_GNULIB_STRTOUL@ GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@ GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@ GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@ GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@ GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@ GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@ GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@ GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@ GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@ GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@ GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@ GL_GNULIB_TOWCTRANS = @GL_GNULIB_TOWCTRANS@ GL_GNULIB_TRUNCATE = @GL_GNULIB_TRUNCATE@ GL_GNULIB_TTYNAME_R = @GL_GNULIB_TTYNAME_R@ GL_GNULIB_TZSET = @GL_GNULIB_TZSET@ GL_GNULIB_UNISTD_H_GETOPT = @GL_GNULIB_UNISTD_H_GETOPT@ GL_GNULIB_UNISTD_H_NONBLOCKING = @GL_GNULIB_UNISTD_H_NONBLOCKING@ GL_GNULIB_UNISTD_H_SIGPIPE = @GL_GNULIB_UNISTD_H_SIGPIPE@ GL_GNULIB_UNLINK = @GL_GNULIB_UNLINK@ GL_GNULIB_UNLINKAT = @GL_GNULIB_UNLINKAT@ GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@ GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@ GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@ GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@ GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@ GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@ GL_GNULIB_VFPRINTF = @GL_GNULIB_VFPRINTF@ GL_GNULIB_VFPRINTF_POSIX = @GL_GNULIB_VFPRINTF_POSIX@ GL_GNULIB_VFSCANF = @GL_GNULIB_VFSCANF@ GL_GNULIB_VPRINTF = @GL_GNULIB_VPRINTF@ GL_GNULIB_VPRINTF_POSIX = @GL_GNULIB_VPRINTF_POSIX@ GL_GNULIB_VSCANF = @GL_GNULIB_VSCANF@ GL_GNULIB_VSNPRINTF = @GL_GNULIB_VSNPRINTF@ GL_GNULIB_VSPRINTF_POSIX = @GL_GNULIB_VSPRINTF_POSIX@ GL_GNULIB_WCPCPY = @GL_GNULIB_WCPCPY@ GL_GNULIB_WCPNCPY = @GL_GNULIB_WCPNCPY@ GL_GNULIB_WCRTOMB = @GL_GNULIB_WCRTOMB@ GL_GNULIB_WCSCASECMP = @GL_GNULIB_WCSCASECMP@ GL_GNULIB_WCSCAT = @GL_GNULIB_WCSCAT@ GL_GNULIB_WCSCHR = @GL_GNULIB_WCSCHR@ GL_GNULIB_WCSCMP = @GL_GNULIB_WCSCMP@ GL_GNULIB_WCSCOLL = @GL_GNULIB_WCSCOLL@ GL_GNULIB_WCSCPY = @GL_GNULIB_WCSCPY@ GL_GNULIB_WCSCSPN = @GL_GNULIB_WCSCSPN@ GL_GNULIB_WCSDUP = @GL_GNULIB_WCSDUP@ GL_GNULIB_WCSFTIME = @GL_GNULIB_WCSFTIME@ GL_GNULIB_WCSLEN = @GL_GNULIB_WCSLEN@ GL_GNULIB_WCSNCASECMP = @GL_GNULIB_WCSNCASECMP@ GL_GNULIB_WCSNCAT = @GL_GNULIB_WCSNCAT@ GL_GNULIB_WCSNCMP = @GL_GNULIB_WCSNCMP@ GL_GNULIB_WCSNCPY = @GL_GNULIB_WCSNCPY@ GL_GNULIB_WCSNLEN = @GL_GNULIB_WCSNLEN@ GL_GNULIB_WCSNRTOMBS = @GL_GNULIB_WCSNRTOMBS@ GL_GNULIB_WCSPBRK = @GL_GNULIB_WCSPBRK@ GL_GNULIB_WCSRCHR = @GL_GNULIB_WCSRCHR@ GL_GNULIB_WCSRTOMBS = @GL_GNULIB_WCSRTOMBS@ GL_GNULIB_WCSSPN = @GL_GNULIB_WCSSPN@ GL_GNULIB_WCSSTR = @GL_GNULIB_WCSSTR@ GL_GNULIB_WCSTOK = @GL_GNULIB_WCSTOK@ GL_GNULIB_WCSWIDTH = @GL_GNULIB_WCSWIDTH@ GL_GNULIB_WCSXFRM = @GL_GNULIB_WCSXFRM@ GL_GNULIB_WCTOB = @GL_GNULIB_WCTOB@ GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@ GL_GNULIB_WCTRANS = @GL_GNULIB_WCTRANS@ GL_GNULIB_WCTYPE = @GL_GNULIB_WCTYPE@ GL_GNULIB_WCWIDTH = @GL_GNULIB_WCWIDTH@ GL_GNULIB_WMEMCHR = @GL_GNULIB_WMEMCHR@ GL_GNULIB_WMEMCMP = @GL_GNULIB_WMEMCMP@ GL_GNULIB_WMEMCPY = @GL_GNULIB_WMEMCPY@ GL_GNULIB_WMEMMOVE = @GL_GNULIB_WMEMMOVE@ GL_GNULIB_WMEMPCPY = @GL_GNULIB_WMEMPCPY@ GL_GNULIB_WMEMSET = @GL_GNULIB_WMEMSET@ GL_GNULIB_WRITE = @GL_GNULIB_WRITE@ GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_TEST_WARN_CFLAGS = @GNULIB_TEST_WARN_CFLAGS@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ GREP = @GREP@ HAVE_ACCEPT4 = @HAVE_ACCEPT4@ HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@ HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@ HAVE_DECL_DIRFD = @HAVE_DECL_DIRFD@ HAVE_DECL_ECVT = @HAVE_DECL_ECVT@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXECVPE = @HAVE_DECL_EXECVPE@ HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ HAVE_DECL_FCLOSEALL = @HAVE_DECL_FCLOSEALL@ HAVE_DECL_FCVT = @HAVE_DECL_FCVT@ HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@ HAVE_DECL_FDOPENDIR = @HAVE_DECL_FDOPENDIR@ HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@ HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@ HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@ HAVE_DECL_GCVT = @HAVE_DECL_GCVT@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@ HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@ HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCSDUP = @HAVE_DECL_WCSDUP@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DIRENT_H = @HAVE_DIRENT_H@ HAVE_DPRINTF = @HAVE_DPRINTF@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_EXECVPE = @HAVE_EXECVPE@ HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHMODAT = @HAVE_FCHMODAT@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FCNTL = @HAVE_FCNTL@ HAVE_FDATASYNC = @HAVE_FDATASYNC@ HAVE_FDOPENDIR = @HAVE_FDOPENDIR@ HAVE_FEATURES_H = @HAVE_FEATURES_H@ HAVE_FFSL = @HAVE_FFSL@ HAVE_FFSLL = @HAVE_FFSLL@ HAVE_FNMATCH = @HAVE_FNMATCH@ HAVE_FNMATCH_H = @HAVE_FNMATCH_H@ HAVE_FREELOCALE = @HAVE_FREELOCALE@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FSTATAT = @HAVE_FSTATAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_FUTIMENS = @HAVE_FUTIMENS@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETENTROPY = @HAVE_GETENTROPY@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETPASS = @HAVE_GETPASS@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ HAVE_GETUMASK = @HAVE_GETUMASK@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISBLANK = @HAVE_ISBLANK@ HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LANGINFO_ALTMON = @HAVE_LANGINFO_ALTMON@ HAVE_LANGINFO_CODESET = @HAVE_LANGINFO_CODESET@ HAVE_LANGINFO_ERA = @HAVE_LANGINFO_ERA@ HAVE_LANGINFO_H = @HAVE_LANGINFO_H@ HAVE_LANGINFO_T_FMT_AMPM = @HAVE_LANGINFO_T_FMT_AMPM@ HAVE_LANGINFO_YESEXPR = @HAVE_LANGINFO_YESEXPR@ HAVE_LCHMOD = @HAVE_LCHMOD@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDIRAT = @HAVE_MKDIRAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ HAVE_MKFIFO = @HAVE_MKFIFO@ HAVE_MKFIFOAT = @HAVE_MKFIFOAT@ HAVE_MKNOD = @HAVE_MKNOD@ HAVE_MKNODAT = @HAVE_MKNODAT@ HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ HAVE_MKSTEMP = @HAVE_MKSTEMP@ HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@ HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@ HAVE_NEWLOCALE = @HAVE_NEWLOCALE@ HAVE_NL_LANGINFO = @HAVE_NL_LANGINFO@ HAVE_OPENAT = @HAVE_OPENAT@ HAVE_OPENDIR = @HAVE_OPENDIR@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PCLOSE = @HAVE_PCLOSE@ HAVE_PIPE = @HAVE_PIPE@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_POPEN = @HAVE_POPEN@ HAVE_POSIX_MEMALIGN = @HAVE_POSIX_MEMALIGN@ HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PSELECT = @HAVE_PSELECT@ HAVE_PTHREAD_ATTR_DESTROY = @HAVE_PTHREAD_ATTR_DESTROY@ HAVE_PTHREAD_ATTR_GETDETACHSTATE = @HAVE_PTHREAD_ATTR_GETDETACHSTATE@ HAVE_PTHREAD_ATTR_INIT = @HAVE_PTHREAD_ATTR_INIT@ HAVE_PTHREAD_ATTR_SETDETACHSTATE = @HAVE_PTHREAD_ATTR_SETDETACHSTATE@ HAVE_PTHREAD_CONDATTR_DESTROY = @HAVE_PTHREAD_CONDATTR_DESTROY@ HAVE_PTHREAD_CONDATTR_INIT = @HAVE_PTHREAD_CONDATTR_INIT@ HAVE_PTHREAD_COND_BROADCAST = @HAVE_PTHREAD_COND_BROADCAST@ HAVE_PTHREAD_COND_DESTROY = @HAVE_PTHREAD_COND_DESTROY@ HAVE_PTHREAD_COND_INIT = @HAVE_PTHREAD_COND_INIT@ HAVE_PTHREAD_COND_SIGNAL = @HAVE_PTHREAD_COND_SIGNAL@ HAVE_PTHREAD_COND_TIMEDWAIT = @HAVE_PTHREAD_COND_TIMEDWAIT@ HAVE_PTHREAD_COND_WAIT = @HAVE_PTHREAD_COND_WAIT@ HAVE_PTHREAD_CREATE = @HAVE_PTHREAD_CREATE@ HAVE_PTHREAD_CREATE_DETACHED = @HAVE_PTHREAD_CREATE_DETACHED@ HAVE_PTHREAD_DETACH = @HAVE_PTHREAD_DETACH@ HAVE_PTHREAD_EQUAL = @HAVE_PTHREAD_EQUAL@ HAVE_PTHREAD_EXIT = @HAVE_PTHREAD_EXIT@ HAVE_PTHREAD_GETSPECIFIC = @HAVE_PTHREAD_GETSPECIFIC@ HAVE_PTHREAD_H = @HAVE_PTHREAD_H@ HAVE_PTHREAD_JOIN = @HAVE_PTHREAD_JOIN@ HAVE_PTHREAD_KEY_CREATE = @HAVE_PTHREAD_KEY_CREATE@ HAVE_PTHREAD_KEY_DELETE = @HAVE_PTHREAD_KEY_DELETE@ HAVE_PTHREAD_MUTEXATTR_DESTROY = @HAVE_PTHREAD_MUTEXATTR_DESTROY@ HAVE_PTHREAD_MUTEXATTR_GETROBUST = @HAVE_PTHREAD_MUTEXATTR_GETROBUST@ HAVE_PTHREAD_MUTEXATTR_GETTYPE = @HAVE_PTHREAD_MUTEXATTR_GETTYPE@ HAVE_PTHREAD_MUTEXATTR_INIT = @HAVE_PTHREAD_MUTEXATTR_INIT@ HAVE_PTHREAD_MUTEXATTR_SETROBUST = @HAVE_PTHREAD_MUTEXATTR_SETROBUST@ HAVE_PTHREAD_MUTEXATTR_SETTYPE = @HAVE_PTHREAD_MUTEXATTR_SETTYPE@ HAVE_PTHREAD_MUTEX_DESTROY = @HAVE_PTHREAD_MUTEX_DESTROY@ HAVE_PTHREAD_MUTEX_INIT = @HAVE_PTHREAD_MUTEX_INIT@ HAVE_PTHREAD_MUTEX_LOCK = @HAVE_PTHREAD_MUTEX_LOCK@ HAVE_PTHREAD_MUTEX_RECURSIVE = @HAVE_PTHREAD_MUTEX_RECURSIVE@ HAVE_PTHREAD_MUTEX_ROBUST = @HAVE_PTHREAD_MUTEX_ROBUST@ HAVE_PTHREAD_MUTEX_TIMEDLOCK = @HAVE_PTHREAD_MUTEX_TIMEDLOCK@ HAVE_PTHREAD_MUTEX_TRYLOCK = @HAVE_PTHREAD_MUTEX_TRYLOCK@ HAVE_PTHREAD_MUTEX_UNLOCK = @HAVE_PTHREAD_MUTEX_UNLOCK@ HAVE_PTHREAD_ONCE = @HAVE_PTHREAD_ONCE@ HAVE_PTHREAD_PROCESS_SHARED = @HAVE_PTHREAD_PROCESS_SHARED@ HAVE_PTHREAD_RWLOCKATTR_DESTROY = @HAVE_PTHREAD_RWLOCKATTR_DESTROY@ HAVE_PTHREAD_RWLOCKATTR_INIT = @HAVE_PTHREAD_RWLOCKATTR_INIT@ HAVE_PTHREAD_RWLOCK_DESTROY = @HAVE_PTHREAD_RWLOCK_DESTROY@ HAVE_PTHREAD_RWLOCK_INIT = @HAVE_PTHREAD_RWLOCK_INIT@ HAVE_PTHREAD_RWLOCK_RDLOCK = @HAVE_PTHREAD_RWLOCK_RDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@ HAVE_PTHREAD_RWLOCK_TRYRDLOCK = @HAVE_PTHREAD_RWLOCK_TRYRDLOCK@ HAVE_PTHREAD_RWLOCK_TRYWRLOCK = @HAVE_PTHREAD_RWLOCK_TRYWRLOCK@ HAVE_PTHREAD_RWLOCK_UNLOCK = @HAVE_PTHREAD_RWLOCK_UNLOCK@ HAVE_PTHREAD_RWLOCK_WRLOCK = @HAVE_PTHREAD_RWLOCK_WRLOCK@ HAVE_PTHREAD_SELF = @HAVE_PTHREAD_SELF@ HAVE_PTHREAD_SETSPECIFIC = @HAVE_PTHREAD_SETSPECIFIC@ HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@ HAVE_PTHREAD_SPINLOCK_T = @HAVE_PTHREAD_SPINLOCK_T@ HAVE_PTHREAD_SPIN_DESTROY = @HAVE_PTHREAD_SPIN_DESTROY@ HAVE_PTHREAD_SPIN_INIT = @HAVE_PTHREAD_SPIN_INIT@ HAVE_PTHREAD_SPIN_LOCK = @HAVE_PTHREAD_SPIN_LOCK@ HAVE_PTHREAD_SPIN_TRYLOCK = @HAVE_PTHREAD_SPIN_TRYLOCK@ HAVE_PTHREAD_SPIN_UNLOCK = @HAVE_PTHREAD_SPIN_UNLOCK@ HAVE_PTHREAD_T = @HAVE_PTHREAD_T@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RAISE = @HAVE_RAISE@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READDIR = @HAVE_READDIR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RENAMEAT = @HAVE_RENAMEAT@ HAVE_REWINDDIR = @HAVE_REWINDDIR@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SA_FAMILY_T = @HAVE_SA_FAMILY_T@ HAVE_SCANDIR = @HAVE_SCANDIR@ HAVE_SCHED_H = @HAVE_SCHED_H@ HAVE_SCHED_YIELD = @HAVE_SCHED_YIELD@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ HAVE_SETSTATE = @HAVE_SETSTATE@ HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@ HAVE_SIGACTION = @HAVE_SIGACTION@ HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@ HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRTOL = @HAVE_STRTOL@ HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOUL = @HAVE_STRTOUL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRUCT_SCHED_PARAM = @HAVE_STRUCT_SCHED_PARAM@ HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@ HAVE_STRUCT_SOCKADDR_STORAGE = @HAVE_STRUCT_SOCKADDR_STORAGE@ HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = @HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_IOCTL_H = @HAVE_SYS_IOCTL_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@ HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_SYS_UIO_H = @HAVE_SYS_UIO_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@ HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_VDPRINTF = @HAVE_VDPRINTF@ HAVE_VISIBILITY = @HAVE_VISIBILITY@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCPCPY = @HAVE_WCPCPY@ HAVE_WCPNCPY = @HAVE_WCPNCPY@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ HAVE_WCSCASECMP = @HAVE_WCSCASECMP@ HAVE_WCSCAT = @HAVE_WCSCAT@ HAVE_WCSCHR = @HAVE_WCSCHR@ HAVE_WCSCMP = @HAVE_WCSCMP@ HAVE_WCSCOLL = @HAVE_WCSCOLL@ HAVE_WCSCPY = @HAVE_WCSCPY@ HAVE_WCSCSPN = @HAVE_WCSCSPN@ HAVE_WCSDUP = @HAVE_WCSDUP@ HAVE_WCSFTIME = @HAVE_WCSFTIME@ HAVE_WCSLEN = @HAVE_WCSLEN@ HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@ HAVE_WCSNCAT = @HAVE_WCSNCAT@ HAVE_WCSNCMP = @HAVE_WCSNCMP@ HAVE_WCSNCPY = @HAVE_WCSNCPY@ HAVE_WCSNLEN = @HAVE_WCSNLEN@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSPBRK = @HAVE_WCSPBRK@ HAVE_WCSRCHR = @HAVE_WCSRCHR@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCSSPN = @HAVE_WCSSPN@ HAVE_WCSSTR = @HAVE_WCSSTR@ HAVE_WCSTOK = @HAVE_WCSTOK@ HAVE_WCSWIDTH = @HAVE_WCSWIDTH@ HAVE_WCSXFRM = @HAVE_WCSXFRM@ HAVE_WCTRANS_T = @HAVE_WCTRANS_T@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WCTYPE_T = @HAVE_WCTYPE_T@ HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE_WMEMCHR = @HAVE_WMEMCHR@ HAVE_WMEMCMP = @HAVE_WMEMCMP@ HAVE_WMEMCPY = @HAVE_WMEMCPY@ HAVE_WMEMMOVE = @HAVE_WMEMMOVE@ HAVE_WMEMPCPY = @HAVE_WMEMPCPY@ HAVE_WMEMSET = @HAVE_WMEMSET@ HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@ HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HAVE__EXIT = @HAVE__EXIT@ HOST_CPU = @HOST_CPU@ HOST_CPU_C_ABI = @HOST_CPU_C_ABI@ ICONV_CONST = @ICONV_CONST@ ICONV_H = @ICONV_H@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INET_PTON_LIB = @INET_PTON_LIB@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBCSTACK = @LIBCSTACK@ LIBGREPUTILS_LIBDEPS = @LIBGREPUTILS_LIBDEPS@ LIBGREPUTILS_LTLIBDEPS = @LIBGREPUTILS_LTLIBDEPS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ LIBPMULTITHREAD = @LIBPMULTITHREAD@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBSIGSEGV = @LIBSIGSEGV@ LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@ LIBSOCKET = @LIBSOCKET@ LIBSTDTHREAD = @LIBSTDTHREAD@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ LIBTHREAD = @LIBTHREAD@ LIBUNISTRING_UNISTR_H = @LIBUNISTRING_UNISTR_H@ LIBUNISTRING_UNITYPES_H = @LIBUNISTRING_UNITYPES_H@ LIBUNISTRING_UNIWIDTH_H = @LIBUNISTRING_UNIWIDTH_H@ LIB_HARD_LOCALE = @LIB_HARD_LOCALE@ LIB_MBRTOWC = @LIB_MBRTOWC@ LIB_NANOSLEEP = @LIB_NANOSLEEP@ LIB_NL_LANGINFO = @LIB_NL_LANGINFO@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ LIB_SCHED_YIELD = @LIB_SCHED_YIELD@ LIB_SELECT = @LIB_SELECT@ LIB_SETLOCALE = @LIB_SETLOCALE@ LIB_SETLOCALE_NULL = @LIB_SETLOCALE_NULL@ LIMITS_H = @LIMITS_H@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALENAME_ENHANCE_LOCALE_FUNCS = @LOCALENAME_ENHANCE_LOCALE_FUNCS@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBCSTACK = @LTLIBCSTACK@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ LTLIBSIGSEGV = @LTLIBSIGSEGV@ LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ NETINET_IN_H = @NETINET_IN_H@ NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_CTYPE_H@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H = @NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@ NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@ NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H = @NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H@ NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H = @NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H@ NEXT_AS_FIRST_DIRECTIVE_SCHED_H = @NEXT_AS_FIRST_DIRECTIVE_SCHED_H@ NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@ NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_CTYPE_H = @NEXT_CTYPE_H@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_FNMATCH_H = @NEXT_FNMATCH_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ NEXT_LANGINFO_H = @NEXT_LANGINFO_H@ NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@ NEXT_PTHREAD_H = @NEXT_PTHREAD_H@ NEXT_SCHED_H = @NEXT_SCHED_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_IOCTL_H = @NEXT_SYS_IOCTL_H@ NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@ NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@ NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NEXT_WCHAR_H = @NEXT_WCHAR_H@ NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_LIBS = @PCRE_LIBS@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ PRAGMA_COLUMNS = @PRAGMA_COLUMNS@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ PRIPTR_PREFIX = @PRIPTR_PREFIX@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_ACCESS = @REPLACE_ACCESS@ REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@ REPLACE_BTOWC = @REPLACE_BTOWC@ REPLACE_CALLOC = @REPLACE_CALLOC@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@ REPLACE_CREAT = @REPLACE_CREAT@ REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ REPLACE_EXECL = @REPLACE_EXECL@ REPLACE_EXECLE = @REPLACE_EXECLE@ REPLACE_EXECLP = @REPLACE_EXECLP@ REPLACE_EXECV = @REPLACE_EXECV@ REPLACE_EXECVE = @REPLACE_EXECVE@ REPLACE_EXECVP = @REPLACE_EXECVP@ REPLACE_EXECVPE = @REPLACE_EXECVPE@ REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHMODAT = @REPLACE_FCHMODAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ REPLACE_FDOPEN = @REPLACE_FDOPEN@ REPLACE_FDOPENDIR = @REPLACE_FDOPENDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ REPLACE_FFSLL = @REPLACE_FFSLL@ REPLACE_FNMATCH = @REPLACE_FNMATCH@ REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ REPLACE_FPURGE = @REPLACE_FPURGE@ REPLACE_FREE = @REPLACE_FREE@ REPLACE_FREELOCALE = @REPLACE_FREELOCALE@ REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FSEEK = @REPLACE_FSEEK@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FSTAT = @REPLACE_FSTAT@ REPLACE_FSTATAT = @REPLACE_FSTATAT@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@ REPLACE_FUTIMENS = @REPLACE_FUTIMENS@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETDELIM = @REPLACE_GETDELIM@ REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ REPLACE_GETDTABLESIZE = @REPLACE_GETDTABLESIZE@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETLINE = @REPLACE_GETLINE@ REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETPASS = @REPLACE_GETPASS@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ REPLACE_GMTIME = @REPLACE_GMTIME@ REPLACE_ICONV = @REPLACE_ICONV@ REPLACE_ICONV_OPEN = @REPLACE_ICONV_OPEN@ REPLACE_ICONV_UTF = @REPLACE_ICONV_UTF@ REPLACE_INET_NTOP = @REPLACE_INET_NTOP@ REPLACE_INET_PTON = @REPLACE_INET_PTON@ REPLACE_INITSTATE = @REPLACE_INITSTATE@ REPLACE_IOCTL = @REPLACE_IOCTL@ REPLACE_ISATTY = @REPLACE_ISATTY@ REPLACE_ISWBLANK = @REPLACE_ISWBLANK@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_ISWDIGIT = @REPLACE_ISWDIGIT@ REPLACE_ISWXDIGIT = @REPLACE_ISWXDIGIT@ REPLACE_ITOLD = @REPLACE_ITOLD@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LOCALECONV = @REPLACE_LOCALECONV@ REPLACE_LOCALTIME = @REPLACE_LOCALTIME@ REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_LSTAT = @REPLACE_LSTAT@ REPLACE_MALLOC = @REPLACE_MALLOC@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ REPLACE_MBSINIT = @REPLACE_MBSINIT@ REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@ REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@ REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@ REPLACE_MBTOWC = @REPLACE_MBTOWC@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKDIR = @REPLACE_MKDIR@ REPLACE_MKFIFO = @REPLACE_MKFIFO@ REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@ REPLACE_MKNOD = @REPLACE_MKNOD@ REPLACE_MKNODAT = @REPLACE_MKNODAT@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_MKTIME = @REPLACE_MKTIME@ REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ REPLACE_NEWLOCALE = @REPLACE_NEWLOCALE@ REPLACE_NL_LANGINFO = @REPLACE_NL_LANGINFO@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ REPLACE_OPEN = @REPLACE_OPEN@ REPLACE_OPENAT = @REPLACE_OPENAT@ REPLACE_OPENDIR = @REPLACE_OPENDIR@ REPLACE_PERROR = @REPLACE_PERROR@ REPLACE_POPEN = @REPLACE_POPEN@ REPLACE_POSIX_MEMALIGN = @REPLACE_POSIX_MEMALIGN@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PRINTF = @REPLACE_PRINTF@ REPLACE_PSELECT = @REPLACE_PSELECT@ REPLACE_PTHREAD_ATTR_DESTROY = @REPLACE_PTHREAD_ATTR_DESTROY@ REPLACE_PTHREAD_ATTR_GETDETACHSTATE = @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@ REPLACE_PTHREAD_ATTR_INIT = @REPLACE_PTHREAD_ATTR_INIT@ REPLACE_PTHREAD_ATTR_SETDETACHSTATE = @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@ REPLACE_PTHREAD_CONDATTR_DESTROY = @REPLACE_PTHREAD_CONDATTR_DESTROY@ REPLACE_PTHREAD_CONDATTR_INIT = @REPLACE_PTHREAD_CONDATTR_INIT@ REPLACE_PTHREAD_COND_BROADCAST = @REPLACE_PTHREAD_COND_BROADCAST@ REPLACE_PTHREAD_COND_DESTROY = @REPLACE_PTHREAD_COND_DESTROY@ REPLACE_PTHREAD_COND_INIT = @REPLACE_PTHREAD_COND_INIT@ REPLACE_PTHREAD_COND_SIGNAL = @REPLACE_PTHREAD_COND_SIGNAL@ REPLACE_PTHREAD_COND_TIMEDWAIT = @REPLACE_PTHREAD_COND_TIMEDWAIT@ REPLACE_PTHREAD_COND_WAIT = @REPLACE_PTHREAD_COND_WAIT@ REPLACE_PTHREAD_CREATE = @REPLACE_PTHREAD_CREATE@ REPLACE_PTHREAD_DETACH = @REPLACE_PTHREAD_DETACH@ REPLACE_PTHREAD_EQUAL = @REPLACE_PTHREAD_EQUAL@ REPLACE_PTHREAD_EXIT = @REPLACE_PTHREAD_EXIT@ REPLACE_PTHREAD_GETSPECIFIC = @REPLACE_PTHREAD_GETSPECIFIC@ REPLACE_PTHREAD_JOIN = @REPLACE_PTHREAD_JOIN@ REPLACE_PTHREAD_KEY_CREATE = @REPLACE_PTHREAD_KEY_CREATE@ REPLACE_PTHREAD_KEY_DELETE = @REPLACE_PTHREAD_KEY_DELETE@ REPLACE_PTHREAD_MUTEXATTR_DESTROY = @REPLACE_PTHREAD_MUTEXATTR_DESTROY@ REPLACE_PTHREAD_MUTEXATTR_GETROBUST = @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@ REPLACE_PTHREAD_MUTEXATTR_GETTYPE = @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@ REPLACE_PTHREAD_MUTEXATTR_INIT = @REPLACE_PTHREAD_MUTEXATTR_INIT@ REPLACE_PTHREAD_MUTEXATTR_SETROBUST = @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@ REPLACE_PTHREAD_MUTEXATTR_SETTYPE = @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@ REPLACE_PTHREAD_MUTEX_DESTROY = @REPLACE_PTHREAD_MUTEX_DESTROY@ REPLACE_PTHREAD_MUTEX_INIT = @REPLACE_PTHREAD_MUTEX_INIT@ REPLACE_PTHREAD_MUTEX_LOCK = @REPLACE_PTHREAD_MUTEX_LOCK@ REPLACE_PTHREAD_MUTEX_TIMEDLOCK = @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@ REPLACE_PTHREAD_MUTEX_TRYLOCK = @REPLACE_PTHREAD_MUTEX_TRYLOCK@ REPLACE_PTHREAD_MUTEX_UNLOCK = @REPLACE_PTHREAD_MUTEX_UNLOCK@ REPLACE_PTHREAD_ONCE = @REPLACE_PTHREAD_ONCE@ REPLACE_PTHREAD_RWLOCKATTR_DESTROY = @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@ REPLACE_PTHREAD_RWLOCKATTR_INIT = @REPLACE_PTHREAD_RWLOCKATTR_INIT@ REPLACE_PTHREAD_RWLOCK_DESTROY = @REPLACE_PTHREAD_RWLOCK_DESTROY@ REPLACE_PTHREAD_RWLOCK_INIT = @REPLACE_PTHREAD_RWLOCK_INIT@ REPLACE_PTHREAD_RWLOCK_RDLOCK = @REPLACE_PTHREAD_RWLOCK_RDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@ REPLACE_PTHREAD_RWLOCK_TRYRDLOCK = @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@ REPLACE_PTHREAD_RWLOCK_TRYWRLOCK = @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@ REPLACE_PTHREAD_RWLOCK_UNLOCK = @REPLACE_PTHREAD_RWLOCK_UNLOCK@ REPLACE_PTHREAD_RWLOCK_WRLOCK = @REPLACE_PTHREAD_RWLOCK_WRLOCK@ REPLACE_PTHREAD_SELF = @REPLACE_PTHREAD_SELF@ REPLACE_PTHREAD_SETSPECIFIC = @REPLACE_PTHREAD_SETSPECIFIC@ REPLACE_PTHREAD_SIGMASK = @REPLACE_PTHREAD_SIGMASK@ REPLACE_PTHREAD_SPIN_DESTROY = @REPLACE_PTHREAD_SPIN_DESTROY@ REPLACE_PTHREAD_SPIN_INIT = @REPLACE_PTHREAD_SPIN_INIT@ REPLACE_PTHREAD_SPIN_LOCK = @REPLACE_PTHREAD_SPIN_LOCK@ REPLACE_PTHREAD_SPIN_TRYLOCK = @REPLACE_PTHREAD_SPIN_TRYLOCK@ REPLACE_PTHREAD_SPIN_UNLOCK = @REPLACE_PTHREAD_SPIN_UNLOCK@ REPLACE_PTSNAME = @REPLACE_PTSNAME@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RAISE = @REPLACE_RAISE@ REPLACE_RANDOM = @REPLACE_RANDOM@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SCHED_YIELD = @REPLACE_SCHED_YIELD@ REPLACE_SELECT = @REPLACE_SELECT@ REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SETLOCALE = @REPLACE_SETLOCALE@ REPLACE_SETSTATE = @REPLACE_SETSTATE@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ REPLACE_STAT = @REPLACE_STAT@ REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@ REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRTOL = @REPLACE_STRTOL@ REPLACE_STRTOLD = @REPLACE_STRTOLD@ REPLACE_STRTOLL = @REPLACE_STRTOLL@ REPLACE_STRTOUL = @REPLACE_STRTOUL@ REPLACE_STRTOULL = @REPLACE_STRTOULL@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TOWLOWER = @REPLACE_TOWLOWER@ REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_TZSET = @REPLACE_TZSET@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VDPRINTF = @REPLACE_VDPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ REPLACE_WCSTOK = @REPLACE_WCSTOK@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ REPLACE_WCTOMB = @REPLACE_WCTOMB@ REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIGSEGV_H = @SIGSEGV_H@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STDALIGN_H = @STDALIGN_H@ STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_IOCTL_H_HAVE_WINSOCK2_H = @SYS_IOCTL_H_HAVE_WINSOCK2_H@ SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@ UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WERROR_CFLAGS = @WERROR_CFLAGS@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@ WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_aux_dir = @abs_aux_dir@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ info_TEXINFOS = grep.texi grep_TEXINFOS = fdl.texi man_MANS = grep.1 fgrep.1 egrep.1 EXTRA_DIST = grep.in.1 CLEANFILES = grep.1 egrep.1 fgrep.1 all: all-am .SUFFIXES: .SUFFIXES: .dvi .html .info .pdf .ps .texi $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): .texi.info: $(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \ am__cwd=`pwd` && $(am__cd) $(srcdir) && \ rm -rf $$backupdir && mkdir $$backupdir && \ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ done; \ else :; fi && \ cd "$$am__cwd"; \ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $@ $<; \ then \ rc=0; \ $(am__cd) $(srcdir); \ else \ rc=$$?; \ $(am__cd) $(srcdir) && \ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ fi; \ rm -rf $$backupdir; exit $$rc .texi.dvi: $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \ $< .texi.pdf: $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \ $< .texi.html: $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $(@:.html=.htp) $<; \ then \ rm -rf $@ && mv $(@:.html=.htp) $@; \ else \ rm -rf $(@:.html=.htp); exit 1; \ fi $(srcdir)/grep.info: grep.texi $(srcdir)/version.texi $(grep_TEXINFOS) grep.dvi: grep.texi $(srcdir)/version.texi $(grep_TEXINFOS) grep.pdf: grep.texi $(srcdir)/version.texi $(grep_TEXINFOS) grep.html: grep.texi $(srcdir)/version.texi $(grep_TEXINFOS) $(srcdir)/version.texi: $(srcdir)/stamp-vti $(srcdir)/stamp-vti: grep.texi $(top_srcdir)/configure @(dir=.; test -f ./grep.texi || dir=$(srcdir); \ set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/grep.texi`; \ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ echo "@set VERSION $(VERSION)") > vti.tmp$$$$ && \ (cmp -s vti.tmp$$$$ $(srcdir)/version.texi \ || (echo "Updating $(srcdir)/version.texi" && \ cp vti.tmp$$$$ $(srcdir)/version.texi.tmp$$$$ && \ mv $(srcdir)/version.texi.tmp$$$$ $(srcdir)/version.texi)) && \ rm -f vti.tmp$$$$ $(srcdir)/version.texi.$$$$ @cp $(srcdir)/version.texi $@ mostlyclean-vti: -rm -f vti.tmp* $(srcdir)/version.texi.tmp* maintainer-clean-vti: -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi .dvi.ps: $(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) $(AM_V_texinfo) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ rm -f "$(DESTDIR)$(dvidir)/$$f"; \ done uninstall-html-am: @$(NORMAL_UNINSTALL) @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ done uninstall-info-am: @$(PRE_UNINSTALL) @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ done; \ else :; fi @$(NORMAL_UNINSTALL) @list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done uninstall-pdf-am: @$(NORMAL_UNINSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ done uninstall-ps-am: @$(NORMAL_UNINSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ rm -f "$(DESTDIR)$(psdir)/$$f"; \ done dist-info: $(INFO_DEPS) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for base in $$list; do \ case $$base in \ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ if test -f $$file; then \ relfile=`expr "$$file" : "$$d/\(.*\)"`; \ test -f "$(distdir)/$$relfile" || \ cp -p $$file "$(distdir)/$$relfile"; \ else :; fi; \ done; \ done mostlyclean-aminfo: -rm -rf grep.t2d grep.t2p clean-aminfo: -test -z "grep.dvi grep.pdf grep.ps grep.html" \ || rm -rf grep.dvi grep.pdf grep.ps grep.html maintainer-clean-aminfo: @list='$(INFO_DEPS)'; for i in $$list; do \ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-info check-am: all-am check: check-am all-am: Makefile $(INFO_DEPS) $(MANS) installdirs: for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-aminfo clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: $(DVIS) html: html-am html-am: $(HTMLS) info: info-am info-am: $(INFO_DEPS) install-data-am: install-info-am install-man install-dvi: install-dvi-am install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ done install-exec-am: install-html: install-html-am install-html-am: $(HTMLS) @$(NORMAL_INSTALL) @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ d2=$$d$$p; \ if test -d "$$d2"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ else \ list2="$$list2 $$d2"; \ fi; \ done; \ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ done; } install-info: install-info-am install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ fi; \ for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ if test -f $$ifile; then \ echo "$$ifile"; \ else : ; fi; \ done; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) @if $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ done; \ else : ; fi install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done install-ps: install-ps-am install-ps-am: $(PSS) @$(NORMAL_INSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf: pdf-am pdf-am: $(PDFS) ps: ps-am ps-am: $(PSS) uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ uninstall-man uninstall-pdf-am uninstall-ps-am uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-aminfo clean-generic \ cscopelist-am ctags-am dist-info distclean distclean-generic \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti mostlyclean \ mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am \ uninstall-dvi-am uninstall-html-am uninstall-info-am \ uninstall-man uninstall-man1 uninstall-pdf-am uninstall-ps-am .PRECIOUS: Makefile grep.1: grep.in.1 $(AM_V_GEN)rm -f $@-t $@ $(AM_V_at)sed 's/@''VERSION@/$(VERSION)/' $(srcdir)/grep.in.1 > $@-t $(AM_V_at)chmod a=r $@-t $(AM_V_at)mv -f $@-t $@ egrep.1 fgrep.1: Makefile.am $(AM_V_GEN)rm -f $@-t $@ $(AM_V_at)inst=`echo grep | sed '$(transform)'`.1 \ && echo ".so man1/$$inst" > $@-t $(AM_V_at)chmod a=r $@-t $(AM_V_at)mv -f $@-t $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/doc/version.texi���������������������������������������������������������������0000664�0001750�0001750�00000000134�14670377427�017576� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@set UPDATED 8 August 2021 @set UPDATED-MONTH August 2021 @set EDITION 3.7 @set VERSION 3.7 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/doc/stamp-vti������������������������������������������������������������������0000664�0001750�0001750�00000000134�14670377430�017057� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@set UPDATED 8 August 2021 @set UPDATED-MONTH August 2021 @set EDITION 3.7 @set VERSION 3.7 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/doc/grep.in.1������������������������������������������������������������������0000664�0001750�0001750�00000102010�14670377427�016636� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������.\" GNU grep man page .de dT .ds Dt \\$2 .. .dT Time-stamp: "2019-12-29" .\" Update the above date whenever a change to either this file or .\" grep.c's 'usage' function results in a nontrivial change to the man page. .\" In Emacs, you can update the date by running 'M-x time-stamp' .\" after you make a change that you decide is nontrivial. .\" It is no big deal to forget to update the date. . .TH GREP 1 \*(Dt "GNU grep @VERSION@" "User Commands" . .if !\w|\*(lq| \{\ .\" groff an-old.tmac does not seem to be in use, so define lq and rq. . ie \n(.g \{\ . ds lq \(lq\" . ds rq \(rq\" . \} . el \{\ . ds lq `` . ds rq '' . \} .\} . .if !\w|\*(la| \{\ .\" groff an-ext.tmac does not seem to be in use, so define the parts of .\" it that are used below. For a copy of groff an-ext.tmac, please see: .\" https://git.savannah.gnu.org/cgit/groff.git/plain/tmac/an-ext.tmac .\" --- Start of lines taken from groff an-ext.tmac . .\" Check whether we are using grohtml. .nr mH 0 .if \n(.g \ . if '\*(.T'html' \ . nr mH 1 . . .\" Map mono-width fonts to standard fonts for groff's TTY device. .if n \{\ . do ftr CR R . do ftr CI I . do ftr CB B .\} . .\" groff has glyph entities for angle brackets. .ie \n(.g \{\ . ds la \(la\" . ds ra \(ra\" .\} .el \{\ . ds la <\" . ds ra >\" . \" groff's man macros control hyphenation with this register. . nr HY 1 .\} . .\" Start URL. .de UR . ds m1 \\$1\" . nh . if \\n(mH \{\ . \" Start diversion in a new environment. . do ev URL-div . do di URL-div . \} .. . . .\" End URL. .de UE . ie \\n(mH \{\ . br . di . ev . . \" Has there been one or more input lines for the link text? . ie \\n(dn \{\ . do HTML-NS "<a href=""\\*(m1"">" . \" Yes, strip off final newline of diversion and emit it. . do chop URL-div . do URL-div \c . do HTML-NS </a> . \} . el \ . do HTML-NS "<a href=""\\*(m1"">\\*(m1</a>" \&\\$*\" . \} . el \ \\*(la\\*(m1\\*(ra\\$*\" . . hy \\n(HY .. . . .\" Start email address. .de MT . ds m1 \\$1\" . nh . if \\n(mH \{\ . \" Start diversion in a new environment. . do ev URL-div . do di URL-div . \} .. . . .\" End email address. .de ME . ie \\n(mH \{\ . br . di . ev . . \" Has there been one or more input lines for the link text? . ie \\n(dn \{\ . do HTML-NS "<a href=""mailto:\\*(m1"">" . \" Yes, strip off final newline of diversion and emit it. . do chop URL-div . do URL-div \c . do HTML-NS </a> . \} . el \ . do HTML-NS "<a href=""mailto:\\*(m1"">\\*(m1</a>" \&\\$*\" . \} . el \ \\*(la\\*(m1\\*(ra\\$*\" . . hy \\n(HY .. .\" --- End of lines taken from groff an-ext.tmac .\} . .hy 0 . .SH NAME grep, egrep, fgrep \- print lines that match patterns . .SH SYNOPSIS .B grep .RI [ OPTION .\|.\|.]\& .I PATTERNS .RI [ FILE .\|.\|.] .br .B grep .RI [ OPTION .\|.\|.]\& .B \-e .I PATTERNS \&.\|.\|.\& .RI [ FILE .\|.\|.] .br .B grep .RI [ OPTION .\|.\|.]\& .B \-f .I PATTERN_FILE \&.\|.\|.\& .RI [ FILE .\|.\|.] . .SH DESCRIPTION .B grep searches for .I PATTERNS in each .IR FILE . .I PATTERNS is one or more patterns separated by newline characters, and .B grep prints each line that matches a pattern. Typically .I PATTERNS should be quoted when .B grep is used in a shell command. .PP A .I FILE of .RB "\*(lq" \- "\*(rq" stands for standard input. If no .I FILE is given, recursive searches examine the working directory, and nonrecursive searches read standard input. .PP In addition, the variant programs .B egrep and .B fgrep are the same as .B "grep\ \-E" and .BR "grep\ \-F" , respectively. These variants are deprecated, but are provided for backward compatibility. . .SH OPTIONS .SS "Generic Program Information" .TP .B \-\^\-help Output a usage message and exit. .TP .BR \-V ", " \-\^\-version Output the version number of .B grep and exit. .SS "Pattern Syntax" .TP .BR \-E ", " \-\^\-extended\-regexp Interpret .I PATTERNS as extended regular expressions (EREs, see below). .TP .BR \-F ", " \-\^\-fixed\-strings Interpret .I PATTERNS as fixed strings, not regular expressions. .TP .BR \-G ", " \-\^\-basic\-regexp Interpret .I PATTERNS as basic regular expressions (BREs, see below). This is the default. .TP .BR \-P ", " \-\^\-perl\-regexp Interpret I<PATTERNS> as Perl-compatible regular expressions (PCREs). This option is experimental when combined with the .B \-z .RB ( \-\^\-null\-data ) option, and .B "grep \-P" may warn of unimplemented features. .SS "Matching Control" .TP .BI \-e " PATTERNS" "\fR,\fP \-\^\-regexp=" PATTERNS Use .I PATTERNS as the patterns. If this option is used multiple times or is combined with the .B \-f .RB ( \-\^\-file ) option, search for all patterns given. This option can be used to protect a pattern beginning with \*(lq\-\*(rq. .TP .BI \-f " FILE" "\fR,\fP \-\^\-file=" FILE Obtain patterns from .IR FILE , one per line. If this option is used multiple times or is combined with the .B \-e .RB ( \-\^\-regexp ) option, search for all patterns given. The empty file contains zero patterns, and therefore matches nothing. .TP .BR \-i ", " \-\^\-ignore\-case Ignore case distinctions in patterns and input data, so that characters that differ only in case match each other. .TP .B \-\^\-no\-ignore\-case Do not ignore case distinctions in patterns and input data. This is the default. This option is useful for passing to shell scripts that already use .BR \-i , to cancel its effects because the two options override each other. .TP .BR \-v ", " \-\^\-invert\-match Invert the sense of matching, to select non-matching lines. .TP .BR \-w ", " \-\^\-word\-regexp Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore. This option has no effect if .B \-x is also specified. .TP .BR \-x ", " \-\^\-line\-regexp Select only those matches that exactly match the whole line. For a regular expression pattern, this is like parenthesizing the pattern and then surrounding it with .B ^ and .BR $ . .TP .B \-y Obsolete synonym for .BR \-i . .SS "General Output Control" .TP .BR \-c ", " \-\^\-count Suppress normal output; instead print a count of matching lines for each input file. With the .BR \-v ", " \-\^\-invert\-match option (see below), count non-matching lines. .TP .BR \-\^\-color [ =\fIWHEN\fP "], " \-\^\-colour [ =\fIWHEN\fP ] Surround the matched (non-empty) strings, matching lines, context lines, file names, line numbers, byte offsets, and separators (for fields and groups of context lines) with escape sequences to display them in color on the terminal. The colors are defined by the environment variable .BR GREP_COLORS . The deprecated environment variable .B GREP_COLOR is still supported, but its setting does not have priority. .I WHEN is .BR never ", " always ", or " auto . .TP .BR \-L ", " \-\^\-files\-without\-match Suppress normal output; instead print the name of each input file from which no output would normally have been printed. .TP .BR \-l ", " \-\^\-files\-with\-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed. Scanning each input file stops upon first match. .TP .BI \-m " NUM" "\fR,\fP \-\^\-max\-count=" NUM Stop reading a file after .I NUM matching lines. If the input is standard input from a regular file, and .I NUM matching lines are output, .B grep ensures that the standard input is positioned to just after the last matching line before exiting, regardless of the presence of trailing context lines. This enables a calling process to resume a search. When .B grep stops after .I NUM matching lines, it outputs any trailing context lines. When the .B \-c or .B \-\^\-count option is also used, .B grep does not output a count greater than .IR NUM . When the .B \-v or .B \-\^\-invert\-match option is also used, .B grep stops after outputting .I NUM non-matching lines. .TP .BR \-o ", " \-\^\-only\-matching Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line. .TP .BR \-q ", " \-\^\-quiet ", " \-\^\-silent Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. Also see the .B \-s or .B \-\^\-no\-messages option. .TP .BR \-s ", " \-\^\-no\-messages Suppress error messages about nonexistent or unreadable files. .SS "Output Line Prefix Control" .TP .BR \-b ", " \-\^\-byte\-offset Print the 0-based byte offset within the input file before each line of output. If .B \-o .RB ( \-\^\-only\-matching ) is specified, print the offset of the matching part itself. .TP .BR \-H ", " \-\^\-with\-filename Print the file name for each match. This is the default when there is more than one file to search. This is a GNU extension. .TP .BR \-h ", " \-\^\-no\-filename Suppress the prefixing of file names on output. This is the default when there is only one file (or only standard input) to search. .TP .BI \-\^\-label= LABEL Display input actually coming from standard input as input coming from file .IR LABEL . This can be useful for commands that transform a file's contents before searching, e.g., .BR "gzip \-cd foo.gz | grep \-\^\-label=foo \-H 'some pattern'" . See also the .B \-H option. .TP .BR \-n ", " \-\^\-line\-number Prefix each line of output with the 1-based line number within its input file. .TP .BR \-T ", " \-\^\-initial\-tab Make sure that the first character of actual line content lies on a tab stop, so that the alignment of tabs looks normal. This is useful with options that prefix their output to the actual content: .BR \-H , \-n , and .BR \-b . In order to improve the probability that lines from a single file will all start at the same column, this also causes the line number and byte offset (if present) to be printed in a minimum size field width. .TP .BR \-Z ", " \-\^\-null Output a zero byte (the ASCII .B NUL character) instead of the character that normally follows a file name. For example, .B "grep \-lZ" outputs a zero byte after each file name instead of the usual newline. This option makes the output unambiguous, even in the presence of file names containing unusual characters like newlines. This option can be used with commands like .BR "find \-print0" , .BR "perl \-0" , .BR "sort \-z" , and .B "xargs \-0" to process arbitrary file names, even those that contain newline characters. .SS "Context Line Control" .TP .BI \-A " NUM" "\fR,\fP \-\^\-after\-context=" NUM Print .I NUM lines of trailing context after matching lines. Places a line containing a group separator .RB ( \-\^\- ) between contiguous groups of matches. With the .B \-o or .B \-\^\-only\-matching option, this has no effect and a warning is given. .TP .BI \-B " NUM" "\fR,\fP \-\^\-before\-context=" NUM Print .I NUM lines of leading context before matching lines. Places a line containing a group separator .RB ( \-\^\- ) between contiguous groups of matches. With the .B \-o or .B \-\^\-only\-matching option, this has no effect and a warning is given. .TP .BI \-C " NUM" "\fR,\fP \-" NUM "\fR,\fP \-\^\-context=" NUM Print .I NUM lines of output context. Places a line containing a group separator .RB ( \-\^\- ) between contiguous groups of matches. With the .B \-o or .B \-\^\-only\-matching option, this has no effect and a warning is given. .TP .BI \-\^\-group\-separator= SEP When .BR \-A , .BR \-B , or .B \-C are in use, print .I SEP instead of .B \-\^\- between groups of lines. .TP .B \-\^\-no\-group\-separator When .BR \-A , .BR \-B , or .B \-C are in use, do not print a separator between groups of lines. .SS "File and Directory Selection" .TP .BR \-a ", " \-\^\-text Process a binary file as if it were text; this is equivalent to the .B \-\^\-binary\-files=text option. .TP .BI \-\^\-binary\-files= TYPE If a file's data or metadata indicate that the file contains binary data, assume that the file is of type .IR TYPE . Non-text bytes indicate binary data; these are either output bytes that are improperly encoded for the current locale, or null input bytes when the .B \-z option is not given. .IP By default, .I TYPE is .BR binary , and .B grep suppresses output after null input binary data is discovered, and suppresses output lines that contain improperly encoded data. When some output is suppressed, .B grep follows any output with a one-line message saying that a binary file matches. .IP If .I TYPE is .BR without\-match , when .B grep discovers null input binary data it assumes that the rest of the file does not match; this is equivalent to the .B \-I option. .IP If .I TYPE is .BR text , .B grep processes a binary file as if it were text; this is equivalent to the .B \-a option. .IP When .I type is .BR binary , .B grep may treat non-text bytes as line terminators even without the .B \-z option. This means choosing .B binary versus .B text can affect whether a pattern matches a file. For example, when .I type is .B binary the pattern .B q$ might match .B q immediately followed by a null byte, even though this is not matched when .I type is .BR text . Conversely, when .I type is .B binary the pattern .B .\& (period) might not match a null byte. .IP .I Warning: The .B \-a option might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands. On the other hand, when reading files whose text encodings are unknown, it can be helpful to use .B \-a or to set .B LC_ALL='C' in the environment, in order to find more matches even if the matches are unsafe for direct display. .TP .BI \-D " ACTION" "\fR,\fP \-\^\-devices=" ACTION If an input file is a device, FIFO or socket, use .I ACTION to process it. By default, .I ACTION is .BR read , which means that devices are read just as if they were ordinary files. If .I ACTION is .BR skip , devices are silently skipped. .TP .BI \-d " ACTION" "\fR,\fP \-\^\-directories=" ACTION If an input file is a directory, use .I ACTION to process it. By default, .I ACTION is .BR read , i.e., read directories just as if they were ordinary files. If .I ACTION is .BR skip , silently skip directories. If .I ACTION is .BR recurse , read all files under each directory, recursively, following symbolic links only if they are on the command line. This is equivalent to the .B \-r option. .TP .BI \-\^\-exclude= GLOB Skip any command-line file with a name suffix that matches the pattern .IR GLOB , using wildcard matching; a name suffix is either the whole name, or a trailing part that starts with a non-slash character immediately after a slash .RB ( / ) in the name. When searching recursively, skip any subfile whose base name matches .IR GLOB ; the base name is the part after the last slash. A pattern can use .BR * , .BR ? , and .BR [ .\|.\|. ]\& as wildcards, and .B \e to quote a wildcard or backslash character literally. .TP .BI \-\^\-exclude\-from= FILE Skip files whose base name matches any of the file-name globs read from .I FILE (using wildcard matching as described under .BR \-\^\-exclude ). .TP .BI \-\^\-exclude\-dir= GLOB Skip any command-line directory with a name suffix that matches the pattern .IR GLOB . When searching recursively, skip any subdirectory whose base name matches .IR GLOB . Ignore any redundant trailing slashes in .IR GLOB . .TP .BR \-I Process a binary file as if it did not contain matching data; this is equivalent to the .B \-\^\-binary\-files=without\-match option. .TP .BI \-\^\-include= GLOB Search only files whose base name matches .I GLOB (using wildcard matching as described under .BR \-\^\-exclude ). If contradictory .B \-\^\-include and .B \-\^\-exclude options are given, the last matching one wins. If no .B \-\^\-include or .B \-\^\-exclude options match, a file is included unless the first such option is .BR \-\^\-include . .TP .BR \-r ", " \-\^\-recursive Read all files under each directory, recursively, following symbolic links only if they are on the command line. Note that if no file operand is given, B<grep> searches the working directory. This is equivalent to the .B "\-d recurse" option. .TP .BR \-R ", " \-\^\-dereference\-recursive Read all files under each directory, recursively. Follow all symbolic links, unlike .BR \-r . .SS "Other Options" .TP .B \-\^\-line\-buffered Use line buffering on output. This can cause a performance penalty. .TP .BR \-U ", " \-\^\-binary Treat the file(s) as binary. By default, under MS-DOS and MS-Windows, .BR grep guesses whether a file is text or binary as described for the .B \-\^\-binary\-files option. If .BR grep decides the file is a text file, it strips the CR characters from the original file contents (to make regular expressions with .B ^ and .B $ work correctly). Specifying .B \-U overrules this guesswork, causing all files to be read and passed to the matching mechanism verbatim; if the file is a text file with CR/LF pairs at the end of each line, this will cause some regular expressions to fail. This option has no effect on platforms other than MS-DOS and MS-Windows. .TP .BR \-z ", " \-\^\-null\-data Treat input and output data as sequences of lines, each terminated by a zero byte (the ASCII NUL character) instead of a newline. Like the .B \-Z or .B \-\^\-null option, this option can be used with commands like .B sort -z to process arbitrary file names. . .SH "REGULAR EXPRESSIONS" A regular expression is a pattern that describes a set of strings. Regular expressions are constructed analogously to arithmetic expressions, by using various operators to combine smaller expressions. .PP .B grep understands three different versions of regular expression syntax: \*(lqbasic\*(rq (BRE), \*(lqextended\*(rq (ERE) and \*(lqperl\*(rq (PCRE). In GNU .B grep there is no difference in available functionality between basic and extended syntaxes. In other implementations, basic regular expressions are less powerful. The following description applies to extended regular expressions; differences for basic regular expressions are summarized afterwards. Perl-compatible regular expressions give additional functionality, and are documented in B<pcresyntax>(3) and B<pcrepattern>(3), but work only if PCRE support is enabled. .PP The fundamental building blocks are the regular expressions that match a single character. Most characters, including all letters and digits, are regular expressions that match themselves. Any meta-character with special meaning may be quoted by preceding it with a backslash. .PP The period .B .\& matches any single character. It is unspecified whether it matches an encoding error. .SS "Character Classes and Bracket Expressions" A .I "bracket expression" is a list of characters enclosed by .B [ and .BR ] . It matches any single character in that list. If the first character of the list is the caret .B ^ then it matches any character .I not in the list; it is unspecified whether it matches an encoding error. For example, the regular expression .B [0123456789] matches any single digit. .PP Within a bracket expression, a .I "range expression" consists of two characters separated by a hyphen. It matches any single character that sorts between the two characters, inclusive, using the locale's collating sequence and character set. For example, in the default C locale, .B [a\-d] is equivalent to .BR [abcd] . Many locales sort characters in dictionary order, and in these locales .B [a\-d] is typically not equivalent to .BR [abcd] ; it might be equivalent to .BR [aBbCcDd] , for example. To obtain the traditional interpretation of bracket expressions, you can use the C locale by setting the .B LC_ALL environment variable to the value .BR C . .PP Finally, certain named classes of characters are predefined within bracket expressions, as follows. Their names are self explanatory, and they are .BR [:alnum:] , .BR [:alpha:] , .BR [:blank:] , .BR [:cntrl:] , .BR [:digit:] , .BR [:graph:] , .BR [:lower:] , .BR [:print:] , .BR [:punct:] , .BR [:space:] , .BR [:upper:] , and .BR [:xdigit:] . For example, .B [[:alnum:]] means the character class of numbers and letters in the current locale. In the C locale and ASCII character set encoding, this is the same as .BR [0\-9A\-Za\-z] . (Note that the brackets in these class names are part of the symbolic names, and must be included in addition to the brackets delimiting the bracket expression.) Most meta-characters lose their special meaning inside bracket expressions. To include a literal .B ] place it first in the list. Similarly, to include a literal .B ^ place it anywhere but first. Finally, to include a literal .B \- place it last. .SS Anchoring The caret .B ^ and the dollar sign .B $ are meta-characters that respectively match the empty string at the beginning and end of a line. .SS "The Backslash Character and Special Expressions" The symbols .B \e< and .B \e> respectively match the empty string at the beginning and end of a word. The symbol .B \eb matches the empty string at the edge of a word, and .B \eB matches the empty string provided it's .I not at the edge of a word. The symbol .B \ew is a synonym for .B [_[:alnum:]] and .B \eW is a synonym for .BR [^_[:alnum:]] . .SS Repetition A regular expression may be followed by one of several repetition operators: .PD 0 .TP .B ? The preceding item is optional and matched at most once. .TP .B * The preceding item will be matched zero or more times. .TP .B + The preceding item will be matched one or more times. .TP .BI { n } The preceding item is matched exactly .I n times. .TP .BI { n ,} The preceding item is matched .I n or more times. .TP .BI {, m } The preceding item is matched at most .I m times. This is a GNU extension. .TP .BI { n , m } The preceding item is matched at least .I n times, but not more than .I m times. .PD .SS Concatenation Two regular expressions may be concatenated; the resulting regular expression matches any string formed by concatenating two substrings that respectively match the concatenated expressions. .SS Alternation Two regular expressions may be joined by the infix operator .BR | ; the resulting regular expression matches any string matching either alternate expression. .SS Precedence Repetition takes precedence over concatenation, which in turn takes precedence over alternation. A whole expression may be enclosed in parentheses to override these precedence rules and form a subexpression. .SS "Back-references and Subexpressions" The back-reference .BI \e n\c \&, where .I n is a single digit, matches the substring previously matched by the .IR n th parenthesized subexpression of the regular expression. .SS "Basic vs Extended Regular Expressions" In basic regular expressions the meta-characters .BR ? , .BR + , .BR { , .BR | , .BR ( , and .BR ) lose their special meaning; instead use the backslashed versions .BR \e? , .BR \e+ , .BR \e{ , .BR \e| , .BR \e( , and .BR \e) . . .SH "EXIT STATUS" Normally the exit status is 0 if a line is selected, 1 if no lines were selected, and 2 if an error occurred. However, if the .B \-q or .B \-\^\-quiet or .B \-\^\-silent is used and a line is selected, the exit status is 0 even if an error occurred. . .SH ENVIRONMENT The behavior of .B grep is affected by the following environment variables. .PP The locale for category .BI LC_ foo is specified by examining the three environment variables .BR LC_ALL , .BR LC_\fIfoo\fP , .BR LANG , in that order. The first of these variables that is set specifies the locale. For example, if .B LC_ALL is not set, but .B LC_MESSAGES is set to .BR pt_BR , then the Brazilian Portuguese locale is used for the .B LC_MESSAGES category. The C locale is used if none of these environment variables are set, if the locale catalog is not installed, or if .B grep was not compiled with national language support (NLS). The shell command .B "locale \-a" lists locales that are currently available. .TP .B GREP_COLOR This variable specifies the color used to highlight matched (non-empty) text. It is deprecated in favor of .BR GREP_COLORS , but still supported. The .BR mt , .BR ms , and .B mc capabilities of .B GREP_COLORS have priority over it. It can only specify the color used to highlight the matching non-empty text in any matching line (a selected line when the .B \-v command-line option is omitted, or a context line when .B \-v is specified). The default is .BR 01;31 , which means a bold red foreground text on the terminal's default background. .TP .B GREP_COLORS Specifies the colors and other attributes used to highlight various parts of the output. Its value is a colon-separated list of capabilities that defaults to .B ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36 with the .B rv and .B ne boolean capabilities omitted (i.e., false). Supported capabilities are as follows. .RS .TP .B sl= SGR substring for whole selected lines (i.e., matching lines when the .B \-v command-line option is omitted, or non-matching lines when .B \-v is specified). If however the boolean .B rv capability and the .B \-v command-line option are both specified, it applies to context matching lines instead. The default is empty (i.e., the terminal's default color pair). .TP .B cx= SGR substring for whole context lines (i.e., non-matching lines when the .B \-v command-line option is omitted, or matching lines when .B \-v is specified). If however the boolean .B rv capability and the .B \-v command-line option are both specified, it applies to selected non-matching lines instead. The default is empty (i.e., the terminal's default color pair). .TP .B rv Boolean value that reverses (swaps) the meanings of the .B sl= and .B cx= capabilities when the .B \-v command-line option is specified. The default is false (i.e., the capability is omitted). .TP .B mt=01;31 SGR substring for matching non-empty text in any matching line (i.e., a selected line when the .B \-v command-line option is omitted, or a context line when .B \-v is specified). Setting this is equivalent to setting both .B ms= and .B mc= at once to the same value. The default is a bold red text foreground over the current line background. .TP .B ms=01;31 SGR substring for matching non-empty text in a selected line. (This is only used when the .B \-v command-line option is omitted.) The effect of the .B sl= (or .B cx= if .BR rv ) capability remains active when this kicks in. The default is a bold red text foreground over the current line background. .TP .B mc=01;31 SGR substring for matching non-empty text in a context line. (This is only used when the .B \-v command-line option is specified.) The effect of the .B cx= (or .B sl= if .BR rv ) capability remains active when this kicks in. The default is a bold red text foreground over the current line background. .TP .B fn=35 SGR substring for file names prefixing any content line. The default is a magenta text foreground over the terminal's default background. .TP .B ln=32 SGR substring for line numbers prefixing any content line. The default is a green text foreground over the terminal's default background. .TP .B bn=32 SGR substring for byte offsets prefixing any content line. The default is a green text foreground over the terminal's default background. .TP .B se=36 SGR substring for separators that are inserted between selected line fields .RB ( : ), between context line fields, .RB ( \- ), and between groups of adjacent lines when nonzero context is specified .RB ( \-\^\- ). The default is a cyan text foreground over the terminal's default background. .TP .B ne Boolean value that prevents clearing to the end of line using Erase in Line (EL) to Right .RB ( \e33[K ) each time a colorized item ends. This is needed on terminals on which EL is not supported. It is otherwise useful on terminals for which the .B back_color_erase .RB ( bce ) boolean terminfo capability does not apply, when the chosen highlight colors do not affect the background, or when EL is too slow or causes too much flicker. The default is false (i.e., the capability is omitted). .PP Note that boolean capabilities have no .BR = .\|.\|.\& part. They are omitted (i.e., false) by default and become true when specified. .PP See the Select Graphic Rendition (SGR) section in the documentation of the text terminal that is used for permitted values and their meaning as character attributes. These substring values are integers in decimal representation and can be concatenated with semicolons. .B grep takes care of assembling the result into a complete SGR sequence .RB ( \e33[ .\|.\|. m ). Common values to concatenate include .B 1 for bold, .B 4 for underline, .B 5 for blink, .B 7 for inverse, .B 39 for default foreground color, .B 30 to .B 37 for foreground colors, .B 90 to .B 97 for 16-color mode foreground colors, .B 38;5;0 to .B 38;5;255 for 88-color and 256-color modes foreground colors, .B 49 for default background color, .B 40 to .B 47 for background colors, .B 100 to .B 107 for 16-color mode background colors, and .B 48;5;0 to .B 48;5;255 for 88-color and 256-color modes background colors. .RE .TP \fBLC_ALL\fP, \fBLC_COLLATE\fP, \fBLANG\fP These variables specify the locale for the .B LC_COLLATE category, which determines the collating sequence used to interpret range expressions like .BR [a\-z] . .TP \fBLC_ALL\fP, \fBLC_CTYPE\fP, \fBLANG\fP These variables specify the locale for the .B LC_CTYPE category, which determines the type of characters, e.g., which characters are whitespace. This category also determines the character encoding, that is, whether text is encoded in UTF-8, ASCII, or some other encoding. In the C or POSIX locale, all characters are encoded as a single byte and every byte is a valid character. .TP \fBLC_ALL\fP, \fBLC_MESSAGES\fP, \fBLANG\fP These variables specify the locale for the .B LC_MESSAGES category, which determines the language that .B grep uses for messages. The default C locale uses American English messages. .TP .B POSIXLY_CORRECT If set, .B grep behaves as POSIX requires; otherwise, .B grep behaves more like other GNU programs. POSIX requires that options that follow file names must be treated as file names; by default, such options are permuted to the front of the operand list and are treated as options. Also, POSIX requires that unrecognized options be diagnosed as \*(lqillegal\*(rq, but since they are not really against the law the default is to diagnose them as \*(lqinvalid\*(rq. .B POSIXLY_CORRECT also disables \fB_\fP\fIN\fP\fB_GNU_nonoption_argv_flags_\fP, described below. .TP \fB_\fP\fIN\fP\fB_GNU_nonoption_argv_flags_\fP (Here .I N is .BR grep 's numeric process ID.) If the .IR i th character of this environment variable's value is .BR 1 , do not consider the .IR i th operand of .B grep to be an option, even if it appears to be one. A shell can put this variable in the environment for each command it runs, specifying which operands are the results of file name wildcard expansion and therefore should not be treated as options. This behavior is available only with the GNU C library, and only when .B POSIXLY_CORRECT is not set. . .SH NOTES This man page is maintained only fitfully; the full documentation is often more up-to-date. . .SH COPYRIGHT Copyright 1998-2000, 2002, 2005-2021 Free Software Foundation, Inc. .PP This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. . .SH BUGS .SS "Reporting Bugs" Email bug reports to .MT bug-grep@gnu.org the bug-reporting address .ME . An .UR https://lists.gnu.org/mailman/listinfo/bug-grep email archive .UE and a .UR https://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep bug tracker .UE are available. .SS "Known Bugs" Large repetition counts in the .BI { n , m } construct may cause .B grep to use lots of memory. In addition, certain other obscure regular expressions require exponential time and space, and may cause .B grep to run out of memory. .PP Back-references are very slow, and may require exponential time. . .SH EXAMPLE The following example outputs the location and contents of any line containing \*(lqf\*(rq and ending in \*(lq.c\*(rq, within all files in the current directory whose names contain \*(lqg\*(rq and end in \*(lq.h\*(rq. The .B \-n option outputs line numbers, the .B \-\- argument treats expansions of \*(lq*g*.h\*(rq starting with \*(lq\-\*(rq as file names not options, and the empty file /dev/null causes file names to be output even if only one file name happens to be of the form \*(lq*g*.h\*(rq. .PP .in +2n .EX $ \fBgrep\fP \-n \-\- 'f.*\e.c$' *g*.h /dev/null argmatch.h:1:/* definitions and prototypes for argmatch.c .EE .in .PP The only line that matches is line 1 of argmatch.h. Note that the regular expression syntax used in the pattern differs from the globbing syntax that the shell uses to match file names. . .SH "SEE ALSO" .SS "Regular Manual Pages" .BR awk (1), .BR cmp (1), .BR diff (1), .BR find (1), .BR perl (1), .BR sed (1), .BR sort (1), .BR xargs (1), .BR read (2), .BR pcre (3), .BR pcresyntax (3), .BR pcrepattern (3), .BR terminfo (5), .BR glob (7), .BR regex (7) .SS "Full Documentation" A .UR https://www.gnu.org/software/grep/manual/ complete manual .UE is available. If the .B info and .B grep programs are properly installed at your site, the command .IP .B info grep .PP should give you access to the complete manual. . .\" Work around problems with some troff -man implementations. .br . .\" Format for Emacs-maintained Dt string defined at this file's start. .\" Local variables: .\" time-stamp-format: "%:y-%02m-%02d" .\" End: ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/doc/grep.info������������������������������������������������������������������0000664�0001750�0001750�00000372054�14670377427�017045� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������This is grep.info, produced by makeinfo version 6.8 from grep.texi. This manual is for ‘grep’, a pattern matching engine. Copyright © 1999–2002, 2005, 2008–2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation Licenseâ€. INFO-DIR-SECTION Text creation and manipulation START-INFO-DIR-ENTRY * grep: (grep). Print lines that match patterns. END-INFO-DIR-ENTRY  File: grep.info, Node: Top, Next: Introduction, Up: (dir) grep **** ‘grep’ prints lines that contain a match for one or more patterns. This manual is for version 3.7 of GNU Grep. This manual is for ‘grep’, a pattern matching engine. Copyright © 1999–2002, 2005, 2008–2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation Licenseâ€. * Menu: * Introduction:: Introduction. * Invoking:: Command-line options, environment, exit status. * Regular Expressions:: Regular Expressions. * Usage:: Examples. * Performance:: Performance tuning. * Reporting Bugs:: Reporting Bugs. * Copying:: License terms for this manual. * Index:: Combined index.  File: grep.info, Node: Introduction, Next: Invoking, Prev: Top, Up: Top 1 Introduction ************** Given one or more patterns, ‘grep’ searches input files for matches to the patterns. When it finds a match in a line, it copies the line to standard output (by default), or produces whatever other sort of output you have requested with options. Though ‘grep’ expects to do the matching on text, it has no limits on input line length other than available memory, and it can match arbitrary characters within a line. If the final byte of an input file is not a newline, ‘grep’ silently supplies one. Since newline is also a separator for the list of patterns, there is no way to match newline characters in a text.  File: grep.info, Node: Invoking, Next: Regular Expressions, Prev: Introduction, Up: Top 2 Invoking ‘grep’ ***************** The general synopsis of the ‘grep’ command line is grep [OPTION...] [PATTERNS] [FILE...] There can be zero or more OPTION arguments, and zero or more FILE arguments. The PATTERNS argument contains one or more patterns separated by newlines, and is omitted when patterns are given via the ‘-e PATTERNS’ or ‘-f FILE’ options. Typically PATTERNS should be quoted when ‘grep’ is used in a shell command. * Menu: * Command-line Options:: Short and long names, grouped by category. * Environment Variables:: POSIX, GNU generic, and GNU grep specific. * Exit Status:: Exit status returned by ‘grep’. * grep Programs:: ‘grep’ programs.  File: grep.info, Node: Command-line Options, Next: Environment Variables, Up: Invoking 2.1 Command-line Options ======================== ‘grep’ comes with a rich set of options: some from POSIX and some being GNU extensions. Long option names are always a GNU extension, even for options that are from POSIX specifications. Options that are specified by POSIX, under their short names, are explicitly marked as such to facilitate POSIX-portable programming. A few option names are provided for compatibility with older or more exotic implementations. * Menu: * Generic Program Information:: * Matching Control:: * General Output Control:: * Output Line Prefix Control:: * Context Line Control:: * File and Directory Selection:: * Other Options:: Several additional options control which variant of the ‘grep’ matching engine is used. *Note grep Programs::.  File: grep.info, Node: Generic Program Information, Next: Matching Control, Up: Command-line Options 2.1.1 Generic Program Information --------------------------------- ‘--help’ Print a usage message briefly summarizing the command-line options and the bug-reporting address, then exit. ‘-V’ ‘--version’ Print the version number of ‘grep’ to the standard output stream. This version number should be included in all bug reports.  File: grep.info, Node: Matching Control, Next: General Output Control, Prev: Generic Program Information, Up: Command-line Options 2.1.2 Matching Control ---------------------- ‘-e PATTERNS’ ‘--regexp=PATTERNS’ Use PATTERNS as one or more patterns; newlines within PATTERNS separate each pattern from the next. If this option is used multiple times or is combined with the ‘-f’ (‘--file’) option, search for all patterns given. Typically PATTERNS should be quoted when ‘grep’ is used in a shell command. (‘-e’ is specified by POSIX.) ‘-f FILE’ ‘--file=FILE’ Obtain patterns from FILE, one per line. If this option is used multiple times or is combined with the ‘-e’ (‘--regexp’) option, search for all patterns given. The empty file contains zero patterns, and therefore matches nothing. (‘-f’ is specified by POSIX.) ‘-i’ ‘-y’ ‘--ignore-case’ Ignore case distinctions in patterns and input data, so that characters that differ only in case match each other. Although this is straightforward when letters differ in case only via lowercase-uppercase pairs, the behavior is unspecified in other situations. For example, uppercase “S†has an unusual lowercase counterpart “ſ†(Unicode character U+017F, LATIN SMALL LETTER LONG S) in many locales, and it is unspecified whether this unusual character matches “S†or “s†even though uppercasing it yields “Sâ€. Another example: the lowercase German letter “߆(U+00DF, LATIN SMALL LETTER SHARP S) is normally capitalized as the two-character string “SS†but it does not match “SSâ€, and it might not match the uppercase letter “ẞ†(U+1E9E, LATIN CAPITAL LETTER SHARP S) even though lowercasing the latter yields the former. ‘-y’ is an obsolete synonym that is provided for compatibility. (‘-i’ is specified by POSIX.) ‘--no-ignore-case’ Do not ignore case distinctions in patterns and input data. This is the default. This option is useful for passing to shell scripts that already use ‘-i’, in order to cancel its effects because the two options override each other. ‘-v’ ‘--invert-match’ Invert the sense of matching, to select non-matching lines. (‘-v’ is specified by POSIX.) ‘-w’ ‘--word-regexp’ Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word constituent characters are letters, digits, and the underscore. This option has no effect if ‘-x’ is also specified. Because the ‘-w’ option can match a substring that does not begin and end with word constituents, it differs from surrounding a regular expression with ‘\<’ and ‘\>’. For example, although ‘grep -w @’ matches a line containing only ‘@’, ‘grep '\<@\>'’ cannot match any line because ‘@’ is not a word constituent. *Note The Backslash Character and Special Expressions::. ‘-x’ ‘--line-regexp’ Select only those matches that exactly match the whole line. For regular expression patterns, this is like parenthesizing each pattern and then surrounding it with ‘^’ and ‘$’. (‘-x’ is specified by POSIX.)  File: grep.info, Node: General Output Control, Next: Output Line Prefix Control, Prev: Matching Control, Up: Command-line Options 2.1.3 General Output Control ---------------------------- ‘-c’ ‘--count’ Suppress normal output; instead print a count of matching lines for each input file. With the ‘-v’ (‘--invert-match’) option, count non-matching lines. (‘-c’ is specified by POSIX.) ‘--color[=WHEN]’ ‘--colour[=WHEN]’ Surround the matched (non-empty) strings, matching lines, context lines, file names, line numbers, byte offsets, and separators (for fields and groups of context lines) with escape sequences to display them in color on the terminal. The colors are defined by the environment variable ‘GREP_COLORS’ and default to ‘ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36’ for bold red matched text, magenta file names, green line numbers, green byte offsets, cyan separators, and default terminal colors otherwise. The deprecated environment variable ‘GREP_COLOR’ is still supported, but its setting does not have priority; it defaults to ‘01;31’ (bold red) which only covers the color for matched text. WHEN is ‘never’, ‘always’, or ‘auto’. ‘-L’ ‘--files-without-match’ Suppress normal output; instead print the name of each input file from which no output would normally have been printed. ‘-l’ ‘--files-with-matches’ Suppress normal output; instead print the name of each input file from which output would normally have been printed. Scanning each input file stops upon first match. (‘-l’ is specified by POSIX.) ‘-m NUM’ ‘--max-count=NUM’ Stop after the first NUM selected lines. If the input is standard input from a regular file, and NUM selected lines are output, ‘grep’ ensures that the standard input is positioned just after the last selected line before exiting, regardless of the presence of trailing context lines. This enables a calling process to resume a search. For example, the following shell script makes use of it: while grep -m 1 'PATTERN' do echo xxxx done < FILE But the following probably will not work because a pipe is not a regular file: # This probably will not work. cat FILE | while grep -m 1 'PATTERN' do echo xxxx done When ‘grep’ stops after NUM selected lines, it outputs any trailing context lines. When the ‘-c’ or ‘--count’ option is also used, ‘grep’ does not output a count greater than NUM. When the ‘-v’ or ‘--invert-match’ option is also used, ‘grep’ stops after outputting NUM non-matching lines. ‘-o’ ‘--only-matching’ Print only the matched (non-empty) parts of matching lines, with each such part on a separate output line. Output lines use the same delimiters as input, and delimiters are null bytes if ‘-z’ (‘--null-data’) is also used (*note Other Options::). ‘-q’ ‘--quiet’ ‘--silent’ Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. Also see the ‘-s’ or ‘--no-messages’ option. (‘-q’ is specified by POSIX.) ‘-s’ ‘--no-messages’ Suppress error messages about nonexistent or unreadable files. Portability note: unlike GNU ‘grep’, 7th Edition Unix ‘grep’ did not conform to POSIX, because it lacked ‘-q’ and its ‘-s’ option behaved like GNU ‘grep’’s ‘-q’ option.(1) USG-style ‘grep’ also lacked ‘-q’ but its ‘-s’ option behaved like GNU ‘grep’’s. Portable shell scripts should avoid both ‘-q’ and ‘-s’ and should redirect standard and error output to ‘/dev/null’ instead. (‘-s’ is specified by POSIX.) ---------- Footnotes ---------- (1) Of course, 7th Edition Unix predated POSIX by several years!  File: grep.info, Node: Output Line Prefix Control, Next: Context Line Control, Prev: General Output Control, Up: Command-line Options 2.1.4 Output Line Prefix Control -------------------------------- When several prefix fields are to be output, the order is always file name, line number, and byte offset, regardless of the order in which these options were specified. ‘-b’ ‘--byte-offset’ Print the 0-based byte offset within the input file before each line of output. If ‘-o’ (‘--only-matching’) is specified, print the offset of the matching part itself. ‘-H’ ‘--with-filename’ Print the file name for each match. This is the default when there is more than one file to search. ‘-h’ ‘--no-filename’ Suppress the prefixing of file names on output. This is the default when there is only one file (or only standard input) to search. ‘--label=LABEL’ Display input actually coming from standard input as input coming from file LABEL. This can be useful for commands that transform a file’s contents before searching; e.g.: gzip -cd foo.gz | grep --label=foo -H 'some pattern' ‘-n’ ‘--line-number’ Prefix each line of output with the 1-based line number within its input file. (‘-n’ is specified by POSIX.) ‘-T’ ‘--initial-tab’ Make sure that the first character of actual line content lies on a tab stop, so that the alignment of tabs looks normal. This is useful with options that prefix their output to the actual content: ‘-H’, ‘-n’, and ‘-b’. This may also prepend spaces to output line numbers and byte offsets so that lines from a single file all start at the same column. ‘-Z’ ‘--null’ Output a zero byte (the ASCII NUL character) instead of the character that normally follows a file name. For example, ‘grep -lZ’ outputs a zero byte after each file name instead of the usual newline. This option makes the output unambiguous, even in the presence of file names containing unusual characters like newlines. This option can be used with commands like ‘find -print0’, ‘perl -0’, ‘sort -z’, and ‘xargs -0’ to process arbitrary file names, even those that contain newline characters.  File: grep.info, Node: Context Line Control, Next: File and Directory Selection, Prev: Output Line Prefix Control, Up: Command-line Options 2.1.5 Context Line Control -------------------------- “Context lines†are non-matching lines that are near a matching line. They are output only if one of the following options are used. Regardless of how these options are set, ‘grep’ never outputs any given line more than once. If the ‘-o’ (‘--only-matching’) option is specified, these options have no effect and a warning is given upon their use. ‘-A NUM’ ‘--after-context=NUM’ Print NUM lines of trailing context after matching lines. ‘-B NUM’ ‘--before-context=NUM’ Print NUM lines of leading context before matching lines. ‘-C NUM’ ‘-NUM’ ‘--context=NUM’ Print NUM lines of leading and trailing output context. ‘--group-separator=STRING’ When ‘-A’, ‘-B’ or ‘-C’ are in use, print STRING instead of ‘--’ between groups of lines. ‘--no-group-separator’ When ‘-A’, ‘-B’ or ‘-C’ are in use, do not print a separator between groups of lines. Here are some points about how ‘grep’ chooses the separator to print between prefix fields and line content: • Matching lines normally use ‘:’ as a separator between prefix fields and actual line content. • Context (i.e., non-matching) lines use ‘-’ instead. • When context is not specified, matching lines are simply output one right after another. • When context is specified, lines that are adjacent in the input form a group and are output one right after another, while by default a separator appears between non-adjacent groups. • The default separator is a ‘--’ line; its presence and appearance can be changed with the options above. • Each group may contain several matching lines when they are close enough to each other that two adjacent groups connect and can merge into a single contiguous one.  File: grep.info, Node: File and Directory Selection, Next: Other Options, Prev: Context Line Control, Up: Command-line Options 2.1.6 File and Directory Selection ---------------------------------- ‘-a’ ‘--text’ Process a binary file as if it were text; this is equivalent to the ‘--binary-files=text’ option. ‘--binary-files=TYPE’ If a file’s data or metadata indicate that the file contains binary data, assume that the file is of type TYPE. Non-text bytes indicate binary data; these are either output bytes that are improperly encoded for the current locale (*note Environment Variables::), or null input bytes when the ‘-z’ (‘--null-data’) option is not given (*note Other Options::). By default, TYPE is ‘binary’, and ‘grep’ suppresses output after null input binary data is discovered, and suppresses output lines that contain improperly encoded data. When some output is suppressed, ‘grep’ follows any output with a one-line message saying that a binary file matches. If TYPE is ‘without-match’, when ‘grep’ discovers null input binary data it assumes that the rest of the file does not match; this is equivalent to the ‘-I’ option. If TYPE is ‘text’, ‘grep’ processes binary data as if it were text; this is equivalent to the ‘-a’ option. When TYPE is ‘binary’, ‘grep’ may treat non-text bytes as line terminators even without the ‘-z’ (‘--null-data’) option. This means choosing ‘binary’ versus ‘text’ can affect whether a pattern matches a file. For example, when TYPE is ‘binary’ the pattern ‘q$’ might match ‘q’ immediately followed by a null byte, even though this is not matched when TYPE is ‘text’. Conversely, when TYPE is ‘binary’ the pattern ‘.’ (period) might not match a null byte. _Warning:_ The ‘-a’ (‘--binary-files=text’) option might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands. On the other hand, when reading files whose text encodings are unknown, it can be helpful to use ‘-a’ or to set ‘LC_ALL='C'’ in the environment, in order to find more matches even if the matches are unsafe for direct display. ‘-D ACTION’ ‘--devices=ACTION’ If an input file is a device, FIFO, or socket, use ACTION to process it. If ACTION is ‘read’, all devices are read just as if they were ordinary files. If ACTION is ‘skip’, devices, FIFOs, and sockets are silently skipped. By default, devices are read if they are on the command line or if the ‘-R’ (‘--dereference-recursive’) option is used, and are skipped if they are encountered recursively and the ‘-r’ (‘--recursive’) option is used. This option has no effect on a file that is read via standard input. ‘-d ACTION’ ‘--directories=ACTION’ If an input file is a directory, use ACTION to process it. By default, ACTION is ‘read’, which means that directories are read just as if they were ordinary files (some operating systems and file systems disallow this, and will cause ‘grep’ to print error messages for every directory or silently skip them). If ACTION is ‘skip’, directories are silently skipped. If ACTION is ‘recurse’, ‘grep’ reads all files under each directory, recursively, following command-line symbolic links and skipping other symlinks; this is equivalent to the ‘-r’ option. ‘--exclude=GLOB’ Skip any command-line file with a name suffix that matches the pattern GLOB, using wildcard matching; a name suffix is either the whole name, or a trailing part that starts with a non-slash character immediately after a slash (‘/’) in the name. When searching recursively, skip any subfile whose base name matches GLOB; the base name is the part after the last slash. A pattern can use ‘*’, ‘?’, and ‘[’...‘]’ as wildcards, and ‘\’ to quote a wildcard or backslash character literally. ‘--exclude-from=FILE’ Skip files whose name matches any of the patterns read from FILE (using wildcard matching as described under ‘--exclude’). ‘--exclude-dir=GLOB’ Skip any command-line directory with a name suffix that matches the pattern GLOB. When searching recursively, skip any subdirectory whose base name matches GLOB. Ignore any redundant trailing slashes in GLOB. ‘-I’ Process a binary file as if it did not contain matching data; this is equivalent to the ‘--binary-files=without-match’ option. ‘--include=GLOB’ Search only files whose name matches GLOB, using wildcard matching as described under ‘--exclude’. If contradictory ‘--include’ and ‘--exclude’ options are given, the last matching one wins. If no ‘--include’ or ‘--exclude’ options match, a file is included unless the first such option is ‘--include’. ‘-r’ ‘--recursive’ For each directory operand, read and process all files in that directory, recursively. Follow symbolic links on the command line, but skip symlinks that are encountered recursively. Note that if no file operand is given, grep searches the working directory. This is the same as the ‘--directories=recurse’ option. ‘-R’ ‘--dereference-recursive’ For each directory operand, read and process all files in that directory, recursively, following all symbolic links.  File: grep.info, Node: Other Options, Prev: File and Directory Selection, Up: Command-line Options 2.1.7 Other Options ------------------- ‘--’ Delimit the option list. Later arguments, if any, are treated as operands even if they begin with ‘-’. For example, ‘grep PAT -- -file1 file2’ searches for the pattern PAT in the files named ‘-file1’ and ‘file2’. ‘--line-buffered’ Use line buffering for standard output, regardless of output device. By default, standard output is line buffered for interactive devices, and is fully buffered otherwise. With full buffering, the output buffer is flushed when full; with line buffering, the buffer is also flushed after every output line. The buffer size is system dependent. ‘-U’ ‘--binary’ On platforms that distinguish between text and binary I/O, use the latter when reading and writing files other than the user’s terminal, so that all input bytes are read and written as-is. This overrides the default behavior where ‘grep’ follows the operating system’s advice whether to use text or binary I/O. On MS-Windows when ‘grep’ uses text I/O it reads a carriage return–newline pair as a newline and a Control-Z as end-of-file, and it writes a newline as a carriage return–newline pair. When using text I/O ‘--byte-offset’ (‘-b’) counts and ‘--binary-files’ heuristics apply to input data after text-I/O processing. Also, the ‘--binary-files’ heuristics need not agree with the ‘--binary’ option; that is, they may treat the data as text even if ‘--binary’ is given, or vice versa. *Note File and Directory Selection::. This option has no effect on GNU and other POSIX-compatible platforms, which do not distinguish text from binary I/O. ‘-z’ ‘--null-data’ Treat input and output data as sequences of lines, each terminated by a zero byte (the ASCII NUL character) instead of a newline. Like the ‘-Z’ or ‘--null’ option, this option can be used with commands like ‘sort -z’ to process arbitrary file names.  File: grep.info, Node: Environment Variables, Next: Exit Status, Prev: Command-line Options, Up: Invoking 2.2 Environment Variables ========================= The behavior of ‘grep’ is affected by the following environment variables. The locale for category ‘LC_FOO’ is specified by examining the three environment variables ‘LC_ALL’, ‘LC_FOO’, and ‘LANG’, in that order. The first of these variables that is set specifies the locale. For example, if ‘LC_ALL’ is not set, but ‘LC_COLLATE’ is set to ‘pt_BR’, then the Brazilian Portuguese locale is used for the ‘LC_COLLATE’ category. As a special case for ‘LC_MESSAGES’ only, the environment variable ‘LANGUAGE’ can contain a colon-separated list of languages that overrides the three environment variables that ordinarily specify the ‘LC_MESSAGES’ category. The ‘C’ locale is used if none of these environment variables are set, if the locale catalog is not installed, or if ‘grep’ was not compiled with national language support (NLS). The shell command ‘locale -a’ lists locales that are currently available. Many of the environment variables in the following list let you control highlighting using Select Graphic Rendition (SGR) commands interpreted by the terminal or terminal emulator. (See the section in the documentation of your text terminal for permitted values and their meanings as character attributes.) These substring values are integers in decimal representation and can be concatenated with semicolons. ‘grep’ takes care of assembling the result into a complete SGR sequence (‘\33[’...‘m’). Common values to concatenate include ‘1’ for bold, ‘4’ for underline, ‘5’ for blink, ‘7’ for inverse, ‘39’ for default foreground color, ‘30’ to ‘37’ for foreground colors, ‘90’ to ‘97’ for 16-color mode foreground colors, ‘38;5;0’ to ‘38;5;255’ for 88-color and 256-color modes foreground colors, ‘49’ for default background color, ‘40’ to ‘47’ for background colors, ‘100’ to ‘107’ for 16-color mode background colors, and ‘48;5;0’ to ‘48;5;255’ for 88-color and 256-color modes background colors. The two-letter names used in the ‘GREP_COLORS’ environment variable (and some of the others) refer to terminal “capabilities,†the ability of a terminal to highlight text, or change its color, and so on. These capabilities are stored in an online database and accessed by the ‘terminfo’ library. ‘GREP_COLOR’ This variable specifies the color used to highlight matched (non-empty) text. It is deprecated in favor of ‘GREP_COLORS’, but still supported. The ‘mt’, ‘ms’, and ‘mc’ capabilities of ‘GREP_COLORS’ have priority over it. It can only specify the color used to highlight the matching non-empty text in any matching line (a selected line when the ‘-v’ command-line option is omitted, or a context line when ‘-v’ is specified). The default is ‘01;31’, which means a bold red foreground text on the terminal’s default background. ‘GREP_COLORS’ This variable specifies the colors and other attributes used to highlight various parts of the output. Its value is a colon-separated list of ‘terminfo’ capabilities that defaults to ‘ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36’ with the ‘rv’ and ‘ne’ boolean capabilities omitted (i.e., false). Supported capabilities are as follows. ‘sl=’ SGR substring for whole selected lines (i.e., matching lines when the ‘-v’ command-line option is omitted, or non-matching lines when ‘-v’ is specified). If however the boolean ‘rv’ capability and the ‘-v’ command-line option are both specified, it applies to context matching lines instead. The default is empty (i.e., the terminal’s default color pair). ‘cx=’ SGR substring for whole context lines (i.e., non-matching lines when the ‘-v’ command-line option is omitted, or matching lines when ‘-v’ is specified). If however the boolean ‘rv’ capability and the ‘-v’ command-line option are both specified, it applies to selected non-matching lines instead. The default is empty (i.e., the terminal’s default color pair). ‘rv’ Boolean value that reverses (swaps) the meanings of the ‘sl=’ and ‘cx=’ capabilities when the ‘-v’ command-line option is specified. The default is false (i.e., the capability is omitted). ‘mt=01;31’ SGR substring for matching non-empty text in any matching line (i.e., a selected line when the ‘-v’ command-line option is omitted, or a context line when ‘-v’ is specified). Setting this is equivalent to setting both ‘ms=’ and ‘mc=’ at once to the same value. The default is a bold red text foreground over the current line background. ‘ms=01;31’ SGR substring for matching non-empty text in a selected line. (This is used only when the ‘-v’ command-line option is omitted.) The effect of the ‘sl=’ (or ‘cx=’ if ‘rv’) capability remains active when this takes effect. The default is a bold red text foreground over the current line background. ‘mc=01;31’ SGR substring for matching non-empty text in a context line. (This is used only when the ‘-v’ command-line option is specified.) The effect of the ‘cx=’ (or ‘sl=’ if ‘rv’) capability remains active when this takes effect. The default is a bold red text foreground over the current line background. ‘fn=35’ SGR substring for file names prefixing any content line. The default is a magenta text foreground over the terminal’s default background. ‘ln=32’ SGR substring for line numbers prefixing any content line. The default is a green text foreground over the terminal’s default background. ‘bn=32’ SGR substring for byte offsets prefixing any content line. The default is a green text foreground over the terminal’s default background. ‘se=36’ SGR substring for separators that are inserted between selected line fields (‘:’), between context line fields (‘-’), and between groups of adjacent lines when nonzero context is specified (‘--’). The default is a cyan text foreground over the terminal’s default background. ‘ne’ Boolean value that prevents clearing to the end of line using Erase in Line (EL) to Right (‘\33[K’) each time a colorized item ends. This is needed on terminals on which EL is not supported. It is otherwise useful on terminals for which the ‘back_color_erase’ (‘bce’) boolean ‘terminfo’ capability does not apply, when the chosen highlight colors do not affect the background, or when EL is too slow or causes too much flicker. The default is false (i.e., the capability is omitted). Note that boolean capabilities have no ‘=’... part. They are omitted (i.e., false) by default and become true when specified. ‘LC_ALL’ ‘LC_COLLATE’ ‘LANG’ These variables specify the locale for the ‘LC_COLLATE’ category, which might affect how range expressions like ‘[a-z]’ are interpreted. ‘LC_ALL’ ‘LC_CTYPE’ ‘LANG’ These variables specify the locale for the ‘LC_CTYPE’ category, which determines the type of characters, e.g., which characters are whitespace. This category also determines the character encoding. *Note Character Encoding::. ‘LANGUAGE’ ‘LC_ALL’ ‘LC_MESSAGES’ ‘LANG’ These variables specify the locale for the ‘LC_MESSAGES’ category, which determines the language that ‘grep’ uses for messages. The default ‘C’ locale uses American English messages. ‘POSIXLY_CORRECT’ If set, ‘grep’ behaves as POSIX requires; otherwise, ‘grep’ behaves more like other GNU programs. POSIX requires that options that follow file names must be treated as file names; by default, such options are permuted to the front of the operand list and are treated as options. Also, ‘POSIXLY_CORRECT’ disables special handling of an invalid bracket expression. *Note invalid-bracket-expr::. ‘_N_GNU_nonoption_argv_flags_’ (Here ‘N’ is ‘grep’’s numeric process ID.) If the Ith character of this environment variable’s value is ‘1’, do not consider the Ith operand of ‘grep’ to be an option, even if it appears to be one. A shell can put this variable in the environment for each command it runs, specifying which operands are the results of file name wildcard expansion and therefore should not be treated as options. This behavior is available only with the GNU C library, and only when ‘POSIXLY_CORRECT’ is not set. The ‘GREP_OPTIONS’ environment variable of ‘grep’ 2.20 and earlier is no longer supported, as it caused problems when writing portable scripts. To make arbitrary changes to how ‘grep’ works, you can use an alias or script instead. For example, if ‘grep’ is in the directory ‘/usr/bin’ you can prepend ‘$HOME/bin’ to your ‘PATH’ and create an executable script ‘$HOME/bin/grep’ containing the following: #! /bin/sh export PATH=/usr/bin exec grep --color=auto --devices=skip "$@"  File: grep.info, Node: Exit Status, Next: grep Programs, Prev: Environment Variables, Up: Invoking 2.3 Exit Status =============== Normally the exit status is 0 if a line is selected, 1 if no lines were selected, and 2 if an error occurred. However, if the ‘-q’ or ‘--quiet’ or ‘--silent’ option is used and a line is selected, the exit status is 0 even if an error occurred. Other ‘grep’ implementations may exit with status greater than 2 on error.  File: grep.info, Node: grep Programs, Prev: Exit Status, Up: Invoking 2.4 ‘grep’ Programs =================== ‘grep’ searches the named input files for lines containing a match to the given patterns. By default, ‘grep’ prints the matching lines. A file named ‘-’ stands for standard input. If no input is specified, ‘grep’ searches the working directory ‘.’ if given a command-line option specifying recursion; otherwise, ‘grep’ searches standard input. There are four major variants of ‘grep’, controlled by the following options. ‘-G’ ‘--basic-regexp’ Interpret patterns as basic regular expressions (BREs). This is the default. ‘-E’ ‘--extended-regexp’ Interpret patterns as extended regular expressions (EREs). (‘-E’ is specified by POSIX.) ‘-F’ ‘--fixed-strings’ Interpret patterns as fixed strings, not regular expressions. (‘-F’ is specified by POSIX.) ‘-P’ ‘--perl-regexp’ Interpret patterns as Perl-compatible regular expressions (PCREs). PCRE support is here to stay, but consider this option experimental when combined with the ‘-z’ (‘--null-data’) option, and note that ‘grep -P’ may warn of unimplemented features. *Note Other Options::. In addition, two variant programs ‘egrep’ and ‘fgrep’ are available. ‘egrep’ is the same as ‘grep -E’. ‘fgrep’ is the same as ‘grep -F’. Direct invocation as either ‘egrep’ or ‘fgrep’ is deprecated, but is provided to allow historical applications that rely on them to run unmodified.  File: grep.info, Node: Regular Expressions, Next: Usage, Prev: Invoking, Up: Top 3 Regular Expressions ********************* A “regular expression†is a pattern that describes a set of strings. Regular expressions are constructed analogously to arithmetic expressions, by using various operators to combine smaller expressions. ‘grep’ understands three different versions of regular expression syntax: basic (BRE), extended (ERE), and Perl-compatible (PCRE). In GNU ‘grep’, there is no difference in available functionality between the basic and extended syntaxes. In other implementations, basic regular expressions are less powerful. The following description applies to extended regular expressions; differences for basic regular expressions are summarized afterwards. Perl-compatible regular expressions give additional functionality, and are documented in the pcresyntax(3) and pcrepattern(3) manual pages, but work only if PCRE is available in the system. * Menu: * Fundamental Structure:: * Character Classes and Bracket Expressions:: * The Backslash Character and Special Expressions:: * Anchoring:: * Back-references and Subexpressions:: * Basic vs Extended:: * Character Encoding:: * Matching Non-ASCII::  File: grep.info, Node: Fundamental Structure, Next: Character Classes and Bracket Expressions, Up: Regular Expressions 3.1 Fundamental Structure ========================= In regular expressions, the characters ‘.?*+{|()[\^$’ are “special characters†and have uses described below. All other characters are “ordinary charactersâ€, and each ordinary character is a regular expression that matches itself. The period ‘.’ matches any single character. It is unspecified whether ‘.’ matches an encoding error. A regular expression may be followed by one of several repetition operators; the operators beginning with ‘{’ are called “interval expressionsâ€. ‘?’ The preceding item is optional and is matched at most once. ‘*’ The preceding item is matched zero or more times. ‘+’ The preceding item is matched one or more times. ‘{N}’ The preceding item is matched exactly N times. ‘{N,}’ The preceding item is matched N or more times. ‘{,M}’ The preceding item is matched at most M times. This is a GNU extension. ‘{N,M}’ The preceding item is matched at least N times, but not more than M times. The empty regular expression matches the empty string. Two regular expressions may be concatenated; the resulting regular expression matches any string formed by concatenating two substrings that respectively match the concatenated expressions. Two regular expressions may be joined by the infix operator ‘|’; the resulting regular expression matches any string matching either alternate expression. Repetition takes precedence over concatenation, which in turn takes precedence over alternation. A whole expression may be enclosed in parentheses to override these precedence rules and form a subexpression. An unmatched ‘)’ matches just itself.  File: grep.info, Node: Character Classes and Bracket Expressions, Next: The Backslash Character and Special Expressions, Prev: Fundamental Structure, Up: Regular Expressions 3.2 Character Classes and Bracket Expressions ============================================= A “bracket expression†is a list of characters enclosed by ‘[’ and ‘]’. It matches any single character in that list. If the first character of the list is the caret ‘^’, then it matches any character *not* in the list, and it is unspecified whether it matches an encoding error. For example, the regular expression ‘[0123456789]’ matches any single digit, whereas ‘[^()]’ matches any single character that is not an opening or closing parenthesis, and might or might not match an encoding error. Within a bracket expression, a “range expression†consists of two characters separated by a hyphen. It matches any single character that sorts between the two characters, inclusive. In the default C locale, the sorting sequence is the native character order; for example, ‘[a-d]’ is equivalent to ‘[abcd]’. In other locales, the sorting sequence is not specified, and ‘[a-d]’ might be equivalent to ‘[abcd]’ or to ‘[aBbCcDd]’, or it might fail to match any character, or the set of characters that it matches might even be erratic. To obtain the traditional interpretation of bracket expressions, you can use the ‘C’ locale by setting the ‘LC_ALL’ environment variable to the value ‘C’. Finally, certain named classes of characters are predefined within bracket expressions, as follows. Their interpretation depends on the ‘LC_CTYPE’ locale; for example, ‘[[:alnum:]]’ means the character class of numbers and letters in the current locale. ‘[:alnum:]’ Alphanumeric characters: ‘[:alpha:]’ and ‘[:digit:]’; in the ‘C’ locale and ASCII character encoding, this is the same as ‘[0-9A-Za-z]’. ‘[:alpha:]’ Alphabetic characters: ‘[:lower:]’ and ‘[:upper:]’; in the ‘C’ locale and ASCII character encoding, this is the same as ‘[A-Za-z]’. ‘[:blank:]’ Blank characters: space and tab. ‘[:cntrl:]’ Control characters. In ASCII, these characters have octal codes 000 through 037, and 177 (DEL). In other character sets, these are the equivalent characters, if any. ‘[:digit:]’ Digits: ‘0 1 2 3 4 5 6 7 8 9’. ‘[:graph:]’ Graphical characters: ‘[:alnum:]’ and ‘[:punct:]’. ‘[:lower:]’ Lower-case letters; in the ‘C’ locale and ASCII character encoding, this is ‘a b c d e f g h i j k l m n o p q r s t u v w x y z’. ‘[:print:]’ Printable characters: ‘[:alnum:]’, ‘[:punct:]’, and space. ‘[:punct:]’ Punctuation characters; in the ‘C’ locale and ASCII character encoding, this is ‘! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~’. ‘[:space:]’ Space characters: in the ‘C’ locale, this is tab, newline, vertical tab, form feed, carriage return, and space. *Note Usage::, for more discussion of matching newlines. ‘[:upper:]’ Upper-case letters: in the ‘C’ locale and ASCII character encoding, this is ‘A B C D E F G H I J K L M N O P Q R S T U V W X Y Z’. ‘[:xdigit:]’ Hexadecimal digits: ‘0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f’. Note that the brackets in these class names are part of the symbolic names, and must be included in addition to the brackets delimiting the bracket expression. If you mistakenly omit the outer brackets, and search for say, ‘[:upper:]’, GNU ‘grep’ prints a diagnostic and exits with status 2, on the assumption that you did not intend to search for the nominally equivalent regular expression: ‘[:epru]’. Set the ‘POSIXLY_CORRECT’ environment variable to disable this feature. Special characters lose their special meaning inside bracket expressions. ‘]’ ends the bracket expression if it’s not the first list item. So, if you want to make the ‘]’ character a list item, you must put it first. ‘[.’ represents the open collating symbol. ‘.]’ represents the close collating symbol. ‘[=’ represents the open equivalence class. ‘=]’ represents the close equivalence class. ‘[:’ represents the open character class symbol, and should be followed by a valid character class name. ‘:]’ represents the close character class symbol. ‘-’ represents the range if it’s not first or last in a list or the ending point of a range. ‘^’ represents the characters not in the list. If you want to make the ‘^’ character a list item, place it anywhere but first.  File: grep.info, Node: The Backslash Character and Special Expressions, Next: Anchoring, Prev: Character Classes and Bracket Expressions, Up: Regular Expressions 3.3 The Backslash Character and Special Expressions =================================================== The ‘\’ character followed by a special character is a regular expression that matches the special character. The ‘\’ character, when followed by certain ordinary characters, takes a special meaning: ‘\b’ Match the empty string at the edge of a word. ‘\B’ Match the empty string provided it’s not at the edge of a word. ‘\<’ Match the empty string at the beginning of a word. ‘\>’ Match the empty string at the end of a word. ‘\w’ Match word constituent, it is a synonym for ‘[_[:alnum:]]’. ‘\W’ Match non-word constituent, it is a synonym for ‘[^_[:alnum:]]’. ‘\s’ Match whitespace, it is a synonym for ‘[[:space:]]’. ‘\S’ Match non-whitespace, it is a synonym for ‘[^[:space:]]’. For example, ‘\brat\b’ matches the separate word ‘rat’, ‘\Brat\B’ matches ‘crate’ but not ‘furry rat’.  File: grep.info, Node: Anchoring, Next: Back-references and Subexpressions, Prev: The Backslash Character and Special Expressions, Up: Regular Expressions 3.4 Anchoring ============= The caret ‘^’ and the dollar sign ‘$’ are special characters that respectively match the empty string at the beginning and end of a line. They are termed “anchorsâ€, since they force the match to be “anchored†to beginning or end of a line, respectively.  File: grep.info, Node: Back-references and Subexpressions, Next: Basic vs Extended, Prev: Anchoring, Up: Regular Expressions 3.5 Back-references and Subexpressions ====================================== The back-reference ‘\N’, where N is a single nonzero digit, matches the substring previously matched by the Nth parenthesized subexpression of the regular expression. For example, ‘(a)\1’ matches ‘aa’. If the parenthesized subexpression does not participate in the match, the back-reference makes the whole match fail; for example, ‘(a)*\1’ fails to match ‘a’. If the parenthesized subexpression matches more than one substring, the back-reference refers to the last matched substring; for example, ‘^(ab*)*\1$’ matches ‘ababbabb’ but not ‘ababbab’. When multiple regular expressions are given with ‘-e’ or from a file (‘-f FILE’), back-references are local to each expression. *Note Known Bugs::, for some known problems with back-references.  File: grep.info, Node: Basic vs Extended, Next: Character Encoding, Prev: Back-references and Subexpressions, Up: Regular Expressions 3.6 Basic vs Extended Regular Expressions ========================================= In basic regular expressions the characters ‘?’, ‘+’, ‘{’, ‘|’, ‘(’, and ‘)’ lose their special meaning; instead use the backslashed versions ‘\?’, ‘\+’, ‘\{’, ‘\|’, ‘\(’, and ‘\)’. Also, a backslash is needed before an interval expression’s closing ‘}’, and an unmatched ‘\)’ is invalid. Portable scripts should avoid the following constructs, as POSIX says they produce undefined results: • Extended regular expressions that use back-references. • Basic regular expressions that use ‘\?’, ‘\+’, or ‘\|’. • Empty parenthesized regular expressions like ‘()’. • Empty alternatives (as in, e.g, ‘a|’). • Repetition operators that immediately follow empty expressions, unescaped ‘$’, or other repetition operators. • A backslash escaping an ordinary character (e.g., ‘\S’), unless it is a back-reference. • An unescaped ‘[’ that is not part of a bracket expression. • In extended regular expressions, an unescaped ‘{’ that is not part of an interval expression. Traditional ‘egrep’ did not support interval expressions and some ‘egrep’ implementations use ‘\{’ and ‘\}’ instead, so portable scripts should avoid interval expressions in ‘grep -E’ patterns and should use ‘[{]’ to match a literal ‘{’. GNU ‘grep -E’ attempts to support traditional usage by assuming that ‘{’ is not special if it would be the start of an invalid interval expression. For example, the command ‘grep -E '{1'’ searches for the two-character string ‘{1’ instead of reporting a syntax error in the regular expression. POSIX allows this behavior as an extension, but portable scripts should avoid it.  File: grep.info, Node: Character Encoding, Next: Matching Non-ASCII, Prev: Basic vs Extended, Up: Regular Expressions 3.7 Character Encoding ====================== The ‘LC_CTYPE’ locale specifies the encoding of characters in patterns and data, that is, whether text is encoded in UTF-8, ASCII, or some other encoding. *Note Environment Variables::. In the ‘C’ or ‘POSIX’ locale, every character is encoded as a single byte and every byte is a valid character. In more-complex encodings such as UTF-8, a sequence of multiple bytes may be needed to represent a character, and some bytes may be encoding errors that do not contribute to the representation of any character. POSIX does not specify the behavior of ‘grep’ when patterns or input data contain encoding errors or null characters, so portable scripts should avoid such usage. As an extension to POSIX, GNU ‘grep’ treats null characters like any other character. However, unless the ‘-a’ (‘--binary-files=text’) option is used, the presence of null characters in input or of encoding errors in output causes GNU ‘grep’ to treat the file as binary and suppress details about matches. *Note File and Directory Selection::. Regardless of locale, the 103 characters in the POSIX Portable Character Set (a subset of ASCII) are always encoded as a single byte, and the 128 ASCII characters have their usual single-byte encodings on all but oddball platforms.  File: grep.info, Node: Matching Non-ASCII, Prev: Character Encoding, Up: Regular Expressions 3.8 Matching Non-ASCII and Non-printable Characters =================================================== In a regular expression, non-ASCII and non-printable characters other than newline are not special, and represent themselves. For example, in a locale using UTF-8 the command ‘grep 'Λ ω'’ (where the white space between ‘Λ’ and the ‘ω’ is a tab character) searches for ‘Λ’ (Unicode character U+039B GREEK CAPITAL LETTER LAMBDA), followed by a tab (U+0009 TAB), followed by ‘ω’ (U+03C9 GREEK SMALL LETTER OMEGA). Suppose you want to limit your pattern to only printable characters (or even only printable ASCII characters) to keep your script readable or portable, but you also want to match specific non-ASCII or non-null non-printable characters. If you are using the ‘-P’ (‘--perl-regexp’) option, PCREs give you several ways to do this. Otherwise, if you are using Bash, the GNU project’s shell, you can represent these characters via ANSI-C quoting. For example, the Bash commands ‘grep $'Λ\tω'’ and ‘grep $'\u039B\t\u03C9'’ both search for the same three-character string ‘Λ ω’ mentioned earlier. However, because Bash translates ANSI-C quoting before ‘grep’ sees the pattern, this technique should not be used to match printable ASCII characters; for example, ‘grep $'\u005E'’ is equivalent to ‘grep '^'’ and matches any line, not just lines containing the character ‘^’ (U+005E CIRCUMFLEX ACCENT). Since PCREs and ANSI-C quoting are GNU extensions to POSIX, portable shell scripts written in ASCII should use other methods to match specific non-ASCII characters. For example, in a UTF-8 locale the command ‘grep "$(printf '\316\233\t\317\211\n')"’ is a portable albeit hard-to-read alternative to Bash’s ‘grep $'Λ\tω'’. However, none of these techniques will let you put a null character directly into a command-line pattern; null characters can appear only in a pattern specified via the ‘-f’ (‘--file’) option.  File: grep.info, Node: Usage, Next: Performance, Prev: Regular Expressions, Up: Top 4 Usage ******* Here is an example command that invokes GNU ‘grep’: grep -i 'hello.*world' menu.h main.c This lists all lines in the files ‘menu.h’ and ‘main.c’ that contain the string ‘hello’ followed by the string ‘world’; this is because ‘.*’ matches zero or more characters within a line. *Note Regular Expressions::. The ‘-i’ option causes ‘grep’ to ignore case, causing it to match the line ‘Hello, world!’, which it would not otherwise match. Here is a more complex example, showing the location and contents of any line containing ‘f’ and ending in ‘.c’, within all files in the current directory whose names start with non-‘.’, contain ‘g’, and end in ‘.h’. The ‘-n’ option outputs line numbers, the ‘--’ argument treats any later arguments as file names not options even if ‘*g*.h’ expands to a file name that starts with ‘-’, and the empty file ‘/dev/null’ causes file names to be output even if only one file name happens to be of the form ‘*g*.h’. grep -n -- 'f.*\.c$' *g*.h /dev/null Note that the regular expression syntax used in the pattern differs from the globbing syntax that the shell uses to match file names. *Note Invoking::, for more details about how to invoke ‘grep’. Here are some common questions and answers about ‘grep’ usage. 1. How can I list just the names of matching files? grep -l 'main' test-*.c lists names of ‘test-*.c’ files in the current directory whose contents mention ‘main’. 2. How do I search directories recursively? grep -r 'hello' /home/gigi searches for ‘hello’ in all files under the ‘/home/gigi’ directory. For more control over which files are searched, use ‘find’ and ‘grep’. For example, the following command searches only C files: find /home/gigi -name '*.c' ! -type d \ -exec grep -H 'hello' '{}' + This differs from the command: grep -H 'hello' /home/gigi/*.c which merely looks for ‘hello’ in non-hidden C files in ‘/home/gigi’ whose names end in ‘.c’. The ‘find’ command line above is more similar to the command: grep -r --include='*.c' 'hello' /home/gigi 3. What if a pattern or file has a leading ‘-’? grep -- '--cut here--' * searches for all lines matching ‘--cut here--’. Without ‘--’, ‘grep’ would attempt to parse ‘--cut here--’ as a list of options, and there would be similar problems with any file names beginning with ‘-’. Alternatively, you can prevent misinterpretation of leading ‘-’ by using ‘-e’ for patterns and leading ‘./’ for files: grep -e '--cut here--' ./* 4. Suppose I want to search for a whole word, not a part of a word? grep -w 'hello' test*.log searches only for instances of ‘hello’ that are entire words; it does not match ‘Othello’. For more control, use ‘\<’ and ‘\>’ to match the start and end of words. For example: grep 'hello\>' test*.log searches only for words ending in ‘hello’, so it matches the word ‘Othello’. 5. How do I output context around the matching lines? grep -C 2 'hello' test*.log prints two lines of context around each matching line. 6. How do I force ‘grep’ to print the name of the file? Append ‘/dev/null’: grep 'eli' /etc/passwd /dev/null gets you: /etc/passwd:eli:x:2098:1000:Eli Smith:/home/eli:/bin/bash Alternatively, use ‘-H’, which is a GNU extension: grep -H 'eli' /etc/passwd 7. Why do people use strange regular expressions on ‘ps’ output? ps -ef | grep '[c]ron' If the pattern had been written without the square brackets, it would have matched not only the ‘ps’ output line for ‘cron’, but also the ‘ps’ output line for ‘grep’. Note that on some platforms, ‘ps’ limits the output to the width of the screen; ‘grep’ does not have any limit on the length of a line except the available memory. 8. Why does ‘grep’ report “Binary file matchesâ€? If ‘grep’ listed all matching “lines†from a binary file, it would probably generate output that is not useful, and it might even muck up your display. So GNU ‘grep’ suppresses output from files that appear to be binary files. To force GNU ‘grep’ to output lines even from files that appear to be binary, use the ‘-a’ or ‘--binary-files=text’ option. To eliminate the “Binary file matches†messages, use the ‘-I’ or ‘--binary-files=without-match’ option, or the ‘-s’ or ‘--no-messages’ option. 9. Why doesn’t ‘grep -lv’ print non-matching file names? ‘grep -lv’ lists the names of all files containing one or more lines that do not match. To list the names of all files that contain no matching lines, use the ‘-L’ or ‘--files-without-match’ option. 10. I can do “OR†with ‘|’, but what about “ANDâ€? grep 'paul' /etc/motd | grep 'franc,ois' finds all lines that contain both ‘paul’ and ‘franc,ois’. 11. Why does the empty pattern match every input line? The ‘grep’ command searches for lines that contain strings that match a pattern. Every line contains the empty string, so an empty pattern causes ‘grep’ to find a match on each line. It is not the only such pattern: ‘^’, ‘$’, and many other patterns cause ‘grep’ to match every line. To match empty lines, use the pattern ‘^$’. To match blank lines, use the pattern ‘^[[:blank:]]*$’. To match no lines at all, use the command ‘grep -f /dev/null’. 12. How can I search in both standard input and in files? Use the special file name ‘-’: cat /etc/passwd | grep 'alain' - /etc/motd 13. Why is this back-reference failing? echo 'ba' | grep -E '(a)\1|b\1' This outputs an error message, because the second ‘\1’ has nothing to refer back to, meaning it will never match anything. 14. How can I match across lines? Standard grep cannot do this, as it is fundamentally line-based. Therefore, merely using the ‘[:space:]’ character class does not match newlines in the way you might expect. With the GNU ‘grep’ option ‘-z’ (‘--null-data’), each input and output “line†is null-terminated; *note Other Options::. Thus, you can match newlines in the input, but typically if there is a match the entire input is output, so this usage is often combined with output-suppressing options like ‘-q’, e.g.: printf 'foo\nbar\n' | grep -z -q 'foo[[:space:]]\+bar' If this does not suffice, you can transform the input before giving it to ‘grep’, or turn to ‘awk’, ‘sed’, ‘perl’, or many other utilities that are designed to operate across lines. 15. What do ‘grep’, ‘fgrep’, and ‘egrep’ stand for? The name ‘grep’ comes from the way line editing was done on Unix. For example, ‘ed’ uses the following syntax to print a list of matching lines on the screen: global/regular expression/print g/re/p ‘fgrep’ stands for Fixed ‘grep’; ‘egrep’ stands for Extended ‘grep’.  File: grep.info, Node: Performance, Next: Reporting Bugs, Prev: Usage, Up: Top 5 Performance ************* Typically ‘grep’ is an efficient way to search text. However, it can be quite slow in some cases, and it can search large files where even minor performance tweaking can help significantly. Although the algorithm used by ‘grep’ is an implementation detail that can change from release to release, understanding its basic strengths and weaknesses can help you improve its performance. The ‘grep’ command operates partly via a set of automata that are designed for efficiency, and partly via a slower matcher that takes over when the fast matchers run into unusual features like back-references. When feasible, the Boyer–Moore fast string searching algorithm is used to match a single fixed pattern, and the Aho–Corasick algorithm is used to match multiple fixed patterns. Generally speaking ‘grep’ operates more efficiently in single-byte locales, since it can avoid the special processing needed for multi-byte characters. If your patterns will work just as well that way, setting ‘LC_ALL’ to a single-byte locale can help performance considerably. Setting ‘LC_ALL='C'’ can be particularly efficient, as ‘grep’ is tuned for that locale. Outside the ‘C’ locale, case-insensitive search, and search for bracket expressions like ‘[a-z]’ and ‘[[=a=]b]’, can be surprisingly inefficient due to difficulties in fast portable access to concepts like multi-character collating elements. A back-reference such as ‘\1’ can hurt performance significantly in some cases, since back-references cannot in general be implemented via a finite state automaton, and instead trigger a backtracking algorithm that can be quite inefficient. For example, although the pattern ‘^(.*)\1{14}(.*)\2{13}$’ matches only lines whose lengths can be written as a sum 15x + 14y for nonnegative integers x and y, the pattern matcher does not perform linear Diophantine analysis and instead backtracks through all possible matching strings, using an algorithm that is exponential in the worst case. On some operating systems that support files with holes—large regions of zeros that are not physically present on secondary storage—‘grep’ can skip over the holes efficiently without needing to read the zeros. This optimization is not available if the ‘-a’ (‘--binary-files=text’) option is used (*note File and Directory Selection::), unless the ‘-z’ (‘--null-data’) option is also used (*note Other Options::). For more about the algorithms used by ‘grep’ and about related string matching algorithms, see: • Aho AV. Algorithms for finding patterns in strings. In: van Leeuwen J. _Handbook of Theoretical Computer Science_, vol. A. New York: Elsevier; 1990. p. 255–300. This surveys classic string matching algorithms, some of which are used by ‘grep’. • Aho AV, Corasick MJ. Efficient string matching: an aid to bibliographic search. _CACM_. 1975;18(6):333–40. <https://dx.doi.org/10.1145/360825.360855>. This introduces the Aho–Corasick algorithm. • Boyer RS, Moore JS. A fast string searching algorithm. _CACM_. 1977;20(10):762–72. <https://dx.doi.org/10.1145/359842.359859>. This introduces the Boyer–Moore algorithm. • Faro S, Lecroq T. The exact online string matching problem: a review of the most recent results. _ACM Comput Surv_. 2013;45(2):13. <https://dx.doi.org/10.1145/2431211.2431212>. This surveys string matching algorithms that might help improve the performance of ‘grep’ in the future.  File: grep.info, Node: Reporting Bugs, Next: Copying, Prev: Performance, Up: Top 6 Reporting bugs **************** Bug reports can be found at the GNU bug report logs for ‘grep’ (https://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep). If you find a bug not listed there, please email it to <bug-grep@gnu.org> to create a new bug report. * Menu: * Known Bugs::  File: grep.info, Node: Known Bugs, Up: Reporting Bugs 6.1 Known Bugs ============== Large repetition counts in the ‘{n,m}’ construct may cause ‘grep’ to use lots of memory. In addition, certain other obscure regular expressions require exponential time and space, and may cause ‘grep’ to run out of memory. Back-references can greatly slow down matching, as they can generate exponentially many matching possibilities that can consume both time and memory to explore. Also, the POSIX specification for back-references is at times unclear. Furthermore, many regular expression implementations have back-reference bugs that can cause programs to return incorrect answers or even crash, and fixing these bugs has often been low-priority: for example, as of 2021 the GNU C library bug database (https://sourceware.org/bugzilla/) contained back-reference bugs 52, 10844, 11053, 24269 and 25322, with little sign of forthcoming fixes. Luckily, back-references are rarely useful and it should be little trouble to avoid them in practical applications.  File: grep.info, Node: Copying, Next: Index, Prev: Reporting Bugs, Up: Top 7 Copying ********* GNU ‘grep’ is licensed under the GNU GPL, which makes it “free softwareâ€. The “free†in “free software†refers to liberty, not price. As some GNU project advocates like to point out, think of “free speech†rather than “free beerâ€. In short, you have the right (freedom) to run and change ‘grep’ and distribute it to other people, and—if you want—charge money for doing either. The important restriction is that you have to grant your recipients the same rights and impose the same restrictions. This general method of licensing software is sometimes called “open sourceâ€. The GNU project prefers the term “free software†for reasons outlined at <https://www.gnu.org/philosophy/open-source-misses-the-point.html>. This manual is free documentation in the same sense. The documentation license is included below. The license for the program is available with the source code, or at <https://www.gnu.org/licenses/gpl.html>. * Menu: * GNU Free Documentation License::  File: grep.info, Node: GNU Free Documentation License, Up: Copying 7.1 GNU Free Documentation License ================================== Version 1.3, 3 November 2008 Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document “free†in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of “copyleftâ€, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Documentâ€, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “youâ€. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A “Modified Version†of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A “Secondary Section†is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The “Invariant Sections†are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The “Cover Texts†are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A “Transparent†copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent†is called “Opaqueâ€. Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The “Title Page†means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page†means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text. The “publisher†means any person or entity that distributes copies of the Document to the public. A section “Entitled XYZ†means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgementsâ€, “Dedicationsâ€, “Endorsementsâ€, or “Historyâ€.) To “Preserve the Title†of such a section when you modify the Document means that it remains a section “Entitled XYZ†according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled “Historyâ€, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History†in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History†section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled “Acknowledgements†or “Dedicationsâ€, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled “Endorsementsâ€. Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled “Endorsements†or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles. You may add a section Entitled “Endorsementsâ€, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled “History†in the various original documents, forming one section Entitled “Historyâ€; likewise combine any sections Entitled “Acknowledgementsâ€, and any sections Entitled “Dedicationsâ€. You must delete all sections Entitled “Endorsements.†6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate†if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled “Acknowledgementsâ€, “Dedicationsâ€, or “Historyâ€, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See <https://www.gnu.org/licenses/>. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version†applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document. 11. RELICENSING “Massive Multiauthor Collaboration Site†(or “MMC Siteâ€) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration†(or “MMCâ€) contained in the site means any set of copyrightable works thus published on the MMC site. “CC-BY-SA†means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. “Incorporate†means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is “eligible for relicensing†if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. ADDENDUM: How to use this License for your documents ==================================================== To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (C) YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with...Texts.†line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.  File: grep.info, Node: Index, Prev: Copying, Up: Top Index ***** �[index�] * Menu: * *: Fundamental Structure. (line 22) * +: Fundamental Structure. (line 25) * --: Other Options. (line 7) * --after-context: Context Line Control. (line 15) * --basic-regexp: grep Programs. (line 15) * --before-context: Context Line Control. (line 19) * --binary: Other Options. (line 22) * --binary-files: File and Directory Selection. (line 12) * --byte-offset: Output Line Prefix Control. (line 12) * --color: General Output Control. (line 14) * --colour: General Output Control. (line 14) * --context: Context Line Control. (line 24) * --count: General Output Control. (line 8) * --dereference-recursive: File and Directory Selection. (line 113) * --devices: File and Directory Selection. (line 51) * --directories: File and Directory Selection. (line 62) * --exclude: File and Directory Selection. (line 73) * --exclude-dir: File and Directory Selection. (line 87) * --exclude-from: File and Directory Selection. (line 83) * --extended-regexp: grep Programs. (line 20) * --file: Matching Control. (line 17) * --files-with-matches: General Output Control. (line 34) * --files-without-match: General Output Control. (line 29) * --fixed-strings: grep Programs. (line 25) * --group-separator: Context Line Control. (line 27) * --group-separator <1>: Context Line Control. (line 31) * --help: Generic Program Information. (line 7) * --ignore-case: Matching Control. (line 26) * --include: File and Directory Selection. (line 97) * --initial-tab: Output Line Prefix Control. (line 41) * --invert-match: Matching Control. (line 51) * --label: Output Line Prefix Control. (line 28) * --line-buffered: Other Options. (line 13) * --line-number: Output Line Prefix Control. (line 36) * --line-regexp: Matching Control. (line 73) * --max-count: General Output Control. (line 40) * --no-filename: Output Line Prefix Control. (line 23) * --no-ignore-case: Matching Control. (line 44) * --no-messages: General Output Control. (line 85) * --null: Output Line Prefix Control. (line 50) * --null-data: Other Options. (line 43) * --only-matching: General Output Control. (line 70) * --perl-regexp: grep Programs. (line 30) * --quiet: General Output Control. (line 78) * --recursive: File and Directory Selection. (line 105) * --regexp=PATTERNS: Matching Control. (line 8) * --silent: General Output Control. (line 78) * --text: File and Directory Selection. (line 8) * --version: Generic Program Information. (line 12) * --with-filename: Output Line Prefix Control. (line 18) * --word-regexp: Matching Control. (line 56) * -A: Context Line Control. (line 15) * -a: File and Directory Selection. (line 8) * -b: Output Line Prefix Control. (line 12) * -B: Context Line Control. (line 19) * -c: General Output Control. (line 8) * -C: Context Line Control. (line 24) * -D: File and Directory Selection. (line 51) * -d: File and Directory Selection. (line 62) * -e: Matching Control. (line 8) * -E: grep Programs. (line 20) * -f: Matching Control. (line 17) * -F: grep Programs. (line 25) * -G: grep Programs. (line 15) * -H: Output Line Prefix Control. (line 18) * -h: Output Line Prefix Control. (line 23) * -i: Matching Control. (line 26) * -L: General Output Control. (line 29) * -l: General Output Control. (line 34) * -m: General Output Control. (line 40) * -n: Output Line Prefix Control. (line 36) * -NUM: Context Line Control. (line 24) * -o: General Output Control. (line 70) * -P: grep Programs. (line 30) * -q: General Output Control. (line 78) * -r: File and Directory Selection. (line 105) * -R: File and Directory Selection. (line 113) * -s: General Output Control. (line 85) * -T: Output Line Prefix Control. (line 41) * -U: Other Options. (line 22) * -V: Generic Program Information. (line 12) * -v: Matching Control. (line 51) * -w: Matching Control. (line 56) * -x: Matching Control. (line 73) * -y: Matching Control. (line 26) * -Z: Output Line Prefix Control. (line 50) * -z: Other Options. (line 43) * .: Fundamental Structure. (line 11) * ?: Fundamental Structure. (line 19) * _N_GNU_nonoption_argv_flags_ environment variable: Environment Variables. (line 178) * {,M}: Fundamental Structure. (line 34) * {N,M}: Fundamental Structure. (line 38) * {N,}: Fundamental Structure. (line 31) * {N}: Fundamental Structure. (line 28) * after context: Context Line Control. (line 15) * alnum character class: Character Classes and Bracket Expressions. (line 31) * alpha character class: Character Classes and Bracket Expressions. (line 36) * alphabetic characters: Character Classes and Bracket Expressions. (line 36) * alphanumeric characters: Character Classes and Bracket Expressions. (line 31) * anchoring: Anchoring. (line 6) * asterisk: Fundamental Structure. (line 22) * back-reference: Back-references and Subexpressions. (line 6) * back-references: Performance. (line 32) * backslash: The Backslash Character and Special Expressions. (line 6) * basic regular expressions: Basic vs Extended. (line 6) * before context: Context Line Control. (line 19) * binary files: File and Directory Selection. (line 8) * binary files <1>: File and Directory Selection. (line 12) * binary I/O: Other Options. (line 22) * blank character class: Character Classes and Bracket Expressions. (line 41) * blank characters: Character Classes and Bracket Expressions. (line 41) * bn GREP_COLORS capability: Environment Variables. (line 121) * braces, first argument omitted: Fundamental Structure. (line 34) * braces, one argument: Fundamental Structure. (line 28) * braces, second argument omitted: Fundamental Structure. (line 31) * braces, two arguments: Fundamental Structure. (line 38) * bracket expression: Character Classes and Bracket Expressions. (line 6) * Bugs, known: Known Bugs. (line 6) * bugs, reporting: Reporting Bugs. (line 6) * byte offset: Output Line Prefix Control. (line 12) * case insensitive search: Matching Control. (line 26) * case insensitive search <1>: Performance. (line 27) * changing name of standard input: Output Line Prefix Control. (line 28) * character class: Character Classes and Bracket Expressions. (line 6) * character classes: Character Classes and Bracket Expressions. (line 30) * character encoding: Character Encoding. (line 6) * character type: Environment Variables. (line 148) * classes of characters: Character Classes and Bracket Expressions. (line 30) * cntrl character class: Character Classes and Bracket Expressions. (line 44) * context lines: General Output Control. (line 62) * context lines <1>: Context Line Control. (line 6) * context lines <2>: Context Line Control. (line 24) * context lines, after match: Context Line Control. (line 15) * context lines, before match: Context Line Control. (line 19) * control characters: Character Classes and Bracket Expressions. (line 44) * copying: Copying. (line 6) * counting lines: General Output Control. (line 8) * cx GREP_COLORS capability: Environment Variables. (line 72) * device search: File and Directory Selection. (line 51) * digit character class: Character Classes and Bracket Expressions. (line 49) * digit characters: Character Classes and Bracket Expressions. (line 49) * directory search: File and Directory Selection. (line 62) * dot: Fundamental Structure. (line 11) * encoding error: Environment Variables. (line 155) * environment variables: Environment Variables. (line 44) * exclude directories: File and Directory Selection. (line 87) * exclude files: File and Directory Selection. (line 73) * exclude files <1>: File and Directory Selection. (line 83) * exit status: Exit Status. (line 6) * FAQ about grep usage: Usage. (line 32) * files which don’t match: General Output Control. (line 29) * fn GREP_COLORS capability: Environment Variables. (line 111) * fn GREP_COLORS capability <1>: Environment Variables. (line 126) * graph character class: Character Classes and Bracket Expressions. (line 52) * graphic characters: Character Classes and Bracket Expressions. (line 52) * grep programs: grep Programs. (line 6) * GREP_COLOR environment variable: Environment Variables. (line 45) * GREP_COLORS environment variable: Environment Variables. (line 56) * group separator: Context Line Control. (line 27) * group separator <1>: Context Line Control. (line 31) * hexadecimal digits: Character Classes and Bracket Expressions. (line 76) * highlight markers: Environment Variables. (line 45) * highlight markers <1>: Environment Variables. (line 56) * highlight, color, colour: General Output Control. (line 14) * holes in files: Performance. (line 42) * include files: File and Directory Selection. (line 97) * interval expressions: Fundamental Structure. (line 14) * interval expressions <1>: Basic vs Extended. (line 27) * invert matching: Matching Control. (line 51) * LANG environment variable: Environment Variables. (line 9) * LANG environment variable <1>: Environment Variables. (line 148) * LANG environment variable <2>: Environment Variables. (line 155) * LANG environment variable <3>: Environment Variables. (line 164) * LANGUAGE environment variable: Environment Variables. (line 9) * LANGUAGE environment variable <1>: Environment Variables. (line 164) * language of messages: Environment Variables. (line 164) * LC_ALL environment variable: Environment Variables. (line 9) * LC_ALL environment variable <1>: Environment Variables. (line 148) * LC_ALL environment variable <2>: Environment Variables. (line 155) * LC_ALL environment variable <3>: Environment Variables. (line 164) * LC_COLLATE environment variable: Environment Variables. (line 148) * LC_CTYPE environment variable: Environment Variables. (line 155) * LC_MESSAGES environment variable: Environment Variables. (line 9) * LC_MESSAGES environment variable <1>: Environment Variables. (line 164) * line buffering: Other Options. (line 13) * line numbering: Output Line Prefix Control. (line 36) * ln GREP_COLORS capability: Environment Variables. (line 116) * locales: Performance. (line 20) * lower character class: Character Classes and Bracket Expressions. (line 55) * lower-case letters: Character Classes and Bracket Expressions. (line 55) * match expression at most M times: Fundamental Structure. (line 34) * match expression at most once: Fundamental Structure. (line 19) * match expression from N to M times: Fundamental Structure. (line 38) * match expression N or more times: Fundamental Structure. (line 31) * match expression N times: Fundamental Structure. (line 28) * match expression one or more times: Fundamental Structure. (line 25) * match expression zero or more times: Fundamental Structure. (line 22) * match the whole line: Matching Control. (line 73) * matching basic regular expressions: grep Programs. (line 15) * matching extended regular expressions: grep Programs. (line 20) * matching fixed strings: grep Programs. (line 25) * matching Perl-compatible regular expressions: grep Programs. (line 30) * matching whole words: Matching Control. (line 56) * max-count: General Output Control. (line 40) * mc GREP_COLORS capability: Environment Variables. (line 103) * message language: Environment Variables. (line 164) * ms GREP_COLORS capability: Environment Variables. (line 95) * MS-Windows binary I/O: Other Options. (line 22) * mt GREP_COLORS capability: Environment Variables. (line 87) * names of matching files: General Output Control. (line 34) * national language support: Environment Variables. (line 148) * national language support <1>: Environment Variables. (line 164) * ne GREP_COLORS capability: Environment Variables. (line 133) * NLS: Environment Variables. (line 148) * no filename prefix: Output Line Prefix Control. (line 23) * non-ASCII matching: Matching Non-ASCII. (line 6) * non-printable matching: Matching Non-ASCII. (line 6) * null character: Environment Variables. (line 155) * numeric characters: Character Classes and Bracket Expressions. (line 49) * only matching: General Output Control. (line 70) * option delimiter: Other Options. (line 7) * ordinary characters: Fundamental Structure. (line 6) * patterns from file: Matching Control. (line 17) * patterns option: Matching Control. (line 8) * performance: Performance. (line 6) * period: Fundamental Structure. (line 11) * plus sign: Fundamental Structure. (line 25) * POSIXLY_CORRECT environment variable: Environment Variables. (line 169) * print character class: Character Classes and Bracket Expressions. (line 59) * print non-matching lines: Matching Control. (line 51) * printable characters: Character Classes and Bracket Expressions. (line 59) * punct character class: Character Classes and Bracket Expressions. (line 62) * punctuation characters: Character Classes and Bracket Expressions. (line 62) * question mark: Fundamental Structure. (line 19) * quiet, silent: General Output Control. (line 78) * range expression: Character Classes and Bracket Expressions. (line 14) * recursive search: File and Directory Selection. (line 105) * recursive search <1>: File and Directory Selection. (line 113) * regular expressions: Regular Expressions. (line 6) * return status: Exit Status. (line 6) * rv GREP_COLORS capability: Environment Variables. (line 81) * searching directory trees: File and Directory Selection. (line 73) * searching directory trees <1>: File and Directory Selection. (line 83) * searching directory trees <2>: File and Directory Selection. (line 97) * searching directory trees <3>: File and Directory Selection. (line 105) * searching directory trees <4>: File and Directory Selection. (line 113) * searching for patterns: Introduction. (line 6) * sl GREP_COLORS capability: Environment Variables. (line 64) * space character class: Character Classes and Bracket Expressions. (line 67) * space characters: Character Classes and Bracket Expressions. (line 67) * special characters: Fundamental Structure. (line 6) * subexpression: Back-references and Subexpressions. (line 6) * suppress binary data: File and Directory Selection. (line 8) * suppress error messages: General Output Control. (line 85) * symbolic links: File and Directory Selection. (line 62) * symbolic links <1>: File and Directory Selection. (line 105) * symbolic links <2>: File and Directory Selection. (line 113) * tab-aligned content lines: Output Line Prefix Control. (line 41) * translation of message language: Environment Variables. (line 164) * upper character class: Character Classes and Bracket Expressions. (line 72) * upper-case letters: Character Classes and Bracket Expressions. (line 72) * usage summary, printing: Generic Program Information. (line 7) * usage, examples: Usage. (line 6) * using grep, Q&A: Usage. (line 32) * variants of grep: grep Programs. (line 6) * version, printing: Generic Program Information. (line 12) * whitespace characters: Character Classes and Bracket Expressions. (line 67) * with filename prefix: Output Line Prefix Control. (line 18) * xdigit character class: Character Classes and Bracket Expressions. (line 76) * xdigit class: Character Classes and Bracket Expressions. (line 76) * zero-terminated file names: Output Line Prefix Control. (line 50) * zero-terminated lines: Other Options. (line 43)  Tag Table: Node: Top773 Node: Introduction1965 Node: Invoking2708 Node: Command-line Options3551 Node: Generic Program Information4434 Node: Matching Control4908 Node: General Output Control8537 Ref: General Output Control-Footnote-112636 Node: Output Line Prefix Control12705 Node: Context Line Control15061 Node: File and Directory Selection17124 Node: Other Options22916 Node: Environment Variables25129 Node: Exit Status35125 Node: grep Programs35603 Node: Regular Expressions37234 Node: Fundamental Structure38475 Node: Character Classes and Bracket Expressions40359 Ref: invalid-bracket-expr43984 Node: The Backslash Character and Special Expressions45222 Node: Anchoring46413 Node: Back-references and Subexpressions46875 Node: Basic vs Extended47879 Node: Character Encoding49888 Node: Matching Non-ASCII51354 Node: Usage53481 Node: Performance61173 Node: Reporting Bugs64873 Node: Known Bugs65250 Node: Copying66321 Node: GNU Free Documentation License67449 Node: Index92754  End Tag Table  Local Variables: coding: utf-8 End: ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/doc/grep.texi������������������������������������������������������������������0000664�0001750�0001750�00000214363�14670377431�017054� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename grep.info @include version.texi @settitle GNU Grep @value{VERSION} @c Combine indices. @syncodeindex ky cp @syncodeindex pg cp @syncodeindex tp cp @defcodeindex op @syncodeindex op cp @syncodeindex vr cp @c %**end of header @documentencoding UTF-8 @c These two require Texinfo 5.0 or later, so use the older @c equivalent @set variables supported in 4.11 and later. @ignore @codequotebacktick on @codequoteundirected on @end ignore @set txicodequoteundirected @set txicodequotebacktick @iftex @c TeX sometimes fails to hyphenate, so help it here. @hyphenation{spec-i-fied} @end iftex @copying This manual is for @command{grep}, a pattern matching engine. Copyright @copyright{} 1999--2002, 2005, 2008--2021 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. @end quotation @end copying @dircategory Text creation and manipulation @direntry * grep: (grep). Print lines that match patterns. @end direntry @titlepage @title GNU Grep: Print lines that match patterns @subtitle version @value{VERSION}, @value{UPDATED} @author Alain Magloire et al. @page @vskip 0pt plus 1filll @insertcopying @end titlepage @contents @ifnottex @node Top @top grep @command{grep} prints lines that contain a match for one or more patterns. This manual is for version @value{VERSION} of GNU Grep. @insertcopying @end ifnottex @menu * Introduction:: Introduction. * Invoking:: Command-line options, environment, exit status. * Regular Expressions:: Regular Expressions. * Usage:: Examples. * Performance:: Performance tuning. * Reporting Bugs:: Reporting Bugs. * Copying:: License terms for this manual. * Index:: Combined index. @end menu @node Introduction @chapter Introduction @cindex searching for patterns Given one or more patterns, @command{grep} searches input files for matches to the patterns. When it finds a match in a line, it copies the line to standard output (by default), or produces whatever other sort of output you have requested with options. Though @command{grep} expects to do the matching on text, it has no limits on input line length other than available memory, and it can match arbitrary characters within a line. If the final byte of an input file is not a newline, @command{grep} silently supplies one. Since newline is also a separator for the list of patterns, there is no way to match newline characters in a text. @node Invoking @chapter Invoking @command{grep} The general synopsis of the @command{grep} command line is @example grep [@var{option}...] [@var{patterns}] [@var{file}...] @end example @noindent There can be zero or more @var{option} arguments, and zero or more @var{file} arguments. The @var{patterns} argument contains one or more patterns separated by newlines, and is omitted when patterns are given via the @samp{-e@ @var{patterns}} or @samp{-f@ @var{file}} options. Typically @var{patterns} should be quoted when @command{grep} is used in a shell command. @menu * Command-line Options:: Short and long names, grouped by category. * Environment Variables:: POSIX, GNU generic, and GNU grep specific. * Exit Status:: Exit status returned by @command{grep}. * grep Programs:: @command{grep} programs. @end menu @node Command-line Options @section Command-line Options @command{grep} comes with a rich set of options: some from POSIX and some being GNU extensions. Long option names are always a GNU extension, even for options that are from POSIX specifications. Options that are specified by POSIX, under their short names, are explicitly marked as such to facilitate POSIX-portable programming. A few option names are provided for compatibility with older or more exotic implementations. @menu * Generic Program Information:: * Matching Control:: * General Output Control:: * Output Line Prefix Control:: * Context Line Control:: * File and Directory Selection:: * Other Options:: @end menu Several additional options control which variant of the @command{grep} matching engine is used. @xref{grep Programs}. @node Generic Program Information @subsection Generic Program Information @table @option @item --help @opindex --help @cindex usage summary, printing Print a usage message briefly summarizing the command-line options and the bug-reporting address, then exit. @item -V @itemx --version @opindex -V @opindex --version @cindex version, printing Print the version number of @command{grep} to the standard output stream. This version number should be included in all bug reports. @end table @node Matching Control @subsection Matching Control @table @option @item -e @var{patterns} @itemx --regexp=@var{patterns} @opindex -e @opindex --regexp=@var{patterns} @cindex patterns option Use @var{patterns} as one or more patterns; newlines within @var{patterns} separate each pattern from the next. If this option is used multiple times or is combined with the @option{-f} (@option{--file}) option, search for all patterns given. Typically @var{patterns} should be quoted when @command{grep} is used in a shell command. (@option{-e} is specified by POSIX.) @item -f @var{file} @itemx --file=@var{file} @opindex -f @opindex --file @cindex patterns from file Obtain patterns from @var{file}, one per line. If this option is used multiple times or is combined with the @option{-e} (@option{--regexp}) option, search for all patterns given. The empty file contains zero patterns, and therefore matches nothing. (@option{-f} is specified by POSIX.) @item -i @itemx -y @itemx --ignore-case @opindex -i @opindex -y @opindex --ignore-case @cindex case insensitive search Ignore case distinctions in patterns and input data, so that characters that differ only in case match each other. Although this is straightforward when letters differ in case only via lowercase-uppercase pairs, the behavior is unspecified in other situations. For example, uppercase ``S'' has an unusual lowercase counterpart ``Å¿'' (Unicode character U+017F, LATIN SMALL LETTER LONG S) in many locales, and it is unspecified whether this unusual character matches ``S'' or ``s'' even though uppercasing it yields ``S''. Another example: the lowercase German letter ``ß'' (U+00DF, LATIN SMALL LETTER SHARP S) is normally capitalized as the two-character string ``SS'' but it does not match ``SS'', and it might not match the uppercase letter ``ẞ'' (U+1E9E, LATIN CAPITAL LETTER SHARP S) even though lowercasing the latter yields the former. @option{-y} is an obsolete synonym that is provided for compatibility. (@option{-i} is specified by POSIX.) @item --no-ignore-case @opindex --no-ignore-case Do not ignore case distinctions in patterns and input data. This is the default. This option is useful for passing to shell scripts that already use @option{-i}, in order to cancel its effects because the two options override each other. @item -v @itemx --invert-match @opindex -v @opindex --invert-match @cindex invert matching @cindex print non-matching lines Invert the sense of matching, to select non-matching lines. (@option{-v} is specified by POSIX.) @item -w @itemx --word-regexp @opindex -w @opindex --word-regexp @cindex matching whole words Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word constituent characters are letters, digits, and the underscore. This option has no effect if @option{-x} is also specified. Because the @option{-w} option can match a substring that does not begin and end with word constituents, it differs from surrounding a regular expression with @samp{\<} and @samp{\>}. For example, although @samp{grep -w @@} matches a line containing only @samp{@@}, @samp{grep '\<@@\>'} cannot match any line because @samp{@@} is not a word constituent. @xref{The Backslash Character and Special Expressions}. @item -x @itemx --line-regexp @opindex -x @opindex --line-regexp @cindex match the whole line Select only those matches that exactly match the whole line. For regular expression patterns, this is like parenthesizing each pattern and then surrounding it with @samp{^} and @samp{$}. (@option{-x} is specified by POSIX.) @end table @node General Output Control @subsection General Output Control @table @option @item -c @itemx --count @opindex -c @opindex --count @cindex counting lines Suppress normal output; instead print a count of matching lines for each input file. With the @option{-v} (@option{--invert-match}) option, count non-matching lines. (@option{-c} is specified by POSIX.) @item --color[=@var{WHEN}] @itemx --colour[=@var{WHEN}] @opindex --color @opindex --colour @cindex highlight, color, colour Surround the matched (non-empty) strings, matching lines, context lines, file names, line numbers, byte offsets, and separators (for fields and groups of context lines) with escape sequences to display them in color on the terminal. The colors are defined by the environment variable @env{GREP_COLORS} and default to @samp{ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36} for bold red matched text, magenta file names, green line numbers, green byte offsets, cyan separators, and default terminal colors otherwise. The deprecated environment variable @env{GREP_COLOR} is still supported, but its setting does not have priority; it defaults to @samp{01;31} (bold red) which only covers the color for matched text. @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}. @item -L @itemx --files-without-match @opindex -L @opindex --files-without-match @cindex files which don't match Suppress normal output; instead print the name of each input file from which no output would normally have been printed. @item -l @itemx --files-with-matches @opindex -l @opindex --files-with-matches @cindex names of matching files Suppress normal output; instead print the name of each input file from which output would normally have been printed. Scanning each input file stops upon first match. (@option{-l} is specified by POSIX.) @item -m @var{num} @itemx --max-count=@var{num} @opindex -m @opindex --max-count @cindex max-count Stop after the first @var{num} selected lines. If the input is standard input from a regular file, and @var{num} selected lines are output, @command{grep} ensures that the standard input is positioned just after the last selected line before exiting, regardless of the presence of trailing context lines. This enables a calling process to resume a search. For example, the following shell script makes use of it: @example while grep -m 1 'PATTERN' do echo xxxx done < FILE @end example But the following probably will not work because a pipe is not a regular file: @example # This probably will not work. cat FILE | while grep -m 1 'PATTERN' do echo xxxx done @end example @cindex context lines When @command{grep} stops after @var{num} selected lines, it outputs any trailing context lines. When the @option{-c} or @option{--count} option is also used, @command{grep} does not output a count greater than @var{num}. When the @option{-v} or @option{--invert-match} option is also used, @command{grep} stops after outputting @var{num} non-matching lines. @item -o @itemx --only-matching @opindex -o @opindex --only-matching @cindex only matching Print only the matched (non-empty) parts of matching lines, with each such part on a separate output line. Output lines use the same delimiters as input, and delimiters are null bytes if @option{-z} (@option{--null-data}) is also used (@pxref{Other Options}). @item -q @itemx --quiet @itemx --silent @opindex -q @opindex --quiet @opindex --silent @cindex quiet, silent Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. Also see the @option{-s} or @option{--no-messages} option. (@option{-q} is specified by POSIX.) @item -s @itemx --no-messages @opindex -s @opindex --no-messages @cindex suppress error messages Suppress error messages about nonexistent or unreadable files. Portability note: unlike GNU @command{grep}, 7th Edition Unix @command{grep} did not conform to POSIX, because it lacked @option{-q} and its @option{-s} option behaved like GNU @command{grep}'s @option{-q} option.@footnote{Of course, 7th Edition Unix predated POSIX by several years!} USG-style @command{grep} also lacked @option{-q} but its @option{-s} option behaved like GNU @command{grep}'s. Portable shell scripts should avoid both @option{-q} and @option{-s} and should redirect standard and error output to @file{/dev/null} instead. (@option{-s} is specified by POSIX.) @end table @node Output Line Prefix Control @subsection Output Line Prefix Control When several prefix fields are to be output, the order is always file name, line number, and byte offset, regardless of the order in which these options were specified. @table @option @item -b @itemx --byte-offset @opindex -b @opindex --byte-offset @cindex byte offset Print the 0-based byte offset within the input file before each line of output. If @option{-o} (@option{--only-matching}) is specified, print the offset of the matching part itself. @item -H @itemx --with-filename @opindex -H @opindex --with-filename @cindex with filename prefix Print the file name for each match. This is the default when there is more than one file to search. @item -h @itemx --no-filename @opindex -h @opindex --no-filename @cindex no filename prefix Suppress the prefixing of file names on output. This is the default when there is only one file (or only standard input) to search. @item --label=@var{LABEL} @opindex --label @cindex changing name of standard input Display input actually coming from standard input as input coming from file @var{LABEL}. This can be useful for commands that transform a file's contents before searching; e.g.: @example gzip -cd foo.gz | grep --label=foo -H 'some pattern' @end example @item -n @itemx --line-number @opindex -n @opindex --line-number @cindex line numbering Prefix each line of output with the 1-based line number within its input file. (@option{-n} is specified by POSIX.) @item -T @itemx --initial-tab @opindex -T @opindex --initial-tab @cindex tab-aligned content lines Make sure that the first character of actual line content lies on a tab stop, so that the alignment of tabs looks normal. This is useful with options that prefix their output to the actual content: @option{-H}, @option{-n}, and @option{-b}. This may also prepend spaces to output line numbers and byte offsets so that lines from a single file all start at the same column. @item -Z @itemx --null @opindex -Z @opindex --null @cindex zero-terminated file names Output a zero byte (the ASCII NUL character) instead of the character that normally follows a file name. For example, @samp{grep -lZ} outputs a zero byte after each file name instead of the usual newline. This option makes the output unambiguous, even in the presence of file names containing unusual characters like newlines. This option can be used with commands like @samp{find -print0}, @samp{perl -0}, @samp{sort -z}, and @samp{xargs -0} to process arbitrary file names, even those that contain newline characters. @end table @node Context Line Control @subsection Context Line Control @cindex context lines @dfn{Context lines} are non-matching lines that are near a matching line. They are output only if one of the following options are used. Regardless of how these options are set, @command{grep} never outputs any given line more than once. If the @option{-o} (@option{--only-matching}) option is specified, these options have no effect and a warning is given upon their use. @table @option @item -A @var{num} @itemx --after-context=@var{num} @opindex -A @opindex --after-context @cindex after context @cindex context lines, after match Print @var{num} lines of trailing context after matching lines. @item -B @var{num} @itemx --before-context=@var{num} @opindex -B @opindex --before-context @cindex before context @cindex context lines, before match Print @var{num} lines of leading context before matching lines. @item -C @var{num} @itemx -@var{num} @itemx --context=@var{num} @opindex -C @opindex --context @opindex -@var{num} @cindex context lines Print @var{num} lines of leading and trailing output context. @item --group-separator=@var{string} @opindex --group-separator @cindex group separator When @option{-A}, @option{-B} or @option{-C} are in use, print @var{string} instead of @option{--} between groups of lines. @item --no-group-separator @opindex --group-separator @cindex group separator When @option{-A}, @option{-B} or @option{-C} are in use, do not print a separator between groups of lines. @end table Here are some points about how @command{grep} chooses the separator to print between prefix fields and line content: @itemize @bullet @item Matching lines normally use @samp{:} as a separator between prefix fields and actual line content. @item Context (i.e., non-matching) lines use @samp{-} instead. @item When context is not specified, matching lines are simply output one right after another. @item When context is specified, lines that are adjacent in the input form a group and are output one right after another, while by default a separator appears between non-adjacent groups. @item The default separator is a @samp{--} line; its presence and appearance can be changed with the options above. @item Each group may contain several matching lines when they are close enough to each other that two adjacent groups connect and can merge into a single contiguous one. @end itemize @node File and Directory Selection @subsection File and Directory Selection @table @option @item -a @itemx --text @opindex -a @opindex --text @cindex suppress binary data @cindex binary files Process a binary file as if it were text; this is equivalent to the @samp{--binary-files=text} option. @item --binary-files=@var{type} @opindex --binary-files @cindex binary files If a file's data or metadata indicate that the file contains binary data, assume that the file is of type @var{type}. Non-text bytes indicate binary data; these are either output bytes that are improperly encoded for the current locale (@pxref{Environment Variables}), or null input bytes when the @option{-z} (@option{--null-data}) option is not given (@pxref{Other Options}). By default, @var{type} is @samp{binary}, and @command{grep} suppresses output after null input binary data is discovered, and suppresses output lines that contain improperly encoded data. When some output is suppressed, @command{grep} follows any output with a one-line message saying that a binary file matches. If @var{type} is @samp{without-match}, when @command{grep} discovers null input binary data it assumes that the rest of the file does not match; this is equivalent to the @option{-I} option. If @var{type} is @samp{text}, @command{grep} processes binary data as if it were text; this is equivalent to the @option{-a} option. When @var{type} is @samp{binary}, @command{grep} may treat non-text bytes as line terminators even without the @option{-z} (@option{--null-data}) option. This means choosing @samp{binary} versus @samp{text} can affect whether a pattern matches a file. For example, when @var{type} is @samp{binary} the pattern @samp{q$} might match @samp{q} immediately followed by a null byte, even though this is not matched when @var{type} is @samp{text}. Conversely, when @var{type} is @samp{binary} the pattern @samp{.} (period) might not match a null byte. @emph{Warning:} The @option{-a} (@option{--binary-files=text}) option might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands. On the other hand, when reading files whose text encodings are unknown, it can be helpful to use @option{-a} or to set @samp{LC_ALL='C'} in the environment, in order to find more matches even if the matches are unsafe for direct display. @item -D @var{action} @itemx --devices=@var{action} @opindex -D @opindex --devices @cindex device search If an input file is a device, FIFO, or socket, use @var{action} to process it. If @var{action} is @samp{read}, all devices are read just as if they were ordinary files. If @var{action} is @samp{skip}, devices, FIFOs, and sockets are silently skipped. By default, devices are read if they are on the command line or if the @option{-R} (@option{--dereference-recursive}) option is used, and are skipped if they are encountered recursively and the @option{-r} (@option{--recursive}) option is used. This option has no effect on a file that is read via standard input. @item -d @var{action} @itemx --directories=@var{action} @opindex -d @opindex --directories @cindex directory search @cindex symbolic links If an input file is a directory, use @var{action} to process it. By default, @var{action} is @samp{read}, which means that directories are read just as if they were ordinary files (some operating systems and file systems disallow this, and will cause @command{grep} to print error messages for every directory or silently skip them). If @var{action} is @samp{skip}, directories are silently skipped. If @var{action} is @samp{recurse}, @command{grep} reads all files under each directory, recursively, following command-line symbolic links and skipping other symlinks; this is equivalent to the @option{-r} option. @item --exclude=@var{glob} @opindex --exclude @cindex exclude files @cindex searching directory trees Skip any command-line file with a name suffix that matches the pattern @var{glob}, using wildcard matching; a name suffix is either the whole name, or a trailing part that starts with a non-slash character immediately after a slash (@samp{/}) in the name. When searching recursively, skip any subfile whose base name matches @var{glob}; the base name is the part after the last slash. A pattern can use @samp{*}, @samp{?}, and @samp{[}...@samp{]} as wildcards, and @code{\} to quote a wildcard or backslash character literally. @item --exclude-from=@var{file} @opindex --exclude-from @cindex exclude files @cindex searching directory trees Skip files whose name matches any of the patterns read from @var{file} (using wildcard matching as described under @option{--exclude}). @item --exclude-dir=@var{glob} @opindex --exclude-dir @cindex exclude directories Skip any command-line directory with a name suffix that matches the pattern @var{glob}. When searching recursively, skip any subdirectory whose base name matches @var{glob}. Ignore any redundant trailing slashes in @var{glob}. @item -I Process a binary file as if it did not contain matching data; this is equivalent to the @samp{--binary-files=without-match} option. @item --include=@var{glob} @opindex --include @cindex include files @cindex searching directory trees Search only files whose name matches @var{glob}, using wildcard matching as described under @option{--exclude}. If contradictory @option{--include} and @option{--exclude} options are given, the last matching one wins. If no @option{--include} or @option{--exclude} options match, a file is included unless the first such option is @option{--include}. @item -r @itemx --recursive @opindex -r @opindex --recursive @cindex recursive search @cindex searching directory trees @cindex symbolic links For each directory operand, read and process all files in that directory, recursively. Follow symbolic links on the command line, but skip symlinks that are encountered recursively. Note that if no file operand is given, grep searches the working directory. This is the same as the @samp{--directories=recurse} option. @item -R @itemx --dereference-recursive @opindex -R @opindex --dereference-recursive @cindex recursive search @cindex searching directory trees @cindex symbolic links For each directory operand, read and process all files in that directory, recursively, following all symbolic links. @end table @node Other Options @subsection Other Options @table @option @item -- @opindex -- @cindex option delimiter Delimit the option list. Later arguments, if any, are treated as operands even if they begin with @samp{-}. For example, @samp{grep PAT -- -file1 file2} searches for the pattern PAT in the files named @file{-file1} and @file{file2}. @item --line-buffered @opindex --line-buffered @cindex line buffering Use line buffering for standard output, regardless of output device. By default, standard output is line buffered for interactive devices, and is fully buffered otherwise. With full buffering, the output buffer is flushed when full; with line buffering, the buffer is also flushed after every output line. The buffer size is system dependent. @item -U @itemx --binary @opindex -U @opindex --binary @cindex MS-Windows binary I/O @cindex binary I/O On platforms that distinguish between text and binary I/O, use the latter when reading and writing files other than the user's terminal, so that all input bytes are read and written as-is. This overrides the default behavior where @command{grep} follows the operating system's advice whether to use text or binary I/O@. On MS-Windows when @command{grep} uses text I/O it reads a carriage return--newline pair as a newline and a Control-Z as end-of-file, and it writes a newline as a carriage return--newline pair. When using text I/O @option{--byte-offset} (@option{-b}) counts and @option{--binary-files} heuristics apply to input data after text-I/O processing. Also, the @option{--binary-files} heuristics need not agree with the @option{--binary} option; that is, they may treat the data as text even if @option{--binary} is given, or vice versa. @xref{File and Directory Selection}. This option has no effect on GNU and other POSIX-compatible platforms, which do not distinguish text from binary I/O. @item -z @itemx --null-data @opindex -z @opindex --null-data @cindex zero-terminated lines Treat input and output data as sequences of lines, each terminated by a zero byte (the ASCII NUL character) instead of a newline. Like the @option{-Z} or @option{--null} option, this option can be used with commands like @samp{sort -z} to process arbitrary file names. @end table @node Environment Variables @section Environment Variables The behavior of @command{grep} is affected by the following environment variables. @vindex LANGUAGE @r{environment variable} @vindex LC_ALL @r{environment variable} @vindex LC_MESSAGES @r{environment variable} @vindex LANG @r{environment variable} The locale for category @w{@code{LC_@var{foo}}} is specified by examining the three environment variables @env{LC_ALL}, @w{@env{LC_@var{foo}}}, and @env{LANG}, in that order. The first of these variables that is set specifies the locale. For example, if @env{LC_ALL} is not set, but @env{LC_COLLATE} is set to @samp{pt_BR}, then the Brazilian Portuguese locale is used for the @env{LC_COLLATE} category. As a special case for @env{LC_MESSAGES} only, the environment variable @env{LANGUAGE} can contain a colon-separated list of languages that overrides the three environment variables that ordinarily specify the @env{LC_MESSAGES} category. The @samp{C} locale is used if none of these environment variables are set, if the locale catalog is not installed, or if @command{grep} was not compiled with national language support (NLS). The shell command @code{locale -a} lists locales that are currently available. Many of the environment variables in the following list let you control highlighting using Select Graphic Rendition (SGR) commands interpreted by the terminal or terminal emulator. (See the section in the documentation of your text terminal for permitted values and their meanings as character attributes.) These substring values are integers in decimal representation and can be concatenated with semicolons. @command{grep} takes care of assembling the result into a complete SGR sequence (@samp{\33[}...@samp{m}). Common values to concatenate include @samp{1} for bold, @samp{4} for underline, @samp{5} for blink, @samp{7} for inverse, @samp{39} for default foreground color, @samp{30} to @samp{37} for foreground colors, @samp{90} to @samp{97} for 16-color mode foreground colors, @samp{38;5;0} to @samp{38;5;255} for 88-color and 256-color modes foreground colors, @samp{49} for default background color, @samp{40} to @samp{47} for background colors, @samp{100} to @samp{107} for 16-color mode background colors, and @samp{48;5;0} to @samp{48;5;255} for 88-color and 256-color modes background colors. The two-letter names used in the @env{GREP_COLORS} environment variable (and some of the others) refer to terminal ``capabilities,'' the ability of a terminal to highlight text, or change its color, and so on. These capabilities are stored in an online database and accessed by the @code{terminfo} library. @cindex environment variables @table @env @item GREP_COLOR @vindex GREP_COLOR @r{environment variable} @cindex highlight markers This variable specifies the color used to highlight matched (non-empty) text. It is deprecated in favor of @env{GREP_COLORS}, but still supported. The @samp{mt}, @samp{ms}, and @samp{mc} capabilities of @env{GREP_COLORS} have priority over it. It can only specify the color used to highlight the matching non-empty text in any matching line (a selected line when the @option{-v} command-line option is omitted, or a context line when @option{-v} is specified). The default is @samp{01;31}, which means a bold red foreground text on the terminal's default background. @item GREP_COLORS @vindex GREP_COLORS @r{environment variable} @cindex highlight markers This variable specifies the colors and other attributes used to highlight various parts of the output. Its value is a colon-separated list of @code{terminfo} capabilities that defaults to @samp{ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36} with the @samp{rv} and @samp{ne} boolean capabilities omitted (i.e., false). Supported capabilities are as follows. @table @code @item sl= @vindex sl GREP_COLORS @r{capability} SGR substring for whole selected lines (i.e., matching lines when the @option{-v} command-line option is omitted, or non-matching lines when @option{-v} is specified). If however the boolean @samp{rv} capability and the @option{-v} command-line option are both specified, it applies to context matching lines instead. The default is empty (i.e., the terminal's default color pair). @item cx= @vindex cx GREP_COLORS @r{capability} SGR substring for whole context lines (i.e., non-matching lines when the @option{-v} command-line option is omitted, or matching lines when @option{-v} is specified). If however the boolean @samp{rv} capability and the @option{-v} command-line option are both specified, it applies to selected non-matching lines instead. The default is empty (i.e., the terminal's default color pair). @item rv @vindex rv GREP_COLORS @r{capability} Boolean value that reverses (swaps) the meanings of the @samp{sl=} and @samp{cx=} capabilities when the @option{-v} command-line option is specified. The default is false (i.e., the capability is omitted). @item mt=01;31 @vindex mt GREP_COLORS @r{capability} SGR substring for matching non-empty text in any matching line (i.e., a selected line when the @option{-v} command-line option is omitted, or a context line when @option{-v} is specified). Setting this is equivalent to setting both @samp{ms=} and @samp{mc=} at once to the same value. The default is a bold red text foreground over the current line background. @item ms=01;31 @vindex ms GREP_COLORS @r{capability} SGR substring for matching non-empty text in a selected line. (This is used only when the @option{-v} command-line option is omitted.) The effect of the @samp{sl=} (or @samp{cx=} if @samp{rv}) capability remains active when this takes effect. The default is a bold red text foreground over the current line background. @item mc=01;31 @vindex mc GREP_COLORS @r{capability} SGR substring for matching non-empty text in a context line. (This is used only when the @option{-v} command-line option is specified.) The effect of the @samp{cx=} (or @samp{sl=} if @samp{rv}) capability remains active when this takes effect. The default is a bold red text foreground over the current line background. @item fn=35 @vindex fn GREP_COLORS @r{capability} SGR substring for file names prefixing any content line. The default is a magenta text foreground over the terminal's default background. @item ln=32 @vindex ln GREP_COLORS @r{capability} SGR substring for line numbers prefixing any content line. The default is a green text foreground over the terminal's default background. @item bn=32 @vindex bn GREP_COLORS @r{capability} SGR substring for byte offsets prefixing any content line. The default is a green text foreground over the terminal's default background. @item se=36 @vindex fn GREP_COLORS @r{capability} SGR substring for separators that are inserted between selected line fields (@samp{:}), between context line fields (@samp{-}), and between groups of adjacent lines when nonzero context is specified (@samp{--}). The default is a cyan text foreground over the terminal's default background. @item ne @vindex ne GREP_COLORS @r{capability} Boolean value that prevents clearing to the end of line using Erase in Line (EL) to Right (@samp{\33[K}) each time a colorized item ends. This is needed on terminals on which EL is not supported. It is otherwise useful on terminals for which the @code{back_color_erase} (@code{bce}) boolean @code{terminfo} capability does not apply, when the chosen highlight colors do not affect the background, or when EL is too slow or causes too much flicker. The default is false (i.e., the capability is omitted). @end table Note that boolean capabilities have no @samp{=}... part. They are omitted (i.e., false) by default and become true when specified. @item LC_ALL @itemx LC_COLLATE @itemx LANG @vindex LC_ALL @r{environment variable} @vindex LC_COLLATE @r{environment variable} @vindex LANG @r{environment variable} @cindex character type @cindex national language support @cindex NLS These variables specify the locale for the @env{LC_COLLATE} category, which might affect how range expressions like @samp{[a-z]} are interpreted. @item LC_ALL @itemx LC_CTYPE @itemx LANG @vindex LC_ALL @r{environment variable} @vindex LC_CTYPE @r{environment variable} @vindex LANG @r{environment variable} @cindex encoding error @cindex null character These variables specify the locale for the @env{LC_CTYPE} category, which determines the type of characters, e.g., which characters are whitespace. This category also determines the character encoding. @xref{Character Encoding}. @item LANGUAGE @itemx LC_ALL @itemx LC_MESSAGES @itemx LANG @vindex LANGUAGE @r{environment variable} @vindex LC_ALL @r{environment variable} @vindex LC_MESSAGES @r{environment variable} @vindex LANG @r{environment variable} @cindex language of messages @cindex message language @cindex national language support @cindex translation of message language These variables specify the locale for the @env{LC_MESSAGES} category, which determines the language that @command{grep} uses for messages. The default @samp{C} locale uses American English messages. @item POSIXLY_CORRECT @vindex POSIXLY_CORRECT @r{environment variable} If set, @command{grep} behaves as POSIX requires; otherwise, @command{grep} behaves more like other GNU programs. POSIX requires that options that follow file names must be treated as file names; by default, such options are permuted to the front of the operand list and are treated as options. Also, @env{POSIXLY_CORRECT} disables special handling of an invalid bracket expression. @xref{invalid-bracket-expr}. @item _@var{N}_GNU_nonoption_argv_flags_ @vindex _@var{N}_GNU_nonoption_argv_flags_ @r{environment variable} (Here @code{@var{N}} is @command{grep}'s numeric process ID.) If the @var{i}th character of this environment variable's value is @samp{1}, do not consider the @var{i}th operand of @command{grep} to be an option, even if it appears to be one. A shell can put this variable in the environment for each command it runs, specifying which operands are the results of file name wildcard expansion and therefore should not be treated as options. This behavior is available only with the GNU C library, and only when @env{POSIXLY_CORRECT} is not set. @end table The @env{GREP_OPTIONS} environment variable of @command{grep} 2.20 and earlier is no longer supported, as it caused problems when writing portable scripts. To make arbitrary changes to how @command{grep} works, you can use an alias or script instead. For example, if @command{grep} is in the directory @samp{/usr/bin} you can prepend @file{$HOME/bin} to your @env{PATH} and create an executable script @file{$HOME/bin/grep} containing the following: @example #! /bin/sh export PATH=/usr/bin exec grep --color=auto --devices=skip "$@@" @end example @node Exit Status @section Exit Status @cindex exit status @cindex return status Normally the exit status is 0 if a line is selected, 1 if no lines were selected, and 2 if an error occurred. However, if the @option{-q} or @option{--quiet} or @option{--silent} option is used and a line is selected, the exit status is 0 even if an error occurred. Other @command{grep} implementations may exit with status greater than 2 on error. @node grep Programs @section @command{grep} Programs @cindex @command{grep} programs @cindex variants of @command{grep} @command{grep} searches the named input files for lines containing a match to the given patterns. By default, @command{grep} prints the matching lines. A file named @file{-} stands for standard input. If no input is specified, @command{grep} searches the working directory @file{.} if given a command-line option specifying recursion; otherwise, @command{grep} searches standard input. There are four major variants of @command{grep}, controlled by the following options. @table @option @item -G @itemx --basic-regexp @opindex -G @opindex --basic-regexp @cindex matching basic regular expressions Interpret patterns as basic regular expressions (BREs). This is the default. @item -E @itemx --extended-regexp @opindex -E @opindex --extended-regexp @cindex matching extended regular expressions Interpret patterns as extended regular expressions (EREs). (@option{-E} is specified by POSIX.) @item -F @itemx --fixed-strings @opindex -F @opindex --fixed-strings @cindex matching fixed strings Interpret patterns as fixed strings, not regular expressions. (@option{-F} is specified by POSIX.) @item -P @itemx --perl-regexp @opindex -P @opindex --perl-regexp @cindex matching Perl-compatible regular expressions Interpret patterns as Perl-compatible regular expressions (PCREs). PCRE support is here to stay, but consider this option experimental when combined with the @option{-z} (@option{--null-data}) option, and note that @samp{grep@ -P} may warn of unimplemented features. @xref{Other Options}. @end table In addition, two variant programs @command{egrep} and @command{fgrep} are available. @command{egrep} is the same as @samp{grep@ -E}. @command{fgrep} is the same as @samp{grep@ -F}. Direct invocation as either @command{egrep} or @command{fgrep} is deprecated, but is provided to allow historical applications that rely on them to run unmodified. @node Regular Expressions @chapter Regular Expressions @cindex regular expressions A @dfn{regular expression} is a pattern that describes a set of strings. Regular expressions are constructed analogously to arithmetic expressions, by using various operators to combine smaller expressions. @command{grep} understands three different versions of regular expression syntax: basic (BRE), extended (ERE), and Perl-compatible (PCRE). In GNU @command{grep}, there is no difference in available functionality between the basic and extended syntaxes. In other implementations, basic regular expressions are less powerful. The following description applies to extended regular expressions; differences for basic regular expressions are summarized afterwards. Perl-compatible regular expressions give additional functionality, and are documented in the @i{pcresyntax}(3) and @i{pcrepattern}(3) manual pages, but work only if PCRE is available in the system. @menu * Fundamental Structure:: * Character Classes and Bracket Expressions:: * The Backslash Character and Special Expressions:: * Anchoring:: * Back-references and Subexpressions:: * Basic vs Extended:: * Character Encoding:: * Matching Non-ASCII:: @end menu @node Fundamental Structure @section Fundamental Structure @cindex ordinary characters @cindex special characters In regular expressions, the characters @samp{.?*+@{|()[\^$} are @dfn{special characters} and have uses described below. All other characters are @dfn{ordinary characters}, and each ordinary character is a regular expression that matches itself. @opindex . @cindex dot @cindex period The period @samp{.} matches any single character. It is unspecified whether @samp{.} matches an encoding error. @cindex interval expressions A regular expression may be followed by one of several repetition operators; the operators beginning with @samp{@{} are called @dfn{interval expressions}. @table @samp @item ? @opindex ? @cindex question mark @cindex match expression at most once The preceding item is optional and is matched at most once. @item * @opindex * @cindex asterisk @cindex match expression zero or more times The preceding item is matched zero or more times. @item + @opindex + @cindex plus sign @cindex match expression one or more times The preceding item is matched one or more times. @item @{@var{n}@} @opindex @{@var{n}@} @cindex braces, one argument @cindex match expression @var{n} times The preceding item is matched exactly @var{n} times. @item @{@var{n},@} @opindex @{@var{n},@} @cindex braces, second argument omitted @cindex match expression @var{n} or more times The preceding item is matched @var{n} or more times. @item @{,@var{m}@} @opindex @{,@var{m}@} @cindex braces, first argument omitted @cindex match expression at most @var{m} times The preceding item is matched at most @var{m} times. This is a GNU extension. @item @{@var{n},@var{m}@} @opindex @{@var{n},@var{m}@} @cindex braces, two arguments @cindex match expression from @var{n} to @var{m} times The preceding item is matched at least @var{n} times, but not more than @var{m} times. @end table The empty regular expression matches the empty string. Two regular expressions may be concatenated; the resulting regular expression matches any string formed by concatenating two substrings that respectively match the concatenated expressions. Two regular expressions may be joined by the infix operator @samp{|}; the resulting regular expression matches any string matching either alternate expression. Repetition takes precedence over concatenation, which in turn takes precedence over alternation. A whole expression may be enclosed in parentheses to override these precedence rules and form a subexpression. An unmatched @samp{)} matches just itself. @node Character Classes and Bracket Expressions @section Character Classes and Bracket Expressions @cindex bracket expression @cindex character class A @dfn{bracket expression} is a list of characters enclosed by @samp{[} and @samp{]}. It matches any single character in that list. If the first character of the list is the caret @samp{^}, then it matches any character @strong{not} in the list, and it is unspecified whether it matches an encoding error. For example, the regular expression @samp{[0123456789]} matches any single digit, whereas @samp{[^()]} matches any single character that is not an opening or closing parenthesis, and might or might not match an encoding error. @cindex range expression Within a bracket expression, a @dfn{range expression} consists of two characters separated by a hyphen. It matches any single character that sorts between the two characters, inclusive. In the default C locale, the sorting sequence is the native character order; for example, @samp{[a-d]} is equivalent to @samp{[abcd]}. In other locales, the sorting sequence is not specified, and @samp{[a-d]} might be equivalent to @samp{[abcd]} or to @samp{[aBbCcDd]}, or it might fail to match any character, or the set of characters that it matches might even be erratic. To obtain the traditional interpretation of bracket expressions, you can use the @samp{C} locale by setting the @env{LC_ALL} environment variable to the value @samp{C}. Finally, certain named classes of characters are predefined within bracket expressions, as follows. Their interpretation depends on the @env{LC_CTYPE} locale; for example, @samp{[[:alnum:]]} means the character class of numbers and letters in the current locale. @cindex classes of characters @cindex character classes @table @samp @item [:alnum:] @opindex alnum @r{character class} @cindex alphanumeric characters Alphanumeric characters: @samp{[:alpha:]} and @samp{[:digit:]}; in the @samp{C} locale and ASCII character encoding, this is the same as @samp{[0-9A-Za-z]}. @item [:alpha:] @opindex alpha @r{character class} @cindex alphabetic characters Alphabetic characters: @samp{[:lower:]} and @samp{[:upper:]}; in the @samp{C} locale and ASCII character encoding, this is the same as @samp{[A-Za-z]}. @item [:blank:] @opindex blank @r{character class} @cindex blank characters Blank characters: space and tab. @item [:cntrl:] @opindex cntrl @r{character class} @cindex control characters Control characters. In ASCII, these characters have octal codes 000 through 037, and 177 (DEL). In other character sets, these are the equivalent characters, if any. @item [:digit:] @opindex digit @r{character class} @cindex digit characters @cindex numeric characters Digits: @code{0 1 2 3 4 5 6 7 8 9}. @item [:graph:] @opindex graph @r{character class} @cindex graphic characters Graphical characters: @samp{[:alnum:]} and @samp{[:punct:]}. @item [:lower:] @opindex lower @r{character class} @cindex lower-case letters Lower-case letters; in the @samp{C} locale and ASCII character encoding, this is @code{a b c d e f g h i j k l m n o p q r s t u v w x y z}. @item [:print:] @opindex print @r{character class} @cindex printable characters Printable characters: @samp{[:alnum:]}, @samp{[:punct:]}, and space. @item [:punct:] @opindex punct @r{character class} @cindex punctuation characters Punctuation characters; in the @samp{C} locale and ASCII character encoding, this is @code{!@: " # $ % & ' ( ) * + , - .@: / : ; < = > ?@: @@ [ \ ] ^ _ ` @{ | @} ~}. @item [:space:] @opindex space @r{character class} @cindex space characters @cindex whitespace characters Space characters: in the @samp{C} locale, this is tab, newline, vertical tab, form feed, carriage return, and space. @xref{Usage}, for more discussion of matching newlines. @item [:upper:] @opindex upper @r{character class} @cindex upper-case letters Upper-case letters: in the @samp{C} locale and ASCII character encoding, this is @code{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}. @item [:xdigit:] @opindex xdigit @r{character class} @cindex xdigit class @cindex hexadecimal digits Hexadecimal digits: @code{0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f}. @end table Note that the brackets in these class names are part of the symbolic names, and must be included in addition to the brackets delimiting the bracket expression. @anchor{invalid-bracket-expr} If you mistakenly omit the outer brackets, and search for say, @samp{[:upper:]}, GNU @command{grep} prints a diagnostic and exits with status 2, on the assumption that you did not intend to search for the nominally equivalent regular expression: @samp{[:epru]}. Set the @env{POSIXLY_CORRECT} environment variable to disable this feature. Special characters lose their special meaning inside bracket expressions. @table @samp @item ] ends the bracket expression if it's not the first list item. So, if you want to make the @samp{]} character a list item, you must put it first. @item [. represents the open collating symbol. @item .] represents the close collating symbol. @item [= represents the open equivalence class. @item =] represents the close equivalence class. @item [: represents the open character class symbol, and should be followed by a valid character class name. @item :] represents the close character class symbol. @item - represents the range if it's not first or last in a list or the ending point of a range. @item ^ represents the characters not in the list. If you want to make the @samp{^} character a list item, place it anywhere but first. @end table @node The Backslash Character and Special Expressions @section The Backslash Character and Special Expressions @cindex backslash The @samp{\} character followed by a special character is a regular expression that matches the special character. The @samp{\} character, when followed by certain ordinary characters, takes a special meaning: @table @samp @item \b Match the empty string at the edge of a word. @item \B Match the empty string provided it's not at the edge of a word. @item \< Match the empty string at the beginning of a word. @item \> Match the empty string at the end of a word. @item \w Match word constituent, it is a synonym for @samp{[_[:alnum:]]}. @item \W Match non-word constituent, it is a synonym for @samp{[^_[:alnum:]]}. @item \s Match whitespace, it is a synonym for @samp{[[:space:]]}. @item \S Match non-whitespace, it is a synonym for @samp{[^[:space:]]}. @end table For example, @samp{\brat\b} matches the separate word @samp{rat}, @samp{\Brat\B} matches @samp{crate} but not @samp{furry rat}. @node Anchoring @section Anchoring @cindex anchoring The caret @samp{^} and the dollar sign @samp{$} are special characters that respectively match the empty string at the beginning and end of a line. They are termed @dfn{anchors}, since they force the match to be ``anchored'' to beginning or end of a line, respectively. @node Back-references and Subexpressions @section Back-references and Subexpressions @cindex subexpression @cindex back-reference The back-reference @samp{\@var{n}}, where @var{n} is a single nonzero digit, matches the substring previously matched by the @var{n}th parenthesized subexpression of the regular expression. For example, @samp{(a)\1} matches @samp{aa}. If the parenthesized subexpression does not participate in the match, the back-reference makes the whole match fail; for example, @samp{(a)*\1} fails to match @samp{a}. If the parenthesized subexpression matches more than one substring, the back-reference refers to the last matched substring; for example, @samp{^(ab*)*\1$} matches @samp{ababbabb} but not @samp{ababbab}. When multiple regular expressions are given with @option{-e} or from a file (@samp{-f @var{file}}), back-references are local to each expression. @xref{Known Bugs}, for some known problems with back-references. @node Basic vs Extended @section Basic vs Extended Regular Expressions @cindex basic regular expressions In basic regular expressions the characters @samp{?}, @samp{+}, @samp{@{}, @samp{|}, @samp{(}, and @samp{)} lose their special meaning; instead use the backslashed versions @samp{\?}, @samp{\+}, @samp{\@{}, @samp{\|}, @samp{\(}, and @samp{\)}. Also, a backslash is needed before an interval expression's closing @samp{@}}, and an unmatched @code{\)} is invalid. Portable scripts should avoid the following constructs, as POSIX says they produce undefined results: @itemize @bullet @item Extended regular expressions that use back-references. @item Basic regular expressions that use @samp{\?}, @samp{\+}, or @samp{\|}. @item Empty parenthesized regular expressions like @samp{()}. @item Empty alternatives (as in, e.g, @samp{a|}). @item Repetition operators that immediately follow empty expressions, unescaped @samp{$}, or other repetition operators. @item A backslash escaping an ordinary character (e.g., @samp{\S}), unless it is a back-reference. @item An unescaped @samp{[} that is not part of a bracket expression. @item In extended regular expressions, an unescaped @samp{@{} that is not part of an interval expression. @end itemize @cindex interval expressions Traditional @command{egrep} did not support interval expressions and some @command{egrep} implementations use @samp{\@{} and @samp{\@}} instead, so portable scripts should avoid interval expressions in @samp{grep@ -E} patterns and should use @samp{[@{]} to match a literal @samp{@{}. GNU @command{grep@ -E} attempts to support traditional usage by assuming that @samp{@{} is not special if it would be the start of an invalid interval expression. For example, the command @samp{grep@ -E@ '@{1'} searches for the two-character string @samp{@{1} instead of reporting a syntax error in the regular expression. POSIX allows this behavior as an extension, but portable scripts should avoid it. @node Character Encoding @section Character Encoding @cindex character encoding The @env{LC_CTYPE} locale specifies the encoding of characters in patterns and data, that is, whether text is encoded in UTF-8, ASCII, or some other encoding. @xref{Environment Variables}. In the @samp{C} or @samp{POSIX} locale, every character is encoded as a single byte and every byte is a valid character. In more-complex encodings such as UTF-8, a sequence of multiple bytes may be needed to represent a character, and some bytes may be encoding errors that do not contribute to the representation of any character. POSIX does not specify the behavior of @command{grep} when patterns or input data contain encoding errors or null characters, so portable scripts should avoid such usage. As an extension to POSIX, GNU @command{grep} treats null characters like any other character. However, unless the @option{-a} (@option{--binary-files=text}) option is used, the presence of null characters in input or of encoding errors in output causes GNU @command{grep} to treat the file as binary and suppress details about matches. @xref{File and Directory Selection}. Regardless of locale, the 103 characters in the POSIX Portable Character Set (a subset of ASCII) are always encoded as a single byte, and the 128 ASCII characters have their usual single-byte encodings on all but oddball platforms. @node Matching Non-ASCII @section Matching Non-ASCII and Non-printable Characters @cindex non-ASCII matching @cindex non-printable matching In a regular expression, non-ASCII and non-printable characters other than newline are not special, and represent themselves. For example, in a locale using UTF-8 the command @samp{grep 'Λ@tie{}ω'} (where the white space between @samp{Λ} and the @samp{ω} is a tab character) searches for @samp{Λ} (Unicode character U+039B GREEK CAPITAL LETTER LAMBDA), followed by a tab (U+0009 TAB), followed by @samp{ω} (U+03C9 GREEK SMALL LETTER OMEGA). Suppose you want to limit your pattern to only printable characters (or even only printable ASCII characters) to keep your script readable or portable, but you also want to match specific non-ASCII or non-null non-printable characters. If you are using the @option{-P} (@option{--perl-regexp}) option, PCREs give you several ways to do this. Otherwise, if you are using Bash, the GNU project's shell, you can represent these characters via ANSI-C quoting. For example, the Bash commands @samp{grep $'Λ\tω'} and @samp{grep $'\u039B\t\u03C9'} both search for the same three-character string @samp{Λ@tie{}ω} mentioned earlier. However, because Bash translates ANSI-C quoting before @command{grep} sees the pattern, this technique should not be used to match printable ASCII characters; for example, @samp{grep $'\u005E'} is equivalent to @samp{grep '^'} and matches any line, not just lines containing the character @samp{^} (U+005E CIRCUMFLEX ACCENT). Since PCREs and ANSI-C quoting are GNU extensions to POSIX, portable shell scripts written in ASCII should use other methods to match specific non-ASCII characters. For example, in a UTF-8 locale the command @samp{grep "$(printf '\316\233\t\317\211\n')"} is a portable albeit hard-to-read alternative to Bash's @samp{grep $'Λ\tω'}. However, none of these techniques will let you put a null character directly into a command-line pattern; null characters can appear only in a pattern specified via the @option{-f} (@option{--file}) option. @node Usage @chapter Usage @cindex usage, examples Here is an example command that invokes GNU @command{grep}: @example grep -i 'hello.*world' menu.h main.c @end example @noindent This lists all lines in the files @file{menu.h} and @file{main.c} that contain the string @samp{hello} followed by the string @samp{world}; this is because @samp{.*} matches zero or more characters within a line. @xref{Regular Expressions}. The @option{-i} option causes @command{grep} to ignore case, causing it to match the line @samp{Hello, world!}, which it would not otherwise match. Here is a more complex example, showing the location and contents of any line containing @samp{f} and ending in @samp{.c}, within all files in the current directory whose names start with non-@samp{.}, contain @samp{g}, and end in @samp{.h}. The @option{-n} option outputs line numbers, the @option{--} argument treats any later arguments as file names not options even if @code{*g*.h} expands to a file name that starts with @samp{-}, and the empty file @file{/dev/null} causes file names to be output even if only one file name happens to be of the form @samp{*g*.h}. @example grep -n -- 'f.*\.c$' *g*.h /dev/null @end example @noindent Note that the regular expression syntax used in the pattern differs from the globbing syntax that the shell uses to match file names. @xref{Invoking}, for more details about how to invoke @command{grep}. @cindex using @command{grep}, Q&A @cindex FAQ about @command{grep} usage Here are some common questions and answers about @command{grep} usage. @enumerate @item How can I list just the names of matching files? @example grep -l 'main' test-*.c @end example @noindent lists names of @samp{test-*.c} files in the current directory whose contents mention @samp{main}. @item How do I search directories recursively? @example grep -r 'hello' /home/gigi @end example @noindent searches for @samp{hello} in all files under the @file{/home/gigi} directory. For more control over which files are searched, use @command{find} and @command{grep}. For example, the following command searches only C files: @example find /home/gigi -name '*.c' ! -type d \ -exec grep -H 'hello' '@{@}' + @end example This differs from the command: @example grep -H 'hello' /home/gigi/*.c @end example which merely looks for @samp{hello} in non-hidden C files in @file{/home/gigi} whose names end in @samp{.c}. The @command{find} command line above is more similar to the command: @example grep -r --include='*.c' 'hello' /home/gigi @end example @item What if a pattern or file has a leading @samp{-}? @example grep -- '--cut here--' * @end example @noindent searches for all lines matching @samp{--cut here--}. Without @option{--}, @command{grep} would attempt to parse @samp{--cut here--} as a list of options, and there would be similar problems with any file names beginning with @samp{-}. Alternatively, you can prevent misinterpretation of leading @samp{-} by using @option{-e} for patterns and leading @samp{./} for files: @example grep -e '--cut here--' ./* @end example @item Suppose I want to search for a whole word, not a part of a word? @example grep -w 'hello' test*.log @end example @noindent searches only for instances of @samp{hello} that are entire words; it does not match @samp{Othello}. For more control, use @samp{\<} and @samp{\>} to match the start and end of words. For example: @example grep 'hello\>' test*.log @end example @noindent searches only for words ending in @samp{hello}, so it matches the word @samp{Othello}. @item How do I output context around the matching lines? @example grep -C 2 'hello' test*.log @end example @noindent prints two lines of context around each matching line. @item How do I force @command{grep} to print the name of the file? Append @file{/dev/null}: @example grep 'eli' /etc/passwd /dev/null @end example gets you: @example /etc/passwd:eli:x:2098:1000:Eli Smith:/home/eli:/bin/bash @end example Alternatively, use @option{-H}, which is a GNU extension: @example grep -H 'eli' /etc/passwd @end example @item Why do people use strange regular expressions on @command{ps} output? @example ps -ef | grep '[c]ron' @end example If the pattern had been written without the square brackets, it would have matched not only the @command{ps} output line for @command{cron}, but also the @command{ps} output line for @command{grep}. Note that on some platforms, @command{ps} limits the output to the width of the screen; @command{grep} does not have any limit on the length of a line except the available memory. @item Why does @command{grep} report ``Binary file matches''? If @command{grep} listed all matching ``lines'' from a binary file, it would probably generate output that is not useful, and it might even muck up your display. So GNU @command{grep} suppresses output from files that appear to be binary files. To force GNU @command{grep} to output lines even from files that appear to be binary, use the @option{-a} or @samp{--binary-files=text} option. To eliminate the ``Binary file matches'' messages, use the @option{-I} or @samp{--binary-files=without-match} option, or the @option{-s} or @option{--no-messages} option. @item Why doesn't @samp{grep -lv} print non-matching file names? @samp{grep -lv} lists the names of all files containing one or more lines that do not match. To list the names of all files that contain no matching lines, use the @option{-L} or @option{--files-without-match} option. @item I can do ``OR'' with @samp{|}, but what about ``AND''? @example grep 'paul' /etc/motd | grep 'franc,ois' @end example @noindent finds all lines that contain both @samp{paul} and @samp{franc,ois}. @item Why does the empty pattern match every input line? The @command{grep} command searches for lines that contain strings that match a pattern. Every line contains the empty string, so an empty pattern causes @command{grep} to find a match on each line. It is not the only such pattern: @samp{^}, @samp{$}, and many other patterns cause @command{grep} to match every line. To match empty lines, use the pattern @samp{^$}. To match blank lines, use the pattern @samp{^[[:blank:]]*$}. To match no lines at all, use the command @samp{grep -f /dev/null}. @item How can I search in both standard input and in files? Use the special file name @samp{-}: @example cat /etc/passwd | grep 'alain' - /etc/motd @end example @item Why is this back-reference failing? @example echo 'ba' | grep -E '(a)\1|b\1' @end example This outputs an error message, because the second @samp{\1} has nothing to refer back to, meaning it will never match anything. @item How can I match across lines? Standard grep cannot do this, as it is fundamentally line-based. Therefore, merely using the @code{[:space:]} character class does not match newlines in the way you might expect. With the GNU @command{grep} option @option{-z} (@option{--null-data}), each input and output ``line'' is null-terminated; @pxref{Other Options}. Thus, you can match newlines in the input, but typically if there is a match the entire input is output, so this usage is often combined with output-suppressing options like @option{-q}, e.g.: @example printf 'foo\nbar\n' | grep -z -q 'foo[[:space:]]\+bar' @end example If this does not suffice, you can transform the input before giving it to @command{grep}, or turn to @command{awk}, @command{sed}, @command{perl}, or many other utilities that are designed to operate across lines. @item What do @command{grep}, @command{fgrep}, and @command{egrep} stand for? The name @command{grep} comes from the way line editing was done on Unix. For example, @command{ed} uses the following syntax to print a list of matching lines on the screen: @example global/regular expression/print g/re/p @end example @command{fgrep} stands for Fixed @command{grep}; @command{egrep} stands for Extended @command{grep}. @end enumerate @node Performance @chapter Performance @cindex performance Typically @command{grep} is an efficient way to search text. However, it can be quite slow in some cases, and it can search large files where even minor performance tweaking can help significantly. Although the algorithm used by @command{grep} is an implementation detail that can change from release to release, understanding its basic strengths and weaknesses can help you improve its performance. The @command{grep} command operates partly via a set of automata that are designed for efficiency, and partly via a slower matcher that takes over when the fast matchers run into unusual features like back-references. When feasible, the Boyer--Moore fast string searching algorithm is used to match a single fixed pattern, and the Aho--Corasick algorithm is used to match multiple fixed patterns. @cindex locales Generally speaking @command{grep} operates more efficiently in single-byte locales, since it can avoid the special processing needed for multi-byte characters. If your patterns will work just as well that way, setting @env{LC_ALL} to a single-byte locale can help performance considerably. Setting @samp{LC_ALL='C'} can be particularly efficient, as @command{grep} is tuned for that locale. @cindex case insensitive search Outside the @samp{C} locale, case-insensitive search, and search for bracket expressions like @samp{[a-z]} and @samp{[[=a=]b]}, can be surprisingly inefficient due to difficulties in fast portable access to concepts like multi-character collating elements. @cindex back-references A back-reference such as @samp{\1} can hurt performance significantly in some cases, since back-references cannot in general be implemented via a finite state automaton, and instead trigger a backtracking algorithm that can be quite inefficient. For example, although the pattern @samp{^(.*)\1@{14@}(.*)\2@{13@}$} matches only lines whose lengths can be written as a sum @math{15x + 14y} for nonnegative integers @math{x} and @math{y}, the pattern matcher does not perform linear Diophantine analysis and instead backtracks through all possible matching strings, using an algorithm that is exponential in the worst case. @cindex holes in files On some operating systems that support files with holes---large regions of zeros that are not physically present on secondary storage---@command{grep} can skip over the holes efficiently without needing to read the zeros. This optimization is not available if the @option{-a} (@option{--binary-files=text}) option is used (@pxref{File and Directory Selection}), unless the @option{-z} (@option{--null-data}) option is also used (@pxref{Other Options}). For more about the algorithms used by @command{grep} and about related string matching algorithms, see: @frenchspacing on @itemize @bullet @item Aho AV. Algorithms for finding patterns in strings. In: van Leeuwen J. @emph{Handbook of Theoretical Computer Science}, vol. A. New York: Elsevier; 1990. p. 255--300. This surveys classic string matching algorithms, some of which are used by @command{grep}. @item Aho AV, Corasick MJ. Efficient string matching: an aid to bibliographic search. @emph{CACM}. 1975;18(6):333--40. @url{https://dx.doi.org/10.1145/360825.360855}. This introduces the Aho--Corasick algorithm. @item Boyer RS, Moore JS. A fast string searching algorithm. @emph{CACM}. 1977;20(10):762--72. @url{https://dx.doi.org/10.1145/359842.359859}. This introduces the Boyer--Moore algorithm. @item Faro S, Lecroq T. The exact online string matching problem: a review of the most recent results. @emph{ACM Comput Surv}. 2013;45(2):13. @url{https://dx.doi.org/10.1145/2431211.2431212}. This surveys string matching algorithms that might help improve the performance of @command{grep} in the future. @end itemize @frenchspacing off @node Reporting Bugs @chapter Reporting bugs @cindex bugs, reporting Bug reports can be found at the @url{https://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep, GNU bug report logs for @command{grep}}. If you find a bug not listed there, please email it to @email{bug-grep@@gnu.org} to create a new bug report. @menu * Known Bugs:: @end menu @node Known Bugs @section Known Bugs @cindex Bugs, known Large repetition counts in the @samp{@{n,m@}} construct may cause @command{grep} to use lots of memory. In addition, certain other obscure regular expressions require exponential time and space, and may cause @command{grep} to run out of memory. Back-references can greatly slow down matching, as they can generate exponentially many matching possibilities that can consume both time and memory to explore. Also, the POSIX specification for back-references is at times unclear. Furthermore, many regular expression implementations have back-reference bugs that can cause programs to return incorrect answers or even crash, and fixing these bugs has often been low-priority: for example, as of 2021 the @url{https://sourceware.org/bugzilla/,GNU C library bug database} contained back-reference bugs @url{https://sourceware.org/bugzilla/show_bug.cgi?id=52,,52}, @url{https://sourceware.org/bugzilla/show_bug.cgi?id=10844,,10844}, @url{https://sourceware.org/bugzilla/show_bug.cgi?id=11053,,11053}, @url{https://sourceware.org/bugzilla/show_bug.cgi?id=24269,,24269} and @url{https://sourceware.org/bugzilla/show_bug.cgi?id=25322,,25322}, with little sign of forthcoming fixes. Luckily, back-references are rarely useful and it should be little trouble to avoid them in practical applications. @node Copying @chapter Copying @cindex copying GNU @command{grep} is licensed under the GNU GPL, which makes it @dfn{free software}. The ``free'' in ``free software'' refers to liberty, not price. As some GNU project advocates like to point out, think of ``free speech'' rather than ``free beer''. In short, you have the right (freedom) to run and change @command{grep} and distribute it to other people, and---if you want---charge money for doing either. The important restriction is that you have to grant your recipients the same rights and impose the same restrictions. This general method of licensing software is sometimes called @dfn{open source}. The GNU project prefers the term ``free software'' for reasons outlined at @url{https://www.gnu.org/philosophy/open-source-misses-the-point.html}. This manual is free documentation in the same sense. The documentation license is included below. The license for the program is available with the source code, or at @url{https://www.gnu.org/licenses/gpl.html}. @menu * GNU Free Documentation License:: @end menu @node GNU Free Documentation License @section GNU Free Documentation License @include fdl.texi @node Index @unnumbered Index @printindex cp @bye �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/doc/fdl.texi�������������������������������������������������������������������0000664�0001750�0001750�00000055612�14670377430�016663� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@c The GNU Free Documentation License. @center Version 1.3, 3 November 2008 @c This file is intended to be included within another document, @c hence no sectioning command or @node. @display Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. @uref{https://fsf.org/} Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @end display @enumerate 0 @item PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document @dfn{free} in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of ``copyleft'', which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. @item APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The ``Document'', below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as ``you''. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A ``Modified Version'' of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A ``Secondary Section'' is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The ``Invariant Sections'' are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The ``Cover Texts'' are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A ``Transparent'' copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not ``Transparent'' is called ``Opaque''. Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, La@TeX{} input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG@. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The ``Title Page'' means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, ``Title Page'' means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. The ``publisher'' means any person or entity that distributes copies of the Document to the public. A section ``Entitled XYZ'' means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as ``Acknowledgements'', ``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' of such a section when you modify the Document means that it remains a section ``Entitled XYZ'' according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. @item VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. @item COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. @item MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: @enumerate A @item Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. @item List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. @item State on the Title page the name of the publisher of the Modified Version, as the publisher. @item Preserve all the copyright notices of the Document. @item Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. @item Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. @item Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. @item Include an unaltered copy of this License. @item Preserve the section Entitled ``History'', Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled ``History'' in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. @item Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the ``History'' section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. @item For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. @item Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. @item Delete any section Entitled ``Endorsements''. Such a section may not be included in the Modified Version. @item Do not retitle any existing section to be Entitled ``Endorsements'' or to conflict in title with any Invariant Section. @item Preserve any Warranty Disclaimers. @end enumerate If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled ``Endorsements'', provided it contains nothing but endorsements of your Modified Version by various parties---for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. @item COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled ``History'' in the various original documents, forming one section Entitled ``History''; likewise combine any sections Entitled ``Acknowledgements'', and any sections Entitled ``Dedications''. You must delete all sections Entitled ``Endorsements.'' @item COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. @item AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an ``aggregate'' if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. @item TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled ``Acknowledgements'', ``Dedications'', or ``History'', the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. @item TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. @item FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See @uref{https://www.gnu.org/licenses/}. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License ``or any later version'' applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. @item RELICENSING ``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A ``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the site means any set of copyrightable works thus published on the MMC site. ``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. ``Incorporate'' means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is ``eligible for relicensing'' if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. @end enumerate @page @heading ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: @smallexample @group Copyright (C) @var{year} @var{your name}. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. @end group @end smallexample If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the ``with@dots{}Texts.''@: line with this: @smallexample @group with the Invariant Sections being @var{list their titles}, with the Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}. @end group @end smallexample If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. @c Local Variables: @c ispell-local-pdict: "ispell-dict" @c End: ����������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/ChangeLog-2009�����������������������������������������������������������������0000664�0001750�0001750�00000430035�14670377427�016622� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������2009-11-26 Paolo Bonzini <bonzini@gnu.org> * bootstrap.conf: Add binary-io, dirname. * configure.ac: Remove check for setmode, AC_DOSFILE. * m4/dosfile.m4: Remove. * src/grep.c: Adjust for dirname.h. * src/system.h: Adjust for new gnulib modules. 2009-11-26 Paolo Bonzini <bonzini@gnu.org> * bootstrap.conf: Add gnulib modules for replacement functions and headers. * configure.ac: Remove macros subsumed by gnulib. * lib/hard-locale.c: Remove guards for headers/functions provided by gnulib. * lib/regex.c: Likewise. * lib/savedir.c: Likewise. * src/dfa.c: Likewise. * src/grep.c: Likewise. * src/mbsupport.h: Likewise. * src/system.h: Likewise. * src/dfa.h: Do not look at PROTOTYPES. * m4/mbstate_t.m4: Remove. * src/getpagesize.h: Remove. 2009-11-26 Paolo Bonzini <bonzini@gnu.org> * bootstrap.conf: Add gnulib modules and build libgreputils.a. * configure.ac: Remove macros subsumed by gnulib. * lib/Makefile.am: Remove files subsumed by gnulib. * lib/alloca.c: Remove. * lib/atexit.c: Remove. * lib/error.c: Remove. * lib/error.h: Remove. * lib/fnmatch.c: Remove. * lib/fnmatch.h: Remove. * lib/getopt.c: Remove. * lib/getopt.h: Remove. * lib/getopt1.c: Remove. * lib/gettext.h: Remove. * lib/malloc.c: Remove. * lib/memchr.c: Remove. * lib/obstack.c: Remove. * lib/obstack.h: Remove. * lib/quotearg.c: Remove. * lib/quotearg.h: Remove. * lib/realloc.c: Remove. * lib/stpcpy.c: Remove. * lib/strtol.c: Remove. * lib/strtoul.c: Remove. * lib/strtoull.c: Remove. * lib/xalloc.h: Remove. * lib/xmalloc.c: Remove. * lib/xstrtol.c: Remove. * lib/xstrtol.h: Remove. * lib/xstrtoumax.c: Remove. * m4/error.m4: Remove. * m4/inttypes_h.m4: Remove. * m4/malloc.m4: Remove. * m4/realloc.m4: Remove. * m4/uintmax_t.m4: Remove. * m4/ulonglong.m4: Remove. * m4/xstrtoumax.m4: Remove. * src/system.h: Remove strerror, sys_nerr, sys_errlist. 2009-11-26 Paolo Bonzini <bonzini@gnu.org> * bootstrap: Use gnulib's build-aux/bootstrap. * configure.ac: Add gl_INIT and gl_EARLY. 2009-11-26 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Bump AC_PREREQ to 2.59. 2009-11-26 Paolo Bonzini <bonzini@gnu.org> * lib/savedir.c: Do not use NAMLEN. 2009-11-21 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Remove AC_SEP. * m4/envsep.m4: Remove. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Do not generate lib/posix/Makefile. * lib/Makefile.am: Remove SUBDIRS. * lib/posix/Makefile.am: Remove. * lib/posix/regex.h: Overwrite... * lib/regex.h: ... this. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * doc/Makefile.am: Remove AUTOMAKE_OPTIONS. * lib/posix/Makefile.am: Remove AUTOMAKE_OPTIONS. * vms/Makefile.am: Remove AUTOMAKE_OPTIONS. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * Makefile.cvs: Remove. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * m4/largefile.m4: Remove. * m4/lib-ld.m4: Remove. * m4/lib-prefix.m4: Remove. * m4/missing.m4: Remove. * m4/nls.m4: Remove. * m4/progtest.m4: Remove. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * bootstrap: Add autopoint invocation and fetching of .po files. * configure.ac: Bump to GNU gettext 0.17. * ABOUT-NLS: Remove. * m4/gettext.m4: Remove. * m4/iconv.m4: Remove. * m4/lib-link.m4: Remove. * m4/po.m4: Remove. * po/*.po: Remove. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * autogen.sh: Rename to... * bootstrap: ... this. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * bootstrap/*: Remove. * configure.ac: Do not create bootstrap/Makefile. * Makefile.am: Do not recurse into bootstrap, distribute new files. * Makefile.boot: Move from bootstrap/Makefile.try. * README-boot: Move from bootstrap/README. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * lib/Makefile.am: Distribute gettext.h. * lib/closeout.c: Use it. * lib/gettext.h: New. * lib/quotearg.c: Use it. * lib/xmalloc.c: Use it. * src/dfa.c: Use it. * src/system.h: Use it. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * configure.ac.in: Rename... * configure.ac: ... to this. Remove ALL_LINGUAS definition. * autogen.sh: Generate po/LINGUAS instead of configure.ac. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * configure.ac.in: Remove pointless (?) stamp-h rule. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * configure.ac.in: Remove m4/Makefile creation. * Makefile.am: Remove m4 subdirectory. * m4/Makefile.am: Remove. * m4/codeset.m4: Remove. * m4/glibc.m4: Remove. * m4/glibc21.m4: Remove. * m4/header.m4: Remove. * m4/install.m4: Remove. * m4/isc-posix.m4: Remove. * m4/lcmessage.m4: Remove. * m4/sanity.m4: Remove. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * configure.ac.in (AM_GNU_GETTEXT_VERSION): Bump to 0.17. * Makefile.am (EXTRA_DIST): Add build-aux/config.rpath. * intl/*: Remove. * m4/gettext.m4: Upgrade to gettext-0.17. * m4/iconv.m4: Upgrade to gettext-0.17. * m4/lib-ld.m4: New file, from gettext-0.17. * m4/lib-link.m4: New file, from gettext-0.17. * m4/lib-prefix.m4: New file, from gettext-0.17. * m4/nls.m4: New file, from gettext-0.17. * m4/po.m4: New file, from gettext-0.17. * m4/progtest.m4: Upgrade to gettext-0.17. * m4/Makefile.am (EXTRA_DIST): Add the new files. * po/Makefile.in.in: Upgrade to gettext-0.17. * po/Makevars: New. * po/cat-id-tbl.c: New. * src/Makefile.am: Replace @INTLLIBS@ with @LIBINTL@. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * configure.ac.in: Test for limits.h, locale.h, stddef.h, mempcpy and setlocale, though already done implicitly via AM_GNU_GETTEXT. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * bootstrap/Makefile.try: Adjust. * lib/savedir.c: Avoid using stpcpy, so that bootstrapping does not need it. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Slightly modernize. * Makefile.am: Modernize, use dependencies. * Makefile.am: Modernize, use dependencies. * lib/Makefile.am: Remove ansi2knr. * src/Makefile.am: Remove ansi2knr. * .gitignore: Add INSTALL * build-aux/.gitignore: New. 2009-11-20 Paolo Bonzini <bonzini@gnu.org> * autogen.sh: Remove what is useless with git. 2009-02-10 Tony Abou-Assaleh <taa@acm.org> * po/*.po: update from the Translation Project * configure.ac.in: update version to 2.6-cvs 2009-02-02 Karl Berry <karl@tug.org> * configure.ac.in (pcre): set CPPFLAGS, not CFLAGS. 2009-02-01 Tony Abou-Assaleh <taa@acm.org> * po/*.po: update from the Translation Project * po/Makefile.in.in: Remove deleted file ChangeLog from DISTFILES * configure.ac.in: Replace obsolete macro AC_OUTPUT with modern equivalent 2009-02-01 Karl Berry <karl@tug.org> * missing: re-add (from gnulib), since it's missing. * src/grep.c (usage): consistent punctuation. 2009-01-31 Tony Abou-Assaleh <taa@acm.org> * m4/*.m4: quote underquoted definitions * m4/codeset.m4: serial AM1 -> serial 1 * m4/iconv.m4: serial AM2 -> serial 2 * m4/header.m4: m4_regexp -> m4_bregexp, m4_patsubst -> m4_bpatsubst 2009-01-29 Karl Berry <karl@gnu.org> * src/grep.c (usage): mention gnu.org/s/grep and gnu.org/gethelp. Update and/or add copyright notices: * ABOUT-NLS * AUTHORS * ChangeLog * Makefile.am * NEWS * README * README-alpha * README.DOS * THANKS * autogen.sh * configure.ac.in * bootstrap/Makefile.am * bootstrap/Makefile.try * bootstrap/README * doc/Makefile.am * doc/grep.texi * lib/Makefile.am * m4/Makefile.am * po/POTFILES.in * src/Makefile.am * src/dfa.h * src/dosbuf.c * src/grep.h * src/kwset.c * src/kwset.h * src/mbsupport.h * src/search.c * src/system.h * src/vms_fab.c * src/vms_fab.h * tests/Makefile.am * tests/backref.sh * tests/bre.awk * tests/bre.sh * tests/empty.sh * tests/ere.awk * tests/ere.sh * tests/file.sh * tests/fmbtest.sh * tests/foad1.sh * tests/khadafy.sh * tests/options.sh * tests/pcre.sh * tests/spencer1.awk * tests/spencer1.sh * tests/spencer2.sh * tests/status.sh * tests/tests * tests/warning.sh * tests/yesno.sh * vms/Makefile.am * vms/config_vms.h * po/ChangeLog: remove this file, just a bit of ancient cruft. 2009-01-25 Tony Abou-Assaleh <taa@acm.org> * README: updated "KNOWN BUGS" section 2009-01-24 Bruno Haible <bruno@clisp.org> * lib/posix/regex.h (__restrict, __restrict_arr): Remove macros. (_Restrict_, _Restrict_arr_): New macros. From gnulib/lib/regex.h. (regcomp, regexec): Update declarations to use them. * lib/savedir.c (isdir): New declaration. * src/dfa.c (update_mb_len_index): Change argument type to 'char const *'. (match_mb_charset): Cast argument to strncpy. (dfaexec): Add pointer cast. * src/grep.c (parse_grep_colors): Add braces for disambiguation. * src/kwset.c: Include xalloc.h instead of declaring xmalloc manually. 2009-01-20 Tony Abou-Assaleh <taa@acm.org> * tests/foad1.sh: disable tests that fail under cs_CZ.UTF-8. * tests/fmbtest.sh: likewise * README: added "KNOWN BUGS" section * src/grep.c: updated copyright year 2008-12-12 Karl Berry <karl@gnu.org> * doc/grep.texi (Exit Status, grep Programs): move these nodes to under Invoking. * doc/grep.texi: remove all remaining node pointers; downcase cindex entries. 2008-12-11 Karl Berry <karl@gnu.org> * doc/grep.texi (Copying): update url's. (GNU General Public License): remove node. (GNU Free Documentation License): @include fdl.texi instead. (@copying): update to v1.3 or later. * doc/fdl.texi: new file, copied from https://www.gnu.org/licenses/fdl.texi. * doc/Makefile.am (grep_TEXINFOS): new variable to get fdl.texi. Also add usual GPL license statement. * doc/grep.texi (Index): Merge in Concept Index node, to have only one index. Arrange @syncodeindex's accordingly. 2008-12-10 Karl Berry <karl@gnu.org> * doc/grep.texi (@copying): use @copying; move @contents to beginning; rearrange other frontmatter in the conventional ways. 2008-06-15 Tony Abou-Assaleh <taa@acm.org> * src/ansi2knr.[1c]: Remove generated files (installed by automake). Thanks to Emanuele Giaquinta for this. 2008-02-14 Tony Abou-Assaleh <taa@acm.org> * src/grep.c: Factor out copyright year in --version. Thanks to Karl Berry for this. * src/grep.c: Update copyright years * po/POTFILES.in: +src/system.h +lib/closeout.c +lib/regex.c +lib/xmalloc.c -lib/getopt1.c 2008-02-09 Tony Abou-Assaleh <taa@acm.org> * src/dfa.c: Replace a MALLOC and for loop with a CALLOC. Thanks to Johan Walles for this. Patch #6288 * README-alpha: more info about CVS code * README: pointer to README-alpha * src/grep.c: Update grep copyright year 2008-02-08 Reuben Thomas <rrt@sc3d.org> (tiny change) * .cvsignore: add configure.ac * src/.cvsignore: add .deps 2008-02-06 Tony Abou-Assaleh <taa@acm.org> * tests/foad1.sh: Comment out cases that are known to fail. These should be uncommented after the 2.5.4 release. * tests/yesno.sh: Likewise. * doc/grep.1: Update description of -e PATTERN; from Benno Schulenberg * doc/grep.texi: Likewise. 2007-11-19 Tony Abou-Assaleh <taa@acm.org> * m4/Makefile.am: Remove reference strerror_r.m4 2007-11-16 Tony Abou-Assaleh <taa@acm.org> * po/sk.po: updated from the translation project 2007-11-03 Tony Abou-Assaleh <taa@acm.org> * po/*.po: get latest translations * po/no.po: removed * po/ky.po: added * po/sk.po: added 2007-10-10 Tony Abou-Assaleh <taa@acm.org> * configure.ac.in: update version to 2.6-dev * src/grep.c: update --version message 2007-10-07 Tony Abou-Assaleh <taa@acm.org> * src/grep.c: When -h and -H are combined, use the last specified, Bug #15620, Patch #4866 * tests/foad1.sh: add tests for -h and -H * ChangeLog: Add a copyright notice (years taken from commit logs), add a license notice (taken from gnulib ChangeLog) * TODO: update the link to a list of other grep implementations 2007-06-29 Bernhard Rosenkraenzer <bero@arklinux.org> * all files: GPLv3 * configure.ac.in: Change version number 2006-11-25 Bernhard Rosenkraenzer <bero@arklinux.org> * configure.ac.in: Update version number for post-2.5.2 development 2006-11-25 Bernhard Rosenkraenzer <bero@arklinux.org> * configure.ac.in, grep.spec: Update version number * Makefile.cvs: Update to work with current autoconf scripts * po/Makefile.in.in: Adjust to work with automake 1.1x 2006-08-19 Bernhard Rosenkraenzer <bero@arklinux.org> * po/*: Sync with translation project * doc/*: Assorted documentation updates, Patch #4610 * autogen.sh, configure.in, configure.ac.in: Autogenerate ALL_LINGUAS variable * m4/strerror_r.m4, configure.ac.in: Fix detection of strerror_r * lib/error.c: Remove bogus warning * lib/savedir.c, lib/savedir.h, src/grep.c, doc/*: Add --exclude-dir option (patch #5051) 2005-11-18 Charles Levert <charles_levert@gna.org> * tests/foad1.sh: Use ": ${VERBOSE=}" so that the caller can set it without modifying the script; the usual caller (Makefile) still leaves it untouched (usually unset, so it's off by default). Modify "-m1 -A99 '^...$'" tests that failed so that their expectation now corresponds to the output currently produced by grep. Those tests used to expect that two selected (or selectable) lines be output, even with -m1. Nothing was modified with other similar tests that output _context_ lines after one selected line has been output with -m1; they used to and still succeed. Although tests/yesno.sh now provides a more comprehensive framework for testing -m/-C feature interaction, it doesn't exercise mixing them with anchors so the whole relevant tests/foad1.sh test group is kept, notably to check that grep doesn't crash when it is run. 2005-11-17 Charles Levert <charles_levert@gna.org> On 2005-06-21, many changes were made that affected --color, --only-matching, and --invert-match. Some of them introduced a misunderstanding between the concepts of matched/non-matched and selected/rejected lines. Furthermore, a few bugs with -v sneaked in stemming from this. This set of changes aims to rectify most of this situation. Some GREP_COLORS capabilities are also added as a result of the clarification. (Further issues with -v/-o/-C feature interaction still remain to be sorted out.) * src/grep.c: Rename/add global variables, macros, and capabilities: SEP_CHAR_MATCH --> SEP_CHAR_SELECTED SEP_CHAR_CONTEXT --> SEP_CHAR_REJECTED SEP_STR_CHUNK --> SEP_STR_GROUP grep_color --> selected_match_color + context_match_color mlines_color --> selected_line_color context_color --> context_line_color "ml" --> "sl" "mt" --> "mt" = "ms" + "mc" --> "rv" (reverse "sl"/"cx" when -v) * src/grep.c (color_cap_mt_fct, color_cap_rv_fct): New functions. * src/grep.c (print_line_tail): Renamed color argument to line_color. * src/grep.c (print_line_middle, prline): Revert part of the logic to a pre-2005-06-21 one so that lines with matches have their matched parts properly handled again ("m?" colors or --only-matching), whether or not -v is specified. Whole line colors ("sl", "cx") follow a selected / rejected(context) logic, as opposed to a matched / non-matched one (unless "rv"). Matched text colors ("ms", "mc") always follow a selected / rejected(context) logic, regardless of "rv", because only matched lines use them anyway. pr_line_middle() now takes additional line_color and match_color arguments computed by prline() prior to calling that function. The old logic was a buggy hybrid matched / rejected(context) one. * src/grep.c (prpending, prtext, grepfile): Renamed macro invocations. * src/grep.c (parse_grep_colors): Update top comment. * src/grep.c (main): GREP_COLOR (singular) now sets both selected_match_color and context_match_color. 2005-11-16 Charles Levert <charles_levert@gna.org> * src/search.c (Pcompile): Clarify message for the -P option not being supported so that users don't assume it's a run-time problem, but know that it's a compile-time configuration choice. Based on an idea by: Benno Schulenberg <benno@nietvergeten.nl>. 2005-11-13 Charles Levert <charles_levert@gna.org> * tests/yesno.sh: New file. Test feature interaction of -C, -v, -o, and -m. This reveals bugs, including some I introduced on 2005-06-21, but also others. * tests/Makefile.am (TESTS): Add yesno.sh. * tests/Makefile.am (CLEANFILES): Add cspatfile and csinput, as created by fmbtest.sh. Add yesno.txt, as created by yesno.sh. 2005-11-11 Charles Levert <charles_levert@gna.org> * configure.in (ALL_LINGUAS): Add languages that were missing from this variable (bg, ca, da, nb, tr), but that GNU grep supports with a po/xx.po file. Reported by Tony Abou-Assaleh <taa@acm.org>. * src/search.c (Pcompile): Abort in error if -P and multiple patterns are specified, with an error message explaining the situation. Fixing this won't be simple; the '\n' characters separating the patterns cannot just be replaced by '|' to create an alternation as back-references are assumed to be local to each individual pattern. * src/grep.c (parse_grep_colors, main): Replace all uses of fprintf(stderr, _("%s: foo\n"), program_name, ...) with error(0, 0, _("foo"), ...) for uniformization and simplification of warning messages that will be up for localization. (My bad.) 2005-11-10 Charles Levert <charles_levert@gna.org> The introduction of the --only-matching and --color GNU extensions to grep added the requirement that each execute() implementation not only be able to identify matching lines as a whole, but also individual "exact" matches within a line known to be matching, from leftmost to rightmost match, when the output from matching lines is actually produced. The interface and implementations of execute() were not up to it. This set of changes aims to rectify that situation. Previously failing tests relative to left anchors (^ and \<) and -w should now pass. This fixes <https://savannah.gnu.org/bugs/?func=detailitem&item_id=11579>, <https://savannah.gnu.org/patch/?func=detailitem&item_id=1834>, <https://savannah.gnu.org/bugs/?func=detailitem&item_id=8243>, and possibly part of other, bigger, pending patches. The problem was also compounded by the POSIX requirement to support a pattern list instead of just an individual pattern (for -G and -E as well). * tests/foad1.sh: Test for increasing/decreasing-length word matches, given pattern order, and leftmost/longest match. * tests/fmbtest.sh: Modify test #6 according to new expectations. Better document what tests #6 and #7 are actually for. Eliminate test #5 in favor of bringing tests #6 and #7 within the F G E loop. * src/grep.h (EXECUTE_ARGS): Change last argument from "int exact" to "char const *start_ptr". Testing for "start_ptr" being non-NULL retains the same semantics as testing for "exact" being non-zero. * src/grep.c (print_line_middle): Call execute() with whole buffer to work on, but using current position as start_ptr. * src/grep.c (prpending, grepbuf): Call execute() with NULL as start_ptr. * src/search.c (EGexecute, Fexecute, Pexecute): When start_ptr is non-NULL, return first match from it as an offset relative to buf. * src/search.c (EGexecute): Consider all patterns if many and, for an exact match, return the best one (leftmost, then longest). Don't explore worst solutions, of course (branch and bound). 2005-11-10 Charles Levert <charles_levert@gna.org> * src/grep.c (main): Fix a subtle memory allocation bug introduced with the mb_icase_keys() function, which can call xrealloc() or free() on keys, by making sure keys is always dynamically allocated. 2005-11-09 Charles Levert <charles_levert@gna.org> * doc/grep.1, doc/grep.texi: Advise users to test for "exit_status > 1" instead of "exit_status == 2" in order to detect errors, for portability with other POSIX-compliant implementations. 2005-11-09 Charles Levert <charles_levert@gna.org> The following set of changes aims to make "egrep" and "fgrep" minimal executable programs for legacy applications, instead of shell scripts. This "fgrep" is much smaller than "grep". This set of changes appears more daunting than it really is. * src/egrep.c, src/fgrep.c, src/esearch.c, src/fsearch.c: New files that #define either EGREP_PROGRAM or FGREP_PROGRAM and #include the corresponding generic (i.e., non e or f specific) *.c file. * src/grepmat.c: Remove whole file. * src/Makefile.am: Remove no-dependencies from AUTOMAKE_OPTIONS. Add definitions to make "egrep" and "fgrep" specific standalone executable programs that only use the source files they need. Remove rules for "egrep" and "fgrep" shell scripts. * src/grep.h: #define GREP_PROGRAM if both EGREP_PROGRAM and FGREP_PROGRAM are #undef. Only declare matchers[] in this case along with the compile_fp_t and execute_fp_t function pointers typedefs, otherwise declare prototypes for straight compile() and execute() functions for the specialized "egrep" and "fgrep" programs. Remove the extern declaration for matcher. Define COMPILE_RET, COMPILE_ARGS, EXECUTE_RET, EXECUTE_ARGS, COMPILE_FCT, and EXECUTE_FCT helper preprocessor macros. * src/grep.c (short_options, long_options, usage, main): Only support -G, -E, -F, -P, and -X for GREP_PROGRAM, but not for EGREP_PROGRAM or FGREP_PROGRAM. Customize usage messages. * src/grep.c (set_limits): New function with unchanged code, called from main(), because it shouldn't be in install_matcher() since it was already matcher-independent. * src/grep.c (matcher): Add as static, only for GREP_PROGRAM. * src/grep.c (setmatcher, install_matcher): Only for GREP_PROGRAM. * src/grep.c (main): Remove any tweaking and dependence on argv[0]. * src/grep.c (print_line_middle, prpending, grepbuf, main): Call compile() and execute() directly, not through a function pointer dereferencing notation, so that it works with both straight functions (in EGREP_PROGRAM and FGREP_PROGRAM) and function pointers (in GREP_PROGRAM). * src/search.c (<regex.h>, "dfa.h", dfa, pattern0, patterns, pcount, dfaerror, kwset_exact_matches, kwsmusts): Only include/declare/define if not FGREP_PROGRAM. * src/search.c: Remove function prototypes for all functions that are not used before their definition, since this is just a hassle now with their varying names and conditional definition. * src/search.c (GEAcompile): Rename from Ecompile(). Add new syntax_bits argument/variable. Use as compile() for EGREP_PROGRAM. Put in the needed RE_ICASE fix, albeit commented-out for now. Make sure to free() modified word/line pattern after use, if any. * src/search.c (Gcompile): Merge with GEAcompile() then remove. * src/search.c (Gcompile, Acompile, Ecompile): New small functions that call GEAcompile(), now that matcher is not an extern variable. * src/search.c (GEAcompile, Gcompile, Acompile, Ecompile, Fcompile, Pcompile, EGexecute, Fexecute, Pexecute, matchers): Only define when needed according to *GREP_PROGRAM, and rename to just compile() and execute() when appropriate. * grep/bootstrap/Makefile.try: Similar changes. 2005-11-08 Charles Levert <charles_levert@gna.org> * README.DOS, TODO, grep.spec, doc/grep.1, doc/grep.texi, src/grep.h, po/da.po, po/nb.po, po/no.po, po/sv.po: Replace all capitalized "Grep" by a lowercase "grep", except in citations. Reported by Benno Schulenberg <benno@nietvergeten.nl> from the <https://bugs.debian.org/190551> entry in the Debian bug tracker. * doc/grep.1, doc/grep.texi: Explain that the "egrep" and "fgrep" commands are deprecated and provided for historical applications. Replace some "egrep" uses by "grep -E" to promote the newer usage. Typeset "zgrep" as a command. Fix some spacing and punctuation bugs. 2005-11-08 Julian Foad <julianfoad@btopenworld.com> * doc/grep.texi: Rewrite a poorly written usage example about back-references, and tweak another. New text by Benno Schulenberg. 2005-11-04 Charles Levert <charles_levert@gna.org> * src/grep.c (mb_icase_keys): New function to properly lowercase keys if match_icase. The problem was that some multi-octet characters can get longer or shorter upon this conversion, so that it cannot just naively be done in place on the same memory buffer. * src/grep.c (main): Call mb_icase_keys (and remove in-line code). * tests/foad1.sh: Duplicate three "-o -b" tests for the "-F" mode because it relies on a different code path that deserves the same kind of testing. 2005-09-27 Stepan Kasal <kasal@ucw.cz> * doc/grep.1: Fix a typo. 2005-08-24 Charles Levert <charles_levert@gna.org> * src/grep.c (print_line_middle): In case of an empty match, make minimal progress and continue instead of aborting process of the remainder of the line, in case there's still an upcoming non-empty match. * tests/foad1.sh: Add two tests for this. * doc/grep.texi, doc/grep.1: Document this behavior, since --only-matching and --color are GNU extensions which are otherwise unspecified by POSIX or other standards. 2005-07-26 Charles Levert <charles_levert@gna.org> * tests/pcre.sh: New file. Add test 1. * tests/Makefile.am: Add pcre.sh to TESTS. 2005-07-07 Charles Levert <charles_levert@gna.org> * src/grep.c: Remove all xm capability code. 2005-07-05 Charles Levert <charles_levert@gna.org> * doc/grep.texi: Add missing green color in GREP_COLORS description. * doc/grep.1: Fix typo and reorganize GREP_COLORS documentation. * src/kwset.c (DEPTH_SIZE): New macro to anticipate architectures/compilers where CHAR_BIT is not 8 (we assume it won't be less than 4, which would be non-standard and unlikely). Checked to hold for CHAR_BIT up to 1023 (and maybe more)! * src/kwset.c (kwsincr): Use DEPTH_SIZE in two array declarations. * src/kwset.c (kwsincr): When a second obstack_alloc() call fails, free what the first one successfully allocated by popping it off the top of the obstack, before returning in error, just to keep things clean. * src/kwset.c (kwsprep): Verify return value of obstack_alloc() and return a memory exhausted error if so. This function had a prototype to return such errors, but never did. 2005-07-04 Charles Levert <charles_levert@gna.org> * src/kwset.c: Readability changes. Replace uses of 0 for pointer values by NULL. Generalize use of existing U() macro to whole file. * src/kwset.c (kwsprep): Use memset() and memcpy() when appropriate. * src/kwset.c (kwsprep): Move three variable declarations to the single {}-block where they are used. * src/kwset.c (kwsprep): Optimize search for mind2 value by starting from the end of the target[] array. 2005-06-22 Charles Levert <charles_levert@gna.org> * grep/autogen.sh, grep/src/Makefile.am, grep/tests/backref.sh, grep/tests/bre.sh, grep/tests/empty.sh, grep/tests/ere.sh, grep/tests/file.sh, grep/tests/fmbtest.sh, grep/tests/foad1.sh, grep/tests/khadafy.sh, grep/tests/options.sh, grep/tests/spencer1.sh, grep/tests/spencer2.sh, grep/tests/status.sh, grep/tests/warning.sh: As per autoconf's "Portable Shell Programming" guidelines, replace all instances of "#!/bin/sh" by "#! /bin/sh" (notice the space). 2005-06-21 Charles Levert <charles_levert@gna.org> * src/grep.c (nlscan): Make this function more robust by removing the undocumented assumption that its "lim" argument points right after a line boundary. This will be used later to fix --byte-offset's broken behavior. Patch #3769. * src/grep.c (main): Add a test to check if -o/--only-matching and context lines are both specified and if so, set both context specifications (before and after) to zero then print an explicit warning to stderr explaining what was done and why (as opposed to drastically aborting the process in error). Patch #3768. Other code needs this zero setting to work correctly without having to repeatedly test for this conflictual condition. * tests/foad1.sh: Add tests combining -o, -n/-b/-H, and -i, since there are separate code paths for -i. Add tests combining -o, -n/-b/-H, and -3, since any context line specification should be ignored when combined with -o. * src/grep.c (print_line_head): New function, culled off the top content of prline(). Adds a guard against "lastnl" having already reached "lim", which can happen when if the function is called more than once per line. * src/grep.c (prline): Now calls print_line_head(), not only at the beginning to replace the moved code when -o is not specified, but also for each match when -o is specified (two code paths with this). Patch #3770, more or less. This makes all tests combining -o and -n/-b/-H pass, which they didn't before. Fixes bug #12727. * src/grep.c (SEP_CHAR_MATCH, SEP_CHAR_CONTEXT, SEP_STR_CHUNK): New macros for ':', '-', and "--". Used throughout the file. Will be used even more in upcoming updates, so good to have now. * src/grep.c: The new GREP_COLORS (plural) framework, only partially used at this point to make for a simpler initial patch in CVS. A subset of patch #3644 on Savannah. * src/grep.c (color_cap_ne_fct, color_cap_xm_fct, print_filename, print_sep, parse_grep_colors): New functions. * src/grep.c (prtext, grepfile, main): Existing functions modified to use the new framework. * doc/grep.texi, doc/grep.1: Document GREP_COLORS. * src/grep.c: The new -T/--initial-tab framework, only partially used at this point to make for a simpler initial patch in CVS. A subset of patch #3644 on Savannah. The option name/calling convention is the same as for GNU diff. * doc/grep.texi, doc/grep.1: Document -T/--initial-tab. * src/grep.c (print_offset): Renamed print_offset_sep() to better represent its new functionality; new calling convention. * src/grep.c (print_offset, print_line_head): Use and implement missing parts of the GREP_COLORS and -T/--initial-tab frameworks. * src/grep.c (print_line_middle, print_line_tail): New functions, unused for now, intended to allow a simplifying rewrite of prline(). Adding them first will make for cleaner CVS patches. * src/grep.c (prline): Simplifying rewrite using print_line_middle() and print_line_tail(). No longer attempts to find matches to colorize in context lines, thus avoiding costly calls to (*execute)(), since we know by then that they can't contain any by definition. There are no longer four different code paths whether -o and -i are each specified or not; they have been unified into one, which should help avoid bugs similar to previous ones due to not updating all code paths in a synchronized fashion. The -i code has been explicitly marked since it doesn't belong there and should be removed as soon as other -i code elsewhere is fixed. The remaining GREP_COLORS functionality is implemented. Savannah patch #3771 and patch #3644, heavily reworked. * src/grep.c (color_cap_ne_fct, color_cap_xm_fct, print_line_middle, print_line_tail): Make these four functions static. 2005-06-20 Charles Levert <charles_levert@gna.org> * src/grep.c: Extensively document the SGR/EL-to-Right issue. * src/grep.c: Explain the context and logic for choosing default --color screen attributes (SGR parameters). 2005-06-15 Charles Levert <charles_levert@gna.org> * tests/foad1.sh: Since this script is run by /bin/sh, it must work under posix mode. That means not using assignment statements right before a function call (LC_ALL=... grep_test, in this case), because it won't do the expected thing. 2005-06-14 Charles Levert <charles_levert@gna.org> Fix bug #11022 (Line wrapping causes GREP_COLOR background color to "smear") by outputting a "clear to end of line" control sequence after each SGR (Select Graphic Rendition) control sequence (START and END). This also avoid similar problems with HT (tab) characters. * src/grep.c (SGR_START, SGR_END, PR_SGR_FMT, PR_SGR_FMT_IF, PR_SGR_START, PR_SGR_END, PR_SGR_START_IF, PR_SGR_END_IF): New macros. * src/grep.c (prline): Use the new macros. * tests/fmbtest.sh, tests/foad1.sh: Adjust the regression tests to expect the new control sequences. 2005-05-06 Charles Levert <charles_levert@gna.org> * TODO: Add a few more projects and derived versions to check out. 2005-05-05 Charles Levert <charles_levert@gna.org> * README-alpha: Document grep-commit mailing list. * TODO: Add various stuff culled from the mailing list. 2005-05-02 Charles Levert <charles_levert@gna.org> * 78 files: Update FSF's civic address, zip code, and citizen relocation code. 2005-04-29 Charles Levert <charles_levert@gna.org> * tests/foad1.sh: Add -b and tricky UTF-8 tests. Display LC_ALL when its value is special. Patch #3962. * ABOUT-NLS: Sync with CVS revision 1.9 of 2005-04-13T11:21:55Z from GNU gettext on ":pserver:anoncvs@sources.redhat.com:/cvs/gettext", file "gettext/gettext-runtime/ABOUT-NLS". 2005-04-29 Julian Foad <julianfoad@btopenworld.com> * Makefile.am: Remove reference to long-gone files PATCHES.AC and PATCHES.AM. Thanks to Tony Abou-Assaleh for this. Patch #3961. 2005-04-29 Charles Levert <charles_levert@gna.org> * src/grep.c: Fix typo in prline()'s --only-matching --ignore-case code path; this fixes bug #9768 and passes one more test in tests/foad1.sh. This whole code path should be removed in the future, when other --ignore-case issues are dealt with. 2005-04-28 Julian Foad <julianfoad@btopenworld.com> * tests/foad1.sh: Remove Bash-specific syntax. * src/dfa.c: Fix a DFA bug whereby a bracket "[" was matched by the pattern "[[:alpha:]]" in UTF-8 locales. Patch #3800, by Tim Waugh. * tests/foad1.sh: Add a regression test for that. 2005-04-27 Julian Foad <julianfoad@btopenworld.com> Fix a bug reported by Elliott Hughes in patch #1834 whereby "grep -Fw" would miss matches after a non-word occurrence of the pattern. Fix by Gordon Lack; tests based on reproduction recipes by Gordon Lack. * src/search.c (Fexecute): Fix the "match_words" case. * tests/foad1.sh: Modify the test framework so that the "PATTERN" argument is optional. Add a regression test and a test for a similar case that other proposed patches have got wrong. Add more tests, some initially failing. * tests/foad1.sh: Add tests for "--color", most initially failing. * tests/fmbtest.sh: New file of tests for "grep -i" with multi-byte chars, by Jakub Jelinek, from patch #3808: Red Hat's "tests" patch. Initially, test #4 fails (in all three modes). * tests/Makefile.am: Include the new tests file "fmbtest.sh". 2005-04-12 Julian Foad <julianfoad@btopenworld.com> * tests/bre.tests: Enable a regression test for bug #9519. * src/grep.c: Fix a seg-fault in "-o -i": patch #1939. * tests/foad1.sh: New tests for "-o", initially all failing. * tests/Makefile.am: Include the new tests file "foad1.sh". * tests/spencer2.sh: Be consistent with "spencer1.sh" in the naming of associated files. * src/grep.c: Fix off-by-one error in prpending(). Patch #3840 by Claudio Fontana. * tests/foad1.sh: Add tests by Pavol Gono for patch #3840. Some of them still fail, but no longer seg-fault due to that bug. 2005-04-11 Julian Foad <julianfoad@btopenworld.com> * doc/grep.texi, doc/grep.1: Document USG grep -s too. Based on a patch by Paul Eggert; suggested by Keith Marshall. * src/dfa.c (lex): Fix bug #9519: "echo do^re | grep do^re" was failing to find a match. 2005-03-09 Stepan Kasal <kasal@ucw.cz> * src/search.c (EGexecute, Fexecute): Use xmalloc, not malloc. (EGexecute): Handle the failure in one place, goto there. 2005-02-26 Stepan Kasal <kasal@ucw.cz> * src/grep.c (get_nondigit_option): Don't give up too early. * src/search.c (Pexecute): Add a comment explaining that this situation should not happen. 2005-02-22 Claudio Fontana <sick_soul@users.sourceforge.net> (tiny change) * src/search.c (Pexecute): Consider eof case when delimiting matching line. Fixes bug #4531. 2005-02-23 Julian Foad <julianfoad@btopenworld.com> * po/ko.po: Fix email address. * README-alpha: Fix email addresses and clarify the notes. * tests/backref.sh: Fix trivial typos. 2005-02-08 Bruno Haible <bruno@clisp.org> (tiny change) * src/kwset.h (kwsincr, kwsprep): Change return type to 'const char *'. * src/kwset.c (kwsincr, kwsprep): Likewise. 2005-02-08 Arnold D. Robbins <arnold@skeeve.com> Stepan Kasal <kasal@ucw.cz> * src/mbsupport.h: Don't say the file is part of GAWK. Make wording in explanatory comment more generic. 2005-02-07 Stepan Kasal <kasal@ucw.cz> * src/grep.c: Document that -X is undocumented. 2005-01-16 Bruno Haible <bruno@clisp.org> (tiny change) Stepan Kasal <kasal@ucw.cz> * configure.in: Add tests for iswctype, mbrlen, wcrtomb, wcscoll; use AC_FUNC_MBRTOWC to check for mbrtowc and mbstate_t; move AC_MBSTATE_T below it. * src/grep.c: Include mbsupport.h to define MBS_SUPPORT uniformly. * src/mbsupport.h: Don't test for HAVE_WCTYPE_T. 2005-01-13 Arnold D. Robbins <arnold@skeeve.com> * src/dfa.c (dfaparse): Use LC_COLLATE whenever it is defined; ENABLE_NLS has nothing to do with this. 2005-01-07 Stepan Kasal <kasal@ucw.cz> * tests/status.sh: Added two tests--option '-s' should have no influence on the exit status. 2004-12-16 Stepan Kasal <kasal@ucw.cz> Cosmetic changes, mostly imported from gawk: * src/dfa.c (lexstart): Removed unused variable. (parse_bracket_exp_mb): Don't initialize different pointers in one assignment (lex): Don't initialize automatic arrays, it's invalid in pre-C89 compilers. Various other typos. * src/dfa.h, src/grep.c, src/search.c: Typos. 2004-12-16 Isamu Hasegawa <isamuh@jp.ibm.com> From http://oss.software.ibm.com/linux/patches/?patch_id=25 * src/search.c: Patch for i18n correctness. * src/grep.c: Likewise. * src/dfa.c: Likewise. * lib/regex.c: Likewise. 2004-12-15 Julian Foad <julianfoad@btopenworld.com> Changes to documentation and help text, mostly from Stepan Kasal. * doc/grep.texi: Minor fixes of phrasing. * doc/grep.1: Likewise. * src/grep.c: Likewise. 2004-12-01 Stepan Kasal <kasal@ucw.cz> * src/grep.c (usage): Use "FILE_PATTERN" for --include and --exclude, change "only print" to "print only". * doc/grep.1: Likewise; state that wildcard matching is used. Move some options so that they are sorted alphabetically. * dfa.c, NEWS: Fix typos. 2004-11-28 Benno Schulenberg <benno@nietvergeten.nl> (tiny change) * src/grep.c (usage): Clean up several details in the usage string. * doc/grep.1: Fix descriptions of --include and --exclude. * doc/grep.texi: Likewise. 2004-11-23 Stepan Kasal <kasal@ucw.cz> * src/Makefile.am: The egrep and fgrep script now use their own path to construct the full pathname of grep. 2004-11-23 Stepan Kasal <kasal@ucw.cz> * src/Makefile.am: Merged the rules for creating the egrep and fgrep script. 2004-11-23 Stepan Kasal <kasal@ucw.cz> * src/grep.c (usage): Make sure both copies of the "usage" strings match. Add "(C)" to the copyright notice. * src/dfa.c: Changed "out of memory" to "memory exhausted" to match messages elsewhere in the source. 2004-11-22 Stepan Kasal <kasal@ucw.cz> * src/search.c: Use mbsupport.h . * src/dfa.c: Move the inclusion of mbsupport.h lower. 2004-11-22 Stepan Kasal <kasal@ucw.cz> * src/grep.c (main): Use PACKAGE_STRING for --version. 2004-11-20 Benno Schulenberg <benno@nietvergeten.nl> (tiny change) * src/grep.c (reset): Move the stat check ... (grepfile): ... here, and also check for a fifo. 2004-11-20 Stepan Kasal <kasal@ucw.cz> This change is based on a suggestion by Elliott Hughes. * src/grep.c (usage): Use PACKAGE_BUGREPORT. * po/*.po: Hacked the current translation again. 2004-11-20 Stepan Kasal <kasal@ucw.cz> * configure.in: Added a copyright notice (using gawk as a template). (AC_INIT, AM_INIT_AUTOMAKE): Changed to the "new" form so that the PACKAGE_* symbols get defined correctly in config.h. 2004-11-20 Stepan Kasal <kasal@ucw.cz> * ./cvsignore: Amended several .cvsignore files and removed *.gmo, acinclude.m4 and stamp-h.in from the root one. * m4/init.m4: Nuked, it was breaking current automake. * m4/Makefile.m4: Removed init.m4. * autogen.m4: Drop support for legacy autoconf; tell whether the auto tools exited successfully or not; fix the permissions of tests/*.sh--CVS doesn't provide a way to fix it. 2004-11-19 Stepan Kasal <kasal@ucw.cz> * src/dfa.c: Removed old version of gofast patch, from 2003-05-30. * src/search.c (check_multibyte_string): Likewise. 2004-11-19 Stepan Kasal <kasal@ucw.cz> * src/dfa.c: Added some simple changes from gawk. * src/mbsupport.h: Imported from gawk. 2004-11-11 Stepan Kasal <kasal@ucw.cz> * tests/spencer1.awk: Use only lines with 3 fields. * tests/spencer1.tests: Disable #55 for now. * tests/ere.tests, tests/bre.tests: Add "TO CORRECT" to disabled tests which had empty $4. * tests/backref.sh: Modify #2 so that current glibc regex can handle it in finite time. 2004-11-12 Stepan Kasal <kasal@ucw.cz> Change bug-gnu-utils address to bug-grep, on many places; there is no need to have the word "grep" in subject then. Thanks to Tony Abou-Assaleh and Benno Schulenberg for pointing out this. 2004-11-02 Stepan Kasal <kasal@ucw.cz> * README-alpha: Remove obsolete instructions about CVS, redirect the reader to savannah web. 2004-09-26 Stepan Kasal <kasal@ucw.cz> * src/search.c (check_multibyte_string, Gcompile, Ecompile): Replace malloc with xmalloc. * src/dfa.c (dfamust): Replace two calls to 'malloc' by MALLOC. 2003-07-23 Stepan Kasal <kasal@ucw.cz> * src/Makefile.am: Add the egrep and fgrep scripts to CLEANFILES. 2003-07-23 Stepan Kasal <kasal@ucw.cz> * tests/backref.sh: Messages fixed. 2003-07-08 David Kaelbling <drk@sgi.com> (tiny change) * src/dfa.c: remove non-constant initializers from dfa.c 2003-06-16 Stepan Kasal <kasal@ucw.cz> * doc/grep.1: two typos "--line-buffered [...] penalty" * doc/grep.texi: a typo 2003-06-12 Bernhard Rosenkraenzer <bero@arklinux.org> * README-alpha: Mention bug tracking system and grep-devel-list * tests/spencer1.tests: Fix test 55, as noted by Tim Waugh * src/search.c: Speed up multibyte support (Patch from Tim Waugh) 2003-06-05 Stepan Kasal <kasal@ucw.cz> * tests/formatbre.awk, tests/formatere.awk: probably unused, so I've removed them. 2003-06-05 Stepan Kasal <kasal@ucw.cz> * intl/Makefile: remove generated file. 2003-06-04 Stepan Kasal <kasal@ucw.cz> * src/dfa.c: typos fixed. 2003-05-30 Bernhard Rosenkraenzer <bero@arklinux.org> * src/dfa.c: Speed up multibyte support (Patch from Tim Waugh) 2003-01-18 Bernhard Rosenkraenzer <bero@arklinux.org> * src/grep.c: Fix -i -o combination (Patch from Tim Waugh) 2002-03-26 Bernhard Rosenkraenzer <bero@arklinux.org> * 2.5.1 Release. 2002-03-26 Bernhard Rosenkraenzer <bero@arklinux.org> * src/grep.c: Don't fail if we don't have an stdout fd and -q is used (happens e.g. on calls from hotplug scripts) * src/grep.c: Don't hang forever if fed with an empty string to grep for and --color enabled * src/grep.c: Fix infinite loop on echo "1 one" | grep -E "[0-9]*" -o echo "1 one" | grep -E "[0-9]*" --color * po/*: Sync with translation project * src/grep.c, src/Makefile.am, configure.in: Add patch from Paul Eggert <eggert@twinsun.com> to comply with ridiculous guidelines (don't act differently if invoked as egrep or fgrep) * configure.in: Bump version number, require a recent autoconf 2002-03-14 Bernhard Rosenkraenzer <bero@arklinux.org> * src/Makefile.am, po/Makefile.in.in: Support DESTDIR properly * tests/bre.tests: Add fix from Peter Breitenlohner <peb@mppmu.mpg.de> 2002-03-13 Bernhard Rosenkraenzer <bero@arklinux.org> * configure.in, m4/regex.m4, m4/malloc.m4, m4/realloc.m4: Don't set LIBOBJS directly, autoconf 2.53 doesn't like it * intl/*: Sync with gettext 0.11 * po/*: Sync with translation project * configure.in, src/Makefile.am: Don't duplicate code - make egrep and fgrep links to grep and set matcher based on application name, suggestion from Guillaume Cottenceau <gc@mandrakesoft.com> * src/grep.c: (prline) Add fix for -i --color from Jim Meyering <meyering@lucent.com> * configure.in: Version 2.5; release 2002-01-23 Bernhard Rosenkraenzer <bero@arklinux.org> * configure.in: Version 2.5g * Makefile.cvs, grep.spec: Add packaging tools Merge djgpp changes from Andrew Cottrell <anddjgpp@ihug.coml.au>: * src/grep.c: Added conditional compilation for DJGPP * djgpp: remove directory as it is no longer required with DJGPP 2.03 (or 2.04 when released) * README.DOS: Moved djgpp/readme to readme.dos * PATCHES.AC, PATCHES.AM: delete files - redundant * configure.in, Makefile.am: remove djgpp directory from list 2002-01-22 Bernhard Rosenkraenzer <bero@arklinux.org> * doc/grep.texi, doc/grep.1, NEWS: Document --label * po/ru.po: Sync with translation project * po/grep.pot: Sync with source 2002-01-18 Bernhard Rosenkraenzer <bero@arklinux.org> * src/grep.c: Add --label, based on patch from Stepan Koltsov 2001-11-20 Bernhard Rosenkraenzer <bero@arklinux.org> * autogen.sh: Don't hardcode aclocal dir 2001-11-19 Bernhard Rosenkraenzer <bero@arklinux.org> * src/grep.c: Add --only-matching (-o) switch (see NEWS) * doc/grep.texi, doc/grep.1, NEWS: Document changes * configure.in, lib/Makefile.am: Don't use internal getopt if we're on a system that provides a working getopt function 2001-09-25 Bernhard Rosenkraenzer <bero@arklinux.org> * configure.in: Detect pcre correctly even when it's in non-standard locations, using pcre-config * src/grep.c: Add --color={always,never,tty} argument (like in ls) * src/grep.c: Turn off blinking in the default colorization * src/grep.c: Add --devices (-D) switch (analogous to --directories) * src/dfa.c: Fix an i18n bug: echo "A" | grep '[A-Z0-9]' wouldn't work in non-C-Locales on systems using current versions of glibc. * AUTHORS: Change maintainer, credit Alain for his work until now * configure.in, m4/decl.m4, m4/dosfile.m4, m4/gettext.m4, m4/init.m4, m4/install.m4, m4/largefile.m4, m4/lcmessage.m4, m4/header.m4, m4/isc-posix.m4, m4/missing.m4, m4/progtest.m4, m4/sanity.m4: Fix build with autoconf 2.5x, retain 2.1x compatibility for now * autogen.sh: Add some crude hacks to make it possible to build with both autoconf 2.5x and 2.1x * acconfig.h: removed (no longer required) * Makefile.am: add cvs-clean target * doc/grep.texi, doc/grep.1, NEWS: Document changes (--color, --devices, -D) * src/dfa.c, src/grep.c: Add vim modelines 2001-08-30 Alain Magloire * configure.in: Add gl in ALL_LINGUAS. 2001-08-30 Kurt D Schwehr * doc/grep.1: Warn that grep insert a "--" between groups of matches, when using the context options. * doc/grep.texi: Likewised. 2001-08-25 Heikki Korpela * doc/grep.texi: Point out that some Platforms do not support reading of directories and silently ignore them. 2001-08-21 Alain Magloire * lib/malloc.c: New file: * lib/realloc.c: New file: * lib/Makefile.am: Add malloc.c and realloc.c in EXTRA_DIST. 2001-07-31 Alain Magloire * po/*.po: New files from the translation team: grep-2.5e.de.po grep-2.5e.el.po grep-2.5e.eo.po grep-2.5e.es.po grep-2.5e.et.po grep-2.5e.fr.po grep-2.5e.gl.po grep-2.5e.it.po grep-2.5e.pl.po grep-2.5e.sl.po 2001-07-31 Andreas Schwab * src/grep.c: Fix all uses of error to pass a proper format string. 2001-07-29 Alain Magloire * grep/src/grep.c (usage): Typos corrected. Patches from Santiago Vila. 2001-07-29 Alain Magloire David Clissold, wrote: a small bug in the GNU grep 2.4.2, which may have gone unnoticed because it only causes a failure if building on a system with large files enabled (e.g. an "off_t" is a "long long" rather than a "long"). savedir() takes on off_t argument, but in grepdir() the parameter is cast to an (unsigned). Well, if an off_t is larger than an int, the value gets truncated. This would not normally have an effect on a little-endian platform (unless the file is >2GB), but on a big-endian system it will always fail. The external effect is that "grep -r foo dir_name" fails with ENOMEM (from malloc() within savedir()). * grep/src/grep.c (grepdir): Remove the (unsigned) cast when calling savedir(). Patch from David Clissold. 2001-07-29 Alain Magloire * grep/doc/grep.texi: In Bugs report use {n,m} for consistency. * grep/doc/grep.1: Likewised. Noted by Steven Lucy. 2001-04-27 Isamu Hasegawa * dfa.c (mblen_buf) : New variable contains the amount of remain byte of corresponding multibyte character in the input string. (SKIP_REMAIN_MB_IF_INITIAL_STATE) : Use mblen_buf. (match_anychar) : Use mblen_buf. (match_mb_charset) : Use mblen_buf. (transit_state_consume_1char) : Use mblen_buf. (transit_state) : Use inputwcs to get current (multibyte) character. (dfaexec) : Add initialization of mblen_buf. 2001-04-27 Isamu Hasegawa * dfa.c (addtok) : Set appropriate value to multibyte_prop. (dfastate) : Add the initialization of the variable. (dfaexec) : Call transit_state if d->fail may transit by multibyte characters. (transit_state_singlebyte) : Clean up unnecessary code. (transit_state_consume_1char) : Likewise. (transit_state) : Add checking for word and newline. 2001-04-19 Isamu Hasegawa * search.c (check_multibyte_string) : Check the case when mbclen == 0. 2001-04-11 Isamu Hasegawa * search.c (check_multibyte_string) : Check the head of multibyte characters, and optimize a bit. (EGexecute) : Optimize a bit. (Fexecute) : Fix the index. 2001-04-02 Alain Magloire * lib/regex.c: Update from GNU lib C, with the changes provided by Paul Eggert. * lib/posix/regex.h: Likewise. 2001-02-17 Paul Eggert Stop trying to support hosts that have nonstandard declarations for mbrtowc and/or mbstate_t. It's not worth the portability hassle. * lib/quotearg.c (mbrtowc, mbsinit): Remove workaround macros for hosts that have mbrtowc but not mbstate_t, as we now insist on proper declarations for both before using mbrtowc. 2001-03-18 Alain Magloire * configure.in: Call AC_MBSTATE_T. * Makefile.am: Add mbstate_t.m4 * m4/Makefile.am: Add mbstate_t.m4 * m4/mbstate_t.m4: New m4 macro. * lib/strtol.c: Define CHAR_BITS. Uwe H. Steinfeld, Ruslan Ermilov, Volkert Bochert, noted that mbstate_t was not define for certain platforms. 2001-03-18 Paul Eggert * src/grep.c (fillbuf): Fix storage allocation performance bug: buffer was doubling in size in many cases where it didn't have to. 2001-03-17 Paul Eggert * src/grep.c (fillbuf): Avoid unnecessary division by 2. Don't check xrealloc return value; it's guaranteed to be nonzero. (fillbuf, grepdir): Use xalloc_die rather than error; it's shorter. 2001-03-17 Alain Magloire * src/grep.c (context_length_arg): error () passing wrong format. Spotted by Jim Meyering. 2001-03-07 Alain Magloire * README-alpha: Removed reference to GNU tar, add the location of the CVSROOT. 2001-03-06 Alain Magloire Only the Regex patterns should be split in an array, patterns[]. The dfa and KWset compiled patterns should remain global and the patterns compiled all at once. * src/search.c: include "error.h" and "xalloc.h" to get prototyping of x*alloc() and error(). (kwsinit): Reverse to previous behaviour and takes no argument. (kwsmusts): Likewised. (Gcompile): For the regex pattern, split them and each pattern is put in different compiled structure patterns[]. The patterns are given to dfacomp() and kwsmusts() as is. (Ecompile): Likewised. (Fcompile): Reverse to the old behaviour of compiling the enire patterns in one shot. (EGexecute): If falling to GNU regex for the matching, loop in the array of compile patterns[] to find a match. (error): Many error () were call with arguments in the wrong order. * tests/file.sh: Simple test to check for pattern in files. Reaction to bug report fired by Greg Louis <glouis@dynamicro.on.ca> 2001-03-06 Isamu Hasegawa In multibyte environments, handle multibyte characters as single characters in bracket expressions. * src/dfa.h (mb_char_classes) : new structure. (mbcsets): new variable. (nmbcsets): new variable. (mbcsets_alloc) : new variable. * src/dfa.c (prtok) : handle MBCSET. (fetch_wc): new function to fetch a wide character. (parse_bracket_exp_mb) : new function to handle multibyte character in lex(). (lex): invoke parse_bracket_exp_mb() for multibyte bracket expression. (atom): handle MBCSET. (epsclosure): likewise. (dfaanalyze): likewise. (dfastate): likewise. (match_mb_charset): new function to judge whether a bracket match with a multibyte character. (check_matching_with_multibyte_ops) : handle MBCSET. (dfainit): initialize new variables. (dfafree): free new variables. 2001-03-04 Alain Magloire To get more in sync with other GNU utilities like GNU tar and fetish all the supporting functions are now under lib. Thanks to Jim Meyering, Volkert Bochert and Paul Eggert for the code and the reminders. * src/grep.c (fatal): Function removed, using error () from lib/error.c instead. (usage): Copyright updated. (error): Function removed, using error () from lib/error.c instead, adjust prototypes. (prog): Global variable rename to program_name, to work with new lib/error.c. (xrealloc): Removed using lib/xmalloc.c. (xmalloc): Removed using lib/xmalloc.c (main): Register with atexit() to check for error on stdout. * configure.in: Check for atexit(), call jm_MALLOC, jm_RELLOC and jm_PREREQ_ERROR. * tests/bre.awk: Removed the hack to drain the buffer since we always fclose(stdout) atexit. * tests/ere.awk: Likewise. * tests/spencer1.awk: Likewise. * bootstrap/Makefile.try: Update the Makefile to reflect the changes in the new hierarchy. * README-alpha: New File. * m4/realloc.m4: New File. * m4/malloc.m4: New File. * m4/error.m4: New File. * m4/Makefile.am: Updated. * lib: New directory. * lib/Makefile.am: New file. * lib/closeout.c: New file. * lib/closeout.h: New file. * lib/fnmatch.c: New file. * lib/fnmatch.h: New file. * lib/atexit.c: New file. * lib/error.c: New file. * lib/error.h: New file. * lib/quotearg.h: New file. * lib/quotearg.c: New file. * lib/xmalloc.c: New file. * lib/posix: New directory. * lib/posix/Makefile.am: New file. * src/getopt.c: Moved to lib. * src/getopt1.c: Moved to lib. * src/getopt.h: Moved to lib. * src/alloca.c: Moved to lib. * src/exclude.c: Moved to lib. * src/exclude.h: Moved to lib. * src/hard-locale.h: Moved to lib. * src/hard-locale.c: Moved to lib. * src/isdir.c: Moved to lib. * src/mechr.c: Moved to lib. * src/obstack.c: Moved to lib. * src/obstack.h: Moved to lib. * src/regex.c: Moved to lib. * src/regex.h: Moved to lib. * src/posix: Moved to lib. * src/posix/regex.h: Moved to lib. * src/savedir.h: Moved to lib. * src/savedir.c: Moved to lib. * src/stpcpy.c: Moved to lib. * src/strtoul.c: Moved to lib. * src/strtol.c: Moved to lib. * src/strtoull.c: Moved to lib. * src/strtoumax.c: Moved to lib. * src/xstrtol.c: Moved to lib. * src/xstrtol.h: Moved to lib. * src/xstrtoumax.c: Moved to lib. 2001-03-01 Isamu Hasegawa Implement the mechanism to match with multibyte characters, and use it for 'period' in multibyte environments. * dfa.h (mbps): new variable. * dfa.c (prtok): handle ANYCHAR. (lex): use ANYCHAR for 'period' in multibyte environments. (atom): handle ANYCHAR. (state_index): initialize mbps in multibyte environments. (epsclosure): handle ANYCHAR. (dfaanalyze): handle ANYCHAR. (dfastate): handle ANYCHAR. (realloc_trans_if_necessary): new function. (transit_state_singlebyte): new function. (match_anychar): new function. (check_matching_with_multibyte_ops): new function. (transit_state_consume_1char): new function. (transit_state): new function. (dfaexec): invoke transit_state if expression can match with a multibyte character in multibyte environments. (dfamust): handle ANYCHAR. 2001-03-01 Alain Magloire * src/exclude.c: New file. * src/exclude.h: New file. * src/grep.c (main): Took the GNU tar code to handle the option --include, --exclude, --exclude-from. Files are check for a match, with exlude_filename (). New option --exclude-from. * src/savedir.c: Call exclude_filename() to check for file pattern exclusion or inclusion. * configure.in: --disable-pcre rename to --disable-perl-regexp. 2001-02-25 Alain Magloire * src/dfa.c: Typo corrected. Noted by Isamu Hasegawa. * src/savedir.c: Typos corrected. 2001-02-22 Alain Magloire * src/savedir.c (isdir1): New function, calling isdir with the correct pathname. 2001-02-19 Isamu Hasegawa Avoid incorrect state transition in multibyte environments. * dfa.h (nmultibyte_prop): new variable. (multibyte_prop): new variable. * dfa.c (addtok): set inputwcs. (dfastate): avoid incorrect state transition in multibyte environments. (dfaexec): likewise. (dfainit): init multibyte_prop. (dfafree): free multibyte_prop. (inputwcs): new variable. 2001-02-19 Isamu Hasegawa Handle a multibyte character followed by '*', '+', and '{n,m}' correctly. * dfa.c (update_mb_len_index): new function. Support for multibyte string. (FETCH): call update_mb_len_index. (lex): check cur_mb_index not to misunderstand multibyte characters. (atom): make a tree from a multibyte character. (dfaparse): initialize new variables. (mbs): new variable. (cur_mb_len): new variable. (cur_mb_index): new variable. 2001-02-18 Jim Meyering * m4/dosfile.m4 (AC_DOSFILE): Move AC_DEFINEs out of AC_CACHE_CHECK. 2001-02-17 Alain Malgoire * doc/grep.texi: Document the new options and the new behaviour back-references are local. Use excerpt from Karl Berry regex texinfo. * bootstrap/Makefile.try: Added xstrtoumax.o xstrtoul.o hard-local.o 2001-02-17 Alain Magloire From Guglielmo 'bond' Bondioni : The bug was that using a multi line file that contained REs (one per line), backreferences in the REs were considered global (to the file) and not local (to the line). That is, \1 in line n refers to the first \(.\) in the whole file, rather than in the line itself. From Tapani Tarvainen : # Re: grep -e '\(a\)\1' -e '\(b\)\1' That's not the way it should work: multiple -e arguments should be treated as independent patterns and back references should not refer to previous ones. From Paul Eggert : GNU grep currently does not issue diagnostics for the following two cases, both of which are erroneous: grep -e '[' -e ']' grep '[ ]' POSIX requires a diagnostic in both cases because '[' is not a valid regular expression. To overcome those problems, grep no longer pass the concatenate patterns to GNU regex but rather compile each patterns separately and keep the result in an array. * src/search.c (patterns): New global variable; a structure array holding the compiled patterns. Declare function prototypes to minimize error. (dfa, kswset, regexbuf, regs): Removed, no longer static globals, but rather fields in patterns[] structure per motif. (Fcompile): Alloc an entry in patterns[] to hold the regex. (Ecompile): Alloc an entry per motif in the patterns[] array. (Gcompile): Likewise. (EGexecute): Loop through of array of patterns[] for a match. 2001-02-17 Alain Magloire From Bernd Strieder : # tail -f logfile | grep important | do_something_urgent # tail -f logfile | grep important | do_something_taking_very_long If grep does full buffering in these cases then the urgent operation does not happen as it should in the first case, and in the second case time is lost due to waiting for the buffer to be filled. This is clearly spoken not grep's fault in the first place, but libc's. There is a heuristic in libc that make a stream line-buffered only if a terminal is on the other end. This doesn't take care of the cases where this connection is somehow indirect. * src/grep.c (line_buffered): new option variable. (prline): if line_buffered is set fflush() is call. (usage): line_buffered new option. Input from Paul Eggert, doing setvbuf() may not be portable and breaks grep -z. 2001-02-16 Alain Magloire Patch from Isamu Hasegawa, for multibyte support. This patch prevent kwset_matcher from following problems. For example, in SJIS encoding, one character has the codepoint 0x895c. So the second byte of the character can match with '\' incorrectly. And in eucJP encoding, there are the characters whose codepoints are 0xa5b9, 0xa5c8. On the other hand, there is one character whose codepoint is 0xb9a5. So 0xb9a5 can match with 2nd byte of 0xa5b9 and 1st byte of 0xa5c8. * configure.in: Add check for mbrtowc. * src/search.c (check_multibyte_string): new function. Support for multibyte string. (EGexecute): call check_multibyte_string when kwset is set. (Fexecute): call to check_multibyte_string. (MBS_SUPPORT): new macro. (MB_CUR_MAX): new macro. 2001-02-16 Alain Magloire * djgpp/config.bat: Fix for 4dos.com. * m4/dosfile.m4 (HAVE_DOS_FILE_CONTENTS): Was not set. Bugs noted and patched by Juan Manuel Guerrero. 2001-02-16 Alain Magloire A much requested feature, the possibility to select files when doing recurse : # find . -name "*.c" | xargs grep main {} # grep --include=*.c main . # find . -not -name "*.c" | xargs grep main {} # grep --exclude=*.c main . * src/grep.c (short_options): -R equivalent to -r. (#ifdef) : Fix some inconsistencies in the use of #ifdefs, prefer #if defined() wen possible. (long_options): Add --color, --include and exclude. (Usage): Description of new options. (color): Rename color variable to color_option. Removed 'always|never|auto' arguments, not necessary for grep. (exclude_pattern): new variable, holder for the file pattern. (include_pattern): new variable, hoder for the file pattern. * src/savedir.c: Signature change, take two new argmuments. * doc/grep.texi: Document, new options. * doc/grep.man: Document, new options. 2001-02-09 Alain Magloire * src/grep.c (long_options): Added equivalent to -r with -R. * src/grep.c (usage): added --color and --colour. Noted with patch from, H.Merijn Brand and Wichert Akkerman. 2001-02-09 Alain Magloire Patch from Ulrich Drepper to provide hilighting. * src/grep.c: New option --color. (color): New static var. (COLOR_OPTION): new constant. (grep_color): new static var. (prline): Now when color is set prline() will call the current matcher to find the offset of the matching string. * src/savedir.c: Take advantage of _DIRENT_HAVE_TYPE if supported. * src/search.c (EGexecute, Fexecute, Pexecute): Take a new argument when doing exact match for the color hiligting. 2000-09-01 Brian Youmans * doc/grep.texi: Typo fixes. 2000-08-30 Paul Eggert * doc/grep.texi (Usage): Talk about what "grep -r hello *.c" means. 2000-08-20 Paul Eggert Handle range expressions correctly even when they match strings with two or more characters. * src/dfa.h (CRANGE): New enum value. Comment fix. * src/dfa.c: Include <locale.h> if HAVE_SETLOCALE. Include "hard-locale.h". (prtok): Print CRANGE. (hard_LC_COLLATE): New static var. (lex): Return CRANGE when parsing a character range in a hard locale. Don't use strcoll; it's no longer needed and wasn't correct anyway. Use unsigned rather than token to hold unsigned chars. (addtok): Comment fix. (atom): Treat a CRANGE as if it were (.\1), approximately. (dfaparse): Initialize hard_LC_COLLATE. * src/Makefile.am (base_sources): Add hard-locale.c, hard-locale.h. * src/hard-locale.c, src/hard-locale.h: New files, taken from textutils. 2000-08-20 Paul Eggert * tests/Makefile.am (TESTS_ENVIRONMENT): Add LC_ALL=C, since some of the tests assume the C locale. 2000-08-16 Paul Eggert * src/search.c (Gcompile, Ecompile): -x overrides -w, for consistency with fgrep. Don't assume that sizes fit in 'int'. Fix comments to match code. 2000-06-06 Paul Eggert * src/grep.c (grepdir): Don't look at st_dev when testing for Mingw32 bug. 2000-06-05 Paul Eggert Port to Mingw32, based on suggestions from Christian Groessler <cpg@aladdin.de>. * src/isdir.c: New file, taken from fileutils. * src/Makefile.am (base_sources): Add isdir.c. * src/grep.c (grepfile): Use isdir instead of doing it inline. (grepdir): Suppress ancestor check if the directory's inode and device are both zero, as that occurs only on Mingw32 which doesn't support inode or device. * src/system.h (isdir): New decl. (is_EISDIR): Depend on HAVE_DIR_EACCES_BUG, not D_OK. Use isdir, not access. 2000-06-02 Paul Eggert Problen noted by Gerald Stoller <gerald_stoller@hotmail.com> * src/grep.c (main): POSIX says that -q overrides -l, which in turn overrides the other output options. Fix grep to behave that way. 2000-05-27 Paul Eggert Simplify and tune the buffer allocation strategy. Do not reserve a large save area: reserve only enough bytes to hold the residue, plus page alignment. Put a newline sentinel before the buffer, for speed when searching backwards for newline. * src/grep.c (ubuffer, bufsalloc, PREFERRED_SAVE_FACTOR, page_alloc): Remove. All uses changed. (INITIAL_BUFSIZE): New macro. (reset, fillbuf): Use simpler buffer allocation strategy. (reset): Check for preposterously large pagesize that would cause later calculations to overflow. (fillbuf): Do not resize buffer if there's room at the end for at least one more page. This greatly increases performance when reading from non-regular files that contain no newlines. When growing the buffer, double its size instead of using a more complicated algorithm. (prtext, grep): Speed up by relying on the newline sentinel before the start of the buffer. (grep): When looking backwards for the last newline in a buffer, stop when we hit the residue, since it can't contain a newline. This avoids an O(N**2) algorithm when reading binary data from a pipe. Use a sentinel to speed up the backward search for newline. (nlscan): Undo previous change; it wasn't needed and just complicates and slows down the code a tad. 2000-05-24 Paul Eggert Handle very large input counts better. Bug noted by Jim Meyering. * src/grep.c (totalcc, totalnl): Use uintmax_t, not off_t. (add_count): New function. (nlscan, prline, grep): Use it to check line and byte count overflows. (nlscan, grep): Don't keep track of counts when not asked to; this avoids unnecessary overflow diagnostics. (print_offset_sep): Now takes args of type uintmax_t and char, not off_t and int. 2000-05-16 Paul Eggert Problem reported by Bob Proulx <rwp@hprwp.fc.hp.com>, this patch is base on his finding, with appropriate corrections. * src/grep.c (main): Fix bug: -x and -w matched even when no patterns were specified. * tests/empty.sh: Test for -x and -w bug in grep 2.4.2. 2000-04-24 Paul Eggert POSIX conformance fixes: grep -q now exits with status zero if an input line is selected, even if an error also occurs. grep -s no longer affects exit status. * src/grep.c (suppress_errors): Move definition earlier so that suppressible_error can use it. (suppressible_error): New function. (exit_on_match): New var. (grepbuf): If exit_on_match is nonzero, exit with status zero immediately. (grep, grepfile, grepdir): Invoke suppressible_error. (main): -q sets exit_on_match. * doc/grep.1, doc/grep.texi, NEWS: Document -q's behavior as required by POSIX. * tests/status.sh: Test for -q and -s behavior as conforming to POSIX. 2000-04-20 Paul Eggert * tests/Makefile.am (TESTS_ENVIRONMENT): Set GREP_OPTIONS to the empty string. 2000-04-20 Paul Eggert * tests/status.sh: Fix typo: test -b -> test -r. 2000-04-20 Paul Eggert * src/dfa.c (lex): Do not assume that [c] is equivalent to [c-c]; this isn't true if LC_COLLATE specifies that some characters are equivalent. (setbit_case_fold): New function. (lex): Use it to simplify the code a bit. 2000-04-17 Paul Eggert Do CRLF munging only if HAVE_DOS_FILE_CONTENTS, instead of having it depend on O_BINARY (which leads to incorrect results on BeOS, VMS, and MacOS). * bootstrap/Makefile.try (DEFS): Add -DHAVE_DOS_FILE_CONTENTS. * src/system.h (SET_BINARY): Define only if HAVE_DOS_FILE_CONTENTS. (O_BINARY): Do not define. * m4/dosfile.m4: Define HAVE_DOS_FILE_CONTENTS if it appears we're using DOS. * src/grep.c (undossify_input, fillbuf, dosbuf.c, prline, main): Depend on HAVE_DOS_FILE_CONTENTS, not O_BINARY, when handling CRLF matters. (grepfile, main): Depend on SET_BINARY, not O_BINARY, when handling binary files on hosts that care about text versus binary. 2000-04-17 Paul Eggert * lib/getpagesize.h (getpagesize): Define to B_PAGE_SIZE if __BEOS__ is defined. Based on a fix by Bruno Haible <haible@clisp.cons.org>. 2000-04-17 Bruno Haible * src/system.h [BeOS]: Ignore O_BINARY. * src/getpagesize.h [BeOS]: Define getpagesize() as B_PAGE_SIZE. 2000-04-10 Paul Eggert * doc/grep.1, doc/grep.texi, NEWS: -C now requires an operand. * src/grep.c (short_options, long_options, main, usage): Likewise. (context_length_arg): Renamed from ck_atoi. Now reports an error and exits if the number is out of range for a context length. (get_nondigit_option): New function, which checks for overflow correctly, and which does not parse nonadjacent strings of digits into a single number. (main): Use get_nondigit_option instead of doing the code inline. With -A, -B, and -C, optarg is now guaranteed to be nonzero. 2000-04-08 Paul Eggert Now that we know that the input is always terminated by a newline before the matching algorithms see it, clean up the matching algorithms so that they no longer need to modify the input by inserting a sentinel newline, and no longer worry about running off the end of the buffer due to a missing sentinel. * src/grep.c (nlscan, prpending, prtext, grepbuf): Do not worry about running off the end of the input buffer, since it's now guaranteed to end in the sentinel newline. * src/search.c (EGexecute, Pexecute): Likewise. * src/dfa.c (prtok, dfasyntax, dfaparse, copy, merge, state_index, epsclosure, dfaexec, dfacomp): Change many instances of "T *" to "T const *", to catch any inadvertent programming errors made during this conversion. * src/dfa.h (dfacomp, dfaexec, dfaparse): Likewise. * src/grep.c (struct stats.parent, long_options, grepdir, compile, execute, fillbuf, lastnl, lastout, nlscan, prline, prpending, prtext, grepbuf, grep, grepfile, grepdir): Likewise. * src/grep.h (struct matcher.compile, struct matcher.execute): Likewise. * src/kwset.c (struct kwset.trans, kwsalloc, kwsincr, treefails, treedelta, hasevery, treenext, bmexec, cwexec, kwsexec): Likewise. * src/kwset.h (kwsalloc, kwsincr, kwsexec): Likewise. * src/search.c (kwsmusts, Gcompile, Ecompile, EGexecute, Pcompile, Pexecute): Likewise. * src/dfa.c (dfaexec): Use size_t, not char *, to avoid worrisome casts to convert char const * to char *. * src/dfa.h (dfaexec): Likewise. * src/grep.c (execute): Likewise. * src/grep.h (execute): Likewise. * src/kwset.c (bmexec, cwexec, kwsexec): Likewise. * src/kwset.h (struct kwsmatch.offset, kwsalloc, kwsincr, kwsexec): Likewise. * src/search.c (EGexecute, Fexecute, Pexecute): Likewise. * src/dfa.h (_PTR_T): Depend on defined __STDC__, not __STDC__. (PARAMS): Depend on PROTOTYPES, not __STDC__. * src/dfa.c (dfasyntax): Last arg is unsigned char, not int. * src/dfa.h (dfasyntax): Likewise. * src/dfa.h (struct dfa): Remove member newlines; no longer needed. * src/dfa.c (build_state, dfaexec, dfafree): Do not worry about special newline state. * src/search.c (matchers): Move definition to end of file, so that we don't need forward decls. (lastexact): Remove. (kwset_exact_matches): New var; subsumes old lastexact var. All uses changed. * src/dfa.c (index): Remove macro. (REALLOC_IF_NECESSARY): Skip unnecessary test. (tstbit, setbit, clrbit): Declare arg to be unsigned, to help compiler. (copyset, zeroset, equal): Use C builtin primitives, to help compiler. (dfaexec): Do not modify input string. Remove newline parameter; no longer needed. (comsubs): Use strchr, not index. * src/grep.h (matchers): Use fixed name size, not pointer (as there's no need for the extra flexibility). All uses changed. * src/kwset.h (struct kwsmatch.offset): Renamed from beg, with change of type to size_t. All uses changed. * src/grep.c (reset): No longer need kludge for dfaexec. Simplify. (reset, grepbuf): Adjust to new interface for 'execute'. (install_matcher): List is now terminated by null compile, not null name. Do not invoke setrlimit if that wouldn't change the limit. * src/dfa.c (xcalloc, xmalloc, xrealloc, prtok, tstbit, setbit, clrbit, copyset, zeroset, notset, equal, charclass_index, looking_at, lex, addtok, atom, nsubtoks, copytoks, closure, branch, regexp, copy, insert, merge, delete, state_index, build_state, build_state_zero, icatalloc, icpyalloc, istrstr, ifree, freelist, enlist, comsubs, addlists, inboth): Remove forward decls; no longer needed. * src/grep.c (ck_atoi, usage, error, setmatcher, install_matcher, prepend_args, prepend_default_options, page_alloc, reset, fillbuf, grepbuf, prtext, prpending, prline, print_offset_sep, nlscan, grep, grepfile): Likewise. * src/kwset.c (enqueue, treefails, treedelta, hasevery, treenext, bmexec, cwexec): Likewise. * src/search.c (Gcompile, Ecompile, EGexecute, Fcompile, Fexecute, Pcompile, Pexecute, kwsinit): Likewise. * src/search.c (Pcompile): Do not assume newly allocated storage is zeroed. 2000-04-06 Paul Eggert * doc/grep.1, doc/grep.texi, NEWS: Improve the explanation of locale-dependent behavior of range expressions. Mention LC_COLLATE, since this affects range expressions. 2000-03-26 Paul Eggert * Makefile.am (ACINCLUDE_INPUTS): Add decl.m4, inttypes_h.m4, uintmax_t.m4, ulonglong.m4, xstrtoumax.m4. * m4/Makefile.am (EXTRA_DIST): Likewise. * src/Makefile.am (base_sources): Add xstrtol.c, xstrtol.h, xstrtoumax.c. (EXTRA_DIST): Add strtol.c. * configure.in (jm_AC_TYPE_UINTMAX_T, jm_AC_PREREQ_XSTRTOUMAX, HAVE_DECL_STRTOUL, HAVE_DECL_STRTOULL): Add. (AC_REPLACE_FUNCS): Add strtoul. * src/grep.c: Include xstrtol.h. (ck_atio): Use xstrtoumax and do proper overflow checking. (max_count, outleft): Now off_t, not int. (main): Likewise. Use xstrtoumax to convert max_count from string. * acconfig.h (HAVE_DECL_STRTOUL, HAVE_DECL_STRTOULL): New #undefs. (HAVE_STPCPY, ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_LC_MESSAGES): Remove. * m4/decl.m4, m4/inttypes_h.m4, m4/uintmax_t.m4, m4/ulonglong.m4, m4/xstrtoumax.m4, src/strtol.c, src/strtoul.c, src/strtoull.c, src/strtoumax.c, src/xstrtol.c, src/xstrtol.h, src/xstrtoumax.c: New files, taken unchanged from textutils, fileutils, sh-utils and/or tar. 2000-03-23 Paul Eggert * src/search.c (Pcompile): Add support for NUL bytes in Perl regular expressions. 2000-03-23 Paul Eggert * NEWS, doc/grep.1, doc/grep.texi: Change --pcre to --perl-regexp. * src/grep.c (long_options, usage): Likewise. * doc/grep.1, doc/grep.texi: Remove pgrep program. * src/Makefile.am (bin_PROGRAMS): Likewise. (pgrep_SOURCES): Remove. * src/grep.c (main): Rename matcher from "pgrep" to "perl". * src/search.c (matchers): Likewise. * src/search.c: Do not include stdio.h; no longer needed. (NILP): Remove. (sub): No longer static. (n_pcre): Remove. (cre): No longer an array. Present only if HAVE_LIBPCRE. (extra): New variable. (Pcompile): Use fatal to report errors. This also removes a possible core dump. Add checks (marked FIXME) for restrictions in pcre. Use pcre_maketables for proper localized behavior. (Pcompile, Pexecute): Use GNU coding style. The argument is a single pattern, not a list of patterns separated by newlines; this is for consistency with grep and egrep. Use pcre_study for speed. (Pexecute): Abort if we lack pcre. Abort if pcre_exec reports an impossible error. Use code similar to the rest of search.c to narrow down to the line we've found. 2000-03-21 Alain Magloire * configure.in: added AC_CHECK_LIB(pcre, pcre_exec) * ChangeLog: Typos corrected. * src/search.c: new MACRO HAVE_LIBPCRE 2000-03-21 H.Merijn Brand * src/Makefile.am(bin_PROGRAMS): added pgrep and new macro pgrep_SOURCES. * src/search.c: new functions Pcompile() and Pexecute() to support PCRE. Update matcher[] array for pgrep. * src/grep.c: new short and long option --pcre and -P. usage() updated. 2000-03-21 Bastiaan Stougie Improvement of the -m or --max-count option. Now works for NUM > 1 and prints trailing context for the last matching line. * src/grep.c (after_last_match): Is a new off_t variable that replaces inputhwm to retain the correct input offset even after a call to fillbuf. Note that after_last_match has a different meaning than inputhwm: it always points to the offset in the input of the first byte after the last matching line, and is 0 if no matching line has been found yet. (grep): Print trailing context after the NUMth match when the -m NUM option is used. (grep): Added comment. Should have been commented already. (grepbuf): Now updates outleft correctly. This fixes the bug that the -m NUM option did not stop after NUM lines for NUM greater than 1. (grepbuf, prtext): Now update after_last_match instead of inputhwm. (fillbuf): No longer updates inputhwm. (prpending): When outputting trailing context of the max_count-th matching line, stop at the first matching line. (grepfile): Seek to after_last_match or eof, depending on the values of outleft and bufmapped. (usage): added the -m or --max-count option to the help message. * doc/grep.texi, doc/grep.1: Document the change of the -m option. 2000-03-17 Paul Eggert Add new -m or --max-count option, based on a suggestion by Bastiaan Stougie. * doc/grep.texi, doc/grep.1: Document it. * src/grep.c (short_options, long_options, main): Add it. (inputhwm): New variable. (fillbuf, prtext, grepbuf): Set it. (bufmapped): Now a macro (defined to zero) if HAVE_MMAP is not defined. (max_count, outleft): New variables. (prtext, grepbuf, grep): Don't output more than outleft lines. (grepfile): If grepping standard input, seek to the limit of what we've read before exiting. This fixes a bug with mmapped input, and is needed for proper -m support. (main): Exit immediately if -m 0 is specified. 2000-03-08 Alain Magloire * configure.in: version 2.4.2 2000-03-07 Paul Eggert * Make intl subdirectory match fileutils, tar, etc.; see intl/ChangeLog for details. * src/getpagesize.h: Reformat to match latest fileutils. * src/savedir.c (savedir): Work even if directory size is negative; this can happen with some NFS screwups. 2000-03-03 Jim Meyering * regex.m4: Make sure re_compile_pattern accepts patterns like '{1'. 2000-03-02 Alain Magloire * 2.4.1 Release 2000-02-25 Paul Eggert * configure.in (LIBOBJS): Work around automake 1.4 bug: regex.c wasn't being passed through ansi2knr on pre-ANSI hosts. (ac_use_included_regex): Fix typo in warning. * src/Makefile.am (EXTRA_DIST): Remove regex.c, as the LIBOBJS workaround means that automake now puts regex.c into DIST_COMMON. 2000-02-25 Alain Magloire * po/*.po: update of the PO files. 2000-02-22 Eli Zaretskii * doc/grep.1: Two small glitches(typos). 2000-02-18 Eli Zaretskii * djgpp/config.site (prefix, INSTALL): Use /dev/env/DJDIR instead of ${DJDIR}, so that the produced Makefile's work on any DJGPP installation. 2000-01-30 Alain Magloire * doc/grep.1: corrected typo. Noted by Ruslan Ermilov. 2000-01-30 Alain Magloire * vms/Makefile.am: added config_vms.h to EXTRA_DIST. * vms/config_vms.h: New File, contains macros specific to VMS and avoid namespace collision with operating system supplied C library. * vms/make.com: Better compiler auto-detection; information for builds on pre-OpenVMS 7.x systems; general overhaul. * src/getpagesize.h: Reinstate support for different pagesizes on VAX and Alpha. Work around problem with DEC C compiler. * src/vms_fab.c: Cast to some assigments; fixed typo argcp vs. argp. * src/vms_fab.h: Added new include files to avoid warnings about undefined function prototypes. Those patches were provided by Martin P.J. Zinser (zinser@decus.de). 2000-01-30 Paul Eggert * src/grep.c (main): Update copyright notice. 2000-01-28 Alain Magloire * src/grep.c (usage): The example "%s -i 'hello.*world' could lead to confusion when progname is 'fgrep. Noted by Akim Demaille. * configure.in: Reenable, jm_INCLUDE_REGEX() since we now track GNU lib C. * src/Makefile.am: EXTRA_DIST new macros with regex.c regex.h. Requested By Ulrich Drepper. 2000-01-25 Paul Eggert * src/grep.c (grep): If the final byte of an input file is not a newline, grep now silently supplies one. * doc/grep.texi, NEWS: Likewise. 2000-01-25 Paul Eggert * NEWS, doc/grep.1, doc/grep.texi: Add -I option. * src/grep.c (short_options, usage, main): Likewise. * doc/grep.texi: Fix some incorrect references to ASCII. 2000-01-25 Paul Eggert * doc/grep.1: Simplify synopsis; sort options; mention environment variables; clean up some minor gaffes. 2000-01-25 Paul Eggert * doc/grep.texi: Fix some errors in description of [:print:] and the like. 2000-01-23 Paul Eggert * src/dfa.c (FETCH, lex): Put brackets around if-body to avoid GCC warning about ambiguous if-then-else. 2000-01-23 Paul Eggert * src/regex.c (GET_UNSIGNED_NUMBER): Allow only ASCII digits. * src/dfa.c (ISASCIIDIGIT): New macro. (lex): Use it instead of ISDIGIT. 2000-01-23 Paul Eggert The bug is that regular expression ranges like [a-z] compare raw byte codes to the range boundaries, whereas POSIX says that they should use the current collating sequence instead. For example, in Solaris 7 with LC_ALL=en_US, the command echo x | grep '[ -~]' outputs 'x', but it shouldn't output anything since ' ' and '~' sort before all letters in that locale. * src/regex.c (compile_range): When matching a character range, use the current collating sequence, as POSIX requires. * src/dfa.c (lex): Likewise. 2000-01-20 Alain Magloire * tests/Makefile.am (dist-hook): Added new rule to make sure that the shell scripts have the right permissions. * src/posix/Makefile.am (EXTRA_DIST): added regex.h in the distribution. * THANKS: updated. 2000-01-18 Alain Magloire * Rectification the initial patch to add --binary-file option was done by Ruslan Ermilov. 2000-01-17 Paul Eggert Sync with sources of fileutils 4.0n, tar 1.13.17, glibc 2.1.3a1. Convert to ANSI C prototypes (using ansi2knr for backwards compatibility), as this makes it easier to sync. * configure.in (AC_OBJEXT): Spell in a funny way, to work around a bug in automake 1.4 with ansi2knr. (LIBOBJS): Add assignment so that .o files in LIBOBJS are also built via the ANSI2KNR-filtering rules. (AC_OUTPUT): Add src/posix/Makefile. * src/Makefile.am (AUTOMAKE_OPTIONS): Add ansi2knr. (SUBDIRS): New macro. * src/ansi2knr.1, src/ansi2knr.c, src/posix/Makefile.am: New files. * src/dfa.c, src/dosbuf.c, src/grep.c, src/kwset.c, src/search.c, src/vms_fab.c: Use prototypes for function definitions. * src/grep.c (main): Use int counter for default context, fixing an ANSI portability bug uncovered by the above changes. * config.guess, config.sub, install-sh, missing, src/alloca.c, src/getpagesize.h, src/memchr.c, src/savedir.c, src/savedir.h, src/stpcpy.c: Upgrade to latest version from fileutils 4.0n. * src/getopt.c, src/getopt.h, src/getopt1.c: Upgrade to latest version from tar 1.13.17. * src/obstack.c, src/obstack.h, src/regex.c, src/regex.h: Upgrade to glibc 2.1.3 alpha 1, with K&R C portability fix. * src/posix/regex.h: New file, from glibc 2.1.3 alpha 1. 2000-01-04 Paul Eggert Initial patch by Ruslan Ermilov. Add --binary-files option. * NEWS, doc/grep.1, doc/grep.texi: Document it. * src/grep.c (BINARY_FILES_OPTION): New constant. (long_options, grep, usage, main): New --binary-files option. (binary_files): New var. * src/system.h (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, CHAR_MAX): New macros. (INT_MAX, UCHAR_MAX): Define in terms of TYPE_MAXIMUM. 2000-01-04 Paul Eggert * savedir.c (savedir): Don't store past the end of an array if name_size is zero and the directory is empty. Reported by Dima Barsky <dima@pwd.hp.com>. 1999-12-03 Alain Magloire * 2.4 Release. 1999-11-18 Paul Eggert * m4/largefile.m4 (AC_SYS_LARGEFILE_FLAGS): Work around a problem with the QNX 4.25 shell, which doesn't propagate exit status of failed commands inside shell assignments. 1999-11-13 Eli Zaretskii * doc/grep.texi: Minor markup and spelling corrections. Use @noindent where appropriate. * PATCHES-{AM,AC}: rename to PATCHES.{AM,AC} 1999-11-12 Eli Zaretskii doc/grep.texi: Minor fixes and typos corrected. djgpp/README: Updated version. 1999-11-07 Paul Eggert * src/grep.c (usage): Fix misspelling. 1999-11-07 Paul Eggert Don't assume that the C library has re_set_syntax and friends. * src/Makefile.am (base_sources): Add regex.c, regex.h. (EXTRA_DIST): Remove regex.c, regex.h. * src/grep.c (prtext): Use out_quiet, not not_text, to decide whether to set pending to zero at the end. (not_text): Remove static variable, undoing latest change. (grep): Likewise. * doc/grep.texi: Tighten up the text, and fix some minor spelling and usage errors. Use @enumerate rather than @table @samp, since it's better for Q&A format. Add cross references. 1999-11-01 Alain Magloire * src/search.c: Use the more portable [[:alnum:]] to define a word instead of Ascii dependent [0-9A-Za-z] * src/grep.c: make not_text global to not display text when the context switches -A/-B/-C are use on binary files. * make grep-2.3g available for testing. * configure.in: drop support for --without-included-regex. This was generating bogus bug reports, since many GNU/Linux users have different version of glibc. And glibc maintainers decided to drop k&r support. 1999-11-01 Arnold D. Robbins * regex.c (init_syntax_once): move below definition of ISALNUM etc., then use ISALNUM to init the table, so that the word ops will work if i18n'ed. (SYNTAX): And subscript with 0xFF for Latin-1 characters. 1999-10-26 Alain Magloire * src/regex.c: Merge changes from GNU lib C. * Updated the *.po files 1999-10-26 Paul Eggert * src/grep.c (fillbuf): Don't report buffer size overflow if newalloc == save and maxalloc == save. This can happen e.g. when reading a large page-aligned file that contains no newlines. 1999-10-21 Paul Eggert * src/grep.c (usage): Give example. Clarify -F. Explain exit status more clearly. 1999-10-12 Paul Eggert * doc/grep.texi: Shorten the commentary about egrep and {. "BSD grep" -> "traditional grep". * doc/grep.1: Match recent changes to grep.texi. 1999-10-11 Paul Eggert * NEWS, doc/grep.1, doc/grep.texi: New option --mmap. * src/grep.c (mmap_option): New variable. (long_options, reset, usage): Add --mmap. Default is now read, not mmap. * doc/grep.1: Document -Z or --null. 1999-10-11 Paul Eggert * doc/grep.texi: Fix texinfo glitches. POSIX -> POSIX where appropriate. 1999-10-11 Paul Eggert * acconfig.h (ssize_t): New #undef. * configure.in (AC_CHECK_TYPE): Add ssize_t. * src/grep.c (PREFERRED_SAVE_FACTOR): New macro. (reset): If the buffer has already been allocated, set bufsalloc to be bufalloc / PREFERRED_SAVE_FACTOR. This avoids problems when bufsalloc == bufalloc (possible after reading a large binary file). (reset): Use PREFERRED_SAVE_FACTOR instead of magic constant. Do not set bufbeg; nobody uses it. Always set buflim. Check for lseek error. Use SEEK_CUR, not a magic constant. (fillbuf): Return an error indication, not a count. All callers changed. Do not assume ssize_t fits in int. Use PREFERRED_SAVE_FACTOR instead of magic constant. Clean up mmap code. Do not attempt to mmap zero bytes. Check for lseek error. Use SEEK_SET, not a magic constant. Work correctly if read is interrupted. (grepfile): Work correctly if open or close is interrupted. * src/system.h (SEEK_SET, SEEK_CUR): New macros. 1999-10-02 Alain Magloire * src/regex.[ch]: upgrade from GNU lib C source tree. * make beta 2.3f available. 1999-10-02 Paul Eggert * NEWS: egrep is now equivalent to 'grep -E'. The lower bound of an interval is not optional. You can specify a matcher multiple types without error. -u and -U are now allowed on non-DOS hosts, and have no effect. * doc/grep.texi: Likewise. * doc/grep.1: Likewise. Fix some troff bugs that prevented 'groff' from rendering the page. * src/egrepmat.c, src/fgrepmat.c, src/grepmat.c (default_matcher): Remove. (matcher): Add. * src/grep.h (default_matcher): Remove. (matcher): Now exported from ?grepmat.c, not grep.c. * src/dfa.c (lex): If { would start an invalid interval specification, treat it as a normal character. Remove (broken) support for {,M} meaning {0,M}. Diagnose bogus intervals like {1,0}. (closure): maxrep is now -1 to indicate no limit, not zero; zero is a valid value for maxrep, meaning an upper bound of zero. * src/grep.c (short_options): New constant. (long_options, main): -u and -U are now supported on Unix, with no effect. (matcher): Removed; now defined by ?grepmat.c. (install_matcher): Renamed from setmatcher. (setmatcher): New function. (usage): Report new, more uniform option scheme. (main): Do not initialize matcher; ?grepmat.c now does this. Rely on setmatcher to catch matcher conflicts. Default matcher is "grep". * src/search.c (matchers): Remove "posix-egrep" matcher; no longer needed. (Ecompile): Likewise. The egrep matcher now has POSIX behavior. * tests/bre.tests: grep '\{' is no longer an error. Fix test for interval too large, and enable it. * tests/ere.tests: grep -E {1 is no longer an error Likewise for a{1, a{1a, a{1a}, a{1,x}. 1999-09-22 Paul Eggert * largefile.m4 (AC_SYS_LARGEFILE_FLAGS): Work around GCC 2.95.1 bug with HP-UX 10.20. 1999-09-12 Paul Eggert * src/grep.c (fillbuf): Fix typo: we sometimes reported arithmetic overflow even when there wasn't any. 1999-09-12 Paul Eggert * configure.in (AC_CHECK_FUNCS): Add memmove. * src/system.h (S_ISREG): New macro. (memmove): Define if ! defined HAVE_MEMMOVE && ! defined memmove, not if !defined STDC_HEADERS. This is needed for SunOS 4.1.4, which defines STDC_HEADERS but lacks memmove. * src/grep.c (bufoffset): Needed even if !defined HAVE_MMAP. (reset): Always fstat the file, since we always need its size if it is regular. Similarly, get the buffer offset of every regular file. Set bufmapped to 0 if the file's initial offset is not a multiple of the page size. (fillbuf): Calculate an upper bound on how much memory we should allocate only for regular files, since we don't know the sizes of other files. Don't bother to check whether the file offset is a multiple of the page size, since we now do that just once in 'reset'. When an mmapped area would fall past the end of the file, trim it to just before instead of giving up immediately and doing a 'read'; that avoids a worst-case behavior that could read half an mmapped file. Fix bug when computing offsets on hosts that don't have mmap. 1999-08-27 Paul Eggert * src/system.h (memmove): New macro. * src/grep.c (page_alloc): Reallocate the old buffer instead of having both old and new buffers active simultaneously. Remove valloc debugging variant, which no longer applies. (fillbuf): Rejigger the buffer allocation mechanism. The old mechanism could allocate more than 10*N bytes for an N-byte file, which was excessive. Check for arithmetic overflow a bit more carefully. 1999-08-25 Paul Eggert * src/grep.c (grepdir): Don't assume that st_ino and st_dev must be integers; POSIX allows them to be floating-point (!). * src/vms_fab.h (arr_ptr): ':' -> ';' to fix typo. 1999-08-18 Alain Magloire * 2.3e snapshot. 1999-08-18 Alain Magloire * src/search.c: On a CRAY J90 system running UNICOS 8.0. Compilation of ./src/search.c failed because the declaration of the variable "regex": static struct re_pattern_buffer regex; conflicted with a previous declaration search.c #includes "system.h", which #includes <stdlib.h>, which declares : extern char *regex __((char *_Re, char *_Subject, ...)); The declaration in search.c is local to that one source file. I just changed its name to something less likely to conflict. (I called it "regexbuf", but you could pick any name you want.) Excerpt email from Dean Kopesky. 1999-08-16 Paul Eggert Upgrade large-file support to the version used in tar and textutils. * Makefile.am (ACLOCAL_AMFLAGS): Define to be empty. (M4DIR, ACINCLUDE_INPUTS): New macros. ($(srcdir)/acinclude.m4): New rule. * configure.in (AC_CANONICAL_HOST, AM_C_PROTOTYPES): Add. (AC_SYS_LARGEFILE): Renamed from AC_LFS, for compatibility with what should appear in the next autoconf release. * m4/largefile.m4: Renamed from m4/lfs.m4. * src/ansi2knr.1, src/ansi2knr.c, config.guess, config.sub: New files. config.guess and config.sub ar needed by the new AC_SYS_LARGEFILE. ansi2knr is needed by AM_C_PROTOTYPES, which in turn is needed by the new AC_SYS_LARGEFILE. 1999-08-16 Alain Magloire * 2.3d snapshot on ftp server. 1999-07-26 Paul Eggert Several GNU tools have options to process arbitrary file names, even file names that contain newline characters. These include 'find -print0', 'perl -0', 'sort -z', and 'xargs -0'. It'd be handy if GNU grep also processed such file names. Here's a proposed patch to do this, relative to grep 2.3c. This patch introduces two options, one for the data, and one for the file names. (Sometimes one wants null-terminated file names in the output, and sometimes one wants to process lists of null-terminated strings, and these are orthogonal axes.) * NEWS, doc/grep.texi: New -z or --null-data and -Z or --null options. * src/grep.c (long_options, usage, main): Likewise. * src/dfa.h (dfasyntax): New eol parameter. * src/dfa.c (eolbyte): New var. (dfasyntax): Set it from new parameter. (lex, dfastat, build_state, dfaexec): Use it instead of '\n'. * src/grep.h (eolbyte): New decl. * src/grep.c (eolbyte): New var. (nlscan, prpending, prtext, grepbuf, grep): Use it instead of '\n'. (filename_mask): New var. (prline, grepfile): Output NUL separator if filename_mask is zero. (grep): Look for '\200' as the hallmark of a binary file, not '\0', if -z or --null-data is specified, since it implies that '\0' is expected as text. * src/search.c (Gcompile, Ecompile): Pass eolbyte to dfasyntax. (EGexecute, Fexecute): Use eolbyte instead of '\n'. 1999-06-15 Alain Magloire * src/grep.c, doc/grep{1,texi} : --revert-match should be --invert-match. Correction proposed by Karl Berry. 1999-06-12 Alain Magloire * doc/grep.{1,texi}: add description for --with-filename. Noted missing by UEBAYASHI Masao. 1999-03-17 Paul Eggert * NEWS: Add GREP_OPTIONS. * doc/grep.texi: Document GREP_OPTIONS, and the other environment variables. Fix doc for [:blank:], [:cntrl:], [:punct:]. * src/grep.c (prepend_args, prepend_default_options): New functions. (main): Use them to implement GREP_OPTIONS. * src/system.h (getenv): New decl. 1999-03-16 Volker Borchert * configure.in: Use case case ... esac for checking Visual C++. When ${CC} contains options it was not recognize. 1999-03-07 Paul Eggert * src/grep.c (usage): Don't report -E, -F, and -G unless we're grep. (main): Don't match options -E, -F, and -G unless we're grep. Remove after-the-fact check for options -E, -F, and -G, since they're no longer needed. 1999-03-05 Eli Zaretskii * src/grep.c (main): Print the name of the default matcher instead of just "grep". 1999-02-06 Alain Magloire * tests/*.awk : Linux users are seeing "Broken Pipe" on make check. The problem is that grep does not drain its stdin, thus the previous process in the pipeline receives a SIGPIPE. Other shells are silent about this. There is actually no failure, since the broken pipe is expected. You can work around it by changing the pipeline, so that the input is drained, like this: status=`echo 'check' | { ${GREP} -E -e pattern >/dev/null 2>&1; echo $?; cat >/dev/null; }`; if test $status -ne $errnu then ... fi Excerpt email from Andreas Schwab. 1999-02-23 Alain Magloire * src/grep.c : Restrict the use of -E, -F, -G to only grep driver, Posix behaviour. {f,e}grep the matcher is already set. This change may brake scripts, warn in NEWS. * doc/grep.{1,texi} : -C takes arguments, upgrade manual. * beta 2.3a 1999-02-23 Alain Magloire * configure.in : Change the configure VC test from 'test x$ac_cv_prog_CC = xcl;' to 'test x"$ac_cv_prog_CC" = xcl;' Email from Joshua R. Poulson. 1999-02-23 Paul Eggert Fix porting bug reported by Amakawa Shuhei for SunOS 4.1.4-JL. The btowc.c shipped with grep 2.3 is incorrect for Solaris 2.5.1 and earlier, as it assumes UTF8, which these OSes do not support. Solaris 7 supports btowc, so there's no need to ship a substitute for it. The only questionable case is Solaris 2.6, which lacks btowc but does support UTF8. However, 2.6 supports UTF8 but only as a demonstration (for an English locale!); Japanese Solaris 2.6 users typically use EUC, or sometimes shift-JIS, but they cannot use UTF8 since Japanese UTF8 is not supported. Hence there's no point to having grep substitute a btowc that uses UTF8, as it is either redundant, or it will almost invariably have incorrect behavior. * configure.in (AC_CHECK_HEADERS): Don't set USE_WCHAR. (AC_CHECK_FUNCS): Add btowc, wctype. (AC_REPLACE_FUNCS): Don't replace btowc; our replacement is invariably doing the wrong thing anyway, at least on SunOS/Solaris. Don't bother to check for wctype in -lw, as we don't support wide characters on Solaris 2.5.1 or earlier anyway. * bootstrap/Makefile.try (OBJS): Remove btowc.$(OBJEXT). * src/btowc.c: Removed; no longer needed. 1999-02-19 Paul Eggert * NEWS: Fix typo when talking about the old behavior of silently skipping directories; it was grep 2.1, not grep 2.2. 1999-02-15 Alain Magloire * bootstrap/Makefile.try : add DJGPP DEFS. Done by Elie Zaretsckii. 1999-02-14 Alain Magloire * m4/gettext.m4 : Guard [] with changequote. From Elie Zaretskii. * djgpp/config.bat : Makefile.in.in --> Makefile.in-in From Elie Zaretskii. * src/dosbuf: k&r function parameter. * release of 2.3. 1999-02-10 Alain Magloire * bootstrap/{Makefile{try,am},REAMDE} : skeleton provided for system lacking the tools to autoconfigure. * src/{e,f,}grepmat.c: added guard [HAVE_CONFIG_H] 1999-02-10 Alain Magloire * PATCHES-AC, PATCHES-AM: updated. * m4/regex.m4 : updated. 1999-02-05 Eli Zaretskii * m4/gettext.m4 : Support DOS-style D:/foo/bar absolute file names. * aclocal.m4 (DJGPP) : Use $DJ_GPP instead, since changing the latter prevents GCC from finding headers and libraries. * djgpp/config.bat: Make building from another directory work * djgpp/config.sed: Remove redundant command that edited path separator: now done by configure. * src/grep.c [O_BINARY]: Add prototype for undossify_input. * doc/grep.texi (Introduction): Typo fixed. 1999-02-03 Alain Magloire * grep-2.2f beta release. 1999-02-02 Alain Magloire * m4/{djgpp,envsep,glibc,regex,dosfile,isc-posix}.m4 : New files to aid configuration and unload configure.in. * m4/Makefile.am : updated. * src/btowc.c : protect for wchar.h 1999-01-28 Alain Magloire * intl/Makefile.in: Replace .o with .${ac_objext} where necessary. Work around a limitation of Visual C++ on Cygwin32. * acconfig.h configure.in: Define 'alloca' as '_alloca' when CC=cl. This little hack was suggested by Ian Roxborough <irox@cygnus.com>. Patch forwarded by Ben Elliston. 1999-01-28 Alain Magloire * PATCHES-AM: New file. A small patch for automake-1.4, use $(sep) as the path separator base on @SEP@. * PATCHES-AC configure.in : updated for autoconf-13. 1999-01-27 Volker Borchert * grep.c: fgrep -NUM not working correctly. add the argument number to digit_args_val. 1999-01-22 Paul Eggert Prevent grep -r from recursing infinitely through directory loops via symbolic links. * grep.c (struct stats): New type. (stats_base): New var. (bufstat): Remove; subsumed by stats->stat. (reset, fillbuf, grep, grepdir, grepfile): Pass struct stats * arg, for directory loop checking; use this instead of the bufstat global. All callers changed. (grepfile): Stat the file before invoking grepdir. (grepdir): Assume that the argument has already been statted. No longer a need for a directory size argument, since it can be gotten from the struct stats * argument. Check for directory loops. Create linked list of directories currently being visited, to detect loops. 1998-12-29 Kaveh R. Ghazi intl/localealias.c: When building grep-2.2e using cc on Irix4, I needed the following patch to intl/localealias.c. (Its the same patch used by fileutils-4.0.) The patch resolves conflicts between char* and unsigned char* in the i18n code. 1998-12-10 Alain Magloire * src/grep.c : Typo in contex -->context Noted by Vladimir Michl. 1998-12-01 Alain Magloire * doc/Makefile.am djgpp/Makefile.am m4/Makefile.am vms/Makefile.am: New files. * m4/progtest.m4: proctect '[]' from m4. Noted by Eli Z. * PATCHES-AC: New file, add the patch for autoconf in the dist. * acconfig.h: (HAVE_DOS_FILENAME) * TODO: updated. * src/search.c: remove obsolete 'gegrep,ggrep,gnugrep' matchers. grep no longer depend on argv[0]. * grep-2.2e beta to test DJGPP port. 1998-11-28 Paul Eggert Various portability enhancements: - Don't assume that O_BINARY implies DOS. Use separate macros D_OK (for DOS-like directory access) and HAVE_DOS_FILE_NAMES (for DOS-like file names). - Don't assume that off_t fits into long; it doesn't on Solaris 2.6. - Have is_EISDIR set errno properly on hosts with screwed-up EISDIR. - Treat ':' specially in DOS file names only if it's the end of a drive specifier. - Protect against errno < 0. * src/grep.c (is_EISDIR): Move defn to system.h. (print_offset_sep): New function. (fillbuf): Remove redundant test of O_BINARY. (totalcc, totalnl): Now of type off_t. (prline): Use print_offset_sep to print file offsets. (grepfile): Don't set e to EISDIR; that's is_EISDIR's responsibility on machines that don't work properly with EISDIR. (grepdir): Don't assume ':' means slash on all DOS filenames; it means it only in the file prefix. * src/system.h (strerror): Check for negative error numbers. (is_EISDIR): Depend on D_OK, not O_BINARY. (SET_BINARY): Depend on HAVE_SETMODE, not __DJGPP__. (IS_SLASH, FILESYSTEM_PREFIX_LEN): Depend on HAVE_DOS_FILE_NAMES, not O_BINARY. (CHAR_BIT): New macro. * src/dosbuf.c (struct dos_map): pos and add members are now of type off_t. (dos_stripped_crs): Now of type off_t. (dossified_pos): Now accepts arg and returns value of type off_t. * configure.in (AC_CHECK_FUNCS): Add setmode. (HAVE_DOS_FILENAMES): New macro 1998-11-27 Eli Zaretskii * djgpp/config.sed: New file, a Sed script to edit configure script before running it on DOS/Windows. * djgpp/config.bat: Updated to handle po2tbl.sed.in and po/Makefile.in.in on DOS filesystems, and to run config.sed. 1998-11-24 Jim Meyering * src/grep.c : Typo s/infalid/invalid/ Also noted by Stanislav Brabec. 1998-11-24 Eli Zaretskii * doc/grep.texi: I found and corrected several typos. I believe the GNU standards require the section that describes the options to the programs to be called "Invoking" or "Invoking <program-name>". This is so users and programs can easily find that node in any Info file. So I changed the name of the "Options" chapter to "Invoking", and corrected the cross-references accordingly. I added some markup to things like file names and options. I added some additional index entries where that seemed useful. I also corrected some index entries, such as "@cindex [:alnum:]", which used a colon in them (the colons confuse Info readers). 1998-11-24 Alain Magloire * grep/doc/grep.texi : -h is not use for help. Nit spotted by Jim Meyering. 1998-11-23 Alain Magloire * doc: New directory, grep.1, {e,f}grep.man move here * doc/grep.texi: New info manual * doc/version.texi: New * doc/Makefile.am: New * tests/{ere,bre}.*: New files. The spencer2 test is split in two ere/bre. * config.hin: New, config.h.in rename to config.hin for OS with limited file system aka DOS. * grep-2.2d release for beta. 1998-11-18 Alain Magloire * src/regex.[ch] : Updated from GLibc, previous patches were integrate by Ulrich Drepper and some added ones. 1998-11-16 Paul Eggert * grep.h (__attribute__): New macro, if not GCC. (fatal): Add __attribute__((noreturn)). * grep.c (usage): Add __attribute__((noreturn)). 1998-11-16 Paul Eggert Remove memory leak with valloced buffers, by invoking malloc instead. * configure.in (AC_CHECK_FUNCS), src/system.h (valloc): Remove. * src/grep.c (page_alloc): New function. (ubuffer, pagesize): New vars. (ALIGN_TO): New macro. (reset): Initialize new vars. Check for overflow in buffer size calc. Use page_alloc instead of valloc. (fillbuf): Likewise. Use memcpy to copy saved area. 1998-11-15 Paul Eggert * dfa.c (dfacomp), search.c (EGexecute): Don't assume char is unsigned. 1998-11-14 Paul Eggert * src/grep.c (grepdir): Fix bug: memory freed twice. * src/search.c (Gcompile, Ecompile): Don't invoke dfainit, since dfacomp does it for us, and if we also do it then we leak memory. 1998-11-13 Eli Zaretskii * djgpp/config.bat: Rewrite to run the configure script via Bash. * djgpp/config.site, djgpp/getconf: New files. * djgpp/config.h, djgpp/*.mak, djgpp/po2tbl.sed: Remove. * djgpp/README: Update instructions. * Makefile.am (EXTRA_DIST): Update the list of DJGPP files. * src/system.h (IS_SLASH): New macro. (is_EISDIR): Define it here for DOS and Windows. * src/grep.c (main) [O_BINARY]: Set stdout to binary mode, so the EOL formats of the input and output files match, unless stdout is the console device. (is_EISDIR): Don't define if already defined. Accept a second argument, the file name; all callers changed. (grepdir): Don't free 'file', inside the loop. Use IS_SLASH to check whether 'dir' needs a slash. (grepfile): If file is a directory, set e to EISDIR. 1998-11-10 Alain Magloire * src/vms_fab.{c,h}: New file for VMS wildcard expansion Written by Phillip C. Brisco. * vms/make.com : add line to compile vms_fab.c and {e,f,}grepmat.c with link for each grep/fgrep/egrep. Base on patch send by Phillib C. Brisco. 1998-11-09 Alain Magloire * grep-2.2c on alpha for testing. 1998-11-09 Paul Eggert * src/grep.1: Fix "Last Change" of output by generating the date from the RCS Id. * src/grep.c (is_EISDIR): New macro. (grep): If -s, suppress errors from trying to read directories. (grepfile): Use is_EISDIR to simplify code. (grepdir): If -s, suppress errors from trying to read directories. * src/grep.1: Fix -q -r -s problems; describe BSD grep better. * src/grep.c (main): Update copyright. Specify default matcher with default_matcher extern var, not DEFAULT_MATCHER macro. This is more straightforward and means we need to compile grep.c just once. * src/egrepmat.c, src/fgrepmat.c, src/grepmat.c: New files. * src/Makefile.am (base_sources): New macro. (egrep_SOURCES, fgrep_SOURCES, grep_SOURCES): Now consist of $(base_sources) plus the single tailoring file. (grep_LDADD, egrep_LDADD, fgrep_LDADD): Remove. (EXTRA_DIST): Remove grep.c, regex.c. (fgrep.o, egrep.o): Remove. * src/grep.h (matcher): Now char const *. (default_matcher): New decl. * src/grep.c (matcher): Now char const *. (setmatcher): Now accepts char const *. (main): Default the matcher from default_matcher (linked externally) rather than DEFAULT_MATCHER (a macro). 1998-11-08 Alain Magloire * src/grep.1: 'prep.ai.mit.edu' should be replaced with 'gnu.org'. Nit from Paul Eggert. 1998-11-06 Alain Magloire * src/grep.c: The Matcher is not set to argv[0] but explicitly by a #define MATCHER at compile time default is "grep". * aclocal/: NEW dir. provides our own *.m4 * configure.in: Move Paul's Large Files to AC_LFS.(aclocal/lfs.m4) Taken from Jim Meyering fileutils. 1998-11-05 Alain Magloire * src/grep.1: update the man pages according to the changes make by Miles. * po/*.po: updated. * first beta release for 2.3 (2.2a). 1998-11-04 Miles Bader * src/grep.c (main): Rationalize interaction of -C/-NUM/-A/-B options, and allow -C to have an optional argument. -NUM can now be mixed with -C, and -A, -B always take precedence over -C/-NUM, regardless of order. (long_options): Let -C/--context take an optional argument. 1998-11-03 Alain Magloire * src/dfa.c: HP-UX define clrbit/setbit as macros in <sys/param.h> #undef if defined. Fixed by Andreas Ley and Philippe Defert. * src/grep.1 : mention that -s follows POSIX behavior. Noted by Paul Eggert and others. * tests/khadafy.sh: a typo in failure(s). Spotted By Sotiris Vassilopoulos. 1998-11-01 Paul Eggert * src/system.h (IN_CTYPE_DOMAIN): New macro. (ISALPHA, ISUPPER, ISLOWER, ISDIGIT, ISXDIGIT, ISSPACE, ISPUNCT, ISALNUM, ISPRINT, ISGRAPH, ISCNTRL): Use IN_CTYPE_DOMAIN instead of isascii. 1998-08-18 Paul Eggert Add support for new -r or --recursive (or -d recurse or --directories=recurse) option. * src/Makefile.am (grep_SOURCES): Add savedir.c, savedir.h, stpcpy.c. * src/grep.1: Describe new options. * src/grep.c: Include "savedir.h". (long_options): Add -r or --recursive. (RECURSE_DIRECTORIES): New enum value. (IS_DIRECTORY_ERRNO): Remove. (reset, grep): Add file name arg. (grepdir, grepfile): New functions. (initial_bufoffset): New var. (reset): Initialize it. (fillbuf): Use it. (count_matches, list_files, no_filenames, suppress_errors): New static vars; formerly were local to 'main'. (grep): Recurse through directories if the user asks for this. (usage, main): Add new options. (main): Change some local vars to be static, as described above. Move most of the guts into grepfile function. so that it can be recursed through. * configure.in (AC_HEADER_DIRENT, AC_FUNC_CLOSEDIR_VOID): Add. (AC_REPLACE_FUNCS): Add stpcpy. * src/savedir.c, src/savedir.h, src/stpcpy.c: New files; taken from fileutils 3.16u. 1998-08-11 Paul Eggert * src/system.h (initialize_main): New macro. * src/grep.c (main): Invoke initialize_main first thing. 1998-04-29 Paul Eggert * NEWS, src/grep.1: Describe new -a and -d options. * src/grep.c (long_options, usage, main): New options -d or --directories and -a or --text. (directories, always_text): New variables. (IS_DIRECTORY_ERRNO): New macro. (reset): Now returns value specifying whether to skip this file. Stat the file if either mmap or directory-skipping is possible. Skip the file if it's a directory and we're skipping directories. (grep): Skip the file if 'reset' tells us to. (main): If open fails because the file is a directory, and if we're skipping directories, don't report an error. Remove special case for DOS and Windows. * src/dosbuf.c (guess_type): Use the same method for guessing whether a file is binary as grep.c's grep does. There's no longer any need to declare 'bp' to be unsigned. 1998-04-26 Alain Magloire * grep-2.2 release. * src/dfa.c: Wrong revision was pulled out for beta 2.1.1d. * src/search.c: Wrong revision was pulled out for beta 2.1.1d. * src/grep.c: ck_atoi () added instead of atoi (). Suggestion from Jim Meyering. ck_atoi () pulled from diffutils-2.7, maintained by Paul Eggert. * AUTHORS: Rephrase of some sentences. * README: Rewording. Noted and patched by Joel N. Weber II. 1998-04-17 Kaveh R. Ghazi * src/dfa.h: Don't define 'const', trust autoconf to handle it. 1998-04-16 Alain Magloire * tests/{status,empty}.sh: wrong return status. * src/grep.c: Remove the REGEX part in usage (), it was consider overkill by most. 1998-04-14 Eli Zaretskii * djgpp/config.bat: Support file names with multiple dots on all platforms. * djgpp/README: Add instructions about file names illegal on MS-DOS. 1998-04-13 Alain Magloire * src/dfa.c: by "popular" demand reverse back to '_' not word-constituent. * grep-2.1.1c available for testing. 1998-04-13 Karl Heuer * src/grep.c: (a) The directory check is done too early: logically, if the argument is "-", then it refers to standard input, regardless of whether there's something in the file system answering to "-". (b) The sh command "grep -l root /etc/passwd /etc/group 0<&-" prints "(standard input)" instead of "/etc/passwd", because it mistakenly believes that a named file will never be opened on fd 0. The string "(standard input)" should be based on the file having been originally specified as "-", rather than making assumptions about the fd. (c) the code that calls close(fd) is being done outside of the test for a bad fd. Thus, if the open failed, this code will attempt to close(-1). It should be done inside the "fd != -1" branch. This patch addresses all three of these problems. 1998-04-13 Alain Magloire * configure.in: remove the deprecated AC_ISC_POSIX macro. Spotted by Karl Heuer. 1998-04-03 Eli Zaretskii * djgpp/main.mak, djgpp/src.mak, djgpp/tests.mak: Updated from the relevant Makefile.in files. * djgpp/config.bat: Create files in intl directory like the configure script does. 1998-03-28 Eli Zaretskii * djgpp/main.mak, djgpp/src.mak, djgpp/tests.mak: Updated to track changes in respective Makefile.in files. * src/dosbuf.c (guess_type): Avoid running off the end of the buffer. Spotted by Paul Eggert. 1998-03-27 Alain Magloire * grep-2.1.1b.tar.gz available. * src/regex.c: CLASS_CHAR_MAX set to 256 instead of 6 when WCTYPE and WCHAR are not defined. When class names where bigger then 6, it will not detect an error. example '[[:alphabet:]]'. * Updated the copyright of the files with emacs. With emacs Jim :). 1998-03-26 Jim Meyering * src/dfa.c (IS_WORD_CONSTITUENT): Define. (lex): Use IS_WORD_CONSTITUENT, not ISALNUM. Don't special-case '_'. (dfastate): Use IS_WORD_CONSTITUENT, not ISALNUM. (dfaexec): Likewise. 1998-03-25 Alain Magloire * tests/warning.sh: typos and replace the echos with a simple cat. Noted By Jim Meyering. * src/regex.c: #undef ISASCII and ISPRINT before defining them(On Solaris it was define). Pattern 'a[[:]:]]b' is an invalid char class and the error from regex was 1(REG_NOMATCH) instead of 2 (REG_ECTYPE). Fix with help from Ulrich Drepper. * src/grep.c (usage): Ulrich wrote: "A single printf should not have more than 900 bytes. For translation reasons the text shouldn't be split in too many pieces since this is tiresome and also does not help to generate a consistent picture." Noted by Ulrich Drepper. * src/grep.c (usage): Dig out and old patch from Franc,ois to explain the regex in usage(). Ideas from Franc,ois Pinard. 1998-03-23 Alain Magloire * testing: grep-2.1.1a for testing. * configure.in: Solaris needs '-lw' if we use wchar/wctype functions. * src/btowc.c: New file from GNU libc. Solaris 2.5 don't have it define. * configure.in : check for btowc (). * regex.c: Include <wchar.h> before <wctype.h>, to work around a Solaris 2.5 bug. Patch provided by Paul Eggert. * tests/status.sh: new file to check return status code. * tests/empty.sh: new file to check for empty pattern. * tests/warning.sh: new file to tell where to report errors. * configure.in: If available, prefer support for large files unless the user specified one of the CPPFLAGS, LDFLAGS, or LIBS variables. Done by Paul Eggert. * src/grep.c (usage): change prep.ai.mit.edu for gnu.org. 1998-03-18 Alain Magloire * src/grep.c (usage): Formating the --help message a bit off. Noted by William Bader. * src/grep.c (main): When checking conflicting matcher for option -E the matcher was to "egrep" instead of "posix-egrep". Reported by kwzh@gnu.org. * src/grep.c: Typos and rewording the --help message. Reported by Karl Heuer. * src/grep.1: The man page wording : A regular expression matching a single character may be followed by one of several repetition operators: is unclear since 'x(yz)*z' is a valid regex. Remove the "matching a single character". Suggested by Harald Hanche-Olsen. * src/grep.c (main): '-f /dev/null' now specifies no patterns and therfore matches nothing. Reported by Jorge Stolfi. Patched by Paul Eggert. 1998-03-10 Alain Magloire * Ice storm 98(el nino). Lost grep repository disk, and my $HOME directory, etc .. Trying to get the emails/patch from dejanews.com and start from grep-2.1. sigh .... 1997-11-01 Alain Magloire * src/grep.c: For the long options, the problems are: --file appears in the option table as 'no_argument' instead of 'required_argument'. --files-with-matches is missing from the option table. The help lists '--fixed-strings' as the long option for -F, the table has '--fixed-regexp'. --regexp appears in the option table as 'no_argument' instead of 'required_argument'. --with-filename is missing from the option table. Reported by Grant McDorman and Krishna Sethuraman. 1997-10-19 Alain Magloire * src/grep.c: the option "with-filename was not in the arg table. Corrected by Jim Hand. * GNU gettext library from gettext-0.10.32. * src/grep.c: reverse back to greping directories, One could skip the error message by defining SKIP_DIR_ERROR. There is no clear way of doing things, I hope to setle this on the next majore release Thanks Paul Eggert, Eli Zaretskii and gnits for the exchange. * tests/status.sh: add this check to make sure That the return status code is ok. 1997-10-10 Andreas Schwab * src/grep.1: Fix formatting. * configure.in: Check for wctype.h, wchar.h, libintl.h and isascii, which are needed for regex.c. 1997-10-01 Paul Eggert * src/grep.c (fillbuf): Don't warn about mmap failures. 1997-09-7 Alain Magloire * src/grep.c: added code for -H --with-filename. * djgpp/*: patch wrongly apply duplication of text in djgpp/{README,config.h}. Filter djgpp/config.bat with unix2dos. * djgpp/make.mak: beautify From Eli Zaretskii. * grep-2.1 release. 1997-09-01 Alain Magloire * grep-2.0f out for testing. * update to GNU gettext library from gettext-0.10.31 * grep.c : have a nicer format for --version. Noted by Ulrich Drepper. * obstack.[ch]: updated from GNU C library * configure.in: look for stdlib.h [HAVE_STDLIB_H] Comments from Ulrich Drepper. 1997-08-25 Philippe De Muyter <phdm@info.ucl.ac.be> * src/dfa.c (sys/types.h): File included unconditionnaly. 1997-08-16 Eli Zaretskii <eliz@is.elta.co.il> * grep.c (long_options) [O_BINARY]: Add DOS-specific options. (fillbuf) [O_BINARY]: For DOS-style text files, strip CR characters at end of line. (prline) [O_BINARY]: Report correct byte offsets, even though CR characters were stripped when reading the file. (usage) [O_BINARY]: Add DOS-specific options. (setmatcher) [HAVE_SETRLIMIT]: Set re_max_failures so that the matcher won't ever overflow the stack. (main) [__MSDOS__, _WIN32]: Handle backslashes and drive letters in argv[0], remove the .exe suffix, and downcase the prgram name. [O_BINARY]: Pass additional DOS-specific options to getopt_long and handle them. Call stat before attempting to open the file, in case it is a directory (DOS will fail the open call for directories). Switch the input descriptor to binary mode, unless it is a terminal device. * system.h [O_BINARY]: Define macros to switch a handle to binary mode, so binary files could be grep'ed on MS-DOS and MS-Windows. [HAVE_SETLOCALE]: Test for HAVE_SETLOCALE instead of HAVE_LC_MESSAGES, to prevent compilation error in grep.c on systems which don't define HAVE_LC_MESSAGES, but have setlocale. * dosbuf.c: New file, functions specific for MS-DOS/MS-Windows. (guess_type, undossify_input, dossified_pos): New functions. * djgpp/config.h, djgpp/config.bat, djgpp/main.mak, djgpp/src.mak, djgpp/po.mak, djgpp/intl.mak, djgpp/tests.mak, djgpp/po2tbl.sed: New files, for building Grep with DJGPP tools for MS-DOS and MS-Windows. * grep.1: Document DOS-specific switches. 1997-08-08 Alain Magloire * grep-2.0e: available for testing * grep.c: change LC_MESSAGE to LC_ALL for (LC_CTYPE). Suggested by Jochen Hein. * ABOUT-NLS: updated. * grep.c: --version: more verbosity (COPYRIGHT). * grep.c: --help: PATTERN, FILE instead of <pattern>, <file>. * INSTALL.grep: not necessary removed. * configure.in: --disable-regex rename --without-include-regex. * THANKS: format: first row name, second email. * ChangeLog: format ISO 8601. Reported by Franc,ois Pinard. * grep.c: move dcl of struct stat st into "else" where it's used. Reported by Jim Meyering. * grep.c: totalnl should be %u in printf. Reported by Michael Aichlmay Corrected with guidance from Ulrich Drepper 1997-07-24 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * Makefile.am: corrected an error when installing {f,e}grep.1. From Kaveh R. Ghazi <ghazi@caip.rutgers.edu>. From Ulrich Drepper <drepper@cygnus.com>. * Many files: use PARAMS instead of __STDC__ for prototypes. From Jim Meyering <meyering@eng.ascend.com>. Patch provided by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>. * dfa.[ch]: uses the one in gawk-3.0.3 with the patch from Arnold (see Changelog: July 12 1997) * grep.1: a note to say -l, -L, -q stop on first match. Noted by Andrew Beattie <gaffer@tug.com>. * grep.c: refuse to scan if the file is a directory. This was causing problems on SUNs. If the directory contains a file that could match the pattern, garbage was display. * tests directory: added new set of tests from Henry Spencer regex package. Change the way the tests were done to be more conformant to automake. * configure.in: added --disable-regex for folks with their own fuctions. * grep-20d : available for testing 1997-07-18 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * grep-2.0c: available for testing 1997-07-17 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * src/grep.c: Cause grep to fail if 'fclose (stdout)' fails. From Jim Meyering <meyering@eng.ascend.com>. * grep.c:usage() more consistency in the --help. * egrep, fgrep were links This is in violation of GNU standards: "Please don't make the behavior of a utility depend on the name used to invoke it. It is useful sometimes to make a link to a utility with a different name, and that should not change what it does." For now egrep and fgrep will be copies of grep. A better scheme should be found later. After discussion with Tom Tromey <tromey@cygnus.com>. * fgrep.man and egrep.man included: They are stubs that call grep.1. * Makefile.am: modified to install {f,e,}grep[,.1]. * speed hack for -l, -L: bail out on first match. From Scott Weikart <scott@igc.apc.org>. * *.[ch]: provided prototypes for strict argument checking With the help of Stewart Levin <stew@sep.stanford.edu>. 1997-07-16 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * configure.in: typo in the creation of po/Makefile Noted by Volker Borchert bt@teknon.de. * grep-2.0b: make it available for testing. 1997-07-15 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * src/grep.c usage(): cut the --help in smaller printf()'s Noted by Ulrich Drepper <drepper@cygnus.com>. 1997-07-14 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * grep-2.0a: make an alpha available for testing. 1997-07-12 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * run gettextize: added the po directory filled with *.po files. * check.sh, scriptgen.awk: fix grep paths. * change the directory strucure: grep is now in src to comply with gettext.m4. * grep.c version.c [VERSION]: got rid of version.c, it is now define via config.h. * dfa.c: patch to speed up initialization. Arnold Robbins (arnold@gnu.ai.mit.edu). 1997-07-09 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * *.c [HAVE_CONFIG_H]: Macro defined. * support for I18N in Makefile.am and configure.in. * update all the string to use gettext(I18N). Help from Franc,ois Pinard previous patch <pinard@IRO.UMontreal.CA>. 1997-07-04 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * obstack.[ch]: updated from glibc. Work of Ulrich Drepper <drepper@cygnus.com>. * regex.[ch]: updated from glibc. Work of Ulrich Drepper <drepper@cygnus.com>. * grep.c: for option -e not counting '\n' for new keys. From Mark Waite <markw@mddmew.fc.hp.com>. * grep.c: for option -f allocating the right count. From Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>. Mike Heartel (mike@cs.uoregon.edu). * kwset.c (bmexec): Cast tp[-2] to unsigned char before comparing. From Jim Meyering <meyering@asic.sc.ti.com>. * grep.1: various typos. From Keith Bostic <bostic@bsdi.com>. Mike Heartel (mike@cs.uoregon.edu). 1997-06-17 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * grep.c: support for long options. patch done by Franc,ois Pinard <pinard@IRO.UMontreal.CA>. * add getopt1.c in Makefile.am. Noted by Franc,ois Pinard <pinard@IRO.UMontreal.CA> * replace getopt.[ch] and add getopt1.c. * kwset.c: undef malloc before define it. Franc,ois Pinard <pinard@IRO.UMontreal.CA>. 1997-06-07 Alain Magloire <alainm@rcsm.ee.mcgill.ca> * grep.c: format incorrect in fprintf("%s: warning: %s: %s...", filename, strerror(errno)). Mike Heartel (mike@cs.uoregon.edu). 1996-11-19 David J MacKenzie <djm@catapult.va.pubnix.com> * make.com: Set the logical SYS. From rdb@cocamrd.oz.au (Rodney Brown). * grep.c (S_ISREG): Define if not defined already, for e.g. SunOS 4.0.3. * dfa.c (test_bit, set_bit, clear_bit): Renamed from tstbit, setbit, clrbit to avoid conflict with HP-UX sys/param.h macros. * memchr.c: New file, from GNU libc. * grep.c (memchr): Remove definition. * configure.in: Use AC_REPLACE_FUNCS for memchr. * configure.in: Remove unused checks for memalign and unsigned char. * grep.c: HAVE_WORKING_MMAP -> HAVE_MMAP. * system.h: New file. * dfa.c, kwset.c, grep.c, search.c: Use it instead of duplicating portability boilerplate. * grep.c: Include sys/types.h once, instead of three times conditionally. * dfa.c, kwset.c, search.c: Include sys/types.h unconditionally, to always try to get size_t (needed on some old SysV's). * dfa.c: Define strchr in terms of index, not the other way around. * search.c: Use memcpy instead of bcopy. 1996-11-15 David J MacKenzie <djm@catapult.va.pubnix.com> * Many files: Update FSF address. Update configuration to use autoconf v2 and automake. 1993-05-22 Mike Haertel <mike@cs.uoregon.edu> * Version 2.0 released. Copyright (C) 1998-2021 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted provided the copyright notice and this notice are preserved. ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/maint.mk�����������������������������������������������������������������������0000664�0001750�0001750�00000201612�14670377450�016112� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*-Makefile-*- # This Makefile fragment tries to be general-purpose enough to be # used by many projects via the gnulib maintainer-makefile module. ## Copyright (C) 2001-2021 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 <https://www.gnu.org/licenses/>. # This is reported not to work with make-3.79.1 # ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) ME := maint.mk # These variables ought to be defined through the configure.ac section # of the module description. But some packages import this file directly, # ignoring the module description. AWK ?= awk GREP ?= grep SED ?= sed # Helper variables. _empty = _sp = $(_empty) $(_empty) # _equal,S1,S2 # ------------ # If S1 == S2, return S1, otherwise the empty string. _equal = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1))) # member-check,VARIABLE,VALID-VALUES # ---------------------------------- # Check that $(VARIABLE) is in the space-separated list of VALID-VALUES, and # return it. Die otherwise. member-check = \ $(strip \ $(if $($(1)), \ $(if $(findstring $(_sp),$($(1))), \ $(error invalid $(1): '$($(1))', expected $(2)), \ $(or $(findstring $(_sp)$($(1))$(_sp),$(_sp)$(2)$(_sp)), \ $(error invalid $(1): '$($(1))', expected $(2)))), \ $(error $(1) undefined))) # Do not save the original name or timestamp in the .tar.gz file. # Use --rsyncable if available. gzip_rsyncable := \ $(shell gzip --help 2>/dev/null|$(GREP) rsyncable >/dev/null \ && printf %s --rsyncable) GZIP_ENV = '--no-name --best $(gzip_rsyncable)' GIT = git VC = $(GIT) VC_LIST = $(srcdir)/$(_build-aux)/vc-list-files -C $(srcdir) # You can override this variable in cfg.mk if your gnulib submodule lives # in a different location. gnulib_dir ?= $(shell if test -d $(srcdir)/gnulib; then \ echo $(srcdir)/gnulib; \ else \ echo ${GNULIB_SRCDIR}; \ fi) # You can override this variable in cfg.mk to set your own regexp # matching files to ignore. VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$ # This is to preprocess robustly the output of $(VC_LIST), so that even # when $(srcdir) is a pathological name like "....", the leading sed command # removes only the intended prefix. _dot_escaped_srcdir = $(subst .,\.,$(srcdir)) # Post-process $(VC_LIST) output, prepending $(srcdir)/, but only # when $(srcdir) is not ".". ifeq ($(srcdir),.) _prepend_srcdir_prefix = else _prepend_srcdir_prefix = | $(SED) 's|^|$(srcdir)/|' endif # In order to be able to consistently filter "."-relative names, # (i.e., with no $(srcdir) prefix), this definition is careful to # remove any $(srcdir) prefix, and to restore what it removes. _sc_excl = \ $(or $(exclude_file_name_regexp--$@),^$$) VC_LIST_EXCEPT = \ $(VC_LIST) | $(SED) 's|^$(_dot_escaped_srcdir)/||' \ | if test -f $(srcdir)/.x-$@; then $(GREP) -vEf $(srcdir)/.x-$@; \ else $(GREP) -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \ | $(GREP) -Ev -e '($(VC_LIST_ALWAYS_EXCLUDE_REGEX)|$(_sc_excl))' \ $(_prepend_srcdir_prefix) ifeq ($(origin prev_version_file), undefined) prev_version_file = $(srcdir)/.prev-version endif PREV_VERSION := $(shell cat $(prev_version_file) 2>/dev/null) VERSION_REGEXP = $(subst .,\.,$(VERSION)) PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION)) ifeq ($(VC),$(GIT)) this-vc-tag = v$(VERSION) this-vc-tag-regexp = v$(VERSION_REGEXP) else tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') tag-this-version = $(subst .,_,$(VERSION)) this-vc-tag = $(tag-package)-$(tag-this-version) this-vc-tag-regexp = $(this-vc-tag) endif my_distdir = $(PACKAGE)-$(VERSION) # Old releases are stored here. release_archive_dir ?= ../release # If RELEASE_TYPE is undefined, but RELEASE is, use its second word. # But overwrite VERSION. ifdef RELEASE VERSION := $(word 1, $(RELEASE)) RELEASE_TYPE ?= $(word 2, $(RELEASE)) endif # Validate and return $(RELEASE_TYPE), or die. RELEASE_TYPES = alpha beta stable release-type = $(call member-check,RELEASE_TYPE,$(RELEASE_TYPES)) # Override gnu_rel_host and url_dir_list in cfg.mk if these are not right. # Use alpha.gnu.org for alpha and beta releases. # Use ftp.gnu.org for stable releases. gnu_ftp_host-alpha = alpha.gnu.org gnu_ftp_host-beta = alpha.gnu.org gnu_ftp_host-stable = ftp.gnu.org gnu_rel_host ?= $(gnu_ftp_host-$(release-type)) url_dir_list ?= $(if $(call _equal,$(gnu_rel_host),ftp.gnu.org), \ https://ftpmirror.gnu.org/$(PACKAGE), \ https://$(gnu_rel_host)/gnu/$(PACKAGE)) # Override this in cfg.mk if you are using a different format in your # NEWS file. today = $(shell date +%Y-%m-%d) # Select which lines of NEWS are searched for $(news-check-regexp). # This is a sed line number spec. The default says that we search # lines 1..10 of NEWS for $(news-check-regexp). # If you want to search only line 3 or only lines 20-22, use "3" or "20,22". news-check-lines-spec ?= 1,10 news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)' # Prevent programs like 'sort' from considering distinct strings to be equal. # Doing it here saves us from having to set LC_ALL elsewhere in this file. export LC_ALL = C ## --------------- ## ## Sanity checks. ## ## --------------- ## ifneq ($(_gl-Makefile),) _cfg_mk := $(wildcard $(srcdir)/cfg.mk) # Collect the names of rules starting with 'sc_'. syntax-check-rules := $(sort $(shell env LC_ALL=C $(SED) -n \ 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(srcdir)/$(ME) $(_cfg_mk))) .PHONY: $(syntax-check-rules) ifeq ($(shell $(VC_LIST) >/dev/null 2>&1; echo $$?),0) local-checks-available += $(syntax-check-rules) else local-checks-available += no-vc-detected no-vc-detected: @echo "No version control files detected; skipping syntax check" endif .PHONY: $(local-checks-available) # Arrange to print the name of each syntax-checking rule just before running it. $(syntax-check-rules): %: %.m sc_m_rules_ = $(patsubst %, %.m, $(syntax-check-rules)) .PHONY: $(sc_m_rules_) $(sc_m_rules_): @echo $(patsubst sc_%.m, %, $@) @date +%s.%N > .sc-start-$(basename $@) # Compute and print the elapsed time for each syntax-check rule. sc_z_rules_ = $(patsubst %, %.z, $(syntax-check-rules)) .PHONY: $(sc_z_rules_) $(sc_z_rules_): %.z: % @end=$$(date +%s.%N); \ start=$$(cat .sc-start-$*); \ rm -f .sc-start-$*; \ $(AWK) -v s=$$start -v e=$$end \ 'END {printf "%.2f $(patsubst sc_%,%,$*)\n", e - s}' < /dev/null # The patsubst here is to replace each sc_% rule with its sc_%.z wrapper # that computes and prints elapsed time. local-check := \ $(patsubst sc_%, sc_%.z, \ $(filter-out $(local-checks-to-skip), $(local-checks-available))) syntax-check: $(local-check) endif # _sc_search_regexp # # This macro searches for a given construct in the selected files and # then takes some action. # # Parameters (shell variables): # # prohibit | require # # Regular expression (ERE) denoting either a forbidden construct # or a required construct. Those arguments are exclusive. # # exclude # # Regular expression (ERE) denoting lines to ignore that matched # a prohibit construct. For example, this can be used to exclude # comments that mention why the nearby code uses an alternative # construct instead of the simpler prohibited construct. # # in_vc_files | in_files # # grep-E-style regexp selecting the files to check. For in_vc_files, # the regexp is used to select matching files from the list of all # version-controlled files; for in_files, it's from the names printed # by "find $(srcdir)". When neither is specified, use all files that # are under version control. # # containing | non_containing # # Select the files (non) containing strings matching this regexp. # If both arguments are specified then CONTAINING takes # precedence. # # with_grep_options # # Extra options for grep. # # ignore_case # # Ignore case. # # halt # # Message to display before to halting execution. # # Finally, you may exempt files based on an ERE matching file names. # For example, to exempt from the sc_space_tab check all files with the # .diff suffix, set this Make variable: # # exclude_file_name_regexp--sc_space_tab = \.diff$ # # Note that while this functionality is mostly inherited via VC_LIST_EXCEPT, # when filtering by name via in_files, we explicitly filter out matching # names here as well. # Initialize each, so that envvar settings cannot interfere. export require = export prohibit = export exclude = export in_vc_files = export in_files = export containing = export non_containing = export halt = export with_grep_options = # By default, _sc_search_regexp does not ignore case. export ignore_case = _ignore_case = $$(test -n "$$ignore_case" && printf %s -i || :) define _sc_say_and_exit dummy=; : so we do not need a semicolon before each use; \ { printf '%s\n' "$(ME): $$msg" 1>&2; exit 1; }; endef define _sc_search_regexp dummy=; : so we do not need a semicolon before each use; \ \ : Check arguments; \ test -n "$$prohibit" && test -n "$$require" \ && { msg='Cannot specify both prohibit and require' \ $(_sc_say_and_exit) } || :; \ test -z "$$prohibit" && test -z "$$require" \ && { msg='Should specify either prohibit or require' \ $(_sc_say_and_exit) } || :; \ test -z "$$prohibit" && test -n "$$exclude" \ && { msg='Use of exclude requires a prohibit pattern' \ $(_sc_say_and_exit) } || :; \ test -n "$$in_vc_files" && test -n "$$in_files" \ && { msg='Cannot specify both in_vc_files and in_files' \ $(_sc_say_and_exit) } || :; \ test "x$$halt" != x \ || { msg='halt not defined' $(_sc_say_and_exit) }; \ \ : Filter by file name; \ if test -n "$$in_files"; then \ files=$$(find $(srcdir) | $(GREP) -E "$$in_files" \ | $(GREP) -Ev '$(_sc_excl)'); \ else \ files=$$($(VC_LIST_EXCEPT)); \ if test -n "$$in_vc_files"; then \ files=$$(echo "$$files" | $(GREP) -E "$$in_vc_files"); \ fi; \ fi; \ \ : Filter by content; \ test -n "$$files" \ && test -n "$$containing" \ && { files=$$(echo "$$files" | xargs $(GREP) -l "$$containing"); } \ || :; \ test -n "$$files" \ && test -n "$$non_containing" \ && { files=$$(echo "$$files" | xargs $(GREP) -vl "$$non_containing"); } \ || :; \ \ : Check for the construct; \ if test -n "$$files"; then \ if test -n "$$prohibit"; then \ echo "$$files" \ | xargs $(GREP) $$with_grep_options $(_ignore_case) -nE \ "$$prohibit" /dev/null \ | $(GREP) -vE "$${exclude:-^$$}" \ && { msg="$$halt" $(_sc_say_and_exit) } \ || :; \ else \ echo "$$files" \ | xargs \ $(GREP) $$with_grep_options $(_ignore_case) -LE "$$require" \ | $(GREP) . \ && { msg="$$halt" $(_sc_say_and_exit) } \ || :; \ fi \ else :; \ fi || :; endef sc_avoid_if_before_free: @$(VC_LIST_EXCEPT) \ | $(GREP) -v useless-if-before-free \ | xargs \ $(srcdir)/$(_build-aux)/useless-if-before-free \ $(useless_free_options) \ && { printf '$(ME): found useless "if"' \ ' before "free" above\n' 1>&2; \ exit 1; } \ || : sc_cast_of_argument_to_free: @prohibit='\<free *\( *\(' halt="don't cast free argument" \ $(_sc_search_regexp) sc_cast_of_x_alloc_return_value: @prohibit='\*\) *x(m|c|re)alloc\>' \ halt="don't cast x*alloc return value" \ $(_sc_search_regexp) sc_cast_of_alloca_return_value: @prohibit='\*\) *alloca\>' \ halt="don't cast alloca return value" \ $(_sc_search_regexp) sc_space_tab: @prohibit='[ ] ' \ halt='found SPACE-TAB sequence; remove the SPACE' \ $(_sc_search_regexp) # Don't use *scanf or the old ato* functions in "real" code. # They provide no error checking mechanism. # Instead, use strto* functions. sc_prohibit_atoi_atof: @prohibit='\<([fs]?scanf|ato([filq]|ll)) *\(' \ halt='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \ $(_sc_search_regexp) # Use STREQ rather than comparing strcmp == 0, or != 0. sp_ = strcmp *\(.+\) sc_prohibit_strcmp: @prohibit='! *strcmp *\(|\<$(sp_) *[!=]=|[!=]= *$(sp_)' \ exclude='# *define STRN?EQ\(' \ halt='replace strcmp calls above with STREQ/STRNEQ' \ $(_sc_search_regexp) # Really. You don't want to use this function. # It may fail to NUL-terminate the destination, # and always NUL-pads out to the specified length. sc_prohibit_strncpy: @prohibit='\<strncpy *\(' \ halt='do not use strncpy, period' \ $(_sc_search_regexp) # Pass EXIT_*, not number, to usage, exit, and error (when exiting) # Convert all uses automatically, via these two commands: # git grep -l '\<exit *(1)' \ # | grep -vEf .x-sc_prohibit_magic_number_exit \ # | xargs --no-run-if-empty \ # perl -pi -e 's/(^|[^.])\b(exit ?)\(1\)/$1$2(EXIT_FAILURE)/' # git grep -l '\<exit *(0)' \ # | grep -vEf .x-sc_prohibit_magic_number_exit \ # | xargs --no-run-if-empty \ # perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/' sc_prohibit_magic_number_exit: @prohibit='(^|[^.])\<(usage|exit|error) ?\(-?[0-9]+[,)]' \ exclude='exit \(77\)|error ?\(((0|77),|[^,]*)' \ halt='use EXIT_* values rather than magic number' \ $(_sc_search_regexp) # Check that we don't use $< in non-implicit Makefile rules. # # To find the Makefiles, trace AC_CONFIG_FILES. Using VC_LIST would # miss the Makefiles that are not under VC control (e.g., symlinks # installed for gettext). "Parsing" (recursive) uses of SUBDIRS seems # too delicate. # # Use GNU Make's --print-data-base to normalize the rules into some # easy to parse format: they are separated by two \n. Look for the # "section" about non-pattern rules (marked with "# Files") inside # which there are still the POSIX Make like implicit rules (".c.o"). sc_prohibit_gnu_make_extensions_awk_ = \ BEGIN { \ RS = "\n\n"; \ in_rules = 0; \ } \ /^\# Files/ { \ in_rules = 1; \ } \ /\$$</ && in_rules && $$0 !~ /^(.*\n)*\.\w+(\.\w+)?:/ { \ print "Error: " file ": $$< in a non implicit rule\n" $$0; \ status = 1; \ } \ END { \ exit status; \ } sc_prohibit_gnu_make_extensions: @if $(AWK) --version | grep GNU >/dev/null 2>&1; then \ (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') | \ tr ' ' '\n' | \ $(SED) -ne '/Makefile/{s/\.in$$//;p;}' | \ while read m; do \ $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null | \ $(AWK) -v file=$$m -e '$($@_awk_)' || exit 1; \ done; \ fi # Using EXIT_SUCCESS as the first argument to error is misleading, # since when that parameter is 0, error does not exit. Use '0' instead. sc_error_exit_success: @prohibit='error *\(EXIT_SUCCESS,' \ in_vc_files='\.[chly]$$' \ halt='found error (EXIT_SUCCESS' \ $(_sc_search_regexp) # "FATAL:" should be fully upper-cased in error messages # "WARNING:" should be fully upper-cased, or fully lower-cased sc_error_message_warn_fatal: @$(VC_LIST_EXCEPT) \ | xargs $(GREP) -nEA2 '[^rp]error *\(' /dev/null \ | $(GREP) -E '"Warning|"Fatal|"fatal' \ && { echo '$(ME): use FATAL, WARNING or warning' 1>&2; \ exit 1; } \ || : # Error messages should not start with a capital letter sc_error_message_uppercase: @$(VC_LIST_EXCEPT) \ | xargs $(GREP) -nEA2 '[^rp]error *\(' /dev/null \ | $(GREP) -E '"[A-Z]' \ | $(GREP) -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' \ && { echo '$(ME): found capitalized error message' 1>&2; \ exit 1; } \ || : # Error messages should not end with a period sc_error_message_period: @$(VC_LIST_EXCEPT) \ | xargs $(GREP) -nEA2 '[^rp]error *\(' /dev/null \ | $(GREP) -E '[^."]\."' \ && { echo '$(ME): found error message ending in period' 1>&2; \ exit 1; } \ || : sc_file_system: @prohibit=file''system \ exclude='/proc/filesystems' \ ignore_case=1 \ halt='found use of "file''system"; spell it "file system"' \ $(_sc_search_regexp) # Don't use cpp tests of this symbol. All code assumes config.h is included. sc_prohibit_have_config_h: @prohibit='^# *if.*HAVE''_CONFIG_H' \ halt='found use of HAVE''_CONFIG_H; remove' \ $(_sc_search_regexp) # Nearly all .c files must include <config.h>. However, we also permit this # via inclusion of a package-specific header, if cfg.mk specified one. # config_h_header must be suitable for grep -E. config_h_header ?= <config\.h> sc_require_config_h: @require='^# *include $(config_h_header)' \ in_vc_files='\.c$$' \ halt='the above files do not include <config.h>' \ $(_sc_search_regexp) # Print each file name for which the first #include does not match # $(config_h_header). Like grep -m 1, this only looks at the first match. perl_config_h_first_ = \ -e 'BEGIN {$$ret = 0}' \ -e 'if (/^\# *include\b/) {' \ -e ' if (not m{^\# *include $(config_h_header)}) {' \ -e ' print "$$ARGV\n";' \ -e ' $$ret = 1;' \ -e ' }' \ -e ' \# Move on to next file after first include' \ -e ' close ARGV;' \ -e '}' \ -e 'END {exit $$ret}' # You must include <config.h> before including any other header file. # This can possibly be via a package-specific header, if given by cfg.mk. sc_require_config_h_first: @if $(VC_LIST_EXCEPT) | $(GREP) '\.c$$' > /dev/null; then \ files=$$($(VC_LIST_EXCEPT) | $(GREP) '\.c$$') && \ perl -n $(perl_config_h_first_) $$files || \ { echo '$(ME): the above files include some other header' \ 'before <config.h>' 1>&2; exit 1; } || :; \ else :; \ fi sc_prohibit_HAVE_MBRTOWC: @prohibit='\bHAVE_MBRTOWC\b' \ halt="do not use $$prohibit; it is always defined" \ $(_sc_search_regexp) # To use this "command" macro, you must first define two shell variables: # h: the header name, with no enclosing <> or "" # re: a regular expression that matches IFF something provided by $h is used. define _sc_header_without_use dummy=; : so we do not need a semicolon before each use; \ h_esc=`echo '[<"]'"$$h"'[">]'|$(SED) 's/\./\\\\./g'`; \ if $(VC_LIST_EXCEPT) | $(GREP) '\.c$$' > /dev/null; then \ files=$$($(GREP) -l '^# *include '"$$h_esc" \ $$($(VC_LIST_EXCEPT) | $(GREP) '\.c$$')) && \ $(GREP) -LE "$$re" $$files | $(GREP) . && \ { echo "$(ME): the above files include $$h but don't use it" \ 1>&2; exit 1; } || :; \ else :; \ fi endef # Prohibit the inclusion of assert.h without an actual use of assert. sc_prohibit_assert_without_use: @h='assert.h' re='\<assert *\(' $(_sc_header_without_use) # Prohibit the inclusion of close-stream.h without an actual use. sc_prohibit_close_stream_without_use: @h='close-stream.h' re='\<close_stream *\(' $(_sc_header_without_use) # Prohibit the inclusion of getopt.h without an actual use. sc_prohibit_getopt_without_use: @h='getopt.h' re='\<getopt(_long)? *\(' $(_sc_header_without_use) # Don't include quotearg.h unless you use one of its functions. sc_prohibit_quotearg_without_use: @h='quotearg.h' re='\<quotearg(_[^ ]+)? *\(' $(_sc_header_without_use) # Don't include quote.h unless you use one of its functions. sc_prohibit_quote_without_use: @h='quote.h' re='\<quote((_n)? *\(|_quoting_options\>)' \ $(_sc_header_without_use) # Don't include this header unless you use one of its functions. sc_prohibit_long_options_without_use: @h='long-options.h' re='\<parse_(long_options|gnu_standard_options_only) *\(' \ $(_sc_header_without_use) # Don't include this header unless you use one of its functions. sc_prohibit_inttostr_without_use: @h='inttostr.h' re='\<(off|[iu]max|uint)tostr *\(' \ $(_sc_header_without_use) # Don't include this header unless you use one of its functions. sc_prohibit_ignore_value_without_use: @h='ignore-value.h' re='\<ignore_(value|ptr) *\(' \ $(_sc_header_without_use) # Don't include this header unless you use one of its functions. sc_prohibit_error_without_use: @h='error.h' \ re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\ $(_sc_header_without_use) # Don't include xalloc.h unless you use one of its functions. # Consider these symbols: # perl -lne '/^# *define (\w+)\(/ and print $1' lib/xalloc.h|grep -v '^__'; # perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) *\(/ and print $1' lib/xalloc.h # Divide into two sets on case, and filter each through this: # | sort | perl -MRegexp::Assemble -le \ # 'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed 's/\?://g' # Note this was produced by the above: # _xa1 = \ #x(((2n?)?re|c(har)?|n(re|m)|z)alloc|alloc_(oversized|die)|m(alloc|emdup)|strdup) # But we can do better, in at least two ways: # 1) take advantage of two "dup"-suffixed strings: # x(((2n?)?re|c(har)?|n(re|m)|[mz])alloc|alloc_(oversized|die)|(mem|str)dup) # 2) notice that "c(har)?|[mz]" is equivalent to the shorter and more readable # "char|[cmz]" # x(((2n?)?re|char|n(re|m)|[cmz])alloc|alloc_(oversized|die)|(mem|str)dup) _xa1 = x(((2n?)?re|char|n(re|m)|[cmz])alloc|alloc_(oversized|die)|(mem|str)dup) _xa2 = X([CZ]|N?M)ALLOC sc_prohibit_xalloc_without_use: @h='xalloc.h' \ re='\<($(_xa1)|$(_xa2)) *\('\ $(_sc_header_without_use) # Extract function names: # perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) *\(/ and print $1' lib/hash.h _hash_re = \ clear|delete|free|get_(first|next)|insert|lookup|print_statistics|reset_tuning _hash_fn = \<($(_hash_re)) *\( _hash_struct = (struct )?\<[Hh]ash_(table|tuning)\> sc_prohibit_hash_without_use: @h='hash.h' \ re='$(_hash_fn)|$(_hash_struct)'\ $(_sc_header_without_use) sc_prohibit_cloexec_without_use: @h='cloexec.h' re='\<(set_cloexec_flag|dup_cloexec) *\(' \ $(_sc_header_without_use) sc_prohibit_posixver_without_use: @h='posixver.h' re='\<posix2_version *\(' $(_sc_header_without_use) sc_prohibit_same_without_use: @h='same.h' re='\<same_name(at)? *\(' $(_sc_header_without_use) sc_prohibit_hash_pjw_without_use: @h='hash-pjw.h' \ re='\<hash_pjw\>' \ $(_sc_header_without_use) sc_prohibit_safe_read_without_use: @h='safe-read.h' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \ $(_sc_header_without_use) sc_prohibit_argmatch_without_use: @h='argmatch.h' \ re='(\<(ARGMATCH_DEFINE_GROUP|ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<(invalid_arg|argmatch(_exit_fn|_(in)?valid)?) *\()' \ $(_sc_header_without_use) sc_prohibit_canonicalize_without_use: @h='canonicalize.h' \ re='CAN_(EXISTING|ALL_BUT_LAST|MISSING)|canonicalize_(mode_t|filename_mode|file_name)' \ $(_sc_header_without_use) sc_prohibit_root_dev_ino_without_use: @h='root-dev-ino.h' \ re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \ $(_sc_header_without_use) sc_prohibit_openat_without_use: @h='openat.h' \ re='\<(openat_(permissive|needs_fchdir|(save|restore)_fail)|l?(stat|ch(own|mod))at|(euid)?accessat|(FCHMOD|FCHOWN|STAT)AT_INLINE)\>' \ $(_sc_header_without_use) # Prohibit the inclusion of c-ctype.h without an actual use. ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\ |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper sc_prohibit_c_ctype_without_use: @h='c-ctype.h' re='\<c_($(ctype_re)) *\(' \ $(_sc_header_without_use) # The following list was generated by running: # man signal.h|col -b|perl -ne '/bsd_signal.*;/.../sigwaitinfo.*;/ and print' \ # | perl -lne '/^\s+(?:int|void).*?(\w+).*/ and print $1' | fmt _sig_functions = \ bsd_signal kill killpg pthread_kill pthread_sigmask raise sigaction \ sigaddset sigaltstack sigdelset sigemptyset sigfillset sighold sigignore \ siginterrupt sigismember signal sigpause sigpending sigprocmask sigqueue \ sigrelse sigset sigsuspend sigtimedwait sigwait sigwaitinfo _sig_function_re = $(subst $(_sp),|,$(strip $(_sig_functions))) # The following were extracted from "man signal.h" manually. _sig_types_and_consts = \ MINSIGSTKSZ SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK \ SA_RESETHAND SA_RESTART SA_SIGINFO SIGEV_NONE SIGEV_SIGNAL \ SIGEV_THREAD SIGSTKSZ SIG_BLOCK SIG_SETMASK SIG_UNBLOCK SS_DISABLE \ SS_ONSTACK mcontext_t pid_t sig_atomic_t sigevent siginfo_t sigset_t \ sigstack sigval stack_t ucontext_t # generated via this: # perl -lne '/^#ifdef (SIG\w+)/ and print $1' lib/sig2str.c|sort -u|fmt -70 _sig_names = \ SIGABRT SIGALRM SIGALRM1 SIGBUS SIGCANCEL SIGCHLD SIGCLD SIGCONT \ SIGDANGER SIGDIL SIGEMT SIGFPE SIGFREEZE SIGGRANT SIGHUP SIGILL \ SIGINFO SIGINT SIGIO SIGIOT SIGKAP SIGKILL SIGKILLTHR SIGLOST SIGLWP \ SIGMIGRATE SIGMSG SIGPHONE SIGPIPE SIGPOLL SIGPRE SIGPROF SIGPWR \ SIGQUIT SIGRETRACT SIGSAK SIGSEGV SIGSOUND SIGSTKFLT SIGSTOP SIGSYS \ SIGTERM SIGTHAW SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR1 \ SIGUSR2 SIGVIRT SIGVTALRM SIGWAITING SIGWINCH SIGWIND SIGWINDOW \ SIGXCPU SIGXFSZ _sig_syms_re = $(subst $(_sp),|,$(strip $(_sig_names) $(_sig_types_and_consts))) # Prohibit the inclusion of signal.h without an actual use. sc_prohibit_signal_without_use: @h='signal.h' \ re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>' \ $(_sc_header_without_use) # Don't include stdio--.h unless you use one of its functions. sc_prohibit_stdio--_without_use: @h='stdio--.h' re='\<((f(re)?|p)open|tmpfile) *\(' \ $(_sc_header_without_use) # Don't include stdio-safer.h unless you use one of its functions. sc_prohibit_stdio-safer_without_use: @h='stdio-safer.h' re='\<((f(re)?|p)open|tmpfile)_safer *\(' \ $(_sc_header_without_use) # Prohibit the inclusion of strings.h without a sensible use. # Using the likes of bcmp, bcopy, bzero, index or rindex is not sensible. sc_prohibit_strings_without_use: @h='strings.h' \ re='\<(strn?casecmp|ffs(ll)?)\>' \ $(_sc_header_without_use) # Extract the raw list of symbol names with this: gl_extract_define_simple = \ /^\# *define ([A-Z]\w+)\(/ and print $$1 # Filter out duplicates and convert to a space-separated list: _intprops_names = \ $(shell f=$(gnulib_dir)/lib/intprops.h; \ perl -lne '$(gl_extract_define_simple)' $$f | sort -u | tr '\n' ' ') # Remove trailing space and convert to a regular expression: _intprops_syms_re = $(subst $(_sp),|,$(strip $(_intprops_names))) # Prohibit the inclusion of intprops.h without an actual use. sc_prohibit_intprops_without_use: @h='intprops.h' \ re='\<($(_intprops_syms_re)) *\(' \ $(_sc_header_without_use) _stddef_syms_re = NULL|offsetof|ptrdiff_t|size_t|wchar_t # Prohibit the inclusion of stddef.h without an actual use. sc_prohibit_stddef_without_use: @h='stddef.h' \ re='\<($(_stddef_syms_re))\>' \ $(_sc_header_without_use) _de1 = dirfd|(close|(fd)?open|read|rewind|seek|tell)dir(64)?(_r)? _de2 = (versionsort|struct dirent|getdirentries|alphasort|scandir(at)?)(64)? _de3 = MAXNAMLEN|DIR|ino_t|d_ino|d_fileno|d_namlen _dirent_syms_re = $(_de1)|$(_de2)|$(_de3) # Prohibit the inclusion of dirent.h without an actual use. sc_prohibit_dirent_without_use: @h='dirent.h' \ re='\<($(_dirent_syms_re))\>' \ $(_sc_header_without_use) # Prohibit the inclusion of verify.h without an actual use. sc_prohibit_verify_without_use: @h='verify.h' \ re='\<(verify(true|expr)?|assume|static_assert) *\(' \ $(_sc_header_without_use) # Don't include xfreopen.h unless you use one of its functions. sc_prohibit_xfreopen_without_use: @h='xfreopen.h' re='\<xfreopen *\(' $(_sc_header_without_use) sc_obsolete_symbols: @prohibit='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \ halt='do not use HAVE''_FCNTL_H or O'_NDELAY \ $(_sc_search_regexp) # FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ # Each nonempty ChangeLog line must start with a year number, or a TAB. sc_changelog: @prohibit='^[^12 ]' \ in_vc_files='^ChangeLog$$' \ halt='found unexpected prefix in a ChangeLog' \ $(_sc_search_regexp) # Ensure that each .c file containing a "main" function also # calls bindtextdomain. sc_bindtextdomain: @require='bindtextdomain *\(' \ in_vc_files='\.c$$' \ containing='\<main *(' \ halt='the above files do not call bindtextdomain' \ $(_sc_search_regexp) # Require that the final line of each test-lib.sh-using test be this one: # Exit $fail # Note: this test requires GNU grep's --label= option. Exit_witness_file ?= tests/test-lib.sh Exit_base := $(notdir $(Exit_witness_file)) sc_require_test_exit_idiom: @if test -f $(srcdir)/$(Exit_witness_file); then \ die=0; \ for i in $$($(GREP) -l -F 'srcdir/$(Exit_base)' \ $$($(VC_LIST) tests)); do \ tail -n1 $$i | $(GREP) '^Exit .' > /dev/null \ && : || { die=1; echo $$i; } \ done; \ test $$die = 1 && \ { echo 1>&2 '$(ME): the final line in each of the above is not:'; \ echo 1>&2 'Exit something'; \ exit 1; } || :; \ fi sc_trailing_blank: @prohibit='[ ]$$' \ halt='found trailing blank(s)' \ exclude='^Binary file .* matches$$' \ $(_sc_search_regexp) # Match lines like the following, but where there is only one space # between the options and the description: # -D, --all-repeated[=delimit-method] print all duplicate lines\n longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)? sc_two_space_separator_in_usage: @prohibit='^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \ halt='help2man requires at least two spaces between an option and its description'\ $(_sc_search_regexp) # A regexp matching function names like "error" that may be used # to emit translatable messages. _gl_translatable_diag_func_re ?= error # Look for diagnostics that aren't marked for translation. # This won't find any for which error's format string is on a separate line. sc_unmarked_diagnostics: @prohibit='\<$(_gl_translatable_diag_func_re) *\([^"]*"[^"]*[a-z]{3}' \ exclude='(_|ngettext ?)\(' \ halt='found unmarked diagnostic(s)' \ $(_sc_search_regexp) # Avoid useless parentheses like those in this example: # #if defined (SYMBOL) || defined (SYM2) sc_useless_cpp_parens: @prohibit='^# *if .*defined *\(' \ halt='found useless parentheses in cpp directive' \ $(_sc_search_regexp) # List headers for which HAVE_HEADER_H is always true, assuming you are # using the appropriate gnulib module. CAUTION: for each "unnecessary" # #if HAVE_HEADER_H that you remove, be sure that your project explicitly # requires the gnulib module that guarantees the usability of that header. gl_assured_headers_ = \ cd $(gnulib_dir)/lib && echo *.in.h|$(SED) 's/\.in\.h//g' # Convert the list of names to upper case, and replace each space with "|". az_ = abcdefghijklmnopqrstuvwxyz AZ_ = ABCDEFGHIJKLMNOPQRSTUVWXYZ gl_header_upper_case_or_ = \ $$($(gl_assured_headers_) \ | tr $(az_)/.- $(AZ_)___ \ | tr -s ' ' '|' \ ) sc_prohibit_always_true_header_tests: @or=$(gl_header_upper_case_or_); \ re="HAVE_($$or)_H"; \ prohibit='\<'"$$re"'\>' \ halt=$$(printf '%s\n' \ 'do not test the above HAVE_<header>_H symbol(s);' \ ' with the corresponding gnulib module, they are always true') \ $(_sc_search_regexp) sc_prohibit_defined_have_decl_tests: @prohibit='(#[ ]*ifn?def|\<defined)\>[ (]+HAVE_DECL_' \ halt='HAVE_DECL macros are always defined' \ $(_sc_search_regexp) # ================================================================== gl_other_headers_ ?= \ intprops.h \ openat.h \ stat-macros.h # Perl -lne code to extract "significant" cpp-defined symbols from a # gnulib header file, eliminating a few common false-positives. # The exempted names below are defined only conditionally in gnulib, # and hence sometimes must/may be defined in application code. gl_extract_significant_defines_ = \ /^\# *define ([^_ (][^ (]*)(\s*\(|\s+\w+)/\ && $$2 !~ /(?:rpl_|_used_without_)/\ && $$1 !~ /^(?:NSIG|ENODATA)$$/\ && $$1 !~ /^(?:SA_RESETHAND|SA_RESTART)$$/\ and print $$1 # Create a list of regular expressions matching the names # of macros that are guaranteed to be defined by parts of gnulib. define def_sym_regex gen_h=$(gl_generated_headers_); \ (cd $(gnulib_dir)/lib; \ for f in *.in.h $(gl_other_headers_); do \ test -f $$f \ && perl -lne '$(gl_extract_significant_defines_)' $$f; \ done; \ ) | sort -u \ | $(SED) 's/^/^ *# *(define|undef) */;s/$$/\\>/' endef # Don't define macros that we already get from gnulib header files. sc_prohibit_always-defined_macros: @if test -d $(gnulib_dir); then \ case $$(echo all: | $(GREP) -l -f - Makefile) in Makefile);; *) \ echo '$(ME): skipping $@: you lack GNU grep' 1>&2; exit 0;; \ esac; \ regex=$$($(def_sym_regex)); export regex; \ $(VC_LIST_EXCEPT) \ | xargs sh -c 'echo $$regex | $(GREP) -E -f - "$$@"' \ dummy /dev/null \ && { printf '$(ME): define the above' \ ' via some gnulib .h file\n' 1>&2; \ exit 1; } \ || :; \ fi # ================================================================== # Prohibit checked in backup files. sc_prohibit_backup_files: @$(VC_LIST) | $(GREP) '~$$' && \ { echo '$(ME): found version controlled backup file' 1>&2; \ exit 1; } || : # Require the latest GPL. sc_GPL_version: @prohibit='either ''version [^3]' \ halt='GPL vN, N!=3' \ $(_sc_search_regexp) # Require the latest GFDL. Two regexp, since some .texi files end up # line wrapping between 'Free Documentation License,' and 'Version'. _GFDL_regexp = (Free ''Documentation.*Version 1\.[^3]|Version 1\.[^3] or any) sc_GFDL_version: @prohibit='$(_GFDL_regexp)' \ halt='GFDL vN, N!=3' \ $(_sc_search_regexp) # Don't use Texinfo's @acronym{}. # https://lists.gnu.org/r/bug-gnulib/2010-03/msg00321.html texinfo_suffix_re_ ?= \.(txi|texi(nfo)?)$$ sc_texinfo_acronym: @prohibit='@acronym\{' \ in_vc_files='$(texinfo_suffix_re_)' \ halt='found use of Texinfo @acronym{}' \ $(_sc_search_regexp) cvs_keywords = \ Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State sc_prohibit_cvs_keyword: @prohibit='\$$($(cvs_keywords))\$$' \ halt='do not use CVS keyword expansion' \ $(_sc_search_regexp) # This Perl code is slightly obfuscated. Not only is each "$" doubled # because it's in a Makefile, but the $$c's are comments; we cannot # use "#" due to the way the script ends up concatenated onto one line. # It would be much more concise, and would produce better output (including # counts) if written as: # perl -ln -0777 -e '/\n(\n+)$/ and print "$ARGV: ".length $1' ... # but that would be far less efficient, reading the entire contents # of each file, rather than just the last two bytes of each. # In addition, while the code below detects both blank lines and a missing # newline at EOF, the above detects only the former. # # This is a perl script that is expected to be the single-quoted argument # to a command-line "-le". The remaining arguments are file names. # Print the name of each file that does not end in exactly one newline byte. # I.e., warn if there are blank lines (2 or more newlines), or if the # last byte is not a newline. However, currently we don't complain # about any file that contains exactly one byte. # Exit nonzero if at least one such file is found, otherwise, exit 0. # Warn about, but otherwise ignore open failure. Ignore seek/read failure. # # Use this if you want to remove trailing empty lines from selected files: # perl -pi -0777 -e 's/\n\n+$/\n/' files... # require_exactly_one_NL_at_EOF_ = \ foreach my $$f (@ARGV) \ { \ open F, "<", $$f or (warn "failed to open $$f: $$!\n"), next; \ my $$p = sysseek (F, -2, 2); \ my $$c = "seek failure probably means file has < 2 bytes; ignore"; \ my $$last_two_bytes; \ defined $$p and $$p = sysread F, $$last_two_bytes, 2; \ close F; \ $$c = "ignore read failure"; \ $$p && ($$last_two_bytes eq "\n\n" \ || substr ($$last_two_bytes,1) ne "\n") \ and (print $$f), $$fail=1; \ } \ END { exit defined $$fail } sc_prohibit_empty_lines_at_EOF: @$(VC_LIST_EXCEPT) \ | xargs perl -le '$(require_exactly_one_NL_at_EOF_)' \ || { echo '$(ME): empty line(s) or no newline at EOF' 1>&2; \ exit 1; } \ || : # Make sure we don't use st_blocks. Use ST_NBLOCKS instead. # This is a bit of a kludge, since it prevents use of the string # even in comments, but for now it does the job with no false positives. sc_prohibit_stat_st_blocks: @prohibit='[.>]st_blocks' \ halt='do not use st_blocks; use ST_NBLOCKS' \ $(_sc_search_regexp) # Make sure we don't define any S_IS* macros in src/*.c files. # They're already defined via gnulib's sys/stat.h replacement. sc_prohibit_S_IS_definition: @prohibit='^ *# *define *S_IS' \ halt='do not define S_IS* macros; include <sys/stat.h>' \ $(_sc_search_regexp) # Perl block to convert a match to FILE_NAME:LINENO:TEST, # that is shared by two definitions below. perl_filename_lineno_text_ = \ -e ' {' \ -e ' $$n = ($$` =~ tr/\n/\n/ + 1);' \ -e ' ($$v = $$&) =~ s/\n/\\n/g;' \ -e ' print "$$ARGV:$$n:$$v\n";' \ -e ' }' prohibit_doubled_words_ = \ the then in an on if is it but for or at and do to # expand the regex before running the check to avoid using expensive captures prohibit_doubled_word_expanded_ = \ $(join $(prohibit_doubled_words_),$(addprefix \s+,$(prohibit_doubled_words_))) prohibit_doubled_word_RE_ ?= \ /\b(?:$(subst $(_sp),|,$(prohibit_doubled_word_expanded_)))\b/gims prohibit_doubled_word_ = \ -e 'while ($(prohibit_doubled_word_RE_))' \ $(perl_filename_lineno_text_) # Define this to a regular expression that matches # any filename:dd:match lines you want to ignore. # The default is to ignore no matches. ignore_doubled_word_match_RE_ ?= ^$$ sc_prohibit_doubled_word: @$(VC_LIST_EXCEPT) \ | xargs perl -n -0777 $(prohibit_doubled_word_) \ | $(GREP) -vE '$(ignore_doubled_word_match_RE_)' \ | $(GREP) . \ && { echo '$(ME): doubled words' 1>&2; exit 1; } \ || : # A regular expression matching undesirable combinations of words like # "can not"; this matches them even when the two words appear on different # lines, but not when there is an intervening delimiter like "#" or "*". # Similarly undesirable, "See @xref{...}", since an @xref should start # a sentence. Explicitly prohibit any prefix of "see" or "also". # Also prohibit a prefix matching "\w+ +". # @pxref gets the same see/also treatment and should be parenthesized; # presume it must *not* start a sentence. # POSIX spells it "timestamp" rather than "time\s+stamp", so we do, too. bad_xref_re_ ?= (?:[\w,:;] +|(?:see|also)\s+)\@xref\{ bad_pxref_re_ ?= (?:[.!?]|(?:see|also))\s+\@pxref\{ prohibit_undesirable_word_seq_RE_ ?= \ /(?:\bcan\s+not\b|\btime\s+stamps?\b|$(bad_xref_re_)|$(bad_pxref_re_))/gims prohibit_undesirable_word_seq_ = \ -e 'while ($(prohibit_undesirable_word_seq_RE_))' \ $(perl_filename_lineno_text_) # Define this to a regular expression that matches # any filename:dd:match lines you want to ignore. # The default is to ignore no matches. ignore_undesirable_word_sequence_RE_ ?= ^$$ sc_prohibit_undesirable_word_seq: @$(VC_LIST_EXCEPT) \ | xargs perl -n -0777 $(prohibit_undesirable_word_seq_) \ | $(GREP) -vE '$(ignore_undesirable_word_sequence_RE_)' \ | $(GREP) . \ && { echo '$(ME): undesirable word sequence' >&2; exit 1; } \ || : # Except for shell files and for loops, double semicolon is probably a mistake sc_prohibit_double_semicolon: @prohibit='; *;[ {} \]*(/[/*]|$$)' \ in_vc_files='\.[chly]$$' \ exclude='\bfor *\(.*\)' \ halt="Double semicolon detected" \ $(_sc_search_regexp) _ptm1 = use "test C1 && test C2", not "test C1 -''a C2" _ptm2 = use "test C1 || test C2", not "test C1 -''o C2" # Using test's -a and -o operators is not portable. # We prefer test over [, since the latter is spelled [[ in configure.ac. sc_prohibit_test_minus_ao: @prohibit='(\<test| \[+) .+ -[ao] ' \ halt='$(_ptm1); $(_ptm2)' \ $(_sc_search_regexp) # Avoid a test bashism. sc_prohibit_test_double_equal: @prohibit='(\<test| \[+) .+ == ' \ containing='#! */bin/[a-z]*sh' \ halt='use "test x = x", not "test x =''= x"' \ $(_sc_search_regexp) # Each program that uses proper_name_utf8 must link with one of the # ICONV libraries. Otherwise, some ICONV library must appear in LDADD. # The perl -0777 invocation below extracts the possibly-multi-line # definition of LDADD from the appropriate Makefile.am and exits 0 # when it contains "ICONV". sc_proper_name_utf8_requires_ICONV: @progs=$$($(VC_LIST_EXCEPT) \ | xargs $(GREP) -l 'proper_name_utf8 ''("'); \ if test "x$$progs" != x; then \ fail=0; \ for p in $$progs; do \ dir=$$(dirname "$$p"); \ perl -0777 \ -ne 'exit !(/^LDADD =(.+?[^\\]\n)/ms && $$1 =~ /ICONV/)' \ $$dir/Makefile.am && continue; \ base=$$(basename "$$p" .c); \ $(GREP) "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \ || { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \ done; \ test $$fail = 1 && \ { echo 1>&2 '$(ME): the above do not link with any ICONV library'; \ exit 1; } || :; \ fi # Warn about "c0nst struct Foo const foo[]", # but not about "char const *const foo" or "#define const const". sc_redundant_const: @prohibit='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \ halt='redundant "const" in declarations' \ $(_sc_search_regexp) sc_const_long_option: @prohibit='^ *static.*struct option ' \ exclude='const struct option|struct option const' \ halt='add "const" to the above declarations' \ $(_sc_search_regexp) NEWS_hash = \ $$($(SED) -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \ $(srcdir)/NEWS \ | perl -0777 -pe \ 's/^Copyright.+?Free\sSoftware\sFoundation,\sInc\.\n//ms' \ | md5sum - \ | $(SED) 's/ .*//') # Ensure that we don't accidentally insert an entry into an old NEWS block. sc_immutable_NEWS: @if test -f $(srcdir)/NEWS; then \ test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \ { echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \ fi # Update the hash stored above. Do this after each release and # for any corrections to old entries. update-NEWS-hash: NEWS perl -pi -e 's/^(old_NEWS_hash[ \t]+:?=[ \t]+).*/$${1}'"$(NEWS_hash)/" \ $(srcdir)/cfg.mk # Ensure that we use only the standard $(VAR) notation, # not @...@ in Makefile.am, now that we can rely on automake # to emit a definition for each substituted variable. # However, there is still one case in which @VAR@ use is not just # legitimate, but actually required: when augmenting an automake-defined # variable with a prefix. For example, gettext uses this: # MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@ # otherwise, makeinfo would put German or French (current locale) # navigation hints in the otherwise-English documentation. # # Allow the package to add exceptions via a hook in cfg.mk; # for example, @PRAGMA_SYSTEM_HEADER@ can be permitted by # setting this to ' && !/PRAGMA_SYSTEM_HEADER/'. _makefile_at_at_check_exceptions ?= sc_makefile_at_at_check: @perl -ne '/\@\w+\@/' \ -e ' && !/(\w+)\s+=.*\@\1\@$$/' \ -e ''$(_makefile_at_at_check_exceptions) \ -e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}' \ $$($(VC_LIST_EXCEPT) | $(GREP) -E '(^|/)(Makefile\.am|[^/]+\.mk)$$') \ && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || : news-check: NEWS $(AM_V_GEN)if $(SED) -n $(news-check-lines-spec)p $< \ | $(GREP) -E $(news-check-regexp) >/dev/null; then \ :; \ else \ echo 'NEWS: $$(news-check-regexp) failed to match' 1>&2; \ exit 1; \ fi sc_makefile_TAB_only_indentation: @prohibit='^ [ ]{8}' \ in_vc_files='akefile|\.mk$$' \ halt='found TAB-8-space indentation' \ $(_sc_search_regexp) sc_m4_quote_check: @prohibit='(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \ in_vc_files='(^configure\.ac|\.m4)$$' \ halt='quote the first arg to AC_DEF*' \ $(_sc_search_regexp) fix_po_file_diag = \ 'you have changed the set of files with translatable diagnostics;\n\ apply the above patch\n' # Generate a list of files in which to search for translatable strings. perl_translatable_files_list_ = \ -e 'foreach $$file (@ARGV) {' \ -e ' \# Consider only file extensions with one or two letters' \ -e ' $$file =~ /\...?$$/ or next;' \ -e ' \# Ignore m4 and mk files' \ -e ' $$file =~ /\.m[4k]$$/ and next;' \ -e ' \# Ignore a .c or .h file with a corresponding .l or .y file' \ -e ' $$file =~ /(.+)\.[ch]$$/ && (-e "$${1}.l" || -e "$${1}.y")' \ -e ' and next;' \ -e ' \# Skip unreadable files' \ -e ' -r $$file or next;' \ -e ' print "$$file ";' \ -e '}' # Verify that all source files using _() (more specifically, files that # match $(_gl_translatable_string_re)) are listed in po/POTFILES.in. po_file ?= $(srcdir)/po/POTFILES.in generated_files ?= $(srcdir)/lib/*.[ch] _gl_translatable_string_re ?= \b(N?_|gettext *)\([^)"]*("|$$) sc_po_check: @if test -f $(po_file); then \ $(GREP) -E -v '^(#|$$)' $(po_file) \ | $(GREP) -v '^src/false\.c$$' | sort > $@-1; \ { $(VC_LIST_EXCEPT); echo $(generated_files); } \ | xargs perl $(perl_translatable_files_list_) \ | xargs $(GREP) -E -l '$(_gl_translatable_string_re)' \ | $(SED) 's|^$(_dot_escaped_srcdir)/||' \ | sort -u > $@-2; \ diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \ || { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; }; \ rm -f $@-1 $@-2; \ fi # Sometimes it is useful to change the PATH environment variable # in Makefiles. When doing so, it's better not to use the Unix-centric # path separator of ':', but rather the automake-provided '$(PATH_SEPARATOR)'. msg = 'Do not use ":" above; use $$(PATH_SEPARATOR) instead' sc_makefile_path_separator_check: @prohibit='PATH[=].*:' \ in_vc_files='akefile|\.mk$$' \ halt=$(msg) \ $(_sc_search_regexp) # Check that 'make alpha' will not fail at the end of the process, # i.e., when pkg-M.N.tar.xz already exists (either in "." or in ../release) # and is read-only. writable-files: $(AM_V_GEN)if test -d $(release_archive_dir); then \ for file in $(DIST_ARCHIVES); do \ for p in ./ $(release_archive_dir)/; do \ test -e $$p$$file || continue; \ test -w $$p$$file \ || { echo ERROR: $$p$$file is not writable; fail=1; }; \ done; \ done; \ test "$$fail" && exit 1 || : ; \ else :; \ fi v_etc_file = $(gnulib_dir)/lib/version-etc.c sample-test = tests/sample-test texi = doc/$(PACKAGE).texi # Make sure that the copyright date in $(v_etc_file) is up to date. # Do the same for the $(sample-test) and the main doc/.texi file. sc_copyright_check: @require='enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' \ in_files=$(v_etc_file) \ halt='out of date copyright in $(v_etc_file); update it' \ $(_sc_search_regexp) @require='# Copyright \(C\) '$$(date +%Y)' Free' \ in_vc_files=$(sample-test) \ halt='out of date copyright in $(sample-test); update it' \ $(_sc_search_regexp) @require='Copyright @copyright\{\} .*'$$(date +%Y) \ in_vc_files=$(texi) \ halt='out of date copyright in $(texi); update it' \ $(_sc_search_regexp) # If tests/help-version exists and seems to be new enough, assume that its # use of init.sh and path_prepend_ is correct, and ensure that every other # use of init.sh is identical. # This is useful because help-version cross-checks prog --version # with $(VERSION), which verifies that its path_prepend_ invocation # sets PATH correctly. This is an inexpensive way to ensure that # the other init.sh-using tests also get it right. _hv_file ?= $(srcdir)/tests/help-version _hv_regex_weak ?= ^ *\. .*/init\.sh" # Fix syntax-highlighters " _hv_regex_strong ?= ^ *\. "\$${srcdir=\.}/init\.sh" sc_cross_check_PATH_usage_in_tests: @if test -f $(_hv_file); then \ $(GREP) -l 'VERSION mismatch' $(_hv_file) >/dev/null \ || { echo "$@: skipped: no such file: $(_hv_file)" 1>&2; \ exit 0; }; \ $(GREP) -lE '$(_hv_regex_strong)' $(_hv_file) >/dev/null \ || { echo "$@: $(_hv_file) lacks conforming use of init.sh" 1>&2; \ exit 1; }; \ good=$$($(GREP) -E '$(_hv_regex_strong)' $(_hv_file)); \ $(VC_LIST_EXCEPT) \ | xargs $(GREP) -lE '$(_hv_regex_weak)' \ | xargs $(GREP) -LFx "$$good" \ | $(GREP) . \ && { printf "$(ME): the above files use" \ " path_prepend_ inconsistently\n" 1>&2; \ exit 1; } \ || :; \ fi # BRE regex of file contents to identify a test script. _test_script_regex ?= \<init\.sh\> # In tests, use "compare expected actual", not the reverse. sc_prohibit_reversed_compare_failure: @prohibit='\<compare [^ ]+ ([^ ]*exp|/dev/null)' \ containing='$(_test_script_regex)' \ halt='reversed compare arguments' \ $(_sc_search_regexp) # #if HAVE_... will evaluate to false for any non numeric string. # That would be flagged by using -Wundef, however gnulib currently # tests many undefined macros, and so we can't enable that option. # So at least preclude common boolean strings as macro values. sc_Wundef_boolean: @prohibit='^#define.*(yes|no|true|false)$$' \ in_files='$(CONFIG_INCLUDE)' \ halt='Use 0 or 1 for macro values' \ $(_sc_search_regexp) # Even if you use pathmax.h to guarantee that PATH_MAX is defined, it might # not be constant, or might overflow a stack. In general, use PATH_MAX as # a limit, not an array or alloca size. sc_prohibit_path_max_allocation: @prohibit='(\balloca *\([^)]*|\[[^]]*)\bPATH_MAX' \ halt='Avoid stack allocations of size PATH_MAX' \ $(_sc_search_regexp) sc_vulnerable_makefile_CVE-2009-4029: @prohibit='perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)' \ in_files='(^|/)Makefile\.in$$' \ halt=$$(printf '%s\n' \ 'the above files are vulnerable; beware of running' \ ' "make dist*" rules, and upgrade to fixed automake' \ ' see https://bugzilla.redhat.com/show_bug.cgi?id=542609 for details') \ $(_sc_search_regexp) sc_vulnerable_makefile_CVE-2012-3386: @prohibit='chmod a\+w \$$\(distdir\)' \ in_files='(^|/)Makefile\.in$$' \ halt=$$(printf '%s\n' \ 'the above files are vulnerable; beware of running' \ ' "make distcheck", and upgrade to fixed automake' \ ' see https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-3386 for details') \ $(_sc_search_regexp) vc-diff-check: $(AM_V_GEN)(unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || : $(AM_V_at)if test -s vc-diffs; then \ cat vc-diffs; \ echo "Some files are locally modified:" 1>&2; \ exit 1; \ else \ rm vc-diffs; \ fi rel-files = $(DIST_ARCHIVES) gnulib-version = $$(cd $(gnulib_dir) \ && { git describe || git rev-parse --short=10 HEAD; } ) bootstrap-tools ?= autoconf,automake,gnulib gpgv = $$(gpgv2 --version >/dev/null && echo gpgv2 || echo gpgv) # If it's not already specified, derive the GPG key ID from # the signed tag we've just applied to mark this release. gpg_key_ID ?= \ $$(cd $(srcdir) \ && git cat-file tag v$(VERSION) \ | $(gpgv) --status-fd 1 --keyring /dev/null - - 2>/dev/null \ | $(AWK) '/^\[GNUPG:\] ERRSIG / {print $$3; exit}') translation_project_ ?= coordinator@translationproject.org # Make info-gnu the default only for a stable release. announcement_Cc_stable = $(translation_project_), $(PACKAGE_BUGREPORT) announcement_mail_headers_stable = \ To: info-gnu@gnu.org \ Cc: $(announcement_Cc_) \ Mail-Followup-To: $(PACKAGE_BUGREPORT) announcement_Cc_alpha = $(translation_project_) announcement_mail_headers_alpha = \ To: $(PACKAGE_BUGREPORT) \ Cc: $(announcement_Cc_) announcement_mail_Cc_beta = $(announcement_mail_Cc_alpha) announcement_mail_headers_beta = $(announcement_mail_headers_alpha) announcement_Cc_ ?= $(announcement_Cc_$(release-type)) announcement_mail_headers_ ?= $(announcement_mail_headers_$(release-type)) announcement: NEWS ChangeLog $(rel-files) # Not $(AM_V_GEN) since the output of this command serves as # announcement message: it would start with " GEN announcement". $(AM_V_at)$(srcdir)/$(_build-aux)/announce-gen \ --mail-headers='$(announcement_mail_headers_)' \ --release-type=$(release-type) \ --package=$(PACKAGE) \ --prev=$(PREV_VERSION) \ --curr=$(VERSION) \ --gpg-key-id=$(gpg_key_ID) \ --srcdir=$(srcdir) \ --news=$(srcdir)/NEWS \ --bootstrap-tools=$(bootstrap-tools) \ $$(case ,$(bootstrap-tools), in (*,gnulib,*) \ echo --gnulib-version=$(gnulib-version);; esac) \ $(addprefix --url-dir=, $(url_dir_list)) .PHONY: release-commit release-commit: $(AM_V_GEN)cd $(srcdir) \ && $(_build-aux)/do-release-commit-and-tag \ -C $(abs_builddir) $(RELEASE) ## ---------------- ## ## Updating files. ## ## ---------------- ## ftp-gnu = https://ftp.gnu.org/gnu www-gnu = https://www.gnu.org upload_dest_dir_ ?= $(PACKAGE) upload_command = \ $(srcdir)/$(_build-aux)/gnupload $(GNUPLOADFLAGS) \ --to $(gnu_rel_host):$(upload_dest_dir_) \ $(rel-files) emit_upload_commands: @echo ===================================== @echo ===================================== @echo '$(upload_command)' @echo '# send the ~/announce-$(my_distdir) e-mail' @echo ===================================== @echo ===================================== .PHONY: upload upload: $(AM_V_GEN)$(upload_command) define emit-commit-log printf '%s\n' 'maint: post-release administrivia' '' \ '* NEWS: Add header line for next release.' \ '* .prev-version: Record previous version.' \ '* cfg.mk (old_NEWS_hash): Auto-update.' endef .PHONY: no-submodule-changes no-submodule-changes: $(AM_V_GEN)if test -d $(srcdir)/.git \ && git --version >/dev/null 2>&1; then \ diff=$$(cd $(srcdir) && git submodule -q foreach \ git diff-index --name-only HEAD) \ || exit 1; \ case $$diff in '') ;; \ *) echo '$(ME): submodule files are locally modified:'; \ echo "$$diff"; exit 1;; esac; \ else \ : ; \ fi submodule-checks ?= no-submodule-changes public-submodule-commit # Ensure that each sub-module commit we're using is public. # Without this, it is too easy to tag and release code that # cannot be built from a fresh clone. .PHONY: public-submodule-commit public-submodule-commit: $(AM_V_GEN)if test -d $(srcdir)/.git \ && git --version >/dev/null 2>&1; then \ cd $(srcdir) && \ git submodule --quiet foreach \ 'test "$$(git rev-parse "$$sha1")" \ = "$$(git merge-base origin "$$sha1")"' \ || { echo '$(ME): found non-public submodule commit' >&2; \ exit 1; }; \ else \ : ; \ fi # This rule has a high enough utility/cost ratio that it should be a # dependent of "check" by default. However, some of us do occasionally # commit a temporary change that deliberately points to a non-public # submodule commit, and want to be able to use rules like "make check". # In that case, run e.g., "make check gl_public_submodule_commit=" # to disable this test. gl_public_submodule_commit ?= public-submodule-commit check: $(gl_public_submodule_commit) .PHONY: alpha beta stable release ALL_RECURSIVE_TARGETS += alpha beta stable alpha beta stable: $(local-check) writable-files $(submodule-checks) $(AM_V_GEN)test $@ = stable \ && { echo $(VERSION) | $(GREP) -E '^[0-9]+(\.[0-9]+)+$$' \ || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\ || : $(AM_V_at)$(MAKE) vc-diff-check $(AM_V_at)$(MAKE) news-check $(AM_V_at)$(MAKE) distcheck $(AM_V_at)$(MAKE) dist $(AM_V_at)$(MAKE) $(release-prep-hook) RELEASE_TYPE=$@ $(AM_V_at)$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@ release: $(AM_V_GEN)$(MAKE) _version $(AM_V_GEN)$(MAKE) $(release-type) # Override this in cfg.mk if you follow different procedures. release-prep-hook ?= release-prep gl_noteworthy_news_ = * Noteworthy changes in release ?.? (????-??-??) [?] .PHONY: release-prep release-prep: $(AM_V_GEN)$(MAKE) --no-print-directory -s announcement \ > ~/announce-$(my_distdir) $(AM_V_at)if test -d $(release_archive_dir); then \ ln $(rel-files) $(release_archive_dir); \ chmod a-w $(rel-files); \ fi $(AM_V_at)echo $(VERSION) > $(prev_version_file) $(AM_V_at)$(MAKE) update-NEWS-hash $(AM_V_at)perl -pi \ -e '$$. == 3 and print "$(gl_noteworthy_news_)\n\n\n"' \ $(srcdir)/NEWS $(AM_V_at)msg=$$($(emit-commit-log)) || exit 1; \ cd $(srcdir) && $(VC) commit -m "$$msg" -a # Override this with e.g., -s $(srcdir)/some_other_name.texi # if the default $(PACKAGE)-derived name doesn't apply. gendocs_options_ ?= .PHONY: web-manual web-manual: $(AM_V_GEN)test -z "$(manual_title)" \ && { echo define manual_title in cfg.mk 1>&2; exit 1; } || : $(AM_V_at)cd '$(srcdir)/doc'; \ $(SHELL) ../$(_build-aux)/gendocs.sh $(gendocs_options_) \ -o '$(abs_builddir)/doc/manual' \ --email $(PACKAGE_BUGREPORT) $(PACKAGE) \ "$(PACKAGE_NAME) - $(manual_title)" $(AM_V_at)echo " *** Upload the doc/manual directory to web-cvs." .PHONY: web-manual-update web-manual-update: $(AM_V_GEN)cd $(srcdir) \ && $(_build-aux)/gnu-web-doc-update -C $(abs_builddir) # Code Coverage init-coverage: $(MAKE) $(AM_MAKEFLAGS) clean lcov --directory . --zerocounters COVERAGE_CCOPTS ?= "-g --coverage" COVERAGE_OUT ?= doc/coverage build-coverage: $(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS) $(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS) check mkdir -p $(COVERAGE_OUT) lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \ --capture gen-coverage: genhtml --output-directory $(COVERAGE_OUT) \ $(COVERAGE_OUT)/$(PACKAGE).info \ --highlight --frames --legend \ --title "$(PACKAGE_NAME)" coverage: $(MAKE) init-coverage $(MAKE) build-coverage $(MAKE) gen-coverage # Some projects carry local adjustments for gnulib modules via patches in # a gnulib patch directory whose default name is gl/ (defined in bootstrap # via local_gl_dir=gl). Those patches become stale as the originals evolve # in gnulib. Use this rule to refresh any stale patches. It applies each # patch to the original in $(gnulib_dir) and uses the temporary result to # generate a fuzz-free .diff file. If you customize the name of your local # gnulib patch directory via bootstrap.conf, this rule detects that name. # Run this from a non-VPATH (i.e., srcdir) build directory. .PHONY: refresh-gnulib-patches refresh-gnulib-patches: gl=gl; \ if test -f bootstrap.conf; then \ t=$$(perl -lne '/^\s*local_gl_dir=(\S+)/ and $$d=$$1;' \ -e 'END{defined $$d and print $$d}' bootstrap.conf); \ test -n "$$t" && gl=$$t; \ fi; \ for diff in $$(cd $$gl; git ls-files | $(GREP) '\.diff$$'); do \ b=$$(printf %s "$$diff"|$(SED) 's/\.diff$$//'); \ VERSION_CONTROL=none \ patch "$(gnulib_dir)/$$b" "$$gl/$$diff" || exit 1; \ ( cd $(gnulib_dir) || exit 1; \ git diff "$$b" > "../$$gl/$$diff"; \ git checkout $$b ) || exit 1; \ done # Update gettext files. PACKAGE ?= $(shell basename $(PWD)) PO_DOMAIN ?= $(PACKAGE) POURL = https://translationproject.org/latest/$(PO_DOMAIN)/ PODIR ?= po refresh-po: rm -f $(PODIR)/*.po && \ echo "$(ME): getting translations into po (please ignore the robots.txt ERROR 404)..." && \ wget --no-verbose --directory-prefix $(PODIR) --no-directories --recursive --level 1 --accept .po --accept .po.1 $(POURL) && \ echo 'en@boldquot' > $(PODIR)/LINGUAS && \ echo 'en@quot' >> $(PODIR)/LINGUAS && \ ls $(PODIR)/*.po | $(SED) 's/\.po//;s,$(PODIR)/,,' | \ sort >> $(PODIR)/LINGUAS # Running indent once is not idempotent, but running it twice is. INDENT_SOURCES ?= $(C_SOURCES) .PHONY: indent indent: indent $(INDENT_SOURCES) indent $(INDENT_SOURCES) # If you want to set UPDATE_COPYRIGHT_* environment variables, # put the assignments in this variable. update-copyright-env ?= # Run this rule once per year (usually early in January) # to update all FSF copyright year lists in your project. # If you have an additional project-specific rule, # add it in cfg.mk along with a line 'update-copyright: prereq'. # By default, exclude all variants of COPYING; you can also # add exemptions (such as ChangeLog..* for rotated change logs) # in the file .x-update-copyright. .PHONY: update-copyright update-copyright: $(AM_V_GEN)$(GREP) -l -w Copyright \ $$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \ | $(update-copyright-env) xargs $(srcdir)/$(_build-aux)/$@ # This tight_scope test is skipped with a warning if $(_gl_TS_headers) is not # overridden and $(_gl_TS_dir)/Makefile.am does not mention noinst_HEADERS. # NOTE: to override any _gl_TS_* default value, you must # define the variable(s) using "export" in cfg.mk. _gl_TS_dir ?= src ALL_RECURSIVE_TARGETS += sc_tight_scope sc_tight_scope: tight-scope.mk @fail=0; \ if ! $(GREP) '^ *export _gl_TS_headers *=' $(srcdir)/cfg.mk \ > /dev/null \ && ! $(GREP) -w noinst_HEADERS $(srcdir)/$(_gl_TS_dir)/Makefile.am \ > /dev/null 2>&1; then \ echo '$(ME): skipping $@'; \ else \ $(MAKE) -s -C $(_gl_TS_dir) \ -f Makefile \ -f $(abs_top_srcdir)/cfg.mk \ -f $(abs_top_builddir)/$< \ _gl_tight_scope \ || fail=1; \ fi; \ rm -f $<; \ exit $$fail tight-scope.mk: $(ME) @rm -f $@ $@-t @perl -ne '/^# TS-start/.../^# TS-end/ and print' $(srcdir)/$(ME) > $@-t @chmod a=r $@-t && mv $@-t $@ ifeq (a,b) # TS-start # Most functions should have static scope. # Any that don't must be marked with 'extern', but 'main' # and 'usage' are exceptions: they're always extern, but # do not need to be marked. Symbols matching '__.*' are # reserved by the compiler, so are automatically excluded below. _gl_TS_unmarked_extern_functions ?= main usage _gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\w+) *\(/ # If your project uses a macro like "XTERN", then put # the following in cfg.mk to override this default: # export _gl_TS_extern = extern|XTERN _gl_TS_extern ?= extern # The second nm|grep checks for file-scope variables with 'extern' scope. # Without gnulib's progname module, you might put program_name here. # Symbols matching '__.*' are reserved by the compiler, # so are automatically excluded below. _gl_TS_unmarked_extern_vars ?= # NOTE: the _match variables are perl expressions -- not mere regular # expressions -- so that you can extend them to match other patterns # and easily extract matched variable names. # For example, if your project declares some global variables via # a macro like this: GLOBAL(type, var_name, initializer), then you # can override this definition to automatically extract those names: # export _gl_TS_var_match = \ # /^(?:$(_gl_TS_extern)) .*?\**(\w+)(\[.*?\])?;/ || /\bGLOBAL\(.*?,\s*(.*?),/ _gl_TS_var_match ?= /^(?:$(_gl_TS_extern)) .*?(\w+)(\[.*?\])?;/ # The names of object files in (or relative to) $(_gl_TS_dir). _gl_TS_obj_files ?= *.$(OBJEXT) # Files in which to search for the one-line style extern declarations. # $(_gl_TS_dir)-relative. _gl_TS_headers ?= $(noinst_HEADERS) _gl_TS_other_headers ?= *.h .PHONY: _gl_tight_scope _gl_tight_scope: $(bin_PROGRAMS) sed_wrap='s/^/^_?/;s/$$/$$/'; \ t=exceptions-$$$$; \ trap 's=$$?; rm -f $$t; exit $$s' 0; \ for sig in 1 2 3 13 15; do \ eval "trap 'v=`expr $$sig + 128`; (exit $$v); exit $$v' $$sig"; \ done; \ src=`for f in $(SOURCES); do \ test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \ hdr=`for f in $(_gl_TS_headers); do \ test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \ ( printf '%s\n' '__.*' $(_gl_TS_unmarked_extern_functions); \ $(GREP) -h -A1 '^extern .*[^;]$$' $$src \ | $(GREP) -vE '^(extern |--|#)' | $(SED) 's/ .*//; /^$$/d'; \ perl -lne \ '$(_gl_TS_function_match) and print $$1' $$hdr; \ ) | sort -u | $(SED) "$$sed_wrap" > $$t; \ nm -g $(_gl_TS_obj_files)|$(SED) -n 's/.* T //p'|$(GREP) -Ev -f $$t \ && { echo the above functions should have static scope >&2; \ exit 1; } || : ; \ ( printf '%s\n' '__.*' main $(_gl_TS_unmarked_extern_vars); \ perl -lne '$(_gl_TS_var_match) and print $$1' \ $$hdr $(_gl_TS_other_headers) \ ) | sort -u | $(SED) "$$sed_wrap" > $$t; \ nm -g $(_gl_TS_obj_files) | $(SED) -n 's/.* [BCDGRS] //p' \ | sort -u | $(GREP) -Ev -f $$t \ && { echo the above variables should have static scope >&2; \ exit 1; } || : # TS-end endif ����������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/cfg.mk�������������������������������������������������������������������������0000664�0001750�0001750�00000015236�14670377427�015552� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Customize maint.mk -*- makefile -*- # Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. # Cause the tool(s) built by this package to be used also when running # commands via e.g., "make syntax-check". Doing this a little sooner # would have avoided a grep infloop bug. ifeq ($(build_triplet), $(host_triplet)) export PATH := $(builddir)/src$(PATH_SEPARATOR)$(PATH) endif # Used in maint.mk's web-manual rule manual_title = GNU Grep: Print lines matching a pattern # Use the direct link. This is guaranteed to work immediately, while # it can take a while for the faster mirror links to become usable. url_dir_list = https://ftp.gnu.org/gnu/$(PACKAGE) # Tests not to run as part of "make distcheck". local-checks-to-skip = \ sc_texinfo_acronym # Tools used to bootstrap this package, used for "announcement". bootstrap-tools = autoconf,automake,gnulib # Override the default Cc: used in generating an announcement. announcement_Cc_ = $(translation_project_), $(PACKAGE)-devel@gnu.org # The tight_scope test gets confused about inline functions. # like 'to_uchar'. _gl_TS_unmarked_extern_functions = main usage mb_clen to_uchar dfaerror dfawarn # Now that we have better tests, make this the default. export VERBOSE = yes # Comparing tarball sizes compressed using different xz presets, we see # that -6e adds only 60 bytes to the size of the tarball, yet reduces # (from -9) the decompression memory requirement from 64 MiB to 9 MiB. # Don't be tempted by -5e, since -6 and -5 use the same dictionary size. # $ for i in {4,5,6,7,8,9}{e,}; do \ # (n=$(xz -$i < grep-2.11.tar|wc -c);echo $n $i) & done |sort -nr # 1236632 4 # 1162564 5 # 1140988 4e # 1139620 6 # 1139480 7 # 1139480 8 # 1139480 9 # 1129552 5e # 1127616 6e # 1127556 7e # 1127556 8e # 1127556 9e export XZ_OPT = -6e old_NEWS_hash = da867d7903ff4936e2ee6c173e20fb63 # We prefer to spell it back-reference, as POSIX does. sc_prohibit_backref: @prohibit=back''reference \ halt='spell it "back-reference"' \ $(_sc_search_regexp) # Many m4 macros names once began with 'jm_'. # Make sure that none are inadvertently reintroduced. sc_prohibit_jm_in_m4: @grep -nE 'jm_[A-Z]' \ $$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \ { echo '$(ME): do not use jm_ in m4 macro names' \ 1>&2; exit 1; } || : sc_prohibit_echo_minus_en: @prohibit='\<echo -[en]' \ halt='do not use echo ''-e or echo ''-n; use printf instead' \ $(_sc_search_regexp) # Look for lines longer than 80 characters, except omit: # - program-generated long lines in diff headers, # - the help2man script copied from upstream, # - tests involving long checksum lines, and # - the 'pr' test cases. LINE_LEN_MAX = 80 FILTER_LONG_LINES = \ /^[^:]*\.diff:[^:]*:@@ / d; \ \|^[^:]*TODO:| d; \ \|^[^:]*man/help2man:| d; \ \|^[^:]*tests/misc/sha[0-9]*sum.*\.pl[-:]| d; \ \|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; }; sc_long_lines: @files=$$($(VC_LIST_EXCEPT)) \ halt='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \ for file in $$files; do \ expand $$file | grep -nE '^.{$(LINE_LEN_MAX)}.' | \ sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)'; \ done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || : # Indent only with spaces. sc_prohibit_tab_based_indentation: @prohibit='^ * ' \ halt='TAB in indentation; use only spaces' \ $(_sc_search_regexp) # Don't use "indent-tabs-mode: nil" anymore. No longer needed. sc_prohibit_emacs__indent_tabs_mode__setting: @prohibit='^( *[*#] *)?indent-tabs-mode:' \ halt='use of emacs indent-tabs-mode: setting' \ $(_sc_search_regexp) # Ensure that the list of test file names in tests/Makefile.am is sorted. sc_sorted_tests: @perl -0777 -ne \ '/^TESTS =(.*?)^$$/ms; ($$t = $$1) =~ s/[\\\s\n]+/\n/g;print $$t' \ tests/Makefile.am | sort -c # THANKS.in is a list of name/email pairs for people who are mentioned in # commit logs (and generated ChangeLog), but who are not also listed as an # author of a commit. Name/email pairs of commit authors are automatically # extracted from the repository. As a very minor factorization, when # someone who was initially listed only in THANKS.in later authors a commit, # this rule detects that their pair may now be removed from THANKS.in. sc_THANKS_in_duplicates: @{ git log --pretty=format:%aN | sort -u; \ cut -b-36 THANKS.in | sed '/^$$/d;s/ *$$//'; } \ | sort | uniq -d | grep . \ && { echo '$(ME): remove the above names from THANKS.in' \ 1>&2; exit 1; } || : # Ensure that tests don't use `cmd ... && fail=1` as that hides crashes. # The "exclude" expression allows common idioms like `test ... && fail=1` # and the 2>... portion allows commands that redirect stderr and so probably # independently check its contents and thus detect any crash messages. sc_prohibit_and_fail_1: @prohibit='&& fail=1' \ exclude='(stat|kill|test |EGREP|grep|compare|2> *[^/])' \ halt='&& fail=1 detected. Please use: returns_ 1 ... || fail=1' \ in_vc_files='^tests/' \ $(_sc_search_regexp) update-copyright-env = \ UPDATE_COPYRIGHT_USE_INTERVALS=1 \ UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79 include $(abs_top_srcdir)/dist-check.mk exclude_file_name_regexp--sc_bindtextdomain = \ ^tests/get-mb-cur-max\.c$$ exclude_file_name_regexp--sc_prohibit_strcmp = /colorize-.*\.c$$ exclude_file_name_regexp--sc_prohibit_xalloc_without_use = ^src/kwset\.c$$ exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \ (Makefile|\.(am|mk)$$) exclude_file_name_regexp--sc_prohibit_doubled_word = ^tests/count-newline$$ exclude_file_name_regexp--sc_long_lines = ^tests/.*$$ # If a test uses timeout, it must also use require_timeout_. # Grandfather-exempt the fedora test, since it ensures timeout works # as expected before using it. sc_timeout_prereq: @$(VC_LIST_EXCEPT) \ | grep '^tests/' \ | grep -v '^tests/fedora$$' \ | xargs grep -lw timeout \ | xargs grep -FLw require_timeout_ \ | $(GREP) . \ && { echo '$(ME): timeout withtout use of require_timeout_' \ 1>&2; exit 1; } || : ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/THANKS�������������������������������������������������������������������������0000664�0001750�0001750�00000017207�14670377427�015375� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������These people have contributed to the GNU grep. Those contributions are described in the version control logs. If your name has been left out, if you'd rather not be listed, or if you'd prefer a different address be used, please send a note to the bug-report mailing list (as seen at end of e.g., grep --help). Adam Katz savannah@kopis.com Aharon Robbins arnold@skeeve.com Akim Demaille akim@epita.fr Alain Magloire alainm@rcsm.ee.mcgill.ca Allan McRae allan@archlinux.org Andreas Ley andy@rz.uni-karlsruhe.de Andreas Schwab schwab@suse.de Arnold D. Robbins arnold@skeeve.com Arnold Robbins arnold@skeeve.com Barret Rhoden brho@cs.berkeley.edu Bastiaan "Darquan" Stougie darquan@zonnet.nl behoffski behoffski@grouse.com.au Ben Elliston bje@cygnus.com Benno Schulenberg bensberg@justemail.net Bernd Strieder strieder@student.uni-kl.de Bernhard Rosenkraenzer bero@arklinux.org Bernhard Voelker mail@bernhard-voelker.de Bob Proulx rwp@hprwp.fc.hp.com Brian Youmans 3diff@gnu.org Bruno Haible bruno@clisp.org Charles Levert charles_levert@gna.org Christian Boltz grep-bug@cboltz.de Christian Groessler cpg@aladdin.de Corinna Vinschen vinschen@redhat.com Dagobert Michelsen dam@opencsw.org Daisuke GOTO gotoh@m-design.com Dave Reisner d@falconindy.com David Clissold cliss@austin.ibm.com David J MacKenzie djm@catapult.va.pubnix.com David O'Brien obrien@freebsd.org Dmitry V. Levin ldv@altlinux.org 'Drake' Daham Wang drakewang@gmail.com Egmont Koblinger egmont@gmail.com Eli Zaretskii eliz@gnu.org Eric Blake eblake@redhat.com Fernando Basso fernandobasso.br@gmail.com Florian La Roche laroche@redhat.com François Pinard pinard@iro.umontreal.ca Gerald Stoller gerald_stoller@hotmail.com Grant McDorman grant@isgtec.com Greg Boyd gboyd.ccsf@gmail.com Greg Louis glouis@dynamicro.on.ca Guglielmo 'bond' Bondioni g.bondioni@libero.it H. Merijn Brand h.m.brand@hccnet.nl Hans-Bernhard Broeker broeker@physik.rwth-aachen.de Harald Hanche-Olsen hanche@math.ntnu.no Heikki Korpela heko@iki.fi Helge Kreutzmann debian@helgefjell.de Igor O. Ladygin assa@zabtrans.ru Ilya Basin basinilya@gmail.com Isamu Hasegawa isamu@yamato.ibm.com Jaroslav Å karvada jskarvad@redhat.com Javier Villavicencio the_paya@gentoo.org Jeff Bailey jbailey@nisa.net Jim Hand jhand@austx.tandem.com Jim Meyering jim@meyering.net Jochen Hein jochen.hein@delphi.central.de Joel N. Weber II devnull@gnu.org Johan Walles johan.walles@gmail.com John Hughes john@nitelite.calvacom.fr Jorge Stolfi stolfi@dcc.unicamp.br Juan Manuel Guerrero juan.guerrero@gmx.de Julian Foad julianfoad@btopenworld.com Karl Berry karl@gnu.org Karl Heuer kwzh@gnu.org Kaveh R. Ghazi ghazi@caip.rutgers.edu Kazuro Furukawa furukawa@apricot.kek.jp Keith Bostic bostic@bsdi.com Krishna Sethuraman krishna@sgihub.corp.sgi.com Kurt D Schwehr kdschweh@insci14.ucsd.edu Ludovic Courtès ludo@gnu.org Marc Aldorasi m101010a@gmail.com Marek Suppa mr@shu.io Mark Veltzer mark.veltzer@gmail.com Mark Waite markw@mddmew.fc.hp.com Martin P.J. Zinser zinser@decus.de Martin Rex martin.rex@sap-ag.de Matthew Burgess matthew@linuxfromscratch.org Michael Aichlmayr mikla@nx.com Mike Frysinger vapier@gentoo.org Mike Haertel mike@ducky.net Miles Bader miles@ccs.mt.nec.co.jp Mirraz Mirraz mirraz1@rambler.ru Nelson H. F. Beebe beebe@math.utah.edu Nicolas Vigier boklm@mars-attacks.org Nima Aghdaii naghdaii@fb.com Norihiro Tanaka noritnk@kcn.ne.jp Olaf Kirch okir@ns.lst.de Pádraig Brady P@draigBrady.com Paolo Bonzini bonzini@gnu.org Patrick Boyd pboyd04@gmail.com Paul Eggert eggert@cs.ucla.edu Paul Kimoto kimoto@spacenet.tn.cornell.edu Péter Radics mitchnull@gmail.com Petr PísaÅ™ petr.pisar@atlas.cz Petr Pisar ppisar@redhat.com Philip Hazel ph10@cus.cam.ac.uk Philipp Kohlbecher xt28@gmx.de Philippe Defert Philippe.Defert@cern.ch Philippe De Muyter phdm@info.ucl.ac.be Phillip C. Brisco phillip.craig.brisco@ccmail.census.gov Rainer Orth ro@cebitec.uni-bielefeld.de Reuben Thomas rrt@sc3d.org Roland Roberts rroberts@muller.com Ruslan Ermilov ru@freebsd.org Santiago Ruano Rincón santiago@debian.org Santiago Vila sanvila@unex.es Shannon Hill hill@synnet.com Sotiris Vassilopoulos Sotiris.Vassilopoulos@betatech.gr Standish Parsley adsspamtrap01@yahoo.com Stefano Lattarini stefano.lattarini@gmail.com Stepan Kasal kasal@ucw.cz Stephan T. Lavavej stl@nuwen.net Stephane Chazelas stephane.chazelas@gmail.com Stewart Levin stew@sep.stanford.edu Strahinja Kustudic kustodian@gmail.com Sven Joachim svenjoac@gmx.de Sydoruk Stepan step@unitex.kiev.ua Tapani Tarvainen tt@mit.jyu.fi Tim Waugh twaugh@redhat.com Tom 'moof' Spindler dogcow@ccs.neu.edu Tom Tromey tromey@creche.cygnus.com Tony Abou-Assaleh taa@acm.org UEBAYASHI Masao masao@nf.enveng.titech.ac.jp Ulrich Drepper drepper@cygnus.com Uwe H. Steinfeld usteinfeld@gmx.net Volker Borchert bt@teknon.de Wichert Akkerman wichert@cistron.nl William Bader william@nscs.fast.net Wolfgang Schludi schludi@syscomp.de Yuliy Pisetsky ypisetsky@fb.com Zev Weiss zev@bewilderbeest.net Zoltan Herczeg hzmester@freemail.hu ;; Local Variables: ;; coding: utf-8 ;; End: �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/configure����������������������������������������������������������������������0000775�0001750�0001750�00005051473�14670377431�016374� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for GNU grep 3.7. # # Report bugs to <bug-grep@gnu.org>. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and bug-grep@gnu.org $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 </dev/null exec 6>&1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='GNU grep' PACKAGE_TARNAME='grep' PACKAGE_VERSION='3.7' PACKAGE_STRING='GNU grep 3.7' PACKAGE_BUGREPORT='bug-grep@gnu.org' PACKAGE_URL='https://www.gnu.org/software/grep/' ac_unique_file="src/grep.c" # Factoring default headers for most tests. ac_includes_default="\ #include <stddef.h> #ifdef HAVE_STDIO_H # include <stdio.h> #endif #ifdef HAVE_STDLIB_H # include <stdlib.h> #endif #ifdef HAVE_STRING_H # include <string.h> #endif #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #ifdef HAVE_STDINT_H # include <stdint.h> #endif #ifdef HAVE_STRINGS_H # include <strings.h> #endif #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_SYS_STAT_H # include <sys/stat.h> #endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif" ac_header_c_list= gl_use_threads_default= gl_use_winpthreads_default= ac_func_c_list= gl_fnmatch_required=POSIX gl_getopt_required=POSIX gt_needs= ac_subst_vars='gltests_LTLIBOBJS gltests_LIBOBJS gl_LTLIBOBJS gl_LIBOBJS CONFIG_INCLUDE am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS COLORIZE_SOURCE USE_PCRE_FALSE USE_PCRE_TRUE PCRE_LIBS PCRE_CFLAGS USE_INCLUDED_REGEX_FALSE USE_INCLUDED_REGEX_TRUE POSUB INTLLIBS XGETTEXT_EXTRA_OPTIONS MSGMERGE XGETTEXT_015 XGETTEXT GMSGFMT_015 MSGFMT_015 GMSGFMT MSGFMT GETTEXT_MACRO_VERSION USE_NLS GNULIB_TEST_WARN_CFLAGS GNULIB_WARN_CFLAGS WARN_CFLAGS WERROR_CFLAGS HAVE_PERL_FALSE HAVE_PERL_TRUE LIBTESTS_LIBDEPS LIBGREPUTILS_LTLIBDEPS LIBGREPUTILS_LIBDEPS abs_aux_dir HAVE_SYS_UIO_H NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H NEXT_SYS_UIO_H NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H NEXT_SYS_IOCTL_H HAVE_SYS_IOCTL_H LIB_SETLOCALE GL_GNULIB_SELECT GL_GNULIB_PSELECT GL_GNULIB_SCHED_YIELD HAVE_STRUCT_SCHED_PARAM HAVE_SCHED_H NEXT_AS_FIRST_DIRECTIVE_SCHED_H NEXT_SCHED_H REPLACE_SCHED_YIELD HAVE_SCHED_YIELD LIB_PTHREAD_SIGMASK GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK GL_GNULIB_PTHREAD_SPIN GL_GNULIB_PTHREAD_TSS GL_GNULIB_PTHREAD_COND GL_GNULIB_PTHREAD_RWLOCK GL_GNULIB_PTHREAD_MUTEX GL_GNULIB_PTHREAD_ONCE GL_GNULIB_PTHREAD_THREAD LIB_PTHREAD HAVE_PTHREAD_H NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H NEXT_PTHREAD_H REPLACE_PTHREAD_SPIN_DESTROY REPLACE_PTHREAD_SPIN_UNLOCK REPLACE_PTHREAD_SPIN_TRYLOCK REPLACE_PTHREAD_SPIN_LOCK REPLACE_PTHREAD_SPIN_INIT REPLACE_PTHREAD_KEY_DELETE REPLACE_PTHREAD_GETSPECIFIC REPLACE_PTHREAD_SETSPECIFIC REPLACE_PTHREAD_KEY_CREATE REPLACE_PTHREAD_COND_DESTROY REPLACE_PTHREAD_COND_BROADCAST REPLACE_PTHREAD_COND_SIGNAL REPLACE_PTHREAD_COND_TIMEDWAIT REPLACE_PTHREAD_COND_WAIT REPLACE_PTHREAD_CONDATTR_DESTROY REPLACE_PTHREAD_CONDATTR_INIT REPLACE_PTHREAD_COND_INIT REPLACE_PTHREAD_RWLOCK_DESTROY REPLACE_PTHREAD_RWLOCK_UNLOCK REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK REPLACE_PTHREAD_RWLOCK_TRYWRLOCK REPLACE_PTHREAD_RWLOCK_TRYRDLOCK REPLACE_PTHREAD_RWLOCK_WRLOCK REPLACE_PTHREAD_RWLOCK_RDLOCK REPLACE_PTHREAD_RWLOCKATTR_DESTROY REPLACE_PTHREAD_RWLOCKATTR_INIT REPLACE_PTHREAD_RWLOCK_INIT REPLACE_PTHREAD_MUTEX_DESTROY REPLACE_PTHREAD_MUTEX_UNLOCK REPLACE_PTHREAD_MUTEX_TIMEDLOCK REPLACE_PTHREAD_MUTEX_TRYLOCK REPLACE_PTHREAD_MUTEX_LOCK REPLACE_PTHREAD_MUTEXATTR_DESTROY REPLACE_PTHREAD_MUTEXATTR_SETROBUST REPLACE_PTHREAD_MUTEXATTR_GETROBUST REPLACE_PTHREAD_MUTEXATTR_SETTYPE REPLACE_PTHREAD_MUTEXATTR_GETTYPE REPLACE_PTHREAD_MUTEXATTR_INIT REPLACE_PTHREAD_MUTEX_INIT REPLACE_PTHREAD_ONCE REPLACE_PTHREAD_EXIT REPLACE_PTHREAD_JOIN REPLACE_PTHREAD_DETACH REPLACE_PTHREAD_EQUAL REPLACE_PTHREAD_SELF REPLACE_PTHREAD_ATTR_DESTROY REPLACE_PTHREAD_ATTR_SETDETACHSTATE REPLACE_PTHREAD_ATTR_GETDETACHSTATE REPLACE_PTHREAD_ATTR_INIT REPLACE_PTHREAD_CREATE HAVE_PTHREAD_SPIN_DESTROY HAVE_PTHREAD_SPIN_UNLOCK HAVE_PTHREAD_SPIN_TRYLOCK HAVE_PTHREAD_SPIN_LOCK HAVE_PTHREAD_SPIN_INIT HAVE_PTHREAD_KEY_DELETE HAVE_PTHREAD_GETSPECIFIC HAVE_PTHREAD_SETSPECIFIC HAVE_PTHREAD_KEY_CREATE HAVE_PTHREAD_COND_DESTROY HAVE_PTHREAD_COND_BROADCAST HAVE_PTHREAD_COND_SIGNAL HAVE_PTHREAD_COND_TIMEDWAIT HAVE_PTHREAD_COND_WAIT HAVE_PTHREAD_CONDATTR_DESTROY HAVE_PTHREAD_CONDATTR_INIT HAVE_PTHREAD_COND_INIT HAVE_PTHREAD_RWLOCK_DESTROY HAVE_PTHREAD_RWLOCK_UNLOCK HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK HAVE_PTHREAD_RWLOCK_TRYWRLOCK HAVE_PTHREAD_RWLOCK_TRYRDLOCK HAVE_PTHREAD_RWLOCK_WRLOCK HAVE_PTHREAD_RWLOCK_RDLOCK HAVE_PTHREAD_RWLOCKATTR_DESTROY HAVE_PTHREAD_RWLOCKATTR_INIT HAVE_PTHREAD_RWLOCK_INIT HAVE_PTHREAD_MUTEX_DESTROY HAVE_PTHREAD_MUTEX_UNLOCK HAVE_PTHREAD_MUTEX_TIMEDLOCK HAVE_PTHREAD_MUTEX_TRYLOCK HAVE_PTHREAD_MUTEX_LOCK HAVE_PTHREAD_MUTEXATTR_DESTROY HAVE_PTHREAD_MUTEXATTR_SETROBUST HAVE_PTHREAD_MUTEXATTR_GETROBUST HAVE_PTHREAD_MUTEXATTR_SETTYPE HAVE_PTHREAD_MUTEXATTR_GETTYPE HAVE_PTHREAD_MUTEXATTR_INIT HAVE_PTHREAD_MUTEX_INIT HAVE_PTHREAD_ONCE HAVE_PTHREAD_EXIT HAVE_PTHREAD_JOIN HAVE_PTHREAD_DETACH HAVE_PTHREAD_EQUAL HAVE_PTHREAD_SELF HAVE_PTHREAD_ATTR_DESTROY HAVE_PTHREAD_ATTR_SETDETACHSTATE HAVE_PTHREAD_ATTR_GETDETACHSTATE HAVE_PTHREAD_ATTR_INIT HAVE_PTHREAD_CREATE HAVE_PTHREAD_PROCESS_SHARED HAVE_PTHREAD_MUTEX_ROBUST HAVE_PTHREAD_MUTEX_RECURSIVE HAVE_PTHREAD_CREATE_DETACHED HAVE_PTHREAD_SPINLOCK_T HAVE_PTHREAD_T GL_GENERATE_NETINET_IN_H_FALSE GL_GENERATE_NETINET_IN_H_TRUE NETINET_IN_H HAVE_NETINET_IN_H NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H NEXT_NETINET_IN_H LIB_NANOSLEEP LIB_SELECT LIBSOCKET HAVE_SYS_SELECT_H NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H NEXT_SYS_SELECT_H REPLACE_SELECT REPLACE_PSELECT HAVE_PSELECT INTL_MACOSX_LIBS GL_GNULIB_IOCTL INET_PTON_LIB GL_GNULIB_GETTIMEOFDAY NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H NEXT_SYS_TIME_H REPLACE_STRUCT_TIMEVAL REPLACE_GETTIMEOFDAY HAVE_SYS_TIME_H HAVE_STRUCT_TIMEVAL HAVE_GETTIMEOFDAY REPLACE_ITOLD GL_GENERATE_FLOAT_H_FALSE GL_GENERATE_FLOAT_H_TRUE FLOAT_H NEXT_AS_FIRST_DIRECTIVE_FLOAT_H NEXT_FLOAT_H LOCALE_TR_UTF8 GL_GNULIB_INET_PTON GL_GNULIB_INET_NTOP NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H NEXT_ARPA_INET_H HAVE_ARPA_INET_H REPLACE_INET_PTON REPLACE_INET_NTOP HAVE_DECL_INET_PTON HAVE_DECL_INET_NTOP GL_GNULIB_ACCEPT4 GL_GNULIB_SHUTDOWN GL_GNULIB_SETSOCKOPT GL_GNULIB_SENDTO GL_GNULIB_RECVFROM GL_GNULIB_SEND GL_GNULIB_RECV GL_GNULIB_LISTEN GL_GNULIB_GETSOCKOPT GL_GNULIB_GETSOCKNAME GL_GNULIB_GETPEERNAME GL_GNULIB_BIND GL_GNULIB_ACCEPT GL_GNULIB_CONNECT GL_GNULIB_SOCKET HAVE_WS2TCPIP_H HAVE_SYS_SOCKET_H NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H NEXT_SYS_SOCKET_H HAVE_ACCEPT4 HAVE_SA_FAMILY_T HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY HAVE_STRUCT_SOCKADDR_STORAGE gltests_WITNESS GL_CXXFLAG_ALLOW_WARNINGS GL_CFLAG_ALLOW_WARNINGS HAVE_FEATURES_H NEXT_AS_FIRST_DIRECTIVE_WCHAR_H NEXT_WCHAR_H LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE LIBUNISTRING_UNIWIDTH_H LIBUNISTRING_UNITYPES_H LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_FALSE LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_FALSE LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE LIBUNISTRING_UNISTR_H HAVE_UNISTD_H NEXT_AS_FIRST_DIRECTIVE_UNISTD_H NEXT_UNISTD_H GL_GNULIB_MDA_TZSET GL_GNULIB_TZSET GL_GNULIB_TIME_RZ GL_GNULIB_TIME_R GL_GNULIB_TIMESPEC_GET GL_GNULIB_TIMEGM GL_GNULIB_STRPTIME GL_GNULIB_STRFTIME GL_GNULIB_NANOSLEEP GL_GNULIB_LOCALTIME GL_GNULIB_MKTIME GL_GNULIB_CTIME TIME_H_DEFINES_TIME_UTC UNISTD_H_DEFINES_STRUCT_TIMESPEC PTHREAD_H_DEFINES_STRUCT_TIMESPEC SYS_TIME_H_DEFINES_STRUCT_TIMESPEC TIME_H_DEFINES_STRUCT_TIMESPEC NEXT_AS_FIRST_DIRECTIVE_TIME_H NEXT_TIME_H REPLACE_LOCALTIME REPLACE_GMTIME GNULIB_GETTIMEOFDAY REPLACE_TZSET REPLACE_TIMEGM REPLACE_STRFTIME REPLACE_NANOSLEEP REPLACE_MKTIME REPLACE_LOCALTIME_R REPLACE_CTIME HAVE_TIMEZONE_T HAVE_TIMESPEC_GET HAVE_TIMEGM HAVE_STRPTIME HAVE_NANOSLEEP HAVE_DECL_LOCALTIME_R NEXT_AS_FIRST_DIRECTIVE_STRING_H NEXT_STRING_H NEXT_AS_FIRST_DIRECTIVE_STDLIB_H NEXT_STDLIB_H NEXT_AS_FIRST_DIRECTIVE_STDIO_H NEXT_STDIO_H HAVE__BOOL GL_GENERATE_STDBOOL_H_FALSE GL_GENERATE_STDBOOL_H_TRUE STDBOOL_H GL_GENERATE_STDARG_H_FALSE GL_GENERATE_STDARG_H_TRUE STDARG_H NEXT_AS_FIRST_DIRECTIVE_STDARG_H NEXT_STDARG_H GL_GENERATE_STDALIGN_H_FALSE GL_GENERATE_STDALIGN_H_TRUE STDALIGN_H GL_GENERATE_SIGSEGV_H_FALSE GL_GENERATE_SIGSEGV_H_TRUE SIGSEGV_H LIBSIGSEGV_PREFIX LTLIBSIGSEGV LIBSIGSEGV HAVE_LIBSIGSEGV NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H NEXT_SIGNAL_H GL_GNULIB_SIGACTION GL_GNULIB_SIGPROCMASK GL_GNULIB_SIGNAL_H_SIGPIPE GL_GNULIB_RAISE GL_GNULIB_PTHREAD_SIGMASK REPLACE_RAISE REPLACE_PTHREAD_SIGMASK HAVE_SIGHANDLER_T HAVE_TYPE_VOLATILE_SIG_ATOMIC_T HAVE_STRUCT_SIGACTION_SA_SIGACTION HAVE_SIGACTION HAVE_SIGINFO_T HAVE_SIGSET_T HAVE_RAISE HAVE_PTHREAD_SIGMASK HAVE_POSIX_SIGNALBLOCKING PERL LIB_NL_LANGINFO UNDEFINE_STRTOK_R REPLACE_STRSIGNAL REPLACE_STRERRORNAME_NP REPLACE_STRERROR_R REPLACE_STRERROR REPLACE_STRTOK_R REPLACE_STRCASESTR REPLACE_STRSTR REPLACE_STRNLEN REPLACE_STRNDUP REPLACE_STRNCAT REPLACE_STRDUP REPLACE_STRCHRNUL REPLACE_STPNCPY REPLACE_MEMMEM REPLACE_MEMCHR REPLACE_FFSLL HAVE_STRVERSCMP HAVE_DECL_STRSIGNAL HAVE_SIGDESCR_NP HAVE_SIGABBREV_NP HAVE_STRERRORNAME_NP HAVE_DECL_STRERROR_R HAVE_DECL_STRTOK_R HAVE_STRCASESTR HAVE_STRSEP HAVE_STRPBRK HAVE_DECL_STRNLEN HAVE_DECL_STRNDUP HAVE_DECL_STRDUP HAVE_STRCHRNUL HAVE_STPNCPY HAVE_STPCPY HAVE_RAWMEMCHR HAVE_DECL_MEMRCHR HAVE_MEMPCPY HAVE_DECL_MEMMEM HAVE_FFSLL HAVE_FFSL HAVE_EXPLICIT_BZERO HAVE_MBSLEN GL_GNULIB_MDA_STRDUP GL_GNULIB_MDA_MEMCCPY GL_GNULIB_STRVERSCMP GL_GNULIB_STRSIGNAL GL_GNULIB_SIGDESCR_NP GL_GNULIB_SIGABBREV_NP GL_GNULIB_STRERRORNAME_NP GL_GNULIB_STRERROR_R GL_GNULIB_STRERROR GL_GNULIB_MBSTOK_R GL_GNULIB_MBSSEP GL_GNULIB_MBSSPN GL_GNULIB_MBSPBRK GL_GNULIB_MBSCSPN GL_GNULIB_MBSCASESTR GL_GNULIB_MBSPCASECMP GL_GNULIB_MBSNCASECMP GL_GNULIB_MBSCASECMP GL_GNULIB_MBSSTR GL_GNULIB_MBSRCHR GL_GNULIB_MBSCHR GL_GNULIB_MBSNLEN GL_GNULIB_MBSLEN GL_GNULIB_STRTOK_R GL_GNULIB_STRCASESTR GL_GNULIB_STRSTR GL_GNULIB_STRSEP GL_GNULIB_STRPBRK GL_GNULIB_STRNLEN GL_GNULIB_STRNDUP GL_GNULIB_STRNCAT GL_GNULIB_STRDUP GL_GNULIB_STRCHRNUL GL_GNULIB_STPNCPY GL_GNULIB_STPCPY GL_GNULIB_RAWMEMCHR GL_GNULIB_MEMRCHR GL_GNULIB_MEMPCPY GL_GNULIB_MEMMEM GL_GNULIB_MEMCHR GL_GNULIB_FFSLL GL_GNULIB_FFSL GL_GNULIB_EXPLICIT_BZERO HAVE_VISIBILITY CFLAG_VISIBILITY LIB_MBRTOWC SED WINDOWS_STAT_INODES WINDOWS_64_BIT_OFF_T NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H NEXT_SYS_TYPES_H LTLIBMULTITHREAD LIBMULTITHREAD LTLIBTHREAD LIBTHREAD LIBSTDTHREAD GL_GNULIB_LOCALENAME GL_GNULIB_DUPLOCALE GL_GNULIB_SETLOCALE_NULL GL_GNULIB_SETLOCALE GL_GNULIB_LOCALECONV NEXT_AS_FIRST_DIRECTIVE_LOCALE_H NEXT_LOCALE_H HAVE_XLOCALE_H NEXT_AS_FIRST_DIRECTIVE_STDDEF_H NEXT_STDDEF_H GL_GENERATE_STDDEF_H_FALSE GL_GENERATE_STDDEF_H_TRUE STDDEF_H HAVE_WCHAR_T HAVE_MAX_ALIGN_T REPLACE_NULL LOCALENAME_ENHANCE_LOCALE_FUNCS REPLACE_STRUCT_LCONV REPLACE_FREELOCALE REPLACE_DUPLOCALE REPLACE_NEWLOCALE REPLACE_SETLOCALE REPLACE_LOCALECONV HAVE_FREELOCALE HAVE_DUPLOCALE HAVE_NEWLOCALE LOCALCHARSET_TESTS_ENVIRONMENT GL_GNULIB_NL_LANGINFO HAVE_LANGINFO_YESEXPR HAVE_LANGINFO_ERA HAVE_LANGINFO_ALTMON HAVE_LANGINFO_T_FMT_AMPM HAVE_LANGINFO_CODESET HAVE_LANGINFO_H NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H NEXT_LANGINFO_H REPLACE_NL_LANGINFO HAVE_NL_LANGINFO LOCALE_ZH_CN LOCALE_FR_UTF8 LOCALE_JA GL_GNULIB_TOWCTRANS GL_GNULIB_WCTRANS GL_GNULIB_ISWCTYPE GL_GNULIB_WCTYPE GL_GNULIB_ISWXDIGIT GL_GNULIB_ISWDIGIT GL_GNULIB_ISWBLANK REPLACE_TOWLOWER REPLACE_ISWCNTRL HAVE_WCTYPE_H NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H NEXT_WCTYPE_H HAVE_CRTDEFS_H HAVE_WINT_T HAVE_ISWCNTRL REPLACE_ISWXDIGIT REPLACE_ISWDIGIT REPLACE_ISWBLANK HAVE_WCTRANS_T HAVE_WCTYPE_T HAVE_ISWBLANK GL_GNULIB_STRTOUMAX GL_GNULIB_STRTOIMAX GL_GNULIB_IMAXDIV GL_GNULIB_IMAXABS NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H NEXT_INTTYPES_H UINT64_MAX_EQ_ULONG_MAX UINT32_MAX_LT_UINTMAX_MAX PRIPTR_PREFIX INT64_MAX_EQ_LONG_MAX INT32_MAX_LT_INTMAX_MAX REPLACE_STRTOUMAX REPLACE_STRTOIMAX HAVE_IMAXDIV_T HAVE_DECL_STRTOUMAX HAVE_DECL_STRTOIMAX HAVE_DECL_IMAXDIV HAVE_DECL_IMAXABS GL_GENERATE_STDINT_H_FALSE GL_GENERATE_STDINT_H_TRUE STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H HAVE_C99_STDINT_H WINT_T_SUFFIX WCHAR_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX PTRDIFF_T_SUFFIX HAVE_SIGNED_WINT_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_SIG_ATOMIC_T BITSIZEOF_WINT_T BITSIZEOF_WCHAR_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_PTRDIFF_T APPLE_UNIVERSAL_BUILD HAVE_STDINT_H NEXT_AS_FIRST_DIRECTIVE_STDINT_H NEXT_STDINT_H HAVE_SYS_TYPES_H HAVE_INTTYPES_H HAVE_WCHAR_H GNULIBHEADERS_OVERRIDE_WINT_T GL_GENERATE_LIMITS_H_FALSE GL_GENERATE_LIMITS_H_TRUE LIMITS_H NEXT_AS_FIRST_DIRECTIVE_LIMITS_H NEXT_LIMITS_H NEXT_AS_FIRST_DIRECTIVE_ICONV_H NEXT_ICONV_H GL_GNULIB_ICONV GL_GENERATE_ICONV_H_FALSE GL_GENERATE_ICONV_H_TRUE ICONV_H REPLACE_ICONV_UTF REPLACE_ICONV_OPEN REPLACE_ICONV ICONV_CONST LTLIBICONV LIBICONV HOST_CPU_C_ABI HOST_CPU LIB_HARD_LOCALE LIB_SETLOCALE_NULL LIB_SCHED_YIELD LIBPMULTITHREAD LIBPTHREAD LTLIBINTL LIBINTL GETOPT_CDEFS_H GETOPT_H HAVE_SYS_CDEFS_H HAVE_GETOPT_H NEXT_AS_FIRST_DIRECTIVE_GETOPT_H NEXT_GETOPT_H GL_GNULIB_MDA_UMASK GL_GNULIB_MDA_MKDIR GL_GNULIB_MDA_CHMOD GL_GNULIB_OVERRIDES_STRUCT_STAT GL_GNULIB_UTIMENSAT GL_GNULIB_STAT GL_GNULIB_MKNODAT GL_GNULIB_MKNOD GL_GNULIB_MKFIFOAT GL_GNULIB_MKFIFO GL_GNULIB_MKDIRAT GL_GNULIB_MKDIR GL_GNULIB_LSTAT GL_GNULIB_LCHMOD GL_GNULIB_GETUMASK GL_GNULIB_FUTIMENS GL_GNULIB_FSTATAT GL_GNULIB_FSTAT GL_GNULIB_FCHMODAT WINDOWS_64_BIT_ST_SIZE WINDOWS_STAT_TIMESPEC NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H NEXT_SYS_STAT_H REPLACE_UTIMENSAT REPLACE_STAT REPLACE_MKNODAT REPLACE_MKNOD REPLACE_MKFIFOAT REPLACE_MKFIFO REPLACE_MKDIR REPLACE_LSTAT REPLACE_FUTIMENS REPLACE_FSTATAT REPLACE_FSTAT REPLACE_FCHMODAT HAVE_UTIMENSAT HAVE_MKNODAT HAVE_MKNOD HAVE_MKFIFOAT HAVE_MKFIFO HAVE_MKDIRAT HAVE_LSTAT HAVE_LCHMOD HAVE_GETUMASK HAVE_FUTIMENS HAVE_FSTATAT HAVE_FCHMODAT GL_GNULIB_MDA_TEMPNAM GL_GNULIB_MDA_PUTW GL_GNULIB_MDA_GETW GL_GNULIB_MDA_FILENO GL_GNULIB_MDA_FDOPEN GL_GNULIB_MDA_FCLOSEALL GL_GNULIB_VSPRINTF_POSIX GL_GNULIB_VSNPRINTF GL_GNULIB_VPRINTF_POSIX GL_GNULIB_VPRINTF GL_GNULIB_VFPRINTF_POSIX GL_GNULIB_VFPRINTF GL_GNULIB_VDPRINTF GL_GNULIB_VSCANF GL_GNULIB_VFSCANF GL_GNULIB_VASPRINTF GL_GNULIB_TMPFILE GL_GNULIB_STDIO_H_SIGPIPE GL_GNULIB_STDIO_H_NONBLOCKING GL_GNULIB_SPRINTF_POSIX GL_GNULIB_SNPRINTF GL_GNULIB_SCANF GL_GNULIB_RENAMEAT GL_GNULIB_RENAME GL_GNULIB_REMOVE GL_GNULIB_PUTS GL_GNULIB_PUTCHAR GL_GNULIB_PUTC GL_GNULIB_PRINTF_POSIX GL_GNULIB_PRINTF GL_GNULIB_POPEN GL_GNULIB_PERROR GL_GNULIB_PCLOSE GL_GNULIB_OBSTACK_PRINTF_POSIX GL_GNULIB_OBSTACK_PRINTF GL_GNULIB_GETLINE GL_GNULIB_GETDELIM GL_GNULIB_GETCHAR GL_GNULIB_GETC GL_GNULIB_FWRITE GL_GNULIB_FTELLO GL_GNULIB_FTELL GL_GNULIB_FSEEKO GL_GNULIB_FSEEK GL_GNULIB_FSCANF GL_GNULIB_FREOPEN GL_GNULIB_FREAD GL_GNULIB_FPUTS GL_GNULIB_FPUTC GL_GNULIB_FPURGE GL_GNULIB_FPRINTF_POSIX GL_GNULIB_FPRINTF GL_GNULIB_FOPEN GL_GNULIB_FGETS GL_GNULIB_FGETC GL_GNULIB_FFLUSH GL_GNULIB_FDOPEN GL_GNULIB_FCLOSE GL_GNULIB_DPRINTF REPLACE_VSPRINTF REPLACE_VSNPRINTF REPLACE_VPRINTF REPLACE_VFPRINTF REPLACE_VDPRINTF REPLACE_VASPRINTF REPLACE_TMPFILE REPLACE_STDIO_WRITE_FUNCS REPLACE_STDIO_READ_FUNCS REPLACE_SPRINTF REPLACE_SNPRINTF REPLACE_RENAMEAT REPLACE_RENAME REPLACE_REMOVE REPLACE_PRINTF REPLACE_POPEN REPLACE_PERROR REPLACE_OBSTACK_PRINTF REPLACE_GETLINE REPLACE_GETDELIM REPLACE_FTELLO REPLACE_FTELL REPLACE_FSEEKO REPLACE_FSEEK REPLACE_FREOPEN REPLACE_FPURGE REPLACE_FPRINTF REPLACE_FOPEN REPLACE_FFLUSH REPLACE_FDOPEN REPLACE_FCLOSE REPLACE_DPRINTF HAVE_VDPRINTF HAVE_VASPRINTF HAVE_RENAMEAT HAVE_POPEN HAVE_PCLOSE HAVE_FTELLO HAVE_FSEEKO HAVE_DPRINTF HAVE_DECL_VSNPRINTF HAVE_DECL_SNPRINTF HAVE_DECL_OBSTACK_PRINTF HAVE_DECL_GETLINE HAVE_DECL_GETDELIM HAVE_DECL_FTELLO HAVE_DECL_FSEEKO HAVE_DECL_FPURGE HAVE_DECL_FCLOSEALL GL_GNULIB_FNMATCH GL_GENERATE_FNMATCH_H_FALSE GL_GENERATE_FNMATCH_H_TRUE FNMATCH_H HAVE_FNMATCH_H NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H NEXT_FNMATCH_H REPLACE_FNMATCH HAVE_FNMATCH NEXT_AS_FIRST_DIRECTIVE_FCNTL_H NEXT_FCNTL_H GL_GNULIB_MDA_OPEN GL_GNULIB_MDA_CREAT GL_GNULIB_OPENAT GL_GNULIB_OPEN GL_GNULIB_NONBLOCKING GL_GNULIB_FCNTL GL_GNULIB_CREAT REPLACE_OPENAT REPLACE_OPEN REPLACE_FCNTL REPLACE_CREAT HAVE_OPENAT HAVE_FCNTL EOVERFLOW_VALUE EOVERFLOW_HIDDEN ENOLINK_VALUE ENOLINK_HIDDEN EMULTIHOP_VALUE EMULTIHOP_HIDDEN GL_GENERATE_ERRNO_H_FALSE GL_GENERATE_ERRNO_H_TRUE ERRNO_H NEXT_AS_FIRST_DIRECTIVE_ERRNO_H NEXT_ERRNO_H HAVE_DIRENT_H NEXT_AS_FIRST_DIRECTIVE_DIRENT_H NEXT_DIRENT_H GL_GNULIB_ISBLANK NEXT_AS_FIRST_DIRECTIVE_CTYPE_H NEXT_CTYPE_H PRAGMA_COLUMNS PRAGMA_SYSTEM_HEADER INCLUDE_NEXT_AS_FIRST_DIRECTIVE INCLUDE_NEXT HAVE_ISBLANK pkglibexecdir lispdir GL_GNULIB_ALPHASORT GL_GNULIB_SCANDIR GL_GNULIB_FDOPENDIR GL_GNULIB_DIRFD GL_GNULIB_CLOSEDIR GL_GNULIB_REWINDDIR GL_GNULIB_READDIR GL_GNULIB_OPENDIR REPLACE_FDOPENDIR REPLACE_DIRFD REPLACE_CLOSEDIR REPLACE_OPENDIR HAVE_ALPHASORT HAVE_SCANDIR HAVE_FDOPENDIR HAVE_DECL_FDOPENDIR HAVE_DECL_DIRFD HAVE_CLOSEDIR HAVE_REWINDDIR HAVE_READDIR HAVE_OPENDIR HAVE_WINSOCK2_H REPLACE_IOCTL SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS SYS_IOCTL_H_HAVE_WINSOCK2_H HAVE_MSVC_INVALID_PARAMETER_HANDLER UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS UNISTD_H_HAVE_WINSOCK2_H UNISTD_H_HAVE_SYS_RANDOM_H REPLACE_WRITE REPLACE_USLEEP REPLACE_UNLINKAT REPLACE_UNLINK REPLACE_TTYNAME_R REPLACE_TRUNCATE REPLACE_SYMLINKAT REPLACE_SYMLINK REPLACE_SLEEP REPLACE_RMDIR REPLACE_READLINKAT REPLACE_READLINK REPLACE_READ REPLACE_PWRITE REPLACE_PREAD REPLACE_LSEEK REPLACE_LINKAT REPLACE_LINK REPLACE_LCHOWN REPLACE_ISATTY REPLACE_GETPASS REPLACE_GETPAGESIZE REPLACE_GETGROUPS REPLACE_GETLOGIN_R REPLACE_GETDTABLESIZE REPLACE_GETDOMAINNAME REPLACE_GETCWD REPLACE_FTRUNCATE REPLACE_FCHOWNAT REPLACE_FACCESSAT REPLACE_EXECVPE REPLACE_EXECVP REPLACE_EXECVE REPLACE_EXECV REPLACE_EXECLP REPLACE_EXECLE REPLACE_EXECL REPLACE_DUP2 REPLACE_DUP REPLACE_CLOSE REPLACE_CHOWN REPLACE_ACCESS HAVE_SYS_PARAM_H HAVE_OS_H HAVE_DECL_TTYNAME_R HAVE_DECL_TRUNCATE HAVE_DECL_SETHOSTNAME HAVE_DECL_GETUSERSHELL HAVE_DECL_GETPAGESIZE HAVE_DECL_GETLOGIN_R HAVE_DECL_GETLOGIN HAVE_DECL_GETDOMAINNAME HAVE_DECL_FDATASYNC HAVE_DECL_FCHDIR HAVE_DECL_EXECVPE HAVE_DECL_ENVIRON HAVE_USLEEP HAVE_UNLINKAT HAVE_SYMLINKAT HAVE_SYMLINK HAVE_SLEEP HAVE_SETHOSTNAME HAVE_READLINKAT HAVE_READLINK HAVE_PWRITE HAVE_PREAD HAVE_PIPE2 HAVE_PIPE HAVE_LINKAT HAVE_LINK HAVE_LCHOWN HAVE_GROUP_MEMBER HAVE_GETPASS HAVE_GETPAGESIZE HAVE_GETLOGIN HAVE_GETHOSTNAME HAVE_GETGROUPS HAVE_GETENTROPY HAVE_GETDTABLESIZE HAVE_FTRUNCATE HAVE_FSYNC HAVE_FDATASYNC HAVE_FCHOWNAT HAVE_FCHDIR HAVE_FACCESSAT HAVE_EXECVPE HAVE_EUIDACCESS HAVE_DUP3 HAVE_COPY_FILE_RANGE HAVE_CHOWN GL_GNULIB_MDA_WRITE GL_GNULIB_MDA_UNLINK GL_GNULIB_MDA_SWAB GL_GNULIB_MDA_RMDIR GL_GNULIB_MDA_READ GL_GNULIB_MDA_LSEEK GL_GNULIB_MDA_ISATTY GL_GNULIB_MDA_GETPID GL_GNULIB_MDA_GETCWD GL_GNULIB_MDA_EXECVPE GL_GNULIB_MDA_EXECVP GL_GNULIB_MDA_EXECVE GL_GNULIB_MDA_EXECV GL_GNULIB_MDA_EXECLP GL_GNULIB_MDA_EXECLE GL_GNULIB_MDA_EXECL GL_GNULIB_MDA_DUP2 GL_GNULIB_MDA_DUP GL_GNULIB_MDA_CLOSE GL_GNULIB_MDA_CHDIR GL_GNULIB_MDA_ACCESS GL_GNULIB_WRITE GL_GNULIB_USLEEP GL_GNULIB_UNLINKAT GL_GNULIB_UNLINK GL_GNULIB_UNISTD_H_SIGPIPE GL_GNULIB_UNISTD_H_NONBLOCKING GL_GNULIB_UNISTD_H_GETOPT GL_GNULIB_TTYNAME_R GL_GNULIB_TRUNCATE GL_GNULIB_SYMLINKAT GL_GNULIB_SYMLINK GL_GNULIB_SLEEP GL_GNULIB_SETHOSTNAME GL_GNULIB_RMDIR GL_GNULIB_READLINKAT GL_GNULIB_READLINK GL_GNULIB_READ GL_GNULIB_PWRITE GL_GNULIB_PREAD GL_GNULIB_PIPE2 GL_GNULIB_PIPE GL_GNULIB_LSEEK GL_GNULIB_LINKAT GL_GNULIB_LINK GL_GNULIB_LCHOWN GL_GNULIB_ISATTY GL_GNULIB_GROUP_MEMBER GL_GNULIB_GETUSERSHELL GL_GNULIB_GETPASS GL_GNULIB_GETPAGESIZE GL_GNULIB_GETOPT_POSIX GL_GNULIB_GETLOGIN_R GL_GNULIB_GETLOGIN GL_GNULIB_GETHOSTNAME GL_GNULIB_GETGROUPS GL_GNULIB_GETENTROPY GL_GNULIB_GETDTABLESIZE GL_GNULIB_GETDOMAINNAME GL_GNULIB_GETCWD GL_GNULIB_FTRUNCATE GL_GNULIB_FSYNC GL_GNULIB_FDATASYNC GL_GNULIB_FCHOWNAT GL_GNULIB_FCHDIR GL_GNULIB_FACCESSAT GL_GNULIB_EXECVPE GL_GNULIB_EXECVP GL_GNULIB_EXECVE GL_GNULIB_EXECV GL_GNULIB_EXECLP GL_GNULIB_EXECLE GL_GNULIB_EXECL GL_GNULIB_EUIDACCESS GL_GNULIB_ENVIRON GL_GNULIB_DUP3 GL_GNULIB_DUP2 GL_GNULIB_DUP GL_GNULIB_COPY_FILE_RANGE GL_GNULIB_CLOSE GL_GNULIB_CHOWN GL_GNULIB_CHDIR GL_GNULIB_ACCESS GL_GNULIB_MDA_PUTENV GL_GNULIB_MDA_MKTEMP GL_GNULIB_MDA_GCVT GL_GNULIB_MDA_FCVT GL_GNULIB_MDA_ECVT GL_GNULIB_WCTOMB GL_GNULIB_UNSETENV GL_GNULIB_UNLOCKPT GL_GNULIB_SYSTEM_POSIX GL_GNULIB_STRTOULL GL_GNULIB_STRTOUL GL_GNULIB_STRTOLL GL_GNULIB_STRTOLD GL_GNULIB_STRTOL GL_GNULIB_STRTOD GL_GNULIB_SETENV GL_GNULIB_SECURE_GETENV GL_GNULIB_RPMATCH GL_GNULIB_REALPATH GL_GNULIB_REALLOC_POSIX GL_GNULIB_REALLOCARRAY GL_GNULIB_RANDOM_R GL_GNULIB_RANDOM GL_GNULIB_QSORT_R GL_GNULIB_PUTENV GL_GNULIB_PTSNAME_R GL_GNULIB_PTSNAME GL_GNULIB_POSIX_OPENPT GL_GNULIB_POSIX_MEMALIGN GL_GNULIB_MKSTEMPS GL_GNULIB_MKSTEMP GL_GNULIB_MKOSTEMPS GL_GNULIB_MKOSTEMP GL_GNULIB_MKDTEMP GL_GNULIB_MBTOWC GL_GNULIB_MALLOC_POSIX GL_GNULIB_GRANTPT GL_GNULIB_GETSUBOPT GL_GNULIB_GETLOADAVG GL_GNULIB_FREE_POSIX GL_GNULIB_CANONICALIZE_FILE_NAME GL_GNULIB_CALLOC_POSIX GL_GNULIB_ATOLL GL_GNULIB_ALIGNED_ALLOC GL_GNULIB__EXIT REPLACE_WCTOMB REPLACE_UNSETENV REPLACE_STRTOULL REPLACE_STRTOUL REPLACE_STRTOLL REPLACE_STRTOLD REPLACE_STRTOL REPLACE_STRTOD REPLACE_SETSTATE REPLACE_SETENV REPLACE_REALPATH REPLACE_REALLOCARRAY REPLACE_REALLOC REPLACE_RANDOM_R REPLACE_RANDOM REPLACE_QSORT_R REPLACE_PUTENV REPLACE_PTSNAME_R REPLACE_PTSNAME REPLACE_POSIX_MEMALIGN REPLACE_MKSTEMP REPLACE_MBTOWC REPLACE_MALLOC REPLACE_INITSTATE REPLACE_FREE REPLACE_CANONICALIZE_FILE_NAME REPLACE_CALLOC REPLACE_ALIGNED_ALLOC HAVE_DECL_UNSETENV HAVE_UNLOCKPT HAVE_SYS_LOADAVG_H HAVE_STRUCT_RANDOM_DATA HAVE_STRTOULL HAVE_STRTOUL HAVE_STRTOLL HAVE_STRTOLD HAVE_STRTOL HAVE_STRTOD HAVE_DECL_SETSTATE HAVE_SETSTATE HAVE_DECL_SETENV HAVE_SETENV HAVE_SECURE_GETENV HAVE_RPMATCH HAVE_REALPATH HAVE_REALLOCARRAY HAVE_RANDOM_R HAVE_RANDOM_H HAVE_RANDOM HAVE_QSORT_R HAVE_PTSNAME_R HAVE_PTSNAME HAVE_POSIX_OPENPT HAVE_POSIX_MEMALIGN HAVE_MKSTEMPS HAVE_MKSTEMP HAVE_MKOSTEMPS HAVE_MKOSTEMP HAVE_MKDTEMP HAVE_MBTOWC HAVE_DECL_INITSTATE HAVE_INITSTATE HAVE_GRANTPT HAVE_GETSUBOPT HAVE_DECL_GETLOADAVG HAVE_DECL_GCVT HAVE_DECL_FCVT HAVE_DECL_ECVT HAVE_CANONICALIZE_FILE_NAME HAVE_ATOLL HAVE_ALIGNED_ALLOC HAVE__EXIT LTLIBCSTACK LIBCSTACK GL_GNULIB_MDA_WCSDUP GL_GNULIB_WCSFTIME GL_GNULIB_WCSWIDTH GL_GNULIB_WCSTOK GL_GNULIB_WCSSTR GL_GNULIB_WCSPBRK GL_GNULIB_WCSSPN GL_GNULIB_WCSCSPN GL_GNULIB_WCSRCHR GL_GNULIB_WCSCHR GL_GNULIB_WCSDUP GL_GNULIB_WCSXFRM GL_GNULIB_WCSCOLL GL_GNULIB_WCSNCASECMP GL_GNULIB_WCSCASECMP GL_GNULIB_WCSNCMP GL_GNULIB_WCSCMP GL_GNULIB_WCSNCAT GL_GNULIB_WCSCAT GL_GNULIB_WCPNCPY GL_GNULIB_WCSNCPY GL_GNULIB_WCPCPY GL_GNULIB_WCSCPY GL_GNULIB_WCSNLEN GL_GNULIB_WCSLEN GL_GNULIB_WMEMSET GL_GNULIB_WMEMPCPY GL_GNULIB_WMEMMOVE GL_GNULIB_WMEMCPY GL_GNULIB_WMEMCMP GL_GNULIB_WMEMCHR GL_GNULIB_WCWIDTH GL_GNULIB_WCSNRTOMBS GL_GNULIB_WCSRTOMBS GL_GNULIB_WCRTOMB GL_GNULIB_MBSNRTOWCS GL_GNULIB_MBSRTOWCS GL_GNULIB_MBRLEN GL_GNULIB_MBRTOWC GL_GNULIB_MBSINIT GL_GNULIB_WCTOB GL_GNULIB_BTOWC LOCALE_FR REPLACE_WCSTOK REPLACE_WCSFTIME REPLACE_WCSWIDTH REPLACE_WCWIDTH REPLACE_WCSNRTOMBS REPLACE_WCSRTOMBS REPLACE_WCRTOMB REPLACE_MBSNRTOWCS REPLACE_MBSRTOWCS REPLACE_MBRLEN REPLACE_MBRTOWC REPLACE_MBSINIT REPLACE_WCTOB REPLACE_BTOWC REPLACE_MBSTATE_T HAVE_DECL_WCWIDTH HAVE_DECL_WCSDUP HAVE_DECL_WCTOB HAVE_WCSFTIME HAVE_WCSWIDTH HAVE_WCSTOK HAVE_WCSSTR HAVE_WCSPBRK HAVE_WCSSPN HAVE_WCSCSPN HAVE_WCSRCHR HAVE_WCSCHR HAVE_WCSDUP HAVE_WCSXFRM HAVE_WCSCOLL HAVE_WCSNCASECMP HAVE_WCSCASECMP HAVE_WCSNCMP HAVE_WCSCMP HAVE_WCSNCAT HAVE_WCSCAT HAVE_WCPNCPY HAVE_WCSNCPY HAVE_WCPCPY HAVE_WCSCPY HAVE_WCSNLEN HAVE_WCSLEN HAVE_WMEMSET HAVE_WMEMPCPY HAVE_WMEMMOVE HAVE_WMEMCPY HAVE_WMEMCMP HAVE_WMEMCHR HAVE_WCSNRTOMBS HAVE_WCSRTOMBS HAVE_WCRTOMB HAVE_MBSNRTOWCS HAVE_MBSRTOWCS HAVE_MBRLEN HAVE_MBRTOWC HAVE_MBSINIT HAVE_BTOWC HAVE_ALLOCA_H GL_GENERATE_ALLOCA_H_FALSE GL_GENERATE_ALLOCA_H_TRUE ALLOCA_H ALLOCA GL_COND_LIBTOOL_FALSE GL_COND_LIBTOOL_TRUE PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG RANLIB ARFLAGS AR EGREP GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC host_os host_vendor host_cpu host build_os build_vendor build_cpu build AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V CSCOPE ETAGS CTAGS am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_largefile enable_year2038 enable_threads enable_cross_guesses enable_assert with_gnu_ld enable_rpath with_libiconv_prefix with_included_regex with_libsigsegv with_libsigsegv_prefix with_packager with_packager_version with_packager_bug_reports enable_gcc_warnings enable_nls with_libintl_prefix enable_perl_regexp ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PCRE_CFLAGS PCRE_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures GNU grep 3.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/grep] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of GNU grep 3.7:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --disable-largefile omit support for large files --disable-year2038 omit support for timestamps past the year 2038 --enable-threads={isoc|posix|isoc+posix|windows} specify multithreading API --disable-threads build without multithread safety --enable-cross-guesses={conservative|risky} specify policy for cross-compilation guesses --disable-assert turn off assertions --disable-rpath do not hardcode runtime library paths --enable-gcc-warnings turn on lots of GCC warnings (for developers) --disable-nls do not use Native Language Support --disable-perl-regexp disable perl-regexp (pcre) support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --without-included-regex don't compile regex; this is the default on systems with recent-enough versions of the GNU C Library (use with caution on other systems). --with-libsigsegv use the GNU libsigsegv library, when present, instead of the gnulib module 'sigsegv' --with-libsigsegv-prefix[=DIR] search for libsigsegv in DIR/include and DIR/lib --without-libsigsegv-prefix don't search for libsigsegv in includedir and libdir --with-packager String identifying the packager of this software --with-packager-version Packager-specific version information --with-packager-bug-reports Packager info for bug reports (URL/e-mail/...) --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path PCRE_CFLAGS C compiler flags for PCRE, overriding pkg-config PCRE_LIBS linker flags for PCRE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to <bug-grep@gnu.org>. GNU grep home page: <https://www.gnu.org/software/grep/>. General help using GNU software: <https://www.gnu.org/gethelp/>. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF GNU grep configure 3.7 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_run LINENO # ---------------------- # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that # executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case <limits.h> declares $2. For example, HP-UX 11i <limits.h> declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. */ #include <limits.h> #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR # ------------------------------------------------------------------ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. ac_fn_check_decl () { ac_save_ac_compile="$ac_compile" if test -n "$ac_compile_for_check_decl"; then ac_compile="$ac_compile_for_check_decl" fi as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 printf %s "checking whether $as_decl_name is declared... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` eval ac_save_FLAGS=\$$6 as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval $6=\$ac_save_FLAGS fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno ac_compile="$ac_save_ac_compile" } # ac_fn_check_decl # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=$ac_mid; break else $as_nop as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_lo=$ac_mid; break else $as_nop as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done else $as_nop ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=$ac_mid else $as_nop as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval (void) { return $2; } static unsigned long int ulongval (void) { return $2; } #include <stdio.h> #include <stdlib.h> int main (void) { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : echo >>conftest.val; read $3 <conftest.val; ac_retval=0 else $as_nop ac_retval=1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext rm -f conftest.val fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_compute_int # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 printf %s "checking for $2.$3... " >&6; } if eval test \${$4+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main (void) { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main (void) { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" else $as_nop eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$4 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GNU grep $as_me 3.7, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include <stddef.h> #include <stdarg.h> struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' // Does the compiler advertise C99 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif #include <stdbool.h> extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' // Does the compiler advertise C11 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" as_fn_append ac_func_c_list " btowc HAVE_BTOWC" as_fn_append ac_header_c_list " sys/param.h sys_param_h HAVE_SYS_PARAM_H" as_fn_append ac_func_c_list " _set_invalid_parameter_handler HAVE__SET_INVALID_PARAMETER_HANDLER" as_fn_append ac_header_c_list " sys/socket.h sys_socket_h HAVE_SYS_SOCKET_H" as_fn_append ac_func_c_list " fchdir HAVE_FCHDIR" as_fn_append ac_header_c_list " dirent.h dirent_h HAVE_DIRENT_H" as_fn_append ac_func_c_list " fcntl HAVE_FCNTL" as_fn_append ac_func_c_list " symlink HAVE_SYMLINK" as_fn_append ac_func_c_list " fdopendir HAVE_FDOPENDIR" as_fn_append ac_func_c_list " mempcpy HAVE_MEMPCPY" as_fn_append ac_header_c_list " fnmatch.h fnmatch_h HAVE_FNMATCH_H" as_fn_append ac_func_c_list " fnmatch HAVE_FNMATCH" as_fn_append ac_func_c_list " mbsrtowcs HAVE_MBSRTOWCS" as_fn_append ac_header_c_list " stdio_ext.h stdio_ext_h HAVE_STDIO_EXT_H" as_fn_append ac_func_c_list " fstatat HAVE_FSTATAT" as_fn_append ac_func_c_list " openat HAVE_OPENAT" as_fn_append ac_func_c_list " fstatfs HAVE_FSTATFS" as_fn_append ac_header_c_list " sys/vfs.h sys_vfs_h HAVE_SYS_VFS_H" as_fn_append ac_func_c_list " getdtablesize HAVE_GETDTABLESIZE" gl_getopt_required=GNU as_fn_append ac_header_c_list " getopt.h getopt_h HAVE_GETOPT_H" as_fn_append ac_header_c_list " sys/cdefs.h sys_cdefs_h HAVE_SYS_CDEFS_H" as_fn_append ac_func_c_list " getprogname HAVE_GETPROGNAME" as_fn_append ac_func_c_list " getexecname HAVE_GETEXECNAME" as_fn_append ac_header_c_list " threads.h threads_h HAVE_THREADS_H" as_fn_append ac_header_c_list " iconv.h iconv_h HAVE_ICONV_H" as_fn_append ac_header_c_list " limits.h limits_h HAVE_LIMITS_H" as_fn_append ac_func_c_list " isblank HAVE_ISBLANK" as_fn_append ac_func_c_list " iswcntrl HAVE_ISWCNTRL" as_fn_append ac_header_c_list " crtdefs.h crtdefs_h HAVE_CRTDEFS_H" as_fn_append ac_header_c_list " wctype.h wctype_h HAVE_WCTYPE_H" as_fn_append ac_func_c_list " iswblank HAVE_ISWBLANK" as_fn_append ac_header_c_list " langinfo.h langinfo_h HAVE_LANGINFO_H" as_fn_append ac_header_c_list " xlocale.h xlocale_h HAVE_XLOCALE_H" as_fn_append ac_func_c_list " lstat HAVE_LSTAT" as_fn_append ac_func_c_list " mbsinit HAVE_MBSINIT" as_fn_append ac_func_c_list " mbrtowc HAVE_MBRTOWC" as_fn_append ac_func_c_list " mbrlen HAVE_MBRLEN" as_fn_append ac_func_c_list " mbslen HAVE_MBSLEN" as_fn_append ac_header_c_list " sys/mman.h sys_mman_h HAVE_SYS_MMAN_H" as_fn_append ac_func_c_list " mprotect HAVE_MPROTECT" as_fn_append ac_func_c_list " nl_langinfo HAVE_NL_LANGINFO" as_fn_append ac_func_c_list " pipe HAVE_PIPE" as_fn_append ac_header_c_list " malloc.h malloc_h HAVE_MALLOC_H" as_fn_append ac_func_c_list " iswctype HAVE_ISWCTYPE" as_fn_append ac_func_c_list " sigaltstack HAVE_SIGALTSTACK" as_fn_append ac_func_c_list " setrlimit HAVE_SETRLIMIT" as_fn_append ac_func_c_list " getrlimit HAVE_GETRLIMIT" as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H" as_fn_append ac_func_c_list " strerror_r HAVE_STRERROR_R" as_fn_append ac_func_c_list " __xpg_strerror_r HAVE___XPG_STRERROR_R" as_fn_append ac_func_c_list " strtoimax HAVE_STRTOIMAX" as_fn_append ac_func_c_list " strtoumax HAVE_STRTOUMAX" as_fn_append ac_header_c_list " features.h features_h HAVE_FEATURES_H" as_fn_append ac_func_c_list " wcrtomb HAVE_WCRTOMB" as_fn_append ac_func_c_list " wctob HAVE_WCTOB" as_fn_append ac_func_c_list " wcwidth HAVE_WCWIDTH" as_fn_append ac_func_c_list " wmempcpy HAVE_WMEMPCPY" as_fn_append ac_header_c_list " arpa/inet.h arpa_inet_h HAVE_ARPA_INET_H" as_fn_append ac_func_c_list " ftruncate HAVE_FTRUNCATE" as_fn_append ac_func_c_list " gettimeofday HAVE_GETTIMEOFDAY" as_fn_append ac_func_c_list " duplocale HAVE_DUPLOCALE" as_fn_append ac_header_c_list " netdb.h netdb_h HAVE_NETDB_H" as_fn_append ac_header_c_list " netinet/in.h netinet_in_h HAVE_NETINET_IN_H" as_fn_append ac_func_c_list " newlocale HAVE_NEWLOCALE" as_fn_append ac_func_c_list " uselocale HAVE_USELOCALE" as_fn_append ac_func_c_list " freelocale HAVE_FREELOCALE" as_fn_append ac_header_c_list " sys/select.h sys_select_h HAVE_SYS_SELECT_H" as_fn_append ac_header_c_list " pthread.h pthread_h HAVE_PTHREAD_H" as_fn_append ac_func_c_list " pthread_sigmask HAVE_PTHREAD_SIGMASK" as_fn_append ac_header_c_list " sys/wait.h sys_wait_h HAVE_SYS_WAIT_H" as_fn_append ac_func_c_list " setenv HAVE_SETENV" as_fn_append ac_func_c_list " sigaction HAVE_SIGACTION" as_fn_append ac_func_c_list " siginterrupt HAVE_SIGINTERRUPT" as_fn_append ac_func_c_list " sleep HAVE_SLEEP" as_fn_append ac_func_c_list " snprintf HAVE_SNPRINTF" as_fn_append ac_func_c_list " catgets HAVE_CATGETS" as_fn_append ac_header_c_list " sys/ioctl.h sys_ioctl_h HAVE_SYS_IOCTL_H" as_fn_append ac_func_c_list " shutdown HAVE_SHUTDOWN" as_fn_append ac_header_c_list " sys/uio.h sys_uio_h HAVE_SYS_UIO_H" as_fn_append ac_func_c_list " vasnprintf HAVE_VASNPRINTF" as_fn_append ac_func_c_list " isascii HAVE_ISASCII" as_fn_append ac_func_c_list " setlocale HAVE_SETLOCALE" gt_needs="$gt_needs " # Auxiliary files required by this configure script. ac_aux_files="config.rpath compile config.guess config.sub missing install-sh" # Locations in which to look for auxiliary files. ac_aux_dir_candidates="${srcdir}/build-aux" # Search for a directory containing all of the required auxiliary files, # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. # If we don't find one directory that contains all the files we need, # we report the set of missing files from the *first* directory in # $ac_aux_dir_candidates and give up. ac_missing_aux_files="" ac_first_candidate=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in $ac_aux_dir_candidates do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 ac_aux_dir_found=yes ac_install_sh= for ac_aux in $ac_aux_files do # As a special case, if "install-sh" is required, that requirement # can be satisfied by any of "install-sh", "install.sh", or "shtool", # and $ac_install_sh is set appropriately for whichever one is found. if test x"$ac_aux" = x"install-sh" then if test -f "${as_dir}install-sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 ac_install_sh="${as_dir}install-sh -c" elif test -f "${as_dir}install.sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 ac_install_sh="${as_dir}install.sh -c" elif test -f "${as_dir}shtool"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 ac_install_sh="${as_dir}shtool install -c" else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} install-sh" else break fi fi else if test -f "${as_dir}${ac_aux}"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" else break fi fi fi done if test "$ac_aux_dir_found" = yes; then ac_aux_dir="$as_dir" break fi ac_first_candidate=false as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. if test -f "${ac_aux_dir}config.guess"; then ac_config_guess="$SHELL ${ac_aux_dir}config.guess" fi if test -f "${ac_aux_dir}config.sub"; then ac_config_sub="$SHELL ${ac_aux_dir}config.sub" fi if test -f "$ac_aux_dir/configure"; then ac_configure="$SHELL ${ac_aux_dir}configure" fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$GREP" || test -n "$EGREP"; then as_fn_error $? "no working 'grep' found A working 'grep' command is needed to build GNU Grep. This 'grep' should support -e and long lines. On Solaris 10, install the package SUNWggrp or SUNWxcu4. On Solaris 11, install the package text/gnu-grep or system/xopen/xcu4." "$LINENO" 5 fi printf "%s\n" "#define GREP 1" >>confdefs.h am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac # Account for fact that we put trailing slashes in our PATH walk. case $as_dir in #(( ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test ${ac_cv_path_mkdir+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir ('*'coreutils) '* | \ 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 printf "%s\n" "$AWK" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 else $as_nop if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='grep' VERSION='3.7' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi if test -z "$ETAGS"; then ETAGS=etags fi if test -z "$CSCOPE"; then CSCOPE=cscope fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: <https://www.gnu.org/software/coreutils/>. If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 else $as_nop if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' # make --enable-silent-rules the default. ac_config_headers="$ac_config_headers config.h:config.hin" # Make sure we can run config.sub. $SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 printf "%s\n" "$AWK" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> int main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler is clang" >&5 printf %s "checking whether the compiler is clang... " >&6; } if test ${gl_cv_compiler_clang+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __clang__ barfbarf #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_compiler_clang=no else $as_nop gl_cv_compiler_clang=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_compiler_clang" >&5 printf "%s\n" "$gl_cv_compiler_clang" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compiler option needed when checking for declarations" >&5 printf %s "checking for compiler option needed when checking for declarations... " >&6; } if test ${gl_cv_compiler_check_decl_option+y} then : printf %s "(cached) " >&6 else $as_nop if test $gl_cv_compiler_clang = yes; then save_ac_compile="$ac_compile" ac_compile="$ac_compile -Werror=implicit-function-declaration" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration' else $as_nop gl_cv_compiler_check_decl_option=none fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_compile="$save_ac_compile" else gl_cv_compiler_check_decl_option=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_compiler_check_decl_option" >&5 printf "%s\n" "$gl_cv_compiler_check_decl_option" >&6; } if test "x$gl_cv_compiler_check_decl_option" != xnone; then ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option" else ac_compile_for_check_decl="$ac_compile" fi DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test ${enable_dependency_tracking+y} then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } if test ${ac_cv_safe_to_define___extensions__+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_safe_to_define___extensions__=yes else $as_nop ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } if test ${ac_cv_should_define__xopen_source+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_should_define__xopen_source=no if test $ac_cv_header_wchar_h = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> mbstate_t x; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE 500 #include <wchar.h> mbstate_t x; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_should_define__xopen_source=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h if test $ac_cv_header_minix_config_h = yes then : MINIX=yes printf "%s\n" "#define _MINIX 1" >>confdefs.h printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h else $as_nop MINIX= fi if test $ac_cv_safe_to_define___extensions__ = yes then : printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h fi if test $ac_cv_should_define__xopen_source = yes then : printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h fi case "$host_os" in openbsd*) printf "%s\n" "#define _ISOC11_SOURCE 1" >>confdefs.h ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 printf %s "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test ${ac_cv_prog_CPP+y} then : printf %s "(cached) " >&6 else $as_nop # Double quotes because $CC needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 printf "%s\n" "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 printf %s "checking for grep that handles long lines and -e... " >&6; } if test ${ac_cv_path_GREP+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in grep ggrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 printf %s "checking for egrep... " >&6; } if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in egrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Minix Amsterdam compiler" >&5 printf %s "checking for Minix Amsterdam compiler... " >&6; } if test ${gl_cv_c_amsterdam_compiler+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ACK__ Amsterdam #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Amsterdam" >/dev/null 2>&1 then : gl_cv_c_amsterdam_compiler=yes else $as_nop gl_cv_c_amsterdam_compiler=no fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_amsterdam_compiler" >&5 printf "%s\n" "$gl_cv_c_amsterdam_compiler" >&6; } if test $gl_cv_c_amsterdam_compiler = yes; then if test -z "$AR"; then AR='cc -c.a' fi if test -z "$ARFLAGS"; then ARFLAGS='-o' fi else : fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="ar" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi if test -z "$ARFLAGS"; then ARFLAGS='cr' fi if test -z "$RANLIB"; then if test $gl_cv_c_amsterdam_compiler = yes; then RANLIB=':' else if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi fi fi # IEEE behaviour is the default on all CPUs except Alpha and SH # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4 # and the GCC 4.1.2 manual). case "$host_cpu" in alpha*) # On Alpha systems, a compiler option provides the behaviour. # See the ieee(3) manual page, also available at # <https://backdrift.org/man/tru64/man3/ieee.3.html> if test -n "$GCC"; then # GCC has the option -mieee. # For full IEEE compliance (rarely needed), use option -mieee-with-inexact. CPPFLAGS="$CPPFLAGS -mieee" else # Compaq (ex-DEC) C has the option -ieee, equivalent to -ieee_with_no_inexact. # For full IEEE compliance (rarely needed), use option -ieee_with_inexact. CPPFLAGS="$CPPFLAGS -ieee" fi ;; sh*) if test -n "$GCC"; then # GCC has the option -mieee. CPPFLAGS="$CPPFLAGS -mieee" fi ;; esac # Check whether --enable-largefile was given. if test ${enable_largefile+y} then : enableval=$enable_largefile; fi if test "$enable_largefile" != no then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 printf %s "checking for special C compiler options needed for large files... " >&6; } if test ${ac_cv_sys_largefile_CC+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : break fi rm -f core conftest.err conftest.$ac_objext conftest.beam CC="$CC -n32" if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if test ${ac_cv_sys_file_offset_bits+y} then : printf %s "(cached) " >&6 else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #undef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h ;; esac rm -rf conftest* case $ac_cv_sys_file_offset_bits in #( unknown) : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } if test ${ac_cv_sys_large_files+y} then : printf %s "(cached) " >&6 else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #undef _LARGE_FILES #define _LARGE_FILES 1 #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 printf "%s\n" "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h ;; esac rm -rf conftest* ;; #( 64) : # Check whether --enable-year2038 was given. if test ${enable_year2038+y} then : enableval=$enable_year2038; fi if test "$enable_year2038" != no then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for time_t past the year 2038" >&5 printf %s "checking for time_t past the year 2038... " >&6; } if test ${gl_cv_type_time_t_y2038+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <time.h> /* Check that time_t can represent 2**32 - 1 correctly. */ #define LARGE_TIME_T \\ ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 && LARGE_TIME_T % 65537 == 0) ? 1 : -1]; _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_type_time_t_y2038=yes else $as_nop gl_cv_type_time_t_y2038=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_time_t_y2038" >&5 printf "%s\n" "$gl_cv_type_time_t_y2038" >&6; } if test "$gl_cv_type_time_t_y2038" = no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit time_t with _TIME_BITS=64" >&5 printf %s "checking for 64-bit time_t with _TIME_BITS=64... " >&6; } if test ${gl_cv_type_time_t_bits_macro+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _TIME_BITS 64 #define _FILE_OFFSET_BITS 64 #include <time.h> /* Check that time_t can represent 2**32 - 1 correctly. */ #define LARGE_TIME_T \\ ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 && LARGE_TIME_T % 65537 == 0) ? 1 : -1]; _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_type_time_t_bits_macro=yes else $as_nop gl_cv_type_time_t_bits_macro=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_time_t_bits_macro" >&5 printf "%s\n" "$gl_cv_type_time_t_bits_macro" >&6; } if test "$gl_cv_type_time_t_bits_macro" = yes; then printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h printf "%s\n" "#define _FILE_OFFSET_BITS 64" >>confdefs.h gl_cv_type_time_t_y2038=yes fi fi if test $gl_cv_type_time_t_y2038 = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _USE_32BIT_TIME_T int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The 'time_t' type stops working after January 2038. Remove _USE_32BIT_TIME_T from the compiler flags. See \`config.log' for more details" "$LINENO" 5; } else $as_nop # If not cross-compiling and says we should check, # and 'touch' works with a large timestamp, then evidently wider time_t # is desired and supported, so fail and ask the builder to fix the # problem. Otherwise, just warn the builder. if test "$gl_warned_about_y2038" != yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: The 'time_t' type stops working after January 2038, and this package needs a wider 'time_t' type if there is any way to access timestamps after that. Configure with 'CC=\"${CC} -m64\"' perhaps?" >&5 printf "%s\n" "$as_me: WARNING: The 'time_t' type stops working after January 2038, and this package needs a wider 'time_t' type if there is any way to access timestamps after that. Configure with 'CC=\"${CC} -m64\"' perhaps?" >&2;} gl_warned_about_y2038=yes fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi ;; #( *) : ;; esac fi case "$host_os" in mingw*) printf "%s\n" "#define __MINGW_USE_VC2005_COMPAT 1" >>confdefs.h ;; esac # Check whether --enable-threads was given. if test ${enable_threads+y} then : enableval=$enable_threads; gl_use_threads=$enableval else $as_nop if test -n "$gl_use_threads_default"; then gl_use_threads="$gl_use_threads_default" else case "$host_os" in osf*) gl_use_threads=no ;; cygwin*) case `uname -r` in 1.[0-5].*) gl_use_threads=no ;; *) gl_use_threads=yes ;; esac ;; mingw*) case "$gl_use_winpthreads_default" in yes) gl_use_threads=posix ;; no) gl_use_threads=windows ;; *) gl_use_threads=yes ;; esac ;; *) gl_use_threads=yes ;; esac fi fi if test "$gl_use_threads" = yes \ || test "$gl_use_threads" = isoc \ || test "$gl_use_threads" = posix \ || test "$gl_use_threads" = isoc+posix; then # For using <threads.h> or <pthread.h>: if test -z "$gl_anythreadlib_early_done"; then case "$host_os" in osf*) # On OSF/1, the compiler needs the flag -D_REENTRANT so that it # groks <pthread.h>. cc also understands the flag -pthread, but # we don't use it because 1. gcc-2.95 doesn't understand -pthread, # 2. putting a flag into CPPFLAGS that has an effect on the linker # causes the AC_LINK_IFELSE test below to succeed unexpectedly, # leading to wrong values of LIBTHREAD and LTLIBTHREAD. CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac # Some systems optimize for single-threaded programs by default, and # need special flags to disable these optimizations. For example, the # definition of 'errno' in <errno.h>. case "$host_os" in aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac gl_anythreadlib_early_done=done fi fi # Pre-early section. # Code from module absolute-header: # Code from module accept: # Code from module accept-tests: # Code from module alignof: # Code from module alignof-tests: # Code from module alloca: # Code from module alloca-opt: # Code from module alloca-opt-tests: # Code from module announce-gen: # Code from module argmatch: # Code from module argmatch-tests: # Code from module arpa_inet: # Code from module arpa_inet-tests: # Code from module assert: # Code from module assure: # Code from module at-internal: # Code from module attribute: # Code from module basename-lgpl: # Code from module binary-io: # Code from module binary-io-tests: # Code from module bind: # Code from module bind-tests: # Code from module bitrotate: # Code from module bitrotate-tests: # Code from module btowc: # Code from module btowc-tests: # Code from module builtin-expect: # Code from module c-ctype: # Code from module c-ctype-tests: # Code from module c-stack: # Code from module c-stack-tests: # Code from module c-strcase: # Code from module c-strcase-tests: # Code from module c-strcaseeq: # Code from module c99: # Code from module calloc-gnu: # Code from module calloc-gnu-tests: # Code from module calloc-posix: # Code from module chdir: # Code from module chdir-long: # Code from module chdir-tests: # Code from module cloexec: # Code from module cloexec-tests: # Code from module close: # Code from module close-stream: # Code from module close-tests: # Code from module closedir: # Code from module closeout: # Code from module configmake: # Code from module connect: # Code from module connect-tests: # Code from module ctype: # Code from module ctype-tests: # Code from module cycle-check: # Code from module d-ino: # Code from module d-type: # Code from module dev-ino: # Code from module dfa: # Code from module dfa-tests: # Code from module dirent: # Code from module dirent-tests: # Code from module dirfd: # Code from module dirname-lgpl: # Code from module do-release-commit-and-tag: # Code from module double-slash-root: # Code from module dup: # Code from module dup-tests: # Code from module dup2: # Code from module dup2-tests: # Code from module dynarray: # Code from module dynarray-tests: # Code from module environ: # Code from module environ-tests: # Code from module errno: # Code from module errno-tests: # Code from module error: # Code from module exclude: # Code from module exclude-tests: # Code from module exitfail: # Code from module extensions: # Code from module extern-inline: # Code from module fchdir: # Code from module fchdir-tests: # Code from module fcntl: # Code from module fcntl-h: # Code from module fcntl-h-tests: # Code from module fcntl-safer: # Code from module fcntl-safer-tests: # Code from module fcntl-tests: # Code from module fd-hook: # Code from module fd-safer-flag: # Code from module fdl: # Code from module fdopen: # Code from module fdopen-tests: # Code from module fdopendir: # Code from module fdopendir-tests: # Code from module fgetc-tests: # Code from module filename: # Code from module filenamecat-lgpl: # Code from module flexmember: # Code from module float: # Code from module float-tests: # Code from module fnmatch: # Code from module fnmatch-h: # Code from module fnmatch-h-tests: # Code from module fnmatch-tests: # Code from module fopen: # Code from module fopen-gnu: # Code from module fopen-gnu-tests: # Code from module fopen-tests: # Code from module fpending: # Code from module fpending-tests: # Code from module fpieee: # Code from module fpucw: # Code from module fputc-tests: # Code from module fread-tests: # Code from module free-posix: # Code from module free-posix-tests: # Code from module fstat: # Code from module fstat-tests: # Code from module fstatat: # Code from module fstatat-tests: # Code from module ftruncate: # Code from module ftruncate-tests: # Code from module fts: # Code from module fwrite-tests: # Code from module gendocs: # Code from module getcwd-lgpl: # Code from module getcwd-lgpl-tests: # Code from module getdtablesize: # Code from module getdtablesize-tests: # Code from module getopt-gnu: # Code from module getopt-gnu-tests: # Code from module getopt-posix: # Code from module getopt-posix-tests: # Code from module getpagesize: # Code from module getprogname: # Code from module getprogname-tests: # Code from module gettext-h: # Code from module gettimeofday: # Code from module gettimeofday-tests: # Code from module git-version-gen: # Code from module gitlog-to-changelog: # Code from module gnu-web-doc-update: # Code from module gnumakefile: # Code from module gnupload: # Code from module gperf: # Code from module hard-locale: # Code from module hard-locale-tests: # Code from module hash: # Code from module hash-pjw: # Code from module hash-tests: # Code from module havelib: # Code from module host-cpu-c-abi: # Code from module i-ring: # Code from module i-ring-tests: # Code from module ialloc: # Code from module iconv: # Code from module iconv-h: # Code from module iconv-h-tests: # Code from module iconv-tests: # Code from module iconv_open: # Code from module idx: # Code from module ignore-value: # Code from module ignore-value-tests: # Code from module include_next: # Code from module inet_pton: # Code from module inet_pton-tests: # Code from module inline: # Code from module intprops: # Code from module intprops-tests: # Code from module inttostr: # Code from module inttostr-tests: # Code from module inttypes: # Code from module inttypes-incomplete: # Code from module inttypes-tests: # Code from module ioctl: # Code from module ioctl-tests: # Code from module isatty: # Code from module isatty-tests: # Code from module isblank: # Code from module isblank-tests: # Code from module iswblank: # Code from module iswblank-tests: # Code from module iswctype: # Code from module iswdigit: # Code from module iswdigit-tests: # Code from module iswxdigit: # Code from module iswxdigit-tests: # Code from module langinfo: # Code from module langinfo-tests: # Code from module largefile: # Code from module libc-config: # Code from module limits-h: # Code from module limits-h-tests: # Code from module listen: # Code from module listen-tests: # Code from module localcharset: # Code from module localcharset-tests: # Code from module locale: # Code from module locale-tests: # Code from module localeconv: # Code from module localeconv-tests: # Code from module localename: # Code from module localename-tests: # Code from module lock: # Code from module lseek: # Code from module lseek-tests: # Code from module lstat: # Code from module lstat-tests: # Code from module maintainer-makefile: # Code from module malloc-gnu: # Code from module malloc-gnu-tests: # Code from module malloc-posix: # Code from module malloca: # Code from module malloca-tests: # Code from module manywarnings: # Code from module mbchar: # Code from module mbiter: # Code from module mbrlen: # Code from module mbrtowc: # Code from module mbscasecmp: # Code from module mbscasecmp-tests: # Code from module mbsinit: # Code from module mbsinit-tests: # Code from module mbslen: # Code from module mbsrtowcs: # Code from module mbsrtowcs-tests: # Code from module mbsstr: # Code from module mbsstr-tests: # Code from module mbtowc: # Code from module mbuiter: # Code from module memchr: # Code from module memchr-tests: # Code from module memchr2: # Code from module memchr2-tests: # Code from module mempcpy: # Code from module memrchr: # Code from module memrchr-tests: # Code from module minmax: # Code from module msvc-inval: # Code from module msvc-nothrow: # Code from module multiarch: # Code from module nanosleep: # Code from module nanosleep-tests: # Code from module netinet_in: # Code from module netinet_in-tests: # Code from module nl_langinfo: # Code from module nl_langinfo-tests: # Code from module nocrash: # Code from module obstack: # Code from module open: # Code from module open-tests: # Code from module openat: # Code from module openat-die: # Code from module openat-h: # Code from module openat-safer: # Code from module openat-safer-tests: # Code from module openat-tests: # Code from module opendir: # Code from module opendirat: # Code from module pathmax: # Code from module pathmax-tests: # Code from module perl: # Code from module perror: # Code from module perror-tests: # Code from module pipe-posix: # Code from module pipe-posix-tests: # Code from module propername: # Code from module pthread-h: if test -z "$gl_anythreadlib_early_done"; then case "$host_os" in osf*) # On OSF/1, the compiler needs the flag -D_REENTRANT so that it # groks <pthread.h>. cc also understands the flag -pthread, but # we don't use it because 1. gcc-2.95 doesn't understand -pthread, # 2. putting a flag into CPPFLAGS that has an effect on the linker # causes the AC_LINK_IFELSE test below to succeed unexpectedly, # leading to wrong values of LIBTHREAD and LTLIBTHREAD. CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac # Some systems optimize for single-threaded programs by default, and # need special flags to disable these optimizations. For example, the # definition of 'errno' in <errno.h>. case "$host_os" in aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac gl_anythreadlib_early_done=done fi # Code from module pthread-h-tests: # Code from module pthread-thread: # Code from module pthread-thread-tests: # Code from module pthread_sigmask: # Code from module pthread_sigmask-tests: # Code from module putenv: # Code from module quote: # Code from module quotearg: # Code from module quotearg-simple: # Code from module quotearg-simple-tests: # Code from module raise: # Code from module raise-tests: # Code from module rawmemchr: # Code from module rawmemchr-tests: # Code from module read: # Code from module read-tests: # Code from module readdir: # Code from module readme-release: # Code from module realloc-gnu: # Code from module realloc-gnu-tests: # Code from module realloc-posix: # Code from module reallocarray: # Code from module reallocarray-tests: # Code from module regex: # Code from module regex-tests: # Code from module safe-read: # Code from module same-inode: # Code from module save-cwd: # Code from module sched: # Code from module sched-tests: # Code from module select: # Code from module select-tests: # Code from module setenv: # Code from module setenv-tests: # Code from module setlocale: # Code from module setlocale-null: # Code from module setlocale-null-tests: # Code from module setlocale-tests: # Code from module setsockopt: # Code from module setsockopt-tests: # Code from module sigaction: # Code from module sigaction-tests: # Code from module signal-h: # Code from module signal-h-tests: # Code from module sigprocmask: # Code from module sigprocmask-tests: # Code from module sigsegv: # Code from module sigsegv-tests: # Code from module size_max: # Code from module sleep: # Code from module sleep-tests: # Code from module snippet/_Noreturn: # Code from module snippet/arg-nonnull: # Code from module snippet/c++defs: # Code from module snippet/warn-on-use: # Code from module snprintf: # Code from module snprintf-tests: # Code from module socket: # Code from module socketlib: # Code from module sockets: # Code from module sockets-tests: # Code from module socklen: # Code from module ssize_t: # Code from module stat: # Code from module stat-tests: # Code from module stat-time: # Code from module stat-time-tests: # Code from module std-gnu11: # Code from module stdalign: # Code from module stdalign-tests: # Code from module stdarg: # Code from module stdarg-tests: # Code from module stdbool: # Code from module stdbool-tests: # Code from module stddef: # Code from module stddef-tests: # Code from module stdint: # Code from module stdint-tests: # Code from module stdio: # Code from module stdio-tests: # Code from module stdlib: # Code from module stdlib-tests: # Code from module stpcpy: # Code from module strdup-posix: # Code from module streq: # Code from module strerror: # Code from module strerror-override: # Code from module strerror-tests: # Code from module strerror_r-posix: # Code from module strerror_r-posix-tests: # Code from module striconv: # Code from module striconv-tests: # Code from module string: # Code from module string-tests: # Code from module strnlen: # Code from module strnlen-tests: # Code from module strnlen1: # Code from module strstr: # Code from module strstr-simple: # Code from module strstr-tests: # Code from module strtoimax: # Code from module strtoimax-tests: # Code from module strtoll: # Code from module strtoll-tests: # Code from module strtoull: # Code from module strtoull-tests: # Code from module strtoumax: # Code from module strtoumax-tests: # Code from module symlink: # Code from module symlink-tests: # Code from module sys_ioctl: # Code from module sys_ioctl-tests: # Code from module sys_select: # Code from module sys_select-tests: # Code from module sys_socket: # Code from module sys_socket-tests: # Code from module sys_stat: # Code from module sys_stat-tests: # Code from module sys_time: # Code from module sys_time-tests: # Code from module sys_types: # Code from module sys_types-tests: # Code from module sys_uio: # Code from module sys_uio-tests: # Code from module test-framework-sh: # Code from module test-framework-sh-tests: # Code from module thread: # Code from module thread-optim: # Code from module thread-tests: # Code from module threadlib: # Code from module time: # Code from module time-tests: # Code from module trim: # Code from module unistd: # Code from module unistd-safer: # Code from module unistd-safer-tests: # Code from module unistd-tests: # Code from module unistr/base: # Code from module unistr/u8-mbtoucr: # Code from module unistr/u8-mbtoucr-tests: # Code from module unistr/u8-uctomb: # Code from module unistr/u8-uctomb-tests: # Code from module unitypes: # Code from module uniwidth/base: # Code from module uniwidth/width: # Code from module uniwidth/width-tests: # Code from module unlocked-io: # Code from module unlocked-io-internal: # Code from module unsetenv: # Code from module unsetenv-tests: # Code from module update-copyright: # Code from module useless-if-before-free: # Code from module vasnprintf: # Code from module vasnprintf-tests: # Code from module vc-list-files: # Code from module vc-list-files-tests: # Code from module verify: # Code from module verify-tests: # Code from module version-etc: # Code from module version-etc-fsf: # Code from module version-etc-tests: # Code from module warnings: # Code from module wchar: # Code from module wchar-tests: # Code from module wcrtomb: # Code from module wcrtomb-tests: # Code from module wctob: # Code from module wctomb: # Code from module wctype-h: # Code from module wctype-h-tests: # Code from module wcwidth: # Code from module wcwidth-tests: # Code from module windows-mutex: # Code from module windows-once: # Code from module windows-recmutex: # Code from module windows-rwlock: # Code from module windows-stat-inodes: # Code from module windows-stat-override: # Code from module windows-thread: # Code from module windows-tls: # Code from module wmemchr: # Code from module wmempcpy: # Code from module xalloc: # Code from module xalloc-die: # Code from module xalloc-die-tests: # Code from module xalloc-oversized: # Code from module xbinary-io: # Code from module xsize: # Code from module xstriconv: # Code from module xstrtoimax: # Code from module xstrtoimax-tests: # Code from module xstrtol: # Code from module xstrtol-error: # Code from module xstrtol-tests: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_PKG_CONFIG+y} then : printf %s "(cached) " >&6 else $as_nop case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 printf "%s\n" "$PKG_CONFIG" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} then : printf %s "(cached) " >&6 else $as_nop case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } PKG_CONFIG="" fi fi # grep never invokes mbrtowc or mbrlen on empty input, # so don't worry about this common bug, # as working around it would merely slow grep down. gl_cv_func_mbrtowc_empty_input='assume yes' ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : else $as_nop printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 printf %s "checking for an ANSI C-conforming const... " >&6; } if test ${ac_cv_c_const+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* IBM XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_const=yes else $as_nop ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 printf "%s\n" "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then printf "%s\n" "#define const /**/" >>confdefs.h fi # Check whether --enable-cross-guesses was given. if test ${enable_cross_guesses+y} then : enableval=$enable_cross_guesses; if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-cross-guesses" >&5 printf "%s\n" "$as_me: WARNING: invalid argument supplied to --enable-cross-guesses" >&2;} enableval=conservative fi gl_cross_guesses="$enableval" else $as_nop gl_cross_guesses=conservative fi if test $gl_cross_guesses = risky; then gl_cross_guess_normal="guessing yes" gl_cross_guess_inverted="guessing no" else gl_cross_guess_normal="guessing no" gl_cross_guess_inverted="guessing yes" fi LIBC_FATAL_STDERR_=1 export LIBC_FATAL_STDERR_ # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 printf %s "checking for working alloca.h... " >&6; } if test ${ac_cv_working_alloca_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <alloca.h> int main (void) { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_working_alloca_h=yes else $as_nop ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 printf "%s\n" "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 printf %s "checking for alloca... " >&6; } if test ${ac_cv_func_alloca_works+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_working_alloca_h = yes; then ac_cv_func_alloca_works=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <stddef.h> #ifndef alloca # ifdef __GNUC__ # define alloca __builtin_alloca # elif defined _MSC_VER # include <malloc.h> # define alloca _alloca # else # ifdef __cplusplus extern "C" # endif void *alloca (size_t); # endif #endif int main (void) { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_func_alloca_works=yes else $as_nop ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 printf "%s\n" "$ac_cv_func_alloca_works" >&6; } fi if test $ac_cv_func_alloca_works = yes; then printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 printf %s "checking stack direction for C alloca... " >&6; } if test ${ac_cv_c_stack_direction+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_c_stack_direction=0 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char **argv) { return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_stack_direction=1 else $as_nop ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 printf "%s\n" "$ac_cv_c_stack_direction" >&6; } printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h fi HAVE_BTOWC=1; HAVE_MBSINIT=1; HAVE_MBRTOWC=1; HAVE_MBRLEN=1; HAVE_MBSRTOWCS=1; HAVE_MBSNRTOWCS=1; HAVE_WCRTOMB=1; HAVE_WCSRTOMBS=1; HAVE_WCSNRTOMBS=1; HAVE_WMEMCHR=1; HAVE_WMEMCMP=1; HAVE_WMEMCPY=1; HAVE_WMEMMOVE=1; HAVE_WMEMPCPY=1; HAVE_WMEMSET=1; HAVE_WCSLEN=1; HAVE_WCSNLEN=1; HAVE_WCSCPY=1; HAVE_WCPCPY=1; HAVE_WCSNCPY=1; HAVE_WCPNCPY=1; HAVE_WCSCAT=1; HAVE_WCSNCAT=1; HAVE_WCSCMP=1; HAVE_WCSNCMP=1; HAVE_WCSCASECMP=1; HAVE_WCSNCASECMP=1; HAVE_WCSCOLL=1; HAVE_WCSXFRM=1; HAVE_WCSDUP=1; HAVE_WCSCHR=1; HAVE_WCSRCHR=1; HAVE_WCSCSPN=1; HAVE_WCSSPN=1; HAVE_WCSPBRK=1; HAVE_WCSSTR=1; HAVE_WCSTOK=1; HAVE_WCSWIDTH=1; HAVE_WCSFTIME=1; HAVE_DECL_WCTOB=1; HAVE_DECL_WCSDUP=1; HAVE_DECL_WCWIDTH=1; REPLACE_MBSTATE_T=0; REPLACE_BTOWC=0; REPLACE_WCTOB=0; REPLACE_MBSINIT=0; REPLACE_MBRTOWC=0; REPLACE_MBRLEN=0; REPLACE_MBSRTOWCS=0; REPLACE_MBSNRTOWCS=0; REPLACE_WCRTOMB=0; REPLACE_WCSRTOMBS=0; REPLACE_WCSNRTOMBS=0; REPLACE_WCWIDTH=0; REPLACE_WCSWIDTH=0; REPLACE_WCSFTIME=0; REPLACE_WCSTOK=0; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether <wchar.h> uses 'inline' correctly" >&5 printf %s "checking whether <wchar.h> uses 'inline' correctly... " >&6; } if test ${gl_cv_header_wchar_h_correct_inline+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_header_wchar_h_correct_inline=yes case "$host_os" in *-gnu* | gnu*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define wcstod renamed_wcstod #include <wchar.h> extern int zero (void); int main () { return zero(); } _ACEOF save_ac_compile="$ac_compile" ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` if echo '#include "conftest.c"' >conftest1.c \ && { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define wcstod renamed_wcstod #include <wchar.h> int zero (void) { return 0; } _ACEOF ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` if echo '#include "conftest.c"' >conftest2.c \ && { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&5 2>&1; then : else gl_cv_header_wchar_h_correct_inline=no fi fi fi ac_compile="$save_ac_compile" rm -f conftest12.c conftest12.$ac_objext conftest$ac_exeext ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_wchar_h_correct_inline" >&5 printf "%s\n" "$gl_cv_header_wchar_h_correct_inline" >&6; } if test $gl_cv_header_wchar_h_correct_inline = no; then as_fn_error $? "<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in C99 mode. You have four options: - Add the flag -fgnu89-inline to CC and reconfigure, or - Fix your include files, using parts of <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or - Use a gcc version older than 4.3, or - Don't use the flags -std=c99 or -std=gnu99. Configuration aborted." "$LINENO" 5 fi ac_func= for ac_item in $ac_func_c_list do if test $ac_func; then ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then echo "#define $ac_item 1" >> confdefs.h fi ac_func= else ac_func=$ac_item fi done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5 printf %s "checking for nl_langinfo and CODESET... " >&6; } if test ${am_cv_langinfo_codeset+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <langinfo.h> int main (void) { char* cs = nl_langinfo(CODESET); return !cs; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : am_cv_langinfo_codeset=yes else $as_nop am_cv_langinfo_codeset=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_langinfo_codeset" >&5 printf "%s\n" "$am_cv_langinfo_codeset" >&6; } if test $am_cv_langinfo_codeset = yes; then printf "%s\n" "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 printf %s "checking for a traditional french locale... " >&6; } if test ${gt_cv_locale_fr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 else # None found. gt_cv_locale_fr=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO-8859-1 else # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO8859-1 else # Test for the HP-UX locale name. if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else # Test for the Solaris 7 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else # None found. gt_cv_locale_fr=none fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr" >&5 printf "%s\n" "$gt_cv_locale_fr" >&6; } LOCALE_FR=$gt_cv_locale_fr GL_GNULIB_BTOWC=0 GL_GNULIB_WCTOB=0 GL_GNULIB_MBSINIT=0 GL_GNULIB_MBRTOWC=0 GL_GNULIB_MBRLEN=0 GL_GNULIB_MBSRTOWCS=0 GL_GNULIB_MBSNRTOWCS=0 GL_GNULIB_WCRTOMB=0 GL_GNULIB_WCSRTOMBS=0 GL_GNULIB_WCSNRTOMBS=0 GL_GNULIB_WCWIDTH=0 GL_GNULIB_WMEMCHR=0 GL_GNULIB_WMEMCMP=0 GL_GNULIB_WMEMCPY=0 GL_GNULIB_WMEMMOVE=0 GL_GNULIB_WMEMPCPY=0 GL_GNULIB_WMEMSET=0 GL_GNULIB_WCSLEN=0 GL_GNULIB_WCSNLEN=0 GL_GNULIB_WCSCPY=0 GL_GNULIB_WCPCPY=0 GL_GNULIB_WCSNCPY=0 GL_GNULIB_WCPNCPY=0 GL_GNULIB_WCSCAT=0 GL_GNULIB_WCSNCAT=0 GL_GNULIB_WCSCMP=0 GL_GNULIB_WCSNCMP=0 GL_GNULIB_WCSCASECMP=0 GL_GNULIB_WCSNCASECMP=0 GL_GNULIB_WCSCOLL=0 GL_GNULIB_WCSXFRM=0 GL_GNULIB_WCSDUP=0 GL_GNULIB_WCSCHR=0 GL_GNULIB_WCSRCHR=0 GL_GNULIB_WCSCSPN=0 GL_GNULIB_WCSSPN=0 GL_GNULIB_WCSPBRK=0 GL_GNULIB_WCSSTR=0 GL_GNULIB_WCSTOK=0 GL_GNULIB_WCSWIDTH=0 GL_GNULIB_WCSFTIME=0 GL_GNULIB_MDA_WCSDUP=1 HAVE__EXIT=1; HAVE_ALIGNED_ALLOC=1; HAVE_ATOLL=1; HAVE_CANONICALIZE_FILE_NAME=1; HAVE_DECL_ECVT=1; HAVE_DECL_FCVT=1; HAVE_DECL_GCVT=1; HAVE_DECL_GETLOADAVG=1; HAVE_GETSUBOPT=1; HAVE_GRANTPT=1; HAVE_INITSTATE=1; HAVE_DECL_INITSTATE=1; HAVE_MBTOWC=1; HAVE_MKDTEMP=1; HAVE_MKOSTEMP=1; HAVE_MKOSTEMPS=1; HAVE_MKSTEMP=1; HAVE_MKSTEMPS=1; HAVE_POSIX_MEMALIGN=1; HAVE_POSIX_OPENPT=1; HAVE_PTSNAME=1; HAVE_PTSNAME_R=1; HAVE_QSORT_R=1; HAVE_RANDOM=1; HAVE_RANDOM_H=1; HAVE_RANDOM_R=1; HAVE_REALLOCARRAY=1; HAVE_REALPATH=1; HAVE_RPMATCH=1; HAVE_SECURE_GETENV=1; HAVE_SETENV=1; HAVE_DECL_SETENV=1; HAVE_SETSTATE=1; HAVE_DECL_SETSTATE=1; HAVE_STRTOD=1; HAVE_STRTOL=1; HAVE_STRTOLD=1; HAVE_STRTOLL=1; HAVE_STRTOUL=1; HAVE_STRTOULL=1; HAVE_STRUCT_RANDOM_DATA=1; HAVE_SYS_LOADAVG_H=0; HAVE_UNLOCKPT=1; HAVE_DECL_UNSETENV=1; REPLACE_ALIGNED_ALLOC=0; REPLACE_CALLOC=0; REPLACE_CANONICALIZE_FILE_NAME=0; REPLACE_FREE=0; REPLACE_INITSTATE=0; REPLACE_MALLOC=0; REPLACE_MBTOWC=0; REPLACE_MKSTEMP=0; REPLACE_POSIX_MEMALIGN=0; REPLACE_PTSNAME=0; REPLACE_PTSNAME_R=0; REPLACE_PUTENV=0; REPLACE_QSORT_R=0; REPLACE_RANDOM=0; REPLACE_RANDOM_R=0; REPLACE_REALLOC=0; REPLACE_REALLOCARRAY=0; REPLACE_REALPATH=0; REPLACE_SETENV=0; REPLACE_SETSTATE=0; REPLACE_STRTOD=0; REPLACE_STRTOL=0; REPLACE_STRTOLD=0; REPLACE_STRTOLL=0; REPLACE_STRTOUL=0; REPLACE_STRTOULL=0; REPLACE_UNSETENV=0; REPLACE_WCTOMB=0; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether malloc is ptrdiff_t safe" >&5 printf %s "checking whether malloc is ptrdiff_t safe... " >&6; } if test ${gl_cv_malloc_ptrdiff+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdint.h> int main (void) { /* 64-bit ptrdiff_t is so wide that no practical platform can exceed it. */ #define WIDE_PTRDIFF (PTRDIFF_MAX >> 31 >> 31 != 0) /* On rare machines where size_t fits in ptrdiff_t there is no problem. */ #define NARROW_SIZE (SIZE_MAX <= PTRDIFF_MAX) /* glibc 2.30 and later malloc refuses to exceed ptrdiff_t bounds even on 32-bit platforms. We don't know which non-glibc systems are safe. */ #define KNOWN_SAFE (2 < __GLIBC__ + (30 <= __GLIBC_MINOR__)) #if WIDE_PTRDIFF || NARROW_SIZE || KNOWN_SAFE return 0; #else #error "malloc might not be ptrdiff_t safe" syntax error #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_malloc_ptrdiff=yes else $as_nop gl_cv_malloc_ptrdiff=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_malloc_ptrdiff" >&5 printf "%s\n" "$gl_cv_malloc_ptrdiff" >&6; } test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether malloc, realloc, calloc set errno on failure" >&5 printf %s "checking whether malloc, realloc, calloc set errno on failure... " >&6; } if test ${gl_cv_func_malloc_posix+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in mingw*) gl_cv_func_malloc_posix=no ;; irix* | solaris*) gl_cv_func_malloc_posix=no ;; *) gl_cv_func_malloc_posix=yes ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_malloc_posix" >&5 printf "%s\n" "$gl_cv_func_malloc_posix" >&6; } if test "$gl_cv_func_malloc_posix" = yes; then printf "%s\n" "#define HAVE_MALLOC_POSIX 1" >>confdefs.h else REPLACE_MALLOC=1 fi if test $REPLACE_MALLOC = 1; then REPLACE_CALLOC=1 fi GL_GNULIB__EXIT=0 GL_GNULIB_ALIGNED_ALLOC=0 GL_GNULIB_ATOLL=0 GL_GNULIB_CALLOC_POSIX=0 GL_GNULIB_CANONICALIZE_FILE_NAME=0 GL_GNULIB_FREE_POSIX=0 GL_GNULIB_GETLOADAVG=0 GL_GNULIB_GETSUBOPT=0 GL_GNULIB_GRANTPT=0 GL_GNULIB_MALLOC_POSIX=0 GL_GNULIB_MBTOWC=0 GL_GNULIB_MKDTEMP=0 GL_GNULIB_MKOSTEMP=0 GL_GNULIB_MKOSTEMPS=0 GL_GNULIB_MKSTEMP=0 GL_GNULIB_MKSTEMPS=0 GL_GNULIB_POSIX_MEMALIGN=0 GL_GNULIB_POSIX_OPENPT=0 GL_GNULIB_PTSNAME=0 GL_GNULIB_PTSNAME_R=0 GL_GNULIB_PUTENV=0 GL_GNULIB_QSORT_R=0 GL_GNULIB_RANDOM=0 GL_GNULIB_RANDOM_R=0 GL_GNULIB_REALLOCARRAY=0 GL_GNULIB_REALLOC_POSIX=0 GL_GNULIB_REALPATH=0 GL_GNULIB_RPMATCH=0 GL_GNULIB_SECURE_GETENV=0 GL_GNULIB_SETENV=0 GL_GNULIB_STRTOD=0 GL_GNULIB_STRTOL=0 GL_GNULIB_STRTOLD=0 GL_GNULIB_STRTOLL=0 GL_GNULIB_STRTOUL=0 GL_GNULIB_STRTOULL=0 GL_GNULIB_SYSTEM_POSIX=0 GL_GNULIB_UNLOCKPT=0 GL_GNULIB_UNSETENV=0 GL_GNULIB_WCTOMB=0 GL_GNULIB_MDA_ECVT=1 GL_GNULIB_MDA_FCVT=1 GL_GNULIB_MDA_GCVT=1 GL_GNULIB_MDA_MKTEMP=1 GL_GNULIB_MDA_PUTENV=1 GL_GNULIB_ACCESS=0 GL_GNULIB_CHDIR=0 GL_GNULIB_CHOWN=0 GL_GNULIB_CLOSE=0 GL_GNULIB_COPY_FILE_RANGE=0 GL_GNULIB_DUP=0 GL_GNULIB_DUP2=0 GL_GNULIB_DUP3=0 GL_GNULIB_ENVIRON=0 GL_GNULIB_EUIDACCESS=0 GL_GNULIB_EXECL=0 GL_GNULIB_EXECLE=0 GL_GNULIB_EXECLP=0 GL_GNULIB_EXECV=0 GL_GNULIB_EXECVE=0 GL_GNULIB_EXECVP=0 GL_GNULIB_EXECVPE=0 GL_GNULIB_FACCESSAT=0 GL_GNULIB_FCHDIR=0 GL_GNULIB_FCHOWNAT=0 GL_GNULIB_FDATASYNC=0 GL_GNULIB_FSYNC=0 GL_GNULIB_FTRUNCATE=0 GL_GNULIB_GETCWD=0 GL_GNULIB_GETDOMAINNAME=0 GL_GNULIB_GETDTABLESIZE=0 GL_GNULIB_GETENTROPY=0 GL_GNULIB_GETGROUPS=0 GL_GNULIB_GETHOSTNAME=0 GL_GNULIB_GETLOGIN=0 GL_GNULIB_GETLOGIN_R=0 GL_GNULIB_GETOPT_POSIX=0 GL_GNULIB_GETPAGESIZE=0 GL_GNULIB_GETPASS=0 GL_GNULIB_GETUSERSHELL=0 GL_GNULIB_GROUP_MEMBER=0 GL_GNULIB_ISATTY=0 GL_GNULIB_LCHOWN=0 GL_GNULIB_LINK=0 GL_GNULIB_LINKAT=0 GL_GNULIB_LSEEK=0 GL_GNULIB_PIPE=0 GL_GNULIB_PIPE2=0 GL_GNULIB_PREAD=0 GL_GNULIB_PWRITE=0 GL_GNULIB_READ=0 GL_GNULIB_READLINK=0 GL_GNULIB_READLINKAT=0 GL_GNULIB_RMDIR=0 GL_GNULIB_SETHOSTNAME=0 GL_GNULIB_SLEEP=0 GL_GNULIB_SYMLINK=0 GL_GNULIB_SYMLINKAT=0 GL_GNULIB_TRUNCATE=0 GL_GNULIB_TTYNAME_R=0 GL_GNULIB_UNISTD_H_GETOPT=0 GL_GNULIB_UNISTD_H_NONBLOCKING=0 GL_GNULIB_UNISTD_H_SIGPIPE=0 GL_GNULIB_UNLINK=0 GL_GNULIB_UNLINKAT=0 GL_GNULIB_USLEEP=0 GL_GNULIB_WRITE=0 GL_GNULIB_MDA_ACCESS=1 GL_GNULIB_MDA_CHDIR=1 GL_GNULIB_MDA_CLOSE=1 GL_GNULIB_MDA_DUP=1 GL_GNULIB_MDA_DUP2=1 GL_GNULIB_MDA_EXECL=1 GL_GNULIB_MDA_EXECLE=1 GL_GNULIB_MDA_EXECLP=1 GL_GNULIB_MDA_EXECV=1 GL_GNULIB_MDA_EXECVE=1 GL_GNULIB_MDA_EXECVP=1 GL_GNULIB_MDA_EXECVPE=1 GL_GNULIB_MDA_GETCWD=1 GL_GNULIB_MDA_GETPID=1 GL_GNULIB_MDA_ISATTY=1 GL_GNULIB_MDA_LSEEK=1 GL_GNULIB_MDA_READ=1 GL_GNULIB_MDA_RMDIR=1 GL_GNULIB_MDA_SWAB=1 GL_GNULIB_MDA_UNLINK=1 GL_GNULIB_MDA_WRITE=1 HAVE_CHOWN=1; HAVE_COPY_FILE_RANGE=1; HAVE_DUP3=1; HAVE_EUIDACCESS=1; HAVE_EXECVPE=1; HAVE_FACCESSAT=1; HAVE_FCHDIR=1; HAVE_FCHOWNAT=1; HAVE_FDATASYNC=1; HAVE_FSYNC=1; HAVE_FTRUNCATE=1; HAVE_GETDTABLESIZE=1; HAVE_GETENTROPY=1; HAVE_GETGROUPS=1; HAVE_GETHOSTNAME=1; HAVE_GETLOGIN=1; HAVE_GETPAGESIZE=1; HAVE_GETPASS=1; HAVE_GROUP_MEMBER=1; HAVE_LCHOWN=1; HAVE_LINK=1; HAVE_LINKAT=1; HAVE_PIPE=1; HAVE_PIPE2=1; HAVE_PREAD=1; HAVE_PWRITE=1; HAVE_READLINK=1; HAVE_READLINKAT=1; HAVE_SETHOSTNAME=1; HAVE_SLEEP=1; HAVE_SYMLINK=1; HAVE_SYMLINKAT=1; HAVE_UNLINKAT=1; HAVE_USLEEP=1; HAVE_DECL_ENVIRON=1; HAVE_DECL_EXECVPE=1; HAVE_DECL_FCHDIR=1; HAVE_DECL_FDATASYNC=1; HAVE_DECL_GETDOMAINNAME=1; HAVE_DECL_GETLOGIN=1; HAVE_DECL_GETLOGIN_R=1; HAVE_DECL_GETPAGESIZE=1; HAVE_DECL_GETUSERSHELL=1; HAVE_DECL_SETHOSTNAME=1; HAVE_DECL_TRUNCATE=1; HAVE_DECL_TTYNAME_R=1; HAVE_OS_H=0; HAVE_SYS_PARAM_H=0; REPLACE_ACCESS=0; REPLACE_CHOWN=0; REPLACE_CLOSE=0; REPLACE_DUP=0; REPLACE_DUP2=0; REPLACE_EXECL=0; REPLACE_EXECLE=0; REPLACE_EXECLP=0; REPLACE_EXECV=0; REPLACE_EXECVE=0; REPLACE_EXECVP=0; REPLACE_EXECVPE=0; REPLACE_FACCESSAT=0; REPLACE_FCHOWNAT=0; REPLACE_FTRUNCATE=0; REPLACE_GETCWD=0; REPLACE_GETDOMAINNAME=0; REPLACE_GETDTABLESIZE=0; REPLACE_GETLOGIN_R=0; REPLACE_GETGROUPS=0; REPLACE_GETPAGESIZE=0; REPLACE_GETPASS=0; REPLACE_ISATTY=0; REPLACE_LCHOWN=0; REPLACE_LINK=0; REPLACE_LINKAT=0; REPLACE_LSEEK=0; REPLACE_PREAD=0; REPLACE_PWRITE=0; REPLACE_READ=0; REPLACE_READLINK=0; REPLACE_READLINKAT=0; REPLACE_RMDIR=0; REPLACE_SLEEP=0; REPLACE_SYMLINK=0; REPLACE_SYMLINKAT=0; REPLACE_TRUNCATE=0; REPLACE_TTYNAME_R=0; REPLACE_UNLINK=0; REPLACE_UNLINKAT=0; REPLACE_USLEEP=0; REPLACE_WRITE=0; UNISTD_H_HAVE_SYS_RANDOM_H=0; UNISTD_H_HAVE_WINSOCK2_H=0; UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; if test $ac_cv_func__set_invalid_parameter_handler = yes; then HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 printf "%s\n" "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h else HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 fi SYS_IOCTL_H_HAVE_WINSOCK2_H=0; SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; REPLACE_IOCTL=0; HAVE_OPENDIR=1; HAVE_READDIR=1; HAVE_REWINDDIR=1; HAVE_CLOSEDIR=1; HAVE_DECL_DIRFD=1; HAVE_DECL_FDOPENDIR=1; HAVE_FDOPENDIR=1; HAVE_SCANDIR=1; HAVE_ALPHASORT=1; REPLACE_OPENDIR=0; REPLACE_CLOSEDIR=0; REPLACE_DIRFD=0; REPLACE_FDOPENDIR=0; GL_GNULIB_OPENDIR=0 GL_GNULIB_READDIR=0 GL_GNULIB_REWINDDIR=0 GL_GNULIB_CLOSEDIR=0 GL_GNULIB_DIRFD=0 GL_GNULIB_FDOPENDIR=0 GL_GNULIB_SCANDIR=0 GL_GNULIB_ALPHASORT=0 HAVE_ISBLANK=1; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5 printf %s "checking whether the preprocessor supports include_next... " >&6; } if test ${gl_cv_have_include_next+y} then : printf %s "(cached) " >&6 else $as_nop rm -rf conftestd1a conftestd1b conftestd2 mkdir conftestd1a conftestd1b conftestd2 cat <<EOF > conftestd1a/conftest.h #define DEFINED_IN_CONFTESTD1 #include_next <conftest.h> #ifdef DEFINED_IN_CONFTESTD2 int foo; #else #error "include_next doesn't work" #endif EOF cat <<EOF > conftestd1b/conftest.h #define DEFINED_IN_CONFTESTD1 #include <stdio.h> #include_next <conftest.h> #ifdef DEFINED_IN_CONFTESTD2 int foo; #else #error "include_next doesn't work" #endif EOF cat <<EOF > conftestd2/conftest.h #ifndef DEFINED_IN_CONFTESTD1 #error "include_next test doesn't work" #endif #define DEFINED_IN_CONFTESTD2 EOF gl_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <conftest.h> _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_have_include_next=yes else $as_nop CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <conftest.h> _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_have_include_next=buggy else $as_nop gl_cv_have_include_next=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CPPFLAGS="$gl_save_CPPFLAGS" rm -rf conftestd1a conftestd1b conftestd2 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_include_next" >&5 printf "%s\n" "$gl_cv_have_include_next" >&6; } PRAGMA_SYSTEM_HEADER= if test $gl_cv_have_include_next = yes; then INCLUDE_NEXT=include_next INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next if test -n "$GCC"; then PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' fi else if test $gl_cv_have_include_next = buggy; then INCLUDE_NEXT=include INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next else INCLUDE_NEXT=include INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether source code line length is unlimited" >&5 printf %s "checking whether source code line length is unlimited... " >&6; } if test ${gl_cv_source_line_length_unlimited+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __TANDEM choke me #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "choke me" >/dev/null 2>&1 then : gl_cv_source_line_length_unlimited=no else $as_nop gl_cv_source_line_length_unlimited=yes fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_source_line_length_unlimited" >&5 printf "%s\n" "$gl_cv_source_line_length_unlimited" >&6; } if test $gl_cv_source_line_length_unlimited = no; then PRAGMA_COLUMNS="#pragma COLUMNS 10000" else PRAGMA_COLUMNS= fi if test $gl_cv_have_include_next = yes; then gl_cv_next_ctype_h='<'ctype.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <ctype.h>" >&5 printf %s "checking absolute name of <ctype.h>... " >&6; } if test ${gl_cv_next_ctype_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ctype.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'ctype.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_ctype_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_ctype_h gl_cv_next_ctype_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_ctype_h" >&5 printf "%s\n" "$gl_cv_next_ctype_h" >&6; } fi NEXT_CTYPE_H=$gl_cv_next_ctype_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'ctype.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_ctype_h fi NEXT_AS_FIRST_DIRECTIVE_CTYPE_H=$gl_next_as_first_directive GL_GNULIB_ISBLANK=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 printf %s "checking for inline... " >&6; } if test ${ac_cv_c_inline+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo (void) {return 0; } $ac_kw foo_t foo (void) {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 printf "%s\n" "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac if test $gl_cv_have_include_next = yes; then gl_cv_next_dirent_h='<'dirent.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <dirent.h>" >&5 printf %s "checking absolute name of <dirent.h>... " >&6; } if test ${gl_cv_next_dirent_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_dirent_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <dirent.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'dirent.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_dirent_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_dirent_h gl_cv_next_dirent_h='"'$gl_header'"' else gl_cv_next_dirent_h='<'dirent.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_dirent_h" >&5 printf "%s\n" "$gl_cv_next_dirent_h" >&6; } fi NEXT_DIRENT_H=$gl_cv_next_dirent_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'dirent.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_dirent_h fi NEXT_AS_FIRST_DIRECTIVE_DIRENT_H=$gl_next_as_first_directive if test $ac_cv_header_dirent_h = yes; then HAVE_DIRENT_H=1 else HAVE_DIRENT_H=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } if test ${ac_cv_c_undeclared_builtin_options+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_CFLAGS=$CFLAGS ac_cv_c_undeclared_builtin_options='cannot detect' for ac_arg in '' -fno-builtin; do CFLAGS="$ac_save_CFLAGS $ac_arg" # This test program should *not* compile successfully. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { (void) strchr; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop # This test program should compile successfully. # No library function is consistently available on # freestanding implementations, so test against a dummy # declaration. Include always-available headers on the # off chance that they somehow elicit warnings. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <float.h> #include <limits.h> #include <stdarg.h> #include <stddef.h> extern void ac_decl (int, char *); int main (void) { (void) ac_decl (0, (char *) 0); (void) ac_decl; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if test x"$ac_arg" = x then : ac_cv_c_undeclared_builtin_options='none needed' else $as_nop ac_cv_c_undeclared_builtin_options=$ac_arg fi break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done CFLAGS=$ac_save_CFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } case $ac_cv_c_undeclared_builtin_options in #( 'cannot detect') : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot make $CC report undeclared builtins See \`config.log' for more details" "$LINENO" 5; } ;; #( 'none needed') : ac_c_undeclared_builtin_options='' ;; #( *) : ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; esac gl_mda_defines=' #if defined _WIN32 && !defined __CYGWIN__ #define access _access #define chdir _chdir #define chmod _chmod #define close _close #define creat _creat #define dup _dup #define dup2 _dup2 #define ecvt _ecvt #define execl _execl #define execle _execle #define execlp _execlp #define execv _execv #define execve _execve #define execvp _execvp #define execvpe _execvpe #define fcloseall _fcloseall #define fcvt _fcvt #define fdopen _fdopen #define fileno _fileno #define gcvt _gcvt #define getcwd _getcwd #define getpid _getpid #define getw _getw #define isatty _isatty #define j0 _j0 #define j1 _j1 #define jn _jn #define lfind _lfind #define lsearch _lsearch #define lseek _lseek #define memccpy _memccpy #define mkdir _mkdir #define mktemp _mktemp #define open _open #define putenv _putenv #define putw _putw #define read _read #define rmdir _rmdir #define strdup _strdup #define swab _swab #define tempnam _tempnam #define tzset _tzset #define umask _umask #define unlink _unlink #define utime _utime #define wcsdup _wcsdup #define write _write #define y0 _y0 #define y1 _y1 #define yn _yn #endif ' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for complete errno.h" >&5 printf %s "checking for complete errno.h... " >&6; } if test ${gl_cv_header_errno_h_complete+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #if !defined ETXTBSY booboo #endif #if !defined ENOMSG booboo #endif #if !defined EIDRM booboo #endif #if !defined ENOLINK booboo #endif #if !defined EPROTO booboo #endif #if !defined EMULTIHOP booboo #endif #if !defined EBADMSG booboo #endif #if !defined EOVERFLOW booboo #endif #if !defined ENOTSUP booboo #endif #if !defined ENETRESET booboo #endif #if !defined ECONNABORTED booboo #endif #if !defined ESTALE booboo #endif #if !defined EDQUOT booboo #endif #if !defined ECANCELED booboo #endif #if !defined EOWNERDEAD booboo #endif #if !defined ENOTRECOVERABLE booboo #endif #if !defined EILSEQ booboo #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "booboo" >/dev/null 2>&1 then : gl_cv_header_errno_h_complete=no else $as_nop gl_cv_header_errno_h_complete=yes fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_complete" >&5 printf "%s\n" "$gl_cv_header_errno_h_complete" >&6; } if test $gl_cv_header_errno_h_complete = yes; then ERRNO_H='' else if test $gl_cv_have_include_next = yes; then gl_cv_next_errno_h='<'errno.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <errno.h>" >&5 printf %s "checking absolute name of <errno.h>... " >&6; } if test ${gl_cv_next_errno_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'errno.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_errno_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_errno_h gl_cv_next_errno_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_errno_h" >&5 printf "%s\n" "$gl_cv_next_errno_h" >&6; } fi NEXT_ERRNO_H=$gl_cv_next_errno_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'errno.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_errno_h fi NEXT_AS_FIRST_DIRECTIVE_ERRNO_H=$gl_next_as_first_directive ERRNO_H='errno.h' fi if test -n "$ERRNO_H"; then GL_GENERATE_ERRNO_H_TRUE= GL_GENERATE_ERRNO_H_FALSE='#' else GL_GENERATE_ERRNO_H_TRUE='#' GL_GENERATE_ERRNO_H_FALSE= fi if test -n "$ERRNO_H"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EMULTIHOP value" >&5 printf %s "checking for EMULTIHOP value... " >&6; } if test ${gl_cv_header_errno_h_EMULTIHOP+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #ifdef EMULTIHOP yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1 then : gl_cv_header_errno_h_EMULTIHOP=yes else $as_nop gl_cv_header_errno_h_EMULTIHOP=no fi rm -rf conftest* if test $gl_cv_header_errno_h_EMULTIHOP = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include <errno.h> #ifdef EMULTIHOP yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1 then : gl_cv_header_errno_h_EMULTIHOP=hidden fi rm -rf conftest* if test $gl_cv_header_errno_h_EMULTIHOP = hidden; then if ac_fn_c_compute_int "$LINENO" "EMULTIHOP" "gl_cv_header_errno_h_EMULTIHOP" " #define _XOPEN_SOURCE_EXTENDED 1 #include <errno.h> /* The following two lines are a workaround against an autoconf-2.52 bug. */ #include <stdio.h> #include <stdlib.h> " then : fi fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_EMULTIHOP" >&5 printf "%s\n" "$gl_cv_header_errno_h_EMULTIHOP" >&6; } case $gl_cv_header_errno_h_EMULTIHOP in yes | no) EMULTIHOP_HIDDEN=0; EMULTIHOP_VALUE= ;; *) EMULTIHOP_HIDDEN=1; EMULTIHOP_VALUE="$gl_cv_header_errno_h_EMULTIHOP" ;; esac fi if test -n "$ERRNO_H"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ENOLINK value" >&5 printf %s "checking for ENOLINK value... " >&6; } if test ${gl_cv_header_errno_h_ENOLINK+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #ifdef ENOLINK yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1 then : gl_cv_header_errno_h_ENOLINK=yes else $as_nop gl_cv_header_errno_h_ENOLINK=no fi rm -rf conftest* if test $gl_cv_header_errno_h_ENOLINK = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include <errno.h> #ifdef ENOLINK yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1 then : gl_cv_header_errno_h_ENOLINK=hidden fi rm -rf conftest* if test $gl_cv_header_errno_h_ENOLINK = hidden; then if ac_fn_c_compute_int "$LINENO" "ENOLINK" "gl_cv_header_errno_h_ENOLINK" " #define _XOPEN_SOURCE_EXTENDED 1 #include <errno.h> /* The following two lines are a workaround against an autoconf-2.52 bug. */ #include <stdio.h> #include <stdlib.h> " then : fi fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_ENOLINK" >&5 printf "%s\n" "$gl_cv_header_errno_h_ENOLINK" >&6; } case $gl_cv_header_errno_h_ENOLINK in yes | no) ENOLINK_HIDDEN=0; ENOLINK_VALUE= ;; *) ENOLINK_HIDDEN=1; ENOLINK_VALUE="$gl_cv_header_errno_h_ENOLINK" ;; esac fi if test -n "$ERRNO_H"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EOVERFLOW value" >&5 printf %s "checking for EOVERFLOW value... " >&6; } if test ${gl_cv_header_errno_h_EOVERFLOW+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #ifdef EOVERFLOW yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1 then : gl_cv_header_errno_h_EOVERFLOW=yes else $as_nop gl_cv_header_errno_h_EOVERFLOW=no fi rm -rf conftest* if test $gl_cv_header_errno_h_EOVERFLOW = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include <errno.h> #ifdef EOVERFLOW yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1 then : gl_cv_header_errno_h_EOVERFLOW=hidden fi rm -rf conftest* if test $gl_cv_header_errno_h_EOVERFLOW = hidden; then if ac_fn_c_compute_int "$LINENO" "EOVERFLOW" "gl_cv_header_errno_h_EOVERFLOW" " #define _XOPEN_SOURCE_EXTENDED 1 #include <errno.h> /* The following two lines are a workaround against an autoconf-2.52 bug. */ #include <stdio.h> #include <stdlib.h> " then : fi fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_EOVERFLOW" >&5 printf "%s\n" "$gl_cv_header_errno_h_EOVERFLOW" >&6; } case $gl_cv_header_errno_h_EOVERFLOW in yes | no) EOVERFLOW_HIDDEN=0; EOVERFLOW_VALUE= ;; *) EOVERFLOW_HIDDEN=1; EOVERFLOW_VALUE="$gl_cv_header_errno_h_EOVERFLOW" ;; esac fi ac_fn_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_strerror_r" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_STRERROR_R $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_strerror_r = yes; then # For backward compatibility's sake, define HAVE_STRERROR_R. # (We used to run AC_CHECK_FUNCS_ONCE for strerror_r, as well # as AC_CHECK_DECLS_ONCE.) printf "%s\n" "#define HAVE_STRERROR_R 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 printf %s "checking whether strerror_r returns char *... " >&6; } if test ${ac_cv_func_strerror_r_char_p+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_func_strerror_r_char_p=no if test $ac_cv_have_decl_strerror_r = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> int main (void) { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); char *p = strerror_r (0, buf, sizeof buf); return !p || x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_func_strerror_r_char_p=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 printf "%s\n" "$ac_cv_func_strerror_r_char_p" >&6; } if test $ac_cv_func_strerror_r_char_p = yes; then printf "%s\n" "#define STRERROR_R_CHAR_P 1" >>confdefs.h fi XGETTEXT_EXTRA_OPTIONS= ac_fn_check_decl "$LINENO" "fchdir" "ac_cv_have_decl_fchdir" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_fchdir" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FCHDIR $ac_have_decl" >>confdefs.h HAVE_FCNTL=1; HAVE_OPENAT=1; REPLACE_CREAT=0; REPLACE_FCNTL=0; REPLACE_OPEN=0; REPLACE_OPENAT=0; GL_GNULIB_CREAT=0 GL_GNULIB_FCNTL=0 GL_GNULIB_NONBLOCKING=0 GL_GNULIB_OPEN=0 GL_GNULIB_OPENAT=0 GL_GNULIB_MDA_CREAT=1 GL_GNULIB_MDA_OPEN=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working fcntl.h" >&5 printf %s "checking for working fcntl.h... " >&6; } if test ${gl_cv_header_working_fcntl_h+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess 'no' on native Windows. mingw*) gl_cv_header_working_fcntl_h='no' ;; *) gl_cv_header_working_fcntl_h=cross-compiling ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/stat.h> #if HAVE_UNISTD_H # include <unistd.h> #else /* on Windows with MSVC */ # include <io.h> # include <stdlib.h> # defined sleep(n) _sleep ((n) * 1000) #endif #include <fcntl.h> $gl_mda_defines #ifndef O_NOATIME #define O_NOATIME 0 #endif #ifndef O_NOFOLLOW #define O_NOFOLLOW 0 #endif static int const constants[] = { O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY }; int main (void) { int result = !constants; #if HAVE_SYMLINK { static char const sym[] = "conftest.sym"; if (symlink ("/dev/null", sym) != 0) result |= 2; else { int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); if (fd >= 0) { close (fd); result |= 4; } } if (unlink (sym) != 0 || symlink (".", sym) != 0) result |= 2; else { int fd = open (sym, O_RDONLY | O_NOFOLLOW); if (fd >= 0) { close (fd); result |= 4; } } unlink (sym); } #endif { static char const file[] = "confdefs.h"; int fd = open (file, O_RDONLY | O_NOATIME); if (fd < 0) result |= 8; else { struct stat st0; if (fstat (fd, &st0) != 0) result |= 16; else { char c; sleep (1); if (read (fd, &c, 1) != 1) result |= 24; else { if (close (fd) != 0) result |= 32; else { struct stat st1; if (stat (file, &st1) != 0) result |= 40; else if (st0.st_atime != st1.st_atime) result |= 64; } } } } } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_header_working_fcntl_h=yes else $as_nop case $? in #( 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( *) gl_cv_header_working_fcntl_h='no';; esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_fcntl_h" >&5 printf "%s\n" "$gl_cv_header_working_fcntl_h" >&6; } case $gl_cv_header_working_fcntl_h in #( *O_NOATIME* | no | cross-compiling) ac_val=0;; #( *) ac_val=1;; esac printf "%s\n" "#define HAVE_WORKING_O_NOATIME $ac_val" >>confdefs.h case $gl_cv_header_working_fcntl_h in #( *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( *) ac_val=1;; esac printf "%s\n" "#define HAVE_WORKING_O_NOFOLLOW $ac_val" >>confdefs.h ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default " if test "x$ac_cv_type_pid_t" = xyes then : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _WIN64 && !defined __CYGWIN__ LLP64 #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_pid_type='int' else $as_nop ac_pid_type='__int64' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes then : else $as_nop printf "%s\n" "#define mode_t int" >>confdefs.h fi if test $gl_cv_have_include_next = yes; then gl_cv_next_fcntl_h='<'fcntl.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <fcntl.h>" >&5 printf %s "checking absolute name of <fcntl.h>... " >&6; } if test ${gl_cv_next_fcntl_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <fcntl.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'fcntl.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_fcntl_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_fcntl_h gl_cv_next_fcntl_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_fcntl_h" >&5 printf "%s\n" "$gl_cv_next_fcntl_h" >&6; } fi NEXT_FCNTL_H=$gl_cv_next_fcntl_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'fcntl.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_fcntl_h fi NEXT_AS_FIRST_DIRECTIVE_FCNTL_H=$gl_next_as_first_directive { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for promoted mode_t type" >&5 printf %s "checking for promoted mode_t type... " >&6; } if test ${gl_cv_promoted_mode_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> int main (void) { typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_promoted_mode_t='int' else $as_nop gl_cv_promoted_mode_t='mode_t' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_promoted_mode_t" >&5 printf "%s\n" "$gl_cv_promoted_mode_t" >&6; } printf "%s\n" "#define PROMOTED_MODE_T $gl_cv_promoted_mode_t" >>confdefs.h HAVE_FNMATCH=1; REPLACE_FNMATCH=0; if test $gl_cv_have_include_next = yes; then gl_cv_next_fnmatch_h='<'fnmatch.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <fnmatch.h>" >&5 printf %s "checking absolute name of <fnmatch.h>... " >&6; } if test ${gl_cv_next_fnmatch_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_fnmatch_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <fnmatch.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'fnmatch.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_fnmatch_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_fnmatch_h gl_cv_next_fnmatch_h='"'$gl_header'"' else gl_cv_next_fnmatch_h='<'fnmatch.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_fnmatch_h" >&5 printf "%s\n" "$gl_cv_next_fnmatch_h" >&6; } fi NEXT_FNMATCH_H=$gl_cv_next_fnmatch_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'fnmatch.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_fnmatch_h fi NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H=$gl_next_as_first_directive if test $ac_cv_header_fnmatch_h = yes; then HAVE_FNMATCH_H=1 else HAVE_FNMATCH_H=0 fi FNMATCH_H='' if false; then FNMATCH_H=fnmatch.h else if test $ac_cv_header_fnmatch_h != yes; then FNMATCH_H=fnmatch.h fi fi if test -n "$FNMATCH_H"; then GL_GENERATE_FNMATCH_H_TRUE= GL_GENERATE_FNMATCH_H_FALSE='#' else GL_GENERATE_FNMATCH_H_TRUE='#' GL_GENERATE_FNMATCH_H_FALSE= fi GL_GNULIB_FNMATCH=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5 printf %s "checking for mbstate_t... " >&6; } if test ${ac_cv_type_mbstate_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #include <wchar.h> int main (void) { mbstate_t x; return sizeof x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_type_mbstate_t=yes else $as_nop ac_cv_type_mbstate_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_mbstate_t" >&5 printf "%s\n" "$ac_cv_type_mbstate_t" >&6; } if test $ac_cv_type_mbstate_t = yes; then printf "%s\n" "#define HAVE_MBSTATE_T 1" >>confdefs.h else printf "%s\n" "#define mbstate_t int" >>confdefs.h fi HAVE_DECL_FCLOSEALL=1; HAVE_DECL_FPURGE=1; HAVE_DECL_FSEEKO=1; HAVE_DECL_FTELLO=1; HAVE_DECL_GETDELIM=1; HAVE_DECL_GETLINE=1; HAVE_DECL_OBSTACK_PRINTF=1; HAVE_DECL_SNPRINTF=1; HAVE_DECL_VSNPRINTF=1; HAVE_DPRINTF=1; HAVE_FSEEKO=1; HAVE_FTELLO=1; HAVE_PCLOSE=1; HAVE_POPEN=1; HAVE_RENAMEAT=1; HAVE_VASPRINTF=1; HAVE_VDPRINTF=1; REPLACE_DPRINTF=0; REPLACE_FCLOSE=0; REPLACE_FDOPEN=0; REPLACE_FFLUSH=0; REPLACE_FOPEN=0; REPLACE_FPRINTF=0; REPLACE_FPURGE=0; REPLACE_FREOPEN=0; REPLACE_FSEEK=0; REPLACE_FSEEKO=0; REPLACE_FTELL=0; REPLACE_FTELLO=0; REPLACE_GETDELIM=0; REPLACE_GETLINE=0; REPLACE_OBSTACK_PRINTF=0; REPLACE_PERROR=0; REPLACE_POPEN=0; REPLACE_PRINTF=0; REPLACE_REMOVE=0; REPLACE_RENAME=0; REPLACE_RENAMEAT=0; REPLACE_SNPRINTF=0; REPLACE_SPRINTF=0; REPLACE_STDIO_READ_FUNCS=0; REPLACE_STDIO_WRITE_FUNCS=0; REPLACE_TMPFILE=0; REPLACE_VASPRINTF=0; REPLACE_VDPRINTF=0; REPLACE_VFPRINTF=0; REPLACE_VPRINTF=0; REPLACE_VSNPRINTF=0; REPLACE_VSPRINTF=0; GL_GNULIB_DPRINTF=0 GL_GNULIB_FCLOSE=0 GL_GNULIB_FDOPEN=0 GL_GNULIB_FFLUSH=0 GL_GNULIB_FGETC=0 GL_GNULIB_FGETS=0 GL_GNULIB_FOPEN=0 GL_GNULIB_FPRINTF=0 GL_GNULIB_FPRINTF_POSIX=0 GL_GNULIB_FPURGE=0 GL_GNULIB_FPUTC=0 GL_GNULIB_FPUTS=0 GL_GNULIB_FREAD=0 GL_GNULIB_FREOPEN=0 GL_GNULIB_FSCANF=0 GL_GNULIB_FSEEK=0 GL_GNULIB_FSEEKO=0 GL_GNULIB_FTELL=0 GL_GNULIB_FTELLO=0 GL_GNULIB_FWRITE=0 GL_GNULIB_GETC=0 GL_GNULIB_GETCHAR=0 GL_GNULIB_GETDELIM=0 GL_GNULIB_GETLINE=0 GL_GNULIB_OBSTACK_PRINTF=0 GL_GNULIB_OBSTACK_PRINTF_POSIX=0 GL_GNULIB_PCLOSE=0 GL_GNULIB_PERROR=0 GL_GNULIB_POPEN=0 GL_GNULIB_PRINTF=0 GL_GNULIB_PRINTF_POSIX=0 GL_GNULIB_PUTC=0 GL_GNULIB_PUTCHAR=0 GL_GNULIB_PUTS=0 GL_GNULIB_REMOVE=0 GL_GNULIB_RENAME=0 GL_GNULIB_RENAMEAT=0 GL_GNULIB_SCANF=0 GL_GNULIB_SNPRINTF=0 GL_GNULIB_SPRINTF_POSIX=0 GL_GNULIB_STDIO_H_NONBLOCKING=0 GL_GNULIB_STDIO_H_SIGPIPE=0 GL_GNULIB_TMPFILE=0 GL_GNULIB_VASPRINTF=0 GL_GNULIB_VFSCANF=0 GL_GNULIB_VSCANF=0 GL_GNULIB_VDPRINTF=0 GL_GNULIB_VFPRINTF=0 GL_GNULIB_VFPRINTF_POSIX=0 GL_GNULIB_VPRINTF=0 GL_GNULIB_VPRINTF_POSIX=0 GL_GNULIB_VSNPRINTF=0 GL_GNULIB_VSPRINTF_POSIX=0 GL_GNULIB_MDA_FCLOSEALL=1 GL_GNULIB_MDA_FDOPEN=1 GL_GNULIB_MDA_FILENO=1 GL_GNULIB_MDA_GETW=1 GL_GNULIB_MDA_PUTW=1 GL_GNULIB_MDA_TEMPNAM=1 HAVE_FCHMODAT=1; HAVE_FSTATAT=1; HAVE_FUTIMENS=1; HAVE_GETUMASK=1; HAVE_LCHMOD=1; HAVE_LSTAT=1; HAVE_MKDIRAT=1; HAVE_MKFIFO=1; HAVE_MKFIFOAT=1; HAVE_MKNOD=1; HAVE_MKNODAT=1; HAVE_UTIMENSAT=1; REPLACE_FCHMODAT=0; REPLACE_FSTAT=0; REPLACE_FSTATAT=0; REPLACE_FUTIMENS=0; REPLACE_LSTAT=0; REPLACE_MKDIR=0; REPLACE_MKFIFO=0; REPLACE_MKFIFOAT=0; REPLACE_MKNOD=0; REPLACE_MKNODAT=0; REPLACE_STAT=0; REPLACE_UTIMENSAT=0; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 printf %s "checking whether stat file-mode macros are broken... " >&6; } if test ${ac_cv_header_stat_broken+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/stat.h> #if defined S_ISBLK && defined S_IFDIR extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; #endif #if defined S_ISBLK && defined S_IFCHR extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; #endif #if defined S_ISLNK && defined S_IFREG extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; #endif #if defined S_ISSOCK && defined S_IFREG extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_header_stat_broken=no else $as_nop ac_cv_header_stat_broken=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 printf "%s\n" "$ac_cv_header_stat_broken" >&6; } if test $ac_cv_header_stat_broken = yes; then printf "%s\n" "#define STAT_MACROS_BROKEN 1" >>confdefs.h fi case "$host_os" in mingw*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit off_t" >&5 printf %s "checking for 64-bit off_t... " >&6; } if test ${gl_cv_type_off_t_64+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_type_off_t_64=yes else $as_nop gl_cv_type_off_t_64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_off_t_64" >&5 printf "%s\n" "$gl_cv_type_off_t_64" >&6; } if test $gl_cv_type_off_t_64 = no; then WINDOWS_64_BIT_OFF_T=1 else WINDOWS_64_BIT_OFF_T=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit st_size" >&5 printf %s "checking for 64-bit st_size... " >&6; } if test ${gl_cv_member_st_size_64+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> struct stat buf; int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_member_st_size_64=yes else $as_nop gl_cv_member_st_size_64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_member_st_size_64" >&5 printf "%s\n" "$gl_cv_member_st_size_64" >&6; } if test $gl_cv_member_st_size_64 = no; then WINDOWS_64_BIT_ST_SIZE=1 else WINDOWS_64_BIT_ST_SIZE=0 fi ;; *) WINDOWS_64_BIT_OFF_T=0 WINDOWS_64_BIT_ST_SIZE=0 ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 printf %s "checking for C/C++ restrict keyword... " >&6; } if test ${ac_cv_c_restrict+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_restrict=no # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see: # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html # Put 'restrict' last, because C++ lacks it. for ac_kw in __restrict__ __restrict _Restrict restrict; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ typedef int *int_ptr; int foo (int_ptr $ac_kw ip) { return ip[0]; } int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ int bar (int ip[$ac_kw]) { return ip[0]; } int main (void) { int s[1]; int *$ac_kw t = s; t[0] = 0; return foo (t) + bar (t); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_restrict=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_restrict" != no && break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 printf "%s\n" "$ac_cv_c_restrict" >&6; } case $ac_cv_c_restrict in restrict) ;; no) printf "%s\n" "#define restrict /**/" >>confdefs.h ;; *) printf "%s\n" "#define restrict $ac_cv_c_restrict" >>confdefs.h ;; esac if test $gl_cv_have_include_next = yes; then gl_cv_next_sys_stat_h='<'sys/stat.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/stat.h>" >&5 printf %s "checking absolute name of <sys/stat.h>... " >&6; } if test ${gl_cv_next_sys_stat_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_sys_stat_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/stat.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'sys/stat.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_sys_stat_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_sys_stat_h gl_cv_next_sys_stat_h='"'$gl_header'"' else gl_cv_next_sys_stat_h='<'sys/stat.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_stat_h" >&5 printf "%s\n" "$gl_cv_next_sys_stat_h" >&6; } fi NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'sys/stat.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_sys_stat_h fi NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H=$gl_next_as_first_directive WINDOWS_STAT_TIMESPEC=0 ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include <sys/types.h> #include <sys/stat.h> " if test "x$ac_cv_type_nlink_t" = xyes then : else $as_nop printf "%s\n" "#define nlink_t int" >>confdefs.h fi case "$host_os" in mingw*) ac_fn_c_check_header_compile "$LINENO" "sdkddkver.h" "ac_cv_header_sdkddkver_h" "$ac_includes_default" if test "x$ac_cv_header_sdkddkver_h" = xyes then : printf "%s\n" "#define HAVE_SDKDDKVER_H 1" >>confdefs.h fi ;; esac GL_GNULIB_FCHMODAT=0 GL_GNULIB_FSTAT=0 GL_GNULIB_FSTATAT=0 GL_GNULIB_FUTIMENS=0 GL_GNULIB_GETUMASK=0 GL_GNULIB_LCHMOD=0 GL_GNULIB_LSTAT=0 GL_GNULIB_MKDIR=0 GL_GNULIB_MKDIRAT=0 GL_GNULIB_MKFIFO=0 GL_GNULIB_MKFIFOAT=0 GL_GNULIB_MKNOD=0 GL_GNULIB_MKNODAT=0 GL_GNULIB_STAT=0 GL_GNULIB_UTIMENSAT=0 GL_GNULIB_OVERRIDES_STRUCT_STAT=0 GL_GNULIB_MDA_CHMOD=1 GL_GNULIB_MDA_MKDIR=1 GL_GNULIB_MDA_UMASK=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 printf %s "checking whether lstat correctly handles trailing slash... " >&6; } if test ${gl_cv_func_lstat_dereferences_slashed_symlink+y} then : printf %s "(cached) " >&6 else $as_nop rm -f conftest.sym conftest.file echo >conftest.file if test "$cross_compiling" = yes then : case "$host_os" in linux-* | linux) # Guess yes on Linux systems. gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; *-gnu* | gnu*) # Guess yes on glibc systems. gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; mingw*) # Guess no on native Windows. gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; *) # If we don't know, obey --enable-cross-guesses. gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { struct stat sbuf; if (symlink ("conftest.file", "conftest.sym") != 0) return 1; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_lstat_dereferences_slashed_symlink=yes else $as_nop gl_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.sym conftest.file fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5 printf "%s\n" "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; } case "$gl_cv_func_lstat_dereferences_slashed_symlink" in *yes) printf "%s\n" "#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1" >>confdefs.h ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5 printf %s "checking for O_CLOEXEC... " >&6; } if test ${gl_cv_macro_O_CLOEXEC+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <fcntl.h> #ifndef O_CLOEXEC choke me; #endif int main (void) { return O_CLOEXEC; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_macro_O_CLOEXEC=yes else $as_nop gl_cv_macro_O_CLOEXEC=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_macro_O_CLOEXEC" >&5 printf "%s\n" "$gl_cv_macro_O_CLOEXEC" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getcwd (NULL, 0) allocates memory for result" >&5 printf %s "checking whether getcwd (NULL, 0) allocates memory for result... " >&6; } if test ${gl_cv_func_getcwd_null+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_getcwd_null="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_getcwd_null="guessing yes";; # Guess yes on Cygwin. cygwin*) gl_cv_func_getcwd_null="guessing yes";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_getcwd_null="$gl_cross_guess_normal";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # include <stdlib.h> # if HAVE_UNISTD_H # include <unistd.h> # else /* on Windows with MSVC */ # include <direct.h> # endif $gl_mda_defines # ifndef getcwd char *getcwd (); # endif int main (void) { #if defined _WIN32 && ! defined __CYGWIN__ /* mingw cwd does not start with '/', but _getcwd does allocate. However, mingw fails to honor non-zero size. */ #else if (chdir ("/") != 0) return 1; else { char *f = getcwd (NULL, 0); if (! f) return 2; if (f[0] != '/') { free (f); return 3; } if (f[1] != '\0') { free (f); return 4; } free (f); return 0; } #endif ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_getcwd_null=yes else $as_nop gl_cv_func_getcwd_null=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_null" >&5 printf "%s\n" "$gl_cv_func_getcwd_null" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for getcwd with POSIX signature" >&5 printf %s "checking for getcwd with POSIX signature... " >&6; } if test ${gl_cv_func_getcwd_posix_signature+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> $gl_mda_defines int main (void) { extern #ifdef __cplusplus "C" #endif char *getcwd (char *, size_t); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_getcwd_posix_signature=yes else $as_nop gl_cv_func_getcwd_posix_signature=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_posix_signature" >&5 printf "%s\n" "$gl_cv_func_getcwd_posix_signature" >&6; } ac_fn_check_decl "$LINENO" "getdtablesize" "ac_cv_have_decl_getdtablesize" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_getdtablesize" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_GETDTABLESIZE $ac_have_decl" >>confdefs.h if test $gl_cv_have_include_next = yes; then gl_cv_next_getopt_h='<'getopt.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <getopt.h>" >&5 printf %s "checking absolute name of <getopt.h>... " >&6; } if test ${gl_cv_next_getopt_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_getopt_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <getopt.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'getopt.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_getopt_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_getopt_h gl_cv_next_getopt_h='"'$gl_header'"' else gl_cv_next_getopt_h='<'getopt.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_getopt_h" >&5 printf "%s\n" "$gl_cv_next_getopt_h" >&6; } fi NEXT_GETOPT_H=$gl_cv_next_getopt_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'getopt.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_getopt_h fi NEXT_AS_FIRST_DIRECTIVE_GETOPT_H=$gl_next_as_first_directive if test $ac_cv_header_getopt_h = yes; then HAVE_GETOPT_H=1 else HAVE_GETOPT_H=0 fi gl_replace_getopt= if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then for ac_header in getopt.h do : ac_fn_c_check_header_compile "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default" if test "x$ac_cv_header_getopt_h" = xyes then : printf "%s\n" "#define HAVE_GETOPT_H 1" >>confdefs.h else $as_nop gl_replace_getopt=yes fi done fi if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then for ac_func in getopt_long_only do : ac_fn_c_check_func "$LINENO" "getopt_long_only" "ac_cv_func_getopt_long_only" if test "x$ac_cv_func_getopt_long_only" = xyes then : printf "%s\n" "#define HAVE_GETOPT_LONG_ONLY 1" >>confdefs.h else $as_nop gl_replace_getopt=yes fi done fi if test -z "$gl_replace_getopt"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getopt is POSIX compatible" >&5 printf %s "checking whether getopt is POSIX compatible... " >&6; } if test ${gl_cv_func_getopt_posix+y} then : printf %s "(cached) " >&6 else $as_nop if test $cross_compiling = no; then if test "$cross_compiling" = yes then : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> #include <stdlib.h> #include <string.h> int main () { static char program[] = "program"; static char a[] = "-a"; static char foo[] = "foo"; static char bar[] = "bar"; char *argv[] = { program, a, foo, bar, NULL }; int c; c = getopt (4, argv, "ab"); if (!(c == 'a')) return 1; c = getopt (4, argv, "ab"); if (!(c == -1)) return 2; if (!(optind == 2)) return 3; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_getopt_posix=maybe else $as_nop gl_cv_func_getopt_posix=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $gl_cv_func_getopt_posix = maybe; then if test "$cross_compiling" = yes then : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> #include <stdlib.h> #include <string.h> int main () { static char program[] = "program"; static char donald[] = "donald"; static char p[] = "-p"; static char billy[] = "billy"; static char duck[] = "duck"; static char a[] = "-a"; static char bar[] = "bar"; char *argv[] = { program, donald, p, billy, duck, a, bar, NULL }; int c; c = getopt (7, argv, "+abp:q:"); if (!(c == -1)) return 4; if (!(strcmp (argv[0], "program") == 0)) return 5; if (!(strcmp (argv[1], "donald") == 0)) return 6; if (!(strcmp (argv[2], "-p") == 0)) return 7; if (!(strcmp (argv[3], "billy") == 0)) return 8; if (!(strcmp (argv[4], "duck") == 0)) return 9; if (!(strcmp (argv[5], "-a") == 0)) return 10; if (!(strcmp (argv[6], "bar") == 0)) return 11; if (!(optind == 1)) return 12; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_getopt_posix=maybe else $as_nop gl_cv_func_getopt_posix=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if test $gl_cv_func_getopt_posix = maybe; then if test "$cross_compiling" = yes then : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> #include <stdlib.h> #include <string.h> int main () { static char program[] = "program"; static char ab[] = "-ab"; char *argv[3] = { program, ab, NULL }; if (getopt (2, argv, "ab:") != 'a') return 13; if (getopt (2, argv, "ab:") != '?') return 14; if (optopt != 'b') return 15; if (optind != 2) return 16; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_getopt_posix=yes else $as_nop gl_cv_func_getopt_posix=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi else case "$host_os" in darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";; *) gl_cv_func_getopt_posix="guessing yes";; esac fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_posix" >&5 printf "%s\n" "$gl_cv_func_getopt_posix" >&6; } case "$gl_cv_func_getopt_posix" in *no) gl_replace_getopt=yes ;; esac fi if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt function" >&5 printf %s "checking for working GNU getopt function... " >&6; } if test ${gl_cv_func_getopt_gnu+y} then : printf %s "(cached) " >&6 else $as_nop # Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the # optstring is necessary for programs like m4 that have POSIX-mandated # semantics for supporting options interspersed with files. # Also, since getopt_long is a GNU extension, we require optind=0. # Bash ties 'set -o posix' to a non-exported POSIXLY_CORRECT; # so take care to revert to the correct (non-)export state. gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }' case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in xx) gl_had_POSIXLY_CORRECT=exported ;; x) gl_had_POSIXLY_CORRECT=yes ;; *) gl_had_POSIXLY_CORRECT= ;; esac POSIXLY_CORRECT=1 export POSIXLY_CORRECT if test "$cross_compiling" = yes then : gl_cv_func_getopt_gnu="$gl_cross_guess_normal" else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <getopt.h> #include <stddef.h> #include <string.h> #include <stdlib.h> #if defined __MACH__ && defined __APPLE__ /* Avoid a crash on Mac OS X. */ #include <mach/mach.h> #include <mach/mach_error.h> #include <mach/thread_status.h> #include <mach/exception.h> #include <mach/task.h> #include <pthread.h> /* The exception port on which our thread listens. */ static mach_port_t our_exception_port; /* The main function of the thread listening for exceptions of type EXC_BAD_ACCESS. */ static void * mach_exception_thread (void *arg) { /* Buffer for a message to be received. */ struct { mach_msg_header_t head; mach_msg_body_t msgh_body; char data[1024]; } msg; mach_msg_return_t retval; /* Wait for a message on the exception port. */ retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); if (retval != MACH_MSG_SUCCESS) abort (); exit (1); } static void nocrash_init (void) { mach_port_t self = mach_task_self (); /* Allocate a port on which the thread shall listen for exceptions. */ if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) == KERN_SUCCESS) { /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ if (mach_port_insert_right (self, our_exception_port, our_exception_port, MACH_MSG_TYPE_MAKE_SEND) == KERN_SUCCESS) { /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting for us. */ exception_mask_t mask = EXC_MASK_BAD_ACCESS; /* Create the thread listening on the exception port. */ pthread_attr_t attr; pthread_t thread; if (pthread_attr_init (&attr) == 0 && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { pthread_attr_destroy (&attr); /* Replace the exception port info for these exceptions with our own. Note that we replace the exception port for the entire task, not only for a particular thread. This has the effect that when our exception port gets the message, the thread specific exception port has already been asked, and we don't need to bother about it. See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ task_set_exception_ports (self, mask, our_exception_port, EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); } } } } #elif defined _WIN32 && ! defined __CYGWIN__ /* Avoid a crash on native Windows. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winerror.h> static LONG WINAPI exception_filter (EXCEPTION_POINTERS *ExceptionInfo) { switch (ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: case EXCEPTION_IN_PAGE_ERROR: case EXCEPTION_STACK_OVERFLOW: case EXCEPTION_GUARD_PAGE: case EXCEPTION_PRIV_INSTRUCTION: case EXCEPTION_ILLEGAL_INSTRUCTION: case EXCEPTION_DATATYPE_MISALIGNMENT: case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: case EXCEPTION_NONCONTINUABLE_EXCEPTION: exit (1); } return EXCEPTION_CONTINUE_SEARCH; } static void nocrash_init (void) { SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); } #else /* Avoid a crash on POSIX systems. */ #include <signal.h> #include <unistd.h> /* A POSIX signal handler. */ static void exception_handler (int sig) { _exit (1); } static void nocrash_init (void) { #ifdef SIGSEGV signal (SIGSEGV, exception_handler); #endif #ifdef SIGBUS signal (SIGBUS, exception_handler); #endif } #endif int main (void) { int result = 0; nocrash_init(); /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10. */ { static char conftest[] = "conftest"; static char plus[] = "-+"; char *argv[3] = { conftest, plus, NULL }; opterr = 0; if (getopt (2, argv, "+a") != '?') result |= 1; } /* This code succeeds on glibc 2.8, mingw, and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ { static char program[] = "program"; static char p[] = "-p"; static char foo[] = "foo"; static char bar[] = "bar"; char *argv[] = { program, p, foo, bar, NULL }; optind = 1; if (getopt (4, argv, "p::") != 'p') result |= 2; else if (optarg != NULL) result |= 4; else if (getopt (4, argv, "p::") != -1) result |= 6; else if (optind != 2) result |= 8; } /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ { static char program[] = "program"; static char foo[] = "foo"; static char p[] = "-p"; char *argv[] = { program, foo, p, NULL }; optind = 0; if (getopt (3, argv, "-p") != 1) result |= 16; else if (getopt (3, argv, "-p") != 'p') result |= 16; } /* This code fails on glibc 2.11. */ { static char program[] = "program"; static char b[] = "-b"; static char a[] = "-a"; char *argv[] = { program, b, a, NULL }; optind = opterr = 0; if (getopt (3, argv, "+:a:b") != 'b') result |= 32; else if (getopt (3, argv, "+:a:b") != ':') result |= 32; } /* This code dumps core on glibc 2.14. */ { static char program[] = "program"; static char w[] = "-W"; static char dummy[] = "dummy"; char *argv[] = { program, w, dummy, NULL }; optind = opterr = 1; if (getopt (3, argv, "W;") != 'W') result |= 64; } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_getopt_gnu=yes else $as_nop gl_cv_func_getopt_gnu=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi case $gl_had_POSIXLY_CORRECT in exported) ;; yes) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;}; POSIXLY_CORRECT=1 ;; *) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;} ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_gnu" >&5 printf "%s\n" "$gl_cv_func_getopt_gnu" >&6; } if test "$gl_cv_func_getopt_gnu" != yes; then gl_replace_getopt=yes else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt_long function" >&5 printf %s "checking for working GNU getopt_long function... " >&6; } if test ${gl_cv_func_getopt_long_gnu+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in openbsd*) gl_cv_func_getopt_long_gnu="guessing no";; *) gl_cv_func_getopt_long_gnu="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <getopt.h> #include <stddef.h> #include <string.h> int main (void) { static const struct option long_options[] = { { "xtremely-",no_argument, NULL, 1003 }, { "xtra", no_argument, NULL, 1001 }, { "xtreme", no_argument, NULL, 1002 }, { "xtremely", no_argument, NULL, 1003 }, { NULL, 0, NULL, 0 } }; /* This code fails on OpenBSD 5.0. */ { static char program[] = "program"; static char xtremel[] = "--xtremel"; char *argv[] = { program, xtremel, NULL }; int option_index; optind = 1; opterr = 0; if (getopt_long (2, argv, "", long_options, &option_index) != 1003) return 1; } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_getopt_long_gnu=yes else $as_nop gl_cv_func_getopt_long_gnu=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_long_gnu" >&5 printf "%s\n" "$gl_cv_func_getopt_long_gnu" >&6; } case "$gl_cv_func_getopt_long_gnu" in *yes) ;; *) gl_replace_getopt=yes ;; esac fi fi if test -z "$gl_pthreadlib_body_done"; then gl_pthread_api=no LIBPTHREAD= LIBPMULTITHREAD= # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY. ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes then : gl_have_pthread_h=yes else $as_nop gl_have_pthread_h=no fi if test "$gl_have_pthread_h" = yes; then # Other possible tests: # -lpthreads (FSU threads, PCthreads) # -lgthreads # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist # in libc. IRIX 6.5 has the first one in both libc and libpthread, but # the second one only in libpthread, and lock.c needs it. # # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 # needs -pthread for some reason. See: # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html save_LIBS=$LIBS for gl_pthread in '' '-pthread'; do LIBS="$LIBS $gl_pthread" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> pthread_mutex_t m; pthread_mutexattr_t ma; int main (void) { pthread_mutex_lock (&m); pthread_mutexattr_init (&ma); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_pthread_api=yes LIBPTHREAD=$gl_pthread LIBPMULTITHREAD=$gl_pthread fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$save_LIBS test $gl_pthread_api = yes && break done echo "$as_me:13017: gl_pthread_api=$gl_pthread_api" >&5 echo "$as_me:13018: LIBPTHREAD=$LIBPTHREAD" >&5 gl_pthread_in_glibc=no # On Linux with glibc >= 2.34, libc contains the fully functional # pthread functions. case "$host_os" in linux*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <features.h> #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2) Lucky user #endif #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1 then : gl_pthread_in_glibc=yes fi rm -rf conftest* ;; esac echo "$as_me:13044: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5 # Test for libpthread by looking for pthread_kill. (Not pthread_self, # since it is defined as a macro on OSF/1.) if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then # The program links fine without libpthread. But it may actually # need to link with libpthread in order to create multiple threads. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 printf %s "checking for pthread_kill in -lpthread... " >&6; } if test ${ac_cv_lib_pthread_pthread_kill+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_kill (); int main (void) { return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_pthread_pthread_kill=yes else $as_nop ac_cv_lib_pthread_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } if test "x$ac_cv_lib_pthread_pthread_kill" = xyes then : if test $gl_pthread_in_glibc = yes; then LIBPMULTITHREAD= else LIBPMULTITHREAD=-lpthread # On Solaris and HP-UX, most pthread functions exist also in libc. # Therefore pthread_in_use() needs to actually try to create a # thread: pthread_create from libc will fail, whereas # pthread_create will actually create a thread. # On Solaris 10 or newer, this test is no longer needed, because # libc contains the fully functional pthread functions. case "$host_os" in solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h esac fi fi elif test $gl_pthread_api != yes; then # Some library is needed. Try libpthread and libc_r. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 printf %s "checking for pthread_kill in -lpthread... " >&6; } if test ${ac_cv_lib_pthread_pthread_kill+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_kill (); int main (void) { return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_pthread_pthread_kill=yes else $as_nop ac_cv_lib_pthread_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } if test "x$ac_cv_lib_pthread_pthread_kill" = xyes then : gl_pthread_api=yes LIBPTHREAD=-lpthread LIBPMULTITHREAD=-lpthread fi if test $gl_pthread_api != yes; then # For FreeBSD 4. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 printf %s "checking for pthread_kill in -lc_r... " >&6; } if test ${ac_cv_lib_c_r_pthread_kill+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_kill (); int main (void) { return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_c_r_pthread_kill=yes else $as_nop ac_cv_lib_c_r_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 printf "%s\n" "$ac_cv_lib_c_r_pthread_kill" >&6; } if test "x$ac_cv_lib_c_r_pthread_kill" = xyes then : gl_pthread_api=yes LIBPTHREAD=-lc_r LIBPMULTITHREAD=-lc_r fi fi fi echo "$as_me:13198: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 printf %s "checking whether POSIX threads API is available... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 printf "%s\n" "$gl_pthread_api" >&6; } if test $gl_pthread_api = yes; then printf "%s\n" "#define HAVE_PTHREAD_API 1" >>confdefs.h fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sched.h> int main (void) { sched_yield (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : LIB_SCHED_YIELD= else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 printf %s "checking for sched_yield in -lrt... " >&6; } if test ${ac_cv_lib_rt_sched_yield+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char sched_yield (); int main (void) { return sched_yield (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_rt_sched_yield=yes else $as_nop ac_cv_lib_rt_sched_yield=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 printf "%s\n" "$ac_cv_lib_rt_sched_yield" >&6; } if test "x$ac_cv_lib_rt_sched_yield" = xyes then : LIB_SCHED_YIELD=-lrt else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 printf %s "checking for sched_yield in -lposix4... " >&6; } if test ${ac_cv_lib_posix4_sched_yield+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lposix4 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char sched_yield (); int main (void) { return sched_yield (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_posix4_sched_yield=yes else $as_nop ac_cv_lib_posix4_sched_yield=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 printf "%s\n" "$ac_cv_lib_posix4_sched_yield" >&6; } if test "x$ac_cv_lib_posix4_sched_yield" = xyes then : LIB_SCHED_YIELD=-lposix4 fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext gl_pthreadlib_body_done=done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setlocale (LC_ALL, NULL) is multithread-safe" >&5 printf %s "checking whether setlocale (LC_ALL, NULL) is multithread-safe... " >&6; } if test ${gl_cv_func_setlocale_null_all_mtsafe+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) gl_cv_func_setlocale_null_all_mtsafe=no ;; # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) gl_cv_func_setlocale_null_all_mtsafe=yes ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_all_mtsafe" >&5 printf "%s\n" "$gl_cv_func_setlocale_null_all_mtsafe" >&6; } case "$host_os" in mingw*) ;; *) if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then gl_cv_func_setlocale_null_all_mtsafe="trivially yes" fi ;; esac case "$gl_cv_func_setlocale_null_all_mtsafe" in *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; esac printf "%s\n" "#define SETLOCALE_NULL_ALL_MTSAFE $SETLOCALE_NULL_ALL_MTSAFE" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setlocale (category, NULL) is multithread-safe" >&5 printf %s "checking whether setlocale (category, NULL) is multithread-safe... " >&6; } if test ${gl_cv_func_setlocale_null_one_mtsafe+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on OpenBSD, AIX. openbsd* | aix*) gl_cv_func_setlocale_null_one_mtsafe=no ;; # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) gl_cv_func_setlocale_null_one_mtsafe=yes ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_one_mtsafe" >&5 printf "%s\n" "$gl_cv_func_setlocale_null_one_mtsafe" >&6; } case "$host_os" in mingw*) ;; *) if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then gl_cv_func_setlocale_null_one_mtsafe="trivially yes" fi ;; esac case "$gl_cv_func_setlocale_null_one_mtsafe" in *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; esac printf "%s\n" "#define SETLOCALE_NULL_ONE_MTSAFE $SETLOCALE_NULL_ONE_MTSAFE" >>confdefs.h if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then case "$host_os" in mingw*) LIB_SETLOCALE_NULL= ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 printf %s "checking whether imported symbols can be declared weak... " >&6; } if test ${gl_cv_have_weak+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_have_weak=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern void xyzzy (); #pragma weak xyzzy int main (void) { xyzzy(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_have_weak=maybe fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test $gl_cv_have_weak = maybe; then if test "$cross_compiling" = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ELF__ Extensible Linking Format #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Extensible Linking Format" >/dev/null 2>&1 then : gl_cv_have_weak="guessing yes" else $as_nop gl_cv_have_weak="guessing no" fi rm -rf conftest* else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #pragma weak fputs int main () { return (fputs == NULL); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_have_weak=yes else $as_nop gl_cv_have_weak=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi case " $LDFLAGS " in *" -static "*) gl_cv_have_weak=no ;; esac case "$gl_cv_have_weak" in *yes) case "$host_os" in freebsd* | dragonfly* | midnightbsd*) : > conftest1.c $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 cat <<EOF > conftest2.c #include <pthread.h> #pragma weak pthread_mutexattr_gettype int main () { return (pthread_mutexattr_gettype != NULL); } EOF $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ || gl_cv_have_weak=no rm -f conftest1.c libempty.so conftest2.c conftest ;; esac ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 printf "%s\n" "$gl_cv_have_weak" >&6; } case "$gl_cv_have_weak" in *yes) printf "%s\n" "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h ;; esac case "$gl_cv_have_weak" in *yes) LIB_SETLOCALE_NULL= ;; *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; esac ;; esac else LIB_SETLOCALE_NULL= fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _MSC_VER MicrosoftCompiler #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "MicrosoftCompiler" >/dev/null 2>&1 then : rm -f conftest* echo 'int dummy;' > conftest.c { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } >/dev/null 2>&1 if test -f conftest.o; then gl_asmext='s' gl_c_asm_opt='-S' else gl_asmext='asm' gl_c_asm_opt='-c -Fa' fi rm -f conftest* else $as_nop gl_asmext='s' gl_c_asm_opt='-S' fi rm -rf conftest* { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host CPU and C ABI" >&5 printf %s "checking host CPU and C ABI... " >&6; } if test ${gl_cv_host_cpu_c_abi+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_cpu" in i[34567]86 ) gl_cv_host_cpu_c_abi=i386 ;; x86_64 ) # On x86_64 systems, the C compiler may be generating code in one of # these ABIs: # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 # with native Windows (mingw, MSVC). # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if (defined __x86_64__ || defined __amd64__ \ || defined _M_X64 || defined _M_AMD64) int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __ILP32__ || defined _ILP32 int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi=x86_64-x32 else $as_nop gl_cv_host_cpu_c_abi=x86_64 fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop gl_cv_host_cpu_c_abi=i386 fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) gl_cv_host_cpu_c_abi=alpha ;; arm* | aarch64 ) # Assume arm with EABI. # On arm64 systems, the C compiler may be generating code in one of # these ABIs: # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __aarch64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __ILP32__ || defined _ILP32 int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi=arm64-ilp32 else $as_nop gl_cv_host_cpu_c_abi=arm64 fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop # Don't distinguish little-endian and big-endian arm, since they # don't require different machine code for simple operations and # since the user can distinguish them through the preprocessor # defines __ARMEL__ vs. __ARMEB__. # But distinguish arm which passes floating-point arguments and # return values in integer registers (r0, r1, ...) - this is # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which # passes them in float registers (s0, s1, ...) and double registers # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer # sets the preprocessor defines __ARM_PCS (for the first case) and # __ARM_PCS_VFP (for the second case), but older GCC does not. echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c # Look for a reference to the register d0 in the .s file. { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } >/dev/null 2>&1 if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then gl_cv_host_cpu_c_abi=armhf else gl_cv_host_cpu_c_abi=arm fi rm -f conftest* fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) # On hppa, the C compiler may be generating 32-bit code or 64-bit # code. In the latter case, it defines _LP64 and __LP64__. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __LP64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi=hppa64 else $as_nop gl_cv_host_cpu_c_abi=hppa fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; ia64* ) # On ia64 on HP-UX, the C compiler may be generating 64-bit code or # 32-bit code. In the latter case, it defines _ILP32. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _ILP32 int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi=ia64-ilp32 else $as_nop gl_cv_host_cpu_c_abi=ia64 fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; mips* ) # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this # at 32. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi=mips64 else $as_nop # In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32. # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if (_MIPS_SIM == _ABIN32) int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi=mipsn32 else $as_nop gl_cv_host_cpu_c_abi=mips fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; powerpc* ) # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. # No need to distinguish them here; the caller may distinguish # them based on the OS. # On powerpc64 systems, the C compiler may still be generating # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may # be generating 64-bit code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __powerpc64__ || defined __LP64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : # On powerpc64, there are two ABIs on Linux: The AIX compatible # one and the ELFv2 one. The latter defines _CALL_ELF=2. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _CALL_ELF && _CALL_ELF == 2 int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi=powerpc64-elfv2 else $as_nop gl_cv_host_cpu_c_abi=powerpc64 fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop gl_cv_host_cpu_c_abi=powerpc fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; rs6000 ) gl_cv_host_cpu_c_abi=powerpc ;; riscv32 | riscv64 ) # There are 2 architectures (with variants): rv32* and rv64*. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if __riscv_xlen == 64 int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : cpu=riscv64 else $as_nop cpu=riscv32 fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. # Size of 'long' and 'void *': cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __LP64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : main_abi=lp64 else $as_nop main_abi=ilp32 fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Float ABIs: # __riscv_float_abi_double: # 'float' and 'double' are passed in floating-point registers. # __riscv_float_abi_single: # 'float' are passed in floating-point registers. # __riscv_float_abi_soft: # No values are passed in floating-point registers. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __riscv_float_abi_double int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : float_abi=d else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __riscv_float_abi_single int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : float_abi=f else $as_nop float_abi='' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}" ;; s390* ) # On s390x, the C compiler may be generating 64-bit (= s390x) code # or 31-bit (= s390) code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __LP64__ || defined __s390x__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi=s390x else $as_nop gl_cv_host_cpu_c_abi=s390 fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; sparc | sparc64 ) # UltraSPARCs running Linux have `uname -m` = "sparc64", but the # C compiler still generates 32-bit code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi=sparc64 else $as_nop gl_cv_host_cpu_c_abi=sparc fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; *) gl_cv_host_cpu_c_abi="$host_cpu" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_host_cpu_c_abi" >&5 printf "%s\n" "$gl_cv_host_cpu_c_abi" >&6; } HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'` HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi" # This was # AC_DEFINE_UNQUOTED([__${HOST_CPU}__]) # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__]) # earlier, but KAI C++ 3.2d doesn't like this. sed -e 's/-/_/g' >> confdefs.h <<EOF #ifndef __${HOST_CPU}__ #define __${HOST_CPU}__ 1 #endif #ifndef __${HOST_CPU_C_ABI}__ #define __${HOST_CPU_C_ABI}__ 1 #endif EOF if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" # Check whether --with-gnu-ld was given. if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else $as_nop with_gnu_ld=no fi # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi if test -n "$LD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld" >&5 printf %s "checking for ld... " >&6; } elif test "$GCC" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } elif test "$with_gnu_ld" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 printf %s "checking for GNU ld... " >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 printf %s "checking for non-GNU ld... " >&6; } fi if test -n "$LD"; then # Let the user override the test with a path. : else if test ${acl_cv_path_LD+y} then : printf %s "(cached) " >&6 else $as_nop acl_cv_path_LD= # Final result of this test ac_prog=ld # Program to search in $PATH if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) acl_output=`($CC -print-prog-name=ld) 2>&5` ;; esac case $acl_output in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` done # Got the pathname. No search in PATH is needed. acl_cv_path_LD="$acl_output" ac_prog= ;; "") # If it fails, then pretend we aren't using GCC. ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac fi if test -n "$ac_prog"; then # Search for $ac_prog in $PATH. acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$acl_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$acl_save_ifs" fi case $host in *-*-aix*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __powerpc64__ || defined __LP64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : # The compiler produces 64-bit code. Add option '-b64' so that the # linker groks 64-bit object files. case "$acl_cv_path_LD " in *" -b64 "*) ;; *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; sparc64-*-netbsd*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop # The compiler produces 32-bit code. Add option '-m elf32_sparc' # so that the linker groks 32-bit object files. case "$acl_cv_path_LD " in *" -m elf32_sparc "*) ;; *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi LD="$acl_cv_path_LD" fi if test -n "$LD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${acl_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 </dev/null` in *GNU* | *'with BFD'*) acl_cv_prog_gnu_ld=yes ;; *) acl_cv_prog_gnu_ld=no ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5 printf "%s\n" "$acl_cv_prog_gnu_ld" >&6; } with_gnu_ld=$acl_cv_prog_gnu_ld { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 printf %s "checking for shared library run path origin... " >&6; } if test ${acl_cv_rpath+y} then : printf %s "(cached) " >&6 else $as_nop CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 printf "%s\n" "$acl_cv_rpath" >&6; } wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" # Check whether --enable-rpath was given. if test ${enable_rpath+y} then : enableval=$enable_rpath; : else $as_nop enable_rpath=yes fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking 32-bit host C ABI" >&5 printf %s "checking 32-bit host C ABI... " >&6; } if test ${gl_cv_host_cpu_c_abi_32bit+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$gl_cv_host_cpu_c_abi"; then case "$gl_cv_host_cpu_c_abi" in i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) gl_cv_host_cpu_c_abi_32bit=yes ;; x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) gl_cv_host_cpu_c_abi_32bit=no ;; *) gl_cv_host_cpu_c_abi_32bit=unknown ;; esac else case "$host_cpu" in # CPUs that only support a 32-bit ABI. arc \ | bfin \ | cris* \ | csky \ | epiphany \ | ft32 \ | h8300 \ | m68k \ | microblaze | microblazeel \ | nds32 | nds32le | nds32be \ | nios2 | nios2eb | nios2el \ | or1k* \ | or32 \ | sh | sh1234 | sh1234elb \ | tic6x \ | xtensa* ) gl_cv_host_cpu_c_abi_32bit=yes ;; # CPUs that only support a 64-bit ABI. alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ | mmix ) gl_cv_host_cpu_c_abi_32bit=no ;; i[34567]86 ) gl_cv_host_cpu_c_abi_32bit=yes ;; x86_64 ) # On x86_64 systems, the C compiler may be generating code in one of # these ABIs: # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 # with native Windows (mingw, MSVC). # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if (defined __x86_64__ || defined __amd64__ \ || defined _M_X64 || defined _M_AMD64) \ && !(defined __ILP32__ || defined _ILP32) int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi_32bit=no else $as_nop gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; arm* | aarch64 ) # Assume arm with EABI. # On arm64 systems, the C compiler may be generating code in one of # these ABIs: # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi_32bit=no else $as_nop gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) # On hppa, the C compiler may be generating 32-bit code or 64-bit # code. In the latter case, it defines _LP64 and __LP64__. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __LP64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi_32bit=no else $as_nop gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; ia64* ) # On ia64 on HP-UX, the C compiler may be generating 64-bit code or # 32-bit code. In the latter case, it defines _ILP32. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _ILP32 int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi_32bit=yes else $as_nop gl_cv_host_cpu_c_abi_32bit=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; mips* ) # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this # at 32. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi_32bit=no else $as_nop gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; powerpc* ) # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. # No need to distinguish them here; the caller may distinguish # them based on the OS. # On powerpc64 systems, the C compiler may still be generating # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may # be generating 64-bit code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __powerpc64__ || defined __LP64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi_32bit=no else $as_nop gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; rs6000 ) gl_cv_host_cpu_c_abi_32bit=yes ;; riscv32 | riscv64 ) # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. # Size of 'long' and 'void *': cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __LP64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi_32bit=no else $as_nop gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; s390* ) # On s390x, the C compiler may be generating 64-bit (= s390x) code # or 31-bit (= s390) code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __LP64__ || defined __s390x__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi_32bit=no else $as_nop gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; sparc | sparc64 ) # UltraSPARCs running Linux have `uname -m` = "sparc64", but the # C compiler still generates 32-bit code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi_32bit=no else $as_nop gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; *) gl_cv_host_cpu_c_abi_32bit=unknown ;; esac fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_host_cpu_c_abi_32bit" >&5 printf "%s\n" "$gl_cv_host_cpu_c_abi_32bit" >&6; } HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ELF binary format" >&5 printf %s "checking for ELF binary format... " >&6; } if test ${gl_cv_elf+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ELF__ Extensible Linking Format #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Extensible Linking Format" >/dev/null 2>&1 then : gl_cv_elf=yes else $as_nop gl_cv_elf=no fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_elf" >&5 printf "%s\n" "$gl_cv_elf" >&6; } if test $gl_cv_elf = yes; then # Extract the ELF class of a file (5th byte) in decimal. # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header if od -A x < /dev/null >/dev/null 2>/dev/null; then # Use POSIX od. func_elfclass () { od -A n -t d1 -j 4 -N 1 } else # Use BSD hexdump. func_elfclass () { dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' echo } fi # Use 'expr', not 'test', to compare the values of func_elfclass, because on # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, # not 1 or 2. case $HOST_CPU_C_ABI_32BIT in yes) # 32-bit ABI. acl_is_expected_elfclass () { expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null } ;; no) # 64-bit ABI. acl_is_expected_elfclass () { expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null } ;; *) # Unknown. acl_is_expected_elfclass () { : } ;; esac else acl_is_expected_elfclass () { : } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 printf %s "checking for the common suffixes of directories in the library search path... " >&6; } if test ${acl_cv_libdirstems+y} then : printf %s "(cached) " >&6 else $as_nop acl_libdirstem=lib acl_libdirstem2= acl_libdirstem3= case "$host_os" in solaris*) if test $HOST_CPU_C_ABI_32BIT = no; then acl_libdirstem2=lib/64 case "$host_cpu" in sparc*) acl_libdirstem3=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; esac fi ;; *) searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test $HOST_CPU_C_ABI_32BIT != no; then # 32-bit or unknown ABI. if test -d /usr/lib32; then acl_libdirstem2=lib32 fi fi if test $HOST_CPU_C_ABI_32BIT != yes; then # 64-bit or unknown ABI. if test -d /usr/lib64; then acl_libdirstem3=lib64 fi fi if test -n "$searchpath"; then acl_save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib32 ) acl_libdirstem2=lib32 ;; */lib64 ) acl_libdirstem3=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" if test $HOST_CPU_C_ABI_32BIT = yes; then # 32-bit ABI. acl_libdirstem3= fi if test $HOST_CPU_C_ABI_32BIT = no; then # 64-bit ABI. acl_libdirstem2= fi fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libdirstems" >&5 printf "%s\n" "$acl_cv_libdirstems" >&6; } acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libiconv-prefix was given. if test ${with_libiconv_prefix+y} then : withval=$with_libiconv_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" additional_libdir2="$withval/$acl_libdirstem2" additional_libdir3="$withval/$acl_libdirstem3" fi fi fi if test "X$additional_libdir2" = "X$additional_libdir"; then additional_libdir2= fi if test "X$additional_libdir3" = "X$additional_libdir"; then additional_libdir3= fi LIBICONV= LTLIBICONV= INCICONV= LIBICONV_PREFIX= HAVE_LIBICONV= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='iconv ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" else : fi else found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do if test "X$found_dir" = "X"; then eval dir=\$$additional_libdir_variable if test -n "$dir"; then if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi fi done fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" else LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem3 | */$acl_libdirstem3/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$dependency_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$dependency_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dep=`echo "X$dep" | sed -e 's/^X-l//'` if test "X$dep" != Xc \ || case $host_os in linux* | gnu* | k*bsd*-gnu) false ;; *) true ;; esac; then names_next_round="$names_next_round $dep" fi ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" ;; esac done fi else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" done fi ICONV_CONST=; REPLACE_ICONV=0; REPLACE_ICONV_OPEN=0; REPLACE_ICONV_UTF=0; ICONV_H=''; if false; then ICONV_H='iconv.h' fi if test -n "$ICONV_H"; then GL_GENERATE_ICONV_H_TRUE= GL_GENERATE_ICONV_H_FALSE='#' else GL_GENERATE_ICONV_H_TRUE='#' GL_GENERATE_ICONV_H_FALSE= fi am_save_CPPFLAGS="$CPPFLAGS" for element in $INCICONV; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 printf %s "checking for iconv... " >&6; } if test ${am_cv_func_iconv+y} then : printf %s "(cached) " >&6 else $as_nop am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <iconv.h> int main (void) { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <iconv.h> int main (void) { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 printf "%s\n" "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 printf %s "checking for working iconv... " >&6; } if test ${am_cv_func_iconv_works+y} then : printf %s "(cached) " >&6 else $as_nop am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi am_cv_func_iconv_works=no for ac_iconv_const in '' 'const'; do if test "$cross_compiling" = yes then : case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <iconv.h> #include <string.h> #ifndef ICONV_CONST # define ICONV_CONST $ac_iconv_const #endif int main (void) { int result = 0; /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from successful returns. This is even documented in <https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv.html> */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\263"; char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 2; iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ { iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 4; iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 8; iconv_close (cd_88591_to_utf8); } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ { /* Try standardized names. */ iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); /* Try IRIX, OSF/1 names. */ iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); /* Try AIX names. */ iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); /* Try HP-UX names. */ iconv_t cd4 = iconv_open ("utf8", "eucJP"); if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) result |= 16; if (cd1 != (iconv_t)(-1)) iconv_close (cd1); if (cd2 != (iconv_t)(-1)) iconv_close (cd2); if (cd3 != (iconv_t)(-1)) iconv_close (cd3); if (cd4 != (iconv_t)(-1)) iconv_close (cd4); } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : am_cv_func_iconv_works=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi test "$am_cv_func_iconv_works" = no || break done LIBS="$am_save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 printf "%s\n" "$am_cv_func_iconv_works" >&6; } case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 printf %s "checking how to link with libiconv... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 printf "%s\n" "$LIBICONV" >&6; } else CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi if test "$am_cv_func_iconv" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether iconv is compatible with its POSIX signature" >&5 printf %s "checking whether iconv is compatible with its POSIX signature... " >&6; } if test ${gl_cv_iconv_nonconst+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <iconv.h> extern #ifdef __cplusplus "C" #endif size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_iconv_nonconst=yes else $as_nop gl_cv_iconv_nonconst=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_iconv_nonconst" >&5 printf "%s\n" "$gl_cv_iconv_nonconst" >&6; } else gl_cv_iconv_nonconst=yes fi if test $gl_cv_iconv_nonconst = yes; then iconv_arg1="" else iconv_arg1="const" fi printf "%s\n" "#define ICONV_CONST $iconv_arg1" >>confdefs.h if test $gl_cv_iconv_nonconst != yes; then ICONV_CONST="const" fi GL_GNULIB_ICONV=0 if test $gl_cv_have_include_next = yes; then gl_cv_next_iconv_h='<'iconv.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <iconv.h>" >&5 printf %s "checking absolute name of <iconv.h>... " >&6; } if test ${gl_cv_next_iconv_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_iconv_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <iconv.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'iconv.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_iconv_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_iconv_h gl_cv_next_iconv_h='"'$gl_header'"' else gl_cv_next_iconv_h='<'iconv.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_iconv_h" >&5 printf "%s\n" "$gl_cv_next_iconv_h" >&6; } fi NEXT_ICONV_H=$gl_cv_next_iconv_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'iconv.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_iconv_h fi NEXT_AS_FIRST_DIRECTIVE_ICONV_H=$gl_next_as_first_directive if test $gl_cv_have_include_next = yes; then gl_cv_next_limits_h='<'limits.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <limits.h>" >&5 printf %s "checking absolute name of <limits.h>... " >&6; } if test ${gl_cv_next_limits_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_limits_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'limits.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_limits_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_limits_h gl_cv_next_limits_h='"'$gl_header'"' else gl_cv_next_limits_h='<'limits.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_limits_h" >&5 printf "%s\n" "$gl_cv_next_limits_h" >&6; } fi NEXT_LIMITS_H=$gl_cv_next_limits_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'limits.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_limits_h fi NEXT_AS_FIRST_DIRECTIVE_LIMITS_H=$gl_next_as_first_directive { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether limits.h has WORD_BIT, BOOL_WIDTH etc." >&5 printf %s "checking whether limits.h has WORD_BIT, BOOL_WIDTH etc.... " >&6; } if test ${gl_cv_header_limits_width+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 #endif #include <limits.h> long long llm = LLONG_MAX; int wb = WORD_BIT; int ullw = ULLONG_WIDTH; int bw = BOOL_WIDTH; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_limits_width=yes else $as_nop gl_cv_header_limits_width=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_limits_width" >&5 printf "%s\n" "$gl_cv_header_limits_width" >&6; } if test "$gl_cv_header_limits_width" = yes; then LIMITS_H= else LIMITS_H=limits.h fi if test -n "$LIMITS_H"; then GL_GENERATE_LIMITS_H_TRUE= GL_GENERATE_LIMITS_H_FALSE='#' else GL_GENERATE_LIMITS_H_TRUE='#' GL_GENERATE_LIMITS_H_FALSE= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wint_t" >&5 printf %s "checking for wint_t... " >&6; } if test ${gt_cv_c_wint_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> wint_t foo = (wchar_t)'\0'; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gt_cv_c_wint_t=yes else $as_nop gt_cv_c_wint_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wint_t" >&5 printf "%s\n" "$gt_cv_c_wint_t" >&6; } if test $gt_cv_c_wint_t = yes; then printf "%s\n" "#define HAVE_WINT_T 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether wint_t is large enough" >&5 printf %s "checking whether wint_t is large enough... " >&6; } if test ${gl_cv_type_wint_t_large_enough+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_type_wint_t_large_enough=yes else $as_nop gl_cv_type_wint_t_large_enough=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wint_t_large_enough" >&5 printf "%s\n" "$gl_cv_type_wint_t_large_enough" >&6; } if test $gl_cv_type_wint_t_large_enough = no; then GNULIBHEADERS_OVERRIDE_WINT_T=1 else GNULIBHEADERS_OVERRIDE_WINT_T=0 fi else GNULIBHEADERS_OVERRIDE_WINT_T=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler produces multi-arch binaries" >&5 printf %s "checking whether the compiler produces multi-arch binaries... " >&6; } if test ${gl_cv_c_multiarch+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_c_multiarch=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO" then : arch= prev= for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do if test -n "$prev"; then case $word in i?86 | x86_64 | ppc | ppc64 | arm | arm64) if test -z "$arch" || test "$arch" = "$word"; then arch="$word" else gl_cv_c_multiarch=yes fi ;; esac prev= else if test "x$word" = "x-arch"; then prev=arch fi fi done fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_multiarch" >&5 printf "%s\n" "$gl_cv_c_multiarch" >&6; } if test $gl_cv_c_multiarch = yes; then APPLE_UNIVERSAL_BUILD=1 else APPLE_UNIVERSAL_BUILD=0 fi printf "%s\n" "#define HAVE_LONG_LONG_INT 1" >>confdefs.h printf "%s\n" "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h if test $ac_cv_header_wchar_h = yes; then HAVE_WCHAR_H=1 else HAVE_WCHAR_H=0 fi if test $ac_cv_header_inttypes_h = yes; then HAVE_INTTYPES_H=1 else HAVE_INTTYPES_H=0 fi if test $ac_cv_header_sys_types_h = yes; then HAVE_SYS_TYPES_H=1 else HAVE_SYS_TYPES_H=0 fi if test $gl_cv_have_include_next = yes; then gl_cv_next_stdint_h='<'stdint.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <stdint.h>" >&5 printf %s "checking absolute name of <stdint.h>... " >&6; } if test ${gl_cv_next_stdint_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_stdint_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdint.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'stdint.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_stdint_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_stdint_h gl_cv_next_stdint_h='"'$gl_header'"' else gl_cv_next_stdint_h='<'stdint.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdint_h" >&5 printf "%s\n" "$gl_cv_next_stdint_h" >&6; } fi NEXT_STDINT_H=$gl_cv_next_stdint_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'stdint.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_stdint_h fi NEXT_AS_FIRST_DIRECTIVE_STDINT_H=$gl_next_as_first_directive if test $ac_cv_header_stdint_h = yes; then HAVE_STDINT_H=1 else HAVE_STDINT_H=0 fi if test $ac_cv_header_stdint_h = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stdint.h conforms to C99" >&5 printf %s "checking whether stdint.h conforms to C99... " >&6; } if test ${gl_cv_header_working_stdint_h+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_header_working_stdint_h=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ #define __STDC_CONSTANT_MACROS 1 #define __STDC_LIMIT_MACROS 1 #include <stdint.h> /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ #if !(defined WCHAR_MIN && defined WCHAR_MAX) #error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>" #endif #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H # include <wchar.h> #endif #ifdef INT8_MAX int8_t a1 = INT8_MAX; int8_t a1min = INT8_MIN; #endif #ifdef INT16_MAX int16_t a2 = INT16_MAX; int16_t a2min = INT16_MIN; #endif #ifdef INT32_MAX int32_t a3 = INT32_MAX; int32_t a3min = INT32_MIN; #endif #ifdef INT64_MAX int64_t a4 = INT64_MAX; int64_t a4min = INT64_MIN; #endif #ifdef UINT8_MAX uint8_t b1 = UINT8_MAX; #else typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; #endif #ifdef UINT16_MAX uint16_t b2 = UINT16_MAX; #endif #ifdef UINT32_MAX uint32_t b3 = UINT32_MAX; #endif #ifdef UINT64_MAX uint64_t b4 = UINT64_MAX; #endif int_least8_t c1 = INT8_C (0x7f); int_least8_t c1max = INT_LEAST8_MAX; int_least8_t c1min = INT_LEAST8_MIN; int_least16_t c2 = INT16_C (0x7fff); int_least16_t c2max = INT_LEAST16_MAX; int_least16_t c2min = INT_LEAST16_MIN; int_least32_t c3 = INT32_C (0x7fffffff); int_least32_t c3max = INT_LEAST32_MAX; int_least32_t c3min = INT_LEAST32_MIN; int_least64_t c4 = INT64_C (0x7fffffffffffffff); int_least64_t c4max = INT_LEAST64_MAX; int_least64_t c4min = INT_LEAST64_MIN; uint_least8_t d1 = UINT8_C (0xff); uint_least8_t d1max = UINT_LEAST8_MAX; uint_least16_t d2 = UINT16_C (0xffff); uint_least16_t d2max = UINT_LEAST16_MAX; uint_least32_t d3 = UINT32_C (0xffffffff); uint_least32_t d3max = UINT_LEAST32_MAX; uint_least64_t d4 = UINT64_C (0xffffffffffffffff); uint_least64_t d4max = UINT_LEAST64_MAX; int_fast8_t e1 = INT_FAST8_MAX; int_fast8_t e1min = INT_FAST8_MIN; int_fast16_t e2 = INT_FAST16_MAX; int_fast16_t e2min = INT_FAST16_MIN; int_fast32_t e3 = INT_FAST32_MAX; int_fast32_t e3min = INT_FAST32_MIN; int_fast64_t e4 = INT_FAST64_MAX; int_fast64_t e4min = INT_FAST64_MIN; uint_fast8_t f1 = UINT_FAST8_MAX; uint_fast16_t f2 = UINT_FAST16_MAX; uint_fast32_t f3 = UINT_FAST32_MAX; uint_fast64_t f4 = UINT_FAST64_MAX; #ifdef INTPTR_MAX intptr_t g = INTPTR_MAX; intptr_t gmin = INTPTR_MIN; #endif #ifdef UINTPTR_MAX uintptr_t h = UINTPTR_MAX; #endif intmax_t i = INTMAX_MAX; uintmax_t j = UINTMAX_MAX; /* Check that SIZE_MAX has the correct type, if possible. */ #if 201112 <= __STDC_VERSION__ int k = _Generic (SIZE_MAX, size_t: 0); #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ || (0x5110 <= __SUNPRO_C && !__STDC__)) extern size_t k; extern __typeof__ (SIZE_MAX) k; #endif #include <limits.h> /* for CHAR_BIT */ #define TYPE_MINIMUM(t) \ ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) #define TYPE_MAXIMUM(t) \ ((t) ((t) 0 < (t) -1 \ ? (t) -1 \ : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) struct s { int check_PTRDIFF: PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) ? 1 : -1; /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */ int check_SIG_ATOMIC: SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) ? 1 : -1; int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; int check_WCHAR: WCHAR_MIN == TYPE_MINIMUM (wchar_t) && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) ? 1 : -1; /* Detect bug in mingw. */ int check_WINT: WINT_MIN == TYPE_MINIMUM (wint_t) && WINT_MAX == TYPE_MAXIMUM (wint_t) ? 1 : -1; /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ int check_UINT8_C: (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; int check_UINT16_C: (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; /* Detect bugs in OpenBSD 3.9 stdint.h. */ #ifdef UINT8_MAX int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; #endif #ifdef UINT16_MAX int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; #endif #ifdef UINT32_MAX int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; #endif #ifdef UINT64_MAX int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; #endif int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; }; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on native Windows. mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; # In general, assume it works. *) gl_cv_header_working_stdint_h="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ #define __STDC_CONSTANT_MACROS 1 #define __STDC_LIMIT_MACROS 1 #include <stdint.h> #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H # include <wchar.h> #endif #include <stdio.h> #include <string.h> #define MVAL(macro) MVAL1(macro) #define MVAL1(expression) #expression static const char *macro_values[] = { #ifdef INT8_MAX MVAL (INT8_MAX), #endif #ifdef INT16_MAX MVAL (INT16_MAX), #endif #ifdef INT32_MAX MVAL (INT32_MAX), #endif #ifdef INT64_MAX MVAL (INT64_MAX), #endif #ifdef UINT8_MAX MVAL (UINT8_MAX), #endif #ifdef UINT16_MAX MVAL (UINT16_MAX), #endif #ifdef UINT32_MAX MVAL (UINT32_MAX), #endif #ifdef UINT64_MAX MVAL (UINT64_MAX), #endif NULL }; int main (void) { const char **mv; for (mv = macro_values; *mv != NULL; mv++) { const char *value = *mv; /* Test whether it looks like a cast expression. */ if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 || strncmp (value, "((int)"/*)*/, 6) == 0 || strncmp (value, "((signed short)"/*)*/, 15) == 0 || strncmp (value, "((signed char)"/*)*/, 14) == 0) return mv - macro_values + 1; } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_header_working_stdint_h=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdint_h" >&5 printf "%s\n" "$gl_cv_header_working_stdint_h" >&6; } fi HAVE_C99_STDINT_H=0 HAVE_SYS_BITYPES_H=0 HAVE_SYS_INTTYPES_H=0 STDINT_H=stdint.h case "$gl_cv_header_working_stdint_h" in *yes) HAVE_C99_STDINT_H=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stdint.h works without ISO C predefines" >&5 printf %s "checking whether stdint.h works without ISO C predefines... " >&6; } if test ${gl_cv_header_stdint_without_STDC_macros+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_header_stdint_without_STDC_macros=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ #include <stdint.h> #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H # include <wchar.h> #endif intmax_t im = INTMAX_MAX; int32_t i32 = INT32_C (0x7fffffff); int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_stdint_without_STDC_macros=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_without_STDC_macros" >&5 printf "%s\n" "$gl_cv_header_stdint_without_STDC_macros" >&6; } if test $gl_cv_header_stdint_without_STDC_macros = no; then printf "%s\n" "#define __STDC_CONSTANT_MACROS 1" >>confdefs.h printf "%s\n" "#define __STDC_LIMIT_MACROS 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stdint.h has UINTMAX_WIDTH etc." >&5 printf %s "checking whether stdint.h has UINTMAX_WIDTH etc.... " >&6; } if test ${gl_cv_header_stdint_width+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_header_stdint_width=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Work if build is not clean. */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 #endif #include <stdint.h> #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H # include <wchar.h> #endif int iw = UINTMAX_WIDTH; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_stdint_width=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_width" >&5 printf "%s\n" "$gl_cv_header_stdint_width" >&6; } if test "$gl_cv_header_stdint_width" = yes; then STDINT_H= fi ;; *) ac_fn_c_check_header_compile "$LINENO" "sys/inttypes.h" "ac_cv_header_sys_inttypes_h" "$ac_includes_default" if test "x$ac_cv_header_sys_inttypes_h" = xyes then : printf "%s\n" "#define HAVE_SYS_INTTYPES_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/bitypes.h" "ac_cv_header_sys_bitypes_h" "$ac_includes_default" if test "x$ac_cv_header_sys_bitypes_h" = xyes then : printf "%s\n" "#define HAVE_SYS_BITYPES_H 1" >>confdefs.h fi if test $ac_cv_header_sys_inttypes_h = yes; then HAVE_SYS_INTTYPES_H=1 fi if test $ac_cv_header_sys_bitypes_h = yes; then HAVE_SYS_BITYPES_H=1 fi if test $APPLE_UNIVERSAL_BUILD = 0; then for gltype in ptrdiff_t size_t ; do { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 printf %s "checking for bit size of $gltype... " >&6; } if eval test \${gl_cv_bitsizeof_${gltype}+y} then : printf %s "(cached) " >&6 else $as_nop if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H # include <wchar.h> #endif #include <limits.h>" then : else $as_nop result=unknown fi eval gl_cv_bitsizeof_${gltype}=\$result fi eval ac_res=\$gl_cv_bitsizeof_${gltype} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval result=\$gl_cv_bitsizeof_${gltype} if test $result = unknown; then result=0 fi GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` printf "%s\n" "#define BITSIZEOF_${GLTYPE} $result" >>confdefs.h eval BITSIZEOF_${GLTYPE}=\$result done fi for gltype in sig_atomic_t wchar_t wint_t ; do { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 printf %s "checking for bit size of $gltype... " >&6; } if eval test \${gl_cv_bitsizeof_${gltype}+y} then : printf %s "(cached) " >&6 else $as_nop if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H # include <wchar.h> #endif #include <limits.h>" then : else $as_nop result=unknown fi eval gl_cv_bitsizeof_${gltype}=\$result fi eval ac_res=\$gl_cv_bitsizeof_${gltype} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval result=\$gl_cv_bitsizeof_${gltype} if test $result = unknown; then result=0 fi GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` printf "%s\n" "#define BITSIZEOF_${GLTYPE} $result" >>confdefs.h eval BITSIZEOF_${GLTYPE}=\$result done for gltype in sig_atomic_t wchar_t wint_t ; do { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $gltype is signed" >&5 printf %s "checking whether $gltype is signed... " >&6; } if eval test \${gl_cv_type_${gltype}_signed+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H # include <wchar.h> #endif int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : result=yes else $as_nop result=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval gl_cv_type_${gltype}_signed=\$result fi eval ac_res=\$gl_cv_type_${gltype}_signed { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval result=\$gl_cv_type_${gltype}_signed GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` if test "$result" = yes; then printf "%s\n" "#define HAVE_SIGNED_${GLTYPE} 1" >>confdefs.h eval HAVE_SIGNED_${GLTYPE}=1 else eval HAVE_SIGNED_${GLTYPE}=0 fi done gl_cv_type_ptrdiff_t_signed=yes gl_cv_type_size_t_signed=no if test $APPLE_UNIVERSAL_BUILD = 0; then for gltype in ptrdiff_t size_t ; do { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 printf %s "checking for $gltype integer literal suffix... " >&6; } if eval test \${gl_cv_type_${gltype}_suffix+y} then : printf %s "(cached) " >&6 else $as_nop eval gl_cv_type_${gltype}_suffix=no eval result=\$gl_cv_type_${gltype}_signed if test "$result" = yes; then glsufu= else glsufu=u fi for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do case $glsuf in '') gltype1='int';; l) gltype1='long int';; ll) gltype1='long long int';; i64) gltype1='__int64';; u) gltype1='unsigned int';; ul) gltype1='unsigned long int';; ull) gltype1='unsigned long long int';; ui64)gltype1='unsigned __int64';; esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H # include <wchar.h> #endif extern $gltype foo; extern $gltype1 foo; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval gl_cv_type_${gltype}_suffix=\$glsuf fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval result=\$gl_cv_type_${gltype}_suffix test "$result" != no && break done fi eval ac_res=\$gl_cv_type_${gltype}_suffix { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` eval result=\$gl_cv_type_${gltype}_suffix test "$result" = no && result= eval ${GLTYPE}_SUFFIX=\$result printf "%s\n" "#define ${GLTYPE}_SUFFIX $result" >>confdefs.h done fi for gltype in sig_atomic_t wchar_t wint_t ; do { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 printf %s "checking for $gltype integer literal suffix... " >&6; } if eval test \${gl_cv_type_${gltype}_suffix+y} then : printf %s "(cached) " >&6 else $as_nop eval gl_cv_type_${gltype}_suffix=no eval result=\$gl_cv_type_${gltype}_signed if test "$result" = yes; then glsufu= else glsufu=u fi for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do case $glsuf in '') gltype1='int';; l) gltype1='long int';; ll) gltype1='long long int';; i64) gltype1='__int64';; u) gltype1='unsigned int';; ul) gltype1='unsigned long int';; ull) gltype1='unsigned long long int';; ui64)gltype1='unsigned __int64';; esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H # include <wchar.h> #endif extern $gltype foo; extern $gltype1 foo; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval gl_cv_type_${gltype}_suffix=\$glsuf fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval result=\$gl_cv_type_${gltype}_suffix test "$result" != no && break done fi eval ac_res=\$gl_cv_type_${gltype}_suffix { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` eval result=\$gl_cv_type_${gltype}_suffix test "$result" = no && result= eval ${GLTYPE}_SUFFIX=\$result printf "%s\n" "#define ${GLTYPE}_SUFFIX $result" >>confdefs.h done if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then BITSIZEOF_WINT_T=32 fi ;; esac LIMITS_H='limits.h' if test -n "$LIMITS_H"; then GL_GENERATE_LIMITS_H_TRUE= GL_GENERATE_LIMITS_H_FALSE='#' else GL_GENERATE_LIMITS_H_TRUE='#' GL_GENERATE_LIMITS_H_FALSE= fi if test -n "$STDINT_H"; then GL_GENERATE_STDINT_H_TRUE= GL_GENERATE_STDINT_H_FALSE='#' else GL_GENERATE_STDINT_H_TRUE='#' GL_GENERATE_STDINT_H_FALSE= fi HAVE_DECL_IMAXABS=1; HAVE_DECL_IMAXDIV=1; HAVE_DECL_STRTOIMAX=1; HAVE_DECL_STRTOUMAX=1; HAVE_IMAXDIV_T=1; REPLACE_STRTOIMAX=0; REPLACE_STRTOUMAX=0; INT32_MAX_LT_INTMAX_MAX=1; INT64_MAX_EQ_LONG_MAX='defined _LP64'; PRIPTR_PREFIX=__PRIPTR_PREFIX; UINT32_MAX_LT_UINTMAX_MAX=1; UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; if test $gl_cv_have_include_next = yes; then gl_cv_next_inttypes_h='<'inttypes.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <inttypes.h>" >&5 printf %s "checking absolute name of <inttypes.h>... " >&6; } if test ${gl_cv_next_inttypes_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_inttypes_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <inttypes.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'inttypes.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_inttypes_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_inttypes_h gl_cv_next_inttypes_h='"'$gl_header'"' else gl_cv_next_inttypes_h='<'inttypes.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_inttypes_h" >&5 printf "%s\n" "$gl_cv_next_inttypes_h" >&6; } fi NEXT_INTTYPES_H=$gl_cv_next_inttypes_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'inttypes.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_inttypes_h fi NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H=$gl_next_as_first_directive PRIPTR_PREFIX= if test -n "$STDINT_H"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _WIN64 LLP64 #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : PRIPTR_PREFIX='"l"' else $as_nop PRIPTR_PREFIX='"ll"' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else for glpfx in '' l ll I64; do case $glpfx in '') gltype1='int';; l) gltype1='long int';; ll) gltype1='long long int';; I64) gltype1='__int64';; esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdint.h> extern intptr_t foo; extern $gltype1 foo; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : PRIPTR_PREFIX='"'$glpfx'"' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test -n "$PRIPTR_PREFIX" && break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether INT32_MAX < INTMAX_MAX" >&5 printf %s "checking whether INT32_MAX < INTMAX_MAX... " >&6; } if test ${gl_cv_test_INT32_MAX_LT_INTMAX_MAX+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Work also in C++ mode. */ #define __STDC_LIMIT_MACROS 1 /* Work if build is not clean. */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H #include <limits.h> #if HAVE_STDINT_H #include <stdint.h> #endif #if defined INT32_MAX && defined INTMAX_MAX #define CONDITION (INT32_MAX < INTMAX_MAX) #else #define CONDITION (sizeof (int) < sizeof (long long int)) #endif int test[CONDITION ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_test_INT32_MAX_LT_INTMAX_MAX=yes else $as_nop gl_cv_test_INT32_MAX_LT_INTMAX_MAX=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_INT32_MAX_LT_INTMAX_MAX" >&5 printf "%s\n" "$gl_cv_test_INT32_MAX_LT_INTMAX_MAX" >&6; } if test $gl_cv_test_INT32_MAX_LT_INTMAX_MAX = yes; then INT32_MAX_LT_INTMAX_MAX=1; else INT32_MAX_LT_INTMAX_MAX=0; fi if test $APPLE_UNIVERSAL_BUILD = 0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether INT64_MAX == LONG_MAX" >&5 printf %s "checking whether INT64_MAX == LONG_MAX... " >&6; } if test ${gl_cv_test_INT64_MAX_EQ_LONG_MAX+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Work also in C++ mode. */ #define __STDC_LIMIT_MACROS 1 /* Work if build is not clean. */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H #include <limits.h> #if HAVE_STDINT_H #include <stdint.h> #endif #if defined INT64_MAX #define CONDITION (INT64_MAX == LONG_MAX) #else #define CONDITION (sizeof (long long int) == sizeof (long int)) #endif int test[CONDITION ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_test_INT64_MAX_EQ_LONG_MAX=yes else $as_nop gl_cv_test_INT64_MAX_EQ_LONG_MAX=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_INT64_MAX_EQ_LONG_MAX" >&5 printf "%s\n" "$gl_cv_test_INT64_MAX_EQ_LONG_MAX" >&6; } if test $gl_cv_test_INT64_MAX_EQ_LONG_MAX = yes; then INT64_MAX_EQ_LONG_MAX=1; else INT64_MAX_EQ_LONG_MAX=0; fi else INT64_MAX_EQ_LONG_MAX=-1 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether UINT32_MAX < UINTMAX_MAX" >&5 printf %s "checking whether UINT32_MAX < UINTMAX_MAX... " >&6; } if test ${gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Work also in C++ mode. */ #define __STDC_LIMIT_MACROS 1 /* Work if build is not clean. */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H #include <limits.h> #if HAVE_STDINT_H #include <stdint.h> #endif #if defined UINT32_MAX && defined UINTMAX_MAX #define CONDITION (UINT32_MAX < UINTMAX_MAX) #else #define CONDITION (sizeof (unsigned int) < sizeof (unsigned long long int)) #endif int test[CONDITION ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX=yes else $as_nop gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX" >&5 printf "%s\n" "$gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX" >&6; } if test $gl_cv_test_UINT32_MAX_LT_UINTMAX_MAX = yes; then UINT32_MAX_LT_UINTMAX_MAX=1; else UINT32_MAX_LT_UINTMAX_MAX=0; fi if test $APPLE_UNIVERSAL_BUILD = 0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether UINT64_MAX == ULONG_MAX" >&5 printf %s "checking whether UINT64_MAX == ULONG_MAX... " >&6; } if test ${gl_cv_test_UINT64_MAX_EQ_ULONG_MAX+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Work also in C++ mode. */ #define __STDC_LIMIT_MACROS 1 /* Work if build is not clean. */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H #include <limits.h> #if HAVE_STDINT_H #include <stdint.h> #endif #if defined UINT64_MAX #define CONDITION (UINT64_MAX == ULONG_MAX) #else #define CONDITION (sizeof (unsigned long long int) == sizeof (unsigned long int)) #endif int test[CONDITION ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_test_UINT64_MAX_EQ_ULONG_MAX=yes else $as_nop gl_cv_test_UINT64_MAX_EQ_ULONG_MAX=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_test_UINT64_MAX_EQ_ULONG_MAX" >&5 printf "%s\n" "$gl_cv_test_UINT64_MAX_EQ_ULONG_MAX" >&6; } if test $gl_cv_test_UINT64_MAX_EQ_ULONG_MAX = yes; then UINT64_MAX_EQ_ULONG_MAX=1; else UINT64_MAX_EQ_ULONG_MAX=0; fi else UINT64_MAX_EQ_ULONG_MAX=-1 fi GL_GNULIB_IMAXABS=0 GL_GNULIB_IMAXDIV=0 GL_GNULIB_STRTOIMAX=0 GL_GNULIB_STRTOUMAX=0 HAVE_ISWBLANK=1; HAVE_WCTYPE_T=1; HAVE_WCTRANS_T=1; REPLACE_ISWBLANK=0; REPLACE_ISWDIGIT=0; REPLACE_ISWXDIGIT=0; if test $ac_cv_header_crtdefs_h = yes; then HAVE_CRTDEFS_H=1 else HAVE_CRTDEFS_H=0 fi if test $ac_cv_func_iswcntrl = yes; then HAVE_ISWCNTRL=1 else HAVE_ISWCNTRL=0 fi if test $gt_cv_c_wint_t = yes; then HAVE_WINT_T=1 else HAVE_WINT_T=0 fi if test $gl_cv_have_include_next = yes; then gl_cv_next_wctype_h='<'wctype.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <wctype.h>" >&5 printf %s "checking absolute name of <wctype.h>... " >&6; } if test ${gl_cv_next_wctype_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_wctype_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wctype.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'wctype.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_wctype_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_wctype_h gl_cv_next_wctype_h='"'$gl_header'"' else gl_cv_next_wctype_h='<'wctype.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wctype_h" >&5 printf "%s\n" "$gl_cv_next_wctype_h" >&6; } fi NEXT_WCTYPE_H=$gl_cv_next_wctype_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'wctype.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_wctype_h fi NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H=$gl_next_as_first_directive if test $ac_cv_header_wctype_h = yes; then if test $ac_cv_func_iswcntrl = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether iswcntrl works" >&5 printf %s "checking whether iswcntrl works... " >&6; } if test ${gl_cv_func_iswcntrl_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #if __GNU_LIBRARY__ == 1 Linux libc5 i18n is broken. #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_iswcntrl_works="guessing yes" else $as_nop gl_cv_func_iswcntrl_works="guessing no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> #include <wctype.h> int main () { return iswprint ('x') == 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_iswcntrl_works=yes else $as_nop gl_cv_func_iswcntrl_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswcntrl_works" >&5 printf "%s\n" "$gl_cv_func_iswcntrl_works" >&6; } fi HAVE_WCTYPE_H=1 else HAVE_WCTYPE_H=0 fi if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then REPLACE_ISWCNTRL=1 else case "$gl_cv_func_iswcntrl_works" in *yes) REPLACE_ISWCNTRL=0 ;; *) REPLACE_ISWCNTRL=1 ;; esac fi if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then : fi if test $REPLACE_ISWCNTRL = 1; then REPLACE_TOWLOWER=1 else ac_fn_c_check_func "$LINENO" "towlower" "ac_cv_func_towlower" if test "x$ac_cv_func_towlower" = xyes then : printf "%s\n" "#define HAVE_TOWLOWER 1" >>confdefs.h fi if test $ac_cv_func_towlower = yes; then REPLACE_TOWLOWER=0 else ac_fn_check_decl "$LINENO" "towlower" "ac_cv_have_decl_towlower" "#include <wchar.h> #if HAVE_WCTYPE_H # include <wctype.h> #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_towlower" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_TOWLOWER $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_towlower = yes; then REPLACE_TOWLOWER=1 else REPLACE_TOWLOWER=0 fi fi fi if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wctype_t" >&5 printf %s "checking for wctype_t... " >&6; } if test ${gl_cv_type_wctype_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> #if HAVE_WCTYPE_H # include <wctype.h> #endif wctype_t a; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_type_wctype_t=yes else $as_nop gl_cv_type_wctype_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctype_t" >&5 printf "%s\n" "$gl_cv_type_wctype_t" >&6; } if test $gl_cv_type_wctype_t = no; then HAVE_WCTYPE_T=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wctrans_t" >&5 printf %s "checking for wctrans_t... " >&6; } if test ${gl_cv_type_wctrans_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> #include <wctype.h> wctrans_t a; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_type_wctrans_t=yes else $as_nop gl_cv_type_wctrans_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctrans_t" >&5 printf "%s\n" "$gl_cv_type_wctrans_t" >&6; } if test $gl_cv_type_wctrans_t = no; then HAVE_WCTRANS_T=0 fi GL_GNULIB_ISWBLANK=0 GL_GNULIB_ISWDIGIT=0 GL_GNULIB_ISWXDIGIT=0 GL_GNULIB_WCTYPE=0 GL_GNULIB_ISWCTYPE=0 GL_GNULIB_WCTRANS=0 GL_GNULIB_TOWCTRANS=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional japanese locale" >&5 printf %s "checking for a traditional japanese locale... " >&6; } if test ${gt_cv_locale_ja+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales on Cygwin 1.5.x. */ if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Note that on native Windows, the Japanese locale is # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we # cannot use it here. gt_cv_locale_ja=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the AIX locale name. if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP else # Test for the locale name with explicit encoding suffix. if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC-JP else # Test for the HP-UX, OSF/1, NetBSD locale name. if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.eucJP else # Test for the IRIX, FreeBSD locale name. if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC else # Test for the Solaris 7 locale name. if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja else # Special test for NetBSD 1.6. if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then gt_cv_locale_ja=ja_JP.eucJP else # None found. gt_cv_locale_ja=none fi fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_ja" >&5 printf "%s\n" "$gt_cv_locale_ja" >&6; } LOCALE_JA=$gt_cv_locale_ja { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 printf %s "checking for a french Unicode locale... " >&6; } if test ${gt_cv_locale_fr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 printf %s "checking for a transitional chinese locale... " >&6; } if test ${gt_cv_locale_zh_CN+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } /* Check whether a typical GB18030 multibyte sequence is recognized as a single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=Chinese_China.54936 else # None found. gt_cv_locale_zh_CN=none fi ;; solaris2.8) # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. gt_cv_locale_zh_CN=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the locale name without encoding suffix. if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN else # Test for the locale name with explicit encoding suffix. if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN.GB18030 else # None found. gt_cv_locale_zh_CN=none fi fi ;; esac else # If there was a link error, due to mblen(), the system is so old that # it certainly doesn't have a chinese locale. gt_cv_locale_zh_CN=none fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 printf "%s\n" "$gt_cv_locale_zh_CN" >&6; } LOCALE_ZH_CN=$gt_cv_locale_zh_CN HAVE_NL_LANGINFO=1; REPLACE_NL_LANGINFO=0; if test $gl_cv_have_include_next = yes; then gl_cv_next_langinfo_h='<'langinfo.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <langinfo.h>" >&5 printf %s "checking absolute name of <langinfo.h>... " >&6; } if test ${gl_cv_next_langinfo_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_langinfo_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <langinfo.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'langinfo.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_langinfo_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_langinfo_h gl_cv_next_langinfo_h='"'$gl_header'"' else gl_cv_next_langinfo_h='<'langinfo.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_langinfo_h" >&5 printf "%s\n" "$gl_cv_next_langinfo_h" >&6; } fi NEXT_LANGINFO_H=$gl_cv_next_langinfo_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'langinfo.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_langinfo_h fi NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H=$gl_next_as_first_directive HAVE_LANGINFO_CODESET=0 HAVE_LANGINFO_T_FMT_AMPM=0 HAVE_LANGINFO_ALTMON=0 HAVE_LANGINFO_ERA=0 HAVE_LANGINFO_YESEXPR=0 if test $ac_cv_header_langinfo_h = yes; then HAVE_LANGINFO_H=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether langinfo.h defines CODESET" >&5 printf %s "checking whether langinfo.h defines CODESET... " >&6; } if test ${gl_cv_header_langinfo_codeset+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <langinfo.h> int a = CODESET; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_langinfo_codeset=yes else $as_nop gl_cv_header_langinfo_codeset=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_langinfo_codeset" >&5 printf "%s\n" "$gl_cv_header_langinfo_codeset" >&6; } if test $gl_cv_header_langinfo_codeset = yes; then HAVE_LANGINFO_CODESET=1 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether langinfo.h defines T_FMT_AMPM" >&5 printf %s "checking whether langinfo.h defines T_FMT_AMPM... " >&6; } if test ${gl_cv_header_langinfo_t_fmt_ampm+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <langinfo.h> int a = T_FMT_AMPM; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_langinfo_t_fmt_ampm=yes else $as_nop gl_cv_header_langinfo_t_fmt_ampm=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_langinfo_t_fmt_ampm" >&5 printf "%s\n" "$gl_cv_header_langinfo_t_fmt_ampm" >&6; } if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then HAVE_LANGINFO_T_FMT_AMPM=1 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether langinfo.h defines ALTMON_1" >&5 printf %s "checking whether langinfo.h defines ALTMON_1... " >&6; } if test ${gl_cv_header_langinfo_altmon+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <langinfo.h> int a = ALTMON_1; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_langinfo_altmon=yes else $as_nop gl_cv_header_langinfo_altmon=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_langinfo_altmon" >&5 printf "%s\n" "$gl_cv_header_langinfo_altmon" >&6; } if test $gl_cv_header_langinfo_altmon = yes; then HAVE_LANGINFO_ALTMON=1 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether langinfo.h defines ERA" >&5 printf %s "checking whether langinfo.h defines ERA... " >&6; } if test ${gl_cv_header_langinfo_era+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <langinfo.h> int a = ERA; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_langinfo_era=yes else $as_nop gl_cv_header_langinfo_era=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_langinfo_era" >&5 printf "%s\n" "$gl_cv_header_langinfo_era" >&6; } if test $gl_cv_header_langinfo_era = yes; then HAVE_LANGINFO_ERA=1 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether langinfo.h defines YESEXPR" >&5 printf %s "checking whether langinfo.h defines YESEXPR... " >&6; } if test ${gl_cv_header_langinfo_yesexpr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <langinfo.h> int a = YESEXPR; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_langinfo_yesexpr=yes else $as_nop gl_cv_header_langinfo_yesexpr=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_langinfo_yesexpr" >&5 printf "%s\n" "$gl_cv_header_langinfo_yesexpr" >&6; } if test $gl_cv_header_langinfo_yesexpr = yes; then HAVE_LANGINFO_YESEXPR=1 fi else HAVE_LANGINFO_H=0 fi GL_GNULIB_NL_LANGINFO=0 HAVE_NEWLOCALE=1; HAVE_DUPLOCALE=1; HAVE_FREELOCALE=1; REPLACE_LOCALECONV=0; REPLACE_SETLOCALE=0; REPLACE_NEWLOCALE=0; REPLACE_DUPLOCALE=0; REPLACE_FREELOCALE=0; REPLACE_STRUCT_LCONV=0; LOCALENAME_ENHANCE_LOCALE_FUNCS=0; REPLACE_NULL=0; HAVE_MAX_ALIGN_T=1; HAVE_WCHAR_T=1; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wchar_t" >&5 printf %s "checking for wchar_t... " >&6; } if test ${gt_cv_c_wchar_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> wchar_t foo = (wchar_t)'\0'; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gt_cv_c_wchar_t=yes else $as_nop gt_cv_c_wchar_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wchar_t" >&5 printf "%s\n" "$gt_cv_c_wchar_t" >&6; } if test $gt_cv_c_wchar_t = yes; then printf "%s\n" "#define HAVE_WCHAR_T 1" >>confdefs.h fi STDDEF_H= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for good max_align_t" >&5 printf %s "checking for good max_align_t... " >&6; } if test ${gl_cv_type_max_align_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> unsigned int s = sizeof (max_align_t); #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; #endif typedef struct { char a; max_align_t b; } max_helper; typedef struct { char a; long b; } long_helper; typedef struct { char a; double b; } double_helper; typedef struct { char a; long double b; } long_double_helper; int check3[2 * (offsetof (long_helper, b) <= offsetof (max_helper, b)) - 1]; int check4[2 * (offsetof (double_helper, b) <= offsetof (max_helper, b)) - 1]; int check5[2 * (offsetof (long_double_helper, b) <= offsetof (max_helper, b)) - 1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_type_max_align_t=yes else $as_nop gl_cv_type_max_align_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_max_align_t" >&5 printf "%s\n" "$gl_cv_type_max_align_t" >&6; } if test $gl_cv_type_max_align_t = no; then HAVE_MAX_ALIGN_T=0 STDDEF_H=stddef.h fi if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether NULL can be used in arbitrary expressions" >&5 printf %s "checking whether NULL can be used in arbitrary expressions... " >&6; } if test ${gl_cv_decl_null_works+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> int test[2 * (sizeof NULL == sizeof (void *)) -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_decl_null_works=yes else $as_nop gl_cv_decl_null_works=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_null_works" >&5 printf "%s\n" "$gl_cv_decl_null_works" >&6; } if test $gl_cv_decl_null_works = no; then REPLACE_NULL=1 STDDEF_H=stddef.h fi if test -n "$STDDEF_H"; then GL_GENERATE_STDDEF_H_TRUE= GL_GENERATE_STDDEF_H_FALSE='#' else GL_GENERATE_STDDEF_H_TRUE='#' GL_GENERATE_STDDEF_H_FALSE= fi if test -n "$STDDEF_H"; then if test $gl_cv_have_include_next = yes; then gl_cv_next_stddef_h='<'stddef.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <stddef.h>" >&5 printf %s "checking absolute name of <stddef.h>... " >&6; } if test ${gl_cv_next_stddef_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'stddef.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_stddef_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_stddef_h gl_cv_next_stddef_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stddef_h" >&5 printf "%s\n" "$gl_cv_next_stddef_h" >&6; } fi NEXT_STDDEF_H=$gl_cv_next_stddef_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'stddef.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_stddef_h fi NEXT_AS_FIRST_DIRECTIVE_STDDEF_H=$gl_next_as_first_directive fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether locale.h defines locale_t" >&5 printf %s "checking whether locale.h defines locale_t... " >&6; } if test ${gl_cv_header_locale_has_locale_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> locale_t x; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_locale_has_locale_t=yes else $as_nop gl_cv_header_locale_has_locale_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_has_locale_t" >&5 printf "%s\n" "$gl_cv_header_locale_has_locale_t" >&6; } if test $ac_cv_header_xlocale_h = yes; then HAVE_XLOCALE_H=1 if test $gl_cv_header_locale_has_locale_t = yes; then gl_cv_header_locale_h_needs_xlocale_h=no else gl_cv_header_locale_h_needs_xlocale_h=yes fi HAVE_LOCALE_T=1 else HAVE_XLOCALE_H=0 gl_cv_header_locale_h_needs_xlocale_h=no if test $gl_cv_header_locale_has_locale_t = yes; then HAVE_LOCALE_T=1 else HAVE_LOCALE_T=0 fi fi case "$host_os" in solaris*) printf "%s\n" "#define _LCONV_C99 1" >>confdefs.h ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether locale.h conforms to POSIX:2001" >&5 printf %s "checking whether locale.h conforms to POSIX:2001... " >&6; } if test ${gl_cv_header_locale_h_posix2001+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> int x = LC_MESSAGES; int y = sizeof (((struct lconv *) 0)->decimal_point); int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_locale_h_posix2001=yes else $as_nop gl_cv_header_locale_h_posix2001=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_h_posix2001" >&5 printf "%s\n" "$gl_cv_header_locale_h_posix2001" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether struct lconv is properly defined" >&5 printf %s "checking whether struct lconv is properly defined... " >&6; } if test ${gl_cv_sys_struct_lconv_ok+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> struct lconv l; int x = sizeof (l.decimal_point); int y = sizeof (l.int_p_cs_precedes); int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_sys_struct_lconv_ok=yes else $as_nop gl_cv_sys_struct_lconv_ok=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_lconv_ok" >&5 printf "%s\n" "$gl_cv_sys_struct_lconv_ok" >&6; } if test $gl_cv_sys_struct_lconv_ok = no; then case "$host_os" in mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _MSC_VER Special #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Special" >/dev/null 2>&1 then : else $as_nop REPLACE_STRUCT_LCONV=1 fi rm -rf conftest* ;; *) REPLACE_STRUCT_LCONV=1 ;; esac fi if test $gl_cv_have_include_next = yes; then gl_cv_next_locale_h='<'locale.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <locale.h>" >&5 printf %s "checking absolute name of <locale.h>... " >&6; } if test ${gl_cv_next_locale_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'locale.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_locale_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_locale_h gl_cv_next_locale_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_locale_h" >&5 printf "%s\n" "$gl_cv_next_locale_h" >&6; } fi NEXT_LOCALE_H=$gl_cv_next_locale_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'locale.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_locale_h fi NEXT_AS_FIRST_DIRECTIVE_LOCALE_H=$gl_next_as_first_directive GL_GNULIB_LOCALECONV=0 GL_GNULIB_SETLOCALE=0 GL_GNULIB_SETLOCALE_NULL=0 GL_GNULIB_DUPLOCALE=0 GL_GNULIB_LOCALENAME=0 gl_threads_api=none LIBTHREAD= LTLIBTHREAD= LIBMULTITHREAD= LTLIBMULTITHREAD= if test "$gl_use_threads" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 printf %s "checking whether imported symbols can be declared weak... " >&6; } if test ${gl_cv_have_weak+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_have_weak=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern void xyzzy (); #pragma weak xyzzy int main (void) { xyzzy(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_have_weak=maybe fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test $gl_cv_have_weak = maybe; then if test "$cross_compiling" = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ELF__ Extensible Linking Format #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Extensible Linking Format" >/dev/null 2>&1 then : gl_cv_have_weak="guessing yes" else $as_nop gl_cv_have_weak="guessing no" fi rm -rf conftest* else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #pragma weak fputs int main () { return (fputs == NULL); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_have_weak=yes else $as_nop gl_cv_have_weak=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi case " $LDFLAGS " in *" -static "*) gl_cv_have_weak=no ;; esac case "$gl_cv_have_weak" in *yes) case "$host_os" in freebsd* | dragonfly* | midnightbsd*) : > conftest1.c $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 cat <<EOF > conftest2.c #include <pthread.h> #pragma weak pthread_mutexattr_gettype int main () { return (pthread_mutexattr_gettype != NULL); } EOF $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ || gl_cv_have_weak=no rm -f conftest1.c libempty.so conftest2.c conftest ;; esac ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 printf "%s\n" "$gl_cv_have_weak" >&6; } case "$gl_cv_have_weak" in *yes) printf "%s\n" "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h ;; esac if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then : fi if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then gl_have_isoc_threads="$ac_cv_header_threads_h" fi if test "$gl_use_threads" = yes \ || test "$gl_use_threads" = posix \ || test "$gl_use_threads" = isoc+posix; then if test -z "$gl_pthreadlib_body_done"; then gl_pthread_api=no LIBPTHREAD= LIBPMULTITHREAD= # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY. ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes then : gl_have_pthread_h=yes else $as_nop gl_have_pthread_h=no fi if test "$gl_have_pthread_h" = yes; then # Other possible tests: # -lpthreads (FSU threads, PCthreads) # -lgthreads # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist # in libc. IRIX 6.5 has the first one in both libc and libpthread, but # the second one only in libpthread, and lock.c needs it. # # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 # needs -pthread for some reason. See: # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html save_LIBS=$LIBS for gl_pthread in '' '-pthread'; do LIBS="$LIBS $gl_pthread" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> pthread_mutex_t m; pthread_mutexattr_t ma; int main (void) { pthread_mutex_lock (&m); pthread_mutexattr_init (&ma); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_pthread_api=yes LIBPTHREAD=$gl_pthread LIBPMULTITHREAD=$gl_pthread fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$save_LIBS test $gl_pthread_api = yes && break done echo "$as_me:18770: gl_pthread_api=$gl_pthread_api" >&5 echo "$as_me:18771: LIBPTHREAD=$LIBPTHREAD" >&5 gl_pthread_in_glibc=no # On Linux with glibc >= 2.34, libc contains the fully functional # pthread functions. case "$host_os" in linux*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <features.h> #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2) Lucky user #endif #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1 then : gl_pthread_in_glibc=yes fi rm -rf conftest* ;; esac echo "$as_me:18797: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5 # Test for libpthread by looking for pthread_kill. (Not pthread_self, # since it is defined as a macro on OSF/1.) if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then # The program links fine without libpthread. But it may actually # need to link with libpthread in order to create multiple threads. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 printf %s "checking for pthread_kill in -lpthread... " >&6; } if test ${ac_cv_lib_pthread_pthread_kill+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_kill (); int main (void) { return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_pthread_pthread_kill=yes else $as_nop ac_cv_lib_pthread_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } if test "x$ac_cv_lib_pthread_pthread_kill" = xyes then : if test $gl_pthread_in_glibc = yes; then LIBPMULTITHREAD= else LIBPMULTITHREAD=-lpthread # On Solaris and HP-UX, most pthread functions exist also in libc. # Therefore pthread_in_use() needs to actually try to create a # thread: pthread_create from libc will fail, whereas # pthread_create will actually create a thread. # On Solaris 10 or newer, this test is no longer needed, because # libc contains the fully functional pthread functions. case "$host_os" in solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h esac fi fi elif test $gl_pthread_api != yes; then # Some library is needed. Try libpthread and libc_r. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 printf %s "checking for pthread_kill in -lpthread... " >&6; } if test ${ac_cv_lib_pthread_pthread_kill+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_kill (); int main (void) { return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_pthread_pthread_kill=yes else $as_nop ac_cv_lib_pthread_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } if test "x$ac_cv_lib_pthread_pthread_kill" = xyes then : gl_pthread_api=yes LIBPTHREAD=-lpthread LIBPMULTITHREAD=-lpthread fi if test $gl_pthread_api != yes; then # For FreeBSD 4. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 printf %s "checking for pthread_kill in -lc_r... " >&6; } if test ${ac_cv_lib_c_r_pthread_kill+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_kill (); int main (void) { return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_c_r_pthread_kill=yes else $as_nop ac_cv_lib_c_r_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 printf "%s\n" "$ac_cv_lib_c_r_pthread_kill" >&6; } if test "x$ac_cv_lib_c_r_pthread_kill" = xyes then : gl_pthread_api=yes LIBPTHREAD=-lc_r LIBPMULTITHREAD=-lc_r fi fi fi echo "$as_me:18951: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 printf %s "checking whether POSIX threads API is available... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 printf "%s\n" "$gl_pthread_api" >&6; } if test $gl_pthread_api = yes; then printf "%s\n" "#define HAVE_PTHREAD_API 1" >>confdefs.h fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sched.h> int main (void) { sched_yield (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : LIB_SCHED_YIELD= else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 printf %s "checking for sched_yield in -lrt... " >&6; } if test ${ac_cv_lib_rt_sched_yield+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char sched_yield (); int main (void) { return sched_yield (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_rt_sched_yield=yes else $as_nop ac_cv_lib_rt_sched_yield=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 printf "%s\n" "$ac_cv_lib_rt_sched_yield" >&6; } if test "x$ac_cv_lib_rt_sched_yield" = xyes then : LIB_SCHED_YIELD=-lrt else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 printf %s "checking for sched_yield in -lposix4... " >&6; } if test ${ac_cv_lib_posix4_sched_yield+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lposix4 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char sched_yield (); int main (void) { return sched_yield (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_posix4_sched_yield=yes else $as_nop ac_cv_lib_posix4_sched_yield=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 printf "%s\n" "$ac_cv_lib_posix4_sched_yield" >&6; } if test "x$ac_cv_lib_posix4_sched_yield" = xyes then : LIB_SCHED_YIELD=-lposix4 fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext gl_pthreadlib_body_done=done fi LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD if test $gl_pthread_api = yes; then if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then gl_threads_api='isoc+posix' printf "%s\n" "#define USE_ISOC_AND_POSIX_THREADS 1" >>confdefs.h LIBTHREAD= LTLIBTHREAD= else gl_threads_api=posix printf "%s\n" "#define USE_POSIX_THREADS 1" >>confdefs.h if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then printf "%s\n" "#define USE_POSIX_THREADS_FROM_LIBC 1" >>confdefs.h else if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then printf "%s\n" "#define USE_POSIX_THREADS_WEAK 1" >>confdefs.h LIBTHREAD= LTLIBTHREAD= else case "$host_os" in freebsd* | dragonfly* | midnightbsd*) if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h fi ;; esac fi fi fi fi fi if test $gl_threads_api = none; then if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then if test -z "$gl_stdthreadlib_body_done"; then case "$host_os" in mingw*) LIBSTDTHREAD= ;; *) if test -z "$gl_pthreadlib_body_done"; then gl_pthread_api=no LIBPTHREAD= LIBPMULTITHREAD= # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY. ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes then : gl_have_pthread_h=yes else $as_nop gl_have_pthread_h=no fi if test "$gl_have_pthread_h" = yes; then # Other possible tests: # -lpthreads (FSU threads, PCthreads) # -lgthreads # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist # in libc. IRIX 6.5 has the first one in both libc and libpthread, but # the second one only in libpthread, and lock.c needs it. # # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 # needs -pthread for some reason. See: # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html save_LIBS=$LIBS for gl_pthread in '' '-pthread'; do LIBS="$LIBS $gl_pthread" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> pthread_mutex_t m; pthread_mutexattr_t ma; int main (void) { pthread_mutex_lock (&m); pthread_mutexattr_init (&ma); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_pthread_api=yes LIBPTHREAD=$gl_pthread LIBPMULTITHREAD=$gl_pthread fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$save_LIBS test $gl_pthread_api = yes && break done echo "$as_me:19179: gl_pthread_api=$gl_pthread_api" >&5 echo "$as_me:19180: LIBPTHREAD=$LIBPTHREAD" >&5 gl_pthread_in_glibc=no # On Linux with glibc >= 2.34, libc contains the fully functional # pthread functions. case "$host_os" in linux*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <features.h> #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2) Lucky user #endif #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1 then : gl_pthread_in_glibc=yes fi rm -rf conftest* ;; esac echo "$as_me:19206: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5 # Test for libpthread by looking for pthread_kill. (Not pthread_self, # since it is defined as a macro on OSF/1.) if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then # The program links fine without libpthread. But it may actually # need to link with libpthread in order to create multiple threads. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 printf %s "checking for pthread_kill in -lpthread... " >&6; } if test ${ac_cv_lib_pthread_pthread_kill+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_kill (); int main (void) { return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_pthread_pthread_kill=yes else $as_nop ac_cv_lib_pthread_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } if test "x$ac_cv_lib_pthread_pthread_kill" = xyes then : if test $gl_pthread_in_glibc = yes; then LIBPMULTITHREAD= else LIBPMULTITHREAD=-lpthread # On Solaris and HP-UX, most pthread functions exist also in libc. # Therefore pthread_in_use() needs to actually try to create a # thread: pthread_create from libc will fail, whereas # pthread_create will actually create a thread. # On Solaris 10 or newer, this test is no longer needed, because # libc contains the fully functional pthread functions. case "$host_os" in solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h esac fi fi elif test $gl_pthread_api != yes; then # Some library is needed. Try libpthread and libc_r. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 printf %s "checking for pthread_kill in -lpthread... " >&6; } if test ${ac_cv_lib_pthread_pthread_kill+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_kill (); int main (void) { return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_pthread_pthread_kill=yes else $as_nop ac_cv_lib_pthread_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } if test "x$ac_cv_lib_pthread_pthread_kill" = xyes then : gl_pthread_api=yes LIBPTHREAD=-lpthread LIBPMULTITHREAD=-lpthread fi if test $gl_pthread_api != yes; then # For FreeBSD 4. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 printf %s "checking for pthread_kill in -lc_r... " >&6; } if test ${ac_cv_lib_c_r_pthread_kill+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_kill (); int main (void) { return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_c_r_pthread_kill=yes else $as_nop ac_cv_lib_c_r_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 printf "%s\n" "$ac_cv_lib_c_r_pthread_kill" >&6; } if test "x$ac_cv_lib_c_r_pthread_kill" = xyes then : gl_pthread_api=yes LIBPTHREAD=-lc_r LIBPMULTITHREAD=-lc_r fi fi fi echo "$as_me:19360: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 printf %s "checking whether POSIX threads API is available... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 printf "%s\n" "$gl_pthread_api" >&6; } if test $gl_pthread_api = yes; then printf "%s\n" "#define HAVE_PTHREAD_API 1" >>confdefs.h fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sched.h> int main (void) { sched_yield (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : LIB_SCHED_YIELD= else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 printf %s "checking for sched_yield in -lrt... " >&6; } if test ${ac_cv_lib_rt_sched_yield+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char sched_yield (); int main (void) { return sched_yield (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_rt_sched_yield=yes else $as_nop ac_cv_lib_rt_sched_yield=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 printf "%s\n" "$ac_cv_lib_rt_sched_yield" >&6; } if test "x$ac_cv_lib_rt_sched_yield" = xyes then : LIB_SCHED_YIELD=-lrt else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 printf %s "checking for sched_yield in -lposix4... " >&6; } if test ${ac_cv_lib_posix4_sched_yield+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lposix4 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char sched_yield (); int main (void) { return sched_yield (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_posix4_sched_yield=yes else $as_nop ac_cv_lib_posix4_sched_yield=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 printf "%s\n" "$ac_cv_lib_posix4_sched_yield" >&6; } if test "x$ac_cv_lib_posix4_sched_yield" = xyes then : LIB_SCHED_YIELD=-lposix4 fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext gl_pthreadlib_body_done=done fi if test $ac_cv_header_threads_h = yes; then ac_fn_c_check_func "$LINENO" "thrd_create" "ac_cv_func_thrd_create" if test "x$ac_cv_func_thrd_create" = xyes then : printf "%s\n" "#define HAVE_THRD_CREATE 1" >>confdefs.h fi if test $ac_cv_func_thrd_create = yes; then LIBSTDTHREAD= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for thrd_create in -lstdthreads" >&5 printf %s "checking for thrd_create in -lstdthreads... " >&6; } if test ${ac_cv_lib_stdthreads_thrd_create+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lstdthreads $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char thrd_create (); int main (void) { return thrd_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_stdthreads_thrd_create=yes else $as_nop ac_cv_lib_stdthreads_thrd_create=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_stdthreads_thrd_create" >&5 printf "%s\n" "$ac_cv_lib_stdthreads_thrd_create" >&6; } if test "x$ac_cv_lib_stdthreads_thrd_create" = xyes then : LIBSTDTHREAD='-lstdthreads -lpthread' else $as_nop LIBSTDTHREAD="$LIBPMULTITHREAD" fi fi else LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ISO C threads API is available" >&5 printf %s "checking whether ISO C threads API is available... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_threads_h" >&5 printf "%s\n" "$ac_cv_header_threads_h" >&6; } gl_stdthreadlib_body_done=done fi LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD gl_threads_api=isoc printf "%s\n" "#define USE_ISOC_THREADS 1" >>confdefs.h fi fi if test $gl_threads_api = none; then case "$gl_use_threads" in yes | windows | win32) # The 'win32' is for backward compatibility. if { case "$host_os" in mingw*) true;; *) false;; esac }; then gl_threads_api=windows printf "%s\n" "#define USE_WINDOWS_THREADS 1" >>confdefs.h fi ;; esac fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for multithread API to use" >&5 printf %s "checking for multithread API to use... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_threads_api" >&5 printf "%s\n" "$gl_threads_api" >&6; } case "$host_os" in mingw*) WINDOWS_STAT_INODES=1 ;; *) WINDOWS_STAT_INODES=0 ;; esac printf "%s\n" "#define _USE_STD_STAT 1" >>confdefs.h if test $gl_cv_have_include_next = yes; then gl_cv_next_sys_types_h='<'sys/types.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/types.h>" >&5 printf %s "checking absolute name of <sys/types.h>... " >&6; } if test ${gl_cv_next_sys_types_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'sys/types.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_sys_types_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_sys_types_h gl_cv_next_sys_types_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_types_h" >&5 printf "%s\n" "$gl_cv_next_sys_types_h" >&6; } fi NEXT_SYS_TYPES_H=$gl_cv_next_sys_types_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'sys/types.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_sys_types_h fi NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H=$gl_next_as_first_directive { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 printf %s "checking for a sed that does not truncate output... " >&6; } if test ${ac_cv_path_SED+y} then : printf %s "(cached) " >&6 else $as_nop ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in sed gsed do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 printf "%s\n" "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether malloc (0) returns nonnull" >&5 printf %s "checking whether malloc (0) returns nonnull... " >&6; } if test ${ac_cv_func_malloc_0_nonnull+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on platforms where we know the result. *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | gnu* | *-musl* | midnightbsd* \ | hpux* | solaris* | cygwin* | mingw* | msys* ) ac_cv_func_malloc_0_nonnull="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> int main (void) { void *p = malloc (0); int result = !p; free (p); return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_malloc_0_nonnull=yes else $as_nop ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } case $ac_cv_func_malloc_0_nonnull in #( *yes) : gl_cv_func_malloc_0_nonnull=1 ;; #( *) : gl_cv_func_malloc_0_nonnull=0 ;; esac printf "%s\n" "#define MALLOC_0_IS_NONNULL $gl_cv_func_malloc_0_nonnull" >>confdefs.h if case "$host_os" in mingw*) true ;; *) test $ac_cv_func_mbsinit = yes ;; esac \ && test $ac_cv_func_mbrtowc = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 printf %s "checking whether mbrtowc handles incomplete characters... " >&6; } if test ${gl_cv_func_mbrtowc_incomplete_state+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on AIX and OSF/1. aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; esac if test $LOCALE_JA != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_incomplete_state=yes else $as_nop gl_cv_func_mbrtowc_incomplete_state=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { const char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_incomplete_state=yes else $as_nop gl_cv_func_mbrtowc_incomplete_state=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_incomplete_state" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_incomplete_state" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works as well as mbtowc" >&5 printf %s "checking whether mbrtowc works as well as mbtowc... " >&6; } if test ${gl_cv_func_mbrtowc_sanitycheck+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on Solaris 8. solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; esac if test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main () { /* This fails on Solaris 8: mbrtowc returns 2, and sets wc to 0x00F0. mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 6, &state) != 4 && mbtowc (&wc, input + 3, 6) == 4) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_sanitycheck=yes else $as_nop gl_cv_func_mbrtowc_sanitycheck=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_sanitycheck" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_sanitycheck" >&6; } REPLACE_MBSTATE_T=0 case "$gl_cv_func_mbrtowc_incomplete_state" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac case "$gl_cv_func_mbrtowc_sanitycheck" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac else REPLACE_MBSTATE_T=1 fi if test $ac_cv_func_mbrtowc = no; then HAVE_MBRTOWC=0 ac_fn_check_decl "$LINENO" "mbrtowc" "ac_cv_have_decl_mbrtowc" " #include <wchar.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_mbrtowc" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_MBRTOWC $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_mbrtowc = yes; then REPLACE_MBRTOWC=1 fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_MBRTOWC=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles a NULL pwc argument" >&5 printf %s "checking whether mbrtowc handles a NULL pwc argument... " >&6; } if test ${gl_cv_func_mbrtowc_null_arg1+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on Solaris. solaris*) gl_cv_func_mbrtowc_null_arg1="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; esac if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main () { int result = 0; if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { char input[] = "\303\237er"; mbstate_t state; wchar_t wc; size_t ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input, 5, &state); if (ret != 2) result |= 1; if (!mbsinit (&state)) result |= 2; memset (&state, '\0', sizeof (mbstate_t)); ret = mbrtowc (NULL, input, 5, &state); if (ret != 2) /* Solaris 7 fails here: ret is -1. */ result |= 4; if (!mbsinit (&state)) result |= 8; } return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_null_arg1=yes else $as_nop gl_cv_func_mbrtowc_null_arg1=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_null_arg1" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_null_arg1" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles a NULL string argument" >&5 printf %s "checking whether mbrtowc handles a NULL string argument... " >&6; } if test ${gl_cv_func_mbrtowc_null_arg2+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on OSF/1. osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; esac if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { mbstate_t state; wchar_t wc; int ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; mbrtowc (&wc, NULL, 5, &state); /* Check that wc was not modified. */ if (wc != (wchar_t) 0xBADFACE) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_null_arg2=yes else $as_nop gl_cv_func_mbrtowc_null_arg2=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_null_arg2" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_null_arg2" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc has a correct return value" >&5 printf %s "checking whether mbrtowc has a correct return value... " >&6; } if test ${gl_cv_func_mbrtowc_retval+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on HP-UX, Solaris, native Windows. hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_retval="guessing yes" ;; esac if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ || { case "$host_os" in mingw*) true;; *) false;; esac; }; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { int result = 0; int found_some_locale = 0; /* This fails on Solaris. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 1) result |= 1; } found_some_locale = 1; } /* This fails on HP-UX 11.11. */ if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 2) result |= 2; } found_some_locale = 1; } /* This fails on native Windows. */ if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) { char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) { input[3] = '\0'; if (mbrtowc (&wc, input + 4, 4, &state) != 1) result |= 4; } found_some_locale = 1; } if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) { char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) { input[3] = '\0'; if (mbrtowc (&wc, input + 4, 4, &state) != 1) result |= 8; } found_some_locale = 1; } if (setlocale (LC_ALL, "Chinese_China.936") != NULL) { char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) { input[3] = '\0'; if (mbrtowc (&wc, input + 4, 4, &state) != 1) result |= 16; } found_some_locale = 1; } return (found_some_locale ? result : 77); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_retval=yes else $as_nop if test $? != 77; then gl_cv_func_mbrtowc_retval=no fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_retval" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_retval" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc returns 0 when parsing a NUL character" >&5 printf %s "checking whether mbrtowc returns 0 when parsing a NUL character... " >&6; } if test ${gl_cv_func_mbrtowc_nul_retval+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on Solaris 8 and 9. solaris2.[89]) gl_cv_func_mbrtowc_nul_retval="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_nul_retval="guessing yes" ;; esac if test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { /* This fails on Solaris 8 and 9. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "", 1, &state) != 0) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_nul_retval=yes else $as_nop gl_cv_func_mbrtowc_nul_retval=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_nul_retval" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_nul_retval" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc stores incomplete characters" >&5 printf %s "checking whether mbrtowc stores incomplete characters... " >&6; } if test ${gl_cv_func_mbrtowc_stores_incomplete+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess yes on native Windows. mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; esac case "$host_os" in mingw*) if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { int result = 0; if (setlocale (LC_ALL, "French_France.65001") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 1; } if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\226", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 2; } if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\245", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 4; } if (setlocale (LC_ALL, "Chinese_China.936") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\261", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 8; } return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_stores_incomplete=no else $as_nop gl_cv_func_mbrtowc_stores_incomplete=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi ;; *) if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) return 1; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_stores_incomplete=no else $as_nop gl_cv_func_mbrtowc_stores_incomplete=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_stores_incomplete" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_stores_incomplete" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works on empty input" >&5 printf %s "checking whether mbrtowc works on empty input... " >&6; } if test ${gl_cv_func_mbrtowc_empty_input+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on AIX and glibc systems. aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; esac if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> static wchar_t wc; static mbstate_t mbs; int main (void) { return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_empty_input=yes else $as_nop gl_cv_func_mbrtowc_empty_input=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_empty_input" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_empty_input" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C locale is free of encoding errors" >&5 printf %s "checking whether the C locale is free of encoding errors... " >&6; } if test ${gl_cv_func_mbrtowc_C_locale_sans_EILSEQ+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on native Windows. mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> #include <locale.h> #include <wchar.h> int main (void) { int i; char *locale = setlocale (LC_ALL, "C"); if (! locale) return 2; for (i = CHAR_MIN; i <= CHAR_MAX; i++) { char c = i; wchar_t wc; mbstate_t mbs = { 0, }; size_t ss = mbrtowc (&wc, &c, 1, &mbs); if (1 < ss) return 3; } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes else $as_nop gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" >&6; } case "$gl_cv_func_mbrtowc_null_arg1" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_NULL_ARG1_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_null_arg2" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_NULL_ARG2_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_retval" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_RETVAL_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_nul_retval" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_NUL_RETVAL_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_stores_incomplete" in *no) ;; *) printf "%s\n" "#define MBRTOWC_STORES_INCOMPLETE_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_empty_input" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_EMPTY_INPUT_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac fi fi if test $REPLACE_MBSTATE_T = 1; then case "$host_os" in mingw*) LIB_MBRTOWC= ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 printf %s "checking whether imported symbols can be declared weak... " >&6; } if test ${gl_cv_have_weak+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_have_weak=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern void xyzzy (); #pragma weak xyzzy int main (void) { xyzzy(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_have_weak=maybe fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test $gl_cv_have_weak = maybe; then if test "$cross_compiling" = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ELF__ Extensible Linking Format #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Extensible Linking Format" >/dev/null 2>&1 then : gl_cv_have_weak="guessing yes" else $as_nop gl_cv_have_weak="guessing no" fi rm -rf conftest* else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #pragma weak fputs int main () { return (fputs == NULL); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_have_weak=yes else $as_nop gl_cv_have_weak=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi case " $LDFLAGS " in *" -static "*) gl_cv_have_weak=no ;; esac case "$gl_cv_have_weak" in *yes) case "$host_os" in freebsd* | dragonfly* | midnightbsd*) : > conftest1.c $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 cat <<EOF > conftest2.c #include <pthread.h> #pragma weak pthread_mutexattr_gettype int main () { return (pthread_mutexattr_gettype != NULL); } EOF $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ || gl_cv_have_weak=no rm -f conftest1.c libempty.so conftest2.c conftest ;; esac ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 printf "%s\n" "$gl_cv_have_weak" >&6; } case "$gl_cv_have_weak" in *yes) printf "%s\n" "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h ;; esac case "$gl_cv_have_weak" in *yes) LIB_MBRTOWC= ;; *) LIB_MBRTOWC="$LIBPTHREAD" ;; esac ;; esac else LIB_MBRTOWC= fi GL_GNULIB_EXPLICIT_BZERO=0 GL_GNULIB_FFSL=0 GL_GNULIB_FFSLL=0 GL_GNULIB_MEMCHR=0 GL_GNULIB_MEMMEM=0 GL_GNULIB_MEMPCPY=0 GL_GNULIB_MEMRCHR=0 GL_GNULIB_RAWMEMCHR=0 GL_GNULIB_STPCPY=0 GL_GNULIB_STPNCPY=0 GL_GNULIB_STRCHRNUL=0 GL_GNULIB_STRDUP=0 GL_GNULIB_STRNCAT=0 GL_GNULIB_STRNDUP=0 GL_GNULIB_STRNLEN=0 GL_GNULIB_STRPBRK=0 GL_GNULIB_STRSEP=0 GL_GNULIB_STRSTR=0 GL_GNULIB_STRCASESTR=0 GL_GNULIB_STRTOK_R=0 GL_GNULIB_MBSLEN=0 GL_GNULIB_MBSNLEN=0 GL_GNULIB_MBSCHR=0 GL_GNULIB_MBSRCHR=0 GL_GNULIB_MBSSTR=0 GL_GNULIB_MBSCASECMP=0 GL_GNULIB_MBSNCASECMP=0 GL_GNULIB_MBSPCASECMP=0 GL_GNULIB_MBSCASESTR=0 GL_GNULIB_MBSCSPN=0 GL_GNULIB_MBSPBRK=0 GL_GNULIB_MBSSPN=0 GL_GNULIB_MBSSEP=0 GL_GNULIB_MBSTOK_R=0 GL_GNULIB_STRERROR=0 GL_GNULIB_STRERROR_R=0 GL_GNULIB_STRERRORNAME_NP=0 GL_GNULIB_SIGABBREV_NP=0 GL_GNULIB_SIGDESCR_NP=0 GL_GNULIB_STRSIGNAL=0 GL_GNULIB_STRVERSCMP=0 GL_GNULIB_MDA_MEMCCPY=1 GL_GNULIB_MDA_STRDUP=1 HAVE_MBSLEN=0; HAVE_EXPLICIT_BZERO=1; HAVE_FFSL=1; HAVE_FFSLL=1; HAVE_DECL_MEMMEM=1; HAVE_MEMPCPY=1; HAVE_DECL_MEMRCHR=1; HAVE_RAWMEMCHR=1; HAVE_STPCPY=1; HAVE_STPNCPY=1; HAVE_STRCHRNUL=1; HAVE_DECL_STRDUP=1; HAVE_DECL_STRNDUP=1; HAVE_DECL_STRNLEN=1; HAVE_STRPBRK=1; HAVE_STRSEP=1; HAVE_STRCASESTR=1; HAVE_DECL_STRTOK_R=1; HAVE_DECL_STRERROR_R=1; HAVE_STRERRORNAME_NP=1; HAVE_SIGABBREV_NP=1; HAVE_SIGDESCR_NP=1; HAVE_DECL_STRSIGNAL=1; HAVE_STRVERSCMP=1; REPLACE_FFSLL=0; REPLACE_MEMCHR=0; REPLACE_MEMMEM=0; REPLACE_STPNCPY=0; REPLACE_STRCHRNUL=0; REPLACE_STRDUP=0; REPLACE_STRNCAT=0; REPLACE_STRNDUP=0; REPLACE_STRNLEN=0; REPLACE_STRSTR=0; REPLACE_STRCASESTR=0; REPLACE_STRTOK_R=0; REPLACE_STRERROR=0; REPLACE_STRERROR_R=0; REPLACE_STRERRORNAME_NP=0; REPLACE_STRSIGNAL=0; UNDEFINE_STRTOK_R=0; # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is # irrelevant for anonymous mappings. ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" if test "x$ac_cv_func_mmap" = xyes then : gl_have_mmap=yes else $as_nop gl_have_mmap=no fi # Try to allow MAP_ANONYMOUS. gl_have_mmap_anonymous=no if test $gl_have_mmap = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 printf %s "checking for MAP_ANONYMOUS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/mman.h> #ifdef MAP_ANONYMOUS I cannot identify this map #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "I cannot identify this map" >/dev/null 2>&1 then : gl_have_mmap_anonymous=yes fi rm -rf conftest* if test $gl_have_mmap_anonymous != yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/mman.h> #ifdef MAP_ANON I cannot identify this map #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "I cannot identify this map" >/dev/null 2>&1 then : printf "%s\n" "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h gl_have_mmap_anonymous=yes fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 printf "%s\n" "$gl_have_mmap_anonymous" >&6; } if test $gl_have_mmap_anonymous = yes; then printf "%s\n" "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h fi fi # Detect platform-specific bugs in some versions of glibc: # memchr should not dereference anything with length 0 # https://bugzilla.redhat.com/show_bug.cgi?id=499689 # memchr should not dereference overestimated length after a match # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 # memchr should cast the second argument to 'unsigned char'. # This bug exists in Android 4.3. # Assume that memchr works on platforms that lack mprotect. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether memchr works" >&5 printf %s "checking whether memchr works... " >&6; } if test ${gl_cv_func_memchr_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on Android. linux*-android*) gl_cv_func_memchr_works="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_memchr_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> #if HAVE_SYS_MMAN_H # include <fcntl.h> # include <unistd.h> # include <sys/types.h> # include <sys/mman.h> # ifndef MAP_FILE # define MAP_FILE 0 # endif #endif int main (void) { int result = 0; char *fence = NULL; #if HAVE_SYS_MMAN_H && HAVE_MPROTECT # if HAVE_MAP_ANONYMOUS const int flags = MAP_ANONYMOUS | MAP_PRIVATE; const int fd = -1; # else /* !HAVE_MAP_ANONYMOUS */ const int flags = MAP_FILE | MAP_PRIVATE; int fd = open ("/dev/zero", O_RDONLY, 0666); if (fd >= 0) # endif { int pagesize = getpagesize (); char *two_pages = (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, flags, fd, 0); if (two_pages != (char *)(-1) && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) fence = two_pages + pagesize; } #endif if (fence) { /* Test against bugs on glibc systems. */ if (memchr (fence, 0, 0)) result |= 1; strcpy (fence - 9, "12345678"); if (memchr (fence - 9, 0, 79) != fence - 1) result |= 2; if (memchr (fence - 1, 0, 3) != fence - 1) result |= 4; /* Test against bug on AIX 7.2. */ if (memchr (fence - 4, '6', 16) != fence - 4) result |= 8; } /* Test against bug on Android 4.3. */ { char input[3]; input[0] = 'a'; input[1] = 'b'; input[2] = 'c'; if (memchr (input, 0x789abc00 | 'b', 3) != input + 1) result |= 16; } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_memchr_works=yes else $as_nop gl_cv_func_memchr_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_memchr_works" >&5 printf "%s\n" "$gl_cv_func_memchr_works" >&6; } case "$gl_cv_func_memchr_works" in *yes) ;; *) REPLACE_MEMCHR=1 ;; esac ac_fn_check_decl "$LINENO" "memrchr" "ac_cv_have_decl_memrchr" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_memrchr" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_MEMRCHR $ac_have_decl" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether <limits.h> defines MIN and MAX" >&5 printf %s "checking whether <limits.h> defines MIN and MAX... " >&6; } if test ${gl_cv_minmax_in_limits_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> int x = MIN (42, 17); int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_minmax_in_limits_h=yes else $as_nop gl_cv_minmax_in_limits_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_minmax_in_limits_h" >&5 printf "%s\n" "$gl_cv_minmax_in_limits_h" >&6; } if test $gl_cv_minmax_in_limits_h = yes; then printf "%s\n" "#define HAVE_MINMAX_IN_LIMITS_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether <sys/param.h> defines MIN and MAX" >&5 printf %s "checking whether <sys/param.h> defines MIN and MAX... " >&6; } if test ${gl_cv_minmax_in_sys_param_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/param.h> int x = MIN (42, 17); int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_minmax_in_sys_param_h=yes else $as_nop gl_cv_minmax_in_sys_param_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_minmax_in_sys_param_h" >&5 printf "%s\n" "$gl_cv_minmax_in_sys_param_h" >&6; } if test $gl_cv_minmax_in_sys_param_h = yes; then printf "%s\n" "#define HAVE_MINMAX_IN_SYS_PARAM_H 1" >>confdefs.h fi HAVE_POSIX_SIGNALBLOCKING=1; HAVE_PTHREAD_SIGMASK=1; HAVE_RAISE=1; HAVE_SIGSET_T=1; HAVE_SIGINFO_T=1; HAVE_SIGACTION=1; HAVE_STRUCT_SIGACTION_SA_SIGACTION=1; HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; HAVE_SIGHANDLER_T=1; REPLACE_PTHREAD_SIGMASK=0; REPLACE_RAISE=0; ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" " #include <signal.h> /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */ #include <sys/types.h> " if test "x$ac_cv_type_sigset_t" = xyes then : printf "%s\n" "#define HAVE_SIGSET_T 1" >>confdefs.h gl_cv_type_sigset_t=yes else $as_nop gl_cv_type_sigset_t=no fi if test $gl_cv_type_sigset_t != yes; then HAVE_SIGSET_T=0 fi GL_GNULIB_PTHREAD_SIGMASK=0 GL_GNULIB_RAISE=0 GL_GNULIB_SIGNAL_H_SIGPIPE=0 GL_GNULIB_SIGPROCMASK=0 GL_GNULIB_SIGACTION=0 if test $REPLACE_MALLOC = 1; then REPLACE_REALLOC=1 fi ac_fn_check_decl "$LINENO" "alarm" "ac_cv_have_decl_alarm" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_alarm" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_ALARM $ac_have_decl" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5 printf %s "checking for ssize_t... " >&6; } if test ${gt_cv_ssize_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> int main (void) { int x = sizeof (ssize_t *) + sizeof (ssize_t); return !x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gt_cv_ssize_t=yes else $as_nop gt_cv_ssize_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_ssize_t" >&5 printf "%s\n" "$gt_cv_ssize_t" >&6; } if test $gt_cv_ssize_t = no; then printf "%s\n" "#define ssize_t int" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 printf %s "checking for uid_t in sys/types.h... " >&6; } if test ${ac_cv_type_uid_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1 then : ac_cv_type_uid_t=yes else $as_nop ac_cv_type_uid_t=no fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 printf "%s\n" "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then printf "%s\n" "#define uid_t int" >>confdefs.h printf "%s\n" "#define gid_t int" >>confdefs.h fi if test $gl_cv_have_include_next = yes; then gl_cv_next_signal_h='<'signal.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <signal.h>" >&5 printf %s "checking absolute name of <signal.h>... " >&6; } if test ${gl_cv_next_signal_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <signal.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'signal.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_signal_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_signal_h gl_cv_next_signal_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_signal_h" >&5 printf "%s\n" "$gl_cv_next_signal_h" >&6; } fi NEXT_SIGNAL_H=$gl_cv_next_signal_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'signal.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_signal_h fi NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H=$gl_next_as_first_directive # AIX declares sig_atomic_t to already include volatile, and C89 compilers # then choke on 'volatile sig_atomic_t'. C99 requires that it compile. ac_fn_c_check_type "$LINENO" "volatile sig_atomic_t" "ac_cv_type_volatile_sig_atomic_t" " #include <signal.h> " if test "x$ac_cv_type_volatile_sig_atomic_t" = xyes then : else $as_nop HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0 fi ac_fn_c_check_type "$LINENO" "sighandler_t" "ac_cv_type_sighandler_t" " #include <signal.h> " if test "x$ac_cv_type_sighandler_t" = xyes then : else $as_nop HAVE_SIGHANDLER_T=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 printf %s "checking for stdbool.h that conforms to C99... " >&6; } if test ${ac_cv_header_stdbool_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdbool.h> #ifdef __cplusplus typedef bool Bool; #else typedef _Bool Bool; #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html */ Bool q = true; Bool *pq = &q; bool *qq = &q; int main (void) { bool e = &s; *pq |= q; *pq |= ! q; *qq |= q; *qq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq + !qq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_header_stdbool_h=yes else $as_nop ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 printf "%s\n" "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes then : printf "%s\n" "#define HAVE__BOOL 1" >>confdefs.h fi ac_fn_check_decl "$LINENO" "fcloseall" "ac_cv_have_decl_fcloseall" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_fcloseall" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FCLOSEALL $ac_have_decl" >>confdefs.h printf "%s\n" "#define __USE_MINGW_ANSI_STDIO 1" >>confdefs.h if test $gl_cv_have_include_next = yes; then gl_cv_next_stdio_h='<'stdio.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <stdio.h>" >&5 printf %s "checking absolute name of <stdio.h>... " >&6; } if test ${gl_cv_next_stdio_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'stdio.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_stdio_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_stdio_h gl_cv_next_stdio_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdio_h" >&5 printf "%s\n" "$gl_cv_next_stdio_h" >&6; } fi NEXT_STDIO_H=$gl_cv_next_stdio_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'stdio.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_stdio_h fi NEXT_AS_FIRST_DIRECTIVE_STDIO_H=$gl_next_as_first_directive { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which flavor of printf attribute matches inttypes macros" >&5 printf %s "checking which flavor of printf attribute matches inttypes macros... " >&6; } if test ${gl_cv_func_printf_attribute_flavor+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define __STDC_FORMAT_MACROS 1 #include <stdio.h> #include <inttypes.h> /* For non-mingw systems, compilation will trivially succeed. For mingw, compilation will succeed for older mingw (system printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */ #if (defined _WIN32 && ! defined __CYGWIN__) && \ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1]; #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_printf_attribute_flavor=system else $as_nop gl_cv_func_printf_attribute_flavor=gnu fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_attribute_flavor" >&5 printf "%s\n" "$gl_cv_func_printf_attribute_flavor" >&6; } if test "$gl_cv_func_printf_attribute_flavor" = gnu; then printf "%s\n" "#define GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU 1" >>confdefs.h fi if test $ac_cv_have_decl_fcloseall = no; then HAVE_DECL_FCLOSEALL=0 fi ac_fn_check_decl "$LINENO" "ecvt" "ac_cv_have_decl_ecvt" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_ecvt" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_ECVT $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "fcvt" "ac_cv_have_decl_fcvt" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_fcvt" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FCVT $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "gcvt" "ac_cv_have_decl_gcvt" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_gcvt" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_GCVT $ac_have_decl" >>confdefs.h if test $gl_cv_have_include_next = yes; then gl_cv_next_stdlib_h='<'stdlib.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <stdlib.h>" >&5 printf %s "checking absolute name of <stdlib.h>... " >&6; } if test ${gl_cv_next_stdlib_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'stdlib.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_stdlib_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_stdlib_h gl_cv_next_stdlib_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdlib_h" >&5 printf "%s\n" "$gl_cv_next_stdlib_h" >&6; } fi NEXT_STDLIB_H=$gl_cv_next_stdlib_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'stdlib.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_stdlib_h fi NEXT_AS_FIRST_DIRECTIVE_STDLIB_H=$gl_next_as_first_directive if test $ac_cv_have_decl_ecvt = no; then HAVE_DECL_ECVT=0 fi if test $ac_cv_have_decl_fcvt = no; then HAVE_DECL_FCVT=0 fi if test $ac_cv_have_decl_gcvt = no; then HAVE_DECL_GCVT=0 fi ac_fn_check_decl "$LINENO" "strdup" "ac_cv_have_decl_strdup" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_strdup" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_STRDUP $ac_have_decl" >>confdefs.h REPLACE_STRERROR_0=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strerror(0) succeeds" >&5 printf %s "checking whether strerror(0) succeeds... " >&6; } if test ${gl_cv_func_strerror_0_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; # Guess yes on native Windows. mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> #include <errno.h> int main (void) { int result = 0; char *str; errno = 0; str = strerror (0); if (!*str) result |= 1; if (errno) result |= 2; if (strstr (str, "nknown") || strstr (str, "ndefined")) result |= 4; return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_strerror_0_works=yes else $as_nop gl_cv_func_strerror_0_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_0_works" >&5 printf "%s\n" "$gl_cv_func_strerror_0_works" >&6; } case "$gl_cv_func_strerror_0_works" in *yes) ;; *) REPLACE_STRERROR_0=1 printf "%s\n" "#define REPLACE_STRERROR_0 1" >>confdefs.h ;; esac if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for strerror_r with POSIX signature" >&5 printf %s "checking for strerror_r with POSIX signature... " >&6; } if test ${gl_cv_func_strerror_r_posix_signature+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> int strerror_r (int, char *, size_t); int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_strerror_r_posix_signature=yes else $as_nop gl_cv_func_strerror_r_posix_signature=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_r_posix_signature" >&5 printf "%s\n" "$gl_cv_func_strerror_r_posix_signature" >&6; } if test $gl_cv_func_strerror_r_posix_signature = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strerror_r works" >&5 printf %s "checking whether strerror_r works... " >&6; } if test ${gl_cv_func_strerror_r_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on AIX. aix*) gl_cv_func_strerror_r_works="guessing no";; # Guess no on HP-UX. hpux*) gl_cv_func_strerror_r_works="guessing no";; # Guess no on BSD variants. *bsd*) gl_cv_func_strerror_r_works="guessing no";; # Guess yes otherwise. *) gl_cv_func_strerror_r_works="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #include <string.h> int main (void) { int result = 0; char buf[79]; if (strerror_r (EACCES, buf, 0) < 0) result |= 1; errno = 0; if (strerror_r (EACCES, buf, sizeof buf) != 0) result |= 2; strcpy (buf, "Unknown"); if (strerror_r (0, buf, sizeof buf) != 0) result |= 4; if (errno) result |= 8; if (strstr (buf, "nknown") || strstr (buf, "ndefined")) result |= 0x10; errno = 0; *buf = 0; if (strerror_r (-3, buf, sizeof buf) < 0) result |= 0x20; if (errno) result |= 0x40; if (!*buf) result |= 0x80; return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_strerror_r_works=yes else $as_nop gl_cv_func_strerror_r_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_r_works" >&5 printf "%s\n" "$gl_cv_func_strerror_r_works" >&6; } else if test $ac_cv_func___xpg_strerror_r = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether __xpg_strerror_r works" >&5 printf %s "checking whether __xpg_strerror_r works... " >&6; } if test ${gl_cv_func_strerror_r_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : gl_cv_func_strerror_r_works="$gl_cross_guess_normal" else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #include <string.h> extern #ifdef __cplusplus "C" #endif int __xpg_strerror_r(int, char *, size_t); int main (void) { int result = 0; char buf[256] = "^"; char copy[256]; char *str = strerror (-1); strcpy (copy, str); if (__xpg_strerror_r (-2, buf, 1) == 0) result |= 1; if (*buf) result |= 2; __xpg_strerror_r (-2, buf, 256); if (strcmp (str, copy)) result |= 4; return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_strerror_r_works=yes else $as_nop gl_cv_func_strerror_r_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_r_works" >&5 printf "%s\n" "$gl_cv_func_strerror_r_works" >&6; } fi fi fi fi if test $gl_cv_have_include_next = yes; then gl_cv_next_string_h='<'string.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <string.h>" >&5 printf %s "checking absolute name of <string.h>... " >&6; } if test ${gl_cv_next_string_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'string.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_string_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_string_h gl_cv_next_string_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_string_h" >&5 printf "%s\n" "$gl_cv_next_string_h" >&6; } fi NEXT_STRING_H=$gl_cv_next_string_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'string.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_string_h fi NEXT_AS_FIRST_DIRECTIVE_STRING_H=$gl_next_as_first_directive ac_fn_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_strnlen" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_STRNLEN $ac_have_decl" >>confdefs.h if test $REPLACE_MEMCHR = 1; then REPLACE_STRSTR=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strstr works" >&5 printf %s "checking whether strstr works... " >&6; } if test ${gl_cv_func_strstr_works_always+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> /* for __GNU_LIBRARY__ */ #ifdef __GNU_LIBRARY__ #include <features.h> #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ || defined __UCLIBC__ Lucky user #endif #elif defined __CYGWIN__ #include <cygwin/version.h> #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) Lucky user #endif #else Lucky user #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1 then : gl_cv_func_strstr_works_always="guessing yes" else $as_nop gl_cv_func_strstr_works_always="$gl_cross_guess_normal" fi rm -rf conftest* else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> /* for __GNU_LIBRARY__, strstr */ #ifdef __GNU_LIBRARY__ #include <features.h> #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28 Unlucky user #endif #endif #define P "_EF_BF_BD" #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P #define NEEDLE P P P P P int main (void) { return !!strstr (HAYSTACK, NEEDLE); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_strstr_works_always=yes else $as_nop gl_cv_func_strstr_works_always=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strstr_works_always" >&5 printf "%s\n" "$gl_cv_func_strstr_works_always" >&6; } case "$gl_cv_func_strstr_works_always" in *yes) ;; *) REPLACE_STRSTR=1 ;; esac fi ac_fn_check_decl "$LINENO" "strtoimax" "ac_cv_have_decl_strtoimax" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_strtoimax" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_STRTOIMAX $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "strtoumax" "ac_cv_have_decl_strtoumax" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_strtoumax" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_STRTOUMAX $ac_have_decl" >>confdefs.h HAVE_DECL_LOCALTIME_R=1; HAVE_NANOSLEEP=1; HAVE_STRPTIME=1; HAVE_TIMEGM=1; HAVE_TIMESPEC_GET=1; HAVE_TIMEZONE_T=0; REPLACE_CTIME=GNULIB_PORTCHECK; REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; REPLACE_MKTIME=GNULIB_PORTCHECK; REPLACE_NANOSLEEP=GNULIB_PORTCHECK; REPLACE_STRFTIME=GNULIB_PORTCHECK; REPLACE_TIMEGM=GNULIB_PORTCHECK; REPLACE_TZSET=GNULIB_PORTCHECK; : ${GNULIB_GETTIMEOFDAY=0}; REPLACE_GMTIME=0; REPLACE_LOCALTIME=0; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in <time.h>" >&5 printf %s "checking for struct timespec in <time.h>... " >&6; } if test ${gl_cv_sys_struct_timespec_in_time_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <time.h> int main (void) { static struct timespec x; x.tv_sec = x.tv_nsec; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_sys_struct_timespec_in_time_h=yes else $as_nop gl_cv_sys_struct_timespec_in_time_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_time_h" >&5 printf "%s\n" "$gl_cv_sys_struct_timespec_in_time_h" >&6; } TIME_H_DEFINES_STRUCT_TIMESPEC=0 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 UNISTD_H_DEFINES_STRUCT_TIMESPEC=0 if test $gl_cv_sys_struct_timespec_in_time_h = yes; then TIME_H_DEFINES_STRUCT_TIMESPEC=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in <sys/time.h>" >&5 printf %s "checking for struct timespec in <sys/time.h>... " >&6; } if test ${gl_cv_sys_struct_timespec_in_sys_time_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/time.h> int main (void) { static struct timespec x; x.tv_sec = x.tv_nsec; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_sys_struct_timespec_in_sys_time_h=yes else $as_nop gl_cv_sys_struct_timespec_in_sys_time_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_sys_time_h" >&5 printf "%s\n" "$gl_cv_sys_struct_timespec_in_sys_time_h" >&6; } if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in <pthread.h>" >&5 printf %s "checking for struct timespec in <pthread.h>... " >&6; } if test ${gl_cv_sys_struct_timespec_in_pthread_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> int main (void) { static struct timespec x; x.tv_sec = x.tv_nsec; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_sys_struct_timespec_in_pthread_h=yes else $as_nop gl_cv_sys_struct_timespec_in_pthread_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_pthread_h" >&5 printf "%s\n" "$gl_cv_sys_struct_timespec_in_pthread_h" >&6; } if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in <unistd.h>" >&5 printf %s "checking for struct timespec in <unistd.h>... " >&6; } if test ${gl_cv_sys_struct_timespec_in_unistd_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> int main (void) { static struct timespec x; x.tv_sec = x.tv_nsec; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_sys_struct_timespec_in_unistd_h=yes else $as_nop gl_cv_sys_struct_timespec_in_unistd_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_unistd_h" >&5 printf "%s\n" "$gl_cv_sys_struct_timespec_in_unistd_h" >&6; } if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then UNISTD_H_DEFINES_STRUCT_TIMESPEC=1 fi fi fi fi if test $gl_cv_have_include_next = yes; then gl_cv_next_time_h='<'time.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <time.h>" >&5 printf %s "checking absolute name of <time.h>... " >&6; } if test ${gl_cv_next_time_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <time.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'time.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_time_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_time_h gl_cv_next_time_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_time_h" >&5 printf "%s\n" "$gl_cv_next_time_h" >&6; } fi NEXT_TIME_H=$gl_cv_next_time_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'time.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_time_h fi NEXT_AS_FIRST_DIRECTIVE_TIME_H=$gl_next_as_first_directive { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TIME_UTC in <time.h>" >&5 printf %s "checking for TIME_UTC in <time.h>... " >&6; } if test ${gl_cv_time_h_has_TIME_UTC+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <time.h> int main (void) { static int x = TIME_UTC; x++; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_time_h_has_TIME_UTC=yes else $as_nop gl_cv_time_h_has_TIME_UTC=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_time_h_has_TIME_UTC" >&5 printf "%s\n" "$gl_cv_time_h_has_TIME_UTC" >&6; } if test $gl_cv_time_h_has_TIME_UTC = yes; then TIME_H_DEFINES_TIME_UTC=1 else TIME_H_DEFINES_TIME_UTC=0 fi GL_GNULIB_CTIME=0 GL_GNULIB_MKTIME=0 GL_GNULIB_LOCALTIME=0 GL_GNULIB_NANOSLEEP=0 GL_GNULIB_STRFTIME=0 GL_GNULIB_STRPTIME=0 GL_GNULIB_TIMEGM=0 GL_GNULIB_TIMESPEC_GET=0 GL_GNULIB_TIME_R=0 GL_GNULIB_TIME_RZ=0 GL_GNULIB_TZSET=0 GL_GNULIB_MDA_TZSET=1 ac_fn_check_decl "$LINENO" "execvpe" "ac_cv_have_decl_execvpe" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_execvpe" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_EXECVPE $ac_have_decl" >>confdefs.h if test $gl_cv_have_include_next = yes; then gl_cv_next_unistd_h='<'unistd.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <unistd.h>" >&5 printf %s "checking absolute name of <unistd.h>... " >&6; } if test ${gl_cv_next_unistd_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_unistd_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'unistd.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_unistd_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_unistd_h gl_cv_next_unistd_h='"'$gl_header'"' else gl_cv_next_unistd_h='<'unistd.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_unistd_h" >&5 printf "%s\n" "$gl_cv_next_unistd_h" >&6; } fi NEXT_UNISTD_H=$gl_cv_next_unistd_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'unistd.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_unistd_h fi NEXT_AS_FIRST_DIRECTIVE_UNISTD_H=$gl_next_as_first_directive if test $ac_cv_header_unistd_h = yes; then HAVE_UNISTD_H=1 else HAVE_UNISTD_H=0 fi if test $ac_cv_have_decl_execvpe = no; then HAVE_DECL_EXECVPE=0 fi gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;} i\ 0 q ' gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;} i\ 0 q ' gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;} i\ 0 q ' if test "$HAVE_LIBUNISTRING" = yes; then LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"` LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"` LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"` fi ac_fn_check_decl "$LINENO" "clearerr_unlocked" "ac_cv_have_decl_clearerr_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_clearerr_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_CLEARERR_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "feof_unlocked" "ac_cv_have_decl_feof_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_feof_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FEOF_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "ferror_unlocked" "ac_cv_have_decl_ferror_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_ferror_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FERROR_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "fflush_unlocked" "ac_cv_have_decl_fflush_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_fflush_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FFLUSH_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "fgets_unlocked" "ac_cv_have_decl_fgets_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_fgets_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FGETS_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "fputc_unlocked" "ac_cv_have_decl_fputc_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_fputc_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FPUTC_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "fputs_unlocked" "ac_cv_have_decl_fputs_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_fputs_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FPUTS_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "fread_unlocked" "ac_cv_have_decl_fread_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_fread_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FREAD_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "fwrite_unlocked" "ac_cv_have_decl_fwrite_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_fwrite_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FWRITE_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_getc_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_GETC_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "getchar_unlocked" "ac_cv_have_decl_getchar_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_getchar_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_GETCHAR_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "putc_unlocked" "ac_cv_have_decl_putc_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_putc_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_PUTC_UNLOCKED $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "putchar_unlocked" "ac_cv_have_decl_putchar_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_putchar_unlocked" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_PUTCHAR_UNLOCKED $ac_have_decl" >>confdefs.h if test $ac_cv_header_features_h = yes; then HAVE_FEATURES_H=1 else HAVE_FEATURES_H=0 fi if test $gl_cv_have_include_next = yes; then gl_cv_next_wchar_h='<'wchar.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <wchar.h>" >&5 printf %s "checking absolute name of <wchar.h>... " >&6; } if test ${gl_cv_next_wchar_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_wchar_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'wchar.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_wchar_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_wchar_h gl_cv_next_wchar_h='"'$gl_header'"' else gl_cv_next_wchar_h='<'wchar.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wchar_h" >&5 printf "%s\n" "$gl_cv_next_wchar_h" >&6; } fi NEXT_WCHAR_H=$gl_cv_next_wchar_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'wchar.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_wchar_h fi NEXT_AS_FIRST_DIRECTIVE_WCHAR_H=$gl_next_as_first_directive if test $ac_cv_header_wchar_h = yes; then HAVE_WCHAR_H=1 else HAVE_WCHAR_H=0 fi if test $gt_cv_c_wint_t = yes; then HAVE_WINT_T=1 else HAVE_WINT_T=0 fi ac_fn_check_decl "$LINENO" "wcsdup" "ac_cv_have_decl_wcsdup" " #include <wchar.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_wcsdup" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_WCSDUP $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_wcsdup = no; then HAVE_DECL_WCSDUP=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler option to allow warnings" >&5 printf %s "checking for C compiler option to allow warnings... " >&6; } if test ${gl_cv_cc_wallow+y} then : printf %s "(cached) " >&6 else $as_nop rm -f conftest* echo 'int dummy;' > conftest.c { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } >/dev/null { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } >/dev/null if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then gl_cv_cc_wallow='-Wno-error' else gl_cv_cc_wallow=none fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_wallow" >&5 printf "%s\n" "$gl_cv_cc_wallow" >&6; } case "$gl_cv_cc_wallow" in none) GL_CFLAG_ALLOW_WARNINGS='' ;; *) GL_CFLAG_ALLOW_WARNINGS="$gl_cv_cc_wallow" ;; esac if test -n "$CXX" && test "$CXX" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler option to allow warnings" >&5 printf %s "checking for C++ compiler option to allow warnings... " >&6; } if test ${gl_cv_cxx_wallow+y} then : printf %s "(cached) " >&6 else $as_nop rm -f conftest* echo 'int dummy;' > conftest.cc { ac_try='${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } >/dev/null { ac_try='${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } >/dev/null if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then gl_cv_cxx_wallow='-Wno-error' else gl_cv_cxx_wallow=none fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cxx_wallow" >&5 printf "%s\n" "$gl_cv_cxx_wallow" >&6; } case "$gl_cv_cxx_wallow" in none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; *) GL_CXXFLAG_ALLOW_WARNINGS="$gl_cv_cxx_wallow" ;; esac else GL_CXXFLAG_ALLOW_WARNINGS='' fi HAVE_STRUCT_SOCKADDR_STORAGE=1; HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; HAVE_SA_FAMILY_T=1; HAVE_ACCEPT4=1; if test $ac_cv_header_sys_socket_h = no; then ac_fn_c_check_header_compile "$LINENO" "ws2tcpip.h" "ac_cv_header_ws2tcpip_h" "$ac_includes_default" if test "x$ac_cv_header_ws2tcpip_h" = xyes then : printf "%s\n" "#define HAVE_WS2TCPIP_H 1" >>confdefs.h fi fi case "$host_os" in osf*) printf "%s\n" "#define _POSIX_PII_SOCKET 1" >>confdefs.h ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether <sys/socket.h> is self-contained" >&5 printf %s "checking whether <sys/socket.h> is self-contained... " >&6; } if test ${gl_cv_header_sys_socket_h_selfcontained+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/socket.h> int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_sys_socket_h_selfcontained=yes else $as_nop gl_cv_header_sys_socket_h_selfcontained=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_socket_h_selfcontained" >&5 printf "%s\n" "$gl_cv_header_sys_socket_h_selfcontained" >&6; } if test $gl_cv_header_sys_socket_h_selfcontained = yes; then ac_fn_c_check_func "$LINENO" "shutdown" "ac_cv_func_shutdown" if test "x$ac_cv_func_shutdown" = xyes then : printf "%s\n" "#define HAVE_SHUTDOWN 1" >>confdefs.h fi if test $ac_cv_func_shutdown = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether <sys/socket.h> defines the SHUT_* macros" >&5 printf %s "checking whether <sys/socket.h> defines the SHUT_* macros... " >&6; } if test ${gl_cv_header_sys_socket_h_shut+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/socket.h> int main (void) { int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_sys_socket_h_shut=yes else $as_nop gl_cv_header_sys_socket_h_shut=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_socket_h_shut" >&5 printf "%s\n" "$gl_cv_header_sys_socket_h_shut" >&6; } if test $gl_cv_header_sys_socket_h_shut = no; then SYS_SOCKET_H='sys/socket.h' fi fi fi # We need to check for ws2tcpip.h now. if test $gl_cv_have_include_next = yes; then gl_cv_next_sys_socket_h='<'sys/socket.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/socket.h>" >&5 printf %s "checking absolute name of <sys/socket.h>... " >&6; } if test ${gl_cv_next_sys_socket_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_sys_socket_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/socket.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'sys/socket.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_sys_socket_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_sys_socket_h gl_cv_next_sys_socket_h='"'$gl_header'"' else gl_cv_next_sys_socket_h='<'sys/socket.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_socket_h" >&5 printf "%s\n" "$gl_cv_next_sys_socket_h" >&6; } fi NEXT_SYS_SOCKET_H=$gl_cv_next_sys_socket_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'sys/socket.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_sys_socket_h fi NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H=$gl_next_as_first_directive if test $ac_cv_header_sys_socket_h = yes; then HAVE_SYS_SOCKET_H=1 else HAVE_SYS_SOCKET_H=0 fi if test $ac_cv_header_sys_socket_h = yes; then HAVE_WS2TCPIP_H=0 else if test $ac_cv_header_ws2tcpip_h = yes; then HAVE_WS2TCPIP_H=1 else HAVE_WS2TCPIP_H=0 fi fi ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" " /* sys/types.h is not needed according to POSIX, but the sys/socket.h in i386-unknown-freebsd4.10 and powerpc-apple-darwin5.5 required it. */ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif " if test "x$ac_cv_type_struct_sockaddr_storage" = xyes then : printf "%s\n" "#define HAVE_STRUCT_SOCKADDR_STORAGE 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "sa_family_t" "ac_cv_type_sa_family_t" " /* sys/types.h is not needed according to POSIX, but the sys/socket.h in i386-unknown-freebsd4.10 and powerpc-apple-darwin5.5 required it. */ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif " if test "x$ac_cv_type_sa_family_t" = xyes then : printf "%s\n" "#define HAVE_SA_FAMILY_T 1" >>confdefs.h fi if test $ac_cv_type_struct_sockaddr_storage = no; then HAVE_STRUCT_SOCKADDR_STORAGE=0 fi if test $ac_cv_type_sa_family_t = no; then HAVE_SA_FAMILY_T=0 fi if test $ac_cv_type_struct_sockaddr_storage != no; then ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "ss_family" "ac_cv_member_struct_sockaddr_storage_ss_family" "#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif " if test "x$ac_cv_member_struct_sockaddr_storage_ss_family" = xyes then : printf "%s\n" "#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1" >>confdefs.h else $as_nop HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0 fi fi if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then SYS_SOCKET_H='sys/socket.h' fi if test $ac_cv_header_sys_socket_h != yes; then ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" if test "x$ac_cv_header_winsock2_h" = xyes then : printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h fi fi if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 UNISTD_H_HAVE_WINSOCK2_H=1 SYS_IOCTL_H_HAVE_WINSOCK2_H=1 else HAVE_WINSOCK2_H=0 fi GL_GNULIB_SOCKET=0 GL_GNULIB_CONNECT=0 GL_GNULIB_ACCEPT=0 GL_GNULIB_BIND=0 GL_GNULIB_GETPEERNAME=0 GL_GNULIB_GETSOCKNAME=0 GL_GNULIB_GETSOCKOPT=0 GL_GNULIB_LISTEN=0 GL_GNULIB_RECV=0 GL_GNULIB_SEND=0 GL_GNULIB_RECVFROM=0 GL_GNULIB_SENDTO=0 GL_GNULIB_SETSOCKOPT=0 GL_GNULIB_SHUTDOWN=0 GL_GNULIB_ACCEPT4=0 HAVE_DECL_INET_NTOP=1; HAVE_DECL_INET_PTON=1; REPLACE_INET_NTOP=0; REPLACE_INET_PTON=0; if test $ac_cv_header_arpa_inet_h = yes; then HAVE_ARPA_INET_H=1 else HAVE_ARPA_INET_H=0 fi if test $gl_cv_have_include_next = yes; then gl_cv_next_arpa_inet_h='<'arpa/inet.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <arpa/inet.h>" >&5 printf %s "checking absolute name of <arpa/inet.h>... " >&6; } if test ${gl_cv_next_arpa_inet_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_arpa_inet_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <arpa/inet.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'arpa/inet.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_arpa_inet_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_arpa_inet_h gl_cv_next_arpa_inet_h='"'$gl_header'"' else gl_cv_next_arpa_inet_h='<'arpa/inet.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_arpa_inet_h" >&5 printf "%s\n" "$gl_cv_next_arpa_inet_h" >&6; } fi NEXT_ARPA_INET_H=$gl_cv_next_arpa_inet_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'arpa/inet.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_arpa_inet_h fi NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H=$gl_next_as_first_directive if test $ac_cv_header_sys_socket_h = yes; then HAVE_WS2TCPIP_H=0 else if test $ac_cv_header_ws2tcpip_h = yes; then HAVE_WS2TCPIP_H=1 else HAVE_WS2TCPIP_H=0 fi fi GL_GNULIB_INET_NTOP=0 GL_GNULIB_INET_PTON=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5 printf %s "checking if environ is properly declared... " >&6; } if test ${gt_cv_var_environ_declaration+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if HAVE_UNISTD_H #include <unistd.h> #endif /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ #include <stdlib.h> typedef struct { int foo; } foo_t; extern foo_t environ; int main (void) { environ.foo = 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gt_cv_var_environ_declaration=no else $as_nop gt_cv_var_environ_declaration=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_var_environ_declaration" >&5 printf "%s\n" "$gt_cv_var_environ_declaration" >&6; } if test $gt_cv_var_environ_declaration = yes; then printf "%s\n" "#define HAVE_ENVIRON_DECL 1" >>confdefs.h fi if test $gt_cv_var_environ_declaration != yes; then HAVE_DECL_ENVIRON=0 fi HAVE_GETTIMEOFDAY=1; HAVE_STRUCT_TIMEVAL=1; HAVE_SYS_TIME_H=1; REPLACE_GETTIMEOFDAY=0; REPLACE_STRUCT_TIMEVAL=0; if test $gl_cv_have_include_next = yes; then gl_cv_next_sys_time_h='<'sys/time.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/time.h>" >&5 printf %s "checking absolute name of <sys/time.h>... " >&6; } if test ${gl_cv_next_sys_time_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_sys_time_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/time.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'sys/time.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_sys_time_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_sys_time_h gl_cv_next_sys_time_h='"'$gl_header'"' else gl_cv_next_sys_time_h='<'sys/time.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_time_h" >&5 printf "%s\n" "$gl_cv_next_sys_time_h" >&6; } fi NEXT_SYS_TIME_H=$gl_cv_next_sys_time_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'sys/time.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_sys_time_h fi NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H=$gl_next_as_first_directive if test $ac_cv_header_sys_time_h != yes; then HAVE_SYS_TIME_H=0 fi if test $ac_cv_header_sys_socket_h != yes; then ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" if test "x$ac_cv_header_winsock2_h" = xyes then : printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h fi fi if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 UNISTD_H_HAVE_WINSOCK2_H=1 SYS_IOCTL_H_HAVE_WINSOCK2_H=1 else HAVE_WINSOCK2_H=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5 printf %s "checking for struct timeval... " >&6; } if test ${gl_cv_sys_struct_timeval+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if HAVE_SYS_TIME_H #include <sys/time.h> #endif #include <time.h> #if HAVE_WINSOCK2_H # include <winsock2.h> #endif int main (void) { static struct timeval x; x.tv_sec = x.tv_usec; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_sys_struct_timeval=yes else $as_nop gl_cv_sys_struct_timeval=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timeval" >&5 printf "%s\n" "$gl_cv_sys_struct_timeval" >&6; } if test $gl_cv_sys_struct_timeval != yes; then HAVE_STRUCT_TIMEVAL=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wide-enough struct timeval.tv_sec member" >&5 printf %s "checking for wide-enough struct timeval.tv_sec member... " >&6; } if test ${gl_cv_sys_struct_timeval_tv_sec+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if HAVE_SYS_TIME_H #include <sys/time.h> #endif #include <time.h> #if HAVE_WINSOCK2_H # include <winsock2.h> #endif int main (void) { static struct timeval x; typedef int verify_tv_sec_type[ sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1 ]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_sys_struct_timeval_tv_sec=yes else $as_nop gl_cv_sys_struct_timeval_tv_sec=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timeval_tv_sec" >&5 printf "%s\n" "$gl_cv_sys_struct_timeval_tv_sec" >&6; } if test $gl_cv_sys_struct_timeval_tv_sec != yes; then REPLACE_STRUCT_TIMEVAL=1 fi fi GL_GNULIB_GETTIMEOFDAY=0 case "$host_os" in *-musl*) printf "%s\n" "#define MUSL_LIBC 1" >>confdefs.h ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for IPv4 sockets" >&5 printf %s "checking for IPv4 sockets... " >&6; } if test ${gl_cv_socket_ipv4+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> #endif #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif int main (void) { int x = AF_INET; struct in_addr y; struct sockaddr_in z; if (&x && &y && &z) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_socket_ipv4=yes else $as_nop gl_cv_socket_ipv4=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socket_ipv4" >&5 printf "%s\n" "$gl_cv_socket_ipv4" >&6; } if test $gl_cv_socket_ipv4 = yes; then printf "%s\n" "#define HAVE_IPV4 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for IPv6 sockets" >&5 printf %s "checking for IPv6 sockets... " >&6; } if test ${gl_cv_socket_ipv6+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> #endif #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif int main (void) { int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; if (&x && &y && &z) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_socket_ipv6=yes else $as_nop gl_cv_socket_ipv6=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socket_ipv6" >&5 printf "%s\n" "$gl_cv_socket_ipv6" >&6; } if test $gl_cv_socket_ipv6 = yes; then printf "%s\n" "#define HAVE_IPV6 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes then : else $as_nop printf "%s\n" "#define off_t long int" >>confdefs.h fi GL_GNULIB_IOCTL=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LC_MESSAGES" >&5 printf %s "checking for LC_MESSAGES... " >&6; } if test ${gt_cv_val_LC_MESSAGES+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> int main (void) { return LC_MESSAGES ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gt_cv_val_LC_MESSAGES=yes else $as_nop gt_cv_val_LC_MESSAGES=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_val_LC_MESSAGES" >&5 printf "%s\n" "$gt_cv_val_LC_MESSAGES" >&6; } if test $gt_cv_val_LC_MESSAGES = yes; then printf "%s\n" "#define HAVE_LC_MESSAGES 1" >>confdefs.h fi if test $ac_cv_func_uselocale = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether uselocale works" >&5 printf %s "checking whether uselocale works... " >&6; } if test ${gt_cv_func_uselocale_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : # Guess no on AIX and z/OS, yes otherwise. case "$host_os" in aix* | openedition*) gt_cv_func_uselocale_works="guessing no" ;; *) gt_cv_func_uselocale_works="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #if HAVE_XLOCALE_H # include <xlocale.h> #endif locale_t loc1; int main () { uselocale (NULL); setlocale (LC_ALL, "en_US.UTF-8"); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gt_cv_func_uselocale_works=yes else $as_nop gt_cv_func_uselocale_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_uselocale_works" >&5 printf "%s\n" "$gt_cv_func_uselocale_works" >&6; } else gt_cv_func_uselocale_works=no fi case "$gt_cv_func_uselocale_works" in *yes) gt_working_uselocale=yes printf "%s\n" "#define HAVE_WORKING_USELOCALE 1" >>confdefs.h ;; *) gt_working_uselocale=no ;; esac case "$gt_cv_func_uselocale_works" in *yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fake locale system (OpenBSD)" >&5 printf %s "checking for fake locale system (OpenBSD)... " >&6; } if test ${gt_cv_locale_fake+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in openbsd*) gt_cv_locale_fake="guessing yes" ;; *) gt_cv_locale_fake="guessing no" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #if HAVE_XLOCALE_H # include <xlocale.h> #endif int main () { locale_t loc1, loc2; if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL) return 1; if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL) return 1; loc1 = newlocale (LC_ALL_MASK, "de_DE.UTF-8", (locale_t)0); loc2 = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", (locale_t)0); return !(loc1 == loc2); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gt_cv_locale_fake=yes else $as_nop gt_cv_locale_fake=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fake" >&5 printf "%s\n" "$gt_cv_locale_fake" >&6; } ;; *) gt_cv_locale_fake=no ;; esac case "$gt_cv_locale_fake" in *yes) gt_fake_locales=yes printf "%s\n" "#define HAVE_FAKE_LOCALES 1" >>confdefs.h ;; *) gt_fake_locales=no ;; esac case "$gt_cv_func_uselocale_works" in *yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Solaris 11.4 locale system" >&5 printf %s "checking for Solaris 11.4 locale system... " >&6; } if test ${gt_cv_locale_solaris114+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in solaris*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> struct _LC_locale_t *x; locale_t y; int main (void) { *y = x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gt_cv_locale_solaris114=yes else $as_nop gt_cv_locale_solaris114=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; *) gt_cv_locale_solaris114=no ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_solaris114" >&5 printf "%s\n" "$gt_cv_locale_solaris114" >&6; } ;; *) gt_cv_locale_solaris114=no ;; esac if test $gt_cv_locale_solaris114 = yes; then printf "%s\n" "#define HAVE_SOLARIS114_LOCALES 1" >>confdefs.h fi case "$gt_cv_func_uselocale_works" in *yes) ac_fn_c_check_func "$LINENO" "getlocalename_l" "ac_cv_func_getlocalename_l" if test "x$ac_cv_func_getlocalename_l" = xyes then : printf "%s\n" "#define HAVE_GETLOCALENAME_L 1" >>confdefs.h fi ;; esac gt_nameless_locales=no case "$host_os" in aix*) gt_nameless_locales=yes printf "%s\n" "#define HAVE_NAMELESS_LOCALES 1" >>confdefs.h ;; esac if test $gt_working_uselocale = yes && test $gt_fake_locales = no; then gt_good_uselocale=yes printf "%s\n" "#define HAVE_GOOD_USELOCALE 1" >>confdefs.h else gt_good_uselocale=no fi if test $gt_good_uselocale = yes && test $gt_nameless_locales = yes; then gt_localename_enhances_locale_funcs=yes LOCALENAME_ENHANCE_LOCALE_FUNCS=1 printf "%s\n" "#define LOCALENAME_ENHANCE_LOCALE_FUNCS 1" >>confdefs.h else gt_localename_enhances_locale_funcs=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 printf %s "checking for CFPreferencesCopyAppValue... " >&6; } if test ${gt_cv_func_CFPreferencesCopyAppValue+y} then : printf %s "(cached) " >&6 else $as_nop gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <CoreFoundation/CFPreferences.h> int main (void) { CFPreferencesCopyAppValue(NULL, NULL) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gt_cv_func_CFPreferencesCopyAppValue=yes else $as_nop gt_cv_func_CFPreferencesCopyAppValue=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 printf "%s\n" "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then printf "%s\n" "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyPreferredLanguages" >&5 printf %s "checking for CFLocaleCopyPreferredLanguages... " >&6; } if test ${gt_cv_func_CFLocaleCopyPreferredLanguages+y} then : printf %s "(cached) " >&6 else $as_nop gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <CoreFoundation/CFLocale.h> int main (void) { CFLocaleCopyPreferredLanguages(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gt_cv_func_CFLocaleCopyPreferredLanguages=yes else $as_nop gt_cv_func_CFLocaleCopyPreferredLanguages=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyPreferredLanguages" >&5 printf "%s\n" "$gt_cv_func_CFLocaleCopyPreferredLanguages" >&6; } if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then printf "%s\n" "#define HAVE_CFLOCALECOPYPREFERREDLANGUAGES 1" >>confdefs.h fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi HAVE_PSELECT=1; REPLACE_PSELECT=0; REPLACE_SELECT=0; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether <sys/select.h> is self-contained" >&5 printf %s "checking whether <sys/select.h> is self-contained... " >&6; } if test ${gl_cv_header_sys_select_h_selfcontained+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/select.h> int main (void) { struct timeval b; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_sys_select_h_selfcontained=yes else $as_nop gl_cv_header_sys_select_h_selfcontained=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test $gl_cv_header_sys_select_h_selfcontained = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/select.h> int main (void) { int memset; int bzero; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/select.h> int main (void) { #undef memset #define memset nonexistent_memset extern #ifdef __cplusplus "C" #endif void *memset (void *, int, unsigned long); #undef bzero #define bzero nonexistent_bzero extern #ifdef __cplusplus "C" #endif void bzero (void *, unsigned long); fd_set fds; FD_ZERO (&fds); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : else $as_nop gl_cv_header_sys_select_h_selfcontained=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_select_h_selfcontained" >&5 printf "%s\n" "$gl_cv_header_sys_select_h_selfcontained" >&6; } if test $gl_cv_have_include_next = yes; then gl_cv_next_sys_select_h='<'sys/select.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/select.h>" >&5 printf %s "checking absolute name of <sys/select.h>... " >&6; } if test ${gl_cv_next_sys_select_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_sys_select_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/select.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'sys/select.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_sys_select_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_sys_select_h gl_cv_next_sys_select_h='"'$gl_header'"' else gl_cv_next_sys_select_h='<'sys/select.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_select_h" >&5 printf "%s\n" "$gl_cv_next_sys_select_h" >&6; } fi NEXT_SYS_SELECT_H=$gl_cv_next_sys_select_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'sys/select.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_sys_select_h fi NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H=$gl_next_as_first_directive if test $ac_cv_header_sys_select_h = yes; then HAVE_SYS_SELECT_H=1 else HAVE_SYS_SELECT_H=0 fi if test $ac_cv_header_sys_socket_h != yes; then ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" if test "x$ac_cv_header_winsock2_h" = xyes then : printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h fi fi if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 UNISTD_H_HAVE_WINSOCK2_H=1 SYS_IOCTL_H_HAVE_WINSOCK2_H=1 else HAVE_WINSOCK2_H=0 fi if test $ac_cv_header_sys_socket_h != yes; then ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" if test "x$ac_cv_header_winsock2_h" = xyes then : printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h fi fi if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 UNISTD_H_HAVE_WINSOCK2_H=1 SYS_IOCTL_H_HAVE_WINSOCK2_H=1 else HAVE_WINSOCK2_H=0 fi LIBSOCKET= if test $HAVE_WINSOCK2_H = 1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for WSAStartup" >&5 printf %s "checking for WSAStartup... " >&6; } if test ${gl_cv_func_wsastartup+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_LIBS="$LIBS" LIBS="$LIBS -lws2_32" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_WINSOCK2_H # include <winsock2.h> #endif int main (void) { WORD wVersionRequested = MAKEWORD(1, 1); WSADATA wsaData; int err = WSAStartup(wVersionRequested, &wsaData); WSACleanup (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_func_wsastartup=yes else $as_nop gl_cv_func_wsastartup=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gl_save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wsastartup" >&5 printf "%s\n" "$gl_cv_func_wsastartup" >&6; } if test "$gl_cv_func_wsastartup" = "yes"; then printf "%s\n" "#define WINDOWS_SOCKETS 1" >>confdefs.h LIBSOCKET='-lws2_32' fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing setsockopt" >&5 printf %s "checking for library containing setsockopt... " >&6; } if test ${gl_cv_lib_socket+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_lib_socket= cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern #ifdef __cplusplus "C" #endif char setsockopt(); int main (void) { setsockopt(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : else $as_nop gl_save_LIBS="$LIBS" LIBS="$gl_save_LIBS -lsocket" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern #ifdef __cplusplus "C" #endif char setsockopt(); int main (void) { setsockopt(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_lib_socket="-lsocket" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$gl_cv_lib_socket"; then LIBS="$gl_save_LIBS -lnetwork" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern #ifdef __cplusplus "C" #endif char setsockopt(); int main (void) { setsockopt(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_lib_socket="-lnetwork" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$gl_cv_lib_socket"; then LIBS="$gl_save_LIBS -lnet" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern #ifdef __cplusplus "C" #endif char setsockopt(); int main (void) { setsockopt(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_lib_socket="-lnet" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi fi LIBS="$gl_save_LIBS" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$gl_cv_lib_socket"; then gl_cv_lib_socket="none needed" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_lib_socket" >&5 printf "%s\n" "$gl_cv_lib_socket" >&6; } if test "$gl_cv_lib_socket" != "none needed"; then LIBSOCKET="$gl_cv_lib_socket" fi fi : if test "$ac_cv_header_winsock2_h" = yes; then REPLACE_SELECT=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether select supports a 0 argument" >&5 printf %s "checking whether select supports a 0 argument... " >&6; } if test ${gl_cv_func_select_supports0+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on Interix. interix*) gl_cv_func_select_supports0="guessing no";; # Guess yes otherwise. *) gl_cv_func_select_supports0="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/time.h> #if HAVE_SYS_SELECT_H #include <sys/select.h> #endif int main () { struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 5; return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_select_supports0=yes else $as_nop gl_cv_func_select_supports0=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_select_supports0" >&5 printf "%s\n" "$gl_cv_func_select_supports0" >&6; } case "$gl_cv_func_select_supports0" in *yes) ;; *) REPLACE_SELECT=1 ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether select detects invalid fds" >&5 printf %s "checking whether select detects invalid fds... " >&6; } if test ${gl_cv_func_select_detects_ebadf+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_select_detects_ebadf="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_select_detects_ebadf="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_select_detects_ebadf="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/time.h> #if HAVE_SYS_SELECT_H # include <sys/select.h> #endif #include <unistd.h> #include <errno.h> $gl_mda_defines int main (void) { fd_set set; dup2(0, 16); FD_ZERO(&set); FD_SET(16, &set); close(16); struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 5; return select (17, &set, NULL, NULL, &timeout) != -1 || errno != EBADF; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_select_detects_ebadf=yes else $as_nop gl_cv_func_select_detects_ebadf=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_select_detects_ebadf" >&5 printf "%s\n" "$gl_cv_func_select_detects_ebadf" >&6; } case $gl_cv_func_select_detects_ebadf in *yes) ;; *) REPLACE_SELECT=1 ;; esac fi LIB_SELECT="$LIBSOCKET" if test $REPLACE_SELECT = 1; then case "$host_os" in mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> int main () { MsgWaitForMultipleObjects (0, NULL, 0, 0, 0); return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : else $as_nop LIB_SELECT="$LIB_SELECT -luser32" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi if test $ac_cv_have_decl_strerror_r = no; then HAVE_DECL_STRERROR_R=0 fi if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then if test $gl_cv_func_strerror_r_posix_signature = yes; then case "$gl_cv_func_strerror_r_works" in *no) REPLACE_STRERROR_R=1 ;; esac else REPLACE_STRERROR_R=1 fi else REPLACE_STRERROR_R=1 fi fi HAVE_PTHREAD_T=1; HAVE_PTHREAD_SPINLOCK_T=1; HAVE_PTHREAD_CREATE_DETACHED=1; HAVE_PTHREAD_MUTEX_RECURSIVE=1; HAVE_PTHREAD_MUTEX_ROBUST=1; HAVE_PTHREAD_PROCESS_SHARED=1; HAVE_PTHREAD_CREATE=1; HAVE_PTHREAD_ATTR_INIT=1; HAVE_PTHREAD_ATTR_GETDETACHSTATE=1; HAVE_PTHREAD_ATTR_SETDETACHSTATE=1; HAVE_PTHREAD_ATTR_DESTROY=1; HAVE_PTHREAD_SELF=1; HAVE_PTHREAD_EQUAL=1; HAVE_PTHREAD_DETACH=1; HAVE_PTHREAD_JOIN=1; HAVE_PTHREAD_EXIT=1; HAVE_PTHREAD_ONCE=1; HAVE_PTHREAD_MUTEX_INIT=1; HAVE_PTHREAD_MUTEXATTR_INIT=1; HAVE_PTHREAD_MUTEXATTR_GETTYPE=1; HAVE_PTHREAD_MUTEXATTR_SETTYPE=1; HAVE_PTHREAD_MUTEXATTR_GETROBUST=1; HAVE_PTHREAD_MUTEXATTR_SETROBUST=1; HAVE_PTHREAD_MUTEXATTR_DESTROY=1; HAVE_PTHREAD_MUTEX_LOCK=1; HAVE_PTHREAD_MUTEX_TRYLOCK=1; HAVE_PTHREAD_MUTEX_TIMEDLOCK=1; HAVE_PTHREAD_MUTEX_UNLOCK=1; HAVE_PTHREAD_MUTEX_DESTROY=1; HAVE_PTHREAD_RWLOCK_INIT=1; HAVE_PTHREAD_RWLOCKATTR_INIT=1; HAVE_PTHREAD_RWLOCKATTR_DESTROY=1; HAVE_PTHREAD_RWLOCK_RDLOCK=1; HAVE_PTHREAD_RWLOCK_WRLOCK=1; HAVE_PTHREAD_RWLOCK_TRYRDLOCK=1; HAVE_PTHREAD_RWLOCK_TRYWRLOCK=1; HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK=1; HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK=1; HAVE_PTHREAD_RWLOCK_UNLOCK=1; HAVE_PTHREAD_RWLOCK_DESTROY=1; HAVE_PTHREAD_COND_INIT=1; HAVE_PTHREAD_CONDATTR_INIT=1; HAVE_PTHREAD_CONDATTR_DESTROY=1; HAVE_PTHREAD_COND_WAIT=1; HAVE_PTHREAD_COND_TIMEDWAIT=1; HAVE_PTHREAD_COND_SIGNAL=1; HAVE_PTHREAD_COND_BROADCAST=1; HAVE_PTHREAD_COND_DESTROY=1; HAVE_PTHREAD_KEY_CREATE=1; HAVE_PTHREAD_SETSPECIFIC=1; HAVE_PTHREAD_GETSPECIFIC=1; HAVE_PTHREAD_KEY_DELETE=1; HAVE_PTHREAD_SPIN_INIT=1; HAVE_PTHREAD_SPIN_LOCK=1; HAVE_PTHREAD_SPIN_TRYLOCK=1; HAVE_PTHREAD_SPIN_UNLOCK=1; HAVE_PTHREAD_SPIN_DESTROY=1; REPLACE_PTHREAD_CREATE=0; REPLACE_PTHREAD_ATTR_INIT=0; REPLACE_PTHREAD_ATTR_GETDETACHSTATE=0; REPLACE_PTHREAD_ATTR_SETDETACHSTATE=0; REPLACE_PTHREAD_ATTR_DESTROY=0; REPLACE_PTHREAD_SELF=0; REPLACE_PTHREAD_EQUAL=0; REPLACE_PTHREAD_DETACH=0; REPLACE_PTHREAD_JOIN=0; REPLACE_PTHREAD_EXIT=0; REPLACE_PTHREAD_ONCE=0; REPLACE_PTHREAD_MUTEX_INIT=0; REPLACE_PTHREAD_MUTEXATTR_INIT=0; REPLACE_PTHREAD_MUTEXATTR_GETTYPE=0; REPLACE_PTHREAD_MUTEXATTR_SETTYPE=0; REPLACE_PTHREAD_MUTEXATTR_GETROBUST=0; REPLACE_PTHREAD_MUTEXATTR_SETROBUST=0; REPLACE_PTHREAD_MUTEXATTR_DESTROY=0; REPLACE_PTHREAD_MUTEX_LOCK=0; REPLACE_PTHREAD_MUTEX_TRYLOCK=0; REPLACE_PTHREAD_MUTEX_TIMEDLOCK=0; REPLACE_PTHREAD_MUTEX_UNLOCK=0; REPLACE_PTHREAD_MUTEX_DESTROY=0; REPLACE_PTHREAD_RWLOCK_INIT=0; REPLACE_PTHREAD_RWLOCKATTR_INIT=0; REPLACE_PTHREAD_RWLOCKATTR_DESTROY=0; REPLACE_PTHREAD_RWLOCK_RDLOCK=0; REPLACE_PTHREAD_RWLOCK_WRLOCK=0; REPLACE_PTHREAD_RWLOCK_TRYRDLOCK=0; REPLACE_PTHREAD_RWLOCK_TRYWRLOCK=0; REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK=0; REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK=0; REPLACE_PTHREAD_RWLOCK_UNLOCK=0; REPLACE_PTHREAD_RWLOCK_DESTROY=0; REPLACE_PTHREAD_COND_INIT=0; REPLACE_PTHREAD_CONDATTR_INIT=0; REPLACE_PTHREAD_CONDATTR_DESTROY=0; REPLACE_PTHREAD_COND_WAIT=0; REPLACE_PTHREAD_COND_TIMEDWAIT=0; REPLACE_PTHREAD_COND_SIGNAL=0; REPLACE_PTHREAD_COND_BROADCAST=0; REPLACE_PTHREAD_COND_DESTROY=0; REPLACE_PTHREAD_KEY_CREATE=0; REPLACE_PTHREAD_SETSPECIFIC=0; REPLACE_PTHREAD_GETSPECIFIC=0; REPLACE_PTHREAD_KEY_DELETE=0; REPLACE_PTHREAD_SPIN_INIT=0; REPLACE_PTHREAD_SPIN_LOCK=0; REPLACE_PTHREAD_SPIN_TRYLOCK=0; REPLACE_PTHREAD_SPIN_UNLOCK=0; REPLACE_PTHREAD_SPIN_DESTROY=0; if test $gl_cv_have_include_next = yes; then gl_cv_next_pthread_h='<'pthread.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <pthread.h>" >&5 printf %s "checking absolute name of <pthread.h>... " >&6; } if test ${gl_cv_next_pthread_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_pthread_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'pthread.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_pthread_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_pthread_h gl_cv_next_pthread_h='"'$gl_header'"' else gl_cv_next_pthread_h='<'pthread.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_pthread_h" >&5 printf "%s\n" "$gl_cv_next_pthread_h" >&6; } fi NEXT_PTHREAD_H=$gl_cv_next_pthread_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'pthread.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_pthread_h fi NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H=$gl_next_as_first_directive if test $ac_cv_header_pthread_h = yes; then HAVE_PTHREAD_H=1 if { case "$host_os" in mingw*) true;; *) false;; esac; } \ && test $gl_threads_api = windows; then HAVE_PTHREAD_H=0 fi else HAVE_PTHREAD_H=0 fi ac_fn_c_check_type "$LINENO" "pthread_t" "ac_cv_type_pthread_t" "$ac_includes_default #if HAVE_PTHREAD_H #include <pthread.h> #endif " if test "x$ac_cv_type_pthread_t" = xyes then : printf "%s\n" "#define HAVE_PTHREAD_T 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "pthread_spinlock_t" "ac_cv_type_pthread_spinlock_t" "$ac_includes_default #if HAVE_PTHREAD_H #include <pthread.h> #endif " if test "x$ac_cv_type_pthread_spinlock_t" = xyes then : printf "%s\n" "#define HAVE_PTHREAD_SPINLOCK_T 1" >>confdefs.h fi if test $ac_cv_type_pthread_t != yes; then HAVE_PTHREAD_T=0 fi if test $ac_cv_type_pthread_spinlock_t != yes; then HAVE_PTHREAD_SPINLOCK_T=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_CREATE_DETACHED" >&5 printf %s "checking for PTHREAD_CREATE_DETACHED... " >&6; } if test ${gl_cv_const_PTHREAD_CREATE_DETACHED+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> int x = PTHREAD_CREATE_DETACHED; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_const_PTHREAD_CREATE_DETACHED=yes else $as_nop gl_cv_const_PTHREAD_CREATE_DETACHED=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_const_PTHREAD_CREATE_DETACHED" >&5 printf "%s\n" "$gl_cv_const_PTHREAD_CREATE_DETACHED" >&6; } if test $gl_cv_const_PTHREAD_CREATE_DETACHED != yes; then HAVE_PTHREAD_CREATE_DETACHED=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_MUTEX_RECURSIVE" >&5 printf %s "checking for PTHREAD_MUTEX_RECURSIVE... " >&6; } if test ${gl_cv_const_PTHREAD_MUTEX_RECURSIVE+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> int x = PTHREAD_MUTEX_RECURSIVE; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_const_PTHREAD_MUTEX_RECURSIVE=yes else $as_nop gl_cv_const_PTHREAD_MUTEX_RECURSIVE=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_const_PTHREAD_MUTEX_RECURSIVE" >&5 printf "%s\n" "$gl_cv_const_PTHREAD_MUTEX_RECURSIVE" >&6; } if test $gl_cv_const_PTHREAD_MUTEX_RECURSIVE != yes; then HAVE_PTHREAD_MUTEX_RECURSIVE=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_MUTEX_ROBUST" >&5 printf %s "checking for PTHREAD_MUTEX_ROBUST... " >&6; } if test ${gl_cv_const_PTHREAD_MUTEX_ROBUST+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> int x = PTHREAD_MUTEX_ROBUST; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_const_PTHREAD_MUTEX_ROBUST=yes else $as_nop gl_cv_const_PTHREAD_MUTEX_ROBUST=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_const_PTHREAD_MUTEX_ROBUST" >&5 printf "%s\n" "$gl_cv_const_PTHREAD_MUTEX_ROBUST" >&6; } if test $gl_cv_const_PTHREAD_MUTEX_ROBUST != yes; then HAVE_PTHREAD_MUTEX_ROBUST=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PROCESS_SHARED" >&5 printf %s "checking for PTHREAD_PROCESS_SHARED... " >&6; } if test ${gl_cv_const_PTHREAD_PROCESS_SHARED+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> int x = PTHREAD_PROCESS_SHARED; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_const_PTHREAD_PROCESS_SHARED=yes else $as_nop gl_cv_const_PTHREAD_PROCESS_SHARED=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_const_PTHREAD_PROCESS_SHARED" >&5 printf "%s\n" "$gl_cv_const_PTHREAD_PROCESS_SHARED" >&6; } if test $gl_cv_const_PTHREAD_PROCESS_SHARED != yes; then HAVE_PTHREAD_PROCESS_SHARED=0 fi LIB_PTHREAD="$LIBPMULTITHREAD" GL_GNULIB_PTHREAD_THREAD=0 GL_GNULIB_PTHREAD_ONCE=0 GL_GNULIB_PTHREAD_MUTEX=0 GL_GNULIB_PTHREAD_RWLOCK=0 GL_GNULIB_PTHREAD_COND=0 GL_GNULIB_PTHREAD_TSS=0 GL_GNULIB_PTHREAD_SPIN=0 GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK=0 HAVE_SCHED_YIELD=1; REPLACE_SCHED_YIELD=0; ac_fn_c_check_header_compile "$LINENO" "sched.h" "ac_cv_header_sched_h" "#if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif " if test "x$ac_cv_header_sched_h" = xyes then : printf "%s\n" "#define HAVE_SCHED_H 1" >>confdefs.h fi if test $gl_cv_have_include_next = yes; then gl_cv_next_sched_h='<'sched.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <sched.h>" >&5 printf %s "checking absolute name of <sched.h>... " >&6; } if test ${gl_cv_next_sched_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sched.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'sched.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_sched_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_sched_h gl_cv_next_sched_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sched_h" >&5 printf "%s\n" "$gl_cv_next_sched_h" >&6; } fi NEXT_SCHED_H=$gl_cv_next_sched_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'sched.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_sched_h fi NEXT_AS_FIRST_DIRECTIVE_SCHED_H=$gl_next_as_first_directive if test "$ac_cv_header_sched_h" = yes; then HAVE_SCHED_H=1 else HAVE_SCHED_H=0 fi if test "$HAVE_SCHED_H" = 1; then ac_fn_c_check_type "$LINENO" "struct sched_param" "ac_cv_type_struct_sched_param" "#if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif #include <sched.h> " if test "x$ac_cv_type_struct_sched_param" = xyes then : HAVE_STRUCT_SCHED_PARAM=1 else $as_nop HAVE_STRUCT_SCHED_PARAM=0 fi else HAVE_STRUCT_SCHED_PARAM=0 case "$host_os" in os2*) ac_fn_c_check_type "$LINENO" "struct sched_param" "ac_cv_type_struct_sched_param" "#include <spawn.h> " if test "x$ac_cv_type_struct_sched_param" = xyes then : HAVE_STRUCT_SCHED_PARAM=1 fi ;; vms) ac_fn_c_check_type "$LINENO" "struct sched_param" "ac_cv_type_struct_sched_param" "#include <pthread.h> " if test "x$ac_cv_type_struct_sched_param" = xyes then : HAVE_STRUCT_SCHED_PARAM=1 fi ;; esac fi if test "$ac_cv_header_sys_cdefs_h" = yes; then HAVE_SYS_CDEFS_H=1 else HAVE_SYS_CDEFS_H=0 fi GL_GNULIB_SCHED_YIELD=0 GL_GNULIB_PSELECT=0 GL_GNULIB_SELECT=0 ac_fn_check_decl "$LINENO" "setenv" "ac_cv_have_decl_setenv" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_setenv" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_SETENV $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_setenv = no; then HAVE_DECL_SETENV=0 fi ac_fn_c_check_header_compile "$LINENO" "search.h" "ac_cv_header_search_h" "$ac_includes_default" if test "x$ac_cv_header_search_h" = xyes then : printf "%s\n" "#define HAVE_SEARCH_H 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "tsearch" "ac_cv_func_tsearch" if test "x$ac_cv_func_tsearch" = xyes then : printf "%s\n" "#define HAVE_TSEARCH 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf returns a byte count as in C99" >&5 printf %s "checking whether snprintf returns a byte count as in C99... " >&6; } if test ${gl_cv_func_snprintf_retval_c99+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; midnightbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on OpenBSD >= 3.9. openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) gl_cv_func_snprintf_retval_c99="guessing no";; openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on Solaris >= 2.10. solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; solaris*) gl_cv_func_printf_sizes_c99="guessing no";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_snprintf_retval_c99="guessing no";; netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on Android. linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on MSVC, no on mingw. mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _MSC_VER Known #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Known" >/dev/null 2>&1 then : gl_cv_func_snprintf_retval_c99="guessing yes" else $as_nop gl_cv_func_snprintf_retval_c99="guessing no" fi rm -rf conftest* ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #include <string.h> #if HAVE_SNPRINTF # define my_snprintf snprintf #else # include <stdarg.h> static int my_snprintf (char *buf, int size, const char *format, ...) { va_list args; int ret; va_start (args, format); ret = vsnprintf (buf, size, format, args); va_end (args); return ret; } #endif static char buf[100]; int main () { strcpy (buf, "ABCDEF"); if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7) return 1; if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7) return 2; if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7) return 3; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_snprintf_retval_c99=yes else $as_nop gl_cv_func_snprintf_retval_c99=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_retval_c99" >&5 printf "%s\n" "$gl_cv_func_snprintf_retval_c99" >&6; } ac_fn_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_snprintf" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_SNPRINTF $ac_have_decl" >>confdefs.h if test $ac_cv_header_sys_ioctl_h = yes; then HAVE_SYS_IOCTL_H=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether <sys/ioctl.h> declares ioctl" >&5 printf %s "checking whether <sys/ioctl.h> declares ioctl... " >&6; } if test ${gl_cv_decl_ioctl_in_sys_ioctl_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/ioctl.h> int main (void) { (void) ioctl; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_decl_ioctl_in_sys_ioctl_h=yes else $as_nop gl_cv_decl_ioctl_in_sys_ioctl_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_ioctl_in_sys_ioctl_h" >&5 printf "%s\n" "$gl_cv_decl_ioctl_in_sys_ioctl_h" >&6; } else HAVE_SYS_IOCTL_H=0 fi if test $gl_cv_have_include_next = yes; then gl_cv_next_sys_ioctl_h='<'sys/ioctl.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/ioctl.h>" >&5 printf %s "checking absolute name of <sys/ioctl.h>... " >&6; } if test ${gl_cv_next_sys_ioctl_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_sys_ioctl_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/ioctl.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'sys/ioctl.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_sys_ioctl_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_sys_ioctl_h gl_cv_next_sys_ioctl_h='"'$gl_header'"' else gl_cv_next_sys_ioctl_h='<'sys/ioctl.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_ioctl_h" >&5 printf "%s\n" "$gl_cv_next_sys_ioctl_h" >&6; } fi NEXT_SYS_IOCTL_H=$gl_cv_next_sys_ioctl_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'sys/ioctl.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_sys_ioctl_h fi NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H=$gl_next_as_first_directive if test $gl_cv_have_include_next = yes; then gl_cv_next_sys_uio_h='<'sys/uio.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/uio.h>" >&5 printf %s "checking absolute name of <sys/uio.h>... " >&6; } if test ${gl_cv_next_sys_uio_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_sys_uio_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/uio.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'sys/uio.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_sys_uio_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_sys_uio_h gl_cv_next_sys_uio_h='"'$gl_header'"' else gl_cv_next_sys_uio_h='<'sys/uio.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_uio_h" >&5 printf "%s\n" "$gl_cv_next_sys_uio_h" >&6; } fi NEXT_SYS_UIO_H=$gl_cv_next_sys_uio_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'sys/uio.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_sys_uio_h fi NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H=$gl_next_as_first_directive if test $ac_cv_header_sys_uio_h = yes; then HAVE_SYS_UIO_H=1 else HAVE_SYS_UIO_H=0 fi ac_fn_check_decl "$LINENO" "unsetenv" "ac_cv_have_decl_unsetenv" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_unsetenv" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_UNSETENV $ac_have_decl" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inttypes.h" >&5 printf %s "checking for inttypes.h... " >&6; } if test ${gl_cv_header_inttypes_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <inttypes.h> int main (void) { uintmax_t i = (uintmax_t) -1; return !i; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_inttypes_h=yes else $as_nop gl_cv_header_inttypes_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_inttypes_h" >&5 printf "%s\n" "$gl_cv_header_inttypes_h" >&6; } if test $gl_cv_header_inttypes_h = yes; then printf "%s\n" "#define HAVE_INTTYPES_H_WITH_UINTMAX 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdint.h" >&5 printf %s "checking for stdint.h... " >&6; } if test ${gl_cv_header_stdint_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <stdint.h> int main (void) { uintmax_t i = (uintmax_t) -1; return !i; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_stdint_h=yes else $as_nop gl_cv_header_stdint_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_h" >&5 printf "%s\n" "$gl_cv_header_stdint_h" >&6; } if test $gl_cv_header_stdint_h = yes; then printf "%s\n" "#define HAVE_STDINT_H_WITH_UINTMAX 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for intmax_t" >&5 printf %s "checking for intmax_t... " >&6; } if test ${gt_cv_c_intmax_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> #include <stdlib.h> #if HAVE_STDINT_H_WITH_UINTMAX #include <stdint.h> #endif #if HAVE_INTTYPES_H_WITH_UINTMAX #include <inttypes.h> #endif int main (void) { intmax_t x = -1; return !x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gt_cv_c_intmax_t=yes else $as_nop gt_cv_c_intmax_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_intmax_t" >&5 printf "%s\n" "$gt_cv_c_intmax_t" >&6; } if test $gt_cv_c_intmax_t = yes; then printf "%s\n" "#define HAVE_INTMAX_T 1" >>confdefs.h else printf "%s\n" "#define intmax_t long long" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'double'" >&5 printf %s "checking where to find the exponent in a 'double'... " >&6; } if test ${gl_cv_cc_double_expbit0+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined arm || defined __arm || defined __arm__ mixed_endianness #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "mixed_endianness" >/dev/null 2>&1 then : gl_cv_cc_double_expbit0="unknown" else $as_nop : if test ${ac_cv_c_bigendian+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO" then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/param.h> int main (void) { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/param.h> int main (void) { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> int main (void) { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> int main (void) { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ unsigned short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; unsigned short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } unsigned short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; unsigned short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main (void) { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_bigendian=no else $as_nop ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi : case $ac_cv_c_bigendian in #( yes) gl_cv_cc_double_expbit0="word 0 bit 20";; #( no) gl_cv_cc_double_expbit0="word 1 bit 20" ;; #( universal) printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) gl_cv_cc_double_expbit0="unknown" ;; esac fi rm -rf conftest* else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <float.h> #include <stddef.h> #include <stdio.h> #include <string.h> #define NWORDS \ ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) typedef union { double value; unsigned int word[NWORDS]; } memory_double; static unsigned int ored_words[NWORDS]; static unsigned int anded_words[NWORDS]; static void add_to_ored_words (double x) { memory_double m; size_t i; /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ memset (&m, 0, sizeof (memory_double)); m.value = x; for (i = 0; i < NWORDS; i++) { ored_words[i] |= m.word[i]; anded_words[i] &= m.word[i]; } } int main () { size_t j; FILE *fp = fopen ("conftest.out", "w"); if (fp == NULL) return 1; for (j = 0; j < NWORDS; j++) anded_words[j] = ~ (unsigned int) 0; add_to_ored_words (0.25); add_to_ored_words (0.5); add_to_ored_words (1.0); add_to_ored_words (2.0); add_to_ored_words (4.0); /* Remove bits that are common (e.g. if representation of the first mantissa bit is explicit). */ for (j = 0; j < NWORDS; j++) ored_words[j] &= ~anded_words[j]; /* Now find the nonzero word. */ for (j = 0; j < NWORDS; j++) if (ored_words[j] != 0) break; if (j < NWORDS) { size_t i; for (i = j + 1; i < NWORDS; i++) if (ored_words[i] != 0) { fprintf (fp, "unknown"); return (fclose (fp) != 0); } for (i = 0; ; i++) if ((ored_words[j] >> i) & 1) { fprintf (fp, "word %d bit %d", (int) j, (int) i); return (fclose (fp) != 0); } } fprintf (fp, "unknown"); return (fclose (fp) != 0); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_cc_double_expbit0=`cat conftest.out` else $as_nop gl_cv_cc_double_expbit0="unknown" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.out fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_double_expbit0" >&5 printf "%s\n" "$gl_cv_cc_double_expbit0" >&6; } case "$gl_cv_cc_double_expbit0" in word*bit*) word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` printf "%s\n" "#define DBL_EXPBIT0_WORD $word" >>confdefs.h printf "%s\n" "#define DBL_EXPBIT0_BIT $bit" >>confdefs.h ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf truncates the result as in C99" >&5 printf %s "checking whether snprintf truncates the result as in C99... " >&6; } if test ${gl_cv_func_snprintf_truncation_c99+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; midnightbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on OpenBSD >= 3.9. openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) gl_cv_func_snprintf_truncation_c99="guessing no";; openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Solaris >= 2.6. solaris2.[0-5] | solaris2.[0-5].*) gl_cv_func_snprintf_truncation_c99="guessing no";; solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on HP-UX >= 11. hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on IRIX >= 6.5. irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on OSF/1 >= 5. osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_snprintf_truncation_c99="guessing no";; netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Android. linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess no on native Windows. mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #include <string.h> #if HAVE_SNPRINTF # define my_snprintf snprintf #else # include <stdarg.h> static int my_snprintf (char *buf, int size, const char *format, ...) { va_list args; int ret; va_start (args, format); ret = vsnprintf (buf, size, format, args); va_end (args); return ret; } #endif static char buf[100]; int main () { strcpy (buf, "ABCDEF"); my_snprintf (buf, 3, "%d %d", 4567, 89); if (memcmp (buf, "45\0DEF", 6) != 0) return 1; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_snprintf_truncation_c99=yes else $as_nop gl_cv_func_snprintf_truncation_c99=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_truncation_c99" >&5 printf "%s\n" "$gl_cv_func_snprintf_truncation_c99" >&6; } ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" if test "x$ac_cv_func_snprintf" = xyes then : printf "%s\n" "#define HAVE_SNPRINTF 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "strnlen" "ac_cv_func_strnlen" if test "x$ac_cv_func_strnlen" = xyes then : printf "%s\n" "#define HAVE_STRNLEN 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "wcslen" "ac_cv_func_wcslen" if test "x$ac_cv_func_wcslen" = xyes then : printf "%s\n" "#define HAVE_WCSLEN 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "wcsnlen" "ac_cv_func_wcsnlen" if test "x$ac_cv_func_wcsnlen" = xyes then : printf "%s\n" "#define HAVE_WCSNLEN 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "mbrtowc" "ac_cv_func_mbrtowc" if test "x$ac_cv_func_mbrtowc" = xyes then : printf "%s\n" "#define HAVE_MBRTOWC 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "wcrtomb" "ac_cv_func_wcrtomb" if test "x$ac_cv_func_wcrtomb" = xyes then : printf "%s\n" "#define HAVE_WCRTOMB 1" >>confdefs.h fi ac_fn_check_decl "$LINENO" "_snprintf" "ac_cv_have_decl__snprintf" "#include <stdio.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl__snprintf" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL__SNPRINTF $ac_have_decl" >>confdefs.h case "$gl_cv_func_snprintf_retval_c99" in *yes) printf "%s\n" "#define HAVE_SNPRINTF_RETVAL_C99 1" >>confdefs.h ;; esac case "$gl_cv_func_snprintf_truncation_c99" in *yes) printf "%s\n" "#define HAVE_SNPRINTF_TRUNCATION_C99 1" >>confdefs.h ;; esac if false; then GL_COND_LIBTOOL_TRUE= GL_COND_LIBTOOL_FALSE='#' else GL_COND_LIBTOOL_TRUE='#' GL_COND_LIBTOOL_FALSE= fi gl_cond_libtool=false gl_libdeps= gl_ltlibdeps= gl_m4_base='m4' gl_source_base='lib' if test $ac_cv_func_alloca_works = no; then : fi # Define an additional variable used in the Makefile substitution. if test $ac_cv_working_alloca_h = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca as a compiler built-in" >&5 printf %s "checking for alloca as a compiler built-in... " >&6; } if test ${gl_cv_rpl_alloca+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __GNUC__ || defined _AIX || defined _MSC_VER Need own alloca #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Need own alloca" >/dev/null 2>&1 then : gl_cv_rpl_alloca=yes else $as_nop gl_cv_rpl_alloca=no fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_rpl_alloca" >&5 printf "%s\n" "$gl_cv_rpl_alloca" >&6; } if test $gl_cv_rpl_alloca = yes; then printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h ALLOCA_H=alloca.h else ALLOCA_H= fi else ALLOCA_H=alloca.h fi if test -n "$ALLOCA_H"; then GL_GENERATE_ALLOCA_H_TRUE= GL_GENERATE_ALLOCA_H_FALSE='#' else GL_GENERATE_ALLOCA_H_TRUE='#' GL_GENERATE_ALLOCA_H_FALSE= fi if test $ac_cv_working_alloca_h = yes; then HAVE_ALLOCA_H=1 else HAVE_ALLOCA_H=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable assertions" >&5 printf %s "checking whether to enable assertions... " >&6; } # Check whether --enable-assert was given. if test ${enable_assert+y} then : enableval=$enable_assert; if test "x$enableval" = xno then : printf "%s\n" "#define NDEBUG 1" >>confdefs.h elif test "x$enableval" != xyes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-assert" >&5 printf "%s\n" "$as_me: WARNING: invalid argument supplied to --enable-assert" >&2;} enable_assert=yes fi else $as_nop enable_assert=yes fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_assert" >&5 printf "%s\n" "$enable_assert" >&6; } if test $ac_cv_func_btowc = no; then HAVE_BTOWC=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether btowc(0) is correct" >&5 printf %s "checking whether btowc(0) is correct... " >&6; } if test ${gl_cv_func_btowc_nul+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on Cygwin. cygwin*) gl_cv_func_btowc_nul="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_btowc_nul="guessing yes" ;; # Guess yes otherwise. *) gl_cv_func_btowc_nul="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> int main () { if (btowc ('\0') != 0) return 1; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_btowc_nul=yes else $as_nop gl_cv_func_btowc_nul=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_btowc_nul" >&5 printf "%s\n" "$gl_cv_func_btowc_nul" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether btowc(EOF) is correct" >&5 printf %s "checking whether btowc(EOF) is correct... " >&6; } if test ${gl_cv_func_btowc_eof+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on IRIX. irix*) gl_cv_func_btowc_eof="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_btowc_eof="guessing yes" ;; # Guess yes otherwise. *) gl_cv_func_btowc_eof="guessing yes" ;; esac if test $LOCALE_FR != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdio.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { if (btowc (EOF) != WEOF) return 1; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_btowc_eof=yes else $as_nop gl_cv_func_btowc_eof=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_btowc_eof" >&5 printf "%s\n" "$gl_cv_func_btowc_eof" >&6; } case "$gl_cv_func_btowc_nul" in *yes) ;; *) REPLACE_BTOWC=1 ;; esac case "$gl_cv_func_btowc_eof" in *yes) ;; *) REPLACE_BTOWC=1 ;; esac fi if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then gl_LIBOBJS="$gl_LIBOBJS btowc.$ac_objext" : fi GL_GNULIB_BTOWC=1 printf "%s\n" "#define GNULIB_TEST_BTOWC 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __builtin_expect" >&5 printf %s "checking for __builtin_expect... " >&6; } if test ${gl_cv___builtin_expect+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (int argc, char **argv) { argc = __builtin_expect (argc, 100); return argv[argc != 100][0]; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv___builtin_expect=yes else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <builtins.h> int main (int argc, char **argv) { argc = __builtin_expect (argc, 100); return argv[argc != 100][0]; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv___builtin_expect="in <builtins.h>" else $as_nop gl_cv___builtin_expect=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv___builtin_expect" >&5 printf "%s\n" "$gl_cv___builtin_expect" >&6; } if test "$gl_cv___builtin_expect" = yes; then printf "%s\n" "#define HAVE___BUILTIN_EXPECT 1" >>confdefs.h elif test "$gl_cv___builtin_expect" = "in <builtins.h>"; then printf "%s\n" "#define HAVE___BUILTIN_EXPECT 2" >>confdefs.h fi if test "$with_libsigsegv" = yes; then if test "$gl_cv_lib_sigsegv" = yes; then LIBCSTACK=$LIBSIGSEGV LTLIBCSTACK=$LTLIBSIGSEGV fi fi if test $REPLACE_CALLOC = 0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether calloc (0, n) and calloc (n, 0) return nonnull" >&5 printf %s "checking whether calloc (0, n) and calloc (n, 0) return nonnull... " >&6; } if test ${ac_cv_func_calloc_0_nonnull+y} then : printf %s "(cached) " >&6 else $as_nop if test $cross_compiling != yes; then ac_cv_func_calloc_0_nonnull=yes if test "$cross_compiling" = yes then : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { int result = 0; char * volatile p = calloc (0, 0); if (!p) result |= 1; free (p); return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : else $as_nop ac_cv_func_calloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; # Guess yes on musl systems. *-musl*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; # Guess yes on native Windows. mingw*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; esac fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_calloc_0_nonnull" >&5 printf "%s\n" "$ac_cv_func_calloc_0_nonnull" >&6; } case $ac_cv_func_calloc_0_nonnull in #( *yes) : ;; #( *) : REPLACE_CALLOC=1 ;; esac fi if test $REPLACE_CALLOC = 1; then gl_LIBOBJS="$gl_LIBOBJS calloc.$ac_objext" fi if test $REPLACE_MALLOC = 1; then REPLACE_CALLOC=1 fi if test $REPLACE_CALLOC = 1; then gl_LIBOBJS="$gl_LIBOBJS calloc.$ac_objext" fi GL_GNULIB_CALLOC_POSIX=1 printf "%s\n" "#define GNULIB_TEST_CALLOC_POSIX 1" >>confdefs.h GL_GNULIB_CHDIR=1 printf "%s\n" "#define GNULIB_TEST_CHDIR 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether this system supports file names of any length" >&5 printf %s "checking whether this system supports file names of any length... " >&6; } if test ${gl_cv_have_unlimited_file_name_length+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Arrange to define PATH_MAX, like "pathmax.h" does. */ #if HAVE_UNISTD_H # include <unistd.h> #endif #include <limits.h> #if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN # include <sys/param.h> #endif #if !defined PATH_MAX && defined MAXPATHLEN # define PATH_MAX MAXPATHLEN #endif #ifdef __hpux # undef PATH_MAX # define PATH_MAX 1024 #endif #if defined _WIN32 && ! defined __CYGWIN__ # undef PATH_MAX # define PATH_MAX 260 #endif #ifdef PATH_MAX have_arbitrary_file_name_length_limit #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "have_arbitrary_file_name_length_limit" >/dev/null 2>&1 then : gl_cv_have_unlimited_file_name_length=no else $as_nop gl_cv_have_unlimited_file_name_length=yes fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_unlimited_file_name_length" >&5 printf "%s\n" "$gl_cv_have_unlimited_file_name_length" >&6; } if test $gl_cv_have_unlimited_file_name_length = no; then gl_LIBOBJS="$gl_LIBOBJS chdir-long.$ac_objext" : fi printf "%s\n" "#define GNULIB_TEST_CLOEXEC 1" >>confdefs.h if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then REPLACE_CLOSE=1 fi if test $ac_cv_header_sys_socket_h != yes; then ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" if test "x$ac_cv_header_winsock2_h" = xyes then : printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h fi fi if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 UNISTD_H_HAVE_WINSOCK2_H=1 SYS_IOCTL_H_HAVE_WINSOCK2_H=1 else HAVE_WINSOCK2_H=0 fi if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then REPLACE_CLOSE=1 fi if test $REPLACE_CLOSE = 0; then if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi if test $HAVE_FCHDIR = 0; then REPLACE_CLOSE=1 fi fi if test $REPLACE_CLOSE = 1; then gl_LIBOBJS="$gl_LIBOBJS close.$ac_objext" fi GL_GNULIB_CLOSE=1 printf "%s\n" "#define GNULIB_TEST_CLOSE 1" >>confdefs.h printf "%s\n" "#define GNULIB_CLOSE_STREAM 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "closedir" "ac_cv_func_closedir" if test "x$ac_cv_func_closedir" = xyes then : printf "%s\n" "#define HAVE_CLOSEDIR 1" >>confdefs.h fi if test $ac_cv_func_closedir = no; then HAVE_CLOSEDIR=0 fi if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi if test $HAVE_FCHDIR = 0; then if test $HAVE_CLOSEDIR = 1; then REPLACE_CLOSEDIR=1 fi fi case $host_os,$HAVE_CLOSEDIR in os2*,1) REPLACE_CLOSEDIR=1;; esac if test $HAVE_CLOSEDIR = 0 || test $REPLACE_CLOSEDIR = 1; then gl_LIBOBJS="$gl_LIBOBJS closedir.$ac_objext" fi GL_GNULIB_CLOSEDIR=1 printf "%s\n" "#define GNULIB_TEST_CLOSEDIR 1" >>confdefs.h if test "x$lispdir" = x; then lispdir='${datarootdir}/emacs/site-lisp' fi if test "x$runstatedir" = x; then runstatedir='${localstatedir}/run' fi pkglibexecdir='${libexecdir}/${PACKAGE}' : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for d_ino member in directory struct" >&5 printf %s "checking for d_ino member in directory struct... " >&6; } if test ${gl_cv_struct_dirent_d_ino+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems with Linux kernel. linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;; # Guess yes on musl systems with Linux kernel. linux*-musl*) gl_cv_struct_dirent_d_ino="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_struct_dirent_d_ino="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_struct_dirent_d_ino="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> int main (void) { DIR *dp = opendir ("."); struct dirent *e; struct stat st; if (! dp) return 1; e = readdir (dp); if (! e) { closedir (dp); return 2; } if (lstat (e->d_name, &st) != 0) { closedir (dp); return 3; } if (e->d_ino != st.st_ino) { closedir (dp); return 4; } closedir (dp); return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_struct_dirent_d_ino=yes else $as_nop gl_cv_struct_dirent_d_ino=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_struct_dirent_d_ino" >&5 printf "%s\n" "$gl_cv_struct_dirent_d_ino" >&6; } case "$gl_cv_struct_dirent_d_ino" in *yes) printf "%s\n" "#define D_INO_IN_DIRENT 1" >>confdefs.h ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for d_type member in directory struct" >&5 printf %s "checking for d_type member in directory struct... " >&6; } if test ${gl_cv_struct_dirent_d_type+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <dirent.h> int main (void) { struct dirent dp; dp.d_type = 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_struct_dirent_d_type=yes else $as_nop gl_cv_struct_dirent_d_type=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_struct_dirent_d_type" >&5 printf "%s\n" "$gl_cv_struct_dirent_d_type" >&6; } if test $gl_cv_struct_dirent_d_type = yes; then printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_TYPE 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "dirfd" "ac_cv_func_dirfd" if test "x$ac_cv_func_dirfd" = xyes then : printf "%s\n" "#define HAVE_DIRFD 1" >>confdefs.h fi ac_fn_check_decl "$LINENO" "dirfd" "ac_cv_have_decl_dirfd" "#include <sys/types.h> #include <dirent.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_dirfd" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_DIRFD $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_dirfd = no; then HAVE_DECL_DIRFD=0 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether dirfd is a macro" >&5 printf %s "checking whether dirfd is a macro... " >&6; } if test ${gl_cv_func_dirfd_macro+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <dirent.h> #ifdef dirfd dirent_header_defines_dirfd #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "dirent_header_defines_dirfd" >/dev/null 2>&1 then : gl_cv_func_dirfd_macro=yes else $as_nop gl_cv_func_dirfd_macro=no fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dirfd_macro" >&5 printf "%s\n" "$gl_cv_func_dirfd_macro" >&6; } # Use the replacement if we have no function or macro with that name, # or if OS/2 kLIBC whose dirfd() does not work. # Replace only if the system declares dirfd already. case $ac_cv_func_dirfd,$gl_cv_func_dirfd_macro,$host_os,$ac_cv_have_decl_dirfd in no,no,*,yes | *,*,os2*,yes) REPLACE_DIRFD=1 printf "%s\n" "#define REPLACE_DIRFD 1" >>confdefs.h ;; esac if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no \ || test $REPLACE_DIRFD = 1; then gl_LIBOBJS="$gl_LIBOBJS dirfd.$ac_objext" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to get the file descriptor associated with an open DIR*" >&5 printf %s "checking how to get the file descriptor associated with an open DIR*... " >&6; } if test ${gl_cv_sys_dir_fd_member_name+y} then : printf %s "(cached) " >&6 else $as_nop dirfd_save_CFLAGS=$CFLAGS for ac_expr in d_fd dd_fd; do CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <dirent.h> int main (void) { DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : dir_fd_found=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$dirfd_save_CFLAGS test "$dir_fd_found" = yes && break done test "$dir_fd_found" = yes || ac_expr=no_such_member gl_cv_sys_dir_fd_member_name=$ac_expr fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_dir_fd_member_name" >&5 printf "%s\n" "$gl_cv_sys_dir_fd_member_name" >&6; } if test $gl_cv_sys_dir_fd_member_name != no_such_member; then printf "%s\n" "#define DIR_FD_MEMBER_NAME $gl_cv_sys_dir_fd_member_name" >>confdefs.h fi fi GL_GNULIB_DIRFD=1 printf "%s\n" "#define GNULIB_TEST_DIRFD 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether // is distinct from /" >&5 printf %s "checking whether // is distinct from /... " >&6; } if test ${gl_cv_double_slash_root+y} then : printf %s "(cached) " >&6 else $as_nop if test x"$cross_compiling" = xyes ; then # When cross-compiling, there is no way to tell whether // is special # short of a list of hosts. However, the only known hosts to date # that have a distinct // are Apollo DomainOS (too old to port to), # Cygwin, and z/OS. If anyone knows of another system for which // has # special semantics and is distinct from /, please report it to # <bug-gnulib@gnu.org>. case $host in *-cygwin | i370-ibm-openedition) gl_cv_double_slash_root=yes ;; *) # Be optimistic and assume that / and // are the same when we # don't know. gl_cv_double_slash_root='unknown, assuming no' ;; esac else set x `ls -di / // 2>/dev/null` if test "$2" = "$4" && wc //dev/null >/dev/null 2>&1; then gl_cv_double_slash_root=no else gl_cv_double_slash_root=yes fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_double_slash_root" >&5 printf "%s\n" "$gl_cv_double_slash_root" >&6; } if test "$gl_cv_double_slash_root" = yes; then printf "%s\n" "#define DOUBLE_SLASH_IS_DISTINCT_ROOT 1" >>confdefs.h fi if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then REPLACE_DUP=1 fi if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi if test $HAVE_FCHDIR = 0; then REPLACE_DUP=1 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether dup works" >&5 printf %s "checking whether dup works... " >&6; } if test ${gl_cv_func_dup_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on native Windows. mingw*) gl_cv_func_dup_works="guessing no" ;; *) gl_cv_func_dup_works="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> #include <fcntl.h> #include <errno.h> $gl_mda_defines int main (void) { /* On OS/2 kLIBC, dup does not work on a directory fd. */ int fd = open (".", O_RDONLY); return fd < 0 ? 1 : dup (fd) < 0 ? 2 : 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_dup_works=yes else $as_nop gl_cv_func_dup_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dup_works" >&5 printf "%s\n" "$gl_cv_func_dup_works" >&6; } case "$gl_cv_func_dup_works" in *yes) ;; *) REPLACE_DUP=1 ;; esac if test $REPLACE_DUP = 1; then gl_LIBOBJS="$gl_LIBOBJS dup.$ac_objext" : fi GL_GNULIB_DUP=1 printf "%s\n" "#define GNULIB_TEST_DUP 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether dup2 works" >&5 printf %s "checking whether dup2 works... " >&6; } if test ${gl_cv_func_dup2_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in mingw*) # on this platform, dup2 always returns 0 for success gl_cv_func_dup2_works="guessing no" ;; cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 gl_cv_func_dup2_works="guessing no" ;; aix* | freebsd*) # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, # not EBADF. gl_cv_func_dup2_works="guessing no" ;; haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. gl_cv_func_dup2_works="guessing no" ;; *-android*) # implemented using dup3(), which fails if oldfd == newfd gl_cv_func_dup2_works="guessing no" ;; os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd. gl_cv_func_dup2_works="guessing no" ;; *) gl_cv_func_dup2_works="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #include <fcntl.h> #include <limits.h> #include <sys/resource.h> #include <unistd.h> $gl_mda_defines #ifndef RLIM_SAVED_CUR # define RLIM_SAVED_CUR RLIM_INFINITY #endif #ifndef RLIM_SAVED_MAX # define RLIM_SAVED_MAX RLIM_INFINITY #endif int main (void) { int result = 0; int bad_fd = INT_MAX; struct rlimit rlim; if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX && rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur != RLIM_SAVED_MAX && rlim.rlim_cur != RLIM_SAVED_CUR) bad_fd = rlim.rlim_cur; #ifdef FD_CLOEXEC if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) result |= 1; #endif if (dup2 (1, 1) != 1) result |= 2; #ifdef FD_CLOEXEC if (fcntl (1, F_GETFD) != FD_CLOEXEC) result |= 4; #endif close (0); if (dup2 (0, 0) != -1) result |= 8; /* Many gnulib modules require POSIX conformance of EBADF. */ if (dup2 (2, bad_fd) == -1 && errno != EBADF) result |= 16; /* Flush out some cygwin core dumps. */ if (dup2 (2, -1) != -1 || errno != EBADF) result |= 32; dup2 (2, 255); dup2 (2, 256); /* On OS/2 kLIBC, dup2() does not work on a directory fd. */ { int fd = open (".", O_RDONLY); if (fd == -1) result |= 64; else if (dup2 (fd, fd + 1) == -1) result |= 128; close (fd); } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_dup2_works=yes else $as_nop gl_cv_func_dup2_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dup2_works" >&5 printf "%s\n" "$gl_cv_func_dup2_works" >&6; } case "$gl_cv_func_dup2_works" in *yes) ;; *) REPLACE_DUP2=1 ac_fn_c_check_func "$LINENO" "setdtablesize" "ac_cv_func_setdtablesize" if test "x$ac_cv_func_setdtablesize" = xyes then : printf "%s\n" "#define HAVE_SETDTABLESIZE 1" >>confdefs.h fi ;; esac if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi if test $HAVE_FCHDIR = 0; then REPLACE_DUP2=1 fi if test $REPLACE_DUP2 = 1; then gl_LIBOBJS="$gl_LIBOBJS dup2.$ac_objext" fi GL_GNULIB_DUP2=1 printf "%s\n" "#define GNULIB_TEST_DUP2 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 printf %s "checking for error_at_line... " >&6; } if test ${ac_cv_lib_error_at_line+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <error.h> int main (void) { error_at_line (0, 0, "", 0, "an error occurred"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_error_at_line=yes else $as_nop ac_cv_lib_error_at_line=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 printf "%s\n" "$ac_cv_lib_error_at_line" >&6; } if test $ac_cv_lib_error_at_line = no; then gl_LIBOBJS="$gl_LIBOBJS error.$ac_objext" : fi XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=error:3:c-format" XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=error_at_line:5:c-format" if test $ac_cv_have_decl_fchdir = no; then HAVE_DECL_FCHDIR=0 fi if test $HAVE_FCHDIR = 0; then gl_LIBOBJS="$gl_LIBOBJS fchdir.$ac_objext" : printf "%s\n" "#define REPLACE_FCHDIR 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether open can visit directories" >&5 printf %s "checking whether open can visit directories... " >&6; } if test ${gl_cv_func_open_directory_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_open_directory_works="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_open_directory_works="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_open_directory_works="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_open_directory_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <fcntl.h> $gl_mda_defines int main (void) { return open(".", O_RDONLY) < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_open_directory_works=yes else $as_nop gl_cv_func_open_directory_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_directory_works" >&5 printf "%s\n" "$gl_cv_func_open_directory_works" >&6; } case "$gl_cv_func_open_directory_works" in *yes) ;; *) printf "%s\n" "#define REPLACE_OPEN_DIRECTORY 1" >>confdefs.h ;; esac fi GL_GNULIB_FCHDIR=1 printf "%s\n" "#define GNULIB_TEST_FCHDIR 1" >>confdefs.h if test $ac_cv_func_fcntl = no; then if test $ac_cv_func_fcntl = no; then HAVE_FCNTL=0 else REPLACE_FCNTL=1 fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fcntl handles F_DUPFD correctly" >&5 printf %s "checking whether fcntl handles F_DUPFD correctly... " >&6; } if test ${gl_cv_func_fcntl_f_dupfd_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case $host_os in aix* | cygwin* | haiku*) gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #include <fcntl.h> #include <limits.h> #include <sys/resource.h> #include <unistd.h> $gl_mda_defines #ifndef RLIM_SAVED_CUR # define RLIM_SAVED_CUR RLIM_INFINITY #endif #ifndef RLIM_SAVED_MAX # define RLIM_SAVED_MAX RLIM_INFINITY #endif int main (void) { int result = 0; int bad_fd = INT_MAX; struct rlimit rlim; if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX && rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur != RLIM_SAVED_MAX && rlim.rlim_cur != RLIM_SAVED_CUR) bad_fd = rlim.rlim_cur; if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; if (errno != EINVAL) result |= 2; if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; if (errno != EINVAL) result |= 8; /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */ { int fd; fd = open (".", O_RDONLY); if (fd == -1) result |= 16; else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1) result |= 32; close (fd); } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_fcntl_f_dupfd_works=yes else $as_nop gl_cv_func_fcntl_f_dupfd_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fcntl_f_dupfd_works" >&5 printf "%s\n" "$gl_cv_func_fcntl_f_dupfd_works" >&6; } case $gl_cv_func_fcntl_f_dupfd_works in *yes) ;; *) if test $ac_cv_func_fcntl = no; then HAVE_FCNTL=0 else REPLACE_FCNTL=1 fi printf "%s\n" "#define FCNTL_DUPFD_BUGGY 1" >>confdefs.h ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fcntl understands F_DUPFD_CLOEXEC" >&5 printf %s "checking whether fcntl understands F_DUPFD_CLOEXEC... " >&6; } if test ${gl_cv_func_fcntl_f_dupfd_cloexec+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on NetBSD. netbsd*) gl_cv_func_fcntl_f_dupfd_cloexec="guessing no" ;; *) gl_cv_func_fcntl_f_dupfd_cloexec="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <fcntl.h> #include <unistd.h> int main (int argc, char *argv[]) { if (argc == 1) /* parent process */ { if (fcntl (1, F_DUPFD_CLOEXEC, 10) < 0) return 1; return execl ("./conftest", "./conftest", "child", NULL); } else /* child process */ return (fcntl (10, F_GETFL) < 0 ? 0 : 42); } _ACEOF if ac_fn_c_try_run "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __linux__ /* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace it to support the semantics on older kernels that failed with EINVAL. */ choke me #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_fcntl_f_dupfd_cloexec=yes else $as_nop gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop gl_cv_func_fcntl_f_dupfd_cloexec=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fcntl_f_dupfd_cloexec" >&5 printf "%s\n" "$gl_cv_func_fcntl_f_dupfd_cloexec" >&6; } case "$gl_cv_func_fcntl_f_dupfd_cloexec" in *yes) ;; *) if test $ac_cv_func_fcntl = no; then HAVE_FCNTL=0 else REPLACE_FCNTL=1 fi ;; esac fi if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi if test $HAVE_FCHDIR = 0; then if test $ac_cv_func_fcntl = no; then HAVE_FCNTL=0 else REPLACE_FCNTL=1 fi fi if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then gl_LIBOBJS="$gl_LIBOBJS fcntl.$ac_objext" fi GL_GNULIB_FCNTL=1 printf "%s\n" "#define GNULIB_TEST_FCNTL 1" >>confdefs.h printf "%s\n" "#define GNULIB_FCNTL_SAFER 1" >>confdefs.h printf "%s\n" "#define GNULIB_FD_SAFER_FLAG 1" >>confdefs.h ac_fn_check_decl "$LINENO" "fdopendir" "ac_cv_have_decl_fdopendir" " #include <dirent.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_fdopendir" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FDOPENDIR $ac_have_decl" >>confdefs.h if test $ac_have_decl = 1 then : else $as_nop HAVE_DECL_FDOPENDIR=0 fi if test $ac_cv_func_fdopendir = no; then HAVE_FDOPENDIR=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fdopendir works" >&5 printf %s "checking whether fdopendir works... " >&6; } if test ${gl_cv_func_fdopendir_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_fdopendir_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <dirent.h> #include <fcntl.h> #include <unistd.h> $gl_mda_defines #if !HAVE_DECL_FDOPENDIR extern # ifdef __cplusplus "C" # endif DIR *fdopendir (int); #endif int main (void) { int result = 0; int fd = open ("conftest.c", O_RDONLY); if (fd < 0) result |= 1; if (fdopendir (fd)) result |= 2; if (close (fd)) result |= 4; return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_fdopendir_works=yes else $as_nop gl_cv_func_fdopendir_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fdopendir_works" >&5 printf "%s\n" "$gl_cv_func_fdopendir_works" >&6; } case "$gl_cv_func_fdopendir_works" in *yes) ;; *) REPLACE_FDOPENDIR=1 ;; esac fi if test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1; then gl_LIBOBJS="$gl_LIBOBJS fdopendir.$ac_objext" fi GL_GNULIB_FDOPENDIR=1 printf "%s\n" "#define GNULIB_TEST_FDOPENDIR 1" >>confdefs.h printf "%s\n" "#define GNULIB_FDOPENDIR 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for flexible array member" >&5 printf %s "checking for flexible array member... " >&6; } if test ${ac_cv_c_flexmember+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <stdio.h> #include <stddef.h> struct m { struct m *next, **list; char name[]; }; struct s { struct s *p; struct m *m; int n; double d[]; }; int main (void) { int m = getchar (); size_t nbytes = offsetof (struct s, d) + m * sizeof (double); nbytes += sizeof (struct s) - 1; nbytes -= nbytes % sizeof (struct s); struct s *p = malloc (nbytes); p->p = p; p->m = NULL; p->d[0] = 0.0; return p->d != (double *) NULL; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_flexmember=yes else $as_nop ac_cv_c_flexmember=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_flexmember" >&5 printf "%s\n" "$ac_cv_c_flexmember" >&6; } if test $ac_cv_c_flexmember = yes; then printf "%s\n" "#define FLEXIBLE_ARRAY_MEMBER /**/" >>confdefs.h else printf "%s\n" "#define FLEXIBLE_ARRAY_MEMBER 1" >>confdefs.h fi gl_fnmatch_required_lowercase=` echo $gl_fnmatch_required | LC_ALL=C tr '[A-Z]' '[a-z]' ` if test $ac_cv_func_fnmatch = no; then HAVE_FNMATCH=0 else gl_fnmatch_cache_var="gl_cv_func_fnmatch_${gl_fnmatch_required_lowercase}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working $gl_fnmatch_required fnmatch" >&5 printf %s "checking for working $gl_fnmatch_required fnmatch... " >&6; } if eval test \${$gl_fnmatch_cache_var+y} then : printf %s "(cached) " >&6 else $as_nop if test $gl_fnmatch_required = GNU; then gl_fnmatch_gnu_start= gl_fnmatch_gnu_end= else gl_fnmatch_gnu_start='#if 0' gl_fnmatch_gnu_end='#endif' fi if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on musl systems. *-musl*) eval "$gl_fnmatch_cache_var=\"guessing yes\"" ;; # Guess no otherwise, even on glibc systems. *) eval "$gl_fnmatch_cache_var=\"guessing no\"" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <fnmatch.h> static int y (char const *pattern, char const *string, int flags) { return fnmatch (pattern, string, flags) == 0; } static int n (char const *pattern, char const *string, int flags) { return fnmatch (pattern, string, flags) == FNM_NOMATCH; } int main (void) { char const *Apat = 'A' < '\\\\' ? "[A-\\\\\\\\]" : "[\\\\\\\\-A]"; char const *apat = 'a' < '\\\\' ? "[a-\\\\\\\\]" : "[\\\\\\\\-a]"; static char const A_1[] = { 'A' - 1, 0 }; static char const A01[] = { 'A' + 1, 0 }; static char const a_1[] = { 'a' - 1, 0 }; static char const a01[] = { 'a' + 1, 0 }; static char const bs_1[] = { '\\\\' - 1, 0 }; static char const bs01[] = { '\\\\' + 1, 0 }; int result = 0; if (!n ("a*", "", 0)) return 1; if (!y ("a*", "abc", 0)) return 1; if (!y ("[/b", "[/b", 0)) /*"]]"*/ /* glibc Bugzilla bug 12378 */ return 1; if (!n ("d*/*1", "d/s/1", FNM_PATHNAME)) return 2; if (!y ("a\\\\bc", "abc", 0)) return 3; if (!n ("a\\\\bc", "abc", FNM_NOESCAPE)) return 3; if (!y ("*x", ".x", 0)) return 4; if (!n ("*x", ".x", FNM_PERIOD)) return 4; if (!y (Apat, "\\\\", 0)) return 5; if (!y (Apat, "A", 0)) return 5; if (!y (apat, "\\\\", 0)) return 5; if (!y (apat, "a", 0)) return 5; if (!(n (Apat, A_1, 0) == ('A' < '\\\\'))) return 5; if (!(n (apat, a_1, 0) == ('a' < '\\\\'))) return 5; if (!(y (Apat, A01, 0) == ('A' < '\\\\'))) return 5; if (!(y (apat, a01, 0) == ('a' < '\\\\'))) return 5; if (!(y (Apat, bs_1, 0) == ('A' < '\\\\'))) return 5; if (!(y (apat, bs_1, 0) == ('a' < '\\\\'))) return 5; if (!(n (Apat, bs01, 0) == ('A' < '\\\\'))) return 5; if (!(n (apat, bs01, 0) == ('a' < '\\\\'))) return 5; $gl_fnmatch_gnu_start if (!y ("xxXX", "xXxX", FNM_CASEFOLD)) result |= 8; if (!y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)) result |= 16; if (!n ("d*/*1", "d/s/1", FNM_FILE_NAME)) result |= 32; if (!y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)) result |= 64; if (!y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)) result |= 64; if (!y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)) result |= 64; $gl_fnmatch_gnu_end return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : eval "$gl_fnmatch_cache_var=yes" else $as_nop eval "$gl_fnmatch_cache_var=no" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi eval ac_res=\$$gl_fnmatch_cache_var { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval "gl_fnmatch_result=\"\$$gl_fnmatch_cache_var\"" case "$gl_fnmatch_result" in *yes) ;; *) REPLACE_FNMATCH=1 ;; esac fi if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then FNMATCH_H='fnmatch.h' if test -n "$FNMATCH_H"; then GL_GENERATE_FNMATCH_H_TRUE= GL_GENERATE_FNMATCH_H_FALSE='#' else GL_GENERATE_FNMATCH_H_TRUE='#' GL_GENERATE_FNMATCH_H_FALSE= fi fi if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then gl_LIBOBJS="$gl_LIBOBJS fnmatch.$ac_objext" fi GL_GNULIB_FNMATCH=1 printf "%s\n" "#define GNULIB_TEST_FNMATCH 1" >>confdefs.h case "$host_os" in mingw* | pw*) REPLACE_FOPEN=1 gl_cv_func_fopen_slash="guessing no" ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fopen recognizes a trailing slash" >&5 printf %s "checking whether fopen recognizes a trailing slash... " >&6; } if test ${gl_cv_func_fopen_slash+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) gl_cv_func_fopen_slash="guessing no" ;; *) gl_cv_func_fopen_slash="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> #include <stdio.h> int main () { FILE *fp = fopen ("conftest.sl/", "w"); int result = (fp != NULL); if (fp != NULL) fclose (fp); return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_fopen_slash=yes else $as_nop gl_cv_func_fopen_slash=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.sl fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fopen_slash" >&5 printf "%s\n" "$gl_cv_func_fopen_slash" >&6; } ;; esac case "$gl_cv_func_fopen_slash" in *no) printf "%s\n" "#define FOPEN_TRAILING_SLASH_BUG 1" >>confdefs.h REPLACE_FOPEN=1 ;; esac if test $REPLACE_FOPEN = 1; then gl_LIBOBJS="$gl_LIBOBJS fopen.$ac_objext" : fi GL_GNULIB_FOPEN=1 printf "%s\n" "#define GNULIB_TEST_FOPEN 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fopen supports the mode character 'x'" >&5 printf %s "checking whether fopen supports the mode character 'x'... " >&6; } if test ${gl_cv_func_fopen_mode_x+y} then : printf %s "(cached) " >&6 else $as_nop rm -f conftest.x if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc and musl systems. linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) gl_cv_func_fopen_mode_x="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_fopen_mode_x="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #include <errno.h> int main () { FILE *fp; fp = fopen ("conftest.x", "w"); fclose (fp); fp = fopen ("conftest.x", "wx"); if (fp != NULL) /* 'x' ignored */ return 1; else if (errno == EEXIST) return 0; else /* 'x' rejected */ return 2; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_fopen_mode_x=yes else $as_nop gl_cv_func_fopen_mode_x=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.x fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fopen_mode_x" >&5 printf "%s\n" "$gl_cv_func_fopen_mode_x" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fopen supports the mode character 'e'" >&5 printf %s "checking whether fopen supports the mode character 'e'... " >&6; } if test ${gl_cv_func_fopen_mode_e+y} then : printf %s "(cached) " >&6 else $as_nop echo foo > conftest.x if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc and musl systems. linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) gl_cv_func_fopen_mode_e="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_fopen_mode_e="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_fopen_mode_e="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #include <errno.h> #include <fcntl.h> $gl_mda_defines int main () { FILE *fp = fopen ("conftest.x", "re"); if (fp != NULL) { if (fcntl (fileno (fp), F_GETFD) & FD_CLOEXEC) return 0; else /* 'e' ignored */ return 1; } else /* 'e' rejected */ return 2; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_fopen_mode_e=yes else $as_nop gl_cv_func_fopen_mode_e=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.x fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fopen_mode_e" >&5 printf "%s\n" "$gl_cv_func_fopen_mode_e" >&6; } case "$gl_cv_func_fopen_mode_x" in *no) REPLACE_FOPEN=1 ;; esac case "$gl_cv_func_fopen_mode_e" in *no) REPLACE_FOPEN=1 ;; esac if test $REPLACE_FOPEN = 1; then gl_LIBOBJS="$gl_LIBOBJS fopen.$ac_objext" : fi printf "%s\n" "#define GNULIB_FOPEN_GNU 1" >>confdefs.h fp_headers=' #include <stdio.h> #if HAVE_STDIO_EXT_H # include <stdio_ext.h> #endif ' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __fpending" >&5 printf %s "checking for __fpending... " >&6; } if test ${gl_cv_func___fpending+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $fp_headers int main (void) { return ! __fpending (stdin); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_func___fpending=yes else $as_nop gl_cv_func___fpending=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func___fpending" >&5 printf "%s\n" "$gl_cv_func___fpending" >&6; } if test $gl_cv_func___fpending = yes; then ac_fn_check_decl "$LINENO" "__fpending" "ac_cv_have_decl___fpending" "$fp_headers " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl___fpending" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL___FPENDING $ac_have_decl" >>confdefs.h fi if test $gl_cv_func___fpending = no; then gl_LIBOBJS="$gl_LIBOBJS fpending.$ac_objext" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether free is known to preserve errno" >&5 printf %s "checking whether free is known to preserve errno... " >&6; } if test ${gl_cv_func_free_preserves_errno+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> int main (void) { #if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__) #elif defined __OpenBSD__ #elif defined __sun #else #error "'free' is not known to preserve errno" #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_free_preserves_errno=yes else $as_nop gl_cv_func_free_preserves_errno=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_free_preserves_errno" >&5 printf "%s\n" "$gl_cv_func_free_preserves_errno" >&6; } case $gl_cv_func_free_preserves_errno in *yes) printf "%s\n" "#define HAVE_FREE_POSIX 1" >>confdefs.h ;; *) REPLACE_FREE=1 ;; esac if test $REPLACE_FREE = 1; then gl_LIBOBJS="$gl_LIBOBJS free.$ac_objext" : fi GL_GNULIB_FREE_POSIX=1 printf "%s\n" "#define GNULIB_TEST_FREE_POSIX 1" >>confdefs.h case "$host_os" in mingw* | solaris*) REPLACE_FSTAT=1 ;; esac if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi if test $HAVE_FCHDIR = 0; then case "$gl_cv_func_open_directory_works" in *yes) ;; *) REPLACE_FSTAT=1 ;; esac fi if test $REPLACE_FSTAT = 1; then gl_LIBOBJS="$gl_LIBOBJS fstat.$ac_objext" case "$host_os" in mingw*) gl_LIBOBJS="$gl_LIBOBJS stat-w32.$ac_objext" ;; esac : fi GL_GNULIB_FSTAT=1 printf "%s\n" "#define GNULIB_TEST_FSTAT 1" >>confdefs.h if test $ac_cv_func_fstatat = no; then HAVE_FSTATAT=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fstatat (..., 0) works" >&5 printf %s "checking whether fstatat (..., 0) works... " >&6; } if test ${gl_cv_func_fstatat_zero_flag+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in aix*) gl_cv_func_fstatat_zero_flag="guessing no";; *) gl_cv_func_fstatat_zero_flag="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <fcntl.h> #include <sys/stat.h> int main (void) { struct stat a; return fstatat (AT_FDCWD, ".", &a, 0) != 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_fstatat_zero_flag=yes else $as_nop gl_cv_func_fstatat_zero_flag=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fstatat_zero_flag" >&5 printf "%s\n" "$gl_cv_func_fstatat_zero_flag" >&6; } case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in *yes+*yes) ;; *) REPLACE_FSTATAT=1 ;; esac case $host_os in solaris*) REPLACE_FSTATAT=1 ;; esac case $REPLACE_FSTATAT,$gl_cv_func_fstatat_zero_flag in 1,*yes) printf "%s\n" "#define HAVE_WORKING_FSTATAT_ZERO_FLAG 1" >>confdefs.h ;; esac fi if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then gl_LIBOBJS="$gl_LIBOBJS fstatat.$ac_objext" fi GL_GNULIB_FSTATAT=1 printf "%s\n" "#define GNULIB_TEST_FSTATAT 1" >>confdefs.h case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink+$gl_cv_macro_O_CLOEXEC in yes+*yes+yes) ;; yes+*) # Solaris 10 lacks O_CLOEXEC. # Solaris 9 has *at functions, but uniformly mishandles trailing # slash in all of them. REPLACE_OPENAT=1 ;; *) HAVE_OPENAT=0 ;; esac if test "$ac_cv_func_fstatfs,$ac_cv_header_sys_vfs_h" = yes,yes; then ac_fn_c_check_member "$LINENO" "struct statfs" "f_type" "ac_cv_member_struct_statfs_f_type" "$ac_includes_default #include <sys/vfs.h> " if test "x$ac_cv_member_struct_statfs_f_type" = xyes then : printf "%s\n" "#define HAVE_STRUCT_STATFS_F_TYPE 1" >>confdefs.h fi if test "$ac_cv_member_struct_statfs_f_type" = yes; then ac_fn_c_check_type "$LINENO" "__fsword_t" "ac_cv_type___fsword_t" "$ac_includes_default #include <sys/vfs.h> " if test "x$ac_cv_type___fsword_t" = xyes then : printf "%s\n" "#define HAVE___FSWORD_T 1" >>confdefs.h fi fi fi ac_fn_c_check_func "$LINENO" "fts_open" "ac_cv_func_fts_open" if test "x$ac_cv_func_fts_open" = xyes then : fi if test $ac_cv_func_fts_open = yes; then printf "%s\n" "#define fts_open rpl_fts_open" >>confdefs.h printf "%s\n" "#define fts_close rpl_fts_close" >>confdefs.h printf "%s\n" "#define fts_read rpl_fts_read" >>confdefs.h printf "%s\n" "#define fts_set rpl_fts_set" >>confdefs.h printf "%s\n" "#define fts_children rpl_fts_children" >>confdefs.h printf "%s\n" "#define fts_cross_check rpl_fts_cross_check" >>confdefs.h fi gl_LIBOBJS="$gl_LIBOBJS fts.$ac_objext" case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in *yes,yes) ;; *) REPLACE_GETCWD=1 ;; esac if test $REPLACE_GETCWD = 1; then gl_LIBOBJS="$gl_LIBOBJS getcwd-lgpl.$ac_objext" fi GL_GNULIB_GETCWD=1 printf "%s\n" "#define GNULIB_TEST_GETCWD 1" >>confdefs.h if test $ac_cv_func_getdtablesize = yes && test $ac_cv_have_decl_getdtablesize = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getdtablesize works" >&5 printf %s "checking whether getdtablesize works... " >&6; } if test ${gl_cv_func_getdtablesize_works+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in vms*) gl_cv_func_getdtablesize_works="no (limitation)" ;; *) if test "$cross_compiling" = yes then : case "$host_os" in cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows gl_cv_func_getdtablesize_works="guessing no" ;; *) gl_cv_func_getdtablesize_works="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> $gl_mda_defines int main (void) { int size = getdtablesize(); if (dup2 (0, getdtablesize()) != -1) return 1; if (size != getdtablesize()) return 2; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_getdtablesize_works=yes else $as_nop gl_cv_func_getdtablesize_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getdtablesize_works" >&5 printf "%s\n" "$gl_cv_func_getdtablesize_works" >&6; } case "$gl_cv_func_getdtablesize_works" in *yes | "no (limitation)") ;; *) REPLACE_GETDTABLESIZE=1 ;; esac else HAVE_GETDTABLESIZE=0 fi if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then gl_LIBOBJS="$gl_LIBOBJS getdtablesize.$ac_objext" : fi GL_GNULIB_GETDTABLESIZE=1 printf "%s\n" "#define GNULIB_TEST_GETDTABLESIZE 1" >>confdefs.h REPLACE_GETOPT=0 if test -n "$gl_replace_getopt"; then REPLACE_GETOPT=1 fi if test $REPLACE_GETOPT = 1; then if test $ac_cv_header_sys_cdefs_h = yes; then HAVE_SYS_CDEFS_H=1 else HAVE_SYS_CDEFS_H=0 fi printf "%s\n" "#define __GETOPT_PREFIX rpl_" >>confdefs.h GETOPT_H=getopt.h GETOPT_CDEFS_H=getopt-cdefs.h fi if test $REPLACE_GETOPT = 1; then gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext" gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext" GL_GNULIB_UNISTD_H_GETOPT=1 fi GL_GNULIB_GETOPT_POSIX=1 printf "%s\n" "#define GNULIB_TEST_GETOPT_POSIX 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for getpagesize" >&5 printf %s "checking for getpagesize... " >&6; } if test ${gl_cv_func_getpagesize+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> int main (void) { return getpagesize(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_func_getpagesize=yes else $as_nop gl_cv_func_getpagesize=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getpagesize" >&5 printf "%s\n" "$gl_cv_func_getpagesize" >&6; } if test $gl_cv_func_getpagesize = no; then HAVE_GETPAGESIZE=0 ac_fn_c_check_header_compile "$LINENO" "OS.h" "ac_cv_header_OS_h" "$ac_includes_default" if test "x$ac_cv_header_OS_h" = xyes then : printf "%s\n" "#define HAVE_OS_H 1" >>confdefs.h fi if test $ac_cv_header_OS_h = yes; then HAVE_OS_H=1 fi ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" if test "x$ac_cv_header_sys_param_h" = xyes then : printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h fi if test $ac_cv_header_sys_param_h = yes; then HAVE_SYS_PARAM_H=1 fi fi case "$host_os" in mingw*) REPLACE_GETPAGESIZE=1 ;; esac ac_fn_check_decl "$LINENO" "getpagesize" "ac_cv_have_decl_getpagesize" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_getpagesize" = xyes then : else $as_nop HAVE_DECL_GETPAGESIZE=0 fi if test $REPLACE_GETPAGESIZE = 1; then gl_LIBOBJS="$gl_LIBOBJS getpagesize.$ac_objext" fi GL_GNULIB_GETPAGESIZE=1 printf "%s\n" "#define GNULIB_TEST_GETPAGESIZE 1" >>confdefs.h ac_found=0 ac_fn_check_decl "$LINENO" "program_invocation_name" "ac_cv_have_decl_program_invocation_name" "#include <errno.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_program_invocation_name" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_PROGRAM_INVOCATION_NAME $ac_have_decl" >>confdefs.h if test $ac_have_decl = 1 then : ac_found=1 fi ac_fn_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "#include <errno.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_program_invocation_short_name" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME $ac_have_decl" >>confdefs.h if test $ac_have_decl = 1 then : ac_found=1 fi ac_fn_check_decl "$LINENO" "__argv" "ac_cv_have_decl___argv" "#include <stdlib.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl___argv" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL___ARGV $ac_have_decl" >>confdefs.h if test $ac_have_decl = 1 then : ac_found=1 fi # Incur the cost of this test only if none of the above worked. if test $ac_found = 0; then # On OpenBSD 5.1, using the global __progname variable appears to be # the only way to implement getprogname. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether __progname is defined in default libraries" >&5 printf %s "checking whether __progname is defined in default libraries... " >&6; } if test ${gl_cv_var___progname+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_var___progname= cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern char *__progname; int main (void) { return *__progname; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_var___progname=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_var___progname" >&5 printf "%s\n" "$gl_cv_var___progname" >&6; } if test "$gl_cv_var___progname" = yes; then printf "%s\n" "#define HAVE_VAR___PROGNAME 1" >>confdefs.h fi fi # Autoconf 2.61a.99 and earlier don't support linking a file only # in VPATH builds. But since GNUmakefile is for maintainer use # only, it does not matter if we skip the link with older autoconf. # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH # builds, so use a shell variable to bypass this. GNUmakefile=GNUmakefile ac_config_links="$ac_config_links $GNUmakefile:$GNUmakefile" LIB_HARD_LOCALE="$LIB_SETLOCALE_NULL" : GL_GNULIB_ICONV=1 if test "$am_cv_func_iconv" = yes; then ICONV_H='iconv.h' if test -n "$ICONV_H"; then GL_GENERATE_ICONV_H_TRUE= GL_GENERATE_ICONV_H_FALSE='#' else GL_GENERATE_ICONV_H_TRUE='#' GL_GENERATE_ICONV_H_FALSE= fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <iconv.h> #if defined _LIBICONV_VERSION || (defined __GLIBC__ && !defined __UCLIBC__) gnu_iconv #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "gnu_iconv" >/dev/null 2>&1 then : gl_func_iconv_gnu=yes else $as_nop gl_func_iconv_gnu=no fi rm -rf conftest* if test $gl_func_iconv_gnu = no; then iconv_flavor= case "$host_os" in aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;; openedition*) iconv_flavor=ICONV_FLAVOR_ZOS ;; esac if test -n "$iconv_flavor"; then printf "%s\n" "#define ICONV_FLAVOR $iconv_flavor" >>confdefs.h ICONV_H='iconv.h' if test -n "$ICONV_H"; then GL_GENERATE_ICONV_H_TRUE= GL_GENERATE_ICONV_H_FALSE='#' else GL_GENERATE_ICONV_H_TRUE='#' GL_GENERATE_ICONV_H_FALSE= fi REPLACE_ICONV_OPEN=1 fi fi fi if test $REPLACE_ICONV_OPEN = 1; then gl_LIBOBJS="$gl_LIBOBJS iconv_open.$ac_objext" fi if test $REPLACE_ICONV = 1; then gl_LIBOBJS="$gl_LIBOBJS iconv.$ac_objext" gl_LIBOBJS="$gl_LIBOBJS iconv_close.$ac_objext" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler generally respects inline" >&5 printf %s "checking whether the compiler generally respects inline... " >&6; } if test ${gl_cv_c_inline_effective+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_c_inline = no; then gl_cv_c_inline_effective=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifdef __NO_INLINE__ #error "inline is not effective" #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_c_inline_effective=yes else $as_nop gl_cv_c_inline_effective=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_inline_effective" >&5 printf "%s\n" "$gl_cv_c_inline_effective" >&6; } if test $gl_cv_c_inline_effective = yes; then printf "%s\n" "#define HAVE_INLINE 1" >>confdefs.h fi case $host_os in mingw*) REPLACE_ISATTY=1 ;; esac if test $REPLACE_ISATTY = 1; then gl_LIBOBJS="$gl_LIBOBJS isatty.$ac_objext" : fi GL_GNULIB_ISATTY=1 printf "%s\n" "#define GNULIB_TEST_ISATTY 1" >>confdefs.h if test $ac_cv_func_isblank = no; then HAVE_ISBLANK=0 fi if test $HAVE_ISBLANK = 0; then gl_LIBOBJS="$gl_LIBOBJS isblank.$ac_objext" fi printf "%s\n" "#define GNULIB_ISBLANK 1" >>confdefs.h GL_GNULIB_ISBLANK=1 ac_fn_check_decl "$LINENO" "iswblank" "ac_cv_have_decl_iswblank" " #include <wchar.h> #include <wctype.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_iswblank" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_ISWBLANK $ac_have_decl" >>confdefs.h if test $ac_cv_func_iswblank = no; then HAVE_ISWBLANK=0 if test $ac_cv_have_decl_iswblank = yes; then REPLACE_ISWBLANK=1 fi fi if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then : else if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then : fi fi if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then : else if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then gl_LIBOBJS="$gl_LIBOBJS iswblank.$ac_objext" fi fi GL_GNULIB_ISWBLANK=1 printf "%s\n" "#define GNULIB_TEST_ISWBLANK 1" >>confdefs.h if test $HAVE_WCTYPE_T = 0 || test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then gl_LIBOBJS="$gl_LIBOBJS iswctype.$ac_objext" fi GL_GNULIB_ISWCTYPE=1 printf "%s\n" "#define GNULIB_TEST_ISWCTYPE 1" >>confdefs.h if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then REPLACE_ISWDIGIT="$REPLACE_ISWCNTRL" else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether iswdigit is ISO C compliant" >&5 printf %s "checking whether iswdigit is ISO C compliant... " >&6; } if test ${gl_cv_func_iswdigit_works+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on FreeBSD, NetBSD, Solaris, native Windows. freebsd* | dragonfly* | netbsd* | solaris* | mingw*) gl_cv_func_iswdigit_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_iswdigit_works="guessing yes" ;; esac if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> #include <wctype.h> /* Returns the value of iswdigit for the multibyte character s[0..n-1]. */ static int for_character (const char *s, size_t n) { mbstate_t state; wchar_t wc; size_t ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, s, n, &state); if (ret != n) abort (); return iswdigit (wc); } int main (int argc, char *argv[]) { int is; int result = 0; if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { /* This fails on mingw, MSVC 14. */ /* U+00B2 SUPERSCRIPT TWO */ is = for_character ("\262", 1); if (!(is == 0)) result |= 1; } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { /* This fails on NetBSD 8.0. */ /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\243\261", 2); if (!(is == 0)) result |= 2; } if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */ /* U+0663 ARABIC-INDIC DIGIT THREE */ is = for_character ("\331\243", 2); if (!(is == 0)) result |= 4; /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */ /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\357\274\221", 3); if (!(is == 0)) result |= 8; } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { /* This fails on NetBSD 8.0, Solaris 10, Solaris 11.4. */ /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\243\261", 2); if (!(is == 0)) result |= 16; } return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_iswdigit_works=yes else $as_nop gl_cv_func_iswdigit_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswdigit_works" >&5 printf "%s\n" "$gl_cv_func_iswdigit_works" >&6; } case "$gl_cv_func_iswdigit_works" in *yes) ;; *) REPLACE_ISWDIGIT=1 ;; esac fi if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then : else if test $REPLACE_ISWDIGIT = 1; then gl_LIBOBJS="$gl_LIBOBJS iswdigit.$ac_objext" fi fi GL_GNULIB_ISWDIGIT=1 printf "%s\n" "#define GNULIB_TEST_ISWDIGIT 1" >>confdefs.h if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then REPLACE_ISWXDIGIT="$REPLACE_ISWCNTRL" else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether iswxdigit is ISO C compliant" >&5 printf %s "checking whether iswxdigit is ISO C compliant... " >&6; } if test ${gl_cv_func_iswxdigit_works+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on FreeBSD, NetBSD, Solaris, native Windows. freebsd* | dragonfly* | netbsd* | solaris* | mingw*) gl_cv_func_iswxdigit_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_iswxdigit_works="guessing yes" ;; esac if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> #include <wctype.h> /* Returns the value of iswxdigit for the multibyte character s[0..n-1]. */ static int for_character (const char *s, size_t n) { mbstate_t state; wchar_t wc; size_t ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, s, n, &state); if (ret != n) abort (); return iswxdigit (wc); } int main (int argc, char *argv[]) { int is; int result = 0; if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { /* This fails on NetBSD 8.0. */ /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ is = for_character ("\243\301", 2); if (!(is == 0)) result |= 1; } if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { /* This fails on FreeBSD 13.0. */ /* U+0663 ARABIC-INDIC DIGIT THREE */ is = for_character ("\331\243", 2); if (!(is == 0)) result |= 2; /* This fails on MSVC 14. */ /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ is = for_character ("\357\274\241", 3); if (!(is == 0)) result |= 4; } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { /* This fails on Solaris 10, Solaris 11.4. */ /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\243\261", 2); if (!(is == 0)) result |= 8; } return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_iswxdigit_works=yes else $as_nop gl_cv_func_iswxdigit_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswxdigit_works" >&5 printf "%s\n" "$gl_cv_func_iswxdigit_works" >&6; } case "$gl_cv_func_iswxdigit_works" in *yes) ;; *) REPLACE_ISWXDIGIT=1 ;; esac fi if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then : else if test $REPLACE_ISWXDIGIT = 1; then gl_LIBOBJS="$gl_LIBOBJS iswxdigit.$ac_objext" fi fi GL_GNULIB_ISWXDIGIT=1 printf "%s\n" "#define GNULIB_TEST_ISWXDIGIT 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the __inline keyword" >&5 printf %s "checking whether the compiler supports the __inline keyword... " >&6; } if test ${gl_cv_c___inline+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ typedef int foo_t; static __inline foo_t foo (void) { return 0; } int main (void) { return foo (); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_c___inline=yes else $as_nop gl_cv_c___inline=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c___inline" >&5 printf "%s\n" "$gl_cv_c___inline" >&6; } if test $gl_cv_c___inline = yes; then printf "%s\n" "#define HAVE___INLINE 1" >>confdefs.h fi LOCALCHARSET_TESTS_ENVIRONMENT= if test $REPLACE_STRUCT_LCONV = 1; then REPLACE_LOCALECONV=1 fi if test $REPLACE_LOCALECONV = 1; then gl_LIBOBJS="$gl_LIBOBJS localeconv.$ac_objext" ac_fn_c_check_member "$LINENO" "struct lconv" "decimal_point" "ac_cv_member_struct_lconv_decimal_point" "#include <locale.h> " if test "x$ac_cv_member_struct_lconv_decimal_point" = xyes then : printf "%s\n" "#define HAVE_STRUCT_LCONV_DECIMAL_POINT 1" >>confdefs.h fi fi GL_GNULIB_LOCALECONV=1 printf "%s\n" "#define GNULIB_TEST_LOCALECONV 1" >>confdefs.h if test "$gl_threads_api" = posix; then # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the # pthread_rwlock_* functions. has_rwlock=false ac_fn_c_check_type "$LINENO" "pthread_rwlock_t" "ac_cv_type_pthread_rwlock_t" "#include <pthread.h> " if test "x$ac_cv_type_pthread_rwlock_t" = xyes then : has_rwlock=true printf "%s\n" "#define HAVE_PTHREAD_RWLOCK 1" >>confdefs.h fi if $has_rwlock; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthread_rwlock_rdlock prefers a writer to a reader" >&5 printf %s "checking whether pthread_rwlock_rdlock prefers a writer to a reader... " >&6; } if test ${gl_cv_pthread_rwlock_rdlock_prefer_writer+y} then : printf %s "(cached) " >&6 else $as_nop save_LIBS="$LIBS" LIBS="$LIBS $LIBMULTITHREAD" if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on glibc systems. *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; # Guess no on musl systems. *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; # Guess no on bionic systems. *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; # Guess yes on native Windows with the mingw-w64 winpthreads library. # Guess no on native Windows with the gnulib windows-rwlock module. mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" else gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" fi ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #include <pthread.h> #include <stdlib.h> #include <unistd.h> #define SUCCEED() exit (0) #define FAILURE() exit (1) #define UNEXPECTED(n) (exit (10 + (n))) /* The main thread creates the waiting writer and the requesting reader threads in the default way; this guarantees that they have the same priority. We can reuse the main thread as first reader thread. */ static pthread_rwlock_t lock; static pthread_t reader1; static pthread_t writer; static pthread_t reader2; static pthread_t timer; /* Used to pass control from writer to reader2 and from reader2 to timer, as in a relay race. Passing control from one running thread to another running thread is most likely faster than to create the second thread. */ static pthread_mutex_t baton; static void * timer_func (void *ignored) { /* Step 13 (can be before or after step 12): The timer thread takes the baton, then waits a moment to make sure it can tell whether the second reader thread is blocked at step 12. */ if (pthread_mutex_lock (&baton)) UNEXPECTED (13); usleep (100000); /* By the time we get here, it's clear that the second reader thread is blocked at step 12. This is the desired behaviour. */ SUCCEED (); } static void * reader2_func (void *ignored) { int err; /* Step 8 (can be before or after step 7): The second reader thread takes the baton, then waits a moment to make sure the writer thread has reached step 7. */ if (pthread_mutex_lock (&baton)) UNEXPECTED (8); usleep (100000); /* Step 9: The second reader thread requests the lock. */ err = pthread_rwlock_tryrdlock (&lock); if (err == 0) FAILURE (); else if (err != EBUSY) UNEXPECTED (9); /* Step 10: Launch a timer, to test whether the next call blocks. */ if (pthread_create (&timer, NULL, timer_func, NULL)) UNEXPECTED (10); /* Step 11: Release the baton. */ if (pthread_mutex_unlock (&baton)) UNEXPECTED (11); /* Step 12: The second reader thread requests the lock. */ err = pthread_rwlock_rdlock (&lock); if (err == 0) FAILURE (); else UNEXPECTED (12); } static void * writer_func (void *ignored) { /* Step 4: Take the baton, so that the second reader thread does not go ahead too early. */ if (pthread_mutex_lock (&baton)) UNEXPECTED (4); /* Step 5: Create the second reader thread. */ if (pthread_create (&reader2, NULL, reader2_func, NULL)) UNEXPECTED (5); /* Step 6: Release the baton. */ if (pthread_mutex_unlock (&baton)) UNEXPECTED (6); /* Step 7: The writer thread requests the lock. */ if (pthread_rwlock_wrlock (&lock)) UNEXPECTED (7); return NULL; } int main () { reader1 = pthread_self (); /* Step 1: The main thread initializes the lock and the baton. */ if (pthread_rwlock_init (&lock, NULL)) UNEXPECTED (1); if (pthread_mutex_init (&baton, NULL)) UNEXPECTED (1); /* Step 2: The main thread acquires the lock as a reader. */ if (pthread_rwlock_rdlock (&lock)) UNEXPECTED (2); /* Step 3: Create the writer thread. */ if (pthread_create (&writer, NULL, writer_func, NULL)) UNEXPECTED (3); /* Job done. Go to sleep. */ for (;;) { sleep (1); } } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_pthread_rwlock_rdlock_prefer_writer=yes else $as_nop gl_cv_pthread_rwlock_rdlock_prefer_writer=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi LIBS="$save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_pthread_rwlock_rdlock_prefer_writer" >&5 printf "%s\n" "$gl_cv_pthread_rwlock_rdlock_prefer_writer" >&6; } case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in *yes) printf "%s\n" "#define HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER 1" >>confdefs.h ;; esac fi # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> int main (void) { #if __FreeBSD__ == 4 error "No, in FreeBSD 4.0 recursive mutexes actually don't work." #elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) error "No, in Mac OS X < 10.7 recursive mutexes actually don't work." #else int x = (int)PTHREAD_MUTEX_RECURSIVE; return !x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : printf "%s\n" "#define HAVE_PTHREAD_MUTEX_RECURSIVE 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi : printf "%s\n" "#define GNULIB_LOCK 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether lseek detects pipes" >&5 printf %s "checking whether lseek detects pipes... " >&6; } if test ${gl_cv_func_lseek_pipe+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in mingw*) gl_cv_func_lseek_pipe=no ;; *) if test $cross_compiling = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> /* for off_t */ #include <stdio.h> /* for SEEK_CUR */ #if HAVE_UNISTD_H # include <unistd.h> #else /* on Windows with MSVC */ # include <io.h> #endif $gl_mda_defines int main (void) { /* Exit with success only if stdin is seekable. */ return lseek (0, (off_t)0, SEEK_CUR) < 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : if test -s conftest$ac_exeext \ && ./conftest$ac_exeext < conftest.$ac_ext \ && test 1 = "`echo hi \ | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then gl_cv_func_lseek_pipe=yes else gl_cv_func_lseek_pipe=no fi else $as_nop gl_cv_func_lseek_pipe=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __BEOS__ /* BeOS mistakenly return 0 when trying to seek on pipes. */ Choke me. #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_lseek_pipe=yes else $as_nop gl_cv_func_lseek_pipe=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lseek_pipe" >&5 printf "%s\n" "$gl_cv_func_lseek_pipe" >&6; } if test $gl_cv_func_lseek_pipe = no; then REPLACE_LSEEK=1 printf "%s\n" "#define LSEEK_PIPE_BROKEN 1" >>confdefs.h fi if test $WINDOWS_64_BIT_OFF_T = 1; then REPLACE_LSEEK=1 fi if test $REPLACE_LSEEK = 1; then gl_LIBOBJS="$gl_LIBOBJS lseek.$ac_objext" fi GL_GNULIB_LSEEK=1 printf "%s\n" "#define GNULIB_TEST_LSEEK 1" >>confdefs.h if test $ac_cv_func_lstat = yes; then case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in solaris* | *no) REPLACE_LSTAT=1 ;; esac else HAVE_LSTAT=0 fi if test $REPLACE_LSTAT = 1; then gl_LIBOBJS="$gl_LIBOBJS lstat.$ac_objext" : fi GL_GNULIB_LSTAT=1 printf "%s\n" "#define GNULIB_TEST_LSTAT 1" >>confdefs.h if test $REPLACE_MALLOC = 0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether malloc (0) returns nonnull" >&5 printf %s "checking whether malloc (0) returns nonnull... " >&6; } if test ${ac_cv_func_malloc_0_nonnull+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on platforms where we know the result. *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | gnu* | *-musl* | midnightbsd* \ | hpux* | solaris* | cygwin* | mingw* | msys* ) ac_cv_func_malloc_0_nonnull="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> int main (void) { void *p = malloc (0); int result = !p; free (p); return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_malloc_0_nonnull=yes else $as_nop ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } case $ac_cv_func_malloc_0_nonnull in #( *yes) : ;; #( *) : REPLACE_MALLOC=1 ;; esac fi if test $REPLACE_MALLOC = 1; then gl_LIBOBJS="$gl_LIBOBJS malloc.$ac_objext" fi if test $REPLACE_MALLOC = 1; then gl_LIBOBJS="$gl_LIBOBJS malloc.$ac_objext" fi GL_GNULIB_MALLOC_POSIX=1 printf "%s\n" "#define GNULIB_TEST_MALLOC_POSIX 1" >>confdefs.h : if test $ac_cv_func_mbrlen = no; then HAVE_MBRLEN=0 ac_fn_check_decl "$LINENO" "mbrlen" "ac_cv_have_decl_mbrlen" " #include <wchar.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_mbrlen" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_MBRLEN $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_mbrlen = yes; then REPLACE_MBRLEN=1 fi else if test $REPLACE_MBRTOWC = 1; then REPLACE_MBRLEN=1 fi fi if test $HAVE_MBRLEN = 0 || test $REPLACE_MBRLEN = 1; then gl_LIBOBJS="$gl_LIBOBJS mbrlen.$ac_objext" : fi GL_GNULIB_MBRLEN=1 printf "%s\n" "#define GNULIB_TEST_MBRLEN 1" >>confdefs.h if case "$host_os" in mingw*) true ;; *) test $ac_cv_func_mbsinit = yes ;; esac \ && test $ac_cv_func_mbrtowc = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 printf %s "checking whether mbrtowc handles incomplete characters... " >&6; } if test ${gl_cv_func_mbrtowc_incomplete_state+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on AIX and OSF/1. aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; esac if test $LOCALE_JA != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_incomplete_state=yes else $as_nop gl_cv_func_mbrtowc_incomplete_state=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { const char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_incomplete_state=yes else $as_nop gl_cv_func_mbrtowc_incomplete_state=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_incomplete_state" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_incomplete_state" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works as well as mbtowc" >&5 printf %s "checking whether mbrtowc works as well as mbtowc... " >&6; } if test ${gl_cv_func_mbrtowc_sanitycheck+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on Solaris 8. solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; esac if test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main () { /* This fails on Solaris 8: mbrtowc returns 2, and sets wc to 0x00F0. mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 6, &state) != 4 && mbtowc (&wc, input + 3, 6) == 4) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_sanitycheck=yes else $as_nop gl_cv_func_mbrtowc_sanitycheck=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_sanitycheck" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_sanitycheck" >&6; } REPLACE_MBSTATE_T=0 case "$gl_cv_func_mbrtowc_incomplete_state" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac case "$gl_cv_func_mbrtowc_sanitycheck" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac else REPLACE_MBSTATE_T=1 fi if test $ac_cv_func_mbrtowc = no; then HAVE_MBRTOWC=0 ac_fn_check_decl "$LINENO" "mbrtowc" "ac_cv_have_decl_mbrtowc" " #include <wchar.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_mbrtowc" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_MBRTOWC $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_mbrtowc = yes; then REPLACE_MBRTOWC=1 fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_MBRTOWC=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles a NULL pwc argument" >&5 printf %s "checking whether mbrtowc handles a NULL pwc argument... " >&6; } if test ${gl_cv_func_mbrtowc_null_arg1+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on Solaris. solaris*) gl_cv_func_mbrtowc_null_arg1="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; esac if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main () { int result = 0; if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { char input[] = "\303\237er"; mbstate_t state; wchar_t wc; size_t ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input, 5, &state); if (ret != 2) result |= 1; if (!mbsinit (&state)) result |= 2; memset (&state, '\0', sizeof (mbstate_t)); ret = mbrtowc (NULL, input, 5, &state); if (ret != 2) /* Solaris 7 fails here: ret is -1. */ result |= 4; if (!mbsinit (&state)) result |= 8; } return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_null_arg1=yes else $as_nop gl_cv_func_mbrtowc_null_arg1=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_null_arg1" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_null_arg1" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles a NULL string argument" >&5 printf %s "checking whether mbrtowc handles a NULL string argument... " >&6; } if test ${gl_cv_func_mbrtowc_null_arg2+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on OSF/1. osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; esac if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { mbstate_t state; wchar_t wc; int ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; mbrtowc (&wc, NULL, 5, &state); /* Check that wc was not modified. */ if (wc != (wchar_t) 0xBADFACE) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_null_arg2=yes else $as_nop gl_cv_func_mbrtowc_null_arg2=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_null_arg2" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_null_arg2" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc has a correct return value" >&5 printf %s "checking whether mbrtowc has a correct return value... " >&6; } if test ${gl_cv_func_mbrtowc_retval+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on HP-UX, Solaris, native Windows. hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_retval="guessing yes" ;; esac if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ || { case "$host_os" in mingw*) true;; *) false;; esac; }; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { int result = 0; int found_some_locale = 0; /* This fails on Solaris. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 1) result |= 1; } found_some_locale = 1; } /* This fails on HP-UX 11.11. */ if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 2) result |= 2; } found_some_locale = 1; } /* This fails on native Windows. */ if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) { char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) { input[3] = '\0'; if (mbrtowc (&wc, input + 4, 4, &state) != 1) result |= 4; } found_some_locale = 1; } if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) { char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) { input[3] = '\0'; if (mbrtowc (&wc, input + 4, 4, &state) != 1) result |= 8; } found_some_locale = 1; } if (setlocale (LC_ALL, "Chinese_China.936") != NULL) { char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) { input[3] = '\0'; if (mbrtowc (&wc, input + 4, 4, &state) != 1) result |= 16; } found_some_locale = 1; } return (found_some_locale ? result : 77); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_retval=yes else $as_nop if test $? != 77; then gl_cv_func_mbrtowc_retval=no fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_retval" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_retval" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc returns 0 when parsing a NUL character" >&5 printf %s "checking whether mbrtowc returns 0 when parsing a NUL character... " >&6; } if test ${gl_cv_func_mbrtowc_nul_retval+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on Solaris 8 and 9. solaris2.[89]) gl_cv_func_mbrtowc_nul_retval="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_nul_retval="guessing yes" ;; esac if test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { /* This fails on Solaris 8 and 9. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "", 1, &state) != 0) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_nul_retval=yes else $as_nop gl_cv_func_mbrtowc_nul_retval=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_nul_retval" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_nul_retval" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc stores incomplete characters" >&5 printf %s "checking whether mbrtowc stores incomplete characters... " >&6; } if test ${gl_cv_func_mbrtowc_stores_incomplete+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess yes on native Windows. mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; esac case "$host_os" in mingw*) if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { int result = 0; if (setlocale (LC_ALL, "French_France.65001") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 1; } if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\226", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 2; } if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\245", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 4; } if (setlocale (LC_ALL, "Chinese_China.936") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\261", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 8; } return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_stores_incomplete=no else $as_nop gl_cv_func_mbrtowc_stores_incomplete=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi ;; *) if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) return 1; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_stores_incomplete=no else $as_nop gl_cv_func_mbrtowc_stores_incomplete=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_stores_incomplete" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_stores_incomplete" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works on empty input" >&5 printf %s "checking whether mbrtowc works on empty input... " >&6; } if test ${gl_cv_func_mbrtowc_empty_input+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on AIX and glibc systems. aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; esac if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> static wchar_t wc; static mbstate_t mbs; int main (void) { return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_empty_input=yes else $as_nop gl_cv_func_mbrtowc_empty_input=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_empty_input" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_empty_input" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C locale is free of encoding errors" >&5 printf %s "checking whether the C locale is free of encoding errors... " >&6; } if test ${gl_cv_func_mbrtowc_C_locale_sans_EILSEQ+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on native Windows. mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> #include <locale.h> #include <wchar.h> int main (void) { int i; char *locale = setlocale (LC_ALL, "C"); if (! locale) return 2; for (i = CHAR_MIN; i <= CHAR_MAX; i++) { char c = i; wchar_t wc; mbstate_t mbs = { 0, }; size_t ss = mbrtowc (&wc, &c, 1, &mbs); if (1 < ss) return 3; } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes else $as_nop gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" >&6; } case "$gl_cv_func_mbrtowc_null_arg1" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_NULL_ARG1_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_null_arg2" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_NULL_ARG2_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_retval" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_RETVAL_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_nul_retval" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_NUL_RETVAL_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_stores_incomplete" in *no) ;; *) printf "%s\n" "#define MBRTOWC_STORES_INCOMPLETE_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_empty_input" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_EMPTY_INPUT_BUG 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in *yes) ;; *) printf "%s\n" "#define MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac fi fi if test $REPLACE_MBSTATE_T = 1; then case "$host_os" in mingw*) LIB_MBRTOWC= ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 printf %s "checking whether imported symbols can be declared weak... " >&6; } if test ${gl_cv_have_weak+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_have_weak=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern void xyzzy (); #pragma weak xyzzy int main (void) { xyzzy(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_have_weak=maybe fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test $gl_cv_have_weak = maybe; then if test "$cross_compiling" = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ELF__ Extensible Linking Format #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Extensible Linking Format" >/dev/null 2>&1 then : gl_cv_have_weak="guessing yes" else $as_nop gl_cv_have_weak="guessing no" fi rm -rf conftest* else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #pragma weak fputs int main () { return (fputs == NULL); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_have_weak=yes else $as_nop gl_cv_have_weak=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi case " $LDFLAGS " in *" -static "*) gl_cv_have_weak=no ;; esac case "$gl_cv_have_weak" in *yes) case "$host_os" in freebsd* | dragonfly* | midnightbsd*) : > conftest1.c $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 cat <<EOF > conftest2.c #include <pthread.h> #pragma weak pthread_mutexattr_gettype int main () { return (pthread_mutexattr_gettype != NULL); } EOF $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ || gl_cv_have_weak=no rm -f conftest1.c libempty.so conftest2.c conftest ;; esac ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 printf "%s\n" "$gl_cv_have_weak" >&6; } case "$gl_cv_have_weak" in *yes) printf "%s\n" "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h ;; esac case "$gl_cv_have_weak" in *yes) LIB_MBRTOWC= ;; *) LIB_MBRTOWC="$LIBPTHREAD" ;; esac ;; esac else LIB_MBRTOWC= fi if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then gl_LIBOBJS="$gl_LIBOBJS mbrtowc.$ac_objext" if test $REPLACE_MBSTATE_T = 1; then gl_LIBOBJS="$gl_LIBOBJS lc-charset-dispatch.$ac_objext" gl_LIBOBJS="$gl_LIBOBJS mbtowc-lock.$ac_objext" CFLAG_VISIBILITY= HAVE_VISIBILITY=0 if test -n "$GCC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5 printf %s "checking whether the -Werror option is usable... " >&6; } if test ${gl_cv_cc_vis_werror+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_cc_vis_werror=yes else $as_nop gl_cv_cc_vis_werror=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5 printf "%s\n" "$gl_cv_cc_vis_werror" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 printf %s "checking for simple visibility declarations... " >&6; } if test ${gl_cv_cc_visibility+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" if test $gl_cv_cc_vis_werror = yes; then CFLAGS="$CFLAGS -Werror" fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern __attribute__((__visibility__("hidden"))) int hiddenvar; extern __attribute__((__visibility__("default"))) int exportedvar; extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); extern __attribute__((__visibility__("default"))) int exportedfunc (void); void dummyfunc (void); int hiddenvar; int exportedvar; int hiddenfunc (void) { return 51; } int exportedfunc (void) { return 1225736919; } void dummyfunc (void) {} int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_cc_visibility=yes else $as_nop gl_cv_cc_visibility=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 printf "%s\n" "$gl_cv_cc_visibility" >&6; } if test $gl_cv_cc_visibility = yes; then CFLAG_VISIBILITY="-fvisibility=hidden" HAVE_VISIBILITY=1 fi fi printf "%s\n" "#define HAVE_VISIBILITY $HAVE_VISIBILITY" >>confdefs.h fi : fi GL_GNULIB_MBRTOWC=1 printf "%s\n" "#define GNULIB_TEST_MBRTOWC 1" >>confdefs.h GL_GNULIB_MBSCASECMP=1 printf "%s\n" "#define GNULIB_TEST_MBSCASECMP 1" >>confdefs.h if case "$host_os" in mingw*) true ;; *) test $ac_cv_func_mbsinit = yes ;; esac \ && test $ac_cv_func_mbrtowc = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 printf %s "checking whether mbrtowc handles incomplete characters... " >&6; } if test ${gl_cv_func_mbrtowc_incomplete_state+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on AIX and OSF/1. aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; esac if test $LOCALE_JA != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_incomplete_state=yes else $as_nop gl_cv_func_mbrtowc_incomplete_state=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { const char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_incomplete_state=yes else $as_nop gl_cv_func_mbrtowc_incomplete_state=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_incomplete_state" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_incomplete_state" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works as well as mbtowc" >&5 printf %s "checking whether mbrtowc works as well as mbtowc... " >&6; } if test ${gl_cv_func_mbrtowc_sanitycheck+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on Solaris 8. solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; esac if test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main () { /* This fails on Solaris 8: mbrtowc returns 2, and sets wc to 0x00F0. mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 6, &state) != 4 && mbtowc (&wc, input + 3, 6) == 4) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_sanitycheck=yes else $as_nop gl_cv_func_mbrtowc_sanitycheck=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_sanitycheck" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_sanitycheck" >&6; } REPLACE_MBSTATE_T=0 case "$gl_cv_func_mbrtowc_incomplete_state" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac case "$gl_cv_func_mbrtowc_sanitycheck" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac else REPLACE_MBSTATE_T=1 fi if test $ac_cv_func_mbsinit = no; then HAVE_MBSINIT=0 ac_fn_check_decl "$LINENO" "mbsinit" "ac_cv_have_decl_mbsinit" " #include <wchar.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_mbsinit" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_MBSINIT $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_mbsinit = yes; then REPLACE_MBSINIT=1 fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_MBSINIT=1 else case "$host_os" in mingw*) REPLACE_MBSINIT=1 ;; esac fi fi if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then gl_LIBOBJS="$gl_LIBOBJS mbsinit.$ac_objext" : fi GL_GNULIB_MBSINIT=1 printf "%s\n" "#define GNULIB_TEST_MBSINIT 1" >>confdefs.h if test $ac_cv_func_mbslen = yes; then HAVE_MBSLEN=1 else HAVE_MBSLEN=0 fi GL_GNULIB_MBSLEN=1 printf "%s\n" "#define GNULIB_TEST_MBSLEN 1" >>confdefs.h if case "$host_os" in mingw*) true ;; *) test $ac_cv_func_mbsinit = yes ;; esac \ && test $ac_cv_func_mbrtowc = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 printf %s "checking whether mbrtowc handles incomplete characters... " >&6; } if test ${gl_cv_func_mbrtowc_incomplete_state+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on AIX and OSF/1. aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; esac if test $LOCALE_JA != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_incomplete_state=yes else $as_nop gl_cv_func_mbrtowc_incomplete_state=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { const char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_incomplete_state=yes else $as_nop gl_cv_func_mbrtowc_incomplete_state=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_incomplete_state" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_incomplete_state" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works as well as mbtowc" >&5 printf %s "checking whether mbrtowc works as well as mbtowc... " >&6; } if test ${gl_cv_func_mbrtowc_sanitycheck+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on Solaris 8. solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; esac if test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main () { /* This fails on Solaris 8: mbrtowc returns 2, and sets wc to 0x00F0. mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 6, &state) != 4 && mbtowc (&wc, input + 3, 6) == 4) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_sanitycheck=yes else $as_nop gl_cv_func_mbrtowc_sanitycheck=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_sanitycheck" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_sanitycheck" >&6; } REPLACE_MBSTATE_T=0 case "$gl_cv_func_mbrtowc_incomplete_state" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac case "$gl_cv_func_mbrtowc_sanitycheck" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac else REPLACE_MBSTATE_T=1 fi if test $ac_cv_func_mbsrtowcs = no; then HAVE_MBSRTOWCS=0 ac_fn_check_decl "$LINENO" "mbsrtowcs" "ac_cv_have_decl_mbsrtowcs" " #include <wchar.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_mbsrtowcs" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_MBSRTOWCS $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_mbsrtowcs = yes; then REPLACE_MBSRTOWCS=1 fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_MBSRTOWCS=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbsrtowcs works" >&5 printf %s "checking whether mbsrtowcs works... " >&6; } if test ${gl_cv_func_mbsrtowcs_works+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on HP-UX, Solaris, mingw. hpux* | solaris* | mingw*) gl_cv_func_mbsrtowcs_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbsrtowcs_works="guessing yes" ;; esac if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { int result = 0; /* Test whether the function supports a NULL destination argument. This fails on native Windows. */ if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { const char input[] = "\337er"; const char *src = input; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbsrtowcs (NULL, &src, 1, &state) != 3 || src != input) result |= 1; } /* Test whether the function works when started with a conversion state in non-initial state. This fails on HP-UX 11.11 and Solaris 10. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { const char input[] = "B\303\274\303\237er"; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (NULL, input + 1, 1, &state) == (size_t)(-2)) if (!mbsinit (&state)) { const char *src = input + 2; if (mbsrtowcs (NULL, &src, 10, &state) != 4) result |= 2; } } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { const char input[] = "<\306\374\313\334\270\354>"; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (NULL, input + 3, 1, &state) == (size_t)(-2)) if (!mbsinit (&state)) { const char *src = input + 4; if (mbsrtowcs (NULL, &src, 10, &state) != 3) result |= 4; } } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { const char input[] = "B\250\271\201\060\211\070er"; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (NULL, input + 1, 1, &state) == (size_t)(-2)) if (!mbsinit (&state)) { const char *src = input + 2; if (mbsrtowcs (NULL, &src, 10, &state) != 4) result |= 8; } } return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbsrtowcs_works=yes else $as_nop gl_cv_func_mbsrtowcs_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbsrtowcs_works" >&5 printf "%s\n" "$gl_cv_func_mbsrtowcs_works" >&6; } case "$gl_cv_func_mbsrtowcs_works" in *yes) ;; *) REPLACE_MBSRTOWCS=1 ;; esac fi fi if test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1; then gl_LIBOBJS="$gl_LIBOBJS mbsrtowcs.$ac_objext" gl_LIBOBJS="$gl_LIBOBJS mbsrtowcs-state.$ac_objext" : fi GL_GNULIB_MBSRTOWCS=1 printf "%s\n" "#define GNULIB_TEST_MBSRTOWCS 1" >>confdefs.h GL_GNULIB_MBSSTR=1 printf "%s\n" "#define GNULIB_TEST_MBSSTR 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "mbtowc" "ac_cv_func_mbtowc" if test "x$ac_cv_func_mbtowc" = xyes then : printf "%s\n" "#define HAVE_MBTOWC 1" >>confdefs.h fi if test $ac_cv_func_mbtowc = no; then HAVE_MBTOWC=0 else if false; then REPLACE_MBTOWC=1 fi fi if test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1; then gl_LIBOBJS="$gl_LIBOBJS mbtowc.$ac_objext" : fi GL_GNULIB_MBTOWC=1 printf "%s\n" "#define GNULIB_TEST_MBTOWC 1" >>confdefs.h : if test $REPLACE_MEMCHR = 1; then gl_LIBOBJS="$gl_LIBOBJS memchr.$ac_objext" ac_fn_c_check_header_compile "$LINENO" "bp-sym.h" "ac_cv_header_bp_sym_h" "$ac_includes_default" if test "x$ac_cv_header_bp_sym_h" = xyes then : printf "%s\n" "#define HAVE_BP_SYM_H 1" >>confdefs.h fi fi GL_GNULIB_MEMCHR=1 printf "%s\n" "#define GNULIB_TEST_MEMCHR 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "mempcpy" "ac_cv_func_mempcpy" if test "x$ac_cv_func_mempcpy" = xyes then : printf "%s\n" "#define HAVE_MEMPCPY 1" >>confdefs.h fi if test $ac_cv_func_mempcpy = no; then HAVE_MEMPCPY=0 fi if test $HAVE_MEMPCPY = 0; then gl_LIBOBJS="$gl_LIBOBJS mempcpy.$ac_objext" : fi GL_GNULIB_MEMPCPY=1 printf "%s\n" "#define GNULIB_TEST_MEMPCPY 1" >>confdefs.h if test $ac_cv_have_decl_memrchr = no; then HAVE_DECL_MEMRCHR=0 fi ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr" if test "x$ac_cv_func_memrchr" = xyes then : printf "%s\n" "#define HAVE_MEMRCHR 1" >>confdefs.h fi if test $ac_cv_func_memrchr = no; then gl_LIBOBJS="$gl_LIBOBJS memrchr.$ac_objext" : fi GL_GNULIB_MEMRCHR=1 printf "%s\n" "#define GNULIB_TEST_MEMRCHR 1" >>confdefs.h if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then gl_LIBOBJS="$gl_LIBOBJS msvc-inval.$ac_objext" fi if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then gl_LIBOBJS="$gl_LIBOBJS msvc-nothrow.$ac_objext" fi printf "%s\n" "#define GNULIB_MSVC_NOTHROW 1" >>confdefs.h if test $ac_cv_func_nl_langinfo = yes; then # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether YESEXPR works" >&5 printf %s "checking whether YESEXPR works... " >&6; } if test ${gl_cv_func_nl_langinfo_yesexpr_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on irix systems. irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";; # Guess yes elsewhere. *) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <langinfo.h> int main (void) { return !*nl_langinfo(YESEXPR); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_nl_langinfo_yesexpr_works=yes else $as_nop gl_cv_func_nl_langinfo_yesexpr_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_nl_langinfo_yesexpr_works" >&5 printf "%s\n" "$gl_cv_func_nl_langinfo_yesexpr_works" >&6; } case $gl_cv_func_nl_langinfo_yesexpr_works in *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;; *) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;; esac printf "%s\n" "#define FUNC_NL_LANGINFO_YESEXPR_WORKS $FUNC_NL_LANGINFO_YESEXPR_WORKS" >>confdefs.h # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe. case "$host_os" in solaris*) NL_LANGINFO_MTSAFE=0 ;; *) NL_LANGINFO_MTSAFE=1 ;; esac printf "%s\n" "#define NL_LANGINFO_MTSAFE $NL_LANGINFO_MTSAFE" >>confdefs.h if test $HAVE_LANGINFO_CODESET = 1 \ && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \ && test $HAVE_LANGINFO_ALTMON = 1 \ && test $HAVE_LANGINFO_ERA = 1 \ && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \ && test $NL_LANGINFO_MTSAFE = 1; then : else REPLACE_NL_LANGINFO=1 printf "%s\n" "#define REPLACE_NL_LANGINFO 1" >>confdefs.h fi else HAVE_NL_LANGINFO=0 fi if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then LIB_NL_LANGINFO="$LIB_SETLOCALE_NULL" else LIB_NL_LANGINFO= fi if test $HAVE_NL_LANGINFO = 0 || test $REPLACE_NL_LANGINFO = 1; then gl_LIBOBJS="$gl_LIBOBJS nl_langinfo.$ac_objext" fi if test $REPLACE_NL_LANGINFO = 1 && test $NL_LANGINFO_MTSAFE = 0; then gl_LIBOBJS="$gl_LIBOBJS nl_langinfo-lock.$ac_objext" CFLAG_VISIBILITY= HAVE_VISIBILITY=0 if test -n "$GCC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5 printf %s "checking whether the -Werror option is usable... " >&6; } if test ${gl_cv_cc_vis_werror+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_cc_vis_werror=yes else $as_nop gl_cv_cc_vis_werror=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5 printf "%s\n" "$gl_cv_cc_vis_werror" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 printf %s "checking for simple visibility declarations... " >&6; } if test ${gl_cv_cc_visibility+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" if test $gl_cv_cc_vis_werror = yes; then CFLAGS="$CFLAGS -Werror" fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern __attribute__((__visibility__("hidden"))) int hiddenvar; extern __attribute__((__visibility__("default"))) int exportedvar; extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); extern __attribute__((__visibility__("default"))) int exportedfunc (void); void dummyfunc (void); int hiddenvar; int exportedvar; int hiddenfunc (void) { return 51; } int exportedfunc (void) { return 1225736919; } void dummyfunc (void) {} int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_cc_visibility=yes else $as_nop gl_cv_cc_visibility=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 printf "%s\n" "$gl_cv_cc_visibility" >&6; } if test $gl_cv_cc_visibility = yes; then CFLAG_VISIBILITY="-fvisibility=hidden" HAVE_VISIBILITY=1 fi fi printf "%s\n" "#define HAVE_VISIBILITY $HAVE_VISIBILITY" >>confdefs.h fi GL_GNULIB_NL_LANGINFO=1 printf "%s\n" "#define GNULIB_TEST_NL_LANGINFO 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for obstacks that work with any size object" >&5 printf %s "checking for obstacks that work with any size object... " >&6; } if test ${ac_cv_func_obstack+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "obstack.h" void *obstack_chunk_alloc (size_t n) { return 0; } void obstack_chunk_free (void *p) { } /* Check that an internal function returns size_t, not int. */ size_t _obstack_memory_used (struct obstack *); int main (void) { struct obstack mem; obstack_init (&mem); obstack_free (&mem, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_func_obstack=yes else $as_nop ac_cv_func_obstack=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_obstack" >&5 printf "%s\n" "$ac_cv_func_obstack" >&6; } if test "$ac_cv_func_obstack" = yes; then printf "%s\n" "#define HAVE_OBSTACK 1" >>confdefs.h else gl_LIBOBJS="$gl_LIBOBJS obstack.$ac_objext" fi case "$host_os" in mingw* | pw*) REPLACE_OPEN=1 ;; *) if test "$gl_cv_macro_O_CLOEXEC" != yes; then REPLACE_OPEN=1 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether open recognizes a trailing slash" >&5 printf %s "checking whether open recognizes a trailing slash... " >&6; } if test ${gl_cv_func_open_slash+y} then : printf %s "(cached) " >&6 else $as_nop # Assume that if we have lstat, we can also check symlinks. if test $ac_cv_func_lstat = yes; then touch conftest.tmp ln -s conftest.tmp conftest.lnk fi if test "$cross_compiling" = yes then : case "$host_os" in freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) gl_cv_func_open_slash="guessing no" ;; *) gl_cv_func_open_slash="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <fcntl.h> #if HAVE_UNISTD_H # include <unistd.h> #endif $gl_mda_defines int main () { int result = 0; #if HAVE_LSTAT if (open ("conftest.lnk/", O_RDONLY) != -1) result |= 1; #endif if (open ("conftest.sl/", O_CREAT, 0600) >= 0) result |= 2; return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_open_slash=yes else $as_nop gl_cv_func_open_slash=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.sl conftest.tmp conftest.lnk fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_slash" >&5 printf "%s\n" "$gl_cv_func_open_slash" >&6; } case "$gl_cv_func_open_slash" in *no) printf "%s\n" "#define OPEN_TRAILING_SLASH_BUG 1" >>confdefs.h ;; esac case "$gl_cv_func_open_slash" in *no) REPLACE_OPEN=1 ;; esac ;; esac if test $REPLACE_OPEN = 0; then if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi if test $HAVE_FCHDIR = 0; then REPLACE_OPEN=1 fi fi if test $REPLACE_OPEN = 1; then gl_LIBOBJS="$gl_LIBOBJS open.$ac_objext" : fi GL_GNULIB_OPEN=1 printf "%s\n" "#define GNULIB_TEST_OPEN 1" >>confdefs.h case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink+$gl_cv_macro_O_CLOEXEC in yes+*yes+yes) ;; yes+*) # Solaris 10 lacks O_CLOEXEC. # Solaris 9 has *at functions, but uniformly mishandles trailing # slash in all of them. REPLACE_OPENAT=1 ;; *) HAVE_OPENAT=0 ;; esac if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then gl_LIBOBJS="$gl_LIBOBJS openat.$ac_objext" : fi printf "%s\n" "#define GNULIB_OPENAT 1" >>confdefs.h GL_GNULIB_OPENAT=1 printf "%s\n" "#define GNULIB_TEST_OPENAT 1" >>confdefs.h printf "%s\n" "#define GNULIB_OPENAT_SAFER 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "opendir" "ac_cv_func_opendir" if test "x$ac_cv_func_opendir" = xyes then : printf "%s\n" "#define HAVE_OPENDIR 1" >>confdefs.h fi if test $ac_cv_func_opendir = no; then HAVE_OPENDIR=0 fi if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi if test $HAVE_FCHDIR = 0; then if test $HAVE_OPENDIR = 1; then REPLACE_OPENDIR=1 fi fi case $host_os,$HAVE_OPENDIR in os2*,1) REPLACE_OPENDIR=1;; esac if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then gl_LIBOBJS="$gl_LIBOBJS opendir.$ac_objext" fi GL_GNULIB_OPENDIR=1 printf "%s\n" "#define GNULIB_TEST_OPENDIR 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for perl5.005 or newer" >&5 printf %s "checking for perl5.005 or newer... " >&6; } if test "${PERL+set}" = set; then # 'PERL' is set in the user's environment. candidate_perl_names="$PERL" perl_specified=yes else candidate_perl_names='perl perl5' perl_specified=no fi found=no PERL="$am_missing_run perl" for perl in $candidate_perl_names; do # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. if ( $perl -e 'require 5.005; use File::Compare; use warnings;' ) > /dev/null 2>&1; then PERL=$perl found=yes break fi done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $found" >&5 printf "%s\n" "$found" >&6; } test $found = no && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: WARNING: You don't seem to have perl5.005 or newer installed, or you lack a usable version of the Perl File::Compare module. As a result, you may be unable to run a few tests or to regenerate certain files if you modify the sources from which they are derived. " >&5 printf "%s\n" "$as_me: WARNING: WARNING: You don't seem to have perl5.005 or newer installed, or you lack a usable version of the Perl File::Compare module. As a result, you may be unable to run a few tests or to regenerate certain files if you modify the sources from which they are derived. " >&2;} if test $ac_cv_func_pipe != yes; then HAVE_PIPE=0 fi if test $HAVE_PIPE = 0; then gl_LIBOBJS="$gl_LIBOBJS pipe.$ac_objext" fi GL_GNULIB_PIPE=1 printf "%s\n" "#define GNULIB_TEST_PIPE 1" >>confdefs.h XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --keyword='proper_name:1,\"This is a proper name. See the gettext manual, section Names.\"'" XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --keyword='proper_name_utf8:1,\"This is a proper name. See the gettext manual, section Names.\"'" : : ac_fn_c_check_func "$LINENO" "raise" "ac_cv_func_raise" if test "x$ac_cv_func_raise" = xyes then : printf "%s\n" "#define HAVE_RAISE 1" >>confdefs.h fi if test $ac_cv_func_raise = no; then HAVE_RAISE=0 else if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then REPLACE_RAISE=1 fi HAVE_POSIX_SIGNALBLOCKING=0 if test "$gl_cv_type_sigset_t" = yes; then ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" if test "x$ac_cv_func_sigprocmask" = xyes then : HAVE_POSIX_SIGNALBLOCKING=1 fi fi if test $HAVE_POSIX_SIGNALBLOCKING = 0; then : fi fi if test $HAVE_RAISE = 0 || test $REPLACE_RAISE = 1; then gl_LIBOBJS="$gl_LIBOBJS raise.$ac_objext" : fi GL_GNULIB_RAISE=1 printf "%s\n" "#define GNULIB_TEST_RAISE 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "rawmemchr" "ac_cv_func_rawmemchr" if test "x$ac_cv_func_rawmemchr" = xyes then : printf "%s\n" "#define HAVE_RAWMEMCHR 1" >>confdefs.h fi if test $ac_cv_func_rawmemchr = no; then HAVE_RAWMEMCHR=0 fi if test $HAVE_RAWMEMCHR = 0; then gl_LIBOBJS="$gl_LIBOBJS rawmemchr.$ac_objext" : fi GL_GNULIB_RAWMEMCHR=1 printf "%s\n" "#define GNULIB_TEST_RAWMEMCHR 1" >>confdefs.h if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then REPLACE_READ=1 fi if test $REPLACE_READ = 1; then gl_LIBOBJS="$gl_LIBOBJS read.$ac_objext" : fi GL_GNULIB_READ=1 printf "%s\n" "#define GNULIB_TEST_READ 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "readdir" "ac_cv_func_readdir" if test "x$ac_cv_func_readdir" = xyes then : printf "%s\n" "#define HAVE_READDIR 1" >>confdefs.h fi if test $ac_cv_func_readdir = no; then HAVE_READDIR=0 fi if test $HAVE_READDIR = 0; then gl_LIBOBJS="$gl_LIBOBJS readdir.$ac_objext" fi GL_GNULIB_READDIR=1 printf "%s\n" "#define GNULIB_TEST_READDIR 1" >>confdefs.h if test $REPLACE_REALLOC = 0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether realloc (0, 0) returns nonnull" >&5 printf %s "checking whether realloc (0, 0) returns nonnull... " >&6; } if test ${ac_cv_func_realloc_0_nonnull+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on platforms where we know the result. *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | gnu* | *-musl* | midnightbsd* \ | hpux* | solaris* | cygwin* | mingw* | msys* ) ac_cv_func_realloc_0_nonnull="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> int main (void) { void *p = realloc (0, 0); int result = !p; free (p); return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_realloc_0_nonnull=yes else $as_nop ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 printf "%s\n" "$ac_cv_func_realloc_0_nonnull" >&6; } case $ac_cv_func_realloc_0_nonnull in #( *yes) : ;; #( *) : REPLACE_REALLOC=1 ;; esac fi if test $REPLACE_REALLOC = 1; then gl_LIBOBJS="$gl_LIBOBJS realloc.$ac_objext" fi if test $REPLACE_MALLOC = 1; then REPLACE_REALLOC=1 fi if test $REPLACE_REALLOC = 1; then gl_LIBOBJS="$gl_LIBOBJS realloc.$ac_objext" fi GL_GNULIB_REALLOC_POSIX=1 printf "%s\n" "#define GNULIB_TEST_REALLOC_POSIX 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "reallocarray" "ac_cv_func_reallocarray" if test "x$ac_cv_func_reallocarray" = xyes then : printf "%s\n" "#define HAVE_REALLOCARRAY 1" >>confdefs.h fi if test "$ac_cv_func_reallocarray" = no; then HAVE_REALLOCARRAY=0 elif test "$gl_cv_malloc_ptrdiff" = no; then REPLACE_REALLOCARRAY=1 fi if test $HAVE_REALLOCARRAY = 0 || test $REPLACE_REALLOCARRAY = 1; then gl_LIBOBJS="$gl_LIBOBJS reallocarray.$ac_objext" : fi printf "%s\n" "#define GNULIB_REALLOCARRAY 1" >>confdefs.h GL_GNULIB_REALLOCARRAY=1 printf "%s\n" "#define GNULIB_TEST_REALLOCARRAY 1" >>confdefs.h # Check whether --with-included-regex was given. if test ${with_included_regex+y} then : withval=$with_included_regex; fi case $with_included_regex in #( yes|no) ac_use_included_regex=$with_included_regex ;; '') # If the system regex support is good enough that it passes the # following run test, then default to *not* using the included regex.c. # If cross compiling, assume the test would fail and use the included # regex.c. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working re_compile_pattern" >&5 printf %s "checking for working re_compile_pattern... " >&6; } if test ${gl_cv_func_re_compile_pattern_working+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on native Windows. mingw*) gl_cv_func_re_compile_pattern_working="guessing no" ;; # Otherwise obey --enable-cross-guesses. *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <regex.h> #include <locale.h> #include <limits.h> #include <string.h> #if defined M_CHECK_ACTION || HAVE_DECL_ALARM # include <signal.h> # include <unistd.h> #endif #if HAVE_MALLOC_H # include <malloc.h> #endif #ifdef M_CHECK_ACTION /* Exit with distinguishable exit code. */ static void sigabrt_no_core (int sig) { raise (SIGTERM); } #endif int main (void) { int result = 0; static struct re_pattern_buffer regex; unsigned char folded_chars[UCHAR_MAX + 1]; int i; const char *s; struct re_registers regs; /* Some builds of glibc go into an infinite loop on this test. Use alarm to force death, and mallopt to avoid malloc recursion in diagnosing the corrupted heap. */ #if HAVE_DECL_ALARM signal (SIGALRM, SIG_DFL); alarm (2); #endif #ifdef M_CHECK_ACTION signal (SIGABRT, sigabrt_no_core); mallopt (M_CHECK_ACTION, 2); #endif if (setlocale (LC_ALL, "en_US.UTF-8")) { { /* https://sourceware.org/ml/libc-hacker/2006-09/msg00008.html This test needs valgrind to catch the bug on Debian GNU/Linux 3.1 x86, but it might catch the bug better on other platforms and it shouldn't hurt to try the test here. */ static char const pat[] = "insert into"; static char const data[] = "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE | RE_ICASE); memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) result |= 1; else { if (re_search (®ex, data, sizeof data - 1, 0, sizeof data - 1, ®s) != -1) result |= 1; regfree (®ex); } } { /* This test is from glibc bug 15078. The test case is from Andreas Schwab in <https://sourceware.org/ml/libc-alpha/2013-01/msg00967.html>. */ static char const pat[] = "[^x]x"; static char const data[] = /* <U1000><U103B><U103D><U1014><U103A><U102F><U1015><U103A> */ "\xe1\x80\x80" "\xe1\x80\xbb" "\xe1\x80\xbd" "\xe1\x80\x94" "\xe1\x80\xba" "\xe1\x80\xaf" "\xe1\x80\x95" "\xe1\x80\xba" "x"; re_set_syntax (0); memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) result |= 1; else { i = re_search (®ex, data, sizeof data - 1, 0, sizeof data - 1, 0); if (i != 0 && i != 21) result |= 1; regfree (®ex); } } if (! setlocale (LC_ALL, "C")) return 1; } /* This test is from glibc bug 3957, reported by Andrew Mackey. */ re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("a[^x]b", 6, ®ex); if (s) result |= 2; else { /* This should fail, but succeeds for glibc-2.5. */ if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) result |= 2; regfree (®ex); } /* This regular expression is from Spencer ere test number 75 in grep-2.3. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof regex); for (i = 0; i <= UCHAR_MAX; i++) folded_chars[i] = i; regex.translate = folded_chars; s = re_compile_pattern ("a[[:]:]]b\n", 11, ®ex); /* This should fail with _Invalid character class name_ error. */ if (!s) { result |= 4; regfree (®ex); } /* Ensure that [b-a] is diagnosed as invalid, when using RE_NO_EMPTY_RANGES. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("a[b-a]", 6, ®ex); if (s == 0) { result |= 8; regfree (®ex); } /* This should succeed, but does not for glibc-2.1.3. */ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("{1", 2, ®ex); if (s) result |= 8; else regfree (®ex); /* The following example is derived from a problem report against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[an\371]*n", 7, ®ex); if (s) result |= 8; else { /* This should match, but does not for glibc-2.2.1. */ if (re_match (®ex, "an", 2, 0, ®s) != 2) result |= 8; else { free (regs.start); free (regs.end); } regfree (®ex); } memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) result |= 8; else { /* glibc-2.2.93 does not work with a negative RANGE argument. */ if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) result |= 8; else { free (regs.start); free (regs.end); } regfree (®ex); } /* The version of regex.c in older versions of gnulib ignored RE_ICASE. Detect that problem too. */ re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) result |= 16; else { if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) result |= 16; else { free (regs.start); free (regs.end); } regfree (®ex); } /* Catch a bug reported by Vin Shelton in https://lists.gnu.org/r/bug-coreutils/2007-06/msg00089.html */ re_set_syntax (RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[[:alnum:]_-]\\\\+\$", 16, ®ex); if (s) result |= 32; else regfree (®ex); /* REG_STARTEND was added to glibc on 2004-01-15. Reject older versions. */ if (! REG_STARTEND) result |= 64; /* Matching with the compiled form of this regexp would provoke an assertion failure prior to glibc-2.28: regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed With glibc-2.28, compilation fails and reports the invalid back reference. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("0|()0|\\\\1|0", 10, ®ex); if (!s) { memset (®s, 0, sizeof regs); i = re_search (®ex, "x", 1, 0, 1, ®s); if (i != -1) result |= 64; if (0 <= i) { free (regs.start); free (regs.end); } regfree (®ex); } else { if (strcmp (s, "Invalid back reference")) result |= 64; } /* glibc bug 11053. */ re_set_syntax (RE_SYNTAX_POSIX_BASIC); memset (®ex, 0, sizeof regex); static char const pat_sub2[] = "\\\\(a*\\\\)*a*\\\\1"; s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, ®ex); if (s) result |= 64; else { memset (®s, 0, sizeof regs); static char const data[] = "a"; int datalen = sizeof data - 1; i = re_search (®ex, data, datalen, 0, datalen, ®s); if (i != 0) result |= 64; else if (regs.num_regs < 2) result |= 64; else if (! (regs.start[0] == 0 && regs.end[0] == 1)) result |= 64; else if (! (regs.start[1] == 0 && regs.end[1] == 0)) result |= 64; regfree (®ex); free (regs.start); free (regs.end); } #if 0 /* It would be nice to reject hosts whose regoff_t values are too narrow (including glibc on hosts with 64-bit ptrdiff_t and 32-bit int), but we should wait until glibc implements this feature. Otherwise, support for equivalence classes and multibyte collation symbols would always be broken except when compiling --without-included-regex. */ if (sizeof (regoff_t) < sizeof (ptrdiff_t) || sizeof (regoff_t) < sizeof (ssize_t)) result |= 64; #endif return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_re_compile_pattern_working=yes else $as_nop gl_cv_func_re_compile_pattern_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_re_compile_pattern_working" >&5 printf "%s\n" "$gl_cv_func_re_compile_pattern_working" >&6; } case "$gl_cv_func_re_compile_pattern_working" in #( *yes) ac_use_included_regex=no;; #( *no) ac_use_included_regex=yes;; esac ;; *) as_fn_error $? "Invalid value for --with-included-regex: $with_included_regex" "$LINENO" 5 ;; esac if test $ac_use_included_regex = yes; then printf "%s\n" "#define _REGEX_INCLUDE_LIMITS_H 1" >>confdefs.h printf "%s\n" "#define _REGEX_LARGE_OFFSETS 1" >>confdefs.h printf "%s\n" "#define re_syntax_options rpl_re_syntax_options" >>confdefs.h printf "%s\n" "#define re_set_syntax rpl_re_set_syntax" >>confdefs.h printf "%s\n" "#define re_compile_pattern rpl_re_compile_pattern" >>confdefs.h printf "%s\n" "#define re_compile_fastmap rpl_re_compile_fastmap" >>confdefs.h printf "%s\n" "#define re_search rpl_re_search" >>confdefs.h printf "%s\n" "#define re_search_2 rpl_re_search_2" >>confdefs.h printf "%s\n" "#define re_match rpl_re_match" >>confdefs.h printf "%s\n" "#define re_match_2 rpl_re_match_2" >>confdefs.h printf "%s\n" "#define re_set_registers rpl_re_set_registers" >>confdefs.h printf "%s\n" "#define re_comp rpl_re_comp" >>confdefs.h printf "%s\n" "#define re_exec rpl_re_exec" >>confdefs.h printf "%s\n" "#define regcomp rpl_regcomp" >>confdefs.h printf "%s\n" "#define regexec rpl_regexec" >>confdefs.h printf "%s\n" "#define regerror rpl_regerror" >>confdefs.h printf "%s\n" "#define regfree rpl_regfree" >>confdefs.h fi if test $ac_use_included_regex = yes; then gl_LIBOBJS="$gl_LIBOBJS regex.$ac_objext" ac_fn_c_check_header_compile "$LINENO" "libintl.h" "ac_cv_header_libintl_h" "$ac_includes_default" if test "x$ac_cv_header_libintl_h" = xyes then : printf "%s\n" "#define HAVE_LIBINTL_H 1" >>confdefs.h fi ac_fn_check_decl "$LINENO" "isblank" "ac_cv_have_decl_isblank" "#include <ctype.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_isblank" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_ISBLANK $ac_have_decl" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setlocale (LC_ALL, NULL) is multithread-safe" >&5 printf %s "checking whether setlocale (LC_ALL, NULL) is multithread-safe... " >&6; } if test ${gl_cv_func_setlocale_null_all_mtsafe+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) gl_cv_func_setlocale_null_all_mtsafe=no ;; # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) gl_cv_func_setlocale_null_all_mtsafe=yes ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_all_mtsafe" >&5 printf "%s\n" "$gl_cv_func_setlocale_null_all_mtsafe" >&6; } case "$host_os" in mingw*) ;; *) if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then gl_cv_func_setlocale_null_all_mtsafe="trivially yes" fi ;; esac case "$gl_cv_func_setlocale_null_all_mtsafe" in *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; esac printf "%s\n" "#define SETLOCALE_NULL_ALL_MTSAFE $SETLOCALE_NULL_ALL_MTSAFE" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setlocale (category, NULL) is multithread-safe" >&5 printf %s "checking whether setlocale (category, NULL) is multithread-safe... " >&6; } if test ${gl_cv_func_setlocale_null_one_mtsafe+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on OpenBSD, AIX. openbsd* | aix*) gl_cv_func_setlocale_null_one_mtsafe=no ;; # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) gl_cv_func_setlocale_null_one_mtsafe=yes ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_one_mtsafe" >&5 printf "%s\n" "$gl_cv_func_setlocale_null_one_mtsafe" >&6; } case "$host_os" in mingw*) ;; *) if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then gl_cv_func_setlocale_null_one_mtsafe="trivially yes" fi ;; esac case "$gl_cv_func_setlocale_null_one_mtsafe" in *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; esac printf "%s\n" "#define SETLOCALE_NULL_ONE_MTSAFE $SETLOCALE_NULL_ONE_MTSAFE" >>confdefs.h if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then case "$host_os" in mingw*) LIB_SETLOCALE_NULL= ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 printf %s "checking whether imported symbols can be declared weak... " >&6; } if test ${gl_cv_have_weak+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_have_weak=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern void xyzzy (); #pragma weak xyzzy int main (void) { xyzzy(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_have_weak=maybe fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test $gl_cv_have_weak = maybe; then if test "$cross_compiling" = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ELF__ Extensible Linking Format #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Extensible Linking Format" >/dev/null 2>&1 then : gl_cv_have_weak="guessing yes" else $as_nop gl_cv_have_weak="guessing no" fi rm -rf conftest* else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #pragma weak fputs int main () { return (fputs == NULL); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_have_weak=yes else $as_nop gl_cv_have_weak=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi case " $LDFLAGS " in *" -static "*) gl_cv_have_weak=no ;; esac case "$gl_cv_have_weak" in *yes) case "$host_os" in freebsd* | dragonfly* | midnightbsd*) : > conftest1.c $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 cat <<EOF > conftest2.c #include <pthread.h> #pragma weak pthread_mutexattr_gettype int main () { return (pthread_mutexattr_gettype != NULL); } EOF $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ || gl_cv_have_weak=no rm -f conftest1.c libempty.so conftest2.c conftest ;; esac ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 printf "%s\n" "$gl_cv_have_weak" >&6; } case "$gl_cv_have_weak" in *yes) printf "%s\n" "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h ;; esac case "$gl_cv_have_weak" in *yes) LIB_SETLOCALE_NULL= ;; *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; esac ;; esac else LIB_SETLOCALE_NULL= fi if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then gl_LIBOBJS="$gl_LIBOBJS setlocale-lock.$ac_objext" CFLAG_VISIBILITY= HAVE_VISIBILITY=0 if test -n "$GCC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5 printf %s "checking whether the -Werror option is usable... " >&6; } if test ${gl_cv_cc_vis_werror+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_cc_vis_werror=yes else $as_nop gl_cv_cc_vis_werror=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5 printf "%s\n" "$gl_cv_cc_vis_werror" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 printf %s "checking for simple visibility declarations... " >&6; } if test ${gl_cv_cc_visibility+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" if test $gl_cv_cc_vis_werror = yes; then CFLAGS="$CFLAGS -Werror" fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern __attribute__((__visibility__("hidden"))) int hiddenvar; extern __attribute__((__visibility__("default"))) int exportedvar; extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); extern __attribute__((__visibility__("default"))) int exportedfunc (void); void dummyfunc (void); int hiddenvar; int exportedvar; int hiddenfunc (void) { return 51; } int exportedfunc (void) { return 1225736919; } void dummyfunc (void) {} int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_cc_visibility=yes else $as_nop gl_cv_cc_visibility=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 printf "%s\n" "$gl_cv_cc_visibility" >&6; } if test $gl_cv_cc_visibility = yes; then CFLAG_VISIBILITY="-fvisibility=hidden" HAVE_VISIBILITY=1 fi fi printf "%s\n" "#define HAVE_VISIBILITY $HAVE_VISIBILITY" >>confdefs.h fi GL_GNULIB_SETLOCALE_NULL=1 printf "%s\n" "#define GNULIB_TEST_SETLOCALE_NULL 1" >>confdefs.h # Check whether --with-libsigsegv was given. if test ${with_libsigsegv+y} then : withval=$with_libsigsegv; fi SIGSEGV_H=sigsegv.h if test "$with_libsigsegv" = yes; then use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libsigsegv-prefix was given. if test ${with_libsigsegv_prefix+y} then : withval=$with_libsigsegv_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" additional_libdir2="$withval/$acl_libdirstem2" additional_libdir3="$withval/$acl_libdirstem3" fi fi fi if test "X$additional_libdir2" = "X$additional_libdir"; then additional_libdir2= fi if test "X$additional_libdir3" = "X$additional_libdir"; then additional_libdir3= fi LIBSIGSEGV= LTLIBSIGSEGV= INCSIGSEGV= LIBSIGSEGV_PREFIX= HAVE_LIBSIGSEGV= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='sigsegv ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }$value" else : fi else found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do if test "X$found_dir" = "X"; then eval dir=\$$additional_libdir_variable if test -n "$dir"; then if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi fi done fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBSIGSEGV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBSIGSEGV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$found_so" else LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$found_a" else LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = 'sigsegv'; then LIBSIGSEGV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = 'sigsegv'; then LIBSIGSEGV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem3 | */$acl_libdirstem3/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` if test "$name" = 'sigsegv'; then LIBSIGSEGV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCSIGSEGV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCSIGSEGV="${INCSIGSEGV}${INCSIGSEGV:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBSIGSEGV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }-L$dependency_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBSIGSEGV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }-L$dependency_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dep=`echo "X$dep" | sed -e 's/^X-l//'` if test "X$dep" != Xc \ || case $host_os in linux* | gnu* | k*bsd*-gnu) false ;; *) true ;; esac; then names_next_round="$names_next_round $dep" fi ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$dep" LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }$dep" ;; esac done fi else LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }-l$name" LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }-R$found_dir" done fi ac_save_CPPFLAGS="$CPPFLAGS" for element in $INCSIGSEGV; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsigsegv" >&5 printf %s "checking for libsigsegv... " >&6; } if test ${ac_cv_libsigsegv+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_LIBS="$LIBS" case " $LIBSIGSEGV" in *" -l"*) LIBS="$LIBS $LIBSIGSEGV" ;; *) LIBS="$LIBSIGSEGV $LIBS" ;; esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sigsegv.h> int main (void) { sigsegv_deinstall_handler(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_libsigsegv=yes else $as_nop ac_cv_libsigsegv='no, consider installing GNU libsigsegv' fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libsigsegv" >&5 printf "%s\n" "$ac_cv_libsigsegv" >&6; } if test "$ac_cv_libsigsegv" = yes; then HAVE_LIBSIGSEGV=yes printf "%s\n" "#define HAVE_LIBSIGSEGV 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libsigsegv" >&5 printf %s "checking how to link with libsigsegv... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBSIGSEGV" >&5 printf "%s\n" "$LIBSIGSEGV" >&6; } else HAVE_LIBSIGSEGV=no CPPFLAGS="$ac_save_CPPFLAGS" LIBSIGSEGV= LTLIBSIGSEGV= LIBSIGSEGV_PREFIX= fi gl_cv_lib_sigsegv="$ac_cv_libsigsegv" if test "$gl_cv_lib_sigsegv" = yes; then SIGSEGV_H= fi fi if test -n "$SIGSEGV_H"; then GL_GENERATE_SIGSEGV_H_TRUE= GL_GENERATE_SIGSEGV_H_FALSE='#' else GL_GENERATE_SIGSEGV_H_TRUE='#' GL_GENERATE_SIGSEGV_H_FALSE= fi if test -n "$SIGSEGV_H"; then case "$host_os" in solaris2.11) printf "%s\n" "#define SOLARIS11 1" >>confdefs.h ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stack direction" >&5 printf %s "checking for stack direction... " >&6; } if test ${sv_cv_stack_direction_msg+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_cpu" in a29k | \ aarch64* | \ alpha* | \ arc | \ arm* | strongarm* | xscale* | \ avr | avr32 | \ bfin | \ c1 | c2 | c32 | c34 | c38 | \ clipper | \ cris | \ d30v | \ elxsi | \ fr30 | \ h8300 | \ i?86 | x86_64 | \ i860 | \ ia64 | \ m32r | \ m68* | \ m88k | \ mcore | \ microblaze | \ mips* | \ mmix | \ mn10200 | \ mn10300 | \ nios2 | \ nds32* | \ ns32k | \ pdp11 | \ pj* | \ powerpc* | rs6000 | \ riscv* | \ romp | \ s390* | \ sh* | \ sparc* | \ v850 | \ vax | \ xtensa) sv_cv_stack_direction=-1 ;; c4x | \ dsp16xx | \ i960 | \ hppa* | parisc* | \ stormy16 | \ we32k) sv_cv_stack_direction=1 ;; *) if test $cross_compiling = no; then cat > conftest.c <<EOF #include <stdio.h> int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char *argv) { printf ("%d\n", find_stack_direction (NULL, argc + 20)); return 0; } EOF { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } sv_cv_stack_direction=`./conftest` else sv_cv_stack_direction=0 fi ;; esac case $sv_cv_stack_direction in 1) sv_cv_stack_direction_msg="grows up";; -1) sv_cv_stack_direction_msg="grows down";; *) sv_cv_stack_direction_msg="unknown";; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sv_cv_stack_direction_msg" >&5 printf "%s\n" "$sv_cv_stack_direction_msg" >&6; } printf "%s\n" "#define STACK_DIRECTION $sv_cv_stack_direction" >>confdefs.h if test "$ac_cv_func_sigaltstack" = yes; then ac_fn_c_check_type "$LINENO" "stack_t" "ac_cv_type_stack_t" " #include <signal.h> #if HAVE_SYS_SIGNAL_H # include <sys/signal.h> #endif " if test "x$ac_cv_type_stack_t" = xyes then : else $as_nop printf "%s\n" "#define stack_t struct sigaltstack" >>confdefs.h fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working sigaltstack" >&5 printf %s "checking for working sigaltstack... " >&6; } if test ${sv_cv_sigaltstack+y} then : printf %s "(cached) " >&6 else $as_nop if test "$ac_cv_func_sigaltstack" = yes; then case "$host_os" in macos* | darwin[6-9]* | darwin[1-9][0-9]*) # On MacOS X 10.2 or newer, just assume that if it compiles, it will # work. If we were to perform the real test, 1 Crash Report dialog # window would pop up. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <signal.h> int main (void) { int x = SA_ONSTACK; stack_t ss; sigaltstack ((stack_t*)0, &ss); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : sv_cv_sigaltstack="guessing yes" else $as_nop sv_cv_sigaltstack=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; *) if test "$cross_compiling" = yes then : case "$host_os" in *) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <signal.h> int main (void) { int x = SA_ONSTACK; stack_t ss; sigaltstack ((stack_t*)0, &ss); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : sv_cv_sigaltstack="guessing yes" else $as_nop sv_cv_sigaltstack=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <signal.h> #if HAVE_SYS_SIGNAL_H # include <sys/signal.h> #endif #if HAVE_SETRLIMIT # include <sys/types.h> # include <sys/time.h> # include <sys/resource.h> #endif void stackoverflow_handler (int sig) { /* If we get here, the stack overflow was caught. */ exit (0); } volatile int * recurse_1 (volatile int n, volatile int *p) { if (n >= 0) *recurse_1 (n + 1, p) += n; return p; } int recurse (volatile int n) { int sum = 0; return *recurse_1 (n, &sum); } char mystack[2 * (1 << 24)]; int main () { stack_t altstack; struct sigaction action; #if defined HAVE_SETRLIMIT && defined RLIMIT_STACK /* Before starting the endless recursion, try to be friendly to the user's machine. On some Linux 2.2.x systems, there is no stack limit for user processes at all. We don't want to kill such systems. */ struct rlimit rl; rl.rlim_cur = rl.rlim_max = 0x100000; /* 1 MB */ setrlimit (RLIMIT_STACK, &rl); #endif /* Install the alternate stack. Use the midpoint of mystack, to guard against a buggy interpretation of ss_sp on IRIX. */ #ifdef SIGSTKSZ if (sizeof mystack / 2 < SIGSTKSZ) exit (3); #endif altstack.ss_sp = mystack + sizeof mystack / 2; altstack.ss_size = sizeof mystack / 2; altstack.ss_flags = 0; /* no SS_DISABLE */ if (sigaltstack (&altstack, NULL) < 0) exit (1); /* Install the SIGSEGV handler. */ sigemptyset (&action.sa_mask); action.sa_handler = &stackoverflow_handler; action.sa_flags = SA_ONSTACK; sigaction (SIGSEGV, &action, (struct sigaction *) NULL); sigaction (SIGBUS, &action, (struct sigaction *) NULL); /* Provoke a stack overflow. */ recurse (0); exit (2); } _ACEOF if ac_fn_c_try_run "$LINENO" then : sv_cv_sigaltstack=yes else $as_nop sv_cv_sigaltstack=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi ;; esac else sv_cv_sigaltstack=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sv_cv_sigaltstack" >&5 printf "%s\n" "$sv_cv_sigaltstack" >&6; } if test "$sv_cv_sigaltstack" != no; then printf "%s\n" "#define HAVE_WORKING_SIGALTSTACK 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for correct stack_t interpretation" >&5 printf %s "checking for correct stack_t interpretation... " >&6; } if test ${sv_cv_sigaltstack_low_base+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in irix5*) sv_cv_sigaltstack_low_base="no" ;; *) sv_cv_sigaltstack_low_base="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <signal.h> #if HAVE_SYS_SIGNAL_H # include <sys/signal.h> #endif volatile char *stack_lower_bound; volatile char *stack_upper_bound; static void check_stack_location (volatile char *addr) { if (addr >= stack_lower_bound && addr <= stack_upper_bound) exit (0); else exit (1); } static void stackoverflow_handler (int sig) { char dummy; check_stack_location (&dummy); } char mystack[2 * (1 << 24)]; int main () { stack_t altstack; struct sigaction action; /* Install the alternate stack. */ altstack.ss_sp = mystack + sizeof mystack / 2; altstack.ss_size = sizeof mystack / 2; stack_lower_bound = (char *) altstack.ss_sp; stack_upper_bound = (char *) altstack.ss_sp + altstack.ss_size - 1; altstack.ss_flags = 0; /* no SS_DISABLE */ if (sigaltstack (&altstack, NULL) < 0) exit (2); /* Install the SIGSEGV handler. */ sigemptyset (&action.sa_mask); action.sa_handler = &stackoverflow_handler; action.sa_flags = SA_ONSTACK; if (sigaction (SIGSEGV, &action, (struct sigaction *) NULL) < 0) exit(3); /* Provoke a SIGSEGV. */ raise (SIGSEGV); exit (3); } _ACEOF if ac_fn_c_try_run "$LINENO" then : sv_cv_sigaltstack_low_base=yes else $as_nop sv_cv_sigaltstack_low_base=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sv_cv_sigaltstack_low_base" >&5 printf "%s\n" "$sv_cv_sigaltstack_low_base" >&6; } if test "$sv_cv_sigaltstack_low_base" = no; then printf "%s\n" "#define SIGALTSTACK_SS_REVERSED 1" >>confdefs.h fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5 printf %s "checking for ssize_t... " >&6; } if test ${gt_cv_ssize_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> int main (void) { int x = sizeof (ssize_t *) + sizeof (ssize_t); return !x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gt_cv_ssize_t=yes else $as_nop gt_cv_ssize_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_ssize_t" >&5 printf "%s\n" "$gt_cv_ssize_t" >&6; } if test $gt_cv_ssize_t = no; then printf "%s\n" "#define ssize_t int" >>confdefs.h fi case "$host_os" in mingw*) REPLACE_STAT=1 ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5 printf %s "checking whether stat handles trailing slashes on files... " >&6; } if test ${gl_cv_func_stat_file_slash+y} then : printf %s "(cached) " >&6 else $as_nop touch conftest.tmp # Assume that if we have lstat, we can also check symlinks. if test $ac_cv_func_lstat = yes; then ln -s conftest.tmp conftest.lnk fi if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/stat.h> int main (void) { int result = 0; struct stat st; if (!stat ("conftest.tmp/", &st)) result |= 1; #if HAVE_LSTAT if (!stat ("conftest.lnk/", &st)) result |= 2; #endif return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_stat_file_slash=yes else $as_nop gl_cv_func_stat_file_slash=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.tmp conftest.lnk fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_file_slash" >&5 printf "%s\n" "$gl_cv_func_stat_file_slash" >&6; } case $gl_cv_func_stat_file_slash in *no) REPLACE_STAT=1 printf "%s\n" "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h ;; esac case $host_os in solaris*) REPLACE_FSTAT=1 ;; esac ;; esac if test $REPLACE_STAT = 1; then gl_LIBOBJS="$gl_LIBOBJS stat.$ac_objext" case "$host_os" in mingw*) gl_LIBOBJS="$gl_LIBOBJS stat-w32.$ac_objext" ;; esac : fi GL_GNULIB_STAT=1 printf "%s\n" "#define GNULIB_TEST_STAT 1" >>confdefs.h ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.tv_nsec" "ac_cv_member_struct_stat_st_atim_tv_nsec" "#include <sys/types.h> #include <sys/stat.h> " if test "x$ac_cv_member_struct_stat_st_atim_tv_nsec" = xyes then : printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether struct stat.st_atim is of type struct timespec" >&5 printf %s "checking whether struct stat.st_atim is of type struct timespec... " >&6; } if test ${ac_cv_typeof_struct_stat_st_atim_is_struct_timespec+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/stat.h> #if HAVE_SYS_TIME_H # include <sys/time.h> #endif #include <time.h> struct timespec ts; struct stat st; int main (void) { st.st_atim = ts; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes else $as_nop ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&5 printf "%s\n" "$ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&6; } if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then printf "%s\n" "#define TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC 1" >>confdefs.h fi else $as_nop ac_fn_c_check_member "$LINENO" "struct stat" "st_atimespec.tv_nsec" "ac_cv_member_struct_stat_st_atimespec_tv_nsec" "#include <sys/types.h> #include <sys/stat.h> " if test "x$ac_cv_member_struct_stat_st_atimespec_tv_nsec" = xyes then : printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1" >>confdefs.h else $as_nop ac_fn_c_check_member "$LINENO" "struct stat" "st_atimensec" "ac_cv_member_struct_stat_st_atimensec" "#include <sys/types.h> #include <sys/stat.h> " if test "x$ac_cv_member_struct_stat_st_atimensec" = xyes then : printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1" >>confdefs.h else $as_nop ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.st__tim.tv_nsec" "ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" "#include <sys/types.h> #include <sys/stat.h> " if test "x$ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" = xyes then : printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC 1" >>confdefs.h fi fi fi fi ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimespec.tv_nsec" "ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" "#include <sys/types.h> #include <sys/stat.h> " if test "x$ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" = xyes then : printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1" >>confdefs.h else $as_nop ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimensec" "ac_cv_member_struct_stat_st_birthtimensec" "#include <sys/types.h> #include <sys/stat.h> " if test "x$ac_cv_member_struct_stat_st_birthtimensec" = xyes then : printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC 1" >>confdefs.h else $as_nop ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtim.tv_nsec" "ac_cv_member_struct_stat_st_birthtim_tv_nsec" "#include <sys/types.h> #include <sys/stat.h> " if test "x$ac_cv_member_struct_stat_st_birthtim_tv_nsec" = xyes then : printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC 1" >>confdefs.h fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working stdalign.h" >&5 printf %s "checking for working stdalign.h... " >&6; } if test ${gl_cv_header_working_stdalign_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdint.h> #include <stdalign.h> #include <stddef.h> /* Test that alignof yields a result consistent with offsetof. This catches GCC bug 52023 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ #ifdef __cplusplus template <class t> struct alignof_helper { char a; t b; }; # define ao(type) offsetof (alignof_helper<type>, b) #else # define ao(type) offsetof (struct { char a; type b; }, b) #endif char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1]; char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; /* Test _Alignas only on platforms where gnulib can help. */ #if \ ((defined __cplusplus && 201103 <= __cplusplus) \ || (__TINYC__ && defined __attribute__) \ || (defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ : __GNUC__) \ || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__ \ || 1300 <= _MSC_VER) struct alignas_test { char c; char alignas (8) alignas_8; }; char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 ? 1 : -1]; #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_working_stdalign_h=yes else $as_nop gl_cv_header_working_stdalign_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdalign_h" >&5 printf "%s\n" "$gl_cv_header_working_stdalign_h" >&6; } if test $gl_cv_header_working_stdalign_h = yes; then STDALIGN_H='' else STDALIGN_H='stdalign.h' fi if test -n "$STDALIGN_H"; then GL_GENERATE_STDALIGN_H_TRUE= GL_GENERATE_STDALIGN_H_FALSE='#' else GL_GENERATE_STDALIGN_H_TRUE='#' GL_GENERATE_STDALIGN_H_FALSE= fi STDARG_H='' NEXT_STDARG_H='<stdarg.h>' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5 printf %s "checking for va_copy... " >&6; } if test ${gl_cv_func_va_copy+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdarg.h> int main (void) { #ifndef va_copy void (*func) (va_list, va_list) = va_copy; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_va_copy=yes else $as_nop gl_cv_func_va_copy=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_va_copy" >&5 printf "%s\n" "$gl_cv_func_va_copy" >&6; } if test $gl_cv_func_va_copy = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _AIX && !defined __GNUC__ AIX vaccine #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "vaccine" >/dev/null 2>&1 then : gl_aixcc=yes else $as_nop gl_aixcc=no fi rm -rf conftest* if test $gl_aixcc = yes; then STDARG_H=stdarg.h if test $gl_cv_have_include_next = yes; then gl_cv_next_stdarg_h='<'stdarg.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <stdarg.h>" >&5 printf %s "checking absolute name of <stdarg.h>... " >&6; } if test ${gl_cv_next_stdarg_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdarg.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'stdarg.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_stdarg_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_stdarg_h gl_cv_next_stdarg_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdarg_h" >&5 printf "%s\n" "$gl_cv_next_stdarg_h" >&6; } fi NEXT_STDARG_H=$gl_cv_next_stdarg_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'stdarg.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_stdarg_h fi NEXT_AS_FIRST_DIRECTIVE_STDARG_H=$gl_next_as_first_directive if test "$gl_cv_next_stdarg_h" = '""'; then gl_cv_next_stdarg_h='"///usr/include/stdarg.h"' NEXT_STDARG_H="$gl_cv_next_stdarg_h" fi else exec 9>&6 6>/dev/null if test ${gl_cv_func___va_copy+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdarg.h> int main (void) { #ifndef __va_copy error, bail out #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func___va_copy=yes else $as_nop gl_cv_func___va_copy=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi exec 6>&9 9>&- if test $gl_cv_func___va_copy = yes; then printf "%s\n" "#define va_copy __va_copy" >>confdefs.h else printf "%s\n" "#define va_copy gl_va_copy" >>confdefs.h fi fi fi if test -n "$STDARG_H"; then GL_GENERATE_STDARG_H_TRUE= GL_GENERATE_STDARG_H_FALSE='#' else GL_GENERATE_STDARG_H_TRUE='#' GL_GENERATE_STDARG_H_FALSE= fi if test "$ac_cv_header_stdbool_h" = yes; then case "$host_os" in solaris*) if test -z "$GCC"; then STDBOOL_H='stdbool.h' else STDBOOL_H='' fi ;; *) STDBOOL_H='' ;; esac else STDBOOL_H='stdbool.h' fi if test -n "$STDBOOL_H"; then GL_GENERATE_STDBOOL_H_TRUE= GL_GENERATE_STDBOOL_H_FALSE='#' else GL_GENERATE_STDBOOL_H_TRUE='#' GL_GENERATE_STDBOOL_H_FALSE= fi if test "$ac_cv_type__Bool" = yes; then HAVE__BOOL=1 else HAVE__BOOL=0 fi GL_GNULIB_FSCANF=1 printf "%s\n" "#define GNULIB_TEST_FSCANF 1" >>confdefs.h printf "%s\n" "#define GNULIB_FSCANF 1" >>confdefs.h GL_GNULIB_SCANF=1 printf "%s\n" "#define GNULIB_TEST_SCANF 1" >>confdefs.h printf "%s\n" "#define GNULIB_SCANF 1" >>confdefs.h GL_GNULIB_FGETC=1 printf "%s\n" "#define GNULIB_TEST_FGETC 1" >>confdefs.h GL_GNULIB_GETC=1 printf "%s\n" "#define GNULIB_TEST_GETC 1" >>confdefs.h GL_GNULIB_GETCHAR=1 printf "%s\n" "#define GNULIB_TEST_GETCHAR 1" >>confdefs.h GL_GNULIB_FGETS=1 printf "%s\n" "#define GNULIB_TEST_FGETS 1" >>confdefs.h GL_GNULIB_FREAD=1 printf "%s\n" "#define GNULIB_TEST_FREAD 1" >>confdefs.h GL_GNULIB_FPRINTF=1 printf "%s\n" "#define GNULIB_TEST_FPRINTF 1" >>confdefs.h GL_GNULIB_PRINTF=1 printf "%s\n" "#define GNULIB_TEST_PRINTF 1" >>confdefs.h GL_GNULIB_VFPRINTF=1 printf "%s\n" "#define GNULIB_TEST_VFPRINTF 1" >>confdefs.h GL_GNULIB_VPRINTF=1 printf "%s\n" "#define GNULIB_TEST_VPRINTF 1" >>confdefs.h GL_GNULIB_FPUTC=1 printf "%s\n" "#define GNULIB_TEST_FPUTC 1" >>confdefs.h GL_GNULIB_PUTC=1 printf "%s\n" "#define GNULIB_TEST_PUTC 1" >>confdefs.h GL_GNULIB_PUTCHAR=1 printf "%s\n" "#define GNULIB_TEST_PUTCHAR 1" >>confdefs.h GL_GNULIB_FPUTS=1 printf "%s\n" "#define GNULIB_TEST_FPUTS 1" >>confdefs.h GL_GNULIB_PUTS=1 printf "%s\n" "#define GNULIB_TEST_PUTS 1" >>confdefs.h GL_GNULIB_FWRITE=1 printf "%s\n" "#define GNULIB_TEST_FWRITE 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "stpcpy" "ac_cv_func_stpcpy" if test "x$ac_cv_func_stpcpy" = xyes then : printf "%s\n" "#define HAVE_STPCPY 1" >>confdefs.h fi if test $ac_cv_func_stpcpy = no; then HAVE_STPCPY=0 fi if test $HAVE_STPCPY = 0; then gl_LIBOBJS="$gl_LIBOBJS stpcpy.$ac_objext" : fi GL_GNULIB_STPCPY=1 printf "%s\n" "#define GNULIB_TEST_STPCPY 1" >>confdefs.h if test $gl_cv_func_malloc_posix != yes; then REPLACE_STRDUP=1 fi if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 fi if test $REPLACE_STRDUP = 1; then gl_LIBOBJS="$gl_LIBOBJS strdup.$ac_objext" : fi GL_GNULIB_STRDUP=1 printf "%s\n" "#define GNULIB_TEST_STRDUP 1" >>confdefs.h if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strerror function" >&5 printf %s "checking for working strerror function... " >&6; } if test ${gl_cv_func_working_strerror+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_working_strerror="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> int main (void) { if (!*strerror (-2)) return 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_working_strerror=yes else $as_nop gl_cv_func_working_strerror=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_strerror" >&5 printf "%s\n" "$gl_cv_func_working_strerror" >&6; } case "$gl_cv_func_working_strerror" in *yes) ;; *) REPLACE_STRERROR=1 ;; esac case "$gl_cv_func_strerror_r_works" in *no) REPLACE_STRERROR=1 ;; esac else REPLACE_STRERROR=1 fi if test $REPLACE_STRERROR = 1; then gl_LIBOBJS="$gl_LIBOBJS strerror.$ac_objext" fi printf "%s\n" "#define GNULIB_STRERROR 1" >>confdefs.h GL_GNULIB_STRERROR=1 printf "%s\n" "#define GNULIB_TEST_STRERROR 1" >>confdefs.h if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then gl_LIBOBJS="$gl_LIBOBJS strerror-override.$ac_objext" if test $ac_cv_header_sys_socket_h != yes; then ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" if test "x$ac_cv_header_winsock2_h" = xyes then : printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h fi fi if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 UNISTD_H_HAVE_WINSOCK2_H=1 SYS_IOCTL_H_HAVE_WINSOCK2_H=1 else HAVE_WINSOCK2_H=0 fi fi if test $gl_cond_libtool = false; then gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV" gl_libdeps="$gl_libdeps $LIBICONV" fi if test $ac_cv_have_decl_strnlen = no; then HAVE_DECL_STRNLEN=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strnlen" >&5 printf %s "checking for working strnlen... " >&6; } if test ${ac_cv_func_strnlen_working+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : # Guess no on AIX systems, yes otherwise. case "$host_os" in aix*) ac_cv_func_strnlen_working=no;; *) ac_cv_func_strnlen_working=yes;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { #define S "foobar" #define S_LEN (sizeof S - 1) /* At least one implementation is buggy: that of AIX 4.3 would give strnlen (S, 1) == 3. */ int i; for (i = 0; i < S_LEN + 1; ++i) { int expected = i <= S_LEN ? i : S_LEN; if (strnlen (S, i) != expected) return 1; } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_strnlen_working=yes else $as_nop ac_cv_func_strnlen_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strnlen_working" >&5 printf "%s\n" "$ac_cv_func_strnlen_working" >&6; } test $ac_cv_func_strnlen_working = no && : if test $ac_cv_func_strnlen_working = no; then REPLACE_STRNLEN=1 fi fi if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then gl_LIBOBJS="$gl_LIBOBJS strnlen.$ac_objext" : fi GL_GNULIB_STRNLEN=1 printf "%s\n" "#define GNULIB_TEST_STRNLEN 1" >>confdefs.h if test $REPLACE_STRSTR = 0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strstr works in linear time" >&5 printf %s "checking whether strstr works in linear time... " >&6; } if test ${gl_cv_func_strstr_linear+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <features.h> #ifdef __GNU_LIBRARY__ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ && !(defined __i386__ || defined __x86_64__) \ && !defined __UCLIBC__ Lucky user #endif #endif #ifdef __CYGWIN__ #include <cygwin/version.h> #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) Lucky user #endif #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1 then : gl_cv_func_strstr_linear="guessing yes" else $as_nop gl_cv_func_strstr_linear="$gl_cross_guess_normal" fi rm -rf conftest* else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __MVS__ /* z/OS does not deliver signals while strstr() is running (thanks to restrictions on its LE runtime), which prevents us from limiting the running time of this test. */ # error "This test does not work properly on z/OS" #endif #include <signal.h> /* for signal */ #include <string.h> /* for strstr */ #include <stdlib.h> /* for malloc */ #include <unistd.h> /* for alarm */ static void quit (int sig) { _exit (sig + 128); } int main (void) { int result = 0; size_t m = 1000000; char *haystack = (char *) malloc (2 * m + 2); char *needle = (char *) malloc (m + 2); /* Failure to compile this test due to missing alarm is okay, since all such platforms (mingw) also have quadratic strstr. */ signal (SIGALRM, quit); alarm (5); /* Check for quadratic performance. */ if (haystack && needle) { memset (haystack, 'A', 2 * m); haystack[2 * m] = 'B'; haystack[2 * m + 1] = 0; memset (needle, 'A', m); needle[m] = 'B'; needle[m + 1] = 0; if (!strstr (haystack, needle)) result |= 1; } /* Free allocated memory, in case some sanitizer is watching. */ free (haystack); free (needle); return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_strstr_linear=yes else $as_nop gl_cv_func_strstr_linear=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strstr_linear" >&5 printf "%s\n" "$gl_cv_func_strstr_linear" >&6; } case "$gl_cv_func_strstr_linear" in *yes) ;; *) REPLACE_STRSTR=1 ;; esac fi if test $REPLACE_STRSTR = 1; then gl_LIBOBJS="$gl_LIBOBJS strstr.$ac_objext" fi if test $REPLACE_MEMCHR = 1; then REPLACE_STRSTR=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strstr works" >&5 printf %s "checking whether strstr works... " >&6; } if test ${gl_cv_func_strstr_works_always+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> /* for __GNU_LIBRARY__ */ #ifdef __GNU_LIBRARY__ #include <features.h> #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ || defined __UCLIBC__ Lucky user #endif #elif defined __CYGWIN__ #include <cygwin/version.h> #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) Lucky user #endif #else Lucky user #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1 then : gl_cv_func_strstr_works_always="guessing yes" else $as_nop gl_cv_func_strstr_works_always="$gl_cross_guess_normal" fi rm -rf conftest* else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> /* for __GNU_LIBRARY__, strstr */ #ifdef __GNU_LIBRARY__ #include <features.h> #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28 Unlucky user #endif #endif #define P "_EF_BF_BD" #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P #define NEEDLE P P P P P int main (void) { return !!strstr (HAYSTACK, NEEDLE); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_strstr_works_always=yes else $as_nop gl_cv_func_strstr_works_always=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strstr_works_always" >&5 printf "%s\n" "$gl_cv_func_strstr_works_always" >&6; } case "$gl_cv_func_strstr_works_always" in *yes) ;; *) REPLACE_STRSTR=1 ;; esac fi if test $REPLACE_STRSTR = 1; then gl_LIBOBJS="$gl_LIBOBJS strstr.$ac_objext" fi GL_GNULIB_STRSTR=1 printf "%s\n" "#define GNULIB_TEST_STRSTR 1" >>confdefs.h if test "$ac_cv_have_decl_strtoimax" != yes; then HAVE_DECL_STRTOIMAX=0 fi if test "$ac_cv_func_strtoimax" = yes; then HAVE_STRTOIMAX=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strtoimax works" >&5 printf %s "checking whether strtoimax works... " >&6; } if test ${gl_cv_func_strtoimax+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on AIX 5. aix5*) gl_cv_func_strtoimax="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_strtoimax="guessing yes" ;; # Guess yes otherwise. *) gl_cv_func_strtoimax="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #include <string.h> #include <inttypes.h> int main () { if (sizeof (intmax_t) > sizeof (int)) { const char *s = "4294967295"; char *p; intmax_t res; errno = 0; res = strtoimax (s, &p, 10); if (p != s + strlen (s)) return 1; if (errno != 0) return 2; if (res != (intmax_t) 65535 * (intmax_t) 65537) return 3; } else { const char *s = "2147483647"; char *p; intmax_t res; errno = 0; res = strtoimax (s, &p, 10); if (p != s + strlen (s)) return 1; if (errno != 0) return 2; if (res != 2147483647) return 3; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_strtoimax=yes else $as_nop gl_cv_func_strtoimax=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strtoimax" >&5 printf "%s\n" "$gl_cv_func_strtoimax" >&6; } case "$gl_cv_func_strtoimax" in *no) REPLACE_STRTOIMAX=1 ;; esac else if test "$ac_cv_have_decl_strtoimax" = yes; then # HP-UX 11.11 has "#define strtoimax(...) ..." but no function. REPLACE_STRTOIMAX=1 fi HAVE_STRTOIMAX=0 fi if test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; then gl_LIBOBJS="$gl_LIBOBJS strtoimax.$ac_objext" ac_fn_check_decl "$LINENO" "strtoll" "ac_cv_have_decl_strtoll" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_strtoll" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_STRTOLL $ac_have_decl" >>confdefs.h fi GL_GNULIB_STRTOIMAX=1 ac_fn_c_check_func "$LINENO" "strtoll" "ac_cv_func_strtoll" if test "x$ac_cv_func_strtoll" = xyes then : printf "%s\n" "#define HAVE_STRTOLL 1" >>confdefs.h fi if test $ac_cv_func_strtoll = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strtoll works" >&5 printf %s "checking whether strtoll works... " >&6; } if test ${gl_cv_func_strtoll_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on native Windows. mingw*) gl_cv_func_strtoll_works="guessing no" ;; *) gl_cv_func_strtoll_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> int main (void) { int result = 0; char *term; /* This test fails on Minix and native Windows. */ { const char input[] = "0x"; (void) strtoll (input, &term, 16); if (term != input + 1) result |= 1; } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_strtoll_works=yes else $as_nop gl_cv_func_strtoll_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strtoll_works" >&5 printf "%s\n" "$gl_cv_func_strtoll_works" >&6; } case "$gl_cv_func_strtoll_works" in *yes) ;; *) REPLACE_STRTOLL=1 ;; esac else HAVE_STRTOLL=0 fi if test $HAVE_STRTOLL = 0 || test $REPLACE_STRTOLL = 1; then gl_LIBOBJS="$gl_LIBOBJS strtoll.$ac_objext" : fi GL_GNULIB_STRTOLL=1 printf "%s\n" "#define GNULIB_TEST_STRTOLL 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "strtoull" "ac_cv_func_strtoull" if test "x$ac_cv_func_strtoull" = xyes then : printf "%s\n" "#define HAVE_STRTOULL 1" >>confdefs.h fi if test $ac_cv_func_strtoull = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strtoull works" >&5 printf %s "checking whether strtoull works... " >&6; } if test ${gl_cv_func_strtoull_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on native Windows. mingw*) gl_cv_func_strtoull_works="guessing no" ;; *) gl_cv_func_strtoull_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> int main (void) { int result = 0; char *term; /* This test fails on Minix and native Windows. */ { const char input[] = "0x"; (void) strtoull (input, &term, 16); if (term != input + 1) result |= 1; } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_strtoull_works=yes else $as_nop gl_cv_func_strtoull_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strtoull_works" >&5 printf "%s\n" "$gl_cv_func_strtoull_works" >&6; } case "$gl_cv_func_strtoull_works" in *yes) ;; *) REPLACE_STRTOULL=1 ;; esac else HAVE_STRTOULL=0 fi if test $HAVE_STRTOULL = 0 || test $REPLACE_STRTOULL = 1; then gl_LIBOBJS="$gl_LIBOBJS strtoull.$ac_objext" : fi GL_GNULIB_STRTOULL=1 printf "%s\n" "#define GNULIB_TEST_STRTOULL 1" >>confdefs.h if test "$ac_cv_have_decl_strtoumax" = yes; then if test "$ac_cv_func_strtoumax" != yes; then # HP-UX 11.11 has "#define strtoimax(...) ..." but no function. REPLACE_STRTOUMAX=1 fi else HAVE_DECL_STRTOUMAX=0 fi if test $HAVE_DECL_STRTOUMAX = 0 || test $REPLACE_STRTOUMAX = 1; then gl_LIBOBJS="$gl_LIBOBJS strtoumax.$ac_objext" ac_fn_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_strtoull" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_STRTOULL $ac_have_decl" >>confdefs.h fi GL_GNULIB_STRTOUMAX=1 if { test "$HAVE_LIBUNISTRING" != yes \ || { test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ && test $LIBUNISTRING_VERSION_SUBMINOR -lt 11 } } } } }; then LIBUNISTRING_UNISTR_H='unistr.h' else LIBUNISTRING_UNISTR_H= fi printf "%s\n" "#define GNULIB_UNISTR_U8_MBTOUCR 1" >>confdefs.h if { test "$HAVE_LIBUNISTRING" != yes \ || { test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ && test $LIBUNISTRING_VERSION_SUBMINOR -lt 0 } } } } }; then LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE= LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_FALSE='#' else LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE='#' LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_FALSE= fi printf "%s\n" "#define GNULIB_UNISTR_U8_UCTOMB 1" >>confdefs.h if { test "$HAVE_LIBUNISTRING" != yes \ || { test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ && test $LIBUNISTRING_VERSION_SUBMINOR -lt 0 } } } } }; then LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE= LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_FALSE='#' else LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE='#' LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_FALSE= fi if { test "$HAVE_LIBUNISTRING" != yes \ || { test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ && test $LIBUNISTRING_VERSION_SUBMINOR -lt 11 } } } } }; then LIBUNISTRING_UNITYPES_H='unitypes.h' else LIBUNISTRING_UNITYPES_H= fi if { test "$HAVE_LIBUNISTRING" != yes \ || { test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ && test $LIBUNISTRING_VERSION_SUBMINOR -lt 11 } } } } }; then LIBUNISTRING_UNIWIDTH_H='uniwidth.h' else LIBUNISTRING_UNIWIDTH_H= fi if { test "$HAVE_LIBUNISTRING" != yes \ || { test $LIBUNISTRING_VERSION_MAJOR -lt 0 \ || { test $LIBUNISTRING_VERSION_MAJOR -eq 0 \ && { test $LIBUNISTRING_VERSION_MINOR -lt 9 \ || { test $LIBUNISTRING_VERSION_MINOR -eq 9 \ && test $LIBUNISTRING_VERSION_SUBMINOR -lt 8 } } } } }; then LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE= LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE='#' else LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE='#' LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE= fi printf "%s\n" "#define GNULIB_STDIO_SINGLE_THREAD 1" >>confdefs.h printf "%s\n" "#define USE_UNLOCKED_IO GNULIB_STDIO_SINGLE_THREAD" >>confdefs.h # Check whether --with-packager was given. if test ${with_packager+y} then : withval=$with_packager; case $withval in yes|no) ;; *) printf "%s\n" "#define PACKAGE_PACKAGER \"$withval\"" >>confdefs.h ;; esac fi # Check whether --with-packager-version was given. if test ${with_packager_version+y} then : withval=$with_packager_version; case $withval in yes|no) ;; *) printf "%s\n" "#define PACKAGE_PACKAGER_VERSION \"$withval\"" >>confdefs.h ;; esac fi # Check whether --with-packager-bug-reports was given. if test ${with_packager_bug_reports+y} then : withval=$with_packager_bug_reports; case $withval in yes|no) ;; *) printf "%s\n" "#define PACKAGE_PACKAGER_BUG_REPORTS \"$withval\"" >>confdefs.h ;; esac fi if test "X$with_packager" = "X" && \ test "X$with_packager_version$with_packager_bug_reports" != "X" then as_fn_error $? "The --with-packager-{bug-reports,version} options require --with-packager" "$LINENO" 5 fi if case "$host_os" in mingw*) true ;; *) test $ac_cv_func_mbsinit = yes ;; esac \ && test $ac_cv_func_mbrtowc = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 printf %s "checking whether mbrtowc handles incomplete characters... " >&6; } if test ${gl_cv_func_mbrtowc_incomplete_state+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on AIX and OSF/1. aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; esac if test $LOCALE_JA != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_incomplete_state=yes else $as_nop gl_cv_func_mbrtowc_incomplete_state=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else if test $LOCALE_FR_UTF8 != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { const char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_incomplete_state=yes else $as_nop gl_cv_func_mbrtowc_incomplete_state=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_incomplete_state" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_incomplete_state" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works as well as mbtowc" >&5 printf %s "checking whether mbrtowc works as well as mbtowc... " >&6; } if test ${gl_cv_func_mbrtowc_sanitycheck+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on Solaris 8. solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; esac if test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main () { /* This fails on Solaris 8: mbrtowc returns 2, and sets wc to 0x00F0. mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 6, &state) != 4 && mbtowc (&wc, input + 3, 6) == 4) return 2; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_mbrtowc_sanitycheck=yes else $as_nop gl_cv_func_mbrtowc_sanitycheck=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_sanitycheck" >&5 printf "%s\n" "$gl_cv_func_mbrtowc_sanitycheck" >&6; } REPLACE_MBSTATE_T=0 case "$gl_cv_func_mbrtowc_incomplete_state" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac case "$gl_cv_func_mbrtowc_sanitycheck" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac else REPLACE_MBSTATE_T=1 fi if test $ac_cv_func_wcrtomb = no; then HAVE_WCRTOMB=0 ac_fn_check_decl "$LINENO" "wcrtomb" "ac_cv_have_decl_wcrtomb" " #include <wchar.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_wcrtomb" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_WCRTOMB $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_wcrtomb = yes; then REPLACE_WCRTOMB=1 fi else if test $REPLACE_WCRTOMB = 0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether wcrtomb works in the C locale" >&5 printf %s "checking whether wcrtomb works in the C locale... " >&6; } if test ${gl_cv_func_wcrtomb_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on Android. linux*-android*) gl_cv_func_wcrtomb_works="guessing no";; # Guess yes otherwise. *) gl_cv_func_wcrtomb_works="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> #include <stdlib.h> #include <wchar.h> int main () { mbstate_t state; char out[64]; int count; memset (&state, 0, sizeof (state)); out[0] = 'x'; count = wcrtomb (out, L'a', &state); return !(count == 1 && out[0] == 'a'); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_wcrtomb_works=yes else $as_nop gl_cv_func_wcrtomb_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wcrtomb_works" >&5 printf "%s\n" "$gl_cv_func_wcrtomb_works" >&6; } case "$gl_cv_func_wcrtomb_works" in *yes) ;; *) printf "%s\n" "#define WCRTOMB_C_LOCALE_BUG 1" >>confdefs.h REPLACE_WCRTOMB=1 ;; esac fi if test $REPLACE_WCRTOMB = 0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether wcrtomb return value is correct" >&5 printf %s "checking whether wcrtomb return value is correct... " >&6; } if test ${gl_cv_func_wcrtomb_retval+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on AIX 4, OSF/1, Solaris, native Windows. aix4* | osf* | solaris* | mingw*) gl_cv_func_wcrtomb_retval="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_wcrtomb_retval="guessing yes" ;; esac if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <string.h> #include <wchar.h> #include <stdlib.h> int main () { int result = 0; if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 1; } if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 2; { wchar_t wc = (wchar_t) 0xBADFACE; if (mbtowc (&wc, "\303\274", 2) == 2) if (wcrtomb (NULL, wc, NULL) != 1) result |= 2; } } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 4; } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 8; } return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_wcrtomb_retval=yes else $as_nop gl_cv_func_wcrtomb_retval=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wcrtomb_retval" >&5 printf "%s\n" "$gl_cv_func_wcrtomb_retval" >&6; } case "$gl_cv_func_wcrtomb_retval" in *yes) ;; *) printf "%s\n" "#define WCRTOMB_RETVAL_BUG 1" >>confdefs.h REPLACE_WCRTOMB=1 ;; esac fi fi if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then gl_LIBOBJS="$gl_LIBOBJS wcrtomb.$ac_objext" : fi GL_GNULIB_WCRTOMB=1 printf "%s\n" "#define GNULIB_TEST_WCRTOMB 1" >>confdefs.h if test $ac_cv_func_wctob = no; then HAVE_WCTOB=0 HAVE_DECL_WCTOB=0 else HAVE_WCTOB=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether wctob works" >&5 printf %s "checking whether wctob works... " >&6; } if test ${gl_cv_func_wctob_works+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in # Guess no on Solaris <= 9 and Cygwin. solaris2.[1-9] | solaris2.[1-9].* | cygwin*) gl_cv_func_wctob_works="guessing no" ;; # Guess no on native Windows. mingw*) gl_cv_func_wctob_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_wctob_works="guessing yes" ;; esac case "$host_os" in cygwin*) if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <wchar.h> register long global __asm__ ("%ebx"); int main () { setlocale (LC_ALL, "en_US.UTF-8"); global = 0x12345678; if (wctob (0x00FC) != -1) return 1; if (global != 0x12345678) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : : else $as_nop gl_cv_func_wctob_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi ;; esac if test "$gl_cv_func_wctob_works" != no && test $LOCALE_FR != none; then if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { wchar_t wc; if (mbtowc (&wc, "\374", 1) == 1) if (wctob (wc) != (unsigned char) '\374') return 1; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_wctob_works=yes else $as_nop gl_cv_func_wctob_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wctob_works" >&5 printf "%s\n" "$gl_cv_func_wctob_works" >&6; } case "$gl_cv_func_wctob_works" in *yes) ;; *) REPLACE_WCTOB=1 ;; esac if test $REPLACE_WCTOB = 0; then ac_fn_check_decl "$LINENO" "wctob" "ac_cv_have_decl_wctob" " #include <wchar.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_wctob" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_WCTOB $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_wctob != yes; then HAVE_DECL_WCTOB=0 fi fi fi if test $HAVE_WCTOB = 0 || test $REPLACE_WCTOB = 1; then gl_LIBOBJS="$gl_LIBOBJS wctob.$ac_objext" : fi GL_GNULIB_WCTOB=1 printf "%s\n" "#define GNULIB_TEST_WCTOB 1" >>confdefs.h if false; then REPLACE_WCTOMB=1 fi if test $REPLACE_WCTOMB = 1; then gl_LIBOBJS="$gl_LIBOBJS wctomb.$ac_objext" : fi GL_GNULIB_WCTOMB=1 printf "%s\n" "#define GNULIB_TEST_WCTOMB 1" >>confdefs.h ac_fn_check_decl "$LINENO" "wcwidth" "ac_cv_have_decl_wcwidth" " #include <wchar.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_wcwidth" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_WCWIDTH $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_wcwidth != yes; then HAVE_DECL_WCWIDTH=0 fi if test $ac_cv_func_wcwidth != yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether wcwidth is a macro" >&5 printf %s "checking whether wcwidth is a macro... " >&6; } if test ${gl_cv_func_wcwidth_macro+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> #ifdef wcwidth wchar_header_defines_wcwidth #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "wchar_header_defines_wcwidth" >/dev/null 2>&1 then : gl_cv_func_wcwidth_macro=yes else $as_nop gl_cv_func_wcwidth_macro=no fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wcwidth_macro" >&5 printf "%s\n" "$gl_cv_func_wcwidth_macro" >&6; } fi if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then HAVE_WCWIDTH=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether wcwidth works reasonably in UTF-8 locales" >&5 printf %s "checking whether wcwidth works reasonably in UTF-8 locales... " >&6; } if test ${gl_cv_func_wcwidth_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_wcwidth_works="guessing yes";; # Guess yes on AIX 7 systems. aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";; *) gl_cv_func_wcwidth_works="$gl_cross_guess_normal";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <wchar.h> #if !HAVE_DECL_WCWIDTH extern # ifdef __cplusplus "C" # endif int wcwidth (int); #endif int main () { int result = 0; if (setlocale (LC_ALL, "en_US.UTF-8") != NULL) { if (wcwidth (0x0301) > 0) result |= 1; if (wcwidth (0x05B0) > 0) result |= 2; if (wcwidth (0x200B) > 0) result |= 4; if (wcwidth (0xFF1A) == 0) result |= 8; if (wcwidth (0x2202) > 1) result |= 16; } return result; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_wcwidth_works=yes else $as_nop gl_cv_func_wcwidth_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wcwidth_works" >&5 printf "%s\n" "$gl_cv_func_wcwidth_works" >&6; } case "$gl_cv_func_wcwidth_works" in *yes) ;; *no) REPLACE_WCWIDTH=1 ;; esac else HAVE_WCWIDTH=0 fi if test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1; then gl_LIBOBJS="$gl_LIBOBJS wcwidth.$ac_objext" : fi GL_GNULIB_WCWIDTH=1 printf "%s\n" "#define GNULIB_TEST_WCWIDTH 1" >>confdefs.h case "$host_os" in mingw*) gl_LIBOBJS="$gl_LIBOBJS windows-mutex.$ac_objext" ;; esac case "$host_os" in mingw*) gl_LIBOBJS="$gl_LIBOBJS windows-once.$ac_objext" ;; esac case "$host_os" in mingw*) gl_LIBOBJS="$gl_LIBOBJS windows-recmutex.$ac_objext" ;; esac case "$host_os" in mingw*) gl_LIBOBJS="$gl_LIBOBJS windows-rwlock.$ac_objext" ;; esac case "$host_os" in mingw*) GL_GNULIB_OVERRIDES_STRUCT_STAT=1 ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wmemchr" >&5 printf %s "checking for wmemchr... " >&6; } if test ${gl_cv_func_wmemchr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> int main (void) { return ! wmemchr ((const wchar_t *) 0, (wchar_t) ' ', 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_func_wmemchr=yes else $as_nop gl_cv_func_wmemchr=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wmemchr" >&5 printf "%s\n" "$gl_cv_func_wmemchr" >&6; } if test $gl_cv_func_wmemchr = no; then HAVE_WMEMCHR=0 fi if test $HAVE_WMEMCHR = 0; then gl_LIBOBJS="$gl_LIBOBJS wmemchr.$ac_objext" fi GL_GNULIB_WMEMCHR=1 printf "%s\n" "#define GNULIB_TEST_WMEMCHR 1" >>confdefs.h if test $ac_cv_func_wmempcpy = no; then HAVE_WMEMPCPY=0 fi if test $HAVE_WMEMPCPY = 0; then gl_LIBOBJS="$gl_LIBOBJS wmempcpy.$ac_objext" fi GL_GNULIB_WMEMPCPY=1 printf "%s\n" "#define GNULIB_TEST_WMEMPCPY 1" >>confdefs.h : printf "%s\n" "#define GNULIB_XALLOC 1" >>confdefs.h printf "%s\n" "#define GNULIB_XALLOC_DIE 1" >>confdefs.h : # End of code from modules gltests_libdeps= gltests_ltlibdeps= gl_source_base='gnulib-tests' gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS gl_module_indicator_condition=$gltests_WITNESS if test "$ac_cv_header_winsock2_h" = yes; then gltests_LIBOBJS="$gltests_LIBOBJS accept.$ac_objext" fi if test "$GL_GNULIB_ACCEPT" != 1; then if test "$GL_GNULIB_ACCEPT" = 0; then GL_GNULIB_ACCEPT=$gl_module_indicator_condition else GL_GNULIB_ACCEPT="($GL_GNULIB_ACCEPT || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_ACCEPT 1" >>confdefs.h if test "$ac_cv_header_winsock2_h" = yes; then gltests_LIBOBJS="$gltests_LIBOBJS bind.$ac_objext" fi if test "$GL_GNULIB_BIND" != 1; then if test "$GL_GNULIB_BIND" = 0; then GL_GNULIB_BIND=$gl_module_indicator_condition else GL_GNULIB_BIND="($GL_GNULIB_BIND || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_BIND 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 printf %s "checking for a traditional french locale... " >&6; } if test ${gt_cv_locale_fr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 else # None found. gt_cv_locale_fr=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO-8859-1 else # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO8859-1 else # Test for the HP-UX locale name. if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else # Test for the Solaris 7 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else # None found. gt_cv_locale_fr=none fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr" >&5 printf "%s\n" "$gt_cv_locale_fr" >&6; } LOCALE_FR=$gt_cv_locale_fr { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 printf %s "checking for a french Unicode locale... " >&6; } if test ${gt_cv_locale_fr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 printf %s "checking for a traditional french locale... " >&6; } if test ${gt_cv_locale_fr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 else # None found. gt_cv_locale_fr=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO-8859-1 else # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO8859-1 else # Test for the HP-UX locale name. if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else # Test for the Solaris 7 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else # None found. gt_cv_locale_fr=none fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr" >&5 printf "%s\n" "$gt_cv_locale_fr" >&6; } LOCALE_FR=$gt_cv_locale_fr { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a turkish Unicode locale" >&5 printf %s "checking for a turkish Unicode locale... " >&6; } if test ${gt_cv_locale_tr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> #include <wctype.h> struct tm t; char buf[16]; int main () { /* On BeOS, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. But BeOS does not implement the Turkish upper-/lowercase mappings. Therefore, let this program return 1 on BeOS. */ /* Check whether the given locale name is recognized by the system. */ #if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; #else if (setlocale (LC_ALL, "") == NULL) return 1; #endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the tr_TR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ #if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } #endif #ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; #endif /* Check whether in the abbreviation of the eighth month, the second character (should be U+011F: LATIN SMALL LETTER G WITH BREVE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1992 - 1900; t.tm_mon = 8 - 1; t.tm_mday = 19; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc4 || buf[2] != (char) 0x9f) return 1; /* Check whether the upper-/lowercase mappings are as expected for Turkish. */ if (towupper ('i') != 0x0130 || towlower (0x0130) != 'i' || towupper(0x0131) != 'I' || towlower ('I') != 0x0131) return 1; return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Turkish_Turkey.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=Turkish_Turkey.65001 else # None found. gt_cv_locale_tr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=tr_TR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=tr_TR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=tr_TR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=tr_TR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=tr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=tr.UTF-8 else # None found. gt_cv_locale_tr_utf8=none fi fi fi ;; esac else gt_cv_locale_tr_utf8=none fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_tr_utf8" >&5 printf "%s\n" "$gt_cv_locale_tr_utf8" >&6; } LOCALE_TR_UTF8=$gt_cv_locale_tr_utf8 if test "$ac_cv_header_winsock2_h" = yes; then gltests_LIBOBJS="$gltests_LIBOBJS connect.$ac_objext" fi if test "$GL_GNULIB_CONNECT" != 1; then if test "$GL_GNULIB_CONNECT" = 0; then GL_GNULIB_CONNECT=$gl_module_indicator_condition else GL_GNULIB_CONNECT="($GL_GNULIB_CONNECT || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_CONNECT 1" >>confdefs.h if test "$GL_GNULIB_ENVIRON" != 1; then if test "$GL_GNULIB_ENVIRON" = 0; then GL_GNULIB_ENVIRON=$gl_module_indicator_condition else GL_GNULIB_ENVIRON="($GL_GNULIB_ENVIRON || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_ENVIRON 1" >>confdefs.h if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then REPLACE_FDOPEN=1 fi if test $REPLACE_FDOPEN = 0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fdopen sets errno" >&5 printf %s "checking whether fdopen sets errno... " >&6; } if test ${gl_cv_func_fdopen_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in mingw*) gl_cv_func_fdopen_works="guessing no" ;; *) gl_cv_func_fdopen_works="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #include <errno.h> $gl_mda_defines int main (void) { FILE *fp; errno = 0; fp = fdopen (-1, "r"); if (fp == NULL && errno == 0) return 1; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_fdopen_works=yes else $as_nop gl_cv_func_fdopen_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fdopen_works" >&5 printf "%s\n" "$gl_cv_func_fdopen_works" >&6; } case "$gl_cv_func_fdopen_works" in *no) REPLACE_FDOPEN=1 ;; esac fi if test $REPLACE_FDOPEN = 1; then gltests_LIBOBJS="$gltests_LIBOBJS fdopen.$ac_objext" fi if test "$GL_GNULIB_FDOPEN" != 1; then if test "$GL_GNULIB_FDOPEN" = 0; then GL_GNULIB_FDOPEN=$gl_module_indicator_condition else GL_GNULIB_FDOPEN="($GL_GNULIB_FDOPEN || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_FDOPEN 1" >>confdefs.h FLOAT_H= REPLACE_FLOAT_LDBL=0 case "$host_os" in aix* | beos* | openbsd* | mirbsd* | irix*) FLOAT_H=float.h ;; freebsd* | dragonfly*) case "$host_cpu" in i[34567]86 ) FLOAT_H=float.h ;; x86_64 ) # On x86_64 systems, the C compiler may still be generating # 32-bit code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __LP64__ || defined __x86_64__ || defined __amd64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop FLOAT_H=float.h fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac ;; linux*) case "$host_cpu" in powerpc*) FLOAT_H=float.h ;; esac ;; esac case "$host_os" in aix* | freebsd* | dragonfly* | linux*) if test -n "$FLOAT_H"; then REPLACE_FLOAT_LDBL=1 fi ;; esac REPLACE_ITOLD=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether conversion from 'int' to 'long double' works" >&5 printf %s "checking whether conversion from 'int' to 'long double' works... " >&6; } if test ${gl_cv_func_itold_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host" in sparc*-*-linux*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __LP64__ || defined __arch64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_itold_works="guessing no" else $as_nop gl_cv_func_itold_works="guessing yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; # Guess yes on native Windows. mingw*) gl_cv_func_itold_works="guessing yes" ;; *) gl_cv_func_itold_works="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int i = -1; volatile long double ld; int main () { ld += i * 1.0L; if (ld > 0) return 1; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_itold_works=yes else $as_nop gl_cv_func_itold_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_itold_works" >&5 printf "%s\n" "$gl_cv_func_itold_works" >&6; } case "$gl_cv_func_itold_works" in *no) REPLACE_ITOLD=1 FLOAT_H=float.h ;; esac if test -n "$FLOAT_H"; then if test $gl_cv_have_include_next = yes; then gl_cv_next_float_h='<'float.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <float.h>" >&5 printf %s "checking absolute name of <float.h>... " >&6; } if test ${gl_cv_next_float_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <float.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'float.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_float_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_float_h gl_cv_next_float_h='"'$gl_header'"' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_float_h" >&5 printf "%s\n" "$gl_cv_next_float_h" >&6; } fi NEXT_FLOAT_H=$gl_cv_next_float_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'float.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_float_h fi NEXT_AS_FIRST_DIRECTIVE_FLOAT_H=$gl_next_as_first_directive fi if test -n "$FLOAT_H"; then GL_GENERATE_FLOAT_H_TRUE= GL_GENERATE_FLOAT_H_FALSE='#' else GL_GENERATE_FLOAT_H_TRUE='#' GL_GENERATE_FLOAT_H_FALSE= fi if test $REPLACE_FLOAT_LDBL = 1; then gltests_LIBOBJS="$gltests_LIBOBJS float.$ac_objext" fi if test $REPLACE_ITOLD = 1; then gltests_LIBOBJS="$gltests_LIBOBJS itold.$ac_objext" fi if test $ac_cv_func_ftruncate = yes; then case "$host_os" in mingw*) REPLACE_FTRUNCATE=1 ;; esac else HAVE_FTRUNCATE=0 fi if test $HAVE_FTRUNCATE = 0 || test $REPLACE_FTRUNCATE = 1; then gltests_LIBOBJS="$gltests_LIBOBJS ftruncate.$ac_objext" ac_fn_c_check_func "$LINENO" "_chsize" "ac_cv_func__chsize" if test "x$ac_cv_func__chsize" = xyes then : printf "%s\n" "#define HAVE__CHSIZE 1" >>confdefs.h fi fi if test "$GL_GNULIB_FTRUNCATE" != 1; then if test "$GL_GNULIB_FTRUNCATE" = 0; then GL_GNULIB_FTRUNCATE=$gl_module_indicator_condition else GL_GNULIB_FTRUNCATE="($GL_GNULIB_FTRUNCATE || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_FTRUNCATE 1" >>confdefs.h gl_gettimeofday_timezone=void if test $ac_cv_func_gettimeofday != yes; then HAVE_GETTIMEOFDAY=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gettimeofday with POSIX signature" >&5 printf %s "checking for gettimeofday with POSIX signature... " >&6; } if test ${gl_cv_func_gettimeofday_posix_signature+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/time.h> struct timeval c; int gettimeofday (struct timeval *restrict, void *restrict); int main (void) { /* glibc uses struct timezone * rather than the POSIX void * if _GNU_SOURCE is defined. However, since the only portable use of gettimeofday uses NULL as the second parameter, and since the glibc definition is actually more typesafe, it is not worth wrapping this to get a compliant signature. */ int (*f) (struct timeval *restrict, void *restrict) = gettimeofday; int x = f (&c, 0); return !(x | c.tv_sec | c.tv_usec); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_gettimeofday_posix_signature=yes else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/time.h> int gettimeofday (struct timeval *restrict, struct timezone *restrict); int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_gettimeofday_posix_signature=almost else $as_nop gl_cv_func_gettimeofday_posix_signature=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_gettimeofday_posix_signature" >&5 printf "%s\n" "$gl_cv_func_gettimeofday_posix_signature" >&6; } if test $gl_cv_func_gettimeofday_posix_signature = almost; then gl_gettimeofday_timezone='struct timezone' elif test $gl_cv_func_gettimeofday_posix_signature != yes; then REPLACE_GETTIMEOFDAY=1 fi if test $REPLACE_STRUCT_TIMEVAL = 1; then REPLACE_GETTIMEOFDAY=1 fi case "$host_os" in mingw*) REPLACE_GETTIMEOFDAY=1 ;; esac fi printf "%s\n" "#define GETTIMEOFDAY_TIMEZONE $gl_gettimeofday_timezone" >>confdefs.h if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then gltests_LIBOBJS="$gltests_LIBOBJS gettimeofday.$ac_objext" : fi if test "$GL_GNULIB_GETTIMEOFDAY" != 1; then if test "$GL_GNULIB_GETTIMEOFDAY" = 0; then GL_GNULIB_GETTIMEOFDAY=$gl_module_indicator_condition else GL_GNULIB_GETTIMEOFDAY="($GL_GNULIB_GETTIMEOFDAY || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_GETTIMEOFDAY 1" >>confdefs.h HAVE_INET_PTON=1 INET_PTON_LIB= if test $ac_cv_header_sys_socket_h != yes; then ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" if test "x$ac_cv_header_winsock2_h" = xyes then : printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h fi fi if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 UNISTD_H_HAVE_WINSOCK2_H=1 SYS_IOCTL_H_HAVE_WINSOCK2_H=1 else HAVE_WINSOCK2_H=0 fi if test $HAVE_WINSOCK2_H = 1; then REPLACE_INET_PTON=1 ac_fn_check_decl "$LINENO" "inet_pton" "ac_cv_have_decl_inet_pton" "#include <ws2tcpip.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_inet_pton" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_INET_PTON $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_inet_pton = yes; then INET_PTON_LIB="-lws2_32" else HAVE_DECL_INET_PTON=0 fi else gl_save_LIBS=$LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5 printf %s "checking for library containing inet_pton... " >&6; } if test ${ac_cv_search_inet_pton+y} then : printf %s "(cached) " >&6 else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char inet_pton (); int main (void) { return inet_pton (); ; return 0; } _ACEOF for ac_lib in '' nsl resolv network do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO" then : ac_cv_search_inet_pton=$ac_res fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext if test ${ac_cv_search_inet_pton+y} then : break fi done if test ${ac_cv_search_inet_pton+y} then : else $as_nop ac_cv_search_inet_pton=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5 printf "%s\n" "$ac_cv_search_inet_pton" >&6; } ac_res=$ac_cv_search_inet_pton if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else $as_nop ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton" if test "x$ac_cv_func_inet_pton" = xyes then : printf "%s\n" "#define HAVE_INET_PTON 1" >>confdefs.h fi if test $ac_cv_func_inet_pton = no; then HAVE_INET_PTON=0 fi fi LIBS=$gl_save_LIBS if test "$ac_cv_search_inet_pton" != "no" \ && test "$ac_cv_search_inet_pton" != "none required"; then INET_PTON_LIB="$ac_cv_search_inet_pton" fi ac_fn_check_decl "$LINENO" "inet_pton" "ac_cv_have_decl_inet_pton" "#include <arpa/inet.h> #if HAVE_NETDB_H # include <netdb.h> #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_inet_pton" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_INET_PTON $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_inet_pton = no; then HAVE_DECL_INET_PTON=0 fi fi if test $HAVE_INET_PTON = 0 || test $REPLACE_INET_PTON = 1; then gltests_LIBOBJS="$gltests_LIBOBJS inet_pton.$ac_objext" fi if test "$GL_GNULIB_INET_PTON" != 1; then if test "$GL_GNULIB_INET_PTON" = 0; then GL_GNULIB_INET_PTON=$gl_module_indicator_condition else GL_GNULIB_INET_PTON="($GL_GNULIB_INET_PTON || $gl_module_indicator_condition)" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 printf %s "checking whether byte ordering is bigendian... " >&6; } if test ${ac_cv_c_bigendian+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO" then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/param.h> int main (void) { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/param.h> int main (void) { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> int main (void) { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> int main (void) { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ unsigned short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; unsigned short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } unsigned short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; unsigned short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main (void) { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_bigendian=no else $as_nop ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 printf "%s\n" "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac : : : : : HAVE_IOCTL=1 if test "$ac_cv_header_winsock2_h" = yes; then HAVE_IOCTL=0 else ac_fn_c_check_func "$LINENO" "ioctl" "ac_cv_func_ioctl" if test "x$ac_cv_func_ioctl" = xyes then : printf "%s\n" "#define HAVE_IOCTL 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ioctl with POSIX signature" >&5 printf %s "checking for ioctl with POSIX signature... " >&6; } if test ${gl_cv_func_ioctl_posix_signature+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/ioctl.h> /* On some platforms, ioctl() is declared in <unistd.h>. */ #include <unistd.h> int main (void) { extern #ifdef __cplusplus "C" #endif int ioctl (int, int, ...); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_func_ioctl_posix_signature=yes else $as_nop gl_cv_func_ioctl_posix_signature=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ioctl_posix_signature" >&5 printf "%s\n" "$gl_cv_func_ioctl_posix_signature" >&6; } if test $gl_cv_func_ioctl_posix_signature != yes; then REPLACE_IOCTL=1 fi fi if test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1; then gltests_LIBOBJS="$gltests_LIBOBJS ioctl.$ac_objext" fi if test "$GL_GNULIB_IOCTL" != 1; then if test "$GL_GNULIB_IOCTL" = 0; then GL_GNULIB_IOCTL=$gl_module_indicator_condition else GL_GNULIB_IOCTL="($GL_GNULIB_IOCTL || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_IOCTL 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 printf %s "checking for a traditional french locale... " >&6; } if test ${gt_cv_locale_fr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 else # None found. gt_cv_locale_fr=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO-8859-1 else # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO8859-1 else # Test for the HP-UX locale name. if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else # Test for the Solaris 7 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else # None found. gt_cv_locale_fr=none fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr" >&5 printf "%s\n" "$gt_cv_locale_fr" >&6; } LOCALE_FR=$gt_cv_locale_fr { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 printf %s "checking for a french Unicode locale... " >&6; } if test ${gt_cv_locale_fr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional japanese locale" >&5 printf %s "checking for a traditional japanese locale... " >&6; } if test ${gt_cv_locale_ja+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales on Cygwin 1.5.x. */ if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Note that on native Windows, the Japanese locale is # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we # cannot use it here. gt_cv_locale_ja=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the AIX locale name. if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP else # Test for the locale name with explicit encoding suffix. if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC-JP else # Test for the HP-UX, OSF/1, NetBSD locale name. if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.eucJP else # Test for the IRIX, FreeBSD locale name. if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC else # Test for the Solaris 7 locale name. if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja else # Special test for NetBSD 1.6. if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then gt_cv_locale_ja=ja_JP.eucJP else # None found. gt_cv_locale_ja=none fi fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_ja" >&5 printf "%s\n" "$gt_cv_locale_ja" >&6; } LOCALE_JA=$gt_cv_locale_ja { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 printf %s "checking for a transitional chinese locale... " >&6; } if test ${gt_cv_locale_zh_CN+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } /* Check whether a typical GB18030 multibyte sequence is recognized as a single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=Chinese_China.54936 else # None found. gt_cv_locale_zh_CN=none fi ;; solaris2.8) # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. gt_cv_locale_zh_CN=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the locale name without encoding suffix. if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN else # Test for the locale name with explicit encoding suffix. if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN.GB18030 else # None found. gt_cv_locale_zh_CN=none fi fi ;; esac else # If there was a link error, due to mblen(), the system is so old that # it certainly doesn't have a chinese locale. gt_cv_locale_zh_CN=none fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 printf "%s\n" "$gt_cv_locale_zh_CN" >&6; } LOCALE_ZH_CN=$gt_cv_locale_zh_CN { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 printf %s "checking for a traditional french locale... " >&6; } if test ${gt_cv_locale_fr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 else # None found. gt_cv_locale_fr=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO-8859-1 else # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO8859-1 else # Test for the HP-UX locale name. if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else # Test for the Solaris 7 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else # None found. gt_cv_locale_fr=none fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr" >&5 printf "%s\n" "$gt_cv_locale_fr" >&6; } LOCALE_FR=$gt_cv_locale_fr { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 printf %s "checking for a french Unicode locale... " >&6; } if test ${gt_cv_locale_fr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional japanese locale" >&5 printf %s "checking for a traditional japanese locale... " >&6; } if test ${gt_cv_locale_ja+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales on Cygwin 1.5.x. */ if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Note that on native Windows, the Japanese locale is # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we # cannot use it here. gt_cv_locale_ja=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the AIX locale name. if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP else # Test for the locale name with explicit encoding suffix. if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC-JP else # Test for the HP-UX, OSF/1, NetBSD locale name. if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.eucJP else # Test for the IRIX, FreeBSD locale name. if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC else # Test for the Solaris 7 locale name. if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja else # Special test for NetBSD 1.6. if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then gt_cv_locale_ja=ja_JP.eucJP else # None found. gt_cv_locale_ja=none fi fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_ja" >&5 printf "%s\n" "$gt_cv_locale_ja" >&6; } LOCALE_JA=$gt_cv_locale_ja { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 printf %s "checking for a transitional chinese locale... " >&6; } if test ${gt_cv_locale_zh_CN+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } /* Check whether a typical GB18030 multibyte sequence is recognized as a single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=Chinese_China.54936 else # None found. gt_cv_locale_zh_CN=none fi ;; solaris2.8) # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. gt_cv_locale_zh_CN=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the locale name without encoding suffix. if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN else # Test for the locale name with explicit encoding suffix. if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN.GB18030 else # None found. gt_cv_locale_zh_CN=none fi fi ;; esac else # If there was a link error, due to mblen(), the system is so old that # it certainly doesn't have a chinese locale. gt_cv_locale_zh_CN=none fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 printf "%s\n" "$gt_cv_locale_zh_CN" >&6; } LOCALE_ZH_CN=$gt_cv_locale_zh_CN if test "$ac_cv_header_winsock2_h" = yes; then gltests_LIBOBJS="$gltests_LIBOBJS listen.$ac_objext" fi if test "$GL_GNULIB_LISTEN" != 1; then if test "$GL_GNULIB_LISTEN" = 0; then GL_GNULIB_LISTEN=$gl_module_indicator_condition else GL_GNULIB_LISTEN="($GL_GNULIB_LISTEN || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_LISTEN 1" >>confdefs.h if test $HAVE_LOCALE_T = 1; then gl_func_newlocale="$ac_cv_func_newlocale" gl_func_duplocale="$ac_cv_func_duplocale" gl_func_freelocale="$ac_cv_func_freelocale" else gl_func_newlocale=no gl_func_duplocale=no gl_func_freelocale=no fi if test $gl_func_newlocale != yes; then HAVE_NEWLOCALE=0 fi if test $gl_func_duplocale != yes; then HAVE_DUPLOCALE=0 fi if test $gl_func_freelocale != yes; then HAVE_FREELOCALE=0 fi if test $gt_localename_enhances_locale_funcs = yes; then REPLACE_NEWLOCALE=1 REPLACE_DUPLOCALE=1 REPLACE_FREELOCALE=1 fi if test "$GL_GNULIB_LOCALENAME" != 1; then if test "$GL_GNULIB_LOCALENAME" = 0; then GL_GNULIB_LOCALENAME=$gl_module_indicator_condition else GL_GNULIB_LOCALENAME="($GL_GNULIB_LOCALENAME || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_LOCALENAME 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a turkish Unicode locale" >&5 printf %s "checking for a turkish Unicode locale... " >&6; } if test ${gt_cv_locale_tr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> #include <wctype.h> struct tm t; char buf[16]; int main () { /* On BeOS, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. But BeOS does not implement the Turkish upper-/lowercase mappings. Therefore, let this program return 1 on BeOS. */ /* Check whether the given locale name is recognized by the system. */ #if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; #else if (setlocale (LC_ALL, "") == NULL) return 1; #endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the tr_TR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ #if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } #endif #ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; #endif /* Check whether in the abbreviation of the eighth month, the second character (should be U+011F: LATIN SMALL LETTER G WITH BREVE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1992 - 1900; t.tm_mon = 8 - 1; t.tm_mday = 19; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc4 || buf[2] != (char) 0x9f) return 1; /* Check whether the upper-/lowercase mappings are as expected for Turkish. */ if (towupper ('i') != 0x0130 || towlower (0x0130) != 'i' || towupper(0x0131) != 'I' || towlower ('I') != 0x0131) return 1; return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Turkish_Turkey.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=Turkish_Turkey.65001 else # None found. gt_cv_locale_tr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=tr_TR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=tr_TR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=tr_TR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=tr_TR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=tr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=tr.UTF-8 else # None found. gt_cv_locale_tr_utf8=none fi fi fi ;; esac else gt_cv_locale_tr_utf8=none fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_tr_utf8" >&5 printf "%s\n" "$gt_cv_locale_tr_utf8" >&6; } LOCALE_TR_UTF8=$gt_cv_locale_tr_utf8 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 printf %s "checking for a french Unicode locale... " >&6; } if test ${gt_cv_locale_fr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 printf %s "checking for a traditional french locale... " >&6; } if test ${gt_cv_locale_fr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 else # None found. gt_cv_locale_fr=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO-8859-1 else # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO8859-1 else # Test for the HP-UX locale name. if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else # Test for the Solaris 7 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else # None found. gt_cv_locale_fr=none fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr" >&5 printf "%s\n" "$gt_cv_locale_fr" >&6; } LOCALE_FR=$gt_cv_locale_fr { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 printf %s "checking for a french Unicode locale... " >&6; } if test ${gt_cv_locale_fr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional japanese locale" >&5 printf %s "checking for a traditional japanese locale... " >&6; } if test ${gt_cv_locale_ja+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales on Cygwin 1.5.x. */ if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Note that on native Windows, the Japanese locale is # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we # cannot use it here. gt_cv_locale_ja=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the AIX locale name. if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP else # Test for the locale name with explicit encoding suffix. if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC-JP else # Test for the HP-UX, OSF/1, NetBSD locale name. if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.eucJP else # Test for the IRIX, FreeBSD locale name. if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC else # Test for the Solaris 7 locale name. if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja else # Special test for NetBSD 1.6. if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then gt_cv_locale_ja=ja_JP.eucJP else # None found. gt_cv_locale_ja=none fi fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_ja" >&5 printf "%s\n" "$gt_cv_locale_ja" >&6; } LOCALE_JA=$gt_cv_locale_ja { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 printf %s "checking for a transitional chinese locale... " >&6; } if test ${gt_cv_locale_zh_CN+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } /* Check whether a typical GB18030 multibyte sequence is recognized as a single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=Chinese_China.54936 else # None found. gt_cv_locale_zh_CN=none fi ;; solaris2.8) # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. gt_cv_locale_zh_CN=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the locale name without encoding suffix. if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN else # Test for the locale name with explicit encoding suffix. if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN.GB18030 else # None found. gt_cv_locale_zh_CN=none fi fi ;; esac else # If there was a link error, due to mblen(), the system is so old that # it certainly doesn't have a chinese locale. gt_cv_locale_zh_CN=none fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 printf "%s\n" "$gt_cv_locale_zh_CN" >&6; } LOCALE_ZH_CN=$gt_cv_locale_zh_CN { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 printf %s "checking for a french Unicode locale... " >&6; } if test ${gt_cv_locale_fr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 printf %s "checking for a transitional chinese locale... " >&6; } if test ${gt_cv_locale_zh_CN+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } /* Check whether a typical GB18030 multibyte sequence is recognized as a single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=Chinese_China.54936 else # None found. gt_cv_locale_zh_CN=none fi ;; solaris2.8) # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. gt_cv_locale_zh_CN=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the locale name without encoding suffix. if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN else # Test for the locale name with explicit encoding suffix. if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN.GB18030 else # None found. gt_cv_locale_zh_CN=none fi fi ;; esac else # If there was a link error, due to mblen(), the system is so old that # it certainly doesn't have a chinese locale. gt_cv_locale_zh_CN=none fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 printf "%s\n" "$gt_cv_locale_zh_CN" >&6; } LOCALE_ZH_CN=$gt_cv_locale_zh_CN nanosleep_save_libs=$LIBS # Solaris 2.5.1 needs -lposix4 to get the nanosleep function. # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. LIB_NANOSLEEP= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5 printf %s "checking for library containing nanosleep... " >&6; } if test ${ac_cv_search_nanosleep+y} then : printf %s "(cached) " >&6 else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char nanosleep (); int main (void) { return nanosleep (); ; return 0; } _ACEOF for ac_lib in '' rt posix4 do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO" then : ac_cv_search_nanosleep=$ac_res fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext if test ${ac_cv_search_nanosleep+y} then : break fi done if test ${ac_cv_search_nanosleep+y} then : else $as_nop ac_cv_search_nanosleep=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5 printf "%s\n" "$ac_cv_search_nanosleep" >&6; } ac_res=$ac_cv_search_nanosleep if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" test "$ac_cv_search_nanosleep" = "none required" || LIB_NANOSLEEP=$ac_cv_search_nanosleep fi if test "x$ac_cv_search_nanosleep" != xno; then if test $APPLE_UNIVERSAL_BUILD = 1; then # A universal build on Apple Mac OS X platforms. # The test result would be 'no (mishandles large arguments)' in 64-bit # mode but 'yes' in 32-bit mode. But we need a configuration result that # is valid in both modes. gl_cv_func_nanosleep='no (mishandles large arguments)' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working nanosleep" >&5 printf %s "checking for working nanosleep... " >&6; } if test ${gl_cv_func_nanosleep+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in linux*) # Guess it halfway works when the kernel is Linux. gl_cv_func_nanosleep='guessing no (mishandles large arguments)' ;; mingw*) # Guess no on native Windows. gl_cv_func_nanosleep='guessing no' ;; *) # If we don't know, obey --enable-cross-guesses. gl_cv_func_nanosleep="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #include <limits.h> #include <signal.h> #if HAVE_SYS_TIME_H #include <sys/time.h> #endif #include <time.h> #include <unistd.h> #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) #define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) -1 \ : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) #if HAVE_DECL_ALARM static void check_for_SIGALRM (int sig) { if (sig != SIGALRM) _exit (1); } #endif int main () { static struct timespec ts_sleep; static struct timespec ts_remaining; /* Test for major problems first. */ if (! nanosleep) return 2; ts_sleep.tv_sec = 0; ts_sleep.tv_nsec = 1; #if HAVE_DECL_ALARM { static struct sigaction act; act.sa_handler = check_for_SIGALRM; sigemptyset (&act.sa_mask); sigaction (SIGALRM, &act, NULL); alarm (1); if (nanosleep (&ts_sleep, NULL) != 0) return 3; /* Test for a minor problem: the handling of large arguments. */ ts_sleep.tv_sec = TYPE_MAXIMUM (time_t); ts_sleep.tv_nsec = 999999999; alarm (1); if (nanosleep (&ts_sleep, &ts_remaining) != -1) return 4; if (errno != EINTR) return 5; if (ts_remaining.tv_sec <= TYPE_MAXIMUM (time_t) - 10) return 6; } #else /* A simpler test for native Windows. */ if (nanosleep (&ts_sleep, &ts_remaining) < 0) return 3; #endif return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_nanosleep=yes else $as_nop case $? in 4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)';; *) gl_cv_func_nanosleep=no;; esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_nanosleep" >&5 printf "%s\n" "$gl_cv_func_nanosleep" >&6; } case "$gl_cv_func_nanosleep" in *yes) REPLACE_NANOSLEEP=0 ;; *) REPLACE_NANOSLEEP=1 case "$gl_cv_func_nanosleep" in *"mishandles large arguments"*) printf "%s\n" "#define HAVE_BUG_BIG_NANOSLEEP 1" >>confdefs.h ;; *) # The replacement uses select(). Add $LIBSOCKET to $LIB_NANOSLEEP. for ac_lib in $LIBSOCKET; do case " $LIB_NANOSLEEP " in *" $ac_lib "*) ;; *) LIB_NANOSLEEP="$LIB_NANOSLEEP $ac_lib";; esac done ;; esac ;; esac else HAVE_NANOSLEEP=0 fi LIBS=$nanosleep_save_libs if test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1; then gltests_LIBOBJS="$gltests_LIBOBJS nanosleep.$ac_objext" : fi if test "$GL_GNULIB_NANOSLEEP" != 1; then if test "$GL_GNULIB_NANOSLEEP" = 0; then GL_GNULIB_NANOSLEEP=$gl_module_indicator_condition else GL_GNULIB_NANOSLEEP="($GL_GNULIB_NANOSLEEP || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_NANOSLEEP 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether <netinet/in.h> is self-contained" >&5 printf %s "checking whether <netinet/in.h> is self-contained... " >&6; } if test ${gl_cv_header_netinet_in_h_selfcontained+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <netinet/in.h> int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_header_netinet_in_h_selfcontained=yes else $as_nop gl_cv_header_netinet_in_h_selfcontained=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_netinet_in_h_selfcontained" >&5 printf "%s\n" "$gl_cv_header_netinet_in_h_selfcontained" >&6; } if test $gl_cv_header_netinet_in_h_selfcontained = yes; then NETINET_IN_H='' else NETINET_IN_H='netinet/in.h' ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" if test "x$ac_cv_header_netinet_in_h" = xyes then : printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h fi if test $gl_cv_have_include_next = yes; then gl_cv_next_netinet_in_h='<'netinet/in.h'>' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of <netinet/in.h>" >&5 printf %s "checking absolute name of <netinet/in.h>... " >&6; } if test ${gl_cv_next_netinet_in_h+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_header_netinet_in_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <netinet/in.h> _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac case "$host_os" in mingw*) gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo 'netinet/in.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' gl_cv_absolute_netinet_in_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` gl_header=$gl_cv_absolute_netinet_in_h gl_cv_next_netinet_in_h='"'$gl_header'"' else gl_cv_next_netinet_in_h='<'netinet/in.h'>' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_netinet_in_h" >&5 printf "%s\n" "$gl_cv_next_netinet_in_h" >&6; } fi NEXT_NETINET_IN_H=$gl_cv_next_netinet_in_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'netinet/in.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_netinet_in_h fi NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H=$gl_next_as_first_directive if test $ac_cv_header_netinet_in_h = yes; then HAVE_NETINET_IN_H=1 else HAVE_NETINET_IN_H=0 fi fi if test -n "$NETINET_IN_H"; then GL_GENERATE_NETINET_IN_H_TRUE= GL_GENERATE_NETINET_IN_H_FALSE='#' else GL_GENERATE_NETINET_IN_H_TRUE='#' GL_GENERATE_NETINET_IN_H_FALSE= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 printf %s "checking for a traditional french locale... " >&6; } if test ${gt_cv_locale_fr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 else # None found. gt_cv_locale_fr=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO-8859-1 else # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO8859-1 else # Test for the HP-UX locale name. if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else # Test for the Solaris 7 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else # None found. gt_cv_locale_fr=none fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr" >&5 printf "%s\n" "$gt_cv_locale_fr" >&6; } LOCALE_FR=$gt_cv_locale_fr { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 printf %s "checking for a french Unicode locale... " >&6; } if test ${gt_cv_locale_fr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 if test "$ERRNO_H:$REPLACE_STRERROR_0" != :0; then REPLACE_PERROR=1 fi case ${gl_cv_func_strerror_r_works-unset} in unset|*yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether perror matches strerror" >&5 printf %s "checking whether perror matches strerror... " >&6; } if test ${gl_cv_func_perror_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on musl systems. *-musl*) gl_cv_func_perror_works="guessing yes" ;; # Guess yes on native Windows. mingw*) gl_cv_func_perror_works="guessing yes" ;; # Otherwise obey --enable-cross-guesses. *) gl_cv_func_perror_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main (void) { char *str = strerror (-1); if (!getenv("CONFTEST_OUTPUT")) return 0; if (!str) str = ""; puts (str); errno = -1; perror (""); return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : if CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2 \ && cmp conftest.txt1 conftest.txt2 >/dev/null; then gl_cv_func_perror_works=yes else gl_cv_func_perror_works=no fi rm -rf conftest.txt1 conftest.txt2 else $as_nop gl_cv_func_perror_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_perror_works" >&5 printf "%s\n" "$gl_cv_func_perror_works" >&6; } case "$gl_cv_func_perror_works" in *yes) ;; *) REPLACE_PERROR=1 ;; esac ;; *) REPLACE_PERROR=1 ;; esac if test $REPLACE_PERROR = 1; then gltests_LIBOBJS="$gltests_LIBOBJS perror.$ac_objext" fi if test "$GL_GNULIB_PERROR" != 1; then if test "$GL_GNULIB_PERROR" = 0; then GL_GNULIB_PERROR=$gl_module_indicator_condition else GL_GNULIB_PERROR="($GL_GNULIB_PERROR || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_PERROR 1" >>confdefs.h if { case "$host_os" in mingw*) true;; *) false;; esac; } \ && test $gl_threads_api = windows; then REPLACE_PTHREAD_CREATE=1 REPLACE_PTHREAD_ATTR_INIT=1 REPLACE_PTHREAD_ATTR_GETDETACHSTATE=1 REPLACE_PTHREAD_ATTR_SETDETACHSTATE=1 REPLACE_PTHREAD_ATTR_DESTROY=1 REPLACE_PTHREAD_SELF=1 REPLACE_PTHREAD_EQUAL=1 REPLACE_PTHREAD_DETACH=1 REPLACE_PTHREAD_JOIN=1 REPLACE_PTHREAD_EXIT=1 else if test $HAVE_PTHREAD_H = 0; then HAVE_PTHREAD_CREATE=0 HAVE_PTHREAD_ATTR_INIT=0 HAVE_PTHREAD_ATTR_GETDETACHSTATE=0 HAVE_PTHREAD_ATTR_SETDETACHSTATE=0 HAVE_PTHREAD_ATTR_DESTROY=0 HAVE_PTHREAD_SELF=0 HAVE_PTHREAD_EQUAL=0 HAVE_PTHREAD_DETACH=0 HAVE_PTHREAD_JOIN=0 HAVE_PTHREAD_EXIT=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthread_create exists as a global function" >&5 printf %s "checking whether pthread_create exists as a global function... " >&6; } if test ${gl_cv_func_pthread_create+y} then : printf %s "(cached) " >&6 else $as_nop saved_LIBS="$LIBS" LIBS="$LIBS $LIBPMULTITHREAD" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern #ifdef __cplusplus "C" #endif int pthread_create (void); int main () { return pthread_create (); } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_func_pthread_create=yes else $as_nop gl_cv_func_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$saved_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_create" >&5 printf "%s\n" "$gl_cv_func_pthread_create" >&6; } if test $gl_cv_func_pthread_create = no; then REPLACE_PTHREAD_CREATE=1 REPLACE_PTHREAD_ATTR_INIT=1 printf "%s\n" "#define PTHREAD_CREATE_IS_INLINE 1" >>confdefs.h fi fi fi if test $HAVE_PTHREAD_CREATE = 0 || test $REPLACE_PTHREAD_CREATE = 1; then gltests_LIBOBJS="$gltests_LIBOBJS pthread-thread.$ac_objext" fi if test "$GL_GNULIB_PTHREAD_THREAD" != 1; then if test "$GL_GNULIB_PTHREAD_THREAD" = 0; then GL_GNULIB_PTHREAD_THREAD=$gl_module_indicator_condition else GL_GNULIB_PTHREAD_THREAD="($GL_GNULIB_PTHREAD_THREAD || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_PTHREAD_THREAD 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthread_sigmask is a macro" >&5 printf %s "checking whether pthread_sigmask is a macro... " >&6; } if test ${gl_cv_func_pthread_sigmask_macro+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> #include <signal.h> #ifdef pthread_sigmask headers_define_pthread_sigmask #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "headers_define_pthread_sigmask" >/dev/null 2>&1 then : gl_cv_func_pthread_sigmask_macro=yes else $as_nop gl_cv_func_pthread_sigmask_macro=no fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_macro" >&5 printf "%s\n" "$gl_cv_func_pthread_sigmask_macro" >&6; } LIB_PTHREAD_SIGMASK= if test $gl_cv_func_pthread_sigmask_macro = yes; then HAVE_PTHREAD_SIGMASK=0 REPLACE_PTHREAD_SIGMASK=1 else if test "$gl_threads_api" = posix; then if test $ac_cv_func_pthread_sigmask = yes; then : else if test -n "$LIBMULTITHREAD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_sigmask in $LIBMULTITHREAD" >&5 printf %s "checking for pthread_sigmask in $LIBMULTITHREAD... " >&6; } if test ${gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_LIBS="$LIBS" LIBS="$LIBS $LIBMULTITHREAD" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> #include <signal.h> int main (void) { return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes else $as_nop gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gl_save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD" >&5 printf "%s\n" "$gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD" >&6; } if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD" else HAVE_PTHREAD_SIGMASK=0 fi else HAVE_PTHREAD_SIGMASK=0 fi fi else if test $ac_cv_func_pthread_sigmask = yes; then REPLACE_PTHREAD_SIGMASK=1 else HAVE_PTHREAD_SIGMASK=0 fi fi fi if test $HAVE_PTHREAD_SIGMASK = 1; then if test -z "$LIB_PTHREAD_SIGMASK"; then case " $LIBS " in *' -pthread '*) ;; *' -lpthread '*) ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthread_sigmask works without -lpthread" >&5 printf %s "checking whether pthread_sigmask works without -lpthread... " >&6; } if test ${gl_cv_func_pthread_sigmask_in_libc_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in freebsd* | midnightbsd* | hpux* | solaris | solaris2.[2-9]*) gl_cv_func_pthread_sigmask_in_libc_works="guessing no";; *) gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> #include <signal.h> #include <stddef.h> int main () { sigset_t set; sigemptyset (&set); return pthread_sigmask (1729, &set, NULL) != 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_pthread_sigmask_in_libc_works=no else $as_nop gl_cv_func_pthread_sigmask_in_libc_works=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_in_libc_works" >&5 printf "%s\n" "$gl_cv_func_pthread_sigmask_in_libc_works" >&6; } case "$gl_cv_func_pthread_sigmask_in_libc_works" in *no) REPLACE_PTHREAD_SIGMASK=1 printf "%s\n" "#define PTHREAD_SIGMASK_INEFFECTIVE 1" >>confdefs.h ;; esac;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthread_sigmask returns error numbers" >&5 printf %s "checking whether pthread_sigmask returns error numbers... " >&6; } if test ${gl_cv_func_pthread_sigmask_return_works+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_LIBS="$LIBS" LIBS="$LIBS $LIB_PTHREAD_SIGMASK" if test "$cross_compiling" = yes then : case "$host_os" in cygwin*) gl_cv_func_pthread_sigmask_return_works="guessing no";; *) gl_cv_func_pthread_sigmask_return_works="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> #include <signal.h> #include <stddef.h> int main () { sigset_t set; sigemptyset (&set); if (pthread_sigmask (1729, &set, NULL) == -1) return 1; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_pthread_sigmask_return_works=yes else $as_nop gl_cv_func_pthread_sigmask_return_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi LIBS="$gl_save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_return_works" >&5 printf "%s\n" "$gl_cv_func_pthread_sigmask_return_works" >&6; } case "$gl_cv_func_pthread_sigmask_return_works" in *no) REPLACE_PTHREAD_SIGMASK=1 printf "%s\n" "#define PTHREAD_SIGMASK_FAILS_WITH_ERRNO 1" >>confdefs.h ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthread_sigmask unblocks signals correctly" >&5 printf %s "checking whether pthread_sigmask unblocks signals correctly... " >&6; } if test ${gl_cv_func_pthread_sigmask_unblock_works+y} then : printf %s "(cached) " >&6 else $as_nop case "$host_os" in irix*) gl_cv_func_pthread_sigmask_unblock_works="guessing no";; *) gl_cv_func_pthread_sigmask_unblock_works="guessing yes";; esac gl_save_LIBS=$LIBS LIBS="$LIBS $LIBMULTITHREAD" if test "$cross_compiling" = yes then : : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> $gl_mda_defines static volatile int sigint_occurred; static void sigint_handler (int sig) { sigint_occurred++; } int main () { sigset_t set; int pid = getpid (); char command[80]; signal (SIGINT, sigint_handler); sigemptyset (&set); sigaddset (&set, SIGINT); if (!(pthread_sigmask (SIG_BLOCK, &set, NULL) == 0)) return 1; sprintf (command, "sh -c 'sleep 1; kill -%d %d' &", SIGINT, pid); if (!(system (command) == 0)) return 2; sleep (2); if (!(sigint_occurred == 0)) return 3; if (!(pthread_sigmask (SIG_UNBLOCK, &set, NULL) == 0)) return 4; if (!(sigint_occurred == 1)) /* This fails on IRIX. */ return 5; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : : else $as_nop gl_cv_func_pthread_sigmask_unblock_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi LIBS=$gl_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_unblock_works" >&5 printf "%s\n" "$gl_cv_func_pthread_sigmask_unblock_works" >&6; } case "$gl_cv_func_pthread_sigmask_unblock_works" in *no) REPLACE_PTHREAD_SIGMASK=1 printf "%s\n" "#define PTHREAD_SIGMASK_UNBLOCK_BUG 1" >>confdefs.h ;; esac fi if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then gltests_LIBOBJS="$gltests_LIBOBJS pthread_sigmask.$ac_objext" if test $HAVE_PTHREAD_SIGMASK = 1; then printf "%s\n" "#define HAVE_PTHREAD_SIGMASK 1" >>confdefs.h fi fi if test "$GL_GNULIB_PTHREAD_SIGMASK" != 1; then if test "$GL_GNULIB_PTHREAD_SIGMASK" = 0; then GL_GNULIB_PTHREAD_SIGMASK=$gl_module_indicator_condition else GL_GNULIB_PTHREAD_SIGMASK="($GL_GNULIB_PTHREAD_SIGMASK || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_PTHREAD_SIGMASK 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for putenv compatible with GNU and SVID" >&5 printf %s "checking for putenv compatible with GNU and SVID... " >&6; } if test ${gl_cv_func_svid_putenv+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_svid_putenv="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_svid_putenv="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_svid_putenv="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_svid_putenv="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default $gl_mda_defines int main (void) { /* Put it in env. */ if (putenv ("CONFTEST_putenv=val")) return 1; /* Try to remove it. */ if (putenv ("CONFTEST_putenv")) return 2; /* Make sure it was deleted. */ if (getenv ("CONFTEST_putenv") != 0) return 3; return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_svid_putenv=yes else $as_nop gl_cv_func_svid_putenv=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_svid_putenv" >&5 printf "%s\n" "$gl_cv_func_svid_putenv" >&6; } case "$gl_cv_func_svid_putenv" in *yes) ;; *) REPLACE_PUTENV=1 ;; esac if test $REPLACE_PUTENV = 1; then gltests_LIBOBJS="$gltests_LIBOBJS putenv.$ac_objext" ac_fn_check_decl "$LINENO" "_putenv" "ac_cv_have_decl__putenv" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl__putenv" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL__PUTENV $ac_have_decl" >>confdefs.h fi if test "$GL_GNULIB_PUTENV" != 1; then if test "$GL_GNULIB_PUTENV" = 0; then GL_GNULIB_PUTENV=$gl_module_indicator_condition else GL_GNULIB_PUTENV="($GL_GNULIB_PUTENV || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_PUTENV 1" >>confdefs.h if test "$ac_cv_header_winsock2_h" = yes; then REPLACE_SELECT=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether select supports a 0 argument" >&5 printf %s "checking whether select supports a 0 argument... " >&6; } if test ${gl_cv_func_select_supports0+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on Interix. interix*) gl_cv_func_select_supports0="guessing no";; # Guess yes otherwise. *) gl_cv_func_select_supports0="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/time.h> #if HAVE_SYS_SELECT_H #include <sys/select.h> #endif int main () { struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 5; return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_select_supports0=yes else $as_nop gl_cv_func_select_supports0=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_select_supports0" >&5 printf "%s\n" "$gl_cv_func_select_supports0" >&6; } case "$gl_cv_func_select_supports0" in *yes) ;; *) REPLACE_SELECT=1 ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether select detects invalid fds" >&5 printf %s "checking whether select detects invalid fds... " >&6; } if test ${gl_cv_func_select_detects_ebadf+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_select_detects_ebadf="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_select_detects_ebadf="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_select_detects_ebadf="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/time.h> #if HAVE_SYS_SELECT_H # include <sys/select.h> #endif #include <unistd.h> #include <errno.h> $gl_mda_defines int main (void) { fd_set set; dup2(0, 16); FD_ZERO(&set); FD_SET(16, &set); close(16); struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 5; return select (17, &set, NULL, NULL, &timeout) != -1 || errno != EBADF; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_select_detects_ebadf=yes else $as_nop gl_cv_func_select_detects_ebadf=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_select_detects_ebadf" >&5 printf "%s\n" "$gl_cv_func_select_detects_ebadf" >&6; } case $gl_cv_func_select_detects_ebadf in *yes) ;; *) REPLACE_SELECT=1 ;; esac fi LIB_SELECT="$LIBSOCKET" if test $REPLACE_SELECT = 1; then case "$host_os" in mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> int main () { MsgWaitForMultipleObjects (0, NULL, 0, 0, 0); return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : else $as_nop LIB_SELECT="$LIB_SELECT -luser32" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi if test $REPLACE_SELECT = 1; then gltests_LIBOBJS="$gltests_LIBOBJS select.$ac_objext" fi if test "$GL_GNULIB_SELECT" != 1; then if test "$GL_GNULIB_SELECT" = 0; then GL_GNULIB_SELECT=$gl_module_indicator_condition else GL_GNULIB_SELECT="($GL_GNULIB_SELECT || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_SELECT 1" >>confdefs.h if test $ac_cv_func_setenv = no; then HAVE_SETENV=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setenv validates arguments" >&5 printf %s "checking whether setenv validates arguments... " >&6; } if test ${gl_cv_func_setenv_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_setenv_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <errno.h> #include <string.h> int main (void) { int result = 0; { if (setenv ("", "", 0) != -1) result |= 1; else if (errno != EINVAL) result |= 2; } { if (setenv ("a", "=", 1) != 0) result |= 4; else if (strcmp (getenv ("a"), "=") != 0) result |= 8; } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_setenv_works=yes else $as_nop gl_cv_func_setenv_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setenv_works" >&5 printf "%s\n" "$gl_cv_func_setenv_works" >&6; } case "$gl_cv_func_setenv_works" in *yes) ;; *) REPLACE_SETENV=1 ;; esac fi if test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1; then gltests_LIBOBJS="$gltests_LIBOBJS setenv.$ac_objext" fi if test "$GL_GNULIB_SETENV" != 1; then if test "$GL_GNULIB_SETENV" = 0; then GL_GNULIB_SETENV=$gl_module_indicator_condition else GL_GNULIB_SETENV="($GL_GNULIB_SETENV || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_SETENV 1" >>confdefs.h NEED_SETLOCALE_IMPROVED=0 case "$host_os" in mingw*) NEED_SETLOCALE_IMPROVED=1 ;; cygwin*) case `uname -r` in 1.5.*) NEED_SETLOCALE_IMPROVED=1 ;; esac ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether setlocale supports the C locale" >&5 printf %s "checking whether setlocale supports the C locale... " >&6; } if test ${gl_cv_func_setlocale_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess no on Android. linux*-android*) gl_cv_func_setlocale_works="guessing no";; # Guess yes otherwise. *) gl_cv_func_setlocale_works="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> int main () { return setlocale (LC_ALL, "C") == NULL; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_setlocale_works=yes else $as_nop gl_cv_func_setlocale_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_works" >&5 printf "%s\n" "$gl_cv_func_setlocale_works" >&6; } case "$gl_cv_func_setlocale_works" in *yes) ;; *) NEED_SETLOCALE_IMPROVED=1 ;; esac ;; esac printf "%s\n" "#define NEED_SETLOCALE_IMPROVED $NEED_SETLOCALE_IMPROVED" >>confdefs.h NEED_SETLOCALE_MTSAFE=0 if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then NEED_SETLOCALE_MTSAFE=1 fi printf "%s\n" "#define NEED_SETLOCALE_MTSAFE $NEED_SETLOCALE_MTSAFE" >>confdefs.h if test $NEED_SETLOCALE_IMPROVED = 1 || test $NEED_SETLOCALE_MTSAFE = 1; then REPLACE_SETLOCALE=1 fi if test $NEED_SETLOCALE_MTSAFE = 1; then LIB_SETLOCALE="$LIB_SETLOCALE_NULL" else LIB_SETLOCALE= fi if test $REPLACE_SETLOCALE = 1; then gltests_LIBOBJS="$gltests_LIBOBJS setlocale.$ac_objext" : fi if test "$GL_GNULIB_SETLOCALE" != 1; then if test "$GL_GNULIB_SETLOCALE" = 0; then GL_GNULIB_SETLOCALE=$gl_module_indicator_condition else GL_GNULIB_SETLOCALE="($GL_GNULIB_SETLOCALE || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_SETLOCALE 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 printf %s "checking for a traditional french locale... " >&6; } if test ${gt_cv_locale_fr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 else # None found. gt_cv_locale_fr=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO-8859-1 else # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO8859-1 else # Test for the HP-UX locale name. if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else # Test for the Solaris 7 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else # None found. gt_cv_locale_fr=none fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr" >&5 printf "%s\n" "$gt_cv_locale_fr" >&6; } LOCALE_FR=$gt_cv_locale_fr { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 printf %s "checking for a french Unicode locale... " >&6; } if test ${gt_cv_locale_fr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional japanese locale" >&5 printf %s "checking for a traditional japanese locale... " >&6; } if test ${gt_cv_locale_ja+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales on Cygwin 1.5.x. */ if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Note that on native Windows, the Japanese locale is # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we # cannot use it here. gt_cv_locale_ja=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the AIX locale name. if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP else # Test for the locale name with explicit encoding suffix. if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC-JP else # Test for the HP-UX, OSF/1, NetBSD locale name. if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.eucJP else # Test for the IRIX, FreeBSD locale name. if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC else # Test for the Solaris 7 locale name. if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja else # Special test for NetBSD 1.6. if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then gt_cv_locale_ja=ja_JP.eucJP else # None found. gt_cv_locale_ja=none fi fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_ja" >&5 printf "%s\n" "$gt_cv_locale_ja" >&6; } LOCALE_JA=$gt_cv_locale_ja { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 printf %s "checking for a transitional chinese locale... " >&6; } if test ${gt_cv_locale_zh_CN+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } /* Check whether a typical GB18030 multibyte sequence is recognized as a single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=Chinese_China.54936 else # None found. gt_cv_locale_zh_CN=none fi ;; solaris2.8) # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. gt_cv_locale_zh_CN=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the locale name without encoding suffix. if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN else # Test for the locale name with explicit encoding suffix. if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN.GB18030 else # None found. gt_cv_locale_zh_CN=none fi fi ;; esac else # If there was a link error, due to mblen(), the system is so old that # it certainly doesn't have a chinese locale. gt_cv_locale_zh_CN=none fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 printf "%s\n" "$gt_cv_locale_zh_CN" >&6; } LOCALE_ZH_CN=$gt_cv_locale_zh_CN if test "$ac_cv_header_winsock2_h" = yes; then gltests_LIBOBJS="$gltests_LIBOBJS setsockopt.$ac_objext" fi if test "$GL_GNULIB_SETSOCKOPT" != 1; then if test "$GL_GNULIB_SETSOCKOPT" = 0; then GL_GNULIB_SETSOCKOPT=$gl_module_indicator_condition else GL_GNULIB_SETSOCKOPT="($GL_GNULIB_SETSOCKOPT || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_SETSOCKOPT 1" >>confdefs.h if test $ac_cv_func_sigaction = yes; then ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include <signal.h> " if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes then : printf "%s\n" "#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1" >>confdefs.h fi if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then HAVE_STRUCT_SIGACTION_SA_SIGACTION=0 fi else HAVE_SIGACTION=0 fi if test $HAVE_SIGACTION = 0; then gltests_LIBOBJS="$gltests_LIBOBJS sigaction.$ac_objext" ac_fn_c_check_type "$LINENO" "siginfo_t" "ac_cv_type_siginfo_t" " #include <signal.h> " if test "x$ac_cv_type_siginfo_t" = xyes then : printf "%s\n" "#define HAVE_SIGINFO_T 1" >>confdefs.h fi if test $ac_cv_type_siginfo_t = no; then HAVE_SIGINFO_T=0 fi fi if test "$GL_GNULIB_SIGACTION" != 1; then if test "$GL_GNULIB_SIGACTION" = 0; then GL_GNULIB_SIGACTION=$gl_module_indicator_condition else GL_GNULIB_SIGACTION="($GL_GNULIB_SIGACTION || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_SIGACTION 1" >>confdefs.h HAVE_POSIX_SIGNALBLOCKING=0 if test "$gl_cv_type_sigset_t" = yes; then ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" if test "x$ac_cv_func_sigprocmask" = xyes then : HAVE_POSIX_SIGNALBLOCKING=1 fi fi if test $HAVE_POSIX_SIGNALBLOCKING = 0; then gltests_LIBOBJS="$gltests_LIBOBJS sigprocmask.$ac_objext" : fi if test "$GL_GNULIB_SIGPROCMASK" != 1; then if test "$GL_GNULIB_SIGPROCMASK" = 0; then GL_GNULIB_SIGPROCMASK=$gl_module_indicator_condition else GL_GNULIB_SIGPROCMASK="($GL_GNULIB_SIGPROCMASK || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_SIGPROCMASK 1" >>confdefs.h ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" if test "x$ac_cv_header_stdint_h" = xyes then : printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SIZE_MAX" >&5 printf %s "checking for SIZE_MAX... " >&6; } if test ${gl_cv_size_max+y} then : printf %s "(cached) " >&6 else $as_nop gl_cv_size_max=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> #if HAVE_STDINT_H #include <stdint.h> #endif #ifdef SIZE_MAX Found it #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Found it" >/dev/null 2>&1 then : gl_cv_size_max=yes fi rm -rf conftest* if test $gl_cv_size_max != yes; then if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) * CHAR_BIT - 1" "size_t_bits_minus_1" "#include <stddef.h> #include <limits.h>" then : else $as_nop size_t_bits_minus_1= fi if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) <= sizeof (unsigned int)" "fits_in_uint" "#include <stddef.h>" then : else $as_nop fits_in_uint= fi if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then if test $fits_in_uint = 1; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> extern size_t foo; extern unsigned long foo; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : fits_in_uint=0 fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $fits_in_uint = 1; then gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" else gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" fi else gl_cv_size_max='((size_t)~(size_t)0)' fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_size_max" >&5 printf "%s\n" "$gl_cv_size_max" >&6; } if test "$gl_cv_size_max" != yes; then printf "%s\n" "#define SIZE_MAX $gl_cv_size_max" >>confdefs.h fi ac_fn_check_decl "$LINENO" "sleep" "ac_cv_have_decl_sleep" "#include <unistd.h> " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_sleep" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_SLEEP $ac_have_decl" >>confdefs.h if test $ac_cv_have_decl_sleep != yes; then HAVE_SLEEP=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working sleep" >&5 printf %s "checking for working sleep... " >&6; } if test ${gl_cv_func_sleep_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_sleep_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_sleep_works="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_sleep_works="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_sleep_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> #include <unistd.h> #include <signal.h> static void handle_alarm (int sig) { if (sig != SIGALRM) _exit (2); } int main (void) { /* Failure to compile this test due to missing alarm is okay, since all such platforms (mingw) also lack sleep. */ unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days. */ unsigned int remaining; signal (SIGALRM, handle_alarm); alarm (1); remaining = sleep (pentecost); if (remaining > pentecost) return 3; if (remaining <= pentecost - 10) return 4; return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_sleep_works=yes else $as_nop gl_cv_func_sleep_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_sleep_works" >&5 printf "%s\n" "$gl_cv_func_sleep_works" >&6; } case "$gl_cv_func_sleep_works" in *yes) ;; *) REPLACE_SLEEP=1 ;; esac fi if test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1; then gltests_LIBOBJS="$gltests_LIBOBJS sleep.$ac_objext" fi if test "$GL_GNULIB_SLEEP" != 1; then if test "$GL_GNULIB_SLEEP" = 0; then GL_GNULIB_SLEEP=$gl_module_indicator_condition else GL_GNULIB_SLEEP="($GL_GNULIB_SLEEP || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_SLEEP 1" >>confdefs.h gl_cv_func_snprintf_usable=no ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" if test "x$ac_cv_func_snprintf" = xyes then : printf "%s\n" "#define HAVE_SNPRINTF 1" >>confdefs.h fi if test $ac_cv_func_snprintf = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether snprintf respects a size of 1" >&5 printf %s "checking whether snprintf respects a size of 1... " >&6; } if test ${gl_cv_func_snprintf_size1+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on Android. linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; # Guess yes on native Windows. mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; *) gl_cv_func_snprintf_size1="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #if HAVE_SNPRINTF # define my_snprintf snprintf #else # include <stdarg.h> static int my_snprintf (char *buf, int size, const char *format, ...) { va_list args; int ret; va_start (args, format); ret = vsnprintf (buf, size, format, args); va_end (args); return ret; } #endif int main() { static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; my_snprintf (buf, 1, "%d", 12345); return buf[1] != 'E'; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_snprintf_size1=yes else $as_nop gl_cv_func_snprintf_size1=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_size1" >&5 printf "%s\n" "$gl_cv_func_snprintf_size1" >&6; } case "$gl_cv_func_snprintf_size1" in *yes) case "$gl_cv_func_snprintf_retval_c99" in *yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether printf supports POSIX/XSI format strings with positions" >&5 printf %s "checking whether printf supports POSIX/XSI format strings with positions... " >&6; } if test ${gl_cv_func_printf_positions+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) gl_cv_func_printf_positions="guessing no";; beos*) gl_cv_func_printf_positions="guessing no";; # Guess yes on Android. linux*-android*) gl_cv_func_printf_positions="guessing yes";; # Guess no on native Windows. mingw* | pw*) gl_cv_func_printf_positions="guessing no";; *) gl_cv_func_printf_positions="guessing yes";; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> #include <string.h> /* The string "%2$d %1$d", with dollar characters protected from the shell's dollar expansion (possibly an autoconf bug). */ static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; static char buf[100]; int main () { sprintf (buf, format, 33, 55); return (strcmp (buf, "55 33") != 0); } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_printf_positions=yes else $as_nop gl_cv_func_printf_positions=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_positions" >&5 printf "%s\n" "$gl_cv_func_printf_positions" >&6; } case "$gl_cv_func_printf_positions" in *yes) gl_cv_func_snprintf_usable=yes ;; esac ;; esac ;; esac fi if test $gl_cv_func_snprintf_usable = no; then gltests_LIBOBJS="$gltests_LIBOBJS snprintf.$ac_objext" if test $ac_cv_func_snprintf = yes; then REPLACE_SNPRINTF=1 else if test $ac_cv_have_decl_snprintf = yes; then REPLACE_SNPRINTF=1 fi fi : fi if test $ac_cv_have_decl_snprintf = no; then HAVE_DECL_SNPRINTF=0 fi if test "$GL_GNULIB_SNPRINTF" != 1; then if test "$GL_GNULIB_SNPRINTF" = 0; then GL_GNULIB_SNPRINTF=$gl_module_indicator_condition else GL_GNULIB_SNPRINTF="($GL_GNULIB_SNPRINTF || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_SNPRINTF 1" >>confdefs.h printf "%s\n" "#define GNULIB_SNPRINTF $gl_module_indicator_condition" >>confdefs.h if test "$ac_cv_header_winsock2_h" = yes; then gltests_LIBOBJS="$gltests_LIBOBJS socket.$ac_objext" fi # When this module is used, sockets may actually occur as file descriptors, # hence it is worth warning if the modules 'close' and 'ioctl' are not used. if test "$ac_cv_header_winsock2_h" = yes; then UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 fi if test "$GL_GNULIB_SOCKET" != 1; then if test "$GL_GNULIB_SOCKET" = 0; then GL_GNULIB_SOCKET=$gl_module_indicator_condition else GL_GNULIB_SOCKET="($GL_GNULIB_SOCKET || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_SOCKET 1" >>confdefs.h ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " /* <sys/types.h> is not needed according to POSIX, but the <sys/socket.h> in i386-unknown-freebsd4.10 and powerpc-apple-darwin5.5 required it. */ #include <sys/types.h> #if HAVE_SYS_SOCKET_H # include <sys/socket.h> #elif HAVE_WS2TCPIP_H # include <ws2tcpip.h> #endif " if test "x$ac_cv_type_socklen_t" = xyes then : else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5 printf %s "checking for socklen_t equivalent... " >&6; } if test ${gl_cv_socklen_t_equiv+y} then : printf %s "(cached) " >&6 else $as_nop # Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername gl_cv_socklen_t_equiv= for arg2 in "struct sockaddr" void; do for t in int size_t "unsigned int" "long int" "unsigned long int"; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/socket.h> int getpeername (int, $arg2 *, $t *); int main (void) { $t len; getpeername (0, 0, &len); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_socklen_t_equiv="$t" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$gl_cv_socklen_t_equiv" != "" && break done test "$gl_cv_socklen_t_equiv" != "" && break done if test "$gl_cv_socklen_t_equiv" = ""; then as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socklen_t_equiv" >&5 printf "%s\n" "$gl_cv_socklen_t_equiv" >&6; } printf "%s\n" "#define socklen_t $gl_cv_socklen_t_equiv" >>confdefs.h fi if test $ac_cv_have_decl_strerror_r = no; then HAVE_DECL_STRERROR_R=0 fi if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then if test $gl_cv_func_strerror_r_posix_signature = yes; then case "$gl_cv_func_strerror_r_works" in *no) REPLACE_STRERROR_R=1 ;; esac else REPLACE_STRERROR_R=1 fi else REPLACE_STRERROR_R=1 fi fi if test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1; then gltests_LIBOBJS="$gltests_LIBOBJS strerror_r.$ac_objext" fi if test "$GL_GNULIB_STRERROR_R" != 1; then if test "$GL_GNULIB_STRERROR_R" = 0; then GL_GNULIB_STRERROR_R=$gl_module_indicator_condition else GL_GNULIB_STRERROR_R="($GL_GNULIB_STRERROR_R || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_STRERROR_R 1" >>confdefs.h printf "%s\n" "#define GNULIB_STRERROR_R_POSIX $gl_module_indicator_condition" >>confdefs.h if test $ac_cv_func_symlink = no; then HAVE_SYMLINK=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether symlink handles trailing slash correctly" >&5 printf %s "checking whether symlink handles trailing slash correctly... " >&6; } if test ${gl_cv_func_symlink_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_symlink_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> int main (void) { int result = 0; if (!symlink ("a", "conftest.link/")) result |= 1; if (symlink ("conftest.f", "conftest.lnk2")) result |= 2; else if (!symlink ("a", "conftest.lnk2/")) result |= 4; return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_symlink_works=yes else $as_nop gl_cv_func_symlink_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.f conftest.link conftest.lnk2 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_symlink_works" >&5 printf "%s\n" "$gl_cv_func_symlink_works" >&6; } case "$gl_cv_func_symlink_works" in *yes) ;; *) REPLACE_SYMLINK=1 ;; esac fi if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then gltests_LIBOBJS="$gltests_LIBOBJS symlink.$ac_objext" fi if test "$GL_GNULIB_SYMLINK" != 1; then if test "$GL_GNULIB_SYMLINK" = 0; then GL_GNULIB_SYMLINK=$gl_module_indicator_condition else GL_GNULIB_SYMLINK="($GL_GNULIB_SYMLINK || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_SYMLINK 1" >>confdefs.h if test $gl_threads_api = posix; then gl_save_LIBS="$LIBS" LIBS="$LIBS $LIBMULTITHREAD" ac_fn_c_check_func "$LINENO" "pthread_atfork" "ac_cv_func_pthread_atfork" if test "x$ac_cv_func_pthread_atfork" = xyes then : printf "%s\n" "#define HAVE_PTHREAD_ATFORK 1" >>confdefs.h fi LIBS="$gl_save_LIBS" fi ac_fn_c_check_header_compile "$LINENO" "sys/single_threaded.h" "ac_cv_header_sys_single_threaded_h" "$ac_includes_default" if test "x$ac_cv_header_sys_single_threaded_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SINGLE_THREADED_H 1" >>confdefs.h fi if test $ac_cv_have_decl_unsetenv = no; then HAVE_DECL_UNSETENV=0 fi ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv" if test "x$ac_cv_func_unsetenv" = xyes then : printf "%s\n" "#define HAVE_UNSETENV 1" >>confdefs.h fi if test $ac_cv_func_unsetenv = no; then HAVE_UNSETENV=0 else HAVE_UNSETENV=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for unsetenv() return type" >&5 printf %s "checking for unsetenv() return type... " >&6; } if test ${gt_cv_func_unsetenv_ret+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #undef _BSD #define _BSD 1 /* unhide unsetenv declaration in OSF/1 5.1 <stdlib.h> */ #include <stdlib.h> extern #ifdef __cplusplus "C" #endif int unsetenv (const char *name); int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gt_cv_func_unsetenv_ret='int' else $as_nop gt_cv_func_unsetenv_ret='void' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_unsetenv_ret" >&5 printf "%s\n" "$gt_cv_func_unsetenv_ret" >&6; } if test $gt_cv_func_unsetenv_ret = 'void'; then printf "%s\n" "#define VOID_UNSETENV 1" >>confdefs.h REPLACE_UNSETENV=1 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether unsetenv obeys POSIX" >&5 printf %s "checking whether unsetenv obeys POSIX... " >&6; } if test ${gl_cv_func_unsetenv_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # Guess yes on glibc systems. *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <errno.h> extern char **environ; $gl_mda_defines int main (void) { char entry1[] = "a=1"; char entry2[] = "b=2"; char *env[] = { entry1, entry2, NULL }; if (putenv ((char *) "a=1")) return 1; if (putenv (entry2)) return 2; entry2[0] = 'a'; unsetenv ("a"); if (getenv ("a")) return 3; if (!unsetenv ("") || errno != EINVAL) return 4; entry2[0] = 'b'; environ = env; if (!getenv ("a")) return 5; entry2[0] = 'a'; unsetenv ("a"); if (getenv ("a")) return 6; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : gl_cv_func_unsetenv_works=yes else $as_nop gl_cv_func_unsetenv_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_unsetenv_works" >&5 printf "%s\n" "$gl_cv_func_unsetenv_works" >&6; } case "$gl_cv_func_unsetenv_works" in *yes) ;; *) REPLACE_UNSETENV=1 ;; esac fi if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then gltests_LIBOBJS="$gltests_LIBOBJS unsetenv.$ac_objext" fi if test "$GL_GNULIB_UNSETENV" != 1; then if test "$GL_GNULIB_UNSETENV" = 0; then GL_GNULIB_UNSETENV=$gl_module_indicator_condition else GL_GNULIB_UNSETENV="($GL_GNULIB_UNSETENV || $gl_module_indicator_condition)" fi fi printf "%s\n" "#define GNULIB_TEST_UNSETENV 1" >>confdefs.h if test $ac_cv_func_vasnprintf = no; then gltests_LIBOBJS="$gltests_LIBOBJS vasnprintf.$ac_objext" gltests_LIBOBJS="$gltests_LIBOBJS printf-args.$ac_objext" gltests_LIBOBJS="$gltests_LIBOBJS printf-parse.$ac_objext" gltests_LIBOBJS="$gltests_LIBOBJS asnprintf.$ac_objext" if test $ac_cv_func_vasnprintf = yes; then printf "%s\n" "#define REPLACE_VASNPRINTF 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" if test "x$ac_cv_type_ptrdiff_t" = xyes then : else $as_nop printf "%s\n" "#define ptrdiff_t long" >>confdefs.h fi fi abs_aux_dir=`cd "$ac_aux_dir"; pwd` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 printf %s "checking for a traditional french locale... " >&6; } if test ${gt_cv_locale_fr+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 else # None found. gt_cv_locale_fr=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO-8859-1 else # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO8859-1 else # Test for the HP-UX locale name. if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else # Test for the Solaris 7 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else # None found. gt_cv_locale_fr=none fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr" >&5 printf "%s\n" "$gt_cv_locale_fr" >&6; } LOCALE_FR=$gt_cv_locale_fr { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 printf %s "checking for a french Unicode locale... " >&6; } if test ${gt_cv_locale_fr_utf8+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 printf "%s\n" "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a traditional japanese locale" >&5 printf %s "checking for a traditional japanese locale... " >&6; } if test ${gt_cv_locale_ja+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales on Cygwin 1.5.x. */ if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Note that on native Windows, the Japanese locale is # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we # cannot use it here. gt_cv_locale_ja=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the AIX locale name. if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP else # Test for the locale name with explicit encoding suffix. if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC-JP else # Test for the HP-UX, OSF/1, NetBSD locale name. if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.eucJP else # Test for the IRIX, FreeBSD locale name. if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC else # Test for the Solaris 7 locale name. if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja else # Special test for NetBSD 1.6. if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then gt_cv_locale_ja=ja_JP.eucJP else # None found. gt_cv_locale_ja=none fi fi fi fi fi fi ;; esac fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_ja" >&5 printf "%s\n" "$gt_cv_locale_ja" >&6; } LOCALE_JA=$gt_cv_locale_ja { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 printf %s "checking for a transitional chinese locale... " >&6; } if test ${gt_cv_locale_zh_CN+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> #include <stdlib.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } /* Check whether a typical GB18030 multibyte sequence is recognized as a single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; return 0; #endif } _ACEOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=Chinese_China.54936 else # None found. gt_cv_locale_zh_CN=none fi ;; solaris2.8) # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. gt_cv_locale_zh_CN=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the locale name without encoding suffix. if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN else # Test for the locale name with explicit encoding suffix. if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN.GB18030 else # None found. gt_cv_locale_zh_CN=none fi fi ;; esac else # If there was a link error, due to mblen(), the system is so old that # it certainly doesn't have a chinese locale. gt_cv_locale_zh_CN=none fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 printf "%s\n" "$gt_cv_locale_zh_CN" >&6; } LOCALE_ZH_CN=$gt_cv_locale_zh_CN case "$host_os" in mingw*) gltests_LIBOBJS="$gltests_LIBOBJS windows-thread.$ac_objext" ;; esac case "$host_os" in mingw*) gltests_LIBOBJS="$gltests_LIBOBJS windows-tls.$ac_objext" ;; esac ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" if test "x$ac_cv_header_stdint_h" = xyes then : printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h fi LIBGREPUTILS_LIBDEPS="$gl_libdeps" LIBGREPUTILS_LTLIBDEPS="$gl_ltlibdeps" LIBTESTS_LIBDEPS="$gltests_libdeps" # Ensure VLAs are not used. # Note -Wvla is implicitly added by gl_MANYWARN_ALL_GCC printf "%s\n" "#define GNULIB_NO_VLA 1" >>confdefs.h # The test suite needs to know if we have a working perl. # FIXME: this is suboptimal. Ideally, we would be able to call gl_PERL # with an ACTION-IF-NOT-FOUND argument ... cu_have_perl=yes case $PERL in *"/missing "*) cu_have_perl=no;; esac if test $cu_have_perl = yes; then HAVE_PERL_TRUE= HAVE_PERL_FALSE='#' else HAVE_PERL_TRUE='#' HAVE_PERL_FALSE= fi # Check whether --enable-gcc-warnings was given. if test ${enable_gcc_warnings+y} then : enableval=$enable_gcc_warnings; case $enableval in yes|no) ;; *) as_fn_error $? "bad value $enableval for gcc-warnings option" "$LINENO" 5 ;; esac gl_gcc_warnings=$enableval else $as_nop gl_gcc_warnings=no if test "$GCC" = yes && test -d "$srcdir"/.git; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if ! (6 < __GNUC__ + (2 <= __GNUC_MINOR__)) #error "--enable-gcc-warnings defaults to 'no' on older GCC" #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_gcc_warnings=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if test "$gl_gcc_warnings" = yes; then ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror -Wunknown-warning-option" >&5 printf %s "checking whether C compiler handles -Werror -Wunknown-warning-option... " >&6; } if test ${gl_cv_warn_c__Werror__Wunknown_warning_option+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_compiler_FLAGS="$CFLAGS" as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Werror -Wunknown-warning-option" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_warn_c__Werror__Wunknown_warning_option=yes else $as_nop gl_cv_warn_c__Werror__Wunknown_warning_option=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$gl_save_compiler_FLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror__Wunknown_warning_option" >&5 printf "%s\n" "$gl_cv_warn_c__Werror__Wunknown_warning_option" >&6; } if test "x$gl_cv_warn_c__Werror__Wunknown_warning_option" = xyes then : gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror' else $as_nop gl_unknown_warnings_are_errors= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror" >&5 printf %s "checking whether C compiler handles -Werror... " >&6; } if test ${gl_cv_warn_c__Werror+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_compiler_FLAGS="$CFLAGS" as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_warn_c__Werror=yes else $as_nop gl_cv_warn_c__Werror=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$gl_save_compiler_FLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror" >&5 printf "%s\n" "$gl_cv_warn_c__Werror" >&6; } if test "x$gl_cv_warn_c__Werror" = xyes then : as_fn_append WERROR_CFLAGS " -Werror" fi nw= # This, $nw, is the list of warnings we disable. nw="$nw -Wdeclaration-after-statement" # too useful to forbid nw="$nw -Waggregate-return" # anachronistic nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h) nw="$nw -Wc++-compat" # We don't care about C++ compilers nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings nw="$nw -Wpadded" # Our structs are not padded nw="$nw -Wstack-protector" # generates false alarms for useful code nw="$nw -Wswitch-default" # Too many warnings for now nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations nw="$nw -Winline" # streq.h's streq4, streq6 and strcaseeq6 nw="$nw -Wstrict-overflow" # regexec.c ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$GCC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -Wno-missing-field-initializers is supported" >&5 printf %s "checking whether -Wno-missing-field-initializers is supported... " >&6; } if test ${gl_cv_cc_nomfi_supported+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wextra -Werror -Wno-missing-field-initializers" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_cc_nomfi_supported=yes else $as_nop gl_cv_cc_nomfi_supported=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_supported" >&5 printf "%s\n" "$gl_cv_cc_nomfi_supported" >&6; } if test "$gl_cv_cc_nomfi_supported" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -Wno-missing-field-initializers is needed" >&5 printf %s "checking whether -Wno-missing-field-initializers is needed... " >&6; } if test ${gl_cv_cc_nomfi_needed+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wextra -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int f (void) { typedef struct { int a; int b; } s_t; s_t s1 = { 0, }; return s1.b; } int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_cc_nomfi_needed=no else $as_nop gl_cv_cc_nomfi_needed=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_needed" >&5 printf "%s\n" "$gl_cv_cc_nomfi_needed" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -Wuninitialized is supported" >&5 printf %s "checking whether -Wuninitialized is supported... " >&6; } if test ${gl_cv_cc_uninitialized_supported+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror -Wuninitialized" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_cc_uninitialized_supported=yes else $as_nop gl_cv_cc_uninitialized_supported=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_uninitialized_supported" >&5 printf "%s\n" "$gl_cv_cc_uninitialized_supported" >&6; } fi # List all gcc warning categories. # To compare this list to your installed GCC's, run this Bash command: # # comm -3 \ # <((sed -n 's/^ *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \ # awk '/^[^#]/ {print ws}' ../build-aux/gcc-warning.spec) | sort) \ # <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort) ws= for gl_manywarn_item in -fanalyzer -fno-common \ -Wall \ -Warith-conversion \ -Wbad-function-cast \ -Wcast-align=strict \ -Wdate-time \ -Wdisabled-optimization \ -Wdouble-promotion \ -Wduplicated-branches \ -Wduplicated-cond \ -Wextra \ -Wformat-signedness \ -Winit-self \ -Winline \ -Winvalid-pch \ -Wlogical-op \ -Wmissing-declarations \ -Wmissing-include-dirs \ -Wmissing-prototypes \ -Wnested-externs \ -Wnull-dereference \ -Wold-style-definition \ -Wopenmp-simd \ -Woverlength-strings \ -Wpacked \ -Wpointer-arith \ -Wshadow \ -Wstack-protector \ -Wstrict-overflow \ -Wstrict-prototypes \ -Wsuggest-attribute=cold \ -Wsuggest-attribute=const \ -Wsuggest-attribute=format \ -Wsuggest-attribute=malloc \ -Wsuggest-attribute=noreturn \ -Wsuggest-attribute=pure \ -Wsuggest-final-methods \ -Wsuggest-final-types \ -Wsync-nand \ -Wsystem-headers \ -Wtrampolines \ -Wuninitialized \ -Wunknown-pragmas \ -Wunsafe-loop-optimizations \ -Wunused-macros \ -Wvariadic-macros \ -Wvector-operation-performance \ -Wvla \ -Wwrite-strings \ \ ; do as_fn_append ws " $gl_manywarn_item" done # gcc --help=warnings outputs an unusual form for these options; list # them here so that the above 'comm' command doesn't report a false match. as_fn_append ws ' -Warray-bounds=2' as_fn_append ws ' -Wattribute-alias=2' as_fn_append ws ' -Wformat-overflow=2' as_fn_append ws ' -Wformat=2' as_fn_append ws ' -Wformat-truncation=2' as_fn_append ws ' -Wimplicit-fallthrough=5' as_fn_append ws ' -Wshift-overflow=2' as_fn_append ws ' -Wunused-const-variable=2' as_fn_append ws ' -Wvla-larger-than=4031' # These are needed for older GCC versions. if test -n "$GCC"; then case `($CC --version) 2>/dev/null` in 'gcc (GCC) '[0-3].* | \ 'gcc (GCC) '4.[0-7].*) as_fn_append ws ' -fdiagnostics-show-option' as_fn_append ws ' -funit-at-a-time' ;; esac fi # Disable specific options as needed. if test "$gl_cv_cc_nomfi_needed" = yes; then as_fn_append ws ' -Wno-missing-field-initializers' fi if test "$gl_cv_cc_uninitialized_supported" = no; then as_fn_append ws ' -Wno-uninitialized' fi # This warning have too many false alarms in GCC 11.2.1. # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101713 as_fn_append ws ' -Wno-analyzer-malloc-leak' ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu gl_warn_set= set x $ws; shift for gl_warn_item do case " $nw " in *" $gl_warn_item "*) ;; *) as_fn_append gl_warn_set " $gl_warn_item" ;; esac done ws=$gl_warn_set for w in $ws; do as_gl_Warn=`printf "%s\n" "gl_cv_warn_c_$w" | $as_tr_sh` gl_positive="$w" case $gl_positive in -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles $w" >&5 printf %s "checking whether C compiler handles $w... " >&6; } if eval test \${$as_gl_Warn+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_compiler_FLAGS="$CFLAGS" as_fn_append CFLAGS " $gl_unknown_warnings_are_errors $gl_positive" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$as_gl_Warn=yes" else $as_nop eval "$as_gl_Warn=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$gl_save_compiler_FLAGS" fi eval ac_res=\$$as_gl_Warn { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_gl_Warn"\" = x"yes" then : as_fn_append WARN_CFLAGS " $w" fi done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-missing-field-initializers" >&5 printf %s "checking whether C compiler handles -Wno-missing-field-initializers... " >&6; } if test ${gl_cv_warn_c__Wno_missing_field_initializers+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_compiler_FLAGS="$CFLAGS" as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wmissing-field-initializers" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_warn_c__Wno_missing_field_initializers=yes else $as_nop gl_cv_warn_c__Wno_missing_field_initializers=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$gl_save_compiler_FLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_missing_field_initializers" >&5 printf "%s\n" "$gl_cv_warn_c__Wno_missing_field_initializers" >&6; } if test "x$gl_cv_warn_c__Wno_missing_field_initializers" = xyes then : as_fn_append WARN_CFLAGS " -Wno-missing-field-initializers" fi # We need this one { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-sign-compare" >&5 printf %s "checking whether C compiler handles -Wno-sign-compare... " >&6; } if test ${gl_cv_warn_c__Wno_sign_compare+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_compiler_FLAGS="$CFLAGS" as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wsign-compare" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_warn_c__Wno_sign_compare=yes else $as_nop gl_cv_warn_c__Wno_sign_compare=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$gl_save_compiler_FLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_sign_compare" >&5 printf "%s\n" "$gl_cv_warn_c__Wno_sign_compare" >&6; } if test "x$gl_cv_warn_c__Wno_sign_compare" = xyes then : as_fn_append WARN_CFLAGS " -Wno-sign-compare" fi # Too many warnings for now { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-unused-parameter" >&5 printf %s "checking whether C compiler handles -Wno-unused-parameter... " >&6; } if test ${gl_cv_warn_c__Wno_unused_parameter+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_compiler_FLAGS="$CFLAGS" as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wunused-parameter" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_warn_c__Wno_unused_parameter=yes else $as_nop gl_cv_warn_c__Wno_unused_parameter=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$gl_save_compiler_FLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_unused_parameter" >&5 printf "%s\n" "$gl_cv_warn_c__Wno_unused_parameter" >&6; } if test "x$gl_cv_warn_c__Wno_unused_parameter" = xyes then : as_fn_append WARN_CFLAGS " -Wno-unused-parameter" fi # Too many warnings for now { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-cast-function-type" >&5 printf %s "checking whether C compiler handles -Wno-cast-function-type... " >&6; } if test ${gl_cv_warn_c__Wno_cast_function_type+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_compiler_FLAGS="$CFLAGS" as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wcast-function-type" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_warn_c__Wno_cast_function_type=yes else $as_nop gl_cv_warn_c__Wno_cast_function_type=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$gl_save_compiler_FLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_cast_function_type" >&5 printf "%s\n" "$gl_cv_warn_c__Wno_cast_function_type" >&6; } if test "x$gl_cv_warn_c__Wno_cast_function_type" = xyes then : as_fn_append WARN_CFLAGS " -Wno-cast-function-type" fi # sig-handler.h's sa_handler_t cast # In spite of excluding -Wlogical-op above, it is enabled, as of # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-logical-op" >&5 printf %s "checking whether C compiler handles -Wno-logical-op... " >&6; } if test ${gl_cv_warn_c__Wno_logical_op+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_compiler_FLAGS="$CFLAGS" as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wlogical-op" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_warn_c__Wno_logical_op=yes else $as_nop gl_cv_warn_c__Wno_logical_op=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$gl_save_compiler_FLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_logical_op" >&5 printf "%s\n" "$gl_cv_warn_c__Wno_logical_op" >&6; } if test "x$gl_cv_warn_c__Wno_logical_op" = xyes then : as_fn_append WARN_CFLAGS " -Wno-logical-op" fi printf "%s\n" "#define lint 1" >>confdefs.h printf "%s\n" "#define GNULIB_PORTCHECK 1" >>confdefs.h # We use a slightly smaller set of warning options for lib/. # Remove the following and save the result in GNULIB_WARN_CFLAGS. nw= nw="$nw -Wunused-macros" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-format-nonliteral" >&5 printf %s "checking whether C compiler handles -Wno-format-nonliteral... " >&6; } if test ${gl_cv_warn_c__Wno_format_nonliteral+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_compiler_FLAGS="$CFLAGS" as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wformat-nonliteral" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_warn_c__Wno_format_nonliteral=yes else $as_nop gl_cv_warn_c__Wno_format_nonliteral=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$gl_save_compiler_FLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_format_nonliteral" >&5 printf "%s\n" "$gl_cv_warn_c__Wno_format_nonliteral" >&6; } if test "x$gl_cv_warn_c__Wno_format_nonliteral" = xyes then : as_fn_append WARN_CFLAGS " -Wno-format-nonliteral" fi gl_warn_set= set x $WARN_CFLAGS; shift for gl_warn_item do case " $nw " in *" $gl_warn_item "*) ;; *) as_fn_append gl_warn_set " $gl_warn_item" ;; esac done GNULIB_WARN_CFLAGS=$gl_warn_set # For gnulib-tests, the set is slightly smaller still. nw= nw="$nw -Wstrict-prototypes" # It's not worth being this picky about test programs. nw="$nw -Wsuggest-attribute=const" nw="$nw -Wsuggest-attribute=pure" nw="$nw -Wsuggest-attribute=format" nw="$nw -Wformat-truncation=2" # False alarm in strerror_r.c nw="$nw -Wold-style-definition" # Disable to avoid warnings in e.g., test-intprops.c and test-limits-h.c # due to overlong expansions like this: # test-intprops.c:147:5: error: string literal of length 9531 exceeds \ # maximum length 4095 that ISO C99 compilers are required to support nw="$nw -Woverlength-strings" gl_warn_set= set x $GNULIB_WARN_CFLAGS; shift for gl_warn_item do case " $nw " in *" $gl_warn_item "*) ;; *) as_fn_append gl_warn_set " $gl_warn_item" ;; esac done GNULIB_TEST_WARN_CFLAGS=$gl_warn_set { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-return-type" >&5 printf %s "checking whether C compiler handles -Wno-return-type... " >&6; } if test ${gl_cv_warn_c__Wno_return_type+y} then : printf %s "(cached) " >&6 else $as_nop gl_save_compiler_FLAGS="$CFLAGS" as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wreturn-type" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gl_cv_warn_c__Wno_return_type=yes else $as_nop gl_cv_warn_c__Wno_return_type=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$gl_save_compiler_FLAGS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_return_type" >&5 printf "%s\n" "$gl_cv_warn_c__Wno_return_type" >&6; } if test "x$gl_cv_warn_c__Wno_return_type" = xyes then : as_fn_append GNULIB_TEST_WARN_CFLAGS " -Wno-return-type" fi fi # By default, argmatch should fail calling usage (EXIT_FAILURE). printf "%s\n" "#define ARGMATCH_DIE usage (EXIT_FAILURE)" >>confdefs.h printf "%s\n" "#define ARGMATCH_DIE_DECL void usage (int _e)" >>confdefs.h ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`printf "%s\n" "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 printf %s "checking for $ac_hdr that defines DIR... " >&6; } if eval test \${$as_ac_Header+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <$ac_hdr> int main (void) { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_ac_Header=yes" else $as_nop eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$as_ac_Header { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes" then : cat >>confdefs.h <<_ACEOF #define `printf "%s\n" "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 printf %s "checking for library containing opendir... " >&6; } if test ${ac_cv_search_opendir+y} then : printf %s "(cached) " >&6 else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char opendir (); int main (void) { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO" then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext if test ${ac_cv_search_opendir+y} then : break fi done if test ${ac_cv_search_opendir+y} then : else $as_nop ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 printf "%s\n" "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 printf %s "checking for library containing opendir... " >&6; } if test ${ac_cv_search_opendir+y} then : printf %s "(cached) " >&6 else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char opendir (); int main (void) { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO" then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext if test ${ac_cv_search_opendir+y} then : break fi done if test ${ac_cv_search_opendir+y} then : else $as_nop ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 printf "%s\n" "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether closedir returns void" >&5 printf %s "checking whether closedir returns void... " >&6; } if test ${ac_cv_func_closedir_void+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$ac_header_dirent> int main (void) { return closedir(0); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_func_closedir_void=no else $as_nop ac_cv_func_closedir_void=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_closedir_void" >&5 printf "%s\n" "$ac_cv_func_closedir_void" >&6; } if test $ac_cv_func_closedir_void = yes; then printf "%s\n" "#define CLOSEDIR_VOID 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 printf %s "checking whether NLS is requested... " >&6; } # Check whether --enable-nls was given. if test ${enable_nls+y} then : enableval=$enable_nls; USE_NLS=$enableval else $as_nop USE_NLS=yes fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 printf "%s\n" "$USE_NLS" >&6; } GETTEXT_MACRO_VERSION=0.18 # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_MSGFMT+y} then : printf %s "(cached) " >&6 else $as_nop case "$MSGFMT" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 printf "%s\n" "$MSGFMT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_GMSGFMT+y} then : printf %s "(cached) " >&6 else $as_nop case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_path_GMSGFMT="$as_dir$ac_word$ac_exec_ext" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 printf "%s\n" "$GMSGFMT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; *) MSGFMT_015=$MSGFMT ;; esac case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; *) GMSGFMT_015=$GMSGFMT ;; esac # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_XGETTEXT+y} then : printf %s "(cached) " >&6 else $as_nop case "$XGETTEXT" in [\\/]* | ?:[\\/]*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 printf "%s\n" "$XGETTEXT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi rm -f messages.po case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; *) XGETTEXT_015=$XGETTEXT ;; esac # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgmerge", so it can be a program name with args. set dummy msgmerge; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_MSGMERGE+y} then : printf %s "(cached) " >&6 else $as_nop case "$MSGMERGE" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" ;; esac fi MSGMERGE="$ac_cv_path_MSGMERGE" if test "$MSGMERGE" != ":"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 printf "%s\n" "$MSGMERGE" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$localedir" || localedir='${datadir}/locale' test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= ac_config_commands="$ac_config_commands po-directories" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 printf %s "checking for CFPreferencesCopyAppValue... " >&6; } if test ${gt_cv_func_CFPreferencesCopyAppValue+y} then : printf %s "(cached) " >&6 else $as_nop gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <CoreFoundation/CFPreferences.h> int main (void) { CFPreferencesCopyAppValue(NULL, NULL) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gt_cv_func_CFPreferencesCopyAppValue=yes else $as_nop gt_cv_func_CFPreferencesCopyAppValue=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 printf "%s\n" "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then printf "%s\n" "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyPreferredLanguages" >&5 printf %s "checking for CFLocaleCopyPreferredLanguages... " >&6; } if test ${gt_cv_func_CFLocaleCopyPreferredLanguages+y} then : printf %s "(cached) " >&6 else $as_nop gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <CoreFoundation/CFLocale.h> int main (void) { CFLocaleCopyPreferredLanguages(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gt_cv_func_CFLocaleCopyPreferredLanguages=yes else $as_nop gt_cv_func_CFLocaleCopyPreferredLanguages=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyPreferredLanguages" >&5 printf "%s\n" "$gt_cv_func_CFLocaleCopyPreferredLanguages" >&6; } if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then printf "%s\n" "#define HAVE_CFLOCALECOPYPREFERREDLANGUAGES 1" >>confdefs.h fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi LIBINTL= LTLIBINTL= POSUB= case " $gt_needs " in *" need-formatstring-macros "*) gt_api_version=3 ;; *" need-ngettext "*) gt_api_version=2 ;; *) gt_api_version=1 ;; esac gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no if test $gt_api_version -ge 3; then gt_revision_test_code=' #ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; ' else gt_revision_test_code= fi if test $gt_api_version -ge 2; then gt_expression_test_code=' + * ngettext ("", "", 0)' else gt_expression_test_code= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 printf %s "checking for GNU gettext in libc... " >&6; } if eval test \${$gt_func_gnugettext_libc+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <libintl.h> $gt_revision_test_code extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings; int main (void) { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$gt_func_gnugettext_libc=yes" else $as_nop eval "$gt_func_gnugettext_libc=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$gt_func_gnugettext_libc { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then am_save_CPPFLAGS="$CPPFLAGS" for element in $INCICONV; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 printf %s "checking for iconv... " >&6; } if test ${am_cv_func_iconv+y} then : printf %s "(cached) " >&6 else $as_nop am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <iconv.h> int main (void) { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <iconv.h> int main (void) { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 printf "%s\n" "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 printf %s "checking for working iconv... " >&6; } if test ${am_cv_func_iconv_works+y} then : printf %s "(cached) " >&6 else $as_nop am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi am_cv_func_iconv_works=no for ac_iconv_const in '' 'const'; do if test "$cross_compiling" = yes then : case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <iconv.h> #include <string.h> #ifndef ICONV_CONST # define ICONV_CONST $ac_iconv_const #endif int main (void) { int result = 0; /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from successful returns. This is even documented in <https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv.html> */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\263"; char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 2; iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ { iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 4; iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 8; iconv_close (cd_88591_to_utf8); } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ { /* Try standardized names. */ iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); /* Try IRIX, OSF/1 names. */ iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); /* Try AIX names. */ iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); /* Try HP-UX names. */ iconv_t cd4 = iconv_open ("utf8", "eucJP"); if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) result |= 16; if (cd1 != (iconv_t)(-1)) iconv_close (cd1); if (cd2 != (iconv_t)(-1)) iconv_close (cd2); if (cd3 != (iconv_t)(-1)) iconv_close (cd3); if (cd4 != (iconv_t)(-1)) iconv_close (cd4); } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : am_cv_func_iconv_works=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi test "$am_cv_func_iconv_works" = no || break done LIBS="$am_save_LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 printf "%s\n" "$am_cv_func_iconv_works" >&6; } case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 printf %s "checking how to link with libiconv... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 printf "%s\n" "$LIBICONV" >&6; } else CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libintl-prefix was given. if test ${with_libintl_prefix+y} then : withval=$with_libintl_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" additional_libdir2="$withval/$acl_libdirstem2" additional_libdir3="$withval/$acl_libdirstem3" fi fi fi if test "X$additional_libdir2" = "X$additional_libdir"; then additional_libdir2= fi if test "X$additional_libdir3" = "X$additional_libdir"; then additional_libdir3= fi LIBINTL= LTLIBINTL= INCINTL= LIBINTL_PREFIX= HAVE_LIBINTL= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='intl ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" else : fi else found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do if test "X$found_dir" = "X"; then eval dir=\$$additional_libdir_variable if test -n "$dir"; then if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi fi done fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" else LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = 'intl'; then LIBINTL_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = 'intl'; then LIBINTL_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem3 | */$acl_libdirstem3/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` if test "$name" = 'intl'; then LIBINTL_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$dependency_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$dependency_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dep=`echo "X$dep" | sed -e 's/^X-l//'` if test "X$dep" != Xc \ || case $host_os in linux* | gnu* | k*bsd*-gnu) false ;; *) true ;; esac; then names_next_round="$names_next_round $dep" fi ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" ;; esac done fi else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 printf %s "checking for GNU gettext in libintl... " >&6; } if eval test \${$gt_func_gnugettext_libintl+y} then : printf %s "(cached) " >&6 else $as_nop gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <libintl.h> $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); int main (void) { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$gt_func_gnugettext_libintl=yes" else $as_nop eval "$gt_func_gnugettext_libintl=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <libintl.h> $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); int main (void) { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" eval "$gt_func_gnugettext_libintl=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS" fi eval ac_res=\$$gt_func_gnugettext_libintl { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } fi if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else LIBINTL= LTLIBINTL= INCINTL= fi if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then printf "%s\n" "#define ENABLE_NLS 1" >>confdefs.h else USE_NLS=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 printf %s "checking whether to use NLS... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 printf "%s\n" "$USE_NLS" >&6; } if test "$USE_NLS" = "yes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 printf %s "checking where the gettext function comes from... " >&6; } if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 printf "%s\n" "$gt_source" >&6; } fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 printf %s "checking how to link with libintl... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 printf "%s\n" "$LIBINTL" >&6; } for element in $INCINTL; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done fi printf "%s\n" "#define HAVE_GETTEXT 1" >>confdefs.h printf "%s\n" "#define HAVE_DCGETTEXT 1" >>confdefs.h fi POSUB=po fi INTLLIBS="$LIBINTL" if test "$ac_use_included_regex" = yes; then USE_INCLUDED_REGEX_TRUE= USE_INCLUDED_REGEX_FALSE='#' else USE_INCLUDED_REGEX_TRUE='#' USE_INCLUDED_REGEX_FALSE= fi if test "$ac_use_included_regex" = no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Included lib/regex.c not used" >&5 printf "%s\n" "$as_me: WARNING: Included lib/regex.c not used" >&2;} fi # Check whether --enable-perl-regexp was given. if test ${enable_perl_regexp+y} then : enableval=$enable_perl_regexp; case $enableval in yes|no) test_pcre=$enableval;; *) as_fn_error $? "invalid value $enableval for --disable-perl-regexp" "$LINENO" 5;; esac else $as_nop test_pcre=maybe fi use_pcre=no if test $test_pcre != no; then pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PCRE" >&5 printf %s "checking for PCRE... " >&6; } if test -n "$PCRE_CFLAGS"; then pkg_cv_PCRE_CFLAGS="$PCRE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpcre") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PCRE_CFLAGS=`$PKG_CONFIG --cflags "libpcre" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$PCRE_LIBS"; then pkg_cv_PCRE_LIBS="$PCRE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpcre") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PCRE_LIBS=`$PKG_CONFIG --libs "libpcre" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then PCRE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre" 2>&1` else PCRE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PCRE_PKG_ERRORS" >&5 : ${PCRE_LIBS=-lpcre} elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } : ${PCRE_LIBS=-lpcre} else PCRE_CFLAGS=$pkg_cv_PCRE_CFLAGS PCRE_LIBS=$pkg_cv_PCRE_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcre_compile" >&5 printf %s "checking for pcre_compile... " >&6; } if test ${pcre_cv_have_pcre_compile+y} then : printf %s "(cached) " >&6 else $as_nop pcre_saved_CFLAGS=$CFLAGS pcre_saved_LIBS=$LIBS CFLAGS="$CFLAGS $PCRE_CFLAGS" LIBS="$PCRE_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pcre.h> int main (void) { pcre *p = pcre_compile (0, 0, 0, 0, 0); return !p; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : pcre_cv_have_pcre_compile=yes else $as_nop pcre_cv_have_pcre_compile=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$pcre_saved_CFLAGS LIBS=$pcre_saved_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pcre_cv_have_pcre_compile" >&5 printf "%s\n" "$pcre_cv_have_pcre_compile" >&6; } if test "$pcre_cv_have_pcre_compile" = yes; then use_pcre=yes elif test $test_pcre = maybe; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: GNU grep will be built without pcre support." >&5 printf "%s\n" "$as_me: WARNING: GNU grep will be built without pcre support." >&2;} else as_fn_error $? "pcre support not available" "$LINENO" 5 fi fi if test $use_pcre = yes; then printf "%s\n" "#define HAVE_LIBPCRE 1" >>confdefs.h else PCRE_CFLAGS= PCRE_LIBS= fi if test $use_pcre = yes; then USE_PCRE_TRUE= USE_PCRE_FALSE='#' else USE_PCRE_TRUE='#' USE_PCRE_FALSE= fi case $host_os in mingw*) suffix=w32 ;; *) suffix=posix ;; esac COLORIZE_SOURCE=colorize-$suffix.c ac_config_files="$ac_config_files Makefile lib/Makefile src/Makefile tests/Makefile po/Makefile.in doc/Makefile gnulib-tests/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_COND_LIBTOOL_TRUE}" && test -z "${GL_COND_LIBTOOL_FALSE}"; then as_fn_error $? "conditional \"GL_COND_LIBTOOL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_ALLOCA_H_TRUE}" && test -z "${GL_GENERATE_ALLOCA_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_ALLOCA_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_ERRNO_H_TRUE}" && test -z "${GL_GENERATE_ERRNO_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_ERRNO_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_FNMATCH_H_TRUE}" && test -z "${GL_GENERATE_FNMATCH_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_FNMATCH_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_FNMATCH_H_TRUE}" && test -z "${GL_GENERATE_FNMATCH_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_FNMATCH_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_ICONV_H_TRUE}" && test -z "${GL_GENERATE_ICONV_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_ICONV_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_ICONV_H_TRUE}" && test -z "${GL_GENERATE_ICONV_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_ICONV_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_ICONV_H_TRUE}" && test -z "${GL_GENERATE_ICONV_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_ICONV_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_LIMITS_H_TRUE}" && test -z "${GL_GENERATE_LIMITS_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_LIMITS_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_LIMITS_H_TRUE}" && test -z "${GL_GENERATE_LIMITS_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_LIMITS_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_STDINT_H_TRUE}" && test -z "${GL_GENERATE_STDINT_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_STDINT_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_STDDEF_H_TRUE}" && test -z "${GL_GENERATE_STDDEF_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_STDDEF_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi CONFIG_INCLUDE=config.h if test -z "${GL_GENERATE_SIGSEGV_H_TRUE}" && test -z "${GL_GENERATE_SIGSEGV_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_SIGSEGV_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_STDALIGN_H_TRUE}" && test -z "${GL_GENERATE_STDALIGN_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_STDALIGN_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_STDARG_H_TRUE}" && test -z "${GL_GENERATE_STDARG_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_STDARG_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_STDBOOL_H_TRUE}" && test -z "${GL_GENERATE_STDBOOL_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_STDBOOL_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE}" && test -z "${LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_FALSE}"; then as_fn_error $? "conditional \"LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE}" && test -z "${LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_FALSE}"; then as_fn_error $? "conditional \"LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE}" && test -z "${LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE}"; then as_fn_error $? "conditional \"LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi gl_libobjs= gl_ltlibobjs= if test -n "$gl_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gl_libobjs="$gl_libobjs $i.$ac_objext" gl_ltlibobjs="$gl_ltlibobjs $i.lo" done fi gl_LIBOBJS=$gl_libobjs gl_LTLIBOBJS=$gl_ltlibobjs if test -z "${GL_GENERATE_FLOAT_H_TRUE}" && test -z "${GL_GENERATE_FLOAT_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_FLOAT_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_GENERATE_NETINET_IN_H_TRUE}" && test -z "${GL_GENERATE_NETINET_IN_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_NETINET_IN_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi gltests_libobjs= gltests_ltlibobjs= if test -n "$gltests_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gltests_libobjs="$gltests_libobjs $i.$ac_objext" gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" done fi gltests_LIBOBJS=$gltests_libobjs gltests_LTLIBOBJS=$gltests_ltlibobjs if test -z "${HAVE_PERL_TRUE}" && test -z "${HAVE_PERL_FALSE}"; then as_fn_error $? "conditional \"HAVE_PERL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_INCLUDED_REGEX_TRUE}" && test -z "${USE_INCLUDED_REGEX_FALSE}"; then as_fn_error $? "conditional \"USE_INCLUDED_REGEX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_PCRE_TRUE}" && test -z "${USE_PCRE_FALSE}"; then as_fn_error $? "conditional \"USE_PCRE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by GNU grep $as_me 3.7, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_links="$ac_config_links" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration links: $config_links Configuration commands: $config_commands Report bugs to <bug-grep@gnu.org>. GNU grep home page: <https://www.gnu.org/software/grep/>. General help using GNU software: <https://www.gnu.org/gethelp/>." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ GNU grep config.status 3.7 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" GNUmakefile=$GNUmakefile # Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake < 1.5. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.hin" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "$GNUmakefile") CONFIG_LINKS="$CONFIG_LINKS $GNUmakefile:$GNUmakefile" ;; "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "gnulib-tests/Makefile") CONFIG_FILES="$CONFIG_FILES gnulib-tests/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers test ${CONFIG_LINKS+y} || CONFIG_LINKS=$config_links test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' <conf$$subs.awk | sed ' /^[^""]/{ N s/\n// } ' >>$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' <confdefs.h | sed ' s/'"$ac_delim"'/"\\\ "/g' >>$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :L) # # CONFIG_LINK # if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then : else # Prefer the file from the source tree if names are identical. if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then ac_source=$srcdir/$ac_source fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 printf "%s\n" "$as_me: linking $ac_source to $ac_file" >&6;} if test ! -r "$ac_source"; then as_fn_error $? "$ac_source: file not found" "$LINENO" 5 fi rm -f "$ac_file" # Try a relative symlink, then a hard link, then a copy. case $ac_source in [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; *) ac_rel_source=$ac_top_build_prefix$ac_source ;; esac ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || ln "$ac_source" "$ac_file" 2>/dev/null || cp -p "$ac_source" "$ac_file" || as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 fi ;; :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "po-directories":C) for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" gt_tab=`printf '\t'` cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377440�017066� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/xsize.h�����������������������������������������������������������0000664�0001750�0001750�00000006757�14670377440�020420� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* xsize.h -- Checked size_t computations. Copyright (C) 2003, 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _XSIZE_H #define _XSIZE_H /* Get size_t. */ #include <stddef.h> /* Get SIZE_MAX. */ #include <limits.h> #if HAVE_STDINT_H # include <stdint.h> #endif /* Get ATTRIBUTE_PURE. */ #include "attribute.h" #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef XSIZE_INLINE # define XSIZE_INLINE _GL_INLINE #endif /* The size of memory objects is often computed through expressions of type size_t. Example: void* p = malloc (header_size + n * element_size). These computations can lead to overflow. When this happens, malloc() returns a piece of memory that is way too small, and the program then crashes while attempting to fill the memory. To avoid this, the functions and macros in this file check for overflow. The convention is that SIZE_MAX represents overflow. malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc implementation that uses mmap --, it's recommended to use size_overflow_p() or size_in_bounds_p() before invoking malloc(). The example thus becomes: size_t size = xsum (header_size, xtimes (n, element_size)); void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); */ /* Convert an arbitrary value >= 0 to type size_t. */ #define xcast_size_t(N) \ ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) /* Sum of two sizes, with overflow check. */ XSIZE_INLINE size_t ATTRIBUTE_PURE xsum (size_t size1, size_t size2) { size_t sum = size1 + size2; return (sum >= size1 ? sum : SIZE_MAX); } /* Sum of three sizes, with overflow check. */ XSIZE_INLINE size_t ATTRIBUTE_PURE xsum3 (size_t size1, size_t size2, size_t size3) { return xsum (xsum (size1, size2), size3); } /* Sum of four sizes, with overflow check. */ XSIZE_INLINE size_t ATTRIBUTE_PURE xsum4 (size_t size1, size_t size2, size_t size3, size_t size4) { return xsum (xsum (xsum (size1, size2), size3), size4); } /* Maximum of two sizes, with overflow check. */ XSIZE_INLINE size_t ATTRIBUTE_PURE xmax (size_t size1, size_t size2) { /* No explicit check is needed here, because for any n: max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */ return (size1 >= size2 ? size1 : size2); } /* Multiplication of a count with an element size, with overflow check. The count must be >= 0 and the element size must be > 0. This is a macro, not a function, so that it works correctly even when N is of a wider type and N > SIZE_MAX. */ #define xtimes(N, ELSIZE) \ ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) /* Check for overflow. */ #define size_overflow_p(SIZE) \ ((SIZE) == SIZE_MAX) /* Check against overflow. */ #define size_in_bounds_p(SIZE) \ ((SIZE) != SIZE_MAX) _GL_INLINE_HEADER_END #endif /* _XSIZE_H */ �����������������kbuild-3608/src/grep/gnulib-tests/test-getopt-gnu.c�������������������������������������������������0000664�0001750�0001750�00000003631�14670377436�022310� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of command line argument processing. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ #include <config.h> /* None of the files accessed by this test are large, so disable the ftell link warning if we are not using the gnulib ftell module. */ #define _GL_NO_LARGE_FILES /* POSIX and glibc provide the getopt() function in <unistd.h>, see https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html https://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html But gnulib provides the getopt() function in <getopt.h>, not in <unistd.h>. This is what we are testing here. */ #include <getopt.h> #ifndef __getopt_argv_const # define __getopt_argv_const const #endif #include "signature.h" SIGNATURE_CHECK (getopt_long, int, (int, char *__getopt_argv_const *, char const *, struct option const *, int *)); SIGNATURE_CHECK (getopt_long_only, int, (int, char *__getopt_argv_const *, char const *, struct option const *, int *)); #define TEST_GETOPT_GNU 1 #define TEST_GETOPT_TMP_NAME "test-getopt-gnu.tmp" #include "test-getopt-main.h" �������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/listen.c����������������������������������������������������������0000664�0001750�0001750�00000002364�14670377431�020535� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* listen.c --- wrappers for Windows listen function Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paolo Bonzini */ #include <config.h> #define WIN32_LEAN_AND_MEAN /* Get winsock2.h. */ #include <sys/socket.h> /* Get set_winsock_errno, FD_TO_SOCKET etc. */ #include "w32sock.h" #undef listen int rpl_listen (int fd, int backlog) { SOCKET sock = FD_TO_SOCKET (fd); if (sock == INVALID_SOCKET) { errno = EBADF; return -1; } else { int r = listen (sock, backlog); if (r < 0) set_winsock_errno (); return r; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-time.c�������������������������������������������������������0000664�0001750�0001750�00000002532�14670377437�021155� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <time.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <time.h> #include "verify.h" /* Check that the types are all defined. */ struct timespec t1; #if 0 /* POSIX:2008 does not require pid_t in <time.h> unconditionally, and indeed it's missing on Mac OS X 10.5, FreeBSD 6.4, OpenBSD 4.9, mingw. */ pid_t t2; #endif /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); /* Check that TIME_UTC is defined and a positive integer. */ int t3 = TIME_UTC; verify (TIME_UTC > 0); int main (void) { return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sigprocmask.c�����������������������������������������������������0000664�0001750�0001750�00000020622�14670377436�021563� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* POSIX compatible signal blocking. Copyright (C) 2006-2021 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <signal.h> #include <errno.h> #include <stdint.h> #include <stdlib.h> #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" #endif /* We assume that a platform without POSIX signal blocking functions also does not have the POSIX sigaction() function, only the signal() function. We also assume signal() has SysV semantics, where any handler is uninstalled prior to being invoked. This is true for native Windows platforms. */ /* We use raw signal(), but also provide a wrapper rpl_signal() so that applications can query or change a blocked signal. */ #undef signal /* Provide invalid signal numbers as fallbacks if the uncatchable signals are not defined. */ #ifndef SIGKILL # define SIGKILL (-1) #endif #ifndef SIGSTOP # define SIGSTOP (-1) #endif /* On native Windows, as of 2008, the signal SIGABRT_COMPAT is an alias for the signal SIGABRT. Only one signal handler is stored for both SIGABRT and SIGABRT_COMPAT. SIGABRT_COMPAT is not a signal of its own. */ #if defined _WIN32 && ! defined __CYGWIN__ # undef SIGABRT_COMPAT # define SIGABRT_COMPAT 6 #endif #ifdef SIGABRT_COMPAT # define SIGABRT_COMPAT_MASK (1U << SIGABRT_COMPAT) #else # define SIGABRT_COMPAT_MASK 0 #endif typedef void (*handler_t) (int); #if HAVE_MSVC_INVALID_PARAMETER_HANDLER static handler_t signal_nothrow (int sig, handler_t handler) { handler_t result; TRY_MSVC_INVAL { result = signal (sig, handler); } CATCH_MSVC_INVAL { result = SIG_ERR; errno = EINVAL; } DONE_MSVC_INVAL; return result; } # define signal signal_nothrow #endif /* Handling of gnulib defined signals. */ #if GNULIB_defined_SIGPIPE static handler_t SIGPIPE_handler = SIG_DFL; #endif #if GNULIB_defined_SIGPIPE static handler_t ext_signal (int sig, handler_t handler) { switch (sig) { case SIGPIPE: { handler_t old_handler = SIGPIPE_handler; SIGPIPE_handler = handler; return old_handler; } default: /* System defined signal */ return signal (sig, handler); } } # undef signal # define signal ext_signal #endif int sigismember (const sigset_t *set, int sig) { if (sig >= 0 && sig < NSIG) { #ifdef SIGABRT_COMPAT if (sig == SIGABRT_COMPAT) sig = SIGABRT; #endif return (*set >> sig) & 1; } else return 0; } int sigemptyset (sigset_t *set) { *set = 0; return 0; } int sigaddset (sigset_t *set, int sig) { if (sig >= 0 && sig < NSIG) { #ifdef SIGABRT_COMPAT if (sig == SIGABRT_COMPAT) sig = SIGABRT; #endif *set |= 1U << sig; return 0; } else { errno = EINVAL; return -1; } } int sigdelset (sigset_t *set, int sig) { if (sig >= 0 && sig < NSIG) { #ifdef SIGABRT_COMPAT if (sig == SIGABRT_COMPAT) sig = SIGABRT; #endif *set &= ~(1U << sig); return 0; } else { errno = EINVAL; return -1; } } int sigfillset (sigset_t *set) { *set = ((2U << (NSIG - 1)) - 1) & ~ SIGABRT_COMPAT_MASK; return 0; } /* Set of currently blocked signals. */ static volatile sigset_t blocked_set /* = 0 */; /* Set of currently blocked and pending signals. */ static volatile sig_atomic_t pending_array[NSIG] /* = { 0 } */; /* Signal handler that is installed for blocked signals. */ static void blocked_handler (int sig) { /* Reinstall the handler, in case the signal occurs multiple times while blocked. There is an inherent race where an asynchronous signal in between when the kernel uninstalled the handler and when we reinstall it will trigger the default handler; oh well. */ signal (sig, blocked_handler); if (sig >= 0 && sig < NSIG) pending_array[sig] = 1; } int sigpending (sigset_t *set) { sigset_t pending = 0; int sig; for (sig = 0; sig < NSIG; sig++) if (pending_array[sig]) pending |= 1U << sig; *set = pending; return 0; } /* The previous signal handlers. Only the array elements corresponding to blocked signals are relevant. */ static volatile handler_t old_handlers[NSIG]; int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set) { if (old_set != NULL) *old_set = blocked_set; if (set != NULL) { sigset_t new_blocked_set; sigset_t to_unblock; sigset_t to_block; switch (operation) { case SIG_BLOCK: new_blocked_set = blocked_set | *set; break; case SIG_SETMASK: new_blocked_set = *set; break; case SIG_UNBLOCK: new_blocked_set = blocked_set & ~*set; break; default: errno = EINVAL; return -1; } to_unblock = blocked_set & ~new_blocked_set; to_block = new_blocked_set & ~blocked_set; if (to_block != 0) { int sig; for (sig = 0; sig < NSIG; sig++) if ((to_block >> sig) & 1) { pending_array[sig] = 0; if ((old_handlers[sig] = signal (sig, blocked_handler)) != SIG_ERR) blocked_set |= 1U << sig; } } if (to_unblock != 0) { sig_atomic_t received[NSIG]; int sig; for (sig = 0; sig < NSIG; sig++) if ((to_unblock >> sig) & 1) { if (signal (sig, old_handlers[sig]) != blocked_handler) /* The application changed a signal handler while the signal was blocked, bypassing our rpl_signal replacement. We don't support this. */ abort (); received[sig] = pending_array[sig]; blocked_set &= ~(1U << sig); pending_array[sig] = 0; } else received[sig] = 0; for (sig = 0; sig < NSIG; sig++) if (received[sig]) raise (sig); } } return 0; } /* Install the handler FUNC for signal SIG, and return the previous handler. */ handler_t rpl_signal (int sig, handler_t handler) { /* We must provide a wrapper, so that a user can query what handler they installed even if that signal is currently blocked. */ if (sig >= 0 && sig < NSIG && sig != SIGKILL && sig != SIGSTOP && handler != SIG_ERR) { #ifdef SIGABRT_COMPAT if (sig == SIGABRT_COMPAT) sig = SIGABRT; #endif if (blocked_set & (1U << sig)) { /* POSIX states that sigprocmask and signal are both async-signal-safe. This is not true of our implementation - there is a slight data race where an asynchronous interrupt on signal A can occur after we install blocked_handler but before we have updated old_handlers for signal B, such that handler A can see stale information if it calls signal(B). Oh well - signal handlers really shouldn't try to manipulate the installed handlers of unrelated signals. */ handler_t result = old_handlers[sig]; old_handlers[sig] = handler; return result; } else return signal (sig, handler); } else { errno = EINVAL; return SIG_ERR; } } #if GNULIB_defined_SIGPIPE /* Raise the signal SIGPIPE. */ int _gl_raise_SIGPIPE (void) { if (blocked_set & (1U << SIGPIPE)) pending_array[SIGPIPE] = 1; else { handler_t handler = SIGPIPE_handler; if (handler == SIG_DFL) exit (128 + SIGPIPE); else if (handler != SIG_IGN) (*handler) (SIGPIPE); } return 0; } #endif ��������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcrtomb-w32-7.sh���������������������������������������������0000775�0001750�0001750�00000000215�14670377436�022637� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test some UTF-8 locales. ${CHECKER} ./test-wcrtomb-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-version-etc.sh�����������������������������������������������0000775�0001750�0001750�00000002677�14670377436�022661� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test suite for version-etc. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . TMP=ve-expected.tmp LC_ALL=C export LC_ALL ERR=0 cat > $TMP <<EOT test-version-etc (PROJECT) VERSION COPYRIGHT Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Sergey Poznyakoff and Eric Blake. EOT ${CHECKER} test-version-etc${EXEEXT} --version | sed '1s/test-version-etc (.*) .*/test-version-etc (PROJECT) VERSION/ /^Packaged by/d 2,3 s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' | tr -d '\015' | compare $TMP - || ERR=1 rm $TMP exit $ERR �����������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/Makefile.am�������������������������������������������������������0000664�0001750�0001750�00000000130�14670377427�021121� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������AM_CFLAGS = include gnulib.mk AM_CFLAGS += $(GNULIB_TEST_WARN_CFLAGS) $(WERROR_CFLAGS) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-nl_langinfo.sh�����������������������������������������������0000775�0001750�0001750�00000000726�14670377436�022702� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh LC_ALL=C ${CHECKER} ./test-nl_langinfo${EXEEXT} 0 || exit 1 # Test whether a specific traditional locale is installed. : ${LOCALE_FR=fr_FR} if test $LOCALE_FR != none; then LC_ALL=$LOCALE_FR ${CHECKER} ./test-nl_langinfo${EXEEXT} 1 || exit 1 fi # Test whether a specific UTF-8 locale is installed. : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR_UTF8 != none; then LC_ALL=$LOCALE_FR_UTF8 ${CHECKER} ./test-nl_langinfo${EXEEXT} 2 || exit 1 fi exit 0 ������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-ftruncate.sh�������������������������������������������������0000775�0001750�0001750�00000000121�14670377436�022374� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh exec ${CHECKER} ./test-ftruncate${EXEEXT} "$srcdir/test-ftruncate.sh" �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsrtowcs1.sh������������������������������������������������0000775�0001750�0001750�00000000562�14670377436�022516� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test in an ISO-8859-1 or ISO-8859-15 locale. : ${LOCALE_FR=fr_FR} if test $LOCALE_FR = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no traditional french locale is installed" else echo "Skipping test: no traditional french locale is supported" fi exit 77 fi LC_ALL=$LOCALE_FR \ ${CHECKER} ./test-mbsrtowcs${EXEEXT} 1 ����������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sockets.c����������������������������������������������������0000664�0001750�0001750�00000002164�14670377436�021672� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2008-2021 Free Software Foundation, Inc. * Written by Simon Josefsson. * * 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include "sockets.h" int main (void) { int err; err = gl_sockets_startup (SOCKETS_1_1); if (err != 0) { printf ("wsastartup failed %d\n", err); return 1; } err = gl_sockets_cleanup (); if (err != 0) { printf ("wsacleanup failed %d\n", err); return 1; } (void) gl_fd_to_handle (0); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fwrite.c�����������������������������������������������������0000664�0001750�0001750�00000005131�14670377436�021514� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of fwrite() function. Copyright (C) 2011-2021 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, 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include "signature.h" SIGNATURE_CHECK (fwrite, size_t, (const void *, size_t, size_t, FILE *)); #include <errno.h> #include <fcntl.h> #include <unistd.h> #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" #endif #include "macros.h" int main (int argc, char **argv) { const char *filename = "test-fwrite.txt"; /* We don't have an fwrite() function that installs an invalid parameter handler so far. So install that handler here, explicitly. */ #if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING gl_msvc_inval_ensure_handler (); #endif /* Test that fwrite() on an unbuffered stream sets errno if someone else closes the stream fd behind the back of stdio. */ { FILE *fp = fopen (filename, "w"); char buf[5] = "world"; ASSERT (fp != NULL); setvbuf (fp, NULL, _IONBF, 0); ASSERT (close (fileno (fp)) == 0); errno = 0; ASSERT (fwrite (buf, 1, sizeof (buf), fp) == 0); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } /* Test that fwrite() on an unbuffered stream sets errno if the stream was constructed with an invalid file descriptor. */ { FILE *fp = fdopen (-1, "w"); if (fp != NULL) { char buf[5] = "world"; setvbuf (fp, NULL, _IONBF, 0); errno = 0; ASSERT (fwrite (buf, 1, sizeof (buf), fp) == 0); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } } { FILE *fp; close (99); fp = fdopen (99, "w"); if (fp != NULL) { char buf[5] = "world"; setvbuf (fp, NULL, _IONBF, 0); errno = 0; ASSERT (fwrite (buf, 1, sizeof (buf), fp) == 0); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } } /* Clean up. */ unlink (filename); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sys_ioctl.in.h����������������������������������������������������0000664�0001750�0001750�00000005054�14670377431�021660� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Substitute for and wrapper around <sys/ioctl.h>. Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _@GUARD_PREFIX@_SYS_IOCTL_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_SYS_IOCTL_H@ # @INCLUDE_NEXT@ @NEXT_SYS_IOCTL_H@ #endif #ifndef _@GUARD_PREFIX@_SYS_IOCTL_H #define _@GUARD_PREFIX@_SYS_IOCTL_H /* AIX 5.1 and Solaris 10 declare ioctl() in <unistd.h> and in <stropts.h>, but not in <sys/ioctl.h>. Haiku declares ioctl() in <unistd.h>, but not in <sys/ioctl.h>. But avoid namespace pollution on glibc systems. */ #ifndef __GLIBC__ # include <unistd.h> #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Declare overridden functions. */ #if @GNULIB_IOCTL@ # if @REPLACE_IOCTL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ioctl # define ioctl rpl_ioctl # endif _GL_FUNCDECL_RPL (ioctl, int, (int fd, int request, ... /* {void *,char *} arg */)); _GL_CXXALIAS_RPL (ioctl, int, (int fd, int request, ... /* {void *,char *} arg */)); # else # if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ || 1 _GL_FUNCDECL_SYS (ioctl, int, (int fd, int request, ... /* {void *,char *} arg */)); # endif _GL_CXXALIAS_SYS (ioctl, int, (int fd, int request, ... /* {void *,char *} arg */)); # endif _GL_CXXALIASWARN (ioctl); #elif @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ # undef ioctl # define ioctl ioctl_used_without_requesting_gnulib_module_ioctl #elif defined GNULIB_POSIXCHECK # undef ioctl # if HAVE_RAW_DECL_IOCTL _GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - " "use gnulib module ioctl for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_SYS_IOCTL_H */ #endif /* _@GUARD_PREFIX@_SYS_IOCTL_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-select.h�����������������������������������������������������0000664�0001750�0001750�00000026411�14670377436�021504� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of select() substitute. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini, 2008. */ #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <stdbool.h> #include <sys/ioctl.h> #include <errno.h> #include "macros.h" #if defined _WIN32 && ! defined __CYGWIN__ # define WINDOWS_NATIVE #endif #ifdef HAVE_SYS_WAIT_H # include <sys/wait.h> #endif #define TEST_PORT 12345 typedef int (*select_fn) (int, fd_set *, fd_set *, fd_set *, struct timeval *); /* Minimal testing infrastructure. */ static int failures; static void failed (const char *reason) { if (++failures > 1) printf (" "); printf ("failed (%s)\n", reason); } static int test (void (*fn) (select_fn), select_fn my_select, const char *msg) { failures = 0; printf ("%s... ", msg); fflush (stdout); fn (my_select); if (!failures) printf ("passed\n"); return failures; } /* Funny socket code. */ static int open_server_socket (void) { int s, x; struct sockaddr_in ia; s = socket (AF_INET, SOCK_STREAM, 0); x = 1; setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x)); memset (&ia, 0, sizeof (ia)); ia.sin_family = AF_INET; inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr); ia.sin_port = htons (TEST_PORT); if (bind (s, (struct sockaddr *) &ia, sizeof (ia)) < 0) { perror ("bind"); exit (77); } if (listen (s, 1) < 0) { perror ("listen"); exit (77); } return s; } static int connect_to_socket (bool blocking) { int s; struct sockaddr_in ia; s = socket (AF_INET, SOCK_STREAM, 0); memset (&ia, 0, sizeof (ia)); ia.sin_family = AF_INET; inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr); ia.sin_port = htons (TEST_PORT); if (!blocking) { #ifdef WINDOWS_NATIVE unsigned long iMode = 1; ioctl (s, FIONBIO, (char *) &iMode); #elif defined F_GETFL int oldflags = fcntl (s, F_GETFL, NULL); if (!(oldflags & O_NONBLOCK)) fcntl (s, F_SETFL, oldflags | O_NONBLOCK); #endif } if (connect (s, (struct sockaddr *) &ia, sizeof (ia)) < 0 && (blocking || errno != EINPROGRESS)) { perror ("connect"); exit (77); } return s; } /* A slightly more convenient interface to select(2). Waits until a specific event occurs on a file descriptor FD. EV is a bit mask of events to look for: SEL_IN - input can be polled without blocking, SEL_OUT - output can be provided without blocking, SEL_EXC - an exception occurred, A maximum wait time is specified by TIMEOUT. *TIMEOUT = { 0, 0 } means to return immediately, TIMEOUT = NULL means to wait indefinitely. */ enum { SEL_IN = 1, SEL_OUT = 2, SEL_EXC = 4 }; static int do_select (int fd, int ev, struct timeval *timeout, select_fn my_select) { fd_set rfds, wfds, xfds; int r, rev; FD_ZERO (&rfds); FD_ZERO (&wfds); FD_ZERO (&xfds); if (ev & SEL_IN) FD_SET (fd, &rfds); if (ev & SEL_OUT) FD_SET (fd, &wfds); if (ev & SEL_EXC) FD_SET (fd, &xfds); r = my_select (fd + 1, &rfds, &wfds, &xfds, timeout); if (r < 0) return r; rev = 0; if (FD_ISSET (fd, &rfds)) rev |= SEL_IN; if (FD_ISSET (fd, &wfds)) rev |= SEL_OUT; if (FD_ISSET (fd, &xfds)) rev |= SEL_EXC; if (rev && r == 0) failed ("select returned 0"); if (rev & ~ev) failed ("select returned unrequested events"); return rev; } static int do_select_nowait (int fd, int ev, select_fn my_select) { struct timeval tv0; tv0.tv_sec = 0; tv0.tv_usec = 0; return do_select (fd, ev, &tv0, my_select); } static int do_select_wait (int fd, int ev, select_fn my_select) { return do_select (fd, ev, NULL, my_select); } /* Test select(2) for TTYs. */ #ifdef INTERACTIVE static void test_tty (select_fn my_select) { if (do_select_nowait (0, SEL_IN, my_select) != 0) failed ("can read"); if (do_select_nowait (0, SEL_OUT, my_select) == 0) failed ("cannot write"); if (do_select_wait (0, SEL_IN, my_select) == 0) failed ("return with infinite timeout"); getchar (); if (do_select_nowait (0, SEL_IN, my_select) != 0) failed ("can read after getc"); } #endif static int do_select_bad_nfd_nowait (int nfd, select_fn my_select) { struct timeval tv0; tv0.tv_sec = 0; tv0.tv_usec = 0; errno = 0; return my_select (nfd, NULL, NULL, NULL, &tv0); } static void test_bad_nfd (select_fn my_select) { if (do_select_bad_nfd_nowait (-1, my_select) != -1 || errno != EINVAL) failed ("invalid errno after negative nfds"); /* Can't test FD_SETSIZE + 1 for EINVAL, since some systems allow dynamically larger set size by redefining FD_SETSIZE anywhere up to the actual maximum fd. */ #if 0 if (do_select_bad_nfd_nowait (FD_SETSIZE + 1, my_select) != -1 || errno != EINVAL) failed ("invalid errno after bogus nfds"); #endif } /* Test select(2) on invalid file descriptors. */ static int do_select_bad_fd (int fd, int ev, struct timeval *timeout, select_fn my_select) { fd_set rfds, wfds, xfds; FD_ZERO (&rfds); FD_ZERO (&wfds); FD_ZERO (&xfds); if (ev & SEL_IN) FD_SET (fd, &rfds); if (ev & SEL_OUT) FD_SET (fd, &wfds); if (ev & SEL_EXC) FD_SET (fd, &xfds); errno = 0; return my_select (fd + 1, &rfds, &wfds, &xfds, timeout); /* In this case, when fd is invalid, on some platforms, the bit for fd is left alone in the fd_set, whereas on other platforms it is cleared. So, don't check the bit for fd here. */ } static int do_select_bad_fd_nowait (int fd, int ev, select_fn my_select) { struct timeval tv0; tv0.tv_sec = 0; tv0.tv_usec = 0; return do_select_bad_fd (fd, ev, &tv0, my_select); } static void test_bad_fd (select_fn my_select) { /* This tests fails on OSF/1 and native Windows, even with fd = 16. */ #if !(defined __osf__ || defined WINDOWS_NATIVE) int fd; /* On Linux, Mac OS X, *BSD, values of fd like 99 or 399 are discarded by the kernel early and therefore do *not* lead to EBADF, as required by POSIX. */ # if defined __linux__ || (defined __APPLE__ && defined __MACH__) || (defined __FreeBSD__ || defined __DragonFly__) || defined __OpenBSD__ || defined __NetBSD__ fd = 14; # else fd = 99; # endif /* Even on the best POSIX compliant platforms, values of fd >= FD_SETSIZE require an nfds argument that is > FD_SETSIZE and thus may lead to EINVAL, not EBADF. */ if (fd >= FD_SETSIZE) fd = FD_SETSIZE - 1; close (fd); if (do_select_bad_fd_nowait (fd, SEL_IN, my_select) == 0 || errno != EBADF) failed ("invalid fd among rfds"); if (do_select_bad_fd_nowait (fd, SEL_OUT, my_select) == 0 || errno != EBADF) failed ("invalid fd among wfds"); if (do_select_bad_fd_nowait (fd, SEL_EXC, my_select) == 0 || errno != EBADF) failed ("invalid fd among xfds"); #endif } /* Test select(2) for unconnected nonblocking sockets. */ static void test_connect_first (select_fn my_select) { int s = open_server_socket (); struct sockaddr_in ia; socklen_t addrlen; int c1, c2; if (do_select_nowait (s, SEL_IN | SEL_EXC, my_select) != 0) failed ("can read, socket not connected"); c1 = connect_to_socket (false); if (do_select_wait (s, SEL_IN | SEL_EXC, my_select) != SEL_IN) failed ("expecting readability on passive socket"); if (do_select_nowait (s, SEL_IN | SEL_EXC, my_select) != SEL_IN) failed ("expecting readability on passive socket"); addrlen = sizeof (ia); c2 = accept (s, (struct sockaddr *) &ia, &addrlen); ASSERT (close (s) == 0); ASSERT (close (c1) == 0); ASSERT (close (c2) == 0); } /* Test select(2) for unconnected blocking sockets. */ static void test_accept_first (select_fn my_select) { #ifndef WINDOWS_NATIVE int s = open_server_socket (); struct sockaddr_in ia; socklen_t addrlen; char buf[3]; int c, pid; pid = fork (); if (pid < 0) return; if (pid == 0) { addrlen = sizeof (ia); c = accept (s, (struct sockaddr *) &ia, &addrlen); ASSERT (close (s) == 0); ASSERT (write (c, "foo", 3) == 3); ASSERT (read (c, buf, 3) == 3); shutdown (c, SHUT_RD); ASSERT (close (c) == 0); exit (0); } else { ASSERT (close (s) == 0); c = connect_to_socket (true); if (do_select_nowait (c, SEL_OUT, my_select) != SEL_OUT) failed ("cannot write after blocking connect"); ASSERT (write (c, "foo", 3) == 3); wait (&pid); if (do_select_wait (c, SEL_IN, my_select) != SEL_IN) failed ("cannot read data left in the socket by closed process"); ASSERT (read (c, buf, 3) == 3); ASSERT (write (c, "foo", 3) == 3); (void) close (c); /* may fail with errno = ECONNRESET */ } #endif } /* Common code for pipes and connected sockets. */ static void test_pair (int rd, int wd, select_fn my_select) { char buf[3]; if (do_select_wait (wd, SEL_IN | SEL_OUT | SEL_EXC, my_select) != SEL_OUT) failed ("expecting writability before writing"); if (do_select_nowait (wd, SEL_IN | SEL_OUT | SEL_EXC, my_select) != SEL_OUT) failed ("expecting writability before writing"); ASSERT (write (wd, "foo", 3) == 3); if (do_select_wait (rd, SEL_IN, my_select) != SEL_IN) failed ("expecting readability after writing"); if (do_select_nowait (rd, SEL_IN, my_select) != SEL_IN) failed ("expecting readability after writing"); ASSERT (read (rd, buf, 3) == 3); } /* Test select(2) on connected sockets. */ static void test_socket_pair (select_fn my_select) { struct sockaddr_in ia; socklen_t addrlen = sizeof (ia); int s = open_server_socket (); int c1 = connect_to_socket (false); int c2 = accept (s, (struct sockaddr *) &ia, &addrlen); ASSERT (close (s) == 0); test_pair (c1, c2, my_select); ASSERT (close (c1) == 0); ASSERT (write (c2, "foo", 3) == 3); (void) close (c2); /* may fail with errno = ECONNRESET */ } /* Test select(2) on pipes. */ static void test_pipe (select_fn my_select) { int fd[2]; ASSERT (pipe (fd) == 0); test_pair (fd[0], fd[1], my_select); ASSERT (close (fd[0]) == 0); ASSERT (close (fd[1]) == 0); } /* Do them all. */ static int test_function (select_fn my_select) { int result = 0; #ifdef INTERACTIVE printf ("Please press Enter\n"); test (test_tty, "TTY", my_select); #endif result += test (test_bad_nfd, my_select, "Invalid nfd test"); result += test (test_bad_fd, my_select, "Invalid fd test"); result += test (test_connect_first, my_select, "Unconnected socket test"); result += test (test_socket_pair, my_select, "Connected sockets test"); result += test (test_accept_first, my_select, "General socket test with fork"); result += test (test_pipe, my_select, "Pipe test"); return result; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-unsetenv.c���������������������������������������������������0000664�0001750�0001750�00000003376�14670377436�022074� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Tests of unsetenv. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <stdlib.h> #include "signature.h" SIGNATURE_CHECK (unsetenv, int, (char const *)); #include <errno.h> #include <string.h> #include <unistd.h> #include "macros.h" int main (void) { char entry[] = "b=2"; /* Test removal when multiple entries present. */ ASSERT (putenv ((char *) "a=1") == 0); ASSERT (putenv (entry) == 0); entry[0] = 'a'; /* Unspecified what getenv("a") would be at this point. */ ASSERT (unsetenv ("a") == 0); /* Both entries will be removed. */ ASSERT (getenv ("a") == NULL); ASSERT (unsetenv ("a") == 0); /* Required to fail with EINVAL. */ errno = 0; ASSERT (unsetenv ("") == -1); ASSERT (errno == EINVAL); errno = 0; ASSERT (unsetenv ("a=b") == -1); ASSERT (errno == EINVAL); #if 0 /* glibc and gnulib's implementation guarantee this, but POSIX no longer requires it: http://austingroupbugs.net/view.php?id=185 */ errno = 0; ASSERT (unsetenv (NULL) == -1); ASSERT (errno == EINVAL); #endif return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-iswxdigit.c��������������������������������������������������0000664�0001750�0001750�00000021362�14670377436�022233� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of iswxdigit() function. Copyright (C) 2020-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <wctype.h> #include "signature.h" SIGNATURE_CHECK (iswxdigit, int, (wint_t)); #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> #include "macros.h" /* Returns the value of iswxdigit for the multibyte character s[0..n-1]. */ static int for_character (const char *s, size_t n) { mbstate_t state; wchar_t wc; size_t ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, s, n, &state); if (ret == n) return iswxdigit (wc); else return 0; } int main (int argc, char *argv[]) { int is; char buf[4]; /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; /* Test WEOF. */ is = iswxdigit (WEOF); ASSERT (is == 0); /* Test single-byte characters. ISO C 99 sections 7.25.2.1.12 and 6.4.4.1 specify that the hexadecimal digits include only the ASCII 0 ... 9 A ... F a ... f characters. */ { int c; for (c = 0; c < 0x100; c++) switch (c) { case '\t': case '\v': case '\f': 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 '~': /* c is in the ISO C "basic character set". */ buf[0] = (unsigned char) c; is = for_character (buf, 1); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': ASSERT (is != 0); break; default: ASSERT (is == 0); break; } break; } } if (argc > 1) switch (argv[1][0]) { case '0': /* C locale; tested above. */ return 0; case '1': /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ { /* U+00B2 SUPERSCRIPT TWO */ is = for_character ("\262", 1); ASSERT (is == 0); /* U+00B3 SUPERSCRIPT THREE */ is = for_character ("\263", 1); ASSERT (is == 0); /* U+00B9 SUPERSCRIPT ONE */ is = for_character ("\271", 1); ASSERT (is == 0); } return 0; case '2': /* Locale encoding is EUC-JP. */ { /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\243\261", 2); ASSERT (is == 0); /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ is = for_character ("\243\301", 2); ASSERT (is == 0); /* U+FF41 FULLWIDTH LATIN SMALL LETTER A */ is = for_character ("\243\341", 2); ASSERT (is == 0); } return 0; case '3': /* Locale encoding is UTF-8. */ { /* U+00B2 SUPERSCRIPT TWO */ is = for_character ("\302\262", 2); ASSERT (is == 0); /* U+00B3 SUPERSCRIPT THREE */ is = for_character ("\302\263", 2); ASSERT (is == 0); /* U+00B9 SUPERSCRIPT ONE */ is = for_character ("\302\271", 2); ASSERT (is == 0); /* U+0663 ARABIC-INDIC DIGIT THREE */ is = for_character ("\331\243", 2); ASSERT (is == 0); /* U+2070 SUPERSCRIPT ZERO */ is = for_character ("\342\201\260", 3); ASSERT (is == 0); /* U+2079 SUPERSCRIPT NINE */ is = for_character ("\342\201\271", 3); ASSERT (is == 0); /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\357\274\221", 3); ASSERT (is == 0); /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ is = for_character ("\357\274\241", 3); ASSERT (is == 0); /* U+FF41 FULLWIDTH LATIN SMALL LETTER A */ is = for_character ("\357\275\201", 3); ASSERT (is == 0); /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */ is = for_character ("\360\235\237\221", 4); ASSERT (is == 0); /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */ is = for_character ("\360\235\237\233", 4); ASSERT (is == 0); /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */ is = for_character ("\360\235\237\245", 4); ASSERT (is == 0); /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */ is = for_character ("\360\235\237\257", 4); ASSERT (is == 0); /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */ is = for_character ("\360\235\237\271", 4); ASSERT (is == 0); /* U+E0033 TAG DIGIT THREE */ is = for_character ("\363\240\200\263", 4); ASSERT (is == 0); /* U+E0041 TAG LATIN CAPITAL LETTER A */ is = for_character ("\363\240\201\201", 4); ASSERT (is == 0); } return 0; case '4': /* Locale encoding is GB18030. */ { /* U+00B2 SUPERSCRIPT TWO */ is = for_character ("\201\060\205\065", 4); ASSERT (is == 0); /* U+00B3 SUPERSCRIPT THREE */ is = for_character ("\201\060\205\066", 4); ASSERT (is == 0); /* U+00B9 SUPERSCRIPT ONE */ is = for_character ("\201\060\206\061", 4); ASSERT (is == 0); /* U+0663 ARABIC-INDIC DIGIT THREE */ is = for_character ("\201\061\211\071", 4); ASSERT (is == 0); /* U+2070 SUPERSCRIPT ZERO */ is = for_character ("\201\066\255\062", 4); ASSERT (is == 0); /* U+2079 SUPERSCRIPT NINE */ is = for_character ("\201\066\256\061", 4); ASSERT (is == 0); /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\243\261", 2); ASSERT (is == 0); /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ is = for_character ("\243\301", 2); ASSERT (is == 0); /* U+FF41 FULLWIDTH LATIN SMALL LETTER A */ is = for_character ("\243\341", 2); ASSERT (is == 0); /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */ is = for_character ("\224\063\353\071", 4); ASSERT (is == 0); /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */ is = for_character ("\224\063\354\071", 4); ASSERT (is == 0); /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */ is = for_character ("\224\063\355\071", 4); ASSERT (is == 0); /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */ is = for_character ("\224\063\356\071", 4); ASSERT (is == 0); /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */ is = for_character ("\224\063\357\071", 4); ASSERT (is == 0); /* U+E0033 TAG DIGIT THREE */ is = for_character ("\323\066\232\071", 4); ASSERT (is == 0); /* U+E0041 TAG LATIN CAPITAL LETTER A */ is = for_character ("\323\066\234\063", 4); ASSERT (is == 0); } return 0; } return 1; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fpending.sh��������������������������������������������������0000775�0001750�0001750�00000000240�14670377436�022175� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh tmpfile= trap 'rm -fr $tmpfile' 1 2 3 15 tmpfile=test-fpending.t ${CHECKER} ./test-fpending${EXEEXT} > $tmpfile || exit 1 rm -fr $tmpfile exit 0 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/Makefile.in�������������������������������������������������������0000664�0001750�0001750�00001225606�14670377436�021154� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Makefile.in generated by automake 1.16d from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file 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 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. # # You should have received a copy of the GNU General Public License # along with this file. If not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that # contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ TESTS = test-accept$(EXEEXT) test-alignof$(EXEEXT) \ test-alloca-opt$(EXEEXT) test-argmatch$(EXEEXT) \ test-arpa_inet$(EXEEXT) test-binary-io.sh test-bind$(EXEEXT) \ test-bitrotate$(EXEEXT) test-btowc1.sh test-btowc2.sh \ test-c-ctype$(EXEEXT) test-c-stack.sh test-c-stack2.sh \ test-c-strcase.sh test-calloc-gnu$(EXEEXT) test-chdir$(EXEEXT) \ test-cloexec$(EXEEXT) test-close$(EXEEXT) \ test-connect$(EXEEXT) test-ctype$(EXEEXT) \ test-dfa-invalid-char-class.sh test-dfa-invalid-merge.sh \ test-dfa-match.sh test-dirent$(EXEEXT) test-dup$(EXEEXT) \ test-dup2$(EXEEXT) test-dynarray$(EXEEXT) \ test-environ$(EXEEXT) test-errno$(EXEEXT) test-exclude1.sh \ test-exclude2.sh test-exclude3.sh test-exclude4.sh \ test-exclude5.sh test-exclude6.sh test-exclude7.sh \ test-exclude8.sh test-fchdir$(EXEEXT) test-fcntl-h$(EXEEXT) \ test-fcntl-safer$(EXEEXT) test-fcntl$(EXEEXT) \ test-fdopen$(EXEEXT) test-fdopendir$(EXEEXT) \ test-fgetc$(EXEEXT) test-float$(EXEEXT) \ test-fnmatch-h$(EXEEXT) test-fnmatch$(EXEEXT) \ test-fopen-gnu$(EXEEXT) test-fopen$(EXEEXT) test-fpending.sh \ test-fputc$(EXEEXT) test-fread$(EXEEXT) test-free$(EXEEXT) \ test-fstat$(EXEEXT) test-fstatat$(EXEEXT) test-ftruncate.sh \ test-fwrite$(EXEEXT) test-getcwd-lgpl$(EXEEXT) \ test-getdtablesize$(EXEEXT) test-getopt-gnu$(EXEEXT) \ test-getopt-posix$(EXEEXT) test-getprogname$(EXEEXT) \ test-gettimeofday$(EXEEXT) test-hard-locale$(EXEEXT) \ test-hash$(EXEEXT) test-i-ring$(EXEEXT) test-iconv-h$(EXEEXT) \ test-iconv$(EXEEXT) test-ignore-value$(EXEEXT) \ test-inet_pton$(EXEEXT) test-intprops$(EXEEXT) \ test-inttostr$(EXEEXT) test-inttypes$(EXEEXT) \ test-ioctl$(EXEEXT) test-isatty$(EXEEXT) test-isblank$(EXEEXT) \ test-iswblank$(EXEEXT) test-iswdigit.sh test-iswxdigit.sh \ test-langinfo$(EXEEXT) test-limits-h$(EXEEXT) \ test-listen$(EXEEXT) test-locale$(EXEEXT) \ test-localeconv$(EXEEXT) test-localename$(EXEEXT) \ test-lseek.sh test-lstat$(EXEEXT) test-malloc-gnu$(EXEEXT) \ test-malloca$(EXEEXT) test-mbscasecmp.sh test-mbsinit.sh \ test-mbsrtowcs1.sh test-mbsrtowcs2.sh test-mbsrtowcs3.sh \ test-mbsrtowcs4.sh test-mbsstr1$(EXEEXT) test-mbsstr2.sh \ test-mbsstr3.sh test-memchr$(EXEEXT) test-memchr2$(EXEEXT) \ test-memrchr$(EXEEXT) test-nanosleep$(EXEEXT) \ test-netinet_in$(EXEEXT) test-nl_langinfo.sh \ test-nl_langinfo-mt$(EXEEXT) test-open$(EXEEXT) \ test-openat-safer$(EXEEXT) test-openat$(EXEEXT) \ test-pathmax$(EXEEXT) test-perror.sh test-perror2$(EXEEXT) \ test-pipe$(EXEEXT) test-pthread$(EXEEXT) \ test-pthread-thread$(EXEEXT) test-pthread_sigmask1$(EXEEXT) \ test-pthread_sigmask2$(EXEEXT) test-quotearg-simple$(EXEEXT) \ test-raise$(EXEEXT) test-rawmemchr$(EXEEXT) test-read$(EXEEXT) \ test-realloc-gnu$(EXEEXT) test-reallocarray$(EXEEXT) \ test-regex$(EXEEXT) test-sched$(EXEEXT) test-select$(EXEEXT) \ test-select-in.sh test-select-out.sh test-setenv$(EXEEXT) \ test-setlocale_null$(EXEEXT) \ test-setlocale_null-mt-one$(EXEEXT) \ test-setlocale_null-mt-all$(EXEEXT) test-setlocale1.sh \ test-setlocale2.sh test-setsockopt$(EXEEXT) \ test-sigaction$(EXEEXT) test-signal-h$(EXEEXT) \ test-sigprocmask$(EXEEXT) test-sigsegv-catch-segv1$(EXEEXT) \ test-sigsegv-catch-segv2$(EXEEXT) \ test-sigsegv-catch-stackoverflow1$(EXEEXT) \ test-sigsegv-catch-stackoverflow2$(EXEEXT) test-sleep$(EXEEXT) \ test-snprintf$(EXEEXT) test-sockets$(EXEEXT) \ test-stat$(EXEEXT) test-stat-time$(EXEEXT) \ test-stdalign$(EXEEXT) test-stdbool$(EXEEXT) \ test-stddef$(EXEEXT) test-stdint$(EXEEXT) test-stdio$(EXEEXT) \ test-stdlib$(EXEEXT) test-strerror$(EXEEXT) \ test-strerror_r$(EXEEXT) test-striconv$(EXEEXT) \ test-string$(EXEEXT) test-strnlen$(EXEEXT) \ test-strstr$(EXEEXT) test-strtoimax$(EXEEXT) \ test-strtoll$(EXEEXT) test-strtoull$(EXEEXT) \ test-strtoumax$(EXEEXT) test-symlink$(EXEEXT) \ test-sys_ioctl$(EXEEXT) test-sys_select$(EXEEXT) \ test-sys_socket$(EXEEXT) test-sys_stat$(EXEEXT) \ test-sys_time$(EXEEXT) test-sys_types$(EXEEXT) \ test-sys_uio$(EXEEXT) test-init.sh test-thread_self$(EXEEXT) \ test-thread_create$(EXEEXT) test-time$(EXEEXT) \ test-dup-safer$(EXEEXT) test-unistd$(EXEEXT) \ test-u8-mbtoucr$(EXEEXT) test-u8-uctomb$(EXEEXT) \ test-uc_width$(EXEEXT) uniwidth/test-uc_width2.sh \ test-unsetenv$(EXEEXT) test-vasnprintf$(EXEEXT) \ test-vc-list-files-git.sh test-vc-list-files-cvs.sh \ test-verify$(EXEEXT) test-verify.sh test-version-etc.sh \ test-wchar$(EXEEXT) test-wcrtomb.sh test-wcrtomb-w32-1.sh \ test-wcrtomb-w32-2.sh test-wcrtomb-w32-3.sh \ test-wcrtomb-w32-4.sh test-wcrtomb-w32-5.sh \ test-wcrtomb-w32-6.sh test-wcrtomb-w32-7.sh \ test-wctype-h$(EXEEXT) test-wcwidth$(EXEEXT) \ test-xalloc-die.sh test-xstrtoimax.sh test-xstrtol.sh XFAIL_TESTS = noinst_PROGRAMS = current-locale$(EXEEXT) test-localcharset$(EXEEXT) check_PROGRAMS = test-accept$(EXEEXT) test-alignof$(EXEEXT) \ test-alloca-opt$(EXEEXT) test-argmatch$(EXEEXT) \ test-arpa_inet$(EXEEXT) test-binary-io$(EXEEXT) \ test-bind$(EXEEXT) test-bitrotate$(EXEEXT) test-btowc$(EXEEXT) \ test-c-ctype$(EXEEXT) test-c-stack$(EXEEXT) \ test-c-strcasecmp$(EXEEXT) test-c-strncasecmp$(EXEEXT) \ test-calloc-gnu$(EXEEXT) test-chdir$(EXEEXT) \ test-cloexec$(EXEEXT) test-close$(EXEEXT) \ test-connect$(EXEEXT) test-ctype$(EXEEXT) \ test-dfa-match-aux$(EXEEXT) test-dirent$(EXEEXT) \ test-dup$(EXEEXT) test-dup2$(EXEEXT) test-dynarray$(EXEEXT) \ test-environ$(EXEEXT) test-errno$(EXEEXT) \ test-exclude$(EXEEXT) test-fchdir$(EXEEXT) \ test-fcntl-h$(EXEEXT) test-fcntl-safer$(EXEEXT) \ test-fcntl$(EXEEXT) test-fdopen$(EXEEXT) \ test-fdopendir$(EXEEXT) test-fgetc$(EXEEXT) \ test-float$(EXEEXT) test-fnmatch-h$(EXEEXT) \ test-fnmatch$(EXEEXT) test-fopen-gnu$(EXEEXT) \ test-fopen$(EXEEXT) test-fpending$(EXEEXT) test-fputc$(EXEEXT) \ test-fread$(EXEEXT) test-free$(EXEEXT) test-fstat$(EXEEXT) \ test-fstatat$(EXEEXT) test-ftruncate$(EXEEXT) \ test-fwrite$(EXEEXT) test-getcwd-lgpl$(EXEEXT) \ test-getdtablesize$(EXEEXT) test-getopt-gnu$(EXEEXT) \ test-getopt-posix$(EXEEXT) test-getprogname$(EXEEXT) \ test-gettimeofday$(EXEEXT) test-hard-locale$(EXEEXT) \ test-hash$(EXEEXT) test-i-ring$(EXEEXT) test-iconv-h$(EXEEXT) \ test-iconv$(EXEEXT) test-ignore-value$(EXEEXT) \ test-inet_pton$(EXEEXT) test-intprops$(EXEEXT) \ test-inttostr$(EXEEXT) test-inttypes$(EXEEXT) \ test-ioctl$(EXEEXT) test-isatty$(EXEEXT) test-isblank$(EXEEXT) \ test-iswblank$(EXEEXT) test-iswdigit$(EXEEXT) \ test-iswxdigit$(EXEEXT) test-langinfo$(EXEEXT) \ test-limits-h$(EXEEXT) test-listen$(EXEEXT) \ test-locale$(EXEEXT) test-localeconv$(EXEEXT) \ test-localename$(EXEEXT) test-lseek$(EXEEXT) \ test-lstat$(EXEEXT) test-malloc-gnu$(EXEEXT) \ test-malloca$(EXEEXT) test-mbscasecmp$(EXEEXT) \ test-mbsinit$(EXEEXT) test-mbsrtowcs$(EXEEXT) \ test-mbsstr1$(EXEEXT) test-mbsstr2$(EXEEXT) \ test-mbsstr3$(EXEEXT) test-memchr$(EXEEXT) \ test-memchr2$(EXEEXT) test-memrchr$(EXEEXT) \ test-nanosleep$(EXEEXT) test-netinet_in$(EXEEXT) \ test-nl_langinfo$(EXEEXT) test-nl_langinfo-mt$(EXEEXT) \ test-open$(EXEEXT) test-openat-safer$(EXEEXT) \ test-openat$(EXEEXT) test-pathmax$(EXEEXT) \ test-perror$(EXEEXT) test-perror2$(EXEEXT) test-pipe$(EXEEXT) \ test-pthread$(EXEEXT) test-pthread-thread$(EXEEXT) \ test-pthread_sigmask1$(EXEEXT) test-pthread_sigmask2$(EXEEXT) \ test-quotearg-simple$(EXEEXT) test-raise$(EXEEXT) \ test-rawmemchr$(EXEEXT) test-read$(EXEEXT) \ test-realloc-gnu$(EXEEXT) test-reallocarray$(EXEEXT) \ test-regex$(EXEEXT) test-sched$(EXEEXT) test-select$(EXEEXT) \ test-select-fd$(EXEEXT) test-select-stdin$(EXEEXT) \ test-setenv$(EXEEXT) test-setlocale_null$(EXEEXT) \ test-setlocale_null-mt-one$(EXEEXT) \ test-setlocale_null-mt-all$(EXEEXT) test-setlocale1$(EXEEXT) \ test-setlocale2$(EXEEXT) test-setsockopt$(EXEEXT) \ test-sigaction$(EXEEXT) test-signal-h$(EXEEXT) \ test-sigprocmask$(EXEEXT) test-sigsegv-catch-segv1$(EXEEXT) \ test-sigsegv-catch-segv2$(EXEEXT) \ test-sigsegv-catch-stackoverflow1$(EXEEXT) \ test-sigsegv-catch-stackoverflow2$(EXEEXT) test-sleep$(EXEEXT) \ test-snprintf$(EXEEXT) test-sockets$(EXEEXT) \ test-stat$(EXEEXT) test-stat-time$(EXEEXT) \ test-stdalign$(EXEEXT) test-stdbool$(EXEEXT) \ test-stddef$(EXEEXT) test-stdint$(EXEEXT) test-stdio$(EXEEXT) \ test-stdlib$(EXEEXT) test-strerror$(EXEEXT) \ test-strerror_r$(EXEEXT) test-striconv$(EXEEXT) \ test-string$(EXEEXT) test-strnlen$(EXEEXT) \ test-strstr$(EXEEXT) test-strtoimax$(EXEEXT) \ test-strtoll$(EXEEXT) test-strtoull$(EXEEXT) \ test-strtoumax$(EXEEXT) test-symlink$(EXEEXT) \ test-sys_ioctl$(EXEEXT) test-sys_select$(EXEEXT) \ test-sys_socket$(EXEEXT) test-sys_stat$(EXEEXT) \ test-sys_time$(EXEEXT) test-sys_types$(EXEEXT) \ test-sys_uio$(EXEEXT) test-thread_self$(EXEEXT) \ test-thread_create$(EXEEXT) test-time$(EXEEXT) \ test-dup-safer$(EXEEXT) test-unistd$(EXEEXT) \ test-u8-mbtoucr$(EXEEXT) test-u8-uctomb$(EXEEXT) \ test-uc_width$(EXEEXT) test-uc_width2$(EXEEXT) \ test-unsetenv$(EXEEXT) test-vasnprintf$(EXEEXT) \ test-verify$(EXEEXT) test-version-etc$(EXEEXT) \ test-wchar$(EXEEXT) test-wcrtomb$(EXEEXT) \ test-wcrtomb-w32$(EXEEXT) test-wctype-h$(EXEEXT) \ test-wcwidth$(EXEEXT) test-xalloc-die$(EXEEXT) \ test-xstrtoimax$(EXEEXT) test-xstrtol$(EXEEXT) \ test-xstrtoul$(EXEEXT) EXTRA_PROGRAMS = test-verify-try$(EXEEXT) subdir = gnulib-tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/__inline.m4 \ $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \ $(top_srcdir)/m4/arpa_inet_h.m4 \ $(top_srcdir)/m4/asm-underscore.m4 $(top_srcdir)/m4/assert.m4 \ $(top_srcdir)/m4/btowc.m4 $(top_srcdir)/m4/builtin-expect.m4 \ $(top_srcdir)/m4/c-stack.m4 $(top_srcdir)/m4/calloc.m4 \ $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/close.m4 \ $(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/ctype_h.m4 \ $(top_srcdir)/m4/cycle-check.m4 $(top_srcdir)/m4/d-ino.m4 \ $(top_srcdir)/m4/d-type.m4 $(top_srcdir)/m4/dirent_h.m4 \ $(top_srcdir)/m4/dirfd.m4 \ $(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup.m4 \ $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exponentd.m4 \ $(top_srcdir)/m4/extensions.m4 \ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopen.m4 $(top_srcdir)/m4/fdopendir.m4 \ $(top_srcdir)/m4/filenamecat.m4 $(top_srcdir)/m4/flexmember.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fnmatch.m4 \ $(top_srcdir)/m4/fnmatch_h.m4 $(top_srcdir)/m4/fopen.m4 \ $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/fpieee.m4 \ $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/fstat.m4 \ $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/ftruncate.m4 \ $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \ $(top_srcdir)/m4/getpagesize.m4 \ $(top_srcdir)/m4/getprogname.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/iconv_h.m4 \ $(top_srcdir)/m4/iconv_open.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_pton.m4 \ $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intl-thread-locale.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax_t.m4 \ $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes.m4 \ $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/ioctl.m4 \ $(top_srcdir)/m4/isatty.m4 $(top_srcdir)/m4/isblank.m4 \ $(top_srcdir)/m4/iswblank.m4 $(top_srcdir)/m4/iswctype.m4 \ $(top_srcdir)/m4/iswdigit.m4 $(top_srcdir)/m4/iswxdigit.m4 \ $(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \ $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/libsigsegv.m4 \ $(top_srcdir)/m4/libunistring-base.m4 \ $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/localcharset.m4 \ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \ $(top_srcdir)/m4/locale-tr.m4 $(top_srcdir)/m4/locale-zh.m4 \ $(top_srcdir)/m4/locale_h.m4 $(top_srcdir)/m4/localeconv.m4 \ $(top_srcdir)/m4/localename.m4 $(top_srcdir)/m4/lock.m4 \ $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/lstat.m4 \ $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/malloca.m4 \ $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/mbchar.m4 \ $(top_srcdir)/m4/mbiter.m4 $(top_srcdir)/m4/mbrlen.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \ $(top_srcdir)/m4/mbslen.m4 $(top_srcdir)/m4/mbsrtowcs.m4 \ $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbtowc.m4 \ $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/minmax.m4 \ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/musl.m4 $(top_srcdir)/m4/nanosleep.m4 \ $(top_srcdir)/m4/netinet_in_h.m4 \ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/obstack.m4 \ $(top_srcdir)/m4/off_t.m4 $(top_srcdir)/m4/open-cloexec.m4 \ $(top_srcdir)/m4/open-slash.m4 $(top_srcdir)/m4/open.m4 \ $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/opendir.m4 \ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/pcre.m4 \ $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/perror.m4 \ $(top_srcdir)/m4/pipe.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/pthread-thread.m4 \ $(top_srcdir)/m4/pthread_h.m4 \ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \ $(top_srcdir)/m4/pthread_sigmask.m4 $(top_srcdir)/m4/putenv.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/rawmemchr.m4 \ $(top_srcdir)/m4/read.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/reallocarray.m4 \ $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/safe-read.m4 \ $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/sched_h.m4 \ $(top_srcdir)/m4/select.m4 $(top_srcdir)/m4/setenv.m4 \ $(top_srcdir)/m4/setlocale.m4 \ $(top_srcdir)/m4/setlocale_null.m4 \ $(top_srcdir)/m4/sigaction.m4 $(top_srcdir)/m4/sigaltstack.m4 \ $(top_srcdir)/m4/signal_h.m4 \ $(top_srcdir)/m4/signalblocking.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/sleep.m4 \ $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/socketlib.m4 \ $(top_srcdir)/m4/sockets.m4 $(top_srcdir)/m4/socklen.m4 \ $(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stack-direction.m4 \ $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \ $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdarg.m4 \ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/stpcpy.m4 $(top_srcdir)/m4/strdup.m4 \ $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/strerror_r.m4 \ $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strnlen.m4 \ $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtoimax.m4 \ $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoull.m4 \ $(top_srcdir)/m4/strtoumax.m4 $(top_srcdir)/m4/symlink.m4 \ $(top_srcdir)/m4/sys_ioctl_h.m4 \ $(top_srcdir)/m4/sys_select_h.m4 \ $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/sys_uio_h.m4 \ $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/unistd-safer.m4 \ $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/version-etc.m4 \ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/warn-on-use.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_h.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcrtomb.m4 \ $(top_srcdir)/m4/wctob.m4 $(top_srcdir)/m4/wctomb.m4 \ $(top_srcdir)/m4/wctype_h.m4 $(top_srcdir)/m4/wcwidth.m4 \ $(top_srcdir)/m4/windows-stat-inodes.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/wmemchr.m4 \ $(top_srcdir)/m4/wmempcpy.m4 $(top_srcdir)/m4/xalloc.m4 \ $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrtol.m4 \ $(top_srcdir)/m4/year2038.m4 $(top_srcdir)/m4/zzgnulib.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) LIBRARIES = $(noinst_LIBRARIES) AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libtests_a_AR = $(AR) $(ARFLAGS) am__DEPENDENCIES_1 = am__dirstamp = $(am__leading_dot)dirstamp am_libtests_a_OBJECTS = hash-pjw.$(OBJEXT) imaxtostr.$(OBJEXT) \ inttostr.$(OBJEXT) offtostr.$(OBJEXT) uinttostr.$(OBJEXT) \ umaxtostr.$(OBJEXT) localename.$(OBJEXT) \ localename-table.$(OBJEXT) sig-handler.$(OBJEXT) \ sockets.$(OBJEXT) sys_socket.$(OBJEXT) \ glthread/thread.$(OBJEXT) xsize.$(OBJEXT) \ xstrtol-error.$(OBJEXT) libtests_a_OBJECTS = $(am_libtests_a_OBJECTS) am_current_locale_OBJECTS = locale.$(OBJEXT) current_locale_OBJECTS = $(am_current_locale_OBJECTS) current_locale_LDADD = $(LDADD) current_locale_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_accept_SOURCES = test-accept.c test_accept_OBJECTS = test-accept.$(OBJEXT) am__DEPENDENCIES_2 = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_accept_DEPENDENCIES = $(am__DEPENDENCIES_2) test_alignof_SOURCES = test-alignof.c test_alignof_OBJECTS = test-alignof.$(OBJEXT) test_alignof_LDADD = $(LDADD) test_alignof_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_alloca_opt_SOURCES = test-alloca-opt.c test_alloca_opt_OBJECTS = test-alloca-opt.$(OBJEXT) test_alloca_opt_LDADD = $(LDADD) test_alloca_opt_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_argmatch_SOURCES = test-argmatch.c test_argmatch_OBJECTS = test-argmatch.$(OBJEXT) test_argmatch_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_arpa_inet_SOURCES = test-arpa_inet.c test_arpa_inet_OBJECTS = test-arpa_inet.$(OBJEXT) test_arpa_inet_LDADD = $(LDADD) test_arpa_inet_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_binary_io_SOURCES = test-binary-io.c test_binary_io_OBJECTS = test-binary-io.$(OBJEXT) test_binary_io_LDADD = $(LDADD) test_binary_io_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_bind_SOURCES = test-bind.c test_bind_OBJECTS = test-bind.$(OBJEXT) test_bind_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) test_bitrotate_SOURCES = test-bitrotate.c test_bitrotate_OBJECTS = test-bitrotate.$(OBJEXT) test_bitrotate_LDADD = $(LDADD) test_bitrotate_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_btowc_SOURCES = test-btowc.c test_btowc_OBJECTS = test-btowc.$(OBJEXT) test_btowc_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) test_c_ctype_SOURCES = test-c-ctype.c test_c_ctype_OBJECTS = test-c-ctype.$(OBJEXT) test_c_ctype_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_c_stack_SOURCES = test-c-stack.c test_c_stack_OBJECTS = test-c-stack.$(OBJEXT) test_c_stack_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_c_strcasecmp_SOURCES = test-c-strcasecmp.c test_c_strcasecmp_OBJECTS = test-c-strcasecmp.$(OBJEXT) test_c_strcasecmp_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_c_strncasecmp_SOURCES = test-c-strncasecmp.c test_c_strncasecmp_OBJECTS = test-c-strncasecmp.$(OBJEXT) test_c_strncasecmp_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_calloc_gnu_SOURCES = test-calloc-gnu.c test_calloc_gnu_OBJECTS = test-calloc-gnu.$(OBJEXT) test_calloc_gnu_LDADD = $(LDADD) test_calloc_gnu_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_chdir_SOURCES = test-chdir.c test_chdir_OBJECTS = test-chdir.$(OBJEXT) test_chdir_LDADD = $(LDADD) test_chdir_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_cloexec_SOURCES = test-cloexec.c test_cloexec_OBJECTS = test-cloexec.$(OBJEXT) test_cloexec_LDADD = $(LDADD) test_cloexec_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_close_SOURCES = test-close.c test_close_OBJECTS = test-close.$(OBJEXT) test_close_LDADD = $(LDADD) test_close_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_connect_SOURCES = test-connect.c test_connect_OBJECTS = test-connect.$(OBJEXT) test_connect_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_ctype_SOURCES = test-ctype.c test_ctype_OBJECTS = test-ctype.$(OBJEXT) test_ctype_LDADD = $(LDADD) test_ctype_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_dfa_match_aux_SOURCES = test-dfa-match-aux.c test_dfa_match_aux_OBJECTS = test-dfa-match-aux.$(OBJEXT) test_dfa_match_aux_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_dirent_SOURCES = test-dirent.c test_dirent_OBJECTS = test-dirent.$(OBJEXT) test_dirent_LDADD = $(LDADD) test_dirent_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_dup_SOURCES = test-dup.c test_dup_OBJECTS = test-dup.$(OBJEXT) test_dup_LDADD = $(LDADD) test_dup_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_dup_safer_SOURCES = test-dup-safer.c test_dup_safer_OBJECTS = test-dup-safer.$(OBJEXT) test_dup_safer_LDADD = $(LDADD) test_dup_safer_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_dup2_SOURCES = test-dup2.c test_dup2_OBJECTS = test-dup2.$(OBJEXT) test_dup2_LDADD = $(LDADD) test_dup2_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_dynarray_SOURCES = test-dynarray.c test_dynarray_OBJECTS = test-dynarray.$(OBJEXT) test_dynarray_LDADD = $(LDADD) test_dynarray_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_environ_SOURCES = test-environ.c test_environ_OBJECTS = test-environ.$(OBJEXT) test_environ_LDADD = $(LDADD) test_environ_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_errno_SOURCES = test-errno.c test_errno_OBJECTS = test-errno.$(OBJEXT) test_errno_LDADD = $(LDADD) test_errno_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_exclude_SOURCES = test-exclude.c test_exclude_OBJECTS = test-exclude.$(OBJEXT) test_exclude_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_fchdir_SOURCES = test-fchdir.c test_fchdir_OBJECTS = test-fchdir.$(OBJEXT) test_fchdir_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) test_fcntl_SOURCES = test-fcntl.c test_fcntl_OBJECTS = test-fcntl.$(OBJEXT) test_fcntl_LDADD = $(LDADD) test_fcntl_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_fcntl_h_SOURCES = test-fcntl-h.c test_fcntl_h_OBJECTS = test-fcntl-h.$(OBJEXT) test_fcntl_h_LDADD = $(LDADD) test_fcntl_h_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_fcntl_safer_SOURCES = test-fcntl-safer.c test_fcntl_safer_OBJECTS = test-fcntl-safer.$(OBJEXT) test_fcntl_safer_LDADD = $(LDADD) test_fcntl_safer_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_fdopen_SOURCES = test-fdopen.c test_fdopen_OBJECTS = test-fdopen.$(OBJEXT) test_fdopen_LDADD = $(LDADD) test_fdopen_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_fdopendir_SOURCES = test-fdopendir.c test_fdopendir_OBJECTS = test-fdopendir.$(OBJEXT) test_fdopendir_DEPENDENCIES = $(am__DEPENDENCIES_2) test_fgetc_SOURCES = test-fgetc.c test_fgetc_OBJECTS = test-fgetc.$(OBJEXT) test_fgetc_LDADD = $(LDADD) test_fgetc_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_float_SOURCES = test-float.c test_float_OBJECTS = test-float.$(OBJEXT) test_float_LDADD = $(LDADD) test_float_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_fnmatch_SOURCES = test-fnmatch.c test_fnmatch_OBJECTS = test-fnmatch.$(OBJEXT) test_fnmatch_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_fnmatch_h_SOURCES = test-fnmatch-h.c test_fnmatch_h_OBJECTS = test-fnmatch-h.$(OBJEXT) test_fnmatch_h_LDADD = $(LDADD) test_fnmatch_h_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_fopen_SOURCES = test-fopen.c test_fopen_OBJECTS = test-fopen.$(OBJEXT) test_fopen_LDADD = $(LDADD) test_fopen_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_fopen_gnu_SOURCES = test-fopen-gnu.c test_fopen_gnu_OBJECTS = test-fopen-gnu.$(OBJEXT) test_fopen_gnu_LDADD = $(LDADD) test_fopen_gnu_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_fpending_SOURCES = test-fpending.c test_fpending_OBJECTS = test-fpending.$(OBJEXT) test_fpending_LDADD = $(LDADD) test_fpending_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_fputc_SOURCES = test-fputc.c test_fputc_OBJECTS = test-fputc.$(OBJEXT) test_fputc_LDADD = $(LDADD) test_fputc_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_fread_SOURCES = test-fread.c test_fread_OBJECTS = test-fread.$(OBJEXT) test_fread_LDADD = $(LDADD) test_fread_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_free_SOURCES = test-free.c test_free_OBJECTS = test-free.$(OBJEXT) test_free_LDADD = $(LDADD) test_free_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_fstat_SOURCES = test-fstat.c test_fstat_OBJECTS = test-fstat.$(OBJEXT) test_fstat_LDADD = $(LDADD) test_fstat_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_fstatat_SOURCES = test-fstatat.c test_fstatat_OBJECTS = test-fstatat.$(OBJEXT) test_fstatat_DEPENDENCIES = $(am__DEPENDENCIES_2) test_ftruncate_SOURCES = test-ftruncate.c test_ftruncate_OBJECTS = test-ftruncate.$(OBJEXT) test_ftruncate_LDADD = $(LDADD) test_ftruncate_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_fwrite_SOURCES = test-fwrite.c test_fwrite_OBJECTS = test-fwrite.$(OBJEXT) test_fwrite_LDADD = $(LDADD) test_fwrite_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_getcwd_lgpl_SOURCES = test-getcwd-lgpl.c test_getcwd_lgpl_OBJECTS = test-getcwd-lgpl.$(OBJEXT) test_getcwd_lgpl_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_getdtablesize_SOURCES = test-getdtablesize.c test_getdtablesize_OBJECTS = test-getdtablesize.$(OBJEXT) test_getdtablesize_LDADD = $(LDADD) test_getdtablesize_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_getopt_gnu_SOURCES = test-getopt-gnu.c test_getopt_gnu_OBJECTS = test-getopt-gnu.$(OBJEXT) test_getopt_gnu_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_getopt_posix_SOURCES = test-getopt-posix.c test_getopt_posix_OBJECTS = test-getopt-posix.$(OBJEXT) test_getopt_posix_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_getprogname_SOURCES = test-getprogname.c test_getprogname_OBJECTS = test-getprogname.$(OBJEXT) test_getprogname_DEPENDENCIES = $(am__DEPENDENCIES_2) test_gettimeofday_SOURCES = test-gettimeofday.c test_gettimeofday_OBJECTS = test-gettimeofday.$(OBJEXT) test_gettimeofday_LDADD = $(LDADD) test_gettimeofday_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_hard_locale_SOURCES = test-hard-locale.c test_hard_locale_OBJECTS = test-hard-locale.$(OBJEXT) test_hard_locale_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_hash_SOURCES = test-hash.c test_hash_OBJECTS = test-hash.$(OBJEXT) test_hash_LDADD = $(LDADD) test_hash_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_i_ring_SOURCES = test-i-ring.c test_i_ring_OBJECTS = test-i-ring.$(OBJEXT) test_i_ring_LDADD = $(LDADD) test_i_ring_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_iconv_SOURCES = test-iconv.c test_iconv_OBJECTS = test-iconv.$(OBJEXT) test_iconv_DEPENDENCIES = $(am__DEPENDENCIES_2) test_iconv_h_SOURCES = test-iconv-h.c test_iconv_h_OBJECTS = test-iconv-h.$(OBJEXT) test_iconv_h_LDADD = $(LDADD) test_iconv_h_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_ignore_value_SOURCES = test-ignore-value.c test_ignore_value_OBJECTS = test-ignore-value.$(OBJEXT) test_ignore_value_LDADD = $(LDADD) test_ignore_value_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_inet_pton_SOURCES = test-inet_pton.c test_inet_pton_OBJECTS = test-inet_pton.$(OBJEXT) test_inet_pton_DEPENDENCIES = $(am__DEPENDENCIES_2) test_intprops_SOURCES = test-intprops.c test_intprops_OBJECTS = test-intprops.$(OBJEXT) test_intprops_LDADD = $(LDADD) test_intprops_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_inttostr_SOURCES = test-inttostr.c test_inttostr_OBJECTS = test-inttostr.$(OBJEXT) test_inttostr_LDADD = $(LDADD) test_inttostr_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_inttypes_SOURCES = test-inttypes.c test_inttypes_OBJECTS = test-inttypes.$(OBJEXT) test_inttypes_LDADD = $(LDADD) test_inttypes_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_ioctl_SOURCES = test-ioctl.c test_ioctl_OBJECTS = test-ioctl.$(OBJEXT) test_ioctl_LDADD = $(LDADD) test_ioctl_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_isatty_SOURCES = test-isatty.c test_isatty_OBJECTS = test-isatty.$(OBJEXT) test_isatty_LDADD = $(LDADD) test_isatty_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_isblank_SOURCES = test-isblank.c test_isblank_OBJECTS = test-isblank.$(OBJEXT) test_isblank_LDADD = $(LDADD) test_isblank_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_iswblank_SOURCES = test-iswblank.c test_iswblank_OBJECTS = test-iswblank.$(OBJEXT) test_iswblank_LDADD = $(LDADD) test_iswblank_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_iswdigit_SOURCES = test-iswdigit.c test_iswdigit_OBJECTS = test-iswdigit.$(OBJEXT) test_iswdigit_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_iswxdigit_SOURCES = test-iswxdigit.c test_iswxdigit_OBJECTS = test-iswxdigit.$(OBJEXT) test_iswxdigit_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_langinfo_SOURCES = test-langinfo.c test_langinfo_OBJECTS = test-langinfo.$(OBJEXT) test_langinfo_LDADD = $(LDADD) test_langinfo_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_limits_h_SOURCES = test-limits-h.c test_limits_h_OBJECTS = test-limits-h.$(OBJEXT) test_limits_h_LDADD = $(LDADD) test_limits_h_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_listen_SOURCES = test-listen.c test_listen_OBJECTS = test-listen.$(OBJEXT) test_listen_DEPENDENCIES = $(am__DEPENDENCIES_2) test_localcharset_SOURCES = test-localcharset.c test_localcharset_OBJECTS = test-localcharset.$(OBJEXT) test_localcharset_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_locale_SOURCES = test-locale.c test_locale_OBJECTS = test-locale.$(OBJEXT) test_locale_LDADD = $(LDADD) test_locale_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_localeconv_SOURCES = test-localeconv.c test_localeconv_OBJECTS = test-localeconv.$(OBJEXT) test_localeconv_LDADD = $(LDADD) test_localeconv_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_localename_SOURCES = test-localename.c test_localename_OBJECTS = test-localename.$(OBJEXT) test_localename_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_lseek_SOURCES = test-lseek.c test_lseek_OBJECTS = test-lseek.$(OBJEXT) test_lseek_LDADD = $(LDADD) test_lseek_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_lstat_SOURCES = test-lstat.c test_lstat_OBJECTS = test-lstat.$(OBJEXT) test_lstat_LDADD = $(LDADD) test_lstat_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_malloc_gnu_SOURCES = test-malloc-gnu.c test_malloc_gnu_OBJECTS = test-malloc-gnu.$(OBJEXT) test_malloc_gnu_LDADD = $(LDADD) test_malloc_gnu_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_malloca_SOURCES = test-malloca.c test_malloca_OBJECTS = test-malloca.$(OBJEXT) test_malloca_LDADD = $(LDADD) test_malloca_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_mbscasecmp_SOURCES = test-mbscasecmp.c test_mbscasecmp_OBJECTS = test-mbscasecmp.$(OBJEXT) test_mbscasecmp_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_mbsinit_SOURCES = test-mbsinit.c test_mbsinit_OBJECTS = test-mbsinit.$(OBJEXT) test_mbsinit_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_mbsrtowcs_SOURCES = test-mbsrtowcs.c test_mbsrtowcs_OBJECTS = test-mbsrtowcs.$(OBJEXT) test_mbsrtowcs_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_mbsstr1_SOURCES = test-mbsstr1.c test_mbsstr1_OBJECTS = test-mbsstr1.$(OBJEXT) test_mbsstr1_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_mbsstr2_SOURCES = test-mbsstr2.c test_mbsstr2_OBJECTS = test-mbsstr2.$(OBJEXT) test_mbsstr2_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_mbsstr3_SOURCES = test-mbsstr3.c test_mbsstr3_OBJECTS = test-mbsstr3.$(OBJEXT) test_mbsstr3_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_memchr_SOURCES = test-memchr.c test_memchr_OBJECTS = test-memchr.$(OBJEXT) test_memchr_LDADD = $(LDADD) test_memchr_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_memchr2_SOURCES = test-memchr2.c test_memchr2_OBJECTS = test-memchr2.$(OBJEXT) test_memchr2_LDADD = $(LDADD) test_memchr2_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_memrchr_SOURCES = test-memrchr.c test_memrchr_OBJECTS = test-memrchr.$(OBJEXT) test_memrchr_LDADD = $(LDADD) test_memrchr_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_nanosleep_SOURCES = test-nanosleep.c test_nanosleep_OBJECTS = test-nanosleep.$(OBJEXT) test_nanosleep_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_netinet_in_SOURCES = test-netinet_in.c test_netinet_in_OBJECTS = test-netinet_in.$(OBJEXT) test_netinet_in_LDADD = $(LDADD) test_netinet_in_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_nl_langinfo_SOURCES = test-nl_langinfo.c test_nl_langinfo_OBJECTS = test-nl_langinfo.$(OBJEXT) test_nl_langinfo_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_nl_langinfo_mt_SOURCES = test-nl_langinfo-mt.c test_nl_langinfo_mt_OBJECTS = test-nl_langinfo-mt.$(OBJEXT) test_nl_langinfo_mt_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) test_open_SOURCES = test-open.c test_open_OBJECTS = test-open.$(OBJEXT) test_open_LDADD = $(LDADD) test_open_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_openat_SOURCES = test-openat.c test_openat_OBJECTS = test-openat.$(OBJEXT) test_openat_DEPENDENCIES = $(am__DEPENDENCIES_2) test_openat_safer_SOURCES = test-openat-safer.c test_openat_safer_OBJECTS = test-openat-safer.$(OBJEXT) test_openat_safer_DEPENDENCIES = $(am__DEPENDENCIES_2) test_pathmax_SOURCES = test-pathmax.c test_pathmax_OBJECTS = test-pathmax.$(OBJEXT) test_pathmax_LDADD = $(LDADD) test_pathmax_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_perror_SOURCES = test-perror.c test_perror_OBJECTS = test-perror.$(OBJEXT) test_perror_LDADD = $(LDADD) test_perror_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_perror2_SOURCES = test-perror2.c test_perror2_OBJECTS = test-perror2.$(OBJEXT) test_perror2_LDADD = $(LDADD) test_perror2_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_pipe_SOURCES = test-pipe.c test_pipe_OBJECTS = test-pipe.$(OBJEXT) test_pipe_LDADD = $(LDADD) test_pipe_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_pthread_SOURCES = test-pthread.c test_pthread_OBJECTS = test-pthread.$(OBJEXT) test_pthread_LDADD = $(LDADD) test_pthread_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_pthread_thread_SOURCES = test-pthread-thread.c test_pthread_thread_OBJECTS = test-pthread-thread.$(OBJEXT) test_pthread_thread_DEPENDENCIES = $(am__DEPENDENCIES_2) test_pthread_sigmask1_SOURCES = test-pthread_sigmask1.c test_pthread_sigmask1_OBJECTS = test-pthread_sigmask1.$(OBJEXT) test_pthread_sigmask1_DEPENDENCIES = $(am__DEPENDENCIES_2) test_pthread_sigmask2_SOURCES = test-pthread_sigmask2.c test_pthread_sigmask2_OBJECTS = test-pthread_sigmask2.$(OBJEXT) test_pthread_sigmask2_DEPENDENCIES = $(am__DEPENDENCIES_2) test_quotearg_simple_SOURCES = test-quotearg-simple.c test_quotearg_simple_OBJECTS = test-quotearg-simple.$(OBJEXT) test_quotearg_simple_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_raise_SOURCES = test-raise.c test_raise_OBJECTS = test-raise.$(OBJEXT) test_raise_LDADD = $(LDADD) test_raise_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_rawmemchr_SOURCES = test-rawmemchr.c test_rawmemchr_OBJECTS = test-rawmemchr.$(OBJEXT) test_rawmemchr_LDADD = $(LDADD) test_rawmemchr_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_read_SOURCES = test-read.c test_read_OBJECTS = test-read.$(OBJEXT) test_read_LDADD = $(LDADD) test_read_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_realloc_gnu_SOURCES = test-realloc-gnu.c test_realloc_gnu_OBJECTS = test-realloc-gnu.$(OBJEXT) test_realloc_gnu_LDADD = $(LDADD) test_realloc_gnu_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_reallocarray_SOURCES = test-reallocarray.c test_reallocarray_OBJECTS = test-reallocarray.$(OBJEXT) test_reallocarray_LDADD = $(LDADD) test_reallocarray_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_regex_SOURCES = test-regex.c test_regex_OBJECTS = test-regex.$(OBJEXT) test_regex_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_sched_SOURCES = test-sched.c test_sched_OBJECTS = test-sched.$(OBJEXT) test_sched_LDADD = $(LDADD) test_sched_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_select_SOURCES = test-select.c test_select_OBJECTS = test-select.$(OBJEXT) test_select_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) test_select_fd_SOURCES = test-select-fd.c test_select_fd_OBJECTS = test-select-fd.$(OBJEXT) test_select_fd_DEPENDENCIES = $(am__DEPENDENCIES_2) test_select_stdin_SOURCES = test-select-stdin.c test_select_stdin_OBJECTS = test-select-stdin.$(OBJEXT) test_select_stdin_DEPENDENCIES = $(am__DEPENDENCIES_2) test_setenv_SOURCES = test-setenv.c test_setenv_OBJECTS = test-setenv.$(OBJEXT) test_setenv_LDADD = $(LDADD) test_setenv_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_setlocale1_SOURCES = test-setlocale1.c test_setlocale1_OBJECTS = test-setlocale1.$(OBJEXT) test_setlocale1_DEPENDENCIES = $(am__DEPENDENCIES_2) test_setlocale2_SOURCES = test-setlocale2.c test_setlocale2_OBJECTS = test-setlocale2.$(OBJEXT) test_setlocale2_DEPENDENCIES = $(am__DEPENDENCIES_2) test_setlocale_null_SOURCES = test-setlocale_null.c test_setlocale_null_OBJECTS = test-setlocale_null.$(OBJEXT) test_setlocale_null_DEPENDENCIES = $(am__DEPENDENCIES_2) test_setlocale_null_mt_all_SOURCES = test-setlocale_null-mt-all.c test_setlocale_null_mt_all_OBJECTS = \ test-setlocale_null-mt-all.$(OBJEXT) test_setlocale_null_mt_all_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_setlocale_null_mt_one_SOURCES = test-setlocale_null-mt-one.c test_setlocale_null_mt_one_OBJECTS = \ test-setlocale_null-mt-one.$(OBJEXT) test_setlocale_null_mt_one_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_setsockopt_SOURCES = test-setsockopt.c test_setsockopt_OBJECTS = test-setsockopt.$(OBJEXT) test_setsockopt_DEPENDENCIES = $(am__DEPENDENCIES_2) test_sigaction_SOURCES = test-sigaction.c test_sigaction_OBJECTS = test-sigaction.$(OBJEXT) test_sigaction_LDADD = $(LDADD) test_sigaction_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_signal_h_SOURCES = test-signal-h.c test_signal_h_OBJECTS = test-signal-h.$(OBJEXT) test_signal_h_LDADD = $(LDADD) test_signal_h_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_sigprocmask_SOURCES = test-sigprocmask.c test_sigprocmask_OBJECTS = test-sigprocmask.$(OBJEXT) test_sigprocmask_LDADD = $(LDADD) test_sigprocmask_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_sigsegv_catch_segv1_SOURCES = test-sigsegv-catch-segv1.c test_sigsegv_catch_segv1_OBJECTS = test-sigsegv-catch-segv1.$(OBJEXT) test_sigsegv_catch_segv1_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_sigsegv_catch_segv2_SOURCES = test-sigsegv-catch-segv2.c test_sigsegv_catch_segv2_OBJECTS = test-sigsegv-catch-segv2.$(OBJEXT) test_sigsegv_catch_segv2_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_sigsegv_catch_stackoverflow1_SOURCES = \ test-sigsegv-catch-stackoverflow1.c test_sigsegv_catch_stackoverflow1_OBJECTS = \ test-sigsegv-catch-stackoverflow1.$(OBJEXT) test_sigsegv_catch_stackoverflow1_DEPENDENCIES = \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) test_sigsegv_catch_stackoverflow2_SOURCES = \ test-sigsegv-catch-stackoverflow2.c test_sigsegv_catch_stackoverflow2_OBJECTS = \ test-sigsegv-catch-stackoverflow2.$(OBJEXT) test_sigsegv_catch_stackoverflow2_DEPENDENCIES = \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) test_sleep_SOURCES = test-sleep.c test_sleep_OBJECTS = test-sleep.$(OBJEXT) test_sleep_LDADD = $(LDADD) test_sleep_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_snprintf_SOURCES = test-snprintf.c test_snprintf_OBJECTS = test-snprintf.$(OBJEXT) test_snprintf_LDADD = $(LDADD) test_snprintf_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_sockets_SOURCES = test-sockets.c test_sockets_OBJECTS = test-sockets.$(OBJEXT) test_sockets_DEPENDENCIES = $(am__DEPENDENCIES_2) test_stat_SOURCES = test-stat.c test_stat_OBJECTS = test-stat.$(OBJEXT) test_stat_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) test_stat_time_SOURCES = test-stat-time.c test_stat_time_OBJECTS = test-stat-time.$(OBJEXT) test_stat_time_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_stdalign_SOURCES = test-stdalign.c test_stdalign_OBJECTS = test-stdalign.$(OBJEXT) test_stdalign_LDADD = $(LDADD) test_stdalign_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_stdbool_SOURCES = test-stdbool.c test_stdbool_OBJECTS = test-stdbool.$(OBJEXT) test_stdbool_LDADD = $(LDADD) test_stdbool_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_stddef_SOURCES = test-stddef.c test_stddef_OBJECTS = test-stddef.$(OBJEXT) test_stddef_LDADD = $(LDADD) test_stddef_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_stdint_SOURCES = test-stdint.c test_stdint_OBJECTS = test-stdint.$(OBJEXT) test_stdint_LDADD = $(LDADD) test_stdint_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_stdio_SOURCES = test-stdio.c test_stdio_OBJECTS = test-stdio.$(OBJEXT) test_stdio_LDADD = $(LDADD) test_stdio_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_stdlib_SOURCES = test-stdlib.c test_stdlib_OBJECTS = test-stdlib.$(OBJEXT) test_stdlib_LDADD = $(LDADD) test_stdlib_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_strerror_SOURCES = test-strerror.c test_strerror_OBJECTS = test-strerror.$(OBJEXT) test_strerror_LDADD = $(LDADD) test_strerror_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_strerror_r_SOURCES = test-strerror_r.c test_strerror_r_OBJECTS = test-strerror_r.$(OBJEXT) test_strerror_r_LDADD = $(LDADD) test_strerror_r_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_striconv_SOURCES = test-striconv.c test_striconv_OBJECTS = test-striconv.$(OBJEXT) test_striconv_DEPENDENCIES = $(am__DEPENDENCIES_2) test_string_SOURCES = test-string.c test_string_OBJECTS = test-string.$(OBJEXT) test_string_LDADD = $(LDADD) test_string_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_strnlen_SOURCES = test-strnlen.c test_strnlen_OBJECTS = test-strnlen.$(OBJEXT) test_strnlen_LDADD = $(LDADD) test_strnlen_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_strstr_SOURCES = test-strstr.c test_strstr_OBJECTS = test-strstr.$(OBJEXT) test_strstr_LDADD = $(LDADD) test_strstr_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_strtoimax_SOURCES = test-strtoimax.c test_strtoimax_OBJECTS = test-strtoimax.$(OBJEXT) test_strtoimax_LDADD = $(LDADD) test_strtoimax_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_strtoll_SOURCES = test-strtoll.c test_strtoll_OBJECTS = test-strtoll.$(OBJEXT) test_strtoll_LDADD = $(LDADD) test_strtoll_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_strtoull_SOURCES = test-strtoull.c test_strtoull_OBJECTS = test-strtoull.$(OBJEXT) test_strtoull_LDADD = $(LDADD) test_strtoull_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_strtoumax_SOURCES = test-strtoumax.c test_strtoumax_OBJECTS = test-strtoumax.$(OBJEXT) test_strtoumax_LDADD = $(LDADD) test_strtoumax_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_symlink_SOURCES = test-symlink.c test_symlink_OBJECTS = test-symlink.$(OBJEXT) test_symlink_LDADD = $(LDADD) test_symlink_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_sys_ioctl_SOURCES = test-sys_ioctl.c test_sys_ioctl_OBJECTS = test-sys_ioctl.$(OBJEXT) test_sys_ioctl_LDADD = $(LDADD) test_sys_ioctl_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_sys_select_SOURCES = test-sys_select.c test_sys_select_OBJECTS = test-sys_select.$(OBJEXT) test_sys_select_LDADD = $(LDADD) test_sys_select_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_sys_socket_SOURCES = test-sys_socket.c test_sys_socket_OBJECTS = test-sys_socket.$(OBJEXT) test_sys_socket_LDADD = $(LDADD) test_sys_socket_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_sys_stat_SOURCES = test-sys_stat.c test_sys_stat_OBJECTS = test-sys_stat.$(OBJEXT) test_sys_stat_LDADD = $(LDADD) test_sys_stat_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_sys_time_SOURCES = test-sys_time.c test_sys_time_OBJECTS = test-sys_time.$(OBJEXT) test_sys_time_LDADD = $(LDADD) test_sys_time_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_sys_types_SOURCES = test-sys_types.c test_sys_types_OBJECTS = test-sys_types.$(OBJEXT) test_sys_types_LDADD = $(LDADD) test_sys_types_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_sys_uio_SOURCES = test-sys_uio.c test_sys_uio_OBJECTS = test-sys_uio.$(OBJEXT) test_sys_uio_LDADD = $(LDADD) test_sys_uio_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_thread_create_SOURCES = test-thread_create.c test_thread_create_OBJECTS = test-thread_create.$(OBJEXT) test_thread_create_DEPENDENCIES = $(am__DEPENDENCIES_2) test_thread_self_SOURCES = test-thread_self.c test_thread_self_OBJECTS = test-thread_self.$(OBJEXT) test_thread_self_DEPENDENCIES = $(am__DEPENDENCIES_2) test_time_SOURCES = test-time.c test_time_OBJECTS = test-time.$(OBJEXT) test_time_LDADD = $(LDADD) test_time_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) am_test_u8_mbtoucr_OBJECTS = unistr/test-u8-mbtoucr.$(OBJEXT) test_u8_mbtoucr_OBJECTS = $(am_test_u8_mbtoucr_OBJECTS) test_u8_mbtoucr_DEPENDENCIES = $(am__DEPENDENCIES_2) am_test_u8_uctomb_OBJECTS = unistr/test-u8-uctomb.$(OBJEXT) test_u8_uctomb_OBJECTS = $(am_test_u8_uctomb_OBJECTS) test_u8_uctomb_DEPENDENCIES = $(am__DEPENDENCIES_2) am_test_uc_width_OBJECTS = uniwidth/test-uc_width.$(OBJEXT) test_uc_width_OBJECTS = $(am_test_uc_width_OBJECTS) test_uc_width_DEPENDENCIES = $(am__DEPENDENCIES_2) am_test_uc_width2_OBJECTS = uniwidth/test-uc_width2.$(OBJEXT) test_uc_width2_OBJECTS = $(am_test_uc_width2_OBJECTS) test_uc_width2_DEPENDENCIES = $(am__DEPENDENCIES_2) test_unistd_SOURCES = test-unistd.c test_unistd_OBJECTS = test-unistd.$(OBJEXT) test_unistd_LDADD = $(LDADD) test_unistd_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_unsetenv_SOURCES = test-unsetenv.c test_unsetenv_OBJECTS = test-unsetenv.$(OBJEXT) test_unsetenv_LDADD = $(LDADD) test_unsetenv_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_vasnprintf_SOURCES = test-vasnprintf.c test_vasnprintf_OBJECTS = test-vasnprintf.$(OBJEXT) test_vasnprintf_LDADD = $(LDADD) test_vasnprintf_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_verify_SOURCES = test-verify.c test_verify_OBJECTS = test-verify.$(OBJEXT) test_verify_LDADD = $(LDADD) test_verify_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_verify_try_SOURCES = test-verify-try.c test_verify_try_OBJECTS = test-verify-try.$(OBJEXT) test_verify_try_LDADD = $(LDADD) test_verify_try_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_version_etc_SOURCES = test-version-etc.c test_version_etc_OBJECTS = test-version-etc.$(OBJEXT) test_version_etc_DEPENDENCIES = $(am__DEPENDENCIES_2) test_wchar_SOURCES = test-wchar.c test_wchar_OBJECTS = test-wchar.$(OBJEXT) test_wchar_LDADD = $(LDADD) test_wchar_DEPENDENCIES = libtests.a ../lib/libgreputils.a libtests.a \ ../lib/libgreputils.a libtests.a $(am__DEPENDENCIES_1) test_wcrtomb_SOURCES = test-wcrtomb.c test_wcrtomb_OBJECTS = test-wcrtomb.$(OBJEXT) test_wcrtomb_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_wcrtomb_w32_SOURCES = test-wcrtomb-w32.c test_wcrtomb_w32_OBJECTS = test-wcrtomb-w32.$(OBJEXT) test_wcrtomb_w32_LDADD = $(LDADD) test_wcrtomb_w32_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_wctype_h_SOURCES = test-wctype-h.c test_wctype_h_OBJECTS = test-wctype-h.$(OBJEXT) test_wctype_h_LDADD = $(LDADD) test_wctype_h_DEPENDENCIES = libtests.a ../lib/libgreputils.a \ libtests.a ../lib/libgreputils.a libtests.a \ $(am__DEPENDENCIES_1) test_wcwidth_SOURCES = test-wcwidth.c test_wcwidth_OBJECTS = test-wcwidth.$(OBJEXT) test_wcwidth_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) test_xalloc_die_SOURCES = test-xalloc-die.c test_xalloc_die_OBJECTS = test-xalloc-die.$(OBJEXT) test_xalloc_die_DEPENDENCIES = $(am__DEPENDENCIES_2) test_xstrtoimax_SOURCES = test-xstrtoimax.c test_xstrtoimax_OBJECTS = test-xstrtoimax.$(OBJEXT) test_xstrtoimax_DEPENDENCIES = $(am__DEPENDENCIES_2) test_xstrtol_SOURCES = test-xstrtol.c test_xstrtol_OBJECTS = test-xstrtol.$(OBJEXT) test_xstrtol_DEPENDENCIES = $(am__DEPENDENCIES_2) test_xstrtoul_SOURCES = test-xstrtoul.c test_xstrtoul_OBJECTS = test-xstrtoul.$(OBJEXT) test_xstrtoul_DEPENDENCIES = $(am__DEPENDENCIES_2) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/accept.Po ./$(DEPDIR)/anytostr.Po \ ./$(DEPDIR)/asnprintf.Po ./$(DEPDIR)/bind.Po \ ./$(DEPDIR)/connect.Po ./$(DEPDIR)/fdopen.Po \ ./$(DEPDIR)/float.Po ./$(DEPDIR)/ftruncate.Po \ ./$(DEPDIR)/gettimeofday.Po ./$(DEPDIR)/hash-pjw.Po \ ./$(DEPDIR)/imaxtostr.Po ./$(DEPDIR)/inet_pton.Po \ ./$(DEPDIR)/inttostr.Po ./$(DEPDIR)/ioctl.Po \ ./$(DEPDIR)/itold.Po ./$(DEPDIR)/listen.Po \ ./$(DEPDIR)/locale.Po ./$(DEPDIR)/localename-table.Po \ ./$(DEPDIR)/localename.Po ./$(DEPDIR)/nanosleep.Po \ ./$(DEPDIR)/offtostr.Po ./$(DEPDIR)/perror.Po \ ./$(DEPDIR)/printf-args.Po ./$(DEPDIR)/printf-parse.Po \ ./$(DEPDIR)/pthread-thread.Po ./$(DEPDIR)/pthread_sigmask.Po \ ./$(DEPDIR)/putenv.Po ./$(DEPDIR)/select.Po \ ./$(DEPDIR)/setenv.Po ./$(DEPDIR)/setlocale.Po \ ./$(DEPDIR)/setsockopt.Po ./$(DEPDIR)/sig-handler.Po \ ./$(DEPDIR)/sigaction.Po ./$(DEPDIR)/sigprocmask.Po \ ./$(DEPDIR)/sleep.Po ./$(DEPDIR)/snprintf.Po \ ./$(DEPDIR)/socket.Po ./$(DEPDIR)/sockets.Po \ ./$(DEPDIR)/strerror_r.Po ./$(DEPDIR)/symlink.Po \ ./$(DEPDIR)/sys_socket.Po ./$(DEPDIR)/test-accept.Po \ ./$(DEPDIR)/test-alignof.Po ./$(DEPDIR)/test-alloca-opt.Po \ ./$(DEPDIR)/test-argmatch.Po ./$(DEPDIR)/test-arpa_inet.Po \ ./$(DEPDIR)/test-binary-io.Po ./$(DEPDIR)/test-bind.Po \ ./$(DEPDIR)/test-bitrotate.Po ./$(DEPDIR)/test-btowc.Po \ ./$(DEPDIR)/test-c-ctype.Po ./$(DEPDIR)/test-c-stack.Po \ ./$(DEPDIR)/test-c-strcasecmp.Po \ ./$(DEPDIR)/test-c-strncasecmp.Po \ ./$(DEPDIR)/test-calloc-gnu.Po ./$(DEPDIR)/test-chdir.Po \ ./$(DEPDIR)/test-cloexec.Po ./$(DEPDIR)/test-close.Po \ ./$(DEPDIR)/test-connect.Po ./$(DEPDIR)/test-ctype.Po \ ./$(DEPDIR)/test-dfa-match-aux.Po ./$(DEPDIR)/test-dirent.Po \ ./$(DEPDIR)/test-dup-safer.Po ./$(DEPDIR)/test-dup.Po \ ./$(DEPDIR)/test-dup2.Po ./$(DEPDIR)/test-dynarray.Po \ ./$(DEPDIR)/test-environ.Po ./$(DEPDIR)/test-errno.Po \ ./$(DEPDIR)/test-exclude.Po ./$(DEPDIR)/test-fchdir.Po \ ./$(DEPDIR)/test-fcntl-h.Po ./$(DEPDIR)/test-fcntl-safer.Po \ ./$(DEPDIR)/test-fcntl.Po ./$(DEPDIR)/test-fdopen.Po \ ./$(DEPDIR)/test-fdopendir.Po ./$(DEPDIR)/test-fgetc.Po \ ./$(DEPDIR)/test-float.Po ./$(DEPDIR)/test-fnmatch-h.Po \ ./$(DEPDIR)/test-fnmatch.Po ./$(DEPDIR)/test-fopen-gnu.Po \ ./$(DEPDIR)/test-fopen.Po ./$(DEPDIR)/test-fpending.Po \ ./$(DEPDIR)/test-fputc.Po ./$(DEPDIR)/test-fread.Po \ ./$(DEPDIR)/test-free.Po ./$(DEPDIR)/test-fstat.Po \ ./$(DEPDIR)/test-fstatat.Po ./$(DEPDIR)/test-ftruncate.Po \ ./$(DEPDIR)/test-fwrite.Po ./$(DEPDIR)/test-getcwd-lgpl.Po \ ./$(DEPDIR)/test-getdtablesize.Po \ ./$(DEPDIR)/test-getopt-gnu.Po \ ./$(DEPDIR)/test-getopt-posix.Po \ ./$(DEPDIR)/test-getprogname.Po \ ./$(DEPDIR)/test-gettimeofday.Po \ ./$(DEPDIR)/test-hard-locale.Po ./$(DEPDIR)/test-hash.Po \ ./$(DEPDIR)/test-i-ring.Po ./$(DEPDIR)/test-iconv-h.Po \ ./$(DEPDIR)/test-iconv.Po ./$(DEPDIR)/test-ignore-value.Po \ ./$(DEPDIR)/test-inet_pton.Po ./$(DEPDIR)/test-intprops.Po \ ./$(DEPDIR)/test-inttostr.Po ./$(DEPDIR)/test-inttypes.Po \ ./$(DEPDIR)/test-ioctl.Po ./$(DEPDIR)/test-isatty.Po \ ./$(DEPDIR)/test-isblank.Po ./$(DEPDIR)/test-iswblank.Po \ ./$(DEPDIR)/test-iswdigit.Po ./$(DEPDIR)/test-iswxdigit.Po \ ./$(DEPDIR)/test-langinfo.Po ./$(DEPDIR)/test-limits-h.Po \ ./$(DEPDIR)/test-listen.Po ./$(DEPDIR)/test-localcharset.Po \ ./$(DEPDIR)/test-locale.Po ./$(DEPDIR)/test-localeconv.Po \ ./$(DEPDIR)/test-localename.Po ./$(DEPDIR)/test-lseek.Po \ ./$(DEPDIR)/test-lstat.Po ./$(DEPDIR)/test-malloc-gnu.Po \ ./$(DEPDIR)/test-malloca.Po ./$(DEPDIR)/test-mbscasecmp.Po \ ./$(DEPDIR)/test-mbsinit.Po ./$(DEPDIR)/test-mbsrtowcs.Po \ ./$(DEPDIR)/test-mbsstr1.Po ./$(DEPDIR)/test-mbsstr2.Po \ ./$(DEPDIR)/test-mbsstr3.Po ./$(DEPDIR)/test-memchr.Po \ ./$(DEPDIR)/test-memchr2.Po ./$(DEPDIR)/test-memrchr.Po \ ./$(DEPDIR)/test-nanosleep.Po ./$(DEPDIR)/test-netinet_in.Po \ ./$(DEPDIR)/test-nl_langinfo-mt.Po \ ./$(DEPDIR)/test-nl_langinfo.Po ./$(DEPDIR)/test-open.Po \ ./$(DEPDIR)/test-openat-safer.Po ./$(DEPDIR)/test-openat.Po \ ./$(DEPDIR)/test-pathmax.Po ./$(DEPDIR)/test-perror.Po \ ./$(DEPDIR)/test-perror2.Po ./$(DEPDIR)/test-pipe.Po \ ./$(DEPDIR)/test-pthread-thread.Po ./$(DEPDIR)/test-pthread.Po \ ./$(DEPDIR)/test-pthread_sigmask1.Po \ ./$(DEPDIR)/test-pthread_sigmask2.Po \ ./$(DEPDIR)/test-quotearg-simple.Po ./$(DEPDIR)/test-raise.Po \ ./$(DEPDIR)/test-rawmemchr.Po ./$(DEPDIR)/test-read.Po \ ./$(DEPDIR)/test-realloc-gnu.Po \ ./$(DEPDIR)/test-reallocarray.Po ./$(DEPDIR)/test-regex.Po \ ./$(DEPDIR)/test-sched.Po ./$(DEPDIR)/test-select-fd.Po \ ./$(DEPDIR)/test-select-stdin.Po ./$(DEPDIR)/test-select.Po \ ./$(DEPDIR)/test-setenv.Po ./$(DEPDIR)/test-setlocale1.Po \ ./$(DEPDIR)/test-setlocale2.Po \ ./$(DEPDIR)/test-setlocale_null-mt-all.Po \ ./$(DEPDIR)/test-setlocale_null-mt-one.Po \ ./$(DEPDIR)/test-setlocale_null.Po \ ./$(DEPDIR)/test-setsockopt.Po ./$(DEPDIR)/test-sigaction.Po \ ./$(DEPDIR)/test-signal-h.Po ./$(DEPDIR)/test-sigprocmask.Po \ ./$(DEPDIR)/test-sigsegv-catch-segv1.Po \ ./$(DEPDIR)/test-sigsegv-catch-segv2.Po \ ./$(DEPDIR)/test-sigsegv-catch-stackoverflow1.Po \ ./$(DEPDIR)/test-sigsegv-catch-stackoverflow2.Po \ ./$(DEPDIR)/test-sleep.Po ./$(DEPDIR)/test-snprintf.Po \ ./$(DEPDIR)/test-sockets.Po ./$(DEPDIR)/test-stat-time.Po \ ./$(DEPDIR)/test-stat.Po ./$(DEPDIR)/test-stdalign.Po \ ./$(DEPDIR)/test-stdbool.Po ./$(DEPDIR)/test-stddef.Po \ ./$(DEPDIR)/test-stdint.Po ./$(DEPDIR)/test-stdio.Po \ ./$(DEPDIR)/test-stdlib.Po ./$(DEPDIR)/test-strerror.Po \ ./$(DEPDIR)/test-strerror_r.Po ./$(DEPDIR)/test-striconv.Po \ ./$(DEPDIR)/test-string.Po ./$(DEPDIR)/test-strnlen.Po \ ./$(DEPDIR)/test-strstr.Po ./$(DEPDIR)/test-strtoimax.Po \ ./$(DEPDIR)/test-strtoll.Po ./$(DEPDIR)/test-strtoull.Po \ ./$(DEPDIR)/test-strtoumax.Po ./$(DEPDIR)/test-symlink.Po \ ./$(DEPDIR)/test-sys_ioctl.Po ./$(DEPDIR)/test-sys_select.Po \ ./$(DEPDIR)/test-sys_socket.Po ./$(DEPDIR)/test-sys_stat.Po \ ./$(DEPDIR)/test-sys_time.Po ./$(DEPDIR)/test-sys_types.Po \ ./$(DEPDIR)/test-sys_uio.Po ./$(DEPDIR)/test-thread_create.Po \ ./$(DEPDIR)/test-thread_self.Po ./$(DEPDIR)/test-time.Po \ ./$(DEPDIR)/test-unistd.Po ./$(DEPDIR)/test-unsetenv.Po \ ./$(DEPDIR)/test-vasnprintf.Po ./$(DEPDIR)/test-verify-try.Po \ ./$(DEPDIR)/test-verify.Po ./$(DEPDIR)/test-version-etc.Po \ ./$(DEPDIR)/test-wchar.Po ./$(DEPDIR)/test-wcrtomb-w32.Po \ ./$(DEPDIR)/test-wcrtomb.Po ./$(DEPDIR)/test-wctype-h.Po \ ./$(DEPDIR)/test-wcwidth.Po ./$(DEPDIR)/test-xalloc-die.Po \ ./$(DEPDIR)/test-xstrtoimax.Po ./$(DEPDIR)/test-xstrtol.Po \ ./$(DEPDIR)/test-xstrtoul.Po ./$(DEPDIR)/uinttostr.Po \ ./$(DEPDIR)/umaxtostr.Po ./$(DEPDIR)/unsetenv.Po \ ./$(DEPDIR)/vasnprintf.Po ./$(DEPDIR)/windows-thread.Po \ ./$(DEPDIR)/windows-tls.Po ./$(DEPDIR)/xsize.Po \ ./$(DEPDIR)/xstrtol-error.Po glthread/$(DEPDIR)/thread.Po \ unistr/$(DEPDIR)/test-u8-mbtoucr.Po \ unistr/$(DEPDIR)/test-u8-uctomb.Po \ uniwidth/$(DEPDIR)/test-uc_width.Po \ uniwidth/$(DEPDIR)/test-uc_width2.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(current_locale_SOURCES) test-accept.c test-alignof.c \ test-alloca-opt.c test-argmatch.c test-arpa_inet.c \ test-binary-io.c test-bind.c test-bitrotate.c test-btowc.c \ test-c-ctype.c test-c-stack.c test-c-strcasecmp.c \ test-c-strncasecmp.c test-calloc-gnu.c test-chdir.c \ test-cloexec.c test-close.c test-connect.c test-ctype.c \ test-dfa-match-aux.c test-dirent.c test-dup.c test-dup-safer.c \ test-dup2.c test-dynarray.c test-environ.c test-errno.c \ test-exclude.c test-fchdir.c test-fcntl.c test-fcntl-h.c \ test-fcntl-safer.c test-fdopen.c test-fdopendir.c test-fgetc.c \ test-float.c test-fnmatch.c test-fnmatch-h.c test-fopen.c \ test-fopen-gnu.c test-fpending.c test-fputc.c test-fread.c \ test-free.c test-fstat.c test-fstatat.c test-ftruncate.c \ test-fwrite.c test-getcwd-lgpl.c test-getdtablesize.c \ test-getopt-gnu.c test-getopt-posix.c test-getprogname.c \ test-gettimeofday.c test-hard-locale.c test-hash.c \ test-i-ring.c test-iconv.c test-iconv-h.c test-ignore-value.c \ test-inet_pton.c test-intprops.c test-inttostr.c \ test-inttypes.c test-ioctl.c test-isatty.c test-isblank.c \ test-iswblank.c test-iswdigit.c test-iswxdigit.c \ test-langinfo.c test-limits-h.c test-listen.c \ test-localcharset.c test-locale.c test-localeconv.c \ test-localename.c test-lseek.c test-lstat.c test-malloc-gnu.c \ test-malloca.c test-mbscasecmp.c test-mbsinit.c \ test-mbsrtowcs.c test-mbsstr1.c test-mbsstr2.c test-mbsstr3.c \ test-memchr.c test-memchr2.c test-memrchr.c test-nanosleep.c \ test-netinet_in.c test-nl_langinfo.c test-nl_langinfo-mt.c \ test-open.c test-openat.c test-openat-safer.c test-pathmax.c \ test-perror.c test-perror2.c test-pipe.c test-pthread.c \ test-pthread-thread.c test-pthread_sigmask1.c \ test-pthread_sigmask2.c test-quotearg-simple.c test-raise.c \ test-rawmemchr.c test-read.c test-realloc-gnu.c \ test-reallocarray.c test-regex.c test-sched.c test-select.c \ test-select-fd.c test-select-stdin.c test-setenv.c \ test-setlocale1.c test-setlocale2.c test-setlocale_null.c \ test-setlocale_null-mt-all.c test-setlocale_null-mt-one.c \ test-setsockopt.c test-sigaction.c test-signal-h.c \ test-sigprocmask.c test-sigsegv-catch-segv1.c \ test-sigsegv-catch-segv2.c test-sigsegv-catch-stackoverflow1.c \ test-sigsegv-catch-stackoverflow2.c test-sleep.c \ test-snprintf.c test-sockets.c test-stat.c test-stat-time.c \ test-stdalign.c test-stdbool.c test-stddef.c test-stdint.c \ test-stdio.c test-stdlib.c test-strerror.c test-strerror_r.c \ test-striconv.c test-string.c test-strnlen.c test-strstr.c \ test-strtoimax.c test-strtoll.c test-strtoull.c \ test-strtoumax.c test-symlink.c test-sys_ioctl.c \ test-sys_select.c test-sys_socket.c test-sys_stat.c \ test-sys_time.c test-sys_types.c test-sys_uio.c \ test-thread_create.c test-thread_self.c test-time.c \ $(test_u8_mbtoucr_SOURCES) $(test_u8_uctomb_SOURCES) \ $(test_uc_width_SOURCES) $(test_uc_width2_SOURCES) \ test-unistd.c test-unsetenv.c test-vasnprintf.c test-verify.c \ test-verify-try.c test-version-etc.c test-wchar.c \ test-wcrtomb.c test-wcrtomb-w32.c test-wctype-h.c \ test-wcwidth.c test-xalloc-die.c test-xstrtoimax.c \ test-xstrtol.c test-xstrtoul.c DIST_SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(current_locale_SOURCES) test-accept.c test-alignof.c \ test-alloca-opt.c test-argmatch.c test-arpa_inet.c \ test-binary-io.c test-bind.c test-bitrotate.c test-btowc.c \ test-c-ctype.c test-c-stack.c test-c-strcasecmp.c \ test-c-strncasecmp.c test-calloc-gnu.c test-chdir.c \ test-cloexec.c test-close.c test-connect.c test-ctype.c \ test-dfa-match-aux.c test-dirent.c test-dup.c test-dup-safer.c \ test-dup2.c test-dynarray.c test-environ.c test-errno.c \ test-exclude.c test-fchdir.c test-fcntl.c test-fcntl-h.c \ test-fcntl-safer.c test-fdopen.c test-fdopendir.c test-fgetc.c \ test-float.c test-fnmatch.c test-fnmatch-h.c test-fopen.c \ test-fopen-gnu.c test-fpending.c test-fputc.c test-fread.c \ test-free.c test-fstat.c test-fstatat.c test-ftruncate.c \ test-fwrite.c test-getcwd-lgpl.c test-getdtablesize.c \ test-getopt-gnu.c test-getopt-posix.c test-getprogname.c \ test-gettimeofday.c test-hard-locale.c test-hash.c \ test-i-ring.c test-iconv.c test-iconv-h.c test-ignore-value.c \ test-inet_pton.c test-intprops.c test-inttostr.c \ test-inttypes.c test-ioctl.c test-isatty.c test-isblank.c \ test-iswblank.c test-iswdigit.c test-iswxdigit.c \ test-langinfo.c test-limits-h.c test-listen.c \ test-localcharset.c test-locale.c test-localeconv.c \ test-localename.c test-lseek.c test-lstat.c test-malloc-gnu.c \ test-malloca.c test-mbscasecmp.c test-mbsinit.c \ test-mbsrtowcs.c test-mbsstr1.c test-mbsstr2.c test-mbsstr3.c \ test-memchr.c test-memchr2.c test-memrchr.c test-nanosleep.c \ test-netinet_in.c test-nl_langinfo.c test-nl_langinfo-mt.c \ test-open.c test-openat.c test-openat-safer.c test-pathmax.c \ test-perror.c test-perror2.c test-pipe.c test-pthread.c \ test-pthread-thread.c test-pthread_sigmask1.c \ test-pthread_sigmask2.c test-quotearg-simple.c test-raise.c \ test-rawmemchr.c test-read.c test-realloc-gnu.c \ test-reallocarray.c test-regex.c test-sched.c test-select.c \ test-select-fd.c test-select-stdin.c test-setenv.c \ test-setlocale1.c test-setlocale2.c test-setlocale_null.c \ test-setlocale_null-mt-all.c test-setlocale_null-mt-one.c \ test-setsockopt.c test-sigaction.c test-signal-h.c \ test-sigprocmask.c test-sigsegv-catch-segv1.c \ test-sigsegv-catch-segv2.c test-sigsegv-catch-stackoverflow1.c \ test-sigsegv-catch-stackoverflow2.c test-sleep.c \ test-snprintf.c test-sockets.c test-stat.c test-stat-time.c \ test-stdalign.c test-stdbool.c test-stddef.c test-stdint.c \ test-stdio.c test-stdlib.c test-strerror.c test-strerror_r.c \ test-striconv.c test-string.c test-strnlen.c test-strstr.c \ test-strtoimax.c test-strtoll.c test-strtoull.c \ test-strtoumax.c test-symlink.c test-sys_ioctl.c \ test-sys_select.c test-sys_socket.c test-sys_stat.c \ test-sys_time.c test-sys_types.c test-sys_uio.c \ test-thread_create.c test-thread_self.c test-time.c \ $(test_u8_mbtoucr_SOURCES) $(test_u8_uctomb_SOURCES) \ $(test_uc_width_SOURCES) $(test_uc_width2_SOURCES) \ test-unistd.c test-unsetenv.c test-vasnprintf.c test-verify.c \ test-verify-try.c test-version-etc.c test-wchar.c \ test-wcrtomb.c test-wcrtomb-w32.c test-wctype-h.c \ test-wcwidth.c test-xalloc-die.c test-xstrtoimax.c \ test-xstrtol.c test-xstrtoul.c RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ check recheck distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/gnulib.mk \ $(top_srcdir)/build-aux/depcomp \ $(top_srcdir)/build-aux/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" pkglibexecdir = @pkglibexecdir@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ AR = @AR@ ARFLAGS = @ARFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @GL_CFLAG_ALLOW_WARNINGS@ @CFLAGS@ CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ COLORIZE_SOURCE = @COLORIZE_SOURCE@ CONFIG_INCLUDE = @CONFIG_INCLUDE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ -DEXEEXT=\"@EXEEXT@\" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ ENOLINK_VALUE = @ENOLINK_VALUE@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ FNMATCH_H = @FNMATCH_H@ GETOPT_CDEFS_H = @GETOPT_CDEFS_H@ GETOPT_H = @GETOPT_H@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@ GL_CXXFLAG_ALLOW_WARNINGS = @GL_CXXFLAG_ALLOW_WARNINGS@ GL_GNULIB_ACCEPT = @GL_GNULIB_ACCEPT@ GL_GNULIB_ACCEPT4 = @GL_GNULIB_ACCEPT4@ GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@ GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@ GL_GNULIB_ALPHASORT = @GL_GNULIB_ALPHASORT@ GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@ GL_GNULIB_BIND = @GL_GNULIB_BIND@ GL_GNULIB_BTOWC = @GL_GNULIB_BTOWC@ GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@ GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@ GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@ GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@ GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@ GL_GNULIB_CLOSEDIR = @GL_GNULIB_CLOSEDIR@ GL_GNULIB_CONNECT = @GL_GNULIB_CONNECT@ GL_GNULIB_COPY_FILE_RANGE = @GL_GNULIB_COPY_FILE_RANGE@ GL_GNULIB_CREAT = @GL_GNULIB_CREAT@ GL_GNULIB_CTIME = @GL_GNULIB_CTIME@ GL_GNULIB_DIRFD = @GL_GNULIB_DIRFD@ GL_GNULIB_DPRINTF = @GL_GNULIB_DPRINTF@ GL_GNULIB_DUP = @GL_GNULIB_DUP@ GL_GNULIB_DUP2 = @GL_GNULIB_DUP2@ GL_GNULIB_DUP3 = @GL_GNULIB_DUP3@ GL_GNULIB_DUPLOCALE = @GL_GNULIB_DUPLOCALE@ GL_GNULIB_ENVIRON = @GL_GNULIB_ENVIRON@ GL_GNULIB_EUIDACCESS = @GL_GNULIB_EUIDACCESS@ GL_GNULIB_EXECL = @GL_GNULIB_EXECL@ GL_GNULIB_EXECLE = @GL_GNULIB_EXECLE@ GL_GNULIB_EXECLP = @GL_GNULIB_EXECLP@ GL_GNULIB_EXECV = @GL_GNULIB_EXECV@ GL_GNULIB_EXECVE = @GL_GNULIB_EXECVE@ GL_GNULIB_EXECVP = @GL_GNULIB_EXECVP@ GL_GNULIB_EXECVPE = @GL_GNULIB_EXECVPE@ GL_GNULIB_EXPLICIT_BZERO = @GL_GNULIB_EXPLICIT_BZERO@ GL_GNULIB_FACCESSAT = @GL_GNULIB_FACCESSAT@ GL_GNULIB_FCHDIR = @GL_GNULIB_FCHDIR@ GL_GNULIB_FCHMODAT = @GL_GNULIB_FCHMODAT@ GL_GNULIB_FCHOWNAT = @GL_GNULIB_FCHOWNAT@ GL_GNULIB_FCLOSE = @GL_GNULIB_FCLOSE@ GL_GNULIB_FCNTL = @GL_GNULIB_FCNTL@ GL_GNULIB_FDATASYNC = @GL_GNULIB_FDATASYNC@ GL_GNULIB_FDOPEN = @GL_GNULIB_FDOPEN@ GL_GNULIB_FDOPENDIR = @GL_GNULIB_FDOPENDIR@ GL_GNULIB_FFLUSH = @GL_GNULIB_FFLUSH@ GL_GNULIB_FFSL = @GL_GNULIB_FFSL@ GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@ GL_GNULIB_FGETC = @GL_GNULIB_FGETC@ GL_GNULIB_FGETS = @GL_GNULIB_FGETS@ GL_GNULIB_FNMATCH = @GL_GNULIB_FNMATCH@ GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@ GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@ GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@ GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@ GL_GNULIB_FPUTC = @GL_GNULIB_FPUTC@ GL_GNULIB_FPUTS = @GL_GNULIB_FPUTS@ GL_GNULIB_FREAD = @GL_GNULIB_FREAD@ GL_GNULIB_FREE_POSIX = @GL_GNULIB_FREE_POSIX@ GL_GNULIB_FREOPEN = @GL_GNULIB_FREOPEN@ GL_GNULIB_FSCANF = @GL_GNULIB_FSCANF@ GL_GNULIB_FSEEK = @GL_GNULIB_FSEEK@ GL_GNULIB_FSEEKO = @GL_GNULIB_FSEEKO@ GL_GNULIB_FSTAT = @GL_GNULIB_FSTAT@ GL_GNULIB_FSTATAT = @GL_GNULIB_FSTATAT@ GL_GNULIB_FSYNC = @GL_GNULIB_FSYNC@ GL_GNULIB_FTELL = @GL_GNULIB_FTELL@ GL_GNULIB_FTELLO = @GL_GNULIB_FTELLO@ GL_GNULIB_FTRUNCATE = @GL_GNULIB_FTRUNCATE@ GL_GNULIB_FUTIMENS = @GL_GNULIB_FUTIMENS@ GL_GNULIB_FWRITE = @GL_GNULIB_FWRITE@ GL_GNULIB_GETC = @GL_GNULIB_GETC@ GL_GNULIB_GETCHAR = @GL_GNULIB_GETCHAR@ GL_GNULIB_GETCWD = @GL_GNULIB_GETCWD@ GL_GNULIB_GETDELIM = @GL_GNULIB_GETDELIM@ GL_GNULIB_GETDOMAINNAME = @GL_GNULIB_GETDOMAINNAME@ GL_GNULIB_GETDTABLESIZE = @GL_GNULIB_GETDTABLESIZE@ GL_GNULIB_GETENTROPY = @GL_GNULIB_GETENTROPY@ GL_GNULIB_GETGROUPS = @GL_GNULIB_GETGROUPS@ GL_GNULIB_GETHOSTNAME = @GL_GNULIB_GETHOSTNAME@ GL_GNULIB_GETLINE = @GL_GNULIB_GETLINE@ GL_GNULIB_GETLOADAVG = @GL_GNULIB_GETLOADAVG@ GL_GNULIB_GETLOGIN = @GL_GNULIB_GETLOGIN@ GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@ GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@ GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@ GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@ GL_GNULIB_GETPEERNAME = @GL_GNULIB_GETPEERNAME@ GL_GNULIB_GETSOCKNAME = @GL_GNULIB_GETSOCKNAME@ GL_GNULIB_GETSOCKOPT = @GL_GNULIB_GETSOCKOPT@ GL_GNULIB_GETSUBOPT = @GL_GNULIB_GETSUBOPT@ GL_GNULIB_GETTIMEOFDAY = @GL_GNULIB_GETTIMEOFDAY@ GL_GNULIB_GETUMASK = @GL_GNULIB_GETUMASK@ GL_GNULIB_GETUSERSHELL = @GL_GNULIB_GETUSERSHELL@ GL_GNULIB_GRANTPT = @GL_GNULIB_GRANTPT@ GL_GNULIB_GROUP_MEMBER = @GL_GNULIB_GROUP_MEMBER@ GL_GNULIB_ICONV = @GL_GNULIB_ICONV@ GL_GNULIB_IMAXABS = @GL_GNULIB_IMAXABS@ GL_GNULIB_IMAXDIV = @GL_GNULIB_IMAXDIV@ GL_GNULIB_INET_NTOP = @GL_GNULIB_INET_NTOP@ GL_GNULIB_INET_PTON = @GL_GNULIB_INET_PTON@ GL_GNULIB_IOCTL = @GL_GNULIB_IOCTL@ GL_GNULIB_ISATTY = @GL_GNULIB_ISATTY@ GL_GNULIB_ISBLANK = @GL_GNULIB_ISBLANK@ GL_GNULIB_ISWBLANK = @GL_GNULIB_ISWBLANK@ GL_GNULIB_ISWCTYPE = @GL_GNULIB_ISWCTYPE@ GL_GNULIB_ISWDIGIT = @GL_GNULIB_ISWDIGIT@ GL_GNULIB_ISWXDIGIT = @GL_GNULIB_ISWXDIGIT@ GL_GNULIB_LCHMOD = @GL_GNULIB_LCHMOD@ GL_GNULIB_LCHOWN = @GL_GNULIB_LCHOWN@ GL_GNULIB_LINK = @GL_GNULIB_LINK@ GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@ GL_GNULIB_LISTEN = @GL_GNULIB_LISTEN@ GL_GNULIB_LOCALECONV = @GL_GNULIB_LOCALECONV@ GL_GNULIB_LOCALENAME = @GL_GNULIB_LOCALENAME@ GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@ GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@ GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@ GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@ GL_GNULIB_MBRLEN = @GL_GNULIB_MBRLEN@ GL_GNULIB_MBRTOWC = @GL_GNULIB_MBRTOWC@ GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@ GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@ GL_GNULIB_MBSCHR = @GL_GNULIB_MBSCHR@ GL_GNULIB_MBSCSPN = @GL_GNULIB_MBSCSPN@ GL_GNULIB_MBSINIT = @GL_GNULIB_MBSINIT@ GL_GNULIB_MBSLEN = @GL_GNULIB_MBSLEN@ GL_GNULIB_MBSNCASECMP = @GL_GNULIB_MBSNCASECMP@ GL_GNULIB_MBSNLEN = @GL_GNULIB_MBSNLEN@ GL_GNULIB_MBSNRTOWCS = @GL_GNULIB_MBSNRTOWCS@ GL_GNULIB_MBSPBRK = @GL_GNULIB_MBSPBRK@ GL_GNULIB_MBSPCASECMP = @GL_GNULIB_MBSPCASECMP@ GL_GNULIB_MBSRCHR = @GL_GNULIB_MBSRCHR@ GL_GNULIB_MBSRTOWCS = @GL_GNULIB_MBSRTOWCS@ GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@ GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@ GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@ GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@ GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@ GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@ GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@ GL_GNULIB_MDA_CHMOD = @GL_GNULIB_MDA_CHMOD@ GL_GNULIB_MDA_CLOSE = @GL_GNULIB_MDA_CLOSE@ GL_GNULIB_MDA_CREAT = @GL_GNULIB_MDA_CREAT@ GL_GNULIB_MDA_DUP = @GL_GNULIB_MDA_DUP@ GL_GNULIB_MDA_DUP2 = @GL_GNULIB_MDA_DUP2@ GL_GNULIB_MDA_ECVT = @GL_GNULIB_MDA_ECVT@ GL_GNULIB_MDA_EXECL = @GL_GNULIB_MDA_EXECL@ GL_GNULIB_MDA_EXECLE = @GL_GNULIB_MDA_EXECLE@ GL_GNULIB_MDA_EXECLP = @GL_GNULIB_MDA_EXECLP@ GL_GNULIB_MDA_EXECV = @GL_GNULIB_MDA_EXECV@ GL_GNULIB_MDA_EXECVE = @GL_GNULIB_MDA_EXECVE@ GL_GNULIB_MDA_EXECVP = @GL_GNULIB_MDA_EXECVP@ GL_GNULIB_MDA_EXECVPE = @GL_GNULIB_MDA_EXECVPE@ GL_GNULIB_MDA_FCLOSEALL = @GL_GNULIB_MDA_FCLOSEALL@ GL_GNULIB_MDA_FCVT = @GL_GNULIB_MDA_FCVT@ GL_GNULIB_MDA_FDOPEN = @GL_GNULIB_MDA_FDOPEN@ GL_GNULIB_MDA_FILENO = @GL_GNULIB_MDA_FILENO@ GL_GNULIB_MDA_GCVT = @GL_GNULIB_MDA_GCVT@ GL_GNULIB_MDA_GETCWD = @GL_GNULIB_MDA_GETCWD@ GL_GNULIB_MDA_GETPID = @GL_GNULIB_MDA_GETPID@ GL_GNULIB_MDA_GETW = @GL_GNULIB_MDA_GETW@ GL_GNULIB_MDA_ISATTY = @GL_GNULIB_MDA_ISATTY@ GL_GNULIB_MDA_LSEEK = @GL_GNULIB_MDA_LSEEK@ GL_GNULIB_MDA_MEMCCPY = @GL_GNULIB_MDA_MEMCCPY@ GL_GNULIB_MDA_MKDIR = @GL_GNULIB_MDA_MKDIR@ GL_GNULIB_MDA_MKTEMP = @GL_GNULIB_MDA_MKTEMP@ GL_GNULIB_MDA_OPEN = @GL_GNULIB_MDA_OPEN@ GL_GNULIB_MDA_PUTENV = @GL_GNULIB_MDA_PUTENV@ GL_GNULIB_MDA_PUTW = @GL_GNULIB_MDA_PUTW@ GL_GNULIB_MDA_READ = @GL_GNULIB_MDA_READ@ GL_GNULIB_MDA_RMDIR = @GL_GNULIB_MDA_RMDIR@ GL_GNULIB_MDA_STRDUP = @GL_GNULIB_MDA_STRDUP@ GL_GNULIB_MDA_SWAB = @GL_GNULIB_MDA_SWAB@ GL_GNULIB_MDA_TEMPNAM = @GL_GNULIB_MDA_TEMPNAM@ GL_GNULIB_MDA_TZSET = @GL_GNULIB_MDA_TZSET@ GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@ GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@ GL_GNULIB_MDA_WCSDUP = @GL_GNULIB_MDA_WCSDUP@ GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@ GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@ GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@ GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@ GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@ GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@ GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@ GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@ GL_GNULIB_MKFIFO = @GL_GNULIB_MKFIFO@ GL_GNULIB_MKFIFOAT = @GL_GNULIB_MKFIFOAT@ GL_GNULIB_MKNOD = @GL_GNULIB_MKNOD@ GL_GNULIB_MKNODAT = @GL_GNULIB_MKNODAT@ GL_GNULIB_MKOSTEMP = @GL_GNULIB_MKOSTEMP@ GL_GNULIB_MKOSTEMPS = @GL_GNULIB_MKOSTEMPS@ GL_GNULIB_MKSTEMP = @GL_GNULIB_MKSTEMP@ GL_GNULIB_MKSTEMPS = @GL_GNULIB_MKSTEMPS@ GL_GNULIB_MKTIME = @GL_GNULIB_MKTIME@ GL_GNULIB_NANOSLEEP = @GL_GNULIB_NANOSLEEP@ GL_GNULIB_NL_LANGINFO = @GL_GNULIB_NL_LANGINFO@ GL_GNULIB_NONBLOCKING = @GL_GNULIB_NONBLOCKING@ GL_GNULIB_OBSTACK_PRINTF = @GL_GNULIB_OBSTACK_PRINTF@ GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@ GL_GNULIB_OPEN = @GL_GNULIB_OPEN@ GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@ GL_GNULIB_OPENDIR = @GL_GNULIB_OPENDIR@ GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@ GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@ GL_GNULIB_PERROR = @GL_GNULIB_PERROR@ GL_GNULIB_PIPE = @GL_GNULIB_PIPE@ GL_GNULIB_PIPE2 = @GL_GNULIB_PIPE2@ GL_GNULIB_POPEN = @GL_GNULIB_POPEN@ GL_GNULIB_POSIX_MEMALIGN = @GL_GNULIB_POSIX_MEMALIGN@ GL_GNULIB_POSIX_OPENPT = @GL_GNULIB_POSIX_OPENPT@ GL_GNULIB_PREAD = @GL_GNULIB_PREAD@ GL_GNULIB_PRINTF = @GL_GNULIB_PRINTF@ GL_GNULIB_PRINTF_POSIX = @GL_GNULIB_PRINTF_POSIX@ GL_GNULIB_PSELECT = @GL_GNULIB_PSELECT@ GL_GNULIB_PTHREAD_COND = @GL_GNULIB_PTHREAD_COND@ GL_GNULIB_PTHREAD_MUTEX = @GL_GNULIB_PTHREAD_MUTEX@ GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK = @GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK@ GL_GNULIB_PTHREAD_ONCE = @GL_GNULIB_PTHREAD_ONCE@ GL_GNULIB_PTHREAD_RWLOCK = @GL_GNULIB_PTHREAD_RWLOCK@ GL_GNULIB_PTHREAD_SIGMASK = @GL_GNULIB_PTHREAD_SIGMASK@ GL_GNULIB_PTHREAD_SPIN = @GL_GNULIB_PTHREAD_SPIN@ GL_GNULIB_PTHREAD_THREAD = @GL_GNULIB_PTHREAD_THREAD@ GL_GNULIB_PTHREAD_TSS = @GL_GNULIB_PTHREAD_TSS@ GL_GNULIB_PTSNAME = @GL_GNULIB_PTSNAME@ GL_GNULIB_PTSNAME_R = @GL_GNULIB_PTSNAME_R@ GL_GNULIB_PUTC = @GL_GNULIB_PUTC@ GL_GNULIB_PUTCHAR = @GL_GNULIB_PUTCHAR@ GL_GNULIB_PUTENV = @GL_GNULIB_PUTENV@ GL_GNULIB_PUTS = @GL_GNULIB_PUTS@ GL_GNULIB_PWRITE = @GL_GNULIB_PWRITE@ GL_GNULIB_QSORT_R = @GL_GNULIB_QSORT_R@ GL_GNULIB_RAISE = @GL_GNULIB_RAISE@ GL_GNULIB_RANDOM = @GL_GNULIB_RANDOM@ GL_GNULIB_RANDOM_R = @GL_GNULIB_RANDOM_R@ GL_GNULIB_RAWMEMCHR = @GL_GNULIB_RAWMEMCHR@ GL_GNULIB_READ = @GL_GNULIB_READ@ GL_GNULIB_READDIR = @GL_GNULIB_READDIR@ GL_GNULIB_READLINK = @GL_GNULIB_READLINK@ GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@ GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@ GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@ GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@ GL_GNULIB_RECV = @GL_GNULIB_RECV@ GL_GNULIB_RECVFROM = @GL_GNULIB_RECVFROM@ GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@ GL_GNULIB_RENAME = @GL_GNULIB_RENAME@ GL_GNULIB_RENAMEAT = @GL_GNULIB_RENAMEAT@ GL_GNULIB_REWINDDIR = @GL_GNULIB_REWINDDIR@ GL_GNULIB_RMDIR = @GL_GNULIB_RMDIR@ GL_GNULIB_RPMATCH = @GL_GNULIB_RPMATCH@ GL_GNULIB_SCANDIR = @GL_GNULIB_SCANDIR@ GL_GNULIB_SCANF = @GL_GNULIB_SCANF@ GL_GNULIB_SCHED_YIELD = @GL_GNULIB_SCHED_YIELD@ GL_GNULIB_SECURE_GETENV = @GL_GNULIB_SECURE_GETENV@ GL_GNULIB_SELECT = @GL_GNULIB_SELECT@ GL_GNULIB_SEND = @GL_GNULIB_SEND@ GL_GNULIB_SENDTO = @GL_GNULIB_SENDTO@ GL_GNULIB_SETENV = @GL_GNULIB_SETENV@ GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@ GL_GNULIB_SETLOCALE = @GL_GNULIB_SETLOCALE@ GL_GNULIB_SETLOCALE_NULL = @GL_GNULIB_SETLOCALE_NULL@ GL_GNULIB_SETSOCKOPT = @GL_GNULIB_SETSOCKOPT@ GL_GNULIB_SHUTDOWN = @GL_GNULIB_SHUTDOWN@ GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@ GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@ GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@ GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@ GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@ GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@ GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@ GL_GNULIB_SOCKET = @GL_GNULIB_SOCKET@ GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@ GL_GNULIB_STAT = @GL_GNULIB_STAT@ GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@ GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@ GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@ GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@ GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@ GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@ GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@ GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@ GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@ GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@ GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@ GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@ GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@ GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@ GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@ GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@ GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@ GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@ GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@ GL_GNULIB_STRTOLD = @GL_GNULIB_STRTOLD@ GL_GNULIB_STRTOLL = @GL_GNULIB_STRTOLL@ GL_GNULIB_STRTOUL = @GL_GNULIB_STRTOUL@ GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@ GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@ GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@ GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@ GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@ GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@ GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@ GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@ GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@ GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@ GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@ GL_GNULIB_TOWCTRANS = @GL_GNULIB_TOWCTRANS@ GL_GNULIB_TRUNCATE = @GL_GNULIB_TRUNCATE@ GL_GNULIB_TTYNAME_R = @GL_GNULIB_TTYNAME_R@ GL_GNULIB_TZSET = @GL_GNULIB_TZSET@ GL_GNULIB_UNISTD_H_GETOPT = @GL_GNULIB_UNISTD_H_GETOPT@ GL_GNULIB_UNISTD_H_NONBLOCKING = @GL_GNULIB_UNISTD_H_NONBLOCKING@ GL_GNULIB_UNISTD_H_SIGPIPE = @GL_GNULIB_UNISTD_H_SIGPIPE@ GL_GNULIB_UNLINK = @GL_GNULIB_UNLINK@ GL_GNULIB_UNLINKAT = @GL_GNULIB_UNLINKAT@ GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@ GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@ GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@ GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@ GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@ GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@ GL_GNULIB_VFPRINTF = @GL_GNULIB_VFPRINTF@ GL_GNULIB_VFPRINTF_POSIX = @GL_GNULIB_VFPRINTF_POSIX@ GL_GNULIB_VFSCANF = @GL_GNULIB_VFSCANF@ GL_GNULIB_VPRINTF = @GL_GNULIB_VPRINTF@ GL_GNULIB_VPRINTF_POSIX = @GL_GNULIB_VPRINTF_POSIX@ GL_GNULIB_VSCANF = @GL_GNULIB_VSCANF@ GL_GNULIB_VSNPRINTF = @GL_GNULIB_VSNPRINTF@ GL_GNULIB_VSPRINTF_POSIX = @GL_GNULIB_VSPRINTF_POSIX@ GL_GNULIB_WCPCPY = @GL_GNULIB_WCPCPY@ GL_GNULIB_WCPNCPY = @GL_GNULIB_WCPNCPY@ GL_GNULIB_WCRTOMB = @GL_GNULIB_WCRTOMB@ GL_GNULIB_WCSCASECMP = @GL_GNULIB_WCSCASECMP@ GL_GNULIB_WCSCAT = @GL_GNULIB_WCSCAT@ GL_GNULIB_WCSCHR = @GL_GNULIB_WCSCHR@ GL_GNULIB_WCSCMP = @GL_GNULIB_WCSCMP@ GL_GNULIB_WCSCOLL = @GL_GNULIB_WCSCOLL@ GL_GNULIB_WCSCPY = @GL_GNULIB_WCSCPY@ GL_GNULIB_WCSCSPN = @GL_GNULIB_WCSCSPN@ GL_GNULIB_WCSDUP = @GL_GNULIB_WCSDUP@ GL_GNULIB_WCSFTIME = @GL_GNULIB_WCSFTIME@ GL_GNULIB_WCSLEN = @GL_GNULIB_WCSLEN@ GL_GNULIB_WCSNCASECMP = @GL_GNULIB_WCSNCASECMP@ GL_GNULIB_WCSNCAT = @GL_GNULIB_WCSNCAT@ GL_GNULIB_WCSNCMP = @GL_GNULIB_WCSNCMP@ GL_GNULIB_WCSNCPY = @GL_GNULIB_WCSNCPY@ GL_GNULIB_WCSNLEN = @GL_GNULIB_WCSNLEN@ GL_GNULIB_WCSNRTOMBS = @GL_GNULIB_WCSNRTOMBS@ GL_GNULIB_WCSPBRK = @GL_GNULIB_WCSPBRK@ GL_GNULIB_WCSRCHR = @GL_GNULIB_WCSRCHR@ GL_GNULIB_WCSRTOMBS = @GL_GNULIB_WCSRTOMBS@ GL_GNULIB_WCSSPN = @GL_GNULIB_WCSSPN@ GL_GNULIB_WCSSTR = @GL_GNULIB_WCSSTR@ GL_GNULIB_WCSTOK = @GL_GNULIB_WCSTOK@ GL_GNULIB_WCSWIDTH = @GL_GNULIB_WCSWIDTH@ GL_GNULIB_WCSXFRM = @GL_GNULIB_WCSXFRM@ GL_GNULIB_WCTOB = @GL_GNULIB_WCTOB@ GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@ GL_GNULIB_WCTRANS = @GL_GNULIB_WCTRANS@ GL_GNULIB_WCTYPE = @GL_GNULIB_WCTYPE@ GL_GNULIB_WCWIDTH = @GL_GNULIB_WCWIDTH@ GL_GNULIB_WMEMCHR = @GL_GNULIB_WMEMCHR@ GL_GNULIB_WMEMCMP = @GL_GNULIB_WMEMCMP@ GL_GNULIB_WMEMCPY = @GL_GNULIB_WMEMCPY@ GL_GNULIB_WMEMMOVE = @GL_GNULIB_WMEMMOVE@ GL_GNULIB_WMEMPCPY = @GL_GNULIB_WMEMPCPY@ GL_GNULIB_WMEMSET = @GL_GNULIB_WMEMSET@ GL_GNULIB_WRITE = @GL_GNULIB_WRITE@ GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_TEST_WARN_CFLAGS = @GNULIB_TEST_WARN_CFLAGS@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ GREP = @GREP@ HAVE_ACCEPT4 = @HAVE_ACCEPT4@ HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@ HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@ HAVE_DECL_DIRFD = @HAVE_DECL_DIRFD@ HAVE_DECL_ECVT = @HAVE_DECL_ECVT@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXECVPE = @HAVE_DECL_EXECVPE@ HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ HAVE_DECL_FCLOSEALL = @HAVE_DECL_FCLOSEALL@ HAVE_DECL_FCVT = @HAVE_DECL_FCVT@ HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@ HAVE_DECL_FDOPENDIR = @HAVE_DECL_FDOPENDIR@ HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@ HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@ HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@ HAVE_DECL_GCVT = @HAVE_DECL_GCVT@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@ HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@ HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCSDUP = @HAVE_DECL_WCSDUP@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DIRENT_H = @HAVE_DIRENT_H@ HAVE_DPRINTF = @HAVE_DPRINTF@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_EXECVPE = @HAVE_EXECVPE@ HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHMODAT = @HAVE_FCHMODAT@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FCNTL = @HAVE_FCNTL@ HAVE_FDATASYNC = @HAVE_FDATASYNC@ HAVE_FDOPENDIR = @HAVE_FDOPENDIR@ HAVE_FEATURES_H = @HAVE_FEATURES_H@ HAVE_FFSL = @HAVE_FFSL@ HAVE_FFSLL = @HAVE_FFSLL@ HAVE_FNMATCH = @HAVE_FNMATCH@ HAVE_FNMATCH_H = @HAVE_FNMATCH_H@ HAVE_FREELOCALE = @HAVE_FREELOCALE@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FSTATAT = @HAVE_FSTATAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_FUTIMENS = @HAVE_FUTIMENS@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETENTROPY = @HAVE_GETENTROPY@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETPASS = @HAVE_GETPASS@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ HAVE_GETUMASK = @HAVE_GETUMASK@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISBLANK = @HAVE_ISBLANK@ HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LANGINFO_ALTMON = @HAVE_LANGINFO_ALTMON@ HAVE_LANGINFO_CODESET = @HAVE_LANGINFO_CODESET@ HAVE_LANGINFO_ERA = @HAVE_LANGINFO_ERA@ HAVE_LANGINFO_H = @HAVE_LANGINFO_H@ HAVE_LANGINFO_T_FMT_AMPM = @HAVE_LANGINFO_T_FMT_AMPM@ HAVE_LANGINFO_YESEXPR = @HAVE_LANGINFO_YESEXPR@ HAVE_LCHMOD = @HAVE_LCHMOD@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDIRAT = @HAVE_MKDIRAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ HAVE_MKFIFO = @HAVE_MKFIFO@ HAVE_MKFIFOAT = @HAVE_MKFIFOAT@ HAVE_MKNOD = @HAVE_MKNOD@ HAVE_MKNODAT = @HAVE_MKNODAT@ HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ HAVE_MKSTEMP = @HAVE_MKSTEMP@ HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@ HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@ HAVE_NEWLOCALE = @HAVE_NEWLOCALE@ HAVE_NL_LANGINFO = @HAVE_NL_LANGINFO@ HAVE_OPENAT = @HAVE_OPENAT@ HAVE_OPENDIR = @HAVE_OPENDIR@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PCLOSE = @HAVE_PCLOSE@ HAVE_PIPE = @HAVE_PIPE@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_POPEN = @HAVE_POPEN@ HAVE_POSIX_MEMALIGN = @HAVE_POSIX_MEMALIGN@ HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PSELECT = @HAVE_PSELECT@ HAVE_PTHREAD_ATTR_DESTROY = @HAVE_PTHREAD_ATTR_DESTROY@ HAVE_PTHREAD_ATTR_GETDETACHSTATE = @HAVE_PTHREAD_ATTR_GETDETACHSTATE@ HAVE_PTHREAD_ATTR_INIT = @HAVE_PTHREAD_ATTR_INIT@ HAVE_PTHREAD_ATTR_SETDETACHSTATE = @HAVE_PTHREAD_ATTR_SETDETACHSTATE@ HAVE_PTHREAD_CONDATTR_DESTROY = @HAVE_PTHREAD_CONDATTR_DESTROY@ HAVE_PTHREAD_CONDATTR_INIT = @HAVE_PTHREAD_CONDATTR_INIT@ HAVE_PTHREAD_COND_BROADCAST = @HAVE_PTHREAD_COND_BROADCAST@ HAVE_PTHREAD_COND_DESTROY = @HAVE_PTHREAD_COND_DESTROY@ HAVE_PTHREAD_COND_INIT = @HAVE_PTHREAD_COND_INIT@ HAVE_PTHREAD_COND_SIGNAL = @HAVE_PTHREAD_COND_SIGNAL@ HAVE_PTHREAD_COND_TIMEDWAIT = @HAVE_PTHREAD_COND_TIMEDWAIT@ HAVE_PTHREAD_COND_WAIT = @HAVE_PTHREAD_COND_WAIT@ HAVE_PTHREAD_CREATE = @HAVE_PTHREAD_CREATE@ HAVE_PTHREAD_CREATE_DETACHED = @HAVE_PTHREAD_CREATE_DETACHED@ HAVE_PTHREAD_DETACH = @HAVE_PTHREAD_DETACH@ HAVE_PTHREAD_EQUAL = @HAVE_PTHREAD_EQUAL@ HAVE_PTHREAD_EXIT = @HAVE_PTHREAD_EXIT@ HAVE_PTHREAD_GETSPECIFIC = @HAVE_PTHREAD_GETSPECIFIC@ HAVE_PTHREAD_H = @HAVE_PTHREAD_H@ HAVE_PTHREAD_JOIN = @HAVE_PTHREAD_JOIN@ HAVE_PTHREAD_KEY_CREATE = @HAVE_PTHREAD_KEY_CREATE@ HAVE_PTHREAD_KEY_DELETE = @HAVE_PTHREAD_KEY_DELETE@ HAVE_PTHREAD_MUTEXATTR_DESTROY = @HAVE_PTHREAD_MUTEXATTR_DESTROY@ HAVE_PTHREAD_MUTEXATTR_GETROBUST = @HAVE_PTHREAD_MUTEXATTR_GETROBUST@ HAVE_PTHREAD_MUTEXATTR_GETTYPE = @HAVE_PTHREAD_MUTEXATTR_GETTYPE@ HAVE_PTHREAD_MUTEXATTR_INIT = @HAVE_PTHREAD_MUTEXATTR_INIT@ HAVE_PTHREAD_MUTEXATTR_SETROBUST = @HAVE_PTHREAD_MUTEXATTR_SETROBUST@ HAVE_PTHREAD_MUTEXATTR_SETTYPE = @HAVE_PTHREAD_MUTEXATTR_SETTYPE@ HAVE_PTHREAD_MUTEX_DESTROY = @HAVE_PTHREAD_MUTEX_DESTROY@ HAVE_PTHREAD_MUTEX_INIT = @HAVE_PTHREAD_MUTEX_INIT@ HAVE_PTHREAD_MUTEX_LOCK = @HAVE_PTHREAD_MUTEX_LOCK@ HAVE_PTHREAD_MUTEX_RECURSIVE = @HAVE_PTHREAD_MUTEX_RECURSIVE@ HAVE_PTHREAD_MUTEX_ROBUST = @HAVE_PTHREAD_MUTEX_ROBUST@ HAVE_PTHREAD_MUTEX_TIMEDLOCK = @HAVE_PTHREAD_MUTEX_TIMEDLOCK@ HAVE_PTHREAD_MUTEX_TRYLOCK = @HAVE_PTHREAD_MUTEX_TRYLOCK@ HAVE_PTHREAD_MUTEX_UNLOCK = @HAVE_PTHREAD_MUTEX_UNLOCK@ HAVE_PTHREAD_ONCE = @HAVE_PTHREAD_ONCE@ HAVE_PTHREAD_PROCESS_SHARED = @HAVE_PTHREAD_PROCESS_SHARED@ HAVE_PTHREAD_RWLOCKATTR_DESTROY = @HAVE_PTHREAD_RWLOCKATTR_DESTROY@ HAVE_PTHREAD_RWLOCKATTR_INIT = @HAVE_PTHREAD_RWLOCKATTR_INIT@ HAVE_PTHREAD_RWLOCK_DESTROY = @HAVE_PTHREAD_RWLOCK_DESTROY@ HAVE_PTHREAD_RWLOCK_INIT = @HAVE_PTHREAD_RWLOCK_INIT@ HAVE_PTHREAD_RWLOCK_RDLOCK = @HAVE_PTHREAD_RWLOCK_RDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@ HAVE_PTHREAD_RWLOCK_TRYRDLOCK = @HAVE_PTHREAD_RWLOCK_TRYRDLOCK@ HAVE_PTHREAD_RWLOCK_TRYWRLOCK = @HAVE_PTHREAD_RWLOCK_TRYWRLOCK@ HAVE_PTHREAD_RWLOCK_UNLOCK = @HAVE_PTHREAD_RWLOCK_UNLOCK@ HAVE_PTHREAD_RWLOCK_WRLOCK = @HAVE_PTHREAD_RWLOCK_WRLOCK@ HAVE_PTHREAD_SELF = @HAVE_PTHREAD_SELF@ HAVE_PTHREAD_SETSPECIFIC = @HAVE_PTHREAD_SETSPECIFIC@ HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@ HAVE_PTHREAD_SPINLOCK_T = @HAVE_PTHREAD_SPINLOCK_T@ HAVE_PTHREAD_SPIN_DESTROY = @HAVE_PTHREAD_SPIN_DESTROY@ HAVE_PTHREAD_SPIN_INIT = @HAVE_PTHREAD_SPIN_INIT@ HAVE_PTHREAD_SPIN_LOCK = @HAVE_PTHREAD_SPIN_LOCK@ HAVE_PTHREAD_SPIN_TRYLOCK = @HAVE_PTHREAD_SPIN_TRYLOCK@ HAVE_PTHREAD_SPIN_UNLOCK = @HAVE_PTHREAD_SPIN_UNLOCK@ HAVE_PTHREAD_T = @HAVE_PTHREAD_T@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RAISE = @HAVE_RAISE@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READDIR = @HAVE_READDIR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RENAMEAT = @HAVE_RENAMEAT@ HAVE_REWINDDIR = @HAVE_REWINDDIR@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SA_FAMILY_T = @HAVE_SA_FAMILY_T@ HAVE_SCANDIR = @HAVE_SCANDIR@ HAVE_SCHED_H = @HAVE_SCHED_H@ HAVE_SCHED_YIELD = @HAVE_SCHED_YIELD@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ HAVE_SETSTATE = @HAVE_SETSTATE@ HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@ HAVE_SIGACTION = @HAVE_SIGACTION@ HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@ HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRTOL = @HAVE_STRTOL@ HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOUL = @HAVE_STRTOUL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRUCT_SCHED_PARAM = @HAVE_STRUCT_SCHED_PARAM@ HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@ HAVE_STRUCT_SOCKADDR_STORAGE = @HAVE_STRUCT_SOCKADDR_STORAGE@ HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = @HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_IOCTL_H = @HAVE_SYS_IOCTL_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@ HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_SYS_UIO_H = @HAVE_SYS_UIO_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@ HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_VDPRINTF = @HAVE_VDPRINTF@ HAVE_VISIBILITY = @HAVE_VISIBILITY@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCPCPY = @HAVE_WCPCPY@ HAVE_WCPNCPY = @HAVE_WCPNCPY@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ HAVE_WCSCASECMP = @HAVE_WCSCASECMP@ HAVE_WCSCAT = @HAVE_WCSCAT@ HAVE_WCSCHR = @HAVE_WCSCHR@ HAVE_WCSCMP = @HAVE_WCSCMP@ HAVE_WCSCOLL = @HAVE_WCSCOLL@ HAVE_WCSCPY = @HAVE_WCSCPY@ HAVE_WCSCSPN = @HAVE_WCSCSPN@ HAVE_WCSDUP = @HAVE_WCSDUP@ HAVE_WCSFTIME = @HAVE_WCSFTIME@ HAVE_WCSLEN = @HAVE_WCSLEN@ HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@ HAVE_WCSNCAT = @HAVE_WCSNCAT@ HAVE_WCSNCMP = @HAVE_WCSNCMP@ HAVE_WCSNCPY = @HAVE_WCSNCPY@ HAVE_WCSNLEN = @HAVE_WCSNLEN@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSPBRK = @HAVE_WCSPBRK@ HAVE_WCSRCHR = @HAVE_WCSRCHR@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCSSPN = @HAVE_WCSSPN@ HAVE_WCSSTR = @HAVE_WCSSTR@ HAVE_WCSTOK = @HAVE_WCSTOK@ HAVE_WCSWIDTH = @HAVE_WCSWIDTH@ HAVE_WCSXFRM = @HAVE_WCSXFRM@ HAVE_WCTRANS_T = @HAVE_WCTRANS_T@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WCTYPE_T = @HAVE_WCTYPE_T@ HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE_WMEMCHR = @HAVE_WMEMCHR@ HAVE_WMEMCMP = @HAVE_WMEMCMP@ HAVE_WMEMCPY = @HAVE_WMEMCPY@ HAVE_WMEMMOVE = @HAVE_WMEMMOVE@ HAVE_WMEMPCPY = @HAVE_WMEMPCPY@ HAVE_WMEMSET = @HAVE_WMEMSET@ HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@ HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HAVE__EXIT = @HAVE__EXIT@ HOST_CPU = @HOST_CPU@ HOST_CPU_C_ABI = @HOST_CPU_C_ABI@ ICONV_CONST = @ICONV_CONST@ ICONV_H = @ICONV_H@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INET_PTON_LIB = @INET_PTON_LIB@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBCSTACK = @LIBCSTACK@ LIBGREPUTILS_LIBDEPS = @LIBGREPUTILS_LIBDEPS@ LIBGREPUTILS_LTLIBDEPS = @LIBGREPUTILS_LTLIBDEPS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ LIBPMULTITHREAD = @LIBPMULTITHREAD@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBSIGSEGV = @LIBSIGSEGV@ LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@ LIBSOCKET = @LIBSOCKET@ LIBSTDTHREAD = @LIBSTDTHREAD@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ LIBTHREAD = @LIBTHREAD@ LIBUNISTRING_UNISTR_H = @LIBUNISTRING_UNISTR_H@ LIBUNISTRING_UNITYPES_H = @LIBUNISTRING_UNITYPES_H@ LIBUNISTRING_UNIWIDTH_H = @LIBUNISTRING_UNIWIDTH_H@ LIB_HARD_LOCALE = @LIB_HARD_LOCALE@ LIB_MBRTOWC = @LIB_MBRTOWC@ LIB_NANOSLEEP = @LIB_NANOSLEEP@ LIB_NL_LANGINFO = @LIB_NL_LANGINFO@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ LIB_SCHED_YIELD = @LIB_SCHED_YIELD@ LIB_SELECT = @LIB_SELECT@ LIB_SETLOCALE = @LIB_SETLOCALE@ LIB_SETLOCALE_NULL = @LIB_SETLOCALE_NULL@ LIMITS_H = @LIMITS_H@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALENAME_ENHANCE_LOCALE_FUNCS = @LOCALENAME_ENHANCE_LOCALE_FUNCS@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBCSTACK = @LTLIBCSTACK@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ LTLIBSIGSEGV = @LTLIBSIGSEGV@ LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ NETINET_IN_H = @NETINET_IN_H@ NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_CTYPE_H@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H = @NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@ NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@ NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H = @NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H@ NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H = @NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H@ NEXT_AS_FIRST_DIRECTIVE_SCHED_H = @NEXT_AS_FIRST_DIRECTIVE_SCHED_H@ NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@ NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_CTYPE_H = @NEXT_CTYPE_H@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_FNMATCH_H = @NEXT_FNMATCH_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ NEXT_LANGINFO_H = @NEXT_LANGINFO_H@ NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@ NEXT_PTHREAD_H = @NEXT_PTHREAD_H@ NEXT_SCHED_H = @NEXT_SCHED_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_IOCTL_H = @NEXT_SYS_IOCTL_H@ NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@ NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@ NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NEXT_WCHAR_H = @NEXT_WCHAR_H@ NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_LIBS = @PCRE_LIBS@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ PRAGMA_COLUMNS = @PRAGMA_COLUMNS@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ PRIPTR_PREFIX = @PRIPTR_PREFIX@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_ACCESS = @REPLACE_ACCESS@ REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@ REPLACE_BTOWC = @REPLACE_BTOWC@ REPLACE_CALLOC = @REPLACE_CALLOC@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@ REPLACE_CREAT = @REPLACE_CREAT@ REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ REPLACE_EXECL = @REPLACE_EXECL@ REPLACE_EXECLE = @REPLACE_EXECLE@ REPLACE_EXECLP = @REPLACE_EXECLP@ REPLACE_EXECV = @REPLACE_EXECV@ REPLACE_EXECVE = @REPLACE_EXECVE@ REPLACE_EXECVP = @REPLACE_EXECVP@ REPLACE_EXECVPE = @REPLACE_EXECVPE@ REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHMODAT = @REPLACE_FCHMODAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ REPLACE_FDOPEN = @REPLACE_FDOPEN@ REPLACE_FDOPENDIR = @REPLACE_FDOPENDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ REPLACE_FFSLL = @REPLACE_FFSLL@ REPLACE_FNMATCH = @REPLACE_FNMATCH@ REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ REPLACE_FPURGE = @REPLACE_FPURGE@ REPLACE_FREE = @REPLACE_FREE@ REPLACE_FREELOCALE = @REPLACE_FREELOCALE@ REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FSEEK = @REPLACE_FSEEK@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FSTAT = @REPLACE_FSTAT@ REPLACE_FSTATAT = @REPLACE_FSTATAT@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@ REPLACE_FUTIMENS = @REPLACE_FUTIMENS@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETDELIM = @REPLACE_GETDELIM@ REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ REPLACE_GETDTABLESIZE = @REPLACE_GETDTABLESIZE@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETLINE = @REPLACE_GETLINE@ REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETPASS = @REPLACE_GETPASS@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ REPLACE_GMTIME = @REPLACE_GMTIME@ REPLACE_ICONV = @REPLACE_ICONV@ REPLACE_ICONV_OPEN = @REPLACE_ICONV_OPEN@ REPLACE_ICONV_UTF = @REPLACE_ICONV_UTF@ REPLACE_INET_NTOP = @REPLACE_INET_NTOP@ REPLACE_INET_PTON = @REPLACE_INET_PTON@ REPLACE_INITSTATE = @REPLACE_INITSTATE@ REPLACE_IOCTL = @REPLACE_IOCTL@ REPLACE_ISATTY = @REPLACE_ISATTY@ REPLACE_ISWBLANK = @REPLACE_ISWBLANK@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_ISWDIGIT = @REPLACE_ISWDIGIT@ REPLACE_ISWXDIGIT = @REPLACE_ISWXDIGIT@ REPLACE_ITOLD = @REPLACE_ITOLD@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LOCALECONV = @REPLACE_LOCALECONV@ REPLACE_LOCALTIME = @REPLACE_LOCALTIME@ REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_LSTAT = @REPLACE_LSTAT@ REPLACE_MALLOC = @REPLACE_MALLOC@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ REPLACE_MBSINIT = @REPLACE_MBSINIT@ REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@ REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@ REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@ REPLACE_MBTOWC = @REPLACE_MBTOWC@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKDIR = @REPLACE_MKDIR@ REPLACE_MKFIFO = @REPLACE_MKFIFO@ REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@ REPLACE_MKNOD = @REPLACE_MKNOD@ REPLACE_MKNODAT = @REPLACE_MKNODAT@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_MKTIME = @REPLACE_MKTIME@ REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ REPLACE_NEWLOCALE = @REPLACE_NEWLOCALE@ REPLACE_NL_LANGINFO = @REPLACE_NL_LANGINFO@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ REPLACE_OPEN = @REPLACE_OPEN@ REPLACE_OPENAT = @REPLACE_OPENAT@ REPLACE_OPENDIR = @REPLACE_OPENDIR@ REPLACE_PERROR = @REPLACE_PERROR@ REPLACE_POPEN = @REPLACE_POPEN@ REPLACE_POSIX_MEMALIGN = @REPLACE_POSIX_MEMALIGN@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PRINTF = @REPLACE_PRINTF@ REPLACE_PSELECT = @REPLACE_PSELECT@ REPLACE_PTHREAD_ATTR_DESTROY = @REPLACE_PTHREAD_ATTR_DESTROY@ REPLACE_PTHREAD_ATTR_GETDETACHSTATE = @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@ REPLACE_PTHREAD_ATTR_INIT = @REPLACE_PTHREAD_ATTR_INIT@ REPLACE_PTHREAD_ATTR_SETDETACHSTATE = @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@ REPLACE_PTHREAD_CONDATTR_DESTROY = @REPLACE_PTHREAD_CONDATTR_DESTROY@ REPLACE_PTHREAD_CONDATTR_INIT = @REPLACE_PTHREAD_CONDATTR_INIT@ REPLACE_PTHREAD_COND_BROADCAST = @REPLACE_PTHREAD_COND_BROADCAST@ REPLACE_PTHREAD_COND_DESTROY = @REPLACE_PTHREAD_COND_DESTROY@ REPLACE_PTHREAD_COND_INIT = @REPLACE_PTHREAD_COND_INIT@ REPLACE_PTHREAD_COND_SIGNAL = @REPLACE_PTHREAD_COND_SIGNAL@ REPLACE_PTHREAD_COND_TIMEDWAIT = @REPLACE_PTHREAD_COND_TIMEDWAIT@ REPLACE_PTHREAD_COND_WAIT = @REPLACE_PTHREAD_COND_WAIT@ REPLACE_PTHREAD_CREATE = @REPLACE_PTHREAD_CREATE@ REPLACE_PTHREAD_DETACH = @REPLACE_PTHREAD_DETACH@ REPLACE_PTHREAD_EQUAL = @REPLACE_PTHREAD_EQUAL@ REPLACE_PTHREAD_EXIT = @REPLACE_PTHREAD_EXIT@ REPLACE_PTHREAD_GETSPECIFIC = @REPLACE_PTHREAD_GETSPECIFIC@ REPLACE_PTHREAD_JOIN = @REPLACE_PTHREAD_JOIN@ REPLACE_PTHREAD_KEY_CREATE = @REPLACE_PTHREAD_KEY_CREATE@ REPLACE_PTHREAD_KEY_DELETE = @REPLACE_PTHREAD_KEY_DELETE@ REPLACE_PTHREAD_MUTEXATTR_DESTROY = @REPLACE_PTHREAD_MUTEXATTR_DESTROY@ REPLACE_PTHREAD_MUTEXATTR_GETROBUST = @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@ REPLACE_PTHREAD_MUTEXATTR_GETTYPE = @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@ REPLACE_PTHREAD_MUTEXATTR_INIT = @REPLACE_PTHREAD_MUTEXATTR_INIT@ REPLACE_PTHREAD_MUTEXATTR_SETROBUST = @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@ REPLACE_PTHREAD_MUTEXATTR_SETTYPE = @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@ REPLACE_PTHREAD_MUTEX_DESTROY = @REPLACE_PTHREAD_MUTEX_DESTROY@ REPLACE_PTHREAD_MUTEX_INIT = @REPLACE_PTHREAD_MUTEX_INIT@ REPLACE_PTHREAD_MUTEX_LOCK = @REPLACE_PTHREAD_MUTEX_LOCK@ REPLACE_PTHREAD_MUTEX_TIMEDLOCK = @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@ REPLACE_PTHREAD_MUTEX_TRYLOCK = @REPLACE_PTHREAD_MUTEX_TRYLOCK@ REPLACE_PTHREAD_MUTEX_UNLOCK = @REPLACE_PTHREAD_MUTEX_UNLOCK@ REPLACE_PTHREAD_ONCE = @REPLACE_PTHREAD_ONCE@ REPLACE_PTHREAD_RWLOCKATTR_DESTROY = @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@ REPLACE_PTHREAD_RWLOCKATTR_INIT = @REPLACE_PTHREAD_RWLOCKATTR_INIT@ REPLACE_PTHREAD_RWLOCK_DESTROY = @REPLACE_PTHREAD_RWLOCK_DESTROY@ REPLACE_PTHREAD_RWLOCK_INIT = @REPLACE_PTHREAD_RWLOCK_INIT@ REPLACE_PTHREAD_RWLOCK_RDLOCK = @REPLACE_PTHREAD_RWLOCK_RDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@ REPLACE_PTHREAD_RWLOCK_TRYRDLOCK = @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@ REPLACE_PTHREAD_RWLOCK_TRYWRLOCK = @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@ REPLACE_PTHREAD_RWLOCK_UNLOCK = @REPLACE_PTHREAD_RWLOCK_UNLOCK@ REPLACE_PTHREAD_RWLOCK_WRLOCK = @REPLACE_PTHREAD_RWLOCK_WRLOCK@ REPLACE_PTHREAD_SELF = @REPLACE_PTHREAD_SELF@ REPLACE_PTHREAD_SETSPECIFIC = @REPLACE_PTHREAD_SETSPECIFIC@ REPLACE_PTHREAD_SIGMASK = @REPLACE_PTHREAD_SIGMASK@ REPLACE_PTHREAD_SPIN_DESTROY = @REPLACE_PTHREAD_SPIN_DESTROY@ REPLACE_PTHREAD_SPIN_INIT = @REPLACE_PTHREAD_SPIN_INIT@ REPLACE_PTHREAD_SPIN_LOCK = @REPLACE_PTHREAD_SPIN_LOCK@ REPLACE_PTHREAD_SPIN_TRYLOCK = @REPLACE_PTHREAD_SPIN_TRYLOCK@ REPLACE_PTHREAD_SPIN_UNLOCK = @REPLACE_PTHREAD_SPIN_UNLOCK@ REPLACE_PTSNAME = @REPLACE_PTSNAME@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RAISE = @REPLACE_RAISE@ REPLACE_RANDOM = @REPLACE_RANDOM@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SCHED_YIELD = @REPLACE_SCHED_YIELD@ REPLACE_SELECT = @REPLACE_SELECT@ REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SETLOCALE = @REPLACE_SETLOCALE@ REPLACE_SETSTATE = @REPLACE_SETSTATE@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ REPLACE_STAT = @REPLACE_STAT@ REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@ REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRTOL = @REPLACE_STRTOL@ REPLACE_STRTOLD = @REPLACE_STRTOLD@ REPLACE_STRTOLL = @REPLACE_STRTOLL@ REPLACE_STRTOUL = @REPLACE_STRTOUL@ REPLACE_STRTOULL = @REPLACE_STRTOULL@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TOWLOWER = @REPLACE_TOWLOWER@ REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_TZSET = @REPLACE_TZSET@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VDPRINTF = @REPLACE_VDPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ REPLACE_WCSTOK = @REPLACE_WCSTOK@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ REPLACE_WCTOMB = @REPLACE_WCTOMB@ REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIGSEGV_H = @SIGSEGV_H@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STDALIGN_H = @STDALIGN_H@ STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_IOCTL_H_HAVE_WINSOCK2_H = @SYS_IOCTL_H_HAVE_WINSOCK2_H@ SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@ UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WERROR_CFLAGS = @WERROR_CFLAGS@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@ WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_aux_dir = @abs_aux_dir@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS) $(WERROR_CFLAGS) AUTOMAKE_OPTIONS = 1.11 foreign subdir-objects SUBDIRS = . TESTS_ENVIRONMENT = EXEEXT='@EXEEXT@' srcdir='$(srcdir)' \ LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LIBSIGSEGV='@LIBSIGSEGV@' LOCALE_FR='@LOCALE_FR@' \ LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' \ LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' abs_aux_dir='$(abs_aux_dir)' \ MAKE='$(MAKE)' LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' noinst_HEADERS = noinst_LIBRARIES = check_LIBRARIES = libtests.a EXTRA_DIST = accept.c w32sock.h test-accept.c signature.h macros.h \ test-alignof.c test-alloca-opt.c test-argmatch.c macros.h \ arpa_inet.in.h test-arpa_inet.c test-binary-io.sh \ test-binary-io.c macros.h bind.c w32sock.h test-bind.c \ signature.h macros.h test-bitrotate.c macros.h test-btowc1.sh \ test-btowc2.sh test-btowc.c signature.h macros.h \ test-c-ctype.c macros.h test-c-stack.c test-c-stack.sh \ test-c-stack2.sh macros.h test-c-strcase.sh \ test-c-strcasecmp.c test-c-strncasecmp.c macros.h \ test-calloc-gnu.c macros.h test-chdir.c signature.h macros.h \ test-cloexec.c macros.h test-close.c signature.h macros.h \ connect.c w32sock.h test-connect.c signature.h macros.h \ test-ctype.c test-dfa-match.sh test-dfa-match-aux.c \ test-dfa-invalid-char-class.sh test-dfa-invalid-merge.sh \ test-dirent.c test-dup.c signature.h macros.h test-dup2.c \ signature.h macros.h test-dynarray.c macros.h test-environ.c \ test-errno.c test-exclude.c test-exclude1.sh test-exclude2.sh \ test-exclude3.sh test-exclude4.sh test-exclude5.sh \ test-exclude6.sh test-exclude7.sh test-exclude8.sh \ test-fchdir.c signature.h macros.h test-fcntl-h.c test-open.h \ test-fcntl-safer.c macros.h test-fcntl.c signature.h macros.h \ fdopen.c test-fdopen.c signature.h macros.h test-fdopendir.c \ signature.h macros.h test-fgetc.c signature.h macros.h float.c \ float.in.h itold.c test-float.c macros.h test-fnmatch-h.c \ test-fnmatch.c signature.h macros.h test-fopen-gnu.c macros.h \ test-fopen.h test-fopen.c signature.h macros.h test-fpending.c \ test-fpending.sh macros.h fpucw.h test-fputc.c signature.h \ macros.h test-fread.c signature.h macros.h test-free.c \ macros.h test-fstat.c signature.h macros.h test-fstatat.c \ test-lstat.h test-stat.h signature.h macros.h ftruncate.c \ test-ftruncate.c test-ftruncate.sh signature.h macros.h \ test-fwrite.c signature.h macros.h test-getcwd-lgpl.c \ signature.h macros.h test-getdtablesize.c signature.h macros.h \ macros.h signature.h test-getopt-gnu.c test-getopt-main.h \ test-getopt.h test-getopt_long.h macros.h signature.h \ test-getopt-posix.c test-getopt-main.h test-getopt.h \ test-getprogname.c gettimeofday.c signature.h \ test-gettimeofday.c test-hard-locale.c locale.c test-hash.c \ macros.h test-i-ring.c macros.h test-iconv-h.c test-iconv.c \ signature.h macros.h test-ignore-value.c inet_pton.c \ test-inet_pton.c signature.h macros.h test-intprops.c macros.h \ anytostr.c inttostr.h macros.h test-inttostr.c test-inttypes.c \ ioctl.c w32sock.h test-ioctl.c signature.h macros.h \ test-isatty.c signature.h macros.h test-isblank.c signature.h \ macros.h test-iswblank.c macros.h test-iswdigit.sh \ test-iswdigit.c signature.h macros.h test-iswxdigit.sh \ test-iswxdigit.c signature.h macros.h test-langinfo.c \ test-limits-h.c listen.c w32sock.h test-listen.c signature.h \ macros.h test-localcharset.c test-locale.c test-localeconv.c \ signature.h macros.h localename-table.h localename.h \ test-localename.c macros.h test-lseek.c test-lseek.sh \ signature.h macros.h test-lstat.h test-lstat.c signature.h \ macros.h test-malloc-gnu.c macros.h test-malloca.c \ test-mbscasecmp.sh test-mbscasecmp.c macros.h test-mbsinit.sh \ test-mbsinit.c signature.h macros.h test-mbsrtowcs1.sh \ test-mbsrtowcs2.sh test-mbsrtowcs3.sh test-mbsrtowcs4.sh \ test-mbsrtowcs.c signature.h macros.h test-mbsstr1.c \ test-mbsstr2.sh test-mbsstr2.c test-mbsstr3.sh test-mbsstr3.c \ macros.h test-memchr.c zerosize-ptr.h signature.h macros.h \ test-memchr2.c zerosize-ptr.h macros.h test-memrchr.c \ zerosize-ptr.h signature.h macros.h nanosleep.c \ test-nanosleep.c signature.h macros.h netinet_in.in.h \ test-netinet_in.c test-nl_langinfo.sh test-nl_langinfo.c \ test-nl_langinfo-mt.c signature.h macros.h test-open.h \ test-open.c signature.h macros.h test-openat-safer.c macros.h \ test-openat.c test-open.h signature.h macros.h test-pathmax.c \ perror.c macros.h signature.h test-perror.c test-perror2.c \ test-perror.sh test-pipe.c signature.h macros.h pthread.in.h \ test-pthread.c pthread-thread.c test-pthread-thread.c macros.h \ pthread_sigmask.c test-pthread_sigmask1.c \ test-pthread_sigmask2.c signature.h macros.h putenv.c \ test-quotearg-simple.c test-quotearg.h macros.h zerosize-ptr.h \ test-raise.c signature.h macros.h test-rawmemchr.c \ zerosize-ptr.h signature.h macros.h test-read.c signature.h \ macros.h test-realloc-gnu.c macros.h test-reallocarray.c \ signature.h macros.h test-regex.c macros.h sched.in.h \ test-sched.c select.c macros.h signature.h test-select.c \ test-select.h test-select-fd.c test-select-in.sh \ test-select-out.sh test-select-stdin.c setenv.c test-setenv.c \ signature.h macros.h setlocale.c test-setlocale_null.c \ test-setlocale_null-mt-one.c test-setlocale_null-mt-all.c \ test-setlocale1.sh test-setlocale1.c test-setlocale2.sh \ test-setlocale2.c signature.h macros.h setsockopt.c w32sock.h \ test-setsockopt.c signature.h macros.h sig-handler.h \ sigaction.c test-sigaction.c signature.h macros.h \ test-signal-h.c sigprocmask.c test-sigprocmask.c signature.h \ macros.h test-sigsegv-catch-segv1.c test-sigsegv-catch-segv2.c \ test-sigsegv-catch-stackoverflow1.c \ test-sigsegv-catch-stackoverflow2.c altstack-util.h \ mmap-anon-util.h sleep.c test-sleep.c signature.h macros.h \ _Noreturn.h arg-nonnull.h c++defs.h warn-on-use.h snprintf.c \ test-snprintf.c signature.h macros.h socket.c w32sock.h \ w32sock.h test-sockets.c test-stat.h test-stat.c signature.h \ macros.h test-stat-time.c macros.h nap.h test-stdalign.c \ macros.h test-stdbool.c test-stddef.c test-stdint.c \ test-stdio.c test-stdlib.c test-sys_wait.h test-strerror.c \ signature.h macros.h strerror_r.c test-strerror_r.c \ signature.h macros.h test-striconv.c macros.h test-string.c \ test-strnlen.c zerosize-ptr.h signature.h macros.h \ test-strstr.c zerosize-ptr.h signature.h macros.h \ test-strtoimax.c signature.h macros.h test-strtoll.c \ signature.h macros.h test-strtoull.c signature.h macros.h \ test-strtoumax.c signature.h macros.h symlink.c test-symlink.h \ test-symlink.c signature.h macros.h sys_ioctl.in.h \ test-sys_ioctl.c sys_select.in.h test-sys_select.c signature.h \ sys_socket.in.h test-sys_socket.c test-sys_stat.c \ sys_time.in.h test-sys_time.c test-sys_types.c sys_uio.in.h \ test-sys_uio.c init.sh test-init.sh thread-optim.h \ test-thread_self.c test-thread_create.c macros.h test-time.c \ test-dup-safer.c macros.h test-unistd.c \ unistr/test-u8-mbtoucr.c macros.h unistr/test-u8-uctomb.c \ macros.h uniwidth/test-uc_width.c uniwidth/test-uc_width2.c \ uniwidth/test-uc_width2.sh macros.h unsetenv.c test-unsetenv.c \ signature.h macros.h asnprintf.c float+.h printf-args.c \ printf-args.h printf-parse.c printf-parse.h vasnprintf.c \ vasnprintf.h test-vasnprintf.c macros.h \ test-vc-list-files-git.sh test-vc-list-files-cvs.sh \ test-verify.c test-verify-try.c test-verify.sh \ test-version-etc.c test-version-etc.sh test-wchar.c \ test-wcrtomb.sh test-wcrtomb.c test-wcrtomb-w32-1.sh \ test-wcrtomb-w32-2.sh test-wcrtomb-w32-3.sh \ test-wcrtomb-w32-4.sh test-wcrtomb-w32-5.sh \ test-wcrtomb-w32-6.sh test-wcrtomb-w32-7.sh test-wcrtomb-w32.c \ signature.h macros.h test-wctype-h.c macros.h test-wcwidth.c \ signature.h macros.h windows-thread.c windows-thread.h \ windows-tls.c windows-tls.h test-xalloc-die.c \ test-xalloc-die.sh test-xstrtoimax.c test-xstrtoimax.sh \ xstrtol-error.h test-xstrtol.c test-xstrtoul.c test-xstrtol.sh BUILT_SOURCES = arpa/inet.h $(FLOAT_H) $(NETINET_IN_H) pthread.h \ sched.h sys/ioctl.h sys/select.h sys/socket.h sys/time.h \ sys/uio.h SUFFIXES = # This test expects compilation of test-verify-try.c to fail, and # each time it fails, the makefile rule does not perform the usual # "mv -f $name.Tpo $name.po, so tell make clean to remove that file. MOSTLYCLEANFILES = core *.stackdump arpa/inet.h arpa/inet.h-t \ t-c-stack.tmp t-c-stack2.tmp float.h float.h-t test-fpending.t \ netinet/in.h netinet/in.h-t pthread.h pthread.h-t sched.h \ sched.h-t sys/ioctl.h sys/ioctl.h-t sys/select.h \ sys/select.h-t sys/socket.h sys/socket.h-t sys/time.h \ sys/time.h-t sys/uio.h sys/uio.h-t .deps/test-verify-try.Tpo MOSTLYCLEANDIRS = arpa netinet sys sys sys sys CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = CXXFLAGS = @GL_CXXFLAG_ALLOW_WARNINGS@ @CXXFLAGS@ AM_CPPFLAGS = \ -D@gltests_WITNESS@=1 \ -I. -I$(srcdir) \ -I.. -I$(srcdir)/.. \ -I../lib -I$(srcdir)/../lib LDADD = libtests.a ../lib/libgreputils.a libtests.a ../lib/libgreputils.a libtests.a $(LIBTESTS_LIBDEPS) libtests_a_SOURCES = hash-pjw.h hash-pjw.c imaxtostr.c inttostr.c \ offtostr.c uinttostr.c umaxtostr.c localename.c \ localename-table.c sig-handler.c size_max.h sockets.h \ sockets.c sys_socket.c glthread/thread.h glthread/thread.c \ xsize.h xsize.c xstrtol-error.c libtests_a_LIBADD = $(gltests_LIBOBJS) libtests_a_DEPENDENCIES = $(gltests_LIBOBJS) EXTRA_libtests_a_SOURCES = accept.c bind.c connect.c fdopen.c float.c \ itold.c ftruncate.c gettimeofday.c inet_pton.c anytostr.c \ ioctl.c listen.c nanosleep.c perror.c pthread-thread.c \ pthread_sigmask.c putenv.c select.c setenv.c setlocale.c \ setsockopt.c sigaction.c sigprocmask.c sleep.c snprintf.c \ socket.c strerror_r.c symlink.c unsetenv.c asnprintf.c \ printf-args.c printf-parse.c vasnprintf.c windows-thread.c \ windows-tls.c AM_LIBTOOLFLAGS = --preserve-dup-deps test_accept_LDADD = $(LDADD) @LIBSOCKET@ test_argmatch_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC) test_bind_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB) test_btowc_LDADD = $(LDADD) $(LIB_SETLOCALE) test_c_ctype_LDADD = $(LDADD) $(LIB_SETLOCALE) test_c_stack_LDADD = $(LDADD) $(LIBCSTACK) @LIBINTL@ test_c_strcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) test_c_strncasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) test_connect_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB) test_dfa_match_aux_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIB_MBRTOWC) test_exclude_LDADD = $(LDADD) $(LIBUNISTRING) @LIBINTL@ $(LIB_MBRTOWC) $(LIBTHREAD) test_fchdir_LDADD = $(LDADD) $(LIBINTL) test_fdopendir_LDADD = $(LDADD) @LIBINTL@ test_fnmatch_LDADD = $(LDADD) $(LIB_MBRTOWC) test_fstatat_LDADD = $(LDADD) @LIBINTL@ test_getcwd_lgpl_LDADD = $(LDADD) $(LIBINTL) test_getopt_gnu_LDADD = $(LDADD) $(LIBINTL) test_getopt_posix_LDADD = $(LDADD) $(LIBINTL) test_getprogname_LDADD = $(LDADD) GPERF = gperf V_GPERF = $(V_GPERF_@AM_V@) V_GPERF_ = $(V_GPERF_@AM_DEFAULT_V@) V_GPERF_0 = @echo " GPERF " $@; test_hard_locale_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIB_HARD_LOCALE@ current_locale_SOURCES = locale.c test_iconv_LDADD = $(LDADD) @LIBICONV@ test_inet_pton_LDADD = $(LDADD) @INET_PTON_LIB@ test_iswdigit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) test_iswxdigit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) test_listen_LDADD = $(LDADD) @LIBSOCKET@ test_localcharset_LDADD = $(LDADD) $(LIB_SETLOCALE) test_localename_LDADD = $(LDADD) $(LIB_SETLOCALE) @INTL_MACOSX_LIBS@ $(LIBTHREAD) test_mbscasecmp_LDADD = $(LDADD) $(LIBUNISTRING) $(LIB_SETLOCALE) $(LIB_MBRTOWC) test_mbsinit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) test_mbsrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) test_mbsstr1_LDADD = $(LDADD) $(LIBUNISTRING) $(LIB_MBRTOWC) test_mbsstr2_LDADD = $(LDADD) $(LIBUNISTRING) $(LIB_SETLOCALE) $(LIB_MBRTOWC) test_mbsstr3_LDADD = $(LDADD) $(LIBUNISTRING) $(LIB_SETLOCALE) $(LIB_MBRTOWC) test_nanosleep_LDADD = $(LDADD) $(LIB_NANOSLEEP) test_nl_langinfo_LDADD = $(LDADD) $(LIB_SETLOCALE) test_nl_langinfo_mt_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBMULTITHREAD) $(LIB_NANOSLEEP) test_openat_safer_LDADD = $(LDADD) @LIBINTL@ test_openat_LDADD = $(LDADD) @LIBINTL@ test_pthread_thread_LDADD = $(LDADD) @LIBPMULTITHREAD@ test_pthread_sigmask1_LDADD = $(LDADD) @LIB_PTHREAD_SIGMASK@ test_pthread_sigmask2_LDADD = $(LDADD) @LIB_PTHREAD_SIGMASK@ @LIBMULTITHREAD@ test_quotearg_simple_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC) test_regex_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) @LIBINTL@ $(LIBTHREAD) test_select_LDADD = $(LDADD) @LIB_SELECT@ @LIBSOCKET@ $(INET_PTON_LIB) test_select_fd_LDADD = $(LDADD) @LIB_SELECT@ test_select_stdin_LDADD = $(LDADD) @LIB_SELECT@ test_setlocale_null_LDADD = $(LDADD) @LIB_SETLOCALE_NULL@ test_setlocale_null_mt_one_LDADD = $(LDADD) @LIB_SETLOCALE_NULL@ $(LIBMULTITHREAD) $(LIB_NANOSLEEP) test_setlocale_null_mt_all_LDADD = $(LDADD) @LIB_SETLOCALE_NULL@ $(LIBMULTITHREAD) $(LIB_NANOSLEEP) test_setlocale1_LDADD = $(LDADD) @LIB_SETLOCALE@ test_setlocale2_LDADD = $(LDADD) @LIB_SETLOCALE@ test_setsockopt_LDADD = $(LDADD) @LIBSOCKET@ test_sigsegv_catch_segv1_LDADD = $(LDADD) $(LIBSIGSEGV) test_sigsegv_catch_segv2_LDADD = $(LDADD) $(LIBSIGSEGV) test_sigsegv_catch_stackoverflow1_LDADD = $(LDADD) $(LIBSIGSEGV) test_sigsegv_catch_stackoverflow2_LDADD = $(LDADD) $(LIBSIGSEGV) # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. _NORETURN_H = $(srcdir)/_Noreturn.h # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. ARG_NONNULL_H = $(srcdir)/arg-nonnull.h # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. CXXDEFS_H = $(srcdir)/c++defs.h # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. WARN_ON_USE_H = $(srcdir)/warn-on-use.h test_sockets_LDADD = $(LDADD) @LIBSOCKET@ test_stat_LDADD = $(LDADD) $(LIBINTL) test_stat_time_LDADD = $(LDADD) $(LIB_NANOSLEEP) test_striconv_LDADD = $(LDADD) @LIBICONV@ test_thread_self_LDADD = $(LDADD) @LIBTHREAD@ test_thread_create_LDADD = $(LDADD) @LIBMULTITHREAD@ test_u8_mbtoucr_SOURCES = unistr/test-u8-mbtoucr.c test_u8_mbtoucr_LDADD = $(LDADD) $(LIBUNISTRING) test_u8_uctomb_SOURCES = unistr/test-u8-uctomb.c test_u8_uctomb_LDADD = $(LDADD) $(LIBUNISTRING) test_uc_width_SOURCES = uniwidth/test-uc_width.c test_uc_width_LDADD = $(LDADD) $(LIBUNISTRING) test_uc_width2_SOURCES = uniwidth/test-uc_width2.c test_uc_width2_LDADD = $(LDADD) $(LIBUNISTRING) test_version_etc_LDADD = $(LDADD) @LIBINTL@ test_wcrtomb_LDADD = $(LDADD) $(LIB_SETLOCALE) test_wcwidth_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) test_xalloc_die_LDADD = $(LDADD) @LIBINTL@ test_xstrtoimax_LDADD = $(LDADD) @LIBINTL@ test_xstrtol_LDADD = $(LDADD) @LIBINTL@ test_xstrtoul_LDADD = $(LDADD) @LIBINTL@ all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/gnulib.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gnulib-tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign gnulib-tests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(srcdir)/gnulib.mk $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) clean-checkLIBRARIES: -test -z "$(check_LIBRARIES)" || rm -f $(check_LIBRARIES) clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) glthread/$(am__dirstamp): @$(MKDIR_P) glthread @: > glthread/$(am__dirstamp) glthread/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) glthread/$(DEPDIR) @: > glthread/$(DEPDIR)/$(am__dirstamp) glthread/thread.$(OBJEXT): glthread/$(am__dirstamp) \ glthread/$(DEPDIR)/$(am__dirstamp) libtests.a: $(libtests_a_OBJECTS) $(libtests_a_DEPENDENCIES) $(EXTRA_libtests_a_DEPENDENCIES) $(AM_V_at)-rm -f libtests.a $(AM_V_AR)$(libtests_a_AR) libtests.a $(libtests_a_OBJECTS) $(libtests_a_LIBADD) $(AM_V_at)$(RANLIB) libtests.a current-locale$(EXEEXT): $(current_locale_OBJECTS) $(current_locale_DEPENDENCIES) $(EXTRA_current_locale_DEPENDENCIES) @rm -f current-locale$(EXEEXT) $(AM_V_CCLD)$(LINK) $(current_locale_OBJECTS) $(current_locale_LDADD) $(LIBS) test-accept$(EXEEXT): $(test_accept_OBJECTS) $(test_accept_DEPENDENCIES) $(EXTRA_test_accept_DEPENDENCIES) @rm -f test-accept$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_accept_OBJECTS) $(test_accept_LDADD) $(LIBS) test-alignof$(EXEEXT): $(test_alignof_OBJECTS) $(test_alignof_DEPENDENCIES) $(EXTRA_test_alignof_DEPENDENCIES) @rm -f test-alignof$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_alignof_OBJECTS) $(test_alignof_LDADD) $(LIBS) test-alloca-opt$(EXEEXT): $(test_alloca_opt_OBJECTS) $(test_alloca_opt_DEPENDENCIES) $(EXTRA_test_alloca_opt_DEPENDENCIES) @rm -f test-alloca-opt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_alloca_opt_OBJECTS) $(test_alloca_opt_LDADD) $(LIBS) test-argmatch$(EXEEXT): $(test_argmatch_OBJECTS) $(test_argmatch_DEPENDENCIES) $(EXTRA_test_argmatch_DEPENDENCIES) @rm -f test-argmatch$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_argmatch_OBJECTS) $(test_argmatch_LDADD) $(LIBS) test-arpa_inet$(EXEEXT): $(test_arpa_inet_OBJECTS) $(test_arpa_inet_DEPENDENCIES) $(EXTRA_test_arpa_inet_DEPENDENCIES) @rm -f test-arpa_inet$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_arpa_inet_OBJECTS) $(test_arpa_inet_LDADD) $(LIBS) test-binary-io$(EXEEXT): $(test_binary_io_OBJECTS) $(test_binary_io_DEPENDENCIES) $(EXTRA_test_binary_io_DEPENDENCIES) @rm -f test-binary-io$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_binary_io_OBJECTS) $(test_binary_io_LDADD) $(LIBS) test-bind$(EXEEXT): $(test_bind_OBJECTS) $(test_bind_DEPENDENCIES) $(EXTRA_test_bind_DEPENDENCIES) @rm -f test-bind$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_bind_OBJECTS) $(test_bind_LDADD) $(LIBS) test-bitrotate$(EXEEXT): $(test_bitrotate_OBJECTS) $(test_bitrotate_DEPENDENCIES) $(EXTRA_test_bitrotate_DEPENDENCIES) @rm -f test-bitrotate$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_bitrotate_OBJECTS) $(test_bitrotate_LDADD) $(LIBS) test-btowc$(EXEEXT): $(test_btowc_OBJECTS) $(test_btowc_DEPENDENCIES) $(EXTRA_test_btowc_DEPENDENCIES) @rm -f test-btowc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_btowc_OBJECTS) $(test_btowc_LDADD) $(LIBS) test-c-ctype$(EXEEXT): $(test_c_ctype_OBJECTS) $(test_c_ctype_DEPENDENCIES) $(EXTRA_test_c_ctype_DEPENDENCIES) @rm -f test-c-ctype$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_c_ctype_OBJECTS) $(test_c_ctype_LDADD) $(LIBS) test-c-stack$(EXEEXT): $(test_c_stack_OBJECTS) $(test_c_stack_DEPENDENCIES) $(EXTRA_test_c_stack_DEPENDENCIES) @rm -f test-c-stack$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_c_stack_OBJECTS) $(test_c_stack_LDADD) $(LIBS) test-c-strcasecmp$(EXEEXT): $(test_c_strcasecmp_OBJECTS) $(test_c_strcasecmp_DEPENDENCIES) $(EXTRA_test_c_strcasecmp_DEPENDENCIES) @rm -f test-c-strcasecmp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_c_strcasecmp_OBJECTS) $(test_c_strcasecmp_LDADD) $(LIBS) test-c-strncasecmp$(EXEEXT): $(test_c_strncasecmp_OBJECTS) $(test_c_strncasecmp_DEPENDENCIES) $(EXTRA_test_c_strncasecmp_DEPENDENCIES) @rm -f test-c-strncasecmp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_c_strncasecmp_OBJECTS) $(test_c_strncasecmp_LDADD) $(LIBS) test-calloc-gnu$(EXEEXT): $(test_calloc_gnu_OBJECTS) $(test_calloc_gnu_DEPENDENCIES) $(EXTRA_test_calloc_gnu_DEPENDENCIES) @rm -f test-calloc-gnu$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_calloc_gnu_OBJECTS) $(test_calloc_gnu_LDADD) $(LIBS) test-chdir$(EXEEXT): $(test_chdir_OBJECTS) $(test_chdir_DEPENDENCIES) $(EXTRA_test_chdir_DEPENDENCIES) @rm -f test-chdir$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_chdir_OBJECTS) $(test_chdir_LDADD) $(LIBS) test-cloexec$(EXEEXT): $(test_cloexec_OBJECTS) $(test_cloexec_DEPENDENCIES) $(EXTRA_test_cloexec_DEPENDENCIES) @rm -f test-cloexec$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_cloexec_OBJECTS) $(test_cloexec_LDADD) $(LIBS) test-close$(EXEEXT): $(test_close_OBJECTS) $(test_close_DEPENDENCIES) $(EXTRA_test_close_DEPENDENCIES) @rm -f test-close$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_close_OBJECTS) $(test_close_LDADD) $(LIBS) test-connect$(EXEEXT): $(test_connect_OBJECTS) $(test_connect_DEPENDENCIES) $(EXTRA_test_connect_DEPENDENCIES) @rm -f test-connect$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_connect_OBJECTS) $(test_connect_LDADD) $(LIBS) test-ctype$(EXEEXT): $(test_ctype_OBJECTS) $(test_ctype_DEPENDENCIES) $(EXTRA_test_ctype_DEPENDENCIES) @rm -f test-ctype$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_ctype_OBJECTS) $(test_ctype_LDADD) $(LIBS) test-dfa-match-aux$(EXEEXT): $(test_dfa_match_aux_OBJECTS) $(test_dfa_match_aux_DEPENDENCIES) $(EXTRA_test_dfa_match_aux_DEPENDENCIES) @rm -f test-dfa-match-aux$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_dfa_match_aux_OBJECTS) $(test_dfa_match_aux_LDADD) $(LIBS) test-dirent$(EXEEXT): $(test_dirent_OBJECTS) $(test_dirent_DEPENDENCIES) $(EXTRA_test_dirent_DEPENDENCIES) @rm -f test-dirent$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_dirent_OBJECTS) $(test_dirent_LDADD) $(LIBS) test-dup$(EXEEXT): $(test_dup_OBJECTS) $(test_dup_DEPENDENCIES) $(EXTRA_test_dup_DEPENDENCIES) @rm -f test-dup$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_dup_OBJECTS) $(test_dup_LDADD) $(LIBS) test-dup-safer$(EXEEXT): $(test_dup_safer_OBJECTS) $(test_dup_safer_DEPENDENCIES) $(EXTRA_test_dup_safer_DEPENDENCIES) @rm -f test-dup-safer$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_dup_safer_OBJECTS) $(test_dup_safer_LDADD) $(LIBS) test-dup2$(EXEEXT): $(test_dup2_OBJECTS) $(test_dup2_DEPENDENCIES) $(EXTRA_test_dup2_DEPENDENCIES) @rm -f test-dup2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_dup2_OBJECTS) $(test_dup2_LDADD) $(LIBS) test-dynarray$(EXEEXT): $(test_dynarray_OBJECTS) $(test_dynarray_DEPENDENCIES) $(EXTRA_test_dynarray_DEPENDENCIES) @rm -f test-dynarray$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_dynarray_OBJECTS) $(test_dynarray_LDADD) $(LIBS) test-environ$(EXEEXT): $(test_environ_OBJECTS) $(test_environ_DEPENDENCIES) $(EXTRA_test_environ_DEPENDENCIES) @rm -f test-environ$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_environ_OBJECTS) $(test_environ_LDADD) $(LIBS) test-errno$(EXEEXT): $(test_errno_OBJECTS) $(test_errno_DEPENDENCIES) $(EXTRA_test_errno_DEPENDENCIES) @rm -f test-errno$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_errno_OBJECTS) $(test_errno_LDADD) $(LIBS) test-exclude$(EXEEXT): $(test_exclude_OBJECTS) $(test_exclude_DEPENDENCIES) $(EXTRA_test_exclude_DEPENDENCIES) @rm -f test-exclude$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_exclude_OBJECTS) $(test_exclude_LDADD) $(LIBS) test-fchdir$(EXEEXT): $(test_fchdir_OBJECTS) $(test_fchdir_DEPENDENCIES) $(EXTRA_test_fchdir_DEPENDENCIES) @rm -f test-fchdir$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fchdir_OBJECTS) $(test_fchdir_LDADD) $(LIBS) test-fcntl$(EXEEXT): $(test_fcntl_OBJECTS) $(test_fcntl_DEPENDENCIES) $(EXTRA_test_fcntl_DEPENDENCIES) @rm -f test-fcntl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fcntl_OBJECTS) $(test_fcntl_LDADD) $(LIBS) test-fcntl-h$(EXEEXT): $(test_fcntl_h_OBJECTS) $(test_fcntl_h_DEPENDENCIES) $(EXTRA_test_fcntl_h_DEPENDENCIES) @rm -f test-fcntl-h$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fcntl_h_OBJECTS) $(test_fcntl_h_LDADD) $(LIBS) test-fcntl-safer$(EXEEXT): $(test_fcntl_safer_OBJECTS) $(test_fcntl_safer_DEPENDENCIES) $(EXTRA_test_fcntl_safer_DEPENDENCIES) @rm -f test-fcntl-safer$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fcntl_safer_OBJECTS) $(test_fcntl_safer_LDADD) $(LIBS) test-fdopen$(EXEEXT): $(test_fdopen_OBJECTS) $(test_fdopen_DEPENDENCIES) $(EXTRA_test_fdopen_DEPENDENCIES) @rm -f test-fdopen$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fdopen_OBJECTS) $(test_fdopen_LDADD) $(LIBS) test-fdopendir$(EXEEXT): $(test_fdopendir_OBJECTS) $(test_fdopendir_DEPENDENCIES) $(EXTRA_test_fdopendir_DEPENDENCIES) @rm -f test-fdopendir$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fdopendir_OBJECTS) $(test_fdopendir_LDADD) $(LIBS) test-fgetc$(EXEEXT): $(test_fgetc_OBJECTS) $(test_fgetc_DEPENDENCIES) $(EXTRA_test_fgetc_DEPENDENCIES) @rm -f test-fgetc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fgetc_OBJECTS) $(test_fgetc_LDADD) $(LIBS) test-float$(EXEEXT): $(test_float_OBJECTS) $(test_float_DEPENDENCIES) $(EXTRA_test_float_DEPENDENCIES) @rm -f test-float$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_float_OBJECTS) $(test_float_LDADD) $(LIBS) test-fnmatch$(EXEEXT): $(test_fnmatch_OBJECTS) $(test_fnmatch_DEPENDENCIES) $(EXTRA_test_fnmatch_DEPENDENCIES) @rm -f test-fnmatch$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fnmatch_OBJECTS) $(test_fnmatch_LDADD) $(LIBS) test-fnmatch-h$(EXEEXT): $(test_fnmatch_h_OBJECTS) $(test_fnmatch_h_DEPENDENCIES) $(EXTRA_test_fnmatch_h_DEPENDENCIES) @rm -f test-fnmatch-h$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fnmatch_h_OBJECTS) $(test_fnmatch_h_LDADD) $(LIBS) test-fopen$(EXEEXT): $(test_fopen_OBJECTS) $(test_fopen_DEPENDENCIES) $(EXTRA_test_fopen_DEPENDENCIES) @rm -f test-fopen$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fopen_OBJECTS) $(test_fopen_LDADD) $(LIBS) test-fopen-gnu$(EXEEXT): $(test_fopen_gnu_OBJECTS) $(test_fopen_gnu_DEPENDENCIES) $(EXTRA_test_fopen_gnu_DEPENDENCIES) @rm -f test-fopen-gnu$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fopen_gnu_OBJECTS) $(test_fopen_gnu_LDADD) $(LIBS) test-fpending$(EXEEXT): $(test_fpending_OBJECTS) $(test_fpending_DEPENDENCIES) $(EXTRA_test_fpending_DEPENDENCIES) @rm -f test-fpending$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fpending_OBJECTS) $(test_fpending_LDADD) $(LIBS) test-fputc$(EXEEXT): $(test_fputc_OBJECTS) $(test_fputc_DEPENDENCIES) $(EXTRA_test_fputc_DEPENDENCIES) @rm -f test-fputc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fputc_OBJECTS) $(test_fputc_LDADD) $(LIBS) test-fread$(EXEEXT): $(test_fread_OBJECTS) $(test_fread_DEPENDENCIES) $(EXTRA_test_fread_DEPENDENCIES) @rm -f test-fread$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fread_OBJECTS) $(test_fread_LDADD) $(LIBS) test-free$(EXEEXT): $(test_free_OBJECTS) $(test_free_DEPENDENCIES) $(EXTRA_test_free_DEPENDENCIES) @rm -f test-free$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_free_OBJECTS) $(test_free_LDADD) $(LIBS) test-fstat$(EXEEXT): $(test_fstat_OBJECTS) $(test_fstat_DEPENDENCIES) $(EXTRA_test_fstat_DEPENDENCIES) @rm -f test-fstat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fstat_OBJECTS) $(test_fstat_LDADD) $(LIBS) test-fstatat$(EXEEXT): $(test_fstatat_OBJECTS) $(test_fstatat_DEPENDENCIES) $(EXTRA_test_fstatat_DEPENDENCIES) @rm -f test-fstatat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fstatat_OBJECTS) $(test_fstatat_LDADD) $(LIBS) test-ftruncate$(EXEEXT): $(test_ftruncate_OBJECTS) $(test_ftruncate_DEPENDENCIES) $(EXTRA_test_ftruncate_DEPENDENCIES) @rm -f test-ftruncate$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_ftruncate_OBJECTS) $(test_ftruncate_LDADD) $(LIBS) test-fwrite$(EXEEXT): $(test_fwrite_OBJECTS) $(test_fwrite_DEPENDENCIES) $(EXTRA_test_fwrite_DEPENDENCIES) @rm -f test-fwrite$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fwrite_OBJECTS) $(test_fwrite_LDADD) $(LIBS) test-getcwd-lgpl$(EXEEXT): $(test_getcwd_lgpl_OBJECTS) $(test_getcwd_lgpl_DEPENDENCIES) $(EXTRA_test_getcwd_lgpl_DEPENDENCIES) @rm -f test-getcwd-lgpl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_getcwd_lgpl_OBJECTS) $(test_getcwd_lgpl_LDADD) $(LIBS) test-getdtablesize$(EXEEXT): $(test_getdtablesize_OBJECTS) $(test_getdtablesize_DEPENDENCIES) $(EXTRA_test_getdtablesize_DEPENDENCIES) @rm -f test-getdtablesize$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_getdtablesize_OBJECTS) $(test_getdtablesize_LDADD) $(LIBS) test-getopt-gnu$(EXEEXT): $(test_getopt_gnu_OBJECTS) $(test_getopt_gnu_DEPENDENCIES) $(EXTRA_test_getopt_gnu_DEPENDENCIES) @rm -f test-getopt-gnu$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_getopt_gnu_OBJECTS) $(test_getopt_gnu_LDADD) $(LIBS) test-getopt-posix$(EXEEXT): $(test_getopt_posix_OBJECTS) $(test_getopt_posix_DEPENDENCIES) $(EXTRA_test_getopt_posix_DEPENDENCIES) @rm -f test-getopt-posix$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_getopt_posix_OBJECTS) $(test_getopt_posix_LDADD) $(LIBS) test-getprogname$(EXEEXT): $(test_getprogname_OBJECTS) $(test_getprogname_DEPENDENCIES) $(EXTRA_test_getprogname_DEPENDENCIES) @rm -f test-getprogname$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_getprogname_OBJECTS) $(test_getprogname_LDADD) $(LIBS) test-gettimeofday$(EXEEXT): $(test_gettimeofday_OBJECTS) $(test_gettimeofday_DEPENDENCIES) $(EXTRA_test_gettimeofday_DEPENDENCIES) @rm -f test-gettimeofday$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_gettimeofday_OBJECTS) $(test_gettimeofday_LDADD) $(LIBS) test-hard-locale$(EXEEXT): $(test_hard_locale_OBJECTS) $(test_hard_locale_DEPENDENCIES) $(EXTRA_test_hard_locale_DEPENDENCIES) @rm -f test-hard-locale$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_hard_locale_OBJECTS) $(test_hard_locale_LDADD) $(LIBS) test-hash$(EXEEXT): $(test_hash_OBJECTS) $(test_hash_DEPENDENCIES) $(EXTRA_test_hash_DEPENDENCIES) @rm -f test-hash$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_hash_OBJECTS) $(test_hash_LDADD) $(LIBS) test-i-ring$(EXEEXT): $(test_i_ring_OBJECTS) $(test_i_ring_DEPENDENCIES) $(EXTRA_test_i_ring_DEPENDENCIES) @rm -f test-i-ring$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_i_ring_OBJECTS) $(test_i_ring_LDADD) $(LIBS) test-iconv$(EXEEXT): $(test_iconv_OBJECTS) $(test_iconv_DEPENDENCIES) $(EXTRA_test_iconv_DEPENDENCIES) @rm -f test-iconv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_iconv_OBJECTS) $(test_iconv_LDADD) $(LIBS) test-iconv-h$(EXEEXT): $(test_iconv_h_OBJECTS) $(test_iconv_h_DEPENDENCIES) $(EXTRA_test_iconv_h_DEPENDENCIES) @rm -f test-iconv-h$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_iconv_h_OBJECTS) $(test_iconv_h_LDADD) $(LIBS) test-ignore-value$(EXEEXT): $(test_ignore_value_OBJECTS) $(test_ignore_value_DEPENDENCIES) $(EXTRA_test_ignore_value_DEPENDENCIES) @rm -f test-ignore-value$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_ignore_value_OBJECTS) $(test_ignore_value_LDADD) $(LIBS) test-inet_pton$(EXEEXT): $(test_inet_pton_OBJECTS) $(test_inet_pton_DEPENDENCIES) $(EXTRA_test_inet_pton_DEPENDENCIES) @rm -f test-inet_pton$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_inet_pton_OBJECTS) $(test_inet_pton_LDADD) $(LIBS) test-intprops$(EXEEXT): $(test_intprops_OBJECTS) $(test_intprops_DEPENDENCIES) $(EXTRA_test_intprops_DEPENDENCIES) @rm -f test-intprops$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_intprops_OBJECTS) $(test_intprops_LDADD) $(LIBS) test-inttostr$(EXEEXT): $(test_inttostr_OBJECTS) $(test_inttostr_DEPENDENCIES) $(EXTRA_test_inttostr_DEPENDENCIES) @rm -f test-inttostr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_inttostr_OBJECTS) $(test_inttostr_LDADD) $(LIBS) test-inttypes$(EXEEXT): $(test_inttypes_OBJECTS) $(test_inttypes_DEPENDENCIES) $(EXTRA_test_inttypes_DEPENDENCIES) @rm -f test-inttypes$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_inttypes_OBJECTS) $(test_inttypes_LDADD) $(LIBS) test-ioctl$(EXEEXT): $(test_ioctl_OBJECTS) $(test_ioctl_DEPENDENCIES) $(EXTRA_test_ioctl_DEPENDENCIES) @rm -f test-ioctl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_ioctl_OBJECTS) $(test_ioctl_LDADD) $(LIBS) test-isatty$(EXEEXT): $(test_isatty_OBJECTS) $(test_isatty_DEPENDENCIES) $(EXTRA_test_isatty_DEPENDENCIES) @rm -f test-isatty$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_isatty_OBJECTS) $(test_isatty_LDADD) $(LIBS) test-isblank$(EXEEXT): $(test_isblank_OBJECTS) $(test_isblank_DEPENDENCIES) $(EXTRA_test_isblank_DEPENDENCIES) @rm -f test-isblank$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_isblank_OBJECTS) $(test_isblank_LDADD) $(LIBS) test-iswblank$(EXEEXT): $(test_iswblank_OBJECTS) $(test_iswblank_DEPENDENCIES) $(EXTRA_test_iswblank_DEPENDENCIES) @rm -f test-iswblank$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_iswblank_OBJECTS) $(test_iswblank_LDADD) $(LIBS) test-iswdigit$(EXEEXT): $(test_iswdigit_OBJECTS) $(test_iswdigit_DEPENDENCIES) $(EXTRA_test_iswdigit_DEPENDENCIES) @rm -f test-iswdigit$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_iswdigit_OBJECTS) $(test_iswdigit_LDADD) $(LIBS) test-iswxdigit$(EXEEXT): $(test_iswxdigit_OBJECTS) $(test_iswxdigit_DEPENDENCIES) $(EXTRA_test_iswxdigit_DEPENDENCIES) @rm -f test-iswxdigit$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_iswxdigit_OBJECTS) $(test_iswxdigit_LDADD) $(LIBS) test-langinfo$(EXEEXT): $(test_langinfo_OBJECTS) $(test_langinfo_DEPENDENCIES) $(EXTRA_test_langinfo_DEPENDENCIES) @rm -f test-langinfo$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_langinfo_OBJECTS) $(test_langinfo_LDADD) $(LIBS) test-limits-h$(EXEEXT): $(test_limits_h_OBJECTS) $(test_limits_h_DEPENDENCIES) $(EXTRA_test_limits_h_DEPENDENCIES) @rm -f test-limits-h$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_limits_h_OBJECTS) $(test_limits_h_LDADD) $(LIBS) test-listen$(EXEEXT): $(test_listen_OBJECTS) $(test_listen_DEPENDENCIES) $(EXTRA_test_listen_DEPENDENCIES) @rm -f test-listen$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_listen_OBJECTS) $(test_listen_LDADD) $(LIBS) test-localcharset$(EXEEXT): $(test_localcharset_OBJECTS) $(test_localcharset_DEPENDENCIES) $(EXTRA_test_localcharset_DEPENDENCIES) @rm -f test-localcharset$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_localcharset_OBJECTS) $(test_localcharset_LDADD) $(LIBS) test-locale$(EXEEXT): $(test_locale_OBJECTS) $(test_locale_DEPENDENCIES) $(EXTRA_test_locale_DEPENDENCIES) @rm -f test-locale$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_locale_OBJECTS) $(test_locale_LDADD) $(LIBS) test-localeconv$(EXEEXT): $(test_localeconv_OBJECTS) $(test_localeconv_DEPENDENCIES) $(EXTRA_test_localeconv_DEPENDENCIES) @rm -f test-localeconv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_localeconv_OBJECTS) $(test_localeconv_LDADD) $(LIBS) test-localename$(EXEEXT): $(test_localename_OBJECTS) $(test_localename_DEPENDENCIES) $(EXTRA_test_localename_DEPENDENCIES) @rm -f test-localename$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_localename_OBJECTS) $(test_localename_LDADD) $(LIBS) test-lseek$(EXEEXT): $(test_lseek_OBJECTS) $(test_lseek_DEPENDENCIES) $(EXTRA_test_lseek_DEPENDENCIES) @rm -f test-lseek$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_lseek_OBJECTS) $(test_lseek_LDADD) $(LIBS) test-lstat$(EXEEXT): $(test_lstat_OBJECTS) $(test_lstat_DEPENDENCIES) $(EXTRA_test_lstat_DEPENDENCIES) @rm -f test-lstat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_lstat_OBJECTS) $(test_lstat_LDADD) $(LIBS) test-malloc-gnu$(EXEEXT): $(test_malloc_gnu_OBJECTS) $(test_malloc_gnu_DEPENDENCIES) $(EXTRA_test_malloc_gnu_DEPENDENCIES) @rm -f test-malloc-gnu$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_malloc_gnu_OBJECTS) $(test_malloc_gnu_LDADD) $(LIBS) test-malloca$(EXEEXT): $(test_malloca_OBJECTS) $(test_malloca_DEPENDENCIES) $(EXTRA_test_malloca_DEPENDENCIES) @rm -f test-malloca$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_malloca_OBJECTS) $(test_malloca_LDADD) $(LIBS) test-mbscasecmp$(EXEEXT): $(test_mbscasecmp_OBJECTS) $(test_mbscasecmp_DEPENDENCIES) $(EXTRA_test_mbscasecmp_DEPENDENCIES) @rm -f test-mbscasecmp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_mbscasecmp_OBJECTS) $(test_mbscasecmp_LDADD) $(LIBS) test-mbsinit$(EXEEXT): $(test_mbsinit_OBJECTS) $(test_mbsinit_DEPENDENCIES) $(EXTRA_test_mbsinit_DEPENDENCIES) @rm -f test-mbsinit$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_mbsinit_OBJECTS) $(test_mbsinit_LDADD) $(LIBS) test-mbsrtowcs$(EXEEXT): $(test_mbsrtowcs_OBJECTS) $(test_mbsrtowcs_DEPENDENCIES) $(EXTRA_test_mbsrtowcs_DEPENDENCIES) @rm -f test-mbsrtowcs$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_mbsrtowcs_OBJECTS) $(test_mbsrtowcs_LDADD) $(LIBS) test-mbsstr1$(EXEEXT): $(test_mbsstr1_OBJECTS) $(test_mbsstr1_DEPENDENCIES) $(EXTRA_test_mbsstr1_DEPENDENCIES) @rm -f test-mbsstr1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_mbsstr1_OBJECTS) $(test_mbsstr1_LDADD) $(LIBS) test-mbsstr2$(EXEEXT): $(test_mbsstr2_OBJECTS) $(test_mbsstr2_DEPENDENCIES) $(EXTRA_test_mbsstr2_DEPENDENCIES) @rm -f test-mbsstr2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_mbsstr2_OBJECTS) $(test_mbsstr2_LDADD) $(LIBS) test-mbsstr3$(EXEEXT): $(test_mbsstr3_OBJECTS) $(test_mbsstr3_DEPENDENCIES) $(EXTRA_test_mbsstr3_DEPENDENCIES) @rm -f test-mbsstr3$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_mbsstr3_OBJECTS) $(test_mbsstr3_LDADD) $(LIBS) test-memchr$(EXEEXT): $(test_memchr_OBJECTS) $(test_memchr_DEPENDENCIES) $(EXTRA_test_memchr_DEPENDENCIES) @rm -f test-memchr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_memchr_OBJECTS) $(test_memchr_LDADD) $(LIBS) test-memchr2$(EXEEXT): $(test_memchr2_OBJECTS) $(test_memchr2_DEPENDENCIES) $(EXTRA_test_memchr2_DEPENDENCIES) @rm -f test-memchr2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_memchr2_OBJECTS) $(test_memchr2_LDADD) $(LIBS) test-memrchr$(EXEEXT): $(test_memrchr_OBJECTS) $(test_memrchr_DEPENDENCIES) $(EXTRA_test_memrchr_DEPENDENCIES) @rm -f test-memrchr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_memrchr_OBJECTS) $(test_memrchr_LDADD) $(LIBS) test-nanosleep$(EXEEXT): $(test_nanosleep_OBJECTS) $(test_nanosleep_DEPENDENCIES) $(EXTRA_test_nanosleep_DEPENDENCIES) @rm -f test-nanosleep$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_nanosleep_OBJECTS) $(test_nanosleep_LDADD) $(LIBS) test-netinet_in$(EXEEXT): $(test_netinet_in_OBJECTS) $(test_netinet_in_DEPENDENCIES) $(EXTRA_test_netinet_in_DEPENDENCIES) @rm -f test-netinet_in$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_netinet_in_OBJECTS) $(test_netinet_in_LDADD) $(LIBS) test-nl_langinfo$(EXEEXT): $(test_nl_langinfo_OBJECTS) $(test_nl_langinfo_DEPENDENCIES) $(EXTRA_test_nl_langinfo_DEPENDENCIES) @rm -f test-nl_langinfo$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_nl_langinfo_OBJECTS) $(test_nl_langinfo_LDADD) $(LIBS) test-nl_langinfo-mt$(EXEEXT): $(test_nl_langinfo_mt_OBJECTS) $(test_nl_langinfo_mt_DEPENDENCIES) $(EXTRA_test_nl_langinfo_mt_DEPENDENCIES) @rm -f test-nl_langinfo-mt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_nl_langinfo_mt_OBJECTS) $(test_nl_langinfo_mt_LDADD) $(LIBS) test-open$(EXEEXT): $(test_open_OBJECTS) $(test_open_DEPENDENCIES) $(EXTRA_test_open_DEPENDENCIES) @rm -f test-open$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_open_OBJECTS) $(test_open_LDADD) $(LIBS) test-openat$(EXEEXT): $(test_openat_OBJECTS) $(test_openat_DEPENDENCIES) $(EXTRA_test_openat_DEPENDENCIES) @rm -f test-openat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_openat_OBJECTS) $(test_openat_LDADD) $(LIBS) test-openat-safer$(EXEEXT): $(test_openat_safer_OBJECTS) $(test_openat_safer_DEPENDENCIES) $(EXTRA_test_openat_safer_DEPENDENCIES) @rm -f test-openat-safer$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_openat_safer_OBJECTS) $(test_openat_safer_LDADD) $(LIBS) test-pathmax$(EXEEXT): $(test_pathmax_OBJECTS) $(test_pathmax_DEPENDENCIES) $(EXTRA_test_pathmax_DEPENDENCIES) @rm -f test-pathmax$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_pathmax_OBJECTS) $(test_pathmax_LDADD) $(LIBS) test-perror$(EXEEXT): $(test_perror_OBJECTS) $(test_perror_DEPENDENCIES) $(EXTRA_test_perror_DEPENDENCIES) @rm -f test-perror$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_perror_OBJECTS) $(test_perror_LDADD) $(LIBS) test-perror2$(EXEEXT): $(test_perror2_OBJECTS) $(test_perror2_DEPENDENCIES) $(EXTRA_test_perror2_DEPENDENCIES) @rm -f test-perror2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_perror2_OBJECTS) $(test_perror2_LDADD) $(LIBS) test-pipe$(EXEEXT): $(test_pipe_OBJECTS) $(test_pipe_DEPENDENCIES) $(EXTRA_test_pipe_DEPENDENCIES) @rm -f test-pipe$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_pipe_OBJECTS) $(test_pipe_LDADD) $(LIBS) test-pthread$(EXEEXT): $(test_pthread_OBJECTS) $(test_pthread_DEPENDENCIES) $(EXTRA_test_pthread_DEPENDENCIES) @rm -f test-pthread$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_pthread_OBJECTS) $(test_pthread_LDADD) $(LIBS) test-pthread-thread$(EXEEXT): $(test_pthread_thread_OBJECTS) $(test_pthread_thread_DEPENDENCIES) $(EXTRA_test_pthread_thread_DEPENDENCIES) @rm -f test-pthread-thread$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_pthread_thread_OBJECTS) $(test_pthread_thread_LDADD) $(LIBS) test-pthread_sigmask1$(EXEEXT): $(test_pthread_sigmask1_OBJECTS) $(test_pthread_sigmask1_DEPENDENCIES) $(EXTRA_test_pthread_sigmask1_DEPENDENCIES) @rm -f test-pthread_sigmask1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_pthread_sigmask1_OBJECTS) $(test_pthread_sigmask1_LDADD) $(LIBS) test-pthread_sigmask2$(EXEEXT): $(test_pthread_sigmask2_OBJECTS) $(test_pthread_sigmask2_DEPENDENCIES) $(EXTRA_test_pthread_sigmask2_DEPENDENCIES) @rm -f test-pthread_sigmask2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_pthread_sigmask2_OBJECTS) $(test_pthread_sigmask2_LDADD) $(LIBS) test-quotearg-simple$(EXEEXT): $(test_quotearg_simple_OBJECTS) $(test_quotearg_simple_DEPENDENCIES) $(EXTRA_test_quotearg_simple_DEPENDENCIES) @rm -f test-quotearg-simple$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_quotearg_simple_OBJECTS) $(test_quotearg_simple_LDADD) $(LIBS) test-raise$(EXEEXT): $(test_raise_OBJECTS) $(test_raise_DEPENDENCIES) $(EXTRA_test_raise_DEPENDENCIES) @rm -f test-raise$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_raise_OBJECTS) $(test_raise_LDADD) $(LIBS) test-rawmemchr$(EXEEXT): $(test_rawmemchr_OBJECTS) $(test_rawmemchr_DEPENDENCIES) $(EXTRA_test_rawmemchr_DEPENDENCIES) @rm -f test-rawmemchr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_rawmemchr_OBJECTS) $(test_rawmemchr_LDADD) $(LIBS) test-read$(EXEEXT): $(test_read_OBJECTS) $(test_read_DEPENDENCIES) $(EXTRA_test_read_DEPENDENCIES) @rm -f test-read$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_read_OBJECTS) $(test_read_LDADD) $(LIBS) test-realloc-gnu$(EXEEXT): $(test_realloc_gnu_OBJECTS) $(test_realloc_gnu_DEPENDENCIES) $(EXTRA_test_realloc_gnu_DEPENDENCIES) @rm -f test-realloc-gnu$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_realloc_gnu_OBJECTS) $(test_realloc_gnu_LDADD) $(LIBS) test-reallocarray$(EXEEXT): $(test_reallocarray_OBJECTS) $(test_reallocarray_DEPENDENCIES) $(EXTRA_test_reallocarray_DEPENDENCIES) @rm -f test-reallocarray$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_reallocarray_OBJECTS) $(test_reallocarray_LDADD) $(LIBS) test-regex$(EXEEXT): $(test_regex_OBJECTS) $(test_regex_DEPENDENCIES) $(EXTRA_test_regex_DEPENDENCIES) @rm -f test-regex$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_regex_OBJECTS) $(test_regex_LDADD) $(LIBS) test-sched$(EXEEXT): $(test_sched_OBJECTS) $(test_sched_DEPENDENCIES) $(EXTRA_test_sched_DEPENDENCIES) @rm -f test-sched$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sched_OBJECTS) $(test_sched_LDADD) $(LIBS) test-select$(EXEEXT): $(test_select_OBJECTS) $(test_select_DEPENDENCIES) $(EXTRA_test_select_DEPENDENCIES) @rm -f test-select$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_select_OBJECTS) $(test_select_LDADD) $(LIBS) test-select-fd$(EXEEXT): $(test_select_fd_OBJECTS) $(test_select_fd_DEPENDENCIES) $(EXTRA_test_select_fd_DEPENDENCIES) @rm -f test-select-fd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_select_fd_OBJECTS) $(test_select_fd_LDADD) $(LIBS) test-select-stdin$(EXEEXT): $(test_select_stdin_OBJECTS) $(test_select_stdin_DEPENDENCIES) $(EXTRA_test_select_stdin_DEPENDENCIES) @rm -f test-select-stdin$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_select_stdin_OBJECTS) $(test_select_stdin_LDADD) $(LIBS) test-setenv$(EXEEXT): $(test_setenv_OBJECTS) $(test_setenv_DEPENDENCIES) $(EXTRA_test_setenv_DEPENDENCIES) @rm -f test-setenv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_setenv_OBJECTS) $(test_setenv_LDADD) $(LIBS) test-setlocale1$(EXEEXT): $(test_setlocale1_OBJECTS) $(test_setlocale1_DEPENDENCIES) $(EXTRA_test_setlocale1_DEPENDENCIES) @rm -f test-setlocale1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_setlocale1_OBJECTS) $(test_setlocale1_LDADD) $(LIBS) test-setlocale2$(EXEEXT): $(test_setlocale2_OBJECTS) $(test_setlocale2_DEPENDENCIES) $(EXTRA_test_setlocale2_DEPENDENCIES) @rm -f test-setlocale2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_setlocale2_OBJECTS) $(test_setlocale2_LDADD) $(LIBS) test-setlocale_null$(EXEEXT): $(test_setlocale_null_OBJECTS) $(test_setlocale_null_DEPENDENCIES) $(EXTRA_test_setlocale_null_DEPENDENCIES) @rm -f test-setlocale_null$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_setlocale_null_OBJECTS) $(test_setlocale_null_LDADD) $(LIBS) test-setlocale_null-mt-all$(EXEEXT): $(test_setlocale_null_mt_all_OBJECTS) $(test_setlocale_null_mt_all_DEPENDENCIES) $(EXTRA_test_setlocale_null_mt_all_DEPENDENCIES) @rm -f test-setlocale_null-mt-all$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_setlocale_null_mt_all_OBJECTS) $(test_setlocale_null_mt_all_LDADD) $(LIBS) test-setlocale_null-mt-one$(EXEEXT): $(test_setlocale_null_mt_one_OBJECTS) $(test_setlocale_null_mt_one_DEPENDENCIES) $(EXTRA_test_setlocale_null_mt_one_DEPENDENCIES) @rm -f test-setlocale_null-mt-one$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_setlocale_null_mt_one_OBJECTS) $(test_setlocale_null_mt_one_LDADD) $(LIBS) test-setsockopt$(EXEEXT): $(test_setsockopt_OBJECTS) $(test_setsockopt_DEPENDENCIES) $(EXTRA_test_setsockopt_DEPENDENCIES) @rm -f test-setsockopt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_setsockopt_OBJECTS) $(test_setsockopt_LDADD) $(LIBS) test-sigaction$(EXEEXT): $(test_sigaction_OBJECTS) $(test_sigaction_DEPENDENCIES) $(EXTRA_test_sigaction_DEPENDENCIES) @rm -f test-sigaction$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sigaction_OBJECTS) $(test_sigaction_LDADD) $(LIBS) test-signal-h$(EXEEXT): $(test_signal_h_OBJECTS) $(test_signal_h_DEPENDENCIES) $(EXTRA_test_signal_h_DEPENDENCIES) @rm -f test-signal-h$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_signal_h_OBJECTS) $(test_signal_h_LDADD) $(LIBS) test-sigprocmask$(EXEEXT): $(test_sigprocmask_OBJECTS) $(test_sigprocmask_DEPENDENCIES) $(EXTRA_test_sigprocmask_DEPENDENCIES) @rm -f test-sigprocmask$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sigprocmask_OBJECTS) $(test_sigprocmask_LDADD) $(LIBS) test-sigsegv-catch-segv1$(EXEEXT): $(test_sigsegv_catch_segv1_OBJECTS) $(test_sigsegv_catch_segv1_DEPENDENCIES) $(EXTRA_test_sigsegv_catch_segv1_DEPENDENCIES) @rm -f test-sigsegv-catch-segv1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sigsegv_catch_segv1_OBJECTS) $(test_sigsegv_catch_segv1_LDADD) $(LIBS) test-sigsegv-catch-segv2$(EXEEXT): $(test_sigsegv_catch_segv2_OBJECTS) $(test_sigsegv_catch_segv2_DEPENDENCIES) $(EXTRA_test_sigsegv_catch_segv2_DEPENDENCIES) @rm -f test-sigsegv-catch-segv2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sigsegv_catch_segv2_OBJECTS) $(test_sigsegv_catch_segv2_LDADD) $(LIBS) test-sigsegv-catch-stackoverflow1$(EXEEXT): $(test_sigsegv_catch_stackoverflow1_OBJECTS) $(test_sigsegv_catch_stackoverflow1_DEPENDENCIES) $(EXTRA_test_sigsegv_catch_stackoverflow1_DEPENDENCIES) @rm -f test-sigsegv-catch-stackoverflow1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sigsegv_catch_stackoverflow1_OBJECTS) $(test_sigsegv_catch_stackoverflow1_LDADD) $(LIBS) test-sigsegv-catch-stackoverflow2$(EXEEXT): $(test_sigsegv_catch_stackoverflow2_OBJECTS) $(test_sigsegv_catch_stackoverflow2_DEPENDENCIES) $(EXTRA_test_sigsegv_catch_stackoverflow2_DEPENDENCIES) @rm -f test-sigsegv-catch-stackoverflow2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sigsegv_catch_stackoverflow2_OBJECTS) $(test_sigsegv_catch_stackoverflow2_LDADD) $(LIBS) test-sleep$(EXEEXT): $(test_sleep_OBJECTS) $(test_sleep_DEPENDENCIES) $(EXTRA_test_sleep_DEPENDENCIES) @rm -f test-sleep$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sleep_OBJECTS) $(test_sleep_LDADD) $(LIBS) test-snprintf$(EXEEXT): $(test_snprintf_OBJECTS) $(test_snprintf_DEPENDENCIES) $(EXTRA_test_snprintf_DEPENDENCIES) @rm -f test-snprintf$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_snprintf_OBJECTS) $(test_snprintf_LDADD) $(LIBS) test-sockets$(EXEEXT): $(test_sockets_OBJECTS) $(test_sockets_DEPENDENCIES) $(EXTRA_test_sockets_DEPENDENCIES) @rm -f test-sockets$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sockets_OBJECTS) $(test_sockets_LDADD) $(LIBS) test-stat$(EXEEXT): $(test_stat_OBJECTS) $(test_stat_DEPENDENCIES) $(EXTRA_test_stat_DEPENDENCIES) @rm -f test-stat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stat_OBJECTS) $(test_stat_LDADD) $(LIBS) test-stat-time$(EXEEXT): $(test_stat_time_OBJECTS) $(test_stat_time_DEPENDENCIES) $(EXTRA_test_stat_time_DEPENDENCIES) @rm -f test-stat-time$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stat_time_OBJECTS) $(test_stat_time_LDADD) $(LIBS) test-stdalign$(EXEEXT): $(test_stdalign_OBJECTS) $(test_stdalign_DEPENDENCIES) $(EXTRA_test_stdalign_DEPENDENCIES) @rm -f test-stdalign$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stdalign_OBJECTS) $(test_stdalign_LDADD) $(LIBS) test-stdbool$(EXEEXT): $(test_stdbool_OBJECTS) $(test_stdbool_DEPENDENCIES) $(EXTRA_test_stdbool_DEPENDENCIES) @rm -f test-stdbool$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stdbool_OBJECTS) $(test_stdbool_LDADD) $(LIBS) test-stddef$(EXEEXT): $(test_stddef_OBJECTS) $(test_stddef_DEPENDENCIES) $(EXTRA_test_stddef_DEPENDENCIES) @rm -f test-stddef$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stddef_OBJECTS) $(test_stddef_LDADD) $(LIBS) test-stdint$(EXEEXT): $(test_stdint_OBJECTS) $(test_stdint_DEPENDENCIES) $(EXTRA_test_stdint_DEPENDENCIES) @rm -f test-stdint$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stdint_OBJECTS) $(test_stdint_LDADD) $(LIBS) test-stdio$(EXEEXT): $(test_stdio_OBJECTS) $(test_stdio_DEPENDENCIES) $(EXTRA_test_stdio_DEPENDENCIES) @rm -f test-stdio$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stdio_OBJECTS) $(test_stdio_LDADD) $(LIBS) test-stdlib$(EXEEXT): $(test_stdlib_OBJECTS) $(test_stdlib_DEPENDENCIES) $(EXTRA_test_stdlib_DEPENDENCIES) @rm -f test-stdlib$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stdlib_OBJECTS) $(test_stdlib_LDADD) $(LIBS) test-strerror$(EXEEXT): $(test_strerror_OBJECTS) $(test_strerror_DEPENDENCIES) $(EXTRA_test_strerror_DEPENDENCIES) @rm -f test-strerror$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strerror_OBJECTS) $(test_strerror_LDADD) $(LIBS) test-strerror_r$(EXEEXT): $(test_strerror_r_OBJECTS) $(test_strerror_r_DEPENDENCIES) $(EXTRA_test_strerror_r_DEPENDENCIES) @rm -f test-strerror_r$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strerror_r_OBJECTS) $(test_strerror_r_LDADD) $(LIBS) test-striconv$(EXEEXT): $(test_striconv_OBJECTS) $(test_striconv_DEPENDENCIES) $(EXTRA_test_striconv_DEPENDENCIES) @rm -f test-striconv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_striconv_OBJECTS) $(test_striconv_LDADD) $(LIBS) test-string$(EXEEXT): $(test_string_OBJECTS) $(test_string_DEPENDENCIES) $(EXTRA_test_string_DEPENDENCIES) @rm -f test-string$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_string_OBJECTS) $(test_string_LDADD) $(LIBS) test-strnlen$(EXEEXT): $(test_strnlen_OBJECTS) $(test_strnlen_DEPENDENCIES) $(EXTRA_test_strnlen_DEPENDENCIES) @rm -f test-strnlen$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strnlen_OBJECTS) $(test_strnlen_LDADD) $(LIBS) test-strstr$(EXEEXT): $(test_strstr_OBJECTS) $(test_strstr_DEPENDENCIES) $(EXTRA_test_strstr_DEPENDENCIES) @rm -f test-strstr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strstr_OBJECTS) $(test_strstr_LDADD) $(LIBS) test-strtoimax$(EXEEXT): $(test_strtoimax_OBJECTS) $(test_strtoimax_DEPENDENCIES) $(EXTRA_test_strtoimax_DEPENDENCIES) @rm -f test-strtoimax$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strtoimax_OBJECTS) $(test_strtoimax_LDADD) $(LIBS) test-strtoll$(EXEEXT): $(test_strtoll_OBJECTS) $(test_strtoll_DEPENDENCIES) $(EXTRA_test_strtoll_DEPENDENCIES) @rm -f test-strtoll$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strtoll_OBJECTS) $(test_strtoll_LDADD) $(LIBS) test-strtoull$(EXEEXT): $(test_strtoull_OBJECTS) $(test_strtoull_DEPENDENCIES) $(EXTRA_test_strtoull_DEPENDENCIES) @rm -f test-strtoull$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strtoull_OBJECTS) $(test_strtoull_LDADD) $(LIBS) test-strtoumax$(EXEEXT): $(test_strtoumax_OBJECTS) $(test_strtoumax_DEPENDENCIES) $(EXTRA_test_strtoumax_DEPENDENCIES) @rm -f test-strtoumax$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strtoumax_OBJECTS) $(test_strtoumax_LDADD) $(LIBS) test-symlink$(EXEEXT): $(test_symlink_OBJECTS) $(test_symlink_DEPENDENCIES) $(EXTRA_test_symlink_DEPENDENCIES) @rm -f test-symlink$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_symlink_OBJECTS) $(test_symlink_LDADD) $(LIBS) test-sys_ioctl$(EXEEXT): $(test_sys_ioctl_OBJECTS) $(test_sys_ioctl_DEPENDENCIES) $(EXTRA_test_sys_ioctl_DEPENDENCIES) @rm -f test-sys_ioctl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sys_ioctl_OBJECTS) $(test_sys_ioctl_LDADD) $(LIBS) test-sys_select$(EXEEXT): $(test_sys_select_OBJECTS) $(test_sys_select_DEPENDENCIES) $(EXTRA_test_sys_select_DEPENDENCIES) @rm -f test-sys_select$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sys_select_OBJECTS) $(test_sys_select_LDADD) $(LIBS) test-sys_socket$(EXEEXT): $(test_sys_socket_OBJECTS) $(test_sys_socket_DEPENDENCIES) $(EXTRA_test_sys_socket_DEPENDENCIES) @rm -f test-sys_socket$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sys_socket_OBJECTS) $(test_sys_socket_LDADD) $(LIBS) test-sys_stat$(EXEEXT): $(test_sys_stat_OBJECTS) $(test_sys_stat_DEPENDENCIES) $(EXTRA_test_sys_stat_DEPENDENCIES) @rm -f test-sys_stat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sys_stat_OBJECTS) $(test_sys_stat_LDADD) $(LIBS) test-sys_time$(EXEEXT): $(test_sys_time_OBJECTS) $(test_sys_time_DEPENDENCIES) $(EXTRA_test_sys_time_DEPENDENCIES) @rm -f test-sys_time$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sys_time_OBJECTS) $(test_sys_time_LDADD) $(LIBS) test-sys_types$(EXEEXT): $(test_sys_types_OBJECTS) $(test_sys_types_DEPENDENCIES) $(EXTRA_test_sys_types_DEPENDENCIES) @rm -f test-sys_types$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sys_types_OBJECTS) $(test_sys_types_LDADD) $(LIBS) test-sys_uio$(EXEEXT): $(test_sys_uio_OBJECTS) $(test_sys_uio_DEPENDENCIES) $(EXTRA_test_sys_uio_DEPENDENCIES) @rm -f test-sys_uio$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sys_uio_OBJECTS) $(test_sys_uio_LDADD) $(LIBS) test-thread_create$(EXEEXT): $(test_thread_create_OBJECTS) $(test_thread_create_DEPENDENCIES) $(EXTRA_test_thread_create_DEPENDENCIES) @rm -f test-thread_create$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_thread_create_OBJECTS) $(test_thread_create_LDADD) $(LIBS) test-thread_self$(EXEEXT): $(test_thread_self_OBJECTS) $(test_thread_self_DEPENDENCIES) $(EXTRA_test_thread_self_DEPENDENCIES) @rm -f test-thread_self$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_thread_self_OBJECTS) $(test_thread_self_LDADD) $(LIBS) test-time$(EXEEXT): $(test_time_OBJECTS) $(test_time_DEPENDENCIES) $(EXTRA_test_time_DEPENDENCIES) @rm -f test-time$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_time_OBJECTS) $(test_time_LDADD) $(LIBS) unistr/$(am__dirstamp): @$(MKDIR_P) unistr @: > unistr/$(am__dirstamp) unistr/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) unistr/$(DEPDIR) @: > unistr/$(DEPDIR)/$(am__dirstamp) unistr/test-u8-mbtoucr.$(OBJEXT): unistr/$(am__dirstamp) \ unistr/$(DEPDIR)/$(am__dirstamp) test-u8-mbtoucr$(EXEEXT): $(test_u8_mbtoucr_OBJECTS) $(test_u8_mbtoucr_DEPENDENCIES) $(EXTRA_test_u8_mbtoucr_DEPENDENCIES) @rm -f test-u8-mbtoucr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_mbtoucr_OBJECTS) $(test_u8_mbtoucr_LDADD) $(LIBS) unistr/test-u8-uctomb.$(OBJEXT): unistr/$(am__dirstamp) \ unistr/$(DEPDIR)/$(am__dirstamp) test-u8-uctomb$(EXEEXT): $(test_u8_uctomb_OBJECTS) $(test_u8_uctomb_DEPENDENCIES) $(EXTRA_test_u8_uctomb_DEPENDENCIES) @rm -f test-u8-uctomb$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_uctomb_OBJECTS) $(test_u8_uctomb_LDADD) $(LIBS) uniwidth/$(am__dirstamp): @$(MKDIR_P) uniwidth @: > uniwidth/$(am__dirstamp) uniwidth/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) uniwidth/$(DEPDIR) @: > uniwidth/$(DEPDIR)/$(am__dirstamp) uniwidth/test-uc_width.$(OBJEXT): uniwidth/$(am__dirstamp) \ uniwidth/$(DEPDIR)/$(am__dirstamp) test-uc_width$(EXEEXT): $(test_uc_width_OBJECTS) $(test_uc_width_DEPENDENCIES) $(EXTRA_test_uc_width_DEPENDENCIES) @rm -f test-uc_width$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_uc_width_OBJECTS) $(test_uc_width_LDADD) $(LIBS) uniwidth/test-uc_width2.$(OBJEXT): uniwidth/$(am__dirstamp) \ uniwidth/$(DEPDIR)/$(am__dirstamp) test-uc_width2$(EXEEXT): $(test_uc_width2_OBJECTS) $(test_uc_width2_DEPENDENCIES) $(EXTRA_test_uc_width2_DEPENDENCIES) @rm -f test-uc_width2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_uc_width2_OBJECTS) $(test_uc_width2_LDADD) $(LIBS) test-unistd$(EXEEXT): $(test_unistd_OBJECTS) $(test_unistd_DEPENDENCIES) $(EXTRA_test_unistd_DEPENDENCIES) @rm -f test-unistd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_unistd_OBJECTS) $(test_unistd_LDADD) $(LIBS) test-unsetenv$(EXEEXT): $(test_unsetenv_OBJECTS) $(test_unsetenv_DEPENDENCIES) $(EXTRA_test_unsetenv_DEPENDENCIES) @rm -f test-unsetenv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_unsetenv_OBJECTS) $(test_unsetenv_LDADD) $(LIBS) test-vasnprintf$(EXEEXT): $(test_vasnprintf_OBJECTS) $(test_vasnprintf_DEPENDENCIES) $(EXTRA_test_vasnprintf_DEPENDENCIES) @rm -f test-vasnprintf$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_vasnprintf_OBJECTS) $(test_vasnprintf_LDADD) $(LIBS) test-verify$(EXEEXT): $(test_verify_OBJECTS) $(test_verify_DEPENDENCIES) $(EXTRA_test_verify_DEPENDENCIES) @rm -f test-verify$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_verify_OBJECTS) $(test_verify_LDADD) $(LIBS) test-verify-try$(EXEEXT): $(test_verify_try_OBJECTS) $(test_verify_try_DEPENDENCIES) $(EXTRA_test_verify_try_DEPENDENCIES) @rm -f test-verify-try$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_verify_try_OBJECTS) $(test_verify_try_LDADD) $(LIBS) test-version-etc$(EXEEXT): $(test_version_etc_OBJECTS) $(test_version_etc_DEPENDENCIES) $(EXTRA_test_version_etc_DEPENDENCIES) @rm -f test-version-etc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_version_etc_OBJECTS) $(test_version_etc_LDADD) $(LIBS) test-wchar$(EXEEXT): $(test_wchar_OBJECTS) $(test_wchar_DEPENDENCIES) $(EXTRA_test_wchar_DEPENDENCIES) @rm -f test-wchar$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_wchar_OBJECTS) $(test_wchar_LDADD) $(LIBS) test-wcrtomb$(EXEEXT): $(test_wcrtomb_OBJECTS) $(test_wcrtomb_DEPENDENCIES) $(EXTRA_test_wcrtomb_DEPENDENCIES) @rm -f test-wcrtomb$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_wcrtomb_OBJECTS) $(test_wcrtomb_LDADD) $(LIBS) test-wcrtomb-w32$(EXEEXT): $(test_wcrtomb_w32_OBJECTS) $(test_wcrtomb_w32_DEPENDENCIES) $(EXTRA_test_wcrtomb_w32_DEPENDENCIES) @rm -f test-wcrtomb-w32$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_wcrtomb_w32_OBJECTS) $(test_wcrtomb_w32_LDADD) $(LIBS) test-wctype-h$(EXEEXT): $(test_wctype_h_OBJECTS) $(test_wctype_h_DEPENDENCIES) $(EXTRA_test_wctype_h_DEPENDENCIES) @rm -f test-wctype-h$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_wctype_h_OBJECTS) $(test_wctype_h_LDADD) $(LIBS) test-wcwidth$(EXEEXT): $(test_wcwidth_OBJECTS) $(test_wcwidth_DEPENDENCIES) $(EXTRA_test_wcwidth_DEPENDENCIES) @rm -f test-wcwidth$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_wcwidth_OBJECTS) $(test_wcwidth_LDADD) $(LIBS) test-xalloc-die$(EXEEXT): $(test_xalloc_die_OBJECTS) $(test_xalloc_die_DEPENDENCIES) $(EXTRA_test_xalloc_die_DEPENDENCIES) @rm -f test-xalloc-die$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_xalloc_die_OBJECTS) $(test_xalloc_die_LDADD) $(LIBS) test-xstrtoimax$(EXEEXT): $(test_xstrtoimax_OBJECTS) $(test_xstrtoimax_DEPENDENCIES) $(EXTRA_test_xstrtoimax_DEPENDENCIES) @rm -f test-xstrtoimax$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_xstrtoimax_OBJECTS) $(test_xstrtoimax_LDADD) $(LIBS) test-xstrtol$(EXEEXT): $(test_xstrtol_OBJECTS) $(test_xstrtol_DEPENDENCIES) $(EXTRA_test_xstrtol_DEPENDENCIES) @rm -f test-xstrtol$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_xstrtol_OBJECTS) $(test_xstrtol_LDADD) $(LIBS) test-xstrtoul$(EXEEXT): $(test_xstrtoul_OBJECTS) $(test_xstrtoul_DEPENDENCIES) $(EXTRA_test_xstrtoul_DEPENDENCIES) @rm -f test-xstrtoul$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_xstrtoul_OBJECTS) $(test_xstrtoul_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f glthread/*.$(OBJEXT) -rm -f unistr/*.$(OBJEXT) -rm -f uniwidth/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/accept.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/anytostr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bind.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdopen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftruncate.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash-pjw.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imaxtostr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_pton.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inttostr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itold.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/locale.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localename-table.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localename.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nanosleep.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/offtostr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perror.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-args.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-parse.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pthread-thread.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pthread_sigmask.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/putenv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setenv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setlocale.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setsockopt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sig-handler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigaction.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigprocmask.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sleep.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockets.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror_r.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlink.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sys_socket.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-accept.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-alignof.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-alloca-opt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-argmatch.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-arpa_inet.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-binary-io.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-bind.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-bitrotate.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-btowc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-ctype.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-stack.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-strcasecmp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-strncasecmp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-calloc-gnu.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-chdir.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-cloexec.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-close.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-connect.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-ctype.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dfa-match-aux.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dirent.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dup-safer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dup.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dup2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dynarray.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-environ.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-errno.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-exclude.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fchdir.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fcntl-h.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fcntl-safer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fcntl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fdopen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fdopendir.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fgetc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-float.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fnmatch-h.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fnmatch.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fopen-gnu.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fopen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fpending.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fputc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fread.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-free.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fstat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fstatat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-ftruncate.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fwrite.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-getcwd-lgpl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-getdtablesize.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-getopt-gnu.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-getopt-posix.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-getprogname.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-gettimeofday.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-hard-locale.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-hash.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-i-ring.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-iconv-h.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-iconv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-ignore-value.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-inet_pton.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-intprops.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-inttostr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-inttypes.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-ioctl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isatty.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isblank.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-iswblank.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-iswdigit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-iswxdigit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-langinfo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-limits-h.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-listen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-localcharset.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-locale.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-localeconv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-localename.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-lseek.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-lstat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-malloc-gnu.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-malloca.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mbscasecmp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mbsinit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mbsrtowcs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mbsstr1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mbsstr2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mbsstr3.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-memchr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-memchr2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-memrchr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-nanosleep.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-netinet_in.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-nl_langinfo-mt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-nl_langinfo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-open.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-openat-safer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-openat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-pathmax.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-perror.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-perror2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-pipe.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-pthread-thread.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-pthread.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-pthread_sigmask1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-pthread_sigmask2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-quotearg-simple.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-raise.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-rawmemchr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-read.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-realloc-gnu.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-reallocarray.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-regex.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sched.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-select-fd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-select-stdin.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-select.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setenv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setlocale1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setlocale2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setlocale_null-mt-all.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setlocale_null-mt-one.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setlocale_null.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setsockopt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sigaction.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-signal-h.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sigprocmask.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sigsegv-catch-segv1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sigsegv-catch-segv2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sigsegv-catch-stackoverflow1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sigsegv-catch-stackoverflow2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sleep.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-snprintf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sockets.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stat-time.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdalign.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdbool.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stddef.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdint.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdio.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdlib.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strerror.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strerror_r.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-striconv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-string.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strnlen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strstr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strtoimax.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strtoll.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strtoull.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strtoumax.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-symlink.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_ioctl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_select.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_socket.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_stat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_time.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_types.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_uio.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-thread_create.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-thread_self.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-time.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-unistd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-unsetenv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-vasnprintf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-verify-try.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-verify.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-version-etc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wchar.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wcrtomb-w32.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wcrtomb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wctype-h.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wcwidth.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-xalloc-die.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-xstrtoimax.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-xstrtol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-xstrtoul.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uinttostr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umaxtostr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unsetenv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasnprintf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-thread.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-tls.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsize.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrtol-error.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/thread.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mbtoucr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-uctomb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@uniwidth/$(DEPDIR)/test-uc_width.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@uniwidth/$(DEPDIR)/test-uc_width2.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) $(check_LIBRARIES) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) $(check_LIBRARIES) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? test-accept.log: test-accept$(EXEEXT) @p='test-accept$(EXEEXT)'; \ b='test-accept'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-alignof.log: test-alignof$(EXEEXT) @p='test-alignof$(EXEEXT)'; \ b='test-alignof'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-alloca-opt.log: test-alloca-opt$(EXEEXT) @p='test-alloca-opt$(EXEEXT)'; \ b='test-alloca-opt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-argmatch.log: test-argmatch$(EXEEXT) @p='test-argmatch$(EXEEXT)'; \ b='test-argmatch'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-arpa_inet.log: test-arpa_inet$(EXEEXT) @p='test-arpa_inet$(EXEEXT)'; \ b='test-arpa_inet'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-binary-io.sh.log: test-binary-io.sh @p='test-binary-io.sh'; \ b='test-binary-io.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-bind.log: test-bind$(EXEEXT) @p='test-bind$(EXEEXT)'; \ b='test-bind'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-bitrotate.log: test-bitrotate$(EXEEXT) @p='test-bitrotate$(EXEEXT)'; \ b='test-bitrotate'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-btowc1.sh.log: test-btowc1.sh @p='test-btowc1.sh'; \ b='test-btowc1.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-btowc2.sh.log: test-btowc2.sh @p='test-btowc2.sh'; \ b='test-btowc2.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-c-ctype.log: test-c-ctype$(EXEEXT) @p='test-c-ctype$(EXEEXT)'; \ b='test-c-ctype'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-c-stack.sh.log: test-c-stack.sh @p='test-c-stack.sh'; \ b='test-c-stack.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-c-stack2.sh.log: test-c-stack2.sh @p='test-c-stack2.sh'; \ b='test-c-stack2.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-c-strcase.sh.log: test-c-strcase.sh @p='test-c-strcase.sh'; \ b='test-c-strcase.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-calloc-gnu.log: test-calloc-gnu$(EXEEXT) @p='test-calloc-gnu$(EXEEXT)'; \ b='test-calloc-gnu'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-chdir.log: test-chdir$(EXEEXT) @p='test-chdir$(EXEEXT)'; \ b='test-chdir'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-cloexec.log: test-cloexec$(EXEEXT) @p='test-cloexec$(EXEEXT)'; \ b='test-cloexec'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-close.log: test-close$(EXEEXT) @p='test-close$(EXEEXT)'; \ b='test-close'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-connect.log: test-connect$(EXEEXT) @p='test-connect$(EXEEXT)'; \ b='test-connect'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-ctype.log: test-ctype$(EXEEXT) @p='test-ctype$(EXEEXT)'; \ b='test-ctype'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-dfa-invalid-char-class.sh.log: test-dfa-invalid-char-class.sh @p='test-dfa-invalid-char-class.sh'; \ b='test-dfa-invalid-char-class.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-dfa-invalid-merge.sh.log: test-dfa-invalid-merge.sh @p='test-dfa-invalid-merge.sh'; \ b='test-dfa-invalid-merge.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-dfa-match.sh.log: test-dfa-match.sh @p='test-dfa-match.sh'; \ b='test-dfa-match.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-dirent.log: test-dirent$(EXEEXT) @p='test-dirent$(EXEEXT)'; \ b='test-dirent'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-dup.log: test-dup$(EXEEXT) @p='test-dup$(EXEEXT)'; \ b='test-dup'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-dup2.log: test-dup2$(EXEEXT) @p='test-dup2$(EXEEXT)'; \ b='test-dup2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-dynarray.log: test-dynarray$(EXEEXT) @p='test-dynarray$(EXEEXT)'; \ b='test-dynarray'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-environ.log: test-environ$(EXEEXT) @p='test-environ$(EXEEXT)'; \ b='test-environ'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-errno.log: test-errno$(EXEEXT) @p='test-errno$(EXEEXT)'; \ b='test-errno'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-exclude1.sh.log: test-exclude1.sh @p='test-exclude1.sh'; \ b='test-exclude1.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-exclude2.sh.log: test-exclude2.sh @p='test-exclude2.sh'; \ b='test-exclude2.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-exclude3.sh.log: test-exclude3.sh @p='test-exclude3.sh'; \ b='test-exclude3.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-exclude4.sh.log: test-exclude4.sh @p='test-exclude4.sh'; \ b='test-exclude4.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-exclude5.sh.log: test-exclude5.sh @p='test-exclude5.sh'; \ b='test-exclude5.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-exclude6.sh.log: test-exclude6.sh @p='test-exclude6.sh'; \ b='test-exclude6.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-exclude7.sh.log: test-exclude7.sh @p='test-exclude7.sh'; \ b='test-exclude7.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-exclude8.sh.log: test-exclude8.sh @p='test-exclude8.sh'; \ b='test-exclude8.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fchdir.log: test-fchdir$(EXEEXT) @p='test-fchdir$(EXEEXT)'; \ b='test-fchdir'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fcntl-h.log: test-fcntl-h$(EXEEXT) @p='test-fcntl-h$(EXEEXT)'; \ b='test-fcntl-h'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fcntl-safer.log: test-fcntl-safer$(EXEEXT) @p='test-fcntl-safer$(EXEEXT)'; \ b='test-fcntl-safer'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fcntl.log: test-fcntl$(EXEEXT) @p='test-fcntl$(EXEEXT)'; \ b='test-fcntl'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fdopen.log: test-fdopen$(EXEEXT) @p='test-fdopen$(EXEEXT)'; \ b='test-fdopen'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fdopendir.log: test-fdopendir$(EXEEXT) @p='test-fdopendir$(EXEEXT)'; \ b='test-fdopendir'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fgetc.log: test-fgetc$(EXEEXT) @p='test-fgetc$(EXEEXT)'; \ b='test-fgetc'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-float.log: test-float$(EXEEXT) @p='test-float$(EXEEXT)'; \ b='test-float'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fnmatch-h.log: test-fnmatch-h$(EXEEXT) @p='test-fnmatch-h$(EXEEXT)'; \ b='test-fnmatch-h'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fnmatch.log: test-fnmatch$(EXEEXT) @p='test-fnmatch$(EXEEXT)'; \ b='test-fnmatch'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fopen-gnu.log: test-fopen-gnu$(EXEEXT) @p='test-fopen-gnu$(EXEEXT)'; \ b='test-fopen-gnu'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fopen.log: test-fopen$(EXEEXT) @p='test-fopen$(EXEEXT)'; \ b='test-fopen'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fpending.sh.log: test-fpending.sh @p='test-fpending.sh'; \ b='test-fpending.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fputc.log: test-fputc$(EXEEXT) @p='test-fputc$(EXEEXT)'; \ b='test-fputc'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fread.log: test-fread$(EXEEXT) @p='test-fread$(EXEEXT)'; \ b='test-fread'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-free.log: test-free$(EXEEXT) @p='test-free$(EXEEXT)'; \ b='test-free'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fstat.log: test-fstat$(EXEEXT) @p='test-fstat$(EXEEXT)'; \ b='test-fstat'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fstatat.log: test-fstatat$(EXEEXT) @p='test-fstatat$(EXEEXT)'; \ b='test-fstatat'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-ftruncate.sh.log: test-ftruncate.sh @p='test-ftruncate.sh'; \ b='test-ftruncate.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-fwrite.log: test-fwrite$(EXEEXT) @p='test-fwrite$(EXEEXT)'; \ b='test-fwrite'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-getcwd-lgpl.log: test-getcwd-lgpl$(EXEEXT) @p='test-getcwd-lgpl$(EXEEXT)'; \ b='test-getcwd-lgpl'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-getdtablesize.log: test-getdtablesize$(EXEEXT) @p='test-getdtablesize$(EXEEXT)'; \ b='test-getdtablesize'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-getopt-gnu.log: test-getopt-gnu$(EXEEXT) @p='test-getopt-gnu$(EXEEXT)'; \ b='test-getopt-gnu'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-getopt-posix.log: test-getopt-posix$(EXEEXT) @p='test-getopt-posix$(EXEEXT)'; \ b='test-getopt-posix'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-getprogname.log: test-getprogname$(EXEEXT) @p='test-getprogname$(EXEEXT)'; \ b='test-getprogname'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-gettimeofday.log: test-gettimeofday$(EXEEXT) @p='test-gettimeofday$(EXEEXT)'; \ b='test-gettimeofday'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-hard-locale.log: test-hard-locale$(EXEEXT) @p='test-hard-locale$(EXEEXT)'; \ b='test-hard-locale'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-hash.log: test-hash$(EXEEXT) @p='test-hash$(EXEEXT)'; \ b='test-hash'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-i-ring.log: test-i-ring$(EXEEXT) @p='test-i-ring$(EXEEXT)'; \ b='test-i-ring'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-iconv-h.log: test-iconv-h$(EXEEXT) @p='test-iconv-h$(EXEEXT)'; \ b='test-iconv-h'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-iconv.log: test-iconv$(EXEEXT) @p='test-iconv$(EXEEXT)'; \ b='test-iconv'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-ignore-value.log: test-ignore-value$(EXEEXT) @p='test-ignore-value$(EXEEXT)'; \ b='test-ignore-value'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-inet_pton.log: test-inet_pton$(EXEEXT) @p='test-inet_pton$(EXEEXT)'; \ b='test-inet_pton'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-intprops.log: test-intprops$(EXEEXT) @p='test-intprops$(EXEEXT)'; \ b='test-intprops'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-inttostr.log: test-inttostr$(EXEEXT) @p='test-inttostr$(EXEEXT)'; \ b='test-inttostr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-inttypes.log: test-inttypes$(EXEEXT) @p='test-inttypes$(EXEEXT)'; \ b='test-inttypes'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-ioctl.log: test-ioctl$(EXEEXT) @p='test-ioctl$(EXEEXT)'; \ b='test-ioctl'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-isatty.log: test-isatty$(EXEEXT) @p='test-isatty$(EXEEXT)'; \ b='test-isatty'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-isblank.log: test-isblank$(EXEEXT) @p='test-isblank$(EXEEXT)'; \ b='test-isblank'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-iswblank.log: test-iswblank$(EXEEXT) @p='test-iswblank$(EXEEXT)'; \ b='test-iswblank'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-iswdigit.sh.log: test-iswdigit.sh @p='test-iswdigit.sh'; \ b='test-iswdigit.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-iswxdigit.sh.log: test-iswxdigit.sh @p='test-iswxdigit.sh'; \ b='test-iswxdigit.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-langinfo.log: test-langinfo$(EXEEXT) @p='test-langinfo$(EXEEXT)'; \ b='test-langinfo'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-limits-h.log: test-limits-h$(EXEEXT) @p='test-limits-h$(EXEEXT)'; \ b='test-limits-h'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-listen.log: test-listen$(EXEEXT) @p='test-listen$(EXEEXT)'; \ b='test-listen'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-locale.log: test-locale$(EXEEXT) @p='test-locale$(EXEEXT)'; \ b='test-locale'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-localeconv.log: test-localeconv$(EXEEXT) @p='test-localeconv$(EXEEXT)'; \ b='test-localeconv'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-localename.log: test-localename$(EXEEXT) @p='test-localename$(EXEEXT)'; \ b='test-localename'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-lseek.sh.log: test-lseek.sh @p='test-lseek.sh'; \ b='test-lseek.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-lstat.log: test-lstat$(EXEEXT) @p='test-lstat$(EXEEXT)'; \ b='test-lstat'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-malloc-gnu.log: test-malloc-gnu$(EXEEXT) @p='test-malloc-gnu$(EXEEXT)'; \ b='test-malloc-gnu'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-malloca.log: test-malloca$(EXEEXT) @p='test-malloca$(EXEEXT)'; \ b='test-malloca'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-mbscasecmp.sh.log: test-mbscasecmp.sh @p='test-mbscasecmp.sh'; \ b='test-mbscasecmp.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-mbsinit.sh.log: test-mbsinit.sh @p='test-mbsinit.sh'; \ b='test-mbsinit.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-mbsrtowcs1.sh.log: test-mbsrtowcs1.sh @p='test-mbsrtowcs1.sh'; \ b='test-mbsrtowcs1.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-mbsrtowcs2.sh.log: test-mbsrtowcs2.sh @p='test-mbsrtowcs2.sh'; \ b='test-mbsrtowcs2.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-mbsrtowcs3.sh.log: test-mbsrtowcs3.sh @p='test-mbsrtowcs3.sh'; \ b='test-mbsrtowcs3.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-mbsrtowcs4.sh.log: test-mbsrtowcs4.sh @p='test-mbsrtowcs4.sh'; \ b='test-mbsrtowcs4.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-mbsstr1.log: test-mbsstr1$(EXEEXT) @p='test-mbsstr1$(EXEEXT)'; \ b='test-mbsstr1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-mbsstr2.sh.log: test-mbsstr2.sh @p='test-mbsstr2.sh'; \ b='test-mbsstr2.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-mbsstr3.sh.log: test-mbsstr3.sh @p='test-mbsstr3.sh'; \ b='test-mbsstr3.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-memchr.log: test-memchr$(EXEEXT) @p='test-memchr$(EXEEXT)'; \ b='test-memchr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-memchr2.log: test-memchr2$(EXEEXT) @p='test-memchr2$(EXEEXT)'; \ b='test-memchr2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-memrchr.log: test-memrchr$(EXEEXT) @p='test-memrchr$(EXEEXT)'; \ b='test-memrchr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-nanosleep.log: test-nanosleep$(EXEEXT) @p='test-nanosleep$(EXEEXT)'; \ b='test-nanosleep'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-netinet_in.log: test-netinet_in$(EXEEXT) @p='test-netinet_in$(EXEEXT)'; \ b='test-netinet_in'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-nl_langinfo.sh.log: test-nl_langinfo.sh @p='test-nl_langinfo.sh'; \ b='test-nl_langinfo.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-nl_langinfo-mt.log: test-nl_langinfo-mt$(EXEEXT) @p='test-nl_langinfo-mt$(EXEEXT)'; \ b='test-nl_langinfo-mt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-open.log: test-open$(EXEEXT) @p='test-open$(EXEEXT)'; \ b='test-open'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-openat-safer.log: test-openat-safer$(EXEEXT) @p='test-openat-safer$(EXEEXT)'; \ b='test-openat-safer'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-openat.log: test-openat$(EXEEXT) @p='test-openat$(EXEEXT)'; \ b='test-openat'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-pathmax.log: test-pathmax$(EXEEXT) @p='test-pathmax$(EXEEXT)'; \ b='test-pathmax'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-perror.sh.log: test-perror.sh @p='test-perror.sh'; \ b='test-perror.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-perror2.log: test-perror2$(EXEEXT) @p='test-perror2$(EXEEXT)'; \ b='test-perror2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-pipe.log: test-pipe$(EXEEXT) @p='test-pipe$(EXEEXT)'; \ b='test-pipe'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-pthread.log: test-pthread$(EXEEXT) @p='test-pthread$(EXEEXT)'; \ b='test-pthread'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-pthread-thread.log: test-pthread-thread$(EXEEXT) @p='test-pthread-thread$(EXEEXT)'; \ b='test-pthread-thread'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-pthread_sigmask1.log: test-pthread_sigmask1$(EXEEXT) @p='test-pthread_sigmask1$(EXEEXT)'; \ b='test-pthread_sigmask1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-pthread_sigmask2.log: test-pthread_sigmask2$(EXEEXT) @p='test-pthread_sigmask2$(EXEEXT)'; \ b='test-pthread_sigmask2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-quotearg-simple.log: test-quotearg-simple$(EXEEXT) @p='test-quotearg-simple$(EXEEXT)'; \ b='test-quotearg-simple'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-raise.log: test-raise$(EXEEXT) @p='test-raise$(EXEEXT)'; \ b='test-raise'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-rawmemchr.log: test-rawmemchr$(EXEEXT) @p='test-rawmemchr$(EXEEXT)'; \ b='test-rawmemchr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-read.log: test-read$(EXEEXT) @p='test-read$(EXEEXT)'; \ b='test-read'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-realloc-gnu.log: test-realloc-gnu$(EXEEXT) @p='test-realloc-gnu$(EXEEXT)'; \ b='test-realloc-gnu'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-reallocarray.log: test-reallocarray$(EXEEXT) @p='test-reallocarray$(EXEEXT)'; \ b='test-reallocarray'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-regex.log: test-regex$(EXEEXT) @p='test-regex$(EXEEXT)'; \ b='test-regex'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sched.log: test-sched$(EXEEXT) @p='test-sched$(EXEEXT)'; \ b='test-sched'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-select.log: test-select$(EXEEXT) @p='test-select$(EXEEXT)'; \ b='test-select'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-select-in.sh.log: test-select-in.sh @p='test-select-in.sh'; \ b='test-select-in.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-select-out.sh.log: test-select-out.sh @p='test-select-out.sh'; \ b='test-select-out.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-setenv.log: test-setenv$(EXEEXT) @p='test-setenv$(EXEEXT)'; \ b='test-setenv'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-setlocale_null.log: test-setlocale_null$(EXEEXT) @p='test-setlocale_null$(EXEEXT)'; \ b='test-setlocale_null'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-setlocale_null-mt-one.log: test-setlocale_null-mt-one$(EXEEXT) @p='test-setlocale_null-mt-one$(EXEEXT)'; \ b='test-setlocale_null-mt-one'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-setlocale_null-mt-all.log: test-setlocale_null-mt-all$(EXEEXT) @p='test-setlocale_null-mt-all$(EXEEXT)'; \ b='test-setlocale_null-mt-all'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-setlocale1.sh.log: test-setlocale1.sh @p='test-setlocale1.sh'; \ b='test-setlocale1.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-setlocale2.sh.log: test-setlocale2.sh @p='test-setlocale2.sh'; \ b='test-setlocale2.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-setsockopt.log: test-setsockopt$(EXEEXT) @p='test-setsockopt$(EXEEXT)'; \ b='test-setsockopt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sigaction.log: test-sigaction$(EXEEXT) @p='test-sigaction$(EXEEXT)'; \ b='test-sigaction'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-signal-h.log: test-signal-h$(EXEEXT) @p='test-signal-h$(EXEEXT)'; \ b='test-signal-h'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sigprocmask.log: test-sigprocmask$(EXEEXT) @p='test-sigprocmask$(EXEEXT)'; \ b='test-sigprocmask'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sigsegv-catch-segv1.log: test-sigsegv-catch-segv1$(EXEEXT) @p='test-sigsegv-catch-segv1$(EXEEXT)'; \ b='test-sigsegv-catch-segv1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sigsegv-catch-segv2.log: test-sigsegv-catch-segv2$(EXEEXT) @p='test-sigsegv-catch-segv2$(EXEEXT)'; \ b='test-sigsegv-catch-segv2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sigsegv-catch-stackoverflow1.log: test-sigsegv-catch-stackoverflow1$(EXEEXT) @p='test-sigsegv-catch-stackoverflow1$(EXEEXT)'; \ b='test-sigsegv-catch-stackoverflow1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sigsegv-catch-stackoverflow2.log: test-sigsegv-catch-stackoverflow2$(EXEEXT) @p='test-sigsegv-catch-stackoverflow2$(EXEEXT)'; \ b='test-sigsegv-catch-stackoverflow2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sleep.log: test-sleep$(EXEEXT) @p='test-sleep$(EXEEXT)'; \ b='test-sleep'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-snprintf.log: test-snprintf$(EXEEXT) @p='test-snprintf$(EXEEXT)'; \ b='test-snprintf'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sockets.log: test-sockets$(EXEEXT) @p='test-sockets$(EXEEXT)'; \ b='test-sockets'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-stat.log: test-stat$(EXEEXT) @p='test-stat$(EXEEXT)'; \ b='test-stat'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-stat-time.log: test-stat-time$(EXEEXT) @p='test-stat-time$(EXEEXT)'; \ b='test-stat-time'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-stdalign.log: test-stdalign$(EXEEXT) @p='test-stdalign$(EXEEXT)'; \ b='test-stdalign'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-stdbool.log: test-stdbool$(EXEEXT) @p='test-stdbool$(EXEEXT)'; \ b='test-stdbool'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-stddef.log: test-stddef$(EXEEXT) @p='test-stddef$(EXEEXT)'; \ b='test-stddef'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-stdint.log: test-stdint$(EXEEXT) @p='test-stdint$(EXEEXT)'; \ b='test-stdint'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-stdio.log: test-stdio$(EXEEXT) @p='test-stdio$(EXEEXT)'; \ b='test-stdio'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-stdlib.log: test-stdlib$(EXEEXT) @p='test-stdlib$(EXEEXT)'; \ b='test-stdlib'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-strerror.log: test-strerror$(EXEEXT) @p='test-strerror$(EXEEXT)'; \ b='test-strerror'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-strerror_r.log: test-strerror_r$(EXEEXT) @p='test-strerror_r$(EXEEXT)'; \ b='test-strerror_r'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-striconv.log: test-striconv$(EXEEXT) @p='test-striconv$(EXEEXT)'; \ b='test-striconv'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-string.log: test-string$(EXEEXT) @p='test-string$(EXEEXT)'; \ b='test-string'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-strnlen.log: test-strnlen$(EXEEXT) @p='test-strnlen$(EXEEXT)'; \ b='test-strnlen'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-strstr.log: test-strstr$(EXEEXT) @p='test-strstr$(EXEEXT)'; \ b='test-strstr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-strtoimax.log: test-strtoimax$(EXEEXT) @p='test-strtoimax$(EXEEXT)'; \ b='test-strtoimax'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-strtoll.log: test-strtoll$(EXEEXT) @p='test-strtoll$(EXEEXT)'; \ b='test-strtoll'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-strtoull.log: test-strtoull$(EXEEXT) @p='test-strtoull$(EXEEXT)'; \ b='test-strtoull'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-strtoumax.log: test-strtoumax$(EXEEXT) @p='test-strtoumax$(EXEEXT)'; \ b='test-strtoumax'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-symlink.log: test-symlink$(EXEEXT) @p='test-symlink$(EXEEXT)'; \ b='test-symlink'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sys_ioctl.log: test-sys_ioctl$(EXEEXT) @p='test-sys_ioctl$(EXEEXT)'; \ b='test-sys_ioctl'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sys_select.log: test-sys_select$(EXEEXT) @p='test-sys_select$(EXEEXT)'; \ b='test-sys_select'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sys_socket.log: test-sys_socket$(EXEEXT) @p='test-sys_socket$(EXEEXT)'; \ b='test-sys_socket'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sys_stat.log: test-sys_stat$(EXEEXT) @p='test-sys_stat$(EXEEXT)'; \ b='test-sys_stat'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sys_time.log: test-sys_time$(EXEEXT) @p='test-sys_time$(EXEEXT)'; \ b='test-sys_time'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sys_types.log: test-sys_types$(EXEEXT) @p='test-sys_types$(EXEEXT)'; \ b='test-sys_types'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-sys_uio.log: test-sys_uio$(EXEEXT) @p='test-sys_uio$(EXEEXT)'; \ b='test-sys_uio'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-init.sh.log: test-init.sh @p='test-init.sh'; \ b='test-init.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-thread_self.log: test-thread_self$(EXEEXT) @p='test-thread_self$(EXEEXT)'; \ b='test-thread_self'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-thread_create.log: test-thread_create$(EXEEXT) @p='test-thread_create$(EXEEXT)'; \ b='test-thread_create'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-time.log: test-time$(EXEEXT) @p='test-time$(EXEEXT)'; \ b='test-time'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-dup-safer.log: test-dup-safer$(EXEEXT) @p='test-dup-safer$(EXEEXT)'; \ b='test-dup-safer'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-unistd.log: test-unistd$(EXEEXT) @p='test-unistd$(EXEEXT)'; \ b='test-unistd'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-u8-mbtoucr.log: test-u8-mbtoucr$(EXEEXT) @p='test-u8-mbtoucr$(EXEEXT)'; \ b='test-u8-mbtoucr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-u8-uctomb.log: test-u8-uctomb$(EXEEXT) @p='test-u8-uctomb$(EXEEXT)'; \ b='test-u8-uctomb'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-uc_width.log: test-uc_width$(EXEEXT) @p='test-uc_width$(EXEEXT)'; \ b='test-uc_width'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) uniwidth/test-uc_width2.sh.log: uniwidth/test-uc_width2.sh @p='uniwidth/test-uc_width2.sh'; \ b='uniwidth/test-uc_width2.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-unsetenv.log: test-unsetenv$(EXEEXT) @p='test-unsetenv$(EXEEXT)'; \ b='test-unsetenv'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-vasnprintf.log: test-vasnprintf$(EXEEXT) @p='test-vasnprintf$(EXEEXT)'; \ b='test-vasnprintf'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-vc-list-files-git.sh.log: test-vc-list-files-git.sh @p='test-vc-list-files-git.sh'; \ b='test-vc-list-files-git.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-vc-list-files-cvs.sh.log: test-vc-list-files-cvs.sh @p='test-vc-list-files-cvs.sh'; \ b='test-vc-list-files-cvs.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-verify.log: test-verify$(EXEEXT) @p='test-verify$(EXEEXT)'; \ b='test-verify'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-verify.sh.log: test-verify.sh @p='test-verify.sh'; \ b='test-verify.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-version-etc.sh.log: test-version-etc.sh @p='test-version-etc.sh'; \ b='test-version-etc.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wchar.log: test-wchar$(EXEEXT) @p='test-wchar$(EXEEXT)'; \ b='test-wchar'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wcrtomb.sh.log: test-wcrtomb.sh @p='test-wcrtomb.sh'; \ b='test-wcrtomb.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wcrtomb-w32-1.sh.log: test-wcrtomb-w32-1.sh @p='test-wcrtomb-w32-1.sh'; \ b='test-wcrtomb-w32-1.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wcrtomb-w32-2.sh.log: test-wcrtomb-w32-2.sh @p='test-wcrtomb-w32-2.sh'; \ b='test-wcrtomb-w32-2.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wcrtomb-w32-3.sh.log: test-wcrtomb-w32-3.sh @p='test-wcrtomb-w32-3.sh'; \ b='test-wcrtomb-w32-3.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wcrtomb-w32-4.sh.log: test-wcrtomb-w32-4.sh @p='test-wcrtomb-w32-4.sh'; \ b='test-wcrtomb-w32-4.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wcrtomb-w32-5.sh.log: test-wcrtomb-w32-5.sh @p='test-wcrtomb-w32-5.sh'; \ b='test-wcrtomb-w32-5.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wcrtomb-w32-6.sh.log: test-wcrtomb-w32-6.sh @p='test-wcrtomb-w32-6.sh'; \ b='test-wcrtomb-w32-6.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wcrtomb-w32-7.sh.log: test-wcrtomb-w32-7.sh @p='test-wcrtomb-w32-7.sh'; \ b='test-wcrtomb-w32-7.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wctype-h.log: test-wctype-h$(EXEEXT) @p='test-wctype-h$(EXEEXT)'; \ b='test-wctype-h'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-wcwidth.log: test-wcwidth$(EXEEXT) @p='test-wcwidth$(EXEEXT)'; \ b='test-wcwidth'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-xalloc-die.sh.log: test-xalloc-die.sh @p='test-xalloc-die.sh'; \ b='test-xalloc-die.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-xstrtoimax.sh.log: test-xstrtoimax.sh @p='test-xstrtoimax.sh'; \ b='test-xstrtoimax.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test-xstrtol.sh.log: test-xstrtol.sh @p='test-xstrtol.sh'; \ b='test-xstrtol.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_LIBRARIES) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(PROGRAMS) $(LIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f glthread/$(DEPDIR)/$(am__dirstamp) -rm -f glthread/$(am__dirstamp) -rm -f unistr/$(DEPDIR)/$(am__dirstamp) -rm -f unistr/$(am__dirstamp) -rm -f uniwidth/$(DEPDIR)/$(am__dirstamp) -rm -f uniwidth/$(am__dirstamp) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-checkLIBRARIES clean-checkPROGRAMS clean-generic \ clean-local clean-noinstLIBRARIES clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/accept.Po -rm -f ./$(DEPDIR)/anytostr.Po -rm -f ./$(DEPDIR)/asnprintf.Po -rm -f ./$(DEPDIR)/bind.Po -rm -f ./$(DEPDIR)/connect.Po -rm -f ./$(DEPDIR)/fdopen.Po -rm -f ./$(DEPDIR)/float.Po -rm -f ./$(DEPDIR)/ftruncate.Po -rm -f ./$(DEPDIR)/gettimeofday.Po -rm -f ./$(DEPDIR)/hash-pjw.Po -rm -f ./$(DEPDIR)/imaxtostr.Po -rm -f ./$(DEPDIR)/inet_pton.Po -rm -f ./$(DEPDIR)/inttostr.Po -rm -f ./$(DEPDIR)/ioctl.Po -rm -f ./$(DEPDIR)/itold.Po -rm -f ./$(DEPDIR)/listen.Po -rm -f ./$(DEPDIR)/locale.Po -rm -f ./$(DEPDIR)/localename-table.Po -rm -f ./$(DEPDIR)/localename.Po -rm -f ./$(DEPDIR)/nanosleep.Po -rm -f ./$(DEPDIR)/offtostr.Po -rm -f ./$(DEPDIR)/perror.Po -rm -f ./$(DEPDIR)/printf-args.Po -rm -f ./$(DEPDIR)/printf-parse.Po -rm -f ./$(DEPDIR)/pthread-thread.Po -rm -f ./$(DEPDIR)/pthread_sigmask.Po -rm -f ./$(DEPDIR)/putenv.Po -rm -f ./$(DEPDIR)/select.Po -rm -f ./$(DEPDIR)/setenv.Po -rm -f ./$(DEPDIR)/setlocale.Po -rm -f ./$(DEPDIR)/setsockopt.Po -rm -f ./$(DEPDIR)/sig-handler.Po -rm -f ./$(DEPDIR)/sigaction.Po -rm -f ./$(DEPDIR)/sigprocmask.Po -rm -f ./$(DEPDIR)/sleep.Po -rm -f ./$(DEPDIR)/snprintf.Po -rm -f ./$(DEPDIR)/socket.Po -rm -f ./$(DEPDIR)/sockets.Po -rm -f ./$(DEPDIR)/strerror_r.Po -rm -f ./$(DEPDIR)/symlink.Po -rm -f ./$(DEPDIR)/sys_socket.Po -rm -f ./$(DEPDIR)/test-accept.Po -rm -f ./$(DEPDIR)/test-alignof.Po -rm -f ./$(DEPDIR)/test-alloca-opt.Po -rm -f ./$(DEPDIR)/test-argmatch.Po -rm -f ./$(DEPDIR)/test-arpa_inet.Po -rm -f ./$(DEPDIR)/test-binary-io.Po -rm -f ./$(DEPDIR)/test-bind.Po -rm -f ./$(DEPDIR)/test-bitrotate.Po -rm -f ./$(DEPDIR)/test-btowc.Po -rm -f ./$(DEPDIR)/test-c-ctype.Po -rm -f ./$(DEPDIR)/test-c-stack.Po -rm -f ./$(DEPDIR)/test-c-strcasecmp.Po -rm -f ./$(DEPDIR)/test-c-strncasecmp.Po -rm -f ./$(DEPDIR)/test-calloc-gnu.Po -rm -f ./$(DEPDIR)/test-chdir.Po -rm -f ./$(DEPDIR)/test-cloexec.Po -rm -f ./$(DEPDIR)/test-close.Po -rm -f ./$(DEPDIR)/test-connect.Po -rm -f ./$(DEPDIR)/test-ctype.Po -rm -f ./$(DEPDIR)/test-dfa-match-aux.Po -rm -f ./$(DEPDIR)/test-dirent.Po -rm -f ./$(DEPDIR)/test-dup-safer.Po -rm -f ./$(DEPDIR)/test-dup.Po -rm -f ./$(DEPDIR)/test-dup2.Po -rm -f ./$(DEPDIR)/test-dynarray.Po -rm -f ./$(DEPDIR)/test-environ.Po -rm -f ./$(DEPDIR)/test-errno.Po -rm -f ./$(DEPDIR)/test-exclude.Po -rm -f ./$(DEPDIR)/test-fchdir.Po -rm -f ./$(DEPDIR)/test-fcntl-h.Po -rm -f ./$(DEPDIR)/test-fcntl-safer.Po -rm -f ./$(DEPDIR)/test-fcntl.Po -rm -f ./$(DEPDIR)/test-fdopen.Po -rm -f ./$(DEPDIR)/test-fdopendir.Po -rm -f ./$(DEPDIR)/test-fgetc.Po -rm -f ./$(DEPDIR)/test-float.Po -rm -f ./$(DEPDIR)/test-fnmatch-h.Po -rm -f ./$(DEPDIR)/test-fnmatch.Po -rm -f ./$(DEPDIR)/test-fopen-gnu.Po -rm -f ./$(DEPDIR)/test-fopen.Po -rm -f ./$(DEPDIR)/test-fpending.Po -rm -f ./$(DEPDIR)/test-fputc.Po -rm -f ./$(DEPDIR)/test-fread.Po -rm -f ./$(DEPDIR)/test-free.Po -rm -f ./$(DEPDIR)/test-fstat.Po -rm -f ./$(DEPDIR)/test-fstatat.Po -rm -f ./$(DEPDIR)/test-ftruncate.Po -rm -f ./$(DEPDIR)/test-fwrite.Po -rm -f ./$(DEPDIR)/test-getcwd-lgpl.Po -rm -f ./$(DEPDIR)/test-getdtablesize.Po -rm -f ./$(DEPDIR)/test-getopt-gnu.Po -rm -f ./$(DEPDIR)/test-getopt-posix.Po -rm -f ./$(DEPDIR)/test-getprogname.Po -rm -f ./$(DEPDIR)/test-gettimeofday.Po -rm -f ./$(DEPDIR)/test-hard-locale.Po -rm -f ./$(DEPDIR)/test-hash.Po -rm -f ./$(DEPDIR)/test-i-ring.Po -rm -f ./$(DEPDIR)/test-iconv-h.Po -rm -f ./$(DEPDIR)/test-iconv.Po -rm -f ./$(DEPDIR)/test-ignore-value.Po -rm -f ./$(DEPDIR)/test-inet_pton.Po -rm -f ./$(DEPDIR)/test-intprops.Po -rm -f ./$(DEPDIR)/test-inttostr.Po -rm -f ./$(DEPDIR)/test-inttypes.Po -rm -f ./$(DEPDIR)/test-ioctl.Po -rm -f ./$(DEPDIR)/test-isatty.Po -rm -f ./$(DEPDIR)/test-isblank.Po -rm -f ./$(DEPDIR)/test-iswblank.Po -rm -f ./$(DEPDIR)/test-iswdigit.Po -rm -f ./$(DEPDIR)/test-iswxdigit.Po -rm -f ./$(DEPDIR)/test-langinfo.Po -rm -f ./$(DEPDIR)/test-limits-h.Po -rm -f ./$(DEPDIR)/test-listen.Po -rm -f ./$(DEPDIR)/test-localcharset.Po -rm -f ./$(DEPDIR)/test-locale.Po -rm -f ./$(DEPDIR)/test-localeconv.Po -rm -f ./$(DEPDIR)/test-localename.Po -rm -f ./$(DEPDIR)/test-lseek.Po -rm -f ./$(DEPDIR)/test-lstat.Po -rm -f ./$(DEPDIR)/test-malloc-gnu.Po -rm -f ./$(DEPDIR)/test-malloca.Po -rm -f ./$(DEPDIR)/test-mbscasecmp.Po -rm -f ./$(DEPDIR)/test-mbsinit.Po -rm -f ./$(DEPDIR)/test-mbsrtowcs.Po -rm -f ./$(DEPDIR)/test-mbsstr1.Po -rm -f ./$(DEPDIR)/test-mbsstr2.Po -rm -f ./$(DEPDIR)/test-mbsstr3.Po -rm -f ./$(DEPDIR)/test-memchr.Po -rm -f ./$(DEPDIR)/test-memchr2.Po -rm -f ./$(DEPDIR)/test-memrchr.Po -rm -f ./$(DEPDIR)/test-nanosleep.Po -rm -f ./$(DEPDIR)/test-netinet_in.Po -rm -f ./$(DEPDIR)/test-nl_langinfo-mt.Po -rm -f ./$(DEPDIR)/test-nl_langinfo.Po -rm -f ./$(DEPDIR)/test-open.Po -rm -f ./$(DEPDIR)/test-openat-safer.Po -rm -f ./$(DEPDIR)/test-openat.Po -rm -f ./$(DEPDIR)/test-pathmax.Po -rm -f ./$(DEPDIR)/test-perror.Po -rm -f ./$(DEPDIR)/test-perror2.Po -rm -f ./$(DEPDIR)/test-pipe.Po -rm -f ./$(DEPDIR)/test-pthread-thread.Po -rm -f ./$(DEPDIR)/test-pthread.Po -rm -f ./$(DEPDIR)/test-pthread_sigmask1.Po -rm -f ./$(DEPDIR)/test-pthread_sigmask2.Po -rm -f ./$(DEPDIR)/test-quotearg-simple.Po -rm -f ./$(DEPDIR)/test-raise.Po -rm -f ./$(DEPDIR)/test-rawmemchr.Po -rm -f ./$(DEPDIR)/test-read.Po -rm -f ./$(DEPDIR)/test-realloc-gnu.Po -rm -f ./$(DEPDIR)/test-reallocarray.Po -rm -f ./$(DEPDIR)/test-regex.Po -rm -f ./$(DEPDIR)/test-sched.Po -rm -f ./$(DEPDIR)/test-select-fd.Po -rm -f ./$(DEPDIR)/test-select-stdin.Po -rm -f ./$(DEPDIR)/test-select.Po -rm -f ./$(DEPDIR)/test-setenv.Po -rm -f ./$(DEPDIR)/test-setlocale1.Po -rm -f ./$(DEPDIR)/test-setlocale2.Po -rm -f ./$(DEPDIR)/test-setlocale_null-mt-all.Po -rm -f ./$(DEPDIR)/test-setlocale_null-mt-one.Po -rm -f ./$(DEPDIR)/test-setlocale_null.Po -rm -f ./$(DEPDIR)/test-setsockopt.Po -rm -f ./$(DEPDIR)/test-sigaction.Po -rm -f ./$(DEPDIR)/test-signal-h.Po -rm -f ./$(DEPDIR)/test-sigprocmask.Po -rm -f ./$(DEPDIR)/test-sigsegv-catch-segv1.Po -rm -f ./$(DEPDIR)/test-sigsegv-catch-segv2.Po -rm -f ./$(DEPDIR)/test-sigsegv-catch-stackoverflow1.Po -rm -f ./$(DEPDIR)/test-sigsegv-catch-stackoverflow2.Po -rm -f ./$(DEPDIR)/test-sleep.Po -rm -f ./$(DEPDIR)/test-snprintf.Po -rm -f ./$(DEPDIR)/test-sockets.Po -rm -f ./$(DEPDIR)/test-stat-time.Po -rm -f ./$(DEPDIR)/test-stat.Po -rm -f ./$(DEPDIR)/test-stdalign.Po -rm -f ./$(DEPDIR)/test-stdbool.Po -rm -f ./$(DEPDIR)/test-stddef.Po -rm -f ./$(DEPDIR)/test-stdint.Po -rm -f ./$(DEPDIR)/test-stdio.Po -rm -f ./$(DEPDIR)/test-stdlib.Po -rm -f ./$(DEPDIR)/test-strerror.Po -rm -f ./$(DEPDIR)/test-strerror_r.Po -rm -f ./$(DEPDIR)/test-striconv.Po -rm -f ./$(DEPDIR)/test-string.Po -rm -f ./$(DEPDIR)/test-strnlen.Po -rm -f ./$(DEPDIR)/test-strstr.Po -rm -f ./$(DEPDIR)/test-strtoimax.Po -rm -f ./$(DEPDIR)/test-strtoll.Po -rm -f ./$(DEPDIR)/test-strtoull.Po -rm -f ./$(DEPDIR)/test-strtoumax.Po -rm -f ./$(DEPDIR)/test-symlink.Po -rm -f ./$(DEPDIR)/test-sys_ioctl.Po -rm -f ./$(DEPDIR)/test-sys_select.Po -rm -f ./$(DEPDIR)/test-sys_socket.Po -rm -f ./$(DEPDIR)/test-sys_stat.Po -rm -f ./$(DEPDIR)/test-sys_time.Po -rm -f ./$(DEPDIR)/test-sys_types.Po -rm -f ./$(DEPDIR)/test-sys_uio.Po -rm -f ./$(DEPDIR)/test-thread_create.Po -rm -f ./$(DEPDIR)/test-thread_self.Po -rm -f ./$(DEPDIR)/test-time.Po -rm -f ./$(DEPDIR)/test-unistd.Po -rm -f ./$(DEPDIR)/test-unsetenv.Po -rm -f ./$(DEPDIR)/test-vasnprintf.Po -rm -f ./$(DEPDIR)/test-verify-try.Po -rm -f ./$(DEPDIR)/test-verify.Po -rm -f ./$(DEPDIR)/test-version-etc.Po -rm -f ./$(DEPDIR)/test-wchar.Po -rm -f ./$(DEPDIR)/test-wcrtomb-w32.Po -rm -f ./$(DEPDIR)/test-wcrtomb.Po -rm -f ./$(DEPDIR)/test-wctype-h.Po -rm -f ./$(DEPDIR)/test-wcwidth.Po -rm -f ./$(DEPDIR)/test-xalloc-die.Po -rm -f ./$(DEPDIR)/test-xstrtoimax.Po -rm -f ./$(DEPDIR)/test-xstrtol.Po -rm -f ./$(DEPDIR)/test-xstrtoul.Po -rm -f ./$(DEPDIR)/uinttostr.Po -rm -f ./$(DEPDIR)/umaxtostr.Po -rm -f ./$(DEPDIR)/unsetenv.Po -rm -f ./$(DEPDIR)/vasnprintf.Po -rm -f ./$(DEPDIR)/windows-thread.Po -rm -f ./$(DEPDIR)/windows-tls.Po -rm -f ./$(DEPDIR)/xsize.Po -rm -f ./$(DEPDIR)/xstrtol-error.Po -rm -f glthread/$(DEPDIR)/thread.Po -rm -f unistr/$(DEPDIR)/test-u8-mbtoucr.Po -rm -f unistr/$(DEPDIR)/test-u8-uctomb.Po -rm -f uniwidth/$(DEPDIR)/test-uc_width.Po -rm -f uniwidth/$(DEPDIR)/test-uc_width2.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/accept.Po -rm -f ./$(DEPDIR)/anytostr.Po -rm -f ./$(DEPDIR)/asnprintf.Po -rm -f ./$(DEPDIR)/bind.Po -rm -f ./$(DEPDIR)/connect.Po -rm -f ./$(DEPDIR)/fdopen.Po -rm -f ./$(DEPDIR)/float.Po -rm -f ./$(DEPDIR)/ftruncate.Po -rm -f ./$(DEPDIR)/gettimeofday.Po -rm -f ./$(DEPDIR)/hash-pjw.Po -rm -f ./$(DEPDIR)/imaxtostr.Po -rm -f ./$(DEPDIR)/inet_pton.Po -rm -f ./$(DEPDIR)/inttostr.Po -rm -f ./$(DEPDIR)/ioctl.Po -rm -f ./$(DEPDIR)/itold.Po -rm -f ./$(DEPDIR)/listen.Po -rm -f ./$(DEPDIR)/locale.Po -rm -f ./$(DEPDIR)/localename-table.Po -rm -f ./$(DEPDIR)/localename.Po -rm -f ./$(DEPDIR)/nanosleep.Po -rm -f ./$(DEPDIR)/offtostr.Po -rm -f ./$(DEPDIR)/perror.Po -rm -f ./$(DEPDIR)/printf-args.Po -rm -f ./$(DEPDIR)/printf-parse.Po -rm -f ./$(DEPDIR)/pthread-thread.Po -rm -f ./$(DEPDIR)/pthread_sigmask.Po -rm -f ./$(DEPDIR)/putenv.Po -rm -f ./$(DEPDIR)/select.Po -rm -f ./$(DEPDIR)/setenv.Po -rm -f ./$(DEPDIR)/setlocale.Po -rm -f ./$(DEPDIR)/setsockopt.Po -rm -f ./$(DEPDIR)/sig-handler.Po -rm -f ./$(DEPDIR)/sigaction.Po -rm -f ./$(DEPDIR)/sigprocmask.Po -rm -f ./$(DEPDIR)/sleep.Po -rm -f ./$(DEPDIR)/snprintf.Po -rm -f ./$(DEPDIR)/socket.Po -rm -f ./$(DEPDIR)/sockets.Po -rm -f ./$(DEPDIR)/strerror_r.Po -rm -f ./$(DEPDIR)/symlink.Po -rm -f ./$(DEPDIR)/sys_socket.Po -rm -f ./$(DEPDIR)/test-accept.Po -rm -f ./$(DEPDIR)/test-alignof.Po -rm -f ./$(DEPDIR)/test-alloca-opt.Po -rm -f ./$(DEPDIR)/test-argmatch.Po -rm -f ./$(DEPDIR)/test-arpa_inet.Po -rm -f ./$(DEPDIR)/test-binary-io.Po -rm -f ./$(DEPDIR)/test-bind.Po -rm -f ./$(DEPDIR)/test-bitrotate.Po -rm -f ./$(DEPDIR)/test-btowc.Po -rm -f ./$(DEPDIR)/test-c-ctype.Po -rm -f ./$(DEPDIR)/test-c-stack.Po -rm -f ./$(DEPDIR)/test-c-strcasecmp.Po -rm -f ./$(DEPDIR)/test-c-strncasecmp.Po -rm -f ./$(DEPDIR)/test-calloc-gnu.Po -rm -f ./$(DEPDIR)/test-chdir.Po -rm -f ./$(DEPDIR)/test-cloexec.Po -rm -f ./$(DEPDIR)/test-close.Po -rm -f ./$(DEPDIR)/test-connect.Po -rm -f ./$(DEPDIR)/test-ctype.Po -rm -f ./$(DEPDIR)/test-dfa-match-aux.Po -rm -f ./$(DEPDIR)/test-dirent.Po -rm -f ./$(DEPDIR)/test-dup-safer.Po -rm -f ./$(DEPDIR)/test-dup.Po -rm -f ./$(DEPDIR)/test-dup2.Po -rm -f ./$(DEPDIR)/test-dynarray.Po -rm -f ./$(DEPDIR)/test-environ.Po -rm -f ./$(DEPDIR)/test-errno.Po -rm -f ./$(DEPDIR)/test-exclude.Po -rm -f ./$(DEPDIR)/test-fchdir.Po -rm -f ./$(DEPDIR)/test-fcntl-h.Po -rm -f ./$(DEPDIR)/test-fcntl-safer.Po -rm -f ./$(DEPDIR)/test-fcntl.Po -rm -f ./$(DEPDIR)/test-fdopen.Po -rm -f ./$(DEPDIR)/test-fdopendir.Po -rm -f ./$(DEPDIR)/test-fgetc.Po -rm -f ./$(DEPDIR)/test-float.Po -rm -f ./$(DEPDIR)/test-fnmatch-h.Po -rm -f ./$(DEPDIR)/test-fnmatch.Po -rm -f ./$(DEPDIR)/test-fopen-gnu.Po -rm -f ./$(DEPDIR)/test-fopen.Po -rm -f ./$(DEPDIR)/test-fpending.Po -rm -f ./$(DEPDIR)/test-fputc.Po -rm -f ./$(DEPDIR)/test-fread.Po -rm -f ./$(DEPDIR)/test-free.Po -rm -f ./$(DEPDIR)/test-fstat.Po -rm -f ./$(DEPDIR)/test-fstatat.Po -rm -f ./$(DEPDIR)/test-ftruncate.Po -rm -f ./$(DEPDIR)/test-fwrite.Po -rm -f ./$(DEPDIR)/test-getcwd-lgpl.Po -rm -f ./$(DEPDIR)/test-getdtablesize.Po -rm -f ./$(DEPDIR)/test-getopt-gnu.Po -rm -f ./$(DEPDIR)/test-getopt-posix.Po -rm -f ./$(DEPDIR)/test-getprogname.Po -rm -f ./$(DEPDIR)/test-gettimeofday.Po -rm -f ./$(DEPDIR)/test-hard-locale.Po -rm -f ./$(DEPDIR)/test-hash.Po -rm -f ./$(DEPDIR)/test-i-ring.Po -rm -f ./$(DEPDIR)/test-iconv-h.Po -rm -f ./$(DEPDIR)/test-iconv.Po -rm -f ./$(DEPDIR)/test-ignore-value.Po -rm -f ./$(DEPDIR)/test-inet_pton.Po -rm -f ./$(DEPDIR)/test-intprops.Po -rm -f ./$(DEPDIR)/test-inttostr.Po -rm -f ./$(DEPDIR)/test-inttypes.Po -rm -f ./$(DEPDIR)/test-ioctl.Po -rm -f ./$(DEPDIR)/test-isatty.Po -rm -f ./$(DEPDIR)/test-isblank.Po -rm -f ./$(DEPDIR)/test-iswblank.Po -rm -f ./$(DEPDIR)/test-iswdigit.Po -rm -f ./$(DEPDIR)/test-iswxdigit.Po -rm -f ./$(DEPDIR)/test-langinfo.Po -rm -f ./$(DEPDIR)/test-limits-h.Po -rm -f ./$(DEPDIR)/test-listen.Po -rm -f ./$(DEPDIR)/test-localcharset.Po -rm -f ./$(DEPDIR)/test-locale.Po -rm -f ./$(DEPDIR)/test-localeconv.Po -rm -f ./$(DEPDIR)/test-localename.Po -rm -f ./$(DEPDIR)/test-lseek.Po -rm -f ./$(DEPDIR)/test-lstat.Po -rm -f ./$(DEPDIR)/test-malloc-gnu.Po -rm -f ./$(DEPDIR)/test-malloca.Po -rm -f ./$(DEPDIR)/test-mbscasecmp.Po -rm -f ./$(DEPDIR)/test-mbsinit.Po -rm -f ./$(DEPDIR)/test-mbsrtowcs.Po -rm -f ./$(DEPDIR)/test-mbsstr1.Po -rm -f ./$(DEPDIR)/test-mbsstr2.Po -rm -f ./$(DEPDIR)/test-mbsstr3.Po -rm -f ./$(DEPDIR)/test-memchr.Po -rm -f ./$(DEPDIR)/test-memchr2.Po -rm -f ./$(DEPDIR)/test-memrchr.Po -rm -f ./$(DEPDIR)/test-nanosleep.Po -rm -f ./$(DEPDIR)/test-netinet_in.Po -rm -f ./$(DEPDIR)/test-nl_langinfo-mt.Po -rm -f ./$(DEPDIR)/test-nl_langinfo.Po -rm -f ./$(DEPDIR)/test-open.Po -rm -f ./$(DEPDIR)/test-openat-safer.Po -rm -f ./$(DEPDIR)/test-openat.Po -rm -f ./$(DEPDIR)/test-pathmax.Po -rm -f ./$(DEPDIR)/test-perror.Po -rm -f ./$(DEPDIR)/test-perror2.Po -rm -f ./$(DEPDIR)/test-pipe.Po -rm -f ./$(DEPDIR)/test-pthread-thread.Po -rm -f ./$(DEPDIR)/test-pthread.Po -rm -f ./$(DEPDIR)/test-pthread_sigmask1.Po -rm -f ./$(DEPDIR)/test-pthread_sigmask2.Po -rm -f ./$(DEPDIR)/test-quotearg-simple.Po -rm -f ./$(DEPDIR)/test-raise.Po -rm -f ./$(DEPDIR)/test-rawmemchr.Po -rm -f ./$(DEPDIR)/test-read.Po -rm -f ./$(DEPDIR)/test-realloc-gnu.Po -rm -f ./$(DEPDIR)/test-reallocarray.Po -rm -f ./$(DEPDIR)/test-regex.Po -rm -f ./$(DEPDIR)/test-sched.Po -rm -f ./$(DEPDIR)/test-select-fd.Po -rm -f ./$(DEPDIR)/test-select-stdin.Po -rm -f ./$(DEPDIR)/test-select.Po -rm -f ./$(DEPDIR)/test-setenv.Po -rm -f ./$(DEPDIR)/test-setlocale1.Po -rm -f ./$(DEPDIR)/test-setlocale2.Po -rm -f ./$(DEPDIR)/test-setlocale_null-mt-all.Po -rm -f ./$(DEPDIR)/test-setlocale_null-mt-one.Po -rm -f ./$(DEPDIR)/test-setlocale_null.Po -rm -f ./$(DEPDIR)/test-setsockopt.Po -rm -f ./$(DEPDIR)/test-sigaction.Po -rm -f ./$(DEPDIR)/test-signal-h.Po -rm -f ./$(DEPDIR)/test-sigprocmask.Po -rm -f ./$(DEPDIR)/test-sigsegv-catch-segv1.Po -rm -f ./$(DEPDIR)/test-sigsegv-catch-segv2.Po -rm -f ./$(DEPDIR)/test-sigsegv-catch-stackoverflow1.Po -rm -f ./$(DEPDIR)/test-sigsegv-catch-stackoverflow2.Po -rm -f ./$(DEPDIR)/test-sleep.Po -rm -f ./$(DEPDIR)/test-snprintf.Po -rm -f ./$(DEPDIR)/test-sockets.Po -rm -f ./$(DEPDIR)/test-stat-time.Po -rm -f ./$(DEPDIR)/test-stat.Po -rm -f ./$(DEPDIR)/test-stdalign.Po -rm -f ./$(DEPDIR)/test-stdbool.Po -rm -f ./$(DEPDIR)/test-stddef.Po -rm -f ./$(DEPDIR)/test-stdint.Po -rm -f ./$(DEPDIR)/test-stdio.Po -rm -f ./$(DEPDIR)/test-stdlib.Po -rm -f ./$(DEPDIR)/test-strerror.Po -rm -f ./$(DEPDIR)/test-strerror_r.Po -rm -f ./$(DEPDIR)/test-striconv.Po -rm -f ./$(DEPDIR)/test-string.Po -rm -f ./$(DEPDIR)/test-strnlen.Po -rm -f ./$(DEPDIR)/test-strstr.Po -rm -f ./$(DEPDIR)/test-strtoimax.Po -rm -f ./$(DEPDIR)/test-strtoll.Po -rm -f ./$(DEPDIR)/test-strtoull.Po -rm -f ./$(DEPDIR)/test-strtoumax.Po -rm -f ./$(DEPDIR)/test-symlink.Po -rm -f ./$(DEPDIR)/test-sys_ioctl.Po -rm -f ./$(DEPDIR)/test-sys_select.Po -rm -f ./$(DEPDIR)/test-sys_socket.Po -rm -f ./$(DEPDIR)/test-sys_stat.Po -rm -f ./$(DEPDIR)/test-sys_time.Po -rm -f ./$(DEPDIR)/test-sys_types.Po -rm -f ./$(DEPDIR)/test-sys_uio.Po -rm -f ./$(DEPDIR)/test-thread_create.Po -rm -f ./$(DEPDIR)/test-thread_self.Po -rm -f ./$(DEPDIR)/test-time.Po -rm -f ./$(DEPDIR)/test-unistd.Po -rm -f ./$(DEPDIR)/test-unsetenv.Po -rm -f ./$(DEPDIR)/test-vasnprintf.Po -rm -f ./$(DEPDIR)/test-verify-try.Po -rm -f ./$(DEPDIR)/test-verify.Po -rm -f ./$(DEPDIR)/test-version-etc.Po -rm -f ./$(DEPDIR)/test-wchar.Po -rm -f ./$(DEPDIR)/test-wcrtomb-w32.Po -rm -f ./$(DEPDIR)/test-wcrtomb.Po -rm -f ./$(DEPDIR)/test-wctype-h.Po -rm -f ./$(DEPDIR)/test-wcwidth.Po -rm -f ./$(DEPDIR)/test-xalloc-die.Po -rm -f ./$(DEPDIR)/test-xstrtoimax.Po -rm -f ./$(DEPDIR)/test-xstrtol.Po -rm -f ./$(DEPDIR)/test-xstrtoul.Po -rm -f ./$(DEPDIR)/uinttostr.Po -rm -f ./$(DEPDIR)/umaxtostr.Po -rm -f ./$(DEPDIR)/unsetenv.Po -rm -f ./$(DEPDIR)/vasnprintf.Po -rm -f ./$(DEPDIR)/windows-thread.Po -rm -f ./$(DEPDIR)/windows-tls.Po -rm -f ./$(DEPDIR)/xsize.Po -rm -f ./$(DEPDIR)/xstrtol-error.Po -rm -f glthread/$(DEPDIR)/thread.Po -rm -f unistr/$(DEPDIR)/test-u8-mbtoucr.Po -rm -f unistr/$(DEPDIR)/test-u8-uctomb.Po -rm -f uniwidth/$(DEPDIR)/test-uc_width.Po -rm -f uniwidth/$(DEPDIR)/test-uc_width2.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-local pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) all check check-am install install-am \ install-exec install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-TESTS check-am clean \ clean-checkLIBRARIES clean-checkPROGRAMS clean-generic \ clean-local clean-noinstLIBRARIES clean-noinstPROGRAMS \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-local pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # We need the following in order to create <arpa/inet.h> when the system # doesn't have one. arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_at)$(MKDIR_P) arpa $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \ -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \ -e 's/@''GNULIB_INET_NTOP''@/$(GL_GNULIB_INET_NTOP)/g' \ -e 's/@''GNULIB_INET_PTON''@/$(GL_GNULIB_INET_PTON)/g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \ -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/arpa_inet.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create <float.h> when the system # doesn't have one that works with the given compiler. @GL_GENERATE_FLOAT_H_TRUE@float.h: float.in.h $(top_builddir)/config.status @GL_GENERATE_FLOAT_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_FLOAT_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @GL_GENERATE_FLOAT_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @GL_GENERATE_FLOAT_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @GL_GENERATE_FLOAT_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_FLOAT_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_FLOAT_H_TRUE@ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ @GL_GENERATE_FLOAT_H_TRUE@ -e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \ @GL_GENERATE_FLOAT_H_TRUE@ < $(srcdir)/float.in.h; \ @GL_GENERATE_FLOAT_H_TRUE@ } > $@-t && \ @GL_GENERATE_FLOAT_H_TRUE@ mv $@-t $@ @GL_GENERATE_FLOAT_H_FALSE@float.h: $(top_builddir)/config.status @GL_GENERATE_FLOAT_H_FALSE@ rm -f $@ # We need the following in order to create <netinet/in.h> when the system # doesn't have one. @GL_GENERATE_NETINET_IN_H_TRUE@netinet/in.h: netinet_in.in.h $(top_builddir)/config.status @GL_GENERATE_NETINET_IN_H_TRUE@ $(AM_V_at)$(MKDIR_P) netinet @GL_GENERATE_NETINET_IN_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_NETINET_IN_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @GL_GENERATE_NETINET_IN_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @GL_GENERATE_NETINET_IN_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @GL_GENERATE_NETINET_IN_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_NETINET_IN_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_NETINET_IN_H_TRUE@ -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \ @GL_GENERATE_NETINET_IN_H_TRUE@ -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \ @GL_GENERATE_NETINET_IN_H_TRUE@ < $(srcdir)/netinet_in.in.h; \ @GL_GENERATE_NETINET_IN_H_TRUE@ } > $@-t && \ @GL_GENERATE_NETINET_IN_H_TRUE@ mv $@-t $@ @GL_GENERATE_NETINET_IN_H_FALSE@netinet/in.h: $(top_builddir)/config.status @GL_GENERATE_NETINET_IN_H_FALSE@ rm -f $@ # We need the following in order to create <pthread.h> when the system # doesn't have one that works with the given compiler. pthread.h: pthread.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_PTHREAD_H''@|$(HAVE_PTHREAD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_PTHREAD_H''@|$(NEXT_PTHREAD_H)|g' \ -e 's/@''GNULIB_PTHREAD_THREAD''@/$(GL_GNULIB_PTHREAD_THREAD)/g' \ -e 's/@''GNULIB_PTHREAD_ONCE''@/$(GL_GNULIB_PTHREAD_ONCE)/g' \ -e 's/@''GNULIB_PTHREAD_MUTEX''@/$(GL_GNULIB_PTHREAD_MUTEX)/g' \ -e 's/@''GNULIB_PTHREAD_RWLOCK''@/$(GL_GNULIB_PTHREAD_RWLOCK)/g' \ -e 's/@''GNULIB_PTHREAD_COND''@/$(GL_GNULIB_PTHREAD_COND)/g' \ -e 's/@''GNULIB_PTHREAD_TSS''@/$(GL_GNULIB_PTHREAD_TSS)/g' \ -e 's/@''GNULIB_PTHREAD_SPIN''@/$(GL_GNULIB_PTHREAD_SPIN)/g' \ -e 's/@''GNULIB_PTHREAD_MUTEX_TIMEDLOCK''@/$(GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK)/g' \ -e 's|@''HAVE_PTHREAD_T''@|$(HAVE_PTHREAD_T)|g' \ -e 's|@''HAVE_PTHREAD_SPINLOCK_T''@|$(HAVE_PTHREAD_SPINLOCK_T)|g' \ -e 's|@''HAVE_PTHREAD_CREATE_DETACHED''@|$(HAVE_PTHREAD_CREATE_DETACHED)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_RECURSIVE''@|$(HAVE_PTHREAD_MUTEX_RECURSIVE)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_ROBUST''@|$(HAVE_PTHREAD_MUTEX_ROBUST)|g' \ -e 's|@''HAVE_PTHREAD_PROCESS_SHARED''@|$(HAVE_PTHREAD_PROCESS_SHARED)|g' \ -e 's|@''HAVE_PTHREAD_CREATE''@|$(HAVE_PTHREAD_CREATE)|g' \ -e 's|@''HAVE_PTHREAD_ATTR_INIT''@|$(HAVE_PTHREAD_ATTR_INIT)|g' \ -e 's|@''HAVE_PTHREAD_ATTR_GETDETACHSTATE''@|$(HAVE_PTHREAD_ATTR_GETDETACHSTATE)|g' \ -e 's|@''HAVE_PTHREAD_ATTR_SETDETACHSTATE''@|$(HAVE_PTHREAD_ATTR_SETDETACHSTATE)|g' \ -e 's|@''HAVE_PTHREAD_ATTR_DESTROY''@|$(HAVE_PTHREAD_ATTR_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_SELF''@|$(HAVE_PTHREAD_SELF)|g' \ -e 's|@''HAVE_PTHREAD_EQUAL''@|$(HAVE_PTHREAD_EQUAL)|g' \ -e 's|@''HAVE_PTHREAD_DETACH''@|$(HAVE_PTHREAD_DETACH)|g' \ -e 's|@''HAVE_PTHREAD_JOIN''@|$(HAVE_PTHREAD_JOIN)|g' \ -e 's|@''HAVE_PTHREAD_EXIT''@|$(HAVE_PTHREAD_EXIT)|g' \ -e 's|@''HAVE_PTHREAD_ONCE''@|$(HAVE_PTHREAD_ONCE)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_INIT''@|$(HAVE_PTHREAD_MUTEX_INIT)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_INIT''@|$(HAVE_PTHREAD_MUTEXATTR_INIT)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_GETTYPE''@|$(HAVE_PTHREAD_MUTEXATTR_GETTYPE)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_SETTYPE''@|$(HAVE_PTHREAD_MUTEXATTR_SETTYPE)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_GETROBUST''@|$(HAVE_PTHREAD_MUTEXATTR_GETROBUST)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_SETROBUST''@|$(HAVE_PTHREAD_MUTEXATTR_SETROBUST)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_DESTROY''@|$(HAVE_PTHREAD_MUTEXATTR_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_LOCK''@|$(HAVE_PTHREAD_MUTEX_LOCK)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_TRYLOCK''@|$(HAVE_PTHREAD_MUTEX_TRYLOCK)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_TIMEDLOCK''@|$(HAVE_PTHREAD_MUTEX_TIMEDLOCK)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_UNLOCK''@|$(HAVE_PTHREAD_MUTEX_UNLOCK)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_DESTROY''@|$(HAVE_PTHREAD_MUTEX_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_INIT''@|$(HAVE_PTHREAD_RWLOCK_INIT)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCKATTR_INIT''@|$(HAVE_PTHREAD_RWLOCKATTR_INIT)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCKATTR_DESTROY''@|$(HAVE_PTHREAD_RWLOCKATTR_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_RDLOCK''@|$(HAVE_PTHREAD_RWLOCK_RDLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_WRLOCK''@|$(HAVE_PTHREAD_RWLOCK_WRLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_TRYRDLOCK''@|$(HAVE_PTHREAD_RWLOCK_TRYRDLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_TRYWRLOCK''@|$(HAVE_PTHREAD_RWLOCK_TRYWRLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK''@|$(HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK''@|$(HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_UNLOCK''@|$(HAVE_PTHREAD_RWLOCK_UNLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_DESTROY''@|$(HAVE_PTHREAD_RWLOCK_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_COND_INIT''@|$(HAVE_PTHREAD_COND_INIT)|g' \ -e 's|@''HAVE_PTHREAD_CONDATTR_INIT''@|$(HAVE_PTHREAD_CONDATTR_INIT)|g' \ -e 's|@''HAVE_PTHREAD_CONDATTR_DESTROY''@|$(HAVE_PTHREAD_CONDATTR_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_COND_WAIT''@|$(HAVE_PTHREAD_COND_WAIT)|g' \ -e 's|@''HAVE_PTHREAD_COND_TIMEDWAIT''@|$(HAVE_PTHREAD_COND_TIMEDWAIT)|g' \ -e 's|@''HAVE_PTHREAD_COND_SIGNAL''@|$(HAVE_PTHREAD_COND_SIGNAL)|g' \ -e 's|@''HAVE_PTHREAD_COND_BROADCAST''@|$(HAVE_PTHREAD_COND_BROADCAST)|g' \ -e 's|@''HAVE_PTHREAD_COND_DESTROY''@|$(HAVE_PTHREAD_COND_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_KEY_CREATE''@|$(HAVE_PTHREAD_KEY_CREATE)|g' \ -e 's|@''HAVE_PTHREAD_SETSPECIFIC''@|$(HAVE_PTHREAD_SETSPECIFIC)|g' \ -e 's|@''HAVE_PTHREAD_GETSPECIFIC''@|$(HAVE_PTHREAD_GETSPECIFIC)|g' \ -e 's|@''HAVE_PTHREAD_KEY_DELETE''@|$(HAVE_PTHREAD_KEY_DELETE)|g' \ -e 's|@''HAVE_PTHREAD_SPIN_INIT''@|$(HAVE_PTHREAD_SPIN_INIT)|g' \ -e 's|@''HAVE_PTHREAD_SPIN_LOCK''@|$(HAVE_PTHREAD_SPIN_LOCK)|g' \ -e 's|@''HAVE_PTHREAD_SPIN_TRYLOCK''@|$(HAVE_PTHREAD_SPIN_TRYLOCK)|g' \ -e 's|@''HAVE_PTHREAD_SPIN_UNLOCK''@|$(HAVE_PTHREAD_SPIN_UNLOCK)|g' \ -e 's|@''HAVE_PTHREAD_SPIN_DESTROY''@|$(HAVE_PTHREAD_SPIN_DESTROY)|g' \ < $(srcdir)/pthread.in.h | \ sed -e 's|@''REPLACE_PTHREAD_CREATE''@|$(REPLACE_PTHREAD_CREATE)|g' \ -e 's|@''REPLACE_PTHREAD_ATTR_INIT''@|$(REPLACE_PTHREAD_ATTR_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_ATTR_GETDETACHSTATE''@|$(REPLACE_PTHREAD_ATTR_GETDETACHSTATE)|g' \ -e 's|@''REPLACE_PTHREAD_ATTR_SETDETACHSTATE''@|$(REPLACE_PTHREAD_ATTR_SETDETACHSTATE)|g' \ -e 's|@''REPLACE_PTHREAD_ATTR_DESTROY''@|$(REPLACE_PTHREAD_ATTR_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_SELF''@|$(REPLACE_PTHREAD_SELF)|g' \ -e 's|@''REPLACE_PTHREAD_EQUAL''@|$(REPLACE_PTHREAD_EQUAL)|g' \ -e 's|@''REPLACE_PTHREAD_DETACH''@|$(REPLACE_PTHREAD_DETACH)|g' \ -e 's|@''REPLACE_PTHREAD_JOIN''@|$(REPLACE_PTHREAD_JOIN)|g' \ -e 's|@''REPLACE_PTHREAD_EXIT''@|$(REPLACE_PTHREAD_EXIT)|g' \ -e 's|@''REPLACE_PTHREAD_ONCE''@|$(REPLACE_PTHREAD_ONCE)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_INIT''@|$(REPLACE_PTHREAD_MUTEX_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_INIT''@|$(REPLACE_PTHREAD_MUTEXATTR_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_GETTYPE''@|$(REPLACE_PTHREAD_MUTEXATTR_GETTYPE)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_SETTYPE''@|$(REPLACE_PTHREAD_MUTEXATTR_SETTYPE)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_GETROBUST''@|$(REPLACE_PTHREAD_MUTEXATTR_GETROBUST)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_SETROBUST''@|$(REPLACE_PTHREAD_MUTEXATTR_SETROBUST)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_DESTROY''@|$(REPLACE_PTHREAD_MUTEXATTR_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_LOCK''@|$(REPLACE_PTHREAD_MUTEX_LOCK)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_TRYLOCK''@|$(REPLACE_PTHREAD_MUTEX_TRYLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_TIMEDLOCK''@|$(REPLACE_PTHREAD_MUTEX_TIMEDLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_UNLOCK''@|$(REPLACE_PTHREAD_MUTEX_UNLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_DESTROY''@|$(REPLACE_PTHREAD_MUTEX_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_INIT''@|$(REPLACE_PTHREAD_RWLOCK_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCKATTR_INIT''@|$(REPLACE_PTHREAD_RWLOCKATTR_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCKATTR_DESTROY''@|$(REPLACE_PTHREAD_RWLOCKATTR_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_RDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_RDLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_WRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_WRLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_TRYRDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TRYRDLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_TRYWRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TRYWRLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_UNLOCK''@|$(REPLACE_PTHREAD_RWLOCK_UNLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_DESTROY''@|$(REPLACE_PTHREAD_RWLOCK_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_COND_INIT''@|$(REPLACE_PTHREAD_COND_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_CONDATTR_INIT''@|$(REPLACE_PTHREAD_CONDATTR_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_CONDATTR_DESTROY''@|$(REPLACE_PTHREAD_CONDATTR_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_COND_WAIT''@|$(REPLACE_PTHREAD_COND_WAIT)|g' \ -e 's|@''REPLACE_PTHREAD_COND_TIMEDWAIT''@|$(REPLACE_PTHREAD_COND_TIMEDWAIT)|g' \ -e 's|@''REPLACE_PTHREAD_COND_SIGNAL''@|$(REPLACE_PTHREAD_COND_SIGNAL)|g' \ -e 's|@''REPLACE_PTHREAD_COND_BROADCAST''@|$(REPLACE_PTHREAD_COND_BROADCAST)|g' \ -e 's|@''REPLACE_PTHREAD_COND_DESTROY''@|$(REPLACE_PTHREAD_COND_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_KEY_CREATE''@|$(REPLACE_PTHREAD_KEY_CREATE)|g' \ -e 's|@''REPLACE_PTHREAD_SETSPECIFIC''@|$(REPLACE_PTHREAD_SETSPECIFIC)|g' \ -e 's|@''REPLACE_PTHREAD_GETSPECIFIC''@|$(REPLACE_PTHREAD_GETSPECIFIC)|g' \ -e 's|@''REPLACE_PTHREAD_KEY_DELETE''@|$(REPLACE_PTHREAD_KEY_DELETE)|g' \ -e 's|@''REPLACE_PTHREAD_SPIN_INIT''@|$(REPLACE_PTHREAD_SPIN_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_SPIN_LOCK''@|$(REPLACE_PTHREAD_SPIN_LOCK)|g' \ -e 's|@''REPLACE_PTHREAD_SPIN_TRYLOCK''@|$(REPLACE_PTHREAD_SPIN_TRYLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_SPIN_UNLOCK''@|$(REPLACE_PTHREAD_SPIN_UNLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_SPIN_DESTROY''@|$(REPLACE_PTHREAD_SPIN_DESTROY)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _Noreturn/r $(_NORETURN_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create a replacement for <sched.h> when # the system doesn't have one. sched.h: sched.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_SCHED_H''@|$(HAVE_SCHED_H)|g' \ -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SCHED_H''@|$(NEXT_SCHED_H)|g' \ -e 's|@''HAVE_STRUCT_SCHED_PARAM''@|$(HAVE_STRUCT_SCHED_PARAM)|g' \ -e 's/@''GNULIB_SCHED_YIELD''@/$(GL_GNULIB_SCHED_YIELD)/g' \ -e 's|@''HAVE_SCHED_YIELD''@|$(HAVE_SCHED_YIELD)|g' \ -e 's|@''REPLACE_SCHED_YIELD''@|$(REPLACE_SCHED_YIELD)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sched.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create <sys/ioctl.h> when the system # does not have a complete one. sys/ioctl.h: sys_ioctl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_SYS_IOCTL_H''@|$(HAVE_SYS_IOCTL_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_IOCTL_H''@|$(NEXT_SYS_IOCTL_H)|g' \ -e 's/@''GNULIB_IOCTL''@/$(GL_GNULIB_IOCTL)/g' \ -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \ -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ -e 's|@''REPLACE_IOCTL''@|$(REPLACE_IOCTL)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_ioctl.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create <sys/select.h> when the system # doesn't have one that works with the given compiler. sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \ -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \ -e 's/@''GNULIB_PSELECT''@/$(GL_GNULIB_PSELECT)/g' \ -e 's/@''GNULIB_SELECT''@/$(GL_GNULIB_SELECT)/g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_PSELECT''@|$(HAVE_PSELECT)|g' \ -e 's|@''REPLACE_PSELECT''@|$(REPLACE_PSELECT)|g' \ -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_select.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create <sys/socket.h> when the system # doesn't have one that works with the given compiler. sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \ -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ -e 's/@''GNULIB_CLOSE''@/$(GL_GNULIB_CLOSE)/g' \ -e 's/@''GNULIB_SOCKET''@/$(GL_GNULIB_SOCKET)/g' \ -e 's/@''GNULIB_CONNECT''@/$(GL_GNULIB_CONNECT)/g' \ -e 's/@''GNULIB_ACCEPT''@/$(GL_GNULIB_ACCEPT)/g' \ -e 's/@''GNULIB_BIND''@/$(GL_GNULIB_BIND)/g' \ -e 's/@''GNULIB_GETPEERNAME''@/$(GL_GNULIB_GETPEERNAME)/g' \ -e 's/@''GNULIB_GETSOCKNAME''@/$(GL_GNULIB_GETSOCKNAME)/g' \ -e 's/@''GNULIB_GETSOCKOPT''@/$(GL_GNULIB_GETSOCKOPT)/g' \ -e 's/@''GNULIB_LISTEN''@/$(GL_GNULIB_LISTEN)/g' \ -e 's/@''GNULIB_RECV''@/$(GL_GNULIB_RECV)/g' \ -e 's/@''GNULIB_SEND''@/$(GL_GNULIB_SEND)/g' \ -e 's/@''GNULIB_RECVFROM''@/$(GL_GNULIB_RECVFROM)/g' \ -e 's/@''GNULIB_SENDTO''@/$(GL_GNULIB_SENDTO)/g' \ -e 's/@''GNULIB_SETSOCKOPT''@/$(GL_GNULIB_SETSOCKOPT)/g' \ -e 's/@''GNULIB_SHUTDOWN''@/$(GL_GNULIB_SHUTDOWN)/g' \ -e 's/@''GNULIB_ACCEPT4''@/$(GL_GNULIB_ACCEPT4)/g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \ -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY''@|$(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)|g' \ -e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \ -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_socket.in.h; \ } > $@-t && \ mv -f $@-t $@ # We need the following in order to create <sys/time.h> when the system # doesn't have one that works with the given compiler. sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \ -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GL_GNULIB_GETTIMEOFDAY)/g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \ -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \ -e 's/@''REPLACE_STRUCT_TIMEVAL''@/$(REPLACE_STRUCT_TIMEVAL)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_time.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create <sys/uio.h> when the system # doesn't have one that works with the given compiler. sys/uio.h: sys_uio.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_UIO_H''@|$(NEXT_SYS_UIO_H)|g' \ -e 's|@''HAVE_SYS_UIO_H''@|$(HAVE_SYS_UIO_H)|g' \ < $(srcdir)/sys_uio.in.h; \ } > $@-t && \ mv -f $@-t $@ all: all-notice all-notice: @echo '## ---------------------------------------------------- ##' @echo '## ------------------- Gnulib tests ------------------- ##' @echo '## You can ignore compiler warnings in this directory. ##' @echo '## ---------------------------------------------------- ##' check-am: check-notice check-notice: @echo '## ---------------------------------------------------------------------- ##' @echo '## ---------------------------- Gnulib tests ---------------------------- ##' @echo '## Please report test failures in this directory to <bug-gnulib@gnu.org>. ##' @echo '## ---------------------------------------------------------------------- ##' # Clean up after Solaris cc. clean-local: rm -rf SunWS_cache mostlyclean-local: mostlyclean-generic @for dir in '' $(MOSTLYCLEANDIRS); do \ if test -n "$$dir" && test -d $$dir; then \ echo "rmdir $$dir"; rmdir $$dir; \ fi; \ done; \ : # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ��������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcrtomb-w32-3.sh���������������������������������������������0000775�0001750�0001750�00000000134�14670377436�022633� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test a CP932 locale. ${CHECKER} ./test-wcrtomb-w32${EXEEXT} Japanese_Japan 932 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-close.c������������������������������������������������������0000664�0001750�0001750�00000002202�14670377431�021310� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test closing a file or socket. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (close, int, (int)); #include <errno.h> #include "macros.h" int main (void) { /* Test behaviour for invalid file descriptors. */ { errno = 0; ASSERT (close (-1) == -1); ASSERT (errno == EBADF); } { close (99); errno = 0; ASSERT (close (99) == -1); ASSERT (errno == EBADF); } return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-setlocale1.c�������������������������������������������������0000664�0001750�0001750�00000003407�14670377436�022254� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of setting the current locale. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <locale.h> #include "signature.h" SIGNATURE_CHECK (setlocale, char *, (int, const char *)); #include <stdlib.h> #include <string.h> #include "macros.h" int main (int argc, char *argv[]) { char *name1; char *name2; /* Try to set the locale by implicitly looking at the LC_ALL environment variable. configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; name1 = strdup (setlocale (LC_ALL, NULL)); /* Reset the locale. */ if (setlocale (LC_ALL, "C") == NULL) return 1; /* Try to set the locale by explicitly looking at the LC_ALL environment variable. configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL) return 1; name2 = strdup (setlocale (LC_ALL, NULL)); ASSERT (name1); ASSERT (name2); /* Test that the two results are the same. */ ASSERT (strcmp (name1, name2) == 0); free (name1); free (name2); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-unistd.c�����������������������������������������������������0000664�0001750�0001750�00000003050�14670377437�021521� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <unistd.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <unistd.h> #include "verify.h" /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); /* Check that the various SEEK_* macros are defined. */ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; /* Check that the various *_FILENO macros are defined. */ #if ! (defined STDIN_FILENO \ && (STDIN_FILENO + STDOUT_FILENO + STDERR_FILENO == 3)) missing or broken *_FILENO macros #endif /* Check that the types are all defined. */ size_t t1; ssize_t t2; #ifdef TODO /* Not implemented in gnulib yet */ uid_t t3; gid_t t4; #endif off_t t5; pid_t t6; #ifdef TODO useconds_t t7; intptr_t t8; #endif int main (void) { return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-hard-locale.c������������������������������������������������0000664�0001750�0001750�00000007062�14670377436�022374� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of determination whether a locale is different from the "C" locale. Copyright (C) 2019-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2019. */ #include <config.h> #include "hard-locale.h" #include <locale.h> #include <stdbool.h> #include <stdio.h> #include <string.h> /* True if all locale names are accepted and all locales are trivial. This is the case e.g. on OpenBSD 3.8. */ static bool all_trivial; static int test_one (const char *name, int failure_bitmask) { if (setlocale (LC_ALL, name) != NULL) { bool expected; /* musl libc has special code for the C.UTF-8 locale; other than that, all locale names are accepted and all locales are trivial. OpenBSD returns the locale name that was set, but we don't know how it behaves under the hood. Likewise for Haiku. */ #if defined MUSL_LIBC || defined __OpenBSD__ || defined __HAIKU__ expected = true; #else expected = !all_trivial; #endif if (hard_locale (LC_CTYPE) != expected) { if (expected) fprintf (stderr, "Unexpected: The category LC_CTYPE of the locale '%s' is not equivalent to C or POSIX.\n", name); else fprintf (stderr, "Unexpected: The category LC_CTYPE of the locale '%s' is equivalent to C or POSIX.\n", name); return failure_bitmask; } /* On NetBSD 7.0, some locales such as de_DE.ISO8859-1 and de_DE.UTF-8 have the LC_COLLATE category set to "C". Similarly, on musl libc, with the C.UTF-8 locale. */ #if defined __NetBSD__ expected = false; #elif defined MUSL_LIBC expected = strcmp (name, "C.UTF-8") != 0; #elif (defined __OpenBSD__ && HAVE_DUPLOCALE) || defined __HAIKU__ /* OpenBSD >= 6.2, Haiku */ expected = true; #else expected = !all_trivial; #endif if (hard_locale (LC_COLLATE) != expected) { if (expected) fprintf (stderr, "Unexpected: The category LC_COLLATE of the locale '%s' is not equivalent to C or POSIX.\n", name); else fprintf (stderr, "Unexpected: The category LC_COLLATE of the locale '%s' is equivalent to C or POSIX.\n", name); return failure_bitmask; } } return 0; } int main () { int fail = 0; /* The initial locale is the "C" or "POSIX" locale. */ if (hard_locale (LC_CTYPE) || hard_locale (LC_COLLATE)) { fprintf (stderr, "The initial locale should not be hard!\n"); fail |= 1; } all_trivial = (setlocale (LC_ALL, "foobar") != NULL); fail |= test_one ("de", 2); fail |= test_one ("de_DE", 4); fail |= test_one ("de_DE.ISO8859-1", 8); fail |= test_one ("de_DE.iso88591", 8); fail |= test_one ("de_DE.UTF-8", 16); fail |= test_one ("de_DE.utf8", 16); fail |= test_one ("german", 32); fail |= test_one ("C.UTF-8", 64); return fail; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/printf-args.c�����������������������������������������������������0000664�0001750�0001750�00000014600�14670377430�021466� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Decomposed printf argument list. Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* This file can be parametrized with the following macros: ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. PRINTF_FETCHARGS Name of the function to be defined. STATIC Set to 'static' to declare the function static. */ #ifndef PRINTF_FETCHARGS # include <config.h> #endif /* Specification. */ #ifndef PRINTF_FETCHARGS # include "printf-args.h" #endif #ifdef STATIC STATIC #endif int PRINTF_FETCHARGS (va_list args, arguments *a) { size_t i; argument *ap; for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++) switch (ap->type) { case TYPE_SCHAR: ap->a.a_schar = va_arg (args, /*signed char*/ int); break; case TYPE_UCHAR: ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); break; case TYPE_SHORT: ap->a.a_short = va_arg (args, /*short*/ int); break; case TYPE_USHORT: ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); break; case TYPE_INT: ap->a.a_int = va_arg (args, int); break; case TYPE_UINT: ap->a.a_uint = va_arg (args, unsigned int); break; case TYPE_LONGINT: ap->a.a_longint = va_arg (args, long int); break; case TYPE_ULONGINT: ap->a.a_ulongint = va_arg (args, unsigned long int); break; case TYPE_LONGLONGINT: ap->a.a_longlongint = va_arg (args, long long int); break; case TYPE_ULONGLONGINT: ap->a.a_ulonglongint = va_arg (args, unsigned long long int); break; case TYPE_DOUBLE: ap->a.a_double = va_arg (args, double); break; case TYPE_LONGDOUBLE: ap->a.a_longdouble = va_arg (args, long double); break; case TYPE_CHAR: ap->a.a_char = va_arg (args, int); break; #if HAVE_WINT_T case TYPE_WIDE_CHAR: /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by default argument promotions", this is not the case in mingw32, where wint_t is 'unsigned short'. */ ap->a.a_wide_char = (sizeof (wint_t) < sizeof (int) ? (wint_t) va_arg (args, int) : va_arg (args, wint_t)); break; #endif case TYPE_STRING: ap->a.a_string = va_arg (args, const char *); /* A null pointer is an invalid argument for "%s", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_string == NULL) ap->a.a_string = "(NULL)"; break; #if HAVE_WCHAR_T case TYPE_WIDE_STRING: ap->a.a_wide_string = va_arg (args, const wchar_t *); /* A null pointer is an invalid argument for "%ls", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_wide_string == NULL) { static const wchar_t wide_null_string[] = { (wchar_t)'(', (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', (wchar_t)')', (wchar_t)0 }; ap->a.a_wide_string = wide_null_string; } break; #endif case TYPE_POINTER: ap->a.a_pointer = va_arg (args, void *); break; case TYPE_COUNT_SCHAR_POINTER: ap->a.a_count_schar_pointer = va_arg (args, signed char *); break; case TYPE_COUNT_SHORT_POINTER: ap->a.a_count_short_pointer = va_arg (args, short *); break; case TYPE_COUNT_INT_POINTER: ap->a.a_count_int_pointer = va_arg (args, int *); break; case TYPE_COUNT_LONGINT_POINTER: ap->a.a_count_longint_pointer = va_arg (args, long int *); break; case TYPE_COUNT_LONGLONGINT_POINTER: ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); break; #if ENABLE_UNISTDIO /* The unistdio extensions. */ case TYPE_U8_STRING: ap->a.a_u8_string = va_arg (args, const uint8_t *); /* A null pointer is an invalid argument for "%U", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_u8_string == NULL) { static const uint8_t u8_null_string[] = { '(', 'N', 'U', 'L', 'L', ')', 0 }; ap->a.a_u8_string = u8_null_string; } break; case TYPE_U16_STRING: ap->a.a_u16_string = va_arg (args, const uint16_t *); /* A null pointer is an invalid argument for "%lU", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_u16_string == NULL) { static const uint16_t u16_null_string[] = { '(', 'N', 'U', 'L', 'L', ')', 0 }; ap->a.a_u16_string = u16_null_string; } break; case TYPE_U32_STRING: ap->a.a_u32_string = va_arg (args, const uint32_t *); /* A null pointer is an invalid argument for "%llU", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_u32_string == NULL) { static const uint32_t u32_null_string[] = { '(', 'N', 'U', 'L', 'L', ')', 0 }; ap->a.a_u32_string = u32_null_string; } break; #endif default: /* Unknown type. */ return -1; } return 0; } ��������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-alloca-opt.c�������������������������������������������������0000664�0001750�0001750�00000002774�14670377431�022254� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of optional automatic memory allocation. Copyright (C) 2005, 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <alloca.h> #if HAVE_ALLOCA static void do_allocation (int n) { void *volatile ptr = alloca (n); (void) ptr; } void (*func) (int) = do_allocation; #endif int main () { #if HAVE_ALLOCA int i; /* Repeat a lot of times, to make sure there's no memory leak. */ for (i = 0; i < 100000; i++) { /* Try various values. n = 0 gave a crash on Alpha with gcc-2.5.8. Some versions of Mac OS X have a stack size limit of 512 KB. */ func (34); func (134); func (399); func (510823); func (129321); func (0); func (4070); func (4095); func (1); func (16582); } #endif return 0; } ����kbuild-3608/src/grep/gnulib-tests/connect.c���������������������������������������������������������0000664�0001750�0001750�00000003037�14670377430�020665� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* connect.c --- wrappers for Windows connect function Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paolo Bonzini */ #include <config.h> #define WIN32_LEAN_AND_MEAN /* Get winsock2.h. */ #include <sys/socket.h> /* Get set_winsock_errno, FD_TO_SOCKET etc. */ #include "w32sock.h" #undef connect int rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len) { SOCKET sock = FD_TO_SOCKET (fd); if (sock == INVALID_SOCKET) { errno = EBADF; return -1; } else { int r = connect (sock, sockaddr, len); if (r < 0) { /* EINPROGRESS is not returned by WinSock 2.0; for backwards compatibility, connect(2) uses EWOULDBLOCK. */ if (WSAGetLastError () == WSAEWOULDBLOCK) WSASetLastError (WSAEINPROGRESS); set_winsock_errno (); } return r; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-btowc2.sh����������������������������������������������������0000775�0001750�0001750�00000000601�14670377431�021577� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test whether a specific UTF-8 locale is installed. : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR_UTF8 = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no french Unicode locale is installed" else echo "Skipping test: no french Unicode locale is supported" fi exit 77 fi LC_ALL=$LOCALE_FR_UTF8 \ ${CHECKER} ./test-btowc${EXEEXT} 2 �������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-arpa_inet.c��������������������������������������������������0000664�0001750�0001750�00000001564�14670377431�022157� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <arpa/inet.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <arpa/inet.h> int main (void) { return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-memrchr.c����������������������������������������������������0000664�0001750�0001750�00000005140�14670377436�021651� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2008-2021 Free Software Foundation, Inc. * Written by Eric Blake and Bruno Haible * * 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <string.h> #include "signature.h" SIGNATURE_CHECK (memrchr, void *, (void const *, int, size_t)); #include <stdlib.h> #include "zerosize-ptr.h" #include "macros.h" /* Work around GCC bug 101494. */ #if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif /* Calculating void * + int is not portable, so this wrapper converts to char * to make the tests easier to write. */ #define MEMRCHR (char *) memrchr int main (void) { size_t n = 0x100000; char *input = malloc (n); ASSERT (input); input[n - 1] = 'a'; input[n - 2] = 'b'; memset (input + n - 1026, 'c', 1024); memset (input + 2, 'd', n - 1028); input[1] = 'e'; input[0] = 'a'; /* Basic behavior tests. */ ASSERT (MEMRCHR (input, 'a', n) == input + n - 1); ASSERT (MEMRCHR (input, 'a', 0) == NULL); void *page_boundary = zerosize_ptr (); if (page_boundary) ASSERT (MEMRCHR (page_boundary, 'a', 0) == NULL); ASSERT (MEMRCHR (input, 'b', n) == input + n - 2); ASSERT (MEMRCHR (input, 'c', n) == input + n - 3); ASSERT (MEMRCHR (input, 'd', n) == input + n - 1027); ASSERT (MEMRCHR (input, 'a', n - 1) == input); ASSERT (MEMRCHR (input, 'e', n - 1) == input + 1); ASSERT (MEMRCHR (input, 'f', n) == NULL); ASSERT (MEMRCHR (input, '\0', n) == NULL); /* Check that a very long haystack is handled quickly if the byte is found near the end. */ { size_t repeat = 10000; for (; repeat > 0; repeat--) { ASSERT (MEMRCHR (input, 'c', n) == input + n - 3); } } /* Alignment tests. */ { int i, j; for (i = 0; i < 32; i++) { for (j = 0; j < 256; j++) input[i + j] = j; for (j = 0; j < 256; j++) { ASSERT (MEMRCHR (input + i, j, 256) == input + i + j); } } } free (input); return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-verify-try.c�������������������������������������������������0000664�0001750�0001750�00000001620�14670377436�022333� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test the "verify" module. Copyright (C) 2017-2021 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 <https://www.gnu.org/licenses/>. */ /* This is a separate source file, so that the execution of test-verify.sh does not interfere with the building of the 'test-verify' program. */ #include "test-verify.c" ����������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-inttostr.c���������������������������������������������������0000664�0001750�0001750�00000010201�14670377436�022074� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test inttostr functions, and incidentally, INT_BUFSIZE_BOUND Copyright (C) 2010-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ #include <config.h> #include "inttostr.h" #include "intprops.h" #include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "macros.h" #define STREQ(a, b) (strcmp (a, b) == 0) #define IS_TIGHT(T) (_GL_SIGNED_TYPE_OR_EXPR (T) == TYPE_SIGNED (T)) #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) /* Verify that an inttostr function works as advertised. Convert maximum and minimum (per-type, T) values using both snprintf -- with a cast to intmax_t or uintmax_t -- and FN, and compare the resulting strings. Use malloc for the inttostr buffer, so that if we ever exceed the usually-tight INT_BUFSIZE_BOUND, tools like valgrind will detect the failure. */ #define CK(T, Fn) \ do \ { \ char ref[100]; \ char *buf = malloc (INT_BUFSIZE_BOUND (T)); \ char const *p; \ ASSERT (buf); \ *buf = '\0'; \ ASSERT \ ((TYPE_SIGNED (T) \ ? snprintf (ref, sizeof ref, "%jd", (intmax_t) TYPE_MINIMUM (T)) \ : snprintf (ref, sizeof ref, "%ju", (uintmax_t) TYPE_MINIMUM (T))) \ < sizeof ref); \ ASSERT (STREQ ((p = Fn (TYPE_MINIMUM (T), buf)), ref)); \ /* Ensure that INT_BUFSIZE_BOUND is tight for signed types. */ \ ASSERT (! TYPE_SIGNED (T) || (p == buf && *p == '-')); \ ASSERT \ ((TYPE_SIGNED (T) \ ? snprintf (ref, sizeof ref, "%jd", (intmax_t) TYPE_MAXIMUM (T)) \ : snprintf (ref, sizeof ref, "%ju", (uintmax_t) TYPE_MAXIMUM (T))) \ < sizeof ref); \ ASSERT (STREQ ((p = Fn (TYPE_MAXIMUM (T), buf)), ref)); \ /* For unsigned types, the bound is not always tight. */ \ ASSERT (! IS_TIGHT (T) || TYPE_SIGNED (T) \ || (p == buf && ISDIGIT (*p))); \ free (buf); \ } \ while (0) int main (void) { size_t b_size = 2; char *b = malloc (b_size); ASSERT (b); /* Ideally we would rely on the snprintf-posix module, in which case this guard would not be required, but due to limitations in gnulib's implementation (see modules/snprintf-posix), we cannot. */ if (snprintf (b, b_size, "%ju", (uintmax_t) 3) == 1 && b[0] == '3' && b[1] == '\0') { CK (int, inttostr); CK (unsigned int, uinttostr); CK (off_t, offtostr); CK (uintmax_t, umaxtostr); CK (intmax_t, imaxtostr); free (b); return 0; } /* snprintf doesn't accept %ju; skip this test. */ free (b); return 77; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcrtomb-w32-1.sh���������������������������������������������0000775�0001750�0001750�00000000135�14670377437�022633� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test a CP1252 locale. ${CHECKER} ./test-wcrtomb-w32${EXEEXT} French_France 1252 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-symlink.h����������������������������������������������������0000664�0001750�0001750�00000006157�14670377436�021720� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Tests of symlink. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ /* This file is designed to test both symlink(a,b) and symlinkat(a,AT_FDCWD,b). FUNC is the function to test. Assumes that BASE and ASSERT are already defined, and that appropriate headers are already included. If PRINT, warn before skipping symlink tests with status 77. */ static int test_symlink (int (*func) (char const *, char const *), bool print) { if (func ("nowhere", BASE "link1")) { if (print) fputs ("skipping test: symlinks not supported on this file system\n", stderr); return 77; } /* Some systems allow the creation of 0-length symlinks as a synonym for "."; but most reject it. */ { int status; errno = 0; status = func ("", BASE "link2"); if (status == -1) ASSERT (errno == ENOENT || errno == EINVAL); else { ASSERT (status == 0); ASSERT (unlink (BASE "link2") == 0); } } /* Sanity checks of failures. */ errno = 0; ASSERT (func ("nowhere", "") == -1); ASSERT (errno == ENOENT); errno = 0; ASSERT (func ("nowhere", ".") == -1); ASSERT (errno == EEXIST || errno == EINVAL); errno = 0; ASSERT (func ("somewhere", BASE "link1") == -1); ASSERT (errno == EEXIST); errno = 0; ASSERT (func ("nowhere", BASE "link2/") == -1); ASSERT (errno == ENOTDIR || errno == ENOENT); ASSERT (mkdir (BASE "dir", 0700) == 0); errno = 0; ASSERT (func ("nowhere", BASE "dir") == -1); ASSERT (errno == EEXIST); errno = 0; ASSERT (func ("nowhere", BASE "dir/") == -1); ASSERT (errno == EEXIST || errno == EINVAL || errno == ENOENT /* Lustre FS on Linux */); ASSERT (close (creat (BASE "file", 0600)) == 0); errno = 0; ASSERT (func ("nowhere", BASE "file") == -1); ASSERT (errno == EEXIST); errno = 0; ASSERT (func ("nowhere", BASE "file/") == -1); ASSERT (errno == EEXIST || errno == ENOTDIR || errno == ENOENT); /* Trailing slash must always be rejected. */ ASSERT (unlink (BASE "link1") == 0); ASSERT (func (BASE "link2", BASE "link1") == 0); errno = 0; ASSERT (func (BASE "nowhere", BASE "link1/") == -1); ASSERT (errno == EEXIST || errno == ENOTDIR || errno == ENOENT); errno = 0; ASSERT (unlink (BASE "link2") == -1); ASSERT (errno == ENOENT); /* Cleanup. */ ASSERT (rmdir (BASE "dir") == 0); ASSERT (unlink (BASE "file") == 0); ASSERT (unlink (BASE "link1") == 0); return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/float+.h����������������������������������������������������������0000664�0001750�0001750�00000013007�14670377436�020425� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Supplemental information about the floating-point formats. Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _FLOATPLUS_H #define _FLOATPLUS_H #include <float.h> #include <limits.h> /* Number of bits in the mantissa of a floating-point number, including the "hidden bit". */ #if FLT_RADIX == 2 # define FLT_MANT_BIT FLT_MANT_DIG # define DBL_MANT_BIT DBL_MANT_DIG # define LDBL_MANT_BIT LDBL_MANT_DIG #elif FLT_RADIX == 4 # define FLT_MANT_BIT (FLT_MANT_DIG * 2) # define DBL_MANT_BIT (DBL_MANT_DIG * 2) # define LDBL_MANT_BIT (LDBL_MANT_DIG * 2) #elif FLT_RADIX == 16 # define FLT_MANT_BIT (FLT_MANT_DIG * 4) # define DBL_MANT_BIT (DBL_MANT_DIG * 4) # define LDBL_MANT_BIT (LDBL_MANT_DIG * 4) #endif /* Bit mask that can be used to mask the exponent, as an unsigned number. */ #define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7) #define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7) #define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7) /* Number of bits used for the exponent of a floating-point number, including the exponent's sign. */ #define FLT_EXP_BIT \ (FLT_EXP_MASK < 0x100 ? 8 : \ FLT_EXP_MASK < 0x200 ? 9 : \ FLT_EXP_MASK < 0x400 ? 10 : \ FLT_EXP_MASK < 0x800 ? 11 : \ FLT_EXP_MASK < 0x1000 ? 12 : \ FLT_EXP_MASK < 0x2000 ? 13 : \ FLT_EXP_MASK < 0x4000 ? 14 : \ FLT_EXP_MASK < 0x8000 ? 15 : \ FLT_EXP_MASK < 0x10000 ? 16 : \ FLT_EXP_MASK < 0x20000 ? 17 : \ FLT_EXP_MASK < 0x40000 ? 18 : \ FLT_EXP_MASK < 0x80000 ? 19 : \ FLT_EXP_MASK < 0x100000 ? 20 : \ FLT_EXP_MASK < 0x200000 ? 21 : \ FLT_EXP_MASK < 0x400000 ? 22 : \ FLT_EXP_MASK < 0x800000 ? 23 : \ FLT_EXP_MASK < 0x1000000 ? 24 : \ FLT_EXP_MASK < 0x2000000 ? 25 : \ FLT_EXP_MASK < 0x4000000 ? 26 : \ FLT_EXP_MASK < 0x8000000 ? 27 : \ FLT_EXP_MASK < 0x10000000 ? 28 : \ FLT_EXP_MASK < 0x20000000 ? 29 : \ FLT_EXP_MASK < 0x40000000 ? 30 : \ FLT_EXP_MASK <= 0x7fffffff ? 31 : \ 32) #define DBL_EXP_BIT \ (DBL_EXP_MASK < 0x100 ? 8 : \ DBL_EXP_MASK < 0x200 ? 9 : \ DBL_EXP_MASK < 0x400 ? 10 : \ DBL_EXP_MASK < 0x800 ? 11 : \ DBL_EXP_MASK < 0x1000 ? 12 : \ DBL_EXP_MASK < 0x2000 ? 13 : \ DBL_EXP_MASK < 0x4000 ? 14 : \ DBL_EXP_MASK < 0x8000 ? 15 : \ DBL_EXP_MASK < 0x10000 ? 16 : \ DBL_EXP_MASK < 0x20000 ? 17 : \ DBL_EXP_MASK < 0x40000 ? 18 : \ DBL_EXP_MASK < 0x80000 ? 19 : \ DBL_EXP_MASK < 0x100000 ? 20 : \ DBL_EXP_MASK < 0x200000 ? 21 : \ DBL_EXP_MASK < 0x400000 ? 22 : \ DBL_EXP_MASK < 0x800000 ? 23 : \ DBL_EXP_MASK < 0x1000000 ? 24 : \ DBL_EXP_MASK < 0x2000000 ? 25 : \ DBL_EXP_MASK < 0x4000000 ? 26 : \ DBL_EXP_MASK < 0x8000000 ? 27 : \ DBL_EXP_MASK < 0x10000000 ? 28 : \ DBL_EXP_MASK < 0x20000000 ? 29 : \ DBL_EXP_MASK < 0x40000000 ? 30 : \ DBL_EXP_MASK <= 0x7fffffff ? 31 : \ 32) #define LDBL_EXP_BIT \ (LDBL_EXP_MASK < 0x100 ? 8 : \ LDBL_EXP_MASK < 0x200 ? 9 : \ LDBL_EXP_MASK < 0x400 ? 10 : \ LDBL_EXP_MASK < 0x800 ? 11 : \ LDBL_EXP_MASK < 0x1000 ? 12 : \ LDBL_EXP_MASK < 0x2000 ? 13 : \ LDBL_EXP_MASK < 0x4000 ? 14 : \ LDBL_EXP_MASK < 0x8000 ? 15 : \ LDBL_EXP_MASK < 0x10000 ? 16 : \ LDBL_EXP_MASK < 0x20000 ? 17 : \ LDBL_EXP_MASK < 0x40000 ? 18 : \ LDBL_EXP_MASK < 0x80000 ? 19 : \ LDBL_EXP_MASK < 0x100000 ? 20 : \ LDBL_EXP_MASK < 0x200000 ? 21 : \ LDBL_EXP_MASK < 0x400000 ? 22 : \ LDBL_EXP_MASK < 0x800000 ? 23 : \ LDBL_EXP_MASK < 0x1000000 ? 24 : \ LDBL_EXP_MASK < 0x2000000 ? 25 : \ LDBL_EXP_MASK < 0x4000000 ? 26 : \ LDBL_EXP_MASK < 0x8000000 ? 27 : \ LDBL_EXP_MASK < 0x10000000 ? 28 : \ LDBL_EXP_MASK < 0x20000000 ? 29 : \ LDBL_EXP_MASK < 0x40000000 ? 30 : \ LDBL_EXP_MASK <= 0x7fffffff ? 31 : \ 32) /* Number of bits used for a floating-point number: the mantissa (not counting the "hidden bit", since it may or may not be explicit), the exponent, and the sign. */ #define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1) #define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1) #define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1) /* Number of bytes used for a floating-point number. This can be smaller than the 'sizeof'. For example, on i386 systems, 'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but sizeof (long double) = 12 or = 16. */ #define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) #define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) #define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) /* Verify that SIZEOF_FLT <= sizeof (float) etc. */ typedef int verify_sizeof_flt[SIZEOF_FLT <= sizeof (float) ? 1 : -1]; typedef int verify_sizeof_dbl[SIZEOF_DBL <= sizeof (double) ? 1 : - 1]; typedef int verify_sizeof_ldbl[SIZEOF_LDBL <= sizeof (long double) ? 1 : - 1]; #endif /* _FLOATPLUS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-stat.c�������������������������������������������������������0000664�0001750�0001750�00000003134�14670377436�021170� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Tests of stat. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <sys/stat.h> /* Caution: stat may be a function-like macro. Although this signature check must pass, it may be the signature of the real (and broken) stat rather than rpl_stat. Most code should not use the address of stat. */ #include "signature.h" SIGNATURE_CHECK (stat, int, (char const *, struct stat *)); #include <fcntl.h> #include <errno.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include "same-inode.h" #include "macros.h" #define BASE "test-stat.t" #include "test-stat.h" /* Wrapper around stat, which works even if stat is a function-like macro, where test_stat_func(stat) would do the wrong thing. */ static int do_stat (char const *name, struct stat *st) { return stat (name, st); } int main (void) { return test_stat_func (do_stat, true); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-exclude2.sh��������������������������������������������������0000775�0001750�0001750�00000002475�14670377431�022125� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test suite for exclude. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . fail=0 cat > in <<EOT foo* bar Baz EOT # Test case-insensitive literal matches cat > expected <<EOT foo: 0 foo*: 1 bar: 1 foobar: 0 baz: 1 bar/qux: 0 EOT ${CHECKER} test-exclude -casefold in -- foo 'foo*' bar foobar baz bar/qux > out || exit $? # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac # normalize output LC_ALL=C tr -d "$cr" < out > k && mv k out compare expected out || fail=1 Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsinit.c����������������������������������������������������0000664�0001750�0001750�00000002677�14670377436�021675� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of test for initial conversion state. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include <wchar.h> #include "signature.h" SIGNATURE_CHECK (mbsinit, int, (const mbstate_t *)); #include <locale.h> #include "macros.h" int main (int argc, char *argv[]) { static mbstate_t state; ASSERT (mbsinit (NULL)); ASSERT (mbsinit (&state)); if (argc > 1) { static const char input[1] = "\303"; wchar_t wc; size_t ret; /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; ret = mbrtowc (&wc, input, 1, &state); ASSERT (ret == (size_t)(-2)); ASSERT (!mbsinit (&state)); } return 0; } �����������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sleep.c������������������������������������������������������0000664�0001750�0001750�00000002633�14670377436�021330� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of sleep() function. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (sleep, unsigned int, (unsigned int)); #include <signal.h> #include "macros.h" #if HAVE_DECL_ALARM static void handle_alarm (int sig) { if (sig != SIGALRM) _exit (1); } #endif int main (void) { ASSERT (sleep (1) <= 1); ASSERT (sleep (0) == 0); #if HAVE_DECL_ALARM { const unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days. */ unsigned int remaining; signal (SIGALRM, handle_alarm); alarm (1); remaining = sleep (pentecost); ASSERT (pentecost - 10 < remaining && remaining <= pentecost); } #endif return 0; } �����������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/setsockopt.c������������������������������������������������������0000664�0001750�0001750�00000003370�14670377430�021432� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* setsockopt.c --- wrappers for Windows setsockopt function Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paolo Bonzini */ #include <config.h> #define WIN32_LEAN_AND_MEAN /* Get winsock2.h. */ #include <sys/socket.h> /* Get struct timeval. */ #include <sys/time.h> /* Get set_winsock_errno, FD_TO_SOCKET etc. */ #include "w32sock.h" #undef setsockopt int rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen) { SOCKET sock = FD_TO_SOCKET (fd); int r; if (sock == INVALID_SOCKET) { errno = EBADF; return -1; } else { if (level == SOL_SOCKET && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)) { const struct timeval *tv = optval; int milliseconds = tv->tv_sec * 1000 + tv->tv_usec / 1000; optval = &milliseconds; r = setsockopt (sock, level, optname, optval, sizeof (int)); } else { r = setsockopt (sock, level, optname, optval, optlen); } if (r < 0) set_winsock_errno (); return r; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-getopt-posix.c�����������������������������������������������0000664�0001750�0001750�00000002733�14670377436�022663� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of command line argument processing. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ #include <config.h> /* None of the files accessed by this test are large, so disable the ftell link warning if we are not using the gnulib ftell module. */ #define _GL_NO_LARGE_FILES /* POSIX and glibc provide the getopt() function in <unistd.h>, see https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html https://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html But gnulib provides the getopt() function in <getopt.h>, not in <unistd.h>. Nevertheless the getopt() function should also be found in <unistd.h>. */ #include <unistd.h> #define TEST_GETOPT_GNU 0 #define TEST_GETOPT_TMP_NAME "test-getopt-posix.tmp" #include "test-getopt-main.h" �������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fdopen.c�����������������������������������������������������0000664�0001750�0001750�00000002557�14670377436�021500� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test opening a stream with a file descriptor. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include "signature.h" SIGNATURE_CHECK (fdopen, FILE *, (int, const char *)); #include <errno.h> #include <unistd.h> #include "macros.h" int main (void) { /* Test behavior on failure. POSIX makes it hard to check for failure, since the behavior is not well-defined on invalid file descriptors, so try fdopen 1000 times and if that's not enough to fail due to EMFILE, so be it. */ int i; for (i = 0; i < 1000; i++) { errno = 0; if (! fdopen (STDOUT_FILENO, "w")) { ASSERT (errno != 0); break; } } return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-getcwd-lgpl.c������������������������������������������������0000664�0001750�0001750�00000005106�14670377436�022427� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of getcwd() function. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (getcwd, char *, (char *, size_t)); #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "macros.h" int main (int argc, char **argv) { char *pwd1; char *pwd2; /* If the user provides an argument, attempt to chdir there first. */ if (1 < argc) { if (chdir (argv[1]) == 0) printf ("changed to directory %s\n", argv[1]); } pwd1 = getcwd (NULL, 0); ASSERT (pwd1 && *pwd1); if (1 < argc) printf ("cwd=%s\n", pwd1); /* Make sure the result is usable. */ ASSERT (chdir (pwd1) == 0); ASSERT (chdir (".//./.") == 0); /* Make sure that result is normalized. */ pwd2 = getcwd (NULL, 0); ASSERT (pwd2); ASSERT (strcmp (pwd1, pwd2) == 0); free (pwd2); { size_t len = strlen (pwd1); ssize_t i = len - 10; if (i < 1) i = 1; pwd2 = getcwd (NULL, len + 1); ASSERT (pwd2); free (pwd2); pwd2 = malloc (len + 2); for ( ; i <= len; i++) { char *tmp; errno = 0; ASSERT (getcwd (pwd2, i) == NULL); ASSERT (errno == ERANGE); /* Allow either glibc or BSD behavior, since POSIX allows both. */ errno = 0; tmp = getcwd (NULL, i); if (tmp) { ASSERT (strcmp (pwd1, tmp) == 0); free (tmp); } else { ASSERT (errno == ERANGE); } } ASSERT (getcwd (pwd2, len + 1) == pwd2); pwd2[len] = '/'; pwd2[len + 1] = '\0'; } ASSERT (strstr (pwd2, "/./") == NULL); ASSERT (strstr (pwd2, "/../") == NULL); ASSERT (strstr (pwd2 + 1 + (pwd2[1] == '/'), "//") == NULL); /* Validate a POSIX requirement on size. */ errno = 0; ASSERT (getcwd(pwd2, 0) == NULL); ASSERT (errno == EINVAL); free (pwd1); free (pwd2); return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/pthread_sigmask.c�������������������������������������������������0000664�0001750�0001750�00000005361�14670377430�022403� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* POSIX compatible signal blocking for threads. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <signal.h> #include <errno.h> #include <stddef.h> #if PTHREAD_SIGMASK_INEFFECTIVE # include <string.h> #endif #if PTHREAD_SIGMASK_UNBLOCK_BUG # include <unistd.h> #endif int pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask) #undef pthread_sigmask { #if HAVE_PTHREAD_SIGMASK int ret; # if PTHREAD_SIGMASK_INEFFECTIVE sigset_t omask, omask_copy; sigset_t *old_mask_ptr = &omask; sigemptyset (&omask); /* Add a signal unlikely to be blocked, so that OMASK_COPY is unlikely to match the actual mask. */ sigaddset (&omask, SIGILL); memcpy (&omask_copy, &omask, sizeof omask); # else sigset_t *old_mask_ptr = old_mask; # endif ret = pthread_sigmask (how, new_mask, old_mask_ptr); # if PTHREAD_SIGMASK_INEFFECTIVE if (ret == 0) { /* Detect whether pthread_sigmask is currently ineffective. Don't cache the information: libpthread.so could be dynamically loaded after the program started and after pthread_sigmask was called for the first time. */ if (memcmp (&omask_copy, &omask, sizeof omask) == 0 && pthread_sigmask (1729, &omask_copy, NULL) == 0) { /* pthread_sigmask is currently ineffective. The program is not linked to -lpthread. So use sigprocmask instead. */ return (sigprocmask (how, new_mask, old_mask) < 0 ? errno : 0); } if (old_mask) memcpy (old_mask, &omask, sizeof omask); } # endif # if PTHREAD_SIGMASK_FAILS_WITH_ERRNO if (ret == -1) return errno; # endif # if PTHREAD_SIGMASK_UNBLOCK_BUG if (ret == 0 && new_mask != NULL && (how == SIG_UNBLOCK || how == SIG_SETMASK)) { /* Give the OS the opportunity to raise signals that were pending before the pthread_sigmask call and have now been unblocked. */ usleep (1); } # endif return ret; #else int ret = sigprocmask (how, new_mask, old_mask); return (ret < 0 ? errno : 0); #endif } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-dup.c��������������������������������������������������������0000664�0001750�0001750�00000002201�14670377431�020772� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test duplicating a file descriptor. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (dup, int, (int)); #include <errno.h> #include "macros.h" int main (void) { /* Test behaviour for invalid file descriptors. */ { errno = 0; ASSERT (dup (-1) == -1); ASSERT (errno == EBADF); } { close (99); errno = 0; ASSERT (dup (99) == -1); ASSERT (errno == EBADF); } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-alignof.c����������������������������������������������������0000664�0001750�0001750�00000003061�14670377436�021633� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <alignof.h>. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ #include <config.h> #include <alignof.h> #include <stddef.h> #include <stdint.h> #include "verify.h" typedef long double longdouble; typedef struct { char a[1]; } struct1; typedef struct { char a[2]; } struct2; typedef struct { char a[3]; } struct3; typedef struct { char a[4]; } struct4; #define CHECK(type) \ typedef struct { char slot1; type slot2; } type##_helper; \ verify (alignof_slot (type) == offsetof (type##_helper, slot2)); \ const int type##_slot_alignment = alignof_slot (type); \ const int type##_type_alignment = alignof_type (type); CHECK (char) CHECK (short) CHECK (int) CHECK (long) CHECK (float) CHECK (double) CHECK (longdouble) #ifdef INT64_MAX CHECK (int64_t) #endif CHECK (struct1) CHECK (struct2) CHECK (struct3) CHECK (struct4) int main () { return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/nap.h�������������������������������������������������������������0000664�0001750�0001750�00000010563�14670377430�020021� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Assist in file system timestamp tests. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #ifndef GLTEST_NAP_H # define GLTEST_NAP_H # include <limits.h> # include <stdbool.h> # include <intprops.h> /* Avoid a conflict with a function called nap() on UnixWare. */ # if defined _SCO_DS || (defined __SCO_VERSION__ || defined __sysv5__) /* OpenServer, UnixWare */ # include <unistd.h> # undef nap # define nap gl_nap # endif /* Name of the witness file. */ #define TEMPFILE BASE "nap.tmp" /* File descriptor used for the witness file. */ static int nap_fd = -1; /* Return A - B, in ns. Return 0 if the true result would be negative. Return INT_MAX if the true result would be greater than INT_MAX. */ static int diff_timespec (struct timespec a, struct timespec b) { time_t as = a.tv_sec; time_t bs = b.tv_sec; int ans = a.tv_nsec; int bns = b.tv_nsec; int sdiff; ASSERT (0 <= ans && ans < 2000000000); ASSERT (0 <= bns && bns < 2000000000); if (! (bs < as || (bs == as && bns < ans))) return 0; if (INT_SUBTRACT_WRAPV (as, bs, &sdiff) || INT_MULTIPLY_WRAPV (sdiff, 1000000000, &sdiff) || INT_ADD_WRAPV (sdiff, ans - bns, &sdiff)) return INT_MAX; return sdiff; } /* If DO_WRITE, bump the modification time of the file designated by NAP_FD. Then fetch the new STAT information of NAP_FD. */ static void nap_get_stat (struct stat *st, int do_write) { if (do_write) { ASSERT (write (nap_fd, "\n", 1) == 1); #if defined _WIN32 || defined __CYGWIN__ /* On Windows, the modification times are not changed until NAP_FD is closed. See <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-writefile> */ close (nap_fd); nap_fd = open (TEMPFILE, O_RDWR, 0600); ASSERT (nap_fd != -1); lseek (nap_fd, 0, SEEK_END); #endif } ASSERT (fstat (nap_fd, st) == 0); } /* Given a file whose descriptor is FD, see whether delaying by DELAY nanoseconds causes a change in a file's mtime. OLD_ST is the file's status, recently gotten. */ static bool nap_works (int delay, struct stat old_st) { struct stat st; struct timespec delay_spec; delay_spec.tv_sec = delay / 1000000000; delay_spec.tv_nsec = delay % 1000000000; ASSERT (nanosleep (&delay_spec, 0) == 0); nap_get_stat (&st, 1); if (diff_timespec (get_stat_mtime (&st), get_stat_mtime (&old_st))) return true; return false; } static void clear_temp_file (void) { if (0 <= nap_fd) { ASSERT (close (nap_fd) != -1); ASSERT (unlink (TEMPFILE) != -1); } } /* Sleep long enough to notice a timestamp difference on the file system in the current directory. Use an adaptive approach, trying to find the smallest delay which works on the current file system to make the timestamp difference appear. Assert a maximum delay of ~2 seconds, more precisely sum(2^n) from 0 to 30 = 2^31 - 1 = 2.1s. Assumes that BASE is defined, and requires that the test module depends on nanosleep. */ static void nap (void) { struct stat old_st; static int delay = 1; if (-1 == nap_fd) { atexit (clear_temp_file); ASSERT ((nap_fd = creat (TEMPFILE, 0600)) != -1); nap_get_stat (&old_st, 0); } else { ASSERT (0 <= nap_fd); nap_get_stat (&old_st, 1); } if (1 < delay) delay = delay / 2; /* Try half of the previous delay. */ ASSERT (0 < delay); for (;;) { if (nap_works (delay, old_st)) return; if (delay <= (2147483647 - 1) / 2) { delay = delay * 2 + 1; continue; } else break; } /* Bummer: even the highest nap delay didn't work. */ ASSERT (0); } #endif /* GLTEST_NAP_H */ ���������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-snprintf.c���������������������������������������������������0000664�0001750�0001750�00000003723�14670377436�022064� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of snprintf() function. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <stdio.h> #include "signature.h" SIGNATURE_CHECK (snprintf, int, (char *, size_t, char const *, ...)); #include <string.h> #include "macros.h" int main (int argc, char *argv[]) { char buf[8]; int size; int retval; retval = snprintf (NULL, 0, "%d", 12345); ASSERT (retval == 5); for (size = 0; size <= 8; size++) { memcpy (buf, "DEADBEEF", 8); retval = snprintf (buf, size, "%d", 12345); ASSERT (retval == 5); if (size < 6) { if (size > 0) { ASSERT (memcmp (buf, "12345", size - 1) == 0); ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size); } #if !CHECK_SNPRINTF_POSIX if (size > 0) #endif ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); } else { ASSERT (memcmp (buf, "12345\0EF", 8) == 0); } } /* Test the support of the POSIX/XSI format strings with positions. */ { char result[100]; retval = snprintf (result, sizeof (result), "%2$d %1$d", 33, 55); ASSERT (strcmp (result, "55 33") == 0); ASSERT (retval == strlen (result)); } return 0; } ���������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsstr1.c����������������������������������������������������0000664�0001750�0001750�00000006515�14670377436�021616� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of searching in a string. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <string.h> #include <stdlib.h> #include "macros.h" int main () { /* This test is executed in the C locale. */ { const char input[] = "foo"; const char *result = mbsstr (input, ""); ASSERT (result == input); } { const char input[] = "foo"; const char *result = mbsstr (input, "o"); ASSERT (result == input + 1); } { const char input[] = "ABC ABCDAB ABCDABCDABDE"; const char *result = mbsstr (input, "ABCDABD"); ASSERT (result == input + 15); } { const char input[] = "ABC ABCDAB ABCDABCDABDE"; const char *result = mbsstr (input, "ABCDABE"); ASSERT (result == NULL); } /* Check that a very long haystack is handled quickly if the needle is short and occurs near the beginning. */ { size_t repeat = 10000; size_t m = 1000000; const char *needle = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; char *haystack = (char *) malloc (m + 1); if (haystack != NULL) { memset (haystack, 'A', m); haystack[0] = 'B'; haystack[m] = '\0'; for (; repeat > 0; repeat--) { ASSERT (mbsstr (haystack, needle) == haystack + 1); } free (haystack); } } /* Check that a very long needle is discarded quickly if the haystack is short. */ { size_t repeat = 10000; size_t m = 1000000; const char *haystack = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB"; char *needle = (char *) malloc (m + 1); if (needle != NULL) { memset (needle, 'A', m); needle[m] = '\0'; for (; repeat > 0; repeat--) { ASSERT (mbsstr (haystack, needle) == NULL); } free (needle); } } /* Check that the asymptotic worst-case complexity is not quadratic. */ { size_t m = 1000000; char *haystack = (char *) malloc (2 * m + 2); char *needle = (char *) malloc (m + 2); if (haystack != NULL && needle != NULL) { const char *result; memset (haystack, 'A', 2 * m); haystack[2 * m] = 'B'; haystack[2 * m + 1] = '\0'; memset (needle, 'A', m); needle[m] = 'B'; needle[m + 1] = '\0'; result = mbsstr (haystack, needle); ASSERT (result == haystack + m); } free (needle); free (haystack); } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-binary-io.c��������������������������������������������������0000664�0001750�0001750�00000003054�14670377436�022107� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of binary mode I/O. Copyright (C) 2005, 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. */ #include <config.h> #include "binary-io.h" #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "macros.h" int main (int argc, char *argv[]) { /* Test the O_BINARY macro. */ { int fd = open ("t-bin-out0.tmp", O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0600); if (write (fd, "Hello\n", 6) < 0) exit (1); close (fd); } { struct stat statbuf; if (stat ("t-bin-out0.tmp", &statbuf) < 0) exit (1); ASSERT (statbuf.st_size == 6); } switch (argv[1][0]) { case '1': /* Test the set_binary_mode() function. */ set_binary_mode (1, O_BINARY); fputs ("Hello\n", stdout); break; default: break; } return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-strerror.c���������������������������������������������������0000664�0001750�0001750�00000003710�14670377436�022077� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of strerror() function. Copyright (C) 2007-2021 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, 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2007. */ #include <config.h> #include <string.h> #include "signature.h" SIGNATURE_CHECK (strerror, char *, (int)); #include <errno.h> #include "macros.h" int main (void) { char *str; errno = 0; str = strerror (EACCES); ASSERT (str); ASSERT (*str); ASSERT (errno == 0); errno = 0; str = strerror (ETIMEDOUT); ASSERT (str); ASSERT (*str); ASSERT (errno == 0); errno = 0; str = strerror (EOVERFLOW); ASSERT (str); ASSERT (*str); ASSERT (errno == 0); /* POSIX requires strerror (0) to succeed. Reject use of "Unknown error", but allow "Success", "No error", or even Solaris' "Error 0" which are distinct patterns from true out-of-range strings. http://austingroupbugs.net/view.php?id=382 */ errno = 0; str = strerror (0); ASSERT (str); ASSERT (*str); ASSERT (errno == 0); ASSERT (strstr (str, "nknown") == NULL); ASSERT (strstr (str, "ndefined") == NULL); /* POSIX requires strerror to produce a non-NULL result for all inputs; as an extension, we also guarantee a non-empty result. Reporting EINVAL is optional. */ errno = 0; str = strerror (-3); ASSERT (str); ASSERT (*str); ASSERT (errno == 0 || errno == EINVAL); return 0; } ��������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcrtomb-w32-4.sh���������������������������������������������0000775�0001750�0001750�00000000134�14670377436�022634� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test a CP950 locale. ${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_Taiwan 950 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-inet_pton.c��������������������������������������������������0000664�0001750�0001750�00000003330�14670377436�022212� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of inet_pton function. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ #include <config.h> #include <arpa/inet.h> #include "signature.h" SIGNATURE_CHECK (inet_pton, int, (int, const char *, void *)); #include <netinet/in.h> #include <sys/socket.h> #include "macros.h" int main (void) { #if defined AF_INET /* HAVE_IPV4 */ { /* This machine was for a long time known as ma2s2.mathematik.uni-karlsruhe.de. */ const char printable[] = "129.13.115.2"; struct in_addr internal; int ret; ret = inet_pton (AF_INET, printable, &internal); ASSERT (ret == 1); /* Verify that internal is filled in network byte order. */ ASSERT (((unsigned char *) &internal)[0] == 0x81); ASSERT (((unsigned char *) &internal)[1] == 0x0D); ASSERT (((unsigned char *) &internal)[2] == 0x73); ASSERT (((unsigned char *) &internal)[3] == 0x02); # ifdef WORDS_BIGENDIAN ASSERT (internal.s_addr == 0x810D7302); # else ASSERT (internal.s_addr == 0x02730D81); # endif } #endif return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sys_ioctl.c��������������������������������������������������0000664�0001750�0001750�00000001551�14670377436�022226� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <sys/ioctl.h> substitute. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <sys/ioctl.h> int main (void) { return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-vc-list-files-git.sh�����������������������������������������0000775�0001750�0001750�00000002655�14670377437�023662� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Unit tests for vc-list-files # Copyright (C) 2008-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. */ : ${srcdir=.} . "$srcdir/init.sh"; path_prepend_ . tmpdir=vc-git-$$ GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE fail=1 mkdir $tmpdir && cd $tmpdir && # without git, skip the test # The double use of 'exit' is needed for the reference to $? inside the trap. { ( git init -q ) > /dev/null 2>&1 \ || skip_ "git not found in PATH"; } && mkdir d && touch d/a b c && git config user.email "you@example.com" && git config user.name "Your Name" && git add . > /dev/null && git commit -q -a -m log && printf '%s\n' b c d/a > expected && $BOURNE_SHELL "$abs_aux_dir/vc-list-files" > actual && compare expected actual && fail=0 Exit $fail �����������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-xstrtoimax.c�������������������������������������������������0000664�0001750�0001750�00000000152�14670377436�022434� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __xstrtol xstrtoimax #define __strtol_t intmax_t #define __spec PRIdMAX #include "test-xstrtol.c" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-xstrtol.sh���������������������������������������������������0000775�0001750�0001750�00000004054�14670377437�022132� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh : ${srcdir=.} . "$srcdir/init.sh"; path_prepend_ . too_big=99999999999999999999999999999999999999999999999999999999999999999999 result=0 # test xstrtol ${CHECKER} test-xstrtol 1 >> out 2>&1 || result=1 ${CHECKER} test-xstrtol -1 >> out 2>&1 || result=1 ${CHECKER} test-xstrtol 1k >> out 2>&1 || result=1 ${CHECKER} test-xstrtol ${too_big}h >> out 2>&1 && result=1 ${CHECKER} test-xstrtol $too_big >> out 2>&1 && result=1 ${CHECKER} test-xstrtol x >> out 2>&1 && result=1 ${CHECKER} test-xstrtol 9x >> out 2>&1 && result=1 ${CHECKER} test-xstrtol 010 >> out 2>&1 || result=1 # suffix without integer is valid ${CHECKER} test-xstrtol MiB >> out 2>&1 || result=1 ${CHECKER} test-xstrtol 1bB >> out 2>&1 && result=1 # test xstrtoul ${CHECKER} test-xstrtoul 1 >> out 2>&1 || result=1 ${CHECKER} test-xstrtoul -1 >> out 2>&1 && result=1 ${CHECKER} test-xstrtoul 1k >> out 2>&1 || result=1 ${CHECKER} test-xstrtoul ${too_big}h >> out 2>&1 && result=1 ${CHECKER} test-xstrtoul $too_big >> out 2>&1 && result=1 ${CHECKER} test-xstrtoul x >> out 2>&1 && result=1 ${CHECKER} test-xstrtoul 9x >> out 2>&1 && result=1 ${CHECKER} test-xstrtoul 010 >> out 2>&1 || result=1 ${CHECKER} test-xstrtoul MiB >> out 2>&1 || result=1 ${CHECKER} test-xstrtoul 1bB >> out 2>&1 && result=1 # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. if echo solaris | tr -d '\r' | grep solais > /dev/null; then cr='\015' else cr='\r' fi # normalize output LC_ALL=C tr -d "$cr" < out > k mv k out # compare expected output cat > expected <<EOF 1->1 () -1->-1 () 1k->1024 () invalid suffix in X argument '${too_big}h' X argument '$too_big' too large invalid X argument 'x' invalid suffix in X argument '9x' 010->8 () MiB->1048576 () invalid suffix in X argument '1bB' 1->1 () invalid X argument '-1' 1k->1024 () invalid suffix in X argument '${too_big}h' X argument '$too_big' too large invalid X argument 'x' invalid suffix in X argument '9x' 010->8 () MiB->1048576 () invalid suffix in X argument '1bB' EOF compare expected out || result=1 Exit $result ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/glthread/���������������������������������������������������������0000775�0001750�0001750�00000000000�14670377430�020657� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/glthread/thread.c�������������������������������������������������0000664�0001750�0001750�00000013174�14670377430�022300� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Creating and controlling threads. Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h. */ #include <config.h> /* Specification. */ #include "glthread/thread.h" #include <stdlib.h> #include "glthread/lock.h" /* ========================================================================= */ #if USE_ISOC_THREADS struct thrd_with_exitvalue { thrd_t volatile tid; void * volatile exitvalue; }; /* The Thread-Specific Storage (TSS) key that allows to access each thread's 'struct thrd_with_exitvalue *' pointer. */ static tss_t thrd_with_exitvalue_key; /* Initializes thrd_with_exitvalue_key. This function must only be called once. */ static void do_init_thrd_with_exitvalue_key (void) { if (tss_create (&thrd_with_exitvalue_key, NULL) != thrd_success) abort (); } /* Initializes thrd_with_exitvalue_key. */ static void init_thrd_with_exitvalue_key (void) { static once_flag once = ONCE_FLAG_INIT; call_once (&once, do_init_thrd_with_exitvalue_key); } typedef union { struct thrd_with_exitvalue t; struct { thrd_t tid; /* reserve memory for t.tid */ void *(*mainfunc) (void *); void *arg; } a; } main_arg_t; static int thrd_main_func (void *pmarg) { /* Unpack the object that combines mainfunc and arg. */ main_arg_t *main_arg = (main_arg_t *) pmarg; void *(*mainfunc) (void *) = main_arg->a.mainfunc; void *arg = main_arg->a.arg; if (tss_set (thrd_with_exitvalue_key, &main_arg->t) != thrd_success) abort (); /* Execute mainfunc, with arg as argument. */ { void *exitvalue = mainfunc (arg); /* Store the exitvalue, for use by glthread_join(). */ main_arg->t.exitvalue = exitvalue; return 0; } } int glthread_create (gl_thread_t *threadp, void *(*mainfunc) (void *), void *arg) { init_thrd_with_exitvalue_key (); { /* Combine mainfunc and arg in a single object. A stack-allocated object does not work, because it would be out of existence when thrd_create returns before thrd_main_func is entered. So, allocate it in the heap. */ main_arg_t *main_arg = (main_arg_t *) malloc (sizeof (main_arg_t)); if (main_arg == NULL) return ENOMEM; main_arg->a.mainfunc = mainfunc; main_arg->a.arg = arg; switch (thrd_create ((thrd_t *) &main_arg->t.tid, thrd_main_func, main_arg)) { case thrd_success: break; case thrd_nomem: free (main_arg); return ENOMEM; default: free (main_arg); return EAGAIN; } *threadp = &main_arg->t; return 0; } } gl_thread_t gl_thread_self (void) { init_thrd_with_exitvalue_key (); { gl_thread_t thread = (struct thrd_with_exitvalue *) tss_get (thrd_with_exitvalue_key); if (thread == NULL) { /* This happens only in threads that have not been created through glthread_create(), such as the main thread. */ for (;;) { thread = (struct thrd_with_exitvalue *) malloc (sizeof (struct thrd_with_exitvalue)); if (thread != NULL) break; /* Memory allocation failed. There is not much we can do. Have to busy-loop, waiting for the availability of memory. */ { struct timespec ts; ts.tv_sec = 1; ts.tv_nsec = 0; thrd_sleep (&ts, NULL); } } thread->tid = thrd_current (); thread->exitvalue = NULL; /* just to be deterministic */ if (tss_set (thrd_with_exitvalue_key, thread) != thrd_success) abort (); } return thread; } } int glthread_join (gl_thread_t thread, void **return_value_ptr) { /* On Solaris 11.4, thrd_join crashes when the second argument we pass is NULL. */ int dummy; if (thread == gl_thread_self ()) return EINVAL; if (thrd_join (thread->tid, &dummy) != thrd_success) return EINVAL; if (return_value_ptr != NULL) *return_value_ptr = thread->exitvalue; free (thread); return 0; } _Noreturn void gl_thread_exit (void *return_value) { gl_thread_t thread = gl_thread_self (); thread->exitvalue = return_value; thrd_exit (0); } #endif /* ========================================================================= */ #if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS #include <pthread.h> #if defined PTW32_VERSION || defined __MVS__ const gl_thread_t gl_null_thread /* = { .p = NULL } */; #endif #endif /* ========================================================================= */ #if USE_WINDOWS_THREADS #endif /* ========================================================================= */ gl_thread_t gl_thread_create (void *(*func) (void *arg), void *arg) { gl_thread_t thread; int ret; ret = glthread_create (&thread, func, arg); if (ret != 0) abort (); return thread; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/glthread/thread.h�������������������������������������������������0000664�0001750�0001750�00000026120�14670377427�022306� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Creating and controlling threads. Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h. */ /* This file contains primitives for creating and controlling threads. Thread data type: gl_thread_t. Creating a thread: thread = gl_thread_create (func, arg); Or with control of error handling: err = glthread_create (&thread, func, arg); extern int glthread_create (gl_thread_t *result, void *(*func) (void *), void *arg); Querying and changing the signal mask of a thread (not supported on all platforms): gl_thread_sigmask (how, newmask, oldmask); Or with control of error handling: err = glthread_sigmask (how, newmask, oldmask); extern int glthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask); Waiting for termination of another thread: gl_thread_join (thread, &return_value); Or with control of error handling: err = glthread_join (thread, &return_value); extern int glthread_join (gl_thread_t thread, void **return_value_ptr); Getting a reference to the current thread: current = gl_thread_self (); extern gl_thread_t gl_thread_self (void); Getting a reference to the current thread as a pointer, for debugging: ptr = gl_thread_self_pointer (); extern void * gl_thread_self_pointer (void); Terminating the current thread: gl_thread_exit (return_value); extern _Noreturn void gl_thread_exit (void *return_value); Requesting custom code to be executed at fork() time (not supported on all platforms): gl_thread_atfork (prepare_func, parent_func, child_func); Or with control of error handling: err = glthread_atfork (prepare_func, parent_func, child_func); extern int glthread_atfork (void (*prepare_func) (void), void (*parent_func) (void), void (*child_func) (void)); Note that even on platforms where this is supported, use of fork() and threads together is problematic, see <https://lists.gnu.org/r/bug-gnulib/2008-08/msg00062.html> */ #ifndef _GLTHREAD_THREAD_H #define _GLTHREAD_THREAD_H #include <errno.h> #include <stdlib.h> #if !defined c11_threads_in_use # if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC # define c11_threads_in_use() 1 # elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK # include <threads.h> # pragma weak thrd_exit # define c11_threads_in_use() (thrd_exit != NULL) # else # define c11_threads_in_use() 0 # endif #endif /* ========================================================================= */ #if USE_ISOC_THREADS /* Use the ISO C threads library. */ # include <threads.h> # ifdef __cplusplus extern "C" { # endif /* -------------------------- gl_thread_t datatype -------------------------- */ typedef struct thrd_with_exitvalue *gl_thread_t; extern int glthread_create (gl_thread_t *threadp, void *(*func) (void *), void *arg); # define glthread_sigmask(HOW, SET, OSET) \ pthread_sigmask (HOW, SET, OSET) extern int glthread_join (gl_thread_t thread, void **return_value_ptr); extern gl_thread_t gl_thread_self (void); # define gl_thread_self_pointer() \ (void *) gl_thread_self () extern _Noreturn void gl_thread_exit (void *return_value); # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 # ifdef __cplusplus } # endif #endif /* ========================================================================= */ #if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS /* Use the POSIX threads library. */ # include <pthread.h> /* On IRIX, pthread_atfork is declared in <unistd.h>, not in <pthread.h>. */ # if defined __sgi # include <unistd.h> # endif # if USE_POSIX_THREADS_WEAK /* Compilers other than GCC need to see the declaration of pthread_sigmask before the "#pragma weak pthread_sigmask" below. */ # include <signal.h> # endif # ifdef __cplusplus extern "C" { # endif # if PTHREAD_IN_USE_DETECTION_HARD /* The pthread_in_use() detection needs to be done at runtime. */ # define pthread_in_use() \ glthread_in_use () extern int glthread_in_use (void); # endif # if USE_POSIX_THREADS_WEAK /* Use weak references to the POSIX threads library. */ /* Weak references avoid dragging in external libraries if the other parts of the program don't use them. Here we use them, because we don't want every program that uses libintl to depend on libpthread. This assumes that libpthread would not be loaded after libintl; i.e. if libintl is loaded first, by an executable that does not depend on libpthread, and then a module is dynamically loaded that depends on libpthread, libintl will not be multithread-safe. */ /* The way to test at runtime whether libpthread is present is to test whether a function pointer's value, such as &pthread_mutex_init, is non-NULL. However, some versions of GCC have a bug through which, in PIC mode, &foo != NULL always evaluates to true if there is a direct call to foo(...) in the same function. To avoid this, we test the address of a function in libpthread that we don't use. */ # ifndef pthread_sigmask /* Do not declare rpl_pthread_sigmask weak. */ # pragma weak pthread_sigmask # endif # pragma weak pthread_join # ifndef pthread_self # pragma weak pthread_self # endif # pragma weak pthread_exit # if HAVE_PTHREAD_ATFORK # pragma weak pthread_atfork # endif # if !PTHREAD_IN_USE_DETECTION_HARD # pragma weak pthread_mutexattr_gettype # define pthread_in_use() \ (pthread_mutexattr_gettype != NULL || c11_threads_in_use ()) # endif # else # if !PTHREAD_IN_USE_DETECTION_HARD # define pthread_in_use() 1 # endif # endif /* -------------------------- gl_thread_t datatype -------------------------- */ /* This choice of gl_thread_t assumes that pthread_equal (a, b) is equivalent to ((a) == (b)). This is the case on all platforms in use in 2008. */ typedef pthread_t gl_thread_t; # define glthread_create(THREADP, FUNC, ARG) \ (pthread_in_use () ? pthread_create (THREADP, NULL, FUNC, ARG) : ENOSYS) # define glthread_sigmask(HOW, SET, OSET) \ (pthread_in_use () ? pthread_sigmask (HOW, SET, OSET) : 0) # define glthread_join(THREAD, RETVALP) \ (pthread_in_use () ? pthread_join (THREAD, RETVALP) : 0) # ifdef PTW32_VERSION /* In pthreads-win32, pthread_t is a struct with a pointer field 'p' and other fields. */ # define gl_thread_self() \ (pthread_in_use () ? pthread_self () : gl_null_thread) # define gl_thread_self_pointer() \ (pthread_in_use () ? pthread_self ().p : NULL) extern const gl_thread_t gl_null_thread; # elif defined __MVS__ /* On IBM z/OS, pthread_t is a struct with an 8-byte '__' field. The first three bytes of this field appear to uniquely identify a pthread_t, though not necessarily representing a pointer. */ # define gl_thread_self() \ (pthread_in_use () ? pthread_self () : gl_null_thread) # define gl_thread_self_pointer() \ (pthread_in_use () ? *((void **) pthread_self ().__) : NULL) extern const gl_thread_t gl_null_thread; # else # define gl_thread_self() \ (pthread_in_use () ? pthread_self () : (pthread_t) 0) # define gl_thread_self_pointer() \ (pthread_in_use () ? (void *) pthread_self () : NULL) # endif # define gl_thread_exit(RETVAL) \ (void) (pthread_in_use () ? (pthread_exit (RETVAL), 0) : 0) # if HAVE_PTHREAD_ATFORK # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) \ (pthread_in_use () ? pthread_atfork (PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) : 0) # else # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 # endif # ifdef __cplusplus } # endif #endif /* ========================================================================= */ #if USE_WINDOWS_THREADS # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> # include "windows-thread.h" # ifdef __cplusplus extern "C" { # endif /* -------------------------- gl_thread_t datatype -------------------------- */ typedef glwthread_thread_t gl_thread_t; # define glthread_create(THREADP, FUNC, ARG) \ glwthread_thread_create (THREADP, 0, FUNC, ARG) # define glthread_sigmask(HOW, SET, OSET) \ /* unsupported */ 0 # define glthread_join(THREAD, RETVALP) \ glwthread_thread_join (THREAD, RETVALP) # define gl_thread_self() \ glwthread_thread_self () # define gl_thread_self_pointer() \ gl_thread_self () # define gl_thread_exit(RETVAL) \ glwthread_thread_exit (RETVAL) # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 # ifdef __cplusplus } # endif #endif /* ========================================================================= */ #if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS) /* Provide dummy implementation if threads are not supported. */ typedef int gl_thread_t; # define glthread_create(THREADP, FUNC, ARG) ENOSYS # define glthread_sigmask(HOW, SET, OSET) 0 # define glthread_join(THREAD, RETVALP) 0 # define gl_thread_self() 0 # define gl_thread_self_pointer() \ ((void *) gl_thread_self ()) # define gl_thread_exit(RETVAL) (void)0 # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 #endif /* ========================================================================= */ /* Macros with built-in error handling. */ #ifdef __cplusplus extern "C" { #endif extern gl_thread_t gl_thread_create (void *(*func) (void *arg), void *arg); #define gl_thread_sigmask(HOW, SET, OSET) \ do \ { \ if (glthread_sigmask (HOW, SET, OSET)) \ abort (); \ } \ while (0) #define gl_thread_join(THREAD, RETVAL) \ do \ { \ if (glthread_join (THREAD, RETVAL)) \ abort (); \ } \ while (0) #define gl_thread_atfork(PREPARE, PARENT, CHILD) \ do \ { \ if (glthread_atfork (PREPARE, PARENT, CHILD)) \ abort (); \ } \ while (0) #ifdef __cplusplus } #endif #endif /* _GLTHREAD_THREAD_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fnmatch-h.c��������������������������������������������������0000664�0001750�0001750�00000001766�14670377436�022073� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <fnmatch.h> substitute. Copyright (C) 2018-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2018. */ #include <config.h> #include <fnmatch.h> /* Check that the various FNM_* macros are defined. */ int ret = FNM_NOMATCH; int options[] = { FNM_PATHNAME, FNM_PERIOD, FNM_NOESCAPE }; int main (void) { return 0; } ����������kbuild-3608/src/grep/gnulib-tests/sched.in.h��������������������������������������������������������0000664�0001750�0001750�00000005204�14670377430�020732� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* A GNU-like <sched.h>. Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _@GUARD_PREFIX@_SCHED_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_SCHED_H@ # if @HAVE_SYS_CDEFS_H@ # include <sys/cdefs.h> # endif # @INCLUDE_NEXT@ @NEXT_SCHED_H@ #endif #ifndef _@GUARD_PREFIX@_SCHED_H #define _@GUARD_PREFIX@_SCHED_H /* Get pid_t. This is needed on glibc 2.11 (see glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=13198>) and Mac OS X 10.5. */ #include <sys/types.h> #ifdef __KLIBC__ /* On OS/2 kLIBC, struct sched_param is in spawn.h. */ # include <spawn.h> #endif #ifdef __VMS /* On OpenVMS, struct sched_param is in <pthread.h>. */ # include <pthread.h> #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ #if !@HAVE_STRUCT_SCHED_PARAM@ # if !GNULIB_defined_struct_sched_param struct sched_param { int sched_priority; }; # define GNULIB_defined_struct_sched_param 1 # endif #endif #if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER) # define SCHED_FIFO 1 # define SCHED_RR 2 # define SCHED_OTHER 0 #endif #if @GNULIB_SCHED_YIELD@ # if @REPLACE_SCHED_YIELD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef sched_yield # define sched_yield rpl_sched_yield # endif _GL_FUNCDECL_RPL (sched_yield, int, (void)); _GL_CXXALIAS_RPL (sched_yield, int, (void)); # else # if !@HAVE_SCHED_YIELD@ _GL_FUNCDECL_SYS (sched_yield, int, (void)); # endif _GL_CXXALIAS_SYS (sched_yield, int, (void)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (sched_yield); # endif #elif defined GNULIB_POSIXCHECK # undef sched_yield # if HAVE_RAW_DECL_SCHED_YIELD _GL_WARN_ON_USE (sched_yield, "sched_yield is not portable - " "use gnulib module sched_yield for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_SCHED_H */ #endif /* _@GUARD_PREFIX@_SCHED_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsstr2.sh���������������������������������������������������0000775�0001750�0001750�00000000601�14670377436�022000� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test whether a specific UTF-8 locale is installed. : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR_UTF8 = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no french Unicode locale is installed" else echo "Skipping test: no french Unicode locale is supported" fi exit 77 fi LC_ALL=$LOCALE_FR_UTF8 \ ${CHECKER} ./test-mbsstr2${EXEEXT} �������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsstr2.c����������������������������������������������������0000664�0001750�0001750�00000010245�14670377436�021612� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of searching in a string. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <string.h> #include <locale.h> #include <stdlib.h> #include "macros.h" int main () { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; { const char input[] = "f\303\266\303\266"; const char *result = mbsstr (input, ""); ASSERT (result == input); } { const char input[] = "f\303\266\303\266"; const char *result = mbsstr (input, "\303\266"); ASSERT (result == input + 1); } { const char input[] = "f\303\266\303\266"; const char *result = mbsstr (input, "\266\303"); ASSERT (result == NULL); } { const char input[] = "\303\204BC \303\204BCD\303\204B \303\204BCD\303\204BCD\303\204BDE"; /* "ÄBC ÄBCDÄB ÄBCDÄBCDÄBDE" */ const char *result = mbsstr (input, "\303\204BCD\303\204BD"); /* "ÄBCDÄBD" */ ASSERT (result == input + 19); } { const char input[] = "\303\204BC \303\204BCD\303\204B \303\204BCD\303\204BCD\303\204BDE"; /* "ÄBC ÄBCDÄB ÄBCDÄBCDÄBDE" */ const char *result = mbsstr (input, "\303\204BCD\303\204BE"); /* "ÄBCDÄBE" */ ASSERT (result == NULL); } /* Check that a very long haystack is handled quickly if the needle is short and occurs near the beginning. */ { size_t repeat = 10000; size_t m = 1000000; const char *needle = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; char *haystack = (char *) malloc (m + 1); if (haystack != NULL) { memset (haystack, 'A', m); haystack[0] = '\303'; haystack[1] = '\204'; haystack[m] = '\0'; for (; repeat > 0; repeat--) { ASSERT (mbsstr (haystack, needle) == haystack + 2); } free (haystack); } } /* Check that a very long needle is discarded quickly if the haystack is short. */ { size_t repeat = 10000; size_t m = 1000000; const char *haystack = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207" "A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207" "A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207" "A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207" "A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207"; char *needle = (char *) malloc (m + 1); if (needle != NULL) { memset (needle, 'A', m); needle[m] = '\0'; for (; repeat > 0; repeat--) { ASSERT (mbsstr (haystack, needle) == NULL); } free (needle); } } /* Check that the asymptotic worst-case complexity is not quadratic. */ { size_t m = 1000000; char *haystack = (char *) malloc (2 * m + 3); char *needle = (char *) malloc (m + 3); if (haystack != NULL && needle != NULL) { const char *result; memset (haystack, 'A', 2 * m); haystack[2 * m] = '\303'; haystack[2 * m + 1] = '\207'; haystack[2 * m + 2] = '\0'; memset (needle, 'A', m); needle[m] = '\303'; needle[m + 1] = '\207'; needle[m + 2] = '\0'; result = mbsstr (haystack, needle); ASSERT (result == haystack + m); } free (needle); free (haystack); } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fputc.c������������������������������������������������������0000664�0001750�0001750�00000004656�14670377436�021350� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of fputc() function. Copyright (C) 2011-2021 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, 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include "signature.h" SIGNATURE_CHECK (fputc, int, (int, FILE *)); #include <errno.h> #include <fcntl.h> #include <unistd.h> #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" #endif #include "macros.h" int main (int argc, char **argv) { const char *filename = "test-fputc.txt"; /* We don't have an fputc() function that installs an invalid parameter handler so far. So install that handler here, explicitly. */ #if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING gl_msvc_inval_ensure_handler (); #endif /* Test that fputc() on an unbuffered stream sets errno if someone else closes the stream fd behind the back of stdio. */ { FILE *fp = fopen (filename, "w"); ASSERT (fp != NULL); setvbuf (fp, NULL, _IONBF, 0); ASSERT (close (fileno (fp)) == 0); errno = 0; ASSERT (fputc ('x', fp) == EOF); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } /* Test that fputc() on an unbuffered stream sets errno if the stream was constructed with an invalid file descriptor. */ { FILE *fp = fdopen (-1, "w"); if (fp != NULL) { setvbuf (fp, NULL, _IONBF, 0); errno = 0; ASSERT (fputc ('x', fp) == EOF); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } } { FILE *fp; close (99); fp = fdopen (99, "w"); if (fp != NULL) { setvbuf (fp, NULL, _IONBF, 0); errno = 0; ASSERT (fputc ('x', fp) == EOF); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } } /* Clean up. */ unlink (filename); return 0; } ����������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/printf-args.h�����������������������������������������������������0000664�0001750�0001750�00000007406�14670377436�021507� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Decomposed printf argument list. Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _PRINTF_ARGS_H #define _PRINTF_ARGS_H /* This file can be parametrized with the following macros: ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. PRINTF_FETCHARGS Name of the function to be declared. STATIC Set to 'static' to declare the function static. */ /* Default parameters. */ #ifndef PRINTF_FETCHARGS # define PRINTF_FETCHARGS printf_fetchargs #endif /* Get size_t. */ #include <stddef.h> /* Get wchar_t. */ #if HAVE_WCHAR_T # include <stddef.h> #endif /* Get wint_t. */ #if HAVE_WINT_T # include <wchar.h> #endif /* Get va_list. */ #include <stdarg.h> /* Argument types */ typedef enum { TYPE_NONE, TYPE_SCHAR, TYPE_UCHAR, TYPE_SHORT, TYPE_USHORT, TYPE_INT, TYPE_UINT, TYPE_LONGINT, TYPE_ULONGINT, TYPE_LONGLONGINT, TYPE_ULONGLONGINT, TYPE_DOUBLE, TYPE_LONGDOUBLE, TYPE_CHAR, #if HAVE_WINT_T TYPE_WIDE_CHAR, #endif TYPE_STRING, #if HAVE_WCHAR_T TYPE_WIDE_STRING, #endif TYPE_POINTER, TYPE_COUNT_SCHAR_POINTER, TYPE_COUNT_SHORT_POINTER, TYPE_COUNT_INT_POINTER, TYPE_COUNT_LONGINT_POINTER, TYPE_COUNT_LONGLONGINT_POINTER #if ENABLE_UNISTDIO /* The unistdio extensions. */ , TYPE_U8_STRING , TYPE_U16_STRING , TYPE_U32_STRING #endif } arg_type; /* Polymorphic argument */ typedef struct { arg_type type; union { signed char a_schar; unsigned char a_uchar; short a_short; unsigned short a_ushort; int a_int; unsigned int a_uint; long int a_longint; unsigned long int a_ulongint; long long int a_longlongint; unsigned long long int a_ulonglongint; float a_float; double a_double; long double a_longdouble; int a_char; #if HAVE_WINT_T wint_t a_wide_char; #endif const char* a_string; #if HAVE_WCHAR_T const wchar_t* a_wide_string; #endif void* a_pointer; signed char * a_count_schar_pointer; short * a_count_short_pointer; int * a_count_int_pointer; long int * a_count_longint_pointer; long long int * a_count_longlongint_pointer; #if ENABLE_UNISTDIO /* The unistdio extensions. */ const uint8_t * a_u8_string; const uint16_t * a_u16_string; const uint32_t * a_u32_string; #endif } a; } argument; /* Number of directly allocated arguments (no malloc() needed). */ #define N_DIRECT_ALLOC_ARGUMENTS 7 typedef struct { size_t count; argument *arg; argument direct_alloc_arg[N_DIRECT_ALLOC_ARGUMENTS]; } arguments; /* Fetch the arguments, putting them into a. */ #ifdef STATIC STATIC #else extern #endif int PRINTF_FETCHARGS (va_list args, arguments *a); #endif /* _PRINTF_ARGS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sigsegv-catch-stackoverflow1.c�������������������������������0000664�0001750�0001750�00000007300�14670377436�025713� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test the stack overflow handler. Copyright (C) 2002-2021 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 2 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible and Eric Blake. */ #include <config.h> /* Specification. */ #include "sigsegv.h" #include <stdio.h> #include <limits.h> #if HAVE_STACK_OVERFLOW_RECOVERY # if defined _WIN32 && !defined __CYGWIN__ /* Windows doesn't have sigset_t. */ typedef int sigset_t; # define sigemptyset(set) # define sigprocmask(how,set,oldset) # endif # include <stddef.h> /* needed for NULL on SunOS4 */ # include <stdlib.h> /* for abort, exit */ # include <signal.h> # include <setjmp.h> # if HAVE_SETRLIMIT # include <sys/types.h> # include <sys/time.h> # include <sys/resource.h> # endif # include "altstack-util.h" static jmp_buf mainloop; static sigset_t mainsigset; static volatile int pass = 0; static volatile char *stack_lower_bound; static volatile char *stack_upper_bound; static void stackoverflow_handler_continuation (void *arg1, void *arg2, void *arg3) { int arg = (int) (long) arg1; longjmp (mainloop, arg); } static void stackoverflow_handler (int emergency, stackoverflow_context_t scp) { char dummy; volatile char *addr = &dummy; if (!(addr >= stack_lower_bound && addr <= stack_upper_bound)) abort (); pass++; printf ("Stack overflow %d caught.\n", pass); sigprocmask (SIG_SETMASK, &mainsigset, NULL); sigsegv_leave_handler (stackoverflow_handler_continuation, (void *) (long) (emergency ? -1 : pass), NULL, NULL); } static volatile int * recurse_1 (int n, volatile int *p) { if (n < INT_MAX) *recurse_1 (n + 1, p) += n; return p; } static int recurse (volatile int n) { return *recurse_1 (n, &n); } int main () { sigset_t emptyset; # if HAVE_SETRLIMIT && defined RLIMIT_STACK /* Before starting the endless recursion, try to be friendly to the user's machine. On some Linux 2.2.x systems, there is no stack limit for user processes at all. We don't want to kill such systems. */ struct rlimit rl; rl.rlim_cur = rl.rlim_max = 0x100000; /* 1 MB */ setrlimit (RLIMIT_STACK, &rl); # endif /* Prepare the storage for the alternate stack. */ prepare_alternate_stack (); /* Install the stack overflow handler. */ if (stackoverflow_install_handler (&stackoverflow_handler, mystack, MYSTACK_SIZE) < 0) exit (2); stack_lower_bound = mystack; stack_upper_bound = mystack + MYSTACK_SIZE - 1; /* Save the current signal mask. */ sigemptyset (&emptyset); sigprocmask (SIG_BLOCK, &emptyset, &mainsigset); /* Provoke two stack overflows in a row. */ switch (setjmp (mainloop)) { case -1: printf ("emergency exit\n"); exit (1); case 0: case 1: printf ("Starting recursion pass %d.\n", pass + 1); recurse (0); printf ("no endless recursion?!\n"); exit (1); case 2: break; default: abort (); } /* Validate that the alternate stack did not overflow. */ check_alternate_stack_no_overflow (); printf ("Test passed.\n"); exit (0); } #else int main () { return 77; } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-strerror_r.c�������������������������������������������������0000664�0001750�0001750�00000011464�14670377436�022425� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of strerror_r() function. Copyright (C) 2007-2021 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, 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <string.h> #include "signature.h" SIGNATURE_CHECK (strerror_r, int, (int, char *, size_t)); #include <errno.h> #include "macros.h" int main (void) { char buf[100]; int ret; /* Test results with valid errnum and enough room. */ errno = 0; buf[0] = '\0'; ASSERT (strerror_r (EACCES, buf, sizeof buf) == 0); ASSERT (buf[0] != '\0'); ASSERT (errno == 0); ASSERT (strlen (buf) < sizeof buf); errno = 0; buf[0] = '\0'; ASSERT (strerror_r (ETIMEDOUT, buf, sizeof buf) == 0); ASSERT (buf[0] != '\0'); ASSERT (errno == 0); ASSERT (strlen (buf) < sizeof buf); errno = 0; buf[0] = '\0'; ASSERT (strerror_r (EOVERFLOW, buf, sizeof buf) == 0); ASSERT (buf[0] != '\0'); ASSERT (errno == 0); ASSERT (strlen (buf) < sizeof buf); /* POSIX requires strerror (0) to succeed. Reject use of "Unknown error", but allow "Success", "No error", or even Solaris' "Error 0" which are distinct patterns from true out-of-range strings. http://austingroupbugs.net/view.php?id=382 */ errno = 0; buf[0] = '\0'; ret = strerror_r (0, buf, sizeof buf); ASSERT (ret == 0); ASSERT (buf[0]); ASSERT (errno == 0); ASSERT (strstr (buf, "nknown") == NULL); ASSERT (strstr (buf, "ndefined") == NULL); /* Test results with out-of-range errnum and enough room. POSIX allows an empty string on success, and allows an unchanged buf on error, but these are not useful, so we guarantee contents. */ errno = 0; buf[0] = '^'; ret = strerror_r (-3, buf, sizeof buf); ASSERT (ret == 0 || ret == EINVAL); ASSERT (buf[0] != '^'); ASSERT (*buf); ASSERT (errno == 0); ASSERT (strlen (buf) < sizeof buf); /* Test results with a too small buffer. POSIX requires an error; only ERANGE for 0 and valid errors, and a choice of ERANGE or EINVAL for out-of-range values. On error, POSIX permits buf to be empty, unchanged, or unterminated, but these are not useful, so we guarantee NUL-terminated truncated contents for all but size 0. http://austingroupbugs.net/view.php?id=398. Also ensure that no out-of-bounds writes occur. */ { int errs[] = { EACCES, 0, -3, }; int j; buf[sizeof buf - 1] = '\0'; for (j = 0; j < SIZEOF (errs); j++) { int err = errs[j]; char buf2[sizeof buf] = ""; size_t len; size_t i; strerror_r (err, buf2, sizeof buf2); len = strlen (buf2); ASSERT (len < sizeof buf); for (i = 0; i <= len; i++) { memset (buf, '^', sizeof buf - 1); errno = 0; ret = strerror_r (err, buf, i); ASSERT (errno == 0); if (j == 2) ASSERT (ret == ERANGE || ret == EINVAL); else ASSERT (ret == ERANGE); if (i) { ASSERT (strncmp (buf, buf2, i - 1) == 0); ASSERT (buf[i - 1] == '\0'); } ASSERT (strspn (buf + i, "^") == sizeof buf - 1 - i); } strcpy (buf, "BADFACE"); errno = 0; ret = strerror_r (err, buf, len + 1); ASSERT (ret != ERANGE); ASSERT (errno == 0); ASSERT (strcmp (buf, buf2) == 0); } } #if GNULIB_STRERROR /* Test that strerror_r does not clobber strerror buffer. On some platforms, this test can only succeed if gnulib also replaces strerror. */ { const char *msg1; const char *msg2; const char *msg3; const char *msg4; char *str1; char *str2; char *str3; char *str4; msg1 = strerror (ENOENT); ASSERT (msg1); str1 = strdup (msg1); ASSERT (str1); msg2 = strerror (ERANGE); ASSERT (msg2); str2 = strdup (msg2); ASSERT (str2); msg3 = strerror (-4); ASSERT (msg3); str3 = strdup (msg3); ASSERT (str3); msg4 = strerror (1729576); ASSERT (msg4); str4 = strdup (msg4); ASSERT (str4); strerror_r (EACCES, buf, sizeof buf); strerror_r (-5, buf, sizeof buf); ASSERT (STREQ (msg4, str4)); free (str1); free (str2); free (str3); free (str4); } #endif return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-select-out.sh������������������������������������������������0000775�0001750�0001750�00000001644�14670377436�022500� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test select() on file descriptors opened for writing. tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp" # Regular files. rm -f t-select-out.tmp ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > t-select-out.out test `cat t-select-out.tmp` = "1" || exit 1 # Pipes. if false; then # This test fails on some platforms. rm -f t-select-out.tmp ( { echo abc; ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | { sleep 1; cat; } ) > /dev/null test `cat t-select-out.tmp` = "0" || exit 1 fi rm -f t-select-out.tmp ( { sleep 1; echo abc; ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | cat) > /dev/null test `cat t-select-out.tmp` = "1" || exit 1 # Special files. rm -f t-select-out.tmp ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > /dev/null test `cat t-select-out.tmp` = "1" || exit 1 rm -fr $tmpfiles exit 0 ��������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcrtomb-w32-5.sh���������������������������������������������0000775�0001750�0001750�00000000133�14670377437�022635� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test a CP936 locale. ${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_China 936 �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-isatty.c�����������������������������������������������������0000664�0001750�0001750�00000004404�14670377436�021533� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test isatty() function. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (isatty, int, (int)); #include <errno.h> #include <fcntl.h> #include "macros.h" /* The name of the "always silent" device. */ #if defined _WIN32 && ! defined __CYGWIN__ /* Native Windows API. */ # define DEV_NULL "NUL" #else /* Unix API. */ # define DEV_NULL "/dev/null" #endif int main (void) { const char *file = "test-isatty.txt"; /* Test behaviour for invalid file descriptors. */ { errno = 0; ASSERT (isatty (-1) == 0); ASSERT (errno == EBADF || errno == 0 /* seen on IRIX 6.5, Solaris 10 */ ); } { close (99); errno = 0; ASSERT (isatty (99) == 0); ASSERT (errno == EBADF || errno == 0 /* seen on IRIX 6.5, Solaris 10 */ ); } /* Test behaviour for regular files. */ { int fd; fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644); ASSERT (0 <= fd); ASSERT (write (fd, "hello", 5) == 5); ASSERT (close (fd) == 0); fd = open (file, O_RDONLY); ASSERT (0 <= fd); ASSERT (! isatty (fd)); ASSERT (close (fd) == 0); } /* Test behaviour for pipes. */ { int fd[2]; ASSERT (pipe (fd) == 0); ASSERT (! isatty (fd[0])); ASSERT (! isatty (fd[1])); ASSERT (close (fd[0]) == 0); ASSERT (close (fd[1]) == 0); } /* Test behaviour for /dev/null. */ { int fd; fd = open (DEV_NULL, O_RDONLY); ASSERT (0 <= fd); ASSERT (! isatty (fd)); ASSERT (close (fd) == 0); } ASSERT (unlink (file) == 0); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-c-stack.c����������������������������������������������������0000664�0001750�0001750�00000003652�14670377436�021547� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of c-stack module. Copyright (C) 2002, 2004, 2006, 2008-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include "c-stack.h" #include "exitfail.h" #include <stdio.h> #if HAVE_SETRLIMIT /* At least FreeBSD 5.0 needs extra headers before <sys/resource.h> will compile. */ # include <sys/types.h> # include <sys/time.h> # include <sys/resource.h> #endif #include "macros.h" static volatile int * recurse_1 (volatile int n, volatile int *p) { if (n >= 0) *recurse_1 (n + 1, p) += n; return p; } static int recurse (volatile int n) { int sum = 0; return *recurse_1 (n, &sum); } int main (int argc, char **argv) { #if HAVE_SETRLIMIT && defined RLIMIT_STACK /* Before starting the endless recursion, try to be friendly to the user's machine. On some Linux 2.2.x systems, there is no stack limit for user processes at all. We don't want to kill such systems. */ struct rlimit rl; rl.rlim_cur = rl.rlim_max = 0x100000; /* 1 MB */ setrlimit (RLIMIT_STACK, &rl); #endif if (c_stack_action (NULL) == 0) { if (1 < argc) { exit_failure = 77; ++*argv[argc]; /* Intentionally dereference NULL. */ } return recurse (0); } fputs ("skipping test: ", stderr); perror ("c_stack_action"); return 77; } ��������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-setlocale2.sh������������������������������������������������0000775�0001750�0001750�00000001365�14670377436�022451� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test locale names with likely unsupported encoding in Unix syntax. for name in ar_SA.ISO-8859-1 fr_FR.CP1251 zh_TW.GB18030 zh_CN.BIG5; do env LC_ALL=$name ${CHECKER} ./test-setlocale2${EXEEXT} 1 || exit 1 done # Test locale names with likely unsupported encoding in native Windows syntax. for name in "Arabic_Saudi Arabia.1252" "Arabic_Saudi Arabia.65001" \ French_France.65001 Japanese_Japan.65001 Turkish_Turkey.65001 \ Chinese_Taiwan.65001 Chinese_China.54936 Chinese_China.65001; do # Here we use 'env' to set the LC_ALL environment variable, because on # Solaris 11.0, the /bin/sh refuses to do it for Turkish_Turkey.65001. env LC_ALL="$name" ${CHECKER} ./test-setlocale2${EXEEXT} 1 || exit 1 done exit 0 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-open.c�������������������������������������������������������0000664�0001750�0001750�00000002150�14670377436�021153� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of opening a file descriptor. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <fcntl.h> #include "signature.h" SIGNATURE_CHECK (open, int, (char const *, int, ...)); #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <unistd.h> #include "macros.h" #define BASE "test-open.t" #include "test-open.h" int main (void) { return test_open (open, true); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsrtowcs3.sh������������������������������������������������0000775�0001750�0001750�00000000575�14670377436�022524� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test whether a specific EUC-JP locale is installed. : ${LOCALE_JA=ja_JP} if test $LOCALE_JA = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no traditional japanese locale is installed" else echo "Skipping test: no traditional japanese locale is supported" fi exit 77 fi LC_ALL=$LOCALE_JA \ ${CHECKER} ./test-mbsrtowcs${EXEEXT} 3 �����������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/accept.c����������������������������������������������������������0000664�0001750�0001750�00000002562�14670377430�020475� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* accept.c --- wrappers for Windows accept function Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paolo Bonzini */ #include <config.h> #define WIN32_LEAN_AND_MEAN /* Get winsock2.h. */ #include <sys/socket.h> /* Get set_winsock_errno, FD_TO_SOCKET etc. */ #include "w32sock.h" #undef accept int rpl_accept (int fd, struct sockaddr *addr, socklen_t *addrlen) { SOCKET sock = FD_TO_SOCKET (fd); if (sock == INVALID_SOCKET) { errno = EBADF; return -1; } else { SOCKET fh = accept (sock, addr, addrlen); if (fh == INVALID_SOCKET) { set_winsock_errno (); return -1; } else return SOCKET_TO_FD (fh); } } ����������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-dirent.c�����������������������������������������������������0000664�0001750�0001750�00000001744�14670377436�021507� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <dirent.h> substitute. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <dirent.h> /* Check for existence of required types. */ static DIR *dir _GL_UNUSED; static struct dirent d; static ino_t i; int main (void) { return d.d_name[0] + i; } ����������������������������kbuild-3608/src/grep/gnulib-tests/test-iconv-h.c����������������������������������������������������0000664�0001750�0001750�00000001500�14670377436�021553� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <iconv.h> substitute. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #if HAVE_ICONV # include <iconv.h> #endif int main () { return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/thread-optim.h����������������������������������������������������0000664�0001750�0001750�00000004241�14670377436�021642� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Optimization of multithreaded code. Copyright (C) 2020-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2020. */ #ifndef _THREAD_OPTIM_H #define _THREAD_OPTIM_H /* This file defines a way to optimize multithreaded code for the single-thread case, based on the variable '__libc_single_threaded', defined in glibc >= 2.32. */ /* Typical use: In a block or function, use bool mt = gl_multithreaded (); ... if (mt) if (pthread_mutex_lock (&lock)) abort (); ... if (mt) if (pthread_mutex_unlock (&lock)) abort (); The gl_multithreaded () invocation determines whether the program currently is multithreaded. if (mt) STATEMENT executes STATEMENT in the multithreaded case, and skips it in the single-threaded case. The code between the gl_multithreaded () invocation and any use of the variable 'mt' must not create threads or invoke functions that may indirectly create threads (e.g. 'dlopen' may, indirectly through C++ initializers of global variables in the shared library being opened, create threads). The lock here is meant to synchronize threads in the same process. The same optimization cannot be applied to locks that synchronize different processes (e.g. through shared memory mappings). */ #if HAVE_SYS_SINGLE_THREADED_H /* glibc >= 2.32 */ # include <sys/single_threaded.h> # define gl_multithreaded() !__libc_single_threaded #else # define gl_multithreaded() 1 #endif #endif /* _THREAD_OPTIM_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/locale.c����������������������������������������������������������0000664�0001750�0001750�00000005051�14670377430�020471� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Program that prints the names of the categories of the current locale. Copyright (C) 2019-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2019. */ #include <config.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> /* We want to use the system's setlocale() function here, not the gnulib override. */ #undef setlocale /* Specification: <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/locale.html> Here we implement only the invocation without any command-line options. */ static const char * defaulted_getenv (const char *variable) { const char *value = getenv (variable); return (value != NULL ? value : ""); } static void print_category (int category, const char *variable) { const char *value = defaulted_getenv (variable); if (value[0] != '\0' && defaulted_getenv ("LC_ALL")[0] == '\0') /* The variable is set in the environment and not overridden by LC_ALL. */ printf ("%s=%s\n", variable, value); else printf ("%s=\"%s\"\n", variable, setlocale (category, NULL)); } int main (void) { setlocale (LC_ALL, ""); printf ("LANG=%s\n", defaulted_getenv ("LANG")); print_category (LC_CTYPE, "LC_CTYPE"); print_category (LC_NUMERIC, "LC_NUMERIC"); print_category (LC_TIME, "LC_TIME"); print_category (LC_COLLATE, "LC_COLLATE"); print_category (LC_MONETARY, "LC_MONETARY"); print_category (LC_MESSAGES, "LC_MESSAGES"); #ifdef LC_PAPER print_category (LC_PAPER, "LC_PAPER"); #endif #ifdef LC_NAME print_category (LC_NAME, "LC_NAME"); #endif #ifdef LC_ADDRESS print_category (LC_ADDRESS, "LC_ADDRESS"); #endif #ifdef LC_TELEPHONE print_category (LC_TELEPHONE, "LC_TELEPHONE"); #endif #ifdef LC_MEASUREMENT print_category (LC_MEASUREMENT, "LC_MEASUREMENT"); #endif #ifdef LC_IDENTIFICATION print_category (LC_IDENTIFICATION, "LC_IDENTIFICATION"); #endif printf ("LC_ALL=%s\n", defaulted_getenv ("LC_ALL")); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-init.sh������������������������������������������������������0000775�0001750�0001750�00000004634�14670377436�021361� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Unit tests for init.sh # Copyright (C) 2011-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. */ : ${srcdir=.} . "$srcdir/init.sh"; path_prepend_ . fail=0 test_compare() { touch empty || fail=1 echo xyz > in || fail=1 compare /dev/null /dev/null >out 2>err || fail=1 test -s out && fail_ "out not empty: $(cat out)" # "err" should be empty, too, but has "set -x" output when VERBOSE=yes case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac compare /dev/null empty >out 2>err || fail=1 test -s out && fail_ "out not empty: $(cat out)" case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac compare in in >out 2>err || fail=1 test -s out && fail_ "out not empty: $(cat out)" case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac compare /dev/null in >out 2>err && fail=1 cat <<\EOF > exp diff -u /dev/null in --- /dev/null 1970-01-01 +++ in 1970-01-01 +xyz EOF compare exp out || fail=1 case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac compare empty in >out 2>err && fail=1 # Compare against expected output only if compare is using diff -u. if grep @ out >/dev/null; then # Remove the TAB-date suffix on each --- and +++ line, # for both the expected and the actual output files. # Also remove the @@ line, since Solaris 5.10 and GNU diff formats differ: # -@@ -0,0 +1 @@ # +@@ -1,0 +1,1 @@ # Also, remove space after leading '+', since AIX 7.1 diff outputs a space. sed 's/ .*//;/^@@/d;s/^+ /+/' out > k && mv k out cat <<\EOF > exp --- empty +++ in +xyz EOF compare exp out || fail=1 fi case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac } test_compare Exit $fail ����������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/offtostr.c��������������������������������������������������������0000664�0001750�0001750�00000001513�14670377430�021077� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Convert 'off_t' integer to printable string. Copyright (C) 2004-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #define anytostr offtostr #define inttype off_t #include "anytostr.c" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-regex.c������������������������������������������������������0000664�0001750�0001750�00000042726�14670377436�021341� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test regular expressions Copyright 1996-2001, 2003-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include "regex.h" #include <locale.h> #include <limits.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <wctype.h> #if HAVE_DECL_ALARM # include <unistd.h> # include <signal.h> #endif #include "localcharset.h" static int exit_status; static void report_error (char const *format, ...) { va_list args; va_start (args, format); fprintf (stderr, "test-regex: "); vfprintf (stderr, format, args); fprintf (stderr, "\n"); va_end (args); exit_status = 1; } /* Check whether it's really a UTF-8 locale. On mingw, setlocale (LC_ALL, "en_US.UTF-8") succeeds but returns "English_United States.1252", with locale_charset () returning "CP1252". */ static int really_utf8 (void) { return strcmp (locale_charset (), "UTF-8") == 0; } /* Tests supposed to match; copied from glibc posix/bug-regex11.c. */ static struct { const char *pattern; const char *string; int flags, nmatch; regmatch_t rm[5]; } const tests[] = { /* Test for newline handling in regex. */ { "[^~]*~", "\nx~y", 0, 2, { { 0, 3 }, { -1, -1 } } }, /* Other tests. */ { "a(.*)b", "a b", REG_EXTENDED, 2, { { 0, 3 }, { 1, 2 } } }, { ".*|\\([KIO]\\)\\([^|]*\\).*|?[KIO]", "10~.~|P|K0|I10|O16|?KSb", 0, 3, { { 0, 21 }, { 15, 16 }, { 16, 18 } } }, { ".*|\\([KIO]\\)\\([^|]*\\).*|?\\1", "10~.~|P|K0|I10|O16|?KSb", 0, 3, { { 0, 21 }, { 8, 9 }, { 9, 10 } } }, { "^\\(a*\\)\\1\\{9\\}\\(a\\{0,9\\}\\)\\([0-9]*;.*[^a]\\2\\([0-9]\\)\\)", "a1;;0a1aa2aaa3aaaa4aaaaa5aaaaaa6aaaaaaa7aaaaaaaa8aaaaaaaaa9aa2aa1a0", 0, 5, { { 0, 67 }, { 0, 0 }, { 0, 1 }, { 1, 67 }, { 66, 67 } } }, /* Test for BRE expression anchoring. POSIX says just that this may match; in glibc regex it always matched, so avoid changing it. */ { "\\(^\\|foo\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } }, { "\\(foo\\|^\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } }, /* In ERE this must be treated as an anchor. */ { "(^|foo)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } }, { "(foo|^)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } }, /* Here ^ cannot be treated as an anchor according to POSIX. */ { "(^|foo)bar", "(^|foo)bar", 0, 2, { { 0, 10 }, { -1, -1 } } }, { "(foo|^)bar", "(foo|^)bar", 0, 2, { { 0, 10 }, { -1, -1 } } }, /* More tests on backreferences. */ { "()\\1", "x", REG_EXTENDED, 2, { { 0, 0 }, { 0, 0 } } }, { "()x\\1", "x", REG_EXTENDED, 2, { { 0, 1 }, { 0, 0 } } }, { "()\\1*\\1*", "", REG_EXTENDED, 2, { { 0, 0 }, { 0, 0 } } }, { "([0-9]).*\\1(a*)", "7;7a6", REG_EXTENDED, 3, { { 0, 4 }, { 0, 1 }, { 3, 4 } } }, { "([0-9]).*\\1(a*)", "7;7a", REG_EXTENDED, 3, { { 0, 4 }, { 0, 1 }, { 3, 4 } } }, { "(b)()c\\1", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 1 }, { 1, 1 } } }, { "()(b)c\\2", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 0 }, { 0, 1 } } }, { "a(b)()c\\1", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 2 }, { 2, 2 } } }, { "a()(b)c\\2", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 1 }, { 1, 2 } } }, { "()(b)\\1c\\2", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 0 }, { 0, 1 } } }, { "(b())\\2\\1", "bbbb", REG_EXTENDED, 3, { { 0, 2 }, { 0, 1 }, { 1, 1 } } }, { "a()(b)\\1c\\2", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 1 }, { 1, 2 } } }, { "a()d(b)\\1c\\2", "adbcb", REG_EXTENDED, 3, { { 0, 5 }, { 1, 1 }, { 2, 3 } } }, { "a(b())\\2\\1", "abbbb", REG_EXTENDED, 3, { { 0, 3 }, { 1, 2 }, { 2, 2 } } }, { "(bb())\\2\\1", "bbbb", REG_EXTENDED, 3, { { 0, 4 }, { 0, 2 }, { 2, 2 } } }, { "^([^,]*),\\1,\\1$", "a,a,a", REG_EXTENDED, 2, { { 0, 5 }, { 0, 1 } } }, { "^([^,]*),\\1,\\1$", "ab,ab,ab", REG_EXTENDED, 2, { { 0, 8 }, { 0, 2 } } }, { "^([^,]*),\\1,\\1,\\1$", "abc,abc,abc,abc", REG_EXTENDED, 2, { { 0, 15 }, { 0, 3 } } }, { "^(.?)(.?)(.?)(.?)(.?).?\\5\\4\\3\\2\\1$", "level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } }, { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$|^.?$", "level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } }, { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$|^.?$", "abcdedcba", REG_EXTENDED, 1, { { 0, 9 } } }, { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$|^.?$", "ababababa", REG_EXTENDED, 1, { { 0, 9 } } }, { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$", "level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } }, { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$", "ababababa", REG_EXTENDED, 1, { { 0, 9 } } }, /* Test for *+ match. */ { "^a*+(.)", "ab", REG_EXTENDED, 2, { { 0, 2 }, { 1, 2 } } }, /* Test for ** match. */ { "^(a*)*(.)", "ab", REG_EXTENDED, 3, { { 0, 2 }, { 0, 1 }, { 1, 2 } } }, }; static void bug_regex11 (void) { regex_t re; regmatch_t rm[5]; size_t i; int n; for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) { n = regcomp (&re, tests[i].pattern, tests[i].flags); if (n != 0) { char buf[500]; regerror (n, &re, buf, sizeof (buf)); report_error ("%s: regcomp %zd failed: %s", tests[i].pattern, i, buf); continue; } if (regexec (&re, tests[i].string, tests[i].nmatch, rm, 0)) { report_error ("%s: regexec %zd failed", tests[i].pattern, i); regfree (&re); continue; } for (n = 0; n < tests[i].nmatch; ++n) if (rm[n].rm_so != tests[i].rm[n].rm_so || rm[n].rm_eo != tests[i].rm[n].rm_eo) { if (tests[i].rm[n].rm_so == -1 && tests[i].rm[n].rm_eo == -1) break; report_error ("%s: regexec %zd match failure rm[%d] %d..%d", tests[i].pattern, i, n, (int) rm[n].rm_so, (int) rm[n].rm_eo); break; } regfree (&re); } } int main (void) { static struct re_pattern_buffer regex; unsigned char folded_chars[UCHAR_MAX + 1]; int i; const char *s; struct re_registers regs; #if HAVE_DECL_ALARM /* In case a bug causes glibc to go into an infinite loop. The tests should take less than 10 s on a reasonably modern CPU. */ int alarm_value = 1000; signal (SIGALRM, SIG_DFL); alarm (alarm_value); #endif bug_regex11 (); if (setlocale (LC_ALL, "en_US.UTF-8")) { { /* https://sourceware.org/ml/libc-hacker/2006-09/msg00008.html This test needs valgrind to catch the bug on Debian GNU/Linux 3.1 x86, but it might catch the bug better on other platforms and it shouldn't hurt to try the test here. */ static char const pat[] = "insert into"; static char const data[] = "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE | RE_ICASE); memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) report_error ("%s: %s", pat, s); else { memset (®s, 0, sizeof regs); i = re_search (®ex, data, sizeof data - 1, 0, sizeof data - 1, ®s); if (i != -1) report_error ("re_search '%s' on '%s' returned %d", pat, data, i); regfree (®ex); free (regs.start); free (regs.end); } } if (really_utf8 ()) { /* This test is from glibc bug 15078. The test case is from Andreas Schwab in <https://sourceware.org/ml/libc-alpha/2013-01/msg00967.html>. */ static char const pat[] = "[^x]x"; static char const data[] = /* <U1000><U103B><U103D><U1014><U103A><U102F><U1015><U103A> */ "\xe1\x80\x80" "\xe1\x80\xbb" "\xe1\x80\xbd" "\xe1\x80\x94" "\xe1\x80\xba" "\xe1\x80\xaf" "\xe1\x80\x95" "\xe1\x80\xba" "x"; re_set_syntax (0); memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) report_error ("%s: %s", pat, s); else { memset (®s, 0, sizeof regs); i = re_search (®ex, data, sizeof data - 1, 0, sizeof data - 1, 0); if (i != 0 && i != 21) report_error ("re_search '%s' on '%s' returned %d", pat, data, i); regfree (®ex); free (regs.start); free (regs.end); } } if (! setlocale (LC_ALL, "C")) { report_error ("setlocale \"C\" failed"); return exit_status; } } if (setlocale (LC_ALL, "tr_TR.UTF-8")) { if (really_utf8 () && towupper (L'i') == 0x0130 /* U+0130; see below. */) { re_set_syntax (RE_SYNTAX_GREP | RE_ICASE); memset (®ex, 0, sizeof regex); static char const pat[] = "i"; s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) report_error ("%s: %s", pat, s); else { /* UTF-8 encoding of U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE. In Turkish, this is the upper-case equivalent of ASCII "i". Older versions of Gnulib failed to match "i" to U+0130 when ignoring case in Turkish <https://bugs.gnu.org/43577>. */ static char const data[] = "\xc4\xb0"; memset (®s, 0, sizeof regs); i = re_search (®ex, data, sizeof data - 1, 0, sizeof data - 1, ®s); if (i != 0) report_error ("re_search '%s' on '%s' returned %d", pat, data, i); regfree (®ex); free (regs.start); free (regs.end); } } if (! setlocale (LC_ALL, "C")) { report_error ("setlocale \"C\" failed"); return exit_status; } } /* This test is from glibc bug 3957, reported by Andrew Mackey. */ re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); memset (®ex, 0, sizeof regex); static char const pat_3957[] = "a[^x]b"; s = re_compile_pattern (pat_3957, sizeof pat_3957 - 1, ®ex); if (s) report_error ("%s: %s", pat_3957, s); else { /* This should fail, but succeeds for glibc-2.5. */ memset (®s, 0, sizeof regs); static char const data[] = "a\nb"; i = re_search (®ex, data, sizeof data - 1, 0, sizeof data - 1, ®s); if (i != -1) report_error ("re_search '%s' on '%s' returned %d", pat_3957, data, i); regfree (®ex); free (regs.start); free (regs.end); } /* This regular expression is from Spencer ere test number 75 in grep-2.3. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof regex); for (i = 0; i <= UCHAR_MAX; i++) folded_chars[i] = i; regex.translate = folded_chars; static char const pat75[] = "a[[:@:>@:]]b\n"; s = re_compile_pattern (pat75, sizeof pat75 - 1, ®ex); /* This should fail with _Invalid character class name_ error. */ if (!s) { report_error ("re_compile_pattern: failed to reject '%s'", pat75); regfree (®ex); } /* Ensure that [b-a] is diagnosed as invalid, when using RE_NO_EMPTY_RANGES. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES); memset (®ex, 0, sizeof regex); static char const pat_b_a[] = "a[b-a]"; s = re_compile_pattern (pat_b_a, sizeof pat_b_a - 1, ®ex); if (s == 0) { report_error ("re_compile_pattern: failed to reject '%s'", pat_b_a); regfree (®ex); } /* This should succeed, but does not for glibc-2.1.3. */ memset (®ex, 0, sizeof regex); static char const pat_213[] = "{1"; s = re_compile_pattern (pat_213, sizeof pat_213 - 1, ®ex); if (s) report_error ("%s: %s", pat_213, s); else regfree (®ex); /* The following example is derived from a problem report against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ memset (®ex, 0, sizeof regex); static char const pat_stolfi[] = "[an\371]*n"; s = re_compile_pattern (pat_stolfi, sizeof pat_stolfi - 1, ®ex); if (s) report_error ("%s: %s", pat_stolfi, s); /* This should match, but does not for glibc-2.2.1. */ else { memset (®s, 0, sizeof regs); static char const data[] = "an"; i = re_match (®ex, data, sizeof data - 1, 0, ®s); if (i != 2) report_error ("re_match '%s' on '%s' at 2 returned %d", pat_stolfi, data, i); regfree (®ex); free (regs.start); free (regs.end); } memset (®ex, 0, sizeof regex); static char const pat_x[] = "x"; s = re_compile_pattern (pat_x, sizeof pat_x - 1, ®ex); if (s) report_error ("%s: %s", pat_x, s); /* glibc-2.2.93 does not work with a negative RANGE argument. */ else { memset (®s, 0, sizeof regs); static char const data[] = "wxy"; i = re_search (®ex, data, sizeof data - 1, 2, -2, ®s); if (i != 1) report_error ("re_search '%s' on '%s' returned %d", pat_x, data, i); regfree (®ex); free (regs.start); free (regs.end); } /* The version of regex.c in older versions of gnulib ignored RE_ICASE. Detect that problem too. */ re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat_x, 1, ®ex); if (s) report_error ("%s: %s", pat_x, s); else { memset (®s, 0, sizeof regs); static char const data[] = "WXY"; i = re_search (®ex, data, sizeof data - 1, 0, 3, ®s); if (i < 0) report_error ("re_search '%s' on '%s' returned %d", pat_x, data, i); regfree (®ex); free (regs.start); free (regs.end); } /* glibc bug 11053. */ re_set_syntax (RE_SYNTAX_POSIX_BASIC); memset (®ex, 0, sizeof regex); static char const pat_sub2[] = "\\(a*\\)*a*\\1"; s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, ®ex); if (s) report_error ("%s: %s", pat_sub2, s); else { memset (®s, 0, sizeof regs); static char const data[] = "a"; int datalen = sizeof data - 1; i = re_search (®ex, data, datalen, 0, datalen, ®s); if (i != 0) report_error ("re_search '%s' on '%s' returned %d", pat_sub2, data, i); else if (regs.num_regs < 2) report_error ("re_search '%s' on '%s' returned only %d registers", pat_sub2, data, (int) regs.num_regs); else if (! (regs.start[0] == 0 && regs.end[0] == 1)) report_error ("re_search '%s' on '%s' returned wrong match [%d,%d)", pat_sub2, data, (int) regs.start[0], (int) regs.end[0]); else if (! (regs.start[1] == 0 && regs.end[1] == 0)) report_error ("re_search '%s' on '%s' returned wrong submatch [%d,%d)", pat_sub2, data, (int) regs.start[1], (int) regs.end[1]); regfree (®ex); free (regs.start); free (regs.end); } /* Catch a bug reported by Vin Shelton in https://lists.gnu.org/r/bug-coreutils/2007-06/msg00089.html */ re_set_syntax (RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES); static char const pat_shelton[] = "[[:alnum:]_-]\\\\+$"; s = re_compile_pattern (pat_shelton, sizeof pat_shelton - 1, ®ex); if (s) report_error ("%s: %s", pat_shelton, s); else regfree (®ex); /* REG_STARTEND was added to glibc on 2004-01-15. Reject older versions. */ if (REG_STARTEND == 0) report_error ("REG_STARTEND is zero"); /* Matching with the compiled form of this regexp would provoke an assertion failure prior to glibc-2.28: regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed With glibc-2.28, compilation fails and reports the invalid back reference. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof regex); static char const pat_badback[] = "0|()0|\\1|0"; s = re_compile_pattern (pat_badback, sizeof pat_badback, ®ex); if (!s && re_search (®ex, "x", 1, 0, 1, ®s) != -1) s = "mishandled invalid back reference"; if (s && strcmp (s, "Invalid back reference") != 0) report_error ("%s: %s", pat_badback, s); #if 0 /* It would be nice to reject hosts whose regoff_t values are too narrow (including glibc on hosts with 64-bit ptrdiff_t and 32-bit int), but we should wait until glibc implements this feature. Otherwise, support for equivalence classes and multibyte collation symbols would always be broken except when compiling --without-included-regex. */ if (sizeof (regoff_t) < sizeof (ptrdiff_t) || sizeof (regoff_t) < sizeof (ssize_t)) report_error ("regoff_t values are too narrow"); #endif return exit_status; } ������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-striconv.c���������������������������������������������������0000664�0001750�0001750�00000014215�14670377436�022066� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of character set conversion. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include "striconv.h" #if HAVE_ICONV # include <iconv.h> #endif #include <errno.h> #include <stdlib.h> #include <string.h> #include "macros.h" int main () { #if HAVE_ICONV /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1, and UTF-8. */ iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8"); ASSERT (cd_88591_to_utf8 != (iconv_t)(-1)); ASSERT (cd_utf8_to_88591 != (iconv_t)(-1)); /* ------------------------- Test mem_cd_iconv() ------------------------- */ /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ { static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; char *result = NULL; size_t length = 0; int retval = mem_cd_iconv (input, strlen (input), cd_88591_to_utf8, &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); free (result); } /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ { static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char *result = NULL; size_t length = 0; int retval = mem_cd_iconv (input, strlen (input), cd_utf8_to_88591, &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); free (result); } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ { static const char input[] = "\342\202\254"; /* EURO SIGN */ char *result = NULL; size_t length = 0; int retval = mem_cd_iconv (input, strlen (input), cd_utf8_to_88591, &result, &length); ASSERT (retval == -1 && errno == EILSEQ); ASSERT (result == NULL); } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ { static const char input[] = "\342"; char *result = NULL; size_t length = 0; int retval = mem_cd_iconv (input, strlen (input), cd_utf8_to_88591, &result, &length); ASSERT (retval == 0); ASSERT (length == 0); free (result); } /* ------------------------- Test str_cd_iconv() ------------------------- */ /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ { static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; char *result = str_cd_iconv (input, cd_88591_to_utf8); ASSERT (result != NULL); ASSERT (strcmp (result, expected) == 0); free (result); } /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ { static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char *result = str_cd_iconv (input, cd_utf8_to_88591); ASSERT (result != NULL); ASSERT (strcmp (result, expected) == 0); free (result); } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ { static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */ char *result = str_cd_iconv (input, cd_utf8_to_88591); ASSERT (result == NULL && errno == EILSEQ); } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ { static const char input[] = "\342"; char *result = str_cd_iconv (input, cd_utf8_to_88591); ASSERT (result != NULL); ASSERT (strcmp (result, "") == 0); free (result); } iconv_close (cd_88591_to_utf8); iconv_close (cd_utf8_to_88591); /* -------------------------- Test str_iconv() -------------------------- */ /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ { static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; char *result = str_iconv (input, "ISO-8859-1", "UTF-8"); ASSERT (result != NULL); ASSERT (strcmp (result, expected) == 0); free (result); } /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ { static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char *result = str_iconv (input, "UTF-8", "ISO-8859-1"); ASSERT (result != NULL); ASSERT (strcmp (result, expected) == 0); free (result); } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ { static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */ char *result = str_iconv (input, "UTF-8", "ISO-8859-1"); ASSERT (result == NULL && errno == EILSEQ); } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ { static const char input[] = "\342"; char *result = str_iconv (input, "UTF-8", "ISO-8859-1"); ASSERT (result != NULL); ASSERT (strcmp (result, "") == 0); free (result); } #endif return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-select-stdin.c�����������������������������������������������0000664�0001750�0001750�00000004333�14670377436�022615� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of select() substitute, reading from stdin. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include <stdio.h> #include <stdlib.h> #include <sys/select.h> #include <sys/time.h> #include <unistd.h> #include "macros.h" int main (void) { printf ("Applying select() from standard input. Press Ctrl-C to abort.\n"); for (;;) { struct timeval before; struct timeval after; unsigned long spent_usec; fd_set readfds; struct timeval timeout; int ret; gettimeofday (&before, NULL); FD_ZERO (&readfds); FD_SET (0, &readfds); timeout.tv_sec = 0; timeout.tv_usec = 500000; ret = select (1, &readfds, NULL, NULL, &timeout); gettimeofday (&after, NULL); spent_usec = (after.tv_sec - before.tv_sec) * 1000000 + after.tv_usec - before.tv_usec; if (ret < 0) { perror ("select failed"); exit (1); } if ((ret == 0) != ! FD_ISSET (0, &readfds)) { fprintf (stderr, "incorrect return value\n"); exit (1); } if (ret == 0) { if (spent_usec < 250000) { fprintf (stderr, "returned too early\n"); exit (1); } /* Timeout */ printf ("."); ASSERT (fflush (stdout) == 0); } else { char c; printf ("Input available! Trying to read 1 byte...\n"); ASSERT (read (0, &c, 1) == 1); } } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sys_wait.h���������������������������������������������������0000664�0001750�0001750�00000003616�14670377437�022072� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of macros shared between <sys/wait.h> and <stdlib.h>. Copyright (C) 2010-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2010. */ static int test_sys_wait_macros (void) { /* Check subset of <sys/wait.h> macros that must be visible here. Note that some of these macros are only portable when operating on an lvalue. */ int i; for (i = 0; i < 0x8000; i = (i ? i << 1 : 1)) { /* POSIX requires that for all valid process statuses, that exactly one of these three macros is true. But not all possible 16-bit values map to valid process status. Traditionally, 8 of the bits are for WIFEXITED, 7 of the bits to tell between WIFSIGNALED and WIFSTOPPED, and either 0x80 or 0x8000 to flag that core was also dumped. Since we don't know which byte is WIFEXITED, we skip the both possible bits that can signal core dump. */ if (i == 0x80) continue; if (!!WIFSIGNALED (i) + !!WIFEXITED (i) + !!WIFSTOPPED (i) != 1) return 1; } i = WEXITSTATUS (i) + WSTOPSIG (i) + WTERMSIG (i); switch (i) { #if 0 /* Gnulib doesn't guarantee these, yet. */ case WNOHANG: case WUNTRACED: #endif break; } return 0; } ������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-i-ring.c�����������������������������������������������������0000664�0001750�0001750�00000003045�14670377436�021403� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test the simple ring buffer. Copyright (C) 2006-2021 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 <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ #include <config.h> #include "i-ring.h" #include "macros.h" int main (void) { int o; I_ring ir; i_ring_init (&ir, -1); o = i_ring_push (&ir, 1); ASSERT (o == -1); o = i_ring_push (&ir, 2); ASSERT (o == -1); o = i_ring_push (&ir, 3); ASSERT (o == -1); o = i_ring_push (&ir, 4); ASSERT (o == -1); o = i_ring_push (&ir, 5); ASSERT (o == 1); o = i_ring_push (&ir, 6); ASSERT (o == 2); o = i_ring_push (&ir, 7); ASSERT (o == 3); o = i_ring_pop (&ir); ASSERT (o == 7); o = i_ring_pop (&ir); ASSERT (o == 6); o = i_ring_pop (&ir); ASSERT (o == 5); o = i_ring_pop (&ir); ASSERT (o == 4); ASSERT (i_ring_empty (&ir)); o = i_ring_push (&ir, 8); ASSERT (o == -1); o = i_ring_pop (&ir); ASSERT (o == 8); ASSERT (i_ring_empty (&ir)); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-netinet_in.c�������������������������������������������������0000664�0001750�0001750�00000001566�14670377436�022360� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <netinet/in.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <netinet/in.h> int main (void) { return 0; } ������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fcntl-h.c����������������������������������������������������0000664�0001750�0001750�00000005543�14670377431�021551� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <fcntl.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <fcntl.h> /* Check that the various O_* macros are defined. */ int o = (O_DIRECT | O_DIRECTORY | O_DSYNC | O_IGNORE_CTTY | O_NDELAY | O_NOATIME | O_NONBLOCK | O_NOCTTY | O_NOFOLLOW | O_NOLINK | O_NOLINKS | O_NOTRANS | O_RSYNC | O_SYNC | O_TTY_INIT | O_BINARY | O_TEXT); /* Check that the various SEEK_* macros are defined. */ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; /* Check that the FD_* macros are defined. */ int i = FD_CLOEXEC; /* Check that the types are all defined. */ pid_t t1; off_t t2; mode_t t3; int main (void) { /* Ensure no overlap in SEEK_*. */ switch (0) { case SEEK_CUR: case SEEK_END: case SEEK_SET: ; } /* Ensure no dangerous overlap in non-zero gnulib-defined replacements. */ switch (O_RDONLY) { /* Access modes */ case O_RDONLY: case O_WRONLY: case O_RDWR: #if O_EXEC && O_EXEC != O_RDONLY case O_EXEC: #endif #if O_SEARCH && O_EXEC != O_SEARCH && O_SEARCH != O_RDONLY case O_SEARCH: #endif i = ! (~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)); break; /* Everyone should have these */ case O_CREAT: case O_EXCL: case O_TRUNC: case O_APPEND: break; /* These might be 0 or O_RDONLY, only test non-zero versions. */ #if O_CLOEXEC case O_CLOEXEC: #endif #if O_DIRECT case O_DIRECT: #endif #if O_DIRECTORY case O_DIRECTORY: #endif #if O_DSYNC case O_DSYNC: #endif #if O_IGNORE_CTTY case O_IGNORE_CTTY: #endif #if O_NOATIME case O_NOATIME: #endif #if O_NONBLOCK case O_NONBLOCK: #endif #if O_NOCTTY case O_NOCTTY: #endif #if O_NOFOLLOW case O_NOFOLLOW: #endif #if O_NOLINK case O_NOLINK: #endif #if O_NOLINKS case O_NOLINKS: #endif #if O_NOTRANS case O_NOTRANS: #endif #if O_RSYNC && O_RSYNC != O_DSYNC case O_RSYNC: #endif #if O_SYNC && O_SYNC != O_DSYNC && O_SYNC != O_RSYNC case O_SYNC: #endif #if O_TTY_INIT case O_TTY_INIT: #endif #if O_BINARY case O_BINARY: #endif #if O_TEXT case O_TEXT: #endif ; } return !i; } �������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sys_types.c��������������������������������������������������0000664�0001750�0001750�00000001722�14670377436�022260� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <sys/types.h> substitute. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2011. */ #include <config.h> #include <sys/types.h> /* Check that the types are all defined. */ pid_t t1; size_t t2; ssize_t t3; off_t t4; mode_t t5; int main (void) { return 0; } ����������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-c-ctype.c����������������������������������������������������0000664�0001750�0001750�00000014644�14670377431�021564� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of character handling in C locale. Copyright (C) 2005, 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. */ #include <config.h> #include "c-ctype.h" #include <ctype.h> #include <limits.h> #include <locale.h> #include "macros.h" static void test_agree_with_C_locale (void) { int c; for (c = 0; c <= UCHAR_MAX; c++) { ASSERT (c_isascii (c) == (isascii (c) != 0)); if (c_isascii (c)) { ASSERT (c_isalnum (c) == (isalnum (c) != 0)); ASSERT (c_isalpha (c) == (isalpha (c) != 0)); ASSERT (c_isblank (c) == (isblank (c) != 0)); ASSERT (c_iscntrl (c) == (iscntrl (c) != 0)); ASSERT (c_isdigit (c) == (isdigit (c) != 0)); ASSERT (c_islower (c) == (islower (c) != 0)); ASSERT (c_isgraph (c) == (isgraph (c) != 0)); ASSERT (c_isprint (c) == (isprint (c) != 0)); ASSERT (c_ispunct (c) == (ispunct (c) != 0)); ASSERT (c_isspace (c) == (isspace (c) != 0)); ASSERT (c_isupper (c) == (isupper (c) != 0)); ASSERT (c_isxdigit (c) == (isxdigit (c) != 0)); ASSERT (c_tolower (c) == tolower (c)); ASSERT (c_toupper (c) == toupper (c)); } } } static void test_all (void) { int c; int n_isascii = 0; for (c = CHAR_MIN; c <= UCHAR_MAX; c++) { if (! (0 <= c && c <= CHAR_MAX)) { ASSERT (! c_isascii (c)); ASSERT (! c_isalnum (c)); ASSERT (! c_isalpha (c)); ASSERT (! c_isblank (c)); ASSERT (! c_iscntrl (c)); ASSERT (! c_isdigit (c)); ASSERT (! c_islower (c)); ASSERT (! c_isgraph (c)); ASSERT (! c_isprint (c)); ASSERT (! c_ispunct (c)); ASSERT (! c_isspace (c)); ASSERT (! c_isupper (c)); ASSERT (! c_isxdigit (c)); ASSERT (c_tolower (c) == c); ASSERT (c_toupper (c) == c); } n_isascii += c_isascii (c); #ifdef C_CTYPE_ASCII ASSERT (c_isascii (c) == (0 <= c && c <= 0x7f)); #endif ASSERT (c_isascii (c) == (c_isprint (c) || c_iscntrl (c))); ASSERT (c_isalnum (c) == (c_isalpha (c) || c_isdigit (c))); ASSERT (c_isalpha (c) == (c_islower (c) || c_isupper (c))); switch (c) { case '\t': case ' ': ASSERT (c_isblank (c) == 1); break; default: ASSERT (c_isblank (c) == 0); break; } #ifdef C_CTYPE_ASCII ASSERT (c_iscntrl (c) == ((c >= 0 && c < 0x20) || c == 0x7f)); #endif switch (c) { case '\a': case '\b': case '\f': case '\n': case '\r': case '\t': case '\v': ASSERT (c_iscntrl (c)); break; } ASSERT (! (c_iscntrl (c) && c_isprint (c))); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': ASSERT (c_isdigit (c) == 1); break; default: ASSERT (c_isdigit (c) == 0); break; } switch (c) { 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': ASSERT (c_islower (c) == 1); ASSERT (c_toupper (c) == c - 'a' + 'A'); break; default: ASSERT (c_islower (c) == 0); ASSERT (c_toupper (c) == c); break; } #ifdef C_CTYPE_ASCII ASSERT (c_isgraph (c) == ((c >= 0x20 && c < 0x7f) && c != ' ')); ASSERT (c_isprint (c) == (c >= 0x20 && c < 0x7f)); #endif ASSERT (c_isgraph (c) == (c_isalnum (c) || c_ispunct (c))); ASSERT (c_isprint (c) == (c_isgraph (c) || c == ' ')); switch (c) { case '!': case '"': case '#': case '$': case '%': case '&': case '\'': case '(': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case ':': case ';': case '<': case '=': case '>': case '?': case '@': case '[': case'\\': case ']': case '^': case '_': case '`': case '{': case '|': case '}': case '~': ASSERT (c_ispunct (c) == 1); break; default: ASSERT (c_ispunct (c) == 0); break; } switch (c) { case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': ASSERT (c_isspace (c) == 1); break; default: ASSERT (c_isspace (c) == 0); break; } switch (c) { 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': ASSERT (c_isupper (c) == 1); ASSERT (c_tolower (c) == c - 'A' + 'a'); break; default: ASSERT (c_isupper (c) == 0); ASSERT (c_tolower (c) == c); break; } switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': ASSERT (c_isxdigit (c) == 1); break; default: ASSERT (c_isxdigit (c) == 0); break; } } ASSERT (n_isascii == 128); } int main () { test_agree_with_C_locale (); test_all (); setlocale (LC_ALL, "de_DE"); test_all (); setlocale (LC_ALL, "ja_JP.EUC-JP"); test_all (); return 0; } ��������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sigaction.c��������������������������������������������������0000664�0001750�0001750�00000006775�14670377436�022213� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of sigaction() function. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2008. */ #include <config.h> #include <signal.h> #include "signature.h" SIGNATURE_CHECK (sigaction, int, (int, struct sigaction const *, struct sigaction *)); #include <stddef.h> #include "macros.h" #ifndef SA_NOCLDSTOP # define SA_NOCLDSTOP 0 #endif #ifndef SA_ONSTACK # define SA_ONSTACK 0 #endif #ifndef SA_RESETHAND # define SA_RESETHAND 0 #endif #ifndef SA_RESTART # define SA_RESTART 0 #endif #ifndef SA_SIGINFO # define SA_SIGINFO 0 #endif #ifndef SA_NOCLDWAIT # define SA_NOCLDWAIT 0 #endif /* Define a mask of flags required by POSIX. Some implementations provide other flags as extensions, such as SA_RESTORER, that we must ignore in this test. */ #define MASK_SA_FLAGS (SA_NOCLDSTOP | SA_ONSTACK | SA_RESETHAND | SA_RESTART \ | SA_SIGINFO | SA_NOCLDWAIT | SA_NODEFER) /* This test is unsafe in the presence of an asynchronous SIGABRT, because we install a signal-handler that is intentionally not async-safe. Hopefully, this does not lead to too many reports of false failures, since people don't generally use 'kill -s SIGABRT' to end a runaway program. */ static void handler (int sig) { static int entry_count; struct sigaction sa; ASSERT (sig == SIGABRT); ASSERT (sigaction (SIGABRT, NULL, &sa) == 0); ASSERT ((sa.sa_flags & SA_SIGINFO) == 0); switch (entry_count++) { case 0: ASSERT ((sa.sa_flags & SA_RESETHAND) == 0); ASSERT (sa.sa_handler == handler); break; case 1: /* This assertion fails on glibc-2.3.6 systems with LinuxThreads, when this program is linked with -lpthread, due to the sigaction() override in libpthread.so. */ #if !(defined __GLIBC__ || defined __UCLIBC__) ASSERT (sa.sa_handler == SIG_DFL); #endif break; default: ASSERT (0); } } int main (void) { struct sigaction sa; struct sigaction old_sa; sa.sa_handler = handler; sa.sa_flags = 0; ASSERT (sigemptyset (&sa.sa_mask) == 0); ASSERT (sigaction (SIGABRT, &sa, NULL) == 0); ASSERT (raise (SIGABRT) == 0); sa.sa_flags = SA_RESETHAND | SA_NODEFER; ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0); ASSERT ((old_sa.sa_flags & MASK_SA_FLAGS) == 0); ASSERT (old_sa.sa_handler == handler); ASSERT (raise (SIGABRT) == 0); sa.sa_handler = SIG_DFL; ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0); ASSERT ((old_sa.sa_flags & SA_SIGINFO) == 0); #if !(defined __GLIBC__ || defined __UCLIBC__) /* see above */ ASSERT (old_sa.sa_handler == SIG_DFL); #endif sa.sa_handler = SIG_IGN; ASSERT (sigaction (SIGABRT, &sa, NULL) == 0); ASSERT (raise (SIGABRT) == 0); ASSERT (sigaction (SIGABRT, NULL, &old_sa) == 0); ASSERT (old_sa.sa_handler == SIG_IGN); ASSERT (raise (SIGABRT) == 0); return 0; } ���kbuild-3608/src/grep/gnulib-tests/test-localename.c�������������������������������������������������0000664�0001750�0001750�00000060061�14670377436�022317� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of gl_locale_name function and its variants. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include "localename.h" #include <locale.h> #include <stdlib.h> #include <string.h> #include "macros.h" #if HAVE_WORKING_NEWLOCALE && HAVE_WORKING_USELOCALE && !HAVE_FAKE_LOCALES # define HAVE_GOOD_USELOCALE 1 #endif #if HAVE_GOOD_USELOCALE static struct { int cat; int mask; const char *string; } const categories[] = { { LC_CTYPE, LC_CTYPE_MASK, "LC_CTYPE" }, { LC_NUMERIC, LC_NUMERIC_MASK, "LC_NUMERIC" }, { LC_TIME, LC_TIME_MASK, "LC_TIME" }, { LC_COLLATE, LC_COLLATE_MASK, "LC_COLLATE" }, { LC_MONETARY, LC_MONETARY_MASK, "LC_MONETARY" }, { LC_MESSAGES, LC_MESSAGES_MASK, "LC_MESSAGES" } # ifdef LC_PAPER , { LC_PAPER, LC_PAPER_MASK, "LC_PAPER" } # endif # ifdef LC_NAME , { LC_NAME, LC_NAME_MASK, "LC_NAME" } # endif # ifdef LC_ADDRESS , { LC_ADDRESS, LC_ADDRESS_MASK, "LC_ADDRESS" } # endif # ifdef LC_TELEPHONE , { LC_TELEPHONE, LC_TELEPHONE_MASK, "LC_TELEPHONE" } # endif # ifdef LC_MEASUREMENT , { LC_MEASUREMENT, LC_MEASUREMENT_MASK, "LC_MEASUREMENT" } # endif # ifdef LC_IDENTIFICATION , { LC_IDENTIFICATION, LC_IDENTIFICATION_MASK, "LC_IDENTIFICATION" } # endif }; #endif /* Test the gl_locale_name() function. */ static void test_locale_name (void) { const char *ret; const char *name; /* Check that gl_locale_name returns non-NULL. */ ASSERT (gl_locale_name (LC_MESSAGES, "LC_MESSAGES") != NULL); /* Get into a defined state, */ setlocale (LC_ALL, "en_US.UTF-8"); #if HAVE_GOOD_USELOCALE uselocale (LC_GLOBAL_LOCALE); #endif /* Check that when all environment variables are unset, gl_locale_name returns the default locale. */ unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); unsetenv ("LC_NUMERIC"); unsetenv ("LANG"); /* Need also to unset all environment variables that specify standard or non-standard locale categories. Otherwise, on glibc systems, when some of these variables are set and reference a nonexistent locale, the setlocale (LC_ALL, "") call below would fail. */ unsetenv ("LC_COLLATE"); unsetenv ("LC_MONETARY"); unsetenv ("LC_TIME"); unsetenv ("LC_ADDRESS"); unsetenv ("LC_IDENTIFICATION"); unsetenv ("LC_MEASUREMENT"); unsetenv ("LC_NAME"); unsetenv ("LC_PAPER"); unsetenv ("LC_TELEPHONE"); ret = setlocale (LC_ALL, ""); ASSERT (ret != NULL); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), gl_locale_name_default ()) == 0); ASSERT (strcmp (gl_locale_name (LC_NUMERIC, "LC_NUMERIC"), gl_locale_name_default ()) == 0); /* Check that an empty environment variable is treated like an unset environment variable. */ setenv ("LC_ALL", "", 1); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); setenv ("LC_CTYPE", "", 1); unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); setenv ("LC_MESSAGES", "", 1); unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); setenv ("LANG", "", 1); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), gl_locale_name_default ()) == 0); /* Check that LC_ALL overrides the others, and LANG is overridden by the others. */ setenv ("LC_ALL", "C", 1); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); unsetenv ("LC_ALL"); setenv ("LC_CTYPE", "C", 1); setenv ("LC_MESSAGES", "C", 1); unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); setenv ("LANG", "C", 1); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); /* Check mixed situations. */ unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); setenv ("LANG", "de_DE.UTF-8", 1); if (setlocale (LC_ALL, "") != NULL) { name = gl_locale_name (LC_CTYPE, "LC_CTYPE"); #if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, here, gl_locale_name_thread (LC_CTYPE, "LC_CTYPE") returns NULL and gl_locale_name_posix (LC_CTYPE, "LC_CTYPE") returns either "de_DE" or "de_DE.UTF-8". */ ASSERT (strcmp (name, "de_DE") == 0 || strcmp (name, "de_DE.UTF-8") == 0); #else ASSERT (strcmp (name, "de_DE.UTF-8") == 0); #endif name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); } unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); unsetenv ("LANG"); if (setlocale (LC_ALL, "") != NULL) { name = gl_locale_name (LC_CTYPE, "LC_CTYPE"); ASSERT (strcmp (name, gl_locale_name_default ()) == 0); name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); } #if HAVE_GOOD_USELOCALE /* Check that gl_locale_name considers the thread locale. */ { locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); if (locale != NULL) { uselocale (locale); name = gl_locale_name (LC_CTYPE, "LC_CTYPE"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); uselocale (LC_GLOBAL_LOCALE); freelocale (locale); } } /* Check that gl_locale_name distinguishes different categories of the thread locale, and that the name is the right one for each. */ { unsigned int i; for (i = 0; i < SIZEOF (categories); i++) { int category_mask = categories[i].mask; locale_t loc = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); if (loc != NULL) { locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc); if (locale == NULL) freelocale (loc); else { unsigned int j; uselocale (locale); for (j = 0; j < SIZEOF (categories); j++) { const char *name_j = gl_locale_name (categories[j].cat, categories[j].string); if (j == i) ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0); else ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0); } uselocale (LC_GLOBAL_LOCALE); freelocale (locale); } } } } #endif } /* Test the gl_locale_name_thread() function. */ static void test_locale_name_thread (void) { /* Get into a defined state, */ setlocale (LC_ALL, "en_US.UTF-8"); #if HAVE_GOOD_USELOCALE /* Check that gl_locale_name_thread returns NULL when no thread locale is set. */ uselocale (LC_GLOBAL_LOCALE); ASSERT (gl_locale_name_thread (LC_CTYPE, "LC_CTYPE") == NULL); ASSERT (gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES") == NULL); /* Check that gl_locale_name_thread considers the thread locale. */ { locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); if (locale != NULL) { const char *name; uselocale (locale); name = gl_locale_name_thread (LC_CTYPE, "LC_CTYPE"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); name = gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); uselocale (LC_GLOBAL_LOCALE); freelocale (locale); } } /* Check that gl_locale_name_thread distinguishes different categories of the thread locale, and that the name is the right one for each. */ { unsigned int i; for (i = 0; i < SIZEOF (categories); i++) { int category_mask = categories[i].mask; locale_t loc = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); if (loc != NULL) { locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc); if (locale == NULL) freelocale (loc); else { unsigned int j; uselocale (locale); for (j = 0; j < SIZEOF (categories); j++) { const char *name_j = gl_locale_name_thread (categories[j].cat, categories[j].string); if (j == i) ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0); else ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0); } uselocale (LC_GLOBAL_LOCALE); freelocale (locale); } } } } /* Check that gl_locale_name_thread returns a string that is allocated with indefinite extent. */ { /* Try many locale names in turn, in order to defeat possible caches. */ static const char * const choices[] = { "C", "POSIX", "af_ZA", "af_ZA.UTF-8", "am_ET", "am_ET.UTF-8", "be_BY", "be_BY.UTF-8", "bg_BG", "bg_BG.UTF-8", "ca_ES", "ca_ES.UTF-8", "cs_CZ", "cs_CZ.UTF-8", "da_DK", "da_DK.UTF-8", "de_AT", "de_AT.UTF-8", "de_CH", "de_CH.UTF-8", "de_DE", "de_DE.UTF-8", "el_GR", "el_GR.UTF-8", "en_AU", "en_AU.UTF-8", "en_CA", "en_CA.UTF-8", "en_GB", "en_GB.UTF-8", "en_IE", "en_IE.UTF-8", "en_NZ", "en_NZ.UTF-8", "en_US", "en_US.UTF-8", "es_ES", "es_ES.UTF-8", "et_EE", "et_EE.UTF-8", "eu_ES", "eu_ES.UTF-8", "fi_FI", "fi_FI.UTF-8", "fr_BE", "fr_BE.UTF-8", "fr_CA", "fr_CA.UTF-8", "fr_CH", "fr_CH.UTF-8", "fr_FR", "fr_FR.UTF-8", "he_IL", "he_IL.UTF-8", "hr_HR", "hr_HR.UTF-8", "hu_HU", "hu_HU.UTF-8", "hy_AM", "is_IS", "is_IS.UTF-8", "it_CH", "it_CH.UTF-8", "it_IT", "it_IT.UTF-8", "ja_JP.UTF-8", "kk_KZ", "kk_KZ.UTF-8", "ko_KR.UTF-8", "lt_LT", "lt_LT.UTF-8", "nl_BE", "nl_BE.UTF-8", "nl_NL", "nl_NL.UTF-8", "no_NO", "no_NO.UTF-8", "pl_PL", "pl_PL.UTF-8", "pt_BR", "pt_BR.UTF-8", "pt_PT", "pt_PT.UTF-8", "ro_RO", "ro_RO.UTF-8", "ru_RU", "ru_RU.UTF-8", "sk_SK", "sk_SK.UTF-8", "sl_SI", "sl_SI.UTF-8", "sv_SE", "sv_SE.UTF-8", "tr_TR", "tr_TR.UTF-8", "uk_UA", "uk_UA.UTF-8", "zh_CN", "zh_CN.UTF-8", "zh_HK", "zh_HK.UTF-8", "zh_TW", "zh_TW.UTF-8" }; /* Remember which locales are available. */ unsigned char /* bool */ available[SIZEOF (choices)]; /* Array of remembered results of gl_locale_name_thread. */ const char *unsaved_names[SIZEOF (choices)][SIZEOF (categories)]; /* Array of remembered results of gl_locale_name_thread, stored in safe memory. */ char *saved_names[SIZEOF (choices)][SIZEOF (categories)]; unsigned int j; for (j = 0; j < SIZEOF (choices); j++) { locale_t locale = newlocale (LC_ALL_MASK, choices[j], NULL); available[j] = (locale != NULL); if (locale != NULL) { unsigned int i; uselocale (locale); for (i = 0; i < SIZEOF (categories); i++) { unsaved_names[j][i] = gl_locale_name_thread (categories[i].cat, categories[i].string); saved_names[j][i] = strdup (unsaved_names[j][i]); } uselocale (LC_GLOBAL_LOCALE); freelocale (locale); } } /* Verify the unsaved_names are still valid. */ for (j = 0; j < SIZEOF (choices); j++) if (available[j]) { unsigned int i; for (i = 0; i < SIZEOF (categories); i++) ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0); } /* Allocate many locales, without freeing them. This is an attempt at overwriting as much of the previously allocated memory as possible. */ for (j = SIZEOF (choices); j > 0; ) { j--; if (available[j]) { locale_t locale = newlocale (LC_ALL_MASK, choices[j], NULL); unsigned int i; ASSERT (locale != NULL); uselocale (locale); for (i = 0; i < SIZEOF (categories); i++) { const char *name = gl_locale_name_thread (categories[i].cat, categories[i].string); ASSERT (strcmp (unsaved_names[j][i], name) == 0); } uselocale (LC_GLOBAL_LOCALE); freelocale (locale); } } /* Verify the unsaved_names are still valid. */ for (j = 0; j < SIZEOF (choices); j++) if (available[j]) { unsigned int i; for (i = 0; i < SIZEOF (categories); i++) { ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0); free (saved_names[j][i]); } } } #else /* Check that gl_locale_name_thread always returns NULL. */ ASSERT (gl_locale_name_thread (LC_CTYPE, "LC_CTYPE") == NULL); ASSERT (gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES") == NULL); #endif } /* Test the gl_locale_name_posix() function. */ static void test_locale_name_posix (void) { const char *ret; const char *name; /* Get into a defined state, */ setlocale (LC_ALL, "en_US.UTF-8"); #if HAVE_GOOD_USELOCALE uselocale (LC_GLOBAL_LOCALE); #endif /* Check that when all environment variables are unset, gl_locale_name_posix returns either NULL or the default locale. */ unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); unsetenv ("LC_NUMERIC"); unsetenv ("LANG"); /* Need also to unset all environment variables that specify standard or non-standard locale categories. Otherwise, on glibc systems, when some of these variables are set and reference a nonexistent locale, the setlocale (LC_ALL, "") call below would fail. */ unsetenv ("LC_COLLATE"); unsetenv ("LC_MONETARY"); unsetenv ("LC_TIME"); unsetenv ("LC_ADDRESS"); unsetenv ("LC_IDENTIFICATION"); unsetenv ("LC_MEASUREMENT"); unsetenv ("LC_NAME"); unsetenv ("LC_PAPER"); unsetenv ("LC_TELEPHONE"); ret = setlocale (LC_ALL, ""); ASSERT (ret != NULL); name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); name = gl_locale_name_posix (LC_NUMERIC, "LC_NUMERIC"); ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); /* Check that an empty environment variable is treated like an unset environment variable. */ setenv ("LC_ALL", "", 1); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); setlocale (LC_ALL, ""); name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); setenv ("LC_CTYPE", "", 1); unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); setlocale (LC_ALL, ""); name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); setenv ("LC_MESSAGES", "", 1); unsetenv ("LANG"); setlocale (LC_ALL, ""); name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); setenv ("LANG", "", 1); setlocale (LC_ALL, ""); name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); /* Check that LC_ALL overrides the others, and LANG is overridden by the others. */ setenv ("LC_ALL", "C", 1); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); setlocale (LC_ALL, ""); name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "C") == 0); unsetenv ("LC_ALL"); setenv ("LC_CTYPE", "C", 1); setenv ("LC_MESSAGES", "C", 1); unsetenv ("LANG"); setlocale (LC_ALL, ""); name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "C") == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); setenv ("LANG", "C", 1); setlocale (LC_ALL, ""); name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "C") == 0); /* Check mixed situations. */ unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); setenv ("LANG", "de_DE.UTF-8", 1); if (setlocale (LC_ALL, "") != NULL) { name = gl_locale_name_posix (LC_CTYPE, "LC_CTYPE"); #if defined _WIN32 && !defined __CYGWIN__ ASSERT (strcmp (name, "de_DE") == 0 || strcmp (name, "de_DE.UTF-8") == 0); #else ASSERT (strcmp (name, "de_DE.UTF-8") == 0); #endif name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); } unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); unsetenv ("LANG"); if (setlocale (LC_ALL, "") != NULL) { name = gl_locale_name_posix (LC_CTYPE, "LC_CTYPE"); ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); } #if HAVE_GOOD_USELOCALE /* Check that gl_locale_name_posix ignores the thread locale. */ { locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); if (locale != NULL) { unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); setenv ("LANG", "C", 1); setlocale (LC_ALL, ""); uselocale (locale); name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "C") == 0); uselocale (LC_GLOBAL_LOCALE); freelocale (locale); } } #endif } /* Test the gl_locale_name_environ() function. */ static void test_locale_name_environ (void) { const char *name; /* Get into a defined state, */ setlocale (LC_ALL, "en_US.UTF-8"); #if HAVE_GOOD_USELOCALE uselocale (LC_GLOBAL_LOCALE); #endif /* Check that when all environment variables are unset, gl_locale_name_environ returns NULL. */ unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); unsetenv ("LC_NUMERIC"); unsetenv ("LANG"); ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); ASSERT (gl_locale_name_environ (LC_NUMERIC, "LC_NUMERIC") == NULL); /* Check that an empty environment variable is treated like an unset environment variable. */ setenv ("LC_ALL", "", 1); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); unsetenv ("LC_ALL"); setenv ("LC_CTYPE", "", 1); unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); setenv ("LC_MESSAGES", "", 1); unsetenv ("LANG"); ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); setenv ("LANG", "", 1); ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); /* Check that LC_ALL overrides the others, and LANG is overridden by the others. */ setenv ("LC_ALL", "C", 1); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "C") == 0); unsetenv ("LC_ALL"); setenv ("LC_CTYPE", "C", 1); setenv ("LC_MESSAGES", "C", 1); unsetenv ("LANG"); name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "C") == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); setenv ("LANG", "C", 1); name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "C") == 0); /* Check mixed situations. */ unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); setenv ("LANG", "de_DE.UTF-8", 1); name = gl_locale_name_environ (LC_CTYPE, "LC_CTYPE"); ASSERT (strcmp (name, "de_DE.UTF-8") == 0); name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); unsetenv ("LANG"); name = gl_locale_name_environ (LC_CTYPE, "LC_CTYPE"); ASSERT (name == NULL); name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); #if HAVE_GOOD_USELOCALE /* Check that gl_locale_name_environ ignores the thread locale. */ { locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); if (locale != NULL) { unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); setenv ("LANG", "C", 1); setlocale (LC_ALL, ""); uselocale (locale); name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); ASSERT (strcmp (name, "C") == 0); uselocale (LC_GLOBAL_LOCALE); freelocale (locale); } } #endif } /* Test the gl_locale_name_default() function. */ static void test_locale_name_default (void) { const char *name = gl_locale_name_default (); ASSERT (name != NULL); /* Only Mac OS X and Windows have a facility for the user to set the default locale. */ #if !((defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __CYGWIN__)) ASSERT (strcmp (name, "C") == 0); #endif #if HAVE_GOOD_USELOCALE /* Check that gl_locale_name_default ignores the thread locale. */ { locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); if (locale != NULL) { uselocale (locale); ASSERT (strcmp (gl_locale_name_default (), name) == 0); uselocale (LC_GLOBAL_LOCALE); freelocale (locale); } } #endif } int main () { test_locale_name (); test_locale_name_thread (); test_locale_name_posix (); test_locale_name_environ (); test_locale_name_default (); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbscasecmp.sh������������������������������������������������0000775�0001750�0001750�00000000610�14670377436�022521� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test whether a specific Turkish locale is installed. : ${LOCALE_TR_UTF8=tr_TR.UTF-8} if test $LOCALE_TR_UTF8 = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no turkish Unicode locale is installed" else echo "Skipping test: no turkish Unicode locale is supported" fi exit 77 fi LC_ALL=$LOCALE_TR_UTF8 \ ${CHECKER} ./test-mbscasecmp${EXEEXT} ������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-pthread-thread.c���������������������������������������������0000664�0001750�0001750�00000003643�14670377436�023116� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of pthread_create () function. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2011. */ #include <config.h> #include <pthread.h> #include <stdio.h> #include <string.h> #include "macros.h" static pthread_t main_thread_before; static pthread_t main_thread_after; static pthread_t worker_thread; #define MAGIC ((void *) 1266074729) static volatile int work_done; static void * worker_thread_func (void *arg) { work_done = 1; return MAGIC; } int main () { main_thread_before = pthread_self (); if (pthread_create (&worker_thread, NULL, worker_thread_func, NULL) == 0) { void *ret; /* Check that pthread_self () has the same value before than after the first call to pthread_create (). */ main_thread_after = pthread_self (); ASSERT (memcmp (&main_thread_before, &main_thread_after, sizeof (pthread_t)) == 0); ASSERT (pthread_join (worker_thread, &ret) == 0); /* Check the return value of the thread. */ ASSERT (ret == MAGIC); /* Check that worker_thread_func () has finished executing. */ ASSERT (work_done); return 0; } else { fputs ("pthread_create failed\n", stderr); return 1; } } ���������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-connect.c����������������������������������������������������0000664�0001750�0001750�00000003143�14670377431�021641� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test connecting a client socket. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <sys/socket.h> #include "signature.h" SIGNATURE_CHECK (connect, int, (int, const struct sockaddr *, socklen_t)); #include <errno.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include "sockets.h" #include "macros.h" int main (void) { (void) gl_sockets_startup (SOCKETS_1_1); /* Test behaviour for invalid file descriptors. */ { struct sockaddr_in addr; addr.sin_family = AF_INET; inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr); addr.sin_port = htons (80); { errno = 0; ASSERT (connect (-1, (const struct sockaddr *) &addr, sizeof (addr)) == -1); ASSERT (errno == EBADF); } { close (99); errno = 0; ASSERT (connect (99, (const struct sockaddr *) &addr, sizeof (addr)) == -1); ASSERT (errno == EBADF); } } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-strnlen.c����������������������������������������������������0000664�0001750�0001750�00000003362�14670377436�021705� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2010-2021 Free Software Foundation, Inc. * Written by Eric Blake * * 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <string.h> #include "signature.h" SIGNATURE_CHECK (strnlen, size_t, (char const *, size_t)); #include <stdlib.h> #include "zerosize-ptr.h" #include "macros.h" int main (void) { size_t i; char *page_boundary = (char *) zerosize_ptr (); if (!page_boundary) { page_boundary = malloc (0x1000); ASSERT (page_boundary); page_boundary += 0x1000; } /* Basic behavior tests. */ ASSERT (strnlen ("a", 0) == 0); ASSERT (strnlen ("a", 1) == 1); ASSERT (strnlen ("a", 2) == 1); ASSERT (strnlen ("", 0x100000) == 0); /* Memory fence and alignment testing. */ for (i = 0; i < 512; i++) { char *start = page_boundary - i; size_t j = i; memset (start, 'x', i); do { if (i != j) { start[j] = 0; ASSERT (strnlen (start, i + j) == j); } ASSERT (strnlen (start, i) == j); ASSERT (strnlen (start, j) == j); } while (j--); } return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-nl_langinfo-mt.c���������������������������������������������0000664�0001750�0001750�00000013631�14670377436�023124� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Multithread-safety test for nl_langinfo(). Copyright (C) 2019-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2019. */ #include <config.h> /* Work around GCC bug 44511. */ #if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) # pragma GCC diagnostic ignored "-Wreturn-type" #endif #if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS /* Specification. */ #include <langinfo.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "glthread/thread.h" /* Some common locale names. */ #if defined _WIN32 && !defined __CYGWIN__ # define ENGLISH "English_United States" # define FRENCH "French_France" # define GERMAN "German_Germany" # define ENCODING ".1252" #else # define ENGLISH "en_US" # define FRENCH "fr_FR" # define GERMAN "de_DE" # if defined __sgi # define ENCODING ".ISO8859-15" # elif defined __hpux # define ENCODING ".utf8" # else # define ENCODING ".UTF-8" # endif #endif static const char LOCALE1[] = ENGLISH ENCODING; static const char LOCALE2[] = FRENCH ENCODING; static const char LOCALE3[] = GERMAN ENCODING; static char *expected1; static void * thread1_func (void *arg) { for (;;) { const char *value = nl_langinfo (CODESET); if (strcmp (expected1, value) != 0) { fprintf (stderr, "thread1 disturbed by threadN!\n"); fflush (stderr); abort (); } } /*NOTREACHED*/ } static char *expected2; static void * thread2_func (void *arg) { for (;;) { const char *value = nl_langinfo (PM_STR); if (strcmp (expected2, value) != 0) { fprintf (stderr, "thread2 disturbed by threadN!\n"); fflush (stderr); abort (); } } /*NOTREACHED*/ } static char *expected3; static void * thread3_func (void *arg) { for (;;) { const char *value = nl_langinfo (DAY_2); if (strcmp (expected3, value) != 0) { fprintf (stderr, "thread3 disturbed by threadN!\n"); fflush (stderr); abort (); } } /*NOTREACHED*/ } static char *expected4; static void * thread4_func (void *arg) { for (;;) { const char *value = nl_langinfo (ALTMON_2); if (strcmp (expected4, value) != 0) { fprintf (stderr, "thread4 disturbed by threadN!\n"); fflush (stderr); abort (); } } /*NOTREACHED*/ } static char *expected5; static void * thread5_func (void *arg) { for (;;) { const char *value = nl_langinfo (CRNCYSTR); if (strcmp (expected5, value) != 0) { fprintf (stderr, "thread5 disturbed by threadN!\n"); fflush (stderr); abort (); } } /*NOTREACHED*/ } static char *expected6; static void * thread6_func (void *arg) { for (;;) { const char *value = nl_langinfo (RADIXCHAR); if (strcmp (expected6, value) != 0) { fprintf (stderr, "thread6 disturbed by threadN!\n"); fflush (stderr); abort (); } } /*NOTREACHED*/ } static void * threadN_func (void *arg) { for (;;) { nl_langinfo (CODESET); /* LC_CTYPE */ /* locale charmap */ nl_langinfo (AM_STR); /* LC_TIME */ /* locale -k am_pm */ nl_langinfo (PM_STR); /* LC_TIME */ /* locale -k am_pm */ nl_langinfo (DAY_2); /* LC_TIME */ /* locale -k day */ nl_langinfo (DAY_5); /* LC_TIME */ /* locale -k day */ nl_langinfo (ALTMON_2); /* LC_TIME */ /* locale -k alt_mon */ nl_langinfo (ALTMON_9); /* LC_TIME */ /* locale -k alt_mon */ nl_langinfo (CRNCYSTR); /* LC_MONETARY */ /* locale -k currency_symbol */ nl_langinfo (RADIXCHAR); /* LC_NUMERIC */ /* locale -k decimal_point */ nl_langinfo (THOUSEP); /* LC_NUMERIC */ /* locale -k thousands_sep */ } /*NOTREACHED*/ } int main (int argc, char *argv[]) { if (setlocale (LC_ALL, LOCALE1) == NULL) { fprintf (stderr, "Skipping test: LOCALE1 not recognized\n"); return 77; } if (setlocale (LC_MONETARY, LOCALE2) == NULL) { fprintf (stderr, "Skipping test: LOCALE2 not recognized\n"); return 77; } if (setlocale (LC_NUMERIC, LOCALE3) == NULL) { fprintf (stderr, "Skipping test: LOCALE3 not recognized\n"); return 77; } expected1 = strdup (nl_langinfo (CODESET)); expected2 = strdup (nl_langinfo (PM_STR)); expected3 = strdup (nl_langinfo (DAY_2)); expected4 = strdup (nl_langinfo (ALTMON_2)); expected5 = strdup (nl_langinfo (CRNCYSTR)); expected6 = strdup (nl_langinfo (RADIXCHAR)); /* Create the checker threads. */ gl_thread_create (thread1_func, NULL); gl_thread_create (thread2_func, NULL); gl_thread_create (thread3_func, NULL); gl_thread_create (thread4_func, NULL); gl_thread_create (thread5_func, NULL); gl_thread_create (thread6_func, NULL); /* Create the disturber thread. */ gl_thread_create (threadN_func, NULL); /* Let them run for 2 seconds. */ { struct timespec duration; duration.tv_sec = (argc > 1 ? atoi (argv[1]) : 2); duration.tv_nsec = 0; nanosleep (&duration, NULL); } return 0; } #else /* No multithreading available. */ #include <stdio.h> int main () { fputs ("Skipping test: multithreading not enabled\n", stderr); return 77; } #endif �������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sigsegv-catch-segv1.c����������������������������������������0000664�0001750�0001750�00000006123�14670377436�023770� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test that the handler is called, with the right fault address. Copyright (C) 2002-2021 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 2 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible. */ #include <config.h> /* Specification. */ #include "sigsegv.h" #include <stdint.h> #include <stdio.h> #if HAVE_SIGSEGV_RECOVERY # include "mmap-anon-util.h" # include <stdlib.h> # if SIGSEGV_FAULT_ADDRESS_ALIGNMENT > 1UL # include <unistd.h> # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS (getpagesize () - 1) # else # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0 # endif uintptr_t page; volatile int handler_called = 0; static int handler (void *fault_address, int serious) { handler_called++; if (handler_called > 10) abort (); if (fault_address != (void *)((page + 0x678) & ~SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS)) abort (); if (mprotect ((void *) page, 0x4000, PROT_READ_WRITE) == 0) return 1; return 0; } static void crasher (uintptr_t p) { *(volatile int *) (p + 0x678) = 42; } int main () { int prot_unwritable; void *p; /* Preparations. */ # if !HAVE_MAP_ANONYMOUS zero_fd = open ("/dev/zero", O_RDONLY, 0644); # endif # if defined __linux__ && defined __sparc__ /* On Linux 2.6.26/SPARC64, PROT_READ has the same effect as PROT_READ | PROT_WRITE. */ prot_unwritable = PROT_NONE; # else prot_unwritable = PROT_READ; # endif /* Setup some mmaped memory. */ p = mmap_zeromap ((void *) 0x12340000, 0x4000); if (p == (void *)(-1)) { fprintf (stderr, "mmap_zeromap failed.\n"); exit (2); } page = (uintptr_t) p; /* Make it read-only. */ if (mprotect ((void *) page, 0x4000, prot_unwritable) < 0) { fprintf (stderr, "mprotect failed.\n"); exit (2); } /* Test whether it's possible to make it read-write after it was read-only. This is not possible on Cygwin. */ if (mprotect ((void *) page, 0x4000, PROT_READ_WRITE) < 0 || mprotect ((void *) page, 0x4000, prot_unwritable) < 0) { fprintf (stderr, "mprotect failed.\n"); exit (2); } /* Install the SIGSEGV handler. */ sigsegv_install_handler (&handler); /* The first write access should invoke the handler and then complete. */ crasher (page); /* The second write access should not invoke the handler. */ crasher (page); /* Check that the handler was called only once. */ if (handler_called != 1) exit (1); /* Test passed! */ printf ("Test passed.\n"); return 0; } #else int main () { return 77; } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcrtomb.c����������������������������������������������������0000664�0001750�0001750�00000011131�14670377437�021667� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of conversion of wide character to multibyte character. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include <wchar.h> #include "signature.h" SIGNATURE_CHECK (wcrtomb, size_t, (char *, wchar_t, mbstate_t *)); #include <locale.h> #include <stdlib.h> #include <string.h> #include "macros.h" /* Check the multibyte character s[0..n-1]. */ static void check_character (const char *s, size_t n) { wchar_t wc; char buf[64]; int iret; size_t ret; wc = (wchar_t) 0xBADFACE; iret = mbtowc (&wc, s, n); ASSERT (iret == n); ret = wcrtomb (buf, wc, NULL); ASSERT (ret == n); ASSERT (memcmp (buf, s, n) == 0); /* Test special calling convention, passing a NULL pointer. */ ret = wcrtomb (NULL, wc, NULL); ASSERT (ret == 1); } int main (int argc, char *argv[]) { char buf[64]; size_t ret; /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; /* Test NUL character. */ { buf[0] = 'x'; ret = wcrtomb (buf, 0, NULL); ASSERT (ret == 1); ASSERT (buf[0] == '\0'); } /* Test single bytes. */ { int c; for (c = 0; c < 0x100; c++) switch (c) { case '\t': case '\v': case '\f': 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 '~': /* c is in the ISO C "basic character set". */ ret = wcrtomb (buf, btowc (c), NULL); ASSERT (ret == 1); ASSERT (buf[0] == (char) c); break; } } /* Test special calling convention, passing a NULL pointer. */ { ret = wcrtomb (NULL, '\0', NULL); ASSERT (ret == 1); ret = wcrtomb (NULL, btowc ('x'), NULL); ASSERT (ret == 1); } if (argc > 1) switch (argv[1][0]) { case '1': /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ { const char input[] = "B\374\337er"; /* "Büßer" */ check_character (input + 1, 1); check_character (input + 2, 1); } return 0; case '2': /* Locale encoding is UTF-8. */ { const char input[] = "B\303\274\303\237er"; /* "Büßer" */ check_character (input + 1, 2); check_character (input + 3, 2); } return 0; case '3': /* Locale encoding is EUC-JP. */ { const char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */ check_character (input + 1, 2); check_character (input + 3, 2); check_character (input + 5, 2); } return 0; case '4': /* Locale encoding is GB18030. */ { const char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ check_character (input + 1, 2); check_character (input + 3, 4); } return 0; case '5': /* C locale; tested above. */ return 0; } return 1; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-inttypes.c���������������������������������������������������0000664�0001750�0001750�00000006061�14670377436�022076� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <inttypes.h> substitute. Copyright (C) 2006-2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <inttypes.h> #include <stddef.h> /* Tests for macros supposed to be defined in inttypes.h. */ const char *k = /* implicit string concatenation */ #ifdef INT8_MAX PRId8 PRIi8 #endif #ifdef UINT8_MAX PRIo8 PRIu8 PRIx8 PRIX8 #endif #ifdef INT16_MAX PRId16 PRIi16 #endif #ifdef UINT16_MAX PRIo16 PRIu16 PRIx16 PRIX16 #endif #ifdef INT32_MAX PRId32 PRIi32 #endif #ifdef UINT32_MAX PRIo32 PRIu32 PRIx32 PRIX32 #endif #ifdef INT64_MAX PRId64 PRIi64 #endif #ifdef UINT64_MAX PRIo64 PRIu64 PRIx64 PRIX64 #endif PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8 PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16 PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32 PRIdLEAST64 PRIiLEAST64 PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64 PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8 PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16 PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32 PRIdFAST64 PRIiFAST64 PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64 PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX #ifdef INTPTR_MAX PRIdPTR PRIiPTR #endif #ifdef UINTPTR_MAX PRIoPTR PRIuPTR PRIxPTR PRIXPTR #endif ; const char *l = /* implicit string concatenation */ #ifdef INT8_MAX SCNd8 SCNi8 #endif #ifdef UINT8_MAX SCNo8 SCNu8 SCNx8 #endif #ifdef INT16_MAX SCNd16 SCNi16 #endif #ifdef UINT16_MAX SCNo16 SCNu16 SCNx16 #endif #ifdef INT32_MAX SCNd32 SCNi32 #endif #ifdef UINT32_MAX SCNo32 SCNu32 SCNx32 #endif #ifdef INT64_MAX SCNd64 SCNi64 #endif #ifdef UINT64_MAX SCNo64 SCNu64 SCNx64 #endif SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8 SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16 SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32 SCNdLEAST64 SCNiLEAST64 SCNoLEAST64 SCNuLEAST64 SCNxLEAST64 SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8 SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16 SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32 SCNdFAST64 SCNiFAST64 SCNoFAST64 SCNuFAST64 SCNxFAST64 SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX #ifdef INTPTR_MAX SCNdPTR SCNiPTR #endif #ifdef UINTPTR_MAX SCNoPTR SCNuPTR SCNxPTR #endif ; int main (void) { return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sys_select.in.h���������������������������������������������������0000664�0001750�0001750�00000030604�14670377431�022024� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Substitute for <sys/select.h>. Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ # if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ # endif @PRAGMA_COLUMNS@ /* On OSF/1 and Solaris 2.6, <sys/types.h> and <sys/time.h> both include <sys/select.h>. On Cygwin, <sys/time.h> includes <sys/select.h>. Simply delegate to the system's header in this case. */ #if (@HAVE_SYS_SELECT_H@ \ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H \ && ((defined __osf__ && defined _SYS_TYPES_H_ \ && defined _OSF_SOURCE) \ || (defined __sun && defined _SYS_TYPES_H \ && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \ || defined __EXTENSIONS__)))) # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ #elif (@HAVE_SYS_SELECT_H@ \ && (defined _CYGWIN_SYS_TIME_H \ || (!defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \ && ((defined __osf__ && defined _SYS_TIME_H_ \ && defined _OSF_SOURCE) \ || (defined __sun && defined _SYS_TIME_H \ && (! (defined _XOPEN_SOURCE \ || defined _POSIX_C_SOURCE) \ || defined __EXTENSIONS__)))))) # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ /* On IRIX 6.5, <sys/timespec.h> includes <sys/types.h>, which includes <sys/bsd_types.h>, which includes <sys/select.h>. At this point we cannot include <signal.h>, because that includes <internal/signal_core.h>, which gives a syntax error because <sys/timespec.h> has not been completely processed. Simply delegate to the system's header in this case. */ #elif @HAVE_SYS_SELECT_H@ && defined __sgi && (defined _SYS_BSD_TYPES_H && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H) # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ /* On OpenBSD 5.0, <pthread.h> includes <sys/types.h>, which includes <sys/select.h>. At this point we cannot include <signal.h>, because that includes gnulib's pthread.h override, which gives a syntax error because /usr/include/pthread.h has not been completely processed. Simply delegate to the system's header in this case. */ #elif @HAVE_SYS_SELECT_H@ && defined __OpenBSD__ && (defined _PTHREAD_H_ && !defined PTHREAD_MUTEX_INITIALIZER) # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ #else #ifndef _@GUARD_PREFIX@_SYS_SELECT_H /* On many platforms, <sys/select.h> assumes prior inclusion of <sys/types.h>. Also, mingw defines sigset_t there, instead of in <signal.h> where it belongs. */ #include <sys/types.h> #if @HAVE_SYS_SELECT_H@ /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration of 'struct timeval', and no definition of this type. Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select() in <sys/time.h>. But avoid namespace pollution on glibc systems and "unknown type name" problems on Cygwin. */ # if !(defined __GLIBC__ || defined __CYGWIN__) # include <sys/time.h> # endif /* On AIX 7 and Solaris 10, <sys/select.h> provides an FD_ZERO implementation that relies on memset(), but without including <string.h>. But in any case avoid namespace pollution on glibc systems. */ # if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __osf__ || defined __BEOS__) \ && ! defined __GLIBC__ # include <string.h> # endif /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ #endif /* Get definition of 'sigset_t'. But avoid namespace pollution on glibc systems and "unknown type name" problems on Cygwin. On OS/2 kLIBC, sigset_t is defined in <sys/select.h>, too. In addition, if <sys/param.h> is included, <types.h> -> <sys/types.h> -> <sys/select.h> are included. Then <signal.h> -> <pthread.h> are included by GNULIB. By the way, <pthread.h> requires PAGE_SIZE defined in <sys/param.h>. However, <sys/param.h> has not been processed, yet. As a result, 'PAGE_SIZE' undeclared error occurs in <pthread.h>. Do this after the include_next (for the sake of OpenBSD 5.0) but before the split double-inclusion guard (for the sake of Solaris). */ #if !((defined __GLIBC__ || defined __CYGWIN__ || defined __KLIBC__) \ && !defined __UCLIBC__) # include <signal.h> #endif #ifndef _@GUARD_PREFIX@_SYS_SELECT_H #define _@GUARD_PREFIX@_SYS_SELECT_H #if !@HAVE_SYS_SELECT_H@ /* A platform that lacks <sys/select.h>. */ /* Get the 'struct timeval' and 'fd_set' types and the FD_* macros on most platforms. */ # include <sys/time.h> /* On HP-UX 11, <sys/time.h> provides an FD_ZERO implementation that relies on memset(), but without including <string.h>. */ # if defined __hpux # include <string.h> # endif /* On native Windows platforms: Get the 'fd_set' type. Get the close() declaration before we override it. */ # if @HAVE_WINSOCK2_H@ # if !defined _GL_INCLUDING_WINSOCK2_H # define _GL_INCLUDING_WINSOCK2_H # include <winsock2.h> # undef _GL_INCLUDING_WINSOCK2_H # endif # include <io.h> # endif #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Fix some definitions from <winsock2.h>. */ #if @HAVE_WINSOCK2_H@ # if !GNULIB_defined_rpl_fd_isset /* Re-define FD_ISSET to avoid a WSA call while we are not using network sockets. */ static int rpl_fd_isset (SOCKET fd, fd_set * set) { u_int i; if (set == NULL) return 0; for (i = 0; i < set->fd_count; i++) if (set->fd_array[i] == fd) return 1; return 0; } # define GNULIB_defined_rpl_fd_isset 1 # endif # undef FD_ISSET # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) #endif /* Hide some function declarations from <winsock2.h>. */ #if @HAVE_WINSOCK2_H@ # if !defined _@GUARD_PREFIX@_UNISTD_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef close # define close close_used_without_including_unistd_h # elif !defined __clang__ _GL_WARN_ON_USE (close, "close() used without including <unistd.h>"); # endif # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gethostname # define gethostname gethostname_used_without_including_unistd_h # elif !defined __clang__ _GL_WARN_ON_USE (gethostname, "gethostname() used without including <unistd.h>"); # endif # endif # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef socket # define socket socket_used_without_including_sys_socket_h # undef connect # define connect connect_used_without_including_sys_socket_h # undef accept # define accept accept_used_without_including_sys_socket_h # undef bind # define bind bind_used_without_including_sys_socket_h # undef getpeername # define getpeername getpeername_used_without_including_sys_socket_h # undef getsockname # define getsockname getsockname_used_without_including_sys_socket_h # undef getsockopt # define getsockopt getsockopt_used_without_including_sys_socket_h # undef listen # define listen listen_used_without_including_sys_socket_h # undef recv # define recv recv_used_without_including_sys_socket_h # undef send # define send send_used_without_including_sys_socket_h # undef recvfrom # define recvfrom recvfrom_used_without_including_sys_socket_h # undef sendto # define sendto sendto_used_without_including_sys_socket_h # undef setsockopt # define setsockopt setsockopt_used_without_including_sys_socket_h # undef shutdown # define shutdown shutdown_used_without_including_sys_socket_h # elif !defined __clang__ _GL_WARN_ON_USE (socket, "socket() used without including <sys/socket.h>"); _GL_WARN_ON_USE (connect, "connect() used without including <sys/socket.h>"); _GL_WARN_ON_USE (accept, "accept() used without including <sys/socket.h>"); _GL_WARN_ON_USE (bind, "bind() used without including <sys/socket.h>"); _GL_WARN_ON_USE (getpeername, "getpeername() used without including <sys/socket.h>"); _GL_WARN_ON_USE (getsockname, "getsockname() used without including <sys/socket.h>"); _GL_WARN_ON_USE (getsockopt, "getsockopt() used without including <sys/socket.h>"); _GL_WARN_ON_USE (listen, "listen() used without including <sys/socket.h>"); _GL_WARN_ON_USE (recv, "recv() used without including <sys/socket.h>"); _GL_WARN_ON_USE (send, "send() used without including <sys/socket.h>"); _GL_WARN_ON_USE (recvfrom, "recvfrom() used without including <sys/socket.h>"); _GL_WARN_ON_USE (sendto, "sendto() used without including <sys/socket.h>"); _GL_WARN_ON_USE (setsockopt, "setsockopt() used without including <sys/socket.h>"); _GL_WARN_ON_USE (shutdown, "shutdown() used without including <sys/socket.h>"); # endif # endif #endif #if @GNULIB_PSELECT@ # if @REPLACE_PSELECT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pselect # define pselect rpl_pselect # endif _GL_FUNCDECL_RPL (pselect, int, (int, fd_set *restrict, fd_set *restrict, fd_set *restrict, struct timespec const *restrict, const sigset_t *restrict)); _GL_CXXALIAS_RPL (pselect, int, (int, fd_set *restrict, fd_set *restrict, fd_set *restrict, struct timespec const *restrict, const sigset_t *restrict)); # else # if !@HAVE_PSELECT@ _GL_FUNCDECL_SYS (pselect, int, (int, fd_set *restrict, fd_set *restrict, fd_set *restrict, struct timespec const *restrict, const sigset_t *restrict)); # endif _GL_CXXALIAS_SYS (pselect, int, (int, fd_set *restrict, fd_set *restrict, fd_set *restrict, struct timespec const *restrict, const sigset_t *restrict)); # endif _GL_CXXALIASWARN (pselect); #elif defined GNULIB_POSIXCHECK # undef pselect # if HAVE_RAW_DECL_PSELECT _GL_WARN_ON_USE (pselect, "pselect is not portable - " "use gnulib module pselect for portability"); # endif #endif #if @GNULIB_SELECT@ # if @REPLACE_SELECT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef select # define select rpl_select # endif _GL_FUNCDECL_RPL (select, int, (int, fd_set *restrict, fd_set *restrict, fd_set *restrict, struct timeval *restrict)); _GL_CXXALIAS_RPL (select, int, (int, fd_set *restrict, fd_set *restrict, fd_set *restrict, timeval *restrict)); # else _GL_CXXALIAS_SYS (select, int, (int, fd_set *restrict, fd_set *restrict, fd_set *restrict, timeval *restrict)); # endif _GL_CXXALIASWARN (select); #elif @HAVE_WINSOCK2_H@ # undef select # define select select_used_without_requesting_gnulib_module_select #elif defined GNULIB_POSIXCHECK # undef select # if HAVE_RAW_DECL_SELECT _GL_WARN_ON_USE (select, "select is not always POSIX compliant - " "use gnulib module select for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_SYS_SELECT_H */ #endif /* _@GUARD_PREFIX@_SYS_SELECT_H */ #endif /* OSF/1 */ ����������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/hash-pjw.c��������������������������������������������������������0000664�0001750�0001750�00000002360�14670377430�020753� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* hash-pjw.c -- compute a hash value from a NUL-terminated string. Copyright (C) 2001, 2003, 2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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> #include "hash-pjw.h" #include <limits.h> #define SIZE_BITS (sizeof (size_t) * CHAR_BIT) /* A hash function for NUL-terminated char* strings using the method described by Bruno Haible. See https://www.haible.de/bruno/hashfunc.html. */ size_t hash_pjw (const void *x, size_t tablesize) { const char *s; size_t h = 0; for (s = x; *s; s++) h = *s + ((h << 9) | (h >> (SIZE_BITS - 9))); return h % tablesize; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/netinet_in.in.h���������������������������������������������������0000664�0001750�0001750�00000002536�14670377436�022013� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Substitute for <netinet/in.h>. Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _@GUARD_PREFIX@_NETINET_IN_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if @HAVE_NETINET_IN_H@ /* On many platforms, <netinet/in.h> assumes prior inclusion of <sys/types.h>. */ # include <sys/types.h> /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@ #endif #ifndef _@GUARD_PREFIX@_NETINET_IN_H #define _@GUARD_PREFIX@_NETINET_IN_H #if !@HAVE_NETINET_IN_H@ /* A platform that lacks <netinet/in.h>. */ # include <sys/socket.h> #endif #endif /* _@GUARD_PREFIX@_NETINET_IN_H */ #endif /* _@GUARD_PREFIX@_NETINET_IN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-xstrtoul.c���������������������������������������������������0000664�0001750�0001750�00000000156�14670377436�022122� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __xstrtol xstrtoul #define __strtol_t unsigned long int #define __spec "lu" #include "test-xstrtol.c" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-verify.c�����������������������������������������������������0000664�0001750�0001750�00000006166�14670377436�021531� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test the "verify" module. Copyright (C) 2005, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible. */ #include <config.h> #include "verify.h" #ifndef EXP_FAIL # define EXP_FAIL 0 #endif /* ======================= Test verify, verify_expr ======================= */ int gx; enum { A, B, C }; #if EXP_FAIL == 1 verify (gx >= 0); /* should give ERROR: non-constant expression */ #endif verify (C == 2); /* should be ok */ #if EXP_FAIL == 2 verify (1 + 1 == 3); /* should give ERROR */ #endif verify (1 == 1); verify (1 == 1); /* should be ok */ enum { item = verify_expr (1 == 1, 10 * 0 + 17) /* should be ok */ }; static int function (int n) { #if EXP_FAIL == 3 verify (n >= 0); /* should give ERROR: non-constant expression */ #endif verify (C == 2); /* should be ok */ #if EXP_FAIL == 4 verify (1 + 1 == 3); /* should give ERROR */ #endif verify (1 == 1); verify (1 == 1); /* should be ok */ if (n) return ((void) verify_expr (1 == 1, 1), verify_expr (1 == 1, 8)); /* should be ok */ #if EXP_FAIL == 5 return verify_expr (1 == 2, 5); /* should give ERROR */ #endif return 0; } /* ============================== Test assume ============================== */ static int f (int a) { return a; } typedef struct { unsigned int context : 4; unsigned int halt : 1; } state; void test_assume_expressions (state *s); int test_assume_optimization (int x); _Noreturn void test_assume_noreturn (void); void test_assume_expressions (state *s) { /* Check that 'assume' accepts a function call, even of a non-const function. */ assume (f (1)); /* Check that 'assume' accepts a bit-field expression. */ assume (s->halt); } int test_assume_optimization (int x) { /* Check that the compiler uses 'assume' for optimization. This function, when compiled with optimization, should have code equivalent to return x + 3; Use 'objdump --disassemble test-verify.o' to verify this. */ assume (x >= 4); return (x > 1 ? x + 3 : 2 * x + 10); } _Noreturn void test_assume_noreturn (void) { /* Check that the compiler's data-flow analysis recognizes 'assume (0)'. This function should not elicit a warning. */ assume (0); } /* ============================== Main ===================================== */ int main (void) { state s = { 0, 1 }; test_assume_expressions (&s); test_assume_optimization (5); return !(function (0) == 0 && function (1) == 8); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcrtomb-w32-2.sh���������������������������������������������0000775�0001750�0001750�00000000145�14670377437�022635� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test a CP1256 locale. ${CHECKER} ./test-wcrtomb-w32${EXEEXT} "Arabic_Saudi Arabia" 1256 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/vasnprintf.h������������������������������������������������������0000664�0001750�0001750�00000005031�14670377440�021430� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* vsprintf with automatic memory allocation. Copyright (C) 2002-2004, 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _VASNPRINTF_H #define _VASNPRINTF_H /* Get va_list. */ #include <stdarg.h> /* Get size_t. */ #include <stddef.h> /* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD. */ #include <stdio.h> #ifdef __cplusplus extern "C" { #endif /* Write formatted output to a string dynamically allocated with malloc(). You can pass a preallocated buffer for the result in RESULTBUF and its size in *LENGTHP; otherwise you pass RESULTBUF = NULL. If successful, return the address of the string (this may be = RESULTBUF if no dynamic memory allocation was necessary) and set *LENGTHP to the number of resulting bytes, excluding the trailing NUL. Upon error, set errno and return NULL. When dynamic memory allocation occurs, the preallocated buffer is left alone (with possibly modified contents). This makes it possible to use a statically allocated or stack-allocated buffer, like this: char buf[100]; size_t len = sizeof (buf); char *output = vasnprintf (buf, &len, format, args); if (output == NULL) ... error handling ...; else { ... use the output string ...; if (output != buf) free (output); } */ #if REPLACE_VASNPRINTF # define asnprintf rpl_asnprintf # define vasnprintf rpl_vasnprintf #endif extern char * asnprintf (char *restrict resultbuf, size_t *lengthp, const char *format, ...) _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 4)); extern char * vasnprintf (char *restrict resultbuf, size_t *lengthp, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 0)); #ifdef __cplusplus } #endif #endif /* _VASNPRINTF_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-environ.c����������������������������������������������������0000664�0001750�0001750�00000002730�14670377431�021671� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of environ variable. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include <unistd.h> #include <string.h> int main () { /* The environment variables that are set even in the weirdest situations are HOME and PATH. POSIX says that HOME is initialized by the system, and that PATH may be unset. But in practice it's more frequent to see HOME unset and PATH set. So we test the presence of PATH. */ char **remaining_variables = environ; char *string; for (; (string = *remaining_variables) != NULL; remaining_variables++) { if (strncmp (string, "PATH=", 5) == 0) /* Found the PATH environment variable. */ return 0; } /* Failed to find the PATH environment variable. */ return 1; } ����������������������������������������kbuild-3608/src/grep/gnulib-tests/xsize.c�����������������������������������������������������������0000664�0001750�0001750�00000001504�14670377440�020374� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checked size_t computations. Copyright (C) 2012-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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> #define XSIZE_INLINE _GL_EXTERN_INLINE #include "xsize.h" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-bitrotate.c��������������������������������������������������0000664�0001750�0001750�00000036415�14670377431�022215� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <bitrotate.h> substitute. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson <simon@josefsson.org>, 2008. */ #include <config.h> #include "bitrotate.h" #include "macros.h" int main (void) { ASSERT (rotl8 (42, 0) == 42); ASSERT (rotl8 (42, 1) == 84); ASSERT (rotl8 (42, 2) == 168); ASSERT (rotl8 (42, 3) == 81); ASSERT (rotl8 (42, 4) == 162); ASSERT (rotl8 (42, 5) == 69); ASSERT (rotl8 (42, 6) == 138); ASSERT (rotl8 (42, 7) == 21); ASSERT (rotl8 (42, 8) == 42); ASSERT (rotr8 (42, 0) == 42); ASSERT (rotr8 (42, 1) == 21); ASSERT (rotr8 (42, 2) == 138); ASSERT (rotr8 (42, 3) == 69); ASSERT (rotr8 (42, 4) == 162); ASSERT (rotr8 (42, 5) == 81); ASSERT (rotr8 (42, 6) == 168); ASSERT (rotr8 (42, 7) == 84); ASSERT (rotr8 (42, 8) == 42); ASSERT (rotl16 (43981, 0) == 43981); ASSERT (rotl16 (43981, 1) == 22427); ASSERT (rotl16 (43981, 2) == 44854); ASSERT (rotl16 (43981, 3) == 24173); ASSERT (rotl16 (43981, 4) == 48346); ASSERT (rotl16 (43981, 5) == 31157); ASSERT (rotl16 (43981, 6) == 62314); ASSERT (rotl16 (43981, 7) == 59093); ASSERT (rotl16 (43981, 8) == 52651); ASSERT (rotl16 (43981, 9) == 39767); ASSERT (rotl16 (43981, 10) == 13999); ASSERT (rotl16 (43981, 11) == 27998); ASSERT (rotl16 (43981, 12) == 55996); ASSERT (rotl16 (43981, 13) == 46457); ASSERT (rotl16 (43981, 14) == 27379); ASSERT (rotl16 (43981, 15) == 54758); ASSERT (rotl16 (43981, 16) == 43981); ASSERT (rotr16 (43981, 0) == 43981); ASSERT (rotr16 (43981, 1) == 54758); ASSERT (rotr16 (43981, 2) == 27379); ASSERT (rotr16 (43981, 3) == 46457); ASSERT (rotr16 (43981, 4) == 55996); ASSERT (rotr16 (43981, 5) == 27998); ASSERT (rotr16 (43981, 6) == 13999); ASSERT (rotr16 (43981, 7) == 39767); ASSERT (rotr16 (43981, 8) == 52651); ASSERT (rotr16 (43981, 9) == 59093); ASSERT (rotr16 (43981, 10) == 62314); ASSERT (rotr16 (43981, 11) == 31157); ASSERT (rotr16 (43981, 12) == 48346); ASSERT (rotr16 (43981, 13) == 24173); ASSERT (rotr16 (43981, 14) == 44854); ASSERT (rotr16 (43981, 15) == 22427); ASSERT (rotr16 (43981, 16) == 43981); ASSERT (rotl32 (2309737967U, 1) == 324508639U); ASSERT (rotl32 (2309737967U, 2) == 649017278U); ASSERT (rotl32 (2309737967U, 3) == 1298034556U); ASSERT (rotl32 (2309737967U, 4) == 2596069112U); ASSERT (rotl32 (2309737967U, 5) == 897170929U); ASSERT (rotl32 (2309737967U, 6) == 1794341858U); ASSERT (rotl32 (2309737967U, 7) == 3588683716U); ASSERT (rotl32 (2309737967U, 8) == 2882400137U); ASSERT (rotl32 (2309737967U, 9) == 1469832979U); ASSERT (rotl32 (2309737967U, 10) == 2939665958U); ASSERT (rotl32 (2309737967U, 11) == 1584364621U); ASSERT (rotl32 (2309737967U, 12) == 3168729242U); ASSERT (rotl32 (2309737967U, 13) == 2042491189U); ASSERT (rotl32 (2309737967U, 14) == 4084982378U); ASSERT (rotl32 (2309737967U, 15) == 3874997461U); ASSERT (rotl32 (2309737967U, 16) == 3455027627U); ASSERT (rotl32 (2309737967U, 17) == 2615087959U); ASSERT (rotl32 (2309737967U, 18) == 935208623U); ASSERT (rotl32 (2309737967U, 19) == 1870417246U); ASSERT (rotl32 (2309737967U, 20) == 3740834492U); ASSERT (rotl32 (2309737967U, 21) == 3186701689U); ASSERT (rotl32 (2309737967U, 22) == 2078436083U); ASSERT (rotl32 (2309737967U, 23) == 4156872166U); ASSERT (rotl32 (2309737967U, 24) == 4018777037U); ASSERT (rotl32 (2309737967U, 25) == 3742586779U); ASSERT (rotl32 (2309737967U, 26) == 3190206263U); ASSERT (rotl32 (2309737967U, 27) == 2085445231U); ASSERT (rotl32 (2309737967U, 28) == 4170890462U); ASSERT (rotl32 (2309737967U, 29) == 4046813629U); ASSERT (rotl32 (2309737967U, 30) == 3798659963U); ASSERT (rotl32 (2309737967U, 31) == 3302352631U); ASSERT (rotr32 (2309737967U, 1) == 3302352631lU); ASSERT (rotr32 (2309737967U, 2) == 3798659963lU); ASSERT (rotr32 (2309737967U, 3) == 4046813629lU); ASSERT (rotr32 (2309737967U, 4) == 4170890462lU); ASSERT (rotr32 (2309737967U, 5) == 2085445231lU); ASSERT (rotr32 (2309737967U, 6) == 3190206263lU); ASSERT (rotr32 (2309737967U, 7) == 3742586779lU); ASSERT (rotr32 (2309737967U, 8) == 4018777037lU); ASSERT (rotr32 (2309737967U, 9) == 4156872166lU); ASSERT (rotr32 (2309737967U, 10) == 2078436083lU); ASSERT (rotr32 (2309737967U, 11) == 3186701689lU); ASSERT (rotr32 (2309737967U, 12) == 3740834492lU); ASSERT (rotr32 (2309737967U, 13) == 1870417246lU); ASSERT (rotr32 (2309737967U, 14) == 935208623lU); ASSERT (rotr32 (2309737967U, 15) == 2615087959lU); ASSERT (rotr32 (2309737967U, 16) == 3455027627lU); ASSERT (rotr32 (2309737967U, 17) == 3874997461lU); ASSERT (rotr32 (2309737967U, 18) == 4084982378lU); ASSERT (rotr32 (2309737967U, 19) == 2042491189lU); ASSERT (rotr32 (2309737967U, 20) == 3168729242lU); ASSERT (rotr32 (2309737967U, 21) == 1584364621lU); ASSERT (rotr32 (2309737967U, 22) == 2939665958lU); ASSERT (rotr32 (2309737967U, 23) == 1469832979lU); ASSERT (rotr32 (2309737967U, 24) == 2882400137lU); ASSERT (rotr32 (2309737967U, 25) == 3588683716lU); ASSERT (rotr32 (2309737967U, 26) == 1794341858lU); ASSERT (rotr32 (2309737967U, 27) == 897170929lU); ASSERT (rotr32 (2309737967U, 28) == 2596069112lU); ASSERT (rotr32 (2309737967U, 29) == 1298034556lU); ASSERT (rotr32 (2309737967U, 30) == 649017278lU); ASSERT (rotr32 (2309737967U, 31) == 324508639lU); #ifdef UINT64_MAX ASSERT (rotl64 (16045690984503098046ULL, 1) == 13644637895296644477ULL); ASSERT (rotl64 (16045690984503098046ULL, 2) == 8842531716883737339ULL); ASSERT (rotl64 (16045690984503098046ULL, 3) == 17685063433767474678ULL); ASSERT (rotl64 (16045690984503098046ULL, 4) == 16923382793825397741ULL); ASSERT (rotl64 (16045690984503098046ULL, 5) == 15400021513941243867ULL); ASSERT (rotl64 (16045690984503098046ULL, 6) == 12353298954172936119ULL); ASSERT (rotl64 (16045690984503098046ULL, 7) == 6259853834636320623ULL); ASSERT (rotl64 (16045690984503098046ULL, 8) == 12519707669272641246ULL); ASSERT (rotl64 (16045690984503098046ULL, 9) == 6592671264835730877ULL); ASSERT (rotl64 (16045690984503098046ULL, 10) == 13185342529671461754ULL); ASSERT (rotl64 (16045690984503098046ULL, 11) == 7923940985633371893ULL); ASSERT (rotl64 (16045690984503098046ULL, 12) == 15847881971266743786ULL); ASSERT (rotl64 (16045690984503098046ULL, 13) == 13249019868823935957ULL); ASSERT (rotl64 (16045690984503098046ULL, 14) == 8051295663938320299ULL); ASSERT (rotl64 (16045690984503098046ULL, 15) == 16102591327876640598ULL); ASSERT (rotl64 (16045690984503098046ULL, 16) == 13758438582043729581ULL); ASSERT (rotl64 (16045690984503098046ULL, 17) == 9070133090377907547ULL); ASSERT (rotl64 (16045690984503098046ULL, 18) == 18140266180755815094ULL); ASSERT (rotl64 (16045690984503098046ULL, 19) == 17833788287802078573ULL); ASSERT (rotl64 (16045690984503098046ULL, 20) == 17220832501894605531ULL); ASSERT (rotl64 (16045690984503098046ULL, 21) == 15994920930079659447ULL); ASSERT (rotl64 (16045690984503098046ULL, 22) == 13543097786449767279ULL); ASSERT (rotl64 (16045690984503098046ULL, 23) == 8639451499189982943ULL); ASSERT (rotl64 (16045690984503098046ULL, 24) == 17278902998379965886ULL); ASSERT (rotl64 (16045690984503098046ULL, 25) == 16111061923050380157ULL); ASSERT (rotl64 (16045690984503098046ULL, 26) == 13775379772391208699ULL); ASSERT (rotl64 (16045690984503098046ULL, 27) == 9104015471072865783ULL); ASSERT (rotl64 (16045690984503098046ULL, 28) == 18208030942145731566ULL); ASSERT (rotl64 (16045690984503098046ULL, 29) == 17969317810581911517ULL); ASSERT (rotl64 (16045690984503098046ULL, 30) == 17491891547454271419ULL); ASSERT (rotl64 (16045690984503098046ULL, 31) == 16537039021198991223ULL); ASSERT (rotl64 (16045690984503098046ULL, 32) == 14627333968688430831ULL); ASSERT (rotl64 (16045690984503098046ULL, 33) == 10807923863667310047ULL); ASSERT (rotl64 (16045690984503098046ULL, 34) == 3169103653625068479ULL); ASSERT (rotl64 (16045690984503098046ULL, 35) == 6338207307250136958ULL); ASSERT (rotl64 (16045690984503098046ULL, 36) == 12676414614500273916ULL); ASSERT (rotl64 (16045690984503098046ULL, 37) == 6906085155290996217ULL); ASSERT (rotl64 (16045690984503098046ULL, 38) == 13812170310581992434ULL); ASSERT (rotl64 (16045690984503098046ULL, 39) == 9177596547454433253ULL); ASSERT (rotl64 (16045690984503098046ULL, 40) == 18355193094908866506ULL); ASSERT (rotl64 (16045690984503098046ULL, 41) == 18263642116108181397ULL); ASSERT (rotl64 (16045690984503098046ULL, 42) == 18080540158506811179ULL); ASSERT (rotl64 (16045690984503098046ULL, 43) == 17714336243304070743ULL); ASSERT (rotl64 (16045690984503098046ULL, 44) == 16981928412898589871ULL); ASSERT (rotl64 (16045690984503098046ULL, 45) == 15517112752087628127ULL); ASSERT (rotl64 (16045690984503098046ULL, 46) == 12587481430465704639ULL); ASSERT (rotl64 (16045690984503098046ULL, 47) == 6728218787221857663ULL); ASSERT (rotl64 (16045690984503098046ULL, 48) == 13456437574443715326ULL); ASSERT (rotl64 (16045690984503098046ULL, 49) == 8466131075177879037ULL); ASSERT (rotl64 (16045690984503098046ULL, 50) == 16932262150355758074ULL); ASSERT (rotl64 (16045690984503098046ULL, 51) == 15417780227001964533ULL); ASSERT (rotl64 (16045690984503098046ULL, 52) == 12388816380294377451ULL); ASSERT (rotl64 (16045690984503098046ULL, 53) == 6330888686879203287ULL); ASSERT (rotl64 (16045690984503098046ULL, 54) == 12661777373758406574ULL); ASSERT (rotl64 (16045690984503098046ULL, 55) == 6876810673807261533ULL); ASSERT (rotl64 (16045690984503098046ULL, 56) == 13753621347614523066ULL); ASSERT (rotl64 (16045690984503098046ULL, 57) == 9060498621519494517ULL); ASSERT (rotl64 (16045690984503098046ULL, 58) == 18120997243038989034ULL); ASSERT (rotl64 (16045690984503098046ULL, 59) == 17795250412368426453ULL); ASSERT (rotl64 (16045690984503098046ULL, 60) == 17143756751027301291ULL); ASSERT (rotl64 (16045690984503098046ULL, 61) == 15840769428345050967ULL); ASSERT (rotl64 (16045690984503098046ULL, 62) == 13234794782980550319ULL); ASSERT (rotl64 (16045690984503098046ULL, 63) == 8022845492251549023ULL); ASSERT (rotr64 (16045690984503098046ULL, 1) == 8022845492251549023ULL); ASSERT (rotr64 (16045690984503098046ULL, 2) == 13234794782980550319ULL); ASSERT (rotr64 (16045690984503098046ULL, 3) == 15840769428345050967ULL); ASSERT (rotr64 (16045690984503098046ULL, 4) == 17143756751027301291ULL); ASSERT (rotr64 (16045690984503098046ULL, 5) == 17795250412368426453ULL); ASSERT (rotr64 (16045690984503098046ULL, 6) == 18120997243038989034ULL); ASSERT (rotr64 (16045690984503098046ULL, 7) == 9060498621519494517ULL); ASSERT (rotr64 (16045690984503098046ULL, 8) == 13753621347614523066ULL); ASSERT (rotr64 (16045690984503098046ULL, 9) == 6876810673807261533ULL); ASSERT (rotr64 (16045690984503098046ULL, 10) == 12661777373758406574ULL); ASSERT (rotr64 (16045690984503098046ULL, 11) == 6330888686879203287ULL); ASSERT (rotr64 (16045690984503098046ULL, 12) == 12388816380294377451ULL); ASSERT (rotr64 (16045690984503098046ULL, 13) == 15417780227001964533ULL); ASSERT (rotr64 (16045690984503098046ULL, 14) == 16932262150355758074ULL); ASSERT (rotr64 (16045690984503098046ULL, 15) == 8466131075177879037ULL); ASSERT (rotr64 (16045690984503098046ULL, 16) == 13456437574443715326ULL); ASSERT (rotr64 (16045690984503098046ULL, 17) == 6728218787221857663ULL); ASSERT (rotr64 (16045690984503098046ULL, 18) == 12587481430465704639ULL); ASSERT (rotr64 (16045690984503098046ULL, 19) == 15517112752087628127ULL); ASSERT (rotr64 (16045690984503098046ULL, 20) == 16981928412898589871ULL); ASSERT (rotr64 (16045690984503098046ULL, 21) == 17714336243304070743ULL); ASSERT (rotr64 (16045690984503098046ULL, 22) == 18080540158506811179ULL); ASSERT (rotr64 (16045690984503098046ULL, 23) == 18263642116108181397ULL); ASSERT (rotr64 (16045690984503098046ULL, 24) == 18355193094908866506ULL); ASSERT (rotr64 (16045690984503098046ULL, 25) == 9177596547454433253ULL); ASSERT (rotr64 (16045690984503098046ULL, 26) == 13812170310581992434ULL); ASSERT (rotr64 (16045690984503098046ULL, 27) == 6906085155290996217ULL); ASSERT (rotr64 (16045690984503098046ULL, 28) == 12676414614500273916ULL); ASSERT (rotr64 (16045690984503098046ULL, 29) == 6338207307250136958ULL); ASSERT (rotr64 (16045690984503098046ULL, 30) == 3169103653625068479ULL); ASSERT (rotr64 (16045690984503098046ULL, 31) == 10807923863667310047ULL); ASSERT (rotr64 (16045690984503098046ULL, 32) == 14627333968688430831ULL); ASSERT (rotr64 (16045690984503098046ULL, 33) == 16537039021198991223ULL); ASSERT (rotr64 (16045690984503098046ULL, 34) == 17491891547454271419ULL); ASSERT (rotr64 (16045690984503098046ULL, 35) == 17969317810581911517ULL); ASSERT (rotr64 (16045690984503098046ULL, 36) == 18208030942145731566ULL); ASSERT (rotr64 (16045690984503098046ULL, 37) == 9104015471072865783ULL); ASSERT (rotr64 (16045690984503098046ULL, 38) == 13775379772391208699ULL); ASSERT (rotr64 (16045690984503098046ULL, 39) == 16111061923050380157ULL); ASSERT (rotr64 (16045690984503098046ULL, 40) == 17278902998379965886ULL); ASSERT (rotr64 (16045690984503098046ULL, 41) == 8639451499189982943ULL); ASSERT (rotr64 (16045690984503098046ULL, 42) == 13543097786449767279ULL); ASSERT (rotr64 (16045690984503098046ULL, 43) == 15994920930079659447ULL); ASSERT (rotr64 (16045690984503098046ULL, 44) == 17220832501894605531ULL); ASSERT (rotr64 (16045690984503098046ULL, 45) == 17833788287802078573ULL); ASSERT (rotr64 (16045690984503098046ULL, 46) == 18140266180755815094ULL); ASSERT (rotr64 (16045690984503098046ULL, 47) == 9070133090377907547ULL); ASSERT (rotr64 (16045690984503098046ULL, 48) == 13758438582043729581ULL); ASSERT (rotr64 (16045690984503098046ULL, 49) == 16102591327876640598ULL); ASSERT (rotr64 (16045690984503098046ULL, 50) == 8051295663938320299ULL); ASSERT (rotr64 (16045690984503098046ULL, 51) == 13249019868823935957ULL); ASSERT (rotr64 (16045690984503098046ULL, 52) == 15847881971266743786ULL); ASSERT (rotr64 (16045690984503098046ULL, 53) == 7923940985633371893ULL); ASSERT (rotr64 (16045690984503098046ULL, 54) == 13185342529671461754ULL); ASSERT (rotr64 (16045690984503098046ULL, 55) == 6592671264835730877ULL); ASSERT (rotr64 (16045690984503098046ULL, 56) == 12519707669272641246ULL); ASSERT (rotr64 (16045690984503098046ULL, 57) == 6259853834636320623ULL); ASSERT (rotr64 (16045690984503098046ULL, 58) == 12353298954172936119ULL); ASSERT (rotr64 (16045690984503098046ULL, 59) == 15400021513941243867ULL); ASSERT (rotr64 (16045690984503098046ULL, 60) == 16923382793825397741ULL); ASSERT (rotr64 (16045690984503098046ULL, 61) == 17685063433767474678ULL); ASSERT (rotr64 (16045690984503098046ULL, 62) == 8842531716883737339ULL); ASSERT (rotr64 (16045690984503098046ULL, 63) == 13644637895296644477ULL); #endif /* UINT64_MAX */ return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-setlocale_null.c���������������������������������������������0000664�0001750�0001750�00000002152�14670377436�023221� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of setlocale_null_r function. Copyright (C) 2019-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2019. */ #include <config.h> /* Specification. */ #include <locale.h> /* Check that SETLOCALE_NULL_ALL_MAX is a constant expression. */ static char buf[SETLOCALE_NULL_ALL_MAX]; int main () { /* Check that setlocale_null_r() can be used with $(LIB_SETLOCALE_NULL). */ return setlocale_null_r (LC_ALL, buf, sizeof (buf)) != 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-ioctl.c������������������������������������������������������0000664�0001750�0001750�00000002415�14670377436�021330� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of ioctl() function. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include <sys/ioctl.h> #include "signature.h" SIGNATURE_CHECK (ioctl, int, (int, int, ...)); #include <errno.h> #include <unistd.h> #include "macros.h" int main (void) { #ifdef FIONREAD /* Test behaviour for invalid file descriptors. */ { int value; errno = 0; ASSERT (ioctl (-1, FIONREAD, &value) == -1); ASSERT (errno == EBADF); } { int value; close (99); errno = 0; ASSERT (ioctl (99, FIONREAD, &value) == -1); ASSERT (errno == EBADF); } #endif return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-strtoumax.c��������������������������������������������������0000664�0001750�0001750�00000010174�14670377436�022265� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <inttypes.h> #include "signature.h" #ifndef strtoumax SIGNATURE_CHECK (strtoumax, uintmax_t, (const char *, char **, int)); #endif #include <errno.h> #include "macros.h" int main (void) { /* Subject sequence empty or invalid. */ { const char input[] = ""; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " "; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " +"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " -"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } /* Simple integer values. */ { const char input[] = "0"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 1); ASSERT (errno == 0); } { const char input[] = "+0"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = "-0"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = "23"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = " 23"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } { const char input[] = "+23"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } { const char input[] = "-23"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == - (uintmax_t) 23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } /* Large integer values. */ { const char input[] = "2147483647"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 2147483647); ASSERT (ptr == input + 10); ASSERT (errno == 0); } { const char input[] = "-2147483648"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == - (uintmax_t) 2147483648U); ASSERT (ptr == input + 11); ASSERT (errno == 0); } { const char input[] = "4294967295"; char *ptr; uintmax_t result; errno = 0; result = strtoumax (input, &ptr, 10); ASSERT (result == 4294967295U); ASSERT (ptr == input + 10); ASSERT (errno == 0); } return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-exclude.c����������������������������������������������������0000664�0001750�0001750�00000006230�14670377431�021641� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test suite for exclude. Copyright (C) 2009-2021 Free Software Foundation, Inc. This file is part of the GNUlib Library. 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <stdbool.h> #include <fnmatch.h> #include "exclude.h" #include "error.h" #include "argmatch.h" #ifndef FNM_CASEFOLD # define FNM_CASEFOLD 0 #endif #ifndef FNM_LEADING_DIR # define FNM_LEADING_DIR 0 #endif char const * const exclude_keywords[] = { "noescape", "pathname", "period", "leading_dir", "casefold", "anchored", "include", "wildcards", NULL }; int exclude_flags[] = { FNM_NOESCAPE, FNM_PATHNAME, FNM_PERIOD, FNM_LEADING_DIR, FNM_CASEFOLD, EXCLUDE_ANCHORED, EXCLUDE_INCLUDE, EXCLUDE_WILDCARDS }; ARGMATCH_VERIFY (exclude_keywords, exclude_flags); /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and thus must link with a definition of that function. Provide it here. */ #ifdef ARGMATCH_DIE_DECL _Noreturn ARGMATCH_DIE_DECL; ARGMATCH_DIE_DECL { exit (1); } #endif int main (int argc, char **argv) { int exclude_options = 0; struct exclude *exclude = new_exclude (); if (argc == 1) error (1, 0, "usage: %s file -- words...", argv[0]); while (--argc) { char *opt = *++argv; if (opt[0] == '-') { int neg = 0; int flag; char *s = opt + 1; if (opt[1] == '-' && opt[2] == 0) { argc--; break; } if (strlen (s) > 3 && memcmp (s, "no-", 3) == 0) { neg = 1; s += 3; } flag = XARGMATCH (opt, s, exclude_keywords, exclude_flags); if (neg) exclude_options &= ~flag; else exclude_options |= flag; /* Skip this test if invoked with -leading-dir on a system that lacks support for FNM_LEADING_DIR. */ if (strcmp (s, "leading_dir") == 0 && FNM_LEADING_DIR == 0) exit (77); /* Likewise for -casefold and FNM_CASEFOLD. */ if (strcmp (s, "casefold") == 0 && FNM_CASEFOLD == 0) exit (77); } else if (add_exclude_file (add_exclude, exclude, opt, exclude_options, '\n') != 0) error (1, errno, "error loading %s", opt); } for (; argc; --argc) { char *word = *++argv; printf ("%s: %d\n", word, excluded_file_name (exclude, word)); } free_exclude (exclude); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/perror.c����������������������������������������������������������0000664�0001750�0001750�00000003005�14670377431�020541� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Print a message describing error code. Copyright (C) 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include "strerror-override.h" /* Use the system functions, not the gnulib overrides in this file. */ #undef fprintf void perror (const char *string) { char stackbuf[STACKBUF_LEN]; int ret; /* Our implementation guarantees that this will be a non-empty string, even if it returns EINVAL; and stackbuf should be sized large enough to avoid ERANGE. */ ret = strerror_r (errno, stackbuf, sizeof stackbuf); if (ret == ERANGE) abort (); if (string != NULL && *string != '\0') fprintf (stderr, "%s: %s\n", string, stackbuf); else fprintf (stderr, "%s\n", stackbuf); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-isblank.c����������������������������������������������������0000664�0001750�0001750�00000003052�14670377436�021637� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of isblank() function. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ #include <config.h> #include <ctype.h> #include "signature.h" SIGNATURE_CHECK (isblank, int, (int)); #include <limits.h> #include <stdio.h> #include "macros.h" int main (int argc, char *argv[]) { unsigned int c; /* Verify the property in the "C" locale. POSIX specifies in <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html> that - in all locales, the blank characters include the <space> and <tab> characters, - in the "POSIX" locale (which is usually the same as the "C" locale), the blank characters include only the ASCII <space> and <tab> characters. */ for (c = 0; c <= UCHAR_MAX; c++) ASSERT (!isblank (c) == !(c == ' ' || c == '\t')); ASSERT (!isblank (EOF)); return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/unsetenv.c��������������������������������������������������������0000664�0001750�0001750�00000005514�14670377437�021114� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1992, 1995-2002, 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. 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 Lesser General Public License for more details. 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/>. */ /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc optimizes away the name == NULL test below. */ #define _GL_ARG_NONNULL(params) #include <config.h> /* Specification. */ #include <stdlib.h> #include <errno.h> #if !_LIBC # define __set_errno(ev) ((errno) = (ev)) #endif #include <string.h> #include <unistd.h> #if !_LIBC # define __environ environ #endif #if _LIBC /* This lock protects against simultaneous modifications of 'environ'. */ # include <bits/libc-lock.h> __libc_lock_define_initialized (static, envlock) # define LOCK __libc_lock_lock (envlock) # define UNLOCK __libc_lock_unlock (envlock) #else # define LOCK # define UNLOCK #endif /* In the GNU C library we must keep the namespace clean. */ #ifdef _LIBC # define unsetenv __unsetenv #endif #if _LIBC || !HAVE_UNSETENV int unsetenv (const char *name) { size_t len; char **ep; if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { __set_errno (EINVAL); return -1; } len = strlen (name); LOCK; ep = __environ; while (*ep != NULL) if (!strncmp (*ep, name, len) && (*ep)[len] == '=') { /* Found it. Remove this pointer by moving later ones back. */ char **dp = ep; do dp[0] = dp[1]; while (*dp++); /* Continue the loop in case NAME appears again. */ } else ++ep; UNLOCK; return 0; } #ifdef _LIBC # undef unsetenv weak_alias (__unsetenv, unsetenv) #endif #else /* HAVE_UNSETENV */ # undef unsetenv # if !HAVE_DECL_UNSETENV # if VOID_UNSETENV extern void unsetenv (const char *); # else extern int unsetenv (const char *); # endif # endif /* Call the underlying unsetenv, in case there is hidden bookkeeping that needs updating beyond just modifying environ. */ int rpl_unsetenv (const char *name) { int result = 0; if (!name || !*name || strchr (name, '=')) { errno = EINVAL; return -1; } while (getenv (name)) # if !VOID_UNSETENV result = # endif unsetenv (name); return result; } #endif /* HAVE_UNSETENV */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/arg-nonnull.h�����������������������������������������������������0000664�0001750�0001750�00000002353�14670377430�021475� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* A C macro for declaring that specific arguments must not be NULL. Copyright (C) 2009-2021 Free Software Foundation, Inc. This program 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 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 Lesser General Public License for more details. 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/>. */ /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools that the values passed as arguments n, ..., m must be non-NULL pointers. n = 1 stands for the first argument, n = 2 for the second argument etc. */ #ifndef _GL_ARG_NONNULL # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) # else # define _GL_ARG_NONNULL(params) # endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fcntl.c������������������������������������������������������0000664�0001750�0001750�00000025120�14670377431�021315� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of fcntl(2). Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> /* Specification. */ #include <fcntl.h> #include "signature.h" SIGNATURE_CHECK (fcntl, int, (int, int, ...)); /* Helpers. */ #include <errno.h> #include <stdarg.h> #include <stdbool.h> #include <unistd.h> #if defined _WIN32 && ! defined __CYGWIN__ /* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include <io.h> # endif #endif #include "binary-io.h" #include "macros.h" #if !O_BINARY # define set_binary_mode(f,m) zero () static int zero (void) { return 0; } #endif /* Return true if FD is open. */ static bool is_open (int fd) { #if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows, the initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE, and there is no fcntl. */ return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; #else # ifndef F_GETFL # error Please port fcntl to your platform # endif return 0 <= fcntl (fd, F_GETFL); #endif } /* Return true if FD is open and inheritable across exec/spawn. */ static bool is_inheritable (int fd) { #if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows, the initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE, and there is no fcntl. */ HANDLE h = (HANDLE) _get_osfhandle (fd); DWORD flags; if (h == INVALID_HANDLE_VALUE || GetHandleInformation (h, &flags) == 0) return false; return (flags & HANDLE_FLAG_INHERIT) != 0; #else # ifndef F_GETFD # error Please port fcntl to your platform # endif int i = fcntl (fd, F_GETFD); return 0 <= i && (i & FD_CLOEXEC) == 0; #endif } /* Return non-zero if FD is open in the given MODE, which is either O_TEXT or O_BINARY. */ static bool is_mode (int fd, int mode) { int value = set_binary_mode (fd, O_BINARY); set_binary_mode (fd, value); return mode == value; } /* Since native fcntl can have more supported operations than our replacement is aware of, and since various operations assign different types to the vararg argument, a wrapper around fcntl must be able to pass a vararg of unknown type on through to the original fcntl. Make sure that this works properly: func1 behaves like the original fcntl interpreting the vararg as an int or a pointer to a struct, and func2 behaves like rpl_fcntl that doesn't know what type to forward. */ struct dummy_struct { long filler; int value; }; static int func1 (int a, ...) { va_list arg; int i; va_start (arg, a); if (a < 4) i = va_arg (arg, int); else { struct dummy_struct *s = va_arg (arg, struct dummy_struct *); i = s->value; } va_end (arg); return i; } static int func2 (int a, ...) { va_list arg; void *p; va_start (arg, a); p = va_arg (arg, void *); va_end (arg); return func1 (a, p); } /* Ensure that all supported fcntl actions are distinct, and usable in preprocessor expressions. */ static void check_flags (void) { switch (0) { case F_DUPFD: #if F_DUPFD #endif case F_DUPFD_CLOEXEC: #if F_DUPFD_CLOEXEC #endif case F_GETFD: #if F_GETFD #endif #ifdef F_SETFD case F_SETFD: # if F_SETFD # endif #endif #ifdef F_GETFL case F_GETFL: # if F_GETFL # endif #endif #ifdef F_SETFL case F_SETFL: # if F_SETFL # endif #endif #ifdef F_GETOWN case F_GETOWN: # if F_GETOWN # endif #endif #ifdef F_SETOWN case F_SETOWN: # if F_SETOWN # endif #endif #ifdef F_GETLK case F_GETLK: # if F_GETLK # endif #endif #ifdef F_SETLK case F_SETLK: # if F_SETLK # endif #endif #ifdef F_SETLKW case F_SETLKW: # if F_SETLKW # endif #endif default: ; } } int main (int argc, char *argv[]) { if (argc > 1) /* child process */ return (is_open (10) ? 42 : 0); const char *file = "test-fcntl.tmp"; int fd; int bad_fd = getdtablesize (); /* Sanity check that rpl_fcntl is likely to work. */ ASSERT (func2 (1, 2) == 2); ASSERT (func2 (2, -2) == -2); ASSERT (func2 (3, 0x80000000) == 0x80000000); { struct dummy_struct s = { 0L, 4 }; ASSERT (func2 (4, &s) == 4); } check_flags (); /* Assume std descriptors were provided by invoker, and ignore fds that might have been inherited. */ fd = creat (file, 0600); ASSERT (STDERR_FILENO < fd); close (fd + 1); close (fd + 2); /* For F_DUPFD*, the source must be valid. */ errno = 0; ASSERT (fcntl (-1, F_DUPFD, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (fd + 1, F_DUPFD, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (bad_fd, F_DUPFD, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (-1, F_DUPFD_CLOEXEC, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (fd + 1, F_DUPFD_CLOEXEC, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (bad_fd, F_DUPFD_CLOEXEC, 0) == -1); ASSERT (errno == EBADF); /* For F_DUPFD*, the destination must be valid. */ errno = 0; ASSERT (fcntl (fd, F_DUPFD, -1) == -1); ASSERT (errno == EINVAL); errno = 0; ASSERT (fcntl (fd, F_DUPFD, bad_fd) == -1); ASSERT (errno == EINVAL); errno = 0; ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, -1) == -1); ASSERT (errno == EINVAL); errno = 0; ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, bad_fd) == -1); ASSERT (errno == EINVAL || errno == EMFILE /* WSL */); /* For F_DUPFD*, check for correct inheritance, as well as preservation of text vs. binary. */ set_binary_mode (fd, O_BINARY); ASSERT (is_open (fd)); ASSERT (!is_open (fd + 1)); ASSERT (!is_open (fd + 2)); ASSERT (is_inheritable (fd)); ASSERT (is_mode (fd, O_BINARY)); ASSERT (fcntl (fd, F_DUPFD, fd) == fd + 1); ASSERT (is_open (fd)); ASSERT (is_open (fd + 1)); ASSERT (!is_open (fd + 2)); ASSERT (is_inheritable (fd + 1)); ASSERT (is_mode (fd, O_BINARY)); ASSERT (is_mode (fd + 1, O_BINARY)); ASSERT (close (fd + 1) == 0); ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, fd + 2) == fd + 2); ASSERT (is_open (fd)); ASSERT (!is_open (fd + 1)); ASSERT (is_open (fd + 2)); ASSERT (is_inheritable (fd)); ASSERT (!is_inheritable (fd + 2)); ASSERT (is_mode (fd, O_BINARY)); ASSERT (is_mode (fd + 2, O_BINARY)); ASSERT (close (fd) == 0); set_binary_mode (fd + 2, O_TEXT); ASSERT (fcntl (fd + 2, F_DUPFD, fd + 1) == fd + 1); ASSERT (!is_open (fd)); ASSERT (is_open (fd + 1)); ASSERT (is_open (fd + 2)); ASSERT (is_inheritable (fd + 1)); ASSERT (!is_inheritable (fd + 2)); ASSERT (is_mode (fd + 1, O_TEXT)); ASSERT (is_mode (fd + 2, O_TEXT)); ASSERT (close (fd + 1) == 0); ASSERT (fcntl (fd + 2, F_DUPFD_CLOEXEC, 0) == fd); ASSERT (is_open (fd)); ASSERT (!is_open (fd + 1)); ASSERT (is_open (fd + 2)); ASSERT (!is_inheritable (fd)); ASSERT (!is_inheritable (fd + 2)); ASSERT (is_mode (fd, O_TEXT)); ASSERT (is_mode (fd + 2, O_TEXT)); ASSERT (close (fd + 2) == 0); /* Test F_GETFD on invalid file descriptors. */ errno = 0; ASSERT (fcntl (-1, F_GETFD) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (fd + 1, F_GETFD) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (bad_fd, F_GETFD) == -1); ASSERT (errno == EBADF); /* Test F_GETFD, the FD_CLOEXEC bit. */ { int result = fcntl (fd, F_GETFD); ASSERT (0 <= result); ASSERT ((result & FD_CLOEXEC) == FD_CLOEXEC); ASSERT (dup (fd) == fd + 1); result = fcntl (fd + 1, F_GETFD); ASSERT (0 <= result); ASSERT ((result & FD_CLOEXEC) == 0); ASSERT (close (fd + 1) == 0); } #ifdef F_SETFD /* Test F_SETFD on invalid file descriptors. */ errno = 0; ASSERT (fcntl (-1, F_SETFD, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (fd + 1, F_SETFD, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (bad_fd, F_SETFD, 0) == -1); ASSERT (errno == EBADF); #endif #ifdef F_GETFL /* Test F_GETFL on invalid file descriptors. */ errno = 0; ASSERT (fcntl (-1, F_GETFL) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (fd + 1, F_GETFL) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (bad_fd, F_GETFL) == -1); ASSERT (errno == EBADF); #endif #ifdef F_SETFL /* Test F_SETFL on invalid file descriptors. */ errno = 0; ASSERT (fcntl (-1, F_SETFL, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (fd + 1, F_SETFL, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (bad_fd, F_SETFL, 0) == -1); ASSERT (errno == EBADF); #endif #ifdef F_GETOWN /* Test F_GETOWN on invalid file descriptors. */ errno = 0; ASSERT (fcntl (-1, F_GETOWN) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (fd + 1, F_GETOWN) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (bad_fd, F_GETOWN) == -1); ASSERT (errno == EBADF); #endif #ifdef F_SETOWN /* Test F_SETFL on invalid file descriptors. */ errno = 0; ASSERT (fcntl (-1, F_SETOWN, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (fd + 1, F_SETOWN, 0) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (fcntl (bad_fd, F_SETOWN, 0) == -1); ASSERT (errno == EBADF); #endif /* Cleanup. */ ASSERT (close (fd) == 0); ASSERT (unlink (file) == 0); /* Close file descriptors that may have been inherited from the parent process and that would cause failures below. Such file descriptors have been seen: - with GNU make, when invoked as 'make -j N' with j > 1, - in some versions of the KDE desktop environment, - on NetBSD, - in MacPorts with the "trace mode" enabled. */ (void) close (10); /* Test whether F_DUPFD_CLOEXEC is effective. */ ASSERT (fcntl (1, F_DUPFD_CLOEXEC, 10) >= 0); #if defined _WIN32 && !defined __CYGWIN__ return _execl ("./test-fcntl", "./test-fcntl", "child", NULL); #else return execl ("./test-fcntl", "./test-fcntl", "child", NULL); #endif } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-btowc.c������������������������������������������������������0000664�0001750�0001750�00000003311�14670377436�021330� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of conversion of unibyte character to wide character. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include <wchar.h> #include "signature.h" SIGNATURE_CHECK (btowc, wint_t, (int)); #include <locale.h> #include <stdio.h> #include "macros.h" int main (int argc, char *argv[]) { int c; /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; ASSERT (btowc (EOF) == WEOF); if (argc > 1) switch (argv[1][0]) { case '1': /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ for (c = 0; c < 0x80; c++) ASSERT (btowc (c) == c); for (c = 0xA0; c < 0x100; c++) ASSERT (btowc (c) != WEOF); return 0; case '2': /* Locale encoding is UTF-8. */ for (c = 0; c < 0x80; c++) ASSERT (btowc (c) == c); for (c = 0x80; c < 0x100; c++) ASSERT (btowc (c) == WEOF); return 0; } return 1; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-getopt_long.h������������������������������������������������0000664�0001750�0001750�00000175506�14670377436�022560� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of command line argument processing. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ static int a_seen; static int b_seen; static int q_seen; static const struct option long_options_required[] = { { "alpha", no_argument, NULL, 'a' }, { "beta", no_argument, &b_seen, 1 }, { "prune", required_argument, NULL, 'p' }, { "quetsche", required_argument, &q_seen, 1 }, { "xtremely-",no_argument, NULL, 1003 }, { "xtra", no_argument, NULL, 1001 }, { "xtreme", no_argument, NULL, 1002 }, { "xtremely", no_argument, NULL, 1003 }, { NULL, 0, NULL, 0 } }; static const struct option long_options_optional[] = { { "alpha", no_argument, NULL, 'a' }, { "beta", no_argument, &b_seen, 1 }, { "prune", optional_argument, NULL, 'p' }, { "quetsche", optional_argument, &q_seen, 1 }, { NULL, 0, NULL, 0 } }; static void getopt_long_loop (int argc, const char **argv, const char *options, const struct option *long_options, const char **p_value, const char **q_value, int *non_options_count, const char **non_options, int *unrecognized) { int option_index = -1; int c; opterr = 0; q_seen = 0; while ((c = getopt_long (argc, (char **) argv, options, long_options, &option_index)) != -1) { switch (c) { case 0: /* An option with a non-NULL flag pointer was processed. */ if (q_seen) *q_value = optarg; break; case 'a': a_seen++; break; case 'b': b_seen = 1; break; case 'p': *p_value = optarg; break; case 'q': *q_value = optarg; break; case '\1': /* Must only happen with option '-' at the beginning. */ ASSERT (options[0] == '-'); non_options[(*non_options_count)++] = optarg; break; case ':': /* Must only happen with option ':' at the beginning. */ ASSERT (options[0] == ':' || ((options[0] == '-' || options[0] == '+') && options[1] == ':')); FALLTHROUGH; case '?': *unrecognized = optopt; break; default: *unrecognized = c; break; } } } /* Reduce casting, so we can use string literals elsewhere. getopt_long takes an array of char*, but luckily does not modify those elements, so we can pass const char*. */ static int do_getopt_long (int argc, const char **argv, const char *shortopts, const struct option *longopts, int *longind) { return getopt_long (argc, (char **) argv, shortopts, longopts, longind); } static void test_getopt_long (void) { int start; /* Test disambiguation of options. */ { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--x"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == '?'); ASSERT (optopt == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--xt"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == '?'); ASSERT (optopt == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--xtr"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == '?'); ASSERT (optopt == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--xtra"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == 1001); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--xtre"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == '?'); ASSERT (optopt == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--xtrem"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == '?'); ASSERT (optopt == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--xtreme"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == 1002); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--xtremel"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == 1003); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--xtremely"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == 1003); } /* Check that -W handles unknown options. */ { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-W"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "W;", long_options_required, &option_index); ASSERT (c == '?'); ASSERT (optopt == 'W'); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-Wunknown"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "W;", long_options_required, &option_index); /* glibc and BSD behave differently here, but for now, we allow both behaviors since W support is not frequently used. */ if (c == '?') { ASSERT (optopt == 0); ASSERT (optarg == NULL); } else { ASSERT (c == 'W'); ASSERT (strcmp (optarg, "unknown") == 0); } } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-W"; argv[argc++] = "unknown"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "W;", long_options_required, &option_index); /* glibc and BSD behave differently here, but for now, we allow both behaviors since W support is not frequently used. */ if (c == '?') { ASSERT (optopt == 0); ASSERT (optarg == NULL); } else { ASSERT (c == 'W'); ASSERT (strcmp (optarg, "unknown") == 0); } } /* Test that 'W' does not dump core: https://sourceware.org/bugzilla/show_bug.cgi?id=12922 */ { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-W"; argv[argc++] = "dummy"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long (argc, argv, "W;", NULL, &option_index); ASSERT (c == 'W'); ASSERT (optind == 2); } /* Test processing of boolean short options. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-a"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "ab", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-b"; argv[argc++] = "-a"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "ab", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-ba"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "ab", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-ab"; argv[argc++] = "-a"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "ab", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 2); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); } /* Test processing of boolean long options. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "--alpha"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "ab", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "--beta"; argv[argc++] = "--alpha"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "ab", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "--alpha"; argv[argc++] = "--beta"; argv[argc++] = "--alpha"; argv[argc++] = "--beta"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "ab", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 2); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 5); } /* Test processing of boolean long options via -W. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-Walpha"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abW;", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-W"; argv[argc++] = "beta"; argv[argc++] = "-W"; argv[argc++] = "alpha"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "aW;b", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 5); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-Walpha"; argv[argc++] = "-Wbeta"; argv[argc++] = "-Walpha"; argv[argc++] = "-Wbeta"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "W;ab", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 2); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 5); } /* Test processing of short options with arguments. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-pfoo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-ab"; argv[argc++] = "-q"; argv[argc++] = "baz"; argv[argc++] = "-pfoo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 5); } /* Test processing of long options with arguments. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "--p=foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "--p"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-ab"; argv[argc++] = "--q"; argv[argc++] = "baz"; argv[argc++] = "--p=foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 5); } /* Test processing of long options with arguments via -W. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-Wp=foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p:q:W;", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-W"; argv[argc++] = "p"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p:W;q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 4); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-ab"; argv[argc++] = "-Wq"; argv[argc++] = "baz"; argv[argc++] = "-W"; argv[argc++] = "p=foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "W;abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 6); } /* Test processing of short options with optional arguments. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-pfoo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p::q::", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p::q::", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp::q::", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); } /* Test processing of long options with optional arguments. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "--p=foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p::q::", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "--p"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p::q::", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "--p="; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p::q::", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && *p_value == '\0'); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "--p"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp::q::", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); } /* Test processing of long options with optional arguments via -W. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-Wp=foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p::q::W;", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-Wp"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p::q::W;", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-Wp="; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "W;p::q::", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && *p_value == '\0'); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-W"; argv[argc++] = "p="; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "W;p::q::", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && *p_value == '\0'); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-W"; argv[argc++] = "p"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "W;abp::q::", long_options_optional, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 0); /* ASSERT (p_value == NULL); */ ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 4); } /* Check that invalid options are recognized. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "-x"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 'x'); ASSERT (optind == 5); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "-:"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == ':'); ASSERT (optind == 5); } /* Check that unexpected arguments are recognized. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "--a="; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 'a'); ASSERT (optind == 4); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "--b="; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); /* When flag is non-zero, glibc sets optopt anyway, but BSD leaves optopt unchanged. */ ASSERT (unrecognized == 1 || unrecognized == 0); ASSERT (optind == 4); } /* Check that by default, non-options arguments are moved to the end. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "-p") == 0); ASSERT (strcmp (argv[2], "billy") == 0); ASSERT (strcmp (argv[3], "-a") == 0); ASSERT (strcmp (argv[4], "donald") == 0); ASSERT (strcmp (argv[5], "duck") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 4); } /* Check that '--' ends the argument processing. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[20]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "--"; argv[argc++] = "-b"; argv[argc++] = "foo"; argv[argc++] = "-q"; argv[argc++] = "johnny"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "-p") == 0); ASSERT (strcmp (argv[2], "billy") == 0); ASSERT (strcmp (argv[3], "-a") == 0); ASSERT (strcmp (argv[4], "--") == 0); ASSERT (strcmp (argv[5], "donald") == 0); ASSERT (strcmp (argv[6], "duck") == 0); ASSERT (strcmp (argv[7], "-b") == 0); ASSERT (strcmp (argv[8], "foo") == 0); ASSERT (strcmp (argv[9], "-q") == 0); ASSERT (strcmp (argv[10], "johnny") == 0); ASSERT (strcmp (argv[11], "bar") == 0); ASSERT (argv[12] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 5); } /* Check that the '-' flag causes non-options to be returned in order. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "-abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 3); ASSERT (strcmp (non_options[0], "donald") == 0); ASSERT (strcmp (non_options[1], "duck") == 0); ASSERT (strcmp (non_options[2], "bar") == 0); ASSERT (unrecognized == 0); ASSERT (optind == 7); } /* Check that '--' ends the argument processing. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[20]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "--"; argv[argc++] = "-b"; argv[argc++] = "foo"; argv[argc++] = "-q"; argv[argc++] = "johnny"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "-abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "--") == 0); ASSERT (strcmp (argv[7], "-b") == 0); ASSERT (strcmp (argv[8], "foo") == 0); ASSERT (strcmp (argv[9], "-q") == 0); ASSERT (strcmp (argv[10], "johnny") == 0); ASSERT (strcmp (argv[11], "bar") == 0); ASSERT (argv[12] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); if (non_options_count == 2) { /* glibc behaviour. */ ASSERT (non_options_count == 2); ASSERT (strcmp (non_options[0], "donald") == 0); ASSERT (strcmp (non_options[1], "duck") == 0); ASSERT (unrecognized == 0); ASSERT (optind == 7); } else { /* Another valid behaviour. */ ASSERT (non_options_count == 7); ASSERT (strcmp (non_options[0], "donald") == 0); ASSERT (strcmp (non_options[1], "duck") == 0); ASSERT (strcmp (non_options[2], "-b") == 0); ASSERT (strcmp (non_options[3], "foo") == 0); ASSERT (strcmp (non_options[4], "-q") == 0); ASSERT (strcmp (non_options[5], "johnny") == 0); ASSERT (strcmp (non_options[6], "bar") == 0); ASSERT (unrecognized == 0); ASSERT (optind == 12); } } /* Check that the '-' flag has to come first. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:-", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "-p") == 0); ASSERT (strcmp (argv[2], "billy") == 0); ASSERT (strcmp (argv[3], "-a") == 0); ASSERT (strcmp (argv[4], "donald") == 0); ASSERT (strcmp (argv[5], "duck") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 4); } /* Check that the '+' flag causes the first non-option to terminate the loop. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "+abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 1); } for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-+"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "+abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == '+'); ASSERT (optind == 2); } /* Check that '--' ends the argument processing. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[20]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "--"; argv[argc++] = "-b"; argv[argc++] = "foo"; argv[argc++] = "-q"; argv[argc++] = "johnny"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "+abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "--") == 0); ASSERT (strcmp (argv[7], "-b") == 0); ASSERT (strcmp (argv[8], "foo") == 0); ASSERT (strcmp (argv[9], "-q") == 0); ASSERT (strcmp (argv[10], "johnny") == 0); ASSERT (strcmp (argv[11], "bar") == 0); ASSERT (argv[12] == NULL); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 1); } /* Check that the '+' flag has to come first. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:+", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "-p") == 0); ASSERT (strcmp (argv[2], "billy") == 0); ASSERT (strcmp (argv[3], "-a") == 0); ASSERT (strcmp (argv[4], "donald") == 0); ASSERT (strcmp (argv[5], "duck") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 4); } } /* Test behavior of getopt_long when POSIXLY_CORRECT is set in the environment. Options with optional arguments should not change behavior just because of an environment variable. https://lists.gnu.org/r/bug-m4/2006-09/msg00028.html */ static void test_getopt_long_posix (void) { int start; /* Check that POSIXLY_CORRECT stops parsing the same as leading '+'. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "abp:q:", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 1); } /* Check that POSIXLY_CORRECT doesn't change optional arguments. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "p::", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); } /* Check that leading - still sees options after non-options. */ for (start = 0; start <= 1; start++) { const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; int argc = 0; const char *argv[10]; a_seen = 0; b_seen = 0; argv[argc++] = "program"; argv[argc++] = "-a"; argv[argc++] = "billy"; argv[argc++] = "-b"; argv[argc] = NULL; optind = start; getopt_long_loop (argc, argv, "-ab", long_options_required, &p_value, &q_value, &non_options_count, non_options, &unrecognized); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 1); ASSERT (strcmp (non_options[0], "billy") == 0); ASSERT (unrecognized == 0); ASSERT (optind == 4); } } /* Reduce casting, so we can use string literals elsewhere. getopt_long_only takes an array of char*, but luckily does not modify those elements, so we can pass const char*. */ static int do_getopt_long_only (int argc, const char **argv, const char *shortopts, const struct option *longopts, int *longind) { return getopt_long_only (argc, (char **) argv, shortopts, longopts, longind); } static void test_getopt_long_only (void) { /* Test disambiguation of options. */ { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-x"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long_only (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == '?'); ASSERT (optopt == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-x"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long_only (argc, argv, "abx", long_options_required, &option_index); ASSERT (c == 'x'); ASSERT (optopt == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--x"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long_only (argc, argv, "abx", long_options_required, &option_index); ASSERT (c == '?'); ASSERT (optopt == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-b"; argv[argc] = NULL; optind = 1; opterr = 0; b_seen = 0; c = do_getopt_long_only (argc, argv, "abx", long_options_required, &option_index); ASSERT (c == 'b'); ASSERT (b_seen == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "--b"; argv[argc] = NULL; optind = 1; opterr = 0; b_seen = 0; c = do_getopt_long_only (argc, argv, "abx", long_options_required, &option_index); ASSERT (c == 0); ASSERT (b_seen == 1); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-xt"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long_only (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == '?'); ASSERT (optopt == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-xt"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long_only (argc, argv, "abx", long_options_required, &option_index); ASSERT (c == '?'); ASSERT (optopt == 0); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-xtra"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long_only (argc, argv, "ab", long_options_required, &option_index); ASSERT (c == 1001); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-xtreme"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long_only (argc, argv, "abx:", long_options_required, &option_index); ASSERT (c == 1002); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-xtremel"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long_only (argc, argv, "ab", long_options_required, &option_index); /* glibc getopt_long_only is intentionally different from getopt_long when handling a prefix that is common to two spellings, when both spellings have the same option directives. BSD getopt_long_only treats both cases the same. */ ASSERT (c == 1003 || c == '?'); ASSERT (optind == 2); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-xtremel"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long_only (argc, argv, "abx::", long_options_required, &option_index); /* glibc getopt_long_only is intentionally different from getopt_long when handling a prefix that is common to two spellings, when both spellings have the same option directives. BSD getopt_long_only treats both cases the same. */ ASSERT (c == 1003 || c == '?'); ASSERT (optind == 2); ASSERT (optarg == NULL); } { int argc = 0; const char *argv[10]; int option_index; int c; argv[argc++] = "program"; argv[argc++] = "-xtras"; argv[argc] = NULL; optind = 1; opterr = 0; c = do_getopt_long_only (argc, argv, "abx::", long_options_required, &option_index); ASSERT (c == 'x'); ASSERT (strcmp (optarg, "tras") == 0); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-iswdigit.sh��������������������������������������������������0000775�0001750�0001750�00000001670�14670377436�022236� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test in the POSIX locale. LC_ALL=C ${CHECKER} ./test-iswdigit${EXEEXT} 0 || exit 1 LC_ALL=POSIX ${CHECKER} ./test-iswdigit${EXEEXT} 0 || exit 1 # Test in an ISO-8859-1 or ISO-8859-15 locale. : ${LOCALE_FR=fr_FR} if test $LOCALE_FR != none; then LC_ALL=$LOCALE_FR \ ${CHECKER} ./test-iswdigit${EXEEXT} 1 \ || exit 1 fi # Test whether a specific EUC-JP locale is installed. : ${LOCALE_JA=ja_JP} if test $LOCALE_JA != none; then LC_ALL=$LOCALE_JA \ ${CHECKER} ./test-iswdigit${EXEEXT} 2 \ || exit 1 fi # Test whether a specific UTF-8 locale is installed. : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR_UTF8 != none; then LC_ALL=$LOCALE_FR_UTF8 \ ${CHECKER} ./test-iswdigit${EXEEXT} 3 \ || exit 1 fi # Test whether a specific GB18030 locale is installed. : ${LOCALE_ZH_CN=zh_CN.GB18030} if test $LOCALE_ZH_CN != none; then LC_ALL=$LOCALE_ZH_CN \ ${CHECKER} ./test-iswdigit${EXEEXT} 4 \ || exit 1 fi exit 0 ������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sys_select.c�������������������������������������������������0000664�0001750�0001750�00000003362�14670377436�022375� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <sys/select.h> substitute. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <sys/select.h> #include "signature.h" /* The following may be macros without underlying functions, so only check signature if they are not macros. */ #ifndef FD_CLR SIGNATURE_CHECK (FD_CLR, void, (int, fd_set *)); #endif #ifndef FD_ISSET SIGNATURE_CHECK (FD_ISSET, void, (int, fd_set *)); #endif #ifndef FD_SET SIGNATURE_CHECK (FD_SET, int, (int, fd_set *)); #endif #ifndef FD_ZERO SIGNATURE_CHECK (FD_ZERO, void, (fd_set *)); #endif /* Check that the 'struct timeval' type is defined. */ struct timeval a; /* Check that a.tv_sec is wide enough to hold a time_t, ignoring signedness issues. */ typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1]; /* Check that sigset_t is defined. */ sigset_t t2; int main (void) { /* Check that FD_ZERO can be used. This should not yield a warning such as "warning: implicit declaration of function 'memset'". */ fd_set fds; FD_ZERO (&fds); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-locale.c�����������������������������������������������������0000664�0001750�0001750�00000004424�14670377436�021457� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <locale.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <locale.h> #include "verify.h" int a[] = { LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME }; /* Check that the 'struct lconv' type is defined. */ struct lconv l; int ls; /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); int main () { #if HAVE_WORKING_NEWLOCALE /* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined. */ locale_t b = LC_GLOBAL_LOCALE; (void) b; #endif /* Check that 'struct lconv' has the ISO C and POSIX specified members. */ ls += sizeof (*l.decimal_point); ls += sizeof (*l.thousands_sep); ls += sizeof (*l.grouping); ls += sizeof (*l.mon_decimal_point); ls += sizeof (*l.mon_thousands_sep); ls += sizeof (*l.mon_grouping); ls += sizeof (*l.positive_sign); ls += sizeof (*l.negative_sign); ls += sizeof (*l.currency_symbol); ls += sizeof (l.frac_digits); ls += sizeof (l.p_cs_precedes); ls += sizeof (l.p_sign_posn); ls += sizeof (l.p_sep_by_space); ls += sizeof (l.n_cs_precedes); ls += sizeof (l.n_sign_posn); ls += sizeof (l.n_sep_by_space); ls += sizeof (*l.int_curr_symbol); ls += sizeof (l.int_frac_digits); ls += sizeof (l.int_p_cs_precedes); ls += sizeof (l.int_p_sign_posn); ls += sizeof (l.int_p_sep_by_space); ls += sizeof (l.int_n_cs_precedes); ls += sizeof (l.int_n_sign_posn); ls += sizeof (l.int_n_sep_by_space); return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-stdalign.c���������������������������������������������������0000664�0001750�0001750�00000007770�14670377436�022034� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <stdalign.h>. Copyright 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert, inspired by Bruno Haible's test-alignof.c. */ #include <config.h> #include <stdalign.h> #include <stddef.h> #include <stdint.h> #include "verify.h" #include "macros.h" typedef long double longdouble; typedef struct { char a[1]; } struct1; typedef struct { char a[2]; } struct2; typedef struct { char a[3]; } struct3; typedef struct { char a[4]; } struct4; verify (__alignof_is_defined == 1); #ifndef alignof # error "alignof is not a macro" #endif #if __alignas_is_defined verify (__alignas_is_defined == 1); # ifndef alignas # error "alignas is not a macro" # endif /* mingw can go up only to 8. 8 is all that GNU Emacs needs, so let's limit the test to 8 for now. */ # define TEST_ALIGNMENT 8 #else # define _Alignas(alignment) # define alignas(alignment) # define TEST_ALIGNMENT 1 #endif #define CHECK_STATIC(type) \ typedef struct { char slot1; type slot2; } type##_helper; \ verify (alignof (type) == offsetof (type##_helper, slot2)); \ verify (_Alignof (type) == alignof (type)); \ const int type##_alignment = alignof (type); \ type alignas (TEST_ALIGNMENT) static_##type##_alignas; \ type _Alignas (TEST_ALIGNMENT) static_##type##_Alignas #define CHECK_ALIGNED(var) ASSERT ((uintptr_t) &(var) % TEST_ALIGNMENT == 0) CHECK_STATIC (char); CHECK_STATIC (short); CHECK_STATIC (int); CHECK_STATIC (long); #ifdef INT64_MAX CHECK_STATIC (int64_t); #endif CHECK_STATIC (float); CHECK_STATIC (double); /* CHECK_STATIC (longdouble); */ CHECK_STATIC (struct1); CHECK_STATIC (struct2); CHECK_STATIC (struct3); CHECK_STATIC (struct4); int main () { #if defined __SUNPRO_C && __SUNPRO_C < 0x5150 /* Avoid a test failure due to Sun Studio Developer Bug Report #2125432. */ fputs ("Skipping test: known Sun C compiler bug\n", stderr); return 77; #elif defined __HP_cc && __ia64 /* Avoid a test failure due to HP-UX Itanium cc bug; see: https://lists.gnu.org/r/bug-gnulib/2017-03/msg00078.html */ fputs ("Skipping test: known HP-UX Itanium cc compiler bug\n", stderr); return 77; #elif defined __clang__ && defined __ibmxl__ /* Avoid a test failure with IBM xlc 16.1. It ignores alignas (8), _Alignas (8), and __attribute__ ((__aligned__ (8))). */ fputs ("Skipping test: known AIX XL C compiler deficiency\n", stderr); return 77; #else CHECK_ALIGNED (static_char_alignas); CHECK_ALIGNED (static_char_Alignas); CHECK_ALIGNED (static_short_alignas); CHECK_ALIGNED (static_short_Alignas); CHECK_ALIGNED (static_int_alignas); CHECK_ALIGNED (static_int_Alignas); CHECK_ALIGNED (static_long_alignas); CHECK_ALIGNED (static_long_Alignas); # ifdef INT64_MAX CHECK_ALIGNED (static_int64_t_alignas); CHECK_ALIGNED (static_int64_t_Alignas); # endif CHECK_ALIGNED (static_float_alignas); CHECK_ALIGNED (static_float_Alignas); CHECK_ALIGNED (static_double_alignas); CHECK_ALIGNED (static_double_Alignas); /* CHECK_ALIGNED (static_longdouble_alignas); */ /* CHECK_ALIGNED (static_longdouble_Alignas); */ CHECK_ALIGNED (static_struct1_alignas); CHECK_ALIGNED (static_struct1_Alignas); CHECK_ALIGNED (static_struct2_alignas); CHECK_ALIGNED (static_struct2_Alignas); CHECK_ALIGNED (static_struct3_alignas); CHECK_ALIGNED (static_struct3_Alignas); CHECK_ALIGNED (static_struct4_alignas); CHECK_ALIGNED (static_struct4_Alignas); return 0; #endif } ��������kbuild-3608/src/grep/gnulib-tests/test-strtoull.c���������������������������������������������������0000664�0001750�0001750�00000013126�14670377436�022107� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdlib.h> #include "signature.h" #ifndef strtoull SIGNATURE_CHECK (strtoull, unsigned long long, (const char *, char **, int)); #endif #include <errno.h> #include "macros.h" int main (void) { /* Subject sequence empty or invalid. */ { const char input[] = ""; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " "; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " +"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " -"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } /* Simple integer values. */ { const char input[] = "0"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 1); ASSERT (errno == 0); } { const char input[] = "+0"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = "-0"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = "23"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = " 23"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } { const char input[] = "+23"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } { const char input[] = "-23"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == - 23ULL); ASSERT (ptr == input + 3); ASSERT (errno == 0); } /* Large integer values. */ { const char input[] = "2147483647"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 2147483647); ASSERT (ptr == input + 10); ASSERT (errno == 0); } { const char input[] = "-2147483648"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == - 2147483648ULL); ASSERT (ptr == input + 11); ASSERT (errno == 0); } { const char input[] = "4294967295"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 4294967295U); ASSERT (ptr == input + 10); ASSERT (errno == 0); } /* Hexadecimal integer syntax. */ { const char input[] = "0x2A"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 0ULL); ASSERT (ptr == input + 1); ASSERT (errno == 0); } { const char input[] = "0x2A"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 16); ASSERT (result == 42ULL); ASSERT (ptr == input + 4); ASSERT (errno == 0); } { const char input[] = "0x2A"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 0); ASSERT (result == 42ULL); ASSERT (ptr == input + 4); ASSERT (errno == 0); } { const char input[] = "0x"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 10); ASSERT (result == 0ULL); ASSERT (ptr == input + 1); ASSERT (errno == 0); } { const char input[] = "0x"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 16); ASSERT (result == 0ULL); ASSERT (ptr == input + 1); ASSERT (errno == 0); } { const char input[] = "0x"; char *ptr; unsigned long long result; errno = 0; result = strtoull (input, &ptr, 0); ASSERT (result == 0ULL); ASSERT (ptr == input + 1); ASSERT (errno == 0); } return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-openat.c�����������������������������������������������������0000664�0001750�0001750�00000005144�14670377436�021506� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test that openat works. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <fcntl.h> #include "signature.h" SIGNATURE_CHECK (openat, int, (int, char const *, int, ...)); #include <errno.h> #include <stdarg.h> #include <stdbool.h> #include <stdio.h> #include <unistd.h> #include "macros.h" #define BASE "test-openat.t" #include "test-open.h" static int dfd = AT_FDCWD; /* Wrapper around openat to test open behavior. */ static int do_open (char const *name, int flags, ...) { if (flags & O_CREAT) { mode_t mode = 0; va_list arg; va_start (arg, flags); /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 creates crashing code when 'mode_t' is smaller than 'int'. */ mode = va_arg (arg, PROMOTED_MODE_T); va_end (arg); return openat (dfd, name, flags, mode); } return openat (dfd, name, flags); } int main (int argc _GL_UNUSED, char *argv[]) { int result; /* Test behaviour for invalid file descriptors. */ { errno = 0; ASSERT (openat (-1, "foo", O_RDONLY) == -1); ASSERT (errno == EBADF); } { close (99); errno = 0; ASSERT (openat (99, "foo", O_RDONLY) == -1); ASSERT (errno == EBADF); } /* Basic checks. */ result = test_open (do_open, false); dfd = open (".", O_RDONLY); ASSERT (0 <= dfd); ASSERT (test_open (do_open, false) == result); ASSERT (close (dfd) == 0); /* Check that even when *-safer modules are in use, plain openat can land in fd 0. Do this test last, since it is destructive to stdin. */ ASSERT (close (STDIN_FILENO) == 0); ASSERT (openat (AT_FDCWD, ".", O_RDONLY) == STDIN_FILENO); { dfd = open (".", O_RDONLY); ASSERT (STDIN_FILENO < dfd); ASSERT (chdir ("..") == 0); ASSERT (close (STDIN_FILENO) == 0); ASSERT (openat (dfd, ".", O_RDONLY) == STDIN_FILENO); ASSERT (close (dfd) == 0); } return result; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-pthread_sigmask1.c�������������������������������������������0000664�0001750�0001750�00000004676�14670377436�023457� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of pthread_sigmask in a single-threaded program. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2011. */ #include <config.h> #include <signal.h> #include "signature.h" SIGNATURE_CHECK (pthread_sigmask, int, (int, const sigset_t *, sigset_t *)); #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "macros.h" #if !(defined _WIN32 && !defined __CYGWIN__) static volatile int sigint_occurred; static void sigint_handler (int sig) { sigint_occurred++; } int main (int argc, char *argv[]) { sigset_t set; int pid = getpid (); char command[80]; signal (SIGINT, sigint_handler); sigemptyset (&set); sigaddset (&set, SIGINT); /* Check error handling. */ ASSERT (pthread_sigmask (1729, &set, NULL) == EINVAL); /* Block SIGINT. */ ASSERT (pthread_sigmask (SIG_BLOCK, &set, NULL) == 0); /* Request a SIGINT signal from outside. */ sprintf (command, "sh -c 'sleep 1; kill -%d %d' &", SIGINT, pid); ASSERT (system (command) == 0); /* Wait. */ sleep (2); /* The signal should not have arrived yet, because it is blocked. */ ASSERT (sigint_occurred == 0); /* Unblock SIGINT. */ ASSERT (pthread_sigmask (SIG_UNBLOCK, &set, NULL) == 0); /* The signal should have arrived now, because POSIX says "If there are any pending unblocked signals after the call to pthread_sigmask(), at least one of those signals shall be delivered before the call to pthread_sigmask() returns." */ ASSERT (sigint_occurred == 1); return 0; } #else /* On native Windows, getpid() values and the arguments that are passed to the (Cygwin?) 'kill' program are not necessarily related. */ int main () { fputs ("Skipping test: native Windows platform\n", stderr); return 77; } #endif ������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcrtomb-w32.c������������������������������������������������0000664�0001750�0001750�00000022141�14670377436�022302� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of conversion of wide character to multibyte character. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <wchar.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "localcharset.h" #include "macros.h" #if defined _WIN32 && !defined __CYGWIN__ static int test_one_locale (const char *name, int codepage) { char buf[64]; size_t ret; # if 1 /* Portable code to set the locale. */ { char name_with_codepage[1024]; sprintf (name_with_codepage, "%s.%d", name, codepage); /* Set the locale. */ if (setlocale (LC_ALL, name_with_codepage) == NULL) return 77; } # else /* Hacky way to set a locale.codepage combination that setlocale() refuses to set. */ { /* Codepage of the current locale, set with setlocale(). Not necessarily the same as GetACP(). */ extern __declspec(dllimport) unsigned int __lc_codepage; /* Set the locale. */ if (setlocale (LC_ALL, name) == NULL) return 77; /* Clobber the codepage and MB_CUR_MAX, both set by setlocale(). */ __lc_codepage = codepage; switch (codepage) { case 1252: case 1256: MB_CUR_MAX = 1; break; case 932: case 950: case 936: MB_CUR_MAX = 2; break; case 54936: case 65001: MB_CUR_MAX = 4; break; } /* Test whether the codepage is really available. */ { mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, " ", 1, &state) == (size_t)(-1)) return 77; } } # endif /* Test NUL character. */ { buf[0] = 'x'; ret = wcrtomb (buf, 0, NULL); ASSERT (ret == 1); ASSERT (buf[0] == '\0'); } /* Test single bytes. */ { int c; for (c = 0; c < 0x100; c++) switch (c) { case '\t': case '\v': case '\f': 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 '~': /* c is in the ISO C "basic character set". */ ret = wcrtomb (buf, btowc (c), NULL); ASSERT (ret == 1); ASSERT (buf[0] == (char) c); break; } } /* Test special calling convention, passing a NULL pointer. */ { ret = wcrtomb (NULL, '\0', NULL); ASSERT (ret == 1); ret = wcrtomb (NULL, btowc ('x'), NULL); ASSERT (ret == 1); } switch (codepage) { case 1252: /* Locale encoding is CP1252, an extension of ISO-8859-1. */ { /* Convert "B\374\337er": "Büßer" */ memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00FC, NULL); ASSERT (ret == 1); ASSERT (memcmp (buf, "\374", 1) == 0); ASSERT (buf[1] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00DF, NULL); ASSERT (ret == 1); ASSERT (memcmp (buf, "\337", 1) == 0); ASSERT (buf[1] == 'x'); } return 0; case 1256: /* Locale encoding is CP1256, not the same as ISO-8859-6. */ { /* Convert "x\302\341\346y": "xآلوy" */ memset (buf, 'x', 8); ret = wcrtomb (buf, 0x0622, NULL); ASSERT (ret == 1); ASSERT (memcmp (buf, "\302", 1) == 0); ASSERT (buf[1] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x0644, NULL); ASSERT (ret == 1); ASSERT (memcmp (buf, "\341", 1) == 0); ASSERT (buf[1] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x0648, NULL); ASSERT (ret == 1); ASSERT (memcmp (buf, "\346", 1) == 0); ASSERT (buf[1] == 'x'); } return 0; case 932: /* Locale encoding is CP932, similar to Shift_JIS. */ { /* Convert "<\223\372\226\173\214\352>": "<日本語>" */ memset (buf, 'x', 8); ret = wcrtomb (buf, 0x65E5, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\223\372", 2) == 0); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x672C, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\226\173", 2) == 0); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x8A9E, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\214\352", 2) == 0); ASSERT (buf[2] == 'x'); } return 0; case 950: /* Locale encoding is CP950, similar to Big5. */ { /* Convert "<\244\351\245\273\273\171>": "<日本語>" */ memset (buf, 'x', 8); ret = wcrtomb (buf, 0x65E5, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\244\351", 2) == 0); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x672C, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\245\273", 2) == 0); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x8A9E, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\273\171", 2) == 0); ASSERT (buf[2] == 'x'); } return 0; case 936: /* Locale encoding is CP936 = GBK, an extension of GB2312. */ { /* Convert "<\310\325\261\276\325\132>": "<日本語>" */ memset (buf, 'x', 8); ret = wcrtomb (buf, 0x65E5, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\310\325", 2) == 0); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x672C, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\261\276", 2) == 0); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x8A9E, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\325\132", 2) == 0); ASSERT (buf[2] == 'x'); } return 0; case 54936: /* Locale encoding is CP54936 = GB18030. */ if (strcmp (locale_charset (), "GB18030") != 0) return 77; { /* Convert "B\250\271\201\060\211\070er": "Büßer" */ memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00FC, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\250\271", 2) == 0); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00DF, NULL); ASSERT (ret == 4); ASSERT (memcmp (buf, "\201\060\211\070", 4) == 0); ASSERT (buf[4] == 'x'); } return 0; case 65001: /* Locale encoding is CP65001 = UTF-8. */ if (strcmp (locale_charset (), "UTF-8") != 0) return 77; { /* Convert "B\303\274\303\237er": "Büßer" */ memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00FC, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\303\274", 2) == 0); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00DF, NULL); ASSERT (ret == 2); ASSERT (memcmp (buf, "\303\237", 2) == 0); ASSERT (buf[2] == 'x'); } return 0; default: return 1; } } int main (int argc, char *argv[]) { int codepage = atoi (argv[argc - 1]); int result; int i; result = 77; for (i = 1; i < argc - 1; i++) { int ret = test_one_locale (argv[i], codepage); if (ret != 77) result = ret; } if (result == 77) { fprintf (stderr, "Skipping test: found no locale with codepage %d\n", codepage); } return result; } #else int main (int argc, char *argv[]) { fputs ("Skipping test: not a native Windows system\n", stderr); return 77; } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sockets.h���������������������������������������������������������0000664�0001750�0001750�00000003174�14670377431�020717� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* sockets.h - wrappers for Windows socket functions Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Simon Josefsson */ #ifndef SOCKETS_H #define SOCKETS_H 1 #define SOCKETS_1_0 0x0001 #define SOCKETS_1_1 0x0101 #define SOCKETS_2_0 0x0002 #define SOCKETS_2_1 0x0102 #define SOCKETS_2_2 0x0202 int gl_sockets_startup (int version) #ifndef WINDOWS_SOCKETS _GL_ATTRIBUTE_CONST #endif ; int gl_sockets_cleanup (void) #ifndef WINDOWS_SOCKETS _GL_ATTRIBUTE_CONST #endif ; /* This function is useful it you create a socket using gnulib's Winsock wrappers but needs to pass on the socket handle to some other library that only accepts sockets. */ #ifdef WINDOWS_SOCKETS # include <sys/socket.h> # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include <io.h> # endif static inline SOCKET gl_fd_to_handle (int fd) { return _get_osfhandle (fd); } #else # define gl_fd_to_handle(x) (x) #endif /* WINDOWS_SOCKETS */ #endif /* SOCKETS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-xstrtoimax.sh������������������������������������������������0000775�0001750�0001750�00000002261�14670377436�022632� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh : ${srcdir=.} . "$srcdir/init.sh"; path_prepend_ . too_big=99999999999999999999999999999999999999999999999999999999999999999999 result=0 # test xstrtoimax ${CHECKER} test-xstrtoimax 1 >> out 2>&1 || result=1 ${CHECKER} test-xstrtoimax -1 >> out 2>&1 || result=1 ${CHECKER} test-xstrtoimax 1k >> out 2>&1 || result=1 ${CHECKER} test-xstrtoimax ${too_big}h >> out 2>&1 && result=1 ${CHECKER} test-xstrtoimax $too_big >> out 2>&1 && result=1 ${CHECKER} test-xstrtoimax x >> out 2>&1 && result=1 ${CHECKER} test-xstrtoimax 9x >> out 2>&1 && result=1 ${CHECKER} test-xstrtoimax 010 >> out 2>&1 || result=1 ${CHECKER} test-xstrtoimax MiB >> out 2>&1 || result=1 # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. if echo solaris | tr -d '\r' | grep solais > /dev/null; then cr='\015' else cr='\r' fi # normalize output LC_ALL=C tr -d "$cr" < out > k mv k out # compare expected output cat > exp <<EOF 1->1 () -1->-1 () 1k->1024 () invalid suffix in X argument '${too_big}h' X argument '$too_big' too large invalid X argument 'x' invalid suffix in X argument '9x' 010->8 () MiB->1048576 () EOF compare exp out || result=1 Exit $result �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-exclude1.sh��������������������������������������������������0000775�0001750�0001750�00000002442�14670377436�022123� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test suite for exclude. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . fail=0 # Test literal matches cat > in <<EOT foo* bar Baz EOT cat > expected <<EOT foo: 0 foo*: 1 bar: 1 foobar: 0 baz: 0 bar/qux: 0 EOT ${CHECKER} test-exclude in -- foo 'foo*' bar foobar baz bar/qux > out || exit $? # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac # normalize output LC_ALL=C tr -d "$cr" < out > k && mv k out compare expected out || fail=1 Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sys_socket.c������������������������������������������������������0000664�0001750�0001750�00000001555�14670377431�021426� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Inline functions for <sys/socket.h>. Copyright (C) 2012-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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> #define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE #include "sys/socket.h" typedef int dummy; ���������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/windows-thread.h��������������������������������������������������0000664�0001750�0001750�00000004365�14670377440�022206� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Creating and controlling threads (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. Based on GCC's gthr-win32.h. */ #ifndef _WINDOWS_THREAD_H #define _WINDOWS_THREAD_H #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include <windows.h> /* The glwthread_thread_t is a pointer to a structure in memory. Why not the thread handle? If it were the thread handle, it would be hard to implement glwthread_thread_self() (since GetCurrentThread () returns a pseudo-handle, DuplicateHandle (GetCurrentThread ()) returns a handle that must be closed afterwards, and there is no function for quickly retrieving a thread handle from its id). Why not the thread id? I tried it. It did not work: Sometimes ids appeared that did not belong to running threads, and glthread_join failed with ESRCH. */ typedef struct glwthread_thread_struct *glwthread_thread_t; #ifdef __cplusplus extern "C" { #endif /* attr is a bit mask, consisting of the following bits: */ #define GLWTHREAD_ATTR_DETACHED 1 extern int glwthread_thread_create (glwthread_thread_t *threadp, unsigned int attr, void * (*func) (void *), void *arg); extern int glwthread_thread_join (glwthread_thread_t thread, void **retvalp); extern int glwthread_thread_detach (glwthread_thread_t thread); extern glwthread_thread_t glwthread_thread_self (void); extern _Noreturn void glwthread_thread_exit (void *retval); #ifdef __cplusplus } #endif #endif /* _WINDOWS_THREAD_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/size_max.h��������������������������������������������������������0000664�0001750�0001750�00000002253�14670377430�021057� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* size_max.h -- declare SIZE_MAX through system headers Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. Written by Simon Josefsson. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef GNULIB_SIZE_MAX_H #define GNULIB_SIZE_MAX_H /* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */ # include <limits.h> /* Get SIZE_MAX declaration on systems like glibc 2. */ # if HAVE_STDINT_H # include <stdint.h> # endif /* On systems where these include files don't define it, SIZE_MAX is defined in config.h. */ #endif /* GNULIB_SIZE_MAX_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-perror.c�����������������������������������������������������0000664�0001750�0001750�00000002057�14670377436�021531� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of perror() function. Copyright (C) 2008-2021 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, 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include "signature.h" SIGNATURE_CHECK (perror, void, (char const *)); #include <errno.h> int main (int argc, char **argv) { const char *prefix = (argc > 1 ? argv[1] : NULL); errno = EACCES; perror (prefix); errno = ETIMEDOUT; perror (prefix); errno = EOVERFLOW; perror (prefix); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-vasnprintf.c�������������������������������������������������0000664�0001750�0001750�00000006637�14670377436�022422� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of vasnprintf() and asnprintf() functions. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include "vasnprintf.h" #include <stdarg.h> #include <stdlib.h> #include <string.h> #include "macros.h" static void test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { char buf[8]; int size; for (size = 0; size <= 8; size++) { size_t length = size; char *result = my_asnprintf (NULL, &length, "%d", 12345); ASSERT (result != NULL); ASSERT (strcmp (result, "12345") == 0); ASSERT (length == 5); free (result); } for (size = 0; size <= 8; size++) { size_t length; char *result; memcpy (buf, "DEADBEEF", 8); length = size; result = my_asnprintf (buf, &length, "%d", 12345); ASSERT (result != NULL); ASSERT (strcmp (result, "12345") == 0); ASSERT (length == 5); if (size < 5 + 1) ASSERT (result != buf); ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); if (result != buf) free (result); } /* Note: This test assumes IEEE 754 representation of 'double' floats. */ for (size = 0; size <= 8; size++) { size_t length; char *result; memcpy (buf, "DEADBEEF", 8); length = size; result = my_asnprintf (buf, &length, "%2.0f", 1.6314159265358979e+125); ASSERT (result != NULL); /* The exact result and the result on glibc systems is 163141592653589790215729350939528493057529598899734151772468186268423257777068536614838678161083520756952076273094236944990208 On Cygwin, the result is 163141592653589790215729350939528493057529600000000000000000000000000000000000000000000000000000000000000000000000000000000000 On HP-UX 11.31 / hppa and IRIX 6.5, the result is 163141592653589790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 */ ASSERT (strlen (result) == 126); ASSERT (memcmp (result, "163141592653589790", 18) == 0); ASSERT (length == 126); if (size < 126 + 1) ASSERT (result != buf); ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); if (result != buf) free (result); } } static char * my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) { va_list args; char *ret; va_start (args, format); ret = vasnprintf (resultbuf, lengthp, format, args); va_end (args); return ret; } static void test_vasnprintf () { test_function (my_asnprintf); } static void test_asnprintf () { test_function (asnprintf); } int main (int argc, char *argv[]) { test_vasnprintf (); test_asnprintf (); return 0; } �������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/itold.c�����������������������������������������������������������0000664�0001750�0001750�00000002032�14670377430�020341� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Replacement for 'int' to 'long double' conversion routine. Copyright (C) 2011-2021 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <float.h> void _Qp_itoq (long double *result, int a) { /* Convert from 'int' to 'double', then from 'double' to 'long double'. */ *result = (double) a; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-xstrtol.c����������������������������������������������������0000664�0001750�0001750�00000003015�14670377437�021733� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of xstrtol module. Copyright (C) 1995-1996, 1998-2001, 2003-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <inttypes.h> #include <stdlib.h> #include <stdio.h> #include "xstrtol-error.h" #include "error.h" #ifndef __xstrtol # define __xstrtol xstrtol # define __strtol_t long int # define __spec "ld" #endif /* Don't show the program name in error messages. */ static void print_no_progname (void) { } int main (int argc, char **argv) { strtol_error s_err; int i; error_print_progname = print_no_progname; for (i = 1; i < argc; i++) { char *p; __strtol_t val; s_err = __xstrtol (argv[i], &p, 0, &val, "bckMw0"); if (s_err == LONGINT_OK) { printf ("%s->%" __spec " (%s)\n", argv[i], val, p); } else { xstrtol_fatal (s_err, -2, 'X', NULL, argv[i]); } } exit (0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-setenv.c�����������������������������������������������������0000664�0001750�0001750�00000003107�14670377436�021521� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Tests of setenv. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <stdlib.h> #include "signature.h" SIGNATURE_CHECK (setenv, int, (char const *, char const *, int)); #include <errno.h> #include <string.h> #include <unistd.h> #include "macros.h" int main (void) { /* Test overwriting. */ ASSERT (setenv ("a", "==", -1) == 0); ASSERT (setenv ("a", "2", 0) == 0); ASSERT (strcmp (getenv ("a"), "==") == 0); /* Required to fail with EINVAL. */ errno = 0; ASSERT (setenv ("", "", 1) == -1); ASSERT (errno == EINVAL); errno = 0; ASSERT (setenv ("a=b", "", 0) == -1); ASSERT (errno == EINVAL); #if 0 /* glibc and gnulib's implementation guarantee this, but POSIX no longer requires it: http://austingroupbugs.net/view.php?id=185 */ errno = 0; ASSERT (setenv (NULL, "", 0) == -1); ASSERT (errno == EINVAL); #endif return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-memchr.c�����������������������������������������������������0000664�0001750�0001750�00000007431�14670377436�021474� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2008-2021 Free Software Foundation, Inc. * Written by Eric Blake and Bruno Haible * * 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <string.h> #include "signature.h" SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t)); #include <stdlib.h> #include "zerosize-ptr.h" #include "macros.h" /* Calculating void * + int is not portable, so this wrapper converts to char * to make the tests easier to write. */ #define MEMCHR (char *) memchr int main (void) { size_t n = 0x100000; char *input = malloc (n); ASSERT (input); input[0] = 'a'; input[1] = 'b'; memset (input + 2, 'c', 1024); memset (input + 1026, 'd', n - 1028); input[n - 2] = 'e'; input[n - 1] = 'a'; /* Basic behavior tests. */ ASSERT (MEMCHR (input, 'a', n) == input); ASSERT (MEMCHR (input, 'a', 0) == NULL); { void *page_boundary = zerosize_ptr (); if (page_boundary) ASSERT (MEMCHR (page_boundary, 'a', 0) == NULL); } ASSERT (MEMCHR (input, 'b', n) == input + 1); ASSERT (MEMCHR (input, 'c', n) == input + 2); ASSERT (MEMCHR (input, 'd', n) == input + 1026); ASSERT (MEMCHR (input + 1, 'a', n - 1) == input + n - 1); ASSERT (MEMCHR (input + 1, 'e', n - 1) == input + n - 2); ASSERT (MEMCHR (input + 1, 0x789abc00 | 'e', n - 1) == input + n - 2); ASSERT (MEMCHR (input, 'f', n) == NULL); ASSERT (MEMCHR (input, '\0', n) == NULL); /* Check that a very long haystack is handled quickly if the byte is found near the beginning. */ { size_t repeat = 10000; for (; repeat > 0; repeat--) { ASSERT (MEMCHR (input, 'c', n) == input + 2); } } /* Alignment tests. */ { int i, j; for (i = 0; i < 32; i++) { for (j = 0; j < 256; j++) input[i + j] = j; for (j = 0; j < 256; j++) { ASSERT (MEMCHR (input + i, j, 256) == input + i + j); } } } /* Check that memchr() does not read past the first occurrence of the byte being searched. See the Austin Group's clarification <https://www.opengroup.org/austin/docs/austin_454.txt>. Test both '\0' and something else, since some implementations special-case searching for NUL. */ { char *page_boundary = (char *) zerosize_ptr (); /* Too small, and we miss cache line boundary tests; too large, and the test takes cubically longer to complete. */ int limit = 257; if (page_boundary != NULL) { for (n = 1; n <= limit; n++) { char *mem = page_boundary - n; memset (mem, 'X', n); ASSERT (MEMCHR (mem, 'U', n) == NULL); ASSERT (MEMCHR (mem, 0, n) == NULL); { size_t i; size_t k; for (i = 0; i < n; i++) { mem[i] = 'U'; for (k = i + 1; k < n + limit; k++) ASSERT (MEMCHR (mem, 'U', k) == mem + i); mem[i] = 0; for (k = i + 1; k < n + limit; k++) ASSERT (MEMCHR (mem, 0, k) == mem + i); mem[i] = 'X'; } } } } } free (input); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fgetc.c������������������������������������������������������0000664�0001750�0001750�00000004765�14670377436�021320� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of fgetc() function. Copyright (C) 2011-2021 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, 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include "signature.h" SIGNATURE_CHECK (fgetc, int, (FILE *)); #include <errno.h> #include <fcntl.h> #include <unistd.h> #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" #endif #include "macros.h" int main (int argc, char **argv) { const char *filename = "test-fgetc.txt"; /* We don't have an fgetc() function that installs an invalid parameter handler so far. So install that handler here, explicitly. */ #if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING gl_msvc_inval_ensure_handler (); #endif /* Prepare a file. */ { const char text[] = "hello world"; int fd = open (filename, O_RDWR | O_CREAT | O_TRUNC, 0600); ASSERT (fd >= 0); ASSERT (write (fd, text, sizeof (text)) == sizeof (text)); ASSERT (close (fd) == 0); } /* Test that fgetc() sets errno if someone else closes the stream fd behind the back of stdio. */ { FILE *fp = fopen (filename, "r"); ASSERT (fp != NULL); ASSERT (close (fileno (fp)) == 0); errno = 0; ASSERT (fgetc (fp) == EOF); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } /* Test that fgetc() sets errno if the stream was constructed with an invalid file descriptor. */ { FILE *fp = fdopen (-1, "r"); if (fp != NULL) { errno = 0; ASSERT (fgetc (fp) == EOF); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } } { FILE *fp; close (99); fp = fdopen (99, "r"); if (fp != NULL) { errno = 0; ASSERT (fgetc (fp) == EOF); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } } /* Clean up. */ unlink (filename); return 0; } �����������kbuild-3608/src/grep/gnulib-tests/strerror_r.c������������������������������������������������������0000664�0001750�0001750�00000032414�14670377431�021441� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* strerror_r.c --- POSIX compatible system error routine Copyright (C) 2010-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2010. */ #include <config.h> /* Enable declaration of sys_nerr and sys_errlist in <errno.h> on NetBSD. */ #define _NETBSD_SOURCE 1 /* Specification. */ #include <string.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #if !HAVE_SNPRINTF # include <stdarg.h> #endif #include "strerror-override.h" #if (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) && HAVE___XPG_STRERROR_R /* glibc >= 2.3.4, cygwin >= 1.7.9 */ # define USE_XPG_STRERROR_R 1 extern #ifdef __cplusplus "C" #endif int __xpg_strerror_r (int errnum, char *buf, size_t buflen); #elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) /* The system's strerror_r function is OK, except that its third argument is 'int', not 'size_t', or its return type is wrong. */ # include <limits.h> # define USE_SYSTEM_STRERROR_R 1 #else /* (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__ ? !HAVE___XPG_STRERROR_R : !HAVE_DECL_STRERROR_R) */ /* Use the system's strerror(). Exclude glibc and cygwin because the system strerror_r has the wrong return type, and cygwin 1.7.9 strerror_r clobbers strerror. */ # undef strerror # define USE_SYSTEM_STRERROR 1 # if defined __NetBSD__ || defined __hpux || (defined _WIN32 && !defined __CYGWIN__) || defined __sgi || (defined __sun && !defined _LP64) || defined __CYGWIN__ /* No locking needed. */ /* Get catgets internationalization functions. */ # if HAVE_CATGETS # include <nl_types.h> # endif #ifdef __cplusplus extern "C" { #endif /* Get sys_nerr, sys_errlist on HP-UX (otherwise only declared in C++ mode). Get sys_nerr, sys_errlist on IRIX (otherwise only declared with _SGIAPI). */ # if defined __hpux || defined __sgi extern int sys_nerr; extern char *sys_errlist[]; # endif /* Get sys_nerr on Solaris. */ # if defined __sun && !defined _LP64 extern int sys_nerr; # endif #ifdef __cplusplus } #endif # else # include "glthread/lock.h" /* This lock protects the buffer returned by strerror(). We assume that no other uses of strerror() exist in the program. */ gl_lock_define_initialized(static, strerror_lock) # endif #endif /* On MSVC, there is no snprintf() function, just a _snprintf(). It is of lower quality, but sufficient for the simple use here. We only have to make sure to NUL terminate the result (_snprintf does not NUL terminate, like strncpy). */ #if !HAVE_SNPRINTF static int local_snprintf (char *buf, size_t buflen, const char *format, ...) { va_list args; int result; va_start (args, format); result = _vsnprintf (buf, buflen, format, args); va_end (args); if (buflen > 0 && (result < 0 || result >= buflen)) buf[buflen - 1] = '\0'; return result; } # undef snprintf # define snprintf local_snprintf #endif /* Copy as much of MSG into BUF as possible, without corrupting errno. Return 0 if MSG fit in BUFLEN, otherwise return ERANGE. */ static int safe_copy (char *buf, size_t buflen, const char *msg) { size_t len = strlen (msg); size_t moved = len < buflen ? len : buflen - 1; /* Although POSIX lets memmove corrupt errno, we don't know of any implementation where this is a real problem. */ memmove (buf, msg, moved); buf[moved] = '\0'; return len < buflen ? 0 : ERANGE; } int strerror_r (int errnum, char *buf, size_t buflen) #undef strerror_r { /* Filter this out now, so that rest of this replacement knows that there is room for a non-empty message and trailing NUL. */ if (buflen <= 1) { if (buflen) *buf = '\0'; return ERANGE; } *buf = '\0'; /* Check for gnulib overrides. */ { char const *msg = strerror_override (errnum); if (msg) return safe_copy (buf, buflen, msg); } { int ret; int saved_errno = errno; #if USE_XPG_STRERROR_R { ret = __xpg_strerror_r (errnum, buf, buflen); if (ret < 0) ret = errno; if (!*buf) { /* glibc 2.13 would not touch buf on err, so we have to fall back to GNU strerror_r which always returns a thread-safe untruncated string to (partially) copy into our buf. */ safe_copy (buf, buflen, strerror_r (errnum, buf, buflen)); } } #elif USE_SYSTEM_STRERROR_R if (buflen > INT_MAX) buflen = INT_MAX; # ifdef __hpux /* On HP-UX 11.31, strerror_r always fails when buflen < 80; it also fails to change buf on EINVAL. */ { char stackbuf[80]; if (buflen < sizeof stackbuf) { ret = strerror_r (errnum, stackbuf, sizeof stackbuf); if (ret == 0) ret = safe_copy (buf, buflen, stackbuf); } else ret = strerror_r (errnum, buf, buflen); } # else ret = strerror_r (errnum, buf, buflen); /* Some old implementations may return (-1, EINVAL) instead of EINVAL. But on Haiku, valid error numbers are negative. */ # if !defined __HAIKU__ if (ret < 0) ret = errno; # endif # endif # if defined _AIX || defined __HAIKU__ /* AIX and Haiku return 0 rather than ERANGE when truncating strings; try again until we are sure we got the entire string. */ if (!ret && strlen (buf) == buflen - 1) { char stackbuf[STACKBUF_LEN]; size_t len; strerror_r (errnum, stackbuf, sizeof stackbuf); len = strlen (stackbuf); /* STACKBUF_LEN should have been large enough. */ if (len + 1 == sizeof stackbuf) abort (); if (buflen <= len) ret = ERANGE; } # else /* Solaris 10 does not populate buf on ERANGE. OpenBSD 4.7 truncates early on ERANGE rather than return a partial integer. We prefer the maximal string. We set buf[0] earlier, and we know of no implementation that modifies buf to be an unterminated string, so this strlen should be portable in practice (rather than pulling in a safer strnlen). */ if (ret == ERANGE && strlen (buf) < buflen - 1) { char stackbuf[STACKBUF_LEN]; /* STACKBUF_LEN should have been large enough. */ if (strerror_r (errnum, stackbuf, sizeof stackbuf) == ERANGE) abort (); safe_copy (buf, buflen, stackbuf); } # endif #else /* USE_SYSTEM_STRERROR */ /* Try to do what strerror (errnum) does, but without clobbering the buffer used by strerror(). */ # if defined __NetBSD__ || defined __hpux || (defined _WIN32 && !defined __CYGWIN__) || defined __CYGWIN__ /* NetBSD, HP-UX, native Windows, Cygwin */ /* NetBSD: sys_nerr, sys_errlist are declared through _NETBSD_SOURCE and <errno.h> above. HP-UX: sys_nerr, sys_errlist are declared explicitly above. native Windows: sys_nerr, sys_errlist are declared in <stdlib.h>. Cygwin: sys_nerr, sys_errlist are declared in <errno.h>. */ if (errnum >= 0 && errnum < sys_nerr) { # if HAVE_CATGETS && (defined __NetBSD__ || defined __hpux) # if defined __NetBSD__ nl_catd catd = catopen ("libc", NL_CAT_LOCALE); const char *errmsg = (catd != (nl_catd)-1 ? catgets (catd, 1, errnum, sys_errlist[errnum]) : sys_errlist[errnum]); # endif # if defined __hpux nl_catd catd = catopen ("perror", NL_CAT_LOCALE); const char *errmsg = (catd != (nl_catd)-1 ? catgets (catd, 1, 1 + errnum, sys_errlist[errnum]) : sys_errlist[errnum]); # endif # else const char *errmsg = sys_errlist[errnum]; # endif if (errmsg == NULL || *errmsg == '\0') ret = EINVAL; else ret = safe_copy (buf, buflen, errmsg); # if HAVE_CATGETS && (defined __NetBSD__ || defined __hpux) if (catd != (nl_catd)-1) catclose (catd); # endif } else ret = EINVAL; # elif defined __sgi || (defined __sun && !defined _LP64) /* IRIX, Solaris <= 9 32-bit */ /* For a valid error number, the system's strerror() function returns a pointer to a not copied string, not to a buffer. */ if (errnum >= 0 && errnum < sys_nerr) { char *errmsg = strerror (errnum); if (errmsg == NULL || *errmsg == '\0') ret = EINVAL; else ret = safe_copy (buf, buflen, errmsg); } else ret = EINVAL; # else gl_lock_lock (strerror_lock); { char *errmsg = strerror (errnum); /* For invalid error numbers, strerror() on - IRIX 6.5 returns NULL, - HP-UX 11 returns an empty string. */ if (errmsg == NULL || *errmsg == '\0') ret = EINVAL; else ret = safe_copy (buf, buflen, errmsg); } gl_lock_unlock (strerror_lock); # endif #endif #if defined _WIN32 && !defined __CYGWIN__ /* MSVC 14 defines names for many error codes in the range 100..140, but _sys_errlist contains strings only for the error codes < _sys_nerr = 43. */ if (ret == EINVAL) { const char *errmsg; switch (errnum) { case 100 /* EADDRINUSE */: errmsg = "Address already in use"; break; case 101 /* EADDRNOTAVAIL */: errmsg = "Cannot assign requested address"; break; case 102 /* EAFNOSUPPORT */: errmsg = "Address family not supported by protocol"; break; case 103 /* EALREADY */: errmsg = "Operation already in progress"; break; case 105 /* ECANCELED */: errmsg = "Operation canceled"; break; case 106 /* ECONNABORTED */: errmsg = "Software caused connection abort"; break; case 107 /* ECONNREFUSED */: errmsg = "Connection refused"; break; case 108 /* ECONNRESET */: errmsg = "Connection reset by peer"; break; case 109 /* EDESTADDRREQ */: errmsg = "Destination address required"; break; case 110 /* EHOSTUNREACH */: errmsg = "No route to host"; break; case 112 /* EINPROGRESS */: errmsg = "Operation now in progress"; break; case 113 /* EISCONN */: errmsg = "Transport endpoint is already connected"; break; case 114 /* ELOOP */: errmsg = "Too many levels of symbolic links"; break; case 115 /* EMSGSIZE */: errmsg = "Message too long"; break; case 116 /* ENETDOWN */: errmsg = "Network is down"; break; case 117 /* ENETRESET */: errmsg = "Network dropped connection on reset"; break; case 118 /* ENETUNREACH */: errmsg = "Network is unreachable"; break; case 119 /* ENOBUFS */: errmsg = "No buffer space available"; break; case 123 /* ENOPROTOOPT */: errmsg = "Protocol not available"; break; case 126 /* ENOTCONN */: errmsg = "Transport endpoint is not connected"; break; case 128 /* ENOTSOCK */: errmsg = "Socket operation on non-socket"; break; case 129 /* ENOTSUP */: errmsg = "Not supported"; break; case 130 /* EOPNOTSUPP */: errmsg = "Operation not supported"; break; case 132 /* EOVERFLOW */: errmsg = "Value too large for defined data type"; break; case 133 /* EOWNERDEAD */: errmsg = "Owner died"; break; case 134 /* EPROTO */: errmsg = "Protocol error"; break; case 135 /* EPROTONOSUPPORT */: errmsg = "Protocol not supported"; break; case 136 /* EPROTOTYPE */: errmsg = "Protocol wrong type for socket"; break; case 138 /* ETIMEDOUT */: errmsg = "Connection timed out"; break; case 140 /* EWOULDBLOCK */: errmsg = "Operation would block"; break; default: errmsg = NULL; break; } if (errmsg != NULL) ret = safe_copy (buf, buflen, errmsg); } #endif if (ret == EINVAL && !*buf) { #if defined __HAIKU__ /* For consistency with perror(). */ snprintf (buf, buflen, "Unknown Application Error (%d)", errnum); #else snprintf (buf, buflen, "Unknown error %d", errnum); #endif } errno = saved_errno; return ret; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/inttostr.c��������������������������������������������������������0000664�0001750�0001750�00000001507�14670377431�021123� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Convert 'int' integer to printable string. Copyright (C) 2004-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #define anytostr inttostr #define inttype int #include "anytostr.c" �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-nl_langinfo.c������������������������������������������������0000664�0001750�0001750�00000014063�14670377436�022506� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of nl_langinfo replacement. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ #include <config.h> #include <langinfo.h> #include "signature.h" SIGNATURE_CHECK (nl_langinfo, char *, (nl_item)); #include <locale.h> #include <stdlib.h> #include <string.h> #include "c-strcase.h" #include "macros.h" /* For GCC >= 4.3, silence the warnings "comparison of unsigned expression >= 0 is always true" in this file. */ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) # pragma GCC diagnostic ignored "-Wtype-limits" #endif int main (int argc, char *argv[]) { int pass = atoi (argv[1]); /* pass locale 0 C 1 traditional French locale 2 French UTF-8 locale */ setlocale (LC_ALL, ""); /* nl_langinfo items of the LC_CTYPE category */ ASSERT (strlen (nl_langinfo (CODESET)) > 0); if (pass == 2) { const char *codeset = nl_langinfo (CODESET); ASSERT (c_strcasecmp (codeset, "UTF-8") == 0 || c_strcasecmp (codeset, "UTF8") == 0); } /* nl_langinfo items of the LC_NUMERIC category */ ASSERT (strlen (nl_langinfo (RADIXCHAR)) > 0); ASSERT (strlen (nl_langinfo (THOUSEP)) >= 0); /* nl_langinfo items of the LC_TIME category */ ASSERT (strlen (nl_langinfo (D_T_FMT)) > 0); ASSERT (strlen (nl_langinfo (D_FMT)) > 0); ASSERT (strlen (nl_langinfo (T_FMT)) > 0); ASSERT (strlen (nl_langinfo (T_FMT_AMPM)) >= (pass == 0 ? 1 : 0)); ASSERT (strlen (nl_langinfo (AM_STR)) >= (pass == 0 ? 1 : 0)); ASSERT (strlen (nl_langinfo (PM_STR)) >= (pass == 0 ? 1 : 0)); ASSERT (strlen (nl_langinfo (DAY_1)) > 0); ASSERT (strlen (nl_langinfo (DAY_2)) > 0); ASSERT (strlen (nl_langinfo (DAY_3)) > 0); ASSERT (strlen (nl_langinfo (DAY_4)) > 0); ASSERT (strlen (nl_langinfo (DAY_5)) > 0); ASSERT (strlen (nl_langinfo (DAY_6)) > 0); ASSERT (strlen (nl_langinfo (DAY_7)) > 0); ASSERT (strlen (nl_langinfo (ABDAY_1)) > 0); ASSERT (strlen (nl_langinfo (ABDAY_2)) > 0); ASSERT (strlen (nl_langinfo (ABDAY_3)) > 0); ASSERT (strlen (nl_langinfo (ABDAY_4)) > 0); ASSERT (strlen (nl_langinfo (ABDAY_5)) > 0); ASSERT (strlen (nl_langinfo (ABDAY_6)) > 0); ASSERT (strlen (nl_langinfo (ABDAY_7)) > 0); ASSERT (strlen (nl_langinfo (MON_1)) > 0); ASSERT (strlen (nl_langinfo (MON_2)) > 0); ASSERT (strlen (nl_langinfo (MON_3)) > 0); ASSERT (strlen (nl_langinfo (MON_4)) > 0); ASSERT (strlen (nl_langinfo (MON_5)) > 0); ASSERT (strlen (nl_langinfo (MON_6)) > 0); ASSERT (strlen (nl_langinfo (MON_7)) > 0); ASSERT (strlen (nl_langinfo (MON_8)) > 0); ASSERT (strlen (nl_langinfo (MON_9)) > 0); ASSERT (strlen (nl_langinfo (MON_10)) > 0); ASSERT (strlen (nl_langinfo (MON_11)) > 0); ASSERT (strlen (nl_langinfo (MON_12)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_1)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_2)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_3)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_4)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_5)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_6)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_7)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_8)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_9)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_10)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_11)) > 0); ASSERT (strlen (nl_langinfo (ALTMON_12)) > 0); /* In the tested locales, alternate month names and month names ought to be the same. */ ASSERT (strcmp (nl_langinfo (ALTMON_1), nl_langinfo (MON_1)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_2), nl_langinfo (MON_2)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_3), nl_langinfo (MON_3)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_4), nl_langinfo (MON_4)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_5), nl_langinfo (MON_5)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_6), nl_langinfo (MON_6)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_7), nl_langinfo (MON_7)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_8), nl_langinfo (MON_8)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_9), nl_langinfo (MON_9)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_10), nl_langinfo (MON_10)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_11), nl_langinfo (MON_11)) == 0); ASSERT (strcmp (nl_langinfo (ALTMON_12), nl_langinfo (MON_12)) == 0); ASSERT (strlen (nl_langinfo (ABMON_1)) > 0); ASSERT (strlen (nl_langinfo (ABMON_2)) > 0); ASSERT (strlen (nl_langinfo (ABMON_3)) > 0); ASSERT (strlen (nl_langinfo (ABMON_4)) > 0); ASSERT (strlen (nl_langinfo (ABMON_5)) > 0); ASSERT (strlen (nl_langinfo (ABMON_6)) > 0); ASSERT (strlen (nl_langinfo (ABMON_7)) > 0); ASSERT (strlen (nl_langinfo (ABMON_8)) > 0); ASSERT (strlen (nl_langinfo (ABMON_9)) > 0); ASSERT (strlen (nl_langinfo (ABMON_10)) > 0); ASSERT (strlen (nl_langinfo (ABMON_11)) > 0); ASSERT (strlen (nl_langinfo (ABMON_12)) > 0); ASSERT (strlen (nl_langinfo (ERA)) >= 0); ASSERT (strlen (nl_langinfo (ERA_D_FMT)) >= 0); ASSERT (strlen (nl_langinfo (ERA_D_T_FMT)) >= 0); ASSERT (strlen (nl_langinfo (ERA_T_FMT)) >= 0); ASSERT (nl_langinfo (ALT_DIGITS) != NULL); /* nl_langinfo items of the LC_MONETARY category */ { const char *currency = nl_langinfo (CRNCYSTR); ASSERT (strlen (currency) >= 0); #if !defined __NetBSD__ if (pass > 0) ASSERT (strlen (currency) >= 1); #endif } /* nl_langinfo items of the LC_MESSAGES category */ ASSERT (strlen (nl_langinfo (YESEXPR)) > 0); ASSERT (strlen (nl_langinfo (NOEXPR)) > 0); return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/zerosize-ptr.h����������������������������������������������������0000664�0001750�0001750�00000006104�14670377440�021715� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Return a pointer to a zero-size object in memory. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* ISO C 99 does not allow memcmp(), memchr() etc. to be invoked with a NULL argument. Therefore this file produces a non-NULL pointer which cannot be dereferenced, if possible. */ /* On Android, when targeting Android 4.4 or older with a GCC toolchain, prevent a compilation error "error: call to 'mmap' declared with attribute error: mmap is not available with _FILE_OFFSET_BITS=64 when using GCC until android-21. Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or switch to Clang." The files that we access in this compilation unit are less than 2 GB large. */ #if defined __ANDROID__ # undef _FILE_OFFSET_BITS # undef __USE_FILE_OFFSET64 #endif #include <stdlib.h> /* Test whether mmap() and mprotect() are available. We don't use HAVE_MMAP, because AC_FUNC_MMAP would not define it on HP-UX. HAVE_MPROTECT is not enough, because mingw does not have mmap() but has an mprotect() function in libgcc.a. And OS/2 kLIBC has <sys/mman.h> and mprotect(), but not mmap(). */ #if HAVE_SYS_MMAN_H && HAVE_MPROTECT && !defined __KLIBC__ # include <fcntl.h> # include <unistd.h> # include <sys/types.h> # include <sys/mman.h> /* Define MAP_FILE when it isn't otherwise. */ # ifndef MAP_FILE # define MAP_FILE 0 # endif #endif /* Return a pointer to a zero-size object in memory (that is, actually, a pointer to a page boundary where the previous page is readable and writable and the next page is neither readable not writable), if possible. Return NULL otherwise. */ static void * zerosize_ptr (void) { /* Use mmap and mprotect when they exist. Don't test HAVE_MMAP, because it is not defined on HP-UX 11 (since it does not support MAP_FIXED). */ #if HAVE_SYS_MMAN_H && HAVE_MPROTECT && !defined __KLIBC__ # if HAVE_MAP_ANONYMOUS const int flags = MAP_ANONYMOUS | MAP_PRIVATE; const int fd = -1; # else /* !HAVE_MAP_ANONYMOUS */ const int flags = MAP_FILE | MAP_PRIVATE; int fd = open ("/dev/zero", O_RDONLY, 0666); if (fd >= 0) # endif { int pagesize = getpagesize (); char *two_pages = (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, flags, fd, 0); if (two_pages != (char *)(-1) && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) return two_pages + pagesize; } #endif return NULL; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fstat.c������������������������������������������������������0000664�0001750�0001750�00000002375�14670377436�021344� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Tests of fstat() function. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <sys/stat.h> #include "signature.h" SIGNATURE_CHECK (fstat, int, (int, struct stat *)); #include <errno.h> #include <unistd.h> #include "macros.h" int main (int argc, char *argv[]) { /* Test behaviour for invalid file descriptors. */ { struct stat statbuf; errno = 0; ASSERT (fstat (-1, &statbuf) == -1); ASSERT (errno == EBADF); } { struct stat statbuf; close (99); errno = 0; ASSERT (fstat (99, &statbuf) == -1); ASSERT (errno == EBADF); } return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/uniwidth/���������������������������������������������������������0000775�0001750�0001750�00000000000�14670377437�020727� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/uniwidth/test-uc_width.c������������������������������������������0000664�0001750�0001750�00000003425�14670377437�023662� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of uc_width() function. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include "uniwidth.h" #include "macros.h" int main () { ucs4_t uc; /* Test width of ASCII characters. */ for (uc = 0x0020; uc < 0x007F; uc++) ASSERT (uc_width (uc, "ISO-8859-2") == 1); /* Test width of some non-spacing characters. */ ASSERT (uc_width (0x0301, "UTF-8") == 0); ASSERT (uc_width (0x05B0, "UTF-8") == 0); /* Test width of some format control characters. */ ASSERT (uc_width (0x200E, "UTF-8") == 0); ASSERT (uc_width (0x2060, "UTF-8") == 0); ASSERT (uc_width (0xE0001, "UTF-8") == 0); ASSERT (uc_width (0xE0044, "UTF-8") == 0); /* Test width of some zero width characters. */ ASSERT (uc_width (0x200B, "UTF-8") == 0); ASSERT (uc_width (0xFEFF, "UTF-8") == 0); /* Test width of some CJK characters. */ ASSERT (uc_width (0x3000, "UTF-8") == 2); ASSERT (uc_width (0xB250, "UTF-8") == 2); ASSERT (uc_width (0xFF1A, "UTF-8") == 2); ASSERT (uc_width (0x20369, "UTF-8") == 2); ASSERT (uc_width (0x2F876, "UTF-8") == 2); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/uniwidth/test-uc_width2.c�����������������������������������������0000664�0001750�0001750�00000004220�14670377437�023736� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of uc_width() function. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include "uniwidth.h" #include <stdio.h> #include "macros.h" /* One of 0, '0', '1', 'A', '2'. */ static char current_width; /* The interval for which the current_width holds. */ static ucs4_t current_start; static ucs4_t current_end; static void finish_interval (void) { if (current_width != 0) { if (current_start == current_end) printf ("%04X\t\t%c\n", (unsigned) current_start, current_width); else printf ("%04X..%04X\t%c\n", (unsigned) current_start, (unsigned) current_end, current_width); current_width = 0; } } static void add_to_interval (ucs4_t uc, char width) { if (current_width == width && uc == current_end + 1) current_end = uc; else { finish_interval (); current_width = width; current_start = current_end = uc; } } int main () { ucs4_t uc; for (uc = 0; uc < 0x110000; uc++) { int w1 = uc_width (uc, "UTF-8"); int w2 = uc_width (uc, "GBK"); char width = (w1 == 0 && w2 == 0 ? '0' : w1 == 1 && w2 == 1 ? '1' : w1 == 1 && w2 == 2 ? 'A' : w1 == 2 && w2 == 2 ? '2' : 0); if (width == 0) { /* uc must be a control character. */ ASSERT (w1 < 0 && w2 < 0); } else add_to_interval (uc, width); } finish_interval (); return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/uniwidth/test-uc_width2.sh����������������������������������������0000775�0001750�0001750�00000017164�14670377437�024144� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 tmpfiles="$tmpfiles uc_width.out" ${CHECKER} ./test-uc_width2${EXEEXT} | LC_ALL=C tr -d '\r' > uc_width.out tmpfiles="$tmpfiles uc_width.ok" cat > uc_width.ok <<\EOF 0000 0 0020..007E 1 00A0 1 00A1..00AC A 00AD 0 00AE..02FF A 0300..036F 0 0370..0482 A 0483..0489 0 048A..0590 A 0591..05BD 0 05BE A 05BF 0 05C0 A 05C1..05C2 0 05C3 A 05C4..05C5 0 05C6 A 05C7 0 05C8..05FF A 0600..0605 0 0606..060F A 0610..061A 0 061B A 061C 0 061D..064A A 064B..065F 0 0660..066F A 0670 0 0671..06D5 A 06D6..06DD 0 06DE A 06DF..06E4 0 06E5..06E6 A 06E7..06E8 0 06E9 A 06EA..06ED 0 06EE..070E A 070F 0 0710 A 0711 0 0712..072F A 0730..074A 0 074B..07A5 A 07A6..07B0 0 07B1..07EA A 07EB..07F3 0 07F4..0815 A 0816..0819 0 081A A 081B..0823 0 0824 A 0825..0827 0 0828 A 0829..082D 0 082E..0858 A 0859..085B 0 085C..08D3 A 08D4..0902 0 0903..0939 A 093A 0 093B A 093C 0 093D..0940 A 0941..0948 0 0949..094C A 094D 0 094E..0950 A 0951..0957 0 0958..0961 A 0962..0963 0 0964..0980 A 0981 0 0982..09BB A 09BC 0 09BD..09C0 A 09C1..09C4 0 09C5..09CC A 09CD 0 09CE..09E1 A 09E2..09E3 0 09E4..0A00 A 0A01..0A02 0 0A03..0A3B A 0A3C 0 0A3D..0A40 A 0A41..0A42 0 0A43..0A46 A 0A47..0A48 0 0A49..0A4A A 0A4B..0A4D 0 0A4E..0A50 A 0A51 0 0A52..0A6F A 0A70..0A71 0 0A72..0A74 A 0A75 0 0A76..0A80 A 0A81..0A82 0 0A83..0ABB A 0ABC 0 0ABD..0AC0 A 0AC1..0AC5 0 0AC6 A 0AC7..0AC8 0 0AC9..0ACC A 0ACD 0 0ACE..0AE1 A 0AE2..0AE3 0 0AE4..0B00 A 0B01 0 0B02..0B3B A 0B3C 0 0B3D..0B3E A 0B3F 0 0B40 A 0B41..0B44 0 0B45..0B4C A 0B4D 0 0B4E..0B55 A 0B56 0 0B57..0B61 A 0B62..0B63 0 0B64..0B81 A 0B82 0 0B83..0BBF A 0BC0 0 0BC1..0BCC A 0BCD 0 0BCE..0BFF A 0C00 0 0C01..0C3D A 0C3E..0C40 0 0C41..0C45 A 0C46..0C48 0 0C49 A 0C4A..0C4D 0 0C4E..0C54 A 0C55..0C56 0 0C57..0C61 A 0C62..0C63 0 0C64..0C80 A 0C81 0 0C82..0CBB A 0CBC 0 0CBD..0CCB A 0CCC..0CCD 0 0CCE..0CE1 A 0CE2..0CE3 0 0CE4..0D00 A 0D01 0 0D02..0D40 A 0D41..0D44 0 0D45..0D4C A 0D4D 0 0D4E..0D61 A 0D62..0D63 0 0D64..0DC9 A 0DCA 0 0DCB..0DD1 A 0DD2..0DD4 0 0DD5 A 0DD6 0 0DD7..0E30 A 0E31 0 0E32..0E33 A 0E34..0E3A 0 0E3B..0E46 A 0E47..0E4E 0 0E4F..0EB0 A 0EB1 0 0EB2..0EB3 A 0EB4..0EB9 0 0EBA A 0EBB..0EBC 0 0EBD..0EC7 A 0EC8..0ECD 0 0ECE..0F17 A 0F18..0F19 0 0F1A..0F34 A 0F35 0 0F36 A 0F37 0 0F38 A 0F39 0 0F3A..0F70 A 0F71..0F7E 0 0F7F A 0F80..0F84 0 0F85 A 0F86..0F87 0 0F88..0F8C A 0F8D..0F97 0 0F98 A 0F99..0FBC 0 0FBD..0FC5 A 0FC6 0 0FC7..102C A 102D..1030 0 1031 A 1032..1037 0 1038 A 1039..103A 0 103B..103C A 103D..103E 0 103F..1057 A 1058..1059 0 105A..105D A 105E..1060 0 1061..1070 A 1071..1074 0 1075..1081 A 1082 0 1083..1084 A 1085..1086 0 1087..108C A 108D 0 108E..109C A 109D 0 109E..10FF A 1100..115F 2 1160..135C A 135D..135F 0 1360..1711 A 1712..1714 0 1715..1731 A 1732..1734 0 1735..1751 A 1752..1753 0 1754..1771 A 1772..1773 0 1774..17B3 A 17B4..17B5 0 17B6 A 17B7..17BD 0 17BE..17C5 A 17C6 0 17C7..17C8 A 17C9..17D3 0 17D4..17DC A 17DD 0 17DE..180A A 180B..180E 0 180F..1884 A 1885..1886 0 1887..18A8 A 18A9 0 18AA..191F A 1920..1922 0 1923..1926 A 1927..1928 0 1929..1931 A 1932 0 1933..1938 A 1939..193B 0 193C..1A16 A 1A17..1A18 0 1A19..1A1A A 1A1B 0 1A1C..1A55 A 1A56 0 1A57 A 1A58..1A5E 0 1A5F A 1A60 0 1A61 A 1A62 0 1A63..1A64 A 1A65..1A6C 0 1A6D..1A72 A 1A73..1A7C 0 1A7D..1A7E A 1A7F 0 1A80..1AAF A 1AB0..1ABE 0 1ABF..1AFF A 1B00..1B03 0 1B04..1B33 A 1B34 0 1B35 A 1B36..1B3A 0 1B3B A 1B3C 0 1B3D..1B41 A 1B42 0 1B43..1B6A A 1B6B..1B73 0 1B74..1B7F A 1B80..1B81 0 1B82..1BA1 A 1BA2..1BA5 0 1BA6..1BA7 A 1BA8..1BA9 0 1BAA A 1BAB..1BAD 0 1BAE..1BE5 A 1BE6 0 1BE7 A 1BE8..1BE9 0 1BEA..1BEC A 1BED 0 1BEE A 1BEF..1BF1 0 1BF2..1C2B A 1C2C..1C33 0 1C34..1C35 A 1C36..1C37 0 1C38..1CCF A 1CD0..1CD2 0 1CD3 A 1CD4..1CE0 0 1CE1 A 1CE2..1CE8 0 1CE9..1CEC A 1CED 0 1CEE..1CF3 A 1CF4 0 1CF5..1CF7 A 1CF8..1CF9 0 1CFA..1DBF A 1DC0..1DF5 0 1DF6..1DFA A 1DFB..1DFF 0 1E00..200A A 200B..200F 0 2010..2029 A 202A..202E 0 202F..205F A 2060..2064 0 2065 A 2066..206F 0 2070..20A8 A 20A9 1 20AA..20CF A 20D0..20F0 0 20F1..2328 A 2329..232A 2 232B..2CEE A 2CEF..2CF1 0 2CF2..2D7E A 2D7F 0 2D80..2DDF A 2DE0..2DFF 0 2E00..2E7F A 2E80..3029 2 302A..302D 0 302E..303E 2 303F A 3040..3098 2 3099..309A 0 309B..4DBF 2 4DC0..4DFF A 4E00..A4CF 2 A4D0..A66E A A66F..A672 0 A673 A A674..A67D 0 A67E..A69D A A69E..A69F 0 A6A0..A6EF A A6F0..A6F1 0 A6F2..A801 A A802 0 A803..A805 A A806 0 A807..A80A A A80B 0 A80C..A824 A A825..A826 0 A827..A8C3 A A8C4..A8C5 0 A8C6..A8DF A A8E0..A8F1 0 A8F2..A925 A A926..A92D 0 A92E..A946 A A947..A951 0 A952..A97F A A980..A982 0 A983..A9B2 A A9B3 0 A9B4..A9B5 A A9B6..A9B9 0 A9BA..A9BB A A9BC 0 A9BD..A9E4 A A9E5 0 A9E6..AA28 A AA29..AA2E 0 AA2F..AA30 A AA31..AA32 0 AA33..AA34 A AA35..AA36 0 AA37..AA42 A AA43 0 AA44..AA4B A AA4C 0 AA4D..AA7B A AA7C 0 AA7D..AAAF A AAB0 0 AAB1 A AAB2..AAB4 0 AAB5..AAB6 A AAB7..AAB8 0 AAB9..AABD A AABE..AABF 0 AAC0 A AAC1 0 AAC2..AAEB A AAEC..AAED 0 AAEE..AAF5 A AAF6 0 AAF7..ABE4 A ABE5 0 ABE6..ABE7 A ABE8 0 ABE9..ABEC A ABED 0 ABEE..ABFF A AC00..D7A3 2 D7A4..F8FF A F900..FAFF 2 FB00..FB1D A FB1E 0 FB1F..FDFF A FE00..FE0F 0 FE10..FE1F 2 FE20..FE2F 0 FE30..FE6F 2 FE70..FEFE A FEFF 0 FF00..FF60 2 FF61..FFDF 1 FFE0..FFE6 2 FFE7..FFF8 1 FFF9..FFFB 0 FFFC..101FC 1 101FD 0 101FE..102DF 1 102E0 0 102E1..10375 1 10376..1037A 0 1037B..10A00 1 10A01..10A03 0 10A04 1 10A05..10A06 0 10A07..10A0B 1 10A0C..10A0F 0 10A10..10A37 1 10A38..10A3A 0 10A3B..10A3E 1 10A3F 0 10A40..10AE4 1 10AE5..10AE6 0 10AE7..11000 1 11001 0 11002..11037 1 11038..11046 0 11047..1107E 1 1107F..11081 0 11082..110B2 1 110B3..110B6 0 110B7..110B8 1 110B9..110BA 0 110BB..110BC 1 110BD 0 110BE..110FF 1 11100..11102 0 11103..11126 1 11127..1112B 0 1112C 1 1112D..11134 0 11135..11172 1 11173 0 11174..1117F 1 11180..11181 0 11182..111B5 1 111B6..111BE 0 111BF..111C9 1 111CA..111CC 0 111CD..1122E 1 1122F..11231 0 11232..11233 1 11234 0 11235 1 11236..11237 0 11238..1123D 1 1123E 0 1123F..112DE 1 112DF 0 112E0..112E2 1 112E3..112EA 0 112EB..112FF 1 11300..11301 0 11302..1133B 1 1133C 0 1133D..1133F 1 11340 0 11341..11365 1 11366..1136C 0 1136D..1136F 1 11370..11374 0 11375..11437 1 11438..1143F 0 11440..11441 1 11442..11444 0 11445 1 11446 0 11447..114B2 1 114B3..114B8 0 114B9 1 114BA 0 114BB..114BE 1 114BF..114C0 0 114C1 1 114C2..114C3 0 114C4..115B1 1 115B2..115B5 0 115B6..115BB 1 115BC..115BD 0 115BE 1 115BF..115C0 0 115C1..115DB 1 115DC..115DD 0 115DE..11632 1 11633..1163A 0 1163B..1163C 1 1163D 0 1163E 1 1163F..11640 0 11641..116AA 1 116AB 0 116AC 1 116AD 0 116AE..116AF 1 116B0..116B5 0 116B6 1 116B7 0 116B8..1171C 1 1171D..1171F 0 11720..11721 1 11722..11725 0 11726 1 11727..1172B 0 1172C..11C2F 1 11C30..11C36 0 11C37 1 11C38..11C3D 0 11C3E..11C91 1 11C92..11CA7 0 11CA8..11CA9 1 11CAA..11CB0 0 11CB1 1 11CB2..11CB3 0 11CB4 1 11CB5..11CB6 0 11CB7..16AEF 1 16AF0..16AF4 0 16AF5..16B2F 1 16B30..16B36 0 16B37..16F8E 1 16F8F..16F92 0 16F93..1BC9C 1 1BC9D..1BC9E 0 1BC9F 1 1BCA0..1BCA3 0 1BCA4..1D166 1 1D167..1D169 0 1D16A..1D172 1 1D173..1D182 0 1D183..1D184 1 1D185..1D18B 0 1D18C..1D1A9 1 1D1AA..1D1AD 0 1D1AE..1D241 1 1D242..1D244 0 1D245..1D9FF 1 1DA00..1DA36 0 1DA37..1DA3A 1 1DA3B..1DA6C 0 1DA6D..1DA74 1 1DA75 0 1DA76..1DA83 1 1DA84 0 1DA85..1DA9A 1 1DA9B..1DA9F 0 1DAA0 1 1DAA1..1DAAF 0 1DAB0..1DFFF 1 1E000..1E006 0 1E007 1 1E008..1E018 0 1E019..1E01A 1 1E01B..1E021 0 1E022 1 1E023..1E024 0 1E025 1 1E026..1E02A 0 1E02B..1E8CF 1 1E8D0..1E8D6 0 1E8D7..1E943 1 1E944..1E94A 0 1E94B..1FFFF 1 20000..3FFFF 2 40000..E0000 1 E0001 0 E0002..E001F 1 E0020..E007F 0 E0080..E00FF 1 E0100..E01EF 0 E01F0..10FFFF 1 EOF : ${DIFF=diff} ${DIFF} uc_width.ok uc_width.out result=$? rm -fr $tmpfiles exit $result ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-stdlib.c�����������������������������������������������������0000664�0001750�0001750�00000002625�14670377436�021502� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <stdlib.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <stdlib.h> #include "verify.h" /* Check that EXIT_SUCCESS is 0, per POSIX. */ static int exitcode = EXIT_SUCCESS; #if EXIT_SUCCESS "oops" #endif /* Check for GNU value (not guaranteed by POSIX, but is guaranteed by gnulib). */ #if EXIT_FAILURE != 1 "oops" #endif /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); #if GNULIB_TEST_SYSTEM_POSIX # include "test-sys_wait.h" #else # define test_sys_wait_macros() 0 #endif int main (void) { if (test_sys_wait_macros ()) return 1; return exitcode; } �����������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-iswblank.c���������������������������������������������������0000664�0001750�0001750�00000002043�14670377436�022025� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of iswblank() function. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <wctype.h> #include "macros.h" /* Check that WEOF is defined. */ wint_t e = WEOF; int main (void) { /* Check that the function exist as a function or as a macro. */ (void) iswblank (0); /* Check that the isw* functions map WEOF to 0. */ ASSERT (!iswblank (e)); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-read.c�������������������������������������������������������0000664�0001750�0001750�00000003461�14670377436�021133� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test the read() function. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (read, ssize_t, (int, void *, size_t)); #include <errno.h> #include <fcntl.h> #include <string.h> #include "macros.h" int main (void) { const char *filename = "test-read.tmp"; int fd; /* Create a file with a simple contents. */ fd = open (filename, O_CREAT | O_WRONLY, 0600); ASSERT (fd >= 0); ASSERT (write (fd, "Hello World", 11) == 11); ASSERT (close (fd) == 0); /* Read from the middle of the file. */ fd = open (filename, O_RDONLY); ASSERT (fd >= 0); ASSERT (lseek (fd, 6, SEEK_SET) == 6); { char buf[10]; ssize_t ret = read (fd, buf, 10); ASSERT (ret == 5); ASSERT (memcmp (buf, "World", 5) == 0); } ASSERT (close (fd) == 0); /* Test behaviour for invalid file descriptors. */ { char byte; errno = 0; ASSERT (read (-1, &byte, 1) == -1); ASSERT (errno == EBADF); } { char byte; close (99); errno = 0; ASSERT (read (99, &byte, 1) == -1); ASSERT (errno == EBADF); } /* Clean up. */ unlink (filename); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-dynarray.c���������������������������������������������������0000664�0001750�0001750�00000002506�14670377436�022050� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of type-safe arrays that grow dynamically. Copyright (C) 2021 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 2, 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2021. */ #include <config.h> #define DYNARRAY_STRUCT int_sequence #define DYNARRAY_ELEMENT int #define DYNARRAY_PREFIX intseq_ #include "dynarray.h" #include "macros.h" #define N 100000 static int value_at (long long int i) { return (i % 13) + ((i * i) % 251); } int main () { struct int_sequence s; int i; intseq_init (&s); for (i = 0; i < N; i++) intseq_add (&s, value_at (i)); for (i = N - 1; i >= N / 2; i--) { ASSERT (* intseq_at (&s, i) == value_at (i)); intseq_remove_last (&s); } intseq_free (&s); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-getopt-main.h������������������������������������������������0000664�0001750�0001750�00000004114�14670377436�022445� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of command line argument processing. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ #include "signature.h" SIGNATURE_CHECK (getopt, int, (int, char * const[], char const *)); #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> /* This test intentionally remaps stderr. So, we arrange to have fd 10 (outside the range of interesting fd's during the test) set up to duplicate the original stderr. */ #define BACKUP_STDERR_FILENO 10 #define ASSERT_STREAM myerr #include "macros.h" static FILE *myerr; #include "test-getopt.h" #if TEST_GETOPT_GNU # include "test-getopt_long.h" #endif int main (void) { /* This test validates that stderr is used correctly, so move the original into fd 10. */ if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL) return 2; ASSERT (freopen (TEST_GETOPT_TMP_NAME, "w", stderr) == stderr); /* These default values are required by POSIX. */ ASSERT (optind == 1); ASSERT (opterr != 0); setenv ("POSIXLY_CORRECT", "1", 1); test_getopt (); #if TEST_GETOPT_GNU test_getopt_long_posix (); #endif unsetenv ("POSIXLY_CORRECT"); test_getopt (); #if TEST_GETOPT_GNU test_getopt_long (); test_getopt_long_only (); #endif ASSERT (fclose (stderr) == 0); ASSERT (remove (TEST_GETOPT_TMP_NAME) == 0); return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-exclude3.sh��������������������������������������������������0000775�0001750�0001750�00000002443�14670377431�022121� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test suite for exclude. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . fail=0 # Test include cat > in <<EOT foo* bar Baz EOT cat > expected <<EOT foo: 1 foo*: 0 bar: 0 foobar: 1 baz: 1 bar/qux: 1 EOT ${CHECKER} test-exclude -include in -- foo 'foo*' bar foobar baz bar/qux > out || exit $? # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac # normalize output LC_ALL=C tr -d "$cr" < out > k && mv k out compare expected out || fail=1 Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-pathmax.c����������������������������������������������������0000664�0001750�0001750�00000001704�14670377436�021660� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of "pathmax.h". Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2011. */ #include <config.h> #include "pathmax.h" /* Check that PATH_MAX is a constant if it is defined. */ #ifdef PATH_MAX int a = PATH_MAX; #endif int main (void) { return 0; } ������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fopen.h������������������������������������������������������0000664�0001750�0001750�00000005057�14670377436�021337� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of opening a file stream. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ /* Include <config.h> and a form of <stdio.h> first. */ #include <errno.h> #include <unistd.h> #include "macros.h" /* Test fopen. Assumes BASE is defined. */ static int test_fopen (void) { FILE *f; /* Remove anything from prior partial run. */ unlink (BASE "file"); /* Read requires existing file. */ errno = 0; ASSERT (fopen (BASE "file", "r") == NULL); ASSERT (errno == ENOENT); /* Write can create a file. */ f = fopen (BASE "file", "w"); ASSERT (f); ASSERT (fclose (f) == 0); /* Trailing slash is invalid on non-directory. */ errno = 0; ASSERT (fopen (BASE "file/", "r") == NULL); ASSERT (errno == ENOTDIR || errno == EISDIR || errno == EINVAL); errno = 0; ASSERT (fopen (BASE "file/", "r+") == NULL); ASSERT (errno == ENOTDIR || errno == EISDIR || errno == EINVAL); /* Cannot create a directory. */ errno = 0; ASSERT (fopen ("nonexist.ent/", "w") == NULL); ASSERT (errno == ENOTDIR || errno == EISDIR || errno == ENOENT || errno == EINVAL); /* Directories cannot be opened for writing. */ errno = 0; ASSERT (fopen (".", "w") == NULL); ASSERT (errno == EISDIR || errno == EINVAL || errno == EACCES); errno = 0; ASSERT (fopen ("./", "w") == NULL); ASSERT (errno == EISDIR || errno == EINVAL || errno == EACCES); errno = 0; ASSERT (fopen (".", "r+") == NULL); ASSERT (errno == EISDIR || errno == EINVAL || errno == EACCES); errno = 0; ASSERT (fopen ("./", "r+") == NULL); ASSERT (errno == EISDIR || errno == EINVAL || errno == EACCES); /* /dev/null must exist, and be writable. */ f = fopen ("/dev/null", "r"); ASSERT (f); ASSERT (fclose (f) == 0); f = fopen ("/dev/null", "w"); ASSERT (f); ASSERT (fclose (f) == 0); /* Cleanup. */ ASSERT (unlink (BASE "file") == 0); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fdopendir.c��������������������������������������������������0000664�0001750�0001750�00000004300�14670377431�022156� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test opening a directory stream from a file descriptor. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <dirent.h> #include "signature.h" SIGNATURE_CHECK (fdopendir, DIR *, (int)); #include <errno.h> #include <fcntl.h> #include <unistd.h> #include "macros.h" int main (int argc _GL_UNUSED, char *argv[]) { DIR *d; int fd; /* A non-directory cannot be turned into a directory stream. */ fd = open ("test-fdopendir.tmp", O_RDONLY | O_CREAT, 0600); ASSERT (0 <= fd); errno = 0; ASSERT (fdopendir (fd) == NULL); ASSERT (errno == ENOTDIR); ASSERT (close (fd) == 0); ASSERT (unlink ("test-fdopendir.tmp") == 0); /* A bad fd cannot be turned into a stream. */ { errno = 0; ASSERT (fdopendir (-1) == NULL); ASSERT (errno == EBADF); } { close (99); errno = 0; ASSERT (fdopendir (99) == NULL); ASSERT (errno == EBADF); } /* This should work. */ fd = open (".", O_RDONLY); ASSERT (0 <= fd); d = fdopendir (fd); ASSERT (d); /* fdopendir should not close fd. */ ASSERT (dup2 (fd, fd) == fd); /* Don't test dirfd here. dirfd (d) must return fd on current POSIX platforms, but on pre-2008 platforms or on non-POSIX platforms dirfd (fd) might return some other descriptor, or -1, and gnulib does not work around this porting problem. */ ASSERT (closedir (d) == 0); /* Now we can guarantee that fd must be closed. */ errno = 0; ASSERT (dup2 (fd, fd) == -1); ASSERT (errno == EBADF); return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-bind.c�������������������������������������������������������0000664�0001750�0001750�00000003105�14670377431�021122� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test binding a server socket to a port. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <sys/socket.h> #include "signature.h" SIGNATURE_CHECK (bind, int, (int, const struct sockaddr *, socklen_t)); #include <errno.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include "sockets.h" #include "macros.h" int main (void) { (void) gl_sockets_startup (SOCKETS_1_1); /* Test behaviour for invalid file descriptors. */ { struct sockaddr_in addr; addr.sin_family = AF_INET; inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr); addr.sin_port = htons (80); { errno = 0; ASSERT (bind (-1, (const struct sockaddr *) &addr, sizeof (addr)) == -1); ASSERT (errno == EBADF); } { close (99); errno = 0; ASSERT (bind (99, (const struct sockaddr *) &addr, sizeof (addr)) == -1); ASSERT (errno == EBADF); } } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/inttostr.h��������������������������������������������������������0000664�0001750�0001750�00000002237�14670377430�021130� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* inttostr.h -- convert integers to printable strings Copyright (C) 2001-2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paul Eggert */ #include <stdint.h> #include <sys/types.h> #include "intprops.h" _GL_ATTRIBUTE_NODISCARD char *imaxtostr (intmax_t, char *); _GL_ATTRIBUTE_NODISCARD char *inttostr (int, char *); _GL_ATTRIBUTE_NODISCARD char *offtostr (off_t, char *); _GL_ATTRIBUTE_NODISCARD char *uinttostr (unsigned int, char *); _GL_ATTRIBUTE_NODISCARD char *umaxtostr (uintmax_t, char *); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-stddef.c�����������������������������������������������������0000664�0001750�0001750�00000005425�14670377436�021473� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <stddef.h> substitute. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <stddef.h> #include <limits.h> #include <stdalign.h> #include "verify.h" /* Check that appropriate types are defined. */ wchar_t a = 'c'; ptrdiff_t b = 1; size_t c = 2; max_align_t x; /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); /* Check that offsetof produces integer constants with correct type. */ struct d { char e; char f; }; /* Solaris 10 has a bug where offsetof is under-parenthesized, and cannot be used as an arbitrary expression. However, since it is unlikely to bite real code, we ignore that short-coming. */ /* verify (sizeof offsetof (struct d, e) == sizeof (size_t)); */ verify (sizeof (offsetof (struct d, e)) == sizeof (size_t)); verify (offsetof (struct d, f) == 1); /* offsetof promotes to an unsigned integer if and only if sizes do not fit in int. */ verify ((offsetof (struct d, e) < -1) == (INT_MAX < (size_t) -1)); /* Check max_align_t's alignment. */ verify (alignof (double) <= alignof (max_align_t)); verify (alignof (int) <= alignof (max_align_t)); verify (alignof (long double) <= alignof (max_align_t)); verify (alignof (long int) <= alignof (max_align_t)); verify (alignof (ptrdiff_t) <= alignof (max_align_t)); verify (alignof (size_t) <= alignof (max_align_t)); verify (alignof (wchar_t) <= alignof (max_align_t)); verify (alignof (struct d) <= alignof (max_align_t)); #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ verify (__alignof__ (double) <= __alignof__ (max_align_t)); verify (__alignof__ (int) <= __alignof__ (max_align_t)); verify (__alignof__ (long double) <= __alignof__ (max_align_t)); verify (__alignof__ (long int) <= __alignof__ (max_align_t)); verify (__alignof__ (ptrdiff_t) <= __alignof__ (max_align_t)); verify (__alignof__ (size_t) <= __alignof__ (max_align_t)); verify (__alignof__ (wchar_t) <= __alignof__ (max_align_t)); verify (__alignof__ (struct d) <= __alignof__ (max_align_t)); #endif int main (void) { return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-stat-time.c��������������������������������������������������0000664�0001750�0001750�00000015241�14670377436�022126� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <stat-time.h>. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by James Youngman <jay@gnu.org>, 2007. */ #include <config.h> #include "stat-time.h" #include <fcntl.h> #include <signal.h> #include <stdio.h> #include <sys/stat.h> #include <unistd.h> #include <time.h> #include "macros.h" #define BASE "test-stat-time.t" #include "nap.h" enum { NFILES = 4 }; static char filename_stamp1[50]; static char filename_testfile[50]; static char filename_stamp2[50]; static char filename_stamp3[50]; /* Use file names that are different at each run. This is necessary for test_birthtime() to pass on native Windows: On this platform, the file system apparently remembers the creation time of a file even after it is removed and created anew. See "Windows NT Contains File System Tunneling Capabilities" <https://support.microsoft.com/en-us/help/172190/> */ static void initialize_filenames (void) { long t = (long) time (NULL); sprintf (filename_stamp1, "t-stt-%ld-stamp1", t); sprintf (filename_testfile, "t-stt-%ld-testfile", t); sprintf (filename_stamp2, "t-stt-%ld-stamp2", t); sprintf (filename_stamp3, "t-stt-%ld-stamp3", t); } static int force_unlink (const char *filename) { /* This chmod is necessary on mingw, where unlink() of a read-only file fails with EPERM. */ chmod (filename, 0600); return unlink (filename); } static void cleanup (int sig) { /* Remove temporary files. */ force_unlink (filename_stamp1); force_unlink (filename_testfile); force_unlink (filename_stamp2); force_unlink (filename_stamp3); if (sig != 0) _exit (1); } static int open_file (const char *filename, int flags) { int fd = open (filename, flags | O_WRONLY, 0500); if (fd >= 0) { close (fd); return 1; } else { return 0; } } static void create_file (const char *filename) { ASSERT (open_file (filename, O_CREAT | O_EXCL)); } static void do_stat (const char *filename, struct stat *p) { ASSERT (stat (filename, p) == 0); } static void prepare_test (struct stat *statinfo, struct timespec *modtimes) { int i; create_file (filename_stamp1); nap (); create_file (filename_testfile); nap (); create_file (filename_stamp2); nap (); ASSERT (chmod (filename_testfile, 0400) == 0); nap (); create_file (filename_stamp3); do_stat (filename_stamp1, &statinfo[0]); do_stat (filename_testfile, &statinfo[1]); do_stat (filename_stamp2, &statinfo[2]); do_stat (filename_stamp3, &statinfo[3]); /* Now use our access functions. */ for (i = 0; i < NFILES; ++i) { modtimes[i] = get_stat_mtime (&statinfo[i]); } } static void test_mtime (const struct stat *statinfo, struct timespec *modtimes) { int i; /* Use the struct stat fields directly. */ /* mtime(stamp1) < mtime(stamp2) */ ASSERT (statinfo[0].st_mtime < statinfo[2].st_mtime || (statinfo[0].st_mtime == statinfo[2].st_mtime && (get_stat_mtime_ns (&statinfo[0]) < get_stat_mtime_ns (&statinfo[2])))); /* mtime(stamp2) < mtime(stamp3) */ ASSERT (statinfo[2].st_mtime < statinfo[3].st_mtime || (statinfo[2].st_mtime == statinfo[3].st_mtime && (get_stat_mtime_ns (&statinfo[2]) < get_stat_mtime_ns (&statinfo[3])))); /* Now check the result of the access functions. */ /* mtime(stamp1) < mtime(stamp2) */ ASSERT (modtimes[0].tv_sec < modtimes[2].tv_sec || (modtimes[0].tv_sec == modtimes[2].tv_sec && modtimes[0].tv_nsec < modtimes[2].tv_nsec)); /* mtime(stamp2) < mtime(stamp3) */ ASSERT (modtimes[2].tv_sec < modtimes[3].tv_sec || (modtimes[2].tv_sec == modtimes[3].tv_sec && modtimes[2].tv_nsec < modtimes[3].tv_nsec)); /* verify equivalence */ for (i = 0; i < NFILES; ++i) { struct timespec ts; ts = get_stat_mtime (&statinfo[i]); ASSERT (ts.tv_sec == statinfo[i].st_mtime); } } #if defined _WIN32 && !defined __CYGWIN__ /* Skip the ctime tests on native Windows platforms, because their st_ctime is either the same as st_mtime (plus or minus an offset) or set to the file _creation_ time, and is not influenced by rename or chmod. */ # define test_ctime(ignored) ((void) 0) #else static void test_ctime (const struct stat *statinfo) { /* On some buggy NFS clients, mtime and ctime are disproportionately skewed from one another. Skip this test in that case. */ if (statinfo[0].st_mtime != statinfo[0].st_ctime) return; /* mtime(stamp2) < ctime(testfile) */ ASSERT (statinfo[2].st_mtime < statinfo[1].st_ctime || (statinfo[2].st_mtime == statinfo[1].st_ctime && (get_stat_mtime_ns (&statinfo[2]) < get_stat_ctime_ns (&statinfo[1])))); } #endif static void test_birthtime (const struct stat *statinfo, const struct timespec *modtimes, struct timespec *birthtimes) { int i; /* Collect the birth times. */ for (i = 0; i < NFILES; ++i) { birthtimes[i] = get_stat_birthtime (&statinfo[i]); if (birthtimes[i].tv_nsec < 0) return; } /* mtime(stamp1) < birthtime(testfile) */ ASSERT (modtimes[0].tv_sec < birthtimes[1].tv_sec || (modtimes[0].tv_sec == birthtimes[1].tv_sec && modtimes[0].tv_nsec < birthtimes[1].tv_nsec)); /* birthtime(testfile) < mtime(stamp2) */ ASSERT (birthtimes[1].tv_sec < modtimes[2].tv_sec || (birthtimes[1].tv_sec == modtimes[2].tv_sec && birthtimes[1].tv_nsec < modtimes[2].tv_nsec)); } int main (void) { struct stat statinfo[NFILES]; struct timespec modtimes[NFILES]; struct timespec birthtimes[NFILES]; initialize_filenames (); #ifdef SIGHUP signal (SIGHUP, cleanup); #endif #ifdef SIGINT signal (SIGINT, cleanup); #endif #ifdef SIGQUIT signal (SIGQUIT, cleanup); #endif #ifdef SIGTERM signal (SIGTERM, cleanup); #endif cleanup (0); prepare_test (statinfo, modtimes); test_mtime (statinfo, modtimes); test_ctime (statinfo); test_birthtime (statinfo, modtimes, birthtimes); cleanup (0); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/localename-table.h������������������������������������������������0000664�0001750�0001750�00000005476�14670377430�022437� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Table that maps a locale object to the names of the locale categories. Copyright (C) 2018-2021 Free Software Foundation, Inc. This program 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2018. */ #if HAVE_WORKING_USELOCALE && HAVE_NAMELESS_LOCALES # include <stddef.h> # include <locale.h> # include "glthread/lock.h" struct locale_categories_names { /* Locale category -> name (allocated with indefinite extent). */ const char *category_name[6]; }; /* A hash table of fixed size. Multiple threads can access it read-only simultaneously, but only one thread can insert into it or remove from it at the same time. This hash table has global scope, so that when an application uses both GNU libintl and gnulib, the application sees only one hash table. (When linking statically with libintl, the fact that localename-table.c is a separate compilation unit resolves the duplicate symbol conflict. When linking with libintl as a shared library, we rely on ELF and the symbol conflict resolution implemented in the ELF dynamic loader here.) Both the libintl overrides and the gnulib overrides of the functions newlocale, duplocale, freelocale see the same hash table (and the same lock). For this reason, the internal layout of the hash table and the hash function MUST NEVER CHANGE. If you need to change the internal layout or the hash function, introduce versioning by appending a version suffix to the symbols at the linker level. */ # define locale_hash_function libintl_locale_hash_function # define locale_hash_table libintl_locale_hash_table # define locale_lock libintl_locale_lock extern size_t _GL_ATTRIBUTE_CONST locale_hash_function (locale_t x); /* A node in a hash bucket collision list. */ struct locale_hash_node { struct locale_hash_node *next; locale_t locale; struct locale_categories_names names; }; # define LOCALE_HASH_TABLE_SIZE 101 extern struct locale_hash_node * locale_hash_table[LOCALE_HASH_TABLE_SIZE]; /* This lock protects the locale_hash_table against multiple simultaneous accesses (except that multiple simultaneous read accesses are allowed). */ gl_rwlock_define(extern, locale_lock) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-getopt.h�����������������������������������������������������0000664�0001750�0001750�00000125655�14670377436�021541� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of command line argument processing. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ #include <stdbool.h> /* The glibc/gnulib implementation of getopt supports setting optind = 0, but not all other implementations do. This matters for getopt. But for getopt_long, we require GNU compatibility. */ #if defined __GETOPT_PREFIX || (__GLIBC__ >= 2 && !defined __UCLIBC__) # define OPTIND_MIN 0 #elif HAVE_DECL_OPTRESET # define OPTIND_MIN (optreset = 1) #else # define OPTIND_MIN 1 #endif static void getopt_loop (int argc, const char **argv, const char *options, int *a_seen, int *b_seen, const char **p_value, const char **q_value, int *non_options_count, const char **non_options, int *unrecognized, bool *message_issued) { int c; int pos = ftell (stderr); while ((c = getopt (argc, (char **) argv, options)) != -1) { switch (c) { case 'a': (*a_seen)++; break; case 'b': (*b_seen)++; break; case 'p': *p_value = optarg; break; case 'q': *q_value = optarg; break; case '\1': /* Must only happen with option '-' at the beginning. */ ASSERT (options[0] == '-'); non_options[(*non_options_count)++] = optarg; break; case ':': /* Must only happen with option ':' at the beginning. */ ASSERT (options[0] == ':' || ((options[0] == '-' || options[0] == '+') && options[1] == ':')); FALLTHROUGH; case '?': *unrecognized = optopt; break; default: *unrecognized = c; break; } } *message_issued = pos < ftell (stderr); } static void test_getopt (void) { int start; bool posixly = !!getenv ("POSIXLY_CORRECT"); /* See comment in getopt.c: glibc gets a LSB-compliant getopt. Standalone applications get a POSIX-compliant getopt. */ #if defined __GETOPT_PREFIX || !(__GLIBC__ >= 2 || defined __MINGW32__) /* Using getopt from gnulib or from a non-glibc system. */ posixly = true; #endif /* Test processing of boolean options. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-a"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "ab", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-b"; argv[argc++] = "-a"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "ab", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-ba"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "ab", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-ab"; argv[argc++] = "-a"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "ab", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 2); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); ASSERT (!output); } /* Test processing of options with arguments. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-pfoo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "p:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "p:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-ab"; argv[argc++] = "-q"; argv[argc++] = "baz"; argv[argc++] = "-pfoo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 1); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 5); ASSERT (!output); } #if GNULIB_TEST_GETOPT_GNU /* Test processing of options with optional arguments. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-pfoo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "p::q::", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "p::q::", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 2); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "abp::q::", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 3); ASSERT (!output); } #endif /* GNULIB_TEST_GETOPT_GNU */ /* Check that invalid options are recognized; and that both opterr and leading ':' can silence output. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "-x"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 42; getopt_loop (argc, argv, "abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 'x'); ASSERT (optind == 5); ASSERT (output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "-x"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 0; getopt_loop (argc, argv, "abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 'x'); ASSERT (optind == 5); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "-x"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, ":abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 'x'); ASSERT (optind == 5); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "-:"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 42; getopt_loop (argc, argv, "abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == ':'); ASSERT (optind == 5); ASSERT (output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "-:"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 0; getopt_loop (argc, argv, "abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == ':'); ASSERT (optind == 5); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc++] = "foo"; argv[argc++] = "-:"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, ":abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == ':'); ASSERT (optind == 5); ASSERT (!output); } /* Check for missing argument behavior. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-ap"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 'p'); ASSERT (optind == 2); ASSERT (output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-ap"; argv[argc] = NULL; optind = start; opterr = 0; getopt_loop (argc, argv, "abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 'p'); ASSERT (optind == 2); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-ap"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, ":abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 'p'); ASSERT (optind == 2); ASSERT (!output); } /* Check that by default, non-options arguments are moved to the end. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); if (posixly) { ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 1); ASSERT (!output); } else { ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "-p") == 0); ASSERT (strcmp (argv[2], "billy") == 0); ASSERT (strcmp (argv[3], "-a") == 0); ASSERT (strcmp (argv[4], "donald") == 0); ASSERT (strcmp (argv[5], "duck") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 4); ASSERT (!output); } } /* Check that '--' ends the argument processing. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[20]; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "--"; argv[argc++] = "-b"; argv[argc++] = "foo"; argv[argc++] = "-q"; argv[argc++] = "johnny"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); if (posixly) { ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "--") == 0); ASSERT (strcmp (argv[7], "-b") == 0); ASSERT (strcmp (argv[8], "foo") == 0); ASSERT (strcmp (argv[9], "-q") == 0); ASSERT (strcmp (argv[10], "johnny") == 0); ASSERT (strcmp (argv[11], "bar") == 0); ASSERT (argv[12] == NULL); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 1); ASSERT (!output); } else { ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "-p") == 0); ASSERT (strcmp (argv[2], "billy") == 0); ASSERT (strcmp (argv[3], "-a") == 0); ASSERT (strcmp (argv[4], "--") == 0); ASSERT (strcmp (argv[5], "donald") == 0); ASSERT (strcmp (argv[6], "duck") == 0); ASSERT (strcmp (argv[7], "-b") == 0); ASSERT (strcmp (argv[8], "foo") == 0); ASSERT (strcmp (argv[9], "-q") == 0); ASSERT (strcmp (argv[10], "johnny") == 0); ASSERT (strcmp (argv[11], "bar") == 0); ASSERT (argv[12] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 5); ASSERT (!output); } } #if GNULIB_TEST_GETOPT_GNU /* Check that the '-' flag causes non-options to be returned in order. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "-abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 3); ASSERT (strcmp (non_options[0], "donald") == 0); ASSERT (strcmp (non_options[1], "duck") == 0); ASSERT (strcmp (non_options[2], "bar") == 0); ASSERT (unrecognized == 0); ASSERT (optind == 7); ASSERT (!output); } /* Check that '--' ends the argument processing. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[20]; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "--"; argv[argc++] = "-b"; argv[argc++] = "foo"; argv[argc++] = "-q"; argv[argc++] = "johnny"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "-abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "--") == 0); ASSERT (strcmp (argv[7], "-b") == 0); ASSERT (strcmp (argv[8], "foo") == 0); ASSERT (strcmp (argv[9], "-q") == 0); ASSERT (strcmp (argv[10], "johnny") == 0); ASSERT (strcmp (argv[11], "bar") == 0); ASSERT (argv[12] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (!output); if (non_options_count == 2) { /* glibc behaviour. */ ASSERT (non_options_count == 2); ASSERT (strcmp (non_options[0], "donald") == 0); ASSERT (strcmp (non_options[1], "duck") == 0); ASSERT (unrecognized == 0); ASSERT (optind == 7); } else { /* Another valid behaviour. */ ASSERT (non_options_count == 7); ASSERT (strcmp (non_options[0], "donald") == 0); ASSERT (strcmp (non_options[1], "duck") == 0); ASSERT (strcmp (non_options[2], "-b") == 0); ASSERT (strcmp (non_options[3], "foo") == 0); ASSERT (strcmp (non_options[4], "-q") == 0); ASSERT (strcmp (non_options[5], "johnny") == 0); ASSERT (strcmp (non_options[6], "bar") == 0); ASSERT (unrecognized == 0); ASSERT (optind == 12); } } /* Check that the '-' flag has to come first. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "abp:q:-", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); if (posixly) { ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 1); ASSERT (!output); } else { ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "-p") == 0); ASSERT (strcmp (argv[2], "billy") == 0); ASSERT (strcmp (argv[3], "-a") == 0); ASSERT (strcmp (argv[4], "donald") == 0); ASSERT (strcmp (argv[5], "duck") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 4); ASSERT (!output); } } /* Check that the '+' flag causes the first non-option to terminate the loop. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "+abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 1); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-+"; argv[argc] = NULL; optind = start; getopt_loop (argc, argv, "+abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == '+'); ASSERT (optind == 2); ASSERT (output); } /* Check that '--' ends the argument processing. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[20]; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "--"; argv[argc++] = "-b"; argv[argc++] = "foo"; argv[argc++] = "-q"; argv[argc++] = "johnny"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "+abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "--") == 0); ASSERT (strcmp (argv[7], "-b") == 0); ASSERT (strcmp (argv[8], "foo") == 0); ASSERT (strcmp (argv[9], "-q") == 0); ASSERT (strcmp (argv[10], "johnny") == 0); ASSERT (strcmp (argv[11], "bar") == 0); ASSERT (argv[12] == NULL); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 1); ASSERT (!output); } #endif /* GNULIB_TEST_GETOPT_GNU */ /* Check that the '+' flag has to come first. */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "abp:q:+", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); if (posixly) { ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 1); ASSERT (!output); } else { ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "-p") == 0); ASSERT (strcmp (argv[2], "billy") == 0); ASSERT (strcmp (argv[3], "-a") == 0); ASSERT (strcmp (argv[4], "donald") == 0); ASSERT (strcmp (argv[5], "duck") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 1); ASSERT (b_seen == 0); ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 4); ASSERT (!output); } } #if GNULIB_TEST_GETOPT_GNU /* If GNU extensions are supported, require compliance with POSIX interpretation on leading '+' behavior. http://austingroupbugs.net/view.php?id=191 */ for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = start; opterr = 1; getopt_loop (argc, argv, "+:abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (strcmp (argv[0], "program") == 0); ASSERT (strcmp (argv[1], "donald") == 0); ASSERT (strcmp (argv[2], "-p") == 0); ASSERT (strcmp (argv[3], "billy") == 0); ASSERT (strcmp (argv[4], "duck") == 0); ASSERT (strcmp (argv[5], "-a") == 0); ASSERT (strcmp (argv[6], "bar") == 0); ASSERT (argv[7] == NULL); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); ASSERT (optind == 1); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-p"; argv[argc] = NULL; optind = start; getopt_loop (argc, argv, "+:abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 0); ASSERT (b_seen == 0); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 'p'); ASSERT (optind == 2); ASSERT (!output); } for (start = OPTIND_MIN; start <= 1; start++) { int a_seen = 0; int b_seen = 0; const char *p_value = NULL; const char *q_value = NULL; int non_options_count = 0; const char *non_options[10]; int unrecognized = 0; bool output; int argc = 0; const char *argv[10]; argv[argc++] = "program"; argv[argc++] = "-b"; argv[argc++] = "-p"; argv[argc] = NULL; optind = start; getopt_loop (argc, argv, "+:abp:q:", &a_seen, &b_seen, &p_value, &q_value, &non_options_count, non_options, &unrecognized, &output); ASSERT (a_seen == 0); ASSERT (b_seen == 1); ASSERT (p_value == NULL); ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 'p'); ASSERT (optind == 3); ASSERT (!output); } /* Check that 'W' does not dump core: https://sourceware.org/bugzilla/show_bug.cgi?id=12922 Technically, POSIX says the presence of ';' in the opt-string gives unspecified behavior, so we only test this when GNU compliance is desired. */ for (start = OPTIND_MIN; start <= 1; start++) { int argc = 0; const char *argv[10]; int pos = ftell (stderr); argv[argc++] = "program"; argv[argc++] = "-W"; argv[argc++] = "dummy"; argv[argc] = NULL; optind = start; opterr = 1; ASSERT (getopt (argc, (char **) argv, "W;") == 'W'); ASSERT (ftell (stderr) == pos); ASSERT (optind == 2); } #endif /* GNULIB_TEST_GETOPT_GNU */ } �����������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsrtowcs4.sh������������������������������������������������0000775�0001750�0001750�00000000617�14670377436�022522� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test whether a specific GB18030 locale is installed. : ${LOCALE_ZH_CN=zh_CN.GB18030} if test $LOCALE_ZH_CN = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no transitional chinese locale is installed" else echo "Skipping test: no transitional chinese locale is supported" fi exit 77 fi LC_ALL=$LOCALE_ZH_CN \ ${CHECKER} ./test-mbsrtowcs${EXEEXT} 4 �����������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/pthread-thread.c��������������������������������������������������0000664�0001750�0001750�00000007614�14670377430�022135� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Creating and controlling POSIX threads. Copyright (C) 2010-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paul Eggert, 2010, and Bruno Haible <bruno@clisp.org>, 2019. */ #include <config.h> /* Specification. */ #include <pthread.h> #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS # include "windows-thread.h" #else # include <stdlib.h> #endif typedef void * (* pthread_main_function_t) (void *); #if ((defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS) || !HAVE_PTHREAD_H int pthread_attr_init (pthread_attr_t *attr) { *attr = PTHREAD_CREATE_JOINABLE; return 0; } int pthread_attr_getdetachstate (const pthread_attr_t *attr, int *detachstatep) { *detachstatep = *attr & (PTHREAD_CREATE_JOINABLE | PTHREAD_CREATE_DETACHED); return 0; } int pthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate) { if (!(detachstate == PTHREAD_CREATE_JOINABLE || detachstate == PTHREAD_CREATE_DETACHED)) return EINVAL; *attr ^= (*attr ^ detachstate) & (PTHREAD_CREATE_JOINABLE | PTHREAD_CREATE_DETACHED); return 0; } int pthread_attr_destroy (pthread_attr_t *attr _GL_UNUSED) { return 0; } #endif #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS /* Use Windows threads. */ int pthread_create (pthread_t *threadp, const pthread_attr_t *attr, pthread_main_function_t mainfunc, void *arg) { unsigned int glwthread_attr = (attr != NULL && (*attr & (PTHREAD_CREATE_JOINABLE | PTHREAD_CREATE_DETACHED)) != PTHREAD_CREATE_JOINABLE ? GLWTHREAD_ATTR_DETACHED : 0); return glwthread_thread_create (threadp, glwthread_attr, mainfunc, arg); } pthread_t pthread_self (void) { return glwthread_thread_self (); } int pthread_equal (pthread_t thread1, pthread_t thread2) { return thread1 == thread2; } int pthread_detach (pthread_t thread) { return glwthread_thread_detach (thread); } int pthread_join (pthread_t thread, void **valuep) { return glwthread_thread_join (thread, valuep); } void pthread_exit (void *value) { glwthread_thread_exit (value); } #elif HAVE_PTHREAD_H /* Provide workarounds for POSIX threads. */ # if PTHREAD_CREATE_IS_INLINE int pthread_create (pthread_t *threadp, const pthread_attr_t *attr, pthread_main_function_t mainfunc, void *arg) # undef pthread_create { return pthread_create (threadp, attr, mainfunc, arg); } int pthread_attr_init (pthread_attr_t *attr) # undef pthread_attr_init { return pthread_attr_init (attr); } # endif #else /* Provide a dummy implementation for single-threaded applications. */ int pthread_create (pthread_t *threadp, const pthread_attr_t *attr, pthread_main_function_t mainfunc, void *arg) { /* The maximum number of threads is reached. Do not create a thread. */ return EAGAIN; } pthread_t pthread_self (void) { return 42; } int pthread_equal (pthread_t thread1, pthread_t thread2) { return thread1 == thread2; } int pthread_detach (pthread_t thread) { /* There are no joinable threads. */ return EINVAL; } int pthread_join (pthread_t thread, void **valuep) { /* There are no joinable threads. */ return EINVAL; } void pthread_exit (void *value) { /* There is just one thread, so the process exits. */ exit (0); } #endif ��������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-xalloc-die.c�������������������������������������������������0000664�0001750�0001750�00000001634�14670377437�022242� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of xalloc_die() function. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson <simon@josefsson.org>, 2009. */ #include <config.h> #include "xalloc.h" int main (int argc _GL_UNUSED, char **argv) { xalloc_die (); return 0; } ����������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsstr3.sh���������������������������������������������������0000775�0001750�0001750�00000000601�14670377436�022001� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test whether a specific GB18030 locale is installed. : ${LOCALE_ZH_CN=zh_CN.GB18030} if test $LOCALE_ZH_CN = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no chinese GB18030 locale is installed" else echo "Skipping test: no chinese GB18030 locale is supported" fi exit 77 fi LC_ALL=$LOCALE_ZH_CN \ ${CHECKER} ./test-mbsstr3${EXEEXT} �������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-errno.c������������������������������������������������������0000664�0001750�0001750�00000005555�14670377431�021346� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <errno.h> substitute. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include <errno.h> /* Verify that the POSIX mandated errno values exist and can be used as initializers outside of a function. The variable names happen to match the Linux/x86 error numbers. */ int e1 = EPERM; int e2 = ENOENT; int e3 = ESRCH; int e4 = EINTR; int e5 = EIO; int e6 = ENXIO; int e7 = E2BIG; int e8 = ENOEXEC; int e9 = EBADF; int e10 = ECHILD; int e11 = EAGAIN; int e11a = EWOULDBLOCK; int e12 = ENOMEM; int e13 = EACCES; int e14 = EFAULT; int e16 = EBUSY; int e17 = EEXIST; int e18 = EXDEV; int e19 = ENODEV; int e20 = ENOTDIR; int e21 = EISDIR; int e22 = EINVAL; int e23 = ENFILE; int e24 = EMFILE; int e25 = ENOTTY; int e26 = ETXTBSY; int e27 = EFBIG; int e28 = ENOSPC; int e29 = ESPIPE; int e30 = EROFS; int e31 = EMLINK; int e32 = EPIPE; int e33 = EDOM; int e34 = ERANGE; int e35 = EDEADLK; int e36 = ENAMETOOLONG; int e37 = ENOLCK; int e38 = ENOSYS; int e39 = ENOTEMPTY; int e40 = ELOOP; int e42 = ENOMSG; int e43 = EIDRM; int e67 = ENOLINK; int e71 = EPROTO; int e72 = EMULTIHOP; int e74 = EBADMSG; int e75 = EOVERFLOW; int e84 = EILSEQ; int e88 = ENOTSOCK; int e89 = EDESTADDRREQ; int e90 = EMSGSIZE; int e91 = EPROTOTYPE; int e92 = ENOPROTOOPT; int e93 = EPROTONOSUPPORT; int e95 = EOPNOTSUPP; int e95a = ENOTSUP; int e97 = EAFNOSUPPORT; int e98 = EADDRINUSE; int e99 = EADDRNOTAVAIL; int e100 = ENETDOWN; int e101 = ENETUNREACH; int e102 = ENETRESET; int e103 = ECONNABORTED; int e104 = ECONNRESET; int e105 = ENOBUFS; int e106 = EISCONN; int e107 = ENOTCONN; int e110 = ETIMEDOUT; int e111 = ECONNREFUSED; int e113 = EHOSTUNREACH; int e114 = EALREADY; int e115 = EINPROGRESS; int e116 = ESTALE; int e122 = EDQUOT; int e125 = ECANCELED; int e130 = EOWNERDEAD; int e131 = ENOTRECOVERABLE; /* Don't verify that these errno values are all different, except for possibly EWOULDBLOCK == EAGAIN. Even Linux/x86 does not pass this check: it has ENOTSUP == EOPNOTSUPP. */ int main () { /* Verify that errno can be assigned. */ errno = EOVERFLOW; /* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */ if (errno == EINVAL) return 1; return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-xalloc-die.sh������������������������������������������������0000775�0001750�0001750�00000002122�14670377437�022426� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test suite for xalloc_die. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . ${CHECKER} test-xalloc-die${EXEEXT} > out 2> err case $? in 1) ;; *) Exit 1;; esac tr -d '\015' < err \ | sed 's,.*test-xalloc-die[.ex]*:,test-xalloc-die:,' > err2 || Exit 1 compare - err2 <<\EOF || Exit 1 test-xalloc-die: memory exhausted EOF test -s out && Exit 1 Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-setlocale1.sh������������������������������������������������0000775�0001750�0001750�00000001562�14670377436�022447� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh : ${LOCALE_FR=fr_FR} : ${LOCALE_FR_UTF8=fr_FR.UTF-8} : ${LOCALE_JA=ja_JP} : ${LOCALE_ZH_CN=zh_CN.GB18030} if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none \ && test $LOCALE_JA = none && test $LOCALE_ZH_CN = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no locale for testing is installed" else echo "Skipping test: no locale for testing is supported" fi exit 77 fi if test $LOCALE_FR != none; then LC_ALL=$LOCALE_FR ${CHECKER} ./test-setlocale1${EXEEXT} || exit 1 fi if test $LOCALE_FR_UTF8 != none; then LC_ALL=$LOCALE_FR_UTF8 ${CHECKER} ./test-setlocale1${EXEEXT} || exit 1 fi if test $LOCALE_JA != none; then LC_ALL=$LOCALE_JA ${CHECKER} ./test-setlocale1${EXEEXT} || exit 1 fi if test $LOCALE_ZH_CN != none; then LC_ALL=$LOCALE_ZH_CN ${CHECKER} ./test-setlocale1${EXEEXT} || exit 1 fi exit 0 ����������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsrtowcs.c��������������������������������������������������0000664�0001750�0001750�00000023055�14670377436�022244� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of conversion of string to wide string. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include <wchar.h> #include "signature.h" SIGNATURE_CHECK (mbsrtowcs, size_t, (wchar_t *, char const **, size_t, mbstate_t *)); #include <locale.h> #include <stdio.h> #include <string.h> #include "macros.h" int main (int argc, char *argv[]) { mbstate_t state; wchar_t wc; size_t ret; /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; /* Test NUL byte input. */ { const char *src; memset (&state, '\0', sizeof (mbstate_t)); src = ""; ret = mbsrtowcs (NULL, &src, 0, &state); ASSERT (ret == 0); ASSERT (mbsinit (&state)); src = ""; ret = mbsrtowcs (NULL, &src, 1, &state); ASSERT (ret == 0); ASSERT (mbsinit (&state)); wc = (wchar_t) 0xBADFACE; src = ""; ret = mbsrtowcs (&wc, &src, 0, &state); ASSERT (ret == 0); ASSERT (wc == (wchar_t) 0xBADFACE); ASSERT (mbsinit (&state)); wc = (wchar_t) 0xBADFACE; src = ""; ret = mbsrtowcs (&wc, &src, 1, &state); ASSERT (ret == 0); ASSERT (wc == 0); ASSERT (mbsinit (&state)); } if (argc > 1) { int unlimited; for (unlimited = 0; unlimited < 2; unlimited++) { #define BUFSIZE 10 wchar_t buf[BUFSIZE]; const char *src; mbstate_t temp_state; { size_t i; for (i = 0; i < BUFSIZE; i++) buf[i] = (wchar_t) 0xBADFACE; } switch (argv[1][0]) { case '1': /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ { char input[] = "B\374\337er"; /* "Büßer" */ memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input, 1, &state); ASSERT (ret == 1); ASSERT (wc == 'B'); ASSERT (mbsinit (&state)); input[0] = '\0'; wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input + 1, 1, &state); ASSERT (ret == 1); ASSERT (wctob (wc) == (unsigned char) '\374'); ASSERT (mbsinit (&state)); input[1] = '\0'; src = input + 2; temp_state = state; ret = mbsrtowcs (NULL, &src, unlimited ? BUFSIZE : 1, &temp_state); ASSERT (ret == 3); ASSERT (src == input + 2); ASSERT (mbsinit (&state)); src = input + 2; ret = mbsrtowcs (buf, &src, unlimited ? BUFSIZE : 1, &state); ASSERT (ret == (unlimited ? 3 : 1)); ASSERT (src == (unlimited ? NULL : input + 3)); ASSERT (wctob (buf[0]) == (unsigned char) '\337'); if (unlimited) { ASSERT (buf[1] == 'e'); ASSERT (buf[2] == 'r'); ASSERT (buf[3] == 0); ASSERT (buf[4] == (wchar_t) 0xBADFACE); } else ASSERT (buf[1] == (wchar_t) 0xBADFACE); ASSERT (mbsinit (&state)); } break; case '2': /* Locale encoding is UTF-8. */ { char input[] = "B\303\274\303\237er"; /* "Büßer" */ memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input, 1, &state); ASSERT (ret == 1); ASSERT (wc == 'B'); ASSERT (mbsinit (&state)); input[0] = '\0'; wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input + 1, 1, &state); ASSERT (ret == (size_t)(-2)); ASSERT (wc == (wchar_t) 0xBADFACE); ASSERT (!mbsinit (&state)); input[1] = '\0'; src = input + 2; temp_state = state; ret = mbsrtowcs (NULL, &src, unlimited ? BUFSIZE : 2, &temp_state); ASSERT (ret == 4); ASSERT (src == input + 2); ASSERT (!mbsinit (&state)); src = input + 2; ret = mbsrtowcs (buf, &src, unlimited ? BUFSIZE : 2, &state); ASSERT (ret == (unlimited ? 4 : 2)); ASSERT (src == (unlimited ? NULL : input + 5)); ASSERT (wctob (buf[0]) == EOF); ASSERT (wctob (buf[1]) == EOF); if (unlimited) { ASSERT (buf[2] == 'e'); ASSERT (buf[3] == 'r'); ASSERT (buf[4] == 0); ASSERT (buf[5] == (wchar_t) 0xBADFACE); } else ASSERT (buf[2] == (wchar_t) 0xBADFACE); ASSERT (mbsinit (&state)); } break; case '3': /* Locale encoding is EUC-JP. */ { char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */ memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input, 1, &state); ASSERT (ret == 1); ASSERT (wc == '<'); ASSERT (mbsinit (&state)); input[0] = '\0'; wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input + 1, 2, &state); ASSERT (ret == 2); ASSERT (wctob (wc) == EOF); ASSERT (mbsinit (&state)); input[1] = '\0'; input[2] = '\0'; wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input + 3, 1, &state); ASSERT (ret == (size_t)(-2)); ASSERT (wc == (wchar_t) 0xBADFACE); ASSERT (!mbsinit (&state)); input[3] = '\0'; src = input + 4; temp_state = state; ret = mbsrtowcs (NULL, &src, unlimited ? BUFSIZE : 2, &temp_state); ASSERT (ret == 3); ASSERT (src == input + 4); ASSERT (!mbsinit (&state)); src = input + 4; ret = mbsrtowcs (buf, &src, unlimited ? BUFSIZE : 2, &state); ASSERT (ret == (unlimited ? 3 : 2)); ASSERT (src == (unlimited ? NULL : input + 7)); ASSERT (wctob (buf[0]) == EOF); ASSERT (wctob (buf[1]) == EOF); if (unlimited) { ASSERT (buf[2] == '>'); ASSERT (buf[3] == 0); ASSERT (buf[4] == (wchar_t) 0xBADFACE); } else ASSERT (buf[2] == (wchar_t) 0xBADFACE); ASSERT (mbsinit (&state)); } break; case '4': /* Locale encoding is GB18030. */ { char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input, 1, &state); ASSERT (ret == 1); ASSERT (wc == 'B'); ASSERT (mbsinit (&state)); input[0] = '\0'; wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input + 1, 1, &state); ASSERT (ret == (size_t)(-2)); ASSERT (wc == (wchar_t) 0xBADFACE); ASSERT (!mbsinit (&state)); input[1] = '\0'; src = input + 2; temp_state = state; ret = mbsrtowcs (NULL, &src, unlimited ? BUFSIZE : 2, &temp_state); ASSERT (ret == 4); ASSERT (src == input + 2); ASSERT (!mbsinit (&state)); src = input + 2; ret = mbsrtowcs (buf, &src, unlimited ? BUFSIZE : 2, &state); ASSERT (ret == (unlimited ? 4 : 2)); ASSERT (src == (unlimited ? NULL : input + 7)); ASSERT (wctob (buf[0]) == EOF); ASSERT (wctob (buf[1]) == EOF); if (unlimited) { ASSERT (buf[2] == 'e'); ASSERT (buf[3] == 'r'); ASSERT (buf[4] == 0); ASSERT (buf[5] == (wchar_t) 0xBADFACE); } else ASSERT (buf[2] == (wchar_t) 0xBADFACE); ASSERT (mbsinit (&state)); } break; default: return 1; } } return 0; } return 1; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/printf-parse.c����������������������������������������������������0000664�0001750�0001750�00000052473�14670377430�021656� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Formatted output to strings. Copyright (C) 1999-2000, 2002-2003, 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* This file can be parametrized with the following macros: CHAR_T The element type of the format string. CHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters in the format string are ASCII. DIRECTIVE Structure denoting a format directive. Depends on CHAR_T. DIRECTIVES Structure denoting the set of format directives of a format string. Depends on CHAR_T. PRINTF_PARSE Function that parses a format string. Depends on CHAR_T. STATIC Set to 'static' to declare the function static. ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. */ #ifndef PRINTF_PARSE # include <config.h> #endif /* Specification. */ #ifndef PRINTF_PARSE # include "printf-parse.h" #endif /* Default parameters. */ #ifndef PRINTF_PARSE # define PRINTF_PARSE printf_parse # define CHAR_T char # define DIRECTIVE char_directive # define DIRECTIVES char_directives #endif /* Get size_t, NULL. */ #include <stddef.h> /* Get intmax_t. */ #include <stdint.h> /* malloc(), realloc(), free(). */ #include <stdlib.h> /* memcpy(). */ #include <string.h> /* errno. */ #include <errno.h> /* Checked size_t computations. */ #include "xsize.h" #if CHAR_T_ONLY_ASCII /* c_isascii(). */ # include "c-ctype.h" #endif #ifdef STATIC STATIC #endif int PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) { const CHAR_T *cp = format; /* pointer into format */ size_t arg_posn = 0; /* number of regular arguments consumed */ size_t d_allocated; /* allocated elements of d->dir */ size_t a_allocated; /* allocated elements of a->arg */ size_t max_width_length = 0; size_t max_precision_length = 0; d->count = 0; d_allocated = N_DIRECT_ALLOC_DIRECTIVES; d->dir = d->direct_alloc_dir; a->count = 0; a_allocated = N_DIRECT_ALLOC_ARGUMENTS; a->arg = a->direct_alloc_arg; #define REGISTER_ARG(_index_,_type_) \ { \ size_t n = (_index_); \ if (n >= a_allocated) \ { \ size_t memory_size; \ argument *memory; \ \ a_allocated = xtimes (a_allocated, 2); \ if (a_allocated <= n) \ a_allocated = xsum (n, 1); \ memory_size = xtimes (a_allocated, sizeof (argument)); \ if (size_overflow_p (memory_size)) \ /* Overflow, would lead to out of memory. */ \ goto out_of_memory; \ memory = (argument *) (a->arg != a->direct_alloc_arg \ ? realloc (a->arg, memory_size) \ : malloc (memory_size)); \ if (memory == NULL) \ /* Out of memory. */ \ goto out_of_memory; \ if (a->arg == a->direct_alloc_arg) \ memcpy (memory, a->arg, a->count * sizeof (argument)); \ a->arg = memory; \ } \ while (a->count <= n) \ a->arg[a->count++].type = TYPE_NONE; \ if (a->arg[n].type == TYPE_NONE) \ a->arg[n].type = (_type_); \ else if (a->arg[n].type != (_type_)) \ /* Ambiguous type for positional argument. */ \ goto error; \ } while (*cp != '\0') { CHAR_T c = *cp++; if (c == '%') { size_t arg_index = ARG_NONE; DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */ /* Initialize the next directive. */ dp->dir_start = cp - 1; dp->flags = 0; dp->width_start = NULL; dp->width_end = NULL; dp->width_arg_index = ARG_NONE; dp->precision_start = NULL; dp->precision_end = NULL; dp->precision_arg_index = ARG_NONE; dp->arg_index = ARG_NONE; /* Test for positional argument. */ if (*cp >= '0' && *cp <= '9') { const CHAR_T *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum (xtimes (n, 10), *np - '0'); if (n == 0) /* Positional argument 0. */ goto error; if (size_overflow_p (n)) /* n too large, would lead to out of memory later. */ goto error; arg_index = n - 1; cp = np + 1; } } /* Read the flags. */ for (;;) { if (*cp == '\'') { dp->flags |= FLAG_GROUP; cp++; } else if (*cp == '-') { dp->flags |= FLAG_LEFT; cp++; } else if (*cp == '+') { dp->flags |= FLAG_SHOWSIGN; cp++; } else if (*cp == ' ') { dp->flags |= FLAG_SPACE; cp++; } else if (*cp == '#') { dp->flags |= FLAG_ALT; cp++; } else if (*cp == '0') { dp->flags |= FLAG_ZERO; cp++; } #if __GLIBC__ >= 2 && !defined __UCLIBC__ else if (*cp == 'I') { dp->flags |= FLAG_LOCALIZED; cp++; } #endif else break; } /* Parse the field width. */ if (*cp == '*') { dp->width_start = cp; cp++; dp->width_end = cp; if (max_width_length < 1) max_width_length = 1; /* Test for positional argument. */ if (*cp >= '0' && *cp <= '9') { const CHAR_T *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum (xtimes (n, 10), *np - '0'); if (n == 0) /* Positional argument 0. */ goto error; if (size_overflow_p (n)) /* n too large, would lead to out of memory later. */ goto error; dp->width_arg_index = n - 1; cp = np + 1; } } if (dp->width_arg_index == ARG_NONE) { dp->width_arg_index = arg_posn++; if (dp->width_arg_index == ARG_NONE) /* arg_posn wrapped around. */ goto error; } REGISTER_ARG (dp->width_arg_index, TYPE_INT); } else if (*cp >= '0' && *cp <= '9') { size_t width_length; dp->width_start = cp; for (; *cp >= '0' && *cp <= '9'; cp++) ; dp->width_end = cp; width_length = dp->width_end - dp->width_start; if (max_width_length < width_length) max_width_length = width_length; } /* Parse the precision. */ if (*cp == '.') { cp++; if (*cp == '*') { dp->precision_start = cp - 1; cp++; dp->precision_end = cp; if (max_precision_length < 2) max_precision_length = 2; /* Test for positional argument. */ if (*cp >= '0' && *cp <= '9') { const CHAR_T *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum (xtimes (n, 10), *np - '0'); if (n == 0) /* Positional argument 0. */ goto error; if (size_overflow_p (n)) /* n too large, would lead to out of memory later. */ goto error; dp->precision_arg_index = n - 1; cp = np + 1; } } if (dp->precision_arg_index == ARG_NONE) { dp->precision_arg_index = arg_posn++; if (dp->precision_arg_index == ARG_NONE) /* arg_posn wrapped around. */ goto error; } REGISTER_ARG (dp->precision_arg_index, TYPE_INT); } else { size_t precision_length; dp->precision_start = cp - 1; for (; *cp >= '0' && *cp <= '9'; cp++) ; dp->precision_end = cp; precision_length = dp->precision_end - dp->precision_start; if (max_precision_length < precision_length) max_precision_length = precision_length; } } { arg_type type; /* Parse argument type/size specifiers. */ { int flags = 0; for (;;) { if (*cp == 'h') { flags |= (1 << (flags & 1)); cp++; } else if (*cp == 'L') { flags |= 4; cp++; } else if (*cp == 'l') { flags += 8; cp++; } else if (*cp == 'j') { if (sizeof (intmax_t) > sizeof (long)) { /* intmax_t = long long */ flags += 16; } else if (sizeof (intmax_t) > sizeof (int)) { /* intmax_t = long */ flags += 8; } cp++; } else if (*cp == 'z' || *cp == 'Z') { /* 'z' is standardized in ISO C 99, but glibc uses 'Z' because the warning facility in gcc-2.95.2 understands only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ if (sizeof (size_t) > sizeof (long)) { /* size_t = long long */ flags += 16; } else if (sizeof (size_t) > sizeof (int)) { /* size_t = long */ flags += 8; } cp++; } else if (*cp == 't') { if (sizeof (ptrdiff_t) > sizeof (long)) { /* ptrdiff_t = long long */ flags += 16; } else if (sizeof (ptrdiff_t) > sizeof (int)) { /* ptrdiff_t = long */ flags += 8; } cp++; } #if defined __APPLE__ && defined __MACH__ /* On Mac OS X 10.3, PRIdMAX is defined as "qd". We cannot change it to "lld" because PRIdMAX must also be understood by the system's printf routines. */ else if (*cp == 'q') { if (64 / 8 > sizeof (long)) { /* int64_t = long long */ flags += 16; } else { /* int64_t = long */ flags += 8; } cp++; } #endif #if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows, PRIdMAX is defined as "I64d". We cannot change it to "lld" because PRIdMAX must also be understood by the system's printf routines. */ else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4') { if (64 / 8 > sizeof (long)) { /* __int64 = long long */ flags += 16; } else { /* __int64 = long */ flags += 8; } cp += 3; } #endif else break; } /* Read the conversion character. */ c = *cp++; switch (c) { case 'd': case 'i': /* If 'long long' is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_LONGLONGINT; else /* If 'long long' is the same as 'long', we parse "lld" into TYPE_LONGINT. */ if (flags >= 8) type = TYPE_LONGINT; else if (flags & 2) type = TYPE_SCHAR; else if (flags & 1) type = TYPE_SHORT; else type = TYPE_INT; break; case 'o': case 'u': case 'x': case 'X': /* If 'unsigned long long' is larger than 'unsigned long': */ if (flags >= 16 || (flags & 4)) type = TYPE_ULONGLONGINT; else /* If 'unsigned long long' is the same as 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ if (flags >= 8) type = TYPE_ULONGINT; else if (flags & 2) type = TYPE_UCHAR; else if (flags & 1) type = TYPE_USHORT; else type = TYPE_UINT; break; case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': case 'a': case 'A': if (flags >= 16 || (flags & 4)) type = TYPE_LONGDOUBLE; else type = TYPE_DOUBLE; break; case 'c': if (flags >= 8) #if HAVE_WINT_T type = TYPE_WIDE_CHAR; #else goto error; #endif else type = TYPE_CHAR; break; #if HAVE_WINT_T case 'C': type = TYPE_WIDE_CHAR; c = 'c'; break; #endif case 's': if (flags >= 8) #if HAVE_WCHAR_T type = TYPE_WIDE_STRING; #else goto error; #endif else type = TYPE_STRING; break; #if HAVE_WCHAR_T case 'S': type = TYPE_WIDE_STRING; c = 's'; break; #endif case 'p': type = TYPE_POINTER; break; case 'n': /* If 'long long' is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_COUNT_LONGLONGINT_POINTER; else /* If 'long long' is the same as 'long', we parse "lln" into TYPE_COUNT_LONGINT_POINTER. */ if (flags >= 8) type = TYPE_COUNT_LONGINT_POINTER; else if (flags & 2) type = TYPE_COUNT_SCHAR_POINTER; else if (flags & 1) type = TYPE_COUNT_SHORT_POINTER; else type = TYPE_COUNT_INT_POINTER; break; #if ENABLE_UNISTDIO /* The unistdio extensions. */ case 'U': if (flags >= 16) type = TYPE_U32_STRING; else if (flags >= 8) type = TYPE_U16_STRING; else type = TYPE_U8_STRING; break; #endif case '%': type = TYPE_NONE; break; default: /* Unknown conversion character. */ goto error; } } if (type != TYPE_NONE) { dp->arg_index = arg_index; if (dp->arg_index == ARG_NONE) { dp->arg_index = arg_posn++; if (dp->arg_index == ARG_NONE) /* arg_posn wrapped around. */ goto error; } REGISTER_ARG (dp->arg_index, type); } dp->conversion = c; dp->dir_end = cp; } d->count++; if (d->count >= d_allocated) { size_t memory_size; DIRECTIVE *memory; d_allocated = xtimes (d_allocated, 2); memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); if (size_overflow_p (memory_size)) /* Overflow, would lead to out of memory. */ goto out_of_memory; memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir ? realloc (d->dir, memory_size) : malloc (memory_size)); if (memory == NULL) /* Out of memory. */ goto out_of_memory; if (d->dir == d->direct_alloc_dir) memcpy (memory, d->dir, d->count * sizeof (DIRECTIVE)); d->dir = memory; } } #if CHAR_T_ONLY_ASCII else if (!c_isascii (c)) { /* Non-ASCII character. Not supported. */ goto error; } #endif } d->dir[d->count].dir_start = cp; d->max_width_length = max_width_length; d->max_precision_length = max_precision_length; return 0; error: if (a->arg != a->direct_alloc_arg) free (a->arg); if (d->dir != d->direct_alloc_dir) free (d->dir); errno = EINVAL; return -1; out_of_memory: if (a->arg != a->direct_alloc_arg) free (a->arg); if (d->dir != d->direct_alloc_dir) free (d->dir); errno = ENOMEM; return -1; } #undef PRINTF_PARSE #undef DIRECTIVES #undef DIRECTIVE #undef CHAR_T_ONLY_ASCII #undef CHAR_T �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/localename-table.c������������������������������������������������0000664�0001750�0001750�00000002726�14670377436�022433� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Table that maps a locale object to the names of the locale categories. Copyright (C) 2018-2021 Free Software Foundation, Inc. This program 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2018. */ #include <config.h> #if HAVE_WORKING_USELOCALE && HAVE_NAMELESS_LOCALES /* Specification. */ #include "localename-table.h" #include <stdint.h> /* A hash function for pointers. */ size_t _GL_ATTRIBUTE_CONST locale_hash_function (locale_t x) { uintptr_t p = (uintptr_t) x; size_t h = ((p % 4177) << 12) + ((p % 79) << 6) + (p % 61); return h; } struct locale_hash_node * locale_hash_table[LOCALE_HASH_TABLE_SIZE] /* = { NULL, ..., NULL } */; gl_rwlock_define_initialized(, locale_lock) #else /* This declaration is solely to ensure that after preprocessing this file is never empty. */ typedef int dummy; #endif ������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-listen.c�����������������������������������������������������0000664�0001750�0001750�00000002342�14670377436�021513� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test listen() function. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <sys/socket.h> #include "signature.h" SIGNATURE_CHECK (listen, int, (int, int)); #include <errno.h> #include <unistd.h> #include "sockets.h" #include "macros.h" int main (void) { (void) gl_sockets_startup (SOCKETS_1_1); /* Test behaviour for invalid file descriptors. */ { errno = 0; ASSERT (listen (-1, 1) == -1); ASSERT (errno == EBADF); } { close (99); errno = 0; ASSERT (listen (99 ,1) == -1); ASSERT (errno == EBADF); } return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-dup2.c�������������������������������������������������������0000664�0001750�0001750�00000014025�14670377431�021063� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test duplicating file descriptors. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (dup2, int, (int, int)); #include <errno.h> #include <fcntl.h> #if HAVE_SYS_RESOURCE_H # include <sys/resource.h> #endif #include "binary-io.h" #if GNULIB_TEST_CLOEXEC # include "cloexec.h" #endif #if defined _WIN32 && ! defined __CYGWIN__ /* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include <io.h> # endif #endif #include "macros.h" /* Return non-zero if FD is open. */ static int is_open (int fd) { #if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows, the initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE, and there is no fcntl. */ return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; #else # ifndef F_GETFL # error Please port fcntl to your platform # endif return 0 <= fcntl (fd, F_GETFL); #endif } #if GNULIB_TEST_CLOEXEC /* Return non-zero if FD is open and inheritable across exec/spawn. */ static int is_inheritable (int fd) { # if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows, the initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE, and there is no fcntl. */ HANDLE h = (HANDLE) _get_osfhandle (fd); DWORD flags; if (h == INVALID_HANDLE_VALUE || GetHandleInformation (h, &flags) == 0) return 0; return (flags & HANDLE_FLAG_INHERIT) != 0; # else # ifndef F_GETFD # error Please port fcntl to your platform # endif int i = fcntl (fd, F_GETFD); return 0 <= i && (i & FD_CLOEXEC) == 0; # endif } #endif /* GNULIB_TEST_CLOEXEC */ #if !O_BINARY # define set_binary_mode(f,m) zero () static int zero (void) { return 0; } #endif /* Return non-zero if FD is open in the given MODE, which is either O_TEXT or O_BINARY. */ static int is_mode (int fd, int mode) { int value = set_binary_mode (fd, O_BINARY); set_binary_mode (fd, value); return mode == value; } int main (void) { const char *file = "test-dup2.tmp"; char buffer[1]; int bad_fd = getdtablesize (); int fd = open (file, O_CREAT | O_TRUNC | O_RDWR, 0600); /* Assume std descriptors were provided by invoker. */ ASSERT (STDERR_FILENO < fd); ASSERT (is_open (fd)); /* Ignore any other fd's leaked into this process. */ close (fd + 1); close (fd + 2); ASSERT (!is_open (fd + 1)); ASSERT (!is_open (fd + 2)); /* Assigning to self must be a no-op. */ ASSERT (dup2 (fd, fd) == fd); ASSERT (is_open (fd)); /* The source must be valid. */ errno = 0; ASSERT (dup2 (-1, fd) == -1); ASSERT (errno == EBADF); close (99); errno = 0; ASSERT (dup2 (99, fd) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (dup2 (AT_FDCWD, fd) == -1); ASSERT (errno == EBADF); ASSERT (is_open (fd)); /* If the source is not open, then the destination is unaffected. */ errno = 0; ASSERT (dup2 (fd + 1, fd + 1) == -1); ASSERT (errno == EBADF); ASSERT (!is_open (fd + 1)); errno = 0; ASSERT (dup2 (fd + 1, fd) == -1); ASSERT (errno == EBADF); ASSERT (is_open (fd)); /* The destination must be valid. */ errno = 0; ASSERT (dup2 (fd, -2) == -1); ASSERT (errno == EBADF); if (bad_fd > 256) { ASSERT (dup2 (fd, 255) == 255); ASSERT (dup2 (fd, 256) == 256); ASSERT (close (255) == 0); ASSERT (close (256) == 0); } ASSERT (dup2 (fd, bad_fd - 1) == bad_fd - 1); ASSERT (close (bad_fd - 1) == 0); errno = 0; ASSERT (dup2 (fd, bad_fd) == -1); ASSERT (errno == EBADF); /* Using dup2 can skip fds. */ ASSERT (dup2 (fd, fd + 2) == fd + 2); ASSERT (is_open (fd)); ASSERT (!is_open (fd + 1)); ASSERT (is_open (fd + 2)); /* Verify that dup2 closes the previous occupant of a fd. */ ASSERT (open ("/dev/null", O_WRONLY, 0600) == fd + 1); ASSERT (dup2 (fd + 1, fd) == fd); ASSERT (close (fd + 1) == 0); ASSERT (write (fd, "1", 1) == 1); ASSERT (dup2 (fd + 2, fd) == fd); ASSERT (lseek (fd, 0, SEEK_END) == 0); ASSERT (write (fd + 2, "2", 1) == 1); ASSERT (lseek (fd, 0, SEEK_SET) == 0); ASSERT (read (fd, buffer, 1) == 1); ASSERT (*buffer == '2'); #if GNULIB_TEST_CLOEXEC /* Any new fd created by dup2 must not be cloexec. */ ASSERT (close (fd + 2) == 0); ASSERT (dup_cloexec (fd) == fd + 1); ASSERT (!is_inheritable (fd + 1)); ASSERT (dup2 (fd + 1, fd + 1) == fd + 1); ASSERT (!is_inheritable (fd + 1)); ASSERT (dup2 (fd + 1, fd + 2) == fd + 2); ASSERT (!is_inheritable (fd + 1)); ASSERT (is_inheritable (fd + 2)); errno = 0; ASSERT (dup2 (fd + 1, -1) == -1); ASSERT (errno == EBADF); ASSERT (!is_inheritable (fd + 1)); #endif /* On systems that distinguish between text and binary mode, dup2 reuses the mode of the source. */ set_binary_mode (fd, O_BINARY); ASSERT (is_mode (fd, O_BINARY)); ASSERT (dup2 (fd, fd + 1) == fd + 1); ASSERT (is_mode (fd + 1, O_BINARY)); set_binary_mode (fd, O_TEXT); ASSERT (is_mode (fd, O_TEXT)); ASSERT (dup2 (fd, fd + 1) == fd + 1); ASSERT (is_mode (fd + 1, O_TEXT)); /* Clean up. */ ASSERT (close (fd + 2) == 0); ASSERT (close (fd + 1) == 0); ASSERT (close (fd) == 0); ASSERT (unlink (file) == 0); return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sys_socket.c�������������������������������������������������0000664�0001750�0001750�00000003301�14670377437�022400� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <sys/socket.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <sys/socket.h> #include <errno.h> #if HAVE_SHUTDOWN /* Check some integer constant expressions. */ int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; #endif /* Check that the 'socklen_t' type is defined. */ socklen_t t1; /* Check that the 'size_t' and 'ssize_t' types are defined. */ size_t t2; ssize_t t3; /* Check that 'struct iovec' is defined. */ struct iovec io; /* Check that a minimal set of 'struct msghdr' is defined. */ struct msghdr msg; int main (void) { struct sockaddr_storage x; sa_family_t i; /* Check some errno values. */ switch (ENOTSOCK) { case ENOTSOCK: case EADDRINUSE: case ENETRESET: case ECONNABORTED: case ECONNRESET: case ENOTCONN: case ESHUTDOWN: break; } x.ss_family = 42; i = 42; msg.msg_iov = &io; return (x.ss_family - i + msg.msg_namelen + msg.msg_iov->iov_len + msg.msg_iovlen); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/xstrtol-error.h���������������������������������������������������0000664�0001750�0001750�00000003246�14670377437�022120� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Error reporting interface for xstrto* functions. Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2021 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 <https://www.gnu.org/licenses/>. */ #ifndef XSTRTOL_ERROR_H_ # define XSTRTOL_ERROR_H_ 1 # include "xstrtol.h" # include <getopt.h> /* Report an error for an invalid integer in an option argument. ERR is the error code returned by one of the xstrto* functions. Use OPT_IDX to decide whether to print the short option string "C" or "-C" or a long option string derived from LONG_OPTION. OPT_IDX is -2 if the short option "C" was used, without any leading "-"; it is -1 if the short option "-C" was used; otherwise it is an index into LONG_OPTIONS, which should have a name preceded by two '-' characters. ARG is the option-argument containing the integer. After reporting an error, exit with a failure status. */ _Noreturn void xstrtol_fatal (enum strtol_error, int, char, struct option const *, char const *); #endif /* not XSTRTOL_ERROR_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sys_uio.in.h������������������������������������������������������0000664�0001750�0001750�00000003236�14670377431�021342� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Substitute for <sys/uio.h>. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ # if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ # endif @PRAGMA_COLUMNS@ #ifndef _@GUARD_PREFIX@_SYS_UIO_H #if @HAVE_SYS_UIO_H@ /* On OpenBSD 4.4, <sys/uio.h> assumes prior inclusion of <sys/types.h>. */ # include <sys/types.h> /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@ #endif #ifndef _@GUARD_PREFIX@_SYS_UIO_H #define _@GUARD_PREFIX@_SYS_UIO_H #if !@HAVE_SYS_UIO_H@ /* A platform that lacks <sys/uio.h>. */ /* Get 'size_t' and 'ssize_t'. */ # include <sys/types.h> # ifdef __cplusplus extern "C" { # endif # if !GNULIB_defined_struct_iovec /* All known platforms that lack <sys/uio.h> also lack any declaration of struct iovec in any other header. */ struct iovec { void *iov_base; size_t iov_len; }; # define GNULIB_defined_struct_iovec 1 # endif # ifdef __cplusplus } # endif #endif #endif /* _@GUARD_PREFIX@_SYS_UIO_H */ #endif /* _@GUARD_PREFIX@_SYS_UIO_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-ctype.c������������������������������������������������������0000664�0001750�0001750�00000001541�14670377431�021334� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <ctype.h> substitute. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <ctype.h> int main (void) { return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-thread_self.c������������������������������������������������0000664�0001750�0001750�00000002446�14670377436�022502� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of gl_thread_self () macro. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2011. */ #include <config.h> #include "glthread/thread.h" gl_thread_t main_thread; int main () { /* Check that gl_thread_self () can be used with just $(LIBTHREAD), not $(LIBMULTITHREAD), i.e. in libraries that are multithread-safe but don't create threads themselves. */ /* This is not the case on AIX with --enable-threads=isoc+posix, because in this case, $(LIBTHREAD) is empty whereas $(LIBMULTITHREAD) is '-lpthread'. */ #if !defined _AIX main_thread = gl_thread_self (); #endif return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/vasnprintf.c������������������������������������������������������0000664�0001750�0001750�00000712673�14670377440�021444� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* vsprintf with automatic memory allocation. Copyright (C) 1999, 2002-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* This file can be parametrized with the following macros: VASNPRINTF The name of the function being defined. FCHAR_T The element type of the format string. DCHAR_T The element type of the destination (result) string. FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters in the format string are ASCII. MUST be set if FCHAR_T and DCHAR_T are not the same type. DIRECTIVE Structure denoting a format directive. Depends on FCHAR_T. DIRECTIVES Structure denoting the set of format directives of a format string. Depends on FCHAR_T. PRINTF_PARSE Function that parses a format string. Depends on FCHAR_T. DCHAR_CPY memcpy like function for DCHAR_T[] arrays. DCHAR_SET memset like function for DCHAR_T[] arrays. DCHAR_MBSNLEN mbsnlen like function for DCHAR_T[] arrays. SNPRINTF The system's snprintf (or similar) function. This may be either snprintf or swprintf. TCHAR_T The element type of the argument and result string of the said SNPRINTF function. This may be either char or wchar_t. The code exploits that sizeof (TCHAR_T) | sizeof (DCHAR_T) and alignof (TCHAR_T) <= alignof (DCHAR_T). DCHAR_IS_TCHAR Set to 1 if DCHAR_T and TCHAR_T are the same type. DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[]. DCHAR_IS_UINT8_T Set to 1 if DCHAR_T is uint8_t. DCHAR_IS_UINT16_T Set to 1 if DCHAR_T is uint16_t. DCHAR_IS_UINT32_T Set to 1 if DCHAR_T is uint32_t. ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. ENABLE_WCHAR_FALLBACK Set to 1 to avoid EILSEQ during conversion of wide characters (wchar_t) and wide character strings (wchar_t[]) to multibyte sequences. The fallback is the hexadecimal escape syntax (\unnnn or \Unnnnnnnn) or, if wchar_t is not Unicode encoded, \wnnnn or \Wnnnnnnnn. */ /* Tell glibc's <stdio.h> to provide a prototype for snprintf(). This must come before <config.h> because <config.h> may include <features.h>, and once <features.h> has been included, it's too late. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #ifndef VASNPRINTF # include <config.h> #endif /* As of GCC 11.2.1, gcc -Wanalyzer-too-complex reports that main's use of CHECK macros expands to code that is too complicated for gcc -fanalyzer. Suppress the resulting bogus warnings. */ #if 10 <= __GNUC__ # pragma GCC diagnostic ignored "-Wanalyzer-null-argument" #endif #include <alloca.h> /* Specification. */ #ifndef VASNPRINTF # if WIDE_CHAR_VERSION # include "vasnwprintf.h" # else # include "vasnprintf.h" # endif #endif #include <locale.h> /* localeconv() */ #include <stdio.h> /* snprintf(), sprintf() */ #include <stdlib.h> /* abort(), malloc(), realloc(), free() */ #include <string.h> /* memcpy(), strlen() */ #include <errno.h> /* errno */ #include <limits.h> /* CHAR_BIT */ #include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */ #if HAVE_NL_LANGINFO # include <langinfo.h> #endif #ifndef VASNPRINTF # if WIDE_CHAR_VERSION # include "wprintf-parse.h" # else # include "printf-parse.h" # endif #endif /* Checked size_t computations. */ #include "xsize.h" #include "attribute.h" #include "verify.h" #if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL # include <math.h> # include "float+.h" #endif #if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL # include <math.h> # include "isnand-nolibm.h" #endif #if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL # include <math.h> # include "isnanl-nolibm.h" # include "fpucw.h" #endif #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL # include <math.h> # include "isnand-nolibm.h" # include "printf-frexp.h" #endif #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL # include <math.h> # include "isnanl-nolibm.h" # include "printf-frexpl.h" # include "fpucw.h" #endif /* Default parameters. */ #ifndef VASNPRINTF # if WIDE_CHAR_VERSION # define VASNPRINTF vasnwprintf # define FCHAR_T wchar_t # define DCHAR_T wchar_t # define TCHAR_T wchar_t # define DCHAR_IS_TCHAR 1 # define DIRECTIVE wchar_t_directive # define DIRECTIVES wchar_t_directives # define PRINTF_PARSE wprintf_parse # define DCHAR_CPY wmemcpy # define DCHAR_SET wmemset # else # define VASNPRINTF vasnprintf # define FCHAR_T char # define DCHAR_T char # define TCHAR_T char # define DCHAR_IS_TCHAR 1 # define DIRECTIVE char_directive # define DIRECTIVES char_directives # define PRINTF_PARSE printf_parse # define DCHAR_CPY memcpy # define DCHAR_SET memset # endif #endif #if WIDE_CHAR_VERSION /* TCHAR_T is wchar_t. */ # define USE_SNPRINTF 1 # if HAVE_DECL__SNWPRINTF /* On Windows, the function swprintf() has a different signature than on Unix; we use the function _snwprintf() or - on mingw - snwprintf() instead. The mingw function snwprintf() has fewer bugs than the MSVCRT function _snwprintf(), so prefer that. */ # if defined __MINGW32__ # define SNPRINTF snwprintf # else # define SNPRINTF _snwprintf # define USE_MSVC__SNPRINTF 1 # endif # else /* Unix. */ # define SNPRINTF swprintf # endif #else /* TCHAR_T is char. */ /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'. But don't use it on BeOS, since BeOS snprintf produces no output if the size argument is >= 0x3000000. Also don't use it on Linux libc5, since there snprintf with size = 1 writes any output without bounds, like sprintf. */ # if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ && !(__GNU_LIBRARY__ == 1) # define USE_SNPRINTF 1 # else # define USE_SNPRINTF 0 # endif # if HAVE_DECL__SNPRINTF /* Windows. The mingw function snprintf() has fewer bugs than the MSVCRT function _snprintf(), so prefer that. */ # if defined __MINGW32__ # define SNPRINTF snprintf /* Here we need to call the native snprintf, not rpl_snprintf. */ # undef snprintf # else /* MSVC versions < 14 did not have snprintf, only _snprintf. */ # define SNPRINTF _snprintf # define USE_MSVC__SNPRINTF 1 # endif # else /* Unix. */ # define SNPRINTF snprintf /* Here we need to call the native snprintf, not rpl_snprintf. */ # undef snprintf # endif #endif /* Here we need to call the native sprintf, not rpl_sprintf. */ #undef sprintf /* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized" warnings in this file. Use -Dlint to suppress them. */ #if defined GCC_LINT || defined lint # define IF_LINT(Code) Code #else # define IF_LINT(Code) /* empty */ #endif /* Avoid some warnings from "gcc -Wshadow". This file doesn't use the exp() and remainder() functions. */ #undef exp #define exp expo #undef remainder #define remainder rem #if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && !WIDE_CHAR_VERSION # if (HAVE_STRNLEN && !defined _AIX) # define local_strnlen strnlen # else # ifndef local_strnlen_defined # define local_strnlen_defined 1 static size_t local_strnlen (const char *string, size_t maxlen) { const char *end = memchr (string, '\0', maxlen); return end ? (size_t) (end - string) : maxlen; } # endif # endif #endif #if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T # if HAVE_WCSLEN # define local_wcslen wcslen # else /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid a dependency towards this library, here is a local substitute. Define this substitute only once, even if this file is included twice in the same compilation unit. */ # ifndef local_wcslen_defined # define local_wcslen_defined 1 static size_t local_wcslen (const wchar_t *s) { const wchar_t *ptr; for (ptr = s; *ptr != (wchar_t) 0; ptr++) ; return ptr - s; } # endif # endif #endif #if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && HAVE_WCHAR_T && WIDE_CHAR_VERSION # if HAVE_WCSNLEN # define local_wcsnlen wcsnlen # else # ifndef local_wcsnlen_defined # define local_wcsnlen_defined 1 static size_t local_wcsnlen (const wchar_t *s, size_t maxlen) { const wchar_t *ptr; for (ptr = s; maxlen > 0 && *ptr != (wchar_t) 0; ptr++, maxlen--) ; return ptr - s; } # endif # endif #endif #if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL) || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || (ENABLE_WCHAR_FALLBACK && HAVE_WINT_T)) && !WIDE_CHAR_VERSION # if ENABLE_WCHAR_FALLBACK static size_t wctomb_fallback (char *s, wchar_t wc) { static char hex[16] = "0123456789ABCDEF"; s[0] = '\\'; if (sizeof (wchar_t) > 2 && wc > 0xffff) { # if __STDC_ISO_10646__ || (__GLIBC__ >= 2) || (defined _WIN32 || defined __CYGWIN__) s[1] = 'U'; # else s[1] = 'W'; # endif s[2] = hex[(wc & 0xf0000000U) >> 28]; s[3] = hex[(wc & 0xf000000U) >> 24]; s[4] = hex[(wc & 0xf00000U) >> 20]; s[5] = hex[(wc & 0xf0000U) >> 16]; s[6] = hex[(wc & 0xf000U) >> 12]; s[7] = hex[(wc & 0xf00U) >> 8]; s[8] = hex[(wc & 0xf0U) >> 4]; s[9] = hex[wc & 0xfU]; return 10; } else { # if __STDC_ISO_10646__ || (__GLIBC__ >= 2) || (defined _WIN32 || defined __CYGWIN__) s[1] = 'u'; # else s[1] = 'w'; # endif s[2] = hex[(wc & 0xf000U) >> 12]; s[3] = hex[(wc & 0xf00U) >> 8]; s[4] = hex[(wc & 0xf0U) >> 4]; s[5] = hex[wc & 0xfU]; return 6; } } # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t static size_t local_wcrtomb (char *s, wchar_t wc, mbstate_t *ps) { size_t count = wcrtomb (s, wc, ps); if (count == (size_t)(-1)) count = wctomb_fallback (s, wc); return count; } # else static int local_wctomb (char *s, wchar_t wc) { int count = wctomb (s, wc); if (count < 0) count = wctomb_fallback (s, wc); return count; } # define local_wcrtomb(S, WC, PS) local_wctomb ((S), (WC)) # endif # else # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t # define local_wcrtomb(S, WC, PS) wcrtomb ((S), (WC), (PS)) # else # define local_wcrtomb(S, WC, PS) wctomb ((S), (WC)) # endif # endif #endif #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL /* Determine the decimal-point character according to the current locale. */ # ifndef decimal_point_char_defined # define decimal_point_char_defined 1 static char decimal_point_char (void) { const char *point; /* Determine it in a multithread-safe way. We know nl_langinfo is multithread-safe on glibc systems and Mac OS X systems, but is not required to be multithread-safe by POSIX. sprintf(), however, is multithread-safe. localeconv() is rarely multithread-safe. */ # if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__)) point = nl_langinfo (RADIXCHAR); # elif 1 char pointbuf[5]; sprintf (pointbuf, "%#.0f", 1.0); point = &pointbuf[1]; # else point = localeconv () -> decimal_point; # endif /* The decimal point is always a single byte: either '.' or ','. */ return (point[0] != '\0' ? point[0] : '.'); } # endif #endif #if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL /* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ static int is_infinite_or_zero (double x) { return isnand (x) || x + x == x; } #endif #if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL /* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ static int is_infinite_or_zerol (long double x) { return isnanl (x) || x + x == x; } #endif #if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL /* Converting 'long double' to decimal without rare rounding bugs requires real bignums. We use the naming conventions of GNU gmp, but vastly simpler (and slower) algorithms. */ typedef unsigned int mp_limb_t; # define GMP_LIMB_BITS 32 verify (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS); typedef unsigned long long mp_twolimb_t; # define GMP_TWOLIMB_BITS 64 verify (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS); /* Representation of a bignum >= 0. */ typedef struct { size_t nlimbs; mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc(). */ } mpn_t; /* Compute the product of two bignums >= 0. Return the allocated memory in case of success, NULL in case of memory allocation failure. */ static void * multiply (mpn_t src1, mpn_t src2, mpn_t *dest) { const mp_limb_t *p1; const mp_limb_t *p2; size_t len1; size_t len2; if (src1.nlimbs <= src2.nlimbs) { len1 = src1.nlimbs; p1 = src1.limbs; len2 = src2.nlimbs; p2 = src2.limbs; } else { len1 = src2.nlimbs; p1 = src2.limbs; len2 = src1.nlimbs; p2 = src1.limbs; } /* Now 0 <= len1 <= len2. */ if (len1 == 0) { /* src1 or src2 is zero. */ dest->nlimbs = 0; dest->limbs = (mp_limb_t *) malloc (1); } else { /* Here 1 <= len1 <= len2. */ size_t dlen; mp_limb_t *dp; size_t k, i, j; dlen = len1 + len2; dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t)); if (dp == NULL) return NULL; for (k = len2; k > 0; ) dp[--k] = 0; for (i = 0; i < len1; i++) { mp_limb_t digit1 = p1[i]; mp_twolimb_t carry = 0; for (j = 0; j < len2; j++) { mp_limb_t digit2 = p2[j]; carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; carry += dp[i + j]; dp[i + j] = (mp_limb_t) carry; carry = carry >> GMP_LIMB_BITS; } dp[i + len2] = (mp_limb_t) carry; } /* Normalise. */ while (dlen > 0 && dp[dlen - 1] == 0) dlen--; dest->nlimbs = dlen; dest->limbs = dp; } return dest->limbs; } /* Compute the quotient of a bignum a >= 0 and a bignum b > 0. a is written as a = q * b + r with 0 <= r < b. q is the quotient, r the remainder. Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd, q is incremented. Return the allocated memory in case of success, NULL in case of memory allocation failure. */ static void * divide (mpn_t a, mpn_t b, mpn_t *q) { /* Algorithm: First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]] with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS). If m<n, then q:=0 and r:=a. If m>=n=1, perform a single-precision division: r:=0, j:=m, while j>0 do {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j = = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r<b[0]<beta} j:=j-1, r:=r*beta+a[j], q[j]:=floor(r/b[0]), r:=r-b[0]*q[j]. Normalise [q[m-1],...,q[0]], yields q. If m>=n>1, perform a multiple-precision division: We have a/b < beta^(m-n+1). s:=intDsize-1-(highest bit in b[n-1]), 0<=s<intDsize. Shift a and b left by s bits, copying them. r:=a. r=[r[m],...,r[0]], b=[b[n-1],...,b[0]] with b[n-1]>=beta/2. For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).} Compute q* : q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]). In case of overflow (q* >= beta) set q* := beta-1. Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2] and c3 := b[n-2] * q*. {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow occurred. Furthermore 0 <= c3 < beta^2. If there was overflow and r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2, the next test can be skipped.} While c3 > c2, {Here 0 <= c2 < c3 < beta^2} Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2]. If q* > 0: Put r := r - b * q* * beta^j. In detail: [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]]. hence: u:=0, for i:=0 to n-1 do u := u + q* * b[i], r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry), u:=u div beta (+ 1, if carry in subtraction) r[n+j]:=r[n+j]-u. {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1 < q* + 1 <= beta, the carry u does not overflow.} If a negative carry occurs, put q* := q* - 1 and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]]. Set q[j] := q*. Normalise [q[m-n],..,q[0]]; this yields the quotient q. Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the rest r. The room for q[j] can be allocated at the memory location of r[n+j]. Finally, round-to-even: Shift r left by 1 bit. If r > b or if r = b and q[0] is odd, q := q+1. */ const mp_limb_t *a_ptr = a.limbs; size_t a_len = a.nlimbs; const mp_limb_t *b_ptr = b.limbs; size_t b_len = b.nlimbs; mp_limb_t *roomptr; mp_limb_t *tmp_roomptr = NULL; mp_limb_t *q_ptr; size_t q_len; mp_limb_t *r_ptr; size_t r_len; /* Allocate room for a_len+2 digits. (Need a_len+1 digits for the real division and 1 more digit for the final rounding of q.) */ roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t)); if (roomptr == NULL) return NULL; /* Normalise a. */ while (a_len > 0 && a_ptr[a_len - 1] == 0) a_len--; /* Normalise b. */ for (;;) { if (b_len == 0) /* Division by zero. */ abort (); if (b_ptr[b_len - 1] == 0) b_len--; else break; } /* Here m = a_len >= 0 and n = b_len > 0. */ if (a_len < b_len) { /* m<n: trivial case. q=0, r := copy of a. */ r_ptr = roomptr; r_len = a_len; memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t)); q_ptr = roomptr + a_len; q_len = 0; } else if (b_len == 1) { /* n=1: single precision division. beta^(m-1) <= a < beta^m ==> beta^(m-2) <= a/b < beta^m */ r_ptr = roomptr; q_ptr = roomptr + 1; { mp_limb_t den = b_ptr[0]; mp_limb_t remainder = 0; const mp_limb_t *sourceptr = a_ptr + a_len; mp_limb_t *destptr = q_ptr + a_len; size_t count; for (count = a_len; count > 0; count--) { mp_twolimb_t num = ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr; *--destptr = num / den; remainder = num % den; } /* Normalise and store r. */ if (remainder > 0) { r_ptr[0] = remainder; r_len = 1; } else r_len = 0; /* Normalise q. */ q_len = a_len; if (q_ptr[q_len - 1] == 0) q_len--; } } else { /* n>1: multiple precision division. beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n ==> beta^(m-n-1) <= a/b < beta^(m-n+1). */ /* Determine s. */ size_t s; { mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */ /* Determine s = GMP_LIMB_BITS - integer_length (msd). Code copied from gnulib's integer_length.c. */ # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) \ || (__clang_major__ >= 4) s = __builtin_clz (msd); # else # if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT if (GMP_LIMB_BITS <= DBL_MANT_BIT) { /* Use 'double' operations. Assumes an IEEE 754 'double' implementation. */ # define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7) # define DBL_EXP_BIAS (DBL_EXP_MASK / 2 - 1) # define NWORDS \ ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) union { double value; unsigned int word[NWORDS]; } m; /* Use a single integer to floating-point conversion. */ m.value = msd; s = GMP_LIMB_BITS - (((m.word[DBL_EXPBIT0_WORD] >> DBL_EXPBIT0_BIT) & DBL_EXP_MASK) - DBL_EXP_BIAS); } else # undef NWORDS # endif { s = 31; if (msd >= 0x10000) { msd = msd >> 16; s -= 16; } if (msd >= 0x100) { msd = msd >> 8; s -= 8; } if (msd >= 0x10) { msd = msd >> 4; s -= 4; } if (msd >= 0x4) { msd = msd >> 2; s -= 2; } if (msd >= 0x2) { msd = msd >> 1; s -= 1; } } # endif } /* 0 <= s < GMP_LIMB_BITS. Copy b, shifting it left by s bits. */ if (s > 0) { tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t)); if (tmp_roomptr == NULL) { free (roomptr); return NULL; } { const mp_limb_t *sourceptr = b_ptr; mp_limb_t *destptr = tmp_roomptr; mp_twolimb_t accu = 0; size_t count; for (count = b_len; count > 0; count--) { accu += (mp_twolimb_t) *sourceptr++ << s; *destptr++ = (mp_limb_t) accu; accu = accu >> GMP_LIMB_BITS; } /* accu must be zero, since that was how s was determined. */ if (accu != 0) abort (); } b_ptr = tmp_roomptr; } /* Copy a, shifting it left by s bits, yields r. Memory layout: At the beginning: r = roomptr[0..a_len], at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len] */ r_ptr = roomptr; if (s == 0) { memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t)); r_ptr[a_len] = 0; } else { const mp_limb_t *sourceptr = a_ptr; mp_limb_t *destptr = r_ptr; mp_twolimb_t accu = 0; size_t count; for (count = a_len; count > 0; count--) { accu += (mp_twolimb_t) *sourceptr++ << s; *destptr++ = (mp_limb_t) accu; accu = accu >> GMP_LIMB_BITS; } *destptr++ = (mp_limb_t) accu; } q_ptr = roomptr + b_len; q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */ { size_t j = a_len - b_len; /* m-n */ mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */ mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */ mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */ ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd; /* Division loop, traversed m-n+1 times. j counts down, b is unchanged, beta/2 <= b[n-1] < beta. */ for (;;) { mp_limb_t q_star; mp_limb_t c1; if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */ { /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow. */ mp_twolimb_t num = ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS) | r_ptr[j + b_len - 1]; q_star = num / b_msd; c1 = num % b_msd; } else { /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1]. */ q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */ /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) {<= beta !}. If yes, jump directly to the subtraction loop. (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */ if (r_ptr[j + b_len] > b_msd || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd) /* r[j+n] >= b[n-1]+1 or r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a carry. */ goto subtract; } /* q_star = q*, c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta). */ { mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */ ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2]; mp_twolimb_t c3 = /* b[n-2] * q* */ (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star; /* While c2 < c3, increase c2 and decrease c3. Consider c3-c2. While it is > 0, decrease it by b[n-1]*beta+b[n-2]. Because of b[n-1]*beta+b[n-2] >= beta^2/2 this can happen only twice. */ if (c3 > c2) { q_star = q_star - 1; /* q* := q* - 1 */ if (c3 - c2 > b_msdd) q_star = q_star - 1; /* q* := q* - 1 */ } } if (q_star > 0) subtract: { /* Subtract r := r - b * q* * beta^j. */ mp_limb_t cr; { const mp_limb_t *sourceptr = b_ptr; mp_limb_t *destptr = r_ptr + j; mp_twolimb_t carry = 0; size_t count; for (count = b_len; count > 0; count--) { /* Here 0 <= carry <= q*. */ carry = carry + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++ + (mp_limb_t) ~(*destptr); /* Here 0 <= carry <= beta*q* + beta-1. */ *destptr++ = ~(mp_limb_t) carry; carry = carry >> GMP_LIMB_BITS; /* <= q* */ } cr = (mp_limb_t) carry; } /* Subtract cr from r_ptr[j + b_len], then forget about r_ptr[j + b_len]. */ if (cr > r_ptr[j + b_len]) { /* Subtraction gave a carry. */ q_star = q_star - 1; /* q* := q* - 1 */ /* Add b back. */ { const mp_limb_t *sourceptr = b_ptr; mp_limb_t *destptr = r_ptr + j; mp_limb_t carry = 0; size_t count; for (count = b_len; count > 0; count--) { mp_limb_t source1 = *sourceptr++; mp_limb_t source2 = *destptr; *destptr++ = source1 + source2 + carry; carry = (carry ? source1 >= (mp_limb_t) ~source2 : source1 > (mp_limb_t) ~source2); } } /* Forget about the carry and about r[j+n]. */ } } /* q* is determined. Store it as q[j]. */ q_ptr[j] = q_star; if (j == 0) break; j--; } } r_len = b_len; /* Normalise q. */ if (q_ptr[q_len - 1] == 0) q_len--; # if 0 /* Not needed here, since we need r only to compare it with b/2, and b is shifted left by s bits. */ /* Shift r right by s bits. */ if (s > 0) { mp_limb_t ptr = r_ptr + r_len; mp_twolimb_t accu = 0; size_t count; for (count = r_len; count > 0; count--) { accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS; accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s); *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS); } } # endif /* Normalise r. */ while (r_len > 0 && r_ptr[r_len - 1] == 0) r_len--; } /* Compare r << 1 with b. */ if (r_len > b_len) goto increment_q; { size_t i; for (i = b_len;;) { mp_limb_t r_i = (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0) | (i < r_len ? r_ptr[i] << 1 : 0); mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0); if (r_i > b_i) goto increment_q; if (r_i < b_i) goto keep_q; if (i == 0) break; i--; } } if (q_len > 0 && ((q_ptr[0] & 1) != 0)) /* q is odd. */ increment_q: { size_t i; for (i = 0; i < q_len; i++) if (++(q_ptr[i]) != 0) goto keep_q; q_ptr[q_len++] = 1; } keep_q: if (tmp_roomptr != NULL) free (tmp_roomptr); q->limbs = q_ptr; q->nlimbs = q_len; return roomptr; } /* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal representation. Destroys the contents of a. Return the allocated memory - containing the decimal digits in low-to-high order, terminated with a NUL character - in case of success, NULL in case of memory allocation failure. */ static char * convert_to_decimal (mpn_t a, size_t extra_zeroes) { mp_limb_t *a_ptr = a.limbs; size_t a_len = a.nlimbs; /* 0.03345 is slightly larger than log(2)/(9*log(10)). */ size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1); /* We need extra_zeroes bytes for zeroes, followed by c_len bytes for the digits of a, followed by 1 byte for the terminating NUL. */ char *c_ptr = (char *) malloc (xsum (xsum (extra_zeroes, c_len), 1)); if (c_ptr != NULL) { char *d_ptr = c_ptr; for (; extra_zeroes > 0; extra_zeroes--) *d_ptr++ = '0'; while (a_len > 0) { /* Divide a by 10^9, in-place. */ mp_limb_t remainder = 0; mp_limb_t *ptr = a_ptr + a_len; size_t count; for (count = a_len; count > 0; count--) { mp_twolimb_t num = ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr; *ptr = num / 1000000000; remainder = num % 1000000000; } /* Store the remainder as 9 decimal digits. */ for (count = 9; count > 0; count--) { *d_ptr++ = '0' + (remainder % 10); remainder = remainder / 10; } /* Normalize a. */ if (a_ptr[a_len - 1] == 0) a_len--; } /* Remove leading zeroes. */ while (d_ptr > c_ptr && d_ptr[-1] == '0') d_ptr--; /* But keep at least one zero. */ if (d_ptr == c_ptr) *d_ptr++ = '0'; /* Terminate the string. */ *d_ptr = '\0'; } return c_ptr; } # if NEED_PRINTF_LONG_DOUBLE /* Assuming x is finite and >= 0: write x as x = 2^e * m, where m is a bignum. Return the allocated memory in case of success, NULL in case of memory allocation failure. */ static void * decode_long_double (long double x, int *ep, mpn_t *mp) { mpn_t m; int exp; long double y; size_t i; /* Allocate memory for result. */ m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); if (m.limbs == NULL) return NULL; /* Split into exponential part and mantissa. */ y = frexpl (x, &exp); if (!(y >= 0.0L && y < 1.0L)) abort (); /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the latter is an integer. */ /* Convert the mantissa (y * 2^LDBL_MANT_BIT) to a sequence of limbs. I'm not sure whether it's safe to cast a 'long double' value between 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int', doesn't matter). */ # if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0 # if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 { mp_limb_t hi, lo; y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2)); hi = (int) y; y -= hi; if (!(y >= 0.0L && y < 1.0L)) abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0L && y < 1.0L)) abort (); m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; } # else { mp_limb_t d; y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS); d = (int) y; y -= d; if (!(y >= 0.0L && y < 1.0L)) abort (); m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d; } # endif # endif for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) { mp_limb_t hi, lo; y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); hi = (int) y; y -= hi; if (!(y >= 0.0L && y < 1.0L)) abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0L && y < 1.0L)) abort (); m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; } # if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess precision. */ if (!(y == 0.0L)) abort (); # endif /* Normalise. */ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) m.nlimbs--; *mp = m; *ep = exp - LDBL_MANT_BIT; return m.limbs; } # endif # if NEED_PRINTF_DOUBLE /* Assuming x is finite and >= 0: write x as x = 2^e * m, where m is a bignum. Return the allocated memory in case of success, NULL in case of memory allocation failure. */ static void * decode_double (double x, int *ep, mpn_t *mp) { mpn_t m; int exp; double y; size_t i; /* Allocate memory for result. */ m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); if (m.limbs == NULL) return NULL; /* Split into exponential part and mantissa. */ y = frexp (x, &exp); if (!(y >= 0.0 && y < 1.0)) abort (); /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * 2^DBL_MANT_BIT), and the latter is an integer. */ /* Convert the mantissa (y * 2^DBL_MANT_BIT) to a sequence of limbs. I'm not sure whether it's safe to cast a 'double' value between 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only 'double' values between 0 and 2^16 (to 'unsigned int' or 'int', doesn't matter). */ # if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0 # if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 { mp_limb_t hi, lo; y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2)); hi = (int) y; y -= hi; if (!(y >= 0.0 && y < 1.0)) abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0 && y < 1.0)) abort (); m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; } # else { mp_limb_t d; y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS); d = (int) y; y -= d; if (!(y >= 0.0 && y < 1.0)) abort (); m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d; } # endif # endif for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) { mp_limb_t hi, lo; y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); hi = (int) y; y -= hi; if (!(y >= 0.0 && y < 1.0)) abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0 && y < 1.0)) abort (); m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; } if (!(y == 0.0)) abort (); /* Normalise. */ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) m.nlimbs--; *mp = m; *ep = exp - DBL_MANT_BIT; return m.limbs; } # endif /* Assuming x = 2^e * m is finite and >= 0, and n is an integer: Returns the decimal representation of round (x * 10^n). Return the allocated memory - containing the decimal digits in low-to-high order, terminated with a NUL character - in case of success, NULL in case of memory allocation failure. */ static char * scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) { int s; size_t extra_zeroes; unsigned int abs_n; unsigned int abs_s; mp_limb_t *pow5_ptr; size_t pow5_len; unsigned int s_limbs; unsigned int s_bits; mpn_t pow5; mpn_t z; void *z_memory; char *digits; if (memory == NULL) return NULL; /* x = 2^e * m, hence y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m) = round (2^s * 5^n * m). */ s = e + n; extra_zeroes = 0; /* Factor out a common power of 10 if possible. */ if (s > 0 && n > 0) { extra_zeroes = (s < n ? s : n); s -= extra_zeroes; n -= extra_zeroes; } /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes. Before converting to decimal, we need to compute z = round (2^s * 5^n * m). */ /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same sign. 2.322 is slightly larger than log(5)/log(2). */ abs_n = (n >= 0 ? n : -n); abs_s = (s >= 0 ? s : -s); pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1 + abs_s / GMP_LIMB_BITS + 1) * sizeof (mp_limb_t)); if (pow5_ptr == NULL) { free (memory); return NULL; } /* Initialize with 1. */ pow5_ptr[0] = 1; pow5_len = 1; /* Multiply with 5^|n|. */ if (abs_n > 0) { static mp_limb_t const small_pow5[13 + 1] = { 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, 48828125, 244140625, 1220703125 }; unsigned int n13; for (n13 = 0; n13 <= abs_n; n13 += 13) { mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13]; size_t j; mp_twolimb_t carry = 0; for (j = 0; j < pow5_len; j++) { mp_limb_t digit2 = pow5_ptr[j]; carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; pow5_ptr[j] = (mp_limb_t) carry; carry = carry >> GMP_LIMB_BITS; } if (carry > 0) pow5_ptr[pow5_len++] = (mp_limb_t) carry; } } s_limbs = abs_s / GMP_LIMB_BITS; s_bits = abs_s % GMP_LIMB_BITS; if (n >= 0 ? s >= 0 : s <= 0) { /* Multiply with 2^|s|. */ if (s_bits > 0) { mp_limb_t *ptr = pow5_ptr; mp_twolimb_t accu = 0; size_t count; for (count = pow5_len; count > 0; count--) { accu += (mp_twolimb_t) *ptr << s_bits; *ptr++ = (mp_limb_t) accu; accu = accu >> GMP_LIMB_BITS; } if (accu > 0) { *ptr = (mp_limb_t) accu; pow5_len++; } } if (s_limbs > 0) { size_t count; for (count = pow5_len; count > 0;) { count--; pow5_ptr[s_limbs + count] = pow5_ptr[count]; } for (count = s_limbs; count > 0;) { count--; pow5_ptr[count] = 0; } pow5_len += s_limbs; } pow5.limbs = pow5_ptr; pow5.nlimbs = pow5_len; if (n >= 0) { /* Multiply m with pow5. No division needed. */ z_memory = multiply (m, pow5, &z); } else { /* Divide m by pow5 and round. */ z_memory = divide (m, pow5, &z); } } else { pow5.limbs = pow5_ptr; pow5.nlimbs = pow5_len; if (n >= 0) { /* n >= 0, s < 0. Multiply m with pow5, then divide by 2^|s|. */ mpn_t numerator; mpn_t denominator; void *tmp_memory; tmp_memory = multiply (m, pow5, &numerator); if (tmp_memory == NULL) { free (pow5_ptr); free (memory); return NULL; } /* Construct 2^|s|. */ { mp_limb_t *ptr = pow5_ptr + pow5_len; size_t i; for (i = 0; i < s_limbs; i++) ptr[i] = 0; ptr[s_limbs] = (mp_limb_t) 1 << s_bits; denominator.limbs = ptr; denominator.nlimbs = s_limbs + 1; } z_memory = divide (numerator, denominator, &z); free (tmp_memory); } else { /* n < 0, s > 0. Multiply m with 2^s, then divide by pow5. */ mpn_t numerator; mp_limb_t *num_ptr; num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1) * sizeof (mp_limb_t)); if (num_ptr == NULL) { free (pow5_ptr); free (memory); return NULL; } { mp_limb_t *destptr = num_ptr; { size_t i; for (i = 0; i < s_limbs; i++) *destptr++ = 0; } if (s_bits > 0) { const mp_limb_t *sourceptr = m.limbs; mp_twolimb_t accu = 0; size_t count; for (count = m.nlimbs; count > 0; count--) { accu += (mp_twolimb_t) *sourceptr++ << s_bits; *destptr++ = (mp_limb_t) accu; accu = accu >> GMP_LIMB_BITS; } if (accu > 0) *destptr++ = (mp_limb_t) accu; } else { const mp_limb_t *sourceptr = m.limbs; size_t count; for (count = m.nlimbs; count > 0; count--) *destptr++ = *sourceptr++; } numerator.limbs = num_ptr; numerator.nlimbs = destptr - num_ptr; } z_memory = divide (numerator, pow5, &z); free (num_ptr); } } free (pow5_ptr); free (memory); /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */ if (z_memory == NULL) return NULL; digits = convert_to_decimal (z, extra_zeroes); free (z_memory); return digits; } # if NEED_PRINTF_LONG_DOUBLE /* Assuming x is finite and >= 0, and n is an integer: Returns the decimal representation of round (x * 10^n). Return the allocated memory - containing the decimal digits in low-to-high order, terminated with a NUL character - in case of success, NULL in case of memory allocation failure. */ static char * scale10_round_decimal_long_double (long double x, int n) { int e IF_LINT(= 0); mpn_t m; void *memory = decode_long_double (x, &e, &m); return scale10_round_decimal_decoded (e, m, memory, n); } # endif # if NEED_PRINTF_DOUBLE /* Assuming x is finite and >= 0, and n is an integer: Returns the decimal representation of round (x * 10^n). Return the allocated memory - containing the decimal digits in low-to-high order, terminated with a NUL character - in case of success, NULL in case of memory allocation failure. */ static char * scale10_round_decimal_double (double x, int n) { int e IF_LINT(= 0); mpn_t m; void *memory = decode_double (x, &e, &m); return scale10_round_decimal_decoded (e, m, memory, n); } # endif # if NEED_PRINTF_LONG_DOUBLE /* Assuming x is finite and > 0: Return an approximation for n with 10^n <= x < 10^(n+1). The approximation is usually the right n, but may be off by 1 sometimes. */ static int floorlog10l (long double x) { int exp; long double y; double z; double l; /* Split into exponential part and mantissa. */ y = frexpl (x, &exp); if (!(y >= 0.0L && y < 1.0L)) abort (); if (y == 0.0L) return INT_MIN; if (y < 0.5L) { while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) { y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); exp -= GMP_LIMB_BITS; } if (y < (1.0L / (1 << 16))) { y *= 1.0L * (1 << 16); exp -= 16; } if (y < (1.0L / (1 << 8))) { y *= 1.0L * (1 << 8); exp -= 8; } if (y < (1.0L / (1 << 4))) { y *= 1.0L * (1 << 4); exp -= 4; } if (y < (1.0L / (1 << 2))) { y *= 1.0L * (1 << 2); exp -= 2; } if (y < (1.0L / (1 << 1))) { y *= 1.0L * (1 << 1); exp -= 1; } } if (!(y >= 0.5L && y < 1.0L)) abort (); /* Compute an approximation for l = log2(x) = exp + log2(y). */ l = exp; z = y; if (z < 0.70710678118654752444) { z *= 1.4142135623730950488; l -= 0.5; } if (z < 0.8408964152537145431) { z *= 1.1892071150027210667; l -= 0.25; } if (z < 0.91700404320467123175) { z *= 1.0905077326652576592; l -= 0.125; } if (z < 0.9576032806985736469) { z *= 1.0442737824274138403; l -= 0.0625; } /* Now 0.95 <= z <= 1.01. */ z = 1 - z; /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...) Four terms are enough to get an approximation with error < 10^-7. */ l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); /* Finally multiply with log(2)/log(10), yields an approximation for log10(x). */ l *= 0.30102999566398119523; /* Round down to the next integer. */ return (int) l + (l < 0 ? -1 : 0); } # endif # if NEED_PRINTF_DOUBLE /* Assuming x is finite and > 0: Return an approximation for n with 10^n <= x < 10^(n+1). The approximation is usually the right n, but may be off by 1 sometimes. */ static int floorlog10 (double x) { int exp; double y; double z; double l; /* Split into exponential part and mantissa. */ y = frexp (x, &exp); if (!(y >= 0.0 && y < 1.0)) abort (); if (y == 0.0) return INT_MIN; if (y < 0.5) { while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) { y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); exp -= GMP_LIMB_BITS; } if (y < (1.0 / (1 << 16))) { y *= 1.0 * (1 << 16); exp -= 16; } if (y < (1.0 / (1 << 8))) { y *= 1.0 * (1 << 8); exp -= 8; } if (y < (1.0 / (1 << 4))) { y *= 1.0 * (1 << 4); exp -= 4; } if (y < (1.0 / (1 << 2))) { y *= 1.0 * (1 << 2); exp -= 2; } if (y < (1.0 / (1 << 1))) { y *= 1.0 * (1 << 1); exp -= 1; } } if (!(y >= 0.5 && y < 1.0)) abort (); /* Compute an approximation for l = log2(x) = exp + log2(y). */ l = exp; z = y; if (z < 0.70710678118654752444) { z *= 1.4142135623730950488; l -= 0.5; } if (z < 0.8408964152537145431) { z *= 1.1892071150027210667; l -= 0.25; } if (z < 0.91700404320467123175) { z *= 1.0905077326652576592; l -= 0.125; } if (z < 0.9576032806985736469) { z *= 1.0442737824274138403; l -= 0.0625; } /* Now 0.95 <= z <= 1.01. */ z = 1 - z; /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...) Four terms are enough to get an approximation with error < 10^-7. */ l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); /* Finally multiply with log(2)/log(10), yields an approximation for log10(x). */ l *= 0.30102999566398119523; /* Round down to the next integer. */ return (int) l + (l < 0 ? -1 : 0); } # endif /* Tests whether a string of digits consists of exactly PRECISION zeroes and a single '1' digit. */ static int is_borderline (const char *digits, size_t precision) { for (; precision > 0; precision--, digits++) if (*digits != '0') return 0; if (*digits != '1') return 0; digits++; return *digits == '\0'; } #endif #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF /* Use a different function name, to make it possible that the 'wchar_t' parametrization and the 'char' parametrization get compiled in the same translation unit. */ # if WIDE_CHAR_VERSION # define MAX_ROOM_NEEDED wmax_room_needed # else # define MAX_ROOM_NEEDED max_room_needed # endif /* Returns the number of TCHAR_T units needed as temporary space for the result of sprintf or SNPRINTF of a single conversion directive. */ static size_t MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, arg_type type, int flags, size_t width, int has_precision, size_t precision, int pad_ourselves) { size_t tmp_length; switch (conversion) { case 'd': case 'i': case 'u': if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ else if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Multiply by 2, as an estimate for FLAG_GROUP. */ tmp_length = xsum (tmp_length, tmp_length); /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; case 'o': if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ else if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; case 'x': case 'X': if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ else if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Add 2, to account for a leading sign or alternate form. */ tmp_length = xsum (tmp_length, 2); break; case 'f': case 'F': if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_MAX_EXP * 0.30103 /* binary -> decimal */ * 2 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ else tmp_length = (unsigned int) (DBL_MAX_EXP * 0.30103 /* binary -> decimal */ * 2 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ tmp_length = xsum (tmp_length, precision); break; case 'e': case 'E': case 'g': case 'G': tmp_length = 12; /* sign, decimal point, exponent etc. */ tmp_length = xsum (tmp_length, precision); break; case 'a': case 'A': if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_DIG * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (DBL_DIG * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Account for sign, decimal point etc. */ tmp_length = xsum (tmp_length, 12); break; case 'c': # if HAVE_WINT_T && !WIDE_CHAR_VERSION if (type == TYPE_WIDE_CHAR) { tmp_length = MB_CUR_MAX; # if ENABLE_WCHAR_FALLBACK if (tmp_length < (sizeof (wchar_t) > 2 ? 10 : 6)) tmp_length = (sizeof (wchar_t) > 2 ? 10 : 6); # endif } else # endif tmp_length = 1; break; case 's': # if HAVE_WCHAR_T if (type == TYPE_WIDE_STRING) { # if WIDE_CHAR_VERSION /* ISO C says about %ls in fwprintf: "If the precision is not specified or is greater than the size of the array, the array shall contain a null wide character." So if there is a precision, we must not use wcslen. */ const wchar_t *arg = ap->arg[arg_index].a.a_wide_string; if (has_precision) tmp_length = local_wcsnlen (arg, precision); else tmp_length = local_wcslen (arg); # else /* ISO C says about %ls in fprintf: "If a precision is specified, no more than that many bytes are written (including shift sequences, if any), and the array shall contain a null wide character if, to equal the multibyte character sequence length given by the precision, the function would need to access a wide character one past the end of the array." So if there is a precision, we must not use wcslen. */ /* This case has already been handled separately in VASNPRINTF. */ abort (); # endif } else # endif { # if WIDE_CHAR_VERSION /* ISO C says about %s in fwprintf: "If the precision is not specified or is greater than the size of the converted array, the converted array shall contain a null wide character." So if there is a precision, we must not use strlen. */ /* This case has already been handled separately in VASNPRINTF. */ abort (); # else /* ISO C says about %s in fprintf: "If the precision is not specified or greater than the size of the array, the array shall contain a null character." So if there is a precision, we must not use strlen. */ const char *arg = ap->arg[arg_index].a.a_string; if (has_precision) tmp_length = local_strnlen (arg, precision); else tmp_length = strlen (arg); # endif } break; case 'p': tmp_length = (unsigned int) (sizeof (void *) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1 /* turn floor into ceil */ + 2; /* account for leading 0x */ break; default: abort (); } if (!pad_ourselves) { # if ENABLE_UNISTDIO /* Padding considers the number of characters, therefore the number of elements after padding may be > max (tmp_length, width) but is certainly <= tmp_length + width. */ tmp_length = xsum (tmp_length, width); # else /* Padding considers the number of elements, says POSIX. */ if (tmp_length < width) tmp_length = width; # endif } tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ return tmp_length; } #endif DCHAR_T * VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, const FCHAR_T *format, va_list args) { DIRECTIVES d; arguments a; if (PRINTF_PARSE (format, &d, &a) < 0) /* errno is already set. */ return NULL; /* Frees the memory allocated by this function. Preserves errno. */ #define CLEANUP() \ if (d.dir != d.direct_alloc_dir) \ free (d.dir); \ if (a.arg != a.direct_alloc_arg) \ free (a.arg); if (PRINTF_FETCHARGS (args, &a) < 0) { CLEANUP (); errno = EINVAL; return NULL; } { size_t buf_neededlength; TCHAR_T *buf; TCHAR_T *buf_malloced; const FCHAR_T *cp; size_t i; DIRECTIVE *dp; /* Output string accumulator. */ DCHAR_T *result; size_t allocated; size_t length; /* Allocate a small buffer that will hold a directive passed to sprintf or snprintf. */ buf_neededlength = xsum4 (7, d.max_width_length, d.max_precision_length, 6); #if HAVE_ALLOCA if (buf_neededlength < 4000 / sizeof (TCHAR_T)) { buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T)); buf_malloced = NULL; } else #endif { size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T)); if (size_overflow_p (buf_memsize)) goto out_of_memory_1; buf = (TCHAR_T *) malloc (buf_memsize); if (buf == NULL) goto out_of_memory_1; buf_malloced = buf; } if (resultbuf != NULL) { result = resultbuf; allocated = *lengthp; } else { result = NULL; allocated = 0; } length = 0; /* Invariants: result is either == resultbuf or == NULL or malloc-allocated. If length > 0, then result != NULL. */ /* Ensures that allocated >= needed. Aborts through a jump to out_of_memory if needed is SIZE_MAX or otherwise too big. */ #define ENSURE_ALLOCATION_ELSE(needed, oom_statement) \ if ((needed) > allocated) \ { \ size_t memory_size; \ DCHAR_T *memory; \ \ allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ if ((needed) > allocated) \ allocated = (needed); \ memory_size = xtimes (allocated, sizeof (DCHAR_T)); \ if (size_overflow_p (memory_size)) \ oom_statement \ if (result == resultbuf || result == NULL) \ memory = (DCHAR_T *) malloc (memory_size); \ else \ memory = (DCHAR_T *) realloc (result, memory_size); \ if (memory == NULL) \ oom_statement \ if (result == resultbuf && length > 0) \ DCHAR_CPY (memory, result, length); \ result = memory; \ } #define ENSURE_ALLOCATION(needed) \ ENSURE_ALLOCATION_ELSE((needed), goto out_of_memory; ) for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) { if (cp != dp->dir_start) { size_t n = dp->dir_start - cp; size_t augmented_length = xsum (length, n); ENSURE_ALLOCATION (augmented_length); /* This copies a piece of FCHAR_T[] into a DCHAR_T[]. Here we need that the format string contains only ASCII characters if FCHAR_T and DCHAR_T are not the same type. */ if (sizeof (FCHAR_T) == sizeof (DCHAR_T)) { DCHAR_CPY (result + length, (const DCHAR_T *) cp, n); length = augmented_length; } else { do result[length++] = *cp++; while (--n > 0); } } if (i == d.count) break; /* Execute a single directive. */ if (dp->conversion == '%') { size_t augmented_length; if (!(dp->arg_index == ARG_NONE)) abort (); augmented_length = xsum (length, 1); ENSURE_ALLOCATION (augmented_length); result[length] = '%'; length = augmented_length; } else { if (!(dp->arg_index != ARG_NONE)) abort (); if (dp->conversion == 'n') { switch (a.arg[dp->arg_index].type) { case TYPE_COUNT_SCHAR_POINTER: *a.arg[dp->arg_index].a.a_count_schar_pointer = length; break; case TYPE_COUNT_SHORT_POINTER: *a.arg[dp->arg_index].a.a_count_short_pointer = length; break; case TYPE_COUNT_INT_POINTER: *a.arg[dp->arg_index].a.a_count_int_pointer = length; break; case TYPE_COUNT_LONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longint_pointer = length; break; case TYPE_COUNT_LONGLONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; break; default: abort (); } } #if ENABLE_UNISTDIO /* The unistdio extensions. */ else if (dp->conversion == 'U') { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; int has_width; size_t width; int has_precision; size_t precision; has_width = 0; width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; width = -width; } } else { const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } has_width = 1; } has_precision = 0; precision = 0; if (dp->precision_start != dp->precision_end) { if (dp->precision_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->precision_arg_index].a.a_int; /* "A negative precision is taken as if the precision were omitted." */ if (arg >= 0) { precision = arg; has_precision = 1; } } else { const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) precision = xsum (xtimes (precision, 10), *digitp++ - '0'); has_precision = 1; } } switch (type) { case TYPE_U8_STRING: { const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string; const uint8_t *arg_end; size_t characters; if (has_precision) { /* Use only PRECISION characters, from the left. */ arg_end = arg; characters = 0; for (; precision > 0; precision--) { int count = u8_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else if (has_width) { /* Use the entire string, and count the number of characters. */ arg_end = arg; characters = 0; for (;;) { int count = u8_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else { /* Use the entire string. */ arg_end = arg + u8_strlen (arg); /* The number of characters doesn't matter. */ characters = 0; } if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } # if DCHAR_IS_UINT8_T { size_t n = arg_end - arg; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_CPY (result + length, arg, n); length += n; } # else { /* Convert. */ DCHAR_T *converted = result + length; size_t converted_len = allocated - length; # if DCHAR_IS_TCHAR /* Convert from UTF-8 to locale encoding. */ converted = u8_conv_to_encoding (locale_charset (), iconveh_question_mark, arg, arg_end - arg, NULL, converted, &converted_len); # else /* Convert from UTF-8 to UTF-16/UTF-32. */ converted = U8_TO_DCHAR (arg, arg_end - arg, converted, &converted_len); # endif if (converted == NULL) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); return NULL; } if (converted != result + length) { ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), { free (converted); goto out_of_memory; }); DCHAR_CPY (result + length, converted, converted_len); free (converted); } length += converted_len; } # endif if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } } break; case TYPE_U16_STRING: { const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string; const uint16_t *arg_end; size_t characters; if (has_precision) { /* Use only PRECISION characters, from the left. */ arg_end = arg; characters = 0; for (; precision > 0; precision--) { int count = u16_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else if (has_width) { /* Use the entire string, and count the number of characters. */ arg_end = arg; characters = 0; for (;;) { int count = u16_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else { /* Use the entire string. */ arg_end = arg + u16_strlen (arg); /* The number of characters doesn't matter. */ characters = 0; } if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } # if DCHAR_IS_UINT16_T { size_t n = arg_end - arg; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_CPY (result + length, arg, n); length += n; } # else { /* Convert. */ DCHAR_T *converted = result + length; size_t converted_len = allocated - length; # if DCHAR_IS_TCHAR /* Convert from UTF-16 to locale encoding. */ converted = u16_conv_to_encoding (locale_charset (), iconveh_question_mark, arg, arg_end - arg, NULL, converted, &converted_len); # else /* Convert from UTF-16 to UTF-8/UTF-32. */ converted = U16_TO_DCHAR (arg, arg_end - arg, converted, &converted_len); # endif if (converted == NULL) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); return NULL; } if (converted != result + length) { ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), { free (converted); goto out_of_memory; }); DCHAR_CPY (result + length, converted, converted_len); free (converted); } length += converted_len; } # endif if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } } break; case TYPE_U32_STRING: { const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string; const uint32_t *arg_end; size_t characters; if (has_precision) { /* Use only PRECISION characters, from the left. */ arg_end = arg; characters = 0; for (; precision > 0; precision--) { int count = u32_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else if (has_width) { /* Use the entire string, and count the number of characters. */ arg_end = arg; characters = 0; for (;;) { int count = u32_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else { /* Use the entire string. */ arg_end = arg + u32_strlen (arg); /* The number of characters doesn't matter. */ characters = 0; } if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } # if DCHAR_IS_UINT32_T { size_t n = arg_end - arg; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_CPY (result + length, arg, n); length += n; } # else { /* Convert. */ DCHAR_T *converted = result + length; size_t converted_len = allocated - length; # if DCHAR_IS_TCHAR /* Convert from UTF-32 to locale encoding. */ converted = u32_conv_to_encoding (locale_charset (), iconveh_question_mark, arg, arg_end - arg, NULL, converted, &converted_len); # else /* Convert from UTF-32 to UTF-8/UTF-16. */ converted = U32_TO_DCHAR (arg, arg_end - arg, converted, &converted_len); # endif if (converted == NULL) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); return NULL; } if (converted != result + length) { ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), { free (converted); goto out_of_memory; }); DCHAR_CPY (result + length, converted, converted_len); free (converted); } length += converted_len; } # endif if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } } break; default: abort (); } } #endif #if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL) || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T else if (dp->conversion == 's' # if WIDE_CHAR_VERSION && a.arg[dp->arg_index].type != TYPE_WIDE_STRING # else && a.arg[dp->arg_index].type == TYPE_WIDE_STRING # endif ) { /* The normal handling of the 's' directive below requires allocating a temporary buffer. The determination of its length (tmp_length), in the case when a precision is specified, below requires a conversion between a char[] string and a wchar_t[] wide string. It could be done, but we have no guarantee that the implementation of sprintf will use the exactly same algorithm. Without this guarantee, it is possible to have buffer overrun bugs. In order to avoid such bugs, we implement the entire processing of the 's' directive ourselves. */ int flags = dp->flags; int has_width; size_t width; int has_precision; size_t precision; has_width = 0; width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; width = -width; } } else { const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } has_width = 1; } has_precision = 0; precision = 6; if (dp->precision_start != dp->precision_end) { if (dp->precision_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->precision_arg_index].a.a_int; /* "A negative precision is taken as if the precision were omitted." */ if (arg >= 0) { precision = arg; has_precision = 1; } } else { const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) precision = xsum (xtimes (precision, 10), *digitp++ - '0'); has_precision = 1; } } # if WIDE_CHAR_VERSION /* %s in vasnwprintf. See the specification of fwprintf. */ { const char *arg = a.arg[dp->arg_index].a.a_string; const char *arg_end; size_t characters; if (has_precision) { /* Use only as many bytes as needed to produce PRECISION wide characters, from the left. */ # if HAVE_MBRTOWC mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif arg_end = arg; characters = 0; for (; precision > 0; precision--) { int count; # if HAVE_MBRTOWC count = mbrlen (arg_end, MB_CUR_MAX, &state); # else count = mblen (arg_end, MB_CUR_MAX); # endif if (count == 0) /* Found the terminating NUL. */ break; if (count < 0) { /* Invalid or incomplete multibyte character. */ if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else if (has_width) { /* Use the entire string, and count the number of wide characters. */ # if HAVE_MBRTOWC mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif arg_end = arg; characters = 0; for (;;) { int count; # if HAVE_MBRTOWC count = mbrlen (arg_end, MB_CUR_MAX, &state); # else count = mblen (arg_end, MB_CUR_MAX); # endif if (count == 0) /* Found the terminating NUL. */ break; if (count < 0) { /* Invalid or incomplete multibyte character. */ if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else { /* Use the entire string. */ arg_end = arg + strlen (arg); /* The number of characters doesn't matter. */ characters = 0; } if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } if (has_precision || has_width) { /* We know the number of wide characters in advance. */ size_t remaining; # if HAVE_MBRTOWC mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif ENSURE_ALLOCATION (xsum (length, characters)); for (remaining = characters; remaining > 0; remaining--) { wchar_t wc; int count; # if HAVE_MBRTOWC count = mbrtowc (&wc, arg, arg_end - arg, &state); # else count = mbtowc (&wc, arg, arg_end - arg); # endif if (count <= 0) /* mbrtowc not consistent with mbrlen, or mbtowc not consistent with mblen. */ abort (); result[length++] = wc; arg += count; } if (!(arg == arg_end)) abort (); } else { # if HAVE_MBRTOWC mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif while (arg < arg_end) { wchar_t wc; int count; # if HAVE_MBRTOWC count = mbrtowc (&wc, arg, arg_end - arg, &state); # else count = mbtowc (&wc, arg, arg_end - arg); # endif if (count <= 0) /* mbrtowc not consistent with mbrlen, or mbtowc not consistent with mblen. */ abort (); ENSURE_ALLOCATION (xsum (length, 1)); result[length++] = wc; arg += count; } } if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } } # else /* %ls in vasnprintf. See the specification of fprintf. */ { const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; const wchar_t *arg_end; size_t characters; # if !DCHAR_IS_TCHAR /* This code assumes that TCHAR_T is 'char'. */ verify (sizeof (TCHAR_T) == 1); TCHAR_T *tmpsrc; DCHAR_T *tmpdst; size_t tmpdst_len; # endif size_t w; if (has_precision) { /* Use only as many wide characters as needed to produce at most PRECISION bytes, from the left. */ # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif arg_end = arg; characters = 0; while (precision > 0) { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; if (*arg_end == 0) /* Found the terminating null wide character. */ break; count = local_wcrtomb (cbuf, *arg_end, &state); if (count < 0) { /* Cannot convert. */ if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } if (precision < (unsigned int) count) break; arg_end++; characters += count; precision -= count; } } # if DCHAR_IS_TCHAR else if (has_width) # else else # endif { /* Use the entire string, and count the number of bytes. */ # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif arg_end = arg; characters = 0; for (;;) { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; if (*arg_end == 0) /* Found the terminating null wide character. */ break; count = local_wcrtomb (cbuf, *arg_end, &state); if (count < 0) { /* Cannot convert. */ if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end++; characters += count; } } # if DCHAR_IS_TCHAR else { /* Use the entire string. */ arg_end = arg + local_wcslen (arg); /* The number of bytes doesn't matter. */ characters = 0; } # endif # if !DCHAR_IS_TCHAR /* Convert the string into a piece of temporary memory. */ tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T)); if (tmpsrc == NULL) goto out_of_memory; { TCHAR_T *tmpptr = tmpsrc; size_t remaining; # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif for (remaining = characters; remaining > 0; ) { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; if (*arg == 0) abort (); count = local_wcrtomb (cbuf, *arg, &state); if (count <= 0) /* Inconsistency. */ abort (); memcpy (tmpptr, cbuf, count); tmpptr += count; arg++; remaining -= count; } if (!(arg == arg_end)) abort (); } /* Convert from TCHAR_T[] to DCHAR_T[]. */ tmpdst = DCHAR_CONV_FROM_ENCODING (locale_charset (), iconveh_question_mark, tmpsrc, characters, NULL, NULL, &tmpdst_len); if (tmpdst == NULL) { free (tmpsrc); if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); return NULL; } free (tmpsrc); # endif if (has_width) { # if ENABLE_UNISTDIO /* Outside POSIX, it's preferable to compare the width against the number of _characters_ of the converted value. */ w = DCHAR_MBSNLEN (result + length, characters); # else /* The width is compared against the number of _bytes_ of the converted value, says POSIX. */ w = characters; # endif } else /* w doesn't matter. */ w = 0; if (w < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - w; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } # if DCHAR_IS_TCHAR if (has_precision || has_width) { /* We know the number of bytes in advance. */ size_t remaining; # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif ENSURE_ALLOCATION (xsum (length, characters)); for (remaining = characters; remaining > 0; ) { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; if (*arg == 0) abort (); count = local_wcrtomb (cbuf, *arg, &state); if (count <= 0) /* Inconsistency. */ abort (); memcpy (result + length, cbuf, count); length += count; arg++; remaining -= count; } if (!(arg == arg_end)) abort (); } else { # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif while (arg < arg_end) { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; if (*arg == 0) abort (); count = local_wcrtomb (cbuf, *arg, &state); if (count <= 0) { /* Cannot convert. */ if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } ENSURE_ALLOCATION (xsum (length, count)); memcpy (result + length, cbuf, count); length += count; arg++; } } # else ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), { free (tmpdst); goto out_of_memory; }); DCHAR_CPY (result + length, tmpdst, tmpdst_len); free (tmpdst); length += tmpdst_len; # endif if (w < width && (dp->flags & FLAG_LEFT)) { size_t n = width - w; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } } # endif } #endif #if ENABLE_WCHAR_FALLBACK && HAVE_WINT_T && !WIDE_CHAR_VERSION else if (dp->conversion == 'c' && a.arg[dp->arg_index].type == TYPE_WIDE_CHAR) { /* Implement the 'lc' directive ourselves, in order to provide the fallback that avoids EILSEQ. */ int flags = dp->flags; int has_width; size_t width; has_width = 0; width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; width = -width; } } else { const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } has_width = 1; } /* %lc in vasnprintf. See the specification of fprintf. */ { wchar_t arg = (wchar_t) a.arg[dp->arg_index].a.a_wide_char; size_t characters; # if !DCHAR_IS_TCHAR /* This code assumes that TCHAR_T is 'char'. */ verify (sizeof (TCHAR_T) == 1); TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64. */ DCHAR_T *tmpdst; size_t tmpdst_len; # endif size_t w; # if DCHAR_IS_TCHAR if (has_width) # endif { /* Count the number of bytes. */ characters = 0; if (arg != 0) { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif count = local_wcrtomb (cbuf, arg, &state); if (count < 0) /* Inconsistency. */ abort (); characters = count; } } # if DCHAR_IS_TCHAR else { /* The number of bytes doesn't matter. */ characters = 0; } # endif # if !DCHAR_IS_TCHAR /* Convert the string into a piece of temporary memory. */ if (characters > 0) /* implies arg != 0 */ { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif count = local_wcrtomb (cbuf, arg, &state); if (count <= 0) /* Inconsistency. */ abort (); memcpy (tmpsrc, cbuf, count); } /* Convert from TCHAR_T[] to DCHAR_T[]. */ tmpdst = DCHAR_CONV_FROM_ENCODING (locale_charset (), iconveh_question_mark, tmpsrc, characters, NULL, NULL, &tmpdst_len); if (tmpdst == NULL) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); return NULL; } # endif if (has_width) { # if ENABLE_UNISTDIO /* Outside POSIX, it's preferable to compare the width against the number of _characters_ of the converted value. */ w = DCHAR_MBSNLEN (result + length, characters); # else /* The width is compared against the number of _bytes_ of the converted value, says POSIX. */ w = characters; # endif } else /* w doesn't matter. */ w = 0; if (w < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - w; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } # if DCHAR_IS_TCHAR if (has_width) { /* We know the number of bytes in advance. */ ENSURE_ALLOCATION (xsum (length, characters)); if (characters > 0) /* implies arg != 0 */ { int count; # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif count = local_wcrtomb (result + length, arg, &state); if (count <= 0) /* Inconsistency. */ abort (); length += count; } } else { if (arg != 0) { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif count = local_wcrtomb (cbuf, arg, &state); if (count <= 0) /* Inconsistency. */ abort (); ENSURE_ALLOCATION (xsum (length, count)); memcpy (result + length, cbuf, count); length += count; } } # else ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), { free (tmpdst); goto out_of_memory; }); DCHAR_CPY (result + length, tmpdst, tmpdst_len); free (tmpdst); length += tmpdst_len; # endif if (w < width && (dp->flags & FLAG_LEFT)) { size_t n = width - w; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } } } #endif #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL else if ((dp->conversion == 'a' || dp->conversion == 'A') # if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) && (0 # if NEED_PRINTF_DOUBLE || a.arg[dp->arg_index].type == TYPE_DOUBLE # endif # if NEED_PRINTF_LONG_DOUBLE || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE # endif ) # endif ) { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; size_t width; int has_precision; size_t precision; size_t tmp_length; size_t count; DCHAR_T tmpbuf[700]; DCHAR_T *tmp; DCHAR_T *pad_ptr; DCHAR_T *p; width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; width = -width; } } else { const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } } has_precision = 0; precision = 0; if (dp->precision_start != dp->precision_end) { if (dp->precision_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->precision_arg_index].a.a_int; /* "A negative precision is taken as if the precision were omitted." */ if (arg >= 0) { precision = arg; has_precision = 1; } } else { const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) precision = xsum (xtimes (precision, 10), *digitp++ - '0'); has_precision = 1; } } /* Allocate a temporary buffer of sufficient size. */ if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) ((LDBL_DIG + 1) * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) ((DBL_DIG + 1) * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Account for sign, decimal point etc. */ tmp_length = xsum (tmp_length, 12); if (tmp_length < width) tmp_length = width; tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) tmp = tmpbuf; else { size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); if (size_overflow_p (tmp_memsize)) /* Overflow, would lead to out of memory. */ goto out_of_memory; tmp = (DCHAR_T *) malloc (tmp_memsize); if (tmp == NULL) /* Out of memory. */ goto out_of_memory; } pad_ptr = NULL; p = tmp; if (type == TYPE_LONGDOUBLE) { # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE long double arg = a.arg[dp->arg_index].a.a_longdouble; if (isnanl (arg)) { if (dp->conversion == 'A') { *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; } else { *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; } } else { int sign = 0; DECL_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING (); if (signbit (arg)) /* arg < 0.0L or negative zero */ { sign = -1; arg = -arg; } if (sign < 0) *p++ = '-'; else if (flags & FLAG_SHOWSIGN) *p++ = '+'; else if (flags & FLAG_SPACE) *p++ = ' '; if (arg > 0.0L && arg + arg == arg) { if (dp->conversion == 'A') { *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; } else { *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; } } else { int exponent; long double mantissa; if (arg > 0.0L) mantissa = printf_frexpl (arg, &exponent); else { exponent = 0; mantissa = 0.0L; } if (has_precision && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1) { /* Round the mantissa. */ long double tail = mantissa; size_t q; for (q = precision; ; q--) { int digit = (int) tail; tail -= digit; if (q == 0) { if (digit & 1 ? tail >= 0.5L : tail > 0.5L) tail = 1 - tail; else tail = - tail; break; } tail *= 16.0L; } if (tail != 0.0L) for (q = precision; q > 0; q--) tail *= 0.0625L; mantissa += tail; } *p++ = '0'; *p++ = dp->conversion - 'A' + 'X'; pad_ptr = p; { int digit; digit = (int) mantissa; mantissa -= digit; *p++ = '0' + digit; if ((flags & FLAG_ALT) || mantissa > 0.0L || precision > 0) { *p++ = decimal_point_char (); /* This loop terminates because we assume that FLT_RADIX is a power of 2. */ while (mantissa > 0.0L) { mantissa *= 16.0L; digit = (int) mantissa; mantissa -= digit; *p++ = digit + (digit < 10 ? '0' : dp->conversion - 10); if (precision > 0) precision--; } while (precision > 0) { *p++ = '0'; precision--; } } } *p++ = dp->conversion - 'A' + 'P'; # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', 'd', '\0' }; SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, "%+d", exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, "%+d", exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } # endif } END_LONG_DOUBLE_ROUNDING (); } # else abort (); # endif } else { # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE double arg = a.arg[dp->arg_index].a.a_double; if (isnand (arg)) { if (dp->conversion == 'A') { *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; } else { *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; } } else { int sign = 0; if (signbit (arg)) /* arg < 0.0 or negative zero */ { sign = -1; arg = -arg; } if (sign < 0) *p++ = '-'; else if (flags & FLAG_SHOWSIGN) *p++ = '+'; else if (flags & FLAG_SPACE) *p++ = ' '; if (arg > 0.0 && arg + arg == arg) { if (dp->conversion == 'A') { *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; } else { *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; } } else { int exponent; double mantissa; if (arg > 0.0) mantissa = printf_frexp (arg, &exponent); else { exponent = 0; mantissa = 0.0; } if (has_precision && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1) { /* Round the mantissa. */ double tail = mantissa; size_t q; for (q = precision; ; q--) { int digit = (int) tail; tail -= digit; if (q == 0) { if (digit & 1 ? tail >= 0.5 : tail > 0.5) tail = 1 - tail; else tail = - tail; break; } tail *= 16.0; } if (tail != 0.0) for (q = precision; q > 0; q--) tail *= 0.0625; mantissa += tail; } *p++ = '0'; *p++ = dp->conversion - 'A' + 'X'; pad_ptr = p; { int digit; digit = (int) mantissa; mantissa -= digit; *p++ = '0' + digit; if ((flags & FLAG_ALT) || mantissa > 0.0 || precision > 0) { *p++ = decimal_point_char (); /* This loop terminates because we assume that FLT_RADIX is a power of 2. */ while (mantissa > 0.0) { mantissa *= 16.0; digit = (int) mantissa; mantissa -= digit; *p++ = digit + (digit < 10 ? '0' : dp->conversion - 10); if (precision > 0) precision--; } while (precision > 0) { *p++ = '0'; precision--; } } } *p++ = dp->conversion - 'A' + 'P'; # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', 'd', '\0' }; SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, "%+d", exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, "%+d", exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } # endif } } # else abort (); # endif } /* The generated string now extends from tmp to p, with the zero padding insertion point being at pad_ptr. */ count = p - tmp; if (count < width) { size_t pad = width - count; DCHAR_T *end = p + pad; if (flags & FLAG_LEFT) { /* Pad with spaces on the right. */ for (; pad > 0; pad--) *p++ = ' '; } else if ((flags & FLAG_ZERO) && pad_ptr != NULL) { /* Pad with zeroes. */ DCHAR_T *q = end; while (p > pad_ptr) *--q = *--p; for (; pad > 0; pad--) *p++ = '0'; } else { /* Pad with spaces on the left. */ DCHAR_T *q = end; while (p > tmp) *--q = *--p; for (; pad > 0; pad--) *p++ = ' '; } p = end; } count = p - tmp; if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the code above! */ abort (); /* Make room for the result. */ if (count >= allocated - length) { size_t n = xsum (length, count); ENSURE_ALLOCATION (n); } /* Append the result. */ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); if (tmp != tmpbuf) free (tmp); length += count; } #endif #if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL else if ((dp->conversion == 'f' || dp->conversion == 'F' || dp->conversion == 'e' || dp->conversion == 'E' || dp->conversion == 'g' || dp->conversion == 'G' || dp->conversion == 'a' || dp->conversion == 'A') && (0 # if NEED_PRINTF_DOUBLE || a.arg[dp->arg_index].type == TYPE_DOUBLE # elif NEED_PRINTF_INFINITE_DOUBLE || (a.arg[dp->arg_index].type == TYPE_DOUBLE /* The systems (mingw) which produce wrong output for Inf, -Inf, and NaN also do so for -0.0. Therefore we treat this case here as well. */ && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double)) # endif # if NEED_PRINTF_LONG_DOUBLE || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE # elif NEED_PRINTF_INFINITE_LONG_DOUBLE || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE /* Some systems produce wrong output for Inf, -Inf, and NaN. Some systems in this category (IRIX 5.3) also do so for -0.0. Therefore we treat this case here as well. */ && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble)) # endif )) { # if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) arg_type type = a.arg[dp->arg_index].type; # endif int flags = dp->flags; size_t width; size_t count; int has_precision; size_t precision; size_t tmp_length; DCHAR_T tmpbuf[700]; DCHAR_T *tmp; DCHAR_T *pad_ptr; DCHAR_T *p; width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; width = -width; } } else { const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } } has_precision = 0; precision = 0; if (dp->precision_start != dp->precision_end) { if (dp->precision_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->precision_arg_index].a.a_int; /* "A negative precision is taken as if the precision were omitted." */ if (arg >= 0) { precision = arg; has_precision = 1; } } else { const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) precision = xsum (xtimes (precision, 10), *digitp++ - '0'); has_precision = 1; } } /* POSIX specifies the default precision to be 6 for %f, %F, %e, %E, but not for %g, %G. Implementations appear to use the same default precision also for %g, %G. But for %a, %A, the default precision is 0. */ if (!has_precision) if (!(dp->conversion == 'a' || dp->conversion == 'A')) precision = 6; /* Allocate a temporary buffer of sufficient size. */ # if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1); # elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0); # elif NEED_PRINTF_LONG_DOUBLE tmp_length = LDBL_DIG + 1; # elif NEED_PRINTF_DOUBLE tmp_length = DBL_DIG + 1; # else tmp_length = 0; # endif if (tmp_length < precision) tmp_length = precision; # if NEED_PRINTF_LONG_DOUBLE # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE if (type == TYPE_LONGDOUBLE) # endif if (dp->conversion == 'f' || dp->conversion == 'F') { long double arg = a.arg[dp->arg_index].a.a_longdouble; if (!(isnanl (arg) || arg + arg == arg)) { /* arg is finite and nonzero. */ int exponent = floorlog10l (arg < 0 ? -arg : arg); if (exponent >= 0 && tmp_length < exponent + precision) tmp_length = exponent + precision; } } # endif # if NEED_PRINTF_DOUBLE # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE if (type == TYPE_DOUBLE) # endif if (dp->conversion == 'f' || dp->conversion == 'F') { double arg = a.arg[dp->arg_index].a.a_double; if (!(isnand (arg) || arg + arg == arg)) { /* arg is finite and nonzero. */ int exponent = floorlog10 (arg < 0 ? -arg : arg); if (exponent >= 0 && tmp_length < exponent + precision) tmp_length = exponent + precision; } } # endif /* Account for sign, decimal point etc. */ tmp_length = xsum (tmp_length, 12); if (tmp_length < width) tmp_length = width; tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) tmp = tmpbuf; else { size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); if (size_overflow_p (tmp_memsize)) /* Overflow, would lead to out of memory. */ goto out_of_memory; tmp = (DCHAR_T *) malloc (tmp_memsize); if (tmp == NULL) /* Out of memory. */ goto out_of_memory; } pad_ptr = NULL; p = tmp; # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE if (type == TYPE_LONGDOUBLE) # endif { long double arg = a.arg[dp->arg_index].a.a_longdouble; if (isnanl (arg)) { if (dp->conversion >= 'A' && dp->conversion <= 'Z') { *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; } else { *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; } } else { int sign = 0; DECL_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING (); if (signbit (arg)) /* arg < 0.0L or negative zero */ { sign = -1; arg = -arg; } if (sign < 0) *p++ = '-'; else if (flags & FLAG_SHOWSIGN) *p++ = '+'; else if (flags & FLAG_SPACE) *p++ = ' '; if (arg > 0.0L && arg + arg == arg) { if (dp->conversion >= 'A' && dp->conversion <= 'Z') { *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; } else { *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; } } else { # if NEED_PRINTF_LONG_DOUBLE pad_ptr = p; if (dp->conversion == 'f' || dp->conversion == 'F') { char *digits; size_t ndigits; digits = scale10_round_decimal_long_double (arg, precision); if (digits == NULL) { END_LONG_DOUBLE_ROUNDING (); goto out_of_memory; } ndigits = strlen (digits); if (ndigits > precision) do { --ndigits; *p++ = digits[ndigits]; } while (ndigits > precision); else *p++ = '0'; /* Here ndigits <= precision. */ if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > ndigits; precision--) *p++ = '0'; while (ndigits > 0) { --ndigits; *p++ = digits[ndigits]; } } free (digits); } else if (dp->conversion == 'e' || dp->conversion == 'E') { int exponent; if (arg == 0.0L) { exponent = 0; *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } } else { /* arg > 0.0L. */ int adjusted; char *digits; size_t ndigits; exponent = floorlog10l (arg); adjusted = 0; for (;;) { digits = scale10_round_decimal_long_double (arg, (int)precision - exponent); if (digits == NULL) { END_LONG_DOUBLE_ROUNDING (); goto out_of_memory; } ndigits = strlen (digits); if (ndigits == precision + 1) break; if (ndigits < precision || ndigits > precision + 2) /* The exponent was not guessed precisely enough. */ abort (); if (adjusted) /* None of two values of exponent is the right one. Prevent an endless loop. */ abort (); free (digits); if (ndigits == precision) exponent -= 1; else exponent += 1; adjusted = 1; } /* Here ndigits = precision+1. */ if (is_borderline (digits, precision)) { /* Maybe the exponent guess was too high and a smaller exponent can be reached by turning a 10...0 into 9...9x. */ char *digits2 = scale10_round_decimal_long_double (arg, (int)precision - exponent + 1); if (digits2 == NULL) { free (digits); END_LONG_DOUBLE_ROUNDING (); goto out_of_memory; } if (strlen (digits2) == precision + 1) { free (digits); digits = digits2; exponent -= 1; } else free (digits2); } /* Here ndigits = precision+1. */ *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); while (ndigits > 0) { --ndigits; *p++ = digits[ndigits]; } } free (digits); } *p++ = dp->conversion; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', '.', '2', 'd', '\0' }; SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, "%+.2d", exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, "%+.2d", exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } # endif } else if (dp->conversion == 'g' || dp->conversion == 'G') { if (precision == 0) precision = 1; /* precision >= 1. */ if (arg == 0.0L) /* The exponent is 0, >= -4, < precision. Use fixed-point notation. */ { size_t ndigits = precision; /* Number of trailing zeroes that have to be dropped. */ size_t nzeroes = (flags & FLAG_ALT ? 0 : precision - 1); --ndigits; *p++ = '0'; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = '0'; } } } else { /* arg > 0.0L. */ int exponent; int adjusted; char *digits; size_t ndigits; size_t nzeroes; exponent = floorlog10l (arg); adjusted = 0; for (;;) { digits = scale10_round_decimal_long_double (arg, (int)(precision - 1) - exponent); if (digits == NULL) { END_LONG_DOUBLE_ROUNDING (); goto out_of_memory; } ndigits = strlen (digits); if (ndigits == precision) break; if (ndigits < precision - 1 || ndigits > precision + 1) /* The exponent was not guessed precisely enough. */ abort (); if (adjusted) /* None of two values of exponent is the right one. Prevent an endless loop. */ abort (); free (digits); if (ndigits < precision) exponent -= 1; else exponent += 1; adjusted = 1; } /* Here ndigits = precision. */ if (is_borderline (digits, precision - 1)) { /* Maybe the exponent guess was too high and a smaller exponent can be reached by turning a 10...0 into 9...9x. */ char *digits2 = scale10_round_decimal_long_double (arg, (int)(precision - 1) - exponent + 1); if (digits2 == NULL) { free (digits); END_LONG_DOUBLE_ROUNDING (); goto out_of_memory; } if (strlen (digits2) == precision) { free (digits); digits = digits2; exponent -= 1; } else free (digits2); } /* Here ndigits = precision. */ /* Determine the number of trailing zeroes that have to be dropped. */ nzeroes = 0; if ((flags & FLAG_ALT) == 0) while (nzeroes < ndigits && digits[nzeroes] == '0') nzeroes++; /* The exponent is now determined. */ if (exponent >= -4 && exponent < (long)precision) { /* Fixed-point notation: max(exponent,0)+1 digits, then the decimal point, then the remaining digits without trailing zeroes. */ if (exponent >= 0) { size_t ecount = exponent + 1; /* Note: count <= precision = ndigits. */ for (; ecount > 0; ecount--) *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } } else { size_t ecount = -exponent - 1; *p++ = '0'; *p++ = decimal_point_char (); for (; ecount > 0; ecount--) *p++ = '0'; while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } } else { /* Exponential notation. */ *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', '.', '2', 'd', '\0' }; SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, "%+.2d", exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, "%+.2d", exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } # endif } free (digits); } } else abort (); # else /* arg is finite. */ if (!(arg == 0.0L)) abort (); pad_ptr = p; if (dp->conversion == 'f' || dp->conversion == 'F') { *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } } else if (dp->conversion == 'e' || dp->conversion == 'E') { *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } *p++ = dp->conversion; /* 'e' or 'E' */ *p++ = '+'; *p++ = '0'; *p++ = '0'; } else if (dp->conversion == 'g' || dp->conversion == 'G') { *p++ = '0'; if (flags & FLAG_ALT) { size_t ndigits = (precision > 0 ? precision - 1 : 0); *p++ = decimal_point_char (); for (; ndigits > 0; --ndigits) *p++ = '0'; } } else if (dp->conversion == 'a' || dp->conversion == 'A') { *p++ = '0'; *p++ = dp->conversion - 'A' + 'X'; pad_ptr = p; *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } *p++ = dp->conversion - 'A' + 'P'; *p++ = '+'; *p++ = '0'; } else abort (); # endif } END_LONG_DOUBLE_ROUNDING (); } } # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE else # endif # endif # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE { double arg = a.arg[dp->arg_index].a.a_double; if (isnand (arg)) { if (dp->conversion >= 'A' && dp->conversion <= 'Z') { *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; } else { *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; } } else { int sign = 0; if (signbit (arg)) /* arg < 0.0 or negative zero */ { sign = -1; arg = -arg; } if (sign < 0) *p++ = '-'; else if (flags & FLAG_SHOWSIGN) *p++ = '+'; else if (flags & FLAG_SPACE) *p++ = ' '; if (arg > 0.0 && arg + arg == arg) { if (dp->conversion >= 'A' && dp->conversion <= 'Z') { *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; } else { *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; } } else { # if NEED_PRINTF_DOUBLE pad_ptr = p; if (dp->conversion == 'f' || dp->conversion == 'F') { char *digits; size_t ndigits; digits = scale10_round_decimal_double (arg, precision); if (digits == NULL) goto out_of_memory; ndigits = strlen (digits); if (ndigits > precision) do { --ndigits; *p++ = digits[ndigits]; } while (ndigits > precision); else *p++ = '0'; /* Here ndigits <= precision. */ if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > ndigits; precision--) *p++ = '0'; while (ndigits > 0) { --ndigits; *p++ = digits[ndigits]; } } free (digits); } else if (dp->conversion == 'e' || dp->conversion == 'E') { int exponent; if (arg == 0.0) { exponent = 0; *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } } else { /* arg > 0.0. */ int adjusted; char *digits; size_t ndigits; exponent = floorlog10 (arg); adjusted = 0; for (;;) { digits = scale10_round_decimal_double (arg, (int)precision - exponent); if (digits == NULL) goto out_of_memory; ndigits = strlen (digits); if (ndigits == precision + 1) break; if (ndigits < precision || ndigits > precision + 2) /* The exponent was not guessed precisely enough. */ abort (); if (adjusted) /* None of two values of exponent is the right one. Prevent an endless loop. */ abort (); free (digits); if (ndigits == precision) exponent -= 1; else exponent += 1; adjusted = 1; } /* Here ndigits = precision+1. */ if (is_borderline (digits, precision)) { /* Maybe the exponent guess was too high and a smaller exponent can be reached by turning a 10...0 into 9...9x. */ char *digits2 = scale10_round_decimal_double (arg, (int)precision - exponent + 1); if (digits2 == NULL) { free (digits); goto out_of_memory; } if (strlen (digits2) == precision + 1) { free (digits); digits = digits2; exponent -= 1; } else free (digits2); } /* Here ndigits = precision+1. */ *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); while (ndigits > 0) { --ndigits; *p++ = digits[ndigits]; } } free (digits); } *p++ = dp->conversion; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = /* Produce the same number of exponent digits as the native printf implementation. */ # if defined _WIN32 && ! defined __CYGWIN__ { '%', '+', '.', '3', 'd', '\0' }; # else { '%', '+', '.', '2', 'd', '\0' }; # endif SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else { static const char decimal_format[] = /* Produce the same number of exponent digits as the native printf implementation. */ # if defined _WIN32 && ! defined __CYGWIN__ "%+.3d"; # else "%+.2d"; # endif if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, decimal_format, exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, decimal_format, exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } } # endif } else if (dp->conversion == 'g' || dp->conversion == 'G') { if (precision == 0) precision = 1; /* precision >= 1. */ if (arg == 0.0) /* The exponent is 0, >= -4, < precision. Use fixed-point notation. */ { size_t ndigits = precision; /* Number of trailing zeroes that have to be dropped. */ size_t nzeroes = (flags & FLAG_ALT ? 0 : precision - 1); --ndigits; *p++ = '0'; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = '0'; } } } else { /* arg > 0.0. */ int exponent; int adjusted; char *digits; size_t ndigits; size_t nzeroes; exponent = floorlog10 (arg); adjusted = 0; for (;;) { digits = scale10_round_decimal_double (arg, (int)(precision - 1) - exponent); if (digits == NULL) goto out_of_memory; ndigits = strlen (digits); if (ndigits == precision) break; if (ndigits < precision - 1 || ndigits > precision + 1) /* The exponent was not guessed precisely enough. */ abort (); if (adjusted) /* None of two values of exponent is the right one. Prevent an endless loop. */ abort (); free (digits); if (ndigits < precision) exponent -= 1; else exponent += 1; adjusted = 1; } /* Here ndigits = precision. */ if (is_borderline (digits, precision - 1)) { /* Maybe the exponent guess was too high and a smaller exponent can be reached by turning a 10...0 into 9...9x. */ char *digits2 = scale10_round_decimal_double (arg, (int)(precision - 1) - exponent + 1); if (digits2 == NULL) { free (digits); goto out_of_memory; } if (strlen (digits2) == precision) { free (digits); digits = digits2; exponent -= 1; } else free (digits2); } /* Here ndigits = precision. */ /* Determine the number of trailing zeroes that have to be dropped. */ nzeroes = 0; if ((flags & FLAG_ALT) == 0) while (nzeroes < ndigits && digits[nzeroes] == '0') nzeroes++; /* The exponent is now determined. */ if (exponent >= -4 && exponent < (long)precision) { /* Fixed-point notation: max(exponent,0)+1 digits, then the decimal point, then the remaining digits without trailing zeroes. */ if (exponent >= 0) { size_t ecount = exponent + 1; /* Note: ecount <= precision = ndigits. */ for (; ecount > 0; ecount--) *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } } else { size_t ecount = -exponent - 1; *p++ = '0'; *p++ = decimal_point_char (); for (; ecount > 0; ecount--) *p++ = '0'; while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } } else { /* Exponential notation. */ *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = /* Produce the same number of exponent digits as the native printf implementation. */ # if defined _WIN32 && ! defined __CYGWIN__ { '%', '+', '.', '3', 'd', '\0' }; # else { '%', '+', '.', '2', 'd', '\0' }; # endif SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else { static const char decimal_format[] = /* Produce the same number of exponent digits as the native printf implementation. */ # if defined _WIN32 && ! defined __CYGWIN__ "%+.3d"; # else "%+.2d"; # endif if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, decimal_format, exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, decimal_format, exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } } # endif } free (digits); } } else abort (); # else /* arg is finite. */ if (!(arg == 0.0)) abort (); pad_ptr = p; if (dp->conversion == 'f' || dp->conversion == 'F') { *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } } else if (dp->conversion == 'e' || dp->conversion == 'E') { *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } *p++ = dp->conversion; /* 'e' or 'E' */ *p++ = '+'; /* Produce the same number of exponent digits as the native printf implementation. */ # if defined _WIN32 && ! defined __CYGWIN__ *p++ = '0'; # endif *p++ = '0'; *p++ = '0'; } else if (dp->conversion == 'g' || dp->conversion == 'G') { *p++ = '0'; if (flags & FLAG_ALT) { size_t ndigits = (precision > 0 ? precision - 1 : 0); *p++ = decimal_point_char (); for (; ndigits > 0; --ndigits) *p++ = '0'; } } else abort (); # endif } } } # endif /* The generated string now extends from tmp to p, with the zero padding insertion point being at pad_ptr. */ count = p - tmp; if (count < width) { size_t pad = width - count; DCHAR_T *end = p + pad; if (flags & FLAG_LEFT) { /* Pad with spaces on the right. */ for (; pad > 0; pad--) *p++ = ' '; } else if ((flags & FLAG_ZERO) && pad_ptr != NULL) { /* Pad with zeroes. */ DCHAR_T *q = end; while (p > pad_ptr) *--q = *--p; for (; pad > 0; pad--) *p++ = '0'; } else { /* Pad with spaces on the left. */ DCHAR_T *q = end; while (p > tmp) *--q = *--p; for (; pad > 0; pad--) *p++ = ' '; } p = end; } count = p - tmp; if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the code above! */ abort (); /* Make room for the result. */ if (count >= allocated - length) { size_t n = xsum (length, count); ENSURE_ALLOCATION (n); } /* Append the result. */ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); if (tmp != tmpbuf) free (tmp); length += count; } #endif else { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION int has_width; #endif #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION size_t width; #endif #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION int has_precision; size_t precision; #endif #if NEED_PRINTF_UNBOUNDED_PRECISION int prec_ourselves; #else # define prec_ourselves 0 #endif #if NEED_PRINTF_FLAG_LEFTADJUST # define pad_ourselves 1 #elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION int pad_ourselves; #else # define pad_ourselves 0 #endif TCHAR_T *fbp; unsigned int prefix_count; int prefixes[2] IF_LINT (= { 0 }); int orig_errno; #if !USE_SNPRINTF size_t tmp_length; TCHAR_T tmpbuf[700]; TCHAR_T *tmp; #endif #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION has_width = 0; #endif #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; width = -width; } } else { const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION has_width = 1; #endif } #endif #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION has_precision = 0; precision = 6; if (dp->precision_start != dp->precision_end) { if (dp->precision_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->precision_arg_index].a.a_int; /* "A negative precision is taken as if the precision were omitted." */ if (arg >= 0) { precision = arg; has_precision = 1; } } else { const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) precision = xsum (xtimes (precision, 10), *digitp++ - '0'); has_precision = 1; } } #endif /* Decide whether to handle the precision ourselves. */ #if NEED_PRINTF_UNBOUNDED_PRECISION switch (dp->conversion) { case 'd': case 'i': case 'u': case 'o': case 'x': case 'X': case 'p': prec_ourselves = has_precision && (precision > 0); break; default: prec_ourselves = 0; break; } #endif /* Decide whether to perform the padding ourselves. */ #if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION) switch (dp->conversion) { # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need to perform the padding after this conversion. Functions with unistdio extensions perform the padding based on character count rather than element count. */ case 'c': case 's': # endif # if NEED_PRINTF_FLAG_ZERO case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': case 'a': case 'A': # endif pad_ourselves = 1; break; default: pad_ourselves = prec_ourselves; break; } #endif #if !USE_SNPRINTF /* Allocate a temporary buffer of sufficient size for calling sprintf. */ tmp_length = MAX_ROOM_NEEDED (&a, dp->arg_index, dp->conversion, type, flags, width, has_precision, precision, pad_ourselves); if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T)) tmp = tmpbuf; else { size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T)); if (size_overflow_p (tmp_memsize)) /* Overflow, would lead to out of memory. */ goto out_of_memory; tmp = (TCHAR_T *) malloc (tmp_memsize); if (tmp == NULL) /* Out of memory. */ goto out_of_memory; } #endif /* Construct the format string for calling snprintf or sprintf. */ fbp = buf; *fbp++ = '%'; #if NEED_PRINTF_FLAG_GROUPING /* The underlying implementation doesn't support the ' flag. Produce no grouping characters in this case; this is acceptable because the grouping is locale dependent. */ #else if (flags & FLAG_GROUP) *fbp++ = '\''; #endif if (flags & FLAG_LEFT) *fbp++ = '-'; if (flags & FLAG_SHOWSIGN) *fbp++ = '+'; if (flags & FLAG_SPACE) *fbp++ = ' '; if (flags & FLAG_ALT) *fbp++ = '#'; #if __GLIBC__ >= 2 && !defined __UCLIBC__ if (flags & FLAG_LOCALIZED) *fbp++ = 'I'; #endif if (!pad_ourselves) { if (flags & FLAG_ZERO) *fbp++ = '0'; if (dp->width_start != dp->width_end) { size_t n = dp->width_end - dp->width_start; /* The width specification is known to consist only of standard ASCII characters. */ if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) { memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T)); fbp += n; } else { const FCHAR_T *mp = dp->width_start; do *fbp++ = *mp++; while (--n > 0); } } } if (!prec_ourselves) { if (dp->precision_start != dp->precision_end) { size_t n = dp->precision_end - dp->precision_start; /* The precision specification is known to consist only of standard ASCII characters. */ if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) { memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T)); fbp += n; } else { const FCHAR_T *mp = dp->precision_start; do *fbp++ = *mp++; while (--n > 0); } } } switch (type) { case TYPE_LONGLONGINT: case TYPE_ULONGLONGINT: #if defined _WIN32 && ! defined __CYGWIN__ *fbp++ = 'I'; *fbp++ = '6'; *fbp++ = '4'; break; #else *fbp++ = 'l'; #endif FALLTHROUGH; case TYPE_LONGINT: case TYPE_ULONGINT: #if HAVE_WINT_T case TYPE_WIDE_CHAR: #endif #if HAVE_WCHAR_T case TYPE_WIDE_STRING: #endif *fbp++ = 'l'; break; case TYPE_LONGDOUBLE: *fbp++ = 'L'; break; default: break; } #if NEED_PRINTF_DIRECTIVE_F if (dp->conversion == 'F') *fbp = 'f'; else #endif *fbp = dp->conversion; #if USE_SNPRINTF # if ((HAVE_SNPRINTF_RETVAL_C99 && HAVE_SNPRINTF_TRUNCATION_C99) \ || ((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \ && !defined __UCLIBC__) \ || (defined __APPLE__ && defined __MACH__) \ || defined __ANDROID__ \ || (defined _WIN32 && ! defined __CYGWIN__)) /* On systems where we know that snprintf's return value conforms to ISO C 99 (HAVE_SNPRINTF_RETVAL_C99) and that snprintf always produces NUL-terminated strings (HAVE_SNPRINTF_TRUNCATION_C99), it is possible to avoid using %n. And it is desirable to do so, because more and more platforms no longer support %n, for "security reasons". In particular, the following platforms: - On glibc2 systems from 2004-10-18 or newer, the use of %n in format strings in writable memory may crash the program (if compiled with _FORTIFY_SOURCE=2). - On Mac OS X 10.13 or newer, the use of %n in format strings in writable memory by default crashes the program. - On Android, starting on 2018-03-07, the use of %n in format strings produces a fatal error (see <https://android.googlesource.com/platform/bionic/+/41398d03b7e8e0dfb951660ae713e682e9fc0336>). On these platforms, HAVE_SNPRINTF_RETVAL_C99 and HAVE_SNPRINTF_TRUNCATION_C99 are 1. We have listed them explicitly in the condition above, in case of cross- compilation (just to be sure). */ /* On native Windows systems (such as mingw), we can avoid using %n because: - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, snprintf does not write more than the specified number of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes '4', '5', '6' into buf, not '4', '5', '\0'.) - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf allows us to recognize the case of an insufficient buffer size: it returns -1 in this case. On native Windows systems (such as mingw) where the OS is Windows Vista, the use of %n in format strings by default crashes the program. See <https://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-printf-count-output> So we should avoid %n in this situation. */ fbp[1] = '\0'; # else /* AIX <= 5.1, HP-UX, IRIX, OSF/1, Solaris <= 9, BeOS */ fbp[1] = '%'; fbp[2] = 'n'; fbp[3] = '\0'; # endif #else fbp[1] = '\0'; #endif /* Construct the arguments for calling snprintf or sprintf. */ prefix_count = 0; if (!pad_ourselves && dp->width_arg_index != ARG_NONE) { if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int; } if (!prec_ourselves && dp->precision_arg_index != ARG_NONE) { if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int; } #if USE_SNPRINTF /* The SNPRINTF result is appended after result[0..length]. The latter is an array of DCHAR_T; SNPRINTF appends an array of TCHAR_T to it. This is possible because sizeof (TCHAR_T) divides sizeof (DCHAR_T) and alignof (TCHAR_T) <= alignof (DCHAR_T). */ # define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T)) /* Ensure that maxlen below will be >= 2. Needed on BeOS, where an snprintf() with maxlen==1 acts like sprintf(). */ ENSURE_ALLOCATION (xsum (length, (2 + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR)); /* Prepare checking whether snprintf returns the count via %n. */ *(TCHAR_T *) (result + length) = '\0'; #endif orig_errno = errno; for (;;) { int count = -1; #if USE_SNPRINTF int retcount = 0; size_t maxlen = allocated - length; /* SNPRINTF can fail if its second argument is > INT_MAX. */ if (maxlen > INT_MAX / TCHARS_PER_DCHAR) maxlen = INT_MAX / TCHARS_PER_DCHAR; maxlen = maxlen * TCHARS_PER_DCHAR; # define SNPRINTF_BUF(arg) \ switch (prefix_count) \ { \ case 0: \ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ maxlen, buf, \ arg, &count); \ break; \ case 1: \ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ maxlen, buf, \ prefixes[0], arg, &count); \ break; \ case 2: \ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ maxlen, buf, \ prefixes[0], prefixes[1], arg, \ &count); \ break; \ default: \ abort (); \ } #else # define SNPRINTF_BUF(arg) \ switch (prefix_count) \ { \ case 0: \ count = sprintf (tmp, buf, arg); \ break; \ case 1: \ count = sprintf (tmp, buf, prefixes[0], arg); \ break; \ case 2: \ count = sprintf (tmp, buf, prefixes[0], prefixes[1],\ arg); \ break; \ default: \ abort (); \ } #endif errno = 0; switch (type) { case TYPE_SCHAR: { int arg = a.arg[dp->arg_index].a.a_schar; SNPRINTF_BUF (arg); } break; case TYPE_UCHAR: { unsigned int arg = a.arg[dp->arg_index].a.a_uchar; SNPRINTF_BUF (arg); } break; case TYPE_SHORT: { int arg = a.arg[dp->arg_index].a.a_short; SNPRINTF_BUF (arg); } break; case TYPE_USHORT: { unsigned int arg = a.arg[dp->arg_index].a.a_ushort; SNPRINTF_BUF (arg); } break; case TYPE_INT: { int arg = a.arg[dp->arg_index].a.a_int; SNPRINTF_BUF (arg); } break; case TYPE_UINT: { unsigned int arg = a.arg[dp->arg_index].a.a_uint; SNPRINTF_BUF (arg); } break; case TYPE_LONGINT: { long int arg = a.arg[dp->arg_index].a.a_longint; SNPRINTF_BUF (arg); } break; case TYPE_ULONGINT: { unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint; SNPRINTF_BUF (arg); } break; case TYPE_LONGLONGINT: { long long int arg = a.arg[dp->arg_index].a.a_longlongint; SNPRINTF_BUF (arg); } break; case TYPE_ULONGLONGINT: { unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint; SNPRINTF_BUF (arg); } break; case TYPE_DOUBLE: { double arg = a.arg[dp->arg_index].a.a_double; SNPRINTF_BUF (arg); } break; case TYPE_LONGDOUBLE: { long double arg = a.arg[dp->arg_index].a.a_longdouble; SNPRINTF_BUF (arg); } break; case TYPE_CHAR: { int arg = a.arg[dp->arg_index].a.a_char; SNPRINTF_BUF (arg); } break; #if HAVE_WINT_T case TYPE_WIDE_CHAR: { wint_t arg = a.arg[dp->arg_index].a.a_wide_char; SNPRINTF_BUF (arg); } break; #endif case TYPE_STRING: { const char *arg = a.arg[dp->arg_index].a.a_string; SNPRINTF_BUF (arg); } break; #if HAVE_WCHAR_T case TYPE_WIDE_STRING: { const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; SNPRINTF_BUF (arg); } break; #endif case TYPE_POINTER: { void *arg = a.arg[dp->arg_index].a.a_pointer; SNPRINTF_BUF (arg); } break; default: abort (); } #if USE_SNPRINTF /* Portability: Not all implementations of snprintf() are ISO C 99 compliant. Determine the number of bytes that snprintf() has produced or would have produced. */ if (count >= 0) { /* Verify that snprintf() has NUL-terminated its result. */ if ((unsigned int) count < maxlen && ((TCHAR_T *) (result + length)) [count] != '\0') abort (); /* Portability hack. */ if (retcount > count) count = retcount; } else { /* snprintf() doesn't understand the '%n' directive. */ if (fbp[1] != '\0') { /* Don't use the '%n' directive; instead, look at the snprintf() return value. */ fbp[1] = '\0'; continue; } else { /* Look at the snprintf() return value. */ if (retcount < 0) { # if !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF /* HP-UX 10.20 snprintf() is doubly deficient: It doesn't understand the '%n' directive, *and* it returns -1 (rather than the length that would have been required) when the buffer is too small. But a failure at this point can also come from other reasons than a too small buffer, such as an invalid wide string argument to the %ls directive, or possibly an invalid floating-point argument. */ size_t tmp_length = MAX_ROOM_NEEDED (&a, dp->arg_index, dp->conversion, type, flags, width, has_precision, precision, pad_ourselves); if (maxlen < tmp_length) { /* Make more room. But try to do through this reallocation only once. */ size_t bigger_need = xsum (length, xsum (tmp_length, TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR); /* And always grow proportionally. (There may be several arguments, each needing a little more room than the previous one.) */ size_t bigger_need2 = xsum (xtimes (allocated, 2), 12); if (bigger_need < bigger_need2) bigger_need = bigger_need2; ENSURE_ALLOCATION (bigger_need); continue; } # endif } else count = retcount; } } #endif /* Attempt to handle failure. */ if (count < 0) { /* SNPRINTF or sprintf failed. Use the errno that it has set, if any. */ if (errno == 0) { if (dp->conversion == 'c' || dp->conversion == 's') errno = EILSEQ; else errno = EINVAL; } if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); return NULL; } #if USE_SNPRINTF /* Handle overflow of the allocated buffer. If such an overflow occurs, a C99 compliant snprintf() returns a count >= maxlen. However, a non-compliant snprintf() function returns only count = maxlen - 1. To cover both cases, test whether count >= maxlen - 1. */ if ((unsigned int) count + 1 >= maxlen) { /* If maxlen already has attained its allowed maximum, allocating more memory will not increase maxlen. Instead of looping, bail out. */ if (maxlen == INT_MAX / TCHARS_PER_DCHAR) goto overflow; else { /* Need at least (count + 1) * sizeof (TCHAR_T) bytes. (The +1 is for the trailing NUL.) But ask for (count + 2) * sizeof (TCHAR_T) bytes, so that in the next round, we likely get maxlen > (unsigned int) count + 1 and so we don't get here again. And allocate proportionally, to avoid looping eternally if snprintf() reports a too small count. */ size_t n = xmax (xsum (length, ((unsigned int) count + 2 + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR), xtimes (allocated, 2)); ENSURE_ALLOCATION (n); continue; } } #endif #if NEED_PRINTF_UNBOUNDED_PRECISION if (prec_ourselves) { /* Handle the precision. */ TCHAR_T *prec_ptr = # if USE_SNPRINTF (TCHAR_T *) (result + length); # else tmp; # endif size_t prefix_count; size_t move; prefix_count = 0; /* Put the additional zeroes after the sign. */ if (count >= 1 && (*prec_ptr == '-' || *prec_ptr == '+' || *prec_ptr == ' ')) prefix_count = 1; /* Put the additional zeroes after the 0x prefix if (flags & FLAG_ALT) || (dp->conversion == 'p'). */ else if (count >= 2 && prec_ptr[0] == '0' && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) prefix_count = 2; move = count - prefix_count; if (precision > move) { /* Insert zeroes. */ size_t insert = precision - move; TCHAR_T *prec_end; # if USE_SNPRINTF size_t n = xsum (length, (count + insert + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR); length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; ENSURE_ALLOCATION (n); length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; prec_ptr = (TCHAR_T *) (result + length); # endif prec_end = prec_ptr + count; prec_ptr += prefix_count; while (prec_end > prec_ptr) { prec_end--; prec_end[insert] = prec_end[0]; } prec_end += insert; do *--prec_end = '0'; while (prec_end > prec_ptr); count += insert; } } #endif #if !USE_SNPRINTF if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the code above! */ abort (); #endif #if !DCHAR_IS_TCHAR /* Convert from TCHAR_T[] to DCHAR_T[]. */ if (dp->conversion == 'c' || dp->conversion == 's') { /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING TYPE_WIDE_STRING. The result string is not certainly ASCII. */ const TCHAR_T *tmpsrc; DCHAR_T *tmpdst; size_t tmpdst_len; /* This code assumes that TCHAR_T is 'char'. */ verify (sizeof (TCHAR_T) == 1); # if USE_SNPRINTF tmpsrc = (TCHAR_T *) (result + length); # else tmpsrc = tmp; # endif tmpdst = DCHAR_CONV_FROM_ENCODING (locale_charset (), iconveh_question_mark, tmpsrc, count, NULL, NULL, &tmpdst_len); if (tmpdst == NULL) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); return NULL; } ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), { free (tmpdst); goto out_of_memory; }); DCHAR_CPY (result + length, tmpdst, tmpdst_len); free (tmpdst); count = tmpdst_len; } else { /* The result string is ASCII. Simple 1:1 conversion. */ # if USE_SNPRINTF /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a no-op conversion, in-place on the array starting at (result + length). */ if (sizeof (DCHAR_T) != sizeof (TCHAR_T)) # endif { const TCHAR_T *tmpsrc; DCHAR_T *tmpdst; size_t n; # if USE_SNPRINTF if (result == resultbuf) { tmpsrc = (TCHAR_T *) (result + length); /* ENSURE_ALLOCATION will not move tmpsrc (because it's part of resultbuf). */ ENSURE_ALLOCATION (xsum (length, count)); } else { /* ENSURE_ALLOCATION will move the array (because it uses realloc(). */ ENSURE_ALLOCATION (xsum (length, count)); tmpsrc = (TCHAR_T *) (result + length); } # else tmpsrc = tmp; ENSURE_ALLOCATION (xsum (length, count)); # endif tmpdst = result + length; /* Copy backwards, because of overlapping. */ tmpsrc += count; tmpdst += count; for (n = count; n > 0; n--) *--tmpdst = *--tmpsrc; } } #endif #if DCHAR_IS_TCHAR && !USE_SNPRINTF /* Make room for the result. */ if (count > allocated - length) { /* Need at least count elements. But allocate proportionally. */ size_t n = xmax (xsum (length, count), xtimes (allocated, 2)); ENSURE_ALLOCATION (n); } #endif /* Here count <= allocated - length. */ /* Perform padding. */ #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION if (pad_ourselves && has_width) { size_t w; # if ENABLE_UNISTDIO /* Outside POSIX, it's preferable to compare the width against the number of _characters_ of the converted value. */ w = DCHAR_MBSNLEN (result + length, count); # else /* The width is compared against the number of _bytes_ of the converted value, says POSIX. */ w = count; # endif if (w < width) { size_t pad = width - w; /* Make room for the result. */ if (xsum (count, pad) > allocated - length) { /* Need at least count + pad elements. But allocate proportionally. */ size_t n = xmax (xsum3 (length, count, pad), xtimes (allocated, 2)); # if USE_SNPRINTF length += count; ENSURE_ALLOCATION (n); length -= count; # else ENSURE_ALLOCATION (n); # endif } /* Here count + pad <= allocated - length. */ { # if !DCHAR_IS_TCHAR || USE_SNPRINTF DCHAR_T * const rp = result + length; # else DCHAR_T * const rp = tmp; # endif DCHAR_T *p = rp + count; DCHAR_T *end = p + pad; DCHAR_T *pad_ptr; # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO if (dp->conversion == 'c' || dp->conversion == 's') /* No zero-padding for string directives. */ pad_ptr = NULL; else # endif { pad_ptr = (*rp == '-' ? rp + 1 : rp); /* No zero-padding of "inf" and "nan". */ if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z') || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) pad_ptr = NULL; } /* The generated string now extends from rp to p, with the zero padding insertion point being at pad_ptr. */ count = count + pad; /* = end - rp */ if (flags & FLAG_LEFT) { /* Pad with spaces on the right. */ for (; pad > 0; pad--) *p++ = ' '; } else if ((flags & FLAG_ZERO) && pad_ptr != NULL) { /* Pad with zeroes. */ DCHAR_T *q = end; while (p > pad_ptr) *--q = *--p; for (; pad > 0; pad--) *p++ = '0'; } else { /* Pad with spaces on the left. */ DCHAR_T *q = end; while (p > rp) *--q = *--p; for (; pad > 0; pad--) *p++ = ' '; } } } } #endif /* Here still count <= allocated - length. */ #if !DCHAR_IS_TCHAR || USE_SNPRINTF /* The snprintf() result did fit. */ #else /* Append the sprintf() result. */ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); #endif #if !USE_SNPRINTF if (tmp != tmpbuf) free (tmp); #endif #if NEED_PRINTF_DIRECTIVE_F if (dp->conversion == 'F') { /* Convert the %f result to upper case for %F. */ DCHAR_T *rp = result + length; size_t rc; for (rc = count; rc > 0; rc--, rp++) if (*rp >= 'a' && *rp <= 'z') *rp = *rp - 'a' + 'A'; } #endif length += count; break; } errno = orig_errno; #undef pad_ourselves #undef prec_ourselves } } } /* Add the final NUL. */ ENSURE_ALLOCATION (xsum (length, 1)); result[length] = '\0'; if (result != resultbuf && length + 1 < allocated) { /* Shrink the allocated memory if possible. */ DCHAR_T *memory; memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T)); if (memory != NULL) result = memory; } if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); *lengthp = length; /* Note that we can produce a big string of a length > INT_MAX. POSIX says that snprintf() fails with errno = EOVERFLOW in this case, but that's only because snprintf() returns an 'int'. This function does not have this limitation. */ return result; #if USE_SNPRINTF overflow: if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EOVERFLOW; return NULL; #endif out_of_memory: if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); out_of_memory_1: CLEANUP (); errno = ENOMEM; return NULL; } } #undef MAX_ROOM_NEEDED #undef TCHARS_PER_DCHAR #undef SNPRINTF #undef USE_SNPRINTF #undef DCHAR_SET #undef DCHAR_CPY #undef PRINTF_PARSE #undef DIRECTIVES #undef DIRECTIVE #undef DCHAR_IS_TCHAR #undef TCHAR_T #undef DCHAR_T #undef FCHAR_T #undef VASNPRINTF ���������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sys_time.c���������������������������������������������������0000664�0001750�0001750�00000002150�14670377436�022046� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <sys/time.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <sys/time.h> /* Check that the 'struct timeval' type is defined. */ struct timeval a; /* Check that a.tv_sec is wide enough to hold a time_t, ignoring signedness issues. */ typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1]; int main (void) { return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-setlocale_null-mt-all.c��������������������������������������0000664�0001750�0001750�00000007775�14670377436�024425� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Multithread-safety test for setlocale_null_r (LC_ALL, ...). Copyright (C) 2019-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2019. */ #include <config.h> /* Work around GCC bug 44511. */ #if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) # pragma GCC diagnostic ignored "-Wreturn-type" #endif #if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS /* Specification. */ #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "glthread/thread.h" /* We want to use the system's setlocale() function here, not the gnulib override. */ #undef setlocale /* Some common locale names. */ #if defined _WIN32 && !defined __CYGWIN__ # define ENGLISH "English_United States" # define GERMAN "German_Germany" # define FRENCH "French_France" # define ENCODING ".1252" #else # define ENGLISH "en_US" # define GERMAN "de_DE" # define FRENCH "fr_FR" # if defined __sgi # define ENCODING ".ISO8859-15" # elif defined __hpux # define ENCODING ".utf8" # else # define ENCODING ".UTF-8" # endif #endif static const char LOCALE1[] = ENGLISH ENCODING; static const char LOCALE2[] = GERMAN ENCODING; static const char LOCALE3[] = FRENCH ENCODING; static char *expected; static void * thread1_func (void *arg) { for (;;) { char buf[SETLOCALE_NULL_ALL_MAX]; if (setlocale_null_r (LC_ALL, buf, sizeof (buf))) abort (); if (strcmp (expected, buf) != 0) { fprintf (stderr, "thread1 disturbed by thread2!\n"); fflush (stderr); abort (); } } /*NOTREACHED*/ } static void * thread2_func (void *arg) { for (;;) { char buf[SETLOCALE_NULL_ALL_MAX]; setlocale_null_r (LC_NUMERIC, buf, sizeof (buf)); setlocale_null_r (LC_ALL, buf, sizeof (buf)); } /*NOTREACHED*/ } int main (int argc, char *argv[]) { if (setlocale (LC_ALL, LOCALE1) == NULL) { fprintf (stderr, "Skipping test: LOCALE1 not recognized\n"); return 77; } if (setlocale (LC_NUMERIC, LOCALE2) == NULL) { fprintf (stderr, "Skipping test: LOCALE2 not recognized\n"); return 77; } if (setlocale (LC_TIME, LOCALE3) == NULL) { fprintf (stderr, "Skipping test: LOCALE3 not recognized\n"); return 77; } expected = strdup (setlocale (LC_ALL, NULL)); /* Create the two threads. */ gl_thread_create (thread1_func, NULL); gl_thread_create (thread2_func, NULL); /* Let them run for 5 seconds. */ { struct timespec duration; duration.tv_sec = 5; duration.tv_nsec = 0; nanosleep (&duration, NULL); } return 0; } #else /* No multithreading available. */ #include <stdio.h> int main () { fputs ("Skipping test: multithreading not enabled\n", stderr); return 77; } #endif /* Without locking, the results of this test would be: glibc OK musl libc crash < 10 sec macOS crash < 1 sec FreeBSD crash < 1 sec NetBSD crash < 2 sec OpenBSD crash < 1 sec AIX crash < 2 sec HP-UX OK IRIX OK Solaris 10 OK Solaris 11.0 OK Solaris 11.4 OK Solaris OpenIndiana OK Haiku crash < 1 sec Cygwin crash < 1 sec mingw OK MSVC OK (assuming compiler option /MD !) */ ���kbuild-3608/src/grep/gnulib-tests/test-realloc-gnu.c������������������������������������������������0000664�0001750�0001750�00000002677�14670377436�022440� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of realloc function. Copyright (C) 2010-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include <stdlib.h> #include <errno.h> #include <stdint.h> #include "macros.h" int main (int argc, char **argv) { /* Check that realloc (NULL, 0) is not a NULL pointer. */ void *volatile p = realloc (NULL, 0); ASSERT (p != NULL); /* Check that realloc (p, n) fails when p is non-null and n exceeds PTRDIFF_MAX. */ if (PTRDIFF_MAX < SIZE_MAX) { size_t one = argc != 12345; p = realloc (p, PTRDIFF_MAX + one); ASSERT (p == NULL); /* Avoid a test failure due to glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=27870>. */ if (!getenv ("MALLOC_CHECK_")) ASSERT (errno == ENOMEM); } free (p); return 0; } �����������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-exclude5.sh��������������������������������������������������0000775�0001750�0001750�00000002431�14670377436�022125� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test suite for exclude. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . fail=0 # Test FNM_LEADING_DIR cat > in <<EOT foo* bar Baz EOT cat > expected <<EOT bar: 1 bar/qux: 1 barz: 0 foo/bar: 1 EOT ${CHECKER} test-exclude -leading_dir in -- bar bar/qux barz foo/bar > out || exit $? # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac # normalize output LC_ALL=C tr -d "$cr" < out > k && mv k out compare expected out || fail=1 Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-lstat.c������������������������������������������������������0000664�0001750�0001750�00000003406�14670377436�021346� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of lstat() function. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson, 2008; and Eric Blake, 2009. */ #include <config.h> #include <sys/stat.h> /* Caution: lstat may be a function-like macro. Although this signature check must pass, it may be the signature of the real (and broken) lstat rather than rpl_lstat. Most code should not use the address of lstat. */ #include "signature.h" SIGNATURE_CHECK (lstat, int, (char const *, struct stat *)); #include <fcntl.h> #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "same-inode.h" #include "ignore-value.h" #include "macros.h" #define BASE "test-lstat.t" #include "test-lstat.h" /* Wrapper around lstat, which works even if lstat is a function-like macro, where test_lstat_func(lstat) would do the wrong thing. */ static int do_lstat (char const *name, struct stat *st) { return lstat (name, st); } int main (void) { /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); return test_lstat_func (do_lstat, true); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/xstrtol-error.c���������������������������������������������������0000664�0001750�0001750�00000005377�14670377437�022122� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* A more useful interface to strtol. Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include "xstrtol-error.h" #include <stdlib.h> #include "error.h" #include "exitfail.h" #include "gettext.h" #define N_(msgid) msgid /* Report an error for an invalid integer in an option argument. ERR is the error code returned by one of the xstrto* functions. Use OPT_IDX to decide whether to print the short option string "C" or "-C" or a long option string derived from LONG_OPTION. OPT_IDX is -2 if the short option "C" was used, without any leading "-"; it is -1 if the short option "-C" was used; otherwise it is an index into LONG_OPTIONS, which should have a name preceded by two '-' characters. ARG is the option-argument containing the integer. After reporting an error, exit with status EXIT_STATUS if it is nonzero. */ static void xstrtol_error (enum strtol_error err, int opt_idx, char c, struct option const *long_options, char const *arg, int exit_status) { char const *hyphens = "--"; char const *msgid; char const *option; char option_buffer[2]; switch (err) { default: abort (); case LONGINT_INVALID: msgid = N_("invalid %s%s argument '%s'"); break; case LONGINT_INVALID_SUFFIX_CHAR: case LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW: msgid = N_("invalid suffix in %s%s argument '%s'"); break; case LONGINT_OVERFLOW: msgid = N_("%s%s argument '%s' too large"); break; } if (opt_idx < 0) { hyphens -= opt_idx; option_buffer[0] = c; option_buffer[1] = '\0'; option = option_buffer; } else option = long_options[opt_idx].name; error (exit_status, 0, gettext (msgid), hyphens, option, arg); } /* Like xstrtol_error, except exit with a failure status. */ void xstrtol_fatal (enum strtol_error err, int opt_idx, char c, struct option const *long_options, char const *arg) { xstrtol_error (err, opt_idx, c, long_options, arg, exit_failure); abort (); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbscasecmp.c�������������������������������������������������0000664�0001750�0001750�00000003462�14670377436�022336� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of case-insensitive string comparison function. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <string.h> #include <locale.h> #include "macros.h" int main () { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; ASSERT (mbscasecmp ("paragraph", "Paragraph") == 0); ASSERT (mbscasecmp ("paragrapH", "parAgRaph") == 0); ASSERT (mbscasecmp ("paragraph", "paraLyzed") < 0); ASSERT (mbscasecmp ("paraLyzed", "paragraph") > 0); ASSERT (mbscasecmp ("para", "paragraph") < 0); ASSERT (mbscasecmp ("paragraph", "para") > 0); /* The following tests shows how mbscasecmp() is different from strcasecmp(). */ ASSERT (mbscasecmp ("\303\266zg\303\274r", "\303\226ZG\303\234R") == 0); /* özgür */ ASSERT (mbscasecmp ("\303\226ZG\303\234R", "\303\266zg\303\274r") == 0); /* özgür */ /* This test shows how strings of different size can compare equal. */ ASSERT (mbscasecmp ("turkish", "TURK\304\260SH") == 0); ASSERT (mbscasecmp ("TURK\304\260SH", "turkish") == 0); return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-string.c�����������������������������������������������������0000664�0001750�0001750�00000002010�14670377436�021513� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <string.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <string.h> #include "verify.h" /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); int main (void) { return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-signal-h.c���������������������������������������������������0000664�0001750�0001750�00000004753�14670377436�021727� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <signal.h> substitute. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <signal.h> /* Check for required types. */ struct { size_t a; uid_t b; volatile sig_atomic_t c; sigset_t d; pid_t e; #if 0 /* Not guaranteed by gnulib. */ pthread_t f; struct timespec g; #endif } s; /* Check that NSIG is defined. */ int nsig = NSIG; int main (void) { switch (0) { /* The following are guaranteed by C. */ case 0: case SIGABRT: case SIGFPE: case SIGILL: case SIGINT: case SIGSEGV: case SIGTERM: /* The following is guaranteed by gnulib. */ #if GNULIB_SIGPIPE || defined SIGPIPE case SIGPIPE: #endif /* Ensure no conflict with other standardized names. */ #ifdef SIGALRM case SIGALRM: #endif /* On Haiku, SIGBUS is mistakenly equal to SIGSEGV. */ #if defined SIGBUS && SIGBUS != SIGSEGV case SIGBUS: #endif #ifdef SIGCHLD case SIGCHLD: #endif #ifdef SIGCONT case SIGCONT: #endif #ifdef SIGHUP case SIGHUP: #endif #ifdef SIGKILL case SIGKILL: #endif #ifdef SIGQUIT case SIGQUIT: #endif #ifdef SIGSTOP case SIGSTOP: #endif #ifdef SIGTSTP case SIGTSTP: #endif #ifdef SIGTTIN case SIGTTIN: #endif #ifdef SIGTTOU case SIGTTOU: #endif #ifdef SIGUSR1 case SIGUSR1: #endif #ifdef SIGUSR2 case SIGUSR2: #endif #ifdef SIGSYS case SIGSYS: #endif #ifdef SIGTRAP case SIGTRAP: #endif #ifdef SIGURG case SIGURG: #endif #ifdef SIGVTALRM case SIGVTALRM: #endif #ifdef SIGXCPU case SIGXCPU: #endif #ifdef SIGXFSZ case SIGXFSZ: #endif /* SIGRTMIN and SIGRTMAX need not be compile-time constants. */ #if 0 # ifdef SIGRTMIN case SIGRTMIN: # endif # ifdef SIGRTMAX case SIGRTMAX: # endif #endif ; } return s.a + s.b + s.c + s.e; } ���������������������kbuild-3608/src/grep/gnulib-tests/test-localeconv.c�������������������������������������������������0000664�0001750�0001750�00000004502�14670377436�022342� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of localeconv() function. Copyright (C) 2012-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2012. */ #include <config.h> #include <locale.h> #include "signature.h" SIGNATURE_CHECK (localeconv, struct lconv *, (void)); #include <limits.h> #include <string.h> #include "macros.h" int main () { /* Test localeconv() result in the "C" locale. */ { struct lconv *l = localeconv (); ASSERT (STREQ (l->decimal_point, ".")); ASSERT (STREQ (l->thousands_sep, "")); #if !((defined __FreeBSD__ || defined __DragonFly__) || defined __sun || defined __CYGWIN__) ASSERT (STREQ (l->grouping, "")); #endif ASSERT (STREQ (l->mon_decimal_point, "")); ASSERT (STREQ (l->mon_thousands_sep, "")); #if !((defined __FreeBSD__ || defined __DragonFly__) || defined __sun || defined __CYGWIN__) ASSERT (STREQ (l->mon_grouping, "")); #endif ASSERT (STREQ (l->positive_sign, "")); ASSERT (STREQ (l->negative_sign, "")); ASSERT (STREQ (l->currency_symbol, "")); ASSERT (l->frac_digits == CHAR_MAX); ASSERT (l->p_cs_precedes == CHAR_MAX); ASSERT (l->p_sign_posn == CHAR_MAX); ASSERT (l->p_sep_by_space == CHAR_MAX); ASSERT (l->n_cs_precedes == CHAR_MAX); ASSERT (l->n_sign_posn == CHAR_MAX); ASSERT (l->n_sep_by_space == CHAR_MAX); ASSERT (STREQ (l->int_curr_symbol, "")); ASSERT (l->int_frac_digits == CHAR_MAX); ASSERT (l->int_p_cs_precedes == CHAR_MAX); ASSERT (l->int_p_sign_posn == CHAR_MAX); ASSERT (l->int_p_sep_by_space == CHAR_MAX); ASSERT (l->int_n_cs_precedes == CHAR_MAX); ASSERT (l->int_n_sign_posn == CHAR_MAX); ASSERT (l->int_n_sep_by_space == CHAR_MAX); } return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/init.sh�����������������������������������������������������������0000664�0001750�0001750�00000054744�14670377430�020402� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# source this file; set up for tests # Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. # Using this file in a test # ========================= # # The typical skeleton of a test looks like this: # # #!/bin/sh # . "${srcdir=.}/init.sh"; path_prepend_ . # Execute some commands. # Note that these commands are executed in a subdirectory, therefore you # need to prepend "../" to relative filenames in the build directory. # Note that the "path_prepend_ ." is useful only if the body of your # test invokes programs residing in the initial directory. # For example, if the programs you want to test are in src/, and this test # script is named tests/test-1, then you would use "path_prepend_ ../src", # or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" # to all tests via automake's TESTS_ENVIRONMENT. # Set the exit code 0 for success, 77 for skipped, or 1 or other for failure. # Use the skip_ and fail_ functions to print a diagnostic and then exit # with the corresponding exit code. # Exit $? # Executing a test that uses this file # ==================================== # # Running a single test: # $ make check TESTS=test-foo.sh # # Running a single test, with verbose output: # $ make check TESTS=test-foo.sh VERBOSE=yes # # Running a single test, keeping the temporary directory: # $ make check TESTS=test-foo.sh KEEP=yes # # Running a single test, with single-stepping: # 1. Go into a sub-shell: # $ bash # 2. Set relevant environment variables from TESTS_ENVIRONMENT in the # Makefile: # $ export srcdir=../../tests # this is an example # 3. Execute the commands from the test, copy&pasting them one by one: # $ . "$srcdir/init.sh"; path_prepend_ . # ... # 4. Finally # $ exit # ============================================================================= # Elementary diagnostics ME_=`expr "./$0" : '.*/\(.*\)$'` # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi # We use a trap below for cleanup. This requires us to go through # hoops to get the right exit status transported through the handler. # So use 'Exit STATUS' instead of 'exit STATUS' inside of the tests. # Turn off errexit here so that we don't trip the bug with OSF1/Tru64 # sh inside this function. Exit () { set +e; (exit $1); exit $1; } # Print warnings (e.g., about skipped and failed tests) to this file number. # Override by defining to say, 9, in init.cfg, and putting say, # export ...ENVVAR_SETTINGS...; $(SHELL) 9>&2 # in the definition of TESTS_ENVIRONMENT in your tests/Makefile.am file. # This is useful when using automake's parallel tests mode, to print # the reason for skip/failure to console, rather than to the .log files. : ${stderr_fileno_=2} # Note that correct expansion of "$*" depends on IFS starting with ' '. # Always write the full diagnostic to stderr. # When stderr_fileno_ is not 2, also emit the first line of the # diagnostic to that file descriptor. warn_ () { # If IFS does not start with ' ', set it and emit the warning in a subshell. case $IFS in ' '*) printf '%s\n' "$*" >&2 test $stderr_fileno_ = 2 \ || { printf '%s\n' "$*" | sed 1q >&$stderr_fileno_ ; } ;; *) (IFS=' '; warn_ "$@");; esac } fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; } skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; } fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; } framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; } # ============================================================================= # Ensure the shell supports modern syntax. # Sanitize this shell to POSIX mode, if possible. DUALCASE=1; export DUALCASE if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # We require $(...) support unconditionally. # We require that the printf built-in work correctly regarding octal escapes; # this eliminates /bin/sh on AIX 7.2. # We require non-surprising "local" semantics (this eliminates dash). # This takes the admittedly draconian step of eliminating dash, because the # assignment tab=$(printf '\t') works fine, yet preceding it with "local " # transforms it into an assignment that sets the variable to the empty string. # That is too counter-intuitive, and can lead to subtle run-time malfunction. # The example below is less subtle in that with dash, it evokes the run-time # exception "dash: 1: local: 1: bad variable name". # We require a few additional shell features only when $EXEEXT is nonempty, # in order to support automatic $EXEEXT emulation: # - hyphen-containing alias names # - we prefer to use ${var#...} substitution, rather than having # to work around lack of support for that feature. # The following code attempts to find a shell with support for these features. # If the current shell passes the test, we're done. Otherwise, test other # shells until we find one that passes. If one is found, re-exec it. # If no acceptable shell is found, skip the current test. # # The "...set -x; P=1 true 2>err..." test is to disqualify any shell that # emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do. # # Use "9" to indicate success (rather than 0), in case some shell acts # like Solaris 10's /bin/sh but exits successfully instead of with status 2. # Eval this code in a subshell to determine a shell's suitability. # 10 - passes all tests; ok to use # 9 - ok, but enabling "set -x" corrupts app stderr; prefer higher score # ? - not ok gl_shell_test_script_=' test $(echo y) = y || exit 1 LC_ALL=en_US.UTF-8 printf "\\351" 2>/dev/null \ | LC_ALL=C tr "\\351" x | LC_ALL=C grep "^x$" > /dev/null \ || exit 1 printf "\\351" 2>/dev/null \ | LC_ALL=C tr "\\351" x | LC_ALL=C grep "^x$" > /dev/null \ || exit 1 f_local_() { local v=1; }; f_local_ || exit 1 f_dash_local_fail_() { local t=$(printf " 1"); }; f_dash_local_fail_ score_=10 if test "$VERBOSE" = yes; then test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9 fi test -z "$EXEEXT" && exit $score_ shopt -s expand_aliases alias a-b="echo zoo" v=abx test ${v%x} = ab \ && test ${v#a} = bx \ && test $(a-b) = zoo \ && exit $score_ ' if test "x$1" = "x--no-reexec"; then shift else # Assume a working shell. Export to subshells (setup_ needs this). gl_set_x_corrupts_stderr_=false export gl_set_x_corrupts_stderr_ # Record the first marginally acceptable shell. marginal_= # Search for a shell that meets our requirements. for re_shell_ in __current__ "${CONFIG_SHELL:-no_shell}" \ /bin/sh bash dash zsh pdksh fail do test "$re_shell_" = no_shell && continue # If we've made it all the way to the sentinel, "fail" without # finding even a marginal shell, skip this test. if test "$re_shell_" = fail; then test -z "$marginal_" && skip_ failed to find an adequate shell re_shell_=$marginal_ break fi # When testing the current shell, simply "eval" the test code. # Otherwise, run it via $re_shell_ -c ... if test "$re_shell_" = __current__; then # 'eval'ing this code makes Solaris 10's /bin/sh exit with # $? set to 2. It does not evaluate any of the code after the # "unexpected" first '('. Thus, we must run it in a subshell. ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1 else "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null fi st_=$? # $re_shell_ works just fine. Use it. if test $st_ = 10; then gl_set_x_corrupts_stderr_=false break fi # If this is our first marginally acceptable shell, remember it. if test "$st_:$marginal_" = 9: ; then marginal_="$re_shell_" gl_set_x_corrupts_stderr_=true fi done if test "$re_shell_" != __current__; then # Found a usable shell. Preserve -v and -x. case $- in *v*x* | *x*v*) opts_=-vx ;; *v*) opts_=-v ;; *x*) opts_=-x ;; *) opts_= ;; esac re_shell=$re_shell_ export re_shell exec "$re_shell_" $opts_ "$0" --no-reexec "$@" echo "$ME_: exec failed" 1>&2 exit 127 fi fi # ============================================================================= # Ensure the shell behaves reasonably. # If this is bash, turn off all aliases. test -n "$BASH_VERSION" && unalias -a # Note that when supporting $EXEEXT (transparently mapping from PROG_NAME to # PROG_NAME.exe), we want to support hyphen-containing names like test-acos. # That is part of the shell-selection test above. Why use aliases rather # than functions? Because support for hyphen-containing aliases is more # widespread than that for hyphen-containing function names. test -n "$EXEEXT" && test -n "$BASH_VERSION" && shopt -s expand_aliases # ============================================================================= # Creating a temporary directory (needed by the core test framework) # Create a temporary directory, much like mktemp -d does. # Written by Jim Meyering. # # Usage: mktempd_ /tmp phoey.XXXXXXXXXX # # First, try to use the mktemp program. # Failing that, we'll roll our own mktemp-like function: # - try to get random bytes from /dev/urandom # - failing that, generate output from a combination of quickly-varying # sources and gzip. Ignore non-varying gzip header, and extract # "random" bits from there. # - given those bits, map to file-name bytes using tr, and try to create # the desired directory. # - make only $MAX_TRIES_ attempts # Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. rand_bytes_ () { n_=$1 # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first? # But if they have openssl, they probably have mktemp, too. chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 dev_rand_=/dev/urandom if test -r "$dev_rand_"; then # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194. dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \ | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ return fi n_plus_50_=`expr $n_ + 50` cmds_='date; date +%N; free; who -a; w; ps auxww; ps -ef' data_=` (eval "$cmds_") 2>&1 | gzip ` # Ensure that $data_ has length at least 50+$n_ while :; do len_=`echo "$data_"|wc -c` test $n_plus_50_ -le $len_ && break; data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip ` done echo "$data_" \ | dd bs=1 skip=50 count=$n_ 2>/dev/null \ | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ } mktempd_ () { case $# in 2);; *) fail_ "Usage: mktempd_ DIR TEMPLATE";; esac destdir_=$1 template_=$2 MAX_TRIES_=4 # Disallow any trailing slash on specified destdir: # it would subvert the post-mktemp "case"-based destdir test. case $destdir_ in / | //) destdir_slash_=$destdir;; */) fail_ "invalid destination dir: remove trailing slash(es)";; *) destdir_slash_=$destdir_/;; esac case $template_ in *XXXX) ;; *) fail_ \ "invalid template: $template_ (must have a suffix of at least 4 X's)";; esac # First, try to use mktemp. d=`unset TMPDIR; { mktemp -d -t -p "$destdir_" "$template_"; } 2>/dev/null` && # The resulting name must be in the specified directory. case $d in "$destdir_slash_"*) :;; *) false;; esac && # It must have created the directory. test -d "$d" && # It must have 0700 permissions. Handle sticky "S" bits. perms=`ls -dgo "$d" 2>/dev/null` && case $perms in drwx--[-S]---*) :;; *) false;; esac && { echo "$d" return } # If we reach this point, we'll have to create a directory manually. # Get a copy of the template without its suffix of X's. base_template_=`echo "$template_"|sed 's/XX*$//'` # Calculate how many X's we've just removed. template_length_=`echo "$template_" | wc -c` nx_=`echo "$base_template_" | wc -c` nx_=`expr $template_length_ - $nx_` err_= i_=1 while :; do X_=`rand_bytes_ $nx_` candidate_dir_="$destdir_slash_$base_template_$X_" err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \ && { echo "$candidate_dir_"; return; } test $MAX_TRIES_ -le $i_ && break; i_=`expr $i_ + 1` done fail_ "$err_" } # ============================================================================= # Core test framework # An arbitrary prefix to help distinguish test directories. testdir_prefix_ () { printf gt; } # Set up the environment for the test to run in. setup_ () { if test "$VERBOSE" = yes; then # Test whether set -x may cause the selected shell to corrupt an # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh # from SunOS 5.11, OpenBSD 4.7 and Irix 6.5. # If enabling verbose output this way would cause trouble, simply # issue a warning and refrain. if $gl_set_x_corrupts_stderr_; then warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr" else set -x fi fi initial_cwd_=$PWD # Create and enter the temporary directory. pfx_=`testdir_prefix_` test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ || fail_ "failed to create temporary directory in $initial_cwd_" cd "$test_dir_" || fail_ "failed to cd to temporary directory" # Set variables srcdir, builddir, for the convenience of the test. case $srcdir in /* | ?:*) ;; *) srcdir="../$srcdir" ;; esac builddir=".." export srcdir builddir # As autoconf-generated configure scripts do, ensure that IFS # is defined initially, so that saving and restoring $IFS works. gl_init_sh_nl_=' ' IFS=" "" $gl_init_sh_nl_" # This trap statement, along with a trap on 0 below, ensure that the # temporary directory, $test_dir_, is removed upon exit as well as # upon receipt of any of the listed signals. for sig_ in 1 2 3 13 15; do eval "trap 'Exit $(expr $sig_ + 128)' $sig_" done } # This is a stub function that is run upon trap (upon regular exit and # interrupt). Override it with a per-test function, e.g., to unmount # a partition, or to undo any other global state changes. cleanup_ () { :; } # Run the user-overridable cleanup_ function, remove the temporary # directory and exit with the incoming value of $?. remove_tmp_ () { __st=$? cleanup_ if test "$KEEP" = yes; then echo "Not removing temporary directory $test_dir_" else # cd out of the directory we're about to remove cd "$initial_cwd_" || cd / || cd /tmp chmod -R u+rwx "$test_dir_" # If removal fails and exit status was to be 0, then change it to 1. rm -rf "$test_dir_" || { test $__st = 0 && __st=1; } fi exit $__st } # ============================================================================= # Prepending directories to PATH # Given a directory name, DIR, if every entry in it that matches *.exe # contains only the specified bytes (see the case stmt below), then print # a space-separated list of those names and return 0. Otherwise, don't # print anything and return 1. Naming constraints apply also to DIR. find_exe_basenames_ () { feb_dir_=$1 feb_fail_=0 feb_result_= feb_sp_= for feb_file_ in $feb_dir_/*.exe; do # If there was no *.exe file, or there existed a file named "*.exe" that # was deleted between the above glob expansion and the existence test # below, just skip it. test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \ && continue # Exempt [.exe, since we can't create a function by that name, yet # we can't invoke [ by PATH search anyways due to shell builtins. test "x$feb_file_" = "x$feb_dir_/[.exe" && continue case $feb_file_ in *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;; *) # Remove leading file name components as well as the .exe suffix. feb_file_=${feb_file_##*/} feb_file_=${feb_file_%.exe} feb_result_="$feb_result_$feb_sp_$feb_file_";; esac feb_sp_=' ' done test $feb_fail_ = 0 && printf %s "$feb_result_" return $feb_fail_ } # Consider the files in directory, $1. # For each file name of the form PROG.exe, create an alias named # PROG that simply invokes PROG.exe, then return 0. If any selected # file name or the directory name, $1, contains an unexpected character, # define no alias and return 1. create_exe_shims_ () { case $EXEEXT in '') return 0 ;; .exe) ;; *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;; esac base_names_=`find_exe_basenames_ $1` \ || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 0; } if test -n "$base_names_"; then for base_ in $base_names_; do alias "$base_"="$base_$EXEEXT" done fi return 0 } # Use this function to prepend to PATH an absolute name for each # specified, possibly-$initial_cwd_-relative, directory. path_prepend_ () { while test $# != 0; do path_dir_=$1 case $path_dir_ in '') fail_ "invalid path dir: '$1'";; /* | ?:*) abs_path_dir_=$path_dir_;; *) abs_path_dir_=$initial_cwd_/$path_dir_;; esac case $abs_path_dir_ in *$PATH_SEPARATOR*) fail_ "invalid path dir: '$abs_path_dir_'";; esac PATH="$abs_path_dir_$PATH_SEPARATOR$PATH" # Create an alias, FOO, for each FOO.exe in this directory. create_exe_shims_ "$abs_path_dir_" \ || fail_ "something failed (above): $abs_path_dir_" shift done export PATH } # ============================================================================= # Convenience environment variables for the tests # ----------------------------------------------------------------------------- # Enable glibc's malloc-perturbing option. # This is useful for exposing code that depends on the fact that # malloc-related functions often return memory that is mostly zeroed. # If you have the time and cycles, use valgrind to do an even better job. : ${MALLOC_PERTURB_=87} export MALLOC_PERTURB_ # ----------------------------------------------------------------------------- # The interpreter for Bourne-shell scripts. # No special standards compatibility requirements. # Some environments, such as Android, don't have /bin/sh. if test -f /bin/sh$EXEEXT; then BOURNE_SHELL=/bin/sh else BOURNE_SHELL=sh fi # ============================================================================= # Convenience functions for the tests # ----------------------------------------------------------------------------- # Return value checking # This is used to simplify checking of the return value # which is useful when ensuring a command fails as desired. # I.e., just doing `command ... &&fail=1` will not catch # a segfault in command for example. With this helper you # instead check an explicit exit code like # returns_ 1 command ... || fail returns_ () { # Disable tracing so it doesn't interfere with stderr of the wrapped command { set +x; } 2>/dev/null local exp_exit="$1" shift "$@" test $? -eq $exp_exit && ret_=0 || ret_=1 if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then set -x fi { return $ret_; } 2>/dev/null } # ----------------------------------------------------------------------------- # Text file comparison # Emit a header similar to that from diff -u; Print the simulated "diff" # command so that the order of arguments is clear. Don't bother with @@ lines. emit_diff_u_header_ () { printf '%s\n' "diff -u $*" \ "--- $1 1970-01-01" \ "+++ $2 1970-01-01" } # Arrange not to let diff or cmp operate on /dev/null, # since on some systems (at least OSF/1 5.1), that doesn't work. # When there are not two arguments, or no argument is /dev/null, return 2. # When one argument is /dev/null and the other is not empty, # cat the nonempty file to stderr and return 1. # Otherwise, return 0. compare_dev_null_ () { test $# = 2 || return 2 if test "x$1" = x/dev/null; then test -s "$2" || return 0 emit_diff_u_header_ "$@"; sed 's/^/+/' "$2" return 1 fi if test "x$2" = x/dev/null; then test -s "$1" || return 0 emit_diff_u_header_ "$@"; sed 's/^/-/' "$1" return 1 fi return 2 } for diff_opt_ in -u -U3 -c '' no; do test "$diff_opt_" != no && diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" < /dev/null` && break done if test "$diff_opt_" != no; then if test -z "$diff_out_"; then compare_ () { diff $diff_opt_ "$@"; } else compare_ () { # If no differences were found, AIX and HP-UX 'diff' produce output # like "No differences encountered". Hide this output. diff $diff_opt_ "$@" > diff.out diff_status_=$? test $diff_status_ -eq 0 || cat diff.out || diff_status_=2 rm -f diff.out || diff_status_=2 return $diff_status_ } fi elif cmp -s /dev/null /dev/null 2>/dev/null; then compare_ () { cmp -s "$@"; } else compare_ () { cmp "$@"; } fi # Usage: compare EXPECTED ACTUAL # # Given compare_dev_null_'s preprocessing, defer to compare_ if 2 or more. # Otherwise, propagate $? to caller: any diffs have already been printed. compare () { # This looks like it can be factored to use a simple "case $?" # after unchecked compare_dev_null_ invocation, but that would # fail in a "set -e" environment. if compare_dev_null_ "$@"; then return 0 else case $? in 1) return 1;; *) compare_ "$@";; esac fi } # ----------------------------------------------------------------------------- # If you want to override the testdir_prefix_ function, # or to add more utility functions, use this file. test -f "$srcdir/init.cfg" \ && . "$srcdir/init.cfg" # ============================================================================= # Set up the environment for the test to run in. setup_ "$@" # This trap is here, rather than in the setup_ function, because some # shells run the exit trap at shell function exit, rather than script exit. trap remove_tmp_ 0 ����������������������������kbuild-3608/src/grep/gnulib-tests/test-vc-list-files-cvs.sh�����������������������������������������0000775�0001750�0001750�00000003257�14670377437�023671� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Unit tests for vc-list-files # Copyright (C) 2008-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. */ : ${srcdir=.} . "$srcdir/init.sh"; path_prepend_ . tmpdir=vc-cvs repo=`pwd`/$tmpdir/repo fail=0 for i in with-cvsu without; do # On the first iteration, test using cvsu, if it's in your path. # On the second iteration, ensure that cvsu fails, so we'll # exercise the awk-using code. if test $i = without; then printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu chmod a+x cvsu PATH=`pwd`:$PATH export PATH fi ok=0 mkdir $tmpdir && cd $tmpdir && # without cvs, skip the test { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \ || skip_ "cvs not found in PATH"; } && mkdir w && cd w && mkdir d && touch d/a b c && cvs -Q -d "$repo" import -m imp m M M0 && cvs -Q -d "$repo" co m && cd m && printf '%s\n' b c d/a > expected && $BOURNE_SHELL "$abs_aux_dir/vc-list-files" | sort > actual && compare expected actual && ok=1 test $ok = 0 && fail=1 done Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-limits-h.c���������������������������������������������������0000664�0001750�0001750�00000010040�14670377436�021735� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <limits.h> substitute. Copyright 2016-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ #include <config.h> #include <limits.h> #include "verify.h" #if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) # pragma GCC diagnostic ignored "-Woverlength-strings" #endif #define verify_width(width, min, max) \ verify ((max) >> ((width) - 1 - ((min) < 0)) == 1) /* Macros borrowed from intprops.h. */ #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) #define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) #define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t)) #define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) -1 \ : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) /* Type width macros. */ int type_bits[] = { CHAR_BIT, WORD_BIT, LONG_BIT }; verify_width (CHAR_BIT, CHAR_MIN, CHAR_MAX); verify_width (WORD_BIT, INT_MIN, INT_MAX); verify_width (LONG_BIT, LONG_MIN, LONG_MAX); /* Numerical limit macros. */ char limits1[] = { CHAR_MIN, CHAR_MAX }; verify (TYPE_MINIMUM (char) == CHAR_MIN); verify (TYPE_MAXIMUM (char) == CHAR_MAX); signed char limits2[] = { SCHAR_MIN, SCHAR_MAX }; verify (TYPE_MINIMUM (signed char) == SCHAR_MIN); verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX); unsigned char limits3[] = { UCHAR_MAX }; verify (TYPE_MINIMUM (unsigned char) == 0); verify (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX); short limits4[] = { SHRT_MIN, SHRT_MAX }; verify (TYPE_MINIMUM (short int) == SHRT_MIN); verify (TYPE_MAXIMUM (short int) == SHRT_MAX); unsigned short limits5[] = { USHRT_MAX }; verify (TYPE_MINIMUM (unsigned short int) == 0); verify (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX); int limits6[] = { INT_MIN, INT_MAX }; verify (TYPE_MINIMUM (int) == INT_MIN); verify (TYPE_MAXIMUM (int) == INT_MAX); unsigned int limits7[] = { UINT_MAX }; verify (TYPE_MINIMUM (unsigned int) == 0); verify (TYPE_MAXIMUM (unsigned int) == UINT_MAX); long limits8[] = { LONG_MIN, LONG_MAX }; verify (TYPE_MINIMUM (long int) == LONG_MIN); verify (TYPE_MAXIMUM (long int) == LONG_MAX); unsigned long limits9[] = { ULONG_MAX }; verify (TYPE_MINIMUM (unsigned long int) == 0); verify (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX); long long limits10[] = { LLONG_MIN, LLONG_MAX }; verify (TYPE_MINIMUM (long long int) == LLONG_MIN); verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); unsigned long long limits11[] = { ULLONG_MAX }; verify (TYPE_MINIMUM (unsigned long long int) == 0); verify (TYPE_MAXIMUM (unsigned long long int) == ULLONG_MAX); /* Macros specified by ISO/IEC TS 18661-1:2014. */ verify_width (CHAR_WIDTH, CHAR_MIN, CHAR_MAX); verify_width (SCHAR_WIDTH, SCHAR_MIN, SCHAR_MAX); verify_width (UCHAR_WIDTH, 0, UCHAR_MAX); verify_width (SHRT_WIDTH, SHRT_MIN, SHRT_MAX); verify_width (USHRT_WIDTH, 0, USHRT_MAX); verify_width (INT_WIDTH, INT_MIN, INT_MAX); verify_width (UINT_WIDTH, 0, UINT_MAX); verify_width (LONG_WIDTH, LONG_MIN, LONG_MAX); verify_width (ULONG_WIDTH, 0, ULONG_MAX); verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX); verify_width (ULLONG_WIDTH, 0, ULLONG_MAX); /* Macros specified by C2x. */ int bool_attrs[] = { BOOL_MAX, BOOL_WIDTH }; verify (BOOL_MAX == (((1U << (BOOL_WIDTH - 1)) - 1) * 2) + 1); int main (void) { return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/nanosleep.c�������������������������������������������������������0000664�0001750�0001750�00000020017�14670377431�021216� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Provide a replacement for the POSIX nanosleep function. Copyright (C) 1999-2000, 2002, 2004-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* written by Jim Meyering and Bruno Haible for the native Windows part */ #include <config.h> #include <time.h> #include "intprops.h" #include "sig-handler.h" #include "verify.h" #include <stdbool.h> #include <stdio.h> #include <sys/types.h> #include <sys/select.h> #include <signal.h> #include <sys/time.h> #include <errno.h> #include <unistd.h> enum { BILLION = 1000 * 1000 * 1000 }; #if HAVE_BUG_BIG_NANOSLEEP int nanosleep (const struct timespec *requested_delay, struct timespec *remaining_delay) # undef nanosleep { /* nanosleep mishandles large sleeps due to internal overflow problems. The worst known case of this is Linux 2.6.9 with glibc 2.3.4, which can't sleep more than 24.85 days (2^31 milliseconds). Similarly, cygwin 1.5.x, which can't sleep more than 49.7 days (2^32 milliseconds). Solve this by breaking the sleep up into smaller chunks. */ if (requested_delay->tv_nsec < 0 || BILLION <= requested_delay->tv_nsec) { errno = EINVAL; return -1; } { /* Verify that time_t is large enough. */ verify (TYPE_MAXIMUM (time_t) / 24 / 24 / 60 / 60); const time_t limit = 24 * 24 * 60 * 60; time_t seconds = requested_delay->tv_sec; struct timespec intermediate; intermediate.tv_nsec = requested_delay->tv_nsec; while (limit < seconds) { int result; intermediate.tv_sec = limit; result = nanosleep (&intermediate, remaining_delay); seconds -= limit; if (result) { if (remaining_delay) remaining_delay->tv_sec += seconds; return result; } intermediate.tv_nsec = 0; } intermediate.tv_sec = seconds; return nanosleep (&intermediate, remaining_delay); } } #elif defined _WIN32 && ! defined __CYGWIN__ /* Native Windows platforms. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> /* The Windows API function Sleep() has a resolution of about 15 ms and takes at least 5 ms to execute. We use this function for longer time periods. Additionally, we use busy-looping over short time periods, to get a resolution of about 0.01 ms. In order to measure such short timespans, we use the QueryPerformanceCounter() function. */ int nanosleep (const struct timespec *requested_delay, struct timespec *remaining_delay) { static bool initialized; /* Number of performance counter increments per nanosecond, or zero if it could not be determined. */ static double ticks_per_nanosecond; if (requested_delay->tv_nsec < 0 || BILLION <= requested_delay->tv_nsec) { errno = EINVAL; return -1; } /* For requested delays of one second or more, 15ms resolution is sufficient. */ if (requested_delay->tv_sec == 0) { if (!initialized) { /* Initialize ticks_per_nanosecond. */ LARGE_INTEGER ticks_per_second; if (QueryPerformanceFrequency (&ticks_per_second)) ticks_per_nanosecond = (double) ticks_per_second.QuadPart / 1000000000.0; initialized = true; } if (ticks_per_nanosecond) { /* QueryPerformanceFrequency worked. We can use QueryPerformanceCounter. Use a combination of Sleep and busy-looping. */ /* Number of milliseconds to pass to the Sleep function. Since Sleep can take up to 8 ms less or 8 ms more than requested (or maybe more if the system is loaded), we subtract 10 ms. */ int sleep_millis = (int) requested_delay->tv_nsec / 1000000 - 10; /* Determine how many ticks to delay. */ LONGLONG wait_ticks = requested_delay->tv_nsec * ticks_per_nanosecond; /* Start. */ LARGE_INTEGER counter_before; if (QueryPerformanceCounter (&counter_before)) { /* Wait until the performance counter has reached this value. We don't need to worry about overflow, because the performance counter is reset at reboot, and with a frequency of 3.6E6 ticks per second 63 bits suffice for over 80000 years. */ LONGLONG wait_until = counter_before.QuadPart + wait_ticks; /* Use Sleep for the longest part. */ if (sleep_millis > 0) Sleep (sleep_millis); /* Busy-loop for the rest. */ for (;;) { LARGE_INTEGER counter_after; if (!QueryPerformanceCounter (&counter_after)) /* QueryPerformanceCounter failed, but succeeded earlier. Should not happen. */ break; if (counter_after.QuadPart >= wait_until) /* The requested time has elapsed. */ break; } goto done; } } } /* Implementation for long delays and as fallback. */ Sleep (requested_delay->tv_sec * 1000 + requested_delay->tv_nsec / 1000000); done: /* Sleep is not interruptible. So there is no remaining delay. */ if (remaining_delay != NULL) { remaining_delay->tv_sec = 0; remaining_delay->tv_nsec = 0; } return 0; } #else /* Unix platforms lacking nanosleep. */ /* Some systems (MSDOS) don't have SIGCONT. Using SIGTERM here turns the signal-handling code below into a no-op on such systems. */ # ifndef SIGCONT # define SIGCONT SIGTERM # endif static sig_atomic_t volatile suspended; /* Handle SIGCONT. */ static _GL_ASYNC_SAFE void sighandler (int sig) { suspended = 1; } /* Suspend execution for at least *TS_DELAY seconds. */ static int my_usleep (const struct timespec *ts_delay) { struct timeval tv_delay; tv_delay.tv_sec = ts_delay->tv_sec; tv_delay.tv_usec = (ts_delay->tv_nsec + 999) / 1000; if (tv_delay.tv_usec == 1000000) { if (tv_delay.tv_sec == TYPE_MAXIMUM (time_t)) tv_delay.tv_usec = 1000000 - 1; /* close enough */ else { tv_delay.tv_sec++; tv_delay.tv_usec = 0; } } return select (0, NULL, NULL, NULL, &tv_delay); } /* Suspend execution for at least *REQUESTED_DELAY seconds. The *REMAINING_DELAY part isn't implemented yet. */ int nanosleep (const struct timespec *requested_delay, struct timespec *remaining_delay) { static bool initialized; if (requested_delay->tv_nsec < 0 || BILLION <= requested_delay->tv_nsec) { errno = EINVAL; return -1; } /* set up sig handler */ if (! initialized) { struct sigaction oldact; sigaction (SIGCONT, NULL, &oldact); if (get_handler (&oldact) != SIG_IGN) { struct sigaction newact; newact.sa_handler = sighandler; sigemptyset (&newact.sa_mask); newact.sa_flags = 0; sigaction (SIGCONT, &newact, NULL); } initialized = true; } suspended = 0; if (my_usleep (requested_delay) == -1) { if (suspended) { /* Calculate time remaining. */ /* FIXME: the code in sleep doesn't use this, so there's no rush to implement it. */ errno = EINTR; } return -1; } /* FIXME: Restore sig handler? */ return 0; } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-malloc-gnu.c�������������������������������������������������0000664�0001750�0001750�00000002365�14670377436�022260� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of malloc function. Copyright (C) 2010-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include <stdlib.h> #include <errno.h> #include <stdint.h> #include "macros.h" int main (int argc, char **argv) { /* Check that malloc (0) is not a NULL pointer. */ void *volatile p = malloc (0); ASSERT (p != NULL); free (p); /* Check that malloc (n) fails when n exceeds PTRDIFF_MAX. */ if (PTRDIFF_MAX < SIZE_MAX) { size_t one = argc != 12345; p = malloc (PTRDIFF_MAX + one); ASSERT (p == NULL); ASSERT (errno == ENOMEM); } return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/windows-tls.h�����������������������������������������������������0000664�0001750�0001750�00000002705�14670377437�021543� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Thread-local storage (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. */ #ifndef _WINDOWS_TLS_H #define _WINDOWS_TLS_H #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include <windows.h> typedef DWORD glwthread_tls_key_t; #ifdef __cplusplus extern "C" { #endif extern int glwthread_tls_key_create (glwthread_tls_key_t *keyp, void (*destructor) (void *)); extern void *glwthread_tls_get (glwthread_tls_key_t key); extern int glwthread_tls_set (glwthread_tls_key_t key, void *value); extern int glwthread_tls_key_delete (glwthread_tls_key_t key); extern void glwthread_tls_process_destructors (void); #define GLWTHREAD_DESTRUCTOR_ITERATIONS 4 #ifdef __cplusplus } #endif #endif /* _WINDOWS_TLS_H */ �����������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-version-etc.c������������������������������������������������0000664�0001750�0001750�00000002024�14670377437�022451� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test suite for version-etc. Copyright (C) 2009-2021 Free Software Foundation, Inc. This file is part of the GNUlib Library. 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include "version-etc.h" #define AUTHORS "Sergey Poznyakoff", "Eric Blake" int main (int argc _GL_UNUSED, char **argv) { version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS, (const char *) NULL); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-stdbool.c����������������������������������������������������0000664�0001750�0001750�00000007327�14670377436�021673� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <stdbool.h> substitute. Copyright (C) 2002-2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ /* Define ADDRESS_CHECK_OKAY if it is OK to assign an address to a 'bool' and this does not generate a warning (because we want this test to succeed even when using gcc's -Werror). */ #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) \ || (__clang_major__ >= 4) /* We can silence the warning. */ # pragma GCC diagnostic ignored "-Waddress" # define ADDRESS_CHECK_OKAY #elif defined __GNUC__ || defined __clang__ /* There may be a warning. */ #else /* Ignore warnings from other compilers. */ # define ADDRESS_CHECK_OKAY #endif #include <config.h> #include <stdbool.h> #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif /* Several tests cannot be guaranteed with gnulib's <stdbool.h>, at least, not for all compilers and compiler options. */ #if HAVE_STDBOOL_H || 3 <= __GNUC__ || 4 <= __clang_major__ struct s { _Bool s: 1; _Bool t; } s; #endif char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; #if HAVE_STDBOOL_H || 3 <= __GNUC__ || 4 <= __clang_major__ /* See above. */ char d[(bool) 0.5 == true ? 1 : -1]; # ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */ /* C99 may plausibly be interpreted as not requiring support for a cast from a variable's address to bool in a static initializer. So treat it like a GCC extension. */ # if defined __GNUC__ || defined __clang__ bool e = &s; # endif # endif char f[(_Bool) 0.0 == false ? 1 : -1]; #endif char g[true]; char h[sizeof (_Bool)]; #if HAVE_STDBOOL_H || 3 <= __GNUC__ || 4 <= __clang_major__ /* See above. */ char i[sizeof s.t]; #endif enum { j = false, k = true, l = false * true, m = true * 256 }; _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { int error = 0; #if HAVE_STDBOOL_H || 3 <= __GNUC_ || 4 <= __clang_major___ /* See above. */ # ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */ /* A cast from a variable's address to bool is valid in expressions. */ { bool e1 = &s; if (!e1) error = 1; } # endif #endif /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 reported by James Lemley on 2005-10-05; see https://lists.gnu.org/r/bug-coreutils/2005-10/msg00086.html This is a runtime test, since a corresponding compile-time test would rely on initializer extensions. */ { char digs[] = "0123456789"; if (&(digs + 5)[-2 + (bool) 1] != &digs[4]) error = 1; } return error; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/windows-tls.c�����������������������������������������������������0000664�0001750�0001750�00000024610�14670377437�021535� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Thread-local storage (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. */ #include <config.h> /* Specification. */ #include "windows-tls.h" #include <errno.h> #include <limits.h> #include <stdlib.h> #include "windows-once.h" void * glwthread_tls_get (glwthread_tls_key_t key) { return TlsGetValue (key); } int glwthread_tls_set (glwthread_tls_key_t key, void *value) { if (!TlsSetValue (key, value)) return EINVAL; return 0; } /* The following variables keep track of TLS keys with non-NULL destructor. */ static glwthread_once_t dtor_table_init_once = GLWTHREAD_ONCE_INIT; static CRITICAL_SECTION dtor_table_lock; struct dtor { glwthread_tls_key_t key; void (*destructor) (void *); }; /* The table of dtors. */ static struct dtor *dtor_table; /* Number of active entries in the dtor_table. */ static unsigned int dtors_count; /* Valid indices into dtor_table are 0..dtors_used-1. */ static unsigned int dtors_used; /* Allocation size of dtor_table. */ static unsigned int dtors_allocated; /* Invariant: 0 <= dtors_count <= dtors_used <= dtors_allocated. */ /* Number of threads that are currently processing destructors. */ static unsigned int dtor_processing_threads; static void dtor_table_initialize (void) { InitializeCriticalSection (&dtor_table_lock); /* The other variables are already initialized to NULL or 0, respectively. */ } static void dtor_table_ensure_initialized (void) { glwthread_once (&dtor_table_init_once, dtor_table_initialize); } /* Shrinks dtors_used down to dtors_count, by replacing inactive entries with active ones. */ static void dtor_table_shrink_used (void) { unsigned int i = 0; unsigned int j = dtors_used; for (;;) { BOOL i_found = FALSE; BOOL j_found = FALSE; /* Find the next inactive entry, from the left. */ for (; i < dtors_count;) { if (dtor_table[i].destructor == NULL) { i_found = TRUE; break; } i++; } /* Find the next active entry, from the right. */ for (; j > dtors_count;) { j--; if (dtor_table[j].destructor != NULL) { j_found = TRUE; break; } } if (i_found != j_found) /* dtors_count was apparently wrong. */ abort (); if (!i_found) break; /* i_found and j_found are TRUE. Swap the two entries. */ dtor_table[i] = dtor_table[j]; i++; } dtors_used = dtors_count; } void glwthread_tls_process_destructors (void) { unsigned int repeat; dtor_table_ensure_initialized (); EnterCriticalSection (&dtor_table_lock); if (dtor_processing_threads == 0) { /* Now it's the appropriate time for shrinking dtors_used. */ if (dtors_used > dtors_count) dtor_table_shrink_used (); } dtor_processing_threads++; for (repeat = GLWTHREAD_DESTRUCTOR_ITERATIONS; repeat > 0; repeat--) { unsigned int destructors_run = 0; /* Iterate across dtor_table. We don't need to make a copy of dtor_table, because * When another thread calls glwthread_tls_key_create with a non-NULL destructor argument, this will possibly reallocate the dtor_table array and increase dtors_allocated as well as dtors_used and dtors_count, but it will not change dtors_used nor the contents of the first dtors_used entries of dtor_table. * When another thread calls glwthread_tls_key_delete, this will possibly set some 'destructor' member to NULL, thus marking an entry as inactive, but it will not otherwise change dtors_used nor the contents of the first dtors_used entries of dtor_table. */ unsigned int i_limit = dtors_used; unsigned int i; for (i = 0; i < i_limit; i++) { struct dtor current = dtor_table[i]; if (current.destructor != NULL) { /* The current dtor has not been deleted yet. */ void *current_value = glwthread_tls_get (current.key); if (current_value != NULL) { /* The current value is non-NULL. Run the destructor. */ glwthread_tls_set (current.key, NULL); LeaveCriticalSection (&dtor_table_lock); current.destructor (current_value); EnterCriticalSection (&dtor_table_lock); destructors_run++; } } } /* When all TLS values were already NULL, no further iterations are needed. */ if (destructors_run == 0) break; } dtor_processing_threads--; LeaveCriticalSection (&dtor_table_lock); } int glwthread_tls_key_create (glwthread_tls_key_t *keyp, void (*destructor) (void *)) { if (destructor != NULL) { dtor_table_ensure_initialized (); EnterCriticalSection (&dtor_table_lock); if (dtor_processing_threads == 0) { /* Now it's the appropriate time for shrinking dtors_used. */ if (dtors_used > dtors_count) dtor_table_shrink_used (); } while (dtors_used == dtors_allocated) { /* Need to grow the dtor_table. */ unsigned int new_allocated = 2 * dtors_allocated + 1; if (new_allocated < 7) new_allocated = 7; if (new_allocated <= dtors_allocated) /* overflow? */ new_allocated = UINT_MAX; LeaveCriticalSection (&dtor_table_lock); { struct dtor *new_table = (struct dtor *) malloc (new_allocated * sizeof (struct dtor)); if (new_table == NULL) return ENOMEM; EnterCriticalSection (&dtor_table_lock); /* Attention! dtors_used, dtors_allocated may have changed! */ if (dtors_used < new_allocated) { if (dtors_allocated < new_allocated) { /* The new_table is useful. */ memcpy (new_table, dtor_table, dtors_used * sizeof (struct dtor)); dtor_table = new_table; dtors_allocated = new_allocated; } else { /* The new_table is not useful, since another thread meanwhile allocated a drop_table that is at least as large. */ free (new_table); } break; } /* The new_table is not useful, since other threads increased dtors_used. Free it any retry. */ free (new_table); } } /* Here dtors_used < dtors_allocated. */ { /* Allocate a new key. */ glwthread_tls_key_t key = TlsAlloc (); if (key == (DWORD)-1) { LeaveCriticalSection (&dtor_table_lock); return EAGAIN; } /* Store the new dtor in the dtor_table, after all used entries. Do not overwrite inactive entries with indices < dtors_used, in order not to disturb glwthread_tls_process_destructors invocations that may be executing in other threads. */ dtor_table[dtors_used].key = key; dtor_table[dtors_used].destructor = destructor; dtors_used++; dtors_count++; LeaveCriticalSection (&dtor_table_lock); *keyp = key; } } else { /* Allocate a new key. */ glwthread_tls_key_t key = TlsAlloc (); if (key == (DWORD)-1) return EAGAIN; *keyp = key; } return 0; } int glwthread_tls_key_delete (glwthread_tls_key_t key) { /* Should the destructor be called for all threads that are currently running? Probably not, because - ISO C does not specify when the destructor is to be invoked at all. - In POSIX, the destructor functions specified with pthread_key_create() are invoked at thread exit. - It would be hard to implement, because there are no primitives for accessing thread-specific values from a different thread. */ dtor_table_ensure_initialized (); EnterCriticalSection (&dtor_table_lock); if (dtor_processing_threads == 0) { /* Now it's the appropriate time for shrinking dtors_used. */ if (dtors_used > dtors_count) dtor_table_shrink_used (); /* Here dtors_used == dtors_count. */ /* Find the key in dtor_table. */ { unsigned int i_limit = dtors_used; unsigned int i; for (i = 0; i < i_limit; i++) if (dtor_table[i].key == key) { if (i < dtors_used - 1) /* Swap the entries i and dtors_used - 1. */ dtor_table[i] = dtor_table[dtors_used - 1]; dtors_count = dtors_used = dtors_used - 1; break; } } } else { /* Be careful not to disturb the glwthread_tls_process_destructors invocations that are executing in other threads. */ unsigned int i_limit = dtors_used; unsigned int i; for (i = 0; i < i_limit; i++) if (dtor_table[i].destructor != NULL /* skip inactive entries */ && dtor_table[i].key == key) { /* Mark this entry as inactive. */ dtor_table[i].destructor = NULL; dtors_count = dtors_count - 1; break; } } LeaveCriticalSection (&dtor_table_lock); /* Now we have ensured that glwthread_tls_process_destructors will no longer use this key. */ if (!TlsFree (key)) return EINVAL; return 0; } ������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-symlink.c����������������������������������������������������0000664�0001750�0001750�00000002423�14670377436�021703� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Tests of symlink. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (symlink, int, (char const *, char const *)); #include <fcntl.h> #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include "ignore-value.h" #include "macros.h" #define BASE "test-symlink.t" #include "test-symlink.h" int main (void) { /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); return test_symlink (symlink, true); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/gnulib.mk���������������������������������������������������������0000664�0001750�0001750�00000213154�14670377436�020712� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file 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 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. # # You should have received a copy of the GNU General Public License # along with this file. If not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that # contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. AUTOMAKE_OPTIONS = 1.11 foreign subdir-objects SUBDIRS = . TESTS = XFAIL_TESTS = TESTS_ENVIRONMENT = noinst_PROGRAMS = check_PROGRAMS = EXTRA_PROGRAMS = noinst_HEADERS = noinst_LIBRARIES = check_LIBRARIES = libtests.a EXTRA_DIST = BUILT_SOURCES = SUFFIXES = MOSTLYCLEANFILES = core *.stackdump MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = CFLAGS = @GL_CFLAG_ALLOW_WARNINGS@ @CFLAGS@ CXXFLAGS = @GL_CXXFLAG_ALLOW_WARNINGS@ @CXXFLAGS@ AM_CPPFLAGS = \ -D@gltests_WITNESS@=1 \ -I. -I$(srcdir) \ -I.. -I$(srcdir)/.. \ -I../lib -I$(srcdir)/../lib LDADD = libtests.a ../lib/libgreputils.a libtests.a ../lib/libgreputils.a libtests.a $(LIBTESTS_LIBDEPS) libtests_a_SOURCES = libtests_a_LIBADD = $(gltests_LIBOBJS) libtests_a_DEPENDENCIES = $(gltests_LIBOBJS) EXTRA_libtests_a_SOURCES = AM_LIBTOOLFLAGS = --preserve-dup-deps TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' ## begin gnulib module accept EXTRA_DIST += accept.c w32sock.h EXTRA_libtests_a_SOURCES += accept.c ## end gnulib module accept ## begin gnulib module accept-tests TESTS += test-accept check_PROGRAMS += test-accept test_accept_LDADD = $(LDADD) @LIBSOCKET@ EXTRA_DIST += test-accept.c signature.h macros.h ## end gnulib module accept-tests ## begin gnulib module alignof-tests TESTS += test-alignof check_PROGRAMS += test-alignof EXTRA_DIST += test-alignof.c ## end gnulib module alignof-tests ## begin gnulib module alloca-opt-tests TESTS += test-alloca-opt check_PROGRAMS += test-alloca-opt EXTRA_DIST += test-alloca-opt.c ## end gnulib module alloca-opt-tests ## begin gnulib module argmatch-tests TESTS += test-argmatch check_PROGRAMS += test-argmatch test_argmatch_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC) EXTRA_DIST += test-argmatch.c macros.h ## end gnulib module argmatch-tests ## begin gnulib module arpa_inet BUILT_SOURCES += arpa/inet.h # We need the following in order to create <arpa/inet.h> when the system # doesn't have one. arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_at)$(MKDIR_P) arpa $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \ -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \ -e 's/@''GNULIB_INET_NTOP''@/$(GL_GNULIB_INET_NTOP)/g' \ -e 's/@''GNULIB_INET_PTON''@/$(GL_GNULIB_INET_PTON)/g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \ -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/arpa_inet.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t MOSTLYCLEANDIRS += arpa EXTRA_DIST += arpa_inet.in.h ## end gnulib module arpa_inet ## begin gnulib module arpa_inet-tests TESTS += test-arpa_inet check_PROGRAMS += test-arpa_inet EXTRA_DIST += test-arpa_inet.c ## end gnulib module arpa_inet-tests ## begin gnulib module binary-io-tests TESTS += test-binary-io.sh check_PROGRAMS += test-binary-io EXTRA_DIST += test-binary-io.sh test-binary-io.c macros.h ## end gnulib module binary-io-tests ## begin gnulib module bind EXTRA_DIST += bind.c w32sock.h EXTRA_libtests_a_SOURCES += bind.c ## end gnulib module bind ## begin gnulib module bind-tests TESTS += test-bind check_PROGRAMS += test-bind test_bind_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB) EXTRA_DIST += test-bind.c signature.h macros.h ## end gnulib module bind-tests ## begin gnulib module bitrotate-tests TESTS += test-bitrotate check_PROGRAMS += test-bitrotate EXTRA_DIST += test-bitrotate.c macros.h ## end gnulib module bitrotate-tests ## begin gnulib module btowc-tests TESTS += test-btowc1.sh test-btowc2.sh TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-btowc test_btowc_LDADD = $(LDADD) $(LIB_SETLOCALE) EXTRA_DIST += test-btowc1.sh test-btowc2.sh test-btowc.c signature.h macros.h ## end gnulib module btowc-tests ## begin gnulib module c-ctype-tests TESTS += test-c-ctype check_PROGRAMS += test-c-ctype test_c_ctype_LDADD = $(LDADD) $(LIB_SETLOCALE) EXTRA_DIST += test-c-ctype.c macros.h ## end gnulib module c-ctype-tests ## begin gnulib module c-stack-tests TESTS += test-c-stack.sh test-c-stack2.sh TESTS_ENVIRONMENT += LIBSIGSEGV='@LIBSIGSEGV@' check_PROGRAMS += test-c-stack test_c_stack_LDADD = $(LDADD) $(LIBCSTACK) @LIBINTL@ MOSTLYCLEANFILES += t-c-stack.tmp t-c-stack2.tmp EXTRA_DIST += test-c-stack.c test-c-stack.sh test-c-stack2.sh macros.h ## end gnulib module c-stack-tests ## begin gnulib module c-strcase-tests TESTS += test-c-strcase.sh TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' check_PROGRAMS += test-c-strcasecmp test-c-strncasecmp test_c_strcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) test_c_strncasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) EXTRA_DIST += test-c-strcase.sh test-c-strcasecmp.c test-c-strncasecmp.c macros.h ## end gnulib module c-strcase-tests ## begin gnulib module calloc-gnu-tests TESTS += test-calloc-gnu check_PROGRAMS += test-calloc-gnu EXTRA_DIST += test-calloc-gnu.c macros.h ## end gnulib module calloc-gnu-tests ## begin gnulib module chdir-tests TESTS += test-chdir check_PROGRAMS += test-chdir EXTRA_DIST += test-chdir.c signature.h macros.h ## end gnulib module chdir-tests ## begin gnulib module cloexec-tests TESTS += test-cloexec check_PROGRAMS += test-cloexec EXTRA_DIST += test-cloexec.c macros.h ## end gnulib module cloexec-tests ## begin gnulib module close-tests TESTS += test-close check_PROGRAMS += test-close EXTRA_DIST += test-close.c signature.h macros.h ## end gnulib module close-tests ## begin gnulib module connect EXTRA_DIST += connect.c w32sock.h EXTRA_libtests_a_SOURCES += connect.c ## end gnulib module connect ## begin gnulib module connect-tests TESTS += test-connect check_PROGRAMS += test-connect test_connect_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB) EXTRA_DIST += test-connect.c signature.h macros.h ## end gnulib module connect-tests ## begin gnulib module ctype-tests TESTS += test-ctype check_PROGRAMS += test-ctype EXTRA_DIST += test-ctype.c ## end gnulib module ctype-tests ## begin gnulib module dfa-tests TESTS += \ test-dfa-invalid-char-class.sh \ test-dfa-invalid-merge.sh \ test-dfa-match.sh check_PROGRAMS += test-dfa-match-aux test_dfa_match_aux_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIB_MBRTOWC) EXTRA_DIST += test-dfa-match.sh test-dfa-match-aux.c test-dfa-invalid-char-class.sh test-dfa-invalid-merge.sh ## end gnulib module dfa-tests ## begin gnulib module dirent-tests TESTS += test-dirent check_PROGRAMS += test-dirent EXTRA_DIST += test-dirent.c ## end gnulib module dirent-tests ## begin gnulib module dup-tests TESTS += test-dup check_PROGRAMS += test-dup EXTRA_DIST += test-dup.c signature.h macros.h ## end gnulib module dup-tests ## begin gnulib module dup2-tests TESTS += test-dup2 check_PROGRAMS += test-dup2 EXTRA_DIST += test-dup2.c signature.h macros.h ## end gnulib module dup2-tests ## begin gnulib module dynarray-tests TESTS += test-dynarray check_PROGRAMS += test-dynarray EXTRA_DIST += test-dynarray.c macros.h ## end gnulib module dynarray-tests ## begin gnulib module environ-tests TESTS += test-environ check_PROGRAMS += test-environ EXTRA_DIST += test-environ.c ## end gnulib module environ-tests ## begin gnulib module errno-tests TESTS += test-errno check_PROGRAMS += test-errno EXTRA_DIST += test-errno.c ## end gnulib module errno-tests ## begin gnulib module exclude-tests TESTS += \ test-exclude1.sh\ test-exclude2.sh\ test-exclude3.sh\ test-exclude4.sh\ test-exclude5.sh\ test-exclude6.sh\ test-exclude7.sh\ test-exclude8.sh check_PROGRAMS += test-exclude test_exclude_LDADD = $(LDADD) $(LIBUNISTRING) @LIBINTL@ $(LIB_MBRTOWC) $(LIBTHREAD) EXTRA_DIST += test-exclude.c test-exclude1.sh test-exclude2.sh test-exclude3.sh test-exclude4.sh test-exclude5.sh test-exclude6.sh test-exclude7.sh test-exclude8.sh ## end gnulib module exclude-tests ## begin gnulib module fchdir-tests TESTS += test-fchdir check_PROGRAMS += test-fchdir test_fchdir_LDADD = $(LDADD) $(LIBINTL) EXTRA_DIST += test-fchdir.c signature.h macros.h ## end gnulib module fchdir-tests ## begin gnulib module fcntl-h-tests TESTS += test-fcntl-h check_PROGRAMS += test-fcntl-h EXTRA_DIST += test-fcntl-h.c ## end gnulib module fcntl-h-tests ## begin gnulib module fcntl-safer-tests TESTS += test-fcntl-safer check_PROGRAMS += test-fcntl-safer EXTRA_DIST += test-open.h test-fcntl-safer.c macros.h ## end gnulib module fcntl-safer-tests ## begin gnulib module fcntl-tests TESTS += test-fcntl check_PROGRAMS += test-fcntl EXTRA_DIST += test-fcntl.c signature.h macros.h ## end gnulib module fcntl-tests ## begin gnulib module fdopen EXTRA_DIST += fdopen.c EXTRA_libtests_a_SOURCES += fdopen.c ## end gnulib module fdopen ## begin gnulib module fdopen-tests TESTS += test-fdopen check_PROGRAMS += test-fdopen EXTRA_DIST += test-fdopen.c signature.h macros.h ## end gnulib module fdopen-tests ## begin gnulib module fdopendir-tests TESTS += test-fdopendir check_PROGRAMS += test-fdopendir test_fdopendir_LDADD = $(LDADD) @LIBINTL@ EXTRA_DIST += test-fdopendir.c signature.h macros.h ## end gnulib module fdopendir-tests ## begin gnulib module fgetc-tests TESTS += test-fgetc check_PROGRAMS += test-fgetc EXTRA_DIST += test-fgetc.c signature.h macros.h ## end gnulib module fgetc-tests ## begin gnulib module float BUILT_SOURCES += $(FLOAT_H) # We need the following in order to create <float.h> when the system # doesn't have one that works with the given compiler. if GL_GENERATE_FLOAT_H float.h: float.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ -e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \ < $(srcdir)/float.in.h; \ } > $@-t && \ mv $@-t $@ else float.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += float.h float.h-t EXTRA_DIST += float.c float.in.h itold.c EXTRA_libtests_a_SOURCES += float.c itold.c ## end gnulib module float ## begin gnulib module float-tests TESTS += test-float check_PROGRAMS += test-float EXTRA_DIST += test-float.c macros.h ## end gnulib module float-tests ## begin gnulib module fnmatch-h-tests TESTS += test-fnmatch-h check_PROGRAMS += test-fnmatch-h EXTRA_DIST += test-fnmatch-h.c ## end gnulib module fnmatch-h-tests ## begin gnulib module fnmatch-tests TESTS += test-fnmatch check_PROGRAMS += test-fnmatch test_fnmatch_LDADD = $(LDADD) $(LIB_MBRTOWC) EXTRA_DIST += test-fnmatch.c signature.h macros.h ## end gnulib module fnmatch-tests ## begin gnulib module fopen-gnu-tests TESTS += test-fopen-gnu check_PROGRAMS += test-fopen-gnu EXTRA_DIST += test-fopen-gnu.c macros.h ## end gnulib module fopen-gnu-tests ## begin gnulib module fopen-tests TESTS += test-fopen check_PROGRAMS += test-fopen EXTRA_DIST += test-fopen.h test-fopen.c signature.h macros.h ## end gnulib module fopen-tests ## begin gnulib module fpending-tests TESTS += test-fpending.sh check_PROGRAMS += test-fpending MOSTLYCLEANFILES += test-fpending.t EXTRA_DIST += test-fpending.c test-fpending.sh macros.h ## end gnulib module fpending-tests ## begin gnulib module fpucw EXTRA_DIST += fpucw.h ## end gnulib module fpucw ## begin gnulib module fputc-tests TESTS += test-fputc check_PROGRAMS += test-fputc EXTRA_DIST += test-fputc.c signature.h macros.h ## end gnulib module fputc-tests ## begin gnulib module fread-tests TESTS += test-fread check_PROGRAMS += test-fread EXTRA_DIST += test-fread.c signature.h macros.h ## end gnulib module fread-tests ## begin gnulib module free-posix-tests TESTS += test-free check_PROGRAMS += test-free EXTRA_DIST += test-free.c macros.h ## end gnulib module free-posix-tests ## begin gnulib module fstat-tests TESTS += test-fstat check_PROGRAMS += test-fstat EXTRA_DIST += test-fstat.c signature.h macros.h ## end gnulib module fstat-tests ## begin gnulib module fstatat-tests TESTS += test-fstatat check_PROGRAMS += test-fstatat test_fstatat_LDADD = $(LDADD) @LIBINTL@ EXTRA_DIST += test-fstatat.c test-lstat.h test-stat.h signature.h macros.h ## end gnulib module fstatat-tests ## begin gnulib module ftruncate EXTRA_DIST += ftruncate.c EXTRA_libtests_a_SOURCES += ftruncate.c ## end gnulib module ftruncate ## begin gnulib module ftruncate-tests TESTS += test-ftruncate.sh check_PROGRAMS += test-ftruncate EXTRA_DIST += test-ftruncate.c test-ftruncate.sh signature.h macros.h ## end gnulib module ftruncate-tests ## begin gnulib module fwrite-tests TESTS += test-fwrite check_PROGRAMS += test-fwrite EXTRA_DIST += test-fwrite.c signature.h macros.h ## end gnulib module fwrite-tests ## begin gnulib module getcwd-lgpl-tests TESTS += test-getcwd-lgpl check_PROGRAMS += test-getcwd-lgpl test_getcwd_lgpl_LDADD = $(LDADD) $(LIBINTL) EXTRA_DIST += test-getcwd-lgpl.c signature.h macros.h ## end gnulib module getcwd-lgpl-tests ## begin gnulib module getdtablesize-tests TESTS += test-getdtablesize check_PROGRAMS += test-getdtablesize EXTRA_DIST += test-getdtablesize.c signature.h macros.h ## end gnulib module getdtablesize-tests ## begin gnulib module getopt-gnu-tests TESTS += test-getopt-gnu check_PROGRAMS += test-getopt-gnu test_getopt_gnu_LDADD = $(LDADD) $(LIBINTL) EXTRA_DIST += macros.h signature.h test-getopt-gnu.c test-getopt-main.h test-getopt.h test-getopt_long.h ## end gnulib module getopt-gnu-tests ## begin gnulib module getopt-posix-tests TESTS += test-getopt-posix check_PROGRAMS += test-getopt-posix test_getopt_posix_LDADD = $(LDADD) $(LIBINTL) EXTRA_DIST += macros.h signature.h test-getopt-posix.c test-getopt-main.h test-getopt.h ## end gnulib module getopt-posix-tests ## begin gnulib module getprogname-tests DEFS += -DEXEEXT=\"@EXEEXT@\" TESTS += test-getprogname check_PROGRAMS += test-getprogname test_getprogname_LDADD = $(LDADD) EXTRA_DIST += test-getprogname.c ## end gnulib module getprogname-tests ## begin gnulib module gettimeofday EXTRA_DIST += gettimeofday.c EXTRA_libtests_a_SOURCES += gettimeofday.c ## end gnulib module gettimeofday ## begin gnulib module gettimeofday-tests TESTS += test-gettimeofday check_PROGRAMS += test-gettimeofday EXTRA_DIST += signature.h test-gettimeofday.c ## end gnulib module gettimeofday-tests ## begin gnulib module gperf GPERF = gperf V_GPERF = $(V_GPERF_@AM_V@) V_GPERF_ = $(V_GPERF_@AM_DEFAULT_V@) V_GPERF_0 = @echo " GPERF " $@; ## end gnulib module gperf ## begin gnulib module hard-locale-tests TESTS += test-hard-locale check_PROGRAMS += test-hard-locale test_hard_locale_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIB_HARD_LOCALE@ # We cannot call this program 'locale', because the C++ compiler on Mac OS X # would then barf upon '#include <locale>'. So, call it 'current-locale'. noinst_PROGRAMS += current-locale current_locale_SOURCES = locale.c EXTRA_DIST += test-hard-locale.c locale.c ## end gnulib module hard-locale-tests ## begin gnulib module hash-pjw libtests_a_SOURCES += hash-pjw.h hash-pjw.c ## end gnulib module hash-pjw ## begin gnulib module hash-tests TESTS += test-hash check_PROGRAMS += test-hash EXTRA_DIST += test-hash.c macros.h ## end gnulib module hash-tests ## begin gnulib module i-ring-tests TESTS += test-i-ring check_PROGRAMS += test-i-ring EXTRA_DIST += test-i-ring.c macros.h ## end gnulib module i-ring-tests ## begin gnulib module iconv-h-tests TESTS += test-iconv-h check_PROGRAMS += test-iconv-h EXTRA_DIST += test-iconv-h.c ## end gnulib module iconv-h-tests ## begin gnulib module iconv-tests TESTS += test-iconv check_PROGRAMS += test-iconv test_iconv_LDADD = $(LDADD) @LIBICONV@ EXTRA_DIST += test-iconv.c signature.h macros.h ## end gnulib module iconv-tests ## begin gnulib module ignore-value-tests TESTS += test-ignore-value check_PROGRAMS += test-ignore-value EXTRA_DIST += test-ignore-value.c ## end gnulib module ignore-value-tests ## begin gnulib module inet_pton EXTRA_DIST += inet_pton.c EXTRA_libtests_a_SOURCES += inet_pton.c ## end gnulib module inet_pton ## begin gnulib module inet_pton-tests TESTS += test-inet_pton check_PROGRAMS += test-inet_pton test_inet_pton_LDADD = $(LDADD) @INET_PTON_LIB@ EXTRA_DIST += test-inet_pton.c signature.h macros.h ## end gnulib module inet_pton-tests ## begin gnulib module intprops-tests TESTS += test-intprops check_PROGRAMS += test-intprops EXTRA_DIST += test-intprops.c macros.h ## end gnulib module intprops-tests ## begin gnulib module inttostr libtests_a_SOURCES += imaxtostr.c inttostr.c offtostr.c uinttostr.c umaxtostr.c EXTRA_DIST += anytostr.c inttostr.h EXTRA_libtests_a_SOURCES += anytostr.c ## end gnulib module inttostr ## begin gnulib module inttostr-tests TESTS += test-inttostr check_PROGRAMS += test-inttostr EXTRA_DIST += macros.h test-inttostr.c ## end gnulib module inttostr-tests ## begin gnulib module inttypes-tests TESTS += test-inttypes check_PROGRAMS += test-inttypes EXTRA_DIST += test-inttypes.c ## end gnulib module inttypes-tests ## begin gnulib module ioctl EXTRA_DIST += ioctl.c w32sock.h EXTRA_libtests_a_SOURCES += ioctl.c ## end gnulib module ioctl ## begin gnulib module ioctl-tests TESTS += test-ioctl check_PROGRAMS += test-ioctl EXTRA_DIST += test-ioctl.c signature.h macros.h ## end gnulib module ioctl-tests ## begin gnulib module isatty-tests TESTS += test-isatty check_PROGRAMS += test-isatty EXTRA_DIST += test-isatty.c signature.h macros.h ## end gnulib module isatty-tests ## begin gnulib module isblank-tests TESTS += test-isblank check_PROGRAMS += test-isblank EXTRA_DIST += test-isblank.c signature.h macros.h ## end gnulib module isblank-tests ## begin gnulib module iswblank-tests TESTS += test-iswblank check_PROGRAMS += test-iswblank EXTRA_DIST += test-iswblank.c macros.h ## end gnulib module iswblank-tests ## begin gnulib module iswdigit-tests TESTS += test-iswdigit.sh TESTS_ENVIRONMENT += \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-iswdigit test_iswdigit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) EXTRA_DIST += test-iswdigit.sh test-iswdigit.c signature.h macros.h ## end gnulib module iswdigit-tests ## begin gnulib module iswxdigit-tests TESTS += test-iswxdigit.sh TESTS_ENVIRONMENT += \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-iswxdigit test_iswxdigit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) EXTRA_DIST += test-iswxdigit.sh test-iswxdigit.c signature.h macros.h ## end gnulib module iswxdigit-tests ## begin gnulib module langinfo-tests TESTS += test-langinfo check_PROGRAMS += test-langinfo EXTRA_DIST += test-langinfo.c ## end gnulib module langinfo-tests ## begin gnulib module limits-h-tests TESTS += test-limits-h check_PROGRAMS += test-limits-h EXTRA_DIST += test-limits-h.c ## end gnulib module limits-h-tests ## begin gnulib module listen EXTRA_DIST += listen.c w32sock.h EXTRA_libtests_a_SOURCES += listen.c ## end gnulib module listen ## begin gnulib module listen-tests TESTS += test-listen check_PROGRAMS += test-listen test_listen_LDADD = $(LDADD) @LIBSOCKET@ EXTRA_DIST += test-listen.c signature.h macros.h ## end gnulib module listen-tests ## begin gnulib module localcharset-tests noinst_PROGRAMS += test-localcharset test_localcharset_LDADD = $(LDADD) $(LIB_SETLOCALE) EXTRA_DIST += test-localcharset.c ## end gnulib module localcharset-tests ## begin gnulib module locale-tests TESTS += test-locale check_PROGRAMS += test-locale EXTRA_DIST += test-locale.c ## end gnulib module locale-tests ## begin gnulib module localeconv-tests TESTS += test-localeconv check_PROGRAMS += test-localeconv EXTRA_DIST += test-localeconv.c signature.h macros.h ## end gnulib module localeconv-tests ## begin gnulib module localename libtests_a_SOURCES += localename.c localename-table.c EXTRA_DIST += localename-table.h localename.h ## end gnulib module localename ## begin gnulib module localename-tests TESTS += test-localename check_PROGRAMS += test-localename test_localename_LDADD = $(LDADD) $(LIB_SETLOCALE) @INTL_MACOSX_LIBS@ $(LIBTHREAD) EXTRA_DIST += test-localename.c macros.h ## end gnulib module localename-tests ## begin gnulib module lseek-tests TESTS += test-lseek.sh check_PROGRAMS += test-lseek EXTRA_DIST += test-lseek.c test-lseek.sh signature.h macros.h ## end gnulib module lseek-tests ## begin gnulib module lstat-tests TESTS += test-lstat check_PROGRAMS += test-lstat EXTRA_DIST += test-lstat.h test-lstat.c signature.h macros.h ## end gnulib module lstat-tests ## begin gnulib module malloc-gnu-tests TESTS += test-malloc-gnu check_PROGRAMS += test-malloc-gnu EXTRA_DIST += test-malloc-gnu.c macros.h ## end gnulib module malloc-gnu-tests ## begin gnulib module malloca-tests TESTS += test-malloca check_PROGRAMS += test-malloca EXTRA_DIST += test-malloca.c ## end gnulib module malloca-tests ## begin gnulib module mbscasecmp-tests TESTS += test-mbscasecmp.sh TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' check_PROGRAMS += test-mbscasecmp test_mbscasecmp_LDADD = $(LDADD) $(LIBUNISTRING) $(LIB_SETLOCALE) $(LIB_MBRTOWC) EXTRA_DIST += test-mbscasecmp.sh test-mbscasecmp.c macros.h ## end gnulib module mbscasecmp-tests ## begin gnulib module mbsinit-tests TESTS += test-mbsinit.sh TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-mbsinit test_mbsinit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) EXTRA_DIST += test-mbsinit.sh test-mbsinit.c signature.h macros.h ## end gnulib module mbsinit-tests ## begin gnulib module mbsrtowcs-tests TESTS += test-mbsrtowcs1.sh test-mbsrtowcs2.sh test-mbsrtowcs3.sh test-mbsrtowcs4.sh TESTS_ENVIRONMENT += \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-mbsrtowcs test_mbsrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) EXTRA_DIST += test-mbsrtowcs1.sh test-mbsrtowcs2.sh test-mbsrtowcs3.sh test-mbsrtowcs4.sh test-mbsrtowcs.c signature.h macros.h ## end gnulib module mbsrtowcs-tests ## begin gnulib module mbsstr-tests TESTS += test-mbsstr1 test-mbsstr2.sh test-mbsstr3.sh TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-mbsstr1 test-mbsstr2 test-mbsstr3 test_mbsstr1_LDADD = $(LDADD) $(LIBUNISTRING) $(LIB_MBRTOWC) test_mbsstr2_LDADD = $(LDADD) $(LIBUNISTRING) $(LIB_SETLOCALE) $(LIB_MBRTOWC) test_mbsstr3_LDADD = $(LDADD) $(LIBUNISTRING) $(LIB_SETLOCALE) $(LIB_MBRTOWC) EXTRA_DIST += test-mbsstr1.c test-mbsstr2.sh test-mbsstr2.c test-mbsstr3.sh test-mbsstr3.c macros.h ## end gnulib module mbsstr-tests ## begin gnulib module memchr-tests TESTS += test-memchr check_PROGRAMS += test-memchr EXTRA_DIST += test-memchr.c zerosize-ptr.h signature.h macros.h ## end gnulib module memchr-tests ## begin gnulib module memchr2-tests TESTS += test-memchr2 check_PROGRAMS += test-memchr2 EXTRA_DIST += test-memchr2.c zerosize-ptr.h macros.h ## end gnulib module memchr2-tests ## begin gnulib module memrchr-tests TESTS += test-memrchr check_PROGRAMS += test-memrchr EXTRA_DIST += test-memrchr.c zerosize-ptr.h signature.h macros.h ## end gnulib module memrchr-tests ## begin gnulib module nanosleep EXTRA_DIST += nanosleep.c EXTRA_libtests_a_SOURCES += nanosleep.c ## end gnulib module nanosleep ## begin gnulib module nanosleep-tests TESTS += test-nanosleep check_PROGRAMS += test-nanosleep test_nanosleep_LDADD = $(LDADD) $(LIB_NANOSLEEP) EXTRA_DIST += test-nanosleep.c signature.h macros.h ## end gnulib module nanosleep-tests ## begin gnulib module netinet_in BUILT_SOURCES += $(NETINET_IN_H) # We need the following in order to create <netinet/in.h> when the system # doesn't have one. if GL_GENERATE_NETINET_IN_H netinet/in.h: netinet_in.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) netinet $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \ -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \ < $(srcdir)/netinet_in.in.h; \ } > $@-t && \ mv $@-t $@ else netinet/in.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t MOSTLYCLEANDIRS += netinet EXTRA_DIST += netinet_in.in.h ## end gnulib module netinet_in ## begin gnulib module netinet_in-tests TESTS += test-netinet_in check_PROGRAMS += test-netinet_in EXTRA_DIST += test-netinet_in.c ## end gnulib module netinet_in-tests ## begin gnulib module nl_langinfo-tests TESTS += test-nl_langinfo.sh test-nl_langinfo-mt TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-nl_langinfo test-nl_langinfo-mt test_nl_langinfo_LDADD = $(LDADD) $(LIB_SETLOCALE) test_nl_langinfo_mt_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBMULTITHREAD) $(LIB_NANOSLEEP) EXTRA_DIST += test-nl_langinfo.sh test-nl_langinfo.c test-nl_langinfo-mt.c signature.h macros.h ## end gnulib module nl_langinfo-tests ## begin gnulib module open-tests TESTS += test-open check_PROGRAMS += test-open EXTRA_DIST += test-open.h test-open.c signature.h macros.h ## end gnulib module open-tests ## begin gnulib module openat-safer-tests TESTS += test-openat-safer check_PROGRAMS += test-openat-safer test_openat_safer_LDADD = $(LDADD) @LIBINTL@ EXTRA_DIST += test-openat-safer.c macros.h ## end gnulib module openat-safer-tests ## begin gnulib module openat-tests TESTS += test-openat check_PROGRAMS += test-openat test_openat_LDADD = $(LDADD) @LIBINTL@ EXTRA_DIST += test-openat.c test-open.h signature.h macros.h ## end gnulib module openat-tests ## begin gnulib module pathmax-tests TESTS += test-pathmax check_PROGRAMS += test-pathmax EXTRA_DIST += test-pathmax.c ## end gnulib module pathmax-tests ## begin gnulib module perror EXTRA_DIST += perror.c EXTRA_libtests_a_SOURCES += perror.c ## end gnulib module perror ## begin gnulib module perror-tests TESTS += test-perror.sh test-perror2 check_PROGRAMS += test-perror test-perror2 EXTRA_DIST += macros.h signature.h test-perror.c test-perror2.c test-perror.sh ## end gnulib module perror-tests ## begin gnulib module pipe-posix-tests TESTS += test-pipe check_PROGRAMS += test-pipe EXTRA_DIST += test-pipe.c signature.h macros.h ## end gnulib module pipe-posix-tests ## begin gnulib module pthread-h BUILT_SOURCES += pthread.h # We need the following in order to create <pthread.h> when the system # doesn't have one that works with the given compiler. pthread.h: pthread.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_PTHREAD_H''@|$(HAVE_PTHREAD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_PTHREAD_H''@|$(NEXT_PTHREAD_H)|g' \ -e 's/@''GNULIB_PTHREAD_THREAD''@/$(GL_GNULIB_PTHREAD_THREAD)/g' \ -e 's/@''GNULIB_PTHREAD_ONCE''@/$(GL_GNULIB_PTHREAD_ONCE)/g' \ -e 's/@''GNULIB_PTHREAD_MUTEX''@/$(GL_GNULIB_PTHREAD_MUTEX)/g' \ -e 's/@''GNULIB_PTHREAD_RWLOCK''@/$(GL_GNULIB_PTHREAD_RWLOCK)/g' \ -e 's/@''GNULIB_PTHREAD_COND''@/$(GL_GNULIB_PTHREAD_COND)/g' \ -e 's/@''GNULIB_PTHREAD_TSS''@/$(GL_GNULIB_PTHREAD_TSS)/g' \ -e 's/@''GNULIB_PTHREAD_SPIN''@/$(GL_GNULIB_PTHREAD_SPIN)/g' \ -e 's/@''GNULIB_PTHREAD_MUTEX_TIMEDLOCK''@/$(GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK)/g' \ -e 's|@''HAVE_PTHREAD_T''@|$(HAVE_PTHREAD_T)|g' \ -e 's|@''HAVE_PTHREAD_SPINLOCK_T''@|$(HAVE_PTHREAD_SPINLOCK_T)|g' \ -e 's|@''HAVE_PTHREAD_CREATE_DETACHED''@|$(HAVE_PTHREAD_CREATE_DETACHED)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_RECURSIVE''@|$(HAVE_PTHREAD_MUTEX_RECURSIVE)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_ROBUST''@|$(HAVE_PTHREAD_MUTEX_ROBUST)|g' \ -e 's|@''HAVE_PTHREAD_PROCESS_SHARED''@|$(HAVE_PTHREAD_PROCESS_SHARED)|g' \ -e 's|@''HAVE_PTHREAD_CREATE''@|$(HAVE_PTHREAD_CREATE)|g' \ -e 's|@''HAVE_PTHREAD_ATTR_INIT''@|$(HAVE_PTHREAD_ATTR_INIT)|g' \ -e 's|@''HAVE_PTHREAD_ATTR_GETDETACHSTATE''@|$(HAVE_PTHREAD_ATTR_GETDETACHSTATE)|g' \ -e 's|@''HAVE_PTHREAD_ATTR_SETDETACHSTATE''@|$(HAVE_PTHREAD_ATTR_SETDETACHSTATE)|g' \ -e 's|@''HAVE_PTHREAD_ATTR_DESTROY''@|$(HAVE_PTHREAD_ATTR_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_SELF''@|$(HAVE_PTHREAD_SELF)|g' \ -e 's|@''HAVE_PTHREAD_EQUAL''@|$(HAVE_PTHREAD_EQUAL)|g' \ -e 's|@''HAVE_PTHREAD_DETACH''@|$(HAVE_PTHREAD_DETACH)|g' \ -e 's|@''HAVE_PTHREAD_JOIN''@|$(HAVE_PTHREAD_JOIN)|g' \ -e 's|@''HAVE_PTHREAD_EXIT''@|$(HAVE_PTHREAD_EXIT)|g' \ -e 's|@''HAVE_PTHREAD_ONCE''@|$(HAVE_PTHREAD_ONCE)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_INIT''@|$(HAVE_PTHREAD_MUTEX_INIT)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_INIT''@|$(HAVE_PTHREAD_MUTEXATTR_INIT)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_GETTYPE''@|$(HAVE_PTHREAD_MUTEXATTR_GETTYPE)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_SETTYPE''@|$(HAVE_PTHREAD_MUTEXATTR_SETTYPE)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_GETROBUST''@|$(HAVE_PTHREAD_MUTEXATTR_GETROBUST)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_SETROBUST''@|$(HAVE_PTHREAD_MUTEXATTR_SETROBUST)|g' \ -e 's|@''HAVE_PTHREAD_MUTEXATTR_DESTROY''@|$(HAVE_PTHREAD_MUTEXATTR_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_LOCK''@|$(HAVE_PTHREAD_MUTEX_LOCK)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_TRYLOCK''@|$(HAVE_PTHREAD_MUTEX_TRYLOCK)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_TIMEDLOCK''@|$(HAVE_PTHREAD_MUTEX_TIMEDLOCK)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_UNLOCK''@|$(HAVE_PTHREAD_MUTEX_UNLOCK)|g' \ -e 's|@''HAVE_PTHREAD_MUTEX_DESTROY''@|$(HAVE_PTHREAD_MUTEX_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_INIT''@|$(HAVE_PTHREAD_RWLOCK_INIT)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCKATTR_INIT''@|$(HAVE_PTHREAD_RWLOCKATTR_INIT)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCKATTR_DESTROY''@|$(HAVE_PTHREAD_RWLOCKATTR_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_RDLOCK''@|$(HAVE_PTHREAD_RWLOCK_RDLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_WRLOCK''@|$(HAVE_PTHREAD_RWLOCK_WRLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_TRYRDLOCK''@|$(HAVE_PTHREAD_RWLOCK_TRYRDLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_TRYWRLOCK''@|$(HAVE_PTHREAD_RWLOCK_TRYWRLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK''@|$(HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK''@|$(HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_UNLOCK''@|$(HAVE_PTHREAD_RWLOCK_UNLOCK)|g' \ -e 's|@''HAVE_PTHREAD_RWLOCK_DESTROY''@|$(HAVE_PTHREAD_RWLOCK_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_COND_INIT''@|$(HAVE_PTHREAD_COND_INIT)|g' \ -e 's|@''HAVE_PTHREAD_CONDATTR_INIT''@|$(HAVE_PTHREAD_CONDATTR_INIT)|g' \ -e 's|@''HAVE_PTHREAD_CONDATTR_DESTROY''@|$(HAVE_PTHREAD_CONDATTR_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_COND_WAIT''@|$(HAVE_PTHREAD_COND_WAIT)|g' \ -e 's|@''HAVE_PTHREAD_COND_TIMEDWAIT''@|$(HAVE_PTHREAD_COND_TIMEDWAIT)|g' \ -e 's|@''HAVE_PTHREAD_COND_SIGNAL''@|$(HAVE_PTHREAD_COND_SIGNAL)|g' \ -e 's|@''HAVE_PTHREAD_COND_BROADCAST''@|$(HAVE_PTHREAD_COND_BROADCAST)|g' \ -e 's|@''HAVE_PTHREAD_COND_DESTROY''@|$(HAVE_PTHREAD_COND_DESTROY)|g' \ -e 's|@''HAVE_PTHREAD_KEY_CREATE''@|$(HAVE_PTHREAD_KEY_CREATE)|g' \ -e 's|@''HAVE_PTHREAD_SETSPECIFIC''@|$(HAVE_PTHREAD_SETSPECIFIC)|g' \ -e 's|@''HAVE_PTHREAD_GETSPECIFIC''@|$(HAVE_PTHREAD_GETSPECIFIC)|g' \ -e 's|@''HAVE_PTHREAD_KEY_DELETE''@|$(HAVE_PTHREAD_KEY_DELETE)|g' \ -e 's|@''HAVE_PTHREAD_SPIN_INIT''@|$(HAVE_PTHREAD_SPIN_INIT)|g' \ -e 's|@''HAVE_PTHREAD_SPIN_LOCK''@|$(HAVE_PTHREAD_SPIN_LOCK)|g' \ -e 's|@''HAVE_PTHREAD_SPIN_TRYLOCK''@|$(HAVE_PTHREAD_SPIN_TRYLOCK)|g' \ -e 's|@''HAVE_PTHREAD_SPIN_UNLOCK''@|$(HAVE_PTHREAD_SPIN_UNLOCK)|g' \ -e 's|@''HAVE_PTHREAD_SPIN_DESTROY''@|$(HAVE_PTHREAD_SPIN_DESTROY)|g' \ < $(srcdir)/pthread.in.h | \ sed -e 's|@''REPLACE_PTHREAD_CREATE''@|$(REPLACE_PTHREAD_CREATE)|g' \ -e 's|@''REPLACE_PTHREAD_ATTR_INIT''@|$(REPLACE_PTHREAD_ATTR_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_ATTR_GETDETACHSTATE''@|$(REPLACE_PTHREAD_ATTR_GETDETACHSTATE)|g' \ -e 's|@''REPLACE_PTHREAD_ATTR_SETDETACHSTATE''@|$(REPLACE_PTHREAD_ATTR_SETDETACHSTATE)|g' \ -e 's|@''REPLACE_PTHREAD_ATTR_DESTROY''@|$(REPLACE_PTHREAD_ATTR_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_SELF''@|$(REPLACE_PTHREAD_SELF)|g' \ -e 's|@''REPLACE_PTHREAD_EQUAL''@|$(REPLACE_PTHREAD_EQUAL)|g' \ -e 's|@''REPLACE_PTHREAD_DETACH''@|$(REPLACE_PTHREAD_DETACH)|g' \ -e 's|@''REPLACE_PTHREAD_JOIN''@|$(REPLACE_PTHREAD_JOIN)|g' \ -e 's|@''REPLACE_PTHREAD_EXIT''@|$(REPLACE_PTHREAD_EXIT)|g' \ -e 's|@''REPLACE_PTHREAD_ONCE''@|$(REPLACE_PTHREAD_ONCE)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_INIT''@|$(REPLACE_PTHREAD_MUTEX_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_INIT''@|$(REPLACE_PTHREAD_MUTEXATTR_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_GETTYPE''@|$(REPLACE_PTHREAD_MUTEXATTR_GETTYPE)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_SETTYPE''@|$(REPLACE_PTHREAD_MUTEXATTR_SETTYPE)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_GETROBUST''@|$(REPLACE_PTHREAD_MUTEXATTR_GETROBUST)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_SETROBUST''@|$(REPLACE_PTHREAD_MUTEXATTR_SETROBUST)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEXATTR_DESTROY''@|$(REPLACE_PTHREAD_MUTEXATTR_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_LOCK''@|$(REPLACE_PTHREAD_MUTEX_LOCK)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_TRYLOCK''@|$(REPLACE_PTHREAD_MUTEX_TRYLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_TIMEDLOCK''@|$(REPLACE_PTHREAD_MUTEX_TIMEDLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_UNLOCK''@|$(REPLACE_PTHREAD_MUTEX_UNLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_MUTEX_DESTROY''@|$(REPLACE_PTHREAD_MUTEX_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_INIT''@|$(REPLACE_PTHREAD_RWLOCK_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCKATTR_INIT''@|$(REPLACE_PTHREAD_RWLOCKATTR_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCKATTR_DESTROY''@|$(REPLACE_PTHREAD_RWLOCKATTR_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_RDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_RDLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_WRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_WRLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_TRYRDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TRYRDLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_TRYWRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TRYWRLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_UNLOCK''@|$(REPLACE_PTHREAD_RWLOCK_UNLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_RWLOCK_DESTROY''@|$(REPLACE_PTHREAD_RWLOCK_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_COND_INIT''@|$(REPLACE_PTHREAD_COND_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_CONDATTR_INIT''@|$(REPLACE_PTHREAD_CONDATTR_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_CONDATTR_DESTROY''@|$(REPLACE_PTHREAD_CONDATTR_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_COND_WAIT''@|$(REPLACE_PTHREAD_COND_WAIT)|g' \ -e 's|@''REPLACE_PTHREAD_COND_TIMEDWAIT''@|$(REPLACE_PTHREAD_COND_TIMEDWAIT)|g' \ -e 's|@''REPLACE_PTHREAD_COND_SIGNAL''@|$(REPLACE_PTHREAD_COND_SIGNAL)|g' \ -e 's|@''REPLACE_PTHREAD_COND_BROADCAST''@|$(REPLACE_PTHREAD_COND_BROADCAST)|g' \ -e 's|@''REPLACE_PTHREAD_COND_DESTROY''@|$(REPLACE_PTHREAD_COND_DESTROY)|g' \ -e 's|@''REPLACE_PTHREAD_KEY_CREATE''@|$(REPLACE_PTHREAD_KEY_CREATE)|g' \ -e 's|@''REPLACE_PTHREAD_SETSPECIFIC''@|$(REPLACE_PTHREAD_SETSPECIFIC)|g' \ -e 's|@''REPLACE_PTHREAD_GETSPECIFIC''@|$(REPLACE_PTHREAD_GETSPECIFIC)|g' \ -e 's|@''REPLACE_PTHREAD_KEY_DELETE''@|$(REPLACE_PTHREAD_KEY_DELETE)|g' \ -e 's|@''REPLACE_PTHREAD_SPIN_INIT''@|$(REPLACE_PTHREAD_SPIN_INIT)|g' \ -e 's|@''REPLACE_PTHREAD_SPIN_LOCK''@|$(REPLACE_PTHREAD_SPIN_LOCK)|g' \ -e 's|@''REPLACE_PTHREAD_SPIN_TRYLOCK''@|$(REPLACE_PTHREAD_SPIN_TRYLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_SPIN_UNLOCK''@|$(REPLACE_PTHREAD_SPIN_UNLOCK)|g' \ -e 's|@''REPLACE_PTHREAD_SPIN_DESTROY''@|$(REPLACE_PTHREAD_SPIN_DESTROY)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _Noreturn/r $(_NORETURN_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += pthread.h pthread.h-t EXTRA_DIST += pthread.in.h ## end gnulib module pthread-h ## begin gnulib module pthread-h-tests TESTS += test-pthread check_PROGRAMS += test-pthread EXTRA_DIST += test-pthread.c ## end gnulib module pthread-h-tests ## begin gnulib module pthread-thread EXTRA_DIST += pthread-thread.c EXTRA_libtests_a_SOURCES += pthread-thread.c ## end gnulib module pthread-thread ## begin gnulib module pthread-thread-tests TESTS += test-pthread-thread check_PROGRAMS += test-pthread-thread test_pthread_thread_LDADD = $(LDADD) @LIBPMULTITHREAD@ EXTRA_DIST += test-pthread-thread.c macros.h ## end gnulib module pthread-thread-tests ## begin gnulib module pthread_sigmask EXTRA_DIST += pthread_sigmask.c EXTRA_libtests_a_SOURCES += pthread_sigmask.c ## end gnulib module pthread_sigmask ## begin gnulib module pthread_sigmask-tests TESTS += test-pthread_sigmask1 test-pthread_sigmask2 check_PROGRAMS += test-pthread_sigmask1 test-pthread_sigmask2 test_pthread_sigmask1_LDADD = $(LDADD) @LIB_PTHREAD_SIGMASK@ test_pthread_sigmask2_LDADD = $(LDADD) @LIB_PTHREAD_SIGMASK@ @LIBMULTITHREAD@ EXTRA_DIST += test-pthread_sigmask1.c test-pthread_sigmask2.c signature.h macros.h ## end gnulib module pthread_sigmask-tests ## begin gnulib module putenv EXTRA_DIST += putenv.c EXTRA_libtests_a_SOURCES += putenv.c ## end gnulib module putenv ## begin gnulib module quotearg-simple-tests TESTS += test-quotearg-simple check_PROGRAMS += test-quotearg-simple test_quotearg_simple_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC) EXTRA_DIST += test-quotearg-simple.c test-quotearg.h macros.h zerosize-ptr.h ## end gnulib module quotearg-simple-tests ## begin gnulib module raise-tests TESTS += test-raise check_PROGRAMS += test-raise EXTRA_DIST += test-raise.c signature.h macros.h ## end gnulib module raise-tests ## begin gnulib module rawmemchr-tests TESTS += test-rawmemchr check_PROGRAMS += test-rawmemchr EXTRA_DIST += test-rawmemchr.c zerosize-ptr.h signature.h macros.h ## end gnulib module rawmemchr-tests ## begin gnulib module read-tests TESTS += test-read check_PROGRAMS += test-read EXTRA_DIST += test-read.c signature.h macros.h ## end gnulib module read-tests ## begin gnulib module realloc-gnu-tests TESTS += test-realloc-gnu check_PROGRAMS += test-realloc-gnu EXTRA_DIST += test-realloc-gnu.c macros.h ## end gnulib module realloc-gnu-tests ## begin gnulib module reallocarray-tests TESTS += test-reallocarray check_PROGRAMS += test-reallocarray EXTRA_DIST += test-reallocarray.c signature.h macros.h ## end gnulib module reallocarray-tests ## begin gnulib module regex-tests TESTS += test-regex check_PROGRAMS += test-regex test_regex_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) @LIBINTL@ $(LIBTHREAD) EXTRA_DIST += test-regex.c macros.h ## end gnulib module regex-tests ## begin gnulib module sched BUILT_SOURCES += sched.h # We need the following in order to create a replacement for <sched.h> when # the system doesn't have one. sched.h: sched.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_SCHED_H''@|$(HAVE_SCHED_H)|g' \ -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SCHED_H''@|$(NEXT_SCHED_H)|g' \ -e 's|@''HAVE_STRUCT_SCHED_PARAM''@|$(HAVE_STRUCT_SCHED_PARAM)|g' \ -e 's/@''GNULIB_SCHED_YIELD''@/$(GL_GNULIB_SCHED_YIELD)/g' \ -e 's|@''HAVE_SCHED_YIELD''@|$(HAVE_SCHED_YIELD)|g' \ -e 's|@''REPLACE_SCHED_YIELD''@|$(REPLACE_SCHED_YIELD)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sched.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += sched.h sched.h-t EXTRA_DIST += sched.in.h ## end gnulib module sched ## begin gnulib module sched-tests TESTS += test-sched check_PROGRAMS += test-sched EXTRA_DIST += test-sched.c ## end gnulib module sched-tests ## begin gnulib module select EXTRA_DIST += select.c EXTRA_libtests_a_SOURCES += select.c ## end gnulib module select ## begin gnulib module select-tests TESTS += test-select test-select-in.sh test-select-out.sh # test-select-stdin has to be run by hand. check_PROGRAMS += test-select test-select-fd test-select-stdin test_select_LDADD = $(LDADD) @LIB_SELECT@ @LIBSOCKET@ $(INET_PTON_LIB) test_select_fd_LDADD = $(LDADD) @LIB_SELECT@ test_select_stdin_LDADD = $(LDADD) @LIB_SELECT@ EXTRA_DIST += macros.h signature.h test-select.c test-select.h test-select-fd.c test-select-in.sh test-select-out.sh test-select-stdin.c ## end gnulib module select-tests ## begin gnulib module setenv EXTRA_DIST += setenv.c EXTRA_libtests_a_SOURCES += setenv.c ## end gnulib module setenv ## begin gnulib module setenv-tests TESTS += test-setenv check_PROGRAMS += test-setenv EXTRA_DIST += test-setenv.c signature.h macros.h ## end gnulib module setenv-tests ## begin gnulib module setlocale EXTRA_DIST += setlocale.c EXTRA_libtests_a_SOURCES += setlocale.c ## end gnulib module setlocale ## begin gnulib module setlocale-null-tests TESTS += \ test-setlocale_null \ test-setlocale_null-mt-one \ test-setlocale_null-mt-all check_PROGRAMS += \ test-setlocale_null \ test-setlocale_null-mt-one \ test-setlocale_null-mt-all test_setlocale_null_LDADD = $(LDADD) @LIB_SETLOCALE_NULL@ test_setlocale_null_mt_one_LDADD = $(LDADD) @LIB_SETLOCALE_NULL@ $(LIBMULTITHREAD) $(LIB_NANOSLEEP) test_setlocale_null_mt_all_LDADD = $(LDADD) @LIB_SETLOCALE_NULL@ $(LIBMULTITHREAD) $(LIB_NANOSLEEP) EXTRA_DIST += test-setlocale_null.c test-setlocale_null-mt-one.c test-setlocale_null-mt-all.c ## end gnulib module setlocale-null-tests ## begin gnulib module setlocale-tests TESTS += test-setlocale1.sh test-setlocale2.sh TESTS_ENVIRONMENT += \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-setlocale1 test-setlocale2 test_setlocale1_LDADD = $(LDADD) @LIB_SETLOCALE@ test_setlocale2_LDADD = $(LDADD) @LIB_SETLOCALE@ EXTRA_DIST += test-setlocale1.sh test-setlocale1.c test-setlocale2.sh test-setlocale2.c signature.h macros.h ## end gnulib module setlocale-tests ## begin gnulib module setsockopt EXTRA_DIST += setsockopt.c w32sock.h EXTRA_libtests_a_SOURCES += setsockopt.c ## end gnulib module setsockopt ## begin gnulib module setsockopt-tests TESTS += test-setsockopt check_PROGRAMS += test-setsockopt test_setsockopt_LDADD = $(LDADD) @LIBSOCKET@ EXTRA_DIST += test-setsockopt.c signature.h macros.h ## end gnulib module setsockopt-tests ## begin gnulib module sigaction libtests_a_SOURCES += sig-handler.c EXTRA_DIST += sig-handler.h sigaction.c EXTRA_libtests_a_SOURCES += sigaction.c ## end gnulib module sigaction ## begin gnulib module sigaction-tests TESTS += test-sigaction check_PROGRAMS += test-sigaction EXTRA_DIST += test-sigaction.c signature.h macros.h ## end gnulib module sigaction-tests ## begin gnulib module signal-h-tests TESTS += test-signal-h check_PROGRAMS += test-signal-h EXTRA_DIST += test-signal-h.c ## end gnulib module signal-h-tests ## begin gnulib module sigprocmask EXTRA_DIST += sigprocmask.c EXTRA_libtests_a_SOURCES += sigprocmask.c ## end gnulib module sigprocmask ## begin gnulib module sigprocmask-tests TESTS += test-sigprocmask check_PROGRAMS += test-sigprocmask EXTRA_DIST += test-sigprocmask.c signature.h macros.h ## end gnulib module sigprocmask-tests ## begin gnulib module sigsegv-tests TESTS += \ test-sigsegv-catch-segv1 \ test-sigsegv-catch-segv2 \ test-sigsegv-catch-stackoverflow1 \ test-sigsegv-catch-stackoverflow2 check_PROGRAMS += \ test-sigsegv-catch-segv1 \ test-sigsegv-catch-segv2 \ test-sigsegv-catch-stackoverflow1 \ test-sigsegv-catch-stackoverflow2 test_sigsegv_catch_segv1_LDADD = $(LDADD) $(LIBSIGSEGV) test_sigsegv_catch_segv2_LDADD = $(LDADD) $(LIBSIGSEGV) test_sigsegv_catch_stackoverflow1_LDADD = $(LDADD) $(LIBSIGSEGV) test_sigsegv_catch_stackoverflow2_LDADD = $(LDADD) $(LIBSIGSEGV) EXTRA_DIST += test-sigsegv-catch-segv1.c test-sigsegv-catch-segv2.c test-sigsegv-catch-stackoverflow1.c test-sigsegv-catch-stackoverflow2.c altstack-util.h mmap-anon-util.h ## end gnulib module sigsegv-tests ## begin gnulib module size_max libtests_a_SOURCES += size_max.h ## end gnulib module size_max ## begin gnulib module sleep EXTRA_DIST += sleep.c EXTRA_libtests_a_SOURCES += sleep.c ## end gnulib module sleep ## begin gnulib module sleep-tests TESTS += test-sleep check_PROGRAMS += test-sleep EXTRA_DIST += test-sleep.c signature.h macros.h ## end gnulib module sleep-tests ## begin gnulib module snippet/_Noreturn # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. _NORETURN_H=$(srcdir)/_Noreturn.h EXTRA_DIST += _Noreturn.h ## end gnulib module snippet/_Noreturn ## begin gnulib module snippet/arg-nonnull # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. ARG_NONNULL_H=$(srcdir)/arg-nonnull.h EXTRA_DIST += arg-nonnull.h ## end gnulib module snippet/arg-nonnull ## begin gnulib module snippet/c++defs # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. CXXDEFS_H=$(srcdir)/c++defs.h EXTRA_DIST += c++defs.h ## end gnulib module snippet/c++defs ## begin gnulib module snippet/warn-on-use # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. WARN_ON_USE_H=$(srcdir)/warn-on-use.h EXTRA_DIST += warn-on-use.h ## end gnulib module snippet/warn-on-use ## begin gnulib module snprintf EXTRA_DIST += snprintf.c EXTRA_libtests_a_SOURCES += snprintf.c ## end gnulib module snprintf ## begin gnulib module snprintf-tests TESTS += test-snprintf check_PROGRAMS += test-snprintf EXTRA_DIST += test-snprintf.c signature.h macros.h ## end gnulib module snprintf-tests ## begin gnulib module socket EXTRA_DIST += socket.c w32sock.h EXTRA_libtests_a_SOURCES += socket.c ## end gnulib module socket ## begin gnulib module sockets libtests_a_SOURCES += sockets.h sockets.c EXTRA_DIST += w32sock.h ## end gnulib module sockets ## begin gnulib module sockets-tests TESTS += test-sockets check_PROGRAMS += test-sockets test_sockets_LDADD = $(LDADD) @LIBSOCKET@ EXTRA_DIST += test-sockets.c ## end gnulib module sockets-tests ## begin gnulib module stat-tests TESTS += test-stat check_PROGRAMS += test-stat test_stat_LDADD = $(LDADD) $(LIBINTL) EXTRA_DIST += test-stat.h test-stat.c signature.h macros.h ## end gnulib module stat-tests ## begin gnulib module stat-time-tests TESTS += test-stat-time check_PROGRAMS += test-stat-time test_stat_time_LDADD = $(LDADD) $(LIB_NANOSLEEP) EXTRA_DIST += test-stat-time.c macros.h nap.h ## end gnulib module stat-time-tests ## begin gnulib module stdalign-tests TESTS += test-stdalign check_PROGRAMS += test-stdalign EXTRA_DIST += test-stdalign.c macros.h ## end gnulib module stdalign-tests ## begin gnulib module stdbool-tests TESTS += test-stdbool check_PROGRAMS += test-stdbool EXTRA_DIST += test-stdbool.c ## end gnulib module stdbool-tests ## begin gnulib module stddef-tests TESTS += test-stddef check_PROGRAMS += test-stddef EXTRA_DIST += test-stddef.c ## end gnulib module stddef-tests ## begin gnulib module stdint-tests TESTS += test-stdint check_PROGRAMS += test-stdint EXTRA_DIST += test-stdint.c ## end gnulib module stdint-tests ## begin gnulib module stdio-tests TESTS += test-stdio check_PROGRAMS += test-stdio EXTRA_DIST += test-stdio.c ## end gnulib module stdio-tests ## begin gnulib module stdlib-tests TESTS += test-stdlib check_PROGRAMS += test-stdlib EXTRA_DIST += test-stdlib.c test-sys_wait.h ## end gnulib module stdlib-tests ## begin gnulib module strerror-tests TESTS += test-strerror check_PROGRAMS += test-strerror EXTRA_DIST += test-strerror.c signature.h macros.h ## end gnulib module strerror-tests ## begin gnulib module strerror_r-posix EXTRA_DIST += strerror_r.c EXTRA_libtests_a_SOURCES += strerror_r.c ## end gnulib module strerror_r-posix ## begin gnulib module strerror_r-posix-tests TESTS += test-strerror_r check_PROGRAMS += test-strerror_r EXTRA_DIST += test-strerror_r.c signature.h macros.h ## end gnulib module strerror_r-posix-tests ## begin gnulib module striconv-tests TESTS += test-striconv check_PROGRAMS += test-striconv test_striconv_LDADD = $(LDADD) @LIBICONV@ EXTRA_DIST += test-striconv.c macros.h ## end gnulib module striconv-tests ## begin gnulib module string-tests TESTS += test-string check_PROGRAMS += test-string EXTRA_DIST += test-string.c ## end gnulib module string-tests ## begin gnulib module strnlen-tests TESTS += test-strnlen check_PROGRAMS += test-strnlen EXTRA_DIST += test-strnlen.c zerosize-ptr.h signature.h macros.h ## end gnulib module strnlen-tests ## begin gnulib module strstr-tests TESTS += test-strstr check_PROGRAMS += test-strstr EXTRA_DIST += test-strstr.c zerosize-ptr.h signature.h macros.h ## end gnulib module strstr-tests ## begin gnulib module strtoimax-tests TESTS += test-strtoimax check_PROGRAMS += test-strtoimax EXTRA_DIST += test-strtoimax.c signature.h macros.h ## end gnulib module strtoimax-tests ## begin gnulib module strtoll-tests TESTS += test-strtoll check_PROGRAMS += test-strtoll EXTRA_DIST += test-strtoll.c signature.h macros.h ## end gnulib module strtoll-tests ## begin gnulib module strtoull-tests TESTS += test-strtoull check_PROGRAMS += test-strtoull EXTRA_DIST += test-strtoull.c signature.h macros.h ## end gnulib module strtoull-tests ## begin gnulib module strtoumax-tests TESTS += test-strtoumax check_PROGRAMS += test-strtoumax EXTRA_DIST += test-strtoumax.c signature.h macros.h ## end gnulib module strtoumax-tests ## begin gnulib module symlink EXTRA_DIST += symlink.c EXTRA_libtests_a_SOURCES += symlink.c ## end gnulib module symlink ## begin gnulib module symlink-tests TESTS += test-symlink check_PROGRAMS += test-symlink EXTRA_DIST += test-symlink.h test-symlink.c signature.h macros.h ## end gnulib module symlink-tests ## begin gnulib module sys_ioctl BUILT_SOURCES += sys/ioctl.h # We need the following in order to create <sys/ioctl.h> when the system # does not have a complete one. sys/ioctl.h: sys_ioctl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_SYS_IOCTL_H''@|$(HAVE_SYS_IOCTL_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_IOCTL_H''@|$(NEXT_SYS_IOCTL_H)|g' \ -e 's/@''GNULIB_IOCTL''@/$(GL_GNULIB_IOCTL)/g' \ -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \ -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ -e 's|@''REPLACE_IOCTL''@|$(REPLACE_IOCTL)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_ioctl.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += sys/ioctl.h sys/ioctl.h-t MOSTLYCLEANDIRS += sys EXTRA_DIST += sys_ioctl.in.h ## end gnulib module sys_ioctl ## begin gnulib module sys_ioctl-tests TESTS += test-sys_ioctl check_PROGRAMS += test-sys_ioctl EXTRA_DIST += test-sys_ioctl.c ## end gnulib module sys_ioctl-tests ## begin gnulib module sys_select BUILT_SOURCES += sys/select.h # We need the following in order to create <sys/select.h> when the system # doesn't have one that works with the given compiler. sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \ -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \ -e 's/@''GNULIB_PSELECT''@/$(GL_GNULIB_PSELECT)/g' \ -e 's/@''GNULIB_SELECT''@/$(GL_GNULIB_SELECT)/g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_PSELECT''@|$(HAVE_PSELECT)|g' \ -e 's|@''REPLACE_PSELECT''@|$(REPLACE_PSELECT)|g' \ -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_select.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += sys/select.h sys/select.h-t MOSTLYCLEANDIRS += sys EXTRA_DIST += sys_select.in.h ## end gnulib module sys_select ## begin gnulib module sys_select-tests TESTS += test-sys_select check_PROGRAMS += test-sys_select EXTRA_DIST += test-sys_select.c signature.h ## end gnulib module sys_select-tests ## begin gnulib module sys_socket BUILT_SOURCES += sys/socket.h libtests_a_SOURCES += sys_socket.c # We need the following in order to create <sys/socket.h> when the system # doesn't have one that works with the given compiler. sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \ -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ -e 's/@''GNULIB_CLOSE''@/$(GL_GNULIB_CLOSE)/g' \ -e 's/@''GNULIB_SOCKET''@/$(GL_GNULIB_SOCKET)/g' \ -e 's/@''GNULIB_CONNECT''@/$(GL_GNULIB_CONNECT)/g' \ -e 's/@''GNULIB_ACCEPT''@/$(GL_GNULIB_ACCEPT)/g' \ -e 's/@''GNULIB_BIND''@/$(GL_GNULIB_BIND)/g' \ -e 's/@''GNULIB_GETPEERNAME''@/$(GL_GNULIB_GETPEERNAME)/g' \ -e 's/@''GNULIB_GETSOCKNAME''@/$(GL_GNULIB_GETSOCKNAME)/g' \ -e 's/@''GNULIB_GETSOCKOPT''@/$(GL_GNULIB_GETSOCKOPT)/g' \ -e 's/@''GNULIB_LISTEN''@/$(GL_GNULIB_LISTEN)/g' \ -e 's/@''GNULIB_RECV''@/$(GL_GNULIB_RECV)/g' \ -e 's/@''GNULIB_SEND''@/$(GL_GNULIB_SEND)/g' \ -e 's/@''GNULIB_RECVFROM''@/$(GL_GNULIB_RECVFROM)/g' \ -e 's/@''GNULIB_SENDTO''@/$(GL_GNULIB_SENDTO)/g' \ -e 's/@''GNULIB_SETSOCKOPT''@/$(GL_GNULIB_SETSOCKOPT)/g' \ -e 's/@''GNULIB_SHUTDOWN''@/$(GL_GNULIB_SHUTDOWN)/g' \ -e 's/@''GNULIB_ACCEPT4''@/$(GL_GNULIB_ACCEPT4)/g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \ -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY''@|$(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)|g' \ -e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \ -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_socket.in.h; \ } > $@-t && \ mv -f $@-t $@ MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t MOSTLYCLEANDIRS += sys EXTRA_DIST += sys_socket.in.h ## end gnulib module sys_socket ## begin gnulib module sys_socket-tests TESTS += test-sys_socket check_PROGRAMS += test-sys_socket EXTRA_DIST += test-sys_socket.c ## end gnulib module sys_socket-tests ## begin gnulib module sys_stat-tests TESTS += test-sys_stat check_PROGRAMS += test-sys_stat EXTRA_DIST += test-sys_stat.c ## end gnulib module sys_stat-tests ## begin gnulib module sys_time BUILT_SOURCES += sys/time.h # We need the following in order to create <sys/time.h> when the system # doesn't have one that works with the given compiler. sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \ -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GL_GNULIB_GETTIMEOFDAY)/g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \ -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \ -e 's/@''REPLACE_STRUCT_TIMEVAL''@/$(REPLACE_STRUCT_TIMEVAL)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_time.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += sys/time.h sys/time.h-t EXTRA_DIST += sys_time.in.h ## end gnulib module sys_time ## begin gnulib module sys_time-tests TESTS += test-sys_time check_PROGRAMS += test-sys_time EXTRA_DIST += test-sys_time.c ## end gnulib module sys_time-tests ## begin gnulib module sys_types-tests TESTS += test-sys_types check_PROGRAMS += test-sys_types EXTRA_DIST += test-sys_types.c ## end gnulib module sys_types-tests ## begin gnulib module sys_uio BUILT_SOURCES += sys/uio.h # We need the following in order to create <sys/uio.h> when the system # doesn't have one that works with the given compiler. sys/uio.h: sys_uio.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_UIO_H''@|$(NEXT_SYS_UIO_H)|g' \ -e 's|@''HAVE_SYS_UIO_H''@|$(HAVE_SYS_UIO_H)|g' \ < $(srcdir)/sys_uio.in.h; \ } > $@-t && \ mv -f $@-t $@ MOSTLYCLEANFILES += sys/uio.h sys/uio.h-t MOSTLYCLEANDIRS += sys EXTRA_DIST += sys_uio.in.h ## end gnulib module sys_uio ## begin gnulib module sys_uio-tests TESTS += test-sys_uio check_PROGRAMS += test-sys_uio EXTRA_DIST += test-sys_uio.c ## end gnulib module sys_uio-tests ## begin gnulib module test-framework-sh-tests TESTS += test-init.sh EXTRA_DIST += init.sh EXTRA_DIST += test-init.sh ## end gnulib module test-framework-sh-tests ## begin gnulib module thread libtests_a_SOURCES += glthread/thread.h glthread/thread.c ## end gnulib module thread ## begin gnulib module thread-optim EXTRA_DIST += thread-optim.h ## end gnulib module thread-optim ## begin gnulib module thread-tests TESTS += test-thread_self test-thread_create check_PROGRAMS += test-thread_self test-thread_create test_thread_self_LDADD = $(LDADD) @LIBTHREAD@ test_thread_create_LDADD = $(LDADD) @LIBMULTITHREAD@ EXTRA_DIST += test-thread_self.c test-thread_create.c macros.h ## end gnulib module thread-tests ## begin gnulib module time-tests TESTS += test-time check_PROGRAMS += test-time EXTRA_DIST += test-time.c ## end gnulib module time-tests ## begin gnulib module unistd-safer-tests TESTS += test-dup-safer check_PROGRAMS += test-dup-safer EXTRA_DIST += test-dup-safer.c macros.h ## end gnulib module unistd-safer-tests ## begin gnulib module unistd-tests TESTS += test-unistd check_PROGRAMS += test-unistd EXTRA_DIST += test-unistd.c ## end gnulib module unistd-tests ## begin gnulib module unistr/u8-mbtoucr-tests TESTS += test-u8-mbtoucr check_PROGRAMS += test-u8-mbtoucr test_u8_mbtoucr_SOURCES = unistr/test-u8-mbtoucr.c test_u8_mbtoucr_LDADD = $(LDADD) $(LIBUNISTRING) EXTRA_DIST += unistr/test-u8-mbtoucr.c macros.h ## end gnulib module unistr/u8-mbtoucr-tests ## begin gnulib module unistr/u8-uctomb-tests TESTS += test-u8-uctomb check_PROGRAMS += test-u8-uctomb test_u8_uctomb_SOURCES = unistr/test-u8-uctomb.c test_u8_uctomb_LDADD = $(LDADD) $(LIBUNISTRING) EXTRA_DIST += unistr/test-u8-uctomb.c macros.h ## end gnulib module unistr/u8-uctomb-tests ## begin gnulib module uniwidth/width-tests TESTS += test-uc_width uniwidth/test-uc_width2.sh check_PROGRAMS += test-uc_width test-uc_width2 test_uc_width_SOURCES = uniwidth/test-uc_width.c test_uc_width_LDADD = $(LDADD) $(LIBUNISTRING) test_uc_width2_SOURCES = uniwidth/test-uc_width2.c test_uc_width2_LDADD = $(LDADD) $(LIBUNISTRING) EXTRA_DIST += uniwidth/test-uc_width.c uniwidth/test-uc_width2.c uniwidth/test-uc_width2.sh macros.h ## end gnulib module uniwidth/width-tests ## begin gnulib module unsetenv EXTRA_DIST += unsetenv.c EXTRA_libtests_a_SOURCES += unsetenv.c ## end gnulib module unsetenv ## begin gnulib module unsetenv-tests TESTS += test-unsetenv check_PROGRAMS += test-unsetenv EXTRA_DIST += test-unsetenv.c signature.h macros.h ## end gnulib module unsetenv-tests ## begin gnulib module vasnprintf EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h EXTRA_libtests_a_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c ## end gnulib module vasnprintf ## begin gnulib module vasnprintf-tests TESTS += test-vasnprintf check_PROGRAMS += test-vasnprintf EXTRA_DIST += test-vasnprintf.c macros.h ## end gnulib module vasnprintf-tests ## begin gnulib module vc-list-files-tests TESTS += test-vc-list-files-git.sh TESTS += test-vc-list-files-cvs.sh TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)' EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh ## end gnulib module vc-list-files-tests ## begin gnulib module verify-tests TESTS_ENVIRONMENT += MAKE='$(MAKE)' TESTS += test-verify test-verify.sh check_PROGRAMS += test-verify # test-verify-try is never built, but test-verify.sh needs a rule to # build test-verify-try.o. EXTRA_PROGRAMS += test-verify-try # This test expects compilation of test-verify-try.c to fail, and # each time it fails, the makefile rule does not perform the usual # "mv -f $name.Tpo $name.po, so tell make clean to remove that file. MOSTLYCLEANFILES += .deps/test-verify-try.Tpo EXTRA_DIST += test-verify.c test-verify-try.c test-verify.sh ## end gnulib module verify-tests ## begin gnulib module version-etc-tests TESTS += test-version-etc.sh check_PROGRAMS += test-version-etc test_version_etc_LDADD = $(LDADD) @LIBINTL@ EXTRA_DIST += test-version-etc.c test-version-etc.sh ## end gnulib module version-etc-tests ## begin gnulib module wchar-tests TESTS += test-wchar check_PROGRAMS += test-wchar EXTRA_DIST += test-wchar.c ## end gnulib module wchar-tests ## begin gnulib module wcrtomb-tests TESTS += \ test-wcrtomb.sh \ test-wcrtomb-w32-1.sh test-wcrtomb-w32-2.sh test-wcrtomb-w32-3.sh \ test-wcrtomb-w32-4.sh test-wcrtomb-w32-5.sh test-wcrtomb-w32-6.sh \ test-wcrtomb-w32-7.sh TESTS_ENVIRONMENT += \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-wcrtomb test-wcrtomb-w32 test_wcrtomb_LDADD = $(LDADD) $(LIB_SETLOCALE) EXTRA_DIST += test-wcrtomb.sh test-wcrtomb.c test-wcrtomb-w32-1.sh test-wcrtomb-w32-2.sh test-wcrtomb-w32-3.sh test-wcrtomb-w32-4.sh test-wcrtomb-w32-5.sh test-wcrtomb-w32-6.sh test-wcrtomb-w32-7.sh test-wcrtomb-w32.c signature.h macros.h ## end gnulib module wcrtomb-tests ## begin gnulib module wctype-h-tests TESTS += test-wctype-h check_PROGRAMS += test-wctype-h EXTRA_DIST += test-wctype-h.c macros.h ## end gnulib module wctype-h-tests ## begin gnulib module wcwidth-tests TESTS += test-wcwidth check_PROGRAMS += test-wcwidth test_wcwidth_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) EXTRA_DIST += test-wcwidth.c signature.h macros.h ## end gnulib module wcwidth-tests ## begin gnulib module windows-thread EXTRA_DIST += windows-thread.c windows-thread.h EXTRA_libtests_a_SOURCES += windows-thread.c ## end gnulib module windows-thread ## begin gnulib module windows-tls EXTRA_DIST += windows-tls.c windows-tls.h EXTRA_libtests_a_SOURCES += windows-tls.c ## end gnulib module windows-tls ## begin gnulib module xalloc-die-tests TESTS += test-xalloc-die.sh check_PROGRAMS += test-xalloc-die test_xalloc_die_LDADD = $(LDADD) @LIBINTL@ EXTRA_DIST += test-xalloc-die.c test-xalloc-die.sh ## end gnulib module xalloc-die-tests ## begin gnulib module xsize libtests_a_SOURCES += xsize.h xsize.c ## end gnulib module xsize ## begin gnulib module xstrtoimax-tests TESTS += test-xstrtoimax.sh check_PROGRAMS += test-xstrtoimax test_xstrtoimax_LDADD = $(LDADD) @LIBINTL@ EXTRA_DIST += test-xstrtoimax.c test-xstrtoimax.sh ## end gnulib module xstrtoimax-tests ## begin gnulib module xstrtol-error libtests_a_SOURCES += xstrtol-error.c EXTRA_DIST += xstrtol-error.h ## end gnulib module xstrtol-error ## begin gnulib module xstrtol-tests TESTS += test-xstrtol.sh check_PROGRAMS += test-xstrtol test-xstrtoul test_xstrtol_LDADD = $(LDADD) @LIBINTL@ test_xstrtoul_LDADD = $(LDADD) @LIBINTL@ EXTRA_DIST += test-xstrtol.c test-xstrtoul.c test-xstrtol.sh ## end gnulib module xstrtol-tests all: all-notice all-notice: @echo '## ---------------------------------------------------- ##' @echo '## ------------------- Gnulib tests ------------------- ##' @echo '## You can ignore compiler warnings in this directory. ##' @echo '## ---------------------------------------------------- ##' check-am: check-notice check-notice: @echo '## ---------------------------------------------------------------------- ##' @echo '## ---------------------------- Gnulib tests ---------------------------- ##' @echo '## Please report test failures in this directory to <bug-gnulib@gnu.org>. ##' @echo '## ---------------------------------------------------------------------- ##' # Clean up after Solaris cc. clean-local: rm -rf SunWS_cache mostlyclean-local: mostlyclean-generic @for dir in '' $(MOSTLYCLEANDIRS); do \ if test -n "$$dir" && test -d $$dir; then \ echo "rmdir $$dir"; rmdir $$dir; \ fi; \ done; \ : ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sys_uio.c����������������������������������������������������0000664�0001750�0001750�00000001736�14670377437�021716� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <sys/uio.h> substitute. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <eblake@redhat.com>, 2011. */ #include <config.h> #include <sys/uio.h> /* Check that necessary types are defined. */ size_t a; ssize_t b; struct iovec c; int main (void) { return a + b + !!c.iov_base + c.iov_len; } ����������������������������������kbuild-3608/src/grep/gnulib-tests/snprintf.c��������������������������������������������������������0000664�0001750�0001750�00000003565�14670377431�021106� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Formatted output to strings. Copyright (C) 2004, 2006-2021 Free Software Foundation, Inc. Written by Simon Josefsson and Paul Eggert. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <stdio.h> #include <errno.h> #include <limits.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include "vasnprintf.h" /* Print formatted output to string STR. Similar to sprintf, but additional length SIZE limit how much is written into STR. Returns string length of formatted string (which may be larger than SIZE). STR may be NULL, in which case nothing will be written. On error, return a negative value. */ int snprintf (char *str, size_t size, const char *format, ...) { char *output; size_t len; size_t lenbuf = size; va_list args; va_start (args, format); output = vasnprintf (str, &lenbuf, format, args); len = lenbuf; va_end (args); if (!output) return -1; if (output != str) { if (size) { size_t pruned_len = (len < size ? len : size - 1); memcpy (str, output, pruned_len); str[pruned_len] = '\0'; } free (output); } if (INT_MAX < len) { errno = EOVERFLOW; return -1; } return len; } �������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-hash.c�������������������������������������������������������0000664�0001750�0001750�00000015102�14670377436�021136� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2009-2021 Free Software Foundation, Inc. * Written by Jim Meyering * * 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include "hash.h" #include "hash-pjw.h" #include "inttostr.h" #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <unistd.h> #include "macros.h" #define STREQ(a, b) (strcmp (a, b) == 0) #define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) static bool hash_compare_strings (void const *x, void const *y) { ASSERT (x != y); return STREQ (x, y) ? true : false; } static void hash_freer (void *x) { free (x); } static void insert_new (Hash_table *ht, const void *ent) { void *e = hash_insert (ht, ent); ASSERT (e == ent); } static bool walk (void *ent, void *data) { char *str = ent; unsigned int *map = data; switch (*str) { case 'a': *map |= 1; return true; case 'b': *map |= 2; return true; case 'c': *map |= 4; return true; } *map |= 8; return false; } static int get_seed (char const *str, unsigned int *seed) { size_t len = strlen (str); if (len == 0 || strspn (str, "0123456789") != len || 10 < len) return 1; *seed = atoi (str); return 0; } int main (int argc, char **argv) { unsigned int i; unsigned int k; unsigned int table_size[] = {1, 2, 3, 4, 5, 23, 53}; Hash_table *ht; Hash_tuning tuning; hash_reset_tuning (&tuning); tuning.shrink_threshold = 0.3; tuning.shrink_factor = 0.707; tuning.growth_threshold = 1.5; tuning.growth_factor = 2.0; tuning.is_n_buckets = true; if (1 < argc) { unsigned int seed; if (get_seed (argv[1], &seed) != 0) { fprintf (stderr, "invalid seed: %s\n", argv[1]); exit (EXIT_FAILURE); } srand (seed); } for (i = 0; i < ARRAY_CARDINALITY (table_size); i++) { size_t sz = table_size[i]; ht = hash_initialize (sz, NULL, hash_pjw, hash_compare_strings, NULL); ASSERT (ht); insert_new (ht, "a"); { char *str1 = strdup ("a"); char *str2; ASSERT (str1); str2 = hash_insert (ht, str1); ASSERT (str1 != str2); ASSERT (STREQ (str1, str2)); free (str1); } insert_new (ht, "b"); insert_new (ht, "c"); i = 0; ASSERT (hash_do_for_each (ht, walk, &i) == 3); ASSERT (i == 7); { void *buf[5] = { NULL }; ASSERT (hash_get_entries (ht, NULL, 0) == 0); ASSERT (hash_get_entries (ht, buf, 5) == 3); ASSERT (STREQ (buf[0], "a") || STREQ (buf[0], "b") || STREQ (buf[0], "c")); } ASSERT (hash_remove (ht, "a")); ASSERT (hash_remove (ht, "a") == NULL); ASSERT (hash_remove (ht, "b")); ASSERT (hash_remove (ht, "c")); ASSERT (hash_rehash (ht, 47)); ASSERT (hash_rehash (ht, 467)); /* Free an empty table. */ hash_clear (ht); hash_free (ht); ht = hash_initialize (sz, NULL, hash_pjw, hash_compare_strings, NULL); ASSERT (ht); insert_new (ht, "z"); insert_new (ht, "y"); insert_new (ht, "x"); insert_new (ht, "w"); insert_new (ht, "v"); insert_new (ht, "u"); hash_clear (ht); ASSERT (hash_get_n_entries (ht) == 0); hash_free (ht); /* Test pointer hashing. */ ht = hash_initialize (sz, NULL, NULL, NULL, NULL); ASSERT (ht); { char *str = strdup ("a"); ASSERT (str); insert_new (ht, "a"); insert_new (ht, str); ASSERT (hash_lookup (ht, str) == str); free (str); } hash_free (ht); } hash_reset_tuning (&tuning); tuning.shrink_threshold = 0.3; tuning.shrink_factor = 0.707; tuning.growth_threshold = 1.5; tuning.growth_factor = 2.0; tuning.is_n_buckets = true; /* Invalid tuning. */ ht = hash_initialize (4651, &tuning, hash_pjw, hash_compare_strings, hash_freer); ASSERT (!ht); /* Alternate tuning. */ tuning.growth_threshold = 0.89; /* Run with default tuning, then with custom tuning settings. */ for (k = 0; k < 2; k++) { Hash_tuning const *tune = (k == 0 ? NULL : &tuning); /* Now, each entry is malloc'd. */ ht = hash_initialize (4651, tune, hash_pjw, hash_compare_strings, hash_freer); ASSERT (ht); for (i = 0; i < 10000; i++) { unsigned int op = rand () % 10; switch (op) { case 0: case 1: case 2: case 3: case 4: case 5: { char buf[50]; char const *p = uinttostr (i, buf); char *p_dup = strdup (p); ASSERT (p_dup); insert_new (ht, p_dup); } break; case 6: { size_t n = hash_get_n_entries (ht); ASSERT (hash_rehash (ht, n + rand () % 20)); } break; case 7: { size_t n = hash_get_n_entries (ht); size_t delta = rand () % 20; if (delta < n) ASSERT (hash_rehash (ht, n - delta)); } break; case 8: case 9: { /* Delete a random entry. */ size_t n = hash_get_n_entries (ht); if (n) { size_t kk = rand () % n; void const *p; void *v; for (p = hash_get_first (ht); kk; --kk, p = hash_get_next (ht, p)) { /* empty */ } ASSERT (p); v = hash_remove (ht, p); ASSERT (v); free (v); } break; } } ASSERT (hash_table_ok (ht)); } hash_free (ht); } return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/setenv.c����������������������������������������������������������0000664�0001750�0001750�00000025077�14670377430�020550� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1992, 1995-2003, 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. 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 Lesser General Public License for more details. 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/>. */ #if !_LIBC /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc optimizes away the name == NULL test below. */ # define _GL_ARG_NONNULL(params) # define _GL_USE_STDLIB_ALLOC 1 # include <config.h> #endif #include <alloca.h> /* Specification. */ #include <stdlib.h> #include <errno.h> #ifndef __set_errno # define __set_errno(ev) ((errno) = (ev)) #endif #include <string.h> #if _LIBC || HAVE_UNISTD_H # include <unistd.h> #endif #if !_LIBC # include "malloca.h" #endif #if _LIBC || !HAVE_SETENV #if !_LIBC # define __environ environ #endif #if _LIBC /* This lock protects against simultaneous modifications of 'environ'. */ # include <bits/libc-lock.h> __libc_lock_define_initialized (static, envlock) # define LOCK __libc_lock_lock (envlock) # define UNLOCK __libc_lock_unlock (envlock) #else # define LOCK # define UNLOCK #endif /* In the GNU C library we must keep the namespace clean. */ #ifdef _LIBC # define setenv __setenv # define clearenv __clearenv # define tfind __tfind # define tsearch __tsearch #endif /* In the GNU C library implementation we try to be more clever and allow arbitrarily many changes of the environment given that the used values are from a small set. Outside glibc this will eat up all memory after a while. */ #if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \ && (defined __GNUC__ || defined __clang__)) # define USE_TSEARCH 1 # include <search.h> typedef int (*compar_fn_t) (const void *, const void *); /* This is a pointer to the root of the search tree with the known values. */ static void *known_values; # define KNOWN_VALUE(Str) \ ({ \ void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ value != NULL ? *(char **) value : NULL; \ }) # define STORE_VALUE(Str) \ tsearch (Str, &known_values, (compar_fn_t) strcmp) #else # undef USE_TSEARCH # define KNOWN_VALUE(Str) NULL # define STORE_VALUE(Str) do { } while (0) #endif /* If this variable is not a null pointer we allocated the current environment. */ static char **last_environ; /* This function is used by 'setenv' and 'putenv'. The difference between the two functions is that for the former must create a new string which is then placed in the environment, while the argument of 'putenv' must be used directly. This is all complicated by the fact that we try to reuse values once generated for a 'setenv' call since we can never free the strings. */ int __add_to_environ (const char *name, const char *value, const char *combined, int replace) { char **ep; size_t size; const size_t namelen = strlen (name); const size_t vallen = value != NULL ? strlen (value) + 1 : 0; LOCK; /* We have to get the pointer now that we have the lock and not earlier since another thread might have created a new environment. */ ep = __environ; size = 0; if (ep != NULL) { for (; *ep != NULL; ++ep) if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') break; else ++size; } if (ep == NULL || *ep == NULL) { char **new_environ; #ifdef USE_TSEARCH char *new_value; #endif /* We allocated this space; we can extend it. */ new_environ = (char **) (last_environ == NULL ? malloc ((size + 2) * sizeof (char *)) : realloc (last_environ, (size + 2) * sizeof (char *))); if (new_environ == NULL) { /* It's easier to set errno to ENOMEM than to rely on the 'malloc-posix' and 'realloc-posix' gnulib modules. */ __set_errno (ENOMEM); UNLOCK; return -1; } /* If the whole entry is given add it. */ if (combined != NULL) /* We must not add the string to the search tree since it belongs to the user. */ new_environ[size] = (char *) combined; else { /* See whether the value is already known. */ #ifdef USE_TSEARCH # ifdef _LIBC new_value = (char *) alloca (namelen + 1 + vallen); __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), value, vallen); # else new_value = (char *) malloca (namelen + 1 + vallen); if (new_value == NULL) { __set_errno (ENOMEM); UNLOCK; return -1; } memcpy (new_value, name, namelen); new_value[namelen] = '='; memcpy (&new_value[namelen + 1], value, vallen); # endif new_environ[size] = KNOWN_VALUE (new_value); if (new_environ[size] == NULL) #endif { new_environ[size] = (char *) malloc (namelen + 1 + vallen); if (new_environ[size] == NULL) { #if defined USE_TSEARCH && !defined _LIBC freea (new_value); #endif __set_errno (ENOMEM); UNLOCK; return -1; } #ifdef USE_TSEARCH memcpy (new_environ[size], new_value, namelen + 1 + vallen); #else memcpy (new_environ[size], name, namelen); new_environ[size][namelen] = '='; memcpy (&new_environ[size][namelen + 1], value, vallen); #endif /* And save the value now. We cannot do this when we remove the string since then we cannot decide whether it is a user string or not. */ STORE_VALUE (new_environ[size]); } #if defined USE_TSEARCH && !defined _LIBC freea (new_value); #endif } if (__environ != last_environ) memcpy ((char *) new_environ, (char *) __environ, size * sizeof (char *)); new_environ[size + 1] = NULL; last_environ = __environ = new_environ; } else if (replace) { char *np; /* Use the user string if given. */ if (combined != NULL) np = (char *) combined; else { #ifdef USE_TSEARCH char *new_value; # ifdef _LIBC new_value = alloca (namelen + 1 + vallen); __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), value, vallen); # else new_value = malloca (namelen + 1 + vallen); if (new_value == NULL) { __set_errno (ENOMEM); UNLOCK; return -1; } memcpy (new_value, name, namelen); new_value[namelen] = '='; memcpy (&new_value[namelen + 1], value, vallen); # endif np = KNOWN_VALUE (new_value); if (np == NULL) #endif { np = (char *) malloc (namelen + 1 + vallen); if (np == NULL) { #if defined USE_TSEARCH && !defined _LIBC freea (new_value); #endif __set_errno (ENOMEM); UNLOCK; return -1; } #ifdef USE_TSEARCH memcpy (np, new_value, namelen + 1 + vallen); #else memcpy (np, name, namelen); np[namelen] = '='; memcpy (&np[namelen + 1], value, vallen); #endif /* And remember the value. */ STORE_VALUE (np); } #if defined USE_TSEARCH && !defined _LIBC freea (new_value); #endif } *ep = np; } UNLOCK; return 0; } int setenv (const char *name, const char *value, int replace) { if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { __set_errno (EINVAL); return -1; } return __add_to_environ (name, value, NULL, replace); } /* The 'clearenv' was planned to be added to POSIX.1 but probably never made it. Nevertheless the POSIX.9 standard (POSIX bindings for Fortran 77) requires this function. */ int clearenv (void) { LOCK; if (__environ == last_environ && __environ != NULL) { /* We allocated this environment so we can free it. */ free (__environ); last_environ = NULL; } /* Clear the environment pointer removes the whole environment. */ __environ = NULL; UNLOCK; return 0; } #ifdef _LIBC static void free_mem (void) { /* Remove all traces. */ clearenv (); /* Now remove the search tree. */ __tdestroy (known_values, free); known_values = NULL; } text_set_element (__libc_subfreeres, free_mem); # undef setenv # undef clearenv weak_alias (__setenv, setenv) weak_alias (__clearenv, clearenv) #endif #endif /* _LIBC || !HAVE_SETENV */ /* The rest of this file is called into use when replacing an existing but buggy setenv. Known bugs include failure to diagnose invalid name, and consuming a leading '=' from value. */ #if HAVE_SETENV # undef setenv # if !HAVE_DECL_SETENV extern int setenv (const char *, const char *, int); # endif # define STREQ(a, b) (strcmp (a, b) == 0) int rpl_setenv (const char *name, const char *value, int replace) { int result; if (!name || !*name || strchr (name, '=')) { errno = EINVAL; return -1; } /* Call the real setenv even if replace is 0, in case implementation has underlying data to update, such as when environ changes. */ result = setenv (name, value, replace); if (result == 0 && replace && *value == '=') { char *tmp = getenv (name); if (!STREQ (tmp, value)) { int saved_errno; size_t len = strlen (value); tmp = malloca (len + 2); /* Since leading '=' is eaten, double it up. */ *tmp = '='; memcpy (tmp + 1, value, len + 1); result = setenv (name, tmp, replace); saved_errno = errno; freea (tmp); errno = saved_errno; } } return result; } #endif /* HAVE_SETENV */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sig-handler.c�����������������������������������������������������0000664�0001750�0001750�00000001552�14670377436�021437� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Convenience declarations when working with <signal.h>. Copyright (C) 2012-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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> #define SIG_HANDLER_INLINE _GL_EXTERN_INLINE #include "sig-handler.h" ������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-exclude6.sh��������������������������������������������������0000775�0001750�0001750�00000002357�14670377431�022130� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test suite for exclude. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . fail=0 # Test anchored cat > in <<EOT foo* bar Baz EOT cat > expected <<EOT bar: 1 foo/bar: 0 EOT ${CHECKER} test-exclude -anchored in -- bar foo/bar > out || exit $? # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac # normalize output LC_ALL=C tr -d "$cr" < out > k && mv k out compare expected out || fail=1 Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-pthread_sigmask2.c�������������������������������������������0000664�0001750�0001750�00000005146�14670377436�023451� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of pthread_sigmask in a multi-threaded program. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2011. */ #include <config.h> #include <signal.h> #include <errno.h> #include <pthread.h> #include <stdio.h> #include <unistd.h> #include "macros.h" #if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS static pthread_t main_thread; static pthread_t killer_thread; static void * killer_thread_func (void *arg) { sleep (1); pthread_kill (main_thread, SIGINT); return NULL; } static volatile int sigint_occurred; static void sigint_handler (int sig) { sigint_occurred++; } int main (int argc, char *argv[]) { sigset_t set; signal (SIGINT, sigint_handler); sigemptyset (&set); sigaddset (&set, SIGINT); /* Check error handling. */ /* This call returns 0 on NetBSD 8.0. */ #if !defined __NetBSD__ ASSERT (pthread_sigmask (1729, &set, NULL) == EINVAL); #endif /* Block SIGINT. */ ASSERT (pthread_sigmask (SIG_BLOCK, &set, NULL) == 0); /* Request a SIGINT signal from another thread. */ main_thread = pthread_self (); ASSERT (pthread_create (&killer_thread, NULL, killer_thread_func, NULL) == 0); /* Wait. */ sleep (2); /* The signal should not have arrived yet, because it is blocked. */ ASSERT (sigint_occurred == 0); /* Unblock SIGINT. */ ASSERT (pthread_sigmask (SIG_UNBLOCK, &set, NULL) == 0); /* The signal should have arrived now, because POSIX says "If there are any pending unblocked signals after the call to pthread_sigmask(), at least one of those signals shall be delivered before the call to pthread_sigmask() returns." */ ASSERT (sigint_occurred == 1); /* Clean up the thread. This avoid a "ThreadSanitizer: thread leak" warning from "gcc -fsanitize=thread". */ ASSERT (pthread_join (killer_thread, NULL) == 0); return 0; } #else int main () { fputs ("Skipping test: POSIX threads not enabled\n", stderr); return 77; } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-lseek.sh�����������������������������������������������������0000775�0001750�0001750�00000000650�14670377436�021513� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh tmpfiles= trap 'rm -fr $tmpfiles' 1 2 3 15 tmpfiles=t-lseek.tmp # seekable files ${CHECKER} ./test-lseek${EXEEXT} 0 < "$srcdir/test-lseek.sh" > t-lseek.tmp || exit 1 # pipes echo hi | { ${CHECKER} ./test-lseek${EXEEXT} 1; echo $? > t-lseek.tmp; cat > /dev/null; } | cat test "`cat t-lseek.tmp`" = "0" || exit 1 # closed descriptors ${CHECKER} ./test-lseek${EXEEXT} 2 <&- >&- || exit 1 rm -rf $tmpfiles exit 0 ����������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sys_time.in.h�����������������������������������������������������0000664�0001750�0001750�00000017450�14670377431�021507� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Provide a more complete sys/time.h. Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paul Eggert. */ #ifndef _@GUARD_PREFIX@_SYS_TIME_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* On Cygwin and on many BSDish systems, <sys/time.h> includes itself recursively via <sys/select.h>. Simply delegate to the system's header in this case; it is a no-op. Without this extra ifdef, the C++ gettimeofday declaration below would be a forward declaration in gnulib's nested <sys/time.h>. */ #if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_ # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ #else /* The include_next requires a split double-inclusion guard. */ #if @HAVE_SYS_TIME_H@ # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ #endif #ifndef _@GUARD_PREFIX@_SYS_TIME_H #define _@GUARD_PREFIX@_SYS_TIME_H #if ! @HAVE_SYS_TIME_H@ # include <time.h> #endif /* On native Windows with MSVC, get the 'struct timeval' type. Also, on native Windows with a 64-bit time_t, where we are overriding the 'struct timeval' type, get all declarations of system functions whose signature contains 'struct timeval'. */ #if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H # define _GL_INCLUDING_WINSOCK2_H # include <winsock2.h> # undef _GL_INCLUDING_WINSOCK2_H #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ #ifdef __cplusplus extern "C" { #endif #if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@ # if @REPLACE_STRUCT_TIMEVAL@ # define timeval rpl_timeval # endif # if !GNULIB_defined_struct_timeval struct timeval { time_t tv_sec; long int tv_usec; }; # define GNULIB_defined_struct_timeval 1 # endif #endif #ifdef __cplusplus } #endif #if @GNULIB_GETTIMEOFDAY@ # if @REPLACE_GETTIMEOFDAY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gettimeofday # define gettimeofday rpl_gettimeofday # endif _GL_FUNCDECL_RPL (gettimeofday, int, (struct timeval *restrict, void *restrict) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (gettimeofday, int, (struct timeval *restrict, void *restrict)); # else # if !@HAVE_GETTIMEOFDAY@ _GL_FUNCDECL_SYS (gettimeofday, int, (struct timeval *restrict, void *restrict) _GL_ARG_NONNULL ((1))); # endif /* Need to cast, because on glibc systems, by default, the second argument is struct timezone *. */ _GL_CXXALIAS_SYS_CAST (gettimeofday, int, (struct timeval *restrict, void *restrict)); # endif _GL_CXXALIASWARN (gettimeofday); # if defined __cplusplus && defined GNULIB_NAMESPACE namespace GNULIB_NAMESPACE { typedef ::timeval # undef timeval timeval; # if @REPLACE_STRUCT_TIMEVAL@ # define timeval rpl_timeval typedef ::timeval timeval; # endif } # endif #elif defined GNULIB_POSIXCHECK # undef gettimeofday # if HAVE_RAW_DECL_GETTIMEOFDAY _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " "use gnulib module gettimeofday for portability"); # endif #endif /* Hide some function declarations from <winsock2.h>. */ #if defined _MSC_VER && @HAVE_WINSOCK2_H@ # if !defined _@GUARD_PREFIX@_UNISTD_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef close # define close close_used_without_including_unistd_h # elif !defined __clang__ _GL_WARN_ON_USE (close, "close() used without including <unistd.h>"); # endif # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gethostname # define gethostname gethostname_used_without_including_unistd_h # else _GL_WARN_ON_USE (gethostname, "gethostname() used without including <unistd.h>"); # endif # endif # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef socket # define socket socket_used_without_including_sys_socket_h # undef connect # define connect connect_used_without_including_sys_socket_h # undef accept # define accept accept_used_without_including_sys_socket_h # undef bind # define bind bind_used_without_including_sys_socket_h # undef getpeername # define getpeername getpeername_used_without_including_sys_socket_h # undef getsockname # define getsockname getsockname_used_without_including_sys_socket_h # undef getsockopt # define getsockopt getsockopt_used_without_including_sys_socket_h # undef listen # define listen listen_used_without_including_sys_socket_h # undef recv # define recv recv_used_without_including_sys_socket_h # undef send # define send send_used_without_including_sys_socket_h # undef recvfrom # define recvfrom recvfrom_used_without_including_sys_socket_h # undef sendto # define sendto sendto_used_without_including_sys_socket_h # undef setsockopt # define setsockopt setsockopt_used_without_including_sys_socket_h # undef shutdown # define shutdown shutdown_used_without_including_sys_socket_h # else _GL_WARN_ON_USE (socket, "socket() used without including <sys/socket.h>"); _GL_WARN_ON_USE (connect, "connect() used without including <sys/socket.h>"); _GL_WARN_ON_USE (accept, "accept() used without including <sys/socket.h>"); _GL_WARN_ON_USE (bind, "bind() used without including <sys/socket.h>"); _GL_WARN_ON_USE (getpeername, "getpeername() used without including <sys/socket.h>"); _GL_WARN_ON_USE (getsockname, "getsockname() used without including <sys/socket.h>"); _GL_WARN_ON_USE (getsockopt, "getsockopt() used without including <sys/socket.h>"); _GL_WARN_ON_USE (listen, "listen() used without including <sys/socket.h>"); _GL_WARN_ON_USE (recv, "recv() used without including <sys/socket.h>"); _GL_WARN_ON_USE (send, "send() used without including <sys/socket.h>"); _GL_WARN_ON_USE (recvfrom, "recvfrom() used without including <sys/socket.h>"); _GL_WARN_ON_USE (sendto, "sendto() used without including <sys/socket.h>"); _GL_WARN_ON_USE (setsockopt, "setsockopt() used without including <sys/socket.h>"); _GL_WARN_ON_USE (shutdown, "shutdown() used without including <sys/socket.h>"); # endif # endif # if !defined _@GUARD_PREFIX@_SYS_SELECT_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef select # define select select_used_without_including_sys_select_h # else _GL_WARN_ON_USE (select, "select() used without including <sys/select.h>"); # endif # endif #endif #endif /* _@GUARD_PREFIX@_SYS_TIME_H */ #endif /* _CYGWIN_SYS_TIME_H */ #endif /* _@GUARD_PREFIX@_SYS_TIME_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/gettimeofday.c����������������������������������������������������0000664�0001750�0001750�00000011304�14670377430�021711� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Provide gettimeofday for systems that don't have it or for which it's broken. Copyright (C) 2001-2003, 2005-2007, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* written by Jim Meyering */ #include <config.h> /* Specification. */ #include <sys/time.h> #include <time.h> #if defined _WIN32 && ! defined __CYGWIN__ # define WINDOWS_NATIVE # include <windows.h> #endif #ifdef WINDOWS_NATIVE /* Don't assume that UNICODE is not defined. */ # undef LoadLibrary # define LoadLibrary LoadLibraryA # 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 # define GetSystemTimePreciseAsFileTimeFunc GetSystemTimePreciseAsFileTime # endif #endif /* 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) { #undef gettimeofday #ifdef WINDOWS_NATIVE /* 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; # if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) if (!initialized) initialize (); # endif if (GetSystemTimePreciseAsFileTimeFunc != NULL) GetSystemTimePreciseAsFileTimeFunc (¤t_time); else GetSystemTimeAsFileTime (¤t_time); /* 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->tv_sec = microseconds_since_1970 / (ULONGLONG) 1000000; tv->tv_usec = microseconds_since_1970 % (ULONGLONG) 1000000; return 0; #else # if HAVE_GETTIMEOFDAY # if defined timeval /* 'struct timeval' overridden by gnulib? */ # undef timeval struct timeval otv; int result = gettimeofday (&otv, (struct timezone *) tz); if (result == 0) { tv->tv_sec = otv.tv_sec; tv->tv_usec = otv.tv_usec; } # else int result = gettimeofday (tv, (struct timezone *) tz); # endif return result; # else # if !defined OK_TO_USE_1S_CLOCK # error "Only 1-second nominal clock resolution found. Is that intended?" \ "If so, compile with the -DOK_TO_USE_1S_CLOCK option." # endif tv->tv_sec = time (NULL); tv->tv_usec = 0; return 0; # endif #endif } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-iconv.c������������������������������������������������������0000664�0001750�0001750�00000012145�14670377436�021335� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of character set conversion. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #if HAVE_ICONV # include <iconv.h> # ifndef ICONV_CONST # define ICONV_CONST /* empty */ # endif #include "signature.h" SIGNATURE_CHECK (iconv, size_t, (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *)); SIGNATURE_CHECK (iconv_close, int, (iconv_t x)); SIGNATURE_CHECK (iconv_open, iconv_t, (char const *, char const *)); #endif #include <errno.h> #include <string.h> #include "macros.h" int main () { #if HAVE_ICONV /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1, and UTF-8. */ iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8"); #if defined __MVS__ && defined __IBMC__ /* String literals below are in ASCII, not EBCDIC. */ # pragma convert("ISO8859-1") # define CONVERT_ENABLED #endif ASSERT (cd_88591_to_utf8 != (iconv_t)(-1)); ASSERT (cd_utf8_to_88591 != (iconv_t)(-1)); /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ { static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; char buf[50]; const char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, (ICONV_CONST char **) &inptr, &inbytesleft, &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + strlen (expected)); ASSERT (memcmp (buf, expected, strlen (expected)) == 0); } /* Test conversion from ISO-8859-1 to UTF-8 with E2BIG. */ { static const char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; const char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, (ICONV_CONST char **) &inptr, &inbytesleft, &outptr, &outbytesleft); ASSERT (res == (size_t)(-1) && errno == E2BIG); ASSERT (inbytesleft == 1); ASSERT (outbytesleft == 1); ASSERT ((unsigned char) buf[1] == 0xAD); ASSERT ((unsigned char) buf[0] == 0xDE); } /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ { static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; const char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, (ICONV_CONST char **) &inptr, &inbytesleft, &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + strlen (expected)); ASSERT (memcmp (buf, expected, strlen (expected)) == 0); } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ { static const char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; const char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, (ICONV_CONST char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == (size_t)(-1)) { ASSERT (errno == EILSEQ); ASSERT (inbytesleft == strlen (input) && outptr == buf); } else { ASSERT (res == 1); ASSERT (inbytesleft == 0); } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ { static const char input[] = "\342"; char buf[10]; const char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, (ICONV_CONST char **) &inptr, &inbytesleft, &outptr, &outbytesleft); ASSERT (res == (size_t)(-1) && errno == EINVAL); ASSERT (inbytesleft == 1 && outptr == buf); } iconv_close (cd_88591_to_utf8); iconv_close (cd_utf8_to_88591); #ifdef CONVERT_ENABLED # pragma convert(pop) #endif #endif /* HAVE_ICONV */ return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-gettimeofday.c�����������������������������������������������0000664�0001750�0001750�00000002451�14670377436�022677� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc. * Written by Jim Meyering. * * 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <sys/time.h> #include "signature.h" SIGNATURE_CHECK (gettimeofday, int, (struct timeval *, GETTIMEOFDAY_TIMEZONE *)); #include <time.h> #include <stdio.h> #include <string.h> int main (void) { time_t t = 0; struct tm *lt; struct tm saved_lt; struct timeval tv; lt = localtime (&t); saved_lt = *lt; gettimeofday (&tv, NULL); if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0) { fprintf (stderr, "gettimeofday still clobbers the localtime buffer!\n"); return 1; } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/umaxtostr.c�������������������������������������������������������0000664�0001750�0001750�00000001524�14670377437�021310� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Convert 'uintmax_t' integer to printable string. Copyright (C) 2004-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #define anytostr umaxtostr #define inttype uintmax_t #include "anytostr.c" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-float.c������������������������������������������������������0000664�0001750�0001750�00000021625�14670377436�021327� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <float.h> substitute. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2011. */ #include <config.h> #include <float.h> #include "fpucw.h" #include "macros.h" /* Check that FLT_RADIX is a constant expression. */ int a[] = { FLT_RADIX }; #if FLT_RADIX == 2 /* Return 2^n. */ static float pow2f (int n) { int k = n; volatile float x = 1; volatile float y = 2; /* Invariant: 2^n == x * y^k. */ if (k < 0) { y = 0.5f; k = - k; } while (k > 0) { if (k != 2 * (k / 2)) { x = x * y; k = k - 1; } if (k == 0) break; y = y * y; k = k / 2; } /* Now k == 0, hence x == 2^n. */ return x; } /* Return 2^n. */ static double pow2d (int n) { int k = n; volatile double x = 1; volatile double y = 2; /* Invariant: 2^n == x * y^k. */ if (k < 0) { y = 0.5; k = - k; } while (k > 0) { if (k != 2 * (k / 2)) { x = x * y; k = k - 1; } if (k == 0) break; y = y * y; k = k / 2; } /* Now k == 0, hence x == 2^n. */ return x; } /* Return 2^n. */ static long double pow2l (int n) { int k = n; volatile long double x = 1; volatile long double y = 2; /* Invariant: 2^n == x * y^k. */ if (k < 0) { y = 0.5L; k = - k; } while (k > 0) { if (k != 2 * (k / 2)) { x = x * y; k = k - 1; } if (k == 0) break; y = y * y; k = k / 2; } /* Now k == 0, hence x == 2^n. */ return x; } /* ----------------------- Check macros for 'float' ----------------------- */ /* Check that the FLT_* macros expand to constant expressions. */ int fb[] = { FLT_MANT_DIG, FLT_MIN_EXP, FLT_MAX_EXP, FLT_DIG, FLT_MIN_10_EXP, FLT_MAX_10_EXP }; float fc[] = { FLT_EPSILON, FLT_MIN, FLT_MAX }; static void test_float (void) { /* Check that the value of FLT_MIN_EXP is well parenthesized. */ ASSERT ((FLT_MIN_EXP % 101111) == (FLT_MIN_EXP) % 101111); /* Check that the value of DBL_MIN_10_EXP is well parenthesized. */ ASSERT ((FLT_MIN_10_EXP % 101111) == (FLT_MIN_10_EXP) % 101111); /* Check that 'float' is as specified in IEEE 754. */ ASSERT (FLT_MANT_DIG == 24); ASSERT (FLT_MIN_EXP == -125); ASSERT (FLT_MAX_EXP == 128); /* Check the value of FLT_MIN_10_EXP. */ ASSERT (FLT_MIN_10_EXP == - (int) (- (FLT_MIN_EXP - 1) * 0.30103)); /* Check the value of FLT_DIG. */ ASSERT (FLT_DIG == (int) ((FLT_MANT_DIG - 1) * 0.30103)); /* Check the value of FLT_MIN_10_EXP. */ ASSERT (FLT_MIN_10_EXP == - (int) (- (FLT_MIN_EXP - 1) * 0.30103)); /* Check the value of FLT_MAX_10_EXP. */ ASSERT (FLT_MAX_10_EXP == (int) (FLT_MAX_EXP * 0.30103)); /* Check the value of FLT_MAX. */ { volatile float m = FLT_MAX; int n; ASSERT (m + m > m); for (n = 0; n <= 2 * FLT_MANT_DIG; n++) { volatile float pow2_n = pow2f (n); /* 2^n */ volatile float x = m + (m / pow2_n); if (x > m) ASSERT (x + x == x); else ASSERT (!(x + x == x)); } } /* Check the value of FLT_MIN. */ { volatile float m = FLT_MIN; volatile float x = pow2f (FLT_MIN_EXP - 1); ASSERT (m == x); } /* Check the value of FLT_EPSILON. */ { volatile float e = FLT_EPSILON; volatile float me; int n; me = 1.0f + e; ASSERT (me > 1.0f); ASSERT (me - 1.0f == e); for (n = 0; n <= 2 * FLT_MANT_DIG; n++) { volatile float half_n = pow2f (- n); /* 2^-n */ volatile float x = me - half_n; if (x < me) ASSERT (x <= 1.0f); } } } /* ----------------------- Check macros for 'double' ----------------------- */ /* Check that the DBL_* macros expand to constant expressions. */ int db[] = { DBL_MANT_DIG, DBL_MIN_EXP, DBL_MAX_EXP, DBL_DIG, DBL_MIN_10_EXP, DBL_MAX_10_EXP }; double dc[] = { DBL_EPSILON, DBL_MIN, DBL_MAX }; static void test_double (void) { /* Check that the value of DBL_MIN_EXP is well parenthesized. */ ASSERT ((DBL_MIN_EXP % 101111) == (DBL_MIN_EXP) % 101111); /* Check that the value of DBL_MIN_10_EXP is well parenthesized. */ ASSERT ((DBL_MIN_10_EXP % 101111) == (DBL_MIN_10_EXP) % 101111); /* Check that 'double' is as specified in IEEE 754. */ ASSERT (DBL_MANT_DIG == 53); ASSERT (DBL_MIN_EXP == -1021); ASSERT (DBL_MAX_EXP == 1024); /* Check the value of DBL_MIN_10_EXP. */ ASSERT (DBL_MIN_10_EXP == - (int) (- (DBL_MIN_EXP - 1) * 0.30103)); /* Check the value of DBL_DIG. */ ASSERT (DBL_DIG == (int) ((DBL_MANT_DIG - 1) * 0.30103)); /* Check the value of DBL_MIN_10_EXP. */ ASSERT (DBL_MIN_10_EXP == - (int) (- (DBL_MIN_EXP - 1) * 0.30103)); /* Check the value of DBL_MAX_10_EXP. */ ASSERT (DBL_MAX_10_EXP == (int) (DBL_MAX_EXP * 0.30103)); /* Check the value of DBL_MAX. */ { volatile double m = DBL_MAX; int n; ASSERT (m + m > m); for (n = 0; n <= 2 * DBL_MANT_DIG; n++) { volatile double pow2_n = pow2d (n); /* 2^n */ volatile double x = m + (m / pow2_n); if (x > m) ASSERT (x + x == x); else ASSERT (!(x + x == x)); } } /* Check the value of DBL_MIN. */ { volatile double m = DBL_MIN; volatile double x = pow2d (DBL_MIN_EXP - 1); ASSERT (m == x); } /* Check the value of DBL_EPSILON. */ { volatile double e = DBL_EPSILON; volatile double me; int n; me = 1.0 + e; ASSERT (me > 1.0); ASSERT (me - 1.0 == e); for (n = 0; n <= 2 * DBL_MANT_DIG; n++) { volatile double half_n = pow2d (- n); /* 2^-n */ volatile double x = me - half_n; if (x < me) ASSERT (x <= 1.0); } } } /* -------------------- Check macros for 'long double' -------------------- */ /* Check that the LDBL_* macros expand to constant expressions. */ int lb[] = { LDBL_MANT_DIG, LDBL_MIN_EXP, LDBL_MAX_EXP, LDBL_DIG, LDBL_MIN_10_EXP, LDBL_MAX_10_EXP }; long double lc1 = LDBL_EPSILON; long double lc2 = LDBL_MIN; #if 0 /* LDBL_MAX is not a constant expression on some platforms. */ long double lc3 = LDBL_MAX; #endif static void test_long_double (void) { /* Check that the value of LDBL_MIN_EXP is well parenthesized. */ ASSERT ((LDBL_MIN_EXP % 101111) == (LDBL_MIN_EXP) % 101111); /* Check that the value of LDBL_MIN_10_EXP is well parenthesized. */ ASSERT ((LDBL_MIN_10_EXP % 101111) == (LDBL_MIN_10_EXP) % 101111); /* Check that 'long double' is at least as wide as 'double'. */ ASSERT (LDBL_MANT_DIG >= DBL_MANT_DIG); ASSERT (LDBL_MIN_EXP - LDBL_MANT_DIG <= DBL_MIN_EXP - DBL_MANT_DIG); ASSERT (LDBL_MAX_EXP >= DBL_MAX_EXP); /* Check the value of LDBL_DIG. */ ASSERT (LDBL_DIG == (int)((LDBL_MANT_DIG - 1) * 0.30103)); /* Check the value of LDBL_MIN_10_EXP. */ ASSERT (LDBL_MIN_10_EXP == - (int) (- (LDBL_MIN_EXP - 1) * 0.30103)); /* Check the value of LDBL_MAX_10_EXP. */ ASSERT (LDBL_MAX_10_EXP == (int) (LDBL_MAX_EXP * 0.30103)); /* Check the value of LDBL_MAX. */ { volatile long double m = LDBL_MAX; int n; ASSERT (m + m > m); for (n = 0; n <= 2 * LDBL_MANT_DIG; n++) { volatile long double pow2_n = pow2l (n); /* 2^n */ volatile long double x = m + (m / pow2_n); if (x > m) ASSERT (x + x == x); else ASSERT (!(x + x == x)); } } /* Check the value of LDBL_MIN. */ { volatile long double m = LDBL_MIN; volatile long double x = pow2l (LDBL_MIN_EXP - 1); ASSERT (m == x); } /* Check the value of LDBL_EPSILON. */ { volatile long double e = LDBL_EPSILON; volatile long double me; int n; me = 1.0L + e; ASSERT (me > 1.0L); ASSERT (me - 1.0L == e); for (n = 0; n <= 2 * LDBL_MANT_DIG; n++) { volatile long double half_n = pow2l (- n); /* 2^-n */ volatile long double x = me - half_n; if (x < me) ASSERT (x <= 1.0L); } } } int main () { test_float (); test_double (); { DECL_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING (); test_long_double (); END_LONG_DOUBLE_ROUNDING (); } return 0; } #else int main () { fprintf (stderr, "Skipping test: FLT_RADIX is not 2.\n"); return 77; } #endif �����������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fcntl-safer.c������������������������������������������������0000664�0001750�0001750�00000002042�14670377431�022411� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of opening a file descriptor. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include "fcntl--.h" #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <unistd.h> #include "macros.h" #define BASE "test-fcntl-safer.t" #include "test-open.h" int main (void) { return test_open (open, true); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-c-strcase.sh�������������������������������������������������0000775�0001750�0001750�00000001245�14670377431�022270� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test in the C locale. ${CHECKER} ./test-c-strcasecmp${EXEEXT} || exit 1 ${CHECKER} ./test-c-strncasecmp${EXEEXT} || exit 1 # Test in an ISO-8859-1 or ISO-8859-15 locale. : ${LOCALE_FR=fr_FR} if test $LOCALE_FR != none; then LC_ALL=$LOCALE_FR ${CHECKER} ./test-c-strcasecmp${EXEEXT} locale || exit 1 LC_ALL=$LOCALE_FR ${CHECKER} ./test-c-strncasecmp${EXEEXT} locale || exit 1 fi # Test in a Turkish UTF-8 locale. : ${LOCALE_TR_UTF8=tr_TR.UTF-8} if test $LOCALE_TR_UTF8 != none; then LC_ALL=$LOCALE_TR_UTF8 ${CHECKER} ./test-c-strcasecmp${EXEEXT} locale || exit 1 LC_ALL=$LOCALE_TR_UTF8 ${CHECKER} ./test-c-strncasecmp${EXEEXT} locale || exit 1 fi exit 0 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-strtoll.c����������������������������������������������������0000664�0001750�0001750�00000012674�14670377436�021731� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdlib.h> #include "signature.h" #ifndef strtoll SIGNATURE_CHECK (strtoll, long long, (const char *, char **, int)); #endif #include <errno.h> #include "macros.h" int main (void) { /* Subject sequence empty or invalid. */ { const char input[] = ""; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " "; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " +"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " -"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } /* Simple integer values. */ { const char input[] = "0"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 1); ASSERT (errno == 0); } { const char input[] = "+0"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = "-0"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = "23"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = " 23"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } { const char input[] = "+23"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } { const char input[] = "-23"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == -23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } /* Large integer values. */ { const char input[] = "2147483647"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 2147483647); ASSERT (ptr == input + 10); ASSERT (errno == 0); } { const char input[] = "-2147483648"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == -2147483647 - 1); ASSERT (ptr == input + 11); ASSERT (errno == 0); } if (sizeof (long long) > sizeof (int)) { const char input[] = "4294967295"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 65535LL * 65537LL); ASSERT (ptr == input + 10); ASSERT (errno == 0); } /* Hexadecimal integer syntax. */ { const char input[] = "0x2A"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 0LL); ASSERT (ptr == input + 1); ASSERT (errno == 0); } { const char input[] = "0x2A"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 16); ASSERT (result == 42LL); ASSERT (ptr == input + 4); ASSERT (errno == 0); } { const char input[] = "0x2A"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 0); ASSERT (result == 42LL); ASSERT (ptr == input + 4); ASSERT (errno == 0); } { const char input[] = "0x"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 10); ASSERT (result == 0LL); ASSERT (ptr == input + 1); ASSERT (errno == 0); } { const char input[] = "0x"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 16); ASSERT (result == 0LL); ASSERT (ptr == input + 1); ASSERT (errno == 0); } { const char input[] = "0x"; char *ptr; long long result; errno = 0; result = strtoll (input, &ptr, 0); ASSERT (result == 0LL); ASSERT (ptr == input + 1); ASSERT (errno == 0); } return 0; } ��������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/unistr/�����������������������������������������������������������0000775�0001750�0001750�00000000000�14670377436�020417� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/unistr/test-u8-mbtoucr.c������������������������������������������0000664�0001750�0001750�00000010577�14670377436�023557� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of u8_mbtoucr() function. Copyright (C) 2010-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2010. */ #include <config.h> #include "unistr.h" #include "macros.h" int main () { ucs4_t uc; int ret; /* Test NUL unit input. */ { static const uint8_t input[] = ""; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 1); ASSERT (ret == 1); ASSERT (uc == 0); } /* Test ISO 646 unit input. */ { ucs4_t c; uint8_t buf[1]; for (c = 0; c < 0x80; c++) { buf[0] = c; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, buf, 1); ASSERT (ret == 1); ASSERT (uc == c); } } /* Test 2-byte character input. */ { static const uint8_t input[] = { 0xC3, 0x97 }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 2); ASSERT (ret == 2); ASSERT (uc == 0x00D7); } /* Test 3-byte character input. */ { static const uint8_t input[] = { 0xE2, 0x82, 0xAC }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 3); ASSERT (ret == 3); ASSERT (uc == 0x20AC); } /* Test 4-byte character input. */ { static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 4); ASSERT (ret == 4); ASSERT (uc == 0x10FFFD); } /* Test incomplete/invalid 1-byte input. */ { static const uint8_t input[] = { 0xC1 }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 1); ASSERT (ret == -1); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xC3 }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 1); ASSERT (ret == -2); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xE2 }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 1); ASSERT (ret == -2); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xF4 }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 1); ASSERT (ret == -2); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xFE }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 1); ASSERT (ret == -1); ASSERT (uc == 0xFFFD); } /* Test incomplete/invalid 2-byte input. */ { static const uint8_t input[] = { 0xE0, 0x9F }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 2); ASSERT (ret == -1); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xE2, 0x82 }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 2); ASSERT (ret == -2); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xE2, 0xD0 }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 2); ASSERT (ret == -1); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xF0, 0x8F }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 2); ASSERT (ret == -1); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xF3, 0x8F }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 2); ASSERT (ret == -2); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xF3, 0xD0 }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 2); ASSERT (ret == -1); ASSERT (uc == 0xFFFD); } /* Test incomplete/invalid 3-byte input. */ { static const uint8_t input[] = { 0xF3, 0x8F, 0xBF }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 3); ASSERT (ret == -2); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xF3, 0xD0, 0xBF }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 3); ASSERT (ret == -1); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 }; uc = 0xBADFACE; ret = u8_mbtoucr (&uc, input, 3); ASSERT (ret == -1); ASSERT (uc == 0xFFFD); } return 0; } ���������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/unistr/test-u8-uctomb.c�������������������������������������������0000664�0001750�0001750�00000007403�14670377436�023367� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of u8_uctomb() function. Copyright (C) 2010-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2010. */ #include <config.h> #include "unistr.h" #include "macros.h" #define MAGIC 0xBA int main () { /* Test ISO 646 character, in particular the NUL character. */ { ucs4_t uc; for (uc = 0; uc < 0x80; uc++) { uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; int ret; ret = u8_uctomb (buf, uc, 0); ASSERT (ret == -2); ASSERT (buf[0] == MAGIC); ret = u8_uctomb (buf, uc, 1); ASSERT (ret == 1); ASSERT (buf[0] == uc); ASSERT (buf[1] == MAGIC); } } /* Test 2-byte character. */ { ucs4_t uc = 0x00D7; uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; int ret; ret = u8_uctomb (buf, uc, 0); ASSERT (ret == -2); ASSERT (buf[0] == MAGIC); ret = u8_uctomb (buf, uc, 1); ASSERT (ret == -2); ASSERT (buf[0] == MAGIC); ret = u8_uctomb (buf, uc, 2); ASSERT (ret == 2); ASSERT (buf[0] == 0xC3); ASSERT (buf[1] == 0x97); ASSERT (buf[2] == MAGIC); } /* Test 3-byte character. */ { ucs4_t uc = 0x20AC; uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; int ret; ret = u8_uctomb (buf, uc, 0); ASSERT (ret == -2); ASSERT (buf[0] == MAGIC); ret = u8_uctomb (buf, uc, 1); ASSERT (ret == -2); ASSERT (buf[0] == MAGIC); ret = u8_uctomb (buf, uc, 2); ASSERT (ret == -2); ASSERT (buf[0] == MAGIC); ASSERT (buf[1] == MAGIC); ret = u8_uctomb (buf, uc, 3); ASSERT (ret == 3); ASSERT (buf[0] == 0xE2); ASSERT (buf[1] == 0x82); ASSERT (buf[2] == 0xAC); ASSERT (buf[3] == MAGIC); } /* Test 4-byte character. */ { ucs4_t uc = 0x10FFFD; uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; int ret; ret = u8_uctomb (buf, uc, 0); ASSERT (ret == -2); ASSERT (buf[0] == MAGIC); ret = u8_uctomb (buf, uc, 1); ASSERT (ret == -2); ASSERT (buf[0] == MAGIC); ret = u8_uctomb (buf, uc, 2); ASSERT (ret == -2); ASSERT (buf[0] == MAGIC); ASSERT (buf[1] == MAGIC); ret = u8_uctomb (buf, uc, 3); ASSERT (ret == -2); ASSERT (buf[0] == MAGIC); ASSERT (buf[1] == MAGIC); ASSERT (buf[2] == MAGIC); ret = u8_uctomb (buf, uc, 4); ASSERT (ret == 4); ASSERT (buf[0] == 0xF4); ASSERT (buf[1] == 0x8F); ASSERT (buf[2] == 0xBF); ASSERT (buf[3] == 0xBD); ASSERT (buf[4] == MAGIC); } /* Test invalid characters. */ { ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; size_t i; for (i = 0; i < SIZEOF (invalid); i++) { ucs4_t uc = invalid[i]; int n; for (n = 0; n <= 4; n++) { int ret = u8_uctomb (buf, uc, n); ASSERT (ret == -1); ASSERT (buf[0] == MAGIC); ASSERT (buf[1] == MAGIC); ASSERT (buf[2] == MAGIC); ASSERT (buf[3] == MAGIC); ASSERT (buf[4] == MAGIC); } } } return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcwidth.c����������������������������������������������������0000664�0001750�0001750�00000007443�14670377436�021675� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of wcwidth() function. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <wchar.h> #include "signature.h" SIGNATURE_CHECK (wcwidth, int, (wchar_t)); #include <locale.h> #include <string.h> #include "c-ctype.h" #include "localcharset.h" #include "macros.h" int main () { wchar_t wc; #if !GNULIB_WCHAR_SINGLE_LOCALE # ifdef C_CTYPE_ASCII /* Test width of ASCII characters. */ for (wc = 0x20; wc < 0x7F; wc++) ASSERT (wcwidth (wc) == 1); # endif #endif /* Switch to an UTF-8 locale. */ if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL /* Check whether it's really an UTF-8 locale. On OpenBSD 4.0, the setlocale call succeeds only for the LC_CTYPE category and therefore returns "C/fr_FR.UTF-8/C/C/C/C", but the LC_CTYPE category is effectively set to an ASCII LC_CTYPE category; in particular, locale_charset() returns "ASCII". */ && strcmp (locale_charset (), "UTF-8") == 0) { /* Test width of ASCII characters. */ for (wc = 0x20; wc < 0x7F; wc++) ASSERT (wcwidth (wc) == 1); /* Test width of some non-spacing characters. */ ASSERT (wcwidth (0x0301) == 0); ASSERT (wcwidth (0x05B0) == 0); /* Test width of some format control characters. */ ASSERT (wcwidth (0x200E) <= 0); ASSERT (wcwidth (0x2060) <= 0); #if 0 /* wchar_t may be only 16 bits. */ ASSERT (wcwidth (0xE0001) <= 0); ASSERT (wcwidth (0xE0044) <= 0); #endif /* Test width of some zero width characters. */ /* While it is desirable that U+200B, U+200C, U+200D have width 0, because this makes wcswidth work better on strings that contain these characters, it is acceptable if an implementation treats these characters like control characters. */ ASSERT (wcwidth (0x200B) <= 0); ASSERT (wcwidth (0xFEFF) <= 0); /* Test width of some math symbols. U+2202 is marked as having ambiguous width (A) in EastAsianWidth.txt (see <https://www.unicode.org/Public/12.0.0/ucd/EastAsianWidth.txt>). The Unicode Standard Annex 11 <https://www.unicode.org/reports/tr11/tr11-36.html> says "Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). If the context cannot be established reliably, they should be treated as narrow characters by default." For wcwidth(), the only available context information is the locale. "fr_FR.UTF-8" is a Western locale, not an East Asian locale, therefore U+2202 should be treated like a narrow character. */ ASSERT (wcwidth (0x2202) == 1); /* Test width of some CJK characters. */ ASSERT (wcwidth (0x3000) == 2); ASSERT (wcwidth (0xB250) == 2); ASSERT (wcwidth (0xFF1A) == 2); #if 0 /* wchar_t may be only 16 bits. */ ASSERT (wcwidth (0x20369) == 2); ASSERT (wcwidth (0x2F876) == 2); #endif } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-c-stack2.sh��������������������������������������������������0000775�0001750�0001750�00000002227�14670377431�022014� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 tmpfiles="t-c-stack2.tmp" # Sanitize exit status within a subshell, since some shells fail to # redirect stderr on their message about death due to signal. (${CHECKER} ./test-c-stack${EXEEXT} 1; exit $?) 2> t-c-stack2.tmp case $? in 77) if grep 'stack overflow' t-c-stack2.tmp >/dev/null ; then if test -z "$LIBSIGSEGV"; then echo 'cannot tell stack overflow from crash; consider installing libsigsegv' >&2 exit 77 else echo 'cannot tell stack overflow from crash, in spite of libsigsegv' >&2 exit 1 fi else cat t-c-stack2.tmp >&2 exit 77 fi ;; 1) # Dereferencing NULL exits the program with status 1, # so this test doesn't check the c-stack testing harness like it should. # https://lists.gnu.org/r/grep-devel/2020-09/msg00034.html cat t-c-stack2.tmp >&2 echo 'skipping test (perhaps gcc -fsanitize=undefined is in use?)' exit 77;; 0) (exit 1); exit 1 ;; esac if grep 'program error' t-c-stack2.tmp >/dev/null ; then : else (exit 1); exit 1 fi rm -fr $tmpfiles exit 0 �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sig-handler.h�����������������������������������������������������0000664�0001750�0001750�00000003563�14670377430�021442� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Convenience declarations when working with <signal.h>. Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _GL_SIG_HANDLER_H #define _GL_SIG_HANDLER_H #include <signal.h> #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef SIG_HANDLER_INLINE # define SIG_HANDLER_INLINE _GL_INLINE #endif /* Convenience type when working with signal handlers. */ typedef void (*sa_handler_t) (int); /* Return the handler of a signal, as a sa_handler_t value regardless of its true type. The resulting function can be compared to special values like SIG_IGN but it is not portable to call it. */ SIG_HANDLER_INLINE sa_handler_t _GL_ATTRIBUTE_PURE get_handler (struct sigaction const *a) { /* POSIX says that special values like SIG_IGN can only occur when action.sa_flags does not contain SA_SIGINFO. But in Linux 2.4, for example, sa_sigaction and sa_handler are aliases and a signal is ignored if sa_sigaction (after casting) equals SIG_IGN. In this case, this implementation relies on the fact that the two are aliases, and simply returns sa_handler. */ return a->sa_handler; } _GL_INLINE_HEADER_END #endif /* _GL_SIG_HANDLER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-rawmemchr.c��������������������������������������������������0000664�0001750�0001750�00000004755�14670377436�022214� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2008-2021 Free Software Foundation, Inc. * Written by Eric Blake and Bruno Haible * * 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <string.h> #include "signature.h" SIGNATURE_CHECK (rawmemchr, void *, (void const *, int)); #include <stdlib.h> #include "zerosize-ptr.h" #include "macros.h" /* Calculating void * + int is not portable, so this wrapper converts to char * to make the tests easier to write. */ #define RAWMEMCHR (char *) rawmemchr int main (void) { size_t n = 0x100000; char *input = malloc (n + 1); ASSERT (input); input[0] = 'a'; input[1] = 'b'; memset (input + 2, 'c', 1024); memset (input + 1026, 'd', n - 1028); input[n - 2] = 'e'; input[n - 1] = 'a'; input[n] = '\0'; /* Basic behavior tests. */ ASSERT (RAWMEMCHR (input, 'a') == input); ASSERT (RAWMEMCHR (input, 'b') == input + 1); ASSERT (RAWMEMCHR (input, 'c') == input + 2); ASSERT (RAWMEMCHR (input, 'd') == input + 1026); ASSERT (RAWMEMCHR (input + 1, 'a') == input + n - 1); ASSERT (RAWMEMCHR (input + 1, 'e') == input + n - 2); ASSERT (RAWMEMCHR (input + 1, 0x789abc00 | 'e') == input + n - 2); ASSERT (RAWMEMCHR (input, '\0') == input + n); /* Alignment tests. */ { int i, j; for (i = 0; i < 32; i++) { for (j = 0; j < 256; j++) input[i + j] = j; for (j = 0; j < 256; j++) { ASSERT (RAWMEMCHR (input + i, j) == input + i + j); } } } /* Ensure that no unaligned oversized reads occur. */ { char *page_boundary = (char *) zerosize_ptr (); size_t i; if (!page_boundary) page_boundary = input + 4096; memset (page_boundary - 512, '1', 511); page_boundary[-1] = '2'; for (i = 1; i <= 512; i++) ASSERT (RAWMEMCHR (page_boundary - i, (i * 0x01010100) | '2') == page_boundary - 1); } free (input); return 0; } �������������������kbuild-3608/src/grep/gnulib-tests/test-lstat.h������������������������������������������������������0000664�0001750�0001750�00000007651�14670377436�021361� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of lstat() function. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson, 2008; and Eric Blake, 2009. */ /* This file is designed to test both lstat(n,buf) and fstatat(AT_FDCWD,n,buf,AT_SYMLINK_NOFOLLOW). FUNC is the function to test. Assumes that BASE and ASSERT are already defined, and that appropriate headers are already included. If PRINT, warn before skipping symlink tests with status 77. */ static int test_lstat_func (int (*func) (char const *, struct stat *), bool print) { struct stat st1; struct stat st2; /* Test for common directories. */ ASSERT (func (".", &st1) == 0); ASSERT (func ("./", &st2) == 0); #if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES) ASSERT (SAME_INODE (st1, st2)); #endif ASSERT (S_ISDIR (st1.st_mode)); ASSERT (S_ISDIR (st2.st_mode)); ASSERT (func ("/", &st1) == 0); ASSERT (func ("///", &st2) == 0); #if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES) ASSERT (SAME_INODE (st1, st2)); #endif ASSERT (S_ISDIR (st1.st_mode)); ASSERT (S_ISDIR (st2.st_mode)); ASSERT (func ("..", &st1) == 0); ASSERT (S_ISDIR (st1.st_mode)); /* Test for error conditions. */ errno = 0; ASSERT (func ("", &st1) == -1); ASSERT (errno == ENOENT); errno = 0; ASSERT (func ("nosuch", &st1) == -1); ASSERT (errno == ENOENT); errno = 0; ASSERT (func ("nosuch/", &st1) == -1); ASSERT (errno == ENOENT); ASSERT (close (creat (BASE "file", 0600)) == 0); ASSERT (func (BASE "file", &st1) == 0); ASSERT (S_ISREG (st1.st_mode)); errno = 0; ASSERT (func (BASE "file/", &st1) == -1); ASSERT (errno == ENOTDIR); /* Now for some symlink tests, where supported. We set up: link1 -> directory link2 -> file link3 -> dangling link4 -> loop then test behavior both with and without trailing slash. */ if (symlink (".", BASE "link1") != 0) { ASSERT (unlink (BASE "file") == 0); if (print) fputs ("skipping test: symlinks not supported on this file system\n", stderr); return 77; } ASSERT (symlink (BASE "file", BASE "link2") == 0); ASSERT (symlink (BASE "nosuch", BASE "link3") == 0); ASSERT (symlink (BASE "link4", BASE "link4") == 0); ASSERT (func (BASE "link1", &st1) == 0); ASSERT (S_ISLNK (st1.st_mode)); ASSERT (func (BASE "link1/", &st1) == 0); ASSERT (stat (BASE "link1", &st2) == 0); ASSERT (S_ISDIR (st1.st_mode)); ASSERT (S_ISDIR (st2.st_mode)); #if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES) ASSERT (SAME_INODE (st1, st2)); #endif ASSERT (func (BASE "link2", &st1) == 0); ASSERT (S_ISLNK (st1.st_mode)); errno = 0; ASSERT (func (BASE "link2/", &st1) == -1); ASSERT (errno == ENOTDIR); ASSERT (func (BASE "link3", &st1) == 0); ASSERT (S_ISLNK (st1.st_mode)); errno = 0; ASSERT (func (BASE "link3/", &st1) == -1); ASSERT (errno == ENOENT); ASSERT (func (BASE "link4", &st1) == 0); ASSERT (S_ISLNK (st1.st_mode)); errno = 0; ASSERT (func (BASE "link4/", &st1) == -1); ASSERT (errno == ELOOP); /* Cleanup. */ ASSERT (unlink (BASE "file") == 0); ASSERT (unlink (BASE "link1") == 0); ASSERT (unlink (BASE "link2") == 0); ASSERT (unlink (BASE "link3") == 0); ASSERT (unlink (BASE "link4") == 0); return 0; } ���������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/_Noreturn.h�������������������������������������������������������0000664�0001750�0001750�00000004150�14670377430�021211� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* A C macro for declaring that a function does not return. Copyright (C) 2011-2021 Free Software Foundation, Inc. This program 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 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 Lesser General Public License for more details. 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/>. */ #ifndef _Noreturn # if (defined __cplusplus \ && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ || (defined _MSC_VER && 1900 <= _MSC_VER)) \ && 0) /* [[noreturn]] is not practically usable, because with it the syntax extern _Noreturn void func (...); would not be valid; such a declaration would only be valid with 'extern' and '_Noreturn' swapped, or without the 'extern' keyword. However, some AIX system header files and several gnulib header files use precisely this syntax with 'extern'. */ # define _Noreturn [[noreturn]] # elif ((!defined __cplusplus || defined __clang__) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ || (!defined __STRICT_ANSI__ \ && (__4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ || (defined __apple_build_version__ \ ? 6000000 <= __apple_build_version__ \ : 3 < __clang_major__ + (5 <= __clang_minor__)))))) /* _Noreturn works as-is. */ # elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \ || 0x5110 <= __SUNPRO_C) # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) # else # define _Noreturn # endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-free.c�������������������������������������������������������0000664�0001750�0001750�00000013760�14670377436�021144� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of free() function. Copyright (C) 2020-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2020. */ #include <config.h> /* Specification. */ #include <stdlib.h> #include <errno.h> #include <string.h> #include <unistd.h> #if defined __linux__ # include <fcntl.h> # include <stdint.h> # include <string.h> # include <sys/mman.h> #endif #include "macros.h" /* The indirection through a volatile function pointer is necessary to prevent a GCC optimization. Without it, when optimizing, GCC would "know" that errno is unchanged by calling free(ptr), when ptr was the result of a malloc(...) call in the same function. */ static int get_errno (void) { volatile int err = errno; return err; } static int (* volatile get_errno_func) (void) = get_errno; int main () { /* Check that free() preserves errno. */ { errno = 1789; /* Liberté, égalité, fraternité. */ free (NULL); ASSERT_NO_STDIO (get_errno_func () == 1789); } { /* Small memory allocations. */ #define N 10000 void * volatile ptrs[N]; size_t i; for (i = 0; i < N; i++) ptrs[i] = malloc (15); for (i = 0; i < N; i++) { errno = 1789; free (ptrs[i]); ASSERT_NO_STDIO (get_errno_func () == 1789); } #undef N } { /* Medium memory allocations. */ #define N 1000 void * volatile ptrs[N]; size_t i; for (i = 0; i < N; i++) ptrs[i] = malloc (729); for (i = 0; i < N; i++) { errno = 1789; free (ptrs[i]); ASSERT_NO_STDIO (get_errno_func () == 1789); } #undef N } { /* Large memory allocations. */ #define N 10 void * volatile ptrs[N]; size_t i; for (i = 0; i < N; i++) ptrs[i] = malloc (5318153); for (i = 0; i < N; i++) { errno = 1789; free (ptrs[i]); ASSERT_NO_STDIO (get_errno_func () == 1789); } #undef N } /* Test a less common code path. When malloc() is based on mmap(), free() can sometimes call munmap(). munmap() usually succeeds, but fails in a particular situation: when - it has to unmap the middle part of a VMA, and - the number of VMAs of a process is limited and the limit is already reached. The latter condition is fulfilled on Linux, when the file /proc/sys/vm/max_map_count exists. This file contains the limit - for Linux >= 2.4.19: 65536 (DEFAULT_MAX_MAP_COUNT in linux/include/linux/sched.h) - for Linux >= 2.6.31: 65530 (DEFAULT_MAX_MAP_COUNT in linux/include/linux/mm.h). But do not test it with glibc < 2.15, since that triggers a glibc internal abort: "malloc.c:3551: munmap_chunk: Assertion `ret == 0' failed." */ #if defined __linux__ && !(__GLIBC__ == 2 && __GLIBC_MINOR__ < 15) if (open ("/proc/sys/vm/max_map_count", O_RDONLY) >= 0) { /* Preparations. */ size_t pagesize = getpagesize (); void *firstpage_backup = malloc (pagesize); void *lastpage_backup = malloc (pagesize); /* Allocate a large memory area, as a bumper, so that the MAP_FIXED allocation later will not overwrite parts of the memory areas allocated to ld.so or libc.so. */ void *bumper_region = mmap (NULL, 0x1000000, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); /* A file descriptor pointing to a regular file. */ int fd = open ("test-free", O_RDONLY); if (firstpage_backup != NULL && lastpage_backup != NULL && bumper_region != (void *)(-1) && fd >= 0) { /* Do a large memory allocation. */ size_t big_size = 0x1000000; void * volatile ptr = malloc (big_size - 0x100); char *ptr_aligned = (char *) ((uintptr_t) ptr & ~(pagesize - 1)); /* This large memory allocation allocated a memory area from ptr_aligned to ptr_aligned + big_size. Enlarge this memory area by adding a page before and a page after it. */ memcpy (firstpage_backup, ptr_aligned, pagesize); memcpy (lastpage_backup, ptr_aligned + big_size - pagesize, pagesize); if (mmap (ptr_aligned - pagesize, pagesize + big_size + pagesize, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0) != (void *)(-1)) { memcpy (ptr_aligned, firstpage_backup, pagesize); memcpy (ptr_aligned + big_size - pagesize, lastpage_backup, pagesize); /* Now add as many mappings as we can. Stop at 65536, in order not to crash the machine (in case the limit has been increased by the system administrator). */ size_t i; for (i = 0; i < 65536; i++) if (mmap (NULL, pagesize, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0) == (void *)(-1)) break; /* Now the number of VMAs of this process has hopefully attained its limit. */ errno = 1789; /* This call to free() is supposed to call munmap (ptr_aligned, big_size); which increases the number of VMAs by 1, which is supposed to fail. */ free (ptr); ASSERT_NO_STDIO (get_errno_func () == 1789); } } } #endif return 0; } ����������������kbuild-3608/src/grep/gnulib-tests/test-pipe.c�������������������������������������������������������0000664�0001750�0001750�00000005243�14670377436�021155� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of pipe. Copyright (C) 2009-2021 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, 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (pipe, int, (int[2])); #include <fcntl.h> #include <stdbool.h> #if defined _WIN32 && ! defined __CYGWIN__ /* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include <io.h> # endif #endif #include "binary-io.h" #include "macros.h" /* Return true if FD is open. */ static bool is_open (int fd) { #if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows, the initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE, and there is no fcntl. */ return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; #else # ifndef F_GETFL # error Please port fcntl to your platform # endif return 0 <= fcntl (fd, F_GETFL); #endif } /* Return true if FD is not inherited to child processes. */ static bool is_cloexec (int fd) { #if defined _WIN32 && ! defined __CYGWIN__ HANDLE h = (HANDLE) _get_osfhandle (fd); DWORD flags; ASSERT (GetHandleInformation (h, &flags)); return (flags & HANDLE_FLAG_INHERIT) == 0; #else int flags; ASSERT ((flags = fcntl (fd, F_GETFD)) >= 0); return (flags & FD_CLOEXEC) != 0; #endif } /* Return true if FD is in non-blocking mode. */ static bool is_nonblocking (int fd) { #if defined _WIN32 && ! defined __CYGWIN__ /* We don't use the non-blocking mode for sockets here. */ return 0; #else int flags; ASSERT ((flags = fcntl (fd, F_GETFL)) >= 0); return (flags & O_NONBLOCK) != 0; #endif } int main () { int fd[2]; fd[0] = -1; fd[1] = -1; ASSERT (pipe (fd) >= 0); ASSERT (fd[0] >= 0); ASSERT (fd[1] >= 0); ASSERT (fd[0] != fd[1]); ASSERT (is_open (fd[0])); ASSERT (is_open (fd[1])); ASSERT (!is_cloexec (fd[0])); ASSERT (!is_cloexec (fd[1])); ASSERT (!is_nonblocking (fd[0])); ASSERT (!is_nonblocking (fd[1])); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/fdopen.c����������������������������������������������������������0000664�0001750�0001750�00000003105�14670377427�020511� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Open a stream with a given file descriptor. Copyright (C) 2011-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <stdio.h> #include <errno.h> #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" #endif #undef fdopen #if defined _WIN32 && !defined __CYGWIN__ # if HAVE_MSVC_INVALID_PARAMETER_HANDLER static FILE * fdopen_nothrow (int fd, const char *mode) { FILE *result; TRY_MSVC_INVAL { result = _fdopen (fd, mode); } CATCH_MSVC_INVAL { result = NULL; } DONE_MSVC_INVAL; return result; } # else # define fdopen_nothrow _fdopen # endif #else # define fdopen_nothrow fdopen #endif FILE * rpl_fdopen (int fd, const char *mode) { int saved_errno = errno; FILE *fp; errno = 0; fp = fdopen_nothrow (fd, mode); if (fp == NULL) { if (errno == 0) errno = EBADF; } else errno = saved_errno; return fp; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/windows-thread.c��������������������������������������������������0000664�0001750�0001750�00000015132�14670377440�022173� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Creating and controlling threads (native Windows implementation). Copyright (C) 2005-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. Based on GCC's gthr-win32.h. */ #include <config.h> /* Specification. */ #include "windows-thread.h" #include <errno.h> #include <process.h> #include <stdlib.h> #include "windows-once.h" #include "windows-tls.h" /* The Thread-Local Storage (TLS) key that allows to access each thread's 'struct glwthread_thread_struct *' pointer. */ static DWORD self_key = (DWORD)-1; /* Initializes self_key. This function must only be called once. */ static void do_init_self_key (void) { self_key = TlsAlloc (); /* If this fails, we're hosed. */ if (self_key == (DWORD)-1) abort (); } /* Initializes self_key. */ static void init_self_key (void) { static glwthread_once_t once = GLWTHREAD_ONCE_INIT; glwthread_once (&once, do_init_self_key); } /* This structure contains information about a thread. It is stored in TLS under key self_key. */ struct glwthread_thread_struct { /* Fields for managing the handle. */ HANDLE volatile handle; CRITICAL_SECTION handle_lock; /* Fields for managing the exit value. */ BOOL volatile detached; void * volatile result; /* Fields for managing the thread start. */ void * (*func) (void *); void *arg; }; /* Return a real HANDLE object for the current thread. */ static HANDLE get_current_thread_handle (void) { HANDLE this_handle; /* GetCurrentThread() returns a pseudo-handle, i.e. only a symbolic identifier, not a real handle. */ if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), GetCurrentProcess (), &this_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) abort (); return this_handle; } glwthread_thread_t glwthread_thread_self (void) { glwthread_thread_t thread; if (self_key == (DWORD)-1) init_self_key (); thread = TlsGetValue (self_key); if (thread == NULL) { /* This happens only in threads that have not been created through glthread_create(), such as the main thread. */ for (;;) { thread = (struct glwthread_thread_struct *) malloc (sizeof (struct glwthread_thread_struct)); if (thread != NULL) break; /* Memory allocation failed. There is not much we can do. Have to busy-loop, waiting for the availability of memory. */ Sleep (1); } thread->handle = get_current_thread_handle (); InitializeCriticalSection (&thread->handle_lock); thread->detached = FALSE; /* This can lead to a memory leak. */ thread->result = NULL; /* just to be deterministic */ TlsSetValue (self_key, thread); } return thread; } /* The main function of a freshly creating thread. It's a wrapper around the FUNC and ARG arguments passed to glthread_create_func. */ static unsigned int WINAPI wrapper_func (void *varg) { struct glwthread_thread_struct *thread = (struct glwthread_thread_struct *) varg; EnterCriticalSection (&thread->handle_lock); /* Create a new handle for the thread only if the parent thread did not yet fill in the handle. */ if (thread->handle == NULL) thread->handle = get_current_thread_handle (); LeaveCriticalSection (&thread->handle_lock); if (self_key == (DWORD)-1) init_self_key (); TlsSetValue (self_key, thread); /* Run the thread. Store the exit value if the thread was not terminated otherwise. */ thread->result = thread->func (thread->arg); /* Process the TLS destructors. */ glwthread_tls_process_destructors (); if (thread->detached) { /* Clean up the thread, like thrd_join would do. */ DeleteCriticalSection (&thread->handle_lock); CloseHandle (thread->handle); free (thread); } return 0; } int glwthread_thread_create (glwthread_thread_t *threadp, unsigned int attr, void * (*func) (void *), void *arg) { struct glwthread_thread_struct *thread = (struct glwthread_thread_struct *) malloc (sizeof (struct glwthread_thread_struct)); if (thread == NULL) return ENOMEM; thread->handle = NULL; InitializeCriticalSection (&thread->handle_lock); thread->detached = (attr & GLWTHREAD_ATTR_DETACHED ? TRUE : FALSE); thread->result = NULL; /* just to be deterministic */ thread->func = func; thread->arg = arg; { unsigned int thread_id; HANDLE thread_handle; thread_handle = (HANDLE) _beginthreadex (NULL, 100000, wrapper_func, thread, 0, &thread_id); /* calls CreateThread with the same arguments */ if (thread_handle == NULL) { DeleteCriticalSection (&thread->handle_lock); free (thread); return EAGAIN; } EnterCriticalSection (&thread->handle_lock); if (thread->handle == NULL) thread->handle = thread_handle; else /* thread->handle was already set by the thread itself. */ CloseHandle (thread_handle); LeaveCriticalSection (&thread->handle_lock); *threadp = thread; return 0; } } int glwthread_thread_join (glwthread_thread_t thread, void **retvalp) { if (thread == NULL) return EINVAL; if (thread == glwthread_thread_self ()) return EDEADLK; if (thread->detached) return EINVAL; if (WaitForSingleObject (thread->handle, INFINITE) == WAIT_FAILED) return EINVAL; if (retvalp != NULL) *retvalp = thread->result; DeleteCriticalSection (&thread->handle_lock); CloseHandle (thread->handle); free (thread); return 0; } int glwthread_thread_detach (glwthread_thread_t thread) { if (thread == NULL) return EINVAL; if (thread->detached) return EINVAL; thread->detached = TRUE; return 0; } void glwthread_thread_exit (void *retval) { glwthread_thread_t thread = glwthread_thread_self (); thread->result = retval; glwthread_tls_process_destructors (); _endthreadex (0); /* calls ExitThread (0) */ abort (); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sockets.c���������������������������������������������������������0000664�0001750�0001750�00000010212�14670377430�020700� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* sockets.c --- wrappers for Windows socket functions Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Simon Josefsson */ #include <config.h> /* Specification. */ #include "sockets.h" #if WINDOWS_SOCKETS /* This includes winsock2.h on MinGW. */ # include <sys/socket.h> # include "fd-hook.h" # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include <io.h> # endif /* Get set_winsock_errno, FD_TO_SOCKET etc. */ # include "w32sock.h" static int close_fd_maybe_socket (const struct fd_hook *remaining_list, gl_close_fn primary, int fd) { /* Note about multithread-safety: There is a race condition where, between our calls to closesocket() and the primary close(), some other thread could make system calls that allocate precisely the same HANDLE value as sock; then the primary close() would call CloseHandle() on it. */ SOCKET sock; WSANETWORKEVENTS ev; /* Test whether fd refers to a socket. */ sock = FD_TO_SOCKET (fd); ev.lNetworkEvents = 0xDEADBEEF; WSAEnumNetworkEvents (sock, NULL, &ev); if (ev.lNetworkEvents != 0xDEADBEEF) { /* fd refers to a socket. */ /* FIXME: other applications, like squid, use an undocumented _free_osfhnd free function. But this is not enough: The 'osfile' flags for fd also needs to be cleared, but it is hard to access it. Instead, here we just close twice the file descriptor. */ if (closesocket (sock)) { set_winsock_errno (); return -1; } else { /* This call frees the file descriptor and does a CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails. */ _close (fd); return 0; } } else /* Some other type of file descriptor. */ return execute_close_hooks (remaining_list, primary, fd); } static int ioctl_fd_maybe_socket (const struct fd_hook *remaining_list, gl_ioctl_fn primary, int fd, int request, void *arg) { SOCKET sock; WSANETWORKEVENTS ev; /* Test whether fd refers to a socket. */ sock = FD_TO_SOCKET (fd); ev.lNetworkEvents = 0xDEADBEEF; WSAEnumNetworkEvents (sock, NULL, &ev); if (ev.lNetworkEvents != 0xDEADBEEF) { /* fd refers to a socket. */ if (ioctlsocket (sock, request, arg) < 0) { set_winsock_errno (); return -1; } else return 0; } else /* Some other type of file descriptor. */ return execute_ioctl_hooks (remaining_list, primary, fd, request, arg); } static struct fd_hook fd_sockets_hook; static int initialized_sockets_version /* = 0 */; #endif /* WINDOWS_SOCKETS */ int gl_sockets_startup (int version _GL_UNUSED) { #if WINDOWS_SOCKETS if (version > initialized_sockets_version) { WSADATA data; int err; err = WSAStartup (version, &data); if (err != 0) return 1; if (data.wVersion != version) { WSACleanup (); return 2; } if (initialized_sockets_version == 0) register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket, &fd_sockets_hook); initialized_sockets_version = version; } #endif return 0; } int gl_sockets_cleanup (void) { #if WINDOWS_SOCKETS int err; initialized_sockets_version = 0; unregister_fd_hook (&fd_sockets_hook); err = WSACleanup (); if (err != 0) return 1; #endif return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-stdio.c������������������������������������������������������0000664�0001750�0001750�00000002323�14670377436�021336� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <stdio.h> substitute. Copyright (C) 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <stdio.h> #include "verify.h" /* Check that the various SEEK_* macros are defined. */ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); /* Check that the types are all defined. */ fpos_t t1; off_t t2; size_t t3; ssize_t t4; va_list t5; int main (void) { return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-quotearg.h���������������������������������������������������0000664�0001750�0001750�00000007450�14670377436�022056� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of quotearg family of functions. Copyright (C) 2008-2021 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, 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2008. */ struct result_strings { char const *str1; /* Translation of "". */ char const *str2; /* Translation of "\0""1\0". */ size_t len2; /* Length of str2. */ char const *str3; /* Translation of "simple". */ char const *str4; /* Translation of " \t\n'\"\033?""?/\\". */ char const *str5; /* Translation of "a:b". */ char const *str6; /* Translation of "a\\b". */ char const *str7; /* Translation of "a' b". */ char const *str8a; /* Translation of LQ RQ, in ASCII charset. */ char const *str8b; /* Translation of LQ RQ, in Latin1 or UTF-8 charset. */ }; struct result_groups { struct result_strings group1; /* Via quotearg_buffer. */ struct result_strings group2; /* Via quotearg{,_mem}. */ struct result_strings group3; /* Via quotearg_colon{,_mem}. */ }; /* These quotes are borrowed from a pt_PT.utf8 translation. */ # define LQ "\302\253" # define RQ "\302\273" # define LQ_ENC "\\302\\253" # define RQ_ENC "\\302\\273" # define RQ_ESC "\\\302\273" static struct result_strings inputs = { "", "\0001\0", 3, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b", LQ RQ, NULL }; static void compare (char const *a, size_t la, char const *b, size_t lb) { ASSERT (la == lb); ASSERT (memcmp (a, b, la) == 0); ASSERT (b[lb] == '\0'); } static void compare_strings (char *(func) (char const *, size_t *), struct result_strings *results, bool ascii_only) { size_t len; char *p; len = 0; p = func (inputs.str1, &len); compare (results->str1, strlen (results->str1), p, len); len = inputs.len2; p = func (inputs.str2, &len); compare (results->str2, results->len2, p, len); len = SIZE_MAX; p = func (inputs.str3, &len); compare (results->str3, strlen (results->str3), p, len); len = strlen (inputs.str4); p = func (inputs.str4, &len); compare (results->str4, strlen (results->str4), p, len); len = SIZE_MAX; p = func (inputs.str5, &len); compare (results->str5, strlen (results->str5), p, len); len = strlen (inputs.str6); p = func (inputs.str6, &len); compare (results->str6, strlen (results->str6), p, len); len = strlen (inputs.str7); p = func (inputs.str7, &len); compare (results->str7, strlen (results->str7), p, len); len = strlen (inputs.str8a); p = func (inputs.str8a, &len); if (ascii_only) compare (results->str8a, strlen (results->str8a), p, len); else compare (results->str8b, strlen (results->str8b), p, len); } static char * use_quotearg_buffer (const char *str, size_t *len) { static char buf[100]; size_t size; memset (buf, 0xa5, 100); size = quotearg_buffer (buf, 100, str, *len, NULL); *len = size; ASSERT ((unsigned char) buf[size + 1] == 0xa5); return buf; } static char * use_quotearg (const char *str, size_t *len) { char *p = *len == SIZE_MAX ? quotearg (str) : quotearg_mem (str, *len); *len = strlen (p); return p; } static char * use_quotearg_colon (const char *str, size_t *len) { char *p = (*len == SIZE_MAX ? quotearg_colon (str) : quotearg_colon_mem (str, *len)); *len = strlen (p); return p; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/socket.c����������������������������������������������������������0000664�0001750�0001750�00000002742�14670377436�020534� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* socket.c --- wrappers for Windows socket function Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paolo Bonzini */ #include <config.h> #define WIN32_LEAN_AND_MEAN /* Get winsock2.h. */ #include <sys/socket.h> /* Get set_winsock_errno, FD_TO_SOCKET etc. */ #include "w32sock.h" #include "sockets.h" /* Don't assume that UNICODE is defined. */ #undef WSASocket #define WSASocket WSASocketW int rpl_socket (int domain, int type, int protocol) { SOCKET fh; gl_sockets_startup (SOCKETS_1_1); /* We have to use WSASocket() to create non-overlapped IO sockets. Overlapped IO sockets cannot be used with read/write. */ fh = WSASocket (domain, type, protocol, NULL, 0, 0); if (fh == INVALID_SOCKET) { set_winsock_errno (); return -1; } else return SOCKET_TO_FD (fh); } ������������������������������kbuild-3608/src/grep/gnulib-tests/test-dfa-match-aux.c����������������������������������������������0000664�0001750�0001750�00000003474�14670377431�022636� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Auxiliary program to test a DFA code path that cannot be triggered by grep or gawk. Copyright 2014-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <config.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <regex.h> #include <dfa.h> #include <localeinfo.h> _Noreturn void dfaerror (char const *mesg) { printf ("dfaerror: %s\n", mesg); exit (EXIT_FAILURE); } static int exit_status = EXIT_SUCCESS; void dfawarn (char const *mesg) { printf ("dfawarn: %s\n", mesg); exit_status = EXIT_FAILURE; } int main (int argc, char **argv) { struct dfa *dfa; char *beg, *end, *p; int allow_nl; struct localeinfo localeinfo; if (argc < 3) exit (EXIT_FAILURE); setlocale (LC_ALL, ""); init_localeinfo (&localeinfo); dfa = dfaalloc (); dfasyntax (dfa, &localeinfo, RE_SYNTAX_EGREP | RE_NO_EMPTY_RANGES, 0); dfacomp (argv[1], strlen (argv[1]), dfa, 0); beg = argv[2]; end = argv[2] + strlen (argv[2]); allow_nl = argc > 3 && atoi (argv[3]); p = dfaexec (dfa, beg, end, allow_nl, NULL, NULL); if (p != NULL) printf ("%zd\n", p - beg); exit (exit_status); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-c-stack.sh���������������������������������������������������0000775�0001750�0001750�00000000534�14670377431�021731� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 tmpfiles="t-c-stack.tmp" ${CHECKER} ./test-c-stack${EXEEXT} 2> t-c-stack.tmp case $? in 77) cat t-c-stack.tmp >&2; (exit 77); exit 77 ;; 1) ;; *) (exit 1); exit 1 ;; esac if grep 'stack overflow' t-c-stack.tmp >/dev/null ; then : else (exit 1); exit 1 fi rm -fr $tmpfiles exit 0 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-argmatch.c���������������������������������������������������0000664�0001750�0001750�00000012054�14670377431�021777� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of exact or abbreviated match search. Copyright (C) 1990, 1998-1999, 2001-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007, based on test code by David MacKenzie <djm@gnu.ai.mit.edu>. */ #include <config.h> /* As of GCC 11.2.1, gcc -Wanalyzer-too-complex reports that main's use of CHECK macros expands to code that is too complicated for gcc -fanalyzer. Suppress the resulting bogus warnings. */ #if 10 <= __GNUC__ # pragma GCC diagnostic ignored "-Wanalyzer-null-argument" #endif #include "argmatch.h" #include <stdlib.h> #include "macros.h" # define N_(Msgid) (Msgid) /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and thus must link with a definition of that function. Provide it here. */ #ifdef ARGMATCH_DIE_DECL _Noreturn ARGMATCH_DIE_DECL; ARGMATCH_DIE_DECL { exit (1); } #endif enum backup_type { no_backups, simple_backups, numbered_existing_backups, numbered_backups }; static const char *const backup_args[] = { "no", "none", "off", "simple", "never", "single", "existing", "nil", "numbered-existing", "numbered", "t", "newstyle", NULL }; static const enum backup_type backup_vals[] = { no_backups, no_backups, no_backups, simple_backups, simple_backups, simple_backups, numbered_existing_backups, numbered_existing_backups, numbered_existing_backups, numbered_backups, numbered_backups, numbered_backups }; ARGMATCH_DEFINE_GROUP(backup, enum backup_type) static const argmatch_backup_doc argmatch_backup_docs[] = { { "no", N_("never make backups (even if --backup is given)") }, { "numbered", N_("make numbered backups") }, { "existing", N_("numbered if numbered backups exist, simple otherwise") }, { "simple", N_("always make simple backups") }, { NULL, NULL } }; static const argmatch_backup_arg argmatch_backup_args[] = { { "no", no_backups }, { "none", no_backups }, { "off", no_backups }, { "simple", simple_backups }, { "never", simple_backups }, { "single", simple_backups }, { "existing", numbered_existing_backups }, { "nil", numbered_existing_backups }, { "numbered-existing", numbered_existing_backups }, { "numbered", numbered_backups }, { "t", numbered_backups }, { "newstyle", numbered_backups }, { NULL, no_backups } }; const argmatch_backup_group_type argmatch_backup_group = { argmatch_backup_args, argmatch_backup_docs, N_("\ The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.\n\ The version control method may be selected via the --backup option or through\n\ the VERSION_CONTROL environment variable. Here are the values:\n"), NULL }; int main (int argc, char *argv[]) { #define CHECK(Input, Output) \ do { \ ASSERT (ARGMATCH (Input, backup_args, backup_vals) == Output); \ ASSERT (argmatch_backup_choice (Input) == Output); \ if (0 <= Output) \ { \ enum backup_type val \ = argmatch_backup_args[Output < 0 ? 0 : Output].val; \ ASSERT (*argmatch_backup_value ("test", Input) == val); \ ASSERT (*argmatch_backup_value ("test", \ argmatch_backup_argument (&val)) \ == val); \ } \ } while (0) /* Not found. */ CHECK ("klingon", -1); /* Exact match. */ CHECK ("none", 1); CHECK ("nil", 7); /* Too long. */ CHECK ("nilpotent", -1); /* Abbreviated. */ CHECK ("simpl", 3); CHECK ("simp", 3); CHECK ("sim", 3); /* Exact match and abbreviated. */ CHECK ("numbered", 9); CHECK ("numbere", -2); CHECK ("number", -2); CHECK ("numbe", -2); CHECK ("numb", -2); CHECK ("num", -2); CHECK ("nu", -2); CHECK ("n", -2); /* Ambiguous abbreviated. */ CHECK ("ne", -2); /* Ambiguous abbreviated, but same value ("single" and "simple"). */ CHECK ("si", 3); CHECK ("s", 3); #undef CHECK argmatch_backup_usage (stdout); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-btowc1.sh����������������������������������������������������0000775�0001750�0001750�00000000556�14670377431�021607� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test in an ISO-8859-1 or ISO-8859-15 locale. : ${LOCALE_FR=fr_FR} if test $LOCALE_FR = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no traditional french locale is installed" else echo "Skipping test: no traditional french locale is supported" fi exit 77 fi LC_ALL=$LOCALE_FR \ ${CHECKER} ./test-btowc${EXEEXT} 1 ��������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsinit.sh���������������������������������������������������0000775�0001750�0001750�00000000601�14670377436�022051� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test whether a specific UTF-8 locale is installed. : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR_UTF8 = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no french Unicode locale is installed" else echo "Skipping test: no french Unicode locale is supported" fi exit 77 fi LC_ALL=$LOCALE_FR_UTF8 \ ${CHECKER} ./test-mbsinit${EXEEXT} �������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-chdir.c������������������������������������������������������0000664�0001750�0001750�00000001675�14670377431�021311� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test changing to a directory. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (chdir, int, (const char *)); #include "macros.h" int main (void) { ASSERT (chdir ("/") == 0); return 0; } �������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-reallocarray.c�����������������������������������������������0000664�0001750�0001750�00000003226�14670377436�022677� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of reallocarray function. Copyright (C) 2010-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include <stdlib.h> #include <errno.h> #include <stdint.h> #include "signature.h" SIGNATURE_CHECK (reallocarray, void *, (void *, size_t, size_t)); #include "macros.h" int main () { /* Check that reallocarray fails when requested to allocate a block of memory larger than PTRDIFF_MAX or SIZE_MAX bytes. */ for (size_t n = 2; n != 0; n <<= 1) { void *volatile p = NULL; if (PTRDIFF_MAX / n + 1 <= SIZE_MAX) { p = reallocarray (p, PTRDIFF_MAX / n + 1, n); ASSERT (p == NULL); ASSERT (errno == ENOMEM); } p = reallocarray (p, SIZE_MAX / n + 1, n); ASSERT (p == NULL); ASSERT (errno == ENOMEM || errno == EOVERFLOW /* NetBSD */); /* Reallocarray should not crash with zero sizes. */ p = reallocarray (p, 0, n); p = reallocarray (p, n, 0); free (p); } return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fchdir.c�����������������������������������������������������0000664�0001750�0001750�00000005612�14670377436�021457� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test changing to a directory named by a file descriptor. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (fchdir, int, (int)); #include <errno.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> #include "cloexec.h" #include "macros.h" int main (void) { char *cwd; int fd; int i; cwd = getcwd (NULL, 0); ASSERT (cwd); fd = open (".", O_RDONLY); ASSERT (0 <= fd); /* Test behaviour for invalid file descriptors. */ { errno = 0; ASSERT (fchdir (-1) == -1); ASSERT (errno == EBADF); } { close (99); errno = 0; ASSERT (fchdir (99) == -1); ASSERT (errno == EBADF); } /* Check for other failure cases. */ { int bad_fd = open ("/dev/null", O_RDONLY); ASSERT (0 <= bad_fd); errno = 0; ASSERT (fchdir (bad_fd) == -1); ASSERT (errno == ENOTDIR); ASSERT (close (bad_fd) == 0); } /* Repeat test twice, once in '.' and once in '..'. */ for (i = 0; i < 2; i++) { ASSERT (chdir (&".."[1 - i]) == 0); ASSERT (fchdir (fd) == 0); { size_t len = strlen (cwd) + 1; char *new_dir = malloc (len); ASSERT (new_dir); ASSERT (getcwd (new_dir, len) == new_dir); ASSERT (strcmp (cwd, new_dir) == 0); free (new_dir); } /* For second iteration, use a cloned fd, to ensure that dup remembers whether an fd was associated with a directory. */ if (!i) { int new_fd = dup (fd); ASSERT (0 <= new_fd); ASSERT (close (fd) == 0); ASSERT (dup2 (new_fd, fd) == fd); ASSERT (close (new_fd) == 0); ASSERT (dup_cloexec (fd) == new_fd); ASSERT (dup2 (new_fd, fd) == fd); ASSERT (close (new_fd) == 0); ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, new_fd) == new_fd); ASSERT (close (fd) == 0); ASSERT (fcntl (new_fd, F_DUPFD, fd) == fd); ASSERT (close (new_fd) == 0); #if GNULIB_TEST_DUP3 ASSERT (dup3 (fd, new_fd, 0) == new_fd); ASSERT (dup3 (new_fd, fd, 0) == fd); ASSERT (close (new_fd) == 0); #endif } } free (cwd); return 0; } ����������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/mmap-anon-util.h��������������������������������������������������0000664�0001750�0001750�00000005222�14670377430�022075� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Some auxiliary stuff for using mmap & friends. Copyright (C) 2002-2021 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 2 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible. */ #if defined _WIN32 && !defined __CYGWIN__ /* ------------------------ Windows ------------------------ */ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> # include <winerror.h> # define PROT_NONE PAGE_NOACCESS # define PROT_READ PAGE_READONLY # define PROT_READ_WRITE PAGE_READWRITE static void * mmap_zeromap (void *map_addr_hint, size_t map_len) { if (VirtualAlloc ((void *)((uintptr_t) map_addr_hint & -0x10000), (((uintptr_t) map_addr_hint + map_len - 1) | 0xffff) + 1 - ((uintptr_t) map_addr_hint & -0x10000), MEM_RESERVE, PAGE_NOACCESS) && VirtualAlloc (map_addr_hint, map_len, MEM_COMMIT, PAGE_READWRITE)) return map_addr_hint; else return (void *)(-1); } int munmap (void *addr, size_t len) { if (VirtualFree (addr, len, MEM_DECOMMIT)) return 0; else return -1; } int mprotect (void *addr, size_t len, int prot) { DWORD oldprot; if (VirtualProtect (addr, len, prot, &oldprot)) return 0; else return -1; } #else /* ------------------------ Unix ------------------------ */ # include <sys/types.h> # include <sys/mman.h> # include <fcntl.h> # ifndef PROT_NONE # define PROT_NONE 0 # endif # define PROT_READ_WRITE (PROT_READ|PROT_WRITE) # if HAVE_MAP_ANONYMOUS # define zero_fd -1 # define map_flags MAP_ANONYMOUS | MAP_PRIVATE # else # ifndef MAP_FILE # define MAP_FILE 0 # endif static int zero_fd; # define map_flags MAP_FILE | MAP_PRIVATE # endif static void * mmap_zeromap (void *map_addr_hint, size_t map_len) { # ifdef __hpux /* HP-UX 10 mmap() often fails when given a hint. So give the OS complete freedom about the address range. */ return (void *) mmap ((void *) 0, map_len, PROT_READ_WRITE, map_flags, zero_fd, 0); # else return (void *) mmap (map_addr_hint, map_len, PROT_READ_WRITE, map_flags, zero_fd, 0); # endif } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wctype-h.c���������������������������������������������������0000664�0001750�0001750�00000003766�14670377436�021770� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <wctype.h> substitute. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <wctype.h> #include "macros.h" /* Check that the type wint_t is defined. */ wint_t a = 'x'; /* Check that WEOF is defined. */ wint_t e = WEOF; /* Check that the type wctype_t is defined. */ wctype_t p; /* Check that the type wctrans_t is defined. */ wctrans_t q; int main (void) { /* Check that the isw* functions exist as functions or as macros. */ (void) iswalnum (0); (void) iswalpha (0); (void) iswcntrl (0); (void) iswdigit (0); (void) iswgraph (0); (void) iswlower (0); (void) iswprint (0); (void) iswpunct (0); (void) iswspace (0); (void) iswupper (0); (void) iswxdigit (0); /* Check that the isw* functions map WEOF to 0. */ ASSERT (!iswalnum (e)); ASSERT (!iswalpha (e)); ASSERT (!iswcntrl (e)); ASSERT (!iswdigit (e)); ASSERT (!iswgraph (e)); ASSERT (!iswlower (e)); ASSERT (!iswprint (e)); ASSERT (!iswpunct (e)); ASSERT (!iswspace (e)); ASSERT (!iswupper (e)); ASSERT (!iswxdigit (e)); /* Check that the tow* functions exist as functions or as macros. */ (void) towlower (0); (void) towupper (0); /* Check that the tow* functions map WEOF to WEOF. */ ASSERT (towlower (e) == e); ASSERT (towupper (e) == e); return 0; } ����������kbuild-3608/src/grep/gnulib-tests/test-stdint.c�����������������������������������������������������0000664�0001750�0001750�00000033506�14670377436�021530� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <stdint.h> substitute. Copyright (C) 2006-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2006. */ #include <config.h> /* Whether to enable pedantic checks. */ #define DO_PEDANTIC 0 #include <stdint.h> #include "verify.h" #include "intprops.h" #if ((__GNUC__ >= 2) || (__clang_major__ >= 4)) && DO_PEDANTIC # define verify_same_types(expr1,expr2) \ extern void _verify_func(__LINE__) (__typeof__ (expr1) *); \ extern void _verify_func(__LINE__) (__typeof__ (expr2) *); # define _verify_func(line) _verify_func2(line) # define _verify_func2(line) verify_func_ ## line #else # define verify_same_types(expr1,expr2) extern void verify_func (int) #endif /* 7.18.1.1. Exact-width integer types */ /* 7.18.2.1. Limits of exact-width integer types */ int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX }; verify (TYPE_MINIMUM (int8_t) == INT8_MIN); verify (TYPE_MAXIMUM (int8_t) == INT8_MAX); verify_same_types (INT8_MIN, (int8_t) 0 + 0); verify_same_types (INT8_MAX, (int8_t) 0 + 0); int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX }; verify (TYPE_MINIMUM (int16_t) == INT16_MIN); verify (TYPE_MAXIMUM (int16_t) == INT16_MAX); verify_same_types (INT16_MIN, (int16_t) 0 + 0); verify_same_types (INT16_MAX, (int16_t) 0 + 0); int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX }; verify (TYPE_MINIMUM (int32_t) == INT32_MIN); verify (TYPE_MAXIMUM (int32_t) == INT32_MAX); verify_same_types (INT32_MIN, (int32_t) 0 + 0); verify_same_types (INT32_MAX, (int32_t) 0 + 0); #ifdef INT64_MAX int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX }; verify (TYPE_MINIMUM (int64_t) == INT64_MIN); verify (TYPE_MAXIMUM (int64_t) == INT64_MAX); verify_same_types (INT64_MIN, (int64_t) 0 + 0); verify_same_types (INT64_MAX, (int64_t) 0 + 0); #endif uint8_t b1[2] = { UINT8_C (17), UINT8_MAX }; verify (TYPE_MAXIMUM (uint8_t) == UINT8_MAX); verify_same_types (UINT8_MAX, (uint8_t) 0 + 0); uint16_t b2[2] = { UINT16_C (17), UINT16_MAX }; verify (TYPE_MAXIMUM (uint16_t) == UINT16_MAX); verify_same_types (UINT16_MAX, (uint16_t) 0 + 0); uint32_t b3[2] = { UINT32_C (17), UINT32_MAX }; verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX); verify_same_types (UINT32_MAX, (uint32_t) 0 + 0); #ifdef UINT64_MAX uint64_t b4[2] = { UINT64_C (17), UINT64_MAX }; verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX); verify_same_types (UINT64_MAX, (uint64_t) 0 + 0); #endif #if INT8_MIN && INT8_MAX && INT16_MIN && INT16_MAX && INT32_MIN && INT32_MAX /* ok */ #else err or; #endif #if UINT8_MAX && UINT16_MAX && UINT32_MAX /* ok */ #else err or; #endif /* 7.18.1.2. Minimum-width integer types */ /* 7.18.2.2. Limits of minimum-width integer types */ int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX }; verify (TYPE_MINIMUM (int_least8_t) == INT_LEAST8_MIN); verify (TYPE_MAXIMUM (int_least8_t) == INT_LEAST8_MAX); verify_same_types (INT_LEAST8_MIN, (int_least8_t) 0 + 0); verify_same_types (INT_LEAST8_MAX, (int_least8_t) 0 + 0); int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX }; verify (TYPE_MINIMUM (int_least16_t) == INT_LEAST16_MIN); verify (TYPE_MAXIMUM (int_least16_t) == INT_LEAST16_MAX); verify_same_types (INT_LEAST16_MIN, (int_least16_t) 0 + 0); verify_same_types (INT_LEAST16_MAX, (int_least16_t) 0 + 0); int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX }; verify (TYPE_MINIMUM (int_least32_t) == INT_LEAST32_MIN); verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX); verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0); verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0); #ifdef INT_LEAST64_MAX int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX }; verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN); verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX); verify_same_types (INT_LEAST64_MIN, (int_least64_t) 0 + 0); verify_same_types (INT_LEAST64_MAX, (int_least64_t) 0 + 0); #endif uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX }; verify (TYPE_MAXIMUM (uint_least8_t) == UINT_LEAST8_MAX); verify_same_types (UINT_LEAST8_MAX, (uint_least8_t) 0 + 0); uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX }; verify (TYPE_MAXIMUM (uint_least16_t) == UINT_LEAST16_MAX); verify_same_types (UINT_LEAST16_MAX, (uint_least16_t) 0 + 0); uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX }; verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX); verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0); #ifdef UINT_LEAST64_MAX uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX }; verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX); verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0); #endif #if INT_LEAST8_MIN && INT_LEAST8_MAX && INT_LEAST16_MIN && INT_LEAST16_MAX && INT_LEAST32_MIN && INT_LEAST32_MAX /* ok */ #else err or; #endif #if UINT_LEAST8_MAX && UINT_LEAST16_MAX && UINT_LEAST32_MAX /* ok */ #else err or; #endif /* 7.18.1.3. Fastest minimum-width integer types */ /* 7.18.2.3. Limits of fastest minimum-width integer types */ int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX }; verify (TYPE_MINIMUM (int_fast8_t) == INT_FAST8_MIN); verify (TYPE_MAXIMUM (int_fast8_t) == INT_FAST8_MAX); verify_same_types (INT_FAST8_MIN, (int_fast8_t) 0 + 0); verify_same_types (INT_FAST8_MAX, (int_fast8_t) 0 + 0); int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX }; verify (TYPE_MINIMUM (int_fast16_t) == INT_FAST16_MIN); verify (TYPE_MAXIMUM (int_fast16_t) == INT_FAST16_MAX); verify_same_types (INT_FAST16_MIN, (int_fast16_t) 0 + 0); verify_same_types (INT_FAST16_MAX, (int_fast16_t) 0 + 0); int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX }; verify (TYPE_MINIMUM (int_fast32_t) == INT_FAST32_MIN); verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX); verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0); verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0); #ifdef INT_FAST64_MAX int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX }; verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN); verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX); verify_same_types (INT_FAST64_MIN, (int_fast64_t) 0 + 0); verify_same_types (INT_FAST64_MAX, (int_fast64_t) 0 + 0); #endif uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX }; verify (TYPE_MAXIMUM (uint_fast8_t) == UINT_FAST8_MAX); verify_same_types (UINT_FAST8_MAX, (uint_fast8_t) 0 + 0); uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX }; verify (TYPE_MAXIMUM (uint_fast16_t) == UINT_FAST16_MAX); verify_same_types (UINT_FAST16_MAX, (uint_fast16_t) 0 + 0); uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX }; verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX); verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0); #ifdef UINT_FAST64_MAX uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX }; verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX); verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0); #endif #if INT_FAST8_MIN && INT_FAST8_MAX && INT_FAST16_MIN && INT_FAST16_MAX && INT_FAST32_MIN && INT_FAST32_MAX /* ok */ #else err or; #endif #if UINT_FAST8_MAX && UINT_FAST16_MAX && UINT_FAST32_MAX /* ok */ #else err or; #endif /* 7.18.1.4. Integer types capable of holding object pointers */ /* 7.18.2.4. Limits of integer types capable of holding object pointers */ intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX }; verify (sizeof (void *) <= sizeof (intptr_t)); verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN); verify (TYPE_MAXIMUM (intptr_t) == INTPTR_MAX); verify_same_types (INTPTR_MIN, (intptr_t) 0 + 0); verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0); uintptr_t h[2] = { 17, UINTPTR_MAX }; verify (sizeof (void *) <= sizeof (uintptr_t)); verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX); verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0); #if INTPTR_MIN && INTPTR_MAX && UINTPTR_MAX /* ok */ #else err or; #endif /* 7.18.1.5. Greatest-width integer types */ /* 7.18.2.5. Limits of greatest-width integer types */ intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX }; verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN); verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX); verify_same_types (INTMAX_MIN, (intmax_t) 0 + 0); verify_same_types (INTMAX_MAX, (intmax_t) 0 + 0); uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX }; verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX); verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0); /* As of 2007, Sun C and HP-UX 10.20 cc don't support 'long long' constants in the preprocessor. */ #if !(defined __SUNPRO_C || (defined __hpux && !defined __GNUC__)) #if INTMAX_MIN && INTMAX_MAX && UINTMAX_MAX /* ok */ #else err or; #endif #endif /* 7.18.3. Limits of other integer types */ #include <stddef.h> verify (TYPE_MINIMUM (ptrdiff_t) == PTRDIFF_MIN); verify (TYPE_MAXIMUM (ptrdiff_t) == PTRDIFF_MAX); verify_same_types (PTRDIFF_MIN, (ptrdiff_t) 0 + 0); verify_same_types (PTRDIFF_MAX, (ptrdiff_t) 0 + 0); #if PTRDIFF_MIN && PTRDIFF_MAX /* ok */ #else err or; #endif #include <signal.h> verify (TYPE_MINIMUM (sig_atomic_t) == SIG_ATOMIC_MIN); verify (TYPE_MAXIMUM (sig_atomic_t) == SIG_ATOMIC_MAX); verify_same_types (SIG_ATOMIC_MIN, (sig_atomic_t) 0 + 0); verify_same_types (SIG_ATOMIC_MAX, (sig_atomic_t) 0 + 0); #if SIG_ATOMIC_MIN != 17 && SIG_ATOMIC_MAX /* ok */ #else err or; #endif verify (TYPE_MAXIMUM (size_t) == SIZE_MAX); verify_same_types (SIZE_MAX, (size_t) 0 + 0); #if SIZE_MAX /* ok */ #else err or; #endif #if HAVE_WCHAR_T verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN); verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX); verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0); verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0); # if WCHAR_MIN != 17 && WCHAR_MAX /* ok */ # else err or; # endif #endif #if HAVE_WINT_T # include <wchar.h> verify (TYPE_MINIMUM (wint_t) == WINT_MIN); verify (TYPE_MAXIMUM (wint_t) == WINT_MAX); verify_same_types (WINT_MIN, (wint_t) 0 + 0); verify_same_types (WINT_MAX, (wint_t) 0 + 0); # if WINT_MIN != 17 && WINT_MAX /* ok */ # else err or; # endif #endif /* 7.18.4. Macros for integer constants */ verify (INT8_C (17) == 17); verify_same_types (INT8_C (17), (int_least8_t)0 + 0); verify (UINT8_C (17) == 17); verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0); verify (INT16_C (17) == 17); verify_same_types (INT16_C (17), (int_least16_t)0 + 0); verify (UINT16_C (17) == 17); verify_same_types (UINT16_C (17), (uint_least16_t)0 + 0); verify (INT32_C (17) == 17); verify_same_types (INT32_C (17), (int_least32_t)0 + 0); verify (UINT32_C (17) == 17); verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0); #ifdef INT64_C verify (INT64_C (17) == 17); verify_same_types (INT64_C (17), (int_least64_t)0 + 0); #endif #ifdef UINT64_C verify (UINT64_C (17) == 17); verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0); #endif verify (INTMAX_C (17) == 17); verify_same_types (INTMAX_C (17), (intmax_t)0 + 0); verify (UINTMAX_C (17) == 17); verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); /* Use _GL_VERIFY (with a fixed-length diagnostic string) rather than verify, because the latter would require forming each stringified expression, and many of these would be so long as to trigger a warning/error like this: test-stdint.c:407:1: error: string length '6980' is greater than the \ length '4095' ISO C99 compilers are required to support \ [-Werror=overlength-strings] */ #define verify_width(width, min, max) \ _GL_VERIFY ((max) >> ((width) - 1 - ((min) < 0)) == 1, \ "verify_width check", -) /* Macros specified by ISO/IEC TS 18661-1:2014. */ #ifdef INT8_MAX verify_width (INT8_WIDTH, INT8_MIN, INT8_MAX); #endif #ifdef UINT8_MAX verify_width (UINT8_WIDTH, 0, UINT8_MAX); #endif #ifdef INT16_MAX verify_width (INT16_WIDTH, INT16_MIN, INT16_MAX); #endif #ifdef UINT16_MAX verify_width (UINT16_WIDTH, 0, UINT16_MAX); #endif #ifdef INT32_MAX verify_width (INT32_WIDTH, INT32_MIN, INT32_MAX); #endif #ifdef UINT32_MAX verify_width (UINT32_WIDTH, 0, UINT32_MAX); #endif #ifdef INT64_MAX verify_width (INT64_WIDTH, INT64_MIN, INT64_MAX); #endif #ifdef UINT64_MAX verify_width (UINT64_WIDTH, 0, UINT64_MAX); #endif verify_width (INT_LEAST8_WIDTH, INT_LEAST8_MIN, INT_LEAST8_MAX); verify_width (UINT_LEAST8_WIDTH, 0, UINT_LEAST8_MAX); verify_width (INT_LEAST16_WIDTH, INT_LEAST16_MIN, INT_LEAST16_MAX); verify_width (UINT_LEAST16_WIDTH, 0, UINT_LEAST16_MAX); verify_width (INT_LEAST32_WIDTH, INT_LEAST32_MIN, INT_LEAST32_MAX); verify_width (UINT_LEAST32_WIDTH, 0, UINT_LEAST32_MAX); verify_width (INT_LEAST64_WIDTH, INT_LEAST64_MIN, INT_LEAST64_MAX); verify_width (UINT_LEAST64_WIDTH, 0, UINT_LEAST64_MAX); verify_width (INT_FAST8_WIDTH, INT_FAST8_MIN, INT_FAST8_MAX); verify_width (UINT_FAST8_WIDTH, 0, UINT_FAST8_MAX); verify_width (INT_FAST16_WIDTH, INT_FAST16_MIN, INT_FAST16_MAX); verify_width (UINT_FAST16_WIDTH, 0, UINT_FAST16_MAX); verify_width (INT_FAST32_WIDTH, INT_FAST32_MIN, INT_FAST32_MAX); verify_width (UINT_FAST32_WIDTH, 0, UINT_FAST32_MAX); verify_width (INT_FAST64_WIDTH, INT_FAST64_MIN, INT_FAST64_MAX); verify_width (UINT_FAST64_WIDTH, 0, UINT_FAST64_MAX); verify_width (INTPTR_WIDTH, INTPTR_MIN, INTPTR_MAX); verify_width (UINTPTR_WIDTH, 0, UINTPTR_MAX); verify_width (INTMAX_WIDTH, INTMAX_MIN, INTMAX_MAX); verify_width (UINTMAX_WIDTH, 0, UINTMAX_MAX); verify_width (PTRDIFF_WIDTH, PTRDIFF_MIN, PTRDIFF_MAX); verify_width (SIZE_WIDTH, 0, SIZE_MAX); verify_width (WCHAR_WIDTH, WCHAR_MIN, WCHAR_MAX); #ifdef WINT_MAX verify_width (WINT_WIDTH, WINT_MIN, WINT_MAX); #endif #ifdef SIG_ATOMIC_MAX verify_width (SIG_ATOMIC_WIDTH, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX); #endif int main (void) { return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-select-fd.c��������������������������������������������������0000664�0001750�0001750�00000004426�14670377436�022070� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of select() substitute, reading or writing from a given file descriptor. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include <stdio.h> #include <stdlib.h> #include <sys/select.h> int main (int argc, char *argv[]) { if (argc == 4) { char mode = argv[1][0]; if (mode == 'r' || mode == 'w') { int fd = atoi (argv[2]); if (fd >= 0) { const char *result_file_name = argv[3]; FILE *result_file = fopen (result_file_name, "wb"); if (result_file != NULL) { fd_set fds; struct timeval timeout; int ret; FD_ZERO (&fds); FD_SET (fd, &fds); timeout.tv_sec = 0; timeout.tv_usec = 10000; ret = (mode == 'r' ? select (fd + 1, &fds, NULL, NULL, &timeout) : select (fd + 1, NULL, &fds, NULL, &timeout)); if (ret < 0) { perror ("select failed"); exit (1); } if ((ret == 0) != ! FD_ISSET (fd, &fds)) { fprintf (stderr, "incorrect return value\n"); exit (1); } fprintf (result_file, "%d\n", ret); exit (0); } } } } fprintf (stderr, "Usage: test-select-fd mode fd result-file-name\n"); exit (1); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-select.c�����������������������������������������������������0000664�0001750�0001750�00000002026�14670377436�021473� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of select() substitute. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini, 2008. */ #include <config.h> #include <sys/select.h> #include "signature.h" SIGNATURE_CHECK (select, int, (int, fd_set *, fd_set *, fd_set *, struct timeval *)); #include "test-select.h" int main (void) { return test_function (select); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-setsockopt.c�������������������������������������������������0000664�0001750�0001750�00000002656�14670377436�022423� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test setsockopt() function. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <sys/socket.h> #include "signature.h" SIGNATURE_CHECK (setsockopt, int, (int, int, int, const void *, socklen_t)); #include <errno.h> #include <unistd.h> #include "sockets.h" #include "macros.h" int main (void) { (void) gl_sockets_startup (SOCKETS_1_1); /* Test behaviour for invalid file descriptors. */ { int value = 1; errno = 0; ASSERT (setsockopt (-1, SOL_SOCKET, SO_REUSEADDR, &value, sizeof (value)) == -1); ASSERT (errno == EBADF); } { int value = 1; close (99); errno = 0; ASSERT (setsockopt (99, SOL_SOCKET, SO_REUSEADDR, &value, sizeof (value)) == -1); ASSERT (errno == EBADF); } return 0; } ����������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/bind.c������������������������������������������������������������0000664�0001750�0001750�00000002423�14670377436�020154� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* bind.c --- wrappers for Windows bind function Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paolo Bonzini */ #include <config.h> #define WIN32_LEAN_AND_MEAN /* Get winsock2.h. */ #include <sys/socket.h> /* Get set_winsock_errno, FD_TO_SOCKET etc. */ #include "w32sock.h" #undef bind int rpl_bind (int fd, const struct sockaddr *sockaddr, socklen_t len) { SOCKET sock = FD_TO_SOCKET (fd); if (sock == INVALID_SOCKET) { errno = EBADF; return -1; } else { int r = bind (sock, sockaddr, len); if (r < 0) set_winsock_errno (); return r; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-malloca.c����������������������������������������������������0000664�0001750�0001750�00000003072�14670377436�021626� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of safe automatic memory allocation. Copyright (C) 2005, 2007, 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. */ #include <config.h> #include "malloca.h" #include <stdlib.h> static void do_allocation (int n) { void *volatile ptr = malloca (n); freea (ptr); safe_alloca (n); } void (*func) (int) = do_allocation; int main () { int i; /* This slows down malloc a lot. */ unsetenv ("MALLOC_PERTURB_"); /* Repeat a lot of times, to make sure there's no memory leak. */ for (i = 0; i < 50000; i++) { /* Try various values. n = 0 gave a crash on Alpha with gcc-2.5.8. Some versions of Mac OS X have a stack size limit of 512 KB. */ func (34); func (134); func (399); func (510823); func (129321); func (0); func (4070); func (4095); func (1); func (16582); } return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcrtomb-w32-6.sh���������������������������������������������0000775�0001750�0001750�00000000137�14670377437�022642� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test a GB18030 locale. ${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_China 54936 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/printf-parse.h����������������������������������������������������0000664�0001750�0001750�00000012225�14670377431�021653� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Parse printf format string. Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _PRINTF_PARSE_H #define _PRINTF_PARSE_H /* This file can be parametrized with the following macros: ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. STATIC Set to 'static' to declare the function static. */ #if HAVE_FEATURES_H # include <features.h> /* for __GLIBC__, __UCLIBC__ */ #endif #include "printf-args.h" /* Flags */ #define FLAG_GROUP 1 /* ' flag */ #define FLAG_LEFT 2 /* - flag */ #define FLAG_SHOWSIGN 4 /* + flag */ #define FLAG_SPACE 8 /* space flag */ #define FLAG_ALT 16 /* # flag */ #define FLAG_ZERO 32 #if __GLIBC__ >= 2 && !defined __UCLIBC__ # define FLAG_LOCALIZED 64 /* I flag, uses localized digits */ #endif /* arg_index value indicating that no argument is consumed. */ #define ARG_NONE (~(size_t)0) /* xxx_directive: A parsed directive. xxx_directives: A parsed format string. */ /* Number of directly allocated directives (no malloc() needed). */ #define N_DIRECT_ALLOC_DIRECTIVES 7 /* A parsed directive. */ typedef struct { const char* dir_start; const char* dir_end; int flags; const char* width_start; const char* width_end; size_t width_arg_index; const char* precision_start; const char* precision_end; size_t precision_arg_index; char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ size_t arg_index; } char_directive; /* A parsed format string. */ typedef struct { size_t count; char_directive *dir; size_t max_width_length; size_t max_precision_length; char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } char_directives; #if ENABLE_UNISTDIO /* A parsed directive. */ typedef struct { const uint8_t* dir_start; const uint8_t* dir_end; int flags; const uint8_t* width_start; const uint8_t* width_end; size_t width_arg_index; const uint8_t* precision_start; const uint8_t* precision_end; size_t precision_arg_index; uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ size_t arg_index; } u8_directive; /* A parsed format string. */ typedef struct { size_t count; u8_directive *dir; size_t max_width_length; size_t max_precision_length; u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } u8_directives; /* A parsed directive. */ typedef struct { const uint16_t* dir_start; const uint16_t* dir_end; int flags; const uint16_t* width_start; const uint16_t* width_end; size_t width_arg_index; const uint16_t* precision_start; const uint16_t* precision_end; size_t precision_arg_index; uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ size_t arg_index; } u16_directive; /* A parsed format string. */ typedef struct { size_t count; u16_directive *dir; size_t max_width_length; size_t max_precision_length; u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } u16_directives; /* A parsed directive. */ typedef struct { const uint32_t* dir_start; const uint32_t* dir_end; int flags; const uint32_t* width_start; const uint32_t* width_end; size_t width_arg_index; const uint32_t* precision_start; const uint32_t* precision_end; size_t precision_arg_index; uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ size_t arg_index; } u32_directive; /* A parsed format string. */ typedef struct { size_t count; u32_directive *dir; size_t max_width_length; size_t max_precision_length; u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } u32_directives; #endif /* Parses the format string. Fills in the number N of directives, and fills in directives[0], ..., directives[N-1], and sets directives[N].dir_start to the end of the format string. Also fills in the arg_type fields of the arguments and the needed count of arguments. */ #if ENABLE_UNISTDIO extern int ulc_printf_parse (const char *format, char_directives *d, arguments *a); extern int u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a); extern int u16_printf_parse (const uint16_t *format, u16_directives *d, arguments *a); extern int u32_printf_parse (const uint32_t *format, u32_directives *d, arguments *a); #else # ifdef STATIC STATIC # else extern # endif int printf_parse (const char *format, char_directives *d, arguments *a); #endif #endif /* _PRINTF_PARSE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-localcharset.c�����������������������������������������������0000664�0001750�0001750�00000002224�14670377436�022660� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Manual test of localcharset() function. Copyright (C) 2018-2021 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 <https://www.gnu.org/licenses/>. */ /* This program prints the result of locale_charset in the current locale. One way to use it is: $ for l in `locale -a`; do echo -n "$l "; LANG=$l ./test-localcharset; done \ | sort -k 2 */ #include <config.h> #include "localcharset.h" #include <locale.h> #include <stdio.h> int main (void) { setlocale (LC_ALL, ""); printf ("%s\n", locale_charset ()); return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-c-strcasecmp.c�����������������������������������������������0000664�0001750�0001750�00000004223�14670377436�022601� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of case-insensitive string comparison function. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include "c-strcase.h" #include "c-ctype.h" #include <locale.h> #include <string.h> #include "macros.h" int main (int argc, char *argv[]) { if (argc > 1) { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; } ASSERT (c_strcasecmp ("paragraph", "Paragraph") == 0); ASSERT (c_strcasecmp ("paragrapH", "parAgRaph") == 0); ASSERT (c_strcasecmp ("paragraph", "paraLyzed") < 0); ASSERT (c_strcasecmp ("paraLyzed", "paragraph") > 0); ASSERT (c_strcasecmp ("para", "paragraph") < 0); ASSERT (c_strcasecmp ("paragraph", "para") > 0); /* The following tests shows how c_strcasecmp() is different from strcasecmp(). */ ASSERT (c_strcasecmp ("\311mile", "\351mile") < 0); ASSERT (c_strcasecmp ("\351mile", "\311mile") > 0); /* The following tests shows how c_strcasecmp() is different from mbscasecmp(). */ ASSERT (c_strcasecmp ("\303\266zg\303\274r", "\303\226ZG\303\234R") > 0); /* özgür */ ASSERT (c_strcasecmp ("\303\226ZG\303\234R", "\303\266zg\303\274r") < 0); /* özgür */ #if C_CTYPE_ASCII /* This test shows how strings of different size cannot compare equal. */ ASSERT (c_strcasecmp ("turkish", "TURK\304\260SH") < 0); ASSERT (c_strcasecmp ("TURK\304\260SH", "turkish") > 0); #endif return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sys_stat.c���������������������������������������������������0000664�0001750�0001750�00000016266�14670377437�022101� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <sys/stat.h> substitute. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <sys/stat.h> #include "verify.h" /* Check the existence of some macros. */ int a[] = { S_IFMT, #ifdef S_IFBLK /* missing on MSVC */ S_IFBLK, #endif S_IFCHR, S_IFDIR, S_IFIFO, S_IFREG, #ifdef S_IFLNK /* missing on native Windows and DJGPP */ S_IFLNK, #endif #ifdef S_IFSOCK /* missing on native Windows and DJGPP */ S_IFSOCK, #endif S_IRWXU, S_IRUSR, S_IWUSR, S_IXUSR, S_IRWXG, S_IRGRP, S_IWGRP, S_IXGRP, S_IRWXO, S_IROTH, S_IWOTH, S_IXOTH, S_ISUID, S_ISGID, S_ISVTX, S_ISBLK (S_IFREG), S_ISCHR (S_IFREG), S_ISDIR (S_IFREG), S_ISFIFO (S_IFREG), S_ISREG (S_IFREG), S_ISLNK (S_IFREG), S_ISSOCK (S_IFREG), S_ISDOOR (S_IFREG), S_ISMPB (S_IFREG), S_ISMPX (S_IFREG), S_ISNAM (S_IFREG), S_ISNWK (S_IFREG), S_ISPORT (S_IFREG), S_ISCTG (S_IFREG), S_ISOFD (S_IFREG), S_ISOFL (S_IFREG), S_ISWHT (S_IFREG) }; /* Sanity checks. */ verify (S_IRWXU == (S_IRUSR | S_IWUSR | S_IXUSR)); verify (S_IRWXG == (S_IRGRP | S_IWGRP | S_IXGRP)); verify (S_IRWXO == (S_IROTH | S_IWOTH | S_IXOTH)); #ifdef S_IFBLK verify (S_ISBLK (S_IFBLK)); #endif verify (!S_ISBLK (S_IFCHR)); verify (!S_ISBLK (S_IFDIR)); verify (!S_ISBLK (S_IFIFO)); verify (!S_ISBLK (S_IFREG)); #ifdef S_IFLNK verify (!S_ISBLK (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISBLK (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISCHR (S_IFBLK)); #endif verify (S_ISCHR (S_IFCHR)); verify (!S_ISCHR (S_IFDIR)); verify (!S_ISCHR (S_IFIFO)); verify (!S_ISCHR (S_IFREG)); #ifdef S_IFLNK verify (!S_ISCHR (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISCHR (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISDIR (S_IFBLK)); #endif verify (!S_ISDIR (S_IFCHR)); verify (S_ISDIR (S_IFDIR)); verify (!S_ISDIR (S_IFIFO)); verify (!S_ISDIR (S_IFREG)); #ifdef S_IFLNK verify (!S_ISDIR (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISDIR (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISFIFO (S_IFBLK)); #endif verify (!S_ISFIFO (S_IFCHR)); verify (!S_ISFIFO (S_IFDIR)); verify (S_ISFIFO (S_IFIFO)); verify (!S_ISFIFO (S_IFREG)); #ifdef S_IFLNK verify (!S_ISFIFO (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISFIFO (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISREG (S_IFBLK)); #endif verify (!S_ISREG (S_IFCHR)); verify (!S_ISREG (S_IFDIR)); verify (!S_ISREG (S_IFIFO)); verify (S_ISREG (S_IFREG)); #ifdef S_IFLNK verify (!S_ISREG (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISREG (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISLNK (S_IFBLK)); #endif verify (!S_ISLNK (S_IFCHR)); verify (!S_ISLNK (S_IFDIR)); verify (!S_ISLNK (S_IFIFO)); verify (!S_ISLNK (S_IFREG)); #ifdef S_IFLNK verify (S_ISLNK (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISLNK (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISSOCK (S_IFBLK)); #endif verify (!S_ISSOCK (S_IFCHR)); verify (!S_ISSOCK (S_IFDIR)); verify (!S_ISSOCK (S_IFIFO)); verify (!S_ISSOCK (S_IFREG)); #ifdef S_IFLNK verify (!S_ISSOCK (S_IFLNK)); #endif #ifdef S_IFSOCK verify (S_ISSOCK (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISDOOR (S_IFBLK)); #endif verify (!S_ISDOOR (S_IFCHR)); verify (!S_ISDOOR (S_IFDIR)); verify (!S_ISDOOR (S_IFIFO)); verify (!S_ISDOOR (S_IFREG)); #ifdef S_IFLNK verify (!S_ISDOOR (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISDOOR (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISMPB (S_IFBLK)); #endif verify (!S_ISMPB (S_IFCHR)); verify (!S_ISMPB (S_IFDIR)); verify (!S_ISMPB (S_IFIFO)); verify (!S_ISMPB (S_IFREG)); #ifdef S_IFLNK verify (!S_ISMPB (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISMPB (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISMPX (S_IFBLK)); #endif verify (!S_ISMPX (S_IFCHR)); verify (!S_ISMPX (S_IFDIR)); verify (!S_ISMPX (S_IFIFO)); verify (!S_ISMPX (S_IFREG)); #ifdef S_IFLNK verify (!S_ISMPX (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISMPX (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISNAM (S_IFBLK)); #endif verify (!S_ISNAM (S_IFCHR)); verify (!S_ISNAM (S_IFDIR)); verify (!S_ISNAM (S_IFIFO)); verify (!S_ISNAM (S_IFREG)); #ifdef S_IFLNK verify (!S_ISNAM (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISNAM (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISNWK (S_IFBLK)); #endif verify (!S_ISNWK (S_IFCHR)); verify (!S_ISNWK (S_IFDIR)); verify (!S_ISNWK (S_IFIFO)); verify (!S_ISNWK (S_IFREG)); #ifdef S_IFLNK verify (!S_ISNWK (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISNWK (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISPORT (S_IFBLK)); #endif verify (!S_ISPORT (S_IFCHR)); verify (!S_ISPORT (S_IFDIR)); verify (!S_ISPORT (S_IFIFO)); verify (!S_ISPORT (S_IFREG)); #ifdef S_IFLNK verify (!S_ISPORT (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISPORT (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISCTG (S_IFBLK)); #endif verify (!S_ISCTG (S_IFCHR)); verify (!S_ISCTG (S_IFDIR)); verify (!S_ISCTG (S_IFIFO)); verify (!S_ISCTG (S_IFREG)); #ifdef S_IFLNK verify (!S_ISCTG (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISCTG (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISOFD (S_IFBLK)); #endif verify (!S_ISOFD (S_IFCHR)); verify (!S_ISOFD (S_IFDIR)); verify (!S_ISOFD (S_IFIFO)); verify (!S_ISOFD (S_IFREG)); #ifdef S_IFLNK verify (!S_ISOFD (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISOFD (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISOFL (S_IFBLK)); #endif verify (!S_ISOFL (S_IFCHR)); verify (!S_ISOFL (S_IFDIR)); verify (!S_ISOFL (S_IFIFO)); verify (!S_ISOFL (S_IFREG)); #ifdef S_IFLNK verify (!S_ISOFL (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISOFL (S_IFSOCK)); #endif #ifdef S_IFBLK verify (!S_ISWHT (S_IFBLK)); #endif verify (!S_ISWHT (S_IFCHR)); verify (!S_ISWHT (S_IFDIR)); verify (!S_ISWHT (S_IFIFO)); verify (!S_ISWHT (S_IFREG)); #ifdef S_IFLNK verify (!S_ISWHT (S_IFLNK)); #endif #ifdef S_IFSOCK verify (!S_ISWHT (S_IFSOCK)); #endif /* POSIX 2008 requires traditional encoding of permission constants. */ verify (S_IRWXU == 00700); verify (S_IRUSR == 00400); verify (S_IWUSR == 00200); verify (S_IXUSR == 00100); verify (S_IRWXG == 00070); verify (S_IRGRP == 00040); verify (S_IWGRP == 00020); verify (S_IXGRP == 00010); verify (S_IRWXO == 00007); verify (S_IROTH == 00004); verify (S_IWOTH == 00002); verify (S_IXOTH == 00001); verify (S_ISUID == 04000); verify (S_ISGID == 02000); verify (S_ISVTX == 01000); #if ((0 <= UTIME_NOW && UTIME_NOW < 1000000000) \ || (0 <= UTIME_OMIT && UTIME_OMIT < 1000000000) \ || UTIME_NOW == UTIME_OMIT) invalid UTIME macros #endif /* Check the existence of some types. */ nlink_t t1; off_t t2; mode_t t3; struct timespec st; int main (void) { return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-cloexec.c����������������������������������������������������0000664�0001750�0001750�00000007777�14670377436�021660� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test duplicating non-inheritable file descriptors. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include "cloexec.h" #include <errno.h> #include <fcntl.h> #include <unistd.h> #if defined _WIN32 && ! defined __CYGWIN__ /* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include <io.h> # endif #endif #include "binary-io.h" #include "macros.h" /* Return non-zero if FD is open and inheritable across exec/spawn. */ static int is_inheritable (int fd) { #if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows, the initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE, and there is no fcntl. */ HANDLE h = (HANDLE) _get_osfhandle (fd); DWORD flags; if (h == INVALID_HANDLE_VALUE || GetHandleInformation (h, &flags) == 0) return 0; return (flags & HANDLE_FLAG_INHERIT) != 0; #else # ifndef F_GETFD # error Please port fcntl to your platform # endif int i = fcntl (fd, F_GETFD); return 0 <= i && (i & FD_CLOEXEC) == 0; #endif } #if !O_BINARY # define set_binary_mode(f,m) zero () static int zero (void) { return 0; } #endif /* Return non-zero if FD is open in the given MODE, which is either O_TEXT or O_BINARY. */ static int is_mode (int fd, int mode) { int value = set_binary_mode (fd, O_BINARY); set_binary_mode (fd, value); return mode == value; } int main (void) { const char *file = "test-cloexec.tmp"; int fd = creat (file, 0600); int fd2; int bad_fd = getdtablesize (); /* Assume std descriptors were provided by invoker. */ ASSERT (STDERR_FILENO < fd); ASSERT (is_inheritable (fd)); /* Normal use of set_cloexec_flag. */ ASSERT (set_cloexec_flag (fd, true) == 0); #if !(defined _WIN32 && ! defined __CYGWIN__) ASSERT (!is_inheritable (fd)); #endif ASSERT (set_cloexec_flag (fd, false) == 0); ASSERT (is_inheritable (fd)); /* Normal use of dup_cloexec. */ fd2 = dup_cloexec (fd); ASSERT (fd < fd2); ASSERT (!is_inheritable (fd2)); ASSERT (close (fd) == 0); ASSERT (dup_cloexec (fd2) == fd); ASSERT (!is_inheritable (fd)); ASSERT (close (fd2) == 0); /* On systems that distinguish between text and binary mode, dup_cloexec reuses the mode of the source. */ set_binary_mode (fd, O_BINARY); ASSERT (is_mode (fd, O_BINARY)); fd2 = dup_cloexec (fd); ASSERT (fd < fd2); ASSERT (is_mode (fd2, O_BINARY)); ASSERT (close (fd2) == 0); set_binary_mode (fd, O_TEXT); ASSERT (is_mode (fd, O_TEXT)); fd2 = dup_cloexec (fd); ASSERT (fd < fd2); ASSERT (is_mode (fd2, O_TEXT)); ASSERT (close (fd2) == 0); /* Test error handling. */ errno = 0; ASSERT (set_cloexec_flag (-1, false) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (set_cloexec_flag (bad_fd, false) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (set_cloexec_flag (fd2, false) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (dup_cloexec (-1) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (dup_cloexec (bad_fd) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (dup_cloexec (fd2) == -1); ASSERT (errno == EBADF); /* Clean up. */ ASSERT (close (fd) == 0); ASSERT (unlink (file) == 0); return 0; } �kbuild-3608/src/grep/gnulib-tests/test-intprops.c���������������������������������������������������0000664�0001750�0001750�00000050173�14670377436�022100� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test intprops.h. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ /* Tell gcc not to warn about the long expressions that the overflow macros expand to, or about the (X < 0) expressions. */ #if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) # pragma GCC diagnostic ignored "-Woverlength-strings" # pragma GCC diagnostic ignored "-Wtype-limits" /* Work around a bug in GCC 6.1 and earlier; see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68971 */ # pragma GCC diagnostic ignored "-Woverflow" #endif #include <config.h> #include "intprops.h" #include "verify.h" #include <stdbool.h> #include <inttypes.h> #include <limits.h> #include "macros.h" /* Compile-time verification of expression X. In this file, we need it as a statement, rather than as a declaration. */ #define verify_stmt(x) do { verify (x); } while (0) /* VERIFY (X) uses a static assertion for compilers that are known to work, and falls back on a dynamic assertion for other compilers. These tests should be checkable via 'verify' rather than 'ASSERT', but using 'verify' would run into a bug with HP-UX 11.23 cc; see <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00401.html>. */ #if __GNUC__ || __clang__ || __SUNPRO_C # define VERIFY(x) verify_stmt (x) #else # define VERIFY(x) ASSERT (x) #endif #define DONTCARE __LINE__ int int_minus_2 = -2; int int_1 = 1; int main (void) { /* Use VERIFY for tests that must be integer constant expressions, ASSERT otherwise. */ /* TYPE_IS_INTEGER. */ ASSERT (TYPE_IS_INTEGER (bool)); ASSERT (TYPE_IS_INTEGER (char)); ASSERT (TYPE_IS_INTEGER (signed char)); ASSERT (TYPE_IS_INTEGER (unsigned char)); ASSERT (TYPE_IS_INTEGER (short int)); ASSERT (TYPE_IS_INTEGER (unsigned short int)); ASSERT (TYPE_IS_INTEGER (int)); ASSERT (TYPE_IS_INTEGER (unsigned int)); ASSERT (TYPE_IS_INTEGER (long int)); ASSERT (TYPE_IS_INTEGER (unsigned long int)); ASSERT (TYPE_IS_INTEGER (intmax_t)); ASSERT (TYPE_IS_INTEGER (uintmax_t)); ASSERT (! TYPE_IS_INTEGER (float)); ASSERT (! TYPE_IS_INTEGER (double)); ASSERT (! TYPE_IS_INTEGER (long double)); /* TYPE_SIGNED. */ /* VERIFY (! TYPE_SIGNED (bool)); // not guaranteed by gnulib substitute */ VERIFY (TYPE_SIGNED (signed char)); VERIFY (! TYPE_SIGNED (unsigned char)); VERIFY (TYPE_SIGNED (short int)); VERIFY (! TYPE_SIGNED (unsigned short int)); VERIFY (TYPE_SIGNED (int)); VERIFY (! TYPE_SIGNED (unsigned int)); VERIFY (TYPE_SIGNED (long int)); VERIFY (! TYPE_SIGNED (unsigned long int)); VERIFY (TYPE_SIGNED (intmax_t)); VERIFY (! TYPE_SIGNED (uintmax_t)); ASSERT (TYPE_SIGNED (float)); ASSERT (TYPE_SIGNED (double)); ASSERT (TYPE_SIGNED (long double)); /* Integer representation. Check that it is two's complement. */ VERIFY (INT_MIN + INT_MAX < 0); /* TYPE_MINIMUM, TYPE_MAXIMUM. */ VERIFY (TYPE_MINIMUM (char) == CHAR_MIN); VERIFY (TYPE_MAXIMUM (char) == CHAR_MAX); VERIFY (TYPE_MINIMUM (unsigned char) == 0); VERIFY (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX); VERIFY (TYPE_MINIMUM (signed char) == SCHAR_MIN); VERIFY (TYPE_MAXIMUM (signed char) == SCHAR_MAX); VERIFY (TYPE_MINIMUM (short int) == SHRT_MIN); VERIFY (TYPE_MAXIMUM (short int) == SHRT_MAX); VERIFY (TYPE_MINIMUM (unsigned short int) == 0); VERIFY (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX); VERIFY (TYPE_MINIMUM (int) == INT_MIN); VERIFY (TYPE_MAXIMUM (int) == INT_MAX); VERIFY (TYPE_MINIMUM (unsigned int) == 0); VERIFY (TYPE_MAXIMUM (unsigned int) == UINT_MAX); VERIFY (TYPE_MINIMUM (long int) == LONG_MIN); VERIFY (TYPE_MAXIMUM (long int) == LONG_MAX); VERIFY (TYPE_MINIMUM (unsigned long int) == 0); VERIFY (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX); #ifdef LLONG_MAX verify_stmt (TYPE_MINIMUM (long long int) == LLONG_MIN); verify_stmt (TYPE_MAXIMUM (long long int) == LLONG_MAX); verify_stmt (TYPE_MINIMUM (unsigned long long int) == 0); verify_stmt (TYPE_MAXIMUM (unsigned long long int) == ULLONG_MAX); #endif VERIFY (TYPE_MINIMUM (intmax_t) == INTMAX_MIN); VERIFY (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX); VERIFY (TYPE_MINIMUM (uintmax_t) == 0); VERIFY (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX); /* TYPE_WIDTH. */ #ifdef CHAR_WIDTH verify_stmt (TYPE_WIDTH (char) == CHAR_WIDTH); verify_stmt (TYPE_WIDTH (signed char) == SCHAR_WIDTH); verify_stmt (TYPE_WIDTH (unsigned char) == UCHAR_WIDTH); verify_stmt (TYPE_WIDTH (short int) == SHRT_WIDTH); verify_stmt (TYPE_WIDTH (unsigned short int) == USHRT_WIDTH); verify_stmt (TYPE_WIDTH (int) == INT_WIDTH); verify_stmt (TYPE_WIDTH (unsigned int) == UINT_WIDTH); verify_stmt (TYPE_WIDTH (long int) == LONG_WIDTH); verify_stmt (TYPE_WIDTH (unsigned long int) == ULONG_WIDTH); #ifdef LLONG_WIDTH verify_stmt (TYPE_WIDTH (long long int) == LLONG_WIDTH); verify_stmt (TYPE_WIDTH (unsigned long long int) == ULLONG_WIDTH); #endif #endif /* INT_BITS_STRLEN_BOUND. */ VERIFY (INT_BITS_STRLEN_BOUND (1) == 1); VERIFY (INT_BITS_STRLEN_BOUND (2620) == 789); /* INT_STRLEN_BOUND, INT_BUFSIZE_BOUND. */ #ifdef INT32_MAX /* POSIX guarantees int32_t; this ports to non-POSIX. */ VERIFY (INT_STRLEN_BOUND (int32_t) == sizeof ("-2147483648") - 1); VERIFY (INT_BUFSIZE_BOUND (int32_t) == sizeof ("-2147483648")); #endif #ifdef INT64_MAX VERIFY (INT_STRLEN_BOUND (int64_t) == sizeof ("-9223372036854775808") - 1); VERIFY (INT_BUFSIZE_BOUND (int64_t) == sizeof ("-9223372036854775808")); #endif /* All the INT_<op>_RANGE_OVERFLOW tests are equally valid as INT_<op>_OVERFLOW tests, so define macros to do both. OP is the operation, OPNAME its symbolic name, A and B its operands, T the result type, V the overflow flag, and VRES the result if V and if two's complement. CHECK_BINOP is for most binary operatinos, CHECK_SBINOP for binary +, -, * when the result type is signed, and CHECK_UNOP for unary operations. */ #define CHECK_BINOP(op, opname, a, b, t, v, vres) \ VERIFY (INT_##opname##_RANGE_OVERFLOW (a, b, TYPE_MINIMUM (t), \ TYPE_MAXIMUM (t)) \ == (v)); \ VERIFY (INT_##opname##_OVERFLOW (a, b) == (v)) #define CHECK_SBINOP(op, opname, a, b, t, v, vres) \ CHECK_BINOP(op, opname, a, b, t, v, vres); \ { \ t result; \ ASSERT (INT_##opname##_WRAPV (a, b, &result) == (v)); \ ASSERT (result == ((v) ? (vres) : ((a) op (b)))); \ } #define CHECK_UNOP(op, opname, a, t, v) \ VERIFY (INT_##opname##_RANGE_OVERFLOW (a, TYPE_MINIMUM (t), \ TYPE_MAXIMUM (t)) \ == (v)); \ VERIFY (INT_##opname##_OVERFLOW (a) == (v)) /* INT_<op>_RANGE_OVERFLOW, INT_<op>_OVERFLOW. */ VERIFY (INT_ADD_RANGE_OVERFLOW (INT_MAX, 1, INT_MIN, INT_MAX)); VERIFY (INT_ADD_OVERFLOW (INT_MAX, 1)); CHECK_SBINOP (+, ADD, INT_MAX, 1, int, true, INT_MIN); CHECK_SBINOP (+, ADD, INT_MAX, -1, int, false, INT_MAX - 1); CHECK_SBINOP (+, ADD, INT_MIN, 1, int, false, INT_MIN + 1); CHECK_SBINOP (+, ADD, INT_MIN, -1, int, true, INT_MAX); CHECK_BINOP (+, ADD, UINT_MAX, 1u, unsigned int, true, 0u); CHECK_BINOP (+, ADD, 0u, 1u, unsigned int, false, 1u); CHECK_SBINOP (-, SUBTRACT, INT_MAX, 1, int, false, INT_MAX - 1); CHECK_SBINOP (-, SUBTRACT, INT_MAX, -1, int, true, INT_MIN); CHECK_SBINOP (-, SUBTRACT, INT_MIN, 1, int, true, INT_MAX); CHECK_SBINOP (-, SUBTRACT, INT_MIN, -1, int, false, INT_MIN - -1); CHECK_BINOP (-, SUBTRACT, UINT_MAX, 1u, unsigned int, false, UINT_MAX - 1u); CHECK_BINOP (-, SUBTRACT, 0u, 1u, unsigned int, true, 0u - 1u); CHECK_UNOP (-, NEGATE, INT_MIN, int, true); CHECK_UNOP (-, NEGATE, 0, int, false); CHECK_UNOP (-, NEGATE, INT_MAX, int, false); CHECK_UNOP (-, NEGATE, 0u, unsigned int, false); CHECK_UNOP (-, NEGATE, 1u, unsigned int, true); CHECK_UNOP (-, NEGATE, UINT_MAX, unsigned int, true); CHECK_SBINOP (*, MULTIPLY, INT_MAX, INT_MAX, int, true, 1); CHECK_SBINOP (*, MULTIPLY, INT_MAX, INT_MIN, int, true, INT_MIN); CHECK_SBINOP (*, MULTIPLY, INT_MIN, INT_MAX, int, true, INT_MIN); CHECK_SBINOP (*, MULTIPLY, INT_MIN, INT_MIN, int, true, 0); CHECK_SBINOP (*, MULTIPLY, -1, INT_MIN, int, INT_NEGATE_OVERFLOW (INT_MIN), INT_MIN); #if !defined __HP_cc CHECK_SBINOP (*, MULTIPLY, LONG_MIN / INT_MAX, (long int) INT_MAX, long int, false, LONG_MIN - LONG_MIN % INT_MAX); #endif CHECK_BINOP (/, DIVIDE, INT_MIN, -1, int, INT_NEGATE_OVERFLOW (INT_MIN), INT_MIN); CHECK_BINOP (/, DIVIDE, INT_MAX, 1, int, false, INT_MAX); CHECK_BINOP (/, DIVIDE, (unsigned int) INT_MIN, -1u, unsigned int, false, INT_MIN / -1u); CHECK_BINOP (%, REMAINDER, INT_MIN, -1, int, INT_NEGATE_OVERFLOW (INT_MIN), 0); CHECK_BINOP (%, REMAINDER, INT_MAX, 1, int, false, 0); CHECK_BINOP (%, REMAINDER, (unsigned int) INT_MIN, -1u, unsigned int, false, INT_MIN % -1u); CHECK_BINOP (<<, LEFT_SHIFT, UINT_MAX, 1, unsigned int, true, UINT_MAX << 1); CHECK_BINOP (<<, LEFT_SHIFT, UINT_MAX / 2 + 1, 1, unsigned int, true, (UINT_MAX / 2 + 1) << 1); CHECK_BINOP (<<, LEFT_SHIFT, UINT_MAX / 2, 1, unsigned int, false, (UINT_MAX / 2) << 1); /* INT_<op>_OVERFLOW and INT_<op>_WRAPV with mixed types. */ #define CHECK_SUM(a, b, t, v, vres) \ CHECK_SUM1 (a, b, t, v, vres); \ CHECK_SUM1 (b, a, t, v, vres) #define CHECK_SUM_WRAPV(a, b, t, v, vres, okres) \ CHECK_SUM_WRAPV1 (a, b, t, v, vres, okres); \ CHECK_SUM_WRAPV1 (b, a, t, v, vres, okres) #define CHECK_SUM1(a, b, t, v, vres) \ VERIFY (INT_ADD_OVERFLOW (a, b) == (v)); \ CHECK_SUM_WRAPV1 (a, b, t, v, vres, (a) + (b)) #define CHECK_SUM_WRAPV1(a, b, t, v, vres, okres) \ { \ t result; \ ASSERT (INT_ADD_WRAPV (a, b, &result) == (v)); \ ASSERT (result == ((v) ? (vres) : (okres))); \ } CHECK_SUM (-1, LONG_MIN, long int, true, LONG_MAX); CHECK_SUM (-1, UINT_MAX, unsigned int, false, DONTCARE); CHECK_SUM (-1L, INT_MIN, long int, INT_MIN == LONG_MIN, INT_MIN == LONG_MIN ? INT_MAX : DONTCARE); CHECK_SUM (0u, -1, unsigned int, true, 0u + -1); CHECK_SUM (0u, 0, unsigned int, false, DONTCARE); CHECK_SUM (0u, 1, unsigned int, false, DONTCARE); CHECK_SUM (1, LONG_MAX, long int, true, LONG_MIN); CHECK_SUM (1, UINT_MAX, unsigned int, true, 0u); CHECK_SUM (1L, INT_MAX, long int, INT_MAX == LONG_MAX, INT_MAX == LONG_MAX ? INT_MIN : DONTCARE); CHECK_SUM (1u, INT_MAX, unsigned int, INT_MAX == UINT_MAX, 1u + INT_MAX); CHECK_SUM (1u, INT_MIN, unsigned int, true, 1u + INT_MIN); CHECK_SUM_WRAPV (-1, 1u, int, false, DONTCARE, 0); CHECK_SUM_WRAPV (-1, 1ul, int, false, DONTCARE, 0); CHECK_SUM_WRAPV (-1l, 1u, int, false, DONTCARE, 0); CHECK_SUM_WRAPV (-100, 1000u, int, false, DONTCARE, 900); CHECK_SUM_WRAPV (INT_MIN, UINT_MAX, int, false, DONTCARE, INT_MAX); CHECK_SUM_WRAPV (1u, INT_MAX, int, true, INT_MIN, DONTCARE); CHECK_SUM_WRAPV (INT_MAX, 1, long int, LONG_MAX <= INT_MAX, INT_MIN, INT_MAX + 1L); CHECK_SUM_WRAPV (UINT_MAX, 1, long int, LONG_MAX <= UINT_MAX, 0, UINT_MAX + 1L); CHECK_SUM_WRAPV (INT_MAX, 1, unsigned long int, ULONG_MAX <= INT_MAX, 0, INT_MAX + 1uL); CHECK_SUM_WRAPV (UINT_MAX, 1, unsigned long int, ULONG_MAX <= UINT_MAX, 0, UINT_MAX + 1uL); { long int result; ASSERT (INT_ADD_WRAPV (1, INT_MAX, &result) == (INT_MAX == LONG_MAX)); ASSERT (INT_ADD_WRAPV (-1, INT_MIN, &result) == (INT_MIN == LONG_MIN)); } #define CHECK_DIFFERENCE(a, b, t, v, vres) \ VERIFY (INT_SUBTRACT_OVERFLOW (a, b) == (v)) #define CHECK_SDIFFERENCE(a, b, t, v, vres) \ CHECK_DIFFERENCE (a, b, t, v, vres); \ CHECK_SDIFFERENCE_WRAPV (a, b, t, v, vres) #define CHECK_SDIFFERENCE_WRAPV(a, b, t, v, vres) \ { \ t result; \ ASSERT (INT_SUBTRACT_WRAPV (a, b, &result) == (v)); \ ASSERT (result == ((v) ? (vres) : ((a) - (b)))); \ } CHECK_DIFFERENCE (INT_MAX, 1u, unsigned int, UINT_MAX < INT_MAX - 1, INT_MAX - 1u); CHECK_DIFFERENCE (UINT_MAX, 1, unsigned int, false, UINT_MAX - 1); CHECK_DIFFERENCE (0u, -1, unsigned int, false, 0u - -1); CHECK_DIFFERENCE (UINT_MAX, -1, unsigned int, true, UINT_MAX - -1); CHECK_DIFFERENCE (INT_MIN, 1u, unsigned int, true, INT_MIN - 1u); CHECK_DIFFERENCE (-1, 0u, unsigned int, true, -1 - 0u); CHECK_SDIFFERENCE (-1, INT_MIN, int, false, -1 - INT_MIN); CHECK_SDIFFERENCE (-1, INT_MAX, int, false, -1 - INT_MAX); CHECK_SDIFFERENCE (0, INT_MIN, int, INT_MIN < -INT_MAX, INT_MIN); CHECK_SDIFFERENCE (0, INT_MAX, int, false, 0 - INT_MAX); CHECK_SDIFFERENCE_WRAPV (-1, 1u, int, false, DONTCARE); CHECK_SDIFFERENCE_WRAPV (-1, 1ul, int, false, DONTCARE); CHECK_SDIFFERENCE_WRAPV (-1l, 1u, int, false, DONTCARE); CHECK_SDIFFERENCE_WRAPV (0u, INT_MAX, int, false, DONTCARE); CHECK_SDIFFERENCE_WRAPV (1u, INT_MIN, int, true, 1u - INT_MIN); { long int result; ASSERT (INT_SUBTRACT_WRAPV (INT_MAX, -1, &result) == (INT_MAX == LONG_MAX)); ASSERT (INT_SUBTRACT_WRAPV (INT_MIN, 1, &result) == (INT_MAX == LONG_MAX)); } #define CHECK_PRODUCT(a, b, t, v, vres) \ CHECK_PRODUCT1 (a, b, t, v, vres); \ CHECK_PRODUCT1 (b, a, t, v, vres) #define CHECK_SPRODUCT(a, b, t, v, vres) \ CHECK_SPRODUCT1 (a, b, t, v, vres); \ CHECK_SPRODUCT1 (b, a, t, v, vres) #define CHECK_SPRODUCT_WRAPV(a, b, t, v, vres) \ CHECK_SPRODUCT_WRAPV1 (a, b, t, v, vres); \ CHECK_SPRODUCT_WRAPV1 (b, a, t, v, vres) #define CHECK_PRODUCT1(a, b, t, v, vres) \ VERIFY (INT_MULTIPLY_OVERFLOW (a, b) == (v)) #define CHECK_SPRODUCT1(a, b, t, v, vres) \ CHECK_PRODUCT1 (a, b, t, v, vres); \ CHECK_SPRODUCT_WRAPV1 (a, b, t, v, vres) #define CHECK_SPRODUCT_WRAPV1(a, b, t, v, vres) \ { \ t result; \ ASSERT (INT_MULTIPLY_WRAPV (a, b, &result) == (v)); \ ASSERT (result == ((v) ? (vres) : ((a) * (b)))); \ } CHECK_PRODUCT (-1, 1u, unsigned int, true, -1 * 1u); CHECK_SPRODUCT (-1, INT_MIN, int, INT_NEGATE_OVERFLOW (INT_MIN), INT_MIN); CHECK_PRODUCT (-1, UINT_MAX, unsigned int, true, -1 * UINT_MAX); CHECK_SPRODUCT (-32768, LONG_MAX / -32768 - 1, long int, true, LONG_MIN); CHECK_SPRODUCT (-12345, LONG_MAX / -12345, long int, false, DONTCARE); CHECK_SPRODUCT (0, -1, int, false, DONTCARE); CHECK_SPRODUCT (0, 0, int, false, DONTCARE); CHECK_PRODUCT (0, 0u, unsigned int, false, DONTCARE); CHECK_SPRODUCT (0, 1, int, false, DONTCARE); CHECK_SPRODUCT (0, INT_MAX, int, false, DONTCARE); CHECK_SPRODUCT (0, INT_MIN, int, false, DONTCARE); CHECK_PRODUCT (0, UINT_MAX, unsigned int, false, DONTCARE); CHECK_PRODUCT (0u, -1, unsigned int, false, DONTCARE); CHECK_PRODUCT (0u, 0, unsigned int, false, DONTCARE); CHECK_PRODUCT (0u, 0u, unsigned int, false, DONTCARE); CHECK_PRODUCT (0u, 1, unsigned int, false, DONTCARE); CHECK_PRODUCT (0u, INT_MAX, unsigned int, false, DONTCARE); CHECK_PRODUCT (0u, INT_MIN, unsigned int, false, DONTCARE); CHECK_PRODUCT (0u, UINT_MAX, unsigned int, false, DONTCARE); CHECK_SPRODUCT (1, INT_MAX, int, false, DONTCARE); CHECK_SPRODUCT (1, INT_MIN, int, false, DONTCARE); CHECK_PRODUCT (1, UINT_MAX, unsigned int, false, DONTCARE); CHECK_PRODUCT (1u, INT_MIN, unsigned int, true, 1u * INT_MIN); CHECK_PRODUCT (1u, INT_MAX, unsigned int, UINT_MAX < INT_MAX, 1u * INT_MAX); CHECK_PRODUCT (INT_MAX, UINT_MAX, unsigned int, true, INT_MAX * UINT_MAX); CHECK_PRODUCT (INT_MAX, ULONG_MAX, unsigned long int, true, INT_MAX * ULONG_MAX); #if !defined __HP_cc CHECK_SPRODUCT (INT_MIN, LONG_MAX / INT_MIN - 1, long int, true, LONG_MIN); CHECK_SPRODUCT (INT_MIN, LONG_MAX / INT_MIN, long int, false, DONTCARE); #endif CHECK_PRODUCT (INT_MIN, UINT_MAX, unsigned int, true, INT_MIN * UINT_MAX); CHECK_PRODUCT (INT_MIN, ULONG_MAX, unsigned long int, true, INT_MIN * ULONG_MAX); CHECK_SPRODUCT_WRAPV (-1, INT_MAX + 1u, int, false, DONTCARE); CHECK_SPRODUCT_WRAPV (-1, 1u, int, false, DONTCARE); CHECK_SPRODUCT (0, ULONG_MAX, int, false, DONTCARE); CHECK_SPRODUCT (0u, LONG_MIN, int, false, DONTCARE); { long int result; ASSERT (INT_MULTIPLY_WRAPV (INT_MAX, INT_MAX, &result) == (LONG_MAX / INT_MAX < INT_MAX)); ASSERT (INT_MULTIPLY_WRAPV (INT_MAX, INT_MAX, &result) || result == INT_MAX * (long int) INT_MAX); ASSERT (INT_MULTIPLY_WRAPV (INT_MIN, INT_MIN, &result) || result == INT_MIN * (long int) INT_MIN); } # ifdef LLONG_MAX { long long int result; ASSERT (INT_MULTIPLY_WRAPV (LONG_MAX, LONG_MAX, &result) == (LLONG_MAX / LONG_MAX < LONG_MAX)); ASSERT (INT_MULTIPLY_WRAPV (LONG_MAX, LONG_MAX, &result) || result == LONG_MAX * (long long int) LONG_MAX); ASSERT (INT_MULTIPLY_WRAPV (LONG_MIN, LONG_MIN, &result) || result == LONG_MIN * (long long int) LONG_MIN); } # endif /* Check for GCC bug 91450. */ { unsigned long long result; ASSERT (INT_MULTIPLY_WRAPV (int_minus_2, int_1, &result) && result == -2); } #define CHECK_QUOTIENT(a, b, v) VERIFY (INT_DIVIDE_OVERFLOW (a, b) == (v)) CHECK_QUOTIENT (INT_MIN, -1L, INT_MIN == LONG_MIN); CHECK_QUOTIENT (INT_MIN, UINT_MAX, false); CHECK_QUOTIENT (INTMAX_MIN, UINTMAX_MAX, false); CHECK_QUOTIENT (INTMAX_MIN, UINT_MAX, false); CHECK_QUOTIENT (-11, 10u, true); CHECK_QUOTIENT (-10, 10u, true); CHECK_QUOTIENT (-9, 10u, false); CHECK_QUOTIENT (11u, -10, true); CHECK_QUOTIENT (10u, -10, true); CHECK_QUOTIENT (9u, -10, false); #define CHECK_REMAINDER(a, b, v) VERIFY (INT_REMAINDER_OVERFLOW (a, b) == (v)) CHECK_REMAINDER (INT_MIN, -1L, INT_MIN == LONG_MIN); CHECK_REMAINDER (-1, UINT_MAX, true); CHECK_REMAINDER ((intmax_t) -1, UINTMAX_MAX, true); CHECK_REMAINDER (INTMAX_MIN, UINT_MAX, (INTMAX_MAX < UINT_MAX && - (unsigned int) INTMAX_MIN % UINT_MAX != 0)); CHECK_REMAINDER (INT_MIN, ULONG_MAX, INT_MIN % ULONG_MAX != 1); CHECK_REMAINDER (1u, -1, false); CHECK_REMAINDER (37*39u, -39, false); CHECK_REMAINDER (37*39u + 1, -39, true); CHECK_REMAINDER (37*39u - 1, -39, true); CHECK_REMAINDER (LONG_MAX, -INT_MAX, false); return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-calloc-gnu.c�������������������������������������������������0000664�0001750�0001750�00000003771�14670377431�022243� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of calloc function. Copyright (C) 2010-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include <stdlib.h> #include <errno.h> #include <stdint.h> #include "macros.h" /* Return N. Usual compilers are not able to infer something about the return value. */ static size_t identity (size_t n) { unsigned int x = rand (); unsigned int y = x * x * x * x; x++; y |= x * x * x * x; x++; y |= x * x * x * x; x++; y |= x * x * x * x; y = y >> 1; y &= -y; y -= 8; /* At this point Y is zero but GCC doesn't infer this. */ return n + y; } int main () { /* Check that calloc (0, 0) is not a NULL pointer. */ { void * volatile p = calloc (0, 0); ASSERT (p != NULL); free (p); } /* Check that calloc fails when requested to allocate a block of memory larger than PTRDIFF_MAX or SIZE_MAX bytes. Use 'identity' to avoid a compiler warning from GCC 7. 'volatile' is needed to defeat an incorrect optimization by clang 10, see <https://bugs.llvm.org/show_bug.cgi?id=46055>. */ { for (size_t n = 2; n != 0; n <<= 1) { void *volatile p = calloc (PTRDIFF_MAX / n + 1, identity (n)); ASSERT (p == NULL); ASSERT (errno == ENOMEM); p = calloc (SIZE_MAX / n + 1, identity (n)); ASSERT (p == NULL); ASSERT (errno == ENOMEM); } } return 0; } �������kbuild-3608/src/grep/gnulib-tests/test-sigsegv-catch-segv2.c����������������������������������������0000664�0001750�0001750�00000006642�14670377436�023777� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test that the handler can be exited multiple times. Copyright (C) 2002-2021 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 2 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible. */ #include <config.h> /* Specification. */ #include "sigsegv.h" #include <stdint.h> #include <stdio.h> #if HAVE_SIGSEGV_RECOVERY # if defined _WIN32 && !defined __CYGWIN__ /* Windows doesn't have sigset_t. */ typedef int sigset_t; # define sigemptyset(set) # define sigprocmask(how,set,oldset) # endif # include "mmap-anon-util.h" # include <stdlib.h> /* for abort, exit */ # include <signal.h> # include <setjmp.h> # if SIGSEGV_FAULT_ADDRESS_ALIGNMENT > 1UL # include <unistd.h> # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS (getpagesize () - 1) # else # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0 # endif jmp_buf mainloop; sigset_t mainsigset; volatile int pass = 0; uintptr_t page; volatile int handler_called = 0; static void handler_continuation (void *arg1, void *arg2, void *arg3) { longjmp (mainloop, pass); } int handler (void *fault_address, int serious) { handler_called++; if (handler_called > 10) abort (); if (fault_address != (void *)((page + 0x678 + 8 * pass) & ~SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS)) abort (); pass++; printf ("Fault %d caught.\n", pass); sigprocmask (SIG_SETMASK, &mainsigset, NULL); return sigsegv_leave_handler (handler_continuation, NULL, NULL, NULL); } void crasher (uintptr_t p) { *(volatile int *) (p + 0x678 + 8 * pass) = 42; } int main () { int prot_unwritable; void *p; sigset_t emptyset; /* Preparations. */ # if !HAVE_MAP_ANONYMOUS zero_fd = open ("/dev/zero", O_RDONLY, 0644); # endif # if defined __linux__ && defined __sparc__ /* On Linux 2.6.26/SPARC64, PROT_READ has the same effect as PROT_READ | PROT_WRITE. */ prot_unwritable = PROT_NONE; # else prot_unwritable = PROT_READ; # endif /* Setup some mmaped memory. */ p = mmap_zeromap ((void *) 0x12340000, 0x4000); if (p == (void *)(-1)) { fprintf (stderr, "mmap_zeromap failed.\n"); exit (2); } page = (uintptr_t) p; /* Make it read-only. */ if (mprotect ((void *) page, 0x4000, prot_unwritable) < 0) { fprintf (stderr, "mprotect failed.\n"); exit (2); } /* Install the SIGSEGV handler. */ if (sigsegv_install_handler (&handler) < 0) exit (2); /* Save the current signal mask. */ sigemptyset (&emptyset); sigprocmask (SIG_BLOCK, &emptyset, &mainsigset); /* Provoke two SIGSEGVs in a row. */ switch (setjmp (mainloop)) { case 0: case 1: printf ("Doing SIGSEGV pass %d.\n", pass + 1); crasher (page); printf ("no SIGSEGV?!\n"); exit (1); case 2: break; default: abort (); } /* Test passed! */ printf ("Test passed.\n"); return 0; } #else int main () { return 77; } #endif ����������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsstr3.c����������������������������������������������������0000664�0001750�0001750�00000004714�14670377436�021617� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of searching in a string. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <string.h> #include <locale.h> #include "macros.h" int main () { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; /* Tests with a character < 0x30. */ { const char input[] = "\312\276\300\375 \312\276\300\375 \312\276\300\375"; /* "示例 示例 示例" */ const char *result = mbsstr (input, " "); ASSERT (result == input + 4); } { const char input[] = "\312\276\300\375"; /* "示例" */ const char *result = mbsstr (input, " "); ASSERT (result == NULL); } /* Tests with a character >= 0x30. */ { const char input[] = "\272\305123\324\313\320\320\241\243"; /* "å·123è¿è¡Œã€‚" */ const char *result = mbsstr (input, "2"); ASSERT (result == input + 3); } /* The following tests show how mbsstr() is different from strstr(). */ { const char input[] = "\313\320\320\320"; /* "诵行" */ const char *result = mbsstr (input, "\320\320"); /* "行" */ ASSERT (result == input + 2); } { const char input[] = "\203\062\332\066123\324\313\320\320\241\243"; /* "씋123è¿è¡Œã€‚" */ const char *result = mbsstr (input, "2"); ASSERT (result == input + 5); } { const char input[] = "\312\276\300\375 \312\276\300\375 \312\276\300\375"; /* "示例 示例 示例" */ const char *result = mbsstr (input, "\276\300"); /* "纠" */ ASSERT (result == NULL); } { const char input[] = "\312\276\300\375 \312\276\300\375 \312\276\300\375"; /* "示例 示例 示例" */ const char *result = mbsstr (input, "\375 "); /* invalid multibyte sequence */ ASSERT (result == NULL); } return 0; } ����������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-nanosleep.c��������������������������������������������������0000664�0001750�0001750�00000004263�14670377436�022205� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of nanosleep() function. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <time.h> #include "signature.h" SIGNATURE_CHECK (nanosleep, int, (struct timespec const *, struct timespec *)); #include <errno.h> #include <signal.h> #include <unistd.h> #include "macros.h" #if HAVE_DECL_ALARM static void handle_alarm (int sig) { if (sig != SIGALRM) _exit (1); } #endif int main (void) { struct timespec ts; ts.tv_sec = 1000; ts.tv_nsec = -1; errno = 0; ASSERT (nanosleep (&ts, NULL) == -1); ASSERT (errno == EINVAL); ts.tv_nsec = 1000000000; errno = 0; ASSERT (nanosleep (&ts, NULL) == -1); ASSERT (errno == EINVAL); ts.tv_sec = 0; ts.tv_nsec = 1; ASSERT (nanosleep (&ts, &ts) == 0); /* Remaining time is only defined on EINTR failure; but on success, it is typically either 0 or unchanged from input. At any rate, it shouldn't be randomly changed to unrelated values. */ ASSERT (ts.tv_sec == 0); ASSERT (ts.tv_nsec == 0 || ts.tv_nsec == 1); ts.tv_nsec = 0; ASSERT (nanosleep (&ts, NULL) == 0); #if HAVE_DECL_ALARM { const time_t pentecost = 50 * 24 * 60 * 60; /* 50 days. */ signal (SIGALRM, handle_alarm); alarm (1); ts.tv_sec = pentecost; ts.tv_nsec = 999999999; errno = 0; ASSERT (nanosleep (&ts, &ts) == -1); ASSERT (errno == EINTR); ASSERT (pentecost - 10 < ts.tv_sec && ts.tv_sec <= pentecost); ASSERT (0 <= ts.tv_nsec && ts.tv_nsec <= 999999999); } #endif return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fpending.c���������������������������������������������������0000664�0001750�0001750�00000002057�14670377436�022012� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Ensure that __fpending works. Copyright (C) 2004, 2007-2021 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 <https://www.gnu.org/licenses/>. Written by Jim Meyering. */ #include <config.h> #include "fpending.h" #include <stdio.h> #include <stdlib.h> #include "macros.h" int main (void) { ASSERT (__fpending (stdout) == 0); fputs ("foo", stdout); ASSERT (__fpending (stdout) == 3); fflush (stdout); ASSERT (__fpending (stdout) == 0); exit (0); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sys_socket.in.h���������������������������������������������������0000664�0001750�0001750�00000057572�14670377436�022057� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Provide a sys/socket header file for systems lacking it (read: MinGW) and for systems where it is incomplete. Copyright (C) 2005-2021 Free Software Foundation, Inc. Written by Simon Josefsson. 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. 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 Lesser General Public License for more details. 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/>. */ /* This file is supposed to be used on platforms that lack <sys/socket.h>, on platforms where <sys/socket.h> cannot be included standalone, and on platforms where <sys/socket.h> does not provide all necessary definitions. It is intended to provide definitions and prototypes needed by an application. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H /* Special invocation convention: - On Cygwin 1.5.x we have a sequence of nested includes <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>, and the latter includes <sys/socket.h>. In this situation, the functions are not yet declared, therefore we cannot provide the C++ aliases. */ #@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H #if @HAVE_SYS_SOCKET_H@ # define _GL_ALREADY_INCLUDING_SYS_SOCKET_H /* On many platforms, <sys/socket.h> assumes prior inclusion of <sys/types.h>. */ # include <sys/types.h> /* On FreeBSD 6.4, <sys/socket.h> defines some macros that assume that NULL is defined. */ # include <stddef.h> /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ # undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H #endif #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H #define _@GUARD_PREFIX@_SYS_SOCKET_H #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_SYS_SOCKET_INLINE # define _GL_SYS_SOCKET_INLINE _GL_INLINE #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ #if !@HAVE_SA_FAMILY_T@ # if !GNULIB_defined_sa_family_t /* On OS/2 kLIBC, sa_family_t is unsigned char unless TCPV40HDRS is defined. */ # if !defined __KLIBC__ || defined TCPV40HDRS typedef unsigned short sa_family_t; # else typedef unsigned char sa_family_t; # endif # define GNULIB_defined_sa_family_t 1 # endif #endif #if @HAVE_STRUCT_SOCKADDR_STORAGE@ /* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1. */ # if !@HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@ # ifndef ss_family # define ss_family __ss_family # endif # endif #else # include <stdalign.h> /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */ # define __ss_aligntype unsigned long int # define _SS_SIZE 256 # define _SS_PADSIZE \ (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \ ? sizeof (sa_family_t) \ : alignof (__ss_aligntype)) \ + sizeof (__ss_aligntype))) # if !GNULIB_defined_struct_sockaddr_storage struct sockaddr_storage { sa_family_t ss_family; /* Address family, etc. */ __ss_aligntype __ss_align; /* Force desired alignment. */ char __ss_padding[_SS_PADSIZE]; }; # define GNULIB_defined_struct_sockaddr_storage 1 # endif #endif /* Get struct iovec. */ /* But avoid namespace pollution on glibc systems. */ #if ! defined __GLIBC__ # include <sys/uio.h> #endif #if @HAVE_SYS_SOCKET_H@ /* A platform that has <sys/socket.h>. */ /* For shutdown(). */ # if !defined SHUT_RD # define SHUT_RD 0 # endif # if !defined SHUT_WR # define SHUT_WR 1 # endif # if !defined SHUT_RDWR # define SHUT_RDWR 2 # endif # ifdef __VMS /* OpenVMS */ # ifndef CMSG_SPACE # define CMSG_SPACE(length) _CMSG_SPACE(length) # endif # ifndef CMSG_LEN # define CMSG_LEN(length) _CMSG_LEN(length) # endif # endif #else # ifdef __CYGWIN__ # error "Cygwin does have a sys/socket.h, doesn't it?!?" # endif /* A platform that lacks <sys/socket.h>. Currently only MinGW is supported. See the gnulib manual regarding Windows sockets. MinGW has the header files winsock2.h and ws2tcpip.h that declare the sys/socket.h definitions we need. Note that you can influence which definitions you get by setting the WINVER symbol before including these two files. For example, getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that symbol is set indirectly through WINVER). You can set this by adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your code may not run on older Windows releases then. My Windows 2000 box was not able to run the code, for example. The situation is slightly confusing because <https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfo> suggests that getaddrinfo should be available on all Windows releases. */ # if @HAVE_WINSOCK2_H@ # include <winsock2.h> # endif # if @HAVE_WS2TCPIP_H@ # include <ws2tcpip.h> # endif /* For shutdown(). */ # if !defined SHUT_RD && defined SD_RECEIVE # define SHUT_RD SD_RECEIVE # endif # if !defined SHUT_WR && defined SD_SEND # define SHUT_WR SD_SEND # endif # if !defined SHUT_RDWR && defined SD_BOTH # define SHUT_RDWR SD_BOTH # endif # if @HAVE_WINSOCK2_H@ /* Include headers needed by the emulation code. */ # include <sys/types.h> # include <io.h> /* If these headers don't define socklen_t, <config.h> does. */ # endif /* Rudimentary 'struct msghdr'; this works as long as you don't try to access msg_control or msg_controllen. */ struct msghdr { void *msg_name; socklen_t msg_namelen; struct iovec *msg_iov; int msg_iovlen; int msg_flags; }; #endif /* Ensure SO_REUSEPORT is defined. */ /* For the subtle differences between SO_REUSEPORT and SO_REUSEADDR, see https://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t and https://lwn.net/Articles/542629/ */ #ifndef SO_REUSEPORT # define SO_REUSEPORT SO_REUSEADDR #endif /* Fix some definitions from <winsock2.h>. */ #if @HAVE_WINSOCK2_H@ # if !GNULIB_defined_rpl_fd_isset /* Re-define FD_ISSET to avoid a WSA call while we are not using network sockets. */ _GL_SYS_SOCKET_INLINE int rpl_fd_isset (SOCKET fd, fd_set * set) { u_int i; if (set == NULL) return 0; for (i = 0; i < set->fd_count; i++) if (set->fd_array[i] == fd) return 1; return 0; } # define GNULIB_defined_rpl_fd_isset 1 # endif # undef FD_ISSET # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) #endif /* Hide some function declarations from <winsock2.h>. */ #if @HAVE_WINSOCK2_H@ # if !defined _@GUARD_PREFIX@_UNISTD_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef close # define close close_used_without_including_unistd_h # elif !defined __clang__ _GL_WARN_ON_USE (close, "close() used without including <unistd.h>"); # endif # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gethostname # define gethostname gethostname_used_without_including_unistd_h # else _GL_WARN_ON_USE (gethostname, "gethostname() used without including <unistd.h>"); # endif # endif # if !defined _@GUARD_PREFIX@_SYS_SELECT_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef select # define select select_used_without_including_sys_select_h # else _GL_WARN_ON_USE (select, "select() used without including <sys/select.h>"); # endif # endif #endif /* Wrap everything else to use libc file descriptors for sockets. */ #if @GNULIB_SOCKET@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef socket # define socket rpl_socket # endif _GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol)); _GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol)); # else _GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol)); # endif _GL_CXXALIASWARN (socket); #elif @HAVE_WINSOCK2_H@ # undef socket # define socket socket_used_without_requesting_gnulib_module_socket #elif defined GNULIB_POSIXCHECK # undef socket # if HAVE_RAW_DECL_SOCKET _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - " "use gnulib module socket for portability"); # endif #endif #if @GNULIB_CONNECT@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef connect # define connect rpl_connect # endif _GL_FUNCDECL_RPL (connect, int, (int fd, const struct sockaddr *addr, socklen_t addrlen) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (connect, int, (int fd, const struct sockaddr *addr, socklen_t addrlen)); # else /* Need to cast, because on NonStop Kernel, the third parameter is size_t addrlen. */ _GL_CXXALIAS_SYS_CAST (connect, int, (int fd, const struct sockaddr *addr, socklen_t addrlen)); # endif _GL_CXXALIASWARN (connect); #elif @HAVE_WINSOCK2_H@ # undef connect # define connect socket_used_without_requesting_gnulib_module_connect #elif defined GNULIB_POSIXCHECK # undef connect # if HAVE_RAW_DECL_CONNECT _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - " "use gnulib module connect for portability"); # endif #endif #if @GNULIB_ACCEPT@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef accept # define accept rpl_accept # endif _GL_FUNCDECL_RPL (accept, int, (int fd, struct sockaddr *restrict addr, socklen_t *restrict addrlen)); _GL_CXXALIAS_RPL (accept, int, (int fd, struct sockaddr *restrict addr, socklen_t *restrict addrlen)); # else /* Need to cast, because on Solaris 10 systems, the third parameter is void *addrlen. */ _GL_CXXALIAS_SYS_CAST (accept, int, (int fd, struct sockaddr *restrict addr, socklen_t *restrict addrlen)); # endif _GL_CXXALIASWARN (accept); #elif @HAVE_WINSOCK2_H@ # undef accept # define accept accept_used_without_requesting_gnulib_module_accept #elif defined GNULIB_POSIXCHECK # undef accept # if HAVE_RAW_DECL_ACCEPT _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - " "use gnulib module accept for portability"); # endif #endif #if @GNULIB_BIND@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef bind # define bind rpl_bind # endif _GL_FUNCDECL_RPL (bind, int, (int fd, const struct sockaddr *addr, socklen_t addrlen) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (bind, int, (int fd, const struct sockaddr *addr, socklen_t addrlen)); # else /* Need to cast, because on NonStop Kernel, the third parameter is size_t addrlen. */ _GL_CXXALIAS_SYS_CAST (bind, int, (int fd, const struct sockaddr *addr, socklen_t addrlen)); # endif _GL_CXXALIASWARN (bind); #elif @HAVE_WINSOCK2_H@ # undef bind # define bind bind_used_without_requesting_gnulib_module_bind #elif defined GNULIB_POSIXCHECK # undef bind # if HAVE_RAW_DECL_BIND _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - " "use gnulib module bind for portability"); # endif #endif #if @GNULIB_GETPEERNAME@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getpeername # define getpeername rpl_getpeername # endif _GL_FUNCDECL_RPL (getpeername, int, (int fd, struct sockaddr *restrict addr, socklen_t *restrict addrlen) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (getpeername, int, (int fd, struct sockaddr *restrict addr, socklen_t *restrict addrlen)); # else /* Need to cast, because on Solaris 10 systems, the third parameter is void *addrlen. */ _GL_CXXALIAS_SYS_CAST (getpeername, int, (int fd, struct sockaddr *restrict addr, socklen_t *restrict addrlen)); # endif _GL_CXXALIASWARN (getpeername); #elif @HAVE_WINSOCK2_H@ # undef getpeername # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername #elif defined GNULIB_POSIXCHECK # undef getpeername # if HAVE_RAW_DECL_GETPEERNAME _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - " "use gnulib module getpeername for portability"); # endif #endif #if @GNULIB_GETSOCKNAME@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getsockname # define getsockname rpl_getsockname # endif _GL_FUNCDECL_RPL (getsockname, int, (int fd, struct sockaddr *restrict addr, socklen_t *restrict addrlen) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (getsockname, int, (int fd, struct sockaddr *restrict addr, socklen_t *restrict addrlen)); # else /* Need to cast, because on Solaris 10 systems, the third parameter is void *addrlen. */ _GL_CXXALIAS_SYS_CAST (getsockname, int, (int fd, struct sockaddr *restrict addr, socklen_t *restrict addrlen)); # endif _GL_CXXALIASWARN (getsockname); #elif @HAVE_WINSOCK2_H@ # undef getsockname # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname #elif defined GNULIB_POSIXCHECK # undef getsockname # if HAVE_RAW_DECL_GETSOCKNAME _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - " "use gnulib module getsockname for portability"); # endif #endif #if @GNULIB_GETSOCKOPT@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getsockopt # define getsockopt rpl_getsockopt # endif _GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname, void *restrict optval, socklen_t *restrict optlen) _GL_ARG_NONNULL ((4, 5))); _GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname, void *restrict optval, socklen_t *restrict optlen)); # else /* Need to cast, because on Solaris 10 systems, the fifth parameter is void *optlen. */ _GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname, void *restrict optval, socklen_t *restrict optlen)); # endif _GL_CXXALIASWARN (getsockopt); #elif @HAVE_WINSOCK2_H@ # undef getsockopt # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt #elif defined GNULIB_POSIXCHECK # undef getsockopt # if HAVE_RAW_DECL_GETSOCKOPT _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - " "use gnulib module getsockopt for portability"); # endif #endif #if @GNULIB_LISTEN@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef listen # define listen rpl_listen # endif _GL_FUNCDECL_RPL (listen, int, (int fd, int backlog)); _GL_CXXALIAS_RPL (listen, int, (int fd, int backlog)); # else _GL_CXXALIAS_SYS (listen, int, (int fd, int backlog)); # endif _GL_CXXALIASWARN (listen); #elif @HAVE_WINSOCK2_H@ # undef listen # define listen listen_used_without_requesting_gnulib_module_listen #elif defined GNULIB_POSIXCHECK # undef listen # if HAVE_RAW_DECL_LISTEN _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - " "use gnulib module listen for portability"); # endif #endif #if @GNULIB_RECV@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef recv # define recv rpl_recv # endif _GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); # else /* Need to cast, because on HP-UX 11.31 the return type may be int, depending on compiler options. */ _GL_CXXALIAS_SYS_CAST (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); # endif _GL_CXXALIASWARN (recv); #elif @HAVE_WINSOCK2_H@ # undef recv # define recv recv_used_without_requesting_gnulib_module_recv #elif defined GNULIB_POSIXCHECK # undef recv # if HAVE_RAW_DECL_RECV _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - " "use gnulib module recv for portability"); # endif #endif #if @GNULIB_SEND@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef send # define send rpl_send # endif _GL_FUNCDECL_RPL (send, ssize_t, (int fd, const void *buf, size_t len, int flags) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (send, ssize_t, (int fd, const void *buf, size_t len, int flags)); # else /* Need to cast, because on HP-UX 11.31 the return type may be int, depending on compiler options. */ _GL_CXXALIAS_SYS_CAST (send, ssize_t, (int fd, const void *buf, size_t len, int flags)); # endif _GL_CXXALIASWARN (send); #elif @HAVE_WINSOCK2_H@ # undef send # define send send_used_without_requesting_gnulib_module_send #elif defined GNULIB_POSIXCHECK # undef send # if HAVE_RAW_DECL_SEND _GL_WARN_ON_USE (send, "send is not always POSIX compliant - " "use gnulib module send for portability"); # endif #endif #if @GNULIB_RECVFROM@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef recvfrom # define recvfrom rpl_recvfrom # endif _GL_FUNCDECL_RPL (recvfrom, ssize_t, (int fd, void *restrict buf, size_t len, int flags, struct sockaddr *restrict from, socklen_t *restrict fromlen) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (recvfrom, ssize_t, (int fd, void *restrict buf, size_t len, int flags, struct sockaddr *restrict from, socklen_t *restrict fromlen)); # else /* Need to cast, because on Solaris 10 systems, the sixth parameter is void *fromlen. */ _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t, (int fd, void *restrict buf, size_t len, int flags, struct sockaddr *restrict from, socklen_t *restrict fromlen)); # endif _GL_CXXALIASWARN (recvfrom); #elif @HAVE_WINSOCK2_H@ # undef recvfrom # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom #elif defined GNULIB_POSIXCHECK # undef recvfrom # if HAVE_RAW_DECL_RECVFROM _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - " "use gnulib module recvfrom for portability"); # endif #endif #if @GNULIB_SENDTO@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef sendto # define sendto rpl_sendto # endif _GL_FUNCDECL_RPL (sendto, ssize_t, (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (sendto, ssize_t, (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)); # else /* Need to cast, because on NonStop Kernel, the sixth parameter is size_t tolen. */ _GL_CXXALIAS_SYS_CAST (sendto, ssize_t, (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)); # endif _GL_CXXALIASWARN (sendto); #elif @HAVE_WINSOCK2_H@ # undef sendto # define sendto sendto_used_without_requesting_gnulib_module_sendto #elif defined GNULIB_POSIXCHECK # undef sendto # if HAVE_RAW_DECL_SENDTO _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - " "use gnulib module sendto for portability"); # endif #endif #if @GNULIB_SETSOCKOPT@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef setsockopt # define setsockopt rpl_setsockopt # endif _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname, const void * optval, socklen_t optlen) _GL_ARG_NONNULL ((4))); _GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname, const void * optval, socklen_t optlen)); # else /* Need to cast, because on NonStop Kernel, the fifth parameter is size_t optlen. */ _GL_CXXALIAS_SYS_CAST (setsockopt, int, (int fd, int level, int optname, const void * optval, socklen_t optlen)); # endif _GL_CXXALIASWARN (setsockopt); #elif @HAVE_WINSOCK2_H@ # undef setsockopt # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt #elif defined GNULIB_POSIXCHECK # undef setsockopt # if HAVE_RAW_DECL_SETSOCKOPT _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - " "use gnulib module setsockopt for portability"); # endif #endif #if @GNULIB_SHUTDOWN@ # if @HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef shutdown # define shutdown rpl_shutdown # endif _GL_FUNCDECL_RPL (shutdown, int, (int fd, int how)); _GL_CXXALIAS_RPL (shutdown, int, (int fd, int how)); # else _GL_CXXALIAS_SYS (shutdown, int, (int fd, int how)); # endif _GL_CXXALIASWARN (shutdown); #elif @HAVE_WINSOCK2_H@ # undef shutdown # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown #elif defined GNULIB_POSIXCHECK # undef shutdown # if HAVE_RAW_DECL_SHUTDOWN _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " "use gnulib module shutdown for portability"); # endif #endif #if @GNULIB_ACCEPT4@ /* Accept a connection on a socket, with specific opening flags. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) and O_TEXT, O_BINARY (defined in "binary-io.h"). See also the Linux man page at <https://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */ # if @HAVE_ACCEPT4@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define accept4 rpl_accept4 # endif _GL_FUNCDECL_RPL (accept4, int, (int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)); _GL_CXXALIAS_RPL (accept4, int, (int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)); # else _GL_FUNCDECL_SYS (accept4, int, (int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)); _GL_CXXALIAS_SYS (accept4, int, (int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)); # endif _GL_CXXALIASWARN (accept4); #elif defined GNULIB_POSIXCHECK # undef accept4 # if HAVE_RAW_DECL_ACCEPT4 _GL_WARN_ON_USE (accept4, "accept4 is unportable - " "use gnulib module accept4 for portability"); # endif #endif _GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */ #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */ #endif ��������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-strstr.c�����������������������������������������������������0000664�0001750�0001750�00000021405�14670377436�021557� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2004, 2007-2021 Free Software Foundation, Inc. * Written by Bruno Haible and Eric Blake * * 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <string.h> #include "signature.h" SIGNATURE_CHECK (strstr, char *, (char const *, char const *)); #include <signal.h> #include <stdlib.h> #include <unistd.h> #include "zerosize-ptr.h" #include "macros.h" int main (int argc, char *argv[]) { #if HAVE_DECL_ALARM /* Declare failure if test takes too long, by using default abort caused by SIGALRM. All known platforms that lack alarm also have a quadratic strstr, and the replacement strstr is known to not take too long. */ int alarm_value = 50; signal (SIGALRM, SIG_DFL); alarm (alarm_value); #endif { const char input[] = "foo"; const char *result = strstr (input, ""); ASSERT (result == input); } { const char input[] = "foo"; const char *result = strstr (input, "o"); ASSERT (result == input + 1); } { /* On some platforms, the memchr() functions reads past the first occurrence of the byte to be searched, leading to an out-of-bounds read access for strstr(). See <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737>. This is a bug in memchr(), see the Austin Group's clarification <https://www.opengroup.org/austin/docs/austin_454.txt>. */ const char *fix = "aBaaaaaaaaaaax"; char *page_boundary = (char *) zerosize_ptr (); size_t len = strlen (fix) + 1; char *input = page_boundary ? page_boundary - len : malloc (len); const char *result; strcpy (input, fix); result = strstr (input, "B1x"); ASSERT (result == NULL); if (!page_boundary) free (input); } { const char input[] = "ABC ABCDAB ABCDABCDABDE"; const char *result = strstr (input, "ABCDABD"); ASSERT (result == input + 15); } { const char input[] = "ABC ABCDAB ABCDABCDABDE"; const char *result = strstr (input, "ABCDABE"); ASSERT (result == NULL); } { const char input[] = "ABC ABCDAB ABCDABCDABDE"; const char *result = strstr (input, "ABCDABCD"); ASSERT (result == input + 11); } /* Check that a long periodic needle does not cause false positives. */ { const char input[] = "F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD" "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD" "_C3_A7_20_EF_BF_BD"; const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"; const char *result = strstr (input, need); ASSERT (result == NULL); } { const char input[] = "F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD" "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD" "_C3_A7_20_EF_BF_BD_DA_B5_C2_A6_20" "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"; const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"; const char *result = strstr (input, need); ASSERT (result == input + 115); } /* Check that a very long haystack is handled quickly if the needle is short and occurs near the beginning. */ { size_t repeat = 10000; size_t m = 1000000; const char *needle = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; char *haystack = (char *) malloc (m + 1); if (haystack != NULL) { memset (haystack, 'A', m); haystack[0] = 'B'; haystack[m] = '\0'; for (; repeat > 0; repeat--) { ASSERT (strstr (haystack, needle) == haystack + 1); } free (haystack); } } /* Check that a very long needle is discarded quickly if the haystack is short. */ { size_t repeat = 10000; size_t m = 1000000; const char *haystack = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB"; char *needle = (char *) malloc (m + 1); if (needle != NULL) { memset (needle, 'A', m); needle[m] = '\0'; for (; repeat > 0; repeat--) { ASSERT (strstr (haystack, needle) == NULL); } free (needle); } } /* Check that the asymptotic worst-case complexity is not quadratic. */ { size_t m = 1000000; char *haystack = (char *) malloc (2 * m + 2); char *needle = (char *) malloc (m + 2); if (haystack != NULL && needle != NULL) { const char *result; memset (haystack, 'A', 2 * m); haystack[2 * m] = 'B'; haystack[2 * m + 1] = '\0'; memset (needle, 'A', m); needle[m] = 'B'; needle[m + 1] = '\0'; result = strstr (haystack, needle); ASSERT (result == haystack + m); } free (needle); free (haystack); } /* Sublinear speed is only possible in memmem; strstr must examine every character of haystack to find its length. */ { /* Ensure that with a barely periodic "short" needle, strstr's search does not mistakenly skip just past the match point. This use of strstr would mistakenly return NULL before gnulib v0.0-4927. */ const char *haystack = "\n" "with_build_libsubdir\n" "with_local_prefix\n" "with_gxx_include_dir\n" "with_cpp_install_dir\n" "enable_generated_files_in_srcdir\n" "with_gnu_ld\n" "with_ld\n" "with_demangler_in_ld\n" "with_gnu_as\n" "with_as\n" "enable_largefile\n" "enable_werror_always\n" "enable_checking\n" "enable_coverage\n" "enable_gather_detailed_mem_stats\n" "enable_build_with_cxx\n" "with_stabs\n" "enable_multilib\n" "enable___cxa_atexit\n" "enable_decimal_float\n" "enable_fixed_point\n" "enable_threads\n" "enable_tls\n" "enable_objc_gc\n" "with_dwarf2\n" "enable_shared\n" "with_build_sysroot\n" "with_sysroot\n" "with_specs\n" "with_pkgversion\n" "with_bugurl\n" "enable_languages\n" "with_multilib_list\n"; const char *needle = "\n" "with_gnu_ld\n"; const char* p = strstr (haystack, needle); ASSERT (p - haystack == 114); } { /* Same bug, shorter trigger. */ const char *haystack = "..wi.d."; const char *needle = ".d."; const char* p = strstr (haystack, needle); ASSERT (p - haystack == 4); } { /* Like the above, but trigger the flaw in two_way_long_needle by using a needle of length LONG_NEEDLE_THRESHOLD (32) or greater. Rather than trying to find the right alignment manually, I've arbitrarily chosen the following needle and template for the haystack, and ensure that for each placement of the needle in that haystack, strstr finds it. */ const char *needle = "\nwith_gnu_ld-extend-to-len-32-b\n"; const char *h = "\n" "with_build_libsubdir\n" "with_local_prefix\n" "with_gxx_include_dir\n" "with_cpp_install_dir\n" "with_e_\n" "..............................\n" "with_FGHIJKLMNOPQRSTUVWXYZ\n" "with_567890123456789\n" "with_multilib_list\n"; size_t h_len = strlen (h); char *haystack = malloc (h_len + 1); size_t i; ASSERT (haystack); for (i = 0; i < h_len - strlen (needle); i++) { const char *p; memcpy (haystack, h, h_len + 1); memcpy (haystack + i, needle, strlen (needle) + 1); p = strstr (haystack, needle); ASSERT (p); ASSERT (p - haystack == i); } free (haystack); } /* Test long needles. */ { size_t m = 1024; char *haystack = (char *) malloc (2 * m + 1); char *needle = (char *) malloc (m + 1); if (haystack != NULL && needle != NULL) { const char *p; haystack[0] = 'x'; memset (haystack + 1, ' ', m - 1); memset (haystack + m, 'x', m); haystack[2 * m] = '\0'; memset (needle, 'x', m); needle[m] = '\0'; p = strstr (haystack, needle); ASSERT (p); ASSERT (p - haystack == m); } free (needle); free (haystack); } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-c-strncasecmp.c����������������������������������������������0000664�0001750�0001750�00000006011�14670377431�022747� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of case-insensitive string comparison function. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include "c-strcase.h" #include "c-ctype.h" #include <locale.h> #include <string.h> #include "macros.h" int main (int argc, char *argv[]) { if (argc > 1) { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; } ASSERT (c_strncasecmp ("paragraph", "Paragraph", 1000000) == 0); ASSERT (c_strncasecmp ("paragraph", "Paragraph", 9) == 0); ASSERT (c_strncasecmp ("paragrapH", "parAgRaph", 1000000) == 0); ASSERT (c_strncasecmp ("paragrapH", "parAgRaph", 9) == 0); ASSERT (c_strncasecmp ("paragraph", "paraLyzed", 10) < 0); ASSERT (c_strncasecmp ("paragraph", "paraLyzed", 9) < 0); ASSERT (c_strncasecmp ("paragraph", "paraLyzed", 5) < 0); ASSERT (c_strncasecmp ("paragraph", "paraLyzed", 4) == 0); ASSERT (c_strncasecmp ("paraLyzed", "paragraph", 10) > 0); ASSERT (c_strncasecmp ("paraLyzed", "paragraph", 9) > 0); ASSERT (c_strncasecmp ("paraLyzed", "paragraph", 5) > 0); ASSERT (c_strncasecmp ("paraLyzed", "paragraph", 4) == 0); ASSERT (c_strncasecmp ("para", "paragraph", 10) < 0); ASSERT (c_strncasecmp ("para", "paragraph", 9) < 0); ASSERT (c_strncasecmp ("para", "paragraph", 5) < 0); ASSERT (c_strncasecmp ("para", "paragraph", 4) == 0); ASSERT (c_strncasecmp ("paragraph", "para", 10) > 0); ASSERT (c_strncasecmp ("paragraph", "para", 9) > 0); ASSERT (c_strncasecmp ("paragraph", "para", 5) > 0); ASSERT (c_strncasecmp ("paragraph", "para", 4) == 0); /* The following tests shows how c_strncasecmp() is different from strncasecmp(). */ ASSERT (c_strncasecmp ("\311mily", "\351mile", 4) < 0); ASSERT (c_strncasecmp ("\351mile", "\311mily", 4) > 0); /* The following tests shows how c_strncasecmp() is different from mbsncasecmp(). */ ASSERT (c_strncasecmp ("\303\266zg\303\274r", "\303\226ZG\303\234R", 99) > 0); /* özgür */ ASSERT (c_strncasecmp ("\303\226ZG\303\234R", "\303\266zg\303\274r", 99) < 0); /* özgür */ #if C_CTYPE_ASCII /* This test shows how strings of different size cannot compare equal. */ ASSERT (c_strncasecmp ("turkish", "TURK\304\260SH", 7) < 0); ASSERT (c_strncasecmp ("TURK\304\260SH", "turkish", 7) > 0); #endif return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/w32sock.h���������������������������������������������������������0000664�0001750�0001750�00000006452�14670377437�020547� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* w32sock.h --- internal auxiliary functions for Windows socket functions Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paolo Bonzini */ #include <errno.h> /* Get O_RDWR and O_BINARY. */ #include <fcntl.h> /* Get _open_osfhandle(). */ #include <io.h> /* Get _get_osfhandle(). */ #if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" #else # include <io.h> #endif #define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd))) #define SOCKET_TO_FD(fh) (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY)) static inline void set_winsock_errno (void) { int err = WSAGetLastError (); /* Map some WSAE* errors to the runtime library's error codes. */ switch (err) { case WSA_INVALID_HANDLE: errno = EBADF; break; case WSA_NOT_ENOUGH_MEMORY: errno = ENOMEM; break; case WSA_INVALID_PARAMETER: errno = EINVAL; break; case WSAENAMETOOLONG: errno = ENAMETOOLONG; break; case WSAENOTEMPTY: errno = ENOTEMPTY; break; case WSAEWOULDBLOCK: errno = EWOULDBLOCK; break; case WSAEINPROGRESS: errno = EINPROGRESS; break; case WSAEALREADY: errno = EALREADY; break; case WSAENOTSOCK: errno = ENOTSOCK; break; case WSAEDESTADDRREQ: errno = EDESTADDRREQ; break; case WSAEMSGSIZE: errno = EMSGSIZE; break; case WSAEPROTOTYPE: errno = EPROTOTYPE; break; case WSAENOPROTOOPT: errno = ENOPROTOOPT; break; case WSAEPROTONOSUPPORT: errno = EPROTONOSUPPORT; break; case WSAEOPNOTSUPP: errno = EOPNOTSUPP; break; case WSAEAFNOSUPPORT: errno = EAFNOSUPPORT; break; case WSAEADDRINUSE: errno = EADDRINUSE; break; case WSAEADDRNOTAVAIL: errno = EADDRNOTAVAIL; break; case WSAENETDOWN: errno = ENETDOWN; break; case WSAENETUNREACH: errno = ENETUNREACH; break; case WSAENETRESET: errno = ENETRESET; break; case WSAECONNABORTED: errno = ECONNABORTED; break; case WSAECONNRESET: errno = ECONNRESET; break; case WSAENOBUFS: errno = ENOBUFS; break; case WSAEISCONN: errno = EISCONN; break; case WSAENOTCONN: errno = ENOTCONN; break; case WSAETIMEDOUT: errno = ETIMEDOUT; break; case WSAECONNREFUSED: errno = ECONNREFUSED; break; case WSAELOOP: errno = ELOOP; break; case WSAEHOSTUNREACH: errno = EHOSTUNREACH; break; default: errno = (err > 10000 && err < 10025) ? err - 10000 : err; break; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/float.in.h��������������������������������������������������������0000664�0001750�0001750�00000017310�14670377430�020752� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* A correct <float.h>. Copyright (C) 2007-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _@GUARD_PREFIX@_FLOAT_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_FLOAT_H@ #ifndef _@GUARD_PREFIX@_FLOAT_H #define _@GUARD_PREFIX@_FLOAT_H /* 'long double' properties. */ #if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) /* Number of mantissa units, in base FLT_RADIX. */ # undef LDBL_MANT_DIG # define LDBL_MANT_DIG 64 /* Number of decimal digits that is sufficient for representing a number. */ # undef LDBL_DIG # define LDBL_DIG 18 /* x-1 where x is the smallest representable number > 1. */ # undef LDBL_EPSILON # define LDBL_EPSILON 1.0842021724855044340E-19L /* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */ # undef LDBL_MIN_EXP # define LDBL_MIN_EXP (-16381) /* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */ # undef LDBL_MAX_EXP # define LDBL_MAX_EXP 16384 /* Minimum positive normalized number. */ # undef LDBL_MIN # define LDBL_MIN 3.3621031431120935063E-4932L /* Maximum representable finite number. */ # undef LDBL_MAX # define LDBL_MAX 1.1897314953572317650E+4932L /* Minimum e such that 10^e is in the range of normalized numbers. */ # undef LDBL_MIN_10_EXP # define LDBL_MIN_10_EXP (-4931) /* Maximum e such that 10^e is in the range of representable finite numbers. */ # undef LDBL_MAX_10_EXP # define LDBL_MAX_10_EXP 4932 #endif /* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of precision in the compiler but 64 bits of precision at runtime. See <https://lists.gnu.org/r/bug-gnulib/2008-07/msg00063.html>. */ #if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) /* Number of mantissa units, in base FLT_RADIX. */ # undef LDBL_MANT_DIG # define LDBL_MANT_DIG 64 /* Number of decimal digits that is sufficient for representing a number. */ # undef LDBL_DIG # define LDBL_DIG 18 /* x-1 where x is the smallest representable number > 1. */ # undef LDBL_EPSILON # define LDBL_EPSILON 1.084202172485504434007452800869941711426e-19L /* 2^-63 */ /* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */ # undef LDBL_MIN_EXP # define LDBL_MIN_EXP (-16381) /* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */ # undef LDBL_MAX_EXP # define LDBL_MAX_EXP 16384 /* Minimum positive normalized number. */ # undef LDBL_MIN # define LDBL_MIN 3.362103143112093506262677817321752E-4932L /* = 0x1p-16382L */ /* Maximum representable finite number. */ # undef LDBL_MAX /* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }. But the largest literal that GCC allows us to write is 0x0.fffffffffffff8p16384L = { 0xFFFFF800, 0xFFFFFFFF, 32766 }. So, define it like this through a reference to an external variable const unsigned int LDBL_MAX[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }; extern const long double LDBL_MAX; Unfortunately, this is not a constant expression. */ # if !GNULIB_defined_long_double_union union gl_long_double_union { struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd; long double ld; }; # define GNULIB_defined_long_double_union 1 # endif extern const union gl_long_double_union gl_LDBL_MAX; # define LDBL_MAX (gl_LDBL_MAX.ld) /* Minimum e such that 10^e is in the range of normalized numbers. */ # undef LDBL_MIN_10_EXP # define LDBL_MIN_10_EXP (-4931) /* Maximum e such that 10^e is in the range of representable finite numbers. */ # undef LDBL_MAX_10_EXP # define LDBL_MAX_10_EXP 4932 #endif /* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are wrong. On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong. */ #if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ # undef LDBL_MIN_EXP # define LDBL_MIN_EXP DBL_MIN_EXP # undef LDBL_MIN_10_EXP # define LDBL_MIN_10_EXP DBL_MIN_10_EXP # undef LDBL_MIN # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ #endif #if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ # undef LDBL_MAX /* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }. It is not easy to define: #define LDBL_MAX 1.79769313486231580793728971405302307166e308L is too small, whereas #define LDBL_MAX 1.79769313486231580793728971405302307167e308L is too large. Apparently a bug in GCC decimal-to-binary conversion. Also, I can't get values larger than #define LDBL63 ((long double) (1ULL << 63)) #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL) which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }. So, define it like this through a reference to an external variable const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }; extern const long double LDBL_MAX; or through a pointer cast #define LDBL_MAX \ (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }) Unfortunately, this is not a constant expression, and the latter expression does not work well when GCC is optimizing.. */ # if !GNULIB_defined_long_double_union union gl_long_double_union { struct { double hi; double lo; } dd; long double ld; }; # define GNULIB_defined_long_double_union 1 # endif extern const union gl_long_double_union gl_LDBL_MAX; # define LDBL_MAX (gl_LDBL_MAX.ld) #endif /* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong. On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON are wrong. */ #if defined __sgi && (LDBL_MANT_DIG >= 106) # undef LDBL_MANT_DIG # define LDBL_MANT_DIG 106 # if defined __GNUC__ # undef LDBL_MIN_EXP # define LDBL_MIN_EXP DBL_MIN_EXP # undef LDBL_MIN_10_EXP # define LDBL_MIN_10_EXP DBL_MIN_10_EXP # undef LDBL_MIN # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ # undef LDBL_EPSILON # define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */ # endif #endif #if @REPLACE_ITOLD@ /* Pull in a function that fixes the 'int' to 'long double' conversion of glibc 2.7. */ extern # ifdef __cplusplus "C" # endif void _Qp_itoq (long double *, int); static void (*_gl_float_fix_itold) (long double *, int) = _Qp_itoq; #endif #endif /* _@GUARD_PREFIX@_FLOAT_H */ #endif /* _@GUARD_PREFIX@_FLOAT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sigaction.c�������������������������������������������������������0000664�0001750�0001750�00000016136�14670377431�021221� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* POSIX compatible signal blocking. Copyright (C) 2008-2021 Free Software Foundation, Inc. Written by Eric Blake <ebb9@byu.net>, 2008. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <signal.h> #include <errno.h> #include <stdint.h> #include <stdlib.h> /* This implementation of sigaction is tailored to native Windows behavior: signal() has SysV semantics (ie. the handler is uninstalled before it is invoked). This is an inherent data race if an asynchronous signal is sent twice in a row before we can reinstall our handler, but there's nothing we can do about it. Meanwhile, sigprocmask() is not present, and while we can use the gnulib replacement to provide critical sections, it too suffers from potential data races in the face of an ill-timed asynchronous signal. And we compound the situation by reading static storage in a signal handler, which POSIX warns is not generically async-signal-safe. Oh well. Additionally: - We don't implement SA_NOCLDSTOP or SA_NOCLDWAIT, because SIGCHLD is not defined. - We don't implement SA_ONSTACK, because sigaltstack() is not present. - We ignore SA_RESTART, because blocking native Windows API calls are not interrupted anyway when an asynchronous signal occurs, and the MSVCRT runtime never sets errno to EINTR. - We don't implement SA_SIGINFO because it is impossible to do so portably. POSIX states that an application should not mix signal() and sigaction(). We support the use of signal() within the gnulib sigprocmask() substitute, but all other application code linked with this module should stick with only sigaction(). */ /* Check some of our assumptions. */ #if defined SIGCHLD || defined HAVE_SIGALTSTACK || defined HAVE_SIGINTERRUPT # error "Revisit the assumptions made in the sigaction module" #endif /* Out-of-range substitutes make a good fallback for uncatchable signals. */ #ifndef SIGKILL # define SIGKILL (-1) #endif #ifndef SIGSTOP # define SIGSTOP (-1) #endif /* On native Windows, as of 2008, the signal SIGABRT_COMPAT is an alias for the signal SIGABRT. Only one signal handler is stored for both SIGABRT and SIGABRT_COMPAT. SIGABRT_COMPAT is not a signal of its own. */ #if defined _WIN32 && ! defined __CYGWIN__ # undef SIGABRT_COMPAT # define SIGABRT_COMPAT 6 #endif /* A signal handler. */ typedef void (*handler_t) (int signal); /* Set of current actions. If sa_handler for an entry is NULL, then that signal is not currently handled by the sigaction handler. */ static struct sigaction volatile action_array[NSIG] /* = 0 */; /* Signal handler that is installed for signals. */ static void sigaction_handler (int sig) { handler_t handler; sigset_t mask; sigset_t oldmask; int saved_errno = errno; if (sig < 0 || NSIG <= sig || !action_array[sig].sa_handler) { /* Unexpected situation; be careful to avoid recursive abort. */ if (sig == SIGABRT) signal (SIGABRT, SIG_DFL); abort (); } /* Reinstall the signal handler when required; otherwise update the bookkeeping so that the user's handler may call sigaction and get accurate results. We know the signal isn't currently blocked, or we wouldn't be in its handler, therefore we know that we are not interrupting a sigaction() call. There is a race where any asynchronous instance of the same signal occurring before we reinstall the handler will trigger the default handler; oh well. */ handler = action_array[sig].sa_handler; if ((action_array[sig].sa_flags & SA_RESETHAND) == 0) signal (sig, sigaction_handler); else action_array[sig].sa_handler = NULL; /* Block appropriate signals. */ mask = action_array[sig].sa_mask; if ((action_array[sig].sa_flags & SA_NODEFER) == 0) sigaddset (&mask, sig); sigprocmask (SIG_BLOCK, &mask, &oldmask); /* Invoke the user's handler, then restore prior mask. */ errno = saved_errno; handler (sig); saved_errno = errno; sigprocmask (SIG_SETMASK, &oldmask, NULL); errno = saved_errno; } /* Change and/or query the action that will be taken on delivery of signal SIG. If not NULL, ACT describes the new behavior. If not NULL, OACT is set to the prior behavior. Return 0 on success, or set errno and return -1 on failure. */ int sigaction (int sig, const struct sigaction *restrict act, struct sigaction *restrict oact) { sigset_t mask; sigset_t oldmask; int saved_errno; if (sig < 0 || NSIG <= sig || sig == SIGKILL || sig == SIGSTOP || (act && act->sa_handler == SIG_ERR)) { errno = EINVAL; return -1; } #ifdef SIGABRT_COMPAT if (sig == SIGABRT_COMPAT) sig = SIGABRT; #endif /* POSIX requires sigaction() to be async-signal-safe. In other words, if an asynchronous signal can occur while we are anywhere inside this function, the user's handler could then call sigaction() recursively and expect consistent results. We meet this rule by using sigprocmask to block all signals before modifying any data structure that could be read from a signal handler; this works since we know that the gnulib sigprocmask replacement does not try to use sigaction() from its handler. */ if (!act && !oact) return 0; sigfillset (&mask); sigprocmask (SIG_BLOCK, &mask, &oldmask); if (oact) { if (action_array[sig].sa_handler) *oact = action_array[sig]; else { /* Safe to change the handler at will here, since all signals are currently blocked. */ oact->sa_handler = signal (sig, SIG_DFL); if (oact->sa_handler == SIG_ERR) goto failure; signal (sig, oact->sa_handler); oact->sa_flags = SA_RESETHAND | SA_NODEFER; sigemptyset (&oact->sa_mask); } } if (act) { /* Safe to install the handler before updating action_array, since all signals are currently blocked. */ if (act->sa_handler == SIG_DFL || act->sa_handler == SIG_IGN) { if (signal (sig, act->sa_handler) == SIG_ERR) goto failure; action_array[sig].sa_handler = NULL; } else { if (signal (sig, sigaction_handler) == SIG_ERR) goto failure; action_array[sig] = *act; } } sigprocmask (SIG_SETMASK, &oldmask, NULL); return 0; failure: saved_errno = errno; sigprocmask (SIG_SETMASK, &oldmask, NULL); errno = saved_errno; return -1; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-getdtablesize.c����������������������������������������������0000664�0001750�0001750�00000002151�14670377436�023041� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of getdtablesize() function. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (getdtablesize, int, (void)); #include "macros.h" int main (int argc, char *argv[]) { ASSERT (getdtablesize () >= 3); ASSERT (dup2 (0, getdtablesize() - 1) == getdtablesize () - 1); ASSERT (dup2 (0, getdtablesize()) == -1); return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/localename.c������������������������������������������������������0000664�0001750�0001750�00000304760�14670377431�021344� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Determine name of the currently selected locale. Copyright (C) 1995-2021 Free Software Foundation, Inc. This program 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Ulrich Drepper <drepper@gnu.org>, 1995. */ /* Native Windows code written by Tor Lillqvist <tml@iki.fi>. */ /* Mac OS X code written by Bruno Haible <bruno@clisp.org>. */ #include <config.h> /* Specification. */ #include "localename.h" #include <limits.h> #include <stdbool.h> #include <stddef.h> #include <stdlib.h> #include <locale.h> #include <string.h> #include "flexmember.h" #include "setlocale_null.h" #include "thread-optim.h" #if HAVE_GOOD_USELOCALE /* Mac OS X 10.5 defines the locale_t type in <xlocale.h>. */ # if defined __APPLE__ && defined __MACH__ # include <xlocale.h> # endif # if (__GLIBC__ >= 2 && !defined __UCLIBC__) || (defined __linux__ && HAVE_LANGINFO_H) || defined __CYGWIN__ # include <langinfo.h> # endif # include "glthread/lock.h" # if defined __sun # if HAVE_GETLOCALENAME_L /* Solaris >= 12. */ extern char * getlocalename_l(int, locale_t); # elif HAVE_SOLARIS114_LOCALES # include <sys/localedef.h> # endif # endif # if HAVE_NAMELESS_LOCALES # include "localename-table.h" # endif #endif #if HAVE_CFPREFERENCESCOPYAPPVALUE # include <CoreFoundation/CFString.h> # include <CoreFoundation/CFPreferences.h> #endif #if defined _WIN32 && !defined __CYGWIN__ # define WINDOWS_NATIVE # include "glthread/lock.h" #endif #if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Native Windows or Cygwin */ # define WIN32_LEAN_AND_MEAN # include <windows.h> # include <winnls.h> /* List of language codes, sorted by value: 0x01 LANG_ARABIC 0x02 LANG_BULGARIAN 0x03 LANG_CATALAN 0x04 LANG_CHINESE 0x05 LANG_CZECH 0x06 LANG_DANISH 0x07 LANG_GERMAN 0x08 LANG_GREEK 0x09 LANG_ENGLISH 0x0a LANG_SPANISH 0x0b LANG_FINNISH 0x0c LANG_FRENCH 0x0d LANG_HEBREW 0x0e LANG_HUNGARIAN 0x0f LANG_ICELANDIC 0x10 LANG_ITALIAN 0x11 LANG_JAPANESE 0x12 LANG_KOREAN 0x13 LANG_DUTCH 0x14 LANG_NORWEGIAN 0x15 LANG_POLISH 0x16 LANG_PORTUGUESE 0x17 LANG_ROMANSH 0x18 LANG_ROMANIAN 0x19 LANG_RUSSIAN 0x1a LANG_CROATIAN == LANG_SERBIAN 0x1b LANG_SLOVAK 0x1c LANG_ALBANIAN 0x1d LANG_SWEDISH 0x1e LANG_THAI 0x1f LANG_TURKISH 0x20 LANG_URDU 0x21 LANG_INDONESIAN 0x22 LANG_UKRAINIAN 0x23 LANG_BELARUSIAN 0x24 LANG_SLOVENIAN 0x25 LANG_ESTONIAN 0x26 LANG_LATVIAN 0x27 LANG_LITHUANIAN 0x28 LANG_TAJIK 0x29 LANG_FARSI 0x2a LANG_VIETNAMESE 0x2b LANG_ARMENIAN 0x2c LANG_AZERI 0x2d LANG_BASQUE 0x2e LANG_SORBIAN 0x2f LANG_MACEDONIAN 0x30 LANG_SUTU 0x31 LANG_TSONGA 0x32 LANG_TSWANA 0x33 LANG_VENDA 0x34 LANG_XHOSA 0x35 LANG_ZULU 0x36 LANG_AFRIKAANS 0x37 LANG_GEORGIAN 0x38 LANG_FAEROESE 0x39 LANG_HINDI 0x3a LANG_MALTESE 0x3b LANG_SAMI 0x3c LANG_GAELIC 0x3d LANG_YIDDISH 0x3e LANG_MALAY 0x3f LANG_KAZAK 0x40 LANG_KYRGYZ 0x41 LANG_SWAHILI 0x42 LANG_TURKMEN 0x43 LANG_UZBEK 0x44 LANG_TATAR 0x45 LANG_BENGALI 0x46 LANG_PUNJABI 0x47 LANG_GUJARATI 0x48 LANG_ORIYA 0x49 LANG_TAMIL 0x4a LANG_TELUGU 0x4b LANG_KANNADA 0x4c LANG_MALAYALAM 0x4d LANG_ASSAMESE 0x4e LANG_MARATHI 0x4f LANG_SANSKRIT 0x50 LANG_MONGOLIAN 0x51 LANG_TIBETAN 0x52 LANG_WELSH 0x53 LANG_CAMBODIAN 0x54 LANG_LAO 0x55 LANG_BURMESE 0x56 LANG_GALICIAN 0x57 LANG_KONKANI 0x58 LANG_MANIPURI 0x59 LANG_SINDHI 0x5a LANG_SYRIAC 0x5b LANG_SINHALESE 0x5c LANG_CHEROKEE 0x5d LANG_INUKTITUT 0x5e LANG_AMHARIC 0x5f LANG_TAMAZIGHT 0x60 LANG_KASHMIRI 0x61 LANG_NEPALI 0x62 LANG_FRISIAN 0x63 LANG_PASHTO 0x64 LANG_TAGALOG 0x65 LANG_DIVEHI 0x66 LANG_EDO 0x67 LANG_FULFULDE 0x68 LANG_HAUSA 0x69 LANG_IBIBIO 0x6a LANG_YORUBA 0x6d LANG_BASHKIR 0x6e LANG_LUXEMBOURGISH 0x6f LANG_GREENLANDIC 0x70 LANG_IGBO 0x71 LANG_KANURI 0x72 LANG_OROMO 0x73 LANG_TIGRINYA 0x74 LANG_GUARANI 0x75 LANG_HAWAIIAN 0x76 LANG_LATIN 0x77 LANG_SOMALI 0x78 LANG_YI 0x79 LANG_PAPIAMENTU 0x7a LANG_MAPUDUNGUN 0x7c LANG_MOHAWK 0x7e LANG_BRETON 0x82 LANG_OCCITAN 0x83 LANG_CORSICAN 0x84 LANG_ALSATIAN 0x85 LANG_YAKUT 0x86 LANG_KICHE 0x87 LANG_KINYARWANDA 0x88 LANG_WOLOF 0x8c LANG_DARI 0x91 LANG_SCOTTISH_GAELIC */ /* Mingw headers don't have latest language and sublanguage codes. */ # ifndef LANG_AFRIKAANS # define LANG_AFRIKAANS 0x36 # endif # ifndef LANG_ALBANIAN # define LANG_ALBANIAN 0x1c # endif # ifndef LANG_ALSATIAN # define LANG_ALSATIAN 0x84 # endif # ifndef LANG_AMHARIC # define LANG_AMHARIC 0x5e # endif # ifndef LANG_ARABIC # define LANG_ARABIC 0x01 # endif # ifndef LANG_ARMENIAN # define LANG_ARMENIAN 0x2b # endif # ifndef LANG_ASSAMESE # define LANG_ASSAMESE 0x4d # endif # ifndef LANG_AZERI # define LANG_AZERI 0x2c # endif # ifndef LANG_BASHKIR # define LANG_BASHKIR 0x6d # endif # ifndef LANG_BASQUE # define LANG_BASQUE 0x2d # endif # ifndef LANG_BELARUSIAN # define LANG_BELARUSIAN 0x23 # endif # ifndef LANG_BENGALI # define LANG_BENGALI 0x45 # endif # ifndef LANG_BRETON # define LANG_BRETON 0x7e # endif # ifndef LANG_BURMESE # define LANG_BURMESE 0x55 # endif # ifndef LANG_CAMBODIAN # define LANG_CAMBODIAN 0x53 # endif # ifndef LANG_CATALAN # define LANG_CATALAN 0x03 # endif # ifndef LANG_CHEROKEE # define LANG_CHEROKEE 0x5c # endif # ifndef LANG_CORSICAN # define LANG_CORSICAN 0x83 # endif # ifndef LANG_DARI # define LANG_DARI 0x8c # endif # ifndef LANG_DIVEHI # define LANG_DIVEHI 0x65 # endif # ifndef LANG_EDO # define LANG_EDO 0x66 # endif # ifndef LANG_ESTONIAN # define LANG_ESTONIAN 0x25 # endif # ifndef LANG_FAEROESE # define LANG_FAEROESE 0x38 # endif # ifndef LANG_FARSI # define LANG_FARSI 0x29 # endif # ifndef LANG_FRISIAN # define LANG_FRISIAN 0x62 # endif # ifndef LANG_FULFULDE # define LANG_FULFULDE 0x67 # endif # ifndef LANG_GAELIC # define LANG_GAELIC 0x3c # endif # ifndef LANG_GALICIAN # define LANG_GALICIAN 0x56 # endif # ifndef LANG_GEORGIAN # define LANG_GEORGIAN 0x37 # endif # ifndef LANG_GREENLANDIC # define LANG_GREENLANDIC 0x6f # endif # ifndef LANG_GUARANI # define LANG_GUARANI 0x74 # endif # ifndef LANG_GUJARATI # define LANG_GUJARATI 0x47 # endif # ifndef LANG_HAUSA # define LANG_HAUSA 0x68 # endif # ifndef LANG_HAWAIIAN # define LANG_HAWAIIAN 0x75 # endif # ifndef LANG_HEBREW # define LANG_HEBREW 0x0d # endif # ifndef LANG_HINDI # define LANG_HINDI 0x39 # endif # ifndef LANG_IBIBIO # define LANG_IBIBIO 0x69 # endif # ifndef LANG_IGBO # define LANG_IGBO 0x70 # endif # ifndef LANG_INDONESIAN # define LANG_INDONESIAN 0x21 # endif # ifndef LANG_INUKTITUT # define LANG_INUKTITUT 0x5d # endif # ifndef LANG_KANNADA # define LANG_KANNADA 0x4b # endif # ifndef LANG_KANURI # define LANG_KANURI 0x71 # endif # ifndef LANG_KASHMIRI # define LANG_KASHMIRI 0x60 # endif # ifndef LANG_KAZAK # define LANG_KAZAK 0x3f # endif # ifndef LANG_KICHE # define LANG_KICHE 0x86 # endif # ifndef LANG_KINYARWANDA # define LANG_KINYARWANDA 0x87 # endif # ifndef LANG_KONKANI # define LANG_KONKANI 0x57 # endif # ifndef LANG_KYRGYZ # define LANG_KYRGYZ 0x40 # endif # ifndef LANG_LAO # define LANG_LAO 0x54 # endif # ifndef LANG_LATIN # define LANG_LATIN 0x76 # endif # ifndef LANG_LATVIAN # define LANG_LATVIAN 0x26 # endif # ifndef LANG_LITHUANIAN # define LANG_LITHUANIAN 0x27 # endif # ifndef LANG_LUXEMBOURGISH # define LANG_LUXEMBOURGISH 0x6e # endif # ifndef LANG_MACEDONIAN # define LANG_MACEDONIAN 0x2f # endif # ifndef LANG_MALAY # define LANG_MALAY 0x3e # endif # ifndef LANG_MALAYALAM # define LANG_MALAYALAM 0x4c # endif # ifndef LANG_MALTESE # define LANG_MALTESE 0x3a # endif # ifndef LANG_MANIPURI # define LANG_MANIPURI 0x58 # endif # ifndef LANG_MAORI # define LANG_MAORI 0x81 # endif # ifndef LANG_MAPUDUNGUN # define LANG_MAPUDUNGUN 0x7a # endif # ifndef LANG_MARATHI # define LANG_MARATHI 0x4e # endif # ifndef LANG_MOHAWK # define LANG_MOHAWK 0x7c # endif # ifndef LANG_MONGOLIAN # define LANG_MONGOLIAN 0x50 # endif # ifndef LANG_NEPALI # define LANG_NEPALI 0x61 # endif # ifndef LANG_OCCITAN # define LANG_OCCITAN 0x82 # endif # ifndef LANG_ORIYA # define LANG_ORIYA 0x48 # endif # ifndef LANG_OROMO # define LANG_OROMO 0x72 # endif # ifndef LANG_PAPIAMENTU # define LANG_PAPIAMENTU 0x79 # endif # ifndef LANG_PASHTO # define LANG_PASHTO 0x63 # endif # ifndef LANG_PUNJABI # define LANG_PUNJABI 0x46 # endif # ifndef LANG_QUECHUA # define LANG_QUECHUA 0x6b # endif # ifndef LANG_ROMANSH # define LANG_ROMANSH 0x17 # endif # ifndef LANG_SAMI # define LANG_SAMI 0x3b # endif # ifndef LANG_SANSKRIT # define LANG_SANSKRIT 0x4f # endif # ifndef LANG_SCOTTISH_GAELIC # define LANG_SCOTTISH_GAELIC 0x91 # endif # ifndef LANG_SERBIAN # define LANG_SERBIAN 0x1a # endif # ifndef LANG_SINDHI # define LANG_SINDHI 0x59 # endif # ifndef LANG_SINHALESE # define LANG_SINHALESE 0x5b # endif # ifndef LANG_SLOVAK # define LANG_SLOVAK 0x1b # endif # ifndef LANG_SOMALI # define LANG_SOMALI 0x77 # endif # ifndef LANG_SORBIAN # define LANG_SORBIAN 0x2e # endif # ifndef LANG_SOTHO # define LANG_SOTHO 0x6c # endif # ifndef LANG_SUTU # define LANG_SUTU 0x30 # endif # ifndef LANG_SWAHILI # define LANG_SWAHILI 0x41 # endif # ifndef LANG_SYRIAC # define LANG_SYRIAC 0x5a # endif # ifndef LANG_TAGALOG # define LANG_TAGALOG 0x64 # endif # ifndef LANG_TAJIK # define LANG_TAJIK 0x28 # endif # ifndef LANG_TAMAZIGHT # define LANG_TAMAZIGHT 0x5f # endif # ifndef LANG_TAMIL # define LANG_TAMIL 0x49 # endif # ifndef LANG_TATAR # define LANG_TATAR 0x44 # endif # ifndef LANG_TELUGU # define LANG_TELUGU 0x4a # endif # ifndef LANG_THAI # define LANG_THAI 0x1e # endif # ifndef LANG_TIBETAN # define LANG_TIBETAN 0x51 # endif # ifndef LANG_TIGRINYA # define LANG_TIGRINYA 0x73 # endif # ifndef LANG_TSONGA # define LANG_TSONGA 0x31 # endif # ifndef LANG_TSWANA # define LANG_TSWANA 0x32 # endif # ifndef LANG_TURKMEN # define LANG_TURKMEN 0x42 # endif # ifndef LANG_UIGHUR # define LANG_UIGHUR 0x80 # endif # ifndef LANG_UKRAINIAN # define LANG_UKRAINIAN 0x22 # endif # ifndef LANG_URDU # define LANG_URDU 0x20 # endif # ifndef LANG_UZBEK # define LANG_UZBEK 0x43 # endif # ifndef LANG_VENDA # define LANG_VENDA 0x33 # endif # ifndef LANG_VIETNAMESE # define LANG_VIETNAMESE 0x2a # endif # ifndef LANG_WELSH # define LANG_WELSH 0x52 # endif # ifndef LANG_WOLOF # define LANG_WOLOF 0x88 # endif # ifndef LANG_XHOSA # define LANG_XHOSA 0x34 # endif # ifndef LANG_YAKUT # define LANG_YAKUT 0x85 # endif # ifndef LANG_YI # define LANG_YI 0x78 # endif # ifndef LANG_YIDDISH # define LANG_YIDDISH 0x3d # endif # ifndef LANG_YORUBA # define LANG_YORUBA 0x6a # endif # ifndef LANG_ZULU # define LANG_ZULU 0x35 # endif # ifndef SUBLANG_AFRIKAANS_SOUTH_AFRICA # define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01 # endif # ifndef SUBLANG_ALBANIAN_ALBANIA # define SUBLANG_ALBANIAN_ALBANIA 0x01 # endif # ifndef SUBLANG_ALSATIAN_FRANCE # define SUBLANG_ALSATIAN_FRANCE 0x01 # endif # ifndef SUBLANG_AMHARIC_ETHIOPIA # define SUBLANG_AMHARIC_ETHIOPIA 0x01 # endif # ifndef SUBLANG_ARABIC_SAUDI_ARABIA # define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 # endif # ifndef SUBLANG_ARABIC_IRAQ # define SUBLANG_ARABIC_IRAQ 0x02 # endif # ifndef SUBLANG_ARABIC_EGYPT # define SUBLANG_ARABIC_EGYPT 0x03 # endif # ifndef SUBLANG_ARABIC_LIBYA # define SUBLANG_ARABIC_LIBYA 0x04 # endif # ifndef SUBLANG_ARABIC_ALGERIA # define SUBLANG_ARABIC_ALGERIA 0x05 # endif # ifndef SUBLANG_ARABIC_MOROCCO # define SUBLANG_ARABIC_MOROCCO 0x06 # endif # ifndef SUBLANG_ARABIC_TUNISIA # define SUBLANG_ARABIC_TUNISIA 0x07 # endif # ifndef SUBLANG_ARABIC_OMAN # define SUBLANG_ARABIC_OMAN 0x08 # endif # ifndef SUBLANG_ARABIC_YEMEN # define SUBLANG_ARABIC_YEMEN 0x09 # endif # ifndef SUBLANG_ARABIC_SYRIA # define SUBLANG_ARABIC_SYRIA 0x0a # endif # ifndef SUBLANG_ARABIC_JORDAN # define SUBLANG_ARABIC_JORDAN 0x0b # endif # ifndef SUBLANG_ARABIC_LEBANON # define SUBLANG_ARABIC_LEBANON 0x0c # endif # ifndef SUBLANG_ARABIC_KUWAIT # define SUBLANG_ARABIC_KUWAIT 0x0d # endif # ifndef SUBLANG_ARABIC_UAE # define SUBLANG_ARABIC_UAE 0x0e # endif # ifndef SUBLANG_ARABIC_BAHRAIN # define SUBLANG_ARABIC_BAHRAIN 0x0f # endif # ifndef SUBLANG_ARABIC_QATAR # define SUBLANG_ARABIC_QATAR 0x10 # endif # ifndef SUBLANG_ARMENIAN_ARMENIA # define SUBLANG_ARMENIAN_ARMENIA 0x01 # endif # ifndef SUBLANG_ASSAMESE_INDIA # define SUBLANG_ASSAMESE_INDIA 0x01 # endif # ifndef SUBLANG_AZERI_LATIN # define SUBLANG_AZERI_LATIN 0x01 # endif # ifndef SUBLANG_AZERI_CYRILLIC # define SUBLANG_AZERI_CYRILLIC 0x02 # endif # ifndef SUBLANG_BASHKIR_RUSSIA # define SUBLANG_BASHKIR_RUSSIA 0x01 # endif # ifndef SUBLANG_BASQUE_BASQUE # define SUBLANG_BASQUE_BASQUE 0x01 # endif # ifndef SUBLANG_BELARUSIAN_BELARUS # define SUBLANG_BELARUSIAN_BELARUS 0x01 # endif # ifndef SUBLANG_BENGALI_INDIA # define SUBLANG_BENGALI_INDIA 0x01 # endif # ifndef SUBLANG_BENGALI_BANGLADESH # define SUBLANG_BENGALI_BANGLADESH 0x02 # endif # ifndef SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN # define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05 # endif # ifndef SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC # define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08 # endif # ifndef SUBLANG_BRETON_FRANCE # define SUBLANG_BRETON_FRANCE 0x01 # endif # ifndef SUBLANG_BULGARIAN_BULGARIA # define SUBLANG_BULGARIAN_BULGARIA 0x01 # endif # ifndef SUBLANG_CAMBODIAN_CAMBODIA # define SUBLANG_CAMBODIAN_CAMBODIA 0x01 # endif # ifndef SUBLANG_CATALAN_SPAIN # define SUBLANG_CATALAN_SPAIN 0x01 # endif # ifndef SUBLANG_CORSICAN_FRANCE # define SUBLANG_CORSICAN_FRANCE 0x01 # endif # ifndef SUBLANG_CROATIAN_CROATIA # define SUBLANG_CROATIAN_CROATIA 0x01 # endif # ifndef SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN # define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04 # endif # ifndef SUBLANG_CHINESE_MACAU # define SUBLANG_CHINESE_MACAU 0x05 # endif # ifndef SUBLANG_CZECH_CZECH_REPUBLIC # define SUBLANG_CZECH_CZECH_REPUBLIC 0x01 # endif # ifndef SUBLANG_DANISH_DENMARK # define SUBLANG_DANISH_DENMARK 0x01 # endif # ifndef SUBLANG_DARI_AFGHANISTAN # define SUBLANG_DARI_AFGHANISTAN 0x01 # endif # ifndef SUBLANG_DIVEHI_MALDIVES # define SUBLANG_DIVEHI_MALDIVES 0x01 # endif # ifndef SUBLANG_DUTCH_SURINAM # define SUBLANG_DUTCH_SURINAM 0x03 # endif # ifndef SUBLANG_ENGLISH_SOUTH_AFRICA # define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 # endif # ifndef SUBLANG_ENGLISH_JAMAICA # define SUBLANG_ENGLISH_JAMAICA 0x08 # endif # ifndef SUBLANG_ENGLISH_CARIBBEAN # define SUBLANG_ENGLISH_CARIBBEAN 0x09 # endif # ifndef SUBLANG_ENGLISH_BELIZE # define SUBLANG_ENGLISH_BELIZE 0x0a # endif # ifndef SUBLANG_ENGLISH_TRINIDAD # define SUBLANG_ENGLISH_TRINIDAD 0x0b # endif # ifndef SUBLANG_ENGLISH_ZIMBABWE # define SUBLANG_ENGLISH_ZIMBABWE 0x0c # endif # ifndef SUBLANG_ENGLISH_PHILIPPINES # define SUBLANG_ENGLISH_PHILIPPINES 0x0d # endif # ifndef SUBLANG_ENGLISH_INDONESIA # define SUBLANG_ENGLISH_INDONESIA 0x0e # endif # ifndef SUBLANG_ENGLISH_HONGKONG # define SUBLANG_ENGLISH_HONGKONG 0x0f # endif # ifndef SUBLANG_ENGLISH_INDIA # define SUBLANG_ENGLISH_INDIA 0x10 # endif # ifndef SUBLANG_ENGLISH_MALAYSIA # define SUBLANG_ENGLISH_MALAYSIA 0x11 # endif # ifndef SUBLANG_ENGLISH_SINGAPORE # define SUBLANG_ENGLISH_SINGAPORE 0x12 # endif # ifndef SUBLANG_ESTONIAN_ESTONIA # define SUBLANG_ESTONIAN_ESTONIA 0x01 # endif # ifndef SUBLANG_FAEROESE_FAROE_ISLANDS # define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01 # endif # ifndef SUBLANG_FARSI_IRAN # define SUBLANG_FARSI_IRAN 0x01 # endif # ifndef SUBLANG_FINNISH_FINLAND # define SUBLANG_FINNISH_FINLAND 0x01 # endif # ifndef SUBLANG_FRENCH_LUXEMBOURG # define SUBLANG_FRENCH_LUXEMBOURG 0x05 # endif # ifndef SUBLANG_FRENCH_MONACO # define SUBLANG_FRENCH_MONACO 0x06 # endif # ifndef SUBLANG_FRENCH_WESTINDIES # define SUBLANG_FRENCH_WESTINDIES 0x07 # endif # ifndef SUBLANG_FRENCH_REUNION # define SUBLANG_FRENCH_REUNION 0x08 # endif # ifndef SUBLANG_FRENCH_CONGO # define SUBLANG_FRENCH_CONGO 0x09 # endif # ifndef SUBLANG_FRENCH_SENEGAL # define SUBLANG_FRENCH_SENEGAL 0x0a # endif # ifndef SUBLANG_FRENCH_CAMEROON # define SUBLANG_FRENCH_CAMEROON 0x0b # endif # ifndef SUBLANG_FRENCH_COTEDIVOIRE # define SUBLANG_FRENCH_COTEDIVOIRE 0x0c # endif # ifndef SUBLANG_FRENCH_MALI # define SUBLANG_FRENCH_MALI 0x0d # endif # ifndef SUBLANG_FRENCH_MOROCCO # define SUBLANG_FRENCH_MOROCCO 0x0e # endif # ifndef SUBLANG_FRENCH_HAITI # define SUBLANG_FRENCH_HAITI 0x0f # endif # ifndef SUBLANG_FRISIAN_NETHERLANDS # define SUBLANG_FRISIAN_NETHERLANDS 0x01 # endif # ifndef SUBLANG_GALICIAN_SPAIN # define SUBLANG_GALICIAN_SPAIN 0x01 # endif # ifndef SUBLANG_GEORGIAN_GEORGIA # define SUBLANG_GEORGIAN_GEORGIA 0x01 # endif # ifndef SUBLANG_GERMAN_LUXEMBOURG # define SUBLANG_GERMAN_LUXEMBOURG 0x04 # endif # ifndef SUBLANG_GERMAN_LIECHTENSTEIN # define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 # endif # ifndef SUBLANG_GREEK_GREECE # define SUBLANG_GREEK_GREECE 0x01 # endif # ifndef SUBLANG_GREENLANDIC_GREENLAND # define SUBLANG_GREENLANDIC_GREENLAND 0x01 # endif # ifndef SUBLANG_GUJARATI_INDIA # define SUBLANG_GUJARATI_INDIA 0x01 # endif # ifndef SUBLANG_HAUSA_NIGERIA_LATIN # define SUBLANG_HAUSA_NIGERIA_LATIN 0x01 # endif # ifndef SUBLANG_HEBREW_ISRAEL # define SUBLANG_HEBREW_ISRAEL 0x01 # endif # ifndef SUBLANG_HINDI_INDIA # define SUBLANG_HINDI_INDIA 0x01 # endif # ifndef SUBLANG_HUNGARIAN_HUNGARY # define SUBLANG_HUNGARIAN_HUNGARY 0x01 # endif # ifndef SUBLANG_ICELANDIC_ICELAND # define SUBLANG_ICELANDIC_ICELAND 0x01 # endif # ifndef SUBLANG_IGBO_NIGERIA # define SUBLANG_IGBO_NIGERIA 0x01 # endif # ifndef SUBLANG_INDONESIAN_INDONESIA # define SUBLANG_INDONESIAN_INDONESIA 0x01 # endif # ifndef SUBLANG_INUKTITUT_CANADA # define SUBLANG_INUKTITUT_CANADA 0x01 # endif # undef SUBLANG_INUKTITUT_CANADA_LATIN # define SUBLANG_INUKTITUT_CANADA_LATIN 0x02 # undef SUBLANG_IRISH_IRELAND # define SUBLANG_IRISH_IRELAND 0x02 # ifndef SUBLANG_JAPANESE_JAPAN # define SUBLANG_JAPANESE_JAPAN 0x01 # endif # ifndef SUBLANG_KANNADA_INDIA # define SUBLANG_KANNADA_INDIA 0x01 # endif # ifndef SUBLANG_KASHMIRI_INDIA # define SUBLANG_KASHMIRI_INDIA 0x02 # endif # ifndef SUBLANG_KAZAK_KAZAKHSTAN # define SUBLANG_KAZAK_KAZAKHSTAN 0x01 # endif # ifndef SUBLANG_KICHE_GUATEMALA # define SUBLANG_KICHE_GUATEMALA 0x01 # endif # ifndef SUBLANG_KINYARWANDA_RWANDA # define SUBLANG_KINYARWANDA_RWANDA 0x01 # endif # ifndef SUBLANG_KONKANI_INDIA # define SUBLANG_KONKANI_INDIA 0x01 # endif # ifndef SUBLANG_KYRGYZ_KYRGYZSTAN # define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01 # endif # ifndef SUBLANG_LAO_LAOS # define SUBLANG_LAO_LAOS 0x01 # endif # ifndef SUBLANG_LATVIAN_LATVIA # define SUBLANG_LATVIAN_LATVIA 0x01 # endif # ifndef SUBLANG_LITHUANIAN_LITHUANIA # define SUBLANG_LITHUANIAN_LITHUANIA 0x01 # endif # undef SUBLANG_LOWER_SORBIAN_GERMANY # define SUBLANG_LOWER_SORBIAN_GERMANY 0x02 # ifndef SUBLANG_LUXEMBOURGISH_LUXEMBOURG # define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01 # endif # ifndef SUBLANG_MACEDONIAN_MACEDONIA # define SUBLANG_MACEDONIAN_MACEDONIA 0x01 # endif # ifndef SUBLANG_MALAY_MALAYSIA # define SUBLANG_MALAY_MALAYSIA 0x01 # endif # ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM # define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 # endif # ifndef SUBLANG_MALAYALAM_INDIA # define SUBLANG_MALAYALAM_INDIA 0x01 # endif # ifndef SUBLANG_MALTESE_MALTA # define SUBLANG_MALTESE_MALTA 0x01 # endif # ifndef SUBLANG_MAORI_NEW_ZEALAND # define SUBLANG_MAORI_NEW_ZEALAND 0x01 # endif # ifndef SUBLANG_MAPUDUNGUN_CHILE # define SUBLANG_MAPUDUNGUN_CHILE 0x01 # endif # ifndef SUBLANG_MARATHI_INDIA # define SUBLANG_MARATHI_INDIA 0x01 # endif # ifndef SUBLANG_MOHAWK_CANADA # define SUBLANG_MOHAWK_CANADA 0x01 # endif # ifndef SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA # define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01 # endif # ifndef SUBLANG_MONGOLIAN_PRC # define SUBLANG_MONGOLIAN_PRC 0x02 # endif # ifndef SUBLANG_NEPALI_NEPAL # define SUBLANG_NEPALI_NEPAL 0x01 # endif # ifndef SUBLANG_NEPALI_INDIA # define SUBLANG_NEPALI_INDIA 0x02 # endif # ifndef SUBLANG_OCCITAN_FRANCE # define SUBLANG_OCCITAN_FRANCE 0x01 # endif # ifndef SUBLANG_ORIYA_INDIA # define SUBLANG_ORIYA_INDIA 0x01 # endif # ifndef SUBLANG_PASHTO_AFGHANISTAN # define SUBLANG_PASHTO_AFGHANISTAN 0x01 # endif # ifndef SUBLANG_POLISH_POLAND # define SUBLANG_POLISH_POLAND 0x01 # endif # ifndef SUBLANG_PUNJABI_INDIA # define SUBLANG_PUNJABI_INDIA 0x01 # endif # ifndef SUBLANG_PUNJABI_PAKISTAN # define SUBLANG_PUNJABI_PAKISTAN 0x02 # endif # ifndef SUBLANG_QUECHUA_BOLIVIA # define SUBLANG_QUECHUA_BOLIVIA 0x01 # endif # ifndef SUBLANG_QUECHUA_ECUADOR # define SUBLANG_QUECHUA_ECUADOR 0x02 # endif # ifndef SUBLANG_QUECHUA_PERU # define SUBLANG_QUECHUA_PERU 0x03 # endif # ifndef SUBLANG_ROMANIAN_ROMANIA # define SUBLANG_ROMANIAN_ROMANIA 0x01 # endif # ifndef SUBLANG_ROMANIAN_MOLDOVA # define SUBLANG_ROMANIAN_MOLDOVA 0x02 # endif # ifndef SUBLANG_ROMANSH_SWITZERLAND # define SUBLANG_ROMANSH_SWITZERLAND 0x01 # endif # ifndef SUBLANG_RUSSIAN_RUSSIA # define SUBLANG_RUSSIAN_RUSSIA 0x01 # endif # ifndef SUBLANG_RUSSIAN_MOLDAVIA # define SUBLANG_RUSSIAN_MOLDAVIA 0x02 # endif # ifndef SUBLANG_SAMI_NORTHERN_NORWAY # define SUBLANG_SAMI_NORTHERN_NORWAY 0x01 # endif # ifndef SUBLANG_SAMI_NORTHERN_SWEDEN # define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02 # endif # ifndef SUBLANG_SAMI_NORTHERN_FINLAND # define SUBLANG_SAMI_NORTHERN_FINLAND 0x03 # endif # ifndef SUBLANG_SAMI_LULE_NORWAY # define SUBLANG_SAMI_LULE_NORWAY 0x04 # endif # ifndef SUBLANG_SAMI_LULE_SWEDEN # define SUBLANG_SAMI_LULE_SWEDEN 0x05 # endif # ifndef SUBLANG_SAMI_SOUTHERN_NORWAY # define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06 # endif # ifndef SUBLANG_SAMI_SOUTHERN_SWEDEN # define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07 # endif # undef SUBLANG_SAMI_SKOLT_FINLAND # define SUBLANG_SAMI_SKOLT_FINLAND 0x08 # undef SUBLANG_SAMI_INARI_FINLAND # define SUBLANG_SAMI_INARI_FINLAND 0x09 # ifndef SUBLANG_SANSKRIT_INDIA # define SUBLANG_SANSKRIT_INDIA 0x01 # endif # ifndef SUBLANG_SERBIAN_LATIN # define SUBLANG_SERBIAN_LATIN 0x02 # endif # ifndef SUBLANG_SERBIAN_CYRILLIC # define SUBLANG_SERBIAN_CYRILLIC 0x03 # endif # ifndef SUBLANG_SINDHI_INDIA # define SUBLANG_SINDHI_INDIA 0x01 # endif # undef SUBLANG_SINDHI_PAKISTAN # define SUBLANG_SINDHI_PAKISTAN 0x02 # ifndef SUBLANG_SINDHI_AFGHANISTAN # define SUBLANG_SINDHI_AFGHANISTAN 0x02 # endif # ifndef SUBLANG_SINHALESE_SRI_LANKA # define SUBLANG_SINHALESE_SRI_LANKA 0x01 # endif # ifndef SUBLANG_SLOVAK_SLOVAKIA # define SUBLANG_SLOVAK_SLOVAKIA 0x01 # endif # ifndef SUBLANG_SLOVENIAN_SLOVENIA # define SUBLANG_SLOVENIAN_SLOVENIA 0x01 # endif # ifndef SUBLANG_SOTHO_SOUTH_AFRICA # define SUBLANG_SOTHO_SOUTH_AFRICA 0x01 # endif # ifndef SUBLANG_SPANISH_GUATEMALA # define SUBLANG_SPANISH_GUATEMALA 0x04 # endif # ifndef SUBLANG_SPANISH_COSTA_RICA # define SUBLANG_SPANISH_COSTA_RICA 0x05 # endif # ifndef SUBLANG_SPANISH_PANAMA # define SUBLANG_SPANISH_PANAMA 0x06 # endif # ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC # define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 # endif # ifndef SUBLANG_SPANISH_VENEZUELA # define SUBLANG_SPANISH_VENEZUELA 0x08 # endif # ifndef SUBLANG_SPANISH_COLOMBIA # define SUBLANG_SPANISH_COLOMBIA 0x09 # endif # ifndef SUBLANG_SPANISH_PERU # define SUBLANG_SPANISH_PERU 0x0a # endif # ifndef SUBLANG_SPANISH_ARGENTINA # define SUBLANG_SPANISH_ARGENTINA 0x0b # endif # ifndef SUBLANG_SPANISH_ECUADOR # define SUBLANG_SPANISH_ECUADOR 0x0c # endif # ifndef SUBLANG_SPANISH_CHILE # define SUBLANG_SPANISH_CHILE 0x0d # endif # ifndef SUBLANG_SPANISH_URUGUAY # define SUBLANG_SPANISH_URUGUAY 0x0e # endif # ifndef SUBLANG_SPANISH_PARAGUAY # define SUBLANG_SPANISH_PARAGUAY 0x0f # endif # ifndef SUBLANG_SPANISH_BOLIVIA # define SUBLANG_SPANISH_BOLIVIA 0x10 # endif # ifndef SUBLANG_SPANISH_EL_SALVADOR # define SUBLANG_SPANISH_EL_SALVADOR 0x11 # endif # ifndef SUBLANG_SPANISH_HONDURAS # define SUBLANG_SPANISH_HONDURAS 0x12 # endif # ifndef SUBLANG_SPANISH_NICARAGUA # define SUBLANG_SPANISH_NICARAGUA 0x13 # endif # ifndef SUBLANG_SPANISH_PUERTO_RICO # define SUBLANG_SPANISH_PUERTO_RICO 0x14 # endif # ifndef SUBLANG_SPANISH_US # define SUBLANG_SPANISH_US 0x15 # endif # ifndef SUBLANG_SWAHILI_KENYA # define SUBLANG_SWAHILI_KENYA 0x01 # endif # ifndef SUBLANG_SWEDISH_SWEDEN # define SUBLANG_SWEDISH_SWEDEN 0x01 # endif # ifndef SUBLANG_SWEDISH_FINLAND # define SUBLANG_SWEDISH_FINLAND 0x02 # endif # ifndef SUBLANG_SYRIAC_SYRIA # define SUBLANG_SYRIAC_SYRIA 0x01 # endif # ifndef SUBLANG_TAGALOG_PHILIPPINES # define SUBLANG_TAGALOG_PHILIPPINES 0x01 # endif # ifndef SUBLANG_TAJIK_TAJIKISTAN # define SUBLANG_TAJIK_TAJIKISTAN 0x01 # endif # ifndef SUBLANG_TAMAZIGHT_ARABIC # define SUBLANG_TAMAZIGHT_ARABIC 0x01 # endif # ifndef SUBLANG_TAMAZIGHT_ALGERIA_LATIN # define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02 # endif # ifndef SUBLANG_TAMIL_INDIA # define SUBLANG_TAMIL_INDIA 0x01 # endif # ifndef SUBLANG_TATAR_RUSSIA # define SUBLANG_TATAR_RUSSIA 0x01 # endif # ifndef SUBLANG_TELUGU_INDIA # define SUBLANG_TELUGU_INDIA 0x01 # endif # ifndef SUBLANG_THAI_THAILAND # define SUBLANG_THAI_THAILAND 0x01 # endif # ifndef SUBLANG_TIBETAN_PRC # define SUBLANG_TIBETAN_PRC 0x01 # endif # undef SUBLANG_TIBETAN_BHUTAN # define SUBLANG_TIBETAN_BHUTAN 0x02 # ifndef SUBLANG_TIGRINYA_ETHIOPIA # define SUBLANG_TIGRINYA_ETHIOPIA 0x01 # endif # ifndef SUBLANG_TIGRINYA_ERITREA # define SUBLANG_TIGRINYA_ERITREA 0x02 # endif # ifndef SUBLANG_TSWANA_SOUTH_AFRICA # define SUBLANG_TSWANA_SOUTH_AFRICA 0x01 # endif # ifndef SUBLANG_TURKISH_TURKEY # define SUBLANG_TURKISH_TURKEY 0x01 # endif # ifndef SUBLANG_TURKMEN_TURKMENISTAN # define SUBLANG_TURKMEN_TURKMENISTAN 0x01 # endif # ifndef SUBLANG_UIGHUR_PRC # define SUBLANG_UIGHUR_PRC 0x01 # endif # ifndef SUBLANG_UKRAINIAN_UKRAINE # define SUBLANG_UKRAINIAN_UKRAINE 0x01 # endif # ifndef SUBLANG_UPPER_SORBIAN_GERMANY # define SUBLANG_UPPER_SORBIAN_GERMANY 0x01 # endif # ifndef SUBLANG_URDU_PAKISTAN # define SUBLANG_URDU_PAKISTAN 0x01 # endif # ifndef SUBLANG_URDU_INDIA # define SUBLANG_URDU_INDIA 0x02 # endif # ifndef SUBLANG_UZBEK_LATIN # define SUBLANG_UZBEK_LATIN 0x01 # endif # ifndef SUBLANG_UZBEK_CYRILLIC # define SUBLANG_UZBEK_CYRILLIC 0x02 # endif # ifndef SUBLANG_VIETNAMESE_VIETNAM # define SUBLANG_VIETNAMESE_VIETNAM 0x01 # endif # ifndef SUBLANG_WELSH_UNITED_KINGDOM # define SUBLANG_WELSH_UNITED_KINGDOM 0x01 # endif # ifndef SUBLANG_WOLOF_SENEGAL # define SUBLANG_WOLOF_SENEGAL 0x01 # endif # ifndef SUBLANG_XHOSA_SOUTH_AFRICA # define SUBLANG_XHOSA_SOUTH_AFRICA 0x01 # endif # ifndef SUBLANG_YAKUT_RUSSIA # define SUBLANG_YAKUT_RUSSIA 0x01 # endif # ifndef SUBLANG_YI_PRC # define SUBLANG_YI_PRC 0x01 # endif # ifndef SUBLANG_YORUBA_NIGERIA # define SUBLANG_YORUBA_NIGERIA 0x01 # endif # ifndef SUBLANG_ZULU_SOUTH_AFRICA # define SUBLANG_ZULU_SOUTH_AFRICA 0x01 # endif /* GetLocaleInfoA operations. */ # ifndef LOCALE_SNAME # define LOCALE_SNAME 0x5c # endif # ifndef LOCALE_NAME_MAX_LENGTH # define LOCALE_NAME_MAX_LENGTH 85 # endif /* Don't assume that UNICODE is not defined. */ # undef GetLocaleInfo # define GetLocaleInfo GetLocaleInfoA # undef EnumSystemLocales # define EnumSystemLocales EnumSystemLocalesA #endif /* We want to use the system's setlocale() function here, not the gnulib override. */ #undef setlocale #if HAVE_CFPREFERENCESCOPYAPPVALUE /* Mac OS X 10.4 or newer */ /* Canonicalize a Mac OS X locale name to a Unix locale name. NAME is a sufficiently large buffer. On input, it contains the Mac OS X locale name. On output, it contains the Unix locale name. */ # if !defined IN_LIBINTL static # endif void gl_locale_name_canonicalize (char *name) { /* This conversion is based on a posting by Deborah GoldSmith <goldsmit@apple.com> on 2005-03-08, https://lists.apple.com/archives/carbon-dev/2005/Mar/msg00293.html */ /* Convert legacy (NeXTstep inherited) English names to Unix (ISO 639 and ISO 3166) names. Prior to Mac OS X 10.3, there is no API for doing this. Therefore we do it ourselves, using a table based on the results of the Mac OS X 10.3.8 function CFLocaleCreateCanonicalLocaleIdentifierFromString(). */ typedef struct { const char legacy[21+1]; const char unixy[5+1]; } legacy_entry; static const legacy_entry legacy_table[] = { { "Afrikaans", "af" }, { "Albanian", "sq" }, { "Amharic", "am" }, { "Arabic", "ar" }, { "Armenian", "hy" }, { "Assamese", "as" }, { "Aymara", "ay" }, { "Azerbaijani", "az" }, { "Basque", "eu" }, { "Belarusian", "be" }, { "Belorussian", "be" }, { "Bengali", "bn" }, { "Brazilian Portugese", "pt_BR" }, { "Brazilian Portuguese", "pt_BR" }, { "Breton", "br" }, { "Bulgarian", "bg" }, { "Burmese", "my" }, { "Byelorussian", "be" }, { "Catalan", "ca" }, { "Chewa", "ny" }, { "Chichewa", "ny" }, { "Chinese", "zh" }, { "Chinese, Simplified", "zh_CN" }, { "Chinese, Traditional", "zh_TW" }, { "Chinese, Tradtional", "zh_TW" }, { "Croatian", "hr" }, { "Czech", "cs" }, { "Danish", "da" }, { "Dutch", "nl" }, { "Dzongkha", "dz" }, { "English", "en" }, { "Esperanto", "eo" }, { "Estonian", "et" }, { "Faroese", "fo" }, { "Farsi", "fa" }, { "Finnish", "fi" }, { "Flemish", "nl_BE" }, { "French", "fr" }, { "Galician", "gl" }, { "Gallegan", "gl" }, { "Georgian", "ka" }, { "German", "de" }, { "Greek", "el" }, { "Greenlandic", "kl" }, { "Guarani", "gn" }, { "Gujarati", "gu" }, { "Hawaiian", "haw" }, /* Yes, "haw", not "cpe". */ { "Hebrew", "he" }, { "Hindi", "hi" }, { "Hungarian", "hu" }, { "Icelandic", "is" }, { "Indonesian", "id" }, { "Inuktitut", "iu" }, { "Irish", "ga" }, { "Italian", "it" }, { "Japanese", "ja" }, { "Javanese", "jv" }, { "Kalaallisut", "kl" }, { "Kannada", "kn" }, { "Kashmiri", "ks" }, { "Kazakh", "kk" }, { "Khmer", "km" }, { "Kinyarwanda", "rw" }, { "Kirghiz", "ky" }, { "Korean", "ko" }, { "Kurdish", "ku" }, { "Latin", "la" }, { "Latvian", "lv" }, { "Lithuanian", "lt" }, { "Macedonian", "mk" }, { "Malagasy", "mg" }, { "Malay", "ms" }, { "Malayalam", "ml" }, { "Maltese", "mt" }, { "Manx", "gv" }, { "Marathi", "mr" }, { "Moldavian", "mo" }, { "Mongolian", "mn" }, { "Nepali", "ne" }, { "Norwegian", "nb" }, /* Yes, "nb", not the obsolete "no". */ { "Nyanja", "ny" }, { "Nynorsk", "nn" }, { "Oriya", "or" }, { "Oromo", "om" }, { "Panjabi", "pa" }, { "Pashto", "ps" }, { "Persian", "fa" }, { "Polish", "pl" }, { "Portuguese", "pt" }, { "Portuguese, Brazilian", "pt_BR" }, { "Punjabi", "pa" }, { "Pushto", "ps" }, { "Quechua", "qu" }, { "Romanian", "ro" }, { "Ruanda", "rw" }, { "Rundi", "rn" }, { "Russian", "ru" }, { "Sami", "se_NO" }, /* Not just "se". */ { "Sanskrit", "sa" }, { "Scottish", "gd" }, { "Serbian", "sr" }, { "Simplified Chinese", "zh_CN" }, { "Sindhi", "sd" }, { "Sinhalese", "si" }, { "Slovak", "sk" }, { "Slovenian", "sl" }, { "Somali", "so" }, { "Spanish", "es" }, { "Sundanese", "su" }, { "Swahili", "sw" }, { "Swedish", "sv" }, { "Tagalog", "tl" }, { "Tajik", "tg" }, { "Tajiki", "tg" }, { "Tamil", "ta" }, { "Tatar", "tt" }, { "Telugu", "te" }, { "Thai", "th" }, { "Tibetan", "bo" }, { "Tigrinya", "ti" }, { "Tongan", "to" }, { "Traditional Chinese", "zh_TW" }, { "Turkish", "tr" }, { "Turkmen", "tk" }, { "Uighur", "ug" }, { "Ukrainian", "uk" }, { "Urdu", "ur" }, { "Uzbek", "uz" }, { "Vietnamese", "vi" }, { "Welsh", "cy" }, { "Yiddish", "yi" } }; /* Convert new-style locale names with language tags (ISO 639 and ISO 15924) to Unix (ISO 639 and ISO 3166) names. */ typedef struct { const char langtag[7+1]; const char unixy[12+1]; } langtag_entry; static const langtag_entry langtag_table[] = { /* Mac OS X has "az-Arab", "az-Cyrl", "az-Latn". The default script for az on Unix is Latin. */ { "az-Latn", "az" }, /* Mac OS X has "bs-Cyrl", "bs-Latn". The default script for bs on Unix is Latin. */ { "bs-Latn", "bs" }, /* Mac OS X has "ga-dots". Does not yet exist on Unix. */ { "ga-dots", "ga" }, /* Mac OS X has "kk-Cyrl". The default script for kk on Unix is Cyrillic. */ { "kk-Cyrl", "kk" }, /* Mac OS X has "mn-Cyrl", "mn-Mong". The default script for mn on Unix is Cyrillic. */ { "mn-Cyrl", "mn" }, /* Mac OS X has "ms-Arab", "ms-Latn". The default script for ms on Unix is Latin. */ { "ms-Latn", "ms" }, /* Mac OS X has "pa-Arab", "pa-Guru". Country codes are used to distinguish these on Unix. */ { "pa-Arab", "pa_PK" }, { "pa-Guru", "pa_IN" }, /* Mac OS X has "shi-Latn", "shi-Tfng". Does not yet exist on Unix. */ /* Mac OS X has "sr-Cyrl", "sr-Latn". The default script for sr on Unix is Cyrillic. */ { "sr-Cyrl", "sr" }, /* Mac OS X has "tg-Cyrl". The default script for tg on Unix is Cyrillic. */ { "tg-Cyrl", "tg" }, /* Mac OS X has "tk-Cyrl". The default script for tk on Unix is Cyrillic. */ { "tk-Cyrl", "tk" }, /* Mac OS X has "tt-Cyrl". The default script for tt on Unix is Cyrillic. */ { "tt-Cyrl", "tt" }, /* Mac OS X has "uz-Arab", "uz-Cyrl", "uz-Latn". The default script for uz on Unix is Latin. */ { "uz-Latn", "uz" }, /* Mac OS X has "vai-Latn", "vai-Vaii". Does not yet exist on Unix. */ /* Mac OS X has "yue-Hans", "yue-Hant". The default script for yue on Unix is Simplified Han. */ { "yue-Hans", "yue" }, /* Mac OS X has "zh-Hans", "zh-Hant". Country codes are used to distinguish these on Unix. */ { "zh-Hans", "zh_CN" }, { "zh-Hant", "zh_TW" } }; /* Convert script names (ISO 15924) to Unix conventions. See https://www.unicode.org/iso15924/iso15924-codes.html */ typedef struct { const char script[4+1]; const char unixy[9+1]; } script_entry; static const script_entry script_table[] = { { "Arab", "arabic" }, { "Cyrl", "cyrillic" }, { "Latn", "latin" }, { "Mong", "mongolian" } }; /* Step 1: Convert using legacy_table. */ if (name[0] >= 'A' && name[0] <= 'Z') { unsigned int i1, i2; i1 = 0; i2 = sizeof (legacy_table) / sizeof (legacy_entry); while (i2 - i1 > 1) { /* At this point we know that if name occurs in legacy_table, its index must be >= i1 and < i2. */ unsigned int i = (i1 + i2) >> 1; const legacy_entry *p = &legacy_table[i]; if (strcmp (name, p->legacy) < 0) i2 = i; else i1 = i; } if (strcmp (name, legacy_table[i1].legacy) == 0) { strcpy (name, legacy_table[i1].unixy); return; } } /* Step 2: Convert using langtag_table and script_table. */ if (strlen (name) == 7 && name[2] == '-') { unsigned int i1, i2; i1 = 0; i2 = sizeof (langtag_table) / sizeof (langtag_entry); while (i2 - i1 > 1) { /* At this point we know that if name occurs in langtag_table, its index must be >= i1 and < i2. */ unsigned int i = (i1 + i2) >> 1; const langtag_entry *p = &langtag_table[i]; if (strcmp (name, p->langtag) < 0) i2 = i; else i1 = i; } if (strcmp (name, langtag_table[i1].langtag) == 0) { strcpy (name, langtag_table[i1].unixy); return; } i1 = 0; i2 = sizeof (script_table) / sizeof (script_entry); while (i2 - i1 > 1) { /* At this point we know that if (name + 3) occurs in script_table, its index must be >= i1 and < i2. */ unsigned int i = (i1 + i2) >> 1; const script_entry *p = &script_table[i]; if (strcmp (name + 3, p->script) < 0) i2 = i; else i1 = i; } if (strcmp (name + 3, script_table[i1].script) == 0) { name[2] = '@'; strcpy (name + 3, script_table[i1].unixy); return; } } /* Step 3: Convert new-style dash to Unix underscore. */ { char *p; for (p = name; *p != '\0'; p++) if (*p == '-') *p = '_'; } } #endif #if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Native Windows or Cygwin */ /* Canonicalize a Windows native locale name to a Unix locale name. NAME is a sufficiently large buffer. On input, it contains the Windows locale name. On output, it contains the Unix locale name. */ # if !defined IN_LIBINTL static # endif void gl_locale_name_canonicalize (char *name) { /* FIXME: This is probably incomplete: it does not handle "zh-Hans" and "zh-Hant". */ char *p; for (p = name; *p != '\0'; p++) if (*p == '-') { *p = '_'; p++; for (; *p != '\0'; p++) { if (*p >= 'a' && *p <= 'z') *p += 'A' - 'a'; if (*p == '-') { *p = '\0'; return; } } return; } } # if !defined IN_LIBINTL static # endif const char * gl_locale_name_from_win32_LANGID (LANGID langid) { /* Activate the new code only when the GETTEXT_MUI environment variable is set, for the time being, since the new code is not well tested. */ if (getenv ("GETTEXT_MUI") != NULL) { static char namebuf[256]; /* Query the system's notion of locale name. On Windows95/98/ME, GetLocaleInfoA returns some incorrect results. But we don't need to support systems that are so old. */ if (GetLocaleInfoA (MAKELCID (langid, SORT_DEFAULT), LOCALE_SNAME, namebuf, sizeof (namebuf) - 1)) { /* Convert it to a Unix locale name. */ gl_locale_name_canonicalize (namebuf); return namebuf; } } /* Internet Explorer has an LCID to RFC3066 name mapping stored in HKEY_CLASSES_ROOT\Mime\Database\Rfc1766. But we better don't use that since IE's i18n subsystem is known to be inconsistent with the native Windows base (e.g. they have different character conversion facilities that produce different results). */ /* Use our own table. */ { int primary, sub; /* Split into language and territory part. */ primary = PRIMARYLANGID (langid); sub = SUBLANGID (langid); /* Dispatch on language. See also https://www.unicode.org/unicode/onlinedat/languages.html . For details about languages, see https://www.ethnologue.com/ . */ switch (primary) { case LANG_AFRIKAANS: switch (sub) { case SUBLANG_AFRIKAANS_SOUTH_AFRICA: return "af_ZA"; } return "af"; case LANG_ALBANIAN: switch (sub) { case SUBLANG_ALBANIAN_ALBANIA: return "sq_AL"; } return "sq"; case LANG_ALSATIAN: switch (sub) { case SUBLANG_ALSATIAN_FRANCE: return "gsw_FR"; } return "gsw"; case LANG_AMHARIC: switch (sub) { case SUBLANG_AMHARIC_ETHIOPIA: return "am_ET"; } return "am"; case LANG_ARABIC: switch (sub) { case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA"; case SUBLANG_ARABIC_IRAQ: return "ar_IQ"; case SUBLANG_ARABIC_EGYPT: return "ar_EG"; case SUBLANG_ARABIC_LIBYA: return "ar_LY"; case SUBLANG_ARABIC_ALGERIA: return "ar_DZ"; case SUBLANG_ARABIC_MOROCCO: return "ar_MA"; case SUBLANG_ARABIC_TUNISIA: return "ar_TN"; case SUBLANG_ARABIC_OMAN: return "ar_OM"; case SUBLANG_ARABIC_YEMEN: return "ar_YE"; case SUBLANG_ARABIC_SYRIA: return "ar_SY"; case SUBLANG_ARABIC_JORDAN: return "ar_JO"; case SUBLANG_ARABIC_LEBANON: return "ar_LB"; case SUBLANG_ARABIC_KUWAIT: return "ar_KW"; case SUBLANG_ARABIC_UAE: return "ar_AE"; case SUBLANG_ARABIC_BAHRAIN: return "ar_BH"; case SUBLANG_ARABIC_QATAR: return "ar_QA"; } return "ar"; case LANG_ARMENIAN: switch (sub) { case SUBLANG_ARMENIAN_ARMENIA: return "hy_AM"; } return "hy"; case LANG_ASSAMESE: switch (sub) { case SUBLANG_ASSAMESE_INDIA: return "as_IN"; } return "as"; case LANG_AZERI: switch (sub) { /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */ case 0x1e: return "az@latin"; case SUBLANG_AZERI_LATIN: return "az_AZ@latin"; case 0x1d: return "az@cyrillic"; case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic"; } return "az"; case LANG_BASHKIR: switch (sub) { case SUBLANG_BASHKIR_RUSSIA: return "ba_RU"; } return "ba"; case LANG_BASQUE: switch (sub) { case SUBLANG_BASQUE_BASQUE: return "eu_ES"; } return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */ case LANG_BELARUSIAN: switch (sub) { case SUBLANG_BELARUSIAN_BELARUS: return "be_BY"; } return "be"; case LANG_BENGALI: switch (sub) { case SUBLANG_BENGALI_INDIA: return "bn_IN"; case SUBLANG_BENGALI_BANGLADESH: return "bn_BD"; } return "bn"; case LANG_BRETON: switch (sub) { case SUBLANG_BRETON_FRANCE: return "br_FR"; } return "br"; case LANG_BULGARIAN: switch (sub) { case SUBLANG_BULGARIAN_BULGARIA: return "bg_BG"; } return "bg"; case LANG_BURMESE: switch (sub) { case SUBLANG_DEFAULT: return "my_MM"; } return "my"; case LANG_CAMBODIAN: switch (sub) { case SUBLANG_CAMBODIAN_CAMBODIA: return "km_KH"; } return "km"; case LANG_CATALAN: switch (sub) { case SUBLANG_CATALAN_SPAIN: return "ca_ES"; } return "ca"; case LANG_CHEROKEE: switch (sub) { case SUBLANG_DEFAULT: return "chr_US"; } return "chr"; case LANG_CHINESE: switch (sub) { case SUBLANG_CHINESE_TRADITIONAL: case 0x1f: return "zh_TW"; case SUBLANG_CHINESE_SIMPLIFIED: case 0x00: return "zh_CN"; case SUBLANG_CHINESE_HONGKONG: return "zh_HK"; /* traditional */ case SUBLANG_CHINESE_SINGAPORE: return "zh_SG"; /* simplified */ case SUBLANG_CHINESE_MACAU: return "zh_MO"; /* traditional */ } return "zh"; case LANG_CORSICAN: switch (sub) { case SUBLANG_CORSICAN_FRANCE: return "co_FR"; } return "co"; case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN == LANG_BOSNIAN * What used to be called Serbo-Croatian * should really now be two separate * languages because of political reasons. * (Says tml, who knows nothing about Serbian * or Croatian.) * (I can feel those flames coming already.) */ switch (sub) { /* Croatian */ case 0x00: return "hr"; case SUBLANG_CROATIAN_CROATIA: return "hr_HR"; case SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN: return "hr_BA"; /* Serbian */ case 0x1f: return "sr"; case 0x1c: return "sr"; /* latin */ case SUBLANG_SERBIAN_LATIN: return "sr_CS"; /* latin */ case 0x09: return "sr_RS"; /* latin */ case 0x0b: return "sr_ME"; /* latin */ case 0x06: return "sr_BA"; /* latin */ case 0x1b: return "sr@cyrillic"; case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic"; case 0x0a: return "sr_RS@cyrillic"; case 0x0c: return "sr_ME@cyrillic"; case 0x07: return "sr_BA@cyrillic"; /* Bosnian */ case 0x1e: return "bs"; case 0x1a: return "bs"; /* latin */ case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN: return "bs_BA"; /* latin */ case 0x19: return "bs@cyrillic"; case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC: return "bs_BA@cyrillic"; } return "hr"; case LANG_CZECH: switch (sub) { case SUBLANG_CZECH_CZECH_REPUBLIC: return "cs_CZ"; } return "cs"; case LANG_DANISH: switch (sub) { case SUBLANG_DANISH_DENMARK: return "da_DK"; } return "da"; case LANG_DARI: /* FIXME: Adjust this when such locales appear on Unix. */ switch (sub) { case SUBLANG_DARI_AFGHANISTAN: return "prs_AF"; } return "prs"; case LANG_DIVEHI: switch (sub) { case SUBLANG_DIVEHI_MALDIVES: return "dv_MV"; } return "dv"; case LANG_DUTCH: switch (sub) { case SUBLANG_DUTCH: return "nl_NL"; case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE"; case SUBLANG_DUTCH_SURINAM: return "nl_SR"; } return "nl"; case LANG_EDO: switch (sub) { case SUBLANG_DEFAULT: return "bin_NG"; } return "bin"; case LANG_ENGLISH: switch (sub) { /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought * English was the language spoken in England. * Oh well. */ case SUBLANG_ENGLISH_US: return "en_US"; case SUBLANG_ENGLISH_UK: return "en_GB"; case SUBLANG_ENGLISH_AUS: return "en_AU"; case SUBLANG_ENGLISH_CAN: return "en_CA"; case SUBLANG_ENGLISH_NZ: return "en_NZ"; case SUBLANG_ENGLISH_EIRE: return "en_IE"; case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA"; case SUBLANG_ENGLISH_JAMAICA: return "en_JM"; case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */ case SUBLANG_ENGLISH_BELIZE: return "en_BZ"; case SUBLANG_ENGLISH_TRINIDAD: return "en_TT"; case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW"; case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH"; case SUBLANG_ENGLISH_INDONESIA: return "en_ID"; case SUBLANG_ENGLISH_HONGKONG: return "en_HK"; case SUBLANG_ENGLISH_INDIA: return "en_IN"; case SUBLANG_ENGLISH_MALAYSIA: return "en_MY"; case SUBLANG_ENGLISH_SINGAPORE: return "en_SG"; } return "en"; case LANG_ESTONIAN: switch (sub) { case SUBLANG_ESTONIAN_ESTONIA: return "et_EE"; } return "et"; case LANG_FAEROESE: switch (sub) { case SUBLANG_FAEROESE_FAROE_ISLANDS: return "fo_FO"; } return "fo"; case LANG_FARSI: switch (sub) { case SUBLANG_FARSI_IRAN: return "fa_IR"; } return "fa"; case LANG_FINNISH: switch (sub) { case SUBLANG_FINNISH_FINLAND: return "fi_FI"; } return "fi"; case LANG_FRENCH: switch (sub) { case SUBLANG_FRENCH: return "fr_FR"; case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE"; case SUBLANG_FRENCH_CANADIAN: return "fr_CA"; case SUBLANG_FRENCH_SWISS: return "fr_CH"; case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU"; case SUBLANG_FRENCH_MONACO: return "fr_MC"; case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */ case SUBLANG_FRENCH_REUNION: return "fr_RE"; case SUBLANG_FRENCH_CONGO: return "fr_CG"; case SUBLANG_FRENCH_SENEGAL: return "fr_SN"; case SUBLANG_FRENCH_CAMEROON: return "fr_CM"; case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI"; case SUBLANG_FRENCH_MALI: return "fr_ML"; case SUBLANG_FRENCH_MOROCCO: return "fr_MA"; case SUBLANG_FRENCH_HAITI: return "fr_HT"; } return "fr"; case LANG_FRISIAN: switch (sub) { case SUBLANG_FRISIAN_NETHERLANDS: return "fy_NL"; } return "fy"; case LANG_FULFULDE: /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin. */ switch (sub) { case SUBLANG_DEFAULT: return "ff_NG"; } return "ff"; case LANG_GAELIC: switch (sub) { case 0x01: /* SCOTTISH */ /* old, superseded by LANG_SCOTTISH_GAELIC */ return "gd_GB"; case SUBLANG_IRISH_IRELAND: return "ga_IE"; } return "ga"; case LANG_GALICIAN: switch (sub) { case SUBLANG_GALICIAN_SPAIN: return "gl_ES"; } return "gl"; case LANG_GEORGIAN: switch (sub) { case SUBLANG_GEORGIAN_GEORGIA: return "ka_GE"; } return "ka"; case LANG_GERMAN: switch (sub) { case SUBLANG_GERMAN: return "de_DE"; case SUBLANG_GERMAN_SWISS: return "de_CH"; case SUBLANG_GERMAN_AUSTRIAN: return "de_AT"; case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU"; case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI"; } return "de"; case LANG_GREEK: switch (sub) { case SUBLANG_GREEK_GREECE: return "el_GR"; } return "el"; case LANG_GREENLANDIC: switch (sub) { case SUBLANG_GREENLANDIC_GREENLAND: return "kl_GL"; } return "kl"; case LANG_GUARANI: switch (sub) { case SUBLANG_DEFAULT: return "gn_PY"; } return "gn"; case LANG_GUJARATI: switch (sub) { case SUBLANG_GUJARATI_INDIA: return "gu_IN"; } return "gu"; case LANG_HAUSA: switch (sub) { case 0x1f: return "ha"; case SUBLANG_HAUSA_NIGERIA_LATIN: return "ha_NG"; } return "ha"; case LANG_HAWAIIAN: /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers) or Hawaii Creole English ("cpe_US", 600000 speakers)? */ switch (sub) { case SUBLANG_DEFAULT: return "cpe_US"; } return "cpe"; case LANG_HEBREW: switch (sub) { case SUBLANG_HEBREW_ISRAEL: return "he_IL"; } return "he"; case LANG_HINDI: switch (sub) { case SUBLANG_HINDI_INDIA: return "hi_IN"; } return "hi"; case LANG_HUNGARIAN: switch (sub) { case SUBLANG_HUNGARIAN_HUNGARY: return "hu_HU"; } return "hu"; case LANG_IBIBIO: switch (sub) { case SUBLANG_DEFAULT: return "nic_NG"; } return "nic"; case LANG_ICELANDIC: switch (sub) { case SUBLANG_ICELANDIC_ICELAND: return "is_IS"; } return "is"; case LANG_IGBO: switch (sub) { case SUBLANG_IGBO_NIGERIA: return "ig_NG"; } return "ig"; case LANG_INDONESIAN: switch (sub) { case SUBLANG_INDONESIAN_INDONESIA: return "id_ID"; } return "id"; case LANG_INUKTITUT: switch (sub) { case 0x1e: return "iu"; /* syllabic */ case SUBLANG_INUKTITUT_CANADA: return "iu_CA"; /* syllabic */ case 0x1f: return "iu@latin"; case SUBLANG_INUKTITUT_CANADA_LATIN: return "iu_CA@latin"; } return "iu"; case LANG_ITALIAN: switch (sub) { case SUBLANG_ITALIAN: return "it_IT"; case SUBLANG_ITALIAN_SWISS: return "it_CH"; } return "it"; case LANG_JAPANESE: switch (sub) { case SUBLANG_JAPANESE_JAPAN: return "ja_JP"; } return "ja"; case LANG_KANNADA: switch (sub) { case SUBLANG_KANNADA_INDIA: return "kn_IN"; } return "kn"; case LANG_KANURI: switch (sub) { case SUBLANG_DEFAULT: return "kr_NG"; } return "kr"; case LANG_KASHMIRI: switch (sub) { case SUBLANG_DEFAULT: return "ks_PK"; case SUBLANG_KASHMIRI_INDIA: return "ks_IN"; } return "ks"; case LANG_KAZAK: switch (sub) { case SUBLANG_KAZAK_KAZAKHSTAN: return "kk_KZ"; } return "kk"; case LANG_KICHE: /* FIXME: Adjust this when such locales appear on Unix. */ switch (sub) { case SUBLANG_KICHE_GUATEMALA: return "qut_GT"; } return "qut"; case LANG_KINYARWANDA: switch (sub) { case SUBLANG_KINYARWANDA_RWANDA: return "rw_RW"; } return "rw"; case LANG_KONKANI: /* FIXME: Adjust this when such locales appear on Unix. */ switch (sub) { case SUBLANG_KONKANI_INDIA: return "kok_IN"; } return "kok"; case LANG_KOREAN: switch (sub) { case SUBLANG_DEFAULT: return "ko_KR"; } return "ko"; case LANG_KYRGYZ: switch (sub) { case SUBLANG_KYRGYZ_KYRGYZSTAN: return "ky_KG"; } return "ky"; case LANG_LAO: switch (sub) { case SUBLANG_LAO_LAOS: return "lo_LA"; } return "lo"; case LANG_LATIN: switch (sub) { case SUBLANG_DEFAULT: return "la_VA"; } return "la"; case LANG_LATVIAN: switch (sub) { case SUBLANG_LATVIAN_LATVIA: return "lv_LV"; } return "lv"; case LANG_LITHUANIAN: switch (sub) { case SUBLANG_LITHUANIAN_LITHUANIA: return "lt_LT"; } return "lt"; case LANG_LUXEMBOURGISH: switch (sub) { case SUBLANG_LUXEMBOURGISH_LUXEMBOURG: return "lb_LU"; } return "lb"; case LANG_MACEDONIAN: switch (sub) { case SUBLANG_MACEDONIAN_MACEDONIA: return "mk_MK"; } return "mk"; case LANG_MALAY: switch (sub) { case SUBLANG_MALAY_MALAYSIA: return "ms_MY"; case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN"; } return "ms"; case LANG_MALAYALAM: switch (sub) { case SUBLANG_MALAYALAM_INDIA: return "ml_IN"; } return "ml"; case LANG_MALTESE: switch (sub) { case SUBLANG_MALTESE_MALTA: return "mt_MT"; } return "mt"; case LANG_MANIPURI: /* FIXME: Adjust this when such locales appear on Unix. */ switch (sub) { case SUBLANG_DEFAULT: return "mni_IN"; } return "mni"; case LANG_MAORI: switch (sub) { case SUBLANG_MAORI_NEW_ZEALAND: return "mi_NZ"; } return "mi"; case LANG_MAPUDUNGUN: switch (sub) { case SUBLANG_MAPUDUNGUN_CHILE: return "arn_CL"; } return "arn"; case LANG_MARATHI: switch (sub) { case SUBLANG_MARATHI_INDIA: return "mr_IN"; } return "mr"; case LANG_MOHAWK: switch (sub) { case SUBLANG_MOHAWK_CANADA: return "moh_CA"; } return "moh"; case LANG_MONGOLIAN: switch (sub) { case SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA: case 0x1e: return "mn_MN"; case SUBLANG_MONGOLIAN_PRC: case 0x1f: return "mn_CN"; } return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN". */ case LANG_NEPALI: switch (sub) { case SUBLANG_NEPALI_NEPAL: return "ne_NP"; case SUBLANG_NEPALI_INDIA: return "ne_IN"; } return "ne"; case LANG_NORWEGIAN: switch (sub) { case 0x1f: return "nb"; case SUBLANG_NORWEGIAN_BOKMAL: return "nb_NO"; case 0x1e: return "nn"; case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO"; } return "no"; case LANG_OCCITAN: switch (sub) { case SUBLANG_OCCITAN_FRANCE: return "oc_FR"; } return "oc"; case LANG_ORIYA: switch (sub) { case SUBLANG_ORIYA_INDIA: return "or_IN"; } return "or"; case LANG_OROMO: switch (sub) { case SUBLANG_DEFAULT: return "om_ET"; } return "om"; case LANG_PAPIAMENTU: switch (sub) { case SUBLANG_DEFAULT: return "pap_AN"; } return "pap"; case LANG_PASHTO: switch (sub) { case SUBLANG_PASHTO_AFGHANISTAN: return "ps_AF"; } return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */ case LANG_POLISH: switch (sub) { case SUBLANG_POLISH_POLAND: return "pl_PL"; } return "pl"; case LANG_PORTUGUESE: switch (sub) { /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT. Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */ case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR"; case SUBLANG_PORTUGUESE: return "pt_PT"; } return "pt"; case LANG_PUNJABI: switch (sub) { case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */ case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */ } return "pa"; case LANG_QUECHUA: /* Note: Microsoft uses the non-ISO language code "quz". */ switch (sub) { case SUBLANG_QUECHUA_BOLIVIA: return "qu_BO"; case SUBLANG_QUECHUA_ECUADOR: return "qu_EC"; case SUBLANG_QUECHUA_PERU: return "qu_PE"; } return "qu"; case LANG_ROMANIAN: switch (sub) { case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO"; case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD"; } return "ro"; case LANG_ROMANSH: switch (sub) { case SUBLANG_ROMANSH_SWITZERLAND: return "rm_CH"; } return "rm"; case LANG_RUSSIAN: switch (sub) { case SUBLANG_RUSSIAN_RUSSIA: return "ru_RU"; case SUBLANG_RUSSIAN_MOLDAVIA: return "ru_MD"; } return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD". */ case LANG_SAMI: switch (sub) { /* Northern Sami */ case 0x00: return "se"; case SUBLANG_SAMI_NORTHERN_NORWAY: return "se_NO"; case SUBLANG_SAMI_NORTHERN_SWEDEN: return "se_SE"; case SUBLANG_SAMI_NORTHERN_FINLAND: return "se_FI"; /* Lule Sami */ case 0x1f: return "smj"; case SUBLANG_SAMI_LULE_NORWAY: return "smj_NO"; case SUBLANG_SAMI_LULE_SWEDEN: return "smj_SE"; /* Southern Sami */ case 0x1e: return "sma"; case SUBLANG_SAMI_SOUTHERN_NORWAY: return "sma_NO"; case SUBLANG_SAMI_SOUTHERN_SWEDEN: return "sma_SE"; /* Skolt Sami */ case 0x1d: return "sms"; case SUBLANG_SAMI_SKOLT_FINLAND: return "sms_FI"; /* Inari Sami */ case 0x1c: return "smn"; case SUBLANG_SAMI_INARI_FINLAND: return "smn_FI"; } return "se"; /* or "smi"? */ case LANG_SANSKRIT: switch (sub) { case SUBLANG_SANSKRIT_INDIA: return "sa_IN"; } return "sa"; case LANG_SCOTTISH_GAELIC: switch (sub) { case SUBLANG_DEFAULT: return "gd_GB"; } return "gd"; case LANG_SINDHI: switch (sub) { case SUBLANG_SINDHI_INDIA: return "sd_IN"; case SUBLANG_SINDHI_PAKISTAN: return "sd_PK"; /*case SUBLANG_SINDHI_AFGHANISTAN: return "sd_AF";*/ } return "sd"; case LANG_SINHALESE: switch (sub) { case SUBLANG_SINHALESE_SRI_LANKA: return "si_LK"; } return "si"; case LANG_SLOVAK: switch (sub) { case SUBLANG_SLOVAK_SLOVAKIA: return "sk_SK"; } return "sk"; case LANG_SLOVENIAN: switch (sub) { case SUBLANG_SLOVENIAN_SLOVENIA: return "sl_SI"; } return "sl"; case LANG_SOMALI: switch (sub) { case SUBLANG_DEFAULT: return "so_SO"; } return "so"; case LANG_SORBIAN: /* FIXME: Adjust this when such locales appear on Unix. */ switch (sub) { /* Upper Sorbian */ case 0x00: return "hsb"; case SUBLANG_UPPER_SORBIAN_GERMANY: return "hsb_DE"; /* Lower Sorbian */ case 0x1f: return "dsb"; case SUBLANG_LOWER_SORBIAN_GERMANY: return "dsb_DE"; } return "wen"; case LANG_SOTHO: /* <https://docs.microsoft.com/en-us/windows/desktop/Intl/language-identifier-constants-and-strings> calls it "Sesotho sa Leboa"; according to <https://www.ethnologue.com/show_language.asp?code=nso> <https://www.ethnologue.com/show_language.asp?code=sot> it's the same as Northern Sotho. */ switch (sub) { case SUBLANG_SOTHO_SOUTH_AFRICA: return "nso_ZA"; } return "nso"; case LANG_SPANISH: switch (sub) { case SUBLANG_SPANISH: return "es_ES"; case SUBLANG_SPANISH_MEXICAN: return "es_MX"; case SUBLANG_SPANISH_MODERN: return "es_ES@modern"; /* not seen on Unix */ case SUBLANG_SPANISH_GUATEMALA: return "es_GT"; case SUBLANG_SPANISH_COSTA_RICA: return "es_CR"; case SUBLANG_SPANISH_PANAMA: return "es_PA"; case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO"; case SUBLANG_SPANISH_VENEZUELA: return "es_VE"; case SUBLANG_SPANISH_COLOMBIA: return "es_CO"; case SUBLANG_SPANISH_PERU: return "es_PE"; case SUBLANG_SPANISH_ARGENTINA: return "es_AR"; case SUBLANG_SPANISH_ECUADOR: return "es_EC"; case SUBLANG_SPANISH_CHILE: return "es_CL"; case SUBLANG_SPANISH_URUGUAY: return "es_UY"; case SUBLANG_SPANISH_PARAGUAY: return "es_PY"; case SUBLANG_SPANISH_BOLIVIA: return "es_BO"; case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV"; case SUBLANG_SPANISH_HONDURAS: return "es_HN"; case SUBLANG_SPANISH_NICARAGUA: return "es_NI"; case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR"; case SUBLANG_SPANISH_US: return "es_US"; } return "es"; case LANG_SUTU: switch (sub) { case SUBLANG_DEFAULT: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */ } return "bnt"; case LANG_SWAHILI: switch (sub) { case SUBLANG_SWAHILI_KENYA: return "sw_KE"; } return "sw"; case LANG_SWEDISH: switch (sub) { case SUBLANG_SWEDISH_SWEDEN: return "sv_SE"; case SUBLANG_SWEDISH_FINLAND: return "sv_FI"; } return "sv"; case LANG_SYRIAC: switch (sub) { case SUBLANG_SYRIAC_SYRIA: return "syr_SY"; /* An extinct language. */ } return "syr"; case LANG_TAGALOG: switch (sub) { case SUBLANG_TAGALOG_PHILIPPINES: return "tl_PH"; /* or "fil_PH"? */ } return "tl"; /* or "fil"? */ case LANG_TAJIK: switch (sub) { case 0x1f: return "tg"; case SUBLANG_TAJIK_TAJIKISTAN: return "tg_TJ"; } return "tg"; case LANG_TAMAZIGHT: /* Note: Microsoft uses the non-ISO language code "tmz". */ switch (sub) { /* FIXME: Adjust this when Tamazight locales appear on Unix. */ case SUBLANG_TAMAZIGHT_ARABIC: return "ber_MA@arabic"; case 0x1f: return "ber@latin"; case SUBLANG_TAMAZIGHT_ALGERIA_LATIN: return "ber_DZ@latin"; } return "ber"; case LANG_TAMIL: switch (sub) { case SUBLANG_TAMIL_INDIA: return "ta_IN"; } return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */ case LANG_TATAR: switch (sub) { case SUBLANG_TATAR_RUSSIA: return "tt_RU"; } return "tt"; case LANG_TELUGU: switch (sub) { case SUBLANG_TELUGU_INDIA: return "te_IN"; } return "te"; case LANG_THAI: switch (sub) { case SUBLANG_THAI_THAILAND: return "th_TH"; } return "th"; case LANG_TIBETAN: switch (sub) { case SUBLANG_TIBETAN_PRC: /* Most Tibetans would not like "bo_CN". But Tibet does not yet have a country code of its own. */ return "bo"; case SUBLANG_TIBETAN_BHUTAN: return "bo_BT"; } return "bo"; case LANG_TIGRINYA: switch (sub) { case SUBLANG_TIGRINYA_ETHIOPIA: return "ti_ET"; case SUBLANG_TIGRINYA_ERITREA: return "ti_ER"; } return "ti"; case LANG_TSONGA: switch (sub) { case SUBLANG_DEFAULT: return "ts_ZA"; } return "ts"; case LANG_TSWANA: /* Spoken in South Africa, Botswana. */ switch (sub) { case SUBLANG_TSWANA_SOUTH_AFRICA: return "tn_ZA"; } return "tn"; case LANG_TURKISH: switch (sub) { case SUBLANG_TURKISH_TURKEY: return "tr_TR"; } return "tr"; case LANG_TURKMEN: switch (sub) { case SUBLANG_TURKMEN_TURKMENISTAN: return "tk_TM"; } return "tk"; case LANG_UIGHUR: switch (sub) { case SUBLANG_UIGHUR_PRC: return "ug_CN"; } return "ug"; case LANG_UKRAINIAN: switch (sub) { case SUBLANG_UKRAINIAN_UKRAINE: return "uk_UA"; } return "uk"; case LANG_URDU: switch (sub) { case SUBLANG_URDU_PAKISTAN: return "ur_PK"; case SUBLANG_URDU_INDIA: return "ur_IN"; } return "ur"; case LANG_UZBEK: switch (sub) { case 0x1f: return "uz"; case SUBLANG_UZBEK_LATIN: return "uz_UZ"; case 0x1e: return "uz@cyrillic"; case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic"; } return "uz"; case LANG_VENDA: switch (sub) { case SUBLANG_DEFAULT: return "ve_ZA"; } return "ve"; case LANG_VIETNAMESE: switch (sub) { case SUBLANG_VIETNAMESE_VIETNAM: return "vi_VN"; } return "vi"; case LANG_WELSH: switch (sub) { case SUBLANG_WELSH_UNITED_KINGDOM: return "cy_GB"; } return "cy"; case LANG_WOLOF: switch (sub) { case SUBLANG_WOLOF_SENEGAL: return "wo_SN"; } return "wo"; case LANG_XHOSA: switch (sub) { case SUBLANG_XHOSA_SOUTH_AFRICA: return "xh_ZA"; } return "xh"; case LANG_YAKUT: switch (sub) { case SUBLANG_YAKUT_RUSSIA: return "sah_RU"; } return "sah"; case LANG_YI: switch (sub) { case SUBLANG_YI_PRC: return "ii_CN"; } return "ii"; case LANG_YIDDISH: switch (sub) { case SUBLANG_DEFAULT: return "yi_IL"; } return "yi"; case LANG_YORUBA: switch (sub) { case SUBLANG_YORUBA_NIGERIA: return "yo_NG"; } return "yo"; case LANG_ZULU: switch (sub) { case SUBLANG_ZULU_SOUTH_AFRICA: return "zu_ZA"; } return "zu"; default: return "C"; } } } # if !defined IN_LIBINTL static # endif const char * gl_locale_name_from_win32_LCID (LCID lcid) { LANGID langid; /* Strip off the sorting rules, keep only the language part. */ langid = LANGIDFROMLCID (lcid); return gl_locale_name_from_win32_LANGID (langid); } # ifdef WINDOWS_NATIVE /* Two variables to interface between get_lcid and the EnumLocales callback function below. */ static LCID found_lcid; static char lname[LC_MAX * (LOCALE_NAME_MAX_LENGTH + 1) + 1]; /* Callback function for EnumLocales. */ static BOOL CALLBACK enum_locales_fn (LPSTR locale_num_str) { char *endp; char locval[2 * LOCALE_NAME_MAX_LENGTH + 1 + 1]; LCID try_lcid = strtoul (locale_num_str, &endp, 16); if (GetLocaleInfo (try_lcid, LOCALE_SENGLANGUAGE, locval, LOCALE_NAME_MAX_LENGTH)) { strcat (locval, "_"); if (GetLocaleInfo (try_lcid, LOCALE_SENGCOUNTRY, locval + strlen (locval), LOCALE_NAME_MAX_LENGTH)) { size_t locval_len = strlen (locval); if (strncmp (locval, lname, locval_len) == 0 && (lname[locval_len] == '.' || lname[locval_len] == '\0')) { found_lcid = try_lcid; return FALSE; } } } return TRUE; } /* This lock protects the get_lcid against multiple simultaneous calls. */ gl_lock_define_initialized(static, get_lcid_lock) /* Return the Locale ID (LCID) number given the locale's name, a string, in LOCALE_NAME. This works by enumerating all the locales supported by the system, until we find one whose name matches LOCALE_NAME. */ static LCID get_lcid (const char *locale_name) { /* A simple cache. */ static LCID last_lcid; static char last_locale[1000]; /* Lock while looking for an LCID, to protect access to static variables: last_lcid, last_locale, found_lcid, and lname. */ gl_lock_lock (get_lcid_lock); if (last_lcid > 0 && strcmp (locale_name, last_locale) == 0) { gl_lock_unlock (get_lcid_lock); return last_lcid; } strncpy (lname, locale_name, sizeof (lname) - 1); lname[sizeof (lname) - 1] = '\0'; found_lcid = 0; EnumSystemLocales (enum_locales_fn, LCID_SUPPORTED); if (found_lcid > 0) { last_lcid = found_lcid; strcpy (last_locale, locale_name); } gl_lock_unlock (get_lcid_lock); return found_lcid; } # endif #endif #if HAVE_GOOD_USELOCALE /* glibc, Mac OS X, FreeBSD >= 9.1, Cygwin >= 2.6, Solaris 11 OpenIndiana, or Solaris >= 11.4 */ /* Simple hash set of strings. We don't want to drag in lots of hash table code here. */ # define SIZE_BITS (sizeof (size_t) * CHAR_BIT) /* A hash function for NUL-terminated char* strings using the method described by Bruno Haible. See https://www.haible.de/bruno/hashfunc.html. */ static size_t _GL_ATTRIBUTE_PURE string_hash (const void *x) { const char *s = (const char *) x; size_t h = 0; for (; *s; s++) h = *s + ((h << 9) | (h >> (SIZE_BITS - 9))); return h; } /* A hash table of fixed size. Multiple threads can access it read-only simultaneously, but only one thread can insert into it at the same time. */ /* A node in a hash bucket collision list. */ struct struniq_hash_node { struct struniq_hash_node * volatile next; char contents[FLEXIBLE_ARRAY_MEMBER]; }; # define STRUNIQ_HASH_TABLE_SIZE 257 static struct struniq_hash_node * volatile struniq_hash_table[STRUNIQ_HASH_TABLE_SIZE] /* = { NULL, ..., NULL } */; /* This lock protects the struniq_hash_table against multiple simultaneous insertions. */ gl_lock_define_initialized(static, struniq_lock) /* Store a copy of the given string in a string pool with indefinite extent. Return a pointer to this copy. */ static const char * struniq (const char *string) { size_t hashcode = string_hash (string); size_t slot = hashcode % STRUNIQ_HASH_TABLE_SIZE; size_t size; struct struniq_hash_node *new_node; struct struniq_hash_node *p; for (p = struniq_hash_table[slot]; p != NULL; p = p->next) if (strcmp (p->contents, string) == 0) return p->contents; size = strlen (string) + 1; new_node = (struct struniq_hash_node *) malloc (FLEXSIZEOF (struct struniq_hash_node, contents, size)); if (new_node == NULL) /* Out of memory. Return a statically allocated string. */ return "C"; memcpy (new_node->contents, string, size); { bool mt = gl_multithreaded (); /* Lock while inserting new_node. */ if (mt) gl_lock_lock (struniq_lock); /* Check whether another thread already added the string while we were waiting on the lock. */ for (p = struniq_hash_table[slot]; p != NULL; p = p->next) if (strcmp (p->contents, string) == 0) { free (new_node); new_node = p; goto done; } /* Really insert new_node into the hash table. Fill new_node entirely first, because other threads may be iterating over the linked list. */ new_node->next = struniq_hash_table[slot]; struniq_hash_table[slot] = new_node; done: /* Unlock after new_node is inserted. */ if (mt) gl_lock_unlock (struniq_lock); } return new_node->contents; } #endif #if LOCALENAME_ENHANCE_LOCALE_FUNCS /* The 'locale_t' object does not contain the names of the locale categories. We have to associate them with the object through a hash table. The hash table is defined in localename-table.[hc]. */ /* Returns the name of a given locale category in a given locale_t object, allocated as a string with indefinite extent. */ static const char * get_locale_t_name (int category, locale_t locale) { if (locale == LC_GLOBAL_LOCALE) { /* Query the global locale. */ const char *name = setlocale_null (category); if (name != NULL) return struniq (name); else /* Should normally not happen. */ return ""; } else { /* Look up the names in the hash table. */ size_t hashcode = locale_hash_function (locale); size_t slot = hashcode % LOCALE_HASH_TABLE_SIZE; /* If the locale was not found in the table, return "". This can happen if the application uses the original newlocale()/duplocale() functions instead of the overridden ones. */ const char *name = ""; struct locale_hash_node *p; /* Lock while looking up the hash node. */ gl_rwlock_rdlock (locale_lock); for (p = locale_hash_table[slot]; p != NULL; p = p->next) if (p->locale == locale) { name = p->names.category_name[category]; break; } gl_rwlock_unlock (locale_lock); return name; } } # if !(defined newlocale && defined duplocale && defined freelocale) # error "newlocale, duplocale, freelocale not being replaced as expected!" # endif /* newlocale() override. */ locale_t newlocale (int category_mask, const char *name, locale_t base) #undef newlocale { struct locale_categories_names names; struct locale_hash_node *node; locale_t result; /* Make sure name has indefinite extent. */ if (((LC_CTYPE_MASK | LC_NUMERIC_MASK | LC_TIME_MASK | LC_COLLATE_MASK | LC_MONETARY_MASK | LC_MESSAGES_MASK) & category_mask) != 0) name = struniq (name); /* Determine the category names of the result. */ if (((LC_CTYPE_MASK | LC_NUMERIC_MASK | LC_TIME_MASK | LC_COLLATE_MASK | LC_MONETARY_MASK | LC_MESSAGES_MASK) & ~category_mask) == 0) { /* Use name, ignore base. */ int category; name = struniq (name); for (category = 0; category < 6; category++) names.category_name[category] = name; } else { /* Use base, possibly also name. */ if (base == NULL) { int category; for (category = 0; category < 6; category++) { int mask; switch (category) { case LC_CTYPE: mask = LC_CTYPE_MASK; break; case LC_NUMERIC: mask = LC_NUMERIC_MASK; break; case LC_TIME: mask = LC_TIME_MASK; break; case LC_COLLATE: mask = LC_COLLATE_MASK; break; case LC_MONETARY: mask = LC_MONETARY_MASK; break; case LC_MESSAGES: mask = LC_MESSAGES_MASK; break; default: abort (); } names.category_name[category] = ((mask & category_mask) != 0 ? name : "C"); } } else if (base == LC_GLOBAL_LOCALE) { int category; for (category = 0; category < 6; category++) { int mask; switch (category) { case LC_CTYPE: mask = LC_CTYPE_MASK; break; case LC_NUMERIC: mask = LC_NUMERIC_MASK; break; case LC_TIME: mask = LC_TIME_MASK; break; case LC_COLLATE: mask = LC_COLLATE_MASK; break; case LC_MONETARY: mask = LC_MONETARY_MASK; break; case LC_MESSAGES: mask = LC_MESSAGES_MASK; break; default: abort (); } names.category_name[category] = ((mask & category_mask) != 0 ? name : get_locale_t_name (category, LC_GLOBAL_LOCALE)); } } else { /* Look up the names of base in the hash table. Like multiple calls of get_locale_t_name, but locking only once. */ struct locale_hash_node *p; int category; /* Lock while looking up the hash node. */ gl_rwlock_rdlock (locale_lock); for (p = locale_hash_table[locale_hash_function (base) % LOCALE_HASH_TABLE_SIZE]; p != NULL; p = p->next) if (p->locale == base) break; for (category = 0; category < 6; category++) { int mask; switch (category) { case LC_CTYPE: mask = LC_CTYPE_MASK; break; case LC_NUMERIC: mask = LC_NUMERIC_MASK; break; case LC_TIME: mask = LC_TIME_MASK; break; case LC_COLLATE: mask = LC_COLLATE_MASK; break; case LC_MONETARY: mask = LC_MONETARY_MASK; break; case LC_MESSAGES: mask = LC_MESSAGES_MASK; break; default: abort (); } names.category_name[category] = ((mask & category_mask) != 0 ? name : (p != NULL ? p->names.category_name[category] : "")); } gl_rwlock_unlock (locale_lock); } } node = (struct locale_hash_node *) malloc (sizeof (struct locale_hash_node)); if (node == NULL) /* errno is set to ENOMEM. */ return NULL; result = newlocale (category_mask, name, base); if (result == NULL) { free (node); return NULL; } /* Fill the hash node. */ node->locale = result; node->names = names; /* Insert it in the hash table. */ { size_t hashcode = locale_hash_function (result); size_t slot = hashcode % LOCALE_HASH_TABLE_SIZE; struct locale_hash_node *p; /* Lock while inserting the new node. */ gl_rwlock_wrlock (locale_lock); for (p = locale_hash_table[slot]; p != NULL; p = p->next) if (p->locale == result) { /* This can happen if the application uses the original freelocale() function instead of the overridden one. */ p->names = node->names; break; } if (p == NULL) { node->next = locale_hash_table[slot]; locale_hash_table[slot] = node; } gl_rwlock_unlock (locale_lock); if (p != NULL) free (node); } return result; } /* duplocale() override. */ locale_t duplocale (locale_t locale) #undef duplocale { struct locale_hash_node *node; locale_t result; if (locale == NULL) /* Invalid argument. */ abort (); node = (struct locale_hash_node *) malloc (sizeof (struct locale_hash_node)); if (node == NULL) /* errno is set to ENOMEM. */ return NULL; result = duplocale (locale); if (result == NULL) { free (node); return NULL; } /* Fill the hash node. */ node->locale = result; if (locale == LC_GLOBAL_LOCALE) { int category; for (category = 0; category < 6; category++) node->names.category_name[category] = get_locale_t_name (category, LC_GLOBAL_LOCALE); /* Lock before inserting the new node. */ gl_rwlock_wrlock (locale_lock); } else { struct locale_hash_node *p; /* Lock once, for the lookup and the insertion. */ gl_rwlock_wrlock (locale_lock); for (p = locale_hash_table[locale_hash_function (locale) % LOCALE_HASH_TABLE_SIZE]; p != NULL; p = p->next) if (p->locale == locale) break; if (p != NULL) node->names = p->names; else { /* This can happen if the application uses the original newlocale()/duplocale() functions instead of the overridden ones. */ int category; for (category = 0; category < 6; category++) node->names.category_name[category] = ""; } } /* Insert it in the hash table. */ { size_t hashcode = locale_hash_function (result); size_t slot = hashcode % LOCALE_HASH_TABLE_SIZE; struct locale_hash_node *p; for (p = locale_hash_table[slot]; p != NULL; p = p->next) if (p->locale == result) { /* This can happen if the application uses the original freelocale() function instead of the overridden one. */ p->names = node->names; break; } if (p == NULL) { node->next = locale_hash_table[slot]; locale_hash_table[slot] = node; } gl_rwlock_unlock (locale_lock); if (p != NULL) free (node); } return result; } /* freelocale() override. */ void freelocale (locale_t locale) #undef freelocale { if (locale == NULL || locale == LC_GLOBAL_LOCALE) /* Invalid argument. */ abort (); { size_t hashcode = locale_hash_function (locale); size_t slot = hashcode % LOCALE_HASH_TABLE_SIZE; struct locale_hash_node *found; struct locale_hash_node **p; found = NULL; /* Lock while removing the hash node. */ gl_rwlock_wrlock (locale_lock); for (p = &locale_hash_table[slot]; *p != NULL; p = &(*p)->next) if ((*p)->locale == locale) { found = *p; *p = (*p)->next; break; } gl_rwlock_unlock (locale_lock); free (found); } freelocale (locale); } #endif #if defined IN_LIBINTL || HAVE_GOOD_USELOCALE /* Like gl_locale_name_thread, except that the result is not in storage of indefinite extent. */ # if !defined IN_LIBINTL static # endif const char * gl_locale_name_thread_unsafe (int category, const char *categoryname _GL_UNUSED) { # if HAVE_GOOD_USELOCALE { locale_t thread_locale = uselocale (NULL); if (thread_locale != LC_GLOBAL_LOCALE) { # if __GLIBC__ >= 2 && !defined __UCLIBC__ /* Work around an incorrect definition of the _NL_LOCALE_NAME macro in glibc < 2.12. See <https://sourceware.org/bugzilla/show_bug.cgi?id=10968>. */ const char *name = nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1))); if (name[0] == '\0') /* Fallback code for glibc < 2.4, which did not implement nl_langinfo (_NL_LOCALE_NAME (category)). */ name = thread_locale->__names[category]; return name; # elif defined __linux__ && HAVE_LANGINFO_H && defined NL_LOCALE_NAME /* musl libc */ return nl_langinfo_l (NL_LOCALE_NAME (category), thread_locale); # elif (defined __FreeBSD__ || defined __DragonFly__) || (defined __APPLE__ && defined __MACH__) /* FreeBSD, Mac OS X */ int mask; switch (category) { case LC_CTYPE: mask = LC_CTYPE_MASK; break; case LC_NUMERIC: mask = LC_NUMERIC_MASK; break; case LC_TIME: mask = LC_TIME_MASK; break; case LC_COLLATE: mask = LC_COLLATE_MASK; break; case LC_MONETARY: mask = LC_MONETARY_MASK; break; case LC_MESSAGES: mask = LC_MESSAGES_MASK; break; default: /* We shouldn't get here. */ return ""; } return querylocale (mask, thread_locale); # elif defined __sun # if HAVE_GETLOCALENAME_L /* Solaris >= 12. */ return getlocalename_l (category, thread_locale); # elif HAVE_SOLARIS114_LOCALES /* Solaris >= 11.4. */ void *lcp = (*thread_locale)->core.data->lcp; if (lcp != NULL) switch (category) { case LC_CTYPE: case LC_NUMERIC: case LC_TIME: case LC_COLLATE: case LC_MONETARY: case LC_MESSAGES: return ((const char * const *) lcp)[category]; default: /* We shouldn't get here. */ return ""; } # elif HAVE_NAMELESS_LOCALES return get_locale_t_name (category, thread_locale); # else /* Solaris 11 OpenIndiana. For the internal structure of locale objects, see https://github.com/OpenIndiana/illumos-gate/blob/master/usr/src/lib/libc/port/locale/localeimpl.h */ switch (category) { case LC_CTYPE: case LC_NUMERIC: case LC_TIME: case LC_COLLATE: case LC_MONETARY: case LC_MESSAGES: return ((const char * const *) thread_locale)[category]; default: /* We shouldn't get here. */ return ""; } # endif # elif defined _AIX && HAVE_NAMELESS_LOCALES return get_locale_t_name (category, thread_locale); # elif defined __CYGWIN__ /* Cygwin < 2.6 lacks uselocale and thread-local locales altogether. Cygwin <= 2.6.1 lacks NL_LOCALE_NAME, requiring peeking inside an opaque struct. */ # ifdef NL_LOCALE_NAME return nl_langinfo_l (NL_LOCALE_NAME (category), thread_locale); # else /* FIXME: Remove when we can assume new-enough Cygwin. */ struct __locale_t { char categories[7][32]; }; return ((struct __locale_t *) thread_locale)->categories[category]; # endif # elif defined __ANDROID__ return MB_CUR_MAX == 4 ? "C.UTF-8" : "C"; # endif } } # endif return NULL; } #endif const char * gl_locale_name_thread (int category, const char *categoryname _GL_UNUSED) { #if HAVE_GOOD_USELOCALE const char *name = gl_locale_name_thread_unsafe (category, categoryname); if (name != NULL) return struniq (name); #endif /* On WINDOWS_NATIVE, don't use GetThreadLocale() here, because when SetThreadLocale has not been called - which is a very frequent case - the value of GetThreadLocale() ignores past calls to 'setlocale'. */ return NULL; } /* XPG3 defines the result of 'setlocale (category, NULL)' as: "Directs 'setlocale()' to query 'category' and return the current setting of 'local'." However it does not specify the exact format. Neither do SUSV2 and ISO C 99. So we can use this feature only on selected systems (e.g. those using GNU C Library). */ #if defined _LIBC || ((defined __GLIBC__ && __GLIBC__ >= 2) && !defined __UCLIBC__) # define HAVE_LOCALE_NULL #endif const char * gl_locale_name_posix (int category, const char *categoryname _GL_UNUSED) { #if defined WINDOWS_NATIVE if (LC_MIN <= category && category <= LC_MAX) { const char *locname = /* setlocale_null (category) is identical to setlocale (category, NULL) on this platform. */ setlocale (category, NULL); /* Convert locale name to LCID. We don't want to use LocaleNameToLCID because (a) it is only available since Vista, and (b) it doesn't accept locale names returned by 'setlocale'. */ LCID lcid = get_lcid (locname); if (lcid > 0) return gl_locale_name_from_win32_LCID (lcid); } #endif { const char *locname; /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'. On some systems this can be done by the 'setlocale' function itself. */ #if defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL locname = setlocale_null (category); #else /* On other systems we ignore what setlocale reports and instead look at the environment variables directly. This is necessary 1. on systems which have a facility for customizing the default locale (Mac OS X, native Windows, Cygwin) and where the system's setlocale() function ignores this default locale (Mac OS X, Cygwin), in two cases: a. when the user missed to use the setlocale() override from libintl (for example by not including <libintl.h>), b. when setlocale supports only the "C" locale, such as on Cygwin 1.5.x. In this case even the override from libintl cannot help. 2. on all systems where setlocale supports only the "C" locale. */ /* Strictly speaking, it is a POSIX violation to look at the environment variables regardless whether setlocale has been called or not. POSIX says: "For C-language programs, the POSIX locale shall be the default locale when the setlocale() function is not called." But we assume that all programs that use internationalized APIs call setlocale (LC_ALL, ""). */ locname = gl_locale_name_environ (category, categoryname); #endif /* Convert the locale name from the format returned by setlocale() or found in the environment variables to the XPG syntax. */ #if defined WINDOWS_NATIVE if (locname != NULL) { /* Convert locale name to LCID. We don't want to use LocaleNameToLCID because (a) it is only available since Vista, and (b) it doesn't accept locale names returned by 'setlocale'. */ LCID lcid = get_lcid (locname); if (lcid > 0) return gl_locale_name_from_win32_LCID (lcid); } #endif return locname; } } const char * gl_locale_name_environ (int category _GL_UNUSED, const char *categoryname) { const char *retval; /* Setting of LC_ALL overrides all other. */ retval = getenv ("LC_ALL"); if (retval != NULL && retval[0] != '\0') return retval; /* Next comes the name of the desired category. */ retval = getenv (categoryname); if (retval != NULL && retval[0] != '\0') return retval; /* Last possibility is the LANG environment variable. */ retval = getenv ("LANG"); if (retval != NULL && retval[0] != '\0') { #if HAVE_CFPREFERENCESCOPYAPPVALUE /* Mac OS X 10.2 or newer. Ignore invalid LANG value set by the Terminal application. */ if (strcmp (retval, "UTF-8") != 0) #endif #if defined __CYGWIN__ /* Cygwin. Ignore dummy LANG value set by ~/.profile. */ if (strcmp (retval, "C.UTF-8") != 0) #endif return retval; } return NULL; } const char * gl_locale_name_default (void) { /* POSIX:2001 says: "All implementations shall define a locale as the default locale, to be invoked when no environment variables are set, or set to the empty string. This default locale can be the POSIX locale or any other implementation-defined locale. Some implementations may provide facilities for local installation administrators to set the default locale, customizing it for each location. POSIX:2001 does not require such a facility. The systems with such a facility are Mac OS X and Windows: They provide a GUI that allows the user to choose a locale. - On Mac OS X, by default, none of LC_* or LANG are set. Starting with Mac OS X 10.4 or 10.5, LANG is set for processes launched by the 'Terminal' application (but sometimes to an incorrect value "UTF-8"). When no environment variable is set, setlocale (LC_ALL, "") uses the "C" locale. - On native Windows, by default, none of LC_* or LANG are set. When no environment variable is set, setlocale (LC_ALL, "") uses the locale chosen by the user. - On Cygwin 1.5.x, by default, none of LC_* or LANG are set. When no environment variable is set, setlocale (LC_ALL, "") uses the "C" locale. - On Cygwin 1.7, by default, LANG is set to "C.UTF-8" when the default ~/.profile is executed. When no environment variable is set, setlocale (LC_ALL, "") uses the "C.UTF-8" locale, which operates in the same way as the "C" locale. */ #if !(HAVE_CFPREFERENCESCOPYAPPVALUE || defined WINDOWS_NATIVE || defined __CYGWIN__) /* The system does not have a way of setting the locale, other than the POSIX specified environment variables. We use C as default locale. */ return "C"; #else /* Return an XPG style locale name language[_territory][@modifier]. Don't even bother determining the codeset; it's not useful in this context, because message catalogs are not specific to a single codeset. */ # if HAVE_CFPREFERENCESCOPYAPPVALUE /* Mac OS X 10.4 or newer */ /* Don't use the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent, because in macOS 10.13.4 it has the following behaviour: When two or more languages are specified in the "System Preferences > Language & Region > Preferred Languages" panel, it returns en_CC where CC is the territory (even when English is not among the preferred languages!). What we want instead is what CFLocaleCopyCurrent returned in earlier macOS releases and what CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the first among the preferred languages and CC is the territory. */ { /* Cache the locale name, since CoreFoundation calls are expensive. */ static const char *cached_localename; if (cached_localename == NULL) { char namebuf[256]; CFTypeRef value = CFPreferencesCopyAppValue (CFSTR ("AppleLocale"), kCFPreferencesCurrentApplication); if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) { CFStringRef name = (CFStringRef)value; if (CFStringGetCString (name, namebuf, sizeof (namebuf), kCFStringEncodingASCII)) { gl_locale_name_canonicalize (namebuf); cached_localename = strdup (namebuf); } } if (cached_localename == NULL) cached_localename = "C"; } return cached_localename; } # endif # if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Native Windows or Cygwin */ { LCID lcid; /* Use native Windows API locale ID. */ lcid = GetThreadLocale (); return gl_locale_name_from_win32_LCID (lcid); } # endif #endif } /* Determine the current locale's name, and canonicalize it into XPG syntax language[_territory][.codeset][@modifier] The codeset part in the result is not reliable; the locale_charset() should be used for codeset information instead. The result must not be freed; it is statically allocated. */ const char * gl_locale_name (int category, const char *categoryname) { const char *retval; retval = gl_locale_name_thread (category, categoryname); if (retval != NULL) return retval; retval = gl_locale_name_posix (category, categoryname); if (retval != NULL) return retval; return gl_locale_name_default (); } ����������������kbuild-3608/src/grep/gnulib-tests/altstack-util.h���������������������������������������������������0000664�0001750�0001750�00000004356�14670377427�022035� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Some auxiliary stuff for defining an alternate stack. Copyright (C) 2010-2021 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 2 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake and Bruno Haible. */ #include <stdint.h> /* uintptr_t */ #include <string.h> /* for memset */ #define MYSTACK_SIZE (1 << 24) /* glibc says: Users should use SIGSTKSZ as the size of user-supplied buffers. We want to detect stack overflow of the alternate stack in a nicer manner than just crashing, so we overallocate in comparison to what we hand libsigsegv. Also, we intentionally hand an unaligned pointer, to ensure the alternate stack still ends up aligned. */ #define MYSTACK_CRUMPLE_ZONE 8192 static char mystack_storage[MYSTACK_SIZE + 2 * MYSTACK_CRUMPLE_ZONE + 31]; static char *mystack; /* MYSTACK_SIZE bytes in the middle of storage. */ static void prepare_alternate_stack (void) { #ifdef SIGSTKSZ if (MYSTACK_SIZE < SIGSTKSZ) { size_t size = SIGSTKSZ; printf ("SIGSTKSZ=%zu exceeds MYSTACK_SIZE=%d\n", size, MYSTACK_SIZE); exit (1); } #endif memset (mystack_storage, 's', sizeof mystack_storage); mystack = (char *) ((uintptr_t) (mystack_storage + MYSTACK_CRUMPLE_ZONE) | 31); } static void check_alternate_stack_no_overflow (void) { unsigned int i; for (i = MYSTACK_CRUMPLE_ZONE; i > 0; i--) if (*(mystack - i) != 's') { printf ("Alternate stack was exceeded by %u bytes!!\n", i); exit (1); } for (i = MYSTACK_CRUMPLE_ZONE; i > 0; i--) if (*(mystack + MYSTACK_SIZE - 1 + i) != 's') { printf ("Alternate stack was exceeded by %u bytes!!\n", i); exit (1); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/imaxtostr.c�������������������������������������������������������0000664�0001750�0001750�00000001522�14670377427�021271� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Convert 'intmax_t' integer to printable string. Copyright (C) 2004-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #define anytostr imaxtostr #define inttype intmax_t #include "anytostr.c" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fopen-gnu.c��������������������������������������������������0000664�0001750�0001750�00000004372�14670377436�022120� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of opening a file stream. Copyright (C) 2020-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2020. */ #include <config.h> /* Specification. */ #include <stdio.h> #include <errno.h> #include <fcntl.h> #include <unistd.h> #include "macros.h" #define BASE "test-fopen-gnu.t" /* 0x1a is an EOF on Windows. */ #define DATA "abc\x1axyz" int main (void) { FILE *f; int fd; int flags; char buf[16]; /* Remove anything from prior partial run. */ unlink (BASE "file"); unlink (BASE "binary"); /* Create the file. */ f = fopen (BASE "file", "w"); ASSERT (f); fd = fileno (f); ASSERT (fd >= 0); flags = fcntl (fd, F_GETFD); ASSERT (flags >= 0); ASSERT ((flags & FD_CLOEXEC) == 0); ASSERT (fclose (f) == 0); /* Create the file and check the 'e' mode. */ f = fopen (BASE "file", "we"); ASSERT (f); fd = fileno (f); ASSERT (fd >= 0); flags = fcntl (fd, F_GETFD); ASSERT (flags >= 0); ASSERT ((flags & FD_CLOEXEC) != 0); ASSERT (fclose (f) == 0); /* Open the file and check the 'x' mode. */ f = fopen (BASE "file", "ax"); ASSERT (f == NULL); ASSERT (errno == EEXIST); /* Open a binary file and check that the 'e' mode doesn't interfere. */ f = fopen (BASE "binary", "wbe"); ASSERT (f); ASSERT (fwrite (DATA, 1, sizeof (DATA)-1, f) == sizeof (DATA)-1); ASSERT (fclose (f) == 0); f = fopen (BASE "binary", "rbe"); ASSERT (f); ASSERT (fread (buf, 1, sizeof (buf), f) == sizeof (DATA)-1); ASSERT (fclose (f) == 0); /* Cleanup. */ ASSERT (unlink (BASE "file") == 0); ASSERT (unlink (BASE "binary") == 0); return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-exclude4.sh��������������������������������������������������0000775�0001750�0001750�00000002354�14670377431�022123� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test suite for exclude. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . fail=0 # Test wildcard matching cat > in <<EOT foo* bar Baz EOT cat > expected <<EOT foobar: 1 EOT ${CHECKER} test-exclude -wildcards in -- foobar > out || exit $? # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac # normalize output LC_ALL=C tr -d "$cr" < out > k && mv k out compare expected out || fail=1 Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/arpa_inet.in.h����������������������������������������������������0000664�0001750�0001750�00000012131�14670377430�021603� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* A GNU-like <arpa/inet.h>. Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _@GUARD_PREFIX@_ARPA_INET_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if @HAVE_FEATURES_H@ # include <features.h> /* for __GLIBC__ */ #endif /* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and for pulling in winsock2.h etc. under MinGW. But avoid namespace pollution on glibc systems. */ #ifndef __GLIBC__ # include <sys/socket.h> #endif /* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>. But avoid namespace pollution on glibc systems. */ #if defined __TANDEM && !defined __GLIBC__ # include <netdb.h> #endif #if @HAVE_ARPA_INET_H@ /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@ #endif #ifndef _@GUARD_PREFIX@_ARPA_INET_H #define _@GUARD_PREFIX@_ARPA_INET_H /* Get all possible declarations of inet_ntop() and inet_pton(). */ #if (@GNULIB_INET_NTOP@ || @GNULIB_INET_PTON@ || defined GNULIB_POSIXCHECK) \ && @HAVE_WS2TCPIP_H@ # include <ws2tcpip.h> #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ #if @GNULIB_INET_NTOP@ /* Converts an internet address from internal format to a printable, presentable format. AF is an internet address family, such as AF_INET or AF_INET6. SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr' (for AF_INET6). DST points to a buffer having room for CNT bytes. The printable representation of the address (in numeric form, not surrounded by [...], no reverse DNS is done) is placed in DST, and DST is returned. If an error occurs, the return value is NULL and errno is set. If CNT bytes are not sufficient to hold the result, the return value is NULL and errno is set to ENOSPC. A good value for CNT is 46. For more details, see the POSIX:2008 specification <https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html>. */ # if @REPLACE_INET_NTOP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef inet_ntop # define inet_ntop rpl_inet_ntop # endif _GL_FUNCDECL_RPL (inet_ntop, const char *, (int af, const void *restrict src, char *restrict dst, socklen_t cnt) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (inet_ntop, const char *, (int af, const void *restrict src, char *restrict dst, socklen_t cnt)); # else # if !@HAVE_DECL_INET_NTOP@ _GL_FUNCDECL_SYS (inet_ntop, const char *, (int af, const void *restrict src, char *restrict dst, socklen_t cnt) _GL_ARG_NONNULL ((2, 3))); # endif /* Need to cast, because on NonStop Kernel, the fourth parameter is size_t cnt. */ _GL_CXXALIAS_SYS_CAST (inet_ntop, const char *, (int af, const void *restrict src, char *restrict dst, socklen_t cnt)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (inet_ntop); # endif #elif defined GNULIB_POSIXCHECK # undef inet_ntop # if HAVE_RAW_DECL_INET_NTOP _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - " "use gnulib module inet_ntop for portability"); # endif #endif #if @GNULIB_INET_PTON@ # if @REPLACE_INET_PTON@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef inet_pton # define inet_pton rpl_inet_pton # endif _GL_FUNCDECL_RPL (inet_pton, int, (int af, const char *restrict src, void *restrict dst) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (inet_pton, int, (int af, const char *restrict src, void *restrict dst)); # else # if !@HAVE_DECL_INET_PTON@ _GL_FUNCDECL_SYS (inet_pton, int, (int af, const char *restrict src, void *restrict dst) _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (inet_pton, int, (int af, const char *restrict src, void *restrict dst)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (inet_pton); # endif #elif defined GNULIB_POSIXCHECK # undef inet_pton # if HAVE_RAW_DECL_INET_PTON _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - " "use gnulib module inet_pton for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_ARPA_INET_H */ #endif /* _@GUARD_PREFIX@_ARPA_INET_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-dfa-invalid-char-class.sh������������������������������������0000775�0001750�0001750�00000002014�14670377436�024600� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This use of our DFA-testing helper would fail for grep-2.21. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src # Add "." to PATH for the use of test-dfa-match-aux. path_prepend_ . fail=0 echo 'dfaerror: invalid character class' > exp LC_ALL=C ${CHECKER} test-dfa-match-aux '[[:foo:]]' a > out 2>&1 compare exp out || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/inet_pton.c�������������������������������������������������������0000664�0001750�0001750�00000015414�14670377436�021243� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* * Copyright (c) 1996,1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include <config.h> /* Specification. */ #include <arpa/inet.h> #if HAVE_DECL_INET_PTON # undef inet_pton int rpl_inet_pton (int af, const char *restrict src, void *restrict dst) { return inet_pton (af, src, dst); } #else # include <c-ctype.h> # include <string.h> # include <errno.h> # define NS_INADDRSZ 4 # define NS_IN6ADDRSZ 16 # define NS_INT16SZ 2 /* * WARNING: Don't even consider trying to compile this on a system where * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. */ static int inet_pton4 (const char *src, unsigned char *dst); # if HAVE_IPV6 static int inet_pton6 (const char *src, unsigned char *dst); # endif /* int * inet_pton(af, src, dst) * convert from presentation format (which usually means ASCII printable) * to network format (which is usually some kind of binary format). * return: * 1 if the address was valid for the specified address family * 0 if the address wasn't valid ('dst' is untouched in this case) * -1 if some other error occurred ('dst' is untouched in this case, too) * author: * Paul Vixie, 1996. */ int inet_pton (int af, const char *restrict src, void *restrict dst) { switch (af) { case AF_INET: return (inet_pton4 (src, dst)); # if HAVE_IPV6 case AF_INET6: return (inet_pton6 (src, dst)); # endif default: errno = EAFNOSUPPORT; return (-1); } /* NOTREACHED */ } /* int * inet_pton4(src, dst) * like inet_aton() but without all the hexadecimal, octal (with the * exception of 0) and shorthand. * return: * 1 if 'src' is a valid dotted quad, else 0. * notice: * does not touch 'dst' unless it's returning 1. * author: * Paul Vixie, 1996. */ static int inet_pton4 (const char *restrict src, unsigned char *restrict dst) { int saw_digit, octets, ch; unsigned char tmp[NS_INADDRSZ], *tp; saw_digit = 0; octets = 0; *(tp = tmp) = 0; while ((ch = *src++) != '\0') { if (ch >= '0' && ch <= '9') { unsigned new = *tp * 10 + (ch - '0'); if (saw_digit && *tp == 0) return (0); if (new > 255) return (0); *tp = new; if (!saw_digit) { if (++octets > 4) return (0); saw_digit = 1; } } else if (ch == '.' && saw_digit) { if (octets == 4) return (0); *++tp = 0; saw_digit = 0; } else return (0); } if (octets < 4) return (0); memcpy (dst, tmp, NS_INADDRSZ); return (1); } # if HAVE_IPV6 /* int * inet_pton6(src, dst) * convert presentation level address to network order binary form. * return: * 1 if 'src' is a valid [RFC1884 2.2] address, else 0. * notice: * (1) does not touch 'dst' unless it's returning 1. * (2) :: in a full address is silently ignored. * credit: * inspired by Mark Andrews. * author: * Paul Vixie, 1996. */ static int inet_pton6 (const char *restrict src, unsigned char *restrict dst) { static const char xdigits[] = "0123456789abcdef"; unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; const char *curtok; int ch, saw_xdigit; unsigned val; tp = memset (tmp, '\0', NS_IN6ADDRSZ); endp = tp + NS_IN6ADDRSZ; colonp = NULL; /* Leading :: requires some special handling. */ if (*src == ':') if (*++src != ':') return (0); curtok = src; saw_xdigit = 0; val = 0; while ((ch = c_tolower (*src++)) != '\0') { const char *pch; pch = strchr (xdigits, ch); if (pch != NULL) { val <<= 4; val |= (pch - xdigits); if (val > 0xffff) return (0); saw_xdigit = 1; continue; } if (ch == ':') { curtok = src; if (!saw_xdigit) { if (colonp) return (0); colonp = tp; continue; } else if (*src == '\0') { return (0); } if (tp + NS_INT16SZ > endp) return (0); *tp++ = (u_char) (val >> 8) & 0xff; *tp++ = (u_char) val & 0xff; saw_xdigit = 0; val = 0; continue; } if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && inet_pton4 (curtok, tp) > 0) { tp += NS_INADDRSZ; saw_xdigit = 0; break; /* '\0' was seen by inet_pton4(). */ } return (0); } if (saw_xdigit) { if (tp + NS_INT16SZ > endp) return (0); *tp++ = (u_char) (val >> 8) & 0xff; *tp++ = (u_char) val & 0xff; } if (colonp != NULL) { /* * Since some memmove()'s erroneously fail to handle * overlapping regions, we'll do the shift by hand. */ const int n = tp - colonp; int i; if (tp == endp) return (0); for (i = 1; i <= n; i++) { endp[-i] = colonp[n - i]; colonp[n - i] = 0; } tp = endp; } if (tp != endp) return (0); memcpy (dst, tmp, NS_IN6ADDRSZ); return (1); } # endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/select.c����������������������������������������������������������0000664�0001750�0001750�00000040710�14670377436�020520� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Emulation for select(2) Contributed by Paolo Bonzini. Copyright 2008-2021 Free Software Foundation, Inc. This file is part of gnulib. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <sys/select.h> #if defined _WIN32 && ! defined __CYGWIN__ /* Native Windows. */ #include <alloca.h> #include <assert.h> #include <sys/types.h> #include <errno.h> #include <limits.h> #include <winsock2.h> #include <windows.h> #include <io.h> #include <stdio.h> #include <conio.h> #include <time.h> /* Get the overridden 'struct timeval'. */ #include <sys/time.h> #if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" #else # include <io.h> #endif #undef select /* Don't assume that UNICODE is not defined. */ #undef GetModuleHandle #define GetModuleHandle GetModuleHandleA #undef PeekConsoleInput #define PeekConsoleInput PeekConsoleInputA #undef CreateEvent #define CreateEvent CreateEventA #undef PeekMessage #define PeekMessage PeekMessageA #undef DispatchMessage #define DispatchMessage DispatchMessageA /* Avoid warnings from gcc -Wcast-function-type. */ #define GetProcAddress \ (void *) GetProcAddress struct bitset { unsigned char in[FD_SETSIZE / CHAR_BIT]; unsigned char out[FD_SETSIZE / CHAR_BIT]; }; /* Declare data structures for ntdll functions. */ typedef struct _FILE_PIPE_LOCAL_INFORMATION { ULONG NamedPipeType; ULONG NamedPipeConfiguration; ULONG MaximumInstances; ULONG CurrentInstances; ULONG InboundQuota; ULONG ReadDataAvailable; ULONG OutboundQuota; ULONG WriteQuotaAvailable; ULONG NamedPipeState; ULONG NamedPipeEnd; } FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION; typedef struct _IO_STATUS_BLOCK { union { DWORD Status; PVOID Pointer; } u; ULONG_PTR Information; } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; typedef enum _FILE_INFORMATION_CLASS { FilePipeLocalInformation = 24 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; typedef DWORD (WINAPI *PNtQueryInformationFile) (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS); #ifndef PIPE_BUF #define PIPE_BUF 512 #endif static BOOL IsConsoleHandle (HANDLE h) { DWORD mode; return GetConsoleMode (h, &mode) != 0; } static BOOL IsSocketHandle (HANDLE h) { WSANETWORKEVENTS ev; if (IsConsoleHandle (h)) return FALSE; /* Under Wine, it seems that getsockopt returns 0 for pipes too. WSAEnumNetworkEvents instead distinguishes the two correctly. */ ev.lNetworkEvents = 0xDEADBEEF; WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev); return ev.lNetworkEvents != 0xDEADBEEF; } /* Compute output fd_sets for libc descriptor FD (whose Windows handle is H). */ static int windows_poll_handle (HANDLE h, int fd, struct bitset *rbits, struct bitset *wbits, struct bitset *xbits) { BOOL read, write, except; int i, ret; INPUT_RECORD *irbuffer; DWORD avail, nbuffer; BOOL bRet; IO_STATUS_BLOCK iosb; FILE_PIPE_LOCAL_INFORMATION fpli; static PNtQueryInformationFile NtQueryInformationFile; static BOOL once_only; read = write = except = FALSE; switch (GetFileType (h)) { case FILE_TYPE_DISK: read = TRUE; write = TRUE; break; case FILE_TYPE_PIPE: if (!once_only) { NtQueryInformationFile = (PNtQueryInformationFile) GetProcAddress (GetModuleHandle ("ntdll.dll"), "NtQueryInformationFile"); once_only = TRUE; } if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0) { if (avail) read = TRUE; } else if (GetLastError () == ERROR_BROKEN_PIPE) ; else { /* It was the write-end of the pipe. Check if it is writable. If NtQueryInformationFile fails, optimistically assume the pipe is writable. This could happen on Windows 9x, where NtQueryInformationFile is not available, or if we inherit a pipe that doesn't permit FILE_READ_ATTRIBUTES access on the write end (I think this should not happen since Windows XP SP2; WINE seems fine too). Otherwise, ensure that enough space is available for atomic writes. */ memset (&iosb, 0, sizeof (iosb)); memset (&fpli, 0, sizeof (fpli)); if (!NtQueryInformationFile || NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli), FilePipeLocalInformation) || fpli.WriteQuotaAvailable >= PIPE_BUF || (fpli.OutboundQuota < PIPE_BUF && fpli.WriteQuotaAvailable == fpli.OutboundQuota)) write = TRUE; } break; case FILE_TYPE_CHAR: write = TRUE; if (!(rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1))))) break; ret = WaitForSingleObject (h, 0); if (ret == WAIT_OBJECT_0) { if (!IsConsoleHandle (h)) { read = TRUE; break; } nbuffer = avail = 0; bRet = GetNumberOfConsoleInputEvents (h, &nbuffer); /* Screen buffers handles are filtered earlier. */ assert (bRet); if (nbuffer == 0) { except = TRUE; break; } irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD)); bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail); if (!bRet || avail == 0) { except = TRUE; break; } for (i = 0; i < avail; i++) if (irbuffer[i].EventType == KEY_EVENT) read = TRUE; } break; default: ret = WaitForSingleObject (h, 0); write = TRUE; if (ret == WAIT_OBJECT_0) read = TRUE; break; } ret = 0; if (read && (rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1))))) { rbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1))); ret++; } if (write && (wbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1))))) { wbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1))); ret++; } if (except && (xbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1))))) { xbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1))); ret++; } return ret; } int rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, struct timeval *timeout) #undef timeval { static struct timeval tv0; static HANDLE hEvent; HANDLE h, handle_array[FD_SETSIZE + 2]; fd_set handle_rfds, handle_wfds, handle_xfds; struct bitset rbits, wbits, xbits; unsigned char anyfds_in[FD_SETSIZE / CHAR_BIT]; DWORD ret, wait_timeout, nhandles, nsock, nbuffer; MSG msg; int i, fd, rc; clock_t tend; if (nfds > FD_SETSIZE) nfds = FD_SETSIZE; if (!timeout) wait_timeout = INFINITE; else { wait_timeout = timeout->tv_sec * 1000 + timeout->tv_usec / 1000; /* select is also used as a portable usleep. */ if (!rfds && !wfds && !xfds) { Sleep (wait_timeout); return 0; } } if (!hEvent) hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); handle_array[0] = hEvent; nhandles = 1; nsock = 0; /* Copy descriptors to bitsets. At the same time, eliminate bits in the "wrong" direction for console input buffers and screen buffers, because screen buffers are waitable and they will block until a character is available. */ memset (&rbits, 0, sizeof (rbits)); memset (&wbits, 0, sizeof (wbits)); memset (&xbits, 0, sizeof (xbits)); memset (anyfds_in, 0, sizeof (anyfds_in)); if (rfds) for (i = 0; i < rfds->fd_count; i++) { fd = rfds->fd_array[i]; h = (HANDLE) _get_osfhandle (fd); if (IsConsoleHandle (h) && !GetNumberOfConsoleInputEvents (h, &nbuffer)) continue; rbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); } else rfds = (fd_set *) alloca (sizeof (fd_set)); if (wfds) for (i = 0; i < wfds->fd_count; i++) { fd = wfds->fd_array[i]; h = (HANDLE) _get_osfhandle (fd); if (IsConsoleHandle (h) && GetNumberOfConsoleInputEvents (h, &nbuffer)) continue; wbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); } else wfds = (fd_set *) alloca (sizeof (fd_set)); if (xfds) for (i = 0; i < xfds->fd_count; i++) { fd = xfds->fd_array[i]; xbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); } else xfds = (fd_set *) alloca (sizeof (fd_set)); /* Zero all the fd_sets, including the application's. */ FD_ZERO (rfds); FD_ZERO (wfds); FD_ZERO (xfds); FD_ZERO (&handle_rfds); FD_ZERO (&handle_wfds); FD_ZERO (&handle_xfds); /* Classify handles. Create fd sets for sockets, poll the others. */ for (i = 0; i < nfds; i++) { if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0) continue; h = (HANDLE) _get_osfhandle (i); if (!h) { errno = EBADF; return -1; } if (IsSocketHandle (h)) { int requested = FD_CLOSE; /* See above; socket handles are mapped onto select, but we need to map descriptors to handles. */ if (rbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) { requested |= FD_READ | FD_ACCEPT; FD_SET ((SOCKET) h, rfds); FD_SET ((SOCKET) h, &handle_rfds); } if (wbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) { requested |= FD_WRITE | FD_CONNECT; FD_SET ((SOCKET) h, wfds); FD_SET ((SOCKET) h, &handle_wfds); } if (xbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) { requested |= FD_OOB; FD_SET ((SOCKET) h, xfds); FD_SET ((SOCKET) h, &handle_xfds); } WSAEventSelect ((SOCKET) h, hEvent, requested); nsock++; } else { handle_array[nhandles++] = h; /* Poll now. If we get an event, do not wait below. */ if (wait_timeout != 0 && windows_poll_handle (h, i, &rbits, &wbits, &xbits)) wait_timeout = 0; } } /* Place a sentinel at the end of the array. */ handle_array[nhandles] = NULL; /* When will the waiting period expire? */ if (wait_timeout != INFINITE) tend = clock () + wait_timeout; restart: if (wait_timeout == 0 || nsock == 0) rc = 0; else { /* See if we need to wait in the loop below. If any select is ready, do MsgWaitForMultipleObjects anyway to dispatch messages, but no need to call select again. */ rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0); if (rc == 0) { /* Restore the fd_sets for the other select we do below. */ memcpy (&handle_rfds, rfds, sizeof (fd_set)); memcpy (&handle_wfds, wfds, sizeof (fd_set)); memcpy (&handle_xfds, xfds, sizeof (fd_set)); } else wait_timeout = 0; } /* How much is left to wait? */ if (wait_timeout != INFINITE) { clock_t tnow = clock (); if (tend >= tnow) wait_timeout = tend - tnow; else wait_timeout = 0; } for (;;) { ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE, wait_timeout, QS_ALLINPUT); if (ret == WAIT_OBJECT_0 + nhandles) { /* new input of some other kind */ BOOL bRet; while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0) { TranslateMessage (&msg); DispatchMessage (&msg); } } else break; } /* If we haven't done it yet, check the status of the sockets. */ if (rc == 0 && nsock > 0) rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0); if (nhandles > 1) { /* Count results that are not counted in the return value of select. */ nhandles = 1; for (i = 0; i < nfds; i++) { if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0) continue; h = (HANDLE) _get_osfhandle (i); if (h == handle_array[nhandles]) { /* Not a socket. */ nhandles++; windows_poll_handle (h, i, &rbits, &wbits, &xbits); if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))) || wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))) || xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) rc++; } } if (rc == 0 && (wait_timeout == INFINITE /* If NHANDLES > 1, but no bits are set, it means we've been told incorrectly that some handle was signaled. This happens with anonymous pipes, which always cause MsgWaitForMultipleObjects to exit immediately, but no data is found ready to be read by windows_poll_handle. To avoid a total failure (whereby we return zero and don't wait at all), let's poll in a more busy loop. */ || (wait_timeout != 0 && nhandles > 1))) { /* Sleep 1 millisecond to avoid busy wait and retry with the original fd_sets. */ memcpy (&handle_rfds, rfds, sizeof (fd_set)); memcpy (&handle_wfds, wfds, sizeof (fd_set)); memcpy (&handle_xfds, xfds, sizeof (fd_set)); SleepEx (1, TRUE); goto restart; } if (timeout && wait_timeout == 0 && rc == 0) timeout->tv_sec = timeout->tv_usec = 0; } /* Now fill in the results. */ FD_ZERO (rfds); FD_ZERO (wfds); FD_ZERO (xfds); nhandles = 1; for (i = 0; i < nfds; i++) { if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0) continue; h = (HANDLE) _get_osfhandle (i); if (h != handle_array[nhandles]) { /* Perform handle->descriptor mapping. */ SOCKET s = (SOCKET) h; WSAEventSelect (s, NULL, 0); if (FD_ISSET (s, &handle_rfds)) FD_SET (i, rfds); if (FD_ISSET (s, &handle_wfds)) FD_SET (i, wfds); if (FD_ISSET (s, &handle_xfds)) FD_SET (i, xfds); } else { /* Not a socket. */ nhandles++; if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) FD_SET (i, rfds); if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) FD_SET (i, wfds); if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) FD_SET (i, xfds); } } return rc; } #else /* ! Native Windows. */ #include <stddef.h> /* NULL */ #include <errno.h> #include <unistd.h> #undef select int rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, struct timeval *timeout) { int i; /* FreeBSD 8.2 has a bug: it does not always detect invalid fds. */ if (nfds < 0 || nfds > FD_SETSIZE) { errno = EINVAL; return -1; } for (i = 0; i < nfds; i++) { if (((rfds && FD_ISSET (i, rfds)) || (wfds && FD_ISSET (i, wfds)) || (xfds && FD_ISSET (i, xfds))) && dup2 (i, i) != i) return -1; } /* Interix 3.5 has a bug: it does not support nfds == 0. */ if (nfds == 0) { nfds = 1; rfds = NULL; wfds = NULL; xfds = NULL; } return select (nfds, rfds, wfds, xfds, timeout); } #endif ��������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/asnprintf.c�������������������������������������������������������0000664�0001750�0001750�00000002110�14670377427�021235� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Formatted output to strings. Copyright (C) 1999, 2002, 2006, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include "vasnprintf.h" #include <stdarg.h> char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) { va_list args; char *result; va_start (args, format); result = vasnprintf (resultbuf, lengthp, format, args); va_end (args); return result; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-quotearg-simple.c��������������������������������������������0000664�0001750�0001750�00000037340�14670377436�023341� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of quotearg family of functions. Copyright (C) 2008-2021 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, 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2008. */ #include <config.h> #include "quotearg.h" #include <ctype.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "localcharset.h" #include "macros.h" #include "zerosize-ptr.h" #include "test-quotearg.h" static struct result_groups results_g[] = { /* literal_quoting_style */ { { "", "\0""1\0", 3, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b", LQ RQ, LQ RQ }, { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b", LQ RQ, LQ RQ }, { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b", LQ RQ, LQ RQ } }, /* shell_quoting_style */ { { "''", "\0""1\0", 3, "simple", "' \t\n'\\''\"\033?""?/\\'", "a:b", "'a\\b'", "\"a' b\"", LQ RQ, LQ RQ }, { "''", "1", 1, "simple", "' \t\n'\\''\"\033?""?/\\'", "a:b", "'a\\b'", "\"a' b\"", LQ RQ, LQ RQ }, { "''", "1", 1, "simple", "' \t\n'\\''\"\033?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"", LQ RQ, LQ RQ } }, /* shell_always_quoting_style */ { { "''", "'\0""1\0'", 5, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"", "'" LQ RQ "'", "'" LQ RQ "'" }, { "''", "'1'", 3, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"", "'" LQ RQ "'", "'" LQ RQ "'" }, { "''", "'1'", 3, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"", "'" LQ RQ "'", "'" LQ RQ "'" } }, /* shell_escape_quoting_style */ { { "''", "''$'\\0''1'$'\\0'", 15, "simple", "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "a:b", "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", LQ RQ }, { "''", "''$'\\0''1'$'\\0'", 15, "simple", "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "a:b", "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", LQ RQ }, { "''", "''$'\\0''1'$'\\0'", 15, "simple", "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", LQ RQ } }, /* shell_escape_always_quoting_style */ { { "''", "''$'\\0''1'$'\\0'", 15, "'simple'", "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" }, { "''", "''$'\\0''1'$'\\0'", 15, "'simple'", "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" }, { "''", "''$'\\0''1'$'\\0'", 15, "'simple'", "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" } }, /* c_quoting_style */ { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"", "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" }, { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"", "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" }, { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"", "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" } }, /* c_maybe_quoting_style */ { { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ }, { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ }, { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ } }, /* escape_quoting_style */ { { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a:b", "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ }, { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a:b", "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ }, { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a\\:b", "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ } }, /* locale_quoting_style */ { { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'", "'a:b'", "'a\\\\b'", "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" }, { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'", "'a:b'", "'a\\\\b'", "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" }, { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'", "'a\\:b'", "'a\\\\b'", "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" } }, /* clocale_quoting_style */ { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"", "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" }, { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"", "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" }, { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"", "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" } } }; static struct result_groups flag_results[] = { /* literal_quoting_style and QA_ELIDE_NULL_BYTES */ { { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b", LQ RQ, LQ RQ }, { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b", LQ RQ, LQ RQ }, { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b", LQ RQ, LQ RQ } }, /* c_quoting_style and QA_ELIDE_OUTER_QUOTES */ { { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ }, { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ }, { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ } }, /* c_quoting_style and QA_SPLIT_TRIGRAPHS */ { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"", "\"a\\\\b\"", "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" }, { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"", "\"a\\\\b\"", "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" }, { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"", "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" } } }; static char const *custom_quotes[][2] = { { "", "" }, { "'", "'" }, { "(", ")" }, { ":", " " }, { " ", ":" }, { "# ", "\n" }, { "\"'", "'\"" } }; static struct result_groups custom_results[] = { /* left_quote = right_quote = "" */ { { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a:b", "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ }, { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a:b", "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ }, { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a\\:b", "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ } }, /* left_quote = right_quote = "'" */ { { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'", "'a:b'", "'a\\\\b'", "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" }, { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'", "'a:b'", "'a\\\\b'", "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" }, { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'", "'a\\:b'", "'a\\\\b'", "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" } }, /* left_quote = "(" and right_quote = ")" */ { { "()", "(\\0001\\0)", 9, "(simple)", "( \\t\\n'\"\\033?""?/\\\\)", "(a:b)", "(a\\\\b)", "(a' b)", "(" LQ_ENC RQ_ENC ")", "(" LQ RQ ")" }, { "()", "(\\0001\\0)", 9, "(simple)", "( \\t\\n'\"\\033?""?/\\\\)", "(a:b)", "(a\\\\b)", "(a' b)", "(" LQ_ENC RQ_ENC ")", "(" LQ RQ ")" }, { "()", "(\\0001\\0)", 9, "(simple)", "( \\t\\n'\"\\033?""?/\\\\)", "(a\\:b)", "(a\\\\b)", "(a' b)", "(" LQ_ENC RQ_ENC ")", "(" LQ RQ ")" } }, /* left_quote = ":" and right_quote = " " */ { { ": ", ":\\0001\\0 ", 9, ":simple ", ":\\ \\t\\n'\"\\033?""?/\\\\ ", ":a:b ", ":a\\\\b ", ":a'\\ b ", ":" LQ_ENC RQ_ENC " ", ":" LQ RQ " " }, { ": ", ":\\0001\\0 ", 9, ":simple ", ":\\ \\t\\n'\"\\033?""?/\\\\ ", ":a:b ", ":a\\\\b ", ":a'\\ b ", ":" LQ_ENC RQ_ENC " ", ":" LQ RQ " " }, { ": ", ":\\0001\\0 ", 9, ":simple ", ":\\ \\t\\n'\"\\033?""?/\\\\ ", ":a\\:b ", ":a\\\\b ", ":a'\\ b ", ":" LQ_ENC RQ_ENC " ", ":" LQ RQ " " } }, /* left_quote = " " and right_quote = ":" */ { { " :", " \\0001\\0:", 9, " simple:", " \\t\\n'\"\\033?""?/\\\\:", " a\\:b:", " a\\\\b:", " a' b:", " " LQ_ENC RQ_ENC ":", " " LQ RQ ":" }, { " :", " \\0001\\0:", 9, " simple:", " \\t\\n'\"\\033?""?/\\\\:", " a\\:b:", " a\\\\b:", " a' b:", " " LQ_ENC RQ_ENC ":", " " LQ RQ ":" }, { " :", " \\0001\\0:", 9, " simple:", " \\t\\n'\"\\033?""?/\\\\:", " a\\:b:", " a\\\\b:", " a' b:", " " LQ_ENC RQ_ENC ":", " " LQ RQ ":" } }, /* left_quote = "# " and right_quote = "\n" */ { { "# \n", "# \\0001\\0\n", 10, "# simple\n", "# \\t\\n'\"\\033?""?/\\\\\n", "# a:b\n", "# a\\\\b\n", "# a' b\n", "# " LQ_ENC RQ_ENC "\n", "# " LQ RQ "\n" }, { "# \n", "# \\0001\\0\n", 10, "# simple\n", "# \\t\\n'\"\\033?""?/\\\\\n", "# a:b\n", "# a\\\\b\n", "# a' b\n", "# " LQ_ENC RQ_ENC "\n", "# " LQ RQ "\n" }, { "# \n", "# \\0001\\0\n", 10, "# simple\n", "# \\t\\n'\"\\033?""?/\\\\\n", "# a\\:b\n", "# a\\\\b\n", "# a' b\n", "# " LQ_ENC RQ_ENC "\n", "# " LQ RQ "\n" } }, /* left_quote = "\"'" and right_quote = "'\"" */ { { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"", "\"' \\t\\n\\'\"\\033?""?/\\\\'\"", "\"'a:b'\"", "\"'a\\\\b'\"", "\"'a' b'\"", "\"'" LQ_ENC RQ_ENC "'\"", "\"'" LQ RQ "'\"" }, { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"", "\"' \\t\\n\\'\"\\033?""?/\\\\'\"", "\"'a:b'\"", "\"'a\\\\b'\"", "\"'a' b'\"", "\"'" LQ_ENC RQ_ENC "'\"", "\"'" LQ RQ "'\"" }, { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"", "\"' \\t\\n\\'\"\\033?""?/\\\\'\"", "\"'a\\:b'\"", "\"'a\\\\b'\"", "\"'a' b'\"", "\"'" LQ_ENC RQ_ENC "'\"", "\"'" LQ RQ "'\"" } } }; static char * use_quote_double_quotes (const char *str, size_t *len) { char *p = *len == SIZE_MAX ? quotearg_char (str, '"') : quotearg_char_mem (str, *len, '"'); *len = strlen (p); return p; } int main (int argc _GL_UNUSED, char *argv[]) { int i; bool ascii_only = MB_CUR_MAX == 1 && !isprint ((unsigned char) LQ[0]); /* This part of the program is hard-wired to the C locale since it does not call setlocale. However, according to POSIX, the use of 8-bit bytes in a character context in the C locale gives unspecified results (that is, the C locale charset is allowed to be unibyte with 8-bit bytes rejected [ASCII], unibyte with 8-bit bytes being characters [often ISO-8859-1], or multibyte [often UTF-8]). We assume that the latter two cases will be indistinguishable in this test - that is, the LQ and RQ sequences will pass through unchanged in either type of charset. So when testing for quoting of str7, use the ascii_only flag to decide what to expect for the 8-bit data being quoted. */ ASSERT (!isprint ('\033')); for (i = literal_quoting_style; i <= clocale_quoting_style; i++) { set_quoting_style (NULL, (enum quoting_style) i); if (!(i == locale_quoting_style || i == clocale_quoting_style) || (strcmp (locale_charset (), "ASCII") == 0 || strcmp (locale_charset (), "ANSI_X3.4-1968") == 0)) { compare_strings (use_quotearg_buffer, &results_g[i].group1, ascii_only); compare_strings (use_quotearg, &results_g[i].group2, ascii_only); if (i == c_quoting_style) compare_strings (use_quote_double_quotes, &results_g[i].group2, ascii_only); compare_strings (use_quotearg_colon, &results_g[i].group3, ascii_only); } } set_quoting_style (NULL, literal_quoting_style); ASSERT (set_quoting_flags (NULL, QA_ELIDE_NULL_BYTES) == 0); compare_strings (use_quotearg_buffer, &flag_results[0].group1, ascii_only); compare_strings (use_quotearg, &flag_results[0].group2, ascii_only); compare_strings (use_quotearg_colon, &flag_results[0].group3, ascii_only); set_quoting_style (NULL, c_quoting_style); ASSERT (set_quoting_flags (NULL, QA_ELIDE_OUTER_QUOTES) == QA_ELIDE_NULL_BYTES); compare_strings (use_quotearg_buffer, &flag_results[1].group1, ascii_only); compare_strings (use_quotearg, &flag_results[1].group2, ascii_only); compare_strings (use_quote_double_quotes, &flag_results[1].group2, ascii_only); compare_strings (use_quotearg_colon, &flag_results[1].group3, ascii_only); ASSERT (set_quoting_flags (NULL, QA_SPLIT_TRIGRAPHS) == QA_ELIDE_OUTER_QUOTES); compare_strings (use_quotearg_buffer, &flag_results[2].group1, ascii_only); compare_strings (use_quotearg, &flag_results[2].group2, ascii_only); compare_strings (use_quote_double_quotes, &flag_results[2].group2, ascii_only); compare_strings (use_quotearg_colon, &flag_results[2].group3, ascii_only); ASSERT (set_quoting_flags (NULL, 0) == QA_SPLIT_TRIGRAPHS); for (i = 0; i < sizeof custom_quotes / sizeof *custom_quotes; ++i) { set_custom_quoting (NULL, custom_quotes[i][0], custom_quotes[i][1]); compare_strings (use_quotearg_buffer, &custom_results[i].group1, ascii_only); compare_strings (use_quotearg, &custom_results[i].group2, ascii_only); compare_strings (use_quotearg_colon, &custom_results[i].group3, ascii_only); } { /* Trigger the bug whereby quotearg_buffer would read beyond the NUL that defines the end of the string being quoted. Use an input string whose NUL is the last byte before an unreadable page. */ char *z = zerosize_ptr (); if (z) { size_t q_len = 1024; char *q = malloc (q_len + 1); char buf[10]; memset (q, 'Q', q_len); q[q_len] = 0; /* Z points to the boundary between a readable/writable page and one that is neither readable nor writable. Position our string so its NUL is at the end of the writable one. */ char const *str = "____"; size_t s_len = strlen (str); z -= s_len + 1; memcpy (z, str, s_len + 1); set_custom_quoting (NULL, q, q); /* Whether this actually triggers a SEGV depends on the implementation of memcmp: whether it compares only byte-at- a-time, and from left to right (no SEGV) or some other way. */ size_t n = quotearg_buffer (buf, sizeof buf, z, SIZE_MAX, NULL); ASSERT (n == s_len + 2 * q_len); ASSERT (memcmp (buf, q, sizeof buf) == 0); free (q); } } quotearg_free (); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/c++defs.h���������������������������������������������������������0000664�0001750�0001750�00000035577�14670377430�020471� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* C++ compatible function declaration macros. Copyright (C) 2010-2021 Free Software Foundation, Inc. This program 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 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 Lesser General Public License for more details. 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/>. */ #ifndef _GL_CXXDEFS_H #define _GL_CXXDEFS_H /* Begin/end the GNULIB_NAMESPACE namespace. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { # define _GL_END_NAMESPACE } #else # define _GL_BEGIN_NAMESPACE # define _GL_END_NAMESPACE #endif /* The three most frequent use cases of these macros are: * For providing a substitute for a function that is missing on some platforms, but is declared and works fine on the platforms on which it exists: #if @GNULIB_FOO@ # if !@HAVE_FOO@ _GL_FUNCDECL_SYS (foo, ...); # endif _GL_CXXALIAS_SYS (foo, ...); _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif * For providing a replacement for a function that exists on all platforms, but is broken/insufficient and needs to be replaced on some platforms: #if @GNULIB_FOO@ # if @REPLACE_FOO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef foo # define foo rpl_foo # endif _GL_FUNCDECL_RPL (foo, ...); _GL_CXXALIAS_RPL (foo, ...); # else _GL_CXXALIAS_SYS (foo, ...); # endif _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif * For providing a replacement for a function that exists on some platforms but is broken/insufficient and needs to be replaced on some of them and is additionally either missing or undeclared on some other platforms: #if @GNULIB_FOO@ # if @REPLACE_FOO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef foo # define foo rpl_foo # endif _GL_FUNCDECL_RPL (foo, ...); _GL_CXXALIAS_RPL (foo, ...); # else # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ _GL_FUNCDECL_SYS (foo, ...); # endif _GL_CXXALIAS_SYS (foo, ...); # endif _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif */ /* _GL_EXTERN_C declaration; performs the declaration with C linkage. */ #if defined __cplusplus # define _GL_EXTERN_C extern "C" #else # define _GL_EXTERN_C extern #endif /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); declares a replacement function, named rpl_func, with the given prototype, consisting of return type, parameters, and attributes. Example: _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); */ #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ _GL_EXTERN_C rettype rpl_func parameters_and_attributes /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); declares the system function, named func, with the given prototype, consisting of return type, parameters, and attributes. Example: _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); */ #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ _GL_EXTERN_C rettype func parameters_and_attributes /* _GL_CXXALIAS_RPL (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that redirects to rpl_func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); Wrapping rpl_func in an object with an inline conversion operator avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is actually used in the program. */ #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ \ inline operator type () const \ { \ return ::rpl_func; \ } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_MDA (func, rettype, parameters); is to be used when func is a Microsoft deprecated alias, on native Windows. It declares a C++ alias called GNULIB_NAMESPACE::func that redirects to _func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); */ #define _GL_CXXALIAS_MDA(func,rettype,parameters) \ _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); except that the C function rpl_func may have a slightly different declaration. A cast is used to silence the "invalid conversion" error that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ \ inline operator type () const \ { \ return reinterpret_cast<type>(::rpl_func); \ } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); is like _GL_CXXALIAS_MDA (func, rettype, parameters); except that the C function func may have a slightly different declaration. A cast is used to silence the "invalid conversion" error that would otherwise occur. */ #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) /* _GL_CXXALIAS_SYS (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that redirects to the system provided function func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); Wrapping func in an object with an inline conversion operator avoids a reference to func unless GNULIB_NAMESPACE::func is actually used in the program. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ \ inline operator type () const \ { \ return ::func; \ } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); is like _GL_CXXALIAS_SYS (func, rettype, parameters); except that the C function func may have a slightly different declaration. A cast is used to silence the "invalid conversion" error that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ \ inline operator type () const \ { \ return reinterpret_cast<type>(::func); \ } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); is like _GL_CXXALIAS_SYS (func, rettype, parameters); except that the C function is picked among a set of overloaded functions, namely the one with rettype2 and parameters2. Two consecutive casts are used to silence the "cannot find a match" and "invalid conversion" errors that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE /* The outer cast must be a reinterpret_cast. The inner cast: When the function is defined as a set of overloaded functions, it works as a static_cast<>, choosing the designated variant. When the function is defined as a single variant, it works as a reinterpret_cast<>. The parenthesized cast syntax works both ways. */ # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ namespace GNULIB_NAMESPACE \ { \ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ \ inline operator type () const \ { \ return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIASWARN (func); causes a warning to be emitted when ::func is used but not when GNULIB_NAMESPACE::func is used. func must be defined without overloaded variants. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIASWARN(func) \ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) # define _GL_CXXALIASWARN_1(func,namespace) \ _GL_CXXALIASWARN_2 (func, namespace) /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, we enable the warning only when not optimizing. */ # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) # define _GL_CXXALIASWARN_2(func,namespace) \ _GL_WARN_ON_USE (func, \ "The symbol ::" #func " refers to the system function. " \ "Use " #namespace "::" #func " instead.") # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING # define _GL_CXXALIASWARN_2(func,namespace) \ extern __typeof__ (func) func # else # define _GL_CXXALIASWARN_2(func,namespace) \ _GL_EXTERN_C int _gl_cxxalias_dummy # endif #else # define _GL_CXXALIASWARN(func) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); causes a warning to be emitted when the given overloaded variant of ::func is used but not when GNULIB_NAMESPACE::func is used. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ GNULIB_NAMESPACE) # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, we enable the warning only when not optimizing. */ # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ "The symbol ::" #func " refers to the system function. " \ "Use " #namespace "::" #func " instead.") # else # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ _GL_EXTERN_C int _gl_cxxalias_dummy # endif #else # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif #endif /* _GL_CXXDEFS_H */ ���������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wcrtomb.sh���������������������������������������������������0000775�0001750�0001750�00000001662�14670377437�022072� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test in an ISO-8859-1 or ISO-8859-15 locale. : ${LOCALE_FR=fr_FR} if test $LOCALE_FR != none; then LC_ALL=$LOCALE_FR \ ${CHECKER} ./test-wcrtomb${EXEEXT} 1 \ || exit 1 fi # Test whether a specific UTF-8 locale is installed. : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR_UTF8 != none; then LC_ALL=$LOCALE_FR_UTF8 \ ${CHECKER} ./test-wcrtomb${EXEEXT} 2 \ || exit 1 fi # Test whether a specific EUC-JP locale is installed. : ${LOCALE_JA=ja_JP} if test $LOCALE_JA != none; then LC_ALL=$LOCALE_JA \ ${CHECKER} ./test-wcrtomb${EXEEXT} 3 \ || exit 1 fi # Test whether a specific GB18030 locale is installed. : ${LOCALE_ZH_CN=zh_CN.GB18030} if test $LOCALE_ZH_CN != none; then LC_ALL=$LOCALE_ZH_CN \ ${CHECKER} ./test-wcrtomb${EXEEXT} 4 \ || exit 1 fi # Test in the POSIX locale. LC_ALL=C ${CHECKER} ./test-wcrtomb${EXEEXT} 5 || exit 1 LC_ALL=POSIX ${CHECKER} ./test-wcrtomb${EXEEXT} 5 || exit 1 exit 0 ������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-langinfo.c���������������������������������������������������0000664�0001750�0001750�00000003572�14670377436�022020� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <langinfo.h> substitute. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ #include <config.h> #include <langinfo.h> /* Check that all the nl_item values are defined. */ int items[] = { /* nl_langinfo items of the LC_CTYPE category */ CODESET, /* nl_langinfo items of the LC_NUMERIC category */ RADIXCHAR, THOUSEP, /* nl_langinfo items of the LC_TIME category */ D_T_FMT, D_FMT, T_FMT, T_FMT_AMPM, AM_STR, PM_STR, DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7, ABDAY_1, ABDAY_2, ABDAY_3, ABDAY_4, ABDAY_5, ABDAY_6, ABDAY_7, MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7, MON_8, MON_9, MON_10, MON_11, MON_12, ABMON_1, ABMON_2, ABMON_3, ABMON_4, ABMON_5, ABMON_6, ABMON_7, ABMON_8, ABMON_9, ABMON_10, ABMON_11, ABMON_12, ERA, ERA_D_FMT, ERA_D_T_FMT, ERA_T_FMT, ALT_DIGITS, /* nl_langinfo items of the LC_MONETARY category */ CRNCYSTR, /* nl_langinfo items of the LC_MESSAGES category */ YESEXPR, NOEXPR }; int main (void) { return 0; } ��������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/fpucw.h�����������������������������������������������������������0000664�0001750�0001750�00000011365�14670377427�020376� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Manipulating the FPU control word. -*- coding: utf-8 -*- Copyright (C) 2007-2021 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _FPUCW_H #define _FPUCW_H /* The i386 floating point hardware (the 387 compatible FPU, not the modern SSE/SSE2 hardware) has a controllable rounding precision. It is specified through the 'PC' bits in the FPU control word ('fctrl' register). (See the GNU libc i386 <fpu_control.h> header for details.) On some platforms, such as Linux or Solaris, the default precision setting is set to "extended precision". This means that 'long double' instructions operate correctly, but 'double' computations often produce slightly different results as on strictly IEEE 754 conforming systems. On some platforms, such as NetBSD, the default precision is set to "double precision". This means that 'long double' instructions will operate only as 'double', i.e. lead to wrong results. Similarly on FreeBSD 6.4, at least for the division of 'long double' numbers. The FPU control word is under control of the application, i.e. it is not required to be set either way by the ABI. (In fact, the i386 ABI https://www.linux-mips.org/pub/linux/mips/doc/ABI/abi386-4.pdf page 3-12 = page 38 is not clear about it. But in any case, gcc treats the control word like a "preserved" register: it emits code that assumes that the control word is preserved across calls, and it restores the control word at the end of functions that modify it.) See Vincent Lefèvre's page https://www.vinc17.net/research/extended.en.html for a good explanation. See https://web.archive.org/web/20060905133417/http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html some argumentation which setting should be the default. */ /* This header file provides the following facilities: fpucw_t integral type holding the value of 'fctrl' FPU_PC_MASK bit mask denoting the precision control FPU_PC_DOUBLE precision control for 53 bits mantissa FPU_PC_EXTENDED precision control for 64 bits mantissa GET_FPUCW () yields the current FPU control word SET_FPUCW (word) sets the FPU control word DECL_LONG_DOUBLE_ROUNDING variable declaration for BEGIN/END_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING () starts a sequence of instructions with 'long double' safe operation precision END_LONG_DOUBLE_ROUNDING () ends a sequence of instructions with 'long double' safe operation precision */ /* Inline assembler like this works only with GNU C and clang. */ #if (defined __i386__ || defined __x86_64__) && (defined __GNUC__ || defined __clang__) typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */ # define FPU_PC_MASK 0x0300 # define FPU_PC_DOUBLE 0x200 /* glibc calls this _FPU_DOUBLE */ # define FPU_PC_EXTENDED 0x300 /* glibc calls this _FPU_EXTENDED */ # define GET_FPUCW() __extension__ \ ({ fpucw_t _cw; \ __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw)); \ _cw; \ }) # define SET_FPUCW(word) __extension__ \ (void)({ fpucw_t _ncw = (word); \ __asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw)); \ }) # define DECL_LONG_DOUBLE_ROUNDING \ fpucw_t oldcw; # define BEGIN_LONG_DOUBLE_ROUNDING() \ (void)(oldcw = GET_FPUCW (), \ SET_FPUCW ((oldcw & ~FPU_PC_MASK) | FPU_PC_EXTENDED)) # define END_LONG_DOUBLE_ROUNDING() \ SET_FPUCW (oldcw) #else typedef unsigned int fpucw_t; # define FPU_PC_MASK 0 # define FPU_PC_DOUBLE 0 # define FPU_PC_EXTENDED 0 # define GET_FPUCW() 0 # define SET_FPUCW(word) (void)(word) # define DECL_LONG_DOUBLE_ROUNDING # define BEGIN_LONG_DOUBLE_ROUNDING() # define END_LONG_DOUBLE_ROUNDING() #endif #endif /* _FPUCW_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fstatat.c����������������������������������������������������0000664�0001750�0001750�00000005223�14670377436�021664� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Tests of fstatat. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <sys/stat.h> #include "signature.h" SIGNATURE_CHECK (fstatat, int, (int, char const *, struct stat *, int)); #include <fcntl.h> #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "openat.h" #include "same-inode.h" #include "ignore-value.h" #include "macros.h" #ifndef BASE # define BASE "test-fstatat.t" #endif #include "test-lstat.h" #include "test-stat.h" static int dfd = AT_FDCWD; /* Wrapper around fstatat to test stat behavior. */ static int do_stat (char const *name, struct stat *st) { #ifdef TEST_STATAT return statat (dfd, name, st); #else return fstatat (dfd, name, st, 0); #endif } /* Wrapper around fstatat to test lstat behavior. */ static int do_lstat (char const *name, struct stat *st) { #ifdef TEST_STATAT return lstatat (dfd, name, st); #else return fstatat (dfd, name, st, AT_SYMLINK_NOFOLLOW); #endif } int main (int argc _GL_UNUSED, char *argv[]) { int result; /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); /* Test behaviour for invalid file descriptors. */ { struct stat statbuf; errno = 0; ASSERT (fstatat (-1, "foo", &statbuf, 0) == -1); ASSERT (errno == EBADF); } { struct stat statbuf; close (99); errno = 0; ASSERT (fstatat (99, "foo", &statbuf, 0) == -1); ASSERT (errno == EBADF); } result = test_stat_func (do_stat, false); ASSERT (test_lstat_func (do_lstat, false) == result); dfd = open (".", O_RDONLY); ASSERT (0 <= dfd); ASSERT (test_stat_func (do_stat, false) == result); ASSERT (test_lstat_func (do_lstat, false) == result); ASSERT (close (dfd) == 0); /* FIXME - add additional tests of dfd not at current directory. */ if (result == 77) fputs ("skipping test: symlinks not supported on this file system\n", stderr); return result; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/anytostr.c��������������������������������������������������������0000664�0001750�0001750�00000003162�14670377436�021124� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* anytostr.c -- convert integers to printable strings Copyright (C) 2001, 2006, 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paul Eggert */ /* Tell gcc not to warn about the (i < 0) test, below. */ #if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ # pragma GCC diagnostic ignored "-Wtype-limits" #elif defined __clang__ # pragma clang diagnostic ignored "-Wtautological-compare" #endif #include <config.h> #include "inttostr.h" /* Convert I to a printable string in BUF, which must be at least INT_BUFSIZE_BOUND (INTTYPE) bytes long. Return the address of the printable string, which need not start at BUF. */ _GL_ATTRIBUTE_NODISCARD char * anytostr (inttype i, char *buf) { char *p = buf + INT_STRLEN_BOUND (inttype); *p = 0; if (i < 0) { do *--p = '0' - i % 10; while ((i /= 10) != 0); *--p = '-'; } else { do *--p = '0' + i % 10; while ((i /= 10) != 0); } return p; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-ftruncate.c��������������������������������������������������0000664�0001750�0001750�00000003017�14670377436�022210� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test truncating a file. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (ftruncate, int, (int, off_t)); #include <errno.h> #include <fcntl.h> #include "macros.h" int main (int argc, char *argv[]) { const char *filename = argv[1]; /* Test behaviour for invalid file descriptors. */ { errno = 0; ASSERT (ftruncate (-1, 0) == -1); ASSERT (errno == EBADF); } { close (99); errno = 0; ASSERT (ftruncate (99, 0) == -1); ASSERT (errno == EBADF); } /* Test behaviour for read-only file descriptors. */ { int fd = open (filename, O_RDONLY); ASSERT (fd >= 0); errno = 0; ASSERT (ftruncate (fd, 0) == -1); ASSERT (errno == EBADF || errno == EINVAL || errno == EACCES /* seen on mingw */ ); close (fd); } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-strtoimax.c��������������������������������������������������0000664�0001750�0001750�00000010252�14670377436�022246� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <inttypes.h> #include "signature.h" #ifndef strtoimax SIGNATURE_CHECK (strtoimax, intmax_t, (const char *, char **, int)); #endif #include <errno.h> #include "macros.h" int main (void) { /* Subject sequence empty or invalid. */ { const char input[] = ""; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " "; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " +"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } { const char input[] = " -"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input); ASSERT (errno == 0 || errno == EINVAL); } /* Simple integer values. */ { const char input[] = "0"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 1); ASSERT (errno == 0); } { const char input[] = "+0"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = "-0"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 0); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = "23"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 2); ASSERT (errno == 0); } { const char input[] = " 23"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } { const char input[] = "+23"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } { const char input[] = "-23"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == -23); ASSERT (ptr == input + 3); ASSERT (errno == 0); } /* Large integer values. */ { const char input[] = "2147483647"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == 2147483647); ASSERT (ptr == input + 10); ASSERT (errno == 0); } { const char input[] = "-2147483648"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == -2147483647 - 1); ASSERT (ptr == input + 11); ASSERT (errno == 0); } if (sizeof (intmax_t) > sizeof (int)) { const char input[] = "4294967295"; char *ptr; intmax_t result; errno = 0; result = strtoimax (input, &ptr, 10); ASSERT (result == (intmax_t) 65535 * (intmax_t) 65537); ASSERT (ptr == input + 10); ASSERT (errno == 0); } return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sigsegv-catch-stackoverflow2.c�������������������������������0000664�0001750�0001750�00000012304�14670377436�025714� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test that stack overflow and SIGSEGV are correctly distinguished. Copyright (C) 2002-2021 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 2 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible and Eric Blake. */ #include <config.h> /* Specification. */ #include "sigsegv.h" #include <stdint.h> #include <stdio.h> #include <limits.h> #if HAVE_STACK_OVERFLOW_RECOVERY && HAVE_SIGSEGV_RECOVERY # if defined _WIN32 && !defined __CYGWIN__ /* Windows doesn't have sigset_t. */ typedef int sigset_t; # define sigemptyset(set) # define sigprocmask(how,set,oldset) # endif # include "mmap-anon-util.h" # include <stddef.h> /* needed for NULL on SunOS4 */ # include <stdlib.h> /* for abort, exit */ # include <signal.h> # include <setjmp.h> # if HAVE_SETRLIMIT # include <sys/types.h> # include <sys/time.h> # include <sys/resource.h> # endif # include "altstack-util.h" static jmp_buf mainloop; static sigset_t mainsigset; static volatile int pass = 0; static uintptr_t page; static volatile int *null_pointer_to_volatile_int /* = NULL */; static void stackoverflow_handler_continuation (void *arg1, void *arg2, void *arg3) { int arg = (int) (long) arg1; longjmp (mainloop, arg); } static void stackoverflow_handler (int emergency, stackoverflow_context_t scp) { pass++; if (pass <= 2) printf ("Stack overflow %d caught.\n", pass); else { printf ("Segmentation violation misdetected as stack overflow.\n"); exit (1); } sigprocmask (SIG_SETMASK, &mainsigset, NULL); sigsegv_leave_handler (stackoverflow_handler_continuation, (void *) (long) (emergency ? -1 : pass), NULL, NULL); } static int sigsegv_handler (void *address, int emergency) { /* This test is necessary to distinguish stack overflow and SIGSEGV. */ if (!emergency) return 0; pass++; if (pass <= 2) { printf ("Stack overflow %d missed.\n", pass); exit (1); } else printf ("Segmentation violation correctly detected.\n"); sigprocmask (SIG_SETMASK, &mainsigset, NULL); return sigsegv_leave_handler (stackoverflow_handler_continuation, (void *) (long) pass, NULL, NULL); } static volatile int * recurse_1 (int n, volatile int *p) { if (n < INT_MAX) *recurse_1 (n + 1, p) += n; return p; } static int recurse (volatile int n) { return *recurse_1 (n, &n); } int main () { int prot_unwritable; void *p; sigset_t emptyset; # if HAVE_SETRLIMIT && defined RLIMIT_STACK /* Before starting the endless recursion, try to be friendly to the user's machine. On some Linux 2.2.x systems, there is no stack limit for user processes at all. We don't want to kill such systems. */ struct rlimit rl; rl.rlim_cur = rl.rlim_max = 0x100000; /* 1 MB */ setrlimit (RLIMIT_STACK, &rl); # endif /* Prepare the storage for the alternate stack. */ prepare_alternate_stack (); /* Install the stack overflow handler. */ if (stackoverflow_install_handler (&stackoverflow_handler, mystack, MYSTACK_SIZE) < 0) exit (2); /* Preparations. */ # if !HAVE_MAP_ANONYMOUS zero_fd = open ("/dev/zero", O_RDONLY, 0644); # endif # if defined __linux__ && defined __sparc__ /* On Linux 2.6.26/SPARC64, PROT_READ has the same effect as PROT_READ | PROT_WRITE. */ prot_unwritable = PROT_NONE; # else prot_unwritable = PROT_READ; # endif /* Setup some mmaped memory. */ p = mmap_zeromap ((void *) 0x12340000, 0x4000); if (p == (void *)(-1)) { fprintf (stderr, "mmap_zeromap failed.\n"); exit (2); } page = (uintptr_t) p; /* Make it read-only. */ if (mprotect ((void *) page, 0x4000, prot_unwritable) < 0) { fprintf (stderr, "mprotect failed.\n"); exit (2); } /* Install the SIGSEGV handler. */ if (sigsegv_install_handler (&sigsegv_handler) < 0) exit (2); /* Save the current signal mask. */ sigemptyset (&emptyset); sigprocmask (SIG_BLOCK, &emptyset, &mainsigset); /* Provoke two stack overflows in a row. */ switch (setjmp (mainloop)) { case -1: printf ("emergency exit\n"); exit (1); case 0: case 1: printf ("Starting recursion pass %d.\n", pass + 1); recurse (0); printf ("no endless recursion?!\n"); exit (1); case 2: *(volatile int *) (page + 0x678) = 42; break; case 3: *null_pointer_to_volatile_int = 42; break; case 4: break; default: abort (); } /* Validate that the alternate stack did not overflow. */ check_alternate_stack_no_overflow (); printf ("Test passed.\n"); exit (0); } #else int main () { return 77; } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-iswdigit.c���������������������������������������������������0000664�0001750�0001750�00000017056�14670377436�022050� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of iswdigit() function. Copyright (C) 2020-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <wctype.h> #include "signature.h" SIGNATURE_CHECK (iswdigit, int, (wint_t)); #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> #include "macros.h" /* Returns the value of iswdigit for the multibyte character s[0..n-1]. */ static int for_character (const char *s, size_t n) { mbstate_t state; wchar_t wc; size_t ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, s, n, &state); if (ret == n) return iswdigit (wc); else return 0; } int main (int argc, char *argv[]) { int is; char buf[4]; /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; /* Test WEOF. */ is = iswdigit (WEOF); ASSERT (is == 0); /* Test single-byte characters. ISO C 99 sections 7.25.2.1.5 and 5.2.1 specify that the decimal digits include only the ASCII 0 ... 9 characters. */ { int c; for (c = 0; c < 0x100; c++) switch (c) { case '\t': case '\v': case '\f': 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 '~': /* c is in the ISO C "basic character set". */ buf[0] = (unsigned char) c; is = for_character (buf, 1); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': ASSERT (is != 0); break; default: ASSERT (is == 0); break; } break; } } if (argc > 1) switch (argv[1][0]) { case '0': /* C locale; tested above. */ return 0; case '1': /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ { /* U+00B2 SUPERSCRIPT TWO */ is = for_character ("\262", 1); ASSERT (is == 0); /* U+00B3 SUPERSCRIPT THREE */ is = for_character ("\263", 1); ASSERT (is == 0); /* U+00B9 SUPERSCRIPT ONE */ is = for_character ("\271", 1); ASSERT (is == 0); } return 0; case '2': /* Locale encoding is EUC-JP. */ { /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\243\261", 2); ASSERT (is == 0); } return 0; case '3': /* Locale encoding is UTF-8. */ { /* U+00B2 SUPERSCRIPT TWO */ is = for_character ("\302\262", 2); ASSERT (is == 0); /* U+00B3 SUPERSCRIPT THREE */ is = for_character ("\302\263", 2); ASSERT (is == 0); /* U+00B9 SUPERSCRIPT ONE */ is = for_character ("\302\271", 2); ASSERT (is == 0); /* U+0663 ARABIC-INDIC DIGIT THREE */ is = for_character ("\331\243", 2); ASSERT (is == 0); /* U+2070 SUPERSCRIPT ZERO */ is = for_character ("\342\201\260", 3); ASSERT (is == 0); /* U+2079 SUPERSCRIPT NINE */ is = for_character ("\342\201\271", 3); ASSERT (is == 0); /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\357\274\221", 3); ASSERT (is == 0); /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */ is = for_character ("\360\235\237\221", 4); ASSERT (is == 0); /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */ is = for_character ("\360\235\237\233", 4); ASSERT (is == 0); /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */ is = for_character ("\360\235\237\245", 4); ASSERT (is == 0); /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */ is = for_character ("\360\235\237\257", 4); ASSERT (is == 0); /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */ is = for_character ("\360\235\237\271", 4); ASSERT (is == 0); /* U+E0033 TAG DIGIT THREE */ is = for_character ("\363\240\200\263", 4); ASSERT (is == 0); } return 0; case '4': /* Locale encoding is GB18030. */ { /* U+00B2 SUPERSCRIPT TWO */ is = for_character ("\201\060\205\065", 4); ASSERT (is == 0); /* U+00B3 SUPERSCRIPT THREE */ is = for_character ("\201\060\205\066", 4); ASSERT (is == 0); /* U+00B9 SUPERSCRIPT ONE */ is = for_character ("\201\060\206\061", 4); ASSERT (is == 0); /* U+0663 ARABIC-INDIC DIGIT THREE */ is = for_character ("\201\061\211\071", 4); ASSERT (is == 0); /* U+2070 SUPERSCRIPT ZERO */ is = for_character ("\201\066\255\062", 4); ASSERT (is == 0); /* U+2079 SUPERSCRIPT NINE */ is = for_character ("\201\066\256\061", 4); ASSERT (is == 0); /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\243\261", 2); ASSERT (is == 0); /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */ is = for_character ("\224\063\353\071", 4); ASSERT (is == 0); /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */ is = for_character ("\224\063\354\071", 4); ASSERT (is == 0); /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */ is = for_character ("\224\063\355\071", 4); ASSERT (is == 0); /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */ is = for_character ("\224\063\356\071", 4); ASSERT (is == 0); /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */ is = for_character ("\224\063\357\071", 4); ASSERT (is == 0); /* U+E0033 TAG DIGIT THREE */ is = for_character ("\323\066\232\071", 4); ASSERT (is == 0); } return 0; } return 1; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-dfa-invalid-merge.sh�����������������������������������������0000775�0001750�0001750�00000002113�14670377431�023652� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # The DFA matcher would wrongly convert a regular expression like # a+a+a to a+a, thus possibly reporting a false match. # Introduced in v0.1-2111-g4299106ce # Copyright 2020-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src # Add "." to PATH for the use of test-dfa-match-aux. path_prepend_ . fail=0 LC_ALL=C returns_ 0 ${CHECKER} test-dfa-match-aux 'x+x+x+' xx > out 2>&1 compare /dev/null out || fail=1 Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-select-in.sh�������������������������������������������������0000775�0001750�0001750�00000001735�14670377436�022300� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test select() on file descriptors opened for reading. # This test is known to fail on Solaris 2.6 and older, due to its handling # of /dev/null. tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 tmpfiles="$tmpfiles t-select-in.tmp" # Regular files. rm -f t-select-in.tmp ${CHECKER} ./test-select-fd${EXEEXT} r 0 t-select-in.tmp < ./test-select-fd${EXEEXT} test `cat t-select-in.tmp` = "1" || exit 1 # Pipes. rm -f t-select-in.tmp { sleep 1; echo abc; } | \ { ${CHECKER} ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; cat > /dev/null; } test `cat t-select-in.tmp` = "0" || exit 1 rm -f t-select-in.tmp echo abc | { sleep 1; ${CHECKER} ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; } test `cat t-select-in.tmp` = "1" || exit 1 # Special files. # This part of the test is known to fail on Solaris 2.6 and older. rm -f t-select-in.tmp ${CHECKER} ./test-select-fd${EXEEXT} r 0 t-select-in.tmp < /dev/null test `cat t-select-in.tmp` = "1" || exit 1 rm -fr $tmpfiles exit 0 �����������������������������������kbuild-3608/src/grep/gnulib-tests/localename.h������������������������������������������������������0000664�0001750�0001750�00000010766�14670377430�021350� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Determine name of the currently selected locale. Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. This program 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. 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 Lesser General Public License for more details. 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/>. */ #ifndef _GL_LOCALENAME_H #define _GL_LOCALENAME_H #ifdef __cplusplus extern "C" { #endif /* Determine the current locale's name. It considers both the POSIX notion of locale name (see functions gl_locale_name_thread and gl_locale_name_posix) and the system notion of locale name (see function gl_locale_name_default). CATEGORY is a locale category abbreviation, as defined in <locale.h>, but not LC_ALL. E.g. LC_MESSAGES. CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES". Return the locale category's name, canonicalized into XPG syntax language[_territory][.codeset][@modifier] The codeset part in the result is not reliable; the locale_charset() should be used for codeset information instead. The result must not be freed; it is statically allocated. */ extern const char * gl_locale_name (int category, const char *categoryname); /* Determine the current per-thread locale's name, as specified by uselocale() calls. CATEGORY is a locale category abbreviation, as defined in <locale.h>, but not LC_ALL. E.g. LC_MESSAGES. CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES". Return the locale category's name, canonicalized into XPG syntax language[_territory][.codeset][@modifier] or NULL if no locale has been specified for the current thread. The codeset part in the result is not reliable; the locale_charset() should be used for codeset information instead. The result must not be freed; it is statically allocated. */ extern const char * gl_locale_name_thread (int category, const char *categoryname); /* Determine the thread-independent current locale's name, as specified by setlocale() calls or by environment variables. CATEGORY is a locale category abbreviation, as defined in <locale.h>, but not LC_ALL. E.g. LC_MESSAGES. CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES". Return the locale category's name, canonicalized into XPG syntax language[_territory][.codeset][@modifier] or NULL if no locale has been specified to setlocale() or by environment variables. The codeset part in the result is not reliable; the locale_charset() should be used for codeset information instead. The result must not be freed; it is statically allocated. */ extern const char * gl_locale_name_posix (int category, const char *categoryname); /* Determine the default locale's name, as specified by environment variables. Return the locale category's name, or NULL if no locale has been specified by environment variables. The result must not be freed; it is statically allocated. */ extern const char * gl_locale_name_environ (int category, const char *categoryname); /* Determine the default locale's name. This is the current locale's name, if not specified by uselocale() calls, by setlocale() calls, or by environment variables. This locale name is usually determined by systems settings that the user can manipulate through a GUI. Quoting POSIX:2001: "All implementations shall define a locale as the default locale, to be invoked when no environment variables are set, or set to the empty string. This default locale can be the C locale or any other implementation-defined locale. Some implementations may provide facilities for local installation administrators to set the default locale, customizing it for each location. IEEE Std 1003.1-2001 does not require such a facility." The result must not be freed; it is statically allocated. */ extern const char * gl_locale_name_default (void) #if !(HAVE_CFPREFERENCESCOPYAPPVALUE || defined _WIN32 || defined __CYGWIN__) _GL_ATTRIBUTE_CONST #endif ; #ifdef __cplusplus } #endif #endif /* _GL_LOCALENAME_H */ ����������kbuild-3608/src/grep/gnulib-tests/ftruncate.c�������������������������������������������������������0000664�0001750�0001750�00000011740�14670377436�021235� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ftruncate emulations for native Windows. Copyright (C) 1992-2021 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, 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 <https://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include <unistd.h> #if HAVE__CHSIZE /* A native Windows platform. */ # include <errno.h> # if _GL_WINDOWS_64_BIT_OFF_T /* Large File Support: off_t is 64-bit, but _chsize() takes only a 32-bit argument. So, define a 64-bit safe SetFileSize function ourselves. */ /* Ensure that <windows.h> declares GetFileSizeEx. */ # if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN2K) # undef _WIN32_WINNT # define _WIN32_WINNT _WIN32_WINNT_WIN2K # endif /* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include <io.h> # endif static BOOL SetFileSize (HANDLE h, LONGLONG size) { LARGE_INTEGER old_size; if (!GetFileSizeEx (h, &old_size)) return FALSE; if (size != old_size.QuadPart) { /* Duplicate the handle, so we are free to modify its file position. */ HANDLE curr_process = GetCurrentProcess (); HANDLE tmph; if (!DuplicateHandle (curr_process, /* SourceProcessHandle */ h, /* SourceHandle */ curr_process, /* TargetProcessHandle */ (PHANDLE) &tmph, /* TargetHandle */ (DWORD) 0, /* DesiredAccess */ FALSE, /* InheritHandle */ DUPLICATE_SAME_ACCESS)) /* Options */ return FALSE; if (size < old_size.QuadPart) { /* Reduce the size. */ LONG size_hi = (LONG) (size >> 32); if (SetFilePointer (tmph, (LONG) size, &size_hi, FILE_BEGIN) == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { CloseHandle (tmph); return FALSE; } if (!SetEndOfFile (tmph)) { CloseHandle (tmph); return FALSE; } } else { /* Increase the size by adding zero bytes at the end. */ static char zero_bytes[1024]; LONG pos_hi = 0; LONG pos_lo = SetFilePointer (tmph, (LONG) 0, &pos_hi, FILE_END); LONGLONG pos; if (pos_lo == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { CloseHandle (tmph); return FALSE; } pos = ((LONGLONG) pos_hi << 32) | (ULONGLONG) (ULONG) pos_lo; while (pos < size) { DWORD written; LONGLONG count = size - pos; if (count > sizeof (zero_bytes)) count = sizeof (zero_bytes); if (!WriteFile (tmph, zero_bytes, (DWORD) count, &written, NULL) || written == 0) { CloseHandle (tmph); return FALSE; } pos += (ULONGLONG) (ULONG) written; } } /* Close the handle. */ CloseHandle (tmph); } return TRUE; } int ftruncate (int fd, off_t length) { HANDLE handle = (HANDLE) _get_osfhandle (fd); if (handle == INVALID_HANDLE_VALUE) { errno = EBADF; return -1; } if (length < 0) { errno = EINVAL; return -1; } if (!SetFileSize (handle, length)) { switch (GetLastError ()) { case ERROR_ACCESS_DENIED: errno = EACCES; break; case ERROR_HANDLE_DISK_FULL: case ERROR_DISK_FULL: case ERROR_DISK_TOO_FRAGMENTED: errno = ENOSPC; break; default: errno = EIO; break; } return -1; } return 0; } # else # include <io.h> # if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" static int chsize_nothrow (int fd, long length) { int result; TRY_MSVC_INVAL { result = _chsize (fd, length); } CATCH_MSVC_INVAL { result = -1; errno = EBADF; } DONE_MSVC_INVAL; return result; } # else # define chsize_nothrow _chsize # endif int ftruncate (int fd, off_t length) { return chsize_nothrow (fd, length); } # endif #endif ��������������������������������kbuild-3608/src/grep/gnulib-tests/test-pthread.c����������������������������������������������������0000664�0001750�0001750�00000004546�14670377436�021654� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <pthread.h> substitute. Copyright (C) 2019-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2019. */ #include <config.h> #include <pthread.h> #include "verify.h" /* Check that the types are all defined. */ pthread_t t1; pthread_attr_t t2; pthread_once_t t3 = PTHREAD_ONCE_INIT; pthread_mutex_t t4 = PTHREAD_MUTEX_INITIALIZER; pthread_mutexattr_t t5; pthread_rwlock_t t6 = PTHREAD_RWLOCK_INITIALIZER; pthread_rwlockattr_t t7; pthread_cond_t t8 = PTHREAD_COND_INITIALIZER; pthread_condattr_t t9; pthread_key_t t10; pthread_spinlock_t t11; #ifdef TODO /* Not implemented in gnulib yet */ pthread_barrier_t t12; pthread_barrierattr_t t13; #endif /* Check that the various macros are defined. */ /* Constants for pthread_attr_setdetachstate(). */ int ds[] = { PTHREAD_CREATE_JOINABLE, PTHREAD_CREATE_DETACHED }; /* Constants for pthread_exit(). */ void *canceled = PTHREAD_CANCELED; /* Constants for pthread_mutexattr_settype(). */ int mt[] = { PTHREAD_MUTEX_DEFAULT, PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK }; #ifdef TODO /* Not implemented in gnulib yet */ /* Constants for pthread_mutexattr_setrobust(). */ int mr[] = { PTHREAD_MUTEX_ROBUST, PTHREAD_MUTEX_STALLED }; /* Constants for pthread_barrierattr_setpshared(). */ int bp[] = { PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE }; /* Constants for pthread_barrier_wait(). */ int bw[] = { PTHREAD_BARRIER_SERIAL_THREAD }; /* Constants for pthread_setcancelstate(). */ int cs[] = { PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DISABLE }; /* Constants for pthread_setcanceltype(). */ int ct[] = { PTHREAD_CANCEL_DEFERRED, PTHREAD_CANCEL_ASYNCHRONOUS }; #endif int main (void) { return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-thread_create.c����������������������������������������������0000664�0001750�0001750�00000004134�14670377436�023010� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of gl_thread_create () macro. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2011. */ #include <config.h> #include "glthread/thread.h" #include <stdio.h> #include <string.h> #include "macros.h" static gl_thread_t main_thread_before; static gl_thread_t main_thread_after; static gl_thread_t worker_thread; static int dummy; static volatile int work_done; static void * worker_thread_func (void *arg) { work_done = 1; return &dummy; } int main () { main_thread_before = gl_thread_self (); if (glthread_create (&worker_thread, worker_thread_func, NULL) == 0) { void *ret; /* Check that gl_thread_self () has the same value before than after the first call to gl_thread_create (). */ main_thread_after = gl_thread_self (); ASSERT (memcmp (&main_thread_before, &main_thread_after, sizeof (gl_thread_t)) == 0); gl_thread_join (worker_thread, &ret); /* Check the return value of the thread. */ ASSERT (ret == &dummy); /* Check that worker_thread_func () has finished executing. */ ASSERT (work_done); return 0; } else { #if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS fputs ("glthread_create failed\n", stderr); return 1; #else fputs ("Skipping test: multithreading not enabled\n", stderr); return 77; #endif } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-mbsrtowcs2.sh������������������������������������������������0000775�0001750�0001750�00000000605�14670377436�022515� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test whether a specific UTF-8 locale is installed. : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR_UTF8 = none; then if test -f /usr/bin/localedef; then echo "Skipping test: no french Unicode locale is installed" else echo "Skipping test: no french Unicode locale is supported" fi exit 77 fi LC_ALL=$LOCALE_FR_UTF8 \ ${CHECKER} ./test-mbsrtowcs${EXEEXT} 2 ���������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/macros.h����������������������������������������������������������0000664�0001750�0001750�00000011471�14670377436�020534� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Common macros used by gnulib tests. Copyright (C) 2006-2021 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 <https://www.gnu.org/licenses/>. */ /* This file contains macros that are used by many gnulib tests. Put here only frequently used macros, say, used by 10 tests or more. */ #include <stdio.h> #include <stdlib.h> #ifndef FALLTHROUGH # if (__GNUC__ >= 7) || (__clang_major__ >= 10) # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) # endif #endif /* Define ASSERT_STREAM before including this file if ASSERT must target a stream other than stderr. */ #ifndef ASSERT_STREAM # define ASSERT_STREAM stderr #endif /* ASSERT (condition); verifies that the specified condition is fulfilled. If not, a message is printed to ASSERT_STREAM if defined (defaulting to stderr if undefined) and the program is terminated with an error code. This macro has the following properties: - The programmer specifies the expected condition, not the failure condition. This simplifies thinking. - The condition is tested always, regardless of compilation flags. (Unlike the macro from <assert.h>.) - On Unix platforms, the tester can debug the test program with a debugger (provided core dumps are enabled: "ulimit -c unlimited"). - For the sake of platforms where no debugger is available (such as some mingw systems), an error message is printed on the error stream that includes the source location of the ASSERT invocation. */ #define ASSERT(expr) \ do \ { \ if (!(expr)) \ { \ fprintf (ASSERT_STREAM, "%s:%d: assertion '%s' failed\n", \ __FILE__, __LINE__, #expr); \ fflush (ASSERT_STREAM); \ abort (); \ } \ } \ while (0) /* Like ASSERT, except that it uses no stdio. Requires #include <string.h> and #include <unistd.h>. */ #define ASSERT_NO_STDIO(expr) \ do \ { \ if (!(expr)) \ { \ WRITE_TO_STDERR (__FILE__); \ WRITE_TO_STDERR (":"); \ WRITE_MACROEXPANDED_INTEGER_TO_STDERR (__LINE__); \ WRITE_TO_STDERR (": assertion '"); \ WRITE_TO_STDERR (#expr); \ WRITE_TO_STDERR ("' failed\n"); \ abort (); \ } \ } \ while (0) #define WRITE_MACROEXPANDED_INTEGER_TO_STDERR(integer) \ WRITE_INTEGER_TO_STDERR(integer) #define WRITE_INTEGER_TO_STDERR(integer) \ WRITE_TO_STDERR (#integer) #define WRITE_TO_STDERR(string_literal) \ { \ const char *s = string_literal; \ int ret = write (2, s, strlen (s)); \ (void) ret; \ } /* SIZEOF (array) returns the number of elements of an array. It works for arrays that are declared outside functions and for local variables of array type. It does *not* work for function parameters of array type, because they are actually parameters of pointer type. */ #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) /* STREQ (str1, str2) Return true if two strings compare equal. */ #define STREQ(a, b) (strcmp (a, b) == 0) /* Some numbers in the interval [0,1). */ extern const float randomf[1000]; extern const double randomd[1000]; extern const long double randoml[1000]; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/signature.h�������������������������������������������������������0000664�0001750�0001750�00000003677�14670377430�021254� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Macro for checking that a function declaration is compliant. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ #ifndef SIGNATURE_CHECK /* Check that the function FN takes the specified arguments ARGS with a return type of RET. This header is designed to be included after <config.h> and the one system header that is supposed to contain the function being checked, but prior to any other system headers that are necessary for the unit test. Therefore, this file does not include any system headers, nor reference anything outside of the macro arguments. For an example, if foo.h should provide: extern int foo (char, float); then the unit test named test-foo.c would start out with: #include <config.h> #include <foo.h> #include "signature.h" SIGNATURE_CHECK (foo, int, (char, float)); #include <other.h> ... */ # define SIGNATURE_CHECK(fn, ret, args) \ SIGNATURE_CHECK1 (fn, ret, args, __LINE__) /* Necessary to allow multiple SIGNATURE_CHECK lines in a unit test. Note that the checks must not occupy the same line. */ # define SIGNATURE_CHECK1(fn, ret, args, id) \ SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */ # define SIGNATURE_CHECK2(fn, ret, args, id) \ static ret (* _GL_UNUSED signature_check ## id) args = fn #endif /* SIGNATURE_CHECK */ �����������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/pthread.in.h������������������������������������������������������0000664�0001750�0001750�00000212256�14670377436�021310� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Implement the most essential subset of POSIX 1003.1-2008 pthread.h. Copyright (C) 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paul Eggert, Glen Lenker, and Bruno Haible. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ #if defined _GL_ALREADY_INCLUDING_PTHREAD_H /* Special invocation convention: On Android, we have a sequence of nested includes <pthread.h> -> <time.h> -> <sys/time.h> -> <sys/select.h> -> <signal.h> -> <pthread.h>. In this situation, PTHREAD_COND_INITIALIZER is not yet defined, therefore we should not attempt to define PTHREAD_MUTEX_NORMAL etc. */ #@INCLUDE_NEXT@ @NEXT_PTHREAD_H@ #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_PTHREAD_H_ #if @HAVE_PTHREAD_H@ # define _GL_ALREADY_INCLUDING_PTHREAD_H /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_PTHREAD_H@ # undef _GL_ALREADY_INCLUDING_PTHREAD_H #endif #ifndef _@GUARD_PREFIX@_PTHREAD_H_ #define _@GUARD_PREFIX@_PTHREAD_H_ #define __need_system_stdlib_h #include <stdlib.h> #undef __need_system_stdlib_h /* The pthreads-win32 <pthread.h> defines a couple of broken macros. */ #undef asctime_r #undef ctime_r #undef gmtime_r #undef localtime_r #undef rand_r #undef strtok_r #include <errno.h> #include <sched.h> #include <sys/types.h> #include <time.h> /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _Noreturn is copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* =========== Thread types and macros =========== */ #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS # if @GNULIB_PTHREAD_THREAD@ # include "windows-thread.h" # if @HAVE_PTHREAD_T@ # define pthread_t rpl_pthread_t # define pthread_attr_t rpl_pthread_attr_t # endif # if !GNULIB_defined_pthread_thread_types typedef glwthread_thread_t pthread_t; typedef unsigned int pthread_attr_t; # define GNULIB_defined_pthread_thread_types 1 # endif # else # if @HAVE_PTHREAD_T@ # define pthread_t rpl_pthread_t # define pthread_attr_t rpl_pthread_attr_t # endif # if !GNULIB_defined_pthread_thread_types typedef int pthread_t; typedef unsigned int pthread_attr_t; # define GNULIB_defined_pthread_thread_types 1 # endif # endif # undef PTHREAD_CREATE_JOINABLE # undef PTHREAD_CREATE_DETACHED # define PTHREAD_CREATE_JOINABLE 0 # define PTHREAD_CREATE_DETACHED 1 #else # if !@HAVE_PTHREAD_T@ # if !GNULIB_defined_pthread_thread_types typedef int pthread_t; typedef unsigned int pthread_attr_t; # define GNULIB_defined_pthread_thread_types 1 # endif # endif # if !@HAVE_PTHREAD_CREATE_DETACHED@ # define PTHREAD_CREATE_JOINABLE 0 # define PTHREAD_CREATE_DETACHED 1 # endif #endif /* =========== Once-only control (initialization) types and macros ========== */ #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS # if @GNULIB_PTHREAD_ONCE@ # include "windows-once.h" # if @HAVE_PTHREAD_T@ # define pthread_once_t rpl_pthread_once_t # endif # if !GNULIB_defined_pthread_once_types typedef glwthread_once_t pthread_once_t; # define GNULIB_defined_pthread_once_types 1 # endif # undef PTHREAD_ONCE_INIT # define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT # else # if @HAVE_PTHREAD_T@ # define pthread_once_t rpl_pthread_once_t # endif # if !GNULIB_defined_pthread_once_types typedef int pthread_once_t; # define GNULIB_defined_pthread_once_types 1 # endif # undef PTHREAD_ONCE_INIT # define PTHREAD_ONCE_INIT { 0 } # endif #else # if !@HAVE_PTHREAD_T@ # if !GNULIB_defined_pthread_once_types typedef int pthread_once_t; # define GNULIB_defined_pthread_once_types 1 # endif # undef PTHREAD_ONCE_INIT # define PTHREAD_ONCE_INIT { 0 } # endif #endif /* =========== Mutex types and macros =========== */ #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS # if @GNULIB_PTHREAD_MUTEX@ # include "windows-timedmutex.h" # include "windows-timedrecmutex.h" # if @HAVE_PTHREAD_T@ # define pthread_mutex_t rpl_pthread_mutex_t # define pthread_mutexattr_t rpl_pthread_mutexattr_t # endif # if !GNULIB_defined_pthread_mutex_types typedef struct { int type; union { glwthread_timedmutex_t u_timedmutex; glwthread_timedrecmutex_t u_timedrecmutex; } u; } pthread_mutex_t; typedef unsigned int pthread_mutexattr_t; # define GNULIB_defined_pthread_mutex_types 1 # endif # undef PTHREAD_MUTEX_INITIALIZER # define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } } # else # if @HAVE_PTHREAD_T@ # define pthread_mutex_t rpl_pthread_mutex_t # define pthread_mutexattr_t rpl_pthread_mutexattr_t # endif # if !GNULIB_defined_pthread_mutex_types typedef int pthread_mutex_t; typedef unsigned int pthread_mutexattr_t; # define GNULIB_defined_pthread_mutex_types 1 # endif # undef PTHREAD_MUTEX_INITIALIZER # define PTHREAD_MUTEX_INITIALIZER { 0 } # endif # undef PTHREAD_MUTEX_DEFAULT # undef PTHREAD_MUTEX_NORMAL # undef PTHREAD_MUTEX_ERRORCHECK # undef PTHREAD_MUTEX_RECURSIVE # define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL # define PTHREAD_MUTEX_NORMAL 0 # define PTHREAD_MUTEX_ERRORCHECK 1 # define PTHREAD_MUTEX_RECURSIVE 2 # undef PTHREAD_MUTEX_STALLED # undef PTHREAD_MUTEX_ROBUST # define PTHREAD_MUTEX_STALLED 0 # define PTHREAD_MUTEX_ROBUST 1 #else # if !@HAVE_PTHREAD_T@ # if !GNULIB_defined_pthread_mutex_types typedef int pthread_mutex_t; typedef unsigned int pthread_mutexattr_t; # define GNULIB_defined_pthread_mutex_types 1 # endif # undef PTHREAD_MUTEX_INITIALIZER # define PTHREAD_MUTEX_INITIALIZER { 0 } # endif # if !@HAVE_PTHREAD_MUTEX_RECURSIVE@ # define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL # define PTHREAD_MUTEX_NORMAL 0 # define PTHREAD_MUTEX_ERRORCHECK 1 # define PTHREAD_MUTEX_RECURSIVE 2 # endif # if !@HAVE_PTHREAD_MUTEX_ROBUST@ # define PTHREAD_MUTEX_STALLED 0 # define PTHREAD_MUTEX_ROBUST 1 # endif #endif /* =========== Read-write lock types and macros =========== */ #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS # if @GNULIB_PTHREAD_RWLOCK@ # include "windows-timedrwlock.h" # if @HAVE_PTHREAD_T@ # define pthread_rwlock_t rpl_pthread_rwlock_t # define pthread_rwlockattr_t rpl_pthread_rwlockattr_t # endif # if !GNULIB_defined_pthread_rwlock_types typedef glwthread_timedrwlock_t pthread_rwlock_t; typedef unsigned int pthread_rwlockattr_t; # define GNULIB_defined_pthread_rwlock_types 1 # endif # undef PTHREAD_RWLOCK_INITIALIZER # define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT # else # if @HAVE_PTHREAD_T@ # define pthread_rwlock_t rpl_pthread_rwlock_t # define pthread_rwlockattr_t rpl_pthread_rwlockattr_t # endif # if !GNULIB_defined_pthread_rwlock_types typedef int pthread_rwlock_t; typedef unsigned int pthread_rwlockattr_t; # define GNULIB_defined_pthread_rwlock_types 1 # endif # undef PTHREAD_RWLOCK_INITIALIZER # define PTHREAD_RWLOCK_INITIALIZER { 0 } # endif #elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_INIT@ /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */ # if @HAVE_PTHREAD_T@ # define pthread_rwlock_t rpl_pthread_rwlock_t # define pthread_rwlockattr_t rpl_pthread_rwlockattr_t # endif # if !GNULIB_defined_pthread_rwlock_types typedef struct { pthread_mutex_t lock; /* protects the remaining fields */ pthread_cond_t waiting_readers; /* waiting readers */ pthread_cond_t waiting_writers; /* waiting writers */ unsigned int waiting_writers_count; /* number of waiting writers */ int runcount; /* number of readers running, or -1 when a writer runs */ } pthread_rwlock_t; typedef unsigned int pthread_rwlockattr_t; # define GNULIB_defined_pthread_rwlock_types 1 # endif # undef PTHREAD_RWLOCK_INITIALIZER # define PTHREAD_RWLOCK_INITIALIZER \ { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 } #else # if @HAVE_PTHREAD_T@ # if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */ # define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP # endif # else # if !GNULIB_defined_pthread_rwlock_types typedef int pthread_rwlock_t; typedef unsigned int pthread_rwlockattr_t; # define GNULIB_defined_pthread_rwlock_types 1 # endif # undef PTHREAD_RWLOCK_INITIALIZER # define PTHREAD_RWLOCK_INITIALIZER { 0 } # endif #endif /* =========== Condition variable types and macros =========== */ #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS # if @GNULIB_PTHREAD_COND@ # include "windows-cond.h" # if @HAVE_PTHREAD_T@ # define pthread_cond_t rpl_pthread_cond_t # define pthread_condattr_t rpl_pthread_condattr_t # endif # if !GNULIB_defined_pthread_cond_types typedef glwthread_cond_t pthread_cond_t; typedef unsigned int pthread_condattr_t; # define GNULIB_defined_pthread_cond_types 1 # endif # undef PTHREAD_COND_INITIALIZER # define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT # else # if @HAVE_PTHREAD_T@ # define pthread_cond_t rpl_pthread_cond_t # define pthread_condattr_t rpl_pthread_condattr_t # endif # if !GNULIB_defined_pthread_cond_types typedef int pthread_cond_t; typedef unsigned int pthread_condattr_t; # define GNULIB_defined_pthread_cond_types 1 # endif # undef PTHREAD_COND_INITIALIZER # define PTHREAD_COND_INITIALIZER { 0 } # endif #else # if !@HAVE_PTHREAD_T@ # if !GNULIB_defined_pthread_cond_types typedef int pthread_cond_t; typedef unsigned int pthread_condattr_t; # define GNULIB_defined_pthread_cond_types 1 # endif # undef PTHREAD_COND_INITIALIZER # define PTHREAD_COND_INITIALIZER { 0 } # endif #endif /* =========== Thread-specific storage types and macros =========== */ #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS # if @GNULIB_PTHREAD_TSS@ # include "windows-tls.h" # if @HAVE_PTHREAD_T@ # define pthread_key_t rpl_pthread_key_t # endif # if !GNULIB_defined_pthread_tss_types typedef glwthread_tls_key_t pthread_key_t; # define GNULIB_defined_pthread_tss_types 1 # endif # undef PTHREAD_DESTRUCTOR_ITERATIONS # define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS # else # if @HAVE_PTHREAD_T@ # define pthread_key_t rpl_pthread_key_t # endif # if !GNULIB_defined_pthread_tss_types typedef void ** pthread_key_t; # define GNULIB_defined_pthread_tss_types 1 # endif # undef PTHREAD_DESTRUCTOR_ITERATIONS # define PTHREAD_DESTRUCTOR_ITERATIONS 0 # endif #else # if !@HAVE_PTHREAD_T@ # if !GNULIB_defined_pthread_tss_types typedef void ** pthread_key_t; # define GNULIB_defined_pthread_tss_types 1 # endif # undef PTHREAD_DESTRUCTOR_ITERATIONS # define PTHREAD_DESTRUCTOR_ITERATIONS 0 # endif #endif /* =========== Spinlock types and macros =========== */ #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS # if @GNULIB_PTHREAD_SPIN@ # include "windows-spin.h" # if @HAVE_PTHREAD_T@ # define pthread_spinlock_t rpl_pthread_spinlock_t # endif # if !GNULIB_defined_pthread_spin_types typedef glwthread_spinlock_t pthread_spinlock_t; # define GNULIB_defined_pthread_spin_types 1 # endif # else # if @HAVE_PTHREAD_T@ # define pthread_spinlock_t rpl_pthread_spinlock_t # endif # if !GNULIB_defined_pthread_spin_types typedef pthread_mutex_t pthread_spinlock_t; # define GNULIB_defined_pthread_spin_types 1 # endif # endif # undef PTHREAD_PROCESS_PRIVATE # undef PTHREAD_PROCESS_SHARED # define PTHREAD_PROCESS_PRIVATE 0 # define PTHREAD_PROCESS_SHARED 1 #else # if !@HAVE_PTHREAD_SPINLOCK_T@ /* Approximate spinlocks with mutexes. */ # if !GNULIB_defined_pthread_spin_types typedef pthread_mutex_t pthread_spinlock_t; # define GNULIB_defined_pthread_spin_types 1 # endif # endif # if !@HAVE_PTHREAD_PROCESS_SHARED@ # define PTHREAD_PROCESS_PRIVATE 0 # define PTHREAD_PROCESS_SHARED 1 # endif #endif /* =========== Other types and macros =========== */ #if !@HAVE_PTHREAD_T@ # if !GNULIB_defined_other_pthread_types typedef int pthread_barrier_t; typedef unsigned int pthread_barrierattr_t; # define GNULIB_defined_other_pthread_types 1 # endif #endif #if !defined PTHREAD_CANCELED # define PTHREAD_BARRIER_SERIAL_THREAD (-1) # define PTHREAD_CANCEL_DEFERRED 0 # define PTHREAD_CANCEL_ASYNCHRONOUS 1 # define PTHREAD_CANCEL_ENABLE 0 # define PTHREAD_CANCEL_DISABLE 1 # define PTHREAD_CANCELED ((void *) -1) # define PTHREAD_INHERIT_SCHED 0 # define PTHREAD_EXPLICIT_SCHED 1 # define PTHREAD_PRIO_NONE 0 # define PTHREAD_PRIO_INHERIT 1 # define PTHREAD_PRIO_PROTECT 2 # define PTHREAD_SCOPE_SYSTEM 0 # define PTHREAD_SCOPE_PROCESS 1 #endif /* =========== Thread functions =========== */ #if @GNULIB_PTHREAD_THREAD@ /* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way. Sigh. */ # if @REPLACE_PTHREAD_CREATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_create # define pthread_create rpl_pthread_create # endif _GL_FUNCDECL_RPL (pthread_create, int, (pthread_t *restrict threadp, const pthread_attr_t *restrict attr, void * (*mainfunc) (void *), void *restrict arg) _GL_ARG_NONNULL ((1, 3))); _GL_CXXALIAS_RPL (pthread_create, int, (pthread_t *restrict threadp, const pthread_attr_t *restrict attr, void * (*mainfunc) (void *), void *restrict arg)); # else # if !@HAVE_PTHREAD_CREATE@ _GL_FUNCDECL_SYS (pthread_create, int, (pthread_t *restrict threadp, const pthread_attr_t *restrict attr, void * (*mainfunc) (void *), void *restrict arg) _GL_ARG_NONNULL ((1, 3))); # endif _GL_CXXALIAS_SYS_CAST (pthread_create, int, (pthread_t *restrict threadp, const pthread_attr_t *restrict attr, void * (*mainfunc) (void *), void *restrict arg)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_create); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_create # if HAVE_RAW_DECL_PTHREAD_CREATE _GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - " "use gnulib module pthread-thread for portability"); # endif #endif #if @GNULIB_PTHREAD_THREAD@ # if @REPLACE_PTHREAD_ATTR_INIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_attr_init # define pthread_attr_init rpl_pthread_attr_init # endif _GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr)); # else # if !@HAVE_PTHREAD_ATTR_INIT@ _GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_attr_init); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_attr_init # if HAVE_RAW_DECL_PTHREAD_ATTR_INIT _GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - " "use gnulib module pthread-thread for portability"); # endif #endif #if @GNULIB_PTHREAD_THREAD@ # if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_attr_getdetachstate # define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate # endif _GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int, (const pthread_attr_t *attr, int *detachstatep) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int, (const pthread_attr_t *attr, int *detachstatep)); # else # if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@ _GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int, (const pthread_attr_t *attr, int *detachstatep) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int, (const pthread_attr_t *attr, int *detachstatep)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_attr_getdetachstate); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_attr_getdetachstate # if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE _GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - " "use gnulib module pthread-thread for portability"); # endif #endif #if @GNULIB_PTHREAD_THREAD@ # if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_attr_setdetachstate # define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate # endif _GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int, (pthread_attr_t *attr, int detachstate) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int, (pthread_attr_t *attr, int detachstate)); # else # if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@ _GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int, (pthread_attr_t *attr, int detachstate) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int, (pthread_attr_t *attr, int detachstate)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_attr_setdetachstate); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_attr_setdetachstate # if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE _GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - " "use gnulib module pthread-thread for portability"); # endif #endif #if @GNULIB_PTHREAD_THREAD@ # if @REPLACE_PTHREAD_ATTR_DESTROY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_attr_destroy # define pthread_attr_destroy rpl_pthread_attr_destroy # endif _GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr)); # else # if !@HAVE_PTHREAD_ATTR_DESTROY@ _GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_attr_destroy); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_attr_destroy # if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY _GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - " "use gnulib module pthread-thread for portability"); # endif #endif #if @GNULIB_PTHREAD_THREAD@ # if @REPLACE_PTHREAD_SELF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_self # define pthread_self rpl_pthread_self # endif _GL_FUNCDECL_RPL (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (pthread_self, pthread_t, (void)); # else # if !@HAVE_PTHREAD_SELF@ _GL_FUNCDECL_SYS (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (pthread_self, pthread_t, (void)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_self); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_self # if HAVE_RAW_DECL_PTHREAD_SELF _GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - " "use gnulib module pthread-thread for portability"); # endif #endif #if @GNULIB_PTHREAD_THREAD@ # if @REPLACE_PTHREAD_EQUAL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_equal # define pthread_equal rpl_pthread_equal # endif _GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2)); _GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2)); # else # if !@HAVE_PTHREAD_EQUAL@ _GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2)); # endif _GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_equal); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_equal # if HAVE_RAW_DECL_PTHREAD_EQUAL _GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - " "use gnulib module pthread-thread for portability"); # endif #endif #if @GNULIB_PTHREAD_THREAD@ # if @REPLACE_PTHREAD_DETACH@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_detach # define pthread_detach rpl_pthread_detach # endif _GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread)); _GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread)); # else # if !@HAVE_PTHREAD_DETACH@ _GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread)); # endif _GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_detach); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_detach # if HAVE_RAW_DECL_PTHREAD_DETACH _GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - " "use gnulib module pthread-thread for portability"); # endif #endif #if @GNULIB_PTHREAD_THREAD@ # if @REPLACE_PTHREAD_JOIN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_join # define pthread_join rpl_pthread_join # endif _GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep)); _GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep)); # else # if !@HAVE_PTHREAD_JOIN@ _GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep)); # endif _GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_join); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_join # if HAVE_RAW_DECL_PTHREAD_JOIN _GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - " "use gnulib module pthread-thread for portability"); # endif #endif #if @GNULIB_PTHREAD_THREAD@ # if @REPLACE_PTHREAD_EXIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_exit # define pthread_exit rpl_pthread_exit # endif _GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value)); _GL_CXXALIAS_RPL (pthread_exit, void, (void *value)); # else # if !@HAVE_PTHREAD_EXIT@ _GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value)); # endif /* Need to cast because of AIX with xlclang++. */ _GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_exit); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_exit # if HAVE_RAW_DECL_PTHREAD_EXIT _GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - " "use gnulib module pthread-thread for portability"); # endif #endif /* =========== Once-only control (initialization) functions =========== */ #if @GNULIB_PTHREAD_ONCE@ # if @REPLACE_PTHREAD_ONCE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_once # define pthread_once rpl_pthread_once # endif _GL_FUNCDECL_RPL (pthread_once, int, (pthread_once_t *once_control, void (*initfunction) (void)) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_once, int, (pthread_once_t *once_control, void (*initfunction) (void))); # else # if !@HAVE_PTHREAD_ONCE@ _GL_FUNCDECL_SYS (pthread_once, int, (pthread_once_t *once_control, void (*initfunction) (void)) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS_CAST (pthread_once, int, (pthread_once_t *once_control, void (*initfunction) (void))); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_once); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_once # if HAVE_RAW_DECL_PTHREAD_ONCE _GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - " "use gnulib module pthread-once for portability"); # endif #endif /* =========== Mutex functions =========== */ #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEX_INIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutex_init # define pthread_mutex_init rpl_pthread_mutex_init # endif _GL_FUNCDECL_RPL (pthread_mutex_init, int, (pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_mutex_init, int, (pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr)); # else # if !@HAVE_PTHREAD_MUTEX_INIT@ _GL_FUNCDECL_SYS (pthread_mutex_init, int, (pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_mutex_init, int, (pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutex_init); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutex_init # if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT _GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEXATTR_INIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutexattr_init # define pthread_mutexattr_init rpl_pthread_mutexattr_init # endif _GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)); # else # if !@HAVE_PTHREAD_MUTEXATTR_INIT@ _GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutexattr_init); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutexattr_init # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT _GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutexattr_gettype # define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype # endif _GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int, (const pthread_mutexattr_t *restrict attr, int *restrict typep) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int, (const pthread_mutexattr_t *restrict attr, int *restrict typep)); # else # if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@ _GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int, (const pthread_mutexattr_t *restrict attr, int *restrict typep) _GL_ARG_NONNULL ((1, 2))); # endif /* Need to cast, because on FreeBSD the first parameter is pthread_mutexattr_t *attr. */ _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int, (const pthread_mutexattr_t *restrict attr, int *restrict typep)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutexattr_gettype); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutexattr_gettype # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE _GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutexattr_settype # define pthread_mutexattr_settype rpl_pthread_mutexattr_settype # endif _GL_FUNCDECL_RPL (pthread_mutexattr_settype, int, (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_mutexattr_settype, int, (pthread_mutexattr_t *attr, int type)); # else # if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@ _GL_FUNCDECL_SYS (pthread_mutexattr_settype, int, (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_mutexattr_settype, int, (pthread_mutexattr_t *attr, int type)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutexattr_settype); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutexattr_settype # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE _GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutexattr_getrobust # define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust # endif _GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int, (const pthread_mutexattr_t *restrict attr, int *restrict robustp) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int, (const pthread_mutexattr_t *restrict attr, int *restrict robustp)); # else # if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@ _GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int, (const pthread_mutexattr_t *restrict attr, int *restrict robustp) _GL_ARG_NONNULL ((1, 2))); # endif /* Need to cast, because on FreeBSD the first parameter is pthread_mutexattr_t *attr. */ _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int, (const pthread_mutexattr_t *restrict attr, int *restrict robustp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutexattr_getrobust); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutexattr_getrobust # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST _GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutexattr_setrobust # define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust # endif _GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int, (pthread_mutexattr_t *attr, int robust) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int, (pthread_mutexattr_t *attr, int robust)); # else # if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@ _GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int, (pthread_mutexattr_t *attr, int robust) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int, (pthread_mutexattr_t *attr, int robust)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutexattr_setrobust); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutexattr_setrobust # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST _GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutexattr_destroy # define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy # endif _GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)); # else # if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@ _GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutexattr_destroy); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutexattr_destroy # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY _GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEX_LOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutex_lock # define pthread_mutex_lock rpl_pthread_mutex_lock # endif _GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex)); # else # if !@HAVE_PTHREAD_MUTEX_LOCK@ _GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutex_lock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutex_lock # if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK _GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEX_TRYLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutex_trylock # define pthread_mutex_trylock rpl_pthread_mutex_trylock # endif _GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)); # else # if !@HAVE_PTHREAD_MUTEX_TRYLOCK@ _GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutex_trylock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutex_trylock # if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK _GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@ # if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutex_timedlock # define pthread_mutex_timedlock rpl_pthread_mutex_timedlock # endif _GL_FUNCDECL_RPL (pthread_mutex_timedlock, int, (pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_mutex_timedlock, int, (pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime)); # else # if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@ _GL_FUNCDECL_SYS (pthread_mutex_timedlock, int, (pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (pthread_mutex_timedlock, int, (pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutex_timedlock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutex_timedlock # if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK _GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - " "use gnulib module pthread_mutex_timedlock for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEX_UNLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutex_unlock # define pthread_mutex_unlock rpl_pthread_mutex_unlock # endif _GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)); # else # if !@HAVE_PTHREAD_MUTEX_UNLOCK@ _GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutex_unlock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutex_unlock # if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK _GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif #if @GNULIB_PTHREAD_MUTEX@ # if @REPLACE_PTHREAD_MUTEX_DESTROY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_mutex_destroy # define pthread_mutex_destroy rpl_pthread_mutex_destroy # endif _GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)); # else # if !@HAVE_PTHREAD_MUTEX_DESTROY@ _GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutex_destroy); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_mutex_destroy # if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY _GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - " "use gnulib module pthread-mutex for portability"); # endif #endif /* =========== Read-write lock functions =========== */ #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCK_INIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlock_init # define pthread_rwlock_init rpl_pthread_rwlock_init # endif _GL_FUNCDECL_RPL (pthread_rwlock_init, int, (pthread_rwlock_t *restrict lock, const pthread_rwlockattr_t *restrict attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_rwlock_init, int, (pthread_rwlock_t *restrict lock, const pthread_rwlockattr_t *restrict attr)); # else # if !@HAVE_PTHREAD_RWLOCK_INIT@ _GL_FUNCDECL_SYS (pthread_rwlock_init, int, (pthread_rwlock_t *restrict lock, const pthread_rwlockattr_t *restrict attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_init, int, (pthread_rwlock_t *restrict lock, const pthread_rwlockattr_t *restrict attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlock_init); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlock_init # if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT _GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCKATTR_INIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlockattr_init # define pthread_rwlockattr_init rpl_pthread_rwlockattr_init # endif _GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)); # else # if !@HAVE_PTHREAD_RWLOCKATTR_INIT@ _GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlockattr_init); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlockattr_init # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT _GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlockattr_destroy # define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy # endif _GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int, (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int, (pthread_rwlockattr_t *attr)); # else # if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@ _GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int, (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int, (pthread_rwlockattr_t *attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlockattr_destroy); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlockattr_destroy # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY _GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCK_RDLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlock_rdlock # define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock # endif _GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)); # else # if !@HAVE_PTHREAD_RWLOCK_RDLOCK@ _GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlock_rdlock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlock_rdlock # if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK _GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCK_WRLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlock_wrlock # define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock # endif _GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)); # else # if !@HAVE_PTHREAD_RWLOCK_WRLOCK@ _GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlock_wrlock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlock_wrlock # if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK _GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlock_tryrdlock # define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock # endif _GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)); # else # if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@ _GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlock_tryrdlock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlock_tryrdlock # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK _GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlock_trywrlock # define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock # endif _GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)); # else # if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@ _GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlock_trywrlock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlock_trywrlock # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK _GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlock_timedrdlock # define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock # endif _GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int, (pthread_rwlock_t *restrict lock, const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int, (pthread_rwlock_t *restrict lock, const struct timespec *restrict abstime)); # else # if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@ _GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int, (pthread_rwlock_t *restrict lock, const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int, (pthread_rwlock_t *restrict lock, const struct timespec *restrict abstime)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlock_timedrdlock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlock_timedrdlock # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK _GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlock_timedwrlock # define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock # endif _GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int, (pthread_rwlock_t *restrict lock, const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int, (pthread_rwlock_t *restrict lock, const struct timespec *restrict abstime)); # else # if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@ _GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int, (pthread_rwlock_t *restrict lock, const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int, (pthread_rwlock_t *restrict lock, const struct timespec *restrict abstime)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlock_timedwrlock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlock_timedwrlock # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK _GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCK_UNLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlock_unlock # define pthread_rwlock_unlock rpl_pthread_rwlock_unlock # endif _GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)); # else # if !@HAVE_PTHREAD_RWLOCK_UNLOCK@ _GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlock_unlock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlock_unlock # if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK _GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif #if @GNULIB_PTHREAD_RWLOCK@ # if @REPLACE_PTHREAD_RWLOCK_DESTROY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_rwlock_destroy # define pthread_rwlock_destroy rpl_pthread_rwlock_destroy # endif _GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)); # else # if !@HAVE_PTHREAD_RWLOCK_DESTROY@ _GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_rwlock_destroy); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_rwlock_destroy # if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY _GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - " "use gnulib module pthread-rwlock for portability"); # endif #endif /* =========== Condition variable functions =========== */ #if @GNULIB_PTHREAD_COND@ # if @REPLACE_PTHREAD_COND_INIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_cond_init # define pthread_cond_init rpl_pthread_cond_init # endif _GL_FUNCDECL_RPL (pthread_cond_init, int, (pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_cond_init, int, (pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr)); # else # if !@HAVE_PTHREAD_COND_INIT@ _GL_FUNCDECL_SYS (pthread_cond_init, int, (pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_cond_init, int, (pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_cond_init); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_cond_init # if HAVE_RAW_DECL_PTHREAD_COND_INIT _GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - " "use gnulib module pthread-cond for portability"); # endif #endif #if @GNULIB_PTHREAD_COND@ # if @REPLACE_PTHREAD_CONDATTR_INIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_condattr_init # define pthread_condattr_init rpl_pthread_condattr_init # endif _GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr)); # else # if !@HAVE_PTHREAD_CONDATTR_INIT@ _GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_condattr_init); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_condattr_init # if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT _GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - " "use gnulib module pthread-cond for portability"); # endif #endif #if @GNULIB_PTHREAD_COND@ # if @REPLACE_PTHREAD_CONDATTR_DESTROY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_condattr_destroy # define pthread_condattr_destroy rpl_pthread_condattr_destroy # endif _GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr)); # else # if !@HAVE_PTHREAD_CONDATTR_DESTROY@ _GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_condattr_destroy); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_condattr_destroy # if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY _GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - " "use gnulib module pthread-cond for portability"); # endif #endif #if @GNULIB_PTHREAD_COND@ # if @REPLACE_PTHREAD_COND_WAIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_cond_wait # define pthread_cond_wait rpl_pthread_cond_wait # endif _GL_FUNCDECL_RPL (pthread_cond_wait, int, (pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_cond_wait, int, (pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex)); # else # if !@HAVE_PTHREAD_COND_WAIT@ _GL_FUNCDECL_SYS (pthread_cond_wait, int, (pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (pthread_cond_wait, int, (pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_cond_wait); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_cond_wait # if HAVE_RAW_DECL_PTHREAD_COND_WAIT _GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - " "use gnulib module pthread-cond for portability"); # endif #endif #if @GNULIB_PTHREAD_COND@ # if @REPLACE_PTHREAD_COND_TIMEDWAIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_cond_timedwait # define pthread_cond_timedwait rpl_pthread_cond_timedwait # endif _GL_FUNCDECL_RPL (pthread_cond_timedwait, int, (pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2, 3))); _GL_CXXALIAS_RPL (pthread_cond_timedwait, int, (pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime)); # else # if !@HAVE_PTHREAD_COND_TIMEDWAIT@ _GL_FUNCDECL_SYS (pthread_cond_timedwait, int, (pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2, 3))); # endif _GL_CXXALIAS_SYS (pthread_cond_timedwait, int, (pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_cond_timedwait); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_cond_timedwait # if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT _GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait is not portable - " "use gnulib module pthread-cond for portability"); # endif #endif #if @GNULIB_PTHREAD_COND@ # if @REPLACE_PTHREAD_COND_SIGNAL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_cond_signal # define pthread_cond_signal rpl_pthread_cond_signal # endif _GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond)); # else # if !@HAVE_PTHREAD_COND_SIGNAL@ _GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_cond_signal); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_cond_signal # if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL _GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - " "use gnulib module pthread-cond for portability"); # endif #endif #if @GNULIB_PTHREAD_COND@ # if @REPLACE_PTHREAD_COND_BROADCAST@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_cond_broadcast # define pthread_cond_broadcast rpl_pthread_cond_broadcast # endif _GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond)); # else # if !@HAVE_PTHREAD_COND_BROADCAST@ _GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_cond_broadcast); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_cond_broadcast # if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST _GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - " "use gnulib module pthread-cond for portability"); # endif #endif #if @GNULIB_PTHREAD_COND@ # if @REPLACE_PTHREAD_COND_DESTROY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_cond_destroy # define pthread_cond_destroy rpl_pthread_cond_destroy # endif _GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond)); # else # if !@HAVE_PTHREAD_COND_DESTROY@ _GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_cond_destroy); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_cond_destroy # if HAVE_RAW_DECL_PTHREAD_COND_DESTROY _GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - " "use gnulib module pthread-cond for portability"); # endif #endif /* =========== Thread-specific storage functions =========== */ #if @GNULIB_PTHREAD_TSS@ # if @REPLACE_PTHREAD_KEY_CREATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_key_create # define pthread_key_create rpl_pthread_key_create # endif _GL_FUNCDECL_RPL (pthread_key_create, int, (pthread_key_t *keyp, void (*destructor) (void *)) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_key_create, int, (pthread_key_t *keyp, void (*destructor) (void *))); # else # if !@HAVE_PTHREAD_KEY_CREATE@ _GL_FUNCDECL_SYS (pthread_key_create, int, (pthread_key_t *keyp, void (*destructor) (void *)) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS_CAST (pthread_key_create, int, (pthread_key_t *keyp, void (*destructor) (void *))); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_key_create); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_key_create # if HAVE_RAW_DECL_PTHREAD_KEY_CREATE _GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - " "use gnulib module pthread-tss for portability"); # endif #endif #if @GNULIB_PTHREAD_TSS@ # if @REPLACE_PTHREAD_SETSPECIFIC@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_setspecific # define pthread_setspecific rpl_pthread_setspecific # endif _GL_FUNCDECL_RPL (pthread_setspecific, int, (pthread_key_t key, const void *value)); _GL_CXXALIAS_RPL (pthread_setspecific, int, (pthread_key_t key, const void *value)); # else # if !@HAVE_PTHREAD_SETSPECIFIC@ _GL_FUNCDECL_SYS (pthread_setspecific, int, (pthread_key_t key, const void *value)); # endif _GL_CXXALIAS_SYS (pthread_setspecific, int, (pthread_key_t key, const void *value)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_setspecific); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_setspecific # if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC _GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - " "use gnulib module pthread-tss for portability"); # endif #endif #if @GNULIB_PTHREAD_TSS@ # if @REPLACE_PTHREAD_GETSPECIFIC@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_getspecific # define pthread_getspecific rpl_pthread_getspecific # endif _GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key)); _GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key)); # else # if !@HAVE_PTHREAD_GETSPECIFIC@ _GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key)); # endif _GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_getspecific); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_getspecific # if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC _GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - " "use gnulib module pthread-tss for portability"); # endif #endif #if @GNULIB_PTHREAD_TSS@ # if @REPLACE_PTHREAD_KEY_DELETE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_key_delete # define pthread_key_delete rpl_pthread_key_delete # endif _GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key)); _GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key)); # else # if !@HAVE_PTHREAD_KEY_DELETE@ _GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key)); # endif _GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_key_delete); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_key_delete # if HAVE_RAW_DECL_PTHREAD_KEY_DELETE _GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - " "use gnulib module pthread-tss for portability"); # endif #endif /* =========== Spinlock functions =========== */ #if @GNULIB_PTHREAD_SPIN@ # if @REPLACE_PTHREAD_SPIN_INIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_spin_init # define pthread_spin_init rpl_pthread_spin_init # endif _GL_FUNCDECL_RPL (pthread_spin_init, int, (pthread_spinlock_t *lock, int shared_across_processes) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_spin_init, int, (pthread_spinlock_t *lock, int shared_across_processes)); # else # if !@HAVE_PTHREAD_SPIN_INIT@ _GL_FUNCDECL_SYS (pthread_spin_init, int, (pthread_spinlock_t *lock, int shared_across_processes) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_spin_init, int, (pthread_spinlock_t *lock, int shared_across_processes)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_spin_init); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_spin_init # if HAVE_RAW_DECL_PTHREAD_SPIN_INIT _GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - " "use gnulib module pthread-spin for portability"); # endif #endif #if @GNULIB_PTHREAD_SPIN@ # if @REPLACE_PTHREAD_SPIN_LOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_spin_lock # define pthread_spin_lock rpl_pthread_spin_lock # endif _GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock)); # else # if !@HAVE_PTHREAD_SPIN_LOCK@ _GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_spin_lock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_spin_lock # if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK _GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - " "use gnulib module pthread-spin for portability"); # endif #endif #if @GNULIB_PTHREAD_SPIN@ # if @REPLACE_PTHREAD_SPIN_TRYLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_spin_trylock # define pthread_spin_trylock rpl_pthread_spin_trylock # endif _GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock)); # else # if !@HAVE_PTHREAD_SPIN_TRYLOCK@ _GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_spin_trylock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_spin_trylock # if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK _GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - " "use gnulib module pthread-spin for portability"); # endif #endif #if @GNULIB_PTHREAD_SPIN@ # if @REPLACE_PTHREAD_SPIN_UNLOCK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_spin_unlock # define pthread_spin_unlock rpl_pthread_spin_unlock # endif _GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock)); # else # if !@HAVE_PTHREAD_SPIN_UNLOCK@ _GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_spin_unlock); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_spin_unlock # if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK _GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - " "use gnulib module pthread-spin for portability"); # endif #endif #if @GNULIB_PTHREAD_SPIN@ # if @REPLACE_PTHREAD_SPIN_DESTROY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_spin_destroy # define pthread_spin_destroy rpl_pthread_spin_destroy # endif _GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock)); # else # if !@HAVE_PTHREAD_SPIN_DESTROY@ _GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_spin_destroy); # endif #elif defined GNULIB_POSIXCHECK # undef pthread_spin_destroy # if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY _GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - " "use gnulib module pthread-spin for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */ #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */ #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/symlink.c���������������������������������������������������������0000664�0001750�0001750�00000002677�14670377436�020741� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Stub for symlink(). Copyright (C) 2009-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/stat.h> #if HAVE_SYMLINK # undef symlink /* Create a symlink, but reject trailing slash. */ int rpl_symlink (char const *contents, char const *name) { size_t len = strlen (name); if (len && name[len - 1] == '/') { struct stat st; if (lstat (name, &st) == 0 || errno == EOVERFLOW) errno = EEXIST; return -1; } return symlink (contents, name); } #else /* !HAVE_SYMLINK */ /* The system does not support symlinks. */ int symlink (char const *contents _GL_UNUSED, char const *name _GL_UNUSED) { errno = ENOSYS; return -1; } #endif /* !HAVE_SYMLINK */ �����������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/uinttostr.c�������������������������������������������������������0000664�0001750�0001750�00000001532�14670377437�021314� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Convert 'unsigned int' integer to printable string. Copyright (C) 2006-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ #define anytostr uinttostr #define inttype unsigned int #include "anytostr.c" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-verify.sh����������������������������������������������������0000775�0001750�0001750�00000001325�14670377437�021715� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh . "${srcdir=.}/init.sh" # We are not interested in triggering bugs in the compilers and tools # (such as gcc 4.3.1 on openSUSE 11.0). unset MALLOC_PERTURB_ # Rather than figure out how to invoke the compiler with the right # include path ourselves, we let make do it: (cd "$initial_cwd_" \ && rm -f test-verify-try.o \ && $MAKE test-verify-try.o >/dev/null 2>&1) \ || skip_ "cannot compile error-free" # Now, prove that we encounter all expected compilation failures: : >out : >err for i in 1 2 3 4 5; do (cd "$initial_cwd_" rm -f test-verify-try.o $MAKE CFLAGS=-DEXP_FAIL=$i test-verify-try.o) >>out 2>>err \ && { warn_ "compiler didn't detect verification failure $i"; fail=1; } done Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-exclude7.sh��������������������������������������������������0000775�0001750�0001750�00000002473�14670377431�022130� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test suite for exclude. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . fail=0 # Test exclude precedence cat > in <<EOT foo* bar Baz EOT cat > expected <<EOT bar: 0 bar: 1 EOT ${CHECKER} test-exclude in -include in -- bar > out || exit $? ${CHECKER} test-exclude -include in -no-include in -- bar >> out || exit $? # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac # normalize output LC_ALL=C tr -d "$cr" < out > k && mv k out compare expected out || fail=1 Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-openat-safer.c�����������������������������������������������0000664�0001750�0001750�00000007656�14670377436�022616� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test that openat_safer leave standard fds alone. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include "fcntl--.h" #include <errno.h> #include <stdio.h> #include <sys/stat.h> #include <unistd.h> /* This test intentionally closes stderr. So, we arrange to have fd 10 (outside the range of interesting fd's during the test) set up to duplicate the original stderr. */ #define BACKUP_STDERR_FILENO 10 #define ASSERT_STREAM myerr #include "macros.h" static FILE *myerr; #define witness "test-openat-safer.txt" int main (void) { int i; int j; int dfd; int fd; char buf[2]; /* We close fd 2 later, so save it in fd 10. */ if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL) return 2; /* Create handle for future use. */ dfd = openat (AT_FDCWD, ".", O_RDONLY); ASSERT (STDERR_FILENO < dfd); /* Create file for later checks. */ remove (witness); fd = openat (dfd, witness, O_WRONLY | O_CREAT | O_EXCL, 0600); ASSERT (STDERR_FILENO < fd); ASSERT (write (fd, "hi", 2) == 2); ASSERT (close (fd) == 0); /* Four iterations, with progressively more standard descriptors closed. */ for (i = -1; i <= STDERR_FILENO; i++) { ASSERT (fchdir (dfd) == 0); if (0 <= i) ASSERT (close (i) == 0); /* Execute once in ".", once in "..". */ for (j = 0; j <= 1; j++) { if (j) ASSERT (chdir ("..") == 0); /* Check for error detection. */ errno = 0; ASSERT (openat (AT_FDCWD, "", O_RDONLY) == -1); ASSERT (errno == ENOENT); errno = 0; ASSERT (openat (dfd, "", O_RDONLY) == -1); ASSERT (errno == ENOENT); errno = 0; ASSERT (openat (-1, ".", O_RDONLY) == -1); ASSERT (errno == EBADF); /* Check for trailing slash and /dev/null handling. */ errno = 0; ASSERT (openat (dfd, "nonexist.ent/", O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR) == -1); ASSERT (errno == ENOTDIR || errno == EISDIR || errno == ENOENT || errno == EINVAL); errno = 0; ASSERT (openat (dfd, witness "/", O_RDONLY) == -1); ASSERT (errno == ENOTDIR || errno == EISDIR || errno == EINVAL); #if defined __linux__ || defined __ANDROID__ /* Using a bad directory is okay for absolute paths. */ fd = openat (-1, "/dev/null", O_WRONLY); ASSERT (STDERR_FILENO < fd); #endif /* Using a non-directory is wrong for relative paths. */ errno = 0; fd = open ("/dev/null", O_RDONLY); ASSERT (STDERR_FILENO < fd); ASSERT (openat (fd, ".", O_RDONLY) == -1); ASSERT (errno == EBADF || errno == ENOTDIR); ASSERT (close (fd) == 0); /* Check for our witness file. */ fd = openat (dfd, witness, O_RDONLY | O_NOFOLLOW); ASSERT (STDERR_FILENO < fd); ASSERT (read (fd, buf, 2) == 2); ASSERT (buf[0] == 'h' && buf[1] == 'i'); ASSERT (close (fd) == 0); } } ASSERT (fchdir (dfd) == 0); ASSERT (unlink (witness) == 0); ASSERT (close (dfd) == 0); return 0; } ����������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-binary-io.sh�������������������������������������������������0000775�0001750�0001750�00000000400�14670377431�022265� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 tmpfiles="$tmpfiles t-bin-out0.tmp t-bin-out1.tmp" ${CHECKER} ./test-binary-io${EXEEXT} 1 > t-bin-out1.tmp || exit 1 cmp t-bin-out0.tmp t-bin-out1.tmp > /dev/null || exit 1 rm -fr $tmpfiles exit 0 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-memchr2.c����������������������������������������������������0000664�0001750�0001750�00000005743�14670377436�021562� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2008-2021 Free Software Foundation, Inc. * Written by Eric Blake * * 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include "memchr2.h" #include <stdlib.h> #include <string.h> #include "zerosize-ptr.h" #include "macros.h" /* Calculating void * + int is not portable, so this wrapper converts to char * to make the tests easier to write. */ #define MEMCHR2 (char *) memchr2 int main (void) { size_t n = 0x100000; char *input = malloc (n); ASSERT (input); input[0] = 'a'; input[1] = 'b'; memset (input + 2, 'c', 1024); memset (input + 1026, 'd', n - 1028); input[n - 2] = 'e'; input[n - 1] = 'a'; /* Basic behavior tests. */ ASSERT (MEMCHR2 (input, 'a', 'b', n) == input); ASSERT (MEMCHR2 (input, 'b', 'a', n) == input); ASSERT (MEMCHR2 (input, 'a', 'b', 0) == NULL); void *page_boundary = zerosize_ptr (); if (page_boundary) ASSERT (MEMCHR2 (page_boundary, 'a', 'b', 0) == NULL); ASSERT (MEMCHR2 (input, 'b', 'd', n) == input + 1); ASSERT (MEMCHR2 (input + 2, 'b', 'd', n - 2) == input + 1026); ASSERT (MEMCHR2 (input, 'd', 'e', n) == input + 1026); ASSERT (MEMCHR2 (input, 'e', 'd', n) == input + 1026); ASSERT (MEMCHR2 (input + 1, 'a', 'e', n - 1) == input + n - 2); ASSERT (MEMCHR2 (input + 1, 'e', 'a', n - 1) == input + n - 2); ASSERT (MEMCHR2 (input, 'f', 'g', n) == NULL); ASSERT (MEMCHR2 (input, 'f', '\0', n) == NULL); ASSERT (MEMCHR2 (input, 'a', 'a', n) == input); ASSERT (MEMCHR2 (input + 1, 'a', 'a', n - 1) == input + n - 1); ASSERT (MEMCHR2 (input, 'f', 'f', n) == NULL); /* Check that a very long haystack is handled quickly if one of the two bytes is found near the beginning. */ { size_t repeat = 10000; for (; repeat > 0; repeat--) { ASSERT (MEMCHR2 (input, 'c', 'e', n) == input + 2); ASSERT (MEMCHR2 (input, 'e', 'c', n) == input + 2); ASSERT (MEMCHR2 (input, 'c', '\0', n) == input + 2); ASSERT (MEMCHR2 (input, '\0', 'c', n) == input + 2); } } /* Alignment tests. */ { int i, j; for (i = 0; i < 32; i++) { for (j = 0; j < 256; j++) input[i + j] = j; for (j = 0; j < 256; j++) { ASSERT (MEMCHR2 (input + i, j, 0xff, 256) == input + i + j); ASSERT (MEMCHR2 (input + i, 0xff, j, 256) == input + i + j); } } } free (input); return 0; } �����������������������������kbuild-3608/src/grep/gnulib-tests/ioctl.c�����������������������������������������������������������0000664�0001750�0001750�00000004374�14670377436�020361� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ioctl.c --- wrappers for Windows ioctl function Copyright (C) 2008-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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/>. */ /* Written by Paolo Bonzini */ #include <config.h> #include <sys/ioctl.h> #include <stdarg.h> #if HAVE_IOCTL /* Provide a wrapper with the POSIX prototype. */ # undef ioctl int rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */) { void *buf; va_list args; va_start (args, request); buf = va_arg (args, void *); va_end (args); /* Cast 'request' so that when the system's ioctl function takes a 64-bit request argument, the value gets zero-extended, not sign-extended. */ return ioctl (fd, (unsigned int) request, buf); } #else /* mingw */ # include <errno.h> /* Get HANDLE. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> # include "fd-hook.h" /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include <io.h> # endif static int primary_ioctl (int fd, int request, void *arg) { /* We don't support FIONBIO on pipes here. If you want to make pipe fds non-blocking, use the gnulib 'nonblocking' module, until gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK. */ if ((HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE) errno = ENOSYS; else errno = EBADF; return -1; } int ioctl (int fd, int request, ... /* {void *,char *} arg */) { void *arg; va_list args; va_start (args, request); arg = va_arg (args, void *); va_end (args); # if WINDOWS_SOCKETS return execute_all_ioctl_hooks (primary_ioctl, fd, request, arg); # else return primary_ioctl (fd, request, arg); # endif } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/sleep.c�����������������������������������������������������������0000664�0001750�0001750�00000004402�14670377431�020342� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Pausing execution of the current thread. Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <unistd.h> #include <limits.h> #include "verify.h" #if defined _WIN32 && ! defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> unsigned int sleep (unsigned int seconds) { unsigned int remaining; /* Sleep for 1 second many times, because 1. Sleep is not interruptible by Ctrl-C, 2. we want to avoid arithmetic overflow while multiplying with 1000. */ for (remaining = seconds; remaining > 0; remaining--) Sleep (1000); return remaining; } #elif HAVE_SLEEP # undef sleep /* Guarantee unlimited sleep and a reasonable return value. Cygwin 1.5.x rejects attempts to sleep more than 49.7 days (2**32 milliseconds), but uses uninitialized memory which results in a garbage answer. Similarly, Linux 2.6.9 with glibc 2.3.4 has a too small return value when asked to sleep more than 24.85 days. */ unsigned int rpl_sleep (unsigned int seconds) { /* This requires int larger than 16 bits. */ verify (UINT_MAX / 24 / 24 / 60 / 60); const unsigned int limit = 24 * 24 * 60 * 60; while (limit < seconds) { unsigned int result; seconds -= limit; result = sleep (limit); if (result) return seconds + result; } return sleep (seconds); } #else /* !HAVE_SLEEP */ #error "Please port gnulib sleep.c to your platform, possibly using usleep() or select(), then report this to bug-gnulib." #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-iswxdigit.sh�������������������������������������������������0000775�0001750�0001750�00000001676�14670377436�022434� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test in the POSIX locale. LC_ALL=C ${CHECKER} ./test-iswxdigit${EXEEXT} 0 || exit 1 LC_ALL=POSIX ${CHECKER} ./test-iswxdigit${EXEEXT} 0 || exit 1 # Test in an ISO-8859-1 or ISO-8859-15 locale. : ${LOCALE_FR=fr_FR} if test $LOCALE_FR != none; then LC_ALL=$LOCALE_FR \ ${CHECKER} ./test-iswxdigit${EXEEXT} 1 \ || exit 1 fi # Test whether a specific EUC-JP locale is installed. : ${LOCALE_JA=ja_JP} if test $LOCALE_JA != none; then LC_ALL=$LOCALE_JA \ ${CHECKER} ./test-iswxdigit${EXEEXT} 2 \ || exit 1 fi # Test whether a specific UTF-8 locale is installed. : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR_UTF8 != none; then LC_ALL=$LOCALE_FR_UTF8 \ ${CHECKER} ./test-iswxdigit${EXEEXT} 3 \ || exit 1 fi # Test whether a specific GB18030 locale is installed. : ${LOCALE_ZH_CN=zh_CN.GB18030} if test $LOCALE_ZH_CN != none; then LC_ALL=$LOCALE_ZH_CN \ ${CHECKER} ./test-iswxdigit${EXEEXT} 4 \ || exit 1 fi exit 0 ������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sigprocmask.c������������������������������������������������0000664�0001750�0001750�00000005060�14670377436�022537� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of sigprocmask. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2011. */ #include <config.h> #include <signal.h> #include "signature.h" SIGNATURE_CHECK (sigprocmask, int, (int, const sigset_t *, sigset_t *)); #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "macros.h" #if !(defined _WIN32 && !defined __CYGWIN__) static volatile int sigint_occurred; static void sigint_handler (int sig) { sigint_occurred++; } int main (int argc, char *argv[]) { sigset_t set; pid_t pid = getpid (); char command[80]; if (sizeof (int) < sizeof pid && 0x7fffffff < pid) { fputs ("Skipping test: pid too large\n", stderr); return 77; } signal (SIGINT, sigint_handler); sigemptyset (&set); sigaddset (&set, SIGINT); /* Check error handling. */ ASSERT (sigprocmask (1729, &set, NULL) == -1); ASSERT (errno == EINVAL); /* Block SIGINT. */ ASSERT (sigprocmask (SIG_BLOCK, &set, NULL) == 0); /* Request a SIGINT signal from outside. */ sprintf (command, "sh -c 'sleep 1; kill -%d %d' &", SIGINT, (int) pid); ASSERT (system (command) == 0); /* Wait. */ sleep (2); /* The signal should not have arrived yet, because it is blocked. */ ASSERT (sigint_occurred == 0); /* Unblock SIGINT. */ ASSERT (sigprocmask (SIG_UNBLOCK, &set, NULL) == 0); /* The signal should have arrived now, because POSIX says "If there are any pending unblocked signals after the call to sigprocmask(), at least one of those signals shall be delivered before the call to sigprocmask() returns." */ ASSERT (sigint_occurred == 1); return 0; } #else /* On native Windows, getpid() values and the arguments that are passed to the (Cygwin?) 'kill' program are not necessarily related. */ int main () { fputs ("Skipping test: native Windows platform\n", stderr); return 77; } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/warn-on-use.h�����������������������������������������������������0000664�0001750�0001750�00000015471�14670377437�021430� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* A C macro for emitting warnings if a function is used. Copyright (C) 2010-2021 Free Software Foundation, Inc. This program 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 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 Lesser General Public License for more details. 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/>. */ /* _GL_WARN_ON_USE (function, "literal string") issues a declaration for FUNCTION which will then trigger a compiler warning containing the text of "literal string" anywhere that function is called, if supported by the compiler. If the compiler does not support this feature, the macro expands to an unused extern declaration. _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the attribute used in _GL_WARN_ON_USE. If the compiler does not support this feature, it expands to empty. These macros are useful for marking a function as a potential portability trap, with the intent that "literal string" include instructions on the replacement function that should be used instead. _GL_WARN_ON_USE is for functions with 'extern' linkage. _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' linkage. However, one of the reasons that a function is a portability trap is if it has the wrong signature. Declaring FUNCTION with a different signature in C is a compilation error, so this macro must use the same type as any existing declaration so that programs that avoid the problematic FUNCTION do not fail to compile merely because they included a header that poisoned the function. But this implies that _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already have a declaration. Use of this macro implies that there must not be any other macro hiding the declaration of FUNCTION; but undefining FUNCTION first is part of the poisoning process anyway (although for symbols that are provided only via a macro, the result is a compilation error rather than a warning containing "literal string"). Also note that in C++, it is only safe to use if FUNCTION has no overloads. For an example, it is possible to poison 'getline' by: - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], [getline]) in configure.ac, which potentially defines HAVE_RAW_DECL_GETLINE - adding this code to a header that wraps the system <stdio.h>: #undef getline #if HAVE_RAW_DECL_GETLINE _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" "not universally present; use the gnulib module getline"); #endif It is not possible to directly poison global variables. But it is possible to write a wrapper accessor function, and poison that (less common usage, like &environ, will cause a compilation error rather than issue the nice warning, but the end result of informing the developer about their portability problem is still achieved): #if HAVE_RAW_DECL_ENVIRON static char *** rpl_environ (void) { return &environ; } _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); # undef environ # define environ (*rpl_environ ()) #endif or better (avoiding contradictory use of 'static' and 'extern'): #if HAVE_RAW_DECL_ENVIRON static char *** _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") rpl_environ (void) { return &environ; } # undef environ # define environ (*rpl_environ ()) #endif */ #ifndef _GL_WARN_ON_USE # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function __attribute__ ((__warning__ (message))) # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ __attribute__ ((__warning__ (message))) # elif __clang_major__ >= 4 /* Another compiler attribute is available in clang. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function \ __attribute__ ((__diagnose_if__ (1, message, "warning"))) # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ __attribute__ ((__diagnose_if__ (1, message, "warning"))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function # define _GL_WARN_ON_USE_ATTRIBUTE(message) # else /* Unsupported. */ # define _GL_WARN_ON_USE(function, message) \ _GL_WARN_EXTERN_C int _gl_warn_on_use # define _GL_WARN_ON_USE_ATTRIBUTE(message) # endif #endif /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the function is declared with the given prototype, consisting of return type, parameters, and attributes. This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does not work in this case. */ #ifndef _GL_WARN_ON_USE_CXX # if !defined __cplusplus # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ _GL_WARN_ON_USE (function, msg) # else # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ extern rettype_gcc function parameters_and_attributes \ __attribute__ ((__warning__ (msg))) # elif __clang_major__ >= 4 /* Another compiler attribute is available in clang. */ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ extern rettype_clang function parameters_and_attributes \ __attribute__ ((__diagnose_if__ (1, msg, "warning"))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ extern rettype_gcc function parameters_and_attributes # else /* Unsupported. */ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ _GL_WARN_EXTERN_C int _gl_warn_on_use # endif # endif #endif /* _GL_WARN_EXTERN_C declaration; performs the declaration with C linkage. */ #ifndef _GL_WARN_EXTERN_C # if defined __cplusplus # define _GL_WARN_EXTERN_C extern "C" # else # define _GL_WARN_EXTERN_C extern # endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-accept.c�����������������������������������������������������0000664�0001750�0001750�00000002773�14670377431�021457� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test accepting a connection to a server socket. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <sys/socket.h> #include "signature.h" SIGNATURE_CHECK (accept, int, (int, struct sockaddr *, socklen_t *)); #include <errno.h> #include <netinet/in.h> #include <unistd.h> #include "sockets.h" #include "macros.h" int main (void) { (void) gl_sockets_startup (SOCKETS_1_1); /* Test behaviour for invalid file descriptors. */ { struct sockaddr_in addr; socklen_t addrlen = sizeof (addr); errno = 0; ASSERT (accept (-1, (struct sockaddr *) &addr, &addrlen) == -1); ASSERT (errno == EBADF); } { struct sockaddr_in addr; socklen_t addrlen = sizeof (addr); close (99); errno = 0; ASSERT (accept (99, (struct sockaddr *) &addr, &addrlen) == -1); ASSERT (errno == EBADF); } return 0; } �����kbuild-3608/src/grep/gnulib-tests/setlocale.c�������������������������������������������������������0000664�0001750�0001750�00000162670�14670377431�021221� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Set the current locale. -*- coding: utf-8 -*- Copyright (C) 2009, 2011-2021 Free Software Foundation, Inc. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ #include <config.h> /* Override setlocale() so that when the default locale is requested (locale = ""), the environment variables LC_ALL, LC_*, and LANG are considered. Also include all the functionality from libintl's setlocale() override. */ /* Please keep this file in sync with gettext/gettext-runtime/intl/setlocale.c ! */ /* Specification. */ #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "localename.h" #if HAVE_CFLOCALECOPYPREFERREDLANGUAGES || HAVE_CFPREFERENCESCOPYAPPVALUE # if HAVE_CFLOCALECOPYPREFERREDLANGUAGES # include <CoreFoundation/CFLocale.h> # elif HAVE_CFPREFERENCESCOPYAPPVALUE # include <CoreFoundation/CFPreferences.h> # endif # include <CoreFoundation/CFPropertyList.h> # include <CoreFoundation/CFArray.h> # include <CoreFoundation/CFString.h> extern void gl_locale_name_canonicalize (char *name); #endif #if 1 # undef setlocale /* Which of the replacements to activate? */ # if NEED_SETLOCALE_IMPROVED # define setlocale_improved rpl_setlocale # elif NEED_SETLOCALE_MTSAFE # define setlocale_mtsafe rpl_setlocale # else # error "This file should only be compiled if NEED_SETLOCALE_IMPROVED || NEED_SETLOCALE_MTSAFE." # endif /* Like setlocale, but guaranteed to be multithread-safe if LOCALE == NULL. */ # if !SETLOCALE_NULL_ALL_MTSAFE || !SETLOCALE_NULL_ONE_MTSAFE /* i.e. if NEED_SETLOCALE_MTSAFE */ # if NEED_SETLOCALE_IMPROVED static # endif char * setlocale_mtsafe (int category, const char *locale) { if (locale == NULL) return (char *) setlocale_null (category); else return setlocale (category, locale); } # else /* !NEED_SETLOCALE_MTSAFE */ # define setlocale_mtsafe setlocale # endif /* NEED_SETLOCALE_MTSAFE */ # if NEED_SETLOCALE_IMPROVED /* Return string representation of locale category CATEGORY. */ static const char * category_to_name (int category) { const char *retval; switch (category) { case LC_COLLATE: retval = "LC_COLLATE"; break; case LC_CTYPE: retval = "LC_CTYPE"; break; case LC_MONETARY: retval = "LC_MONETARY"; break; case LC_NUMERIC: retval = "LC_NUMERIC"; break; case LC_TIME: retval = "LC_TIME"; break; case LC_MESSAGES: retval = "LC_MESSAGES"; break; default: /* If you have a better idea for a default value let me know. */ retval = "LC_XXX"; } return retval; } # if defined _WIN32 && ! defined __CYGWIN__ /* The native Windows setlocale() function expects locale names of the form "German" or "German_Germany" or "DEU", but not "de" or "de_DE". We need to convert the names from the form with ISO 639 language code and ISO 3166 country code to the form with English names or with three-letter identifier. The three-letter identifiers known by a Windows XP SP2 or SP3 are: AFK Afrikaans_South Africa.1252 ARA Arabic_Saudi Arabia.1256 ARB Arabic_Lebanon.1256 ARE Arabic_Egypt.1256 ARG Arabic_Algeria.1256 ARH Arabic_Bahrain.1256 ARI Arabic_Iraq.1256 ARJ Arabic_Jordan.1256 ARK Arabic_Kuwait.1256 ARL Arabic_Libya.1256 ARM Arabic_Morocco.1256 ARO Arabic_Oman.1256 ARQ Arabic_Qatar.1256 ARS Arabic_Syria.1256 ART Arabic_Tunisia.1256 ARU Arabic_U.A.E..1256 ARY Arabic_Yemen.1256 AZE Azeri (Latin)_Azerbaijan.1254 BEL Belarusian_Belarus.1251 BGR Bulgarian_Bulgaria.1251 BSB Bosnian_Bosnia and Herzegovina.1250 BSC Bosnian (Cyrillic)_Bosnia and Herzegovina.1250 (wrong encoding!) CAT Catalan_Spain.1252 CHH Chinese_Hong Kong S.A.R..950 CHI Chinese_Singapore.936 CHS Chinese_People's Republic of China.936 CHT Chinese_Taiwan.950 CSY Czech_Czech Republic.1250 CYM Welsh_United Kingdom.1252 DAN Danish_Denmark.1252 DEA German_Austria.1252 DEC German_Liechtenstein.1252 DEL German_Luxembourg.1252 DES German_Switzerland.1252 DEU German_Germany.1252 ELL Greek_Greece.1253 ENA English_Australia.1252 ENB English_Caribbean.1252 ENC English_Canada.1252 ENG English_United Kingdom.1252 ENI English_Ireland.1252 ENJ English_Jamaica.1252 ENL English_Belize.1252 ENP English_Republic of the Philippines.1252 ENS English_South Africa.1252 ENT English_Trinidad and Tobago.1252 ENU English_United States.1252 ENW English_Zimbabwe.1252 ENZ English_New Zealand.1252 ESA Spanish_Panama.1252 ESB Spanish_Bolivia.1252 ESC Spanish_Costa Rica.1252 ESD Spanish_Dominican Republic.1252 ESE Spanish_El Salvador.1252 ESF Spanish_Ecuador.1252 ESG Spanish_Guatemala.1252 ESH Spanish_Honduras.1252 ESI Spanish_Nicaragua.1252 ESL Spanish_Chile.1252 ESM Spanish_Mexico.1252 ESN Spanish_Spain.1252 ESO Spanish_Colombia.1252 ESP Spanish_Spain.1252 ESR Spanish_Peru.1252 ESS Spanish_Argentina.1252 ESU Spanish_Puerto Rico.1252 ESV Spanish_Venezuela.1252 ESY Spanish_Uruguay.1252 ESZ Spanish_Paraguay.1252 ETI Estonian_Estonia.1257 EUQ Basque_Spain.1252 FAR Farsi_Iran.1256 FIN Finnish_Finland.1252 FOS Faroese_Faroe Islands.1252 FPO Filipino_Philippines.1252 FRA French_France.1252 FRB French_Belgium.1252 FRC French_Canada.1252 FRL French_Luxembourg.1252 FRM French_Principality of Monaco.1252 FRS French_Switzerland.1252 FYN Frisian_Netherlands.1252 GLC Galician_Spain.1252 HEB Hebrew_Israel.1255 HRB Croatian_Bosnia and Herzegovina.1250 HRV Croatian_Croatia.1250 HUN Hungarian_Hungary.1250 IND Indonesian_Indonesia.1252 IRE Irish_Ireland.1252 ISL Icelandic_Iceland.1252 ITA Italian_Italy.1252 ITS Italian_Switzerland.1252 IUK Inuktitut (Latin)_Canada.1252 JPN Japanese_Japan.932 KKZ Kazakh_Kazakhstan.1251 KOR Korean_Korea.949 KYR Kyrgyz_Kyrgyzstan.1251 LBX Luxembourgish_Luxembourg.1252 LTH Lithuanian_Lithuania.1257 LVI Latvian_Latvia.1257 MKI FYRO Macedonian_Former Yugoslav Republic of Macedonia.1251 MON Mongolian_Mongolia.1251 MPD Mapudungun_Chile.1252 MSB Malay_Brunei Darussalam.1252 MSL Malay_Malaysia.1252 MWK Mohawk_Canada.1252 NLB Dutch_Belgium.1252 NLD Dutch_Netherlands.1252 NON Norwegian-Nynorsk_Norway.1252 NOR Norwegian (BokmÃ¥l)_Norway.1252 NSO Northern Sotho_South Africa.1252 PLK Polish_Poland.1250 PTB Portuguese_Brazil.1252 PTG Portuguese_Portugal.1252 QUB Quechua_Bolivia.1252 QUE Quechua_Ecuador.1252 QUP Quechua_Peru.1252 RMC Romansh_Switzerland.1252 ROM Romanian_Romania.1250 RUS Russian_Russia.1251 SKY Slovak_Slovakia.1250 SLV Slovenian_Slovenia.1250 SMA Sami (Southern)_Norway.1252 SMB Sami (Southern)_Sweden.1252 SME Sami (Northern)_Norway.1252 SMF Sami (Northern)_Sweden.1252 SMG Sami (Northern)_Finland.1252 SMJ Sami (Lule)_Norway.1252 SMK Sami (Lule)_Sweden.1252 SMN Sami (Inari)_Finland.1252 SMS Sami (Skolt)_Finland.1252 SQI Albanian_Albania.1250 SRB Serbian (Cyrillic)_Serbia and Montenegro.1251 SRL Serbian (Latin)_Serbia and Montenegro.1250 SRN Serbian (Cyrillic)_Bosnia and Herzegovina.1251 SRS Serbian (Latin)_Bosnia and Herzegovina.1250 SVE Swedish_Sweden.1252 SVF Swedish_Finland.1252 SWK Swahili_Kenya.1252 THA Thai_Thailand.874 TRK Turkish_Turkey.1254 TSN Tswana_South Africa.1252 TTT Tatar_Russia.1251 UKR Ukrainian_Ukraine.1251 URD Urdu_Islamic Republic of Pakistan.1256 USA English_United States.1252 UZB Uzbek (Latin)_Uzbekistan.1254 VIT Vietnamese_Viet Nam.1258 XHO Xhosa_South Africa.1252 ZHH Chinese_Hong Kong S.A.R..950 ZHI Chinese_Singapore.936 ZHM Chinese_Macau S.A.R..950 ZUL Zulu_South Africa.1252 */ /* Table from ISO 639 language code, optionally with country or script suffix, to English name. Keep in sync with the gl_locale_name_from_win32_LANGID function in localename.c! */ struct table_entry { const char *code; const char *english; }; static const struct table_entry language_table[] = { { "af", "Afrikaans" }, { "am", "Amharic" }, { "ar", "Arabic" }, { "arn", "Mapudungun" }, { "as", "Assamese" }, { "az@cyrillic", "Azeri (Cyrillic)" }, { "az@latin", "Azeri (Latin)" }, { "ba", "Bashkir" }, { "be", "Belarusian" }, { "ber", "Tamazight" }, { "ber@arabic", "Tamazight (Arabic)" }, { "ber@latin", "Tamazight (Latin)" }, { "bg", "Bulgarian" }, { "bin", "Edo" }, { "bn", "Bengali" }, { "bn_BD", "Bengali (Bangladesh)" }, { "bn_IN", "Bengali (India)" }, { "bnt", "Sutu" }, { "bo", "Tibetan" }, { "br", "Breton" }, { "bs", "BSB" }, /* "Bosnian (Latin)" */ { "bs@cyrillic", "BSC" }, /* Bosnian (Cyrillic) */ { "ca", "Catalan" }, { "chr", "Cherokee" }, { "co", "Corsican" }, { "cpe", "Hawaiian" }, { "cs", "Czech" }, { "cy", "Welsh" }, { "da", "Danish" }, { "de", "German" }, { "dsb", "Lower Sorbian" }, { "dv", "Divehi" }, { "el", "Greek" }, { "en", "English" }, { "es", "Spanish" }, { "et", "Estonian" }, { "eu", "Basque" }, { "fa", "Farsi" }, { "ff", "Fulfulde" }, { "fi", "Finnish" }, { "fo", "Faroese" }, /* "Faeroese" does not work */ { "fr", "French" }, { "fy", "Frisian" }, { "ga", "IRE" }, /* Gaelic (Ireland) */ { "gd", "Gaelic (Scotland)" }, { "gd", "Scottish Gaelic" }, { "gl", "Galician" }, { "gn", "Guarani" }, { "gsw", "Alsatian" }, { "gu", "Gujarati" }, { "ha", "Hausa" }, { "he", "Hebrew" }, { "hi", "Hindi" }, { "hr", "Croatian" }, { "hsb", "Upper Sorbian" }, { "hu", "Hungarian" }, { "hy", "Armenian" }, { "id", "Indonesian" }, { "ig", "Igbo" }, { "ii", "Yi" }, { "is", "Icelandic" }, { "it", "Italian" }, { "iu", "IUK" }, /* Inuktitut */ { "ja", "Japanese" }, { "ka", "Georgian" }, { "kk", "Kazakh" }, { "kl", "Greenlandic" }, { "km", "Cambodian" }, { "km", "Khmer" }, { "kn", "Kannada" }, { "ko", "Korean" }, { "kok", "Konkani" }, { "kr", "Kanuri" }, { "ks", "Kashmiri" }, { "ks_IN", "Kashmiri_India" }, { "ks_PK", "Kashmiri (Arabic)_Pakistan" }, { "ky", "Kyrgyz" }, { "la", "Latin" }, { "lb", "Luxembourgish" }, { "lo", "Lao" }, { "lt", "Lithuanian" }, { "lv", "Latvian" }, { "mi", "Maori" }, { "mk", "FYRO Macedonian" }, { "mk", "Macedonian" }, { "ml", "Malayalam" }, { "mn", "Mongolian" }, { "mni", "Manipuri" }, { "moh", "Mohawk" }, { "mr", "Marathi" }, { "ms", "Malay" }, { "mt", "Maltese" }, { "my", "Burmese" }, { "nb", "NOR" }, /* Norwegian BokmÃ¥l */ { "ne", "Nepali" }, { "nic", "Ibibio" }, { "nl", "Dutch" }, { "nn", "NON" }, /* Norwegian Nynorsk */ { "no", "Norwegian" }, { "nso", "Northern Sotho" }, { "nso", "Sepedi" }, { "oc", "Occitan" }, { "om", "Oromo" }, { "or", "Oriya" }, { "pa", "Punjabi" }, { "pap", "Papiamentu" }, { "pl", "Polish" }, { "prs", "Dari" }, { "ps", "Pashto" }, { "pt", "Portuguese" }, { "qu", "Quechua" }, { "qut", "K'iche'" }, { "rm", "Romansh" }, { "ro", "Romanian" }, { "ru", "Russian" }, { "rw", "Kinyarwanda" }, { "sa", "Sanskrit" }, { "sah", "Yakut" }, { "sd", "Sindhi" }, { "se", "Sami (Northern)" }, { "se", "Northern Sami" }, { "si", "Sinhalese" }, { "sk", "Slovak" }, { "sl", "Slovenian" }, { "sma", "Sami (Southern)" }, { "sma", "Southern Sami" }, { "smj", "Sami (Lule)" }, { "smj", "Lule Sami" }, { "smn", "Sami (Inari)" }, { "smn", "Inari Sami" }, { "sms", "Sami (Skolt)" }, { "sms", "Skolt Sami" }, { "so", "Somali" }, { "sq", "Albanian" }, { "sr", "Serbian (Latin)" }, { "sr@cyrillic", "SRB" }, /* Serbian (Cyrillic) */ { "sv", "Swedish" }, { "sw", "Swahili" }, { "syr", "Syriac" }, { "ta", "Tamil" }, { "te", "Telugu" }, { "tg", "Tajik" }, { "th", "Thai" }, { "ti", "Tigrinya" }, { "tk", "Turkmen" }, { "tl", "Filipino" }, { "tn", "Tswana" }, { "tr", "Turkish" }, { "ts", "Tsonga" }, { "tt", "Tatar" }, { "ug", "Uighur" }, { "uk", "Ukrainian" }, { "ur", "Urdu" }, { "uz", "Uzbek" }, { "uz", "Uzbek (Latin)" }, { "uz@cyrillic", "Uzbek (Cyrillic)" }, { "ve", "Venda" }, { "vi", "Vietnamese" }, { "wen", "Sorbian" }, { "wo", "Wolof" }, { "xh", "Xhosa" }, { "yi", "Yiddish" }, { "yo", "Yoruba" }, { "zh", "Chinese" }, { "zu", "Zulu" } }; /* Table from ISO 3166 country code to English name. Keep in sync with the gl_locale_name_from_win32_LANGID function in localename.c! */ static const struct table_entry country_table[] = { { "AE", "U.A.E." }, { "AF", "Afghanistan" }, { "AL", "Albania" }, { "AM", "Armenia" }, { "AN", "Netherlands Antilles" }, { "AR", "Argentina" }, { "AT", "Austria" }, { "AU", "Australia" }, { "AZ", "Azerbaijan" }, { "BA", "Bosnia and Herzegovina" }, { "BD", "Bangladesh" }, { "BE", "Belgium" }, { "BG", "Bulgaria" }, { "BH", "Bahrain" }, { "BN", "Brunei Darussalam" }, { "BO", "Bolivia" }, { "BR", "Brazil" }, { "BT", "Bhutan" }, { "BY", "Belarus" }, { "BZ", "Belize" }, { "CA", "Canada" }, { "CG", "Congo" }, { "CH", "Switzerland" }, { "CI", "Cote d'Ivoire" }, { "CL", "Chile" }, { "CM", "Cameroon" }, { "CN", "People's Republic of China" }, { "CO", "Colombia" }, { "CR", "Costa Rica" }, { "CS", "Serbia and Montenegro" }, { "CZ", "Czech Republic" }, { "DE", "Germany" }, { "DK", "Denmark" }, { "DO", "Dominican Republic" }, { "DZ", "Algeria" }, { "EC", "Ecuador" }, { "EE", "Estonia" }, { "EG", "Egypt" }, { "ER", "Eritrea" }, { "ES", "Spain" }, { "ET", "Ethiopia" }, { "FI", "Finland" }, { "FO", "Faroe Islands" }, { "FR", "France" }, { "GB", "United Kingdom" }, { "GD", "Caribbean" }, { "GE", "Georgia" }, { "GL", "Greenland" }, { "GR", "Greece" }, { "GT", "Guatemala" }, { "HK", "Hong Kong" }, { "HK", "Hong Kong S.A.R." }, { "HN", "Honduras" }, { "HR", "Croatia" }, { "HT", "Haiti" }, { "HU", "Hungary" }, { "ID", "Indonesia" }, { "IE", "Ireland" }, { "IL", "Israel" }, { "IN", "India" }, { "IQ", "Iraq" }, { "IR", "Iran" }, { "IS", "Iceland" }, { "IT", "Italy" }, { "JM", "Jamaica" }, { "JO", "Jordan" }, { "JP", "Japan" }, { "KE", "Kenya" }, { "KG", "Kyrgyzstan" }, { "KH", "Cambodia" }, { "KR", "South Korea" }, { "KW", "Kuwait" }, { "KZ", "Kazakhstan" }, { "LA", "Laos" }, { "LB", "Lebanon" }, { "LI", "Liechtenstein" }, { "LK", "Sri Lanka" }, { "LT", "Lithuania" }, { "LU", "Luxembourg" }, { "LV", "Latvia" }, { "LY", "Libya" }, { "MA", "Morocco" }, { "MC", "Principality of Monaco" }, { "MD", "Moldava" }, { "MD", "Moldova" }, { "ME", "Montenegro" }, { "MK", "Former Yugoslav Republic of Macedonia" }, { "ML", "Mali" }, { "MM", "Myanmar" }, { "MN", "Mongolia" }, { "MO", "Macau S.A.R." }, { "MT", "Malta" }, { "MV", "Maldives" }, { "MX", "Mexico" }, { "MY", "Malaysia" }, { "NG", "Nigeria" }, { "NI", "Nicaragua" }, { "NL", "Netherlands" }, { "NO", "Norway" }, { "NP", "Nepal" }, { "NZ", "New Zealand" }, { "OM", "Oman" }, { "PA", "Panama" }, { "PE", "Peru" }, { "PH", "Philippines" }, { "PK", "Islamic Republic of Pakistan" }, { "PL", "Poland" }, { "PR", "Puerto Rico" }, { "PT", "Portugal" }, { "PY", "Paraguay" }, { "QA", "Qatar" }, { "RE", "Reunion" }, { "RO", "Romania" }, { "RS", "Serbia" }, { "RU", "Russia" }, { "RW", "Rwanda" }, { "SA", "Saudi Arabia" }, { "SE", "Sweden" }, { "SG", "Singapore" }, { "SI", "Slovenia" }, { "SK", "Slovak" }, { "SN", "Senegal" }, { "SO", "Somalia" }, { "SR", "Suriname" }, { "SV", "El Salvador" }, { "SY", "Syria" }, { "TH", "Thailand" }, { "TJ", "Tajikistan" }, { "TM", "Turkmenistan" }, { "TN", "Tunisia" }, { "TR", "Turkey" }, { "TT", "Trinidad and Tobago" }, { "TW", "Taiwan" }, { "TZ", "Tanzania" }, { "UA", "Ukraine" }, { "US", "United States" }, { "UY", "Uruguay" }, { "VA", "Vatican" }, { "VE", "Venezuela" }, { "VN", "Viet Nam" }, { "YE", "Yemen" }, { "ZA", "South Africa" }, { "ZW", "Zimbabwe" } }; /* Given a string STRING, find the set of indices i such that TABLE[i].code is the given STRING. It is a range [lo,hi-1]. */ typedef struct { size_t lo; size_t hi; } range_t; static void search (const struct table_entry *table, size_t table_size, const char *string, range_t *result) { /* The table is sorted. Perform a binary search. */ size_t hi = table_size; size_t lo = 0; while (lo < hi) { /* Invariant: for i < lo, strcmp (table[i].code, string) < 0, for i >= hi, strcmp (table[i].code, string) > 0. */ size_t mid = (hi + lo) >> 1; /* >= lo, < hi */ int cmp = strcmp (table[mid].code, string); if (cmp < 0) lo = mid + 1; else if (cmp > 0) hi = mid; else { /* Found an i with strcmp (language_table[i].code, string) == 0. Find the entire interval of such i. */ { size_t i; for (i = mid; i > lo; ) { i--; if (strcmp (table[i].code, string) < 0) { lo = i + 1; break; } } } { size_t i; for (i = mid + 1; i < hi; i++) { if (strcmp (table[i].code, string) > 0) { hi = i; break; } } } /* The set of i with strcmp (language_table[i].code, string) == 0 is the interval [lo, hi-1]. */ break; } } result->lo = lo; result->hi = hi; } /* Like setlocale, but accept also locale names in the form ll or ll_CC, where ll is an ISO 639 language code and CC is an ISO 3166 country code. */ static char * setlocale_unixlike (int category, const char *locale) { char *result; char llCC_buf[64]; char ll_buf[64]; char CC_buf[64]; /* The native Windows implementation of setlocale understands the special locale name "C", but not "POSIX". Therefore map "POSIX" to "C". */ if (locale != NULL && strcmp (locale, "POSIX") == 0) locale = "C"; /* First, try setlocale with the original argument unchanged. */ result = setlocale_mtsafe (category, locale); if (result != NULL) return result; /* Otherwise, assume the argument is in the form language[_territory][.codeset][@modifier] and try to map it using the tables. */ if (strlen (locale) < sizeof (llCC_buf)) { /* Second try: Remove the codeset part. */ { const char *p = locale; char *q = llCC_buf; /* Copy the part before the dot. */ for (; *p != '\0' && *p != '.'; p++, q++) *q = *p; if (*p == '.') /* Skip the part up to the '@', if any. */ for (; *p != '\0' && *p != '@'; p++) ; /* Copy the part starting with '@', if any. */ for (; *p != '\0'; p++, q++) *q = *p; *q = '\0'; } /* llCC_buf now contains language[_territory][@modifier] */ if (strcmp (llCC_buf, locale) != 0) { result = setlocale (category, llCC_buf); if (result != NULL) return result; } /* Look it up in language_table. */ { range_t range; size_t i; search (language_table, sizeof (language_table) / sizeof (language_table[0]), llCC_buf, &range); for (i = range.lo; i < range.hi; i++) { /* Try the replacement in language_table[i]. */ result = setlocale (category, language_table[i].english); if (result != NULL) return result; } } /* Split language[_territory][@modifier] into ll_buf = language[@modifier] and CC_buf = territory */ { const char *underscore = strchr (llCC_buf, '_'); if (underscore != NULL) { const char *territory_start = underscore + 1; const char *territory_end = strchr (territory_start, '@'); if (territory_end == NULL) territory_end = territory_start + strlen (territory_start); memcpy (ll_buf, llCC_buf, underscore - llCC_buf); strcpy (ll_buf + (underscore - llCC_buf), territory_end); memcpy (CC_buf, territory_start, territory_end - territory_start); CC_buf[territory_end - territory_start] = '\0'; { /* Look up ll_buf in language_table and CC_buf in country_table. */ range_t language_range; search (language_table, sizeof (language_table) / sizeof (language_table[0]), ll_buf, &language_range); if (language_range.lo < language_range.hi) { range_t country_range; search (country_table, sizeof (country_table) / sizeof (country_table[0]), CC_buf, &country_range); if (country_range.lo < country_range.hi) { size_t i; size_t j; for (i = language_range.lo; i < language_range.hi; i++) for (j = country_range.lo; j < country_range.hi; j++) { /* Concatenate the replacements. */ const char *part1 = language_table[i].english; size_t part1_len = strlen (part1); const char *part2 = country_table[j].english; size_t part2_len = strlen (part2) + 1; char buf[64+64]; if (!(part1_len + 1 + part2_len <= sizeof (buf))) abort (); memcpy (buf, part1, part1_len); buf[part1_len] = '_'; memcpy (buf + part1_len + 1, part2, part2_len); /* Try the concatenated replacements. */ result = setlocale (category, buf); if (result != NULL) return result; } } /* Try omitting the country entirely. This may set a locale corresponding to the wrong country, but is better than failing entirely. */ { size_t i; for (i = language_range.lo; i < language_range.hi; i++) { /* Try only the language replacement. */ result = setlocale (category, language_table[i].english); if (result != NULL) return result; } } } } } } } /* Failed. */ return NULL; } # elif defined __ANDROID__ /* Like setlocale, but accept also the locale names "C" and "POSIX". */ static char * setlocale_unixlike (int category, const char *locale) { char *result = setlocale_mtsafe (category, locale); if (result == NULL) switch (category) { case LC_CTYPE: case LC_NUMERIC: case LC_TIME: case LC_COLLATE: case LC_MONETARY: case LC_MESSAGES: case LC_ALL: case LC_PAPER: case LC_NAME: case LC_ADDRESS: case LC_TELEPHONE: case LC_MEASUREMENT: if (locale == NULL || strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0) result = (char *) "C"; break; default: break; } return result; } # define setlocale setlocale_unixlike # else # define setlocale_unixlike setlocale_mtsafe # endif # if LC_MESSAGES == 1729 /* The system does not store an LC_MESSAGES locale category. Do it here. */ static char lc_messages_name[64] = "C"; /* Like setlocale, but support also LC_MESSAGES. */ static char * setlocale_single (int category, const char *locale) { if (category == LC_MESSAGES) { if (locale != NULL) { lc_messages_name[sizeof (lc_messages_name) - 1] = '\0'; strncpy (lc_messages_name, locale, sizeof (lc_messages_name) - 1); } return lc_messages_name; } else return setlocale_unixlike (category, locale); } # else # define setlocale_single setlocale_unixlike # endif # if defined __APPLE__ && defined __MACH__ /* Mapping from language to main territory where that language is spoken. */ static char const locales_with_principal_territory[][6 + 1] = { /* Language Main territory */ "ace_ID", /* Achinese Indonesia */ "af_ZA", /* Afrikaans South Africa */ "ak_GH", /* Akan Ghana */ "am_ET", /* Amharic Ethiopia */ "an_ES", /* Aragonese Spain */ "ang_GB", /* Old English Britain */ "arn_CL", /* Mapudungun Chile */ "as_IN", /* Assamese India */ "ast_ES", /* Asturian Spain */ "av_RU", /* Avaric Russia */ "awa_IN", /* Awadhi India */ "az_AZ", /* Azerbaijani Azerbaijan */ "ban_ID", /* Balinese Indonesia */ "be_BY", /* Belarusian Belarus */ "bej_SD", /* Beja Sudan */ "bem_ZM", /* Bemba Zambia */ "bg_BG", /* Bulgarian Bulgaria */ "bho_IN", /* Bhojpuri India */ "bi_VU", /* Bislama Vanuatu */ "bik_PH", /* Bikol Philippines */ "bin_NG", /* Bini Nigeria */ "bm_ML", /* Bambara Mali */ "bn_IN", /* Bengali India */ "bo_CN", /* Tibetan China */ "br_FR", /* Breton France */ "bs_BA", /* Bosnian Bosnia */ "bug_ID", /* Buginese Indonesia */ "ca_ES", /* Catalan Spain */ "ce_RU", /* Chechen Russia */ "ceb_PH", /* Cebuano Philippines */ "co_FR", /* Corsican France */ "cr_CA", /* Cree Canada */ /* Don't put "crh_UZ" or "crh_UA" here. That would be asking for fruitless political discussion. */ "cs_CZ", /* Czech Czech Republic */ "csb_PL", /* Kashubian Poland */ "cy_GB", /* Welsh Britain */ "da_DK", /* Danish Denmark */ "de_DE", /* German Germany */ "din_SD", /* Dinka Sudan */ "doi_IN", /* Dogri India */ "dsb_DE", /* Lower Sorbian Germany */ "dv_MV", /* Divehi Maldives */ "dz_BT", /* Dzongkha Bhutan */ "ee_GH", /* Éwé Ghana */ "el_GR", /* Greek Greece */ /* Don't put "en_GB" or "en_US" here. That would be asking for fruitless political discussion. */ "es_ES", /* Spanish Spain */ "et_EE", /* Estonian Estonia */ "fa_IR", /* Persian Iran */ "fi_FI", /* Finnish Finland */ "fil_PH", /* Filipino Philippines */ "fj_FJ", /* Fijian Fiji */ "fo_FO", /* Faroese Faeroe Islands */ "fon_BJ", /* Fon Benin */ "fr_FR", /* French France */ "fur_IT", /* Friulian Italy */ "fy_NL", /* Western Frisian Netherlands */ "ga_IE", /* Irish Ireland */ "gd_GB", /* Scottish Gaelic Britain */ "gon_IN", /* Gondi India */ "gsw_CH", /* Swiss German Switzerland */ "gu_IN", /* Gujarati India */ "he_IL", /* Hebrew Israel */ "hi_IN", /* Hindi India */ "hil_PH", /* Hiligaynon Philippines */ "hr_HR", /* Croatian Croatia */ "hsb_DE", /* Upper Sorbian Germany */ "ht_HT", /* Haitian Haiti */ "hu_HU", /* Hungarian Hungary */ "hy_AM", /* Armenian Armenia */ "id_ID", /* Indonesian Indonesia */ "ig_NG", /* Igbo Nigeria */ "ii_CN", /* Sichuan Yi China */ "ilo_PH", /* Iloko Philippines */ "is_IS", /* Icelandic Iceland */ "it_IT", /* Italian Italy */ "ja_JP", /* Japanese Japan */ "jab_NG", /* Hyam Nigeria */ "jv_ID", /* Javanese Indonesia */ "ka_GE", /* Georgian Georgia */ "kab_DZ", /* Kabyle Algeria */ "kaj_NG", /* Jju Nigeria */ "kam_KE", /* Kamba Kenya */ "kmb_AO", /* Kimbundu Angola */ "kcg_NG", /* Tyap Nigeria */ "kdm_NG", /* Kagoma Nigeria */ "kg_CD", /* Kongo Democratic Republic of Congo */ "kk_KZ", /* Kazakh Kazakhstan */ "kl_GL", /* Kalaallisut Greenland */ "km_KH", /* Central Khmer Cambodia */ "kn_IN", /* Kannada India */ "ko_KR", /* Korean Korea (South) */ "kok_IN", /* Konkani India */ "kr_NG", /* Kanuri Nigeria */ "kru_IN", /* Kurukh India */ "ky_KG", /* Kyrgyz Kyrgyzstan */ "lg_UG", /* Ganda Uganda */ "li_BE", /* Limburgish Belgium */ "lo_LA", /* Laotian Laos */ "lt_LT", /* Lithuanian Lithuania */ "lu_CD", /* Luba-Katanga Democratic Republic of Congo */ "lua_CD", /* Luba-Lulua Democratic Republic of Congo */ "luo_KE", /* Luo Kenya */ "lv_LV", /* Latvian Latvia */ "mad_ID", /* Madurese Indonesia */ "mag_IN", /* Magahi India */ "mai_IN", /* Maithili India */ "mak_ID", /* Makasar Indonesia */ "man_ML", /* Mandingo Mali */ "men_SL", /* Mende Sierra Leone */ "mfe_MU", /* Mauritian Creole Mauritius */ "mg_MG", /* Malagasy Madagascar */ "mi_NZ", /* Maori New Zealand */ "min_ID", /* Minangkabau Indonesia */ "mk_MK", /* Macedonian North Macedonia */ "ml_IN", /* Malayalam India */ "mn_MN", /* Mongolian Mongolia */ "mni_IN", /* Manipuri India */ "mos_BF", /* Mossi Burkina Faso */ "mr_IN", /* Marathi India */ "ms_MY", /* Malay Malaysia */ "mt_MT", /* Maltese Malta */ "mwr_IN", /* Marwari India */ "my_MM", /* Burmese Myanmar */ "na_NR", /* Nauru Nauru */ "nah_MX", /* Nahuatl Mexico */ "nap_IT", /* Neapolitan Italy */ "nb_NO", /* Norwegian BokmÃ¥l Norway */ "nds_DE", /* Low Saxon Germany */ "ne_NP", /* Nepali Nepal */ "nl_NL", /* Dutch Netherlands */ "nn_NO", /* Norwegian Nynorsk Norway */ "no_NO", /* Norwegian Norway */ "nr_ZA", /* South Ndebele South Africa */ "nso_ZA", /* Northern Sotho South Africa */ "ny_MW", /* Chichewa Malawi */ "nym_TZ", /* Nyamwezi Tanzania */ "nyn_UG", /* Nyankole Uganda */ "oc_FR", /* Occitan France */ "oj_CA", /* Ojibwa Canada */ "or_IN", /* Oriya India */ "pa_IN", /* Punjabi India */ "pag_PH", /* Pangasinan Philippines */ "pam_PH", /* Pampanga Philippines */ "pap_AN", /* Papiamento Netherlands Antilles - this line can be removed in 2018 */ "pbb_CO", /* Páez Colombia */ "pl_PL", /* Polish Poland */ "ps_AF", /* Pashto Afghanistan */ "pt_PT", /* Portuguese Portugal */ "raj_IN", /* Rajasthani India */ "rm_CH", /* Romansh Switzerland */ "rn_BI", /* Kirundi Burundi */ "ro_RO", /* Romanian Romania */ "ru_RU", /* Russian Russia */ "rw_RW", /* Kinyarwanda Rwanda */ "sa_IN", /* Sanskrit India */ "sah_RU", /* Yakut Russia */ "sas_ID", /* Sasak Indonesia */ "sat_IN", /* Santali India */ "sc_IT", /* Sardinian Italy */ "scn_IT", /* Sicilian Italy */ "sg_CF", /* Sango Central African Republic */ "shn_MM", /* Shan Myanmar */ "si_LK", /* Sinhala Sri Lanka */ "sid_ET", /* Sidamo Ethiopia */ "sk_SK", /* Slovak Slovakia */ "sl_SI", /* Slovenian Slovenia */ "sm_WS", /* Samoan Samoa */ "smn_FI", /* Inari Sami Finland */ "sms_FI", /* Skolt Sami Finland */ "so_SO", /* Somali Somalia */ "sq_AL", /* Albanian Albania */ "sr_RS", /* Serbian Serbia */ "srr_SN", /* Serer Senegal */ "suk_TZ", /* Sukuma Tanzania */ "sus_GN", /* Susu Guinea */ "sv_SE", /* Swedish Sweden */ "te_IN", /* Telugu India */ "tem_SL", /* Timne Sierra Leone */ "tet_ID", /* Tetum Indonesia */ "tg_TJ", /* Tajik Tajikistan */ "th_TH", /* Thai Thailand */ "ti_ER", /* Tigrinya Eritrea */ "tiv_NG", /* Tiv Nigeria */ "tk_TM", /* Turkmen Turkmenistan */ "tl_PH", /* Tagalog Philippines */ "to_TO", /* Tonga Tonga */ "tpi_PG", /* Tok Pisin Papua New Guinea */ "tr_TR", /* Turkish Turkey */ "tum_MW", /* Tumbuka Malawi */ "ug_CN", /* Uighur China */ "uk_UA", /* Ukrainian Ukraine */ "umb_AO", /* Umbundu Angola */ "ur_PK", /* Urdu Pakistan */ "uz_UZ", /* Uzbek Uzbekistan */ "ve_ZA", /* Venda South Africa */ "vi_VN", /* Vietnamese Vietnam */ "wa_BE", /* Walloon Belgium */ "wal_ET", /* Walamo Ethiopia */ "war_PH", /* Waray Philippines */ "wen_DE", /* Sorbian Germany */ "yao_MW", /* Yao Malawi */ "zap_MX" /* Zapotec Mexico */ }; /* Compare just the language part of two locale names. */ static int langcmp (const char *locale1, const char *locale2) { size_t locale1_len; size_t locale2_len; int cmp; { const char *locale1_end = strchr (locale1, '_'); if (locale1_end != NULL) locale1_len = locale1_end - locale1; else locale1_len = strlen (locale1); } { const char *locale2_end = strchr (locale2, '_'); if (locale2_end != NULL) locale2_len = locale2_end - locale2; else locale2_len = strlen (locale2); } if (locale1_len < locale2_len) { cmp = memcmp (locale1, locale2, locale1_len); if (cmp == 0) cmp = -1; } else { cmp = memcmp (locale1, locale2, locale2_len); if (locale1_len > locale2_len && cmp == 0) cmp = 1; } return cmp; } /* Given a locale name, return the main locale with the same language, or NULL if not found. For example: "fr_DE" -> "fr_FR". */ static const char * get_main_locale_with_same_language (const char *locale) { # define table locales_with_principal_territory /* The table is sorted. Perform a binary search. */ size_t hi = sizeof (table) / sizeof (table[0]); size_t lo = 0; while (lo < hi) { /* Invariant: for i < lo, langcmp (table[i], locale) < 0, for i >= hi, langcmp (table[i], locale) > 0. */ size_t mid = (hi + lo) >> 1; /* >= lo, < hi */ int cmp = langcmp (table[mid], locale); if (cmp < 0) lo = mid + 1; else if (cmp > 0) hi = mid; else { /* Found an i with langcmp (language_table[i], locale) == 0. Verify that it is the only such i. */ if (mid > lo && langcmp (table[mid - 1], locale) >= 0) abort (); if (mid + 1 < hi && langcmp (table[mid + 1], locale) <= 0) abort (); return table[mid]; } } # undef table return NULL; } /* Mapping from territory to main language that is spoken in that territory. */ static char const locales_with_principal_language[][6 + 1] = { /* This is based on the set of existing locales in glibc, with duplicates removed, and on the Wikipedia pages named "Languages of <territory>". If in doubt, use the locale that exists in macOS. For example, the only "*_IN" locale in macOS 10.13 is "hi_IN", so use that. */ /* A useful shell function for producing a line of this table is: func_line () { # Usage: func_line ll_CC ll=`echo "$1" | sed -e 's|_.*||'` cc=`echo "$1" | sed -e 's|^.*_||'` llx=`sed -n -e "s|^${ll} ||p" < gettext-tools/doc/ISO_639` ccx=`expand gettext-tools/doc/ISO_3166 | sed -n -e "s|^${cc} *||p"` echo " \"$1\", /$X* ${llx} ${ccx} *$X/" } */ /* Main language Territory */ "ca_AD", /* Catalan Andorra */ "ar_AE", /* Arabic United Arab Emirates */ "ps_AF", /* Pashto Afghanistan */ "en_AG", /* English Antigua and Barbuda */ "sq_AL", /* Albanian Albania */ "hy_AM", /* Armenian Armenia */ "pap_AN", /* Papiamento Netherlands Antilles - this line can be removed in 2018 */ "pt_AO", /* Portuguese Angola */ "es_AR", /* Spanish Argentina */ "de_AT", /* German Austria */ "en_AU", /* English Australia */ /* Aruba has two official languages: "nl_AW", "pap_AW". */ "az_AZ", /* Azerbaijani Azerbaijan */ "bs_BA", /* Bosnian Bosnia */ "bn_BD", /* Bengali Bangladesh */ "nl_BE", /* Dutch Belgium */ "fr_BF", /* French Burkina Faso */ "bg_BG", /* Bulgarian Bulgaria */ "ar_BH", /* Arabic Bahrain */ "rn_BI", /* Kirundi Burundi */ "fr_BJ", /* French Benin */ "es_BO", /* Spanish Bolivia */ "pt_BR", /* Portuguese Brazil */ "dz_BT", /* Dzongkha Bhutan */ "en_BW", /* English Botswana */ "be_BY", /* Belarusian Belarus */ "en_CA", /* English Canada */ "fr_CD", /* French Democratic Republic of Congo */ "sg_CF", /* Sango Central African Republic */ "de_CH", /* German Switzerland */ "es_CL", /* Spanish Chile */ "zh_CN", /* Chinese China */ "es_CO", /* Spanish Colombia */ "es_CR", /* Spanish Costa Rica */ "es_CU", /* Spanish Cuba */ /* Curaçao has three official languages: "nl_CW", "pap_CW", "en_CW". */ "el_CY", /* Greek Cyprus */ "cs_CZ", /* Czech Czech Republic */ "de_DE", /* German Germany */ /* Djibouti has two official languages: "ar_DJ" and "fr_DJ". */ "da_DK", /* Danish Denmark */ "es_DO", /* Spanish Dominican Republic */ "ar_DZ", /* Arabic Algeria */ "es_EC", /* Spanish Ecuador */ "et_EE", /* Estonian Estonia */ "ar_EG", /* Arabic Egypt */ "ti_ER", /* Tigrinya Eritrea */ "es_ES", /* Spanish Spain */ "am_ET", /* Amharic Ethiopia */ "fi_FI", /* Finnish Finland */ /* Fiji has three official languages: "en_FJ", "fj_FJ", "hif_FJ". */ "fo_FO", /* Faroese Faeroe Islands */ "fr_FR", /* French France */ "en_GB", /* English Britain */ "ka_GE", /* Georgian Georgia */ "en_GH", /* English Ghana */ "kl_GL", /* Kalaallisut Greenland */ "fr_GN", /* French Guinea */ "el_GR", /* Greek Greece */ "es_GT", /* Spanish Guatemala */ "zh_HK", /* Chinese Hong Kong */ "es_HN", /* Spanish Honduras */ "hr_HR", /* Croatian Croatia */ "ht_HT", /* Haitian Haiti */ "hu_HU", /* Hungarian Hungary */ "id_ID", /* Indonesian Indonesia */ "en_IE", /* English Ireland */ "he_IL", /* Hebrew Israel */ "hi_IN", /* Hindi India */ "ar_IQ", /* Arabic Iraq */ "fa_IR", /* Persian Iran */ "is_IS", /* Icelandic Iceland */ "it_IT", /* Italian Italy */ "ar_JO", /* Arabic Jordan */ "ja_JP", /* Japanese Japan */ "sw_KE", /* Swahili Kenya */ "ky_KG", /* Kyrgyz Kyrgyzstan */ "km_KH", /* Central Khmer Cambodia */ "ko_KR", /* Korean Korea (South) */ "ar_KW", /* Arabic Kuwait */ "kk_KZ", /* Kazakh Kazakhstan */ "lo_LA", /* Laotian Laos */ "ar_LB", /* Arabic Lebanon */ "de_LI", /* German Liechtenstein */ "si_LK", /* Sinhala Sri Lanka */ "lt_LT", /* Lithuanian Lithuania */ /* Luxembourg has three official languages: "lb_LU", "fr_LU", "de_LU". */ "lv_LV", /* Latvian Latvia */ "ar_LY", /* Arabic Libya */ "ar_MA", /* Arabic Morocco */ "sr_ME", /* Serbian Montenegro */ "mg_MG", /* Malagasy Madagascar */ "mk_MK", /* Macedonian North Macedonia */ "fr_ML", /* French Mali */ "my_MM", /* Burmese Myanmar */ "mn_MN", /* Mongolian Mongolia */ "mt_MT", /* Maltese Malta */ "mfe_MU", /* Mauritian Creole Mauritius */ "dv_MV", /* Divehi Maldives */ "ny_MW", /* Chichewa Malawi */ "es_MX", /* Spanish Mexico */ "ms_MY", /* Malay Malaysia */ "en_NG", /* English Nigeria */ "es_NI", /* Spanish Nicaragua */ "nl_NL", /* Dutch Netherlands */ "no_NO", /* Norwegian Norway */ "ne_NP", /* Nepali Nepal */ "na_NR", /* Nauru Nauru */ "niu_NU", /* Niuean Niue */ "en_NZ", /* English New Zealand */ "ar_OM", /* Arabic Oman */ "es_PA", /* Spanish Panama */ "es_PE", /* Spanish Peru */ "tpi_PG", /* Tok Pisin Papua New Guinea */ "fil_PH", /* Filipino Philippines */ "pa_PK", /* Punjabi Pakistan */ "pl_PL", /* Polish Poland */ "es_PR", /* Spanish Puerto Rico */ "pt_PT", /* Portuguese Portugal */ "es_PY", /* Spanish Paraguay */ "ar_QA", /* Arabic Qatar */ "ro_RO", /* Romanian Romania */ "sr_RS", /* Serbian Serbia */ "ru_RU", /* Russian Russia */ "rw_RW", /* Kinyarwanda Rwanda */ "ar_SA", /* Arabic Saudi Arabia */ "en_SC", /* English Seychelles */ "ar_SD", /* Arabic Sudan */ "sv_SE", /* Swedish Sweden */ "en_SG", /* English Singapore */ "sl_SI", /* Slovenian Slovenia */ "sk_SK", /* Slovak Slovakia */ "en_SL", /* English Sierra Leone */ "fr_SN", /* French Senegal */ "so_SO", /* Somali Somalia */ "ar_SS", /* Arabic South Sudan */ "es_SV", /* Spanish El Salvador */ "ar_SY", /* Arabic Syria */ "th_TH", /* Thai Thailand */ "tg_TJ", /* Tajik Tajikistan */ "tk_TM", /* Turkmen Turkmenistan */ "ar_TN", /* Arabic Tunisia */ "to_TO", /* Tonga Tonga */ "tr_TR", /* Turkish Turkey */ "zh_TW", /* Chinese Taiwan */ "sw_TZ", /* Swahili Tanzania */ "uk_UA", /* Ukrainian Ukraine */ "lg_UG", /* Ganda Uganda */ "en_US", /* English United States of America */ "es_UY", /* Spanish Uruguay */ "uz_UZ", /* Uzbek Uzbekistan */ "es_VE", /* Spanish Venezuela */ "vi_VN", /* Vietnamese Vietnam */ "bi_VU", /* Bislama Vanuatu */ "sm_WS", /* Samoan Samoa */ "ar_YE", /* Arabic Yemen */ "en_ZA", /* English South Africa */ "en_ZM", /* English Zambia */ "en_ZW" /* English Zimbabwe */ }; /* Compare just the territory part of two locale names. */ static int terrcmp (const char *locale1, const char *locale2) { const char *territory1 = strrchr (locale1, '_') + 1; const char *territory2 = strrchr (locale2, '_') + 1; return strcmp (territory1, territory2); } /* Given a locale name, return the locale corresponding to the main language with the same territory, or NULL if not found. For example: "fr_DE" -> "de_DE". */ static const char * get_main_locale_with_same_territory (const char *locale) { if (strrchr (locale, '_') != NULL) { # define table locales_with_principal_language /* The table is sorted. Perform a binary search. */ size_t hi = sizeof (table) / sizeof (table[0]); size_t lo = 0; while (lo < hi) { /* Invariant: for i < lo, terrcmp (table[i], locale) < 0, for i >= hi, terrcmp (table[i], locale) > 0. */ size_t mid = (hi + lo) >> 1; /* >= lo, < hi */ int cmp = terrcmp (table[mid], locale); if (cmp < 0) lo = mid + 1; else if (cmp > 0) hi = mid; else { /* Found an i with terrcmp (language_table[i], locale) == 0. Verify that it is the only such i. */ if (mid > lo && terrcmp (table[mid - 1], locale) >= 0) abort (); if (mid + 1 < hi && terrcmp (table[mid + 1], locale) <= 0) abort (); return table[mid]; } } # undef table } return NULL; } # endif char * setlocale_improved (int category, const char *locale) { if (locale != NULL && locale[0] == '\0') { /* A request to the set the current locale to the default locale. */ if (category == LC_ALL) { /* Set LC_CTYPE first. Then the other categories. */ static int const categories[] = { LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES }; char *saved_locale; const char *base_name; unsigned int i; /* Back up the old locale, in case one of the steps fails. */ saved_locale = setlocale (LC_ALL, NULL); if (saved_locale == NULL) return NULL; saved_locale = strdup (saved_locale); if (saved_locale == NULL) return NULL; /* Set LC_CTYPE category. Set all other categories (except possibly LC_MESSAGES) to the same value in the same call; this is likely to save calls. */ base_name = gl_locale_name_environ (LC_CTYPE, category_to_name (LC_CTYPE)); if (base_name == NULL) base_name = gl_locale_name_default (); if (setlocale_unixlike (LC_ALL, base_name) != NULL) { /* LC_CTYPE category already set. */ i = 1; } else { /* On Mac OS X, "UTF-8" is a valid locale name for LC_CTYPE but not for LC_ALL. Therefore this call may fail. So, try another base_name. */ base_name = "C"; if (setlocale_unixlike (LC_ALL, base_name) == NULL) goto fail; i = 0; } # if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows, setlocale(LC_ALL,...) may succeed but set the LC_CTYPE category to an invalid value ("C") when it does not support the specified encoding. Report a failure instead. */ if (strchr (base_name, '.') != NULL && strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) goto fail; # endif for (; i < sizeof (categories) / sizeof (categories[0]); i++) { int cat = categories[i]; const char *name; name = gl_locale_name_environ (cat, category_to_name (cat)); if (name == NULL) name = gl_locale_name_default (); /* If name is the same as base_name, it has already been set through the setlocale call before the loop. */ if (strcmp (name, base_name) != 0 # if LC_MESSAGES == 1729 || cat == LC_MESSAGES # endif ) if (setlocale_single (cat, name) == NULL) # if defined __APPLE__ && defined __MACH__ { /* On Mac OS X 10.13, some locales can be set through System Preferences > Language & Region, that are not supported by libc. The system's setlocale() falls back to "C" for these locale categories. We can do better, by trying an existing locale with the same language or an existing locale with the same territory. If we can't, print a warning, to limit user expectations. */ int warn = 0; if (cat == LC_CTYPE) warn = (setlocale_single (cat, "UTF-8") == NULL); else if (cat == LC_MESSAGES) { # if HAVE_CFLOCALECOPYPREFERREDLANGUAGES || HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */ /* Take the primary language preference. */ # if HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* MacOS X 10.5 or newer */ CFArrayRef prefArray = CFLocaleCopyPreferredLanguages (); # elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */ CFTypeRef preferences = CFPreferencesCopyAppValue (CFSTR ("AppleLanguages"), kCFPreferencesCurrentApplication); if (preferences != NULL && CFGetTypeID (preferences) == CFArrayGetTypeID ()) { CFArrayRef prefArray = (CFArrayRef)preferences; # endif int n = CFArrayGetCount (prefArray); if (n > 0) { char buf[256]; CFTypeRef element = CFArrayGetValueAtIndex (prefArray, 0); if (element != NULL && CFGetTypeID (element) == CFStringGetTypeID () && CFStringGetCString ((CFStringRef)element, buf, sizeof (buf), kCFStringEncodingASCII)) { /* Remove the country. E.g. "zh-Hans-DE" -> "zh-Hans". */ char *last_minus = strrchr (buf, '-'); if (last_minus != NULL) *last_minus = '\0'; /* Convert to Unix locale name. E.g. "zh-Hans" -> "zh_CN". */ gl_locale_name_canonicalize (buf); /* Try setlocale with this value. */ if (setlocale_single (cat, buf) == NULL) { const char *last_try = get_main_locale_with_same_language (buf); if (last_try == NULL || setlocale_single (cat, last_try) == NULL) warn = 1; } } } # if HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* MacOS X 10.5 or newer */ CFRelease (prefArray); # elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */ } # endif # else const char *last_try = get_main_locale_with_same_language (name); if (last_try == NULL || setlocale_single (cat, last_try) == NULL) warn = 1; # endif } else { /* For LC_NUMERIC, the application should use the locale properties kCFLocaleDecimalSeparator, kCFLocaleGroupingSeparator. For LC_TIME, the application should use the locale property kCFLocaleCalendarIdentifier. For LC_COLLATE, the application should use the locale properties kCFLocaleCollationIdentifier, kCFLocaleCollatorIdentifier. For LC_MONETARY, the applicationshould use the locale properties kCFLocaleCurrencySymbol, kCFLocaleCurrencyCode. But since most applications don't have macOS specific code like this, try an existing locale with the same territory. */ const char *last_try = get_main_locale_with_same_territory (name); if (last_try == NULL || setlocale_single (cat, last_try) == NULL) warn = 1; } if (warn) { /* Warn only if the environment variable SETLOCALE_VERBOSE is set. Otherwise these warnings are just annoyances, since normal users won't invoke 'localedef'. */ const char *verbose = getenv ("SETLOCALE_VERBOSE"); if (verbose != NULL && verbose[0] != '\0') fprintf (stderr, "Warning: Failed to set locale category %s to %s.\n", category_to_name (cat), name); } } # else goto fail; # endif } /* All steps were successful. */ free (saved_locale); return setlocale (LC_ALL, NULL); fail: if (saved_locale[0] != '\0') /* don't risk an endless recursion */ setlocale (LC_ALL, saved_locale); free (saved_locale); return NULL; } else { const char *name = gl_locale_name_environ (category, category_to_name (category)); if (name == NULL) name = gl_locale_name_default (); return setlocale_single (category, name); } } else { # if defined _WIN32 && ! defined __CYGWIN__ if (category == LC_ALL && locale != NULL && strchr (locale, '.') != NULL) { char *saved_locale; /* Back up the old locale. */ saved_locale = setlocale (LC_ALL, NULL); if (saved_locale == NULL) return NULL; saved_locale = strdup (saved_locale); if (saved_locale == NULL) return NULL; if (setlocale_unixlike (LC_ALL, locale) == NULL) { free (saved_locale); return NULL; } /* On native Windows, setlocale(LC_ALL,...) may succeed but set the LC_CTYPE category to an invalid value ("C") when it does not support the specified encoding. Report a failure instead. */ if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) { if (saved_locale[0] != '\0') /* don't risk an endless recursion */ setlocale (LC_ALL, saved_locale); free (saved_locale); return NULL; } /* It was really successful. */ free (saved_locale); return setlocale (LC_ALL, NULL); } else # endif return setlocale_single (category, locale); } } # endif /* NEED_SETLOCALE_IMPROVED */ #endif ������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-ignore-value.c�����������������������������������������������0000664�0001750�0001750�00000003206�14670377436�022612� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test the "ignore-value" module. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ #include <config.h> #include "ignore-value.h" #include <stdio.h> #include "attribute.h" struct s { int i; }; NODISCARD static char doChar (void); NODISCARD static int doInt (void); NODISCARD static off_t doOff (void); NODISCARD static void *doPtr (void); NODISCARD static struct s doStruct (void); static char doChar (void) { return 0; } static int doInt (void) { return 0; } static off_t doOff (void) { return 0; } static void * doPtr (void) { return NULL; } static struct s doStruct (void) { static struct s s1; return s1; } int main (void) { /* If this test can compile with -Werror and the same warnings as the rest of the project, then we are properly silencing warnings about ignored return values. */ ignore_value (doChar ()); ignore_value (doInt ()); ignore_value (doOff ()); ignore_value (doPtr ()); ignore_value (doStruct ()); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fread.c������������������������������������������������������0000664�0001750�0001750�00000005161�14670377436�021300� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of fread() function. Copyright (C) 2011-2021 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, 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include "signature.h" SIGNATURE_CHECK (fread, size_t, (void *, size_t, size_t, FILE *)); #include <errno.h> #include <fcntl.h> #include <unistd.h> #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # include "msvc-inval.h" #endif #include "macros.h" int main (int argc, char **argv) { const char *filename = "test-fread.txt"; /* We don't have an fread() function that installs an invalid parameter handler so far. So install that handler here, explicitly. */ #if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING gl_msvc_inval_ensure_handler (); #endif /* Prepare a file. */ { const char text[] = "hello world"; int fd = open (filename, O_RDWR | O_CREAT | O_TRUNC, 0600); ASSERT (fd >= 0); ASSERT (write (fd, text, sizeof (text)) == sizeof (text)); ASSERT (close (fd) == 0); } /* Test that fread() sets errno if someone else closes the stream fd behind the back of stdio. */ { FILE *fp = fopen (filename, "r"); char buf[5]; ASSERT (fp != NULL); ASSERT (close (fileno (fp)) == 0); errno = 0; ASSERT (fread (buf, 1, sizeof (buf), fp) == 0); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } /* Test that fread() sets errno if the stream was constructed with an invalid file descriptor. */ { FILE *fp = fdopen (-1, "r"); if (fp != NULL) { char buf[1]; errno = 0; ASSERT (fread (buf, 1, 1, fp) == 0); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } } { FILE *fp; close (99); fp = fdopen (99, "r"); if (fp != NULL) { char buf[1]; errno = 0; ASSERT (fread (buf, 1, 1, fp) == 0); ASSERT (errno == EBADF); ASSERT (ferror (fp)); fclose (fp); } } /* Clean up. */ unlink (filename); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fnmatch.c����������������������������������������������������0000664�0001750�0001750�00000004222�14670377436�021634� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of fnmatch string matching function. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson <simon@josefsson.org>, 2009. */ #include <config.h> #include <fnmatch.h> #include "signature.h" SIGNATURE_CHECK (fnmatch, int, (char const *, char const *, int)); #include "macros.h" int main () { int res; ASSERT (res = fnmatch ("", "", 0) == 0); ASSERT (res = fnmatch ("*", "", 0) == 0); ASSERT (res = fnmatch ("*", "foo", 0) == 0); ASSERT (res = fnmatch ("*", "bar", 0) == 0); ASSERT (res = fnmatch ("*", "*", 0) == 0); ASSERT (res = fnmatch ("**", "f", 0) == 0); ASSERT (res = fnmatch ("**", "foo.txt", 0) == 0); ASSERT (res = fnmatch ("*.*", "foo.txt", 0) == 0); ASSERT (res = fnmatch ("foo*.txt", "foobar.txt", 0) == 0); ASSERT (res = fnmatch ("foo.txt", "foo.txt", 0) == 0); ASSERT (res = fnmatch ("foo\\.txt", "foo.txt", 0) == 0); ASSERT (res = fnmatch ("foo\\.txt", "foo.txt", FNM_NOESCAPE) == FNM_NOMATCH); /* Verify that an unmatched [ is treated as a literal, as POSIX requires. This test ensures that glibc Bugzilla bug #12378 stays fixed. */ ASSERT (res = fnmatch ("[/b", "[/b", 0) == 0); ASSERT (fnmatch ("[[:alpha:]'[:alpha:]\0]", "a", 0) == FNM_NOMATCH); ASSERT (fnmatch ("[a[.\0.]]", "a", 0) == FNM_NOMATCH); #ifdef FNM_EXTMATCH ASSERT (fnmatch ("**(!()", "**(!()", FNM_EXTMATCH) == 0); #endif #ifdef FNM_LEADING_DIR ASSERT (fnmatch ("x?y", "x/y/z", FNM_PATHNAME | FNM_LEADING_DIR) == FNM_NOMATCH); #endif return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-perror.sh����������������������������������������������������0000775�0001750�0001750�00000001757�14670377436�021732� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh : ${srcdir=.} . "$srcdir/init.sh"; path_prepend_ . # Test NULL prefix. Result should not contain a number, except in lines that # start with 'EDC' (IBM z/OS libc produces an error identifier before the # error message). ${CHECKER} test-perror 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror.tmp grep -v '^EDC' t-perror.tmp | grep '[0-9]' > /dev/null \ && fail_ "result should not contain a number" # Test empty prefix. Result should be the same. ${CHECKER} test-perror '' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror1.tmp diff t-perror.tmp t-perror1.tmp \ || fail_ "empty prefix should behave like NULL argument" # Test non-empty prefix. ${CHECKER} test-perror foo 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror3.tmp sed -e 's/^/foo: /' < t-perror.tmp > t-perror2.tmp diff t-perror2.tmp t-perror3.tmp || fail_ "prefix applied incorrectly" # Test exit status. ${CHECKER} test-perror >out 2>/dev/null || fail_ "unexpected exit status" test -s out && fail_ "unexpected output" Exit 0 �����������������kbuild-3608/src/grep/gnulib-tests/test-dfa-match.sh�������������������������������������������������0000775�0001750�0001750�00000002623�14670377431�022231� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would fail with grep-2.21's dfa.c. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src # Add "." to PATH for the use of test-dfa-match-aux. path_prepend_ . if (type timeout) >/dev/null 2>&1; then # Busybox's timeout required -t until its 1.30.0 release on 2018-12-31, # after which it became compatible with coreutils' timeout. if timeout --help 2>&1 | grep BusyBox && timeout -t 0 true; then timeout_10='timeout -t 10' else timeout_10='timeout 10' fi else timeout_10= fi fail=0 ${CHECKER} test-dfa-match-aux a ba 0 > out || fail=1 compare /dev/null out || fail=1 in=$(printf "bb\nbb") $timeout_10 ${CHECKER} test-dfa-match-aux a "$in" 1 > out || fail=1 compare /dev/null out || fail=1 Exit $fail �������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-open.h�������������������������������������������������������0000664�0001750�0001750�00000010037�14670377436�021163� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of opening a file descriptor. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ /* Make test_open always inline if we're using Fortify, which defines __always_inline to do that. Do nothing otherwise. This works around a glibc bug whereby 'open' cannot be used as a function pointer when _FORTIFY_SOURCE is positive. */ #if __GLIBC__ && defined __always_inline # define ALWAYS_INLINE __always_inline #else # define ALWAYS_INLINE #endif /* This file is designed to test both open(n,buf[,mode]) and openat(AT_FDCWD,n,buf[,mode]). FUNC is the function to test. Assumes that BASE and ASSERT are already defined, and that appropriate headers are already included. If PRINT, warn before skipping symlink tests with status 77. */ static ALWAYS_INLINE int test_open (int (*func) (char const *, int, ...), bool print) { int fd; /* Remove anything from prior partial run. */ unlink (BASE "file"); unlink (BASE "e.exe"); unlink (BASE "link"); /* Cannot create directory. */ errno = 0; ASSERT (func ("nonexist.ent/", O_CREAT | O_RDONLY, 0600) == -1); ASSERT (errno == ENOTDIR || errno == EISDIR || errno == ENOENT || errno == EINVAL); /* Create a regular file. */ fd = func (BASE "file", O_CREAT | O_RDONLY, 0600); ASSERT (0 <= fd); ASSERT (close (fd) == 0); /* Create an executable regular file. */ fd = func (BASE "e.exe", O_CREAT | O_RDONLY, 0700); ASSERT (0 <= fd); ASSERT (close (fd) == 0); /* Trailing slash handling. */ errno = 0; ASSERT (func (BASE "file/", O_RDONLY) == -1); ASSERT (errno == ENOTDIR || errno == EISDIR || errno == EINVAL); /* Directories cannot be opened for writing. */ errno = 0; ASSERT (func (".", O_WRONLY) == -1); ASSERT (errno == EISDIR || errno == EACCES); /* /dev/null must exist, and be writable. */ fd = func ("/dev/null", O_RDONLY); ASSERT (0 <= fd); { char c; ASSERT (read (fd, &c, 1) == 0); } ASSERT (close (fd) == 0); fd = func ("/dev/null", O_WRONLY); ASSERT (0 <= fd); ASSERT (write (fd, "c", 1) == 1); ASSERT (close (fd) == 0); /* Although O_NONBLOCK on regular files can be ignored, it must not cause a failure. */ fd = func (BASE "file", O_NONBLOCK | O_RDONLY); ASSERT (0 <= fd); ASSERT (close (fd) == 0); /* O_CLOEXEC must be honoured. */ if (O_CLOEXEC) { /* Since the O_CLOEXEC handling goes through a special code path at its first invocation, test it twice. */ int i; for (i = 0; i < 2; i++) { int flags; fd = func (BASE "file", O_CLOEXEC | O_RDONLY); ASSERT (0 <= fd); flags = fcntl (fd, F_GETFD); ASSERT (flags >= 0); ASSERT ((flags & FD_CLOEXEC) != 0); ASSERT (close (fd) == 0); } } /* Symlink handling, where supported. */ if (symlink (BASE "file", BASE "link") != 0) { ASSERT (unlink (BASE "file") == 0); if (print) fputs ("skipping test: symlinks not supported on this file system\n", stderr); return 77; } errno = 0; ASSERT (func (BASE "link/", O_RDONLY) == -1); ASSERT (errno == ENOTDIR); fd = func (BASE "link", O_RDONLY); ASSERT (0 <= fd); ASSERT (close (fd) == 0); /* Cleanup. */ ASSERT (unlink (BASE "file") == 0); ASSERT (unlink (BASE "e.exe") == 0); ASSERT (unlink (BASE "link") == 0); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-wchar.c������������������������������������������������������0000664�0001750�0001750�00000002136�14670377436�021322� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <wchar.h> substitute. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <wchar.h> #include "verify.h" /* Check that the types wchar_t and wint_t are defined. */ wchar_t a = 'c'; wint_t b = 'x'; /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); int main (void) { return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-sched.c������������������������������������������������������0000664�0001750�0001750�00000002303�14670377436�021300� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of <sched.h> substitute. Copyright (C) 2008-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ #include <config.h> #include <sched.h> /* Check that 'struct sched_param' is defined. */ static struct sched_param a; /* Check that the SCHED_* macros are defined and compile-time constants. */ int b[] = { SCHED_FIFO, SCHED_RR, SCHED_OTHER }; /* Check that the types are all defined. */ pid_t t1; static int f1; int main () { /* Check fields of 'struct sched_param'. */ f1 = a.sched_priority; return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-stat.h�������������������������������������������������������0000664�0001750�0001750�00000006423�14670377436�021201� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Tests of stat. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ /* This file is designed to test both stat(n,buf) and fstatat(AT_FDCWD,n,buf,0). FUNC is the function to test. Assumes that BASE and ASSERT are already defined, and that appropriate headers are already included. If PRINT, warn before skipping symlink tests with status 77. */ static int test_stat_func (int (*func) (char const *, struct stat *), bool print) { struct stat st1; struct stat st2; char *cwd = getcwd (NULL, 0); ASSERT (cwd); ASSERT (func (".", &st1) == 0); ASSERT (func ("./", &st2) == 0); #if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES) ASSERT (SAME_INODE (st1, st2)); #endif ASSERT (func (cwd, &st2) == 0); #if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES) ASSERT (SAME_INODE (st1, st2)); #endif ASSERT (func ("/", &st1) == 0); ASSERT (func ("///", &st2) == 0); #if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES) ASSERT (SAME_INODE (st1, st2)); #endif errno = 0; ASSERT (func ("", &st1) == -1); ASSERT (errno == ENOENT); errno = 0; ASSERT (func ("nosuch", &st1) == -1); ASSERT (errno == ENOENT); errno = 0; ASSERT (func ("nosuch/", &st1) == -1); ASSERT (errno == ENOENT); ASSERT (close (creat (BASE "file", 0600)) == 0); ASSERT (func (BASE "file", &st1) == 0); errno = 0; ASSERT (func (BASE "file/", &st1) == -1); ASSERT (errno == ENOTDIR); /* Now for some symlink tests, where supported. We set up: link1 -> directory link2 -> file link3 -> dangling link4 -> loop then test behavior with trailing slash. */ if (symlink (".", BASE "link1") != 0) { ASSERT (unlink (BASE "file") == 0); if (print) fputs ("skipping test: symlinks not supported on this file system\n", stderr); return 77; } ASSERT (symlink (BASE "file", BASE "link2") == 0); ASSERT (symlink (BASE "nosuch", BASE "link3") == 0); ASSERT (symlink (BASE "link4", BASE "link4") == 0); ASSERT (func (BASE "link1/", &st1) == 0); ASSERT (S_ISDIR (st1.st_mode)); errno = 0; ASSERT (func (BASE "link2/", &st1) == -1); ASSERT (errno == ENOTDIR); errno = 0; ASSERT (func (BASE "link3/", &st1) == -1); ASSERT (errno == ENOENT); errno = 0; ASSERT (func (BASE "link4/", &st1) == -1); ASSERT (errno == ELOOP); /* Cleanup. */ ASSERT (unlink (BASE "file") == 0); ASSERT (unlink (BASE "link1") == 0); ASSERT (unlink (BASE "link2") == 0); ASSERT (unlink (BASE "link3") == 0); ASSERT (unlink (BASE "link4") == 0); free (cwd); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/putenv.c����������������������������������������������������������0000664�0001750�0001750�00000012006�14670377431�020552� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2021 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <stdlib.h> #include <stddef.h> /* Include errno.h *after* sys/types.h to work around header problems on AIX 3.2.5. */ #include <errno.h> #ifndef __set_errno # define __set_errno(ev) ((errno) = (ev)) #endif #include <string.h> #include <unistd.h> #if defined _WIN32 && ! defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN # include <windows.h> #endif #if _LIBC # if HAVE_GNU_LD # define environ __environ # else extern char **environ; # endif #endif #if _LIBC /* This lock protects against simultaneous modifications of 'environ'. */ # include <bits/libc-lock.h> __libc_lock_define_initialized (static, envlock) # define LOCK __libc_lock_lock (envlock) # define UNLOCK __libc_lock_unlock (envlock) #else # define LOCK # define UNLOCK #endif #if defined _WIN32 && ! defined __CYGWIN__ /* Don't assume that UNICODE is not defined. */ # undef SetEnvironmentVariable # define SetEnvironmentVariable SetEnvironmentVariableA #endif static int _unsetenv (const char *name) { size_t len; #if !HAVE_DECL__PUTENV char **ep; #endif if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { __set_errno (EINVAL); return -1; } len = strlen (name); #if HAVE_DECL__PUTENV { int putenv_result; char *name_ = malloc (len + 2); memcpy (name_, name, len); name_[len] = '='; name_[len + 1] = 0; putenv_result = _putenv (name_); free (name_); return putenv_result; } #else LOCK; ep = environ; while (*ep != NULL) if (!strncmp (*ep, name, len) && (*ep)[len] == '=') { /* Found it. Remove this pointer by moving later ones back. */ char **dp = ep; do dp[0] = dp[1]; while (*dp++); /* Continue the loop in case NAME appears again. */ } else ++ep; UNLOCK; return 0; #endif } /* Put STRING, which is of the form "NAME=VALUE", in the environment. If STRING contains no '=', then remove STRING from the environment. */ int putenv (char *string) { const char *name_end = strchr (string, '='); char **ep; if (name_end == NULL) { /* Remove the variable from the environment. */ return _unsetenv (string); } #if HAVE_DECL__PUTENV /* Rely on _putenv to allocate the new environment. If other parts of the application use _putenv, the !HAVE_DECL__PUTENV code would fight over who owns the environ vector, causing a crash. */ if (name_end[1]) return _putenv (string); else { /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ") to allocate the environ vector and then replace the new entry with "NAME=". */ int putenv_result; char *name_x = malloc (name_end - string + sizeof "= "); if (!name_x) return -1; memcpy (name_x, string, name_end - string + 1); name_x[name_end - string + 1] = ' '; name_x[name_end - string + 2] = 0; putenv_result = _putenv (name_x); for (ep = environ; *ep; ep++) if (strcmp (*ep, name_x) == 0) { *ep = string; break; } # if defined _WIN32 && ! defined __CYGWIN__ if (putenv_result == 0) { /* _putenv propagated "NAME= " into the subprocess environment; fix that by calling SetEnvironmentVariable directly. */ name_x[name_end - string] = 0; putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1; errno = ENOMEM; /* ENOMEM is the only way to fail. */ } # endif free (name_x); return putenv_result; } #else for (ep = environ; *ep; ep++) if (strncmp (*ep, string, name_end - string) == 0 && (*ep)[name_end - string] == '=') break; if (*ep) *ep = string; else { static char **last_environ = NULL; size_t size = ep - environ; char **new_environ = malloc ((size + 2) * sizeof *new_environ); if (! new_environ) return -1; new_environ[0] = string; memcpy (new_environ + 1, environ, (size + 1) * sizeof *new_environ); free (last_environ); last_environ = new_environ; environ = new_environ; } return 0; #endif } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-setlocale2.c�������������������������������������������������0000664�0001750�0001750�00000003350�14670377436�022252� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of setting the current locale. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main () { /* Try to set the locale by implicitly looking at the LC_ALL environment variable. */ if (setlocale (LC_ALL, "") != NULL) /* It was successful. Check whether LC_CTYPE is non-trivial. */ if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) { fprintf (stderr, "setlocale did not fail for implicit %s\n", getenv ("LC_ALL")); return 1; } /* Reset the locale. */ if (setlocale (LC_ALL, "C") == NULL) return 1; /* Try to set the locale by explicitly looking at the LC_ALL environment variable. */ if (setlocale (LC_ALL, getenv ("LC_ALL")) != NULL) /* It was successful. Check whether LC_CTYPE is non-trivial. */ if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) { fprintf (stderr, "setlocale did not fail for explicit %s\n", getenv ("LC_ALL")); return 1; } return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-fopen.c������������������������������������������������������0000664�0001750�0001750�00000002000�14670377436�021313� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of opening a file stream. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <stdio.h> #include "signature.h" SIGNATURE_CHECK (fopen, FILE *, (char const *, char const *)); #define BASE "test-fopen.t" #include "test-fopen.h" int main (void) { return test_fopen (); } kbuild-3608/src/grep/gnulib-tests/float.c�����������������������������������������������������������0000664�0001750�0001750�00000002526�14670377430�020343� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Auxiliary definitions for <float.h>. Copyright (C) 2011-2021 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. 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. 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 Lesser General Public License for more details. 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> /* Specification. */ #include <float.h> #if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ const union gl_long_double_union gl_LDBL_MAX = { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } }; #elif defined __i386__ const union gl_long_double_union gl_LDBL_MAX = { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } }; #else /* This declaration is solely to ensure that after preprocessing this file is never empty. */ typedef int dummy; #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-exclude8.sh��������������������������������������������������0000775�0001750�0001750�00000002416�14670377431�022126� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test suite for exclude. # Copyright (C) 2010-2021 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . fail=0 # Test escaped metacharacters. cat > in <<'EOT' f\*e b[a\*]r EOT cat > expected <<'EOT' f*e: 1 file: 0 bar: 1 EOT ${CHECKER} test-exclude -wildcards in -- 'f*e' 'file' 'bar' > out || exit $? # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac # normalize output LC_ALL=C tr -d "$cr" < out > k && mv k out compare expected out || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-setlocale_null-mt-one.c��������������������������������������0000664�0001750�0001750�00000007673�14670377436�024433� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Multithread-safety test for setlocale_null_r (LC_xxx, ...). Copyright (C) 2019-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2019. */ #include <config.h> /* Work around GCC bug 44511. */ #if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) # pragma GCC diagnostic ignored "-Wreturn-type" #endif #if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS /* Specification. */ #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "glthread/thread.h" /* We want to use the system's setlocale() function here, not the gnulib override. */ #undef setlocale /* Some common locale names. */ #if defined _WIN32 && !defined __CYGWIN__ # define ENGLISH "English_United States" # define GERMAN "German_Germany" # define FRENCH "French_France" # define ENCODING ".1252" #else # define ENGLISH "en_US" # define GERMAN "de_DE" # define FRENCH "fr_FR" # if defined __sgi # define ENCODING ".ISO8859-15" # elif defined __hpux # define ENCODING ".utf8" # else # define ENCODING ".UTF-8" # endif #endif static const char LOCALE1[] = ENGLISH ENCODING; static const char LOCALE2[] = GERMAN ENCODING; static const char LOCALE3[] = FRENCH ENCODING; static char *expected; static void * thread1_func (void *arg) { for (;;) { char buf[SETLOCALE_NULL_MAX]; if (setlocale_null_r (LC_NUMERIC, buf, sizeof (buf))) abort (); if (strcmp (expected, buf) != 0) { fprintf (stderr, "thread1 disturbed by thread2!\n"); fflush (stderr); abort (); } } /*NOTREACHED*/ } static void * thread2_func (void *arg) { for (;;) { char buf[SETLOCALE_NULL_MAX]; setlocale_null_r (LC_NUMERIC, buf, sizeof (buf)); setlocale_null_r (LC_TIME, buf, sizeof (buf)); } /*NOTREACHED*/ } int main (int argc, char *argv[]) { if (setlocale (LC_ALL, LOCALE1) == NULL) { fprintf (stderr, "Skipping test: LOCALE1 not recognized\n"); return 77; } if (setlocale (LC_NUMERIC, LOCALE2) == NULL) { fprintf (stderr, "Skipping test: LOCALE2 not recognized\n"); return 77; } if (setlocale (LC_TIME, LOCALE3) == NULL) { fprintf (stderr, "Skipping test: LOCALE3 not recognized\n"); return 77; } expected = strdup (setlocale (LC_NUMERIC, NULL)); /* Create the two threads. */ gl_thread_create (thread1_func, NULL); gl_thread_create (thread2_func, NULL); /* Let them run for 2 seconds. */ { struct timespec duration; duration.tv_sec = 2; duration.tv_nsec = 0; nanosleep (&duration, NULL); } return 0; } #else /* No multithreading available. */ #include <stdio.h> int main () { fputs ("Skipping test: multithreading not enabled\n", stderr); return 77; } #endif /* Without locking, the results of this test would be: glibc OK musl libc OK macOS OK FreeBSD OK NetBSD OK OpenBSD crash < 1 sec AIX crash < 2 sec HP-UX OK IRIX OK Solaris 10 OK Solaris 11.0 OK Solaris 11.4 OK Solaris OpenIndiana OK Haiku OK Cygwin OK mingw OK MSVC OK (assuming compiler option /MD !) */ ���������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-lseek.c������������������������������������������������������0000664�0001750�0001750�00000006323�14670377436�021323� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of lseek() function. Copyright (C) 2007-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake, 2007. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (lseek, off_t, (int, off_t, int)); #include <errno.h> #include "macros.h" /* ARGC must be 2; *ARGV[1] is '0' if stdin and stdout are files, '1' if they are pipes, and '2' if they are closed. Check for proper semantics of lseek. */ int main (int argc, char **argv) { if (argc != 2) return 2; switch (*argv[1]) { case '0': /* regular files */ ASSERT (lseek (0, (off_t)2, SEEK_SET) == 2); ASSERT (lseek (0, (off_t)-4, SEEK_CUR) == -1); ASSERT (errno == EINVAL); errno = 0; #if ! defined __BEOS__ /* POSIX says that the last lseek call, when failing, does not change the current offset. But BeOS sets it to 0. */ ASSERT (lseek (0, (off_t)0, SEEK_CUR) == 2); #endif #if 0 /* leads to SIGSYS on IRIX 6.5 */ ASSERT (lseek (0, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); ASSERT (errno == EINVAL); #endif ASSERT (lseek (1, (off_t)2, SEEK_SET) == 2); errno = 0; ASSERT (lseek (1, (off_t)-4, SEEK_CUR) == -1); ASSERT (errno == EINVAL); errno = 0; #if ! defined __BEOS__ /* POSIX says that the last lseek call, when failing, does not change the current offset. But BeOS sets it to 0. */ ASSERT (lseek (1, (off_t)0, SEEK_CUR) == 2); #endif #if 0 /* leads to SIGSYS on IRIX 6.5 */ ASSERT (lseek (1, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); ASSERT (errno == EINVAL); #endif break; case '1': /* pipes */ errno = 0; ASSERT (lseek (0, (off_t)0, SEEK_CUR) == -1); ASSERT (errno == ESPIPE); errno = 0; ASSERT (lseek (1, (off_t)0, SEEK_CUR) == -1); ASSERT (errno == ESPIPE); break; case '2': /* closed */ /* Explicitly close file descriptors 0 and 1. The <&- and >&- in the invoking shell are not enough on HP-UX. */ close (0); close (1); errno = 0; ASSERT (lseek (0, (off_t)0, SEEK_CUR) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (lseek (1, (off_t)0, SEEK_CUR) == -1); ASSERT (errno == EBADF); /* Test behaviour for invalid file descriptors. */ errno = 0; ASSERT (lseek (-1, (off_t)0, SEEK_CUR) == -1); ASSERT (errno == EBADF); close (99); errno = 0; ASSERT (lseek (99, (off_t)0, SEEK_CUR) == -1); ASSERT (errno == EBADF); break; default: return 1; } return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-raise.c������������������������������������������������������0000664�0001750�0001750�00000002666�14670377436�021331� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test raising a signal. Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <signal.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (raise, int, (int)); #include <stdlib.h> #include "macros.h" /* It is safe to use _Noreturn here: exit() never returns, and GCC knows that exit() is a non-returning function, even on platforms where its declaration in <stdlib.h> does not have the 'noreturn' attribute. */ static _Noreturn void handler (int sig) { _exit (0); } int main (void) { /* Test behaviour for invalid argument. */ ASSERT (raise (-1) != 0); /* Test behaviour for SIGINT. */ ASSERT (signal (SIGINT, handler) != SIG_ERR); raise (SIGINT); /* We should not get here, because the handler takes away the control. */ exit (1); } ��������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-perror2.c����������������������������������������������������0000664�0001750�0001750�00000006521�14670377436�021613� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test of perror() function. Copyright (C) 2011-2021 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, 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <unistd.h> /* This test intentionally parses stderr. So, we arrange to have fd 10 (outside the range of interesting fd's during the test) set up to duplicate the original stderr. */ #define BACKUP_STDERR_FILENO 10 #define ASSERT_STREAM myerr #include "macros.h" static FILE *myerr; #define BASE "test-perror2" int main (void) { /* We change fd 2 later, so save it in fd 10. */ if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL) return 2; ASSERT (freopen (BASE ".tmp", "w+", stderr) == stderr); /* Test that perror does not clobber strerror buffer. */ { const char *msg1; const char *msg2; const char *msg3; const char *msg4; char *str1; char *str2; char *str3; char *str4; msg1 = strerror (ENOENT); ASSERT (msg1); str1 = strdup (msg1); ASSERT (str1); msg2 = strerror (ERANGE); ASSERT (msg2); str2 = strdup (msg2); ASSERT (str2); msg3 = strerror (-4); ASSERT (msg3); str3 = strdup (msg3); ASSERT (str3); msg4 = strerror (1729576); ASSERT (msg4); str4 = strdup (msg4); ASSERT (str4); errno = EACCES; perror (""); errno = -5; perror (""); ASSERT (!ferror (stderr)); ASSERT (STREQ (msg4, str4)); free (str1); free (str2); free (str3); free (str4); } /* Test that perror uses the same message as strerror. */ { int errs[] = { EACCES, 0, -3, }; int i; for (i = 0; i < SIZEOF (errs); i++) { char buf[256]; const char *err = strerror (errs[i]); ASSERT (err); ASSERT (strlen (err) < sizeof buf); rewind (stderr); ASSERT (ftruncate (fileno (stderr), 0) == 0); errno = errs[i]; perror (NULL); ASSERT (!ferror (stderr)); rewind (stderr); ASSERT (fgets (buf, sizeof buf, stderr) == buf); ASSERT (strstr (buf, err)); } } /* Test that perror reports write failure. */ { ASSERT (freopen (BASE ".tmp", "r", stderr) == stderr); ASSERT (setvbuf (stderr, NULL, _IONBF, BUFSIZ) == 0); errno = -1; ASSERT (!ferror (stderr)); perror (NULL); #if 0 /* Commented out until cygwin behaves: https://sourceware.org/ml/newlib/2011/msg00228.html */ ASSERT (errno > 0); /* Commented out until glibc behaves: https://sourceware.org/bugzilla/show_bug.cgi?id=12792 */ ASSERT (ferror (stderr)); #endif } ASSERT (fclose (stderr) == 0); ASSERT (remove (BASE ".tmp") == 0); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-dup-safer.c��������������������������������������������������0000664�0001750�0001750�00000011645�14670377431�022104� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test that dup_safer leaves standard fds alone. Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include "unistd--.h" #include <fcntl.h> #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <unistd.h> #include "binary-io.h" #include "cloexec.h" #if defined _WIN32 && ! defined __CYGWIN__ /* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> /* Get _get_osfhandle. */ # if GNULIB_MSVC_NOTHROW # include "msvc-nothrow.h" # else # include <io.h> # endif #endif #if !O_BINARY # define set_binary_mode(f,m) zero () static int zero (void) { return 0; } #endif /* This test intentionally closes stderr. So, we arrange to have fd 10 (outside the range of interesting fd's during the test) set up to duplicate the original stderr. */ #define BACKUP_STDERR_FILENO 10 #define ASSERT_STREAM myerr #include "macros.h" static FILE *myerr; /* Return true if FD is open. */ static bool is_open (int fd) { #if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows, the initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE, and there is no fcntl. */ return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; #else # ifndef F_GETFL # error Please port fcntl to your platform # endif return 0 <= fcntl (fd, F_GETFL); #endif } /* Return true if FD is open and inheritable across exec/spawn. */ static bool is_inheritable (int fd) { #if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows, the initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE, and there is no fcntl. */ HANDLE h = (HANDLE) _get_osfhandle (fd); DWORD flags; if (h == INVALID_HANDLE_VALUE || GetHandleInformation (h, &flags) == 0) return 0; return (flags & HANDLE_FLAG_INHERIT) != 0; #else # ifndef F_GETFD # error Please port fcntl to your platform # endif int i = fcntl (fd, F_GETFD); return 0 <= i && (i & FD_CLOEXEC) == 0; #endif } /* Return true if FD is open in the given MODE, which is either O_TEXT or O_BINARY. */ static bool is_mode (int fd, int mode) { int value = set_binary_mode (fd, O_BINARY); set_binary_mode (fd, value); return mode == value; } #define witness "test-dup-safer.txt" int main (void) { int i; int fd; int bad_fd = getdtablesize (); /* We close fd 2 later, so save it in fd 10. */ if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL) return 2; /* Create file for later checks. */ fd = creat (witness, 0600); ASSERT (STDERR_FILENO < fd); /* Four iterations, with progressively more standard descriptors closed. */ for (i = -1; i <= STDERR_FILENO; i++) { if (0 <= i) ASSERT (close (i) == 0); /* Detect errors. */ errno = 0; ASSERT (dup (-1) == -1); ASSERT (errno == EBADF); errno = 0; ASSERT (dup (bad_fd) == -1); ASSERT (errno == EBADF); close (fd + 1); errno = 0; ASSERT (dup (fd + 1) == -1); ASSERT (errno == EBADF); /* Preserve text vs. binary. */ set_binary_mode (fd, O_BINARY); ASSERT (dup (fd) == fd + 1); ASSERT (is_open (fd + 1)); ASSERT (is_inheritable (fd + 1)); ASSERT (is_mode (fd + 1, O_BINARY)); ASSERT (close (fd + 1) == 0); set_binary_mode (fd, O_TEXT); ASSERT (dup (fd) == fd + 1); ASSERT (is_open (fd + 1)); ASSERT (is_inheritable (fd + 1)); ASSERT (is_mode (fd + 1, O_TEXT)); /* Create cloexec copy. */ ASSERT (close (fd + 1) == 0); ASSERT (fd_safer_flag (dup_cloexec (fd), O_CLOEXEC) == fd + 1); ASSERT (set_cloexec_flag (fd + 1, true) == 0); ASSERT (is_open (fd + 1)); ASSERT (!is_inheritable (fd + 1)); ASSERT (close (fd) == 0); /* dup always creates inheritable copies. Also, check that earliest slot past std fds is used. */ ASSERT (dup (fd + 1) == fd); ASSERT (is_open (fd)); ASSERT (is_inheritable (fd)); ASSERT (close (fd + 1) == 0); } /* Cleanup. */ ASSERT (close (fd) == 0); ASSERT (unlink (witness) == 0); return 0; } �������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/hash-pjw.h��������������������������������������������������������0000664�0001750�0001750�00000002154�14670377431�020762� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* hash-pjw.h -- declaration for a simple hash function Copyright (C) 2001, 2003, 2009-2021 Free Software Foundation, Inc. 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. 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 Lesser General Public License for more details. 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 <stddef.h> /* Compute a hash code for a NUL-terminated string starting at X, and return the hash code modulo TABLESIZE. The result is platform dependent: it depends on the size of the 'size_t' type and on the signedness of the 'char' type. */ extern size_t hash_pjw (void const *x, size_t tablesize) _GL_ATTRIBUTE_PURE; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/gnulib-tests/test-getprogname.c������������������������������������������������0000664�0001750�0001750�00000004007�14670377436�022525� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Test the gnulib getprogname module. Copyright (C) 2016-2021 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include "getprogname.h" #include <string.h> #include <assert.h> #ifdef __hpux # define STREQ(a, b) (strncmp (a, b, 14) == 0) #else # define STREQ(a, b) (strcmp (a, b) == 0) #endif int main (void) { char const *p = getprogname (); /* libtool creates a temporary executable whose name is sometimes prefixed with "lt-" (depends on the platform). But the name of the temporary executable is a detail that should not be visible to the end user and to the test suite. Remove this "lt-" prefix here. */ if (strncmp (p, "lt-", 3) == 0) p += 3; /* Note: You can make this test fail a) by running it on a case-insensitive file system (such as on Windows, Cygwin, or on Mac OS X with a case-insensitive HFS+ file system), with an invocation that contains upper case characters, e.g. test-GETPROGNAME, b) by hardlinking or symlinking it to a different name (e.g. test-foo) and invoking it through that name. That's not the intended use. The Makefile always invokes it as 'test-getprogname${EXEEXT}'. */ #if defined __CYGWIN__ /* The Cygwin getprogname() function strips the ".exe" suffix. */ assert (STREQ (p, "test-getprogname")); #else assert (STREQ (p, "test-getprogname" EXEEXT)); #endif return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/�������������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377472�015615� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/get-mb-cur-max.c���������������������������������������������������������0000664�0001750�0001750�00000002126�14670377471�020506� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Auxiliary program to detect support for a locale. Copyright 2010-2021 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <config.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> #include "getprogname.h" int main (int argc, char **argv) { if (1 < argc && setlocale (LC_ALL, argv[1])) { printf ("%d\n", (int) MB_CUR_MAX); exit (EXIT_SUCCESS); } exit (EXIT_FAILURE); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/mb-non-UTF8-overrun������������������������������������������������������0000775�0001750�0001750�00000002044�14670377472�021153� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # grep would sometimes read beyond end of input, when using a non-UTF8 # multibyte locale. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_JP_EUC_locale_ fail=0 # This would fail when running an ASAN-enabled binary, or when run via # valgrind, accessing one byte beyond the end of an input buffer. returns_ 1 grep -z . < /dev/null || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/word-multibyte�����������������������������������������������������������0000775�0001750�0001750�00000001102�14670377472�020524� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would fail for grep-2.20 . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ e_acute=$(printf '\303\251') printf "$e_acute\n" > in || framework_failure_ # Use this locale only if it is installed. zh=zh_CN.UTF-8 path_prepend_ . case $(get-mb-cur-max $zh) in [456]) ;; *) zh=;; esac fail=0 for LOC in en_US.UTF-8 $zh $LOCALE_FR_UTF8; do out=out1-$LOC LC_ALL=$LOC grep '\w' in >$out || fail=1 compare in $out || fail=1 out=out2-$LOC LC_ALL=$LOC grep '\W' in >$out && fail=1 compare /dev/null $out || fail=1 done Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/in-eq-out-infloop��������������������������������������������������������0000775�0001750�0001750�00000002541�14670377471�021026� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Demonstrate the disk-filling infloop when redirecting to an input file. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_timeout_ # Use an input file large enough that the problem is reproducible in spite # of buffering effects. Just larger than 256KB should be adequate. v=$(printf %063d 0)' ' # 64 * 2^12 = 256k for i in 1 2 3 4 5 6 7 8 9 10 11 12; do v="$v$v" done echo "$v" > out || framework_failure_ for arg in out - ''; do # Accommodate both 'out' and '(standard input)', as well as # the multi-byte quoting we see on OS/X-based systems. echo grep: ...: input file is also the output > err.exp || framework_failure_ # Require an exit status of 2. # grep-2.8 and earlier would infloop with $arg = out. # grep-2.10 and earlier would infloop with $arg = - or $arg = ''. timeout 10 grep 0 $arg < out >> out 2> err; st=$?; test $st = 2 || fail=1 sed 's/grep: .*: /grep: ...: /' err > k && mv k err # Normalize the diagnostic prefix from e.g., "/mnt/dir/grep: " to "grep: " sed 's/^[^:]*: /grep: /' err > k && mv k err compare err.exp err || fail=1 # But with each of the following options it must not exit-2. for i in -q -m1 -l -L; do timeout 10 grep $i 0 $arg < out >> out 2> err; st=$? test $st = 2 && fail=1 done timeout 10 grep -2 0 $arg < out >> out 2> err; st=$? test $st = 2 || fail=1 done Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/Makefile.am��������������������������������������������������������������0000664�0001750�0001750�00000017356�14670377472�017665� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������## Process this file with automake to create Makefile.in # Copyright 1997-1998, 2005-2021 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, 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 <https://www.gnu.org/licenses/>. TEST_EXTENSIONS = .sh .pl if HAVE_PERL TESTSUITE_PERL = $(PERL) else TESTSUITE_PERL = $(SHELL) $(srcdir)/no-perl endif # Options passed to the perl invocations running the perl test scripts. TESTSUITE_PERL_OPTIONS = -w -I$(srcdir) -MCoreutils -MCuSkip # '$f' is set by the Automake-generated test harness to the path of the # current test script stripped of VPATH components, and is used by the # CuTmpdir module to determine the name of the temporary files to be # used. Note that $f is a shell variable, not a make macro, so the use # of '$$f' below is correct, and not a typo. TESTSUITE_PERL_OPTIONS += -M"CuTmpdir qw($$f)" SH_LOG_COMPILER = $(SHELL) PL_LOG_COMPILER = $(TESTSUITE_PERL) $(TESTSUITE_PERL_OPTIONS) check_PROGRAMS = get-mb-cur-max AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \ -I$(top_srcdir)/src AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) # Tell the linker to omit references to unused shared libraries. AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS) LDADD = ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a # The triple-backref test is expected to fail with both the system # matcher (i.e., with glibc) and with the included matcher. # Both matchers need to be fixed. # FIXME-2015: Remove this once the glibc and gnulib bugs are fixed. XFAIL_TESTS = triple-backref # Equivalence classes are only supported when using the system # matcher (which means only with glibc). # The included matcher needs to be fixed. # FIXME-2015: Remove this once the gnulib bug is fixed. if USE_INCLUDED_REGEX XFAIL_TESTS += equiv-classes else # The backref-alt test fails for glibc 2.27 and earlier. # If you're using older glibc you can upgrade to glibc 2.28 or later, # configure --with-included-regex, or ignore the test failure. endif TESTS = \ backref \ backref-alt \ backref-multibyte-slow \ backref-word \ backslash-dot \ backslash-s-and-repetition-operators \ backslash-s-vs-invalid-multibyte \ big-hole \ big-match \ binary-file-matches \ bogus-wctob \ bre \ c-locale \ case-fold-backref \ case-fold-backslash-w \ case-fold-char-class \ case-fold-char-range \ case-fold-char-type \ case-fold-titlecase \ char-class-multibyte \ char-class-multibyte2 \ context-0 \ count-newline \ dfa-coverage \ dfa-heap-overrun \ dfa-infloop \ dfa-invalid-utf8 \ dfaexec-multibyte \ empty \ empty-line \ empty-line-mb \ encoding-error \ epipe \ equiv-classes \ ere \ euc-mb \ false-match-mb-non-utf8 \ fedora \ fgrep-infloop \ fgrep-longest \ file \ filename-lineno.pl \ fmbtest \ foad1 \ grep-dev-null \ grep-dev-null-out \ grep-dir \ hash-collision-perf \ help-version \ high-bit-range \ in-eq-out-infloop \ include-exclude \ inconsistent-range \ initial-tab \ invalid-multibyte-infloop \ khadafy \ kwset-abuse \ long-line-vs-2GiB-read \ long-pattern-perf \ many-regex-performance \ match-lines \ max-count-overread \ max-count-vs-context \ mb-dot-newline \ mb-non-UTF8-overrun \ mb-non-UTF8-perf-Fw \ mb-non-UTF8-performance \ mb-non-UTF8-word-boundary \ multibyte-white-space \ multiple-begin-or-end-line \ null-byte \ options \ pcre \ pcre-abort \ pcre-context \ pcre-count \ pcre-infloop \ pcre-invalid-utf8-infloop \ pcre-invalid-utf8-input \ pcre-jitstack \ pcre-o \ pcre-utf8 \ pcre-w \ pcre-wx-backref \ pcre-z \ posix-bracket \ prefix-of-multibyte \ proc \ r-dot \ repetition-overflow \ reversed-range-endpoints \ sjis-mb \ skip-device \ skip-read \ spencer1 \ spencer1-locale \ stack-overflow \ status \ surrogate-pair \ symlink \ triple-backref \ turkish-I \ turkish-I-without-dot \ turkish-eyes \ two-chars \ two-files \ unibyte-binary \ unibyte-bracket-expr \ unibyte-negated-circumflex \ utf8-bracket \ warn-char-classes \ word-delim-multibyte \ word-multi-file \ word-multibyte \ write-error-msg \ yesno \ z-anchor-newline EXTRA_DIST = \ $(TESTS) \ bre.awk \ bre.tests \ Coreutils.pm \ CuSkip.pm \ CuTmpdir.pm \ envvar-check \ ere.awk \ ere.tests \ init.cfg \ init.sh \ khadafy.lines \ khadafy.regexp \ no-perl \ spencer1.awk \ spencer1.tests \ spencer1-locale.awk # Default to a nonzero value. Environment overrides. # https://udrepper.livejournal.com/11429.html MALLOC_PERTURB_ = 1 TESTS_ENVIRONMENT = \ tmp__=$${TMPDIR-/tmp}; \ test -d "$$tmp__" && test -w "$$tmp__" || tmp__=.; \ . $(srcdir)/envvar-check; \ TMPDIR=$$tmp__; export TMPDIR; \ \ if test -n "$$BASH_VERSION" || (eval "export v=x") 2>/dev/null; then \ export_with_values () { export "$$@"; }; \ else \ export_with_values () \ { \ sed_extract_var='s/=.*//'; \ sed_quote_value="s/'/'\\\\''/g;s/=\\(.*\\)/='\\1'/";\ for arg in "$$@"; do \ var=`echo "$$arg" | sed "$$sed_extract_var"`; \ arg=`echo "$$arg" | sed "$$sed_quote_value"`; \ eval "$$arg"; \ export "$$var"; \ done; \ }; \ fi; \ \ : 'Test egrep/fgrep help if they use our grep.'; \ grep=`echo grep | sed -e '$(transform)'` || exit; \ if test "$$grep" = grep; then \ built_programs='grep egrep fgrep'; \ else \ built_programs='grep'; \ fi; \ \ export_with_values \ VERSION='$(VERSION)' \ LOCALE_FR='$(LOCALE_FR)' \ LOCALE_FR_UTF8='$(LOCALE_FR_UTF8)' \ AWK=$(AWK) \ LC_ALL=C \ abs_top_builddir='$(abs_top_builddir)' \ abs_top_srcdir='$(abs_top_srcdir)' \ abs_srcdir='$(abs_srcdir)' \ built_programs="$$built_programs" \ host_triplet='$(host_triplet)' \ srcdir='$(srcdir)' \ top_srcdir='$(top_srcdir)' \ CC='$(CC)' \ GREP_TEST_NAME=`echo $$tst|sed 's,^\./,,;s,/,-,g'` \ MAKE=$(MAKE) \ MALLOC_PERTURB_=$(MALLOC_PERTURB_) \ PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)' \ PACKAGE_VERSION=$(PACKAGE_VERSION) \ PERL='$(PERL)' \ SHELL='$(SHELL)' \ PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \ ; \ \ : 'set this envvar to indicate whether -P works'; \ m=0; if err=`echo .|grep -Pq . 2>&1`; then \ test -z "$$err" && m=1; fi; \ export PCRE_WORKS=$$m; \ 9>&2 LOG_COMPILER = $(SHELL) VERBOSE = yes check: check_executable_TESTS .PHONY: check_executable_TESTS check_executable_TESTS: Makefile $(AM_V_GEN)fail=0; \ cd $(srcdir) && for i in $(TESTS); do \ test -x $$i || { fail=1; echo $$i >&2; }; \ done; \ test $$fail = 1 \ && { echo the above test scripts are not executable >&2; exit 1; } \ || : ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/symlink������������������������������������������������������������������0000775�0001750�0001750�00000003457�14670377472�017242� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Check that "grep -r" does the right thing with symbolic links. # Copyright (C) 2012-2021 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 <https://www.gnu.org/licenses/>. # written by Paul Eggert . "${srcdir=.}/init.sh"; path_prepend_ ../src mkdir dir || framework_failure_ echo a > dir/a || framework_failure_ echo b > dir/b || framework_failure_ ln -s a dir/c || framework_failure_ ln -s . dir/d || framework_failure_ ln -s dangling dir/e || framework_failure_ touch out || framework_failure_ for recursion in '' -r -R do for files in '' '*' do case $recursion,$files in -R,* | *,'*') expected_status=2 ;; *) expected_status=0 ;; esac (cd dir && grep $recursion '^' $files <a ) >grepout test $? -eq $expected_status || fail=1 case $recursion,$files in ,) exp='a\n' ;; ,'*' | -R,) exp='a:a\nb:b\nc:a\n' ;; -r,) exp='a:a\nb:b\n' ;; -r,'*') exp='a:a\nb:b\nc:a\nd/a:a\nd/b:b\n' ;; -R,'*') exp='a:a\nb:b\nc:a\nd/a:a\nd/b:b\nd/c:a\n' ;; *) framework_failure_ ;; esac printf "$exp" >exp || framework_failure_ LC_ALL=C sort grepout >out || fail=1 compare exp out || fail=1 done done Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/Makefile.in��������������������������������������������������������������0000664�0001750�0001750�00000372635�14670377471�017701� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Makefile.in generated by automake 1.16d from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright 1997-1998, 2005-2021 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, 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 <https://www.gnu.org/licenses/>. VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = get-mb-cur-max$(EXEEXT) # Equivalence classes are only supported when using the system # matcher (which means only with glibc). # The included matcher needs to be fixed. # FIXME-2015: Remove this once the gnulib bug is fixed. @USE_INCLUDED_REGEX_TRUE@am__append_1 = equiv-classes subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/__inline.m4 \ $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \ $(top_srcdir)/m4/arpa_inet_h.m4 \ $(top_srcdir)/m4/asm-underscore.m4 $(top_srcdir)/m4/assert.m4 \ $(top_srcdir)/m4/btowc.m4 $(top_srcdir)/m4/builtin-expect.m4 \ $(top_srcdir)/m4/c-stack.m4 $(top_srcdir)/m4/calloc.m4 \ $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/close.m4 \ $(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/ctype_h.m4 \ $(top_srcdir)/m4/cycle-check.m4 $(top_srcdir)/m4/d-ino.m4 \ $(top_srcdir)/m4/d-type.m4 $(top_srcdir)/m4/dirent_h.m4 \ $(top_srcdir)/m4/dirfd.m4 \ $(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup.m4 \ $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/errno_h.m4 \ $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exponentd.m4 \ $(top_srcdir)/m4/extensions.m4 \ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopen.m4 $(top_srcdir)/m4/fdopendir.m4 \ $(top_srcdir)/m4/filenamecat.m4 $(top_srcdir)/m4/flexmember.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fnmatch.m4 \ $(top_srcdir)/m4/fnmatch_h.m4 $(top_srcdir)/m4/fopen.m4 \ $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/fpieee.m4 \ $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/fstat.m4 \ $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/ftruncate.m4 \ $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \ $(top_srcdir)/m4/getpagesize.m4 \ $(top_srcdir)/m4/getprogname.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/iconv_h.m4 \ $(top_srcdir)/m4/iconv_open.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_pton.m4 \ $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intl-thread-locale.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax_t.m4 \ $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes.m4 \ $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/ioctl.m4 \ $(top_srcdir)/m4/isatty.m4 $(top_srcdir)/m4/isblank.m4 \ $(top_srcdir)/m4/iswblank.m4 $(top_srcdir)/m4/iswctype.m4 \ $(top_srcdir)/m4/iswdigit.m4 $(top_srcdir)/m4/iswxdigit.m4 \ $(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \ $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/libsigsegv.m4 \ $(top_srcdir)/m4/libunistring-base.m4 \ $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/localcharset.m4 \ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \ $(top_srcdir)/m4/locale-tr.m4 $(top_srcdir)/m4/locale-zh.m4 \ $(top_srcdir)/m4/locale_h.m4 $(top_srcdir)/m4/localeconv.m4 \ $(top_srcdir)/m4/localename.m4 $(top_srcdir)/m4/lock.m4 \ $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/lstat.m4 \ $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/malloca.m4 \ $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/mbchar.m4 \ $(top_srcdir)/m4/mbiter.m4 $(top_srcdir)/m4/mbrlen.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \ $(top_srcdir)/m4/mbslen.m4 $(top_srcdir)/m4/mbsrtowcs.m4 \ $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbtowc.m4 \ $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/minmax.m4 \ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/musl.m4 $(top_srcdir)/m4/nanosleep.m4 \ $(top_srcdir)/m4/netinet_in_h.m4 \ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/obstack.m4 \ $(top_srcdir)/m4/off_t.m4 $(top_srcdir)/m4/open-cloexec.m4 \ $(top_srcdir)/m4/open-slash.m4 $(top_srcdir)/m4/open.m4 \ $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/opendir.m4 \ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/pcre.m4 \ $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/perror.m4 \ $(top_srcdir)/m4/pipe.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/pthread-thread.m4 \ $(top_srcdir)/m4/pthread_h.m4 \ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \ $(top_srcdir)/m4/pthread_sigmask.m4 $(top_srcdir)/m4/putenv.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/rawmemchr.m4 \ $(top_srcdir)/m4/read.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/reallocarray.m4 \ $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/safe-read.m4 \ $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/sched_h.m4 \ $(top_srcdir)/m4/select.m4 $(top_srcdir)/m4/setenv.m4 \ $(top_srcdir)/m4/setlocale.m4 \ $(top_srcdir)/m4/setlocale_null.m4 \ $(top_srcdir)/m4/sigaction.m4 $(top_srcdir)/m4/sigaltstack.m4 \ $(top_srcdir)/m4/signal_h.m4 \ $(top_srcdir)/m4/signalblocking.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/sleep.m4 \ $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/socketlib.m4 \ $(top_srcdir)/m4/sockets.m4 $(top_srcdir)/m4/socklen.m4 \ $(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stack-direction.m4 \ $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \ $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdarg.m4 \ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/stpcpy.m4 $(top_srcdir)/m4/strdup.m4 \ $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/strerror_r.m4 \ $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strnlen.m4 \ $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtoimax.m4 \ $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoull.m4 \ $(top_srcdir)/m4/strtoumax.m4 $(top_srcdir)/m4/symlink.m4 \ $(top_srcdir)/m4/sys_ioctl_h.m4 \ $(top_srcdir)/m4/sys_select_h.m4 \ $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/sys_uio_h.m4 \ $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/unistd-safer.m4 \ $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/version-etc.m4 \ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/warn-on-use.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_h.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcrtomb.m4 \ $(top_srcdir)/m4/wctob.m4 $(top_srcdir)/m4/wctomb.m4 \ $(top_srcdir)/m4/wctype_h.m4 $(top_srcdir)/m4/wcwidth.m4 \ $(top_srcdir)/m4/windows-stat-inodes.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/wmemchr.m4 \ $(top_srcdir)/m4/wmempcpy.m4 $(top_srcdir)/m4/xalloc.m4 \ $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrtol.m4 \ $(top_srcdir)/m4/year2038.m4 $(top_srcdir)/m4/zzgnulib.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = get_mb_cur_max_SOURCES = get-mb-cur-max.c get_mb_cur_max_OBJECTS = get-mb-cur-max.$(OBJEXT) get_mb_cur_max_LDADD = $(LDADD) am__DEPENDENCIES_1 = get_mb_cur_max_DEPENDENCIES = ../lib/libgreputils.a \ $(am__DEPENDENCIES_1) ../lib/libgreputils.a AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/get-mb-cur-max.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = get-mb-cur-max.c DIST_SOURCES = get-mb-cur-max.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) am__test_logs3 = $(am__test_logs2:.sh.log=.log) SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS) TEST_LOGS = $(am__test_logs3:.pl.log=.log) PL_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver PL_LOG_COMPILE = $(PL_LOG_COMPILER) $(AM_PL_LOG_FLAGS) $(PL_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in \ $(top_srcdir)/build-aux/depcomp \ $(top_srcdir)/build-aux/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkglibexecdir = @pkglibexecdir@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ AR = @AR@ ARFLAGS = @ARFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ COLORIZE_SOURCE = @COLORIZE_SOURCE@ CONFIG_INCLUDE = @CONFIG_INCLUDE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ ENOLINK_VALUE = @ENOLINK_VALUE@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ FNMATCH_H = @FNMATCH_H@ GETOPT_CDEFS_H = @GETOPT_CDEFS_H@ GETOPT_H = @GETOPT_H@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@ GL_CXXFLAG_ALLOW_WARNINGS = @GL_CXXFLAG_ALLOW_WARNINGS@ GL_GNULIB_ACCEPT = @GL_GNULIB_ACCEPT@ GL_GNULIB_ACCEPT4 = @GL_GNULIB_ACCEPT4@ GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@ GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@ GL_GNULIB_ALPHASORT = @GL_GNULIB_ALPHASORT@ GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@ GL_GNULIB_BIND = @GL_GNULIB_BIND@ GL_GNULIB_BTOWC = @GL_GNULIB_BTOWC@ GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@ GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@ GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@ GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@ GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@ GL_GNULIB_CLOSEDIR = @GL_GNULIB_CLOSEDIR@ GL_GNULIB_CONNECT = @GL_GNULIB_CONNECT@ GL_GNULIB_COPY_FILE_RANGE = @GL_GNULIB_COPY_FILE_RANGE@ GL_GNULIB_CREAT = @GL_GNULIB_CREAT@ GL_GNULIB_CTIME = @GL_GNULIB_CTIME@ GL_GNULIB_DIRFD = @GL_GNULIB_DIRFD@ GL_GNULIB_DPRINTF = @GL_GNULIB_DPRINTF@ GL_GNULIB_DUP = @GL_GNULIB_DUP@ GL_GNULIB_DUP2 = @GL_GNULIB_DUP2@ GL_GNULIB_DUP3 = @GL_GNULIB_DUP3@ GL_GNULIB_DUPLOCALE = @GL_GNULIB_DUPLOCALE@ GL_GNULIB_ENVIRON = @GL_GNULIB_ENVIRON@ GL_GNULIB_EUIDACCESS = @GL_GNULIB_EUIDACCESS@ GL_GNULIB_EXECL = @GL_GNULIB_EXECL@ GL_GNULIB_EXECLE = @GL_GNULIB_EXECLE@ GL_GNULIB_EXECLP = @GL_GNULIB_EXECLP@ GL_GNULIB_EXECV = @GL_GNULIB_EXECV@ GL_GNULIB_EXECVE = @GL_GNULIB_EXECVE@ GL_GNULIB_EXECVP = @GL_GNULIB_EXECVP@ GL_GNULIB_EXECVPE = @GL_GNULIB_EXECVPE@ GL_GNULIB_EXPLICIT_BZERO = @GL_GNULIB_EXPLICIT_BZERO@ GL_GNULIB_FACCESSAT = @GL_GNULIB_FACCESSAT@ GL_GNULIB_FCHDIR = @GL_GNULIB_FCHDIR@ GL_GNULIB_FCHMODAT = @GL_GNULIB_FCHMODAT@ GL_GNULIB_FCHOWNAT = @GL_GNULIB_FCHOWNAT@ GL_GNULIB_FCLOSE = @GL_GNULIB_FCLOSE@ GL_GNULIB_FCNTL = @GL_GNULIB_FCNTL@ GL_GNULIB_FDATASYNC = @GL_GNULIB_FDATASYNC@ GL_GNULIB_FDOPEN = @GL_GNULIB_FDOPEN@ GL_GNULIB_FDOPENDIR = @GL_GNULIB_FDOPENDIR@ GL_GNULIB_FFLUSH = @GL_GNULIB_FFLUSH@ GL_GNULIB_FFSL = @GL_GNULIB_FFSL@ GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@ GL_GNULIB_FGETC = @GL_GNULIB_FGETC@ GL_GNULIB_FGETS = @GL_GNULIB_FGETS@ GL_GNULIB_FNMATCH = @GL_GNULIB_FNMATCH@ GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@ GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@ GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@ GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@ GL_GNULIB_FPUTC = @GL_GNULIB_FPUTC@ GL_GNULIB_FPUTS = @GL_GNULIB_FPUTS@ GL_GNULIB_FREAD = @GL_GNULIB_FREAD@ GL_GNULIB_FREE_POSIX = @GL_GNULIB_FREE_POSIX@ GL_GNULIB_FREOPEN = @GL_GNULIB_FREOPEN@ GL_GNULIB_FSCANF = @GL_GNULIB_FSCANF@ GL_GNULIB_FSEEK = @GL_GNULIB_FSEEK@ GL_GNULIB_FSEEKO = @GL_GNULIB_FSEEKO@ GL_GNULIB_FSTAT = @GL_GNULIB_FSTAT@ GL_GNULIB_FSTATAT = @GL_GNULIB_FSTATAT@ GL_GNULIB_FSYNC = @GL_GNULIB_FSYNC@ GL_GNULIB_FTELL = @GL_GNULIB_FTELL@ GL_GNULIB_FTELLO = @GL_GNULIB_FTELLO@ GL_GNULIB_FTRUNCATE = @GL_GNULIB_FTRUNCATE@ GL_GNULIB_FUTIMENS = @GL_GNULIB_FUTIMENS@ GL_GNULIB_FWRITE = @GL_GNULIB_FWRITE@ GL_GNULIB_GETC = @GL_GNULIB_GETC@ GL_GNULIB_GETCHAR = @GL_GNULIB_GETCHAR@ GL_GNULIB_GETCWD = @GL_GNULIB_GETCWD@ GL_GNULIB_GETDELIM = @GL_GNULIB_GETDELIM@ GL_GNULIB_GETDOMAINNAME = @GL_GNULIB_GETDOMAINNAME@ GL_GNULIB_GETDTABLESIZE = @GL_GNULIB_GETDTABLESIZE@ GL_GNULIB_GETENTROPY = @GL_GNULIB_GETENTROPY@ GL_GNULIB_GETGROUPS = @GL_GNULIB_GETGROUPS@ GL_GNULIB_GETHOSTNAME = @GL_GNULIB_GETHOSTNAME@ GL_GNULIB_GETLINE = @GL_GNULIB_GETLINE@ GL_GNULIB_GETLOADAVG = @GL_GNULIB_GETLOADAVG@ GL_GNULIB_GETLOGIN = @GL_GNULIB_GETLOGIN@ GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@ GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@ GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@ GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@ GL_GNULIB_GETPEERNAME = @GL_GNULIB_GETPEERNAME@ GL_GNULIB_GETSOCKNAME = @GL_GNULIB_GETSOCKNAME@ GL_GNULIB_GETSOCKOPT = @GL_GNULIB_GETSOCKOPT@ GL_GNULIB_GETSUBOPT = @GL_GNULIB_GETSUBOPT@ GL_GNULIB_GETTIMEOFDAY = @GL_GNULIB_GETTIMEOFDAY@ GL_GNULIB_GETUMASK = @GL_GNULIB_GETUMASK@ GL_GNULIB_GETUSERSHELL = @GL_GNULIB_GETUSERSHELL@ GL_GNULIB_GRANTPT = @GL_GNULIB_GRANTPT@ GL_GNULIB_GROUP_MEMBER = @GL_GNULIB_GROUP_MEMBER@ GL_GNULIB_ICONV = @GL_GNULIB_ICONV@ GL_GNULIB_IMAXABS = @GL_GNULIB_IMAXABS@ GL_GNULIB_IMAXDIV = @GL_GNULIB_IMAXDIV@ GL_GNULIB_INET_NTOP = @GL_GNULIB_INET_NTOP@ GL_GNULIB_INET_PTON = @GL_GNULIB_INET_PTON@ GL_GNULIB_IOCTL = @GL_GNULIB_IOCTL@ GL_GNULIB_ISATTY = @GL_GNULIB_ISATTY@ GL_GNULIB_ISBLANK = @GL_GNULIB_ISBLANK@ GL_GNULIB_ISWBLANK = @GL_GNULIB_ISWBLANK@ GL_GNULIB_ISWCTYPE = @GL_GNULIB_ISWCTYPE@ GL_GNULIB_ISWDIGIT = @GL_GNULIB_ISWDIGIT@ GL_GNULIB_ISWXDIGIT = @GL_GNULIB_ISWXDIGIT@ GL_GNULIB_LCHMOD = @GL_GNULIB_LCHMOD@ GL_GNULIB_LCHOWN = @GL_GNULIB_LCHOWN@ GL_GNULIB_LINK = @GL_GNULIB_LINK@ GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@ GL_GNULIB_LISTEN = @GL_GNULIB_LISTEN@ GL_GNULIB_LOCALECONV = @GL_GNULIB_LOCALECONV@ GL_GNULIB_LOCALENAME = @GL_GNULIB_LOCALENAME@ GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@ GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@ GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@ GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@ GL_GNULIB_MBRLEN = @GL_GNULIB_MBRLEN@ GL_GNULIB_MBRTOWC = @GL_GNULIB_MBRTOWC@ GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@ GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@ GL_GNULIB_MBSCHR = @GL_GNULIB_MBSCHR@ GL_GNULIB_MBSCSPN = @GL_GNULIB_MBSCSPN@ GL_GNULIB_MBSINIT = @GL_GNULIB_MBSINIT@ GL_GNULIB_MBSLEN = @GL_GNULIB_MBSLEN@ GL_GNULIB_MBSNCASECMP = @GL_GNULIB_MBSNCASECMP@ GL_GNULIB_MBSNLEN = @GL_GNULIB_MBSNLEN@ GL_GNULIB_MBSNRTOWCS = @GL_GNULIB_MBSNRTOWCS@ GL_GNULIB_MBSPBRK = @GL_GNULIB_MBSPBRK@ GL_GNULIB_MBSPCASECMP = @GL_GNULIB_MBSPCASECMP@ GL_GNULIB_MBSRCHR = @GL_GNULIB_MBSRCHR@ GL_GNULIB_MBSRTOWCS = @GL_GNULIB_MBSRTOWCS@ GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@ GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@ GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@ GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@ GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@ GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@ GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@ GL_GNULIB_MDA_CHMOD = @GL_GNULIB_MDA_CHMOD@ GL_GNULIB_MDA_CLOSE = @GL_GNULIB_MDA_CLOSE@ GL_GNULIB_MDA_CREAT = @GL_GNULIB_MDA_CREAT@ GL_GNULIB_MDA_DUP = @GL_GNULIB_MDA_DUP@ GL_GNULIB_MDA_DUP2 = @GL_GNULIB_MDA_DUP2@ GL_GNULIB_MDA_ECVT = @GL_GNULIB_MDA_ECVT@ GL_GNULIB_MDA_EXECL = @GL_GNULIB_MDA_EXECL@ GL_GNULIB_MDA_EXECLE = @GL_GNULIB_MDA_EXECLE@ GL_GNULIB_MDA_EXECLP = @GL_GNULIB_MDA_EXECLP@ GL_GNULIB_MDA_EXECV = @GL_GNULIB_MDA_EXECV@ GL_GNULIB_MDA_EXECVE = @GL_GNULIB_MDA_EXECVE@ GL_GNULIB_MDA_EXECVP = @GL_GNULIB_MDA_EXECVP@ GL_GNULIB_MDA_EXECVPE = @GL_GNULIB_MDA_EXECVPE@ GL_GNULIB_MDA_FCLOSEALL = @GL_GNULIB_MDA_FCLOSEALL@ GL_GNULIB_MDA_FCVT = @GL_GNULIB_MDA_FCVT@ GL_GNULIB_MDA_FDOPEN = @GL_GNULIB_MDA_FDOPEN@ GL_GNULIB_MDA_FILENO = @GL_GNULIB_MDA_FILENO@ GL_GNULIB_MDA_GCVT = @GL_GNULIB_MDA_GCVT@ GL_GNULIB_MDA_GETCWD = @GL_GNULIB_MDA_GETCWD@ GL_GNULIB_MDA_GETPID = @GL_GNULIB_MDA_GETPID@ GL_GNULIB_MDA_GETW = @GL_GNULIB_MDA_GETW@ GL_GNULIB_MDA_ISATTY = @GL_GNULIB_MDA_ISATTY@ GL_GNULIB_MDA_LSEEK = @GL_GNULIB_MDA_LSEEK@ GL_GNULIB_MDA_MEMCCPY = @GL_GNULIB_MDA_MEMCCPY@ GL_GNULIB_MDA_MKDIR = @GL_GNULIB_MDA_MKDIR@ GL_GNULIB_MDA_MKTEMP = @GL_GNULIB_MDA_MKTEMP@ GL_GNULIB_MDA_OPEN = @GL_GNULIB_MDA_OPEN@ GL_GNULIB_MDA_PUTENV = @GL_GNULIB_MDA_PUTENV@ GL_GNULIB_MDA_PUTW = @GL_GNULIB_MDA_PUTW@ GL_GNULIB_MDA_READ = @GL_GNULIB_MDA_READ@ GL_GNULIB_MDA_RMDIR = @GL_GNULIB_MDA_RMDIR@ GL_GNULIB_MDA_STRDUP = @GL_GNULIB_MDA_STRDUP@ GL_GNULIB_MDA_SWAB = @GL_GNULIB_MDA_SWAB@ GL_GNULIB_MDA_TEMPNAM = @GL_GNULIB_MDA_TEMPNAM@ GL_GNULIB_MDA_TZSET = @GL_GNULIB_MDA_TZSET@ GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@ GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@ GL_GNULIB_MDA_WCSDUP = @GL_GNULIB_MDA_WCSDUP@ GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@ GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@ GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@ GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@ GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@ GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@ GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@ GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@ GL_GNULIB_MKFIFO = @GL_GNULIB_MKFIFO@ GL_GNULIB_MKFIFOAT = @GL_GNULIB_MKFIFOAT@ GL_GNULIB_MKNOD = @GL_GNULIB_MKNOD@ GL_GNULIB_MKNODAT = @GL_GNULIB_MKNODAT@ GL_GNULIB_MKOSTEMP = @GL_GNULIB_MKOSTEMP@ GL_GNULIB_MKOSTEMPS = @GL_GNULIB_MKOSTEMPS@ GL_GNULIB_MKSTEMP = @GL_GNULIB_MKSTEMP@ GL_GNULIB_MKSTEMPS = @GL_GNULIB_MKSTEMPS@ GL_GNULIB_MKTIME = @GL_GNULIB_MKTIME@ GL_GNULIB_NANOSLEEP = @GL_GNULIB_NANOSLEEP@ GL_GNULIB_NL_LANGINFO = @GL_GNULIB_NL_LANGINFO@ GL_GNULIB_NONBLOCKING = @GL_GNULIB_NONBLOCKING@ GL_GNULIB_OBSTACK_PRINTF = @GL_GNULIB_OBSTACK_PRINTF@ GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@ GL_GNULIB_OPEN = @GL_GNULIB_OPEN@ GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@ GL_GNULIB_OPENDIR = @GL_GNULIB_OPENDIR@ GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@ GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@ GL_GNULIB_PERROR = @GL_GNULIB_PERROR@ GL_GNULIB_PIPE = @GL_GNULIB_PIPE@ GL_GNULIB_PIPE2 = @GL_GNULIB_PIPE2@ GL_GNULIB_POPEN = @GL_GNULIB_POPEN@ GL_GNULIB_POSIX_MEMALIGN = @GL_GNULIB_POSIX_MEMALIGN@ GL_GNULIB_POSIX_OPENPT = @GL_GNULIB_POSIX_OPENPT@ GL_GNULIB_PREAD = @GL_GNULIB_PREAD@ GL_GNULIB_PRINTF = @GL_GNULIB_PRINTF@ GL_GNULIB_PRINTF_POSIX = @GL_GNULIB_PRINTF_POSIX@ GL_GNULIB_PSELECT = @GL_GNULIB_PSELECT@ GL_GNULIB_PTHREAD_COND = @GL_GNULIB_PTHREAD_COND@ GL_GNULIB_PTHREAD_MUTEX = @GL_GNULIB_PTHREAD_MUTEX@ GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK = @GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK@ GL_GNULIB_PTHREAD_ONCE = @GL_GNULIB_PTHREAD_ONCE@ GL_GNULIB_PTHREAD_RWLOCK = @GL_GNULIB_PTHREAD_RWLOCK@ GL_GNULIB_PTHREAD_SIGMASK = @GL_GNULIB_PTHREAD_SIGMASK@ GL_GNULIB_PTHREAD_SPIN = @GL_GNULIB_PTHREAD_SPIN@ GL_GNULIB_PTHREAD_THREAD = @GL_GNULIB_PTHREAD_THREAD@ GL_GNULIB_PTHREAD_TSS = @GL_GNULIB_PTHREAD_TSS@ GL_GNULIB_PTSNAME = @GL_GNULIB_PTSNAME@ GL_GNULIB_PTSNAME_R = @GL_GNULIB_PTSNAME_R@ GL_GNULIB_PUTC = @GL_GNULIB_PUTC@ GL_GNULIB_PUTCHAR = @GL_GNULIB_PUTCHAR@ GL_GNULIB_PUTENV = @GL_GNULIB_PUTENV@ GL_GNULIB_PUTS = @GL_GNULIB_PUTS@ GL_GNULIB_PWRITE = @GL_GNULIB_PWRITE@ GL_GNULIB_QSORT_R = @GL_GNULIB_QSORT_R@ GL_GNULIB_RAISE = @GL_GNULIB_RAISE@ GL_GNULIB_RANDOM = @GL_GNULIB_RANDOM@ GL_GNULIB_RANDOM_R = @GL_GNULIB_RANDOM_R@ GL_GNULIB_RAWMEMCHR = @GL_GNULIB_RAWMEMCHR@ GL_GNULIB_READ = @GL_GNULIB_READ@ GL_GNULIB_READDIR = @GL_GNULIB_READDIR@ GL_GNULIB_READLINK = @GL_GNULIB_READLINK@ GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@ GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@ GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@ GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@ GL_GNULIB_RECV = @GL_GNULIB_RECV@ GL_GNULIB_RECVFROM = @GL_GNULIB_RECVFROM@ GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@ GL_GNULIB_RENAME = @GL_GNULIB_RENAME@ GL_GNULIB_RENAMEAT = @GL_GNULIB_RENAMEAT@ GL_GNULIB_REWINDDIR = @GL_GNULIB_REWINDDIR@ GL_GNULIB_RMDIR = @GL_GNULIB_RMDIR@ GL_GNULIB_RPMATCH = @GL_GNULIB_RPMATCH@ GL_GNULIB_SCANDIR = @GL_GNULIB_SCANDIR@ GL_GNULIB_SCANF = @GL_GNULIB_SCANF@ GL_GNULIB_SCHED_YIELD = @GL_GNULIB_SCHED_YIELD@ GL_GNULIB_SECURE_GETENV = @GL_GNULIB_SECURE_GETENV@ GL_GNULIB_SELECT = @GL_GNULIB_SELECT@ GL_GNULIB_SEND = @GL_GNULIB_SEND@ GL_GNULIB_SENDTO = @GL_GNULIB_SENDTO@ GL_GNULIB_SETENV = @GL_GNULIB_SETENV@ GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@ GL_GNULIB_SETLOCALE = @GL_GNULIB_SETLOCALE@ GL_GNULIB_SETLOCALE_NULL = @GL_GNULIB_SETLOCALE_NULL@ GL_GNULIB_SETSOCKOPT = @GL_GNULIB_SETSOCKOPT@ GL_GNULIB_SHUTDOWN = @GL_GNULIB_SHUTDOWN@ GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@ GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@ GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@ GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@ GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@ GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@ GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@ GL_GNULIB_SOCKET = @GL_GNULIB_SOCKET@ GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@ GL_GNULIB_STAT = @GL_GNULIB_STAT@ GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@ GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@ GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@ GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@ GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@ GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@ GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@ GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@ GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@ GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@ GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@ GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@ GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@ GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@ GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@ GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@ GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@ GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@ GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@ GL_GNULIB_STRTOLD = @GL_GNULIB_STRTOLD@ GL_GNULIB_STRTOLL = @GL_GNULIB_STRTOLL@ GL_GNULIB_STRTOUL = @GL_GNULIB_STRTOUL@ GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@ GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@ GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@ GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@ GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@ GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@ GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@ GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@ GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@ GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@ GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@ GL_GNULIB_TOWCTRANS = @GL_GNULIB_TOWCTRANS@ GL_GNULIB_TRUNCATE = @GL_GNULIB_TRUNCATE@ GL_GNULIB_TTYNAME_R = @GL_GNULIB_TTYNAME_R@ GL_GNULIB_TZSET = @GL_GNULIB_TZSET@ GL_GNULIB_UNISTD_H_GETOPT = @GL_GNULIB_UNISTD_H_GETOPT@ GL_GNULIB_UNISTD_H_NONBLOCKING = @GL_GNULIB_UNISTD_H_NONBLOCKING@ GL_GNULIB_UNISTD_H_SIGPIPE = @GL_GNULIB_UNISTD_H_SIGPIPE@ GL_GNULIB_UNLINK = @GL_GNULIB_UNLINK@ GL_GNULIB_UNLINKAT = @GL_GNULIB_UNLINKAT@ GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@ GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@ GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@ GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@ GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@ GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@ GL_GNULIB_VFPRINTF = @GL_GNULIB_VFPRINTF@ GL_GNULIB_VFPRINTF_POSIX = @GL_GNULIB_VFPRINTF_POSIX@ GL_GNULIB_VFSCANF = @GL_GNULIB_VFSCANF@ GL_GNULIB_VPRINTF = @GL_GNULIB_VPRINTF@ GL_GNULIB_VPRINTF_POSIX = @GL_GNULIB_VPRINTF_POSIX@ GL_GNULIB_VSCANF = @GL_GNULIB_VSCANF@ GL_GNULIB_VSNPRINTF = @GL_GNULIB_VSNPRINTF@ GL_GNULIB_VSPRINTF_POSIX = @GL_GNULIB_VSPRINTF_POSIX@ GL_GNULIB_WCPCPY = @GL_GNULIB_WCPCPY@ GL_GNULIB_WCPNCPY = @GL_GNULIB_WCPNCPY@ GL_GNULIB_WCRTOMB = @GL_GNULIB_WCRTOMB@ GL_GNULIB_WCSCASECMP = @GL_GNULIB_WCSCASECMP@ GL_GNULIB_WCSCAT = @GL_GNULIB_WCSCAT@ GL_GNULIB_WCSCHR = @GL_GNULIB_WCSCHR@ GL_GNULIB_WCSCMP = @GL_GNULIB_WCSCMP@ GL_GNULIB_WCSCOLL = @GL_GNULIB_WCSCOLL@ GL_GNULIB_WCSCPY = @GL_GNULIB_WCSCPY@ GL_GNULIB_WCSCSPN = @GL_GNULIB_WCSCSPN@ GL_GNULIB_WCSDUP = @GL_GNULIB_WCSDUP@ GL_GNULIB_WCSFTIME = @GL_GNULIB_WCSFTIME@ GL_GNULIB_WCSLEN = @GL_GNULIB_WCSLEN@ GL_GNULIB_WCSNCASECMP = @GL_GNULIB_WCSNCASECMP@ GL_GNULIB_WCSNCAT = @GL_GNULIB_WCSNCAT@ GL_GNULIB_WCSNCMP = @GL_GNULIB_WCSNCMP@ GL_GNULIB_WCSNCPY = @GL_GNULIB_WCSNCPY@ GL_GNULIB_WCSNLEN = @GL_GNULIB_WCSNLEN@ GL_GNULIB_WCSNRTOMBS = @GL_GNULIB_WCSNRTOMBS@ GL_GNULIB_WCSPBRK = @GL_GNULIB_WCSPBRK@ GL_GNULIB_WCSRCHR = @GL_GNULIB_WCSRCHR@ GL_GNULIB_WCSRTOMBS = @GL_GNULIB_WCSRTOMBS@ GL_GNULIB_WCSSPN = @GL_GNULIB_WCSSPN@ GL_GNULIB_WCSSTR = @GL_GNULIB_WCSSTR@ GL_GNULIB_WCSTOK = @GL_GNULIB_WCSTOK@ GL_GNULIB_WCSWIDTH = @GL_GNULIB_WCSWIDTH@ GL_GNULIB_WCSXFRM = @GL_GNULIB_WCSXFRM@ GL_GNULIB_WCTOB = @GL_GNULIB_WCTOB@ GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@ GL_GNULIB_WCTRANS = @GL_GNULIB_WCTRANS@ GL_GNULIB_WCTYPE = @GL_GNULIB_WCTYPE@ GL_GNULIB_WCWIDTH = @GL_GNULIB_WCWIDTH@ GL_GNULIB_WMEMCHR = @GL_GNULIB_WMEMCHR@ GL_GNULIB_WMEMCMP = @GL_GNULIB_WMEMCMP@ GL_GNULIB_WMEMCPY = @GL_GNULIB_WMEMCPY@ GL_GNULIB_WMEMMOVE = @GL_GNULIB_WMEMMOVE@ GL_GNULIB_WMEMPCPY = @GL_GNULIB_WMEMPCPY@ GL_GNULIB_WMEMSET = @GL_GNULIB_WMEMSET@ GL_GNULIB_WRITE = @GL_GNULIB_WRITE@ GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_TEST_WARN_CFLAGS = @GNULIB_TEST_WARN_CFLAGS@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ GREP = @GREP@ HAVE_ACCEPT4 = @HAVE_ACCEPT4@ HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@ HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@ HAVE_DECL_DIRFD = @HAVE_DECL_DIRFD@ HAVE_DECL_ECVT = @HAVE_DECL_ECVT@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXECVPE = @HAVE_DECL_EXECVPE@ HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ HAVE_DECL_FCLOSEALL = @HAVE_DECL_FCLOSEALL@ HAVE_DECL_FCVT = @HAVE_DECL_FCVT@ HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@ HAVE_DECL_FDOPENDIR = @HAVE_DECL_FDOPENDIR@ HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@ HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@ HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@ HAVE_DECL_GCVT = @HAVE_DECL_GCVT@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@ HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@ HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCSDUP = @HAVE_DECL_WCSDUP@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DIRENT_H = @HAVE_DIRENT_H@ HAVE_DPRINTF = @HAVE_DPRINTF@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_EXECVPE = @HAVE_EXECVPE@ HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHMODAT = @HAVE_FCHMODAT@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FCNTL = @HAVE_FCNTL@ HAVE_FDATASYNC = @HAVE_FDATASYNC@ HAVE_FDOPENDIR = @HAVE_FDOPENDIR@ HAVE_FEATURES_H = @HAVE_FEATURES_H@ HAVE_FFSL = @HAVE_FFSL@ HAVE_FFSLL = @HAVE_FFSLL@ HAVE_FNMATCH = @HAVE_FNMATCH@ HAVE_FNMATCH_H = @HAVE_FNMATCH_H@ HAVE_FREELOCALE = @HAVE_FREELOCALE@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FSTATAT = @HAVE_FSTATAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_FUTIMENS = @HAVE_FUTIMENS@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETENTROPY = @HAVE_GETENTROPY@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETPASS = @HAVE_GETPASS@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ HAVE_GETUMASK = @HAVE_GETUMASK@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISBLANK = @HAVE_ISBLANK@ HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LANGINFO_ALTMON = @HAVE_LANGINFO_ALTMON@ HAVE_LANGINFO_CODESET = @HAVE_LANGINFO_CODESET@ HAVE_LANGINFO_ERA = @HAVE_LANGINFO_ERA@ HAVE_LANGINFO_H = @HAVE_LANGINFO_H@ HAVE_LANGINFO_T_FMT_AMPM = @HAVE_LANGINFO_T_FMT_AMPM@ HAVE_LANGINFO_YESEXPR = @HAVE_LANGINFO_YESEXPR@ HAVE_LCHMOD = @HAVE_LCHMOD@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDIRAT = @HAVE_MKDIRAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ HAVE_MKFIFO = @HAVE_MKFIFO@ HAVE_MKFIFOAT = @HAVE_MKFIFOAT@ HAVE_MKNOD = @HAVE_MKNOD@ HAVE_MKNODAT = @HAVE_MKNODAT@ HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ HAVE_MKSTEMP = @HAVE_MKSTEMP@ HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@ HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@ HAVE_NEWLOCALE = @HAVE_NEWLOCALE@ HAVE_NL_LANGINFO = @HAVE_NL_LANGINFO@ HAVE_OPENAT = @HAVE_OPENAT@ HAVE_OPENDIR = @HAVE_OPENDIR@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PCLOSE = @HAVE_PCLOSE@ HAVE_PIPE = @HAVE_PIPE@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_POPEN = @HAVE_POPEN@ HAVE_POSIX_MEMALIGN = @HAVE_POSIX_MEMALIGN@ HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PSELECT = @HAVE_PSELECT@ HAVE_PTHREAD_ATTR_DESTROY = @HAVE_PTHREAD_ATTR_DESTROY@ HAVE_PTHREAD_ATTR_GETDETACHSTATE = @HAVE_PTHREAD_ATTR_GETDETACHSTATE@ HAVE_PTHREAD_ATTR_INIT = @HAVE_PTHREAD_ATTR_INIT@ HAVE_PTHREAD_ATTR_SETDETACHSTATE = @HAVE_PTHREAD_ATTR_SETDETACHSTATE@ HAVE_PTHREAD_CONDATTR_DESTROY = @HAVE_PTHREAD_CONDATTR_DESTROY@ HAVE_PTHREAD_CONDATTR_INIT = @HAVE_PTHREAD_CONDATTR_INIT@ HAVE_PTHREAD_COND_BROADCAST = @HAVE_PTHREAD_COND_BROADCAST@ HAVE_PTHREAD_COND_DESTROY = @HAVE_PTHREAD_COND_DESTROY@ HAVE_PTHREAD_COND_INIT = @HAVE_PTHREAD_COND_INIT@ HAVE_PTHREAD_COND_SIGNAL = @HAVE_PTHREAD_COND_SIGNAL@ HAVE_PTHREAD_COND_TIMEDWAIT = @HAVE_PTHREAD_COND_TIMEDWAIT@ HAVE_PTHREAD_COND_WAIT = @HAVE_PTHREAD_COND_WAIT@ HAVE_PTHREAD_CREATE = @HAVE_PTHREAD_CREATE@ HAVE_PTHREAD_CREATE_DETACHED = @HAVE_PTHREAD_CREATE_DETACHED@ HAVE_PTHREAD_DETACH = @HAVE_PTHREAD_DETACH@ HAVE_PTHREAD_EQUAL = @HAVE_PTHREAD_EQUAL@ HAVE_PTHREAD_EXIT = @HAVE_PTHREAD_EXIT@ HAVE_PTHREAD_GETSPECIFIC = @HAVE_PTHREAD_GETSPECIFIC@ HAVE_PTHREAD_H = @HAVE_PTHREAD_H@ HAVE_PTHREAD_JOIN = @HAVE_PTHREAD_JOIN@ HAVE_PTHREAD_KEY_CREATE = @HAVE_PTHREAD_KEY_CREATE@ HAVE_PTHREAD_KEY_DELETE = @HAVE_PTHREAD_KEY_DELETE@ HAVE_PTHREAD_MUTEXATTR_DESTROY = @HAVE_PTHREAD_MUTEXATTR_DESTROY@ HAVE_PTHREAD_MUTEXATTR_GETROBUST = @HAVE_PTHREAD_MUTEXATTR_GETROBUST@ HAVE_PTHREAD_MUTEXATTR_GETTYPE = @HAVE_PTHREAD_MUTEXATTR_GETTYPE@ HAVE_PTHREAD_MUTEXATTR_INIT = @HAVE_PTHREAD_MUTEXATTR_INIT@ HAVE_PTHREAD_MUTEXATTR_SETROBUST = @HAVE_PTHREAD_MUTEXATTR_SETROBUST@ HAVE_PTHREAD_MUTEXATTR_SETTYPE = @HAVE_PTHREAD_MUTEXATTR_SETTYPE@ HAVE_PTHREAD_MUTEX_DESTROY = @HAVE_PTHREAD_MUTEX_DESTROY@ HAVE_PTHREAD_MUTEX_INIT = @HAVE_PTHREAD_MUTEX_INIT@ HAVE_PTHREAD_MUTEX_LOCK = @HAVE_PTHREAD_MUTEX_LOCK@ HAVE_PTHREAD_MUTEX_RECURSIVE = @HAVE_PTHREAD_MUTEX_RECURSIVE@ HAVE_PTHREAD_MUTEX_ROBUST = @HAVE_PTHREAD_MUTEX_ROBUST@ HAVE_PTHREAD_MUTEX_TIMEDLOCK = @HAVE_PTHREAD_MUTEX_TIMEDLOCK@ HAVE_PTHREAD_MUTEX_TRYLOCK = @HAVE_PTHREAD_MUTEX_TRYLOCK@ HAVE_PTHREAD_MUTEX_UNLOCK = @HAVE_PTHREAD_MUTEX_UNLOCK@ HAVE_PTHREAD_ONCE = @HAVE_PTHREAD_ONCE@ HAVE_PTHREAD_PROCESS_SHARED = @HAVE_PTHREAD_PROCESS_SHARED@ HAVE_PTHREAD_RWLOCKATTR_DESTROY = @HAVE_PTHREAD_RWLOCKATTR_DESTROY@ HAVE_PTHREAD_RWLOCKATTR_INIT = @HAVE_PTHREAD_RWLOCKATTR_INIT@ HAVE_PTHREAD_RWLOCK_DESTROY = @HAVE_PTHREAD_RWLOCK_DESTROY@ HAVE_PTHREAD_RWLOCK_INIT = @HAVE_PTHREAD_RWLOCK_INIT@ HAVE_PTHREAD_RWLOCK_RDLOCK = @HAVE_PTHREAD_RWLOCK_RDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@ HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@ HAVE_PTHREAD_RWLOCK_TRYRDLOCK = @HAVE_PTHREAD_RWLOCK_TRYRDLOCK@ HAVE_PTHREAD_RWLOCK_TRYWRLOCK = @HAVE_PTHREAD_RWLOCK_TRYWRLOCK@ HAVE_PTHREAD_RWLOCK_UNLOCK = @HAVE_PTHREAD_RWLOCK_UNLOCK@ HAVE_PTHREAD_RWLOCK_WRLOCK = @HAVE_PTHREAD_RWLOCK_WRLOCK@ HAVE_PTHREAD_SELF = @HAVE_PTHREAD_SELF@ HAVE_PTHREAD_SETSPECIFIC = @HAVE_PTHREAD_SETSPECIFIC@ HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@ HAVE_PTHREAD_SPINLOCK_T = @HAVE_PTHREAD_SPINLOCK_T@ HAVE_PTHREAD_SPIN_DESTROY = @HAVE_PTHREAD_SPIN_DESTROY@ HAVE_PTHREAD_SPIN_INIT = @HAVE_PTHREAD_SPIN_INIT@ HAVE_PTHREAD_SPIN_LOCK = @HAVE_PTHREAD_SPIN_LOCK@ HAVE_PTHREAD_SPIN_TRYLOCK = @HAVE_PTHREAD_SPIN_TRYLOCK@ HAVE_PTHREAD_SPIN_UNLOCK = @HAVE_PTHREAD_SPIN_UNLOCK@ HAVE_PTHREAD_T = @HAVE_PTHREAD_T@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RAISE = @HAVE_RAISE@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READDIR = @HAVE_READDIR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RENAMEAT = @HAVE_RENAMEAT@ HAVE_REWINDDIR = @HAVE_REWINDDIR@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SA_FAMILY_T = @HAVE_SA_FAMILY_T@ HAVE_SCANDIR = @HAVE_SCANDIR@ HAVE_SCHED_H = @HAVE_SCHED_H@ HAVE_SCHED_YIELD = @HAVE_SCHED_YIELD@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ HAVE_SETSTATE = @HAVE_SETSTATE@ HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@ HAVE_SIGACTION = @HAVE_SIGACTION@ HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@ HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRTOL = @HAVE_STRTOL@ HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOUL = @HAVE_STRTOUL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRUCT_SCHED_PARAM = @HAVE_STRUCT_SCHED_PARAM@ HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@ HAVE_STRUCT_SOCKADDR_STORAGE = @HAVE_STRUCT_SOCKADDR_STORAGE@ HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = @HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_IOCTL_H = @HAVE_SYS_IOCTL_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@ HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_SYS_UIO_H = @HAVE_SYS_UIO_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@ HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_VDPRINTF = @HAVE_VDPRINTF@ HAVE_VISIBILITY = @HAVE_VISIBILITY@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCPCPY = @HAVE_WCPCPY@ HAVE_WCPNCPY = @HAVE_WCPNCPY@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ HAVE_WCSCASECMP = @HAVE_WCSCASECMP@ HAVE_WCSCAT = @HAVE_WCSCAT@ HAVE_WCSCHR = @HAVE_WCSCHR@ HAVE_WCSCMP = @HAVE_WCSCMP@ HAVE_WCSCOLL = @HAVE_WCSCOLL@ HAVE_WCSCPY = @HAVE_WCSCPY@ HAVE_WCSCSPN = @HAVE_WCSCSPN@ HAVE_WCSDUP = @HAVE_WCSDUP@ HAVE_WCSFTIME = @HAVE_WCSFTIME@ HAVE_WCSLEN = @HAVE_WCSLEN@ HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@ HAVE_WCSNCAT = @HAVE_WCSNCAT@ HAVE_WCSNCMP = @HAVE_WCSNCMP@ HAVE_WCSNCPY = @HAVE_WCSNCPY@ HAVE_WCSNLEN = @HAVE_WCSNLEN@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSPBRK = @HAVE_WCSPBRK@ HAVE_WCSRCHR = @HAVE_WCSRCHR@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCSSPN = @HAVE_WCSSPN@ HAVE_WCSSTR = @HAVE_WCSSTR@ HAVE_WCSTOK = @HAVE_WCSTOK@ HAVE_WCSWIDTH = @HAVE_WCSWIDTH@ HAVE_WCSXFRM = @HAVE_WCSXFRM@ HAVE_WCTRANS_T = @HAVE_WCTRANS_T@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WCTYPE_T = @HAVE_WCTYPE_T@ HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE_WMEMCHR = @HAVE_WMEMCHR@ HAVE_WMEMCMP = @HAVE_WMEMCMP@ HAVE_WMEMCPY = @HAVE_WMEMCPY@ HAVE_WMEMMOVE = @HAVE_WMEMMOVE@ HAVE_WMEMPCPY = @HAVE_WMEMPCPY@ HAVE_WMEMSET = @HAVE_WMEMSET@ HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@ HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HAVE__EXIT = @HAVE__EXIT@ HOST_CPU = @HOST_CPU@ HOST_CPU_C_ABI = @HOST_CPU_C_ABI@ ICONV_CONST = @ICONV_CONST@ ICONV_H = @ICONV_H@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INET_PTON_LIB = @INET_PTON_LIB@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBCSTACK = @LIBCSTACK@ LIBGREPUTILS_LIBDEPS = @LIBGREPUTILS_LIBDEPS@ LIBGREPUTILS_LTLIBDEPS = @LIBGREPUTILS_LTLIBDEPS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ LIBPMULTITHREAD = @LIBPMULTITHREAD@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBSIGSEGV = @LIBSIGSEGV@ LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@ LIBSOCKET = @LIBSOCKET@ LIBSTDTHREAD = @LIBSTDTHREAD@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ LIBTHREAD = @LIBTHREAD@ LIBUNISTRING_UNISTR_H = @LIBUNISTRING_UNISTR_H@ LIBUNISTRING_UNITYPES_H = @LIBUNISTRING_UNITYPES_H@ LIBUNISTRING_UNIWIDTH_H = @LIBUNISTRING_UNIWIDTH_H@ LIB_HARD_LOCALE = @LIB_HARD_LOCALE@ LIB_MBRTOWC = @LIB_MBRTOWC@ LIB_NANOSLEEP = @LIB_NANOSLEEP@ LIB_NL_LANGINFO = @LIB_NL_LANGINFO@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ LIB_SCHED_YIELD = @LIB_SCHED_YIELD@ LIB_SELECT = @LIB_SELECT@ LIB_SETLOCALE = @LIB_SETLOCALE@ LIB_SETLOCALE_NULL = @LIB_SETLOCALE_NULL@ LIMITS_H = @LIMITS_H@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALENAME_ENHANCE_LOCALE_FUNCS = @LOCALENAME_ENHANCE_LOCALE_FUNCS@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBCSTACK = @LTLIBCSTACK@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ LTLIBSIGSEGV = @LTLIBSIGSEGV@ LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ NETINET_IN_H = @NETINET_IN_H@ NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_CTYPE_H@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H = @NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@ NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@ NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H = @NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H@ NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H = @NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H@ NEXT_AS_FIRST_DIRECTIVE_SCHED_H = @NEXT_AS_FIRST_DIRECTIVE_SCHED_H@ NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@ NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_CTYPE_H = @NEXT_CTYPE_H@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_FNMATCH_H = @NEXT_FNMATCH_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ NEXT_LANGINFO_H = @NEXT_LANGINFO_H@ NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@ NEXT_PTHREAD_H = @NEXT_PTHREAD_H@ NEXT_SCHED_H = @NEXT_SCHED_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_IOCTL_H = @NEXT_SYS_IOCTL_H@ NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@ NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@ NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NEXT_WCHAR_H = @NEXT_WCHAR_H@ NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_LIBS = @PCRE_LIBS@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ PRAGMA_COLUMNS = @PRAGMA_COLUMNS@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ PRIPTR_PREFIX = @PRIPTR_PREFIX@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_ACCESS = @REPLACE_ACCESS@ REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@ REPLACE_BTOWC = @REPLACE_BTOWC@ REPLACE_CALLOC = @REPLACE_CALLOC@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@ REPLACE_CREAT = @REPLACE_CREAT@ REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ REPLACE_EXECL = @REPLACE_EXECL@ REPLACE_EXECLE = @REPLACE_EXECLE@ REPLACE_EXECLP = @REPLACE_EXECLP@ REPLACE_EXECV = @REPLACE_EXECV@ REPLACE_EXECVE = @REPLACE_EXECVE@ REPLACE_EXECVP = @REPLACE_EXECVP@ REPLACE_EXECVPE = @REPLACE_EXECVPE@ REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHMODAT = @REPLACE_FCHMODAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ REPLACE_FDOPEN = @REPLACE_FDOPEN@ REPLACE_FDOPENDIR = @REPLACE_FDOPENDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ REPLACE_FFSLL = @REPLACE_FFSLL@ REPLACE_FNMATCH = @REPLACE_FNMATCH@ REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ REPLACE_FPURGE = @REPLACE_FPURGE@ REPLACE_FREE = @REPLACE_FREE@ REPLACE_FREELOCALE = @REPLACE_FREELOCALE@ REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FSEEK = @REPLACE_FSEEK@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FSTAT = @REPLACE_FSTAT@ REPLACE_FSTATAT = @REPLACE_FSTATAT@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@ REPLACE_FUTIMENS = @REPLACE_FUTIMENS@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETDELIM = @REPLACE_GETDELIM@ REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ REPLACE_GETDTABLESIZE = @REPLACE_GETDTABLESIZE@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETLINE = @REPLACE_GETLINE@ REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETPASS = @REPLACE_GETPASS@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ REPLACE_GMTIME = @REPLACE_GMTIME@ REPLACE_ICONV = @REPLACE_ICONV@ REPLACE_ICONV_OPEN = @REPLACE_ICONV_OPEN@ REPLACE_ICONV_UTF = @REPLACE_ICONV_UTF@ REPLACE_INET_NTOP = @REPLACE_INET_NTOP@ REPLACE_INET_PTON = @REPLACE_INET_PTON@ REPLACE_INITSTATE = @REPLACE_INITSTATE@ REPLACE_IOCTL = @REPLACE_IOCTL@ REPLACE_ISATTY = @REPLACE_ISATTY@ REPLACE_ISWBLANK = @REPLACE_ISWBLANK@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_ISWDIGIT = @REPLACE_ISWDIGIT@ REPLACE_ISWXDIGIT = @REPLACE_ISWXDIGIT@ REPLACE_ITOLD = @REPLACE_ITOLD@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LOCALECONV = @REPLACE_LOCALECONV@ REPLACE_LOCALTIME = @REPLACE_LOCALTIME@ REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_LSTAT = @REPLACE_LSTAT@ REPLACE_MALLOC = @REPLACE_MALLOC@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ REPLACE_MBSINIT = @REPLACE_MBSINIT@ REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@ REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@ REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@ REPLACE_MBTOWC = @REPLACE_MBTOWC@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKDIR = @REPLACE_MKDIR@ REPLACE_MKFIFO = @REPLACE_MKFIFO@ REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@ REPLACE_MKNOD = @REPLACE_MKNOD@ REPLACE_MKNODAT = @REPLACE_MKNODAT@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_MKTIME = @REPLACE_MKTIME@ REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ REPLACE_NEWLOCALE = @REPLACE_NEWLOCALE@ REPLACE_NL_LANGINFO = @REPLACE_NL_LANGINFO@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ REPLACE_OPEN = @REPLACE_OPEN@ REPLACE_OPENAT = @REPLACE_OPENAT@ REPLACE_OPENDIR = @REPLACE_OPENDIR@ REPLACE_PERROR = @REPLACE_PERROR@ REPLACE_POPEN = @REPLACE_POPEN@ REPLACE_POSIX_MEMALIGN = @REPLACE_POSIX_MEMALIGN@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PRINTF = @REPLACE_PRINTF@ REPLACE_PSELECT = @REPLACE_PSELECT@ REPLACE_PTHREAD_ATTR_DESTROY = @REPLACE_PTHREAD_ATTR_DESTROY@ REPLACE_PTHREAD_ATTR_GETDETACHSTATE = @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@ REPLACE_PTHREAD_ATTR_INIT = @REPLACE_PTHREAD_ATTR_INIT@ REPLACE_PTHREAD_ATTR_SETDETACHSTATE = @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@ REPLACE_PTHREAD_CONDATTR_DESTROY = @REPLACE_PTHREAD_CONDATTR_DESTROY@ REPLACE_PTHREAD_CONDATTR_INIT = @REPLACE_PTHREAD_CONDATTR_INIT@ REPLACE_PTHREAD_COND_BROADCAST = @REPLACE_PTHREAD_COND_BROADCAST@ REPLACE_PTHREAD_COND_DESTROY = @REPLACE_PTHREAD_COND_DESTROY@ REPLACE_PTHREAD_COND_INIT = @REPLACE_PTHREAD_COND_INIT@ REPLACE_PTHREAD_COND_SIGNAL = @REPLACE_PTHREAD_COND_SIGNAL@ REPLACE_PTHREAD_COND_TIMEDWAIT = @REPLACE_PTHREAD_COND_TIMEDWAIT@ REPLACE_PTHREAD_COND_WAIT = @REPLACE_PTHREAD_COND_WAIT@ REPLACE_PTHREAD_CREATE = @REPLACE_PTHREAD_CREATE@ REPLACE_PTHREAD_DETACH = @REPLACE_PTHREAD_DETACH@ REPLACE_PTHREAD_EQUAL = @REPLACE_PTHREAD_EQUAL@ REPLACE_PTHREAD_EXIT = @REPLACE_PTHREAD_EXIT@ REPLACE_PTHREAD_GETSPECIFIC = @REPLACE_PTHREAD_GETSPECIFIC@ REPLACE_PTHREAD_JOIN = @REPLACE_PTHREAD_JOIN@ REPLACE_PTHREAD_KEY_CREATE = @REPLACE_PTHREAD_KEY_CREATE@ REPLACE_PTHREAD_KEY_DELETE = @REPLACE_PTHREAD_KEY_DELETE@ REPLACE_PTHREAD_MUTEXATTR_DESTROY = @REPLACE_PTHREAD_MUTEXATTR_DESTROY@ REPLACE_PTHREAD_MUTEXATTR_GETROBUST = @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@ REPLACE_PTHREAD_MUTEXATTR_GETTYPE = @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@ REPLACE_PTHREAD_MUTEXATTR_INIT = @REPLACE_PTHREAD_MUTEXATTR_INIT@ REPLACE_PTHREAD_MUTEXATTR_SETROBUST = @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@ REPLACE_PTHREAD_MUTEXATTR_SETTYPE = @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@ REPLACE_PTHREAD_MUTEX_DESTROY = @REPLACE_PTHREAD_MUTEX_DESTROY@ REPLACE_PTHREAD_MUTEX_INIT = @REPLACE_PTHREAD_MUTEX_INIT@ REPLACE_PTHREAD_MUTEX_LOCK = @REPLACE_PTHREAD_MUTEX_LOCK@ REPLACE_PTHREAD_MUTEX_TIMEDLOCK = @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@ REPLACE_PTHREAD_MUTEX_TRYLOCK = @REPLACE_PTHREAD_MUTEX_TRYLOCK@ REPLACE_PTHREAD_MUTEX_UNLOCK = @REPLACE_PTHREAD_MUTEX_UNLOCK@ REPLACE_PTHREAD_ONCE = @REPLACE_PTHREAD_ONCE@ REPLACE_PTHREAD_RWLOCKATTR_DESTROY = @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@ REPLACE_PTHREAD_RWLOCKATTR_INIT = @REPLACE_PTHREAD_RWLOCKATTR_INIT@ REPLACE_PTHREAD_RWLOCK_DESTROY = @REPLACE_PTHREAD_RWLOCK_DESTROY@ REPLACE_PTHREAD_RWLOCK_INIT = @REPLACE_PTHREAD_RWLOCK_INIT@ REPLACE_PTHREAD_RWLOCK_RDLOCK = @REPLACE_PTHREAD_RWLOCK_RDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@ REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@ REPLACE_PTHREAD_RWLOCK_TRYRDLOCK = @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@ REPLACE_PTHREAD_RWLOCK_TRYWRLOCK = @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@ REPLACE_PTHREAD_RWLOCK_UNLOCK = @REPLACE_PTHREAD_RWLOCK_UNLOCK@ REPLACE_PTHREAD_RWLOCK_WRLOCK = @REPLACE_PTHREAD_RWLOCK_WRLOCK@ REPLACE_PTHREAD_SELF = @REPLACE_PTHREAD_SELF@ REPLACE_PTHREAD_SETSPECIFIC = @REPLACE_PTHREAD_SETSPECIFIC@ REPLACE_PTHREAD_SIGMASK = @REPLACE_PTHREAD_SIGMASK@ REPLACE_PTHREAD_SPIN_DESTROY = @REPLACE_PTHREAD_SPIN_DESTROY@ REPLACE_PTHREAD_SPIN_INIT = @REPLACE_PTHREAD_SPIN_INIT@ REPLACE_PTHREAD_SPIN_LOCK = @REPLACE_PTHREAD_SPIN_LOCK@ REPLACE_PTHREAD_SPIN_TRYLOCK = @REPLACE_PTHREAD_SPIN_TRYLOCK@ REPLACE_PTHREAD_SPIN_UNLOCK = @REPLACE_PTHREAD_SPIN_UNLOCK@ REPLACE_PTSNAME = @REPLACE_PTSNAME@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RAISE = @REPLACE_RAISE@ REPLACE_RANDOM = @REPLACE_RANDOM@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SCHED_YIELD = @REPLACE_SCHED_YIELD@ REPLACE_SELECT = @REPLACE_SELECT@ REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SETLOCALE = @REPLACE_SETLOCALE@ REPLACE_SETSTATE = @REPLACE_SETSTATE@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ REPLACE_STAT = @REPLACE_STAT@ REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@ REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRTOL = @REPLACE_STRTOL@ REPLACE_STRTOLD = @REPLACE_STRTOLD@ REPLACE_STRTOLL = @REPLACE_STRTOLL@ REPLACE_STRTOUL = @REPLACE_STRTOUL@ REPLACE_STRTOULL = @REPLACE_STRTOULL@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TOWLOWER = @REPLACE_TOWLOWER@ REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_TZSET = @REPLACE_TZSET@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VDPRINTF = @REPLACE_VDPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ REPLACE_WCSTOK = @REPLACE_WCSTOK@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ REPLACE_WCTOMB = @REPLACE_WCTOMB@ REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIGSEGV_H = @SIGSEGV_H@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STDALIGN_H = @STDALIGN_H@ STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_IOCTL_H_HAVE_WINSOCK2_H = @SYS_IOCTL_H_HAVE_WINSOCK2_H@ SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@ UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WERROR_CFLAGS = @WERROR_CFLAGS@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@ WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_aux_dir = @abs_aux_dir@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TEST_EXTENSIONS = .sh .pl @HAVE_PERL_FALSE@TESTSUITE_PERL = $(SHELL) $(srcdir)/no-perl @HAVE_PERL_TRUE@TESTSUITE_PERL = $(PERL) # Options passed to the perl invocations running the perl test scripts. # '$f' is set by the Automake-generated test harness to the path of the # current test script stripped of VPATH components, and is used by the # CuTmpdir module to determine the name of the temporary files to be # used. Note that $f is a shell variable, not a make macro, so the use # of '$$f' below is correct, and not a typo. TESTSUITE_PERL_OPTIONS = -w -I$(srcdir) -MCoreutils -MCuSkip \ -M"CuTmpdir qw($$f)" SH_LOG_COMPILER = $(SHELL) PL_LOG_COMPILER = $(TESTSUITE_PERL) $(TESTSUITE_PERL_OPTIONS) AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \ -I$(top_srcdir)/src AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) # Tell the linker to omit references to unused shared libraries. AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS) LDADD = ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a # The triple-backref test is expected to fail with both the system # matcher (i.e., with glibc) and with the included matcher. # Both matchers need to be fixed. # FIXME-2015: Remove this once the glibc and gnulib bugs are fixed. XFAIL_TESTS = triple-backref $(am__append_1) # The backref-alt test fails for glibc 2.27 and earlier. # If you're using older glibc you can upgrade to glibc 2.28 or later, # configure --with-included-regex, or ignore the test failure. TESTS = \ backref \ backref-alt \ backref-multibyte-slow \ backref-word \ backslash-dot \ backslash-s-and-repetition-operators \ backslash-s-vs-invalid-multibyte \ big-hole \ big-match \ binary-file-matches \ bogus-wctob \ bre \ c-locale \ case-fold-backref \ case-fold-backslash-w \ case-fold-char-class \ case-fold-char-range \ case-fold-char-type \ case-fold-titlecase \ char-class-multibyte \ char-class-multibyte2 \ context-0 \ count-newline \ dfa-coverage \ dfa-heap-overrun \ dfa-infloop \ dfa-invalid-utf8 \ dfaexec-multibyte \ empty \ empty-line \ empty-line-mb \ encoding-error \ epipe \ equiv-classes \ ere \ euc-mb \ false-match-mb-non-utf8 \ fedora \ fgrep-infloop \ fgrep-longest \ file \ filename-lineno.pl \ fmbtest \ foad1 \ grep-dev-null \ grep-dev-null-out \ grep-dir \ hash-collision-perf \ help-version \ high-bit-range \ in-eq-out-infloop \ include-exclude \ inconsistent-range \ initial-tab \ invalid-multibyte-infloop \ khadafy \ kwset-abuse \ long-line-vs-2GiB-read \ long-pattern-perf \ many-regex-performance \ match-lines \ max-count-overread \ max-count-vs-context \ mb-dot-newline \ mb-non-UTF8-overrun \ mb-non-UTF8-perf-Fw \ mb-non-UTF8-performance \ mb-non-UTF8-word-boundary \ multibyte-white-space \ multiple-begin-or-end-line \ null-byte \ options \ pcre \ pcre-abort \ pcre-context \ pcre-count \ pcre-infloop \ pcre-invalid-utf8-infloop \ pcre-invalid-utf8-input \ pcre-jitstack \ pcre-o \ pcre-utf8 \ pcre-w \ pcre-wx-backref \ pcre-z \ posix-bracket \ prefix-of-multibyte \ proc \ r-dot \ repetition-overflow \ reversed-range-endpoints \ sjis-mb \ skip-device \ skip-read \ spencer1 \ spencer1-locale \ stack-overflow \ status \ surrogate-pair \ symlink \ triple-backref \ turkish-I \ turkish-I-without-dot \ turkish-eyes \ two-chars \ two-files \ unibyte-binary \ unibyte-bracket-expr \ unibyte-negated-circumflex \ utf8-bracket \ warn-char-classes \ word-delim-multibyte \ word-multi-file \ word-multibyte \ write-error-msg \ yesno \ z-anchor-newline EXTRA_DIST = \ $(TESTS) \ bre.awk \ bre.tests \ Coreutils.pm \ CuSkip.pm \ CuTmpdir.pm \ envvar-check \ ere.awk \ ere.tests \ init.cfg \ init.sh \ khadafy.lines \ khadafy.regexp \ no-perl \ spencer1.awk \ spencer1.tests \ spencer1-locale.awk # Default to a nonzero value. Environment overrides. # https://udrepper.livejournal.com/11429.html MALLOC_PERTURB_ = 1 TESTS_ENVIRONMENT = \ tmp__=$${TMPDIR-/tmp}; \ test -d "$$tmp__" && test -w "$$tmp__" || tmp__=.; \ . $(srcdir)/envvar-check; \ TMPDIR=$$tmp__; export TMPDIR; \ \ if test -n "$$BASH_VERSION" || (eval "export v=x") 2>/dev/null; then \ export_with_values () { export "$$@"; }; \ else \ export_with_values () \ { \ sed_extract_var='s/=.*//'; \ sed_quote_value="s/'/'\\\\''/g;s/=\\(.*\\)/='\\1'/";\ for arg in "$$@"; do \ var=`echo "$$arg" | sed "$$sed_extract_var"`; \ arg=`echo "$$arg" | sed "$$sed_quote_value"`; \ eval "$$arg"; \ export "$$var"; \ done; \ }; \ fi; \ \ : 'Test egrep/fgrep help if they use our grep.'; \ grep=`echo grep | sed -e '$(transform)'` || exit; \ if test "$$grep" = grep; then \ built_programs='grep egrep fgrep'; \ else \ built_programs='grep'; \ fi; \ \ export_with_values \ VERSION='$(VERSION)' \ LOCALE_FR='$(LOCALE_FR)' \ LOCALE_FR_UTF8='$(LOCALE_FR_UTF8)' \ AWK=$(AWK) \ LC_ALL=C \ abs_top_builddir='$(abs_top_builddir)' \ abs_top_srcdir='$(abs_top_srcdir)' \ abs_srcdir='$(abs_srcdir)' \ built_programs="$$built_programs" \ host_triplet='$(host_triplet)' \ srcdir='$(srcdir)' \ top_srcdir='$(top_srcdir)' \ CC='$(CC)' \ GREP_TEST_NAME=`echo $$tst|sed 's,^\./,,;s,/,-,g'` \ MAKE=$(MAKE) \ MALLOC_PERTURB_=$(MALLOC_PERTURB_) \ PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)' \ PACKAGE_VERSION=$(PACKAGE_VERSION) \ PERL='$(PERL)' \ SHELL='$(SHELL)' \ PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \ ; \ \ : 'set this envvar to indicate whether -P works'; \ m=0; if err=`echo .|grep -Pq . 2>&1`; then \ test -z "$$err" && m=1; fi; \ export PCRE_WORKS=$$m; \ 9>&2 LOG_COMPILER = $(SHELL) VERBOSE = yes all: all-am .SUFFIXES: .SUFFIXES: .c .log .o .obj .pl .pl$(EXEEXT) .sh .sh$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) get-mb-cur-max$(EXEEXT): $(get_mb_cur_max_OBJECTS) $(get_mb_cur_max_DEPENDENCIES) $(EXTRA_get_mb_cur_max_DEPENDENCIES) @rm -f get-mb-cur-max$(EXEEXT) $(AM_V_CCLD)$(LINK) $(get_mb_cur_max_OBJECTS) $(get_mb_cur_max_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-mb-cur-max.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? backref.log: backref @p='backref'; \ b='backref'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) backref-alt.log: backref-alt @p='backref-alt'; \ b='backref-alt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) backref-multibyte-slow.log: backref-multibyte-slow @p='backref-multibyte-slow'; \ b='backref-multibyte-slow'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) backref-word.log: backref-word @p='backref-word'; \ b='backref-word'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) backslash-dot.log: backslash-dot @p='backslash-dot'; \ b='backslash-dot'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) backslash-s-and-repetition-operators.log: backslash-s-and-repetition-operators @p='backslash-s-and-repetition-operators'; \ b='backslash-s-and-repetition-operators'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) backslash-s-vs-invalid-multibyte.log: backslash-s-vs-invalid-multibyte @p='backslash-s-vs-invalid-multibyte'; \ b='backslash-s-vs-invalid-multibyte'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) big-hole.log: big-hole @p='big-hole'; \ b='big-hole'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) big-match.log: big-match @p='big-match'; \ b='big-match'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) binary-file-matches.log: binary-file-matches @p='binary-file-matches'; \ b='binary-file-matches'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) bogus-wctob.log: bogus-wctob @p='bogus-wctob'; \ b='bogus-wctob'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) bre.log: bre @p='bre'; \ b='bre'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) c-locale.log: c-locale @p='c-locale'; \ b='c-locale'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) case-fold-backref.log: case-fold-backref @p='case-fold-backref'; \ b='case-fold-backref'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) case-fold-backslash-w.log: case-fold-backslash-w @p='case-fold-backslash-w'; \ b='case-fold-backslash-w'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) case-fold-char-class.log: case-fold-char-class @p='case-fold-char-class'; \ b='case-fold-char-class'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) case-fold-char-range.log: case-fold-char-range @p='case-fold-char-range'; \ b='case-fold-char-range'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) case-fold-char-type.log: case-fold-char-type @p='case-fold-char-type'; \ b='case-fold-char-type'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) case-fold-titlecase.log: case-fold-titlecase @p='case-fold-titlecase'; \ b='case-fold-titlecase'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) char-class-multibyte.log: char-class-multibyte @p='char-class-multibyte'; \ b='char-class-multibyte'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) char-class-multibyte2.log: char-class-multibyte2 @p='char-class-multibyte2'; \ b='char-class-multibyte2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) context-0.log: context-0 @p='context-0'; \ b='context-0'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) count-newline.log: count-newline @p='count-newline'; \ b='count-newline'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) dfa-coverage.log: dfa-coverage @p='dfa-coverage'; \ b='dfa-coverage'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) dfa-heap-overrun.log: dfa-heap-overrun @p='dfa-heap-overrun'; \ b='dfa-heap-overrun'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) dfa-infloop.log: dfa-infloop @p='dfa-infloop'; \ b='dfa-infloop'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) dfa-invalid-utf8.log: dfa-invalid-utf8 @p='dfa-invalid-utf8'; \ b='dfa-invalid-utf8'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) dfaexec-multibyte.log: dfaexec-multibyte @p='dfaexec-multibyte'; \ b='dfaexec-multibyte'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) empty.log: empty @p='empty'; \ b='empty'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) empty-line.log: empty-line @p='empty-line'; \ b='empty-line'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) empty-line-mb.log: empty-line-mb @p='empty-line-mb'; \ b='empty-line-mb'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) encoding-error.log: encoding-error @p='encoding-error'; \ b='encoding-error'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) epipe.log: epipe @p='epipe'; \ b='epipe'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) equiv-classes.log: equiv-classes @p='equiv-classes'; \ b='equiv-classes'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) ere.log: ere @p='ere'; \ b='ere'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) euc-mb.log: euc-mb @p='euc-mb'; \ b='euc-mb'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) false-match-mb-non-utf8.log: false-match-mb-non-utf8 @p='false-match-mb-non-utf8'; \ b='false-match-mb-non-utf8'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) fedora.log: fedora @p='fedora'; \ b='fedora'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) fgrep-infloop.log: fgrep-infloop @p='fgrep-infloop'; \ b='fgrep-infloop'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) fgrep-longest.log: fgrep-longest @p='fgrep-longest'; \ b='fgrep-longest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) file.log: file @p='file'; \ b='file'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) fmbtest.log: fmbtest @p='fmbtest'; \ b='fmbtest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) foad1.log: foad1 @p='foad1'; \ b='foad1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) grep-dev-null.log: grep-dev-null @p='grep-dev-null'; \ b='grep-dev-null'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) grep-dev-null-out.log: grep-dev-null-out @p='grep-dev-null-out'; \ b='grep-dev-null-out'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) grep-dir.log: grep-dir @p='grep-dir'; \ b='grep-dir'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) hash-collision-perf.log: hash-collision-perf @p='hash-collision-perf'; \ b='hash-collision-perf'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) help-version.log: help-version @p='help-version'; \ b='help-version'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) high-bit-range.log: high-bit-range @p='high-bit-range'; \ b='high-bit-range'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) in-eq-out-infloop.log: in-eq-out-infloop @p='in-eq-out-infloop'; \ b='in-eq-out-infloop'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) include-exclude.log: include-exclude @p='include-exclude'; \ b='include-exclude'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) inconsistent-range.log: inconsistent-range @p='inconsistent-range'; \ b='inconsistent-range'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) initial-tab.log: initial-tab @p='initial-tab'; \ b='initial-tab'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) invalid-multibyte-infloop.log: invalid-multibyte-infloop @p='invalid-multibyte-infloop'; \ b='invalid-multibyte-infloop'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) khadafy.log: khadafy @p='khadafy'; \ b='khadafy'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) kwset-abuse.log: kwset-abuse @p='kwset-abuse'; \ b='kwset-abuse'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) long-line-vs-2GiB-read.log: long-line-vs-2GiB-read @p='long-line-vs-2GiB-read'; \ b='long-line-vs-2GiB-read'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) long-pattern-perf.log: long-pattern-perf @p='long-pattern-perf'; \ b='long-pattern-perf'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) many-regex-performance.log: many-regex-performance @p='many-regex-performance'; \ b='many-regex-performance'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) match-lines.log: match-lines @p='match-lines'; \ b='match-lines'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) max-count-overread.log: max-count-overread @p='max-count-overread'; \ b='max-count-overread'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) max-count-vs-context.log: max-count-vs-context @p='max-count-vs-context'; \ b='max-count-vs-context'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) mb-dot-newline.log: mb-dot-newline @p='mb-dot-newline'; \ b='mb-dot-newline'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) mb-non-UTF8-overrun.log: mb-non-UTF8-overrun @p='mb-non-UTF8-overrun'; \ b='mb-non-UTF8-overrun'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) mb-non-UTF8-perf-Fw.log: mb-non-UTF8-perf-Fw @p='mb-non-UTF8-perf-Fw'; \ b='mb-non-UTF8-perf-Fw'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) mb-non-UTF8-performance.log: mb-non-UTF8-performance @p='mb-non-UTF8-performance'; \ b='mb-non-UTF8-performance'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) mb-non-UTF8-word-boundary.log: mb-non-UTF8-word-boundary @p='mb-non-UTF8-word-boundary'; \ b='mb-non-UTF8-word-boundary'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) multibyte-white-space.log: multibyte-white-space @p='multibyte-white-space'; \ b='multibyte-white-space'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) multiple-begin-or-end-line.log: multiple-begin-or-end-line @p='multiple-begin-or-end-line'; \ b='multiple-begin-or-end-line'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) null-byte.log: null-byte @p='null-byte'; \ b='null-byte'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) options.log: options @p='options'; \ b='options'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre.log: pcre @p='pcre'; \ b='pcre'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-abort.log: pcre-abort @p='pcre-abort'; \ b='pcre-abort'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-context.log: pcre-context @p='pcre-context'; \ b='pcre-context'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-count.log: pcre-count @p='pcre-count'; \ b='pcre-count'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-infloop.log: pcre-infloop @p='pcre-infloop'; \ b='pcre-infloop'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-invalid-utf8-infloop.log: pcre-invalid-utf8-infloop @p='pcre-invalid-utf8-infloop'; \ b='pcre-invalid-utf8-infloop'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-invalid-utf8-input.log: pcre-invalid-utf8-input @p='pcre-invalid-utf8-input'; \ b='pcre-invalid-utf8-input'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-jitstack.log: pcre-jitstack @p='pcre-jitstack'; \ b='pcre-jitstack'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-o.log: pcre-o @p='pcre-o'; \ b='pcre-o'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-utf8.log: pcre-utf8 @p='pcre-utf8'; \ b='pcre-utf8'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-w.log: pcre-w @p='pcre-w'; \ b='pcre-w'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-wx-backref.log: pcre-wx-backref @p='pcre-wx-backref'; \ b='pcre-wx-backref'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pcre-z.log: pcre-z @p='pcre-z'; \ b='pcre-z'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) posix-bracket.log: posix-bracket @p='posix-bracket'; \ b='posix-bracket'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) prefix-of-multibyte.log: prefix-of-multibyte @p='prefix-of-multibyte'; \ b='prefix-of-multibyte'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) proc.log: proc @p='proc'; \ b='proc'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) r-dot.log: r-dot @p='r-dot'; \ b='r-dot'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) repetition-overflow.log: repetition-overflow @p='repetition-overflow'; \ b='repetition-overflow'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) reversed-range-endpoints.log: reversed-range-endpoints @p='reversed-range-endpoints'; \ b='reversed-range-endpoints'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) sjis-mb.log: sjis-mb @p='sjis-mb'; \ b='sjis-mb'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) skip-device.log: skip-device @p='skip-device'; \ b='skip-device'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) skip-read.log: skip-read @p='skip-read'; \ b='skip-read'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) spencer1.log: spencer1 @p='spencer1'; \ b='spencer1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) spencer1-locale.log: spencer1-locale @p='spencer1-locale'; \ b='spencer1-locale'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) stack-overflow.log: stack-overflow @p='stack-overflow'; \ b='stack-overflow'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) status.log: status @p='status'; \ b='status'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) surrogate-pair.log: surrogate-pair @p='surrogate-pair'; \ b='surrogate-pair'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) symlink.log: symlink @p='symlink'; \ b='symlink'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) triple-backref.log: triple-backref @p='triple-backref'; \ b='triple-backref'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) turkish-I.log: turkish-I @p='turkish-I'; \ b='turkish-I'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) turkish-I-without-dot.log: turkish-I-without-dot @p='turkish-I-without-dot'; \ b='turkish-I-without-dot'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) turkish-eyes.log: turkish-eyes @p='turkish-eyes'; \ b='turkish-eyes'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) two-chars.log: two-chars @p='two-chars'; \ b='two-chars'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) two-files.log: two-files @p='two-files'; \ b='two-files'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) unibyte-binary.log: unibyte-binary @p='unibyte-binary'; \ b='unibyte-binary'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) unibyte-bracket-expr.log: unibyte-bracket-expr @p='unibyte-bracket-expr'; \ b='unibyte-bracket-expr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) unibyte-negated-circumflex.log: unibyte-negated-circumflex @p='unibyte-negated-circumflex'; \ b='unibyte-negated-circumflex'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) utf8-bracket.log: utf8-bracket @p='utf8-bracket'; \ b='utf8-bracket'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) warn-char-classes.log: warn-char-classes @p='warn-char-classes'; \ b='warn-char-classes'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) word-delim-multibyte.log: word-delim-multibyte @p='word-delim-multibyte'; \ b='word-delim-multibyte'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) word-multi-file.log: word-multi-file @p='word-multi-file'; \ b='word-multi-file'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) word-multibyte.log: word-multibyte @p='word-multibyte'; \ b='word-multibyte'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) write-error-msg.log: write-error-msg @p='write-error-msg'; \ b='write-error-msg'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) yesno.log: yesno @p='yesno'; \ b='yesno'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) z-anchor-newline.log: z-anchor-newline @p='z-anchor-newline'; \ b='z-anchor-newline'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .sh.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.sh$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) .pl.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(PL_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_PL_LOG_DRIVER_FLAGS) $(PL_LOG_DRIVER_FLAGS) -- $(PL_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.pl$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(PL_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_PL_LOG_DRIVER_FLAGS) $(PL_LOG_DRIVER_FLAGS) -- $(PL_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/get-mb-cur-max.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/get-mb-cur-max.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile check: check_executable_TESTS .PHONY: check_executable_TESTS check_executable_TESTS: Makefile $(AM_V_GEN)fail=0; \ cd $(srcdir) && for i in $(TESTS); do \ test -x $$i || { fail=1; echo $$i >&2; }; \ done; \ test $$fail = 1 \ && { echo the above test scripts are not executable >&2; exit 1; } \ || : # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ���������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/null-byte����������������������������������������������������������������0000775�0001750�0001750�00000004166�14670377471�017464� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test NUL bytes in patterns and data. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src # Add "." to PATH for the use of get-mb-cur-max. path_prepend_ . locales=C for locale in en_US.iso885915 en_US.UTF-8; do get-mb-cur-max en_US.UTF-8 >/dev/null 2>&1 && locales="$locales $locale" done fail=0 for left in '' a '#' '\0'; do for right in '' b '#' '\0'; do data="$left\\0$right" printf "$data\\n" >in || framework_failure_ for hat in '' '^'; do for dollar in '' '$'; do for force_regex in '' '\\(\\)\\1'; do pat="$hat$force_regex$data$dollar" printf "$pat\\n" >pat || framework_failure_ for locale in $locales; do LC_ALL=$locale grep -f pat in status=$? test $status -eq 0 || test $status -eq 1 || fail_ "'$pat' caused an error" LC_ALL=$locale grep -a -f pat in | cmp -s - in || fail_ "-a '$pat' does not match '$data'" done done done done done done (echo xxx && yes yyy | sed 100000q && printf 'z\n\0') >in || framework_failure_ echo xxx >exp || framework_failure_ grep xxx in >out || fail=1 compare exp out || fail=1 printf 'xxx\n' > exp || framework_failure_ grep -E 'xxx|z' in >out || fail=1 compare exp out || fail=1 printf '%s\0' 'abcadc' >in || framework_failure_ printf '%s\0' 'abc' 'adc' >exp || framework_failure_ grep -oz 'a[^c]*c' in >out || fail=1 compare exp out || fail=1 Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/backref-word�������������������������������������������������������������0000775�0001750�0001750�00000000660�14670377471�020112� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would fail for grep-2.6 . "${srcdir=.}/init.sh"; path_prepend_ ../src printf 'foo foo bar\n' > exp1 || framework_failure_ fail=0 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do out=out1-$LOC LC_ALL=$LOC grep -w '\(foo\) \1' exp1 > $out || fail=1 compare exp1 $out || fail=1 LC_ALL=$LOC grep -wx '\(foo\) \1' exp1 > $out test $? -eq 1 || fail=1 compare /dev/null $out || fail=1 done Exit $fail ��������������������������������������������������������������������������������kbuild-3608/src/grep/tests/mb-non-UTF8-word-boundary������������������������������������������������0000775�0001750�0001750�00000001742�14670377471�022252� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # grep -Fw could false-match when using a non-UTF8 multibyte locale. # Copyright 2019-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_JP_EUC_locale_ fail=0 echo ab > in || framework_failure_ # This would mistakenly print its input line from grep-2.28..3.3 returns_ 1 grep -Fw b in || fail=1 Exit $fail ������������������������������kbuild-3608/src/grep/tests/kwset-abuse��������������������������������������������������������������0000775�0001750�0001750�00000002337�14670377472�020002� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Evoke a segfault in a hard-to-reach code path of kwset.c. # This bug affected grep versions 2.19 through 2.21. # # Copyright (C) 2015-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # This test case chooses a haystack of size 260,000, since prodding # with gdb showed a reallocation slightly larger than that in fillbuf. # To reach the buggy code, the needle must have length < 1/11 that of # the haystack, and 10,000 is a nice round number that fits the bill. printf '%0260000dXy\n' 0 | returns_ 1 grep -F $(printf %010000dy 0) \ || fail=1 Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/false-match-mb-non-utf8��������������������������������������������������0000775�0001750�0001750�00000002432�14670377471�021777� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test for false matches in grep 2.19..2.26 in multibyte, non-UTF8 locales # # Copyright (C) 2016-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src # Add "." to PATH for the use of get-mb-cur-max. path_prepend_ . fail=0 loc=zh_CN.gb18030 test "$(get-mb-cur-max $loc)" = 4 || skip_ "no support for the $loc locale" # This must not match: the input is a single character, \uC9 followed # by a newline. But it just so happens that that character is made up # of four bytes, the last of which is the digit, 7, and grep's DFA # matcher would mistakenly report that ".*7" matches that input line. printf '\2010\2077\n' > in || framework_failure_ returns_ 1 env LC_ALL=$loc grep -E '.*7' in || fail=1 returns_ 1 env LC_ALL=$loc grep -E '.{0,1}7' in || fail=1 returns_ 1 env LC_ALL=$loc grep -E '.?7' in || fail=1 # Similar for the \ue9 code point, which ends in an "m" byte. loc=zh_HK.big5hkscs test "$(get-mb-cur-max $loc)" = 2 || skip_ "no support for the $loc locale" printf '\210m\n' > in || framework_failure_ returns_ 1 env LC_ALL=$loc grep '.*m' in || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/file���������������������������������������������������������������������0000775�0001750�0001750�00000002632�14670377471�016464� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test for POSIX options for grep: # grep -E -f pattern_file file # grep -F -f pattern_file file # grep -G -f pattern_file file # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 cat <<EOF >patfile radar MILES GNU EOF # match echo "miles" | grep -i -E -f patfile > /dev/null 2>&1 if test $? -ne 0 ; then echo "File_pattern: Wrong status code, test \#1 failed" fail=1 fi # match echo "GNU" | grep -G -f patfile > /dev/null 2>&1 if test $? -ne 0 ; then echo "File_pattern: Wrong status code, test \#2 failed" fail=1 fi # checking for no match echo "ridar" | grep -F -f patfile > /dev/null 2>&1 if test $? -ne 1 ; then echo "File_pattern: Wrong status code, test \#3 failed" fail=1 fi cat <<EOF >patfile EOF # empty pattern : every match echo "abbcd" | grep -F -f patfile > /dev/null 2>&1 if test $? -ne 0 ; then echo "File_pattern: Wrong status code, test \#4 failed" fail=1 fi cp /dev/null patfile # null pattern : no match echo "abbcd" | grep -F -f patfile > /dev/null 2>&1 if test $? -ne 1 ; then echo "File_pattern: Wrong status code, test \#5 failed" fail=1 fi Exit $fail ������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/big-match����������������������������������������������������������������0000775�0001750�0001750�00000002032�14670377471�017372� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Check that grep doesn't mishandle long matching lines. . "${srcdir=.}/init.sh"; path_prepend_ ../src expensive_ # Create a one-line file containing slightly more than 2 GiB. echo x | dd bs=1024k seek=2048 >2G-plus-2 || framework_failure_ skip_diagnostic= # These two patterns catch different kinds of # failures due to internal integer overflows. # However, the second one, '^.*x\(\)\1', provokes # so much memory consumption via regexec.c that it renders # some systems unusable. for pattern in '^.*'; do diagnostic=$(LC_ALL=C grep -a "$pattern" 2G-plus-2 2>&1 >/dev/null) status=$? case $status,$diagnostic in 0,*) ;; 2,*': line too long for re_search') skip_diagnostic='regular expression library cannot handle the test' ;; 137,''|2,*': memory exhausted') # The 137/no-diagnostic arises when the kernel OOM-kills grep. skip_diagnostic='not enough main memory to run the test' ;; *) fail=1 ;; esac done case $fail,$skip_diagnostic in 0,?*) skip_ "$skip_diagnostic" ;; esac Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/two-files����������������������������������������������������������������0000775�0001750�0001750�00000001111�14670377472�017446� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Read two files, of increasing size. # With ASAN, this would have triggered a false-positive read of poisoned memory. # # Copyright 2015-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 printf a > 1 || framework_failure_ printf ab > 2 || framework_failure_ grep x 1 2 > out 2>&1 test $? -eq 1 || fail=1 compare /dev/null out || fail=1 Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/max-count-overread�������������������������������������������������������0000775�0001750�0001750�00000000462�14670377471�021264� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Ensure that -m1 stops reading after the first match. # In grep-2.19, yes x|grep -m1 x would infloop. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_timeout_ fail=0 echo x > exp || framework_failure_ yes x | timeout 10 grep -m1 x > out || fail=1 compare exp out || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-context�������������������������������������������������������������0000775�0001750�0001750�00000001070�14670377471�020153� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test Perl regex with context . "${srcdir=.}/init.sh"; path_prepend_ ../src require_pcre_ cat >in <<'EOF' Preceded by 0 empty lines. Preceded by 1 empty line. Preceded by 2 empty lines. Preceded by 3 empty lines. Preceded by 4 empty lines. EOF test $? -eq 0 || framework_failure_ printf '%s\0' \ 'Preceded by 2 empty lines.' \ 'Preceded by 3 empty lines.' \ 'Preceded by 4 empty lines.' >exp || framework_failure_ fail=0 grep -Pzo '(?<=\n\n\n).*' in >out || fail_ 'grep -Pzo failed' compare exp out || fail=1 Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-invalid-utf8-infloop������������������������������������������������0000775�0001750�0001750�00000001303�14670377471�022444� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Ensure that grep -oaP doesn't infloop for invalid multi-byte input # # Copyright (C) 2015-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_timeout_ require_en_utf8_locale_ require_compiled_in_MB_support LC_ALL=en_US.UTF-8 require_pcre_ fail=0 printf '\201_\0' > in || framework_failure_ printf '_\n' > exp || framework_failure_ LC_ALL=en_US.UTF-8 timeout 10 grep -aoP _ in > out 2> err || fail=1 compare exp out || fail=1 compare /dev/null err || fail=1 Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/context-0����������������������������������������������������������������0000775�0001750�0001750�00000000676�14670377471�017374� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # 0 lines of context . "${srcdir=.}/init.sh"; path_prepend_ ../src cat <<EOF > in || framework_failure_ needle 1st line of context 2nd line of context 3rd line of context another needle 5th line of context relative to first match 6th line... EOF cat <<EOF > exp || framework_failure_ needle -- another needle EOF fail=0 grep -C 0 needle in > out 2>err || fail=1 compare exp out || fail=1 compare /dev/null err || fail=1 Exit $fail ������������������������������������������������������������������kbuild-3608/src/grep/tests/warn-char-classes��������������������������������������������������������0000775�0001750�0001750�00000002123�14670377472�021056� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Use of any --include or --exclude* option would segfault in 2.6 and 2.6.1 . "${srcdir=.}/init.sh"; path_prepend_ ../src echo f > x || framework_failure_ echo b >> x || framework_failure_ echo h >> x || framework_failure_ printf 'grep: character class syntax is [[:space:]], not [:space:]\n' \ > exp-err || framework_failure_ # basic cases returns_ 2 grep '[:space:]' x 2> err || fail=1 sed 's/^\([A-Za-z]:\)\{0,1\}[^: ]*: /grep: /' err > err1 && mv err1 err compare exp-err err || fail=1 returns_ 1 grep '[[:space:]]' x 2> err || fail=1 test -s err && fail=1 # disabled by POSIXLY_CORRECT returns_ 1 env POSIXLY_CORRECT=yes grep '[:space:]' x 2> err || fail=1 test -s err && fail=1 # patterns that are considered valid returns_ 1 grep '[::]' x 2> err || fail=1 test -s err && fail=1 returns_ 1 grep '[:space]' x 2> err || fail=1 test -s err && fail=1 returns_ 1 grep '[:space:wxyz]' x 2> err || fail=1 test -s err && fail=1 returns_ 1 grep '[:space[:space:]:]' x 2> err || fail=1 test -s err && fail=1 returns_ 1 grep '[:spac-e:]' x 2> err || fail=1 test -s err && fail=1 Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/envvar-check�������������������������������������������������������������0000664�0001750�0001750�00000002676�14670377472�020127� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- sh -*- # Check environment variables for sane values while testing. # Copyright (C) 2000-2021 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 <https://www.gnu.org/licenses/>. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi envvar_check_fail=0 vars=' _POSIX2_VERSION _STDBUF_E _STDBUF_I _STDBUF_O BASH_ENV BLOCKSIZE BLOCK_SIZE CDPATH COLUMNS DF_BLOCK_SIZE DU_BLOCK_SIZE ENV LANGUAGE LS_BLOCK_SIZE LS_COLORS OMP_NUM_THREADS POSIXLY_CORRECT QUOTING_STYLE SIMPLE_BACKUP_SUFFIX TABSIZE TERM COLORTERM TIME_STYLE TMPDIR VERSION_CONTROL ' for var in $vars do $as_unset $var if eval test \"\${$var+set}\" = set; then echo "$0: the $var environment variable is set --" \ ' unset it and rerun this test' >&2 envvar_check_fail=1 fi done test "$envvar_check_fail" = 1 && exit 1 ������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-jitstack������������������������������������������������������������0000775�0001750�0001750�00000004656�14670377472�020321� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Grep 2.21 would report "grep: internal PCRE error: -27" # # Copyright 2015-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_pcre_ for p in 'base64 -d' 'base64 -D' 'openssl base64 -d' \ "perl -MMIME::Base64 -0777ne 'print decode_base64(\$_)'" FAIL; do test "$p" = FAIL && skip_ "your system lacks a base64 decoder" x=$(echo eA==| ( eval "$p" ) 2>/dev/null) && test "X$x" = Xx && { eval "b64_decode() { $p; }" break } done foo=$( (echo foo | gzip | gzip -d) 2>/dev/null) && test "X$foo" = Xfoo \ || skip_ "your system lacks the gzip program" fail=0 b64_decode >pcrejit.txt.gz <<'EOF' || framework_failure_ H4sIAAAAAAACA+2bUU4DMQxE/7mMz5T7XwKE+IBKVLue58yk0B9EtX6xJxN7t4VaH69a6+tHrW+/ r4e3n75KARWShSOFTtiumE3FPVyo79ATIJ0Ry0No/yXe99UIUqTGKKUzYHFJHJoaCONQDCnDSCDS IPAvGCVeXNsZ7lpbWFfdaZtgPos5LeK2C1TBKzD09V3HFlCOsbFT/hNbz4HzJaRjnjdam9FXw/o6 VyPozhMmiaRYAMeNSJR1iMjBEFLMtsH7lptartfxkzPQgFVofwRlxKsMYn2KNDnU9fsOQCkRIYVT G80ZRqBpSQjRYPX7s9gvtqknyNE2f8V09sxHM7YPmMMJgrmVna2AT717n5fUAIDkiBCqFgWUUgKD 8jOc0Rgj5JS6vZnQI14wkaTDAkD266p/iVHs8gjCrMFARVM0iEVgFAa9YRAQT4tkgsmloTJLmyCm uSHRnTkzIdZMmZ5kYX/iJFtTwu9cFvr3aDWcUx4pUW/cVQwPoQSlwguNd4M0vTpAauKodmLFXv1P dkcKkYUglER2Q4L4gnmOiNGzSBATwGQgwihs5/QffIhyfg4hJvM2r4Rp6L+1ibCCd4jYZ6jCiBlc 2+y4fl4yTGIwcWXNAUEeXmu8iCMV96DNTnmRNICDk2N5qaXGbsF91OX/0hlcYTjrMfy02p9Xv70D mv3RZCFOAAA= EOF gzip -d pcrejit.txt || framework_failure_ LC_ALL=C grep -P -n '^([/](?!/)|[^/])*~/.*' pcrejit.txt if test $? != 1; then # The above often makes grep attempt to use an inordinate amount # of stack space. If grep fails with $? != 1, try again, but this # time with no soft limit: # Use ulimit to remove that limit, if possible. # If ulimit is not usable, just skip this test. (ulimit -s unlimited) || skip_ this shell lacks ulimit support # Rerun that same test, but now with no limit on stack size: (ulimit -s unlimited; returns_ 1 env LC_ALL=C grep -P -n '^([/](?!/)|[^/])*~/.*' pcrejit.txt 2> err) \ || fail=1 # If that failed due to stack overflow, don't cry foul. overflow_pat="stack overflow|exceeded PCRE's recursion limit" test $fail = 1 && { grep -Eq "$overflow_pat" err && fail=0 || cat err; } fi Exit $fail ����������������������������������������������������������������������������������kbuild-3608/src/grep/tests/stack-overflow�����������������������������������������������������������0000775�0001750�0001750�00000003730�14670377472�020514� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Ensure a stack overflow no longer segfaults . "${srcdir=.}/init.sh"; path_prepend_ ../src case $host_triplet in *-midnightbsd*) skip_ 'our stack-overflow detection does not work on this system';; esac # When compiled with ASAN, skip this test, because (on Fedora 32) it # would fail due to output like this on stderr: # +==2176827==WARNING: ASan is ignoring requested __asan_handle_no_return: # stack top: 0x7ffc48f20000; bottom 0x000000e25000; size: 0x7ffc480fb000 (140721517473792) # +False positive error reports may follow # +For details see https://github.com/google/sanitizers/issues/189 ASAN_OPTIONS=help=true grep --version 2>&1 | grep -q AddressSanitizer \ && skip_ 'avoid false failure when built with ASAN' echo grep: stack overflow > exp || framework_failure_ # Limit stack size. Otherwise, it appears to be too hard to overflow the # stack on some systems like gcc113, aarch64/linux-3.13.0 with 32GB of RAM # and 20GB of swap. ulimit -s 8192 2>/dev/null # grep attempts to detect overflow via gnulib's c-stack module. # Trigger that with an input regex composed solely of open parentheses, # increasing the size of that input until grep emits the expected diagnostic. fail=0 for i in 1 3 5 10 20 30 40 50 100 200 400 1000; do # Create a file containing $i * 10000 open parentheses: printf %0${i}0000d 0|tr 0 '(' > in || framework_failure_ grep -E -f in >out 2>err; st=$? if grep -q 'stack overflow' err; then test $st = 2 || fail=1 compare /dev/null out || fail=1 compare exp err || fail=1 test $fail = 0 && Exit 0 fail_ 'printed "stack overflow", but something else was wrong' fi done # If there was no stack overflow message and the final run exited with # status 1 and both stdout and stderr were empty, then assume it's a working # regex that avoids the internal stack overflow problem like glibc's regexp # used to. test $st = 1 \ && ! test -s out \ && ! test -s err \ && Exit 0 fail_ 'grep never printed "stack overflow"' ����������������������������������������kbuild-3608/src/grep/tests/pcre-count���������������������������������������������������������������0000775�0001750�0001750�00000001554�14670377472�017627� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # grep -P / grep -Pc are inconsistent results # This bug affected grep versions 2.21 through 2.22. # # Copyright (C) 2015-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_pcre_ fail=0 printf 'a\n%032768d\nb\0\n%032768d\na\n' 0 0 > in || framework_failure_ # grep will discover that the input is a binary file sooner if the # page size is larger, so allow for either possible output. printf 'a\n' >exp1a || framework_failure_ LC_ALL=C grep -P 'a' in >out || fail=1 compare exp1a out || compare /dev/null out || fail=1 printf '2\n' >exp2 || framework_failure_ LC_ALL=C grep -Pc 'a' in >out || fail=1 compare exp2 out || fail=1 Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/empty-line-mb������������������������������������������������������������0000775�0001750�0001750�00000001407�14670377471�020223� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Exercise bugs in grep-2.13 with -i, -n and an RE of ^$ in a multi-byte locale. # # Copyright (C) 2012-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ LC_ALL=en_US.UTF-8 export LC_ALL printf 'a\n\nb\n' > in || framework_failure_ printf '2:\n' > exp || framework_failure_ printf 'a\nb\n' > in2 || framework_failure_ grep -n -i '^$' in > out || fail=1 compare exp out || fail=1 # Expect no match: with grep-2.13 this would mistakenly exit 0 grep -i '^$' in2 > out && fail=1 compare /dev/null out || fail=1 Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/bre.tests����������������������������������������������������������������0000664�0001750�0001750�00000002157�14670377471�017455� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������0@a\(b\)c@abc 0@a(@a( 2@a\(@EPAREN 2@a\(b@EPAREN 0@a(b@a(b 0@a)@a) 2@a\)@EPAREN 2@\)@EPAREN 0@a\(\)b@ab 0@a^b@a^b 0@a$b@a$b 0@\($\)\(^\)@@TO CORRECT 0@a*\(^b$\)c*@b 0@|@| 0@*@* 0@\(\)@abc 2@\(\{1\}a\)@BADRPT@TO CORRECT 0@^*@* 2@^\{1\}@BADRPT@TO CORRECT 0@{@{ 1@a\(b*\)c\1d@abbcbd 1@a\(b*\)c\1d@abbcbbbd 1@^\(.\)\1@abc 0@a\(\([bc]\)\2\)*d@abbccd 1@a\(\([bc]\)\2\)*d@abbcbd 0@a\(\(b\)*\2\)*d@abbbd 0@\(a\)\1bcd@aabcd 0@\(a\)\1bc*d@aabcd 0@\(a\)\1bc*d@aabd 0@\(a\)\1bc*d@aabcccd 0@\(a\)\1bc*[ce]d@aabcccd@TO CORRECT 0@^\(a\)\1b\(c\)*cd$@aabcccd 0@a\(*\)b@a*b 0@a\(**\)b@ab 2@a\(***\)b@BADRPT@TO CORRECT 0@*a@*a 0@**a@a 2@***a@BADRPT@TO CORRECT 0@a\{1\}b@ab 0@a\{1,\}b@ab 0@a\{1,2\}b@aab 2@a\{1@EBRACE 2@a\{1a@EBRACE 2@a\{1a\}@BADBR 0@a\{,2\}@a\{,2\} 0@a\{,\}@a\{,\} 2@a\{\}@BADBR 2@a\{1,x\}@BADBR 2@a\{1,x@EBRACE 2@a\{32768\}@BADBR 2@a\{1,0\}@BADBR 0@ab\{0,0\}c@abcac 0@ab\{0,1\}c@abcac 0@ab\{0,3\}c@abbcac 0@ab\{1,1\}c@acabc 0@ab\{1,3\}c@acabc 0@ab\{2,2\}c@abcabbc 0@ab\{2,4\}c@abcabbc 2@a\{1\}\{1\}@BADRPT@TO CORRECT 2@a*\{1\}@BADRPT@TO CORRECT 2@a\{1\}*@BADRPT@TO CORRECT 1@a\(b\)?c\1d@acd 0@-\{0,1\}[0-9]*$@-5 2@b\{1000000000\}@ESIZE �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/spencer1-locale����������������������������������������������������������0000775�0001750�0001750�00000001205�14670377472�020516� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Regression test for GNU grep. # # Copyright (C) 1988 Henry Spencer. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # . . . and the following by Henry Spencer. ${AWK-awk} -v extra_locale=$LOCALE_FR_UTF8 \ -f "$abs_srcdir/spencer1-locale.awk" "$abs_srcdir/spencer1.tests" \ > spencer1-locale.script || fail=1 ${re_shell-${SHELL-sh}} spencer1-locale.script || fail=1 Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/hash-collision-perf������������������������������������������������������0000775�0001750�0001750�00000003724�14670377471�021416� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test for this performance regression: # grep-3.5 and 3.6 would take O(N^2) time for some sets of input regexps. # Copyright 2020-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 : > empty || framework_failure_ # Construct a test case that consumes enough CPU time that we don't # have to worry about measurement noise. This first case is searching # for digits, which never exhibited a problem with hash collisions. n_pat=40000 while :; do seq $n_pat > in || framework_failure_ small_ms=$(LC_ALL=C user_time_ 1 grep --file=in empty) || fail=1 test $small_ms -ge 200 && break n_pat=$(expr $n_pat '*' 2) done # Now, search for those same digits mapped to A-J. # With the PJW-based hash function, this became O(N^2). seq $n_pat | tr 0-9 A-J > in || framework_failure_ large_ms=$(LC_ALL=C user_time_ 1 grep --file=in empty) || fail=1 # Deliberately recording in an unused variable so it # shows up in set -x output, in case this test fails. ratio=$(expr "$large_ms" / "$small_ms") warn_ ratio=$ratio # The duration of the latter run must be no more than 10 times # that of the former. Using recent versions prior to this fix, # this test would fail due to ratios > 800. Using the fixed version, # it's common to see a ratio less than 1. returns_ 1 expr $small_ms '<' $large_ms / 10 || fail=1 Exit $fail ��������������������������������������������kbuild-3608/src/grep/tests/pcre���������������������������������������������������������������������0000775�0001750�0001750�00000001135�14670377471�016473� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Simple PCRE tests. # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_pcre_ fail=0 echo | grep -P '\s*$' || fail=1 echo | grep -zP '\s$' || fail=1 echo '.ab' | returns_ 1 grep -Pwx ab || fail=1 echo x | grep -Pz '[^a]' || fail=1 printf 'x\n\0' | returns_ 1 grep -zP 'x$' || fail=1 printf 'a\nb\0' | grep -zxP a && fail=1 Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/unibyte-bracket-expr�����������������������������������������������������0000775�0001750�0001750�00000002522�14670377472�021610� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Exercise a DFA range bug that arises only with a unibyte encoding # for which the wide-char-to-single-byte mapping is nontrivial. # E.g., the regexp, [C] would fail to match C in a unibyte locale like # ru_RU.KOI8-R for any C whose wide-char representation differed from # its single-byte equivalent. # Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_ru_RU_koi8_r LC_ALL=ru_RU.KOI8-R export LC_ALL fail=0 i=128 while :; do in=in-$i octal=$(printf '%03o' $i) b=$(printf "\\$octal") echo "$b" > $in || framework_failure_ grep "[$b]" $in > out || fail=1 compare out $in || fail=1 test $i = 255 && break i=$(expr $i + 1) done Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/fgrep-infloop������������������������������������������������������������0000775�0001750�0001750�00000001074�14670377471�020313� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would infloop for grep-2.6.1 . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_timeout_ require_compiled_in_MB_support encode() { echo "$1" | tr ABC '\357\274\241'; } encode ABC > in || framework_failure_ fail=0 for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do out=out1-$LOC LC_ALL=$LOC timeout 10s grep -F "$(encode BC)" in > $out status=$? if test $status -eq 0; then compare in $out elif test $status -eq 1; then compare_dev_null_ /dev/null $out else test $status -eq 2 fi || fail=1 done Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/char-class-multibyte�����������������������������������������������������0000775�0001750�0001750�00000001331�14670377471�021574� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would segfault for grep-2.6 . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support printf 'é\n' > exp1 || framework_failure_ fail=0 for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do out=out1-$LOC printf 'á\nç\né\n' | LC_ALL=$LOC grep '[é]' > $out || fail=1 compare exp1 $out || fail=1 done printf 'É\n' > exp2 || framework_failure_ for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do out=out2-$LOC printf 'Ã\nÇ\nÉ\n' | LC_ALL=$LOC grep '[É]' > $out || fail=1 compare exp2 $out || fail=1 done for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do out=out3-$LOC printf '\303\n' | returns_ 1 env LC_ALL=$LOC grep '[é]' > $out || fail=1 done Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/equiv-classes������������������������������������������������������������0000775�0001750�0001750�00000000347�14670377471�020332� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test that equivalence classes work. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support LC_ALL=en_US.UTF-8 export LC_ALL echo à | grep '[[=a=]]' > /dev/null Exit $? �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/bogus-wctob��������������������������������������������������������������0000775�0001750�0001750�00000000645�14670377472�020003� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This was latent in grep-2.8 and earlier because we punted interpretation # of MBCSETs to glibc. However, it becomes apparent as soon as "[à]" is # simplified to "à". . "${srcdir=.}/init.sh"; path_prepend_ ../src printf '\340' > in || framework_failure_ fail=0 LC_ALL=en_US.UTF-8 grep '[à]' in case $? in 0) fail=1 ;; 1) ;; 2) framework_failure_ unexpected error from grep ;; esac Exit $fail �������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/euc-mb�������������������������������������������������������������������0000775�0001750�0001750�00000002362�14670377471�016715� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # test that matches starting in the middle of a multibyte char aren't rejected # too greedily. # Derived from https://savannah.gnu.org/bugs/?23814 . "${srcdir=.}/init.sh"; path_prepend_ ../src # Add "." to PATH for the use of get-mb-cur-max. path_prepend_ . require_compiled_in_MB_support locale=ja_JP.EUC-JP make_input () { echo "$1" | tr AB '\244\263' } euc_grep () { pat=$(make_input "$1") LC_ALL=$locale grep "$pat" } case $(get-mb-cur-max $locale) in 2|3) ;; *) skip_ 'EUC-JP locale not found' ;; esac fail=0 # Does EUC-JP work at all? make_input BABA |euc_grep AB && fail=1 # Here are two cases in which a KWSet search matches in the middle # of a multibyte character. The first ensures that the DFA matcher # finds the real match at the end of line. The second ensures that # while the KWSet match found a false positive, the DFA matcher # determines there is no match after all. make_input BABAAB |euc_grep AB > out || fail=1 make_input BABAAB > exp || framework_failure_ compare exp out || fail=1 make_input BABABA |returns_ 1 euc_grep AB || fail=1 make_input BABABA |returns_ 1 euc_grep '^x\|AB' || fail=1 # -P supports only unibyte and UTF-8 locales. returns_ 2 env LC_ALL=$locale grep -P x /dev/null || fail=1 Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/backslash-s-and-repetition-operators�������������������������������������0000775�0001750�0001750�00000001452�14670377471�024673� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Ensure that \s and \S work with repetition operators. # # Copyright (C) 2013-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ fail=0 for loc in en_US.UTF-8 C; do echo locale=$loc LC_ALL=$loc export LC_ALL printf ' \n' > in || framework_failure_ for re in '\s\+' '\s*' '\s\?' '\s\{1\}'; do grep "^$re\$" in > out || fail=1 compare in out || fail=1 done printf 'X\n' > in || framework_failure_ for re in '\S\+' '\S*' '\S\?' '\S\{1\}'; do grep "^$re\$" in > out || fail=1 compare in out || fail=1 done done Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/match-lines��������������������������������������������������������������0000775�0001750�0001750�00000002222�14670377472�017745� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Trigger a bug in the DFA matcher that would make # grep -F -x -o PAT print an extra newline for each match. # This would fail for grep-2.19 and grep-2.20. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src printf 'a\n' > in || framework_failure_ fail=0 for locale in C en_US.UTF-8; do for options in -x '-E -x' '-F -x'; do for o in '' -o; do LC_ALL=$locale grep $o $options a in > out || fail=1 compare out in || fail=1 done done done Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/Coreutils.pm�������������������������������������������������������������0000664�0001750�0001750�00000046061�14670377471�020132� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Coreutils; # This is a testing framework. # Copyright (C) 1998-2015, 2017-2021 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 <https://www.gnu.org/licenses/>. use strict; use vars qw($VERSION @ISA @EXPORT); use FileHandle; use File::Compare qw(compare); @ISA = qw(Exporter); ($VERSION = '$Revision: 1.5 $ ') =~ tr/[0-9].//cd; @EXPORT = qw (run_tests triple_test getlimits); my $debug = $ENV{DEBUG}; my @Types = qw (IN IN_PIPE OUT ERR AUX CMP EXIT PRE POST OUT_SUBST ERR_SUBST ENV ENV_DEL); my %Types = map {$_ => 1} @Types; my %Zero_one_type = map {$_ => 1} qw (OUT ERR EXIT PRE POST OUT_SUBST ERR_SUBST ENV); my $srcdir = "$ENV{srcdir}"; my $Global_count = 1; # When running in a DJGPP environment, make $ENV{SHELL} point to bash. # Otherwise, a bad shell might be used (e.g. command.com) and many # tests would fail. defined $ENV{DJDIR} and $ENV{SHELL} = "$ENV{DJDIR}/bin/bash.exe"; # A file spec: a scalar or a reference to a single-keyed hash # ================ # 'contents' contents only (file name is derived from test name) # {filename => 'contents'} filename and contents # {filename => undef} filename only -- $(srcdir)/tests/filename must exist # # FIXME: If there is more than one input file, then you can't specify 'REDIR'. # PIPE is still ok. # # I/O spec: a hash ref with the following properties # ================ # - one key/value pair # - the key must be one of these strings: IN, OUT, ERR, AUX, CMP, EXIT # - the value must be a file spec # {OUT => 'data'} put data in a temp file and compare it to stdout from cmd # {OUT => {'filename'=>undef}} compare contents of existing filename to # stdout from cmd # {OUT => {'filename'=>[$CTOR, $DTOR]}} $CTOR and $DTOR are references to # functions, each which is passed the single argument 'filename'. # $CTOR must create 'filename'. # DTOR may be omitted in which case 'sub{unlink @_[0]}' is used. # FIXME: implement this # {ERR => ...} # Same as for OUT, but compare with stderr, not stdout. # {OUT_SUBST => 's/variable_output/expected_output/'} # Transform actual standard output before comparing it against expected. # This is useful e.g. for programs like du that produce output that # varies a lot from system. E.g., an empty file may consume zero file # blocks, or more, depending on the OS and on the file system type. # {ERR_SUBST => 's/variable_output/expected_output/'} # Transform actual stderr output before comparing it against expected. # This is useful when verifying that we get a meaningful diagnostic. # For example, in rm/fail-2eperm, we have to account for three different # diagnostics: Operation not permitted, Not owner, and Permission denied. # {EXIT => N} expect exit status of cmd to be N # {ENV => 'VAR=val ...'} # Prepend 'VAR=val ...' to the command that we execute via 'system'. # {ENV_DEL => 'VAR'} # Remove VAR from the environment just before running the corresponding # command, and restore any value just afterwards. # # There may be many input file specs. File names from the input specs # are concatenated in order on the command line. # There may be at most one of the OUT-, ERR-, and EXIT-keyed specs. # If the OUT-(or ERR)-keyed hash ref is omitted, then expect no output # on stdout (or stderr). # If the EXIT-keyed one is omitted, then expect the exit status to be zero. # FIXME: Make sure that no junkfile is also listed as a # non-junkfile (i.e., with undef for contents) sub _shell_quote ($) { my ($string) = @_; $string =~ s/\'/\'\\\'\'/g; return "'$string'"; } sub _create_file ($$$$) { my ($program_name, $test_name, $file_name, $data) = @_; my $file; if (defined $file_name) { $file = $file_name; } else { $file = "$test_name.$Global_count"; ++$Global_count; } warn "creating file '$file' with contents '$data'\n" if $debug; # The test spec gave a string. # Write it to a temp file and return tempfile name. my $fh = new FileHandle "> $file"; die "$program_name: $file: $!\n" if ! $fh; print $fh $data; $fh->close || die "$program_name: $file: $!\n"; return $file; } sub _compare_files ($$$$$) { my ($program_name, $test_name, $in_or_out, $actual, $expected) = @_; my $differ = compare ($actual, $expected); if ($differ) { my $info = (defined $in_or_out ? "std$in_or_out " : ''); warn "$program_name: test $test_name: ${info}mismatch, comparing " . "$expected (expected) and $actual (actual)\n"; # Ignore any failure, discard stderr. system "diff -c $expected $actual 2>/dev/null"; } return $differ; } sub _process_file_spec ($$$$$) { my ($program_name, $test_name, $file_spec, $type, $junk_files) = @_; my ($file_name, $contents); if (!ref $file_spec) { ($file_name, $contents) = (undef, $file_spec); } elsif (ref $file_spec eq 'HASH') { my $n = keys %$file_spec; die "$program_name: $test_name: $type spec has $n elements --" . " expected 1\n" if $n != 1; ($file_name, $contents) = each %$file_spec; # This happens for the AUX hash in an io_spec like this: # {CMP=> ['zy123utsrqponmlkji', {'@AUX@'=> undef}]}, defined $contents or return $file_name; } else { die "$program_name: $test_name: invalid RHS in $type-spec\n" } my $is_junk_file = (! defined $file_name || (($type eq 'IN' || $type eq 'AUX' || $type eq 'CMP') && defined $contents)); my $file = _create_file ($program_name, $test_name, $file_name, $contents); if ($is_junk_file) { push @$junk_files, $file } else { # FIXME: put $srcdir in here somewhere warn "$program_name: $test_name: specified file '$file' does" . " not exist\n" if ! -f "$srcdir/tests/$file"; } return $file; } sub _at_replace ($$) { my ($map, $s) = @_; foreach my $eo (qw (AUX OUT ERR)) { my $f = $map->{$eo}; $f and $s =~ /\@$eo\@/ and $s =~ s/\@$eo\@/$f/g; } return $s; } sub getlimits() { my $NV; open $NV, "getlimits |" or die "Error running getlimits\n"; my %limits = map {split /=|\n/} <$NV>; return \%limits; } # FIXME: cleanup on interrupt # FIXME: extract 'do_1_test' function # FIXME: having to include $program_name here is an expedient kludge. # Library code doesn't 'die'. sub run_tests ($$$$$) { my ($program_name, $prog, $t_spec, $save_temps, $verbose) = @_; # To indicate that $prog is a shell built-in, you'd make it a string 'ref'. # E.g., call run_tests ($prog, \$prog, \@Tests, $save_temps, $verbose); # If it's a ref, invoke it via "env": my @prog = ref $prog ? (qw(env --), $$prog) : $prog; # Warn about empty t_spec. # FIXME # Remove all temp files upon interrupt. # FIXME # Verify that test names are distinct. my $bad_test_name = 0; my %seen; my %seen_8dot3; my $t; foreach $t (@$t_spec) { my $test_name = $t->[0]; if ($seen{$test_name}) { warn "$program_name: $test_name: duplicate test name\n"; $bad_test_name = 1; } $seen{$test_name} = 1; if (0) { my $t8 = lc substr $test_name, 0, 8; if ($seen_8dot3{$t8}) { warn "$program_name: 8.3 test name conflict: " . "$test_name, $seen_8dot3{$t8}\n"; $bad_test_name = 1; } $seen_8dot3{$t8} = $test_name; } # The test name may be no longer than 30 bytes. # Yes, this is an arbitrary limit. If it causes trouble, # consider removing it. my $max = 30; if ($max < length $test_name) { warn "$program_name: $test_name: test name is too long (> $max)\n"; $bad_test_name = 1; } } return 1 if $bad_test_name; # FIXME check exit status system (@prog, '--version') if $verbose; my @junk_files; my $fail = 0; foreach my $tt (@$t_spec) { my @post_compare; my @dummy = @$tt; my $t = \@dummy; my $test_name = shift @$t; my $expect = {}; my ($pre, $post); # FIXME: maybe don't reset this. $Global_count = 1; my @args; my $io_spec; my %seen_type; my @env_delete; my $env_prefix = ''; my $input_pipe_cmd; foreach $io_spec (@$t) { if (!ref $io_spec) { push @args, $io_spec; next; } if (ref $io_spec ne 'HASH') { eval 'use Data::Dumper'; die "$program_name: $test_name: invalid entry in test spec; " . "expected HASH-ref,\nbut got this:\n" . Data::Dumper->Dump ([\$io_spec], ['$io_spec']) . "\n"; } my $n = keys %$io_spec; die "$program_name: $test_name: spec has $n elements --" . " expected 1\n" if $n != 1; my ($type, $val) = each %$io_spec; die "$program_name: $test_name: invalid key '$type' in test spec\n" if ! $Types{$type}; # Make sure there's no more than one of OUT, ERR, EXIT, etc. die "$program_name: $test_name: more than one $type spec\n" if $Zero_one_type{$type} and $seen_type{$type}++; if ($type eq 'PRE' or $type eq 'POST') { $expect->{$type} = $val; next; } if ($type eq 'CMP') { my $t = ref $val; $t && $t eq 'ARRAY' or die "$program_name: $test_name: invalid CMP spec\n"; @$val == 2 or die "$program_name: $test_name: invalid CMP list; must have" . " exactly 2 elements\n"; my @cmp_files; foreach my $e (@$val) { my $r = ref $e; $r && $r ne 'HASH' and die "$program_name: $test_name: invalid element ($r)" . " in CMP list; only scalars and hash references " . "are allowed\n"; if ($r && $r eq 'HASH') { my $n = keys %$e; $n == 1 or die "$program_name: $test_name: CMP spec has $n " . "elements -- expected 1\n"; # Replace any '@AUX@' in the key of %$e. my ($ff, $val) = each %$e; my $new_ff = _at_replace $expect, $ff; if ($new_ff ne $ff) { $e->{$new_ff} = $val; delete $e->{$ff}; } } my $cmp_file = _process_file_spec ($program_name, $test_name, $e, $type, \@junk_files); push @cmp_files, $cmp_file; } push @post_compare, [@cmp_files]; $expect->{$type} = $val; next; } if ($type eq 'EXIT') { die "$program_name: $test_name: invalid EXIT code\n" if $val !~ /^\d+$/; # FIXME: make sure $data is numeric $expect->{EXIT} = $val; next; } if ($type =~ /^(OUT|ERR)_SUBST$/) { $expect->{RESULT_SUBST} ||= {}; $expect->{RESULT_SUBST}->{$1} = $val; next; } if ($type eq 'ENV') { $env_prefix = "$val "; next; } if ($type eq 'ENV_DEL') { push @env_delete, $val; next; } my $file = _process_file_spec ($program_name, $test_name, $val, $type, \@junk_files); if ($type eq 'IN' || $type eq 'IN_PIPE') { my $quoted_file = _shell_quote $file; if ($type eq 'IN_PIPE') { defined $input_pipe_cmd and die "$program_name: $test_name: only one input" . " may be specified with IN_PIPE\n"; $input_pipe_cmd = "cat $quoted_file |"; } else { push @args, $quoted_file; } } elsif ($type eq 'AUX' || $type eq 'OUT' || $type eq 'ERR') { $expect->{$type} = $file; } else { die "$program_name: $test_name: invalid type: $type\n" } } # Expect an exit status of zero if it's not specified. $expect->{EXIT} ||= 0; # Allow ERR to be omitted -- in that case, expect no error output. foreach my $eo (qw (OUT ERR)) { if (!exists $expect->{$eo}) { $expect->{$eo} = _create_file ($program_name, $test_name, undef, ''); push @junk_files, $expect->{$eo}; } } # FIXME: Does it ever make sense to specify a filename *and* contents # in OUT or ERR spec? # FIXME: this is really suboptimal... my @new_args; foreach my $a (@args) { $a = _at_replace $expect, $a; push @new_args, $a; } @args = @new_args; warn "$test_name...\n" if $verbose; &{$expect->{PRE}} if $expect->{PRE}; my %actual; $actual{OUT} = "$test_name.O"; $actual{ERR} = "$test_name.E"; push @junk_files, $actual{OUT}, $actual{ERR}; my @cmd = (@prog, @args, "> $actual{OUT}", "2> $actual{ERR}"); $env_prefix and unshift @cmd, $env_prefix; defined $input_pipe_cmd and unshift @cmd, $input_pipe_cmd; my $cmd_str = join (' ', @cmd); # Delete from the environment any symbols specified by syntax # like this: {ENV_DEL => 'TZ'}. my %pushed_env; foreach my $env_sym (@env_delete) { my $val = delete $ENV{$env_sym}; defined $val and $pushed_env{$env_sym} = $val; } warn "Running command: '$cmd_str'\n" if $debug; my $rc = 0xffff & system $cmd_str; # Restore any environment setting we changed via a deletion. foreach my $env_sym (keys %pushed_env) { $ENV{$env_sym} = $pushed_env{$env_sym}; } if ($rc == 0xff00) { warn "$program_name: test $test_name failed: command failed:\n" . " '$cmd_str': $!\n"; $fail = 1; goto cleanup; } $rc >>= 8 if $rc > 0x80; if ($expect->{EXIT} != $rc) { warn "$program_name: test $test_name failed: exit status mismatch:" . " expected $expect->{EXIT}, got $rc\n"; $fail = 1; goto cleanup; } my %actual_data; # Record actual stdout and stderr contents, if POST may need them. if ($expect->{POST}) { foreach my $eo (qw (OUT ERR)) { my $out_file = $actual{$eo}; open IN, $out_file or (warn "$program_name: cannot open $out_file for reading: $!\n"), $fail = 1, next; $actual_data{$eo} = <IN>; close IN or (warn "$program_name: failed to read $out_file: $!\n"), $fail = 1; } } foreach my $eo (qw (OUT ERR)) { my $subst_expr = $expect->{RESULT_SUBST}->{$eo}; if (defined $subst_expr) { my $out = $actual{$eo}; my $orig = "$out.orig"; # Move $out aside (to $orig), then recreate $out # by transforming each line of $orig via $subst_expr. rename $out, $orig or (warn "$program_name: cannot rename $out to $orig: $!\n"), $fail = 1, next; open IN, $orig or (warn "$program_name: cannot open $orig for reading: $!\n"), $fail = 1, (unlink $orig), next; unlink $orig or (warn "$program_name: cannot unlink $orig: $!\n"), $fail = 1; open OUT, ">$out" or (warn "$program_name: cannot open $out for writing: $!\n"), $fail = 1, next; while (defined (my $line = <IN>)) { eval "\$_ = \$line; $subst_expr; \$line = \$_"; print OUT $line; } close IN; close OUT or (warn "$program_name: failed to write $out: $!\n"), $fail = 1, next; } my $eo_lower = lc $eo; _compare_files ($program_name, $test_name, $eo_lower, $actual{$eo}, $expect->{$eo}) and $fail = 1; } foreach my $pair (@post_compare) { my ($expected, $actual) = @$pair; _compare_files $program_name, $test_name, undef, $actual, $expected and $fail = 1; } cleanup: $expect->{POST} and &{$expect->{POST}} ($actual_data{OUT}, $actual_data{ERR}); } # FIXME: maybe unlink files inside the big foreach loop? unlink @junk_files if ! $save_temps; return $fail; } # For each test in @$TESTS, generate two additional tests, # one using stdin, the other using a pipe. I.e., given this one # ['idem-0', {IN=>''}, {OUT=>''}], # generate these: # ['idem-0.r', '<', {IN=>''}, {OUT=>''}], # ['idem-0.p', {IN_PIPE=>''}, {OUT=>''}], # Generate new tests only if there is exactly one input spec. # The returned list of tests contains each input test, followed # by zero or two derived tests. sub triple_test($) { my ($tests) = @_; my @new; foreach my $t (@$tests) { push @new, $t; my @in; my @args; my @list_of_hash; foreach my $e (@$t) { !ref $e and push (@args, $e), next; ref $e && ref $e eq 'HASH' or (warn "$0: $t->[0]: unexpected entry type\n"), next; defined $e->{IN} and (push @in, $e->{IN}), next; push @list_of_hash, $e; } # Add variants IFF there is exactly one input file. @in == 1 or next; shift @args; # discard test name push @new, ["$t->[0].r", @args, '<', {IN => $in[0]}, @list_of_hash]; push @new, ["$t->[0].p", @args, {IN_PIPE => $in[0]}, @list_of_hash]; } return @new; } ## package return 1; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/binary-file-matches������������������������������������������������������0000775�0001750�0001750�00000001060�14670377471�021362� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test for the "binary file ... matches" diagnostic. # # Copyright (C) 2020-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 echo "grep: (standard input): binary file matches" > exp \ || framework_failure_ printf 'a\0' | grep a > out 2> err || fail=1 compare /dev/null out || fail=1 compare exp err || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-invalid-utf8-input��������������������������������������������������0000775�0001750�0001750�00000001436�14670377471�022144� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Ensure that grep -P doesn't abort or infloop for invalid multi-byte input # # Copyright (C) 2013-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_timeout_ require_en_utf8_locale_ require_compiled_in_MB_support LC_ALL=en_US.UTF-8 require_pcre_ fail=0 printf 'j\202j\nj\nk\202\n' > in || framework_failure_ LC_ALL=en_US.UTF-8 timeout 10 grep -P j in test $? -eq 0 || fail=1 LC_ALL=en_US.UTF-8 timeout 10 grep -P 'k$' in test $? -eq 1 || fail=1 echo k >exp LC_ALL=en_US.UTF-8 timeout 10 grep -aoP 'k*' in >out || fail=1 compare exp out || fail=1 Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/word-delim-multibyte�����������������������������������������������������0000775�0001750�0001750�00000002211�14670377472�021616� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # exercise \< and \> with multibyte data. # Derived from https://savannah.gnu.org/bugs/?29537 . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ e_acute=$(printf '\303\251') echo "$e_acute" > in || framework_failure_ LC_ALL=en_US.UTF-8 export LC_ALL fail=0 grep "\\<$e_acute" in > out 2>err || fail=1 compare out in || fail=1 compare /dev/null err || fail=1 grep "$e_acute\\>" in > out 2>err || fail=1 compare out in || fail=1 compare /dev/null err || fail=1 grep -w "$e_acute" in > out 2>err || fail=1 compare out in || fail=1 compare /dev/null err || fail=1 # Also ensure that this works in both the C locale and that multibyte one. # In the C locale, it failed due to a dfa.c regression in grep-3.2. echo 123-x > in || framework_failure_ for locale in C en_US.UTF-8; do LC_ALL=$locale grep '.\bx' in > out 2>err || fail=1 compare out in || fail=1 compare /dev/null err || fail=1 done # Bug#43255 printf 'a \303\255cone b\n' >in for flag in '' -i; do returns_ 1 env LC_ALL=en_US.UTF-8 grep -w $flag cone in >out 2>err || fail=1 compare /dev/null out || fail=1 compare /dev/null err || fail=1 done Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/char-class-multibyte2����������������������������������������������������0000775�0001750�0001750�00000000675�14670377472�021671� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This test would segfault for grep-2.14 . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support e_acute=$(printf '\303\251') printf "$e_acute\n" > exp || framework_failure_ fail=0 for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do out=out-$LOC printf "á\nç\n$e_acute\n" | LC_ALL=$LOC grep -E "([^.]*[$e_acute]){1,2}" \ > $out || fail=1 compare exp $out || fail=1 done Exit $fail �������������������������������������������������������������������kbuild-3608/src/grep/tests/many-regex-performance���������������������������������������������������0000775�0001750�0001750�00000005614�14670377471�022123� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test for this performance regression: # grep-3.4 would require O(N^2) RSS for N regexps # grep-3.5 requires O(N) in the most common cases. # Copyright 2020-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # This test is susceptible to failure due to differences in # system load during the two test runs, so we'll mark it as # "expensive", making it less likely to be run by regular users. expensive_ # Make the quick/small input large enough so that even on high-end # systems this first invocation takes at least 10ms of user time. word_list=/usr/share/dict/linux.words # If $word_list does not exist, generate an input that exibhits # similar performance characteristics. if ! test -f $word_list; then # Generate data comprable to that word list. # Note how all "words" start with "a", and that there is # a small percentage of lines with at least one "." metachar. # This requires /dev/urandom, so if it's not present, skip # this test. If desperate, we could fall back to using # tar+compressed lib/*.c as the data source. test -r /dev/urandom \ || skip_ 'this system has neither word list nor working /dev/urandom' word_list=word_list ( echo a; cat /dev/urandom \ | LC_ALL=C tr -dc 'a-zA-Z0-9_' \ | head -c500000 \ | sed 's/\(........\)/\1\n/g' \ | sed s/rs/./ \ | sed s/./a/ \ | sort \ ) > $word_list fi n_lines=2000 while :; do sed ${n_lines}q < $word_list > in || framework_failure_ small_ms=$(LC_ALL=C user_time_ 1 grep --file=in -v in) || fail=1 test $small_ms -ge 10 && break n_lines=$(expr $n_lines + 2000) done # Now, run it again, but with 20 times as many lines. n_lines=$(expr $n_lines \* 20) sed ${n_lines}q < $word_list > in || framework_failure_ large_ms=$(LC_ALL=C user_time_ 1 grep --file=in -v in) || fail=1 # Deliberately recording in an unused variable so it # shows up in set -x output, in case this test fails. ratio=$(expr "$large_ms" / "$small_ms") # The duration of the larger run must be no more than 60 times # that of the small one. Using recent versions prior to this fix, # this test would fail due to ratios larger than 300. Using the # fixed version, it's common to see a ratio of 20-30. returns_ 1 expr $small_ms '<' $large_ms / 60 || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/proc���������������������������������������������������������������������0000775�0001750�0001750�00000000744�14670377472�016513� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test the /proc file system if available. # Copyright 2016-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 test -r /proc/self/status || skip_ 'No /proc/self/status on this platform.' grep '^' </proc/self/status >/dev/null || fail=1 Exit $fail ����������������������������kbuild-3608/src/grep/tests/backslash-dot������������������������������������������������������������0000775�0001750�0001750�00000000760�14670377471�020264� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # This once failed to match: echo . | grep '\.' # # Copyright (C) 2020-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 echo . > in || framework_failure_ grep '\.' in > out 2> err || fail=1 compare in out || fail=1 compare /dev/null err || fail=1 Exit $fail ����������������kbuild-3608/src/grep/tests/encoding-error�����������������������������������������������������������0000775�0001750�0001750�00000002262�14670377471�020461� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test grep's behavior on encoding errors. # # Copyright 2015-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ printf 'Alfred Jones\n' > a || framework_failure_ printf 'John Smith\n' >j || framework_failure_ printf 'Pedro P\351rez\n' >p || framework_failure_ cat a p j >in || framework_failure_ LC_ALL=en_US.UTF-8 export LC_ALL fail=0 grep '^A' in >out || fail=1 compare a out || fail=1 grep '^P' in >out || fail=1 compare /dev/null out || fail=1 grep -I '^P' in >out 2>err || fail=1 compare /dev/null out || fail=1 compare /dev/null err || fail=1 grep '^J' in >out || fail=1 compare j out || fail=1 returns_ 1 grep '^X' in >out || fail=1 compare /dev/null out || fail=1 grep . in >out || fail=1 cat a j >exp || framework_failure_ compare exp out || fail=1 grep -I . in >out 2>err || fail=1 cat a j >exp || framework_failure_ compare exp out || fail=1 compare /dev/null err || fail=1 grep -a . in >out || fail=1 compare in out Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/multiple-begin-or-end-line�����������������������������������������������0000775�0001750�0001750�00000002006�14670377471�022564� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test a pattern of multiple begin or end line constraints. # This would mistakenly print a line when using grep-2.19. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src echo aa | grep 'a\(b$\|c$\)' >out && fail=1 compare /dev/null out || fail=1 echo aa | grep '\(^b\|^c\)a' >out && fail=1 compare /dev/null out || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-o�������������������������������������������������������������������0000775�0001750�0001750�00000000655�14670377471�016735� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Ensure that grep -oP doesn't cause internal error at match. # # Copyright (C) 2014-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_pcre_ fail=0 echo ab | grep -oP 'a' || fail=1 Exit $fail �����������������������������������������������������������������������������������kbuild-3608/src/grep/tests/bre.awk������������������������������������������������������������������0000664�0001750�0001750�00000002052�14670377471�017067� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. BEGIN { FS="@"; n = 0; printf ("# Generated Spencer BRE Test\n"); printf ("failures=0\n"); } $0 ~ /^#/ { next; } NF == 3 { # printf ("status=$(echo '%s' | { grep -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; })\n",$3, $2); printf ("status=$(echo '%s' | { grep -e '%s' > /dev/null 2>&1; echo $? ; })\n",$3, $2); printf ("if test $status -ne %s ; then\n", $1); printf ("\techo Spencer bre test \\#%d failed\n", ++n); printf ("\tfailures=1\n"); printf ("fi\n"); } NF == 4 { #don't alarm users # printf ("echo '%s' | grep -e '%s' > /dev/null 2>&1\n",$3, $2); # printf ("if test $? -ne %s ; then\n", $1); # printf ("\techo Expected non conformance \\#%d ... continuing\n", ++n); # printf ("fi\n"); } END { printf ("exit $failures\n"); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/mb-dot-newline�����������������������������������������������������������0000775�0001750�0001750�00000002060�14670377471�020361� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Trigger a bug in the DFA matcher. # This would fail for grep-2.20. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src printf 'a\naa\n' > in || framework_failure_ printf 'aa\n' > exp || framework_failure_ fail=0 for LOC in en_US.UTF-8 en_US zh_CN $LOCALE_FR_UTF8 C; do out1=out1-$LOC LC_ALL=$LOC grep '..' in > out || fail=1 compare exp out || fail=1 done Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/dfaexec-multibyte��������������������������������������������������������0000775�0001750�0001750�00000001146�14670377471�021157� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would fail for grep-2.5.3 . "${srcdir=.}/init.sh"; path_prepend_ ../src printf 'aa\nab\nba\nbb\n' > exp1 || framework_failure_ printf '1 2 3\n' > exp2 || framework_failure_ fail=0 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do out=out1-ab-$LOC LC_ALL=$LOC grep -E '([a]|[b]){2}' < exp1 > $out || fail=1 compare exp1 $out || fail=1 out=out1-ba-$LOC LC_ALL=$LOC grep -E '([b]|[a]){2}' < exp1 > $out || fail=1 compare exp1 $out || fail=1 out=out2-$LOC LC_ALL=$LOC grep -E '^([[:digit:]]+[[:space:]]+){2}' < exp2 > $out || fail=1 compare exp2 $out || fail=1 done Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/mb-non-UTF8-performance��������������������������������������������������0000775�0001750�0001750�00000003363�14670377471�021760� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # grep-2.17 would take nearly 200x longer to run the command below. # The 200x is on an Intel i7-based system. # On an AMD FX-4100, it would take up to 2500x longer. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # This test is susceptible to failure due to differences in # system load during the two test runs, so we'll mark it as # "expensive", making it less likely to be run by regular users. expensive_ # Make the input large enough so that even on high-end systems # the unibyte test takes at least 10ms of user time. n_lines=100000 while :; do yes $(printf '%078d' 0) | sed ${n_lines}q > in || framework_failure_ ubyte_ms=$(LC_ALL=C user_time_ 1 grep -i foobar in) || fail=1 test $ubyte_ms -ge 10 && break n_lines=$(expr $n_lines + 200000) done require_JP_EUC_locale_ mbyte_ms=$(user_time_ 1 grep -i foobar in) || fail=1 # The duration of the multi-byte run must be no more than 30 times # that of the single-byte one. # A multiple of 3 seems to be enough for i5,i7, but AMD needs >25. returns_ 1 expr $ubyte_ms '<' $mbyte_ms / 30 || fail=1 Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/backref-alt��������������������������������������������������������������0000775�0001750�0001750�00000002047�14670377471�017720� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test for a bug in glibc's regex code as of 2015-09-19. # # Copyright 2015-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src echo aa > in || framework_failure_ fail=0 grep -E 'b|(.)b|\1|b' in >out status=$? # POSIX isn't clear whether this regular expression should be invalid, # (because the \1 is out of range for REs that could precede it) # or valid but \1 should not match. Allow either interpretation. test $status -eq 2 || test $status -eq 1 || fail=1 grep -E '0|()0|\1|0' in >out status=$? test $status -eq 2 || test $status -eq 1 || fail=1 # This test is a reduced version of the one in Bug#27838. # It triggers this glibc assertion failure: # grep: regexec.c:1342: pop_fail_stack: Assertion `num >= 0' failed. LC_ALL=C grep -E '(()x)|\2' in > out status=$? test $status -eq 2 || test $status -eq 1 || fail=1 Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/long-pattern-perf��������������������������������������������������������0000775�0001750�0001750�00000003143�14670377471�021107� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # grep-2.21 would incur a 100x penalty for 10x increase in regexp length # Copyright 2015-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # This test is susceptible to failure due to differences in # system load during the two test runs, so we'll mark it as # "expensive", making it less likely to be run by regular users. expensive_ echo x > in || framework_failure_ # Note that we want 10x the byte count (not line count) in the larger file. seq 10000 50000 | tr -d '\012' > r || framework_failure_ cat r r r r r r r r r r > re-10x || framework_failure_ mv r re || framework_failure_ base_ms=$(user_time_ 1 grep -f re in ) || fail=1 b10x_ms=$(user_time_ 1 grep -f re-10x in) || fail=1 # Increasing the length of the regular expression by a factor # of 10 should cause no more than a 10x increase in duration. # However, we'll draw the line at 20x to avoid false-positives. returns_ 1 expr $base_ms '<' $b10x_ms / 20 || fail=1 Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/khadafy.lines������������������������������������������������������������0000664�0001750�0001750�00000001330�14670377471�020254� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������1) Muammar Qaddafi 2) Mo'ammar Gadhafi 3) Muammar Kaddafi 4) Muammar Qadhafi 5) Moammar El Kadhafi 6) Muammar Gadafi 7) Mu'ammar al-Qadafi 8) Moamer El Kazzafi 9) Moamar al-Gaddafi 10) Mu'ammar Al Qathafi 11) Muammar Al Qathafi 12) Mo'ammar el-Gadhafi 13) Moamar El Kadhafi 14) Muammar al-Qadhafi 15) Mu'ammar al-Qadhdhafi 16) Mu'ammar Qadafi 17) Moamar Gaddafi 18) Mu'ammar Qadhdhafi 19) Muammar Khaddafi 20) Muammar al-Khaddafi 21) Mu'amar al-Kadafi 22) Muammar Ghaddafy 23) Muammar Ghadafi 24) Muammar Ghaddafi 25) Muamar Kaddafi 26) Muammar Quathafi 27) Muammar Gheddafi 28) Muamar Al-Kaddafi 29) Moammar Khadafy 30) Moammar Qudhafi 31) Mu'ammar al-Qaddafi 32) Mulazim Awwal Mu'ammar Muhammad Abu Minyar al-Qadhafi ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/long-line-vs-2GiB-read���������������������������������������������������0000775�0001750�0001750�00000001236�14670377471�021510� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Ensure that grep can handle lines 2GiB long. # Before grep-2.16, a line of length 2^31 or greater would provoke # an "Invalid argument" (EINVAL) failure from the read syscall on # systems like OS/X 10.8.5. . "${srcdir=.}/init.sh"; path_prepend_ ../src # Searching 2GiB takes a while. expensive_ echo big > exp || framework_failure_ MiB=1048576 dd bs=$MiB seek=2048 of=big < /dev/null || framework_failure_ echo x >> big || framework_failure_ grep -l x big > out 2> err || fail=1 # Not everyone has 2GB of memory free. grep '^grep: memory exhausted$' err && skip_ 'memory exhausted' compare exp out || fail=1 compare /dev/null err || fail=1 Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/include-exclude����������������������������������������������������������0000775�0001750�0001750�00000004565�14670377471�020626� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Use of any --include or --exclude* option would segfault in 2.6 and 2.6.1 . "${srcdir=.}/init.sh"; path_prepend_ ../src mkdir -p x/dir || framework_failure_ echo aaa > x/a || framework_failure_ echo bbb > x/b || framework_failure_ echo ddd > x/dir/d || framework_failure_ printf '%s\n' x/b:bbb x/dir/d:ddd > exp-not-a || framework_failure_ printf '%s\n' x/dir/d:ddd > exp-not-ab || framework_failure_ printf '%s\n' x/a:aaa x/b:bbb > exp-not-d || framework_failure_ printf '%s\n' x/a:aaa x/b:bbb > exp-not-dir || framework_failure_ printf '%s\n' x/a:aaa > exp-a || framework_failure_ printf '%s\n' a:aaa > exp-aa || framework_failure_ printf '%s\n' aaa > exp-aaa || framework_failure_ printf '%s\n' ./x/a ./x/b ./x/dir/d | sort > exp-dotnames || framework_failure_ grep -r --exclude='a*' . x > out || fail=1 sort out > k && mv k out compare exp-not-a out || fail=1 grep -r --exclude='Rumpelstiltskin' --include='a*' --exclude='a*' . x > out || fail=1 sort out > k && mv k out compare exp-not-a out || fail=1 grep -r --exclude='[ab]' . x > out || fail=1 sort out > k && mv k out compare exp-not-ab out || fail=1 grep -r --exclude='*d' . x > out || fail=1 sort out > k && mv k out compare exp-not-d out || fail=1 grep -r --exclude-dir=dir . x > out || fail=1 sort out > k && mv k out compare exp-not-dir out || fail=1 grep -r --exclude-dir=dir/ . x > out || fail=1 sort out > k && mv k out compare exp-not-dir out || fail=1 # Test with a non-glob. grep -r --include=a . x > out || fail=1 # no need to sort compare exp-a out || fail=1 # Also test --include with a "glob". grep -r --include='a*' . x > out || fail=1 # no need to sort compare exp-a out || fail=1 # --include (without --recursive) uses different code grep --directories=skip --include=x/a --exclude-dir=dir '^aaa$' x/* > out \ || fail=1 compare exp-a out || fail=1 (cd x && grep -r --exclude-dir=. '^aaa$') > out || fail=1 compare exp-aa out || fail=1 grep --exclude=- '^aaa$' - < x/a > out || fail=1 compare exp-aaa out || fail=1 for exclude in 'x' 'x*'; do grep -rl --exclude-dir="$exclude" . x > out test $? -eq 1 || fail=1 compare /dev/null out || fail=1 done for exclude in 'x' 'x*' './x' './x*'; do grep -rl --exclude-dir="$exclude" . ./x | sort > out || fail=1 compare /dev/null out || fail=1 done Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/r-dot��������������������������������������������������������������������0000775�0001750�0001750�00000000720�14670377472�016567� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Check that "grep -r PAT" reads ".". . "${srcdir=.}/init.sh"; path_prepend_ ../src mkdir dir || framework_failure_ echo aaa > dir/a || framework_failure_ echo bbb > dir/b || framework_failure_ echo a:aaa > exp || framework_failure_ (cd dir && grep -r aaa) > out || fail=1 compare exp out || fail=1 (cd dir && grep -r aaa < a) > out || fail=1 compare exp out || fail=1 (cd dir && grep -r aaa *) > out || fail=1 compare exp out || fail=1 Exit $fail ������������������������������������������������kbuild-3608/src/grep/tests/mb-non-UTF8-perf-Fw������������������������������������������������������0000775�0001750�0001750�00000002704�14670377471�020763� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test for a performance regression with -Fw and a non-UTF8 multibyte locale. # Copyright 2019-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 require_timeout_ require_JP_EUC_locale_ yes 00 | head -10000000 > in || framework_failure_ # Since we're using an absolute timeout below and want to avoid any initial # disk read performance penalty, run first with a large timeout and no error # test to prime any cache. Prompted by a report of test failure on a netbsd8.1 # VM whereby the first run would take 2.5 MINUTES, yet the second would complete # in just half a second. timeout 500 grep -Fw 0 in # Before fixing the regression, this would have taken minutes. # With the fix, it typically completes in well under one second. returns_ 1 timeout 30 grep -Fw 0 in || fail=1 Exit $fail ������������������������������������������������������������kbuild-3608/src/grep/tests/backref-multibyte-slow���������������������������������������������������0000775�0001750�0001750�00000002140�14670377472�022133� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This was approximately quadratic up to grep-2.6.3 . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_timeout_ fail=0 # Create a 13000-line input $AWK 'BEGIN {for (i=0; i<13000; i++) print "aba"}' /dev/null > in || fail=1 # Use 10 times the duration of running grep in the C locale as the timeout # when running in en_US.UTF-8. Round up to whole seconds, since timeout # can't deal with fractional seconds. max_seconds=$(LC_ALL=C perl -le 'use Time::HiRes qw(time); my $s = time(); system q,grep -E '\''^([a-z]).\1$'\'' in > junk,; my $elapsed = time() - $s; print int (1 + 10 * $elapsed)') \ || { max_seconds=5; warn_ "$ME_: warning: no perl? using default of 5s timeout"; } # If the above finished so quickly that we'd have a 1-second timeout, # increase it to a duration less likely to arise in a parallel test run. test $max_seconds = 1 && max_seconds=5 for LOC in en_US.UTF-8; do out=out-$LOC LC_ALL=$LOC timeout ${max_seconds}s grep -aE '^([a-z]).\1$' in > $out 2>&1 \ || fail=1 compare $out in || fail=1 done Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/count-newline������������������������������������������������������������0000775�0001750�0001750�00000001665�14670377471�020341� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test that newline is counted correctly even when the transition # table is rebuilt. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src printf '%1024d\nb\n' 0 >in || framework_failure_ grep -f in in >out || fail=1 compare in out || fail=1 Exit $fail ���������������������������������������������������������������������������kbuild-3608/src/grep/tests/skip-device��������������������������������������������������������������0000775�0001750�0001750�00000000640�14670377472�017746� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # grep must ignore --devices=ACTION (-D) when reading stdin # For grep-2.11, this test would fail. . "${srcdir=.}/init.sh"; path_prepend_ ../src # Test both with no file argument, and with "-". echo foo | grep -D skip foo - || fail=1 echo foo | grep --devices=skip foo || fail=1 require_timeout_ mkfifo myfifo || framework_failure_ timeout 10 grep -D skip foo myfifo test $? -eq 1 || fail=1 Exit $fail ������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/grep-dev-null������������������������������������������������������������0000775�0001750�0001750�00000001145�14670377472�020225� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Case-insensitive grep with a 0-size input file would fail in grep up to 2.6.3 . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ LC_ALL=en_US.UTF-8 export LC_ALL echo x | returns_ 1 grep -f /dev/null || fail=1 echo x | returns_ 1 grep -if /dev/null || fail=1 echo x | returns_ 1 grep -Ff /dev/null || fail=1 echo x | returns_ 1 grep -Fif /dev/null || fail=1 returns_ 1 grep -f /dev/null < /dev/null || fail=1 returns_ 1 grep -if /dev/null < /dev/null || fail=1 returns_ 1 grep -Ff /dev/null < /dev/null || fail=1 returns_ 1 grep -Fif /dev/null < /dev/null || fail=1 Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/yesno��������������������������������������������������������������������0000775�0001750�0001750�00000012351�14670377472�016702� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test feature interaction of -C, -v, -o, and -m. # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. # # This set of tests was started by Charles Levert. . "${srcdir=.}/init.sh"; path_prepend_ ../src : ${VERBOSE=} # empty or "1" failures=0 # Lines, including terminating LF, contain 10 octets. # The words "yes" and "no" are at zero-based octet offsets of 5, 15, ... yn='yesno.txt' cat > "$yn" <<EOF [A01 no ] [B02 no ] [C03 yes] [D04 yes] [E05 yes] [F06 no ] [G07 no ] [H08 yes] [I09 yes] [J10 no ] [K11 no ] [L12 no ] [M13 yes] [N14 yes] EOF # Noticed the symmetry? # All possible output substrings (lines): # selected whole, rejected whole, never-read whole, selected part, rejected part. A='1:0:[A01 no ]/'; rA='1-0-[A01 no ]/'; XA='X[A01 no ]/'; B='2:10:[B02 no ]/'; rB='2-10-[B02 no ]/'; XB='X[B02 no ]/'; C='3:20:[C03 yes]/'; rC='3-20-[C03 yes]/'; XC='X[C03 yes]/'; c='3:25:yes/'; rc='3-25-yes/' D='4:30:[D04 yes]/'; rD='4-30-[D04 yes]/'; XD='X[D04 yes]/'; d='4:35:yes/'; rd='4-35-yes/' E='5:40:[E05 yes]/'; rE='5-40-[E05 yes]/'; XE='X[E05 yes]/'; e='5:45:yes/'; re='5-45-yes/' F='6:50:[F06 no ]/'; rF='6-50-[F06 no ]/'; XF='X[F06 no ]/'; G='7:60:[G07 no ]/'; rG='7-60-[G07 no ]/'; XG='X[G07 no ]/'; H='8:70:[H08 yes]/'; rH='8-70-[H08 yes]/'; XH='X[H08 yes]/'; h='8:75:yes/'; rh='8-75-yes/' I='9:80:[I09 yes]/'; rI='9-80-[I09 yes]/'; XI='X[I09 yes]/'; i='9:85:yes/'; ri='9-85-yes/' J='10:90:[J10 no ]/'; rJ='10-90-[J10 no ]/'; XJ='X[J10 no ]/'; K='11:100:[K11 no ]/'; rK='11-100-[K11 no ]/'; XK='X[K11 no ]/'; L='12:110:[L12 no ]/'; rL='12-110-[L12 no ]/'; XL='X[L12 no ]/'; M='13:120:[M13 yes]/'; rM='13-120-[M13 yes]/'; XM='X[M13 yes]/'; m='13:125:yes/'; rm='13-125-yes/' N='14:130:[N14 yes]/'; rN='14-130-[N14 yes]/'; XN='X[N14 yes]/'; n='14:135:yes/'; rn='14-135-yes/' # Group separators. s='--/' S='XYZ/' # Exit statuses. z0='?0/' z1='?1/' z2='?2/' # What needs fixing? Specification, documentation, implementation, or this? # The individual tests. set x \ '' "$C$D$E$H$I$M$N$z0" \ '-o' "$c$d$e$h$i$m$n$z0" \ '-C,1' "$rB$C$D$E$rF$rG$H$I$rJ$s$rL$M$N$z0" \ '-C,1,-o' "$c$d$e$h$i$s$m$n$z0" \ '-C,1,-o,--group=XYZ' "$c$d$e$h$i$S$m$n$z0" \ '-C,1,-o,--no-gr' "$c$d$e$h$i$m$n$z0" \ '-C,4,-1' "$rB$C$D$E$rF$rG$H$I$rJ$s$rL$M$N$z0" \ '-C,1,--group=XYZ' "$rB$C$D$E$rF$rG$H$I$rJ$S$rL$M$N$z0" \ '-C,1,--no-gr' "$rB$C$D$E$rF$rG$H$I$rJ$rL$M$N$z0" \ '-m,4' "$C$D$E$H$z0$XI$XJ$XK$XL$XM$XN" \ '-m,4,-o' "$c$d$e$h$z0$XI$XJ$XK$XL$XM$XN" \ '-m,4,-C,1' "$rB$C$D$E$rF$rG$H$rI$z0$XI$XJ$XK$XL$XM$XN" \ '-m,4,-C,1,-o' "$c$d$e$h$z0$XI$XJ$XK$XL$XM$XN" \ '-m,5' "$C$D$E$H$I$z0$XJ$XK$XL$XM$XN" \ '-m,5,-o' "$c$d$e$h$i$z0$XJ$XK$XL$XM$XN" \ '-m,5,-C,1,-o' "$c$d$e$h$i$z0$XJ$XK$XL$XM$XN" \ '-m,6' "$C$D$E$H$I$M$z0$XN" \ '-m,6,-o' "$c$d$e$h$i$m$z0$XN" \ '-m,6,-C,1' "$rB$C$D$E$rF$rG$H$I$rJ$s$rL$M$rN$z0$XN" \ '-m,6,-C,1,-o' "$c$d$e$h$i$s$m$z0$XN" \ '-v' "$A$B$F$G$J$K$L$z0" \ '-v,-o' "$z0" \ '-v,-C,1' "$A$B$rC$s$rE$F$G$rH$rI$J$K$L$rM$z0" \ '-v,-C,1,-o' "$rc$s$re$rh$ri$rm$z0" \ '-v,-C,1,--group=XYZ' "$A$B$rC$S$rE$F$G$rH$rI$J$K$L$rM$z0" \ '-v,-C,1,--no-gr' "$A$B$rC$rE$F$G$rH$rI$J$K$L$rM$z0" \ '-4,-1' "$rB$C$D$E$rF$rG$H$I$rJ$s$rL$M$N$z0" \ '-4,-v,-1' "$A$B$rC$s$rE$F$G$rH$rI$J$K$L$rM$z0" \ '-m,1,-v' "$A$z0$XB$XC$XD$XE$XF$XG$XH$XI$XJ$XK$XL$XM$XN" \ '-m,1,-v,-o' "$z0$XB$XC$XD$XE$XF$XG$XH$XI$XJ$XK$XL$XM$XN" \ '-m,1,-v,-C,1' "$A$rB$z0$XB$XC$XD$XE$XF$XG$XH$XI$XJ$XK$XL$XM$XN" \ '-m,1,-v,-C,1,-o' "$z0$XB$XC$XD$XE$XF$XG$XH$XI$XJ$XK$XL$XM$XN" \ '-m,2,-v' "$A$B$z0$XC$XD$XE$XF$XG$XH$XI$XJ$XK$XL$XM$XN" \ '-m,2,-v,-o' "$z0$XC$XD$XE$XF$XG$XH$XI$XJ$XK$XL$XM$XN" \ '-m,3,-v' "$A$B$F$z0$XG$XH$XI$XJ$XK$XL$XM$XN" \ '-m,3,-v,-o' "$z0$XG$XH$XI$XJ$XK$XL$XM$XN" \ '-m,3,-v,-C,1' "$A$B$rC$s$rE$F$rG$z0$XG$XH$XI$XJ$XK$XL$XM$XN" \ '-m,3,-v,-C,1,-o' "$rc$s$re$z0$XG$XH$XI$XJ$XK$XL$XM$XN" \ x shift # Comment out cases that are known to fail. These should be uncommented after the 2.5.4 release. TAA. # These should be added back in above and fixed in the code. TAA. # '-m,5,-C,1' "$rB$C$D$E$rF$rG$H$I$z0$XJ$XK$XL$XM$XN" \ # '-m,2,-v,-C,1' "$A$B$z0$XC$XD$XE$XF$XG$XH$XI$XJ$XK$XL$XM$XN" \ # '-m,2,-v,-C,1,-o' "$z0$XC$XD$XE$XF$XG$XH$XI$XJ$XK$XL$XM$XN" \ # Test execution and reporting. t=1 while test xx != "x$1"; do opts=$(echo "$1" | sed 's/,/ /g') expect="$2" shift 2 output=$({ grep -F -n -b $opts yes 2>/dev/null; echo "?$?"; sed 's!^!X!'; } < "$yn" | tr '\n' '/') if test "$output" != "$expect" || test "$VERBOSE" = "1"; then echo " Test #$t: { grep -F -n -b $opts yes; echo \"?\$?\"; sed 's!^!X!'; }" echo " output: \"$output\"" fi if test "$output" != "$expect"; then echo " expect: \"$expect\"" echo ' FAIL' failures=1 elif test "$VERBOSE" = "1"; then echo ' PASS' fi t=$(expr $t + 1) done Exit $failures ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/sjis-mb������������������������������������������������������������������0000775�0001750�0001750�00000003175�14670377472�017115� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # similar to euc-mb and fgrep-infloop, but tests SJIS encoding. # in this encoding, an ASCII character is both a valid single-byte # character, and a suffix of a valid double-byte character . "${srcdir=.}/init.sh"; path_prepend_ ../src # Add "." to PATH for the use of get-mb-cur-max. path_prepend_ . require_compiled_in_MB_support require_timeout_ # Sequences used in this test ("%" and "@" become 8-bit characters, while "A" # is the real ASCII character for "A"): # - "%" becomes an half-width katakana in SJIS, but it is an invalid sequence # in UTF-8. # - "@@" and "@A" are both valid sequences in SJIS. We try to fool grep into # matching "A" against "@A", or mistaking a valid "A" match for the second # byte of a multi-byte character. encode() { echo "$1" | tr @% '\203\301'; } for locale in ja_JP.SHIFT_JIS ja_JP.SJIS ja_JP.PCK ''; do test "$(get-mb-cur-max $locale)" = 2 && break done test -n "$locale" || skip_ 'SJIS locale not found' k=0 test_grep_reject() { k=$(expr $k + 1) encode "$2" > in || return 1 returns_ 1 env LC_ALL=$locale timeout 10s \ grep $1 $(encode "$3") in >out$k 2>&1 \ && compare /dev/null out$k } test_grep() { k=$(expr $k + 1) encode "$2" > exp$k LC_ALL=$locale \ timeout 10s grep $1 $(encode "$3") exp$k > out$k 2>&1 test $? = 0 && compare exp$k out$k } failure_tests=@A successful_tests='%%AA @AA @A@@A' fail=0 for i in $successful_tests; do test_grep -F $i A || fail=1 test_grep -E $i A || fail=1 done for i in $failure_tests; do test_grep_reject -F $i A || fail=1 test_grep_reject -E $i A || fail=1 done test_grep_reject -E @A '^$|A' || fail=1 Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/inconsistent-range�������������������������������������������������������0000775�0001750�0001750�00000000640�14670377472�021355� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would fail for grep-2.6 . "${srcdir=.}/init.sh"; path_prepend_ ../src printf '00a\n00g\n00z\n00A\n00G\n00Z\n' > in || framework_failure_ fail=0 for LOC in en_US.UTF-8 en_US zh_CN $LOCALE_FR_UTF8 C; do out1=out1-$LOC LC_ALL=$LOC grep -E '(.)\1[A-Z]' in > $out1 || fail=1 out2=out2-$LOC LC_ALL=$LOC grep -E '[A-Z]' in > $out2 || fail=1 compare $out1 $out2 || fail=1 done Exit $fail ������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/two-chars����������������������������������������������������������������0000775�0001750�0001750�00000001117�14670377472�017452� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Check for grep -F with two patterns consisting of the same char. # # Copyright 2016-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ fail=0 for LOC in en_US.UTF-8 $zh $LOCALE_FR_UTF8; do printf '0\n0\n' >pat printf '0\n' >in out=out-$LOC LC_ALL=$LOC grep -Ff pat in >$out || fail=1 compare in $out || fail=1 done Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-z�������������������������������������������������������������������0000775�0001750�0001750�00000001400�14670377472�016736� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test Perl regex with NUL-separated input . "${srcdir=.}/init.sh"; path_prepend_ ../src require_pcre_ require_en_utf8_locale_ REGEX=a printf '%s\n\0' abc def ghi aaa gah > in || framework_failure_ grep -z "$REGEX" in > exp 2>err || fail_ 'Cannot do BRE (grep -z) match.' compare /dev/null err || fail_ 'stderr not empty on grep -z.' # Sanity check the output test "$(grep -cz $REGEX in 2>err)" = 3 \ || fail_ 'Incorrect BRE (grep -cz) match.' compare /dev/null err || fail_ 'stderr not empty on grep -cz.' fail=0 grep -Pz "$REGEX" in > out 2>err || fail=1 compare exp out || fail=1 compare /dev/null err || fail=1 printf '\303\200\0' >in0 # "À" followed by a NUL. LC_ALL=en_US.UTF-8 grep -z . in0 >out || fail=1 cmp in0 out || fail=1 Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/init.cfg�����������������������������������������������������������������0000664�0001750�0001750�00000013275�14670377471�017250� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is sourced by init.sh, *before* its initialization. # This goes hand in hand with the "9>&2;" in tests/Makefile.am's # TESTS_ENVIRONMENT definition. stderr_fileno_=9 # Map settings of "none" to the empty string. test _"$LOCALE_FR" = _none && LOCALE_FR= test _"$LOCALE_FR_UTF8" = _none && LOCALE_FR_UTF8= # Unset key environment variables. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Derive this list by searching for string literals as the first # argument to getenv: # git grep getenv|perl -nle '/\bgetenv *\("(.+?)"\)/ and print $1'|sort -u grep vars_=' GREP_COLOR GREP_COLORS TERM ' envvar_check_fail=0 for v_ in $vars_ do $as_unset $v_ if eval test \"\${$v_+set}\" = set; then echo "$0: the $v_ environment variable is set --" \ ' unset it and rerun this test' >&2 envvar_check_fail=1 fi done test "$envvar_check_fail" = 1 && fail_ "failed to unset the above envvars" require_timeout_() { ( timeout 10s true ) > /dev/null 2>&1 \ || skip_ your system lacks the timeout program returns_ 1 timeout 10s false \ || skip_ your system has a non-GNU timeout program returns_ 124 timeout 0.01 sleep 0.02 \ || skip_ "'timeout 0.01 sleep 0.02' did not time out" } require_pcre_() { echo . | grep -P . 2>err || { test $? -eq 1 && fail_ PCRE available, but does not work. skip_ no PCRE support } compare /dev/null err || fail_ PCRE available, but stderr not empty. } # Some tests would fail without this particular locale. # If the locale is not available, just skip the test. require_en_utf8_locale_() { path_prepend_ . case $(get-mb-cur-max en_US.UTF-8) in [3456]) ;; *) skip_ 'en_US.UTF-8 locale not found' ;; esac } require_tr_utf8_locale_() { path_prepend_ . case $(get-mb-cur-max tr_TR.UTF-8) in [3456]) ;; *) skip_ 'tr_TR.UTF-8 locale not found' ;; esac } require_ru_RU_koi8_r() { path_prepend_ . case $(get-mb-cur-max ru_RU.KOI8-R) in 1) ;; *) skip_ 'ru_RU.KOI8-R locale not found' ;; esac } require_compiled_in_MB_support() { require_en_utf8_locale_ printf 'é' | LC_ALL=en_US.UTF-8 grep '[[:lower:]]' \ || skip_ this test requires MBS support } require_unibyte_locale() { path_prepend_ . for loc in C en_US; do for encoding in '' .iso88591 .iso885915 .ISO8859-1 .ISO8859-15; do locale=$loc$encoding MB_CUR_MAX=$(get-mb-cur-max $locale 2>/dev/null) && test "$MB_CUR_MAX" -eq 1 && LC_ALL=$locale && export LC_ALL && return done done skip_ 'no unibyte locale found' } # Define hi_res_time_ to a function that prints the current time # as a floating point number with greater than 1-second resolution. # Otherwise, skip the requiring test. require_hi_res_time_() { local cmd for cmd in 'date +%s.%N' \ 'perl -le "use Time::HiRes qw(time); print scalar time()"'; do case $($cmd) in *.[0-9]*) eval 'hi_res_time_() { '"$cmd"'; }'; break;; esac done type hi_res_time_ || skip_ no high-resolution timer support } require_JP_EUC_locale_() { local locale=ja_JP.eucJP path_prepend_ . case $(get-mb-cur-max $locale) in [23]) LC_ALL=$locale && export LC_ALL && return ;; *) ;; esac skip_ "$locale locale not found" } expensive_() { if test "$RUN_EXPENSIVE_TESTS" != yes; then skip_ 'expensive: disabled by default This test is relatively expensive, so it is disabled by default. To run it anyway, rerun make check with the RUN_EXPENSIVE_TESTS environment variable set to yes. E.g., env RUN_EXPENSIVE_TESTS=yes make check or use the shortcut target of the toplevel Makefile, make check-expensive ' fi } # Like printf with a single argument, but that argument must be a # sequence of four-byte strings \xHH where each H is a hexadecimal byte. hex_printf_() { local octal_fmt=$(printf '\\%o' \ $(printf '%s\n' "$1" \ | sed 's,\\x\([0-9abcdefABCDEF][0-9abcdefABCDEF]\), 0x\1,g')) printf "$octal_fmt" } # Wrap tr so that it always runs in the C locale. # Otherwise, in a multibyte locale, GNU tr (which is not multibyte-aware # as of 2014-11-08), would work differently than others. For example, # this command, which was written with unibyte GNU tr in mind, # LC_ALL=ja_JP.eucJP tr AB '\244\263' # would act like this with the multibyte tr from HP-UX and Solaris: # LC_ALL=ja_JP.eucJP tr A '\244\263' tr() { LC_ALL=C env -- tr "$@"; } # Usage: user_time_ EXPECTED_EXIT_STATUS CMD ... # If CMD ... exits with the expected exit status, print the elapsed # child "user" time (not "system" time) in milliseconds and return 0. # Otherwise, diagnose the exit status mismatch and return nonzero. user_time_() { $PERL -le ' my $expected_exit_status = $ARGV[0]; shift @ARGV; system (@ARGV); my ($user, $system, $child_user, $child_system) = times; my $me = q('"$ME_"'); $? == -1 and die qq($me: failed to exec ") . join (" ", @ARGV) . qq(": $!\n); my $rc = $?; my $sig = ($rc & 127); $sig and die "$me: child died with signal $sig\n"; $rc >>= 8; $rc == $expected_exit_status or die "$me: bad exit status: expected $expected_exit_status; got $rc\n"; # Print milliseconds of child user time. $child_user *= 1000; print int ($child_user + 0.5)' "$@" } # yes is not portable, fake it with $AWK yes() { line=${*-y} ${AWK-awk} 'BEGIN{for (;;) print ENVIRON["line"]}'; } # Some systems lack seq. # A limited replacement for seq: handle 1 or 2 args; increment must be 1 if ! type seq > /dev/null 2>&1; then seq() { case $# in 1) start=1 final=$1;; 2) start=$1 final=$2;; *) echo you lose 1>&2; exit 1;; esac awk 'BEGIN{for(i='$start';i<='$final';i++) print i}' < /dev/null } fi �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/dfa-heap-overrun���������������������������������������������������������0000775�0001750�0001750�00000001565�14670377472�020715� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Trigger a heap overrun in grep-2.6..grep-2.8. # Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 returns_ 1 grep -E '(^| )*(a|b)*(c|d)*( |$)' < /dev/null || fail=1 Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/unibyte-binary�����������������������������������������������������������0000775�0001750�0001750�00000002146�14670377472�020507� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Test binary files in unibyte locales with encoding errors # Copyright 2016-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_unibyte_locale fail=0 printf 'a\n\200\nb\n' >in || framework_failure_ printf 'a\n' >exp || framework_failure_ grep . in >out || fail=1 # In some unibyte locales, \200 is an encoding error; # in others, it is a valid character. Allow either possibility. compare exp out || compare in out || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-utf8����������������������������������������������������������������0000775�0001750�0001750�00000002271�14670377471�017361� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Ensure that, with -P, Unicode \p{} symbols are correctly matched. # # Copyright (C) 2012-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ LC_ALL=en_US.UTF-8 require_pcre_ fail=0 echo '$' | LC_ALL=en_US.UTF-8 grep -qP '\p{S}' \ || skip_ 'PCRE support is compiled out, or it does not support properties' euro='\342\202\254 euro' printf "$euro\\n" > in || framework_failure_ # The euro sign has the unicode "Symbol" property, so this must match: LC_ALL=en_US.UTF-8 grep -P '^\p{S}' in > out || fail=1 compare in out || fail=1 # This RE must *not* match in the C locale, because the first # byte is not a "Symbol". LC_ALL=C grep -P '^\p{S}' in > out && fail=1 compare /dev/null out || fail=1 LC_ALL=en_US.UTF-8 grep -P '^. euro$' in > out2 || fail=1 compare in out2 || fail=1 LC_ALL=en_US.UTF-8 grep -oP '. euro' in > out3 || fail=1 compare in out3 || fail=1 LC_ALL=en_US.UTF-8 grep -P '^\P{S}' in > out4 compare /dev/null out4 || fail=1 Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/skip-read����������������������������������������������������������������0000775�0001750�0001750�00000001276�14670377472�017430� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Check that grep skips reading in some cases. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 echo /dev/null >exp || framework_failure_ for opts in '-m0 y' '-f /dev/null' '-v ""'; do for matcher in '' -E -F; do for file in /dev/null no-such-file; do eval returns_ 1 grep $opts $matcher no-such-file > out || fail=1 compare /dev/null out || fail=1 eval returns_ 1 grep -l $opts $matcher /dev/null > out || fail=1 compare /dev/null out || fail=1 done eval returns_ 1 grep -L $opts $matcher /dev/null > out || fail=1 compare exp out || fail=1 eval returns_ 1 grep -L $opts $matcher /dev/null > /dev/null || fail=1 done done Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/khadafy������������������������������������������������������������������0000775�0001750�0001750�00000001270�14670377471�017151� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Regression test for GNU grep. # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # The Khadafy test is brought to you by Scott Anderson . . . grep -E -f $abs_top_srcdir/tests/khadafy.regexp \ $abs_top_srcdir/tests/khadafy.lines > khadafy.out || fail=1 if cmp $abs_top_srcdir/tests/khadafy.lines khadafy.out then : else echo Khadafy test failed -- output left on khadafy.out fail=1 fi Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/dfa-infloop��������������������������������������������������������������0000775�0001750�0001750�00000000414�14670377471�017737� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would infloop for some unreleased versions between 2.26 and 2.27 . "${srcdir=.}/init.sh"; path_prepend_ ../src require_timeout_ fail=0 echo cx > in || framework_failure_ returns_ 1 timeout 10 env LC_ALL=C grep -E 'c\b[x ]' in || fail=1 Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/no-perl������������������������������������������������������������������0000664�0001750�0001750�00000000410�14670377471�017106� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Perl is not available, the test should be considered skipped. # FD 9 should have been opened by the test suite harness, pointing # to the original stderr (usually, the user's terminal). echo "test skipped: no usable version of Perl found" >&9 exit 77 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-abort���������������������������������������������������������������0000775�0001750�0001750�00000001070�14670377471�017576� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Show that grep handles PCRE's PCRE_ERROR_MATCHLIMIT. # In grep-2.8, it would abort. # # Copyright (C) 2011-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_pcre_ fail=0 echo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab > in || framework_failure_ returns_ 2 grep -P '((a+)*)+$' in > out || fail=1 compare /dev/null out || fail=1 Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/repetition-overflow������������������������������������������������������0000775�0001750�0001750�00000001152�14670377472�021565� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # These would fail (i.e., match erroneously) prior to grep-2.11. . "${srcdir=.}/init.sh"; path_prepend_ ../src xp1=4294967297 # 2^32+1 xp2=4294967298 # 2^32+2 fail=0 # Before grep-2.11, when DFA-matching, a repetition count exceeding the # range of "unsigned int" would silently wrap around. Hence, 2^32+1 # would be treated just like "1", and both of these would mistakenly match. echo abc | returns_ 2 grep -E "b{$xp1}" > out 2> /dev/null || fail=1 compare /dev/null out || fail=1 echo abbc | returns_ 2 grep -E "b{1,$xp2}" > out 2> /dev/null || fail=1 compare /dev/null out || fail=1 Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/fedora�������������������������������������������������������������������0000775�0001750�0001750�00000006005�14670377472�017004� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh . "${srcdir=.}/init.sh"; path_prepend_ ../src # GREP Regression test suite for Fedora bugs and fixes # (c) 2008 Lubomir Rintel # Licensed under the same terms as GNU Grep itself if [ -t 1 ] then # Colored output on terminal G='\033[32m' R='\033[31m' D='\033[0m' fi ok () { printf "${G}OK${D}"; } fail () { printf "${R}FAIL${D} (See ${U})"; failures=1; } U=https://bugzilla.redhat.com/show_bug.cgi?id=116909 printf "fgrep false negatives: " cat > 116909.list <<EOF a b c EOF cat > 116909.in <<EOF a barn c EOF cat > 116909.out <<EOF a c EOF grep -F -w -f 116909.list 116909.in > actual || fail compare 116909.out actual && ok || fail U=https://bugzilla.redhat.com/show_bug.cgi?id=123362 printf 'bad handling of brackets in UTF-8: ' echo Y > 123362.out echo Y | LC_ALL=de_DE.UTF-8 grep -i '[y,Y]' > actual || fail compare 123362.out actual && ok || fail U=https://bugzilla.redhat.com/show_bug.cgi?id=112869 printf 'crash with \\W: ' echo '<form>' > 112869.out LANG=it_IT grep -iE '\Wform\W' 112869.out > actual || fail compare 112869.out actual && ok || fail if ( timeout --version ) > /dev/null 2>&1; then U=https://bugzilla.redhat.com/show_bug.cgi?id=189580 printf 'grep -D skip opening a special file: ' returns_ 124 timeout 10 grep -D skip foo /dev/zero && fail || ok U=https://bugzilla.redhat.com/show_bug.cgi?id=169524 printf 'grep -Fw looping infinitely: ' echo foobar | returns_ 124 timeout 10 grep -Fw "" && fail || ok U=https://bugzilla.redhat.com/show_bug.cgi?id=140781 printf 'fgrep hangs on binary files: ' returns_ 124 timeout 10 grep -F grep "$abs_top_builddir/src/grep" \ > /dev/null && fail || ok fi U=https://bugzilla.redhat.com/show_bug.cgi?id=161700 printf 'grep -Fw fails to match anything: ' echo test > 161700.out grep -Fw test 161700.out > actual || fail compare 161700.out actual && ok || fail U=https://bugzilla.redhat.com/show_bug.cgi?id=179698 printf 'grep -w broken in non-utf8 multibyte locales: ' echo za a > 179698.out LANG=ja_JP.eucjp grep -w a 179698.out > actual || fail compare 179698.out actual && ok || fail # Skip the rest of tests in compiled without PCRE echo a |grep -P a >/dev/null || Exit $failures U=https://bugzilla.redhat.com/show_bug.cgi?id=171379 printf 'grep -P crashes on whitespace lines: ' echo ' ' > 171379.out grep -P '^\s+$' 171379.out > actual || fail compare 171379.out actual && ok || fail U=https://bugzilla.redhat.com/show_bug.cgi?id=204255 printf '%s' "-e '' does not work if not a first parameter: " echo test | grep -e 'HighlightThis' -e '' > 204255.first echo test | grep -e '' -e 'HighlightThis' > 204255.second diff 204255.first 204255.second && ok || fail U=https://bugzilla.redhat.com/show_bug.cgi?id=324781 printf 'bad handling of line breaks with grep -P #1: ' printf 'a\na' | grep -P '[^a]' >/dev/null && fail || ok # This is mostly a check that fix for above doesn't break -P further printf '%s' "bad handling of line breaks with grep -P #2: " printf 'a\na' | grep -P '[^b].[^b]' >/dev/null && fail || ok Exit $failures ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/case-fold-backslash-w����������������������������������������������������0000775�0001750�0001750�00000001123�14670377471�021571� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # test that \W works on case-insensitive matches. It used to become \w. # Derived from https://savannah.gnu.org/bugs/?28162 . "${srcdir=.}/init.sh"; path_prepend_ ../src if echo foo bar | LANG=C.ASCII grep '^foo\W'; then echo foo bar | LANG=C.ASCII grep -i '^foo\W' || fail_ ASCII insensitive else echo foo bar | LANG=C grep '^foo\W' || fail_ LANG=C sensitive echo foo bar | LANG=C grep -i '^foo\W' || fail_ LANG=C insensitive fi echo foo bar | LANG=en_US.UTF-8 grep '^foo\W' || fail_ UTF-8 sensitive echo foo bar | LANG=en_US.UTF-8 grep -i '^foo\W' || fail_ UTF-8 insensitive ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/init.sh������������������������������������������������������������������0000664�0001750�0001750�00000054744�14670377471�017131� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# source this file; set up for tests # Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. # Using this file in a test # ========================= # # The typical skeleton of a test looks like this: # # #!/bin/sh # . "${srcdir=.}/init.sh"; path_prepend_ . # Execute some commands. # Note that these commands are executed in a subdirectory, therefore you # need to prepend "../" to relative filenames in the build directory. # Note that the "path_prepend_ ." is useful only if the body of your # test invokes programs residing in the initial directory. # For example, if the programs you want to test are in src/, and this test # script is named tests/test-1, then you would use "path_prepend_ ../src", # or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" # to all tests via automake's TESTS_ENVIRONMENT. # Set the exit code 0 for success, 77 for skipped, or 1 or other for failure. # Use the skip_ and fail_ functions to print a diagnostic and then exit # with the corresponding exit code. # Exit $? # Executing a test that uses this file # ==================================== # # Running a single test: # $ make check TESTS=test-foo.sh # # Running a single test, with verbose output: # $ make check TESTS=test-foo.sh VERBOSE=yes # # Running a single test, keeping the temporary directory: # $ make check TESTS=test-foo.sh KEEP=yes # # Running a single test, with single-stepping: # 1. Go into a sub-shell: # $ bash # 2. Set relevant environment variables from TESTS_ENVIRONMENT in the # Makefile: # $ export srcdir=../../tests # this is an example # 3. Execute the commands from the test, copy&pasting them one by one: # $ . "$srcdir/init.sh"; path_prepend_ . # ... # 4. Finally # $ exit # ============================================================================= # Elementary diagnostics ME_=`expr "./$0" : '.*/\(.*\)$'` # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi # We use a trap below for cleanup. This requires us to go through # hoops to get the right exit status transported through the handler. # So use 'Exit STATUS' instead of 'exit STATUS' inside of the tests. # Turn off errexit here so that we don't trip the bug with OSF1/Tru64 # sh inside this function. Exit () { set +e; (exit $1); exit $1; } # Print warnings (e.g., about skipped and failed tests) to this file number. # Override by defining to say, 9, in init.cfg, and putting say, # export ...ENVVAR_SETTINGS...; $(SHELL) 9>&2 # in the definition of TESTS_ENVIRONMENT in your tests/Makefile.am file. # This is useful when using automake's parallel tests mode, to print # the reason for skip/failure to console, rather than to the .log files. : ${stderr_fileno_=2} # Note that correct expansion of "$*" depends on IFS starting with ' '. # Always write the full diagnostic to stderr. # When stderr_fileno_ is not 2, also emit the first line of the # diagnostic to that file descriptor. warn_ () { # If IFS does not start with ' ', set it and emit the warning in a subshell. case $IFS in ' '*) printf '%s\n' "$*" >&2 test $stderr_fileno_ = 2 \ || { printf '%s\n' "$*" | sed 1q >&$stderr_fileno_ ; } ;; *) (IFS=' '; warn_ "$@");; esac } fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; } skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; } fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; } framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; } # ============================================================================= # Ensure the shell supports modern syntax. # Sanitize this shell to POSIX mode, if possible. DUALCASE=1; export DUALCASE if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # We require $(...) support unconditionally. # We require that the printf built-in work correctly regarding octal escapes; # this eliminates /bin/sh on AIX 7.2. # We require non-surprising "local" semantics (this eliminates dash). # This takes the admittedly draconian step of eliminating dash, because the # assignment tab=$(printf '\t') works fine, yet preceding it with "local " # transforms it into an assignment that sets the variable to the empty string. # That is too counter-intuitive, and can lead to subtle run-time malfunction. # The example below is less subtle in that with dash, it evokes the run-time # exception "dash: 1: local: 1: bad variable name". # We require a few additional shell features only when $EXEEXT is nonempty, # in order to support automatic $EXEEXT emulation: # - hyphen-containing alias names # - we prefer to use ${var#...} substitution, rather than having # to work around lack of support for that feature. # The following code attempts to find a shell with support for these features. # If the current shell passes the test, we're done. Otherwise, test other # shells until we find one that passes. If one is found, re-exec it. # If no acceptable shell is found, skip the current test. # # The "...set -x; P=1 true 2>err..." test is to disqualify any shell that # emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do. # # Use "9" to indicate success (rather than 0), in case some shell acts # like Solaris 10's /bin/sh but exits successfully instead of with status 2. # Eval this code in a subshell to determine a shell's suitability. # 10 - passes all tests; ok to use # 9 - ok, but enabling "set -x" corrupts app stderr; prefer higher score # ? - not ok gl_shell_test_script_=' test $(echo y) = y || exit 1 LC_ALL=en_US.UTF-8 printf "\\351" 2>/dev/null \ | LC_ALL=C tr "\\351" x | LC_ALL=C grep "^x$" > /dev/null \ || exit 1 printf "\\351" 2>/dev/null \ | LC_ALL=C tr "\\351" x | LC_ALL=C grep "^x$" > /dev/null \ || exit 1 f_local_() { local v=1; }; f_local_ || exit 1 f_dash_local_fail_() { local t=$(printf " 1"); }; f_dash_local_fail_ score_=10 if test "$VERBOSE" = yes; then test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9 fi test -z "$EXEEXT" && exit $score_ shopt -s expand_aliases alias a-b="echo zoo" v=abx test ${v%x} = ab \ && test ${v#a} = bx \ && test $(a-b) = zoo \ && exit $score_ ' if test "x$1" = "x--no-reexec"; then shift else # Assume a working shell. Export to subshells (setup_ needs this). gl_set_x_corrupts_stderr_=false export gl_set_x_corrupts_stderr_ # Record the first marginally acceptable shell. marginal_= # Search for a shell that meets our requirements. for re_shell_ in __current__ "${CONFIG_SHELL:-no_shell}" \ /bin/sh bash dash zsh pdksh fail do test "$re_shell_" = no_shell && continue # If we've made it all the way to the sentinel, "fail" without # finding even a marginal shell, skip this test. if test "$re_shell_" = fail; then test -z "$marginal_" && skip_ failed to find an adequate shell re_shell_=$marginal_ break fi # When testing the current shell, simply "eval" the test code. # Otherwise, run it via $re_shell_ -c ... if test "$re_shell_" = __current__; then # 'eval'ing this code makes Solaris 10's /bin/sh exit with # $? set to 2. It does not evaluate any of the code after the # "unexpected" first '('. Thus, we must run it in a subshell. ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1 else "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null fi st_=$? # $re_shell_ works just fine. Use it. if test $st_ = 10; then gl_set_x_corrupts_stderr_=false break fi # If this is our first marginally acceptable shell, remember it. if test "$st_:$marginal_" = 9: ; then marginal_="$re_shell_" gl_set_x_corrupts_stderr_=true fi done if test "$re_shell_" != __current__; then # Found a usable shell. Preserve -v and -x. case $- in *v*x* | *x*v*) opts_=-vx ;; *v*) opts_=-v ;; *x*) opts_=-x ;; *) opts_= ;; esac re_shell=$re_shell_ export re_shell exec "$re_shell_" $opts_ "$0" --no-reexec "$@" echo "$ME_: exec failed" 1>&2 exit 127 fi fi # ============================================================================= # Ensure the shell behaves reasonably. # If this is bash, turn off all aliases. test -n "$BASH_VERSION" && unalias -a # Note that when supporting $EXEEXT (transparently mapping from PROG_NAME to # PROG_NAME.exe), we want to support hyphen-containing names like test-acos. # That is part of the shell-selection test above. Why use aliases rather # than functions? Because support for hyphen-containing aliases is more # widespread than that for hyphen-containing function names. test -n "$EXEEXT" && test -n "$BASH_VERSION" && shopt -s expand_aliases # ============================================================================= # Creating a temporary directory (needed by the core test framework) # Create a temporary directory, much like mktemp -d does. # Written by Jim Meyering. # # Usage: mktempd_ /tmp phoey.XXXXXXXXXX # # First, try to use the mktemp program. # Failing that, we'll roll our own mktemp-like function: # - try to get random bytes from /dev/urandom # - failing that, generate output from a combination of quickly-varying # sources and gzip. Ignore non-varying gzip header, and extract # "random" bits from there. # - given those bits, map to file-name bytes using tr, and try to create # the desired directory. # - make only $MAX_TRIES_ attempts # Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. rand_bytes_ () { n_=$1 # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first? # But if they have openssl, they probably have mktemp, too. chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 dev_rand_=/dev/urandom if test -r "$dev_rand_"; then # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194. dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \ | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ return fi n_plus_50_=`expr $n_ + 50` cmds_='date; date +%N; free; who -a; w; ps auxww; ps -ef' data_=` (eval "$cmds_") 2>&1 | gzip ` # Ensure that $data_ has length at least 50+$n_ while :; do len_=`echo "$data_"|wc -c` test $n_plus_50_ -le $len_ && break; data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip ` done echo "$data_" \ | dd bs=1 skip=50 count=$n_ 2>/dev/null \ | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ } mktempd_ () { case $# in 2);; *) fail_ "Usage: mktempd_ DIR TEMPLATE";; esac destdir_=$1 template_=$2 MAX_TRIES_=4 # Disallow any trailing slash on specified destdir: # it would subvert the post-mktemp "case"-based destdir test. case $destdir_ in / | //) destdir_slash_=$destdir;; */) fail_ "invalid destination dir: remove trailing slash(es)";; *) destdir_slash_=$destdir_/;; esac case $template_ in *XXXX) ;; *) fail_ \ "invalid template: $template_ (must have a suffix of at least 4 X's)";; esac # First, try to use mktemp. d=`unset TMPDIR; { mktemp -d -t -p "$destdir_" "$template_"; } 2>/dev/null` && # The resulting name must be in the specified directory. case $d in "$destdir_slash_"*) :;; *) false;; esac && # It must have created the directory. test -d "$d" && # It must have 0700 permissions. Handle sticky "S" bits. perms=`ls -dgo "$d" 2>/dev/null` && case $perms in drwx--[-S]---*) :;; *) false;; esac && { echo "$d" return } # If we reach this point, we'll have to create a directory manually. # Get a copy of the template without its suffix of X's. base_template_=`echo "$template_"|sed 's/XX*$//'` # Calculate how many X's we've just removed. template_length_=`echo "$template_" | wc -c` nx_=`echo "$base_template_" | wc -c` nx_=`expr $template_length_ - $nx_` err_= i_=1 while :; do X_=`rand_bytes_ $nx_` candidate_dir_="$destdir_slash_$base_template_$X_" err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \ && { echo "$candidate_dir_"; return; } test $MAX_TRIES_ -le $i_ && break; i_=`expr $i_ + 1` done fail_ "$err_" } # ============================================================================= # Core test framework # An arbitrary prefix to help distinguish test directories. testdir_prefix_ () { printf gt; } # Set up the environment for the test to run in. setup_ () { if test "$VERBOSE" = yes; then # Test whether set -x may cause the selected shell to corrupt an # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh # from SunOS 5.11, OpenBSD 4.7 and Irix 6.5. # If enabling verbose output this way would cause trouble, simply # issue a warning and refrain. if $gl_set_x_corrupts_stderr_; then warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr" else set -x fi fi initial_cwd_=$PWD # Create and enter the temporary directory. pfx_=`testdir_prefix_` test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ || fail_ "failed to create temporary directory in $initial_cwd_" cd "$test_dir_" || fail_ "failed to cd to temporary directory" # Set variables srcdir, builddir, for the convenience of the test. case $srcdir in /* | ?:*) ;; *) srcdir="../$srcdir" ;; esac builddir=".." export srcdir builddir # As autoconf-generated configure scripts do, ensure that IFS # is defined initially, so that saving and restoring $IFS works. gl_init_sh_nl_=' ' IFS=" "" $gl_init_sh_nl_" # This trap statement, along with a trap on 0 below, ensure that the # temporary directory, $test_dir_, is removed upon exit as well as # upon receipt of any of the listed signals. for sig_ in 1 2 3 13 15; do eval "trap 'Exit $(expr $sig_ + 128)' $sig_" done } # This is a stub function that is run upon trap (upon regular exit and # interrupt). Override it with a per-test function, e.g., to unmount # a partition, or to undo any other global state changes. cleanup_ () { :; } # Run the user-overridable cleanup_ function, remove the temporary # directory and exit with the incoming value of $?. remove_tmp_ () { __st=$? cleanup_ if test "$KEEP" = yes; then echo "Not removing temporary directory $test_dir_" else # cd out of the directory we're about to remove cd "$initial_cwd_" || cd / || cd /tmp chmod -R u+rwx "$test_dir_" # If removal fails and exit status was to be 0, then change it to 1. rm -rf "$test_dir_" || { test $__st = 0 && __st=1; } fi exit $__st } # ============================================================================= # Prepending directories to PATH # Given a directory name, DIR, if every entry in it that matches *.exe # contains only the specified bytes (see the case stmt below), then print # a space-separated list of those names and return 0. Otherwise, don't # print anything and return 1. Naming constraints apply also to DIR. find_exe_basenames_ () { feb_dir_=$1 feb_fail_=0 feb_result_= feb_sp_= for feb_file_ in $feb_dir_/*.exe; do # If there was no *.exe file, or there existed a file named "*.exe" that # was deleted between the above glob expansion and the existence test # below, just skip it. test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \ && continue # Exempt [.exe, since we can't create a function by that name, yet # we can't invoke [ by PATH search anyways due to shell builtins. test "x$feb_file_" = "x$feb_dir_/[.exe" && continue case $feb_file_ in *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;; *) # Remove leading file name components as well as the .exe suffix. feb_file_=${feb_file_##*/} feb_file_=${feb_file_%.exe} feb_result_="$feb_result_$feb_sp_$feb_file_";; esac feb_sp_=' ' done test $feb_fail_ = 0 && printf %s "$feb_result_" return $feb_fail_ } # Consider the files in directory, $1. # For each file name of the form PROG.exe, create an alias named # PROG that simply invokes PROG.exe, then return 0. If any selected # file name or the directory name, $1, contains an unexpected character, # define no alias and return 1. create_exe_shims_ () { case $EXEEXT in '') return 0 ;; .exe) ;; *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;; esac base_names_=`find_exe_basenames_ $1` \ || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 0; } if test -n "$base_names_"; then for base_ in $base_names_; do alias "$base_"="$base_$EXEEXT" done fi return 0 } # Use this function to prepend to PATH an absolute name for each # specified, possibly-$initial_cwd_-relative, directory. path_prepend_ () { while test $# != 0; do path_dir_=$1 case $path_dir_ in '') fail_ "invalid path dir: '$1'";; /* | ?:*) abs_path_dir_=$path_dir_;; *) abs_path_dir_=$initial_cwd_/$path_dir_;; esac case $abs_path_dir_ in *$PATH_SEPARATOR*) fail_ "invalid path dir: '$abs_path_dir_'";; esac PATH="$abs_path_dir_$PATH_SEPARATOR$PATH" # Create an alias, FOO, for each FOO.exe in this directory. create_exe_shims_ "$abs_path_dir_" \ || fail_ "something failed (above): $abs_path_dir_" shift done export PATH } # ============================================================================= # Convenience environment variables for the tests # ----------------------------------------------------------------------------- # Enable glibc's malloc-perturbing option. # This is useful for exposing code that depends on the fact that # malloc-related functions often return memory that is mostly zeroed. # If you have the time and cycles, use valgrind to do an even better job. : ${MALLOC_PERTURB_=87} export MALLOC_PERTURB_ # ----------------------------------------------------------------------------- # The interpreter for Bourne-shell scripts. # No special standards compatibility requirements. # Some environments, such as Android, don't have /bin/sh. if test -f /bin/sh$EXEEXT; then BOURNE_SHELL=/bin/sh else BOURNE_SHELL=sh fi # ============================================================================= # Convenience functions for the tests # ----------------------------------------------------------------------------- # Return value checking # This is used to simplify checking of the return value # which is useful when ensuring a command fails as desired. # I.e., just doing `command ... &&fail=1` will not catch # a segfault in command for example. With this helper you # instead check an explicit exit code like # returns_ 1 command ... || fail returns_ () { # Disable tracing so it doesn't interfere with stderr of the wrapped command { set +x; } 2>/dev/null local exp_exit="$1" shift "$@" test $? -eq $exp_exit && ret_=0 || ret_=1 if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then set -x fi { return $ret_; } 2>/dev/null } # ----------------------------------------------------------------------------- # Text file comparison # Emit a header similar to that from diff -u; Print the simulated "diff" # command so that the order of arguments is clear. Don't bother with @@ lines. emit_diff_u_header_ () { printf '%s\n' "diff -u $*" \ "--- $1 1970-01-01" \ "+++ $2 1970-01-01" } # Arrange not to let diff or cmp operate on /dev/null, # since on some systems (at least OSF/1 5.1), that doesn't work. # When there are not two arguments, or no argument is /dev/null, return 2. # When one argument is /dev/null and the other is not empty, # cat the nonempty file to stderr and return 1. # Otherwise, return 0. compare_dev_null_ () { test $# = 2 || return 2 if test "x$1" = x/dev/null; then test -s "$2" || return 0 emit_diff_u_header_ "$@"; sed 's/^/+/' "$2" return 1 fi if test "x$2" = x/dev/null; then test -s "$1" || return 0 emit_diff_u_header_ "$@"; sed 's/^/-/' "$1" return 1 fi return 2 } for diff_opt_ in -u -U3 -c '' no; do test "$diff_opt_" != no && diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" < /dev/null` && break done if test "$diff_opt_" != no; then if test -z "$diff_out_"; then compare_ () { diff $diff_opt_ "$@"; } else compare_ () { # If no differences were found, AIX and HP-UX 'diff' produce output # like "No differences encountered". Hide this output. diff $diff_opt_ "$@" > diff.out diff_status_=$? test $diff_status_ -eq 0 || cat diff.out || diff_status_=2 rm -f diff.out || diff_status_=2 return $diff_status_ } fi elif cmp -s /dev/null /dev/null 2>/dev/null; then compare_ () { cmp -s "$@"; } else compare_ () { cmp "$@"; } fi # Usage: compare EXPECTED ACTUAL # # Given compare_dev_null_'s preprocessing, defer to compare_ if 2 or more. # Otherwise, propagate $? to caller: any diffs have already been printed. compare () { # This looks like it can be factored to use a simple "case $?" # after unchecked compare_dev_null_ invocation, but that would # fail in a "set -e" environment. if compare_dev_null_ "$@"; then return 0 else case $? in 1) return 1;; *) compare_ "$@";; esac fi } # ----------------------------------------------------------------------------- # If you want to override the testdir_prefix_ function, # or to add more utility functions, use this file. test -f "$srcdir/init.cfg" \ && . "$srcdir/init.cfg" # ============================================================================= # Set up the environment for the test to run in. setup_ "$@" # This trap is here, rather than in the setup_ function, because some # shells run the exit trap at shell function exit, rather than script exit. trap remove_tmp_ 0 ����������������������������kbuild-3608/src/grep/tests/dfa-invalid-utf8���������������������������������������������������������0000775�0001750�0001750�00000001525�14670377471�020607� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test whether "grep '.'" matches invalid UTF-8 byte sequences. # # Copyright 2019-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support fail=0 printf 'a\360\202\202\254b\n' >in1 || framework_failure_ LC_ALL=en_US.UTF-8 grep 'a.b' in1 > out1 2> err test $? -eq 1 || fail=1 compare /dev/null out1 || fail=1 compare /dev/null err1 || fail=1 printf 'a\360\202\202\254ba\360\202\202\254b\n' >in2 || framework_failure_ LC_ALL=en_US.UTF-8 grep -E '(a.b)\1' in2 > out2 2> err test $? -eq 1 || fail=1 compare /dev/null out2 || fail=1 compare /dev/null err2 || fail=1 Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/triple-backref�����������������������������������������������������������0000775�0001750�0001750�00000001617�14670377472�020442� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test for a bug in glibc's regex code as of September 7, 2014. # # Copyright (C) 2014-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. # This tickles a bug in the regex code that can cause heap violations etc. # A fix would be welcome, though fixing is not trivial. See: # https://sourceware.org/bugzilla/show_bug.cgi?id=11053 . "${srcdir=.}/init.sh"; path_prepend_ ../src require_timeout_ echo a > in || framework_failure_ fail=0 # Clear this, so glibc doesn't bother to produce a core dump. MALLOC_CHECK_= warn_ "$ME_: expect malfunction on glibc systems due to" \ "https://sourceware.org/bugzilla/show_bug.cgi?id=11053" timeout 10 grep -E '(.?)(.?)(.?)\3\2\1' in > out || fail=1 compare out in || fail=1 Exit $fail �����������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/max-count-vs-context�����������������������������������������������������0000775�0001750�0001750�00000000734�14670377471�021571� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Show how -m1 works with -A N when a 2nd match is < N lines after the first . "${srcdir=.}/init.sh"; path_prepend_ ../src cat <<EOF > in || framework_failure_ needle 1st line of context 2nd line of context 3rd line of context another needle 5th line of context relative to first match 6th line... EOF sed 6q in > exp || framework_failure_ fail=0 grep -m1 -A5 needle in > out 2>err || fail=1 compare exp out || fail=1 compare /dev/null err || fail=1 Exit $fail ������������������������������������kbuild-3608/src/grep/tests/fgrep-longest������������������������������������������������������������0000775�0001750�0001750�00000001320�14670377471�020312� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # With multiple matches, grep -Fo could print a shorter one. # This bug affected grep versions 2.26 through 2.27. # # Copyright (C) 2017-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # The erroneous versions would print "c", rather than the longer match, "bce". printf 'abce\n' > in || framework_failure_ printf 'abcd\nc\nbce\n' > pat || framework_failure_ printf 'bce\n' > exp || framework_failure_ LC_ALL=C grep -Fof pat in > out || fail=1 compare exp out || fail=1 Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/bre����������������������������������������������������������������������0000775�0001750�0001750�00000001062�14670377471�016311� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Regression test for GNU grep. # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # . . . and the following by Henry Spencer. ${AWK-awk} -f $abs_top_srcdir/tests/bre.awk $abs_top_srcdir/tests/bre.tests \ > bre.script || fail=1 ${re_shell-${SHELL-sh}} ./bre.script || fail=1 Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/reversed-range-endpoints�������������������������������������������������0000775�0001750�0001750�00000000724�14670377472�022460� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Ensure that an invalid range like [b-a] evokes exit status of 2. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 printf 'grep: Invalid range end\n' > exp for prog in grep 'grep -E'; do # exit status must be 2, not 1 returns_ 2 $prog '[b-a]' < /dev/null > out 2>&1 || fail=1 # Normalize the diagnostic prefix from e.g., "/mnt/dir/grep: " to "grep: " sed 's/^[^:]*: /grep: /' out > k && mv k out compare exp out || fail=1 done Exit $fail ��������������������������������������������kbuild-3608/src/grep/tests/initial-tab��������������������������������������������������������������0000775�0001750�0001750�00000002241�14670377471�017736� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Exercise -T. # Copyright 2016-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 printf 'x\n\n' > in || framework_failure_ grep -T '^' in > out || fail=1 compare in out || fail=1 printf 'in:\tx\nin:\n' > exp || framework_failure_ grep -T '^' in /dev/null > out || fail=1 compare exp out || fail=1 printf '%s\n' a b c d e f g h i j > in1 || framework_failure_ printf 'in1: 1:\ta\n' > exp1 || framework_failure_ grep -Tn 'a' in1 /dev/null > out1 || fail=1 compare exp1 out1 || fail=1 Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/utf8-bracket�������������������������������������������������������������0000775�0001750�0001750�00000002313�14670377472�020041� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Check bracket expressions in a UTF-8 locale. # Copyright 2015-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ printf '1\n2\n' >in || framework_failure_ fail=0 for locale in C en_US.UTF-8; do for options in -qz -qzE; do case $options in *E*) parens='()';; *) parens='\(\)';; esac for pattern in '1.2' '[12].2' '[1-2].2' '[1-2][^a][1-2]'; do for suffix in '' "$parens\\1"; do LC_ALL=$locale grep $options "$pattern$suffix" in || fail=1 done done done done Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/high-bit-range�����������������������������������������������������������0000775�0001750�0001750�00000001653�14670377471�020334� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Exercise high-bit-set unibyte-in-[...]-range bug. # Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 printf '\201\n' > in || framework_failure_ grep -a "$(printf '[\201]')" in > out || fail=1 compare out in || fail=1 Exit $fail �������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/turkish-eyes�������������������������������������������������������������0000775�0001750�0001750�00000003412�14670377472�020177� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Ensure that case-insensitive matching works with all Turkish i's # Copyright (C) 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_compiled_in_MB_support fail=0 L=tr_TR.UTF-8 # Check for a broken tr_TR.UTF-8 locale definition. # In this locale, 'i' is not a lower-case 'I'. echo I | LC_ALL=$L grep -i i > /dev/null \ && skip_ "your $L locale appears to be broken" # Ensure that this matches: # printf 'I:İ ı:i\n'|LC_ALL=tr_TR.utf8 grep -i 'ı:i I:İ' I=$(printf '\304\260') # capital I with dot i=$(printf '\304\261') # lowercase dotless i data="I:$I $i:i" search_str="$i:i I:$I" printf "$data\\n" > in || framework_failure_ for opt in -E -F -G; do for pat in i I "$i" "$I" " " : "$search_str"; do LC_ALL=$L grep $opt -i "$pat" in > out || fail=1 compare in out || fail=1 case $pat in i|"$I") printf "$I\\ni\\n";; I|"$i") printf "I\\n$i\\n";; :) printf ":\\n:\\n";; ' ') printf " \\n";; *) cat in;; esac >exp || framework_failure_ LC_ALL=$L grep -o $opt -i "$pat" in > out || fail=1 compare exp out || fail=1 done done Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/backslash-s-vs-invalid-multibyte�����������������������������������������0000775�0001750�0001750�00000001165�14670377472�024027� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Ensure that neither \s nor \S matches an invalid multibyte character. # # Copyright (C) 2013-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ printf '\202\n' > in || framework_failure_ LC_ALL=en_US.UTF-8 export LC_ALL fail=0 grep '^\S$' in > out-S && fail=1 compare /dev/null out-S || fail=1 grep '^\s$' in > out-s && fail=1 compare /dev/null out-s || fail=1 Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/case-fold-backref��������������������������������������������������������0000775�0001750�0001750�00000000521�14670377471�020770� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would fail for grep-2.5.3 . "${srcdir=.}/init.sh"; path_prepend_ ../src printf '%s foo\n' foo fOo Foo FOO > exp1 || framework_failure_ fail=0 for LOC in en_US.UTF-8 en_US zh_CN $LOCALE_FR_UTF8 C; do out=out1-$LOC LC_ALL=$LOC grep -Ei '(foo) \1' exp1 > $out || fail=1 compare exp1 $out || fail=1 done Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/epipe��������������������������������������������������������������������0000775�0001750�0001750�00000001672�14670377471�016652� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Check that a write failure with errno == EPIPE # doesn't cause grep to issue multiple "write error" diagnostics. . "${srcdir=.}/init.sh"; path_prepend_ ../src if # Use awk to output a bounded amount of data to the grep in question, # so that the test doesn't loop forever if grep is buggy. # Use an explicit /dev/null for the benefit of older (pre-POSIX) awks. # # Carefully close fd 3 when not needed, as a sanity check. # # Do not use "trap - PIPE" or "trap 'something' PIPE" here, since we may # be running in an environment where SIGPIPE is ignored, and in such an # environment POSIX says that "trap '' PIPE" is all we can do portably. ( ${AWK-awk} 'BEGIN { for (i=0; i<1000000; i++) print i; }' /dev/null 3>&- | (trap '' PIPE; exec grep . 2>&3 3>&-) | : ) 3>&1 | ( read line1 && echo >&2 "$line1" && read line2 && echo >&2 "$line2" ) then fail=1 else fail=0 fi Exit $fail ����������������������������������������������������������������������kbuild-3608/src/grep/tests/spencer1.tests�����������������������������������������������������������0000664�0001750�0001750�00000004064�14670377472�020425� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������0@abc@abc 1@abc@xbc 1@abc@axc 1@abc@abx 0@abc@xabcy 0@abc@ababc 0@ab*c@abc 0@ab*bc@abc 0@ab*bc@abbc 0@ab*bc@abbbbc 0@ab+bc@abbc 1@ab+bc@abc 1@ab+bc@abq 0@ab+bc@abbbbc 0@ab?bc@abbc 0@ab?bc@abc 1@ab?bc@abbbbc 0@ab?c@abc 0@^abc$@abc 1@^abc$@abcc 0@^abc@abcc 1@^abc$@aabc 0@abc$@aabc 0@^@abc 0@$@abc 0@a.c@abc 0@a.c@axc 0@a.*c@axyzc 1@a.*c@axyzd 1@a[bc]d@abc 0@a[bc]d@abd 1@a[b-d]e@abd 0@a[b-d]e@ace 0@a[b-d]@aac 0@a[-b]@a- 0@a[b-]@a- 2@a[b-a]@- 2@a[]b@- 2@a[@- 0@a]@a] 0@a[]]b@a]b 0@a[^bc]d@aed 1@a[^bc]d@abd 0@a[^-b]c@adc 1@a[^-b]c@a-c 1@a[^]b]c@a]c 0@a[^]b]c@adc 0@ab|cd@abc 0@ab|cd@abcd 0@()ef@def 0@()*@- 1@*a@- 0@^*@- 0@$*@- 2@(*)b@-@TO CORRECT 1@$b@b 2@a\@- 0@a\(b@a(b 0@a\(*b@ab 0@a\(*b@a((b 1@a\x@a\x 1@abc)@- 2@(abc@- 0@((a))@abc 0@(a)b(c)@abc 0@a+b+c@aabbabc 0@a**@- 0@a*?@- 0@(a*)*@- 0@(a*)+@- 0@(a|)*@- 0@(a*|b)*@- 0@(a+|b)*@ab 0@(a+|b)+@ab 0@(a+|b)?@ab 0@[^ab]*@cde 0@(^)*@- 0@(ab|)*@- 2@)(@- 1@abc@ 1@abc@ 0@a*@ 0@([abc])*d@abbbcd 0@([abc])*bcd@abcd 0@a|b|c|d|e@e 0@(a|b|c|d|e)f@ef 0@((a*|b))*@- 0@abcd*efg@abcdefg 0@ab*@xabyabbbz 0@ab*@xayabbbz 0@(ab|cd)e@abcde 0@[abhgefdc]ij@hij 1@^(ab|cd)e@abcde 0@(abc|)ef@abcdef 0@(a|b)c*d@abcd 0@(ab|ab*)bc@abc 0@a([bc]*)c*@abc 0@a([bc]*)(c*d)@abcd 0@a([bc]+)(c*d)@abcd 0@a([bc]*)(c+d)@abcd 0@a[bcd]*dcdcde@adcdcde 1@a[bcd]+dcdcde@adcdcde 0@(ab|a)b*c@abc 0@((a)(b)c)(d)@abcd 0@[A-Za-z_][A-Za-z0-9_]*@alpha 0@^a(bc+|b[eh])g|.h$@abh 0@(bc+d$|ef*g.|h?i(j|k))@effgz 0@(bc+d$|ef*g.|h?i(j|k))@ij 1@(bc+d$|ef*g.|h?i(j|k))@effg 1@(bc+d$|ef*g.|h?i(j|k))@bcdd 0@(bc+d$|ef*g.|h?i(j|k))@reffgz 1@((((((((((a))))))))))@- 0@(((((((((a)))))))))@a 0@ca{0,0}b@cb 1@ca{0,0}b@cab 0@ca{0,1}b@cb 0@ca{0,1}b@cab 1@ca{0,1}b@caab 1@ca{1,2}b@cb 0@ca{1,2}b@cab 0@ca{1,2}b@caab 1@ca{1,2}b@caaab 1@multiple words of text@uh-uh 0@multiple words@multiple words, yeah 0@(.*)c(.*)@abcde 1@\((.*),@(.*)\) 1@[k]@ab 0@abcd@abcd 0@a(bc)d@abcd 0@a[-]?c@ac 0@a[]?c@ac 0@(....).*\1@beriberi 0@(^|\B)a@abc 0@(^|\B)a@xyzabc 1@(^|\B)a@xyz abc 0@^a|\Ba@abc 0@^a|\Ba@xyzabc 1@^a|\Ba@xyz abc 0@(^|\>)a@abc 1@(^|\>)a@xyzabc 1@(^|\>)a@xyz abc 0@^a|\>a@abc 1@^a|\>a@xyzabc 1@^a|\>a@xyz abc ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/spencer1�����������������������������������������������������������������0000775�0001750�0001750�00000001102�14670377472�017255� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Regression test for GNU grep. # Copyright (C) 1988 Henry Spencer. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # . . . and the following by Henry Spencer. ${AWK-awk} -f $abs_top_srcdir/tests/spencer1.awk \ $abs_top_srcdir/tests/spencer1.tests > spencer1.script || fail=1 . ./spencer1.script || fail=1 Exit 1 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/help-version�������������������������������������������������������������0000775�0001750�0001750�00000020241�14670377472�020155� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Make sure all of these programs work properly # when invoked with --help or --version. # Copyright (C) 2000-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src # Terminate any background processes cleanup_() { kill $pid 2>/dev/null && wait $pid; } expected_failure_status_chroot=125 expected_failure_status_env=125 expected_failure_status_nice=125 expected_failure_status_nohup=125 expected_failure_status_stdbuf=125 expected_failure_status_timeout=125 expected_failure_status_printenv=2 expected_failure_status_tty=3 expected_failure_status_sort=2 expected_failure_status_expr=3 expected_failure_status_lbracket=2 expected_failure_status_dir=2 expected_failure_status_ls=2 expected_failure_status_vdir=2 expected_failure_status_cmp=2 expected_failure_status_zcmp=2 expected_failure_status_sdiff=2 expected_failure_status_diff3=2 expected_failure_status_diff=2 expected_failure_status_zdiff=2 expected_failure_status_zgrep=2 expected_failure_status_zegrep=2 expected_failure_status_zfgrep=2 expected_failure_status_grep=2 expected_failure_status_egrep=2 expected_failure_status_fgrep=2 test "$built_programs" \ || fail_ "built_programs not specified!?!" test "$VERSION" \ || fail_ "set envvar VERSION; it is required for a PATH sanity-check" # Extract version from --version output of the first program for i in $built_programs; do v=$(env $i --version | sed -n '1s/.* //p;q') break done # Ensure that it matches $VERSION. test "x$v" = "x$VERSION" \ || fail_ "--version-\$VERSION mismatch" for lang in C fr da; do for i in $built_programs; do # Skip 'test'; it doesn't accept --help or --version. test $i = test && continue # false fails even when invoked with --help or --version. # true and false are tested with these options separately. test $i = false || test $i = true && continue # The just-built install executable is always named 'ginstall'. test $i = install && i=ginstall # Make sure they exit successfully, under normal conditions. env $i --help > h-$i || fail=1 env $i --version >/dev/null || fail=1 # Make sure they mention the bug-reporting address in --help output. grep "$PACKAGE_BUGREPORT" h-$i > /dev/null || fail=1 rm -f h-$i # Make sure they fail upon 'disk full' error. if test -w /dev/full && test -c /dev/full; then test $i = [ && prog=lbracket || prog=$(echo $i|sed "s/$EXEEXT$//") eval "expected=\$expected_failure_status_$prog" test x$expected = x && expected=1 returns_ $expected env $i --help >/dev/full 2>/dev/null && returns_ $expected env $i --version >/dev/full 2>/dev/null || { fail=1 env $i --help >/dev/full 2>/dev/null status=$? echo "*** $i: bad exit status '$status' (expected $expected)," 1>&2 echo " with --help or --version output redirected to /dev/full" 1>&2 } fi done done bigZ_in=bigZ-in.Z zin=zin.gz zin2=zin2.gz tmp=tmp-$$ tmp_in=in-$$ tmp_in2=in2-$$ tmp_dir=dir-$$ tmp_out=out-$$ mkdir $tmp || fail=1 cd $tmp || fail=1 comm_setup () { args="$tmp_in $tmp_in"; } csplit_setup () { args="$tmp_in //"; } cut_setup () { args='-f 1'; } join_setup () { args="$tmp_in $tmp_in"; } tr_setup () { args='a a'; } chmod_setup () { args="a+x $tmp_in"; } # Punt on these. chgrp_setup () { args=--version; } chown_setup () { args=--version; } mkfifo_setup () { args=--version; } mknod_setup () { args=--version; } # Punt on uptime, since it fails (e.g., failing to get boot time) # on some systems, and we shouldn't let that stop 'make check'. uptime_setup () { args=--version; } # Create a file in the current directory, not in $TMPDIR. mktemp_setup () { args=mktemp.XXXX; } cmp_setup () { args="$tmp_in $tmp_in2"; } # Tell dd not to print the line with transfer rate and total. # The transfer rate would vary between runs. dd_setup () { args=status=noxfer; } zdiff_setup () { args="$zin $zin2"; } zcmp_setup () { args="$zin $zin2"; } zcat_setup () { args=$zin; } gunzip_setup () { args=$zin; } zmore_setup () { args=$zin; } zless_setup () { args=$zin; } znew_setup () { args=$bigZ_in; } zforce_setup () { args=$zin; } zgrep_setup () { args="z $zin"; } zegrep_setup () { args="z $zin"; } zfgrep_setup () { args="z $zin"; } gzexe_setup () { args=$tmp_in; } # We know that $tmp_in contains a "0" grep_setup () { args="0 $tmp_in"; } egrep_setup () { args="0 $tmp_in"; } fgrep_setup () { args="0 $tmp_in"; } diff_setup () { args="$tmp_in $tmp_in2"; } sdiff_setup () { args="$tmp_in $tmp_in2"; } diff3_setup () { args="$tmp_in $tmp_in2 $tmp_in2"; } cp_setup () { args="$tmp_in $tmp_in2"; } ln_setup () { args="$tmp_in ln-target"; } ginstall_setup () { args="$tmp_in $tmp_in2"; } mv_setup () { args="$tmp_in $tmp_in2"; } mkdir_setup () { args=$tmp_dir/subdir; } realpath_setup () { args=$tmp_in; } rmdir_setup () { args=$tmp_dir; } rm_setup () { args=$tmp_in; } shred_setup () { args=$tmp_in; } touch_setup () { args=$tmp_in2; } truncate_setup () { args="--reference=$tmp_in $tmp_in2"; } mkid_setup () { printf 'f(){}\ntypedef int t;\n' > f.c; args=. ; } lid_setup () { args=; } fid_setup () { args=f.c; } fnid_setup () { args=; } xtokid_setup () { args=; } aid_setup () { args=f; } eid_setup () { args=--version; } gid_setup () { args=f; } defid_setup () { args=t; } basename_setup () { args=$tmp_in; } dirname_setup () { args=$tmp_in; } expr_setup () { args=foo; } # Punt, in case GNU 'id' hasn't been installed yet. groups_setup () { args=--version; } pathchk_setup () { args=$tmp_in; } yes_setup () { args=--version; } logname_setup () { args=--version; } nohup_setup () { args=--version; } printf_setup () { args=foo; } seq_setup () { args=10; } sleep_setup () { args=0; } stdbuf_setup () { args="-oL true"; } timeout_setup () { args=--version; } # I'd rather not run sync, since it spins up disks that I've # deliberately caused to spin down (but not unmounted). sync_setup () { args=--version; } test_setup () { args=foo; } # This is necessary in the unusual event that there is # no valid entry in /etc/mtab. df_setup () { args=/; } # This is necessary in the unusual event that getpwuid (getuid ()) fails. id_setup () { args=-u; } # Use env to avoid invoking built-in sleep of Solaris 11's /bin/sh. kill_setup () { external=env $external sleep 10m & pid=$! args=$pid } link_setup () { args="$tmp_in link-target"; } unlink_setup () { args=$tmp_in; } readlink_setup () { ln -s . slink args=slink; } stat_setup () { args=$tmp_in; } unlink_setup () { args=$tmp_in; } lbracket_setup () { args=": ]"; } parted_setup () { args="-s $tmp_in mklabel gpt" dd if=/dev/null of=$tmp_in seek=2000; } # Ensure that each program "works" (exits successfully) when doing # something more than --help or --version. for i in $built_programs; do # Skip these. case $i in chroot|stty|tty|false|chcon|runcon|coreutils) continue;; esac rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out $bigZ_in $zin $zin2 echo z |gzip > $zin cp $zin $zin2 cp $zin $bigZ_in # This is sort of kludgey: use numbers so this is valid input for factor, # and two tokens so it's valid input for tsort. echo 2147483647 0 > $tmp_in # Make $tmp_in2 identical. Then, using $tmp_in and $tmp_in2 as arguments # to the likes of cmp and diff makes them exit successfully. cp $tmp_in $tmp_in2 mkdir $tmp_dir # echo ================== $i test $i = [ && prog=lbracket || prog=$(echo $i|sed "s/$EXEEXT$//") if type ${prog}_setup > /dev/null 2>&1; then ${prog}_setup else args= fi if env $i $args < $tmp_in > $tmp_out; then : # ok else echo FAIL: $i fail=1 fi rm -rf $tmp_in $tmp_in2 $tmp_out $tmp_dir done Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/backref������������������������������������������������������������������0000775�0001750�0001750�00000002374�14670377471�017145� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test for back-references and other things. # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src failures=0 # checking for a palindrome echo "radar" | grep -e '\(.\)\(.\).\2\1' > /dev/null 2>&1 if test $? -ne 0 ; then echo "Backref: palindrome, test #1 failed" failures=1 fi # hit hard with the 'Bond' tests # For now, remove the '?' in the last parentheses, so that new glibc can do it. # --Stepan echo "civic" \ | grep -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\9\8\7\6\5\4\3\2\1$' \ > /dev/null 2>&1 if test $? -ne 0 ; then echo "Options: Bond, test #2 failed" failures=1 fi # backref are local should be error echo "123" | grep -e 'a\(.\)' -e 'b\1' > /dev/null 2>&1 if test $? -ne 2 ; then echo "Backref: Backref not local, test #3 failed" failures=1 fi # Pattern should fail echo "123" | grep -e '[' -e ']' > /dev/null 2>&1 if test $? -ne 2 ; then echo "Backref: Compiled not local, test #4 failed" failures=1 fi Exit $failures ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/fmbtest������������������������������������������������������������������0000775�0001750�0001750�00000006377�14670377471�017223� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src cz=cs_CZ.UTF-8 # If cs_CZ.UTF-8 locale doesn't work, skip this test. LC_ALL=$cz locale -k LC_CTYPE 2>/dev/null | grep -q charmap.*UTF-8 \ || skip_ this system lacks the $cz locale # If matching is done in single-byte mode, skip this test too printf 'é\n' | LC_ALL=$cz grep -Eq '^[é]{2}$' case $? in 0) skip_ "built without multi-byte support";; 1) ;; *) fail_ "unexpected exit status: $?";; esac failures=0 cat > csinput <<EOF 01 ŽluÅ¥ouÄká Äíše ČíŠE 02 03 Z Äíší ÄŒiší cosi 04 Čí Å e 05 06 ČČČČČČČíšČÃÅ Äíš 07 ČČČ ČČČČíšČÃÅ ÄíšEEEE ÄAs 08 09ÄŒapka 10ÄŒaSy se mÄ›nà ČÃÅ¡E11 ÄŒas12 ð‡•ÄŒÃÅ¡Eð‡“13 ŽČÃÅ¡Eð‡“14 ð‡•ÄŒÃÅ¡EŽ15 ŽČÃÅ¡EŽ16 ÄŒÃÅ¡Eð‡“17 ÄŒÃÅ¡EŽ18 19ð‡•ÄŒÃÅ¡e 20ŽČÃÅ¡e EOF cat > cspatfile <<EOF ÄŒÃÅ¡E ÄŒas EOF for mode in F G E; do test1=$(echo $(LC_ALL=$cz grep -${mode} -f cspatfile csinput | tr -cs '0-9' '[ *]')) if test "$test1" != "11 12 13 14 15 16 17 18"; then echo "Test #1 ${mode} failed: $test1" failures=1 fi test2=$(echo $(LC_ALL=$cz grep -${mode}i -f cspatfile csinput | tr -cs '0-9' '[ *]')) if test "$test2" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then echo "Test #2 ${mode} failed: $test2" failures=1 fi test3=$(echo $(LC_ALL=$cz grep -${mode}i -e 'ÄŒÃÅ¡E' -e 'ÄŒas' csinput | tr -cs '0-9' '[ *]')) if test "$test3" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then echo "Test #3 ${mode} failed: $test3" failures=1 fi # Skip the next test - known to fail. TAA. #test4=$(echo $(LC_ALL=$cz; export LC_ALL # grep -${mode}iw -f cspatfile csinput | # sed 's/[^0123456789]/ /g')) #if test "$test4" != "01 02 08 13 17 19"; then # echo "Test #4 ${mode} failed: $test4" # failures=1 #fi # Test that --color=always does not depend on individual pattern order # within the pattern list, and that a longer match is preferred to a # shorter one starting at the same point. test6="$(echo 'Cosi tu ÄŒiÅ¡Ã...' \ | LC_ALL=$cz grep --color=always -${mode}i -e 'ÄiÅ¡' -e 'Äiší')" if echo "$test6" \ | LC_ALL=C grep -q 'Cosi tu .*\[.*m\(.\[K\)\?ÄŒiÅ¡Ã.*\[.*m\(.\[K\)\?\.\.\.'; \ then : else echo "Test #6 ${mode} failed: $test6" failures=1 fi # Test that --color=always does not depend on individual pattern order # within the pattern list, and that a longer match is preferred to a # shorter one starting at the same point. test7="$(echo 'Cosi tu ÄŒiÅ¡Ã...' \ | LC_ALL=$cz grep --color=always -${mode}i -e 'Äiší' -e 'ÄiÅ¡')" if echo "$test7" \ | LC_ALL=C grep -q 'Cosi tu .*\[.*m\(.\[K\)\?ÄŒiÅ¡Ã.*\[.*m\(.\[K\)\?\.\.\.'; \ then : else echo "Test #7 ${mode} failed: $test7" failures=1 fi done for mode in G E; do test8=$(echo $(LC_ALL=$cz grep -${mode}i -e 'ÄŒ.Å¡E' -e 'ÄŒ[a-f]s' csinput | tr -cs '0-9' '[ *]')) if test "$test8" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then echo "Test #8 ${mode} failed: $test8" failures=1 fi done Exit $failures �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/grep-dev-null-out��������������������������������������������������������0000775�0001750�0001750�00000000410�14670377471�021023� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Outputting to /dev/null. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_timeout_ ${AWK-awk} 'BEGIN {while (1) print "x"}' </dev/null | returns_ 124 timeout 10 grep x >/dev/null || fail=1 echo abc | grep b >>/dev/null || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/status�������������������������������������������������������������������0000775�0001750�0001750�00000004247�14670377472�017075� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test for status code for GNU grep. # status code # 0 match found # 1 no match # 2 file not found # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # should return 0 found a match echo "abcd" | grep -E -e 'abc' > /dev/null 2>&1 if test $? -ne 0 ; then echo "Status: Wrong status code, test \#1 failed" fail=1 fi # should return 1 found no match echo "abcd" | grep -E -e 'zbc' > /dev/null 2>&1 if test $? -ne 1 ; then echo "Status: Wrong status code, test \#2 failed" fail=1 fi # the filename MMMMMMMM.MMM should not exist hopefully if test -r MMMMMMMM.MMM; then echo "Please remove MMMMMMMM.MMM to run check" else # should return 2 file not found grep -E -e 'abc' MMMMMMMM.MMM > /dev/null 2>&1 if test $? -ne 2 ; then echo "Status: Wrong status code, test \#3 failed" fail=1 fi # should return 2 file not found grep -E -s -e 'abc' MMMMMMMM.MMM > /dev/null 2>&1 if test $? -ne 2 ; then echo "Status: Wrong status code, test \#4 failed" fail=1 fi # should return 0 (found a match) or 2 (file not found) echo "abcd" | grep -E -s 'abc' - MMMMMMMM.MMM > /dev/null 2>&1 status=$? if test $status -ne 0 && test $status -ne 2 ; then echo "Status: Wrong status code, test \#5 failed" fail=1 fi # should return 0 found a match echo "abcd" | grep -E -q -s 'abc' MMMMMMMM.MMM - > /dev/null 2>&1 if test $? -ne 0 ; then echo "Status: Wrong status code, test \#6 failed" fail=1 fi # should still return 0 found a match echo "abcd" | grep -E -q 'abc' MMMMMMMM.MMM - > /dev/null 2>&1 if test $? -ne 0 ; then echo "Status: Wrong status code, test \#7 failed" fail=1 fi fi Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/CuSkip.pm����������������������������������������������������������������0000664�0001750�0001750�00000002304�14670377471�017347� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package CuSkip; # Skip a test: emit diag to log and to stderr, and exit 77 # Copyright (C) 2011-2015, 2017-2021 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 <https://www.gnu.org/licenses/>. use strict; use warnings; our $ME = $0 || "<???>"; # Emit a diagnostic both to stderr and to $stderr_fileno_. # FIXME: don't hard-code that value (9), since it's already defined in init.cfg. sub skip ($) { my ($msg) = @_; my $stderr_fileno_ = 9; warn $msg; open FH, ">&$stderr_fileno_" or warn "$ME: failed to dup stderr\n"; print FH $msg; close FH or warn "$ME: failed to close FD $stderr_fileno_\n"; exit 77; } 1; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/case-fold-char-class�����������������������������������������������������0000775�0001750�0001750�00000001032�14670377471�021411� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would fail for grep-2.5.3 . "${srcdir=.}/init.sh"; path_prepend_ ../src printf 'Y\n' > exp1 || framework_failure_ fail=0 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do out=out1-$LOC printf 'X\nY\nZ\n' | LC_ALL=$LOC grep -i '[y]' > $out || fail=1 compare exp1 $out || fail=1 done printf 'y\n' > exp2 || framework_failure_ for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do out=out2-$LOC printf 'x\ny\nz\n' | LC_ALL=$LOC grep -i '[Y]' > $out || fail=1 compare exp2 $out || fail=1 done Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-w�������������������������������������������������������������������0000775�0001750�0001750�00000001425�14670377471�016741� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Before grep-2.19, grep -Pw %% would match %% enclosed in word boundaries # # Copyright (C) 2014-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_pcre_ fail=0 echo %aa% > in || framework_failure_ grep -Pw aa in > out || fail=1 compare out in || fail=1 echo a%%a > in || framework_failure_ grep -Pw %% in > out && fail=1 compare /dev/null out || fail=1 echo %%%% > in || framework_failure_ grep -Pw %% in > out || fail=1 compare out in || fail=1 echo %% > in || framework_failure_ grep -Pw %% in > out || fail=1 compare out in || fail=1 Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/turkish-I-without-dot����������������������������������������������������0000775�0001750�0001750�00000003433�14670377472�021712� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # grep -i would misbehave for any matched line containing a character # (like "I" in the tr_TR.utf8 locale) whose lower-case representation # occupies more bytes (two in this case, for 0xc4b1, aka U+0131). # Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_tr_utf8_locale_ require_compiled_in_MB_support # Before this change, grep could print a lot of uninitialized memory: # $ printf "IIIIIII\n" > in # $ for i in $(seq 10); do LC_ALL=tr_TR.utf8 src/grep -i . in|wc -c; done # 760 # 754 # 585 # 298 # 273 # 458 # 660 # 552 # 936 # 678 fail=0 printf "IIIIIII\n" > in || framework_failure_ LC_ALL=tr_TR.utf8 grep -i .... in > out || fail=1 compare out in || fail=1 # Also exercise the case in which the original string and the lower-case # buffer have precisely the same length (22 bytes here), yet internal # offsets do differ. Lengths are the same because while some bytes shrink # when converted to lower case, others grow, and here they balance out. i='I\304\260' printf "$i$i$i$i$i$i$i\n" > in || framework_failure_ LC_ALL=tr_TR.utf8 grep -i .... in > out || fail=1 compare out in || fail=1 Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/dfa-coverage�������������������������������������������������������������0000775�0001750�0001750�00000001757�14670377471�020077� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Exercise the final reachable code in dfa.c's match_mb_charset. # Copyright (C) 2012-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support fail=0 echo a > in || framework_failure_ LC_ALL=en_US.UTF-8 grep -E '[^_]|$' in > out || fail=1 compare out in || fail=1 Exit $fail �����������������kbuild-3608/src/grep/tests/options������������������������������������������������������������������0000775�0001750�0001750�00000002617�14670377472�017244� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test for POSIX options for grep # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. # # grep [ -E| -F][ -c| -l| -q ][-insvx] -e pattern_list # [-f pattern_file] ... [file. ..] # grep [ -E| -F][ -c| -l| -q ][-insvx][-e pattern_list] # -f pattern_file ... [file ...] # grep [ -E| -F][ -c| -l| -q ][-insvx] pattern_list [file...] . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # checking for -E extended regex echo "abababccccccd" | grep -E -e 'c{3}' > /dev/null 2>&1 if test $? -ne 0 ; then echo "Options: Wrong status code, test #1 failed" fail=1 fi # checking for basic regex echo "abababccccccd" | grep -G -e 'c\{3\}' > /dev/null 2>&1 if test $? -ne 0 ; then echo "Options: Wrong status code, test #2 failed" fail=1 fi # checking for fixed string echo "abababccccccd" | grep -F -e 'c\{3\}' > /dev/null 2>&1 if test $? -ne 1 ; then echo "Options: Wrong status code, test #3 failed" fail=1 fi # checking for multiple -e options; see: # https://bugs.gnu.org/21670 echo abchelloabc | grep -e '^hello' -e 'hello$' > /dev/null 2>&1 if test $? -ne 1 ; then echo "Options: Wrong status code, test #4 failed" fail=1 fi Exit $fail �����������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/empty-line���������������������������������������������������������������0000775�0001750�0001750�00000001733�14670377471�017631� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test that the empty pattern matches everything. # Some of these tests failed in grep 2.18. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 printf 'abc\n' >in || framework_failure_ nl=' ' for opt in '' -E -F; do case $opt in '') prefix='\(\)\1';; -E) prefix='()\1';; -F) prefix="foo$nl";; esac for pattern in "" "$nl" "---$nl" "${nl}foo"; do for pat in "$pattern" "$prefix$pattern"; do grep $opt -e "$pat" in >out || fail=1 compare in out || fail=1 printf -- '%s\n' "$pat" >pat || framework_failure_ grep $opt -f pat in >out || fail=1 compare in out || fail=1 # Check that pattern files that end in non-newlines # are treated as if a newline were appended. case $pattern in '' | *"$nl") ;; *) printf -- '%s' "$pat" >pat || framework_failure_ grep $opt -f pat in >out || fail=1 compare in out || fail=1;; esac done done done Exit $fail �������������������������������������kbuild-3608/src/grep/tests/foad1��������������������������������������������������������������������0000775�0001750�0001750�00000022371�14670377471�016541� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test various combinations of command-line options. # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. # # This set of tests was started by Julian Foad. . "${srcdir=.}/init.sh"; path_prepend_ ../src failures=0 # grep_test INPUT EXPECTED_OUTPUT PATTERN_AND_OPTIONS... # Run "grep" with the given INPUT, pattern and options, and check that # the output is EXPECTED_OUTPUT. If not, print a message and set 'failures'. # "/" represents a newline within INPUT and EXPECTED_OUTPUT. grep_test () { INPUT="$1" EXPECT="$2" shift 2 OUTPUT=$(printf %s "$INPUT" | tr "/" "\n" | grep "$@" | tr "\n" "/") if test "$OUTPUT" != "$EXPECT" || test "$VERBOSE" = "yes"; then echo "Testing: grep $@" test "$LC_ALL" != C && test "$LC_ALL" != "" && echo " LC_ALL: \"$LC_ALL\"" echo " input: \"$INPUT\"" echo " output: \"$OUTPUT\"" fi if test "$OUTPUT" != "$EXPECT"; then echo " expect: \"$EXPECT\"" echo "FAIL" failures=1 fi } # Test "--only-matching" ("-o") option # "-o" with "-i" should output an exact copy of the matching input text. grep_test "WordA/wordB/WORDC/" "Word/word/WORD/" "word" -o -i grep_test "WordA/wordB/WORDC/" "Word/word/WORD/" "Word" -o -i grep_test "WordA/wordB/WORDC/" "Word/word/WORD/" "WORD" -o -i # Should display the line number (-n), octet offset (-b), or file name # (-H) of every match, not just of the first match on each input line. # Check it both with and without -i because of the separate code paths. # Also check what it does when lines of context are specified. grep_test "wA wB/wC/" "1:wA/1:wB/2:wC/" "w." -o -n grep_test "wA wB/wC/" "1:wA/1:wB/2:wC/" "w." -o -n -i grep_test "wA wB/wC/" "1:wA/1:wB/2:wC/" "w." -o -n -3 2>/dev/null grep_test "XwA YwB/ZwC/" "1:wA/5:wB/9:wC/" "w." -o -b grep_test "XwA YwB/ZwC/" "1:wA/5:wB/9:wC/" "w." -o -b -i grep_test "XwA YwB/ZwC/" "1:wA/5:wB/9:wC/" "w." -o -b -3 2>/dev/null grep_test "XwA YwB/ZwC/" "1:w/5:w/9:w/" "w" -F -o -b grep_test "XwA YwB/ZwC/" "1:w/5:w/9:w/" "w" -F -o -b -i grep_test "XwA YwB/ZwC/" "1:w/5:w/9:w/" "w" -F -o -b -3 2>/dev/null grep_test "wA wB/" "(standard input):wA/(standard input):wB/" "w." -o -H grep_test "wA wB/" "(standard input):wA/(standard input):wB/" "w." -o -H -i grep_test "wA wB/" "(standard input):wA/(standard input):wB/" "w." -o -H -3 2>/dev/null # Combination of -h and -H grep_test "wA wB/" "wA wB/" "w." grep_test "wA wB/" "wA wB/" "w." -h grep_test "wA wB/" "wA wB/" "w." -H -h grep_test "wA wB/" "(standard input):wA wB/" "w." -H grep_test "wA wB/" "(standard input):wA wB/" "w." -h -H # End of a previous match should not match a "start of ..." expression. grep_test "word_word/" "word_/" "^word_*" -o grep_test "wordword/" "word/" "\<word" -o # Test "--color" option CB="" CE="" # "--color" with "-i" should output an exact copy of the matching input text. grep_test "WordA/wordb/WORDC/" "${CB}Word${CE}A/${CB}word${CE}b/${CB}WORD${CE}C/" "word" --color=always -i grep_test "WordA/wordb/WORDC/" "${CB}Word${CE}A/${CB}word${CE}b/${CB}WORD${CE}C/" "Word" --color=always -i grep_test "WordA/wordb/WORDC/" "${CB}Word${CE}A/${CB}word${CE}b/${CB}WORD${CE}C/" "WORD" --color=always -i # End of a previous match should not match a "start of ..." expression. grep_test "word_word/" "${CB}word_${CE}word/" "^word_*" --color=always grep_test "wordword/" "${CB}word${CE}word/" "\<word" --color=always # Test combination of "-m" with "-A" and anchors. # Based on a report from Pavol Gono. grep_test "4/40/" "4/40/" "^4$" -m1 -A99 grep_test "4/04/" "4/04/" "^4$" -m1 -A99 grep_test "4/444/" "4/444/" "^4$" -m1 -A99 grep_test "4/40/" "4/40/" "^4" -m1 -A99 grep_test "4/04/" "4/04/" "^4" -m1 -A99 grep_test "4/444/" "4/444/" "^4" -m1 -A99 grep_test "4/40/" "4/40/" "4$" -m1 -A99 grep_test "4/04/" "4/04/" "4$" -m1 -A99 grep_test "4/444/" "4/444/" "4$" -m1 -A99 # Test for "-F -w" bugs. Thanks to Gordon Lack for these two. grep_test "A/CX/B/C/" "A/B/C/" -wF -e A -e B -e C grep_test "LIN7C 55327/" "" -wF -e 5327 -e 5532 # Test for non-empty matches following empty ones. grep_test 'xyz/' 'y/' -o 'y*' grep_test 'xyz/' "x${CB}y${CE}z/" --color=always 'y*' # Test for increasing/decreasing-length word matches, # for independence from pattern order within the pattern list, # and for preferring the longest match at a given position. x0='a bb ccc dddd/' x1='dddd ccc bb a/' x2='bcd abcd abc bc bcd abc/' x3='bc abcd bc/' y0="a ${CB}bb${CE} ${CB}ccc${CE} dddd/" y1="dddd ${CB}ccc${CE} ${CB}bb${CE} a/" y2="bcd abcd abc ${CB}bc${CE} bcd abc/" y3="${CB}bc${CE} abcd ${CB}bc${CE}/" grep_test "$x0" "$y0" -E --color=always -e bb -e cc -e ccc grep_test "$x0" "$y0" -F --color=always -e bb -e cc -e ccc grep_test "$x0" "$y0" -E --color=always -e bb -e ccc -e cc grep_test "$x0" "$y0" -F --color=always -e bb -e ccc -e cc grep_test "$x0" "$y0" -E -w --color=always -e bb -e ccc grep_test "$x0" "$y0" -F -w --color=always -e bb -e ccc grep_test "$x0" "$y0" -E -w --color=always -e ccc -e bb grep_test "$x0" "$y0" -F -w --color=always -e ccc -e bb grep_test "$x1" "$y1" -E -w --color=always -e bb -e ccc grep_test "$x1" "$y1" -F -w --color=always -e bb -e ccc grep_test "$x1" "$y1" -E -w --color=always -e ccc -e bb grep_test "$x1" "$y1" -F -w --color=always -e ccc -e bb grep_test "$x2" "$y2" -E -w --color=always bc grep_test "$x2" "$y2" -F -w --color=always bc grep_test "$x3" "$y3" -E -w --color=always bc grep_test "$x3" "$y3" -F -w --color=always bc # Bug#25655 grep_test .tar/ .tar/ -e '\.tar' -e '\.tbz' grep_test .tar/ .tar/ -o -e '\.tar' -e 'tar' grep_test '$*.[^\/' '$*.[^\/' -o -e '\$\*\.\[\^\\' -e abc grep_test '$*.[^\/(+?{|/' '$*.[^\/(+?{|/' -o -E \ -e '\$\*\.\[\^\\' -e '\(\+\?\{\|' # Skip the rest of the tests - known to fail. TAA. Exit $failures # The rest of this file is meant to be executed under this locale. LC_ALL=cs_CZ.UTF-8; export LC_ALL # If the UTF-8 locale doesn't work, skip these tests silently. locale -k LC_CTYPE 2>/dev/null | grep -q "charmap.*UTF-8" || Exit $failures # Test character class erroneously matching a '[' character. grep_test "[/" "" "[[:alpha:]]" -E for mode in F G E; do # Hint: pipe the output of these tests in # "| LESS= LESSCHARSET=ascii less". # LETTER N WITH TILDE is U+00F1 and U+00D1. # LETTER Y WITH DIAERESIS is U+00FF and U+0178. grep_test 'añÿb/AÑŸB/' 'ñÿ/ÑŸ/' 'ñÿ' -o -i -$mode grep_test 'añÿb/AÑŸB/' 'ñÿ/ÑŸ/' 'ÑŸ' -o -i -$mode grep_test 'añÿb/AÑŸB/' "a${CB}ñÿ${CE}b/A${CB}ÑŸ${CE}B/" 'ñÿ' --color=always -i -$mode grep_test 'añÿb/AÑŸB/' "a${CB}ñÿ${CE}b/A${CB}ÑŸ${CE}B/" 'ÑŸ' --color=always -i -$mode # POSIX (about -i): ... each character in the string is matched # against the pattern, not only the character, but also its case # counterpart (if any), shall be matched. # The following were chosen because of their trickiness due to the # differing UTF-8 octet length of their counterpart and to the # non-reflexivity of their mapping. # Beware of homographs! Look carefully at the actual octets. # lc(U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE) = U+0069 LATIN SMALL LETTER I grep_test 'aİb/' "a${CB}İ${CE}b/" 'i' --color=always -i -$mode grep_test 'aib/' '' 'İ' --color=always -i -$mode grep_test 'aİb/' '' 'I' --color=always -i -$mode # uc(U+0131 LATIN SMALL LETTER DOTLESS I) = U+0049 LATIN CAPITAL LETTER I grep_test 'aıb/' "a${CB}ı${CE}b/" 'I' --color=always -i -$mode grep_test 'aIb/' '' 'ı' --color=always -i -$mode grep_test 'aıb/' '' 'i' --color=always -i -$mode # uc(U+017F LATIN SMALL LETTER LONG S) = U+0053 LATIN CAPITAL LETTER S grep_test 'aÅ¿b/' "a${CB}Å¿${CE}b/" 'S' --color=always -i -$mode grep_test 'aSb/' '' 'Å¿' --color=always -i -$mode grep_test 'aÅ¿b/' '' 's' --color=always -i -$mode # uc(U+1FBE GREEK PROSGEGRAMMENI) = U+0399 GREEK CAPITAL LETTER IOTA grep_test 'aá¾¾b/' "a${CB}á¾¾${CE}b/" 'Ι' --color=always -i -$mode grep_test 'aΙb/' '' 'á¾¾' --color=always -i -$mode grep_test 'aá¾¾b/' '' 'ι' --color=always -i -$mode # lc(U+2126 OHM SIGN) = U+03C9 GREEK SMALL LETTER OMEGA grep_test 'aΩb/' "a${CB}Ω${CE}b/" 'ω' --color=always -i -$mode grep_test 'aωb/' '' 'Ω' --color=always -i -$mode grep_test 'aΩb/' '' 'Ω' --color=always -i -$mode # lc(U+212A KELVIN SIGN) = U+006B LATIN SMALL LETTER K grep_test 'aKb/' "a${CB}K${CE}b/" 'k' --color=always -i -$mode grep_test 'akb/' '' 'K' --color=always -i -$mode grep_test 'aKb/' '' 'K' --color=always -i -$mode # lc(U+212B ANGSTROM SIGN) = U+00E5 LATIN SMALL LETTER A WITH RING ABOVE grep_test 'aâ„«b/' "a${CB}â„«${CE}b/" 'Ã¥' --color=always -i -$mode grep_test 'aÃ¥b/' '' 'â„«' --color=always -i -$mode grep_test 'aâ„«b/' '' 'Ã…' --color=always -i -$mode done # Any tests inserted right here will be performed under an UTF-8 locale. # Insert them before LC_ALL is set above to avoid this. # Leave this comment last. Exit $failures �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/prefix-of-multibyte������������������������������������������������������0000775�0001750�0001750�00000002113�14670377472�021453� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would mistakenly print a line prior to grep-2.18. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support encode() { echo "$1" | tr ABC '\357\274\241'; } encode ABC >exp1 encode aABC >exp2 encode ABCABC >exp3 encode _____________________ABCABC___ >exp4 fail=0 for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do for pat in A aA BCA; do for file in exp1 exp2 exp3 exp4; do for type in regex dfa fgrep; do case $type in dfa) opt= prefix= ;; fgrep) opt=-F prefix= ;; regex) opt= prefix='\(\)\1' ;; esac pattern=$prefix$(encode $pat) out=out-$type-$LOC LC_ALL=$LOC grep $opt "$pattern" $file >$out status=$? echo $status >$out.status if test $status -eq 0; then compare $file $out elif test $status -eq 1; then compare_dev_null_ /dev/null $out else test $status -eq 2 fi || fail=1 compare out-regex-$LOC.status $out.status || fail=1 done done done done Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/posix-bracket������������������������������������������������������������0000775�0001750�0001750�00000002167�14670377472�020324� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Check various bracket expressions in the POSIX locale. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src LC_ALL=C export LC_ALL fail=0 echo a >in || framework_failure_ for bracketed in '[.a.]' '[.a.]-a' 'a-[.a.]' '[.a.]-[.a.]' \ '[=a=]' '[:alpha:]' 'a-a[.-.]--'; do grep "[$bracketed]" in >out || fail=1 compare in out || fail=1 grep "[^$bracketed]" in >out test $? -eq 1 || fail=1 compare /dev/null out || fail=1 done Exit $fail ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/grep-dir�����������������������������������������������������������������0000775�0001750�0001750�00000001474�14670377471�017261� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Case-insensitive grep with a 0-size input file would fail in grep up to 2.6.3 . "${srcdir=.}/init.sh"; path_prepend_ ../src mkdir a || framework_failure # Lower and upper bound of valid exit status for "grep -f DIR", # when reading from empty and nonempty files, respectively. if cat a >acopy 2>&1 && cmp a acopy; then l=1 u=1 L=0 U=1 else l=2 u=127 L=2 U=127 fi status_range () { status=$? { test $1 -le $status && test $status -le $2; } || fail=1 } echo x | grep -f a/; status_range $L $U echo x | grep -if a/; status_range $L $U echo x | grep -Ff a/; status_range $L $U echo x | grep -Fif a/; status_range $L $U grep -f a/ < /dev/null; status_range $l $u grep -if a/ < /dev/null; status_range $l $u grep -Ff a/ < /dev/null; status_range $l $u grep -Fif a/ < /dev/null; status_range $l $u Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/invalid-multibyte-infloop������������������������������������������������0000775�0001750�0001750�00000001352�14670377472�022652� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Ensure that we don't trigger a grep -F infloop. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support require_timeout_ encode() { echo "$1" | tr A '\202'; } encode AA > input fail=0 # Before 2.15, this would infloop. LC_ALL=en_US.UTF-8 timeout 10 grep -aF $(encode A) input > out status=$? if test $status -eq 0; then compare input out elif test $status -eq 1; then compare_dev_null_ /dev/null out else test $status -eq 2 fi || fail=1 LC_ALL=en_US.UTF-8 timeout 10 grep -F $(encode A) input > out status=$? if test $status -eq 0; then compare /dev/null out elif test $status -eq 1; then compare_dev_null_ /dev/null out else test $status -eq 2 fi || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/big-hole�����������������������������������������������������������������0000775�0001750�0001750�00000001763�14670377471�017237� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Check that grep --binary-file=without-match quickly skips files with holes. . "${srcdir=.}/init.sh"; path_prepend_ ../src expensive_ # Skip this test if there is no usable SEEK_HOLE support, # as is the case with linux-3.5.0 on ext4 and tmpfs file systems. $PERL -e '$f=*STDERR; sysseek($f,2**22,0); syswrite($f,"a");' \ -e 'exit ("0 but true" ne sysseek($f,0,4))' 2> seek-hole-test \ || skip_ "this system/FS lacks SEEK_HOLE support" # Try to make this test not THAT expensive, on typical hosts. virtual_memory_KiB=10240 if echo x | (ulimit -v $virtual_memory_KiB && grep x) >/dev/null 2>&1; then ulimit -v $virtual_memory_KiB fi # Create a file that starts with at least a buffer's worth of text, # but has a big hole later. (${AWK-awk} 'BEGIN{ for (i=0;i<1000;i++) printf "%080d\n", 0 }' < /dev/null echo x | dd bs=1024k seek=8000000 ) >8T-or-so || skip_ 'cannot create big sparse file' grep --binary-file=without-match x 8T-or-so >/dev/null test $? -eq 1 || fail=1 Exit $fail �������������kbuild-3608/src/grep/tests/empty��������������������������������������������������������������������0000775�0001750�0001750�00000005155�14670377472�016707� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # test that the empty file means no pattern # and an empty pattern means match all. # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_timeout_ failures=0 for locale in C en_US.UTF-8; do for options in '-E' '-F'; do # should return 0 found a match echo "" | LC_ALL=$locale timeout 10s grep $options -e '' if test $? -ne 0 ; then echo "Status: Wrong status code, test \#1 failed ($options $locale)" failures=1 fi # should return 1 found no match echo abcd | LC_ALL=$locale timeout 10s grep $options -f /dev/null if test $? -ne 1 ; then echo "Status: Wrong status code, test \#2 failed ($options $locale)" failures=1 fi # should return 0 found a match echo abcd \ | LC_ALL=$locale timeout 10s grep $options -f /dev/null -e abcd if test $? -ne 0 ; then echo "Status: Wrong status code, test \#3 failed ($options $locale)" failures=1 fi # should return 0 found a match echo "" | LC_ALL=$locale timeout 10s grep $options -e '' if test $? -ne 0 ; then echo "Status: Wrong status code, test \#4 failed ($options $locale)" failures=1 fi # should return 0 found a match echo abcd | LC_ALL=$locale timeout 10s grep $options -e '' if test $? -ne 0 ; then echo "Status: Wrong status code, test \#5 failed ($options $locale)" failures=1 fi done for options in '-E -w' '-E -x' '-E -w -x' '-F -w' '-F -x' '-F -w -x'; do # should return 0 found a match echo "" | LC_ALL=$locale timeout 10s grep $options -e '' if test $? -ne 0 ; then echo "Status: Wrong status code, test \#6 failed ($options $locale)" failures=1 fi # should return 1 found no match echo abcd | LC_ALL=$locale timeout 10s grep $options -f /dev/null if test $? -ne 1 ; then echo "Status: Wrong status code, test \#7 failed ($options $locale)" failures=1 fi # should return 1 found no match echo abcd | LC_ALL=$locale timeout 10s grep $options -f /dev/null -e "" if test $? -ne 1 ; then echo "Status: Wrong status code, test \#8 failed ($options $locale)" failures=1 fi done done Exit $failures �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/turkish-I����������������������������������������������������������������0000775�0001750�0001750�00000002032�14670377472�017417� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # grep -i in UTF-8: missing NL in output on line containing I WITH DOT (U+0130) # Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support fail=0 i='\304\260' printf "$i$i$i$i$i$i$i\n" > in || framework_failure_ LC_ALL=en_US.UTF-8 grep -i .... in > out || fail=1 compare out in || fail=1 Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/surrogate-pair�����������������������������������������������������������0000775�0001750�0001750�00000003617�14670377472�020516� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Check the handling of characters outside the Unicode BMP. # Copyright (C) 2013-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support fail=0 s_pair=$(printf '\360\220\220\205') printf '%s\n' "$s_pair" > in || framework_failure_ LC_ALL=en_US.UTF-8 export LC_ALL # On Cygwin, before grep-2.15, this would segfault. # Require not just non-zero exit status, but exactly 1. returns_ 1 grep -i anything-else in > out 2>&1 || fail=1 # Expect no output. compare /dev/null out || fail=1 # This must always match, even on a 16-bit-wchar_t system. grep . in > out 2> err || fail=1 # On platforms where wchar_t is only 16 bits, wchar_t cannot represent # the character encoded in 'in'. # On such old systems the above prints nothing on stdout and a diagnostic # on stderr. In that case, return early; otherwise, the following tests # would all fail. io_pair=$(cat out):$(cat err) case $io_pair in :'grep: in: binary file matches') Exit $fail;; $s_pair:) ;; *) fail_ "unexpected output: $io_pair"; fail=1;; esac # Also test whether a surrogate-pair in the search string works. for opt in '' -i -E -F -iE -iF; do grep --file=in $opt in > out 2>&1 || fail=1 compare out in || fail=1 done Exit $fail �����������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/ere����������������������������������������������������������������������0000775�0001750�0001750�00000001056�14670377471�016317� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Regression test for GNU grep. # # Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 # . . . and the following by Henry Spencer. ${AWK-awk} -f $abs_top_srcdir/tests/ere.awk $abs_top_srcdir/tests/ere.tests \ > ere.script || fail=1 ${re_shell-${SHELL-sh}} ere.script || fail=1 Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/case-fold-char-type������������������������������������������������������0000775�0001750�0001750�00000001052�14670377471�021267� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would fail for grep-2.5.3 . "${srcdir=.}/init.sh"; path_prepend_ ../src printf 'Y\n' > exp1 || framework_failure_ fail=0 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do out=out1-$LOC printf '1\nY\n.\n' | LC_ALL=$LOC grep -i '[[:lower:]]' > $out || fail=1 compare exp1 $out || fail=1 done printf 'y\n' > exp2 || framework_failure_ for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do out=out2-$LOC printf '1\ny\n.\n' | LC_ALL=$LOC grep -i '[[:upper:]]' > $out || fail=1 compare exp2 $out || fail=1 done Exit $fail ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/case-fold-titlecase������������������������������������������������������0000775�0001750�0001750�00000011341�14670377471�021352� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Check that case folding works even with titlecase and similarly odd chars. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support LC_ALL=en_US.UTF-8 export LC_ALL fail=0 for testcase in \ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 do case $testcase in 0) a='\302\265' # U+00B5 b='\316\234' # U+039C c='\316\274' # U+03BC ;; 1) a='\111' # U+0049 b='\151' # U+0069 c='\304\260' # U+0130 ;; 2) a='\111' # U+0049 b='\151' # U+0069 c='\304\261' # U+0131 ;; 3) a='\123' # U+0053 b='\163' # U+0073 c='\305\277' # U+017F ;; 4) a='\307\204' # U+01C4 b='\307\205' # U+01C5 c='\307\206' # U+01C6 ;; 5) a='\307\207' # U+01C7 b='\307\210' # U+01C8 c='\307\211' # U+01C9 ;; 6) a='\307\212' # U+01CA b='\307\213' # U+01CB c='\307\214' # U+01CC ;; 7) a='\307\261' # U+01F1 b='\307\262' # U+01F2 c='\307\263' # U+01F3 ;; 8) a='\315\205' # U+0345 b='\316\231' # U+0399 c='\316\271' # U+03B9 ;; 9) a='\316\243' # U+03A3 b='\317\202' # U+03C2 c='\317\203' # U+03C3 ;; 10) a='\316\222' # U+0392 b='\316\262' # U+03B2 c='\317\220' # U+03D0 ;; 11) a='\316\230' # U+0398 b='\316\270' # U+03B8 c='\317\221' # U+03D1 ;; 12) a='\316\246' # U+03A6 b='\317\206' # U+03C6 c='\317\225' # U+03D5 ;; 13) a='\316\240' # U+03A0 b='\317\200' # U+03C0 c='\317\226' # U+03D6 ;; 14) a='\316\232' # U+039A b='\316\272' # U+03BA c='\317\260' # U+03F0 ;; 15) a='\316\241' # U+03A1 b='\317\201' # U+03C1 c='\317\261' # U+03F1 ;; 16) a='\316\230' # U+0398 b='\316\270' # U+03B8 c='\317\264' # U+03F4 ;; 17) a='\316\225' # U+0395 b='\316\265' # U+03B5 c='\317\265' # U+03F5 ;; 18) a='\341\271\240' # U+1E60 b='\341\271\241' # U+1E61 c='\341\272\233' # U+1E9B ;; 19) a='\303\237' # U+00DF b='\303\237' # U+00DF c='\341\272\236' # U+1E9E ;; 20) a='\316\231' # U+0399 b='\316\271' # U+03B9 c='\341\276\276' # U+1FBE ;; 21) a='\316\251' # U+03A9 b='\317\211' # U+03C9 c='\342\204\246' # U+2126 ;; 22) a='\113' # U+004B b='\153' # U+006B c='\342\204\252' # U+212A ;; 23) a='\303\205' # U+00C5 b='\303\245' # U+00E5 c='\342\204\253' # U+212B ;; 24) a='\316\243' # U+03A3 b='\317\203' # U+03C3 c='\317\262' # U+03F2 ;; esac printf "$a\\n$b\\n$c\\n" >in || framework_failure_ for pattern in "$a" "$b" "$c"; do pat=$(printf "$pattern\\n") || framework_failure_ grep -i "\\(\\)\\1$pat" in >out-regex || fail=1 grep -i "$pat" in >out-dfa || fail=1 compare_ out-regex out-dfa || fail=1 grep -iF "$pat" in >out-fixed || fail=1 compare_ out-regex out-fixed || fail=1 done done # Try a unibyte test with ISO 8859-7, if available. if test "$(get-mb-cur-max el_GR.iso88597)" -eq 1; then LC_ALL=el_GR.iso88597 export LC_ALL a='\323' # SIGMA b='\362' # stigma c='\363' # sigma printf "$a\\n$b\\n$c\\n" >in || framework_failure_ for pattern in "$a" "$b" "$c"; do pat=$(printf "$pattern\\n") || framework_failure_ grep -i "\\(\\)\\1$pat" in >out-regex || fail=1 grep -i "$pat" in >out-dfa || fail=1 compare_ out-regex out-dfa || fail=1 grep -iF "$pat" in >out-fixed || fail=1 compare_ out-regex out-fixed || fail=1 done fi Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/word-multi-file����������������������������������������������������������0000775�0001750�0001750�00000001160�14670377472�020561� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # exercise the -w option on multiple files # Derived from https://bugzilla.redhat.com/570500 . "${srcdir=.}/init.sh"; path_prepend_ ../src mkdir a || framework_failure_ ( cd a \ && echo aa bb cc > 1 \ && echo bb dd ff > 2 \ && echo ff gg hh > 3 \ && echo bb xx zz > 4 \ ) || framework_failure_ cat << \EOF > exp1 || framework_failure_ a/1:aa bb cc a/2:bb dd ff a/4:bb xx zz EOF sed s/..// exp1 > exp2 || framework_failure_ fail=0 grep -rw bb a > out || fail=1 sort < out > k; mv k out compare exp1 out || fail=1 (cd a && grep -w bb [1-4]) > out || fail=1 compare exp2 out || fail=1 Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/filename-lineno.pl�������������������������������������������������������0000775�0001750�0001750�00000010401�14670377472�021213� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/perl # Prior to 2.26, an invalid regexp in a -f-specified file would elicit # a diagnostic like "Unmatched [ or [^", with no indication of the # file or line number from which the offending regular expression came. # With 2.26, now, each such diagnostic has a "FILENAME:LINENO: " prefix. # Copyright (C) 2016-2021 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 <https://www.gnu.org/licenses/>. use strict; (my $program_name = $0) =~ s|.*/||; my $prog = 'grep'; my $full_prog_name = `$prog --no-such-option 2>&1`; $full_prog_name =~ s/:.*//s; $prog = $full_prog_name if $full_prog_name; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; # There are at least two variants of one diagnostic: # - Unmatched [, [^, [:, [., or [= # - Unmatched [ or [^ # Transform each to this: "Unmatched [..." my $err_subst = {ERR_SUBST => 's/(: Unmatched \[).*/$1.../'}; my $no_pcre = "$prog: Perl matching not supported in a --disable-perl-regexp build\n"; my @Tests = ( # Show that grep now includes filename:lineno in the diagnostic: ['invalid-re', '-f g', {AUX=>{g=>"1\n2\n3\n4[[\n"}}, {EXIT=>2}, $err_subst, {ERR => "$prog: g:4: Unmatched [...\n"}, ], # Show that with two or more errors, grep now prints all diagnostics: ['invalid-re-2-files', '-f g -f h', {EXIT=>2}, {AUX=>{g=>"1\n2[[\n3\n4[[\n"}}, {AUX=>{h=>"5\n6\n7[[\n"}}, $err_subst, {ERR => "$prog: g:2: Unmatched [...\n" . "$prog: g:4: Unmatched [...\n" . "$prog: h:3: Unmatched [...\n" }, ], # Like the above, but on the other lines. ['invalid-re-2-files2', '-f g -f h', {EXIT=>2}, {AUX=>{g=>"1[[\n2\n3[[\n4\n"}}, {AUX=>{h=>"5[[\n6[[\n7\n"}}, $err_subst, {ERR => "$prog: g:1: Unmatched [...\n" . "$prog: g:3: Unmatched [...\n" . "$prog: h:1: Unmatched [...\n" . "$prog: h:2: Unmatched [...\n" }, ], # Make sure the line numbers are right when some regexps are duplicates. ['invalid-re-line-numbers', '-f g -f h', {EXIT=>2}, {AUX=>{g=>"1[[\n\n3[[\n\n5[[\n"}}, {AUX=>{h=>"1[[\n\n\n4[[\n\n6[[\n"}}, $err_subst, {ERR => "$prog: g:1: Unmatched [...\n" . "$prog: g:3: Unmatched [...\n" . "$prog: g:5: Unmatched [...\n" . "$prog: h:4: Unmatched [...\n" . "$prog: h:6: Unmatched [...\n" }, ], # Show that with two '-e'-specified erroneous regexps, # there is no file name or line number. ['invalid-re-2e', '-e "1[[" -e "2[["', {EXIT=>2}, $err_subst, {ERR => "$prog: Unmatched [...\n" x 2}, ], # Test unmatched ) as well. It is OK with -E and an error with -G and -P. ['invalid-re-E-paren', '-E ")"', {IN=>''}, {EXIT=>1}], ['invalid-re-E-star-paren', '-E ".*)"', {IN=>''}, {EXIT=>1}], ['invalid-re-G-paren', '-G "\\)"', {EXIT=>2}, {ERR => "$prog: Unmatched ) or \\)\n"}, ], ['invalid-re-G-star-paren', '-G "a.*\\)"', {EXIT=>2}, {ERR => "$prog: Unmatched ) or \\)\n"}, ], ['invalid-re-P-paren', '-P ")"', {EXIT=>2}, {ERR => $ENV{PCRE_WORKS} == 1 ? "$prog: unmatched parentheses\n" : $no_pcre }, ], ['invalid-re-P-star-paren', '-P "a.*)"', {EXIT=>2}, {ERR => $ENV{PCRE_WORKS} == 1 ? "$prog: unmatched parentheses\n" : $no_pcre }, ], # Prior to grep-3.6, the name of the offending file was not printed. ['backtracking-with-file', '-P "((a+)*)+$"', {EXIT=>2}, {IN=>{f=>"a"x20 ."b"}}, {ERR => $ENV{PCRE_WORKS} == 1 ? "$prog: f: exceeded PCRE's backtracking limit\n" : $no_pcre }, ], ); my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); exit $fail; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-wx-backref����������������������������������������������������������0000775�0001750�0001750�00000001345�14670377472�020526� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Before grep-2.19, grep -P and -w/-x would not work with a back-reference. # # Copyright (C) 2014-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_pcre_ echo aa > in || framework_failure_ echo 'grep: reference to non-existent subpattern' > exp-err \ || framework_failure_ fail=0 for xw in x w; do grep -P$xw '(.)\1' in > out 2>&1 || fail=1 compare out in || fail=1 grep -P$xw '(.)\2' in > out 2> err && fail=1 compare /dev/null out || fail=1 compare exp-err err || fail=1 done Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/CuTmpdir.pm��������������������������������������������������������������0000664�0001750�0001750�00000004777�14670377471�017720� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package CuTmpdir; # create, then chdir into a temporary sub-directory # Copyright (C) 2007-2015, 2017-2021 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 <https://www.gnu.org/licenses/>. use strict; use warnings; use File::Temp; use File::Find; our $ME = $0 || "<???>"; my $dir; sub skip_test($) { warn "$ME: skipping test: unsafe working directory name: '$_[0]'\n"; exit 77; } sub chmod_1 { my $name = $_; # Skip symlinks and non-directories. -l $name || !-d _ and return; chmod 0700, $name; } sub chmod_tree { # When tempdir fails, it croaks, which leaves $dir undefined. defined $dir or return; # Perform the equivalent of find "$dir" -type d -print0|xargs -0 chmod -R 700. my $options = {untaint => 1, wanted => \&chmod_1}; find ($options, $dir); } sub import { my $prefix = $_[1]; $ME eq '-' && defined $prefix and $ME = $prefix; if ($prefix !~ /^\//) { eval 'use Cwd'; my $cwd = $@ ? '.' : Cwd::getcwd(); $prefix = "$cwd/$prefix"; } # Untaint for the upcoming mkdir. $prefix =~ m!^([-+\@\w./]+)$! or skip_test $prefix; $prefix = $1; my $original_pid = $$; my $on_sig_remove_tmpdir = sub { my ($sig) = @_; if ($$ == $original_pid and defined $dir) { chmod_tree; # Older versions of File::Temp lack this method. exists &File::Temp::cleanup and &File::Temp::cleanup; } $SIG{$sig} = 'DEFAULT'; kill $sig, $$; }; foreach my $sig (qw (INT TERM HUP)) { $SIG{$sig} = $on_sig_remove_tmpdir; } $dir = File::Temp::tempdir("$prefix.tmp-XXXX", CLEANUP => 1 ); chdir $dir or warn "$ME: failed to chdir to $dir: $!\n"; } END { # Move cwd out of the directory we're about to remove. # This is required on some systems, and by some versions of File::Temp. chdir '..' or warn "$ME: failed to chdir to .. from $dir: $!\n"; my $saved_errno = $?; chmod_tree; $? = $saved_errno; } 1; �kbuild-3608/src/grep/tests/spencer1.awk�������������������������������������������������������������0000664�0001750�0001750�00000001417�14670377472�020044� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 1988 Henry Spencer. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. BEGIN { FS = "@"; printf ("failures=0\n"); } $0 !~ /^#/ && NF == 3 { # printf ("status=$(echo '%s'| { grep -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; })\n",$3, $2); printf ("status=$(echo '%s'| { grep -E -e '%s' >/dev/null 2>&1 ; echo $?; })\n",$3, $2); printf ("if test $status -ne %s ; then\n", $1); printf ("\techo Spencer test \\#%d failed\n", ++n); printf ("\tfailures=1\n"); printf ("fi\n"); } END { printf ("exit $failures\n"); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/c-locale�����������������������������������������������������������������0000775�0001750�0001750�00000001114�14670377472�017217� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Regression test for GNU grep. # # Copyright 2016-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src fail=0 c=1 while test $c -lt 256; do tr2=$(printf '\\%o\n' $c) echo X | tr X "$tr2" >in if test $(wc -l <in) -eq 1; then grep . in >out || fail=1 compare in out || fail=1 fi test $fail -ne 0 && Exit $fail c=$(expr $c + 1) done Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/unibyte-negated-circumflex�����������������������������������������������0000775�0001750�0001750�00000001655�14670377472�022775� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Exercise a bug where [^^-^] was treated as if it were [^-^]. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_unibyte_locale fail=0 echo a >in || framework_failure_ grep '[^^-^]' in >out || fail=1 compare out in || fail=1 Exit $fail �����������������������������������������������������������������������������������kbuild-3608/src/grep/tests/write-error-msg����������������������������������������������������������0000775�0001750�0001750�00000003460�14670377472�020613� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # Ensure that output errors are reported with errno information. # Copyright 2016-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src test -e /dev/full || skip_ your system lacks /dev/full export LC_ALL=C # generate large input, filling the libc stdio buffers # and triggering a write(2) even without line buffering. yes 12345 | head -n 50000 > in || framework_failure_ fail=0 # disk-full error, line buffered # (note: GNU grep returns 2 on error) returns_ 2 grep --line-buffered -v '^$' <in >/dev/full 2>err1 \ || framework_failure_ # disk-full error, unbuffered # (note: GNU grep returns 2 on error) returns_ 2 grep -v '^$' <in >/dev/full 2>err2 \ || framework_failure_ # ensure each error message file contains a 'write error' with additional text for f in err1 err2 ; do grep -Eiq '^[^:]*: write error: [a-z]+' $f \ || { warn_ "incorrect/missing error message in file $f" compare /dev/null $f # print the content in the logs fail=1 } done # These messages should be identical compare err1 err2 \ || { warn_ "err1,err2 contain different error messages" ; fail=1 ; } Exit $fail ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/pcre-infloop�������������������������������������������������������������0000775�0001750�0001750�00000002223�14670377471�020136� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # With some versions of libpcre, apparently including 8.35, # the following would trigger an infinite loop in its match function. # Copyright 2014-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_timeout_ require_en_utf8_locale_ require_compiled_in_MB_support LC_ALL=en_US.UTF-8 require_pcre_ printf 'a\201b\r' > in || framework_failure_ fail=0 returns_ 1 env LC_ALL=en_US.UTF-8 timeout 10 grep -P 'a.?..b' in \ || fail_ "libpcre's match function appears to infloop" Exit $fail �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/spencer1-locale.awk������������������������������������������������������0000664�0001750�0001750�00000001641�14670377472�021300� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 1988 Henry Spencer. # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. BEGIN { FS = "@"; printf ("failures=0\n"); } $0 !~ /^#/ && NF == 3 { test("en_US.UTF-8") test("ru_RU.KOI8-R") test("fr_FR.ISO-8859-1") test("zh_CN") if (extra_locale != "") { test(extra_locale) } } function test(locale) { printf ("status=$(echo '%s'| { LC_ALL=%s grep -E -e '%s' >/dev/null 2>&1 ; echo $?; })\n",$3, locale, $2); printf ("if test $status -ne %s ; then\n", $1); printf ("\techo Spencer test \\#%d failed \\(%s\\)\n", ++n, locale); printf ("\tfailures=1\n"); printf ("fi\n"); } END { printf ("exit $failures\n"); } �����������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/ere.awk������������������������������������������������������������������0000664�0001750�0001750�00000002167�14670377472�017102� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. BEGIN { FS="@"; n = 0; printf ("# Generated Spencer ERE Test\n"); printf ("failures=0\n"); } $0 ~ /^#/ { next; } NF == 3 { # printf ("status=$(echo '%s' | { grep -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; })\n",$3, $2); printf ("status=$(echo '%s' | { grep -E -e '%s' > /dev/null 2>&1; echo $?; })\n",$3, $2); printf ("if test $status -ne %s ; then\n", $1); printf ("\techo Spencer ere test \\#%d failed\n", ++n); printf ("\tfailures=1\n"); printf ("fi\n"); } NF == 4 { # don't alarm the user for now # printf ("echo '%s'|grep -E -e '%s' > /dev/null 2>&1\n",$3, $2); # printf ("if test $? -ne %s ; then\n", $1); # printf ("\techo Expected non conformance \\#%d ... continuing\n", ++n); # printf ("fi\n"); } NF == 5 { # don't alarm the user for now next; } END { printf ("exit $failures\n"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/multibyte-white-space����������������������������������������������������0000775�0001750�0001750�00000007046�14670377472�021777� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Test whether \s matches SP and UTF-8 multi-byte white space characters. # # Copyright (C) 2013-2021 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ LC_ALL=en_US.UTF-8 export LC_ALL # It would have been nice to be able to use all UTF8 characters # with the Unicode WSpace=Y character property, # https://en.wikipedia.org/wiki/Whitespace_character, but that # would currently cause distracting failures everywhere I've tried. # Instead, I've listed each with an indicator column, telling what # this test should do if the system's locale/tools produce the # wrong answer. # The values in that column: # X required on all systems (fail if \s or \S fail to work as expected) # x required on "modern enough" systems # O optional: \s or \S misbehavior elicits a warning, but never failure utf8_space_characters=$(sed 's/.*: *//;s/ */\\x/g' <<\EOF U+0009 Horizontal Tab: X 09 U+000A Line feed: O 0a U+000B Vertical Tab: X 0b U+000C Form feed: X 0c U+000D Carriage return: X 0d U+0020 SPACE: X 20 U+0085 Next line: O 85 U+00A0 NO-BREAK SPACE: O c2 a0 U+1680 OGHAM SPACE MARK: x e1 9a 80 U+2000 EN QUAD: x e2 80 80 U+2001 EM QUAD: x e2 80 81 U+2002 EN SPACE: x e2 80 82 U+2003 EM SPACE: x e2 80 83 U+2004 THREE-PER-EM SPACE: x e2 80 84 U+2005 FOUR-PER-EM SPACE: x e2 80 85 U+2006 SIX-PER-EM SPACE: x e2 80 86 U+2007 FIGURE SPACE: O e2 80 87 U+2008 PUNCTUATION SPACE: x e2 80 88 U+2009 THIN SPACE: x e2 80 89 U+200A HAIR SPACE: x e2 80 8a U+200B ZERO WIDTH SPACE: O e2 80 8b U+202F NARROW NO-BREAK SPACE: O e2 80 af U+205F MEDIUM MATHEMATICAL SPACE: x e2 81 9f U+3000 IDEOGRAPHIC SPACE: x e3 80 80 EOF ) fail=0 # On systems that are not "modern enough," simply warn when an "x"-marked # character is not classified as white space. Too many systems # have inadequate UTF-8 tables in this respect, and that lack should not # discourage/confuse those who consider whether to install grep. # As for what constitutes "modern enough", I've arbitrarily started # with "Fedora 20 or newer". Tested additions welcome. modern_enough=0 grep -iE 'fedora release [2-9][0-9]+\b' /etc/redhat-release >/dev/null 2>&1 \ && modern_enough=1 for i in $utf8_space_characters; do eval 'fail() { fail=1; }' m=ERROR case $i in X*) ;; x*) test $modern_enough = 1 || { eval 'fail() { :; }'; m=warning; } ;; O*) m=warning; eval 'fail() { :; }' ;; *) warn_ "unexpected prefix: $i"; exit 1 ;; esac # Strip the prefix byte. i=${i#?} hex_printf_ "$i" | grep -q '^\s$' \ || { warn_ " $m: \\s failed to match $i in the $LC_ALL locale"; fail; } hex_printf_ "$i" | returns_ 1 grep -q '\S' \ || { warn_ " $m: \\S mistakenly matched $i in the $LC_ALL locale"; fail; } done # This is a separate test, only nominally related to \s. # It is solely to get coverage of a code path (exercising dfa.c's # match_mb_charset function) that would have otherwise been untouched. # However, as of the change-set adding this new test, match_mb_charset # is unreachable via grep. printf '\0' | returns_ 1 grep -aE '^\s?$' > out 2>&1 || fail=1 compare /dev/null out Exit $fail ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/ere.tests����������������������������������������������������������������0000664�0001750�0001750�00000012673�14670377471�017464� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������0@a@a 0@abc@abc 0@abc|de@abc 0@a|b|c@abc 0@a(b)c@abc 2@a(@EPAREN 0@a\(@a( 2@a(b@EPAREN 0@a)@a)@POSIX BOTCH 0@)@)@POSIX BOTCH 0@a()b@ab 0@^abc$@abc 1@a^b@a^b 1@a$b@a$b 0@^@abc 0@$@abc 0@^$@@TO CORRECT 0@$^@@TO CORRECT 0@^^@@TO CORRECT 0@$$@@TO CORRECT 0@a*(^b$)c*@b 2@|@EMPTY@NO ALTERNATION 2@*@BADRPT@TO CORRECT 2@+@BADRPT@TO CORRECT 2@?@BADRPT@TO CORRECT 1@&C@PASS 0@()@abc 2@a||b@EMPTY@NO ALTERNATION 2@|ab@EMPTY@NO ALTERNATION 2@ab|@EMPTY@NO ALTERNATION 2@(|a)b@EMPTY@NO ALTERNATION 2@(a|)b@EMPTY@NO ALTERNATION 2@(*a)@BADRPT@TO CORRECT 2@(+a)@BADRPT@TO CORRECT 2@(?a)@BADRPT@TO CORRECT 2@({1}a)@BADRPT@TO CORRECT 2@(a|*b)@BADRPT@NO ALTERNATION 2@(a|+b)@BADRPT@NO ALTERNATION 2@(a|?b)@BADRPT@NO ALTERNATION 2@(a|{1}b)@BADRPT@NO ALTERNATION 2@^*@BADRPT@TO CORRECT 2@^+@BADRPT@TO CORRECT 2@^?@BADRPT@TO CORRECT 2@^{1}@BADRPT@TO CORRECT 0@a.c@abc 0@a[bc]d@abd 0@a\*c@a*c 0@a\\b@a\b@TO CORRECT 0@a\\\*b@a\*b@SHELL TROUBLE 0@a\bc@abc@TO CORRECT 2@a\@EESCAPE@SHELL TROUBLE 0@a\\bc@a\bc@TO CORRECT 0@a\[b@a[b 2@a[b@EBRACK 0@a$@a 1@a$@a$ 1@a\$@a@SHELL TROUBLE 0@a\$@a$@SHELL TROUBLE 1@a\\$@a 1@a\\$@a$@SHELL TROUBLE 1@a\\$@a\$@SHELL TROUBLE 0@a\\$@a\@SHEL TROUBLE 0@ab*c@abc 0@ab+c@abc 0@ab?c@abc 0@{@{@TO CORRECT 0@{abc@{abc@TO CORRECT 0@{1@{1 2@{1}@BADRPT@TO CORRECT 0@a{b@a{b@TO CORRECT 0@a{1}b@ab 0@a{1,}b@ab 0@a{1,2}b@aab 0@a{1@a{1 1@a{1a@aa 0@a{1a}@a{1a} 0@a{,2}@a{,2} 0@a{,}@a{,} 2@a{}@BADBR 0@a{1,*}@a{1,,,} 2@a{1,x@EBRACE@TO CORRECT 2@a{300}@BADBR@TO CORRECT 2@a{1,0}@BADBR@TO CORRECT 0@ab{0,0}c@abcac 0@ab{0,1}c@abcac 0@ab{0,3}c@abbcac 0@ab{1,1}c@acabc 0@ab{1,3}c@acabc 0@ab{2,2}c@abcabbc 0@ab{2,4}c@abcabbc 2@a**@BADRPT@TO CORRECT 2@a++@BADRPT@TO CORRECT 2@a??@BADRPT@TO CORRECT 2@a*+@BADRPT@TO CORRECT 2@a*?@BADRPT@TO CORRECT 2@a+*@BADRPT@TO CORRECT 2@a+?@BADRPT@TO CORRECT 2@a?*@BADRPT@TO CORRECT 2@a?+@BADRPT@TO CORRECT 2@a{1}{1}@BADRPT@TO CORRECT 2@a*{1}@BADRPT@TO CORRECT 2@a+{1}@BADRPT@TO CORRECT 2@a?{1}@BADRPT@TO CORRECT 2@a{1}*@BADRPT@TO CORRECT 2@a{1}+@BADRPT@TO CORRECT 2@a{1}?@BADRPT@TO CORRECT 0@a*{b}@a{b}@TO CORRECT 0@a[b]c@abc 0@a[ab]c@abc 0@a[^ab]c@adc 0@a[]b]c@a]c 0@a[[b]c@a[c 0@a[-b]c@a-c 0@a[^]b]c@adc 0@a[^-b]c@adc 0@a[b-]c@a-c 2@a[b@EBRACK 2@a[]@EBRACK 0@a[1-3]c@a2c 2@a[3-1]c@ERANGE@TO CORRECT 2@a[1-3-5]c@ERANGE@TO CORRECT 0@a[[.-.]--]c@a-c@TO CORRECT 2@a[1-@ERANGE 2@a[[.@EBRACK 2@a[[.x@EBRACK 2@a[[.x.@EBRACK 2@a[[.x.]@EBRACK@TO CORRECT 0@a[[.x.]]@ax@TO CORRECT 2@a[[.x,.]]@ECOLLATE@TO CORRECT 0@a[[.one.]]b@a1b@TO CORRECT 2@a[[.notdef.]]b@ECOLLATE@TO CORRECT 0@a[[.].]]b@a]b@TO CORRECT 0@a[[:alpha:]]c@abc 2@a[[:notdef:]]c@ECTYPE 2@a[[:@EBRACK 2@a[[:alpha@EBRACK 2@a[[:alpha:]@EBRACK 2@a[[:alpha,:]@ECTYPE 2@a[[:]:]]b@ECTYPE 2@a[[:-:]]b@ECTYPE 2@a[[:alph:]]@ECTYPE 2@a[[:alphabet:]]@ECTYPE 0@[[:digit:]]+@a019b 0@[[:lower:]]+@AabC 0@[[:upper:]]+@aBCd 0@[[:xdigit:]]+@p0f3Cq 0@a[[=b=]]c@abc@TO CORRECT 2@a[[=@EBRACK 2@a[[=b@EBRACK 2@a[[=b=@EBRACK 2@a[[=b=]@EBRACK@TO CORRECT 2@a[[=b,=]]@ECOLLATE@TO CORRECT 0@a[[=one=]]b@a1b@TO CORRECT 0@a(((b)))c@abc 0@a(b|(c))d@abd 0@a(b*|c)d@abbd 0@a[ab]{20}@aaaaabaaaabaaaabaaaab 0@a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]@aaaaabaaaabaaaabaaaab 0@a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)@aaaaabaaaabaaaabaaaabweeknights 0@12345678901234567890123456789@a12345678901234567890123456789b 0@123456789012345678901234567890@a123456789012345678901234567890b 0@1234567890123456789012345678901@a1234567890123456789012345678901b 0@12345678901234567890123456789012@a12345678901234567890123456789012b 0@123456789012345678901234567890123@a123456789012345678901234567890123b 0@1234567890123456789012345678901234567890123456789012345678901234567890@a1234567890123456789012345678901234567890123456789012345678901234567890b 0@[ab][cd][ef][gh][ij][kl][mn]@xacegikmoq 0@[ab][cd][ef][gh][ij][kl][mn][op]@xacegikmoq 0@[ab][cd][ef][gh][ij][kl][mn][op][qr]@xacegikmoqy 0@[ab][cd][ef][gh][ij][kl][mn][op][q]@xacegikmoqy 0@abc@xabcy 0@aBc@Abc@TO CORRECT 0@a[Bc]*d@abBCcd@TO CORRECT 0@0[[:upper:]]1@0a1@TO CORRECT 0@0[[:lower:]]1@0A1@TO CORRECT 1@a[^b]c@abc 1@a[^b]c@aBc@TO CORRECT 0@a[^b]c@adc 0@[a]b[c]@abc 0@[a]b[a]@aba 0@[abc]b[abc]@abc 0@[abc]b[abd]@abd 0@a(b?c)+d@accd 0@(wee|week)(knights|night)@weeknights 0@(we|wee|week|frob)(knights|night|day)@weeknights 0@a[bc]d@xyzaaabcaababdacd 0@a[ab]c@aaabc 0@a*@b 0@/\*.*\*/@/*x*/ 0@/\*.*\*/@/*x*/y/*z*/ 0@/\*([^*]|\*[^/])*\*/@/*x*/ 0@/\*([^*]|\*[^/])*\*/@/*x*/y/*z*/ 0@/\*([^*]|\*[^/])*\*/@/*x**/y/*z*/ 0@/\*([^*]|\*+[^*/])*\*+/@/*x*/ 0@/\*([^*]|\*+[^*/])*\*+/@/*x*/y/*z*/ 0@/\*([^*]|\*+[^*/])*\*+/@/*x**/y/*z*/ 0@/\*([^*]|\*+[^*/])*\*+/@/*x****/y/*z*/ 0@/\*([^*]|\*+[^*/])*\*+/@/*x**x*/y/*z*/ 0@/\*([^*]|\*+[^*/])*\*+/@/*x***x/y/*z*/ 0@aZb@a@TO CORRECT 0@[[:<:]]a@a@TO CORRECT 1@[[:<:]]a@ba@TO CORRECT 0@[[:<:]]a@-a@TO CORRECT 0@a[[:>:]]@a@TO CORRECT 1@a[[:>:]]@ab@TO CORRECT 0@a[[:>:]]@a-@TO CORRECT 0@[[:<:]]a.c[[:>:]]@axcd-dayc-dazce-abc@TO CORRECT 0@[[:<:]]a.c[[:>:]]@axcd-dayc-dazce-abc-q@TO CORRECT 0@[[:<:]]a.c[[:>:]]@axc-dayc-dazce-abc@TO CORRECT 0@[[:<:]]b.c[[:>:]]@a_bxc-byc_d-bzc-q@TO CORRECT 0@[[:<:]].x..[[:>:]]@y_xa_-_xb_y-_xc_-axdc@TO CORRECT 1@[[:<:]]a_b[[:>:]]@x_a_b@TO CORRECT 0@(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A])@A1 0@abcdefghijklmnop@abcdefghijklmnop 0@abcdefghijklmnopqrstuv@abcdefghijklmnopqrstuv 0@CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a@CC11 0@a?b@ab 2@b{1000000000}@ESIZE 0@)@) 1@)@x 0@\()\((a\())(b))@()(a()b) # This would erroneously match from grep-3.2 to grep-3.5 1@a+a+a@aa ���������������������������������������������������������������������kbuild-3608/src/grep/tests/case-fold-char-range�����������������������������������������������������0000775�0001750�0001750�00000001125�14670377472�021404� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # This would fail for grep-2.5.3 . "${srcdir=.}/init.sh"; path_prepend_ ../src printf 'A\nZ\n' > exp1 || framework_failure_ fail=0 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do out=out1-$LOC printf 'A\n1\nZ\n.\n' | LC_ALL=$LOC grep -i '[a-z]' > $out || fail=1 compare exp1 $out || fail=1 done # This actually passes also for grep-2.5.3 printf 'a\nz\n' > exp2 || framework_failure_ for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do out=out2-$LOC printf 'a\n1\nz\n.\n' | LC_ALL=$LOC grep -i '[A-Z]' > $out || fail=1 compare exp2 $out || fail=1 done Exit $fail �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/khadafy.regexp�����������������������������������������������������������0000664�0001750�0001750�00000000102�14670377471�020430� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/tests/z-anchor-newline���������������������������������������������������������0000775�0001750�0001750�00000002622�14670377472�020725� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # grep -z with an anchor in the regex could mistakenly match text # including a newline. # Copyright 2016-2021 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 <https://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src require_en_utf8_locale_ require_compiled_in_MB_support LC_ALL=en_US.UTF-8 printf 'a\nb\0' > in || framework_failure_ fail=0 # These three would all mistakenly match, because the [a-b] range # forced the non-DFA (regexp-using) code path. returns_ 1 grep -z '^[a-b]*$' in || fail=1 returns_ 1 grep -z 'a[a-b]*$' in || fail=1 returns_ 1 grep -z '^[a-b]*b' in || fail=1 # Test these for good measure; they exercise the DFA code path # and always worked returns_ 1 grep -z '^[ab]*$' in || fail=1 returns_ 1 grep -z 'a[ab]*$' in || fail=1 returns_ 1 grep -z '^[ab]*b' in || fail=1 Exit $fail ��������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/����������������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377450�014767� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sys_select_h.m4�������������������������������������������������������������0000664�0001750�0001750�00000010206�14670377450�017714� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sys_select_h.m4 serial 23 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_SYS_SELECT_H], [ AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) AC_CACHE_CHECK([whether <sys/select.h> is self-contained], [gl_cv_header_sys_select_h_selfcontained], [ dnl Test against two bugs: dnl 1. On many platforms, <sys/select.h> assumes prior inclusion of dnl <sys/types.h>. dnl 2. On OSF/1 4.0, <sys/select.h> provides only a forward declaration dnl of 'struct timeval', and no definition of this type. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]], [[struct timeval b;]])], [gl_cv_header_sys_select_h_selfcontained=yes], [gl_cv_header_sys_select_h_selfcontained=no]) dnl Test against another bug: dnl 3. On Solaris 10, <sys/select.h> provides an FD_ZERO implementation dnl that relies on memset(), but without including <string.h>. if test $gl_cv_header_sys_select_h_selfcontained = yes; then AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <sys/select.h>]], [[int memset; int bzero;]]) ], [AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include <sys/select.h>]], [[ #undef memset #define memset nonexistent_memset extern #ifdef __cplusplus "C" #endif void *memset (void *, int, unsigned long); #undef bzero #define bzero nonexistent_bzero extern #ifdef __cplusplus "C" #endif void bzero (void *, unsigned long); fd_set fds; FD_ZERO (&fds); ]]) ], [], [gl_cv_header_sys_select_h_selfcontained=no]) ]) fi ]) dnl <sys/select.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([sys/select.h]) if test $ac_cv_header_sys_select_h = yes; then HAVE_SYS_SELECT_H=1 else HAVE_SYS_SELECT_H=0 fi AC_SUBST([HAVE_SYS_SELECT_H]) gl_PREREQ_SYS_H_WINSOCK2 dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ /* Some systems require prerequisite headers. */ #include <sys/types.h> #if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H # include <sys/time.h> #endif #include <sys/select.h> ]], [pselect select]) ]) # gl_SYS_SELECT_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_SYS_SELECT_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_SYS_SELECT_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SELECT_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PSELECT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SELECT]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SELECT_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) ]) AC_DEFUN([gl_SYS_SELECT_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_PSELECT=1; AC_SUBST([HAVE_PSELECT]) REPLACE_PSELECT=0; AC_SUBST([REPLACE_PSELECT]) REPLACE_SELECT=0; AC_SUBST([REPLACE_SELECT]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/localeconv.m4���������������������������������������������������������������0000664�0001750�0001750�00000001147�14670377450�017361� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# localeconv.m4 serial 1 dnl Copyright (C) 2012-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_LOCALECONV], [ AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) AC_REQUIRE([gl_LOCALE_H]) if test $REPLACE_STRUCT_LCONV = 1; then REPLACE_LOCALECONV=1 fi ]) # Prerequisites of lib/localeconv.c. AC_DEFUN([gl_PREREQ_LOCALECONV], [ AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [], [[#include <locale.h>]]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/d-ino.m4��������������������������������������������������������������������0000664�0001750�0001750�00000004201�14670377440�016233� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 20 dnl From Jim Meyering. dnl dnl Check whether struct dirent has a member named d_ino. dnl # Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2021 Free Software # Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO], [AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([for d_ino member in directory struct], [gl_cv_struct_dirent_d_ino], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> #include <sys/stat.h> #include <dirent.h> ]], [[DIR *dp = opendir ("."); struct dirent *e; struct stat st; if (! dp) return 1; e = readdir (dp); if (! e) { closedir (dp); return 2; } if (lstat (e->d_name, &st) != 0) { closedir (dp); return 3; } if (e->d_ino != st.st_ino) { closedir (dp); return 4; } closedir (dp); return 0; ]])], [gl_cv_struct_dirent_d_ino=yes], [gl_cv_struct_dirent_d_ino=no], [case "$host_os" in # Guess yes on glibc systems with Linux kernel. linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;; # Guess yes on musl systems with Linux kernel. linux*-musl*) gl_cv_struct_dirent_d_ino="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_struct_dirent_d_ino="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_struct_dirent_d_ino="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_struct_dirent_d_ino" in *yes) AC_DEFINE([D_INO_IN_DIRENT], [1], [Define if struct dirent has a member d_ino that actually works.]) ;; esac ] ) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mode_t.m4�������������������������������������������������������������������0000664�0001750�0001750�00000002342�14670377450�016501� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mode_t.m4 serial 2 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # For using mode_t, it's sufficient to use AC_TYPE_MODE_T and # include <sys/types.h>. # Define PROMOTED_MODE_T to the type that is the result of "default argument # promotion" (ISO C 6.5.2.2.(6)) of the type mode_t. AC_DEFUN([gl_PROMOTED_TYPE_MODE_T], [ AC_REQUIRE([AC_TYPE_MODE_T]) AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [ dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int', dnl and to itself otherwise. This assumption is not guaranteed by the ISO C dnl standard, but we don't know of any real-world counterexamples. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])], [gl_cv_promoted_mode_t='int'], [gl_cv_promoted_mode_t='mode_t']) ]) AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t], [Define to the type that is the result of default argument promotions of type mode_t.]) ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fnmatch.m4������������������������������������������������������������������0000664�0001750�0001750�00000013174�14670377440�016656� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Check for fnmatch - serial 15. -*- coding: utf-8 -*- # Copyright (C) 2000-2007, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Autoconf defines AC_FUNC_FNMATCH, but that is obsolescent. # New applications should use the macros below instead. # Request a POSIX compliant fnmatch function. AC_DEFUN([gl_FUNC_FNMATCH_POSIX], [ m4_divert_text([DEFAULTS], [gl_fnmatch_required=POSIX]) AC_REQUIRE([gl_FNMATCH_H]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles gl_fnmatch_required_lowercase=` echo $gl_fnmatch_required | LC_ALL=C tr '[[A-Z]]' '[[a-z]]' ` AC_CHECK_FUNCS_ONCE([fnmatch]) if test $ac_cv_func_fnmatch = no; then HAVE_FNMATCH=0 else gl_fnmatch_cache_var="gl_cv_func_fnmatch_${gl_fnmatch_required_lowercase}" AC_CACHE_CHECK([for working $gl_fnmatch_required fnmatch], [$gl_fnmatch_cache_var], [dnl Some versions of Solaris, SCO, and the GNU C Library dnl have a broken or incompatible fnmatch. dnl So we run a test program. If we are cross-compiling, take no chance. dnl Thanks to John Oleynick, François Pinard, and Paul Eggert for this dnl test. if test $gl_fnmatch_required = GNU; then gl_fnmatch_gnu_start= gl_fnmatch_gnu_end= else gl_fnmatch_gnu_start='#if 0' gl_fnmatch_gnu_end='#endif' fi AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <fnmatch.h> static int y (char const *pattern, char const *string, int flags) { return fnmatch (pattern, string, flags) == 0; } static int n (char const *pattern, char const *string, int flags) { return fnmatch (pattern, string, flags) == FNM_NOMATCH; } ]], [[char const *Apat = 'A' < '\\\\' ? "[A-\\\\\\\\]" : "[\\\\\\\\-A]"; char const *apat = 'a' < '\\\\' ? "[a-\\\\\\\\]" : "[\\\\\\\\-a]"; static char const A_1[] = { 'A' - 1, 0 }; static char const A01[] = { 'A' + 1, 0 }; static char const a_1[] = { 'a' - 1, 0 }; static char const a01[] = { 'a' + 1, 0 }; static char const bs_1[] = { '\\\\' - 1, 0 }; static char const bs01[] = { '\\\\' + 1, 0 }; int result = 0; if (!n ("a*", "", 0)) return 1; if (!y ("a*", "abc", 0)) return 1; if (!y ("[/b", "[/b", 0)) /*"]]"*/ /* glibc Bugzilla bug 12378 */ return 1; if (!n ("d*/*1", "d/s/1", FNM_PATHNAME)) return 2; if (!y ("a\\\\bc", "abc", 0)) return 3; if (!n ("a\\\\bc", "abc", FNM_NOESCAPE)) return 3; if (!y ("*x", ".x", 0)) return 4; if (!n ("*x", ".x", FNM_PERIOD)) return 4; if (!y (Apat, "\\\\", 0)) return 5; if (!y (Apat, "A", 0)) return 5; if (!y (apat, "\\\\", 0)) return 5; if (!y (apat, "a", 0)) return 5; if (!(n (Apat, A_1, 0) == ('A' < '\\\\'))) return 5; if (!(n (apat, a_1, 0) == ('a' < '\\\\'))) return 5; if (!(y (Apat, A01, 0) == ('A' < '\\\\'))) return 5; if (!(y (apat, a01, 0) == ('a' < '\\\\'))) return 5; if (!(y (Apat, bs_1, 0) == ('A' < '\\\\'))) return 5; if (!(y (apat, bs_1, 0) == ('a' < '\\\\'))) return 5; if (!(n (Apat, bs01, 0) == ('A' < '\\\\'))) return 5; if (!(n (apat, bs01, 0) == ('a' < '\\\\'))) return 5; $gl_fnmatch_gnu_start if (!y ("xxXX", "xXxX", FNM_CASEFOLD)) result |= 8; if (!y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)) result |= 16; if (!n ("d*/*1", "d/s/1", FNM_FILE_NAME)) result |= 32; if (!y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)) result |= 64; if (!y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)) result |= 64; if (!y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)) result |= 64; $gl_fnmatch_gnu_end return result; ]])], [eval "$gl_fnmatch_cache_var=yes"], [eval "$gl_fnmatch_cache_var=no"], [case "$host_os" in # Guess yes on musl systems. *-musl*) eval "$gl_fnmatch_cache_var=\"guessing yes\"" ;; # Guess no otherwise, even on glibc systems. *) eval "$gl_fnmatch_cache_var=\"guessing no\"" ;; esac ]) ]) eval "gl_fnmatch_result=\"\$$gl_fnmatch_cache_var\"" case "$gl_fnmatch_result" in *yes) ;; *) REPLACE_FNMATCH=1 ;; esac fi if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then gl_REPLACE_FNMATCH_H fi ]) # Request a POSIX compliant fnmatch function with GNU extensions. AC_DEFUN([gl_FUNC_FNMATCH_GNU], [ m4_divert_text([INIT_PREPARE], [gl_fnmatch_required=GNU]) AC_REQUIRE([gl_FUNC_FNMATCH_POSIX]) ]) AC_DEFUN([gl_PREREQ_FNMATCH], [ dnl Prerequisites of lib/fnmatch.c. AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_CHECK_FUNCS_ONCE([mbsrtowcs]) ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mbchar.m4�������������������������������������������������������������������0000664�0001750�0001750�00000000653�14670377450�016471� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mbchar.m4 serial 9 dnl Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl autoconf tests required for use of mbchar.m4 dnl From Bruno Haible. AC_DEFUN([gl_MBCHAR], [ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ]) �������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fpieee.m4�������������������������������������������������������������������0000664�0001750�0001750�00000004340�14670377440�016466� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# fpieee.m4 serial 2 -*- coding: utf-8 -*- dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl IEEE 754 standardized three items: dnl - The formats of single-float and double-float - nowadays commonly dnl available as 'float' and 'double' in C and C++. dnl No autoconf test needed. dnl - The overflow and division by zero behaviour: The result are values dnl '±Inf' and 'NaN', rather than exceptions as it was before. dnl This file provides an autoconf macro for ensuring this behaviour of dnl floating-point operations. dnl - A set of conditions (overflow, underflow, inexact, etc.) which can dnl be configured to trigger an exception. dnl This cannot be done in a portable way: it depends on the compiler, dnl libc, kernel, and CPU. No autoconf macro is provided for this. dnl Ensure non-trapping behaviour of floating-point overflow and dnl floating-point division by zero. dnl (For integer overflow, see gcc's -ftrapv option; for integer division by dnl zero, see the autoconf macro in intdiv0.m4.) AC_DEFUN([gl_FP_IEEE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) # IEEE behaviour is the default on all CPUs except Alpha and SH # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4 # and the GCC 4.1.2 manual). case "$host_cpu" in alpha*) # On Alpha systems, a compiler option provides the behaviour. # See the ieee(3) manual page, also available at # <https://backdrift.org/man/tru64/man3/ieee.3.html> if test -n "$GCC"; then # GCC has the option -mieee. # For full IEEE compliance (rarely needed), use option -mieee-with-inexact. CPPFLAGS="$CPPFLAGS -mieee" else # Compaq (ex-DEC) C has the option -ieee, equivalent to -ieee_with_no_inexact. # For full IEEE compliance (rarely needed), use option -ieee_with_inexact. CPPFLAGS="$CPPFLAGS -ieee" fi ;; sh*) if test -n "$GCC"; then # GCC has the option -mieee. CPPFLAGS="$CPPFLAGS -mieee" fi ;; esac ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/stdarg.m4�������������������������������������������������������������������0000664�0001750�0001750�00000005333�14670377450�016521� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# stdarg.m4 serial 7 dnl Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Provide a working va_copy in combination with <stdarg.h>. AC_DEFUN([gl_STDARG_H], [ STDARG_H='' NEXT_STDARG_H='<stdarg.h>' AC_CACHE_CHECK([for va_copy], [gl_cv_func_va_copy], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <stdarg.h>]], [[ #ifndef va_copy void (*func) (va_list, va_list) = va_copy; #endif ]])], [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no]) ]) if test $gl_cv_func_va_copy = no; then dnl Provide a substitute. dnl Usually a simple definition in <config.h> is enough. Not so on AIX 5 dnl with some versions of the /usr/vac/bin/cc compiler. It has an <stdarg.h> dnl which does '#undef va_copy', leading to a missing va_copy symbol. For dnl this platform, we use an <stdarg.h> substitute. But we cannot use this dnl approach on other platforms, because <stdarg.h> often defines only dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do dnl not work in this situation. AC_EGREP_CPP([vaccine], [#if defined _AIX && !defined __GNUC__ AIX vaccine #endif ], [gl_aixcc=yes], [gl_aixcc=no]) if test $gl_aixcc = yes; then dnl Provide a substitute <stdarg.h> file. STDARG_H=stdarg.h gl_NEXT_HEADERS([stdarg.h]) dnl Fallback for the case when <stdarg.h> contains only macro definitions. if test "$gl_cv_next_stdarg_h" = '""'; then gl_cv_next_stdarg_h='"///usr/include/stdarg.h"' NEXT_STDARG_H="$gl_cv_next_stdarg_h" fi else dnl Provide a substitute in <config.h>, either __va_copy or as a simple dnl assignment. gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [ AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <stdarg.h>]], [[ #ifndef __va_copy error, bail out #endif ]])], [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])]) if test $gl_cv_func___va_copy = yes; then AC_DEFINE([va_copy], [__va_copy], [Define as a macro for copying va_list variables.]) else AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */ #define gl_va_copy(a,b) ((a) = (b))]) AC_DEFINE([va_copy], [gl_va_copy], [Define as a macro for copying va_list variables.]) fi fi fi AC_SUBST([STDARG_H]) AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"]) AC_SUBST([NEXT_STDARG_H]) ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/getdtablesize.m4������������������������������������������������������������0000664�0001750�0001750�00000005045�14670377440�020062� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# getdtablesize.m4 serial 8 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_GETDTABLESIZE], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([getdtablesize]) AC_CHECK_DECLS_ONCE([getdtablesize]) if test $ac_cv_func_getdtablesize = yes && test $ac_cv_have_decl_getdtablesize = yes; then AC_CACHE_CHECK([whether getdtablesize works], [gl_cv_func_getdtablesize_works], [dnl There are two concepts: the "maximum possible file descriptor value + 1" dnl and the "maximum number of open file descriptors in a process". dnl Per SUSv2 and POSIX, getdtablesize() should return the first one. dnl On most platforms, the first and the second concept are the same. dnl On OpenVMS, however, they are different and getdtablesize() returns dnl the second one; thus the test below fails. But we don't care dnl because there's no good way to write a replacement getdtablesize(). case "$host_os" in vms*) gl_cv_func_getdtablesize_works="no (limitation)" ;; *) dnl Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft dnl limit up to an unchangeable hard limit; all other platforms dnl correctly require setrlimit before getdtablesize() can report dnl a larger value. AC_RUN_IFELSE([ AC_LANG_PROGRAM( [[#include <unistd.h>] GL_MDA_DEFINES ], [[int size = getdtablesize(); if (dup2 (0, getdtablesize()) != -1) return 1; if (size != getdtablesize()) return 2; ]])], [gl_cv_func_getdtablesize_works=yes], [gl_cv_func_getdtablesize_works=no], [case "$host_os" in cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows gl_cv_func_getdtablesize_works="guessing no" ;; *) gl_cv_func_getdtablesize_works="guessing yes" ;; esac ]) ;; esac ]) case "$gl_cv_func_getdtablesize_works" in *yes | "no (limitation)") ;; *) REPLACE_GETDTABLESIZE=1 ;; esac else HAVE_GETDTABLESIZE=0 fi ]) # Prerequisites of lib/getdtablesize.c. AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fdopendir.m4����������������������������������������������������������������0000664�0001750�0001750�00000003661�14670377440�017210� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 14 # See if we need to provide fdopendir. dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Written by Eric Blake. AC_DEFUN([gl_FUNC_FDOPENDIR], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) dnl FreeBSD 7.3 has the function, but failed to declare it. AC_CHECK_DECLS([fdopendir], [], [HAVE_DECL_FDOPENDIR=0], [[ #include <dirent.h> ]]) AC_CHECK_FUNCS_ONCE([fdopendir]) if test $ac_cv_func_fdopendir = no; then HAVE_FDOPENDIR=0 else AC_CACHE_CHECK([whether fdopendir works], [gl_cv_func_fdopendir_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include <dirent.h> #include <fcntl.h> #include <unistd.h> ]GL_MDA_DEFINES[ #if !HAVE_DECL_FDOPENDIR extern # ifdef __cplusplus "C" # endif DIR *fdopendir (int); #endif ]], [[int result = 0; int fd = open ("conftest.c", O_RDONLY); if (fd < 0) result |= 1; if (fdopendir (fd)) result |= 2; if (close (fd)) result |= 4; return result; ]])], [gl_cv_func_fdopendir_works=yes], [gl_cv_func_fdopendir_works=no], [case "$host_os" in # Guess yes on glibc systems. *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_fdopendir_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_fdopendir_works" in *yes) ;; *) REPLACE_FDOPENDIR=1 ;; esac fi ]) �������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mbsinit.m4������������������������������������������������������������������0000664�0001750�0001750�00000002401�14670377450�016673� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mbsinit.m4 serial 9 dnl Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MBSINIT], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN AC_CHECK_FUNCS_ONCE([mbsinit]) if test $ac_cv_func_mbsinit = no; then HAVE_MBSINIT=0 AC_CHECK_DECLS([mbsinit],,, [[ #include <wchar.h> ]]) if test $ac_cv_have_decl_mbsinit = yes; then dnl On Minix 3.1.8, the system's <wchar.h> declares mbsinit() although dnl it does not have the function. Avoid a collision with gnulib's dnl replacement. REPLACE_MBSINIT=1 fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_MBSINIT=1 else dnl On mingw, mbsinit() always returns 1, which is inappropriate for dnl states produced by mbrtowc() for an incomplete multibyte character dnl in multibyte locales. case "$host_os" in mingw*) REPLACE_MBSINIT=1 ;; esac fi fi ]) # Prerequisites of lib/mbsinit.c. AC_DEFUN([gl_PREREQ_MBSINIT], [ : ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/iconv_open.m4���������������������������������������������������������������0000664�0001750�0001750�00000004060�14670377440�017367� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# iconv_open.m4 serial 16 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ICONV_OPEN], [ AC_REQUIRE([AM_ICONV]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_ICONV_H_DEFAULTS]) if test "$am_cv_func_iconv" = yes; then dnl Provide the <iconv.h> override, for the sake of the C++ aliases. gl_REPLACE_ICONV_H dnl Test whether iconv_open accepts standardized encoding names. dnl We know that GNU libiconv and GNU libc do. AC_EGREP_CPP([gnu_iconv], [ #include <iconv.h> #if defined _LIBICONV_VERSION || (defined __GLIBC__ && !defined __UCLIBC__) gnu_iconv #endif ], [gl_func_iconv_gnu=yes], [gl_func_iconv_gnu=no]) if test $gl_func_iconv_gnu = no; then iconv_flavor= case "$host_os" in aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;; openedition*) iconv_flavor=ICONV_FLAVOR_ZOS ;; esac if test -n "$iconv_flavor"; then AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor], [Define to a symbolic name denoting the flavor of iconv_open() implementation.]) gl_REPLACE_ICONV_OPEN fi fi m4_ifdef([gl_FUNC_ICONV_OPEN_UTF_SUPPORT], [ gl_FUNC_ICONV_OPEN_UTF_SUPPORT case "$gl_cv_func_iconv_supports_utf" in *yes) ;; *) REPLACE_ICONV_UTF=1 AC_DEFINE([REPLACE_ICONV_UTF], [1], [Define if the iconv() functions are enhanced to handle the UTF-{16,32}{BE,LE} encodings.]) REPLACE_ICONV=1 gl_REPLACE_ICONV_OPEN ;; esac ]) fi ]) AC_DEFUN([gl_REPLACE_ICONV_OPEN], [ gl_REPLACE_ICONV_H REPLACE_ICONV_OPEN=1 ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mbstate_t.m4����������������������������������������������������������������0000664�0001750�0001750�00000002210�14670377450�017206� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mbstate_t.m4 serial 14 dnl Copyright (C) 2000-2002, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # From Paul Eggert. # BeOS 5 has <wchar.h> but does not define mbstate_t, # so you can't declare an object of that type. # Check for this incompatibility with Standard C. # AC_TYPE_MBSTATE_T # ----------------- AC_DEFUN([AC_TYPE_MBSTATE_T], [ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl for HP-UX 11.11 AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT[ #include <wchar.h>]], [[mbstate_t x; return sizeof x;]])], [ac_cv_type_mbstate_t=yes], [ac_cv_type_mbstate_t=no])]) if test $ac_cv_type_mbstate_t = yes; then AC_DEFINE([HAVE_MBSTATE_T], [1], [Define to 1 if <wchar.h> declares mbstate_t.]) else AC_DEFINE([mbstate_t], [int], [Define to a type if <wchar.h> does not define.]) fi ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/stdlib_h.m4�����������������������������������������������������������������0000664�0001750�0001750�00000022333�14670377450�017024� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# stdlib_h.m4 serial 63 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_STDLIB_H], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) gl_NEXT_HEADERS([stdlib.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by C89. gl_WARN_ON_USE_PREPARE([[#include <stdlib.h> #if HAVE_SYS_LOADAVG_H /* OpenIndiana has a bug: <sys/time.h> must be included before <sys/loadavg.h>. */ # include <sys/time.h> # include <sys/loadavg.h> #endif #if HAVE_RANDOM_H # include <random.h> #endif ]], [_Exit aligned_alloc atoll canonicalize_file_name free getloadavg getsubopt grantpt initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps posix_memalign posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray realpath rpmatch secure_getenv setenv setstate setstate_r srandom srandom_r strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) AC_REQUIRE([AC_C_RESTRICT]) AC_CHECK_DECLS_ONCE([ecvt]) if test $ac_cv_have_decl_ecvt = no; then HAVE_DECL_ECVT=0 fi AC_CHECK_DECLS_ONCE([fcvt]) if test $ac_cv_have_decl_fcvt = no; then HAVE_DECL_FCVT=0 fi AC_CHECK_DECLS_ONCE([gcvt]) if test $ac_cv_have_decl_gcvt = no; then HAVE_DECL_GCVT=0 fi ]) # gl_STDLIB_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_STDLIB_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMPS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMPS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_MEMALIGN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_OPENPT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOULL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYSTEM_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLOCKPT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNSETENV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOMB]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ECVT], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCVT], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GCVT], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKTEMP], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTENV], [1]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) ]) AC_DEFUN([gl_STDLIB_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) HAVE_ALIGNED_ALLOC=1; AC_SUBST([HAVE_ALIGNED_ALLOC]) HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) HAVE_DECL_ECVT=1; AC_SUBST([HAVE_DECL_ECVT]) HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT]) HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT]) HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) HAVE_DECL_INITSTATE=1; AC_SUBST([HAVE_DECL_INITSTATE]) HAVE_MBTOWC=1; AC_SUBST([HAVE_MBTOWC]) HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) HAVE_POSIX_MEMALIGN=1; AC_SUBST([HAVE_POSIX_MEMALIGN]) HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT]) HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R]) HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM]) HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H]) HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) HAVE_REALLOCARRAY=1; AC_SUBST([HAVE_REALLOCARRAY]) HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV]) HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) HAVE_STRTOUL=1; AC_SUBST([HAVE_STRTOUL]) HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) REPLACE_FREE=0; AC_SUBST([REPLACE_FREE]) REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) REPLACE_STRTOUL=0; AC_SUBST([REPLACE_STRTOUL]) REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/flexmember.m4���������������������������������������������������������������0000664�0001750�0001750�00000003254�14670377440�017362� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 5 # Check for flexible array member support. # Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER], [ AC_CACHE_CHECK([for flexible array member], ac_cv_c_flexmember, [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <stdlib.h> #include <stdio.h> #include <stddef.h> struct m { struct m *next, **list; char name[]; }; struct s { struct s *p; struct m *m; int n; double d[]; };]], [[int m = getchar (); size_t nbytes = offsetof (struct s, d) + m * sizeof (double); nbytes += sizeof (struct s) - 1; nbytes -= nbytes % sizeof (struct s); struct s *p = malloc (nbytes); p->p = p; p->m = NULL; p->d[0] = 0.0; return p->d != (double *) NULL;]])], [ac_cv_c_flexmember=yes], [ac_cv_c_flexmember=no])]) if test $ac_cv_c_flexmember = yes; then AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [], [Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like 'struct s { int n; short d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack can be used with pre-C99 compilers. Use 'FLEXSIZEOF (struct s, d, N * sizeof (short))' to calculate the size in bytes of such a struct containing an N-element array.]) else AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1]) fi ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/stat-time.m4����������������������������������������������������������������0000664�0001750�0001750�00000006057�14670377450�017150� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Checks for stat-related time functions. # Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2021 Free Software # Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # st_atim.tv_nsec - Linux, Solaris, Cygwin # st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE # st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE # st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1) # st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway) # st_birthtim - Cygwin 1.7.0+ AC_DEFUN([gl_STAT_TIME], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_HEADERS_ONCE([sys/time.h]) AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec], [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec], [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #include <sys/types.h> #include <sys/stat.h> #if HAVE_SYS_TIME_H # include <sys/time.h> #endif #include <time.h> struct timespec ts; struct stat st; ]], [[ st.st_atim = ts; ]])], [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes], [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])]) if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1], [Define to 1 if the type of the st_atim member of a struct stat is struct timespec.]) fi], [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [], [AC_CHECK_MEMBERS([struct stat.st_atimensec], [], [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [], [#include <sys/types.h> #include <sys/stat.h>])], [#include <sys/types.h> #include <sys/stat.h>])], [#include <sys/types.h> #include <sys/stat.h>])], [#include <sys/types.h> #include <sys/stat.h>]) ]) # Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.) # and NTFS (Cygwin). # There was a time when this field was named st_createtime (21 June # 2002 to 16 July 2002) But that window is very small and applied only # to development code, so systems still using that configuration are # not supported. See revisions 1.10 and 1.11 of FreeBSD's # src/sys/ufs/ufs/dinode.h. # AC_DEFUN([gl_STAT_BIRTHTIME], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_HEADERS_ONCE([sys/time.h]) AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [], [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [], [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [], [#include <sys/types.h> #include <sys/stat.h>])], [#include <sys/types.h> #include <sys/stat.h>])], [#include <sys/types.h> #include <sys/stat.h>]) ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/arpa_inet_h.m4��������������������������������������������������������������0000664�0001750�0001750�00000005035�14670377440�017504� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# arpa_inet_h.m4 serial 17 dnl Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Simon Josefsson and Bruno Haible AC_DEFUN_ONCE([gl_ARPA_INET_H], [ dnl Ensure to expand the default settings once only, before all statements dnl that occur in other macros. AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) AC_CHECK_HEADERS_ONCE([arpa/inet.h]) if test $ac_cv_header_arpa_inet_h = yes; then HAVE_ARPA_INET_H=1 else HAVE_ARPA_INET_H=0 fi AC_SUBST([HAVE_ARPA_INET_H]) dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([arpa/inet.h]) AC_REQUIRE([gl_FEATURES_H]) gl_PREREQ_SYS_H_WS2TCPIP dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ /* On some systems, this header is not self-consistent. */ #if !(defined __GLIBC__ || defined __UCLIBC__) # include <sys/socket.h> #endif #ifdef __TANDEM # include <netdb.h> #endif #include <arpa/inet.h> ]], [inet_ntop inet_pton]) ]) # gl_ARPA_INET_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_ARPA_INET_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_NTOP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_PTON]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) ]) AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP]) REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON]) ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/intlmacosx.m4���������������������������������������������������������������0000664�0001750�0001750�00000006235�14670377440�017417� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# intlmacosx.m4 serial 8 (gettext-0.20.2) dnl Copyright (C) 2004-2014, 2016, 2019-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can be used in projects which are not available under dnl the GNU General Public License or the GNU Lesser General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Checks for special options needed on Mac OS X. dnl Defines INTL_MACOSX_LIBS. AC_DEFUN([gt_INTL_MACOSX], [ dnl Check for API introduced in Mac OS X 10.4. AC_CACHE_CHECK([for CFPreferencesCopyAppValue], [gt_cv_func_CFPreferencesCopyAppValue], [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <CoreFoundation/CFPreferences.h>]], [[CFPreferencesCopyAppValue(NULL, NULL)]])], [gt_cv_func_CFPreferencesCopyAppValue=yes], [gt_cv_func_CFPreferencesCopyAppValue=no]) LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent, dnl because in macOS 10.13.4 it has the following behaviour: dnl When two or more languages are specified in the dnl "System Preferences > Language & Region > Preferred Languages" panel, dnl it returns en_CC where CC is the territory (even when English is not among dnl the preferred languages!). What we want instead is what dnl CFLocaleCopyCurrent returned in earlier macOS releases and what dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the dnl first among the preferred languages and CC is the territory. AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages], [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <CoreFoundation/CFLocale.h>]], [[CFLocaleCopyPreferredLanguages();]])], [gt_cv_func_CFLocaleCopyPreferredLanguages=yes], [gt_cv_func_CFLocaleCopyPreferredLanguages=no]) LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1], [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.]) fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi AC_SUBST([INTL_MACOSX_LIBS]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/gettimeofday.m4�������������������������������������������������������������0000664�0001750�0001750�00000005302�14670377440�017711� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 29 # Copyright (C) 2001-2003, 2005, 2007, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. dnl From Jim Meyering. AC_DEFUN([gl_FUNC_GETTIMEOFDAY], [ AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_SYS_TIME_H]) AC_CHECK_FUNCS_ONCE([gettimeofday]) gl_gettimeofday_timezone=void if test $ac_cv_func_gettimeofday != yes; then HAVE_GETTIMEOFDAY=0 else AC_CACHE_CHECK([for gettimeofday with POSIX signature], [gl_cv_func_gettimeofday_posix_signature], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/time.h> struct timeval c; int gettimeofday (struct timeval *restrict, void *restrict); ]], [[/* glibc uses struct timezone * rather than the POSIX void * if _GNU_SOURCE is defined. However, since the only portable use of gettimeofday uses NULL as the second parameter, and since the glibc definition is actually more typesafe, it is not worth wrapping this to get a compliant signature. */ int (*f) (struct timeval *restrict, void *restrict) = gettimeofday; int x = f (&c, 0); return !(x | c.tv_sec | c.tv_usec); ]])], [gl_cv_func_gettimeofday_posix_signature=yes], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/time.h> int gettimeofday (struct timeval *restrict, struct timezone *restrict); ]])], [gl_cv_func_gettimeofday_posix_signature=almost], [gl_cv_func_gettimeofday_posix_signature=no])])]) if test $gl_cv_func_gettimeofday_posix_signature = almost; then gl_gettimeofday_timezone='struct timezone' elif test $gl_cv_func_gettimeofday_posix_signature != yes; then REPLACE_GETTIMEOFDAY=1 fi dnl If we override 'struct timeval', we also have to override gettimeofday. if test $REPLACE_STRUCT_TIMEVAL = 1; then REPLACE_GETTIMEOFDAY=1 fi dnl On mingw, the original gettimeofday has only a precision of 15.6 dnl milliseconds. So override it. case "$host_os" in mingw*) REPLACE_GETTIMEOFDAY=1 ;; esac fi AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone], [Define this to 'void' or 'struct timezone' to match the system's declaration of the second argument to gettimeofday.]) ]) # Prerequisites of lib/gettimeofday.c. AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [:]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/error.m4��������������������������������������������������������������������0000664�0001750�0001750�00000001510�14670377440�016356� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#serial 14 # Copyright (C) 1996-1998, 2001-2004, 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_ERROR], [ dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer dnl maintained in Autoconf and because it invokes AC_LIBOBJ. AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <error.h>]], [[error_at_line (0, 0, "", 0, "an error occurred");]])], [ac_cv_lib_error_at_line=yes], [ac_cv_lib_error_at_line=no])]) ]) # Prerequisites of lib/error.c. AC_DEFUN([gl_PREREQ_ERROR], [ AC_REQUIRE([AC_FUNC_STRERROR_R]) : ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/c-stack.m4������������������������������������������������������������������0000664�0001750�0001750�00000001203�14670377440�016551� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Check prerequisites for compiling lib/c-stack.c. # Copyright (C) 2002-2004, 2008-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. # serial 23 AC_DEFUN([gl_C_STACK], [ dnl 'c-stack' needs -lsigsegv if and only if the 'sigsegv' module needs it. if test "$with_libsigsegv" = yes; then if test "$gl_cv_lib_sigsegv" = yes; then AC_SUBST([LIBCSTACK], [$LIBSIGSEGV]) AC_SUBST([LTLIBCSTACK], [$LTLIBSIGSEGV]) fi fi ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/dup2.m4���������������������������������������������������������������������0000664�0001750�0001750�00000007236�14670377440�016112� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#serial 27 dnl Copyright (C) 2002, 2005, 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_DUP2], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], [AC_RUN_IFELSE([ AC_LANG_PROGRAM( [[#include <errno.h> #include <fcntl.h> #include <limits.h> #include <sys/resource.h> #include <unistd.h> ]GL_MDA_DEFINES[ #ifndef RLIM_SAVED_CUR # define RLIM_SAVED_CUR RLIM_INFINITY #endif #ifndef RLIM_SAVED_MAX # define RLIM_SAVED_MAX RLIM_INFINITY #endif ]], [[int result = 0; int bad_fd = INT_MAX; struct rlimit rlim; if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX && rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur != RLIM_SAVED_MAX && rlim.rlim_cur != RLIM_SAVED_CUR) bad_fd = rlim.rlim_cur; #ifdef FD_CLOEXEC if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) result |= 1; #endif if (dup2 (1, 1) != 1) result |= 2; #ifdef FD_CLOEXEC if (fcntl (1, F_GETFD) != FD_CLOEXEC) result |= 4; #endif close (0); if (dup2 (0, 0) != -1) result |= 8; /* Many gnulib modules require POSIX conformance of EBADF. */ if (dup2 (2, bad_fd) == -1 && errno != EBADF) result |= 16; /* Flush out some cygwin core dumps. */ if (dup2 (2, -1) != -1 || errno != EBADF) result |= 32; dup2 (2, 255); dup2 (2, 256); /* On OS/2 kLIBC, dup2() does not work on a directory fd. */ { int fd = open (".", O_RDONLY); if (fd == -1) result |= 64; else if (dup2 (fd, fd + 1) == -1) result |= 128; close (fd); } return result;]]) ], [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], [case "$host_os" in mingw*) # on this platform, dup2 always returns 0 for success gl_cv_func_dup2_works="guessing no" ;; cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 gl_cv_func_dup2_works="guessing no" ;; aix* | freebsd*) # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, # not EBADF. gl_cv_func_dup2_works="guessing no" ;; haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. gl_cv_func_dup2_works="guessing no" ;; *-android*) # implemented using dup3(), which fails if oldfd == newfd gl_cv_func_dup2_works="guessing no" ;; os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd. gl_cv_func_dup2_works="guessing no" ;; *) gl_cv_func_dup2_works="guessing yes" ;; esac]) ]) case "$gl_cv_func_dup2_works" in *yes) ;; *) REPLACE_DUP2=1 AC_CHECK_FUNCS([setdtablesize]) ;; esac dnl Replace dup2() for supporting the gnulib-defined fchdir() function, dnl to keep fchdir's bookkeeping up-to-date. m4_ifdef([gl_FUNC_FCHDIR], [ gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then REPLACE_DUP2=1 fi ]) ]) # Prerequisites of lib/dup2.c. AC_DEFUN([gl_PREREQ_DUP2], []) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sched_h.m4������������������������������������������������������������������0000664�0001750�0001750�00000006363�14670377450�016636� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sched_h.m4 serial 15 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Bruno Haible. AC_DEFUN_ONCE([gl_SCHED_H], [ dnl Ensure to expand the default settings once only, before all statements dnl that occur in other macros. AC_REQUIRE([gl_SCHED_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) AC_CHECK_HEADERS([sched.h], [], [], [[#if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif ]]) gl_NEXT_HEADERS([sched.h]) if test "$ac_cv_header_sched_h" = yes; then HAVE_SCHED_H=1 else HAVE_SCHED_H=0 fi AC_SUBST([HAVE_SCHED_H]) if test "$HAVE_SCHED_H" = 1; then AC_CHECK_TYPE([struct sched_param], [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0], [[#if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif #include <sched.h> ]]) else HAVE_STRUCT_SCHED_PARAM=0 case "$host_os" in os2*) dnl On OS/2 kLIBC, struct sched_param is in spawn.h. AC_CHECK_TYPE([struct sched_param], [HAVE_STRUCT_SCHED_PARAM=1], [], [#include <spawn.h>]) ;; vms) dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h. AC_CHECK_TYPE([struct sched_param], [HAVE_STRUCT_SCHED_PARAM=1], [], [#include <pthread.h>]) ;; esac fi AC_SUBST([HAVE_STRUCT_SCHED_PARAM]) if test "$ac_cv_header_sys_cdefs_h" = yes; then HAVE_SYS_CDEFS_H=1 else HAVE_SYS_CDEFS_H=0 fi AC_SUBST([HAVE_SYS_CDEFS_H]) dnl Ensure the type pid_t gets defined. AC_REQUIRE([AC_TYPE_PID_T]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, if it is not common dnl enough to be declared everywhere. gl_WARN_ON_USE_PREPARE([[#include <sched.h> ]], [sched_yield]) ]) # gl_SCHED_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SCHED_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_SCHED_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_SCHED_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCHED_YIELD]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_SCHED_H_DEFAULTS]) ]) AC_DEFUN([gl_SCHED_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_SCHED_YIELD=1; AC_SUBST([HAVE_SCHED_YIELD]) REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD]) ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/wmempcpy.m4�����������������������������������������������������������������0000664�0001750�0001750�00000001204�14670377450�017067� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# wmempcpy.m4 serial 1 dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_WMEMPCPY], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) dnl Persuade glibc <wchar.h> to declare wmempcpy(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl The wmempcpy() declaration in lib/wchar.in.h uses 'restrict'. AC_REQUIRE([AC_C_RESTRICT]) AC_CHECK_FUNCS_ONCE([wmempcpy]) if test $ac_cv_func_wmempcpy = no; then HAVE_WMEMPCPY=0 fi ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/lib-ld.m4�������������������������������������������������������������������0000664�0001750�0001750�00000012370�14670377450�016377� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# lib-ld.m4 serial 10 dnl Copyright (C) 1996-2003, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Subroutines of libtool.m4, dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid dnl collision with libtool.m4. dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], [# I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 </dev/null` in *GNU* | *'with BFD'*) acl_cv_prog_gnu_ld=yes ;; *) acl_cv_prog_gnu_ld=no ;; esac]) with_gnu_ld=$acl_cv_prog_gnu_ld ]) dnl From libtool-2.4. Sets the variable LD. AC_DEFUN([AC_LIB_PROG_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld [default=no]])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi if test -n "$LD"; then AC_MSG_CHECKING([for ld]) elif test "$GCC" = yes; then AC_MSG_CHECKING([for ld used by $CC]) elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi if test -n "$LD"; then # Let the user override the test with a path. : else AC_CACHE_VAL([acl_cv_path_LD], [ acl_cv_path_LD= # Final result of this test ac_prog=ld # Program to search in $PATH if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) acl_output=`($CC -print-prog-name=ld) 2>&5` ;; esac case $acl_output in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` done # Got the pathname. No search in PATH is needed. acl_cv_path_LD="$acl_output" ac_prog= ;; "") # If it fails, then pretend we aren't using GCC. ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac fi if test -n "$ac_prog"; then # Search for $ac_prog in $PATH. acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$acl_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$acl_save_ifs" fi case $host in *-*-aix*) AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail #endif ]])], [# The compiler produces 64-bit code. Add option '-b64' so that the # linker groks 64-bit object files. case "$acl_cv_path_LD " in *" -b64 "*) ;; *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; esac ], []) ;; sparc64-*-netbsd*) AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif ]])], [], [# The compiler produces 32-bit code. Add option '-m elf32_sparc' # so that the linker groks 32-bit object files. case "$acl_cv_path_LD " in *" -m elf32_sparc "*) ;; *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; esac ]) ;; esac ]) LD="$acl_cv_path_LD" fi if test -n "$LD"; then AC_MSG_RESULT([$LD]) else AC_MSG_RESULT([no]) AC_MSG_ERROR([no acceptable ld found in \$PATH]) fi AC_LIB_PROG_LD_GNU ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/strdup.m4�������������������������������������������������������������������0000664�0001750�0001750�00000001455�14670377450�016557� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# strdup.m4 serial 15 dnl Copyright (C) 2002-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRDUP], [ AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_DECLS_ONCE([strdup]) if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 fi ]) AC_DEFUN([gl_FUNC_STRDUP_POSIX], [ AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) if test $gl_cv_func_malloc_posix != yes; then REPLACE_STRDUP=1 fi AC_CHECK_DECLS_ONCE([strdup]) if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 fi ]) # Prerequisites of lib/strdup.c. AC_DEFUN([gl_PREREQ_STRDUP], [:]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/closedir.m4�����������������������������������������������������������������0000664�0001750�0001750�00000001674�14670377440�017044� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# closedir.m4 serial 6 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_CLOSEDIR], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS([closedir]) if test $ac_cv_func_closedir = no; then HAVE_CLOSEDIR=0 fi dnl Replace closedir() for supporting the gnulib-defined fchdir() function, dnl to keep fchdir's bookkeeping up-to-date. m4_ifdef([gl_FUNC_FCHDIR], [ gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then if test $HAVE_CLOSEDIR = 1; then REPLACE_CLOSEDIR=1 fi fi ]) dnl Replace closedir() for supporting the gnulib-defined dirfd() function. case $host_os,$HAVE_CLOSEDIR in os2*,1) REPLACE_CLOSEDIR=1;; esac ]) ��������������������������������������������������������������������kbuild-3608/src/grep/m4/pthread_sigmask.m4����������������������������������������������������������0000664�0001750�0001750�00000022755�14670377450�020411� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pthread_sigmask.m4 serial 21 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([pthread_sigmask]) dnl On MinGW pthread_sigmask is just a macro which always returns 0. dnl It does not exist as a real function, which is required by POSIX. AC_CACHE_CHECK([whether pthread_sigmask is a macro], [gl_cv_func_pthread_sigmask_macro], [AC_EGREP_CPP([headers_define_pthread_sigmask], [ #include <pthread.h> #include <signal.h> #ifdef pthread_sigmask headers_define_pthread_sigmask #endif], [gl_cv_func_pthread_sigmask_macro=yes], [gl_cv_func_pthread_sigmask_macro=no]) ]) LIB_PTHREAD_SIGMASK= if test $gl_cv_func_pthread_sigmask_macro = yes; then dnl pthread_sigmask is a dummy macro. HAVE_PTHREAD_SIGMASK=0 dnl Make sure to '#undef pthread_sigmask' before defining it. REPLACE_PTHREAD_SIGMASK=1 else dnl Test whether the gnulib module 'threadlib' is in use. dnl Some packages like Emacs use --avoid=threadlib. dnl Write the symbol in such a way that it does not cause 'aclocal' to pick dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/. m4_ifdef([gl_][THREADLIB], [ AC_REQUIRE([gl_][THREADLIB]) if test "$gl_threads_api" = posix; then if test $ac_cv_func_pthread_sigmask = yes; then dnl pthread_sigmask is available without -lpthread. : else if test -n "$LIBMULTITHREAD"; then AC_CACHE_CHECK([for pthread_sigmask in $LIBMULTITHREAD], [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD], [gl_save_LIBS="$LIBS" LIBS="$LIBS $LIBMULTITHREAD" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <pthread.h> #include <signal.h> ]], [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]]) ], [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes], [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no]) LIBS="$gl_save_LIBS" ]) if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then dnl pthread_sigmask is available with -pthread or -lpthread. LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD" else dnl pthread_sigmask is not available at all. HAVE_PTHREAD_SIGMASK=0 fi else dnl pthread_sigmask is not available at all. HAVE_PTHREAD_SIGMASK=0 fi fi else dnl pthread_sigmask may exist but does not interoperate with the chosen dnl multithreading facility. if test $ac_cv_func_pthread_sigmask = yes; then REPLACE_PTHREAD_SIGMASK=1 else HAVE_PTHREAD_SIGMASK=0 fi fi ], [ dnl The module 'threadlib' is not in use, due to --avoid=threadlib being dnl specified. dnl The package either has prepared CPPFLAGS and LIBS for use of dnl POSIX:2008 threads, or wants to build single-threaded programs. if test $ac_cv_func_pthread_sigmask = yes; then dnl pthread_sigmask exists and does not require extra libraries. dnl Assume that it is declared. : else dnl pthread_sigmask either does not exist or needs extra libraries. HAVE_PTHREAD_SIGMASK=0 dnl Define the symbol rpl_pthread_sigmask, not pthread_sigmask, dnl so as to not accidentally override the system's pthread_sigmask dnl symbol from libpthread. This is necessary on IRIX 6.5. REPLACE_PTHREAD_SIGMASK=1 fi ]) fi AC_SUBST([LIB_PTHREAD_SIGMASK]) dnl We don't need a variable LTLIB_PTHREAD_SIGMASK, because when dnl "$gl_threads_api" = posix, $LTLIBMULTITHREAD and $LIBMULTITHREAD are the dnl same. dnl Now test for some bugs in the system function. if test $HAVE_PTHREAD_SIGMASK = 1; then AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl On FreeBSD 13.0, MidnightBSD 1.1, HP-UX 11.31, Solaris 9, in programs dnl that are not linked with -lpthread, the pthread_sigmask() function dnl always returns 0 and has no effect. if test -z "$LIB_PTHREAD_SIGMASK"; then case " $LIBS " in *' -pthread '*) ;; *' -lpthread '*) ;; *) AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread], [gl_cv_func_pthread_sigmask_in_libc_works], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <pthread.h> #include <signal.h> #include <stddef.h> int main () { sigset_t set; sigemptyset (&set); return pthread_sigmask (1729, &set, NULL) != 0; }]])], [gl_cv_func_pthread_sigmask_in_libc_works=no], [gl_cv_func_pthread_sigmask_in_libc_works=yes], [ changequote(,)dnl case "$host_os" in freebsd* | midnightbsd* | hpux* | solaris | solaris2.[2-9]*) gl_cv_func_pthread_sigmask_in_libc_works="guessing no";; *) gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";; esac changequote([,])dnl ]) ]) case "$gl_cv_func_pthread_sigmask_in_libc_works" in *no) REPLACE_PTHREAD_SIGMASK=1 AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1], [Define to 1 if pthread_sigmask may return 0 and have no effect.]) ;; esac;; esac fi dnl On Cygwin 1.7.5, the pthread_sigmask() has a wrong return value dnl convention: Upon failure, it returns -1 and sets errno. AC_CACHE_CHECK([whether pthread_sigmask returns error numbers], [gl_cv_func_pthread_sigmask_return_works], [ gl_save_LIBS="$LIBS" LIBS="$LIBS $LIB_PTHREAD_SIGMASK" AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <pthread.h> #include <signal.h> #include <stddef.h> int main () { sigset_t set; sigemptyset (&set); if (pthread_sigmask (1729, &set, NULL) == -1) return 1; return 0; }]])], [gl_cv_func_pthread_sigmask_return_works=yes], [gl_cv_func_pthread_sigmask_return_works=no], [case "$host_os" in cygwin*) gl_cv_func_pthread_sigmask_return_works="guessing no";; *) gl_cv_func_pthread_sigmask_return_works="guessing yes";; esac ]) LIBS="$gl_save_LIBS" ]) case "$gl_cv_func_pthread_sigmask_return_works" in *no) REPLACE_PTHREAD_SIGMASK=1 AC_DEFINE([PTHREAD_SIGMASK_FAILS_WITH_ERRNO], [1], [Define to 1 if pthread_sigmask(), when it fails, returns -1 and sets errno.]) ;; esac dnl On IRIX 6.5, in a single-threaded program, pending signals are not dnl immediately delivered when they are unblocked through pthread_sigmask, dnl only a little while later. AC_CACHE_CHECK([whether pthread_sigmask unblocks signals correctly], [gl_cv_func_pthread_sigmask_unblock_works], [ case "$host_os" in irix*) gl_cv_func_pthread_sigmask_unblock_works="guessing no";; *) gl_cv_func_pthread_sigmask_unblock_works="guessing yes";; esac m4_ifdef([gl_][THREADLIB], [dnl Link against $LIBMULTITHREAD, not only $LIB_PTHREAD_SIGMASK. dnl Otherwise we get a false positive on those platforms where dnl $gl_cv_func_pthread_sigmask_in_libc_works is "no". gl_save_LIBS=$LIBS LIBS="$LIBS $LIBMULTITHREAD"]) AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <pthread.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> ]GL_MDA_DEFINES[ static volatile int sigint_occurred; static void sigint_handler (int sig) { sigint_occurred++; } int main () { sigset_t set; int pid = getpid (); char command[80]; signal (SIGINT, sigint_handler); sigemptyset (&set); sigaddset (&set, SIGINT); if (!(pthread_sigmask (SIG_BLOCK, &set, NULL) == 0)) return 1; sprintf (command, "sh -c 'sleep 1; kill -%d %d' &", SIGINT, pid); if (!(system (command) == 0)) return 2; sleep (2); if (!(sigint_occurred == 0)) return 3; if (!(pthread_sigmask (SIG_UNBLOCK, &set, NULL) == 0)) return 4; if (!(sigint_occurred == 1)) /* This fails on IRIX. */ return 5; return 0; }]])], [:], [gl_cv_func_pthread_sigmask_unblock_works=no], [:]) m4_ifdef([gl_][THREADLIB], [LIBS=$gl_save_LIBS]) ]) case "$gl_cv_func_pthread_sigmask_unblock_works" in *no) REPLACE_PTHREAD_SIGMASK=1 AC_DEFINE([PTHREAD_SIGMASK_UNBLOCK_BUG], [1], [Define to 1 if pthread_sigmask() unblocks signals incorrectly.]) ;; esac fi ]) # Prerequisite of lib/pthread_sigmask.c. AC_DEFUN([gl_PREREQ_PTHREAD_SIGMASK], [ if test $HAVE_PTHREAD_SIGMASK = 1; then AC_DEFINE([HAVE_PTHREAD_SIGMASK], [1], [Define to 1 if the pthread_sigmask function can be used (despite bugs).]) fi ]) �������������������kbuild-3608/src/grep/m4/inet_pton.m4����������������������������������������������������������������0000664�0001750�0001750�00000004460�14670377450�017234� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# inet_pton.m4 serial 19 dnl Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_INET_PTON], [ AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) dnl Persuade Solaris <arpa/inet.h> to declare inet_pton. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_C_RESTRICT]) dnl Most platforms that provide inet_pton define it in libc. dnl Solaris 8..10 provide inet_pton in libnsl instead. dnl Solaris 2.6..7 provide inet_pton in libresolv instead. dnl Haiku provides it in -lnetwork. dnl Native Windows provides it in -lws2_32 instead, with a declaration in dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it). HAVE_INET_PTON=1 INET_PTON_LIB= gl_PREREQ_SYS_H_WINSOCK2 if test $HAVE_WINSOCK2_H = 1; then dnl It needs to be overridden, because the stdcall calling convention dnl is not compliant with POSIX. Set REPLACE_INET_PTON in order to avoid dnl a name conflict at the linker level, even though the header file dnl <ws2tcpip.h> declares inet_pton only if _WIN32_WINNT >= 0x0600. REPLACE_INET_PTON=1 AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]]) if test $ac_cv_have_decl_inet_pton = yes; then INET_PTON_LIB="-lws2_32" else HAVE_DECL_INET_PTON=0 fi else gl_save_LIBS=$LIBS AC_SEARCH_LIBS([inet_pton], [nsl resolv network], [], [AC_CHECK_FUNCS([inet_pton]) if test $ac_cv_func_inet_pton = no; then HAVE_INET_PTON=0 fi ]) LIBS=$gl_save_LIBS if test "$ac_cv_search_inet_pton" != "no" \ && test "$ac_cv_search_inet_pton" != "none required"; then INET_PTON_LIB="$ac_cv_search_inet_pton" fi AC_CHECK_HEADERS_ONCE([netdb.h]) AC_CHECK_DECLS([inet_pton],,, [[#include <arpa/inet.h> #if HAVE_NETDB_H # include <netdb.h> #endif ]]) if test $ac_cv_have_decl_inet_pton = no; then HAVE_DECL_INET_PTON=0 fi fi AC_SUBST([INET_PTON_LIB]) ]) # Prerequisites of lib/inet_pton.c. AC_DEFUN([gl_PREREQ_INET_PTON], [ AC_REQUIRE([gl_SOCKET_FAMILIES]) ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/dirfd.m4��������������������������������������������������������������������0000664�0001750�0001750�00000005135�14670377440�016324� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 26 -*- Autoconf -*- dnl Find out how to get the file descriptor associated with an open DIR*. # Copyright (C) 2001-2006, 2008-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. dnl From Jim Meyering AC_DEFUN([gl_FUNC_DIRFD], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade glibc <dirent.h> to declare dirfd(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_CHECK_FUNCS([dirfd]) AC_CHECK_DECLS([dirfd], , , [[#include <sys/types.h> #include <dirent.h>]]) if test $ac_cv_have_decl_dirfd = no; then HAVE_DECL_DIRFD=0 fi AC_CACHE_CHECK([whether dirfd is a macro], [gl_cv_func_dirfd_macro], [AC_EGREP_CPP([dirent_header_defines_dirfd], [ #include <sys/types.h> #include <dirent.h> #ifdef dirfd dirent_header_defines_dirfd #endif], [gl_cv_func_dirfd_macro=yes], [gl_cv_func_dirfd_macro=no])]) # Use the replacement if we have no function or macro with that name, # or if OS/2 kLIBC whose dirfd() does not work. # Replace only if the system declares dirfd already. case $ac_cv_func_dirfd,$gl_cv_func_dirfd_macro,$host_os,$ac_cv_have_decl_dirfd in no,no,*,yes | *,*,os2*,yes) REPLACE_DIRFD=1 AC_DEFINE([REPLACE_DIRFD], [1], [Define to 1 if gnulib's dirfd() replacement is used.]);; esac ]) dnl Prerequisites of lib/dirfd.c. AC_DEFUN([gl_PREREQ_DIRFD], [ AC_CACHE_CHECK([how to get the file descriptor associated with an open DIR*], [gl_cv_sys_dir_fd_member_name], [ dirfd_save_CFLAGS=$CFLAGS for ac_expr in d_fd dd_fd; do CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <dirent.h>]], [[DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;]])], [dir_fd_found=yes] ) CFLAGS=$dirfd_save_CFLAGS test "$dir_fd_found" = yes && break done test "$dir_fd_found" = yes || ac_expr=no_such_member gl_cv_sys_dir_fd_member_name=$ac_expr ] ) if test $gl_cv_sys_dir_fd_member_name != no_such_member; then AC_DEFINE_UNQUOTED([DIR_FD_MEMBER_NAME], [$gl_cv_sys_dir_fd_member_name], [the name of the file descriptor member of DIR]) fi AH_VERBATIM([DIR_TO_FD], [#ifdef DIR_FD_MEMBER_NAME # define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME) #else # define DIR_TO_FD(Dir_p) -1 #endif ]) ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/intmax_t.m4�����������������������������������������������������������������0000664�0001750�0001750�00000003544�14670377450�017062� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# intmax_t.m4 serial 9 dnl Copyright (C) 1997-2004, 2006-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. AC_PREREQ([2.53]) # Define intmax_t to 'long' or 'long long' # if it is not already defined in <stdint.h> or <inttypes.h>. AC_DEFUN([gl_AC_TYPE_INTMAX_T], [ dnl For simplicity, we assume that a header file defines 'intmax_t' if and dnl only if it defines 'uintmax_t'. AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then AC_DEFINE_UNQUOTED([intmax_t], [long long], [Define to long or long long if <inttypes.h> and <stdint.h> don't define.]) else AC_DEFINE([HAVE_INTMAX_T], [1], [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) fi ]) dnl An alternative would be to explicitly test for 'intmax_t'. AC_DEFUN([gt_AC_TYPE_INTMAX_T], [ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ #include <stddef.h> #include <stdlib.h> #if HAVE_STDINT_H_WITH_UINTMAX #include <stdint.h> #endif #if HAVE_INTTYPES_H_WITH_UINTMAX #include <inttypes.h> #endif ]], [[intmax_t x = -1; return !x;]])], [gt_cv_c_intmax_t=yes], [gt_cv_c_intmax_t=no])]) if test $gt_cv_c_intmax_t = yes; then AC_DEFINE([HAVE_INTMAX_T], [1], [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) else AC_DEFINE_UNQUOTED([intmax_t], [long long], [Define to long or long long if <stdint.h> and <inttypes.h> don't define.]) fi ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/stddef_h.m4�����������������������������������������������������������������0000664�0001750�0001750�00000007157�14670377450�017023� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# stddef_h.m4 serial 11 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl A placeholder for <stddef.h>, for platforms that have issues. AC_DEFUN_ONCE([gl_STDDEF_H], [ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) dnl Persuade OpenBSD <stddef.h> to declare max_align_t. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) STDDEF_H= dnl Test whether the type max_align_t exists and whether its alignment dnl "is as great as is supported by the implementation in all contexts". AC_CACHE_CHECK([for good max_align_t], [gl_cv_type_max_align_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <stddef.h> unsigned int s = sizeof (max_align_t); #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; #endif typedef struct { char a; max_align_t b; } max_helper; typedef struct { char a; long b; } long_helper; typedef struct { char a; double b; } double_helper; typedef struct { char a; long double b; } long_double_helper; int check3[2 * (offsetof (long_helper, b) <= offsetof (max_helper, b)) - 1]; int check4[2 * (offsetof (double_helper, b) <= offsetof (max_helper, b)) - 1]; int check5[2 * (offsetof (long_double_helper, b) <= offsetof (max_helper, b)) - 1]; ]])], [gl_cv_type_max_align_t=yes], [gl_cv_type_max_align_t=no]) ]) if test $gl_cv_type_max_align_t = no; then HAVE_MAX_ALIGN_T=0 STDDEF_H=stddef.h fi if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h fi AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], [gl_cv_decl_null_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> int test[2 * (sizeof NULL == sizeof (void *)) -1]; ]])], [gl_cv_decl_null_works=yes], [gl_cv_decl_null_works=no])]) if test $gl_cv_decl_null_works = no; then REPLACE_NULL=1 STDDEF_H=stddef.h fi AC_SUBST([STDDEF_H]) AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) if test -n "$STDDEF_H"; then gl_NEXT_HEADERS([stddef.h]) fi ]) # gl_STDDEF_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_STDDEF_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS], [ ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) ]) AC_DEFUN([gl_STDDEF_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/stack-direction.m4����������������������������������������������������������0000664�0001750�0001750�00000005305�14670377450�020317� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# stack-direction.m4 serial 7 dnl Copyright (C) 2002-2021 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl Written by Bruno Haible. # Determine the stack direction. Define the C macro STACK_DIRECTION. AC_DEFUN([SV_STACK_DIRECTION], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([for stack direction], [sv_cv_stack_direction_msg], [ case "$host_cpu" in dnl See the #define STACK_GROWS_DOWNWARD in gcc-3.1/gcc/config/*/*.h. a29k | \ aarch64* | \ alpha* | \ arc | \ arm* | strongarm* | xscale* | \ avr | avr32 | \ bfin | \ c1 | c2 | c32 | c34 | c38 | \ clipper | \ cris | \ d30v | \ elxsi | \ fr30 | \ h8300 | \ i?86 | x86_64 | \ i860 | \ ia64 | \ m32r | \ m68* | \ m88k | \ mcore | \ microblaze | \ mips* | \ mmix | \ mn10200 | \ mn10300 | \ nios2 | \ nds32* | \ ns32k | \ pdp11 | \ pj* | \ powerpc* | rs6000 | \ riscv* | \ romp | \ s390* | \ sh* | \ sparc* | \ v850 | \ vax | \ xtensa) sv_cv_stack_direction=-1 ;; c4x | \ dsp16xx | \ i960 | \ hppa* | parisc* | \ stormy16 | \ we32k) sv_cv_stack_direction=1 ;; *) if test $cross_compiling = no; then cat > conftest.c <<EOF #include <stdio.h> int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char *argv[]) { printf ("%d\n", find_stack_direction (NULL, argc + 20)); return 0; } EOF AC_TRY_EVAL([ac_link]) sv_cv_stack_direction=`./conftest` else sv_cv_stack_direction=0 fi ;; esac case $sv_cv_stack_direction in 1) sv_cv_stack_direction_msg="grows up";; -1) sv_cv_stack_direction_msg="grows down";; *) sv_cv_stack_direction_msg="unknown";; esac ]) AC_DEFINE_UNQUOTED([STACK_DIRECTION], [$sv_cv_stack_direction], [Define as the direction of stack growth for your system. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => spaghetti stack.]) ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/limits-h.m4�����������������������������������������������������������������0000664�0001750�0001750�00000002466�14670377450�016767� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������dnl Check whether limits.h has needed features. dnl Copyright 2016-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. AC_DEFUN_ONCE([gl_LIMITS_H], [ gl_CHECK_NEXT_HEADERS([limits.h]) AC_CACHE_CHECK([whether limits.h has WORD_BIT, BOOL_WIDTH etc.], [gl_cv_header_limits_width], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 #endif #include <limits.h> long long llm = LLONG_MAX; int wb = WORD_BIT; int ullw = ULLONG_WIDTH; int bw = BOOL_WIDTH; ]])], [gl_cv_header_limits_width=yes], [gl_cv_header_limits_width=no])]) if test "$gl_cv_header_limits_width" = yes; then LIMITS_H= else LIMITS_H=limits.h fi AC_SUBST([LIMITS_H]) AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) ]) dnl Unconditionally enables the replacement of <limits.h>. AC_DEFUN([gl_REPLACE_LIMITS_H], [ AC_REQUIRE([gl_LIMITS_H]) LIMITS_H='limits.h' AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/lock.m4���������������������������������������������������������������������0000664�0001750�0001750�00000003037�14670377450�016164� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# lock.m4 serial 14 dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN([gl_LOCK], [ AC_REQUIRE([gl_THREADLIB]) if test "$gl_threads_api" = posix; then # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the # pthread_rwlock_* functions. has_rwlock=false AC_CHECK_TYPE([pthread_rwlock_t], [has_rwlock=true AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], [Define if the POSIX multithreading library has read/write locks.])], [], [#include <pthread.h>]) if $has_rwlock; then gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER fi # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. AC_COMPILE_IFELSE([ AC_LANG_PROGRAM( [[#include <pthread.h>]], [[ #if __FreeBSD__ == 4 error "No, in FreeBSD 4.0 recursive mutexes actually don't work." #elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) error "No, in Mac OS X < 10.7 recursive mutexes actually don't work." #else int x = (int)PTHREAD_MUTEX_RECURSIVE; return !x; #endif ]])], [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1], [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])]) fi gl_PREREQ_LOCK ]) # Prerequisites of lib/glthread/lock.c. AC_DEFUN([gl_PREREQ_LOCK], [:]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mbiter.m4�������������������������������������������������������������������0000664�0001750�0001750�00000000642�14670377450�016515� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mbiter.m4 serial 7 dnl Copyright (C) 2005, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl autoconf tests required for use of mbiter.h dnl From Bruno Haible. AC_DEFUN([gl_MBITER], [ AC_REQUIRE([AC_TYPE_MBSTATE_T]) : ]) ����������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/dirent_h.m4�����������������������������������������������������������������0000664�0001750�0001750�00000006222�14670377440�017026� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# dirent_h.m4 serial 19 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Bruno Haible. AC_DEFUN_ONCE([gl_DIRENT_H], [ dnl Ensure to expand the default settings once only, before all statements dnl that occur in other macros. AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) dnl <dirent.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([dirent.h]) if test $ac_cv_header_dirent_h = yes; then HAVE_DIRENT_H=1 else HAVE_DIRENT_H=0 fi AC_SUBST([HAVE_DIRENT_H]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <dirent.h> ]], [alphasort closedir dirfd fdopendir opendir readdir rewinddir scandir]) ]) # gl_DIRENT_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_DIRENT_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_DIRENT_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_DIRENT_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_DIRENT_H_MODULE_INDICATOR_DEFAULTS], [ gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENDIR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READDIR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REWINDDIR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSEDIR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DIRFD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPENDIR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANDIR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALPHASORT]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_DIRENT_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) ]) AC_DEFUN([gl_DIRENT_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_OPENDIR=1; AC_SUBST([HAVE_OPENDIR]) HAVE_READDIR=1; AC_SUBST([HAVE_READDIR]) HAVE_REWINDDIR=1; AC_SUBST([HAVE_REWINDDIR]) HAVE_CLOSEDIR=1; AC_SUBST([HAVE_CLOSEDIR]) HAVE_DECL_DIRFD=1; AC_SUBST([HAVE_DECL_DIRFD]) HAVE_DECL_FDOPENDIR=1;AC_SUBST([HAVE_DECL_FDOPENDIR]) HAVE_FDOPENDIR=1; AC_SUBST([HAVE_FDOPENDIR]) HAVE_SCANDIR=1; AC_SUBST([HAVE_SCANDIR]) HAVE_ALPHASORT=1; AC_SUBST([HAVE_ALPHASORT]) REPLACE_OPENDIR=0; AC_SUBST([REPLACE_OPENDIR]) REPLACE_CLOSEDIR=0; AC_SUBST([REPLACE_CLOSEDIR]) REPLACE_DIRFD=0; AC_SUBST([REPLACE_DIRFD]) REPLACE_FDOPENDIR=0; AC_SUBST([REPLACE_FDOPENDIR]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fstat.m4��������������������������������������������������������������������0000664�0001750�0001750�00000002117�14670377440�016352� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# fstat.m4 serial 8 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FSTAT], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) case "$host_os" in mingw* | solaris*) dnl On MinGW, the original stat() returns st_atime, st_mtime, dnl st_ctime values that are affected by the time zone. dnl Solaris stat can return a negative tv_nsec. REPLACE_FSTAT=1 ;; esac dnl Replace fstat() for supporting the gnulib-defined open() on directories. m4_ifdef([gl_FUNC_FCHDIR], [ gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then case "$gl_cv_func_open_directory_works" in *yes) ;; *) REPLACE_FSTAT=1 ;; esac fi ]) ]) # Prerequisites of lib/fstat.c and lib/stat-w32.c. AC_DEFUN([gl_PREREQ_FSTAT], [ AC_REQUIRE([gl_SYS_STAT_H]) AC_REQUIRE([gl_PREREQ_STAT_W32]) : ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/locale-fr.m4����������������������������������������������������������������0000664�0001750�0001750�00000024474�14670377450�017110� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# locale-fr.m4 serial 20 dnl Copyright (C) 2003, 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Determine the name of a french locale with traditional encoding. AC_DEFUN([gt_LOCALE_FR], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a traditional french locale], [gt_cv_locale_fr], [ AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; #endif } ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 else # None found. gt_cv_locale_fr=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO-8859-1 else # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.ISO8859-1 else # Test for the HP-UX locale name. if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else # Test for the Solaris 7 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else # None found. gt_cv_locale_fr=none fi fi fi fi fi ;; esac fi rm -fr conftest* ]) LOCALE_FR=$gt_cv_locale_fr AC_SUBST([LOCALE_FR]) ]) dnl Determine the name of a french locale with UTF-8 encoding. AC_DEFUN([gt_LOCALE_FR_UTF8], [ AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [ AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; } ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr_FR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr_utf8=fr.UTF-8 else # None found. gt_cv_locale_fr_utf8=none fi fi fi ;; esac fi rm -fr conftest* ]) LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 AC_SUBST([LOCALE_FR_UTF8]) ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/msvc-nothrow.m4�������������������������������������������������������������0000664�0001750�0001750�00000000530�14670377450�017675� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# msvc-nothrow.m4 serial 1 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_MSVC_NOTHROW], [ AC_REQUIRE([gl_MSVC_INVAL]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/gnulib-comp.m4��������������������������������������������������������������0000664�0001750�0001750�00000215534�14670377440�017456� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# DO NOT EDIT! GENERATED AUTOMATICALLY! # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file 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 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. # # You should have received a copy of the GNU General Public License # along with this file. If not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that # contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. # # This file represents the compiled summary of the specification in # gnulib-cache.m4. It lists the computed macro invocations that need # to be invoked from configure.ac. # In projects that use version control, this file can be treated like # other built files. # This macro should be invoked from ./configure.ac, in the section # "Checks for programs", right after AC_PROG_CC, and certainly before # any checks for libraries, header files, types and library functions. AC_DEFUN([gl_EARLY], [ m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace m4_pattern_allow([^gl_ES$])dnl a valid locale name m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable # Pre-early section. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_PROG_AR_RANLIB]) AC_REQUIRE([AM_PROG_CC_C_O]) # Code from module absolute-header: # Code from module accept: # Code from module accept-tests: # Code from module alignof: # Code from module alignof-tests: # Code from module alloca: # Code from module alloca-opt: # Code from module alloca-opt-tests: # Code from module announce-gen: # Code from module argmatch: # Code from module argmatch-tests: # Code from module arpa_inet: # Code from module arpa_inet-tests: # Code from module assert: # Code from module assure: # Code from module at-internal: # Code from module attribute: # Code from module basename-lgpl: # Code from module binary-io: # Code from module binary-io-tests: # Code from module bind: # Code from module bind-tests: # Code from module bitrotate: # Code from module bitrotate-tests: # Code from module btowc: # Code from module btowc-tests: # Code from module builtin-expect: # Code from module c-ctype: # Code from module c-ctype-tests: # Code from module c-stack: # Code from module c-stack-tests: # Code from module c-strcase: # Code from module c-strcase-tests: # Code from module c-strcaseeq: # Code from module c99: # Code from module calloc-gnu: # Code from module calloc-gnu-tests: # Code from module calloc-posix: # Code from module chdir: # Code from module chdir-long: # Code from module chdir-tests: # Code from module cloexec: # Code from module cloexec-tests: # Code from module close: # Code from module close-stream: # Code from module close-tests: # Code from module closedir: # Code from module closeout: # Code from module configmake: # Code from module connect: # Code from module connect-tests: # Code from module ctype: # Code from module ctype-tests: # Code from module cycle-check: # Code from module d-ino: # Code from module d-type: # Code from module dev-ino: # Code from module dfa: # Code from module dfa-tests: # Code from module dirent: # Code from module dirent-tests: # Code from module dirfd: # Code from module dirname-lgpl: # Code from module do-release-commit-and-tag: # Code from module double-slash-root: # Code from module dup: # Code from module dup-tests: # Code from module dup2: # Code from module dup2-tests: # Code from module dynarray: # Code from module dynarray-tests: # Code from module environ: # Code from module environ-tests: # Code from module errno: # Code from module errno-tests: # Code from module error: # Code from module exclude: # Code from module exclude-tests: # Code from module exitfail: # Code from module extensions: # Code from module extern-inline: # Code from module fchdir: # Code from module fchdir-tests: # Code from module fcntl: # Code from module fcntl-h: # Code from module fcntl-h-tests: # Code from module fcntl-safer: # Code from module fcntl-safer-tests: # Code from module fcntl-tests: # Code from module fd-hook: # Code from module fd-safer-flag: # Code from module fdl: # Code from module fdopen: # Code from module fdopen-tests: # Code from module fdopendir: # Code from module fdopendir-tests: # Code from module fgetc-tests: # Code from module filename: # Code from module filenamecat-lgpl: # Code from module flexmember: # Code from module float: # Code from module float-tests: # Code from module fnmatch: # Code from module fnmatch-h: # Code from module fnmatch-h-tests: # Code from module fnmatch-tests: # Code from module fopen: # Code from module fopen-gnu: # Code from module fopen-gnu-tests: # Code from module fopen-tests: # Code from module fpending: # Code from module fpending-tests: # Code from module fpieee: AC_REQUIRE([gl_FP_IEEE]) # Code from module fpucw: # Code from module fputc-tests: # Code from module fread-tests: # Code from module free-posix: # Code from module free-posix-tests: # Code from module fstat: # Code from module fstat-tests: # Code from module fstatat: # Code from module fstatat-tests: # Code from module ftruncate: # Code from module ftruncate-tests: # Code from module fts: # Code from module fwrite-tests: # Code from module gendocs: # Code from module getcwd-lgpl: # Code from module getcwd-lgpl-tests: # Code from module getdtablesize: # Code from module getdtablesize-tests: # Code from module getopt-gnu: # Code from module getopt-gnu-tests: # Code from module getopt-posix: # Code from module getopt-posix-tests: # Code from module getpagesize: # Code from module getprogname: # Code from module getprogname-tests: # Code from module gettext-h: # Code from module gettimeofday: # Code from module gettimeofday-tests: # Code from module git-version-gen: # Code from module gitlog-to-changelog: # Code from module gnu-web-doc-update: # Code from module gnumakefile: # Code from module gnupload: # Code from module gperf: # Code from module hard-locale: # Code from module hard-locale-tests: # Code from module hash: # Code from module hash-pjw: # Code from module hash-tests: # Code from module havelib: # Code from module host-cpu-c-abi: # Code from module i-ring: # Code from module i-ring-tests: # Code from module ialloc: # Code from module iconv: # Code from module iconv-h: # Code from module iconv-h-tests: # Code from module iconv-tests: # Code from module iconv_open: # Code from module idx: # Code from module ignore-value: # Code from module ignore-value-tests: # Code from module include_next: # Code from module inet_pton: # Code from module inet_pton-tests: # Code from module inline: # Code from module intprops: # Code from module intprops-tests: # Code from module inttostr: # Code from module inttostr-tests: # Code from module inttypes: # Code from module inttypes-incomplete: # Code from module inttypes-tests: # Code from module ioctl: # Code from module ioctl-tests: # Code from module isatty: # Code from module isatty-tests: # Code from module isblank: # Code from module isblank-tests: # Code from module iswblank: # Code from module iswblank-tests: # Code from module iswctype: # Code from module iswdigit: # Code from module iswdigit-tests: # Code from module iswxdigit: # Code from module iswxdigit-tests: # Code from module langinfo: # Code from module langinfo-tests: # Code from module largefile: AC_REQUIRE([AC_SYS_LARGEFILE]) AC_REQUIRE([gl_YEAR2038_EARLY]) # Code from module libc-config: # Code from module limits-h: # Code from module limits-h-tests: # Code from module listen: # Code from module listen-tests: # Code from module localcharset: # Code from module localcharset-tests: # Code from module locale: # Code from module locale-tests: # Code from module localeconv: # Code from module localeconv-tests: # Code from module localename: # Code from module localename-tests: # Code from module lock: # Code from module lseek: # Code from module lseek-tests: # Code from module lstat: # Code from module lstat-tests: # Code from module maintainer-makefile: # Code from module malloc-gnu: # Code from module malloc-gnu-tests: # Code from module malloc-posix: # Code from module malloca: # Code from module malloca-tests: # Code from module manywarnings: # Code from module mbchar: # Code from module mbiter: # Code from module mbrlen: # Code from module mbrtowc: # Code from module mbscasecmp: # Code from module mbscasecmp-tests: # Code from module mbsinit: # Code from module mbsinit-tests: # Code from module mbslen: # Code from module mbsrtowcs: # Code from module mbsrtowcs-tests: # Code from module mbsstr: # Code from module mbsstr-tests: # Code from module mbtowc: # Code from module mbuiter: # Code from module memchr: # Code from module memchr-tests: # Code from module memchr2: # Code from module memchr2-tests: # Code from module mempcpy: # Code from module memrchr: # Code from module memrchr-tests: # Code from module minmax: # Code from module msvc-inval: # Code from module msvc-nothrow: # Code from module multiarch: # Code from module nanosleep: # Code from module nanosleep-tests: # Code from module netinet_in: # Code from module netinet_in-tests: # Code from module nl_langinfo: # Code from module nl_langinfo-tests: # Code from module nocrash: # Code from module obstack: # Code from module open: # Code from module open-tests: # Code from module openat: # Code from module openat-die: # Code from module openat-h: # Code from module openat-safer: # Code from module openat-safer-tests: # Code from module openat-tests: # Code from module opendir: # Code from module opendirat: # Code from module pathmax: # Code from module pathmax-tests: # Code from module perl: # Code from module perror: # Code from module perror-tests: # Code from module pipe-posix: # Code from module pipe-posix-tests: # Code from module propername: # Code from module pthread-h: gl_ANYTHREADLIB_EARLY # Code from module pthread-h-tests: # Code from module pthread-thread: # Code from module pthread-thread-tests: # Code from module pthread_sigmask: # Code from module pthread_sigmask-tests: # Code from module putenv: # Code from module quote: # Code from module quotearg: # Code from module quotearg-simple: # Code from module quotearg-simple-tests: # Code from module raise: # Code from module raise-tests: # Code from module rawmemchr: # Code from module rawmemchr-tests: # Code from module read: # Code from module read-tests: # Code from module readdir: # Code from module readme-release: # Code from module realloc-gnu: # Code from module realloc-gnu-tests: # Code from module realloc-posix: # Code from module reallocarray: # Code from module reallocarray-tests: # Code from module regex: # Code from module regex-tests: # Code from module safe-read: # Code from module same-inode: # Code from module save-cwd: # Code from module sched: # Code from module sched-tests: # Code from module select: # Code from module select-tests: # Code from module setenv: # Code from module setenv-tests: # Code from module setlocale: # Code from module setlocale-null: # Code from module setlocale-null-tests: # Code from module setlocale-tests: # Code from module setsockopt: # Code from module setsockopt-tests: # Code from module sigaction: # Code from module sigaction-tests: # Code from module signal-h: # Code from module signal-h-tests: # Code from module sigprocmask: # Code from module sigprocmask-tests: # Code from module sigsegv: # Code from module sigsegv-tests: # Code from module size_max: # Code from module sleep: # Code from module sleep-tests: # Code from module snippet/_Noreturn: # Code from module snippet/arg-nonnull: # Code from module snippet/c++defs: # Code from module snippet/warn-on-use: # Code from module snprintf: # Code from module snprintf-tests: # Code from module socket: # Code from module socketlib: # Code from module sockets: # Code from module sockets-tests: # Code from module socklen: # Code from module ssize_t: # Code from module stat: # Code from module stat-tests: # Code from module stat-time: # Code from module stat-time-tests: # Code from module std-gnu11: # Code from module stdalign: # Code from module stdalign-tests: # Code from module stdarg: dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode dnl for the builtin va_copy to work. gl_PROG_CC_C99 arranges for this. gl_PROG_CC_C99 # Code from module stdarg-tests: # Code from module stdbool: # Code from module stdbool-tests: # Code from module stddef: # Code from module stddef-tests: # Code from module stdint: # Code from module stdint-tests: # Code from module stdio: # Code from module stdio-tests: # Code from module stdlib: # Code from module stdlib-tests: # Code from module stpcpy: # Code from module strdup-posix: # Code from module streq: # Code from module strerror: # Code from module strerror-override: # Code from module strerror-tests: # Code from module strerror_r-posix: # Code from module strerror_r-posix-tests: # Code from module striconv: # Code from module striconv-tests: # Code from module string: # Code from module string-tests: # Code from module strnlen: # Code from module strnlen-tests: # Code from module strnlen1: # Code from module strstr: # Code from module strstr-simple: # Code from module strstr-tests: # Code from module strtoimax: # Code from module strtoimax-tests: # Code from module strtoll: # Code from module strtoll-tests: # Code from module strtoull: # Code from module strtoull-tests: # Code from module strtoumax: # Code from module strtoumax-tests: # Code from module symlink: # Code from module symlink-tests: # Code from module sys_ioctl: # Code from module sys_ioctl-tests: # Code from module sys_select: # Code from module sys_select-tests: # Code from module sys_socket: # Code from module sys_socket-tests: # Code from module sys_stat: # Code from module sys_stat-tests: # Code from module sys_time: # Code from module sys_time-tests: # Code from module sys_types: # Code from module sys_types-tests: # Code from module sys_uio: # Code from module sys_uio-tests: # Code from module test-framework-sh: # Code from module test-framework-sh-tests: # Code from module thread: # Code from module thread-optim: # Code from module thread-tests: # Code from module threadlib: gl_THREADLIB_EARLY # Code from module time: # Code from module time-tests: # Code from module trim: # Code from module unistd: # Code from module unistd-safer: # Code from module unistd-safer-tests: # Code from module unistd-tests: # Code from module unistr/base: # Code from module unistr/u8-mbtoucr: # Code from module unistr/u8-mbtoucr-tests: # Code from module unistr/u8-uctomb: # Code from module unistr/u8-uctomb-tests: # Code from module unitypes: # Code from module uniwidth/base: # Code from module uniwidth/width: # Code from module uniwidth/width-tests: # Code from module unlocked-io: # Code from module unlocked-io-internal: # Code from module unsetenv: # Code from module unsetenv-tests: # Code from module update-copyright: # Code from module useless-if-before-free: # Code from module vasnprintf: # Code from module vasnprintf-tests: # Code from module vc-list-files: # Code from module vc-list-files-tests: # Code from module verify: # Code from module verify-tests: # Code from module version-etc: # Code from module version-etc-fsf: # Code from module version-etc-tests: # Code from module warnings: # Code from module wchar: # Code from module wchar-tests: # Code from module wcrtomb: # Code from module wcrtomb-tests: # Code from module wctob: # Code from module wctomb: # Code from module wctype-h: # Code from module wctype-h-tests: # Code from module wcwidth: # Code from module wcwidth-tests: # Code from module windows-mutex: # Code from module windows-once: # Code from module windows-recmutex: # Code from module windows-rwlock: # Code from module windows-stat-inodes: # Code from module windows-stat-override: # Code from module windows-thread: # Code from module windows-tls: # Code from module wmemchr: # Code from module wmempcpy: # Code from module xalloc: # Code from module xalloc-die: # Code from module xalloc-die-tests: # Code from module xalloc-oversized: # Code from module xbinary-io: # Code from module xsize: # Code from module xstriconv: # Code from module xstrtoimax: # Code from module xstrtoimax-tests: # Code from module xstrtol: # Code from module xstrtol-error: # Code from module xstrtol-tests: ]) # This macro should be invoked from ./configure.ac, in the section # "Check for header files, types and library functions". AC_DEFUN([gl_INIT], [ AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) gl_cond_libtool=false gl_libdeps= gl_ltlibdeps= gl_m4_base='m4' m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) m4_pushdef([gl_LIBSOURCES_LIST], []) m4_pushdef([gl_LIBSOURCES_DIR], []) m4_pushdef([GL_MACRO_PREFIX], [gl]) m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) gl_COMMON gl_source_base='lib' gl_FUNC_ALLOCA gl_ASSERT AC_REQUIRE([AC_CANONICAL_HOST]) gl_FUNC_BTOWC if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then AC_LIBOBJ([btowc]) gl_PREREQ_BTOWC fi gl_WCHAR_MODULE_INDICATOR([btowc]) gl___BUILTIN_EXPECT gl_C_STACK gl_FUNC_CALLOC_GNU if test $REPLACE_CALLOC = 1; then AC_LIBOBJ([calloc]) fi gl_FUNC_CALLOC_POSIX if test $REPLACE_CALLOC = 1; then AC_LIBOBJ([calloc]) fi gl_STDLIB_MODULE_INDICATOR([calloc-posix]) gl_UNISTD_MODULE_INDICATOR([chdir]) gl_FUNC_CHDIR_LONG if test $gl_cv_have_unlimited_file_name_length = no; then AC_LIBOBJ([chdir-long]) gl_PREREQ_CHDIR_LONG fi gl_MODULE_INDICATOR_FOR_TESTS([cloexec]) gl_FUNC_CLOSE if test $REPLACE_CLOSE = 1; then AC_LIBOBJ([close]) fi gl_UNISTD_MODULE_INDICATOR([close]) gl_MODULE_INDICATOR([close-stream]) gl_FUNC_CLOSEDIR if test $HAVE_CLOSEDIR = 0 || test $REPLACE_CLOSEDIR = 1; then AC_LIBOBJ([closedir]) fi gl_DIRENT_MODULE_INDICATOR([closedir]) gl_CONFIGMAKE_PREP gl_CTYPE_H gl_CTYPE_H_REQUIRE_DEFAULTS gl_CYCLE_CHECK gl_CHECK_TYPE_STRUCT_DIRENT_D_INO gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE AC_REQUIRE([AC_C_INLINE]) gl_DIRENT_H gl_DIRENT_H_REQUIRE_DEFAULTS gl_FUNC_DIRFD if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no \ || test $REPLACE_DIRFD = 1; then AC_LIBOBJ([dirfd]) gl_PREREQ_DIRFD fi gl_DIRENT_MODULE_INDICATOR([dirfd]) gl_DOUBLE_SLASH_ROOT gl_FUNC_DUP if test $REPLACE_DUP = 1; then AC_LIBOBJ([dup]) gl_PREREQ_DUP fi gl_UNISTD_MODULE_INDICATOR([dup]) gl_FUNC_DUP2 if test $REPLACE_DUP2 = 1; then AC_LIBOBJ([dup2]) gl_PREREQ_DUP2 fi gl_UNISTD_MODULE_INDICATOR([dup2]) AC_PROG_MKDIR_P gl_HEADER_ERRNO_H gl_ERROR if test $ac_cv_lib_error_at_line = no; then AC_LIBOBJ([error]) gl_PREREQ_ERROR fi m4_ifdef([AM_XGETTEXT_OPTION], [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) AC_REQUIRE([gl_EXTERN_INLINE]) gl_FUNC_FCHDIR gl_UNISTD_MODULE_INDICATOR([fchdir]) gl_FUNC_FCNTL if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then AC_LIBOBJ([fcntl]) fi gl_FCNTL_MODULE_INDICATOR([fcntl]) gl_FCNTL_H gl_FCNTL_H_REQUIRE_DEFAULTS gl_FCNTL_SAFER gl_MODULE_INDICATOR([fcntl-safer]) gl_MODULE_INDICATOR([fd-safer-flag]) gl_FUNC_FDOPENDIR if test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1; then AC_LIBOBJ([fdopendir]) fi gl_DIRENT_MODULE_INDICATOR([fdopendir]) gl_MODULE_INDICATOR([fdopendir]) gl_FILE_NAME_CONCAT_LGPL AC_C_FLEXIBLE_ARRAY_MEMBER gl_FUNC_FNMATCH_POSIX if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then AC_LIBOBJ([fnmatch]) gl_PREREQ_FNMATCH fi gl_FNMATCH_MODULE_INDICATOR([fnmatch]) gl_FNMATCH_H gl_FNMATCH_H_REQUIRE_DEFAULTS gl_FUNC_FOPEN if test $REPLACE_FOPEN = 1; then AC_LIBOBJ([fopen]) gl_PREREQ_FOPEN fi gl_STDIO_MODULE_INDICATOR([fopen]) gl_FUNC_FOPEN_GNU if test $REPLACE_FOPEN = 1; then AC_LIBOBJ([fopen]) gl_PREREQ_FOPEN fi gl_MODULE_INDICATOR([fopen-gnu]) gl_FUNC_FPENDING if test $gl_cv_func___fpending = no; then AC_LIBOBJ([fpending]) fi gl_FUNC_FREE if test $REPLACE_FREE = 1; then AC_LIBOBJ([free]) gl_PREREQ_FREE fi gl_STDLIB_MODULE_INDICATOR([free-posix]) gl_FUNC_FSTAT if test $REPLACE_FSTAT = 1; then AC_LIBOBJ([fstat]) case "$host_os" in mingw*) AC_LIBOBJ([stat-w32]) ;; esac gl_PREREQ_FSTAT fi gl_SYS_STAT_MODULE_INDICATOR([fstat]) gl_FUNC_FSTATAT if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then AC_LIBOBJ([fstatat]) fi gl_SYS_STAT_MODULE_INDICATOR([fstatat]) gl_FUNC_FTS dnl Use this version of fts unconditionally, since the GNU libc and dnl NetBSD versions have bugs and/or unnecessary limitations. AC_LIBOBJ([fts]) gl_FUNC_GETCWD_LGPL if test $REPLACE_GETCWD = 1; then AC_LIBOBJ([getcwd-lgpl]) fi gl_UNISTD_MODULE_INDICATOR([getcwd]) gl_FUNC_GETDTABLESIZE if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then AC_LIBOBJ([getdtablesize]) gl_PREREQ_GETDTABLESIZE fi gl_UNISTD_MODULE_INDICATOR([getdtablesize]) gl_FUNC_GETOPT_GNU dnl Because of the way gl_FUNC_GETOPT_GNU is implemented (the gl_getopt_required dnl mechanism), there is no need to do any AC_LIBOBJ or AC_SUBST here; they are dnl done in the getopt-posix module. gl_FUNC_GETOPT_POSIX if test $REPLACE_GETOPT = 1; then AC_LIBOBJ([getopt]) AC_LIBOBJ([getopt1]) dnl Define the substituted variable GNULIB_UNISTD_H_GETOPT to 1. gl_UNISTD_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) fi gl_UNISTD_MODULE_INDICATOR([getopt-posix]) gl_FUNC_GETPAGESIZE if test $REPLACE_GETPAGESIZE = 1; then AC_LIBOBJ([getpagesize]) fi gl_UNISTD_MODULE_INDICATOR([getpagesize]) gl_FUNC_GETPROGNAME AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) # Autoconf 2.61a.99 and earlier don't support linking a file only # in VPATH builds. But since GNUmakefile is for maintainer use # only, it does not matter if we skip the link with older autoconf. # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH # builds, so use a shell variable to bypass this. GNUmakefile=GNUmakefile m4_if(m4_version_compare([2.61a.100], m4_defn([m4_PACKAGE_VERSION])), [1], [], [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [], [GNUmakefile=$GNUmakefile])]) AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) LIB_HARD_LOCALE="$LIB_SETLOCALE_NULL" AC_SUBST([LIB_HARD_LOCALE]) AC_DEFUN([gl_HAVE_MODULE_HAVELIB]) AC_REQUIRE([gl_HOST_CPU_C_ABI]) gl_I_RING AM_ICONV m4_ifdef([gl_ICONV_MODULE_INDICATOR], [gl_ICONV_MODULE_INDICATOR([iconv])]) gl_ICONV_H gl_ICONV_H_REQUIRE_DEFAULTS gl_FUNC_ICONV_OPEN if test $REPLACE_ICONV_OPEN = 1; then AC_LIBOBJ([iconv_open]) fi if test $REPLACE_ICONV = 1; then AC_LIBOBJ([iconv]) AC_LIBOBJ([iconv_close]) fi gl_INLINE gl_INTTYPES_H gl_INTTYPES_INCOMPLETE gl_INTTYPES_H_REQUIRE_DEFAULTS gl_FUNC_ISATTY if test $REPLACE_ISATTY = 1; then AC_LIBOBJ([isatty]) gl_PREREQ_ISATTY fi gl_UNISTD_MODULE_INDICATOR([isatty]) gl_FUNC_ISBLANK if test $HAVE_ISBLANK = 0; then AC_LIBOBJ([isblank]) fi gl_MODULE_INDICATOR([isblank]) gl_CTYPE_MODULE_INDICATOR([isblank]) gl_FUNC_ISWBLANK if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then : else if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then AC_LIBOBJ([iswblank]) fi fi gl_WCTYPE_MODULE_INDICATOR([iswblank]) gl_FUNC_ISWCTYPE if test $HAVE_WCTYPE_T = 0 || test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then AC_LIBOBJ([iswctype]) fi gl_WCTYPE_MODULE_INDICATOR([iswctype]) gl_FUNC_ISWDIGIT if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then : else if test $REPLACE_ISWDIGIT = 1; then AC_LIBOBJ([iswdigit]) fi fi gl_WCTYPE_MODULE_INDICATOR([iswdigit]) gl_FUNC_ISWXDIGIT if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then : else if test $REPLACE_ISWXDIGIT = 1; then AC_LIBOBJ([iswxdigit]) fi fi gl_WCTYPE_MODULE_INDICATOR([iswxdigit]) gl_LANGINFO_H gl_LANGINFO_H_REQUIRE_DEFAULTS AC_REQUIRE([gl_LARGEFILE]) gl___INLINE gl_LIMITS_H gl_LOCALCHARSET dnl For backward compatibility. Some packages still use this. LOCALCHARSET_TESTS_ENVIRONMENT= AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) gl_LOCALE_H gl_LOCALE_H_REQUIRE_DEFAULTS gl_FUNC_LOCALECONV if test $REPLACE_LOCALECONV = 1; then AC_LIBOBJ([localeconv]) gl_PREREQ_LOCALECONV fi gl_LOCALE_MODULE_INDICATOR([localeconv]) gl_LOCK gl_MODULE_INDICATOR([lock]) gl_FUNC_LSEEK if test $REPLACE_LSEEK = 1; then AC_LIBOBJ([lseek]) fi gl_UNISTD_MODULE_INDICATOR([lseek]) gl_FUNC_LSTAT if test $REPLACE_LSTAT = 1; then AC_LIBOBJ([lstat]) gl_PREREQ_LSTAT fi gl_SYS_STAT_MODULE_INDICATOR([lstat]) AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER], [AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])]) AC_REQUIRE([AC_PROG_SED]) AC_REQUIRE([AC_PROG_GREP]) gl_FUNC_MALLOC_GNU if test $REPLACE_MALLOC = 1; then AC_LIBOBJ([malloc]) fi AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) if test $REPLACE_MALLOC = 1; then AC_LIBOBJ([malloc]) fi gl_STDLIB_MODULE_INDICATOR([malloc-posix]) gl_MALLOCA gl_MBCHAR gl_MBITER gl_FUNC_MBRLEN if test $HAVE_MBRLEN = 0 || test $REPLACE_MBRLEN = 1; then AC_LIBOBJ([mbrlen]) gl_PREREQ_MBRLEN fi gl_WCHAR_MODULE_INDICATOR([mbrlen]) gl_FUNC_MBRTOWC if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then AC_LIBOBJ([mbrtowc]) if test $REPLACE_MBSTATE_T = 1; then AC_LIBOBJ([lc-charset-dispatch]) AC_LIBOBJ([mbtowc-lock]) gl_PREREQ_MBTOWC_LOCK fi gl_PREREQ_MBRTOWC fi gl_WCHAR_MODULE_INDICATOR([mbrtowc]) gl_STRING_MODULE_INDICATOR([mbscasecmp]) gl_FUNC_MBSINIT if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then AC_LIBOBJ([mbsinit]) gl_PREREQ_MBSINIT fi gl_WCHAR_MODULE_INDICATOR([mbsinit]) gl_FUNC_MBSLEN gl_STRING_MODULE_INDICATOR([mbslen]) gl_FUNC_MBSRTOWCS if test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1; then AC_LIBOBJ([mbsrtowcs]) AC_LIBOBJ([mbsrtowcs-state]) gl_PREREQ_MBSRTOWCS fi gl_WCHAR_MODULE_INDICATOR([mbsrtowcs]) gl_STRING_MODULE_INDICATOR([mbsstr]) gl_FUNC_MBTOWC if test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1; then AC_LIBOBJ([mbtowc]) gl_PREREQ_MBTOWC fi gl_STDLIB_MODULE_INDICATOR([mbtowc]) gl_MBITER gl_FUNC_MEMCHR if test $REPLACE_MEMCHR = 1; then AC_LIBOBJ([memchr]) gl_PREREQ_MEMCHR fi gl_STRING_MODULE_INDICATOR([memchr]) gl_FUNC_MEMPCPY if test $HAVE_MEMPCPY = 0; then AC_LIBOBJ([mempcpy]) gl_PREREQ_MEMPCPY fi gl_STRING_MODULE_INDICATOR([mempcpy]) gl_FUNC_MEMRCHR if test $ac_cv_func_memrchr = no; then AC_LIBOBJ([memrchr]) gl_PREREQ_MEMRCHR fi gl_STRING_MODULE_INDICATOR([memrchr]) gl_MINMAX AC_REQUIRE([gl_MSVC_INVAL]) if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then AC_LIBOBJ([msvc-inval]) fi AC_REQUIRE([gl_MSVC_NOTHROW]) if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then AC_LIBOBJ([msvc-nothrow]) fi gl_MODULE_INDICATOR([msvc-nothrow]) gl_MULTIARCH gl_FUNC_NL_LANGINFO if test $HAVE_NL_LANGINFO = 0 || test $REPLACE_NL_LANGINFO = 1; then AC_LIBOBJ([nl_langinfo]) fi if test $REPLACE_NL_LANGINFO = 1 && test $NL_LANGINFO_MTSAFE = 0; then AC_LIBOBJ([nl_langinfo-lock]) gl_PREREQ_NL_LANGINFO_LOCK fi gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) AC_FUNC_OBSTACK dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]). gl_FUNC_OPEN if test $REPLACE_OPEN = 1; then AC_LIBOBJ([open]) gl_PREREQ_OPEN fi gl_FCNTL_MODULE_INDICATOR([open]) gl_FUNC_OPENAT if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then AC_LIBOBJ([openat]) gl_PREREQ_OPENAT fi gl_MODULE_INDICATOR([openat]) dnl for lib/getcwd.c gl_FCNTL_MODULE_INDICATOR([openat]) gl_OPENAT_SAFER gl_MODULE_INDICATOR([openat-safer]) gl_FUNC_OPENDIR if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then AC_LIBOBJ([opendir]) fi gl_DIRENT_MODULE_INDICATOR([opendir]) gl_PATHMAX gl_PERL gl_FUNC_PIPE if test $HAVE_PIPE = 0; then AC_LIBOBJ([pipe]) fi gl_UNISTD_MODULE_INDICATOR([pipe]) m4_ifdef([AM_XGETTEXT_OPTION], [AM_][XGETTEXT_OPTION([--keyword='proper_name:1,\"This is a proper name. See the gettext manual, section Names.\"']) AM_][XGETTEXT_OPTION([--keyword='proper_name_utf8:1,\"This is a proper name. See the gettext manual, section Names.\"'])]) gl_QUOTE gl_QUOTEARG gl_FUNC_RAISE if test $HAVE_RAISE = 0 || test $REPLACE_RAISE = 1; then AC_LIBOBJ([raise]) gl_PREREQ_RAISE fi gl_SIGNAL_MODULE_INDICATOR([raise]) gl_FUNC_RAWMEMCHR if test $HAVE_RAWMEMCHR = 0; then AC_LIBOBJ([rawmemchr]) gl_PREREQ_RAWMEMCHR fi gl_STRING_MODULE_INDICATOR([rawmemchr]) gl_FUNC_READ if test $REPLACE_READ = 1; then AC_LIBOBJ([read]) gl_PREREQ_READ fi gl_UNISTD_MODULE_INDICATOR([read]) gl_FUNC_READDIR if test $HAVE_READDIR = 0; then AC_LIBOBJ([readdir]) fi gl_DIRENT_MODULE_INDICATOR([readdir]) gl_FUNC_REALLOC_GNU if test $REPLACE_REALLOC = 1; then AC_LIBOBJ([realloc]) fi gl_FUNC_REALLOC_POSIX if test $REPLACE_REALLOC = 1; then AC_LIBOBJ([realloc]) fi gl_STDLIB_MODULE_INDICATOR([realloc-posix]) gl_FUNC_REALLOCARRAY if test $HAVE_REALLOCARRAY = 0 || test $REPLACE_REALLOCARRAY = 1; then AC_LIBOBJ([reallocarray]) gl_PREREQ_REALLOCARRAY fi gl_MODULE_INDICATOR([reallocarray]) gl_STDLIB_MODULE_INDICATOR([reallocarray]) gl_REGEX if test $ac_use_included_regex = yes; then AC_LIBOBJ([regex]) gl_PREREQ_REGEX fi gl_PREREQ_SAFE_READ gl_SAVE_CWD gl_FUNC_SETLOCALE_NULL if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then AC_LIBOBJ([setlocale-lock]) gl_PREREQ_SETLOCALE_LOCK fi gl_LOCALE_MODULE_INDICATOR([setlocale_null]) gl_SIGNAL_H gl_SIGNAL_H_REQUIRE_DEFAULTS AC_ARG_WITH([libsigsegv], [AS_HELP_STRING([--with-libsigsegv], [use the GNU libsigsegv library, when present, instead of the gnulib module 'sigsegv'])]) SIGSEGV_H=sigsegv.h if test "$with_libsigsegv" = yes; then gl_LIBSIGSEGV if test "$gl_cv_lib_sigsegv" = yes; then SIGSEGV_H= fi fi AC_SUBST([SIGSEGV_H]) AM_CONDITIONAL([GL_GENERATE_SIGSEGV_H], [test -n "$SIGSEGV_H"]) if test -n "$SIGSEGV_H"; then dnl Persuade glibc <sys/ucontext.h> to declare macros designating register dnl indices: REG_RSP on x86_64, REG_ESP on i386. dnl Persuade Solaris OpenIndiana <ucontext.h> to include <sys/regset.h>, dnl which declares macros designating register indices, such as ESP on i386. dnl Persuade Solaris OpenIndiana <unistd.h> to declare mincore(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in solaris2.11) AC_DEFINE([SOLARIS11], [1], [Define on Solaris 11 and its derivates.]) ;; esac gl_FUNC_MMAP_ANON dnl Stack direction. SV_STACK_DIRECTION dnl Catching stack overflow requires an alternate signal stack. dnl The old "install a guard page" trick would be unreliable, because dnl we don't know where exactly to place the guard page. SV_SIGALTSTACK AC_CHECK_FUNCS_ONCE([getrlimit]) fi gt_TYPE_SSIZE_T gl_FUNC_STAT if test $REPLACE_STAT = 1; then AC_LIBOBJ([stat]) case "$host_os" in mingw*) AC_LIBOBJ([stat-w32]) ;; esac gl_PREREQ_STAT fi gl_SYS_STAT_MODULE_INDICATOR([stat]) gl_STAT_TIME gl_STAT_BIRTHTIME gl_STDALIGN_H gl_STDARG_H AM_STDBOOL_H gl_STDDEF_H gl_STDDEF_H_REQUIRE_DEFAULTS gl_STDINT_H gl_STDIO_H gl_STDIO_H_REQUIRE_DEFAULTS dnl No need to create extra modules for these functions. Everyone who uses dnl <stdio.h> likely needs them. gl_STDIO_MODULE_INDICATOR([fscanf]) gl_MODULE_INDICATOR([fscanf]) gl_STDIO_MODULE_INDICATOR([scanf]) gl_MODULE_INDICATOR([scanf]) gl_STDIO_MODULE_INDICATOR([fgetc]) gl_STDIO_MODULE_INDICATOR([getc]) gl_STDIO_MODULE_INDICATOR([getchar]) gl_STDIO_MODULE_INDICATOR([fgets]) gl_STDIO_MODULE_INDICATOR([fread]) dnl No need to create extra modules for these functions. Everyone who uses dnl <stdio.h> likely needs them. gl_STDIO_MODULE_INDICATOR([fprintf]) gl_STDIO_MODULE_INDICATOR([printf]) gl_STDIO_MODULE_INDICATOR([vfprintf]) gl_STDIO_MODULE_INDICATOR([vprintf]) gl_STDIO_MODULE_INDICATOR([fputc]) gl_STDIO_MODULE_INDICATOR([putc]) gl_STDIO_MODULE_INDICATOR([putchar]) gl_STDIO_MODULE_INDICATOR([fputs]) gl_STDIO_MODULE_INDICATOR([puts]) gl_STDIO_MODULE_INDICATOR([fwrite]) gl_STDLIB_H gl_STDLIB_H_REQUIRE_DEFAULTS gl_FUNC_STPCPY if test $HAVE_STPCPY = 0; then AC_LIBOBJ([stpcpy]) gl_PREREQ_STPCPY fi gl_STRING_MODULE_INDICATOR([stpcpy]) gl_FUNC_STRDUP_POSIX if test $REPLACE_STRDUP = 1; then AC_LIBOBJ([strdup]) gl_PREREQ_STRDUP fi gl_STRING_MODULE_INDICATOR([strdup]) gl_FUNC_STRERROR if test $REPLACE_STRERROR = 1; then AC_LIBOBJ([strerror]) fi gl_MODULE_INDICATOR([strerror]) gl_STRING_MODULE_INDICATOR([strerror]) AC_REQUIRE([gl_HEADER_ERRNO_H]) AC_REQUIRE([gl_FUNC_STRERROR_0]) if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then AC_LIBOBJ([strerror-override]) gl_PREREQ_SYS_H_WINSOCK2 fi if test $gl_cond_libtool = false; then gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV" gl_libdeps="$gl_libdeps $LIBICONV" fi gl_STRING_H gl_STRING_H_REQUIRE_DEFAULTS gl_FUNC_STRNLEN if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then AC_LIBOBJ([strnlen]) gl_PREREQ_STRNLEN fi gl_STRING_MODULE_INDICATOR([strnlen]) gl_FUNC_STRSTR if test $REPLACE_STRSTR = 1; then AC_LIBOBJ([strstr]) fi gl_FUNC_STRSTR_SIMPLE if test $REPLACE_STRSTR = 1; then AC_LIBOBJ([strstr]) fi gl_STRING_MODULE_INDICATOR([strstr]) gl_FUNC_STRTOIMAX if test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; then AC_LIBOBJ([strtoimax]) gl_PREREQ_STRTOIMAX fi gl_INTTYPES_MODULE_INDICATOR([strtoimax]) gl_FUNC_STRTOLL if test $HAVE_STRTOLL = 0 || test $REPLACE_STRTOLL = 1; then AC_LIBOBJ([strtoll]) gl_PREREQ_STRTOLL fi gl_STDLIB_MODULE_INDICATOR([strtoll]) gl_FUNC_STRTOULL if test $HAVE_STRTOULL = 0 || test $REPLACE_STRTOULL = 1; then AC_LIBOBJ([strtoull]) gl_PREREQ_STRTOULL fi gl_STDLIB_MODULE_INDICATOR([strtoull]) gl_FUNC_STRTOUMAX if test $HAVE_DECL_STRTOUMAX = 0 || test $REPLACE_STRTOUMAX = 1; then AC_LIBOBJ([strtoumax]) gl_PREREQ_STRTOUMAX fi gl_INTTYPES_MODULE_INDICATOR([strtoumax]) gl_SYS_STAT_H gl_SYS_STAT_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P gl_SYS_TYPES_H gl_SYS_TYPES_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P AC_REQUIRE([gl_THREADLIB]) gl_TIME_H gl_TIME_H_REQUIRE_DEFAULTS gl_UNISTD_H gl_UNISTD_H_REQUIRE_DEFAULTS gl_UNISTD_SAFER gl_LIBUNISTRING_LIBHEADER([0.9.11], [unistr.h]) gl_MODULE_INDICATOR([unistr/u8-mbtoucr]) gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-mbtoucr]) gl_MODULE_INDICATOR([unistr/u8-uctomb]) gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-uctomb]) gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h]) AH_VERBATIM([unitypes_restrict], [ /* This definition is a duplicate of the one in unitypes.h. It is here so that we can cope with an older version of unitypes.h that does not contain this definition and that is pre-installed among the public header files. */ # if defined __restrict \ || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ || __clang_major__ >= 3 # define _UC_RESTRICT __restrict # elif 199901L <= __STDC_VERSION__ || defined restrict # define _UC_RESTRICT restrict # else # define _UC_RESTRICT # endif ]) gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwidth.h]) gl_LIBUNISTRING_MODULE([0.9.8], [uniwidth/width]) AC_DEFINE([GNULIB_STDIO_SINGLE_THREAD], [1], [Define to 1 if you want the FILE stream functions getc, putc, etc. to use unlocked I/O if available, throughout the package. Unlocked I/O can improve performance, sometimes dramatically. But unlocked I/O is safe only in single-threaded programs, as well as in multithreaded programs for which you can guarantee that every FILE stream, including stdin, stdout, stderr, is used only in a single thread.]) AC_DEFINE([USE_UNLOCKED_IO], [GNULIB_STDIO_SINGLE_THREAD], [An alias of GNULIB_STDIO_SINGLE_THREAD.]) gl_FUNC_GLIBC_UNLOCKED_IO gl_VERSION_ETC gl_WCHAR_H gl_WCHAR_H_REQUIRE_DEFAULTS gl_FUNC_WCRTOMB if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then AC_LIBOBJ([wcrtomb]) gl_PREREQ_WCRTOMB fi gl_WCHAR_MODULE_INDICATOR([wcrtomb]) gl_FUNC_WCTOB if test $HAVE_WCTOB = 0 || test $REPLACE_WCTOB = 1; then AC_LIBOBJ([wctob]) gl_PREREQ_WCTOB fi gl_WCHAR_MODULE_INDICATOR([wctob]) gl_FUNC_WCTOMB if test $REPLACE_WCTOMB = 1; then AC_LIBOBJ([wctomb]) gl_PREREQ_WCTOMB fi gl_STDLIB_MODULE_INDICATOR([wctomb]) gl_WCTYPE_H gl_WCTYPE_H_REQUIRE_DEFAULTS gl_FUNC_WCWIDTH if test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1; then AC_LIBOBJ([wcwidth]) gl_PREREQ_WCWIDTH fi gl_WCHAR_MODULE_INDICATOR([wcwidth]) AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) AC_LIBOBJ([windows-mutex]) ;; esac AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) AC_LIBOBJ([windows-once]) ;; esac AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) AC_LIBOBJ([windows-recmutex]) ;; esac AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) AC_LIBOBJ([windows-rwlock]) ;; esac AC_REQUIRE([gl_WINDOWS_STAT_INODES]) gl_SYS_STAT_H_REQUIRE_DEFAULTS AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OVERRIDES_STRUCT_STAT], [1]) ;; esac gl_FUNC_WMEMCHR if test $HAVE_WMEMCHR = 0; then AC_LIBOBJ([wmemchr]) fi gl_WCHAR_MODULE_INDICATOR([wmemchr]) gl_FUNC_WMEMPCPY if test $HAVE_WMEMPCPY = 0; then AC_LIBOBJ([wmempcpy]) fi gl_WCHAR_MODULE_INDICATOR([wmempcpy]) gl_XALLOC gl_MODULE_INDICATOR([xalloc]) gl_MODULE_INDICATOR([xalloc-die]) gl_XSTRTOL # End of code from modules m4_ifval(gl_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || for gl_file in ]gl_LIBSOURCES_LIST[ ; do if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2 exit 1 fi done])dnl m4_if(m4_sysval, [0], [], [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ]) m4_popdef([GL_MODULE_INDICATOR_PREFIX]) m4_popdef([GL_MACRO_PREFIX]) m4_popdef([gl_LIBSOURCES_DIR]) m4_popdef([gl_LIBSOURCES_LIST]) m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_LIBOBJ]) AC_CONFIG_COMMANDS_PRE([ gl_libobjs= gl_ltlibobjs= if test -n "$gl_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gl_libobjs="$gl_libobjs $i.$ac_objext" gl_ltlibobjs="$gl_ltlibobjs $i.lo" done fi AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) ]) gltests_libdeps= gltests_ltlibdeps= m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ])) m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS])) m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) m4_pushdef([gltests_LIBSOURCES_LIST], []) m4_pushdef([gltests_LIBSOURCES_DIR], []) m4_pushdef([GL_MACRO_PREFIX], [gltests]) m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) gl_COMMON AC_REQUIRE([gl_CC_ALLOW_WARNINGS]) AC_REQUIRE([gl_CXX_ALLOW_WARNINGS]) gl_source_base='gnulib-tests' changequote(,)dnl gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS changequote([, ])dnl AC_SUBST([gltests_WITNESS]) gl_module_indicator_condition=$gltests_WITNESS m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([accept]) fi gl_SYS_SOCKET_MODULE_INDICATOR([accept]) gl_ARPA_INET_H gl_ARPA_INET_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([bind]) fi gl_SYS_SOCKET_MODULE_INDICATOR([bind]) gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_FR gt_LOCALE_TR_UTF8 AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([connect]) fi gl_SYS_SOCKET_MODULE_INDICATOR([connect]) gl_ENVIRON gl_UNISTD_MODULE_INDICATOR([environ]) gl_FUNC_FDOPEN if test $REPLACE_FDOPEN = 1; then AC_LIBOBJ([fdopen]) gl_PREREQ_FDOPEN fi gl_STDIO_MODULE_INDICATOR([fdopen]) gl_FLOAT_H if test $REPLACE_FLOAT_LDBL = 1; then AC_LIBOBJ([float]) fi if test $REPLACE_ITOLD = 1; then AC_LIBOBJ([itold]) fi gl_FUNC_FTRUNCATE if test $HAVE_FTRUNCATE = 0 || test $REPLACE_FTRUNCATE = 1; then AC_LIBOBJ([ftruncate]) gl_PREREQ_FTRUNCATE fi gl_UNISTD_MODULE_INDICATOR([ftruncate]) gl_FUNC_GETTIMEOFDAY if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then AC_LIBOBJ([gettimeofday]) gl_PREREQ_GETTIMEOFDAY fi gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) gl_MUSL_LIBC dnl Distinguish OpenBSD >= 6.2 from OpenBSD < 6.2. AC_CHECK_FUNCS_ONCE([duplocale]) gl_FUNC_INET_PTON if test $HAVE_INET_PTON = 0 || test $REPLACE_INET_PTON = 1; then AC_LIBOBJ([inet_pton]) gl_PREREQ_INET_PTON fi gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) AC_C_BIGENDIAN gl_INTTOSTR gl_FUNC_IOCTL if test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1; then AC_LIBOBJ([ioctl]) fi gl_SYS_IOCTL_MODULE_INDICATOR([ioctl]) gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_JA gt_LOCALE_ZH_CN gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_JA gt_LOCALE_ZH_CN AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([listen]) fi gl_SYS_SOCKET_MODULE_INDICATOR([listen]) AC_CHECK_FUNCS_ONCE([newlocale]) gl_LOCALENAME gl_LOCALE_MODULE_INDICATOR([localename]) AC_CHECK_FUNCS_ONCE([newlocale]) gt_LOCALE_TR_UTF8 gt_LOCALE_FR_UTF8 gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_JA gt_LOCALE_ZH_CN gt_LOCALE_FR_UTF8 gt_LOCALE_ZH_CN dnl Check for prerequisites for memory fence checks. gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) gl_FUNC_NANOSLEEP if test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1; then AC_LIBOBJ([nanosleep]) gl_PREREQ_NANOSLEEP fi gl_TIME_MODULE_INDICATOR([nanosleep]) AC_CHECK_DECLS_ONCE([alarm]) gl_HEADER_NETINET_IN AC_PROG_MKDIR_P gt_LOCALE_FR gt_LOCALE_FR_UTF8 gl_FUNC_PERROR if test $REPLACE_PERROR = 1; then AC_LIBOBJ([perror]) fi gl_STRING_MODULE_INDICATOR([perror]) gl_PTHREAD_H gl_PTHREAD_H_REQUIRE_DEFAULTS gl_PTHREAD_THREAD if test $HAVE_PTHREAD_CREATE = 0 || test $REPLACE_PTHREAD_CREATE = 1; then AC_LIBOBJ([pthread-thread]) fi gl_PTHREAD_MODULE_INDICATOR([pthread-thread]) gl_FUNC_PTHREAD_SIGMASK if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then AC_LIBOBJ([pthread_sigmask]) gl_PREREQ_PTHREAD_SIGMASK fi gl_SIGNAL_MODULE_INDICATOR([pthread_sigmask]) gl_FUNC_PUTENV if test $REPLACE_PUTENV = 1; then AC_LIBOBJ([putenv]) gl_PREREQ_PUTENV fi gl_STDLIB_MODULE_INDICATOR([putenv]) dnl Check for prerequisites for memory fence checks. dnl FIXME: zerosize-ptr.h requires these: make a module for it gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) dnl Check for prerequisites for memory fence checks. gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) gl_SCHED_H gl_SCHED_H_REQUIRE_DEFAULTS gl_FUNC_SELECT if test $REPLACE_SELECT = 1; then AC_LIBOBJ([select]) fi gl_SYS_SELECT_MODULE_INDICATOR([select]) AC_CHECK_HEADERS_ONCE([sys/wait.h]) gl_FUNC_SETENV if test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1; then AC_LIBOBJ([setenv]) fi gl_STDLIB_MODULE_INDICATOR([setenv]) gl_FUNC_SETLOCALE if test $REPLACE_SETLOCALE = 1; then AC_LIBOBJ([setlocale]) gl_PREREQ_SETLOCALE fi gl_LOCALE_MODULE_INDICATOR([setlocale]) gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_JA gt_LOCALE_ZH_CN AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([setsockopt]) fi gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt]) gl_SIGACTION if test $HAVE_SIGACTION = 0; then AC_LIBOBJ([sigaction]) gl_PREREQ_SIGACTION fi gl_SIGNAL_MODULE_INDICATOR([sigaction]) gl_SIGNALBLOCKING if test $HAVE_POSIX_SIGNALBLOCKING = 0; then AC_LIBOBJ([sigprocmask]) gl_PREREQ_SIGPROCMASK fi gl_SIGNAL_MODULE_INDICATOR([sigprocmask]) AC_CHECK_FUNCS_ONCE([setrlimit]) gl_FUNC_MMAP_ANON gl_SIZE_MAX gl_FUNC_SLEEP if test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1; then AC_LIBOBJ([sleep]) fi gl_UNISTD_MODULE_INDICATOR([sleep]) AC_CHECK_DECLS_ONCE([alarm]) gl_FUNC_SNPRINTF gl_STDIO_MODULE_INDICATOR([snprintf]) gl_MODULE_INDICATOR([snprintf]) AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([socket]) fi # When this module is used, sockets may actually occur as file descriptors, # hence it is worth warning if the modules 'close' and 'ioctl' are not used. m4_ifdef([gl_UNISTD_H_DEFAULTS], [gl_UNISTD_H_REQUIRE_DEFAULTS]) m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [gl_SYS_IOCTL_H_REQUIRE_DEFAULTS]) AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2]) if test "$ac_cv_header_winsock2_h" = yes; then UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 fi gl_SYS_SOCKET_MODULE_INDICATOR([socket]) AC_REQUIRE([gl_SOCKETLIB]) AC_REQUIRE([gl_SOCKETS]) gl_TYPE_SOCKLEN_T AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) gl_FUNC_STRERROR_R if test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1; then AC_LIBOBJ([strerror_r]) gl_PREREQ_STRERROR_R fi gl_STRING_MODULE_INDICATOR([strerror_r]) dnl For the modules argp, error. gl_MODULE_INDICATOR([strerror_r-posix]) dnl Check for prerequisites for memory fence checks. gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) AC_CHECK_DECLS_ONCE([alarm]) gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) gl_FUNC_SYMLINK if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then AC_LIBOBJ([symlink]) fi gl_UNISTD_MODULE_INDICATOR([symlink]) gl_SYS_IOCTL_H gl_SYS_IOCTL_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P gl_SYS_SELECT_H gl_SYS_SELECT_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P gl_SYS_SOCKET_H gl_SYS_SOCKET_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P AC_CHECK_FUNCS_ONCE([shutdown]) gl_SYS_TIME_H gl_SYS_TIME_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P gl_SYS_UIO_H gl_SYS_UIO_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P gl_THREAD AC_CHECK_HEADERS([sys/single_threaded.h]) gl_FUNC_UNSETENV if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then AC_LIBOBJ([unsetenv]) gl_PREREQ_UNSETENV fi gl_STDLIB_MODULE_INDICATOR([unsetenv]) AC_REQUIRE([AC_C_RESTRICT]) gl_FUNC_VASNPRINTF abs_aux_dir=`cd "$ac_aux_dir"; pwd` AC_SUBST([abs_aux_dir]) gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_JA gt_LOCALE_ZH_CN AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) AC_LIBOBJ([windows-thread]) ;; esac AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) AC_LIBOBJ([windows-tls]) ;; esac gl_XSIZE m4_popdef([gl_MODULE_INDICATOR_CONDITION]) m4_ifval(gltests_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || for gl_file in ]gltests_LIBSOURCES_LIST[ ; do if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2 exit 1 fi done])dnl m4_if(m4_sysval, [0], [], [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ]) m4_popdef([GL_MODULE_INDICATOR_PREFIX]) m4_popdef([GL_MACRO_PREFIX]) m4_popdef([gltests_LIBSOURCES_DIR]) m4_popdef([gltests_LIBSOURCES_LIST]) m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_LIBOBJ]) AC_CONFIG_COMMANDS_PRE([ gltests_libobjs= gltests_ltlibobjs= if test -n "$gltests_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gltests_libobjs="$gltests_libobjs $i.$ac_objext" gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" done fi AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) ]) LIBGREPUTILS_LIBDEPS="$gl_libdeps" AC_SUBST([LIBGREPUTILS_LIBDEPS]) LIBGREPUTILS_LTLIBDEPS="$gl_ltlibdeps" AC_SUBST([LIBGREPUTILS_LTLIBDEPS]) LIBTESTS_LIBDEPS="$gltests_libdeps" AC_SUBST([LIBTESTS_LIBDEPS]) ]) # Like AC_LIBOBJ, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gl_LIBOBJ], [ AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" ]) # Like AC_REPLACE_FUNCS, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gl_REPLACE_FUNCS], [ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)]) ]) # Like AC_LIBSOURCES, except the directory where the source file is # expected is derived from the gnulib-tool parameterization, # and alloca is special cased (for the alloca-opt module). # We could also entirely rely on EXTRA_lib..._SOURCES. AC_DEFUN([gl_LIBSOURCES], [ m4_foreach([_gl_NAME], [$1], [ m4_if(_gl_NAME, [alloca.c], [], [ m4_define([gl_LIBSOURCES_DIR], [lib]) m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ]) ]) ]) ]) # Like AC_LIBOBJ, except that the module name goes # into gltests_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gltests_LIBOBJ], [ AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext" ]) # Like AC_REPLACE_FUNCS, except that the module name goes # into gltests_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gltests_REPLACE_FUNCS], [ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)]) ]) # Like AC_LIBSOURCES, except the directory where the source file is # expected is derived from the gnulib-tool parameterization, # and alloca is special cased (for the alloca-opt module). # We could also entirely rely on EXTRA_lib..._SOURCES. AC_DEFUN([gltests_LIBSOURCES], [ m4_foreach([_gl_NAME], [$1], [ m4_if(_gl_NAME, [alloca.c], [], [ m4_define([gltests_LIBSOURCES_DIR], [gnulib-tests]) m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ]) ]) ]) ]) # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([gl_FILE_LIST], [ build-aux/announce-gen build-aux/config.rpath build-aux/do-release-commit-and-tag build-aux/gendocs.sh build-aux/git-version-gen build-aux/gitlog-to-changelog build-aux/gnu-web-doc-update build-aux/gnupload build-aux/update-copyright build-aux/useless-if-before-free build-aux/vc-list-files doc/fdl.texi doc/gendocs_template doc/gendocs_template_min lib/_Noreturn.h lib/alignof.h lib/alloca.c lib/alloca.in.h lib/arg-nonnull.h lib/argmatch.c lib/argmatch.h lib/assure.h lib/at-func.c lib/attribute.h lib/basename-lgpl.c lib/basename-lgpl.h lib/binary-io.c lib/binary-io.h lib/bitrotate.c lib/bitrotate.h lib/btowc.c lib/c++defs.h lib/c-ctype.c lib/c-ctype.h lib/c-stack.c lib/c-stack.h lib/c-strcase.h lib/c-strcasecmp.c lib/c-strcaseeq.h lib/c-strncasecmp.c lib/calloc.c lib/cdefs.h lib/chdir-long.c lib/chdir-long.h lib/cloexec.c lib/cloexec.h lib/close-stream.c lib/close-stream.h lib/close.c lib/closedir.c lib/closeout.c lib/closeout.h lib/creat-safer.c lib/ctype.in.h lib/cycle-check.c lib/cycle-check.h lib/dev-ino.h lib/dfa.c lib/dfa.h lib/dirent-private.h lib/dirent.in.h lib/dirfd.c lib/dirname-lgpl.c lib/dirname.h lib/dup-safer-flag.c lib/dup-safer.c lib/dup.c lib/dup2.c lib/dynarray.h lib/errno.in.h lib/error.c lib/error.h lib/exclude.c lib/exclude.h lib/exitfail.c lib/exitfail.h lib/fchdir.c lib/fcntl--.h lib/fcntl-safer.h lib/fcntl.c lib/fcntl.in.h lib/fd-hook.c lib/fd-hook.h lib/fd-safer-flag.c lib/fd-safer.c lib/fdopendir.c lib/filename.h lib/filenamecat-lgpl.c lib/filenamecat.h lib/flexmember.h lib/fnmatch.c lib/fnmatch.in.h lib/fnmatch_loop.c lib/fopen.c lib/fpending.c lib/fpending.h lib/free.c lib/fstat.c lib/fstatat.c lib/fts-cycle.c lib/fts.c lib/fts_.h lib/getcwd-lgpl.c lib/getdtablesize.c lib/getopt-cdefs.in.h lib/getopt-core.h lib/getopt-ext.h lib/getopt-pfx-core.h lib/getopt-pfx-ext.h lib/getopt.c lib/getopt.in.h lib/getopt1.c lib/getopt_int.h lib/getpagesize.c lib/getprogname.c lib/getprogname.h lib/gettext.h lib/glthread/lock.c lib/glthread/lock.h lib/glthread/threadlib.c lib/hard-locale.c lib/hard-locale.h lib/hash.c lib/hash.h lib/i-ring.c lib/i-ring.h lib/ialloc.c lib/ialloc.h lib/iconv.c lib/iconv.in.h lib/iconv_close.c lib/iconv_open-aix.gperf lib/iconv_open-hpux.gperf lib/iconv_open-irix.gperf lib/iconv_open-osf.gperf lib/iconv_open-solaris.gperf lib/iconv_open-zos.gperf lib/iconv_open.c lib/idx.h lib/ignore-value.h lib/intprops.h lib/inttypes.in.h lib/isatty.c lib/isblank.c lib/iswblank.c lib/iswctype-impl.h lib/iswctype.c lib/iswdigit.c lib/iswxdigit.c lib/langinfo.in.h lib/lc-charset-dispatch.c lib/lc-charset-dispatch.h lib/libc-config.h lib/limits.in.h lib/localcharset.c lib/localcharset.h lib/locale.in.h lib/localeconv.c lib/localeinfo.c lib/localeinfo.h lib/lseek.c lib/lstat.c lib/malloc.c lib/malloc/dynarray-skeleton.c lib/malloc/dynarray.h lib/malloc/dynarray_at_failure.c lib/malloc/dynarray_emplace_enlarge.c lib/malloc/dynarray_finalize.c lib/malloc/dynarray_resize.c lib/malloc/dynarray_resize_clear.c lib/malloca.c lib/malloca.h lib/mbchar.c lib/mbchar.h lib/mbiter.c lib/mbiter.h lib/mbrlen.c lib/mbrtowc-impl-utf8.h lib/mbrtowc-impl.h lib/mbrtowc.c lib/mbscasecmp.c lib/mbsinit.c lib/mbslen.c lib/mbsrtowcs-impl.h lib/mbsrtowcs-state.c lib/mbsrtowcs.c lib/mbsstr.c lib/mbtowc-impl.h lib/mbtowc-lock.c lib/mbtowc-lock.h lib/mbtowc.c lib/mbuiter.c lib/mbuiter.h lib/memchr.c lib/memchr.valgrind lib/memchr2.c lib/memchr2.h lib/memchr2.valgrind lib/mempcpy.c lib/memrchr.c lib/minmax.h lib/msvc-inval.c lib/msvc-inval.h lib/msvc-nothrow.c lib/msvc-nothrow.h lib/nl_langinfo-lock.c lib/nl_langinfo.c lib/obstack.c lib/obstack.h lib/open-safer.c lib/open.c lib/openat-die.c lib/openat-priv.h lib/openat-proc.c lib/openat-safer.c lib/openat.c lib/openat.h lib/opendir.c lib/opendirat.c lib/opendirat.h lib/pathmax.h lib/pipe-safer.c lib/pipe.c lib/propername.c lib/propername.h lib/quote.h lib/quotearg.c lib/quotearg.h lib/raise.c lib/rawmemchr.c lib/rawmemchr.valgrind lib/read.c lib/readdir.c lib/realloc.c lib/reallocarray.c lib/regcomp.c lib/regex.c lib/regex.h lib/regex_internal.c lib/regex_internal.h lib/regexec.c lib/safe-read.c lib/safe-read.h lib/same-inode.h lib/save-cwd.c lib/save-cwd.h lib/setlocale-lock.c lib/setlocale_null.c lib/setlocale_null.h lib/signal.in.h lib/sigsegv.c lib/sigsegv.in.h lib/stackvma.c lib/stackvma.h lib/stat-time.c lib/stat-time.h lib/stat-w32.c lib/stat-w32.h lib/stat.c lib/stdalign.in.h lib/stdarg.in.h lib/stdbool.in.h lib/stddef.in.h lib/stdint.in.h lib/stdio-impl.h lib/stdio.in.h lib/stdlib.in.h lib/stpcpy.c lib/str-kmp.h lib/str-two-way.h lib/strdup.c lib/streq.h lib/strerror-override.c lib/strerror-override.h lib/strerror.c lib/striconv.c lib/striconv.h lib/string.in.h lib/stripslash.c lib/strnlen.c lib/strnlen1.c lib/strnlen1.h lib/strstr.c lib/strtoimax.c lib/strtol.c lib/strtoll.c lib/strtoul.c lib/strtoull.c lib/strtoumax.c lib/sys-limits.h lib/sys_stat.in.h lib/sys_types.in.h lib/time.in.h lib/trim.c lib/trim.h lib/unistd--.h lib/unistd-safer.h lib/unistd.c lib/unistd.in.h lib/unistr.in.h lib/unistr/u8-mbtoucr.c lib/unistr/u8-uctomb-aux.c lib/unistr/u8-uctomb.c lib/unitypes.in.h lib/uniwidth.in.h lib/uniwidth/cjk.h lib/uniwidth/width.c lib/unlocked-io.h lib/verify.h lib/version-etc-fsf.c lib/version-etc.c lib/version-etc.h lib/warn-on-use.h lib/wchar.in.h lib/wcrtomb.c lib/wctob.c lib/wctomb-impl.h lib/wctomb.c lib/wctype-h.c lib/wctype.in.h lib/wcwidth.c lib/windows-initguard.h lib/windows-mutex.c lib/windows-mutex.h lib/windows-once.c lib/windows-once.h lib/windows-recmutex.c lib/windows-recmutex.h lib/windows-rwlock.c lib/windows-rwlock.h lib/wmemchr-impl.h lib/wmemchr.c lib/wmempcpy.c lib/xalloc-die.c lib/xalloc-oversized.h lib/xalloc.h lib/xbinary-io.c lib/xbinary-io.h lib/xmalloc.c lib/xstriconv.c lib/xstriconv.h lib/xstrtoimax.c lib/xstrtol.c lib/xstrtol.h lib/xstrtoul.c m4/00gnulib.m4 m4/__inline.m4 m4/absolute-header.m4 m4/alloca.m4 m4/arpa_inet_h.m4 m4/asm-underscore.m4 m4/assert.m4 m4/btowc.m4 m4/builtin-expect.m4 m4/c-stack.m4 m4/calloc.m4 m4/chdir-long.m4 m4/close.m4 m4/closedir.m4 m4/codeset.m4 m4/configmake.m4 m4/ctype_h.m4 m4/cycle-check.m4 m4/d-ino.m4 m4/d-type.m4 m4/dirent_h.m4 m4/dirfd.m4 m4/double-slash-root.m4 m4/dup.m4 m4/dup2.m4 m4/eealloc.m4 m4/environ.m4 m4/errno_h.m4 m4/error.m4 m4/exponentd.m4 m4/extensions.m4 m4/extern-inline.m4 m4/fchdir.m4 m4/fcntl-o.m4 m4/fcntl-safer.m4 m4/fcntl.m4 m4/fcntl_h.m4 m4/fdopen.m4 m4/fdopendir.m4 m4/filenamecat.m4 m4/flexmember.m4 m4/float_h.m4 m4/fnmatch.m4 m4/fnmatch_h.m4 m4/fopen.m4 m4/fpending.m4 m4/fpieee.m4 m4/free.m4 m4/fstat.m4 m4/fstatat.m4 m4/ftruncate.m4 m4/fts.m4 m4/getcwd.m4 m4/getdtablesize.m4 m4/getopt.m4 m4/getpagesize.m4 m4/getprogname.m4 m4/gettimeofday.m4 m4/gnulib-common.m4 m4/host-cpu-c-abi.m4 m4/i-ring.m4 m4/iconv.m4 m4/iconv_h.m4 m4/iconv_open.m4 m4/include_next.m4 m4/inet_pton.m4 m4/inline.m4 m4/intl-thread-locale.m4 m4/intlmacosx.m4 m4/intmax_t.m4 m4/inttostr.m4 m4/inttypes.m4 m4/inttypes_h.m4 m4/ioctl.m4 m4/isatty.m4 m4/isblank.m4 m4/iswblank.m4 m4/iswctype.m4 m4/iswdigit.m4 m4/iswxdigit.m4 m4/langinfo_h.m4 m4/largefile.m4 m4/lcmessage.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/libsigsegv.m4 m4/libunistring-base.m4 m4/limits-h.m4 m4/localcharset.m4 m4/locale-fr.m4 m4/locale-ja.m4 m4/locale-tr.m4 m4/locale-zh.m4 m4/locale_h.m4 m4/localeconv.m4 m4/localename.m4 m4/lock.m4 m4/lseek.m4 m4/lstat.m4 m4/malloc.m4 m4/malloca.m4 m4/manywarnings-c++.m4 m4/manywarnings.m4 m4/math_h.m4 m4/mbchar.m4 m4/mbiter.m4 m4/mbrlen.m4 m4/mbrtowc.m4 m4/mbsinit.m4 m4/mbslen.m4 m4/mbsrtowcs.m4 m4/mbstate_t.m4 m4/mbtowc.m4 m4/memchr.m4 m4/mempcpy.m4 m4/memrchr.m4 m4/minmax.m4 m4/mmap-anon.m4 m4/mode_t.m4 m4/msvc-inval.m4 m4/msvc-nothrow.m4 m4/multiarch.m4 m4/musl.m4 m4/nanosleep.m4 m4/netinet_in_h.m4 m4/nl_langinfo.m4 m4/nocrash.m4 m4/obstack.m4 m4/off_t.m4 m4/open-cloexec.m4 m4/open-slash.m4 m4/open.m4 m4/openat.m4 m4/opendir.m4 m4/pathmax.m4 m4/perl.m4 m4/perror.m4 m4/pid_t.m4 m4/pipe.m4 m4/printf.m4 m4/pthread-thread.m4 m4/pthread_h.m4 m4/pthread_rwlock_rdlock.m4 m4/pthread_sigmask.m4 m4/putenv.m4 m4/quote.m4 m4/quotearg.m4 m4/raise.m4 m4/rawmemchr.m4 m4/read.m4 m4/readdir.m4 m4/realloc.m4 m4/reallocarray.m4 m4/regex.m4 m4/safe-read.m4 m4/save-cwd.m4 m4/sched_h.m4 m4/select.m4 m4/setenv.m4 m4/setlocale.m4 m4/setlocale_null.m4 m4/sigaction.m4 m4/sigaltstack.m4 m4/signal_h.m4 m4/signalblocking.m4 m4/size_max.m4 m4/sleep.m4 m4/snprintf.m4 m4/socketlib.m4 m4/sockets.m4 m4/socklen.m4 m4/sockpfaf.m4 m4/ssize_t.m4 m4/stack-direction.m4 m4/stat-time.m4 m4/stat.m4 m4/std-gnu11.m4 m4/stdalign.m4 m4/stdarg.m4 m4/stdbool.m4 m4/stddef_h.m4 m4/stdint.m4 m4/stdint_h.m4 m4/stdio_h.m4 m4/stdlib_h.m4 m4/stpcpy.m4 m4/strdup.m4 m4/strerror.m4 m4/strerror_r.m4 m4/string_h.m4 m4/strnlen.m4 m4/strstr.m4 m4/strtoimax.m4 m4/strtoll.m4 m4/strtoull.m4 m4/strtoumax.m4 m4/symlink.m4 m4/sys_ioctl_h.m4 m4/sys_select_h.m4 m4/sys_socket_h.m4 m4/sys_stat_h.m4 m4/sys_time_h.m4 m4/sys_types_h.m4 m4/sys_uio_h.m4 m4/thread.m4 m4/threadlib.m4 m4/time_h.m4 m4/unistd-safer.m4 m4/unistd_h.m4 m4/unlocked-io.m4 m4/vasnprintf.m4 m4/version-etc.m4 m4/visibility.m4 m4/warn-on-use.m4 m4/warnings.m4 m4/wchar_h.m4 m4/wchar_t.m4 m4/wcrtomb.m4 m4/wctob.m4 m4/wctomb.m4 m4/wctype_h.m4 m4/wcwidth.m4 m4/windows-stat-inodes.m4 m4/wint_t.m4 m4/wmemchr.m4 m4/wmempcpy.m4 m4/xalloc.m4 m4/xsize.m4 m4/xstrtol.m4 m4/year2038.m4 m4/zzgnulib.m4 tests/altstack-util.h tests/init.sh tests/locale.c tests/macros.h tests/mmap-anon-util.h tests/nap.h tests/signature.h tests/test-accept.c tests/test-alignof.c tests/test-alloca-opt.c tests/test-argmatch.c tests/test-arpa_inet.c tests/test-binary-io.c tests/test-binary-io.sh tests/test-bind.c tests/test-bitrotate.c tests/test-btowc.c tests/test-btowc1.sh tests/test-btowc2.sh tests/test-c-ctype.c tests/test-c-stack.c tests/test-c-stack.sh tests/test-c-stack2.sh tests/test-c-strcase.sh tests/test-c-strcasecmp.c tests/test-c-strncasecmp.c tests/test-calloc-gnu.c tests/test-chdir.c tests/test-cloexec.c tests/test-close.c tests/test-connect.c tests/test-ctype.c tests/test-dfa-invalid-char-class.sh tests/test-dfa-invalid-merge.sh tests/test-dfa-match-aux.c tests/test-dfa-match.sh tests/test-dirent.c tests/test-dup-safer.c tests/test-dup.c tests/test-dup2.c tests/test-dynarray.c tests/test-environ.c tests/test-errno.c tests/test-exclude.c tests/test-exclude1.sh tests/test-exclude2.sh tests/test-exclude3.sh tests/test-exclude4.sh tests/test-exclude5.sh tests/test-exclude6.sh tests/test-exclude7.sh tests/test-exclude8.sh tests/test-fchdir.c tests/test-fcntl-h.c tests/test-fcntl-safer.c tests/test-fcntl.c tests/test-fdopen.c tests/test-fdopendir.c tests/test-fgetc.c tests/test-float.c tests/test-fnmatch-h.c tests/test-fnmatch.c tests/test-fopen-gnu.c tests/test-fopen.c tests/test-fopen.h tests/test-fpending.c tests/test-fpending.sh tests/test-fputc.c tests/test-fread.c tests/test-free.c tests/test-fstat.c tests/test-fstatat.c tests/test-ftruncate.c tests/test-ftruncate.sh tests/test-fwrite.c tests/test-getcwd-lgpl.c tests/test-getdtablesize.c tests/test-getopt-gnu.c tests/test-getopt-main.h tests/test-getopt-posix.c tests/test-getopt.h tests/test-getopt_long.h tests/test-getprogname.c tests/test-gettimeofday.c tests/test-hard-locale.c tests/test-hash.c tests/test-i-ring.c tests/test-iconv-h.c tests/test-iconv.c tests/test-ignore-value.c tests/test-inet_pton.c tests/test-init.sh tests/test-intprops.c tests/test-inttostr.c tests/test-inttypes.c tests/test-ioctl.c tests/test-isatty.c tests/test-isblank.c tests/test-iswblank.c tests/test-iswdigit.c tests/test-iswdigit.sh tests/test-iswxdigit.c tests/test-iswxdigit.sh tests/test-langinfo.c tests/test-limits-h.c tests/test-listen.c tests/test-localcharset.c tests/test-locale.c tests/test-localeconv.c tests/test-localename.c tests/test-lseek.c tests/test-lseek.sh tests/test-lstat.c tests/test-lstat.h tests/test-malloc-gnu.c tests/test-malloca.c tests/test-mbscasecmp.c tests/test-mbscasecmp.sh tests/test-mbsinit.c tests/test-mbsinit.sh tests/test-mbsrtowcs.c tests/test-mbsrtowcs1.sh tests/test-mbsrtowcs2.sh tests/test-mbsrtowcs3.sh tests/test-mbsrtowcs4.sh tests/test-mbsstr1.c tests/test-mbsstr2.c tests/test-mbsstr2.sh tests/test-mbsstr3.c tests/test-mbsstr3.sh tests/test-memchr.c tests/test-memchr2.c tests/test-memrchr.c tests/test-nanosleep.c tests/test-netinet_in.c tests/test-nl_langinfo-mt.c tests/test-nl_langinfo.c tests/test-nl_langinfo.sh tests/test-open.c tests/test-open.h tests/test-openat-safer.c tests/test-openat.c tests/test-pathmax.c tests/test-perror.c tests/test-perror.sh tests/test-perror2.c tests/test-pipe.c tests/test-pthread-thread.c tests/test-pthread.c tests/test-pthread_sigmask1.c tests/test-pthread_sigmask2.c tests/test-quotearg-simple.c tests/test-quotearg.h tests/test-raise.c tests/test-rawmemchr.c tests/test-read.c tests/test-realloc-gnu.c tests/test-reallocarray.c tests/test-regex.c tests/test-sched.c tests/test-select-fd.c tests/test-select-in.sh tests/test-select-out.sh tests/test-select-stdin.c tests/test-select.c tests/test-select.h tests/test-setenv.c tests/test-setlocale1.c tests/test-setlocale1.sh tests/test-setlocale2.c tests/test-setlocale2.sh tests/test-setlocale_null-mt-all.c tests/test-setlocale_null-mt-one.c tests/test-setlocale_null.c tests/test-setsockopt.c tests/test-sigaction.c tests/test-signal-h.c tests/test-sigprocmask.c tests/test-sigsegv-catch-segv1.c tests/test-sigsegv-catch-segv2.c tests/test-sigsegv-catch-stackoverflow1.c tests/test-sigsegv-catch-stackoverflow2.c tests/test-sleep.c tests/test-snprintf.c tests/test-sockets.c tests/test-stat-time.c tests/test-stat.c tests/test-stat.h tests/test-stdalign.c tests/test-stdbool.c tests/test-stddef.c tests/test-stdint.c tests/test-stdio.c tests/test-stdlib.c tests/test-strerror.c tests/test-strerror_r.c tests/test-striconv.c tests/test-string.c tests/test-strnlen.c tests/test-strstr.c tests/test-strtoimax.c tests/test-strtoll.c tests/test-strtoull.c tests/test-strtoumax.c tests/test-symlink.c tests/test-symlink.h tests/test-sys_ioctl.c tests/test-sys_select.c tests/test-sys_socket.c tests/test-sys_stat.c tests/test-sys_time.c tests/test-sys_types.c tests/test-sys_uio.c tests/test-sys_wait.h tests/test-thread_create.c tests/test-thread_self.c tests/test-time.c tests/test-unistd.c tests/test-unsetenv.c tests/test-vasnprintf.c tests/test-vc-list-files-cvs.sh tests/test-vc-list-files-git.sh tests/test-verify-try.c tests/test-verify.c tests/test-verify.sh tests/test-version-etc.c tests/test-version-etc.sh tests/test-wchar.c tests/test-wcrtomb-w32-1.sh tests/test-wcrtomb-w32-2.sh tests/test-wcrtomb-w32-3.sh tests/test-wcrtomb-w32-4.sh tests/test-wcrtomb-w32-5.sh tests/test-wcrtomb-w32-6.sh tests/test-wcrtomb-w32-7.sh tests/test-wcrtomb-w32.c tests/test-wcrtomb.c tests/test-wcrtomb.sh tests/test-wctype-h.c tests/test-wcwidth.c tests/test-xalloc-die.c tests/test-xalloc-die.sh tests/test-xstrtoimax.c tests/test-xstrtoimax.sh tests/test-xstrtol.c tests/test-xstrtol.sh tests/test-xstrtoul.c tests/unistr/test-u8-mbtoucr.c tests/unistr/test-u8-uctomb.c tests/uniwidth/test-uc_width.c tests/uniwidth/test-uc_width2.c tests/uniwidth/test-uc_width2.sh tests/zerosize-ptr.h tests=lib/_Noreturn.h tests=lib/accept.c tests=lib/anytostr.c tests=lib/arg-nonnull.h tests=lib/arpa_inet.in.h tests=lib/asnprintf.c tests=lib/bind.c tests=lib/c++defs.h tests=lib/connect.c tests=lib/fdopen.c tests=lib/float+.h tests=lib/float.c tests=lib/float.in.h tests=lib/fpucw.h tests=lib/ftruncate.c tests=lib/gettimeofday.c tests=lib/glthread/thread.c tests=lib/glthread/thread.h tests=lib/hash-pjw.c tests=lib/hash-pjw.h tests=lib/imaxtostr.c tests=lib/inet_pton.c tests=lib/inttostr.c tests=lib/inttostr.h tests=lib/ioctl.c tests=lib/itold.c tests=lib/listen.c tests=lib/localename-table.c tests=lib/localename-table.h tests=lib/localename.c tests=lib/localename.h tests=lib/nanosleep.c tests=lib/netinet_in.in.h tests=lib/offtostr.c tests=lib/perror.c tests=lib/printf-args.c tests=lib/printf-args.h tests=lib/printf-parse.c tests=lib/printf-parse.h tests=lib/pthread-thread.c tests=lib/pthread.in.h tests=lib/pthread_sigmask.c tests=lib/putenv.c tests=lib/sched.in.h tests=lib/select.c tests=lib/setenv.c tests=lib/setlocale.c tests=lib/setsockopt.c tests=lib/sig-handler.c tests=lib/sig-handler.h tests=lib/sigaction.c tests=lib/sigprocmask.c tests=lib/size_max.h tests=lib/sleep.c tests=lib/snprintf.c tests=lib/socket.c tests=lib/sockets.c tests=lib/sockets.h tests=lib/strerror_r.c tests=lib/symlink.c tests=lib/sys_ioctl.in.h tests=lib/sys_select.in.h tests=lib/sys_socket.c tests=lib/sys_socket.in.h tests=lib/sys_time.in.h tests=lib/sys_uio.in.h tests=lib/thread-optim.h tests=lib/uinttostr.c tests=lib/umaxtostr.c tests=lib/unsetenv.c tests=lib/vasnprintf.c tests=lib/vasnprintf.h tests=lib/w32sock.h tests=lib/warn-on-use.h tests=lib/windows-thread.c tests=lib/windows-thread.h tests=lib/windows-tls.c tests=lib/windows-tls.h tests=lib/xsize.c tests=lib/xsize.h tests=lib/xstrtol-error.c tests=lib/xstrtol-error.h top/GNUmakefile top/README-release top/maint.mk ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/symlink.m4������������������������������������������������������������������0000664�0001750�0001750�00000003766�14670377450�016733� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 9 # See if we need to provide symlink replacement. dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Written by Eric Blake. AC_DEFUN([gl_FUNC_SYMLINK], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS_ONCE([symlink]) dnl The best we can do on mingw is provide a dummy that always fails, so dnl that compilation can proceed with fewer ifdefs. On FreeBSD 7.2, AIX 7.1, dnl and Solaris 9, we want to fix a bug with trailing slash handling. if test $ac_cv_func_symlink = no; then HAVE_SYMLINK=0 else AC_CACHE_CHECK([whether symlink handles trailing slash correctly], [gl_cv_func_symlink_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <unistd.h> ]], [[int result = 0; if (!symlink ("a", "conftest.link/")) result |= 1; if (symlink ("conftest.f", "conftest.lnk2")) result |= 2; else if (!symlink ("a", "conftest.lnk2/")) result |= 4; return result; ]])], [gl_cv_func_symlink_works=yes], [gl_cv_func_symlink_works=no], [case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_symlink_works="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.f conftest.link conftest.lnk2]) case "$gl_cv_func_symlink_works" in *yes) ;; *) REPLACE_SYMLINK=1 ;; esac fi ]) ����������kbuild-3608/src/grep/m4/year2038.m4�����������������������������������������������������������������0000664�0001750�0001750�00000011437�14670377450�016514� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# year2038.m4 serial 7 dnl Copyright (C) 2017-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Attempt to ensure that 'time_t' can go past the year 2038 and that dnl the functions 'time', 'stat', etc. work with post-2038 timestamps. AC_DEFUN([gl_YEAR2038_EARLY], [ AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], [For 64-bit time_t on 32-bit mingw.]) ;; esac ]) # gl_YEAR2038_TEST_INCLUDES # ------------------------- AC_DEFUN([gl_YEAR2038_TEST_INCLUDES], [[ #include <time.h> /* Check that time_t can represent 2**32 - 1 correctly. */ #define LARGE_TIME_T \\ ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 && LARGE_TIME_T % 65537 == 0) ? 1 : -1]; ]]) # gl_YEAR2038_BODY(REQUIRE-YEAR2038-SAFE) ----------------------------------------- AC_DEFUN([gl_YEAR2038_BODY], [ AC_ARG_ENABLE([year2038], [ --disable-year2038 omit support for timestamps past the year 2038]) AS_IF([test "$enable_year2038" != no], [ dnl On many systems, time_t is already a 64-bit type. dnl On those systems where time_t is still 32-bit, it requires kernel dnl and libc support to make it 64-bit. For glibc 2.34 and later on Linux, dnl defining _TIME_BITS=64 and _FILE_OFFSET_BITS=64 is needed on x86 and ARM. dnl dnl On native Windows, the system include files define types __time32_t dnl and __time64_t. By default, time_t is an alias of dnl - __time32_t on 32-bit mingw, dnl - __time64_t on 64-bit mingw and on MSVC (since MSVC 8). dnl But when compiling with -D__MINGW_USE_VC2005_COMPAT, time_t is an dnl alias of __time64_t. dnl And when compiling with -D_USE_32BIT_TIME_T, time_t is an alias of dnl __time32_t. AC_CACHE_CHECK([for time_t past the year 2038], [gl_cv_type_time_t_y2038], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE([gl_YEAR2038_TEST_INCLUDES])], [gl_cv_type_time_t_y2038=yes], [gl_cv_type_time_t_y2038=no]) ]) if test "$gl_cv_type_time_t_y2038" = no; then AC_CACHE_CHECK([for 64-bit time_t with _TIME_BITS=64], [gl_cv_type_time_t_bits_macro], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[#define _TIME_BITS 64 #define _FILE_OFFSET_BITS 64 ]gl_YEAR2038_TEST_INCLUDES])], [gl_cv_type_time_t_bits_macro=yes], [gl_cv_type_time_t_bits_macro=no]) ]) if test "$gl_cv_type_time_t_bits_macro" = yes; then AC_DEFINE([_TIME_BITS], [64], [Number of bits in a timestamp, on hosts where this is settable.]) dnl AC_SYS_LARGFILE also defines this; it's OK if we do too. AC_DEFINE([_FILE_OFFSET_BITS], [64], [Number of bits in a file offset, on hosts where this is settable.]) gl_cv_type_time_t_y2038=yes fi fi if test $gl_cv_type_time_t_y2038 = no; then AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef _USE_32BIT_TIME_T int ok; #else error fail #endif ]])], [AC_MSG_FAILURE( [The 'time_t' type stops working after January 2038. Remove _USE_32BIT_TIME_T from the compiler flags.])], [# If not cross-compiling and $1 says we should check, # and 'touch' works with a large timestamp, then evidently wider time_t # is desired and supported, so fail and ask the builder to fix the # problem. Otherwise, just warn the builder. m4_ifval([$1], [if test $cross_compiling = no \ && TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null; then case `TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null` in *'Feb 7 2106'* | *'Feb 7 17:10'*) AC_MSG_FAILURE( [The 'time_t' type stops working after January 2038, and your system appears to support a wider 'time_t'. Try configuring with 'CC="${CC} -m64"'. To build with a 32-bit time_t anyway (not recommended), configure with '--disable-year2038'.]);; esac rm -f conftest.time fi]) if test "$gl_warned_about_y2038" != yes; then AC_MSG_WARN( [The 'time_t' type stops working after January 2038, and this package needs a wider 'time_t' type if there is any way to access timestamps after that. Configure with 'CC="${CC} -m64"' perhaps?]) gl_warned_about_y2038=yes fi ]) fi]) ]) AC_DEFUN([gl_YEAR2038], [ gl_YEAR2038_BODY([require-year2038-safe]) ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/pipe.m4���������������������������������������������������������������������0000664�0001750�0001750�00000000660�14670377450�016170� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pipe.m4 serial 2 dnl Copyright (C) 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_PIPE], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([pipe]) if test $ac_cv_func_pipe != yes; then HAVE_PIPE=0 fi ]) ��������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fchdir.m4�������������������������������������������������������������������0000664�0001750�0001750�00000004651�14670377440�016475� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# fchdir.m4 serial 26 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FCHDIR], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_DECLS_ONCE([fchdir]) if test $ac_cv_have_decl_fchdir = no; then HAVE_DECL_FCHDIR=0 fi AC_REQUIRE([gl_TEST_FCHDIR]) if test $HAVE_FCHDIR = 0; then AC_LIBOBJ([fchdir]) gl_PREREQ_FCHDIR AC_DEFINE([REPLACE_FCHDIR], [1], [Define to 1 if gnulib's fchdir() replacement is used.]) dnl We must also replace anything that can manipulate a directory fd, dnl to keep our bookkeeping up-to-date. We don't have to replace dnl fstatat, since no platform has fstatat but lacks fchdir. AC_CACHE_CHECK([whether open can visit directories], [gl_cv_func_open_directory_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <fcntl.h> ]GL_MDA_DEFINES], [[return open(".", O_RDONLY) < 0;]])], [gl_cv_func_open_directory_works=yes], [gl_cv_func_open_directory_works=no], [case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_open_directory_works="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_open_directory_works="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_open_directory_works="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_open_directory_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_open_directory_works" in *yes) ;; *) AC_DEFINE([REPLACE_OPEN_DIRECTORY], [1], [Define to 1 if open() should work around the inability to open a directory.]) ;; esac fi ]) # Determine whether to use the overrides in lib/fchdir.c. AC_DEFUN([gl_TEST_FCHDIR], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([fchdir]) if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi ]) # Prerequisites of lib/fchdir.c. AC_DEFUN([gl_PREREQ_FCHDIR], [:]) ���������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/stat.m4���������������������������������������������������������������������0000664�0001750�0001750�00000005457�14670377450�016217� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 18 # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STAT], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([lstat]) case "$host_os" in mingw*) dnl On this platform, the original stat() returns st_atime, st_mtime, dnl st_ctime values that are affected by the time zone. REPLACE_STAT=1 ;; *) dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/"). dnl (For mingw, this is due to a broken stat() override in libmingwex.a.) dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/"). AC_CACHE_CHECK([whether stat handles trailing slashes on files], [gl_cv_func_stat_file_slash], [touch conftest.tmp # Assume that if we have lstat, we can also check symlinks. if test $ac_cv_func_lstat = yes; then ln -s conftest.tmp conftest.lnk fi AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/stat.h> ]], [[int result = 0; struct stat st; if (!stat ("conftest.tmp/", &st)) result |= 1; #if HAVE_LSTAT if (!stat ("conftest.lnk/", &st)) result |= 2; #endif return result; ]])], [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], [case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.tmp conftest.lnk]) case $gl_cv_func_stat_file_slash in *no) REPLACE_STAT=1 AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs help when passed a file name with a trailing slash]);; esac case $host_os in dnl Solaris stat can return a negative tv_nsec. solaris*) REPLACE_FSTAT=1 ;; esac ;; esac ]) # Prerequisites of lib/stat.c and lib/stat-w32.c. AC_DEFUN([gl_PREREQ_STAT], [ AC_REQUIRE([gl_SYS_STAT_H]) AC_REQUIRE([gl_PREREQ_STAT_W32]) : ]) # Prerequisites of lib/stat-w32.c. AC_DEFUN([gl_PREREQ_STAT_W32], [ AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) AC_CHECK_HEADERS([sdkddkver.h]) ;; esac ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/assert.m4�������������������������������������������������������������������0000664�0001750�0001750�00000001660�14670377437�016542� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#serial 7 # Copyright (C) 1998-1999, 2001, 2004, 2008-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. dnl based on code from Eleftherios Gkioulekas dnl Autoconf 2.60 provides AC_HEADER_ASSERT for the same purpose, but dnl it has broken semantics for --enable-assert until 2.64. AC_DEFUN([gl_ASSERT], [ AC_MSG_CHECKING([whether to enable assertions]) AC_ARG_ENABLE([assert], [AS_HELP_STRING([--disable-assert], [turn off assertions])], [AS_IF([test "x$enableval" = xno], [AC_DEFINE([NDEBUG], [1], [Define to 1 if assertions should be disabled.])], [test "x$enableval" != xyes], [AC_MSG_WARN([invalid argument supplied to --enable-assert]) enable_assert=yes])], [enable_assert=yes]) AC_MSG_RESULT([$enable_assert]) ]) ��������������������������������������������������������������������������������kbuild-3608/src/grep/m4/d-type.m4�������������������������������������������������������������������0000664�0001750�0001750�00000001727�14670377450�016442� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 12 dnl From Jim Meyering. dnl dnl Check whether struct dirent has a member named d_type. dnl # Copyright (C) 1997, 1999-2004, 2006, 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE], [AC_CACHE_CHECK([for d_type member in directory struct], [gl_cv_struct_dirent_d_type], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <dirent.h> ]], [[struct dirent dp; dp.d_type = 0;]])], [gl_cv_struct_dirent_d_type=yes], [gl_cv_struct_dirent_d_type=no]) ] ) if test $gl_cv_struct_dirent_d_type = yes; then AC_DEFINE([HAVE_STRUCT_DIRENT_D_TYPE], [1], [Define if there is a member named d_type in the struct describing directory headers.]) fi ] ) �����������������������������������������kbuild-3608/src/grep/m4/setlocale_null.m4�����������������������������������������������������������0000664�0001750�0001750�00000007222�14670377450�020241� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# setlocale_null.m4 serial 5 dnl Copyright (C) 2019-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SETLOCALE_NULL], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_PTHREADLIB]) AC_CHECK_HEADERS_ONCE([threads.h]) AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe], [gl_cv_func_setlocale_null_all_mtsafe], [case "$host_os" in # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) gl_cv_func_setlocale_null_all_mtsafe=no ;; # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) gl_cv_func_setlocale_null_all_mtsafe=yes ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; esac ]) dnl On platforms without multithreading, there is no issue. case "$host_os" in mingw*) ;; *) if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then gl_cv_func_setlocale_null_all_mtsafe="trivially yes" fi ;; esac case "$gl_cv_func_setlocale_null_all_mtsafe" in *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; esac AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ALL_MTSAFE], [$SETLOCALE_NULL_ALL_MTSAFE], [Define to 1 if setlocale (LC_ALL, NULL) is multithread-safe.]) dnl This is about a single category (not LC_ALL). AC_CACHE_CHECK([whether setlocale (category, NULL) is multithread-safe], [gl_cv_func_setlocale_null_one_mtsafe], [case "$host_os" in # Guess no on OpenBSD, AIX. openbsd* | aix*) gl_cv_func_setlocale_null_one_mtsafe=no ;; # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) gl_cv_func_setlocale_null_one_mtsafe=yes ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; esac ]) dnl On platforms without multithreading, there is no issue. case "$host_os" in mingw*) ;; *) if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then gl_cv_func_setlocale_null_one_mtsafe="trivially yes" fi ;; esac case "$gl_cv_func_setlocale_null_one_mtsafe" in *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; esac AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ONE_MTSAFE], [$SETLOCALE_NULL_ONE_MTSAFE], [Define to 1 if setlocale (category, NULL) is multithread-safe.]) dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c. if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then case "$host_os" in mingw*) LIB_SETLOCALE_NULL= ;; *) gl_WEAK_SYMBOLS case "$gl_cv_have_weak" in *yes) LIB_SETLOCALE_NULL= ;; *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; esac ;; esac else LIB_SETLOCALE_NULL= fi dnl LIB_SETLOCALE_NULL is expected to be '-pthread' or '-lpthread' on AIX dnl with gcc or xlc, and empty otherwise. AC_SUBST([LIB_SETLOCALE_NULL]) ]) # Prerequisites of lib/setlocale-lock.c. AC_DEFUN([gl_PREREQ_SETLOCALE_LOCK], [ gl_VISIBILITY ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/pthread_rwlock_rdlock.m4����������������������������������������������������0000664�0001750�0001750�00000015463�14670377450�021610� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pthread_rwlock_rdlock.m4 serial 4 dnl Copyright (C) 2017-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Inspired by dnl https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c dnl by Intel Corporation. dnl Test whether in a situation where dnl - an rwlock is taken by a reader and has a writer waiting, dnl - an additional reader requests the lock, dnl - the waiting writer and the requesting reader threads have the same dnl priority, dnl the requesting reader thread gets blocked, so that at some point the dnl waiting writer can acquire the lock. dnl Without such a guarantee, when there a N readers and each of the readers dnl spends more than 1/Nth of the time with the lock held, there is a high dnl probability that the waiting writer will not get the lock in a given finite dnl time, a phenomenon called "writer starvation". dnl Without such a guarantee, applications have a hard time avoiding writer dnl starvation. dnl dnl POSIX:2017 makes this requirement only for implementations that support TPS dnl (Thread Priority Scheduling) and only for the scheduling policies SCHED_FIFO dnl and SCHED_RR, see dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html dnl but this test verifies the guarantee regardless of TPS and regardless of dnl scheduling policy. dnl Glibc does not provide this guarantee (and never will on Linux), see dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701 dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], [ AC_REQUIRE([gl_THREADLIB_EARLY]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader], [gl_cv_pthread_rwlock_rdlock_prefer_writer], [save_LIBS="$LIBS" LIBS="$LIBS $LIBMULTITHREAD" AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <errno.h> #include <pthread.h> #include <stdlib.h> #include <unistd.h> #define SUCCEED() exit (0) #define FAILURE() exit (1) #define UNEXPECTED(n) (exit (10 + (n))) /* The main thread creates the waiting writer and the requesting reader threads in the default way; this guarantees that they have the same priority. We can reuse the main thread as first reader thread. */ static pthread_rwlock_t lock; static pthread_t reader1; static pthread_t writer; static pthread_t reader2; static pthread_t timer; /* Used to pass control from writer to reader2 and from reader2 to timer, as in a relay race. Passing control from one running thread to another running thread is most likely faster than to create the second thread. */ static pthread_mutex_t baton; static void * timer_func (void *ignored) { /* Step 13 (can be before or after step 12): The timer thread takes the baton, then waits a moment to make sure it can tell whether the second reader thread is blocked at step 12. */ if (pthread_mutex_lock (&baton)) UNEXPECTED (13); usleep (100000); /* By the time we get here, it's clear that the second reader thread is blocked at step 12. This is the desired behaviour. */ SUCCEED (); } static void * reader2_func (void *ignored) { int err; /* Step 8 (can be before or after step 7): The second reader thread takes the baton, then waits a moment to make sure the writer thread has reached step 7. */ if (pthread_mutex_lock (&baton)) UNEXPECTED (8); usleep (100000); /* Step 9: The second reader thread requests the lock. */ err = pthread_rwlock_tryrdlock (&lock); if (err == 0) FAILURE (); else if (err != EBUSY) UNEXPECTED (9); /* Step 10: Launch a timer, to test whether the next call blocks. */ if (pthread_create (&timer, NULL, timer_func, NULL)) UNEXPECTED (10); /* Step 11: Release the baton. */ if (pthread_mutex_unlock (&baton)) UNEXPECTED (11); /* Step 12: The second reader thread requests the lock. */ err = pthread_rwlock_rdlock (&lock); if (err == 0) FAILURE (); else UNEXPECTED (12); } static void * writer_func (void *ignored) { /* Step 4: Take the baton, so that the second reader thread does not go ahead too early. */ if (pthread_mutex_lock (&baton)) UNEXPECTED (4); /* Step 5: Create the second reader thread. */ if (pthread_create (&reader2, NULL, reader2_func, NULL)) UNEXPECTED (5); /* Step 6: Release the baton. */ if (pthread_mutex_unlock (&baton)) UNEXPECTED (6); /* Step 7: The writer thread requests the lock. */ if (pthread_rwlock_wrlock (&lock)) UNEXPECTED (7); return NULL; } int main () { reader1 = pthread_self (); /* Step 1: The main thread initializes the lock and the baton. */ if (pthread_rwlock_init (&lock, NULL)) UNEXPECTED (1); if (pthread_mutex_init (&baton, NULL)) UNEXPECTED (1); /* Step 2: The main thread acquires the lock as a reader. */ if (pthread_rwlock_rdlock (&lock)) UNEXPECTED (2); /* Step 3: Create the writer thread. */ if (pthread_create (&writer, NULL, writer_func, NULL)) UNEXPECTED (3); /* Job done. Go to sleep. */ for (;;) { sleep (1); } } ]])], [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes], [gl_cv_pthread_rwlock_rdlock_prefer_writer=no], [case "$host_os" in # Guess no on glibc systems. *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; # Guess no on musl systems. *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; # Guess no on bionic systems. *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; # Guess yes on native Windows with the mingw-w64 winpthreads library. # Guess no on native Windows with the gnulib windows-rwlock module. mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" else gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" fi ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; esac ]) LIBS="$save_LIBS" ]) case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in *yes) AC_DEFINE([HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], [1], [Define if the 'pthread_rwlock_rdlock' function prefers a writer to a reader.]) ;; esac ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mbsrtowcs.m4����������������������������������������������������������������0000664�0001750�0001750�00000010270�14670377450�017254� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mbsrtowcs.m4 serial 14 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MBSRTOWCS], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN AC_CHECK_FUNCS_ONCE([mbsrtowcs]) if test $ac_cv_func_mbsrtowcs = no; then HAVE_MBSRTOWCS=0 AC_CHECK_DECLS([mbsrtowcs],,, [[ #include <wchar.h> ]]) if test $ac_cv_have_decl_mbsrtowcs = yes; then dnl On Minix 3.1.8, the system's <wchar.h> declares mbsrtowcs() although dnl it does not have the function. Avoid a collision with gnulib's dnl replacement. REPLACE_MBSRTOWCS=1 fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_MBSRTOWCS=1 else gl_MBSRTOWCS_WORKS case "$gl_cv_func_mbsrtowcs_works" in *yes) ;; *) REPLACE_MBSRTOWCS=1 ;; esac fi fi ]) dnl Test whether mbsrtowcs works. dnl Result is gl_cv_func_mbsrtowcs_works. AC_DEFUN([gl_MBSRTOWCS_WORKS], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbsrtowcs works], [gl_cv_func_mbsrtowcs_works], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on HP-UX, Solaris, mingw. hpux* | solaris* | mingw*) gl_cv_func_mbsrtowcs_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbsrtowcs_works="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { int result = 0; /* Test whether the function supports a NULL destination argument. This fails on native Windows. */ if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { const char input[] = "\337er"; const char *src = input; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbsrtowcs (NULL, &src, 1, &state) != 3 || src != input) result |= 1; } /* Test whether the function works when started with a conversion state in non-initial state. This fails on HP-UX 11.11 and Solaris 10. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { const char input[] = "B\303\274\303\237er"; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (NULL, input + 1, 1, &state) == (size_t)(-2)) if (!mbsinit (&state)) { const char *src = input + 2; if (mbsrtowcs (NULL, &src, 10, &state) != 4) result |= 2; } } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { const char input[] = "<\306\374\313\334\270\354>"; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (NULL, input + 3, 1, &state) == (size_t)(-2)) if (!mbsinit (&state)) { const char *src = input + 4; if (mbsrtowcs (NULL, &src, 10, &state) != 3) result |= 4; } } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { const char input[] = "B\250\271\201\060\211\070er"; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (NULL, input + 1, 1, &state) == (size_t)(-2)) if (!mbsinit (&state)) { const char *src = input + 2; if (mbsrtowcs (NULL, &src, 10, &state) != 4) result |= 8; } } return result; }]])], [gl_cv_func_mbsrtowcs_works=yes], [gl_cv_func_mbsrtowcs_works=no], [:]) fi ]) ]) # Prerequisites of lib/mbsrtowcs.c. AC_DEFUN([gl_PREREQ_MBSRTOWCS], [ : ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mmap-anon.m4����������������������������������������������������������������0000664�0001750�0001750�00000003747�14670377450�017127� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mmap-anon.m4 serial 12 dnl Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Detect how mmap can be used to create anonymous (not file-backed) memory # mappings. # - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS # and MAP_ANON exist and have the same value. # - On HP-UX, only MAP_ANONYMOUS exists. # - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists. # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be # used. AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON], [ dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is # irrelevant for anonymous mappings. AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) # Try to allow MAP_ANONYMOUS. gl_have_mmap_anonymous=no if test $gl_have_mmap = yes; then AC_MSG_CHECKING([for MAP_ANONYMOUS]) AC_EGREP_CPP([I cannot identify this map], [ #include <sys/mman.h> #ifdef MAP_ANONYMOUS I cannot identify this map #endif ], [gl_have_mmap_anonymous=yes]) if test $gl_have_mmap_anonymous != yes; then AC_EGREP_CPP([I cannot identify this map], [ #include <sys/mman.h> #ifdef MAP_ANON I cannot identify this map #endif ], [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.]) gl_have_mmap_anonymous=yes]) fi AC_MSG_RESULT([$gl_have_mmap_anonymous]) if test $gl_have_mmap_anonymous = yes; then AC_DEFINE([HAVE_MAP_ANONYMOUS], [1], [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including config.h and <sys/mman.h>.]) fi fi ]) �������������������������kbuild-3608/src/grep/m4/wchar_t.m4������������������������������������������������������������������0000664�0001750�0001750�00000001462�14670377450�016663� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# wchar_t.m4 serial 4 (gettext-0.18.2) dnl Copyright (C) 2002-2003, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether <stddef.h> has the 'wchar_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WCHAR_T], [ AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <stddef.h> wchar_t foo = (wchar_t)'\0';]], [[]])], [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])]) if test $gt_cv_c_wchar_t = yes; then AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) fi ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/builtin-expect.m4�����������������������������������������������������������0000664�0001750�0001750�00000003023�14670377440�020162� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������dnl Check for __builtin_expect. dnl Copyright 2016-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Paul Eggert. AC_DEFUN([gl___BUILTIN_EXPECT], [ AC_CACHE_CHECK([for __builtin_expect], [gl_cv___builtin_expect], [AC_LINK_IFELSE( [AC_LANG_SOURCE([[ int main (int argc, char **argv) { argc = __builtin_expect (argc, 100); return argv[argc != 100][0]; }]])], [gl_cv___builtin_expect=yes], [AC_LINK_IFELSE( [AC_LANG_SOURCE([[ #include <builtins.h> int main (int argc, char **argv) { argc = __builtin_expect (argc, 100); return argv[argc != 100][0]; }]])], [gl_cv___builtin_expect="in <builtins.h>"], [gl_cv___builtin_expect=no])])]) if test "$gl_cv___builtin_expect" = yes; then AC_DEFINE([HAVE___BUILTIN_EXPECT], [1]) elif test "$gl_cv___builtin_expect" = "in <builtins.h>"; then AC_DEFINE([HAVE___BUILTIN_EXPECT], [2]) fi AH_VERBATIM([HAVE___BUILTIN_EXPECT], [/* Define to 1 if the compiler supports __builtin_expect, and to 2 if <builtins.h> does. */ #undef HAVE___BUILTIN_EXPECT #ifndef HAVE___BUILTIN_EXPECT # define __builtin_expect(e, c) (e) #elif HAVE___BUILTIN_EXPECT == 2 # include <builtins.h> #endif ]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/cycle-check.m4��������������������������������������������������������������0000664�0001750�0001750�00000000463�14670377440�017405� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#serial 7 dnl Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_CYCLE_CHECK], [:]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/wint_t.m4�������������������������������������������������������������������0000664�0001750�0001750�00000003433�14670377450�016540� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# wint_t.m4 serial 11 dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's dnl <wchar.h> or <wctype.h> would, if present, override 'wint_t'. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WINT_T], [ AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <wchar.h> wint_t foo = (wchar_t)'\0';]], [[]])], [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])]) if test $gt_cv_c_wint_t = yes; then AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present, dnl override 'wint_t'. AC_CACHE_CHECK([whether wint_t is large enough], [gl_cv_type_wint_t_large_enough], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <wchar.h> int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; ]])], [gl_cv_type_wint_t_large_enough=yes], [gl_cv_type_wint_t_large_enough=no])]) if test $gl_cv_type_wint_t_large_enough = no; then GNULIBHEADERS_OVERRIDE_WINT_T=1 else GNULIBHEADERS_OVERRIDE_WINT_T=0 fi else GNULIBHEADERS_OVERRIDE_WINT_T=0 fi AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T]) ]) dnl Prerequisites of the 'wint_t' override. AC_DEFUN([gl_TYPE_WINT_T_PREREQ], [ AC_CHECK_HEADERS_ONCE([crtdefs.h]) if test $ac_cv_header_crtdefs_h = yes; then HAVE_CRTDEFS_H=1 else HAVE_CRTDEFS_H=0 fi AC_SUBST([HAVE_CRTDEFS_H]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/setenv.m4�������������������������������������������������������������������0000664�0001750�0001750�00000011570�14670377450�016541� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# setenv.m4 serial 30 dnl Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SETENV], [ AC_REQUIRE([gl_FUNC_SETENV_SEPARATE]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles if test $ac_cv_func_setenv = no; then HAVE_SETENV=0 else AC_CACHE_CHECK([whether setenv validates arguments], [gl_cv_func_setenv_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdlib.h> #include <errno.h> #include <string.h> ]], [[ int result = 0; { if (setenv ("", "", 0) != -1) result |= 1; else if (errno != EINVAL) result |= 2; } { if (setenv ("a", "=", 1) != 0) result |= 4; else if (strcmp (getenv ("a"), "=") != 0) result |= 8; } return result; ]])], [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_setenv_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_setenv_works" in *yes) ;; *) REPLACE_SETENV=1 ;; esac fi ]) # Like gl_FUNC_SETENV, except prepare for separate compilation # (no REPLACE_SETENV, no AC_LIBOBJ). AC_DEFUN([gl_FUNC_SETENV_SEPARATE], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_CHECK_DECLS_ONCE([setenv]) if test $ac_cv_have_decl_setenv = no; then HAVE_DECL_SETENV=0 fi AC_CHECK_FUNCS_ONCE([setenv]) gl_PREREQ_SETENV ]) AC_DEFUN([gl_FUNC_UNSETENV], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_DECLS_ONCE([unsetenv]) if test $ac_cv_have_decl_unsetenv = no; then HAVE_DECL_UNSETENV=0 fi AC_CHECK_FUNCS([unsetenv]) if test $ac_cv_func_unsetenv = no; then HAVE_UNSETENV=0 else HAVE_UNSETENV=1 dnl Some BSDs return void, failing to do error checking. AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ #undef _BSD #define _BSD 1 /* unhide unsetenv declaration in OSF/1 5.1 <stdlib.h> */ #include <stdlib.h> extern #ifdef __cplusplus "C" #endif int unsetenv (const char *name); ]], [[]])], [gt_cv_func_unsetenv_ret='int'], [gt_cv_func_unsetenv_ret='void'])]) if test $gt_cv_func_unsetenv_ret = 'void'; then AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void instead of int.]) REPLACE_UNSETENV=1 fi dnl Solaris 10 unsetenv does not remove all copies of a name. dnl Haiku alpha 2 unsetenv gets confused by assignment to environ. dnl OpenBSD 4.7 unsetenv("") does not fail. AC_CACHE_CHECK([whether unsetenv obeys POSIX], [gl_cv_func_unsetenv_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include <stdlib.h> #include <errno.h> extern char **environ; ]GL_MDA_DEFINES], [[ char entry1[] = "a=1"; char entry2[] = "b=2"; char *env[] = { entry1, entry2, NULL }; if (putenv ((char *) "a=1")) return 1; if (putenv (entry2)) return 2; entry2[0] = 'a'; unsetenv ("a"); if (getenv ("a")) return 3; if (!unsetenv ("") || errno != EINVAL) return 4; entry2[0] = 'b'; environ = env; if (!getenv ("a")) return 5; entry2[0] = 'a'; unsetenv ("a"); if (getenv ("a")) return 6; ]])], [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no], [case "$host_os" in # Guess yes on glibc systems. *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_unsetenv_works" in *yes) ;; *) REPLACE_UNSETENV=1 ;; esac fi ]) # Prerequisites of lib/setenv.c. AC_DEFUN([gl_PREREQ_SETENV], [ AC_REQUIRE([AC_FUNC_ALLOCA]) AC_REQUIRE([gl_ENVIRON]) AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_HEADERS([search.h]) AC_CHECK_FUNCS([tsearch]) ]) # Prerequisites of lib/unsetenv.c. AC_DEFUN([gl_PREREQ_UNSETENV], [ AC_REQUIRE([gl_ENVIRON]) AC_CHECK_HEADERS_ONCE([unistd.h]) ]) ����������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/wcwidth.m4������������������������������������������������������������������0000664�0001750�0001750�00000006577�14670377450�016721� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# wcwidth.m4 serial 34 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_WCWIDTH], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade glibc <wchar.h> to declare wcwidth(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_CHECK_HEADERS_ONCE([wchar.h]) AC_CHECK_FUNCS_ONCE([wcwidth]) AC_CHECK_DECLS([wcwidth], [], [], [[ #include <wchar.h> ]]) if test $ac_cv_have_decl_wcwidth != yes; then HAVE_DECL_WCWIDTH=0 fi if test $ac_cv_func_wcwidth != yes; then AC_CACHE_CHECK([whether wcwidth is a macro], [gl_cv_func_wcwidth_macro], [AC_EGREP_CPP([wchar_header_defines_wcwidth], [ #include <wchar.h> #ifdef wcwidth wchar_header_defines_wcwidth #endif], [gl_cv_func_wcwidth_macro=yes], [gl_cv_func_wcwidth_macro=no]) ]) fi if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then HAVE_WCWIDTH=1 dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. dnl On NetBSD 9.0, OpenBSD 5.0, MidnightBSD 1.1, dnl wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1. dnl On NetBSD 9.0, MidnightBSD 1.1, OSF/1 5.1, dnl wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. dnl On OpenBSD 5.8, wcwidth(0xFF1A) (FULLWIDTH COLON) returns 0. dnl This leads to bugs in 'ls' (coreutils). dnl On Solaris 11.4, wcwidth(0x2202) (PARTIAL DIFFERENTIAL) returns 2, dnl even in Western locales. AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales], [gl_cv_func_wcwidth_works], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <wchar.h> #if !HAVE_DECL_WCWIDTH extern # ifdef __cplusplus "C" # endif int wcwidth (int); #endif int main () { int result = 0; if (setlocale (LC_ALL, "en_US.UTF-8") != NULL) { if (wcwidth (0x0301) > 0) result |= 1; if (wcwidth (0x05B0) > 0) result |= 2; if (wcwidth (0x200B) > 0) result |= 4; if (wcwidth (0xFF1A) == 0) result |= 8; if (wcwidth (0x2202) > 1) result |= 16; } return result; }]])], [gl_cv_func_wcwidth_works=yes], [gl_cv_func_wcwidth_works=no], [ changequote(,)dnl case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_wcwidth_works="guessing yes";; # Guess yes on AIX 7 systems. aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";; *) gl_cv_func_wcwidth_works="$gl_cross_guess_normal";; esac changequote([,])dnl ]) ]) case "$gl_cv_func_wcwidth_works" in *yes) ;; *no) REPLACE_WCWIDTH=1 ;; esac else HAVE_WCWIDTH=0 fi dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not dnl have the wcwidth function, then it does not declare it. ]) # Prerequisites of lib/wcwidth.c. AC_DEFUN([gl_PREREQ_WCWIDTH], [ AC_REQUIRE([AC_C_INLINE]) : ]) ���������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/filenamecat.m4��������������������������������������������������������������0000664�0001750�0001750�00000000755�14670377450�017510� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# filenamecat.m4 serial 11 dnl Copyright (C) 2002-2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FILE_NAME_CONCAT], [ AC_REQUIRE([gl_FILE_NAME_CONCAT_LGPL]) ]) AC_DEFUN([gl_FILE_NAME_CONCAT_LGPL], [ dnl Prerequisites of lib/filenamecat-lgpl.c. AC_CHECK_FUNCS_ONCE([mempcpy]) ]) �������������������kbuild-3608/src/grep/m4/lib-prefix.m4���������������������������������������������������������������0000664�0001750�0001750�00000027566�14670377450�017312� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# lib-prefix.m4 serial 19 dnl Copyright (C) 2001-2005, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed dnl with the same --prefix option. dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate dnl libraries, but is otherwise very convenient. AC_DEFUN([AC_LIB_PREFIX], [ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_ARG_WITH([lib-prefix], [[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" fi fi ]) if test $use_additional = yes; then dnl Potentially add $additional_includedir to $CPPFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $CPPFLAGS. CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi fi dnl Potentially add $additional_libdir to $LDFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LDFLAGS. LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" fi fi fi fi fi ]) dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and dnl $exec_prefix will expand at the end of the configure script. AC_DEFUN([AC_LIB_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" ]) dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the dnl variables prefix and exec_prefix bound to the values they will have dnl at the end of the configure script. AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], [ acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" $1 exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" ]) dnl AC_LIB_PREPARE_MULTILIB creates dnl - a function acl_is_expected_elfclass, that tests whether standard input dn; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI, dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing dnl the basename of the libdir to try in turn, either "lib" or "lib64" or dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar. AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ dnl There is no formal standard regarding lib, lib32, and lib64. dnl On most glibc systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib. dnl We determine the compiler's default mode by looking at the compiler's dnl library search path. If at least one of its elements ends in /lib64 or dnl points to a directory whose absolute pathname ends in /lib64, we use that dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default, dnl namely "lib". dnl On Solaris systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT]) AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf], [AC_EGREP_CPP([Extensible Linking Format], [#ifdef __ELF__ Extensible Linking Format #endif ], [gl_cv_elf=yes], [gl_cv_elf=no]) ]) if test $gl_cv_elf = yes; then # Extract the ELF class of a file (5th byte) in decimal. # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header if od -A x < /dev/null >/dev/null 2>/dev/null; then # Use POSIX od. func_elfclass () { od -A n -t d1 -j 4 -N 1 } else # Use BSD hexdump. func_elfclass () { dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' echo } fi # Use 'expr', not 'test', to compare the values of func_elfclass, because on # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, # not 1 or 2. changequote(,)dnl case $HOST_CPU_C_ABI_32BIT in yes) # 32-bit ABI. acl_is_expected_elfclass () { expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null } ;; no) # 64-bit ABI. acl_is_expected_elfclass () { expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null } ;; *) # Unknown. acl_is_expected_elfclass () { : } ;; esac changequote([,])dnl else acl_is_expected_elfclass () { : } fi dnl Allow the user to override the result by setting acl_cv_libdirstems. AC_CACHE_CHECK([for the common suffixes of directories in the library search path], [acl_cv_libdirstems], [dnl Try 'lib' first, because that's the default for libdir in GNU, see dnl <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>. acl_libdirstem=lib acl_libdirstem2= acl_libdirstem3= case "$host_os" in solaris*) dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>. dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the dnl symlink is missing, so we set acl_libdirstem2 too. if test $HOST_CPU_C_ABI_32BIT = no; then acl_libdirstem2=lib/64 case "$host_cpu" in sparc*) acl_libdirstem3=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; esac fi ;; *) dnl If $CC generates code for a 32-bit ABI, the libraries are dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64. dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32. dnl Find the compiler's search path. However, non-system compilers dnl sometimes have odd library search paths. But we can't simply invoke dnl '/usr/bin/gcc -print-search-dirs' because that would not take into dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS. searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test $HOST_CPU_C_ABI_32BIT != no; then # 32-bit or unknown ABI. if test -d /usr/lib32; then acl_libdirstem2=lib32 fi fi if test $HOST_CPU_C_ABI_32BIT != yes; then # 64-bit or unknown ABI. if test -d /usr/lib64; then acl_libdirstem3=lib64 fi fi if test -n "$searchpath"; then acl_save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib32 ) acl_libdirstem2=lib32 ;; */lib64 ) acl_libdirstem3=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" if test $HOST_CPU_C_ABI_32BIT = yes; then # 32-bit ABI. acl_libdirstem3= fi if test $HOST_CPU_C_ABI_32BIT = no; then # 64-bit ABI. acl_libdirstem2= fi fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" ]) dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and dnl acl_libdirstem3. changequote(,)dnl acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` changequote([,])dnl ]) ������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/off_t.m4��������������������������������������������������������������������0000664�0001750�0001750�00000001006�14670377450�016323� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# off_t.m4 serial 1 dnl Copyright (C) 2012-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Check whether to override the 'off_t' type. dnl Set WINDOWS_64_BIT_OFF_T. AC_DEFUN([gl_TYPE_OFF_T], [ m4_ifdef([gl_LARGEFILE], [ AC_REQUIRE([gl_LARGEFILE]) ], [ WINDOWS_64_BIT_OFF_T=0 ]) AC_SUBST([WINDOWS_64_BIT_OFF_T]) ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/signalblocking.m4�����������������������������������������������������������0000664�0001750�0001750�00000001562�14670377450�020223� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# signalblocking.m4 serial 17 dnl Copyright (C) 2001-2002, 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Determine available signal blocking primitives. Three different APIs exist: # 1) POSIX: sigemptyset, sigaddset, sigprocmask # 2) SYSV: sighold, sigrelse # 3) BSD: sigblock, sigsetmask # For simplicity, here we check only for the POSIX signal blocking. AC_DEFUN([gl_SIGNALBLOCKING], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) HAVE_POSIX_SIGNALBLOCKING=0 if test "$gl_cv_type_sigset_t" = yes; then AC_CHECK_FUNC([sigprocmask], [HAVE_POSIX_SIGNALBLOCKING=1]) fi ]) # Prerequisites of lib/sigprocmask.c. AC_DEFUN([gl_PREREQ_SIGPROCMASK], [:]) ����������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mbrlen.m4�������������������������������������������������������������������0000664�0001750�0001750�00000016121�14670377450�016511� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mbrlen.m4 serial 11 -*- coding: utf-8 -*- dnl Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MBRLEN], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_REQUIRE([gl_FUNC_MBRTOWC]) AC_CHECK_FUNCS_ONCE([mbrlen]) if test $ac_cv_func_mbrlen = no; then HAVE_MBRLEN=0 AC_CHECK_DECLS([mbrlen],,, [[ #include <wchar.h> ]]) if test $ac_cv_have_decl_mbrlen = yes; then dnl On Minix 3.1.8, the system's <wchar.h> declares mbrlen() although dnl it does not have the function. Avoid a collision with gnulib's dnl replacement. REPLACE_MBRLEN=1 fi else dnl Most bugs affecting the system's mbrtowc function also affect the dnl mbrlen function. So override mbrlen whenever mbrtowc is overridden. dnl We could also run the individual tests below; the results would be dnl the same. if test $REPLACE_MBRTOWC = 1; then REPLACE_MBRLEN=1 fi fi ]) dnl Test whether mbrlen puts the state into non-initial state when parsing an dnl incomplete multibyte character. dnl Result is gl_cv_func_mbrlen_incomplete_state. AC_DEFUN([gl_MBRLEN_INCOMPLETE_STATE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrlen handles incomplete characters], [gl_cv_func_mbrlen_incomplete_state], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on AIX and OSF/1. aix* | osf*) gl_cv_func_mbrlen_incomplete_state="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrlen_incomplete_state="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_JA != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrlen (input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 1; } return 0; }]])], [gl_cv_func_mbrlen_incomplete_state=yes], [gl_cv_func_mbrlen_incomplete_state=no], []) fi ]) ]) dnl Test whether mbrlen, when parsing the end of a multibyte character, dnl correctly returns the number of bytes that were needed to complete the dnl character (not the total number of bytes of the multibyte character). dnl Result is gl_cv_func_mbrlen_retval. AC_DEFUN([gl_MBRLEN_RETVAL], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrlen has a correct return value], [gl_cv_func_mbrlen_retval], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on HP-UX and Solaris. hpux* | solaris*) gl_cv_func_mbrlen_retval="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrlen_retval="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { int result = 0; /* This fails on Solaris. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrlen (input + 1, 1, &state) == (size_t)(-2)) { input[1] = '\0'; if (mbrlen (input + 2, 5, &state) != 1) result |= 1; } } /* This fails on HP-UX 11.11. */ if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrlen (input + 1, 1, &state) == (size_t)(-2)) { input[1] = '\0'; if (mbrlen (input + 2, 5, &state) != 2) result |= 2; } } return result; }]])], [gl_cv_func_mbrlen_retval=yes], [gl_cv_func_mbrlen_retval=no], []) fi ]) ]) dnl Test whether mbrlen, when parsing a NUL character, correctly returns 0. dnl Result is gl_cv_func_mbrlen_nul_retval. AC_DEFUN([gl_MBRLEN_NUL_RETVAL], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrlen returns 0 when parsing a NUL character], [gl_cv_func_mbrlen_nul_retval], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on Solaris 9. solaris2.9) gl_cv_func_mbrlen_nul_retval="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrlen_nul_retval="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { /* This crashes on Solaris 9 inside __mbrtowc_dense_gb18030. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrlen ("", 1, &state) != 0) return 1; } return 0; }]])], [gl_cv_func_mbrlen_nul_retval=yes], [gl_cv_func_mbrlen_nul_retval=no], []) fi ]) ]) dnl Test whether mbrlen returns the correct value on empty input. AC_DEFUN([gl_MBRLEN_EMPTY_INPUT], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrlen works on empty input], [gl_cv_func_mbrlen_empty_input], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on AIX and glibc systems. aix* | *-gnu* | gnu*) gl_cv_func_mbrlen_empty_input="guessing no" ;; *) gl_cv_func_mbrlen_empty_input="guessing yes" ;; esac changequote([,])dnl AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <wchar.h> static mbstate_t mbs; int main (void) { return mbrlen ("", 0, &mbs) != (size_t) -2; }]])], [gl_cv_func_mbrlen_empty_input=yes], [gl_cv_func_mbrlen_empty_input=no], [:]) ]) ]) # Prerequisites of lib/mbrlen.c. AC_DEFUN([gl_PREREQ_MBRLEN], [ : ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/intl-thread-locale.m4�������������������������������������������������������0000664�0001750�0001750�00000017616�14670377450�020714� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# intl-thread-locale.m4 serial 9 dnl Copyright (C) 2015-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can be used in projects which are not available under dnl the GNU General Public License or the GNU Lesser General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Check how to retrieve the name of a per-thread locale (POSIX locale_t). dnl Sets gt_nameless_locales. AC_DEFUN([gt_INTL_THREAD_LOCALE_NAME], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl Persuade Solaris <locale.h> to define 'locale_t'. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl Test whether uselocale() exists and works at all. gt_FUNC_USELOCALE dnl On OpenBSD >= 6.2, the locale_t type and the uselocale(), newlocale(), dnl duplocale(), freelocale() functions exist but are effectively useless, dnl because the locale_t value depends only on the LC_CTYPE category of the dnl locale and furthermore contains only one bit of information (it dnl distinguishes the "C" locale from the *.UTF-8 locales). See dnl <https://cvsweb.openbsd.org/src/lib/libc/locale/newlocale.c?rev=1.1&content-type=text/x-cvsweb-markup>. dnl In the setlocale() implementation they have thought about the programs dnl that use the API ("Even though only LC_CTYPE has any effect in the dnl OpenBSD base system, store complete information about the global locale, dnl such that third-party software can access it"), but for uselocale() dnl they did not think about the programs. dnl In this situation, even the HAVE_NAMELESS_LOCALES support does not work. dnl So, define HAVE_FAKE_LOCALES and disable all locale_t support. case "$gt_cv_func_uselocale_works" in *yes) AC_CHECK_HEADERS_ONCE([xlocale.h]) AC_CACHE_CHECK([for fake locale system (OpenBSD)], [gt_cv_locale_fake], [AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #if HAVE_XLOCALE_H # include <xlocale.h> #endif int main () { locale_t loc1, loc2; if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL) return 1; if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL) return 1; loc1 = newlocale (LC_ALL_MASK, "de_DE.UTF-8", (locale_t)0); loc2 = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", (locale_t)0); return !(loc1 == loc2); }]])], [gt_cv_locale_fake=yes], [gt_cv_locale_fake=no], [dnl Guess the locale system is fake only on OpenBSD. case "$host_os" in openbsd*) gt_cv_locale_fake="guessing yes" ;; *) gt_cv_locale_fake="guessing no" ;; esac ]) ]) ;; *) gt_cv_locale_fake=no ;; esac case "$gt_cv_locale_fake" in *yes) gt_fake_locales=yes AC_DEFINE([HAVE_FAKE_LOCALES], [1], [Define if the locale_t type contains insufficient information, as on OpenBSD.]) ;; *) gt_fake_locales=no ;; esac case "$gt_cv_func_uselocale_works" in *yes) AC_CACHE_CHECK([for Solaris 11.4 locale system], [gt_cv_locale_solaris114], [case "$host_os" in solaris*) dnl Test whether <locale.h> defines locale_t as a typedef of dnl 'struct _LC_locale_t **' (whereas Illumos defines it as a dnl typedef of 'struct _locale *'). dnl Another possible test would be to include <sys/localedef.h> dnl and test whether it defines the _LC_core_data_locale_t type. dnl This type was added in Solaris 11.4. AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ #include <locale.h> struct _LC_locale_t *x; locale_t y; ]], [[*y = x;]])], [gt_cv_locale_solaris114=yes], [gt_cv_locale_solaris114=no]) ;; *) gt_cv_locale_solaris114=no ;; esac ]) ;; *) gt_cv_locale_solaris114=no ;; esac if test $gt_cv_locale_solaris114 = yes; then AC_DEFINE([HAVE_SOLARIS114_LOCALES], [1], [Define if the locale_t type is as on Solaris 11.4.]) fi dnl Solaris 12 will maybe provide getlocalename_l. If it does, it will dnl improve the implementation of gl_locale_name_thread(), by removing dnl the use of undocumented structures. case "$gt_cv_func_uselocale_works" in *yes) AC_CHECK_FUNCS([getlocalename_l]) ;; esac dnl This code is for platforms where the locale_t type does not provide access dnl to the name of each locale category. This code has the drawback that it dnl requires the gnulib overrides of 'newlocale', 'duplocale', 'freelocale', dnl which is a problem for GNU libunistring. Therefore try hard to avoid dnl enabling this code! gt_nameless_locales=no case "$host_os" in dnl It's needed on AIX 7.2. aix*) gt_nameless_locales=yes AC_DEFINE([HAVE_NAMELESS_LOCALES], [1], [Define if the locale_t type does not contain the name of each locale category.]) ;; esac dnl We cannot support uselocale() on platforms where the locale_t type is dnl fake. So, set dnl gt_good_uselocale = gt_working_uselocale && !gt_fake_locales. if test $gt_working_uselocale = yes && test $gt_fake_locales = no; then gt_good_uselocale=yes AC_DEFINE([HAVE_GOOD_USELOCALE], [1], [Define if the uselocale exists, may be safely called, and returns sufficient information.]) else gt_good_uselocale=no fi dnl Set gt_localename_enhances_locale_funcs to indicate whether localename.c dnl overrides newlocale(), duplocale(), freelocale() to keep track of locale dnl names. if test $gt_good_uselocale = yes && test $gt_nameless_locales = yes; then gt_localename_enhances_locale_funcs=yes LOCALENAME_ENHANCE_LOCALE_FUNCS=1 AC_DEFINE([LOCALENAME_ENHANCE_LOCALE_FUNCS], [1], [Define if localename.c overrides newlocale(), duplocale(), freelocale().]) else gt_localename_enhances_locale_funcs=no fi ]) dnl Tests whether uselocale() exists and is usable. dnl Sets gt_working_uselocale and defines HAVE_WORKING_USELOCALE. AC_DEFUN([gt_FUNC_USELOCALE], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade glibc and Solaris <locale.h> to define 'locale_t'. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_CHECK_FUNCS_ONCE([uselocale]) dnl On AIX 7.2, the uselocale() function is not documented and leads to dnl crashes in subsequent setlocale() invocations. dnl In 2019, some versions of z/OS lack the locale_t type and have a broken dnl uselocale function. if test $ac_cv_func_uselocale = yes; then AC_CHECK_HEADERS_ONCE([xlocale.h]) AC_CACHE_CHECK([whether uselocale works], [gt_cv_func_uselocale_works], [AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #if HAVE_XLOCALE_H # include <xlocale.h> #endif locale_t loc1; int main () { uselocale (NULL); setlocale (LC_ALL, "en_US.UTF-8"); return 0; }]])], [gt_cv_func_uselocale_works=yes], [gt_cv_func_uselocale_works=no], [# Guess no on AIX and z/OS, yes otherwise. case "$host_os" in aix* | openedition*) gt_cv_func_uselocale_works="guessing no" ;; *) gt_cv_func_uselocale_works="guessing yes" ;; esac ]) ]) else gt_cv_func_uselocale_works=no fi case "$gt_cv_func_uselocale_works" in *yes) gt_working_uselocale=yes AC_DEFINE([HAVE_WORKING_USELOCALE], [1], [Define if the uselocale function exists and may safely be called.]) ;; *) gt_working_uselocale=no ;; esac ]) ������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mempcpy.m4������������������������������������������������������������������0000664�0001750�0001750�00000001337�14670377450�016707� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mempcpy.m4 serial 12 dnl Copyright (C) 2003-2004, 2006-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MEMPCPY], [ dnl Persuade glibc <string.h> to declare mempcpy(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'. AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS([mempcpy]) if test $ac_cv_func_mempcpy = no; then HAVE_MEMPCPY=0 fi ]) # Prerequisites of lib/mempcpy.c. AC_DEFUN([gl_PREREQ_MEMPCPY], [ : ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/putenv.m4�������������������������������������������������������������������0000664�0001750�0001750�00000003757�14670377450�016566� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# putenv.m4 serial 25 dnl Copyright (C) 2002-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Jim Meyering. dnl dnl Check whether putenv ("FOO") removes FOO from the environment. dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that. AC_DEFUN([gl_FUNC_PUTENV], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([for putenv compatible with GNU and SVID], [gl_cv_func_svid_putenv], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT GL_MDA_DEFINES], [[ /* Put it in env. */ if (putenv ("CONFTEST_putenv=val")) return 1; /* Try to remove it. */ if (putenv ("CONFTEST_putenv")) return 2; /* Make sure it was deleted. */ if (getenv ("CONFTEST_putenv") != 0) return 3; return 0; ]])], [gl_cv_func_svid_putenv=yes], [gl_cv_func_svid_putenv=no], [dnl When crosscompiling, assume putenv is broken. case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_svid_putenv="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_svid_putenv="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_svid_putenv="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_svid_putenv="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_svid_putenv" in *yes) ;; *) REPLACE_PUTENV=1 ;; esac ]) # Prerequisites of lib/putenv.c. AC_DEFUN([gl_PREREQ_PUTENV], [ AC_CHECK_DECLS([_putenv]) ]) �����������������kbuild-3608/src/grep/m4/xstrtol.m4������������������������������������������������������������������0000664�0001750�0001750�00000000464�14670377450�016754� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#serial 11 dnl Copyright (C) 2002-2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_XSTRTOL], [ : ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/size_max.m4�����������������������������������������������������������������0000664�0001750�0001750�00000005476�14670377450�017064� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# size_max.m4 serial 12 dnl Copyright (C) 2003, 2005-2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_PREREQ([2.61]) AC_DEFUN([gl_SIZE_MAX], [ AC_CHECK_HEADERS([stdint.h]) dnl First test whether the system already has SIZE_MAX. AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ gl_cv_size_max=no AC_EGREP_CPP([Found it], [ #include <limits.h> #if HAVE_STDINT_H #include <stdint.h> #endif #ifdef SIZE_MAX Found it #endif ], [gl_cv_size_max=yes]) if test $gl_cv_size_max != yes; then dnl Define it ourselves. Here we assume that the type 'size_t' is not wider dnl than the type 'unsigned long'. Try hard to find a definition that can dnl be used in a preprocessor #if, i.e. doesn't contain a cast. AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], [#include <stddef.h> #include <limits.h>], [size_t_bits_minus_1=]) AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], [#include <stddef.h>], [fits_in_uint=]) if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then if test $fits_in_uint = 1; then dnl Even though SIZE_MAX fits in an unsigned int, it must be of type dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <stddef.h> extern size_t foo; extern unsigned long foo; ]], [[]])], [fits_in_uint=0]) fi dnl We cannot use 'expr' to simplify this expression, because 'expr' dnl works only with 'long' integers in the host environment, while we dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. if test $fits_in_uint = 1; then gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" else gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" fi else dnl Shouldn't happen, but who knows... gl_cv_size_max='((size_t)~(size_t)0)' fi fi ]) if test "$gl_cv_size_max" != yes; then AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], [Define as the maximum value of type 'size_t', if the system doesn't define it.]) fi dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with dnl #define by AC_DEFINE_UNQUOTED. AH_VERBATIM([SIZE_MAX], [/* Define as the maximum value of type 'size_t', if the system doesn't define it. */ #ifndef SIZE_MAX # undef SIZE_MAX #endif]) ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/nl_langinfo.m4��������������������������������������������������������������0000664�0001750�0001750�00000005276�14670377450�017531� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# nl_langinfo.m4 serial 8 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_NL_LANGINFO], [ AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) AC_REQUIRE([gl_LANGINFO_H]) AC_CHECK_FUNCS_ONCE([nl_langinfo]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) AC_REQUIRE([gl_PTHREADLIB]) AC_CHECK_HEADERS_ONCE([threads.h]) if test $ac_cv_func_nl_langinfo = yes; then # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken. AC_CACHE_CHECK([whether YESEXPR works], [gl_cv_func_nl_langinfo_yesexpr_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[#include <langinfo.h> ]], [[return !*nl_langinfo(YESEXPR); ]])], [gl_cv_func_nl_langinfo_yesexpr_works=yes], [gl_cv_func_nl_langinfo_yesexpr_works=no], [ case "$host_os" in # Guess no on irix systems. irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";; # Guess yes elsewhere. *) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";; esac ]) ]) case $gl_cv_func_nl_langinfo_yesexpr_works in *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;; *) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;; esac AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], [$FUNC_NL_LANGINFO_YESEXPR_WORKS], [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe. case "$host_os" in solaris*) NL_LANGINFO_MTSAFE=0 ;; *) NL_LANGINFO_MTSAFE=1 ;; esac AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], [Define to 1 if nl_langinfo is multithread-safe.]) if test $HAVE_LANGINFO_CODESET = 1 \ && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \ && test $HAVE_LANGINFO_ALTMON = 1 \ && test $HAVE_LANGINFO_ERA = 1 \ && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \ && test $NL_LANGINFO_MTSAFE = 1; then : else REPLACE_NL_LANGINFO=1 AC_DEFINE([REPLACE_NL_LANGINFO], [1], [Define if nl_langinfo exists but is overridden by gnulib.]) fi else HAVE_NL_LANGINFO=0 fi if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then LIB_NL_LANGINFO="$LIB_SETLOCALE_NULL" else LIB_NL_LANGINFO= fi dnl LIB_NL_LANGINFO is expected to be empty everywhere. AC_SUBST([LIB_NL_LANGINFO]) ]) # Prerequisites of lib/nl_langinfo-lock.c. AC_DEFUN([gl_PREREQ_NL_LANGINFO_LOCK], [ gl_VISIBILITY ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fopen.m4��������������������������������������������������������������������0000664�0001750�0001750�00000007601�14670377440�016343� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# fopen.m4 serial 12 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FOPEN], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw* | pw*) dnl Replace fopen, for handling of "/dev/null". REPLACE_FOPEN=1 dnl fopen on mingw also has the trailing slash bug. gl_cv_func_fopen_slash="guessing no" ;; *) dnl fopen("foo/", "w") should not create a file when the file name has a dnl trailing slash. AC_CACHE_CHECK([whether fopen recognizes a trailing slash], [gl_cv_func_fopen_slash], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stddef.h> #include <stdio.h> int main () { FILE *fp = fopen ("conftest.sl/", "w"); int result = (fp != NULL); if (fp != NULL) fclose (fp); return result; }]])], [gl_cv_func_fopen_slash=yes], [gl_cv_func_fopen_slash=no], [ changequote(,)dnl case "$host_os" in aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) gl_cv_func_fopen_slash="guessing no" ;; *) gl_cv_func_fopen_slash="guessing yes" ;; esac changequote([,])dnl ]) rm -f conftest.sl ]) ;; esac case "$gl_cv_func_fopen_slash" in *no) AC_DEFINE([FOPEN_TRAILING_SLASH_BUG], [1], [Define to 1 if fopen() fails to recognize a trailing slash.]) REPLACE_FOPEN=1 ;; esac ]) AC_DEFUN([gl_FUNC_FOPEN_GNU], [ AC_REQUIRE([gl_FUNC_FOPEN]) AC_CACHE_CHECK([whether fopen supports the mode character 'x'], [gl_cv_func_fopen_mode_x], [rm -f conftest.x AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <errno.h> int main () { FILE *fp; fp = fopen ("conftest.x", "w"); fclose (fp); fp = fopen ("conftest.x", "wx"); if (fp != NULL) /* 'x' ignored */ return 1; else if (errno == EEXIST) return 0; else /* 'x' rejected */ return 2; }]])], [gl_cv_func_fopen_mode_x=yes], [gl_cv_func_fopen_mode_x=no], [case "$host_os" in # Guess yes on glibc and musl systems. linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) gl_cv_func_fopen_mode_x="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_fopen_mode_x="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.x ]) AC_CACHE_CHECK([whether fopen supports the mode character 'e'], [gl_cv_func_fopen_mode_e], [echo foo > conftest.x AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <errno.h> #include <fcntl.h> ]GL_MDA_DEFINES[ int main () { FILE *fp = fopen ("conftest.x", "re"); if (fp != NULL) { if (fcntl (fileno (fp), F_GETFD) & FD_CLOEXEC) return 0; else /* 'e' ignored */ return 1; } else /* 'e' rejected */ return 2; }]])], [gl_cv_func_fopen_mode_e=yes], [gl_cv_func_fopen_mode_e=no], [case "$host_os" in # Guess yes on glibc and musl systems. linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) gl_cv_func_fopen_mode_e="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_fopen_mode_e="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_fopen_mode_e="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.x ]) case "$gl_cv_func_fopen_mode_x" in *no) REPLACE_FOPEN=1 ;; esac case "$gl_cv_func_fopen_mode_e" in *no) REPLACE_FOPEN=1 ;; esac ]) # Prerequisites of lib/fopen.c. AC_DEFUN([gl_PREREQ_FOPEN], [:]) �������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/langinfo_h.m4���������������������������������������������������������������0000664�0001750�0001750�00000011234�14670377450�017336� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# langinfo_h.m4 serial 12 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_LANGINFO_H], [ AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) dnl Persuade glibc-2.0.6 <langinfo.h> to define CODESET. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl <langinfo.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([langinfo.h]) dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS. HAVE_LANGINFO_CODESET=0 HAVE_LANGINFO_T_FMT_AMPM=0 HAVE_LANGINFO_ALTMON=0 HAVE_LANGINFO_ERA=0 HAVE_LANGINFO_YESEXPR=0 AC_CHECK_HEADERS_ONCE([langinfo.h]) if test $ac_cv_header_langinfo_h = yes; then HAVE_LANGINFO_H=1 dnl Determine what <langinfo.h> defines. dnl CODESET is missing on OpenBSD 3.8. dnl ERA etc. are missing on OpenBSD 6.7. dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. dnl ALTMON_* are missing on glibc 2.26 and many other systems. AC_CACHE_CHECK([whether langinfo.h defines CODESET], [gl_cv_header_langinfo_codeset], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <langinfo.h> int a = CODESET; ]])], [gl_cv_header_langinfo_codeset=yes], [gl_cv_header_langinfo_codeset=no]) ]) if test $gl_cv_header_langinfo_codeset = yes; then HAVE_LANGINFO_CODESET=1 fi AC_CACHE_CHECK([whether langinfo.h defines T_FMT_AMPM], [gl_cv_header_langinfo_t_fmt_ampm], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <langinfo.h> int a = T_FMT_AMPM; ]])], [gl_cv_header_langinfo_t_fmt_ampm=yes], [gl_cv_header_langinfo_t_fmt_ampm=no]) ]) if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then HAVE_LANGINFO_T_FMT_AMPM=1 fi AC_CACHE_CHECK([whether langinfo.h defines ALTMON_1], [gl_cv_header_langinfo_altmon], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <langinfo.h> int a = ALTMON_1; ]])], [gl_cv_header_langinfo_altmon=yes], [gl_cv_header_langinfo_altmon=no]) ]) if test $gl_cv_header_langinfo_altmon = yes; then HAVE_LANGINFO_ALTMON=1 fi AC_CACHE_CHECK([whether langinfo.h defines ERA], [gl_cv_header_langinfo_era], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <langinfo.h> int a = ERA; ]])], [gl_cv_header_langinfo_era=yes], [gl_cv_header_langinfo_era=no]) ]) if test $gl_cv_header_langinfo_era = yes; then HAVE_LANGINFO_ERA=1 fi AC_CACHE_CHECK([whether langinfo.h defines YESEXPR], [gl_cv_header_langinfo_yesexpr], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <langinfo.h> int a = YESEXPR; ]])], [gl_cv_header_langinfo_yesexpr=yes], [gl_cv_header_langinfo_yesexpr=no]) ]) if test $gl_cv_header_langinfo_yesexpr = yes; then HAVE_LANGINFO_YESEXPR=1 fi else HAVE_LANGINFO_H=0 fi AC_SUBST([HAVE_LANGINFO_H]) AC_SUBST([HAVE_LANGINFO_CODESET]) AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM]) AC_SUBST([HAVE_LANGINFO_ALTMON]) AC_SUBST([HAVE_LANGINFO_ERA]) AC_SUBST([HAVE_LANGINFO_YESEXPR]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <langinfo.h> ]], [nl_langinfo]) ]) # gl_LANGINFO_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_LANGINFO_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_LANGINFO_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NL_LANGINFO]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) ]) AC_DEFUN([gl_LANGINFO_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO]) REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO]) ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/getpagesize.m4��������������������������������������������������������������0000664�0001750�0001750�00000002762�14670377450�017547� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# getpagesize.m4 serial 10 dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_GETPAGESIZE], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) gl_CHECK_FUNC_GETPAGESIZE if test $gl_cv_func_getpagesize = no; then HAVE_GETPAGESIZE=0 AC_CHECK_HEADERS([OS.h]) if test $ac_cv_header_OS_h = yes; then HAVE_OS_H=1 fi AC_CHECK_HEADERS([sys/param.h]) if test $ac_cv_header_sys_param_h = yes; then HAVE_SYS_PARAM_H=1 fi fi case "$host_os" in mingw*) REPLACE_GETPAGESIZE=1 ;; esac dnl Also check whether it's declared. dnl mingw has getpagesize() in libgcc.a but doesn't declare it. AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0]) ]) dnl Tests whether the function getpagesize() exists. dnl Sets gl_cv_func_getpagesize. AC_DEFUN([gl_CHECK_FUNC_GETPAGESIZE], [ dnl We can't use AC_CHECK_FUNC here, because getpagesize() is defined as a dnl static inline function when compiling for Android 4.4 or older. AC_CACHE_CHECK([for getpagesize], [gl_cv_func_getpagesize], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <unistd.h>]], [[return getpagesize();]]) ], [gl_cv_func_getpagesize=yes], [gl_cv_func_getpagesize=no]) ]) ]) ��������������kbuild-3608/src/grep/m4/configmake.m4���������������������������������������������������������������0000664�0001750�0001750�00000001704�14670377450�017336� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# configmake.m4 serial 4 dnl Copyright (C) 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_PREREQ([2.60]) # gl_CONFIGMAKE_PREP # ------------------ # Guarantee all of the standard directory variables, even when used with # autoconf 2.64 (runstatedir wasn't supported before 2.70) or # automake 1.11 (runstatedir isn't supported even in 1.16.1). AC_DEFUN([gl_CONFIGMAKE_PREP], [ if test "x$lispdir" = x; then AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp']) fi dnl Added in autoconf 2.70. if test "x$runstatedir" = x; then AC_SUBST([runstatedir], ['${localstatedir}/run']) fi dnl Automake 1.11 provides pkglibexecdir merely without AC_SUBST. dnl This blind use of AC_SUBST is safe. AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}']) ]) ������������������������������������������������������������kbuild-3608/src/grep/m4/iswblank.m4�����������������������������������������������������������������0000664�0001750�0001750�00000001757�14670377450�017055� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# iswblank.m4 serial 5 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ISWBLANK], [ AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) AC_REQUIRE([gl_WCTYPE_H]) dnl Persuade glibc <wctype.h> to declare iswblank(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_FUNCS_ONCE([iswblank]) AC_CHECK_DECLS([iswblank], , , [[ #include <wchar.h> #include <wctype.h> ]]) if test $ac_cv_func_iswblank = no; then HAVE_ISWBLANK=0 if test $ac_cv_have_decl_iswblank = yes; then REPLACE_ISWBLANK=1 fi fi if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then dnl Redefine all of iswcntrl, ..., towupper in <wctype.h>. : else if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then dnl Redefine only iswblank. : fi fi ]) �����������������kbuild-3608/src/grep/m4/locale-zh.m4����������������������������������������������������������������0000664�0001750�0001750�00000012612�14670377450�017111� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# locale-zh.m4 serial 15 dnl Copyright (C) 2003, 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Determine the name of a chinese locale with GB18030 encoding. AC_DEFUN([gt_LOCALE_ZH_CN], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a transitional chinese locale], [gt_cv_locale_zh_CN], [ AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <stdlib.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } /* Check whether a typical GB18030 multibyte sequence is recognized as a single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; return 0; #endif } ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=Chinese_China.54936 else # None found. gt_cv_locale_zh_CN=none fi ;; solaris2.8) # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. gt_cv_locale_zh_CN=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the locale name without encoding suffix. if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN else # Test for the locale name with explicit encoding suffix. if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=zh_CN.GB18030 else # None found. gt_cv_locale_zh_CN=none fi fi ;; esac else # If there was a link error, due to mblen(), the system is so old that # it certainly doesn't have a chinese locale. gt_cv_locale_zh_CN=none fi rm -fr conftest* ]) LOCALE_ZH_CN=$gt_cv_locale_zh_CN AC_SUBST([LOCALE_ZH_CN]) ]) ����������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/inttypes_h.m4���������������������������������������������������������������0000664�0001750�0001750�00000001774�14670377450�017430� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# inttypes_h.m4 serial 10 dnl Copyright (C) 1997-2004, 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, # doesn't clash with <sys/types.h>, and declares uintmax_t. AC_DEFUN([gl_AC_HEADER_INTTYPES_H], [ AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ #include <sys/types.h> #include <inttypes.h> ]], [[uintmax_t i = (uintmax_t) -1; return !i;]])], [gl_cv_header_inttypes_h=yes], [gl_cv_header_inttypes_h=no])]) if test $gl_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1], [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. ]) fi ]) ����kbuild-3608/src/grep/m4/locale-tr.m4����������������������������������������������������������������0000664�0001750�0001750�00000012042�14670377450�017112� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# locale-tr.m4 serial 13 dnl Copyright (C) 2003, 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Determine the name of a turkish locale with UTF-8 encoding. AC_DEFUN([gt_LOCALE_TR_UTF8], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a turkish Unicode locale], [gt_cv_locale_tr_utf8], [ AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> #include <wctype.h> struct tm t; char buf[16]; int main () { /* On BeOS, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. But BeOS does not implement the Turkish upper-/lowercase mappings. Therefore, let this program return 1 on BeOS. */ /* Check whether the given locale name is recognized by the system. */ #if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; #else if (setlocale (LC_ALL, "") == NULL) return 1; #endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the tr_TR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. */ #if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } #endif #ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; #endif /* Check whether in the abbreviation of the eighth month, the second character (should be U+011F: LATIN SMALL LETTER G WITH BREVE) is two bytes long, with UTF-8 encoding. */ t.tm_year = 1992 - 1900; t.tm_mon = 8 - 1; t.tm_mday = 19; if (strftime (buf, sizeof (buf), "%b", &t) < 4 || buf[1] != (char) 0xc4 || buf[2] != (char) 0x9f) return 1; /* Check whether the upper-/lowercase mappings are as expected for Turkish. */ if (towupper ('i') != 0x0130 || towlower (0x0130) != 'i' || towupper(0x0131) != 'I' || towlower ('I') != 0x0131) return 1; return 0; } ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Turkish_Turkey.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=Turkish_Turkey.65001 else # None found. gt_cv_locale_tr_utf8=none fi ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the usual locale name. if (LC_ALL=tr_TR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=tr_TR else # Test for the locale name with explicit encoding suffix. if (LC_ALL=tr_TR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=tr_TR.UTF-8 else # Test for the Solaris 7 locale name. if (LC_ALL=tr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_tr_utf8=tr.UTF-8 else # None found. gt_cv_locale_tr_utf8=none fi fi fi ;; esac else gt_cv_locale_tr_utf8=none fi rm -fr conftest* ]) LOCALE_TR_UTF8=$gt_cv_locale_tr_utf8 AC_SUBST([LOCALE_TR_UTF8]) ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/wctob.m4��������������������������������������������������������������������0000664�0001750�0001750�00000005511�14670377450�016351� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# wctob.m4 serial 13 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_WCTOB], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([wctob]) if test $ac_cv_func_wctob = no; then HAVE_WCTOB=0 HAVE_DECL_WCTOB=0 else HAVE_WCTOB=1 dnl Solaris 9 has the wctob() function but it does not work. dnl Cygwin 1.7.2 has the wctob() function but it clobbers caller-owned dnl registers, see <https://cygwin.com/ml/cygwin/2010-05/msg00015.html>. AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether wctob works], [gl_cv_func_wctob_works], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on Solaris <= 9 and Cygwin. solaris2.[1-9] | solaris2.[1-9].* | cygwin*) gl_cv_func_wctob_works="guessing no" ;; # Guess no on native Windows. mingw*) gl_cv_func_wctob_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_wctob_works="guessing yes" ;; esac changequote([,])dnl case "$host_os" in cygwin*) AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <wchar.h> register long global __asm__ ("%ebx"); int main () { setlocale (LC_ALL, "en_US.UTF-8"); global = 0x12345678; if (wctob (0x00FC) != -1) return 1; if (global != 0x12345678) return 2; return 0; }]])], [:], [gl_cv_func_wctob_works=no], [:]) ;; esac if test "$gl_cv_func_wctob_works" != no && test $LOCALE_FR != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <stdlib.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { wchar_t wc; if (mbtowc (&wc, "\374", 1) == 1) if (wctob (wc) != (unsigned char) '\374') return 1; } return 0; }]])], [gl_cv_func_wctob_works=yes], [gl_cv_func_wctob_works=no], [:]) fi ]) case "$gl_cv_func_wctob_works" in *yes) ;; *) REPLACE_WCTOB=1 ;; esac if test $REPLACE_WCTOB = 0; then dnl IRIX 6.5 has the wctob() function but does not declare it. AC_CHECK_DECLS([wctob], [], [], [[ #include <wchar.h> ]]) if test $ac_cv_have_decl_wctob != yes; then HAVE_DECL_WCTOB=0 fi fi fi ]) # Prerequisites of lib/wctob.c. AC_DEFUN([gl_PREREQ_WCTOB], [ : ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/warnings.m4�����������������������������������������������������������������0000664�0001750�0001750�00000007456�14670377450�017075� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# warnings.m4 serial 16 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Simon Josefsson # gl_AS_VAR_APPEND(VAR, VALUE) # ---------------------------- # Provide the functionality of AS_VAR_APPEND if Autoconf does not have it. m4_ifdef([AS_VAR_APPEND], [m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])], [m4_define([gl_AS_VAR_APPEND], [AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])]) # gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED], # [PROGRAM = AC_LANG_PROGRAM()]) # ----------------------------------------------------------------- # Check if the compiler supports OPTION when compiling PROGRAM. # # The effects of this macro depend on the current language (_AC_LANG). AC_DEFUN([gl_COMPILER_OPTION_IF], [ AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl AS_LITERAL_IF([$1], [m4_pushdef([gl_Positive], m4_bpatsubst([$1], [^-Wno-], [-W]))], [gl_positive="$1" case $gl_positive in -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; esac m4_pushdef([gl_Positive], [$gl_positive])])dnl AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], [gl_Warn], [ gl_save_compiler_FLAGS="$gl_Flags" gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["]) AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([[]])])], [AS_VAR_SET([gl_Warn], [yes])], [AS_VAR_SET([gl_Warn], [no])]) gl_Flags="$gl_save_compiler_FLAGS" ]) AS_VAR_IF(gl_Warn, [yes], [$2], [$3]) m4_popdef([gl_Positive])dnl AS_VAR_POPDEF([gl_Flags])dnl AS_VAR_POPDEF([gl_Warn])dnl ]) # gl_UNKNOWN_WARNINGS_ARE_ERRORS # ------------------------------ # Clang doesn't complain about unknown warning options unless one also # specifies -Wunknown-warning-option -Werror. Detect this. # # The effects of this macro depend on the current language (_AC_LANG). AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS], [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) # Specialization for _AC_LANG = C. This macro can be AC_REQUIREd. AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)], [ AC_LANG_PUSH([C]) gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL AC_LANG_POP([C]) ]) # Specialization for _AC_LANG = C++. This macro can be AC_REQUIREd. AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)], [ AC_LANG_PUSH([C++]) gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL AC_LANG_POP([C++]) ]) # Specialization for _AC_LANG = Objective C. This macro can be AC_REQUIREd. AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(Objective C)], [ AC_LANG_PUSH([Objective C]) gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL AC_LANG_POP([Objective C]) ]) AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL], [gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option], [gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'], [gl_unknown_warnings_are_errors=])]) # gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS/WARN_CXXFLAGS], # [PROGRAM = AC_LANG_PROGRAM()]) # ----------------------------------------------------------- # Adds parameter to WARN_CFLAGS/WARN_CXXFLAGS if the compiler supports it # when compiling PROGRAM. For example, gl_WARN_ADD([-Wparentheses]). # # If VARIABLE is a variable name, AC_SUBST it. # # The effects of this macro depend on the current language (_AC_LANG). AC_DEFUN([gl_WARN_ADD], [AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS(]_AC_LANG[)]) gl_COMPILER_OPTION_IF([$1], [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_]_AC_LANG_PREFIX[FLAGS]], [[$2]]), [" $1"])], [], [$3]) m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])])], [AC_SUBST([WARN_]_AC_LANG_PREFIX[FLAGS])])dnl ]) # Local Variables: # mode: autoconf # End: ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/quotearg.m4�����������������������������������������������������������������0000664�0001750�0001750�00000000533�14670377450�017061� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# quotearg.m4 serial 10 dnl Copyright (C) 2002, 2004-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_QUOTEARG], [ AC_REQUIRE([AC_C_RESTRICT]) : ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/localcharset.m4�������������������������������������������������������������0000664�0001750�0001750�00000000633�14670377450�017677� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# localcharset.m4 serial 8 dnl Copyright (C) 2002, 2004, 2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_LOCALCHARSET], [ dnl Prerequisites of lib/localcharset.c. AC_REQUIRE([AM_LANGINFO_CODESET]) ]) �����������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fcntl_h.m4������������������������������������������������������������������0000664�0001750�0001750�00000005206�14670377440�016650� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 20 # Configure fcntl.h. dnl Copyright (C) 2006-2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Paul Eggert. AC_DEFUN_ONCE([gl_FCNTL_H], [ AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) AC_REQUIRE([gl_FCNTL_O_FLAGS]) gl_NEXT_HEADERS([fcntl.h]) dnl Ensure the type pid_t gets defined. AC_REQUIRE([AC_TYPE_PID_T]) dnl Ensure the type mode_t gets defined. AC_REQUIRE([AC_TYPE_MODE_T]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, if it is not common dnl enough to be declared everywhere. gl_WARN_ON_USE_PREPARE([[#include <fcntl.h> ]], [fcntl openat]) ]) # gl_FCNTL_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_FCNTL_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) ]) AC_DEFUN([gl_FCNTL_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT]) REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/inttypes.m4�����������������������������������������������������������������0000664�0001750�0001750�00000013772�14670377450�017122� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# inttypes.m4 serial 35 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Derek Price, Bruno Haible. dnl Test whether <inttypes.h> is supported or must be substituted. AC_DEFUN_ONCE([gl_INTTYPES_H], [ AC_REQUIRE([gl_INTTYPES_INCOMPLETE]) gl_INTTYPES_PRI_SCN ]) AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE], [ AC_REQUIRE([gl_STDINT_H]) AC_CHECK_HEADERS_ONCE([inttypes.h]) dnl Override <inttypes.h> always, so that the portability warnings work. AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([inttypes.h]) AC_REQUIRE([gl_MULTIARCH]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <inttypes.h> ]], [imaxabs imaxdiv strtoimax strtoumax]) AC_REQUIRE([AC_C_RESTRICT]) ]) # Ensure that the PRI* and SCN* macros are defined appropriately. AC_DEFUN([gl_INTTYPES_PRI_SCN], [ PRIPTR_PREFIX= if test -n "$STDINT_H"; then dnl Using the gnulib <stdint.h>. It defines intptr_t to 'long' or dnl 'long long', depending on _WIN64. AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ #ifdef _WIN64 LLP64 #endif ]]) ], [PRIPTR_PREFIX='"l"'], [PRIPTR_PREFIX='"ll"']) else dnl Using the system's <stdint.h>. for glpfx in '' l ll I64; do case $glpfx in '') gltype1='int';; l) gltype1='long int';; ll) gltype1='long long int';; I64) gltype1='__int64';; esac AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdint.h> extern intptr_t foo; extern $gltype1 foo;]])], [PRIPTR_PREFIX='"'$glpfx'"']) test -n "$PRIPTR_PREFIX" && break done fi AC_SUBST([PRIPTR_PREFIX]) gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( [INT32_MAX_LT_INTMAX_MAX], [defined INT32_MAX && defined INTMAX_MAX], [INT32_MAX < INTMAX_MAX], [sizeof (int) < sizeof (long long int)]) if test $APPLE_UNIVERSAL_BUILD = 0; then gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( [INT64_MAX_EQ_LONG_MAX], [defined INT64_MAX], [INT64_MAX == LONG_MAX], [sizeof (long long int) == sizeof (long int)]) else INT64_MAX_EQ_LONG_MAX=-1 fi gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( [UINT32_MAX_LT_UINTMAX_MAX], [defined UINT32_MAX && defined UINTMAX_MAX], [UINT32_MAX < UINTMAX_MAX], [sizeof (unsigned int) < sizeof (unsigned long long int)]) if test $APPLE_UNIVERSAL_BUILD = 0; then gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( [UINT64_MAX_EQ_ULONG_MAX], [defined UINT64_MAX], [UINT64_MAX == ULONG_MAX], [sizeof (unsigned long long int) == sizeof (unsigned long int)]) else UINT64_MAX_EQ_ULONG_MAX=-1 fi ]) # Define the symbol $1 to be 1 if the condition is true, 0 otherwise. # If $2 is true, the condition is $3; otherwise if long long int is supported # approximate the condition with $4; otherwise, assume the condition is false. # The condition should work on all C99 platforms; the approximations should be # good enough to work on all practical pre-C99 platforms. # $2 is evaluated by the C preprocessor, $3 and $4 as compile-time constants. AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION], [ AC_CACHE_CHECK([whether $3], [gl_cv_test_$1], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[/* Work also in C++ mode. */ #define __STDC_LIMIT_MACROS 1 /* Work if build is not clean. */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H #include <limits.h> #if HAVE_STDINT_H #include <stdint.h> #endif #if $2 #define CONDITION ($3) #else #define CONDITION ($4) #endif int test[CONDITION ? 1 : -1];]])], [gl_cv_test_$1=yes], [gl_cv_test_$1=no])]) if test $gl_cv_test_$1 = yes; then $1=1; else $1=0; fi AC_SUBST([$1]) ]) # gl_INTTYPES_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_INTTYPES_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_INTTYPES_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXABS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXDIV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOIMAX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUMAX]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) ]) AC_DEFUN([gl_INTTYPES_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_IMAXABS=1; AC_SUBST([HAVE_DECL_IMAXABS]) HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) HAVE_IMAXDIV_T=1; AC_SUBST([HAVE_IMAXDIV_T]) REPLACE_STRTOIMAX=0; AC_SUBST([REPLACE_STRTOIMAX]) REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX]) INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX]) INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX]) PRIPTR_PREFIX=__PRIPTR_PREFIX; AC_SUBST([PRIPTR_PREFIX]) UINT32_MAX_LT_UINTMAX_MAX=1; AC_SUBST([UINT32_MAX_LT_UINTMAX_MAX]) UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; AC_SUBST([UINT64_MAX_EQ_ULONG_MAX]) ]) ������kbuild-3608/src/grep/m4/string_h.m4�����������������������������������������������������������������0000664�0001750�0001750�00000015677�14670377450�017066� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Configure a GNU-like replacement for <string.h>. # Copyright (C) 2007-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 32 # Written by Paul Eggert. AC_DEFUN_ONCE([gl_STRING_H], [ dnl Ensure to expand the default settings once only, before all statements dnl that occur in other macros. AC_REQUIRE([gl_STRING_H_DEFAULTS]) gl_NEXT_HEADERS([string.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by C89. gl_WARN_ON_USE_PREPARE([[#include <string.h> ]], [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) AC_REQUIRE([AC_C_RESTRICT]) ]) # gl_STRING_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STRING_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_STRING_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPLICIT_BZERO]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSEP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRCHR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASECMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNCASECMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPCASECMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASESTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCSPN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPBRK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSIGNAL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRVERSCMP]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MEMCCPY], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_STRDUP], [1]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_STRING_H_DEFAULTS]) ]) AC_DEFUN([gl_STRING_H_DEFAULTS], [ HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL]) REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) ]) �����������������������������������������������������������������kbuild-3608/src/grep/m4/select.m4�������������������������������������������������������������������0000664�0001750�0001750�00000006663�14670377450�016523� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# select.m4 serial 13 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SELECT], [ AC_REQUIRE([gl_SYS_SELECT_H]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_SOCKETS]) if test "$ac_cv_header_winsock2_h" = yes; then REPLACE_SELECT=1 else dnl On Interix 3.5, select(0, NULL, NULL, NULL, timeout) fails with error dnl EFAULT. AC_CHECK_HEADERS_ONCE([sys/select.h]) AC_CACHE_CHECK([whether select supports a 0 argument], [gl_cv_func_select_supports0], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <sys/types.h> #include <sys/time.h> #if HAVE_SYS_SELECT_H #include <sys/select.h> #endif int main () { struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 5; return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0; }]])], [gl_cv_func_select_supports0=yes], [gl_cv_func_select_supports0=no], [ changequote(,)dnl case "$host_os" in # Guess no on Interix. interix*) gl_cv_func_select_supports0="guessing no";; # Guess yes otherwise. *) gl_cv_func_select_supports0="guessing yes";; esac changequote([,])dnl ]) ]) case "$gl_cv_func_select_supports0" in *yes) ;; *) REPLACE_SELECT=1 ;; esac dnl On FreeBSD 8.2, select() doesn't always reject bad fds. AC_CACHE_CHECK([whether select detects invalid fds], [gl_cv_func_select_detects_ebadf], [ AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <sys/time.h> #if HAVE_SYS_SELECT_H # include <sys/select.h> #endif #include <unistd.h> #include <errno.h> ]GL_MDA_DEFINES], [[ fd_set set; dup2(0, 16); FD_ZERO(&set); FD_SET(16, &set); close(16); struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 5; return select (17, &set, NULL, NULL, &timeout) != -1 || errno != EBADF; ]])], [gl_cv_func_select_detects_ebadf=yes], [gl_cv_func_select_detects_ebadf=no], [ case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_select_detects_ebadf="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_select_detects_ebadf="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_select_detects_ebadf="$gl_cross_guess_normal" ;; esac ]) ]) case $gl_cv_func_select_detects_ebadf in *yes) ;; *) REPLACE_SELECT=1 ;; esac fi dnl Determine the needed libraries. LIB_SELECT="$LIBSOCKET" if test $REPLACE_SELECT = 1; then case "$host_os" in mingw*) dnl On the MSVC platform, the function MsgWaitForMultipleObjects dnl (used in lib/select.c) requires linking with -luser32. On mingw, dnl it is implicit. AC_LINK_IFELSE( [AC_LANG_SOURCE([[ #define WIN32_LEAN_AND_MEAN #include <windows.h> int main () { MsgWaitForMultipleObjects (0, NULL, 0, 0, 0); return 0; }]])], [], [LIB_SELECT="$LIB_SELECT -luser32"]) ;; esac fi AC_SUBST([LIB_SELECT]) ]) �����������������������������������������������������������������������������kbuild-3608/src/grep/m4/gettext.m4������������������������������������������������������������������0000664�0001750�0001750�00000035615�14670377440�016726� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# gettext.m4 serial 66 (gettext-0.18.2) dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010. dnl Macro to add for using GNU gettext. dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The dnl default (if it is not specified or empty) is 'no-libtool'. dnl INTLSYMBOL should be 'external' for packages with no intl directory, dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. dnl If INTLSYMBOL is 'use-libtool', then a libtool library dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, dnl depending on --{enable,disable}-{shared,static} and on the presence of dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library dnl $(top_builddir)/intl/libintl.a will be created. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext dnl implementations (in libc or libintl) without the ngettext() function dnl will be ignored. If NEEDSYMBOL is specified and is dnl 'need-formatstring-macros', then GNU gettext implementations that don't dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored. dnl INTLDIR is used to find the intl libraries. If empty, dnl the value '$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled dnl and used. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 2) GNU gettext has been found in the system's C library. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 3) No internationalization, always use English msgid. dnl Catalog format: none dnl Catalog extension: none dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. dnl The use of .gmo is historical (it was needed to avoid overwriting the dnl GNU format catalogs when building on a platform with an X/Open gettext), dnl but we keep it in order not to force irrelevant filename changes on the dnl maintainers. dnl AC_DEFUN([AM_GNU_GETTEXT], [ dnl Argument checking. ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT ])])])])]) ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old], [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])]) ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT ])])])]) define([gt_included_intl], ifelse([$1], [external], ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), [yes])) define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) gt_NEEDS_INIT AM_GNU_GETTEXT_NEED([$2]) AC_REQUIRE([AM_PO_SUBDIRS])dnl ifelse(gt_included_intl, yes, [ AC_REQUIRE([AM_INTL_SUBDIR])dnl ]) dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Sometimes libintl requires libiconv, so first search for libiconv. dnl Ideally we would do this search only after the dnl if test "$USE_NLS" = "yes"; then dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT dnl the configure script would need to contain the same shell code dnl again, outside any 'if'. There are two solutions: dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not dnl documented, we avoid it. ifelse(gt_included_intl, yes, , [ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation. gt_INTL_MACOSX dnl Set USE_NLS. AC_REQUIRE([AM_NLS]) ifelse(gt_included_intl, yes, [ BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no ]) LIBINTL= LTLIBINTL= POSUB= dnl Add a version number to the cache macros. case " $gt_needs " in *" need-formatstring-macros "*) gt_api_version=3 ;; *" need-ngettext "*) gt_api_version=2 ;; *) gt_api_version=1 ;; esac gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no ifelse(gt_included_intl, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH([included-gettext], [ --with-included-gettext use the GNU gettext library included here], nls_cv_force_use_gnu_gettext=$withval, nls_cv_force_use_gnu_gettext=no) AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext]) nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then ]) dnl User does not insist on using GNU NLS library. Figure out what dnl to use. If GNU gettext is available we use this. Else we have dnl to fall back to GNU NLS library. if test $gt_api_version -ge 3; then gt_revision_test_code=' #ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ' else gt_revision_test_code= fi if test $gt_api_version -ge 2; then gt_expression_test_code=' + * ngettext ("", "", 0)' else gt_expression_test_code= fi AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include <libintl.h> $gt_revision_test_code extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings; ]], [[ bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings ]])], [eval "$gt_func_gnugettext_libc=yes"], [eval "$gt_func_gnugettext_libc=no"])]) if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then dnl Sometimes libintl requires libiconv, so first search for libiconv. ifelse(gt_included_intl, yes, , [ AM_ICONV_LINK ]) dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) dnl because that would add "-liconv" to LIBINTL and LTLIBINTL dnl even if libiconv doesn't exist. AC_LIB_LINKFLAGS_BODY([intl]) AC_CACHE_CHECK([for GNU gettext in libintl], [$gt_func_gnugettext_libintl], [gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" dnl Now see whether libintl exists and does not depend on libiconv. AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include <libintl.h> $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); ]], [[ bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") ]])], [eval "$gt_func_gnugettext_libintl=yes"], [eval "$gt_func_gnugettext_libintl=no"]) dnl Now see whether libintl exists and depends on libiconv. if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include <libintl.h> $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); ]], [[ bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") ]])], [LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" eval "$gt_func_gnugettext_libintl=yes" ]) fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) fi dnl If an already present or preinstalled GNU gettext() is found, dnl use it. But if this macro is used in GNU gettext, and GNU dnl gettext is already preinstalled in libintl, we update this dnl libintl. (Cf. the install rule in intl/Makefile.in.) if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else dnl Reset the values set by searching for libintl. LIBINTL= LTLIBINTL= INCINTL= fi ifelse(gt_included_intl, yes, [ if test "$gt_use_preinstalled_gnugettext" != "yes"; then dnl GNU gettext is not found in the C library. dnl Fall back on included GNU gettext library. nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi CATOBJEXT= if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions to use GNU gettext tools. CATOBJEXT=.gmo fi ]) if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Some extra flags are needed during linking. LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then AC_DEFINE([ENABLE_NLS], [1], [Define to 1 if translation of program messages to the user's native language is requested.]) else USE_NLS=no fi fi AC_MSG_CHECKING([whether to use NLS]) AC_MSG_RESULT([$USE_NLS]) if test "$USE_NLS" = "yes"; then AC_MSG_CHECKING([where the gettext function comes from]) if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi AC_MSG_RESULT([$gt_source]) fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then AC_MSG_CHECKING([how to link with libintl]) AC_MSG_RESULT([$LIBINTL]) AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) fi dnl For backward compatibility. Some packages may be using this. AC_DEFINE([HAVE_GETTEXT], [1], [Define if the GNU gettext() function is already present or preinstalled.]) AC_DEFINE([HAVE_DCGETTEXT], [1], [Define if the GNU dcgettext() function is already present or preinstalled.]) fi dnl We need to process the po/ directory. POSUB=po fi ifelse(gt_included_intl, yes, [ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL dnl to 'yes' because some of the testsuite requires it. if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then BUILD_INCLUDED_LIBINTL=yes fi dnl Make all variables we use known to autoconf. AC_SUBST([BUILD_INCLUDED_LIBINTL]) AC_SUBST([USE_INCLUDED_LIBINTL]) AC_SUBST([CATOBJEXT]) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= nls_cv_header_libgt= dnl For backward compatibility. Some Makefiles may be using this. DATADIRNAME=share AC_SUBST([DATADIRNAME]) dnl For backward compatibility. Some Makefiles may be using this. INSTOBJEXT=.mo AC_SUBST([INSTOBJEXT]) dnl For backward compatibility. Some Makefiles may be using this. GENCAT=gencat AC_SUBST([GENCAT]) dnl For backward compatibility. Some Makefiles may be using this. INTLOBJS= if test "$USE_INCLUDED_LIBINTL" = yes; then INTLOBJS="\$(GETTOBJS)" fi AC_SUBST([INTLOBJS]) dnl Enable libtool support if the surrounding package wishes it. INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX]) ]) dnl For backward compatibility. Some Makefiles may be using this. INTLLIBS="$LIBINTL" AC_SUBST([INTLLIBS]) dnl Make all documented variables known to autoconf. AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) AC_SUBST([POSUB]) ]) dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. m4_define([gt_NEEDS_INIT], [ m4_divert_text([DEFAULTS], [gt_needs=]) m4_define([gt_NEEDS_INIT], []) ]) dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) AC_DEFUN([AM_GNU_GETTEXT_NEED], [ m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) ]) dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) �������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fcntl.m4��������������������������������������������������������������������0000664�0001750�0001750�00000012172�14670377450�016342� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# fcntl.m4 serial 11 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # For now, this module ensures that fcntl() # - supports F_DUPFD correctly # - supports or emulates F_DUPFD_CLOEXEC # - supports F_GETFD # Still to be ported to mingw: # - F_SETFD # - F_GETFL, F_SETFL # - F_GETOWN, F_SETOWN # - F_GETLK, F_SETLK, F_SETLKW AC_DEFUN([gl_FUNC_FCNTL], [ dnl Persuade glibc to expose F_DUPFD_CLOEXEC. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([fcntl]) if test $ac_cv_func_fcntl = no; then gl_REPLACE_FCNTL else dnl cygwin 1.5.x F_DUPFD has wrong errno, and allows negative target dnl haiku alpha 2 F_DUPFD has wrong errno AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly], [gl_cv_func_fcntl_f_dupfd_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <errno.h> #include <fcntl.h> #include <limits.h> #include <sys/resource.h> #include <unistd.h> ]GL_MDA_DEFINES[ #ifndef RLIM_SAVED_CUR # define RLIM_SAVED_CUR RLIM_INFINITY #endif #ifndef RLIM_SAVED_MAX # define RLIM_SAVED_MAX RLIM_INFINITY #endif ]], [[int result = 0; int bad_fd = INT_MAX; struct rlimit rlim; if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX && rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur != RLIM_SAVED_MAX && rlim.rlim_cur != RLIM_SAVED_CUR) bad_fd = rlim.rlim_cur; if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; if (errno != EINVAL) result |= 2; if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; if (errno != EINVAL) result |= 8; /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */ { int fd; fd = open (".", O_RDONLY); if (fd == -1) result |= 16; else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1) result |= 32; close (fd); } return result;]])], [gl_cv_func_fcntl_f_dupfd_works=yes], [gl_cv_func_fcntl_f_dupfd_works=no], [case $host_os in aix* | cygwin* | haiku*) gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; esac])]) case $gl_cv_func_fcntl_f_dupfd_works in *yes) ;; *) gl_REPLACE_FCNTL AC_DEFINE([FCNTL_DUPFD_BUGGY], [1], [Define this to 1 if F_DUPFD behavior does not match POSIX]) ;; esac dnl Many systems lack F_DUPFD_CLOEXEC. dnl NetBSD 9.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD. AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC], [gl_cv_func_fcntl_f_dupfd_cloexec], [AC_RUN_IFELSE( [AC_LANG_SOURCE( [[#include <fcntl.h> #include <unistd.h> int main (int argc, char *argv[]) { if (argc == 1) /* parent process */ { if (fcntl (1, F_DUPFD_CLOEXEC, 10) < 0) return 1; return execl ("./conftest", "./conftest", "child", NULL); } else /* child process */ return (fcntl (10, F_GETFL) < 0 ? 0 : 42); } ]]) ], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef __linux__ /* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace it to support the semantics on older kernels that failed with EINVAL. */ choke me #endif ]])], [gl_cv_func_fcntl_f_dupfd_cloexec=yes], [gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check"]) ], [gl_cv_func_fcntl_f_dupfd_cloexec=no], [case "$host_os" in # Guess no on NetBSD. netbsd*) gl_cv_func_fcntl_f_dupfd_cloexec="guessing no" ;; *) gl_cv_func_fcntl_f_dupfd_cloexec="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_fcntl_f_dupfd_cloexec" in *yes) ;; *) gl_REPLACE_FCNTL dnl No witness macro needed for this bug. ;; esac fi dnl Replace fcntl() for supporting the gnulib-defined fchdir() function, dnl to keep fchdir's bookkeeping up-to-date. m4_ifdef([gl_FUNC_FCHDIR], [ gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then gl_REPLACE_FCNTL fi ]) ]) AC_DEFUN([gl_REPLACE_FCNTL], [ AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([fcntl]) if test $ac_cv_func_fcntl = no; then HAVE_FCNTL=0 else REPLACE_FCNTL=1 fi ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fpending.m4�����������������������������������������������������������������0000664�0001750�0001750�00000002174�14670377440�017026� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 23 # Copyright (C) 2000-2001, 2004-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. dnl From Jim Meyering dnl Using code from emacs, based on suggestions from Paul Eggert dnl and Ulrich Drepper. dnl Find out how to determine the number of pending output bytes on a stream. dnl glibc (2.1.93 and newer) and Solaris provide __fpending. On other systems, dnl we have to grub around in the (possibly opaque) FILE struct. AC_DEFUN([gl_FUNC_FPENDING], [ AC_CHECK_HEADERS_ONCE([stdio_ext.h]) fp_headers=' #include <stdio.h> #if HAVE_STDIO_EXT_H # include <stdio_ext.h> #endif ' AC_CACHE_CHECK([for __fpending], [gl_cv_func___fpending], [ AC_LINK_IFELSE( [AC_LANG_PROGRAM([[$fp_headers]], [[return ! __fpending (stdin);]])], [gl_cv_func___fpending=yes], [gl_cv_func___fpending=no]) ]) if test $gl_cv_func___fpending = yes; then AC_CHECK_DECLS([__fpending], [], [], [$fp_headers]) fi ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/strstr.m4�������������������������������������������������������������������0000664�0001750�0001750�00000011165�14670377450�016576� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# strstr.m4 serial 24 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Check that strstr works. AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], [ AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MEMCHR]) if test $REPLACE_MEMCHR = 1; then REPLACE_STRSTR=1 else dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637. AC_CACHE_CHECK([whether strstr works], [gl_cv_func_strstr_works_always], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include <string.h> /* for __GNU_LIBRARY__, strstr */ #ifdef __GNU_LIBRARY__ #include <features.h> #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28 Unlucky user #endif #endif #define P "_EF_BF_BD" #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P #define NEEDLE P P P P P ]], [[return !!strstr (HAYSTACK, NEEDLE); ]])], [gl_cv_func_strstr_works_always=yes], [gl_cv_func_strstr_works_always=no], [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not dnl affected, since it uses different source code for strstr than dnl glibc. dnl Assume that it works on all other platforms, even if it is not dnl linear. AC_EGREP_CPP([Lucky user], [ #include <string.h> /* for __GNU_LIBRARY__ */ #ifdef __GNU_LIBRARY__ #include <features.h> #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ || defined __UCLIBC__ Lucky user #endif #elif defined __CYGWIN__ #include <cygwin/version.h> #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) Lucky user #endif #else Lucky user #endif ], [gl_cv_func_strstr_works_always="guessing yes"], [gl_cv_func_strstr_works_always="$gl_cross_guess_normal"]) ]) ]) case "$gl_cv_func_strstr_works_always" in *yes) ;; *) REPLACE_STRSTR=1 ;; esac fi ]) # gl_FUNC_STRSTR_SIMPLE dnl Additionally, check that strstr is efficient. AC_DEFUN([gl_FUNC_STRSTR], [ AC_REQUIRE([gl_FUNC_STRSTR_SIMPLE]) if test $REPLACE_STRSTR = 0; then AC_CACHE_CHECK([whether strstr works in linear time], [gl_cv_func_strstr_linear], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #ifdef __MVS__ /* z/OS does not deliver signals while strstr() is running (thanks to restrictions on its LE runtime), which prevents us from limiting the running time of this test. */ # error "This test does not work properly on z/OS" #endif #include <signal.h> /* for signal */ #include <string.h> /* for strstr */ #include <stdlib.h> /* for malloc */ #include <unistd.h> /* for alarm */ static void quit (int sig) { _exit (sig + 128); } ]], [[ int result = 0; size_t m = 1000000; char *haystack = (char *) malloc (2 * m + 2); char *needle = (char *) malloc (m + 2); /* Failure to compile this test due to missing alarm is okay, since all such platforms (mingw) also have quadratic strstr. */ signal (SIGALRM, quit); alarm (5); /* Check for quadratic performance. */ if (haystack && needle) { memset (haystack, 'A', 2 * m); haystack[2 * m] = 'B'; haystack[2 * m + 1] = 0; memset (needle, 'A', m); needle[m] = 'B'; needle[m + 1] = 0; if (!strstr (haystack, needle)) result |= 1; } /* Free allocated memory, in case some sanitizer is watching. */ free (haystack); free (needle); return result; ]])], [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no], [dnl Only glibc > 2.12 on processors without SSE 4.2 instructions and dnl cygwin > 1.7.7 are known to have a bug-free strstr that works in dnl linear time. AC_EGREP_CPP([Lucky user], [ #include <features.h> #ifdef __GNU_LIBRARY__ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ && !(defined __i386__ || defined __x86_64__) \ && !defined __UCLIBC__ Lucky user #endif #endif #ifdef __CYGWIN__ #include <cygwin/version.h> #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) Lucky user #endif #endif ], [gl_cv_func_strstr_linear="guessing yes"], [gl_cv_func_strstr_linear="$gl_cross_guess_normal"]) ]) ]) case "$gl_cv_func_strstr_linear" in *yes) ;; *) REPLACE_STRSTR=1 ;; esac fi ]) # gl_FUNC_STRSTR �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/ctype_h.m4������������������������������������������������������������������0000664�0001750�0001750�00000003227�14670377440�016667� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# ctype_h.m4 serial 9 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_CTYPE_H], [ AC_REQUIRE([gl_CTYPE_H_DEFAULTS]) dnl <ctype.h> is always overridden, because of GNULIB_POSIXCHECK. gl_NEXT_HEADERS([ctype.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <ctype.h> ]], [isblank]) ]) # gl_CTYPE_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_CTYPE_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_CTYPE_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_CTYPE_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_CTYPE_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISBLANK]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_CTYPE_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_CTYPE_H_DEFAULTS]) ]) AC_DEFUN([gl_CTYPE_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_ISBLANK=1; AC_SUBST([HAVE_ISBLANK]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/exponentd.m4����������������������������������������������������������������0000664�0001750�0001750�00000007552�14670377440�017245� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# exponentd.m4 serial 3 dnl Copyright (C) 2007-2008, 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION], [ AC_CACHE_CHECK([where to find the exponent in a 'double'], [gl_cv_cc_double_expbit0], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <float.h> #include <stddef.h> #include <stdio.h> #include <string.h> #define NWORDS \ ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) typedef union { double value; unsigned int word[NWORDS]; } memory_double; static unsigned int ored_words[NWORDS]; static unsigned int anded_words[NWORDS]; static void add_to_ored_words (double x) { memory_double m; size_t i; /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ memset (&m, 0, sizeof (memory_double)); m.value = x; for (i = 0; i < NWORDS; i++) { ored_words[i] |= m.word[i]; anded_words[i] &= m.word[i]; } } int main () { size_t j; FILE *fp = fopen ("conftest.out", "w"); if (fp == NULL) return 1; for (j = 0; j < NWORDS; j++) anded_words[j] = ~ (unsigned int) 0; add_to_ored_words (0.25); add_to_ored_words (0.5); add_to_ored_words (1.0); add_to_ored_words (2.0); add_to_ored_words (4.0); /* Remove bits that are common (e.g. if representation of the first mantissa bit is explicit). */ for (j = 0; j < NWORDS; j++) ored_words[j] &= ~anded_words[j]; /* Now find the nonzero word. */ for (j = 0; j < NWORDS; j++) if (ored_words[j] != 0) break; if (j < NWORDS) { size_t i; for (i = j + 1; i < NWORDS; i++) if (ored_words[i] != 0) { fprintf (fp, "unknown"); return (fclose (fp) != 0); } for (i = 0; ; i++) if ((ored_words[j] >> i) & 1) { fprintf (fp, "word %d bit %d", (int) j, (int) i); return (fclose (fp) != 0); } } fprintf (fp, "unknown"); return (fclose (fp) != 0); } ]])], [gl_cv_cc_double_expbit0=`cat conftest.out`], [gl_cv_cc_double_expbit0="unknown"], [ dnl On ARM, there are two 'double' floating-point formats, used by dnl different sets of instructions: The older FPA instructions assume dnl that they are stored in big-endian word order, while the words dnl (like integer types) are stored in little-endian byte order. dnl The newer VFP instructions assume little-endian order dnl consistently. AC_EGREP_CPP([mixed_endianness], [ #if defined arm || defined __arm || defined __arm__ mixed_endianness #endif ], [gl_cv_cc_double_expbit0="unknown"], [ pushdef([AC_MSG_CHECKING],[:])dnl pushdef([AC_MSG_RESULT],[:])dnl pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl AC_C_BIGENDIAN( [gl_cv_cc_double_expbit0="word 0 bit 20"], [gl_cv_cc_double_expbit0="word 1 bit 20"], [gl_cv_cc_double_expbit0="unknown"]) popdef([AC_MSG_RESULT_UNQUOTED])dnl popdef([AC_MSG_RESULT])dnl popdef([AC_MSG_CHECKING])dnl ]) ]) rm -f conftest.out ]) case "$gl_cv_cc_double_expbit0" in word*bit*) word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word], [Define as the word index where to find the exponent of 'double'.]) AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit], [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.]) ;; esac ]) ������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/absolute-header.m4����������������������������������������������������������0000664�0001750�0001750�00000010151�14670377437�020300� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# absolute-header.m4 serial 17 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Derek Price. # gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...) # --------------------------------------- # Find the absolute name of a header file, testing first if the header exists. # If the header were sys/inttypes.h, this macro would define # ABSOLUTE_SYS_INTTYPES_H to the '""' quoted absolute name of sys/inttypes.h # in config.h # (e.g. '#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"'). # The three "///" are to pacify Sun C 5.8, which otherwise would say # "warning: #include of /usr/include/... may be non-portable". # Use '""', not '<>', so that the /// cannot be confused with a C99 comment. # Note: This macro assumes that the header file is not empty after # preprocessing, i.e. it does not only define preprocessor macros but also # provides some type/enum definitions or function/variable declarations. AC_DEFUN([gl_ABSOLUTE_HEADER], [AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_PREPROC_REQUIRE()dnl m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_absolute_header], [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>], [gl_absolute_header], [AS_VAR_PUSHDEF([ac_header_exists], [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl if test AS_VAR_GET([ac_header_exists]) = yes; then gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME])) fi AS_VAR_POPDEF([ac_header_exists])dnl ])dnl AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])), ["AS_VAR_GET([gl_absolute_header])"], [Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.]) AS_VAR_POPDEF([gl_absolute_header])dnl ])dnl ])# gl_ABSOLUTE_HEADER # gl_ABSOLUTE_HEADER_ONE(HEADER) # ------------------------------ # Like gl_ABSOLUTE_HEADER, except that: # - it assumes that the header exists, # - it uses the current CPPFLAGS, # - it does not cache the result, # - it is silent. AC_DEFUN([gl_ABSOLUTE_HEADER_ONE], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])]) dnl AIX "xlc -E" and "cc -E" omit #line directives for header files dnl that contain only a #include of other header files and no dnl non-comment tokens of their own. This leads to a failure to dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h> dnl and others. The workaround is to force preservation of comments dnl through option -C. This ensures all necessary #line directives dnl are present. GCC supports option -C as well. case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac changequote(,) case "$host_os" in mingw*) dnl For the sake of native Windows compilers (excluding gcc), dnl treat backslash as a directory separator, like /. dnl Actually, these compilers use a double-backslash as dnl directory separator, inside the dnl # line "filename" dnl directives. gl_dirsep_regex='[/\\]' ;; *) gl_dirsep_regex='\/' ;; esac dnl A sed expression that turns a string into a basic regular dnl expression, for use within "/.../". gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' gl_header_literal_regex=`echo '$1' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| p q }' changequote([,]) dnl eval is necessary to expand gl_absname_cpp. dnl Ultrix and Pyramid sh refuse to redirect output of eval, dnl so use subshell. AS_VAR_SET([gl_cv_absolute_]AS_TR_SH([[$1]]), [`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | sed -n "$gl_absolute_header_sed"`]) ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sockets.m4������������������������������������������������������������������0000664�0001750�0001750�00000000707�14670377450�016710� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sockets.m4 serial 7 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_SOCKETS], [ AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([gl_SOCKETLIB]) gl_PREREQ_SOCKETS ]) # Prerequisites of lib/sockets.c. AC_DEFUN([gl_PREREQ_SOCKETS], [ : ]) ���������������������������������������������������������kbuild-3608/src/grep/m4/wchar_h.m4������������������������������������������������������������������0000664�0001750�0001750�00000025542�14670377450�016654� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. # wchar_h.m4 serial 53 AC_DEFUN_ONCE([gl_WCHAR_H], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) dnl Prepare for creating substitute <wchar.h>. dnl Check for <wchar.h> (missing in Linux uClibc when built without wide dnl character support). dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([wchar.h]) if test $ac_cv_header_wchar_h = yes; then HAVE_WCHAR_H=1 else HAVE_WCHAR_H=0 fi AC_SUBST([HAVE_WCHAR_H]) AC_REQUIRE([gl_FEATURES_H]) AC_REQUIRE([gt_TYPE_WINT_T]) if test $gt_cv_c_wint_t = yes; then HAVE_WINT_T=1 else HAVE_WINT_T=0 fi AC_SUBST([HAVE_WINT_T]) AC_REQUIRE([gl_TYPE_WINT_T_PREREQ]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ #include <wchar.h> ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmempcpy wmemset wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth wcsftime ]) AC_REQUIRE([AC_C_RESTRICT]) AC_CHECK_DECLS([wcsdup], [], [], [[ #include <wchar.h> ]]) if test $ac_cv_have_decl_wcsdup = no; then HAVE_DECL_WCSDUP=0 fi ]) dnl Check whether <wchar.h> is usable at all. AC_DEFUN([gl_WCHAR_H_INLINE_OK], [ dnl Test whether <wchar.h> suffers due to the transition from '__inline' to dnl 'gnu_inline'. See <https://sourceware.org/bugzilla/show_bug.cgi?id=4022> dnl and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly], [gl_cv_header_wchar_h_correct_inline], [gl_cv_header_wchar_h_correct_inline=yes case "$host_os" in *-gnu* | gnu*) AC_LANG_CONFTEST([ AC_LANG_SOURCE([[ #define wcstod renamed_wcstod #include <wchar.h> extern int zero (void); int main () { return zero(); } ]])]) dnl Do not rename the object file from conftest.$ac_objext to dnl conftest1.$ac_objext, as this will cause the link to fail on dnl z/OS when using the XPLINK object format (due to duplicate dnl CSECT names). Instead, temporarily redefine $ac_compile so dnl that the object file has the latter name from the start. save_ac_compile="$ac_compile" ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` if echo '#include "conftest.c"' >conftest1.c \ && AC_TRY_EVAL([ac_compile]); then AC_LANG_CONFTEST([ AC_LANG_SOURCE([[ #define wcstod renamed_wcstod #include <wchar.h> int zero (void) { return 0; } ]])]) dnl See note above about renaming object files. ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` if echo '#include "conftest.c"' >conftest2.c \ && AC_TRY_EVAL([ac_compile]); then if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then : else gl_cv_header_wchar_h_correct_inline=no fi fi fi ac_compile="$save_ac_compile" rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext ;; esac ]) if test $gl_cv_header_wchar_h_correct_inline = no; then AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in C99 mode. You have four options: - Add the flag -fgnu89-inline to CC and reconfigure, or - Fix your include files, using parts of <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or - Use a gcc version older than 4.3, or - Don't use the flags -std=c99 or -std=gnu99. Configuration aborted.]) fi ]) # gl_WCHAR_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_WCHAR_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOWCS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCRTOMB]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRTOMBS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNRTOMBS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCWIDTH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCHR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMMOVE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMPCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMSET]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPNCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCASECMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCASECMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCOLL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSXFRM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSDUP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCHR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRCHR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCSPN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSPN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSPBRK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) ]) AC_DEFUN([gl_WCHAR_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC]) HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN]) HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS]) HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS]) HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) HAVE_WMEMCHR=1; AC_SUBST([HAVE_WMEMCHR]) HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP]) HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY]) HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE]) HAVE_WMEMPCPY=1; AC_SUBST([HAVE_WMEMPCPY]) HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET]) HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN]) HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN]) HAVE_WCSCPY=1; AC_SUBST([HAVE_WCSCPY]) HAVE_WCPCPY=1; AC_SUBST([HAVE_WCPCPY]) HAVE_WCSNCPY=1; AC_SUBST([HAVE_WCSNCPY]) HAVE_WCPNCPY=1; AC_SUBST([HAVE_WCPNCPY]) HAVE_WCSCAT=1; AC_SUBST([HAVE_WCSCAT]) HAVE_WCSNCAT=1; AC_SUBST([HAVE_WCSNCAT]) HAVE_WCSCMP=1; AC_SUBST([HAVE_WCSCMP]) HAVE_WCSNCMP=1; AC_SUBST([HAVE_WCSNCMP]) HAVE_WCSCASECMP=1; AC_SUBST([HAVE_WCSCASECMP]) HAVE_WCSNCASECMP=1; AC_SUBST([HAVE_WCSNCASECMP]) HAVE_WCSCOLL=1; AC_SUBST([HAVE_WCSCOLL]) HAVE_WCSXFRM=1; AC_SUBST([HAVE_WCSXFRM]) HAVE_WCSDUP=1; AC_SUBST([HAVE_WCSDUP]) HAVE_WCSCHR=1; AC_SUBST([HAVE_WCSCHR]) HAVE_WCSRCHR=1; AC_SUBST([HAVE_WCSRCHR]) HAVE_WCSCSPN=1; AC_SUBST([HAVE_WCSCSPN]) HAVE_WCSSPN=1; AC_SUBST([HAVE_WCSSPN]) HAVE_WCSPBRK=1; AC_SUBST([HAVE_WCSPBRK]) HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR]) HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) HAVE_WCSFTIME=1; AC_SUBST([HAVE_WCSFTIME]) HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) HAVE_DECL_WCSDUP=1; AC_SUBST([HAVE_DECL_WCSDUP]) HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB]) REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT]) REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC]) REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN]) REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS]) REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS]) REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB]) REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/malloc.m4�������������������������������������������������������������������0000664�0001750�0001750�00000013315�14670377450�016503� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# malloc.m4 serial 27 dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # This is adapted with modifications from upstream Autoconf here: # https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949 AC_DEFUN([_AC_FUNC_MALLOC_IF], [ AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles AC_CACHE_CHECK([whether malloc (0) returns nonnull], [ac_cv_func_malloc_0_nonnull], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <stdlib.h> ]], [[void *p = malloc (0); int result = !p; free (p); return result;]]) ], [ac_cv_func_malloc_0_nonnull=yes], [ac_cv_func_malloc_0_nonnull=no], [case "$host_os" in # Guess yes on platforms where we know the result. *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | gnu* | *-musl* | midnightbsd* \ | hpux* | solaris* | cygwin* | mingw* | msys* ) ac_cv_func_malloc_0_nonnull="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; esac ]) ]) AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) ])# _AC_FUNC_MALLOC_IF # gl_FUNC_MALLOC_GNU # ------------------ # Replace malloc if it is not compatible with GNU libc. AC_DEFUN([gl_FUNC_MALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) if test $REPLACE_MALLOC = 0; then _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC=1]) fi ]) # gl_FUNC_MALLOC_PTRDIFF # ---------------------- # Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, # and replace malloc otherwise. AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC=1 ]) # Test whether malloc, realloc, calloc refuse to create objects # larger than what can be expressed in ptrdiff_t. # Set gl_cv_func_malloc_gnu to yes or no accordingly. AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], [ AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], [gl_cv_malloc_ptrdiff], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <stdint.h> ]], [[/* 64-bit ptrdiff_t is so wide that no practical platform can exceed it. */ #define WIDE_PTRDIFF (PTRDIFF_MAX >> 31 >> 31 != 0) /* On rare machines where size_t fits in ptrdiff_t there is no problem. */ #define NARROW_SIZE (SIZE_MAX <= PTRDIFF_MAX) /* glibc 2.30 and later malloc refuses to exceed ptrdiff_t bounds even on 32-bit platforms. We don't know which non-glibc systems are safe. */ #define KNOWN_SAFE (2 < __GLIBC__ + (30 <= __GLIBC_MINOR__)) #if WIDE_PTRDIFF || NARROW_SIZE || KNOWN_SAFE return 0; #else #error "malloc might not be ptrdiff_t safe" syntax error #endif ]])], [gl_cv_malloc_ptrdiff=yes], [gl_cv_malloc_ptrdiff=no]) ]) ]) # gl_FUNC_MALLOC_POSIX # -------------------- # Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it # fails, and doesn't mess up with ptrdiff_t overflow), and replace # malloc if it is not. AC_DEFUN([gl_FUNC_MALLOC_POSIX], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) if test "$gl_cv_func_malloc_posix" = yes; then AC_DEFINE([HAVE_MALLOC_POSIX], [1], [Define if malloc, realloc, and calloc set errno on allocation failure.]) else REPLACE_MALLOC=1 fi ]) # Test whether malloc, realloc, calloc set errno to ENOMEM on failure. # Set gl_cv_func_malloc_posix to yes or no accordingly. AC_DEFUN([gl_CHECK_MALLOC_POSIX], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure], [gl_cv_func_malloc_posix], [ dnl It is too dangerous to try to allocate a large amount of memory: dnl some systems go to their knees when you do that. So assume that dnl all Unix implementations of the function set errno on failure, dnl except on those platforms where we have seen 'test-malloc-gnu', dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. case "$host_os" in mingw*) gl_cv_func_malloc_posix=no ;; irix* | solaris*) dnl On IRIX 6.5, the three functions return NULL with errno unset dnl when the argument is larger than PTRDIFF_MAX. dnl On Solaris 11.3, the three functions return NULL with errno set dnl to EAGAIN, not ENOMEM, when the argument is larger than dnl PTRDIFF_MAX. dnl Here is a test program: m4_divert_push([KILL]) #include <errno.h> #include <stdio.h> #include <stdlib.h> #define ptrdiff_t long #ifndef PTRDIFF_MAX # define PTRDIFF_MAX ((ptrdiff_t) ((1UL << (8 * sizeof (ptrdiff_t) - 1)) - 1)) #endif int main () { void *p; fprintf (stderr, "PTRDIFF_MAX = %lu\n", (unsigned long) PTRDIFF_MAX); errno = 0; p = malloc ((unsigned long) PTRDIFF_MAX + 1); fprintf (stderr, "p=%p errno=%d\n", p, errno); errno = 0; p = calloc (PTRDIFF_MAX / 2 + 1, 2); fprintf (stderr, "p=%p errno=%d\n", p, errno); errno = 0; p = realloc (NULL, (unsigned long) PTRDIFF_MAX + 1); fprintf (stderr, "p=%p errno=%d\n", p, errno); return 0; } m4_divert_pop([KILL]) gl_cv_func_malloc_posix=no ;; *) gl_cv_func_malloc_posix=yes ;; esac ]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/wctype_h.m4�����������������������������������������������������������������0000664�0001750�0001750�00000014444�14670377450�017062� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# wctype_h.m4 serial 30 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Paul Eggert. AC_DEFUN_ONCE([gl_WCTYPE_H], [ AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([iswcntrl]) if test $ac_cv_func_iswcntrl = yes; then HAVE_ISWCNTRL=1 else HAVE_ISWCNTRL=0 fi AC_SUBST([HAVE_ISWCNTRL]) AC_REQUIRE([gt_TYPE_WINT_T]) if test $gt_cv_c_wint_t = yes; then HAVE_WINT_T=1 else HAVE_WINT_T=0 fi AC_SUBST([HAVE_WINT_T]) AC_REQUIRE([gl_TYPE_WINT_T_PREREQ]) gl_CHECK_NEXT_HEADERS([wctype.h]) if test $ac_cv_header_wctype_h = yes; then if test $ac_cv_func_iswcntrl = yes; then dnl Linux libc5 has an iswprint function that returns 0 for all arguments. dnl The other functions are likely broken in the same way. AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <wchar.h> #include <wctype.h> int main () { return iswprint ('x') == 0; } ]])], [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], [dnl Guess no on Linux libc5, yes otherwise. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> #if __GNU_LIBRARY__ == 1 Linux libc5 i18n is broken. #endif]], [[]])], [gl_cv_func_iswcntrl_works="guessing yes"], [gl_cv_func_iswcntrl_works="guessing no"]) ]) ]) fi HAVE_WCTYPE_H=1 else HAVE_WCTYPE_H=0 fi AC_SUBST([HAVE_WCTYPE_H]) if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then REPLACE_ISWCNTRL=1 else case "$gl_cv_func_iswcntrl_works" in *yes) REPLACE_ISWCNTRL=0 ;; *) REPLACE_ISWCNTRL=1 ;; esac fi AC_SUBST([REPLACE_ISWCNTRL]) if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then dnl Redefine all of iswcntrl, ..., iswxdigit in <wctype.h>. : fi if test $REPLACE_ISWCNTRL = 1; then REPLACE_TOWLOWER=1 else AC_CHECK_FUNCS([towlower]) if test $ac_cv_func_towlower = yes; then REPLACE_TOWLOWER=0 else AC_CHECK_DECLS([towlower],,, [[#include <wchar.h> #if HAVE_WCTYPE_H # include <wctype.h> #endif ]]) if test $ac_cv_have_decl_towlower = yes; then dnl On Minix 3.1.8, the system's <wctype.h> declares towlower() and dnl towupper() although it does not have the functions. Avoid a dnl collision with gnulib's replacement. REPLACE_TOWLOWER=1 else REPLACE_TOWLOWER=0 fi fi fi AC_SUBST([REPLACE_TOWLOWER]) if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then dnl Redefine towlower, towupper in <wctype.h>. : fi dnl We assume that the wctype() and iswctype() functions exist if and only dnl if the type wctype_t is defined in <wchar.h> or in <wctype.h> if that dnl exists. dnl HP-UX 11.00 declares all these in <wchar.h> and lacks <wctype.h>. AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <wchar.h> #if HAVE_WCTYPE_H # include <wctype.h> #endif wctype_t a; ]], [[]])], [gl_cv_type_wctype_t=yes], [gl_cv_type_wctype_t=no]) ]) if test $gl_cv_type_wctype_t = no; then HAVE_WCTYPE_T=0 fi dnl We assume that the wctrans() and towctrans() functions exist if and only dnl if the type wctrans_t is defined in <wctype.h>. AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <wchar.h> #include <wctype.h> wctrans_t a; ]], [[]])], [gl_cv_type_wctrans_t=yes], [gl_cv_type_wctrans_t=no]) ]) if test $gl_cv_type_wctrans_t = no; then HAVE_WCTRANS_T=0 fi dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ #if !(defined __GLIBC__ && !defined __UCLIBC__) # include <wchar.h> #endif #include <wctype.h> ]], [wctype iswctype wctrans towctrans ]) ]) # gl_WCTYPE_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_WCTYPE_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_WCTYPE_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTRANS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOWCTRANS]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) ]) AC_DEFUN([gl_WCTYPE_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T]) HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) REPLACE_ISWDIGIT=0; AC_SUBST([REPLACE_ISWDIGIT]) REPLACE_ISWXDIGIT=0; AC_SUBST([REPLACE_ISWXDIGIT]) ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/openat.m4�������������������������������������������������������������������0000664�0001750�0001750�00000002023�14670377450�016514� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 46 # See if we need to use our replacement for Solaris' openat et al functions. dnl Copyright (C) 2004-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Written by Jim Meyering. AC_DEFUN([gl_FUNC_OPENAT], [ AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_FUNCS_ONCE([openat]) AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink+$gl_cv_macro_O_CLOEXEC in yes+*yes+yes) ;; yes+*) # Solaris 10 lacks O_CLOEXEC. # Solaris 9 has *at functions, but uniformly mishandles trailing # slash in all of them. REPLACE_OPENAT=1 ;; *) HAVE_OPENAT=0 ;; esac ]) # Prerequisites of lib/openat.c. AC_DEFUN([gl_PREREQ_OPENAT], [ AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) : ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/iswxdigit.m4����������������������������������������������������������������0000664�0001750�0001750�00000005663�14670377450�017256� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# iswxdigit.m4 serial 3 dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ISWXDIGIT], [ AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) AC_REQUIRE([gl_WCTYPE_H]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([gt_LOCALE_ZH_CN]) if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then dnl <wctype.h> redefines iswxdigit already. REPLACE_ISWXDIGIT="$REPLACE_ISWCNTRL" else AC_CACHE_CHECK([whether iswxdigit is ISO C compliant], [gl_cv_func_iswxdigit_works], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on FreeBSD, NetBSD, Solaris, native Windows. freebsd* | dragonfly* | netbsd* | solaris* | mingw*) gl_cv_func_iswxdigit_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_iswxdigit_works="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> #include <wctype.h> /* Returns the value of iswxdigit for the multibyte character s[0..n-1]. */ static int for_character (const char *s, size_t n) { mbstate_t state; wchar_t wc; size_t ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, s, n, &state); if (ret != n) abort (); return iswxdigit (wc); } int main (int argc, char *argv[]) { int is; int result = 0; if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { /* This fails on NetBSD 8.0. */ /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ is = for_character ("\243\301", 2); if (!(is == 0)) result |= 1; } if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { /* This fails on FreeBSD 13.0. */ /* U+0663 ARABIC-INDIC DIGIT THREE */ is = for_character ("\331\243", 2); if (!(is == 0)) result |= 2; /* This fails on MSVC 14. */ /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ is = for_character ("\357\274\241", 3); if (!(is == 0)) result |= 4; } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { /* This fails on Solaris 10, Solaris 11.4. */ /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\243\261", 2); if (!(is == 0)) result |= 8; } return result; }]])], [gl_cv_func_iswxdigit_works=yes], [gl_cv_func_iswxdigit_works=no], [:]) fi ]) case "$gl_cv_func_iswxdigit_works" in *yes) ;; *) REPLACE_ISWXDIGIT=1 ;; esac fi ]) �����������������������������������������������������������������������������kbuild-3608/src/grep/m4/socketlib.m4����������������������������������������������������������������0000664�0001750�0001750�00000006076�14670377450�017221� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# socketlib.m4 serial 3 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl gl_SOCKETLIB dnl Determines the library to use for socket functions. dnl Sets and AC_SUBSTs LIBSOCKET. AC_DEFUN([gl_SOCKETLIB], [ gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H LIBSOCKET= if test $HAVE_WINSOCK2_H = 1; then dnl Native Windows API (not Cygwin). dnl If the function WSAStartup exists (declared in <winsock2.h> and dnl defined through -lws2_32), we need to call it. AC_CACHE_CHECK([for WSAStartup], [gl_cv_func_wsastartup], [ gl_save_LIBS="$LIBS" LIBS="$LIBS -lws2_32" AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ #ifdef HAVE_WINSOCK2_H # include <winsock2.h> #endif]], [[ WORD wVersionRequested = MAKEWORD(1, 1); WSADATA wsaData; int err = WSAStartup(wVersionRequested, &wsaData); WSACleanup (); ]]) ], [gl_cv_func_wsastartup=yes], [gl_cv_func_wsastartup=no]) LIBS="$gl_save_LIBS" ]) if test "$gl_cv_func_wsastartup" = "yes"; then AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) LIBSOCKET='-lws2_32' fi else dnl Unix API. dnl Solaris has most socket functions in libsocket. dnl Haiku has most socket functions in libnetwork. dnl BeOS has most socket functions in libnet. dnl On HP-UX, do NOT link with libxnet, because in 64-bit mode this would dnl break code (e.g. in libraries) that invokes accept(), getpeername(), dnl getsockname(), getsockopt(), or recvfrom() with a 32-bit addrlen. See dnl "man xopen_networking" for details. AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [ gl_cv_lib_socket= AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern #ifdef __cplusplus "C" #endif char setsockopt();]], [[setsockopt();]])], [], [gl_save_LIBS="$LIBS" LIBS="$gl_save_LIBS -lsocket" AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern #ifdef __cplusplus "C" #endif char setsockopt();]], [[setsockopt();]])], [gl_cv_lib_socket="-lsocket"]) if test -z "$gl_cv_lib_socket"; then LIBS="$gl_save_LIBS -lnetwork" AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern #ifdef __cplusplus "C" #endif char setsockopt();]], [[setsockopt();]])], [gl_cv_lib_socket="-lnetwork"]) if test -z "$gl_cv_lib_socket"; then LIBS="$gl_save_LIBS -lnet" AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern #ifdef __cplusplus "C" #endif char setsockopt();]], [[setsockopt();]])], [gl_cv_lib_socket="-lnet"]) fi fi LIBS="$gl_save_LIBS" ]) if test -z "$gl_cv_lib_socket"; then gl_cv_lib_socket="none needed" fi ]) if test "$gl_cv_lib_socket" != "none needed"; then LIBSOCKET="$gl_cv_lib_socket" fi fi AC_SUBST([LIBSOCKET]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/memrchr.m4������������������������������������������������������������������0000664�0001750�0001750�00000001244�14670377450�016667� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# memrchr.m4 serial 11 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MEMRCHR], [ dnl Persuade glibc <string.h> to declare memrchr(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_DECLS_ONCE([memrchr]) if test $ac_cv_have_decl_memrchr = no; then HAVE_DECL_MEMRCHR=0 fi AC_CHECK_FUNCS([memrchr]) ]) # Prerequisites of lib/memrchr.c. AC_DEFUN([gl_PREREQ_MEMRCHR], [:]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/save-cwd.m4�����������������������������������������������������������������0000664�0001750�0001750�00000000570�14670377450�016744� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 10 dnl Copyright (C) 2002-2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Prerequisites for lib/save-cwd.c. AC_DEFUN([gl_SAVE_CWD], [ AC_CHECK_FUNCS_ONCE([fchdir]) ]) ����������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/strtoull.m4�����������������������������������������������������������������0000664�0001750�0001750�00000003022�14670377450�017116� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# strtoull.m4 serial 9 dnl Copyright (C) 2002, 2004, 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOULL], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS([strtoull]) if test $ac_cv_func_strtoull = yes; then AC_CACHE_CHECK([whether strtoull works], [gl_cv_func_strtoull_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <stdlib.h>]], [[int result = 0; char *term; /* This test fails on Minix and native Windows. */ { const char input[] = "0x"; (void) strtoull (input, &term, 16); if (term != input + 1) result |= 1; } return result; ]]) ], [gl_cv_func_strtoull_works=yes], [gl_cv_func_strtoull_works=no], [case "$host_os" in # Guess no on native Windows. mingw*) gl_cv_func_strtoull_works="guessing no" ;; *) gl_cv_func_strtoull_works="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_strtoull_works" in *yes) ;; *) REPLACE_STRTOULL=1 ;; esac else HAVE_STRTOULL=0 fi ]) # Prerequisites of lib/strtoull.c. AC_DEFUN([gl_PREREQ_STRTOULL], [ : ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/__inline.m4�����������������������������������������������������������������0000664�0001750�0001750�00000001423�14670377437�017012� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Test for __inline keyword dnl Copyright 2017-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl___INLINE], [ AC_CACHE_CHECK([whether the compiler supports the __inline keyword], [gl_cv_c___inline], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[typedef int foo_t; static __inline foo_t foo (void) { return 0; }]], [[return foo ();]])], [gl_cv_c___inline=yes], [gl_cv_c___inline=no])]) if test $gl_cv_c___inline = yes; then AC_DEFINE([HAVE___INLINE], [1], [Define to 1 if the compiler supports the keyword '__inline'.]) fi ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/socklen.m4������������������������������������������������������������������0000664�0001750�0001750�00000006157�14670377450�016700� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# socklen.m4 serial 11 dnl Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Albert Chin, Windows fixes from Simon Josefsson. dnl Check for socklen_t: historically on BSD it is an int, and in dnl POSIX 1g it is a type of its own, but some platforms use different dnl types for the argument to getsockopt, getpeername, etc.: dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS. dnl So we have to test to find something that will work. AC_DEFUN([gl_TYPE_SOCKLEN_T], [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl AC_CHECK_TYPE([socklen_t], , [AC_CACHE_CHECK([for socklen_t equivalent], [gl_cv_socklen_t_equiv], [# Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername gl_cv_socklen_t_equiv= for arg2 in "struct sockaddr" void; do for t in int size_t "unsigned int" "long int" "unsigned long int"; do AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include <sys/types.h> #include <sys/socket.h> int getpeername (int, $arg2 *, $t *);]], [[$t len; getpeername (0, 0, &len);]])], [gl_cv_socklen_t_equiv="$t"]) test "$gl_cv_socklen_t_equiv" != "" && break done test "$gl_cv_socklen_t_equiv" != "" && break done if test "$gl_cv_socklen_t_equiv" = ""; then AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) fi ]) AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], [type to use in place of socklen_t if not defined])], [gl_SOCKET_HEADERS])]) dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find dnl it there too. But on Cygwin, wc2tcpip.h must not be included. Users dnl of this module should use the same include pattern as gl_SOCKET_HEADERS. dnl When you change this macro, keep also in sync: dnl - gl_CHECK_SOCKET_HEADERS, dnl - the Include section of modules/socklen. AC_DEFUN([gl_SOCKET_HEADERS], [ /* <sys/types.h> is not needed according to POSIX, but the <sys/socket.h> in i386-unknown-freebsd4.10 and powerpc-apple-darwin5.5 required it. */ #include <sys/types.h> #if HAVE_SYS_SOCKET_H # include <sys/socket.h> #elif HAVE_WS2TCPIP_H # include <ws2tcpip.h> #endif ]) dnl Tests for the existence of the header for socket facilities. dnl Defines the C macros HAVE_SYS_SOCKET_H, HAVE_WS2TCPIP_H. dnl This macro must match gl_SOCKET_HEADERS. AC_DEFUN([gl_CHECK_SOCKET_HEADERS], [AC_CHECK_HEADERS_ONCE([sys/socket.h]) if test $ac_cv_header_sys_socket_h = no; then dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make dnl the check for those headers unconditional; yet cygwin reports dnl that the headers are present but cannot be compiled (since on dnl cygwin, all socket information should come from sys/socket.h). AC_CHECK_HEADERS([ws2tcpip.h]) fi ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/nanosleep.m4����������������������������������������������������������������0000664�0001750�0001750�00000012025�14670377450�017215� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 40 dnl From Jim Meyering. dnl Check for the nanosleep function. dnl If not found, use the supplied replacement. dnl # Copyright (C) 1999-2001, 2003-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_NANOSLEEP], [ AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade glibc and Solaris <time.h> to declare nanosleep. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_HEADERS_ONCE([sys/time.h]) AC_REQUIRE([gl_FUNC_SELECT]) AC_CHECK_DECLS_ONCE([alarm]) nanosleep_save_libs=$LIBS # Solaris 2.5.1 needs -lposix4 to get the nanosleep function. # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. LIB_NANOSLEEP= AC_SUBST([LIB_NANOSLEEP]) AC_SEARCH_LIBS([nanosleep], [rt posix4], [test "$ac_cv_search_nanosleep" = "none required" || LIB_NANOSLEEP=$ac_cv_search_nanosleep]) if test "x$ac_cv_search_nanosleep" != xno; then dnl The system has a nanosleep function. AC_REQUIRE([gl_MULTIARCH]) if test $APPLE_UNIVERSAL_BUILD = 1; then # A universal build on Apple Mac OS X platforms. # The test result would be 'no (mishandles large arguments)' in 64-bit # mode but 'yes' in 32-bit mode. But we need a configuration result that # is valid in both modes. gl_cv_func_nanosleep='no (mishandles large arguments)' fi AC_CACHE_CHECK([for working nanosleep], [gl_cv_func_nanosleep], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <errno.h> #include <limits.h> #include <signal.h> #if HAVE_SYS_TIME_H #include <sys/time.h> #endif #include <time.h> #include <unistd.h> #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) #define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) -1 \ : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) #if HAVE_DECL_ALARM static void check_for_SIGALRM (int sig) { if (sig != SIGALRM) _exit (1); } #endif int main () { static struct timespec ts_sleep; static struct timespec ts_remaining; /* Test for major problems first. */ if (! nanosleep) return 2; ts_sleep.tv_sec = 0; ts_sleep.tv_nsec = 1; #if HAVE_DECL_ALARM { static struct sigaction act; act.sa_handler = check_for_SIGALRM; sigemptyset (&act.sa_mask); sigaction (SIGALRM, &act, NULL); alarm (1); if (nanosleep (&ts_sleep, NULL) != 0) return 3; /* Test for a minor problem: the handling of large arguments. */ ts_sleep.tv_sec = TYPE_MAXIMUM (time_t); ts_sleep.tv_nsec = 999999999; alarm (1); if (nanosleep (&ts_sleep, &ts_remaining) != -1) return 4; if (errno != EINTR) return 5; if (ts_remaining.tv_sec <= TYPE_MAXIMUM (time_t) - 10) return 6; } #else /* A simpler test for native Windows. */ if (nanosleep (&ts_sleep, &ts_remaining) < 0) return 3; #endif return 0; }]])], [gl_cv_func_nanosleep=yes], [case $? in dnl ( 4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)';; dnl ( *) gl_cv_func_nanosleep=no;; esac], [case "$host_os" in dnl (( linux*) # Guess it halfway works when the kernel is Linux. gl_cv_func_nanosleep='guessing no (mishandles large arguments)' ;; mingw*) # Guess no on native Windows. gl_cv_func_nanosleep='guessing no' ;; *) # If we don't know, obey --enable-cross-guesses. gl_cv_func_nanosleep="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_nanosleep" in *yes) REPLACE_NANOSLEEP=0 ;; *) REPLACE_NANOSLEEP=1 case "$gl_cv_func_nanosleep" in *"mishandles large arguments"*) AC_DEFINE([HAVE_BUG_BIG_NANOSLEEP], [1], [Define to 1 if nanosleep mishandles large arguments.]) ;; *) # The replacement uses select(). Add $LIBSOCKET to $LIB_NANOSLEEP. for ac_lib in $LIBSOCKET; do case " $LIB_NANOSLEEP " in *" $ac_lib "*) ;; *) LIB_NANOSLEEP="$LIB_NANOSLEEP $ac_lib";; esac done ;; esac ;; esac else HAVE_NANOSLEEP=0 fi LIBS=$nanosleep_save_libs ]) # Prerequisites of lib/nanosleep.c. AC_DEFUN([gl_PREREQ_NANOSLEEP], [ AC_CHECK_HEADERS_ONCE([sys/select.h]) gl_PREREQ_SIG_HANDLER_H ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/iswctype.m4�����������������������������������������������������������������0000664�0001750�0001750�00000000570�14670377450�017102� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# iswctype.m4 serial 2 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ISWCTYPE], [ AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) AC_REQUIRE([gl_WCTYPE_H]) ]) ����������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/iconv.m4��������������������������������������������������������������������0000664�0001750�0001750�00000022506�14670377450�016354� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# iconv.m4 serial 24 dnl Copyright (C) 2000-2002, 2007-2014, 2016-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_PREREQ([2.64]) dnl Note: AM_ICONV is documented in the GNU gettext manual dnl <https://www.gnu.org/software/gettext/manual/html_node/AM_005fICONV.html>. dnl Don't make changes that are incompatible with that documentation! AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_LIB_LINKFLAGS_BODY([iconv]) ]) AC_DEFUN([AM_ICONV_LINK], [ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) dnl Add $INCICONV to CPPFLAGS before performing the following checks, dnl because if the user has installed libiconv and not disabled its use dnl via --without-libiconv-prefix, he wants to use it. The first dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. am_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include <stdlib.h> #include <iconv.h> ]], [[iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);]])], [am_cv_func_iconv=yes]) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include <stdlib.h> #include <iconv.h> ]], [[iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);]])], [am_cv_lib_iconv=yes] [am_cv_func_iconv=yes]) LIBS="$am_save_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, dnl Solaris 10. am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi am_cv_func_iconv_works=no for ac_iconv_const in '' 'const'; do AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[ #include <iconv.h> #include <string.h> #ifndef ICONV_CONST # define ICONV_CONST $ac_iconv_const #endif ]], [[int result = 0; /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from successful returns. This is even documented in <https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv.html> */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\263"; char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 2; iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ { iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 4; iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 8; iconv_close (cd_88591_to_utf8); } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ { /* Try standardized names. */ iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); /* Try IRIX, OSF/1 names. */ iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); /* Try AIX names. */ iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); /* Try HP-UX names. */ iconv_t cd4 = iconv_open ("utf8", "eucJP"); if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) result |= 16; if (cd1 != (iconv_t)(-1)) iconv_close (cd1); if (cd2 != (iconv_t)(-1)) iconv_close (cd2); if (cd3 != (iconv_t)(-1)) iconv_close (cd3); if (cd4 != (iconv_t)(-1)) iconv_close (cd4); } return result; ]])], [am_cv_func_iconv_works=yes], , [case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac]) test "$am_cv_func_iconv_works" = no || break done LIBS="$am_save_LIBS" ]) case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then AC_DEFINE([HAVE_ICONV], [1], [Define if you have the iconv() function and it works.]) fi if test "$am_cv_lib_iconv" = yes; then AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV dnl either. CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi AC_SUBST([LIBICONV]) AC_SUBST([LTLIBICONV]) ]) dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". dnl This is tricky because of the way 'aclocal' is implemented: dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. dnl Otherwise aclocal's initial scan pass would miss the macro definition. dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. dnl Otherwise aclocal would emit many "Use of uninitialized value $1" dnl warnings. AC_DEFUN_ONCE([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature], [gl_cv_iconv_nonconst], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ #include <stdlib.h> #include <iconv.h> extern #ifdef __cplusplus "C" #endif size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); ]], [[]])], [gl_cv_iconv_nonconst=yes], [gl_cv_iconv_nonconst=no]) ]) else dnl When compiling GNU libiconv on a system that does not have iconv yet, dnl pick the POSIX compliant declaration without 'const'. gl_cv_iconv_nonconst=yes fi if test $gl_cv_iconv_nonconst = yes; then iconv_arg1="" else iconv_arg1="const" fi AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1], [Define as const if the declaration of iconv() needs const.]) dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>. m4_ifdef([gl_ICONV_H_DEFAULTS], [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) if test $gl_cv_iconv_nonconst != yes; then ICONV_CONST="const" fi ]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sys_ioctl_h.m4��������������������������������������������������������������0000664�0001750�0001750�00000005775�14670377450�017566� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sys_ioctl_h.m4 serial 15 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Bruno Haible. AC_DEFUN_ONCE([gl_SYS_IOCTL_H], [ dnl Ensure to expand the default settings once only, before all statements dnl that occur in other macros. AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) AC_CHECK_HEADERS_ONCE([sys/ioctl.h]) if test $ac_cv_header_sys_ioctl_h = yes; then HAVE_SYS_IOCTL_H=1 dnl Test whether <sys/ioctl.h> declares ioctl(), or whether some other dnl header file, such as <unistd.h> or <stropts.h>, is needed for that. AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl], [gl_cv_decl_ioctl_in_sys_ioctl_h], [dnl We cannot use AC_CHECK_DECL because it produces its own messages. AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/ioctl.h>]], [[(void) ioctl;]])], [gl_cv_decl_ioctl_in_sys_ioctl_h=yes], [gl_cv_decl_ioctl_in_sys_ioctl_h=no]) ]) else HAVE_SYS_IOCTL_H=0 fi AC_SUBST([HAVE_SYS_IOCTL_H]) dnl <sys/ioctl.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([sys/ioctl.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <sys/ioctl.h> /* Some platforms declare ioctl in the wrong header. */ #if !(defined __GLIBC__ && !defined __UCLIBC__) # include <unistd.h> #endif ]], [ioctl]) ]) # gl_SYS_IOCTL_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_SYS_IOCTL_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_SYS_IOCTL_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_IOCTL_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IOCTL]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_IOCTL_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) ]) AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H]) SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) REPLACE_IOCTL=0; AC_SUBST([REPLACE_IOCTL]) ]) ���kbuild-3608/src/grep/m4/i-ring.m4�������������������������������������������������������������������0000664�0001750�0001750�00000000456�14670377440�016422� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 2 dnl Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_I_RING], [ : ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/vasnprintf.m4���������������������������������������������������������������0000664�0001750�0001750�00000021604�14670377450�017426� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# vasnprintf.m4 serial 38 dnl Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_VASNPRINTF], [ AC_CHECK_FUNCS_ONCE([vasnprintf]) if test $ac_cv_func_vasnprintf = no; then gl_REPLACE_VASNPRINTF fi ]) AC_DEFUN([gl_REPLACE_VASNPRINTF], [ AC_CHECK_FUNCS_ONCE([vasnprintf]) AC_LIBOBJ([vasnprintf]) AC_LIBOBJ([printf-args]) AC_LIBOBJ([printf-parse]) AC_LIBOBJ([asnprintf]) if test $ac_cv_func_vasnprintf = yes; then AC_DEFINE([REPLACE_VASNPRINTF], [1], [Define if vasnprintf exists but is overridden by gnulib.]) fi gl_PREREQ_PRINTF_ARGS gl_PREREQ_PRINTF_PARSE gl_PREREQ_VASNPRINTF gl_PREREQ_ASNPRINTF ]) # Prerequisites of lib/printf-args.h, lib/printf-args.c. AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) ]) # Prerequisites of lib/printf-parse.h, lib/printf-parse.c. AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ AC_REQUIRE([gl_FEATURES_H]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_REQUIRE([AC_TYPE_SIZE_T]) AC_CHECK_TYPE([ptrdiff_t], , [AC_DEFINE([ptrdiff_t], [long], [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) ]) AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) ]) # Prerequisites of lib/vasnprintf.c. AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], [ AC_REQUIRE([AC_FUNC_ALLOCA]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) dnl Use the _snprintf function only if it is declared (because on NetBSD it dnl is defined as a weak alias of snprintf; we prefer to use the latter). AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]]) dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE. AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) dnl We can avoid a lot of code by assuming that snprintf's return value dnl conforms to ISO C99. So check that. AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) case "$gl_cv_func_snprintf_retval_c99" in *yes) AC_DEFINE([HAVE_SNPRINTF_RETVAL_C99], [1], [Define if the return value of the snprintf function is the number of of bytes (excluding the terminating NUL) that would have been produced if the buffer had been large enough.]) ;; esac dnl Additionally, the use of %n can be eliminated by assuming that snprintf dnl always produces NUL-terminated strings (no truncation). AC_REQUIRE([gl_SNPRINTF_TRUNCATION_C99]) case "$gl_cv_func_snprintf_truncation_c99" in *yes) AC_DEFINE([HAVE_SNPRINTF_TRUNCATION_C99], [1], [Define if the string produced by the snprintf function is always NUL terminated.]) ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' # arguments. AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], [ AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) case "$gl_cv_func_printf_long_double" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], [Define if the vasnprintf implementation needs special code for 'long double' arguments.]) ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double' # arguments. AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE], [ AC_REQUIRE([gl_PRINTF_INFINITE]) case "$gl_cv_func_printf_infinite" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1], [Define if the vasnprintf implementation needs special code for infinite 'double' arguments.]) ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double' # arguments. AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE], [ AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if dnl NEED_PRINTF_LONG_DOUBLE is already set. AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE]) case "$gl_cv_func_printf_long_double" in *yes) case "$gl_cv_func_printf_infinite_long_double" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1], [Define if the vasnprintf implementation needs special code for infinite 'long double' arguments.]) ;; esac ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive. AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], [ AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) case "$gl_cv_func_printf_directive_a" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1], [Define if the vasnprintf implementation needs special code for the 'a' and 'A' directives.]) AC_CHECK_FUNCS([nl_langinfo]) ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive. AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F], [ AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) case "$gl_cv_func_printf_directive_f" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1], [Define if the vasnprintf implementation needs special code for the 'F' directive.]) ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive. AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS], [ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS]) case "$gl_cv_func_printf_directive_ls" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1], [Define if the vasnprintf implementation needs special code for the 'ls' directive.]) ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], [ AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) case "$gl_cv_func_printf_flag_grouping" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], [Define if the vasnprintf implementation needs special code for the ' flag.]) ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag. AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST], [ AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) case "$gl_cv_func_printf_flag_leftadjust" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1], [Define if the vasnprintf implementation needs special code for the '-' flag.]) ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag. AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], [ AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) case "$gl_cv_func_printf_flag_zero" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1], [Define if the vasnprintf implementation needs special code for the 0 flag.]) ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting large precisions. AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], [ AC_REQUIRE([gl_PRINTF_PRECISION]) case "$gl_cv_func_printf_precision" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1], [Define if the vasnprintf implementation needs special code for supporting large precisions without arbitrary bounds.]) AC_DEFINE([NEED_PRINTF_DOUBLE], [1], [Define if the vasnprintf implementation needs special code for 'double' arguments.]) AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], [Define if the vasnprintf implementation needs special code for 'long double' arguments.]) ;; esac ]) # Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory # conditions. AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], [ AC_REQUIRE([gl_PRINTF_ENOMEM]) case "$gl_cv_func_printf_enomem" in *yes) ;; *) AC_DEFINE([NEED_PRINTF_ENOMEM], [1], [Define if the vasnprintf implementation needs special code for surviving out-of-memory conditions.]) AC_DEFINE([NEED_PRINTF_DOUBLE], [1], [Define if the vasnprintf implementation needs special code for 'double' arguments.]) AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], [Define if the vasnprintf implementation needs special code for 'long double' arguments.]) ;; esac ]) # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], [ AC_REQUIRE([gl_PREREQ_VASNPRINTF]) gl_PREREQ_VASNPRINTF_LONG_DOUBLE gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE gl_PREREQ_VASNPRINTF_DIRECTIVE_A gl_PREREQ_VASNPRINTF_DIRECTIVE_F gl_PREREQ_VASNPRINTF_DIRECTIVE_LS gl_PREREQ_VASNPRINTF_FLAG_GROUPING gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST gl_PREREQ_VASNPRINTF_FLAG_ZERO gl_PREREQ_VASNPRINTF_PRECISION gl_PREREQ_VASNPRINTF_ENOMEM ]) # Prerequisites of lib/asnprintf.c. AC_DEFUN([gl_PREREQ_ASNPRINTF], [ ]) ����������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/stdint.m4�������������������������������������������������������������������0000664�0001750�0001750�00000043027�14670377450�016544� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# stdint.m4 serial 60 dnl Copyright (C) 2001-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert and Bruno Haible. dnl Test whether <stdint.h> is supported or must be substituted. AC_PREREQ([2.61]) AC_DEFUN_ONCE([gl_STDINT_H], [ AC_PREREQ([2.59])dnl AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_LIMITS_H]) AC_REQUIRE([gt_TYPE_WINT_T]) dnl For backward compatibility. Some packages may still be testing these dnl macros. AC_DEFINE([HAVE_LONG_LONG_INT], [1], [Define to 1 if the system has the type 'long long int'.]) AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], [Define to 1 if the system has the type 'unsigned long long int'.]) dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does. AC_CHECK_HEADERS_ONCE([wchar.h]) if test $ac_cv_header_wchar_h = yes; then HAVE_WCHAR_H=1 else HAVE_WCHAR_H=0 fi AC_SUBST([HAVE_WCHAR_H]) dnl Check for <inttypes.h>. AC_CHECK_HEADERS_ONCE([inttypes.h]) if test $ac_cv_header_inttypes_h = yes; then HAVE_INTTYPES_H=1 else HAVE_INTTYPES_H=0 fi AC_SUBST([HAVE_INTTYPES_H]) dnl Check for <sys/types.h>. AC_CHECK_HEADERS_ONCE([sys/types.h]) if test $ac_cv_header_sys_types_h = yes; then HAVE_SYS_TYPES_H=1 else HAVE_SYS_TYPES_H=0 fi AC_SUBST([HAVE_SYS_TYPES_H]) gl_CHECK_NEXT_HEADERS([stdint.h]) if test $ac_cv_header_stdint_h = yes; then HAVE_STDINT_H=1 else HAVE_STDINT_H=0 fi AC_SUBST([HAVE_STDINT_H]) dnl Now see whether we need a substitute <stdint.h>. if test $ac_cv_header_stdint_h = yes; then AC_CACHE_CHECK([whether stdint.h conforms to C99], [gl_cv_header_working_stdint_h], [gl_cv_header_working_stdint_h=no AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ #define __STDC_CONSTANT_MACROS 1 #define __STDC_LIMIT_MACROS 1 #include <stdint.h> /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ #if !(defined WCHAR_MIN && defined WCHAR_MAX) #error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>" #endif ] gl_STDINT_INCLUDES [ #ifdef INT8_MAX int8_t a1 = INT8_MAX; int8_t a1min = INT8_MIN; #endif #ifdef INT16_MAX int16_t a2 = INT16_MAX; int16_t a2min = INT16_MIN; #endif #ifdef INT32_MAX int32_t a3 = INT32_MAX; int32_t a3min = INT32_MIN; #endif #ifdef INT64_MAX int64_t a4 = INT64_MAX; int64_t a4min = INT64_MIN; #endif #ifdef UINT8_MAX uint8_t b1 = UINT8_MAX; #else typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; #endif #ifdef UINT16_MAX uint16_t b2 = UINT16_MAX; #endif #ifdef UINT32_MAX uint32_t b3 = UINT32_MAX; #endif #ifdef UINT64_MAX uint64_t b4 = UINT64_MAX; #endif int_least8_t c1 = INT8_C (0x7f); int_least8_t c1max = INT_LEAST8_MAX; int_least8_t c1min = INT_LEAST8_MIN; int_least16_t c2 = INT16_C (0x7fff); int_least16_t c2max = INT_LEAST16_MAX; int_least16_t c2min = INT_LEAST16_MIN; int_least32_t c3 = INT32_C (0x7fffffff); int_least32_t c3max = INT_LEAST32_MAX; int_least32_t c3min = INT_LEAST32_MIN; int_least64_t c4 = INT64_C (0x7fffffffffffffff); int_least64_t c4max = INT_LEAST64_MAX; int_least64_t c4min = INT_LEAST64_MIN; uint_least8_t d1 = UINT8_C (0xff); uint_least8_t d1max = UINT_LEAST8_MAX; uint_least16_t d2 = UINT16_C (0xffff); uint_least16_t d2max = UINT_LEAST16_MAX; uint_least32_t d3 = UINT32_C (0xffffffff); uint_least32_t d3max = UINT_LEAST32_MAX; uint_least64_t d4 = UINT64_C (0xffffffffffffffff); uint_least64_t d4max = UINT_LEAST64_MAX; int_fast8_t e1 = INT_FAST8_MAX; int_fast8_t e1min = INT_FAST8_MIN; int_fast16_t e2 = INT_FAST16_MAX; int_fast16_t e2min = INT_FAST16_MIN; int_fast32_t e3 = INT_FAST32_MAX; int_fast32_t e3min = INT_FAST32_MIN; int_fast64_t e4 = INT_FAST64_MAX; int_fast64_t e4min = INT_FAST64_MIN; uint_fast8_t f1 = UINT_FAST8_MAX; uint_fast16_t f2 = UINT_FAST16_MAX; uint_fast32_t f3 = UINT_FAST32_MAX; uint_fast64_t f4 = UINT_FAST64_MAX; #ifdef INTPTR_MAX intptr_t g = INTPTR_MAX; intptr_t gmin = INTPTR_MIN; #endif #ifdef UINTPTR_MAX uintptr_t h = UINTPTR_MAX; #endif intmax_t i = INTMAX_MAX; uintmax_t j = UINTMAX_MAX; /* Check that SIZE_MAX has the correct type, if possible. */ #if 201112 <= __STDC_VERSION__ int k = _Generic (SIZE_MAX, size_t: 0); #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ || (0x5110 <= __SUNPRO_C && !__STDC__)) extern size_t k; extern __typeof__ (SIZE_MAX) k; #endif #include <limits.h> /* for CHAR_BIT */ #define TYPE_MINIMUM(t) \ ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) #define TYPE_MAXIMUM(t) \ ((t) ((t) 0 < (t) -1 \ ? (t) -1 \ : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) struct s { int check_PTRDIFF: PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) ? 1 : -1; /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */ int check_SIG_ATOMIC: SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) ? 1 : -1; int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; int check_WCHAR: WCHAR_MIN == TYPE_MINIMUM (wchar_t) && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) ? 1 : -1; /* Detect bug in mingw. */ int check_WINT: WINT_MIN == TYPE_MINIMUM (wint_t) && WINT_MAX == TYPE_MAXIMUM (wint_t) ? 1 : -1; /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ int check_UINT8_C: (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; int check_UINT16_C: (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; /* Detect bugs in OpenBSD 3.9 stdint.h. */ #ifdef UINT8_MAX int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; #endif #ifdef UINT16_MAX int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; #endif #ifdef UINT32_MAX int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; #endif #ifdef UINT64_MAX int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; #endif int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; }; ]])], [dnl Determine whether the various *_MIN, *_MAX macros are usable dnl in preprocessor expression. We could do it by compiling a test dnl program for each of these macros. It is faster to run a program dnl that inspects the macro expansion. dnl This detects a bug on HP-UX 11.23/ia64. AC_RUN_IFELSE([ AC_LANG_PROGRAM([[ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ #define __STDC_CONSTANT_MACROS 1 #define __STDC_LIMIT_MACROS 1 #include <stdint.h> ] gl_STDINT_INCLUDES [ #include <stdio.h> #include <string.h> #define MVAL(macro) MVAL1(macro) #define MVAL1(expression) #expression static const char *macro_values[] = { #ifdef INT8_MAX MVAL (INT8_MAX), #endif #ifdef INT16_MAX MVAL (INT16_MAX), #endif #ifdef INT32_MAX MVAL (INT32_MAX), #endif #ifdef INT64_MAX MVAL (INT64_MAX), #endif #ifdef UINT8_MAX MVAL (UINT8_MAX), #endif #ifdef UINT16_MAX MVAL (UINT16_MAX), #endif #ifdef UINT32_MAX MVAL (UINT32_MAX), #endif #ifdef UINT64_MAX MVAL (UINT64_MAX), #endif NULL }; ]], [[ const char **mv; for (mv = macro_values; *mv != NULL; mv++) { const char *value = *mv; /* Test whether it looks like a cast expression. */ if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 || strncmp (value, "((int)"/*)*/, 6) == 0 || strncmp (value, "((signed short)"/*)*/, 15) == 0 || strncmp (value, "((signed char)"/*)*/, 14) == 0) return mv - macro_values + 1; } return 0; ]])], [gl_cv_header_working_stdint_h=yes], [], [case "$host_os" in # Guess yes on native Windows. mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; # In general, assume it works. *) gl_cv_header_working_stdint_h="guessing yes" ;; esac ]) ]) ]) fi HAVE_C99_STDINT_H=0 HAVE_SYS_BITYPES_H=0 HAVE_SYS_INTTYPES_H=0 STDINT_H=stdint.h case "$gl_cv_header_working_stdint_h" in *yes) HAVE_C99_STDINT_H=1 dnl Now see whether the system <stdint.h> works without dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. dnl If not, there would be problems when stdint.h is included from C++. AC_CACHE_CHECK([whether stdint.h works without ISO C predefines], [gl_cv_header_stdint_without_STDC_macros], [gl_cv_header_stdint_without_STDC_macros=no AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ #include <stdint.h> ] gl_STDINT_INCLUDES [ intmax_t im = INTMAX_MAX; int32_t i32 = INT32_C (0x7fffffff); ]])], [gl_cv_header_stdint_without_STDC_macros=yes]) ]) if test $gl_cv_header_stdint_without_STDC_macros = no; then AC_DEFINE([__STDC_CONSTANT_MACROS], [1], [Define to 1 if the system <stdint.h> predates C++11.]) AC_DEFINE([__STDC_LIMIT_MACROS], [1], [Define to 1 if the system <stdint.h> predates C++11.]) fi AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], [gl_cv_header_stdint_width], [gl_cv_header_stdint_width=no AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ /* Work if build is not clean. */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 #endif #include <stdint.h> ]gl_STDINT_INCLUDES[ int iw = UINTMAX_WIDTH; ]])], [gl_cv_header_stdint_width=yes])]) if test "$gl_cv_header_stdint_width" = yes; then STDINT_H= fi ;; *) dnl Check for <sys/inttypes.h>, and for dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5). AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) if test $ac_cv_header_sys_inttypes_h = yes; then HAVE_SYS_INTTYPES_H=1 fi if test $ac_cv_header_sys_bitypes_h = yes; then HAVE_SYS_BITYPES_H=1 fi gl_STDINT_TYPE_PROPERTIES ;; esac dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. gl_REPLACE_LIMITS_H AC_SUBST([HAVE_C99_STDINT_H]) AC_SUBST([HAVE_SYS_BITYPES_H]) AC_SUBST([HAVE_SYS_INTTYPES_H]) AC_SUBST([STDINT_H]) AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) ]) dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) dnl Determine the size of each of the given types in bits. AC_DEFUN([gl_STDINT_BITSIZEOF], [ dnl Use a shell loop, to avoid bloating configure, and dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into dnl config.h.in, dnl - extra AC_SUBST calls, so that the right substitutions are made. m4_foreach_w([gltype], [$1], [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), [Define to the number of bits in type ']gltype['.])]) for gltype in $1 ; do AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT], [$2 #include <limits.h>], [result=unknown]) eval gl_cv_bitsizeof_${gltype}=\$result ]) eval result=\$gl_cv_bitsizeof_${gltype} if test $result = unknown; then dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, dnl do a syntax check even on unused #if conditions and give an error dnl on valid C code like this: dnl #if 0 dnl # if > 32 dnl # endif dnl #endif result=0 fi GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) eval BITSIZEOF_${GLTYPE}=\$result done m4_foreach_w([gltype], [$1], [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) ]) dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) dnl Determine the signedness of each of the given types. dnl Define HAVE_SIGNED_TYPE if type is signed. AC_DEFUN([gl_CHECK_TYPES_SIGNED], [ dnl Use a shell loop, to avoid bloating configure, and dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into dnl config.h.in, dnl - extra AC_SUBST calls, so that the right substitutions are made. m4_foreach_w([gltype], [$1], [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), [Define to 1 if ']gltype[' is a signed integer type.])]) for gltype in $1 ; do AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([$2[ int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])], result=yes, result=no) eval gl_cv_type_${gltype}_signed=\$result ]) eval result=\$gl_cv_type_${gltype}_signed GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` if test "$result" = yes; then AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1]) eval HAVE_SIGNED_${GLTYPE}=1 else eval HAVE_SIGNED_${GLTYPE}=0 fi done m4_foreach_w([gltype], [$1], [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) ]) dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) dnl Determine the suffix to use for integer constants of the given types. dnl Define t_SUFFIX for each such type. AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], [ dnl Use a shell loop, to avoid bloating configure, and dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into dnl config.h.in, dnl - extra AC_SUBST calls, so that the right substitutions are made. m4_foreach_w([gltype], [$1], [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], [Define to l, ll, u, ul, ull, etc., as suitable for constants of type ']gltype['.])]) for gltype in $1 ; do AC_CACHE_CHECK([for $gltype integer literal suffix], [gl_cv_type_${gltype}_suffix], [eval gl_cv_type_${gltype}_suffix=no eval result=\$gl_cv_type_${gltype}_signed if test "$result" = yes; then glsufu= else glsufu=u fi for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do case $glsuf in '') gltype1='int';; l) gltype1='long int';; ll) gltype1='long long int';; i64) gltype1='__int64';; u) gltype1='unsigned int';; ul) gltype1='unsigned long int';; ull) gltype1='unsigned long long int';; ui64)gltype1='unsigned __int64';; esac AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([$2[ extern $gltype foo; extern $gltype1 foo;]])], [eval gl_cv_type_${gltype}_suffix=\$glsuf]) eval result=\$gl_cv_type_${gltype}_suffix test "$result" != no && break done]) GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` eval result=\$gl_cv_type_${gltype}_suffix test "$result" = no && result= eval ${GLTYPE}_SUFFIX=\$result AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result]) done m4_foreach_w([gltype], [$1], [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) ]) dnl gl_STDINT_INCLUDES AC_DEFUN([gl_STDINT_INCLUDES], [[ #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H # include <wchar.h> #endif ]]) dnl gl_STDINT_TYPE_PROPERTIES dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t dnl of interest to stdint.in.h. AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], [ AC_REQUIRE([gl_MULTIARCH]) if test $APPLE_UNIVERSAL_BUILD = 0; then gl_STDINT_BITSIZEOF([ptrdiff_t size_t], [gl_STDINT_INCLUDES]) fi gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t], [gl_STDINT_INCLUDES]) gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], [gl_STDINT_INCLUDES]) gl_cv_type_ptrdiff_t_signed=yes gl_cv_type_size_t_signed=no if test $APPLE_UNIVERSAL_BUILD = 0; then gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t], [gl_STDINT_INCLUDES]) fi gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], [gl_STDINT_INCLUDES]) dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99 dnl requirement that wint_t is "unchanged by default argument promotions". dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t. dnl Set the variable BITSIZEOF_WINT_T accordingly. if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then BITSIZEOF_WINT_T=32 fi ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/lstat.m4��������������������������������������������������������������������0000664�0001750�0001750�00000005441�14670377450�016364� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 33 # Copyright (C) 1997-2001, 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. dnl From Jim Meyering. AC_DEFUN([gl_FUNC_LSTAT], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) dnl If lstat does not exist, the replacement <sys/stat.h> does dnl "#define lstat stat", and lstat.c is a no-op. AC_CHECK_FUNCS_ONCE([lstat]) if test $ac_cv_func_lstat = yes; then AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in solaris* | *no) REPLACE_LSTAT=1 ;; esac else HAVE_LSTAT=0 fi ]) # Prerequisites of lib/lstat.c. AC_DEFUN([gl_PREREQ_LSTAT], [:]) AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], [ dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ. AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether lstat correctly handles trailing slash], [gl_cv_func_lstat_dereferences_slashed_symlink], [rm -f conftest.sym conftest.file echo >conftest.file AC_RUN_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT], [[struct stat sbuf; if (symlink ("conftest.file", "conftest.sym") != 0) return 1; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ]])], [gl_cv_func_lstat_dereferences_slashed_symlink=yes], [gl_cv_func_lstat_dereferences_slashed_symlink=no], [case "$host_os" in linux-* | linux) # Guess yes on Linux systems. gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; *-gnu* | gnu*) # Guess yes on glibc systems. gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; mingw*) # Guess no on native Windows. gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; *) # If we don't know, obey --enable-cross-guesses. gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.sym conftest.file ]) case "$gl_cv_func_lstat_dereferences_slashed_symlink" in *yes) AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1], [Define to 1 if 'lstat' dereferences a symlink specified with a trailing slash.]) ;; esac ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/wctomb.m4�������������������������������������������������������������������0000664�0001750�0001750�00000000714�14670377450�016526� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# wctomb.m4 serial 2 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_WCTOMB], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) if false; then REPLACE_WCTOMB=1 fi ]) # Prerequisites of lib/wctomb.c. AC_DEFUN([gl_PREREQ_WCTOMB], [ : ]) ����������������������������������������������������kbuild-3608/src/grep/m4/getprogname.m4��������������������������������������������������������������0000664�0001750�0001750�00000002633�14670377440�017544� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# getprogname.m4 - check for getprogname or replacements for it # Copyright (C) 2016-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 AC_DEFUN([gl_FUNC_GETPROGNAME], [ AC_CHECK_FUNCS_ONCE([getprogname getexecname]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) ac_found=0 AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [], [#include <errno.h>]) AC_CHECK_DECLS([program_invocation_short_name], [ac_found=1], [], [#include <errno.h>]) AC_CHECK_DECLS([__argv], [ac_found=1], [], [#include <stdlib.h>]) # Incur the cost of this test only if none of the above worked. if test $ac_found = 0; then # On OpenBSD 5.1, using the global __progname variable appears to be # the only way to implement getprogname. AC_CACHE_CHECK([whether __progname is defined in default libraries], [gl_cv_var___progname], [ gl_cv_var___progname= AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[extern char *__progname;]], [[return *__progname;]] )], [gl_cv_var___progname=yes] ) ] ) if test "$gl_cv_var___progname" = yes; then AC_DEFINE([HAVE_VAR___PROGNAME], 1, [Define if you have a global __progname variable]) fi fi ]) �����������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/raise.m4��������������������������������������������������������������������0000664�0001750�0001750�00000001771�14670377450�016342� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# raise.m4 serial 4 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_RAISE], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS([raise]) if test $ac_cv_func_raise = no; then HAVE_RAISE=0 else m4_ifdef([gl_MSVC_INVAL], [ AC_REQUIRE([gl_MSVC_INVAL]) if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then REPLACE_RAISE=1 fi ]) m4_ifdef([gl_SIGNALBLOCKING], [ gl_SIGNALBLOCKING if test $HAVE_POSIX_SIGNALBLOCKING = 0; then m4_ifdef([gl_SIGNAL_SIGPIPE], [ gl_SIGNAL_SIGPIPE if test $gl_cv_header_signal_h_SIGPIPE != yes; then REPLACE_RAISE=1 fi ], [:]) fi ]) fi ]) # Prerequisites of lib/raise.c. AC_DEFUN([gl_PREREQ_RAISE], [:]) �������kbuild-3608/src/grep/m4/stdalign.m4�����������������������������������������������������������������0000664�0001750�0001750�00000004562�14670377450�017045� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Check for stdalign.h that conforms to C11. dnl Copyright 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Prepare for substituting <stdalign.h> if it is not supported. AC_DEFUN([gl_STDALIGN_H], [ AC_CACHE_CHECK([for working stdalign.h], [gl_cv_header_working_stdalign_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <stdint.h> #include <stdalign.h> #include <stddef.h> /* Test that alignof yields a result consistent with offsetof. This catches GCC bug 52023 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ #ifdef __cplusplus template <class t> struct alignof_helper { char a; t b; }; # define ao(type) offsetof (alignof_helper<type>, b) #else # define ao(type) offsetof (struct { char a; type b; }, b) #endif char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1]; char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; /* Test _Alignas only on platforms where gnulib can help. */ #if \ ((defined __cplusplus && 201103 <= __cplusplus) \ || (__TINYC__ && defined __attribute__) \ || (defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ : __GNUC__) \ || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__ \ || 1300 <= _MSC_VER) struct alignas_test { char c; char alignas (8) alignas_8; }; char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 ? 1 : -1]; #endif ]])], [gl_cv_header_working_stdalign_h=yes], [gl_cv_header_working_stdalign_h=no])]) if test $gl_cv_header_working_stdalign_h = yes; then STDALIGN_H='' else STDALIGN_H='stdalign.h' fi AC_SUBST([STDALIGN_H]) AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"]) ]) ����������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/nocrash.m4������������������������������������������������������������������0000664�0001750�0001750�00000010555�14670377450�016674� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# nocrash.m4 serial 5 dnl Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. AC_PREREQ([2.13]) dnl Expands to some code for use in .c programs that will cause the configure dnl test to exit instead of crashing. This is useful to avoid triggering dnl action from a background debugger and to avoid core dumps. dnl Usage: ... dnl ]GL_NOCRASH[ dnl ... dnl int main() { nocrash_init(); ... } AC_DEFUN([GL_NOCRASH],[[ #include <stdlib.h> #if defined __MACH__ && defined __APPLE__ /* Avoid a crash on Mac OS X. */ #include <mach/mach.h> #include <mach/mach_error.h> #include <mach/thread_status.h> #include <mach/exception.h> #include <mach/task.h> #include <pthread.h> /* The exception port on which our thread listens. */ static mach_port_t our_exception_port; /* The main function of the thread listening for exceptions of type EXC_BAD_ACCESS. */ static void * mach_exception_thread (void *arg) { /* Buffer for a message to be received. */ struct { mach_msg_header_t head; mach_msg_body_t msgh_body; char data[1024]; } msg; mach_msg_return_t retval; /* Wait for a message on the exception port. */ retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); if (retval != MACH_MSG_SUCCESS) abort (); exit (1); } static void nocrash_init (void) { mach_port_t self = mach_task_self (); /* Allocate a port on which the thread shall listen for exceptions. */ if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) == KERN_SUCCESS) { /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ if (mach_port_insert_right (self, our_exception_port, our_exception_port, MACH_MSG_TYPE_MAKE_SEND) == KERN_SUCCESS) { /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting for us. */ exception_mask_t mask = EXC_MASK_BAD_ACCESS; /* Create the thread listening on the exception port. */ pthread_attr_t attr; pthread_t thread; if (pthread_attr_init (&attr) == 0 && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { pthread_attr_destroy (&attr); /* Replace the exception port info for these exceptions with our own. Note that we replace the exception port for the entire task, not only for a particular thread. This has the effect that when our exception port gets the message, the thread specific exception port has already been asked, and we don't need to bother about it. See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ task_set_exception_ports (self, mask, our_exception_port, EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); } } } } #elif defined _WIN32 && ! defined __CYGWIN__ /* Avoid a crash on native Windows. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winerror.h> static LONG WINAPI exception_filter (EXCEPTION_POINTERS *ExceptionInfo) { switch (ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: case EXCEPTION_IN_PAGE_ERROR: case EXCEPTION_STACK_OVERFLOW: case EXCEPTION_GUARD_PAGE: case EXCEPTION_PRIV_INSTRUCTION: case EXCEPTION_ILLEGAL_INSTRUCTION: case EXCEPTION_DATATYPE_MISALIGNMENT: case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: case EXCEPTION_NONCONTINUABLE_EXCEPTION: exit (1); } return EXCEPTION_CONTINUE_SEARCH; } static void nocrash_init (void) { SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); } #else /* Avoid a crash on POSIX systems. */ #include <signal.h> #include <unistd.h> /* A POSIX signal handler. */ static void exception_handler (int sig) { _exit (1); } static void nocrash_init (void) { #ifdef SIGSEGV signal (SIGSEGV, exception_handler); #endif #ifdef SIGBUS signal (SIGBUS, exception_handler); #endif } #endif ]]) ���������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/getcwd.m4�������������������������������������������������������������������0000664�0001750�0001750�00000012247�14670377440�016513� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# getcwd.m4 - check for working getcwd that is compatible with glibc # Copyright (C) 2001, 2003-2007, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. # serial 19 AC_DEFUN([gl_FUNC_GETCWD_NULL], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result], [gl_cv_func_getcwd_null], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ # include <stdlib.h> # if HAVE_UNISTD_H # include <unistd.h> # else /* on Windows with MSVC */ # include <direct.h> # endif ]GL_MDA_DEFINES[ # ifndef getcwd char *getcwd (); # endif ]], [[ #if defined _WIN32 && ! defined __CYGWIN__ /* mingw cwd does not start with '/', but _getcwd does allocate. However, mingw fails to honor non-zero size. */ #else if (chdir ("/") != 0) return 1; else { char *f = getcwd (NULL, 0); if (! f) return 2; if (f[0] != '/') { free (f); return 3; } if (f[1] != '\0') { free (f); return 4; } free (f); return 0; } #endif ]])], [gl_cv_func_getcwd_null=yes], [gl_cv_func_getcwd_null=no], [[case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_getcwd_null="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_getcwd_null="guessing yes";; # Guess yes on Cygwin. cygwin*) gl_cv_func_getcwd_null="guessing yes";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_getcwd_null="$gl_cross_guess_normal";; esac ]])]) ]) AC_DEFUN([gl_FUNC_GETCWD_SIGNATURE], [ AC_CACHE_CHECK([for getcwd with POSIX signature], [gl_cv_func_getcwd_posix_signature], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <unistd.h> ]GL_MDA_DEFINES], [[extern #ifdef __cplusplus "C" #endif char *getcwd (char *, size_t); ]]) ], [gl_cv_func_getcwd_posix_signature=yes], [gl_cv_func_getcwd_posix_signature=no]) ]) ]) dnl Guarantee that getcwd will malloc with a NULL first argument. Assumes dnl that either the system getcwd is robust, or that calling code is okay dnl with spurious failures when run from a directory with an absolute name dnl larger than 4k bytes. dnl dnl Assumes that getcwd exists; if you are worried about obsolete dnl platforms that lacked getcwd(), then you need to use the GPL module. AC_DEFUN([gl_FUNC_GETCWD_LGPL], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_GETCWD_NULL]) AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE]) case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in *yes,yes) ;; *) dnl Minimal replacement lib/getcwd-lgpl.c. REPLACE_GETCWD=1 ;; esac ]) dnl Check for all known getcwd bugs; useful for a program likely to be dnl executed from an arbitrary location. AC_DEFUN([gl_FUNC_GETCWD], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_GETCWD_NULL]) AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles gl_abort_bug=no case "$host_os" in mingw*) gl_cv_func_getcwd_path_max=yes ;; *) gl_FUNC_GETCWD_PATH_MAX case "$gl_cv_func_getcwd_null" in *yes) gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes]) ;; esac ;; esac dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD dnl if appropriate. case "$gl_cv_func_getcwd_path_max" in *"no" | *"no, it has the AIX bug") ;; *) AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1], [Define to 1 if getcwd minimally works, that is, its result can be trusted when it succeeds.]) ;; esac case "$gl_cv_func_getcwd_path_max" in *"no, but it is partly working") AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1], [Define to 1 if getcwd works, except it sometimes fails when it shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.]) ;; *"yes, but with shorter paths") AC_DEFINE([HAVE_GETCWD_SHORTER], [1], [Define to 1 if getcwd works, but with shorter paths than is generally tested with the replacement.]) ;; esac if { case "$gl_cv_func_getcwd_null" in *yes) false;; *) true;; esac; } \ || test $gl_cv_func_getcwd_posix_signature != yes \ || { case "$gl_cv_func_getcwd_path_max" in *yes*) false;; *) true;; esac; } \ || test $gl_abort_bug = yes; then REPLACE_GETCWD=1 fi ]) # Prerequisites of lib/getcwd.c, when full replacement is in effect. AC_DEFUN([gl_PREREQ_GETCWD], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO]) : ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/unlocked-io.m4��������������������������������������������������������������0000664�0001750�0001750�00000002470�14670377450�017445� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# unlocked-io.m4 serial 16 # Copyright (C) 1998-2006, 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. dnl From Jim Meyering. dnl dnl See if the glibc *_unlocked I/O macros or functions are available. dnl Use only those *_unlocked macros or functions that are declared dnl (because some of them were declared in Solaris 2.5.1 but were removed dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run dnl on Solaris 2.6). AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], [ dnl Persuade glibc and Solaris <stdio.h> to declare dnl fgets_unlocked(), fputs_unlocked() etc. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_DECLS_ONCE([clearerr_unlocked]) AC_CHECK_DECLS_ONCE([feof_unlocked]) AC_CHECK_DECLS_ONCE([ferror_unlocked]) AC_CHECK_DECLS_ONCE([fflush_unlocked]) AC_CHECK_DECLS_ONCE([fgets_unlocked]) AC_CHECK_DECLS_ONCE([fputc_unlocked]) AC_CHECK_DECLS_ONCE([fputs_unlocked]) AC_CHECK_DECLS_ONCE([fread_unlocked]) AC_CHECK_DECLS_ONCE([fwrite_unlocked]) AC_CHECK_DECLS_ONCE([getc_unlocked]) AC_CHECK_DECLS_ONCE([getchar_unlocked]) AC_CHECK_DECLS_ONCE([putc_unlocked]) AC_CHECK_DECLS_ONCE([putchar_unlocked]) ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/isblank.m4������������������������������������������������������������������0000664�0001750�0001750�00000001032�14670377450�016650� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# isblank.m4 serial 3 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ISBLANK], [ dnl Persuade glibc <ctype.h> to declare isblank(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_CTYPE_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([isblank]) if test $ac_cv_func_isblank = no; then HAVE_ISBLANK=0 fi ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/xsize.m4��������������������������������������������������������������������0000664�0001750�0001750�00000000626�14670377450�016377� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# xsize.m4 serial 5 dnl Copyright (C) 2003-2004, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_XSIZE], [ dnl Prerequisites of lib/xsize.h. AC_REQUIRE([gl_SIZE_MAX]) AC_CHECK_HEADERS([stdint.h]) ]) ����������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/printf.m4�������������������������������������������������������������������0000664�0001750�0001750�00000213527�14670377450�016545� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# printf.m4 serial 73 dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Test whether the *printf family of functions supports the 'j', 'z', 't', dnl 'L' size specifiers. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_printf_sizes_c99. AC_DEFUN([gl_PRINTF_SIZES_C99], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports size specifiers as in C99], [gl_cv_func_printf_sizes_c99], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stddef.h> #include <stdio.h> #include <string.h> #include <sys/types.h> #if HAVE_STDINT_H_WITH_UINTMAX # include <stdint.h> #endif #if HAVE_INTTYPES_H_WITH_UINTMAX # include <inttypes.h> #endif static char buf[100]; int main () { int result = 0; #if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX buf[0] = '\0'; if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 || strcmp (buf, "12345671 33") != 0) result |= 1; #else result |= 1; #endif buf[0] = '\0'; if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 || strcmp (buf, "12345672 33") != 0) result |= 2; buf[0] = '\0'; if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 || strcmp (buf, "12345673 33") != 0) result |= 4; buf[0] = '\0'; if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 || strcmp (buf, "1.5 33") != 0) result |= 8; return result; }]])], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no], [ case "$host_os" in changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; midnightbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on OpenBSD >= 3.9. openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) gl_cv_func_printf_sizes_c99="guessing no";; openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on Solaris >= 2.10. solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; solaris*) gl_cv_func_printf_sizes_c99="guessing no";; # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_printf_sizes_c99="guessing no";; netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on Android. linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; changequote([,])dnl # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif ], [gl_cv_func_printf_sizes_c99="guessing yes"], [gl_cv_func_printf_sizes_c99="guessing no"]) ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_printf_sizes_c99="$gl_cross_guess_normal";; esac ]) ]) ]) dnl Test whether the *printf family of functions supports 'long double' dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_printf_long_double. AC_DEFUN([gl_PRINTF_LONG_DOUBLE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports 'long double' arguments], [gl_cv_func_printf_long_double], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[10000]; int main () { int result = 0; buf[0] = '\0'; if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 || strcmp (buf, "1.750000 33") != 0) result |= 1; buf[0] = '\0'; if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 || strcmp (buf, "1.750000e+00 33") != 0) result |= 2; buf[0] = '\0'; if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 || strcmp (buf, "1.75 33") != 0) result |= 4; return result; }]])], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no], [case "$host_os" in # Guess no on BeOS. beos*) gl_cv_func_printf_long_double="guessing no";; # Guess yes on Android. linux*-android*) gl_cv_func_printf_long_double="guessing yes";; # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif ], [gl_cv_func_printf_long_double="guessing yes"], [gl_cv_func_printf_long_double="guessing no"]) ;; *) gl_cv_func_printf_long_double="guessing yes";; esac ]) ]) ]) dnl Test whether the *printf family of functions supports infinite and NaN dnl 'double' arguments and negative zero arguments in the %f, %e, %g dnl directives. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_printf_infinite. AC_DEFUN([gl_PRINTF_INFINITE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports infinite 'double' arguments], [gl_cv_func_printf_infinite], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static int strisnan (const char *string, size_t start_index, size_t end_index) { if (start_index < end_index) { if (string[start_index] == '-') start_index++; if (start_index + 3 <= end_index && memcmp (string + start_index, "nan", 3) == 0) { start_index += 3; if (start_index == end_index || (string[start_index] == '(' && string[end_index - 1] == ')')) return 1; } } return 0; } static int have_minus_zero () { static double plus_zero = 0.0; double minus_zero = - plus_zero; return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0; } static char buf[10000]; static double zero = 0.0; int main () { int result = 0; if (sprintf (buf, "%f", 1.0 / zero) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 1; if (sprintf (buf, "%f", -1.0 / zero) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 1; if (sprintf (buf, "%f", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 2; if (sprintf (buf, "%e", 1.0 / zero) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 4; if (sprintf (buf, "%e", -1.0 / zero) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 4; if (sprintf (buf, "%e", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 8; if (sprintf (buf, "%g", 1.0 / zero) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 16; if (sprintf (buf, "%g", -1.0 / zero) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 16; if (sprintf (buf, "%g", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 32; /* This test fails on HP-UX 10.20. */ if (have_minus_zero ()) if (sprintf (buf, "%g", - zero) < 0 || strcmp (buf, "-0") != 0) result |= 64; return result; }]])], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no], [ case "$host_os" in changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on FreeBSD >= 6. freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; midnightbsd*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; darwin*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on HP-UX >= 11. hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; hpux*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_printf_infinite="guessing no";; netbsd*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on OpenBSD >= 6.0. openbsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; openbsd*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_printf_infinite="guessing yes";; # Guess no on Android. linux*-android*) gl_cv_func_printf_infinite="guessing no";; changequote([,])dnl # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif ], [gl_cv_func_printf_infinite="guessing yes"], [gl_cv_func_printf_infinite="guessing no"]) ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_printf_infinite="$gl_cross_guess_normal";; esac ]) ]) ]) dnl Test whether the *printf family of functions supports infinite and NaN dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_printf_infinite_long_double. AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE], [ AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gl_BIGENDIAN]) AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl The user can set or unset the variable gl_printf_safe to indicate dnl that he wishes a safe handling of non-IEEE-754 'long double' values. if test -n "$gl_printf_safe"; then AC_DEFINE([CHECK_PRINTF_SAFE], [1], [Define if you wish *printf() functions that have a safe handling of non-IEEE-754 'long double' values.]) fi case "$gl_cv_func_printf_long_double" in *yes) AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments], [gl_cv_func_printf_infinite_long_double], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ ]GL_NOCRASH[ #include <float.h> #include <stdio.h> #include <string.h> static int strisnan (const char *string, size_t start_index, size_t end_index) { if (start_index < end_index) { if (string[start_index] == '-') start_index++; if (start_index + 3 <= end_index && memcmp (string + start_index, "nan", 3) == 0) { start_index += 3; if (start_index == end_index || (string[start_index] == '(' && string[end_index - 1] == ')')) return 1; } } return 0; } static char buf[10000]; static long double zeroL = 0.0L; int main () { int result = 0; nocrash_init(); if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 1; if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 1; if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 1; if (sprintf (buf, "%Le", 1.0L / zeroL) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 1; if (sprintf (buf, "%Le", -1.0L / zeroL) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 1; if (sprintf (buf, "%Le", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 1; if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 1; if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 1; if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 1; #if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ # ifdef WORDS_BIGENDIAN # define LDBL80_WORDS(exponent,manthi,mantlo) \ { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ (unsigned int) (mantlo) << 16 \ } # else # define LDBL80_WORDS(exponent,manthi,mantlo) \ { mantlo, manthi, exponent } # endif { /* Quiet NaN. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 2; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 2; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 2; } { /* Signalling NaN. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 2; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 2; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 2; } { /* Pseudo-NaN. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) <= 0) result |= 4; if (sprintf (buf, "%Le", x.value) <= 0) result |= 4; if (sprintf (buf, "%Lg", x.value) <= 0) result |= 4; } { /* Pseudo-Infinity. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) <= 0) result |= 8; if (sprintf (buf, "%Le", x.value) <= 0) result |= 8; if (sprintf (buf, "%Lg", x.value) <= 0) result |= 8; } { /* Pseudo-Zero. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) <= 0) result |= 16; if (sprintf (buf, "%Le", x.value) <= 0) result |= 16; if (sprintf (buf, "%Lg", x.value) <= 0) result |= 16; } { /* Unnormalized number. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) <= 0) result |= 32; if (sprintf (buf, "%Le", x.value) <= 0) result |= 32; if (sprintf (buf, "%Lg", x.value) <= 0) result |= 32; } { /* Pseudo-Denormal. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) <= 0) result |= 64; if (sprintf (buf, "%Le", x.value) <= 0) result |= 64; if (sprintf (buf, "%Lg", x.value) <= 0) result |= 64; } #endif return result; }]])], [gl_cv_func_printf_infinite_long_double=yes], [gl_cv_func_printf_infinite_long_double=no], [case "$host_cpu" in # Guess no on ia64, x86_64, i386. ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; *) case "$host_os" in changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on FreeBSD >= 6. freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; midnightbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on HP-UX >= 11. hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on OpenBSD >= 6.0. openbsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; openbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess no on Android. linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; changequote([,])dnl # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif ], [gl_cv_func_printf_infinite_long_double="guessing yes"], [gl_cv_func_printf_infinite_long_double="guessing no"]) ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";; esac ;; esac ]) ]) ;; *) gl_cv_func_printf_infinite_long_double="irrelevant" ;; esac ]) dnl Test whether the *printf family of functions supports the 'a' and 'A' dnl conversion specifier for hexadecimal output of floating-point numbers. dnl (ISO C99, POSIX:2001) dnl Result is gl_cv_func_printf_directive_a. AC_DEFUN([gl_PRINTF_DIRECTIVE_A], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives], [gl_cv_func_printf_directive_a], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; static double zero = 0.0; int main () { int result = 0; if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 || (strcmp (buf, "0x1.922p+1 33") != 0 && strcmp (buf, "0x3.244p+0 33") != 0 && strcmp (buf, "0x6.488p-1 33") != 0 && strcmp (buf, "0xc.91p-2 33") != 0)) result |= 1; if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 || (strcmp (buf, "-0X1.922P+1 33") != 0 && strcmp (buf, "-0X3.244P+0 33") != 0 && strcmp (buf, "-0X6.488P-1 33") != 0 && strcmp (buf, "-0XC.91P-2 33") != 0)) result |= 2; /* This catches a FreeBSD 13.0 bug: it doesn't round. */ if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x1.83p+0 33") != 0 && strcmp (buf, "0x3.05p-1 33") != 0 && strcmp (buf, "0x6.0ap-2 33") != 0 && strcmp (buf, "0xc.14p-3 33") != 0)) result |= 4; /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x2p+0 33") != 0 && strcmp (buf, "0x3p-1 33") != 0 && strcmp (buf, "0x6p-2 33") != 0 && strcmp (buf, "0xcp-3 33") != 0)) result |= 4; /* This catches a FreeBSD 6.1 bug. See <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */ if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 || buf[0] == '0') result |= 8; /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ if (sprintf (buf, "%.1a", 1.999) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 && strcmp (buf, "0x4.0p-1") != 0 && strcmp (buf, "0x8.0p-2") != 0)) result |= 16; /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ if (sprintf (buf, "%.1La", 1.999L) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 && strcmp (buf, "0x4.0p-1") != 0 && strcmp (buf, "0x8.0p-2") != 0)) result |= 32; return result; }]])], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no], [ case "$host_os" in # Guess yes on glibc >= 2.5 systems. *-gnu* | gnu*) AC_EGREP_CPP([BZ2908], [ #include <features.h> #ifdef __GNU_LIBRARY__ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__ BZ2908 #endif #endif ], [gl_cv_func_printf_directive_a="guessing yes"], [gl_cv_func_printf_directive_a="guessing no"]) ;; # Guess yes on musl systems. *-musl*) gl_cv_func_printf_directive_a="guessing yes";; # Guess no on Android. linux*-android*) gl_cv_func_printf_directive_a="guessing no";; # Guess no on native Windows. mingw*) gl_cv_func_printf_directive_a="guessing no";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; esac ]) ]) ]) dnl Test whether the *printf family of functions supports the %F format dnl directive. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_printf_directive_f. AC_DEFUN([gl_PRINTF_DIRECTIVE_F], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports the 'F' directive], [gl_cv_func_printf_directive_f], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; static double zero = 0.0; int main () { int result = 0; if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 || strcmp (buf, "1234567.000000 33") != 0) result |= 1; if (sprintf (buf, "%F", 1.0 / zero) < 0 || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) result |= 2; /* This catches a Cygwin 1.5.x bug. */ if (sprintf (buf, "%.F", 1234.0) < 0 || strcmp (buf, "1234") != 0) result |= 4; return result; }]])], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no], [ case "$host_os" in changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on FreeBSD >= 6. freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; midnightbsd*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; darwin*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on OpenBSD >= 6.0. openbsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; openbsd*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on Solaris >= 2.10. solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";; solaris*) gl_cv_func_printf_directive_f="guessing no";; # Guess no on Android. linux*-android*) gl_cv_func_printf_directive_f="guessing no";; changequote([,])dnl # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif ], [gl_cv_func_printf_directive_f="guessing yes"], [gl_cv_func_printf_directive_f="guessing no"]) ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_printf_directive_f="$gl_cross_guess_normal";; esac ]) ]) ]) dnl Test whether the *printf family of functions supports the %n format dnl directive. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_printf_directive_n. AC_DEFUN([gl_PRINTF_DIRECTIVE_N], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports the 'n' directive], [gl_cv_func_printf_directive_n], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef _MSC_VER #include <inttypes.h> /* See page about "Parameter Validation" on msdn.microsoft.com. <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation> <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-invalid-parameter-handler-set-thread-local-invalid-parameter-handler> */ static void cdecl invalid_parameter_handler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t dummy) { exit (1); } #endif static char fmtstring[10]; static char buf[100]; int main () { int count = -1; #ifdef _MSC_VER _set_invalid_parameter_handler (invalid_parameter_handler); #endif /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) support %n in format strings in read-only memory but not in writable memory. */ strcpy (fmtstring, "%d %n"); if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 || strcmp (buf, "123 ") != 0 || count != 4) return 1; return 0; }]])], [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no], [case "$host_os" in # Guess no on glibc when _FORTIFY_SOURCE >= 2. *-gnu* | gnu*) AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if _FORTIFY_SOURCE >= 2 error fail #endif ]])], [gl_cv_func_printf_directive_n="guessing yes"], [gl_cv_func_printf_directive_n="guessing no"]) ;; # Guess no on Android. linux*-android*) gl_cv_func_printf_directive_n="guessing no";; # Guess no on native Windows. mingw*) gl_cv_func_printf_directive_n="guessing no";; *) gl_cv_func_printf_directive_n="guessing yes";; esac ]) ]) ]) dnl Test whether the *printf family of functions supports the %ls format dnl directive and in particular, when a precision is specified, whether dnl the functions stop converting the wide string argument when the number dnl of bytes that have been produced by this conversion equals or exceeds dnl the precision. dnl Result is gl_cv_func_printf_directive_ls. AC_DEFUN([gl_PRINTF_DIRECTIVE_LS], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports the 'ls' directive], [gl_cv_func_printf_directive_ls], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <wchar.h> #include <string.h> int main () { int result = 0; char buf[100]; /* Test whether %ls works at all. This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on Cygwin 1.5. */ { static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; buf[0] = '\0'; if (sprintf (buf, "%ls", wstring) < 0 || strcmp (buf, "abc") != 0) result |= 1; } /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an assertion failure inside libc), but not on OpenBSD 4.0. */ { static const wchar_t wstring[] = { 'a', 0 }; buf[0] = '\0'; if (sprintf (buf, "%ls", wstring) < 0 || strcmp (buf, "a") != 0) result |= 2; } /* Test whether precisions in %ls are supported as specified in ISO C 99 section 7.19.6.1: "If a precision is specified, no more than that many bytes are written (including shift sequences, if any), and the array shall contain a null wide character if, to equal the multibyte character sequence length given by the precision, the function would need to access a wide character one past the end of the array." This test fails on Solaris 10. */ { static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 }; buf[0] = '\0'; if (sprintf (buf, "%.2ls", wstring) < 0 || strcmp (buf, "ab") != 0) result |= 8; } return result; }]])], [gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=no], [ changequote(,)dnl case "$host_os" in # Guess yes on OpenBSD >= 6.0. openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; irix*) gl_cv_func_printf_directive_ls="guessing no";; solaris*) gl_cv_func_printf_directive_ls="guessing no";; cygwin*) gl_cv_func_printf_directive_ls="guessing no";; beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; # Guess no on Android. linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; # Guess yes on native Windows. mingw*) gl_cv_func_printf_directive_ls="guessing yes";; *) gl_cv_func_printf_directive_ls="guessing yes";; esac changequote([,])dnl ]) ]) ]) dnl Test whether the *printf family of functions supports POSIX/XSI format dnl strings with positions. (POSIX:2001) dnl Result is gl_cv_func_printf_positions. AC_DEFUN([gl_PRINTF_POSITIONS], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions], [gl_cv_func_printf_positions], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> /* The string "%2$d %1$d", with dollar characters protected from the shell's dollar expansion (possibly an autoconf bug). */ static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; static char buf[100]; int main () { sprintf (buf, format, 33, 55); return (strcmp (buf, "55 33") != 0); }]])], [gl_cv_func_printf_positions=yes], [gl_cv_func_printf_positions=no], [ changequote(,)dnl case "$host_os" in netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) gl_cv_func_printf_positions="guessing no";; beos*) gl_cv_func_printf_positions="guessing no";; # Guess yes on Android. linux*-android*) gl_cv_func_printf_positions="guessing yes";; # Guess no on native Windows. mingw* | pw*) gl_cv_func_printf_positions="guessing no";; *) gl_cv_func_printf_positions="guessing yes";; esac changequote([,])dnl ]) ]) ]) dnl Test whether the *printf family of functions supports POSIX/XSI format dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001) dnl Result is gl_cv_func_printf_flag_grouping. AC_DEFUN([gl_PRINTF_FLAG_GROUPING], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports the grouping flag], [gl_cv_func_printf_flag_grouping], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; int main () { if (sprintf (buf, "%'d %d", 1234567, 99) < 0 || buf[strlen (buf) - 1] != '9') return 1; return 0; }]])], [gl_cv_func_printf_flag_grouping=yes], [gl_cv_func_printf_flag_grouping=no], [ changequote(,)dnl case "$host_os" in cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; # Guess no on Android. linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; # Guess no on native Windows. mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; *) gl_cv_func_printf_flag_grouping="guessing yes";; esac changequote([,])dnl ]) ]) ]) dnl Test whether the *printf family of functions supports the - flag correctly. dnl (ISO C99.) See dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html> dnl Result is gl_cv_func_printf_flag_leftadjust. AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly], [gl_cv_func_printf_flag_leftadjust], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; int main () { /* Check that a '-' flag is not annihilated by a negative width. */ if (sprintf (buf, "a%-*sc", -3, "b") < 0 || strcmp (buf, "ab c") != 0) return 1; return 0; }]])], [gl_cv_func_printf_flag_leftadjust=yes], [gl_cv_func_printf_flag_leftadjust=no], [ changequote(,)dnl case "$host_os" in # Guess yes on HP-UX 11. hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; # Guess no on HP-UX 10 and older. hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; # Guess yes on Android. linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; # Guess yes on native Windows. mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; # Guess yes otherwise. *) gl_cv_func_printf_flag_leftadjust="guessing yes";; esac changequote([,])dnl ]) ]) ]) dnl Test whether the *printf family of functions supports padding of non-finite dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See dnl <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> dnl Result is gl_cv_func_printf_flag_zero. AC_DEFUN([gl_PRINTF_FLAG_ZERO], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports the zero flag correctly], [gl_cv_func_printf_flag_zero], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; static double zero = 0.0; int main () { if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0 || (strcmp (buf, " inf") != 0 && strcmp (buf, " infinity") != 0)) return 1; return 0; }]])], [gl_cv_func_printf_flag_zero=yes], [gl_cv_func_printf_flag_zero=no], [ changequote(,)dnl case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_printf_flag_zero="guessing yes";; # Guess no on Android. linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; # Guess no on native Windows. mingw*) gl_cv_func_printf_flag_zero="guessing no";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; esac changequote([,])dnl ]) ]) ]) dnl Test whether the *printf family of functions supports large precisions. dnl On mingw, precisions larger than 512 are treated like 512, in integer, dnl floating-point or pointer output. On Solaris 10/x86, precisions larger dnl than 510 in floating-point output crash the program. On Solaris 10/SPARC, dnl precisions larger than 510 in floating-point output yield wrong results. dnl On AIX 7.1, precisions larger than 998 in floating-point output yield dnl wrong results. On BeOS, precisions larger than 1044 crash the program. dnl Result is gl_cv_func_printf_precision. AC_DEFUN([gl_PRINTF_PRECISION], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf supports large precisions], [gl_cv_func_printf_precision], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[5000]; int main () { int result = 0; #ifdef __BEOS__ /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ return 1; #endif if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) result |= 1; if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5) result |= 2; if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5 || buf[0] != '1') result |= 4; if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5 || buf[0] != '1') result |= 4; return result; }]])], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no], [ changequote(,)dnl case "$host_os" in # Guess no only on Solaris, native Windows, and BeOS systems. solaris*) gl_cv_func_printf_precision="guessing no" ;; mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; beos*) gl_cv_func_printf_precision="guessing no" ;; # Guess yes on Android. linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; *) gl_cv_func_printf_precision="guessing yes" ;; esac changequote([,])dnl ]) ]) ]) dnl Test whether the *printf family of functions recovers gracefully in case dnl of an out-of-memory condition, or whether it crashes the entire program. dnl Result is gl_cv_func_printf_enomem. AC_DEFUN([gl_PRINTF_ENOMEM], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gl_MULTIARCH]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf survives out-of-memory conditions], [gl_cv_func_printf_enomem], [ gl_cv_func_printf_enomem="guessing no" if test "$cross_compiling" = no; then if test $APPLE_UNIVERSAL_BUILD = 0; then AC_LANG_CONFTEST([AC_LANG_SOURCE([[ ]GL_NOCRASH[ #include <stdio.h> #include <sys/types.h> #include <sys/time.h> #include <sys/resource.h> #include <errno.h> int main() { struct rlimit limit; int ret; nocrash_init (); /* Some printf implementations allocate temporary space with malloc. */ /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ #ifdef RLIMIT_DATA if (getrlimit (RLIMIT_DATA, &limit) < 0) return 77; if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) limit.rlim_max = 5000000; limit.rlim_cur = limit.rlim_max; if (setrlimit (RLIMIT_DATA, &limit) < 0) return 77; #endif /* On Linux systems, malloc() is limited by RLIMIT_AS. */ #ifdef RLIMIT_AS if (getrlimit (RLIMIT_AS, &limit) < 0) return 77; if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) limit.rlim_max = 5000000; limit.rlim_cur = limit.rlim_max; if (setrlimit (RLIMIT_AS, &limit) < 0) return 77; #endif /* Some printf implementations allocate temporary space on the stack. */ #ifdef RLIMIT_STACK if (getrlimit (RLIMIT_STACK, &limit) < 0) return 77; if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) limit.rlim_max = 5000000; limit.rlim_cur = limit.rlim_max; if (setrlimit (RLIMIT_STACK, &limit) < 0) return 77; #endif ret = printf ("%.5000000f", 1.0); return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); } ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then (./conftest 2>&AS_MESSAGE_LOG_FD result=$? _AS_ECHO_LOG([\$? = $result]) if test $result != 0 && test $result != 77; then result=1; fi exit $result ) >/dev/null 2>/dev/null case $? in 0) gl_cv_func_printf_enomem="yes" ;; 77) gl_cv_func_printf_enomem="guessing no" ;; *) gl_cv_func_printf_enomem="no" ;; esac else gl_cv_func_printf_enomem="guessing no" fi rm -fr conftest* else dnl A universal build on Apple Mac OS X platforms. dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode. dnl But we need a configuration result that is valid in both modes. gl_cv_func_printf_enomem="guessing no" fi fi if test "$gl_cv_func_printf_enomem" = "guessing no"; then changequote(,)dnl case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";; # Guess yes on Solaris. solaris*) gl_cv_func_printf_enomem="guessing yes";; # Guess yes on AIX. aix*) gl_cv_func_printf_enomem="guessing yes";; # Guess yes on HP-UX/hppa. hpux*) case "$host_cpu" in hppa*) gl_cv_func_printf_enomem="guessing yes";; *) gl_cv_func_printf_enomem="guessing no";; esac ;; # Guess yes on IRIX. irix*) gl_cv_func_printf_enomem="guessing yes";; # Guess yes on OSF/1. osf*) gl_cv_func_printf_enomem="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_printf_enomem="guessing yes";; # Guess yes on Haiku. haiku*) gl_cv_func_printf_enomem="guessing yes";; # Guess no on Android. linux*-android*) gl_cv_func_printf_enomem="guessing no";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_printf_enomem="$gl_cross_guess_normal";; esac changequote([,])dnl fi ]) ]) dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001) dnl Result is ac_cv_func_snprintf. AC_DEFUN([gl_SNPRINTF_PRESENCE], [ AC_CHECK_FUNCS_ONCE([snprintf]) ]) dnl Test whether the string produced by the snprintf function is always NUL dnl terminated. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_snprintf_truncation_c99. AC_DEFUN_ONCE([gl_SNPRINTF_TRUNCATION_C99], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf truncates the result as in C99], [gl_cv_func_snprintf_truncation_c99], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> #if HAVE_SNPRINTF # define my_snprintf snprintf #else # include <stdarg.h> static int my_snprintf (char *buf, int size, const char *format, ...) { va_list args; int ret; va_start (args, format); ret = vsnprintf (buf, size, format, args); va_end (args); return ret; } #endif static char buf[100]; int main () { strcpy (buf, "ABCDEF"); my_snprintf (buf, 3, "%d %d", 4567, 89); if (memcmp (buf, "45\0DEF", 6) != 0) return 1; return 0; }]])], [gl_cv_func_snprintf_truncation_c99=yes], [gl_cv_func_snprintf_truncation_c99=no], [ changequote(,)dnl case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; midnightbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on OpenBSD >= 3.9. openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) gl_cv_func_snprintf_truncation_c99="guessing no";; openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Solaris >= 2.6. solaris2.[0-5] | solaris2.[0-5].*) gl_cv_func_snprintf_truncation_c99="guessing no";; solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on HP-UX >= 11. hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on IRIX >= 6.5. irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on OSF/1 >= 5. osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_snprintf_truncation_c99="guessing no";; netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Android. linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess no on native Windows. mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; esac changequote([,])dnl ]) ]) ]) dnl Test whether the return value of the snprintf function is the number dnl of bytes (excluding the terminating NUL) that would have been produced dnl if the buffer had been large enough. (ISO C99, POSIX:2001) dnl For example, this test program fails on IRIX 6.5: dnl --------------------------------------------------------------------- dnl #include <stdio.h> dnl int main() dnl { dnl static char buf[8]; dnl int retval = snprintf (buf, 3, "%d", 12345); dnl return retval >= 0 && retval < 3; dnl } dnl --------------------------------------------------------------------- dnl Result is gl_cv_func_snprintf_retval_c99. AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf returns a byte count as in C99], [gl_cv_func_snprintf_retval_c99], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> #if HAVE_SNPRINTF # define my_snprintf snprintf #else # include <stdarg.h> static int my_snprintf (char *buf, int size, const char *format, ...) { va_list args; int ret; va_start (args, format); ret = vsnprintf (buf, size, format, args); va_end (args); return ret; } #endif static char buf[100]; int main () { strcpy (buf, "ABCDEF"); if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7) return 1; if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7) return 2; if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7) return 3; return 0; }]])], [gl_cv_func_snprintf_retval_c99=yes], [gl_cv_func_snprintf_retval_c99=no], [case "$host_os" in changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; midnightbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on OpenBSD >= 3.9. openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) gl_cv_func_snprintf_retval_c99="guessing no";; openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on Solaris >= 2.10. solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; solaris*) gl_cv_func_printf_sizes_c99="guessing no";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_snprintf_retval_c99="guessing no";; netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on Android. linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; changequote([,])dnl # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif ], [gl_cv_func_snprintf_retval_c99="guessing yes"], [gl_cv_func_snprintf_retval_c99="guessing no"]) ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";; esac ]) ]) ]) dnl Test whether the snprintf function supports the %n format directive dnl also in truncated portions of the format string. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_snprintf_directive_n. AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive], [gl_cv_func_snprintf_directive_n], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> #if HAVE_SNPRINTF # define my_snprintf snprintf #else # include <stdarg.h> static int my_snprintf (char *buf, int size, const char *format, ...) { va_list args; int ret; va_start (args, format); ret = vsnprintf (buf, size, format, args); va_end (args); return ret; } #endif static char fmtstring[10]; static char buf[100]; int main () { int count = -1; /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) support %n in format strings in read-only memory but not in writable memory. */ strcpy (fmtstring, "%d %n"); my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); if (count != 6) return 1; return 0; }]])], [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no], [ case "$host_os" in # Guess no on glibc when _FORTIFY_SOURCE >= 2. *-gnu* | gnu*) AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if _FORTIFY_SOURCE >= 2 error fail #endif ]])], [gl_cv_func_snprintf_directive_n="guessing yes"], [gl_cv_func_snprintf_directive_n="guessing no"]) ;; changequote(,)dnl # Guess yes on musl systems. *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; midnightbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on Solaris >= 2.6. solaris2.[0-5] | solaris2.[0-5].*) gl_cv_func_snprintf_directive_n="guessing no";; solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; aix*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on IRIX >= 6.5. irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on OSF/1 >= 5. osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; osf*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_snprintf_directive_n="guessing no";; netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess no on Android. linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; # Guess no on native Windows. mingw*) gl_cv_func_snprintf_directive_n="guessing no";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; changequote([,])dnl esac ]) ]) ]) dnl Test whether the snprintf function, when passed a size = 1, writes any dnl output without bounds in this case, behaving like sprintf. This is the dnl case on Linux libc5. dnl Result is gl_cv_func_snprintf_size1. AC_DEFUN([gl_SNPRINTF_SIZE1], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf respects a size of 1], [gl_cv_func_snprintf_size1], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #if HAVE_SNPRINTF # define my_snprintf snprintf #else # include <stdarg.h> static int my_snprintf (char *buf, int size, const char *format, ...) { va_list args; int ret; va_start (args, format); ret = vsnprintf (buf, size, format, args); va_end (args); return ret; } #endif int main() { static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; my_snprintf (buf, 1, "%d", 12345); return buf[1] != 'E'; }]])], [gl_cv_func_snprintf_size1=yes], [gl_cv_func_snprintf_size1=no], [case "$host_os" in # Guess yes on Android. linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; # Guess yes on native Windows. mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; *) gl_cv_func_snprintf_size1="guessing yes" ;; esac ]) ]) ]) dnl Test whether the vsnprintf function, when passed a zero size, produces no dnl output. (ISO C99, POSIX:2001) dnl For example, snprintf nevertheless writes a NUL byte in this case dnl on OSF/1 5.1: dnl --------------------------------------------------------------------- dnl #include <stdio.h> dnl int main() dnl { dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; dnl snprintf (buf, 0, "%d", 12345); dnl return buf[0] != 'D'; dnl } dnl --------------------------------------------------------------------- dnl And vsnprintf writes any output without bounds in this case, behaving like dnl vsprintf, on HP-UX 11 and OSF/1 5.1: dnl --------------------------------------------------------------------- dnl #include <stdarg.h> dnl #include <stdio.h> dnl static int my_snprintf (char *buf, int size, const char *format, ...) dnl { dnl va_list args; dnl int ret; dnl va_start (args, format); dnl ret = vsnprintf (buf, size, format, args); dnl va_end (args); dnl return ret; dnl } dnl int main() dnl { dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; dnl my_snprintf (buf, 0, "%d", 12345); dnl return buf[0] != 'D'; dnl } dnl --------------------------------------------------------------------- dnl Result is gl_cv_func_vsnprintf_zerosize_c99. AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99], [gl_cv_func_vsnprintf_zerosize_c99], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdarg.h> #include <stdio.h> static int my_snprintf (char *buf, int size, const char *format, ...) { va_list args; int ret; va_start (args, format); ret = vsnprintf (buf, size, format, args); va_end (args); return ret; } int main() { static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; my_snprintf (buf, 0, "%d", 12345); return buf[0] != 'D'; }]])], [gl_cv_func_vsnprintf_zerosize_c99=yes], [gl_cv_func_vsnprintf_zerosize_c99=no], [ changequote(,)dnl case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on musl systems. *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on Cygwin. cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on Solaris >= 2.6. solaris2.[0-5] | solaris2.[0-5].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on IRIX >= 6.5. irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on Android. linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on native Windows. mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; esac changequote([,])dnl ]) ]) ]) dnl The results of these tests on various platforms are: dnl dnl 1 = gl_PRINTF_SIZES_C99 dnl 2 = gl_PRINTF_LONG_DOUBLE dnl 3 = gl_PRINTF_INFINITE dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE dnl 5 = gl_PRINTF_DIRECTIVE_A dnl 6 = gl_PRINTF_DIRECTIVE_F dnl 7 = gl_PRINTF_DIRECTIVE_N dnl 8 = gl_PRINTF_DIRECTIVE_LS dnl 9 = gl_PRINTF_POSITIONS dnl 10 = gl_PRINTF_FLAG_GROUPING dnl 11 = gl_PRINTF_FLAG_LEFTADJUST dnl 12 = gl_PRINTF_FLAG_ZERO dnl 13 = gl_PRINTF_PRECISION dnl 14 = gl_PRINTF_ENOMEM dnl 15 = gl_SNPRINTF_PRESENCE dnl 16 = gl_SNPRINTF_TRUNCATION_C99 dnl 17 = gl_SNPRINTF_RETVAL_C99 dnl 18 = gl_SNPRINTF_DIRECTIVE_N dnl 19 = gl_SNPRINTF_SIZE1 dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99 dnl dnl 1 = checking whether printf supports size specifiers as in C99... dnl 2 = checking whether printf supports 'long double' arguments... dnl 3 = checking whether printf supports infinite 'double' arguments... dnl 4 = checking whether printf supports infinite 'long double' arguments... dnl 5 = checking whether printf supports the 'a' and 'A' directives... dnl 6 = checking whether printf supports the 'F' directive... dnl 7 = checking whether printf supports the 'n' directive... dnl 8 = checking whether printf supports the 'ls' directive... dnl 9 = checking whether printf supports POSIX/XSI format strings with positions... dnl 10 = checking whether printf supports the grouping flag... dnl 11 = checking whether printf supports the left-adjust flag correctly... dnl 12 = checking whether printf supports the zero flag correctly... dnl 13 = checking whether printf supports large precisions... dnl 14 = checking whether printf survives out-of-memory conditions... dnl 15 = checking for snprintf... dnl 16 = checking whether snprintf truncates the result as in C99... dnl 17 = checking whether snprintf returns a byte count as in C99... dnl 18 = checking whether snprintf fully supports the 'n' directive... dnl 19 = checking whether snprintf respects a size of 1... dnl 20 = checking whether vsnprintf respects a zero size as in C99... dnl dnl . = yes, # = no. dnl dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . dnl FreeBSD 13.0 . . . . # . . . . . . . . # . . . . . . dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . dnl Mac OS X 10.13.5 . . . # # . # . . . . . . . . . . # . . dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . . dnl OpenBSD 6.0, 6.7 . . . . # . . . . . . . . # . . . . . . dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . dnl Solaris 11.4 . . # # # . . # . . . # . . . . . . . . dnl Solaris 11.3 . . . . # . . # . . . . . . . . . . . . dnl Solaris 11.0 . . # # # . . # . . . # . . . . . . . . dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . . dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . . dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . . dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # dnl NetBSD 9.0 . . . . # . . . . . . . . . . . . . . . dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . dnl Haiku . . . # # # . # . . . . . ? . . ? . . . dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . dnl Android 4.3 . . # # # # # # . # . # . # . . . # . . dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . . �������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/eealloc.m4������������������������������������������������������������������0000664�0001750�0001750�00000001667�14670377440�016646� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# eealloc.m4 serial 3 dnl Copyright (C) 2003, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_EEALLOC], [ AC_REQUIRE([gl_EEMALLOC]) AC_REQUIRE([gl_EEREALLOC]) ]) AC_DEFUN([gl_EEMALLOC], [ _AC_FUNC_MALLOC_IF( [gl_cv_func_malloc_0_nonnull=1], [gl_cv_func_malloc_0_nonnull=0]) AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull], [If malloc(0) is != NULL, define this to 1. Otherwise define this to 0.]) ]) AC_DEFUN([gl_EEREALLOC], [ _AC_FUNC_REALLOC_IF( [gl_cv_func_realloc_0_nonnull=1], [gl_cv_func_realloc_0_nonnull=0]) AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull], [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this to 0.]) ]) �������������������������������������������������������������������������kbuild-3608/src/grep/m4/stpcpy.m4�������������������������������������������������������������������0000664�0001750�0001750�00000001307�14670377450�016554� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# stpcpy.m4 serial 9 dnl Copyright (C) 2002, 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STPCPY], [ dnl Persuade glibc <string.h> to declare stpcpy(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl The stpcpy() declaration in lib/string.in.h uses 'restrict'. AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS([stpcpy]) if test $ac_cv_func_stpcpy = no; then HAVE_STPCPY=0 fi ]) # Prerequisites of lib/stpcpy.c. AC_DEFUN([gl_PREREQ_STPCPY], [ : ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/unistd_h.m4�����������������������������������������������������������������0000664�0001750�0001750�00000031335�14670377450�017053� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# unistd_h.m4 serial 89 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Simon Josefsson, Bruno Haible. AC_DEFUN_ONCE([gl_UNISTD_H], [ dnl Ensure to expand the default settings once only, before all statements dnl that occur in other macros. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([unistd.h]) if test $ac_cv_header_unistd_h = yes; then HAVE_UNISTD_H=1 else HAVE_UNISTD_H=0 fi AC_SUBST([HAVE_UNISTD_H]) dnl Ensure the type pid_t gets defined. AC_REQUIRE([AC_TYPE_PID_T]) dnl Determine WINDOWS_64_BIT_OFF_T. AC_REQUIRE([gl_TYPE_OFF_T]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ #if HAVE_UNISTD_H # include <unistd.h> #endif /* Some systems declare various items in the wrong headers. */ #if !(defined __GLIBC__ && !defined __UCLIBC__) # include <fcntl.h> # include <stdio.h> # include <stdlib.h> # if defined _WIN32 && ! defined __CYGWIN__ # include <io.h> # endif #endif ]], [access chdir chown copy_file_range dup dup2 dup3 environ euidaccess execl execle execlp execv execve execvp execvpe faccessat fchdir fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize getentropy getgroups gethostname getlogin getlogin_r getpagesize getpass getusershell setusershell endusershell group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite readlink readlinkat rmdir sethostname sleep symlink symlinkat truncate ttyname_r unlink unlinkat usleep]) AC_REQUIRE([AC_C_RESTRICT]) AC_CHECK_DECLS_ONCE([execvpe]) if test $ac_cv_have_decl_execvpe = no; then HAVE_DECL_EXECVPE=0 fi ]) # gl_UNISTD_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_UNISTD_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_UNISTD_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCESS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHDIR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHOWN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPY_FILE_RANGE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP2]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP3]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ENVIRON]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EUIDACCESS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVPE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FACCESSAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHDIR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHOWNAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDATASYNC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSYNC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTRUNCATE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCWD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDOMAINNAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDTABLESIZE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETENTROPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETGROUPS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETHOSTNAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETOPT_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAGESIZE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUSERSHELL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GROUP_MEMBER]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISATTY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHOWN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINKAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSEEK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE2]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PREAD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PWRITE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READ]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINKAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RMDIR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETHOSTNAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SLEEP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINKAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCATE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TTYNAME_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_NONBLOCKING]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_SIGPIPE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINKAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_USLEEP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WRITE]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ACCESS], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHDIR], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CLOSE], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP2], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECL], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLE], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLP], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECV], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVE], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVP], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVPE], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETCWD], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETPID], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ISATTY], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LSEEK], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_READ], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_RMDIR], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_SWAB], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UNLINK], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WRITE], [1]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) ]) AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE]) HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) HAVE_EXECVPE=1; AC_SUBST([HAVE_EXECVPE]) HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) HAVE_GETENTROPY=1; AC_SUBST([HAVE_GETENTROPY]) HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) HAVE_GETPASS=1; AC_SUBST([HAVE_GETPASS]) HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) HAVE_PIPE=1; AC_SUBST([HAVE_PIPE]) HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME]) HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) HAVE_DECL_EXECVPE=1; AC_SUBST([HAVE_DECL_EXECVPE]) HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) HAVE_DECL_GETLOGIN=1; AC_SUBST([HAVE_DECL_GETLOGIN]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME]) HAVE_DECL_TRUNCATE=1; AC_SUBST([HAVE_DECL_TRUNCATE]) HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R]) HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) REPLACE_ACCESS=0; AC_SUBST([REPLACE_ACCESS]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) REPLACE_EXECL=0; AC_SUBST([REPLACE_EXECL]) REPLACE_EXECLE=0; AC_SUBST([REPLACE_EXECLE]) REPLACE_EXECLP=0; AC_SUBST([REPLACE_EXECLP]) REPLACE_EXECV=0; AC_SUBST([REPLACE_EXECV]) REPLACE_EXECVE=0; AC_SUBST([REPLACE_EXECVE]) REPLACE_EXECVP=0; AC_SUBST([REPLACE_EXECVP]) REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE]) REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) REPLACE_READ=0; AC_SUBST([REPLACE_READ]) REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) REPLACE_TRUNCATE=0; AC_SUBST([REPLACE_TRUNCATE]) REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) UNISTD_H_HAVE_SYS_RANDOM_H=0; AC_SUBST([UNISTD_H_HAVE_SYS_RANDOM_H]) UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/po.m4�����������������������������������������������������������������������0000664�0001750�0001750�00000045002�14670377450�015650� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# po.m4 serial 20 (gettext-0.18.2) dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. AC_PREREQ([2.60]) dnl Checks for all prerequisites of the po subdirectory. AC_DEFUN([AM_PO_SUBDIRS], [ AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl AC_REQUIRE([AM_NLS])dnl dnl Release version of the gettext macros. This is used to ensure that dnl the gettext macros and po/Makefile.in.in are in sync. AC_SUBST([GETTEXT_MACRO_VERSION], [0.18]) dnl Perform the following tests also if --disable-nls has been given, dnl because they are needed for "make dist" to work. dnl Search for GNU msgfmt in the PATH. dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. dnl The second test excludes FreeBSD msgfmt. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) dnl Test whether it is GNU msgfmt >= 0.15. changequote(,)dnl case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; *) MSGFMT_015=$MSGFMT ;; esac changequote([,])dnl AC_SUBST([MSGFMT_015]) changequote(,)dnl case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; *) GMSGFMT_015=$GMSGFMT ;; esac changequote([,])dnl AC_SUBST([GMSGFMT_015]) dnl Search for GNU xgettext 0.12 or newer in the PATH. dnl The first test excludes Solaris xgettext and early GNU xgettext versions. dnl The second test excludes FreeBSD xgettext. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) dnl Remove leftover from FreeBSD xgettext call. rm -f messages.po dnl Test whether it is GNU xgettext >= 0.15. changequote(,)dnl case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; *) XGETTEXT_015=$XGETTEXT ;; esac changequote([,])dnl AC_SUBST([XGETTEXT_015]) dnl Search for GNU msgmerge 0.11 or newer in the PATH. AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) dnl Installation directories. dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we dnl have to define it here, so that it can be used in po/Makefile. test -n "$localedir" || localedir='${datadir}/locale' AC_SUBST([localedir]) dnl Support for AM_XGETTEXT_OPTION. test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) AC_CONFIG_COMMANDS([po-directories], [[ for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" gt_tab=`printf '\t'` cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done]], [# Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake < 1.5. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" ]) ]) dnl Postprocesses a Makefile in a directory containing PO files. AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], [ # When this code is run, in config.status, two variables have already been # set: # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, # - LINGUAS is the value of the environment variable LINGUAS at configure # time. changequote(,)dnl # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Find a way to echo strings without interpreting backslash. if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then gt_echo='echo' else if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then gt_echo='printf %s\n' else echo_func () { cat <<EOT $* EOT } gt_echo='echo_func' fi fi # A sed script that extracts the value of VARIABLE from a Makefile. tab=`printf '\t'` sed_x_variable=' # Test if the hold space is empty. x s/P/P/ x ta # Yes it was empty. Look if we have the expected variable definition. /^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{ # Seen the first line of the variable definition. s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=// ba } bd :a # Here we are processing a line from the variable definition. # Remove comment, more precisely replace it with a space. s/#.*$/ / # See if the line ends in a backslash. tb :b s/\\$// # Print the line, without the trailing backslash. p tc # There was no trailing backslash. The end of the variable definition is # reached. Clear the hold space. s/^.*$// x bd :c # A trailing backslash means that the variable definition continues in the # next line. Put a nonempty string into the hold space to indicate this. s/^.*$/P/ x :d ' changequote([,])dnl # Set POTFILES to the value of the Makefile variable POTFILES. sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'` POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"` # Compute POTFILES_DEPS as # $(foreach file, $(POTFILES), $(top_srcdir)/$(file)) POTFILES_DEPS= for file in $POTFILES; do POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file" done POMAKEFILEDEPS="" if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS. sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'` ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"` fi # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) # Compute PROPERTIESFILES # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties) # Compute CLASSFILES # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class) # Compute QMFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm) # Compute MSGFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg) # Compute RESOURCESDLLFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= PROPERTIESFILES= CLASSFILES= QMFILES= MSGFILES= RESOURCESDLLFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties" CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class" QMFILES="$QMFILES $srcdirpre$lang.qm" frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg" frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= JAVACATALOGS= QTCATALOGS= TCLCATALOGS= CSHARPCATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties" QTCATALOGS="$QTCATALOGS $lang.qm" frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg" frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll" done fi sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp" tab=`printf '\t'` if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` cat >> "$ac_file.tmp" <<EOF $frobbedlang.msg: $lang.po ${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \ ${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } EOF done fi if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` cat >> "$ac_file.tmp" <<EOF $frobbedlang/\$(DOMAIN).resources.dll: $lang.po ${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \ ${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } EOF done fi if test -n "$POMAKEFILEDEPS"; then cat >> "$ac_file.tmp" <<EOF Makefile: $POMAKEFILEDEPS EOF fi mv "$ac_file.tmp" "$ac_file" ]) dnl Initializes the accumulator used by AM_XGETTEXT_OPTION. AC_DEFUN([AM_XGETTEXT_OPTION_INIT], [ XGETTEXT_EXTRA_OPTIONS= ]) dnl Registers an option to be passed to xgettext in the po subdirectory. AC_DEFUN([AM_XGETTEXT_OPTION], [ AC_REQUIRE([AM_XGETTEXT_OPTION_INIT]) XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1" ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/strnlen.m4������������������������������������������������������������������0000664�0001750�0001750�00000001552�14670377450�016721� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# strnlen.m4 serial 14 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRNLEN], [ AC_REQUIRE([gl_STRING_H_DEFAULTS]) dnl Persuade glibc <string.h> to declare strnlen(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_CHECK_DECLS_ONCE([strnlen]) if test $ac_cv_have_decl_strnlen = no; then HAVE_DECL_STRNLEN=0 else m4_pushdef([AC_LIBOBJ], [:]) dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]). AC_FUNC_STRNLEN m4_popdef([AC_LIBOBJ]) if test $ac_cv_func_strnlen_working = no; then REPLACE_STRNLEN=1 fi fi ]) # Prerequisites of lib/strnlen.c. AC_DEFUN([gl_PREREQ_STRNLEN], [:]) ������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/setlocale.m4����������������������������������������������������������������0000664�0001750�0001750�00000005573�14670377450�017216� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# setlocale.m4 serial 7 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SETLOCALE], [ AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl Test whether we need to improve on the general working of setlocale. NEED_SETLOCALE_IMPROVED=0 case "$host_os" in dnl On native Windows systems, setlocale(category,NULL) does not look at dnl the environment variables LC_ALL, category, and LANG. mingw*) NEED_SETLOCALE_IMPROVED=1 ;; dnl On Cygwin 1.5.x, setlocale always succeeds but setlocale(LC_CTYPE,NULL) dnl is then still "C". cygwin*) case `uname -r` in 1.5.*) NEED_SETLOCALE_IMPROVED=1 ;; esac ;; dnl On Android 4.3, setlocale(category,"C") always fails. *) AC_CACHE_CHECK([whether setlocale supports the C locale], [gl_cv_func_setlocale_works], [AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> int main () { return setlocale (LC_ALL, "C") == NULL; }]])], [gl_cv_func_setlocale_works=yes], [gl_cv_func_setlocale_works=no], [case "$host_os" in # Guess no on Android. linux*-android*) gl_cv_func_setlocale_works="guessing no";; # Guess yes otherwise. *) gl_cv_func_setlocale_works="guessing yes";; esac ]) ]) case "$gl_cv_func_setlocale_works" in *yes) ;; *) NEED_SETLOCALE_IMPROVED=1 ;; esac ;; esac AC_DEFINE_UNQUOTED([NEED_SETLOCALE_IMPROVED], [$NEED_SETLOCALE_IMPROVED], [Define to 1 to enable general improvements of setlocale.]) dnl Test whether we need a multithread-safe setlocale(category,NULL). NEED_SETLOCALE_MTSAFE=0 if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then NEED_SETLOCALE_MTSAFE=1 fi AC_DEFINE_UNQUOTED([NEED_SETLOCALE_MTSAFE], [$NEED_SETLOCALE_MTSAFE], [Define to 1 to enable a multithread-safety fix of setlocale.]) if test $NEED_SETLOCALE_IMPROVED = 1 || test $NEED_SETLOCALE_MTSAFE = 1; then REPLACE_SETLOCALE=1 fi if test $NEED_SETLOCALE_MTSAFE = 1; then LIB_SETLOCALE="$LIB_SETLOCALE_NULL" else LIB_SETLOCALE= fi dnl LIB_SETLOCALE is expected to be '-pthread' or '-lpthread' on AIX with gcc dnl or xlc, and empty otherwise. AC_SUBST([LIB_SETLOCALE]) ]) # Prerequisites of lib/setlocale.c. AC_DEFUN([gl_PREREQ_SETLOCALE], [ dnl No need to check for CFLocaleCopyPreferredLanguages and dnl CFPreferencesCopyAppValue because lib/setlocale.c is not used on Mac OS X. dnl (The Mac OS X specific code is only used in libintl.) : ]) �������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/isatty.m4�������������������������������������������������������������������0000664�0001750�0001750�00000001242�14670377450�016545� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# isatty.m4 serial 3 dnl Copyright (C) 2012-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ISATTY], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl On native Windows, the system's isatty(), defined as an alias of _isatty() dnl in the "oldnames" library, returns true for the NUL device. case $host_os in mingw*) REPLACE_ISATTY=1 ;; esac ]) # Prerequisites of lib/isatty.c. AC_DEFUN([gl_PREREQ_ISATTY], [:]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sys_types_h.m4��������������������������������������������������������������0000664�0001750�0001750�00000004361�14670377450�017606� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sys_types_h.m4 serial 13 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_SYS_TYPES_H], [ AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) dnl Use sane struct stat types in OpenVMS 8.2 and later. AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.]) gl_NEXT_HEADERS([sys/types.h]) dnl Ensure the type pid_t gets defined. AC_REQUIRE([AC_TYPE_PID_T]) dnl Ensure the type mode_t gets defined. AC_REQUIRE([AC_TYPE_MODE_T]) dnl Whether to override the 'off_t' type. AC_REQUIRE([gl_TYPE_OFF_T]) dnl Whether to override the 'dev_t' and 'ino_t' types. m4_ifdef([gl_WINDOWS_STAT_INODES], [ AC_REQUIRE([gl_WINDOWS_STAT_INODES]) ], [ WINDOWS_STAT_INODES=0 ]) AC_SUBST([WINDOWS_STAT_INODES]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_SYS_TYPES_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS], [ ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) ]) AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], [ ]) # This works around a buggy version in autoconf <= 2.69. # See <https://lists.gnu.org/r/autoconf/2016-08/msg00014.html> # The 2.70 version isn't quoted properly, so override it too. m4_version_prereq([2.70.1], [], [ m4_undefine([AC_HEADER_MAJOR]) AC_DEFUN([AC_HEADER_MAJOR], [AC_CHECK_HEADERS_ONCE([sys/types.h]) AC_CHECK_HEADER([sys/mkdev.h], [AC_DEFINE([MAJOR_IN_MKDEV], [1], [Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.])]) if test $ac_cv_header_sys_mkdev_h = no; then AC_CHECK_HEADER([sys/sysmacros.h], [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], [Define to 1 if `major', `minor', and `makedev' are declared in <sysmacros.h>.])]) fi ])# AC_HEADER_MAJOR ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/threadlib.m4����������������������������������������������������������������0000664�0001750�0001750�00000057411�14670377450�017177� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# threadlib.m4 serial 31 dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_PREREQ([2.60]) dnl The general structure of the multithreading modules in gnulib is that we dnl have three set of modules: dnl dnl * POSIX API: dnl pthread, which combines dnl pthread-h dnl pthread-thread dnl pthread-once dnl pthread-mutex dnl pthread-rwlock dnl pthread-cond dnl pthread-tss dnl pthread-spin dnl sched_yield dnl dnl * ISO C API: dnl threads, which combines dnl threads-h dnl thrd dnl mtx dnl cnd dnl tss dnl dnl * Gnulib API, with an implementation that can be chosen at configure dnl time through the option --enable-threads=... dnl thread dnl lock dnl cond dnl tls dnl yield dnl dnl They are independent, except for the fact that dnl - the implementation of the ISO C API may use the POSIX (or some other dnl platform dependent) API, dnl - the implementation of the Gnulib API may use the POSIX or ISO C or dnl some other platform dependent API, depending on the --enable-threads dnl option. dnl dnl This file contains macros for all of these APIs! dnl ============================================================================ dnl Macros for all thread APIs AC_DEFUN([gl_ANYTHREADLIB_EARLY], [ AC_REQUIRE([AC_CANONICAL_HOST]) if test -z "$gl_anythreadlib_early_done"; then case "$host_os" in osf*) # On OSF/1, the compiler needs the flag -D_REENTRANT so that it # groks <pthread.h>. cc also understands the flag -pthread, but # we don't use it because 1. gcc-2.95 doesn't understand -pthread, # 2. putting a flag into CPPFLAGS that has an effect on the linker # causes the AC_LINK_IFELSE test below to succeed unexpectedly, # leading to wrong values of LIBTHREAD and LTLIBTHREAD. CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac # Some systems optimize for single-threaded programs by default, and # need special flags to disable these optimizations. For example, the # definition of 'errno' in <errno.h>. case "$host_os" in aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac gl_anythreadlib_early_done=done fi ]) dnl Checks whether the compiler and linker support weak declarations of symbols. AC_DEFUN([gl_WEAK_SYMBOLS], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether imported symbols can be declared weak], [gl_cv_have_weak], [gl_cv_have_weak=no dnl First, test whether the compiler accepts it syntactically. AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[extern void xyzzy (); #pragma weak xyzzy]], [[xyzzy();]])], [gl_cv_have_weak=maybe]) if test $gl_cv_have_weak = maybe; then dnl Second, test whether it actually works. On Cygwin 1.7.2, with dnl gcc 4.3, symbols declared weak always evaluate to the address 0. AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #pragma weak fputs int main () { return (fputs == NULL); }]])], [gl_cv_have_weak=yes], [gl_cv_have_weak=no], [dnl When cross-compiling, assume that only ELF platforms support dnl weak symbols. AC_EGREP_CPP([Extensible Linking Format], [#ifdef __ELF__ Extensible Linking Format #endif ], [gl_cv_have_weak="guessing yes"], [gl_cv_have_weak="guessing no"]) ]) fi dnl But when linking statically, weak symbols don't work. case " $LDFLAGS " in *" -static "*) gl_cv_have_weak=no ;; esac dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak dnl symbol and linking against a shared library that has a dependency on dnl the shared library that defines the symbol. case "$gl_cv_have_weak" in *yes) case "$host_os" in freebsd* | dragonfly* | midnightbsd*) : > conftest1.c $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 cat <<EOF > conftest2.c #include <pthread.h> #pragma weak pthread_mutexattr_gettype int main () { return (pthread_mutexattr_gettype != NULL); } EOF $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ || gl_cv_have_weak=no rm -f conftest1.c libempty.so conftest2.c conftest ;; esac ;; esac ]) case "$gl_cv_have_weak" in *yes) AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [Define to 1 if the compiler and linker support weak declarations of symbols.]) ;; esac ]) dnl ============================================================================ dnl Macros for the POSIX API dnl gl_PTHREADLIB dnl ------------- dnl Tests for the libraries needs for using the POSIX threads API. dnl Sets the variable LIBPTHREAD to the linker options for use in a Makefile. dnl Sets the variable LIBPMULTITHREAD, for programs that really need dnl multithread functionality. The difference between LIBPTHREAD and dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not. dnl Sets the variable LIB_SCHED_YIELD to the linker options needed to use the dnl sched_yield() function. dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for dnl multithread-safe programs. dnl Defines the C macro HAVE_PTHREAD_API if (at least parts of) the POSIX dnl threads API is available. dnl The guts of gl_PTHREADLIB. Needs to be expanded only once. AC_DEFUN([gl_PTHREADLIB_BODY], [ AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) if test -z "$gl_pthreadlib_body_done"; then gl_pthread_api=no LIBPTHREAD= LIBPMULTITHREAD= # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY. AC_CHECK_HEADER([pthread.h], [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) if test "$gl_have_pthread_h" = yes; then # Other possible tests: # -lpthreads (FSU threads, PCthreads) # -lgthreads # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist # in libc. IRIX 6.5 has the first one in both libc and libpthread, but # the second one only in libpthread, and lock.c needs it. # # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 # needs -pthread for some reason. See: # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html save_LIBS=$LIBS for gl_pthread in '' '-pthread'; do LIBS="$LIBS $gl_pthread" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <pthread.h> pthread_mutex_t m; pthread_mutexattr_t ma; ]], [[pthread_mutex_lock (&m); pthread_mutexattr_init (&ma);]])], [gl_pthread_api=yes LIBPTHREAD=$gl_pthread LIBPMULTITHREAD=$gl_pthread]) LIBS=$save_LIBS test $gl_pthread_api = yes && break done echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: LIBPTHREAD=$LIBPTHREAD" >&AS_MESSAGE_LOG_FD gl_pthread_in_glibc=no # On Linux with glibc >= 2.34, libc contains the fully functional # pthread functions. case "$host_os" in linux*) AC_EGREP_CPP([Lucky user], [#include <features.h> #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2) Lucky user #endif #endif ], [gl_pthread_in_glibc=yes], []) ;; esac echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD # Test for libpthread by looking for pthread_kill. (Not pthread_self, # since it is defined as a macro on OSF/1.) if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then # The program links fine without libpthread. But it may actually # need to link with libpthread in order to create multiple threads. AC_CHECK_LIB([pthread], [pthread_kill], [if test $gl_pthread_in_glibc = yes; then LIBPMULTITHREAD= else LIBPMULTITHREAD=-lpthread # On Solaris and HP-UX, most pthread functions exist also in libc. # Therefore pthread_in_use() needs to actually try to create a # thread: pthread_create from libc will fail, whereas # pthread_create will actually create a thread. # On Solaris 10 or newer, this test is no longer needed, because # libc contains the fully functional pthread functions. case "$host_os" in solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], [Define if the pthread_in_use() detection is hard.]) esac fi ]) elif test $gl_pthread_api != yes; then # Some library is needed. Try libpthread and libc_r. AC_CHECK_LIB([pthread], [pthread_kill], [gl_pthread_api=yes LIBPTHREAD=-lpthread LIBPMULTITHREAD=-lpthread]) if test $gl_pthread_api != yes; then # For FreeBSD 4. AC_CHECK_LIB([c_r], [pthread_kill], [gl_pthread_api=yes LIBPTHREAD=-lc_r LIBPMULTITHREAD=-lc_r]) fi fi echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD fi AC_MSG_CHECKING([whether POSIX threads API is available]) AC_MSG_RESULT([$gl_pthread_api]) AC_SUBST([LIBPTHREAD]) AC_SUBST([LIBPMULTITHREAD]) if test $gl_pthread_api = yes; then AC_DEFINE([HAVE_PTHREAD_API], [1], [Define if you have the <pthread.h> header and the POSIX threads API.]) fi dnl On some systems, sched_yield is in librt, rather than in libpthread. AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <sched.h>]], [[sched_yield ();]])], [LIB_SCHED_YIELD= ], [dnl Solaris 7...10 has sched_yield in librt, not in libpthread or libc. AC_CHECK_LIB([rt], [sched_yield], [LIB_SCHED_YIELD=-lrt], [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt. AC_CHECK_LIB([posix4], [sched_yield], [LIB_SCHED_YIELD=-lposix4])]) ]) AC_SUBST([LIB_SCHED_YIELD]) gl_pthreadlib_body_done=done fi ]) AC_DEFUN([gl_PTHREADLIB], [ AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) gl_PTHREADLIB_BODY ]) dnl ============================================================================ dnl Macros for the ISO C API dnl gl_STDTHREADLIB dnl --------------- dnl Tests for the libraries needs for using the ISO C threads API. dnl Sets the variable LIBSTDTHREAD to the linker options for use in a Makefile. dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for dnl multithread-safe programs. dnl Defines the C macro HAVE_THREADS_H if (at least parts of) the ISO C threads dnl API is available. dnl The guts of gl_STDTHREADLIB. Needs to be expanded only once. AC_DEFUN([gl_STDTHREADLIB_BODY], [ AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) AC_REQUIRE([AC_CANONICAL_HOST]) if test -z "$gl_stdthreadlib_body_done"; then AC_CHECK_HEADERS_ONCE([threads.h]) case "$host_os" in mingw*) LIBSTDTHREAD= ;; *) gl_PTHREADLIB_BODY if test $ac_cv_header_threads_h = yes; then dnl glibc >= 2.29 has thrd_create in libpthread. dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in dnl libc. AC_CHECK_FUNCS([thrd_create]) if test $ac_cv_func_thrd_create = yes; then LIBSTDTHREAD= else AC_CHECK_LIB([stdthreads], [thrd_create], [ LIBSTDTHREAD='-lstdthreads -lpthread' ], [ dnl Guess that thrd_create is in libpthread. LIBSTDTHREAD="$LIBPMULTITHREAD" ]) fi else dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" fi ;; esac AC_SUBST([LIBSTDTHREAD]) AC_MSG_CHECKING([whether ISO C threads API is available]) AC_MSG_RESULT([$ac_cv_header_threads_h]) gl_stdthreadlib_body_done=done fi ]) AC_DEFUN([gl_STDTHREADLIB], [ AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) gl_STDTHREADLIB_BODY ]) dnl ============================================================================ dnl Macros for the Gnulib API dnl gl_THREADLIB dnl ------------ dnl Tests for a multithreading library to be used. dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the dnl default is 'no', otherwise it is system dependent. In both cases, the user dnl can change the choice through the options --enable-threads=choice or dnl --disable-threads. dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, dnl USE_ISOC_AND_POSIX_THREADS, USE_WINDOWS_THREADS. dnl The choice --enable-threads=isoc+posix is available only on platforms that dnl have both the ISO C and the POSIX threads APIs. It has the effect of using dnl the ISO C API for most things and the POSIX API only for creating and dnl controlling threads (because there is no equivalent to pthread_atfork in dnl the ISO C API). dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with dnl libtool). dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for dnl programs that really need multithread functionality. The difference dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak dnl symbols, typically LIBTHREAD is empty whereas LIBMULTITHREAD is not. dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for dnl multithread-safe programs. dnl Since support for GNU pth was removed, $LTLIBTHREAD and $LIBTHREAD have the dnl same value, and similarly $LTLIBMULTITHREAD and $LIBMULTITHREAD have the dnl same value. Only system libraries are needed. AC_DEFUN([gl_THREADLIB_EARLY], [ AC_REQUIRE([gl_THREADLIB_EARLY_BODY]) ]) dnl The guts of gl_THREADLIB_EARLY. Needs to be expanded only once. AC_DEFUN([gl_THREADLIB_EARLY_BODY], [ dnl Ordering constraints: This macro modifies CPPFLAGS in a way that dnl influences the result of the autoconf tests that test for *_unlocked dnl declarations, on AIX 5 at least. Therefore it must come early. AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl AC_BEFORE([$0], [gl_ARGP])dnl AC_REQUIRE([AC_CANONICAL_HOST]) dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl Check for multithreading. m4_ifdef([gl_THREADLIB_DEFAULT_NO], [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=]) AC_ARG_ENABLE([threads], AS_HELP_STRING([--enable-threads={isoc|posix|isoc+posix|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ AS_HELP_STRING([--disable-threads], [build without multithread safety])]), [gl_use_threads=$enableval], [if test -n "$gl_use_threads_default"; then gl_use_threads="$gl_use_threads_default" else changequote(,)dnl case "$host_os" in dnl Disable multithreading by default on OSF/1, because it interferes dnl with fork()/exec(): When msgexec is linked with -lpthread, its dnl child process gets an endless segmentation fault inside execvp(). osf*) gl_use_threads=no ;; dnl Disable multithreading by default on Cygwin 1.5.x, because it has dnl bugs that lead to endless loops or crashes. See dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>. cygwin*) case `uname -r` in 1.[0-5].*) gl_use_threads=no ;; *) gl_use_threads=yes ;; esac ;; dnl Obey gl_AVOID_WINPTHREAD on mingw. mingw*) case "$gl_use_winpthreads_default" in yes) gl_use_threads=posix ;; no) gl_use_threads=windows ;; *) gl_use_threads=yes ;; esac ;; *) gl_use_threads=yes ;; esac changequote([,])dnl fi ]) if test "$gl_use_threads" = yes \ || test "$gl_use_threads" = isoc \ || test "$gl_use_threads" = posix \ || test "$gl_use_threads" = isoc+posix; then # For using <threads.h> or <pthread.h>: gl_ANYTHREADLIB_EARLY fi ]) dnl The guts of gl_THREADLIB. Needs to be expanded only once. AC_DEFUN([gl_THREADLIB_BODY], [ AC_REQUIRE([gl_THREADLIB_EARLY_BODY]) gl_threads_api=none LIBTHREAD= LTLIBTHREAD= LIBMULTITHREAD= LTLIBMULTITHREAD= if test "$gl_use_threads" != no; then dnl Check whether the compiler and linker support weak declarations. gl_WEAK_SYMBOLS if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then dnl If we use weak symbols to implement pthread_in_use / pth_in_use / dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create dnl facility is in use. AC_CHECK_HEADERS_ONCE([threads.h]) : fi if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then AC_CHECK_HEADERS_ONCE([threads.h]) gl_have_isoc_threads="$ac_cv_header_threads_h" fi if test "$gl_use_threads" = yes \ || test "$gl_use_threads" = posix \ || test "$gl_use_threads" = isoc+posix; then gl_PTHREADLIB_BODY LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD if test $gl_pthread_api = yes; then if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then gl_threads_api='isoc+posix' AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) LIBTHREAD= LTLIBTHREAD= else gl_threads_api=posix AC_DEFINE([USE_POSIX_THREADS], [1], [Define if the POSIX multithreading library can be used.]) if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], [Define if references to the POSIX multithreading library are satisfied by libc.]) else if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], [Define if references to the POSIX multithreading library should be made weak.]) LIBTHREAD= LTLIBTHREAD= else case "$host_os" in freebsd* | dragonfly* | midnightbsd*) if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() dnl etc. will succeed, we need a runtime test. AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], [Define if the pthread_in_use() detection is hard.]) fi ;; esac fi fi fi fi fi if test $gl_threads_api = none; then if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then gl_STDTHREADLIB_BODY LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD gl_threads_api=isoc AC_DEFINE([USE_ISOC_THREADS], [1], [Define if the ISO C multithreading library can be used.]) fi fi if test $gl_threads_api = none; then case "$gl_use_threads" in yes | windows | win32) # The 'win32' is for backward compatibility. if { case "$host_os" in mingw*) true;; *) false;; esac }; then gl_threads_api=windows AC_DEFINE([USE_WINDOWS_THREADS], [1], [Define if the native Windows multithreading API can be used.]) fi ;; esac fi fi AC_MSG_CHECKING([for multithread API to use]) AC_MSG_RESULT([$gl_threads_api]) AC_SUBST([LIBTHREAD]) AC_SUBST([LTLIBTHREAD]) AC_SUBST([LIBMULTITHREAD]) AC_SUBST([LTLIBMULTITHREAD]) ]) AC_DEFUN([gl_THREADLIB], [ AC_REQUIRE([gl_THREADLIB_EARLY]) AC_REQUIRE([gl_THREADLIB_BODY]) ]) dnl gl_DISABLE_THREADS dnl ------------------ dnl Sets the gl_THREADLIB default so that threads are not used by default. dnl The user can still override it at installation time, by using the dnl configure option '--enable-threads'. AC_DEFUN([gl_DISABLE_THREADS], [ m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) ]) dnl gl_AVOID_WINPTHREAD dnl ------------------- dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. dnl The user can still override it at installation time, by using the dnl configure option '--enable-threads'. AC_DEFUN([gl_AVOID_WINPTHREAD], [ m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no]) ]) dnl ============================================================================ dnl Survey of platforms: dnl dnl Platform Available Compiler Supports test-lock dnl flavours option weak result dnl --------------- --------- --------- -------- --------- dnl Linux 2.4/glibc posix -lpthread Y OK dnl dnl Linux/glibc 2.34 posix Y OK dnl dnl GNU Hurd/glibc posix -lpthread Y OK dnl dnl Ubuntu 14.04 posix -pthread Y OK dnl dnl FreeBSD 5.3 posix -lc_r Y dnl posix -lkse ? Y dnl posix -lpthread ? Y dnl posix -lthr Y dnl dnl FreeBSD 5.2 posix -lc_r Y dnl posix -lkse Y dnl posix -lthr Y dnl dnl FreeBSD 4.0,4.10 posix -lc_r Y OK dnl dnl NetBSD 1.6 -- dnl dnl OpenBSD 3.4 posix -lpthread Y OK dnl dnl Mac OS X 10.[123] posix -lpthread Y OK dnl dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK dnl dnl HP-UX 11 posix -lpthread N (cc) OK dnl Y (gcc) dnl dnl IRIX 6.5 posix -lpthread Y 0.5 dnl dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK dnl dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK dnl -lpthread (gcc) Y dnl dnl Cygwin posix -lpthread Y OK dnl dnl Mingw windows N OK dnl dnl BeOS 5 -- dnl dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is dnl turned off: dnl OK if all three tests terminate OK, dnl 0.5 if the first test terminates OK but the second one loops endlessly, dnl 0.0 if the first test already loops endlessly. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/wcrtomb.m4������������������������������������������������������������������0000664�0001750�0001750�00000011035�14670377450�016706� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# wcrtomb.m4 serial 17 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_WCRTOMB], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN AC_CHECK_FUNCS_ONCE([wcrtomb]) if test $ac_cv_func_wcrtomb = no; then HAVE_WCRTOMB=0 AC_CHECK_DECLS([wcrtomb],,, [[ #include <wchar.h> ]]) if test $ac_cv_have_decl_wcrtomb = yes; then dnl On Minix 3.1.8, the system's <wchar.h> declares wcrtomb() although dnl it does not have the function. Avoid a collision with gnulib's dnl replacement. REPLACE_WCRTOMB=1 fi else dnl We don't actually need to override wcrtomb when redefining the semantics dnl of the mbstate_t type. Tested on 32-bit AIX. dnl if test $REPLACE_MBSTATE_T = 1; then dnl REPLACE_WCRTOMB=1 dnl fi if test $REPLACE_WCRTOMB = 0; then dnl On Android 4.3, wcrtomb produces wrong characters in the C locale. dnl On AIX 4.3, OSF/1 5.1 and Solaris <= 11.3, wcrtomb (NULL, 0, NULL) dnl sometimes returns 0 instead of 1. AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether wcrtomb works in the C locale], [gl_cv_func_wcrtomb_works], [AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <string.h> #include <stdlib.h> #include <wchar.h> int main () { mbstate_t state; char out[64]; int count; memset (&state, 0, sizeof (state)); out[0] = 'x'; count = wcrtomb (out, L'a', &state); return !(count == 1 && out[0] == 'a'); }]])], [gl_cv_func_wcrtomb_works=yes], [gl_cv_func_wcrtomb_works=no], [case "$host_os" in # Guess no on Android. linux*-android*) gl_cv_func_wcrtomb_works="guessing no";; # Guess yes otherwise. *) gl_cv_func_wcrtomb_works="guessing yes";; esac ]) ]) case "$gl_cv_func_wcrtomb_works" in *yes) ;; *) AC_DEFINE([WCRTOMB_C_LOCALE_BUG], [1], [Define if the wcrtomb function does not work in the C locale.]) REPLACE_WCRTOMB=1 ;; esac fi if test $REPLACE_WCRTOMB = 0; then AC_CACHE_CHECK([whether wcrtomb return value is correct], [gl_cv_func_wcrtomb_retval], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on AIX 4, OSF/1, Solaris, native Windows. aix4* | osf* | solaris* | mingw*) gl_cv_func_wcrtomb_retval="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_wcrtomb_retval="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> #include <stdlib.h> int main () { int result = 0; if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 1; } if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 2; { wchar_t wc = (wchar_t) 0xBADFACE; if (mbtowc (&wc, "\303\274", 2) == 2) if (wcrtomb (NULL, wc, NULL) != 1) result |= 2; } } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 4; } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 8; } return result; }]])], [gl_cv_func_wcrtomb_retval=yes], [gl_cv_func_wcrtomb_retval=no], [:]) fi ]) case "$gl_cv_func_wcrtomb_retval" in *yes) ;; *) AC_DEFINE([WCRTOMB_RETVAL_BUG], [1], [Define if the wcrtomb function has an incorrect return value.]) REPLACE_WCRTOMB=1 ;; esac fi fi ]) # Prerequisites of lib/wcrtomb.c. AC_DEFUN([gl_PREREQ_WCRTOMB], [ : ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/netinet_in_h.m4�������������������������������������������������������������0000664�0001750�0001750�00000002075�14670377450�017700� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# netinet_in_h.m4 serial 5 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_HEADER_NETINET_IN], [ AC_CACHE_CHECK([whether <netinet/in.h> is self-contained], [gl_cv_header_netinet_in_h_selfcontained], [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[]])], [gl_cv_header_netinet_in_h_selfcontained=yes], [gl_cv_header_netinet_in_h_selfcontained=no]) ]) if test $gl_cv_header_netinet_in_h_selfcontained = yes; then NETINET_IN_H='' else NETINET_IN_H='netinet/in.h' AC_CHECK_HEADERS([netinet/in.h]) gl_CHECK_NEXT_HEADERS([netinet/in.h]) if test $ac_cv_header_netinet_in_h = yes; then HAVE_NETINET_IN_H=1 else HAVE_NETINET_IN_H=0 fi AC_SUBST([HAVE_NETINET_IN_H]) fi AC_SUBST([NETINET_IN_H]) AM_CONDITIONAL([GL_GENERATE_NETINET_IN_H], [test -n "$NETINET_IN_H"]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/ioctl.m4��������������������������������������������������������������������0000664�0001750�0001750�00000003043�14670377450�016343� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# ioctl.m4 serial 6 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_IOCTL], [ AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) AC_REQUIRE([gl_SYS_SOCKET_H]) HAVE_IOCTL=1 if test "$ac_cv_header_winsock2_h" = yes; then dnl Even if the 'socket' module is not used here, another part of the dnl application may use it and pass file descriptors that refer to dnl sockets to the ioctl() function. So enable the support for sockets. HAVE_IOCTL=0 else AC_CHECK_FUNCS([ioctl]) dnl On glibc systems, the second parameter is 'unsigned long int request', dnl not 'int request'. We cannot simply cast the function pointer, but dnl instead need a wrapper. AC_CACHE_CHECK([for ioctl with POSIX signature], [gl_cv_func_ioctl_posix_signature], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/ioctl.h> /* On some platforms, ioctl() is declared in <unistd.h>. */ #include <unistd.h> ]], [[extern #ifdef __cplusplus "C" #endif int ioctl (int, int, ...); ]]) ], [gl_cv_func_ioctl_posix_signature=yes], [gl_cv_func_ioctl_posix_signature=no]) ]) if test $gl_cv_func_ioctl_posix_signature != yes; then REPLACE_IOCTL=1 fi fi ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/nls.m4����������������������������������������������������������������������0000664�0001750�0001750�00000002315�14670377450�016026� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# nls.m4 serial 5 (gettext-0.18) dnl Copyright (C) 1995-2003, 2005-2006, 2008-2013 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. AC_PREREQ([2.50]) AC_DEFUN([AM_NLS], [ AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE([nls], [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT([$USE_NLS]) AC_SUBST([USE_NLS]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/pthread-thread.m4�����������������������������������������������������������0000664�0001750�0001750�00000004332�14670377450�020127� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pthread-thread.m4 serial 2 dnl Copyright (C) 2019-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_PTHREAD_THREAD], [ AC_REQUIRE([gl_PTHREAD_H]) AC_REQUIRE([AC_CANONICAL_HOST]) if { case "$host_os" in mingw*) true;; *) false;; esac; } \ && test $gl_threads_api = windows; then dnl Choose function names that don't conflict with the mingw-w64 winpthreads dnl library. REPLACE_PTHREAD_CREATE=1 REPLACE_PTHREAD_ATTR_INIT=1 REPLACE_PTHREAD_ATTR_GETDETACHSTATE=1 REPLACE_PTHREAD_ATTR_SETDETACHSTATE=1 REPLACE_PTHREAD_ATTR_DESTROY=1 REPLACE_PTHREAD_SELF=1 REPLACE_PTHREAD_EQUAL=1 REPLACE_PTHREAD_DETACH=1 REPLACE_PTHREAD_JOIN=1 REPLACE_PTHREAD_EXIT=1 else if test $HAVE_PTHREAD_H = 0; then HAVE_PTHREAD_CREATE=0 HAVE_PTHREAD_ATTR_INIT=0 HAVE_PTHREAD_ATTR_GETDETACHSTATE=0 HAVE_PTHREAD_ATTR_SETDETACHSTATE=0 HAVE_PTHREAD_ATTR_DESTROY=0 HAVE_PTHREAD_SELF=0 HAVE_PTHREAD_EQUAL=0 HAVE_PTHREAD_DETACH=0 HAVE_PTHREAD_JOIN=0 HAVE_PTHREAD_EXIT=0 else dnl On HP-UX 11.11, pthread_create() and pthread_attr_init() are only dnl defined as inline functions. AC_CACHE_CHECK([whether pthread_create exists as a global function], [gl_cv_func_pthread_create], [saved_LIBS="$LIBS" LIBS="$LIBS $LIBPMULTITHREAD" AC_LINK_IFELSE( [AC_LANG_SOURCE( [[extern #ifdef __cplusplus "C" #endif int pthread_create (void); int main () { return pthread_create (); } ]])], [gl_cv_func_pthread_create=yes], [gl_cv_func_pthread_create=no]) LIBS="$saved_LIBS" ]) if test $gl_cv_func_pthread_create = no; then REPLACE_PTHREAD_CREATE=1 REPLACE_PTHREAD_ATTR_INIT=1 AC_DEFINE([PTHREAD_CREATE_IS_INLINE], [1], [Define if pthread_create is an inline function.]) fi fi fi ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/version-etc.m4��������������������������������������������������������������0000664�0001750�0001750�00000002226�14670377450�017471� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# version-etc.m4 serial 1 # Copyright (C) 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. dnl $1 - configure flag and define name dnl $2 - human readable description m4_define([gl_VERSION_ETC_FLAG], [dnl AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1], [$2])], [dnl case $withval in yes|no) ;; *) AC_DEFINE_UNQUOTED(AS_TR_CPP([PACKAGE_$1]), ["$withval"], [$2]) ;; esac ]) ]) AC_DEFUN([gl_VERSION_ETC], [dnl gl_VERSION_ETC_FLAG([packager], [String identifying the packager of this software]) gl_VERSION_ETC_FLAG([packager-version], [Packager-specific version information]) gl_VERSION_ETC_FLAG([packager-bug-reports], [Packager info for bug reports (URL/e-mail/...)]) if test "X$with_packager" = "X" && \ test "X$with_packager_version$with_packager_bug_reports" != "X" then AC_MSG_ERROR([The --with-packager-{bug-reports,version} options require --with-packager]) fi ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sys_uio_h.m4����������������������������������������������������������������0000664�0001750�0001750�00000003102�14670377450�017226� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sys_uio_h.m4 serial 3 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_SYS_UIO_H], [ AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) dnl <sys/uio.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([sys/uio.h]) if test $ac_cv_header_sys_uio_h = yes; then HAVE_SYS_UIO_H=1 else HAVE_SYS_UIO_H=0 fi AC_SUBST([HAVE_SYS_UIO_H]) ]) # gl_SYS_UIO_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_SYS_UIO_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_SYS_UIO_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_UIO_H_MODULE_INDICATOR_DEFAULTS], [ ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_UIO_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) ]) AC_DEFUN([gl_SYS_UIO_H_DEFAULTS], [ ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fnmatch_h.m4����������������������������������������������������������������0000664�0001750�0001750�00000006027�14670377450�017165� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# fnmatch_h.m4 serial 7 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN_ONCE([gl_FNMATCH_H], [ AC_REQUIRE([gl_FNMATCH_H_DEFAULTS]) m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) AC_CHECK_HEADERS_ONCE([fnmatch.h]) gl_CHECK_NEXT_HEADERS([fnmatch.h]) dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc. dnl This is only needed if gl_fnmatch_required = GNU. It would be possible dnl to avoid this dependency for gl_FUNC_FNMATCH_POSIX by putting dnl gl_FUNC_FNMATCH_GNU into a separate .m4 file. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) if test $ac_cv_header_fnmatch_h = yes; then HAVE_FNMATCH_H=1 else HAVE_FNMATCH_H=0 fi AC_SUBST([HAVE_FNMATCH_H]) m4_ifdef([gl_POSIXCHECK], [FNMATCH_H=fnmatch.h], [FNMATCH_H='' if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE. FNMATCH_H=fnmatch.h else if test $ac_cv_header_fnmatch_h != yes; then dnl Provide a substitute <fnmatch.h> file. FNMATCH_H=fnmatch.h fi fi ]) AC_SUBST([FNMATCH_H]) AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <fnmatch.h> ]], [fnmatch]) ]) dnl Unconditionally enables the replacement of <fnmatch.h>. AC_DEFUN([gl_REPLACE_FNMATCH_H], [ gl_FNMATCH_H_REQUIRE_DEFAULTS FNMATCH_H='fnmatch.h' AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"]) ]) # gl_FNMATCH_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_FNMATCH_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_FNMATCH_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_FNMATCH_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_FNMATCH_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FNMATCH]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_FNMATCH_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_FNMATCH_H_DEFAULTS]) ]) AC_DEFUN([gl_FNMATCH_H_DEFAULTS], [ dnl Assume POSIX behavior unless another module says otherwise. HAVE_FNMATCH=1; AC_SUBST([HAVE_FNMATCH]) REPLACE_FNMATCH=0; AC_SUBST([REPLACE_FNMATCH]) ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/chdir-long.m4���������������������������������������������������������������0000664�0001750�0001750�00000002054�14670377450�017260� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#serial 17 # Use Gnulib's robust chdir function. # It can handle arbitrarily long directory names, which means # that when it is given the name of an existing directory, it # never fails with ENAMETOOLONG. # Arrange to compile chdir-long.c only on systems that define PATH_MAX. dnl Copyright (C) 2004-2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Written by Jim Meyering. AC_DEFUN([gl_FUNC_CHDIR_LONG], [ AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ]) AC_CACHE_CHECK([whether this system supports file names of any length], [gl_cv_have_unlimited_file_name_length], [AC_EGREP_CPP([have_arbitrary_file_name_length_limit], gl_PATHMAX_SNIPPET[ #ifdef PATH_MAX have_arbitrary_file_name_length_limit #endif], [gl_cv_have_unlimited_file_name_length=no], [gl_cv_have_unlimited_file_name_length=yes])]) ]) AC_DEFUN([gl_PREREQ_CHDIR_LONG], [:]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sigaltstack.m4��������������������������������������������������������������0000664�0001750�0001750�00000014141�14670377450�017543� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sigaltstack.m4 serial 15 dnl Copyright (C) 2002-2021 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl Written by Bruno Haible and Eric Blake. AC_DEFUN([SV_SIGALTSTACK], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([sigaltstack setrlimit]) if test "$ac_cv_func_sigaltstack" = yes; then AC_CHECK_TYPE([stack_t], , [AC_DEFINE(stack_t, [struct sigaltstack], [Define to 'struct sigaltstack' if that's the type of the argument to sigaltstack]) ], [ #include <signal.h> #if HAVE_SYS_SIGNAL_H # include <sys/signal.h> #endif ]) fi AC_CACHE_CHECK([for working sigaltstack], [sv_cv_sigaltstack], [ if test "$ac_cv_func_sigaltstack" = yes; then case "$host_os" in macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*) # On MacOS X 10.2 or newer, just assume that if it compiles, it will # work. If we were to perform the real test, 1 Crash Report dialog # window would pop up. AC_LINK_IFELSE([ AC_LANG_PROGRAM([[#include <signal.h>]], [[int x = SA_ONSTACK; stack_t ss; sigaltstack ((stack_t*)0, &ss);]])], [sv_cv_sigaltstack="guessing yes"], [sv_cv_sigaltstack=no]) ;; *) AC_RUN_IFELSE([ AC_LANG_SOURCE([[ #include <stdlib.h> #include <signal.h> #if HAVE_SYS_SIGNAL_H # include <sys/signal.h> #endif #if HAVE_SETRLIMIT # include <sys/types.h> # include <sys/time.h> # include <sys/resource.h> #endif void stackoverflow_handler (int sig) { /* If we get here, the stack overflow was caught. */ exit (0); } volatile int * recurse_1 (volatile int n, volatile int *p) { if (n >= 0) *recurse_1 (n + 1, p) += n; return p; } int recurse (volatile int n) { int sum = 0; return *recurse_1 (n, &sum); } char mystack[2 * (1 << 24)]; int main () { stack_t altstack; struct sigaction action; #if defined HAVE_SETRLIMIT && defined RLIMIT_STACK /* Before starting the endless recursion, try to be friendly to the user's machine. On some Linux 2.2.x systems, there is no stack limit for user processes at all. We don't want to kill such systems. */ struct rlimit rl; rl.rlim_cur = rl.rlim_max = 0x100000; /* 1 MB */ setrlimit (RLIMIT_STACK, &rl); #endif /* Install the alternate stack. Use the midpoint of mystack, to guard against a buggy interpretation of ss_sp on IRIX. */ #ifdef SIGSTKSZ if (sizeof mystack / 2 < SIGSTKSZ) exit (3); #endif altstack.ss_sp = mystack + sizeof mystack / 2; altstack.ss_size = sizeof mystack / 2; altstack.ss_flags = 0; /* no SS_DISABLE */ if (sigaltstack (&altstack, NULL) < 0) exit (1); /* Install the SIGSEGV handler. */ sigemptyset (&action.sa_mask); action.sa_handler = &stackoverflow_handler; action.sa_flags = SA_ONSTACK; sigaction (SIGSEGV, &action, (struct sigaction *) NULL); sigaction (SIGBUS, &action, (struct sigaction *) NULL); /* Provoke a stack overflow. */ recurse (0); exit (2); }]])], [sv_cv_sigaltstack=yes], [sv_cv_sigaltstack=no], [ dnl FIXME: Put in some more known values here. case "$host_os" in *) AC_LINK_IFELSE([ AC_LANG_PROGRAM([[#include <signal.h>]], [[int x = SA_ONSTACK; stack_t ss; sigaltstack ((stack_t*)0, &ss);]])], [sv_cv_sigaltstack="guessing yes"], [sv_cv_sigaltstack=no]) ;; esac ]) ;; esac else sv_cv_sigaltstack=no fi ]) if test "$sv_cv_sigaltstack" != no; then AC_DEFINE([HAVE_WORKING_SIGALTSTACK], [1], [Define if you have the sigaltstack() function and it works.]) dnl The ss_sp field of a stack_t is, according to POSIX, the lowest address dnl of the memory block designated as an alternate stack. But IRIX 5.3 dnl interprets it as the highest address! AC_CACHE_CHECK([for correct stack_t interpretation], [sv_cv_sigaltstack_low_base], [ AC_RUN_IFELSE([ AC_LANG_SOURCE([[ #include <stdlib.h> #include <signal.h> #if HAVE_SYS_SIGNAL_H # include <sys/signal.h> #endif volatile char *stack_lower_bound; volatile char *stack_upper_bound; static void check_stack_location (volatile char *addr) { if (addr >= stack_lower_bound && addr <= stack_upper_bound) exit (0); else exit (1); } static void stackoverflow_handler (int sig) { char dummy; check_stack_location (&dummy); } char mystack[2 * (1 << 24)]; int main () { stack_t altstack; struct sigaction action; /* Install the alternate stack. */ altstack.ss_sp = mystack + sizeof mystack / 2; altstack.ss_size = sizeof mystack / 2; stack_lower_bound = (char *) altstack.ss_sp; stack_upper_bound = (char *) altstack.ss_sp + altstack.ss_size - 1; altstack.ss_flags = 0; /* no SS_DISABLE */ if (sigaltstack (&altstack, NULL) < 0) exit (2); /* Install the SIGSEGV handler. */ sigemptyset (&action.sa_mask); action.sa_handler = &stackoverflow_handler; action.sa_flags = SA_ONSTACK; if (sigaction (SIGSEGV, &action, (struct sigaction *) NULL) < 0) exit(3); /* Provoke a SIGSEGV. */ raise (SIGSEGV); exit (3); }]])], [sv_cv_sigaltstack_low_base=yes], [sv_cv_sigaltstack_low_base=no], [ dnl FIXME: Put in some more known values here. case "$host_os" in irix5*) sv_cv_sigaltstack_low_base="no" ;; *) sv_cv_sigaltstack_low_base="guessing yes" ;; esac ]) ]) if test "$sv_cv_sigaltstack_low_base" = no; then AC_DEFINE([SIGALTSTACK_SS_REVERSED], [1], [Define if sigaltstack() interprets the stack_t.ss_sp field incorrectly, as the highest address of the alternate stack range rather than as the lowest address.]) fi fi ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/alloca.m4�������������������������������������������������������������������0000664�0001750�0001750�00000007400�14670377450�016465� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# alloca.m4 serial 20 dnl Copyright (C) 2002-2004, 2006-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ALLOCA], [ AC_REQUIRE([AC_FUNC_ALLOCA]) if test $ac_cv_func_alloca_works = no; then gl_PREREQ_ALLOCA fi # Define an additional variable used in the Makefile substitution. if test $ac_cv_working_alloca_h = yes; then AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [ AC_EGREP_CPP([Need own alloca], [ #if defined __GNUC__ || defined _AIX || defined _MSC_VER Need own alloca #endif ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no]) ]) if test $gl_cv_rpl_alloca = yes; then dnl OK, alloca can be implemented through a compiler built-in. AC_DEFINE([HAVE_ALLOCA], [1], [Define to 1 if you have 'alloca' after including <alloca.h>, a header that may be supplied by this distribution.]) ALLOCA_H=alloca.h else dnl alloca exists as a library function, i.e. it is slow and probably dnl a memory leak. Don't define HAVE_ALLOCA in this case. ALLOCA_H= fi else ALLOCA_H=alloca.h fi AC_SUBST([ALLOCA_H]) AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"]) if test $ac_cv_working_alloca_h = yes; then HAVE_ALLOCA_H=1 else HAVE_ALLOCA_H=0 fi AC_SUBST([HAVE_ALLOCA_H]) ]) # Prerequisites of lib/alloca.c. # STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. AC_DEFUN([gl_PREREQ_ALLOCA], [:]) m4_version_prereq([2.70], [], [ # This works around a bug in autoconf <= 2.68 and has simplifications # from 2.70. See: # https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html # https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497 # https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=15edf7fd8094fd14a89d9891dd72a9624762597a # _AC_LIBOBJ_ALLOCA # ----------------- # Set up the LIBOBJ replacement of 'alloca'. Well, not exactly # AC_LIBOBJ since we actually set the output variable 'ALLOCA'. # Nevertheless, for Automake, AC_LIBSOURCES it. m4_define([_AC_LIBOBJ_ALLOCA], [# The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. AC_LIBSOURCES(alloca.c) AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.]) AC_CACHE_CHECK([stack direction for C alloca], [ac_cv_c_stack_direction], [AC_RUN_IFELSE([AC_LANG_SOURCE( [AC_INCLUDES_DEFAULT int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char **argv) { return find_stack_direction (0, argc + !argv + 20) < 0; }])], [ac_cv_c_stack_direction=1], [ac_cv_c_stack_direction=-1], [ac_cv_c_stack_direction=0])]) AH_VERBATIM([STACK_DIRECTION], [/* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION])dnl AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) ])# _AC_LIBOBJ_ALLOCA ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/dup.m4����������������������������������������������������������������������0000664�0001750�0001750�00000003173�14670377450�016025� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# dup.m4 serial 7 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_DUP], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles m4_ifdef([gl_MSVC_INVAL], [ AC_REQUIRE([gl_MSVC_INVAL]) if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then REPLACE_DUP=1 fi ]) dnl Replace dup() for supporting the gnulib-defined fchdir() function, dnl to keep fchdir's bookkeeping up-to-date. m4_ifdef([gl_FUNC_FCHDIR], [ gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then REPLACE_DUP=1 fi ]) AC_CACHE_CHECK([whether dup works], [gl_cv_func_dup_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[#include <unistd.h> #include <fcntl.h> #include <errno.h> ]GL_MDA_DEFINES], [[/* On OS/2 kLIBC, dup does not work on a directory fd. */ int fd = open (".", O_RDONLY); return fd < 0 ? 1 : dup (fd) < 0 ? 2 : 0; ]]) ], [gl_cv_func_dup_works=yes], [gl_cv_func_dup_works=no], [case "$host_os" in # Guess no on native Windows. mingw*) gl_cv_func_dup_works="guessing no" ;; *) gl_cv_func_dup_works="guessing yes" ;; esac ]) ]) case "$gl_cv_func_dup_works" in *yes) ;; *) REPLACE_DUP=1 ;; esac ]) # Prerequisites of lib/dup.c. AC_DEFUN([gl_PREREQ_DUP], [:]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/stdint_h.m4�����������������������������������������������������������������0000664�0001750�0001750�00000001743�14670377450�017052� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# stdint_h.m4 serial 9 dnl Copyright (C) 1997-2004, 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, # doesn't clash with <sys/types.h>, and declares uintmax_t. AC_DEFUN([gl_AC_HEADER_STDINT_H], [ AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> #include <stdint.h>]], [[uintmax_t i = (uintmax_t) -1; return !i;]])], [gl_cv_header_stdint_h=yes], [gl_cv_header_stdint_h=no])]) if test $gl_cv_header_stdint_h = yes; then AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1], [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. ]) fi ]) �����������������������������kbuild-3608/src/grep/m4/locale-ja.m4����������������������������������������������������������������0000664�0001750�0001750�00000013167�14670377450�017070� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# locale-ja.m4 serial 15 dnl Copyright (C) 2003, 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Determine the name of a japanese locale with EUC-JP encoding. AC_DEFUN([gt_LOCALE_JA], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [ AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif #include <stdlib.h> #include <string.h> struct tm t; char buf[16]; int main () { /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ #if defined __BEOS__ || defined __HAIKU__ return 1; #else /* Check whether the given locale name is recognized by the system. */ # if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE category of the locale to "C". */ if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; # else if (setlocale (LC_ALL, "") == NULL) return 1; # endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } # endif # ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales on Cygwin 1.5.x. */ if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ { const char *p; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) return 1; } return 0; #endif } ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. mingw*) # Note that on native Windows, the Japanese locale is # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we # cannot use it here. gt_cv_locale_ja=none ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. # Test for the AIX locale name. if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP else # Test for the locale name with explicit encoding suffix. if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC-JP else # Test for the HP-UX, OSF/1, NetBSD locale name. if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.eucJP else # Test for the IRIX, FreeBSD locale name. if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC else # Test for the Solaris 7 locale name. if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja else # Special test for NetBSD 1.6. if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then gt_cv_locale_ja=ja_JP.eucJP else # None found. gt_cv_locale_ja=none fi fi fi fi fi fi ;; esac fi rm -fr conftest* ]) LOCALE_JA=$gt_cv_locale_ja AC_SUBST([LOCALE_JA]) ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/regex.m4��������������������������������������������������������������������0000664�0001750�0001750�00000035750�14670377450�016355� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 73 # Copyright (C) 1996-2001, 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. dnl Initially derived from code in GNU grep. dnl Mostly written by Jim Meyering. AC_PREREQ([2.50]) AC_DEFUN([gl_REGEX], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_ARG_WITH([included-regex], [AS_HELP_STRING([--without-included-regex], [don't compile regex; this is the default on systems with recent-enough versions of the GNU C Library (use with caution on other systems).])]) case $with_included_regex in #( yes|no) ac_use_included_regex=$with_included_regex ;; '') # If the system regex support is good enough that it passes the # following run test, then default to *not* using the included regex.c. # If cross compiling, assume the test would fail and use the included # regex.c. AC_CHECK_DECLS_ONCE([alarm]) AC_CHECK_HEADERS_ONCE([malloc.h]) AC_CACHE_CHECK([for working re_compile_pattern], [gl_cv_func_re_compile_pattern_working], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <regex.h> #include <locale.h> #include <limits.h> #include <string.h> #if defined M_CHECK_ACTION || HAVE_DECL_ALARM # include <signal.h> # include <unistd.h> #endif #if HAVE_MALLOC_H # include <malloc.h> #endif #ifdef M_CHECK_ACTION /* Exit with distinguishable exit code. */ static void sigabrt_no_core (int sig) { raise (SIGTERM); } #endif ]], [[int result = 0; static struct re_pattern_buffer regex; unsigned char folded_chars[UCHAR_MAX + 1]; int i; const char *s; struct re_registers regs; /* Some builds of glibc go into an infinite loop on this test. Use alarm to force death, and mallopt to avoid malloc recursion in diagnosing the corrupted heap. */ #if HAVE_DECL_ALARM signal (SIGALRM, SIG_DFL); alarm (2); #endif #ifdef M_CHECK_ACTION signal (SIGABRT, sigabrt_no_core); mallopt (M_CHECK_ACTION, 2); #endif if (setlocale (LC_ALL, "en_US.UTF-8")) { { /* https://sourceware.org/ml/libc-hacker/2006-09/msg00008.html This test needs valgrind to catch the bug on Debian GNU/Linux 3.1 x86, but it might catch the bug better on other platforms and it shouldn't hurt to try the test here. */ static char const pat[] = "insert into"; static char const data[] = "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE | RE_ICASE); memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) result |= 1; else { if (re_search (®ex, data, sizeof data - 1, 0, sizeof data - 1, ®s) != -1) result |= 1; regfree (®ex); } } { /* This test is from glibc bug 15078. The test case is from Andreas Schwab in <https://sourceware.org/ml/libc-alpha/2013-01/msg00967.html>. */ static char const pat[] = "[^x]x"; static char const data[] = /* <U1000><U103B><U103D><U1014><U103A><U102F><U1015><U103A> */ "\xe1\x80\x80" "\xe1\x80\xbb" "\xe1\x80\xbd" "\xe1\x80\x94" "\xe1\x80\xba" "\xe1\x80\xaf" "\xe1\x80\x95" "\xe1\x80\xba" "x"; re_set_syntax (0); memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) result |= 1; else { i = re_search (®ex, data, sizeof data - 1, 0, sizeof data - 1, 0); if (i != 0 && i != 21) result |= 1; regfree (®ex); } } if (! setlocale (LC_ALL, "C")) return 1; } /* This test is from glibc bug 3957, reported by Andrew Mackey. */ re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("a[^x]b", 6, ®ex); if (s) result |= 2; else { /* This should fail, but succeeds for glibc-2.5. */ if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) result |= 2; regfree (®ex); } /* This regular expression is from Spencer ere test number 75 in grep-2.3. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof regex); for (i = 0; i <= UCHAR_MAX; i++) folded_chars[i] = i; regex.translate = folded_chars; s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, ®ex); /* This should fail with _Invalid character class name_ error. */ if (!s) { result |= 4; regfree (®ex); } /* Ensure that [b-a] is diagnosed as invalid, when using RE_NO_EMPTY_RANGES. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("a[b-a]", 6, ®ex); if (s == 0) { result |= 8; regfree (®ex); } /* This should succeed, but does not for glibc-2.1.3. */ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("{1", 2, ®ex); if (s) result |= 8; else regfree (®ex); /* The following example is derived from a problem report against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[an\371]*n", 7, ®ex); if (s) result |= 8; else { /* This should match, but does not for glibc-2.2.1. */ if (re_match (®ex, "an", 2, 0, ®s) != 2) result |= 8; else { free (regs.start); free (regs.end); } regfree (®ex); } memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) result |= 8; else { /* glibc-2.2.93 does not work with a negative RANGE argument. */ if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) result |= 8; else { free (regs.start); free (regs.end); } regfree (®ex); } /* The version of regex.c in older versions of gnulib ignored RE_ICASE. Detect that problem too. */ re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) result |= 16; else { if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) result |= 16; else { free (regs.start); free (regs.end); } regfree (®ex); } /* Catch a bug reported by Vin Shelton in https://lists.gnu.org/r/bug-coreutils/2007-06/msg00089.html */ re_set_syntax (RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[[:alnum:]_-]\\\\+\$", 16, ®ex); if (s) result |= 32; else regfree (®ex); /* REG_STARTEND was added to glibc on 2004-01-15. Reject older versions. */ if (! REG_STARTEND) result |= 64; /* Matching with the compiled form of this regexp would provoke an assertion failure prior to glibc-2.28: regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed With glibc-2.28, compilation fails and reports the invalid back reference. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("0|()0|\\\\1|0", 10, ®ex); if (!s) { memset (®s, 0, sizeof regs); i = re_search (®ex, "x", 1, 0, 1, ®s); if (i != -1) result |= 64; if (0 <= i) { free (regs.start); free (regs.end); } regfree (®ex); } else { if (strcmp (s, "Invalid back reference")) result |= 64; } /* glibc bug 11053. */ re_set_syntax (RE_SYNTAX_POSIX_BASIC); memset (®ex, 0, sizeof regex); static char const pat_sub2[] = "\\\\(a*\\\\)*a*\\\\1"; s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, ®ex); if (s) result |= 64; else { memset (®s, 0, sizeof regs); static char const data[] = "a"; int datalen = sizeof data - 1; i = re_search (®ex, data, datalen, 0, datalen, ®s); if (i != 0) result |= 64; else if (regs.num_regs < 2) result |= 64; else if (! (regs.start[0] == 0 && regs.end[0] == 1)) result |= 64; else if (! (regs.start[1] == 0 && regs.end[1] == 0)) result |= 64; regfree (®ex); free (regs.start); free (regs.end); } #if 0 /* It would be nice to reject hosts whose regoff_t values are too narrow (including glibc on hosts with 64-bit ptrdiff_t and 32-bit int), but we should wait until glibc implements this feature. Otherwise, support for equivalence classes and multibyte collation symbols would always be broken except when compiling --without-included-regex. */ if (sizeof (regoff_t) < sizeof (ptrdiff_t) || sizeof (regoff_t) < sizeof (ssize_t)) result |= 64; #endif return result; ]])], [gl_cv_func_re_compile_pattern_working=yes], [gl_cv_func_re_compile_pattern_working=no], [case "$host_os" in # Guess no on native Windows. mingw*) gl_cv_func_re_compile_pattern_working="guessing no" ;; # Otherwise obey --enable-cross-guesses. *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_re_compile_pattern_working" in #( *yes) ac_use_included_regex=no;; #( *no) ac_use_included_regex=yes;; esac ;; *) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex]) ;; esac if test $ac_use_included_regex = yes; then AC_DEFINE([_REGEX_INCLUDE_LIMITS_H], [1], [Define if you want <regex.h> to include <limits.h>, so that it consistently overrides <limits.h>'s RE_DUP_MAX.]) AC_DEFINE([_REGEX_LARGE_OFFSETS], [1], [Define if you want regoff_t to be at least as wide POSIX requires.]) AC_DEFINE([re_syntax_options], [rpl_re_syntax_options], [Define to rpl_re_syntax_options if the replacement should be used.]) AC_DEFINE([re_set_syntax], [rpl_re_set_syntax], [Define to rpl_re_set_syntax if the replacement should be used.]) AC_DEFINE([re_compile_pattern], [rpl_re_compile_pattern], [Define to rpl_re_compile_pattern if the replacement should be used.]) AC_DEFINE([re_compile_fastmap], [rpl_re_compile_fastmap], [Define to rpl_re_compile_fastmap if the replacement should be used.]) AC_DEFINE([re_search], [rpl_re_search], [Define to rpl_re_search if the replacement should be used.]) AC_DEFINE([re_search_2], [rpl_re_search_2], [Define to rpl_re_search_2 if the replacement should be used.]) AC_DEFINE([re_match], [rpl_re_match], [Define to rpl_re_match if the replacement should be used.]) AC_DEFINE([re_match_2], [rpl_re_match_2], [Define to rpl_re_match_2 if the replacement should be used.]) AC_DEFINE([re_set_registers], [rpl_re_set_registers], [Define to rpl_re_set_registers if the replacement should be used.]) AC_DEFINE([re_comp], [rpl_re_comp], [Define to rpl_re_comp if the replacement should be used.]) AC_DEFINE([re_exec], [rpl_re_exec], [Define to rpl_re_exec if the replacement should be used.]) AC_DEFINE([regcomp], [rpl_regcomp], [Define to rpl_regcomp if the replacement should be used.]) AC_DEFINE([regexec], [rpl_regexec], [Define to rpl_regexec if the replacement should be used.]) AC_DEFINE([regerror], [rpl_regerror], [Define to rpl_regerror if the replacement should be used.]) AC_DEFINE([regfree], [rpl_regfree], [Define to rpl_regfree if the replacement should be used.]) fi ]) # Prerequisites of lib/regex.c and lib/regex_internal.c. AC_DEFUN([gl_PREREQ_REGEX], [ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_REQUIRE([gl_EEMALLOC]) AC_CHECK_HEADERS([libintl.h]) AC_CHECK_FUNCS_ONCE([isblank iswctype]) AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]]) ]) ������������������������kbuild-3608/src/grep/m4/multiarch.m4����������������������������������������������������������������0000664�0001750�0001750�00000004220�14670377450�017217� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# multiarch.m4 serial 9 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Determine whether the compiler is or may be producing universal binaries. # # On Mac OS X 10.5 and later systems, the user can create libraries and # executables that work on multiple system types--known as "fat" or # "universal" binaries--by specifying multiple '-arch' options to the # compiler but only a single '-arch' option to the preprocessor. Like # this: # # ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ # CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ # CPP="gcc -E" CXXCPP="g++ -E" # # Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly. AC_DEFUN_ONCE([gl_MULTIARCH], [ dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. AC_CACHE_CHECK([whether the compiler produces multi-arch binaries], [gl_cv_c_multiarch], [gl_cv_c_multiarch=no AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; ]])], [ dnl Check for potential -arch flags. It is not universal unless dnl there are at least two -arch flags with different values. arch= prev= for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do if test -n "$prev"; then case $word in i?86 | x86_64 | ppc | ppc64 | arm | arm64) if test -z "$arch" || test "$arch" = "$word"; then arch="$word" else gl_cv_c_multiarch=yes fi ;; esac prev= else if test "x$word" = "x-arch"; then prev=arch fi fi done ]) ]) if test $gl_cv_c_multiarch = yes; then APPLE_UNIVERSAL_BUILD=1 else APPLE_UNIVERSAL_BUILD=0 fi AC_SUBST([APPLE_UNIVERSAL_BUILD]) ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/zzgnulib.m4�����������������������������������������������������������������0000664�0001750�0001750�00000001522�14670377450�017075� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# zzgnulib.m4 serial 1 dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This file must be named something that sorts after all other dnl package- or gnulib-provided .m4 files - at least for those packages dnl that redefine AC_PROG_CC. dnl Redefine AC_PROG_CC so that it ends with invocations of gl_COMPILER_CLANG dnl and gl_COMPILER_PREPARE_CHECK_DECL. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[ gl_COMPILER_CLANG gl_COMPILER_PREPARE_CHECK_DECL ]) # gl_ZZGNULIB # ----------- # Witness macro that this file has been included. Needed to force # Automake to include this file after all other gnulib .m4 files. AC_DEFUN([gl_ZZGNULIB]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/close.m4��������������������������������������������������������������������0000664�0001750�0001750�00000002221�14670377440�016332� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# close.m4 serial 9 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_CLOSE], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) m4_ifdef([gl_MSVC_INVAL], [ AC_REQUIRE([gl_MSVC_INVAL]) if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then REPLACE_CLOSE=1 fi ]) m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [ gl_PREREQ_SYS_H_WINSOCK2 if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then dnl Even if the 'socket' module is not used here, another part of the dnl application may use it and pass file descriptors that refer to dnl sockets to the close() function. So enable the support for sockets. REPLACE_CLOSE=1 fi ]) dnl Replace close() for supporting the gnulib-defined fchdir() function, dnl to keep fchdir's bookkeeping up-to-date. m4_ifdef([gl_FUNC_FCHDIR], [ if test $REPLACE_CLOSE = 0; then gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then REPLACE_CLOSE=1 fi fi ]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/calloc.m4�������������������������������������������������������������������0000664�0001750�0001750�00000005611�14670377440�016470� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# calloc.m4 serial 27 # Copyright (C) 2004-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Jim Meyering. # Determine whether calloc (N, S) returns non-NULL when N*S is zero, # and returns NULL when N*S overflows. # If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc # and arrange to use a calloc wrapper function that does work in that case. # _AC_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) # ------------------------------------- # If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT. AC_DEFUN([_AC_FUNC_CALLOC_IF], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull], [ac_cv_func_calloc_0_nonnull], [if test $cross_compiling != yes; then ac_cv_func_calloc_0_nonnull=yes AC_RUN_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT], [[int result = 0; char * volatile p = calloc (0, 0); if (!p) result |= 1; free (p); return result; ]])], [], [ac_cv_func_calloc_0_nonnull=no]) else case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; # Guess yes on musl systems. *-musl*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; # Guess yes on native Windows. mingw*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; esac fi ]) AS_CASE([$ac_cv_func_calloc_0_nonnull], [*yes], [$1], [$2]) ]) # gl_FUNC_CALLOC_GNU # ------------------ # Replace calloc if it is not compatible with GNU libc. AC_DEFUN([gl_FUNC_CALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) if test $REPLACE_CALLOC = 0; then _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC=1]) fi ])# gl_FUNC_CALLOC_GNU # gl_FUNC_CALLOC_POSIX # -------------------- # Test whether 'calloc' is POSIX compliant (sets errno to ENOMEM when it # fails, and doesn't mess up with ptrdiff_t or size_t overflow), # and replace calloc if it is not. AC_DEFUN([gl_FUNC_CALLOC_POSIX], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) if test $REPLACE_MALLOC = 1; then REPLACE_CALLOC=1 fi dnl Although in theory we should also test for size_t overflow, dnl in practice testing for ptrdiff_t overflow suffices dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets. dnl A separate size_t test would slow down 'configure'. ]) �����������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/musl.m4���������������������������������������������������������������������0000664�0001750�0001750�00000001204�14670377450�016206� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# musl.m4 serial 3 dnl Copyright (C) 2019-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Test for musl libc, despite the musl libc authors don't like it # <https://wiki.musl-libc.org/faq.html> # <https://lists.gnu.org/archive/html/bug-gnulib/2018-02/msg00079.html>. # From Bruno Haible. AC_DEFUN_ONCE([gl_MUSL_LIBC], [ AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in *-musl*) AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.]) ;; esac ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/wmemchr.m4������������������������������������������������������������������0000664�0001750�0001750�00000001515�14670377450�016675� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# wmemchr.m4 serial 5 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_WMEMCHR], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) dnl We cannot use AC_CHECK_FUNCS here, because the MSVC 9 header files dnl provide this function as an inline function definition. AC_CACHE_CHECK([for wmemchr], [gl_cv_func_wmemchr], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <wchar.h> ]], [[return ! wmemchr ((const wchar_t *) 0, (wchar_t) ' ', 0);]]) ], [gl_cv_func_wmemchr=yes], [gl_cv_func_wmemchr=no]) ]) if test $gl_cv_func_wmemchr = no; then HAVE_WMEMCHR=0 fi ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/snprintf.m4�����������������������������������������������������������������0000664�0001750�0001750�00000003567�14670377450�017107� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# snprintf.m4 serial 7 dnl Copyright (C) 2002-2004, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Libintl 0.17 will replace snprintf only if it does not support %1$s, dnl but defers to any gnulib snprintf replacements. Therefore, gnulib dnl must guarantee that the decision for replacing snprintf is a superset dnl of the reasons checked by libintl. AC_DEFUN([gl_FUNC_SNPRINTF], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) gl_cv_func_snprintf_usable=no AC_CHECK_FUNCS([snprintf]) if test $ac_cv_func_snprintf = yes; then gl_SNPRINTF_SIZE1 case "$gl_cv_func_snprintf_size1" in *yes) gl_SNPRINTF_RETVAL_C99 case "$gl_cv_func_snprintf_retval_c99" in *yes) gl_PRINTF_POSITIONS case "$gl_cv_func_printf_positions" in *yes) gl_cv_func_snprintf_usable=yes ;; esac ;; esac ;; esac fi if test $gl_cv_func_snprintf_usable = no; then gl_REPLACE_SNPRINTF fi AC_CHECK_DECLS_ONCE([snprintf]) if test $ac_cv_have_decl_snprintf = no; then HAVE_DECL_SNPRINTF=0 fi ]) AC_DEFUN([gl_REPLACE_SNPRINTF], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_LIBOBJ([snprintf]) if test $ac_cv_func_snprintf = yes; then REPLACE_SNPRINTF=1 else AC_CHECK_DECLS_ONCE([snprintf]) if test $ac_cv_have_decl_snprintf = yes; then dnl If the function is declared but does not appear to exist, it may be dnl defined as an inline function. In order to avoid a conflict, we have dnl to define rpl_snprintf, not snprintf. REPLACE_SNPRINTF=1 fi fi gl_PREREQ_SNPRINTF ]) # Prerequisites of lib/snprintf.c. AC_DEFUN([gl_PREREQ_SNPRINTF], [:]) �����������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/gnulib-common.m4������������������������������������������������������������0000664�0001750�0001750�00000073476�14670377450�020020� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# gnulib-common.m4 serial 67 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_PREREQ([2.62]) # gl_COMMON # is expanded unconditionally through gnulib-tool magic. AC_DEFUN([gl_COMMON], [ dnl Use AC_REQUIRE here, so that the code is expanded once only. AC_REQUIRE([gl_00GNULIB]) AC_REQUIRE([gl_COMMON_BODY]) AC_REQUIRE([gl_ZZGNULIB]) ]) AC_DEFUN([gl_COMMON_BODY], [ AH_VERBATIM([_GL_GNUC_PREREQ], [/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ #if defined __GNUC__ && defined __GNUC_MINOR__ # define _GL_GNUC_PREREQ(major, minor) \ ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) #else # define _GL_GNUC_PREREQ(major, minor) 0 #endif ]) AH_VERBATIM([_Noreturn], [/* The _Noreturn keyword of C11. */ #ifndef _Noreturn # if (defined __cplusplus \ && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ || (defined _MSC_VER && 1900 <= _MSC_VER)) \ && 0) /* [[noreturn]] is not practically usable, because with it the syntax extern _Noreturn void func (...); would not be valid; such a declaration would only be valid with 'extern' and '_Noreturn' swapped, or without the 'extern' keyword. However, some AIX system header files and several gnulib header files use precisely this syntax with 'extern'. */ # define _Noreturn [[noreturn]] # elif ((!defined __cplusplus || defined __clang__) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ || (!defined __STRICT_ANSI__ \ && (_GL_GNUC_PREREQ (4, 7) \ || (defined __apple_build_version__ \ ? 6000000 <= __apple_build_version__ \ : 3 < __clang_major__ + (5 <= __clang_minor__)))))) /* _Noreturn works as-is. */ # elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) # else # define _Noreturn # endif #endif ]) AH_VERBATIM([isoc99_inline], [/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. __APPLE__ && __MACH__ test for Mac OS X. __APPLE_CC__ tests for the Apple compiler and its version. __STDC_VERSION__ tests for the C99 mode. */ #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ # define __GNUC_STDC_INLINE__ 1 #endif]) AH_VERBATIM([attribute], [/* Attributes. */ #if (defined __has_attribute \ && (!defined __clang_minor__ \ || 3 < __clang_major__ + (5 <= __clang_minor__))) # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) #else # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr # define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) # define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) # define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) # define _GL_ATTR_diagnose_if 0 # define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) # define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) # define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) # define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) # ifdef _ICC # define _GL_ATTR_may_alias 0 # else # define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) # endif # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) # define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) # define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) # define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) #endif #ifdef __has_c_attribute # define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__) #else # define _GL_HAS_C_ATTRIBUTE(attr) 0 #endif ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead. [ #if _GL_HAS_ATTRIBUTE (alloc_size) # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) #else # define _GL_ATTRIBUTE_ALLOC_SIZE(args) #endif #if _GL_HAS_ATTRIBUTE (always_inline) # define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) #else # define _GL_ATTRIBUTE_ALWAYS_INLINE #endif #if _GL_HAS_ATTRIBUTE (artificial) # define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) #else # define _GL_ATTRIBUTE_ARTIFICIAL #endif /* Avoid __attribute__ ((cold)) on MinGW; see thread starting at <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ #if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ # ifndef __SUNPRO_C # define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) # else # define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) # endif #else # define _GL_ATTRIBUTE_COLD #endif #if _GL_HAS_ATTRIBUTE (const) # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) #else # define _GL_ATTRIBUTE_CONST #endif /* _GL_ATTRIBUTE_DEALLOC (F, I) is for functions returning pointers that can be freed by passing them as the Ith argument to the function F. _GL_ATTRIBUTE_DEALLOC_FREE is for functions that return pointers that can be freed via 'free'; it can be used only after including stdlib.h. These macros cannot be used on inline functions. */ #if _GL_GNUC_PREREQ (11, 0) # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) #else # define _GL_ATTRIBUTE_DEALLOC(f, i) #endif #define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) #if _GL_HAS_C_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] #elif _GL_HAS_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) #else # define _GL_ATTRIBUTE_DEPRECATED #endif #if _GL_HAS_ATTRIBUTE (error) # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) #elif _GL_HAS_ATTRIBUTE (diagnose_if) # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error"))) # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning"))) #else # define _GL_ATTRIBUTE_ERROR(msg) # define _GL_ATTRIBUTE_WARNING(msg) #endif #if _GL_HAS_ATTRIBUTE (externally_visible) # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) #else # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE #endif /* FALLTHROUGH is special, because it always expands to something. */ #if _GL_HAS_C_ATTRIBUTE (fallthrough) # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] #elif _GL_HAS_ATTRIBUTE (fallthrough) # define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) #else # define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) #endif #if _GL_HAS_ATTRIBUTE (format) # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) #else # define _GL_ATTRIBUTE_FORMAT(spec) #endif #if _GL_HAS_ATTRIBUTE (leaf) # define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) #else # define _GL_ATTRIBUTE_LEAF #endif #if _GL_HAS_ATTRIBUTE (malloc) # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) #else # define _GL_ATTRIBUTE_MALLOC #endif /* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ #if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C # define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) #else # define _GL_ATTRIBUTE_MAY_ALIAS #endif #if _GL_HAS_C_ATTRIBUTE (maybe_unused) # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] #else # define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED #endif /* Earlier spellings of this macro. */ #define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED #if _GL_HAS_C_ATTRIBUTE (nodiscard) # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] #elif _GL_HAS_ATTRIBUTE (warn_unused_result) # define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) #else # define _GL_ATTRIBUTE_NODISCARD #endif #if _GL_HAS_ATTRIBUTE (noinline) # define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) #else # define _GL_ATTRIBUTE_NOINLINE #endif #if _GL_HAS_ATTRIBUTE (nonnull) # define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) #else # define _GL_ATTRIBUTE_NONNULL(args) #endif #if _GL_HAS_ATTRIBUTE (nonstring) # define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) #else # define _GL_ATTRIBUTE_NONSTRING #endif /* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ #if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) #else # define _GL_ATTRIBUTE_NOTHROW #endif #if _GL_HAS_ATTRIBUTE (packed) # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) #else # define _GL_ATTRIBUTE_PACKED #endif #if _GL_HAS_ATTRIBUTE (pure) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) #else # define _GL_ATTRIBUTE_PURE #endif #if _GL_HAS_ATTRIBUTE (returns_nonnull) # define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) #else # define _GL_ATTRIBUTE_RETURNS_NONNULL #endif #if _GL_HAS_ATTRIBUTE (sentinel) # define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) #else # define _GL_ATTRIBUTE_SENTINEL(pos) #endif #if _GL_HAS_ATTRIBUTE (unused) # define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #else # define _GL_ATTRIBUTE_UNUSED #endif /* Earlier spellings of this macro. */ #define _GL_UNUSED _GL_ATTRIBUTE_UNUSED ]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead. [ /* To support C++ as well as C, use _GL_UNUSED_LABEL with trailing ';'. */ #if !defined __cplusplus || _GL_GNUC_PREREQ (4, 5) # define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED #else # define _GL_UNUSED_LABEL #endif ]) AH_VERBATIM([async_safe], [/* The _GL_ASYNC_SAFE marker should be attached to functions that are signal handlers (for signals other than SIGABRT, SIGPIPE) or can be invoked from such signal handlers. Such functions have some restrictions: * All functions that it calls should be marked _GL_ASYNC_SAFE as well, or should be listed as async-signal-safe in POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04> section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in particular, are NOT async-signal-safe. * All memory locations (variables and struct fields) that these functions access must be marked 'volatile'. This holds for both read and write accesses. Otherwise the compiler might optimize away stores to and reads from such locations that occur in the program, depending on its data flow analysis. For example, when the program contains a loop that is intended to inspect a variable set from within a signal handler while (!signal_occurred) ; the compiler is allowed to transform this into an endless loop if the variable 'signal_occurred' is not declared 'volatile'. Additionally, recall that: * A signal handler should not modify errno (except if it is a handler for a fatal signal and ends by raising the same signal again, thus provoking the termination of the process). If it invokes a function that may clobber errno, it needs to save and restore the value of errno. */ #define _GL_ASYNC_SAFE ]) AH_VERBATIM([micro_optimizations], [/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where n1 and n2 are expressions without side effects, that evaluate to real numbers (excluding NaN). It returns 1 if n1 > n2 0 if n1 == n2 -1 if n1 < n2 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional jump with nearly all GCC versions up to GCC 10. This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many GCC versions up to GCC 9. The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 avoids conditional jumps in all GCC versions >= 3.4. */ #define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) ]) dnl Hint which direction to take regarding cross-compilation guesses: dnl When a user installs a program on a platform they are not intimately dnl familiar with, --enable-cross-guesses=conservative is the appropriate dnl choice. It implements the "If we don't know, assume the worst" principle. dnl However, when an operating system developer (on a platform which is not dnl yet known to gnulib) builds packages for their platform, they want to dnl expose, not hide, possible platform bugs; in this case, dnl --enable-cross-guesses=risky is the appropriate choice. dnl Sets the variables dnl gl_cross_guess_normal (to be used when 'yes' is good and 'no' is bad), dnl gl_cross_guess_inverted (to be used when 'no' is good and 'yes' is bad). AC_ARG_ENABLE([cross-guesses], [AS_HELP_STRING([--enable-cross-guesses={conservative|risky}], [specify policy for cross-compilation guesses])], [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) enableval=conservative fi gl_cross_guesses="$enableval"], [gl_cross_guesses=conservative]) if test $gl_cross_guesses = risky; then gl_cross_guess_normal="guessing yes" gl_cross_guess_inverted="guessing no" else gl_cross_guess_normal="guessing no" gl_cross_guess_inverted="guessing yes" fi dnl Preparation for running test programs: dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not dnl to /dev/tty, so they can be redirected to log files. Such diagnostics dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N. LIBC_FATAL_STDERR_=1 export LIBC_FATAL_STDERR_ ]) # gl_MODULE_INDICATOR_INIT_VARIABLE([variablename]) # gl_MODULE_INDICATOR_INIT_VARIABLE([variablename], [initialvalue]) # initializes the shell variable that indicates the presence of the given module # as a C preprocessor expression. AC_DEFUN([gl_MODULE_INDICATOR_INIT_VARIABLE], [ GL_MODULE_INDICATOR_PREFIX[]_[$1]=m4_if([$2], , [0], [$2]) AC_SUBST(GL_MODULE_INDICATOR_PREFIX[]_[$1]) ]) # gl_MODULE_INDICATOR_CONDITION # expands to a C preprocessor expression that evaluates to 1 or 0, depending # whether a gnulib module that has been requested shall be considered present # or not. m4_define([gl_MODULE_INDICATOR_CONDITION], [1]) # gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) # sets the shell variable that indicates the presence of the given module to # a C preprocessor expression that will evaluate to 1. AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], [ gl_MODULE_INDICATOR_SET_VARIABLE_AUX( [GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]m4_translit([[$1]], [abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], [gl_MODULE_INDICATOR_CONDITION]) ]) # gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable]) # modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION. # The shell variable's value is a C preprocessor expression that evaluates # to 0 or 1. AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX], [ m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1], [ dnl Simplify the expression VALUE || 1 to 1. $1=1 ], [gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1], [gl_MODULE_INDICATOR_CONDITION])]) ]) # gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition]) # modifies the shell variable to include the given condition. The shell # variable's value is a C preprocessor expression that evaluates to 0 or 1. AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR], [ dnl Simplify the expression 1 || CONDITION to 1. if test "$[]$1" != 1; then dnl Simplify the expression 0 || CONDITION to CONDITION. if test "$[]$1" = 0; then $1=$2 else $1="($[]$1 || $2)" fi fi ]) # gl_MODULE_INDICATOR([modulename]) # defines a C macro indicating the presence of the given module # in a location where it can be used. # | Value | Value | # | in lib/ | in tests/ | # --------------------------------------------+---------+-----------+ # Module present among main modules: | 1 | 1 | # --------------------------------------------+---------+-----------+ # Module present among tests-related modules: | 0 | 1 | # --------------------------------------------+---------+-----------+ # Module not present at all: | 0 | 0 | # --------------------------------------------+---------+-----------+ AC_DEFUN([gl_MODULE_INDICATOR], [ AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]], [abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [gl_MODULE_INDICATOR_CONDITION], [Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module $1 shall be considered present.]) ]) # gl_MODULE_INDICATOR_FOR_TESTS([modulename]) # defines a C macro indicating the presence of the given module # in lib or tests. This is useful to determine whether the module # should be tested. # | Value | Value | # | in lib/ | in tests/ | # --------------------------------------------+---------+-----------+ # Module present among main modules: | 1 | 1 | # --------------------------------------------+---------+-----------+ # Module present among tests-related modules: | 1 | 1 | # --------------------------------------------+---------+-----------+ # Module not present at all: | 0 | 0 | # --------------------------------------------+---------+-----------+ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], [ AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]], [abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], [Define to 1 when the gnulib module $1 should be tested.]) ]) # gl_ASSERT_NO_GNULIB_POSIXCHECK # asserts that there will never be a need to #define GNULIB_POSIXCHECK. # and thereby enables an optimization of configure and config.h. # Used by Emacs. AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK], [ dnl Override gl_WARN_ON_USE_PREPARE. dnl But hide this definition from 'aclocal'. AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], []) ]) # gl_ASSERT_NO_GNULIB_TESTS # asserts that there will be no gnulib tests in the scope of the configure.ac # and thereby enables an optimization of config.h. # Used by Emacs. AC_DEFUN([gl_ASSERT_NO_GNULIB_TESTS], [ dnl Override gl_MODULE_INDICATOR_FOR_TESTS. AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], []) ]) # Test whether <features.h> exists. # Set HAVE_FEATURES_H. AC_DEFUN([gl_FEATURES_H], [ AC_CHECK_HEADERS_ONCE([features.h]) if test $ac_cv_header_features_h = yes; then HAVE_FEATURES_H=1 else HAVE_FEATURES_H=0 fi AC_SUBST([HAVE_FEATURES_H]) ]) # gl_PROG_CC_C99 # Modifies the value of the shell variable CC in an attempt to make $CC # understand ISO C99 source code. AC_DEFUN([gl_PROG_CC_C99], [ dnl Just use AC_PROG_CC_C99. dnl When AC_PROG_CC_C99 and AC_PROG_CC_STDC are used together, the substituted dnl value of CC will contain the C99 enabling options twice. But this is only dnl a cosmetic problem. dnl With Autoconf >= 2.70, use AC_PROG_CC since it implies AC_PROG_CC_C99; dnl this avoids a "warning: The macro `AC_PROG_CC_C99' is obsolete." m4_version_prereq([2.70], [AC_REQUIRE([AC_PROG_CC])], [AC_REQUIRE([AC_PROG_CC_C99])]) ]) # gl_PROG_AR_RANLIB # Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler. # The user can set the variables AR, ARFLAGS, RANLIB if he wants to override # the values. AC_DEFUN([gl_PROG_AR_RANLIB], [ dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler dnl as "cc", and GCC as "gcc". They have different object file formats and dnl library formats. In particular, the GNU binutils programs ar and ranlib dnl produce libraries that work only with gcc, not with cc. AC_REQUIRE([AC_PROG_CC]) dnl The '][' hides this use from 'aclocal'. AC_BEFORE([$0], [A][M_PROG_AR]) AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler], [ AC_EGREP_CPP([Amsterdam], [ #ifdef __ACK__ Amsterdam #endif ], [gl_cv_c_amsterdam_compiler=yes], [gl_cv_c_amsterdam_compiler=no]) ]) dnl Don't compete with AM_PROG_AR's decision about AR/ARFLAGS if we are not dnl building with __ACK__. if test $gl_cv_c_amsterdam_compiler = yes; then if test -z "$AR"; then AR='cc -c.a' fi if test -z "$ARFLAGS"; then ARFLAGS='-o' fi else dnl AM_PROG_AR was added in automake v1.11.2. AM_PROG_AR does not AC_SUBST dnl ARFLAGS variable (it is filed into Makefile.in directly by automake dnl script on-demand, if not specified by ./configure of course). dnl Don't AC_REQUIRE the AM_PROG_AR otherwise the code for __ACK__ above dnl will be ignored. Also, pay attention to call AM_PROG_AR in else block dnl because AM_PROG_AR is written so it could re-set AR variable even for dnl __ACK__. It may seem like its easier to avoid calling the macro here, dnl but we need to AC_SUBST both AR/ARFLAGS (thus those must have some good dnl default value and automake should usually know them). dnl dnl The '][' hides this use from 'aclocal'. m4_ifdef([A][M_PROG_AR], [A][M_PROG_AR], [:]) fi dnl In case the code above has not helped with setting AR/ARFLAGS, use dnl Automake-documented default values for AR and ARFLAGS, but prefer dnl ${host}-ar over ar (useful for cross-compiling). AC_CHECK_TOOL([AR], [ar], [ar]) if test -z "$ARFLAGS"; then ARFLAGS='cr' fi AC_SUBST([AR]) AC_SUBST([ARFLAGS]) if test -z "$RANLIB"; then if test $gl_cv_c_amsterdam_compiler = yes; then RANLIB=':' else dnl Use the ranlib program if it is available. AC_PROG_RANLIB fi fi AC_SUBST([RANLIB]) ]) # AC_C_RESTRICT # This definition is copied from post-2.70 Autoconf and overrides the # AC_C_RESTRICT macro from autoconf 2.60..2.70. m4_version_prereq([2.70.1], [], [ AC_DEFUN([AC_C_RESTRICT], [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], [ac_cv_c_restrict=no # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see: # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html # Put 'restrict' last, because C++ lacks it. for ac_kw in __restrict__ __restrict _Restrict restrict; do AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[typedef int *int_ptr; int foo (int_ptr $ac_kw ip) { return ip[0]; } int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ int bar (int ip[$ac_kw]) { return ip[0]; } ]], [[int s[1]; int *$ac_kw t = s; t[0] = 0; return foo (t) + bar (t); ]])], [ac_cv_c_restrict=$ac_kw]) test "$ac_cv_c_restrict" != no && break done ]) AH_VERBATIM([restrict], [/* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported only directly. */ #undef restrict /* Work around a bug in older versions of Sun C++, which did not #define __restrict__ or support _Restrict or __restrict__ even though the corresponding Sun C compiler ended up with "#define restrict _Restrict" or "#define restrict __restrict__" in the previous line. This workaround can be removed once we assume Oracle Developer Studio 12.5 (2016) or later. */ #if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ # define _Restrict # define __restrict__ #endif]) case $ac_cv_c_restrict in restrict) ;; no) AC_DEFINE([restrict], []) ;; *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; esac ])# AC_C_RESTRICT ]) # gl_BIGENDIAN # is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. # Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some # macros invoke AC_C_BIGENDIAN with arguments. AC_DEFUN([gl_BIGENDIAN], [ AC_C_BIGENDIAN ]) # A temporary file descriptor. # Must be less than 10, because dash 0.5.8 does not support redirections # with multi-digit file descriptors. m4_define([GL_TMP_FD], 9) # gl_SILENT(command) # executes command, but without the normal configure output. # This is useful when you want to invoke AC_CACHE_CHECK (or AC_CHECK_FUNC etc.) # inside another AC_CACHE_CHECK. AC_DEFUN([gl_SILENT], [ exec GL_TMP_FD>&AS_MESSAGE_FD AS_MESSAGE_FD>/dev/null $1 exec AS_MESSAGE_FD>&GL_TMP_FD GL_TMP_FD>&- ]) # gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) # is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not # output a spurious "(cached)" mark in the midst of other configure output. # This macro should be used instead of AC_CACHE_VAL when it is not surrounded # by an AC_MSG_CHECKING/AC_MSG_RESULT pair. AC_DEFUN([gl_CACHE_VAL_SILENT], [ gl_SILENT([ AC_CACHE_VAL([$1], [$2]) ]) ]) # gl_CC_ALLOW_WARNINGS # sets and substitutes a variable GL_CFLAG_ALLOW_WARNINGS, to a $(CC) option # that reverts a preceding '-Werror' option, if available. # This is expected to be '-Wno-error' on gcc, clang (except clang/MSVC), xlclang # and empty otherwise. AC_DEFUN([gl_CC_ALLOW_WARNINGS], [ AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK([for C compiler option to allow warnings], [gl_cv_cc_wallow], [rm -f conftest* echo 'int dummy;' > conftest.c AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null dnl Test the number of error output lines, because AIX xlc accepts the dnl option '-Wno-error', just to produce a warning dnl "Option -Wno-error was incorrectly specified. The option will be ignored." dnl afterwards. if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then gl_cv_cc_wallow='-Wno-error' else gl_cv_cc_wallow=none fi rm -f conftest* ]) case "$gl_cv_cc_wallow" in none) GL_CFLAG_ALLOW_WARNINGS='' ;; *) GL_CFLAG_ALLOW_WARNINGS="$gl_cv_cc_wallow" ;; esac AC_SUBST([GL_CFLAG_ALLOW_WARNINGS]) ]) # gl_CXX_ALLOW_WARNINGS # sets and substitutes a variable GL_CXXFLAG_ALLOW_WARNINGS, to a $(CC) option # that reverts a preceding '-Werror' option, if available. AC_DEFUN([gl_CXX_ALLOW_WARNINGS], [ dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX. if test -n "$CXX" && test "$CXX" != no; then AC_CACHE_CHECK([for C++ compiler option to allow warnings], [gl_cv_cxx_wallow], [rm -f conftest* echo 'int dummy;' > conftest.cc AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null dnl Test the number of error output lines, because AIX xlC accepts the dnl option '-Wno-error', just to produce a warning dnl "Option -Wno-error was incorrectly specified. The option will be ignored." dnl afterwards. if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then gl_cv_cxx_wallow='-Wno-error' else gl_cv_cxx_wallow=none fi rm -f conftest* ]) case "$gl_cv_cxx_wallow" in none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; *) GL_CXXFLAG_ALLOW_WARNINGS="$gl_cv_cxx_wallow" ;; esac else GL_CXXFLAG_ALLOW_WARNINGS='' fi AC_SUBST([GL_CXXFLAG_ALLOW_WARNINGS]) ]) dnl Expands to some code for use in .c programs that, on native Windows, defines dnl the Microsoft deprecated alias function names to the underscore-prefixed dnl actual function names. With this macro, these function names are available dnl without linking with '-loldnames' and without generating warnings. dnl Usage: Use it after all system header files are included. dnl #include <...> dnl #include <...> dnl ]GL_MDA_DEFINES[ dnl ... AC_DEFUN([GL_MDA_DEFINES],[ AC_REQUIRE([_GL_MDA_DEFINES]) [$gl_mda_defines] ]) AC_DEFUN([_GL_MDA_DEFINES], [gl_mda_defines=' #if defined _WIN32 && !defined __CYGWIN__ #define access _access #define chdir _chdir #define chmod _chmod #define close _close #define creat _creat #define dup _dup #define dup2 _dup2 #define ecvt _ecvt #define execl _execl #define execle _execle #define execlp _execlp #define execv _execv #define execve _execve #define execvp _execvp #define execvpe _execvpe #define fcloseall _fcloseall #define fcvt _fcvt #define fdopen _fdopen #define fileno _fileno #define gcvt _gcvt #define getcwd _getcwd #define getpid _getpid #define getw _getw #define isatty _isatty #define j0 _j0 #define j1 _j1 #define jn _jn #define lfind _lfind #define lsearch _lsearch #define lseek _lseek #define memccpy _memccpy #define mkdir _mkdir #define mktemp _mktemp #define open _open #define putenv _putenv #define putw _putw #define read _read #define rmdir _rmdir #define strdup _strdup #define swab _swab #define tempnam _tempnam #define tzset _tzset #define umask _umask #define unlink _unlink #define utime _utime #define wcsdup _wcsdup #define write _write #define y0 _y0 #define y1 _y1 #define yn _yn #endif ' ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sys_socket_h.m4�������������������������������������������������������������0000664�0001750�0001750�00000016266�14670377450�017741� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sys_socket_h.m4 serial 28 dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Simon Josefsson. AC_DEFUN_ONCE([gl_SYS_SOCKET_H], [ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have dnl old-style declarations (with return type 'int' instead of 'ssize_t') dnl unless _POSIX_PII_SOCKET is defined. case "$host_os" in osf*) AC_DEFINE([_POSIX_PII_SOCKET], [1], [Define to 1 in order to get the POSIX compatible declarations of socket functions.]) ;; esac AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], [gl_cv_header_sys_socket_h_selfcontained], [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[]])], [gl_cv_header_sys_socket_h_selfcontained=yes], [gl_cv_header_sys_socket_h_selfcontained=no]) ]) if test $gl_cv_header_sys_socket_h_selfcontained = yes; then dnl If the shutdown function exists, <sys/socket.h> should define dnl SHUT_RD, SHUT_WR, SHUT_RDWR. AC_CHECK_FUNCS([shutdown]) if test $ac_cv_func_shutdown = yes; then AC_CACHE_CHECK([whether <sys/socket.h> defines the SHUT_* macros], [gl_cv_header_sys_socket_h_shut], [ AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])], [gl_cv_header_sys_socket_h_shut=yes], [gl_cv_header_sys_socket_h_shut=no]) ]) if test $gl_cv_header_sys_socket_h_shut = no; then SYS_SOCKET_H='sys/socket.h' fi fi fi # We need to check for ws2tcpip.h now. gl_PREREQ_SYS_H_SOCKET AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ /* sys/types.h is not needed according to POSIX, but the sys/socket.h in i386-unknown-freebsd4.10 and powerpc-apple-darwin5.5 required it. */ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif ]) if test $ac_cv_type_struct_sockaddr_storage = no; then HAVE_STRUCT_SOCKADDR_STORAGE=0 fi if test $ac_cv_type_sa_family_t = no; then HAVE_SA_FAMILY_T=0 fi if test $ac_cv_type_struct_sockaddr_storage != no; then AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], [], [HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0], [#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif ]) fi if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then SYS_SOCKET_H='sys/socket.h' fi gl_PREREQ_SYS_H_WINSOCK2 dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ /* Some systems require prerequisite headers. */ #include <sys/types.h> #include <sys/socket.h> ]], [socket connect accept bind getpeername getsockname getsockopt listen recv send recvfrom sendto setsockopt shutdown accept4]) AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], [ dnl Check prerequisites of the <sys/socket.h> replacement. AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) gl_CHECK_NEXT_HEADERS([sys/socket.h]) if test $ac_cv_header_sys_socket_h = yes; then HAVE_SYS_SOCKET_H=1 else HAVE_SYS_SOCKET_H=0 fi AC_SUBST([HAVE_SYS_SOCKET_H]) gl_PREREQ_SYS_H_WS2TCPIP ]) # Common prerequisites of the <sys/socket.h> replacement and of the # <sys/select.h> replacement. # Sets and substitutes HAVE_WINSOCK2_H. AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], [ m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])]) m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])]) AC_CHECK_HEADERS_ONCE([sys/socket.h]) if test $ac_cv_header_sys_socket_h != yes; then dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make dnl the check for those headers unconditional; yet cygwin reports dnl that the headers are present but cannot be compiled (since on dnl cygwin, all socket information should come from sys/socket.h). AC_CHECK_HEADERS([winsock2.h]) fi if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 UNISTD_H_HAVE_WINSOCK2_H=1 SYS_IOCTL_H_HAVE_WINSOCK2_H=1 else HAVE_WINSOCK2_H=0 fi AC_SUBST([HAVE_WINSOCK2_H]) ]) # Common prerequisites of the <sys/socket.h> replacement and of the # <arpa/inet.h> replacement. # Sets and substitutes HAVE_WS2TCPIP_H. AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], [ AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) if test $ac_cv_header_sys_socket_h = yes; then HAVE_WS2TCPIP_H=0 else if test $ac_cv_header_ws2tcpip_h = yes; then HAVE_WS2TCPIP_H=1 else HAVE_WS2TCPIP_H=0 fi fi AC_SUBST([HAVE_WS2TCPIP_H]) ]) # gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_SYS_SOCKET_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_SYS_SOCKET_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SOCKET]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CONNECT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BIND]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPEERNAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKNAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKOPT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LISTEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SEND]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECVFROM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SENDTO]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETSOCKOPT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SHUTDOWN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT4]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) ]) AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], [ HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/extern-inline.m4������������������������������������������������������������0000664�0001750�0001750�00000011574�14670377450�020022� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������dnl 'extern inline' a la ISO C99. dnl Copyright 2012-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_EXTERN_INLINE], [ AH_VERBATIM([extern_inline], [/* Please see the Gnulib manual for how to use these macros. Suppress extern inline with HP-UX cc, as it appears to be broken; see <https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>. Suppress extern inline with Sun C in standards-conformance mode, as it mishandles inline functions that call each other. E.g., for 'inline void f (void) { } inline void g (void) { f (); }', c99 incorrectly complains 'reference to static identifier "f" in extern inline function'. This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) on configurations that mistakenly use 'static inline' to implement functions or macros in standard C headers like <ctype.h>. For example, if isdigit is mistakenly implemented via a static inline function, a program containing an extern inline function that calls isdigit may not work since the C standard prohibits extern inline functions from calling static functions (ISO C 99 section 6.7.4.(3). This bug is known to occur on: OS X 10.8 and earlier; see: https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html DragonFly; see http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log FreeBSD; see: https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and for clang but remains for g++; see <https://trac.macports.org/ticket/41033>. Assume DragonFly and FreeBSD will be similar. GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline semantics, unless -fgnu89-inline is used. It defines a macro __GNUC_STDC_INLINE__ to indicate this situation or a macro __GNUC_GNU_INLINE__ to indicate the opposite situation. GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline semantics but warns, unless -fgnu89-inline is used: warning: C99 inline functions are not supported; using GNU89 warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. */ #if (((defined __APPLE__ && defined __MACH__) \ || defined __DragonFly__ || defined __FreeBSD__) \ && (defined __header_inline \ ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ && ! defined __clang__) \ : ((! defined _DONT_USE_CTYPE_INLINE_ \ && (defined __GNUC__ || defined __cplusplus)) \ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ && defined __GNUC__ && ! defined __cplusplus)))) # define _GL_EXTERN_INLINE_STDHEADER_BUG #endif #if ((__GNUC__ \ ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ : (199901L <= __STDC_VERSION__ \ && !defined __HP_cc \ && !defined __PGI \ && !(defined __SUNPRO_C && __STDC__))) \ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # define _GL_INLINE inline # define _GL_EXTERN_INLINE extern inline # define _GL_EXTERN_INLINE_IN_USE #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) # else # define _GL_INLINE extern inline # endif # define _GL_EXTERN_INLINE extern # define _GL_EXTERN_INLINE_IN_USE #else # define _GL_INLINE static _GL_UNUSED # define _GL_EXTERN_INLINE static _GL_UNUSED #endif /* In GCC 4.6 (inclusive) to 5.1 (exclusive), suppress bogus "no previous prototype for 'FOO'" and "no previous declaration for 'FOO'" diagnostics, when FOO is an inline function in the header; see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ #if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ # define _GL_INLINE_HEADER_CONST_PRAGMA # else # define _GL_INLINE_HEADER_CONST_PRAGMA \ _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") # endif # define _GL_INLINE_HEADER_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ _GL_INLINE_HEADER_CONST_PRAGMA # define _GL_INLINE_HEADER_END \ _Pragma ("GCC diagnostic pop") #else # define _GL_INLINE_HEADER_BEGIN # define _GL_INLINE_HEADER_END #endif]) ]) ������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/include_next.m4�������������������������������������������������������������0000664�0001750�0001750�00000021037�14670377440�017714� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# include_next.m4 serial 26 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert and Derek Price. dnl Sets INCLUDE_NEXT, INCLUDE_NEXT_AS_FIRST_DIRECTIVE, PRAGMA_SYSTEM_HEADER, dnl and PRAGMA_COLUMNS. dnl dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to dnl 'include' otherwise. dnl dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler dnl supports it in the special case that it is the first include directive in dnl the given file, or to 'include' otherwise. dnl dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next, dnl so as to avoid GCC warnings when the gcc option -pedantic is used. dnl '#pragma GCC system_header' has the same effect as if the file was found dnl through the include search path specified with '-isystem' options (as dnl opposed to the search path specified with '-I' options). Namely, gcc dnl does not warn about some things, and on some systems (Solaris and Interix) dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead dnl of plain '__STDC__'. dnl dnl PRAGMA_COLUMNS can be used in files that override system header files, so dnl as to avoid compilation errors on HP NonStop systems when the gnulib file dnl is included by a system header file that does a "#pragma COLUMNS 80" (which dnl has the effect of truncating the lines of that file and all files that it dnl includes to 80 columns) and the gnulib file has lines longer than 80 dnl columns. AC_DEFUN([gl_INCLUDE_NEXT], [ AC_LANG_PREPROC_REQUIRE() AC_CACHE_CHECK([whether the preprocessor supports include_next], [gl_cv_have_include_next], [rm -rf conftestd1a conftestd1b conftestd2 mkdir conftestd1a conftestd1b conftestd2 dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on dnl AIX 6.1 support include_next when used as first preprocessor directive dnl in a file, but not when preceded by another include directive. Check dnl for this bug by including <stdio.h>. dnl Additionally, with this same compiler, include_next is a no-op when dnl used in a header file that was included by specifying its absolute dnl file name. Despite these two bugs, include_next is used in the dnl compiler's <math.h>. By virtue of the second bug, we need to use dnl include_next as well in this case. cat <<EOF > conftestd1a/conftest.h #define DEFINED_IN_CONFTESTD1 #include_next <conftest.h> #ifdef DEFINED_IN_CONFTESTD2 int foo; #else #error "include_next doesn't work" #endif EOF cat <<EOF > conftestd1b/conftest.h #define DEFINED_IN_CONFTESTD1 #include <stdio.h> #include_next <conftest.h> #ifdef DEFINED_IN_CONFTESTD2 int foo; #else #error "include_next doesn't work" #endif EOF cat <<EOF > conftestd2/conftest.h #ifndef DEFINED_IN_CONFTESTD1 #error "include_next test doesn't work" #endif #define DEFINED_IN_CONFTESTD2 EOF gl_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" dnl We intentionally avoid using AC_LANG_SOURCE here. AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], [gl_cv_have_include_next=yes], [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], [gl_cv_have_include_next=buggy], [gl_cv_have_include_next=no]) ]) CPPFLAGS="$gl_save_CPPFLAGS" rm -rf conftestd1a conftestd1b conftestd2 ]) PRAGMA_SYSTEM_HEADER= if test $gl_cv_have_include_next = yes; then INCLUDE_NEXT=include_next INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next if test -n "$GCC"; then PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' fi else if test $gl_cv_have_include_next = buggy; then INCLUDE_NEXT=include INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next else INCLUDE_NEXT=include INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include fi fi AC_SUBST([INCLUDE_NEXT]) AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) AC_SUBST([PRAGMA_SYSTEM_HEADER]) dnl HP NonStop systems, which define __TANDEM, limit the line length dnl after including some system header files. AC_CACHE_CHECK([whether source code line length is unlimited], [gl_cv_source_line_length_unlimited], [AC_EGREP_CPP([choke me], [ #ifdef __TANDEM choke me #endif ], [gl_cv_source_line_length_unlimited=no], [gl_cv_source_line_length_unlimited=yes]) ]) if test $gl_cv_source_line_length_unlimited = no; then PRAGMA_COLUMNS="#pragma COLUMNS 10000" else PRAGMA_COLUMNS= fi AC_SUBST([PRAGMA_COLUMNS]) ]) # gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) # ------------------------------------------ # For each arg foo.h, if #include_next works, define NEXT_FOO_H to be # '<foo.h>'; otherwise define it to be # '"///usr/include/foo.h"', or whatever other absolute file name is suitable. # Also, if #include_next works as first preprocessing directive in a file, # define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to # be # '"///usr/include/foo.h"', or whatever other absolute file name is suitable. # That way, a header file with the following line: # #@INCLUDE_NEXT@ @NEXT_FOO_H@ # or # #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@ # behaves (after sed substitution) as if it contained # #include_next <foo.h> # even if the compiler does not support include_next. # The three "///" are to pacify Sun C 5.8, which otherwise would say # "warning: #include of /usr/include/... may be non-portable". # Use '""', not '<>', so that the /// cannot be confused with a C99 comment. # Note: This macro assumes that the header file is not empty after # preprocessing, i.e. it does not only define preprocessor macros but also # provides some type/enum definitions or function/variable declarations. # # This macro also checks whether each header exists, by invoking # AC_CHECK_HEADERS_ONCE or AC_CHECK_HEADERS on each argument. AC_DEFUN([gl_CHECK_NEXT_HEADERS], [ gl_NEXT_HEADERS_INTERNAL([$1], [check]) ]) # gl_NEXT_HEADERS(HEADER1 HEADER2 ...) # ------------------------------------ # Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist. # This is suitable for headers like <stddef.h> that are standardized by C89 # and therefore can be assumed to exist. AC_DEFUN([gl_NEXT_HEADERS], [ gl_NEXT_HEADERS_INTERNAL([$1], [assume]) ]) # The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS. AC_DEFUN([gl_NEXT_HEADERS_INTERNAL], [ AC_REQUIRE([gl_INCLUDE_NEXT]) AC_REQUIRE([AC_CANONICAL_HOST]) m4_if([$2], [check], [AC_CHECK_HEADERS_ONCE([$1]) ]) m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_next_header], [gl_cv_next_]m4_defn([gl_HEADER_NAME])) if test $gl_cv_have_include_next = yes; then AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) else AC_CACHE_CHECK( [absolute name of <]m4_defn([gl_HEADER_NAME])[>], [gl_next_header], [m4_if([$2], [check], [AS_VAR_PUSHDEF([gl_header_exists], [ac_cv_header_]m4_defn([gl_HEADER_NAME])) if test AS_VAR_GET([gl_header_exists]) = yes; then AS_VAR_POPDEF([gl_header_exists]) ]) gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME) AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME)) AS_VAR_SET([gl_next_header], ['"'$gl_header'"']) m4_if([$2], [check], [else AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) fi ]) ]) fi AC_SUBST( AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), [AS_VAR_GET([gl_next_header])]) if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'gl_HEADER_NAME'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=AS_VAR_GET([gl_next_header]) fi AC_SUBST( AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), [$gl_next_as_first_directive]) AS_VAR_POPDEF([gl_next_header])]) ]) # Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE; # this fallback is safe for all earlier autoconf versions. m4_define_default([AC_LANG_DEFINES_PROVIDED]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/stdio_h.m4������������������������������������������������������������������0000664�0001750�0001750�00000026242�14670377450�016670� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# stdio_h.m4 serial 56 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_STDIO_H], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AH_VERBATIM([MINGW_ANSI_STDIO], [/* Use GNU style printf and scanf. */ #ifndef __USE_MINGW_ANSI_STDIO # undef __USE_MINGW_ANSI_STDIO #endif ]) AC_DEFINE([__USE_MINGW_ANSI_STDIO]) gl_NEXT_HEADERS([stdio.h]) dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and dnl inttypes.h behave like gnu instead of system; we must give our dnl printf wrapper the right attribute to match. AC_CACHE_CHECK([which flavor of printf attribute matches inttypes macros], [gl_cv_func_printf_attribute_flavor], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #define __STDC_FORMAT_MACROS 1 #include <stdio.h> #include <inttypes.h> /* For non-mingw systems, compilation will trivially succeed. For mingw, compilation will succeed for older mingw (system printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */ #if (defined _WIN32 && ! defined __CYGWIN__) && \ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1]; #endif ]])], [gl_cv_func_printf_attribute_flavor=system], [gl_cv_func_printf_attribute_flavor=gnu])]) if test "$gl_cv_func_printf_attribute_flavor" = gnu; then AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1], [Define to 1 if printf and friends should be labeled with attribute "__gnu_printf__" instead of "__printf__"]) fi dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c" dnl "expected source file, required through AC_LIBSOURCES, not found". It is dnl also an optimization, to avoid performing a configure check whose result dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING dnl or GNULIB_NONBLOCKING redundant. m4_ifdef([gl_NONBLOCKING_IO], [ gl_NONBLOCKING_IO if test $gl_cv_have_nonblocking != yes; then REPLACE_STDIO_READ_FUNCS=1 AC_LIBOBJ([stdio-read]) fi ]) dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" dnl "expected source file, required through AC_LIBSOURCES, not found". It is dnl also an optimization, to avoid performing a configure check whose result dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or dnl GNULIB_SIGPIPE redundant. m4_ifdef([gl_SIGNAL_SIGPIPE], [ gl_SIGNAL_SIGPIPE if test $gl_cv_header_signal_h_SIGPIPE != yes; then REPLACE_STDIO_WRITE_FUNCS=1 AC_LIBOBJ([stdio-write]) fi ]) dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" dnl "expected source file, required through AC_LIBSOURCES, not found". It is dnl also an optimization, to avoid performing a configure check whose result dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING dnl or GNULIB_NONBLOCKING redundant. m4_ifdef([gl_NONBLOCKING_IO], [ gl_NONBLOCKING_IO if test $gl_cv_have_nonblocking != yes; then REPLACE_STDIO_WRITE_FUNCS=1 AC_LIBOBJ([stdio-write]) fi ]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by both C89 and C11. gl_WARN_ON_USE_PREPARE([[#include <stdio.h> ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen renameat snprintf tmpfile vdprintf vsnprintf]) AC_REQUIRE([AC_C_RESTRICT]) AC_CHECK_DECLS_ONCE([fcloseall]) if test $ac_cv_have_decl_fcloseall = no; then HAVE_DECL_FCLOSEALL=0 fi ]) # gl_STDIO_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STDIO_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_STDIO_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPURGE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREAD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREOPEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSCANF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEKO]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTCHAR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMOVE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FILENO], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETW], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTW], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TEMPNAM], [1]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_STDIO_H_DEFAULTS]) ]) AC_DEFUN([gl_STDIO_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_FCLOSEALL=1; AC_SUBST([HAVE_DECL_FCLOSEALL]) HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO]) HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) HAVE_PCLOSE=1; AC_SUBST([HAVE_PCLOSE]) HAVE_POPEN=1; AC_SUBST([HAVE_POPEN]) HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN]) REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE]) REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM]) REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR]) REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN]) REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF]) REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE]) REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME]) REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT]) REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) REPLACE_STDIO_READ_FUNCS=0; AC_SUBST([REPLACE_STDIO_READ_FUNCS]) REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE]) REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF]) REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF]) REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fstatat.m4������������������������������������������������������������������0000664�0001750�0001750�00000003752�14670377440�016705� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# fstatat.m4 serial 4 dnl Copyright (C) 2004-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Written by Jim Meyering. # If we have the fstatat function, and it has the bug (in AIX 7.1) # that it does not fill in st_size correctly, use the replacement function. AC_DEFUN([gl_FUNC_FSTATAT], [ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([fstatat]) if test $ac_cv_func_fstatat = no; then HAVE_FSTATAT=0 else dnl Test for an AIX 7.1 bug; see dnl <https://lists.gnu.org/r/bug-tar/2011-09/msg00015.html>. AC_CACHE_CHECK([whether fstatat (..., 0) works], [gl_cv_func_fstatat_zero_flag], [AC_RUN_IFELSE( [AC_LANG_SOURCE( [[ #include <fcntl.h> #include <sys/stat.h> int main (void) { struct stat a; return fstatat (AT_FDCWD, ".", &a, 0) != 0; } ]])], [gl_cv_func_fstatat_zero_flag=yes], [gl_cv_func_fstatat_zero_flag=no], [case "$host_os" in aix*) gl_cv_func_fstatat_zero_flag="guessing no";; *) gl_cv_func_fstatat_zero_flag="guessing yes";; esac ]) ]) case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in *yes+*yes) ;; *) REPLACE_FSTATAT=1 ;; esac case $host_os in solaris*) REPLACE_FSTATAT=1 ;; esac case $REPLACE_FSTATAT,$gl_cv_func_fstatat_zero_flag in 1,*yes) AC_DEFINE([HAVE_WORKING_FSTATAT_ZERO_FLAG], [1], [Define to 1 if fstatat (..., 0) works. For example, it does not work in AIX 7.1.]) ;; esac fi ]) ����������������������kbuild-3608/src/grep/m4/double-slash-root.m4��������������������������������������������������������0000664�0001750�0001750�00000003125�14670377440�020574� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# double-slash-root.m4 serial 4 -*- Autoconf -*- dnl Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_DOUBLE_SLASH_ROOT], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root], [ if test x"$cross_compiling" = xyes ; then # When cross-compiling, there is no way to tell whether // is special # short of a list of hosts. However, the only known hosts to date # that have a distinct // are Apollo DomainOS (too old to port to), # Cygwin, and z/OS. If anyone knows of another system for which // has # special semantics and is distinct from /, please report it to # <bug-gnulib@gnu.org>. case $host in *-cygwin | i370-ibm-openedition) gl_cv_double_slash_root=yes ;; *) # Be optimistic and assume that / and // are the same when we # don't know. gl_cv_double_slash_root='unknown, assuming no' ;; esac else set x `ls -di / // 2>/dev/null` if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then gl_cv_double_slash_root=no else gl_cv_double_slash_root=yes fi fi]) if test "$gl_cv_double_slash_root" = yes; then AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1], [Define to 1 if // is a file system root distinct from /.]) fi ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/btowc.m4��������������������������������������������������������������������0000664�0001750�0001750�00000005457�14670377450�016362� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# btowc.m4 serial 12 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_BTOWC], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) dnl Check whether <wchar.h> is usable at all, first. Otherwise the test dnl program below may lead to an endless loop. See dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) AC_CHECK_FUNCS_ONCE([btowc]) if test $ac_cv_func_btowc = no; then HAVE_BTOWC=0 else AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Cygwin 1.7.2 btowc('\0') is WEOF, not 0. AC_CACHE_CHECK([whether btowc(0) is correct], [gl_cv_func_btowc_nul], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <wchar.h> int main () { if (btowc ('\0') != 0) return 1; return 0; }]])], [gl_cv_func_btowc_nul=yes], [gl_cv_func_btowc_nul=no], [ changequote(,)dnl case "$host_os" in # Guess no on Cygwin. cygwin*) gl_cv_func_btowc_nul="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_btowc_nul="guessing yes" ;; # Guess yes otherwise. *) gl_cv_func_btowc_nul="guessing yes" ;; esac changequote([,])dnl ]) ]) dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF. AC_CACHE_CHECK([whether btowc(EOF) is correct], [gl_cv_func_btowc_eof], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on IRIX. irix*) gl_cv_func_btowc_eof="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_btowc_eof="guessing yes" ;; # Guess yes otherwise. *) gl_cv_func_btowc_eof="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <stdio.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { if (btowc (EOF) != WEOF) return 1; } return 0; }]])], [gl_cv_func_btowc_eof=yes], [gl_cv_func_btowc_eof=no], [:]) fi ]) case "$gl_cv_func_btowc_nul" in *yes) ;; *) REPLACE_BTOWC=1 ;; esac case "$gl_cv_func_btowc_eof" in *yes) ;; *) REPLACE_BTOWC=1 ;; esac fi ]) # Prerequisites of lib/btowc.c. AC_DEFUN([gl_PREREQ_BTOWC], [ : ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/opendir.m4������������������������������������������������������������������0000664�0001750�0001750�00000001701�14670377450�016670� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# opendir.m4 serial 5 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_OPENDIR], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS([opendir]) if test $ac_cv_func_opendir = no; then HAVE_OPENDIR=0 fi dnl Replace opendir() for supporting the gnulib-defined fchdir() function, dnl to keep fchdir's bookkeeping up-to-date. m4_ifdef([gl_FUNC_FCHDIR], [ gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then if test $HAVE_OPENDIR = 1; then REPLACE_OPENDIR=1 fi fi ]) dnl Replace opendir() on OS/2 kLIBC to support dirfd() function replaced dnl by gnulib. case $host_os,$HAVE_OPENDIR in os2*,1) REPLACE_OPENDIR=1;; esac ]) ���������������������������������������������������������������kbuild-3608/src/grep/m4/visibility.m4���������������������������������������������������������������0000664�0001750�0001750�00000006622�14670377450�017426� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# visibility.m4 serial 8 dnl Copyright (C) 2005, 2008, 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Tests whether the compiler supports the command-line option dnl -fvisibility=hidden and the function and variable attributes dnl __attribute__((__visibility__("hidden"))) and dnl __attribute__((__visibility__("default"))). dnl Does *not* test for __visibility__("protected") - which has tricky dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on dnl Mac OS X. dnl Does *not* test for __visibility__("internal") - which has processor dnl dependent semantics. dnl Does *not* test for #pragma GCC visibility push(hidden) - which is dnl "really only recommended for legacy code". dnl Set the variable CFLAG_VISIBILITY. dnl Defines and sets the variable HAVE_VISIBILITY. AC_DEFUN([gl_VISIBILITY], [ AC_REQUIRE([AC_PROG_CC]) CFLAG_VISIBILITY= HAVE_VISIBILITY=0 if test -n "$GCC"; then dnl First, check whether -Werror can be added to the command line, or dnl whether it leads to an error because of some other option that the dnl user has put into $CC $CFLAGS $CPPFLAGS. AC_CACHE_CHECK([whether the -Werror option is usable], [gl_cv_cc_vis_werror], [gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[]], [[]])], [gl_cv_cc_vis_werror=yes], [gl_cv_cc_vis_werror=no]) CFLAGS="$gl_save_CFLAGS" ]) dnl Now check whether visibility declarations are supported. AC_CACHE_CHECK([for simple visibility declarations], [gl_cv_cc_visibility], [gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" dnl We use the option -Werror and a function dummyfunc, because on some dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning dnl "visibility attribute not supported in this configuration; ignored" dnl at the first function definition in every compilation unit, and we dnl don't want to use the option in this case. if test $gl_cv_cc_vis_werror = yes; then CFLAGS="$CFLAGS -Werror" fi AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; extern __attribute__((__visibility__("default"))) int exportedvar; extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); extern __attribute__((__visibility__("default"))) int exportedfunc (void); void dummyfunc (void); int hiddenvar; int exportedvar; int hiddenfunc (void) { return 51; } int exportedfunc (void) { return 1225736919; } void dummyfunc (void) {} ]], [[]])], [gl_cv_cc_visibility=yes], [gl_cv_cc_visibility=no]) CFLAGS="$gl_save_CFLAGS" ]) if test $gl_cv_cc_visibility = yes; then CFLAG_VISIBILITY="-fvisibility=hidden" HAVE_VISIBILITY=1 fi fi AC_SUBST([CFLAG_VISIBILITY]) AC_SUBST([HAVE_VISIBILITY]) AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY], [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) ]) ��������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/pthread_h.m4����������������������������������������������������������������0000664�0001750�0001750�00000035404�14670377450�017175� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pthread_h.m4 serial 8 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_PTHREAD_H], [ dnl Ensure to expand the default settings once only, before all statements dnl that occur in other macros. AC_REQUIRE([gl_PTHREAD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_PTHREADLIB]) gl_CHECK_NEXT_HEADERS([pthread.h]) if test $ac_cv_header_pthread_h = yes; then HAVE_PTHREAD_H=1 dnl On mingw, if --enable-threads=windows or gl_AVOID_WINPTHREAD is used, dnl ignore the <pthread.h> from the mingw-w64 winpthreads library. m4_ifdef([gl_][THREADLIB], [ AC_REQUIRE([gl_][THREADLIB]) if { case "$host_os" in mingw*) true;; *) false;; esac; } \ && test $gl_threads_api = windows; then HAVE_PTHREAD_H=0 fi ]) else HAVE_PTHREAD_H=0 fi AC_SUBST([HAVE_PTHREAD_H]) AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], [], [], [AC_INCLUDES_DEFAULT[ #if HAVE_PTHREAD_H #include <pthread.h> #endif]]) if test $ac_cv_type_pthread_t != yes; then HAVE_PTHREAD_T=0 fi if test $ac_cv_type_pthread_spinlock_t != yes; then HAVE_PTHREAD_SPINLOCK_T=0 fi dnl Constants may be defined as C preprocessor macros or as enum items. AC_CACHE_CHECK([for PTHREAD_CREATE_DETACHED], [gl_cv_const_PTHREAD_CREATE_DETACHED], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <pthread.h> int x = PTHREAD_CREATE_DETACHED; ]], [[]])], [gl_cv_const_PTHREAD_CREATE_DETACHED=yes], [gl_cv_const_PTHREAD_CREATE_DETACHED=no]) ]) if test $gl_cv_const_PTHREAD_CREATE_DETACHED != yes; then HAVE_PTHREAD_CREATE_DETACHED=0 fi AC_CACHE_CHECK([for PTHREAD_MUTEX_RECURSIVE], [gl_cv_const_PTHREAD_MUTEX_RECURSIVE], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <pthread.h> int x = PTHREAD_MUTEX_RECURSIVE; ]], [[]])], [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=yes], [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=no]) ]) if test $gl_cv_const_PTHREAD_MUTEX_RECURSIVE != yes; then HAVE_PTHREAD_MUTEX_RECURSIVE=0 fi AC_CACHE_CHECK([for PTHREAD_MUTEX_ROBUST], [gl_cv_const_PTHREAD_MUTEX_ROBUST], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <pthread.h> int x = PTHREAD_MUTEX_ROBUST; ]], [[]])], [gl_cv_const_PTHREAD_MUTEX_ROBUST=yes], [gl_cv_const_PTHREAD_MUTEX_ROBUST=no]) ]) if test $gl_cv_const_PTHREAD_MUTEX_ROBUST != yes; then HAVE_PTHREAD_MUTEX_ROBUST=0 fi AC_CACHE_CHECK([for PTHREAD_PROCESS_SHARED], [gl_cv_const_PTHREAD_PROCESS_SHARED], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <pthread.h> int x = PTHREAD_PROCESS_SHARED; ]], [[]])], [gl_cv_const_PTHREAD_PROCESS_SHARED=yes], [gl_cv_const_PTHREAD_PROCESS_SHARED=no]) ]) if test $gl_cv_const_PTHREAD_PROCESS_SHARED != yes; then HAVE_PTHREAD_PROCESS_SHARED=0 fi dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, if it is not common dnl enough to be declared everywhere. gl_WARN_ON_USE_PREPARE([[#include <pthread.h> ]], [ pthread_create pthread_attr_init pthread_attr_getdetachstate pthread_attr_setdetachstate pthread_attr_destroy pthread_self pthread_equal pthread_detach pthread_join pthread_exit pthread_once pthread_mutex_init pthread_mutexattr_init pthread_mutexattr_gettype pthread_mutexattr_settype pthread_mutexattr_getrobust pthread_mutexattr_setrobust pthread_mutexattr_destroy pthread_mutex_lock pthread_mutex_trylock pthread_mutex_timedlock pthread_mutex_unlock pthread_mutex_destroy pthread_rwlock_init pthread_rwlockattr_init pthread_rwlockattr_destroy pthread_rwlock_rdlock pthread_rwlock_wrlock pthread_rwlock_tryrdlock pthread_rwlock_trywrlock pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock pthread_rwlock_unlock pthread_rwlock_destroy pthread_cond_init pthread_condattr_init pthread_condattr_destroy pthread_cond_wait pthread_cond_timedwait pthread_cond_signal pthread_cond_broadcast pthread_cond_destroy pthread_key_create pthread_setspecific pthread_getspecific pthread_key_delete pthread_spin_init pthread_spin_lock pthread_spin_trylock pthread_spin_unlock pthread_spin_destroy]) AC_REQUIRE([AC_C_RESTRICT]) dnl For backward compatibility with gnulib versions <= 2019-07. LIB_PTHREAD="$LIBPMULTITHREAD" AC_SUBST([LIB_PTHREAD]) ]) # gl_PTHREAD_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_PTHREAD_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_PTHREAD_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_PTHREAD_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_THREAD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_ONCE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_RWLOCK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_COND]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_TSS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SPIN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX_TIMEDLOCK]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_PTHREAD_H_DEFAULTS]) ]) AC_DEFUN([gl_PTHREAD_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_PTHREAD_T=1; AC_SUBST([HAVE_PTHREAD_T]) HAVE_PTHREAD_SPINLOCK_T=1; AC_SUBST([HAVE_PTHREAD_SPINLOCK_T]) HAVE_PTHREAD_CREATE_DETACHED=1; AC_SUBST([HAVE_PTHREAD_CREATE_DETACHED]) HAVE_PTHREAD_MUTEX_RECURSIVE=1; AC_SUBST([HAVE_PTHREAD_MUTEX_RECURSIVE]) HAVE_PTHREAD_MUTEX_ROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEX_ROBUST]) HAVE_PTHREAD_PROCESS_SHARED=1; AC_SUBST([HAVE_PTHREAD_PROCESS_SHARED]) HAVE_PTHREAD_CREATE=1; AC_SUBST([HAVE_PTHREAD_CREATE]) HAVE_PTHREAD_ATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_ATTR_INIT]) HAVE_PTHREAD_ATTR_GETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_GETDETACHSTATE]) HAVE_PTHREAD_ATTR_SETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_SETDETACHSTATE]) HAVE_PTHREAD_ATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_ATTR_DESTROY]) HAVE_PTHREAD_SELF=1; AC_SUBST([HAVE_PTHREAD_SELF]) HAVE_PTHREAD_EQUAL=1; AC_SUBST([HAVE_PTHREAD_EQUAL]) HAVE_PTHREAD_DETACH=1; AC_SUBST([HAVE_PTHREAD_DETACH]) HAVE_PTHREAD_JOIN=1; AC_SUBST([HAVE_PTHREAD_JOIN]) HAVE_PTHREAD_EXIT=1; AC_SUBST([HAVE_PTHREAD_EXIT]) HAVE_PTHREAD_ONCE=1; AC_SUBST([HAVE_PTHREAD_ONCE]) HAVE_PTHREAD_MUTEX_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEX_INIT]) HAVE_PTHREAD_MUTEXATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_INIT]) HAVE_PTHREAD_MUTEXATTR_GETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETTYPE]) HAVE_PTHREAD_MUTEXATTR_SETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETTYPE]) HAVE_PTHREAD_MUTEXATTR_GETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETROBUST]) HAVE_PTHREAD_MUTEXATTR_SETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETROBUST]) HAVE_PTHREAD_MUTEXATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_DESTROY]) HAVE_PTHREAD_MUTEX_LOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_LOCK]) HAVE_PTHREAD_MUTEX_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TRYLOCK]) HAVE_PTHREAD_MUTEX_TIMEDLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TIMEDLOCK]) HAVE_PTHREAD_MUTEX_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_UNLOCK]) HAVE_PTHREAD_MUTEX_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEX_DESTROY]) HAVE_PTHREAD_RWLOCK_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_INIT]) HAVE_PTHREAD_RWLOCKATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_INIT]) HAVE_PTHREAD_RWLOCKATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_DESTROY]) HAVE_PTHREAD_RWLOCK_RDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_RDLOCK]) HAVE_PTHREAD_RWLOCK_WRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_WRLOCK]) HAVE_PTHREAD_RWLOCK_TRYRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYRDLOCK]) HAVE_PTHREAD_RWLOCK_TRYWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYWRLOCK]) HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK]) HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK]) HAVE_PTHREAD_RWLOCK_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_UNLOCK]) HAVE_PTHREAD_RWLOCK_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_DESTROY]) HAVE_PTHREAD_COND_INIT=1; AC_SUBST([HAVE_PTHREAD_COND_INIT]) HAVE_PTHREAD_CONDATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_INIT]) HAVE_PTHREAD_CONDATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_DESTROY]) HAVE_PTHREAD_COND_WAIT=1; AC_SUBST([HAVE_PTHREAD_COND_WAIT]) HAVE_PTHREAD_COND_TIMEDWAIT=1; AC_SUBST([HAVE_PTHREAD_COND_TIMEDWAIT]) HAVE_PTHREAD_COND_SIGNAL=1; AC_SUBST([HAVE_PTHREAD_COND_SIGNAL]) HAVE_PTHREAD_COND_BROADCAST=1; AC_SUBST([HAVE_PTHREAD_COND_BROADCAST]) HAVE_PTHREAD_COND_DESTROY=1; AC_SUBST([HAVE_PTHREAD_COND_DESTROY]) HAVE_PTHREAD_KEY_CREATE=1; AC_SUBST([HAVE_PTHREAD_KEY_CREATE]) HAVE_PTHREAD_SETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_SETSPECIFIC]) HAVE_PTHREAD_GETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_GETSPECIFIC]) HAVE_PTHREAD_KEY_DELETE=1; AC_SUBST([HAVE_PTHREAD_KEY_DELETE]) HAVE_PTHREAD_SPIN_INIT=1; AC_SUBST([HAVE_PTHREAD_SPIN_INIT]) HAVE_PTHREAD_SPIN_LOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_LOCK]) HAVE_PTHREAD_SPIN_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_TRYLOCK]) HAVE_PTHREAD_SPIN_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_UNLOCK]) HAVE_PTHREAD_SPIN_DESTROY=1; AC_SUBST([HAVE_PTHREAD_SPIN_DESTROY]) REPLACE_PTHREAD_CREATE=0; AC_SUBST([REPLACE_PTHREAD_CREATE]) REPLACE_PTHREAD_ATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_ATTR_INIT]) REPLACE_PTHREAD_ATTR_GETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_GETDETACHSTATE]) REPLACE_PTHREAD_ATTR_SETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_SETDETACHSTATE]) REPLACE_PTHREAD_ATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_ATTR_DESTROY]) REPLACE_PTHREAD_SELF=0; AC_SUBST([REPLACE_PTHREAD_SELF]) REPLACE_PTHREAD_EQUAL=0; AC_SUBST([REPLACE_PTHREAD_EQUAL]) REPLACE_PTHREAD_DETACH=0; AC_SUBST([REPLACE_PTHREAD_DETACH]) REPLACE_PTHREAD_JOIN=0; AC_SUBST([REPLACE_PTHREAD_JOIN]) REPLACE_PTHREAD_EXIT=0; AC_SUBST([REPLACE_PTHREAD_EXIT]) REPLACE_PTHREAD_ONCE=0; AC_SUBST([REPLACE_PTHREAD_ONCE]) REPLACE_PTHREAD_MUTEX_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_INIT]) REPLACE_PTHREAD_MUTEXATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_INIT]) REPLACE_PTHREAD_MUTEXATTR_GETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETTYPE]) REPLACE_PTHREAD_MUTEXATTR_SETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETTYPE]) REPLACE_PTHREAD_MUTEXATTR_GETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETROBUST]) REPLACE_PTHREAD_MUTEXATTR_SETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETROBUST]) REPLACE_PTHREAD_MUTEXATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_DESTROY]) REPLACE_PTHREAD_MUTEX_LOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_LOCK]) REPLACE_PTHREAD_MUTEX_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TRYLOCK]) REPLACE_PTHREAD_MUTEX_TIMEDLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TIMEDLOCK]) REPLACE_PTHREAD_MUTEX_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_UNLOCK]) REPLACE_PTHREAD_MUTEX_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_DESTROY]) REPLACE_PTHREAD_RWLOCK_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_INIT]) REPLACE_PTHREAD_RWLOCKATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_INIT]) REPLACE_PTHREAD_RWLOCKATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_DESTROY]) REPLACE_PTHREAD_RWLOCK_RDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_RDLOCK]) REPLACE_PTHREAD_RWLOCK_WRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_WRLOCK]) REPLACE_PTHREAD_RWLOCK_TRYRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYRDLOCK]) REPLACE_PTHREAD_RWLOCK_TRYWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYWRLOCK]) REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK]) REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK]) REPLACE_PTHREAD_RWLOCK_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_UNLOCK]) REPLACE_PTHREAD_RWLOCK_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_DESTROY]) REPLACE_PTHREAD_COND_INIT=0; AC_SUBST([REPLACE_PTHREAD_COND_INIT]) REPLACE_PTHREAD_CONDATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_INIT]) REPLACE_PTHREAD_CONDATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_DESTROY]) REPLACE_PTHREAD_COND_WAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_WAIT]) REPLACE_PTHREAD_COND_TIMEDWAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_TIMEDWAIT]) REPLACE_PTHREAD_COND_SIGNAL=0; AC_SUBST([REPLACE_PTHREAD_COND_SIGNAL]) REPLACE_PTHREAD_COND_BROADCAST=0; AC_SUBST([REPLACE_PTHREAD_COND_BROADCAST]) REPLACE_PTHREAD_COND_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_COND_DESTROY]) REPLACE_PTHREAD_KEY_CREATE=0; AC_SUBST([REPLACE_PTHREAD_KEY_CREATE]) REPLACE_PTHREAD_SETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_SETSPECIFIC]) REPLACE_PTHREAD_GETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_GETSPECIFIC]) REPLACE_PTHREAD_KEY_DELETE=0; AC_SUBST([REPLACE_PTHREAD_KEY_DELETE]) REPLACE_PTHREAD_SPIN_INIT=0; AC_SUBST([REPLACE_PTHREAD_SPIN_INIT]) REPLACE_PTHREAD_SPIN_LOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_LOCK]) REPLACE_PTHREAD_SPIN_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_TRYLOCK]) REPLACE_PTHREAD_SPIN_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_UNLOCK]) REPLACE_PTHREAD_SPIN_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_SPIN_DESTROY]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/open-cloexec.m4�������������������������������������������������������������0000664�0001750�0001750�00000001323�14670377450�017611� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Test whether O_CLOEXEC is defined. dnl Copyright 2017-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_PREPROC_O_CLOEXEC], [ AC_CACHE_CHECK([for O_CLOEXEC], [gl_cv_macro_O_CLOEXEC], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <fcntl.h> #ifndef O_CLOEXEC choke me; #endif ]], [[return O_CLOEXEC;]])], [gl_cv_macro_O_CLOEXEC=yes], [gl_cv_macro_O_CLOEXEC=no])]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/windows-stat-inodes.m4������������������������������������������������������0000664�0001750�0001750�00000001420�14670377450�021150� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# windows-stat-inodes.m4 serial 1 dnl Copyright (C) 2017-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Enable inode identification in 'struct stat' on native Windows platforms. dnl Set WINDOWS_STAT_INODES to dnl - 0 -> keep the default (dev_t = 32-bit, ino_t = 16-bit), dnl - 1 -> override types normally (dev_t = 32-bit, ino_t = 64-bit), dnl - 2 -> override types in an extended way (dev_t = 64-bit, ino_t = 128-bit). AC_DEFUN([gl_WINDOWS_STAT_INODES], [ AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) WINDOWS_STAT_INODES=1 ;; *) WINDOWS_STAT_INODES=0 ;; esac ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/manywarnings.m4�������������������������������������������������������������0000664�0001750�0001750�00000014557�14670377450�017762� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# manywarnings.m4 serial 23 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Simon Josefsson # gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR) # -------------------------------------------------- # Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR. # Elements separated by whitespace. In set logic terms, the function # does OUTVAR = LISTVAR \ REMOVEVAR. AC_DEFUN([gl_MANYWARN_COMPLEMENT], [ gl_warn_set= set x $2; shift for gl_warn_item do case " $3 " in *" $gl_warn_item "*) ;; *) gl_AS_VAR_APPEND([gl_warn_set], [" $gl_warn_item"]) ;; esac done $1=$gl_warn_set ]) # gl_MANYWARN_ALL_GCC(VARIABLE) # ----------------------------- # Add all documented GCC warning parameters to variable VARIABLE. # Note that you need to test them using gl_WARN_ADD if you want to # make sure your gcc understands it. # # The effects of this macro depend on the current language (_AC_LANG). AC_DEFUN([gl_MANYWARN_ALL_GCC], [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) # Specialization for _AC_LANG = C. AC_DEFUN([gl_MANYWARN_ALL_GCC(C)], [ AC_LANG_PUSH([C]) dnl First, check for some issues that only occur when combining multiple dnl gcc warning categories. AC_REQUIRE([AC_PROG_CC]) if test -n "$GCC"; then dnl Check if -Wextra -Werror -Wno-missing-field-initializers is supported dnl with the current $CC $CFLAGS $CPPFLAGS. AC_CACHE_CHECK([whether -Wno-missing-field-initializers is supported], [gl_cv_cc_nomfi_supported], [gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wextra -Werror -Wno-missing-field-initializers" AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[]], [[]])], [gl_cv_cc_nomfi_supported=yes], [gl_cv_cc_nomfi_supported=no]) CFLAGS="$gl_save_CFLAGS" ]) if test "$gl_cv_cc_nomfi_supported" = yes; then dnl Now check whether -Wno-missing-field-initializers is needed dnl for the { 0, } construct. AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed], [gl_cv_cc_nomfi_needed], [gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wextra -Werror" AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[int f (void) { typedef struct { int a; int b; } s_t; s_t s1 = { 0, }; return s1.b; } ]], [[]])], [gl_cv_cc_nomfi_needed=no], [gl_cv_cc_nomfi_needed=yes]) CFLAGS="$gl_save_CFLAGS" ]) fi dnl Next, check if -Werror -Wuninitialized is useful with the dnl user's choice of $CFLAGS; some versions of gcc warn that it dnl has no effect if -O is not also used AC_CACHE_CHECK([whether -Wuninitialized is supported], [gl_cv_cc_uninitialized_supported], [gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror -Wuninitialized" AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[]], [[]])], [gl_cv_cc_uninitialized_supported=yes], [gl_cv_cc_uninitialized_supported=no]) CFLAGS="$gl_save_CFLAGS" ]) fi # List all gcc warning categories. # To compare this list to your installed GCC's, run this Bash command: # # comm -3 \ # <((sed -n 's/^ *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \ # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \ # <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort) $1= for gl_manywarn_item in -fanalyzer -fno-common \ -Wall \ -Warith-conversion \ -Wbad-function-cast \ -Wcast-align=strict \ -Wdate-time \ -Wdisabled-optimization \ -Wdouble-promotion \ -Wduplicated-branches \ -Wduplicated-cond \ -Wextra \ -Wformat-signedness \ -Winit-self \ -Winline \ -Winvalid-pch \ -Wlogical-op \ -Wmissing-declarations \ -Wmissing-include-dirs \ -Wmissing-prototypes \ -Wnested-externs \ -Wnull-dereference \ -Wold-style-definition \ -Wopenmp-simd \ -Woverlength-strings \ -Wpacked \ -Wpointer-arith \ -Wshadow \ -Wstack-protector \ -Wstrict-overflow \ -Wstrict-prototypes \ -Wsuggest-attribute=cold \ -Wsuggest-attribute=const \ -Wsuggest-attribute=format \ -Wsuggest-attribute=malloc \ -Wsuggest-attribute=noreturn \ -Wsuggest-attribute=pure \ -Wsuggest-final-methods \ -Wsuggest-final-types \ -Wsync-nand \ -Wsystem-headers \ -Wtrampolines \ -Wuninitialized \ -Wunknown-pragmas \ -Wunsafe-loop-optimizations \ -Wunused-macros \ -Wvariadic-macros \ -Wvector-operation-performance \ -Wvla \ -Wwrite-strings \ \ ; do gl_AS_VAR_APPEND([$1], [" $gl_manywarn_item"]) done # gcc --help=warnings outputs an unusual form for these options; list # them here so that the above 'comm' command doesn't report a false match. gl_AS_VAR_APPEND([$1], [' -Warray-bounds=2']) gl_AS_VAR_APPEND([$1], [' -Wattribute-alias=2']) gl_AS_VAR_APPEND([$1], [' -Wformat-overflow=2']) gl_AS_VAR_APPEND([$1], [' -Wformat=2']) gl_AS_VAR_APPEND([$1], [' -Wformat-truncation=2']) gl_AS_VAR_APPEND([$1], [' -Wimplicit-fallthrough=5']) gl_AS_VAR_APPEND([$1], [' -Wshift-overflow=2']) gl_AS_VAR_APPEND([$1], [' -Wunused-const-variable=2']) gl_AS_VAR_APPEND([$1], [' -Wvla-larger-than=4031']) # These are needed for older GCC versions. if test -n "$GCC"; then case `($CC --version) 2>/dev/null` in 'gcc (GCC) '[[0-3]].* | \ 'gcc (GCC) '4.[[0-7]].*) gl_AS_VAR_APPEND([$1], [' -fdiagnostics-show-option']) gl_AS_VAR_APPEND([$1], [' -funit-at-a-time']) ;; esac fi # Disable specific options as needed. if test "$gl_cv_cc_nomfi_needed" = yes; then gl_AS_VAR_APPEND([$1], [' -Wno-missing-field-initializers']) fi if test "$gl_cv_cc_uninitialized_supported" = no; then gl_AS_VAR_APPEND([$1], [' -Wno-uninitialized']) fi # This warning have too many false alarms in GCC 11.2.1. # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101713 gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-malloc-leak']) AC_LANG_POP([C]) ]) # Specialization for _AC_LANG = C++. AC_DEFUN([gl_MANYWARN_ALL_GCC(C++)], [ gl_MANYWARN_ALL_GCC_CXX_IMPL([$1]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/thread.m4�������������������������������������������������������������������0000664�0001750�0001750�00000000761�14670377450�016504� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# thread.m4 serial 3 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_THREAD], [ AC_REQUIRE([gl_THREADLIB]) if test $gl_threads_api = posix; then gl_save_LIBS="$LIBS" LIBS="$LIBS $LIBMULTITHREAD" AC_CHECK_FUNCS([pthread_atfork]) LIBS="$gl_save_LIBS" fi ]) ���������������kbuild-3608/src/grep/m4/codeset.m4������������������������������������������������������������������0000664�0001750�0001750�00000001525�14670377440�016661� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# codeset.m4 serial 5 (gettext-0.18.2) dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2021 Free Software dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <langinfo.h>]], [[char* cs = nl_langinfo(CODESET); return !cs;]])], [am_cv_langinfo_codeset=yes], [am_cv_langinfo_codeset=no]) ]) if test $am_cv_langinfo_codeset = yes; then AC_DEFINE([HAVE_LANGINFO_CODESET], [1], [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) fi ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/open-slash.m4���������������������������������������������������������������0000664�0001750�0001750�00000003455�14670377450�017311� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# open-slash.m4 serial 2 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Tests whether open() and creat() recognize a trailing slash. dnl Sets gl_cv_func_open_slash. AC_DEFUN([gl_OPEN_TRAILING_SLASH_BUG], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl open("foo/") should not create a file when the file name has a dnl trailing slash. FreeBSD only has the problem on symlinks. AC_CHECK_FUNCS_ONCE([lstat]) AC_CACHE_CHECK([whether open recognizes a trailing slash], [gl_cv_func_open_slash], [# Assume that if we have lstat, we can also check symlinks. if test $ac_cv_func_lstat = yes; then touch conftest.tmp ln -s conftest.tmp conftest.lnk fi AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <fcntl.h> #if HAVE_UNISTD_H # include <unistd.h> #endif ]GL_MDA_DEFINES[ int main () { int result = 0; #if HAVE_LSTAT if (open ("conftest.lnk/", O_RDONLY) != -1) result |= 1; #endif if (open ("conftest.sl/", O_CREAT, 0600) >= 0) result |= 2; return result; }]])], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no], [ changequote(,)dnl case "$host_os" in freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) gl_cv_func_open_slash="guessing no" ;; *) gl_cv_func_open_slash="guessing yes" ;; esac changequote([,])dnl ]) rm -f conftest.sl conftest.tmp conftest.lnk ]) case "$gl_cv_func_open_slash" in *no) AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1], [Define to 1 if open() fails to recognize a trailing slash.]) ;; esac ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/00gnulib.m4�����������������������������������������������������������������0000664�0001750�0001750�00000007011�14670377440�016647� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# 00gnulib.m4 serial 8 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This file must be named something that sorts before all other dnl gnulib-provided .m4 files. It is needed until the clang fix has dnl been included in Autoconf. # The following definitions arrange to use a compiler option # -Werror=implicit-function-declaration in AC_CHECK_DECL, when the # compiler is clang. Without it, clang implicitly declares "known" # library functions in C mode, but not in C++ mode, which would cause # Gnulib to omit a declaration and thus later produce an error in C++ # mode. As of clang 9.0, these "known" functions are identified through # LIBBUILTIN invocations in the LLVM source file # llvm/tools/clang/include/clang/Basic/Builtins.def. # It's not possible to AC_REQUIRE the extra tests from AC_CHECK_DECL, # because AC_CHECK_DECL, like other Autoconf built-ins, is not supposed # to AC_REQUIRE anything: some configure.ac files have their first # AC_CHECK_DECL executed conditionally. Therefore append the extra tests # to AC_PROG_CC. AC_DEFUN([gl_COMPILER_CLANG], [ dnl AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK([whether the compiler is clang], [gl_cv_compiler_clang], [dnl Use _AC_COMPILE_IFELSE instead of AC_EGREP_CPP, to avoid error dnl "circular dependency of AC_LANG_COMPILER(C)" if AC_PROG_CC has dnl not yet been invoked. _AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ #ifdef __clang__ barfbarf #endif ]],[[]]) ], [gl_cv_compiler_clang=no], [gl_cv_compiler_clang=yes]) ]) ]) AC_DEFUN([gl_COMPILER_PREPARE_CHECK_DECL], [ dnl AC_REQUIRE([AC_PROG_CC]) dnl AC_REQUIRE([gl_COMPILER_CLANG]) AC_CACHE_CHECK([for compiler option needed when checking for declarations], [gl_cv_compiler_check_decl_option], [if test $gl_cv_compiler_clang = yes; then dnl Test whether the compiler supports the option dnl '-Werror=implicit-function-declaration'. save_ac_compile="$ac_compile" ac_compile="$ac_compile -Werror=implicit-function-declaration" dnl Use _AC_COMPILE_IFELSE instead of AC_COMPILE_IFELSE, to avoid a dnl warning "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], [gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'], [gl_cv_compiler_check_decl_option=none]) ac_compile="$save_ac_compile" else gl_cv_compiler_check_decl_option=none fi ]) if test "x$gl_cv_compiler_check_decl_option" != xnone; then ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option" else ac_compile_for_check_decl="$ac_compile" fi ]) dnl Redefine _AC_CHECK_DECL_BODY so that it references ac_compile_for_check_decl dnl instead of ac_compile. If, for whatever reason, the override of AC_PROG_CC dnl in zzgnulib.m4 is inactive, use the original ac_compile. m4_define([_AC_CHECK_DECL_BODY], [ ac_save_ac_compile="$ac_compile" if test -n "$ac_compile_for_check_decl"; then ac_compile="$ac_compile_for_check_decl" fi] m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_save_ac_compile" ]) # gl_00GNULIB # ----------- # Witness macro that this file has been included. Needed to force # Automake to include this file prior to all other gnulib .m4 files. AC_DEFUN([gl_00GNULIB]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/lseek.m4��������������������������������������������������������������������0000664�0001750�0001750�00000004377�14670377450�016347� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# lseek.m4 serial 11 dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_LSEEK], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_CC]) AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], [case "$host_os" in mingw*) dnl Native Windows. dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT) dnl for a pipe depends on the environment: In a Cygwin 1.5 dnl environment it succeeds (wrong); in a Cygwin 1.7 environment dnl it fails with a wrong errno value. gl_cv_func_lseek_pipe=no ;; *) if test $cross_compiling = no; then AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> /* for off_t */ #include <stdio.h> /* for SEEK_CUR */ #if HAVE_UNISTD_H # include <unistd.h> #else /* on Windows with MSVC */ # include <io.h> #endif ]GL_MDA_DEFINES], [[ /* Exit with success only if stdin is seekable. */ return lseek (0, (off_t)0, SEEK_CUR) < 0; ]])], [if test -s conftest$ac_exeext \ && ./conftest$ac_exeext < conftest.$ac_ext \ && test 1 = "`echo hi \ | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then gl_cv_func_lseek_pipe=yes else gl_cv_func_lseek_pipe=no fi ], [gl_cv_func_lseek_pipe=no]) else AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[ #if defined __BEOS__ /* BeOS mistakenly return 0 when trying to seek on pipes. */ Choke me. #endif]])], [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no]) fi ;; esac ]) if test $gl_cv_func_lseek_pipe = no; then REPLACE_LSEEK=1 AC_DEFINE([LSEEK_PIPE_BROKEN], [1], [Define to 1 if lseek does not detect pipes.]) fi AC_REQUIRE([gl_SYS_TYPES_H]) if test $WINDOWS_64_BIT_OFF_T = 1; then REPLACE_LSEEK=1 fi ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/readdir.m4������������������������������������������������������������������0000664�0001750�0001750�00000000670�14670377450�016646� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# readdir.m4 serial 1 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_READDIR], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) AC_CHECK_FUNCS([readdir]) if test $ac_cv_func_readdir = no; then HAVE_READDIR=0 fi ]) ������������������������������������������������������������������������kbuild-3608/src/grep/m4/mbtowc.m4�������������������������������������������������������������������0000664�0001750�0001750�00000001063�14670377450�016524� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mbtowc.m4 serial 3 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MBTOWC], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_CHECK_FUNCS([mbtowc]) if test $ac_cv_func_mbtowc = no; then HAVE_MBTOWC=0 else if false; then REPLACE_MBTOWC=1 fi fi ]) # Prerequisites of lib/mbtowc.c. AC_DEFUN([gl_PREREQ_MBTOWC], [ : ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/rawmemchr.m4����������������������������������������������������������������0000664�0001750�0001750�00000001163�14670377450�017217� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# rawmemchr.m4 serial 3 dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_RAWMEMCHR], [ dnl Persuade glibc <string.h> to declare rawmemchr(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS([rawmemchr]) if test $ac_cv_func_rawmemchr = no; then HAVE_RAWMEMCHR=0 fi ]) # Prerequisites of lib/strchrnul.c. AC_DEFUN([gl_PREREQ_RAWMEMCHR], [:]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/quote.m4��������������������������������������������������������������������0000664�0001750�0001750�00000000573�14670377450�016373� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# quote.m4 serial 6 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_QUOTE], [ dnl Prerequisites of lib/quote.c. dnl (none) : ]) �������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/strtoimax.m4����������������������������������������������������������������0000664�0001750�0001750�00000004614�14670377450�017270� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# strtoimax.m4 serial 16 dnl Copyright (C) 2002-2004, 2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOIMAX], [ AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) dnl On OSF/1 5.1 with cc, this function is declared but not defined. AC_CHECK_FUNCS_ONCE([strtoimax]) AC_CHECK_DECLS_ONCE([strtoimax]) if test "$ac_cv_have_decl_strtoimax" != yes; then HAVE_DECL_STRTOIMAX=0 fi if test "$ac_cv_func_strtoimax" = yes; then HAVE_STRTOIMAX=1 dnl On AIX 5.1, strtoimax() fails for values outside the 'int' range. AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether strtoimax works], [gl_cv_func_strtoimax], [AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <errno.h> #include <string.h> #include <inttypes.h> int main () { if (sizeof (intmax_t) > sizeof (int)) { const char *s = "4294967295"; char *p; intmax_t res; errno = 0; res = strtoimax (s, &p, 10); if (p != s + strlen (s)) return 1; if (errno != 0) return 2; if (res != (intmax_t) 65535 * (intmax_t) 65537) return 3; } else { const char *s = "2147483647"; char *p; intmax_t res; errno = 0; res = strtoimax (s, &p, 10); if (p != s + strlen (s)) return 1; if (errno != 0) return 2; if (res != 2147483647) return 3; } return 0; } ]])], [gl_cv_func_strtoimax=yes], [gl_cv_func_strtoimax=no], [case "$host_os" in # Guess no on AIX 5. aix5*) gl_cv_func_strtoimax="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_strtoimax="guessing yes" ;; # Guess yes otherwise. *) gl_cv_func_strtoimax="guessing yes" ;; esac ]) ]) case "$gl_cv_func_strtoimax" in *no) REPLACE_STRTOIMAX=1 ;; esac else if test "$ac_cv_have_decl_strtoimax" = yes; then # HP-UX 11.11 has "#define strtoimax(...) ..." but no function. REPLACE_STRTOIMAX=1 fi HAVE_STRTOIMAX=0 fi ]) # Prerequisites of lib/strtoimax.c. AC_DEFUN([gl_PREREQ_STRTOIMAX], [ AC_CHECK_DECLS([strtoll]) ]) ��������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/safe-read.m4����������������������������������������������������������������0000664�0001750�0001750�00000000631�14670377450�017060� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# safe-read.m4 serial 6 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Prerequisites of lib/safe-read.c. AC_DEFUN([gl_PREREQ_SAFE_READ], [ AC_REQUIRE([gt_TYPE_SSIZE_T]) ]) �������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/strtoll.m4������������������������������������������������������������������0000664�0001750�0001750�00000003002�14670377450�016727� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# strtoll.m4 serial 9 dnl Copyright (C) 2002, 2004, 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOLL], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS([strtoll]) if test $ac_cv_func_strtoll = yes; then AC_CACHE_CHECK([whether strtoll works], [gl_cv_func_strtoll_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <stdlib.h>]], [[int result = 0; char *term; /* This test fails on Minix and native Windows. */ { const char input[] = "0x"; (void) strtoll (input, &term, 16); if (term != input + 1) result |= 1; } return result; ]]) ], [gl_cv_func_strtoll_works=yes], [gl_cv_func_strtoll_works=no], [case "$host_os" in # Guess no on native Windows. mingw*) gl_cv_func_strtoll_works="guessing no" ;; *) gl_cv_func_strtoll_works="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_strtoll_works" in *yes) ;; *) REPLACE_STRTOLL=1 ;; esac else HAVE_STRTOLL=0 fi ]) # Prerequisites of lib/strtoll.c. AC_DEFUN([gl_PREREQ_STRTOLL], [ : ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sigaction.m4����������������������������������������������������������������0000664�0001750�0001750�00000002325�14670377450�017213� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sigaction.m4 serial 7 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Determine if sigaction interface is present. AC_DEFUN([gl_SIGACTION], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([sigaction]) if test $ac_cv_func_sigaction = yes; then AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , , [[#include <signal.h>]]) if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then HAVE_STRUCT_SIGACTION_SA_SIGACTION=0 fi else HAVE_SIGACTION=0 fi ]) # Prerequisites of the part of lib/signal.in.h and of lib/sigaction.c. AC_DEFUN([gl_PREREQ_SIGACTION], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_TYPE_UID_T]) AC_REQUIRE([gl_PREREQ_SIG_HANDLER_H]) AC_CHECK_FUNCS_ONCE([sigaltstack siginterrupt]) AC_CHECK_TYPES([siginfo_t], [], [], [[ #include <signal.h> ]]) if test $ac_cv_type_siginfo_t = no; then HAVE_SIGINFO_T=0 fi ]) # Prerequisites of lib/sig-handler.h. AC_DEFUN([gl_PREREQ_SIG_HANDLER_H], [:]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/libsigsegv.m4���������������������������������������������������������������0000664�0001750�0001750�00000001153�14670377450�017367� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# libsigsegv.m4 serial 4 dnl Copyright (C) 2002-2003, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible, Sam Steingold. AC_DEFUN([gl_LIBSIGSEGV], [ AC_LIB_HAVE_LINKFLAGS([sigsegv], [], [#include <sigsegv.h>], [sigsegv_deinstall_handler();], [no, consider installing GNU libsigsegv]) dnl Some other autoconf macros and clisp's configure use this variable. gl_cv_lib_sigsegv="$ac_cv_libsigsegv" ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/lib-link.m4�����������������������������������������������������������������0000664�0001750�0001750�00000105607�14670377450�016743� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# lib-link.m4 serial 32 dnl Copyright (C) 2001-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_PREREQ([2.61]) dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and dnl augments the CPPFLAGS variable. dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) pushdef([Name],[m4_translit([$1],[./+-], [____])]) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ac_cv_lib[]Name[]_libs="$LIB[]NAME" ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" ac_cv_lib[]Name[]_cppflags="$INC[]NAME" ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" ]) LIB[]NAME="$ac_cv_lib[]Name[]_libs" LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" INC[]NAME="$ac_cv_lib[]Name[]_cppflags" LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) AC_SUBST([LIB]NAME[_PREFIX]) dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the dnl results of this search when this library appears as a dependency. HAVE_LIB[]NAME=yes popdef([NAME]) popdef([Name]) ]) dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message]) dnl searches for libname and the libraries corresponding to explicit and dnl implicit dependencies, together with the specified include files and dnl the ability to compile and link the specified testcode. The missing-message dnl defaults to 'no' and may contain additional hints for the user. dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) pushdef([Name],[m4_translit([$1],[./+-], [____])]) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME dnl accordingly. AC_LIB_LINKFLAGS_BODY([$1], [$2]) dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, dnl because if the user has installed lib[]Name and not disabled its use dnl via --without-lib[]Name-prefix, he wants to use it. ac_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ ac_save_LIBS="$LIBS" dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, dnl because these -l options might require -L options that are present in dnl LIBS. -l options benefit only from the -L options listed before it. dnl Otherwise, add it to the front of LIBS, because it may be a static dnl library that depends on another static library that is present in LIBS. dnl Static libraries benefit only from the static libraries listed after dnl it. case " $LIB[]NAME" in *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; *) LIBS="$LIB[]NAME $LIBS" ;; esac AC_LINK_IFELSE( [AC_LANG_PROGRAM([[$3]], [[$4]])], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) LIBS="$ac_save_LIBS" ]) if test "$ac_cv_lib[]Name" = yes; then HAVE_LIB[]NAME=yes AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.]) AC_MSG_CHECKING([how to link with lib[]$1]) AC_MSG_RESULT([$LIB[]NAME]) else HAVE_LIB[]NAME=no dnl If $LIB[]NAME didn't lead to a usable library, we don't need dnl $INC[]NAME either. CPPFLAGS="$ac_save_CPPFLAGS" LIB[]NAME= LTLIB[]NAME= LIB[]NAME[]_PREFIX= fi AC_SUBST([HAVE_LIB]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) AC_SUBST([LIB]NAME[_PREFIX]) popdef([NAME]) popdef([Name]) ]) dnl Determine the platform dependent parameters needed to use rpath: dnl acl_libext, dnl acl_shlibext, dnl acl_libname_spec, dnl acl_library_names_spec, dnl acl_hardcode_libdir_flag_spec, dnl acl_hardcode_libdir_separator, dnl acl_hardcode_direct, dnl acl_hardcode_minus_L. AC_DEFUN([AC_LIB_RPATH], [ dnl Complain if config.rpath is missing. AC_REQUIRE_AUX_FILE([config.rpath]) AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ]) wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. AC_ARG_ENABLE([rpath], [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) dnl AC_LIB_FROMPACKAGE(name, package) dnl declares that libname comes from the given package. The configure file dnl will then not have a --with-libname-prefix option but a dnl --with-package-prefix option. Several libraries can come from the same dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar dnl macro call that searches for libname. AC_DEFUN([AC_LIB_FROMPACKAGE], [ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_frompackage_]NAME, [$2]) popdef([NAME]) pushdef([PACK],[$2]) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_libsinpackage_]PACKUP, m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) popdef([PACKUP]) popdef([PACK]) ]) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) AC_ARG_WITH(PACK[-prefix], [[ --with-]]PACK[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib --without-]]PACK[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" additional_libdir2="$withval/$acl_libdirstem2" additional_libdir3="$withval/$acl_libdirstem3" fi fi ]) if test "X$additional_libdir2" = "X$additional_libdir"; then additional_libdir2= fi if test "X$additional_libdir3" = "X$additional_libdir"; then additional_libdir3= fi dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= LTLIB[]NAME= INC[]NAME= LIB[]NAME[]_PREFIX= dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been dnl computed. So it has to be reset here. HAVE_LIB[]NAME= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. : fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do if test "X$found_dir" = "X"; then eval dir=\$$additional_libdir_variable if test -n "$dir"; then dnl The same code as in the loop below: dnl First look for a shared library. if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi dnl Then look for a static library. if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi fi done fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` dnl First look for a shared library. if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi dnl Then look for a static library. if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then dnl Found the library. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. if test "$acl_hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else dnl Rely on "-L$found_dir". dnl But don't add it if it's already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem3 | */$acl_libdirstem3/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi fi fi dnl Look for dependencies. if test -n "$found_la"; then dnl Read the .la file. It defines the variables dnl dlname, library_names, old_library, dependency_libs, current, dnl age, revision, installed, dlopen, dlpreopen, libdir. save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" dnl We use only dependency_libs. for dep in $dependency_libs; do case "$dep" in -L*) dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then dnl Really add $dependency_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then dnl Really add $dependency_libdir to $LTLIBNAME. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dnl Handle this in the next round. dnl But on GNU systems, ignore -lc options, because dnl - linking with libc is the default anyway, dnl - linking with libc.a may produce an error dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie" dnl or may produce an executable that always crashes, see dnl <https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00052.html>. dep=`echo "X$dep" | sed -e 's/^X-l//'` if test "X$dep" != Xc \ || case $host_os in linux* | gnu* | k*bsd*-gnu) false ;; *) true ;; esac; then names_next_round="$names_next_round $dep" fi ;; *.la) dnl Handle this in the next round. Throw away the .la's dnl directory; it is already contained in a preceding -L dnl option. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done fi else dnl Didn't find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else dnl The -rpath options are cumulative. for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then dnl When using libtool, the option that works for both libraries and dnl executables is -R. The -R options are cumulative. for found_dir in $ltrpathdirs; do LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi popdef([PACKLIBS]) popdef([PACKUP]) popdef([PACK]) popdef([NAME]) ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, dnl unless already present in VAR. dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes dnl contains two or three consecutive elements that belong together. AC_DEFUN([AC_LIB_APPENDTOVAR], [ for element in [$2]; do haveit= for x in $[$1]; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then [$1]="${[$1]}${[$1]:+ }$element" fi done ]) dnl For those cases where a variable contains several -L and -l options dnl referring to unknown libraries and directories, this macro determines the dnl necessary additional linker options for the runtime path. dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) dnl sets LDADDVAR to linker options needed together with LIBSVALUE. dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, dnl otherwise linking without libtool is assumed. AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], [ AC_REQUIRE([AC_LIB_RPATH]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) $1= if test "$enable_rpath" != no; then if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode directories into the resulting dnl binary. rpathdirs= next= for opt in $2; do if test -n "$next"; then dir="$next" dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ && test "X$dir" != "X/usr/$acl_libdirstem2" \ && test "X$dir" != "X/usr/$acl_libdirstem3"; then rpathdirs="$rpathdirs $dir" fi next= else case $opt in -L) next=yes ;; -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ && test "X$dir" != "X/usr/$acl_libdirstem2" \ && test "X$dir" != "X/usr/$acl_libdirstem3"; then rpathdirs="$rpathdirs $dir" fi next= ;; *) next= ;; esac fi done if test "X$rpathdirs" != "X"; then if test -n ""$3""; then dnl libtool is used for linking. Use -R options. for dir in $rpathdirs; do $1="${$1}${$1:+ }-R$dir" done else dnl The linker is used for linking directly. if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user dnl must pass all path elements in one option. alldirs= for dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="$flag" else dnl The -rpath options are cumulative. for dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="${$1}${$1:+ }$flag" done fi fi fi fi fi AC_SUBST([$1]) ]) �������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/environ.m4������������������������������������������������������������������0000664�0001750�0001750�00000002606�14670377440�016714� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# environ.m4 serial 8 dnl Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_ENVIRON], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl Persuade glibc <unistd.h> to declare environ. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_HEADERS_ONCE([unistd.h]) gt_CHECK_VAR_DECL( [#if HAVE_UNISTD_H #include <unistd.h> #endif /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ #include <stdlib.h> ], [environ]) if test $gt_cv_var_environ_declaration != yes; then HAVE_DECL_ENVIRON=0 fi ]) # Check if a variable is properly declared. # gt_CHECK_VAR_DECL(includes,variable) AC_DEFUN([gt_CHECK_VAR_DECL], [ define([gt_cv_var], [gt_cv_var_]$2[_declaration]) AC_CACHE_CHECK([if $2 is properly declared], [gt_cv_var], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[$1 typedef struct { int foo; } foo_t; extern foo_t $2;]], [[$2.foo = 1;]])], [gt_cv_var=no], [gt_cv_var=yes])]) if test $gt_cv_var = yes; then AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1, [Define if you have the declaration of $2.]) fi undefine([gt_cv_var]) ]) ��������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/strtoumax.m4����������������������������������������������������������������0000664�0001750�0001750�00000001530�14670377450�017276� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# strtoumax.m4 serial 13 dnl Copyright (C) 2002-2004, 2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOUMAX], [ AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) dnl On OSF/1 5.1 with cc, this function is declared but not defined. AC_CHECK_FUNCS_ONCE([strtoumax]) AC_CHECK_DECLS_ONCE([strtoumax]) if test "$ac_cv_have_decl_strtoumax" = yes; then if test "$ac_cv_func_strtoumax" != yes; then # HP-UX 11.11 has "#define strtoimax(...) ..." but no function. REPLACE_STRTOUMAX=1 fi else HAVE_DECL_STRTOUMAX=0 fi ]) # Prerequisites of lib/strtoumax.c. AC_DEFUN([gl_PREREQ_STRTOUMAX], [ AC_CHECK_DECLS([strtoull]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/open.m4���������������������������������������������������������������������0000664�0001750�0001750�00000002765�14670377450�016204� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# open.m4 serial 15 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_OPEN], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) case "$host_os" in mingw* | pw*) REPLACE_OPEN=1 ;; *) dnl open("foo/") should not create a file when the file name has a dnl trailing slash. FreeBSD only has the problem on symlinks. AC_CHECK_FUNCS_ONCE([lstat]) if test "$gl_cv_macro_O_CLOEXEC" != yes; then REPLACE_OPEN=1 fi gl_OPEN_TRAILING_SLASH_BUG case "$gl_cv_func_open_slash" in *no) REPLACE_OPEN=1 ;; esac ;; esac dnl Replace open() for supporting the gnulib-defined fchdir() function, dnl to keep fchdir's bookkeeping up-to-date. m4_ifdef([gl_FUNC_FCHDIR], [ if test $REPLACE_OPEN = 0; then gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then REPLACE_OPEN=1 fi fi ]) dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag. m4_ifdef([gl_NONBLOCKING_IO], [ if test $REPLACE_OPEN = 0; then gl_NONBLOCKING_IO if test $gl_cv_have_open_O_NONBLOCK != yes; then REPLACE_OPEN=1 fi fi ]) ]) # Prerequisites of lib/open.c. AC_DEFUN([gl_PREREQ_OPEN], [ AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) : ]) �����������kbuild-3608/src/grep/m4/sys_time_h.m4���������������������������������������������������������������0000664�0001750�0001750�00000010420�14670377450�017371� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Configure a replacement for <sys/time.h>. # serial 12 # Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert and Martin Lambers. AC_DEFUN_ONCE([gl_SYS_TIME_H], [ dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1 dnl statements that occur in other macros. AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) AC_CHECK_HEADERS_ONCE([sys/time.h]) gl_CHECK_NEXT_HEADERS([sys/time.h]) if test $ac_cv_header_sys_time_h != yes; then HAVE_SYS_TIME_H=0 fi dnl On native Windows with MSVC, 'struct timeval' is defined in <winsock2.h> dnl only. So include that header in the list. gl_PREREQ_SYS_H_WINSOCK2 AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#if HAVE_SYS_TIME_H #include <sys/time.h> #endif #include <time.h> #if HAVE_WINSOCK2_H # include <winsock2.h> #endif ]], [[static struct timeval x; x.tv_sec = x.tv_usec;]])], [gl_cv_sys_struct_timeval=yes], [gl_cv_sys_struct_timeval=no]) ]) if test $gl_cv_sys_struct_timeval != yes; then HAVE_STRUCT_TIMEVAL=0 else dnl On native Windows with a 64-bit 'time_t', 'struct timeval' is defined dnl (in <sys/time.h> and <winsock2.h> for mingw64, in <winsock2.h> only dnl for MSVC) with a tv_sec field of type 'long' (32-bit!), which is dnl smaller than the 'time_t' type mandated by POSIX. dnl On OpenBSD 5.1 amd64, tv_sec is 64 bits and time_t 32 bits, but dnl that is good enough. AC_CACHE_CHECK([for wide-enough struct timeval.tv_sec member], [gl_cv_sys_struct_timeval_tv_sec], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#if HAVE_SYS_TIME_H #include <sys/time.h> #endif #include <time.h> #if HAVE_WINSOCK2_H # include <winsock2.h> #endif ]], [[static struct timeval x; typedef int verify_tv_sec_type[ sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1 ]; ]])], [gl_cv_sys_struct_timeval_tv_sec=yes], [gl_cv_sys_struct_timeval_tv_sec=no]) ]) if test $gl_cv_sys_struct_timeval_tv_sec != yes; then REPLACE_STRUCT_TIMEVAL=1 fi fi dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ #if HAVE_SYS_TIME_H # include <sys/time.h> #endif #include <time.h> ]], [gettimeofday]) ]) # gl_SYS_TIME_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_SYS_TIME_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_SYS_TIME_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TIME_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETTIMEOFDAY]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TIME_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS]) ]) AC_DEFUN([gl_SYS_TIME_H_DEFAULTS], [ dnl Assume POSIX behavior unless another module says otherwise. HAVE_GETTIMEOFDAY=1; AC_SUBST([HAVE_GETTIMEOFDAY]) HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL]) HAVE_SYS_TIME_H=1; AC_SUBST([HAVE_SYS_TIME_H]) REPLACE_GETTIMEOFDAY=0; AC_SUBST([REPLACE_GETTIMEOFDAY]) REPLACE_STRUCT_TIMEVAL=0; AC_SUBST([REPLACE_STRUCT_TIMEVAL]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/realloc.m4������������������������������������������������������������������0000664�0001750�0001750�00000004232�14670377450�016653� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# realloc.m4 serial 24 dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # This is adapted with modifications from upstream Autoconf here: # https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455 AC_DEFUN([_AC_FUNC_REALLOC_IF], [ AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], [ac_cv_func_realloc_0_nonnull], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <stdlib.h> ]], [[void *p = realloc (0, 0); int result = !p; free (p); return result;]]) ], [ac_cv_func_realloc_0_nonnull=yes], [ac_cv_func_realloc_0_nonnull=no], [case "$host_os" in # Guess yes on platforms where we know the result. *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | gnu* | *-musl* | midnightbsd* \ | hpux* | solaris* | cygwin* | mingw* | msys* ) ac_cv_func_realloc_0_nonnull="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; esac ]) ]) AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2]) ])# AC_FUNC_REALLOC # gl_FUNC_REALLOC_GNU # ------------------- # Replace realloc if it is not compatible with GNU libc. AC_DEFUN([gl_FUNC_REALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) if test $REPLACE_REALLOC = 0; then _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC=1]) fi ])# gl_FUNC_REALLOC_GNU # gl_FUNC_REALLOC_POSIX # --------------------- # Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it # fails, and doesn't mess up with ptrdiff_t overflow), # and replace realloc if it is not. AC_DEFUN([gl_FUNC_REALLOC_POSIX], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) if test $REPLACE_MALLOC = 1; then REPLACE_REALLOC=1 fi ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/host-cpu-c-abi.m4�����������������������������������������������������������0000664�0001750�0001750�00000053632�14670377440�017754� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# host-cpu-c-abi.m4 serial 14 dnl Copyright (C) 2002-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible and Sam Steingold. dnl Sets the HOST_CPU variable to the canonical name of the CPU. dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its dnl C language ABI (application binary interface). dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in dnl config.h. dnl dnl This canonical name can be used to select a particular assembly language dnl source file that will interoperate with C code on the given host. dnl dnl For example: dnl * 'i386' and 'sparc' are different canonical names, because code for i386 dnl will not run on SPARC CPUs and vice versa. They have different dnl instruction sets. dnl * 'sparc' and 'sparc64' are different canonical names, because code for dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit dnl mode, but not both. dnl * 'mips' and 'mipsn32' are different canonical names, because they use dnl different argument passing and return conventions for C functions, and dnl although the instruction set of 'mips' is a large subset of the dnl instruction set of 'mipsn32'. dnl * 'mipsn32' and 'mips64' are different canonical names, because they use dnl different sizes for the C types like 'int' and 'void *', and although dnl the instruction sets of 'mipsn32' and 'mips64' are the same. dnl * The same canonical name is used for different endiannesses. You can dnl determine the endianness through preprocessor symbols: dnl - 'arm': test __ARMEL__. dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL. dnl - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN. dnl * The same name 'i386' is used for CPUs of type i386, i486, i586 dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because dnl - Instructions that do not exist on all of these CPUs (cmpxchg, dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your dnl assembly language source files use such instructions, you will dnl need to make the distinction. dnl - Speed of execution of the common instruction set is reasonable across dnl the entire family of CPUs. If you have assembly language source files dnl that are optimized for particular CPU types (like GNU gmp has), you dnl will need to make the distinction. dnl See <https://en.wikipedia.org/wiki/X86_instruction_listings>. AC_DEFUN([gl_HOST_CPU_C_ABI], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_C_ASM]) AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi], [case "$host_cpu" in changequote(,)dnl i[34567]86 ) changequote([,])dnl gl_cv_host_cpu_c_abi=i386 ;; x86_64 ) # On x86_64 systems, the C compiler may be generating code in one of # these ABIs: # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 # with native Windows (mingw, MSVC). # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if (defined __x86_64__ || defined __amd64__ \ || defined _M_X64 || defined _M_AMD64) int ok; #else error fail #endif ]])], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __ILP32__ || defined _ILP32 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=x86_64-x32], [gl_cv_host_cpu_c_abi=x86_64])], [gl_cv_host_cpu_c_abi=i386]) ;; changequote(,)dnl alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) changequote([,])dnl gl_cv_host_cpu_c_abi=alpha ;; arm* | aarch64 ) # Assume arm with EABI. # On arm64 systems, the C compiler may be generating code in one of # these ABIs: # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef __aarch64__ int ok; #else error fail #endif ]])], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __ILP32__ || defined _ILP32 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=arm64-ilp32], [gl_cv_host_cpu_c_abi=arm64])], [# Don't distinguish little-endian and big-endian arm, since they # don't require different machine code for simple operations and # since the user can distinguish them through the preprocessor # defines __ARMEL__ vs. __ARMEB__. # But distinguish arm which passes floating-point arguments and # return values in integer registers (r0, r1, ...) - this is # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which # passes them in float registers (s0, s1, ...) and double registers # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer # sets the preprocessor defines __ARM_PCS (for the first case) and # __ARM_PCS_VFP (for the second case), but older GCC does not. echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c # Look for a reference to the register d0 in the .s file. AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then gl_cv_host_cpu_c_abi=armhf else gl_cv_host_cpu_c_abi=arm fi rm -f conftest* ]) ;; hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) # On hppa, the C compiler may be generating 32-bit code or 64-bit # code. In the latter case, it defines _LP64 and __LP64__. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef __LP64__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=hppa64], [gl_cv_host_cpu_c_abi=hppa]) ;; ia64* ) # On ia64 on HP-UX, the C compiler may be generating 64-bit code or # 32-bit code. In the latter case, it defines _ILP32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef _ILP32 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=ia64-ilp32], [gl_cv_host_cpu_c_abi=ia64]) ;; mips* ) # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this # at 32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=mips64], [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32. # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if (_MIPS_SIM == _ABIN32) int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=mipsn32], [gl_cv_host_cpu_c_abi=mips])]) ;; powerpc* ) # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. # No need to distinguish them here; the caller may distinguish # them based on the OS. # On powerpc64 systems, the C compiler may still be generating # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may # be generating 64-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail #endif ]])], [# On powerpc64, there are two ABIs on Linux: The AIX compatible # one and the ELFv2 one. The latter defines _CALL_ELF=2. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined _CALL_ELF && _CALL_ELF == 2 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=powerpc64-elfv2], [gl_cv_host_cpu_c_abi=powerpc64]) ], [gl_cv_host_cpu_c_abi=powerpc]) ;; rs6000 ) gl_cv_host_cpu_c_abi=powerpc ;; riscv32 | riscv64 ) # There are 2 architectures (with variants): rv32* and rv64*. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if __riscv_xlen == 64 int ok; #else error fail #endif ]])], [cpu=riscv64], [cpu=riscv32]) # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. # Size of 'long' and 'void *': AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __LP64__ int ok; #else error fail #endif ]])], [main_abi=lp64], [main_abi=ilp32]) # Float ABIs: # __riscv_float_abi_double: # 'float' and 'double' are passed in floating-point registers. # __riscv_float_abi_single: # 'float' are passed in floating-point registers. # __riscv_float_abi_soft: # No values are passed in floating-point registers. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __riscv_float_abi_double int ok; #else error fail #endif ]])], [float_abi=d], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __riscv_float_abi_single int ok; #else error fail #endif ]])], [float_abi=f], [float_abi='']) ]) gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}" ;; s390* ) # On s390x, the C compiler may be generating 64-bit (= s390x) code # or 31-bit (= s390) code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __LP64__ || defined __s390x__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=s390x], [gl_cv_host_cpu_c_abi=s390]) ;; sparc | sparc64 ) # UltraSPARCs running Linux have `uname -m` = "sparc64", but the # C compiler still generates 32-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=sparc64], [gl_cv_host_cpu_c_abi=sparc]) ;; *) gl_cv_host_cpu_c_abi="$host_cpu" ;; esac ]) dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same. HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'` HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi" AC_SUBST([HOST_CPU]) AC_SUBST([HOST_CPU_C_ABI]) # This was # AC_DEFINE_UNQUOTED([__${HOST_CPU}__]) # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__]) # earlier, but KAI C++ 3.2d doesn't like this. sed -e 's/-/_/g' >> confdefs.h <<EOF #ifndef __${HOST_CPU}__ #define __${HOST_CPU}__ 1 #endif #ifndef __${HOST_CPU_C_ABI}__ #define __${HOST_CPU_C_ABI}__ 1 #endif EOF AH_TOP([/* CPU and C ABI indicator */ #ifndef __i386__ #undef __i386__ #endif #ifndef __x86_64_x32__ #undef __x86_64_x32__ #endif #ifndef __x86_64__ #undef __x86_64__ #endif #ifndef __alpha__ #undef __alpha__ #endif #ifndef __arm__ #undef __arm__ #endif #ifndef __armhf__ #undef __armhf__ #endif #ifndef __arm64_ilp32__ #undef __arm64_ilp32__ #endif #ifndef __arm64__ #undef __arm64__ #endif #ifndef __hppa__ #undef __hppa__ #endif #ifndef __hppa64__ #undef __hppa64__ #endif #ifndef __ia64_ilp32__ #undef __ia64_ilp32__ #endif #ifndef __ia64__ #undef __ia64__ #endif #ifndef __m68k__ #undef __m68k__ #endif #ifndef __mips__ #undef __mips__ #endif #ifndef __mipsn32__ #undef __mipsn32__ #endif #ifndef __mips64__ #undef __mips64__ #endif #ifndef __powerpc__ #undef __powerpc__ #endif #ifndef __powerpc64__ #undef __powerpc64__ #endif #ifndef __powerpc64_elfv2__ #undef __powerpc64_elfv2__ #endif #ifndef __riscv32__ #undef __riscv32__ #endif #ifndef __riscv64__ #undef __riscv64__ #endif #ifndef __riscv32_ilp32__ #undef __riscv32_ilp32__ #endif #ifndef __riscv32_ilp32f__ #undef __riscv32_ilp32f__ #endif #ifndef __riscv32_ilp32d__ #undef __riscv32_ilp32d__ #endif #ifndef __riscv64_ilp32__ #undef __riscv64_ilp32__ #endif #ifndef __riscv64_ilp32f__ #undef __riscv64_ilp32f__ #endif #ifndef __riscv64_ilp32d__ #undef __riscv64_ilp32d__ #endif #ifndef __riscv64_lp64__ #undef __riscv64_lp64__ #endif #ifndef __riscv64_lp64f__ #undef __riscv64_lp64f__ #endif #ifndef __riscv64_lp64d__ #undef __riscv64_lp64d__ #endif #ifndef __s390__ #undef __s390__ #endif #ifndef __s390x__ #undef __s390x__ #endif #ifndef __sh__ #undef __sh__ #endif #ifndef __sparc__ #undef __sparc__ #endif #ifndef __sparc64__ #undef __sparc64__ #endif ]) ]) dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit dnl one, or to 'unknown' if unknown. dnl This is a simplified variant of gl_HOST_CPU_C_ABI. AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit], [if test -n "$gl_cv_host_cpu_c_abi"; then case "$gl_cv_host_cpu_c_abi" in i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) gl_cv_host_cpu_c_abi_32bit=yes ;; x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) gl_cv_host_cpu_c_abi_32bit=no ;; *) gl_cv_host_cpu_c_abi_32bit=unknown ;; esac else case "$host_cpu" in # CPUs that only support a 32-bit ABI. arc \ | bfin \ | cris* \ | csky \ | epiphany \ | ft32 \ | h8300 \ | m68k \ | microblaze | microblazeel \ | nds32 | nds32le | nds32be \ | nios2 | nios2eb | nios2el \ | or1k* \ | or32 \ | sh | sh[1234] | sh[1234]e[lb] \ | tic6x \ | xtensa* ) gl_cv_host_cpu_c_abi_32bit=yes ;; # CPUs that only support a 64-bit ABI. changequote(,)dnl alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ | mmix ) changequote([,])dnl gl_cv_host_cpu_c_abi_32bit=no ;; changequote(,)dnl i[34567]86 ) changequote([,])dnl gl_cv_host_cpu_c_abi_32bit=yes ;; x86_64 ) # On x86_64 systems, the C compiler may be generating code in one of # these ABIs: # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 # with native Windows (mingw, MSVC). # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if (defined __x86_64__ || defined __amd64__ \ || defined _M_X64 || defined _M_AMD64) \ && !(defined __ILP32__ || defined _ILP32) int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi_32bit=no], [gl_cv_host_cpu_c_abi_32bit=yes]) ;; arm* | aarch64 ) # Assume arm with EABI. # On arm64 systems, the C compiler may be generating code in one of # these ABIs: # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi_32bit=no], [gl_cv_host_cpu_c_abi_32bit=yes]) ;; hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) # On hppa, the C compiler may be generating 32-bit code or 64-bit # code. In the latter case, it defines _LP64 and __LP64__. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef __LP64__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi_32bit=no], [gl_cv_host_cpu_c_abi_32bit=yes]) ;; ia64* ) # On ia64 on HP-UX, the C compiler may be generating 64-bit code or # 32-bit code. In the latter case, it defines _ILP32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef _ILP32 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi_32bit=yes], [gl_cv_host_cpu_c_abi_32bit=no]) ;; mips* ) # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this # at 32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi_32bit=no], [gl_cv_host_cpu_c_abi_32bit=yes]) ;; powerpc* ) # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. # No need to distinguish them here; the caller may distinguish # them based on the OS. # On powerpc64 systems, the C compiler may still be generating # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may # be generating 64-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi_32bit=no], [gl_cv_host_cpu_c_abi_32bit=yes]) ;; rs6000 ) gl_cv_host_cpu_c_abi_32bit=yes ;; riscv32 | riscv64 ) # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. # Size of 'long' and 'void *': AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __LP64__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi_32bit=no], [gl_cv_host_cpu_c_abi_32bit=yes]) ;; s390* ) # On s390x, the C compiler may be generating 64-bit (= s390x) code # or 31-bit (= s390) code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __LP64__ || defined __s390x__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi_32bit=no], [gl_cv_host_cpu_c_abi_32bit=yes]) ;; sparc | sparc64 ) # UltraSPARCs running Linux have `uname -m` = "sparc64", but the # C compiler still generates 32-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi_32bit=no], [gl_cv_host_cpu_c_abi_32bit=yes]) ;; *) gl_cv_host_cpu_c_abi_32bit=unknown ;; esac fi ]) HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" ]) ������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/errno_h.m4������������������������������������������������������������������0000664�0001750�0001750�00000005736�14670377450�016700� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# errno_h.m4 serial 13 dnl Copyright (C) 2004, 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_PREREQ([2.61]) AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], [ AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ AC_EGREP_CPP([booboo],[ #include <errno.h> #if !defined ETXTBSY booboo #endif #if !defined ENOMSG booboo #endif #if !defined EIDRM booboo #endif #if !defined ENOLINK booboo #endif #if !defined EPROTO booboo #endif #if !defined EMULTIHOP booboo #endif #if !defined EBADMSG booboo #endif #if !defined EOVERFLOW booboo #endif #if !defined ENOTSUP booboo #endif #if !defined ENETRESET booboo #endif #if !defined ECONNABORTED booboo #endif #if !defined ESTALE booboo #endif #if !defined EDQUOT booboo #endif #if !defined ECANCELED booboo #endif #if !defined EOWNERDEAD booboo #endif #if !defined ENOTRECOVERABLE booboo #endif #if !defined EILSEQ booboo #endif ], [gl_cv_header_errno_h_complete=no], [gl_cv_header_errno_h_complete=yes]) ]) if test $gl_cv_header_errno_h_complete = yes; then ERRNO_H='' else gl_NEXT_HEADERS([errno.h]) ERRNO_H='errno.h' fi AC_SUBST([ERRNO_H]) AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"]) gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) gl_REPLACE_ERRNO_VALUE([ENOLINK]) gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) ]) # Assuming $1 = EOVERFLOW. # The EOVERFLOW errno value ought to be defined in <errno.h>, according to # POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and # some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. # Check for the value of EOVERFLOW. # Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. AC_DEFUN([gl_REPLACE_ERRNO_VALUE], [ if test -n "$ERRNO_H"; then AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ AC_EGREP_CPP([yes],[ #include <errno.h> #ifdef ]$1[ yes #endif ], [gl_cv_header_errno_h_]$1[=yes], [gl_cv_header_errno_h_]$1[=no]) if test $gl_cv_header_errno_h_]$1[ = no; then AC_EGREP_CPP([yes],[ #define _XOPEN_SOURCE_EXTENDED 1 #include <errno.h> #ifdef ]$1[ yes #endif ], [gl_cv_header_errno_h_]$1[=hidden]) if test $gl_cv_header_errno_h_]$1[ = hidden; then dnl The macro exists but is hidden. dnl Define it to the same value. AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [ #define _XOPEN_SOURCE_EXTENDED 1 #include <errno.h> /* The following two lines are a workaround against an autoconf-2.52 bug. */ #include <stdio.h> #include <stdlib.h> ]) fi fi ]) case $gl_cv_header_errno_h_]$1[ in yes | no) ]$1[_HIDDEN=0; ]$1[_VALUE= ;; *) ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1[" ;; esac AC_SUBST($1[_HIDDEN]) AC_SUBST($1[_VALUE]) fi ]) ����������������������������������kbuild-3608/src/grep/m4/ssize_t.m4������������������������������������������������������������������0000664�0001750�0001750�00000001463�14670377450�016715� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# ssize_t.m4 serial 5 (gettext-0.18.2) dnl Copyright (C) 2001-2003, 2006, 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether ssize_t is defined. AC_DEFUN([gt_TYPE_SSIZE_T], [ AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h>]], [[int x = sizeof (ssize_t *) + sizeof (ssize_t); return !x;]])], [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) if test $gt_cv_ssize_t = no; then AC_DEFINE([ssize_t], [int], [Define as a signed type of the same size as size_t.]) fi ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/free.m4���������������������������������������������������������������������0000664�0001750�0001750�00000003710�14670377450�016153� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# free.m4 serial 6 # Copyright (C) 2003-2005, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert and Bruno Haible. AC_DEFUN([gl_FUNC_FREE], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) dnl In the next release of POSIX, free must preserve errno. dnl https://www.austingroupbugs.net/view.php?id=385 dnl https://sourceware.org/bugzilla/show_bug.cgi?id=17924 dnl So far, we know of three platforms that do this: dnl * glibc >= 2.33, thanks to the fix for this bug: dnl <https://sourceware.org/bugzilla/show_bug.cgi?id=17924> dnl * OpenBSD >= 4.5, thanks to this commit: dnl <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h> dnl * Solaris, because its malloc() implementation is based on brk(), dnl not mmap(); hence its free() implementation makes no system calls. dnl For other platforms, you can only be sure if they state it in their dnl documentation, or by code inspection of the free() implementation in libc. AC_CACHE_CHECK([whether free is known to preserve errno], [gl_cv_func_free_preserves_errno], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <stdlib.h> ]], [[#if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__) #elif defined __OpenBSD__ #elif defined __sun #else #error "'free' is not known to preserve errno" #endif ]])], [gl_cv_func_free_preserves_errno=yes], [gl_cv_func_free_preserves_errno=no]) ]) case $gl_cv_func_free_preserves_errno in *yes) AC_DEFINE([HAVE_FREE_POSIX], [1], [Define if the 'free' function is guaranteed to preserve errno.]) ;; *) REPLACE_FREE=1 ;; esac ]) # Prerequisites of lib/free.c. AC_DEFUN([gl_PREREQ_FREE], [:]) ��������������������������������������������������������kbuild-3608/src/grep/m4/xalloc.m4�������������������������������������������������������������������0000664�0001750�0001750�00000000472�14670377450�016516� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# xalloc.m4 serial 18 dnl Copyright (C) 2002-2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_XALLOC], [:]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/pkg.m4����������������������������������������������������������������������0000664�0001750�0001750�00000030576�14670377450�016025� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 11 (pkg-config-0.29.1) dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a dnl configuration script generated by Autoconf, you may include it under dnl the same distribution terms that you use for the rest of that dnl program. dnl PKG_PREREQ(MIN-VERSION) dnl ----------------------- dnl Since: 0.29 dnl dnl Verify that the version of the pkg-config macros are at least dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's dnl installed version of pkg-config, this checks the developer's version dnl of pkg.m4 when generating configure. dnl dnl To ensure that this macro is defined, also add: dnl m4_ifndef([PKG_PREREQ], dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], [m4_define([PKG_MACROS_VERSION], [0.29.1]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])dnl PKG_PROG_PKG_CONFIG dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------------------------------- dnl Since: 0.18 dnl dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl only at the first occurence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl --------------------------------------------- dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])dnl _PKG_CONFIG dnl _PKG_SHORT_ERRORS_SUPPORTED dnl --------------------------- dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])dnl _PKG_SHORT_ERRORS_SUPPORTED dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl -------------------------------------------------------------- dnl Since: 0.4.0 dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES might not happen, you should be sure to include an dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])dnl PKG_CHECK_MODULES dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl --------------------------------------------------------------------- dnl Since: 0.29 dnl dnl Checks for existence of MODULES and gathers its build flags with dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags dnl and VARIABLE-PREFIX_LIBS from --libs. dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to dnl include an explicit call to PKG_PROG_PKG_CONFIG in your dnl configure.ac. AC_DEFUN([PKG_CHECK_MODULES_STATIC], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl _save_PKG_CONFIG=$PKG_CONFIG PKG_CONFIG="$PKG_CONFIG --static" PKG_CHECK_MODULES($@) PKG_CONFIG=$_save_PKG_CONFIG[]dnl ])dnl PKG_CHECK_MODULES_STATIC dnl PKG_INSTALLDIR([DIRECTORY]) dnl ------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable pkgconfigdir as the location where a module dnl should install pkg-config .pc files. By default the directory is dnl $libdir/pkgconfig, but the default can be changed by passing dnl DIRECTORY. The user can override through the --with-pkgconfigdir dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_INSTALLDIR dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) dnl -------------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable noarch_pkgconfigdir as the location where a dnl module should install arch-independent pkg-config .pc files. By dnl default the directory is $datadir/pkgconfig, but the default can be dnl changed by passing DIRECTORY. The user can override through the dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_NOARCH_INSTALLDIR dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------- dnl Since: 0.28 dnl dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], dnl [DESCRIPTION], [DEFAULT]) dnl ------------------------------------------ dnl dnl Prepare a "--with-" configure option using the lowercase dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and dnl PKG_CHECK_MODULES in a single macro. AC_DEFUN([PKG_WITH_MODULES], [ m4_pushdef([with_arg], m4_tolower([$1])) m4_pushdef([description], [m4_default([$5], [build with ]with_arg[ support])]) m4_pushdef([def_arg], [m4_default([$6], [auto])]) m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) m4_case(def_arg, [yes],[m4_pushdef([with_without], [--without-]with_arg)], [m4_pushdef([with_without],[--with-]with_arg)]) AC_ARG_WITH(with_arg, AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, [AS_TR_SH([with_]with_arg)=def_arg]) AS_CASE([$AS_TR_SH([with_]with_arg)], [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], [auto],[PKG_CHECK_MODULES([$1],[$2], [m4_n([def_action_if_found]) $3], [m4_n([def_action_if_not_found]) $4])]) m4_popdef([with_arg]) m4_popdef([description]) m4_popdef([def_arg]) ])dnl PKG_WITH_MODULES dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [DESCRIPTION], [DEFAULT]) dnl ----------------------------------------------- dnl dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES dnl check._[VARIABLE-PREFIX] is exported as make variable. AC_DEFUN([PKG_HAVE_WITH_MODULES], [ PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) AM_CONDITIONAL([HAVE_][$1], [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) ])dnl PKG_HAVE_WITH_MODULES dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [DESCRIPTION], [DEFAULT]) dnl ------------------------------------------------------ dnl dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make dnl and preprocessor variable. AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], [ PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) ])dnl PKG_HAVE_DEFINE_WITH_MODULES ����������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/getopt.m4�������������������������������������������������������������������0000664�0001750�0001750�00000031417�14670377440�016540� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# getopt.m4 serial 47 dnl Copyright (C) 2002-2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Request a POSIX compliant getopt function. AC_DEFUN([gl_FUNC_GETOPT_POSIX], [ m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX]) AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) dnl Other modules can request the gnulib implementation of the getopt dnl functions unconditionally, by defining gl_REPLACE_GETOPT_ALWAYS. dnl argp.m4 does this. m4_ifdef([gl_REPLACE_GETOPT_ALWAYS], [ REPLACE_GETOPT=1 ], [ REPLACE_GETOPT=0 if test -n "$gl_replace_getopt"; then REPLACE_GETOPT=1 fi ]) if test $REPLACE_GETOPT = 1; then dnl Arrange for getopt.h to be created. gl_GETOPT_SUBSTITUTE_HEADER fi ]) # Request a POSIX compliant getopt function with GNU extensions (such as # options with optional arguments) and the functions getopt_long, # getopt_long_only. AC_DEFUN([gl_FUNC_GETOPT_GNU], [ dnl Set the variable gl_getopt_required, so that all invocations of dnl gl_GETOPT_CHECK_HEADERS in the scope of the current configure file dnl will check for getopt with GNU extensions. dnl This means that if one gnulib-tool invocation requests getopt-posix dnl and another gnulib-tool invocation requests getopt-gnu, it is as if dnl both had requested getopt-gnu. m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU]) dnl No need to invoke gl_FUNC_GETOPT_POSIX here; this is automatically dnl done through the module dependency getopt-gnu -> getopt-posix. ]) # Determine whether to replace the entire getopt facility. AC_DEFUN([gl_GETOPT_CHECK_HEADERS], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([AC_PROG_AWK]) dnl for awk that supports ENVIRON dnl Persuade Solaris <unistd.h> to declare optarg, optind, opterr, optopt. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) gl_CHECK_NEXT_HEADERS([getopt.h]) if test $ac_cv_header_getopt_h = yes; then HAVE_GETOPT_H=1 else HAVE_GETOPT_H=0 fi AC_SUBST([HAVE_GETOPT_H]) gl_replace_getopt= dnl Test whether <getopt.h> is available. if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes]) fi dnl Test whether the function getopt_long is available. if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes]) fi dnl POSIX 2008 does not specify leading '+' behavior, but see dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on dnl the next version of POSIX. For now, we only guarantee leading '+' dnl behavior with getopt-gnu. if test -z "$gl_replace_getopt"; then AC_CACHE_CHECK([whether getopt is POSIX compatible], [gl_cv_func_getopt_posix], [ dnl Merging these three different test programs into a single one dnl would require a reset mechanism. On BSD systems, it can be done dnl through 'optreset'; on some others (glibc), it can be done by dnl setting 'optind' to 0; on others again (HP-UX, IRIX, OSF/1, dnl Solaris 9, musl libc), there is no such mechanism. if test $cross_compiling = no; then dnl Sanity check. Succeeds everywhere (except on MSVC, dnl which lacks <unistd.h> and getopt() entirely). AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <unistd.h> #include <stdlib.h> #include <string.h> int main () { static char program[] = "program"; static char a[] = "-a"; static char foo[] = "foo"; static char bar[] = "bar"; char *argv[] = { program, a, foo, bar, NULL }; int c; c = getopt (4, argv, "ab"); if (!(c == 'a')) return 1; c = getopt (4, argv, "ab"); if (!(c == -1)) return 2; if (!(optind == 2)) return 3; return 0; } ]])], [gl_cv_func_getopt_posix=maybe], [gl_cv_func_getopt_posix=no]) if test $gl_cv_func_getopt_posix = maybe; then dnl Sanity check with '+'. Succeeds everywhere (except on MSVC, dnl which lacks <unistd.h> and getopt() entirely). AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <unistd.h> #include <stdlib.h> #include <string.h> int main () { static char program[] = "program"; static char donald[] = "donald"; static char p[] = "-p"; static char billy[] = "billy"; static char duck[] = "duck"; static char a[] = "-a"; static char bar[] = "bar"; char *argv[] = { program, donald, p, billy, duck, a, bar, NULL }; int c; c = getopt (7, argv, "+abp:q:"); if (!(c == -1)) return 4; if (!(strcmp (argv[0], "program") == 0)) return 5; if (!(strcmp (argv[1], "donald") == 0)) return 6; if (!(strcmp (argv[2], "-p") == 0)) return 7; if (!(strcmp (argv[3], "billy") == 0)) return 8; if (!(strcmp (argv[4], "duck") == 0)) return 9; if (!(strcmp (argv[5], "-a") == 0)) return 10; if (!(strcmp (argv[6], "bar") == 0)) return 11; if (!(optind == 1)) return 12; return 0; } ]])], [gl_cv_func_getopt_posix=maybe], [gl_cv_func_getopt_posix=no]) fi if test $gl_cv_func_getopt_posix = maybe; then dnl Detect Mac OS X 10.5, AIX 7.1, mingw bug. AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <unistd.h> #include <stdlib.h> #include <string.h> int main () { static char program[] = "program"; static char ab[] = "-ab"; char *argv[3] = { program, ab, NULL }; if (getopt (2, argv, "ab:") != 'a') return 13; if (getopt (2, argv, "ab:") != '?') return 14; if (optopt != 'b') return 15; if (optind != 2) return 16; return 0; } ]])], [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no]) fi else case "$host_os" in darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";; *) gl_cv_func_getopt_posix="guessing yes";; esac fi ]) case "$gl_cv_func_getopt_posix" in *no) gl_replace_getopt=yes ;; esac fi if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_getopt_gnu], [# Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the # optstring is necessary for programs like m4 that have POSIX-mandated # semantics for supporting options interspersed with files. # Also, since getopt_long is a GNU extension, we require optind=0. # Bash ties 'set -o posix' to a non-exported POSIXLY_CORRECT; # so take care to revert to the correct (non-)export state. dnl GNU Coding Standards currently allow awk but not env; besides, env dnl is ambiguous with environment values that contain newlines. gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }' case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in xx) gl_had_POSIXLY_CORRECT=exported ;; x) gl_had_POSIXLY_CORRECT=yes ;; *) gl_had_POSIXLY_CORRECT= ;; esac POSIXLY_CORRECT=1 export POSIXLY_CORRECT AC_RUN_IFELSE( [AC_LANG_PROGRAM([[#include <getopt.h> #include <stddef.h> #include <string.h> ]GL_NOCRASH[ ]], [[ int result = 0; nocrash_init(); /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10. */ { static char conftest[] = "conftest"; static char plus[] = "-+"; char *argv[3] = { conftest, plus, NULL }; opterr = 0; if (getopt (2, argv, "+a") != '?') result |= 1; } /* This code succeeds on glibc 2.8, mingw, and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ { static char program[] = "program"; static char p[] = "-p"; static char foo[] = "foo"; static char bar[] = "bar"; char *argv[] = { program, p, foo, bar, NULL }; optind = 1; if (getopt (4, argv, "p::") != 'p') result |= 2; else if (optarg != NULL) result |= 4; else if (getopt (4, argv, "p::") != -1) result |= 6; else if (optind != 2) result |= 8; } /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ { static char program[] = "program"; static char foo[] = "foo"; static char p[] = "-p"; char *argv[] = { program, foo, p, NULL }; optind = 0; if (getopt (3, argv, "-p") != 1) result |= 16; else if (getopt (3, argv, "-p") != 'p') result |= 16; } /* This code fails on glibc 2.11. */ { static char program[] = "program"; static char b[] = "-b"; static char a[] = "-a"; char *argv[] = { program, b, a, NULL }; optind = opterr = 0; if (getopt (3, argv, "+:a:b") != 'b') result |= 32; else if (getopt (3, argv, "+:a:b") != ':') result |= 32; } /* This code dumps core on glibc 2.14. */ { static char program[] = "program"; static char w[] = "-W"; static char dummy[] = "dummy"; char *argv[] = { program, w, dummy, NULL }; optind = opterr = 1; if (getopt (3, argv, "W;") != 'W') result |= 64; } return result; ]])], [gl_cv_func_getopt_gnu=yes], [gl_cv_func_getopt_gnu=no], [dnl Cross compiling. dnl Assume the worst, even on glibc platforms. dnl But obey --enable-cross-guesses. gl_cv_func_getopt_gnu="$gl_cross_guess_normal" ]) case $gl_had_POSIXLY_CORRECT in exported) ;; yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;; *) AS_UNSET([POSIXLY_CORRECT]) ;; esac ]) if test "$gl_cv_func_getopt_gnu" != yes; then gl_replace_getopt=yes else AC_CACHE_CHECK([for working GNU getopt_long function], [gl_cv_func_getopt_long_gnu], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <getopt.h> #include <stddef.h> #include <string.h> ]], [[static const struct option long_options[] = { { "xtremely-",no_argument, NULL, 1003 }, { "xtra", no_argument, NULL, 1001 }, { "xtreme", no_argument, NULL, 1002 }, { "xtremely", no_argument, NULL, 1003 }, { NULL, 0, NULL, 0 } }; /* This code fails on OpenBSD 5.0. */ { static char program[] = "program"; static char xtremel[] = "--xtremel"; char *argv[] = { program, xtremel, NULL }; int option_index; optind = 1; opterr = 0; if (getopt_long (2, argv, "", long_options, &option_index) != 1003) return 1; } return 0; ]])], [gl_cv_func_getopt_long_gnu=yes], [gl_cv_func_getopt_long_gnu=no], [dnl Cross compiling. Guess no on OpenBSD, yes otherwise. case "$host_os" in openbsd*) gl_cv_func_getopt_long_gnu="guessing no";; *) gl_cv_func_getopt_long_gnu="guessing yes";; esac ]) ]) case "$gl_cv_func_getopt_long_gnu" in *yes) ;; *) gl_replace_getopt=yes ;; esac fi fi ]) AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], [ AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) if test $ac_cv_header_sys_cdefs_h = yes; then HAVE_SYS_CDEFS_H=1 else HAVE_SYS_CDEFS_H=0 fi AC_SUBST([HAVE_SYS_CDEFS_H]) AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], [Define to rpl_ if the getopt replacement functions and variables should be used.]) GETOPT_H=getopt.h GETOPT_CDEFS_H=getopt-cdefs.h AC_SUBST([GETOPT_H]) AC_SUBST([GETOPT_CDEFS_H]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/ftruncate.m4����������������������������������������������������������������0000664�0001750�0001750�00000002410�14670377440�017220� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 21 # See if we need to emulate a missing ftruncate function using _chsize. # Copyright (C) 2000-2001, 2003-2007, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FTRUNCATE], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([ftruncate]) if test $ac_cv_func_ftruncate = yes; then m4_ifdef([gl_LARGEFILE], [ AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) dnl Native Windows, and Large File Support is requested. dnl The MSVCRT _chsize() function only accepts a 32-bit file size, dnl and the mingw64 ftruncate64() function is unreliable (it may dnl delete the file, see dnl <https://web.archive.org/web/20160425005423/http://mingw-w64.sourcearchive.com/documentation/2.0-1/ftruncate64_8c_source.html>). dnl Use gnulib's ftruncate() implementation instead. REPLACE_FTRUNCATE=1 ;; esac ], [ : ]) else HAVE_FTRUNCATE=0 fi ]) # Prerequisites of lib/ftruncate.c. AC_DEFUN([gl_PREREQ_FTRUNCATE], [ AC_CHECK_FUNCS([_chsize]) ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/asm-underscore.m4�����������������������������������������������������������0000664�0001750�0001750�00000005270�14670377437�020171� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# asm-underscore.m4 serial 5 dnl Copyright (C) 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. Based on as-underscore.m4 in GNU clisp. # gl_ASM_SYMBOL_PREFIX # Tests for the prefix of C symbols at the assembly language level and the # linker level. This prefix is either an underscore or empty. Defines the # C macro USER_LABEL_PREFIX to this prefix, and sets ASM_SYMBOL_PREFIX to # a stringified variant of this prefix. AC_DEFUN([gl_ASM_SYMBOL_PREFIX], [ AC_REQUIRE([AC_PROG_EGREP]) dnl We don't use GCC's __USER_LABEL_PREFIX__ here, because dnl 1. It works only for GCC. dnl 2. It is incorrectly defined on some platforms, in some GCC versions. AC_REQUIRE([gl_C_ASM]) AC_CACHE_CHECK( [whether C symbols are prefixed with underscore at the linker level], [gl_cv_prog_as_underscore], [cat > conftest.c <<EOF #ifdef __cplusplus extern "C" int foo (void); #endif int foo(void) { return 0; } EOF # Look for the assembly language name in the .s file. AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 if LC_ALL=C $EGREP '(^|[[^a-zA-Z0-9_]])_foo([[^a-zA-Z0-9_]]|$)' conftest.$gl_asmext >/dev/null; then gl_cv_prog_as_underscore=yes else gl_cv_prog_as_underscore=no fi rm -f conftest* ]) if test $gl_cv_prog_as_underscore = yes; then USER_LABEL_PREFIX=_ else USER_LABEL_PREFIX= fi AC_DEFINE_UNQUOTED([USER_LABEL_PREFIX], [$USER_LABEL_PREFIX], [Define to the prefix of C symbols at the assembler and linker level, either an underscore or empty.]) ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"' AC_SUBST([ASM_SYMBOL_PREFIX]) ]) # gl_C_ASM # Determines how to produce an assembly language file from C source code. # Sets the variables: # gl_asmext - the extension of assembly language output, # gl_c_asm_opt - the C compiler option that produces assembly language output. AC_DEFUN([gl_C_ASM], [ AC_EGREP_CPP([MicrosoftCompiler], [ #ifdef _MSC_VER MicrosoftCompiler #endif ], [dnl Microsoft's 'cl' and 'clang-cl' produce an .asm file, whereas 'clang' dnl produces a .s file. Need to distinguish 'clang' and 'clang-cl'. rm -f conftest* echo 'int dummy;' > conftest.c AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c) >/dev/null 2>&1 if test -f conftest.o; then gl_asmext='s' gl_c_asm_opt='-S' else gl_asmext='asm' gl_c_asm_opt='-c -Fa' fi rm -f conftest* ], [gl_asmext='s' gl_c_asm_opt='-S' ]) ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fdopen.m4�������������������������������������������������������������������0000664�0001750�0001750�00000002617�14670377440�016511� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# fdopen.m4 serial 5 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FDOPEN], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles m4_ifdef([gl_MSVC_INVAL], [ AC_REQUIRE([gl_MSVC_INVAL]) if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then REPLACE_FDOPEN=1 fi ]) if test $REPLACE_FDOPEN = 0; then dnl Test whether fdopen() sets errno when it fails due to a bad fd argument. AC_CACHE_CHECK([whether fdopen sets errno], [gl_cv_func_fdopen_works], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> #include <errno.h> ]GL_MDA_DEFINES[ int main (void) { FILE *fp; errno = 0; fp = fdopen (-1, "r"); if (fp == NULL && errno == 0) return 1; return 0; }]])], [gl_cv_func_fdopen_works=yes], [gl_cv_func_fdopen_works=no], [case "$host_os" in mingw*) gl_cv_func_fdopen_works="guessing no" ;; *) gl_cv_func_fdopen_works="guessing yes" ;; esac ]) ]) case "$gl_cv_func_fdopen_works" in *no) REPLACE_FDOPEN=1 ;; esac fi ]) dnl Prerequisites of lib/fdopen.c. AC_DEFUN([gl_PREREQ_FDOPEN], []) �����������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/warn-on-use.m4��������������������������������������������������������������0000664�0001750�0001750�00000004230�14670377450�017403� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# warn-on-use.m4 serial 9 dnl Copyright (C) 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) # --------------------------------------- # If the module 'posixcheck' is in use: # # For each whitespace-separated element in the list of NAMES, define # HAVE_RAW_DECL_name if the function has a declaration among INCLUDES # even after being undefined as a macro. # # See warn-on-use.h for some hints on how to poison function names, as # well as ideas on poisoning global variables and macros. NAMES may # include global variables, but remember that only functions work with # _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single # header, but if the replacement header pulls in other headers because # some systems declare functions in the wrong header, then INCLUDES # should do likewise. # # It is generally safe to assume declarations for functions declared # in the intersection of C89 and C11 (such as printf) without # needing gl_WARN_ON_USE_PREPARE. AC_DEFUN([gl_WARN_ON_USE_PREPARE], [ m4_ifdef([gl_POSIXCHECK], [m4_foreach_w([gl_decl], [$2], [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), [Define to 1 if ]m4_defn([gl_decl])[ is declared even after undefining macros.])])dnl for gl_func in m4_flatten([$2]); do AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl AC_CACHE_CHECK([whether $gl_func is declared without a macro], [gl_Symbol], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], [[#undef $gl_func (void) $gl_func;]])], [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) AS_VAR_IF([gl_Symbol], [yes], [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) dnl shortcut - if the raw declaration exists, then set a cache dnl variable to allow skipping any later AC_CHECK_DECL efforts eval ac_cv_have_decl_$gl_func=yes]) AS_VAR_POPDEF([gl_Symbol])dnl done ]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/strerror_r.m4���������������������������������������������������������������0000664�0001750�0001750�00000015073�14670377450�017442� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# strerror_r.m4 serial 21 dnl Copyright (C) 2002, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRERROR_R], [ AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) dnl Persuade Solaris <string.h> to declare strerror_r(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT dnl are not defined. AC_CHECK_DECLS_ONCE([strerror_r]) if test $ac_cv_have_decl_strerror_r = no; then HAVE_DECL_STRERROR_R=0 fi if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then if test $gl_cv_func_strerror_r_posix_signature = yes; then case "$gl_cv_func_strerror_r_works" in dnl The system's strerror_r has bugs. Replace it. *no) REPLACE_STRERROR_R=1 ;; esac else dnl The system's strerror_r() has a wrong signature. Replace it. REPLACE_STRERROR_R=1 fi else dnl The system's strerror_r() cannot know about the new errno values we dnl add to <errno.h>, or any fix for strerror(0). Replace it. REPLACE_STRERROR_R=1 fi fi ]) # Prerequisites of lib/strerror_r.c. AC_DEFUN([gl_PREREQ_STRERROR_R], [ dnl glibc >= 2.3.4 and cygwin 1.7.9 have a function __xpg_strerror_r. AC_CHECK_FUNCS_ONCE([__xpg_strerror_r]) AC_CHECK_FUNCS_ONCE([catgets]) AC_CHECK_FUNCS_ONCE([snprintf]) ]) # Detect if strerror_r works, but without affecting whether a replacement # strerror_r will be used. AC_DEFUN([gl_FUNC_STRERROR_R_WORKS], [ AC_REQUIRE([gl_HEADER_ERRNO_H]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_FUNC_STRERROR_0]) AC_CHECK_FUNCS_ONCE([strerror_r]) if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then dnl The POSIX prototype is: int strerror_r (int, char *, size_t); dnl glibc, Cygwin: char *strerror_r (int, char *, size_t); dnl AIX 5.1, OSF/1 5.1: int strerror_r (int, char *, int); AC_CACHE_CHECK([for strerror_r with POSIX signature], [gl_cv_func_strerror_r_posix_signature], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <string.h> int strerror_r (int, char *, size_t); ]], [])], [gl_cv_func_strerror_r_posix_signature=yes], [gl_cv_func_strerror_r_posix_signature=no]) ]) if test $gl_cv_func_strerror_r_posix_signature = yes; then dnl AIX 6.1 strerror_r fails by returning -1, not an error number. dnl HP-UX 11.31 strerror_r always fails when the buffer length argument dnl is less than 80. dnl FreeBSD 8.s strerror_r claims failure on 0 dnl Mac OS X 10.5 strerror_r treats 0 like -1 dnl Solaris 10 strerror_r corrupts errno on failure AC_CACHE_CHECK([whether strerror_r works], [gl_cv_func_strerror_r_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <errno.h> #include <string.h> ]], [[int result = 0; char buf[79]; if (strerror_r (EACCES, buf, 0) < 0) result |= 1; errno = 0; if (strerror_r (EACCES, buf, sizeof buf) != 0) result |= 2; strcpy (buf, "Unknown"); if (strerror_r (0, buf, sizeof buf) != 0) result |= 4; if (errno) result |= 8; if (strstr (buf, "nknown") || strstr (buf, "ndefined")) result |= 0x10; errno = 0; *buf = 0; if (strerror_r (-3, buf, sizeof buf) < 0) result |= 0x20; if (errno) result |= 0x40; if (!*buf) result |= 0x80; return result; ]])], [gl_cv_func_strerror_r_works=yes], [gl_cv_func_strerror_r_works=no], [ changequote(,)dnl case "$host_os" in # Guess no on AIX. aix*) gl_cv_func_strerror_r_works="guessing no";; # Guess no on HP-UX. hpux*) gl_cv_func_strerror_r_works="guessing no";; # Guess no on BSD variants. *bsd*) gl_cv_func_strerror_r_works="guessing no";; # Guess yes otherwise. *) gl_cv_func_strerror_r_works="guessing yes";; esac changequote([,])dnl ]) ]) else dnl The system's strerror() has a wrong signature. dnl glibc >= 2.3.4 and cygwin 1.7.9 have a function __xpg_strerror_r. AC_CHECK_FUNCS_ONCE([__xpg_strerror_r]) dnl In glibc < 2.14, __xpg_strerror_r does not populate buf on failure. dnl In cygwin < 1.7.10, __xpg_strerror_r clobbers strerror's buffer. if test $ac_cv_func___xpg_strerror_r = yes; then AC_CACHE_CHECK([whether __xpg_strerror_r works], [gl_cv_func_strerror_r_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <errno.h> #include <string.h> extern #ifdef __cplusplus "C" #endif int __xpg_strerror_r(int, char *, size_t); ]], [[int result = 0; char buf[256] = "^"; char copy[256]; char *str = strerror (-1); strcpy (copy, str); if (__xpg_strerror_r (-2, buf, 1) == 0) result |= 1; if (*buf) result |= 2; __xpg_strerror_r (-2, buf, 256); if (strcmp (str, copy)) result |= 4; return result; ]])], [gl_cv_func_strerror_r_works=yes], [gl_cv_func_strerror_r_works=no], [dnl Guess no on all platforms that have __xpg_strerror_r, dnl at least until fixed glibc and cygwin are more common. gl_cv_func_strerror_r_works="$gl_cross_guess_normal" ]) ]) fi fi fi fi ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/inttostr.m4�����������������������������������������������������������������0000664�0001750�0001750�00000001454�14670377450�017123� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#serial 8 dnl Copyright (C) 2004-2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_INTTOSTR], [ gl_PREREQ_INTTOSTR gl_PREREQ_IMAXTOSTR gl_PREREQ_OFFTOSTR gl_PREREQ_UMAXTOSTR gl_PREREQ_UINTTOSTR ]) # Prerequisites of lib/inttostr.h. AC_DEFUN([gl_PREREQ_INTTOSTR], [ AC_REQUIRE([AC_TYPE_OFF_T]) : ]) # Prerequisites of lib/imaxtostr.c. AC_DEFUN([gl_PREREQ_IMAXTOSTR], [:]) # Prerequisites of lib/offtostr.c. AC_DEFUN([gl_PREREQ_OFFTOSTR], [:]) # Prerequisites of lib/umaxtostr.c. AC_DEFUN([gl_PREREQ_UMAXTOSTR], [:]) # Prerequisites of lib/uinttostr.c. AC_DEFUN([gl_PREREQ_UINTTOSTR], [:]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mbrtowc.m4������������������������������������������������������������������0000664�0001750�0001750�00000055646�14670377450�016726� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mbrtowc.m4 serial 38 -*- coding: utf-8 -*- dnl Copyright (C) 2001-2002, 2004-2005, 2008-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MBRTOWC], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([gl_PTHREADLIB]) AC_CHECK_HEADERS_ONCE([threads.h]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN AC_CHECK_FUNCS_ONCE([mbrtowc]) if test $ac_cv_func_mbrtowc = no; then HAVE_MBRTOWC=0 AC_CHECK_DECLS([mbrtowc],,, [[ #include <wchar.h> ]]) if test $ac_cv_have_decl_mbrtowc = yes; then dnl On Minix 3.1.8, the system's <wchar.h> declares mbrtowc() although dnl it does not have the function. Avoid a collision with gnulib's dnl replacement. REPLACE_MBRTOWC=1 fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_MBRTOWC=1 else gl_MBRTOWC_NULL_ARG1 gl_MBRTOWC_NULL_ARG2 gl_MBRTOWC_RETVAL gl_MBRTOWC_NUL_RETVAL gl_MBRTOWC_STORES_INCOMPLETE gl_MBRTOWC_EMPTY_INPUT gl_MBRTOWC_C_LOCALE case "$gl_cv_func_mbrtowc_null_arg1" in *yes) ;; *) AC_DEFINE([MBRTOWC_NULL_ARG1_BUG], [1], [Define if the mbrtowc function has the NULL pwc argument bug.]) REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_null_arg2" in *yes) ;; *) AC_DEFINE([MBRTOWC_NULL_ARG2_BUG], [1], [Define if the mbrtowc function has the NULL string argument bug.]) REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_retval" in *yes) ;; *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], [Define if the mbrtowc function returns a wrong return value.]) REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_nul_retval" in *yes) ;; *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1], [Define if the mbrtowc function does not return 0 for a NUL character.]) REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_stores_incomplete" in *no) ;; *) AC_DEFINE([MBRTOWC_STORES_INCOMPLETE_BUG], [1], [Define if the mbrtowc function stores a wide character when reporting incomplete input.]) REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_empty_input" in *yes) ;; *) AC_DEFINE([MBRTOWC_EMPTY_INPUT_BUG], [1], [Define if the mbrtowc function does not return (size_t) -2 for empty input.]) REPLACE_MBRTOWC=1 ;; esac case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in *yes) ;; *) AC_DEFINE([MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ], [1], [Define if the mbrtowc function may signal encoding errors in the C locale.]) REPLACE_MBRTOWC=1 ;; esac fi fi if test $REPLACE_MBSTATE_T = 1; then case "$host_os" in mingw*) LIB_MBRTOWC= ;; *) gl_WEAK_SYMBOLS case "$gl_cv_have_weak" in *yes) LIB_MBRTOWC= ;; *) LIB_MBRTOWC="$LIBPTHREAD" ;; esac ;; esac else LIB_MBRTOWC= fi dnl LIB_MBRTOWC is expected to be '-pthread' or '-lpthread' on AIX dnl with gcc or xlc, and empty otherwise. AC_SUBST([LIB_MBRTOWC]) ]) dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that dnl redefines the semantics of the given mbstate_t type. dnl Result is REPLACE_MBSTATE_T. dnl When this is set to 1, we replace both mbsinit() and mbrtowc(), in order to dnl avoid inconsistencies. AC_DEFUN([gl_MBSTATE_T_BROKEN], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_CHECK_FUNCS_ONCE([mbsinit]) AC_CHECK_FUNCS_ONCE([mbrtowc]) dnl On native Windows, we know exactly how mbsinit() behaves and don't need dnl to override it, even if - like on MSVC - mbsinit() is only defined as dnl an inline function, not as a global function. if case "$host_os" in mingw*) true ;; *) test $ac_cv_func_mbsinit = yes ;; esac \ && test $ac_cv_func_mbrtowc = yes; then gl_MBRTOWC_INCOMPLETE_STATE gl_MBRTOWC_SANITYCHECK REPLACE_MBSTATE_T=0 case "$gl_cv_func_mbrtowc_incomplete_state" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac case "$gl_cv_func_mbrtowc_sanitycheck" in *yes) ;; *) REPLACE_MBSTATE_T=1 ;; esac else REPLACE_MBSTATE_T=1 fi ]) dnl Test whether mbrtowc puts the state into non-initial state when parsing an dnl incomplete multibyte character. dnl Result is gl_cv_func_mbrtowc_incomplete_state. AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], [gl_cv_func_mbrtowc_incomplete_state], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on AIX and OSF/1. aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_JA != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; }]])], [gl_cv_func_mbrtowc_incomplete_state=yes], [gl_cv_func_mbrtowc_incomplete_state=no], [:]) else if test $LOCALE_FR_UTF8 != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { const char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) return 2; } return 0; }]])], [gl_cv_func_mbrtowc_incomplete_state=yes], [gl_cv_func_mbrtowc_incomplete_state=no], [:]) fi fi ]) ]) dnl Test whether mbrtowc works not worse than mbtowc. dnl Result is gl_cv_func_mbrtowc_sanitycheck. AC_DEFUN([gl_MBRTOWC_SANITYCHECK], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc works as well as mbtowc], [gl_cv_func_mbrtowc_sanitycheck], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on Solaris 8. solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main () { /* This fails on Solaris 8: mbrtowc returns 2, and sets wc to 0x00F0. mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 6, &state) != 4 && mbtowc (&wc, input + 3, 6) == 4) return 2; } return 0; }]])], [gl_cv_func_mbrtowc_sanitycheck=yes], [gl_cv_func_mbrtowc_sanitycheck=no], [:]) fi ]) ]) dnl Test whether mbrtowc supports a NULL pwc argument correctly. dnl Result is gl_cv_func_mbrtowc_null_arg1. AC_DEFUN([gl_MBRTOWC_NULL_ARG1], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], [gl_cv_func_mbrtowc_null_arg1], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on Solaris. solaris*) gl_cv_func_mbrtowc_null_arg1="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR_UTF8 != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main () { int result = 0; if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { char input[] = "\303\237er"; mbstate_t state; wchar_t wc; size_t ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input, 5, &state); if (ret != 2) result |= 1; if (!mbsinit (&state)) result |= 2; memset (&state, '\0', sizeof (mbstate_t)); ret = mbrtowc (NULL, input, 5, &state); if (ret != 2) /* Solaris 7 fails here: ret is -1. */ result |= 4; if (!mbsinit (&state)) result |= 8; } return result; }]])], [gl_cv_func_mbrtowc_null_arg1=yes], [gl_cv_func_mbrtowc_null_arg1=no], [:]) fi ]) ]) dnl Test whether mbrtowc supports a NULL string argument correctly. dnl Result is gl_cv_func_mbrtowc_null_arg2. AC_DEFUN([gl_MBRTOWC_NULL_ARG2], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], [gl_cv_func_mbrtowc_null_arg2], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on OSF/1. osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR_UTF8 != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { mbstate_t state; wchar_t wc; int ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; mbrtowc (&wc, NULL, 5, &state); /* Check that wc was not modified. */ if (wc != (wchar_t) 0xBADFACE) return 2; } return 0; }]])], [gl_cv_func_mbrtowc_null_arg2=yes], [gl_cv_func_mbrtowc_null_arg2=no], [:]) fi ]) ]) dnl Test whether mbrtowc, when parsing the end of a multibyte character, dnl correctly returns the number of bytes that were needed to complete the dnl character (not the total number of bytes of the multibyte character). dnl Result is gl_cv_func_mbrtowc_retval. AC_DEFUN([gl_MBRTOWC_RETVAL], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether mbrtowc has a correct return value], [gl_cv_func_mbrtowc_retval], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on HP-UX, Solaris, native Windows. hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_retval="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ || { case "$host_os" in mingw*) true;; *) false;; esac; }; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { int result = 0; int found_some_locale = 0; /* This fails on Solaris. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 1) result |= 1; } found_some_locale = 1; } /* This fails on HP-UX 11.11. */ if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 2) result |= 2; } found_some_locale = 1; } /* This fails on native Windows. */ if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) { char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) { input[3] = '\0'; if (mbrtowc (&wc, input + 4, 4, &state) != 1) result |= 4; } found_some_locale = 1; } if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) { char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) { input[3] = '\0'; if (mbrtowc (&wc, input + 4, 4, &state) != 1) result |= 8; } found_some_locale = 1; } if (setlocale (LC_ALL, "Chinese_China.936") != NULL) { char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */ mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) { input[3] = '\0'; if (mbrtowc (&wc, input + 4, 4, &state) != 1) result |= 16; } found_some_locale = 1; } return (found_some_locale ? result : 77); }]])], [gl_cv_func_mbrtowc_retval=yes], [if test $? != 77; then gl_cv_func_mbrtowc_retval=no fi ], [:]) fi ]) ]) dnl Test whether mbrtowc, when parsing a NUL character, correctly returns 0. dnl Result is gl_cv_func_mbrtowc_nul_retval. AC_DEFUN([gl_MBRTOWC_NUL_RETVAL], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc returns 0 when parsing a NUL character], [gl_cv_func_mbrtowc_nul_retval], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on Solaris 8 and 9. solaris2.[89]) gl_cv_func_mbrtowc_nul_retval="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_mbrtowc_nul_retval="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { /* This fails on Solaris 8 and 9. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { mbstate_t state; wchar_t wc; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "", 1, &state) != 0) return 2; } return 0; }]])], [gl_cv_func_mbrtowc_nul_retval=yes], [gl_cv_func_mbrtowc_nul_retval=no], [:]) fi ]) ]) dnl Test whether mbrtowc stores a wide character when reporting incomplete dnl input. AC_DEFUN([gl_MBRTOWC_STORES_INCOMPLETE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc stores incomplete characters], [gl_cv_func_mbrtowc_stores_incomplete], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess yes on native Windows. mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; esac changequote([,])dnl case "$host_os" in mingw*) AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { int result = 0; if (setlocale (LC_ALL, "French_France.65001") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 1; } if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\226", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 2; } if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\245", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 4; } if (setlocale (LC_ALL, "Chinese_China.936") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\261", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) result |= 8; } return result; }]])], [gl_cv_func_mbrtowc_stores_incomplete=no], [gl_cv_func_mbrtowc_stores_incomplete=yes], [:]) ;; *) AC_REQUIRE([gt_LOCALE_FR_UTF8]) if test $LOCALE_FR_UTF8 != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> #include <wchar.h> int main () { if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) && wc != (wchar_t) 0xBADFACE) return 1; } return 0; }]])], [gl_cv_func_mbrtowc_stores_incomplete=no], [gl_cv_func_mbrtowc_stores_incomplete=yes], [:]) fi ;; esac ]) ]) dnl Test whether mbrtowc returns the correct value on empty input. AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc works on empty input], [gl_cv_func_mbrtowc_empty_input], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on AIX and glibc systems. aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; esac changequote([,])dnl AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <wchar.h> static wchar_t wc; static mbstate_t mbs; int main (void) { return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; }]])], [gl_cv_func_mbrtowc_empty_input=yes], [gl_cv_func_mbrtowc_empty_input=no], [:]) ]) ]) dnl Test whether mbrtowc reports encoding errors in the C locale. dnl Although POSIX was never intended to allow this, the GNU C Library dnl and other implementations do it. See: dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932 AC_DEFUN([gl_MBRTOWC_C_LOCALE], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether the C locale is free of encoding errors], [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <limits.h> #include <locale.h> #include <wchar.h> ]], [[ int i; char *locale = setlocale (LC_ALL, "C"); if (! locale) return 2; for (i = CHAR_MIN; i <= CHAR_MAX; i++) { char c = i; wchar_t wc; mbstate_t mbs = { 0, }; size_t ss = mbrtowc (&wc, &c, 1, &mbs); if (1 < ss) return 3; } return 0; ]])], [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes], [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no], [case "$host_os" in # Guess yes on native Windows. mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; esac ]) ]) ]) # Prerequisites of lib/mbrtowc.c and lib/lc-charset-dispatch.c. AC_DEFUN([gl_PREREQ_MBRTOWC], [ AC_REQUIRE([AC_C_INLINE]) : ]) # Prerequisites of lib/mbtowc-lock.c. AC_DEFUN([gl_PREREQ_MBTOWC_LOCK], [ gl_VISIBILITY ]) dnl From Paul Eggert dnl This is an override of an autoconf macro. AC_DEFUN([AC_FUNC_MBRTOWC], [ dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], [gl_cv_func_mbrtowc], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <wchar.h>]], [[wchar_t wc; char const s[] = ""; size_t n = 1; mbstate_t state; return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], [gl_cv_func_mbrtowc=yes], [gl_cv_func_mbrtowc=no])]) if test $gl_cv_func_mbrtowc = yes; then AC_DEFINE([HAVE_MBRTOWC], [1], [Define to 1 if mbrtowc and mbstate_t are properly declared.]) fi ]) ������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/locale_h.m4�����������������������������������������������������������������0000664�0001750�0001750�00000013756�14670377450�017013� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# locale_h.m4 serial 28 dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_LOCALE_H], [ dnl Ensure to expand the default settings once only, before all statements dnl that occur in other macros. AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) dnl Persuade glibc <locale.h> to define locale_t and the int_p_*, int_n_* dnl members of 'struct lconv'. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) dnl If <stddef.h> is replaced, then <locale.h> must also be replaced. AC_REQUIRE([gl_STDDEF_H]) AC_REQUIRE([gl_LOCALE_T]) dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv' dnl only if _LCONV_C99 is defined. AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in solaris*) AC_DEFINE([_LCONV_C99], [1], [Define to 1 on Solaris.]) ;; esac AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001], [gl_cv_header_locale_h_posix2001], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <locale.h> int x = LC_MESSAGES; int y = sizeof (((struct lconv *) 0)->decimal_point);]], [[]])], [gl_cv_header_locale_h_posix2001=yes], [gl_cv_header_locale_h_posix2001=no])]) dnl Check whether 'struct lconv' is complete. dnl Bionic libc's 'struct lconv' is just a dummy. dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x, dnl mingw, MSVC 9, it lacks the int_p_* and int_n_* members. AC_CACHE_CHECK([whether struct lconv is properly defined], [gl_cv_sys_struct_lconv_ok], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <locale.h> struct lconv l; int x = sizeof (l.decimal_point); int y = sizeof (l.int_p_cs_precedes);]], [[]])], [gl_cv_sys_struct_lconv_ok=yes], [gl_cv_sys_struct_lconv_ok=no]) ]) if test $gl_cv_sys_struct_lconv_ok = no; then dnl On native Windows with MSVC, merely define these member names as macros. dnl This avoids trouble in C++ mode. case "$host_os" in mingw*) AC_EGREP_CPP([Special], [ #ifdef _MSC_VER Special #endif ], [], [REPLACE_STRUCT_LCONV=1]) ;; *) REPLACE_STRUCT_LCONV=1 ;; esac fi dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK. gl_NEXT_HEADERS([locale.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <locale.h> /* Some systems provide declarations in a non-standard header. */ #if HAVE_XLOCALE_H # include <xlocale.h> #endif ]], [setlocale newlocale duplocale freelocale]) ]) dnl Checks to determine whether the system has the locale_t type, dnl and how to obtain it. AC_DEFUN([gl_LOCALE_T], [ dnl Persuade glibc and Solaris <locale.h> to define locale_t. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) dnl Check whether use of locale_t requires inclusion of <xlocale.h>, dnl e.g. on Mac OS X 10.5. If <locale.h> does not define locale_t by dnl itself, we assume that <xlocale.h> will do so. AC_CACHE_CHECK([whether locale.h defines locale_t], [gl_cv_header_locale_has_locale_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <locale.h> locale_t x;]], [[]])], [gl_cv_header_locale_has_locale_t=yes], [gl_cv_header_locale_has_locale_t=no]) ]) dnl Check for <xlocale.h>. AC_CHECK_HEADERS_ONCE([xlocale.h]) if test $ac_cv_header_xlocale_h = yes; then HAVE_XLOCALE_H=1 if test $gl_cv_header_locale_has_locale_t = yes; then gl_cv_header_locale_h_needs_xlocale_h=no else gl_cv_header_locale_h_needs_xlocale_h=yes fi HAVE_LOCALE_T=1 else HAVE_XLOCALE_H=0 gl_cv_header_locale_h_needs_xlocale_h=no if test $gl_cv_header_locale_has_locale_t = yes; then HAVE_LOCALE_T=1 else HAVE_LOCALE_T=0 fi fi AC_SUBST([HAVE_XLOCALE_H]) ]) # gl_LOCALE_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_LOCALE_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) ]) AC_DEFUN([gl_LOCALE_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS]) ]) ������������������kbuild-3608/src/grep/m4/pathmax.m4������������������������������������������������������������������0000664�0001750�0001750�00000002155�14670377450�016676� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pathmax.m4 serial 11 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_PATHMAX], [ dnl Prerequisites of lib/pathmax.h. AC_CHECK_HEADERS_ONCE([sys/param.h]) ]) # Expands to a piece of C program that defines PATH_MAX in the same way as # "pathmax.h" will do. AC_DEFUN([gl_PATHMAX_SNIPPET], [[ /* Arrange to define PATH_MAX, like "pathmax.h" does. */ #if HAVE_UNISTD_H # include <unistd.h> #endif #include <limits.h> #if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN # include <sys/param.h> #endif #if !defined PATH_MAX && defined MAXPATHLEN # define PATH_MAX MAXPATHLEN #endif #ifdef __hpux # undef PATH_MAX # define PATH_MAX 1024 #endif #if defined _WIN32 && ! defined __CYGWIN__ # undef PATH_MAX # define PATH_MAX 260 #endif ]]) # Prerequisites of gl_PATHMAX_SNIPPET. AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ], [ AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/extensions.m4���������������������������������������������������������������0000664�0001750�0001750�00000020333�14670377440�017430� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 22 -*- Autoconf -*- # Enable extensions on systems that normally disable them. # Copyright (C) 2003, 2006-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+. m4_ifndef([AC_CHECK_INCLUDES_DEFAULT], [AC_DEFUN([AC_CHECK_INCLUDES_DEFAULT], [])]) # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git # Autoconf. Perhaps we can remove this once we can assume Autoconf # is recent-enough everywhere, but since Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. # If autoconf reports a warning # warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS # or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS # the fix is # 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked # but always AC_REQUIREd, # 2) to ensure that for each occurrence of # AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) # or # AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) # the corresponding gnulib module description has 'extensions' among # its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS # invocation occurs in gl_EARLY, not in gl_INIT. m4_version_prereq([2.70.1], [], [ # AC_USE_SYSTEM_EXTENSIONS # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. # We unconditionally define as many of the known feature-enabling # as possible, reserving conditional behavior for macros that are # known to cause problems on some platforms (such as __EXTENSIONS__). AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], [AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl AC_BEFORE([$0], [AC_LINK_IFELSE])dnl AC_BEFORE([$0], [AC_RUN_IFELSE])dnl AC_BEFORE([$0], [AC_CHECK_INCLUDES_DEFAULT])dnl dnl #undef in AH_VERBATIM gets replaced with #define by AC_DEFINE. dnl Use a different key than __EXTENSIONS__, as that name broke existing dnl configure.ac when using autoheader 2.62. dnl The macros below are in alphabetical order ignoring leading _ or __ dnl prefixes. AH_VERBATIM([USE_SYSTEM_EXTENSIONS], [/* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable general extensions on macOS. */ #ifndef _DARWIN_C_SOURCE # undef _DARWIN_C_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable X/Open compliant socket functions that do not require linking with -lxnet on HP-UX 11.11. */ #ifndef _HPUX_ALT_XOPEN_SOCKET_API # undef _HPUX_ALT_XOPEN_SOCKET_API #endif /* Identify the host operating system as Minix. This macro does not affect the system headers' behavior. A future release of Autoconf may stop defining this macro. */ #ifndef _MINIX # undef _MINIX #endif /* Enable general extensions on NetBSD. Enable NetBSD compatibility extensions on Minix. */ #ifndef _NETBSD_SOURCE # undef _NETBSD_SOURCE #endif /* Enable OpenBSD compatibility extensions on NetBSD. Oddly enough, this does nothing on OpenBSD. */ #ifndef _OPENBSD_SOURCE # undef _OPENBSD_SOURCE #endif /* Define to 1 if needed for POSIX-compatible behavior. */ #ifndef _POSIX_SOURCE # undef _POSIX_SOURCE #endif /* Define to 2 if needed for POSIX-compatible behavior. */ #ifndef _POSIX_1_SOURCE # undef _POSIX_1_SOURCE #endif /* Enable POSIX-compatible threading on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ #ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ # undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ # undef __STDC_WANT_IEC_60559_BFP_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ #ifndef __STDC_WANT_IEC_60559_DFP_EXT__ # undef __STDC_WANT_IEC_60559_DFP_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ #ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ # undef __STDC_WANT_IEC_60559_FUNCS_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ # undef __STDC_WANT_IEC_60559_TYPES_EXT__ #endif /* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ #ifndef __STDC_WANT_LIB_EXT2__ # undef __STDC_WANT_LIB_EXT2__ #endif /* Enable extensions specified by ISO/IEC 24747:2009. */ #ifndef __STDC_WANT_MATH_SPEC_FUNCS__ # undef __STDC_WANT_MATH_SPEC_FUNCS__ #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable X/Open extensions. Define to 500 only if necessary to make mbstate_t available. */ #ifndef _XOPEN_SOURCE # undef _XOPEN_SOURCE #endif ])dnl AC_REQUIRE([AC_CHECK_INCLUDES_DEFAULT])dnl _AC_CHECK_HEADER_ONCE([wchar.h]) _AC_CHECK_HEADER_ONCE([minix/config.h]) dnl Defining __EXTENSIONS__ may break the system headers on some systems. dnl (FIXME: Which ones?) AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ # define __EXTENSIONS__ 1 ]AC_INCLUDES_DEFAULT])], [ac_cv_safe_to_define___extensions__=yes], [ac_cv_safe_to_define___extensions__=no])]) dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to dnl 500, regardless of whether compiling with -Ae or -D_HPUX_SOURCE=1. dnl But defining _XOPEN_SOURCE may turn *off* extensions on platforms dnl not covered by turn-on-extensions macros (notably Dragonfly, Free, dnl and OpenBSD, which don't have any equivalent of _NETBSD_SOURCE) so dnl it should only be defined when necessary. AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], [ac_cv_should_define__xopen_source], [ac_cv_should_define__xopen_source=no AS_IF([test $ac_cv_header_wchar_h = yes], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ #include <wchar.h> mbstate_t x;]])], [], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ #define _XOPEN_SOURCE 500 #include <wchar.h> mbstate_t x;]])], [ac_cv_should_define__xopen_source=yes])])])]) AC_DEFINE([_ALL_SOURCE]) AC_DEFINE([_DARWIN_C_SOURCE]) AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API]) AC_DEFINE([_NETBSD_SOURCE]) AC_DEFINE([_OPENBSD_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__]) AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__]) AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__]) AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__]) AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__]) AC_DEFINE([__STDC_WANT_LIB_EXT2__]) AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) AC_DEFINE([_TANDEM_SOURCE]) AS_IF([test $ac_cv_header_minix_config_h = yes], [MINIX=yes AC_DEFINE([_MINIX]) AC_DEFINE([_POSIX_SOURCE]) AC_DEFINE([_POSIX_1_SOURCE], [2])], [MINIX=]) AS_IF([test $ac_cv_safe_to_define___extensions__ = yes], [AC_DEFINE([__EXTENSIONS__])]) AS_IF([test $ac_cv_should_define__xopen_source = yes], [AC_DEFINE([_XOPEN_SOURCE], [500])]) ])# AC_USE_SYSTEM_EXTENSIONS ]) # gl_USE_SYSTEM_EXTENSIONS # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], [ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl On OpenBSD 6.8 with GCC, the include files contain a couple of dnl definitions that are only activated with an explicit -D_ISOC11_SOURCE. dnl That's because this version of GCC (4.2.1) supports the option dnl '-std=gnu99' but not the option '-std=gnu11'. AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in openbsd*) AC_DEFINE([_ISOC11_SOURCE], [1], [Define to enable the declarations of ISO C 11 types and functions.]) ;; esac ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/iconv_h.m4������������������������������������������������������������������0000664�0001750�0001750�00000005036�14670377440�016661� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# iconv_h.m4 serial 15 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_ICONV_H], [ AC_REQUIRE([gl_ICONV_H_DEFAULTS]) dnl Execute this unconditionally, because ICONV_H may be set by other dnl modules, after this code is executed. gl_CHECK_NEXT_HEADERS([iconv.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by C89. gl_WARN_ON_USE_PREPARE([[#include <iconv.h> ]], [iconv iconv_open]) AC_REQUIRE([AC_C_RESTRICT]) ]) dnl Unconditionally enables the replacement of <iconv.h>. AC_DEFUN([gl_REPLACE_ICONV_H], [ gl_ICONV_H_REQUIRE_DEFAULTS ICONV_H='iconv.h' AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"]) ]) # gl_ICONV_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_ICONV_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_ICONV_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_ICONV_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_ICONV_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ICONV]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_ICONV_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_ICONV_H_DEFAULTS]) ]) AC_DEFUN([gl_ICONV_H_DEFAULTS], [ m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) dnl Assume proper GNU behavior unless another module says otherwise. ICONV_CONST=; AC_SUBST([ICONV_CONST]) REPLACE_ICONV=0; AC_SUBST([REPLACE_ICONV]) REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN]) REPLACE_ICONV_UTF=0; AC_SUBST([REPLACE_ICONV_UTF]) ICONV_H=''; AC_SUBST([ICONV_H]) m4_ifdef([gl_POSIXCHECK], [ICONV_H='iconv.h'], [if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE. ICONV_H='iconv.h' fi ]) AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"]) ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fcntl-safer.m4��������������������������������������������������������������0000664�0001750�0001750�00000000705�14670377440�017436� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#serial 9 dnl Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FCNTL_SAFER], [ dnl Prerequisites of lib/open-safer.c. AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) ]) AC_DEFUN([gl_OPENAT_SAFER], [ AC_REQUIRE([gl_FCNTL_SAFER]) ]) �����������������������������������������������������������kbuild-3608/src/grep/m4/reallocarray.m4�������������������������������������������������������������0000664�0001750�0001750�00000001367�14670377450�017720� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# reallocarray.m4 serial 3 dnl Copyright (C) 2017-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_REALLOCARRAY], [ dnl Persuade glibc <stdlib.h> to declare reallocarray. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) AC_CHECK_FUNCS([reallocarray]) if test "$ac_cv_func_reallocarray" = no; then HAVE_REALLOCARRAY=0 elif test "$gl_cv_malloc_ptrdiff" = no; then REPLACE_REALLOCARRAY=1 fi ]) # Prerequisites of lib/reallocarray.c. AC_DEFUN([gl_PREREQ_REALLOCARRAY], [:]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/float_h.m4������������������������������������������������������������������0000664�0001750�0001750�00000005457�14670377440�016657� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# float_h.m4 serial 12 dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FLOAT_H], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) FLOAT_H= REPLACE_FLOAT_LDBL=0 case "$host_os" in aix* | beos* | openbsd* | mirbsd* | irix*) FLOAT_H=float.h ;; freebsd* | dragonfly*) case "$host_cpu" in changequote(,)dnl i[34567]86 ) changequote([,])dnl FLOAT_H=float.h ;; x86_64 ) # On x86_64 systems, the C compiler may still be generating # 32-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __LP64__ || defined __x86_64__ || defined __amd64__ int ok; #else error fail #endif ]])], [], [FLOAT_H=float.h]) ;; esac ;; linux*) case "$host_cpu" in powerpc*) FLOAT_H=float.h ;; esac ;; esac case "$host_os" in aix* | freebsd* | dragonfly* | linux*) if test -n "$FLOAT_H"; then REPLACE_FLOAT_LDBL=1 fi ;; esac dnl Test against glibc-2.7 Linux/SPARC64 bug. REPLACE_ITOLD=0 AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], [gl_cv_func_itold_works], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ int i = -1; volatile long double ld; int main () { ld += i * 1.0L; if (ld > 0) return 1; return 0; }]])], [gl_cv_func_itold_works=yes], [gl_cv_func_itold_works=no], [case "$host" in sparc*-*-linux*) AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __LP64__ || defined __arch64__ int ok; #else error fail #endif ]])], [gl_cv_func_itold_works="guessing no"], [gl_cv_func_itold_works="guessing yes"]) ;; # Guess yes on native Windows. mingw*) gl_cv_func_itold_works="guessing yes" ;; *) gl_cv_func_itold_works="guessing yes" ;; esac ]) ]) case "$gl_cv_func_itold_works" in *no) REPLACE_ITOLD=1 dnl We add the workaround to <float.h> but also to <math.h>, dnl to increase the chances that the fix function gets pulled in. FLOAT_H=float.h ;; esac if test -n "$FLOAT_H"; then gl_NEXT_HEADERS([float.h]) fi AC_SUBST([FLOAT_H]) AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"]) AC_SUBST([REPLACE_ITOLD]) ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/largefile.m4����������������������������������������������������������������0000664�0001750�0001750�00000015200�14670377450�017161� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Enable large files on systems where this is not the default. # Enable support for files on Linux file systems with 64-bit inode numbers. # Copyright 1992-1996, 1998-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: # It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this # setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko # and ftello in C++ mode as well. AC_DEFUN([gl_SET_LARGEFILE_SOURCE], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_FUNC_FSEEKO case "$host_os" in hpux*) AC_DEFINE([_LARGEFILE_SOURCE], [1], [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).]) ;; esac ]) # Work around a problem in Autoconf through at least 2.71 on glibc 2.34+ # with _TIME_BITS. Also, work around a problem in autoconf <= 2.69: # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, # or configures them incorrectly in some cases. m4_version_prereq([2.70], [], [ # _AC_SYS_LARGEFILE_TEST_INCLUDES # ------------------------------- m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], [#include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]];[]dnl ]) ])# m4_version_prereq 2.70 # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, # CACHE-VAR, # DESCRIPTION, # PROLOGUE, [FUNCTION-BODY]) # -------------------------------------------------------- m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], [AC_CACHE_CHECK([for $1 value needed for large files], [$3], [while :; do m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( [AC_LANG_PROGRAM([$5], [$6])], [$3=no; break]) m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( [AC_LANG_PROGRAM([#undef $1 #define $1 $2 $5], [$6])], [$3=$2; break]) $3=unknown break done]) case $$3 in #( no | unknown) ;; *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);; esac rm -rf conftest*[]dnl ])# _AC_SYS_LARGEFILE_MACRO_VALUE # AC_SYS_LARGEFILE # ---------------- # By default, many hosts won't let programs access large files; # one must use special compiler options to get large-file access to work. # For more details about this brain damage please see: # http://www.unix.org/version2/whatsnew/lfs20mar.html # Additionally, on Linux file systems with 64-bit inodes a file that happens # to have a 64-bit inode number cannot be accessed by 32-bit applications on # Linux x86/x86_64. This can occur with file systems such as XFS and NFS. AC_DEFUN([AC_SYS_LARGEFILE], [AC_ARG_ENABLE(largefile, [ --disable-largefile omit support for large files]) AS_IF([test "$enable_largefile" != no], [AC_CACHE_CHECK([for special C compiler options needed for large files], ac_cv_sys_largefile_CC, [ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])]) AC_COMPILE_IFELSE([], [break]) CC="$CC -n32" AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break]) break done CC=$ac_save_CC rm -f conftest.$ac_ext fi]) if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits, [Number of bits in a file offset, on hosts where this is settable.], [_AC_SYS_LARGEFILE_TEST_INCLUDES]) AS_CASE([$ac_cv_sys_file_offset_bits], [unknown], [_AC_SYS_LARGEFILE_MACRO_VALUE([_LARGE_FILES], [1], [ac_cv_sys_large_files], [Define for large files, on AIX-style hosts.], [_AC_SYS_LARGEFILE_TEST_INCLUDES])], [64], [gl_YEAR2038_BODY([])])]) ])# AC_SYS_LARGEFILE # Enable large files on systems where this is implemented by Gnulib, not by the # system headers. # Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib # overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively. AC_DEFUN([gl_LARGEFILE], [ AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw*) dnl Native Windows. dnl mingw64 defines off_t to a 64-bit type already, if dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1]; ]], [[]])], [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no]) ]) if test $gl_cv_type_off_t_64 = no; then WINDOWS_64_BIT_OFF_T=1 else WINDOWS_64_BIT_OFF_T=0 fi dnl Some mingw versions define, if _FILE_OFFSET_BITS=64, 'struct stat' dnl to 'struct _stat32i64' or 'struct _stat64' (depending on dnl _USE_32BIT_TIME_T), which has a 32-bit st_size member. AC_CACHE_CHECK([for 64-bit st_size], [gl_cv_member_st_size_64], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> struct stat buf; int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; ]], [[]])], [gl_cv_member_st_size_64=yes], [gl_cv_member_st_size_64=no]) ]) if test $gl_cv_member_st_size_64 = no; then WINDOWS_64_BIT_ST_SIZE=1 else WINDOWS_64_BIT_ST_SIZE=0 fi ;; *) dnl Nothing to do on gnulib's side. dnl A 64-bit off_t is dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX, dnl OSF/1, Cygwin, dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on dnl glibc, HP-UX, Solaris, dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX, dnl - impossible to achieve on Minix 3.1.8. WINDOWS_64_BIT_OFF_T=0 WINDOWS_64_BIT_ST_SIZE=0 ;; esac ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/mbslen.m4�������������������������������������������������������������������0000664�0001750�0001750�00000000721�14670377450�016511� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# mbslen.m4 serial 3 dnl Copyright (C) 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MBSLEN], [ AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([mbslen]) if test $ac_cv_func_mbslen = yes; then HAVE_MBSLEN=1 else HAVE_MBSLEN=0 fi ]) �����������������������������������������������kbuild-3608/src/grep/m4/sockpfaf.m4�����������������������������������������������������������������0000664�0001750�0001750�00000004767�14670377450�017043� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sockpfaf.m4 serial 10 dnl Copyright (C) 2004, 2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) dnl and some common address families (AF_INET, AF_INET6, ...). dnl This test assumes that a system supports an address family if and only if dnl it supports the corresponding protocol family. dnl From Bruno Haible. AC_DEFUN([gl_SOCKET_FAMILIES], [ AC_REQUIRE([gl_SYS_SOCKET_H]) AC_CHECK_HEADERS_ONCE([netinet/in.h]) AC_CACHE_CHECK([for IPv4 sockets], [gl_cv_socket_ipv4], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> #endif #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif]], [[int x = AF_INET; struct in_addr y; struct sockaddr_in z; if (&x && &y && &z) return 0;]])], gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)]) if test $gl_cv_socket_ipv4 = yes; then AC_DEFINE([HAVE_IPV4], [1], [Define to 1 if <sys/socket.h> defines AF_INET.]) fi AC_CACHE_CHECK([for IPv6 sockets], [gl_cv_socket_ipv6], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> #endif #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif]], [[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; if (&x && &y && &z) return 0;]])], gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)]) if test $gl_cv_socket_ipv6 = yes; then AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.]) fi ]) AC_DEFUN([gl_SOCKET_FAMILY_UNIX], [ AC_REQUIRE([gl_SYS_SOCKET_H]) AC_CHECK_HEADERS_ONCE([sys/un.h]) AC_CACHE_CHECK([for UNIX domain sockets], [gl_cv_socket_unix], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_SYS_UN_H #include <sys/un.h> #endif #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif]], [[int x = AF_UNIX; struct sockaddr_un y; if (&x && &y) return 0;]])], gl_cv_socket_unix=yes, gl_cv_socket_unix=no)]) if test $gl_cv_socket_unix = yes; then AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.]) fi ]) ���������kbuild-3608/src/grep/m4/stdbool.m4������������������������������������������������������������������0000664�0001750�0001750�00000007635�14670377450�016712� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Check for stdbool.h that conforms to C99. dnl Copyright (C) 2002-2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. #serial 8 # Prepare for substituting <stdbool.h> if it is not supported. AC_DEFUN([AM_STDBOOL_H], [ AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl On some platforms, <stdbool.h> does not exist or does not conform to C99. dnl On Solaris 10 with CC=cc CXX=CC, <stdbool.h> exists but is not usable dnl in C++ mode (and no <cstdbool> exists). In this case, we use our dnl replacement, also in C mode (for binary compatibility between C and C++). if test "$ac_cv_header_stdbool_h" = yes; then case "$host_os" in solaris*) if test -z "$GCC"; then STDBOOL_H='stdbool.h' else STDBOOL_H='' fi ;; *) STDBOOL_H='' ;; esac else STDBOOL_H='stdbool.h' fi AC_SUBST([STDBOOL_H]) AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) if test "$ac_cv_type__Bool" = yes; then HAVE__BOOL=1 else HAVE__BOOL=0 fi AC_SUBST([HAVE__BOOL]) ]) # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) # This version of the macro is needed in autoconf <= 2.68. AC_DEFUN([AC_CHECK_HEADER_STDBOOL], [AC_CACHE_CHECK([for stdbool.h that conforms to C99], [ac_cv_header_stdbool_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ #include <stdbool.h> #ifdef __cplusplus typedef bool Bool; #else typedef _Bool Bool; #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html */ Bool q = true; Bool *pq = &q; bool *qq = &q; ]], [[ bool e = &s; *pq |= q; *pq |= ! q; *qq |= q; *qq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq + !qq); ]])], [ac_cv_header_stdbool_h=yes], [ac_cv_header_stdbool_h=no])]) AC_CHECK_TYPES([_Bool]) ]) ���������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/inline.m4�������������������������������������������������������������������0000664�0001750�0001750�00000003154�14670377450�016512� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# inline.m4 serial 4 dnl Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Test for the 'inline' keyword or equivalent. dnl Define 'inline' to a supported equivalent, or to nothing if not supported, dnl like AC_C_INLINE does. Also, define HAVE_INLINE if 'inline' or an dnl equivalent is effectively supported, i.e. if the compiler is likely to dnl drop unused 'static inline' functions. AC_DEFUN([gl_INLINE], [ AC_REQUIRE([AC_C_INLINE]) AC_CACHE_CHECK([whether the compiler generally respects inline], [gl_cv_c_inline_effective], [if test $ac_cv_c_inline = no; then gl_cv_c_inline_effective=no else dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is dnl specified. dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result dnl depends on optimization flags, which can be in CFLAGS. dnl (AC_EGREP_CPP looks only at the CPPFLAGS.) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[]], [[#ifdef __NO_INLINE__ #error "inline is not effective" #endif]])], [gl_cv_c_inline_effective=yes], [gl_cv_c_inline_effective=no]) fi ]) if test $gl_cv_c_inline_effective = yes; then AC_DEFINE([HAVE_INLINE], [1], [Define to 1 if the compiler supports one of the keywords 'inline', '__inline__', '__inline' and effectively inlines functions marked as such.]) fi ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sleep.m4��������������������������������������������������������������������0000664�0001750�0001750�00000004472�14670377450�016350� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sleep.m4 serial 11 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SLEEP], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl We expect to see the declaration of sleep() in a header file. dnl Older versions of mingw have a sleep() function that is an alias to dnl _sleep() in MSVCRT. It has a different signature than POSIX sleep(): dnl it takes the number of milliseconds as argument and returns void. dnl mingw does not declare this function. AC_CHECK_DECLS([sleep], , , [[#include <unistd.h>]]) AC_CHECK_FUNCS_ONCE([sleep]) if test $ac_cv_have_decl_sleep != yes; then HAVE_SLEEP=0 else dnl Cygwin 1.5.x has a bug where sleep can't exceed 49.7 days. AC_CACHE_CHECK([for working sleep], [gl_cv_func_sleep_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <errno.h> #include <unistd.h> #include <signal.h> static void handle_alarm (int sig) { if (sig != SIGALRM) _exit (2); } ]], [[ /* Failure to compile this test due to missing alarm is okay, since all such platforms (mingw) also lack sleep. */ unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days. */ unsigned int remaining; signal (SIGALRM, handle_alarm); alarm (1); remaining = sleep (pentecost); if (remaining > pentecost) return 3; if (remaining <= pentecost - 10) return 4; return 0; ]])], [gl_cv_func_sleep_works=yes], [gl_cv_func_sleep_works=no], [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_sleep_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_sleep_works="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_sleep_works="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_sleep_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_sleep_works" in *yes) ;; *) REPLACE_SLEEP=1 ;; esac fi ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/strerror.m4�����������������������������������������������������������������0000664�0001750�0001750�00000007162�14670377450�017121� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# strerror.m4 serial 22 dnl Copyright (C) 2002, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRERROR], [ AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_REQUIRE([gl_HEADER_ERRNO_H]) AC_REQUIRE([gl_FUNC_STRERROR_0]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) ]) if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then AC_CACHE_CHECK([for working strerror function], [gl_cv_func_working_strerror], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <string.h> ]], [[if (!*strerror (-2)) return 1;]])], [gl_cv_func_working_strerror=yes], [gl_cv_func_working_strerror=no], [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_working_strerror="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_working_strerror" in *yes) ;; *) dnl The system's strerror() fails to return a string for out-of-range dnl integers. Replace it. REPLACE_STRERROR=1 ;; esac m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's dnl buffer, we must replace strerror. case "$gl_cv_func_strerror_r_works" in *no) REPLACE_STRERROR=1 ;; esac ]) else dnl The system's strerror() cannot know about the new errno values we add dnl to <errno.h>, or any fix for strerror(0). Replace it. REPLACE_STRERROR=1 fi ]) dnl Detect if strerror(0) passes (that is, does not set errno, and does not dnl return a string that matches strerror(-1)). AC_DEFUN([gl_FUNC_STRERROR_0], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles REPLACE_STRERROR_0=0 AC_CACHE_CHECK([whether strerror(0) succeeds], [gl_cv_func_strerror_0_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <string.h> #include <errno.h> ]], [[int result = 0; char *str; errno = 0; str = strerror (0); if (!*str) result |= 1; if (errno) result |= 2; if (strstr (str, "nknown") || strstr (str, "ndefined")) result |= 4; return result;]])], [gl_cv_func_strerror_0_works=yes], [gl_cv_func_strerror_0_works=no], [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; # Guess yes on native Windows. mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_strerror_0_works" in *yes) ;; *) REPLACE_STRERROR_0=1 AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0) does not return a message implying success.]) ;; esac ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/msvc-inval.m4���������������������������������������������������������������0000664�0001750�0001750�00000001334�14670377450�017311� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# msvc-inval.m4 serial 1 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_MSVC_INVAL], [ AC_CHECK_FUNCS_ONCE([_set_invalid_parameter_handler]) if test $ac_cv_func__set_invalid_parameter_handler = yes; then HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 AC_DEFINE([HAVE_MSVC_INVALID_PARAMETER_HANDLER], [1], [Define to 1 on MSVC platforms that have the "invalid parameter handler" concept.]) else HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 fi AC_SUBST([HAVE_MSVC_INVALID_PARAMETER_HANDLER]) ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/perl.m4���������������������������������������������������������������������0000664�0001750�0001750�00000002607�14670377450�016200� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# serial 10 dnl From Jim Meyering. dnl Find a new-enough version of Perl. # Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2021 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_PERL], [ dnl FIXME: don't hard-code 5.005 AC_MSG_CHECKING([for perl5.005 or newer]) if test "${PERL+set}" = set; then # 'PERL' is set in the user's environment. candidate_perl_names="$PERL" perl_specified=yes else candidate_perl_names='perl perl5' perl_specified=no fi found=no AC_SUBST([PERL]) PERL="$am_missing_run perl" for perl in $candidate_perl_names; do # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. if ( $perl -e 'require 5.005; use File::Compare; use warnings;' ) > /dev/null 2>&1; then PERL=$perl found=yes break fi done AC_MSG_RESULT([$found]) test $found = no && AC_MSG_WARN([ WARNING: You don't seem to have perl5.005 or newer installed, or you lack a usable version of the Perl File::Compare module. As a result, you may be unable to run a few tests or to regenerate certain files if you modify the sources from which they are derived. ] ) ]) �������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/time_h.m4�������������������������������������������������������������������0000664�0001750�0001750�00000016024�14670377450�016501� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Configure a more-standard replacement for <time.h>. # Copyright (C) 2000-2001, 2003-2007, 2009-2021 Free Software Foundation, Inc. # serial 18 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert and Jim Meyering. AC_DEFUN_ONCE([gl_TIME_H], [ dnl Ensure to expand the default settings once only, before all statements dnl that occur in other macros. AC_REQUIRE([gl_TIME_H_DEFAULTS]) gl_NEXT_HEADERS([time.h]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) AC_REQUIRE([AC_C_RESTRICT]) AC_CACHE_CHECK([for TIME_UTC in <time.h>], [gl_cv_time_h_has_TIME_UTC], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <time.h> ]], [[static int x = TIME_UTC; x++;]])], [gl_cv_time_h_has_TIME_UTC=yes], [gl_cv_time_h_has_TIME_UTC=no])]) if test $gl_cv_time_h_has_TIME_UTC = yes; then TIME_H_DEFINES_TIME_UTC=1 else TIME_H_DEFINES_TIME_UTC=0 fi AC_SUBST([TIME_H_DEFINES_TIME_UTC]) ]) dnl Check whether 'struct timespec' is declared dnl in time.h, sys/time.h, pthread.h, or unistd.h. AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], [ AC_CHECK_HEADERS_ONCE([sys/time.h]) AC_CACHE_CHECK([for struct timespec in <time.h>], [gl_cv_sys_struct_timespec_in_time_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <time.h> ]], [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], [gl_cv_sys_struct_timespec_in_time_h=yes], [gl_cv_sys_struct_timespec_in_time_h=no])]) TIME_H_DEFINES_STRUCT_TIMESPEC=0 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 UNISTD_H_DEFINES_STRUCT_TIMESPEC=0 if test $gl_cv_sys_struct_timespec_in_time_h = yes; then TIME_H_DEFINES_STRUCT_TIMESPEC=1 else AC_CACHE_CHECK([for struct timespec in <sys/time.h>], [gl_cv_sys_struct_timespec_in_sys_time_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/time.h> ]], [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], [gl_cv_sys_struct_timespec_in_sys_time_h=yes], [gl_cv_sys_struct_timespec_in_sys_time_h=no])]) if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 else AC_CACHE_CHECK([for struct timespec in <pthread.h>], [gl_cv_sys_struct_timespec_in_pthread_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <pthread.h> ]], [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], [gl_cv_sys_struct_timespec_in_pthread_h=yes], [gl_cv_sys_struct_timespec_in_pthread_h=no])]) if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 else AC_CACHE_CHECK([for struct timespec in <unistd.h>], [gl_cv_sys_struct_timespec_in_unistd_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <unistd.h> ]], [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], [gl_cv_sys_struct_timespec_in_unistd_h=yes], [gl_cv_sys_struct_timespec_in_unistd_h=no])]) if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then UNISTD_H_DEFINES_STRUCT_TIMESPEC=1 fi fi fi fi AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC]) AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC]) ]) # gl_TIME_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_TIME_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_TIME_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CTIME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKTIME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALTIME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_TIME_H_DEFAULTS]) ]) AC_DEFUN([gl_TIME_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) dnl Even GNU libc does not have timezone_t yet. HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) dnl If another module says to replace or to not replace, do that. dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; dnl this lets maintainers check for portability. REPLACE_CTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_CTIME]) REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) REPLACE_STRFTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRFTIME]) REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) REPLACE_TZSET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TZSET]) dnl Hack so that the time module doesn't depend on the sys_time module. dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent. : ${GNULIB_GETTIMEOFDAY=0}; AC_SUBST([GNULIB_GETTIMEOFDAY]) dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier dnl is no longer a big deal. REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/sys_stat_h.m4���������������������������������������������������������������0000664�0001750�0001750�00000012054�14670377450�017413� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# sys_stat_h.m4 serial 41 -*- Autoconf -*- dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Eric Blake. dnl Provide a GNU-like <sys/stat.h>. AC_DEFUN_ONCE([gl_SYS_STAT_H], [ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) dnl Check for broken stat macros. AC_REQUIRE([AC_HEADER_STAT]) gl_CHECK_NEXT_HEADERS([sys/stat.h]) dnl Ensure the type mode_t gets defined. AC_REQUIRE([AC_TYPE_MODE_T]) dnl Whether to enable precise timestamps in 'struct stat'. m4_ifdef([gl_WINDOWS_STAT_TIMESPEC], [ AC_REQUIRE([gl_WINDOWS_STAT_TIMESPEC]) ], [ WINDOWS_STAT_TIMESPEC=0 ]) AC_SUBST([WINDOWS_STAT_TIMESPEC]) dnl Whether to ensure that struct stat.st_size is 64-bit wide. m4_ifdef([gl_LARGEFILE], [ AC_REQUIRE([gl_LARGEFILE]) ], [ WINDOWS_64_BIT_ST_SIZE=0 ]) AC_SUBST([WINDOWS_64_BIT_ST_SIZE]) dnl Define types that are supposed to be defined in <sys/types.h> or dnl <sys/stat.h>. AC_CHECK_TYPE([nlink_t], [], [AC_DEFINE([nlink_t], [int], [Define to the type of st_nlink in struct stat, or a supertype.])], [#include <sys/types.h> #include <sys/stat.h>]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h> ]], [fchmodat fstat fstatat futimens getumask lchmod lstat mkdirat mkfifo mkfifoat mknod mknodat stat utimensat]) AC_REQUIRE([AC_C_RESTRICT]) ]) # gl_SYS_STAT_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_SYS_STAT_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [ gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FUTIMENS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUMASK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHMOD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSTAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIRAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFO]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFOAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNOD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNODAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UTIMENSAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OVERRIDES_STRUCT_STAT]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHMOD], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKDIR], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UMASK], [1]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) ]) AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) HAVE_GETUMASK=1; AC_SUBST([HAVE_GETUMASK]) HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) REPLACE_FCHMODAT=0; AC_SUBST([REPLACE_FCHMODAT]) REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) REPLACE_MKFIFOAT=0; AC_SUBST([REPLACE_MKFIFOAT]) REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) REPLACE_MKNODAT=0; AC_SUBST([REPLACE_MKNODAT]) REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/unistd-safer.m4�������������������������������������������������������������0000664�0001750�0001750�00000000530�14670377450�017633� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#serial 9 dnl Copyright (C) 2002, 2005-2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_UNISTD_SAFER], [ AC_CHECK_FUNCS_ONCE([pipe]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/signal_h.m4�����������������������������������������������������������������0000664�0001750�0001750�00000007315�14670377450�017023� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# signal_h.m4 serial 22 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_SIGNAL_H], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) gl_NEXT_HEADERS([signal.h]) # AIX declares sig_atomic_t to already include volatile, and C89 compilers # then choke on 'volatile sig_atomic_t'. C99 requires that it compile. AC_CHECK_TYPE([volatile sig_atomic_t], [], [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[ #include <signal.h> ]]) dnl Ensure the type pid_t gets defined. AC_REQUIRE([AC_TYPE_PID_T]) AC_REQUIRE([AC_TYPE_UID_T]) dnl Persuade glibc <signal.h> to define sighandler_t. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[ #include <signal.h> ]]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <signal.h> ]], [pthread_sigmask sigaction sigaddset sigdelset sigemptyset sigfillset sigismember sigpending sigprocmask]) AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_CHECK_TYPE_SIGSET_T], [ AC_CHECK_TYPES([sigset_t], [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no], [[ #include <signal.h> /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */ #include <sys/types.h> ]]) if test $gl_cv_type_sigset_t != yes; then HAVE_SIGSET_T=0 fi ]) # gl_SIGNAL_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. # This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR], [ dnl Ensure to expand the default settings once only. gl_SIGNAL_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) # Initializes the default values for AC_SUBSTed shell variables. # This macro must not be AC_REQUIREd. It must only be invoked, and only # outside of macros or in macros that are not AC_REQUIREd. AC_DEFUN([gl_SIGNAL_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SIGMASK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAISE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNAL_H_SIGPIPE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGPROCMASK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGACTION]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) ]) AC_DEFUN([gl_SIGNAL_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK]) HAVE_RAISE=1; AC_SUBST([HAVE_RAISE]) HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T]) HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T]) HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION]) HAVE_STRUCT_SIGACTION_SA_SIGACTION=1; AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION]) HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T]) HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T]) REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK]) REPLACE_RAISE=0; AC_SUBST([REPLACE_RAISE]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/localename.m4���������������������������������������������������������������0000664�0001750�0001750�00000002446�14670377450�017337� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# localename.m4 serial 8 dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_LOCALENAME], [ AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) AC_REQUIRE([gl_LOCALE_T]) AC_REQUIRE([gt_LC_MESSAGES]) AC_REQUIRE([gt_INTL_THREAD_LOCALE_NAME]) AC_REQUIRE([gt_INTL_MACOSX]) AC_CHECK_HEADERS_ONCE([langinfo.h]) if test $HAVE_LOCALE_T = 1; then AC_CHECK_FUNCS_ONCE([newlocale duplocale freelocale]) gl_func_newlocale="$ac_cv_func_newlocale" gl_func_duplocale="$ac_cv_func_duplocale" gl_func_freelocale="$ac_cv_func_freelocale" else dnl In 2019, some versions of z/OS lack the locale_t type and have broken dnl newlocale, duplocale, freelocale functions. gl_func_newlocale=no gl_func_duplocale=no gl_func_freelocale=no fi if test $gl_func_newlocale != yes; then HAVE_NEWLOCALE=0 fi if test $gl_func_duplocale != yes; then HAVE_DUPLOCALE=0 fi if test $gl_func_freelocale != yes; then HAVE_FREELOCALE=0 fi if test $gt_localename_enhances_locale_funcs = yes; then REPLACE_NEWLOCALE=1 REPLACE_DUPLOCALE=1 REPLACE_FREELOCALE=1 fi ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/pcre.m4���������������������������������������������������������������������0000664�0001750�0001750�00000003373�14670377450�016170� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pcre.m4 - check for libpcre support # Copyright (C) 2010-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_PCRE], [ AC_ARG_ENABLE([perl-regexp], AS_HELP_STRING([--disable-perl-regexp], [disable perl-regexp (pcre) support]), [case $enableval in yes|no) test_pcre=$enableval;; *) AC_MSG_ERROR([invalid value $enableval for --disable-perl-regexp]);; esac], [test_pcre=maybe]) AC_SUBST([PCRE_CFLAGS]) AC_SUBST([PCRE_LIBS]) use_pcre=no if test $test_pcre != no; then PKG_CHECK_MODULES([PCRE], [libpcre], [], [: ${PCRE_LIBS=-lpcre}]) AC_CACHE_CHECK([for pcre_compile], [pcre_cv_have_pcre_compile], [pcre_saved_CFLAGS=$CFLAGS pcre_saved_LIBS=$LIBS CFLAGS="$CFLAGS $PCRE_CFLAGS" LIBS="$PCRE_LIBS $LIBS" AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include <pcre.h> ]], [[pcre *p = pcre_compile (0, 0, 0, 0, 0); return !p;]])], [pcre_cv_have_pcre_compile=yes], [pcre_cv_have_pcre_compile=no]) CFLAGS=$pcre_saved_CFLAGS LIBS=$pcre_saved_LIBS]) if test "$pcre_cv_have_pcre_compile" = yes; then use_pcre=yes elif test $test_pcre = maybe; then AC_MSG_WARN([AC_PACKAGE_NAME will be built without pcre support.]) else AC_MSG_ERROR([pcre support not available]) fi fi if test $use_pcre = yes; then AC_DEFINE([HAVE_LIBPCRE], [1], [Define to 1 if you have the Perl Compatible Regular Expressions library (-lpcre).]) else PCRE_CFLAGS= PCRE_LIBS= fi ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/libunistring-base.m4��������������������������������������������������������0000664�0001750�0001750�00000014260�14670377450�020655� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# libunistring-base.m4 serial 5 dnl Copyright (C) 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paolo Bonzini and Bruno Haible. dnl gl_LIBUNISTRING_MODULE([VERSION], [Module]) dnl Declares that the source files of Module should be compiled, unless we dnl are linking with libunistring and its version is >= the given VERSION. dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is dnl true if the source files of Module should be compiled. dnl This macro is to be used for public libunistring API, not for dnl undocumented API. dnl dnl You have to bump the VERSION argument to the next projected version dnl number each time you make a change that affects the behaviour of the dnl functions defined in Module (even if the sources of Module itself do not dnl change). AC_DEFUN([gl_LIBUNISTRING_MODULE], [ AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE]) dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from dnl gl_LIBUNISTRING_CORE if that macro has been run. AM_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]), [gl_LIBUNISTRING_VERSION_CMP([$1])]) ]) dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile]) dnl Declares that HeaderFile should be created, unless we are linking dnl with libunistring and its version is >= the given VERSION. dnl HeaderFile should be relative to the lib directory and end in '.h'. dnl Prepares for substituting LIBUNISTRING_HEADERFILE (to HeaderFile or empty). dnl dnl When we are linking with the already installed libunistring and its version dnl is < VERSION, we create HeaderFile here, because we may compile functions dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed dnl version. dnl When we are linking with the already installed libunistring and its version dnl is > VERSION, we don't create HeaderFile here: it could cause compilation dnl errors in other libunistring header files if some types are missing. dnl dnl You have to bump the VERSION argument to the next projected version dnl number each time you make a non-comment change to the HeaderFile. AC_DEFUN([gl_LIBUNISTRING_LIBHEADER], [ AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE]) dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from dnl gl_LIBUNISTRING_CORE if that macro has been run. if gl_LIBUNISTRING_VERSION_CMP([$1]); then LIBUNISTRING_[]AS_TR_CPP([$2])='$2' else LIBUNISTRING_[]AS_TR_CPP([$2])= fi AC_SUBST([LIBUNISTRING_]AS_TR_CPP([$2])) ]) dnl Miscellaneous preparations/initializations. AC_DEFUN([gl_LIBUNISTRING_LIB_PREPARE], [ dnl Ensure that HAVE_LIBUNISTRING is fully determined at this point. m4_ifdef([gl_LIBUNISTRING], [AC_REQUIRE([gl_LIBUNISTRING])]) AC_REQUIRE([AC_PROG_AWK]) dnl Sed expressions to extract the parts of a version number. changequote(,) gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;} i\ 0 q ' gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;} i\ 0 q ' gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;} i\ 0 q ' changequote([,]) if test "$HAVE_LIBUNISTRING" = yes; then LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"` LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"` LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"` fi ]) dnl gl_LIBUNISTRING_VERSION_CMP([VERSION]) dnl Expands to a shell statement that evaluates to true if LIBUNISTRING_VERSION dnl is less than the VERSION argument. AC_DEFUN([gl_LIBUNISTRING_VERSION_CMP], [ { test "$HAVE_LIBUNISTRING" != yes \ || { dnl AS_LITERAL_IF exists and works fine since autoconf-2.59 at least. AS_LITERAL_IF([$1], [dnl This is the optimized variant, that assumes the argument is a literal: m4_pushdef([requested_version_major], [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^\([0-9]*\).*], [\1]), [])]) m4_pushdef([requested_version_minor], [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.]\([0-9]*\).*], [\1]), [$1])]) m4_pushdef([requested_version_subminor], [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.][0-9]*[.]\([0-9]*\).*], [\1]), [$1])]) test $LIBUNISTRING_VERSION_MAJOR -lt requested_version_major \ || { test $LIBUNISTRING_VERSION_MAJOR -eq requested_version_major \ && { test $LIBUNISTRING_VERSION_MINOR -lt requested_version_minor \ || { test $LIBUNISTRING_VERSION_MINOR -eq requested_version_minor \ && test $LIBUNISTRING_VERSION_SUBMINOR -lt requested_version_subminor } } } m4_popdef([requested_version_subminor]) m4_popdef([requested_version_minor]) m4_popdef([requested_version_major]) ], [dnl This is the unoptimized variant: requested_version_major=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_major"` requested_version_minor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_minor"` requested_version_subminor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_subminor"` test $LIBUNISTRING_VERSION_MAJOR -lt $requested_version_major \ || { test $LIBUNISTRING_VERSION_MAJOR -eq $requested_version_major \ && { test $LIBUNISTRING_VERSION_MINOR -lt $requested_version_minor \ || { test $LIBUNISTRING_VERSION_MINOR -eq $requested_version_minor \ && test $LIBUNISTRING_VERSION_SUBMINOR -lt $requested_version_subminor } } } ]) } }]) dnl gl_LIBUNISTRING_ARG_OR_ZERO([ARG], [ORIG]) expands to ARG if it is not the dnl same as ORIG, otherwise to 0. m4_define([gl_LIBUNISTRING_ARG_OR_ZERO], [m4_if([$1], [$2], [0], [$1])]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/minmax.m4�������������������������������������������������������������������0000664�0001750�0001750�00000002455�14670377450�016530� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# minmax.m4 serial 4 dnl Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_PREREQ([2.53]) AC_DEFUN([gl_MINMAX], [ AC_REQUIRE([gl_PREREQ_MINMAX]) ]) # Prerequisites of lib/minmax.h. AC_DEFUN([gl_PREREQ_MINMAX], [ gl_MINMAX_IN_HEADER([limits.h]) gl_MINMAX_IN_HEADER([sys/param.h]) ]) dnl gl_MINMAX_IN_HEADER(HEADER) dnl The parameter has to be a literal header name; it cannot be macro, dnl nor a shell variable. (Because autoheader collects only AC_DEFINE dnl invocations with a literal macro name.) AC_DEFUN([gl_MINMAX_IN_HEADER], [ m4_pushdef([header], AS_TR_SH([$1])) m4_pushdef([HEADER], AS_TR_CPP([$1])) AC_CACHE_CHECK([whether <$1> defines MIN and MAX], [gl_cv_minmax_in_]header, [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <$1> int x = MIN (42, 17);]], [[]])], [gl_cv_minmax_in_]header[=yes], [gl_cv_minmax_in_]header[=no])]) if test $gl_cv_minmax_in_[]header = yes; then AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1, [Define to 1 if <$1> defines the MIN and MAX macros.]) fi m4_popdef([HEADER]) m4_popdef([header]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fcntl-o.m4������������������������������������������������������������������0000664�0001750�0001750�00000011236�14670377440�016575� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# fcntl-o.m4 serial 7 dnl Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Paul Eggert. AC_PREREQ([2.60]) # Test whether the flags O_NOATIME and O_NOFOLLOW actually work. # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. AC_DEFUN([gl_FCNTL_O_FLAGS], [ dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_FUNCS_ONCE([symlink]) AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> #include <sys/stat.h> #if HAVE_UNISTD_H # include <unistd.h> #else /* on Windows with MSVC */ # include <io.h> # include <stdlib.h> # defined sleep(n) _sleep ((n) * 1000) #endif #include <fcntl.h> ]GL_MDA_DEFINES[ #ifndef O_NOATIME #define O_NOATIME 0 #endif #ifndef O_NOFOLLOW #define O_NOFOLLOW 0 #endif static int const constants[] = { O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY }; ]], [[ int result = !constants; #if HAVE_SYMLINK { static char const sym[] = "conftest.sym"; if (symlink ("/dev/null", sym) != 0) result |= 2; else { int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); if (fd >= 0) { close (fd); result |= 4; } } if (unlink (sym) != 0 || symlink (".", sym) != 0) result |= 2; else { int fd = open (sym, O_RDONLY | O_NOFOLLOW); if (fd >= 0) { close (fd); result |= 4; } } unlink (sym); } #endif { static char const file[] = "confdefs.h"; int fd = open (file, O_RDONLY | O_NOATIME); if (fd < 0) result |= 8; else { struct stat st0; if (fstat (fd, &st0) != 0) result |= 16; else { char c; sleep (1); if (read (fd, &c, 1) != 1) result |= 24; else { if (close (fd) != 0) result |= 32; else { struct stat st1; if (stat (file, &st1) != 0) result |= 40; else if (st0.st_atime != st1.st_atime) result |= 64; } } } } } return result;]])], [gl_cv_header_working_fcntl_h=yes], [case $? in #( 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( *) gl_cv_header_working_fcntl_h='no';; esac], [case "$host_os" in # Guess 'no' on native Windows. mingw*) gl_cv_header_working_fcntl_h='no' ;; *) gl_cv_header_working_fcntl_h=cross-compiling ;; esac ]) ]) case $gl_cv_header_working_fcntl_h in #( *O_NOATIME* | no | cross-compiling) ac_val=0;; #( *) ac_val=1;; esac AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], [Define to 1 if O_NOATIME works.]) case $gl_cv_header_working_fcntl_h in #( *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( *) ac_val=1;; esac AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], [Define to 1 if O_NOFOLLOW works.]) ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/malloca.m4������������������������������������������������������������������0000664�0001750�0001750�00000001033�14670377450�016636� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# malloca.m4 serial 2 dnl Copyright (C) 2003-2004, 2006-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_MALLOCA], [ dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables dnl @ALLOCA@ and @LTALLOCA@. dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. AC_REQUIRE([gl_EEMALLOC]) ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/iswdigit.m4�����������������������������������������������������������������0000664�0001750�0001750�00000006332�14670377450�017060� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# iswdigit.m4 serial 3 dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ISWDIGIT], [ AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) AC_REQUIRE([gl_WCTYPE_H]) AC_REQUIRE([gt_LOCALE_FR]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([gt_LOCALE_ZH_CN]) if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then dnl <wctype.h> redefines iswdigit already. REPLACE_ISWDIGIT="$REPLACE_ISWCNTRL" else AC_CACHE_CHECK([whether iswdigit is ISO C compliant], [gl_cv_func_iswdigit_works], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on FreeBSD, NetBSD, Solaris, native Windows. freebsd* | dragonfly* | netbsd* | solaris* | mingw*) gl_cv_func_iswdigit_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_iswdigit_works="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> #include <stdlib.h> #include <string.h> #include <wchar.h> #include <wctype.h> /* Returns the value of iswdigit for the multibyte character s[0..n-1]. */ static int for_character (const char *s, size_t n) { mbstate_t state; wchar_t wc; size_t ret; memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, s, n, &state); if (ret != n) abort (); return iswdigit (wc); } int main (int argc, char *argv[]) { int is; int result = 0; if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { /* This fails on mingw, MSVC 14. */ /* U+00B2 SUPERSCRIPT TWO */ is = for_character ("\262", 1); if (!(is == 0)) result |= 1; } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { /* This fails on NetBSD 8.0. */ /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\243\261", 2); if (!(is == 0)) result |= 2; } if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */ /* U+0663 ARABIC-INDIC DIGIT THREE */ is = for_character ("\331\243", 2); if (!(is == 0)) result |= 4; /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */ /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\357\274\221", 3); if (!(is == 0)) result |= 8; } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { /* This fails on NetBSD 8.0, Solaris 10, Solaris 11.4. */ /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\243\261", 2); if (!(is == 0)) result |= 16; } return result; }]])], [gl_cv_func_iswdigit_works=yes], [gl_cv_func_iswdigit_works=no], [:]) fi ]) case "$gl_cv_func_iswdigit_works" in *yes) ;; *) REPLACE_ISWDIGIT=1 ;; esac fi ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/fts.m4����������������������������������������������������������������������0000664�0001750�0001750�00000003151�14670377450�016025� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#serial 22 dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FTS], [ gl_FUNC_FTS_CORE ]) AC_DEFUN([gl_FUNC_FTS_CORE], [ dnl Prerequisites of lib/fts.c. gl_FUNC_OPENAT AC_CHECK_FUNCS_ONCE([fstatfs]) AC_CHECK_HEADERS_ONCE([sys/param.h sys/vfs.h])dnl if test "$ac_cv_func_fstatfs,$ac_cv_header_sys_vfs_h" = yes,yes; then AC_CHECK_MEMBERS([struct statfs.f_type], [], [], [[$ac_includes_default #include <sys/vfs.h> ]]) if test "$ac_cv_member_struct_statfs_f_type" = yes; then AC_CHECK_TYPES([__fsword_t], [], [], [[$ac_includes_default #include <sys/vfs.h> ]]) fi fi AC_CHECK_FUNC([fts_open]) if test $ac_cv_func_fts_open = yes; then dnl The system already has the symbols fts_open, etc. dnl Avoid conflicts between these symbols and ours at the linker level. AC_DEFINE([fts_open], [rpl_fts_open], [Define to the overridden function name]) AC_DEFINE([fts_close], [rpl_fts_close], [Define to the overridden function name]) AC_DEFINE([fts_read], [rpl_fts_read], [Define to the overridden function name]) AC_DEFINE([fts_set], [rpl_fts_set], [Define to the overridden function name]) AC_DEFINE([fts_children], [rpl_fts_children], [Define to the overridden function name]) AC_DEFINE([fts_cross_check], [rpl_fts_cross_check], [Define to the overridden function name]) fi ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/lcmessage.m4����������������������������������������������������������������0000664�0001750�0001750�00000002515�14670377450�017177� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# lcmessage.m4 serial 8 dnl Copyright (C) 1995-2002, 2004-2005, 2008-2014, 2016, 2019-2021 Free dnl Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can be used in projects which are not available under dnl the GNU General Public License or the GNU Lesser General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper <drepper@cygnus.com>, 1995. # Check whether LC_MESSAGES is available in <locale.h>. AC_DEFUN([gt_LC_MESSAGES], [ AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <locale.h>]], [[return LC_MESSAGES]])], [gt_cv_val_LC_MESSAGES=yes], [gt_cv_val_LC_MESSAGES=no])]) if test $gt_cv_val_LC_MESSAGES = yes; then AC_DEFINE([HAVE_LC_MESSAGES], [1], [Define if your <locale.h> file defines LC_MESSAGES.]) fi ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/obstack.m4������������������������������������������������������������������0000664�0001750�0001750�00000002436�14670377450�016664� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# See if we need to provide obstacks. dnl Copyright 1996-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This replaces Autoconf's AC_FUNC_OBSTACK. dnl The Autoconf version should be marked obsolete at some point. AC_DEFUN([AC_FUNC_OBSTACK], [AC_LIBSOURCES([obstack.h, obstack.c])dnl AC_CACHE_CHECK([for obstacks that work with any size object], [ac_cv_func_obstack], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include "obstack.h" void *obstack_chunk_alloc (size_t n) { return 0; } void obstack_chunk_free (void *p) { } /* Check that an internal function returns size_t, not int. */ size_t _obstack_memory_used (struct obstack *); ]], [[struct obstack mem; obstack_init (&mem); obstack_free (&mem, 0); ]])], [ac_cv_func_obstack=yes], [ac_cv_func_obstack=no])]) if test "$ac_cv_func_obstack" = yes; then AC_DEFINE([HAVE_OBSTACK], 1, [Define to 1 if the system has obstacks that work with any size object.]) else AC_LIBOBJ([obstack]) fi ]) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/progtest.m4�����������������������������������������������������������������0000664�0001750�0001750�00000006040�14670377450�017100� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# progtest.m4 serial 7 (gettext-0.18.2) dnl Copyright (C) 1996-2003, 2005, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper <drepper@cygnus.com>, 1996. AC_PREREQ([2.50]) # Search path for a program which passes the given test. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN([AM_PATH_PROG_WITH_TEST], [ # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL([ac_cv_path_$1], [case "[$]$1" in [[\\/]]* | ?:[[\\/]]*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in ifelse([$5], , $PATH, [$5]); do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$][$1]) else AC_MSG_RESULT([no]) fi AC_SUBST([$1])dnl ]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/perror.m4�������������������������������������������������������������������0000664�0001750�0001750�00000005215�14670377450�016545� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# perror.m4 serial 9 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_PERROR], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_REQUIRE([gl_HEADER_ERRNO_H]) AC_REQUIRE([gl_FUNC_STRERROR_R]) AC_REQUIRE([gl_FUNC_STRERROR_0]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl We intentionally do not check for the broader REPLACE_STRERROR_R, dnl since on glibc systems, strerror_r is replaced only for signature dnl issues, and perror is just fine. Rather, we only want to dnl replace perror if strerror_r was replaced for a content fix. if test "$ERRNO_H:$REPLACE_STRERROR_0" != :0; then dnl The system's perror() cannot know about the new errno values we add dnl to <errno.h>, or any fix for strerror(0). Replace it. REPLACE_PERROR=1 fi case ${gl_cv_func_strerror_r_works-unset} in unset|*yes) AC_CACHE_CHECK([whether perror matches strerror], [gl_cv_func_perror_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> ]], [[char *str = strerror (-1); if (!getenv("CONFTEST_OUTPUT")) return 0; if (!str) str = ""; puts (str); errno = -1; perror (""); return 0; ]])], [if CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2 \ && cmp conftest.txt1 conftest.txt2 >/dev/null; then gl_cv_func_perror_works=yes else gl_cv_func_perror_works=no fi rm -rf conftest.txt1 conftest.txt2], [gl_cv_func_perror_works=no], [case "$host_os" in # Guess yes on musl systems. *-musl*) gl_cv_func_perror_works="guessing yes" ;; # Guess yes on native Windows. mingw*) gl_cv_func_perror_works="guessing yes" ;; # Otherwise obey --enable-cross-guesses. *) gl_cv_func_perror_works="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_perror_works" in *yes) ;; *) REPLACE_PERROR=1 ;; esac ;; *) dnl The system's perror() probably inherits the bugs in the dnl system's strerror_r(). Replace it. REPLACE_PERROR=1 ;; esac ]) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/memchr.m4�������������������������������������������������������������������0000664�0001750�0001750�00000006520�14670377450�016507� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# memchr.m4 serial 18 dnl Copyright (C) 2002-2004, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_FUNC_MEMCHR], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Check for prerequisites for memory fence checks. gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) AC_REQUIRE([gl_STRING_H_DEFAULTS]) # Detect platform-specific bugs in some versions of glibc: # memchr should not dereference anything with length 0 # https://bugzilla.redhat.com/show_bug.cgi?id=499689 # memchr should not dereference overestimated length after a match # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 # memchr should cast the second argument to 'unsigned char'. # This bug exists in Android 4.3. # Assume that memchr works on platforms that lack mprotect. AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> #if HAVE_SYS_MMAN_H # include <fcntl.h> # include <unistd.h> # include <sys/types.h> # include <sys/mman.h> # ifndef MAP_FILE # define MAP_FILE 0 # endif #endif ]], [[ int result = 0; char *fence = NULL; #if HAVE_SYS_MMAN_H && HAVE_MPROTECT # if HAVE_MAP_ANONYMOUS const int flags = MAP_ANONYMOUS | MAP_PRIVATE; const int fd = -1; # else /* !HAVE_MAP_ANONYMOUS */ const int flags = MAP_FILE | MAP_PRIVATE; int fd = open ("/dev/zero", O_RDONLY, 0666); if (fd >= 0) # endif { int pagesize = getpagesize (); char *two_pages = (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, flags, fd, 0); if (two_pages != (char *)(-1) && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) fence = two_pages + pagesize; } #endif if (fence) { /* Test against bugs on glibc systems. */ if (memchr (fence, 0, 0)) result |= 1; strcpy (fence - 9, "12345678"); if (memchr (fence - 9, 0, 79) != fence - 1) result |= 2; if (memchr (fence - 1, 0, 3) != fence - 1) result |= 4; /* Test against bug on AIX 7.2. */ if (memchr (fence - 4, '6', 16) != fence - 4) result |= 8; } /* Test against bug on Android 4.3. */ { char input[3]; input[0] = 'a'; input[1] = 'b'; input[2] = 'c'; if (memchr (input, 0x789abc00 | 'b', 3) != input + 1) result |= 16; } return result; ]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], [case "$host_os" in # Guess no on Android. linux*-android*) gl_cv_func_memchr_works="guessing no" ;; # Guess yes on native Windows. mingw*) gl_cv_func_memchr_works="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; esac ]) ]) case "$gl_cv_func_memchr_works" in *yes) ;; *) REPLACE_MEMCHR=1 ;; esac ]) # Prerequisites of lib/memchr.c. AC_DEFUN([gl_PREREQ_MEMCHR], [ AC_CHECK_HEADERS([bp-sym.h]) ]) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/m4/read.m4���������������������������������������������������������������������0000664�0001750�0001750�00000001610�14670377450�016142� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# read.m4 serial 5 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_READ], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) m4_ifdef([gl_MSVC_INVAL], [ AC_REQUIRE([gl_MSVC_INVAL]) if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then REPLACE_READ=1 fi ]) dnl This ifdef is just an optimization, to avoid performing a configure dnl check whose result is not used. It does not make the test of dnl GNULIB_UNISTD_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. m4_ifdef([gl_NONBLOCKING_IO], [ gl_NONBLOCKING_IO if test $gl_cv_have_nonblocking != yes; then REPLACE_READ=1 fi ]) ]) # Prerequisites of lib/read.c. AC_DEFUN([gl_PREREQ_READ], [:]) ������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/config.hin���������������������������������������������������������������������0000664�0001750�0001750�00000225514�14670377427�016431� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* config.hin. Generated from configure.ac by autoheader. */ /* CPU and C ABI indicator */ #ifndef __i386__ #undef __i386__ #endif #ifndef __x86_64_x32__ #undef __x86_64_x32__ #endif #ifndef __x86_64__ #undef __x86_64__ #endif #ifndef __alpha__ #undef __alpha__ #endif #ifndef __arm__ #undef __arm__ #endif #ifndef __armhf__ #undef __armhf__ #endif #ifndef __arm64_ilp32__ #undef __arm64_ilp32__ #endif #ifndef __arm64__ #undef __arm64__ #endif #ifndef __hppa__ #undef __hppa__ #endif #ifndef __hppa64__ #undef __hppa64__ #endif #ifndef __ia64_ilp32__ #undef __ia64_ilp32__ #endif #ifndef __ia64__ #undef __ia64__ #endif #ifndef __m68k__ #undef __m68k__ #endif #ifndef __mips__ #undef __mips__ #endif #ifndef __mipsn32__ #undef __mipsn32__ #endif #ifndef __mips64__ #undef __mips64__ #endif #ifndef __powerpc__ #undef __powerpc__ #endif #ifndef __powerpc64__ #undef __powerpc64__ #endif #ifndef __powerpc64_elfv2__ #undef __powerpc64_elfv2__ #endif #ifndef __riscv32__ #undef __riscv32__ #endif #ifndef __riscv64__ #undef __riscv64__ #endif #ifndef __riscv32_ilp32__ #undef __riscv32_ilp32__ #endif #ifndef __riscv32_ilp32f__ #undef __riscv32_ilp32f__ #endif #ifndef __riscv32_ilp32d__ #undef __riscv32_ilp32d__ #endif #ifndef __riscv64_ilp32__ #undef __riscv64_ilp32__ #endif #ifndef __riscv64_ilp32f__ #undef __riscv64_ilp32f__ #endif #ifndef __riscv64_ilp32d__ #undef __riscv64_ilp32d__ #endif #ifndef __riscv64_lp64__ #undef __riscv64_lp64__ #endif #ifndef __riscv64_lp64f__ #undef __riscv64_lp64f__ #endif #ifndef __riscv64_lp64d__ #undef __riscv64_lp64d__ #endif #ifndef __s390__ #undef __s390__ #endif #ifndef __s390x__ #undef __s390x__ #endif #ifndef __sh__ #undef __sh__ #endif #ifndef __sparc__ #undef __sparc__ #endif #ifndef __sparc64__ #undef __sparc64__ #endif /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to the function xargmatch calls on failures. */ #undef ARGMATCH_DIE /* Define to the declaration of the xargmatch failure function. */ #undef ARGMATCH_DIE_DECL /* Define to the number of bits in type 'ptrdiff_t'. */ #undef BITSIZEOF_PTRDIFF_T /* Define to the number of bits in type 'sig_atomic_t'. */ #undef BITSIZEOF_SIG_ATOMIC_T /* Define to the number of bits in type 'size_t'. */ #undef BITSIZEOF_SIZE_T /* Define to the number of bits in type 'wchar_t'. */ #undef BITSIZEOF_WCHAR_T /* Define to the number of bits in type 'wint_t'. */ #undef BITSIZEOF_WINT_T /* Define to 1 if the `closedir' function returns void instead of int. */ #undef CLOSEDIR_VOID /* Define to 1 if using 'alloca.c'. */ #undef C_ALLOCA /* Define as the bit index in the word where to find bit 0 of the exponent of 'double'. */ #undef DBL_EXPBIT0_BIT /* Define as the word index where to find the exponent of 'double'. */ #undef DBL_EXPBIT0_WORD /* the name of the file descriptor member of DIR */ #undef DIR_FD_MEMBER_NAME #ifdef DIR_FD_MEMBER_NAME # define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME) #else # define DIR_TO_FD(Dir_p) -1 #endif /* Define to 1 if // is a file system root distinct from /. */ #undef DOUBLE_SLASH_IS_DISTINCT_ROOT /* Define if struct dirent has a member d_ino that actually works. */ #undef D_INO_IN_DIRENT /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS /* Define this to 1 if F_DUPFD behavior does not match POSIX */ #undef FCNTL_DUPFD_BUGGY /* Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like 'struct s { int n; short d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 compilers. Use 'FLEXSIZEOF (struct s, d, N * sizeof (short))' to calculate the size in bytes of such a struct containing an N-element array. */ #undef FLEXIBLE_ARRAY_MEMBER /* Define to 1 if fopen() fails to recognize a trailing slash. */ #undef FOPEN_TRAILING_SLASH_BUG /* Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string. */ #undef FUNC_NL_LANGINFO_YESEXPR_WORKS /* Define this to 'void' or 'struct timezone' to match the system's declaration of the second argument to gettimeofday. */ #undef GETTIMEOFDAY_TIMEZONE /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module close-stream shall be considered present. */ #undef GNULIB_CLOSE_STREAM /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fcntl-safer shall be considered present. */ #undef GNULIB_FCNTL_SAFER /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fdopendir shall be considered present. */ #undef GNULIB_FDOPENDIR /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fd-safer-flag shall be considered present. */ #undef GNULIB_FD_SAFER_FLAG /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fopen-gnu shall be considered present. */ #undef GNULIB_FOPEN_GNU /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fscanf shall be considered present. */ #undef GNULIB_FSCANF /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module isblank shall be considered present. */ #undef GNULIB_ISBLANK /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module lock shall be considered present. */ #undef GNULIB_LOCK /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module msvc-nothrow shall be considered present. */ #undef GNULIB_MSVC_NOTHROW /* Define to 1 to disable use of VLAs */ #undef GNULIB_NO_VLA /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module openat shall be considered present. */ #undef GNULIB_OPENAT /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module openat-safer shall be considered present. */ #undef GNULIB_OPENAT_SAFER /* enable some gnulib portability checks */ #undef GNULIB_PORTCHECK /* Enable compile-time and run-time bounds-checking, and some warnings, without upsetting glibc 2.15+. */ #if (defined GNULIB_PORTCHECK && !defined _FORTIFY_SOURCE \ && defined __OPTIMIZE__ && __OPTIMIZE__) # define _FORTIFY_SOURCE 2 #endif /* Define to 1 if printf and friends should be labeled with attribute "__gnu_printf__" instead of "__printf__" */ #undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module reallocarray shall be considered present. */ #undef GNULIB_REALLOCARRAY /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module scanf shall be considered present. */ #undef GNULIB_SCANF /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module snprintf shall be considered present. */ #undef GNULIB_SNPRINTF /* Define to 1 if you want the FILE stream functions getc, putc, etc. to use unlocked I/O if available, throughout the package. Unlocked I/O can improve performance, sometimes dramatically. But unlocked I/O is safe only in single-threaded programs, as well as in multithreaded programs for which you can guarantee that every FILE stream, including stdin, stdout, stderr, is used only in a single thread. */ #undef GNULIB_STDIO_SINGLE_THREAD /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module strerror shall be considered present. */ #undef GNULIB_STRERROR /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module strerror_r-posix shall be considered present. */ #undef GNULIB_STRERROR_R_POSIX /* Define to 1 when the gnulib module accept should be tested. */ #undef GNULIB_TEST_ACCEPT /* Define to 1 when the gnulib module bind should be tested. */ #undef GNULIB_TEST_BIND /* Define to 1 when the gnulib module btowc should be tested. */ #undef GNULIB_TEST_BTOWC /* Define to 1 when the gnulib module calloc-posix should be tested. */ #undef GNULIB_TEST_CALLOC_POSIX /* Define to 1 when the gnulib module chdir should be tested. */ #undef GNULIB_TEST_CHDIR /* Define to 1 when the gnulib module cloexec should be tested. */ #undef GNULIB_TEST_CLOEXEC /* Define to 1 when the gnulib module close should be tested. */ #undef GNULIB_TEST_CLOSE /* Define to 1 when the gnulib module closedir should be tested. */ #undef GNULIB_TEST_CLOSEDIR /* Define to 1 when the gnulib module connect should be tested. */ #undef GNULIB_TEST_CONNECT /* Define to 1 when the gnulib module dirfd should be tested. */ #undef GNULIB_TEST_DIRFD /* Define to 1 when the gnulib module dup should be tested. */ #undef GNULIB_TEST_DUP /* Define to 1 when the gnulib module dup2 should be tested. */ #undef GNULIB_TEST_DUP2 /* Define to 1 when the gnulib module environ should be tested. */ #undef GNULIB_TEST_ENVIRON /* Define to 1 when the gnulib module fchdir should be tested. */ #undef GNULIB_TEST_FCHDIR /* Define to 1 when the gnulib module fcntl should be tested. */ #undef GNULIB_TEST_FCNTL /* Define to 1 when the gnulib module fdopen should be tested. */ #undef GNULIB_TEST_FDOPEN /* Define to 1 when the gnulib module fdopendir should be tested. */ #undef GNULIB_TEST_FDOPENDIR /* Define to 1 when the gnulib module fgetc should be tested. */ #undef GNULIB_TEST_FGETC /* Define to 1 when the gnulib module fgets should be tested. */ #undef GNULIB_TEST_FGETS /* Define to 1 when the gnulib module fnmatch should be tested. */ #undef GNULIB_TEST_FNMATCH /* Define to 1 when the gnulib module fopen should be tested. */ #undef GNULIB_TEST_FOPEN /* Define to 1 when the gnulib module fprintf should be tested. */ #undef GNULIB_TEST_FPRINTF /* Define to 1 when the gnulib module fputc should be tested. */ #undef GNULIB_TEST_FPUTC /* Define to 1 when the gnulib module fputs should be tested. */ #undef GNULIB_TEST_FPUTS /* Define to 1 when the gnulib module fread should be tested. */ #undef GNULIB_TEST_FREAD /* Define to 1 when the gnulib module free-posix should be tested. */ #undef GNULIB_TEST_FREE_POSIX /* Define to 1 when the gnulib module fscanf should be tested. */ #undef GNULIB_TEST_FSCANF /* Define to 1 when the gnulib module fstat should be tested. */ #undef GNULIB_TEST_FSTAT /* Define to 1 when the gnulib module fstatat should be tested. */ #undef GNULIB_TEST_FSTATAT /* Define to 1 when the gnulib module ftruncate should be tested. */ #undef GNULIB_TEST_FTRUNCATE /* Define to 1 when the gnulib module fwrite should be tested. */ #undef GNULIB_TEST_FWRITE /* Define to 1 when the gnulib module getc should be tested. */ #undef GNULIB_TEST_GETC /* Define to 1 when the gnulib module getchar should be tested. */ #undef GNULIB_TEST_GETCHAR /* Define to 1 when the gnulib module getcwd should be tested. */ #undef GNULIB_TEST_GETCWD /* Define to 1 when the gnulib module getdtablesize should be tested. */ #undef GNULIB_TEST_GETDTABLESIZE /* Define to 1 when the gnulib module getopt-posix should be tested. */ #undef GNULIB_TEST_GETOPT_POSIX /* Define to 1 when the gnulib module getpagesize should be tested. */ #undef GNULIB_TEST_GETPAGESIZE /* Define to 1 when the gnulib module gettimeofday should be tested. */ #undef GNULIB_TEST_GETTIMEOFDAY /* Define to 1 when the gnulib module ioctl should be tested. */ #undef GNULIB_TEST_IOCTL /* Define to 1 when the gnulib module isatty should be tested. */ #undef GNULIB_TEST_ISATTY /* Define to 1 when the gnulib module iswblank should be tested. */ #undef GNULIB_TEST_ISWBLANK /* Define to 1 when the gnulib module iswctype should be tested. */ #undef GNULIB_TEST_ISWCTYPE /* Define to 1 when the gnulib module iswdigit should be tested. */ #undef GNULIB_TEST_ISWDIGIT /* Define to 1 when the gnulib module iswxdigit should be tested. */ #undef GNULIB_TEST_ISWXDIGIT /* Define to 1 when the gnulib module listen should be tested. */ #undef GNULIB_TEST_LISTEN /* Define to 1 when the gnulib module localeconv should be tested. */ #undef GNULIB_TEST_LOCALECONV /* Define to 1 when the gnulib module localename should be tested. */ #undef GNULIB_TEST_LOCALENAME /* Define to 1 when the gnulib module lseek should be tested. */ #undef GNULIB_TEST_LSEEK /* Define to 1 when the gnulib module lstat should be tested. */ #undef GNULIB_TEST_LSTAT /* Define to 1 when the gnulib module malloc-posix should be tested. */ #undef GNULIB_TEST_MALLOC_POSIX /* Define to 1 when the gnulib module mbrlen should be tested. */ #undef GNULIB_TEST_MBRLEN /* Define to 1 when the gnulib module mbrtowc should be tested. */ #undef GNULIB_TEST_MBRTOWC /* Define to 1 when the gnulib module mbscasecmp should be tested. */ #undef GNULIB_TEST_MBSCASECMP /* Define to 1 when the gnulib module mbsinit should be tested. */ #undef GNULIB_TEST_MBSINIT /* Define to 1 when the gnulib module mbslen should be tested. */ #undef GNULIB_TEST_MBSLEN /* Define to 1 when the gnulib module mbsrtowcs should be tested. */ #undef GNULIB_TEST_MBSRTOWCS /* Define to 1 when the gnulib module mbsstr should be tested. */ #undef GNULIB_TEST_MBSSTR /* Define to 1 when the gnulib module mbtowc should be tested. */ #undef GNULIB_TEST_MBTOWC /* Define to 1 when the gnulib module memchr should be tested. */ #undef GNULIB_TEST_MEMCHR /* Define to 1 when the gnulib module mempcpy should be tested. */ #undef GNULIB_TEST_MEMPCPY /* Define to 1 when the gnulib module memrchr should be tested. */ #undef GNULIB_TEST_MEMRCHR /* Define to 1 when the gnulib module nanosleep should be tested. */ #undef GNULIB_TEST_NANOSLEEP /* Define to 1 when the gnulib module nl_langinfo should be tested. */ #undef GNULIB_TEST_NL_LANGINFO /* Define to 1 when the gnulib module open should be tested. */ #undef GNULIB_TEST_OPEN /* Define to 1 when the gnulib module openat should be tested. */ #undef GNULIB_TEST_OPENAT /* Define to 1 when the gnulib module opendir should be tested. */ #undef GNULIB_TEST_OPENDIR /* Define to 1 when the gnulib module perror should be tested. */ #undef GNULIB_TEST_PERROR /* Define to 1 when the gnulib module pipe should be tested. */ #undef GNULIB_TEST_PIPE /* Define to 1 when the gnulib module printf should be tested. */ #undef GNULIB_TEST_PRINTF /* Define to 1 when the gnulib module pthread_sigmask should be tested. */ #undef GNULIB_TEST_PTHREAD_SIGMASK /* Define to 1 when the gnulib module pthread-thread should be tested. */ #undef GNULIB_TEST_PTHREAD_THREAD /* Define to 1 when the gnulib module putc should be tested. */ #undef GNULIB_TEST_PUTC /* Define to 1 when the gnulib module putchar should be tested. */ #undef GNULIB_TEST_PUTCHAR /* Define to 1 when the gnulib module putenv should be tested. */ #undef GNULIB_TEST_PUTENV /* Define to 1 when the gnulib module puts should be tested. */ #undef GNULIB_TEST_PUTS /* Define to 1 when the gnulib module raise should be tested. */ #undef GNULIB_TEST_RAISE /* Define to 1 when the gnulib module rawmemchr should be tested. */ #undef GNULIB_TEST_RAWMEMCHR /* Define to 1 when the gnulib module read should be tested. */ #undef GNULIB_TEST_READ /* Define to 1 when the gnulib module readdir should be tested. */ #undef GNULIB_TEST_READDIR /* Define to 1 when the gnulib module reallocarray should be tested. */ #undef GNULIB_TEST_REALLOCARRAY /* Define to 1 when the gnulib module realloc-posix should be tested. */ #undef GNULIB_TEST_REALLOC_POSIX /* Define to 1 when the gnulib module scanf should be tested. */ #undef GNULIB_TEST_SCANF /* Define to 1 when the gnulib module select should be tested. */ #undef GNULIB_TEST_SELECT /* Define to 1 when the gnulib module setenv should be tested. */ #undef GNULIB_TEST_SETENV /* Define to 1 when the gnulib module setlocale should be tested. */ #undef GNULIB_TEST_SETLOCALE /* Define to 1 when the gnulib module setlocale_null should be tested. */ #undef GNULIB_TEST_SETLOCALE_NULL /* Define to 1 when the gnulib module setsockopt should be tested. */ #undef GNULIB_TEST_SETSOCKOPT /* Define to 1 when the gnulib module sigaction should be tested. */ #undef GNULIB_TEST_SIGACTION /* Define to 1 when the gnulib module sigprocmask should be tested. */ #undef GNULIB_TEST_SIGPROCMASK /* Define to 1 when the gnulib module sleep should be tested. */ #undef GNULIB_TEST_SLEEP /* Define to 1 when the gnulib module snprintf should be tested. */ #undef GNULIB_TEST_SNPRINTF /* Define to 1 when the gnulib module socket should be tested. */ #undef GNULIB_TEST_SOCKET /* Define to 1 when the gnulib module stat should be tested. */ #undef GNULIB_TEST_STAT /* Define to 1 when the gnulib module stpcpy should be tested. */ #undef GNULIB_TEST_STPCPY /* Define to 1 when the gnulib module strdup should be tested. */ #undef GNULIB_TEST_STRDUP /* Define to 1 when the gnulib module strerror should be tested. */ #undef GNULIB_TEST_STRERROR /* Define to 1 when the gnulib module strerror_r should be tested. */ #undef GNULIB_TEST_STRERROR_R /* Define to 1 when the gnulib module strnlen should be tested. */ #undef GNULIB_TEST_STRNLEN /* Define to 1 when the gnulib module strstr should be tested. */ #undef GNULIB_TEST_STRSTR /* Define to 1 when the gnulib module strtoll should be tested. */ #undef GNULIB_TEST_STRTOLL /* Define to 1 when the gnulib module strtoull should be tested. */ #undef GNULIB_TEST_STRTOULL /* Define to 1 when the gnulib module symlink should be tested. */ #undef GNULIB_TEST_SYMLINK /* Define to 1 when the gnulib module unsetenv should be tested. */ #undef GNULIB_TEST_UNSETENV /* Define to 1 when the gnulib module vfprintf should be tested. */ #undef GNULIB_TEST_VFPRINTF /* Define to 1 when the gnulib module vprintf should be tested. */ #undef GNULIB_TEST_VPRINTF /* Define to 1 when the gnulib module wcrtomb should be tested. */ #undef GNULIB_TEST_WCRTOMB /* Define to 1 when the gnulib module wctob should be tested. */ #undef GNULIB_TEST_WCTOB /* Define to 1 when the gnulib module wctomb should be tested. */ #undef GNULIB_TEST_WCTOMB /* Define to 1 when the gnulib module wcwidth should be tested. */ #undef GNULIB_TEST_WCWIDTH /* Define to 1 when the gnulib module wmemchr should be tested. */ #undef GNULIB_TEST_WMEMCHR /* Define to 1 when the gnulib module wmempcpy should be tested. */ #undef GNULIB_TEST_WMEMPCPY /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module unistr/u8-mbtoucr shall be considered present. */ #undef GNULIB_UNISTR_U8_MBTOUCR /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module unistr/u8-uctomb shall be considered present. */ #undef GNULIB_UNISTR_U8_UCTOMB /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module xalloc shall be considered present. */ #undef GNULIB_XALLOC /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module xalloc-die shall be considered present. */ #undef GNULIB_XALLOC_DIE /* We are building grep */ #undef GREP /* Define to 1 if you have 'alloca' after including <alloca.h>, a header that may be supplied by this distribution. */ #undef HAVE_ALLOCA /* Define to 1 if <alloca.h> works. */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the <arpa/inet.h> header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the <bp-sym.h> header file. */ #undef HAVE_BP_SYM_H /* Define to 1 if you have the `btowc' function. */ #undef HAVE_BTOWC /* Define to 1 if nanosleep mishandles large arguments. */ #undef HAVE_BUG_BIG_NANOSLEEP /* Define to 1 if you have the `catgets' function. */ #undef HAVE_CATGETS /* Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework. */ #undef HAVE_CFPREFERENCESCOPYAPPVALUE /* Define to 1 if you have the `closedir' function. */ #undef HAVE_CLOSEDIR /* Define to 1 if you have the <crtdefs.h> header file. */ #undef HAVE_CRTDEFS_H /* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT /* Define to 1 if you have the declaration of `alarm', and to 0 if you don't. */ #undef HAVE_DECL_ALARM /* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_CLEARERR_UNLOCKED /* Define to 1 if you have the declaration of `dirfd', and to 0 if you don't. */ #undef HAVE_DECL_DIRFD /* Define to 1 if you have the declaration of `ecvt', and to 0 if you don't. */ #undef HAVE_DECL_ECVT /* Define to 1 if you have the declaration of `execvpe', and to 0 if you don't. */ #undef HAVE_DECL_EXECVPE /* Define to 1 if you have the declaration of `fchdir', and to 0 if you don't. */ #undef HAVE_DECL_FCHDIR /* Define to 1 if you have the declaration of `fcloseall', and to 0 if you don't. */ #undef HAVE_DECL_FCLOSEALL /* Define to 1 if you have the declaration of `fcvt', and to 0 if you don't. */ #undef HAVE_DECL_FCVT /* Define to 1 if you have the declaration of `fdopendir', and to 0 if you don't. */ #undef HAVE_DECL_FDOPENDIR /* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FEOF_UNLOCKED /* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FERROR_UNLOCKED /* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FFLUSH_UNLOCKED /* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FGETS_UNLOCKED /* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FPUTC_UNLOCKED /* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FPUTS_UNLOCKED /* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FREAD_UNLOCKED /* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FWRITE_UNLOCKED /* Define to 1 if you have the declaration of `gcvt', and to 0 if you don't. */ #undef HAVE_DECL_GCVT /* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_GETCHAR_UNLOCKED /* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_GETC_UNLOCKED /* Define to 1 if you have the declaration of `getdtablesize', and to 0 if you don't. */ #undef HAVE_DECL_GETDTABLESIZE /* Define to 1 if you have the declaration of `inet_pton', and to 0 if you don't. */ #undef HAVE_DECL_INET_PTON /* Define to 1 if you have the declaration of `isblank', and to 0 if you don't. */ #undef HAVE_DECL_ISBLANK /* Define to 1 if you have the declaration of `iswblank', and to 0 if you don't. */ #undef HAVE_DECL_ISWBLANK /* Define to 1 if you have the declaration of `mbrlen', and to 0 if you don't. */ #undef HAVE_DECL_MBRLEN /* Define to 1 if you have the declaration of `mbrtowc', and to 0 if you don't. */ #undef HAVE_DECL_MBRTOWC /* Define to 1 if you have the declaration of `mbsinit', and to 0 if you don't. */ #undef HAVE_DECL_MBSINIT /* Define to 1 if you have the declaration of `mbsrtowcs', and to 0 if you don't. */ #undef HAVE_DECL_MBSRTOWCS /* Define to 1 if you have the declaration of `memrchr', and to 0 if you don't. */ #undef HAVE_DECL_MEMRCHR /* Define to 1 if you have the declaration of `program_invocation_name', and to 0 if you don't. */ #undef HAVE_DECL_PROGRAM_INVOCATION_NAME /* Define to 1 if you have the declaration of `program_invocation_short_name', and to 0 if you don't. */ #undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_PUTCHAR_UNLOCKED /* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_PUTC_UNLOCKED /* Define to 1 if you have the declaration of `setenv', and to 0 if you don't. */ #undef HAVE_DECL_SETENV /* Define to 1 if you have the declaration of `sleep', and to 0 if you don't. */ #undef HAVE_DECL_SLEEP /* Define to 1 if you have the declaration of `snprintf', and to 0 if you don't. */ #undef HAVE_DECL_SNPRINTF /* Define to 1 if you have the declaration of `strdup', and to 0 if you don't. */ #undef HAVE_DECL_STRDUP /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR_R /* Define to 1 if you have the declaration of `strnlen', and to 0 if you don't. */ #undef HAVE_DECL_STRNLEN /* Define to 1 if you have the declaration of `strtoimax', and to 0 if you don't. */ #undef HAVE_DECL_STRTOIMAX /* Define to 1 if you have the declaration of `strtoll', and to 0 if you don't. */ #undef HAVE_DECL_STRTOLL /* Define to 1 if you have the declaration of `strtoull', and to 0 if you don't. */ #undef HAVE_DECL_STRTOULL /* Define to 1 if you have the declaration of `strtoumax', and to 0 if you don't. */ #undef HAVE_DECL_STRTOUMAX /* Define to 1 if you have the declaration of `towlower', and to 0 if you don't. */ #undef HAVE_DECL_TOWLOWER /* Define to 1 if you have the declaration of `unsetenv', and to 0 if you don't. */ #undef HAVE_DECL_UNSETENV /* Define to 1 if you have the declaration of `wcrtomb', and to 0 if you don't. */ #undef HAVE_DECL_WCRTOMB /* Define to 1 if you have the declaration of `wcsdup', and to 0 if you don't. */ #undef HAVE_DECL_WCSDUP /* Define to 1 if you have the declaration of `wctob', and to 0 if you don't. */ #undef HAVE_DECL_WCTOB /* Define to 1 if you have the declaration of `wcwidth', and to 0 if you don't. */ #undef HAVE_DECL_WCWIDTH /* Define to 1 if you have the declaration of `_putenv', and to 0 if you don't. */ #undef HAVE_DECL__PUTENV /* Define to 1 if you have the declaration of `_snprintf', and to 0 if you don't. */ #undef HAVE_DECL__SNPRINTF /* Define to 1 if you have the declaration of `__argv', and to 0 if you don't. */ #undef HAVE_DECL___ARGV /* Define to 1 if you have the declaration of `__fpending', and to 0 if you don't. */ #undef HAVE_DECL___FPENDING /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the `dirfd' function. */ #undef HAVE_DIRFD /* Define to 1 if you have the `duplocale' function. */ #undef HAVE_DUPLOCALE /* Define if you have the declaration of environ. */ #undef HAVE_ENVIRON_DECL /* Define if the locale_t type contains insufficient information, as on OpenBSD. */ #undef HAVE_FAKE_LOCALES /* Define to 1 if you have the `fchdir' function. */ #undef HAVE_FCHDIR /* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL /* Define to 1 if you have the `fdopendir' function. */ #undef HAVE_FDOPENDIR /* Define to 1 if you have the <features.h> header file. */ #undef HAVE_FEATURES_H /* Define to 1 if you have the `fnmatch' function. */ #undef HAVE_FNMATCH /* Define to 1 if you have the <fnmatch.h> header file. */ #undef HAVE_FNMATCH_H /* Define to 1 if you have the `freelocale' function. */ #undef HAVE_FREELOCALE /* Define if the 'free' function is guaranteed to preserve errno. */ #undef HAVE_FREE_POSIX /* Define to 1 if you have the `fstatat' function. */ #undef HAVE_FSTATAT /* Define to 1 if you have the `fstatfs' function. */ #undef HAVE_FSTATFS /* Define to 1 if you have the `ftruncate' function. */ #undef HAVE_FTRUNCATE /* Define to 1 if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE /* Define to 1 if you have the `getexecname' function. */ #undef HAVE_GETEXECNAME /* Define to 1 if you have the `getlocalename_l' function. */ #undef HAVE_GETLOCALENAME_L /* Define to 1 if you have the <getopt.h> header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the `getopt_long_only' function. */ #undef HAVE_GETOPT_LONG_ONLY /* Define to 1 if you have the `getprogname' function. */ #undef HAVE_GETPROGNAME /* Define to 1 if you have the `getrlimit' function. */ #undef HAVE_GETRLIMIT /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define if the uselocale exists, may be safely called, and returns sufficient information. */ #undef HAVE_GOOD_USELOCALE /* Define if you have the iconv() function and it works. */ #undef HAVE_ICONV /* Define to 1 if you have the <iconv.h> header file. */ #undef HAVE_ICONV_H /* Define to 1 if you have the `inet_pton' function. */ #undef HAVE_INET_PTON /* Define to 1 if the compiler supports one of the keywords 'inline', '__inline__', '__inline' and effectively inlines functions marked as such. */ #undef HAVE_INLINE /* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */ #undef HAVE_INTMAX_T /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H /* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. */ #undef HAVE_INTTYPES_H_WITH_UINTMAX /* Define to 1 if you have the `ioctl' function. */ #undef HAVE_IOCTL /* Define to 1 if <sys/socket.h> defines AF_INET. */ #undef HAVE_IPV4 /* Define to 1 if <sys/socket.h> defines AF_INET6. */ #undef HAVE_IPV6 /* Define to 1 if you have the `isascii' function. */ #undef HAVE_ISASCII /* Define to 1 if you have the `isblank' function. */ #undef HAVE_ISBLANK /* Define to 1 if you have the `iswblank' function. */ #undef HAVE_ISWBLANK /* Define to 1 if you have the `iswcntrl' function. */ #undef HAVE_ISWCNTRL /* Define to 1 if you have the `iswctype' function. */ #undef HAVE_ISWCTYPE /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET /* Define to 1 if you have the <langinfo.h> header file. */ #undef HAVE_LANGINFO_H /* Define if your <locale.h> file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES /* Define to 1 if you have the <libintl.h> header file. */ #undef HAVE_LIBINTL_H /* Define to 1 if you have the Perl Compatible Regular Expressions library (-lpcre). */ #undef HAVE_LIBPCRE /* Define if you have the libsigsegv library. */ #undef HAVE_LIBSIGSEGV /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H /* Define to 1 if the system has the type 'long long int'. */ #undef HAVE_LONG_LONG_INT /* Define to 1 if you have the `lstat' function. */ #undef HAVE_LSTAT /* Define to 1 if you have the <malloc.h> header file. */ #undef HAVE_MALLOC_H /* Define if malloc, realloc, and calloc set errno on allocation failure. */ #undef HAVE_MALLOC_POSIX /* Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including config.h and <sys/mman.h>. */ #undef HAVE_MAP_ANONYMOUS /* Define to 1 if you have the `mbrlen' function. */ #undef HAVE_MBRLEN /* Define to 1 if you have the `mbrtowc' function. */ #undef HAVE_MBRTOWC /* Define to 1 if you have the `mbsinit' function. */ #undef HAVE_MBSINIT /* Define to 1 if you have the `mbslen' function. */ #undef HAVE_MBSLEN /* Define to 1 if you have the `mbsrtowcs' function. */ #undef HAVE_MBSRTOWCS /* Define to 1 if <wchar.h> declares mbstate_t. */ #undef HAVE_MBSTATE_T /* Define to 1 if you have the `mbtowc' function. */ #undef HAVE_MBTOWC /* Define to 1 if you have the `mempcpy' function. */ #undef HAVE_MEMPCPY /* Define to 1 if you have the `memrchr' function. */ #undef HAVE_MEMRCHR /* Define to 1 if you have the <minix/config.h> header file. */ #undef HAVE_MINIX_CONFIG_H /* Define to 1 if <limits.h> defines the MIN and MAX macros. */ #undef HAVE_MINMAX_IN_LIMITS_H /* Define to 1 if <sys/param.h> defines the MIN and MAX macros. */ #undef HAVE_MINMAX_IN_SYS_PARAM_H /* Define to 1 if you have the `mprotect' function. */ #undef HAVE_MPROTECT /* Define to 1 on MSVC platforms that have the "invalid parameter handler" concept. */ #undef HAVE_MSVC_INVALID_PARAMETER_HANDLER /* Define if the locale_t type does not contain the name of each locale category. */ #undef HAVE_NAMELESS_LOCALES /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the <netdb.h> header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the <netinet/in.h> header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the `newlocale' function. */ #undef HAVE_NEWLOCALE /* Define to 1 if you have the `nl_langinfo' function. */ #undef HAVE_NL_LANGINFO /* Define to 1 if the system has obstacks that work with any size object. */ #undef HAVE_OBSTACK /* Define to 1 if you have the `openat' function. */ #undef HAVE_OPENAT /* Define to 1 if you have the `opendir' function. */ #undef HAVE_OPENDIR /* Define to 1 if you have the <OS.h> header file. */ #undef HAVE_OS_H /* Define to 1 if you have the `pipe' function. */ #undef HAVE_PIPE /* Define if you have the <pthread.h> header and the POSIX threads API. */ #undef HAVE_PTHREAD_API /* Define to 1 if you have the `pthread_atfork' function. */ #undef HAVE_PTHREAD_ATFORK /* Define to 1 if you have the <pthread.h> header file. */ #undef HAVE_PTHREAD_H /* Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE. */ #undef HAVE_PTHREAD_MUTEX_RECURSIVE /* Define if the POSIX multithreading library has read/write locks. */ #undef HAVE_PTHREAD_RWLOCK /* Define if the 'pthread_rwlock_rdlock' function prefers a writer to a reader. */ #undef HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER /* Define to 1 if the pthread_sigmask function can be used (despite bugs). */ #undef HAVE_PTHREAD_SIGMASK /* Define to 1 if the system has the type `pthread_spinlock_t'. */ #undef HAVE_PTHREAD_SPINLOCK_T /* Define to 1 if the system has the type `pthread_t'. */ #undef HAVE_PTHREAD_T /* Define to 1 if you have the `raise' function. */ #undef HAVE_RAISE /* Define to 1 if you have the `rawmemchr' function. */ #undef HAVE_RAWMEMCHR /* Define to 1 if you have the `readdir' function. */ #undef HAVE_READDIR /* Define to 1 if you have the `reallocarray' function. */ #undef HAVE_REALLOCARRAY /* Define to 1 if the system has the type `sa_family_t'. */ #undef HAVE_SA_FAMILY_T /* Define to 1 if you have the <sched.h> header file. */ #undef HAVE_SCHED_H /* Define to 1 if you have the <sdkddkver.h> header file. */ #undef HAVE_SDKDDKVER_H /* Define to 1 if you have the <search.h> header file. */ #undef HAVE_SEARCH_H /* Define to 1 if you have the `setdtablesize' function. */ #undef HAVE_SETDTABLESIZE /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if you have the `setrlimit' function. */ #undef HAVE_SETRLIMIT /* Define to 1 if you have the `shutdown' function. */ #undef HAVE_SHUTDOWN /* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION /* Define to 1 if you have the `sigaltstack' function. */ #undef HAVE_SIGALTSTACK /* Define to 1 if the system has the type `siginfo_t'. */ #undef HAVE_SIGINFO_T /* Define to 1 if you have the `siginterrupt' function. */ #undef HAVE_SIGINTERRUPT /* Define to 1 if 'sig_atomic_t' is a signed integer type. */ #undef HAVE_SIGNED_SIG_ATOMIC_T /* Define to 1 if 'wchar_t' is a signed integer type. */ #undef HAVE_SIGNED_WCHAR_T /* Define to 1 if 'wint_t' is a signed integer type. */ #undef HAVE_SIGNED_WINT_T /* Define to 1 if the system has the type `sigset_t'. */ #undef HAVE_SIGSET_T /* Define to 1 if you have the `sleep' function. */ #undef HAVE_SLEEP /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define if the return value of the snprintf function is the number of of bytes (excluding the terminating NUL) that would have been produced if the buffer had been large enough. */ #undef HAVE_SNPRINTF_RETVAL_C99 /* Define if the string produced by the snprintf function is always NUL terminated. */ #undef HAVE_SNPRINTF_TRUNCATION_C99 /* Define if the locale_t type is as on Solaris 11.4. */ #undef HAVE_SOLARIS114_LOCALES /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H /* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. */ #undef HAVE_STDINT_H_WITH_UINTMAX /* Define to 1 if you have the <stdio_ext.h> header file. */ #undef HAVE_STDIO_EXT_H /* Define to 1 if you have the <stdio.h> header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `stpcpy' function. */ #undef HAVE_STPCPY /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R /* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strnlen' function. */ #undef HAVE_STRNLEN /* Define to 1 if you have the `strtoimax' function. */ #undef HAVE_STRTOIMAX /* Define to 1 if you have the `strtoll' function. */ #undef HAVE_STRTOLL /* Define to 1 if you have the `strtoull' function. */ #undef HAVE_STRTOULL /* Define to 1 if you have the `strtoumax' function. */ #undef HAVE_STRTOUMAX /* Define if there is a member named d_type in the struct describing directory headers. */ #undef HAVE_STRUCT_DIRENT_D_TYPE /* Define to 1 if `decimal_point' is a member of `struct lconv'. */ #undef HAVE_STRUCT_LCONV_DECIMAL_POINT /* Define to 1 if `sa_sigaction' is a member of `struct sigaction'. */ #undef HAVE_STRUCT_SIGACTION_SA_SIGACTION /* Define to 1 if the system has the type `struct sockaddr_storage'. */ #undef HAVE_STRUCT_SOCKADDR_STORAGE /* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */ #undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY /* Define to 1 if `f_type' is a member of `struct statfs'. */ #undef HAVE_STRUCT_STATFS_F_TYPE /* Define to 1 if `st_atimensec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIMENSEC /* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC /* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC /* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC /* Define to 1 if `st_birthtimensec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC /* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC /* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC /* Define to 1 if you have the `symlink' function. */ #undef HAVE_SYMLINK /* Define to 1 if you have the <sys/bitypes.h> header file. */ #undef HAVE_SYS_BITYPES_H /* Define to 1 if you have the <sys/cdefs.h> header file. */ #undef HAVE_SYS_CDEFS_H /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the <sys/inttypes.h> header file. */ #undef HAVE_SYS_INTTYPES_H /* Define to 1 if you have the <sys/ioctl.h> header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the <sys/mman.h> header file. */ #undef HAVE_SYS_MMAN_H /* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the <sys/param.h> header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the <sys/select.h> header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the <sys/single_threaded.h> header file. */ #undef HAVE_SYS_SINGLE_THREADED_H /* Define to 1 if you have the <sys/socket.h> header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the <sys/time.h> header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the <sys/types.h> header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the <sys/uio.h> header file. */ #undef HAVE_SYS_UIO_H /* Define to 1 if you have the <sys/vfs.h> header file. */ #undef HAVE_SYS_VFS_H /* Define to 1 if you have the <sys/wait.h> header file. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the `thrd_create' function. */ #undef HAVE_THRD_CREATE /* Define to 1 if you have the <threads.h> header file. */ #undef HAVE_THREADS_H /* Define to 1 if you have the `towlower' function. */ #undef HAVE_TOWLOWER /* Define to 1 if you have the `tsearch' function. */ #undef HAVE_TSEARCH /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `unsetenv' function. */ #undef HAVE_UNSETENV /* Define to 1 if the system has the type 'unsigned long long int'. */ #undef HAVE_UNSIGNED_LONG_LONG_INT /* Define to 1 if you have the `uselocale' function. */ #undef HAVE_USELOCALE /* Define if you have a global __progname variable */ #undef HAVE_VAR___PROGNAME /* Define to 1 if you have the `vasnprintf' function. */ #undef HAVE_VASNPRINTF /* Define to 1 or 0, depending whether the compiler supports simple visibility declarations. */ #undef HAVE_VISIBILITY /* Define to 1 if you have the <wchar.h> header file. */ #undef HAVE_WCHAR_H /* Define if you have the 'wchar_t' type. */ #undef HAVE_WCHAR_T /* Define to 1 if you have the `wcrtomb' function. */ #undef HAVE_WCRTOMB /* Define to 1 if you have the `wcslen' function. */ #undef HAVE_WCSLEN /* Define to 1 if you have the `wcsnlen' function. */ #undef HAVE_WCSNLEN /* Define to 1 if you have the `wctob' function. */ #undef HAVE_WCTOB /* Define to 1 if you have the <wctype.h> header file. */ #undef HAVE_WCTYPE_H /* Define to 1 if you have the `wcwidth' function. */ #undef HAVE_WCWIDTH /* Define to 1 if the compiler and linker support weak declarations of symbols. */ #undef HAVE_WEAK_SYMBOLS /* Define to 1 if you have the <winsock2.h> header file. */ #undef HAVE_WINSOCK2_H /* Define if you have the 'wint_t' type. */ #undef HAVE_WINT_T /* Define to 1 if you have the `wmempcpy' function. */ #undef HAVE_WMEMPCPY /* Define to 1 if fstatat (..., 0) works. For example, it does not work in AIX 7.1. */ #undef HAVE_WORKING_FSTATAT_ZERO_FLAG /* Define to 1 if O_NOATIME works. */ #undef HAVE_WORKING_O_NOATIME /* Define to 1 if O_NOFOLLOW works. */ #undef HAVE_WORKING_O_NOFOLLOW /* Define if you have the sigaltstack() function and it works. */ #undef HAVE_WORKING_SIGALTSTACK /* Define if the uselocale function exists and may safely be called. */ #undef HAVE_WORKING_USELOCALE /* Define to 1 if you have the <ws2tcpip.h> header file. */ #undef HAVE_WS2TCPIP_H /* Define to 1 if you have the <xlocale.h> header file. */ #undef HAVE_XLOCALE_H /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Define to 1 if you have the `_chsize' function. */ #undef HAVE__CHSIZE /* Define to 1 if you have the `_set_invalid_parameter_handler' function. */ #undef HAVE__SET_INVALID_PARAMETER_HANDLER /* Define to 1 if the compiler supports __builtin_expect, and to 2 if <builtins.h> does. */ #undef HAVE___BUILTIN_EXPECT #ifndef HAVE___BUILTIN_EXPECT # define __builtin_expect(e, c) (e) #elif HAVE___BUILTIN_EXPECT == 2 # include <builtins.h> #endif /* Define to 1 if the system has the type `__fsword_t'. */ #undef HAVE___FSWORD_T /* Define to 1 if the compiler supports the keyword '__inline'. */ #undef HAVE___INLINE /* Define to 1 if you have the `__xpg_strerror_r' function. */ #undef HAVE___XPG_STRERROR_R /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST /* Define to a symbolic name denoting the flavor of iconv_open() implementation. */ #undef ICONV_FLAVOR /* Define if localename.c overrides newlocale(), duplocale(), freelocale(). */ #undef LOCALENAME_ENHANCE_LOCALE_FUNCS /* Define to 1 if lseek does not detect pipes. */ #undef LSEEK_PIPE_BROKEN /* Define to 1 if 'lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */ #undef MALLOC_0_IS_NONNULL /* Define to a substitute value for mmap()'s MAP_ANONYMOUS flag. */ #undef MAP_ANONYMOUS /* Define if the mbrtowc function does not return (size_t) -2 for empty input. */ #undef MBRTOWC_EMPTY_INPUT_BUG /* Define if the mbrtowc function may signal encoding errors in the C locale. */ #undef MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ /* Define if the mbrtowc function has the NULL pwc argument bug. */ #undef MBRTOWC_NULL_ARG1_BUG /* Define if the mbrtowc function has the NULL string argument bug. */ #undef MBRTOWC_NULL_ARG2_BUG /* Define if the mbrtowc function does not return 0 for a NUL character. */ #undef MBRTOWC_NUL_RETVAL_BUG /* Define if the mbrtowc function returns a wrong return value. */ #undef MBRTOWC_RETVAL_BUG /* Define if the mbrtowc function stores a wide character when reporting incomplete input. */ #undef MBRTOWC_STORES_INCOMPLETE_BUG /* Use GNU style printf and scanf. */ #ifndef __USE_MINGW_ANSI_STDIO # undef __USE_MINGW_ANSI_STDIO #endif /* Define to 1 on musl libc. */ #undef MUSL_LIBC /* Define to 1 if assertions should be disabled. */ #undef NDEBUG /* Define to 1 to enable general improvements of setlocale. */ #undef NEED_SETLOCALE_IMPROVED /* Define to 1 to enable a multithread-safety fix of setlocale. */ #undef NEED_SETLOCALE_MTSAFE /* Define to 1 if nl_langinfo is multithread-safe. */ #undef NL_LANGINFO_MTSAFE /* Define to 1 if open() fails to recognize a trailing slash. */ #undef OPEN_TRAILING_SLASH_BUG /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* String identifying the packager of this software */ #undef PACKAGE_PACKAGER /* Packager info for bug reports (URL/e-mail/...) */ #undef PACKAGE_PACKAGER_BUG_REPORTS /* Packager-specific version information */ #undef PACKAGE_PACKAGER_VERSION /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to the type that is the result of default argument promotions of type mode_t. */ #undef PROMOTED_MODE_T /* Define if pthread_create is an inline function. */ #undef PTHREAD_CREATE_IS_INLINE /* Define if the pthread_in_use() detection is hard. */ #undef PTHREAD_IN_USE_DETECTION_HARD /* Define to 1 if pthread_sigmask(), when it fails, returns -1 and sets errno. */ #undef PTHREAD_SIGMASK_FAILS_WITH_ERRNO /* Define to 1 if pthread_sigmask may return 0 and have no effect. */ #undef PTHREAD_SIGMASK_INEFFECTIVE /* Define to 1 if pthread_sigmask() unblocks signals incorrectly. */ #undef PTHREAD_SIGMASK_UNBLOCK_BUG /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'ptrdiff_t'. */ #undef PTRDIFF_T_SUFFIX /* Define to 1 if gnulib's dirfd() replacement is used. */ #undef REPLACE_DIRFD /* Define to 1 if gnulib's fchdir() replacement is used. */ #undef REPLACE_FCHDIR /* Define to 1 if stat needs help when passed a file name with a trailing slash */ #undef REPLACE_FUNC_STAT_FILE /* Define if nl_langinfo exists but is overridden by gnulib. */ #undef REPLACE_NL_LANGINFO /* Define to 1 if open() should work around the inability to open a directory. */ #undef REPLACE_OPEN_DIRECTORY /* Define to 1 if strerror(0) does not return a message implying success. */ #undef REPLACE_STRERROR_0 /* Define if vasnprintf exists but is overridden by gnulib. */ #undef REPLACE_VASNPRINTF /* Define to 1 if setlocale (LC_ALL, NULL) is multithread-safe. */ #undef SETLOCALE_NULL_ALL_MTSAFE /* Define to 1 if setlocale (category, NULL) is multithread-safe. */ #undef SETLOCALE_NULL_ONE_MTSAFE /* Define if sigaltstack() interprets the stack_t.ss_sp field incorrectly, as the highest address of the alternate stack range rather than as the lowest address. */ #undef SIGALTSTACK_SS_REVERSED /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'sig_atomic_t'. */ #undef SIG_ATOMIC_T_SUFFIX /* Define as the maximum value of type 'size_t', if the system doesn't define it. */ #ifndef SIZE_MAX # undef SIZE_MAX #endif /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'size_t'. */ #undef SIZE_T_SUFFIX /* Define on Solaris 11 and its derivates. */ #undef SOLARIS11 /* Define as the direction of stack growth for your system. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => spaghetti stack. */ #undef STACK_DIRECTION /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ #undef STAT_MACROS_BROKEN /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define to 1 if strerror_r returns char *. */ #undef STRERROR_R_CHAR_P /* Define to 1 if the type of the st_atim member of a struct stat is struct timespec. */ #undef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC /* Define if the combination of the ISO C and POSIX multithreading APIs can be used. */ #undef USE_ISOC_AND_POSIX_THREADS /* Define if the ISO C multithreading library can be used. */ #undef USE_ISOC_THREADS /* Define if the POSIX multithreading library can be used. */ #undef USE_POSIX_THREADS /* Define if references to the POSIX multithreading library are satisfied by libc. */ #undef USE_POSIX_THREADS_FROM_LIBC /* Define if references to the POSIX multithreading library should be made weak. */ #undef USE_POSIX_THREADS_WEAK /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable general extensions on macOS. */ #ifndef _DARWIN_C_SOURCE # undef _DARWIN_C_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable X/Open compliant socket functions that do not require linking with -lxnet on HP-UX 11.11. */ #ifndef _HPUX_ALT_XOPEN_SOCKET_API # undef _HPUX_ALT_XOPEN_SOCKET_API #endif /* Identify the host operating system as Minix. This macro does not affect the system headers' behavior. A future release of Autoconf may stop defining this macro. */ #ifndef _MINIX # undef _MINIX #endif /* Enable general extensions on NetBSD. Enable NetBSD compatibility extensions on Minix. */ #ifndef _NETBSD_SOURCE # undef _NETBSD_SOURCE #endif /* Enable OpenBSD compatibility extensions on NetBSD. Oddly enough, this does nothing on OpenBSD. */ #ifndef _OPENBSD_SOURCE # undef _OPENBSD_SOURCE #endif /* Define to 1 if needed for POSIX-compatible behavior. */ #ifndef _POSIX_SOURCE # undef _POSIX_SOURCE #endif /* Define to 2 if needed for POSIX-compatible behavior. */ #ifndef _POSIX_1_SOURCE # undef _POSIX_1_SOURCE #endif /* Enable POSIX-compatible threading on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ #ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ # undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ # undef __STDC_WANT_IEC_60559_BFP_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ #ifndef __STDC_WANT_IEC_60559_DFP_EXT__ # undef __STDC_WANT_IEC_60559_DFP_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ #ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ # undef __STDC_WANT_IEC_60559_FUNCS_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ # undef __STDC_WANT_IEC_60559_TYPES_EXT__ #endif /* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ #ifndef __STDC_WANT_LIB_EXT2__ # undef __STDC_WANT_LIB_EXT2__ #endif /* Enable extensions specified by ISO/IEC 24747:2009. */ #ifndef __STDC_WANT_MATH_SPEC_FUNCS__ # undef __STDC_WANT_MATH_SPEC_FUNCS__ #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable X/Open extensions. Define to 500 only if necessary to make mbstate_t available. */ #ifndef _XOPEN_SOURCE # undef _XOPEN_SOURCE #endif /* An alias of GNULIB_STDIO_SINGLE_THREAD. */ #undef USE_UNLOCKED_IO /* Define if the native Windows multithreading API can be used. */ #undef USE_WINDOWS_THREADS /* Version number of package */ #undef VERSION /* Define to 1 if unsetenv returns void instead of int. */ #undef VOID_UNSETENV /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'wchar_t'. */ #undef WCHAR_T_SUFFIX /* Define if the wcrtomb function does not work in the C locale. */ #undef WCRTOMB_C_LOCALE_BUG /* Define if the wcrtomb function has an incorrect return value. */ #undef WCRTOMB_RETVAL_BUG /* Define if WSAStartup is needed. */ #undef WINDOWS_SOCKETS /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'wint_t'. */ #undef WINT_T_SUFFIX /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* True if the compiler says it groks GNU C version MAJOR.MINOR. */ #if defined __GNUC__ && defined __GNUC_MINOR__ # define _GL_GNUC_PREREQ(major, minor) \ ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) #else # define _GL_GNUC_PREREQ(major, minor) 0 #endif /* Define to enable the declarations of ISO C 11 types and functions. */ #undef _ISOC11_SOURCE /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to 1 on Solaris. */ #undef _LCONV_C99 /* The _Noreturn keyword of C11. */ #ifndef _Noreturn # if (defined __cplusplus \ && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ || (defined _MSC_VER && 1900 <= _MSC_VER)) \ && 0) /* [[noreturn]] is not practically usable, because with it the syntax extern _Noreturn void func (...); would not be valid; such a declaration would only be valid with 'extern' and '_Noreturn' swapped, or without the 'extern' keyword. However, some AIX system header files and several gnulib header files use precisely this syntax with 'extern'. */ # define _Noreturn [[noreturn]] # elif ((!defined __cplusplus || defined __clang__) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ || (!defined __STRICT_ANSI__ \ && (_GL_GNUC_PREREQ (4, 7) \ || (defined __apple_build_version__ \ ? 6000000 <= __apple_build_version__ \ : 3 < __clang_major__ + (5 <= __clang_minor__)))))) /* _Noreturn works as-is. */ # elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) # else # define _Noreturn # endif #endif /* Define to 1 in order to get the POSIX compatible declarations of socket functions. */ #undef _POSIX_PII_SOCKET /* Define if you want <regex.h> to include <limits.h>, so that it consistently overrides <limits.h>'s RE_DUP_MAX. */ #undef _REGEX_INCLUDE_LIMITS_H /* Define if you want regoff_t to be at least as wide POSIX requires. */ #undef _REGEX_LARGE_OFFSETS /* Number of bits in a timestamp, on hosts where this is settable. */ #undef _TIME_BITS /* For standard stat data types on VMS. */ #undef _USE_STD_STAT /* Define to rpl_ if the getopt replacement functions and variables should be used. */ #undef __GETOPT_PREFIX /* For 64-bit time_t on 32-bit mingw. */ #undef __MINGW_USE_VC2005_COMPAT /* Define to 1 if the system <stdint.h> predates C++11. */ #undef __STDC_CONSTANT_MACROS /* Define to 1 if the system <stdint.h> predates C++11. */ #undef __STDC_LIMIT_MACROS /* The _GL_ASYNC_SAFE marker should be attached to functions that are signal handlers (for signals other than SIGABRT, SIGPIPE) or can be invoked from such signal handlers. Such functions have some restrictions: * All functions that it calls should be marked _GL_ASYNC_SAFE as well, or should be listed as async-signal-safe in POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04> section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in particular, are NOT async-signal-safe. * All memory locations (variables and struct fields) that these functions access must be marked 'volatile'. This holds for both read and write accesses. Otherwise the compiler might optimize away stores to and reads from such locations that occur in the program, depending on its data flow analysis. For example, when the program contains a loop that is intended to inspect a variable set from within a signal handler while (!signal_occurred) ; the compiler is allowed to transform this into an endless loop if the variable 'signal_occurred' is not declared 'volatile'. Additionally, recall that: * A signal handler should not modify errno (except if it is a handler for a fatal signal and ends by raising the same signal again, thus provoking the termination of the process). If it invokes a function that may clobber errno, it needs to save and restore the value of errno. */ #define _GL_ASYNC_SAFE /* Attributes. */ #if (defined __has_attribute \ && (!defined __clang_minor__ \ || 3 < __clang_major__ + (5 <= __clang_minor__))) # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) #else # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr # define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) # define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) # define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) # define _GL_ATTR_diagnose_if 0 # define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) # define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) # define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) # define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) # ifdef _ICC # define _GL_ATTR_may_alias 0 # else # define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) # endif # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) # define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) # define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) # define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) #endif #ifdef __has_c_attribute # define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__) #else # define _GL_HAS_C_ATTRIBUTE(attr) 0 #endif #if _GL_HAS_ATTRIBUTE (alloc_size) # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) #else # define _GL_ATTRIBUTE_ALLOC_SIZE(args) #endif #if _GL_HAS_ATTRIBUTE (always_inline) # define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) #else # define _GL_ATTRIBUTE_ALWAYS_INLINE #endif #if _GL_HAS_ATTRIBUTE (artificial) # define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) #else # define _GL_ATTRIBUTE_ARTIFICIAL #endif /* Avoid __attribute__ ((cold)) on MinGW; see thread starting at <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ #if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ # ifndef __SUNPRO_C # define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) # else # define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) # endif #else # define _GL_ATTRIBUTE_COLD #endif #if _GL_HAS_ATTRIBUTE (const) # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) #else # define _GL_ATTRIBUTE_CONST #endif /* _GL_ATTRIBUTE_DEALLOC (F, I) is for functions returning pointers that can be freed by passing them as the Ith argument to the function F. _GL_ATTRIBUTE_DEALLOC_FREE is for functions that return pointers that can be freed via 'free'; it can be used only after including stdlib.h. These macros cannot be used on inline functions. */ #if _GL_GNUC_PREREQ (11, 0) # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) #else # define _GL_ATTRIBUTE_DEALLOC(f, i) #endif #define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) #if _GL_HAS_C_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] #elif _GL_HAS_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) #else # define _GL_ATTRIBUTE_DEPRECATED #endif #if _GL_HAS_ATTRIBUTE (error) # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) #elif _GL_HAS_ATTRIBUTE (diagnose_if) # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error"))) # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning"))) #else # define _GL_ATTRIBUTE_ERROR(msg) # define _GL_ATTRIBUTE_WARNING(msg) #endif #if _GL_HAS_ATTRIBUTE (externally_visible) # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) #else # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE #endif /* FALLTHROUGH is special, because it always expands to something. */ #if _GL_HAS_C_ATTRIBUTE (fallthrough) # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] #elif _GL_HAS_ATTRIBUTE (fallthrough) # define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) #else # define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) #endif #if _GL_HAS_ATTRIBUTE (format) # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) #else # define _GL_ATTRIBUTE_FORMAT(spec) #endif #if _GL_HAS_ATTRIBUTE (leaf) # define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) #else # define _GL_ATTRIBUTE_LEAF #endif #if _GL_HAS_ATTRIBUTE (malloc) # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) #else # define _GL_ATTRIBUTE_MALLOC #endif /* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ #if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C # define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) #else # define _GL_ATTRIBUTE_MAY_ALIAS #endif #if _GL_HAS_C_ATTRIBUTE (maybe_unused) # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] #else # define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED #endif /* Earlier spellings of this macro. */ #define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED #if _GL_HAS_C_ATTRIBUTE (nodiscard) # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] #elif _GL_HAS_ATTRIBUTE (warn_unused_result) # define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) #else # define _GL_ATTRIBUTE_NODISCARD #endif #if _GL_HAS_ATTRIBUTE (noinline) # define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) #else # define _GL_ATTRIBUTE_NOINLINE #endif #if _GL_HAS_ATTRIBUTE (nonnull) # define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) #else # define _GL_ATTRIBUTE_NONNULL(args) #endif #if _GL_HAS_ATTRIBUTE (nonstring) # define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) #else # define _GL_ATTRIBUTE_NONSTRING #endif /* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ #if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) #else # define _GL_ATTRIBUTE_NOTHROW #endif #if _GL_HAS_ATTRIBUTE (packed) # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) #else # define _GL_ATTRIBUTE_PACKED #endif #if _GL_HAS_ATTRIBUTE (pure) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) #else # define _GL_ATTRIBUTE_PURE #endif #if _GL_HAS_ATTRIBUTE (returns_nonnull) # define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) #else # define _GL_ATTRIBUTE_RETURNS_NONNULL #endif #if _GL_HAS_ATTRIBUTE (sentinel) # define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) #else # define _GL_ATTRIBUTE_SENTINEL(pos) #endif #if _GL_HAS_ATTRIBUTE (unused) # define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #else # define _GL_ATTRIBUTE_UNUSED #endif /* Earlier spellings of this macro. */ #define _GL_UNUSED _GL_ATTRIBUTE_UNUSED /* To support C++ as well as C, use _GL_UNUSED_LABEL with trailing ';'. */ #if !defined __cplusplus || _GL_GNUC_PREREQ (4, 5) # define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED #else # define _GL_UNUSED_LABEL #endif /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Please see the Gnulib manual for how to use these macros. Suppress extern inline with HP-UX cc, as it appears to be broken; see <https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>. Suppress extern inline with Sun C in standards-conformance mode, as it mishandles inline functions that call each other. E.g., for 'inline void f (void) { } inline void g (void) { f (); }', c99 incorrectly complains 'reference to static identifier "f" in extern inline function'. This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) on configurations that mistakenly use 'static inline' to implement functions or macros in standard C headers like <ctype.h>. For example, if isdigit is mistakenly implemented via a static inline function, a program containing an extern inline function that calls isdigit may not work since the C standard prohibits extern inline functions from calling static functions (ISO C 99 section 6.7.4.(3). This bug is known to occur on: OS X 10.8 and earlier; see: https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html DragonFly; see http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log FreeBSD; see: https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and for clang but remains for g++; see <https://trac.macports.org/ticket/41033>. Assume DragonFly and FreeBSD will be similar. GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline semantics, unless -fgnu89-inline is used. It defines a macro __GNUC_STDC_INLINE__ to indicate this situation or a macro __GNUC_GNU_INLINE__ to indicate the opposite situation. GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline semantics but warns, unless -fgnu89-inline is used: warning: C99 inline functions are not supported; using GNU89 warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. */ #if (((defined __APPLE__ && defined __MACH__) \ || defined __DragonFly__ || defined __FreeBSD__) \ && (defined __header_inline \ ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ && ! defined __clang__) \ : ((! defined _DONT_USE_CTYPE_INLINE_ \ && (defined __GNUC__ || defined __cplusplus)) \ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ && defined __GNUC__ && ! defined __cplusplus)))) # define _GL_EXTERN_INLINE_STDHEADER_BUG #endif #if ((__GNUC__ \ ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ : (199901L <= __STDC_VERSION__ \ && !defined __HP_cc \ && !defined __PGI \ && !(defined __SUNPRO_C && __STDC__))) \ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # define _GL_INLINE inline # define _GL_EXTERN_INLINE extern inline # define _GL_EXTERN_INLINE_IN_USE #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) # else # define _GL_INLINE extern inline # endif # define _GL_EXTERN_INLINE extern # define _GL_EXTERN_INLINE_IN_USE #else # define _GL_INLINE static _GL_UNUSED # define _GL_EXTERN_INLINE static _GL_UNUSED #endif /* In GCC 4.6 (inclusive) to 5.1 (exclusive), suppress bogus "no previous prototype for 'FOO'" and "no previous declaration for 'FOO'" diagnostics, when FOO is an inline function in the header; see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ #if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ # define _GL_INLINE_HEADER_CONST_PRAGMA # else # define _GL_INLINE_HEADER_CONST_PRAGMA \ _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") # endif # define _GL_INLINE_HEADER_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ _GL_INLINE_HEADER_CONST_PRAGMA # define _GL_INLINE_HEADER_END \ _Pragma ("GCC diagnostic pop") #else # define _GL_INLINE_HEADER_BEGIN # define _GL_INLINE_HEADER_END #endif /* Define to the overridden function name */ #undef fts_children /* Define to the overridden function name */ #undef fts_close /* Define to the overridden function name */ #undef fts_cross_check /* Define to the overridden function name */ #undef fts_open /* Define to the overridden function name */ #undef fts_read /* Define to the overridden function name */ #undef fts_set /* Define to `int' if <sys/types.h> doesn't define. */ #undef gid_t /* A replacement for va_copy, if needed. */ #define gl_va_copy(a,b) ((a) = (b)) /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to long or long long if <stdint.h> and <inttypes.h> don't define. */ #undef intmax_t /* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. __APPLE__ && __MACH__ test for Mac OS X. __APPLE_CC__ tests for the Apple compiler and its version. __STDC_VERSION__ tests for the C99 mode. */ #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ # define __GNUC_STDC_INLINE__ 1 #endif /* Define to 1 if the compiler is checking for lint. */ #undef lint /* Define to a type if <wchar.h> does not define. */ #undef mbstate_t /* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where n1 and n2 are expressions without side effects, that evaluate to real numbers (excluding NaN). It returns 1 if n1 > n2 0 if n1 == n2 -1 if n1 < n2 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional jump with nearly all GCC versions up to GCC 10. This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many GCC versions up to GCC 9. The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 avoids conditional jumps in all GCC versions >= 3.4. */ #define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) /* Define to `int' if <sys/types.h> does not define. */ #undef mode_t /* Define to the type of st_nlink in struct stat, or a supertype. */ #undef nlink_t /* Define to `long int' if <sys/types.h> does not define. */ #undef off_t /* Define as a signed integer type capable of holding a process identifier. */ #undef pid_t /* Define as the type of the result of subtracting two pointers, if the system doesn't define it. */ #undef ptrdiff_t /* Define to rpl_re_comp if the replacement should be used. */ #undef re_comp /* Define to rpl_re_compile_fastmap if the replacement should be used. */ #undef re_compile_fastmap /* Define to rpl_re_compile_pattern if the replacement should be used. */ #undef re_compile_pattern /* Define to rpl_re_exec if the replacement should be used. */ #undef re_exec /* Define to rpl_re_match if the replacement should be used. */ #undef re_match /* Define to rpl_re_match_2 if the replacement should be used. */ #undef re_match_2 /* Define to rpl_re_search if the replacement should be used. */ #undef re_search /* Define to rpl_re_search_2 if the replacement should be used. */ #undef re_search_2 /* Define to rpl_re_set_registers if the replacement should be used. */ #undef re_set_registers /* Define to rpl_re_set_syntax if the replacement should be used. */ #undef re_set_syntax /* Define to rpl_re_syntax_options if the replacement should be used. */ #undef re_syntax_options /* Define to rpl_regcomp if the replacement should be used. */ #undef regcomp /* Define to rpl_regerror if the replacement should be used. */ #undef regerror /* Define to rpl_regexec if the replacement should be used. */ #undef regexec /* Define to rpl_regfree if the replacement should be used. */ #undef regfree /* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported only directly. */ #undef restrict /* Work around a bug in older versions of Sun C++, which did not #define __restrict__ or support _Restrict or __restrict__ even though the corresponding Sun C compiler ended up with "#define restrict _Restrict" or "#define restrict __restrict__" in the previous line. This workaround can be removed once we assume Oracle Developer Studio 12.5 (2016) or later. */ #if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ # define _Restrict # define __restrict__ #endif /* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t /* type to use in place of socklen_t if not defined */ #undef socklen_t /* Define as a signed type of the same size as size_t. */ #undef ssize_t /* Define to 'struct sigaltstack' if that's the type of the argument to sigaltstack */ #undef stack_t /* Define to `int' if <sys/types.h> doesn't define. */ #undef uid_t /* This definition is a duplicate of the one in unitypes.h. It is here so that we can cope with an older version of unitypes.h that does not contain this definition and that is pre-installed among the public header files. */ # if defined __restrict \ || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ || __clang_major__ >= 3 # define _UC_RESTRICT __restrict # elif 199901L <= __STDC_VERSION__ || defined restrict # define _UC_RESTRICT restrict # else # define _UC_RESTRICT # endif /* Define as a macro for copying va_list variables. */ #undef va_copy ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/dist-check.mk������������������������������������������������������������������0000664�0001750�0001750�00000014633�14670377427�017031� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Most of this is probably too coreutils-centric to be useful to other packages. bin=bin-$$$$ write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)' tmpdir = $(abs_top_builddir)/tests/torture t=$(tmpdir)/$(PACKAGE)/test pfx=$(t)/i built_programs = \ $$(echo 'spy:;@echo $$(bin_PROGRAMS)' \ | MAKEFLAGS= $(MAKE) -s -f Makefile -f - spy \ | fmt -1 | sed 's,$(EXEEXT)$$,,' | sort -u) # More than once, tainted build and source directory names would # have caused at least one "make check" test to apply "chmod 700" # to all directories under $HOME. Make sure it doesn't happen again. tp = $(tmpdir)/taint t_prefix = $(tp)/a t_taint = '$(t_prefix) b' fake_home = $(tp)/home # When extracting from a distribution tarball, extract using the fastest # method possible. With dist-xz, that means using the *.xz file. ifneq ('', $(filter *.xz, $(DIST_ARCHIVES))) tar_decompress_opt_ = J suffix_ = xz else ifneq ('', $(filter *.gz, $(DIST_ARCHIVES))) tar_decompress_opt_ = z suffix_ = gz else tar_decompress_opt_ = j suffix_ = bz2 endif endif amtar_extract_ = $(AMTAR) -$(tar_decompress_opt_)xf preferred_tarball_ = $(distdir).tar.$(suffix_) # Ensure that tests run from tainted build and src dir names work, # and don't affect anything in $HOME. Create witness files in $HOME, # record their attributes, and build/test. Then ensure that the # witnesses were not affected. # Skip this test when using libtool, since libtool-generated scripts # cannot deal with a space-tainted srcdir. ALL_RECURSIVE_TARGETS += taint-distcheck taint-distcheck: $(DIST_ARCHIVES) grep '^[ ]*LT_INIT' configure.ac >/dev/null && exit 0 || : test -d $(t_taint) && chmod -R 700 $(t_taint) || : -rm -rf $(t_taint) $(fake_home) mkdir -p $(t_prefix) $(t_taint) $(fake_home) $(amtar_extract_) $(preferred_tarball_) -C $(t_taint) mkfifo $(fake_home)/fifo touch $(fake_home)/f mkdir -p $(fake_home)/d/e ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before HOME=$(fake_home); export HOME; \ cd $(t_taint)/$(distdir) \ && ./configure \ && $(MAKE) \ && $(MAKE) check \ && ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \ && diff $(tp)/.ls-before $(tp)/.ls-after \ && test -d $(t_prefix) rm -rf $(tp) # Verify that a twisted use of --program-transform-name=PROGRAM works. define install-transform-check echo running install-transform-check \ && rm -rf $(pfx) \ && $(MAKE) program_transform_name='s/.*/zyx/' \ prefix=$(pfx) install \ && test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \ && test "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx" endef # Install, then verify that all binaries and man pages are in place. # Note that neither the binary, ginstall, nor the [.1 man page is installed. define my-instcheck echo running my-instcheck; \ $(MAKE) prefix=$(pfx) install \ && test ! -f $(pfx)/bin/ginstall \ && { fail=0; \ for i in $(built_programs); do \ test "$$i" = ginstall && i=install; \ for j in "$(pfx)/bin/$$i" \ "$(pfx)/share/man/man1/$$i.1"; do \ case $$j in *'[.1') continue;; esac; \ test -f "$$j" && : \ || { echo "$$j not installed"; fail=1; }; \ done; \ done; \ test $$fail = 1 && exit 1 || :; \ } endef # The hard-linking for-loop below ensures that there is a bin/ directory # full of all of the programs under test (except the ones that are required # for basic Makefile rules), all symlinked to the just-built "false" program. # This is to ensure that if ever a test neglects to make PATH include # the build srcdir, these always-failing programs will run. # Otherwise, it is too easy to test the wrong programs. # Note that "false" itself is a symlink to true, so it too will malfunction. define coreutils-path-check { \ echo running coreutils-path-check; \ if test -f $(srcdir)/src/true.c; then \ fail=1; \ mkdir $(bin) \ && ($(write_loser)) > $(bin)/loser \ && chmod a+x $(bin)/loser \ && for i in $(built_programs); do \ case $$i in \ rm|expr|basename|echo|sort|ls|tr);; \ cat|dirname|mv|wc);; \ *) ln $(bin)/loser $(bin)/$$i;; \ esac; \ done \ && ln -sf ../src/true $(bin)/false \ && PATH=`pwd`/$(bin)$(PATH_SEPARATOR)$$PATH \ $(MAKE) -C tests check \ && { test -d gnulib-tests \ && $(MAKE) -C gnulib-tests check \ || :; } \ && rm -rf $(bin) \ && fail=0; \ else \ fail=0; \ fi; \ test $$fail = 1 && exit 1 || :; \ } endef # More generic version of the rule above. define generic-path-check { \ echo running generic-path-check; \ if test -f /bin/false; then \ fail=1; \ mkdir $(bin) \ && ($(write_loser)) > $(bin)/loser \ && chmod a+x $(bin)/loser \ && for i in $(built_programs); do \ ln $(bin)/loser $(bin)/$$i; \ done \ && PATH=`pwd`/$(bin)$(PATH_SEPARATOR)$$PATH \ $(MAKE) check \ && { test -d gnulib-tests \ && $(MAKE) -C gnulib-tests check \ || :; } \ && rm -rf $(bin) \ && fail=0; \ else \ fail=0; \ fi; \ test $$fail = 1 && exit 1 || :; \ } endef # Use this to make sure we don't run these programs when building # from a virgin compressed tarball file, below. null_AM_MAKEFLAGS ?= \ ACLOCAL=false \ AUTOCONF=false \ AUTOMAKE=false \ AUTOHEADER=false \ GPERF=false \ MAKEINFO=false ALL_RECURSIVE_TARGETS += my-distcheck my-distcheck: $(DIST_ARCHIVES) $(local-check) $(MAKE) syntax-check $(MAKE) check -rm -rf $(t) mkdir -p $(t) $(amtar_extract_) $(preferred_tarball_) -C $(t) (set -e; cd $(t)/$(distdir); \ ./configure --quiet --enable-gcc-warnings --disable-nls; \ $(MAKE) AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'; \ $(MAKE) dvi; \ $(install-transform-check); \ $(my-instcheck); \ $(coreutils-path-check); \ $(generic-path-check); \ $(MAKE) distclean \ ) (cd $(t) && mv $(distdir) $(distdir).old \ && $(amtar_extract_) - ) < $(preferred_tarball_) find $(t)/$(distdir).old $(t)/$(distdir) -name .deps | xargs rmdir diff -ur $(t)/$(distdir).old $(t)/$(distdir) -rm -rf $(t) rmdir $(tmpdir)/$(PACKAGE) $(tmpdir) @echo "========================"; \ echo "ready for distribution:"; \ for i in $(DIST_ARCHIVES); do echo " $$i"; done; \ echo "========================" �����������������������������������������������������������������������������������������������������kbuild-3608/src/grep/AUTHORS������������������������������������������������������������������������0000664�0001750�0001750�00000004777�14670377426�015541� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Copyright (C) 1992, 1997-2002, 2004-2021 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Mike Haertel wrote the main program and the dfa and kwset matchers. Isamu Hasegawa wrote the POSIX regular expression matcher, which is part of the GNU C Library and is distributed as part of GNU grep for use on non-GNU systems. Ulrich Drepper, Paul Eggert, Paolo Bonzini, Stanislav Brabec, Assaf Gordon, Jakub Jelinek, Jim Meyering, Arnold Robbins, Andreas Schwab and Florian Weimer also contributed to this matcher. Arthur David Olson contributed the heuristics for finding fixed substrings at the end of dfa.c. Henry Spencer wrote the original test suite from which grep's was derived. Scott Anderson invented the Khadafy test. David MacKenzie wrote the automatic configuration software used to produce the configure script. Authors of the replacements for standard library routines are identified in the corresponding source files. The idea of using Boyer-Moore type algorithms to quickly filter out non-matching text before calling the regexp matcher was originally due to James Woods. He also contributed some code to early versions of GNU grep. Mike Haertel would like to thank Andrew Hume for many fascinating discussions of string searching issues over the years. Hume and Sunday's excellent paper on fast string searching describes some of the history of the subject, as well as providing exhaustive performance analysis of various implementation alternatives. The inner loop of GNU grep is similar to Hume & Sunday's recommended "Tuned Boyer Moore" inner loop. See: Hume A, Sunday D. Fast string searching. Software Pract Exper. 1991;21(11):1221-48. https://doi.org/10.1002/spe.4380211105 Arnold Robbins contributed to improve dfa.[ch]. In fact it came straight from gawk-3.0.3 with small editing and fixes. Many folks contributed. See THANKS; if I omitted someone please send me email. Alain Magloire maintained GNU grep until version 2.5e. Bernhard "Bero" Rosenkränzer <bero@arklinux.org> maintained GNU grep until version 2.5.1, ie. from Sep 2001 till 2003. Stepan Kasal <kasal@ucw.cz> maintained GNU grep since Feb 2004. Tony Abou-Assaleh <taa@acm.org> maintains GNU grep since Oct 2007. Jim Meyering <jim@meyering.net> and Paolo Bonzini <bonzini@gnu.org> began maintaining GNU grep in Nov 2009. Paolo bowed out in 2012. ;; Local Variables: ;; coding: utf-8 ;; End: �kbuild-3608/src/grep/ABOUT-NLS����������������������������������������������������������������������0000664�0001750�0001750�00000267133�14670377427�015716� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������1 Notes on the Free Translation Project *************************************** Free software is going international! The Free Translation Project is a way to get maintainers of free software, translators, and users all together, so that free software will gradually become able to speak many languages. A few packages already provide translations for their messages. If you found this `ABOUT-NLS' file inside a distribution, you may assume that the distributed package does use GNU `gettext' internally, itself available at your nearest GNU archive site. But you do _not_ need to install GNU `gettext' prior to configuring, installing or using this package with messages translated. Installers will find here some useful hints. These notes also explain how users should proceed for getting the programs to use the available translations. They tell how people wanting to contribute and work on translations can contact the appropriate team. 1.1 INSTALL Matters =================== Some packages are "localizable" when properly installed; the programs they contain can be made to speak your own native language. Most such packages use GNU `gettext'. Other packages have their own ways to internationalization, predating GNU `gettext'. By default, this package will be installed to allow translation of messages. It will automatically detect whether the system already provides the GNU `gettext' functions. Installers may use special options at configuration time for changing the default behaviour. The command: ./configure --disable-nls will _totally_ disable translation of messages. When you already have GNU `gettext' installed on your system and run configure without an option for your new package, `configure' will probably detect the previously built and installed `libintl' library and will decide to use it. If not, you may have to to use the `--with-libintl-prefix' option to tell `configure' where to look for it. Internationalized packages usually have many `po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. Unless translations have been forbidden at `configure' time by using the `--disable-nls' switch, all available translations are installed together with the package. However, the environment variable `LINGUAS' may be set, prior to configuration, to limit the installed set. `LINGUAS' should then contain a space separated list of two-letter codes, stating which languages are allowed. 1.2 Using This Package ====================== As a user, if your language has been installed for this package, you only have to set the `LANG' environment variable to the appropriate `LL_CC' combination. If you happen to have the `LC_ALL' or some other `LC_xxx' environment variables set, you should unset them before setting `LANG', otherwise the setting of `LANG' will not have the desired effect. Here `LL' is an ISO 639 two-letter language code, and `CC' is an ISO 3166 two-letter country code. For example, let's suppose that you speak German and live in Germany. At the shell prompt, merely execute `setenv LANG de_DE' (in `csh'), `export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). This can be done from your `.login' or `.profile' file, once and for all. You might think that the country code specification is redundant. But in fact, some languages have dialects in different countries. For example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The country code serves to distinguish the dialects. The locale naming convention of `LL_CC', with `LL' denoting the language and `CC' denoting the country, is the one use on systems based on GNU libc. On other systems, some variations of this scheme are used, such as `LL' or `LL_CC.ENCODING'. You can get the list of locales supported by your system for your language by running the command `locale -a | grep '^LL''. Not all programs have translations for all languages. By default, an English message is shown in place of a nonexistent translation. If you understand other languages, you can set up a priority list of languages. This is done through a different environment variable, called `LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' for the purpose of message handling, but you still need to have `LANG' set to the primary language; this is required by other parts of the system libraries. For example, some Swedish users who would rather read translations in German than English for when Swedish is not available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. Special advice for Norwegian users: The language code for Norwegian bokma*l changed from `no' to `nb' recently (in 2003). During the transition period, while some message catalogs for this language are installed under `nb' and some older ones under `no', it's recommended for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and older translations are used. In the `LANGUAGE' environment variable, but not in the `LANG' environment variable, `LL_CC' combinations can be abbreviated as `LL' to denote the language's main dialect. For example, `de' is equivalent to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' (Portuguese as spoken in Portugal) in this context. 1.3 Translating Teams ===================== For the Free Translation Project to be a success, we need interested people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. Each translation team has its own mailing list. The up-to-date list of teams can be found at the Free Translation Project's homepage, `http://translationproject.org/', in the "Teams" area. If you'd like to volunteer to _work_ at translating messages, you should become a member of the translating team for your own language. The subscribing address is _not_ the same as the list itself, it has `-request' appended. For example, speakers of Swedish can send a message to `sv-request@li.org', having this message body: subscribe Keep in mind that team members are expected to participate _actively_ in translations, or at solving translational difficulties, rather than merely lurking around. If your team does not exist yet and you want to start one, or if you are unsure about what to do or how to get started, please write to `coordinator@translationproject.org' to reach the coordinator for all translator teams. The English team is special. It works at improving and uniformizing the terminology in use. Proven linguistic skills are praised more than programming skills, here. 1.4 Available Packages ====================== Languages are not equally supported in all packages. The following matrix shows the current state of internationalization, as of June 2010. The matrix shows, in regard of each package, for which languages PO files have been submitted to translation coordination, with a translation percentage of at least 50%. Ready PO files af am an ar as ast az be be@latin bg bn_IN bs ca +--------------------------------------------------+ a2ps | [] [] | aegis | | ant-phone | | anubis | | aspell | [] [] | bash | | bfd | | bibshelf | [] | binutils | | bison | | bison-runtime | [] | bluez-pin | [] [] | bombono-dvd | | buzztard | | cflow | | clisp | | coreutils | [] [] | cpio | | cppi | | cpplib | [] | cryptsetup | | dfarc | | dialog | [] [] | dico | | diffutils | [] | dink | | doodle | | e2fsprogs | [] | enscript | [] | exif | | fetchmail | [] | findutils | [] | flex | [] | freedink | | gas | | gawk | [] [] | gcal | [] | gcc | | gettext-examples | [] [] [] [] | gettext-runtime | [] [] | gettext-tools | [] [] | gip | [] | gjay | | gliv | [] | glunarclock | [] [] | gnubiff | | gnucash | [] | gnuedu | | gnulib | | gnunet | | gnunet-gtk | | gnutls | | gold | | gpe-aerial | | gpe-beam | | gpe-bluetooth | | gpe-calendar | | gpe-clock | [] | gpe-conf | | gpe-contacts | | gpe-edit | | gpe-filemanager | | gpe-go | | gpe-login | | gpe-ownerinfo | [] | gpe-package | | gpe-sketchbook | | gpe-su | [] | gpe-taskmanager | [] | gpe-timesheet | [] | gpe-today | [] | gpe-todo | | gphoto2 | | gprof | [] | gpsdrive | | gramadoir | | grep | | grub | [] [] | gsasl | | gss | | gst-plugins-bad | [] | gst-plugins-base | [] | gst-plugins-good | [] | gst-plugins-ugly | [] | gstreamer | [] [] [] | gtick | | gtkam | [] | gtkorphan | [] | gtkspell | [] [] [] | gutenprint | | hello | [] | help2man | | hylafax | | idutils | | indent | [] [] | iso_15924 | | iso_3166 | [] [] [] [] [] [] [] | iso_3166_2 | | iso_4217 | | iso_639 | [] [] [] [] | iso_639_3 | | jwhois | | kbd | | keytouch | [] | keytouch-editor | | keytouch-keyboa... | [] | klavaro | [] | latrine | | ld | [] | leafpad | [] [] | libc | [] [] | libexif | () | libextractor | | libgnutls | | libgpewidget | | libgpg-error | | libgphoto2 | | libgphoto2_port | | libgsasl | | libiconv | [] | libidn | | lifelines | | liferea | [] [] | lilypond | | linkdr | [] | lordsawar | | lprng | | lynx | [] | m4 | | mailfromd | | mailutils | | make | | man-db | | man-db-manpages | | minicom | | mkisofs | | myserver | | nano | [] [] | opcodes | | parted | | pies | | popt | | psmisc | | pspp | [] | pwdutils | | radius | [] | recode | [] [] | rosegarden | | rpm | | rush | | sarg | | screem | | scrollkeeper | [] [] [] | sed | [] [] | sharutils | [] [] | shishi | | skencil | | solfege | | solfege-manual | | soundtracker | | sp | | sysstat | | tar | [] | texinfo | | tin | | unicode-han-tra... | | unicode-transla... | | util-linux-ng | [] | vice | | vmm | | vorbis-tools | | wastesedge | | wdiff | | wget | [] [] | wyslij-po | | xchat | [] [] [] [] | xdg-user-dirs | [] [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] | +--------------------------------------------------+ af am an ar as ast az be be@latin bg bn_IN bs ca 6 0 1 2 3 19 1 10 3 28 3 1 38 crh cs da de el en en_GB en_ZA eo es et eu fa +-------------------------------------------------+ a2ps | [] [] [] [] [] [] [] | aegis | [] [] [] | ant-phone | [] () | anubis | [] [] | aspell | [] [] [] [] [] | bash | [] [] [] | bfd | [] | bibshelf | [] [] [] | binutils | [] | bison | [] [] | bison-runtime | [] [] [] [] | bluez-pin | [] [] [] [] [] [] | bombono-dvd | [] | buzztard | [] [] [] | cflow | [] [] | clisp | [] [] [] [] | coreutils | [] [] [] [] | cpio | | cppi | | cpplib | [] [] [] | cryptsetup | [] | dfarc | [] [] [] | dialog | [] [] [] [] [] | dico | | diffutils | [] [] [] [] [] [] | dink | [] [] [] | doodle | [] | e2fsprogs | [] [] [] | enscript | [] [] [] | exif | () [] [] | fetchmail | [] [] () [] [] [] | findutils | [] [] [] | flex | [] [] | freedink | [] [] [] | gas | [] | gawk | [] [] [] | gcal | [] | gcc | [] [] | gettext-examples | [] [] [] [] | gettext-runtime | [] [] [] [] | gettext-tools | [] [] [] | gip | [] [] [] [] | gjay | [] | gliv | [] [] [] | glunarclock | [] [] | gnubiff | () | gnucash | [] () () () () | gnuedu | [] [] | gnulib | [] [] | gnunet | | gnunet-gtk | [] | gnutls | [] [] | gold | [] | gpe-aerial | [] [] [] [] | gpe-beam | [] [] [] [] | gpe-bluetooth | [] [] | gpe-calendar | [] | gpe-clock | [] [] [] [] | gpe-conf | [] [] [] | gpe-contacts | [] [] [] | gpe-edit | [] [] | gpe-filemanager | [] [] [] | gpe-go | [] [] [] [] | gpe-login | [] [] | gpe-ownerinfo | [] [] [] [] | gpe-package | [] [] [] | gpe-sketchbook | [] [] [] [] | gpe-su | [] [] [] [] | gpe-taskmanager | [] [] [] [] | gpe-timesheet | [] [] [] [] | gpe-today | [] [] [] [] | gpe-todo | [] [] [] | gphoto2 | [] [] () [] [] [] | gprof | [] [] [] | gpsdrive | [] [] [] | gramadoir | [] [] [] | grep | [] | grub | [] [] | gsasl | [] | gss | | gst-plugins-bad | [] [] [] [] [] | gst-plugins-base | [] [] [] [] [] | gst-plugins-good | [] [] [] [] [] [] | gst-plugins-ugly | [] [] [] [] [] [] | gstreamer | [] [] [] [] [] | gtick | [] () [] | gtkam | [] [] () [] [] | gtkorphan | [] [] [] [] | gtkspell | [] [] [] [] [] [] [] | gutenprint | [] [] [] | hello | [] [] [] [] | help2man | [] | hylafax | [] [] | idutils | [] [] | indent | [] [] [] [] [] [] [] | iso_15924 | [] () [] [] | iso_3166 | [] [] [] [] () [] [] [] () | iso_3166_2 | () | iso_4217 | [] [] [] () [] [] | iso_639 | [] [] [] [] () [] [] | iso_639_3 | [] | jwhois | [] | kbd | [] [] [] [] [] | keytouch | [] [] | keytouch-editor | [] [] | keytouch-keyboa... | [] | klavaro | [] [] [] [] | latrine | [] () | ld | [] [] | leafpad | [] [] [] [] [] [] | libc | [] [] [] [] | libexif | [] [] () | libextractor | | libgnutls | [] | libgpewidget | [] [] | libgpg-error | [] [] | libgphoto2 | [] () | libgphoto2_port | [] () [] | libgsasl | | libiconv | [] [] [] [] [] | libidn | [] [] [] | lifelines | [] () | liferea | [] [] [] [] [] | lilypond | [] [] [] | linkdr | [] [] [] | lordsawar | [] | lprng | | lynx | [] [] [] [] | m4 | [] [] [] [] | mailfromd | | mailutils | [] | make | [] [] [] | man-db | | man-db-manpages | | minicom | [] [] [] [] | mkisofs | | myserver | | nano | [] [] [] | opcodes | [] [] | parted | [] [] | pies | | popt | [] [] [] [] [] | psmisc | [] [] [] | pspp | [] | pwdutils | [] | radius | [] | recode | [] [] [] [] [] [] | rosegarden | () () () | rpm | [] [] [] | rush | | sarg | | screem | | scrollkeeper | [] [] [] [] [] | sed | [] [] [] [] [] [] | sharutils | [] [] [] [] | shishi | | skencil | [] () [] | solfege | [] [] [] | solfege-manual | [] [] | soundtracker | [] [] [] | sp | [] | sysstat | [] [] [] | tar | [] [] [] [] | texinfo | [] [] [] | tin | [] [] | unicode-han-tra... | | unicode-transla... | | util-linux-ng | [] [] [] [] | vice | () () | vmm | [] | vorbis-tools | [] [] | wastesedge | [] | wdiff | [] [] | wget | [] [] [] | wyslij-po | | xchat | [] [] [] [] [] | xdg-user-dirs | [] [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] [] [] [] [] | +-------------------------------------------------+ crh cs da de el en en_GB en_ZA eo es et eu fa 5 64 105 117 18 1 8 0 28 89 18 19 0 fi fr ga gl gu he hi hr hu hy id is it ja ka kn +----------------------------------------------------+ a2ps | [] [] [] [] | aegis | [] [] | ant-phone | [] [] | anubis | [] [] [] [] | aspell | [] [] [] [] | bash | [] [] [] [] | bfd | [] [] [] | bibshelf | [] [] [] [] [] | binutils | [] [] [] | bison | [] [] [] [] | bison-runtime | [] [] [] [] [] [] | bluez-pin | [] [] [] [] [] [] [] [] | bombono-dvd | [] | buzztard | [] | cflow | [] [] [] | clisp | [] | coreutils | [] [] [] [] [] | cpio | [] [] [] [] | cppi | [] [] | cpplib | [] [] [] | cryptsetup | [] [] [] | dfarc | [] [] [] | dialog | [] [] [] [] [] [] [] | dico | | diffutils | [] [] [] [] [] [] [] [] [] | dink | [] | doodle | [] [] | e2fsprogs | [] [] | enscript | [] [] [] [] | exif | [] [] [] [] [] [] | fetchmail | [] [] [] [] | findutils | [] [] [] [] [] [] | flex | [] [] [] | freedink | [] [] [] | gas | [] [] | gawk | [] [] [] [] () [] | gcal | [] | gcc | [] | gettext-examples | [] [] [] [] [] [] [] | gettext-runtime | [] [] [] [] [] [] | gettext-tools | [] [] [] [] | gip | [] [] [] [] [] [] | gjay | [] | gliv | [] () | glunarclock | [] [] [] [] | gnubiff | () [] () | gnucash | () () () () () [] | gnuedu | [] [] | gnulib | [] [] [] [] [] [] | gnunet | | gnunet-gtk | [] | gnutls | [] [] | gold | [] [] | gpe-aerial | [] [] [] | gpe-beam | [] [] [] [] | gpe-bluetooth | [] [] [] [] | gpe-calendar | [] [] | gpe-clock | [] [] [] [] [] | gpe-conf | [] [] [] [] | gpe-contacts | [] [] [] [] | gpe-edit | [] [] [] | gpe-filemanager | [] [] [] [] | gpe-go | [] [] [] [] [] | gpe-login | [] [] [] | gpe-ownerinfo | [] [] [] [] [] | gpe-package | [] [] [] | gpe-sketchbook | [] [] [] [] | gpe-su | [] [] [] [] [] [] | gpe-taskmanager | [] [] [] [] [] | gpe-timesheet | [] [] [] [] [] | gpe-today | [] [] [] [] [] [] [] | gpe-todo | [] [] [] | gphoto2 | [] [] [] [] [] [] | gprof | [] [] [] [] | gpsdrive | [] [] [] | gramadoir | [] [] [] | grep | [] [] | grub | [] [] [] [] | gsasl | [] [] [] [] [] | gss | [] [] [] [] [] | gst-plugins-bad | [] [] [] [] [] [] | gst-plugins-base | [] [] [] [] [] [] | gst-plugins-good | [] [] [] [] [] [] | gst-plugins-ugly | [] [] [] [] [] [] | gstreamer | [] [] [] [] [] | gtick | [] [] [] [] [] | gtkam | [] [] [] [] [] | gtkorphan | [] [] [] | gtkspell | [] [] [] [] [] [] [] [] [] | gutenprint | [] [] [] [] | hello | [] [] [] | help2man | [] [] | hylafax | [] | idutils | [] [] [] [] [] [] | indent | [] [] [] [] [] [] [] [] | iso_15924 | [] () [] [] | iso_3166 | [] () [] [] [] [] [] [] [] [] [] [] | iso_3166_2 | () [] [] [] | iso_4217 | [] () [] [] [] [] | iso_639 | [] () [] [] [] [] [] [] [] | iso_639_3 | () [] [] | jwhois | [] [] [] [] [] | kbd | [] [] | keytouch | [] [] [] [] [] [] | keytouch-editor | [] [] [] [] [] | keytouch-keyboa... | [] [] [] [] [] | klavaro | [] [] | latrine | [] [] [] | ld | [] [] [] [] | leafpad | [] [] [] [] [] [] [] () | libc | [] [] [] [] [] | libexif | [] | libextractor | | libgnutls | [] [] | libgpewidget | [] [] [] [] | libgpg-error | [] [] | libgphoto2 | [] [] [] | libgphoto2_port | [] [] [] | libgsasl | [] [] [] [] [] | libiconv | [] [] [] [] [] [] | libidn | [] [] [] [] | lifelines | () | liferea | [] [] [] [] | lilypond | [] [] | linkdr | [] [] [] [] [] | lordsawar | | lprng | [] | lynx | [] [] [] [] [] | m4 | [] [] [] [] [] [] | mailfromd | | mailutils | [] [] | make | [] [] [] [] [] [] [] [] [] | man-db | [] [] | man-db-manpages | [] | minicom | [] [] [] [] [] | mkisofs | [] [] [] [] | myserver | | nano | [] [] [] [] [] [] | opcodes | [] [] [] [] | parted | [] [] [] [] | pies | | popt | [] [] [] [] [] [] [] [] [] | psmisc | [] [] [] | pspp | | pwdutils | [] [] | radius | [] [] | recode | [] [] [] [] [] [] [] [] | rosegarden | () () () () () | rpm | [] [] | rush | | sarg | [] | screem | [] [] | scrollkeeper | [] [] [] [] | sed | [] [] [] [] [] [] [] [] | sharutils | [] [] [] [] [] [] [] | shishi | [] | skencil | [] | solfege | [] [] [] [] | solfege-manual | [] [] | soundtracker | [] [] | sp | [] () | sysstat | [] [] [] [] [] | tar | [] [] [] [] [] [] [] | texinfo | [] [] [] [] | tin | [] | unicode-han-tra... | | unicode-transla... | [] [] | util-linux-ng | [] [] [] [] [] [] | vice | () () () | vmm | [] | vorbis-tools | [] | wastesedge | () () | wdiff | [] | wget | [] [] [] [] [] [] [] [] | wyslij-po | [] [] [] | xchat | [] [] [] [] [] [] [] [] [] | xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] [] [] [] | +----------------------------------------------------+ fi fr ga gl gu he hi hr hu hy id is it ja ka kn 105 121 53 20 4 8 3 5 53 2 120 5 84 67 0 4 ko ku ky lg lt lv mk ml mn mr ms mt nb nds ne +-----------------------------------------------+ a2ps | [] | aegis | | ant-phone | | anubis | [] [] | aspell | [] | bash | | bfd | | bibshelf | [] [] | binutils | | bison | [] | bison-runtime | [] [] [] [] [] | bluez-pin | [] [] [] [] [] | bombono-dvd | | buzztard | | cflow | | clisp | | coreutils | [] | cpio | | cppi | | cpplib | | cryptsetup | | dfarc | [] | dialog | [] [] [] [] [] | dico | | diffutils | [] [] | dink | | doodle | | e2fsprogs | | enscript | | exif | [] | fetchmail | | findutils | | flex | | freedink | [] | gas | | gawk | | gcal | | gcc | | gettext-examples | [] [] [] [] | gettext-runtime | [] | gettext-tools | [] | gip | [] [] | gjay | | gliv | | glunarclock | [] | gnubiff | | gnucash | () () () () | gnuedu | | gnulib | | gnunet | | gnunet-gtk | | gnutls | [] | gold | | gpe-aerial | [] | gpe-beam | [] | gpe-bluetooth | [] [] | gpe-calendar | [] | gpe-clock | [] [] [] [] [] | gpe-conf | [] [] | gpe-contacts | [] [] | gpe-edit | [] | gpe-filemanager | [] [] | gpe-go | [] [] [] | gpe-login | [] | gpe-ownerinfo | [] [] | gpe-package | [] [] | gpe-sketchbook | [] [] | gpe-su | [] [] [] [] [] [] | gpe-taskmanager | [] [] [] [] [] [] | gpe-timesheet | [] [] | gpe-today | [] [] [] [] | gpe-todo | [] [] | gphoto2 | | gprof | [] | gpsdrive | | gramadoir | | grep | | grub | | gsasl | | gss | | gst-plugins-bad | [] [] [] [] | gst-plugins-base | [] [] | gst-plugins-good | [] [] | gst-plugins-ugly | [] [] [] [] [] | gstreamer | | gtick | | gtkam | [] | gtkorphan | [] [] | gtkspell | [] [] [] [] [] [] [] | gutenprint | | hello | [] [] [] | help2man | | hylafax | | idutils | | indent | | iso_15924 | [] [] | iso_3166 | [] [] () [] [] [] [] [] | iso_3166_2 | | iso_4217 | [] [] | iso_639 | [] [] | iso_639_3 | [] | jwhois | [] | kbd | | keytouch | [] | keytouch-editor | [] | keytouch-keyboa... | [] | klavaro | [] | latrine | [] | ld | | leafpad | [] [] [] | libc | [] | libexif | | libextractor | | libgnutls | [] | libgpewidget | [] [] | libgpg-error | | libgphoto2 | | libgphoto2_port | | libgsasl | | libiconv | | libidn | | lifelines | | liferea | | lilypond | | linkdr | | lordsawar | | lprng | | lynx | | m4 | | mailfromd | | mailutils | | make | [] | man-db | | man-db-manpages | | minicom | [] | mkisofs | | myserver | | nano | [] [] | opcodes | | parted | | pies | | popt | [] [] [] | psmisc | | pspp | | pwdutils | | radius | | recode | | rosegarden | | rpm | | rush | | sarg | | screem | | scrollkeeper | [] [] | sed | | sharutils | | shishi | | skencil | | solfege | [] | solfege-manual | | soundtracker | | sp | | sysstat | [] | tar | [] | texinfo | [] | tin | | unicode-han-tra... | | unicode-transla... | | util-linux-ng | | vice | | vmm | | vorbis-tools | | wastesedge | | wdiff | | wget | [] | wyslij-po | | xchat | [] [] [] | xdg-user-dirs | [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] [] | +-----------------------------------------------+ ko ku ky lg lt lv mk ml mn mr ms mt nb nds ne 20 5 10 1 13 48 4 2 2 4 24 10 20 3 1 nl nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr +---------------------------------------------------+ a2ps | [] [] [] [] [] [] [] [] | aegis | [] [] [] | ant-phone | [] [] | anubis | [] [] [] | aspell | [] [] [] [] [] | bash | [] [] | bfd | [] | bibshelf | [] [] | binutils | [] [] | bison | [] [] [] | bison-runtime | [] [] [] [] [] [] [] | bluez-pin | [] [] [] [] [] [] [] [] | bombono-dvd | [] () | buzztard | [] [] | cflow | [] | clisp | [] [] | coreutils | [] [] [] [] [] [] | cpio | [] [] [] | cppi | [] | cpplib | [] | cryptsetup | [] | dfarc | [] | dialog | [] [] [] [] | dico | [] | diffutils | [] [] [] [] [] [] | dink | () | doodle | [] [] | e2fsprogs | [] [] | enscript | [] [] [] [] [] | exif | [] [] [] () [] | fetchmail | [] [] [] [] | findutils | [] [] [] [] [] | flex | [] [] [] [] [] | freedink | [] [] | gas | | gawk | [] [] [] [] | gcal | | gcc | [] | gettext-examples | [] [] [] [] [] [] [] [] | gettext-runtime | [] [] [] [] [] [] [] [] [] | gettext-tools | [] [] [] [] [] [] | gip | [] [] [] [] [] | gjay | | gliv | [] [] [] [] [] [] | glunarclock | [] [] [] [] [] | gnubiff | [] () | gnucash | [] () () () | gnuedu | [] | gnulib | [] [] [] [] | gnunet | | gnunet-gtk | | gnutls | [] [] | gold | | gpe-aerial | [] [] [] [] [] [] [] | gpe-beam | [] [] [] [] [] [] [] | gpe-bluetooth | [] [] | gpe-calendar | [] [] [] [] | gpe-clock | [] [] [] [] [] [] [] [] | gpe-conf | [] [] [] [] [] [] [] | gpe-contacts | [] [] [] [] [] | gpe-edit | [] [] [] | gpe-filemanager | [] [] [] | gpe-go | [] [] [] [] [] [] [] [] | gpe-login | [] [] | gpe-ownerinfo | [] [] [] [] [] [] [] [] | gpe-package | [] [] | gpe-sketchbook | [] [] [] [] [] [] [] | gpe-su | [] [] [] [] [] [] [] [] | gpe-taskmanager | [] [] [] [] [] [] [] [] | gpe-timesheet | [] [] [] [] [] [] [] [] | gpe-today | [] [] [] [] [] [] [] [] | gpe-todo | [] [] [] [] [] | gphoto2 | [] [] [] [] [] [] [] [] | gprof | [] [] [] | gpsdrive | [] [] | gramadoir | [] [] | grep | [] [] [] [] | grub | [] [] [] | gsasl | [] [] [] [] | gss | [] [] [] | gst-plugins-bad | [] [] [] [] [] [] | gst-plugins-base | [] [] [] [] [] | gst-plugins-good | [] [] [] [] [] | gst-plugins-ugly | [] [] [] [] [] [] | gstreamer | [] [] [] [] [] | gtick | [] [] [] | gtkam | [] [] [] [] [] [] | gtkorphan | [] | gtkspell | [] [] [] [] [] [] [] [] [] [] | gutenprint | [] [] | hello | [] [] [] [] | help2man | [] [] | hylafax | [] | idutils | [] [] [] [] [] | indent | [] [] [] [] [] [] [] | iso_15924 | [] [] [] [] | iso_3166 | [] [] [] [] [] () [] [] [] [] [] [] [] [] | iso_3166_2 | [] [] [] | iso_4217 | [] [] [] [] [] [] [] [] | iso_639 | [] [] [] [] [] [] [] [] [] | iso_639_3 | [] [] | jwhois | [] [] [] [] | kbd | [] [] [] | keytouch | [] [] [] | keytouch-editor | [] [] [] | keytouch-keyboa... | [] [] [] | klavaro | [] [] | latrine | [] [] | ld | | leafpad | [] [] [] [] [] [] [] [] [] | libc | [] [] [] [] | libexif | [] [] () [] | libextractor | | libgnutls | [] [] | libgpewidget | [] [] [] | libgpg-error | [] [] | libgphoto2 | [] [] | libgphoto2_port | [] [] [] [] [] | libgsasl | [] [] [] [] [] | libiconv | [] [] [] [] [] | libidn | [] [] | lifelines | [] [] | liferea | [] [] [] [] [] () () [] | lilypond | [] | linkdr | [] [] [] | lordsawar | | lprng | [] | lynx | [] [] [] | m4 | [] [] [] [] [] | mailfromd | [] | mailutils | [] | make | [] [] [] [] | man-db | [] [] [] | man-db-manpages | [] [] [] | minicom | [] [] [] [] | mkisofs | [] [] [] | myserver | | nano | [] [] [] [] | opcodes | [] [] | parted | [] [] [] [] | pies | [] | popt | [] [] [] [] | psmisc | [] [] [] | pspp | [] [] | pwdutils | [] | radius | [] [] [] | recode | [] [] [] [] [] [] [] [] | rosegarden | () () | rpm | [] [] [] | rush | [] [] | sarg | | screem | | scrollkeeper | [] [] [] [] [] [] [] [] | sed | [] [] [] [] [] [] [] [] [] | sharutils | [] [] [] [] | shishi | [] | skencil | [] [] | solfege | [] [] [] [] | solfege-manual | [] [] [] | soundtracker | [] | sp | | sysstat | [] [] [] [] | tar | [] [] [] [] | texinfo | [] [] [] [] | tin | [] | unicode-han-tra... | | unicode-transla... | | util-linux-ng | [] [] [] [] [] | vice | [] | vmm | [] | vorbis-tools | [] [] | wastesedge | [] | wdiff | [] [] | wget | [] [] [] [] [] [] [] | wyslij-po | [] [] [] | xchat | [] [] [] [] [] [] [] [] [] | xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] [] | +---------------------------------------------------+ nl nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr 135 10 4 7 105 1 29 62 47 91 3 54 46 9 37 sv sw ta te tg th tr uk vi wa zh_CN zh_HK zh_TW +---------------------------------------------------+ a2ps | [] [] [] [] [] | 27 aegis | [] | 9 ant-phone | [] [] [] [] | 9 anubis | [] [] [] [] | 15 aspell | [] [] [] | 20 bash | [] [] [] | 12 bfd | [] | 6 bibshelf | [] [] [] | 16 binutils | [] [] | 8 bison | [] [] | 12 bison-runtime | [] [] [] [] [] [] | 29 bluez-pin | [] [] [] [] [] [] [] [] | 37 bombono-dvd | [] | 4 buzztard | [] | 7 cflow | [] [] [] | 9 clisp | | 10 coreutils | [] [] [] [] | 22 cpio | [] [] [] [] [] [] | 13 cppi | [] [] | 5 cpplib | [] [] [] [] [] [] | 14 cryptsetup | [] [] | 7 dfarc | [] | 9 dialog | [] [] [] [] [] [] [] | 30 dico | [] | 2 diffutils | [] [] [] [] [] [] | 30 dink | | 4 doodle | [] [] | 7 e2fsprogs | [] [] [] | 11 enscript | [] [] [] [] | 17 exif | [] [] [] | 16 fetchmail | [] [] [] | 17 findutils | [] [] [] [] [] | 20 flex | [] [] [] [] | 15 freedink | [] | 10 gas | [] | 4 gawk | [] [] [] [] | 18 gcal | [] [] | 5 gcc | [] [] [] | 7 gettext-examples | [] [] [] [] [] [] [] | 34 gettext-runtime | [] [] [] [] [] [] [] | 29 gettext-tools | [] [] [] [] [] [] | 22 gip | [] [] [] [] | 22 gjay | [] | 3 gliv | [] [] [] | 14 glunarclock | [] [] [] [] [] | 19 gnubiff | [] [] | 4 gnucash | () [] () [] () | 10 gnuedu | [] [] | 7 gnulib | [] [] [] [] | 16 gnunet | [] | 1 gnunet-gtk | [] [] [] | 5 gnutls | [] [] [] | 10 gold | [] | 4 gpe-aerial | [] [] [] | 18 gpe-beam | [] [] [] | 19 gpe-bluetooth | [] [] [] | 13 gpe-calendar | [] [] [] [] | 12 gpe-clock | [] [] [] [] [] | 28 gpe-conf | [] [] [] [] | 20 gpe-contacts | [] [] [] | 17 gpe-edit | [] [] [] | 12 gpe-filemanager | [] [] [] [] | 16 gpe-go | [] [] [] [] [] | 25 gpe-login | [] [] [] | 11 gpe-ownerinfo | [] [] [] [] [] | 25 gpe-package | [] [] [] | 13 gpe-sketchbook | [] [] [] | 20 gpe-su | [] [] [] [] [] | 30 gpe-taskmanager | [] [] [] [] [] | 29 gpe-timesheet | [] [] [] [] [] | 25 gpe-today | [] [] [] [] [] [] | 30 gpe-todo | [] [] [] [] | 17 gphoto2 | [] [] [] [] [] | 24 gprof | [] [] [] | 15 gpsdrive | [] [] [] | 11 gramadoir | [] [] [] | 11 grep | [] [] [] | 10 grub | [] [] [] | 14 gsasl | [] [] [] [] | 14 gss | [] [] [] | 11 gst-plugins-bad | [] [] [] [] | 26 gst-plugins-base | [] [] [] [] [] | 24 gst-plugins-good | [] [] [] [] | 24 gst-plugins-ugly | [] [] [] [] [] | 29 gstreamer | [] [] [] [] | 22 gtick | [] [] [] | 13 gtkam | [] [] [] | 20 gtkorphan | [] [] [] | 14 gtkspell | [] [] [] [] [] [] [] [] [] | 45 gutenprint | [] | 10 hello | [] [] [] [] [] [] | 21 help2man | [] [] | 7 hylafax | [] | 5 idutils | [] [] [] [] | 17 indent | [] [] [] [] [] [] | 30 iso_15924 | () [] () [] [] | 16 iso_3166 | [] [] () [] [] () [] [] [] () | 53 iso_3166_2 | () [] () [] | 9 iso_4217 | [] () [] [] () [] [] | 26 iso_639 | [] [] [] () [] () [] [] [] [] | 38 iso_639_3 | [] () | 8 jwhois | [] [] [] [] [] | 16 kbd | [] [] [] [] [] | 15 keytouch | [] [] [] | 16 keytouch-editor | [] [] [] | 14 keytouch-keyboa... | [] [] [] | 14 klavaro | [] | 11 latrine | [] [] [] | 10 ld | [] [] [] [] | 11 leafpad | [] [] [] [] [] [] | 33 libc | [] [] [] [] [] | 21 libexif | [] () | 7 libextractor | [] | 1 libgnutls | [] [] [] | 9 libgpewidget | [] [] [] | 14 libgpg-error | [] [] [] | 9 libgphoto2 | [] [] | 8 libgphoto2_port | [] [] [] [] | 14 libgsasl | [] [] [] | 13 libiconv | [] [] [] [] | 21 libidn | () [] [] | 11 lifelines | [] | 4 liferea | [] [] [] | 21 lilypond | [] | 7 linkdr | [] [] [] [] [] | 17 lordsawar | | 1 lprng | [] | 3 lynx | [] [] [] [] | 17 m4 | [] [] [] [] | 19 mailfromd | [] [] | 3 mailutils | [] | 5 make | [] [] [] [] | 21 man-db | [] [] [] | 8 man-db-manpages | | 4 minicom | [] [] | 16 mkisofs | [] [] | 9 myserver | | 0 nano | [] [] [] [] | 21 opcodes | [] [] [] | 11 parted | [] [] [] [] [] | 15 pies | [] [] | 3 popt | [] [] [] [] [] [] | 27 psmisc | [] [] | 11 pspp | | 4 pwdutils | [] [] | 6 radius | [] [] | 9 recode | [] [] [] [] | 28 rosegarden | () | 0 rpm | [] [] [] | 11 rush | [] [] | 4 sarg | | 1 screem | [] | 3 scrollkeeper | [] [] [] [] [] | 27 sed | [] [] [] [] [] | 30 sharutils | [] [] [] [] [] | 22 shishi | [] | 3 skencil | [] [] | 7 solfege | [] [] [] [] | 16 solfege-manual | [] | 8 soundtracker | [] [] [] | 9 sp | [] | 3 sysstat | [] [] | 15 tar | [] [] [] [] [] [] | 23 texinfo | [] [] [] [] [] | 17 tin | | 4 unicode-han-tra... | | 0 unicode-transla... | | 2 util-linux-ng | [] [] [] [] | 20 vice | () () | 1 vmm | [] | 4 vorbis-tools | [] | 6 wastesedge | | 2 wdiff | [] [] | 7 wget | [] [] [] [] [] | 26 wyslij-po | [] [] | 8 xchat | [] [] [] [] [] [] | 36 xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | 63 xkeyboard-config | [] [] [] | 22 +---------------------------------------------------+ 85 teams sv sw ta te tg th tr uk vi wa zh_CN zh_HK zh_TW 178 domains 119 1 3 3 0 10 65 51 155 17 98 7 41 2618 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are used for implementing regional variants of languages, or language dialects. For a PO file in the matrix above to be effective, the package to which it applies should also have been internationalized and distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. If June 2010 seems to be old, you may fetch a more recent copy of this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date matrix with full percentage details can be found at `http://translationproject.org/extra/matrix.html'. 1.5 Using `gettext' in new packages =================================== If you are writing a freely available program and want to internationalize it you are welcome to use GNU `gettext' in your package. Of course you have to respect the GNU Library General Public License which covers the use of the GNU `gettext' library. This means in particular that even non-free programs can use `libintl' as a shared library, whereas only free software can use `libintl' as a static library or use modified versions of `libintl'. Once the sources are changed appropriately and the setup can handle the use of `gettext' the only thing missing are the translations. The Free Translation Project is also available for packages which are not developed inside the GNU project. Therefore the information given above applies also for every other Free Software Project. Contact `coordinator@translationproject.org' to make the `.pot' files available to the translation teams. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/.mailmap�����������������������������������������������������������������������0000664�0001750�0001750�00000001011�14670377426�016064� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Map git author names and email addresses to canonical/preferred form. <jim@meyering.net> <meyering@fb.com> <jim@meyering.net> <meyering@redhat.com> <karl@gnu.org> <karl@tug.org> Paul Eggert <eggert@cs.ucla.edu> <eggert@penguin.cs.ucla.edu> Paul Eggert <eggert@cs.ucla.edu> <eggert@CS.UCLA.EDU> <eggert@cs.ucla.edu> <eggert@twinsun.com> <karl@gnu.org> <karl@freefriends.org> <bonzini@gnu.org> <pbonzini@redhat.com> # Correct misspelled last name Norihiro Tanaka <noritnk@kcn.ne.jp> Norihirio Tanaka <noritnk@kcn.ne.jp> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/grep/config.win.h�������������������������������������������������������������������0000664�0001750�0001750�00000234075�14670377423�016674� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* config.hin. Manually edited */ #ifndef INCLUDED_CONFIG_WIN_H #define INCLUDED_CONFIG_WIN_H #if 1 /* HACK ALERT! Make inlined CRT functions static to avoid getting duplicate symbols errors for things like _vprintf_l. */ # define _CRT_STDIO_INLINE static __inline /* HACK ALERT! Ugly ugly hack for making __local_stdio_printf_options static and not to cause stupid stupid duplicate symbols linker errors. */ # include <corecrt.h> # undef _CRT_INLINE_PURE_SECURITYCRITICAL_ATTRIBUTE # define _CRT_INLINE_PURE_SECURITYCRITICAL_ATTRIBUTE static /* HACK ALERT! wchar.h requires __inline temporarily redefined to static _inline or we'll end up with mbsinit wmemchr, wmemcmp, wmemcpy and friends as duplicates. */ # include <stdio.h> # include <conio.h> # include <string.h> # include <time.h> # include <sys/stat.h> # define __inline static _inline # include <wchar.h> # undef __inline #endif /* CPU and C ABI indicator */ #ifndef __i386__ #undef __i386__ #endif #ifndef __x86_64_x32__ #undef __x86_64_x32__ #endif #ifndef __x86_64__ #undef __x86_64__ #endif #ifndef __alpha__ #undef __alpha__ #endif #ifndef __arm__ #undef __arm__ #endif #ifndef __armhf__ #undef __armhf__ #endif #ifndef __arm64_ilp32__ #undef __arm64_ilp32__ #endif #ifndef __arm64__ #undef __arm64__ #endif #ifndef __hppa__ #undef __hppa__ #endif #ifndef __hppa64__ #undef __hppa64__ #endif #ifndef __ia64_ilp32__ #undef __ia64_ilp32__ #endif #ifndef __ia64__ #undef __ia64__ #endif #ifndef __m68k__ #undef __m68k__ #endif #ifndef __mips__ #undef __mips__ #endif #ifndef __mipsn32__ #undef __mipsn32__ #endif #ifndef __mips64__ #undef __mips64__ #endif #ifndef __powerpc__ #undef __powerpc__ #endif #ifndef __powerpc64__ #undef __powerpc64__ #endif #ifndef __powerpc64_elfv2__ #undef __powerpc64_elfv2__ #endif #ifndef __riscv32__ #undef __riscv32__ #endif #ifndef __riscv64__ #undef __riscv64__ #endif #ifndef __riscv32_ilp32__ #undef __riscv32_ilp32__ #endif #ifndef __riscv32_ilp32f__ #undef __riscv32_ilp32f__ #endif #ifndef __riscv32_ilp32d__ #undef __riscv32_ilp32d__ #endif #ifndef __riscv64_ilp32__ #undef __riscv64_ilp32__ #endif #ifndef __riscv64_ilp32f__ #undef __riscv64_ilp32f__ #endif #ifndef __riscv64_ilp32d__ #undef __riscv64_ilp32d__ #endif #ifndef __riscv64_lp64__ #undef __riscv64_lp64__ #endif #ifndef __riscv64_lp64f__ #undef __riscv64_lp64f__ #endif #ifndef __riscv64_lp64d__ #undef __riscv64_lp64d__ #endif #ifndef __s390__ #undef __s390__ #endif #ifndef __s390x__ #undef __s390x__ #endif #ifndef __sh__ #undef __sh__ #endif #ifndef __sparc__ #undef __sparc__ #endif #ifndef __sparc64__ #undef __sparc64__ #endif /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to the function xargmatch calls on failures. */ #undef ARGMATCH_DIE /* Define to the declaration of the xargmatch failure function. */ #undef ARGMATCH_DIE_DECL /* Define to the number of bits in type 'ptrdiff_t'. */ #undef BITSIZEOF_PTRDIFF_T /* Define to the number of bits in type 'sig_atomic_t'. */ #undef BITSIZEOF_SIG_ATOMIC_T /* Define to the number of bits in type 'size_t'. */ #undef BITSIZEOF_SIZE_T /* Define to the number of bits in type 'wchar_t'. */ #undef BITSIZEOF_WCHAR_T /* Define to the number of bits in type 'wint_t'. */ #undef BITSIZEOF_WINT_T /* Define to 1 if the `closedir' function returns void instead of int. */ #undef CLOSEDIR_VOID /* Define to 1 if using 'alloca.c'. */ #undef C_ALLOCA /* Define as the bit index in the word where to find bit 0 of the exponent of 'double'. */ #undef DBL_EXPBIT0_BIT /* Define as the word index where to find the exponent of 'double'. */ #undef DBL_EXPBIT0_WORD /* the name of the file descriptor member of DIR */ #undef DIR_FD_MEMBER_NAME #ifdef DIR_FD_MEMBER_NAME # define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME) #else # define DIR_TO_FD(Dir_p) -1 #endif /* Define to 1 if // is a file system root distinct from /. */ #undef DOUBLE_SLASH_IS_DISTINCT_ROOT /* Define if struct dirent has a member d_ino that actually works. */ #undef D_INO_IN_DIRENT /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS /* Define this to 1 if F_DUPFD behavior does not match POSIX */ #undef FCNTL_DUPFD_BUGGY /* Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like 'struct s { int n; short d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 compilers. Use 'FLEXSIZEOF (struct s, d, N * sizeof (short))' to calculate the size in bytes of such a struct containing an N-element array. */ #define FLEXIBLE_ARRAY_MEMBER 1 /* Define to 1 if fopen() fails to recognize a trailing slash. */ #undef FOPEN_TRAILING_SLASH_BUG /* Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string. */ #undef FUNC_NL_LANGINFO_YESEXPR_WORKS /* Define this to 'void' or 'struct timezone' to match the system's declaration of the second argument to gettimeofday. */ #undef GETTIMEOFDAY_TIMEZONE /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module close-stream shall be considered present. */ #undef GNULIB_CLOSE_STREAM /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fcntl-safer shall be considered present. */ #undef GNULIB_FCNTL_SAFER /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fdopendir shall be considered present. */ #undef GNULIB_FDOPENDIR /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fd-safer-flag shall be considered present. */ #undef GNULIB_FD_SAFER_FLAG /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fopen-gnu shall be considered present. */ #undef GNULIB_FOPEN_GNU /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fscanf shall be considered present. */ #undef GNULIB_FSCANF /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module isblank shall be considered present. */ #undef GNULIB_ISBLANK /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module lock shall be considered present. */ #undef GNULIB_LOCK /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module msvc-nothrow shall be considered present. */ #undef GNULIB_MSVC_NOTHROW /* Define to 1 to disable use of VLAs */ #undef GNULIB_NO_VLA /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module openat shall be considered present. */ #define GNULIB_OPENAT 1 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module openat-safer shall be considered present. */ #define GNULIB_OPENAT_SAFER 1 /* enable some gnulib portability checks */ #undef GNULIB_PORTCHECK /* Enable compile-time and run-time bounds-checking, and some warnings, without upsetting glibc 2.15+. */ #if (defined GNULIB_PORTCHECK && !defined _FORTIFY_SOURCE \ && defined __OPTIMIZE__ && __OPTIMIZE__) # define _FORTIFY_SOURCE 2 #endif /* Define to 1 if printf and friends should be labeled with attribute "__gnu_printf__" instead of "__printf__" */ #undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module reallocarray shall be considered present. */ #undef GNULIB_REALLOCARRAY /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module scanf shall be considered present. */ #undef GNULIB_SCANF /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module snprintf shall be considered present. */ #undef GNULIB_SNPRINTF /* Define to 1 if you want the FILE stream functions getc, putc, etc. to use unlocked I/O if available, throughout the package. Unlocked I/O can improve performance, sometimes dramatically. But unlocked I/O is safe only in single-threaded programs, as well as in multithreaded programs for which you can guarantee that every FILE stream, including stdin, stdout, stderr, is used only in a single thread. */ #undef GNULIB_STDIO_SINGLE_THREAD /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module strerror shall be considered present. */ #undef GNULIB_STRERROR /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module strerror_r-posix shall be considered present. */ #define GNULIB_STRERROR_R_POSIX 0 /* Define to 1 when the gnulib module accept should be tested. */ #undef GNULIB_TEST_ACCEPT /* Define to 1 when the gnulib module bind should be tested. */ #undef GNULIB_TEST_BIND /* Define to 1 when the gnulib module btowc should be tested. */ #undef GNULIB_TEST_BTOWC /* Define to 1 when the gnulib module calloc-posix should be tested. */ #undef GNULIB_TEST_CALLOC_POSIX /* Define to 1 when the gnulib module chdir should be tested. */ #undef GNULIB_TEST_CHDIR /* Define to 1 when the gnulib module cloexec should be tested. */ #undef GNULIB_TEST_CLOEXEC /* Define to 1 when the gnulib module close should be tested. */ #undef GNULIB_TEST_CLOSE /* Define to 1 when the gnulib module closedir should be tested. */ #undef GNULIB_TEST_CLOSEDIR /* Define to 1 when the gnulib module connect should be tested. */ #undef GNULIB_TEST_CONNECT /* Define to 1 when the gnulib module dirfd should be tested. */ #undef GNULIB_TEST_DIRFD /* Define to 1 when the gnulib module dup should be tested. */ #undef GNULIB_TEST_DUP /* Define to 1 when the gnulib module dup2 should be tested. */ #undef GNULIB_TEST_DUP2 /* Define to 1 when the gnulib module environ should be tested. */ #undef GNULIB_TEST_ENVIRON /* Define to 1 when the gnulib module fchdir should be tested. */ #undef GNULIB_TEST_FCHDIR /* Define to 1 when the gnulib module fcntl should be tested. */ #undef GNULIB_TEST_FCNTL /* Define to 1 when the gnulib module fdopen should be tested. */ #undef GNULIB_TEST_FDOPEN /* Define to 1 when the gnulib module fdopendir should be tested. */ #undef GNULIB_TEST_FDOPENDIR /* Define to 1 when the gnulib module fgetc should be tested. */ #undef GNULIB_TEST_FGETC /* Define to 1 when the gnulib module fgets should be tested. */ #undef GNULIB_TEST_FGETS /* Define to 1 when the gnulib module fnmatch should be tested. */ #undef GNULIB_TEST_FNMATCH /* Define to 1 when the gnulib module fopen should be tested. */ #undef GNULIB_TEST_FOPEN /* Define to 1 when the gnulib module fprintf should be tested. */ #undef GNULIB_TEST_FPRINTF /* Define to 1 when the gnulib module fputc should be tested. */ #undef GNULIB_TEST_FPUTC /* Define to 1 when the gnulib module fputs should be tested. */ #undef GNULIB_TEST_FPUTS /* Define to 1 when the gnulib module fread should be tested. */ #undef GNULIB_TEST_FREAD /* Define to 1 when the gnulib module free-posix should be tested. */ #undef GNULIB_TEST_FREE_POSIX /* Define to 1 when the gnulib module fscanf should be tested. */ #undef GNULIB_TEST_FSCANF /* Define to 1 when the gnulib module fstat should be tested. */ #undef GNULIB_TEST_FSTAT /* Define to 1 when the gnulib module fstatat should be tested. */ #undef GNULIB_TEST_FSTATAT /* Define to 1 when the gnulib module ftruncate should be tested. */ #undef GNULIB_TEST_FTRUNCATE /* Define to 1 when the gnulib module fwrite should be tested. */ #undef GNULIB_TEST_FWRITE /* Define to 1 when the gnulib module getc should be tested. */ #undef GNULIB_TEST_GETC /* Define to 1 when the gnulib module getchar should be tested. */ #undef GNULIB_TEST_GETCHAR /* Define to 1 when the gnulib module getcwd should be tested. */ #undef GNULIB_TEST_GETCWD /* Define to 1 when the gnulib module getdtablesize should be tested. */ #undef GNULIB_TEST_GETDTABLESIZE /* Define to 1 when the gnulib module getopt-posix should be tested. */ #undef GNULIB_TEST_GETOPT_POSIX /* Define to 1 when the gnulib module getpagesize should be tested. */ #undef GNULIB_TEST_GETPAGESIZE /* Define to 1 when the gnulib module gettimeofday should be tested. */ #undef GNULIB_TEST_GETTIMEOFDAY /* Define to 1 when the gnulib module ioctl should be tested. */ #undef GNULIB_TEST_IOCTL /* Define to 1 when the gnulib module isatty should be tested. */ #undef GNULIB_TEST_ISATTY /* Define to 1 when the gnulib module iswblank should be tested. */ #undef GNULIB_TEST_ISWBLANK /* Define to 1 when the gnulib module iswctype should be tested. */ #undef GNULIB_TEST_ISWCTYPE /* Define to 1 when the gnulib module iswdigit should be tested. */ #undef GNULIB_TEST_ISWDIGIT /* Define to 1 when the gnulib module iswxdigit should be tested. */ #undef GNULIB_TEST_ISWXDIGIT /* Define to 1 when the gnulib module listen should be tested. */ #undef GNULIB_TEST_LISTEN /* Define to 1 when the gnulib module localeconv should be tested. */ #undef GNULIB_TEST_LOCALECONV /* Define to 1 when the gnulib module localename should be tested. */ #undef GNULIB_TEST_LOCALENAME /* Define to 1 when the gnulib module lseek should be tested. */ #undef GNULIB_TEST_LSEEK /* Define to 1 when the gnulib module lstat should be tested. */ #undef GNULIB_TEST_LSTAT /* Define to 1 when the gnulib module malloc-posix should be tested. */ #undef GNULIB_TEST_MALLOC_POSIX /* Define to 1 when the gnulib module mbrlen should be tested. */ #undef GNULIB_TEST_MBRLEN /* Define to 1 when the gnulib module mbrtowc should be tested. */ #undef GNULIB_TEST_MBRTOWC /* Define to 1 when the gnulib module mbscasecmp should be tested. */ #undef GNULIB_TEST_MBSCASECMP /* Define to 1 when the gnulib module mbsinit should be tested. */ #undef GNULIB_TEST_MBSINIT /* Define to 1 when the gnulib module mbslen should be tested. */ #undef GNULIB_TEST_MBSLEN /* Define to 1 when the gnulib module mbsrtowcs should be tested. */ #undef GNULIB_TEST_MBSRTOWCS /* Define to 1 when the gnulib module mbsstr should be tested. */ #undef GNULIB_TEST_MBSSTR /* Define to 1 when the gnulib module mbtowc should be tested. */ #undef GNULIB_TEST_MBTOWC /* Define to 1 when the gnulib module memchr should be tested. */ #undef GNULIB_TEST_MEMCHR /* Define to 1 when the gnulib module mempcpy should be tested. */ #undef GNULIB_TEST_MEMPCPY /* Define to 1 when the gnulib module memrchr should be tested. */ #undef GNULIB_TEST_MEMRCHR /* Define to 1 when the gnulib module nanosleep should be tested. */ #undef GNULIB_TEST_NANOSLEEP /* Define to 1 when the gnulib module nl_langinfo should be tested. */ #undef GNULIB_TEST_NL_LANGINFO /* Define to 1 when the gnulib module open should be tested. */ #undef GNULIB_TEST_OPEN /* Define to 1 when the gnulib module openat should be tested. */ #undef GNULIB_TEST_OPENAT /* Define to 1 when the gnulib module opendir should be tested. */ #undef GNULIB_TEST_OPENDIR /* Define to 1 when the gnulib module perror should be tested. */ #undef GNULIB_TEST_PERROR /* Define to 1 when the gnulib module pipe should be tested. */ #undef GNULIB_TEST_PIPE /* Define to 1 when the gnulib module printf should be tested. */ #undef GNULIB_TEST_PRINTF /* Define to 1 when the gnulib module pthread_sigmask should be tested. */ #undef GNULIB_TEST_PTHREAD_SIGMASK /* Define to 1 when the gnulib module pthread-thread should be tested. */ #undef GNULIB_TEST_PTHREAD_THREAD /* Define to 1 when the gnulib module putc should be tested. */ #undef GNULIB_TEST_PUTC /* Define to 1 when the gnulib module putchar should be tested. */ #undef GNULIB_TEST_PUTCHAR /* Define to 1 when the gnulib module putenv should be tested. */ #undef GNULIB_TEST_PUTENV /* Define to 1 when the gnulib module puts should be tested. */ #undef GNULIB_TEST_PUTS /* Define to 1 when the gnulib module raise should be tested. */ #undef GNULIB_TEST_RAISE /* Define to 1 when the gnulib module rawmemchr should be tested. */ #undef GNULIB_TEST_RAWMEMCHR /* Define to 1 when the gnulib module read should be tested. */ #undef GNULIB_TEST_READ /* Define to 1 when the gnulib module readdir should be tested. */ #undef GNULIB_TEST_READDIR /* Define to 1 when the gnulib module reallocarray should be tested. */ #undef GNULIB_TEST_REALLOCARRAY /* Define to 1 when the gnulib module realloc-posix should be tested. */ #undef GNULIB_TEST_REALLOC_POSIX /* Define to 1 when the gnulib module scanf should be tested. */ #undef GNULIB_TEST_SCANF /* Define to 1 when the gnulib module select should be tested. */ #undef GNULIB_TEST_SELECT /* Define to 1 when the gnulib module setenv should be tested. */ #undef GNULIB_TEST_SETENV /* Define to 1 when the gnulib module setlocale should be tested. */ #undef GNULIB_TEST_SETLOCALE /* Define to 1 when the gnulib module setlocale_null should be tested. */ #undef GNULIB_TEST_SETLOCALE_NULL /* Define to 1 when the gnulib module setsockopt should be tested. */ #undef GNULIB_TEST_SETSOCKOPT /* Define to 1 when the gnulib module sigaction should be tested. */ #undef GNULIB_TEST_SIGACTION /* Define to 1 when the gnulib module sigprocmask should be tested. */ #undef GNULIB_TEST_SIGPROCMASK /* Define to 1 when the gnulib module sleep should be tested. */ #undef GNULIB_TEST_SLEEP /* Define to 1 when the gnulib module snprintf should be tested. */ #undef GNULIB_TEST_SNPRINTF /* Define to 1 when the gnulib module socket should be tested. */ #undef GNULIB_TEST_SOCKET /* Define to 1 when the gnulib module stat should be tested. */ #undef GNULIB_TEST_STAT /* Define to 1 when the gnulib module stpcpy should be tested. */ #undef GNULIB_TEST_STPCPY /* Define to 1 when the gnulib module strdup should be tested. */ #undef GNULIB_TEST_STRDUP /* Define to 1 when the gnulib module strerror should be tested. */ #undef GNULIB_TEST_STRERROR /* Define to 1 when the gnulib module strerror_r should be tested. */ #undef GNULIB_TEST_STRERROR_R /* Define to 1 when the gnulib module strnlen should be tested. */ #undef GNULIB_TEST_STRNLEN /* Define to 1 when the gnulib module strstr should be tested. */ #undef GNULIB_TEST_STRSTR /* Define to 1 when the gnulib module strtoll should be tested. */ #undef GNULIB_TEST_STRTOLL /* Define to 1 when the gnulib module strtoull should be tested. */ #undef GNULIB_TEST_STRTOULL /* Define to 1 when the gnulib module symlink should be tested. */ #undef GNULIB_TEST_SYMLINK /* Define to 1 when the gnulib module unsetenv should be tested. */ #undef GNULIB_TEST_UNSETENV /* Define to 1 when the gnulib module vfprintf should be tested. */ #undef GNULIB_TEST_VFPRINTF /* Define to 1 when the gnulib module vprintf should be tested. */ #undef GNULIB_TEST_VPRINTF /* Define to 1 when the gnulib module wcrtomb should be tested. */ #undef GNULIB_TEST_WCRTOMB /* Define to 1 when the gnulib module wctob should be tested. */ #undef GNULIB_TEST_WCTOB /* Define to 1 when the gnulib module wctomb should be tested. */ #undef GNULIB_TEST_WCTOMB /* Define to 1 when the gnulib module wcwidth should be tested. */ #undef GNULIB_TEST_WCWIDTH /* Define to 1 when the gnulib module wmemchr should be tested. */ #undef GNULIB_TEST_WMEMCHR /* Define to 1 when the gnulib module wmempcpy should be tested. */ #undef GNULIB_TEST_WMEMPCPY /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module unistr/u8-mbtoucr shall be considered present. */ #undef GNULIB_UNISTR_U8_MBTOUCR /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module unistr/u8-uctomb shall be considered present. */ #undef GNULIB_UNISTR_U8_UCTOMB /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module xalloc shall be considered present. */ #define GNULIB_XALLOC 1 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module xalloc-die shall be considered present. */ #define GNULIB_XALLOC_DIE 1 /* We are building grep */ #define GREP /* Define to 1 if you have 'alloca' after including <alloca.h>, a header that may be supplied by this distribution. */ #undef HAVE_ALLOCA /* Define to 1 if <alloca.h> works. */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the <arpa/inet.h> header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the <bp-sym.h> header file. */ #undef HAVE_BP_SYM_H /* Define to 1 if you have the `btowc' function. */ #undef HAVE_BTOWC /* Define to 1 if nanosleep mishandles large arguments. */ #undef HAVE_BUG_BIG_NANOSLEEP /* Define to 1 if you have the `catgets' function. */ #undef HAVE_CATGETS /* Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework. */ #undef HAVE_CFPREFERENCESCOPYAPPVALUE /* Define to 1 if you have the `closedir' function. */ #define HAVE_CLOSEDIR 1 /* Define to 1 if you have the <crtdefs.h> header file. */ #undef HAVE_CRTDEFS_H /* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT /* Define to 1 if you have the declaration of `alarm', and to 0 if you don't. */ #undef HAVE_DECL_ALARM /* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_CLEARERR_UNLOCKED /* Define to 1 if you have the declaration of `dirfd', and to 0 if you don't. */ #undef HAVE_DECL_DIRFD /* Define to 1 if you have the declaration of `ecvt', and to 0 if you don't. */ #undef HAVE_DECL_ECVT /* Define to 1 if you have the declaration of `execvpe', and to 0 if you don't. */ #undef HAVE_DECL_EXECVPE /* Define to 1 if you have the declaration of `fchdir', and to 0 if you don't. */ #define HAVE_DECL_FCHDIR 0 /* Define to 1 if you have the declaration of `fcloseall', and to 0 if you don't. */ #undef HAVE_DECL_FCLOSEALL /* Define to 1 if you have the declaration of `fcvt', and to 0 if you don't. */ #undef HAVE_DECL_FCVT /* Define to 1 if you have the declaration of `fdopendir', and to 0 if you don't. */ #undef HAVE_DECL_FDOPENDIR /* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FEOF_UNLOCKED /* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FERROR_UNLOCKED /* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FFLUSH_UNLOCKED /* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FGETS_UNLOCKED /* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FPUTC_UNLOCKED /* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FPUTS_UNLOCKED /* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FREAD_UNLOCKED /* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FWRITE_UNLOCKED /* Define to 1 if you have the declaration of `gcvt', and to 0 if you don't. */ #undef HAVE_DECL_GCVT /* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if you don't. */ #define HAVE_DECL_GETCHAR_UNLOCKED 0 /* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you don't. */ #define HAVE_DECL_GETC_UNLOCKED 0 /* Define to 1 if you have the declaration of `getdtablesize', and to 0 if you don't. */ #undef HAVE_DECL_GETDTABLESIZE /* Define to 1 if you have the declaration of `inet_pton', and to 0 if you don't. */ #undef HAVE_DECL_INET_PTON /* Define to 1 if you have the declaration of `isblank', and to 0 if you don't. */ #define HAVE_DECL_ISBLANK 0 /* Define to 1 if you have the declaration of `iswblank', and to 0 if you don't. */ #define HAVE_DECL_ISWBLANK 1 /* Define to 1 if you have the declaration of `mbrlen', and to 0 if you don't. */ #define HAVE_DECL_MBRLEN 1 /* Define to 1 if you have the declaration of `mbrtowc', and to 0 if you don't. */ #define HAVE_DECL_MBRTOWC 1 /* Define to 1 if you have the declaration of `mbsinit', and to 0 if you don't. */ #define HAVE_DECL_MBSINIT 0 /* Define to 1 if you have the declaration of `mbsrtowcs', and to 0 if you don't. */ #define HAVE_DECL_MBSRTOWCS 0 /* Define to 1 if you have the declaration of `memrchr', and to 0 if you don't. */ #define HAVE_DECL_MEMRCHR 0 /* Define to 1 if you have the declaration of `program_invocation_name', and to 0 if you don't. */ #define HAVE_DECL_PROGRAM_INVOCATION_NAME 0 /* Define to 1 if you have the declaration of `program_invocation_short_name', and to 0 if you don't. */ #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 0 /* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if you don't. */ #define HAVE_DECL_PUTCHAR_UNLOCKED 0 /* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you don't. */ #define HAVE_DECL_PUTC_UNLOCKED 0 /* Define to 1 if you have the declaration of `setenv', and to 0 if you don't. */ #define HAVE_DECL_SETENV 0 /* Define to 1 if you have the declaration of `sleep', and to 0 if you don't. */ #define HAVE_DECL_SLEEP 0 /* Define to 1 if you have the declaration of `snprintf', and to 0 if you don't. */ #define HAVE_DECL_SNPRINTF 1 /* Define to 1 if you have the declaration of `strdup', and to 0 if you don't. */ #define HAVE_DECL_STRDUP 1 /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #define HAVE_DECL_STRERROR_R 1 /* Define to 1 if you have the declaration of `strnlen', and to 0 if you don't. */ #define HAVE_DECL_STRNLEN 1 /* Define to 1 if you have the declaration of `strtoimax', and to 0 if you don't. */ #define HAVE_DECL_STRTOIMAX 1 /* Define to 1 if you have the declaration of `strtoll', and to 0 if you don't. */ #define HAVE_DECL_STRTOLL 1 /* Define to 1 if you have the declaration of `strtoull', and to 0 if you don't. */ #define HAVE_DECL_STRTOULL 1 /* Define to 1 if you have the declaration of `strtoumax', and to 0 if you don't. */ #define HAVE_DECL_STRTOUMAX 1 /* Define to 1 if you have the declaration of `towlower', and to 0 if you don't. */ #define HAVE_DECL_TOWLOWER 1 /* Define to 1 if you have the declaration of `unsetenv', and to 0 if you don't. */ #define HAVE_DECL_UNSETENV 0 /* Define to 1 if you have the declaration of `wcrtomb', and to 0 if you don't. */ #define HAVE_DECL_WCRTOMB 0 /* Define to 1 if you have the declaration of `wcsdup', and to 0 if you don't. */ #define HAVE_DECL_WCSDUP 1 /* Define to 1 if you have the declaration of `wctob', and to 0 if you don't. */ #define HAVE_DECL_WCTOB 1 /* Define to 1 if you have the declaration of `wcwidth', and to 0 if you don't. */ #define HAVE_DECL_WCWIDTH 0 /* Define to 1 if you have the declaration of `_putenv', and to 0 if you don't. */ #define HAVE_DECL__PUTENV 1 /* Define to 1 if you have the declaration of `_snprintf', and to 0 if you don't. */ #undef HAVE_DECL__SNPRINTF /* Define to 1 if you have the declaration of `__argv', and to 0 if you don't. */ #define HAVE_DECL___ARGV 1 /* Define to 1 if you have the declaration of `__fpending', and to 0 if you don't. */ #define HAVE_DECL___FPENDING 0 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the `dirfd' function. */ #undef HAVE_DIRFD /* Define to 1 if you have the `duplocale' function. */ #undef HAVE_DUPLOCALE /* Define if you have the declaration of environ. */ #undef HAVE_ENVIRON_DECL /* Define if the locale_t type contains insufficient information, as on OpenBSD. */ #undef HAVE_FAKE_LOCALES /* Define to 1 if you have the `fchdir' function. */ #undef HAVE_FCHDIR /* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL /* Define to 1 if you have the `fdopendir' function. */ #undef HAVE_FDOPENDIR /* Define to 1 if you have the <features.h> header file. */ #undef HAVE_FEATURES_H /* Define to 1 if you have the `fnmatch' function. */ #undef HAVE_FNMATCH /* Define to 1 if you have the <fnmatch.h> header file. */ #undef HAVE_FNMATCH_H /* Define to 1 if you have the `freelocale' function. */ #undef HAVE_FREELOCALE /* Define if the 'free' function is guaranteed to preserve errno. */ #undef HAVE_FREE_POSIX /* Define to 1 if you have the `fstatat' function. */ #undef HAVE_FSTATAT /* Define to 1 if you have the `fstatfs' function. */ #undef HAVE_FSTATFS /* Define to 1 if you have the `ftruncate' function. */ #undef HAVE_FTRUNCATE /* Define to 1 if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE /* Define to 1 if you have the `getexecname' function. */ #undef HAVE_GETEXECNAME /* Define to 1 if you have the `getlocalename_l' function. */ #undef HAVE_GETLOCALENAME_L /* Define to 1 if you have the <getopt.h> header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the `getopt_long_only' function. */ #undef HAVE_GETOPT_LONG_ONLY /* Define to 1 if you have the `getprogname' function. */ #define HAVE_GETPROGNAME 1 const char *getprogname(void); /* Define to 1 if you have the `getrlimit' function. */ #undef HAVE_GETRLIMIT /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define if the uselocale exists, may be safely called, and returns sufficient information. */ #undef HAVE_GOOD_USELOCALE /* Define if you have the iconv() function and it works. */ #undef HAVE_ICONV /* Define to 1 if you have the <iconv.h> header file. */ #undef HAVE_ICONV_H /* Define to 1 if you have the `inet_pton' function. */ #undef HAVE_INET_PTON /* Define to 1 if the compiler supports one of the keywords 'inline', '__inline__', '__inline' and effectively inlines functions marked as such. */ #undef HAVE_INLINE /* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */ #undef HAVE_INTMAX_T /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H /* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. */ #undef HAVE_INTTYPES_H_WITH_UINTMAX /* Define to 1 if you have the `ioctl' function. */ #undef HAVE_IOCTL /* Define to 1 if <sys/socket.h> defines AF_INET. */ #undef HAVE_IPV4 /* Define to 1 if <sys/socket.h> defines AF_INET6. */ #undef HAVE_IPV6 /* Define to 1 if you have the `isascii' function. */ #undef HAVE_ISASCII /* Define to 1 if you have the `isblank' function. */ #undef HAVE_ISBLANK /* Define to 1 if you have the `iswblank' function. */ #undef HAVE_ISWBLANK /* Define to 1 if you have the `iswcntrl' function. */ #undef HAVE_ISWCNTRL /* Define to 1 if you have the `iswctype' function. */ #undef HAVE_ISWCTYPE /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET /* Define to 1 if you have the <langinfo.h> header file. */ #undef HAVE_LANGINFO_H /* Define if your <locale.h> file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES /* Define to 1 if you have the <libintl.h> header file. */ #undef HAVE_LIBINTL_H /* Define to 1 if you have the Perl Compatible Regular Expressions library (-lpcre). */ #undef HAVE_LIBPCRE /* Define if you have the libsigsegv library. */ #undef HAVE_LIBSIGSEGV /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H /* Define to 1 if the system has the type 'long long int'. */ #undef HAVE_LONG_LONG_INT /* Define to 1 if you have the `lstat' function. */ #undef HAVE_LSTAT /* Define to 1 if you have the <malloc.h> header file. */ #undef HAVE_MALLOC_H /* Define if malloc, realloc, and calloc set errno on allocation failure. */ #undef HAVE_MALLOC_POSIX /* Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including config.h and <sys/mman.h>. */ #undef HAVE_MAP_ANONYMOUS /* Define to 1 if you have the `mbrlen' function. */ #undef HAVE_MBRLEN /* Define to 1 if you have the `mbrtowc' function. */ #undef HAVE_MBRTOWC /* Define to 1 if you have the `mbsinit' function. */ #undef HAVE_MBSINIT /* Define to 1 if you have the `mbslen' function. */ #undef HAVE_MBSLEN /* Define to 1 if you have the `mbsrtowcs' function. */ #undef HAVE_MBSRTOWCS /* Define to 1 if <wchar.h> declares mbstate_t. */ #undef HAVE_MBSTATE_T /* Define to 1 if you have the `mbtowc' function. */ #undef HAVE_MBTOWC /* Define to 1 if you have the `mempcpy' function. */ #define HAVE_MEMPCPY 1 #include <string.h> static _inline void *mempcpy(void *pvDst, const void *pvSrc, size_t cb) { return (char *)memcpy(pvDst, pvSrc, cb) + cb; } /* Define to 1 if you have the `memrchr' function. */ #undef HAVE_MEMRCHR void *memrchr(const void *, int, size_t); /* Define to 1 if you have the <minix/config.h> header file. */ #undef HAVE_MINIX_CONFIG_H /* Define to 1 if <limits.h> defines the MIN and MAX macros. */ #undef HAVE_MINMAX_IN_LIMITS_H /* Define to 1 if <sys/param.h> defines the MIN and MAX macros. */ #undef HAVE_MINMAX_IN_SYS_PARAM_H /* Define to 1 if you have the `mprotect' function. */ #undef HAVE_MPROTECT /* Define to 1 on MSVC platforms that have the "invalid parameter handler" concept. */ #undef HAVE_MSVC_INVALID_PARAMETER_HANDLER /* Define if the locale_t type does not contain the name of each locale category. */ #undef HAVE_NAMELESS_LOCALES /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the <netdb.h> header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the <netinet/in.h> header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the `newlocale' function. */ #undef HAVE_NEWLOCALE /* Define to 1 if you have the `nl_langinfo' function. */ #undef HAVE_NL_LANGINFO /* Define to 1 if the system has obstacks that work with any size object. */ #undef HAVE_OBSTACK /* Define to 1 if you have the `openat' function. */ #define HAVE_OPENAT 1 /* Define to 1 if you have the `opendir' function. */ #define HAVE_OPENDIR 1 /* Define to 1 if you have the <OS.h> header file. */ #undef HAVE_OS_H /* Define to 1 if you have the `pipe' function. */ #undef HAVE_PIPE /* Define if you have the <pthread.h> header and the POSIX threads API. */ #undef HAVE_PTHREAD_API /* Define to 1 if you have the `pthread_atfork' function. */ #undef HAVE_PTHREAD_ATFORK /* Define to 1 if you have the <pthread.h> header file. */ #undef HAVE_PTHREAD_H /* Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE. */ #undef HAVE_PTHREAD_MUTEX_RECURSIVE /* Define if the POSIX multithreading library has read/write locks. */ #undef HAVE_PTHREAD_RWLOCK /* Define if the 'pthread_rwlock_rdlock' function prefers a writer to a reader. */ #undef HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER /* Define to 1 if the pthread_sigmask function can be used (despite bugs). */ #undef HAVE_PTHREAD_SIGMASK /* Define to 1 if the system has the type `pthread_spinlock_t'. */ #undef HAVE_PTHREAD_SPINLOCK_T /* Define to 1 if the system has the type `pthread_t'. */ #undef HAVE_PTHREAD_T /* Define to 1 if you have the `raise' function. */ #undef HAVE_RAISE /* Define to 1 if you have the `rawmemchr' function. */ #define HAVE_RAWMEMCHR 1 #include <string.h> static _inline void *rawmemchr(const void *pv, int ch) { return memchr(pv, ch, ~(size_t)0 / 4); } /* Define to 1 if you have the `readdir' function. */ #define HAVE_READDIR 1 /* Define to 1 if you have the `reallocarray' function. */ #undef HAVE_REALLOCARRAY /* Define to 1 if the system has the type `sa_family_t'. */ #undef HAVE_SA_FAMILY_T /* Define to 1 if you have the <sched.h> header file. */ #undef HAVE_SCHED_H /* Define to 1 if you have the <sdkddkver.h> header file. */ #undef HAVE_SDKDDKVER_H /* Define to 1 if you have the <search.h> header file. */ #undef HAVE_SEARCH_H /* Define to 1 if you have the `setdtablesize' function. */ #undef HAVE_SETDTABLESIZE /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV /* Define to 1 if you have the `setlocale' function. */ #define HAVE_SETLOCALE 1 /* Define to 1 if you have the `setrlimit' function. */ #undef HAVE_SETRLIMIT /* Define to 1 if you have the `shutdown' function. */ #undef HAVE_SHUTDOWN /* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION /* Define to 1 if you have the `sigaltstack' function. */ #undef HAVE_SIGALTSTACK /* Define to 1 if the system has the type `siginfo_t'. */ #undef HAVE_SIGINFO_T /* Define to 1 if you have the `siginterrupt' function. */ #undef HAVE_SIGINTERRUPT /* Define to 1 if 'sig_atomic_t' is a signed integer type. */ #undef HAVE_SIGNED_SIG_ATOMIC_T /* Define to 1 if 'wchar_t' is a signed integer type. */ #undef HAVE_SIGNED_WCHAR_T /* Define to 1 if 'wint_t' is a signed integer type. */ #undef HAVE_SIGNED_WINT_T /* Define to 1 if the system has the type `sigset_t'. */ #undef HAVE_SIGSET_T /* Define to 1 if you have the `sleep' function. */ #undef HAVE_SLEEP /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define if the return value of the snprintf function is the number of of bytes (excluding the terminating NUL) that would have been produced if the buffer had been large enough. */ #undef HAVE_SNPRINTF_RETVAL_C99 /* Define if the string produced by the snprintf function is always NUL terminated. */ #undef HAVE_SNPRINTF_TRUNCATION_C99 /* Define if the locale_t type is as on Solaris 11.4. */ #undef HAVE_SOLARIS114_LOCALES /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H /* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. */ #undef HAVE_STDINT_H_WITH_UINTMAX /* Define to 1 if you have the <stdio_ext.h> header file. */ #undef HAVE_STDIO_EXT_H /* Define to 1 if you have the <stdio.h> header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `stpcpy' function. */ #undef HAVE_STPCPY /* Define to 1 if you have the `strerror_r' function. */ #define HAVE_STRERROR_R 1 #include <string.h> static _inline int strerror_r(int iErr, char *pszDst, size_t cbDst) { return strerror_s(pszDst, cbDst, iErr); } /* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strnlen' function. */ #undef HAVE_STRNLEN /* Define to 1 if you have the `strtoimax' function. */ #undef HAVE_STRTOIMAX /* Define to 1 if you have the `strtoll' function. */ #undef HAVE_STRTOLL /* Define to 1 if you have the `strtoull' function. */ #undef HAVE_STRTOULL /* Define to 1 if you have the `strtoumax' function. */ #undef HAVE_STRTOUMAX /* Define if there is a member named d_type in the struct describing directory headers. */ #undef HAVE_STRUCT_DIRENT_D_TYPE /* Define to 1 if `decimal_point' is a member of `struct lconv'. */ #undef HAVE_STRUCT_LCONV_DECIMAL_POINT /* Define to 1 if `sa_sigaction' is a member of `struct sigaction'. */ #undef HAVE_STRUCT_SIGACTION_SA_SIGACTION /* Define to 1 if the system has the type `struct sockaddr_storage'. */ #undef HAVE_STRUCT_SOCKADDR_STORAGE /* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */ #undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY /* Define to 1 if `f_type' is a member of `struct statfs'. */ #undef HAVE_STRUCT_STATFS_F_TYPE /* Define to 1 if `st_atimensec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIMENSEC /* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC /* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC /* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC /* Define to 1 if `st_birthtimensec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC /* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC /* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC /* Define to 1 if you have the `symlink' function. */ #undef HAVE_SYMLINK /* Define to 1 if you have the <sys/bitypes.h> header file. */ #undef HAVE_SYS_BITYPES_H /* Define to 1 if you have the <sys/cdefs.h> header file. */ #undef HAVE_SYS_CDEFS_H /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the <sys/inttypes.h> header file. */ #undef HAVE_SYS_INTTYPES_H /* Define to 1 if you have the <sys/ioctl.h> header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the <sys/mman.h> header file. */ #undef HAVE_SYS_MMAN_H /* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the <sys/param.h> header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the <sys/select.h> header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the <sys/single_threaded.h> header file. */ #undef HAVE_SYS_SINGLE_THREADED_H /* Define to 1 if you have the <sys/socket.h> header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the <sys/time.h> header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the <sys/types.h> header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the <sys/uio.h> header file. */ #undef HAVE_SYS_UIO_H /* Define to 1 if you have the <sys/vfs.h> header file. */ #undef HAVE_SYS_VFS_H /* Define to 1 if you have the <sys/wait.h> header file. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the `thrd_create' function. */ #undef HAVE_THRD_CREATE /* Define to 1 if you have the <threads.h> header file. */ #undef HAVE_THREADS_H /* Define to 1 if you have the `towlower' function. */ #undef HAVE_TOWLOWER /* Define to 1 if you have the `tsearch' function. */ #undef HAVE_TSEARCH /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `unsetenv' function. */ #undef HAVE_UNSETENV /* Define to 1 if the system has the type 'unsigned long long int'. */ #undef HAVE_UNSIGNED_LONG_LONG_INT /* Define to 1 if you have the `uselocale' function. */ #undef HAVE_USELOCALE /* Define if you have a global __progname variable */ #undef HAVE_VAR___PROGNAME /* Define to 1 if you have the `vasnprintf' function. */ #undef HAVE_VASNPRINTF /* Define to 1 or 0, depending whether the compiler supports simple visibility declarations. */ #undef HAVE_VISIBILITY /* Define to 1 if you have the <wchar.h> header file. */ #undef HAVE_WCHAR_H /* Define if you have the 'wchar_t' type. */ #undef HAVE_WCHAR_T /* Define to 1 if you have the `wcrtomb' function. */ #undef HAVE_WCRTOMB /* Define to 1 if you have the `wcslen' function. */ #undef HAVE_WCSLEN /* Define to 1 if you have the `wcsnlen' function. */ #undef HAVE_WCSNLEN /* Define to 1 if you have the `wctob' function. */ #undef HAVE_WCTOB /* Define to 1 if you have the <wctype.h> header file. */ #undef HAVE_WCTYPE_H /* Define to 1 if you have the `wcwidth' function. */ #undef HAVE_WCWIDTH /* Define to 1 if the compiler and linker support weak declarations of symbols. */ #undef HAVE_WEAK_SYMBOLS /* Define to 1 if you have the <winsock2.h> header file. */ #undef HAVE_WINSOCK2_H /* Define if you have the 'wint_t' type. */ #undef HAVE_WINT_T /* Define to 1 if you have the `wmempcpy' function. */ #undef HAVE_WMEMPCPY /* Define to 1 if fstatat (..., 0) works. For example, it does not work in AIX 7.1. */ #undef HAVE_WORKING_FSTATAT_ZERO_FLAG /* Define to 1 if O_NOATIME works. */ #undef HAVE_WORKING_O_NOATIME /* Define to 1 if O_NOFOLLOW works. */ #undef HAVE_WORKING_O_NOFOLLOW /* Define if you have the sigaltstack() function and it works. */ #undef HAVE_WORKING_SIGALTSTACK /* Define if the uselocale function exists and may safely be called. */ #undef HAVE_WORKING_USELOCALE /* Define to 1 if you have the <ws2tcpip.h> header file. */ #undef HAVE_WS2TCPIP_H /* Define to 1 if you have the <xlocale.h> header file. */ #undef HAVE_XLOCALE_H /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Define to 1 if you have the `_chsize' function. */ #undef HAVE__CHSIZE /* Define to 1 if you have the `_set_invalid_parameter_handler' function. */ #undef HAVE__SET_INVALID_PARAMETER_HANDLER /* Define to 1 if the compiler supports __builtin_expect, and to 2 if <builtins.h> does. */ #undef HAVE___BUILTIN_EXPECT #ifndef HAVE___BUILTIN_EXPECT # define __builtin_expect(e, c) (e) #elif HAVE___BUILTIN_EXPECT == 2 # include <builtins.h> #endif /* Define to 1 if the system has the type `__fsword_t'. */ #undef HAVE___FSWORD_T /* Define to 1 if the compiler supports the keyword '__inline'. */ #undef HAVE___INLINE /* Define to 1 if you have the `__xpg_strerror_r' function. */ #undef HAVE___XPG_STRERROR_R /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST /* Define to a symbolic name denoting the flavor of iconv_open() implementation. */ #undef ICONV_FLAVOR /* Define if localename.c overrides newlocale(), duplocale(), freelocale(). */ #undef LOCALENAME_ENHANCE_LOCALE_FUNCS /* Define to 1 if lseek does not detect pipes. */ #undef LSEEK_PIPE_BROKEN /* Define to 1 if 'lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */ #undef MALLOC_0_IS_NONNULL /* Define to a substitute value for mmap()'s MAP_ANONYMOUS flag. */ #undef MAP_ANONYMOUS /* Define if the mbrtowc function does not return (size_t) -2 for empty input. */ #undef MBRTOWC_EMPTY_INPUT_BUG /* Define if the mbrtowc function may signal encoding errors in the C locale. */ #undef MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ /* Define if the mbrtowc function has the NULL pwc argument bug. */ #undef MBRTOWC_NULL_ARG1_BUG /* Define if the mbrtowc function has the NULL string argument bug. */ #undef MBRTOWC_NULL_ARG2_BUG /* Define if the mbrtowc function does not return 0 for a NUL character. */ #undef MBRTOWC_NUL_RETVAL_BUG /* Define if the mbrtowc function returns a wrong return value. */ #undef MBRTOWC_RETVAL_BUG /* Define if the mbrtowc function stores a wide character when reporting incomplete input. */ #undef MBRTOWC_STORES_INCOMPLETE_BUG /* Use GNU style printf and scanf. */ #ifndef __USE_MINGW_ANSI_STDIO # undef __USE_MINGW_ANSI_STDIO #endif /* Define to 1 on musl libc. */ #undef MUSL_LIBC /* Define to 1 if assertions should be disabled. */ #undef NDEBUG /* Define to 1 to enable general improvements of setlocale. */ #undef NEED_SETLOCALE_IMPROVED /* Define to 1 to enable a multithread-safety fix of setlocale. */ #undef NEED_SETLOCALE_MTSAFE /* Define to 1 if nl_langinfo is multithread-safe. */ #undef NL_LANGINFO_MTSAFE /* Define to 1 if open() fails to recognize a trailing slash. */ #undef OPEN_TRAILING_SLASH_BUG /* Name of package */ #define PACKAGE "kmk_grep" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "bird-kbuild-spam-ixx@anduin.net" /* Define to the full name of this package. */ #define PACKAGE_NAME "kmk_grep" /* String identifying the packager of this software */ #undef PACKAGE_PACKAGER /* Packager info for bug reports (URL/e-mail/...) */ #undef PACKAGE_PACKAGER_BUG_REPORTS /* Packager-specific version information */ #undef PACKAGE_PACKAGER_VERSION /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #define PACKAGE_VERSION "3.7" /* Define to the type that is the result of default argument promotions of type mode_t. */ #define PROMOTED_MODE_T uintptr_t /* Define if pthread_create is an inline function. */ #undef PTHREAD_CREATE_IS_INLINE /* Define if the pthread_in_use() detection is hard. */ #undef PTHREAD_IN_USE_DETECTION_HARD /* Define to 1 if pthread_sigmask(), when it fails, returns -1 and sets errno. */ #undef PTHREAD_SIGMASK_FAILS_WITH_ERRNO /* Define to 1 if pthread_sigmask may return 0 and have no effect. */ #undef PTHREAD_SIGMASK_INEFFECTIVE /* Define to 1 if pthread_sigmask() unblocks signals incorrectly. */ #undef PTHREAD_SIGMASK_UNBLOCK_BUG /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'ptrdiff_t'. */ #undef PTRDIFF_T_SUFFIX /* Define to 1 if gnulib's dirfd() replacement is used. */ #undef REPLACE_DIRFD /* Define to 1 if gnulib's fchdir() replacement is used. */ #define REPLACE_FCHDIR 1 /* Define to 1 if stat needs help when passed a file name with a trailing slash */ #undef REPLACE_FUNC_STAT_FILE /* Define if nl_langinfo exists but is overridden by gnulib. */ #undef REPLACE_NL_LANGINFO /* Define to 1 if open() should work around the inability to open a directory. */ #undef REPLACE_OPEN_DIRECTORY /* Define to 1 if strerror(0) does not return a message implying success. */ #undef REPLACE_STRERROR_0 /* Define if vasnprintf exists but is overridden by gnulib. */ #undef REPLACE_VASNPRINTF /* Define to 1 if setlocale (LC_ALL, NULL) is multithread-safe. */ #undef SETLOCALE_NULL_ALL_MTSAFE /* Define to 1 if setlocale (category, NULL) is multithread-safe. */ #undef SETLOCALE_NULL_ONE_MTSAFE /* Define if sigaltstack() interprets the stack_t.ss_sp field incorrectly, as the highest address of the alternate stack range rather than as the lowest address. */ #undef SIGALTSTACK_SS_REVERSED /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'sig_atomic_t'. */ #undef SIG_ATOMIC_T_SUFFIX /* Define as the maximum value of type 'size_t', if the system doesn't define it. */ #ifndef SIZE_MAX # undef SIZE_MAX #endif /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'size_t'. */ #undef SIZE_T_SUFFIX /* Define on Solaris 11 and its derivates. */ #undef SOLARIS11 /* Define as the direction of stack growth for your system. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => spaghetti stack. */ #undef STACK_DIRECTION /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ #undef STAT_MACROS_BROKEN /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define to 1 if strerror_r returns char *. */ #undef STRERROR_R_CHAR_P /* Define to 1 if the type of the st_atim member of a struct stat is struct timespec. */ #undef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC /* Define if the combination of the ISO C and POSIX multithreading APIs can be used. */ #undef USE_ISOC_AND_POSIX_THREADS /* Define if the ISO C multithreading library can be used. */ #undef USE_ISOC_THREADS /* Define if the POSIX multithreading library can be used. */ #undef USE_POSIX_THREADS /* Define if references to the POSIX multithreading library are satisfied by libc. */ #undef USE_POSIX_THREADS_FROM_LIBC /* Define if references to the POSIX multithreading library should be made weak. */ #undef USE_POSIX_THREADS_WEAK /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable general extensions on macOS. */ #ifndef _DARWIN_C_SOURCE # undef _DARWIN_C_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif /* Enable X/Open compliant socket functions that do not require linking with -lxnet on HP-UX 11.11. */ #ifndef _HPUX_ALT_XOPEN_SOCKET_API # undef _HPUX_ALT_XOPEN_SOCKET_API #endif /* Identify the host operating system as Minix. This macro does not affect the system headers' behavior. A future release of Autoconf may stop defining this macro. */ #ifndef _MINIX # undef _MINIX #endif /* Enable general extensions on NetBSD. Enable NetBSD compatibility extensions on Minix. */ #ifndef _NETBSD_SOURCE # undef _NETBSD_SOURCE #endif /* Enable OpenBSD compatibility extensions on NetBSD. Oddly enough, this does nothing on OpenBSD. */ #ifndef _OPENBSD_SOURCE # undef _OPENBSD_SOURCE #endif /* Define to 1 if needed for POSIX-compatible behavior. */ #ifndef _POSIX_SOURCE # undef _POSIX_SOURCE #endif /* Define to 2 if needed for POSIX-compatible behavior. */ #ifndef _POSIX_1_SOURCE # undef _POSIX_1_SOURCE #endif /* Enable POSIX-compatible threading on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ #ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ # undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ # undef __STDC_WANT_IEC_60559_BFP_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ #ifndef __STDC_WANT_IEC_60559_DFP_EXT__ # undef __STDC_WANT_IEC_60559_DFP_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ #ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ # undef __STDC_WANT_IEC_60559_FUNCS_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ # undef __STDC_WANT_IEC_60559_TYPES_EXT__ #endif /* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ #ifndef __STDC_WANT_LIB_EXT2__ # undef __STDC_WANT_LIB_EXT2__ #endif /* Enable extensions specified by ISO/IEC 24747:2009. */ #ifndef __STDC_WANT_MATH_SPEC_FUNCS__ # undef __STDC_WANT_MATH_SPEC_FUNCS__ #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable X/Open extensions. Define to 500 only if necessary to make mbstate_t available. */ #ifndef _XOPEN_SOURCE # undef _XOPEN_SOURCE #endif /* An alias of GNULIB_STDIO_SINGLE_THREAD. */ #undef USE_UNLOCKED_IO /* Define if the native Windows multithreading API can be used. */ #undef USE_WINDOWS_THREADS /* Version number of package */ #define VERSION PACKAGE_VERSION /* Define to 1 if unsetenv returns void instead of int. */ #undef VOID_UNSETENV /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'wchar_t'. */ #undef WCHAR_T_SUFFIX /* Define if the wcrtomb function does not work in the C locale. */ #undef WCRTOMB_C_LOCALE_BUG /* Define if the wcrtomb function has an incorrect return value. */ #undef WCRTOMB_RETVAL_BUG /* Define if WSAStartup is needed. */ #undef WINDOWS_SOCKETS /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'wint_t'. */ #undef WINT_T_SUFFIX /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* True if the compiler says it groks GNU C version MAJOR.MINOR. */ #if defined __GNUC__ && defined __GNUC_MINOR__ # define _GL_GNUC_PREREQ(major, minor) \ ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) #else # define _GL_GNUC_PREREQ(major, minor) 0 #endif /* Define to enable the declarations of ISO C 11 types and functions. */ #undef _ISOC11_SOURCE /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to 1 on Solaris. */ #undef _LCONV_C99 /* The _Noreturn keyword of C11. */ #ifndef _Noreturn # if (defined __cplusplus \ && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ || (defined _MSC_VER && 1900 <= _MSC_VER)) \ && 0) /* [[noreturn]] is not practically usable, because with it the syntax extern _Noreturn void func (...); would not be valid; such a declaration would only be valid with 'extern' and '_Noreturn' swapped, or without the 'extern' keyword. However, some AIX system header files and several gnulib header files use precisely this syntax with 'extern'. */ # define _Noreturn [[noreturn]] # elif ((!defined __cplusplus || defined __clang__) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ || (!defined __STRICT_ANSI__ \ && (_GL_GNUC_PREREQ (4, 7) \ || (defined __apple_build_version__ \ ? 6000000 <= __apple_build_version__ \ : 3 < __clang_major__ + (5 <= __clang_minor__)))))) /* _Noreturn works as-is. */ # elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) # else # define _Noreturn # endif #endif /* Define to 1 in order to get the POSIX compatible declarations of socket functions. */ #undef _POSIX_PII_SOCKET /* Define if you want <regex.h> to include <limits.h>, so that it consistently overrides <limits.h>'s RE_DUP_MAX. */ #undef _REGEX_INCLUDE_LIMITS_H /* Define if you want regoff_t to be at least as wide POSIX requires. */ #undef _REGEX_LARGE_OFFSETS /* Number of bits in a timestamp, on hosts where this is settable. */ #undef _TIME_BITS /* For standard stat data types on VMS. */ #undef _USE_STD_STAT /* Define to rpl_ if the getopt replacement functions and variables should be used. */ #undef __GETOPT_PREFIX /* For 64-bit time_t on 32-bit mingw. */ #undef __MINGW_USE_VC2005_COMPAT /* Define to 1 if the system <stdint.h> predates C++11. */ #undef __STDC_CONSTANT_MACROS /* Define to 1 if the system <stdint.h> predates C++11. */ #undef __STDC_LIMIT_MACROS /* The _GL_ASYNC_SAFE marker should be attached to functions that are signal handlers (for signals other than SIGABRT, SIGPIPE) or can be invoked from such signal handlers. Such functions have some restrictions: * All functions that it calls should be marked _GL_ASYNC_SAFE as well, or should be listed as async-signal-safe in POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04> section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in particular, are NOT async-signal-safe. * All memory locations (variables and struct fields) that these functions access must be marked 'volatile'. This holds for both read and write accesses. Otherwise the compiler might optimize away stores to and reads from such locations that occur in the program, depending on its data flow analysis. For example, when the program contains a loop that is intended to inspect a variable set from within a signal handler while (!signal_occurred) ; the compiler is allowed to transform this into an endless loop if the variable 'signal_occurred' is not declared 'volatile'. Additionally, recall that: * A signal handler should not modify errno (except if it is a handler for a fatal signal and ends by raising the same signal again, thus provoking the termination of the process). If it invokes a function that may clobber errno, it needs to save and restore the value of errno. */ #define _GL_ASYNC_SAFE /* Attributes. */ #if (defined __has_attribute \ && (!defined __clang_minor__ \ || 3 < __clang_major__ + (5 <= __clang_minor__))) # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) #else # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr # define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) # define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) # define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) # define _GL_ATTR_diagnose_if 0 # define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) # define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) # define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) # define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) # ifdef _ICC # define _GL_ATTR_may_alias 0 # else # define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) # endif # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) # define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) # define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) # define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) #endif #ifdef __has_c_attribute # define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__) #else # define _GL_HAS_C_ATTRIBUTE(attr) 0 #endif #if _GL_HAS_ATTRIBUTE (alloc_size) # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) #else # define _GL_ATTRIBUTE_ALLOC_SIZE(args) #endif #if _GL_HAS_ATTRIBUTE (always_inline) # define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) #else # define _GL_ATTRIBUTE_ALWAYS_INLINE #endif #if _GL_HAS_ATTRIBUTE (artificial) # define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) #else # define _GL_ATTRIBUTE_ARTIFICIAL #endif /* Avoid __attribute__ ((cold)) on MinGW; see thread starting at <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ #if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ # ifndef __SUNPRO_C # define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) # else # define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) # endif #else # define _GL_ATTRIBUTE_COLD #endif #if _GL_HAS_ATTRIBUTE (const) # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) #else # define _GL_ATTRIBUTE_CONST #endif /* _GL_ATTRIBUTE_DEALLOC (F, I) is for functions returning pointers that can be freed by passing them as the Ith argument to the function F. _GL_ATTRIBUTE_DEALLOC_FREE is for functions that return pointers that can be freed via 'free'; it can be used only after including stdlib.h. These macros cannot be used on inline functions. */ #if _GL_GNUC_PREREQ (11, 0) # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) #else # define _GL_ATTRIBUTE_DEALLOC(f, i) #endif #define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) #if _GL_HAS_C_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] #elif _GL_HAS_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) #else # define _GL_ATTRIBUTE_DEPRECATED #endif #if _GL_HAS_ATTRIBUTE (error) # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) #elif _GL_HAS_ATTRIBUTE (diagnose_if) # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error"))) # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning"))) #else # define _GL_ATTRIBUTE_ERROR(msg) # define _GL_ATTRIBUTE_WARNING(msg) #endif #if _GL_HAS_ATTRIBUTE (externally_visible) # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) #else # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE #endif /* FALLTHROUGH is special, because it always expands to something. */ #if _GL_HAS_C_ATTRIBUTE (fallthrough) # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] #elif _GL_HAS_ATTRIBUTE (fallthrough) # define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) #else # define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) #endif #if _GL_HAS_ATTRIBUTE (format) # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) #else # define _GL_ATTRIBUTE_FORMAT(spec) #endif #if _GL_HAS_ATTRIBUTE (leaf) # define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) #else # define _GL_ATTRIBUTE_LEAF #endif #if _GL_HAS_ATTRIBUTE (malloc) # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) #else # define _GL_ATTRIBUTE_MALLOC #endif /* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ #if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C # define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) #else # define _GL_ATTRIBUTE_MAY_ALIAS #endif #if _GL_HAS_C_ATTRIBUTE (maybe_unused) # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] #else # define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED #endif /* Earlier spellings of this macro. */ #define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED #if _GL_HAS_C_ATTRIBUTE (nodiscard) # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] #elif _GL_HAS_ATTRIBUTE (warn_unused_result) # define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) #else # define _GL_ATTRIBUTE_NODISCARD #endif #if _GL_HAS_ATTRIBUTE (noinline) # define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) #else # define _GL_ATTRIBUTE_NOINLINE #endif #if _GL_HAS_ATTRIBUTE (nonnull) # define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) #else # define _GL_ATTRIBUTE_NONNULL(args) #endif #if _GL_HAS_ATTRIBUTE (nonstring) # define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) #else # define _GL_ATTRIBUTE_NONSTRING #endif /* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ #if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) #else # define _GL_ATTRIBUTE_NOTHROW #endif #if _GL_HAS_ATTRIBUTE (packed) # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) #else # define _GL_ATTRIBUTE_PACKED #endif #if _GL_HAS_ATTRIBUTE (pure) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) #else # define _GL_ATTRIBUTE_PURE #endif #if _GL_HAS_ATTRIBUTE (returns_nonnull) # define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) #else # define _GL_ATTRIBUTE_RETURNS_NONNULL #endif #if _GL_HAS_ATTRIBUTE (sentinel) # define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) #else # define _GL_ATTRIBUTE_SENTINEL(pos) #endif #if _GL_HAS_ATTRIBUTE (unused) # define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #else # define _GL_ATTRIBUTE_UNUSED #endif /* Earlier spellings of this macro. */ #define _GL_UNUSED _GL_ATTRIBUTE_UNUSED /* To support C++ as well as C, use _GL_UNUSED_LABEL with trailing ';'. */ #if !defined __cplusplus || _GL_GNUC_PREREQ (4, 5) # define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED #else # define _GL_UNUSED_LABEL #endif /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Please see the Gnulib manual for how to use these macros. Suppress extern inline with HP-UX cc, as it appears to be broken; see <https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>. Suppress extern inline with Sun C in standards-conformance mode, as it mishandles inline functions that call each other. E.g., for 'inline void f (void) { } inline void g (void) { f (); }', c99 incorrectly complains 'reference to static identifier "f" in extern inline function'. This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) on configurations that mistakenly use 'static inline' to implement functions or macros in standard C headers like <ctype.h>. For example, if isdigit is mistakenly implemented via a static inline function, a program containing an extern inline function that calls isdigit may not work since the C standard prohibits extern inline functions from calling static functions (ISO C 99 section 6.7.4.(3). This bug is known to occur on: OS X 10.8 and earlier; see: https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html DragonFly; see http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log FreeBSD; see: https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and for clang but remains for g++; see <https://trac.macports.org/ticket/41033>. Assume DragonFly and FreeBSD will be similar. GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline semantics, unless -fgnu89-inline is used. It defines a macro __GNUC_STDC_INLINE__ to indicate this situation or a macro __GNUC_GNU_INLINE__ to indicate the opposite situation. GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline semantics but warns, unless -fgnu89-inline is used: warning: C99 inline functions are not supported; using GNU89 warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. */ #if (((defined __APPLE__ && defined __MACH__) \ || defined __DragonFly__ || defined __FreeBSD__) \ && (defined __header_inline \ ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ && ! defined __clang__) \ : ((! defined _DONT_USE_CTYPE_INLINE_ \ && (defined __GNUC__ || defined __cplusplus)) \ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ && defined __GNUC__ && ! defined __cplusplus)))) # define _GL_EXTERN_INLINE_STDHEADER_BUG #endif #if ((__GNUC__ \ ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ : (199901L <= __STDC_VERSION__ \ && !defined __HP_cc \ && !defined __PGI \ && !(defined __SUNPRO_C && __STDC__))) \ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # define _GL_INLINE inline # define _GL_EXTERN_INLINE extern inline # define _GL_EXTERN_INLINE_IN_USE #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) # else # define _GL_INLINE extern inline # endif # define _GL_EXTERN_INLINE extern # define _GL_EXTERN_INLINE_IN_USE #else # define _GL_INLINE static _GL_UNUSED # define _GL_EXTERN_INLINE static _GL_UNUSED #endif /* In GCC 4.6 (inclusive) to 5.1 (exclusive), suppress bogus "no previous prototype for 'FOO'" and "no previous declaration for 'FOO'" diagnostics, when FOO is an inline function in the header; see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ #if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ # define _GL_INLINE_HEADER_CONST_PRAGMA # else # define _GL_INLINE_HEADER_CONST_PRAGMA \ _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") # endif # define _GL_INLINE_HEADER_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ _GL_INLINE_HEADER_CONST_PRAGMA # define _GL_INLINE_HEADER_END \ _Pragma ("GCC diagnostic pop") #else # define _GL_INLINE_HEADER_BEGIN # define _GL_INLINE_HEADER_END #endif /* Define to the overridden function name */ #undef fts_children /* Define to the overridden function name */ #undef fts_close /* Define to the overridden function name */ #undef fts_cross_check /* Define to the overridden function name */ #undef fts_open /* Define to the overridden function name */ #undef fts_read /* Define to the overridden function name */ #undef fts_set /* Define to `int' if <sys/types.h> doesn't define. */ #undef gid_t /* A replacement for va_copy, if needed. */ #define gl_va_copy(a,b) ((a) = (b)) /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to long or long long if <stdint.h> and <inttypes.h> don't define. */ #undef intmax_t /* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. __APPLE__ && __MACH__ test for Mac OS X. __APPLE_CC__ tests for the Apple compiler and its version. __STDC_VERSION__ tests for the C99 mode. */ #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ # define __GNUC_STDC_INLINE__ 1 #endif /* Define to 1 if the compiler is checking for lint. */ #undef lint /* Define to a type if <wchar.h> does not define. */ #undef mbstate_t /* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where n1 and n2 are expressions without side effects, that evaluate to real numbers (excluding NaN). It returns 1 if n1 > n2 0 if n1 == n2 -1 if n1 < n2 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional jump with nearly all GCC versions up to GCC 10. This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many GCC versions up to GCC 9. The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 avoids conditional jumps in all GCC versions >= 3.4. */ #define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) /* Define to `int' if <sys/types.h> does not define. */ #undef mode_t /* Define to the type of st_nlink in struct stat, or a supertype. */ #undef nlink_t /* Define to `long int' if <sys/types.h> does not define. */ #undef off_t /* Define as a signed integer type capable of holding a process identifier. */ #undef pid_t /* Define as the type of the result of subtracting two pointers, if the system doesn't define it. */ #undef ptrdiff_t /* Define to rpl_re_comp if the replacement should be used. */ #undef re_comp /* Define to rpl_re_compile_fastmap if the replacement should be used. */ #undef re_compile_fastmap /* Define to rpl_re_compile_pattern if the replacement should be used. */ #undef re_compile_pattern /* Define to rpl_re_exec if the replacement should be used. */ #undef re_exec /* Define to rpl_re_match if the replacement should be used. */ #undef re_match /* Define to rpl_re_match_2 if the replacement should be used. */ #undef re_match_2 /* Define to rpl_re_search if the replacement should be used. */ #undef re_search /* Define to rpl_re_search_2 if the replacement should be used. */ #undef re_search_2 /* Define to rpl_re_set_registers if the replacement should be used. */ #undef re_set_registers /* Define to rpl_re_set_syntax if the replacement should be used. */ #undef re_set_syntax /* Define to rpl_re_syntax_options if the replacement should be used. */ #undef re_syntax_options /* Define to rpl_regcomp if the replacement should be used. */ #undef regcomp /* Define to rpl_regerror if the replacement should be used. */ #undef regerror /* Define to rpl_regexec if the replacement should be used. */ #undef regexec /* Define to rpl_regfree if the replacement should be used. */ #undef regfree /* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported only directly. */ #define restrict /* Work around a bug in older versions of Sun C++, which did not #define __restrict__ or support _Restrict or __restrict__ even though the corresponding Sun C compiler ended up with "#define restrict _Restrict" or "#define restrict __restrict__" in the previous line. This workaround can be removed once we assume Oracle Developer Studio 12.5 (2016) or later. */ #if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ # define _Restrict # define __restrict__ #endif /* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t /* type to use in place of socklen_t if not defined */ #undef socklen_t /* Define as a signed type of the same size as size_t. */ #define ssize_t ptrdiff_t /* Define to 'struct sigaltstack' if that's the type of the argument to sigaltstack */ #undef stack_t /* Define to `int' if <sys/types.h> doesn't define. */ #undef uid_t /* This definition is a duplicate of the one in unitypes.h. It is here so that we can cope with an older version of unitypes.h that does not contain this definition and that is pre-installed among the public header files. */ # if defined __restrict \ || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ || __clang_major__ >= 3 # define _UC_RESTRICT __restrict # elif 199901L <= __STDC_VERSION__ || defined restrict # define _UC_RESTRICT restrict # else # define _UC_RESTRICT # endif /* Define as a macro for copying va_list variables. */ #undef va_copy typedef unsigned mode_t; /* Include windows.h here before DATADIR is defined, as it conflicts with objidl.h. */ #include <windows.h> /* Hack! */ #include <arg-nonnull.h> /* More hacks */ #define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(a, b) /* S_ISXXX macros: */ #include <sys/stat.h> #include <nt/ntstat.h> #ifndef S_ISCHR # define S_ISCHR(x) 0 #endif #ifndef S_ISBLK # define S_ISBLK(x) 0 #endif #ifndef S_ISSOCK # define S_ISSOCK(x) 0 #endif #ifndef S_ISFIFO # define S_ISFIFO(x) 0 #endif #ifndef S_TYPEISSHM # define S_TYPEISSHM(x) 0 #endif #ifndef S_TYPEISTMO # define S_TYPEISTMO(x) 0 #endif /* Missing these: */ #define STDIN_FILENO 0 #define STDOUT_FILENO 1 #define STDERR_FILENO 2 /* Missing open flags.*/ #include <nt/ntopenat.h> #ifndef O_NOCTTY # define O_NOCTTY 0 #endif #ifndef O_NOFOLLOW # define O_NOFOLLOW 0 #endif #ifndef O_NOLINK # define O_NOLINK 0 #endif #ifndef O_NOLINKS # define O_NOLINKS 0 #endif #ifndef O_NOTRANS # define O_NOTRANS 0 #endif #ifndef O_NONBLOCK # define O_NONBLOCK 0 #endif #ifndef O_SEARCH # define O_SEARCH 0 #endif #ifndef O_CLOEXEC # define O_CLOEXEC _O_NOINHERIT #endif /* Some prototypes of gnulib functions put here to avoid needing to mess with stdlib.in.h, string.in.h and wchar.in.h since MSC has no include_next facility. */ extern void *reallocarray(void *, size_t, size_t); extern int mbscasecmp(const char *, const char *); extern wchar_t *wmempcpy(wchar_t *, const wchar_t *, size_t); extern int wcwidth(wchar_t); #define strerror gl_strerror /* Override initialize_main to do wildcard expansion. */ #define initialize_main w32_initialize_main void w32_initialize_main(int *pcArgs, char ***ppapszArgs); #include "get_codepage.h" #endif /* !INCLUDED_CONFIG_WIN_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/kWorker/����������������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377422�015135� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/kWorker/Makefile.kmk����������������������������������������������������������������0000664�0001750�0001750�00000016077�14670377422�017371� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Makefile.kmk 3549 2022-01-29 02:41:36Z bird $ ## @file # Sub-makefile for kWorker. # # # Copyright (c) 2016 knut st. osmundsen <bird-kBuild-spamx@anduin.net> # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see <http://www.gnu.org/licenses/> # # SUB_DEPTH = ../.. include $(PATH_KBUILD)/subheader.kmk PROGRAMS += kWorker kWorker_TEMPLATE = BIN-STATIC-THREADED kWorker_DEFS := KWORKER kWorker_DEFS.debug = K_STRICT kWorker_DEFS.release = NASSERT ifeq ($(USERNAME),bird) kWorker_CFLAGS = -W4 -wd4127 -wd4100 -wd4214 -wd4201 -wd4204 endif kWorker_SOURCES = \ kWorker.c \ ../kmk/kmkbuiltin/kDepObj.c \ ../kmk/kmkbuiltin/err.c kWorker_INCS = \ ../kmk/ \ ../kmk/kmkbuiltin kWorker_LIBS = \ $(kStuff_1_TARGET) \ $(kWorkerLib_1_TARGET) include $(KBUILD_PATH)/sdks/WINDDK71.kmk kWorker_LIBS.win = \ $(TEMPLATE_BIN-STATIC-THREADED_LIBS) \ $(PATH_SDK_WINDDK71_LIB_WNET)/ntdll.lib \ $(PATH_SDK_WINDDK71_LIB_WNET)/psapi.lib kWorker_LDFLAGS.win = \ /DYNAMICBASE:NO /FIXED kWorker_LDFLAGS.win.x86 = /BASE:0x00010000 kWorker_LDFLAGS.win.amd64 = /BASE:0x0000000420000000 /STACK:16777216,262144 #kWorker_LDFLAGS.win.x86 = \ # /SAFESEH:NO - doesn't help anyone. # # Stuff from ../libs. Need to rebuilt it with static CRT. # LIBRARIES += kWorkerLib kWorkerLib_TEMPLATE = LIB-STATIC-THREADED kWorkerLib_DEFPATH = ../lib # Need fix from r2837. kWorkerLib_DEFPATH := $(PATH_SUB_CURRENT)/../lib kWorkerLib_DEFS := KWORKER kWorkerLib_SOURCES = \ crc32.c \ md5.c \ kbuild_version.c \ kDep.c kWorkerLib_SOURCES.win = \ nt_fullpath.c \ nt_fullpath_cached.c \ quoted_spawn.c \ nt/nthlpcore.c \ nt/nthlpfs.c \ nt/ntdir.c \ nt/ntstat.c \ nt/ntunlink.c \ nt/kFsCache.c \ win_get_processor_group_active_mask.c \ quote_argv.c \ get_codepage.c \ is_console.c \ maybe_con_write.c \ maybe_con_fwrite.c \ msc_buffered_printf.c kbuild_version.c_DEFS = KBUILD_SVN_REV=$(KBUILD_SVN_REV) # # kStuff library. # LIBRARIES += kStuff kStuff_TEMPLATE = LIB-STATIC-THREADED kStuff_DEFS.debug = K_STRICT kStuff_INCS = kStuff/include kStuff_DEFPATH = $(PATH_ROOT)/src/lib # kLdr kStuff_SOURCES += \ kStuff/kLdr/kLdr.c \ kStuff/kLdr/kLdrDyld.c \ kStuff/kLdr/kLdrDyldFind.c \ kStuff/kLdr/kLdrDyldMod.c \ kStuff/kLdr/kLdrDyldOS.c \ kStuff/kLdr/kLdrDyLdSem.c \ kStuff/kLdr/kLdrMod.c \ kStuff/kLdr/kLdrModLX.c \ kStuff/kLdr/kLdrModMachO.c \ kStuff/kLdr/kLdrModNative.c \ kStuff/kLdr/kLdrModPE.c kLdr_SOURCES.os2 += \ kStuff/kLdr/kLdr-os2.c \ kStuff/kLdr/kLdrA-os2.asm kLdr_SOURCES.win += \ kStuff/kLdr/kLdr-win.c # kRdr kStuff_SOURCES += \ kStuff/kRdr/kRdr.cpp \ kStuff/kRdr/kRdrFile.cpp \ kStuff/kRdr/kRdrBuffered.cpp # kCpu kStuff_SOURCES += \ kStuff/kCpu/kCpuCompare.c \ kStuff/kCpu/kCpuGetArchAndCpu.c # kHlp (CRT) kStuff_SOURCES += \ kStuff/kHlp/Generic/kHlpMemPComp.c \ kStuff/kHlp/Generic/kHlpMemICompAscii.c \ kStuff/kHlp/Generic/kHlpStrPCat.c \ kStuff/kHlp/Generic/kHlpStrNPCat.c \ kStuff/kHlp/Generic/kHlpStrPComp.c \ kStuff/kHlp/Generic/kHlpStrNPComp.c \ kStuff/kHlp/Generic/kHlpStrICompAscii.c \ kStuff/kHlp/Generic/kHlpStrIPCompAscii.c \ kStuff/kHlp/Generic/kHlpStrNICompAscii.c \ kStuff/kHlp/Generic/kHlpStrNIPCompAscii.c \ kStuff/kHlp/Generic/kHlpStrPCopy.c \ kStuff/kHlp/Generic/kHlpStrNLen.c \ kStuff/kHlp/Generic/kHlpInt2Ascii.c \ \ kStuff/kHlp/Generic/kHlpGetEnvUZ.c \ \ kStuff/kHlp/Generic/kHlpGetExt.c \ kStuff/kHlp/Generic/kHlpGetFilename.c \ kStuff/kHlp/Generic/kHlpIsFilenameOnly.c \ \ kStuff/kHlp/Generic/kHlpPage.c \ \ kStuff/kHlp/CRT/kHlpCRTAlloc.cpp \ kStuff/kHlp/CRT/kHlpCRTEnv.cpp \ kStuff/kHlp/CRT/kHlpCRTString.cpp kStuff_SOURCES.darwin += \ kStuff/kHlp/Bare/kHlpSys-darwin.c # # A couple of dummy DLLs we use for grabbing LDR TLS entries. # DLLS += kWorkerTls1K kWorkerTls1K01 kWorkerTls1K02 kWorkerTls1K03 kWorkerTls1K04 kWorkerTls1K05 kWorkerTls1K06 kWorkerTls1K07 \ kWorkerTls1K08 kWorkerTls1K09 kWorkerTls1K10 kWorkerTls1K11 kWorkerTls1K12 kWorkerTls1K13 kWorkerTls1K14 kWorkerTls1K15 kWorkerTls1K_TEMPLATE = BIN-STATIC-THREADED kWorkerTls1K_DEFS = TLS_SIZE=1024 kWorkerTls1K_SOURCES = kWorkerTlsXxxK.c kWorkerTls1K_LDFLAGS = /Entry:DummyDllEntry kWorkerTls1K01_EXTENDS = kWorkerTls1K kWorkerTls1K02_EXTENDS = kWorkerTls1K kWorkerTls1K03_EXTENDS = kWorkerTls1K kWorkerTls1K04_EXTENDS = kWorkerTls1K kWorkerTls1K05_EXTENDS = kWorkerTls1K kWorkerTls1K06_EXTENDS = kWorkerTls1K kWorkerTls1K07_EXTENDS = kWorkerTls1K kWorkerTls1K08_EXTENDS = kWorkerTls1K kWorkerTls1K09_EXTENDS = kWorkerTls1K kWorkerTls1K10_EXTENDS = kWorkerTls1K kWorkerTls1K11_EXTENDS = kWorkerTls1K kWorkerTls1K12_EXTENDS = kWorkerTls1K kWorkerTls1K13_EXTENDS = kWorkerTls1K kWorkerTls1K14_EXTENDS = kWorkerTls1K kWorkerTls1K15_EXTENDS = kWorkerTls1K DLLS += kWorkerTls64K kWorkerTls64K01 kWorkerTls64K02 kWorkerTls64K03 kWorkerTls64K04 kWorkerTls64K05 kWorkerTls64K06 kWorkerTls64K07 kWorkerTls64K_TEMPLATE = BIN-STATIC-THREADED kWorkerTls64K_DEFS = TLS_SIZE=65536 kWorkerTls64K_SOURCES = kWorkerTlsXxxK.c kWorkerTls64K_LDFLAGS = /Entry:DummyDllEntry kWorkerTls64K01_EXTENDS = kWorkerTls64K kWorkerTls64K02_EXTENDS = kWorkerTls64K kWorkerTls64K03_EXTENDS = kWorkerTls64K kWorkerTls64K04_EXTENDS = kWorkerTls64K kWorkerTls64K05_EXTENDS = kWorkerTls64K kWorkerTls64K06_EXTENDS = kWorkerTls64K kWorkerTls64K07_EXTENDS = kWorkerTls64K DLLS += kWorkerTls128K kWorkerTls128K01 kWorkerTls128K02 kWorkerTls128K03 kWorkerTls128K04 kWorkerTls128K05 kWorkerTls128K06 kWorkerTls128K07 kWorkerTls128K_TEMPLATE = BIN-STATIC-THREADED kWorkerTls128K_DEFS = TLS_SIZE=131072 kWorkerTls128K_SOURCES = kWorkerTlsXxxK.c kWorkerTls128K_LDFLAGS = /Entry:DummyDllEntry kWorkerTls128K01_EXTENDS = kWorkerTls128K kWorkerTls128K02_EXTENDS = kWorkerTls128K kWorkerTls128K03_EXTENDS = kWorkerTls128K kWorkerTls128K04_EXTENDS = kWorkerTls128K kWorkerTls128K05_EXTENDS = kWorkerTls128K kWorkerTls128K06_EXTENDS = kWorkerTls128K kWorkerTls128K07_EXTENDS = kWorkerTls128K DLLS += kWorkerTls512K kWorkerTls512K01 kWorkerTls512K02 kWorkerTls512K03 kWorkerTls512K04 kWorkerTls512K05 kWorkerTls512K06 kWorkerTls512K07 kWorkerTls512K_TEMPLATE = BIN-STATIC-THREADED kWorkerTls512K_DEFS = TLS_SIZE=524288 kWorkerTls512K_SOURCES = kWorkerTlsXxxK.c kWorkerTls512K_LDFLAGS = /Entry:DummyDllEntry kWorkerTls512K01_EXTENDS = kWorkerTls512K kWorkerTls512K02_EXTENDS = kWorkerTls512K kWorkerTls512K03_EXTENDS = kWorkerTls512K kWorkerTls512K04_EXTENDS = kWorkerTls512K kWorkerTls512K05_EXTENDS = kWorkerTls512K kWorkerTls512K06_EXTENDS = kWorkerTls512K kWorkerTls512K07_EXTENDS = kWorkerTls512K include $(KBUILD_PATH)/subfooter.kmk �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/kWorker/kWorkerTlsXxxK.c������������������������������������������������������������0000664�0001750�0001750�00000012733�14670377422�020241� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kWorkerTlsXxxK.c 3366 2020-06-09 23:53:39Z bird $ */ /** @file * kWorkerTlsXxxK - Loader TLS allocation hack DLL. */ /* * Copyright (c) 2017 knut st. osmundsen <bird-kBuild-spamx@anduin.net> * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see <http://www.gnu.org/licenses/> * */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include <windows.h> /********************************************************************************************************************************* * Structures and Typedefs * *********************************************************************************************************************************/ typedef void KWLDRTLSCALLBACK(void *hDll, DWORD dwReason, void *pvContext, void *pvWorkerModule); typedef KWLDRTLSCALLBACK *PKWLDRTLSCALLBACK; typedef PKWLDRTLSCALLBACK KWLDRTLSALLOCATIONHOOK(void *hDll, ULONG idxTls, char *pabInitData, void **ppvWorkerModule); /********************************************************************************************************************************* * Internal Functions * *********************************************************************************************************************************/ __declspec(dllexport) void __stdcall DummyTlsCallback(void *hDll, DWORD dwReason, void *pvContext); /********************************************************************************************************************************* * Global Variables * *********************************************************************************************************************************/ /** The TLS pointer array. The 2nd entry is NULL and serve to terminate the array. * The first entry can be used by kWorker if it needs to. */ __declspec(dllexport) PIMAGE_TLS_CALLBACK g_apfnTlsCallbacks[2] = { DummyTlsCallback, NULL }; /** * The TLS index. */ __declspec(dllexport) ULONG g_idxTls = ~(ULONG)0; /** * Callback context. */ __declspec(dllexport) void *g_pvWorkerModule = NULL; /** * Regular callback method (returned by kwLdrTlsAllocationHook). */ __declspec(dllexport) PKWLDRTLSCALLBACK g_pfnWorkerCallback = NULL; /** * Initialization data. * kWorker will copy the init data of the target DLL here. */ static char g_abInitData[TLS_SIZE] = {0}; /** * The TLS directory entry. Not possible to get more than one from the linker * and probably also the loader doesn't want more than one anyway. */ #pragma section(".rdata$T", long, read) __declspec(allocate(".rdata$T")) const IMAGE_TLS_DIRECTORY _tls_used = { (ULONG_PTR)&g_abInitData, (ULONG_PTR)&g_abInitData + sizeof(g_abInitData), (ULONG_PTR)&g_idxTls, (ULONG_PTR)&g_apfnTlsCallbacks, 0, /* This SizeOfZeroFill bugger doesn't work on w10/amd64 from what I can tell! */ IMAGE_SCN_ALIGN_32BYTES }; /** * Just a dummy callback function in case the allocation hook gambit fails below * (see KWLDRTLSCALLBACK). */ static void DummyWorkerCallback(void *hDll, DWORD dwReason, void *pvContext, void *pvWorkerModule) { (void)hDll; (void)dwReason; (void)pvContext; (void)pvWorkerModule; } /* * This is just a dummy TLS callback function. * We'll be replacing g_apfnTlsCallbacks[0] from kWorker.c after loading it. * * Note! W10 doesn't seem to want to process the TLS directory if the DLL * doesn't have any imports (to snap). */ __declspec(dllexport) void __stdcall DummyTlsCallback(void *hDll, DWORD dwReason, void *pvContext) { if (g_pfnWorkerCallback) g_pfnWorkerCallback(hDll, dwReason, pvContext, g_pvWorkerModule); else { g_pfnWorkerCallback = DummyWorkerCallback; if (dwReason == DLL_PROCESS_ATTACH) { HMODULE hModExe = GetModuleHandleW(NULL); KWLDRTLSALLOCATIONHOOK *pfnHook = (KWLDRTLSALLOCATIONHOOK *)GetProcAddress(hModExe, "kwLdrTlsAllocationHook"); if (pfnHook) g_pfnWorkerCallback = pfnHook(hDll, g_idxTls, g_abInitData, &g_pvWorkerModule); else __debugbreak(); } } } /* * Dummy DLL entry point to avoid dragging in unnecessary CRT stuff. kWorkerTls1K!_tls_index */ BOOL __stdcall DummyDllEntry(void *hDll, DWORD dwReason, void *pvContext) { (void)hDll; (void)dwReason; (void)pvContext; return TRUE; } �������������������������������������kbuild-3608/src/kWorker/tests-gpl2/�����������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377422�017141� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/kWorker/kWorker.c�������������������������������������������������������������������0000664�0001750�0001750�00002054470�14670377422�016741� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kWorker.c 3522 2021-12-19 12:11:21Z bird $ */ /** @file * kWorker - experimental process reuse worker for Windows. * * Note! This module must be linked statically in order to avoid * accidentally intercepting our own CRT calls. */ /* * Copyright (c) 2016 knut st. osmundsen <bird-kBuild-spamx@anduin.net> * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see <http://www.gnu.org/licenses/> * */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ //#undef NDEBUG //#define K_STRICT 1 //#define KW_LOG_ENABLED #define PSAPI_VERSION 1 #include <k/kHlp.h> #include <k/kLdr.h> #include <stdio.h> #include <intrin.h> #include <setjmp.h> #include <ctype.h> #include <errno.h> #include <process.h> #include "nt/ntstat.h" #include "kbuild_version.h" #include "nt/ntstuff.h" #include "nt/nthlp.h" #include <psapi.h> #include "nt/kFsCache.h" #include "nt_fullpath.h" #include "win_get_processor_group_active_mask.h" #include "quote_argv.h" #include "md5.h" #include "console.h" #include "../kmk/kmkbuiltin.h" /********************************************************************************************************************************* * Defined Constants And Macros * *********************************************************************************************************************************/ /** @def WITH_TEMP_MEMORY_FILES * Enables temporary memory files for cl.exe. */ #define WITH_TEMP_MEMORY_FILES /** @def WITH_HASH_CACHE * Enables caching of MD5, SHA-1, SHA-256 and SHA-512 hashes for cl.exe. * This prevents wasting time on rehashing common headers each time * they are included. */ #define WITH_HASH_CACHE /** @def WITH_CRYPT_CTX_REUSE * Enables reusing crypt contexts. The Visual C++ compiler always creates a * context which is only used for MD5 and maybe some random bytes (VS 2010). * So, only create it once and add a reference to it instead of creating new * ones. Saves registry access among other things. */ #define WITH_CRYPT_CTX_REUSE /** @def WITH_CONSOLE_OUTPUT_BUFFERING * Enables buffering of all console output as well as removal of annoying * source file echo by cl.exe. */ #define WITH_CONSOLE_OUTPUT_BUFFERING /** @def WITH_STD_OUT_ERR_BUFFERING * Enables buffering of standard output and standard error buffer as well as * removal of annoying source file echo by cl.exe. */ #define WITH_STD_OUT_ERR_BUFFERING /** @def WITH_LOG_FILE * Log to file instead of stderr. */ #define WITH_LOG_FILE /** @def WITH_HISTORY * Keep history of the last jobs. For debugging. */ #define WITH_HISTORY /** @def WITH_FIXED_VIRTUAL_ALLOCS * Whether to pre allocate memory for known fixed VirtualAlloc calls (currently * there is only one, but an important one, from cl.exe). */ #if K_ARCH == K_ARCH_X86_32 # define WITH_FIXED_VIRTUAL_ALLOCS #endif /** @def WITH_PCH_CACHING * Enables read caching of precompiled header files. */ #if K_ARCH_BITS >= 64 # define WITH_PCH_CACHING #endif #ifndef NDEBUG # define KW_LOG_ENABLED #endif /** @def KW_LOG * Generic logging. * @param a Argument list for kwDbgPrintf */ #ifdef KW_LOG_ENABLED # define KW_LOG(a) kwDbgPrintf a #else # define KW_LOG(a) do { } while (0) #endif /** @def KWLDR_LOG * Loader related logging. * @param a Argument list for kwDbgPrintf */ #ifdef KW_LOG_ENABLED # define KWLDR_LOG(a) kwDbgPrintf a #else # define KWLDR_LOG(a) do { } while (0) #endif /** @def KWFS_LOG * FS cache logging. * @param a Argument list for kwDbgPrintf */ #ifdef KW_LOG_ENABLED # define KWFS_LOG(a) kwDbgPrintf a #else # define KWFS_LOG(a) do { } while (0) #endif /** @def KWOUT_LOG * Output related logging. * @param a Argument list for kwDbgPrintf */ #ifdef KW_LOG_ENABLED # define KWOUT_LOG(a) kwDbgPrintf a #else # define KWOUT_LOG(a) do { } while (0) #endif /** @def KWCRYPT_LOG * FS cache logging. * @param a Argument list for kwDbgPrintf */ #ifdef KW_LOG_ENABLED # define KWCRYPT_LOG(a) kwDbgPrintf a #else # define KWCRYPT_LOG(a) do { } while (0) #endif /** Converts a windows handle to a handle table index. * @note We currently just mask off the 31th bit, and do no shifting or anything * else to create an index of the handle. * @todo consider shifting by 2 or 3. */ #define KW_HANDLE_TO_INDEX(a_hHandle) ((KUPTR)(a_hHandle) & ~(KUPTR)KU32_C(0x8000000)) /** Maximum handle value we can deal with. */ #define KW_HANDLE_MAX 0x20000 /** Max temporary file size (memory backed). */ #if K_ARCH_BITS >= 64 # define KWFS_TEMP_FILE_MAX (256*1024*1024) #else # define KWFS_TEMP_FILE_MAX (64*1024*1024) #endif /** Marks unfinished code. */ #if 1 # define KWFS_TODO() do { kwErrPrintf("\nHit TODO on line %u in %s!\n", __LINE__, __FUNCTION__); fflush(stderr); __debugbreak(); } while (0) #else # define KWFS_TODO() do { kwErrPrintf("\nHit TODO on line %u in %s!\n", __LINE__, __FUNCTION__); fflush(stderr); } while (0) #endif /** User data key for tools. */ #define KW_DATA_KEY_TOOL (~(KUPTR)16381) /** User data key for a cached file. */ #define KW_DATA_KEY_CACHED_FILE (~(KUPTR)65521) /** String constant comma length. */ #define TUPLE(a_sz) a_sz, sizeof(a_sz) - 1 /** * Generate CRT slot wrapper functions. */ #define CRT_SLOT_FUNCTION_WRAPPER(a_RetTypeAndCallConv, a_FnName, a_aArgsDecl, a_aArgCall) \ static a_RetTypeAndCallConv a_FnName##00 a_aArgsDecl { const unsigned iCrtSlot = 0; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##01 a_aArgsDecl { const unsigned iCrtSlot = 1; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##02 a_aArgsDecl { const unsigned iCrtSlot = 2; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##03 a_aArgsDecl { const unsigned iCrtSlot = 3; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##04 a_aArgsDecl { const unsigned iCrtSlot = 4; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##05 a_aArgsDecl { const unsigned iCrtSlot = 5; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##06 a_aArgsDecl { const unsigned iCrtSlot = 6; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##07 a_aArgsDecl { const unsigned iCrtSlot = 7; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##08 a_aArgsDecl { const unsigned iCrtSlot = 8; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##09 a_aArgsDecl { const unsigned iCrtSlot = 9; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##10 a_aArgsDecl { const unsigned iCrtSlot = 10; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##11 a_aArgsDecl { const unsigned iCrtSlot = 11; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##12 a_aArgsDecl { const unsigned iCrtSlot = 12; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##13 a_aArgsDecl { const unsigned iCrtSlot = 13; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##14 a_aArgsDecl { const unsigned iCrtSlot = 14; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##15 a_aArgsDecl { const unsigned iCrtSlot = 15; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##16 a_aArgsDecl { const unsigned iCrtSlot = 16; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##17 a_aArgsDecl { const unsigned iCrtSlot = 17; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##18 a_aArgsDecl { const unsigned iCrtSlot = 18; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##19 a_aArgsDecl { const unsigned iCrtSlot = 19; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##20 a_aArgsDecl { const unsigned iCrtSlot = 20; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##21 a_aArgsDecl { const unsigned iCrtSlot = 21; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##22 a_aArgsDecl { const unsigned iCrtSlot = 22; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##23 a_aArgsDecl { const unsigned iCrtSlot = 23; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##24 a_aArgsDecl { const unsigned iCrtSlot = 24; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##25 a_aArgsDecl { const unsigned iCrtSlot = 25; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##26 a_aArgsDecl { const unsigned iCrtSlot = 26; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##27 a_aArgsDecl { const unsigned iCrtSlot = 27; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##28 a_aArgsDecl { const unsigned iCrtSlot = 28; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##29 a_aArgsDecl { const unsigned iCrtSlot = 29; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##30 a_aArgsDecl { const unsigned iCrtSlot = 30; return a_FnName##_wrapped a_aArgCall; } \ static a_RetTypeAndCallConv a_FnName##31 a_aArgsDecl { const unsigned iCrtSlot = 31; return a_FnName##_wrapped a_aArgCall; } \ static const KUPTR a_FnName[] = \ { \ (KUPTR)a_FnName##00, \ (KUPTR)a_FnName##01, \ (KUPTR)a_FnName##02, \ (KUPTR)a_FnName##03, \ (KUPTR)a_FnName##04, \ (KUPTR)a_FnName##05, \ (KUPTR)a_FnName##06, \ (KUPTR)a_FnName##07, \ (KUPTR)a_FnName##08, \ (KUPTR)a_FnName##09, \ (KUPTR)a_FnName##10, \ (KUPTR)a_FnName##11, \ (KUPTR)a_FnName##12, \ (KUPTR)a_FnName##13, \ (KUPTR)a_FnName##14, \ (KUPTR)a_FnName##15, \ (KUPTR)a_FnName##16, \ (KUPTR)a_FnName##17, \ (KUPTR)a_FnName##18, \ (KUPTR)a_FnName##19, \ (KUPTR)a_FnName##20, \ (KUPTR)a_FnName##21, \ (KUPTR)a_FnName##22, \ (KUPTR)a_FnName##23, \ (KUPTR)a_FnName##24, \ (KUPTR)a_FnName##25, \ (KUPTR)a_FnName##26, \ (KUPTR)a_FnName##27, \ (KUPTR)a_FnName##28, \ (KUPTR)a_FnName##29, \ (KUPTR)a_FnName##30, \ (KUPTR)a_FnName##31, \ } /********************************************************************************************************************************* * Structures and Typedefs * *********************************************************************************************************************************/ typedef enum KWLOCATION { KWLOCATION_INVALID = 0, KWLOCATION_EXE_DIR, KWLOCATION_IMPORTER_DIR, KWLOCATION_SYSTEM32, KWLOCATION_UNKNOWN_NATIVE, KWLOCATION_UNKNOWN, } KWLOCATION; typedef enum KWMODSTATE { KWMODSTATE_INVALID = 0, KWMODSTATE_NEEDS_BITS, KWMODSTATE_NEEDS_INIT, KWMODSTATE_BEING_INITED, KWMODSTATE_INIT_FAILED, KWMODSTATE_READY, } KWMODSTATE; typedef struct KWMODULE *PKWMODULE; typedef struct KWMODULE { /** Pointer to the next image withe the same hash. */ PKWMODULE pNextHash; /** Pointer to the next image in the global list. */ PKWMODULE pNextList; /** The normalized path to the image. */ const char *pszPath; /** The hash of the program path. */ KU32 uHashPath; /** Number of references. */ KU32 cRefs; /** UTF-16 version of pszPath. */ const wchar_t *pwszPath; /** The offset of the filename in pszPath. */ KU16 offFilename; /** The offset of the filename in pwszPath. */ KU16 offFilenameW; /** Set if executable. */ KBOOL fExe; /** Set if native module entry. */ KBOOL fNative; /** Loader module handle. */ PKLDRMOD pLdrMod; /** The windows module handle. */ HMODULE hOurMod; /** Parent (real) module if this is a virtual API module (api-ms-*.dll or * ext-ms-*.dll). Referenced. */ PKWMODULE pVirtualApiMod; /** The of the loaded image bits. */ KSIZE cbImage; /** The CRT slot for this module, if applicable (KU8_MAX when not). */ KU8 iCrtSlot; /** Loop prevention when working the tree. */ KBOOL fVisited; /** HACK: Set if re-init is needed (fReInitOnMsPdbSrvEndpointChange). */ KBOOL fNeedReInit; /** HACK: Reinit when _MSPDBSRV_ENDPOINT_ changes, K_FALSE if not applicable. * 1 if applicable but not yet used, 2 if used and have pszMsPdbSrvEndpoint. */ KU8 fReInitOnMsPdbSrvEndpointChange; /** HACK: The old _MSPDBSRV_ENDPOINT_ value. */ char *pszMsPdbSrvEndpoint; union { /** Data for a manually loaded image. */ struct { /** Where we load the image. */ KU8 *pbLoad; /** Virgin copy of the image. */ KU8 *pbCopy; /** Ldr pvBits argument. This is NULL till we've successfully resolved * the imports. */ void *pvBits; /** The state. */ KWMODSTATE enmState; /** The re-init state. */ KWMODSTATE enmReInitState; #if defined(KBUILD_OS_WINDOWS) && defined(KBUILD_ARCH_AMD64) /** The number of entries in the table. */ KU32 cFunctions; /** The function table address (in the copy). */ PRUNTIME_FUNCTION paFunctions; /** Set if we've already registered a function table already. */ KBOOL fRegisteredFunctionTable; #endif /** Set if we share memory with other executables. */ KBOOL fUseLdBuf; /** Set after the first whole image copy is done. */ KBOOL fCanDoQuick; /** Number of quick copy chunks. */ KU8 cQuickCopyChunks; /** Number of quick zero chunks. */ KU8 cQuickZeroChunks; /** Quicker image copy instructions that skips non-writable parts when * possible. Need to check fCanDoQuick, fUseLdBuf and previous executable * image. */ struct { /** The copy destination. */ KU8 *pbDst; /** The copy source. */ KU8 const *pbSrc; /** How much to copy. */ KSIZE cbToCopy; } aQuickCopyChunks[3]; /** For handling BSS and zero alignment padding when using aQuickCopyChunks. */ struct { /** Where to start zeroing. */ KU8 *pbDst; /** How much to zero. */ KSIZE cbToZero; } aQuickZeroChunks[3]; /** Pointer to g_abInitData of the kWorkerTlsXxxK.c instance. * This member is set by kwLdrTlsAllocationHook. */ KU8 *pabTlsInitData; /** Pointer to the g_pvWorkerModule variable in kWorkerTlsXxxK.c (our instance * of it). This member is set by kwLdrTlsAllocationHook. Used by our * destructor to prevent after-free references. */ PKWMODULE *ppTlsWorkerModuleVar; /** TLS index if one was allocated, otherwise KU32_MAX. * This member is set by kwLdrTlsAllocationHook. */ KU32 idxTls; /** Offset (RVA) of the TLS initialization data. */ KU32 offTlsInitData; /** Number of bytes of TLS initialization data. */ KU32 cbTlsInitData; /** Number of allocated bytes for TLS. */ KU32 cbTlsAlloc; /** Number of TLS callbacks. */ KU32 cTlsCallbacks; /** Offset (RVA) of the TLS callback table. */ KU32 offTlsCallbacks; /** Number of imported modules. */ KSIZE cImpMods; /** Import array (variable size). */ PKWMODULE apImpMods[1]; } Manual; } u; } KWMODULE; typedef struct KWDYNLOAD *PKWDYNLOAD; typedef struct KWDYNLOAD { /** Pointer to the next in the list. */ PKWDYNLOAD pNext; /** The module handle we present to the application. * This is the LoadLibraryEx return value for special modules and the * KWMODULE.hOurMod value for the others. */ HMODULE hmod; /** The module for non-special resource stuff, NULL if special. */ PKWMODULE pMod; /** The length of the LoadLibary filename. */ KSIZE cchRequest; /** The LoadLibrary filename. */ char szRequest[1]; } KWDYNLOAD; /** * GetModuleHandle cache for system modules frequently queried. */ typedef struct KWGETMODULEHANDLECACHE { const char *pszName; const wchar_t *pwszName; KU8 cchName; KU8 cwcName; KBOOL fAlwaysPresent; HANDLE hmod; } KWGETMODULEHANDLECACHE; typedef KWGETMODULEHANDLECACHE *PKWGETMODULEHANDLECACHE; /** One TLS DLL. */ typedef struct KWTLSDLL { const wchar_t *pwszName; /**< The DLL name. */ KBOOL fUsed; /**< Set if used, clear if not. */ } KWTLSDLL; typedef KWTLSDLL *PKWTLSDLL; /** * TLS DLL tracker. */ typedef struct KWTLSDLLENTRY { KU32 cbTls; /**< Max TLS size. */ KU32 cDlls; /**< Number of DLLs we ship (paDlls). */ PKWTLSDLL paDlls; /**< Array of DLLs we ship. */ } KWTLSDLLENTRY; typedef KWTLSDLLENTRY *PKWTLSDLLENTRY; /** * A cached file. */ typedef struct KFSWCACHEDFILE { /** The user data core. */ KFSUSERDATA Core; /** Cached file handle. */ HANDLE hCached; /** Cached file section handle. */ HANDLE hSection; /** Cached file content. */ KU8 *pbCached; /** The file size. */ KU32 cbCached; #ifdef WITH_HASH_CACHE /** Set if we've got a valid MD5 hash in abMd5Digest. */ KBOOL fValidMd5; /** Set if we've got a valid SHA-1 hash in abMd5Digest. */ KBOOL fValidSha1; /** Set if we've got a valid SHA-256 hash in abMd5Digest. */ KBOOL fValidSha256; /** Set if we've got a valid SHA-512 hash in abMd5Digest. */ KBOOL fValidSha512; /** The MD5 digest if fValidMd5 is set. */ KU8 abMd5Digest[16]; /** The SHA-1 digest if fValidSha1 is set. */ KU8 abSha1Digest[20]; /** The SHA-256 digest if fValidSha256 is set. */ KU8 abSha256Digest[32]; /** The SHA-512 digest if fValidSha256 is set. */ KU8 abSha512Digest[64]; #endif /** Circular self reference. Prevents the object from ever going away and * keeps it handy for debugging. */ PKFSOBJ pFsObj; /** The file path (for debugging). */ char szPath[1]; } KFSWCACHEDFILE; /** Pointer to a cached filed. */ typedef KFSWCACHEDFILE *PKFSWCACHEDFILE; #ifdef WITH_HASH_CACHE /** Pointer to a MD5 hash instance. */ typedef struct KWCRYPTHASH *PKWCRYPTHASH; /** * A MD5 hash instance. */ typedef struct KWCRYPTHASH { /** The magic value. */ KUPTR uMagic; /** Pointer to the next hash handle. */ PKWCRYPTHASH pNext; /** The cached file we've associated this handle with. */ PKFSWCACHEDFILE pCachedFile; /** The number of bytes we've hashed. */ KU32 cbHashed; /** Set if this has gone wrong. */ KBOOL fGoneBad; /** Set if we've already finalized the digest. */ KBOOL fFinal; /** If in fallback mode. */ HCRYPTHASH hFallback; /** The algorithm. */ ALG_ID idAlg; /** The hash name. */ const char *pszAlgName; /** The digest size. */ KU32 cbDigest; /** The finalized digest. */ KU8 abDigest[64]; } KWCRYPTHASH; /** Magic value for KWCRYPTHASH::uMagic (Les McCann). */ # define KWCRYPTHASH_MAGIC KUPTR_C(0x19350923) #endif /* WITH_HASH_CACHE */ #ifdef WITH_TEMP_MEMORY_FILES typedef struct KWFSTEMPFILESEG *PKWFSTEMPFILESEG; typedef struct KWFSTEMPFILESEG { /** File offset of data. */ KU32 offData; /** The size of the buffer pbData points to. */ KU32 cbDataAlloc; /** The segment data. */ KU8 *pbData; } KWFSTEMPFILESEG; typedef struct KWFSTEMPFILE *PKWFSTEMPFILE; typedef struct KWFSTEMPFILE { /** Pointer to the next temporary file for this run. */ PKWFSTEMPFILE pNext; /** The UTF-16 path. (Allocated after this structure.) */ const wchar_t *pwszPath; /** The path length. */ KU16 cwcPath; /** Number of active handles using this file/mapping (<= 2). */ KU8 cActiveHandles; /** Number of active mappings (mapped views) (0 or 1). */ KU8 cMappings; /** The amount of space allocated in the segments. */ KU32 cbFileAllocated; /** The current file size. */ KU32 cbFile; /** The number of segments. */ KU32 cSegs; /** Segments making up the file. */ PKWFSTEMPFILESEG paSegs; } KWFSTEMPFILE; #endif /* WITH_TEMP_MEMORY_FILES */ #ifdef WITH_CONSOLE_OUTPUT_BUFFERING /** * Console line buffer or output full buffer. */ typedef struct KWOUTPUTSTREAMBUF { /** The main output handle. */ HANDLE hOutput; /** Our backup handle. */ HANDLE hBackup; /** Set if this is a console handle and we're in line buffered mode. * When clear, we may buffer multiple lines, though try flush on line * boundraries when ever possible. */ KBOOL fIsConsole; /** Compressed GetFileType result. */ KU8 fFileType; KU8 abPadding[2]; union { /** Line buffer mode (fIsConsole == K_TRUE). */ struct { /** Amount of pending console output in wchar_t's. */ KU32 cwcBuf; /** The allocated buffer size. */ KU32 cwcBufAlloc; /** Pending console output. */ wchar_t *pwcBuf; } Con; /** Fully buffered mode (fIsConsole == K_FALSE). */ struct { /** Amount of pending output (in chars). */ KU32 cchBuf; #ifdef WITH_STD_OUT_ERR_BUFFERING /** The allocated buffer size (in chars). */ KU32 cchBufAlloc; /** Pending output. */ char *pchBuf; #endif } Fully; } u; } KWOUTPUTSTREAMBUF; /** Pointer to a console line buffer. */ typedef KWOUTPUTSTREAMBUF *PKWOUTPUTSTREAMBUF; /** * Combined console buffer of complete lines. */ typedef struct KWCONSOLEOUTPUT { /** The console output handle. * INVALID_HANDLE_VALUE if we haven't got a console and shouldn't be doing any * combined output buffering. */ HANDLE hOutput; /** The current code page for the console. */ KU32 uCodepage; /** Amount of pending console output in wchar_t's. */ KU32 cwcBuf; /** Number of times we've flushed it in any way (for cl.exe hack). */ KU32 cFlushes; /** Pending console output. */ wchar_t wszBuf[8192]; } KWCONSOLEOUTPUT; /** Pointer to a combined console buffer. */ typedef KWCONSOLEOUTPUT *PKWCONSOLEOUTPUT; #endif /* WITH_CONSOLE_OUTPUT_BUFFERING */ /** Handle type. */ typedef enum KWHANDLETYPE { KWHANDLETYPE_INVALID = 0, KWHANDLETYPE_FSOBJ_READ_CACHE, KWHANDLETYPE_FSOBJ_READ_CACHE_MAPPING, #ifdef WITH_TEMP_MEMORY_FILES KWHANDLETYPE_TEMP_FILE, KWHANDLETYPE_TEMP_FILE_MAPPING, #endif KWHANDLETYPE_OUTPUT_BUF } KWHANDLETYPE; /** Handle data. */ typedef struct KWHANDLE { KWHANDLETYPE enmType; /** Number of references */ KU32 cRefs; /** The current file offset. */ KU32 offFile; /** Handle access. */ KU32 dwDesiredAccess; /** The handle. */ HANDLE hHandle; /** The current owner (GetCurrentThreadId). */ KU32 tidOwner; /** Type specific data. */ union { /** The file system object. */ PKFSWCACHEDFILE pCachedFile; #ifdef WITH_TEMP_MEMORY_FILES /** Temporary file handle or mapping handle. */ PKWFSTEMPFILE pTempFile; #endif #ifdef WITH_CONSOLE_OUTPUT_BUFFERING /** Buffered output stream. */ PKWOUTPUTSTREAMBUF pOutBuf; #endif } u; } KWHANDLE; typedef KWHANDLE *PKWHANDLE; /** * Tracking one of our memory mappings. */ typedef struct KWMEMMAPPING { /** Number of references. */ KU32 cRefs; /** The mapping type (KWHANDLETYPE_FSOBJ_READ_CACHE_MAPPING or * KWHANDLETYPE_TEMP_FILE_MAPPING). */ KWHANDLETYPE enmType; /** The mapping address. */ PVOID pvMapping; /** Type specific data. */ union { /** The file system object. */ PKFSWCACHEDFILE pCachedFile; #ifdef WITH_TEMP_MEMORY_FILES /** Temporary file handle or mapping handle. */ PKWFSTEMPFILE pTempFile; #endif } u; } KWMEMMAPPING; /** Pointer to a memory mapping tracker. */ typedef KWMEMMAPPING *PKWMEMMAPPING; /** Pointer to a VirtualAlloc tracker entry. */ typedef struct KWVIRTALLOC *PKWVIRTALLOC; /** * Tracking an VirtualAlloc allocation. */ typedef struct KWVIRTALLOC { PKWVIRTALLOC pNext; void *pvAlloc; KSIZE cbAlloc; /** This is KU32_MAX if not a preallocated chunk. */ KU32 idxPreAllocated; } KWVIRTALLOC; /** Pointer to a heap (HeapCreate) tracker entry. */ typedef struct KWHEAP *PKWHEAP; /** * Tracking an heap (HeapCreate) */ typedef struct KWHEAP { PKWHEAP pNext; HANDLE hHeap; } KWHEAP; /** Pointer to a FlsAlloc/TlsAlloc tracker entry. */ typedef struct KWLOCALSTORAGE *PKWLOCALSTORAGE; /** * Tracking an FlsAlloc/TlsAlloc index. */ typedef struct KWLOCALSTORAGE { PKWLOCALSTORAGE pNext; KU32 idx; } KWLOCALSTORAGE; /** Pointer to an at exit callback record */ typedef struct KWEXITCALLACK *PKWEXITCALLACK; /** * At exit callback record. */ typedef struct KWEXITCALLACK { PKWEXITCALLACK pNext; _onexit_t pfnCallback; /** At exit doesn't have an exit code. */ KBOOL fAtExit; } KWEXITCALLACK; typedef enum KWTOOLTYPE { KWTOOLTYPE_INVALID = 0, KWTOOLTYPE_SANDBOXED, KWTOOLTYPE_WATCOM, KWTOOLTYPE_EXEC, KWTOOLTYPE_END } KWTOOLTYPE; typedef enum KWTOOLHINT { KWTOOLHINT_INVALID = 0, KWTOOLHINT_NONE, KWTOOLHINT_VISUAL_CPP_CL, KWTOOLHINT_VISUAL_CPP_LINK, KWTOOLHINT_END } KWTOOLHINT; /** * A kWorker tool. */ typedef struct KWTOOL { /** The user data core structure. */ KFSUSERDATA Core; /** The normalized path to the program. */ const char *pszPath; /** UTF-16 version of pszPath. */ wchar_t const *pwszPath; /** The kind of tool. */ KWTOOLTYPE enmType; union { struct { /** The main entry point. */ KUPTR uMainAddr; /** The executable. */ PKWMODULE pExe; /** List of dynamically loaded modules. * These will be kept loaded till the tool is destroyed (if we ever do that). */ PKWDYNLOAD pDynLoadHead; /** Module array sorted by hOurMod. */ PKWMODULE *papModules; /** Number of entries in papModules. */ KU32 cModules; /** Tool hint (for hacks and such). */ KWTOOLHINT enmHint; } Sandboxed; } u; } KWTOOL; /** Pointer to a tool. */ typedef struct KWTOOL *PKWTOOL; typedef struct KWSANDBOX *PKWSANDBOX; typedef struct KWSANDBOX { /** Jump buffer (first for alignment reasons). */ jmp_buf JmpBuf; /** The tool currently running in the sandbox. */ PKWTOOL pTool; /** The thread ID of the main thread (owner of JmpBuf). */ DWORD idMainThread; /** Copy of the NT TIB of the main thread. */ NT_TIB TibMainThread; /** The NT_TIB::ExceptionList value inside the try case. * We restore this prior to the longjmp. */ void *pOutXcptListHead; /** The exit code in case of longjmp. */ int rcExitCode; /** Set if we're running. */ KBOOL fRunning; /** Whether to disable caching of ".pch" files. */ KBOOL fNoPchCaching; /** The command line. */ char *pszCmdLine; /** The UTF-16 command line. */ wchar_t *pwszCmdLine; /** Number of arguments in papszArgs. */ int cArgs; /** The argument vector. */ char **papszArgs; /** The argument vector. */ wchar_t **papwszArgs; /** The _pgmptr msvcrt variable. */ char *pgmptr; /** The _wpgmptr msvcrt variable. */ wchar_t *wpgmptr; /** The _initenv msvcrt variable. */ char **initenv; /** The _winitenv msvcrt variable. */ wchar_t **winitenv; /** Size of the array we've allocated (ASSUMES nobody messes with it!). */ KSIZE cEnvVarsAllocated; /** The _environ msvcrt variable. */ char **environ; /** The _wenviron msvcrt variable. */ wchar_t **wenviron; /** The shadow _environ msvcrt variable. */ char **papszEnvVars; /** The shadow _wenviron msvcrt variable. */ wchar_t **papwszEnvVars; /** Critical section protecting the below handle members below. * @note Does not protect the individual handles. */ CRITICAL_SECTION HandlesLock; /** Handle table. */ PKWHANDLE *papHandles; /** Size of the handle table. */ KU32 cHandles; /** Number of active handles in the table. */ KU32 cActiveHandles; /** Number of handles in the handle table that will not be freed. */ KU32 cFixedHandles; /** Total number of leaked handles. */ KU32 cLeakedHandles; /** Number of active memory mappings in paMemMappings. */ KU32 cMemMappings; /** The allocated size of paMemMappings. */ KU32 cMemMappingsAlloc; /** Memory mappings (MapViewOfFile / UnmapViewOfFile). */ PKWMEMMAPPING paMemMappings; #ifdef WITH_TEMP_MEMORY_FILES /** Head of the list of temporary file. */ PKWFSTEMPFILE pTempFileHead; #endif /** Critical section protecting pVirtualAllocHead. */ CRITICAL_SECTION VirtualAllocLock; /** Head of the virtual alloc allocations. */ PKWVIRTALLOC pVirtualAllocHead; /** Head of the heap list (HeapCreate). * This is only done from images we forcibly restore. */ PKWHEAP pHeapHead; /** Head of the FlsAlloc indexes. */ PKWLOCALSTORAGE pFlsAllocHead; /** Head of the TlsAlloc indexes. */ PKWLOCALSTORAGE pTlsAllocHead; /** The at exit callback head. * This is only done from images we forcibly restore. */ PKWEXITCALLACK pExitCallbackHead; MY_UNICODE_STRING SavedCommandLine; #ifdef WITH_HASH_CACHE /** The crypto provider instance we use for hashes. */ HCRYPTPROV hCryptProvRsa; /** The crypto provider instance we use for hashes. */ HCRYPTPROV hCryptProvAes; /** List of crypto hash instances. */ PKWCRYPTHASH pHashHead; /** ReadFile sets these while CryptHashData claims and clears them. * * This is part of the heuristics we use for MD5/SHA1/SHA256 caching for header * files. The observed pattern is that c1.dll/c1xx.dll first reads a chunk of a * source or header, then passes the same buffer and read byte count to * CryptHashData. */ struct { /** The cached file last read from. */ PKFSWCACHEDFILE pCachedFile; /** The file offset of the last cached read. */ KU32 offRead; /** The number of bytes read last. */ KU32 cbRead; /** The buffer pointer of the last read. */ void *pvRead; } LastHashRead; #endif #ifdef WITH_CRYPT_CTX_REUSE /** Reusable crypt contexts. */ struct { /** The creation provider type. */ KU32 dwProvType; /** The creation flags. */ KU32 dwFlags; /** The length of the container name. */ KU32 cwcContainer; /** The length of the provider name. */ KU32 cwcProvider; /** The container name string. */ wchar_t *pwszContainer; /** The provider name string. */ wchar_t *pwszProvider; /** The context handle. */ HCRYPTPROV hProv; } aCryptCtxs[4]; /** Number of reusable crypt conexts in aCryptCtxs. */ KU32 cCryptCtxs; #endif #ifdef WITH_CONSOLE_OUTPUT_BUFFERING /** The internal standard output handle. */ KWHANDLE HandleStdOut; /** The internal standard error handle. */ KWHANDLE HandleStdErr; /** Standard output (and whatever else) buffer. */ KWOUTPUTSTREAMBUF StdOut; /** Standard error buffer. */ KWOUTPUTSTREAMBUF StdErr; /** Combined buffer of completed lines. */ KWCONSOLEOUTPUT Combined; #endif } KWSANDBOX; /** A CRT slot. */ typedef struct KWCRTSLOT { KU32 iSlot; /** The CRT module data. */ PKWMODULE pModule; /** Pointer to the malloc function. */ void * (__cdecl *pfnMalloc)(size_t); /** Pointer to the beginthreadex function. */ uintptr_t (__cdecl *pfnBeginThreadEx)(void *, unsigned, unsigned (__stdcall *)(void *), void *, unsigned, unsigned *); } KWCRTSLOT; typedef KWCRTSLOT *PKWCRTSLOT; /** Replacement function entry. */ typedef struct KWREPLACEMENTFUNCTION { /** The function name. */ const char *pszFunction; /** The length of the function name. */ KSIZE cchFunction; /** The module name (optional). */ const char *pszModule; /** The replacement function, data address or CRT slot function array. */ KUPTR pfnReplacement; /** Only replace in the executable. * @todo fix the reinitialization of non-native DLLs! */ KBOOL fOnlyExe; /** Set if pfnReplacement points to a CRT slot function array. */ KBOOL fCrtSlotArray; } KWREPLACEMENTFUNCTION; typedef KWREPLACEMENTFUNCTION const *PCKWREPLACEMENTFUNCTION; #if 0 /** Replacement function entry. */ typedef struct KWREPLACEMENTDATA { /** The function name. */ const char *pszFunction; /** The length of the function name. */ KSIZE cchFunction; /** The module name (optional). */ const char *pszModule; /** Function providing the replacement. */ KUPTR (*pfnMakeReplacement)(PKWMODULE pMod, const char *pchSymbol, KSIZE cchSymbol); } KWREPLACEMENTDATA; typedef KWREPLACEMENTDATA const *PCKWREPLACEMENTDATA; #endif /** * One test job (--full-test). */ typedef struct KWONETEST { /** Where this job originated. */ const char *pszJobSrc; /** The argument number it started with. */ unsigned iJobSrc; /** Set if virgin, clear if modified. */ KBOOL fVirgin; /** Number of runs to give it. */ unsigned cRuns; /** @name kSubmitHandleJobUnpacked arguments * @{ */ const char *pszExecutable; const char *pszCwd; KU32 cArgs; const char **papszArgs; KU32 cEnvVars; const char **papszEnvVars; const char *pszSpecialEnv; KBOOL fWatcomBrainDamange; KBOOL fNoPchCaching; KU32 cPostCmdArgs; const char **papszPostCmdArgs; /** @} */ /** Pointer to the next one. */ struct KWONETEST *pNext; } KWONETEST; /** Pointer to one test job. */ typedef KWONETEST *PKWONETEST; /********************************************************************************************************************************* * Global Variables * *********************************************************************************************************************************/ /** The sandbox data. */ static KWSANDBOX g_Sandbox; /** The module currently occupying g_abDefLdBuf. */ static PKWMODULE g_pModInLdBuf = NULL; /** The module that previuosly occupied g_abDefLdBuf. */ static PKWMODULE g_pModPrevInLdBuf = NULL; /** Module list head. */ static PKWMODULE g_pModuleHead = NULL; /** Where to insert the next module. */ static PKWMODULE *g_ppModuleNext = &g_pModuleHead; /** Module hash table. */ static PKWMODULE g_apModules[127]; /** GetModuleHandle cache. */ static KWGETMODULEHANDLECACHE g_aGetModuleHandleCache[] = { #define MOD_CACHE_STRINGS(str) str, L##str, sizeof(str) - 1, (sizeof(L##str) / sizeof(wchar_t)) - 1 { MOD_CACHE_STRINGS("KERNEL32.DLL"), K_TRUE, NULL }, #if 1 { MOD_CACHE_STRINGS("KERNELBASE.DLL"), K_TRUE, NULL }, { MOD_CACHE_STRINGS("NTDLL.DLL"), K_TRUE, NULL }, #endif { MOD_CACHE_STRINGS("mscoree.dll"), K_FALSE, NULL }, }; /** Module pending TLS allocation. See kwLdrModuleCreateNonNativeSetupTls. */ static PKWMODULE g_pModPendingTlsAlloc = NULL; /** The 1KB TLS DLLs. */ static KWTLSDLL g_aTls1KDlls[] = { { L"kWorkerTls1K.dll", K_FALSE }, { L"kWorkerTls1K01.dll", K_FALSE }, { L"kWorkerTls1K02.dll", K_FALSE }, { L"kWorkerTls1K03.dll", K_FALSE }, { L"kWorkerTls1K04.dll", K_FALSE }, { L"kWorkerTls1K05.dll", K_FALSE }, { L"kWorkerTls1K06.dll", K_FALSE }, { L"kWorkerTls1K07.dll", K_FALSE }, { L"kWorkerTls1K08.dll", K_FALSE }, { L"kWorkerTls1K09.dll", K_FALSE }, { L"kWorkerTls1K10.dll", K_FALSE }, { L"kWorkerTls1K11.dll", K_FALSE }, { L"kWorkerTls1K12.dll", K_FALSE }, { L"kWorkerTls1K13.dll", K_FALSE }, { L"kWorkerTls1K14.dll", K_FALSE }, { L"kWorkerTls1K15.dll", K_FALSE }, }; /** The 64KB TLS DLLs. */ static KWTLSDLL g_aTls64KDlls[] = { { L"kWorkerTls64K.dll", K_FALSE }, { L"kWorkerTls64K01.dll", K_FALSE }, { L"kWorkerTls64K02.dll", K_FALSE }, { L"kWorkerTls64K03.dll", K_FALSE }, { L"kWorkerTls64K04.dll", K_FALSE }, { L"kWorkerTls64K05.dll", K_FALSE }, { L"kWorkerTls64K06.dll", K_FALSE }, { L"kWorkerTls64K07.dll", K_FALSE }, }; /** The 128KB TLS DLLs. */ static KWTLSDLL g_aTls128KDlls[] = { { L"kWorkerTls128K.dll", K_FALSE }, { L"kWorkerTls128K01.dll", K_FALSE }, { L"kWorkerTls128K02.dll", K_FALSE }, { L"kWorkerTls128K03.dll", K_FALSE }, { L"kWorkerTls128K04.dll", K_FALSE }, { L"kWorkerTls128K05.dll", K_FALSE }, { L"kWorkerTls128K06.dll", K_FALSE }, { L"kWorkerTls128K07.dll", K_FALSE }, }; /** The 512KB TLS DLLs. */ static KWTLSDLL g_aTls512KDlls[] = { { L"kWorkerTls512K.dll", K_FALSE }, { L"kWorkerTls512K01.dll", K_FALSE }, { L"kWorkerTls512K02.dll", K_FALSE }, { L"kWorkerTls512K03.dll", K_FALSE }, { L"kWorkerTls512K04.dll", K_FALSE }, { L"kWorkerTls512K05.dll", K_FALSE }, { L"kWorkerTls512K06.dll", K_FALSE }, { L"kWorkerTls512K07.dll", K_FALSE }, }; /** The TLS DLLs grouped by size. */ static KWTLSDLLENTRY const g_aTlsDlls[] = { { 1024, K_ELEMENTS(g_aTls1KDlls), g_aTls1KDlls }, { 64*1024, K_ELEMENTS(g_aTls64KDlls), g_aTls64KDlls }, { 128*1024, K_ELEMENTS(g_aTls128KDlls), g_aTls128KDlls }, { 512*1024, K_ELEMENTS(g_aTls512KDlls), g_aTls512KDlls }, }; /** CRT slots. * @note The number of entires here must match CRT_SLOT_FUNCTION_WRAPPER. */ static KWCRTSLOT g_aCrtSlots[32]; /** windbg .reload statements. vs */ char g_szReloads[4096]; /** Current offset into g_szReloads. */ KU32 volatile g_cchReloads; /** The file system cache. */ static PKFSCACHE g_pFsCache; /** The current directory (referenced). */ static PKFSOBJ g_pCurDirObj = NULL; #ifdef KBUILD_OS_WINDOWS /** The windows system32 directory (referenced). */ static PKFSDIR g_pWinSys32 = NULL; #endif /** Verbosity level. */ static int g_cVerbose = 2; /** Whether we should restart the worker. */ static KBOOL g_fRestart = K_FALSE; /** The process group this worker is tied to (--group option), -1 if none. */ static KI32 g_iProcessGroup = -1; /** Whether control-C/SIGINT or Control-Break/SIGBREAK have been seen. */ static int volatile g_rcCtrlC = 0; /** The communication pipe handle. We break this when we see Ctrl-C such. */ #ifdef KBUILD_OS_WINDOWS static HANDLE g_hPipe = INVALID_HANDLE_VALUE; #else static int g_hPipe = -1; #endif /* Further down. */ extern KWREPLACEMENTFUNCTION const g_aSandboxReplacements[]; extern KU32 const g_cSandboxReplacements; extern KWREPLACEMENTFUNCTION const g_aSandboxNativeReplacements[]; extern KU32 const g_cSandboxNativeReplacements; extern KWREPLACEMENTFUNCTION const g_aSandboxGetProcReplacements[]; extern KU32 const g_cSandboxGetProcReplacements; /** Create a larget BSS blob that with help of /IMAGEBASE:0x10000 should * cover the default executable link address of 0x400000. * @remarks Early main() makes it read+write+executable. Attempts as having * it as a separate section failed because the linker insists on * writing out every zero in the uninitialized section, resulting in * really big binaries. */ __declspec(align(0x1000)) static KU8 g_abDefLdBuf[16*1024*1024]; #ifdef WITH_LOG_FILE /** Log file handle. */ static HANDLE g_hLogFile = INVALID_HANDLE_VALUE; #endif #ifdef WITH_FIXED_VIRTUAL_ALLOCS /** Virtual address space reserved for CL.EXE heap manager. * * Visual C++ 2010 reserves a 78MB chunk of memory from cl.exe at a fixed * address. It's among other things used for precompiled headers, which * seemingly have addresses hardcoded into them and won't work if mapped * elsewhere. Thus, we have to make sure the area is available when cl.exe asks * for it. (The /Zm option may affect this allocation.) */ static struct { /** The memory address we need. */ KUPTR const uFixed; /** How much we need to fix. */ KSIZE const cbFixed; /** What we actually got, NULL if given back. */ void *pvReserved; /** Whether it is in use or not. */ KBOOL fInUse; } g_aFixedVirtualAllocs[] = { # if K_ARCH == K_ARCH_X86_32 /* Visual C++ 2010 reserves 0x04b00000 by default, and Visual C++ 2015 reserves 0x05300000. We get 0x0f000000 to handle large precompiled header files. */ { KUPTR_C( 0x11000000), KSIZE_C( 0x0f000000), NULL }, # else { KUPTR_C(0x000006BB00000000), KSIZE_C(0x000000002EE00000), NULL }, # endif }; #endif #ifdef WITH_HISTORY /** The job history. */ static char *g_apszHistory[32]; /** Index of the next history entry. */ static unsigned g_iHistoryNext = 0; #endif /** Number of jobs executed. */ static KU32 g_cJobs; /** Number of tools. */ static KU32 g_cTools; /** Number of modules. */ static KU32 g_cModules; /** Number of non-native modules. */ static KU32 g_cNonNativeModules; /** Number of read-cached files. */ static KU32 g_cReadCachedFiles; /** Total size of read-cached files. */ static KSIZE g_cbReadCachedFiles; /** Total number of ReadFile calls. */ static KSIZE g_cReadFileCalls; /** Total bytes read via ReadFile. */ static KSIZE g_cbReadFileTotal; /** Total number of read from read-cached files. */ static KSIZE g_cReadFileFromReadCached; /** Total bytes read from read-cached files. */ static KSIZE g_cbReadFileFromReadCached; /** Total number of read from in-memory temporary files. */ static KSIZE g_cReadFileFromInMemTemp; /** Total bytes read from in-memory temporary files. */ static KSIZE g_cbReadFileFromInMemTemp; /** Total number of WriteFile calls. */ static KSIZE g_cWriteFileCalls; /** Total bytes written via WriteFile. */ static KSIZE g_cbWriteFileTotal; /** Total number of written to from in-memory temporary files. */ static KSIZE g_cWriteFileToInMemTemp; /** Total bytes written to in-memory temporary files. */ static KSIZE g_cbWriteFileToInMemTemp; #ifdef WITH_HASH_CACHE /** Total number of hashes. */ static KSIZE g_cHashes; /** Number of cached hash hits. */ static KSIZE g_cHashesCached; /** Number of fallbacks. */ static KSIZE g_cHashesFallbacks; /** Number of partial cached file hashes. */ static KSIZE g_cHashesPartial; /** Total number of MD5 hashes. */ static KSIZE g_cHashesMd5; /** Total number of SHA-1 hashes. */ static KSIZE g_cHashesSha1; /** Total number of SHA-256 hashes. */ static KSIZE g_cHashesSha256; /** Total number of SHA-512 hashes. */ static KSIZE g_cHashesSha512; #endif /********************************************************************************************************************************* * Internal Functions * *********************************************************************************************************************************/ static FNKLDRMODGETIMPORT kwLdrModuleGetImportCallback; static int kwLdrModuleResolveAndLookup(const char *pszName, PKWMODULE pExe, PKWMODULE pImporter, const char *pszSearchPath, PKWMODULE *ppMod); static PKWMODULE kwLdrModuleForLoadedNative(const char *pszName, KBOOL fEnsureCrtSlot, KBOOL fAlwaysPresent); static PKWMODULE kwLdrModuleForLoadedNativeByHandle(HMODULE hModule, KBOOL fEnsureCrtSlot, const char *pszLogName); static int kwLdrModuleCreateCrtSlot(PKWMODULE pModule); static PKWMODULE kwToolLocateModuleByHandle(PKWTOOL pTool, HMODULE hmod); static char *kwSandboxDoGetEnvA(PKWSANDBOX pSandbox, const char *pchVar, KSIZE cchVar); static KBOOL kwSandboxHandleTableEnter(PKWSANDBOX pSandbox, PKWHANDLE pHandle, HANDLE hHandle); static PKWHANDLE kwSandboxHandleLookup(HANDLE hFile); static PKWHANDLE kwSandboxHandleGet(HANDLE hFile); K_INLINE void kwSandboxHandlePut(PKWHANDLE pHandle); #ifdef WITH_CONSOLE_OUTPUT_BUFFERING static void kwSandboxConsoleWriteA(PKWSANDBOX pSandbox, PKWOUTPUTSTREAMBUF pLineBuf, const char *pchBuffer, KU32 cchToWrite); #endif static PPEB kwSandboxGetProcessEnvironmentBlock(void); /** * Debug printing. * @param pszFormat Debug format string. * @param ... Format argument. */ static void kwDbgPrintfV(const char *pszFormat, va_list va) { if (g_cVerbose >= 2) { DWORD const dwSavedErr = GetLastError(); #ifdef WITH_LOG_FILE DWORD dwIgnored; char szTmp[2048]; int cchPrefix = _snprintf(szTmp, sizeof(szTmp), "%x:%x: ", GetCurrentProcessId(), GetCurrentThreadId()); int cch = vsnprintf(&szTmp[cchPrefix], sizeof(szTmp) - cchPrefix, pszFormat, va); if (cch < (int)sizeof(szTmp) - 1 - cchPrefix) cch += cchPrefix; else { cch = sizeof(szTmp) - 1; szTmp[cch] = '\0'; } if (g_hLogFile == INVALID_HANDLE_VALUE) { wchar_t wszFilename[128]; _snwprintf(wszFilename, K_ELEMENTS(wszFilename), L"kWorker-%x-%x.log", GetTickCount(), GetCurrentProcessId()); g_hLogFile = CreateFileW(wszFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL /*pSecAttrs*/, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL /*hTemplateFile*/); } WriteFile(g_hLogFile, szTmp, cch, &dwIgnored, NULL /*pOverlapped*/); #else fprintf(stderr, "debug: "); vfprintf(stderr, pszFormat, va); #endif SetLastError(dwSavedErr); } } /** * Debug printing. * @param pszFormat Debug format string. * @param ... Format argument. */ static void kwDbgPrintf(const char *pszFormat, ...) { if (g_cVerbose >= 2) { va_list va; va_start(va, pszFormat); kwDbgPrintfV(pszFormat, va); va_end(va); } } /** * Debugger printing. * @param pszFormat Debug format string. * @param ... Format argument. */ static void kwDebuggerPrintfV(const char *pszFormat, va_list va) { if (IsDebuggerPresent()) { DWORD const dwSavedErr = GetLastError(); char szTmp[2048]; _vsnprintf(szTmp, sizeof(szTmp), pszFormat, va); OutputDebugStringA(szTmp); SetLastError(dwSavedErr); } } /** * Debugger printing. * @param pszFormat Debug format string. * @param ... Format argument. */ static void kwDebuggerPrintf(const char *pszFormat, ...) { va_list va; va_start(va, pszFormat); kwDebuggerPrintfV(pszFormat, va); va_end(va); } /** * Error printing. * @param pszFormat Message format string. * @param ... Format argument. */ static void kwErrPrintfV(const char *pszFormat, va_list va) { DWORD const dwSavedErr = GetLastError(); #if defined(KW_LOG_ENABLED) && defined(WITH_LOG_FILE) va_list vaCopy; # if defined(va_copy) || !defined(_MSC_VER) || _MSC_VER >= 1700 /*??*/ va_copy(vaCopy, va); # else vaCopy = va; # endif kwDebuggerPrintf("kWorker: error: "); kwDebuggerPrintfV(pszFormat, vaCopy); #endif fprintf(stderr, "kWorker: error: "); vfprintf(stderr, pszFormat, va); fflush(stderr); /* In case it's a pipe. */ SetLastError(dwSavedErr); } /** * Error printing. * @param pszFormat Message format string. * @param ... Format argument. */ static void kwErrPrintf(const char *pszFormat, ...) { va_list va; va_start(va, pszFormat); kwErrPrintfV(pszFormat, va); va_end(va); } /** * Error printing. * @return rc; * @param rc Return value * @param pszFormat Message format string. * @param ... Format argument. */ static int kwErrPrintfRc(int rc, const char *pszFormat, ...) { va_list va; va_start(va, pszFormat); kwErrPrintfV(pszFormat, va); va_end(va); return rc; } #ifdef K_STRICT KHLP_DECL(void) kHlpAssertMsg1(const char *pszExpr, const char *pszFile, unsigned iLine, const char *pszFunction) { DWORD const dwSavedErr = GetLastError(); fprintf(stderr, "\n" "!!Assertion failed!!\n" "Expression: %s\n" "Function : %s\n" "File: %s\n" "Line: %d\n" , pszExpr, pszFunction, pszFile, iLine); SetLastError(dwSavedErr); } KHLP_DECL(void) kHlpAssertMsg2(const char *pszFormat, ...) { DWORD const dwSavedErr = GetLastError(); va_list va; va_start(va, pszFormat); fprintf(stderr, pszFormat, va); va_end(va); SetLastError(dwSavedErr); } #endif /* K_STRICT */ /** * Hashes a string. * * @returns 32-bit string hash. * @param pszString String to hash. */ static KU32 kwStrHash(const char *pszString) { /* This algorithm was created for sdbm (a public-domain reimplementation of ndbm) database library. it was found to do well in scrambling bits, causing better distribution of the keys and fewer splits. it also happens to be a good general hashing function with good distribution. the actual function is hash(i) = hash(i - 1) * 65599 + str[i]; what is included below is the faster version used in gawk. [there is even a faster, duff-device version] the magic constant 65599 was picked out of thin air while experimenting with different constants, and turns out to be a prime. this is one of the algorithms used in berkeley db (see sleepycat) and elsewhere. */ KU32 uHash = 0; KU32 uChar; while ((uChar = (unsigned char)*pszString++) != 0) uHash = uChar + (uHash << 6) + (uHash << 16) - uHash; return uHash; } /** * Hashes a string. * * @returns The string length. * @param pszString String to hash. * @param puHash Where to return the 32-bit string hash. */ static KSIZE kwStrHashEx(const char *pszString, KU32 *puHash) { const char * const pszStart = pszString; KU32 uHash = 0; KU32 uChar; while ((uChar = (unsigned char)*pszString) != 0) { uHash = uChar + (uHash << 6) + (uHash << 16) - uHash; pszString++; } *puHash = uHash; return pszString - pszStart; } /** * Hashes a string. * * @returns The string length in wchar_t units. * @param pwszString String to hash. * @param puHash Where to return the 32-bit string hash. */ static KSIZE kwUtf16HashEx(const wchar_t *pwszString, KU32 *puHash) { const wchar_t * const pwszStart = pwszString; KU32 uHash = 0; KU32 uChar; while ((uChar = *pwszString) != 0) { uHash = uChar + (uHash << 6) + (uHash << 16) - uHash; pwszString++; } *puHash = uHash; return pwszString - pwszStart; } /** * Converts the given string to unicode. * * @returns Length of the resulting string in wchar_t's. * @param pszSrc The source string. * @param pwszDst The destination buffer. * @param cwcDst The size of the destination buffer in wchar_t's. */ static KSIZE kwStrToUtf16(const char *pszSrc, wchar_t *pwszDst, KSIZE cwcDst) { /* Just to the quick ASCII stuff for now. correct ansi code page stuff later some time. */ KSIZE offDst = 0; while (offDst < cwcDst) { char ch = *pszSrc++; pwszDst[offDst++] = ch; if (!ch) return offDst - 1; kHlpAssert((unsigned)ch < 127); } pwszDst[offDst - 1] = '\0'; return offDst; } /** * Converts the given string to UTF-16, allocating the buffer. * * @returns Pointer to the new heap allocation containing the UTF-16 version of * the source string. * @param pchSrc The source string. * @param cchSrc The length of the source string. */ static wchar_t *kwStrToUtf16AllocN(const char *pchSrc, KSIZE cchSrc) { DWORD const dwErrSaved = GetLastError(); KSIZE cwcBuf = cchSrc + 1; wchar_t *pwszBuf = (wchar_t *)kHlpAlloc(cwcBuf * sizeof(pwszBuf)); if (pwszBuf) { if (cchSrc > 0) { int cwcRet = MultiByteToWideChar(CP_ACP, 0, pchSrc, (int)cchSrc, pwszBuf, (int)cwcBuf - 1); if (cwcRet > 0) { kHlpAssert(cwcRet < (KSSIZE)cwcBuf); pwszBuf[cwcRet] = '\0'; } else { kHlpFree(pwszBuf); /* Figure the length and allocate the right buffer size. */ SetLastError(NO_ERROR); cwcRet = MultiByteToWideChar(CP_ACP, 0, pchSrc, (int)cchSrc, pwszBuf, 0); if (cwcRet) { cwcBuf = cwcRet + 2; pwszBuf = (wchar_t *)kHlpAlloc(cwcBuf * sizeof(pwszBuf)); if (pwszBuf) { SetLastError(NO_ERROR); cwcRet = MultiByteToWideChar(CP_ACP, 0, pchSrc, (int)cchSrc, pwszBuf, (int)cwcBuf - 1); if (cwcRet) { kHlpAssert(cwcRet < (KSSIZE)cwcBuf); pwszBuf[cwcRet] = '\0'; } else { kwErrPrintf("MultiByteToWideChar(,,%*.*s,,) -> dwErr=%d\n", cchSrc, cchSrc, pchSrc, GetLastError()); kHlpFree(pwszBuf); pwszBuf = NULL; } } } else { kwErrPrintf("MultiByteToWideChar(,,%*.*s,,NULL,0) -> dwErr=%d\n", cchSrc, cchSrc, pchSrc, GetLastError()); pwszBuf = NULL; } } } else pwszBuf[0] = '\0'; } SetLastError(dwErrSaved); return pwszBuf; } /** * Converts the given UTF-16 to a normal string. * * @returns Length of the resulting string. * @param pwszSrc The source UTF-16 string. * @param pszDst The destination buffer. * @param cbDst The size of the destination buffer in bytes. */ static KSIZE kwUtf16ToStr(const wchar_t *pwszSrc, char *pszDst, KSIZE cbDst) { /* Just to the quick ASCII stuff for now. correct ansi code page stuff later some time. */ KSIZE offDst = 0; while (offDst < cbDst) { wchar_t wc = *pwszSrc++; pszDst[offDst++] = (char)wc; if (!wc) return offDst - 1; kHlpAssert((unsigned)wc < 127); } pszDst[offDst - 1] = '\0'; return offDst; } /** * Converts the given UTF-16 to ASSI, allocating the buffer. * * @returns Pointer to the new heap allocation containing the ANSI version of * the source string. * @param pwcSrc The source string. * @param cwcSrc The length of the source string. */ static char *kwUtf16ToStrAllocN(const wchar_t *pwcSrc, KSIZE cwcSrc) { DWORD const dwErrSaved = GetLastError(); KSIZE cbBuf = cwcSrc + (cwcSrc >> 1) + 1; char *pszBuf = (char *)kHlpAlloc(cbBuf); if (pszBuf) { if (cwcSrc > 0) { int cchRet = WideCharToMultiByte(CP_ACP, 0, pwcSrc, (int)cwcSrc, pszBuf, (int)cbBuf - 1, NULL, NULL); if (cchRet > 0) { kHlpAssert(cchRet < (KSSIZE)cbBuf); pszBuf[cchRet] = '\0'; } else { kHlpFree(pszBuf); /* Figure the length and allocate the right buffer size. */ SetLastError(NO_ERROR); cchRet = WideCharToMultiByte(CP_ACP, 0, pwcSrc, (int)cwcSrc, pszBuf, 0, NULL, NULL); if (cchRet) { cbBuf = cchRet + 2; pszBuf = (char *)kHlpAlloc(cbBuf); if (pszBuf) { SetLastError(NO_ERROR); cchRet = WideCharToMultiByte(CP_ACP, 0, pwcSrc, (int)cwcSrc, pszBuf, (int)cbBuf - 1, NULL, NULL); if (cchRet) { kHlpAssert(cchRet < (KSSIZE)cbBuf); pszBuf[cchRet] = '\0'; } else { kwErrPrintf("WideCharToMultiByte(,,%*.*ls,,) -> dwErr=%d\n", cwcSrc, cwcSrc, pwcSrc, GetLastError()); kHlpFree(pszBuf); pszBuf = NULL; } } } else { kwErrPrintf("WideCharToMultiByte(,,%*.*ls,,NULL,0) -> dwErr=%d\n", cwcSrc, cwcSrc, pwcSrc, GetLastError()); pszBuf = NULL; } } } else pszBuf[0] = '\0'; } SetLastError(dwErrSaved); return pszBuf; } /** UTF-16 string length. */ static KSIZE kwUtf16Len(wchar_t const *pwsz) { KSIZE cwc = 0; while (*pwsz != '\0') cwc++, pwsz++; return cwc; } /** * Copy out the UTF-16 string following the convension of GetModuleFileName */ static DWORD kwUtf16CopyStyle1(wchar_t const *pwszSrc, wchar_t *pwszDst, KSIZE cwcDst) { KSIZE cwcSrc = kwUtf16Len(pwszSrc); if (cwcSrc + 1 <= cwcDst) { kHlpMemCopy(pwszDst, pwszSrc, (cwcSrc + 1) * sizeof(wchar_t)); return (DWORD)cwcSrc; } if (cwcDst > 0) { KSIZE cwcDstTmp = cwcDst - 1; pwszDst[cwcDstTmp] = '\0'; if (cwcDstTmp > 0) kHlpMemCopy(pwszDst, pwszSrc, cwcDstTmp); } SetLastError(ERROR_INSUFFICIENT_BUFFER); return (DWORD)cwcDst; } /** * Copy out the ANSI string following the convension of GetModuleFileName */ static DWORD kwStrCopyStyle1(char const *pszSrc, char *pszDst, KSIZE cbDst) { KSIZE cchSrc = kHlpStrLen(pszSrc); if (cchSrc + 1 <= cbDst) { kHlpMemCopy(pszDst, pszSrc, cchSrc + 1); return (DWORD)cchSrc; } if (cbDst > 0) { KSIZE cbDstTmp = cbDst - 1; pszDst[cbDstTmp] = '\0'; if (cbDstTmp > 0) kHlpMemCopy(pszDst, pszSrc, cbDstTmp); } SetLastError(ERROR_INSUFFICIENT_BUFFER); return (DWORD)cbDst; } /** * Normalizes the path so we get a consistent hash. * * @returns status code. * @param pszPath The path. * @param pszNormPath The output buffer. * @param cbNormPath The size of the output buffer. */ static int kwPathNormalize(const char *pszPath, char *pszNormPath, KSIZE cbNormPath) { KFSLOOKUPERROR enmError; PKFSOBJ pFsObj = kFsCacheLookupA(g_pFsCache, pszPath, &enmError); if (pFsObj) { KBOOL fRc; fRc = kFsCacheObjGetFullPathA(pFsObj, pszNormPath, cbNormPath, '\\'); kFsCacheObjRelease(g_pFsCache, pFsObj); if (fRc) return 0; return KERR_BUFFER_OVERFLOW; } return KERR_FILE_NOT_FOUND; } /** * Get the pointer to the filename part of the path. * * @returns Pointer to where the filename starts within the string pointed to by pszFilename. * @returns Pointer to the terminator char if no filename. * @param pszPath The path to parse. */ static wchar_t *kwPathGetFilenameW(const wchar_t *pwszPath) { const wchar_t *pwszLast = NULL; for (;;) { wchar_t wc = *pwszPath; #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS if (wc == '/' || wc == '\\' || wc == ':') { while ((wc = *++pwszPath) == '/' || wc == '\\' || wc == ':') /* nothing */; pwszLast = pwszPath; } #else if (wc == '/') { while ((wc = *++pszFilename) == '/') /* betsuni */; pwszLast = pwszPath; } #endif if (!wc) return (wchar_t *)(pwszLast ? pwszLast : pwszPath); pwszPath++; } } /** * Retains a new reference to the given module * @returns pMod * @param pMod The module to retain. */ static PKWMODULE kwLdrModuleRetain(PKWMODULE pMod) { kHlpAssert(pMod->cRefs > 0); kHlpAssert(pMod->cRefs < 64 || pMod->fNative /* kernelbase.dll and VC++ 14.2 */); pMod->cRefs++; return pMod; } /** * Releases a module reference. * * @param pMod The module to release. */ static void kwLdrModuleRelease(PKWMODULE pMod) { if (--pMod->cRefs == 0) { /* Make sure it doesn't receive any more native TLS callbacks.if non-native. */ if (!pMod->fNative && pMod->u.Manual.ppTlsWorkerModuleVar) { *pMod->u.Manual.ppTlsWorkerModuleVar = NULL; pMod->u.Manual.ppTlsWorkerModuleVar = NULL; } /* Unlink it from the hash table. */ if (!pMod->fExe) { unsigned idx = pMod->uHashPath % K_ELEMENTS(g_apModules); if (g_apModules[idx] == pMod) g_apModules[idx] = pMod->pNextHash; else { PKWMODULE pPrev = g_apModules[idx]; kHlpAssert(pPrev != NULL); while (pPrev->pNextHash != pMod) { pPrev = pPrev->pNextHash; kHlpAssert(pPrev != NULL); } pPrev->pNextHash = pMod->pNextHash; } } /* Unlink it from the list. */ if (pMod != g_pModuleHead) { PKWMODULE pPrev = g_pModuleHead; while (pPrev) { if (pPrev->pNextList == pMod) { pPrev->pNextList = pMod->pNextList; if (!pMod->pNextList) g_ppModuleNext = &pPrev->pNextList; break; } pPrev = pPrev->pNextList; } kHlpAssert(pPrev != NULL); } else { g_pModuleHead = pMod->pNextList; if (!pMod->pNextList) g_ppModuleNext = &g_pModuleHead; } /* Release import modules. */ if (!pMod->fNative) { KSIZE idx = pMod->u.Manual.cImpMods; while (idx-- > 0) if (pMod->u.Manual.apImpMods[idx]) { kwLdrModuleRelease(pMod->u.Manual.apImpMods[idx]); pMod->u.Manual.apImpMods[idx] = NULL; } } /* Free our resources. */ kLdrModClose(pMod->pLdrMod); pMod->pLdrMod = NULL; if (!pMod->fNative) { kHlpPageFree(pMod->u.Manual.pbCopy, pMod->cbImage); kHlpPageFree(pMod->u.Manual.pbLoad, pMod->cbImage); } if (pMod->iCrtSlot != KU8_MAX) g_aCrtSlots[pMod->iCrtSlot].pModule = NULL; if (pMod->pszMsPdbSrvEndpoint) { kHlpFree(pMod->pszMsPdbSrvEndpoint); pMod->pszMsPdbSrvEndpoint = NULL; } kHlpFree(pMod); } else kHlpAssert(pMod->cRefs < 64 || pMod->fNative /* kernelbase.dll and VC++ 14.2 */); } /** * Links the module into the module hash table. * * @returns pMod * @param pMod The module to link. */ static PKWMODULE kwLdrModuleLink(PKWMODULE pMod) { if (!pMod->fExe) { unsigned idx = pMod->uHashPath % K_ELEMENTS(g_apModules); pMod->pNextHash = g_apModules[idx]; g_apModules[idx] = pMod; } pMod->pNextList = NULL; *g_ppModuleNext = pMod; g_ppModuleNext = &pMod->pNextList; return pMod; } /** * Replaces imports for this module according to g_aSandboxNativeReplacements. * * @param pMod The natively loaded module to process. */ static void kwLdrModuleDoNativeImportReplacements(PKWMODULE pMod) { KSIZE const cbImage = (KSIZE)kLdrModSize(pMod->pLdrMod); KU8 const * const pbImage = (KU8 const *)pMod->hOurMod; IMAGE_DOS_HEADER const *pMzHdr = (IMAGE_DOS_HEADER const *)pbImage; IMAGE_NT_HEADERS const *pNtHdrs; IMAGE_DATA_DIRECTORY const *pDirEnt; kHlpAssert(pMod->fNative); /* * Locate the export descriptors. */ /* MZ header. */ if (pMzHdr->e_magic == IMAGE_DOS_SIGNATURE) { kHlpAssertReturnVoid((KU32)pMzHdr->e_lfanew <= cbImage - sizeof(*pNtHdrs)); pNtHdrs = (IMAGE_NT_HEADERS const *)&pbImage[pMzHdr->e_lfanew]; } else pNtHdrs = (IMAGE_NT_HEADERS const *)pbImage; /* Check PE header. */ kHlpAssertReturnVoid(pNtHdrs->Signature == IMAGE_NT_SIGNATURE); kHlpAssertReturnVoid(pNtHdrs->FileHeader.SizeOfOptionalHeader == sizeof(pNtHdrs->OptionalHeader)); /* Locate the import descriptor array. */ pDirEnt = (IMAGE_DATA_DIRECTORY const *)&pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]; if ( pDirEnt->Size > 0 && pDirEnt->VirtualAddress != 0) { const IMAGE_IMPORT_DESCRIPTOR *pImpDesc = (const IMAGE_IMPORT_DESCRIPTOR *)&pbImage[pDirEnt->VirtualAddress]; KU32 cLeft = pDirEnt->Size / sizeof(*pImpDesc); MEMORY_BASIC_INFORMATION ProtInfo = { NULL, NULL, 0, 0, 0, 0, 0 }; KU8 *pbProtRange = NULL; SIZE_T cbProtRange = 0; DWORD fOldProt = 0; KU32 const cbPage = 0x1000; BOOL fRc; kHlpAssertReturnVoid(pDirEnt->VirtualAddress < cbImage); kHlpAssertReturnVoid(pDirEnt->Size < cbImage); kHlpAssertReturnVoid(pDirEnt->VirtualAddress + pDirEnt->Size <= cbImage); /* * Walk the import descriptor array. * Note! This only works if there's a backup thunk array, otherwise we cannot get at the name. */ while ( cLeft-- > 0 && pImpDesc->Name > 0 && pImpDesc->FirstThunk > 0) { KU32 iThunk; const char * const pszImport = (const char *)&pbImage[pImpDesc->Name]; PKWMODULE pImportMod = NULL; PIMAGE_THUNK_DATA paThunks = (PIMAGE_THUNK_DATA)&pbImage[pImpDesc->FirstThunk]; PIMAGE_THUNK_DATA paOrgThunks = (PIMAGE_THUNK_DATA)&pbImage[pImpDesc->OriginalFirstThunk]; kHlpAssertReturnVoid(pImpDesc->Name < cbImage); kHlpAssertReturnVoid(pImpDesc->FirstThunk < cbImage); kHlpAssertReturnVoid(pImpDesc->OriginalFirstThunk < cbImage); kHlpAssertReturnVoid(pImpDesc->OriginalFirstThunk != pImpDesc->FirstThunk); kHlpAssertReturnVoid(pImpDesc->OriginalFirstThunk); /* Iterate the thunks. */ for (iThunk = 0; paOrgThunks[iThunk].u1.Ordinal != 0; iThunk++) { KUPTR const off = paOrgThunks[iThunk].u1.Function; kHlpAssertReturnVoid(off < cbImage); if (!IMAGE_SNAP_BY_ORDINAL(off)) { IMAGE_IMPORT_BY_NAME const *pName = (IMAGE_IMPORT_BY_NAME const *)&pbImage[off]; KSIZE const cchSymbol = kHlpStrLen((const char *)&pName->Name[0]); KU32 i = g_cSandboxNativeReplacements; while (i-- > 0) if ( g_aSandboxNativeReplacements[i].cchFunction == cchSymbol && kHlpMemComp(g_aSandboxNativeReplacements[i].pszFunction, pName->Name, cchSymbol) == 0) { if ( !g_aSandboxNativeReplacements[i].pszModule || kHlpStrICompAscii(g_aSandboxNativeReplacements[i].pszModule, pszImport) == 0) { KWLDR_LOG(("%s: replacing %s!%s\n", pMod->pLdrMod->pszName, pszImport, pName->Name)); /* The .rdata section is normally read-only, so we need to make it writable first. */ if ((KUPTR)&paThunks[iThunk] - (KUPTR)pbProtRange >= cbPage) { /* Restore previous .rdata page. */ if (fOldProt) { fRc = VirtualProtect(pbProtRange, cbProtRange, fOldProt, NULL /*pfOldProt*/); kHlpAssert(fRc || GetLastError() == ERROR_NOACCESS /*tinderwin2*/); fOldProt = 0; } /* Query attributes for the current .rdata page. */ pbProtRange = (KU8 *)((KUPTR)&paThunks[iThunk] & ~(KUPTR)(cbPage - 1)); cbProtRange = VirtualQuery(pbProtRange, &ProtInfo, sizeof(ProtInfo)); kHlpAssert(cbProtRange); if (cbProtRange) { switch (ProtInfo.Protect) { case PAGE_READWRITE: case PAGE_WRITECOPY: case PAGE_EXECUTE_READWRITE: case PAGE_EXECUTE_WRITECOPY: /* Already writable, nothing to do. */ fRc = TRUE; break; default: kHlpAssertMsgFailed(("%#x\n", ProtInfo.Protect)); case PAGE_READONLY: cbProtRange = cbPage; fRc = VirtualProtect(pbProtRange, cbProtRange, PAGE_READWRITE, &fOldProt); break; case PAGE_EXECUTE: case PAGE_EXECUTE_READ: cbProtRange = cbPage; fRc = VirtualProtect(pbProtRange, cbProtRange, PAGE_EXECUTE_READWRITE, &fOldProt); break; } kHlpAssertStmt(fRc, fOldProt = 0); } } /* * Unslotted replacements are simple. */ if (!g_aSandboxNativeReplacements[i].fCrtSlotArray) paThunks[iThunk].u1.AddressOfData = g_aSandboxNativeReplacements[i].pfnReplacement; else { /* * Must find our module entry for this module, possibly creating one. */ if (!pImportMod) { pImportMod = kwLdrModuleForLoadedNative(pszImport, K_TRUE /*fEnsureCrtSlot*/, K_TRUE /*fAlwaysPresent*/); if (!pImportMod) { kwErrPrintf("Failed to get module '%s' when performing replacements on module '%s'!\n", pszImport, pMod->pszPath); break; } } paThunks[iThunk].u1.AddressOfData = ((KUPTR *)g_aSandboxNativeReplacements[i].pfnReplacement)[pImportMod->iCrtSlot]; } break; } } } } /* Next import descriptor. */ pImpDesc++; } if (fOldProt) { DWORD fIgnore = 0; fRc = VirtualProtect(pbProtRange, cbProtRange, fOldProt, &fIgnore); kHlpAssertMsg(fRc, ("%u\n", GetLastError())); K_NOREF(fRc); } } } /** * Creates a module from a native kLdr module handle. * * @returns Module w/ 1 reference on success, NULL on failure. * @param pLdrMod The native kLdr module. * @param pszPath The normalized path to the module. * @param cbPath The module path length with terminator. * @param uHashPath The module path hash. * @param fDoReplacements Whether to do import replacements on this * module. */ static PKWMODULE kwLdrModuleCreateForNativekLdrModule(PKLDRMOD pLdrMod, const char *pszPath, KSIZE cbPath, KU32 uHashPath, KBOOL fDoReplacements, PKWMODULE pVirtualApiMod) { /* * Create the entry. */ PKWMODULE pMod = (PKWMODULE)kHlpAllocZ(sizeof(*pMod) + cbPath + cbPath * 2 * sizeof(wchar_t)); if (pMod) { pMod->pwszPath = (wchar_t *)(pMod + 1); kwStrToUtf16(pszPath, (wchar_t *)pMod->pwszPath, cbPath * 2); pMod->pszPath = (char *)kHlpMemCopy((char *)&pMod->pwszPath[cbPath * 2], pszPath, cbPath); pMod->uHashPath = uHashPath; pMod->cRefs = 1; pMod->offFilename = (KU16)(kHlpGetFilename(pszPath) - pszPath); pMod->offFilenameW = (KU16)(kwPathGetFilenameW(pMod->pwszPath) - pMod->pwszPath); pMod->fExe = K_FALSE; pMod->fNative = K_TRUE; pMod->pLdrMod = pLdrMod; pMod->hOurMod = (HMODULE)(KUPTR)pLdrMod->aSegments[0].MapAddress; pMod->cbImage = (KSIZE)kLdrModSize(pLdrMod); pMod->iCrtSlot = KU8_MAX; pMod->fNeedReInit = K_FALSE; pMod->pszMsPdbSrvEndpoint = NULL; pMod->fReInitOnMsPdbSrvEndpointChange = kHlpStrNICompAscii(&pMod->pszPath[pMod->offFilename], TUPLE("mspdb")) == 0; pMod->pVirtualApiMod = pVirtualApiMod; if (pVirtualApiMod) kwLdrModuleRetain(pVirtualApiMod); if (fDoReplacements) { DWORD const dwSavedErr = GetLastError(); kwLdrModuleDoNativeImportReplacements(pMod); SetLastError(dwSavedErr); } KWLDR_LOG(("New module: %p LB %#010x %s (native%s%s)\n", (KUPTR)pMod->pLdrMod->aSegments[0].MapAddress, kLdrModSize(pMod->pLdrMod), pMod->pszPath, pVirtualApiMod ? ", virtual api => " : "", pVirtualApiMod ? pVirtualApiMod->pszPath : "")); g_cModules++; return kwLdrModuleLink(pMod); } return NULL; } /** * Creates a module using the native loader. * * @returns Module w/ 1 reference on success, NULL on failure. * @param pszPath The normalized path to the module. * @param uHashPath The module path hash. * @param fDoReplacements Whether to do import replacements on this * module. */ static PKWMODULE kwLdrModuleCreateNative(const char *pszPath, KU32 uHashPath, KBOOL fDoReplacements) { PKLDRMOD pLdrMod; int rc; /* * HACK ALERT! Make sure the application path is searched when looking for * imports in the module we're loading. */ /** @todo improve on this hack! */ PKWMODULE pExe = g_Sandbox.pTool ? g_Sandbox.pTool->u.Sandboxed.pExe : NULL; if (pExe) { /* HACK ALERT! */ wchar_t *pwzFilename = (wchar_t *)&pExe->pwszPath[pExe->offFilenameW]; wchar_t wcSaved = pExe->pwszPath[pExe->offFilenameW]; *pwzFilename = '\0'; if (!SetDllDirectoryW(pExe->pwszPath)) kwErrPrintf("SetDllDirectoryW failed: %u\n", GetLastError()); KW_LOG(("kwLdrModuleCreateNative: Applied SetDllDirectoryW hack (%ls)\n", pExe->pwszPath)); *pwzFilename = wcSaved; } else KW_LOG(("kwLdrModuleCreateNative: Warning! Too early for SetDllDirectoryW hack\n")); /* * Load the library and create a module structure for it. */ rc = kLdrModOpenNative(pszPath, KLDRMOD_OPEN_FLAGS_NATIVE_ALLOW_INIT_TERM, &pLdrMod); if (rc == 0) { KSIZE cchPath = kHlpStrLen(pszPath); PKWMODULE pMod = kwLdrModuleCreateForNativekLdrModule(pLdrMod, pszPath, cchPath + 1, uHashPath, fDoReplacements, NULL /*pVirtualApiMod*/); if (pMod) return pMod; kLdrModClose(pLdrMod); } return NULL; } /** * Checks if the given name could be a virtual API module or not. */ static KBOOL kwLdrIsVirtualApiModule(const char *pszName, KSIZE cchName) { if (cchName <= 7) return K_FALSE; switch (*pszName) { default: return K_FALSE; case 'a': case 'A': if (pszName[1] != 'p' && pszName[1] != 'P') return K_FALSE; if (pszName[2] != 'i' && pszName[2] != 'I') return K_FALSE; break; case 'e': case 'E': if (pszName[1] != 'x' && pszName[1] != 'X') return K_FALSE; if (pszName[2] != 't' && pszName[2] != 'T') return K_FALSE; break; } if (pszName[3] != '-') return K_FALSE; if (pszName[4] != 'm' && pszName[4] != 'M') return K_FALSE; if (pszName[5] != 's' && pszName[5] != 'S') return K_FALSE; if (pszName[6] != '-') return K_FALSE; return K_TRUE; } /** * Try load what seems to be a virtual API DLL. * * This is a worker for kwLdrModuleResolveAndLookup and * kwSandbox_Kernel32_LoadLibraryExA_VirtualApiModule. * * @returns Pointer to module on success, NULL on failure. * @param pszName The name of the module. This must be * normalized already! * @param cchName The length of the name. */ static PKWMODULE kwLdrModuleTryLoadVirtualDll(const char *pszName, KSIZE cchName) { HMODULE hModule; /* * Look it up in the hash table. */ KU32 const uHashPath = kwStrHash(pszName); unsigned idxHash = uHashPath % K_ELEMENTS(g_apModules); PKWMODULE pMod = g_apModules[idxHash]; if (pMod) { do { if ( pMod->uHashPath == uHashPath && kHlpStrComp(pMod->pszPath, pszName) == 0) return kwLdrModuleRetain(pMod); pMod = pMod->pNextHash; } while (pMod); } /* * Not found. Try load it. */ hModule = LoadLibraryA(pszName); if (!hModule) { KWLDR_LOG(("kwLdrModuleTryLoadVirtualDll: %s failed (%u)\n", pszName, GetLastError())); return NULL; } /* * Loaded successfully. Create a module for the real module. */ pMod = kwLdrModuleForLoadedNativeByHandle(hModule, K_FALSE /*fEnsureCrtSlot*/, pszName); if (pMod) { /* Create a module for the virtual API name too, unless it is actually a real DLL. */ if (stricmp(&pMod->pszPath[pMod->offFilename], pszName) != 0) { PKLDRMOD pLdrMod; int rc = kLdrModOpenNativeByHandle((KUPTR)hModule, KLDRMOD_OPEN_FLAGS_NATIVE_ALLOW_INIT_TERM, &pLdrMod); if (rc == 0) { PKWMODULE pVirtMod = kwLdrModuleCreateForNativekLdrModule(pLdrMod, pszName, cchName + 1, kwStrHash(pszName), K_FALSE /*fDoReplacements*/, pMod /*pVirtualApiMod*/); if (pVirtMod) { kwLdrModuleRelease(pMod); pMod = pVirtMod; } else { kLdrModClose(pLdrMod); kwErrPrintf("out of memory\n"); } } else kwErrPrintf("kLdrModOpenNativeByHandle failed for %p / '%s': %d\n", hModule, pszName, rc); } else { KWLDR_LOG(("kwLdrModuleTryLoadVirtualDll: %s -> %s - A real DLL!\n", pszName, pMod->pszPath)); /* HACK ALERT! If api-ms-win-crt-* find ucrtbase.dll and attach it as the real module as we cannot make replacements in the virtual API set forward DLLs. */ /** @todo Find a way of scanning the exports and collect forwarder DLLs and * imported DLLs. kLdrModEnumSymbols()? */ if ( pMod->pVirtualApiMod == NULL && kHlpStrNICompAscii(pszName, TUPLE("api-ms-win-crt-")) == 0) { HMODULE hModReal = GetModuleHandleW(L"ucrtbase.dll"); if (hModReal) { PKWMODULE pRealMod = kwLdrModuleForLoadedNativeByHandle(hModReal, K_TRUE /*fEnsureCrtSlot*/, "ucrtbase.dll"); if (pRealMod) { KWLDR_LOG(("kwLdrModuleTryLoadVirtualDll: Linking %s to '%s'.\n", pszName, pRealMod->pszPath)); pMod->pVirtualApiMod = pRealMod; } else KWLDR_LOG(("kwLdrModuleTryLoadVirtualDll: kwLdrModuleForLoadedNativeByHandle failed for ucrtbase.dll/%s!\n", pszName)); } else KWLDR_LOG(("kwLdrModuleTryLoadVirtualDll: no ucrtbase.dll found for %s!\n", pszName)); } } } return pMod; } /** * Sets up the quick zero & copy tables for the non-native module. * * This is a worker for kwLdrModuleCreateNonNative. * * @param pMod The module. */ static void kwLdrModuleCreateNonNativeSetupQuickZeroAndCopy(PKWMODULE pMod) { PCKLDRSEG paSegs = pMod->pLdrMod->aSegments; KU32 cSegs = pMod->pLdrMod->cSegments; KU32 iSeg; KWLDR_LOG(("Setting up quick zero & copy for %s:\n", pMod->pszPath)); pMod->u.Manual.cQuickCopyChunks = 0; pMod->u.Manual.cQuickZeroChunks = 0; for (iSeg = 0; iSeg < cSegs; iSeg++) switch (paSegs[iSeg].enmProt) { case KPROT_READWRITE: case KPROT_WRITECOPY: case KPROT_EXECUTE_READWRITE: case KPROT_EXECUTE_WRITECOPY: if (paSegs[iSeg].cbMapped) { KU32 iChunk = pMod->u.Manual.cQuickCopyChunks; if (iChunk < K_ELEMENTS(pMod->u.Manual.aQuickCopyChunks)) { /* * Check for trailing zero words. */ KSIZE cbTrailingZeros; if ( paSegs[iSeg].cbMapped >= 64 * 2 * sizeof(KSIZE) && (paSegs[iSeg].cbMapped & 7) == 0 && pMod->u.Manual.cQuickZeroChunks < K_ELEMENTS(pMod->u.Manual.aQuickZeroChunks) ) { KSIZE const *pauNatural = (KSIZE const *)&pMod->u.Manual.pbCopy[(KSIZE)paSegs[iSeg].RVA]; KSIZE cNatural = paSegs[iSeg].cbMapped / sizeof(KSIZE); KSIZE idxFirstZero = cNatural; while (idxFirstZero > 0) if (pauNatural[--idxFirstZero] == 0) { /* likely */ } else { idxFirstZero++; break; } cbTrailingZeros = (cNatural - idxFirstZero) * sizeof(KSIZE); if (cbTrailingZeros < 128) cbTrailingZeros = 0; } else cbTrailingZeros = 0; /* * Add quick copy entry. */ if (cbTrailingZeros < paSegs[iSeg].cbMapped) { pMod->u.Manual.aQuickCopyChunks[iChunk].pbDst = &pMod->u.Manual.pbLoad[(KSIZE)paSegs[iSeg].RVA]; pMod->u.Manual.aQuickCopyChunks[iChunk].pbSrc = &pMod->u.Manual.pbCopy[(KSIZE)paSegs[iSeg].RVA]; pMod->u.Manual.aQuickCopyChunks[iChunk].cbToCopy = paSegs[iSeg].cbMapped - cbTrailingZeros; pMod->u.Manual.cQuickCopyChunks = (KU8)(iChunk + 1); KWLDR_LOG(("aQuickCopyChunks[%u]: %#p LB %#" KSIZE_PRI " <- %p (%*.*s)\n", iChunk, pMod->u.Manual.aQuickCopyChunks[iChunk].pbDst, pMod->u.Manual.aQuickCopyChunks[iChunk].cbToCopy, pMod->u.Manual.aQuickCopyChunks[iChunk].pbSrc, paSegs[iSeg].cchName, paSegs[iSeg].cchName, paSegs[iSeg].pchName)); } /* * Add quick zero entry. */ if (cbTrailingZeros) { KU32 iZero = pMod->u.Manual.cQuickZeroChunks; pMod->u.Manual.aQuickZeroChunks[iZero].pbDst = pMod->u.Manual.aQuickCopyChunks[iChunk].pbDst + pMod->u.Manual.aQuickCopyChunks[iChunk].cbToCopy; pMod->u.Manual.aQuickZeroChunks[iZero].cbToZero = cbTrailingZeros; pMod->u.Manual.cQuickZeroChunks = (KU8)(iZero + 1); KWLDR_LOG(("aQuickZeroChunks[%u]: %#p LB %#" KSIZE_PRI " <- zero (%*.*s)\n", iZero, pMod->u.Manual.aQuickZeroChunks[iZero].pbDst, pMod->u.Manual.aQuickZeroChunks[iZero].cbToZero, paSegs[iSeg].cchName, paSegs[iSeg].cchName, paSegs[iSeg].pchName)); } } else { /* * We're out of quick copy table entries, so just copy the whole darn thing. * We cannot 104% guarantee that the segments are in mapping order, so this is simpler. */ kHlpAssertFailed(); pMod->u.Manual.aQuickCopyChunks[0].pbDst = pMod->u.Manual.pbLoad; pMod->u.Manual.aQuickCopyChunks[0].pbSrc = pMod->u.Manual.pbCopy; pMod->u.Manual.aQuickCopyChunks[0].cbToCopy = pMod->cbImage; pMod->u.Manual.cQuickCopyChunks = 1; KWLDR_LOG(("Quick copy not possible!\n")); return; } } break; default: break; } } /** * Called from the TLS allocation DLL when ever the native loader wants to issue * a TLS callback after the initial kwLdrTlsAllocationHook callout. * * @param hDll The DLL handle. * @param dwReason The callback reason. * @param pvContext Some context value that seems to always be NULL. * @param pMod Out internal module. */ static void kwLdrTlsNativeLoaderCallback(void *hDll, DWORD dwReason, void *pvContext, PKWMODULE pMod) { if ( pMod && pMod->u.Manual.enmState == KWMODSTATE_READY) { KWLDR_LOG(("kwLdrTlsNativeLoaderCallback: hDll=%p dwReason=%#x pvContext=%p pMod=%p\n", hDll, dwReason, pvContext, pMod)); if (pMod->u.Manual.cTlsCallbacks) { PIMAGE_TLS_CALLBACK *ppfnCallback = (PIMAGE_TLS_CALLBACK *)&pMod->u.Manual.pbLoad[pMod->u.Manual.offTlsCallbacks]; do { KWLDR_LOG(("kwLdrTlsNativeLoaderCallback: Calling TLS callback %p(%p, %#x, %p) - %s\n", *ppfnCallback, pMod->hOurMod, dwReason, pvContext, pMod->pszPath)); (*ppfnCallback)(pMod->hOurMod, dwReason, pvContext); ppfnCallback++; } while (*ppfnCallback); } } else KWLDR_LOG(("kwLdrTlsNativeLoaderCallback: hDll=%p dwReason=%#x pvContext=%p pMod=%p - skipped\n", hDll, dwReason, pvContext, pMod)); } /** * Called from TLS allocation DLL during DLL_PROCESS_ATTACH. * * @returns Address of the callback function (kwLdrTlsNativeLoaderCallback). * @param hDll The DLL handle. * @param idxTls The allocated TLS index. * @param pabInitData The init data in the TLS allocation DLL * (g_abInitData). * @param ppWorkerModuleVar Pointer to the variable holding the pMod * callback parameter value (g_pvWorkerModule). * * @see KWLDRTLSALLOCATIONHOOK in kWorkerTlsXxxxK.c */ __declspec(dllexport) KUPTR kwLdrTlsAllocationHook(void *hDll, ULONG idxTls, KU8 *pabInitData, PKWMODULE *ppWorkerModuleVar) { /* * Do the module initialization thing first. */ PKWMODULE pMod = g_pModPendingTlsAlloc; if (pMod) { if ( pMod->u.Manual.idxTls == KU32_MAX && pMod->u.Manual.pabTlsInitData == NULL) { pMod->u.Manual.idxTls = idxTls; pMod->u.Manual.pabTlsInitData = pabInitData; pMod->u.Manual.ppTlsWorkerModuleVar = ppWorkerModuleVar; KWLDR_LOG(("kwLdrTlsAllocationHook: idxTls=%d (%#x) for %s\n", idxTls, idxTls, pMod->pszPath)); #if 0 /** @todo this doesn't work W10 18363 */ { /* * Try sabotage the DLL name so we can load this module again. */ PPEB pPeb = kwSandboxGetProcessEnvironmentBlock(); LIST_ENTRY *pHead; LIST_ENTRY *pCur; pHead = &pPeb->Ldr->InMemoryOrderModuleList; for (pCur = pHead->Blink; pCur != pHead; pCur = pCur->Blink) { LDR_DATA_TABLE_ENTRY *pMte; pMte = (LDR_DATA_TABLE_ENTRY *)((KUPTR)pCur - K_OFFSETOF(LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks)); if (((KUPTR)pMte->DllBase & ~(KUPTR)31) == ((KUPTR)hDll & ~(KUPTR)31)) { PUNICODE_STRING pStr = &pMte->FullDllName; KSIZE off = pStr->Length / sizeof(pStr->Buffer[0]); pStr->Buffer[--off]++; pStr->Buffer[--off]++; pStr->Buffer[--off]++; KWLDR_LOG(("kwLdrTlsAllocationHook: patched the MTE (%p) for %p\n", pMte, hDll)); break; } } } #endif /* * Don't return a callback function unless the module has callbacks to service. */ if (pMod->u.Manual.cTlsCallbacks > 0) { *ppWorkerModuleVar = pMod; return (KUPTR)kwLdrTlsNativeLoaderCallback; } return 0; } KWLDR_LOG(("kwLdrTlsAllocationHook: WTF? pMod=%p: idxTls=%#x pabTlsInitData=%p\n", pMod, pMod->u.Manual.idxTls, pMod->u.Manual.pabTlsInitData)); } return 0; } /** * Allocates and initializes TLS variables. * * @returns 0 on success, non-zero failure. * @param pMod The module. */ static int kwLdrModuleCreateNonNativeSetupTls(PKWMODULE pMod) { KU8 *pbImg = (KU8 *)pMod->u.Manual.pbCopy; IMAGE_NT_HEADERS const *pNtHdrs; IMAGE_DATA_DIRECTORY const *pTlsDir; if (((PIMAGE_DOS_HEADER)pbImg)->e_magic == IMAGE_DOS_SIGNATURE) pNtHdrs = (PIMAGE_NT_HEADERS)&pbImg[((PIMAGE_DOS_HEADER)pbImg)->e_lfanew]; else pNtHdrs = (PIMAGE_NT_HEADERS)pbImg; kHlpAssert(pNtHdrs->Signature == IMAGE_NT_SIGNATURE); pTlsDir = &pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS]; if (pTlsDir->Size >= sizeof(IMAGE_TLS_DIRECTORY)) { PIMAGE_TLS_DIRECTORY const paEntries = (PIMAGE_TLS_DIRECTORY)&pbImg[pTlsDir->VirtualAddress]; KU32 const cEntries = pTlsDir->Size / sizeof(IMAGE_TLS_DIRECTORY); KU32 iEntry; KU32 iTlsDll; KU32 iTlsDllSub; KUPTR offIndex; KUPTR offCallbacks; KUPTR const *puCallbacks; KSIZE cbData; const wchar_t *pwszTlsDll; HMODULE hmodTlsDll; /* * Check and log. */ for (iEntry = 0; iEntry < cEntries; iEntry++) { KUPTR offIndex = (KUPTR)paEntries[iEntry].AddressOfIndex - (KUPTR)pMod->u.Manual.pbLoad; KUPTR offCallbacks = (KUPTR)paEntries[iEntry].AddressOfCallBacks - (KUPTR)pMod->u.Manual.pbLoad; KUPTR const *puCallbacks = (KUPTR const *)&pbImg[offCallbacks]; KWLDR_LOG(("TLS DIR #%u: %#x-%#x idx=@%#x (%#x) callbacks=@%#x (%#x) cbZero=%#x flags=%#x\n", iEntry, paEntries[iEntry].StartAddressOfRawData, paEntries[iEntry].EndAddressOfRawData, paEntries[iEntry].AddressOfIndex, offIndex, paEntries[iEntry].AddressOfCallBacks, offCallbacks, paEntries[iEntry].SizeOfZeroFill, paEntries[iEntry].Characteristics)); if (offIndex >= pMod->cbImage) { kwErrPrintf("TLS entry #%u in %s has an invalid index address: %p, RVA %p, image size %#x\n", iEntry, pMod->pszPath, paEntries[iEntry].AddressOfIndex, offIndex, pMod->cbImage); return -1; } if (offCallbacks >= pMod->cbImage) { kwErrPrintf("TLS entry #%u in %s has an invalid callbacks address: %p, RVA %p, image size %#x\n", iEntry, pMod->pszPath, paEntries[iEntry].AddressOfCallBacks, offCallbacks, pMod->cbImage); return -1; } while (*puCallbacks != 0) { KWLDR_LOG(("TLS DIR #%u: callback %p, RVA %#x\n", iEntry, *puCallbacks, *puCallbacks - (KUPTR)pMod->u.Manual.pbLoad)); puCallbacks++; } if (paEntries[iEntry].Characteristics > IMAGE_SCN_ALIGN_16BYTES) { kwErrPrintf("TLS entry #%u in %s has an unsupported alignment restriction: %#x\n", iEntry, pMod->pszPath, paEntries[iEntry].Characteristics); return -1; } } if (cEntries > 1) { kwErrPrintf("More than one TLS directory entry in %s: %u\n", pMod->pszPath, cEntries); return -1; } /* * Make the allocation by loading a new instance of one of the TLS dlls. * The DLL will make a call to kwLdrTlsAllocationHook. */ offIndex = (KUPTR)paEntries[0].AddressOfIndex - (KUPTR)pMod->u.Manual.pbLoad; offCallbacks = (KUPTR)paEntries[0].AddressOfCallBacks - (KUPTR)pMod->u.Manual.pbLoad; puCallbacks = (KUPTR const *)&pbImg[offCallbacks]; cbData = paEntries[0].SizeOfZeroFill + (paEntries[0].EndAddressOfRawData - paEntries[0].StartAddressOfRawData); /** @todo find better strategy here. Like temporary copy or whatever when * there is more than a single user. */ for (iTlsDll = 0; cbData > g_aTlsDlls[iTlsDll].cbTls;) if (++iTlsDll >= K_ELEMENTS(g_aTlsDlls)) { kwErrPrintf("TLS data size in %s is too big: %u (%#p), max 512KB\n", pMod->pszPath, (unsigned)cbData, cbData); return -1; } for (iTlsDllSub = 0; g_aTlsDlls[iTlsDll].paDlls[iTlsDllSub].fUsed;) if (++iTlsDllSub >= g_aTlsDlls[iTlsDll].cDlls) { kwErrPrintf("No unused TLS DLLs for %s of size %u!\n", pMod->pszPath, (unsigned)cbData); return -1; } g_aTlsDlls[iTlsDll].paDlls[iTlsDllSub].fUsed = K_TRUE; pwszTlsDll = g_aTlsDlls[iTlsDll].paDlls[iTlsDllSub].pwszName; pMod->u.Manual.pabTlsInitData = NULL; pMod->u.Manual.ppTlsWorkerModuleVar = NULL; pMod->u.Manual.idxTls = KU32_MAX; pMod->u.Manual.offTlsInitData = (KU32)((KUPTR)paEntries[0].StartAddressOfRawData - (KUPTR)pMod->u.Manual.pbLoad); pMod->u.Manual.cbTlsInitData = (KU32)(paEntries[0].EndAddressOfRawData - paEntries[0].StartAddressOfRawData); pMod->u.Manual.cbTlsAlloc = (KU32)cbData; pMod->u.Manual.cTlsCallbacks = 0; while (puCallbacks[pMod->u.Manual.cTlsCallbacks] != 0) pMod->u.Manual.cTlsCallbacks++; pMod->u.Manual.offTlsCallbacks = pMod->u.Manual.cTlsCallbacks ? (KU32)offCallbacks : KU32_MAX; g_pModPendingTlsAlloc = pMod; hmodTlsDll = LoadLibraryExW(pwszTlsDll, NULL /*hFile*/, 0); g_pModPendingTlsAlloc = NULL; if (hmodTlsDll == NULL) { kwErrPrintf("TLS allocation failed for '%s': LoadLibraryExW(%ls) -> %u\n", pMod->pszPath, pwszTlsDll, GetLastError()); return -1; } if (pMod->u.Manual.idxTls == KU32_MAX) { kwErrPrintf("TLS allocation failed for '%s': idxTls = KU32_MAX\n", pMod->pszPath, GetLastError()); return -1; } *(KU32 *)&pMod->u.Manual.pbCopy[offIndex] = pMod->u.Manual.idxTls; KWLDR_LOG(("kwLdrModuleCreateNonNativeSetupTls: idxTls=%d hmodTlsDll=%p (%ls) cbData=%#x pabTlsInitData=%p\n", pMod->u.Manual.idxTls, hmodTlsDll, pwszTlsDll, cbData, pMod->u.Manual.pabTlsInitData)); kHlpAssert(pMod->u.Manual.pabTlsInitData); if (pMod->u.Manual.pabTlsInitData && pMod->u.Manual.cbTlsInitData) kHlpMemCopy(pMod->u.Manual.pabTlsInitData, &pMod->u.Manual.pbCopy[pMod->u.Manual.offTlsInitData], pMod->u.Manual.cbTlsInitData); } return 0; } /** * Creates a module using the our own loader. * * @returns Module w/ 1 reference on success, NULL on failure. * @param pszPath The normalized path to the module. * @param uHashPath The module path hash. * @param fExe K_TRUE if this is an executable image, K_FALSE * if not. Executable images does not get entered * into the global module table. * @param pExeMod The executable module of the process (for * resolving imports). NULL if fExe is set. * @param pszSearchPath The PATH to search for imports. Can be NULL. */ static PKWMODULE kwLdrModuleCreateNonNative(const char *pszPath, KU32 uHashPath, KBOOL fExe, PKWMODULE pExeMod, const char *pszSearchPath) { /* * Open the module and check the type. */ PKLDRMOD pLdrMod; int rc = kLdrModOpen(pszPath, 0 /*fFlags*/, (KCPUARCH)K_ARCH, &pLdrMod); if (rc == 0) { switch (pLdrMod->enmType) { case KLDRTYPE_EXECUTABLE_FIXED: case KLDRTYPE_EXECUTABLE_RELOCATABLE: case KLDRTYPE_EXECUTABLE_PIC: if (!fExe) rc = KERR_GENERAL_FAILURE; break; case KLDRTYPE_SHARED_LIBRARY_RELOCATABLE: case KLDRTYPE_SHARED_LIBRARY_PIC: case KLDRTYPE_SHARED_LIBRARY_FIXED: if (fExe) rc = KERR_GENERAL_FAILURE; break; default: rc = KERR_GENERAL_FAILURE; kwErrPrintf("kwLdrModuleCreateNonNative: Unsupported module type %d (%s)!\n", pLdrMod->enmType, pszPath); break; } if (rc == 0) { KI32 cImports = kLdrModNumberOfImports(pLdrMod, NULL /*pvBits*/); if (cImports >= 0) { /* * Create the entry. */ KSIZE cbPath = kHlpStrLen(pszPath) + 1; PKWMODULE pMod = (PKWMODULE)kHlpAllocZ(sizeof(*pMod) + sizeof(pMod) * cImports + cbPath + cbPath * 2 * sizeof(wchar_t)); if (pMod) { KBOOL fFixed; pMod->cRefs = 1; pMod->offFilename = (KU16)(kHlpGetFilename(pszPath) - pszPath); pMod->uHashPath = uHashPath; pMod->fExe = fExe; pMod->fNative = K_FALSE; pMod->pLdrMod = pLdrMod; pMod->iCrtSlot = KU8_MAX; pMod->fNeedReInit = K_FALSE; pMod->fReInitOnMsPdbSrvEndpointChange = K_FALSE; pMod->pszMsPdbSrvEndpoint = NULL; pMod->u.Manual.cImpMods = (KU32)cImports; #if defined(KBUILD_OS_WINDOWS) && defined(KBUILD_ARCH_AMD64) pMod->u.Manual.fRegisteredFunctionTable = K_FALSE; #endif pMod->u.Manual.fUseLdBuf = K_FALSE; pMod->u.Manual.fCanDoQuick = K_FALSE; pMod->u.Manual.cQuickZeroChunks = 0; pMod->u.Manual.cQuickCopyChunks = 0; pMod->u.Manual.pabTlsInitData = NULL; pMod->u.Manual.ppTlsWorkerModuleVar = NULL; pMod->u.Manual.idxTls = KU32_MAX; pMod->u.Manual.offTlsInitData = KU32_MAX; pMod->u.Manual.cbTlsInitData = 0; pMod->u.Manual.cbTlsAlloc = 0; pMod->u.Manual.cTlsCallbacks = 0; pMod->u.Manual.offTlsCallbacks = 0; pMod->pszPath = (char *)kHlpMemCopy(&pMod->u.Manual.apImpMods[cImports + 1], pszPath, cbPath); pMod->pwszPath = (wchar_t *)(pMod->pszPath + cbPath + (cbPath & 1)); kwStrToUtf16(pMod->pszPath, (wchar_t *)pMod->pwszPath, cbPath * 2); pMod->offFilenameW = (KU16)(kwPathGetFilenameW(pMod->pwszPath) - pMod->pwszPath); /* * Figure out where to load it and get memory there. */ fFixed = pLdrMod->enmType == KLDRTYPE_EXECUTABLE_FIXED || pLdrMod->enmType == KLDRTYPE_SHARED_LIBRARY_FIXED; pMod->u.Manual.pbLoad = fFixed ? (KU8 *)(KUPTR)pLdrMod->aSegments[0].LinkAddress : NULL; pMod->cbImage = (KSIZE)kLdrModSize(pLdrMod); if ( !fFixed || pLdrMod->enmType != KLDRTYPE_EXECUTABLE_FIXED /* only allow fixed executables */ || (KUPTR)pMod->u.Manual.pbLoad - (KUPTR)g_abDefLdBuf >= sizeof(g_abDefLdBuf) || sizeof(g_abDefLdBuf) - (KUPTR)pMod->u.Manual.pbLoad - (KUPTR)g_abDefLdBuf < pMod->cbImage) rc = kHlpPageAlloc((void **)&pMod->u.Manual.pbLoad, pMod->cbImage, KPROT_EXECUTE_READWRITE, fFixed); else pMod->u.Manual.fUseLdBuf = K_TRUE; if (rc == 0) { rc = kHlpPageAlloc(&pMod->u.Manual.pbCopy, pMod->cbImage, KPROT_READWRITE, K_FALSE); if (rc == 0) { KI32 iImp; KU32 cchReloads; /* * Link the module (unless it's an executable image) and process the imports. */ pMod->hOurMod = (HMODULE)pMod->u.Manual.pbLoad; kwLdrModuleLink(pMod); KWLDR_LOG(("New module: %p LB %#010x %s (kLdr)\n", pMod->u.Manual.pbLoad, pMod->cbImage, pMod->pszPath)); KWLDR_LOG(("TODO: .reload /f %s=%p\n", pMod->pszPath, pMod->u.Manual.pbLoad)); kwDebuggerPrintf("TODO: .reload /f %s=%p\n", pMod->pszPath, pMod->u.Manual.pbLoad); cchReloads = g_cchReloads; if (cchReloads + 80 < sizeof(g_szReloads)) { cchReloads += _snprintf(&g_szReloads[cchReloads], sizeof(g_szReloads) - cchReloads, "%s.reload /f %s=%p\n", cchReloads ? "; " : "", pMod->pszPath, pMod->u.Manual.pbLoad); g_cchReloads = cchReloads; } for (iImp = 0; iImp < cImports; iImp++) { char szName[1024]; rc = kLdrModGetImport(pMod->pLdrMod, NULL /*pvBits*/, iImp, szName, sizeof(szName)); if (rc == 0) { rc = kwLdrModuleResolveAndLookup(szName, pExeMod, pMod, pszSearchPath, &pMod->u.Manual.apImpMods[iImp]); if (rc == 0) continue; } kwErrPrintf("Error getting import '%s' for '%s': %d (%u)\n", szName, pMod->pszPath, rc, GetLastError()); break; } if (rc == 0) { rc = kLdrModGetBits(pLdrMod, pMod->u.Manual.pbCopy, (KUPTR)pMod->u.Manual.pbLoad, kwLdrModuleGetImportCallback, pMod); if (rc == 0) { #if defined(KBUILD_OS_WINDOWS) && defined(KBUILD_ARCH_AMD64) /* * Find the function table. No validation here because the * loader did that already, right... */ KU8 *pbImg = (KU8 *)pMod->u.Manual.pbCopy; IMAGE_NT_HEADERS const *pNtHdrs; IMAGE_DATA_DIRECTORY const *pXcptDir; if (((PIMAGE_DOS_HEADER)pbImg)->e_magic == IMAGE_DOS_SIGNATURE) pNtHdrs = (PIMAGE_NT_HEADERS)&pbImg[((PIMAGE_DOS_HEADER)pbImg)->e_lfanew]; else pNtHdrs = (PIMAGE_NT_HEADERS)pbImg; pXcptDir = &pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION]; kHlpAssert(pNtHdrs->Signature == IMAGE_NT_SIGNATURE); if (pXcptDir->Size > 0) { pMod->u.Manual.cFunctions = pXcptDir->Size / sizeof(pMod->u.Manual.paFunctions[0]); kHlpAssert( pMod->u.Manual.cFunctions * sizeof(pMod->u.Manual.paFunctions[0]) == pXcptDir->Size); pMod->u.Manual.paFunctions = (PRUNTIME_FUNCTION)&pbImg[pXcptDir->VirtualAddress]; } else { pMod->u.Manual.cFunctions = 0; pMod->u.Manual.paFunctions = NULL; } #endif kwLdrModuleCreateNonNativeSetupQuickZeroAndCopy(pMod); rc = kwLdrModuleCreateNonNativeSetupTls(pMod); if (rc == 0) { /* * Final finish. */ pMod->u.Manual.pvBits = pMod->u.Manual.pbCopy; pMod->u.Manual.enmState = KWMODSTATE_NEEDS_BITS; pMod->u.Manual.enmReInitState = KWMODSTATE_NEEDS_BITS; if ( g_Sandbox.pTool && ( g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_CL || g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_LINK) && !pMod->fExe) pMod->u.Manual.enmReInitState = KWMODSTATE_READY; g_cModules++; g_cNonNativeModules++; return pMod; } kwErrPrintf("kwLdrModuleCreateNonNativeSetupTls failed with %d for %s\n", rc, pMod->pszPath); } else kwErrPrintf("kLdrModGetBits failed for %s: %#x (%d)\n", pszPath, rc, rc); } kwLdrModuleRelease(pMod); return NULL; } kHlpPageFree(pMod->u.Manual.pbLoad, pMod->cbImage); kwErrPrintf("Failed to allocate %#x bytes\n", pMod->cbImage); } else if (fFixed) kwErrPrintf("Failed to allocate %#x bytes at %p\n", pMod->cbImage, (void *)(KUPTR)pLdrMod->aSegments[0].LinkAddress); else kwErrPrintf("Failed to allocate %#x bytes\n", pMod->cbImage); } else kwErrPrintf("kwLdrModuleCreateNonNative: out of memory!\n"); } else kwErrPrintf("kwLdrModuleCreateNonNative: kLdrModNumberOfImports failed for '%s'\n", pszPath); } kLdrModClose(pLdrMod); } else kwErrPrintf("kLdrOpen failed with %#x (%d) for %s\n", rc, rc, pszPath); return NULL; } /** Implements FNKLDRMODGETIMPORT, used by kwLdrModuleCreate. */ static int kwLdrModuleGetImportCallback(PKLDRMOD pMod, KU32 iImport, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PKLDRADDR puValue, KU32 *pfKind, void *pvUser) { PKWMODULE pCurMod = (PKWMODULE)pvUser; PKWMODULE pImpMod = pCurMod->u.Manual.apImpMods[iImport]; int rc; K_NOREF(pMod); if (pImpMod->fNative) rc = kLdrModQuerySymbol(pImpMod->pLdrMod, NULL /*pvBits*/, KLDRMOD_BASEADDRESS_MAP, iSymbol, pchSymbol, cchSymbol, pszVersion, NULL /*pfnGetForwarder*/, NULL /*pvUSer*/, puValue, pfKind); else rc = kLdrModQuerySymbol(pImpMod->pLdrMod, pImpMod->u.Manual.pvBits, (KUPTR)pImpMod->u.Manual.pbLoad, iSymbol, pchSymbol, cchSymbol, pszVersion, NULL /*pfnGetForwarder*/, NULL /*pvUSer*/, puValue, pfKind); if (rc == 0) { KU32 i = g_cSandboxReplacements; while (i-- > 0) if ( g_aSandboxReplacements[i].cchFunction == cchSymbol && kHlpMemComp(g_aSandboxReplacements[i].pszFunction, pchSymbol, cchSymbol) == 0) { if ( !g_aSandboxReplacements[i].pszModule || kHlpStrICompAscii(g_aSandboxReplacements[i].pszModule, &pImpMod->pszPath[pImpMod->offFilename]) == 0) { if ( pCurMod->fExe || !g_aSandboxReplacements[i].fOnlyExe) { KWLDR_LOG(("replacing %s!%s\n",&pImpMod->pszPath[pImpMod->offFilename], g_aSandboxReplacements[i].pszFunction)); if (!g_aSandboxReplacements[i].fCrtSlotArray) *puValue = g_aSandboxReplacements[i].pfnReplacement; else { if (pImpMod->iCrtSlot == KU8_MAX) { rc = kwLdrModuleCreateCrtSlot(pImpMod); if (rc) KWLDR_LOG(("kwLdrModuleGetImportCallback: kwLdrModuleCreateCrtSlot failed: %d\n", rc)); } *puValue = ((KUPTR *)g_aSandboxReplacements[i].pfnReplacement)[pImpMod->iCrtSlot]; } } break; } } } //printf("iImport=%u (%s) %*.*s rc=%d\n", iImport, &pImpMod->pszPath[pImpMod->offFilename], cchSymbol, cchSymbol, pchSymbol, rc); KWLDR_LOG(("iImport=%u (%s) %*.*s rc=%d\n", iImport, &pImpMod->pszPath[pImpMod->offFilename], cchSymbol, cchSymbol, pchSymbol, rc)); return rc; } /** * Gets the main entrypoint for a module. * * @returns 0 on success, KERR on failure * @param pMod The module. * @param puAddrMain Where to return the address. */ static int kwLdrModuleQueryMainEntrypoint(PKWMODULE pMod, KUPTR *puAddrMain) { KLDRADDR uLdrAddrMain; int rc = kLdrModQueryMainEntrypoint(pMod->pLdrMod, pMod->u.Manual.pvBits, (KUPTR)pMod->u.Manual.pbLoad, &uLdrAddrMain); if (rc == 0) { *puAddrMain = (KUPTR)uLdrAddrMain; return 0; } return rc; } /** * Whether to apply g_aSandboxNativeReplacements to the imports of this module. * * @returns K_TRUE/K_FALSE. * @param pszFilename The filename (no path). * @param enmLocation The location. */ static KBOOL kwLdrModuleShouldDoNativeReplacements(const char *pszFilename, KWLOCATION enmLocation) { if (enmLocation != KWLOCATION_SYSTEM32) return K_TRUE; return kHlpStrNICompAscii(pszFilename, TUPLE("msvc")) == 0 || kHlpStrNICompAscii(pszFilename, TUPLE("msdis")) == 0 || kHlpStrNICompAscii(pszFilename, TUPLE("mspdb")) == 0 || kHlpStrNICompAscii(pszFilename, TUPLE("vcruntime")) == 0 || kHlpStrNICompAscii(pszFilename, TUPLE("ucrtbase")) == 0 || kHlpStrNICompAscii(pszFilename, TUPLE("api-ms-win-crt-")) == 0 #if 0 /* for debugging, only for debugging. */ || kHlpStrICompAscii(pszFilename, "c1.dll") == 0 || kHlpStrICompAscii(pszFilename, "c1xx.dll") == 0 || kHlpStrICompAscii(pszFilename, "c2.dll") == 0 #endif ; } /** * Lazily initializes the g_pWinSys32 variable. */ static PKFSDIR kwLdrResolveWinSys32(void) { KFSLOOKUPERROR enmError; PKFSDIR pWinSys32; /* Get the path first. */ char szSystem32[MAX_PATH]; if (GetSystemDirectoryA(szSystem32, sizeof(szSystem32)) >= sizeof(szSystem32)) { kwErrPrintf("GetSystemDirectory failed: %u\n", GetLastError()); strcpy(szSystem32, "C:\\Windows\\System32"); } /* Look it up and verify it. */ pWinSys32 = (PKFSDIR)kFsCacheLookupA(g_pFsCache, szSystem32, &enmError); if (pWinSys32) { if (pWinSys32->Obj.bObjType == KFSOBJ_TYPE_DIR) { g_pWinSys32 = pWinSys32; return pWinSys32; } kwErrPrintf("System directory '%s' isn't of 'DIR' type: %u\n", szSystem32, g_pWinSys32->Obj.bObjType); } else kwErrPrintf("Failed to lookup system directory '%s': %u\n", szSystem32, enmError); return NULL; } /** * Whether we can load this DLL natively or not. * * @returns K_TRUE/K_FALSE. * @param pszFilename The filename (no path). * @param enmLocation The location. * @param pszFullPath The full filename and path. */ static KBOOL kwLdrModuleCanLoadNatively(const char *pszFilename, KWLOCATION enmLocation, const char *pszFullPath) { if (enmLocation == KWLOCATION_SYSTEM32) return K_TRUE; if (enmLocation == KWLOCATION_UNKNOWN_NATIVE) return K_TRUE; if ( enmLocation == KWLOCATION_UNKNOWN && kwLdrIsVirtualApiModule(pszFilename, kHlpStrLen(pszFilename))) return K_TRUE; /* If the location is unknown, we must check if it's some dynamic loading of a SYSTEM32 DLL with a full path. We do not want to load these ourselves! */ if (enmLocation == KWLOCATION_UNKNOWN) { PKFSDIR pWinSys32 = g_pWinSys32; if (!pWinSys32) pWinSys32 = kwLdrResolveWinSys32(); if (pWinSys32) { KFSLOOKUPERROR enmError; PKFSOBJ pFsObj = kFsCacheLookupA(g_pFsCache, pszFullPath, &enmError); if (pFsObj) { KBOOL fInWinSys32 = pFsObj->pParent == pWinSys32; kFsCacheObjRelease(g_pFsCache, pFsObj); if (fInWinSys32) return K_TRUE; } } } return kHlpStrNICompAscii(pszFilename, TUPLE("msvc")) == 0 || kHlpStrNICompAscii(pszFilename, TUPLE("msdis")) == 0 || kHlpStrNICompAscii(pszFilename, TUPLE("mspdb")) == 0 || kHlpStrNICompAscii(pszFilename, TUPLE("tbbmalloc")) == 0 || kHlpStrNICompAscii(pszFilename, TUPLE("ucrtbase")) == 0 || kHlpStrNICompAscii(pszFilename, TUPLE("vcruntime")) == 0 || ( enmLocation != KWLOCATION_UNKNOWN && kwLdrIsVirtualApiModule(pszFilename, kHlpStrLen(pszFilename))) #if 0 /* for debugging, only for debugging. */ //|| kHlpStrICompAscii(pszFilename, "c1.dll") == 0 //|| kHlpStrICompAscii(pszFilename, "c1xx.dll") == 0 //|| kHlpStrICompAscii(pszFilename, "c2.dll") == 0 #endif ; } /** * Check if the path leads to a regular file (that exists). * * @returns K_TRUE / K_FALSE * @param pszPath Path to the file to check out. */ static KBOOL kwLdrModuleIsRegularFile(const char *pszPath) { /* For stuff with .DLL extensions, we can use the GetFileAttribute cache to speed this up! */ KSIZE cchPath = kHlpStrLen(pszPath); if ( cchPath > 3 && pszPath[cchPath - 4] == '.' && (pszPath[cchPath - 3] == 'd' || pszPath[cchPath - 3] == 'D') && (pszPath[cchPath - 2] == 'l' || pszPath[cchPath - 2] == 'L') && (pszPath[cchPath - 1] == 'l' || pszPath[cchPath - 1] == 'L') ) { KFSLOOKUPERROR enmError; PKFSOBJ pFsObj = kFsCacheLookupNoMissingA(g_pFsCache, pszPath, &enmError); if (pFsObj) { KBOOL fRc = pFsObj->bObjType == KFSOBJ_TYPE_FILE; kFsCacheObjRelease(g_pFsCache, pFsObj); return fRc; } } else { BirdStat_T Stat; int rc = birdStatFollowLink(pszPath, &Stat); if (rc == 0) { if (S_ISREG(Stat.st_mode)) return K_TRUE; } } return K_FALSE; } /** * Worker for kwLdrModuleResolveAndLookup that checks out one possibility. * * If the file exists, we consult the module hash table before trying to load it * off the disk. * * @returns Pointer to module on success, NULL if not found, ~(KUPTR)0 on * failure. * @param pszPath The name of the import module. * @param enmLocation The location we're searching. This is used in * the heuristics for determining if we can use the * native loader or need to sandbox the DLL. * @param pExe The executable (optional). * @param pszSearchPath The PATH to search (optional). */ static PKWMODULE kwLdrModuleTryLoadDll(const char *pszPath, KWLOCATION enmLocation, PKWMODULE pExeMod, const char *pszSearchPath) { /* * Does the file exists and is it a regular file? */ if (kwLdrModuleIsRegularFile(pszPath)) { /* * Yes! Normalize it and look it up in the hash table. */ char szNormPath[1024]; int rc = kwPathNormalize(pszPath, szNormPath, sizeof(szNormPath)); if (rc == 0) { const char *pszName; KU32 const uHashPath = kwStrHash(szNormPath); unsigned idxHash = uHashPath % K_ELEMENTS(g_apModules); PKWMODULE pMod = g_apModules[idxHash]; if (pMod) { do { if ( pMod->uHashPath == uHashPath && kHlpStrComp(pMod->pszPath, szNormPath) == 0) return kwLdrModuleRetain(pMod); pMod = pMod->pNextHash; } while (pMod); } /* * Not in the hash table, so we have to load it from scratch. */ pszName = kHlpGetFilename(szNormPath); if (kwLdrModuleCanLoadNatively(pszName, enmLocation, szNormPath)) pMod = kwLdrModuleCreateNative(szNormPath, uHashPath, kwLdrModuleShouldDoNativeReplacements(pszName, enmLocation)); else pMod = kwLdrModuleCreateNonNative(szNormPath, uHashPath, K_FALSE /*fExe*/, pExeMod, pszSearchPath); if (pMod) return pMod; return (PKWMODULE)~(KUPTR)0; } } return NULL; } /** * Gets a reference to the module by the given name. * * We must do the search path thing, as our hash table may multiple DLLs with * the same base name due to different tools version and similar. We'll use a * modified search sequence, though. No point in searching the current * directory for instance. * * @returns 0 on success, KERR on failure. * @param pszName The name of the import module. * @param pExe The executable (optional). * @param pImporter The module doing the importing (optional). * @param pszSearchPath The PATH to search (optional). * @param ppMod Where to return the module pointer w/ reference. */ static int kwLdrModuleResolveAndLookup(const char *pszName, PKWMODULE pExe, PKWMODULE pImporter, const char *pszSearchPath, PKWMODULE *ppMod) { KSIZE const cchName = kHlpStrLen(pszName); char szPath[1024]; char *psz; PKWMODULE pMod = NULL; KBOOL fNeedSuffix = *kHlpGetExt(pszName) == '\0' && kHlpGetFilename(pszName) == pszName; KSIZE cchSuffix = fNeedSuffix ? 4 : 0; /* Virtual API module. Normalize and try load it. */ if (pMod == NULL && cchName > 7 && kwLdrIsVirtualApiModule(pszName, cchName)) { if (cchName + cchSuffix >= sizeof(szPath)) return KERR_BUFFER_OVERFLOW; kHlpMemCopy(szPath, pszName, cchName); if (fNeedSuffix) kHlpMemCopy(&szPath[cchName], ".dll", sizeof(".dll")); szPath[cchName + cchSuffix] = '\0'; _strlwr(szPath); pMod = kwLdrModuleTryLoadVirtualDll(szPath, cchName + cchSuffix); } /* The import path. */ if (pMod == NULL && pImporter != NULL) { if (pImporter->offFilename + cchName + cchSuffix >= sizeof(szPath)) return KERR_BUFFER_OVERFLOW; psz = (char *)kHlpMemPCopy(kHlpMemPCopy(szPath, pImporter->pszPath, pImporter->offFilename), pszName, cchName + 1); if (fNeedSuffix) kHlpMemCopy(psz - 1, ".dll", sizeof(".dll")); pMod = kwLdrModuleTryLoadDll(szPath, KWLOCATION_IMPORTER_DIR, pExe, pszSearchPath); } /* Application directory first. */ if (pMod == NULL && pExe != NULL && pExe != pImporter) { if (pExe->offFilename + cchName + cchSuffix >= sizeof(szPath)) return KERR_BUFFER_OVERFLOW; psz = (char *)kHlpMemPCopy(kHlpMemPCopy(szPath, pExe->pszPath, pExe->offFilename), pszName, cchName + 1); if (fNeedSuffix) kHlpMemCopy(psz - 1, ".dll", sizeof(".dll")); pMod = kwLdrModuleTryLoadDll(szPath, KWLOCATION_EXE_DIR, pExe, pszSearchPath); } /* The windows directory. */ if (pMod == NULL) { UINT cchDir = GetSystemDirectoryA(szPath, sizeof(szPath)); if ( cchDir <= 2 || cchDir + 1 + cchName + cchSuffix >= sizeof(szPath)) return KERR_BUFFER_OVERFLOW; szPath[cchDir++] = '\\'; psz = (char *)kHlpMemPCopy(&szPath[cchDir], pszName, cchName + 1); if (fNeedSuffix) kHlpMemCopy(psz - 1, ".dll", sizeof(".dll")); pMod = kwLdrModuleTryLoadDll(szPath, KWLOCATION_SYSTEM32, pExe, pszSearchPath); } /* The path. */ if ( pMod == NULL && pszSearchPath) { const char *pszCur = pszSearchPath; while (*pszCur != '\0') { /* Find the end of the component */ KSIZE cch = 0; while (pszCur[cch] != ';' && pszCur[cch] != '\0') cch++; if ( cch > 0 /* wrong, but whatever */ && cch + 1 + cchName + cchSuffix < sizeof(szPath)) { char *pszDst = kHlpMemPCopy(szPath, pszCur, cch); if ( szPath[cch - 1] != ':' && szPath[cch - 1] != '/' && szPath[cch - 1] != '\\') *pszDst++ = '\\'; pszDst = kHlpMemPCopy(pszDst, pszName, cchName); if (fNeedSuffix) pszDst = kHlpMemPCopy(pszDst, ".dll", 4); *pszDst = '\0'; pMod = kwLdrModuleTryLoadDll(szPath, KWLOCATION_SYSTEM32, pExe, pszSearchPath); if (pMod) break; } /* Advance */ pszCur += cch; while (*pszCur == ';') pszCur++; } } /* Return. */ if (pMod != NULL && pMod != (PKWMODULE)~(KUPTR)0) { *ppMod = pMod; return 0; } *ppMod = NULL; return KERR_GENERAL_FAILURE; } /** * Creates a CRT slot for the given module. * * @returns 0 on success, non-zero on failure. * @param pModule The module. */ static int kwLdrModuleCreateCrtSlot(PKWMODULE pModule) { KSIZE iSlot; kHlpAssert(pModule->iCrtSlot == KU8_MAX); for (iSlot = 0; iSlot < K_ELEMENTS(g_aCrtSlots); iSlot++) if (g_aCrtSlots[iSlot].pModule == NULL) { KLDRADDR uAddr; int rc; /* Do the linking: */ g_aCrtSlots[iSlot].pModule = pModule; g_aCrtSlots[iSlot].iSlot = (KU32)iSlot; pModule->iCrtSlot = (KU8)iSlot; /* resolve symbols: */ rc = kLdrModQuerySymbol(pModule->pLdrMod, NULL /*pvBits*/, KLDRMOD_BASEADDRESS_MAP, KU32_MAX, "malloc", 6, NULL /*pvszVersion*/, NULL /*pfnGetForwarder*/, NULL /*pvUser*/, &uAddr, NULL); *(KUPTR *)&g_aCrtSlots[iSlot].pfnMalloc = rc == 0 ? (KUPTR)uAddr : 0; if (rc != 0) kwErrPrintf("Failed to resolved 'malloc' in '%s': %d\n", pModule->pszPath, rc); rc = kLdrModQuerySymbol(pModule->pLdrMod, NULL /*pvBits*/, KLDRMOD_BASEADDRESS_MAP, KU32_MAX, "_beginthreadex", 14, NULL /*pvszVersion*/, NULL /*pfnGetForwarder*/, NULL /*pvUser*/, &uAddr, NULL); *(KUPTR *)&g_aCrtSlots[iSlot].pfnBeginThreadEx = rc == 0 ? (KUPTR)uAddr : 0; //if (rc != 0) // kwErrPrintf("Failed to resolved '_beginthreadex' in '%s': %d\n", pModule->pszPath, rc); return 0; } kwErrPrintf("Out of CRT slots!\n"); return KERR_NO_MEMORY; } /** * Locates the module structure for an already loaded native module. * * This will create a module structure if needed. * * @returns Pointer to the module structure on success, NULL on failure. * @param hModule The native module handle. * @param fEnsureCrtSlot Whether to ensure that it has a valid CRT slot. * @param pszLogName The name to use for logging/errors. */ static PKWMODULE kwLdrModuleForLoadedNativeByHandle(HMODULE hModule, KBOOL fEnsureCrtSlot, const char *pszLogName) { /* * Get a normalized path for it. */ char szModPath[1024]; if (GetModuleFileNameA(hModule, szModPath, sizeof(szModPath)) > 0) { char szNormPath[1024]; int rc = kwPathNormalize(szModPath, szNormPath, sizeof(szNormPath)); if (rc == 0) { /* * Hash the path and look it up. */ KU32 uHashPath; KSIZE const cchPath = kwStrHashEx(szNormPath, &uHashPath); unsigned idxHash = uHashPath % K_ELEMENTS(g_apModules); PKWMODULE pMod = g_apModules[idxHash]; if (pMod) { do { if ( pMod->uHashPath == uHashPath && kHlpStrComp(pMod->pszPath, szNormPath) == 0) { kwLdrModuleRetain(pMod); break; } pMod = pMod->pNextHash; } while (pMod); } /* * If not in the hash table, so create a module entry. */ if (!pMod) { PKLDRMOD pLdrMod; rc = kLdrModOpenNativeByHandle((KUPTR)hModule, KLDRMOD_OPEN_FLAGS_NATIVE_ALLOW_INIT_TERM, &pLdrMod); if (rc == 0) { /** @todo more accurately determine location */ const char *pszFilename = kHlpGetFilename(szNormPath); KBOOL fDoReplacements = kwLdrModuleShouldDoNativeReplacements(pszFilename, KWLOCATION_SYSTEM32); pMod = kwLdrModuleCreateForNativekLdrModule(pLdrMod, szNormPath, cchPath + 1, uHashPath, fDoReplacements, NULL /*pVirtualApiMod*/); if (!pMod) { kLdrModClose(pLdrMod); kwErrPrintf("out of memory\n"); } } else kwErrPrintf("kLdrModOpenNativeByHandle failed for %p / '%s': %d\n", hModule, pszLogName, rc); } if (pMod) { /* * Create a CRT slot for the module if necessary. */ if (!fEnsureCrtSlot || pMod->iCrtSlot != KU8_MAX) return pMod; rc = kwLdrModuleCreateCrtSlot(pMod); if (rc == 0) return pMod; kwLdrModuleRelease(pMod); } } else kwErrPrintf("kwPathNormalize failed for '%s' (%s): %u!\n", szModPath, pszLogName, GetLastError()); } else kwErrPrintf("GetModuleFileNameA failed for '%s': %u!\n", pszLogName, GetLastError()); return NULL; } /** * Locates the module structure for an already loaded native module. * * This will create a module structure if needed. * * @returns Pointer to the module structure on success, NULL on failure. * @param pszName The name of the module. * @param fEnsureCrtSlot Whether to ensure that it has a valid CRT slot. * @param fAlwaysPresent Whether the module is expected to always be present, * or not. If not, complain less. */ static PKWMODULE kwLdrModuleForLoadedNative(const char *pszName, KBOOL fEnsureCrtSlot, KBOOL fAlwaysPresent) { /* * Locate the module handle and pass it to kwLdrModuleForLoadedNativeByHandle. */ HANDLE hModule = GetModuleHandleA(pszName); if (hModule) return kwLdrModuleForLoadedNativeByHandle(hModule, fEnsureCrtSlot, pszName); if (fAlwaysPresent) kwErrPrintf("Module '%s' was not found by GetModuleHandleA/W!\n", pszName); return NULL; } /** * Does the TLS memory initialization for a module on the current thread. * * @returns 0 on success, error on failure. * @param pMod The module. */ static int kwLdrCallTlsAllocateAndInit(PKWMODULE pMod) { if (pMod->u.Manual.idxTls != KU32_MAX) { PTEB pTeb = NtCurrentTeb(); void **ppvTls = *(void ***)( (KUPTR)pTeb + (sizeof(void *) == 4 ? 0x2c : 0x58) ); KU8 *pbData = (KU8 *)ppvTls[pMod->u.Manual.idxTls]; KWLDR_LOG(("%s: TLS: Initializing %#x (%#x), idxTls=%d\n", pMod->pszPath, pbData, pMod->u.Manual.cbTlsAlloc, pMod->u.Manual.cbTlsInitData, pMod->u.Manual.idxTls)); if (pMod->u.Manual.cbTlsInitData < pMod->u.Manual.cbTlsAlloc) kHlpMemSet(&pbData[pMod->u.Manual.cbTlsInitData], 0, pMod->u.Manual.cbTlsAlloc); if (pMod->u.Manual.cbTlsInitData) kHlpMemCopy(pbData, &pMod->u.Manual.pbCopy[pMod->u.Manual.offTlsInitData], pMod->u.Manual.cbTlsInitData); } return 0; } /** * Does the TLS callbacks for a module. * * @param pMod The module. * @param dwReason The callback reason. */ static void kwLdrCallTlsCallbacks(PKWMODULE pMod, DWORD dwReason) { if (pMod->u.Manual.cTlsCallbacks) { PIMAGE_TLS_CALLBACK *ppfnCallback = (PIMAGE_TLS_CALLBACK *)&pMod->u.Manual.pbLoad[pMod->u.Manual.offTlsCallbacks]; do { KWLDR_LOG(("%s: Calling TLS callback %p(%p,%#x,0)\n", pMod->pszPath, *ppfnCallback, pMod->hOurMod, dwReason)); (*ppfnCallback)(pMod->hOurMod, dwReason, 0); } while (*++ppfnCallback); } } /** * Does module initialization starting at @a pMod. * * This is initially used on the executable. Later it is used by the * LoadLibrary interceptor. * * @returns 0 on success, error on failure. * @param pMod The module to initialize. */ static int kwLdrModuleInitTree(PKWMODULE pMod) { int rc = 0; if (!pMod->fNative) { KWLDR_LOG(("kwLdrModuleInitTree: enmState=%#x idxTls=%u %s\n", pMod->u.Manual.enmState, pMod->u.Manual.idxTls, pMod->pszPath)); /* * Need to copy bits? */ if (pMod->u.Manual.enmState == KWMODSTATE_NEEDS_BITS) { if (pMod->u.Manual.fUseLdBuf) { #if defined(KBUILD_OS_WINDOWS) && defined(KBUILD_ARCH_AMD64) if (g_pModInLdBuf != NULL && g_pModInLdBuf != pMod && pMod->u.Manual.fRegisteredFunctionTable) { BOOLEAN fRc = RtlDeleteFunctionTable(pMod->u.Manual.paFunctions); kHlpAssert(fRc); K_NOREF(fRc); } #endif g_pModPrevInLdBuf = g_pModInLdBuf; g_pModInLdBuf = pMod; } /* Do quick zeroing and copying when we can. */ pMod->u.Manual.fCanDoQuick = K_FALSE; if ( pMod->u.Manual.fCanDoQuick && ( !pMod->u.Manual.fUseLdBuf || g_pModPrevInLdBuf == pMod)) { /* Zero first. */ kHlpAssert(pMod->u.Manual.cQuickZeroChunks <= 3); switch (pMod->u.Manual.cQuickZeroChunks) { case 3: kHlpMemSet(pMod->u.Manual.aQuickZeroChunks[2].pbDst, 0, pMod->u.Manual.aQuickZeroChunks[2].cbToZero); case 2: kHlpMemSet(pMod->u.Manual.aQuickZeroChunks[1].pbDst, 0, pMod->u.Manual.aQuickZeroChunks[1].cbToZero); case 1: kHlpMemSet(pMod->u.Manual.aQuickZeroChunks[0].pbDst, 0, pMod->u.Manual.aQuickZeroChunks[0].cbToZero); case 0: break; } /* Then copy. */ kHlpAssert(pMod->u.Manual.cQuickCopyChunks > 0); kHlpAssert(pMod->u.Manual.cQuickCopyChunks <= 3); switch (pMod->u.Manual.cQuickCopyChunks) { case 3: kHlpMemCopy(pMod->u.Manual.aQuickCopyChunks[2].pbDst, pMod->u.Manual.aQuickCopyChunks[2].pbSrc, pMod->u.Manual.aQuickCopyChunks[2].cbToCopy); case 2: kHlpMemCopy(pMod->u.Manual.aQuickCopyChunks[1].pbDst, pMod->u.Manual.aQuickCopyChunks[1].pbSrc, pMod->u.Manual.aQuickCopyChunks[1].cbToCopy); case 1: kHlpMemCopy(pMod->u.Manual.aQuickCopyChunks[0].pbDst, pMod->u.Manual.aQuickCopyChunks[0].pbSrc, pMod->u.Manual.aQuickCopyChunks[0].cbToCopy); case 0: break; } } /* Must copy the whole image. */ else { kHlpMemCopy(pMod->u.Manual.pbLoad, pMod->u.Manual.pbCopy, pMod->cbImage); pMod->u.Manual.fCanDoQuick = K_TRUE; } pMod->u.Manual.enmState = KWMODSTATE_NEEDS_INIT; } #if defined(KBUILD_OS_WINDOWS) && defined(KBUILD_ARCH_AMD64) /* * Need to register function table? */ if ( !pMod->u.Manual.fRegisteredFunctionTable && pMod->u.Manual.cFunctions > 0) { pMod->u.Manual.fRegisteredFunctionTable = RtlAddFunctionTable(pMod->u.Manual.paFunctions, pMod->u.Manual.cFunctions, (KUPTR)pMod->u.Manual.pbLoad) != FALSE; kHlpAssert(pMod->u.Manual.fRegisteredFunctionTable); } #endif if (pMod->u.Manual.enmState == KWMODSTATE_NEEDS_INIT) { /* * Must do imports first, but mark our module as being initialized to avoid * endless recursion should there be a dependency loop. */ KSIZE iImp; pMod->u.Manual.enmState = KWMODSTATE_BEING_INITED; for (iImp = 0; iImp < pMod->u.Manual.cImpMods; iImp++) { rc = kwLdrModuleInitTree(pMod->u.Manual.apImpMods[iImp]); if (rc != 0) return rc; } /* Do TLS allocations for module init? */ rc = kwLdrCallTlsAllocateAndInit(pMod); if (rc != 0) return rc; if (pMod->u.Manual.cTlsCallbacks > 0) kwLdrCallTlsCallbacks(pMod, DLL_PROCESS_ATTACH); /* Finally call the entry point. */ rc = kLdrModCallInit(pMod->pLdrMod, pMod->u.Manual.pbLoad, (KUPTR)pMod->hOurMod); if (rc == 0) pMod->u.Manual.enmState = KWMODSTATE_READY; else pMod->u.Manual.enmState = KWMODSTATE_INIT_FAILED; } } /* * Special hack to disconnect mspdbXXX.dll from mspdbsrv.exe when * _MSPDBSRV_ENDPOINT_ changes value. */ else if (pMod->fNeedReInit) { int rc2; KWLDR_LOG(("kwLdrModuleInitTree: mspdb re-init hack: %s\n", pMod->pszPath)); //fprintf(stderr, "%d: kwLdrModuleInitTree: mspdb re-init hack: %s\n", getpid(), kwSandboxDoGetEnvA(&g_Sandbox, TUPLE("_MSPDBSRV_ENDPOINT_"))); fflush(stderr); rc = kLdrModCallTerm(pMod->pLdrMod, pMod->u.Manual.pbLoad, (KUPTR)pMod->hOurMod); rc2 = kLdrModCallInit(pMod->pLdrMod, pMod->u.Manual.pbLoad, (KUPTR)pMod->hOurMod); if (!rc && !rc2) { /* likely */ } else { kwErrPrintf("Re-init of '%s' failed: rc=%d rc2=%d\n", pMod->pszPath, rc, rc2); if (rc2 && !rc) rc = rc2; } pMod->fNeedReInit = K_FALSE; } return rc; } /** * Looks up a module handle for a tool. * * @returns Referenced loader module on success, NULL on if not found. * @param pTool The tool. * @param hmod The module handle. */ static PKWMODULE kwToolLocateModuleByHandle(PKWTOOL pTool, HMODULE hmod) { KUPTR const uHMod = (KUPTR)hmod; PKWMODULE *papMods; KU32 iEnd; KU32 i; PKWDYNLOAD pDynLoad; if (pTool) { /* likely */ } else return NULL; /* The executable. */ if ( hmod == NULL || (pTool->u.Sandboxed.pExe && pTool->u.Sandboxed.pExe->hOurMod == hmod)) { if (pTool->u.Sandboxed.pExe) return kwLdrModuleRetain(pTool->u.Sandboxed.pExe); return NULL; } /* * Binary lookup using the module table. */ papMods = pTool->u.Sandboxed.papModules; iEnd = pTool->u.Sandboxed.cModules; if (iEnd) { KU32 iStart = 0; i = iEnd / 2; for (;;) { KUPTR const uHModCur = (KUPTR)papMods[i]->hOurMod; if (uHMod < uHModCur) { iEnd = i--; if (iStart <= i) { } else break; } else if (uHMod != uHModCur) { iStart = ++i; if (i < iEnd) { } else break; } /* We've got a match. Always return the non-virtual module (first) when there is one. */ else if (!papMods[i]->pVirtualApiMod) return kwLdrModuleRetain(papMods[i]); else { while (i > 0 && papMods[i - 1]->pVirtualApiMod && papMods[i - 1]->hOurMod == hmod) i--; return kwLdrModuleRetain(papMods[i]); } i = iStart + (iEnd - iStart) / 2; } #ifndef NDEBUG iStart = pTool->u.Sandboxed.cModules; while (--iStart > 0) kHlpAssert((KUPTR)papMods[iStart]->hOurMod != uHMod); kHlpAssert(i == 0 || (KUPTR)papMods[i - 1]->hOurMod < uHMod); #endif } /* * Dynamically loaded images. */ for (pDynLoad = pTool->u.Sandboxed.pDynLoadHead; pDynLoad != NULL; pDynLoad = pDynLoad->pNext) if (pDynLoad->hmod == hmod) { if (pDynLoad->pMod) return kwLdrModuleRetain(pDynLoad->pMod); KWFS_TODO(); return NULL; } return NULL; } /** * Adds the given module to the tool import table. * * @returns 0 on success, non-zero on failure. * @param pTool The tool. * @param pMod The module. */ static int kwToolAddModule(PKWTOOL pTool, PKWMODULE pMod) { /* * Binary lookup. Locating the right slot for it, return if already there. */ KUPTR const uHMod = (KUPTR)pMod->hOurMod; PKWMODULE *papMods = pTool->u.Sandboxed.papModules; KU32 iEnd = pTool->u.Sandboxed.cModules; KU32 i; if (iEnd) { KU32 iStart = 0; i = iEnd / 2; for (;;) { PKWMODULE pCurMod = papMods[i]; KUPTR const uHModCur = (KUPTR)pCurMod->hOurMod; if (uHMod < uHModCur) { iEnd = i; if (iStart < i) { } else break; } else if (uHMod != uHModCur) { iStart = ++i; if (i < iEnd) { } else break; } else { /* Already there in the table. The non-virtual module must be the first entry if we've got duplicate hmod values because of virtual modules. */ if (pMod != pCurMod) { /* Skip to the last module with the same hmod. */ while (i + 1 < iEnd && (KUPTR)(pCurMod = papMods[i + 1])->hOurMod == uHMod) { if (pMod == pCurMod) return 0; i++; } /* Then scan backwards till the first one. */ while (i > 0 && (KUPTR)(pCurMod = papMods[i - 1])->hOurMod == uHMod) { if (pMod == pCurMod) return 0; i--; } pCurMod = papMods[i]; if (pMod != pCurMod) { if (pMod->pVirtualApiMod && !pCurMod->pVirtualApiMod) i++; break; } } return 0; } i = iStart + (iEnd - iStart) / 2; } #ifndef NDEBUG iStart = pTool->u.Sandboxed.cModules; while (--iStart > 0) { kHlpAssert(papMods[iStart] != pMod); kHlpAssert( (KUPTR)papMods[iStart]->hOurMod != uHMod || pMod->pVirtualApiMod || papMods[iStart]->pVirtualApiMod); } kHlpAssert(i == 0 || (KUPTR)papMods[i - 1]->hOurMod <= uHMod); kHlpAssert(i == pTool->u.Sandboxed.cModules || (KUPTR)papMods[i]->hOurMod >= uHMod); #endif } else i = 0; /* * Grow the table? */ if ((pTool->u.Sandboxed.cModules % 16) == 0) { void *pvNew = kHlpRealloc(papMods, sizeof(papMods[0]) * (pTool->u.Sandboxed.cModules + 16)); if (!pvNew) return KERR_NO_MEMORY; pTool->u.Sandboxed.papModules = papMods = (PKWMODULE *)pvNew; } /* Insert it. */ if (i != pTool->u.Sandboxed.cModules) kHlpMemMove(&papMods[i + 1], &papMods[i], (pTool->u.Sandboxed.cModules - i) * sizeof(papMods[0])); papMods[i] = kwLdrModuleRetain(pMod); pTool->u.Sandboxed.cModules++; KWLDR_LOG(("kwToolAddModule: %u modules after adding %p=%s\n", pTool->u.Sandboxed.cModules, uHMod, pMod->pszPath)); return 0; } /** * Adds the given module and all its imports to the * * @returns 0 on success, non-zero on failure. * @param pTool The tool. * @param pMod The module. */ static int kwToolAddModuleAndImports(PKWTOOL pTool, PKWMODULE pMod) { int rc = kwToolAddModule(pTool, pMod); if (pMod->pVirtualApiMod && rc == 0) rc = kwToolAddModule(pTool, pMod->pVirtualApiMod); if (!pMod->fNative && rc == 0) { KSIZE iImp = pMod->u.Manual.cImpMods; while (iImp-- > 0) { rc = kwToolAddModuleAndImports(pTool, pMod->u.Manual.apImpMods[iImp]); if (rc == 0) { } else break; } } return 0; } /** * Creates a tool entry and inserts it. * * @returns Pointer to the tool entry. NULL on failure. * @param pToolFsObj The file object of the tool. The created tool * will be associated with it. * * A reference is donated by the caller and must be * released. * @param pszSearchPath The PATH environment variable value, or NULL. */ static PKWTOOL kwToolEntryCreate(PKFSOBJ pToolFsObj, const char *pszSearchPath) { KSIZE cwcPath = pToolFsObj->cwcParent + pToolFsObj->cwcName + 1; KSIZE cbPath = pToolFsObj->cchParent + pToolFsObj->cchName + 1; PKWTOOL pTool = (PKWTOOL)kFsCacheObjAddUserData(g_pFsCache, pToolFsObj, KW_DATA_KEY_TOOL, sizeof(*pTool) + cwcPath * sizeof(wchar_t) + cbPath); if (pTool) { KBOOL fRc; wchar_t wcSaved; wchar_t *pwcEnd; pTool->pwszPath = (wchar_t const *)(pTool + 1); fRc = kFsCacheObjGetFullPathW(pToolFsObj, (wchar_t *)pTool->pwszPath, cwcPath, '\\'); kHlpAssert(fRc); K_NOREF(fRc); pTool->pszPath = (char const *)&pTool->pwszPath[cwcPath]; fRc = kFsCacheObjGetFullPathA(pToolFsObj, (char *)pTool->pszPath, cbPath, '\\'); kHlpAssert(fRc); /* HACK ALERT! This is to help the loader search the application directory. */ pwcEnd = (wchar_t *)&pTool->pwszPath[pToolFsObj->cwcParent]; wcSaved = *pwcEnd; *pwcEnd = '\0'; if (!SetDllDirectoryW(pTool->pwszPath)) kwErrPrintf("SetDllDirectoryW(tool) failed: %u\n", GetLastError()); *pwcEnd = wcSaved; pTool->enmType = KWTOOLTYPE_SANDBOXED; pTool->u.Sandboxed.pExe = kwLdrModuleCreateNonNative(pTool->pszPath, kwStrHash(pTool->pszPath), K_TRUE /*fExe*/, NULL /*pExeMod*/, pszSearchPath); if (pTool->u.Sandboxed.pExe) { int rc = kwLdrModuleQueryMainEntrypoint(pTool->u.Sandboxed.pExe, &pTool->u.Sandboxed.uMainAddr); if (rc == 0) { if (kHlpStrICompAscii(pToolFsObj->pszName, "cl.exe") == 0) pTool->u.Sandboxed.enmHint = KWTOOLHINT_VISUAL_CPP_CL; else if (kHlpStrICompAscii(pToolFsObj->pszName, "link.exe") == 0) pTool->u.Sandboxed.enmHint = KWTOOLHINT_VISUAL_CPP_LINK; else pTool->u.Sandboxed.enmHint = KWTOOLHINT_NONE; kwToolAddModuleAndImports(pTool, pTool->u.Sandboxed.pExe); } else { kwErrPrintf("Failed to get entrypoint for '%s': %u\n", pTool->pszPath, rc); kwLdrModuleRelease(pTool->u.Sandboxed.pExe); pTool->u.Sandboxed.pExe = NULL; pTool->enmType = KWTOOLTYPE_EXEC; } } else { kwErrPrintf("kwLdrModuleCreateNonNative failed!\n"); pTool->enmType = KWTOOLTYPE_EXEC; } kFsCacheObjRelease(g_pFsCache, pToolFsObj); g_cTools++; return pTool; } kwErrPrintf("kFsCacheObjAddUserData failed!\n"); kFsCacheObjRelease(g_pFsCache, pToolFsObj); return NULL; } /** * Looks up the given tool, creating a new tool table entry if necessary. * * @returns Pointer to the tool entry. NULL on failure (fully bitched). * @param pszExe The executable for the tool (not normalized). * @param cEnvVars Number of environment varibles. * @param papszEnvVars Environment variables. For getting the PATH. */ static PKWTOOL kwToolLookup(const char *pszExe, KU32 cEnvVars, const char **papszEnvVars) { /* * We associate the tools instances with the file system objects. * * We'd like to do the lookup without invaliding the volatile parts of the * cache, thus the double lookup here. The cache gets invalidate later on. */ KFSLOOKUPERROR enmError; PKFSOBJ pToolFsObj = kFsCacheLookupA(g_pFsCache, pszExe, &enmError); if ( !pToolFsObj || pToolFsObj->bObjType != KFSOBJ_TYPE_FILE) { kFsCacheInvalidateCustomBoth(g_pFsCache); pToolFsObj = kFsCacheLookupA(g_pFsCache, pszExe, &enmError); } if (pToolFsObj) { if (pToolFsObj->bObjType == KFSOBJ_TYPE_FILE) { const char *pszSearchPath; PKWTOOL pTool = (PKWTOOL)kFsCacheObjGetUserData(g_pFsCache, pToolFsObj, KW_DATA_KEY_TOOL); if (pTool) { kFsCacheObjRelease(g_pFsCache, pToolFsObj); return pTool; } /* * Need to create a new tool. */ pszSearchPath = NULL; while (cEnvVars-- > 0) if (_strnicmp(papszEnvVars[cEnvVars], "PATH=", 5) == 0) { pszSearchPath = &papszEnvVars[cEnvVars][5]; break; } pTool = kwToolEntryCreate(pToolFsObj, pszSearchPath); if (pTool) return pTool; kwErrPrintf("kwToolLookup(%s) -> NULL: kwToolEntryCreate failed\n", pszExe); } else { kFsCacheObjRelease(g_pFsCache, pToolFsObj); kwErrPrintf("kwToolLookup(%s) -> NULL: not file (bObjType=%d fFlags=%#x uCacheGen=%u auGenerationsMissing=[%u,%u])\n", pszExe, pToolFsObj->bObjType, pToolFsObj->fFlags, pToolFsObj->uCacheGen, g_pFsCache->auGenerationsMissing[0], g_pFsCache->auGenerationsMissing[1]); } } else kwErrPrintf("kwToolLookup(%s) -> NULL: enmError=%d\n", pszExe, enmError); return NULL; } /* * * File system cache. * File system cache. * File system cache. * */ /** * This is for kDep. */ int kwFsPathExists(const char *pszPath) { BirdTimeSpec_T TsIgnored; KFSLOOKUPERROR enmError; PKFSOBJ pFsObj = kFsCacheLookupNoMissingA(g_pFsCache, pszPath, &enmError); if (pFsObj) { kFsCacheObjRelease(g_pFsCache, pFsObj); return 1; } return birdStatModTimeOnly(pszPath, &TsIgnored, 1) == 0; } /* duplicated in dir-nt-bird.c */ void nt_fullpath_cached(const char *pszPath, char *pszFull, size_t cbFull) { KFSLOOKUPERROR enmError; PKFSOBJ pPathObj = kFsCacheLookupA(g_pFsCache, pszPath, &enmError); if (pPathObj) { KSIZE off = pPathObj->cchParent; if (off > 0) { KSIZE offEnd = off + pPathObj->cchName; if (offEnd < cbFull) { PKFSDIR pAncestor; pszFull[off + pPathObj->cchName] = '\0'; memcpy(&pszFull[off], pPathObj->pszName, pPathObj->cchName); for (pAncestor = pPathObj->pParent; off > 0; pAncestor = pAncestor->Obj.pParent) { kHlpAssert(off > 1); kHlpAssert(pAncestor != NULL); kHlpAssert(pAncestor->Obj.cchName > 0); pszFull[--off] = '/'; off -= pAncestor->Obj.cchName; kHlpAssert(pAncestor->Obj.cchParent == off); memcpy(&pszFull[off], pAncestor->Obj.pszName, pAncestor->Obj.cchName); } kFsCacheObjRelease(g_pFsCache, pPathObj); return; } } else { if ((size_t)pPathObj->cchName + 1 < cbFull) { memcpy(pszFull, pPathObj->pszName, pPathObj->cchName); pszFull[pPathObj->cchName] = '/'; pszFull[pPathObj->cchName + 1] = '\0'; kFsCacheObjRelease(g_pFsCache, pPathObj); return; } } /* do fallback. */ kHlpAssertFailed(); kFsCacheObjRelease(g_pFsCache, pPathObj); } nt_fullpath(pszPath, pszFull, cbFull); } /** * Helper for getting the extension of a UTF-16 path. * * @returns Pointer to the extension or the terminator. * @param pwszPath The path. * @param pcwcExt Where to return the length of the extension. */ static wchar_t const *kwFsPathGetExtW(wchar_t const *pwszPath, KSIZE *pcwcExt) { wchar_t const *pwszName = pwszPath; wchar_t const *pwszExt = NULL; for (;;) { wchar_t const wc = *pwszPath++; if (wc == '.') pwszExt = pwszPath; else if (wc == '/' || wc == '\\' || wc == ':') { pwszName = pwszPath; pwszExt = NULL; } else if (wc == '\0') { if (pwszExt) { *pcwcExt = pwszPath - pwszExt - 1; return pwszExt; } *pcwcExt = 0; return pwszPath - 1; } } } /** * Parses the argument string passed in as pszSrc. * * @returns size of the processed arguments. * @param pszSrc Pointer to the commandline that's to be parsed. * @param pcArgs Where to return the number of arguments. * @param argv Pointer to argument vector to put argument pointers in. NULL allowed. * @param pchPool Pointer to memory pchPool to put the arguments into. NULL allowed. * * @remarks Lifted from startuphacks-win.c */ static int parse_args(const char *pszSrc, int *pcArgs, char **argv, char *pchPool) { int bs; char chQuote; char *pfFlags; int cbArgs; int cArgs; #define PUTC(c) do { ++cbArgs; if (pchPool != NULL) *pchPool++ = (c); } while (0) #define PUTV do { ++cArgs; if (argv != NULL) *argv++ = pchPool; } while (0) #define WHITE(c) ((c) == ' ' || (c) == '\t') #define _ARG_DQUOTE 0x01 /* Argument quoted (") */ #define _ARG_RESPONSE 0x02 /* Argument read from response file */ #define _ARG_WILDCARD 0x04 /* Argument expanded from wildcard */ #define _ARG_ENV 0x08 /* Argument from environment */ #define _ARG_NONZERO 0x80 /* Always set, to avoid end of string */ cArgs = 0; cbArgs = 0; #if 0 /* argv[0] */ PUTC((char)_ARG_NONZERO); PUTV; for (;;) { PUTC(*pszSrc); if (*pszSrc == 0) break; ++pszSrc; } ++pszSrc; #endif for (;;) { while (WHITE(*pszSrc)) ++pszSrc; if (*pszSrc == 0) break; pfFlags = pchPool; PUTC((unsigned char)_ARG_NONZERO); PUTV; bs = 0; chQuote = 0; for (;;) { if (!chQuote ? (*pszSrc == '"' /*|| *pszSrc == '\''*/) : *pszSrc == chQuote) { while (bs >= 2) { PUTC('\\'); bs -= 2; } if (bs & 1) PUTC(*pszSrc); else { chQuote = chQuote ? 0 : *pszSrc; if (pfFlags != NULL) *pfFlags |= _ARG_DQUOTE; } bs = 0; } else if (*pszSrc == '\\') ++bs; else { while (bs != 0) { PUTC('\\'); --bs; } if (*pszSrc == 0 || (WHITE(*pszSrc) && !chQuote)) break; PUTC(*pszSrc); } ++pszSrc; } PUTC(0); } *pcArgs = cArgs; return cbArgs; } /* * * Process and thread related APIs. * Process and thread related APIs. * Process and thread related APIs. * */ /** Common worker for ExitProcess(), exit() and friends. */ static void WINAPI kwSandboxDoExit(int uExitCode) { if (g_Sandbox.idMainThread == GetCurrentThreadId()) { PNT_TIB pTib = (PNT_TIB)NtCurrentTeb(); g_Sandbox.rcExitCode = (int)uExitCode; /* Before we jump, restore the TIB as we're not interested in any exception chain stuff installed by the sandboxed executable. */ *pTib = g_Sandbox.TibMainThread; pTib->ExceptionList = g_Sandbox.pOutXcptListHead; longjmp(g_Sandbox.JmpBuf, 1); } KWFS_TODO(); } /** ExitProcess replacement. */ static void WINAPI kwSandbox_Kernel32_ExitProcess(UINT uExitCode) { KW_LOG(("kwSandbox_Kernel32_ExitProcess: %u\n", uExitCode)); kwSandboxDoExit((int)uExitCode); } /** ExitProcess replacement. */ static BOOL WINAPI kwSandbox_Kernel32_TerminateProcess(HANDLE hProcess, UINT uExitCode) { if (hProcess == GetCurrentProcess()) kwSandboxDoExit(uExitCode); KWFS_TODO(); return TerminateProcess(hProcess, uExitCode); } /** Normal CRT exit(). */ static void __cdecl kwSandbox_msvcrt_exit(int rcExitCode) { KW_LOG(("kwSandbox_msvcrt_exit: %d\n", rcExitCode)); kwSandboxDoExit(rcExitCode); } /** Quick CRT _exit(). */ static void __cdecl kwSandbox_msvcrt__exit(int rcExitCode) { /* Quick. */ KW_LOG(("kwSandbox_msvcrt__exit %d\n", rcExitCode)); kwSandboxDoExit(rcExitCode); } /** Return to caller CRT _cexit(). */ static void __cdecl kwSandbox_msvcrt__cexit(int rcExitCode) { KW_LOG(("kwSandbox_msvcrt__cexit: %d\n", rcExitCode)); kwSandboxDoExit(rcExitCode); } /** Quick return to caller CRT _c_exit(). */ static void __cdecl kwSandbox_msvcrt__c_exit(int rcExitCode) { KW_LOG(("kwSandbox_msvcrt__c_exit: %d\n", rcExitCode)); kwSandboxDoExit(rcExitCode); } /** Runtime error and exit _amsg_exit(). */ static void __cdecl kwSandbox_msvcrt__amsg_exit(int iMsgNo) { KW_LOG(("\nRuntime error #%u!\n", iMsgNo)); kwSandboxDoExit(255); } /** CRT - terminate(). */ static void __cdecl kwSandbox_msvcrt_terminate(void) { KW_LOG(("\nRuntime - terminate!\n")); kwSandboxDoExit(254); } /** CRT - _onexit */ static _onexit_t __cdecl kwSandbox_msvcrt__onexit(_onexit_t pfnFunc) { //if (g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_LINK) { PKWEXITCALLACK pCallback; KW_LOG(("_onexit(%p)\n", pfnFunc)); kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pCallback = kHlpAlloc(sizeof(*pCallback)); if (pCallback) { pCallback->pfnCallback = pfnFunc; pCallback->fAtExit = K_FALSE; pCallback->pNext = g_Sandbox.pExitCallbackHead; g_Sandbox.pExitCallbackHead = pCallback; return pfnFunc; } return NULL; } //KW_LOG(("_onexit(%p) - IGNORED\n", pfnFunc)); //return pfnFunc; } /** CRT - atexit */ static int __cdecl kwSandbox_msvcrt_atexit(int (__cdecl *pfnFunc)(void)) { //if (g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_LINK) { PKWEXITCALLACK pCallback; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KW_LOG(("atexit(%p)\n", pfnFunc)); pCallback = kHlpAlloc(sizeof(*pCallback)); if (pCallback) { pCallback->pfnCallback = (_onexit_t)pfnFunc; pCallback->fAtExit = K_TRUE; pCallback->pNext = g_Sandbox.pExitCallbackHead; g_Sandbox.pExitCallbackHead = pCallback; return 0; } return -1; } //KW_LOG(("atexit(%p) - IGNORED!\n", pfnFunc)); //return 0; } /** Kernel32 - SetConsoleCtrlHandler(). */ static BOOL WINAPI kwSandbox_Kernel32_SetConsoleCtrlHandler(PHANDLER_ROUTINE pfnHandler, BOOL fAdd) { KW_LOG(("SetConsoleCtrlHandler(%p, %d) - ignoring\n")); return TRUE; } /** The CRT internal __getmainargs() API. */ static int __cdecl kwSandbox_msvcrt___getmainargs(int *pargc, char ***pargv, char ***penvp, int dowildcard, int const *piNewMode) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); *pargc = g_Sandbox.cArgs; *pargv = g_Sandbox.papszArgs; *penvp = g_Sandbox.environ; /** @todo startinfo points at a newmode (setmode) value. */ return 0; } /** The CRT internal __wgetmainargs() API. */ static int __cdecl kwSandbox_msvcrt___wgetmainargs(int *pargc, wchar_t ***pargv, wchar_t ***penvp, int dowildcard, int const *piNewMode) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); *pargc = g_Sandbox.cArgs; *pargv = g_Sandbox.papwszArgs; *penvp = g_Sandbox.wenviron; /** @todo startinfo points at a newmode (setmode) value. */ return 0; } /** Kernel32 - GetCommandLineA() */ static LPCSTR /*LPSTR*/ WINAPI kwSandbox_Kernel32_GetCommandLineA(VOID) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return g_Sandbox.pszCmdLine; } /** Kernel32 - GetCommandLineW() */ static LPCWSTR /*LPWSTR*/ WINAPI kwSandbox_Kernel32_GetCommandLineW(VOID) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return g_Sandbox.pwszCmdLine; } /** Kernel32 - GetStartupInfoA() */ static VOID WINAPI kwSandbox_Kernel32_GetStartupInfoA(LPSTARTUPINFOA pStartupInfo) { KW_LOG(("GetStartupInfoA\n")); GetStartupInfoA(pStartupInfo); pStartupInfo->lpReserved = NULL; pStartupInfo->lpTitle = NULL; pStartupInfo->lpReserved2 = NULL; pStartupInfo->cbReserved2 = 0; } /** Kernel32 - GetStartupInfoW() */ static VOID WINAPI kwSandbox_Kernel32_GetStartupInfoW(LPSTARTUPINFOW pStartupInfo) { KW_LOG(("GetStartupInfoW\n")); GetStartupInfoW(pStartupInfo); pStartupInfo->lpReserved = NULL; pStartupInfo->lpTitle = NULL; pStartupInfo->lpReserved2 = NULL; pStartupInfo->cbReserved2 = 0; } /** CRT - __p___argc(). */ static int * __cdecl kwSandbox_msvcrt___p___argc(void) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return &g_Sandbox.cArgs; } /** CRT - __p___argv(). */ static char *** __cdecl kwSandbox_msvcrt___p___argv(void) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return &g_Sandbox.papszArgs; } /** CRT - __p___sargv(). */ static wchar_t *** __cdecl kwSandbox_msvcrt___p___wargv(void) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return &g_Sandbox.papwszArgs; } /** CRT - __p__acmdln(). */ static char ** __cdecl kwSandbox_msvcrt___p__acmdln(void) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return (char **)&g_Sandbox.pszCmdLine; } /** CRT - __p__acmdln(). */ static wchar_t ** __cdecl kwSandbox_msvcrt___p__wcmdln(void) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return &g_Sandbox.pwszCmdLine; } /** CRT - __p__pgmptr(). */ static char ** __cdecl kwSandbox_msvcrt___p__pgmptr(void) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return &g_Sandbox.pgmptr; } /** CRT - __p__wpgmptr(). */ static wchar_t ** __cdecl kwSandbox_msvcrt___p__wpgmptr(void) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return &g_Sandbox.wpgmptr; } /** CRT - _get_pgmptr(). */ static errno_t __cdecl kwSandbox_msvcrt__get_pgmptr(char **ppszValue) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); *ppszValue = g_Sandbox.pgmptr; return 0; } /** CRT - _get_wpgmptr(). */ static errno_t __cdecl kwSandbox_msvcrt__get_wpgmptr(wchar_t **ppwszValue) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); *ppwszValue = g_Sandbox.wpgmptr; return 0; } /** Just in case. */ static void kwSandbox_msvcrt__wincmdln(void) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KWFS_TODO(); } /** Just in case. */ static void kwSandbox_msvcrt__wwincmdln(void) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KWFS_TODO(); } /** CreateThread interceptor. */ static HANDLE WINAPI kwSandbox_Kernel32_CreateThread(LPSECURITY_ATTRIBUTES pSecAttr, SIZE_T cbStack, PTHREAD_START_ROUTINE pfnThreadProc, PVOID pvUser, DWORD fFlags, PDWORD pidThread) { HANDLE hThread = NULL; KW_LOG(("CreateThread: pSecAttr=%p (inh=%d) cbStack=%#x pfnThreadProc=%p pvUser=%p fFlags=%#x pidThread=%p\n", pSecAttr, pSecAttr ? pSecAttr->bInheritHandle : 0, cbStack, pfnThreadProc, pvUser, fFlags, pidThread)); kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); if (g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_LINK) { /* Allow link::DbgThread. */ hThread = CreateThread(pSecAttr, cbStack, pfnThreadProc, pvUser, fFlags, pidThread); KW_LOG(("CreateThread -> %p, *pidThread=%#x\n", hThread, pidThread ? *pidThread : 0)); } else KWFS_TODO(); return hThread; } /** _beginthread - create a new thread. */ static uintptr_t __cdecl kwSandbox_msvcrt__beginthread(void (__cdecl *pfnThreadProc)(void *), unsigned cbStack, void *pvUser) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KWFS_TODO(); return 0; } /** _beginthreadex - create a new thread, msvcr120.dll hack for c2.dll. */ static uintptr_t __cdecl kwSandbox_msvcr120__beginthreadex(void *pvSecAttr, unsigned cbStack, unsigned (__stdcall *pfnThreadProc)(void *), void *pvUser, unsigned fCreate, unsigned *pidThread) { /* * The VC++ 12 (VS 2013) compiler pass two is now threaded. Let it do * whatever it needs to. */ KW_LOG(("kwSandbox_msvcr120__beginthreadex: pvSecAttr=%p (inh=%d) cbStack=%#x pfnThreadProc=%p pvUser=%p fCreate=%#x pidThread=%p\n", pvSecAttr, pvSecAttr ? ((LPSECURITY_ATTRIBUTES)pvSecAttr)->bInheritHandle : 0, cbStack, pfnThreadProc, pvUser, fCreate, pidThread)); if (g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_CL) { uintptr_t rcRet; static uintptr_t (__cdecl *s_pfnReal)(void *, unsigned , unsigned (__stdcall *)(void *), void *, unsigned , unsigned *); if (!s_pfnReal) { *(FARPROC *)&s_pfnReal = GetProcAddress(GetModuleHandleA("msvcr120.dll"), "_beginthreadex"); if (!s_pfnReal) { kwErrPrintf("kwSandbox_msvcr120__beginthreadex: Failed to resolve _beginthreadex in msvcr120.dll!\n"); __debugbreak(); } } rcRet = s_pfnReal(pvSecAttr, cbStack, pfnThreadProc, pvUser, fCreate, pidThread); KW_LOG(("kwSandbox_msvcr120__beginthreadex: returns %p *pidThread=%#x\n", rcRet, pidThread ? *pidThread : -1)); return rcRet; } kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KWFS_TODO(); return 0; } /** _beginthreadex - create a new thread. */ static uintptr_t __cdecl kwSandbox_msvcrt__beginthreadex_wrapped(void *pvSecAttr, unsigned cbStack, unsigned (__stdcall *pfnThreadProc)(void *), void *pvUser, unsigned fCreate, unsigned *pidThread, PKWCRTSLOT pSlot) { /* * Since the VC++ 12 (VS 2013) compiler, the 2nd pass is now threaded. * Let it do whatever it needs to. */ KW_LOG(("kwSandbox_msvcrt__beginthreadex: pvSecAttr=%p (inh=%d) cbStack=%#x pfnThreadProc=%p pvUser=%p fCreate=%#x pidThread=%p\n", pvSecAttr, pvSecAttr ? ((LPSECURITY_ATTRIBUTES)pvSecAttr)->bInheritHandle : 0, cbStack, pfnThreadProc, pvUser, fCreate, pidThread)); if ( g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_CL && pSlot->pfnBeginThreadEx) { uintptr_t rcRet = pSlot->pfnBeginThreadEx(pvSecAttr, cbStack, pfnThreadProc, pvUser, fCreate, pidThread); KW_LOG(("kwSandbox_msvcrt__beginthreadex: returns %p *pidThread=%#x\n", rcRet, pidThread ? *pidThread : -1)); return rcRet; } kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KWFS_TODO(); return 0; } CRT_SLOT_FUNCTION_WRAPPER(uintptr_t __cdecl, kwSandbox_msvcrt__beginthreadex, (void *pvSecAttr, unsigned cbStack, unsigned (__stdcall *pfnThreadProc)(void *), void *pvUser, unsigned fCreate, unsigned *pidThread), (pvSecAttr, cbStack, pfnThreadProc, pvUser, fCreate, pidThread, &g_aCrtSlots[iCrtSlot])); /* * * Environment related APIs. * Environment related APIs. * Environment related APIs. * */ /** Kernel32 - GetEnvironmentStringsA (Watcom uses this one). */ static LPCH WINAPI kwSandbox_Kernel32_GetEnvironmentStringsA(void) { char *pszzEnv; char *pszCur; KSIZE cbNeeded = 1; KSIZE iVar = 0; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); /* Figure how space much we need first. */ while ((pszCur = g_Sandbox.papszEnvVars[iVar++]) != NULL) cbNeeded += kHlpStrLen(pszCur) + 1; /* Allocate it. */ pszzEnv = kHlpAlloc(cbNeeded); if (pszzEnv) { char *psz = pszzEnv; iVar = 0; while ((pszCur = g_Sandbox.papszEnvVars[iVar++]) != NULL) { KSIZE cbCur = kHlpStrLen(pszCur) + 1; kHlpAssert((KUPTR)(&psz[cbCur] - pszzEnv) < cbNeeded); psz = (char *)kHlpMemPCopy(psz, pszCur, cbCur); } *psz++ = '\0'; kHlpAssert((KUPTR)(psz - pszzEnv) == cbNeeded); } KW_LOG(("GetEnvironmentStringsA -> %p [%u]\n", pszzEnv, cbNeeded)); #if 0 fprintf(stderr, "GetEnvironmentStringsA: %p LB %#x\n", pszzEnv, cbNeeded); pszCur = pszzEnv; iVar = 0; while (*pszCur) { fprintf(stderr, " %u:%p=%s<eos>\n\n", iVar, pszCur, pszCur); iVar++; pszCur += kHlpStrLen(pszCur) + 1; } fprintf(stderr, " %u:%p=<eos>\n\n", iVar, pszCur); pszCur++; fprintf(stderr, "ended at %p, after %u bytes (expected %u)\n", pszCur, pszCur - pszzEnv, cbNeeded); #endif return pszzEnv; } /** Kernel32 - GetEnvironmentStrings */ static LPCH WINAPI kwSandbox_Kernel32_GetEnvironmentStrings(void) { KW_LOG(("GetEnvironmentStrings!\n")); return kwSandbox_Kernel32_GetEnvironmentStringsA(); } /** Kernel32 - GetEnvironmentStringsW */ static LPWCH WINAPI kwSandbox_Kernel32_GetEnvironmentStringsW(void) { wchar_t *pwszzEnv; wchar_t *pwszCur; KSIZE cwcNeeded = 1; KSIZE iVar = 0; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); /* Figure how space much we need first. */ while ((pwszCur = g_Sandbox.papwszEnvVars[iVar++]) != NULL) cwcNeeded += kwUtf16Len(pwszCur) + 1; /* Allocate it. */ pwszzEnv = kHlpAlloc(cwcNeeded * sizeof(wchar_t)); if (pwszzEnv) { wchar_t *pwsz = pwszzEnv; iVar = 0; while ((pwszCur = g_Sandbox.papwszEnvVars[iVar++]) != NULL) { KSIZE cwcCur = kwUtf16Len(pwszCur) + 1; kHlpAssert((KUPTR)(&pwsz[cwcCur] - pwszzEnv) < cwcNeeded); pwsz = (wchar_t *)kHlpMemPCopy(pwsz, pwszCur, cwcCur * sizeof(wchar_t)); } *pwsz++ = '\0'; kHlpAssert((KUPTR)(pwsz - pwszzEnv) == cwcNeeded); } KW_LOG(("GetEnvironmentStringsW -> %p [%u]\n", pwszzEnv, cwcNeeded)); return pwszzEnv; } /** Kernel32 - FreeEnvironmentStringsA */ static BOOL WINAPI kwSandbox_Kernel32_FreeEnvironmentStringsA(LPCH pszzEnv) { KW_LOG(("FreeEnvironmentStringsA: %p -> TRUE\n", pszzEnv)); kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); kHlpFree(pszzEnv); return TRUE; } /** Kernel32 - FreeEnvironmentStringsW */ static BOOL WINAPI kwSandbox_Kernel32_FreeEnvironmentStringsW(LPWCH pwszzEnv) { KW_LOG(("FreeEnvironmentStringsW: %p -> TRUE\n", pwszzEnv)); kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); kHlpFree(pwszzEnv); return TRUE; } /** * Grows the environment vectors (KWSANDBOX::environ, KWSANDBOX::papszEnvVars, * KWSANDBOX::wenviron, and KWSANDBOX::papwszEnvVars). * * @returns 0 on success, non-zero on failure. * @param pSandbox The sandbox. * @param cMin Minimum size, including terminator. */ static int kwSandboxGrowEnv(PKWSANDBOX pSandbox, KSIZE cMin) { void *pvNew; KSIZE const cOld = pSandbox->cEnvVarsAllocated; KSIZE cNew = cOld + 256; while (cNew < cMin) cNew += 256; pvNew = kHlpRealloc(pSandbox->environ, cNew * sizeof(pSandbox->environ[0])); if (pvNew) { pSandbox->environ = (char **)pvNew; pSandbox->environ[cOld] = NULL; pvNew = kHlpRealloc(pSandbox->papszEnvVars, cNew * sizeof(pSandbox->papszEnvVars[0])); if (pvNew) { pSandbox->papszEnvVars = (char **)pvNew; pSandbox->papszEnvVars[cOld] = NULL; pvNew = kHlpRealloc(pSandbox->wenviron, cNew * sizeof(pSandbox->wenviron[0])); if (pvNew) { pSandbox->wenviron = (wchar_t **)pvNew; pSandbox->wenviron[cOld] = NULL; pvNew = kHlpRealloc(pSandbox->papwszEnvVars, cNew * sizeof(pSandbox->papwszEnvVars[0])); if (pvNew) { pSandbox->papwszEnvVars = (wchar_t **)pvNew; pSandbox->papwszEnvVars[cOld] = NULL; pSandbox->cEnvVarsAllocated = cNew; KW_LOG(("kwSandboxGrowEnv: cNew=%d - crt: %p / %p; shadow: %p, %p\n", cNew, pSandbox->environ, pSandbox->wenviron, pSandbox->papszEnvVars, pSandbox->papwszEnvVars)); return 0; } } } } kwErrPrintf("kwSandboxGrowEnv ran out of memory! cNew=%u\n", cNew); return KERR_NO_MEMORY; } /** * Sets an environment variable, ANSI style. * * @returns 0 on success, non-zero on failure. * @param pSandbox The sandbox. * @param pchVar The variable name. * @param cchVar The length of the name. * @param pszValue The value. */ static int kwSandboxDoSetEnvA(PKWSANDBOX pSandbox, const char *pchVar, KSIZE cchVar, const char *pszValue) { /* Allocate and construct the new strings. */ KSIZE cchTmp = kHlpStrLen(pszValue); char *pszNew = (char *)kHlpAlloc(cchVar + 1 + cchTmp + 1); if (pszNew) { wchar_t *pwszNew; kHlpMemCopy(pszNew, pchVar, cchVar); pszNew[cchVar] = '='; kHlpMemCopy(&pszNew[cchVar + 1], pszValue, cchTmp); cchTmp += cchVar + 1; pszNew[cchTmp] = '\0'; pwszNew = kwStrToUtf16AllocN(pszNew, cchTmp); if (pwszNew) { /* Look it up. */ KSIZE iVar = 0; char *pszEnv; while ((pszEnv = pSandbox->papszEnvVars[iVar]) != NULL) { if ( _strnicmp(pszEnv, pchVar, cchVar) == 0 && pszEnv[cchVar] == '=') { KW_LOG(("kwSandboxDoSetEnvA: Replacing iVar=%d: %p='%s' and %p='%ls'\n" " iVar=%d: %p='%s' and %p='%ls'\n", iVar, pSandbox->papszEnvVars[iVar], pSandbox->papszEnvVars[iVar], pSandbox->papwszEnvVars[iVar], pSandbox->papwszEnvVars[iVar], iVar, pszNew, pszNew, pwszNew, pwszNew)); kHlpFree(pSandbox->papszEnvVars[iVar]); pSandbox->papszEnvVars[iVar] = pszNew; pSandbox->environ[iVar] = pszNew; kHlpFree(pSandbox->papwszEnvVars[iVar]); pSandbox->papwszEnvVars[iVar] = pwszNew; pSandbox->wenviron[iVar] = pwszNew; return 0; } iVar++; } /* Not found, do we need to grow the table first? */ if (iVar + 1 >= pSandbox->cEnvVarsAllocated) kwSandboxGrowEnv(pSandbox, iVar + 2); if (iVar + 1 < pSandbox->cEnvVarsAllocated) { KW_LOG(("kwSandboxDoSetEnvA: Adding iVar=%d: %p='%s' and %p='%ls'\n", iVar, pszNew, pszNew, pwszNew, pwszNew)); pSandbox->papszEnvVars[iVar + 1] = NULL; pSandbox->papszEnvVars[iVar] = pszNew; pSandbox->environ[iVar + 1] = NULL; pSandbox->environ[iVar] = pszNew; pSandbox->papwszEnvVars[iVar + 1] = NULL; pSandbox->papwszEnvVars[iVar] = pwszNew; pSandbox->wenviron[iVar + 1] = NULL; pSandbox->wenviron[iVar] = pwszNew; return 0; } kHlpFree(pwszNew); } kHlpFree(pszNew); } KW_LOG(("Out of memory!\n")); return 0; } /** * Sets an environment variable, UTF-16 style. * * @returns 0 on success, non-zero on failure. * @param pSandbox The sandbox. * @param pwcVar The variable name. * @param cwcVar The length of the name. * @param pwszValue The value. */ static int kwSandboxDoSetEnvW(PKWSANDBOX pSandbox, const wchar_t *pwchVar, KSIZE cwcVar, const wchar_t *pwszValue) { /* Allocate and construct the new strings. */ KSIZE cwcTmp = kwUtf16Len(pwszValue); wchar_t *pwszNew = (wchar_t *)kHlpAlloc((cwcVar + 1 + cwcTmp + 1) * sizeof(wchar_t)); if (pwszNew) { char *pszNew; kHlpMemCopy(pwszNew, pwchVar, cwcVar * sizeof(wchar_t)); pwszNew[cwcVar] = '='; kHlpMemCopy(&pwszNew[cwcVar + 1], pwszValue, cwcTmp * sizeof(wchar_t)); cwcTmp += cwcVar + 1; pwszNew[cwcVar] = '\0'; pszNew = kwUtf16ToStrAllocN(pwszNew, cwcVar); if (pszNew) { /* Look it up. */ KSIZE iVar = 0; wchar_t *pwszEnv; while ((pwszEnv = pSandbox->papwszEnvVars[iVar]) != NULL) { if ( _wcsnicmp(pwszEnv, pwchVar, cwcVar) == 0 && pwszEnv[cwcVar] == '=') { KW_LOG(("kwSandboxDoSetEnvW: Replacing iVar=%d: %p='%s' and %p='%ls'\n" " iVar=%d: %p='%s' and %p='%ls'\n", iVar, pSandbox->papszEnvVars[iVar], pSandbox->papszEnvVars[iVar], pSandbox->papwszEnvVars[iVar], pSandbox->papwszEnvVars[iVar], iVar, pszNew, pszNew, pwszNew, pwszNew)); kHlpFree(pSandbox->papszEnvVars[iVar]); pSandbox->papszEnvVars[iVar] = pszNew; pSandbox->environ[iVar] = pszNew; kHlpFree(pSandbox->papwszEnvVars[iVar]); pSandbox->papwszEnvVars[iVar] = pwszNew; pSandbox->wenviron[iVar] = pwszNew; return 0; } iVar++; } /* Not found, do we need to grow the table first? */ if (iVar + 1 >= pSandbox->cEnvVarsAllocated) kwSandboxGrowEnv(pSandbox, iVar + 2); if (iVar + 1 < pSandbox->cEnvVarsAllocated) { KW_LOG(("kwSandboxDoSetEnvW: Adding iVar=%d: %p='%s' and %p='%ls'\n", iVar, pszNew, pszNew, pwszNew, pwszNew)); pSandbox->papszEnvVars[iVar + 1] = NULL; pSandbox->papszEnvVars[iVar] = pszNew; pSandbox->environ[iVar + 1] = NULL; pSandbox->environ[iVar] = pszNew; pSandbox->papwszEnvVars[iVar + 1] = NULL; pSandbox->papwszEnvVars[iVar] = pwszNew; pSandbox->wenviron[iVar + 1] = NULL; pSandbox->wenviron[iVar] = pwszNew; return 0; } kHlpFree(pwszNew); } kHlpFree(pszNew); } KW_LOG(("Out of memory!\n")); return 0; } /** ANSI unsetenv worker. */ static int kwSandboxDoUnsetEnvA(PKWSANDBOX pSandbox, const char *pchVar, KSIZE cchVar) { KSIZE iVar = 0; char *pszEnv; while ((pszEnv = pSandbox->papszEnvVars[iVar]) != NULL) { if ( _strnicmp(pszEnv, pchVar, cchVar) == 0 && pszEnv[cchVar] == '=') { KSIZE cVars = iVar; while (pSandbox->papszEnvVars[cVars]) cVars++; kHlpAssert(pSandbox->papwszEnvVars[iVar] != NULL); kHlpAssert(pSandbox->papwszEnvVars[cVars] == NULL); KW_LOG(("kwSandboxDoUnsetEnvA: Removing iVar=%d: %p='%s' and %p='%ls'; new cVars=%d\n", iVar, pSandbox->papszEnvVars[iVar], pSandbox->papszEnvVars[iVar], pSandbox->papwszEnvVars[iVar], pSandbox->papwszEnvVars[iVar], cVars - 1)); kHlpFree(pSandbox->papszEnvVars[iVar]); pSandbox->papszEnvVars[iVar] = pSandbox->papszEnvVars[cVars]; pSandbox->environ[iVar] = pSandbox->papszEnvVars[cVars]; pSandbox->papszEnvVars[cVars] = NULL; pSandbox->environ[cVars] = NULL; kHlpFree(pSandbox->papwszEnvVars[iVar]); pSandbox->papwszEnvVars[iVar] = pSandbox->papwszEnvVars[cVars]; pSandbox->wenviron[iVar] = pSandbox->papwszEnvVars[cVars]; pSandbox->papwszEnvVars[cVars] = NULL; pSandbox->wenviron[cVars] = NULL; return 0; } iVar++; } return KERR_ENVVAR_NOT_FOUND; } /** UTF-16 unsetenv worker. */ static int kwSandboxDoUnsetEnvW(PKWSANDBOX pSandbox, const wchar_t *pwcVar, KSIZE cwcVar) { KSIZE iVar = 0; wchar_t *pwszEnv; while ((pwszEnv = pSandbox->papwszEnvVars[iVar]) != NULL) { if ( _wcsnicmp(pwszEnv, pwcVar, cwcVar) == 0 && pwszEnv[cwcVar] == '=') { KSIZE cVars = iVar; while (pSandbox->papwszEnvVars[cVars]) cVars++; kHlpAssert(pSandbox->papszEnvVars[iVar] != NULL); kHlpAssert(pSandbox->papszEnvVars[cVars] == NULL); KW_LOG(("kwSandboxDoUnsetEnvA: Removing iVar=%d: %p='%s' and %p='%ls'; new cVars=%d\n", iVar, pSandbox->papszEnvVars[iVar], pSandbox->papszEnvVars[iVar], pSandbox->papwszEnvVars[iVar], pSandbox->papwszEnvVars[iVar], cVars - 1)); kHlpFree(pSandbox->papszEnvVars[iVar]); pSandbox->papszEnvVars[iVar] = pSandbox->papszEnvVars[cVars]; pSandbox->environ[iVar] = pSandbox->papszEnvVars[cVars]; pSandbox->papszEnvVars[cVars] = NULL; pSandbox->environ[cVars] = NULL; kHlpFree(pSandbox->papwszEnvVars[iVar]); pSandbox->papwszEnvVars[iVar] = pSandbox->papwszEnvVars[cVars]; pSandbox->wenviron[iVar] = pSandbox->papwszEnvVars[cVars]; pSandbox->papwszEnvVars[cVars] = NULL; pSandbox->wenviron[cVars] = NULL; return 0; } iVar++; } return KERR_ENVVAR_NOT_FOUND; } /** ANSI getenv worker. */ static char *kwSandboxDoGetEnvA(PKWSANDBOX pSandbox, const char *pchVar, KSIZE cchVar) { KSIZE iVar = 0; char *pszEnv; while ((pszEnv = pSandbox->papszEnvVars[iVar++]) != NULL) if ( _strnicmp(pszEnv, pchVar, cchVar) == 0 && pszEnv[cchVar] == '=') return &pszEnv[cchVar + 1]; return NULL; } /** UTF-16 getenv worker. */ static wchar_t *kwSandboxDoGetEnvW(PKWSANDBOX pSandbox, const wchar_t *pwcVar, KSIZE cwcVar) { KSIZE iVar = 0; wchar_t *pwszEnv; while ((pwszEnv = pSandbox->papwszEnvVars[iVar++]) != NULL) if ( _wcsnicmp(pwszEnv, pwcVar, cwcVar) == 0 && pwszEnv[cwcVar] == '=') return &pwszEnv[cwcVar + 1]; return NULL; } /** Kernel32 - GetEnvironmentVariableA() */ static DWORD WINAPI kwSandbox_Kernel32_GetEnvironmentVariableA(LPCSTR pszVar, LPSTR pszValue, DWORD cbValue) { char *pszFoundValue; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pszFoundValue = kwSandboxDoGetEnvA(&g_Sandbox, pszVar, kHlpStrLen(pszVar)); if (pszFoundValue) { DWORD cchRet = kwStrCopyStyle1(pszFoundValue, pszValue, cbValue); KW_LOG(("GetEnvironmentVariableA: '%s' -> %u (%s)\n", pszVar, cchRet, pszFoundValue)); return cchRet; } KW_LOG(("GetEnvironmentVariableA: '%s' -> 0\n", pszVar)); SetLastError(ERROR_ENVVAR_NOT_FOUND); return 0; } /** Kernel32 - GetEnvironmentVariableW() */ static DWORD WINAPI kwSandbox_Kernel32_GetEnvironmentVariableW(LPCWSTR pwszVar, LPWSTR pwszValue, DWORD cwcValue) { wchar_t *pwszFoundValue; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pwszFoundValue = kwSandboxDoGetEnvW(&g_Sandbox, pwszVar, kwUtf16Len(pwszVar)); if (pwszFoundValue) { DWORD cchRet = kwUtf16CopyStyle1(pwszFoundValue, pwszValue, cwcValue); KW_LOG(("GetEnvironmentVariableW: '%ls' -> %u (%ls)\n", pwszVar, cchRet, pwszFoundValue)); return cchRet; } KW_LOG(("GetEnvironmentVariableW: '%ls' -> 0\n", pwszVar)); SetLastError(ERROR_ENVVAR_NOT_FOUND); return 0; } /** Kernel32 - SetEnvironmentVariableA() */ static BOOL WINAPI kwSandbox_Kernel32_SetEnvironmentVariableA(LPCSTR pszVar, LPCSTR pszValue) { int rc; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); if (pszValue) rc = kwSandboxDoSetEnvA(&g_Sandbox, pszVar, kHlpStrLen(pszVar), pszValue); else { kwSandboxDoUnsetEnvA(&g_Sandbox, pszVar, kHlpStrLen(pszVar)); rc = 0; //?? } if (rc == 0) { KW_LOG(("SetEnvironmentVariableA(%s,%s) -> TRUE\n", pszVar, pszValue)); return TRUE; } SetLastError(ERROR_NOT_ENOUGH_MEMORY); KW_LOG(("SetEnvironmentVariableA(%s,%s) -> FALSE!\n", pszVar, pszValue)); return FALSE; } /** Kernel32 - SetEnvironmentVariableW() */ static BOOL WINAPI kwSandbox_Kernel32_SetEnvironmentVariableW(LPCWSTR pwszVar, LPCWSTR pwszValue) { int rc; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); if (pwszValue) rc = kwSandboxDoSetEnvW(&g_Sandbox, pwszVar, kwUtf16Len(pwszVar), pwszValue); else { kwSandboxDoUnsetEnvW(&g_Sandbox, pwszVar, kwUtf16Len(pwszVar)); rc = 0; //?? } if (rc == 0) { KW_LOG(("SetEnvironmentVariableA(%ls,%ls) -> TRUE\n", pwszVar, pwszValue)); return TRUE; } SetLastError(ERROR_NOT_ENOUGH_MEMORY); KW_LOG(("SetEnvironmentVariableA(%ls,%ls) -> FALSE!\n", pwszVar, pwszValue)); return FALSE; } /** Kernel32 - ExpandEnvironmentStringsA() */ static DWORD WINAPI kwSandbox_Kernel32_ExpandEnvironmentStringsA(LPCSTR pszSrc, LPSTR pwszDst, DWORD cbDst) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KWFS_TODO(); return 0; } /** Kernel32 - ExpandEnvironmentStringsW() */ static DWORD WINAPI kwSandbox_Kernel32_ExpandEnvironmentStringsW(LPCWSTR pwszSrc, LPWSTR pwszDst, DWORD cbDst) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KWFS_TODO(); return 0; } /** CRT - _putenv(). */ static int __cdecl kwSandbox_msvcrt__putenv(const char *pszVarEqualValue) { int rc; char const *pszEqual; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pszEqual = kHlpStrChr(pszVarEqualValue, '='); if (pszEqual) { rc = kwSandboxDoSetEnvA(&g_Sandbox, pszVarEqualValue, pszEqual - pszVarEqualValue, pszEqual + 1); if (rc == 0) { } else rc = -1; } else { kwSandboxDoUnsetEnvA(&g_Sandbox, pszVarEqualValue, kHlpStrLen(pszVarEqualValue)); rc = 0; } KW_LOG(("_putenv(%s) -> %d\n", pszVarEqualValue, rc)); return rc; } /** CRT - _wputenv(). */ static int __cdecl kwSandbox_msvcrt__wputenv(const wchar_t *pwszVarEqualValue) { int rc; wchar_t const *pwszEqual; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pwszEqual = wcschr(pwszVarEqualValue, '='); if (pwszEqual) { rc = kwSandboxDoSetEnvW(&g_Sandbox, pwszVarEqualValue, pwszEqual - pwszVarEqualValue, pwszEqual + 1); if (rc == 0) { } else rc = -1; } else { kwSandboxDoUnsetEnvW(&g_Sandbox, pwszVarEqualValue, kwUtf16Len(pwszVarEqualValue)); rc = 0; } KW_LOG(("_wputenv(%ls) -> %d\n", pwszVarEqualValue, rc)); return rc; } /** CRT - _putenv_s(). */ static errno_t __cdecl kwSandbox_msvcrt__putenv_s(const char *pszVar, const char *pszValue) { char const *pszEqual; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pszEqual = kHlpStrChr(pszVar, '='); if (pszEqual == NULL) { if (pszValue) { int rc = kwSandboxDoSetEnvA(&g_Sandbox, pszVar, kHlpStrLen(pszVar), pszValue); if (rc == 0) { KW_LOG(("_putenv_s(%s,%s) -> 0\n", pszVar, pszValue)); return 0; } } else { kwSandboxDoUnsetEnvA(&g_Sandbox, pszVar, kHlpStrLen(pszVar)); KW_LOG(("_putenv_s(%ls,NULL) -> 0\n", pszVar)); return 0; } KW_LOG(("_putenv_s(%s,%s) -> ENOMEM\n", pszVar, pszValue)); return ENOMEM; } KW_LOG(("_putenv_s(%s,%s) -> EINVAL\n", pszVar, pszValue)); return EINVAL; } /** CRT - _wputenv_s(). */ static errno_t __cdecl kwSandbox_msvcrt__wputenv_s(const wchar_t *pwszVar, const wchar_t *pwszValue) { wchar_t const *pwszEqual; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pwszEqual = wcschr(pwszVar, '='); if (pwszEqual == NULL) { if (pwszValue) { int rc = kwSandboxDoSetEnvW(&g_Sandbox, pwszVar, kwUtf16Len(pwszVar), pwszValue); if (rc == 0) { KW_LOG(("_wputenv_s(%ls,%ls) -> 0\n", pwszVar, pwszValue)); return 0; } } else { kwSandboxDoUnsetEnvW(&g_Sandbox, pwszVar, kwUtf16Len(pwszVar)); KW_LOG(("_wputenv_s(%ls,NULL) -> 0\n", pwszVar)); return 0; } KW_LOG(("_wputenv_s(%ls,%ls) -> ENOMEM\n", pwszVar, pwszValue)); return ENOMEM; } KW_LOG(("_wputenv_s(%ls,%ls) -> EINVAL\n", pwszVar, pwszValue)); return EINVAL; } /** CRT - get pointer to the __initenv variable (initial environment). */ static char *** __cdecl kwSandbox_msvcrt___p___initenv(void) { KW_LOG(("__p___initenv\n")); kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KWFS_TODO(); return &g_Sandbox.initenv; } /** CRT - get pointer to the __winitenv variable (initial environment). */ static wchar_t *** __cdecl kwSandbox_msvcrt___p___winitenv(void) { KW_LOG(("__p___winitenv\n")); kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KWFS_TODO(); return &g_Sandbox.winitenv; } /** CRT - get pointer to the _environ variable (current environment). */ static char *** __cdecl kwSandbox_msvcrt___p__environ(void) { KW_LOG(("__p__environ\n")); kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return &g_Sandbox.environ; } /** CRT - get pointer to the _wenviron variable (current environment). */ static wchar_t *** __cdecl kwSandbox_msvcrt___p__wenviron(void) { KW_LOG(("__p__wenviron\n")); kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return &g_Sandbox.wenviron; } /** CRT - get the _environ variable (current environment). * @remarks Not documented or prototyped? */ static KUPTR /*void*/ __cdecl kwSandbox_msvcrt__get_environ(char ***ppapszEnviron) { KWFS_TODO(); /** @todo check the callers expectations! */ kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); *ppapszEnviron = g_Sandbox.environ; return 0; } /** CRT - get the _wenviron variable (current environment). * @remarks Not documented or prototyped? */ static KUPTR /*void*/ __cdecl kwSandbox_msvcrt__get_wenviron(wchar_t ***ppapwszEnviron) { KWFS_TODO(); /** @todo check the callers expectations! */ kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); *ppapwszEnviron = g_Sandbox.wenviron; return 0; } /** CRT - _wdupenv_s() (see _tdupenv_s(). */ static errno_t __cdecl kwSandbox_msvcrt__wdupenv_s_wrapped(wchar_t **ppwszValue, size_t *pcwcValue, const wchar_t *pwszVarName, PKWCRTSLOT pSlot) { errno_t rc; wchar_t *pwszValue; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); if (ppwszValue) { pwszValue = kwSandboxDoGetEnvW(&g_Sandbox, pwszVarName, wcslen(pwszVarName)); if (pwszValue) { size_t cwcValue = wcslen(pwszValue); wchar_t *pwszDst = pSlot->pfnMalloc ? (wchar_t *)pSlot->pfnMalloc((cwcValue + 1) * sizeof(wchar_t)) : NULL; if (pwszDst) { memcpy(pwszDst, pwszValue, cwcValue * sizeof(wchar_t)); pwszDst[cwcValue] = '\0'; *ppwszValue = pwszDst; if (pcwcValue) *pcwcValue = cwcValue; rc = 0; } else { *ppwszValue = NULL; if (pcwcValue) *pcwcValue = 0; rc = ENOMEM; } } else { *ppwszValue = NULL; if (pcwcValue) *pcwcValue = 0; rc = 0; } KW_LOG(("_wdupenv_s(,,%ls) -> %d '%ls'\n", pwszVarName, rc, *ppwszValue ? *ppwszValue : L"<null>")); //fprintf(stderr, "%d: _wdupenv_s(,,%ls) -> %d '%ls'\n", getpid(), pwszVarName, rc, *ppwszValue ? *ppwszValue : L"<null>"); fflush(stderr); // HACKING } else { /* * Warning! If mspdb100.dll ends up here, it won't reinitialize the event name * and continue to use the one it constructed when _MSPDBSRV_ENDPOINT_ * was set to a value. */ if (pcwcValue) *pcwcValue = 0; rc = EINVAL; KW_LOG(("_wdupenv_s(,,%ls) -> EINVAL\n", pwszVarName)); //fprintf(stderr, "%d: _wdupenv_s(,,%ls) -> EINVAL\n", getpid(), pwszVarName); fflush(stderr); // HACKING } return rc; } CRT_SLOT_FUNCTION_WRAPPER(errno_t __cdecl, kwSandbox_msvcrt__wdupenv_s, (wchar_t **ppwszValue, size_t *pcwcValue, const wchar_t *pwszVarName), (ppwszValue, pcwcValue, pwszVarName, &g_aCrtSlots[iCrtSlot])); /* * * Loader related APIs * Loader related APIs * Loader related APIs * */ /** * Kernel32 - LoadLibraryExA() worker that loads resource files and such. */ static HMODULE WINAPI kwSandbox_Kernel32_LoadLibraryExA_Resource(PKWDYNLOAD pDynLoad, DWORD fFlags) { /* Load it first. */ HMODULE hmod = LoadLibraryExA(pDynLoad->szRequest, NULL /*hFile*/, fFlags); if (hmod) { pDynLoad->hmod = hmod; pDynLoad->pMod = NULL; /* indicates special */ pDynLoad->pNext = g_Sandbox.pTool->u.Sandboxed.pDynLoadHead; g_Sandbox.pTool->u.Sandboxed.pDynLoadHead = pDynLoad; KWLDR_LOG(("LoadLibraryExA(%s,,[resource]) -> %p\n", pDynLoad->szRequest, pDynLoad->hmod)); } else kHlpFree(pDynLoad); return hmod; } /** * Kernel32 - LoadLibraryExA() worker that deals with the api-ms-xxx modules. */ static HMODULE WINAPI kwSandbox_Kernel32_LoadLibraryExA_VirtualApiModule(PKWDYNLOAD pDynLoad, DWORD fFlags) { static const char s_szDll[] = ".dll"; KSIZE cbFilename = kHlpStrLen(pDynLoad->szRequest) + 1; PKWMODULE pMod; char szNormPath[256]; /* * Lower case it and make sure it ends with .dll. */ if (cbFilename > sizeof(szNormPath)) { SetLastError(ERROR_FILENAME_EXCED_RANGE); return NULL; } kHlpMemCopy(szNormPath, pDynLoad->szRequest, cbFilename); _strlwr(szNormPath); kHlpAssert(cbFilename > 7 /* api-ms- */ ); if (strcmp(&szNormPath[cbFilename - 5], s_szDll) != 0) { if (cbFilename + sizeof(s_szDll) - 1 > sizeof(szNormPath)) { SetLastError(ERROR_FILENAME_EXCED_RANGE); return NULL; } memcpy(&szNormPath[cbFilename - sizeof(s_szDll)], s_szDll, sizeof(s_szDll)); cbFilename += sizeof(s_szDll) - 1; } /* * Try load it. */ pMod = kwLdrModuleTryLoadVirtualDll(szNormPath, cbFilename - 1); if (pMod) { kwToolAddModuleAndImports(g_Sandbox.pTool, pMod); pDynLoad->pMod = pMod; pDynLoad->hmod = pMod->hOurMod; pDynLoad->pNext = g_Sandbox.pTool->u.Sandboxed.pDynLoadHead; g_Sandbox.pTool->u.Sandboxed.pDynLoadHead = pDynLoad; KWLDR_LOG(("LoadLibraryExA(%s,,) -> %p [virtual API module - new]\n", pDynLoad->szRequest, pDynLoad->hmod)); return pDynLoad->hmod; } kHlpFree(pDynLoad); return NULL; } /** Kernel32 - LoadLibraryExA() */ static HMODULE WINAPI kwSandbox_Kernel32_LoadLibraryExA(LPCSTR pszFilename, HANDLE hFile, DWORD fFlags) { KSIZE cchFilename = kHlpStrLen(pszFilename); const char *pszSearchPath; PKWDYNLOAD pDynLoad; PKWMODULE pMod; int rc; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); //fprintf(stderr, "LoadLibraryExA: %s, %#x\n", pszFilename, fFlags); /* * Deal with a couple of extremely unlikely special cases right away. */ if ( ( !(fFlags & LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE) || (fFlags & LOAD_LIBRARY_AS_IMAGE_RESOURCE)) && (hFile == NULL || hFile == INVALID_HANDLE_VALUE) ) { /* likely */ } else { KWFS_TODO(); return LoadLibraryExA(pszFilename, hFile, fFlags); } /* * Check if we've already got a dynload entry for this one. */ for (pDynLoad = g_Sandbox.pTool->u.Sandboxed.pDynLoadHead; pDynLoad; pDynLoad = pDynLoad->pNext) if ( pDynLoad->cchRequest == cchFilename && kHlpMemComp(pDynLoad->szRequest, pszFilename, cchFilename) == 0) { if (pDynLoad->pMod) rc = kwLdrModuleInitTree(pDynLoad->pMod); else rc = 0; if (rc == 0) { KWLDR_LOG(("LoadLibraryExA(%s,,) -> %p [cached]\n", pszFilename, pDynLoad->hmod)); return pDynLoad->hmod; } SetLastError(ERROR_DLL_INIT_FAILED); return NULL; } /* * Allocate a dynload entry for the request. */ pDynLoad = (PKWDYNLOAD)kHlpAlloc(sizeof(*pDynLoad) + cchFilename + 1); if (pDynLoad) { pDynLoad->cchRequest = cchFilename; kHlpMemCopy(pDynLoad->szRequest, pszFilename, cchFilename + 1); } else { KWLDR_LOG(("LoadLibraryExA: Out of memory!\n")); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return NULL; } /* * Deal with resource / data DLLs. */ if (fFlags & ( DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | LOAD_LIBRARY_AS_IMAGE_RESOURCE) ) return kwSandbox_Kernel32_LoadLibraryExA_Resource(pDynLoad, fFlags); /* * Special case: api-ms-win-core-synch-l1-2-0 and friends (32-bit yasm, built with VS2015). */ if ( kwLdrIsVirtualApiModule(pszFilename, cchFilename) && kHlpIsFilenameOnly(pszFilename)) return kwSandbox_Kernel32_LoadLibraryExA_VirtualApiModule(pDynLoad, fFlags); /* * Normal library loading. * We start by being very lazy and reusing the code for resolving imports. */ pszSearchPath = kwSandboxDoGetEnvA(&g_Sandbox, "PATH", 4); if (!kHlpIsFilenameOnly(pszFilename)) pMod = kwLdrModuleTryLoadDll(pszFilename, KWLOCATION_UNKNOWN, g_Sandbox.pTool->u.Sandboxed.pExe, pszSearchPath); #if 1 /* HACK ALERT! We run into trouble with a 2nd mspdb140.dll instance (x64 + x86), so use the one already loaded. A call * to NdrClientCall2 at ConnectToServer+0x426 fails with E_INVALIDARG. Problems with multiple connections from same PID? */ else if ( strcmp(pszFilename, "mspdb140.dll") == 0 && GetModuleHandleA(pszFilename) != NULL) { pMod = kwLdrModuleForLoadedNativeByHandle(GetModuleHandleA(pszFilename), K_FALSE, pszFilename); KWLDR_LOG(("LoadLibraryExA: mspdb140 hack: pMod=%p\n", pMod)); } #endif else { rc = kwLdrModuleResolveAndLookup(pszFilename, g_Sandbox.pTool->u.Sandboxed.pExe, NULL /*pImporter*/, pszSearchPath, &pMod); if (rc != 0) pMod = NULL; } if (pMod && pMod != (PKWMODULE)~(KUPTR)0) { /* Enter it into the tool module table and dynamic link request cache. */ kwToolAddModuleAndImports(g_Sandbox.pTool, pMod); pDynLoad->pMod = pMod; pDynLoad->hmod = pMod->hOurMod; pDynLoad->pNext = g_Sandbox.pTool->u.Sandboxed.pDynLoadHead; g_Sandbox.pTool->u.Sandboxed.pDynLoadHead = pDynLoad; /* * Make sure it's initialized (need to link it first since DllMain may * use loader APIs). */ rc = kwLdrModuleInitTree(pMod); if (rc == 0) { KWLDR_LOG(("LoadLibraryExA(%s,,) -> %p\n", pszFilename, pDynLoad->hmod)); return pDynLoad->hmod; } SetLastError(ERROR_DLL_INIT_FAILED); } else { KWFS_TODO(); kHlpFree(pDynLoad); SetLastError(pMod ? ERROR_BAD_EXE_FORMAT : ERROR_MOD_NOT_FOUND); } return NULL; } /** Kernel32 - LoadLibraryExA() for native overloads */ static HMODULE WINAPI kwSandbox_Kernel32_Native_LoadLibraryExA(LPCSTR pszFilename, HANDLE hFile, DWORD fFlags) { char szPath[1024]; KWLDR_LOG(("kwSandbox_Kernel32_Native_LoadLibraryExA(%s, %p, %#x)\n", pszFilename, hFile, fFlags)); /* * We may have to help resolved unqualified DLLs living in the executable directory. */ if ( kHlpIsFilenameOnly(pszFilename) && g_Sandbox.pTool && g_Sandbox.pTool->u.Sandboxed.pExe) { KSIZE const cchFilename = kHlpStrLen(pszFilename); #define MY_IMATCH(a_szName) (cchFilename == sizeof(a_szName) - 1 && kHlpStrICompAscii(pszFilename, a_szName) == 0) if ( !kwLdrIsVirtualApiModule(pszFilename, cchFilename) && !MY_IMATCH("ntdll") && !MY_IMATCH("kernel32") && !MY_IMATCH("ntdll.dll") && !MY_IMATCH("kernelbase") && !MY_IMATCH("kernel32.dll") && !MY_IMATCH("kernelbase.dll") ) #undef MY_IMATCH { KSIZE cchExePath = g_Sandbox.pTool->u.Sandboxed.pExe->offFilename; if (cchExePath + cchFilename + 1 <= sizeof(szPath)) { kHlpMemCopy(szPath, g_Sandbox.pTool->u.Sandboxed.pExe->pszPath, cchExePath); kHlpMemCopy(&szPath[cchExePath], pszFilename, cchFilename + 1); if (kwFsPathExists(szPath)) { KWLDR_LOG(("kwSandbox_Kernel32_Native_LoadLibraryExA: %s -> %s\n", pszFilename, szPath)); pszFilename = szPath; } } if (pszFilename != szPath) { KSIZE cchSuffix = 0; KBOOL fNeedSuffix = K_FALSE; const char *pszCur = kwSandboxDoGetEnvA(&g_Sandbox, "PATH", 4); kHlpAssert(pszCur); if (pszCur) { while (*pszCur != '\0') { /* Find the end of the component */ KSIZE cch = 0; while (pszCur[cch] != ';' && pszCur[cch] != '\0') cch++; if ( cch > 0 /* wrong, but whatever */ && cch + 1 + cchFilename + cchSuffix < sizeof(szPath)) { char *pszDst = kHlpMemPCopy(szPath, pszCur, cch); if ( szPath[cch - 1] != ':' && szPath[cch - 1] != '/' && szPath[cch - 1] != '\\') *pszDst++ = '\\'; pszDst = kHlpMemPCopy(pszDst, pszFilename, cchFilename); if (fNeedSuffix) pszDst = kHlpMemPCopy(pszDst, ".dll", 4); *pszDst = '\0'; if (kwFsPathExists(szPath)) { KWLDR_LOG(("kwSandbox_Kernel32_Native_LoadLibraryExA: %s -> %s\n", pszFilename, szPath)); pszFilename = szPath; break; } } /* Advance */ pszCur += cch; while (*pszCur == ';') pszCur++; } } } } } return LoadLibraryExA(pszFilename, hFile, fFlags); } /** Kernel32 - LoadLibraryExW() for native overloads */ static HMODULE WINAPI kwSandbox_Kernel32_Native_LoadLibraryExW(LPCWSTR pwszFilename, HANDLE hFile, DWORD fFlags) { char szTmp[4096]; KSIZE cchTmp = kwUtf16ToStr(pwszFilename, szTmp, sizeof(szTmp)); if (cchTmp < sizeof(szTmp)) return kwSandbox_Kernel32_Native_LoadLibraryExA(szTmp, hFile, fFlags); KWFS_TODO(); SetLastError(ERROR_FILENAME_EXCED_RANGE); return NULL; } /** Kernel32 - LoadLibraryExW() */ static HMODULE WINAPI kwSandbox_Kernel32_LoadLibraryExW(LPCWSTR pwszFilename, HANDLE hFile, DWORD fFlags) { char szTmp[4096]; KSIZE cchTmp = kwUtf16ToStr(pwszFilename, szTmp, sizeof(szTmp)); if (cchTmp < sizeof(szTmp)) return kwSandbox_Kernel32_LoadLibraryExA(szTmp, hFile, fFlags); KWFS_TODO(); SetLastError(ERROR_FILENAME_EXCED_RANGE); return NULL; } /** Kernel32 - LoadLibraryA() */ static HMODULE WINAPI kwSandbox_Kernel32_LoadLibraryA(LPCSTR pszFilename) { return kwSandbox_Kernel32_LoadLibraryExA(pszFilename, NULL /*hFile*/, 0 /*fFlags*/); } /** Kernel32 - LoadLibraryW() */ static HMODULE WINAPI kwSandbox_Kernel32_LoadLibraryW(LPCWSTR pwszFilename) { char szTmp[4096]; KSIZE cchTmp = kwUtf16ToStr(pwszFilename, szTmp, sizeof(szTmp)); if (cchTmp < sizeof(szTmp)) return kwSandbox_Kernel32_LoadLibraryExA(szTmp, NULL /*hFile*/, 0 /*fFlags*/); KWFS_TODO(); SetLastError(ERROR_FILENAME_EXCED_RANGE); return NULL; } /** Kernel32 - FreeLibrary() */ static BOOL WINAPI kwSandbox_Kernel32_FreeLibrary(HMODULE hmod) { /* Ignored, we like to keep everything loaded. */ kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); return TRUE; } /** Worker for GetModuleHandleA/W for handling cached modules. */ static HMODULE kwSandbox_Kernel32_GetModuleHandle_ReturnedCachedEntry(KSIZE i) { HMODULE hmod = g_aGetModuleHandleCache[i].hmod; if (hmod) KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandle_ReturnedCachedEntry(%u/%s -> %p [cached]\n", hmod, g_aGetModuleHandleCache[i].pszName)); else { /* * The first time around we have to make sure we have a module table * entry for it, if not we add one. We need to add it to the tools * module list to for it to work. */ PKWMODULE pMod = kwLdrModuleForLoadedNative(g_aGetModuleHandleCache[i].pszName, K_FALSE, g_aGetModuleHandleCache[i].fAlwaysPresent); if (pMod) { hmod = pMod->hOurMod; if (!kwToolLocateModuleByHandle(g_Sandbox.pTool, hmod)) { kwToolAddModule(g_Sandbox.pTool, pMod); KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandle_ReturnedCachedEntry(%u/%s -> %p [added to tool]\n", hmod, g_aGetModuleHandleCache[i].pszName)); } else KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandle_ReturnedCachedEntry(%u/%s -> %p [known to tool]\n", hmod, g_aGetModuleHandleCache[i].pszName)); } } return hmod; } /** Kernel32 - GetModuleHandleA() */ static HMODULE WINAPI kwSandbox_Kernel32_GetModuleHandleA(LPCSTR pszModule) { KSIZE i; KSIZE cchModule; PKWDYNLOAD pDynLoad; KSIZE cchSuffix; DWORD dwErr = ERROR_MOD_NOT_FOUND; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); /* * The executable. */ if (pszModule == NULL) { KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandleA(NULL) -> %p (exe)\n", g_Sandbox.pTool->u.Sandboxed.pExe->hOurMod)); return (HMODULE)g_Sandbox.pTool->u.Sandboxed.pExe->hOurMod; } /* * If no path of suffix, pretend it ends with .DLL. */ cchSuffix = strpbrk(pszModule, ":/\\.") ? 0 : 4; /* * Cache of system modules we've seen queried. */ cchModule = kHlpStrLen(pszModule); for (i = 0; i < K_ELEMENTS(g_aGetModuleHandleCache); i++) if ( ( g_aGetModuleHandleCache[i].cchName == cchModule && stricmp(pszModule, g_aGetModuleHandleCache[i].pszName) == 0) || ( cchSuffix > 0 && g_aGetModuleHandleCache[i].cchName == cchModule + cchSuffix && strnicmp(pszModule, g_aGetModuleHandleCache[i].pszName, cchModule) && stricmp(&g_aGetModuleHandleCache[i].pszName[cchModule], ".dll") == 0)) return kwSandbox_Kernel32_GetModuleHandle_ReturnedCachedEntry(i); /* * Modules we've dynamically loaded. */ for (pDynLoad = g_Sandbox.pTool->u.Sandboxed.pDynLoadHead; pDynLoad; pDynLoad = pDynLoad->pNext) if (pDynLoad->pMod) { const char *pszPath = pDynLoad->pMod->pszPath; const char *pszName = &pszPath[pDynLoad->pMod->offFilename]; if ( stricmp(pszPath, pszModule) == 0 || stricmp(pszName, pszModule) == 0 || ( cchSuffix > 0 && strnicmp(pszName, pszModule, cchModule) == 0 && stricmp(&pszName[cchModule], ".dll") == 0)) { if ( pDynLoad->pMod->fNative || pDynLoad->pMod->u.Manual.enmState == KWMODSTATE_READY) { KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandleA(%s,,) -> %p [dynload]\n", pszModule, pDynLoad->hmod)); return pDynLoad->hmod; } KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandleA(%s) -> NULL (not read)\n", pszModule)); SetLastError(ERROR_MOD_NOT_FOUND); return NULL; } } /* * Hack for the api-ms-win-xxxxx.dll modules. Find which module they map * to and go via the g_aGetModuleHandleCache cache. */ /** @todo virtual api DLLs */ if (kHlpStrNICompAscii(pszModule, "api-ms-win-", 11) == 0) { HMODULE hmod = GetModuleHandleA(pszModule); KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandleA(%s); hmod=%p\n", pszModule, hmod)); if (hmod) { if (hmod == GetModuleHandleW(L"KERNELBASE.DLL")) return kwSandbox_Kernel32_GetModuleHandleA("KERNELBASE.DLL"); if (hmod == GetModuleHandleW(L"KERNEL32.DLL")) return kwSandbox_Kernel32_GetModuleHandleA("KERNEL32.DLL"); if (hmod == GetModuleHandleW(L"NTDLL.DLL")) return kwSandbox_Kernel32_GetModuleHandleA("NTDLL.DLL"); if (hmod == GetModuleHandleW(L"UCRTBASE.DLL")) return kwSandbox_Kernel32_GetModuleHandleA("UCRTBASE.DLL"); } else dwErr = GetLastError(); } kwErrPrintf("pszModule=%s\n", pszModule); KWFS_TODO(); SetLastError(ERROR_MOD_NOT_FOUND); return NULL; } /** Kernel32 - GetModuleHandleW() */ static HMODULE WINAPI kwSandbox_Kernel32_GetModuleHandleW(LPCWSTR pwszModule) { KSIZE i; KSIZE cwcModule; PKWDYNLOAD pDynLoad; KSIZE cwcSuffix; DWORD dwErr = ERROR_MOD_NOT_FOUND; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); /* * The executable. */ if (pwszModule == NULL) { KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandleW(NULL) -> %p (exe)\n", g_Sandbox.pTool->u.Sandboxed.pExe->hOurMod)); return (HMODULE)g_Sandbox.pTool->u.Sandboxed.pExe->hOurMod; } /* * If no path of suffix, pretend it ends with .DLL. */ cwcSuffix = wcspbrk(pwszModule, L":/\\.") ? 0 : 4; /* * Cache of system modules we've seen queried. */ cwcModule = kwUtf16Len(pwszModule); for (i = 0; i < K_ELEMENTS(g_aGetModuleHandleCache); i++) if ( ( g_aGetModuleHandleCache[i].cwcName == cwcModule && _wcsicmp(pwszModule, g_aGetModuleHandleCache[i].pwszName) == 0) || ( cwcSuffix > 0 && g_aGetModuleHandleCache[i].cwcName == cwcModule + cwcSuffix && _wcsnicmp(pwszModule, g_aGetModuleHandleCache[i].pwszName, cwcModule) == 0 && _wcsicmp(&g_aGetModuleHandleCache[i].pwszName[cwcModule], L".dll") == 0)) return kwSandbox_Kernel32_GetModuleHandle_ReturnedCachedEntry(i); /* * Modules we've dynamically loaded. */ for (pDynLoad = g_Sandbox.pTool->u.Sandboxed.pDynLoadHead; pDynLoad; pDynLoad = pDynLoad->pNext) if (pDynLoad->pMod) { const wchar_t *pwszPath = pDynLoad->pMod->pwszPath; const wchar_t *pwszName = &pwszPath[pDynLoad->pMod->offFilenameW]; if ( _wcsicmp(pwszPath, pwszModule) == 0 || _wcsicmp(pwszName, pwszModule) == 0 || ( cwcSuffix && _wcsnicmp(pwszName, pwszModule, cwcModule) == 0 && _wcsicmp(&pwszName[cwcModule], L".dll") == 0)) { if ( pDynLoad->pMod->fNative || pDynLoad->pMod->u.Manual.enmState == KWMODSTATE_READY) { KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandleW(%ls,,) -> %p [dynload]\n", pwszModule, pDynLoad->hmod)); return pDynLoad->hmod; } KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandleW(%ls) -> NULL (not read)\n", pwszModule)); SetLastError(ERROR_MOD_NOT_FOUND); return NULL; } } /* * Hack for the api-ms-win-xxxxx.dll modules. Find which module they map * to and go via the g_aGetModuleHandleCache cache. */ if (_wcsnicmp(pwszModule, L"api-ms-win-", 11) == 0) { HMODULE hmod = GetModuleHandleW(pwszModule); KWLDR_LOG(("kwSandbox_Kernel32_GetModuleHandleW(%ls); hmod=%p\n", pwszModule, hmod)); if (hmod) { if (hmod == GetModuleHandleW(L"KERNELBASE.DLL")) return kwSandbox_Kernel32_GetModuleHandleW(L"KERNELBASE.DLL"); if (hmod == GetModuleHandleW(L"KERNEL32.DLL")) return kwSandbox_Kernel32_GetModuleHandleW(L"KERNEL32.DLL"); if (hmod == GetModuleHandleW(L"NTDLL.DLL")) return kwSandbox_Kernel32_GetModuleHandleW(L"NTDLL.DLL"); } else dwErr = GetLastError(); } kwErrPrintf("pwszModule=%ls\n", pwszModule); KWFS_TODO(); SetLastError(dwErr); return NULL; } /** Used to debug dynamically resolved procedures. */ static UINT WINAPI kwSandbox_BreakIntoDebugger(void *pv1, void *pv2, void *pv3, void *pv4) { #ifdef _MSC_VER __debugbreak(); #else KWFS_TODO(); #endif return ~(UINT)0; } #ifndef NDEBUG /* * This wraps up to three InvokeCompilerPassW functions and dumps their arguments to the log. */ # if K_ARCH == K_ARCH_X86_32 static char g_szInvokeCompilePassW[] = "_InvokeCompilerPassW@16"; # else static char g_szInvokeCompilePassW[] = "InvokeCompilerPassW"; # endif typedef KIPTR __stdcall FNINVOKECOMPILERPASSW(int cArgs, wchar_t **papwszArgs, KUPTR fFlags, void **phCluiInstance); typedef FNINVOKECOMPILERPASSW *PFNINVOKECOMPILERPASSW; typedef struct KWCXINTERCEPTORENTRY { PFNINVOKECOMPILERPASSW pfnOrg; PKWMODULE pModule; PFNINVOKECOMPILERPASSW pfnWrap; } KWCXINTERCEPTORENTRY; static KIPTR kwSandbox_Cx_InvokeCompilerPassW_Common(int cArgs, wchar_t **papwszArgs, KUPTR fFlags, void **phCluiInstance, KWCXINTERCEPTORENTRY *pEntry) { int i; KIPTR rcExit; KW_LOG(("%s!InvokeCompilerPassW(%d, %p, %#x, %p)\n", &pEntry->pModule->pszPath[pEntry->pModule->offFilename], cArgs, papwszArgs, fFlags, phCluiInstance)); for (i = 0; i < cArgs; i++) KW_LOG((" papwszArgs[%u]='%ls'\n", i, papwszArgs[i])); rcExit = pEntry->pfnOrg(cArgs, papwszArgs, fFlags, phCluiInstance); KW_LOG(("%s!InvokeCompilerPassW returns %d\n", &pEntry->pModule->pszPath[pEntry->pModule->offFilename], rcExit)); return rcExit; } static FNINVOKECOMPILERPASSW kwSandbox_Cx_InvokeCompilerPassW_0; static FNINVOKECOMPILERPASSW kwSandbox_Cx_InvokeCompilerPassW_1; static FNINVOKECOMPILERPASSW kwSandbox_Cx_InvokeCompilerPassW_2; static KWCXINTERCEPTORENTRY g_aCxInterceptorEntries[] = { { NULL, NULL, kwSandbox_Cx_InvokeCompilerPassW_0 }, { NULL, NULL, kwSandbox_Cx_InvokeCompilerPassW_1 }, { NULL, NULL, kwSandbox_Cx_InvokeCompilerPassW_2 }, }; static KIPTR __stdcall kwSandbox_Cx_InvokeCompilerPassW_0(int cArgs, wchar_t **papwszArgs, KUPTR fFlags, void **phCluiInstance) { return kwSandbox_Cx_InvokeCompilerPassW_Common(cArgs, papwszArgs, fFlags, phCluiInstance, &g_aCxInterceptorEntries[0]); } static KIPTR __stdcall kwSandbox_Cx_InvokeCompilerPassW_1(int cArgs, wchar_t **papwszArgs, KUPTR fFlags, void **phCluiInstance) { return kwSandbox_Cx_InvokeCompilerPassW_Common(cArgs, papwszArgs, fFlags, phCluiInstance, &g_aCxInterceptorEntries[1]); } static KIPTR __stdcall kwSandbox_Cx_InvokeCompilerPassW_2(int cArgs, wchar_t **papwszArgs, KUPTR fFlags, void **phCluiInstance) { return kwSandbox_Cx_InvokeCompilerPassW_Common(cArgs, papwszArgs, fFlags, phCluiInstance, &g_aCxInterceptorEntries[2]); } #endif /* !NDEBUG */ /** Kernel32 - GetProcAddress() */ static FARPROC WINAPI kwSandbox_Kernel32_GetProcAddress(HMODULE hmod, LPCSTR pszProc) { KSIZE i; PKWMODULE pMod; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); /* * Try locate the module. */ pMod = kwToolLocateModuleByHandle(g_Sandbox.pTool, hmod); if (pMod) { KLDRADDR uValue; int rc = kLdrModQuerySymbol(pMod->pLdrMod, pMod->fNative ? NULL : pMod->u.Manual.pvBits, pMod->fNative ? KLDRMOD_BASEADDRESS_MAP : (KUPTR)pMod->u.Manual.pbLoad, KU32_MAX /*iSymbol*/, pszProc, kHlpStrLen(pszProc), NULL /*pszVersion*/, NULL /*pfnGetForwarder*/, NULL /*pvUser*/, &uValue, NULL /*pfKind*/); if (rc == 0) { //static int s_cDbgGets = 0; KU32 cchProc = (KU32)kHlpStrLen(pszProc); KU32 i = g_cSandboxGetProcReplacements; while (i-- > 0) if ( g_aSandboxGetProcReplacements[i].cchFunction == cchProc && kHlpMemComp(g_aSandboxGetProcReplacements[i].pszFunction, pszProc, cchProc) == 0) { if ( !g_aSandboxGetProcReplacements[i].pszModule || kHlpStrICompAscii(g_aSandboxGetProcReplacements[i].pszModule, &pMod->pszPath[pMod->offFilename]) == 0) { if ( !g_aSandboxGetProcReplacements[i].fOnlyExe || (KUPTR)_ReturnAddress() - (KUPTR)g_Sandbox.pTool->u.Sandboxed.pExe->hOurMod < g_Sandbox.pTool->u.Sandboxed.pExe->cbImage) { if (!g_aSandboxReplacements[i].fCrtSlotArray) uValue = g_aSandboxGetProcReplacements[i].pfnReplacement; else { if (pMod->iCrtSlot == KU8_MAX) { int rc = kwLdrModuleCreateCrtSlot(pMod); if (rc) { KW_LOG(("GetProcAddress: kwLdrModuleCreateCrtSlot failed: %d\n", rc)); SetLastError(ERROR_INTERNAL_ERROR); return NULL; } } uValue = ((KUPTR *)g_aSandboxGetProcReplacements[i].pfnReplacement)[pMod->iCrtSlot]; } KW_LOG(("GetProcAddress(%s, %s) -> %p replaced\n", pMod->pszPath, pszProc, (KUPTR)uValue)); } kwLdrModuleRelease(pMod); return (FARPROC)(KUPTR)uValue; } } #ifndef NDEBUG /* Intercept the compiler pass method, dumping arguments. */ if (kHlpStrComp(pszProc, g_szInvokeCompilePassW) == 0) { KU32 i; for (i = 0; i < K_ELEMENTS(g_aCxInterceptorEntries); i++) if ((KUPTR)g_aCxInterceptorEntries[i].pfnOrg == uValue) { uValue = (KUPTR)g_aCxInterceptorEntries[i].pfnWrap; KW_LOG(("GetProcAddress: intercepting InvokeCompilerPassW\n")); break; } if (i >= K_ELEMENTS(g_aCxInterceptorEntries)) while (i-- > 0) if (g_aCxInterceptorEntries[i].pfnOrg == NULL) { g_aCxInterceptorEntries[i].pfnOrg = (PFNINVOKECOMPILERPASSW)(KUPTR)uValue; g_aCxInterceptorEntries[i].pModule = pMod; uValue = (KUPTR)g_aCxInterceptorEntries[i].pfnWrap; KW_LOG(("GetProcAddress: intercepting InvokeCompilerPassW (new)\n")); break; } } #endif KW_LOG(("GetProcAddress(%s, %s) -> %p\n", pMod->pszPath, pszProc, (KUPTR)uValue)); kwLdrModuleRelease(pMod); //s_cDbgGets++; //if (s_cGets >= 3) // return (FARPROC)kwSandbox_BreakIntoDebugger; return (FARPROC)(KUPTR)uValue; } KWFS_TODO(); SetLastError(ERROR_PROC_NOT_FOUND); kwLdrModuleRelease(pMod); return NULL; } /* * Hmm... could be a cached module-by-name. */ for (i = 0; i < K_ELEMENTS(g_aGetModuleHandleCache); i++) if (g_aGetModuleHandleCache[i].hmod == hmod) return GetProcAddress(hmod, pszProc); KWFS_TODO(); return GetProcAddress(hmod, pszProc); } #ifndef NDEBUG /** Kernel32 - GetProcAddress() - native replacement for debugging only. */ static FARPROC WINAPI kwSandbox_Kernel32_Native_GetProcAddress(HMODULE hmod, LPCSTR pszProc) { FARPROC pfnRet = GetProcAddress(hmod, pszProc); KWLDR_LOG(("kwSandbox_Kernel32_Native_GetProcAddress(%p, %s) -> %p\n", hmod, pszProc, pfnRet)); return pfnRet; } #endif /** Kernel32 - GetModuleFileNameA() */ static DWORD WINAPI kwSandbox_Kernel32_GetModuleFileNameA(HMODULE hmod, LPSTR pszFilename, DWORD cbFilename) { PKWMODULE pMod; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pMod = kwToolLocateModuleByHandle(g_Sandbox.pTool, hmod); if (pMod != NULL) { DWORD cbRet = kwStrCopyStyle1(pMod->pszPath, pszFilename, cbFilename); kwLdrModuleRelease(pMod); return cbRet; } KWFS_TODO(); return 0; } /** Kernel32 - GetModuleFileNameW() */ static DWORD WINAPI kwSandbox_Kernel32_GetModuleFileNameW(HMODULE hmod, LPWSTR pwszFilename, DWORD cbFilename) { PKWMODULE pMod; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pMod = kwToolLocateModuleByHandle(g_Sandbox.pTool, hmod); if (pMod) { DWORD cwcRet = kwUtf16CopyStyle1(pMod->pwszPath, pwszFilename, cbFilename); kwLdrModuleRelease(pMod); return cwcRet; } KWFS_TODO(); return 0; } /** NtDll - RtlPcToFileHeader * This is necessary for msvcr100.dll!CxxThrowException. */ static PVOID WINAPI kwSandbox_ntdll_RtlPcToFileHeader(PVOID pvPC, PVOID *ppvImageBase) { PVOID pvRet; /* * Do a binary lookup of the module table for the current tool. * This will give us a */ if (g_Sandbox.fRunning) { KUPTR const uPC = (KUPTR)pvPC; PKWMODULE *papMods = g_Sandbox.pTool->u.Sandboxed.papModules; KU32 iEnd = g_Sandbox.pTool->u.Sandboxed.cModules; KU32 i; if (iEnd) { KU32 iStart = 0; i = iEnd / 2; for (;;) { KUPTR const uHModCur = (KUPTR)papMods[i]->hOurMod; if (uPC < uHModCur) { iEnd = i; if (iStart < i) { } else break; } else if (uPC != uHModCur) { iStart = ++i; if (i < iEnd) { } else break; } else { /* This isn't supposed to happen. */ break; } i = iStart + (iEnd - iStart) / 2; } /* For reasons of simplicity (= copy & paste), we end up with the module after the one we're interested in here. */ i--; if (i < g_Sandbox.pTool->u.Sandboxed.cModules && papMods[i]->pLdrMod) { KSIZE uRvaPC = uPC - (KUPTR)papMods[i]->hOurMod; if (uRvaPC < papMods[i]->cbImage) { *ppvImageBase = papMods[i]->hOurMod; pvRet = papMods[i]->hOurMod; KW_LOG(("RtlPcToFileHeader(PC=%p) -> %p, *ppvImageBase=%p [our]\n", pvPC, pvRet, *ppvImageBase)); return pvRet; } } } else i = 0; } /* * Call the regular API. */ pvRet = RtlPcToFileHeader(pvPC, ppvImageBase); KW_LOG(("RtlPcToFileHeader(PC=%p) -> %p, *ppvImageBase=%p \n", pvPC, pvRet, *ppvImageBase)); return pvRet; } /* * * File access APIs (for speeding them up). * File access APIs (for speeding them up). * File access APIs (for speeding them up). * */ /** * Converts a lookup error to a windows error code. * * @returns The windows error code. * @param enmError The lookup error. */ static DWORD kwFsLookupErrorToWindowsError(KFSLOOKUPERROR enmError) { switch (enmError) { case KFSLOOKUPERROR_NOT_FOUND: case KFSLOOKUPERROR_NOT_DIR: return ERROR_FILE_NOT_FOUND; case KFSLOOKUPERROR_PATH_COMP_NOT_FOUND: case KFSLOOKUPERROR_PATH_COMP_NOT_DIR: case KFSLOOKUPERROR_PATH_TOO_SHORT: return ERROR_PATH_NOT_FOUND; case KFSLOOKUPERROR_PATH_TOO_LONG: return ERROR_FILENAME_EXCED_RANGE; case KFSLOOKUPERROR_OUT_OF_MEMORY: return ERROR_NOT_ENOUGH_MEMORY; default: return ERROR_PATH_NOT_FOUND; } } #ifdef WITH_TEMP_MEMORY_FILES /** * Checks for a cl.exe temporary file. * * There are quite a bunch of these. They seems to be passing data between the * first and second compiler pass. Since they're on disk, they get subjected to * AV software screening and normal file consistency rules. So, not necessarily * a very efficient way of handling reasonably small amounts of data. * * We make the files live in virtual memory by intercepting their opening, * writing, reading, closing , mapping, unmapping, and maybe some more stuff. * * @returns K_TRUE / K_FALSE * @param pwszFilename The file name being accessed. */ static KBOOL kwFsIsClTempFileW(const wchar_t *pwszFilename) { wchar_t const *pwszName = kwPathGetFilenameW(pwszFilename); if (pwszName) { /* The name starts with _CL_... */ if ( pwszName[0] == '_' && pwszName[1] == 'C' && pwszName[2] == 'L' && pwszName[3] == '_' ) { /* ... followed by 8 xdigits and ends with a two letter file type. Simplify this check by just checking that it's alpha numerical ascii from here on. */ wchar_t wc; pwszName += 4; while ((wc = *pwszName++) != '\0') { if (wc < 127 && iswalnum(wc)) { /* likely */ } else return K_FALSE; } return K_TRUE; } /* In VC2019 there is also one {UUID} file in temp: */ if (pwszName[0] == '{') { KSIZE cwcName = kwUtf16Len(pwszName); if ( cwcName == sizeof("{4465DDD9-E494-471B-996B-9B556E25AEF8}") - 1 && pwszName[37] == '}' && iswalnum(pwszName[1]) // 4 && iswalnum(pwszName[2]) // 4 && iswalnum(pwszName[3]) // 6 && iswalnum(pwszName[4]) // 5 && iswalnum(pwszName[5]) // d && iswalnum(pwszName[6]) // d && iswalnum(pwszName[7]) // d && iswalnum(pwszName[8]) // 9 && pwszName[9] == '-' // - && iswalnum(pwszName[10]) // e && iswalnum(pwszName[11]) // 4 && iswalnum(pwszName[12]) // 9 && iswalnum(pwszName[13]) // 4 && pwszName[14] == '-' // - && iswalnum(pwszName[15]) // 4 && iswalnum(pwszName[16]) // 7 && iswalnum(pwszName[17]) // 1 && iswalnum(pwszName[18]) // b && pwszName[19] == '-' // - && iswalnum(pwszName[20]) // 9 && iswalnum(pwszName[21]) // 9 && iswalnum(pwszName[22]) // 6 && iswalnum(pwszName[23]) // b && pwszName[24] == '-' // - && iswalnum(pwszName[25]) // 9 && iswalnum(pwszName[26]) // b && iswalnum(pwszName[27]) // 5 && iswalnum(pwszName[28]) // 5 && iswalnum(pwszName[29]) // 6 && iswalnum(pwszName[30]) // e && iswalnum(pwszName[31]) // 2 && iswalnum(pwszName[32]) // 5 && iswalnum(pwszName[33]) // a && iswalnum(pwszName[34]) // 3 && iswalnum(pwszName[35]) // f && iswalnum(pwszName[36])) // 8 return K_TRUE; } } return K_FALSE; } /** * Creates a handle to a temporary file. * * @returns The handle on success. * INVALID_HANDLE_VALUE and SetLastError on failure. * @param pTempFile The temporary file. * @param dwDesiredAccess The desired access to the handle. * @param fMapping Whether this is a mapping (K_TRUE) or file * (K_FALSE) handle type. */ static HANDLE kwFsTempFileCreateHandle(PKWFSTEMPFILE pTempFile, DWORD dwDesiredAccess, KBOOL fMapping) { /* * Create a handle to the temporary file. */ HANDLE hFile = INVALID_HANDLE_VALUE; HANDLE hProcSelf = GetCurrentProcess(); if (DuplicateHandle(hProcSelf, hProcSelf, hProcSelf, &hFile, SYNCHRONIZE, FALSE, 0 /*dwOptions*/)) { PKWHANDLE pHandle = (PKWHANDLE)kHlpAlloc(sizeof(*pHandle)); if (pHandle) { pHandle->enmType = !fMapping ? KWHANDLETYPE_TEMP_FILE : KWHANDLETYPE_TEMP_FILE_MAPPING; pHandle->cRefs = 1; pHandle->offFile = 0; pHandle->hHandle = hFile; pHandle->dwDesiredAccess = dwDesiredAccess; pHandle->tidOwner = KU32_MAX; pHandle->u.pTempFile = pTempFile; if (kwSandboxHandleTableEnter(&g_Sandbox, pHandle, hFile)) { pTempFile->cActiveHandles++; kHlpAssert(pTempFile->cActiveHandles >= 1); kHlpAssert(pTempFile->cActiveHandles <= 2); KWFS_LOG(("kwFsTempFileCreateHandle: Temporary file '%ls' -> %p\n", pTempFile->pwszPath, hFile)); return hFile; } kHlpFree(pHandle); } else KWFS_LOG(("kwFsTempFileCreateHandle: Out of memory!\n")); SetLastError(ERROR_NOT_ENOUGH_MEMORY); } else KWFS_LOG(("kwFsTempFileCreateHandle: DuplicateHandle failed: err=%u\n", GetLastError())); return INVALID_HANDLE_VALUE; } static HANDLE kwFsTempFileCreateW(const wchar_t *pwszFilename, DWORD dwDesiredAccess, DWORD dwCreationDisposition, KBOOL *pfFallback) { HANDLE hFile; DWORD dwErr; /* * Check if we've got an existing temp file. * ASSUME exact same path for now. */ KSIZE const cwcFilename = kwUtf16Len(pwszFilename); PKWFSTEMPFILE pTempFile; for (pTempFile = g_Sandbox.pTempFileHead; pTempFile != NULL; pTempFile = pTempFile->pNext) { /* Since the last two chars are usually the only difference, we check them manually before calling memcmp. */ if ( pTempFile->cwcPath == cwcFilename && pTempFile->pwszPath[cwcFilename - 1] == pwszFilename[cwcFilename - 1] && pTempFile->pwszPath[cwcFilename - 2] == pwszFilename[cwcFilename - 2] && kHlpMemComp(pTempFile->pwszPath, pwszFilename, cwcFilename) == 0) break; } /* * Create a new temporary file instance if not found. */ *pfFallback = K_FALSE; if (pTempFile == NULL) { KSIZE cbFilename; switch (dwCreationDisposition) { case CREATE_ALWAYS: case OPEN_ALWAYS: case CREATE_NEW: dwErr = NO_ERROR; break; case OPEN_EXISTING: case TRUNCATE_EXISTING: *pfFallback = K_TRUE; kHlpAssertFailed(); SetLastError(ERROR_FILE_NOT_FOUND); return INVALID_HANDLE_VALUE; default: kHlpAssertFailed(); SetLastError(ERROR_INVALID_PARAMETER); return INVALID_HANDLE_VALUE; } cbFilename = (cwcFilename + 1) * sizeof(wchar_t); pTempFile = (PKWFSTEMPFILE)kHlpAlloc(sizeof(*pTempFile) + cbFilename); if (pTempFile) { pTempFile->cwcPath = (KU16)cwcFilename; pTempFile->cbFile = 0; pTempFile->cbFileAllocated = 0; pTempFile->cActiveHandles = 0; pTempFile->cMappings = 0; pTempFile->cSegs = 0; pTempFile->paSegs = NULL; pTempFile->pwszPath = (wchar_t const *)kHlpMemCopy(pTempFile + 1, pwszFilename, cbFilename); pTempFile->pNext = g_Sandbox.pTempFileHead; g_Sandbox.pTempFileHead = pTempFile; KWFS_LOG(("kwFsTempFileCreateW: Created new temporary file '%ls'\n", pwszFilename)); } else { KWFS_LOG(("kwFsTempFileCreateW: Out of memory!\n")); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return INVALID_HANDLE_VALUE; } } else { switch (dwCreationDisposition) { case OPEN_EXISTING: dwErr = NO_ERROR; break; case OPEN_ALWAYS: dwErr = ERROR_ALREADY_EXISTS; break; case TRUNCATE_EXISTING: case CREATE_ALWAYS: kHlpAssertFailed(); pTempFile->cbFile = 0; dwErr = ERROR_ALREADY_EXISTS; break; case CREATE_NEW: kHlpAssertFailed(); SetLastError(ERROR_FILE_EXISTS); return INVALID_HANDLE_VALUE; default: kHlpAssertFailed(); SetLastError(ERROR_INVALID_PARAMETER); return INVALID_HANDLE_VALUE; } } /* * Create a handle to the temporary file. */ hFile = kwFsTempFileCreateHandle(pTempFile, dwDesiredAccess, K_FALSE /*fMapping*/); if (hFile != INVALID_HANDLE_VALUE) SetLastError(dwErr); return hFile; } #endif /* WITH_TEMP_MEMORY_FILES */ /** * Worker for kwFsIsCacheableExtensionA and kwFsIsCacheableExtensionW * * @returns K_TRUE if cacheable, K_FALSE if not. * @param wcFirst The first extension character. * @param wcSecond The second extension character. * @param wcThird The third extension character. * @param fAttrQuery Set if it's for an attribute query, clear if for * file creation. */ static KBOOL kwFsIsCacheableExtensionCommon(wchar_t wcFirst, wchar_t wcSecond, wchar_t wcThird, KBOOL fAttrQuery) { /* C++ header without an extension or a directory. */ if (wcFirst == '\0') { /** @todo exclude temporary files... */ return K_TRUE; } /* C Header: .h */ if (wcFirst == 'h' || wcFirst == 'H') { if (wcSecond == '\0') return K_TRUE; /* C++ Header: .hpp, .hxx */ if ( (wcSecond == 'p' || wcSecond == 'P') && (wcThird == 'p' || wcThird == 'P')) return K_TRUE; if ( (wcSecond == 'x' || wcSecond == 'X') && (wcThird == 'x' || wcThird == 'X')) return K_TRUE; } /* Misc starting with i. */ else if (wcFirst == 'i' || wcFirst == 'I') { if (wcSecond != '\0') { if (wcSecond == 'n' || wcSecond == 'N') { /* C++ inline header: .inl */ if (wcThird == 'l' || wcThird == 'L') return K_TRUE; /* Assembly include file: .inc */ if (wcThird == 'c' || wcThird == 'C') return K_TRUE; } } } /* Assembly header: .mac */ else if (wcFirst == 'm' || wcFirst == 'M') { if (wcSecond == 'a' || wcSecond == 'A') { if (wcThird == 'c' || wcThird == 'C') return K_TRUE; } } #ifdef WITH_PCH_CACHING /* Precompiled header: .pch */ else if (wcFirst == 'p' || wcFirst == 'P') { if (wcSecond == 'c' || wcSecond == 'C') { if (wcThird == 'h' || wcThird == 'H') return !g_Sandbox.fNoPchCaching; } } #endif #if 0 /* Experimental - need to flush these afterwards as they're highly unlikely to be used after the link is done. */ /* Linker - Object file: .obj */ if ((wcFirst == 'o' || wcFirst == 'O') && g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_LINK) { if (wcSecond == 'b' || wcSecond == 'B') { if (wcThird == 'j' || wcThird == 'J') return K_TRUE; } } #endif else if (fAttrQuery) { /* Dynamic link library: .dll */ if (wcFirst == 'd' || wcFirst == 'D') { if (wcSecond == 'l' || wcSecond == 'L') { if (wcThird == 'l' || wcThird == 'L') return K_TRUE; } } /* Executable file: .exe */ else if (wcFirst == 'e' || wcFirst == 'E') { if (wcSecond == 'x' || wcSecond == 'X') { if (wcThird == 'e' || wcThird == 'E') return K_TRUE; } } /* Response file: .rsp */ else if (wcFirst == 'r' || wcFirst == 'R') { if (wcSecond == 's' || wcSecond == 'S') { if (wcThird == 'p' || wcThird == 'P') return !g_Sandbox.fNoPchCaching; } } /* Linker: */ if (g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_LINK) { /* Object file: .obj */ if (wcFirst == 'o' || wcFirst == 'O') { if (wcSecond == 'b' || wcSecond == 'B') { if (wcThird == 'j' || wcThird == 'J') return K_TRUE; } } /* Library file: .lib */ else if (wcFirst == 'l' || wcFirst == 'L') { if (wcSecond == 'i' || wcSecond == 'I') { if (wcThird == 'b' || wcThird == 'B') return K_TRUE; } } /* Linker definition file: .def */ else if (wcFirst == 'd' || wcFirst == 'D') { if (wcSecond == 'e' || wcSecond == 'E') { if (wcThird == 'f' || wcThird == 'F') return K_TRUE; } } } } return K_FALSE; } /** * Checks if the file extension indicates that the file/dir is something we * ought to cache. * * @returns K_TRUE if cachable, K_FALSE if not. * @param pszExt The kHlpGetExt result. * @param fAttrQuery Set if it's for an attribute query, clear if for * file creation. */ static KBOOL kwFsIsCacheableExtensionA(const char *pszExt, KBOOL fAttrQuery) { wchar_t const wcFirst = *pszExt; if (wcFirst) { wchar_t const wcSecond = pszExt[1]; if (wcSecond) { wchar_t const wcThird = pszExt[2]; if (pszExt[3] == '\0') return kwFsIsCacheableExtensionCommon(wcFirst, wcSecond, wcThird, fAttrQuery); return K_FALSE; } return kwFsIsCacheableExtensionCommon(wcFirst, 0, 0, fAttrQuery); } return kwFsIsCacheableExtensionCommon(0, 0, 0, fAttrQuery); } /** * Checks if the extension of the given UTF-16 path indicates that the file/dir * should be cached. * * @returns K_TRUE if cachable, K_FALSE if not. * @param pwszPath The UTF-16 path to examine. * @param fAttrQuery Set if it's for an attribute query, clear if for * file creation. */ static KBOOL kwFsIsCacheablePathExtensionW(const wchar_t *pwszPath, KBOOL fAttrQuery) { KSIZE cwcExt; wchar_t const *pwszExt = kwFsPathGetExtW(pwszPath, &cwcExt); switch (cwcExt) { case 3: return kwFsIsCacheableExtensionCommon(pwszExt[0], pwszExt[1], pwszExt[2], fAttrQuery); case 2: return kwFsIsCacheableExtensionCommon(pwszExt[0], pwszExt[1], 0, fAttrQuery); case 1: return kwFsIsCacheableExtensionCommon(pwszExt[0], 0, 0, fAttrQuery); case 0: return kwFsIsCacheableExtensionCommon(0, 0, 0, fAttrQuery); } return K_FALSE; } /** * Creates a new * * @returns * @param pFsObj . * @param pwszFilename . */ static PKFSWCACHEDFILE kwFsObjCacheNewFile(PKFSOBJ pFsObj) { HANDLE hFile; MY_IO_STATUS_BLOCK Ios; MY_OBJECT_ATTRIBUTES ObjAttr; MY_UNICODE_STRING UniStr; MY_NTSTATUS rcNt; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); /* * Open the file relative to the parent directory. */ kHlpAssert(pFsObj->bObjType == KFSOBJ_TYPE_FILE); kHlpAssert(pFsObj->pParent); kHlpAssertReturn(pFsObj->pParent->hDir != INVALID_HANDLE_VALUE, NULL); Ios.Information = ~(ULONG_PTR)0; Ios.u.Status = -1; UniStr.Buffer = (wchar_t *)pFsObj->pwszName; UniStr.Length = (USHORT)(pFsObj->cwcName * sizeof(wchar_t)); UniStr.MaximumLength = UniStr.Length + sizeof(wchar_t); MyInitializeObjectAttributes(&ObjAttr, &UniStr, OBJ_CASE_INSENSITIVE, pFsObj->pParent->hDir, NULL /*pSecAttr*/); rcNt = g_pfnNtCreateFile(&hFile, GENERIC_READ | SYNCHRONIZE, &ObjAttr, &Ios, NULL, /*cbFileInitialAlloc */ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, NULL, /*pEaBuffer*/ 0); /*cbEaBuffer*/ if (MY_NT_SUCCESS(rcNt)) { /* * Read the whole file into memory. */ LARGE_INTEGER cbFile; if (GetFileSizeEx(hFile, &cbFile)) { if ( cbFile.QuadPart >= 0 #ifdef WITH_PCH_CACHING && ( cbFile.QuadPart < 16*1024*1024 || ( cbFile.QuadPart < 96*1024*1024 && pFsObj->cchName > 4 && !g_Sandbox.fNoPchCaching && kHlpStrICompAscii(&pFsObj->pszName[pFsObj->cchName - 4], ".pch") == 0) ) #endif ) { KU32 cbCache = (KU32)cbFile.QuadPart; HANDLE hMapping = CreateFileMappingW(hFile, NULL /*pSecAttrs*/, PAGE_READONLY, 0 /*cbMaxLow*/, 0 /*cbMaxHigh*/, NULL /*pwszName*/); if (hMapping != NULL) { KU8 *pbCache = (KU8 *)MapViewOfFile(hMapping, FILE_MAP_READ, 0 /*offFileHigh*/, 0 /*offFileLow*/, cbCache); if (pbCache) { /* * Create the cached file object. */ PKFSWCACHEDFILE pCachedFile; KU32 cbPath = pFsObj->cchParent + pFsObj->cchName + 2; pCachedFile = (PKFSWCACHEDFILE)kFsCacheObjAddUserData(g_pFsCache, pFsObj, KW_DATA_KEY_CACHED_FILE, sizeof(*pCachedFile) + cbPath); if (pCachedFile) { pCachedFile->hCached = hFile; pCachedFile->hSection = hMapping; pCachedFile->cbCached = cbCache; pCachedFile->pbCached = pbCache; pCachedFile->pFsObj = pFsObj; kFsCacheObjGetFullPathA(pFsObj, pCachedFile->szPath, cbPath, '/'); kFsCacheObjRetain(pFsObj); g_cReadCachedFiles++; g_cbReadCachedFiles += cbCache; KWFS_LOG(("Cached '%s': %p LB %#x, hCached=%p\n", pCachedFile->szPath, pbCache, cbCache, hFile)); return pCachedFile; } KWFS_LOG(("Failed to allocate KFSWCACHEDFILE structure!\n")); } else KWFS_LOG(("Failed to cache file: MapViewOfFile failed: %u\n", GetLastError())); CloseHandle(hMapping); } else KWFS_LOG(("Failed to cache file: CreateFileMappingW failed: %u\n", GetLastError())); } else KWFS_LOG(("File to big to cache! %#llx\n", cbFile.QuadPart)); } else KWFS_LOG(("File to get file size! err=%u\n", GetLastError())); g_pfnNtClose(hFile); } else KWFS_LOG(("Error opening '%ls' for caching: %#x\n", pFsObj->pwszName, rcNt)); return NULL; } /** * Kernel32 - Common code for kwFsObjCacheCreateFile and CreateFileMappingW/A. */ static KBOOL kwFsObjCacheCreateFileHandle(PKFSWCACHEDFILE pCachedFile, DWORD dwDesiredAccess, BOOL fInheritHandle, KBOOL fIsFileHandle, HANDLE *phFile) { HANDLE hProcSelf = GetCurrentProcess(); if (DuplicateHandle(hProcSelf, fIsFileHandle ? pCachedFile->hCached : pCachedFile->hSection, hProcSelf, phFile, dwDesiredAccess, fInheritHandle, 0 /*dwOptions*/)) { /* * Create handle table entry for the duplicate handle. */ PKWHANDLE pHandle = (PKWHANDLE)kHlpAlloc(sizeof(*pHandle)); if (pHandle) { pHandle->enmType = fIsFileHandle ? KWHANDLETYPE_FSOBJ_READ_CACHE : KWHANDLETYPE_FSOBJ_READ_CACHE_MAPPING; pHandle->cRefs = 1; pHandle->offFile = 0; pHandle->hHandle = *phFile; pHandle->dwDesiredAccess = dwDesiredAccess; pHandle->tidOwner = KU32_MAX; pHandle->u.pCachedFile = pCachedFile; if (kwSandboxHandleTableEnter(&g_Sandbox, pHandle, pHandle->hHandle)) return K_TRUE; kHlpFree(pHandle); } else KWFS_LOG(("Out of memory for handle!\n")); CloseHandle(*phFile); *phFile = INVALID_HANDLE_VALUE; } else KWFS_LOG(("DuplicateHandle failed! err=%u\n", GetLastError())); return K_FALSE; } /** * Kernel32 - Common code for CreateFileW and CreateFileA. */ static KBOOL kwFsObjCacheCreateFile(PKFSOBJ pFsObj, DWORD dwDesiredAccess, BOOL fInheritHandle, HANDLE *phFile) { *phFile = INVALID_HANDLE_VALUE; /* * At the moment we only handle existing files. */ if (pFsObj->bObjType == KFSOBJ_TYPE_FILE) { PKFSWCACHEDFILE pCachedFile = (PKFSWCACHEDFILE)kFsCacheObjGetUserData(g_pFsCache, pFsObj, KW_DATA_KEY_CACHED_FILE); kHlpAssert(pFsObj->fHaveStats); if ( pCachedFile != NULL || (pCachedFile = kwFsObjCacheNewFile(pFsObj)) != NULL) { if (kwFsObjCacheCreateFileHandle(pCachedFile, dwDesiredAccess, fInheritHandle, K_TRUE /*fIsFileHandle*/, phFile)) return K_TRUE; } } /** @todo Deal with non-existing files if it becomes necessary (it's not for VS2010). */ /* Do fallback, please. */ return K_FALSE; } /** Kernel32 - CreateFileA */ static HANDLE WINAPI kwSandbox_Kernel32_CreateFileA(LPCSTR pszFilename, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES pSecAttrs, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) { HANDLE hFile; /* * Check for include files and similar that we do read-only caching of. */ if (dwCreationDisposition == OPEN_EXISTING) { if ( dwDesiredAccess == GENERIC_READ || dwDesiredAccess == FILE_GENERIC_READ) { if (dwShareMode & FILE_SHARE_READ) { if ( !pSecAttrs || ( pSecAttrs->nLength == sizeof(*pSecAttrs) && pSecAttrs->lpSecurityDescriptor == NULL ) ) { const char *pszExt = kHlpGetExt(pszFilename); if (kwFsIsCacheableExtensionA(pszExt, K_FALSE /*fAttrQuery*/)) { KFSLOOKUPERROR enmError; PKFSOBJ pFsObj; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pFsObj = kFsCacheLookupA(g_pFsCache, pszFilename, &enmError); if (pFsObj) { if (pFsObj->bObjType != KFSOBJ_TYPE_MISSING) { KBOOL fRc = kwFsObjCacheCreateFile(pFsObj, dwDesiredAccess, pSecAttrs && pSecAttrs->bInheritHandle, &hFile); kFsCacheObjRelease(g_pFsCache, pFsObj); if (fRc) { KWFS_LOG(("CreateFileA(%s) -> %p [cached]\n", pszFilename, hFile)); return hFile; } } else if (!(pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN)) { KWFS_LOG(("CreateFileA(%ls) -> INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND\n", pszFilename)); SetLastError(ERROR_FILE_NOT_FOUND); return INVALID_HANDLE_VALUE; } /* Always fall back on missing files in volatile areas. */ } /* These are for nasm and yasm header searching. Cache will already have checked the directories for the file, no need to call CreateFile to do it again. */ else if (enmError == KFSLOOKUPERROR_NOT_FOUND) { KWFS_LOG(("CreateFileA(%s) -> INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND\n", pszFilename)); SetLastError(ERROR_FILE_NOT_FOUND); return INVALID_HANDLE_VALUE; } else if ( enmError == KFSLOOKUPERROR_PATH_COMP_NOT_FOUND || enmError == KFSLOOKUPERROR_PATH_COMP_NOT_DIR) { KWFS_LOG(("CreateFileA(%s) -> INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND\n", pszFilename)); SetLastError(ERROR_PATH_NOT_FOUND); return INVALID_HANDLE_VALUE; } /* fallback */ hFile = CreateFileA(pszFilename, dwDesiredAccess, dwShareMode, pSecAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); KWFS_LOG(("CreateFileA(%s) -> %p (err=%u) [fallback]\n", pszFilename, hFile, GetLastError())); return hFile; } } } } } /* * Okay, normal. */ hFile = CreateFileA(pszFilename, dwDesiredAccess, dwShareMode, pSecAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); kHlpAssert(hFile == INVALID_HANDLE_VALUE || kwSandboxHandleLookup(hFile) == NULL); KWFS_LOG(("CreateFileA(%s) -> %p\n", pszFilename, hFile)); return hFile; } /** Kernel32 - CreateFileW */ static HANDLE WINAPI kwSandbox_Kernel32_CreateFileW(LPCWSTR pwszFilename, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES pSecAttrs, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) { HANDLE hFile; #ifdef WITH_TEMP_MEMORY_FILES /* * Check for temporary files (cl.exe only). */ if ( g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_CL && !(dwFlagsAndAttributes & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE | FILE_FLAG_BACKUP_SEMANTICS)) && !(dwDesiredAccess & (GENERIC_EXECUTE | FILE_EXECUTE)) && kwFsIsClTempFileW(pwszFilename)) { KBOOL fFallback = K_FALSE; hFile = kwFsTempFileCreateW(pwszFilename, dwDesiredAccess, dwCreationDisposition, &fFallback); if (!fFallback) { KWFS_LOG(("CreateFileW(%ls) -> %p [temp]\n", pwszFilename, hFile)); return hFile; } } #endif /* * Check for include files and similar that we do read-only caching of. */ if (dwCreationDisposition == OPEN_EXISTING) { if ( dwDesiredAccess == GENERIC_READ || dwDesiredAccess == FILE_GENERIC_READ) { if (dwShareMode & FILE_SHARE_READ) { if ( !pSecAttrs || ( pSecAttrs->nLength == sizeof(*pSecAttrs) && pSecAttrs->lpSecurityDescriptor == NULL ) ) { if (kwFsIsCacheablePathExtensionW(pwszFilename, K_FALSE /*fAttrQuery*/)) { KFSLOOKUPERROR enmError; PKFSOBJ pFsObj; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pFsObj = kFsCacheLookupW(g_pFsCache, pwszFilename, &enmError); if (pFsObj) { if (pFsObj->bObjType != KFSOBJ_TYPE_MISSING) { KBOOL fRc = kwFsObjCacheCreateFile(pFsObj, dwDesiredAccess, pSecAttrs && pSecAttrs->bInheritHandle, &hFile); kFsCacheObjRelease(g_pFsCache, pFsObj); if (fRc) { KWFS_LOG(("CreateFileW(%ls) -> %p [cached]\n", pwszFilename, hFile)); return hFile; } } else if (!(pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN)) { KWFS_LOG(("CreateFileW(%ls) -> INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND\n", pwszFilename)); SetLastError(ERROR_FILE_NOT_FOUND); #if 0 if ( pFsObj->cchName > sizeof("generated.h") && kHlpStrICompAscii(&pFsObj->pszName[pFsObj->cchName - sizeof("generated.h") + 1], "generated.h") == 0) kwErrPrintf("CreateFileW(%ls) -> ERROR_FILE_NOT_FOUND; pFsObj->fFlags=%#x\n", pwszFilename, pFsObj->fFlags); #endif return INVALID_HANDLE_VALUE; } /* Always fall back on missing files in volatile areas. */ } /* These are for nasm and yasm style header searching. Cache will already have checked the directories for the file, no need to call CreateFile to do it again. */ else if (enmError == KFSLOOKUPERROR_NOT_FOUND) { #if 0 KSIZE cwcFilename = kwUtf16Len(pwszFilename); if ( cwcFilename > sizeof("generated.h") && memcmp(&pwszFilename[cwcFilename - sizeof("generated.h") + 1], L"generated.h", sizeof(L"generated.h")) == 0) kwErrPrintf("CreateFileW(%ls) -> ERROR_FILE_NOT_FOUND; (KFSLOOKUPERROR_NOT_FOUND)\n", pwszFilename, pFsObj->fFlags); #endif KWFS_LOG(("CreateFileW(%ls) -> INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND\n", pwszFilename)); SetLastError(ERROR_FILE_NOT_FOUND); return INVALID_HANDLE_VALUE; } else if ( enmError == KFSLOOKUPERROR_PATH_COMP_NOT_FOUND || enmError == KFSLOOKUPERROR_PATH_COMP_NOT_DIR) { #if 0 KSIZE cwcFilename = kwUtf16Len(pwszFilename); if ( cwcFilename > sizeof("generated.h") && memcmp(&pwszFilename[cwcFilename - sizeof("generated.h") + 1], L"generated.h", sizeof(L"generated.h")) == 0) kwErrPrintf("CreateFileW(%ls) -> ERROR_PATH_NOT_FOUND; (%d)\n", pwszFilename, enmError); #endif KWFS_LOG(("CreateFileW(%ls) -> INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND\n", pwszFilename)); SetLastError(ERROR_PATH_NOT_FOUND); return INVALID_HANDLE_VALUE; } /* fallback */ hFile = CreateFileW(pwszFilename, dwDesiredAccess, dwShareMode, pSecAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); KWFS_LOG(("CreateFileW(%ls) -> %p (err=%u) [fallback]\n", pwszFilename, hFile, GetLastError())); return hFile; } } else KWFS_LOG(("CreateFileW: incompatible security attributes (nLength=%#x pDesc=%p)\n", pSecAttrs->nLength, pSecAttrs->lpSecurityDescriptor)); } else KWFS_LOG(("CreateFileW: incompatible sharing mode %#x\n", dwShareMode)); } else KWFS_LOG(("CreateFileW: incompatible desired access %#x\n", dwDesiredAccess)); } else KWFS_LOG(("CreateFileW: incompatible disposition %u\n", dwCreationDisposition)); /* * Okay, normal. */ hFile = CreateFileW(pwszFilename, dwDesiredAccess, dwShareMode, pSecAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); kHlpAssert(hFile == INVALID_HANDLE_VALUE || kwSandboxHandleLookup(hFile) == NULL); KWFS_LOG(("CreateFileW(%ls) -> %p\n", pwszFilename, hFile)); return hFile; } /** Kernel32 - SetFilePointer */ static DWORD WINAPI kwSandbox_Kernel32_SetFilePointer(HANDLE hFile, LONG cbMove, PLONG pcbMoveHi, DWORD dwMoveMethod) { PKWHANDLE pHandle = kwSandboxHandleGet(hFile); if (pHandle != NULL) { KU32 cbFile; KI64 offMove = pcbMoveHi ? ((KI64)*pcbMoveHi << 32) | cbMove : cbMove; switch (pHandle->enmType) { case KWHANDLETYPE_FSOBJ_READ_CACHE: cbFile = pHandle->u.pCachedFile->cbCached; break; #ifdef WITH_TEMP_MEMORY_FILES case KWHANDLETYPE_TEMP_FILE: cbFile = pHandle->u.pTempFile->cbFile; break; case KWHANDLETYPE_TEMP_FILE_MAPPING: #endif case KWHANDLETYPE_OUTPUT_BUF: default: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_FUNCTION); return INVALID_SET_FILE_POINTER; } switch (dwMoveMethod) { case FILE_BEGIN: break; case FILE_CURRENT: offMove += pHandle->offFile; break; case FILE_END: offMove += cbFile; break; default: KWFS_LOG(("SetFilePointer(%p) - invalid seek method %u! [cached]\n", hFile)); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_PARAMETER); return INVALID_SET_FILE_POINTER; } if (offMove >= 0) { if (offMove >= (KSSIZE)cbFile) { #ifdef WITH_TEMP_MEMORY_FILES /* For read-only files, seeking beyond the end isn't useful to us, so clamp it. */ if (pHandle->enmType != KWHANDLETYPE_TEMP_FILE) #endif offMove = (KSSIZE)cbFile; #ifdef WITH_TEMP_MEMORY_FILES /* For writable files, seeking beyond the end is fine, but check that we've got the type range for the request. */ else if (((KU64)offMove & KU32_MAX) != (KU64)offMove) { kHlpAssertMsgFailed(("%#llx\n", offMove)); kwSandboxHandlePut(pHandle); SetLastError(ERROR_SEEK); return INVALID_SET_FILE_POINTER; } #endif } pHandle->offFile = (KU32)offMove; } else { KWFS_LOG(("SetFilePointer(%p) - negative seek! [cached]\n", hFile)); kwSandboxHandlePut(pHandle); SetLastError(ERROR_NEGATIVE_SEEK); return INVALID_SET_FILE_POINTER; } if (pcbMoveHi) *pcbMoveHi = (KU64)offMove >> 32; KWFS_LOG(("SetFilePointer(%p,%#x,?,%u) -> %#llx [%s]\n", hFile, cbMove, dwMoveMethod, offMove, pHandle->enmType == KWHANDLETYPE_FSOBJ_READ_CACHE ? "cached" : "temp")); kwSandboxHandlePut(pHandle); SetLastError(NO_ERROR); return (KU32)offMove; } KWFS_LOG(("SetFilePointer(%p, %d, %p=%d, %d)\n", hFile, cbMove, pcbMoveHi ? *pcbMoveHi : 0, dwMoveMethod)); return SetFilePointer(hFile, cbMove, pcbMoveHi, dwMoveMethod); } /** Kernel32 - SetFilePointerEx */ static BOOL WINAPI kwSandbox_Kernel32_SetFilePointerEx(HANDLE hFile, LARGE_INTEGER offMove, PLARGE_INTEGER poffNew, DWORD dwMoveMethod) { PKWHANDLE pHandle = kwSandboxHandleGet(hFile); if (pHandle != NULL) { KI64 offMyMove = offMove.QuadPart; KU32 cbFile; switch (pHandle->enmType) { case KWHANDLETYPE_FSOBJ_READ_CACHE: cbFile = pHandle->u.pCachedFile->cbCached; break; #ifdef WITH_TEMP_MEMORY_FILES case KWHANDLETYPE_TEMP_FILE: cbFile = pHandle->u.pTempFile->cbFile; break; case KWHANDLETYPE_TEMP_FILE_MAPPING: #endif case KWHANDLETYPE_OUTPUT_BUF: default: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_FUNCTION); return FALSE; } switch (dwMoveMethod) { case FILE_BEGIN: break; case FILE_CURRENT: offMyMove += pHandle->offFile; break; case FILE_END: offMyMove += cbFile; break; default: KWFS_LOG(("SetFilePointer(%p) - invalid seek method %u! [cached]\n", hFile)); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } if (offMyMove >= 0) { if (offMyMove >= (KSSIZE)cbFile) { #ifdef WITH_TEMP_MEMORY_FILES /* For read-only files, seeking beyond the end isn't useful to us, so clamp it. */ if (pHandle->enmType != KWHANDLETYPE_TEMP_FILE) #endif offMyMove = (KSSIZE)cbFile; #ifdef WITH_TEMP_MEMORY_FILES /* For writable files, seeking beyond the end is fine, but check that we've got the type range for the request. */ else if (((KU64)offMyMove & KU32_MAX) != (KU64)offMyMove) { kHlpAssertMsgFailed(("%#llx\n", offMyMove)); kwSandboxHandlePut(pHandle); SetLastError(ERROR_SEEK); return FALSE; } #endif } pHandle->offFile = (KU32)offMyMove; } else { KWFS_LOG(("SetFilePointerEx(%p) - negative seek! [cached]\n", hFile)); kwSandboxHandlePut(pHandle); SetLastError(ERROR_NEGATIVE_SEEK); return FALSE; } if (poffNew) poffNew->QuadPart = offMyMove; KWFS_LOG(("SetFilePointerEx(%p,%#llx,,%u) -> TRUE, %#llx [%s]\n", hFile, offMove.QuadPart, dwMoveMethod, offMyMove, pHandle->enmType == KWHANDLETYPE_FSOBJ_READ_CACHE ? "cached" : "temp")); kwSandboxHandlePut(pHandle); return TRUE; } KWFS_LOG(("SetFilePointerEx(%p)\n", hFile)); return SetFilePointerEx(hFile, offMove, poffNew, dwMoveMethod); } /** Kernel32 - ReadFile */ static BOOL WINAPI kwSandbox_Kernel32_ReadFile(HANDLE hFile, LPVOID pvBuffer, DWORD cbToRead, LPDWORD pcbActuallyRead, LPOVERLAPPED pOverlapped) { BOOL fRet; PKWHANDLE pHandle = kwSandboxHandleGet(hFile); g_cReadFileCalls++; if (pHandle != NULL) { switch (pHandle->enmType) { case KWHANDLETYPE_FSOBJ_READ_CACHE: { PKFSWCACHEDFILE pCachedFile = pHandle->u.pCachedFile; KU32 cbActually = pCachedFile->cbCached - pHandle->offFile; if (cbActually > cbToRead) cbActually = cbToRead; #ifdef WITH_HASH_CACHE if (g_Sandbox.pHashHead) { g_Sandbox.LastHashRead.pCachedFile = pCachedFile; g_Sandbox.LastHashRead.offRead = pHandle->offFile; g_Sandbox.LastHashRead.cbRead = cbActually; g_Sandbox.LastHashRead.pvRead = pvBuffer; } #endif kHlpMemCopy(pvBuffer, &pCachedFile->pbCached[pHandle->offFile], cbActually); pHandle->offFile += cbActually; kHlpAssert(!pOverlapped); kHlpAssert(pcbActuallyRead); *pcbActuallyRead = cbActually; g_cbReadFileFromReadCached += cbActually; g_cbReadFileTotal += cbActually; g_cReadFileFromReadCached++; KWFS_LOG(("ReadFile(%p,,%#x) -> TRUE, %#x bytes [cached]\n", hFile, cbToRead, cbActually)); kwSandboxHandlePut(pHandle); return TRUE; } #ifdef WITH_TEMP_MEMORY_FILES case KWHANDLETYPE_TEMP_FILE: { PKWFSTEMPFILE pTempFile = pHandle->u.pTempFile; KU32 cbActually; if (pHandle->offFile < pTempFile->cbFile) { cbActually = pTempFile->cbFile - pHandle->offFile; if (cbActually > cbToRead) cbActually = cbToRead; /* Copy the data. */ if (cbActually > 0) { KU32 cbLeft; KU32 offSeg; KWFSTEMPFILESEG const *paSegs = pTempFile->paSegs; /* Locate the segment containing the byte at offFile. */ KU32 iSeg = pTempFile->cSegs - 1; kHlpAssert(pTempFile->cSegs > 0); while (paSegs[iSeg].offData > pHandle->offFile) iSeg--; /* Copy out the data. */ cbLeft = cbActually; offSeg = (pHandle->offFile - paSegs[iSeg].offData); for (;;) { KU32 cbAvail = paSegs[iSeg].cbDataAlloc - offSeg; if (cbAvail >= cbLeft) { kHlpMemCopy(pvBuffer, &paSegs[iSeg].pbData[offSeg], cbLeft); break; } pvBuffer = kHlpMemPCopy(pvBuffer, &paSegs[iSeg].pbData[offSeg], cbAvail); cbLeft -= cbAvail; offSeg = 0; iSeg++; kHlpAssert(iSeg < pTempFile->cSegs); } /* Update the file offset. */ pHandle->offFile += cbActually; } } /* Read does not commit file space, so return zero bytes. */ else cbActually = 0; kHlpAssert(!pOverlapped); kHlpAssert(pcbActuallyRead); *pcbActuallyRead = cbActually; g_cbReadFileTotal += cbActually; g_cbReadFileFromInMemTemp += cbActually; g_cReadFileFromInMemTemp++; KWFS_LOG(("ReadFile(%p,,%#x) -> TRUE, %#x bytes [temp]\n", hFile, cbToRead, (KU32)cbActually)); kwSandboxHandlePut(pHandle); return TRUE; } case KWHANDLETYPE_TEMP_FILE_MAPPING: #endif /* WITH_TEMP_MEMORY_FILES */ case KWHANDLETYPE_OUTPUT_BUF: default: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_FUNCTION); *pcbActuallyRead = 0; return FALSE; } } fRet = ReadFile(hFile, pvBuffer, cbToRead, pcbActuallyRead, pOverlapped); if (fRet && pcbActuallyRead) g_cbReadFileTotal += *pcbActuallyRead; KWFS_LOG(("ReadFile(%p,%p,%#x,,) -> %d, %#x\n", hFile, pvBuffer, cbToRead, fRet, pcbActuallyRead ? *pcbActuallyRead : 0)); return fRet; } /** Kernel32 - ReadFileEx */ static BOOL WINAPI kwSandbox_Kernel32_ReadFileEx(HANDLE hFile, LPVOID pvBuffer, DWORD cbToRead, LPOVERLAPPED pOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE pfnCompletionRoutine) { kHlpAssert(kwSandboxHandleLookup(hFile) == NULL); KWFS_LOG(("ReadFile(%p)\n", hFile)); return ReadFileEx(hFile, pvBuffer, cbToRead, pOverlapped, pfnCompletionRoutine); } #ifdef WITH_STD_OUT_ERR_BUFFERING /** * Write something to a handle, making sure everything is actually written. * * @param hHandle Where to write it to. * @param pchBuf What to write * @param cchToWrite How much to write. */ static void kwSandboxOutBufWriteIt(HANDLE hFile, char const *pchBuf, KU32 cchToWrite) { if (cchToWrite > 0) { DWORD cchWritten = 0; if (WriteFile(hFile, pchBuf, cchToWrite, &cchWritten, NULL)) { if (cchWritten == cchToWrite) { /* likely */ } else { do { pchBuf += cchWritten; cchToWrite -= cchWritten; cchWritten = 0; } while ( cchToWrite > 0 && WriteFile(hFile, pchBuf, cchToWrite, &cchWritten, NULL)); } } else kHlpAssertFailed(); } } /** * Worker for WriteFile when the output isn't going to the console. * * @param pSandbox The sandbox. * @param pOutBuf The output buffer. * @param pchBuffer What to write. * @param cchToWrite How much to write. */ static void kwSandboxOutBufWrite(PKWSANDBOX pSandbox, PKWOUTPUTSTREAMBUF pOutBuf, const char *pchBuffer, KU32 cchToWrite) { if (pOutBuf->u.Fully.cchBufAlloc > 0) { /* likely */ } else { /* No realloc, max size is 64KB. */ pOutBuf->u.Fully.cchBufAlloc = 0x10000; pOutBuf->u.Fully.pchBuf = (char *)kHlpAlloc(pOutBuf->u.Fully.cchBufAlloc); if (!pOutBuf->u.Fully.pchBuf) { while ( !pOutBuf->u.Fully.pchBuf && pOutBuf->u.Fully.cchBufAlloc > 64) { pOutBuf->u.Fully.cchBufAlloc /= 2; pOutBuf->u.Fully.pchBuf = (char *)kHlpAlloc(pOutBuf->u.Fully.cchBufAlloc); } if (!pOutBuf->u.Fully.pchBuf) { pOutBuf->u.Fully.cchBufAlloc = sizeof(pOutBuf->abPadding); pOutBuf->u.Fully.pchBuf = (char *)&pOutBuf->abPadding[0]; } } } /* * Special case: Output ends with newline and fits in the buffer. */ if ( cchToWrite > 1 && pchBuffer[cchToWrite - 1] == '\n' && cchToWrite <= pOutBuf->u.Fully.cchBufAlloc - pOutBuf->u.Fully.cchBuf) { kHlpMemCopy(&pOutBuf->u.Fully.pchBuf[pOutBuf->u.Fully.cchBuf], pchBuffer, cchToWrite); pOutBuf->u.Fully.cchBuf += cchToWrite; } else { /* * Work thru the text line by line, flushing the buffer when * appropriate. The buffer is not a line buffer here, it's a * full buffer. */ while (cchToWrite > 0) { char const *pchNewLine = (const char *)memchr(pchBuffer, '\n', cchToWrite); KU32 cchLine = pchNewLine ? (KU32)(pchNewLine - pchBuffer) + 1 : cchToWrite; if (cchLine <= pOutBuf->u.Fully.cchBufAlloc - pOutBuf->u.Fully.cchBuf) { kHlpMemCopy(&pOutBuf->u.Fully.pchBuf[pOutBuf->u.Fully.cchBuf], pchBuffer, cchLine); pOutBuf->u.Fully.cchBuf += cchLine; } /* * Option one: Flush the buffer and the current line. * * We choose this one when the line won't ever fit, or when we have * an incomplete line in the buffer. */ else if ( cchLine >= pOutBuf->u.Fully.cchBufAlloc || pOutBuf->u.Fully.cchBuf == 0 || pOutBuf->u.Fully.pchBuf[pOutBuf->u.Fully.cchBuf - 1] != '\n') { KWOUT_LOG(("kwSandboxOutBufWrite: flushing %u bytes, writing %u bytes\n", pOutBuf->u.Fully.cchBuf, cchLine)); if (pOutBuf->u.Fully.cchBuf > 0) { kwSandboxOutBufWriteIt(pOutBuf->hBackup, pOutBuf->u.Fully.pchBuf, pOutBuf->u.Fully.cchBuf); pOutBuf->u.Fully.cchBuf = 0; } kwSandboxOutBufWriteIt(pOutBuf->hBackup, pchBuffer, cchLine); } /* * Option two: Only flush the lines in the buffer. */ else { KWOUT_LOG(("kwSandboxOutBufWrite: flushing %u bytes\n", pOutBuf->u.Fully.cchBuf)); kwSandboxOutBufWriteIt(pOutBuf->hBackup, pOutBuf->u.Fully.pchBuf, pOutBuf->u.Fully.cchBuf); kHlpMemCopy(&pOutBuf->u.Fully.pchBuf[0], pchBuffer, cchLine); pOutBuf->u.Fully.cchBuf = cchLine; } /* advance */ pchBuffer += cchLine; cchToWrite -= cchLine; } } } #endif /* WITH_STD_OUT_ERR_BUFFERING */ #ifdef WITH_TEMP_MEMORY_FILES static KBOOL kwFsTempFileEnsureSpace(PKWFSTEMPFILE pTempFile, KU32 offFile, KU32 cbNeeded) { KU32 cbMinFile = offFile + cbNeeded; if (cbMinFile >= offFile) { /* Calc how much space we've already allocated and */ if (cbMinFile <= pTempFile->cbFileAllocated) return K_TRUE; /* Grow the file. */ if (cbMinFile <= KWFS_TEMP_FILE_MAX) { int rc; KU32 cSegs = pTempFile->cSegs; KU32 cbNewSeg = cbMinFile > 4*1024*1024 ? 256*1024 : 4*1024*1024; do { /* grow the segment array? */ if ((cSegs % 16) == 0) { void *pvNew = kHlpRealloc(pTempFile->paSegs, (cSegs + 16) * sizeof(pTempFile->paSegs[0])); if (!pvNew) return K_FALSE; pTempFile->paSegs = (PKWFSTEMPFILESEG)pvNew; } /* Use page alloc here to simplify mapping later. */ rc = kHlpPageAlloc((void **)&pTempFile->paSegs[cSegs].pbData, cbNewSeg, KPROT_READWRITE, K_FALSE); if (rc == 0) { /* likely */ } else { cbNewSeg = 64*1024; rc = kHlpPageAlloc((void **)&pTempFile->paSegs[cSegs].pbData, cbNewSeg, KPROT_READWRITE, K_FALSE); if (rc != 0) { kHlpAssertFailed(); return K_FALSE; } } pTempFile->paSegs[cSegs].offData = pTempFile->cbFileAllocated; pTempFile->paSegs[cSegs].cbDataAlloc = cbNewSeg; pTempFile->cbFileAllocated += cbNewSeg; pTempFile->cSegs = ++cSegs; } while (pTempFile->cbFileAllocated < cbMinFile); return K_TRUE; } } kHlpAssertMsgFailed(("Out of bounds offFile=%#x + cbNeeded=%#x = %#x\n", offFile, cbNeeded, offFile + cbNeeded)); return K_FALSE; } #endif /* WITH_TEMP_MEMORY_FILES */ #if defined(WITH_TEMP_MEMORY_FILES) || defined(WITH_STD_OUT_ERR_BUFFERING) /** Kernel32 - WriteFile */ static BOOL WINAPI kwSandbox_Kernel32_WriteFile(HANDLE hFile, LPCVOID pvBuffer, DWORD cbToWrite, LPDWORD pcbActuallyWritten, LPOVERLAPPED pOverlapped) { PKWHANDLE pHandle = kwSandboxHandleGet(hFile); BOOL fRet; g_cWriteFileCalls++; if (pHandle != NULL) { switch (pHandle->enmType) { # ifdef WITH_TEMP_MEMORY_FILES case KWHANDLETYPE_TEMP_FILE: { PKWFSTEMPFILE pTempFile = pHandle->u.pTempFile; kHlpAssert(!pOverlapped); kHlpAssert(pcbActuallyWritten); if (kwFsTempFileEnsureSpace(pTempFile, pHandle->offFile, cbToWrite)) { KU32 cbLeft; KU32 offSeg; /* Locate the segment containing the byte at offFile. */ KWFSTEMPFILESEG const *paSegs = pTempFile->paSegs; KU32 iSeg = pTempFile->cSegs - 1; kHlpAssert(pTempFile->cSegs > 0); while (paSegs[iSeg].offData > pHandle->offFile) iSeg--; /* Copy in the data. */ cbLeft = cbToWrite; offSeg = (pHandle->offFile - paSegs[iSeg].offData); for (;;) { KU32 cbAvail = paSegs[iSeg].cbDataAlloc - offSeg; if (cbAvail >= cbLeft) { kHlpMemCopy(&paSegs[iSeg].pbData[offSeg], pvBuffer, cbLeft); break; } kHlpMemCopy(&paSegs[iSeg].pbData[offSeg], pvBuffer, cbAvail); pvBuffer = (KU8 const *)pvBuffer + cbAvail; cbLeft -= cbAvail; offSeg = 0; iSeg++; kHlpAssert(iSeg < pTempFile->cSegs); } /* Update the file offset. */ pHandle->offFile += cbToWrite; if (pHandle->offFile > pTempFile->cbFile) pTempFile->cbFile = pHandle->offFile; *pcbActuallyWritten = cbToWrite; g_cbWriteFileTotal += cbToWrite; g_cbWriteFileToInMemTemp += cbToWrite; g_cWriteFileToInMemTemp++; KWFS_LOG(("WriteFile(%p,,%#x) -> TRUE [temp]\n", hFile, cbToWrite)); kwSandboxHandlePut(pHandle); return TRUE; } kHlpAssertFailed(); kwSandboxHandlePut(pHandle); *pcbActuallyWritten = 0; SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } # endif case KWHANDLETYPE_FSOBJ_READ_CACHE: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_ACCESS_DENIED); *pcbActuallyWritten = 0; return FALSE; # if defined(WITH_STD_OUT_ERR_BUFFERING) || defined(WITH_CONSOLE_OUTPUT_BUFFERING) /* * Standard output & error. */ case KWHANDLETYPE_OUTPUT_BUF: { PKWOUTPUTSTREAMBUF pOutBuf = pHandle->u.pOutBuf; if (pOutBuf->fIsConsole) { kwSandboxConsoleWriteA(&g_Sandbox, pOutBuf, (const char *)pvBuffer, cbToWrite); KWOUT_LOG(("WriteFile(%p [console]) -> TRUE\n", hFile)); } else { # ifdef WITH_STD_OUT_ERR_BUFFERING kwSandboxOutBufWrite(&g_Sandbox, pOutBuf, (const char *)pvBuffer, cbToWrite); KWOUT_LOG(("WriteFile(%p [std%s], 's*.*', %#x) -> TRUE\n", hFile, pOutBuf == &g_Sandbox.StdErr ? "err" : "out", cbToWrite, cbToWrite, pvBuffer, cbToWrite)); # else kHlpAssertFailed(); # endif } if (pcbActuallyWritten) *pcbActuallyWritten = cbToWrite; g_cbWriteFileTotal += cbToWrite; kwSandboxHandlePut(pHandle); return TRUE; } # endif default: #ifdef WITH_TEMP_MEMORY_FILES case KWHANDLETYPE_TEMP_FILE_MAPPING: #endif kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_FUNCTION); *pcbActuallyWritten = 0; return FALSE; } } fRet = WriteFile(hFile, pvBuffer, cbToWrite, pcbActuallyWritten, pOverlapped); if (fRet && pcbActuallyWritten) g_cbWriteFileTotal += *pcbActuallyWritten; KWFS_LOG(("WriteFile(%p,,%#x) -> %d, %#x\n", hFile, cbToWrite, fRet, pcbActuallyWritten ? *pcbActuallyWritten : 0)); return fRet; } /** Kernel32 - WriteFileEx */ static BOOL WINAPI kwSandbox_Kernel32_WriteFileEx(HANDLE hFile, LPCVOID pvBuffer, DWORD cbToWrite, LPOVERLAPPED pOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE pfnCompletionRoutine) { kHlpAssert(kwSandboxHandleLookup(hFile) == NULL); KWFS_LOG(("WriteFileEx(%p)\n", hFile)); return WriteFileEx(hFile, pvBuffer, cbToWrite, pOverlapped, pfnCompletionRoutine); } #endif /* WITH_TEMP_MEMORY_FILES || WITH_STD_OUT_ERR_BUFFERING */ #ifdef WITH_TEMP_MEMORY_FILES /** Kernel32 - SetEndOfFile; */ static BOOL WINAPI kwSandbox_Kernel32_SetEndOfFile(HANDLE hFile) { PKWHANDLE pHandle = kwSandboxHandleGet(hFile); if (pHandle != NULL) { switch (pHandle->enmType) { case KWHANDLETYPE_TEMP_FILE: { PKWFSTEMPFILE pTempFile = pHandle->u.pTempFile; if ( pHandle->offFile > pTempFile->cbFile && !kwFsTempFileEnsureSpace(pTempFile, pHandle->offFile, 0)) { kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } pTempFile->cbFile = pHandle->offFile; KWFS_LOG(("SetEndOfFile(%p) -> TRUE (cbFile=%#x)\n", hFile, pTempFile->cbFile)); kwSandboxHandlePut(pHandle); return TRUE; } case KWHANDLETYPE_FSOBJ_READ_CACHE: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_ACCESS_DENIED); return FALSE; # ifdef WITH_CONSOLE_OUTPUT_BUFFERING case KWHANDLETYPE_OUTPUT_BUF: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(pHandle->u.pOutBuf->fIsConsole ? ERROR_INVALID_OPERATION : ERROR_ACCESS_DENIED); return FALSE; # endif default: case KWHANDLETYPE_TEMP_FILE_MAPPING: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_FUNCTION); return FALSE; } } KWFS_LOG(("SetEndOfFile(%p)\n", hFile)); return SetEndOfFile(hFile); } /** Kernel32 - GetFileType */ static BOOL WINAPI kwSandbox_Kernel32_GetFileType(HANDLE hFile) { PKWHANDLE pHandle = kwSandboxHandleGet(hFile); if (pHandle != NULL) { switch (pHandle->enmType) { case KWHANDLETYPE_FSOBJ_READ_CACHE: KWFS_LOG(("GetFileType(%p) -> FILE_TYPE_DISK [cached]\n", hFile)); kwSandboxHandlePut(pHandle); return FILE_TYPE_DISK; case KWHANDLETYPE_TEMP_FILE: KWFS_LOG(("GetFileType(%p) -> FILE_TYPE_DISK [temp]\n", hFile)); kwSandboxHandlePut(pHandle); return FILE_TYPE_DISK; #ifdef WITH_CONSOLE_OUTPUT_BUFFERING case KWHANDLETYPE_OUTPUT_BUF: { PKWOUTPUTSTREAMBUF pOutBuf = pHandle->u.pOutBuf; DWORD fRet; if (pOutBuf->fFileType != KU8_MAX) { fRet = (pOutBuf->fFileType & 0xf) | ((pOutBuf->fFileType & (FILE_TYPE_REMOTE >> 8)) << 8); KWFS_LOG(("GetFileType(%p) -> %#x [outbuf]\n", hFile, fRet)); } else { fRet = GetFileType(hFile); KWFS_LOG(("GetFileType(%p) -> %#x [outbuf, fallback]\n", hFile, fRet)); } kwSandboxHandlePut(pHandle); return fRet; } #endif } kwSandboxHandlePut(pHandle); } KWFS_LOG(("GetFileType(%p)\n", hFile)); return GetFileType(hFile); } /** Kernel32 - GetFileSize */ static DWORD WINAPI kwSandbox_Kernel32_GetFileSize(HANDLE hFile, LPDWORD pcbHighDword) { PKWHANDLE pHandle = kwSandboxHandleGet(hFile); if (pHandle != NULL) { if (pcbHighDword) *pcbHighDword = 0; SetLastError(NO_ERROR); switch (pHandle->enmType) { case KWHANDLETYPE_FSOBJ_READ_CACHE: KWFS_LOG(("GetFileSize(%p) -> %#x [cached]\n", hFile, pHandle->u.pCachedFile->cbCached)); kwSandboxHandlePut(pHandle); return pHandle->u.pCachedFile->cbCached; case KWHANDLETYPE_TEMP_FILE: KWFS_LOG(("GetFileSize(%p) -> %#x [temp]\n", hFile, pHandle->u.pTempFile->cbFile)); kwSandboxHandlePut(pHandle); return pHandle->u.pTempFile->cbFile; case KWHANDLETYPE_OUTPUT_BUF: /* do default */ break; default: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_FUNCTION); return INVALID_FILE_SIZE; } kwSandboxHandlePut(pHandle); } KWFS_LOG(("GetFileSize(%p,)\n", hFile)); return GetFileSize(hFile, pcbHighDword); } /** Kernel32 - GetFileSizeEx */ static BOOL WINAPI kwSandbox_Kernel32_GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER pcbFile) { PKWHANDLE pHandle = kwSandboxHandleGet(hFile); if (pHandle != NULL) { switch (pHandle->enmType) { case KWHANDLETYPE_FSOBJ_READ_CACHE: KWFS_LOG(("GetFileSizeEx(%p) -> TRUE, %#x [cached]\n", hFile, pHandle->u.pCachedFile->cbCached)); pcbFile->QuadPart = pHandle->u.pCachedFile->cbCached; kwSandboxHandlePut(pHandle); return TRUE; case KWHANDLETYPE_TEMP_FILE: KWFS_LOG(("GetFileSizeEx(%p) -> TRUE, %#x [temp]\n", hFile, pHandle->u.pTempFile->cbFile)); pcbFile->QuadPart = pHandle->u.pTempFile->cbFile; kwSandboxHandlePut(pHandle); return TRUE; case KWHANDLETYPE_OUTPUT_BUF: /* do default */ break; default: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_FUNCTION); return INVALID_FILE_SIZE; } kwSandboxHandlePut(pHandle); } KWFS_LOG(("GetFileSizeEx(%p,)\n", hFile)); return GetFileSizeEx(hFile, pcbFile); } /** Kernel32 - CreateFileMappingW */ static HANDLE WINAPI kwSandbox_Kernel32_CreateFileMappingW(HANDLE hFile, LPSECURITY_ATTRIBUTES pSecAttrs, DWORD fProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR pwszName) { HANDLE hMapping; PKWHANDLE pHandle = kwSandboxHandleGet(hFile); if (pHandle != NULL) { switch (pHandle->enmType) { case KWHANDLETYPE_TEMP_FILE: { PKWFSTEMPFILE pTempFile = pHandle->u.pTempFile; if ( ( fProtect == PAGE_READONLY || fProtect == PAGE_EXECUTE_READ) && dwMaximumSizeHigh == 0 && ( dwMaximumSizeLow == 0 || dwMaximumSizeLow == pTempFile->cbFile) && pwszName == NULL) { hMapping = kwFsTempFileCreateHandle(pHandle->u.pTempFile, GENERIC_READ, K_TRUE /*fMapping*/); KWFS_LOG(("CreateFileMappingW(%p, %u) -> %p [temp]\n", hFile, fProtect, hMapping)); kwSandboxHandlePut(pHandle); return hMapping; } kHlpAssertMsgFailed(("fProtect=%#x cb=%#x'%08x name=%p\n", fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName)); kwSandboxHandlePut(pHandle); SetLastError(ERROR_ACCESS_DENIED); return INVALID_HANDLE_VALUE; } /* moc.exe benefits from this. */ case KWHANDLETYPE_FSOBJ_READ_CACHE: { PKFSWCACHEDFILE pCachedFile = pHandle->u.pCachedFile; if ( ( fProtect == PAGE_READONLY || fProtect == PAGE_EXECUTE_READ) && dwMaximumSizeHigh == 0 && ( dwMaximumSizeLow == 0 || dwMaximumSizeLow == pCachedFile->cbCached) && pwszName == NULL) { if (kwFsObjCacheCreateFileHandle(pCachedFile, GENERIC_READ, FALSE /*fInheritHandle*/, K_FALSE /*fIsFileHandle*/, &hMapping)) { /* likely */ } else hMapping = NULL; KWFS_LOG(("CreateFileMappingW(%p, %u) -> %p [cached]\n", hFile, fProtect, hMapping)); kwSandboxHandlePut(pHandle); return hMapping; } /* Do fallback (for .pch). */ kHlpAssertMsg(fProtect == PAGE_WRITECOPY, ("fProtect=%#x cb=%#x'%08x name=%p\n", fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName)); hMapping = CreateFileMappingW(hFile, pSecAttrs, fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName); KWFS_LOG(("CreateFileMappingW(%p, %p, %#x, %#x, %#x, %p) -> %p [cached-fallback]\n", hFile, pSecAttrs, fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName, hMapping)); kwSandboxHandlePut(pHandle); return hMapping; } /** @todo read cached memory mapped files too for moc. */ } kwSandboxHandlePut(pHandle); } hMapping = CreateFileMappingW(hFile, pSecAttrs, fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName); KWFS_LOG(("CreateFileMappingW(%p, %p, %#x, %#x, %#x, %p) -> %p\n", hFile, pSecAttrs, fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName, hMapping)); return hMapping; } /** Kernel32 - MapViewOfFile */ static PVOID WINAPI kwSandbox_Kernel32_MapViewOfFile(HANDLE hSection, DWORD dwDesiredAccess, DWORD offFileHigh, DWORD offFileLow, SIZE_T cbToMap) { PVOID pvRet; PKWHANDLE pHandle = kwSandboxHandleGet(hSection); if (pHandle != NULL) { KU32 idxMapping; /* * Ensure one free entry in the mapping tracking table first, * since this is common to both temporary and cached files. */ if (g_Sandbox.cMemMappings + 1 <= g_Sandbox.cMemMappingsAlloc) { /* likely */ } else { void *pvNew; KU32 cNew = g_Sandbox.cMemMappingsAlloc; if (cNew) cNew *= 2; else cNew = 32; pvNew = kHlpRealloc(g_Sandbox.paMemMappings, cNew * sizeof(g_Sandbox.paMemMappings[0])); if (pvNew) g_Sandbox.paMemMappings = (PKWMEMMAPPING)pvNew; else { kwErrPrintf("Failed to grow paMemMappings from %#x to %#x!\n", g_Sandbox.cMemMappingsAlloc, cNew); kwSandboxHandlePut(pHandle); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return NULL; } g_Sandbox.cMemMappingsAlloc = cNew; } /* * Type specific work. */ switch (pHandle->enmType) { case KWHANDLETYPE_FSOBJ_READ_CACHE: case KWHANDLETYPE_TEMP_FILE: case KWHANDLETYPE_OUTPUT_BUF: default: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_OPERATION); return NULL; case KWHANDLETYPE_TEMP_FILE_MAPPING: { PKWFSTEMPFILE pTempFile = pHandle->u.pTempFile; if ( dwDesiredAccess == FILE_MAP_READ && offFileHigh == 0 && offFileLow == 0 && (cbToMap == 0 || cbToMap == pTempFile->cbFile) ) { kHlpAssert(pTempFile->cMappings == 0 || pTempFile->cSegs == 1); if (pTempFile->cSegs != 1) { KU32 iSeg; KU32 cbLeft; KU32 cbAll = pTempFile->cbFile ? (KU32)K_ALIGN_Z(pTempFile->cbFile, 0x2000) : 0x1000; KU8 *pbAll = NULL; int rc = kHlpPageAlloc((void **)&pbAll, cbAll, KPROT_READWRITE, K_FALSE); if (rc != 0) { kHlpAssertFailed(); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return NULL; } cbLeft = pTempFile->cbFile; for (iSeg = 0; iSeg < pTempFile->cSegs && cbLeft > 0; iSeg++) { KU32 cbToCopy = K_MIN(cbLeft, pTempFile->paSegs[iSeg].cbDataAlloc); kHlpMemCopy(&pbAll[pTempFile->paSegs[iSeg].offData], pTempFile->paSegs[iSeg].pbData, cbToCopy); cbLeft -= cbToCopy; } for (iSeg = 0; iSeg < pTempFile->cSegs; iSeg++) { kHlpPageFree(pTempFile->paSegs[iSeg].pbData, pTempFile->paSegs[iSeg].cbDataAlloc); pTempFile->paSegs[iSeg].pbData = NULL; pTempFile->paSegs[iSeg].cbDataAlloc = 0; } pTempFile->cSegs = 1; pTempFile->cbFileAllocated = cbAll; pTempFile->paSegs[0].cbDataAlloc = cbAll; pTempFile->paSegs[0].pbData = pbAll; pTempFile->paSegs[0].offData = 0; } pTempFile->cMappings++; kHlpAssert(pTempFile->cMappings == 1); pvRet = pTempFile->paSegs[0].pbData; KWFS_LOG(("CreateFileMappingW(%p) -> %p [temp]\n", hSection, pvRet)); break; } kHlpAssertMsgFailed(("dwDesiredAccess=%#x offFile=%#x'%08x cbToMap=%#x (cbFile=%#x)\n", dwDesiredAccess, offFileHigh, offFileLow, cbToMap, pTempFile->cbFile)); kwSandboxHandlePut(pHandle); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return NULL; } /* * This is simple in comparison to the above temporary file code. */ case KWHANDLETYPE_FSOBJ_READ_CACHE_MAPPING: { PKFSWCACHEDFILE pCachedFile = pHandle->u.pCachedFile; if ( dwDesiredAccess == FILE_MAP_READ && offFileHigh == 0 && offFileLow == 0 && (cbToMap == 0 || cbToMap == pCachedFile->cbCached) ) { pvRet = pCachedFile->pbCached; KWFS_LOG(("CreateFileMappingW(%p) -> %p [cached]\n", hSection, pvRet)); break; } kHlpAssertMsgFailed(("dwDesiredAccess=%#x offFile=%#x'%08x cbToMap=%#x (cbFile=%#x)\n", dwDesiredAccess, offFileHigh, offFileLow, cbToMap, pCachedFile->cbCached)); kwSandboxHandlePut(pHandle); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return NULL; } } /* * Insert into the mapping tracking table. This is common * and we should only get here with a non-NULL pvRet. * * Note! We could look for duplicates and do ref counting, but it's * easier to just append for now. */ kHlpAssert(pvRet != NULL); idxMapping = g_Sandbox.cMemMappings; kHlpAssert(idxMapping < g_Sandbox.cMemMappingsAlloc); g_Sandbox.paMemMappings[idxMapping].cRefs = 1; g_Sandbox.paMemMappings[idxMapping].pvMapping = pvRet; g_Sandbox.paMemMappings[idxMapping].enmType = pHandle->enmType; g_Sandbox.paMemMappings[idxMapping].u.pCachedFile = pHandle->u.pCachedFile; g_Sandbox.cMemMappings++; kwSandboxHandlePut(pHandle); return pvRet; } pvRet = MapViewOfFile(hSection, dwDesiredAccess, offFileHigh, offFileLow, cbToMap); KWFS_LOG(("MapViewOfFile(%p, %#x, %#x, %#x, %#x) -> %p\n", hSection, dwDesiredAccess, offFileHigh, offFileLow, cbToMap, pvRet)); return pvRet; } /** Kernel32 - MapViewOfFileEx */ static PVOID WINAPI kwSandbox_Kernel32_MapViewOfFileEx(HANDLE hSection, DWORD dwDesiredAccess, DWORD offFileHigh, DWORD offFileLow, SIZE_T cbToMap, PVOID pvMapAddr) { PVOID pvRet; PKWHANDLE pHandle = kwSandboxHandleGet(hSection); if (pHandle != NULL) { switch (pHandle->enmType) { case KWHANDLETYPE_TEMP_FILE_MAPPING: KWFS_LOG(("MapViewOfFileEx(%p, %#x, %#x, %#x, %#x, %p) - temporary file!\n", hSection, dwDesiredAccess, offFileHigh, offFileLow, cbToMap, pvMapAddr)); if (!pvMapAddr) pvRet = kwSandbox_Kernel32_MapViewOfFile(hSection, dwDesiredAccess, offFileHigh, offFileLow, cbToMap); else { kHlpAssertFailed(); SetLastError(ERROR_NOT_ENOUGH_MEMORY); } kwSandboxHandlePut(pHandle); return NULL; case KWHANDLETYPE_FSOBJ_READ_CACHE_MAPPING: KWFS_LOG(("MapViewOfFileEx(%p, %#x, %#x, %#x, %#x, %p) - read cached file!\n", hSection, dwDesiredAccess, offFileHigh, offFileLow, cbToMap, pvMapAddr)); if (!pvMapAddr) { pvRet = kwSandbox_Kernel32_MapViewOfFile(hSection, dwDesiredAccess, offFileHigh, offFileLow, cbToMap); kwSandboxHandlePut(pHandle); return pvRet; } /* We can use fallback here as the handle is an actual section handle. */ break; case KWHANDLETYPE_FSOBJ_READ_CACHE: case KWHANDLETYPE_TEMP_FILE: case KWHANDLETYPE_OUTPUT_BUF: default: kHlpAssertFailed(); kwSandboxHandlePut(pHandle); SetLastError(ERROR_INVALID_OPERATION); return NULL; } kwSandboxHandlePut(pHandle); } pvRet = MapViewOfFileEx(hSection, dwDesiredAccess, offFileHigh, offFileLow, cbToMap, pvMapAddr); KWFS_LOG(("MapViewOfFileEx(%p, %#x, %#x, %#x, %#x, %p) -> %p\n", hSection, dwDesiredAccess, offFileHigh, offFileLow, cbToMap, pvMapAddr, pvRet)); return pvRet; } /** Kernel32 - UnmapViewOfFile */ static BOOL WINAPI kwSandbox_Kernel32_UnmapViewOfFile(LPCVOID pvBase) { /* * Consult the memory mapping tracker. */ PKWMEMMAPPING paMemMappings = g_Sandbox.paMemMappings; KU32 idxMapping = g_Sandbox.cMemMappings; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); while (idxMapping-- > 0) if (paMemMappings[idxMapping].pvMapping == pvBase) { /* Type specific stuff. */ if (paMemMappings[idxMapping].enmType == KWHANDLETYPE_TEMP_FILE_MAPPING) { KWFS_LOG(("UnmapViewOfFile(%p) -> TRUE [temp]\n", pvBase)); paMemMappings[idxMapping].u.pTempFile->cMappings--; } else KWFS_LOG(("UnmapViewOfFile(%p) -> TRUE [cached]\n", pvBase)); /* Deref and probably free it. */ if (--paMemMappings[idxMapping].cRefs == 0) { g_Sandbox.cMemMappings--; if (idxMapping != g_Sandbox.cMemMappings) paMemMappings[idxMapping] = paMemMappings[g_Sandbox.cMemMappings]; } return TRUE; } KWFS_LOG(("UnmapViewOfFile(%p)\n", pvBase)); return UnmapViewOfFile(pvBase); } /** @todo UnmapViewOfFileEx */ #endif /* WITH_TEMP_MEMORY_FILES */ /** Kernel32 - DuplicateHandle */ static BOOL WINAPI kwSandbox_Kernel32_DuplicateHandle(HANDLE hSrcProc, HANDLE hSrc, HANDLE hDstProc, PHANDLE phNew, DWORD dwDesiredAccess, BOOL fInheritHandle, DWORD dwOptions) { BOOL fRet; /* * We must catch our handles being duplicated. */ if (hSrcProc == GetCurrentProcess()) { PKWHANDLE pHandle = kwSandboxHandleGet(hSrc); if (pHandle) { fRet = DuplicateHandle(hSrcProc, hSrc, hDstProc, phNew, dwDesiredAccess, fInheritHandle, dwOptions); if (fRet) { if (kwSandboxHandleTableEnter(&g_Sandbox, pHandle, *phNew)) { pHandle->cRefs++; KWFS_LOG(("DuplicateHandle(%p, %p, %p, , %#x, %d, %#x) -> TRUE, %p [intercepted handle] enmType=%d cRef=%d\n", hSrcProc, hSrc, hDstProc, dwDesiredAccess, fInheritHandle, dwOptions, *phNew, pHandle->enmType, pHandle->cRefs)); } else { fRet = FALSE; SetLastError(ERROR_NOT_ENOUGH_MEMORY); KWFS_LOG(("DuplicateHandle(%p, %p, %p, , %#x, %d, %#x) -> !FALSE!, %p [intercepted handle] enmType=%d\n", hSrcProc, hSrc, hDstProc, dwDesiredAccess, fInheritHandle, dwOptions, *phNew, pHandle->enmType)); } } else KWFS_LOG(("DuplicateHandle(%p, %p, %p, , %#x, %d, %#x) -> FALSE [intercepted handle] enmType=%d\n", hSrcProc, hSrc, hDstProc, dwDesiredAccess, fInheritHandle, dwOptions, pHandle->enmType)); kwSandboxHandlePut(pHandle); return fRet; } } /* * Not one of ours, just do what the caller asks and log it. */ fRet = DuplicateHandle(hSrcProc, hSrc, hDstProc, phNew, dwDesiredAccess, fInheritHandle, dwOptions); KWFS_LOG(("DuplicateHandle(%p, %p, %p, , %#x, %d, %#x) -> %d, %p\n", hSrcProc, hSrc, hDstProc, dwDesiredAccess, fInheritHandle, dwOptions, fRet, *phNew)); return fRet; } /** Kernel32 - CloseHandle */ static BOOL WINAPI kwSandbox_Kernel32_CloseHandle(HANDLE hObject) { BOOL fRet; KUPTR const idxHandle = KW_HANDLE_TO_INDEX(hObject); PKWHANDLE pHandle = kwSandboxHandleGet(hObject); if (pHandle) { /* Prevent the closing of the standard output and error handles. */ if ( pHandle->enmType != KWHANDLETYPE_OUTPUT_BUF || idxHandle != KW_HANDLE_TO_INDEX(pHandle->hHandle) /* why this?!? */) { fRet = CloseHandle(hObject); if (fRet) { EnterCriticalSection(&g_Sandbox.HandlesLock); pHandle = g_Sandbox.papHandles[idxHandle]; g_Sandbox.papHandles[idxHandle] = NULL; g_Sandbox.cActiveHandles--; kHlpAssert(g_Sandbox.cActiveHandles >= g_Sandbox.cFixedHandles); if (--pHandle->cRefs == 0) { #ifdef WITH_TEMP_MEMORY_FILES if (pHandle->enmType == KWHANDLETYPE_TEMP_FILE) { kHlpAssert(pHandle->u.pTempFile->cActiveHandles > 0); pHandle->u.pTempFile->cActiveHandles--; } #endif kHlpFree(pHandle); KWFS_LOG(("CloseHandle(%p) -> TRUE [intercepted handle, freed]\n", hObject)); } else { KWFS_LOG(("CloseHandle(%p) -> TRUE [intercepted handle, not freed]\n", hObject)); kwSandboxHandlePut(pHandle); } LeaveCriticalSection(&g_Sandbox.HandlesLock); return fRet; } KWFS_LOG(("CloseHandle(%p) -> FALSE [intercepted handle] err=%u!\n", hObject, GetLastError())); } else { #ifdef WITH_CONSOLE_OUTPUT_BUFFERING KWFS_LOG(("CloseHandle(%p) -> TRUE [intercepted handle] Ignored closing of std%s!\n", hObject, hObject == g_Sandbox.StdErr.hOutput ? "err" : "out")); #else KWFS_LOG(("CloseHandle(%p) -> TRUE [intercepted handle] Ignored closing of stdXXX!\n", hObject)); #endif fRet = TRUE; } kwSandboxHandlePut(pHandle); return fRet; } fRet = CloseHandle(hObject); KWFS_LOG(("CloseHandle(%p) -> %d\n", hObject, fRet)); return fRet; } /** Kernel32 - GetFileAttributesA. */ static DWORD WINAPI kwSandbox_Kernel32_GetFileAttributesA(LPCSTR pszFilename) { DWORD fRet; const char *pszExt = kHlpGetExt(pszFilename); if (kwFsIsCacheableExtensionA(pszExt, K_TRUE /*fAttrQuery*/)) { KFSLOOKUPERROR enmError; PKFSOBJ pFsObj; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pFsObj = kFsCacheLookupNoMissingA(g_pFsCache, pszFilename, &enmError); if (pFsObj) { kHlpAssert(pFsObj->fHaveStats); fRet = pFsObj->Stats.st_attribs; kFsCacheObjRelease(g_pFsCache, pFsObj); } else { SetLastError(kwFsLookupErrorToWindowsError(enmError)); fRet = INVALID_FILE_ATTRIBUTES; } KWFS_LOG(("GetFileAttributesA(%s) -> %#x [cached]\n", pszFilename, fRet)); return fRet; } fRet = GetFileAttributesA(pszFilename); KWFS_LOG(("GetFileAttributesA(%s) -> %#x\n", pszFilename, fRet)); return fRet; } /** Kernel32 - GetFileAttributesW. */ static DWORD WINAPI kwSandbox_Kernel32_GetFileAttributesW(LPCWSTR pwszFilename) { DWORD fRet; if (kwFsIsCacheablePathExtensionW(pwszFilename, K_TRUE /*fAttrQuery*/)) { KFSLOOKUPERROR enmError; PKFSOBJ pFsObj; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pFsObj = kFsCacheLookupNoMissingW(g_pFsCache, pwszFilename, &enmError); if (pFsObj) { kHlpAssert(pFsObj->fHaveStats); fRet = pFsObj->Stats.st_attribs; kFsCacheObjRelease(g_pFsCache, pFsObj); } else { SetLastError(kwFsLookupErrorToWindowsError(enmError)); fRet = INVALID_FILE_ATTRIBUTES; } #ifndef NDEBUG { DWORD fCheck = GetFileAttributesW(pwszFilename); kHlpAssertMsg(fCheck == fRet, ("fCheck=%x vs fRet=%#x diff=%#x; %ls\n", fCheck, fRet, fCheck ^ fRet, pwszFilename)); } #endif KWFS_LOG(("GetFileAttributesW(%ls) -> %#x [cached]\n", pwszFilename, fRet)); return fRet; } fRet = GetFileAttributesW(pwszFilename); KWFS_LOG(("GetFileAttributesW(%ls) -> %#x\n", pwszFilename, fRet)); return fRet; } /** Kernel32 - GetFileAttributesExA. */ static BOOL WINAPI kwSandbox_Kernel32_GetFileAttributesExA(LPCSTR pszFilename, GET_FILEEX_INFO_LEVELS enmLevel, WIN32_FILE_ATTRIBUTE_DATA *pData) { BOOL fRet; const char *pszExt = kHlpGetExt(pszFilename); if (kwFsIsCacheableExtensionA(pszExt, K_TRUE /*fAttrQuery*/)) { KFSLOOKUPERROR enmError; PKFSOBJ pFsObj; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pFsObj = kFsCacheLookupNoMissingA(g_pFsCache, pszFilename, &enmError); if (pFsObj) { kHlpAssert(pFsObj->fHaveStats); if (enmLevel == GetFileExInfoStandard) { pData->dwFileAttributes = pFsObj->Stats.st_attribs; pData->nFileSizeHigh = (KU64)pFsObj->Stats.st_size >> 32; pData->nFileSizeLow = (KU32)pFsObj->Stats.st_size; *(KU64 *)&pData->ftCreationTime = birdNtTimeFromTimeSpec(&pFsObj->Stats.st_birthtim); *(KU64 *)&pData->ftLastAccessTime = birdNtTimeFromTimeSpec(&pFsObj->Stats.st_atim); *(KU64 *)&pData->ftLastWriteTime = birdNtTimeFromTimeSpec(&pFsObj->Stats.st_mtim); kFsCacheObjRelease(g_pFsCache, pFsObj); fRet = TRUE; } else { kFsCacheObjRelease(g_pFsCache, pFsObj); fRet = GetFileAttributesExA(pszFilename, enmLevel, pData); } } else { SetLastError(kwFsLookupErrorToWindowsError(enmError)); fRet = FALSE; } #ifdef K_STRICT { WIN32_FILE_ATTRIBUTE_DATA CheckData = { 0 }; DWORD const dwErrSaved = GetLastError(); BOOL const fRetCheck = GetFileAttributesExA(pszFilename, enmLevel, &CheckData); kHlpAssertMsg(fRet == fRetCheck, ("fRet=%d fRetCheck=%d; %s\n", fRet, fRetCheck, pszFilename)); if (fRetCheck && fRet) { # define ASSERT_FS_FIELD_EQUAL_A(pResult, pExpected, pszFilename, Field, szFmt) \ kHlpAssertMsg((pResult)->Field == (pExpected)->Field, (#Field ": " szFmt " , expected " szFmt "; %s\n", (pResult)->Field, (pExpected)->Field, pszFilename)) ASSERT_FS_FIELD_EQUAL_A(pData, &CheckData, pszFilename, dwFileAttributes, "%#x"); ASSERT_FS_FIELD_EQUAL_A(pData, &CheckData, pszFilename, nFileSizeHigh, "%#x"); ASSERT_FS_FIELD_EQUAL_A(pData, &CheckData, pszFilename, nFileSizeLow, "%#x"); ASSERT_FS_FIELD_EQUAL_A(pData, &CheckData, pszFilename, ftCreationTime.dwHighDateTime, "%#x"); ASSERT_FS_FIELD_EQUAL_A(pData, &CheckData, pszFilename, ftCreationTime.dwLowDateTime, "%#x"); ASSERT_FS_FIELD_EQUAL_A(pData, &CheckData, pszFilename, ftLastWriteTime.dwHighDateTime, "%#x"); ASSERT_FS_FIELD_EQUAL_A(pData, &CheckData, pszFilename, ftLastWriteTime.dwLowDateTime, "%#x"); } else kHlpAssertMsg(dwErrSaved == GetLastError(), ("%u, expected %u; %s\n", dwErrSaved, GetLastError(), pszFilename)); SetLastError(dwErrSaved); } #endif KWFS_LOG(("GetFileAttributesA(%s,%d,) -> %d [cached]\n", pszFilename, enmLevel, fRet)); return fRet; } fRet = GetFileAttributesExA(pszFilename, enmLevel, pData); KWFS_LOG(("GetFileAttributesExA(%s,%d,) -> %d\n", pszFilename, enmLevel, fRet)); return fRet; } /** Kernel32 - GetFileAttributesExW. */ static BOOL WINAPI kwSandbox_Kernel32_GetFileAttributesExW(LPCWSTR pwszFilename, GET_FILEEX_INFO_LEVELS enmLevel, WIN32_FILE_ATTRIBUTE_DATA *pData) { BOOL fRet; if (kwFsIsCacheablePathExtensionW(pwszFilename, K_TRUE /*fAttrQuery*/)) { KFSLOOKUPERROR enmError; PKFSOBJ pFsObj; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pFsObj = kFsCacheLookupNoMissingW(g_pFsCache, pwszFilename, &enmError); if (pFsObj) { kHlpAssert(pFsObj->fHaveStats); if (enmLevel == GetFileExInfoStandard) { pData->dwFileAttributes = pFsObj->Stats.st_attribs; pData->nFileSizeHigh = (KU64)pFsObj->Stats.st_size >> 32; pData->nFileSizeLow = (KU32)pFsObj->Stats.st_size; *(KU64 *)&pData->ftCreationTime = birdNtTimeFromTimeSpec(&pFsObj->Stats.st_birthtim); *(KU64 *)&pData->ftLastAccessTime = birdNtTimeFromTimeSpec(&pFsObj->Stats.st_atim); *(KU64 *)&pData->ftLastWriteTime = birdNtTimeFromTimeSpec(&pFsObj->Stats.st_mtim); kFsCacheObjRelease(g_pFsCache, pFsObj); fRet = TRUE; } else { kFsCacheObjRelease(g_pFsCache, pFsObj); fRet = GetFileAttributesExW(pwszFilename, enmLevel, pData); } } else { SetLastError(kwFsLookupErrorToWindowsError(enmError)); fRet = FALSE; } #ifdef K_STRICT { WIN32_FILE_ATTRIBUTE_DATA CheckData = { 0 }; DWORD const dwErrSaved = GetLastError(); BOOL const fRetCheck = GetFileAttributesExW(pwszFilename, enmLevel, &CheckData); kHlpAssertMsg(fRet == fRetCheck, ("fRet=%d fRetCheck=%d; %ls\n", fRet, fRetCheck, pwszFilename)); if (fRetCheck && fRet) { # define ASSERT_FS_FIELD_EQUAL_W(pResult, pExpected, pszFilename, Field, szFmt) \ kHlpAssertMsg((pResult)->Field == (pExpected)->Field, (#Field ": " szFmt " , expected " szFmt "; %ls\n", (pResult)->Field, (pExpected)->Field, pwszFilename)) ASSERT_FS_FIELD_EQUAL_W(pData, &CheckData, pwszFilename, dwFileAttributes, "%#x"); ASSERT_FS_FIELD_EQUAL_W(pData, &CheckData, pwszFilename, nFileSizeHigh, "%#x"); ASSERT_FS_FIELD_EQUAL_W(pData, &CheckData, pwszFilename, nFileSizeLow, "%#x"); ASSERT_FS_FIELD_EQUAL_W(pData, &CheckData, pwszFilename, ftCreationTime.dwHighDateTime, "%#x"); ASSERT_FS_FIELD_EQUAL_W(pData, &CheckData, pwszFilename, ftCreationTime.dwLowDateTime, "%#x"); ASSERT_FS_FIELD_EQUAL_W(pData, &CheckData, pwszFilename, ftLastWriteTime.dwHighDateTime, "%#x"); ASSERT_FS_FIELD_EQUAL_W(pData, &CheckData, pwszFilename, ftLastWriteTime.dwLowDateTime, "%#x"); } else kHlpAssertMsg(dwErrSaved == GetLastError(), ("%u, expected %u; %ls\n", dwErrSaved, GetLastError(), pwszFilename)); SetLastError(dwErrSaved); } #endif KWFS_LOG(("GetFileAttributesExW(%ls,%d,) -> %d [cached]\n", pwszFilename, enmLevel, fRet)); return fRet; } fRet = GetFileAttributesExW(pwszFilename, enmLevel, pData); KWFS_LOG(("GetFileAttributesExW(%ls,%d,) -> %d\n", pwszFilename, enmLevel, fRet)); return fRet; } /** Kernel32 - GetShortPathNameW - c1[xx].dll of VS2010 does this to the * directory containing each include file. We cache the result to speed * things up a little. */ static DWORD WINAPI kwSandbox_Kernel32_GetShortPathNameW(LPCWSTR pwszLongPath, LPWSTR pwszShortPath, DWORD cwcShortPath) { DWORD cwcRet; if (kwFsIsCacheablePathExtensionW(pwszLongPath, K_TRUE /*fAttrQuery*/)) { KFSLOOKUPERROR enmError; PKFSOBJ pObj; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pObj = kFsCacheLookupW(g_pFsCache, pwszLongPath, &enmError); if (pObj) { if (pObj->bObjType != KFSOBJ_TYPE_MISSING) { if (kFsCacheObjGetFullShortPathW(pObj, pwszShortPath, cwcShortPath, '\\')) { cwcRet = (DWORD)kwUtf16Len(pwszShortPath); /* Should preserve trailing slash on directory paths. */ if (pObj->bObjType == KFSOBJ_TYPE_DIR) { if ( cwcRet + 1 < cwcShortPath && pwszShortPath[cwcRet - 1] != '\\') { KSIZE cwcIn = kwUtf16Len(pwszLongPath); if ( cwcIn > 0 && (pwszLongPath[cwcIn - 1] == '\\' || pwszLongPath[cwcIn - 1] == '/') ) { pwszShortPath[cwcRet++] = '\\'; pwszShortPath[cwcRet] = '\0'; } } } KWFS_LOG(("GetShortPathNameW(%ls) -> '%*.*ls' & %#x [cached]\n", pwszLongPath, K_MIN(cwcShortPath, cwcRet), K_MIN(cwcShortPath, cwcRet), pwszShortPath, cwcRet)); kFsCacheObjRelease(g_pFsCache, pObj); return cwcRet; } /* fall back for complicated cases. */ } kFsCacheObjRelease(g_pFsCache, pObj); } } cwcRet = GetShortPathNameW(pwszLongPath, pwszShortPath, cwcShortPath); KWFS_LOG(("GetShortPathNameW(%ls) -> '%*.*ls' & %#x\n", pwszLongPath, K_MIN(cwcShortPath, cwcRet), K_MIN(cwcShortPath, cwcRet), pwszShortPath, cwcRet)); return cwcRet; } #ifdef WITH_TEMP_MEMORY_FILES /** Kernel32 - DeleteFileW * Skip deleting the in-memory files. */ static BOOL WINAPI kwSandbox_Kernel32_DeleteFileW(LPCWSTR pwszFilename) { BOOL fRc; if ( g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_CL && kwFsIsClTempFileW(pwszFilename)) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); KWFS_LOG(("DeleteFileW(%s) -> TRUE [temp]\n", pwszFilename)); fRc = TRUE; } else { fRc = DeleteFileW(pwszFilename); KWFS_LOG(("DeleteFileW(%s) -> %d (%d)\n", pwszFilename, fRc, GetLastError())); } return fRc; } #endif /* WITH_TEMP_MEMORY_FILES */ #ifdef WITH_CONSOLE_OUTPUT_BUFFERING /* * * Console output buffering. * Console output buffering. * Console output buffering. * */ /** * Write a wide char string to the console. * * @param pSandbox The sandbox which output buffer to flush. */ static void kwSandboxConsoleWriteIt(PKWSANDBOX pSandbox, wchar_t const *pwcBuf, KU32 cwcToWrite) { if (cwcToWrite > 0) { DWORD cwcWritten = 0; if (WriteConsoleW(pSandbox->Combined.hOutput, pwcBuf, cwcToWrite, &cwcWritten, NULL)) { if (cwcWritten == cwcToWrite) { /* likely */ } else { DWORD off = 0; do { off += cwcWritten; cwcWritten = 0; } while ( off < cwcToWrite && WriteConsoleW(pSandbox->Combined.hOutput, &pwcBuf[off], cwcToWrite - off, &cwcWritten, NULL)); kHlpAssert(off == cwcWritten); } } else kHlpAssertFailed(); pSandbox->Combined.cFlushes++; } } /** * Flushes the combined console output buffer. * * @param pSandbox The sandbox which output buffer to flush. */ static void kwSandboxConsoleFlushCombined(PKWSANDBOX pSandbox) { if (pSandbox->Combined.cwcBuf > 0) { KWOUT_LOG(("kwSandboxConsoleFlushCombined: %u wchars\n", pSandbox->Combined.cwcBuf)); kwSandboxConsoleWriteIt(pSandbox, pSandbox->Combined.wszBuf, pSandbox->Combined.cwcBuf); pSandbox->Combined.cwcBuf = 0; } } /** * For handling combined buffer overflow cases line by line. * * @param pSandbox The sandbox. * @param pwcBuf What to add to the combined buffer. Usually a * line, unless we're really low on buffer space. * @param cwcBuf The length of what to add. * @param fBrokenLine Whether this is a broken line. */ static void kwSandboxConsoleAddToCombined(PKWSANDBOX pSandbox, wchar_t const *pwcBuf, KU32 cwcBuf, KBOOL fBrokenLine) { if (fBrokenLine) kwSandboxConsoleFlushCombined(pSandbox); if (pSandbox->Combined.cwcBuf + cwcBuf > K_ELEMENTS(pSandbox->Combined.wszBuf)) { kwSandboxConsoleFlushCombined(pSandbox); kwSandboxConsoleWriteIt(pSandbox, pwcBuf, cwcBuf); } else { kHlpMemCopy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf], pwcBuf, cwcBuf * sizeof(wchar_t)); pSandbox->Combined.cwcBuf += cwcBuf; } } /** * Called to final flush a line buffer via the combined buffer (if applicable). * * @param pSandbox The sandbox. * @param pLineBuf The line buffer. * @param pszName The line buffer name (for logging) */ static void kwSandboxConsoleFinalFlushLineBuf(PKWSANDBOX pSandbox, PKWOUTPUTSTREAMBUF pLineBuf, const char *pszName) { if (pLineBuf->fIsConsole) { if (pLineBuf->u.Con.cwcBuf > 0) { KWOUT_LOG(("kwSandboxConsoleFinalFlushLineBuf: %s: %u wchars\n", pszName, pLineBuf->u.Con.cwcBuf)); if (pLineBuf->u.Con.cwcBuf < pLineBuf->u.Con.cwcBufAlloc) { pLineBuf->u.Con.pwcBuf[pLineBuf->u.Con.cwcBuf++] = '\n'; kwSandboxConsoleAddToCombined(pSandbox, pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf, K_FALSE /*fBrokenLine*/); } else { kwSandboxConsoleAddToCombined(pSandbox, pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf, K_TRUE /*fBrokenLine*/); kwSandboxConsoleAddToCombined(pSandbox, L"\n", 1, K_TRUE /*fBrokenLine*/); } pLineBuf->u.Con.cwcBuf = 0; } } #ifdef WITH_STD_OUT_ERR_BUFFERING else if (pLineBuf->u.Fully.cchBuf > 0) { KWOUT_LOG(("kwSandboxConsoleFinalFlushLineBuf: %s: %u bytes\n", pszName, pLineBuf->u.Fully.cchBuf)); kwSandboxOutBufWriteIt(pLineBuf->hBackup, pLineBuf->u.Fully.pchBuf, pLineBuf->u.Fully.cchBuf); pLineBuf->u.Fully.cchBuf = 0; } #endif } /** * Called at the end of sandboxed execution to flush both stream buffers. * * @param pSandbox The sandbox. */ static void kwSandboxConsoleFlushAll(PKWSANDBOX pSandbox) { /* * First do the cl.exe source file supression trick, if applicable. * The output ends up on CONOUT$ if either StdOut or StdErr is a console * handle. */ if ( pSandbox->pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_CL && pSandbox->Combined.cFlushes == 0) { if ( pSandbox->StdOut.fIsConsole || pSandbox->StdErr.fIsConsole) { if ( pSandbox->Combined.cwcBuf >= 3 && (pSandbox->StdOut.fIsConsole ? pSandbox->StdOut.u.Con.cwcBuf : pSandbox->StdOut.u.Fully.cchBuf) == 0 && (pSandbox->StdErr.fIsConsole ? pSandbox->StdErr.u.Con.cwcBuf : pSandbox->StdErr.u.Fully.cchBuf) == 0 ) { KI32 off = pSandbox->Combined.cwcBuf - 1; if (pSandbox->Combined.wszBuf[off] == '\n') { KBOOL fOk = K_TRUE; while (off-- > 0) { wchar_t const wc = pSandbox->Combined.wszBuf[off]; if (iswalnum(wc) || wc == '.' || wc == ' ' || wc == '_' || wc == '-') { /* likely */ } else { fOk = K_FALSE; break; } } if (fOk) { KWOUT_LOG(("kwSandboxConsoleFlushAll: Dropping '%*.*ls in combined console buffer\n", pSandbox->Combined.cwcBuf, pSandbox->Combined.cwcBuf, pSandbox->Combined.wszBuf)); pSandbox->Combined.cwcBuf = 0; return; } } KWOUT_LOG(("kwSandboxConsoleFlushAll: Unable to drop '%*.*ls in combined console buffer\n", pSandbox->Combined.cwcBuf, pSandbox->Combined.cwcBuf, pSandbox->Combined.wszBuf)); } } #ifdef WITH_STD_OUT_ERR_BUFFERING /* * Otherwise, it goes to standard output (redirected). */ else if ( pSandbox->StdErr.u.Fully.cchBuf == 0 && pSandbox->StdOut.u.Fully.cchBuf >= 3) { char const *pchBuf = pSandbox->StdOut.u.Fully.pchBuf; KI32 off = pSandbox->StdOut.u.Fully.cchBuf - 1; kHlpAssert(pSandbox->Combined.cFlushes == 0 && pSandbox->Combined.cwcBuf == 0); /* unused! */ if (pchBuf[off] == '\n') { KBOOL fOk = K_TRUE; if (pchBuf[off - 1] == '\r') off--; while (off-- > 0) { char const ch = pchBuf[off]; if (isalnum(ch) || ch == '.' || ch == ' ' || ch == '_' || ch == '-') { /* likely */ } else { fOk = K_FALSE; break; } } if (fOk) { KWOUT_LOG(("kwSandboxConsoleFlushAll: Dropping '%*.*s in stdout buffer\n", pSandbox->StdOut.u.Fully.cchBuf, pSandbox->StdOut.u.Fully.cchBuf, pchBuf)); pSandbox->StdOut.u.Fully.cchBuf = 0; return; } } KWOUT_LOG(("kwSandboxConsoleFlushAll: Unable to drop '%*.*s in stdout buffer\n", pSandbox->StdOut.u.Fully.cchBuf, pSandbox->StdOut.u.Fully.cchBuf, pchBuf)); } #endif } /* * Flush the two line buffer, then the combined buffer. */ kwSandboxConsoleFinalFlushLineBuf(pSandbox, &pSandbox->StdErr, "StdErr"); kwSandboxConsoleFinalFlushLineBuf(pSandbox, &pSandbox->StdOut, "StdOut"); kwSandboxConsoleFlushCombined(pSandbox); } /** * Writes a string to the given output stream. * * @param pSandbox The sandbox. * @param pLineBuf The line buffer for the output stream. * @param pwcBuffer The buffer to write. * @param cwcToWrite The number of wchar_t's in the buffer. */ static void kwSandboxConsoleWriteW(PKWSANDBOX pSandbox, PKWOUTPUTSTREAMBUF pLineBuf, wchar_t const *pwcBuffer, KU32 cwcToWrite) { kHlpAssert(pLineBuf->fIsConsole); if (cwcToWrite > 0) { /* * First, find the start of the last incomplete line so we can figure * out how much line buffering we need to do. */ KU32 cchLastIncompleteLine; KU32 offLastIncompleteLine = cwcToWrite; while ( offLastIncompleteLine > 0 && pwcBuffer[offLastIncompleteLine - 1] != '\n') offLastIncompleteLine--; cchLastIncompleteLine = cwcToWrite - offLastIncompleteLine; /* Was there anything to line buffer? */ if (offLastIncompleteLine < cwcToWrite) { /* Need to grow the line buffer? */ KU32 cwcNeeded = offLastIncompleteLine == 0 ? pLineBuf->u.Con.cwcBuf + cchLastIncompleteLine /* incomplete line, append to line buffer */ : cchLastIncompleteLine; /* Only the final incomplete line (if any) goes to the line buffer. */ if (cwcNeeded > pLineBuf->u.Con.cwcBufAlloc) { void *pvNew; KU32 cwcNew = !pLineBuf->u.Con.cwcBufAlloc ? 1024 : pLineBuf->u.Con.cwcBufAlloc * 2; while (cwcNew < cwcNeeded) cwcNew *= 2; pvNew = kHlpRealloc(pLineBuf->u.Con.pwcBuf, cwcNew * sizeof(wchar_t)); if (pvNew) { pLineBuf->u.Con.pwcBuf = (wchar_t *)pvNew; pLineBuf->u.Con.cwcBufAlloc = cwcNew; } else { pvNew = kHlpRealloc(pLineBuf->u.Con.pwcBuf, cwcNeeded * sizeof(wchar_t)); if (pvNew) { pLineBuf->u.Con.pwcBuf = (wchar_t *)pvNew; pLineBuf->u.Con.cwcBufAlloc = cwcNeeded; } else { /* This isn't perfect, but it will have to do for now. */ if (pLineBuf->u.Con.cwcBuf > 0) { kwSandboxConsoleAddToCombined(pSandbox, pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf, K_TRUE /*fBrokenLine*/); pLineBuf->u.Con.cwcBuf = 0; } kwSandboxConsoleAddToCombined(pSandbox, pwcBuffer, cwcToWrite, K_TRUE /*fBrokenLine*/); return; } } } /* * Handle the case where we only add to the line buffer. */ if (offLastIncompleteLine == 0) { kHlpMemCopy(&pLineBuf->u.Con.pwcBuf[pLineBuf->u.Con.cwcBuf], pwcBuffer, cwcToWrite * sizeof(wchar_t)); pLineBuf->u.Con.cwcBuf += cwcToWrite; return; } } /* * If there is sufficient combined buffer to handle this request, this is rather simple. */ kHlpAssert(pSandbox->Combined.cwcBuf <= K_ELEMENTS(pSandbox->Combined.wszBuf)); if (pSandbox->Combined.cwcBuf + pLineBuf->u.Con.cwcBuf + offLastIncompleteLine <= K_ELEMENTS(pSandbox->Combined.wszBuf)) { if (pLineBuf->u.Con.cwcBuf > 0) { kHlpMemCopy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf], pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf * sizeof(wchar_t)); pSandbox->Combined.cwcBuf += pLineBuf->u.Con.cwcBuf; pLineBuf->u.Con.cwcBuf = 0; } kHlpMemCopy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf], pwcBuffer, offLastIncompleteLine * sizeof(wchar_t)); pSandbox->Combined.cwcBuf += offLastIncompleteLine; } else { /* * Do line-by-line processing of the input, flusing the combined buffer * when it becomes necessary. We may have to write lines */ KU32 off = 0; KU32 offNextLine = 0; /* If there are buffered chars, we handle the first line outside the main loop. We must try our best outputting it as a complete line. */ if (pLineBuf->u.Con.cwcBuf > 0) { while (offNextLine < cwcToWrite && pwcBuffer[offNextLine] != '\n') offNextLine++; offNextLine++; kHlpAssert(offNextLine <= offLastIncompleteLine); if (pSandbox->Combined.cwcBuf + pLineBuf->u.Con.cwcBuf + offNextLine <= K_ELEMENTS(pSandbox->Combined.wszBuf)) { kHlpMemCopy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf], pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf * sizeof(wchar_t)); pSandbox->Combined.cwcBuf += pLineBuf->u.Con.cwcBuf; pLineBuf->u.Con.cwcBuf = 0; kHlpMemCopy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf], pwcBuffer, offNextLine * sizeof(wchar_t)); pSandbox->Combined.cwcBuf += offNextLine; } else { KU32 cwcLeft = pLineBuf->u.Con.cwcBufAlloc - pLineBuf->u.Con.cwcBuf; if (cwcLeft > 0) { KU32 cwcCopy = K_MIN(cwcLeft, offNextLine); kHlpMemCopy(&pLineBuf->u.Con.pwcBuf[pLineBuf->u.Con.cwcBuf], pwcBuffer, cwcCopy * sizeof(wchar_t)); pLineBuf->u.Con.cwcBuf += cwcCopy; off += cwcCopy; } if (pLineBuf->u.Con.cwcBuf > 0) { kwSandboxConsoleAddToCombined(pSandbox, pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf, K_TRUE /*fBrokenLine*/); pLineBuf->u.Con.cwcBuf = 0; } if (off < offNextLine) kwSandboxConsoleAddToCombined(pSandbox, &pwcBuffer[off], offNextLine - off, K_TRUE /*fBrokenLine*/); } off = offNextLine; } /* Deal with the remaining lines */ while (off < offLastIncompleteLine) { while (offNextLine < offLastIncompleteLine && pwcBuffer[offNextLine] != '\n') offNextLine++; offNextLine++; kHlpAssert(offNextLine <= offLastIncompleteLine); kwSandboxConsoleAddToCombined(pSandbox, &pwcBuffer[off], offNextLine - off, K_FALSE /*fBrokenLine*/); off = offNextLine; } } /* * Buffer any remaining incomplete line chars. */ if (cchLastIncompleteLine) { kHlpMemCopy(&pLineBuf->u.Con.pwcBuf[0], &pwcBuffer[offLastIncompleteLine], cchLastIncompleteLine * sizeof(wchar_t)); pLineBuf->u.Con.cwcBuf = cchLastIncompleteLine; } } } /** * Worker for WriteConsoleA and WriteFile. * * @param pSandbox The sandbox. * @param pLineBuf The line buffer. * @param pchBuffer What to write. * @param cchToWrite How much to write. */ static void kwSandboxConsoleWriteA(PKWSANDBOX pSandbox, PKWOUTPUTSTREAMBUF pLineBuf, const char *pchBuffer, KU32 cchToWrite) { /* * Convert it to wide char and use the 'W' to do the work. */ int cwcRet; KU32 cwcBuf = cchToWrite * 2 + 1; wchar_t *pwcBufFree = NULL; wchar_t *pwcBuf; kHlpAssert(pLineBuf->fIsConsole); if (cwcBuf <= 4096) pwcBuf = alloca(cwcBuf * sizeof(wchar_t)); else pwcBuf = pwcBufFree = kHlpAlloc(cwcBuf * sizeof(wchar_t)); cwcRet = MultiByteToWideChar(pSandbox->Combined.uCodepage, 0/*dwFlags*/, pchBuffer, cchToWrite, pwcBuf, cwcBuf); if (cwcRet > 0) kwSandboxConsoleWriteW(pSandbox, pLineBuf, pwcBuf, cwcRet); else { DWORD cchWritten; kHlpAssertFailed(); /* Flush the line buffer and combined buffer before calling WriteConsoleA. */ if (pLineBuf->u.Con.cwcBuf > 0) { kwSandboxConsoleAddToCombined(pSandbox, pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf, K_TRUE /*fBroken*/); pLineBuf->u.Con.cwcBuf = 0; } kwSandboxConsoleFlushCombined(pSandbox); if (WriteConsoleA(pLineBuf->hBackup, pchBuffer, cchToWrite, &cchWritten, NULL /*pvReserved*/)) { if (cchWritten >= cchToWrite) { /* likely */ } else { KU32 off = 0; do { off += cchWritten; cchWritten = 0; } while ( off < cchToWrite && WriteConsoleA(pLineBuf->hBackup, &pchBuffer[off], cchToWrite - off, &cchWritten, NULL)); } } } if (pwcBufFree) kHlpFree(pwcBufFree); } /** Kernel32 - WriteConsoleA */ BOOL WINAPI kwSandbox_Kernel32_WriteConsoleA(HANDLE hConOutput, CONST VOID *pvBuffer, DWORD cbToWrite, PDWORD pcbWritten, PVOID pvReserved) { BOOL fRc; PKWOUTPUTSTREAMBUF pLineBuf; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); if (hConOutput == g_Sandbox.StdErr.hOutput) pLineBuf = &g_Sandbox.StdErr; else pLineBuf = &g_Sandbox.StdOut; if (pLineBuf->fIsConsole) { kwSandboxConsoleWriteA(&g_Sandbox, pLineBuf, (char const *)pvBuffer, cbToWrite); KWOUT_LOG(("WriteConsoleA: %p, %p LB %#x (%*.*s), %p, %p -> TRUE [cached]\n", hConOutput, pvBuffer, cbToWrite, cbToWrite, cbToWrite, pvBuffer, pcbWritten, pvReserved)); if (pcbWritten) *pcbWritten = cbToWrite; fRc = TRUE; } else { fRc = WriteConsoleA(hConOutput, pvBuffer, cbToWrite, pcbWritten, pvReserved); KWOUT_LOG(("WriteConsoleA: %p, %p LB %#x (%*.*s), %p, %p -> %d !fallback!\n", hConOutput, pvBuffer, cbToWrite, cbToWrite, cbToWrite, pvBuffer, pcbWritten, pvReserved, fRc)); } return fRc; } /** Kernel32 - WriteConsoleW */ BOOL WINAPI kwSandbox_Kernel32_WriteConsoleW(HANDLE hConOutput, CONST VOID *pvBuffer, DWORD cwcToWrite, PDWORD pcwcWritten, PVOID pvReserved) { BOOL fRc; PKWOUTPUTSTREAMBUF pLineBuf; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); if (hConOutput == g_Sandbox.StdErr.hOutput) pLineBuf = &g_Sandbox.StdErr; else if (hConOutput == g_Sandbox.StdOut.hOutput) pLineBuf = &g_Sandbox.StdOut; else pLineBuf = g_Sandbox.StdErr.fIsConsole ? &g_Sandbox.StdErr : &g_Sandbox.StdOut; if (pLineBuf->fIsConsole) { kwSandboxConsoleWriteW(&g_Sandbox, pLineBuf, (wchar_t const *)pvBuffer, cwcToWrite); KWOUT_LOG(("WriteConsoleW: %p, %p LB %#x (%*.*ls), %p, %p -> TRUE [cached]\n", hConOutput, pvBuffer, cwcToWrite, cwcToWrite, cwcToWrite, pvBuffer, pcwcWritten, pvReserved)); if (pcwcWritten) *pcwcWritten = cwcToWrite; fRc = TRUE; } else { fRc = WriteConsoleW(hConOutput, pvBuffer, cwcToWrite, pcwcWritten, pvReserved); KWOUT_LOG(("WriteConsoleW: %p, %p LB %#x (%*.*ls), %p, %p -> %d !fallback!\n", hConOutput, pvBuffer, cwcToWrite, cwcToWrite, cwcToWrite, pvBuffer, pcwcWritten, pvReserved, fRc)); } return fRc; } #endif /* WITH_CONSOLE_OUTPUT_BUFFERING */ /* * * Virtual memory leak prevension. * Virtual memory leak prevension. * Virtual memory leak prevension. * */ #ifdef WITH_FIXED_VIRTUAL_ALLOCS /** For debug logging. */ # ifndef NDEBUG static void kwSandboxLogFixedAllocation(KU32 idxFixed, const char *pszWhere) { MEMORY_BASIC_INFORMATION MemInfo = { NULL, NULL, 0, 0, 0, 0, 0}; SIZE_T cbMemInfo = VirtualQuery(g_aFixedVirtualAllocs[idxFixed].pvReserved, &MemInfo, sizeof(MemInfo)); kHlpAssert(cbMemInfo == sizeof(MemInfo)); if (cbMemInfo != 0) KW_LOG(("%s: #%u %p LB %#x: base=%p alloc=%p region=%#x state=%#x prot=%#x type=%#x\n", pszWhere, idxFixed, g_aFixedVirtualAllocs[idxFixed].pvReserved, g_aFixedVirtualAllocs[idxFixed].cbFixed, MemInfo.BaseAddress, MemInfo.AllocationBase, MemInfo.RegionSize, MemInfo.State, MemInfo.Protect, MemInfo.Type)); } # else # define kwSandboxLogFixedAllocation(idxFixed, pszWhere) do { } while (0) # endif /** * Used by both kwSandbox_Kernel32_VirtualFree and kwSandboxCleanupLate * * @param idxFixed The fixed allocation index to "free". */ static void kwSandboxResetFixedAllocation(KU32 idxFixed) { BOOL fRc; kwSandboxLogFixedAllocation(idxFixed, "kwSandboxResetFixedAllocation[pre]"); fRc = VirtualFree(g_aFixedVirtualAllocs[idxFixed].pvReserved, g_aFixedVirtualAllocs[idxFixed].cbFixed, MEM_DECOMMIT); kHlpAssert(fRc); K_NOREF(fRc); kwSandboxLogFixedAllocation(idxFixed, "kwSandboxResetFixedAllocation[pst]"); g_aFixedVirtualAllocs[idxFixed].fInUse = K_FALSE; } #endif /* WITH_FIXED_VIRTUAL_ALLOCS */ /** Kernel32 - VirtualAlloc - for managing cl.exe / c1[xx].dll heap with fixed * location (~78MB in 32-bit 2010 compiler). */ static PVOID WINAPI kwSandbox_Kernel32_VirtualAlloc(PVOID pvAddr, SIZE_T cb, DWORD fAllocType, DWORD fProt) { PVOID pvMem; if (g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_CL) { KU32 idxPreAllocated = KU32_MAX; #ifdef WITH_FIXED_VIRTUAL_ALLOCS /* * Look for a pre-reserved CL.exe heap allocation. */ pvMem = NULL; if ( pvAddr != 0 && (fAllocType & MEM_RESERVE)) { KU32 idxFixed = K_ELEMENTS(g_aFixedVirtualAllocs); kHlpAssert(!(fAllocType & ~(MEM_RESERVE | MEM_TOP_DOWN))); while (idxFixed-- > 0) if ( g_aFixedVirtualAllocs[idxFixed].uFixed == (KUPTR)pvAddr && g_aFixedVirtualAllocs[idxFixed].pvReserved) { if (g_aFixedVirtualAllocs[idxFixed].cbFixed >= cb) { if (!g_aFixedVirtualAllocs[idxFixed].fInUse) { g_aFixedVirtualAllocs[idxFixed].fInUse = K_TRUE; pvMem = pvAddr; idxPreAllocated = idxFixed; KW_LOG(("VirtualAlloc: pvAddr=%p cb=%p type=%#x prot=%#x -> %p [pre allocated]\n", pvAddr, cb, fAllocType, fProt, pvMem)); kwSandboxLogFixedAllocation(idxFixed, "kwSandbox_Kernel32_VirtualAlloc"); SetLastError(NO_ERROR); break; } kwErrPrintf("VirtualAlloc: Fixed allocation at %p is already in use!\n", pvAddr); } else kwErrPrintf("VirtualAlloc: Fixed allocation at %p LB %#x not large enough: %#x\n", pvAddr, g_aFixedVirtualAllocs[idxFixed].cbFixed, cb); } } if (!pvMem) #endif { pvMem = VirtualAlloc(pvAddr, cb, fAllocType, fProt); KW_LOG(("VirtualAlloc: pvAddr=%p cb=%p type=%#x prot=%#x -> %p (last=%d)\n", pvAddr, cb, fAllocType, fProt, pvMem, GetLastError())); if ( pvAddr && pvAddr != pvMem && !( fAllocType == MEM_RESERVE /* After mapping the PCH, VS2019 ends up here (happens */ && fProt == PAGE_READWRITE /* in real cl.exe runs too). Just shut it up to avoid confusion. */ #if K_ARCH_BITS >= 64 && cb > 0x10000000 /* seen 67c00000, 33e00000, ++ */ #else && cb > 0x04000000 /* no idea */ #endif ) ) kwErrPrintf("VirtualAlloc %p LB %#x (%#x,%#x) failed: %p / %u\n", pvAddr, cb, fAllocType, fProt, pvMem, GetLastError()); } if (pvMem) { /* * Track it. */ PKWVIRTALLOC pTracker; EnterCriticalSection(&g_Sandbox.VirtualAllocLock); pTracker = g_Sandbox.pVirtualAllocHead; while ( pTracker && (KUPTR)pvMem - (KUPTR)pTracker->pvAlloc >= pTracker->cbAlloc) pTracker = pTracker->pNext; LeaveCriticalSection(&g_Sandbox.VirtualAllocLock); if (!pTracker) { DWORD dwErr = GetLastError(); PKWVIRTALLOC pTracker = (PKWVIRTALLOC)kHlpAlloc(sizeof(*pTracker)); if (pTracker) { pTracker->pvAlloc = pvMem; pTracker->cbAlloc = cb; pTracker->idxPreAllocated = idxPreAllocated; EnterCriticalSection(&g_Sandbox.VirtualAllocLock); pTracker->pNext = g_Sandbox.pVirtualAllocHead; g_Sandbox.pVirtualAllocHead = pTracker; LeaveCriticalSection(&g_Sandbox.VirtualAllocLock); } SetLastError(dwErr); } } } else pvMem = VirtualAlloc(pvAddr, cb, fAllocType, fProt); KW_LOG(("VirtualAlloc: pvAddr=%p cb=%p type=%#x prot=%#x -> %p (last=%d)\n", pvAddr, cb, fAllocType, fProt, pvMem, GetLastError())); return pvMem; } /** Kernel32 - VirtualFree. */ static BOOL WINAPI kwSandbox_Kernel32_VirtualFree(PVOID pvAddr, SIZE_T cb, DWORD dwFreeType) { BOOL fRc; if (g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_CL) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); if (dwFreeType & MEM_RELEASE) { PKWVIRTALLOC pTracker; EnterCriticalSection(&g_Sandbox.VirtualAllocLock); pTracker = g_Sandbox.pVirtualAllocHead; if (pTracker) { if (pTracker->pvAlloc == pvAddr) g_Sandbox.pVirtualAllocHead = pTracker->pNext; else { PKWVIRTALLOC pPrev; do { pPrev = pTracker; pTracker = pTracker->pNext; } while (pTracker && pTracker->pvAlloc != pvAddr); if (pTracker) pPrev->pNext = pTracker->pNext; } if (pTracker) { #ifdef WITH_FIXED_VIRTUAL_ALLOCS if (pTracker->idxPreAllocated != KU32_MAX) { kwSandboxResetFixedAllocation(pTracker->idxPreAllocated); LeaveCriticalSection(&g_Sandbox.VirtualAllocLock); KW_LOG(("VirtualFree: pvAddr=%p cb=%p type=%#x -> TRUE [pre allocated #%u]\n", pvAddr, cb, dwFreeType, pTracker->idxPreAllocated)); kHlpFree(pTracker); return TRUE; } #endif fRc = VirtualFree(pvAddr, cb, dwFreeType); if (fRc) kHlpFree(pTracker); else { pTracker->pNext = g_Sandbox.pVirtualAllocHead; g_Sandbox.pVirtualAllocHead = pTracker; } LeaveCriticalSection(&g_Sandbox.VirtualAllocLock); KW_LOG(("VirtualFree: pvAddr=%p cb=%p type=%#x -> %d\n", pvAddr, cb, dwFreeType, fRc)); return fRc; } KW_LOG(("VirtualFree: pvAddr=%p not found!\n", pvAddr)); } LeaveCriticalSection(&g_Sandbox.VirtualAllocLock); } } #ifdef WITH_FIXED_VIRTUAL_ALLOCS /* * Protect our fixed allocations (this isn't just paranoia, btw.). */ if (dwFreeType & MEM_RELEASE) { KU32 idxFixed = K_ELEMENTS(g_aFixedVirtualAllocs); while (idxFixed-- > 0) if (g_aFixedVirtualAllocs[idxFixed].pvReserved == pvAddr) { KW_LOG(("VirtualFree: Damn it! Don't free g_aFixedVirtualAllocs[#%u]: %p LB %#x\n", idxFixed, g_aFixedVirtualAllocs[idxFixed].pvReserved, g_aFixedVirtualAllocs[idxFixed].cbFixed)); return TRUE; } } #endif /* * Not tracker or not actually free the virtual range. */ fRc = VirtualFree(pvAddr, cb, dwFreeType); KW_LOG(("VirtualFree: pvAddr=%p cb=%p type=%#x -> %d\n", pvAddr, cb, dwFreeType, fRc)); return fRc; } /** Kernel32 - HeapCreate / NtDll - RTlCreateHeap */ HANDLE WINAPI kwSandbox_Kernel32_HeapCreate(DWORD fOptions, SIZE_T cbInitial, SIZE_T cbMax) { HANDLE hHeap; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); hHeap = HeapCreate(fOptions, cbInitial, cbMax); if (hHeap != NULL) { DWORD dwErr = GetLastError(); PKWHEAP pTracker = (PKWHEAP)kHlpAlloc(sizeof(*pTracker)); if (pTracker) { pTracker->hHeap = hHeap; pTracker->pNext = g_Sandbox.pHeapHead; g_Sandbox.pHeapHead = pTracker; } SetLastError(dwErr); } return hHeap; } /** Kernel32 - HeapDestroy / NtDll - RTlDestroyHeap */ BOOL WINAPI kwSandbox_Kernel32_HeapDestroy(HANDLE hHeap) { BOOL fRc = HeapDestroy(hHeap); KW_LOG(("HeapDestroy: hHeap=%p -> %d\n", hHeap, fRc)); kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); if (fRc) { PKWHEAP pTracker = g_Sandbox.pHeapHead; if (pTracker) { if (pTracker->hHeap == hHeap) g_Sandbox.pHeapHead = pTracker->pNext; else { PKWHEAP pPrev; do { pPrev = pTracker; pTracker = pTracker->pNext; } while (pTracker && pTracker->hHeap == hHeap); if (pTracker) pPrev->pNext = pTracker->pNext; } if (pTracker) kHlpFree(pTracker); else KW_LOG(("HeapDestroy: pvAddr=%p not found!\n", hHeap)); } } return fRc; } /* * * Thread/Fiber local storage leak prevention. * Thread/Fiber local storage leak prevention. * Thread/Fiber local storage leak prevention. * * Note! The FlsAlloc/Free & TlsAlloc/Free causes problems for statically * linked VS2010 code like VBoxBs3ObjConverter.exe. One thing is that * we're leaking these indexes, but more importantely we crash during * worker exit since the callback is triggered multiple times. */ /** Kernel32 - FlsAlloc */ DWORD WINAPI kwSandbox_Kernel32_FlsAlloc(PFLS_CALLBACK_FUNCTION pfnCallback) { DWORD idxFls = FlsAlloc(pfnCallback); KW_LOG(("FlsAlloc(%p) -> %#x\n", pfnCallback, idxFls)); if (idxFls != FLS_OUT_OF_INDEXES) { PKWLOCALSTORAGE pTracker = (PKWLOCALSTORAGE)kHlpAlloc(sizeof(*pTracker)); if (pTracker) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pTracker->idx = idxFls; pTracker->pNext = g_Sandbox.pFlsAllocHead; g_Sandbox.pFlsAllocHead = pTracker; } } return idxFls; } /** Kernel32 - FlsFree */ BOOL WINAPI kwSandbox_Kernel32_FlsFree(DWORD idxFls) { BOOL fRc = FlsFree(idxFls); KW_LOG(("FlsFree(%#x) -> %d\n", idxFls, fRc)); if (fRc) { PKWLOCALSTORAGE pTracker; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pTracker = g_Sandbox.pFlsAllocHead; if (pTracker) { if (pTracker->idx == idxFls) g_Sandbox.pFlsAllocHead = pTracker->pNext; else { PKWLOCALSTORAGE pPrev; do { pPrev = pTracker; pTracker = pTracker->pNext; } while (pTracker && pTracker->idx != idxFls); if (pTracker) pPrev->pNext = pTracker->pNext; } if (pTracker) { pTracker->idx = FLS_OUT_OF_INDEXES; pTracker->pNext = NULL; kHlpFree(pTracker); } } } return fRc; } /** Kernel32 - TlsAlloc */ DWORD WINAPI kwSandbox_Kernel32_TlsAlloc(VOID) { DWORD idxTls = TlsAlloc(); KW_LOG(("TlsAlloc() -> %#x\n", idxTls)); if (idxTls != TLS_OUT_OF_INDEXES) { PKWLOCALSTORAGE pTracker = (PKWLOCALSTORAGE)kHlpAlloc(sizeof(*pTracker)); if (pTracker) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pTracker->idx = idxTls; pTracker->pNext = g_Sandbox.pTlsAllocHead; g_Sandbox.pTlsAllocHead = pTracker; } } return idxTls; } /** Kernel32 - TlsFree */ BOOL WINAPI kwSandbox_Kernel32_TlsFree(DWORD idxTls) { BOOL fRc = TlsFree(idxTls); KW_LOG(("TlsFree(%#x) -> %d\n", idxTls, fRc)); if (fRc) { PKWLOCALSTORAGE pTracker; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pTracker = g_Sandbox.pTlsAllocHead; if (pTracker) { if (pTracker->idx == idxTls) g_Sandbox.pTlsAllocHead = pTracker->pNext; else { PKWLOCALSTORAGE pPrev; do { pPrev = pTracker; pTracker = pTracker->pNext; } while (pTracker && pTracker->idx != idxTls); if (pTracker) pPrev->pNext = pTracker->pNext; } if (pTracker) { pTracker->idx = TLS_OUT_OF_INDEXES; pTracker->pNext = NULL; kHlpFree(pTracker); } } } return fRc; } /* * * Header file hashing. * Header file hashing. * Header file hashing. * * c1.dll / c1XX.dll hashes the input files. The Visual C++ 2010 profiler * indicated that ~12% of the time was spent doing MD5 caluclation when * rebuiling openssl. The hashing it done right after reading the source * via ReadFile, same buffers and sizes. */ #ifdef WITH_HASH_CACHE /** * Gets our crypto provider context/instance, creating it if needed. */ static HCRYPTPROV kwSandboxGetCryptoProvider(ALG_ID idAlg) { DWORD dwProvider; HCRYPTPROV *phCryptProv; HCRYPTPROV hCryptProv; if ( idAlg == CALG_SHA_256 || idAlg == CALG_SHA_512) { phCryptProv = &g_Sandbox.hCryptProvAes; dwProvider = PROV_RSA_AES; } else { phCryptProv = &g_Sandbox.hCryptProvRsa; dwProvider = PROV_RSA_FULL; } hCryptProv = *phCryptProv; if (hCryptProv) return hCryptProv; /* Create it. */ if (CryptAcquireContextW(&hCryptProv, NULL, NULL, dwProvider, CRYPT_VERIFYCONTEXT)) { kHlpAssert(hCryptProv != 0); kHlpAssert(hCryptProv != KUPTR_MAX); *phCryptProv = hCryptProv; return hCryptProv; } kwErrPrintf("kwSandboxGetCryptoProvider: CryptAcquireContext(,,,%#x, CRYPT_VERIFYCONTEXT) failed! %u\n", dwProvider, GetLastError()); return (HCRYPTPROV)NULL; } /** AdvApi32 - CryptCreateHash */ static BOOL WINAPI kwSandbox_Advapi32_CryptCreateHash(HCRYPTPROV hProv, ALG_ID idAlg, HCRYPTKEY hKey, DWORD dwFlags, HCRYPTHASH *phHash) { BOOL fRc; /* * Only do this for cl.exe when it request normal MD5. */ if (g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_CL) { KU32 cbDigest; const char *pszName; switch (idAlg) { case CALG_MD5: cbDigest = 128/8; pszName = "MD5"; g_cHashesMd5++; break; case CALG_SHA1: cbDigest = 160/8; pszName = "SHA1"; g_cHashesSha1++; break; case CALG_SHA_256: cbDigest = 256/8; pszName = "SHA-256"; g_cHashesSha256++; break; case CALG_SHA_512: cbDigest = 512/8; pszName = "SHA-512"; g_cHashesSha512++; break; default: cbDigest = 0; pszName = NULL; break; } if (cbDigest) { if (hKey == 0) { if (dwFlags == 0) { PKWCRYPTHASH pHash = (PKWCRYPTHASH)kHlpAllocZ(sizeof(*pHash)); if (pHash) { kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); pHash->uMagic = KWCRYPTHASH_MAGIC; pHash->cbHashed = 0; pHash->fGoneBad = K_FALSE; pHash->fFinal = K_FALSE; pHash->hFallback = KUPTR_MAX; pHash->idAlg = idAlg; pHash->pszAlgName = pszName; pHash->cbDigest = cbDigest; /* link it. */ pHash->pNext = g_Sandbox.pHashHead; g_Sandbox.pHashHead = pHash; *phHash = (KUPTR)pHash; KWCRYPT_LOG(("CryptCreateHash(hProv=%p, idAlg=%s, 0, 0, *phHash=%p) -> %d [cached]\n", hProv, pszName, *phHash, TRUE)); return TRUE; } kwErrPrintf("CryptCreateHash: out of memory!\n"); } else kwErrPrintf("CryptCreateHash: dwFlags=%p is not supported with %s\n", hKey, pszName); } else kwErrPrintf("CryptCreateHash: hKey=%p is not supported with %s\n", hKey, pszName); } else kwErrPrintf("CryptCreateHash: idAlg=%#x is not supported\n", idAlg); } /* * Fallback. */ fRc = CryptCreateHash(hProv, idAlg, hKey, dwFlags, phHash); KWCRYPT_LOG(("CryptCreateHash(hProv=%p, idAlg=%#x (%d), hKey=%p, dwFlags=%#x, *phHash=%p) -> %d\n", hProv, idAlg, idAlg, hKey, dwFlags, *phHash, fRc)); return fRc; } /** AdvApi32 - CryptHashData */ static BOOL WINAPI kwSandbox_Advapi32_CryptHashData(HCRYPTHASH hHash, CONST BYTE *pbData, DWORD cbData, DWORD dwFlags) { BOOL fRc; PKWCRYPTHASH pHash = g_Sandbox.pHashHead; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); while (pHash && (KUPTR)pHash != hHash) pHash = pHash->pNext; KWCRYPT_LOG(("CryptHashData(hHash=%p/%p, pbData=%p, cbData=%#x, dwFlags=%#x)\n", hHash, pHash, pbData, cbData, dwFlags)); if (pHash) { /* * Validate the state. */ if ( pHash->uMagic == KWCRYPTHASH_MAGIC && !pHash->fFinal && !pHash->fGoneBad) { if (pHash->hFallback == KUPTR_MAX) { /* * Does this match the previous ReadFile call to a cached file? * If it doesn't, try falling back. */ if ( g_Sandbox.LastHashRead.cbRead == cbData && g_Sandbox.LastHashRead.pvRead == (void *)pbData) { PKFSWCACHEDFILE pCachedFile = g_Sandbox.LastHashRead.pCachedFile; if ( pCachedFile && kHlpMemComp(pbData, &pCachedFile->pbCached[g_Sandbox.LastHashRead.offRead], K_MIN(cbData, 64)) == 0) { if (g_Sandbox.LastHashRead.offRead == pHash->cbHashed) { if ( pHash->pCachedFile == NULL && pHash->cbHashed == 0) pHash->pCachedFile = pCachedFile; if (pHash->pCachedFile == pCachedFile) { pHash->cbHashed += cbData; g_Sandbox.LastHashRead.pCachedFile = NULL; g_Sandbox.LastHashRead.pvRead = NULL; g_Sandbox.LastHashRead.cbRead = 0; g_Sandbox.LastHashRead.offRead = 0; KWCRYPT_LOG(("CryptHashData(hHash=%p/%p/%s, pbData=%p, cbData=%#x, dwFlags=%#x) -> 1 [cached]\n", hHash, pCachedFile, pCachedFile->szPath, pbData, cbData, dwFlags)); return TRUE; } /* Note! it's possible to fall back here too, if necessary. */ kwErrPrintf("CryptHashData: Expected pCachedFile=%p, last read was made to %p!!\n", pHash->pCachedFile, g_Sandbox.LastHashRead.pCachedFile); } else kwErrPrintf("CryptHashData: Expected last read at %#x, instead it was made at %#x\n", pHash->cbHashed, g_Sandbox.LastHashRead.offRead); } else if (!pCachedFile) KWCRYPT_LOG(("CryptHashData: Last pCachedFile is NULL when buffer address and size matches!\n")); else kwErrPrintf("CryptHashData: First 64 bytes of the buffer doesn't match the cache.\n"); } else if (g_Sandbox.LastHashRead.cbRead != 0 && pHash->cbHashed != 0) kwErrPrintf("CryptHashData: Expected cbRead=%#x and pbData=%p, got %#x and %p instead\n", g_Sandbox.LastHashRead.cbRead, g_Sandbox.LastHashRead.pvRead, cbData, pbData); if (pHash->cbHashed == 0) { /* Initiate fallback mode (file that we don't normally cache, like .c/.cpp). */ HCRYPTPROV hCryptProv = kwSandboxGetCryptoProvider(pHash->idAlg); if (hCryptProv) { HCRYPTHASH hCryptHash = KUPTR_MAX; if (CryptCreateHash(hCryptProv, pHash->idAlg, 0, 0, &hCryptHash)) { kHlpAssert(hCryptHash != KUPTR_MAX); pHash->hFallback = hCryptHash; fRc = CryptHashData(hCryptHash, pbData, cbData, dwFlags); if (fRc) pHash->cbHashed = cbData; g_cHashesFallbacks++; KWCRYPT_LOG(("CryptHashData(hHash=%p/fallback, pbData=%p, cbData=%#x, dwFlags=%#x) -> %d (%u) [fallback!]\n", hHash, pbData, cbData, dwFlags, fRc, GetLastError())); } else { kwErrPrintf("kwSandbox_Advapi32_CryptHashData: Fallback CryptCreateHash(%u) failed: %u\n", pHash->idAlg, GetLastError()); fRc = FALSE; } return fRc; } } pHash->fGoneBad = K_TRUE; SetLastError(ERROR_INVALID_PARAMETER); fRc = FALSE; } else { /* fallback. */ fRc = CryptHashData(pHash->hFallback, pbData, cbData, dwFlags); if (fRc) pHash->cbHashed += cbData; KWCRYPT_LOG(("CryptHashData(hHash=%p/fallback, pbData=%p, cbData=%#x, dwFlags=%#x) -> %d [fallback]\n", hHash, pbData, cbData, dwFlags, fRc)); } } /* * Bad handle state. */ else { if (pHash->uMagic != KWCRYPTHASH_MAGIC) kwErrPrintf("CryptHashData: Invalid cached hash handle!!\n"); else kwErrPrintf("CryptHashData: Hash is already finalized!!\n"); SetLastError((DWORD)NTE_BAD_HASH); fRc = FALSE; } } else { fRc = CryptHashData(hHash, pbData, cbData, dwFlags); KWCRYPT_LOG(("CryptHashData(hHash=%p, pbData=%p, cbData=%#x, dwFlags=%#x) -> %d\n", hHash, pbData, cbData, dwFlags, fRc)); } return fRc; } /** Helper for simpe data hashing. */ static BOOL kwSandboxCalcHash(ALG_ID idAlg, void const *pvData, KSIZE cbData, KU8 *pbDigest, KSIZE cbDigest) { BOOL fRet = FALSE; if (idAlg == CALG_MD5) { struct MD5Context Ctx; MD5Init(&Ctx); MD5Update(&Ctx, (unsigned char const *)pvData, (unsigned)cbData); MD5Final(pbDigest, &Ctx); fRet = TRUE; } else { HCRYPTPROV hCryptProv = kwSandboxGetCryptoProvider(idAlg); if (hCryptProv) { HCRYPTHASH hCryptHash = KUPTR_MAX; if (CryptCreateHash(hCryptProv, idAlg, 0, 0, &hCryptHash)) { if (CryptHashData(hCryptHash, (const BYTE *)pvData, (DWORD)cbData, 0)) { DWORD cbActual = (DWORD)cbDigest; if (CryptGetHashParam(hCryptHash, HP_HASHVAL, pbDigest, &cbActual, 0)) { fRet = TRUE; kHlpAssert(cbActual == cbDigest); } else kwErrPrintf("CryptGetHashParam([%#x],HP_HASHVAL,%p,%#x,0) failed: %u\n", idAlg, pbDigest, cbDigest, GetLastError()); } else kwErrPrintf("CryptHashData([%#x],%p,%#x,0) failed: %u\n", idAlg, pvData, cbData, GetLastError()); CryptDestroyHash(hCryptHash); } else kwErrPrintf("CryptCreateHash(%#x) failed: %u\n", idAlg, GetLastError()); } } return fRet; } /** AdvApi32 - CryptGetHashParam */ static BOOL WINAPI kwSandbox_Advapi32_CryptGetHashParam(HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD *pcbData, DWORD dwFlags) { BOOL fRc; PKWCRYPTHASH pHash = g_Sandbox.pHashHead; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); while (pHash && (KUPTR)pHash != hHash) pHash = pHash->pNext; if (pHash) { if (pHash->uMagic == KWCRYPTHASH_MAGIC) { if (dwFlags == 0) { DWORD cbRet; void *pvRet; union { DWORD dw; } uBuf; switch (dwParam) { case HP_HASHVAL: { /* Check the hash progress. */ PKFSWCACHEDFILE pCachedFile = pHash->pCachedFile; g_cHashes++; if (pCachedFile) { if ( pCachedFile->cbCached == pHash->cbHashed && !pHash->fGoneBad) { KBOOL *pfValid; switch (pHash->idAlg) { case CALG_MD5: pfValid = &pCachedFile->fValidMd5; pvRet = pCachedFile->abMd5Digest; break; case CALG_SHA1: pfValid = &pCachedFile->fValidSha1; pvRet = pCachedFile->abSha1Digest; break; case CALG_SHA_256: pfValid = &pCachedFile->fValidSha256; pvRet = pCachedFile->abSha256Digest; break; case CALG_SHA_512: pfValid = &pCachedFile->fValidSha512; pvRet = pCachedFile->abSha512Digest; break; default: kwErrPrintf("Invalid idAlg value: %#x\n", pHash->idAlg); SetLastError(ERROR_INVALID_SERVER_STATE); return FALSE; } if (*pfValid) { KWCRYPT_LOG(("Already calculated hash for %p/%s! [hit]\n", pCachedFile, pCachedFile->szPath)); g_cHashesCached++; } else { fRc = kwSandboxCalcHash(pHash->idAlg, pCachedFile->pbCached, pCachedFile->cbCached, pvRet, pHash->cbDigest); if (!fRc) return FALSE; *pfValid = K_TRUE; KWCRYPT_LOG(("Calculated hash for %p/%s.\n", pCachedFile, pCachedFile->szPath)); } } else { /* This actually happens (iprt/string.h + common/alloc/alloc.cpp), at least from what I can tell, so just deal with it. */ KWCRYPT_LOG(("CryptGetHashParam/HP_HASHVAL: Not at end of cached file! cbCached=%#x cbHashed=%#x fGoneBad=%d (%p/%p/%s)\n", pHash->pCachedFile->cbCached, pHash->cbHashed, pHash->fGoneBad, pHash, pCachedFile, pCachedFile->szPath)); g_cHashesPartial++; pHash->pCachedFile = NULL; pvRet = pHash->abDigest; fRc = kwSandboxCalcHash(pHash->idAlg, pCachedFile->pbCached, pHash->cbHashed, pvRet, pHash->cbDigest); if (!fRc) { pHash->fGoneBad = K_TRUE; return FALSE; } } pHash->fFinal = K_TRUE; cbRet = pHash->cbDigest; break; } pvRet = pHash->abDigest; cbRet = pHash->cbDigest; if (pHash->fFinal) break; if (pHash->hFallback != KUPTR_MAX) { DWORD cbActual = (DWORD)pHash->cbDigest; if (CryptGetHashParam(pHash->hFallback, HP_HASHVAL, pHash->abDigest, &cbActual, 0)) { kHlpAssert(cbActual == pHash->cbDigest); pHash->fFinal = K_TRUE; break; } kwErrPrintf("CryptGetHashParam/HP_HASHVAL: Fallback CryptGetHashParam failed: %u!!\n", GetLastError()); } else { kwErrPrintf("CryptGetHashParam/HP_HASHVAL: pCachedFile is NULL!!\n"); SetLastError(ERROR_INVALID_SERVER_STATE); } return FALSE; } case HP_HASHSIZE: uBuf.dw = pHash->cbDigest; pvRet = &uBuf; cbRet = sizeof(DWORD); break; case HP_ALGID: uBuf.dw = pHash->idAlg; pvRet = &uBuf; cbRet = sizeof(DWORD); break; default: kwErrPrintf("CryptGetHashParam: Unknown dwParam=%#x\n", dwParam); SetLastError((DWORD)NTE_BAD_TYPE); return FALSE; } /* * Copy out cbRet from pvRet. */ if (pbData) { if (*pcbData >= cbRet) { *pcbData = cbRet; kHlpMemCopy(pbData, pvRet, cbRet); if (cbRet == 4) KWCRYPT_LOG(("CryptGetHashParam/%#x/%p/%p: TRUE, cbRet=%#x data=%#x [cached]\n", dwParam, pHash, pHash->pCachedFile, cbRet, (DWORD *)pbData)); else if (cbRet == 16) KWCRYPT_LOG(("CryptGetHashParam/%#x/%p/%p: TRUE, cbRet=%#x data=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x [cached]\n", dwParam, pHash, pHash->pCachedFile, cbRet, pbData[0], pbData[1], pbData[2], pbData[3], pbData[4], pbData[5], pbData[6], pbData[7], pbData[8], pbData[9], pbData[10], pbData[11], pbData[12], pbData[13], pbData[14], pbData[15])); else if (cbRet == 20) KWCRYPT_LOG(("CryptGetHashParam/%#x/%p/%p: TRUE, cbRet=%#x data=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x [cached]\n", dwParam, pHash, pHash->pCachedFile, cbRet, pbData[0], pbData[1], pbData[2], pbData[3], pbData[4], pbData[5], pbData[6], pbData[7], pbData[8], pbData[9], pbData[10], pbData[11], pbData[12], pbData[13], pbData[14], pbData[15], pbData[16], pbData[17], pbData[18], pbData[19] )); else if (cbRet >= 32) KWCRYPT_LOG(("CryptGetHashParam/%#x/%p/%p: TRUE, cbRet=%#x data=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%s [cached]\n", dwParam, pHash, pHash->pCachedFile, cbRet, pbData[0], pbData[1], pbData[2], pbData[3], pbData[4], pbData[5], pbData[6], pbData[7], pbData[8], pbData[9], pbData[10], pbData[11], pbData[12], pbData[13], pbData[14], pbData[15], pbData[16], pbData[17], pbData[18], pbData[19], pbData[20], pbData[21], pbData[22], pbData[23], pbData[24], pbData[25], pbData[26], pbData[27], pbData[28], pbData[29], pbData[30], pbData[31], cbRet > 32 ? "..." : "")); else KWCRYPT_LOG(("CryptGetHashParam/%#x%/p%/%p: TRUE, cbRet=%#x [cached]\n", dwParam, pHash, pHash->pCachedFile, cbRet)); return TRUE; } kHlpMemCopy(pbData, pvRet, *pcbData); } SetLastError(ERROR_MORE_DATA); *pcbData = cbRet; KWCRYPT_LOG(("CryptGetHashParam/%#x: ERROR_MORE_DATA\n")); } else { kwErrPrintf("CryptGetHashParam: dwFlags is not zero: %#x!\n", dwFlags); SetLastError((DWORD)NTE_BAD_FLAGS); } } else { kwErrPrintf("CryptGetHashParam: Invalid cached hash handle!!\n"); SetLastError((DWORD)NTE_BAD_HASH); } fRc = FALSE; } /* * Regular handle. */ else { fRc = CryptGetHashParam(hHash, dwParam, pbData, pcbData, dwFlags); KWCRYPT_LOG(("CryptGetHashParam(hHash=%p, dwParam=%#x (%d), pbData=%p, *pcbData=%#x, dwFlags=%#x) -> %d\n", hHash, dwParam, pbData, *pcbData, dwFlags, fRc)); } return fRc; } /** AdvApi32 - CryptDestroyHash */ static BOOL WINAPI kwSandbox_Advapi32_CryptDestroyHash(HCRYPTHASH hHash) { BOOL fRc; PKWCRYPTHASH pPrev = NULL; PKWCRYPTHASH pHash = g_Sandbox.pHashHead; kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); while (pHash && (KUPTR)pHash != hHash) { pPrev = pHash; pHash = pHash->pNext; } if (pHash) { if (pHash->uMagic == KWCRYPTHASH_MAGIC) { pHash->uMagic = 0; if (!pPrev) g_Sandbox.pHashHead = pHash->pNext; else pPrev->pNext = pHash->pNext; kHlpFree(pHash); KWCRYPT_LOG(("CryptDestroyHash(hHash=%p) -> 1 [cached]\n", hHash)); fRc = TRUE; } else { kwErrPrintf("CryptDestroyHash: Invalid cached hash handle!!\n"); KWCRYPT_LOG(("CryptDestroyHash(hHash=%p) -> FALSE! [cached]\n", hHash)); SetLastError(ERROR_INVALID_HANDLE); fRc = FALSE; } } /* * Regular handle. */ else { fRc = CryptDestroyHash(hHash); KWCRYPT_LOG(("CryptDestroyHash(hHash=%p) -> %d\n", hHash, fRc)); } return fRc; } #endif /* WITH_HASH_CACHE */ /* * * Reuse crypt context. * Reuse crypt context. * Reuse crypt context. * * * This saves a little bit of time and registry accesses each time CL, C1 or C1XX runs. * */ #ifdef WITH_CRYPT_CTX_REUSE /** AdvApi32 - CryptAcquireContextW. */ static BOOL WINAPI kwSandbox_Advapi32_CryptAcquireContextW(HCRYPTPROV *phProv, LPCWSTR pwszContainer, LPCWSTR pwszProvider, DWORD dwProvType, DWORD dwFlags) { BOOL fRet; /* * Lookup reusable context based on the input. */ KSIZE const cwcContainer = pwszContainer ? kwUtf16Len(pwszContainer) : 0; KSIZE const cwcProvider = pwszProvider ? kwUtf16Len(pwszProvider) : 0; KU32 iCtx = g_Sandbox.cCryptCtxs; while (iCtx-- > 0) { if ( g_Sandbox.aCryptCtxs[iCtx].cwcContainer == cwcContainer && g_Sandbox.aCryptCtxs[iCtx].cwcProvider == cwcProvider && g_Sandbox.aCryptCtxs[iCtx].dwProvType == dwProvType && g_Sandbox.aCryptCtxs[iCtx].dwFlags == dwFlags && kHlpMemComp(g_Sandbox.aCryptCtxs[iCtx].pwszContainer, pwszContainer, cwcContainer * sizeof(wchar_t)) == 0 && kHlpMemComp(g_Sandbox.aCryptCtxs[iCtx].pwszProvider, pwszProvider, cwcProvider * sizeof(wchar_t)) == 0) { if (CryptContextAddRef(g_Sandbox.aCryptCtxs[iCtx].hProv, NULL, 0)) { *phProv = g_Sandbox.aCryptCtxs[iCtx].hProv; KWCRYPT_LOG(("CryptAcquireContextW(,%ls, %ls, %#x, %#x) -> TRUE, %p [reused]\n", pwszContainer, pwszProvider, dwProvType, dwFlags, *phProv)); return TRUE; } } } /* * Create it and enter it into the reused array if possible. */ fRet = CryptAcquireContextW(phProv, pwszContainer, pwszProvider, dwProvType, dwFlags); if (fRet) { iCtx = g_Sandbox.cCryptCtxs; if (iCtx < K_ELEMENTS(g_Sandbox.aCryptCtxs)) { /* Try duplicate the input strings. */ g_Sandbox.aCryptCtxs[iCtx].pwszContainer = kHlpDup(pwszContainer ? pwszContainer : L"", (cwcContainer + 1) * sizeof(wchar_t)); if (g_Sandbox.aCryptCtxs[iCtx].pwszContainer) { g_Sandbox.aCryptCtxs[iCtx].pwszProvider = kHlpDup(pwszProvider ? pwszProvider : L"", (cwcProvider + 1) * sizeof(wchar_t)); if (g_Sandbox.aCryptCtxs[iCtx].pwszProvider) { /* Add a couple of references just to be on the safe side and all that. */ HCRYPTPROV hProv = *phProv; if (CryptContextAddRef(hProv, NULL, 0)) { if (CryptContextAddRef(hProv, NULL, 0)) { /* Okay, finish the entry and return success */ g_Sandbox.aCryptCtxs[iCtx].hProv = hProv; g_Sandbox.aCryptCtxs[iCtx].dwProvType = dwProvType; g_Sandbox.aCryptCtxs[iCtx].dwFlags = dwFlags; g_Sandbox.cCryptCtxs = iCtx + 1; KWCRYPT_LOG(("CryptAcquireContextW(,%ls, %ls, %#x, %#x) -> TRUE, %p [new]\n", pwszContainer, pwszProvider, dwProvType, dwFlags, *phProv)); return TRUE; } CryptReleaseContext(hProv, 0); } KWCRYPT_LOG(("CryptAcquireContextW: CryptContextAddRef failed!\n")); kHlpFree(g_Sandbox.aCryptCtxs[iCtx].pwszProvider); g_Sandbox.aCryptCtxs[iCtx].pwszProvider = NULL; } kHlpFree(g_Sandbox.aCryptCtxs[iCtx].pwszContainer); g_Sandbox.aCryptCtxs[iCtx].pwszContainer = NULL; } } else KWCRYPT_LOG(("CryptAcquireContextW: Too many crypt contexts to keep and reuse!\n")); } KWCRYPT_LOG(("CryptAcquireContextW(,%ls, %ls, %#x, %#x) -> %d, %p\n", pwszContainer, pwszProvider, dwProvType, dwFlags, *phProv)); return fRet; } /** AdvApi32 - CryptReleaseContext */ static BOOL WINAPI kwSandbox_Advapi32_CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags) { BOOL fRet = CryptReleaseContext(hProv, dwFlags); KWCRYPT_LOG(("CryptReleaseContext(%p,%#x) -> %d\n", hProv, dwFlags, fRet)); return fRet; } /** AdvApi32 - CryptContextAddRef */ static BOOL WINAPI kwSandbox_Advapi32_CryptContextAddRef(HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags) { BOOL fRet = CryptContextAddRef(hProv, pdwReserved, dwFlags); KWCRYPT_LOG(("CryptContextAddRef(%p,%p,%#x) -> %d\n", hProv, pdwReserved, dwFlags, fRet)); return fRet; } #endif /* WITH_CRYPT_CTX_REUSE */ /* * * Structured exception handling. * Structured exception handling. * Structured exception handling. * */ #if defined(KBUILD_OS_WINDOWS) && defined(KBUILD_ARCH_X86) # define EH_NONCONTINUABLE KU32_C(0x00000001) # define EH_UNWINDING KU32_C(0x00000002) # define EH_EXIT_UNWIND KU32_C(0x00000004) # define EH_STACK_INVALID KU32_C(0x00000008) # define EH_NESTED_CALL KU32_C(0x00000010) typedef KU32 (__cdecl * volatile PFNXCPTHANDLER)(PEXCEPTION_RECORD, struct _EXCEPTION_REGISTRATION_RECORD*, PCONTEXT, struct _EXCEPTION_REGISTRATION_RECORD * volatile *); typedef struct _EXCEPTION_REGISTRATION_RECORD { struct _EXCEPTION_REGISTRATION_RECORD * volatile pPrevRegRec; PFNXCPTHANDLER pfnXcptHandler; }; /** * Calls @a pfnHandler. */ static KU32 kwSandboxXcptCallHandler(PEXCEPTION_RECORD pXcptRec, struct _EXCEPTION_REGISTRATION_RECORD *pRegRec, PCONTEXT pXcptCtx, struct _EXCEPTION_REGISTRATION_RECORD * volatile * ppRegRec, PFNXCPTHANDLER pfnHandler) { # if 1 /* This is a more robust version that isn't subject to calling convension cleanup disputes and such. */ KU32 uSavedEdi; KU32 uSavedEsi; KU32 uSavedEbx; KU32 rcHandler; __asm { mov [uSavedEdi], edi mov [uSavedEsi], esi mov [uSavedEbx], ebx mov esi, esp mov edi, esp mov edi, [pXcptRec] mov edx, [pRegRec] mov eax, [pXcptCtx] mov ebx, [ppRegRec] mov ecx, [pfnHandler] sub esp, 16 and esp, 0fffffff0h mov [esp ], edi mov [esp + 4], edx mov [esp + 8], eax mov [esp + 12], ebx mov edi, esi call ecx mov esp, esi cmp esp, edi je stack_ok int 3 stack_ok: mov edi, [uSavedEdi] mov esi, [uSavedEsi] mov ebx, [uSavedEbx] mov [rcHandler], eax } return rcHandler; # else return pfnHandler(pXcptRec, pRegRec, pXctpCtx, ppRegRec); # endif } /** * Vectored exception handler that emulates x86 chained exception handler. * * This is necessary because the RtlIsValidHandler check fails for self loaded * code and prevents cl.exe from working. (On AMD64 we can register function * tables, but on X86 cooking your own handling seems to be the only viabke * alternative.) * * @returns EXCEPTION_CONTINUE_SEARCH or EXCEPTION_CONTINUE_EXECUTION. * @param pXcptPtrs The exception details. */ static LONG CALLBACK kwSandboxVecXcptEmulateChained(PEXCEPTION_POINTERS pXcptPtrs) { PNT_TIB pTib = (PNT_TIB)NtCurrentTeb(); KW_LOG(("kwSandboxVecXcptEmulateChained: %#x\n", pXcptPtrs->ExceptionRecord->ExceptionCode)); if (g_Sandbox.fRunning) { HANDLE const hCurProc = GetCurrentProcess(); PEXCEPTION_RECORD pXcptRec = pXcptPtrs->ExceptionRecord; PCONTEXT pXcptCtx = pXcptPtrs->ContextRecord; struct _EXCEPTION_REGISTRATION_RECORD * pRegRec = pTib->ExceptionList; while (((KUPTR)pRegRec & (sizeof(void *) - 3)) == 0 && pRegRec != NULL) { /* Read the exception record in a safe manner. */ struct _EXCEPTION_REGISTRATION_RECORD RegRec; DWORD cbActuallyRead = 0; if ( ReadProcessMemory(hCurProc, pRegRec, &RegRec, sizeof(RegRec), &cbActuallyRead) && cbActuallyRead == sizeof(RegRec)) { struct _EXCEPTION_REGISTRATION_RECORD * volatile pDispRegRec = NULL; KU32 rcHandler; KW_LOG(("kwSandboxVecXcptEmulateChained: calling %p, pRegRec=%p, pPrevRegRec=%p\n", RegRec.pfnXcptHandler, pRegRec, RegRec.pPrevRegRec)); rcHandler = kwSandboxXcptCallHandler(pXcptRec, pRegRec, pXcptCtx, &pDispRegRec, RegRec.pfnXcptHandler); KW_LOG(("kwSandboxVecXcptEmulateChained: rcHandler=%#x pDispRegRec=%p\n", rcHandler, pDispRegRec)); if (rcHandler == ExceptionContinueExecution) { kHlpAssert(!(pXcptPtrs->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)); KW_LOG(("kwSandboxVecXcptEmulateChained: returning EXCEPTION_CONTINUE_EXECUTION!\n")); return EXCEPTION_CONTINUE_EXECUTION; } if (rcHandler == ExceptionContinueSearch) kHlpAssert(!(pXcptPtrs->ExceptionRecord->ExceptionFlags & 8 /*EXCEPTION_STACK_INVALID*/)); else if (rcHandler == ExceptionNestedException) kHlpAssertMsgFailed(("Nested exceptions.\n")); else kHlpAssertMsgFailed(("Invalid return %#x (%d).\n", rcHandler, rcHandler)); } else { KW_LOG(("kwSandboxVecXcptEmulateChained: Bad xcpt chain entry at %p! Stopping search.\n", pRegRec)); break; } /* * Next. */ pRegRec = RegRec.pPrevRegRec; } } return EXCEPTION_CONTINUE_SEARCH; } /** NtDll,Kernel32 - RtlUnwind */ static VOID WINAPI kwSandbox_ntdll_RtlUnwind(struct _EXCEPTION_REGISTRATION_RECORD *pStopXcptRec, PVOID pvTargetIp, PEXCEPTION_RECORD pXcptRec, PVOID pvReturnValue) { PNT_TIB pTib = (PNT_TIB)NtCurrentTeb(); KW_LOG(("kwSandbox_ntdll_RtlUnwind: pStopXcptRec=%p pvTargetIp=%p pXctpRec=%p pvReturnValue=%p%s\n", pStopXcptRec, pvTargetIp, pXcptRec, pvReturnValue, g_Sandbox.fRunning ? "" : " [sandbox not running]")); if (g_Sandbox.fRunning) { HANDLE const hCurProc = GetCurrentProcess(); PCONTEXT pXcptCtx = NULL; struct _EXCEPTION_REGISTRATION_RECORD * pRegRec = pTib->ExceptionList; /* * Update / create an exception record. */ if (pXcptRec) pXcptRec->ExceptionFlags |= EH_UNWINDING; else { pXcptRec = (PEXCEPTION_RECORD)alloca(sizeof(*pXcptRec)); kHlpMemSet(pXcptRec, 0, sizeof(*pXcptRec)); pXcptRec->ExceptionCode = (DWORD)STATUS_UNWIND; pXcptRec->ExceptionFlags = EH_UNWINDING; } if (!pStopXcptRec) pXcptRec->ExceptionFlags |= EH_EXIT_UNWIND; /* * Walk the chain till we find pStopXctpRec. */ while ( ((KUPTR)pRegRec & (sizeof(void *) - 3)) == 0 && pRegRec != NULL && pRegRec != pStopXcptRec) { /* Read the exception record in a safe manner. */ struct _EXCEPTION_REGISTRATION_RECORD RegRec; DWORD cbActuallyRead = 0; if ( ReadProcessMemory(hCurProc, pRegRec, &RegRec, sizeof(RegRec), &cbActuallyRead) && cbActuallyRead == sizeof(RegRec)) { struct _EXCEPTION_REGISTRATION_RECORD * volatile pDispRegRec = NULL; KU32 rcHandler; KW_LOG(("kwSandbox_ntdll_RtlUnwind: calling %p, pRegRec=%p, pPrevRegRec=%p\n", RegRec.pfnXcptHandler, pRegRec, RegRec.pPrevRegRec)); rcHandler = kwSandboxXcptCallHandler(pXcptRec, pRegRec, pXcptCtx, &pDispRegRec, RegRec.pfnXcptHandler); KW_LOG(("kwSandbox_ntdll_RtlUnwind: rcHandler=%#x pDispRegRec=%p\n", rcHandler, pDispRegRec)); if (rcHandler == ExceptionContinueSearch) kHlpAssert(!(pXcptRec->ExceptionFlags & 8 /*EXCEPTION_STACK_INVALID*/)); else if (rcHandler == ExceptionCollidedUnwind) kHlpAssertMsgFailed(("Implement collided unwind!\n")); else kHlpAssertMsgFailed(("Invalid return %#x (%d).\n", rcHandler, rcHandler)); } else { KW_LOG(("kwSandbox_ntdll_RtlUnwind: Bad xcpt chain entry at %p! Stopping search.\n", pRegRec)); break; } /* * Pop next. */ pTib->ExceptionList = RegRec.pPrevRegRec; pRegRec = RegRec.pPrevRegRec; } return; } RtlUnwind(pStopXcptRec, pvTargetIp, pXcptRec, pvReturnValue); } #endif /* WINDOWS + X86 */ /* * * Misc function only intercepted while debugging. * Misc function only intercepted while debugging. * Misc function only intercepted while debugging. * */ #ifndef NDEBUG /** CRT - memcpy */ static void * __cdecl kwSandbox_msvcrt_memcpy(void *pvDst, void const *pvSrc, size_t cb) { KU8 const *pbSrc = (KU8 const *)pvSrc; KU8 *pbDst = (KU8 *)pvDst; KSIZE cbLeft = cb; while (cbLeft-- > 0) *pbDst++ = *pbSrc++; return pvDst; } /** CRT - memset */ static void * __cdecl kwSandbox_msvcrt_memset(void *pvDst, int bFiller, size_t cb) { KU8 *pbDst = (KU8 *)pvDst; KSIZE cbLeft = cb; while (cbLeft-- > 0) *pbDst++ = (KU8)bFiller; return pvDst; } #endif /* NDEBUG */ /** @todo consider hooking NtQueryDirectoryFile as c1xx.dll/c1.dll in 2019 * uses it directly to read the content of include directories, however * they do it one file at the time. We already have the info in the * cache (where we do bulk reads). There are a lot of calls for the * SDK include directories, as one can imagine. */ /** * Functions that needs replacing for sandboxed execution. */ KWREPLACEMENTFUNCTION const g_aSandboxReplacements[] = { /* * Kernel32.dll and friends. */ { TUPLE("ExitProcess"), NULL, (KUPTR)kwSandbox_Kernel32_ExitProcess }, { TUPLE("TerminateProcess"), NULL, (KUPTR)kwSandbox_Kernel32_TerminateProcess }, { TUPLE("LoadLibraryA"), NULL, (KUPTR)kwSandbox_Kernel32_LoadLibraryA }, { TUPLE("LoadLibraryW"), NULL, (KUPTR)kwSandbox_Kernel32_LoadLibraryW }, { TUPLE("LoadLibraryExA"), NULL, (KUPTR)kwSandbox_Kernel32_LoadLibraryExA }, { TUPLE("LoadLibraryExW"), NULL, (KUPTR)kwSandbox_Kernel32_LoadLibraryExW }, { TUPLE("FreeLibrary"), NULL, (KUPTR)kwSandbox_Kernel32_FreeLibrary }, { TUPLE("GetModuleHandleA"), NULL, (KUPTR)kwSandbox_Kernel32_GetModuleHandleA }, { TUPLE("GetModuleHandleW"), NULL, (KUPTR)kwSandbox_Kernel32_GetModuleHandleW }, { TUPLE("GetProcAddress"), NULL, (KUPTR)kwSandbox_Kernel32_GetProcAddress }, { TUPLE("GetModuleFileNameA"), NULL, (KUPTR)kwSandbox_Kernel32_GetModuleFileNameA }, { TUPLE("GetModuleFileNameW"), NULL, (KUPTR)kwSandbox_Kernel32_GetModuleFileNameW }, { TUPLE("RtlPcToFileHeader"), NULL, (KUPTR)kwSandbox_ntdll_RtlPcToFileHeader }, { TUPLE("GetCommandLineA"), NULL, (KUPTR)kwSandbox_Kernel32_GetCommandLineA }, { TUPLE("GetCommandLineW"), NULL, (KUPTR)kwSandbox_Kernel32_GetCommandLineW }, { TUPLE("GetStartupInfoA"), NULL, (KUPTR)kwSandbox_Kernel32_GetStartupInfoA }, { TUPLE("GetStartupInfoW"), NULL, (KUPTR)kwSandbox_Kernel32_GetStartupInfoW }, { TUPLE("CreateThread"), NULL, (KUPTR)kwSandbox_Kernel32_CreateThread }, { TUPLE("GetEnvironmentStrings"), NULL, (KUPTR)kwSandbox_Kernel32_GetEnvironmentStrings }, { TUPLE("GetEnvironmentStringsA"), NULL, (KUPTR)kwSandbox_Kernel32_GetEnvironmentStringsA }, { TUPLE("GetEnvironmentStringsW"), NULL, (KUPTR)kwSandbox_Kernel32_GetEnvironmentStringsW }, { TUPLE("FreeEnvironmentStringsA"), NULL, (KUPTR)kwSandbox_Kernel32_FreeEnvironmentStringsA }, { TUPLE("FreeEnvironmentStringsW"), NULL, (KUPTR)kwSandbox_Kernel32_FreeEnvironmentStringsW }, { TUPLE("GetEnvironmentVariableA"), NULL, (KUPTR)kwSandbox_Kernel32_GetEnvironmentVariableA }, { TUPLE("GetEnvironmentVariableW"), NULL, (KUPTR)kwSandbox_Kernel32_GetEnvironmentVariableW }, { TUPLE("SetEnvironmentVariableA"), NULL, (KUPTR)kwSandbox_Kernel32_SetEnvironmentVariableA }, { TUPLE("SetEnvironmentVariableW"), NULL, (KUPTR)kwSandbox_Kernel32_SetEnvironmentVariableW }, { TUPLE("ExpandEnvironmentStringsA"), NULL, (KUPTR)kwSandbox_Kernel32_ExpandEnvironmentStringsA }, { TUPLE("ExpandEnvironmentStringsW"), NULL, (KUPTR)kwSandbox_Kernel32_ExpandEnvironmentStringsW }, { TUPLE("CreateFileA"), NULL, (KUPTR)kwSandbox_Kernel32_CreateFileA }, { TUPLE("CreateFileW"), NULL, (KUPTR)kwSandbox_Kernel32_CreateFileW }, { TUPLE("ReadFile"), NULL, (KUPTR)kwSandbox_Kernel32_ReadFile }, { TUPLE("ReadFileEx"), NULL, (KUPTR)kwSandbox_Kernel32_ReadFileEx }, #ifdef WITH_TEMP_MEMORY_FILES { TUPLE("WriteFile"), NULL, (KUPTR)kwSandbox_Kernel32_WriteFile }, { TUPLE("WriteFileEx"), NULL, (KUPTR)kwSandbox_Kernel32_WriteFileEx }, { TUPLE("SetEndOfFile"), NULL, (KUPTR)kwSandbox_Kernel32_SetEndOfFile }, { TUPLE("GetFileType"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileType }, { TUPLE("GetFileSize"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileSize }, { TUPLE("GetFileSizeEx"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileSizeEx }, { TUPLE("CreateFileMappingW"), NULL, (KUPTR)kwSandbox_Kernel32_CreateFileMappingW }, { TUPLE("MapViewOfFile"), NULL, (KUPTR)kwSandbox_Kernel32_MapViewOfFile }, { TUPLE("MapViewOfFileEx"), NULL, (KUPTR)kwSandbox_Kernel32_MapViewOfFileEx }, { TUPLE("UnmapViewOfFile"), NULL, (KUPTR)kwSandbox_Kernel32_UnmapViewOfFile }, #endif { TUPLE("SetFilePointer"), NULL, (KUPTR)kwSandbox_Kernel32_SetFilePointer }, { TUPLE("SetFilePointerEx"), NULL, (KUPTR)kwSandbox_Kernel32_SetFilePointerEx }, { TUPLE("DuplicateHandle"), NULL, (KUPTR)kwSandbox_Kernel32_DuplicateHandle }, { TUPLE("CloseHandle"), NULL, (KUPTR)kwSandbox_Kernel32_CloseHandle }, { TUPLE("GetFileAttributesA"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileAttributesA }, { TUPLE("GetFileAttributesW"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileAttributesW }, { TUPLE("GetFileAttributesExA"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileAttributesExA }, { TUPLE("GetFileAttributesExW"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileAttributesExW }, { TUPLE("GetShortPathNameW"), NULL, (KUPTR)kwSandbox_Kernel32_GetShortPathNameW }, #ifdef WITH_TEMP_MEMORY_FILES { TUPLE("DeleteFileW"), NULL, (KUPTR)kwSandbox_Kernel32_DeleteFileW }, #endif #ifdef WITH_CONSOLE_OUTPUT_BUFFERING { TUPLE("WriteConsoleA"), NULL, (KUPTR)kwSandbox_Kernel32_WriteConsoleA }, { TUPLE("WriteConsoleW"), NULL, (KUPTR)kwSandbox_Kernel32_WriteConsoleW }, #endif { TUPLE("VirtualAlloc"), NULL, (KUPTR)kwSandbox_Kernel32_VirtualAlloc }, { TUPLE("VirtualFree"), NULL, (KUPTR)kwSandbox_Kernel32_VirtualFree }, { TUPLE("HeapCreate"), NULL, (KUPTR)kwSandbox_Kernel32_HeapCreate, K_TRUE /*fOnlyExe*/ }, { TUPLE("HeapDestroy"), NULL, (KUPTR)kwSandbox_Kernel32_HeapDestroy, K_TRUE /*fOnlyExe*/ }, { TUPLE("FlsAlloc"), NULL, (KUPTR)kwSandbox_Kernel32_FlsAlloc, K_TRUE /*fOnlyExe*/ }, { TUPLE("FlsFree"), NULL, (KUPTR)kwSandbox_Kernel32_FlsFree, K_TRUE /*fOnlyExe*/ }, { TUPLE("TlsAlloc"), NULL, (KUPTR)kwSandbox_Kernel32_TlsAlloc, K_TRUE /*fOnlyExe*/ }, { TUPLE("TlsFree"), NULL, (KUPTR)kwSandbox_Kernel32_TlsFree, K_TRUE /*fOnlyExe*/ }, { TUPLE("SetConsoleCtrlHandler"), NULL, (KUPTR)kwSandbox_Kernel32_SetConsoleCtrlHandler }, #if defined(KBUILD_OS_WINDOWS) && defined(KBUILD_ARCH_X86) { TUPLE("RtlUnwind"), NULL, (KUPTR)kwSandbox_ntdll_RtlUnwind }, #endif #ifdef WITH_HASH_CACHE { TUPLE("CryptCreateHash"), NULL, (KUPTR)kwSandbox_Advapi32_CryptCreateHash }, { TUPLE("CryptHashData"), NULL, (KUPTR)kwSandbox_Advapi32_CryptHashData }, { TUPLE("CryptGetHashParam"), NULL, (KUPTR)kwSandbox_Advapi32_CryptGetHashParam }, { TUPLE("CryptDestroyHash"), NULL, (KUPTR)kwSandbox_Advapi32_CryptDestroyHash }, #endif #ifdef WITH_CRYPT_CTX_REUSE { TUPLE("CryptAcquireContextW"), NULL, (KUPTR)kwSandbox_Advapi32_CryptAcquireContextW }, { TUPLE("CryptReleaseContext"), NULL, (KUPTR)kwSandbox_Advapi32_CryptReleaseContext }, { TUPLE("CryptContextAddRef"), NULL, (KUPTR)kwSandbox_Advapi32_CryptContextAddRef }, #endif /* * MS Visual C++ CRTs. */ { TUPLE("exit"), NULL, (KUPTR)kwSandbox_msvcrt_exit }, { TUPLE("_exit"), NULL, (KUPTR)kwSandbox_msvcrt__exit }, { TUPLE("_cexit"), NULL, (KUPTR)kwSandbox_msvcrt__cexit }, { TUPLE("_c_exit"), NULL, (KUPTR)kwSandbox_msvcrt__c_exit }, { TUPLE("_amsg_exit"), NULL, (KUPTR)kwSandbox_msvcrt__amsg_exit }, { TUPLE("terminate"), NULL, (KUPTR)kwSandbox_msvcrt_terminate }, { TUPLE("onexit"), NULL, (KUPTR)kwSandbox_msvcrt__onexit, K_TRUE /*fOnlyExe*/ }, { TUPLE("_onexit"), NULL, (KUPTR)kwSandbox_msvcrt__onexit, K_TRUE /*fOnlyExe*/ }, { TUPLE("atexit"), NULL, (KUPTR)kwSandbox_msvcrt_atexit, K_TRUE /*fOnlyExe*/ }, { TUPLE("_beginthread"), NULL, (KUPTR)kwSandbox_msvcrt__beginthread }, { TUPLE("_beginthreadex"), NULL, (KUPTR)kwSandbox_msvcrt__beginthreadex, K_FALSE /*fOnlyExe*/, K_TRUE /*fCrtSlotArray*/ }, { TUPLE("_beginthreadex"), "msvcr120.dll", (KUPTR)kwSandbox_msvcr120__beginthreadex }, /* higher priority last */ { TUPLE("__argc"), NULL, (KUPTR)&g_Sandbox.cArgs }, { TUPLE("__argv"), NULL, (KUPTR)&g_Sandbox.papszArgs }, { TUPLE("__wargv"), NULL, (KUPTR)&g_Sandbox.papwszArgs }, { TUPLE("__p___argc"), NULL, (KUPTR)kwSandbox_msvcrt___p___argc }, { TUPLE("__p___argv"), NULL, (KUPTR)kwSandbox_msvcrt___p___argv }, { TUPLE("__p___wargv"), NULL, (KUPTR)kwSandbox_msvcrt___p___wargv }, { TUPLE("_acmdln"), NULL, (KUPTR)&g_Sandbox.pszCmdLine }, { TUPLE("_wcmdln"), NULL, (KUPTR)&g_Sandbox.pwszCmdLine }, { TUPLE("__p__acmdln"), NULL, (KUPTR)kwSandbox_msvcrt___p__acmdln }, { TUPLE("__p__wcmdln"), NULL, (KUPTR)kwSandbox_msvcrt___p__wcmdln }, { TUPLE("_pgmptr"), NULL, (KUPTR)&g_Sandbox.pgmptr }, { TUPLE("_wpgmptr"), NULL, (KUPTR)&g_Sandbox.wpgmptr }, { TUPLE("_get_pgmptr"), NULL, (KUPTR)kwSandbox_msvcrt__get_pgmptr }, { TUPLE("_get_wpgmptr"), NULL, (KUPTR)kwSandbox_msvcrt__get_wpgmptr }, { TUPLE("__p__pgmptr"), NULL, (KUPTR)kwSandbox_msvcrt___p__pgmptr }, { TUPLE("__p__wpgmptr"), NULL, (KUPTR)kwSandbox_msvcrt___p__wpgmptr }, { TUPLE("_wincmdln"), NULL, (KUPTR)kwSandbox_msvcrt__wincmdln }, { TUPLE("_wwincmdln"), NULL, (KUPTR)kwSandbox_msvcrt__wwincmdln }, { TUPLE("__getmainargs"), NULL, (KUPTR)kwSandbox_msvcrt___getmainargs}, { TUPLE("__wgetmainargs"), NULL, (KUPTR)kwSandbox_msvcrt___wgetmainargs}, { TUPLE("_putenv"), NULL, (KUPTR)kwSandbox_msvcrt__putenv}, { TUPLE("_wputenv"), NULL, (KUPTR)kwSandbox_msvcrt__wputenv}, { TUPLE("_putenv_s"), NULL, (KUPTR)kwSandbox_msvcrt__putenv_s}, { TUPLE("_wputenv_s"), NULL, (KUPTR)kwSandbox_msvcrt__wputenv_s}, { TUPLE("__initenv"), NULL, (KUPTR)&g_Sandbox.initenv }, { TUPLE("__winitenv"), NULL, (KUPTR)&g_Sandbox.winitenv }, { TUPLE("__p___initenv"), NULL, (KUPTR)kwSandbox_msvcrt___p___initenv}, { TUPLE("__p___winitenv"), NULL, (KUPTR)kwSandbox_msvcrt___p___winitenv}, { TUPLE("_environ"), NULL, (KUPTR)&g_Sandbox.environ }, { TUPLE("_wenviron"), NULL, (KUPTR)&g_Sandbox.wenviron }, { TUPLE("_get_environ"), NULL, (KUPTR)kwSandbox_msvcrt__get_environ }, { TUPLE("_get_wenviron"), NULL, (KUPTR)kwSandbox_msvcrt__get_wenviron }, { TUPLE("__p__environ"), NULL, (KUPTR)kwSandbox_msvcrt___p__environ }, { TUPLE("__p__wenviron"), NULL, (KUPTR)kwSandbox_msvcrt___p__wenviron }, #ifndef NDEBUG { TUPLE("memcpy"), NULL, (KUPTR)kwSandbox_msvcrt_memcpy }, { TUPLE("memset"), NULL, (KUPTR)kwSandbox_msvcrt_memset }, #endif }; /** Number of entries in g_aReplacements. */ KU32 const g_cSandboxReplacements = K_ELEMENTS(g_aSandboxReplacements); /** * Functions that needs replacing in natively loaded DLLs when doing sandboxed * execution. */ KWREPLACEMENTFUNCTION const g_aSandboxNativeReplacements[] = { /* * Kernel32.dll and friends. */ { TUPLE("ExitProcess"), NULL, (KUPTR)kwSandbox_Kernel32_ExitProcess }, { TUPLE("TerminateProcess"), NULL, (KUPTR)kwSandbox_Kernel32_TerminateProcess }, { TUPLE("GetCommandLineA"), NULL, (KUPTR)kwSandbox_Kernel32_GetCommandLineA }, { TUPLE("GetCommandLineW"), NULL, (KUPTR)kwSandbox_Kernel32_GetCommandLineW }, #if 0 { TUPLE("CreateThread"), NULL, (KUPTR)kwSandbox_Kernel32_CreateThread }, #endif { TUPLE("CreateFileA"), NULL, (KUPTR)kwSandbox_Kernel32_CreateFileA }, { TUPLE("CreateFileW"), NULL, (KUPTR)kwSandbox_Kernel32_CreateFileW }, { TUPLE("ReadFile"), NULL, (KUPTR)kwSandbox_Kernel32_ReadFile }, { TUPLE("ReadFileEx"), NULL, (KUPTR)kwSandbox_Kernel32_ReadFileEx }, #ifdef WITH_TEMP_MEMORY_FILES { TUPLE("WriteFile"), NULL, (KUPTR)kwSandbox_Kernel32_WriteFile }, { TUPLE("WriteFileEx"), NULL, (KUPTR)kwSandbox_Kernel32_WriteFileEx }, { TUPLE("SetEndOfFile"), NULL, (KUPTR)kwSandbox_Kernel32_SetEndOfFile }, { TUPLE("GetFileType"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileType }, { TUPLE("GetFileSize"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileSize }, { TUPLE("GetFileSizeEx"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileSizeEx }, { TUPLE("CreateFileMappingW"), NULL, (KUPTR)kwSandbox_Kernel32_CreateFileMappingW }, { TUPLE("MapViewOfFile"), NULL, (KUPTR)kwSandbox_Kernel32_MapViewOfFile }, { TUPLE("MapViewOfFileEx"), NULL, (KUPTR)kwSandbox_Kernel32_MapViewOfFileEx }, { TUPLE("UnmapViewOfFile"), NULL, (KUPTR)kwSandbox_Kernel32_UnmapViewOfFile }, #endif { TUPLE("SetFilePointer"), NULL, (KUPTR)kwSandbox_Kernel32_SetFilePointer }, { TUPLE("SetFilePointerEx"), NULL, (KUPTR)kwSandbox_Kernel32_SetFilePointerEx }, { TUPLE("DuplicateHandle"), NULL, (KUPTR)kwSandbox_Kernel32_DuplicateHandle }, { TUPLE("CloseHandle"), NULL, (KUPTR)kwSandbox_Kernel32_CloseHandle }, { TUPLE("GetFileAttributesA"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileAttributesA }, { TUPLE("GetFileAttributesW"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileAttributesW }, { TUPLE("GetFileAttributesExA"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileAttributesExA }, { TUPLE("GetFileAttributesExW"), NULL, (KUPTR)kwSandbox_Kernel32_GetFileAttributesExW }, { TUPLE("GetShortPathNameW"), NULL, (KUPTR)kwSandbox_Kernel32_GetShortPathNameW }, #ifdef WITH_TEMP_MEMORY_FILES { TUPLE("DeleteFileW"), NULL, (KUPTR)kwSandbox_Kernel32_DeleteFileW }, #endif { TUPLE("SetConsoleCtrlHandler"), NULL, (KUPTR)kwSandbox_Kernel32_SetConsoleCtrlHandler }, { TUPLE("LoadLibraryExA"), NULL, (KUPTR)kwSandbox_Kernel32_Native_LoadLibraryExA }, { TUPLE("LoadLibraryExW"), NULL, (KUPTR)kwSandbox_Kernel32_Native_LoadLibraryExW }, #ifndef NDEBUG { TUPLE("GetProcAddress"), NULL, (KUPTR)kwSandbox_Kernel32_Native_GetProcAddress }, #endif #ifdef WITH_CONSOLE_OUTPUT_BUFFERING { TUPLE("WriteConsoleA"), NULL, (KUPTR)kwSandbox_Kernel32_WriteConsoleA }, { TUPLE("WriteConsoleW"), NULL, (KUPTR)kwSandbox_Kernel32_WriteConsoleW }, #endif #ifdef WITH_HASH_CACHE { TUPLE("CryptCreateHash"), NULL, (KUPTR)kwSandbox_Advapi32_CryptCreateHash }, { TUPLE("CryptHashData"), NULL, (KUPTR)kwSandbox_Advapi32_CryptHashData }, { TUPLE("CryptGetHashParam"), NULL, (KUPTR)kwSandbox_Advapi32_CryptGetHashParam }, { TUPLE("CryptDestroyHash"), NULL, (KUPTR)kwSandbox_Advapi32_CryptDestroyHash }, #endif { TUPLE("RtlPcToFileHeader"), NULL, (KUPTR)kwSandbox_ntdll_RtlPcToFileHeader }, #if defined(KBUILD_OS_WINDOWS) && defined(KBUILD_ARCH_X86) { TUPLE("RtlUnwind"), NULL, (KUPTR)kwSandbox_ntdll_RtlUnwind }, #endif /* * MS Visual C++ CRTs. */ { TUPLE("exit"), NULL, (KUPTR)kwSandbox_msvcrt_exit }, { TUPLE("_exit"), NULL, (KUPTR)kwSandbox_msvcrt__exit }, { TUPLE("_cexit"), NULL, (KUPTR)kwSandbox_msvcrt__cexit }, { TUPLE("_c_exit"), NULL, (KUPTR)kwSandbox_msvcrt__c_exit }, { TUPLE("_amsg_exit"), NULL, (KUPTR)kwSandbox_msvcrt__amsg_exit }, { TUPLE("terminate"), NULL, (KUPTR)kwSandbox_msvcrt_terminate }, { TUPLE("_wdupenv_s"), NULL, (KUPTR)kwSandbox_msvcrt__wdupenv_s, K_FALSE /*fOnlyExe*/, K_TRUE /*fCrtSlotArray*/ }, #if 0 /* used by mspdbXXX.dll */ { TUPLE("_beginthread"), NULL, (KUPTR)kwSandbox_msvcrt__beginthread }, { TUPLE("_beginthreadex"), NULL, (KUPTR)kwSandbox_msvcrt__beginthreadex }, #endif }; /** Number of entries in g_aSandboxNativeReplacements. */ KU32 const g_cSandboxNativeReplacements = K_ELEMENTS(g_aSandboxNativeReplacements); /** * Functions that needs replacing when queried by GetProcAddress. */ KWREPLACEMENTFUNCTION const g_aSandboxGetProcReplacements[] = { /* * Kernel32.dll and friends. */ { TUPLE("FlsAlloc"), NULL, (KUPTR)kwSandbox_Kernel32_FlsAlloc, K_TRUE /*fOnlyExe*/ }, { TUPLE("FlsFree"), NULL, (KUPTR)kwSandbox_Kernel32_FlsFree, K_TRUE /*fOnlyExe*/ }, { TUPLE("TlsAlloc"), NULL, (KUPTR)kwSandbox_Kernel32_TlsAlloc, K_TRUE /*fOnlyExe*/ }, { TUPLE("TlsFree"), NULL, (KUPTR)kwSandbox_Kernel32_TlsFree, K_TRUE /*fOnlyExe*/ }, }; /** Number of entries in g_aSandboxGetProcReplacements. */ KU32 const g_cSandboxGetProcReplacements = K_ELEMENTS(g_aSandboxGetProcReplacements); /** * Control handler. * * @returns TRUE if handled, FALSE if not. * @param dwCtrlType The signal. */ static BOOL WINAPI kwSandboxCtrlHandler(DWORD dwCtrlType) { DWORD cbIgn; int volatile rc; /* volatile for debugging */ int volatile rcPrev; const char *pszMsg; switch (dwCtrlType) { case CTRL_C_EVENT: rc = 9; pszMsg = "kWorker: Ctrl-C\r\n"; break; case CTRL_BREAK_EVENT: rc = 10; pszMsg = "kWorker: Ctrl-Break\r\n"; break; case CTRL_CLOSE_EVENT: rc = 11; pszMsg = "kWorker: console closed\r\n"; break; case CTRL_LOGOFF_EVENT: rc = 11; pszMsg = "kWorker: logoff event\r\n"; break; case CTRL_SHUTDOWN_EVENT: rc = 11; pszMsg = "kWorker: shutdown event\r\n"; break; default: fprintf(stderr, "kwSandboxCtrlHandler: %#x\n", dwCtrlType); return TRUE; } /* * Terminate the process after 5 seconds. * If we get here a second time we just terminate the process ourselves. * * Note! We do no try call exit() here as it turned out to deadlock a lot * flusing file descriptors (stderr back when we first wrote to it). */ rcPrev = g_rcCtrlC; g_rcCtrlC = rc; WriteFile(GetStdHandle(STD_ERROR_HANDLE), pszMsg, (DWORD)strlen(pszMsg), &cbIgn, NULL); if (rcPrev == 0) { int i; for (i = 0; i < 10; i++) { CancelIoEx(g_hPipe, NULL); /* wake up idle main thread */ Sleep(500); } } TerminateProcess(GetCurrentProcess(), rc); return TRUE; } #if 0 /** * Resets the KWMODULE::fVisited flag for _all_ known modules. */ static void kwSandboxResetModuleVisited(void) { PKWMODULE pMod = g_pModuleHead; while (pMod) { pMod->fVisited = K_FALSE; pMod = pMod->pNextList; } } /** * Used by kwSandboxExec to reset the state of the module tree. * * This is done recursively. * * @param pMod The root of the tree to consider. */ static void kwSandboxResetModuleState(PKWMODULE pMod) { KWLDR_LOG(("kwSandboxResetModuleState: %d %d %s\n", pMod->fNative, pMod->fVisited, pMod->pszPath)); if (!pMod->fNative) { pMod->u.Manual.enmState = KWMODSTATE_NEEDS_BITS; if (!pMod->fVisited) /* Avoid loops. */ { KSIZE iImp; pMod->fVisited = K_TRUE; iImp = pMod->u.Manual.cImpMods; while (iImp-- > 0) kwSandboxResetModuleState(pMod->u.Manual.apImpMods[iImp]); } } /* Hack: Re-init mspdbXXX.dll when we want to use a different mspdbsrv.exe instance. */ else if (pMod->fReInitOnMsPdbSrvEndpointChange) { const char *pszValue = kwSandboxDoGetEnvA(&g_Sandbox, TUPLE("_MSPDBSRV_ENDPOINT_")); if (pMod->fReInitOnMsPdbSrvEndpointChange == 1) { pMod->fReInitOnMsPdbSrvEndpointChange = 2; pMod->pszMsPdbSrvEndpoint = pszValue ? kHlpStrDup(pszValue) : NULL; KWLDR_LOG(("Not re-initing '%s': first time used (_MSPDBSRV_ENDPOINT_ is '%s')\n", pMod->pszPath, pszValue ? pszValue : "<null>")); } else if ( (pszValue == NULL && pMod->pszMsPdbSrvEndpoint == NULL) || (pszValue != NULL && pMod->pszMsPdbSrvEndpoint != NULL && kHlpStrComp(pszValue, pMod->pszMsPdbSrvEndpoint) == 0)) KWLDR_LOG(("Not re-initing '%s': _MSPDBSRV_ENDPOINT_ unchanged ('%s')\n", pMod->pszPath, pszValue ? pszValue : "<null>")); else { KWLDR_LOG(("Re-initing '%s': _MSPDBSRV_ENDPOINT_ changed from '%s' to '%s'\n", pMod->pszPath, pMod->pszMsPdbSrvEndpoint ? pMod->pszMsPdbSrvEndpoint : "<null>", pszValue ? pszValue : "<null>")); kHlpFree(pMod->pszMsPdbSrvEndpoint); if (pszValue != NULL) pMod->pszMsPdbSrvEndpoint = kHlpStrDup(pszValue); else pMod->pszMsPdbSrvEndpoint = NULL; pMod->fNeedReInit = K_TRUE; } } } #else /** * Used by kwSandboxExec to reset the state of the module tree. */ static void kwSandboxResetModuleState(void) { PKWMODULE pMod = g_pModuleHead; while (pMod) { if (!pMod->fNative) pMod->u.Manual.enmState = K_MIN(pMod->u.Manual.enmReInitState, pMod->u.Manual.enmState); /* Hack: Re-init mspdbXXX.dll when we want to use a different mspdbsrv.exe instance. */ else if ( pMod->fReInitOnMsPdbSrvEndpointChange && ( g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_CL || g_Sandbox.pTool->u.Sandboxed.enmHint == KWTOOLHINT_VISUAL_CPP_LINK)) { const char *pszValue = kwSandboxDoGetEnvA(&g_Sandbox, TUPLE("_MSPDBSRV_ENDPOINT_")); if (pMod->fReInitOnMsPdbSrvEndpointChange == 1) { pMod->fReInitOnMsPdbSrvEndpointChange = 2; pMod->pszMsPdbSrvEndpoint = pszValue ? kHlpStrDup(pszValue) : NULL; KWLDR_LOG(("Not re-initing '%s': first time used (_MSPDBSRV_ENDPOINT_ is '%s')\n", pMod->pszPath, pszValue ? pszValue : "<null>")); } else if ( (pszValue == NULL && pMod->pszMsPdbSrvEndpoint == NULL) || (pszValue != NULL && pMod->pszMsPdbSrvEndpoint != NULL && kHlpStrComp(pszValue, pMod->pszMsPdbSrvEndpoint) == 0)) KWLDR_LOG(("Not re-initing '%s': _MSPDBSRV_ENDPOINT_ unchanged ('%s')\n", pMod->pszPath, pszValue ? pszValue : "<null>")); else { KWLDR_LOG(("Re-initing '%s': _MSPDBSRV_ENDPOINT_ changed from '%s' to '%s'\n", pMod->pszPath, pMod->pszMsPdbSrvEndpoint ? pMod->pszMsPdbSrvEndpoint : "<null>", pszValue ? pszValue : "<null>")); kHlpFree(pMod->pszMsPdbSrvEndpoint); if (pszValue != NULL) pMod->pszMsPdbSrvEndpoint = kHlpStrDup(pszValue); else pMod->pszMsPdbSrvEndpoint = NULL; pMod->fNeedReInit = K_TRUE; } } pMod = pMod->pNextList; } } #endif static PPEB kwSandboxGetProcessEnvironmentBlock(void) { #if K_ARCH == K_ARCH_X86_32 return (PPEB)__readfsdword(0x030 /* offset of ProcessEnvironmentBlock in TEB */); #elif K_ARCH == K_ARCH_AMD64 return (PPEB)__readgsqword(0x060 /* offset of ProcessEnvironmentBlock in TEB */); #else # error "Port me!" #endif } /** * Enters the given handle into the handle table. * * @returns K_TRUE on success, K_FALSE on failure. * @param pSandbox The sandbox. * @param pHandle The handle. * @param hHandle The handle value to enter it under (for the * duplicate handle API). */ static KBOOL kwSandboxHandleTableEnter(PKWSANDBOX pSandbox, PKWHANDLE pHandle, HANDLE hHandle) { KUPTR const idxHandle = KW_HANDLE_TO_INDEX(hHandle); kHlpAssertReturn(idxHandle < KW_HANDLE_MAX, K_FALSE); EnterCriticalSection(&g_Sandbox.HandlesLock); /* * Grow handle table. */ if (idxHandle >= pSandbox->cHandles) { void *pvNew; KU32 cHandles = pSandbox->cHandles ? pSandbox->cHandles * 2 : 32; while (cHandles <= idxHandle) cHandles *= 2; pvNew = kHlpRealloc(pSandbox->papHandles, cHandles * sizeof(pSandbox->papHandles[0])); if (!pvNew) { LeaveCriticalSection(&g_Sandbox.HandlesLock); KW_LOG(("Out of memory growing handle table to %u handles\n", cHandles)); return K_FALSE; } pSandbox->papHandles = (PKWHANDLE *)pvNew; kHlpMemSet(&pSandbox->papHandles[pSandbox->cHandles], 0, (cHandles - pSandbox->cHandles) * sizeof(pSandbox->papHandles[0])); pSandbox->cHandles = cHandles; } /* * Check that the entry is unused then insert it. */ kHlpAssertStmtReturn(pSandbox->papHandles[idxHandle] == NULL, LeaveCriticalSection(&g_Sandbox.HandlesLock), K_FALSE); pSandbox->papHandles[idxHandle] = pHandle; pSandbox->cActiveHandles++; LeaveCriticalSection(&g_Sandbox.HandlesLock); return K_TRUE; } /** * Safely looks up a handle, does not get it and it must not be 'put'. * * @returns Pointer to the handle structure if found, otherwise NULL. * @param hFile The handle to resolve. */ static PKWHANDLE kwSandboxHandleLookup(HANDLE hFile) { KUPTR const idxHandle = KW_HANDLE_TO_INDEX(hFile); EnterCriticalSection(&g_Sandbox.HandlesLock); if (idxHandle < g_Sandbox.cHandles) { PKWHANDLE pHandle = g_Sandbox.papHandles[idxHandle]; LeaveCriticalSection(&g_Sandbox.HandlesLock); return pHandle; } LeaveCriticalSection(&g_Sandbox.HandlesLock); return NULL; } /** * Safely gets a handle, must be "put" when done with it. * * @returns Pointer to the handle structure if found, otherwise NULL. * @param hFile The handle to resolve. */ static PKWHANDLE kwSandboxHandleGet(HANDLE hFile) { KUPTR const idxHandle = KW_HANDLE_TO_INDEX(hFile); EnterCriticalSection(&g_Sandbox.HandlesLock); if (idxHandle < g_Sandbox.cHandles) { PKWHANDLE pHandle = g_Sandbox.papHandles[idxHandle]; if (pHandle) { kHlpAssertMsg(pHandle->tidOwner == KU32_MAX, ("hFile=%p tidOwner=%#x\n", hFile, pHandle->tidOwner)); pHandle->tidOwner = GetCurrentThreadId(); LeaveCriticalSection(&g_Sandbox.HandlesLock); return pHandle; } } LeaveCriticalSection(&g_Sandbox.HandlesLock); return NULL; } /** * Puts a handle returned by kwSandboxHandleGet. * * @param pHandle The handle to "put". */ K_INLINE void kwSandboxHandlePut(PKWHANDLE pHandle) { kHlpAssertMsg(pHandle->tidOwner == GetCurrentThreadId(), ("hFile tidOwner=%#x tidMe=%#x\n", pHandle->hHandle, pHandle->tidOwner, GetCurrentThreadId())); pHandle->tidOwner = KU32_MAX; } /** * Creates a correctly quoted ANSI command line string from the given argv. * * @returns Pointer to the command line. * @param cArgs Number of arguments. * @param papszArgs The argument vector. * @param fWatcomBrainDamange Whether to apply watcom rules while quoting. * @param pcbCmdLine Where to return the command line length, * including one terminator. */ static char *kwSandboxInitCmdLineFromArgv(KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange, KSIZE *pcbCmdLine) { KU32 i; KSIZE cbCmdLine; char *pszCmdLine; /* Make a copy of the argument vector that we'll be quoting. */ char **papszQuotedArgs = alloca(sizeof(papszArgs[0]) * (cArgs + 1)); kHlpMemCopy(papszQuotedArgs, papszArgs, sizeof(papszArgs[0]) * (cArgs + 1)); /* Quote the arguments that need it. */ quote_argv(cArgs, papszQuotedArgs, fWatcomBrainDamange, 0 /*leak*/); /* figure out cmd line length. */ cbCmdLine = 0; for (i = 0; i < cArgs; i++) cbCmdLine += kHlpStrLen(papszQuotedArgs[i]) + 1; *pcbCmdLine = cbCmdLine; pszCmdLine = (char *)kHlpAlloc(cbCmdLine + 1); if (pszCmdLine) { char *psz = kHlpStrPCopy(pszCmdLine, papszQuotedArgs[0]); if (papszQuotedArgs[0] != papszArgs[0]) free(papszQuotedArgs[0]); for (i = 1; i < cArgs; i++) { *psz++ = ' '; psz = kHlpStrPCopy(psz, papszQuotedArgs[i]); if (papszQuotedArgs[i] != papszArgs[i]) free(papszQuotedArgs[i]); } kHlpAssert((KSIZE)(&psz[1] - pszCmdLine) == cbCmdLine); *psz++ = '\0'; *psz++ = '\0'; } return pszCmdLine; } static int kwSandboxInit(PKWSANDBOX pSandbox, PKWTOOL pTool, KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange, KU32 cEnvVars, const char **papszEnvVars, KBOOL fNoPchCaching) { PPEB pPeb = kwSandboxGetProcessEnvironmentBlock(); PMY_RTL_USER_PROCESS_PARAMETERS pProcParams = (PMY_RTL_USER_PROCESS_PARAMETERS)pPeb->ProcessParameters; wchar_t *pwcPool; KSIZE cbStrings; KSIZE cwc; KSIZE cbCmdLine; KU32 i; /* Simple stuff. */ pSandbox->rcExitCode = 256; pSandbox->pTool = pTool; pSandbox->idMainThread = GetCurrentThreadId(); pSandbox->pgmptr = (char *)pTool->pszPath; pSandbox->wpgmptr = (wchar_t *)pTool->pwszPath; #ifdef WITH_CONSOLE_OUTPUT_BUFFERING if (pSandbox->StdOut.fIsConsole) pSandbox->StdOut.u.Con.cwcBuf = 0; else pSandbox->StdOut.u.Fully.cchBuf = 0; if (pSandbox->StdErr.fIsConsole) pSandbox->StdErr.u.Con.cwcBuf = 0; else pSandbox->StdErr.u.Fully.cchBuf = 0; pSandbox->Combined.cwcBuf = 0; pSandbox->Combined.cFlushes = 0; #endif pSandbox->fNoPchCaching = fNoPchCaching; pSandbox->cArgs = cArgs; pSandbox->papszArgs = (char **)papszArgs; pSandbox->pszCmdLine = kwSandboxInitCmdLineFromArgv(cArgs, papszArgs, fWatcomBrainDamange, &cbCmdLine); if (!pSandbox->pszCmdLine) return KERR_NO_MEMORY; /* * Convert command line and argv to UTF-16. * We assume each ANSI char requires a surrogate pair in the UTF-16 variant. */ pSandbox->papwszArgs = (wchar_t **)kHlpAlloc(sizeof(wchar_t *) * (pSandbox->cArgs + 2) + cbCmdLine * 2 * sizeof(wchar_t)); if (!pSandbox->papwszArgs) return KERR_NO_MEMORY; pwcPool = (wchar_t *)&pSandbox->papwszArgs[pSandbox->cArgs + 2]; for (i = 0; i < cArgs; i++) { *pwcPool++ = pSandbox->papszArgs[i][-1]; /* flags */ pSandbox->papwszArgs[i] = pwcPool; pwcPool += kwStrToUtf16(pSandbox->papszArgs[i], pwcPool, (kHlpStrLen(pSandbox->papszArgs[i]) + 1) * 2); pwcPool++; } pSandbox->papwszArgs[pSandbox->cArgs + 0] = NULL; pSandbox->papwszArgs[pSandbox->cArgs + 1] = NULL; /* * Convert the commandline string to UTF-16, same pessimistic approach as above. */ cbStrings = (cbCmdLine + 1) * 2 * sizeof(wchar_t); pSandbox->pwszCmdLine = kHlpAlloc(cbStrings); if (!pSandbox->pwszCmdLine) return KERR_NO_MEMORY; cwc = kwStrToUtf16(pSandbox->pszCmdLine, pSandbox->pwszCmdLine, cbStrings / sizeof(wchar_t)); pSandbox->SavedCommandLine = pProcParams->CommandLine; pProcParams->CommandLine.Buffer = pSandbox->pwszCmdLine; pProcParams->CommandLine.Length = (USHORT)cwc * sizeof(wchar_t); /* * Setup the environment. */ if ( cEnvVars + 2 <= pSandbox->cEnvVarsAllocated || kwSandboxGrowEnv(pSandbox, cEnvVars + 2) == 0) { KU32 iDst = 0; for (i = 0; i < cEnvVars; i++) { const char *pszVar = papszEnvVars[i]; KSIZE cchVar = kHlpStrLen(pszVar); const char *pszEqual; if ( cchVar > 0 && (pszEqual = kHlpMemChr(pszVar, '=', cchVar)) != NULL) { char *pszCopy = kHlpDup(pszVar, cchVar + 1); wchar_t *pwszCopy = kwStrToUtf16AllocN(pszVar, cchVar + 1); if (pszCopy && pwszCopy) { pSandbox->papszEnvVars[iDst] = pszCopy; pSandbox->environ[iDst] = pszCopy; pSandbox->papwszEnvVars[iDst] = pwszCopy; pSandbox->wenviron[iDst] = pwszCopy; /* When we see the path, we must tell the system or native exec and module loading won't work . */ if ( (pszEqual - pszVar) == 4 && ( pszCopy[0] == 'P' || pszCopy[0] == 'p') && ( pszCopy[1] == 'A' || pszCopy[1] == 'a') && ( pszCopy[2] == 'T' || pszCopy[2] == 't') && ( pszCopy[3] == 'H' || pszCopy[3] == 'h')) if (!SetEnvironmentVariableW(L"Path", &pwszCopy[5])) kwErrPrintf("kwSandboxInit: SetEnvironmentVariableW(Path,) failed: %u\n", GetLastError()); iDst++; } else { kHlpFree(pszCopy); kHlpFree(pwszCopy); return kwErrPrintfRc(KERR_NO_MEMORY, "Out of memory setting up env vars!\n"); } } else kwErrPrintf("kwSandboxInit: Skipping bad env var '%s'\n", pszVar); } pSandbox->papszEnvVars[iDst] = NULL; pSandbox->environ[iDst] = NULL; pSandbox->papwszEnvVars[iDst] = NULL; pSandbox->wenviron[iDst] = NULL; } else return kwErrPrintfRc(KERR_NO_MEMORY, "Error setting up environment variables: kwSandboxGrowEnv failed\n"); /* * Invalidate the volatile parts of cache (kBuild output directory, * temporary directory, whatever). */ kFsCacheInvalidateCustomBoth(g_pFsCache); #ifdef WITH_HISTORY /* * Record command line in debug history. */ kHlpFree(g_apszHistory[g_iHistoryNext]); g_apszHistory[g_iHistoryNext] = kHlpStrDup(pSandbox->pszCmdLine); g_iHistoryNext = (g_iHistoryNext + 1) % K_ELEMENTS(g_apszHistory); #endif return 0; } /** * Does sandbox cleanup between jobs. * * We postpone whatever isn't externally visible (i.e. files) and doesn't * influence the result, so that kmk can get on with things ASAP. * * @param pSandbox The sandbox. */ static void kwSandboxCleanupLate(PKWSANDBOX pSandbox) { PROCESS_MEMORY_COUNTERS MemInfo; PKWVIRTALLOC pTracker; PKWHEAP pHeap; PKWLOCALSTORAGE pLocalStorage; #ifdef WITH_HASH_CACHE PKWCRYPTHASH pHash; #endif #ifdef WITH_TEMP_MEMORY_FILES PKWFSTEMPFILE pTempFile; #endif PKWEXITCALLACK pExitCallback; /* * First stuff that may cause code to run. */ /* Do exit callback first. */ pExitCallback = g_Sandbox.pExitCallbackHead; g_Sandbox.pExitCallbackHead = NULL; while (pExitCallback) { PKWEXITCALLACK pNext = pExitCallback->pNext; KW_LOG(("kwSandboxCleanupLate: calling %p %sexit handler\n", pExitCallback->pfnCallback, pExitCallback->fAtExit ? "at" : "_on")); __try { pExitCallback->pfnCallback(); } __except (EXCEPTION_EXECUTE_HANDLER) { KW_LOG(("kwSandboxCleanupLate: %sexit handler %p threw an exception!\n", pExitCallback->fAtExit ? "at" : "_on", pExitCallback->pfnCallback)); kHlpAssertFailed(); } kHlpFree(pExitCallback); pExitCallback = pNext; } /* Free left behind FlsAlloc leaks. */ pLocalStorage = g_Sandbox.pFlsAllocHead; g_Sandbox.pFlsAllocHead = NULL; while (pLocalStorage) { PKWLOCALSTORAGE pNext = pLocalStorage->pNext; KW_LOG(("Freeing leaked FlsAlloc index %#x\n", pLocalStorage->idx)); FlsFree(pLocalStorage->idx); kHlpFree(pLocalStorage); pLocalStorage = pNext; } /* Free left behind TlsAlloc leaks. */ pLocalStorage = g_Sandbox.pTlsAllocHead; g_Sandbox.pTlsAllocHead = NULL; while (pLocalStorage) { PKWLOCALSTORAGE pNext = pLocalStorage->pNext; KW_LOG(("Freeing leaked TlsAlloc index %#x\n", pLocalStorage->idx)); TlsFree(pLocalStorage->idx); kHlpFree(pLocalStorage); pLocalStorage = pNext; } /* * Then free resources associated with the sandbox run. */ /* Open handles, except fixed handles (stdout and stderr). */ EnterCriticalSection(&pSandbox->HandlesLock); if (pSandbox->cActiveHandles > pSandbox->cFixedHandles) { KU32 idxHandle = pSandbox->cHandles; while (idxHandle-- > 0) if (pSandbox->papHandles[idxHandle] == NULL) { /* likely */ } else { PKWHANDLE pHandle = pSandbox->papHandles[idxHandle]; if ( pHandle->enmType != KWHANDLETYPE_OUTPUT_BUF || idxHandle != KW_HANDLE_TO_INDEX(pHandle->hHandle) ) { pSandbox->papHandles[idxHandle] = NULL; pSandbox->cLeakedHandles++; switch (pHandle->enmType) { case KWHANDLETYPE_FSOBJ_READ_CACHE: KWFS_LOG(("Closing leaked read cache handle: %#x/%p cRefs=%d\n", idxHandle, pHandle->hHandle, pHandle->cRefs)); break; case KWHANDLETYPE_FSOBJ_READ_CACHE_MAPPING: KWFS_LOG(("Closing leaked read mapping handle: %#x/%p cRefs=%d\n", idxHandle, pHandle->hHandle, pHandle->cRefs)); break; case KWHANDLETYPE_OUTPUT_BUF: KWFS_LOG(("Closing leaked output buf handle: %#x/%p cRefs=%d\n", idxHandle, pHandle->hHandle, pHandle->cRefs)); break; #ifdef WITH_TEMP_MEMORY_FILES case KWHANDLETYPE_TEMP_FILE: KWFS_LOG(("Closing leaked temp file handle: %#x/%p cRefs=%d\n", idxHandle, pHandle->hHandle, pHandle->cRefs)); pHandle->u.pTempFile->cActiveHandles--; break; case KWHANDLETYPE_TEMP_FILE_MAPPING: KWFS_LOG(("Closing leaked temp mapping handle: %#x/%p cRefs=%d\n", idxHandle, pHandle->hHandle, pHandle->cRefs)); pHandle->u.pTempFile->cActiveHandles--; break; #endif default: kHlpAssertFailed(); } if (--pHandle->cRefs == 0) kHlpFree(pHandle); if (--pSandbox->cActiveHandles == pSandbox->cFixedHandles) break; } } kHlpAssert(pSandbox->cActiveHandles == pSandbox->cFixedHandles); } LeaveCriticalSection(&pSandbox->HandlesLock); /* Reset memory mappings - This assumes none of the DLLs keeps any of our mappings open! */ g_Sandbox.cMemMappings = 0; #ifdef WITH_TEMP_MEMORY_FILES /* The temporary files aren't externally visible, they're all in memory. */ pTempFile = pSandbox->pTempFileHead; pSandbox->pTempFileHead = NULL; while (pTempFile) { PKWFSTEMPFILE pNext = pTempFile->pNext; KU32 iSeg = pTempFile->cSegs; while (iSeg-- > 0) kHlpPageFree(pTempFile->paSegs[iSeg].pbData, pTempFile->paSegs[iSeg].cbDataAlloc); kHlpFree(pTempFile->paSegs); pTempFile->pNext = NULL; kHlpFree(pTempFile); pTempFile = pNext; } #endif /* Free left behind HeapCreate leaks. */ pHeap = g_Sandbox.pHeapHead; g_Sandbox.pHeapHead = NULL; while (pHeap != NULL) { PKWHEAP pNext = pHeap->pNext; KW_LOG(("Freeing HeapCreate leak %p\n", pHeap->hHeap)); HeapDestroy(pHeap->hHeap); pHeap = pNext; } /* Free left behind VirtualAlloc leaks. */ EnterCriticalSection(&g_Sandbox.VirtualAllocLock); pTracker = g_Sandbox.pVirtualAllocHead; g_Sandbox.pVirtualAllocHead = NULL; LeaveCriticalSection(&g_Sandbox.VirtualAllocLock); while (pTracker) { PKWVIRTALLOC pNext = pTracker->pNext; KW_LOG(("Freeing VirtualFree leak %p LB %#x\n", pTracker->pvAlloc, pTracker->cbAlloc)); #ifdef WITH_FIXED_VIRTUAL_ALLOCS if (pTracker->idxPreAllocated != KU32_MAX) kwSandboxResetFixedAllocation(pTracker->idxPreAllocated); else #endif VirtualFree(pTracker->pvAlloc, 0, MEM_RELEASE); kHlpFree(pTracker); pTracker = pNext; } /* Free the environment. */ if (pSandbox->papszEnvVars) { KU32 i; for (i = 0; pSandbox->papszEnvVars[i]; i++) kHlpFree(pSandbox->papszEnvVars[i]); pSandbox->environ[0] = NULL; pSandbox->papszEnvVars[0] = NULL; for (i = 0; pSandbox->papwszEnvVars[i]; i++) kHlpFree(pSandbox->papwszEnvVars[i]); pSandbox->wenviron[0] = NULL; pSandbox->papwszEnvVars[0] = NULL; } #ifdef WITH_HASH_CACHE /* * Hash handles. */ pHash = pSandbox->pHashHead; pSandbox->pHashHead = NULL; while (pHash) { PKWCRYPTHASH pNext = pHash->pNext; KWCRYPT_LOG(("Freeing leaked hash instance %#p\n", pHash)); if (pHash->hFallback != KUPTR_MAX) CryptDestroyHash(pHash->hFallback); kHlpFree(pHash); pHash = pNext; } #endif /* * Check the memory usage. If it's getting high, trigger a respawn * after the next job. */ MemInfo.WorkingSetSize = 0; if (GetProcessMemoryInfo(GetCurrentProcess(), &MemInfo, sizeof(MemInfo))) { /* The first time thru, we figure out approximately when to restart based on installed RAM and CPU threads. */ static KU64 s_cbMaxWorkingSet = 0; if (s_cbMaxWorkingSet != 0) { /* likely */ } else { SYSTEM_INFO SysInfo; MEMORYSTATUSEX GlobalMemInfo; const char *pszValue; /* Calculate a reasonable estimate. */ kHlpMemSet(&SysInfo, 0, sizeof(SysInfo)); GetNativeSystemInfo(&SysInfo); kHlpMemSet(&GlobalMemInfo, 0, sizeof(GlobalMemInfo)); GlobalMemInfo.dwLength = sizeof(GlobalMemInfo); if (!GlobalMemoryStatusEx(&GlobalMemInfo)) #if K_ARCH_BITS >= 64 GlobalMemInfo.ullTotalPhys = KU64_C(0x000200000000); /* 8GB */ #else GlobalMemInfo.ullTotalPhys = KU64_C(0x000080000000); /* 2GB */ #endif s_cbMaxWorkingSet = GlobalMemInfo.ullTotalPhys / (K_MAX(SysInfo.dwNumberOfProcessors, 1) * 4); KW_LOG(("Raw estimate of s_cbMaxWorkingSet=%" KU64_PRI "\n", s_cbMaxWorkingSet)); /* User limit. */ pszValue = getenv("KWORKER_MEMORY_LIMIT"); if (pszValue != NULL) { char *pszNext; unsigned long ulValue = strtol(pszValue, &pszNext, 0); if (*pszNext == '\0' || *pszNext == 'M') s_cbMaxWorkingSet = ulValue * (KU64)1048576; else if (*pszNext == 'K') s_cbMaxWorkingSet = ulValue * (KU64)1024; else if (*pszNext == 'G') s_cbMaxWorkingSet = ulValue * (KU64)1073741824; else kwErrPrintf("Unable to grok KWORKER_MEMORY_LIMIT: %s\n", pszValue); KW_LOG(("User s_cbMaxWorkingSet=%" KU64_PRI "\n", s_cbMaxWorkingSet)); } /* Clamp it a little. */ if (s_cbMaxWorkingSet < 168*1024*1024) s_cbMaxWorkingSet = 168*1024*1024; #if K_ARCH_BITS < 64 else s_cbMaxWorkingSet = K_MIN(s_cbMaxWorkingSet, SysInfo.dwProcessorType != PROCESSOR_ARCHITECTURE_AMD64 ? 512*1024*1024 /* Only got 2 or 3 GB VA */ : 1536*1024*1024 /* got 4GB VA */); #endif if (s_cbMaxWorkingSet > GlobalMemInfo.ullTotalPhys) s_cbMaxWorkingSet = GlobalMemInfo.ullTotalPhys; KW_LOG(("Final s_cbMaxWorkingSet=%" KU64_PRI "\n", s_cbMaxWorkingSet)); } /* Finally the check. */ if (MemInfo.WorkingSetSize >= s_cbMaxWorkingSet) { KW_LOG(("WorkingSetSize = %#x - > restart next time.\n", MemInfo.WorkingSetSize)); g_fRestart = K_TRUE; } } /* * The CRT has a max of 8192 handles, so we better restart after a while if * someone is leaking handles or we risk running out of descriptors. * * Note! We only detect leaks for handles we intercept. In the case of CL.EXE * doing _dup2(1, 2) (stderr ==> stdout), there isn't actually a leak. */ if (pSandbox->cLeakedHandles > 6000) { KW_LOG(("LeakedHandles = %#x - > restart next time.\n", pSandbox->cLeakedHandles)); g_fRestart = K_TRUE; } } /** * Does essential cleanups and restoring, anything externally visible. * * All cleanups that aren't externally visible are postponed till after we've * informed kmk of the result, so it can be done in the dead time between jobs. * * @param pSandbox The sandbox. */ static void kwSandboxCleanup(PKWSANDBOX pSandbox) { /* * Restore the parent command line string. */ PPEB pPeb = kwSandboxGetProcessEnvironmentBlock(); PMY_RTL_USER_PROCESS_PARAMETERS pProcParams = (PMY_RTL_USER_PROCESS_PARAMETERS)pPeb->ProcessParameters; pProcParams->CommandLine = pSandbox->SavedCommandLine; #ifdef WITH_CONSOLE_OUTPUT_BUFFERING pProcParams->StandardOutput = pSandbox->StdOut.hOutput; pProcParams->StandardError = pSandbox->StdErr.hOutput; /* CL.EXE messes with this one. */ #endif } static int kwSandboxExec(PKWSANDBOX pSandbox, PKWTOOL pTool, KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange, KU32 cEnvVars, const char **papszEnvVars, KBOOL fNoPchCaching) { int rcExit = 42; int rc; /* * Initialize the sandbox environment. */ rc = kwSandboxInit(&g_Sandbox, pTool, cArgs, papszArgs, fWatcomBrainDamange, cEnvVars, papszEnvVars, fNoPchCaching); if (rc == 0) { if (g_cVerbose > 2) fprintf(stderr, "kWorker: info: Executing (sandboxed): %s\n", g_Sandbox.pszCmdLine); /* * Do module initialization. */ #if 0 //kwSandboxResetModuleVisited(); //kwSandboxResetModuleState(pTool->u.Sandboxed.pExe); #else kwSandboxResetModuleState(); #endif rc = kwLdrModuleInitTree(pTool->u.Sandboxed.pExe); if (rc == 0) { /* * Call the main function. */ #if K_ARCH == K_ARCH_AMD64 int (*pfnWin64Entrypoint)(void *pvPeb, void *, void *, void *); #elif K_ARCH == K_ARCH_X86_32 int (__cdecl *pfnWin32Entrypoint)(void *pvPeb); #else # error "Port me!" #endif /* Save the NT TIB first (should do that here, not in some other function). */ PNT_TIB pTib = (PNT_TIB)NtCurrentTeb(); pSandbox->TibMainThread = *pTib; /* Make the call in a guarded fashion. */ #if K_ARCH == K_ARCH_AMD64 /* AMD64 */ *(KUPTR *)&pfnWin64Entrypoint = pTool->u.Sandboxed.uMainAddr; __try { pSandbox->pOutXcptListHead = pTib->ExceptionList; if (setjmp(pSandbox->JmpBuf) == 0) { *(KU64*)(pSandbox->JmpBuf) = 0; /** @todo find other way to prevent longjmp from doing unwind! */ pSandbox->fRunning = K_TRUE; rcExit = pfnWin64Entrypoint(kwSandboxGetProcessEnvironmentBlock(), NULL, NULL, NULL); pSandbox->fRunning = K_FALSE; } else rcExit = pSandbox->rcExitCode; } #elif K_ARCH == K_ARCH_X86_32 /* x86 (see _tmainCRTStartup) */ *(KUPTR *)&pfnWin32Entrypoint = pTool->u.Sandboxed.uMainAddr; __try { pSandbox->pOutXcptListHead = pTib->ExceptionList; if (setjmp(pSandbox->JmpBuf) == 0) { //*(KU64*)(pSandbox->JmpBuf) = 0; /** @todo find other way to prevent longjmp from doing unwind! */ pSandbox->fRunning = K_TRUE; rcExit = pfnWin32Entrypoint(kwSandboxGetProcessEnvironmentBlock()); pSandbox->fRunning = K_FALSE; } else rcExit = pSandbox->rcExitCode; } #endif __except (EXCEPTION_EXECUTE_HANDLER) { kwErrPrintf("Caught exception %#x!\n", GetExceptionCode()); #ifdef WITH_HISTORY { KU32 cPrinted = 0; while (cPrinted++ < 5) { KU32 idx = (g_iHistoryNext + K_ELEMENTS(g_apszHistory) - cPrinted) % K_ELEMENTS(g_apszHistory); if (g_apszHistory[idx]) kwErrPrintf("cmd[%d]: %s\n", 1 - cPrinted, g_apszHistory[idx]); } } #endif rcExit = 512; } pSandbox->fRunning = K_FALSE; /* Now, restore the NT TIB. */ *pTib = pSandbox->TibMainThread; } else rcExit = 42 + 4; /* * Flush and clean up the essential bits only, postpone whatever we * can till after we've replied to kmk. */ #ifdef WITH_CONSOLE_OUTPUT_BUFFERING kwSandboxConsoleFlushAll(&g_Sandbox); #endif kwSandboxCleanup(&g_Sandbox); /** @todo Flush sandboxed native CRTs too. */ } else rcExit = 42 + 3; return rcExit; } /** * Does the post command part of a job (optional). * * @returns The exit code of the job. * @param cPostCmdArgs Number of post command arguments (includes cmd). * @param papszPostCmdArgs The post command and its argument. */ static int kSubmitHandleJobPostCmd(KU32 cPostCmdArgs, const char **papszPostCmdArgs) { const char *pszCmd = papszPostCmdArgs[0]; /* Allow the kmk builtin prefix. */ static const char s_szKmkBuiltinPrefix[] = "kmk_builtin_"; if (kHlpStrNComp(pszCmd, s_szKmkBuiltinPrefix, sizeof(s_szKmkBuiltinPrefix) - 1) == 0) pszCmd += sizeof(s_szKmkBuiltinPrefix) - 1; /* Command switch. */ if (kHlpStrComp(pszCmd, "kDepObj") == 0) { KMKBUILTINCTX Ctx = { papszPostCmdArgs[0], NULL }; return kmk_builtin_kDepObj(cPostCmdArgs, (char **)papszPostCmdArgs, NULL, &Ctx); } return kwErrPrintfRc(42 + 5, "Unknown post command: '%s'\n", pszCmd); } /** * Helper for kSubmitHandleSpecialEnvVar that gets the current process group. */ static unsigned kwGetCurrentProcessorGroup(void) { typedef BOOL (WINAPI *PFNGETTHREADGROUPAFFINITY)(HANDLE, GROUP_AFFINITY *); HMODULE hmodKernel32 = GetModuleHandleW(L"KERNEL32.DLL"); PFNGETTHREADGROUPAFFINITY pfnGetter = (PFNGETTHREADGROUPAFFINITY)GetProcAddress(hmodKernel32, "GetThreadGroupAffinity"); if (pfnGetter) { GROUP_AFFINITY GroupAffinity; memset(&GroupAffinity, 0, sizeof(GroupAffinity)); if (pfnGetter(GetCurrentThread(), &GroupAffinity)) return GroupAffinity.Group; } return 0; } /** * Helper for kSubmitHandleSpecialEnvVar that gets the current process group. */ static KSIZE kwGetCurrentAuthenticationIdAsString(char *pszValue) { KSIZE cchRet = 0; HANDLE hToken; if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) { DWORD cbRet; TOKEN_STATISTICS TokenStats; memset(&TokenStats, 0, sizeof(TokenStats)); if (GetTokenInformation(hToken, TokenStatistics, &TokenStats, sizeof(TokenStats), &cbRet)) cchRet = sprintf(pszValue, "%" KX64_PRI, ((KU64)TokenStats.AuthenticationId.HighPart << 32) | TokenStats.AuthenticationId.LowPart); else kwErrPrintf("GetTokenInformation/TokenStatistics failed: %u\n", GetLastError()); CloseHandle(hToken); } else kwErrPrintf("OpenProcessToken failed: %u\n", GetLastError()); return cchRet; } /** * Look for and expand the special environment variable. * * We the special variable contains elements like "@@VAR_NAME@@" that kmk * couldn't accuratly determine. Currently the following variables are * implemented: * - "@@PROCESSOR_GROUP@@" - The processor group number. * - "@@AUTHENTICATION_ID@@" - The authentication ID from the process token. * - "@@PID@@" - The kWorker process ID. * - "@@@@" - Escaped "@@". * - "@@DEBUG_COUNTER@@" - An ever increasing counter (starts at zero). */ static int kSubmitHandleSpecialEnvVar(KU32 cEnvVars, const char **papszEnvVars, const char *pszSpecialEnv, char **ppszToFree) { KSIZE const cchSpecialEnv = kHlpStrLen(pszSpecialEnv); KU32 i = cEnvVars; while (i-- > 0) if ( kHlpStrNComp(papszEnvVars[i], pszSpecialEnv, cchSpecialEnv) == 0 && papszEnvVars[i][cchSpecialEnv] == '=') { /* We will expand stuff like @@NAME@@ */ const char *pszValue = papszEnvVars[i]; KSIZE offDst = 0; char szTmp[1024]; for (;;) { const char *pszAt = kHlpStrChr(pszValue, '@'); while (pszAt && pszAt[1] != '@') pszAt = kHlpStrChr(pszAt + 1, '@'); if (pszAt) { KSIZE cchSrc = pszAt - pszValue; if (offDst + cchSrc < sizeof(szTmp)) { char szSrc[64]; kHlpMemCopy(&szTmp[offDst], pszValue, cchSrc); offDst += cchSrc; pszValue = pszAt + 2; if (kHlpStrNComp(pszValue, "PROCESS_GROUP@@", 15) == 0) { pszValue += 15; if (g_iProcessGroup == -1) g_iProcessGroup = kwGetCurrentProcessorGroup(); cchSrc = sprintf(szSrc, "%u", g_iProcessGroup); } else if (kHlpStrNComp(pszValue, "AUTHENTICATION_ID@@", 19) == 0) { pszValue += 19; cchSrc = kwGetCurrentAuthenticationIdAsString(szSrc); } else if (kHlpStrNComp(pszValue, "PID@@", 5) == 0) { pszValue += 5; cchSrc = sprintf(szSrc, "%d", getpid()); } else if (kHlpStrNComp(pszValue, "@@", 2) == 0) { pszValue += 2; szSrc[0] = '@'; szSrc[1] = '@'; szSrc[2] = '\0'; cchSrc = 2; } else if (kHlpStrNComp(pszValue, "DEBUG_COUNTER@@", 15) == 0) { static unsigned int s_iCounter = 0; pszValue += 15; cchSrc = sprintf(szSrc, "%u", s_iCounter++); } else return kwErrPrintfRc(42 + 6, "Special environment variable contains unknown reference: '%s'!\n", pszValue - 2); if (offDst + cchSrc < sizeof(szTmp)) { kHlpMemCopy(&szTmp[offDst], szSrc, cchSrc); offDst += cchSrc; continue; } } } else { KSIZE cchSrc = kHlpStrLen(pszValue); if (offDst + cchSrc < sizeof(szTmp)) { kHlpMemCopy(&szTmp[offDst], pszValue, cchSrc); offDst += cchSrc; break; } } return kwErrPrintfRc(42 + 6, "Special environment variable value too long!\n"); } szTmp[offDst] = '\0'; /* Return a copy of it: */ papszEnvVars[i] = *ppszToFree = kHlpDup(szTmp, offDst + 1); if (papszEnvVars[i]) { SetEnvironmentVariableA(pszSpecialEnv, kHlpStrChr(papszEnvVars[i], '=') + 1); /* hack */ return 0; } return kwErrPrintfRc(42 + 6, "Special environment variable: out of memory\n"); } return kwErrPrintfRc(42 + 6, "Special environment variable not found: '%s'\n", pszSpecialEnv); } /** * Part 2 of the "JOB" command handler. * * @returns The exit code of the job. * @param pszExecutable The executable to execute. * @param pszCwd The current working directory of the job. * @param cArgs The number of arguments. * @param papszArgs The argument vector. * @param fWatcomBrainDamange Whether to apply watcom rules while quoting. * @param cEnvVars The number of environment variables. * @param papszEnvVars The environment vector. * @param pszSpecialEnv Name of special environment variable that * requires selective expansion here. * @param fNoPchCaching Whether to disable precompiled header file * caching. Avoid trouble when creating them. * @param cPostCmdArgs Number of post command arguments (includes cmd). * @param papszPostCmdArgs The post command and its argument. */ static int kSubmitHandleJobUnpacked(const char *pszExecutable, const char *pszCwd, KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange, KU32 cEnvVars, const char **papszEnvVars, const char *pszSpecialEnv, KBOOL fNoPchCaching, KU32 cPostCmdArgs, const char **papszPostCmdArgs) { int rcExit; PKWTOOL pTool; char *pszSpecialEnvFree = NULL; KW_LOG(("\n\nkSubmitHandleJobUnpacked: '%s' in '%s' cArgs=%u cEnvVars=%u cPostCmdArgs=%u\n", pszExecutable, pszCwd, cArgs, cEnvVars, cPostCmdArgs)); #ifdef KW_LOG_ENABLED { KU32 i; for (i = 0; i < cArgs; i++) KW_LOG((" papszArgs[%u]=%s\n", i, papszArgs[i])); for (i = 0; i < cPostCmdArgs; i++) KW_LOG((" papszPostCmdArgs[%u]=%s\n", i, papszPostCmdArgs[i])); } #endif g_cJobs++; /* * Expand pszSpecialEnv if present. */ if (pszSpecialEnv && *pszSpecialEnv) { rcExit = kSubmitHandleSpecialEnvVar(cEnvVars, papszEnvVars, pszSpecialEnv, &pszSpecialEnvFree); if (!rcExit) { /* likely */ } else return rcExit; } /* * Lookup the tool. */ g_Sandbox.pTool = NULL; /* Avoid confusion between the SetDllDirectoryW hacks. */ pTool = kwToolLookup(pszExecutable, cEnvVars, papszEnvVars); if (pTool) { /* * Change the directory if we're going to execute the job inside * this process. Then invoke the tool type specific handler. */ switch (pTool->enmType) { case KWTOOLTYPE_SANDBOXED: case KWTOOLTYPE_WATCOM: { /* Change dir. */ KFSLOOKUPERROR enmError; PKFSOBJ pNewCurDir = kFsCacheLookupA(g_pFsCache, pszCwd, &enmError); if ( pNewCurDir == g_pCurDirObj && pNewCurDir->bObjType == KFSOBJ_TYPE_DIR) kFsCacheObjRelease(g_pFsCache, pNewCurDir); else if (SetCurrentDirectoryA(pszCwd)) { kFsCacheObjRelease(g_pFsCache, g_pCurDirObj); g_pCurDirObj = pNewCurDir; } else { kwErrPrintf("SetCurrentDirectory failed with %u on '%s'\n", GetLastError(), pszCwd); kFsCacheObjRelease(g_pFsCache, pNewCurDir); rcExit = 42 + 1; break; } /* Call specific handler. */ if (pTool->enmType == KWTOOLTYPE_SANDBOXED) { KW_LOG(("Sandboxing tool %s\n", pTool->pszPath)); rcExit = kwSandboxExec(&g_Sandbox, pTool, cArgs, papszArgs, fWatcomBrainDamange, cEnvVars, papszEnvVars, fNoPchCaching); } else { kwErrPrintf("TODO: Watcom style tool %s\n", pTool->pszPath); rcExit = 42 + 2; } break; } case KWTOOLTYPE_EXEC: kwErrPrintf("TODO: Direct exec tool %s\n", pTool->pszPath); rcExit = 42 + 2; break; default: kHlpAssertFailed(); kwErrPrintf("Internal tool type corruption!!\n"); rcExit = 42 + 2; g_fRestart = K_TRUE; break; } /* * Do the post command, if present. */ if (cPostCmdArgs && rcExit == 0) rcExit = kSubmitHandleJobPostCmd(cPostCmdArgs, papszPostCmdArgs); } else rcExit = 42 + 1; if (pszSpecialEnvFree) { SetEnvironmentVariableA(pszSpecialEnv, NULL); /* hack */ kHlpFree(pszSpecialEnvFree); } return rcExit; } /** * Handles a "JOB" command. * * @returns The exit code of the job. * @param pszMsg Points to the "JOB" command part of the message. * @param cbMsg Number of message bytes at @a pszMsg. There are * 4 more zero bytes after the message body to * simplify parsing. */ static int kSubmitHandleJob(const char *pszMsg, KSIZE cbMsg) { int rcExit = 42; /* * Unpack the message. */ const char *pszExecutable; KSIZE cbTmp; pszMsg += sizeof("JOB"); cbMsg -= sizeof("JOB"); /* Executable name. */ pszExecutable = pszMsg; cbTmp = kHlpStrLen(pszMsg) + 1; pszMsg += cbTmp; if ( cbTmp < cbMsg && cbTmp > 2) { const char *pszCwd; cbMsg -= cbTmp; /* Current working directory. */ pszCwd = pszMsg; cbTmp = kHlpStrLen(pszMsg) + 1; pszMsg += cbTmp; if ( cbTmp + sizeof(KU32) < cbMsg && cbTmp >= 2) { KU32 cArgs; cbMsg -= cbTmp; /* Argument count. */ kHlpMemCopy(&cArgs, pszMsg, sizeof(cArgs)); pszMsg += sizeof(cArgs); cbMsg -= sizeof(cArgs); if (cArgs > 0 && cArgs < 4096) { /* The argument vector. */ char const **papszArgs = kHlpAlloc((cArgs + 1) * sizeof(papszArgs[0])); if (papszArgs) { KU32 i; for (i = 0; i < cArgs; i++) { papszArgs[i] = pszMsg + 1; /* First byte is expansion flags for MSC & EMX. */ cbTmp = 1 + kHlpStrLen(pszMsg + 1) + 1; pszMsg += cbTmp; if (cbTmp < cbMsg) cbMsg -= cbTmp; else { cbMsg = 0; break; } } papszArgs[cArgs] = 0; /* Environment variable count. */ if (cbMsg > sizeof(KU32)) { KU32 cEnvVars; kHlpMemCopy(&cEnvVars, pszMsg, sizeof(cEnvVars)); pszMsg += sizeof(cEnvVars); cbMsg -= sizeof(cEnvVars); if (cEnvVars >= 0 && cEnvVars < 4096) { /* The argument vector. */ char const **papszEnvVars = kHlpAlloc((cEnvVars + 1) * sizeof(papszEnvVars[0])); if (papszEnvVars) { for (i = 0; i < cEnvVars; i++) { papszEnvVars[i] = pszMsg; cbTmp = kHlpStrLen(pszMsg) + 1; pszMsg += cbTmp; if (cbTmp < cbMsg) cbMsg -= cbTmp; else { cbMsg = 0; break; } } papszEnvVars[cEnvVars] = 0; /* Flags (currently just watcom argument brain damage and no precompiled header caching). */ if (cbMsg >= sizeof(KU8) * 2) { KBOOL fWatcomBrainDamange = *pszMsg++; KBOOL fNoPchCaching = *pszMsg++; cbMsg -= 2; /* Name of special enviornment variable requiring selective expansion. */ if (cbMsg >= 1) { const char *pszSpecialEnv = pszMsg; cbTmp = kHlpStrLen(pszMsg); pszMsg += cbTmp + 1; cbMsg -= K_MIN(cbMsg, cbTmp + 1); /* Post command argument count (can be zero). */ if (cbMsg >= sizeof(KU32)) { KU32 cPostCmdArgs; kHlpMemCopy(&cPostCmdArgs, pszMsg, sizeof(cPostCmdArgs)); pszMsg += sizeof(cPostCmdArgs); cbMsg -= sizeof(cPostCmdArgs); if (cPostCmdArgs >= 0 && cPostCmdArgs < 32) { char const *apszPostCmdArgs[32+1]; for (i = 0; i < cPostCmdArgs; i++) { apszPostCmdArgs[i] = pszMsg; cbTmp = kHlpStrLen(pszMsg) + 1; pszMsg += cbTmp; if ( cbTmp < cbMsg || (cbTmp == cbMsg && i + 1 == cPostCmdArgs)) cbMsg -= cbTmp; else { cbMsg = KSIZE_MAX; break; } } if (cbMsg == 0) { apszPostCmdArgs[cPostCmdArgs] = NULL; /* * The next step. */ rcExit = kSubmitHandleJobUnpacked(pszExecutable, pszCwd, cArgs, papszArgs, fWatcomBrainDamange, cEnvVars, papszEnvVars, pszSpecialEnv, fNoPchCaching, cPostCmdArgs, apszPostCmdArgs); } else if (cbMsg == KSIZE_MAX) kwErrPrintf("Detected bogus message unpacking post command and its arguments!\n"); else kwErrPrintf("Message has %u bytes unknown trailing bytes\n", cbMsg); } else kwErrPrintf("Bogus post command argument count: %u %#x\n", cPostCmdArgs, cPostCmdArgs); } else kwErrPrintf("Detected bogus message looking for the post command argument count!\n"); } else kwErrPrintf("Detected bogus message unpacking special environment variable!\n"); } else kwErrPrintf("Detected bogus message unpacking flags!\n"); kHlpFree((void *)papszEnvVars); } else kwErrPrintf("Error allocating papszEnvVars for %u variables\n", cEnvVars); } else kwErrPrintf("Bogus environment variable count: %u (%#x)\n", cEnvVars, cEnvVars); } else kwErrPrintf("Detected bogus message unpacking arguments and environment variable count!\n"); kHlpFree((void *)papszArgs); } else kwErrPrintf("Error allocating argv for %u arguments\n", cArgs); } else kwErrPrintf("Bogus argument count: %u (%#x)\n", cArgs, cArgs); } else kwErrPrintf("Detected bogus message unpacking CWD path and argument count!\n"); } else kwErrPrintf("Detected bogus message unpacking executable path!\n"); return rcExit; } /** * Wrapper around WriteFile / write that writes the whole @a cbToWrite. * * @retval 0 on success. * @retval -1 on error (fully bitched). * * @param hPipe The pipe handle. * @param pvBuf The buffer to write out out. * @param cbToWrite The number of bytes to write. */ static int kSubmitWriteIt(HANDLE hPipe, const void *pvBuf, KU32 cbToWrite) { KU8 const *pbBuf = (KU8 const *)pvBuf; KU32 cbLeft = cbToWrite; while (g_rcCtrlC == 0) { DWORD cbActuallyWritten = 0; if (WriteFile(hPipe, pbBuf, cbLeft, &cbActuallyWritten, NULL /*pOverlapped*/)) { cbLeft -= cbActuallyWritten; if (!cbLeft) return 0; pbBuf += cbActuallyWritten; } else { DWORD dwErr = GetLastError(); if (cbLeft == cbToWrite) kwErrPrintf("WriteFile failed: %u\n", dwErr); else kwErrPrintf("WriteFile failed %u byte(s) in: %u\n", cbToWrite - cbLeft, dwErr); return -1; } } return -1; } /** * Wrapper around ReadFile / read that reads the whole @a cbToRead. * * @retval 0 on success. * @retval 1 on shut down (fShutdownOkay must be K_TRUE). * @retval -1 on error (fully bitched). * @param hPipe The pipe handle. * @param pvBuf The buffer to read into. * @param cbToRead The number of bytes to read. * @param fShutdownOkay Whether connection shutdown while reading the * first byte is okay or not. */ static int kSubmitReadIt(HANDLE hPipe, void *pvBuf, KU32 cbToRead, KBOOL fMayShutdown) { KU8 *pbBuf = (KU8 *)pvBuf; KU32 cbLeft = cbToRead; while (g_rcCtrlC == 0) { DWORD cbActuallyRead = 0; if (ReadFile(hPipe, pbBuf, cbLeft, &cbActuallyRead, NULL /*pOverlapped*/)) { cbLeft -= cbActuallyRead; if (!cbLeft) return 0; pbBuf += cbActuallyRead; } else { DWORD dwErr = GetLastError(); if (cbLeft == cbToRead) { if ( fMayShutdown && dwErr == ERROR_BROKEN_PIPE) return 1; kwErrPrintf("ReadFile failed: %u\n", dwErr); } else kwErrPrintf("ReadFile failed %u byte(s) in: %u\n", cbToRead - cbLeft, dwErr); return -1; } } return -1; } /** * Decimal formatting of a 64-bit unsigned value into a large enough buffer. * * @returns pszBuf * @param pszBuf The buffer (sufficiently large). * @param uValue The value. */ static const char *kwFmtU64(char *pszBuf, KU64 uValue) { char szTmp[64]; char *psz = &szTmp[63]; int cch = 4; *psz-- = '\0'; do { if (--cch == 0) { *psz-- = ' '; cch = 3; } *psz-- = (uValue % 10) + '0'; uValue /= 10; } while (uValue != 0); return strcpy(pszBuf, psz + 1); } /** * Prints statistics. */ static void kwPrintStats(void) { PROCESS_MEMORY_COUNTERS_EX MemInfo; MEMORYSTATUSEX MemStatus; IO_COUNTERS IoCounters; DWORD cHandles; KSIZE cMisses; char szBuf[16*1024]; int off = 0; char szPrf[24]; char sz1[64]; char sz2[64]; char sz3[64]; char sz4[64]; sprintf(szPrf, "%5d/%u:", getpid(), K_ARCH_BITS); szBuf[off++] = '\n'; off += sprintf(&szBuf[off], "%s %14s jobs, %s tools, %s modules, %s non-native ones\n", szPrf, kwFmtU64(sz1, g_cJobs), kwFmtU64(sz2, g_cTools), kwFmtU64(sz3, g_cModules), kwFmtU64(sz4, g_cNonNativeModules)); off += sprintf(&szBuf[off], "%s %14s bytes in %s read-cached files, avg %s bytes\n", szPrf, kwFmtU64(sz1, g_cbReadCachedFiles), kwFmtU64(sz2, g_cReadCachedFiles), kwFmtU64(sz3, g_cbReadCachedFiles / K_MAX(g_cReadCachedFiles, 1))); off += sprintf(&szBuf[off], "%s %14s bytes read in %s calls\n", szPrf, kwFmtU64(sz1, g_cbReadFileTotal), kwFmtU64(sz2, g_cReadFileCalls)); off += sprintf(&szBuf[off], "%s %14s bytes read (%u%%) in %s calls (%u%%) from read cached files\n", szPrf, kwFmtU64(sz1, g_cbReadFileFromReadCached), (unsigned)(g_cbReadFileFromReadCached * (KU64)100 / g_cbReadFileTotal), kwFmtU64(sz2, g_cReadFileFromReadCached), (unsigned)(g_cReadFileFromReadCached * (KU64)100 / g_cReadFileCalls)); off += sprintf(&szBuf[off], "%s %14s bytes read (%u%%) in %s calls (%u%%) from in-memory temporary files\n", szPrf, kwFmtU64(sz1, g_cbReadFileFromInMemTemp), (unsigned)(g_cbReadFileFromInMemTemp * (KU64)100 / K_MAX(g_cbReadFileTotal, 1)), kwFmtU64(sz2, g_cReadFileFromInMemTemp), (unsigned)(g_cReadFileFromInMemTemp * (KU64)100 / K_MAX(g_cReadFileCalls, 1))); off += sprintf(&szBuf[off], "%s %14s bytes written in %s calls\n", szPrf, kwFmtU64(sz1, g_cbWriteFileTotal), kwFmtU64(sz2, g_cWriteFileCalls)); off += sprintf(&szBuf[off], "%s %14s bytes written (%u%%) in %s calls (%u%%) to in-memory temporary files\n", szPrf, kwFmtU64(sz1, g_cbWriteFileToInMemTemp), (unsigned)(g_cbWriteFileToInMemTemp * (KU64)100 / K_MAX(g_cbWriteFileTotal, 1)), kwFmtU64(sz2, g_cWriteFileToInMemTemp), (unsigned)(g_cWriteFileToInMemTemp * (KU64)100 / K_MAX(g_cWriteFileCalls, 1))); off += sprintf(&szBuf[off], "%s %14s bytes for the cache\n", szPrf, kwFmtU64(sz1, g_pFsCache->cbObjects + g_pFsCache->cbAnsiPaths + g_pFsCache->cbUtf16Paths + sizeof(*g_pFsCache))); off += sprintf(&szBuf[off], "%s %14s objects, taking up %s bytes, avg %s bytes\n", szPrf, kwFmtU64(sz1, g_pFsCache->cObjects), kwFmtU64(sz2, g_pFsCache->cbObjects), kwFmtU64(sz3, g_pFsCache->cbObjects / g_pFsCache->cObjects)); off += sprintf(&szBuf[off], "%s %14s A path hashes, taking up %s bytes, avg %s bytes, %s collision\n", szPrf, kwFmtU64(sz1, g_pFsCache->cAnsiPaths), kwFmtU64(sz2, g_pFsCache->cbAnsiPaths), kwFmtU64(sz3, g_pFsCache->cbAnsiPaths / K_MAX(g_pFsCache->cAnsiPaths, 1)), kwFmtU64(sz4, g_pFsCache->cAnsiPathCollisions)); #ifdef KFSCACHE_CFG_UTF16 off += sprintf(&szBuf[off], "%s %14s W path hashes, taking up %s bytes, avg %s bytes, %s collisions\n", szPrf, kwFmtU64(sz1, g_pFsCache->cUtf16Paths), kwFmtU64(sz2, g_pFsCache->cbUtf16Paths), kwFmtU64(sz3, g_pFsCache->cbUtf16Paths / K_MAX(g_pFsCache->cUtf16Paths, 1)), kwFmtU64(sz4, g_pFsCache->cUtf16PathCollisions)); #endif off += sprintf(&szBuf[off], "%s %14s child hash tables, total of %s entries, %s children inserted, %s collisions\n", szPrf, kwFmtU64(sz1, g_pFsCache->cChildHashTabs), kwFmtU64(sz2, g_pFsCache->cChildHashEntriesTotal), kwFmtU64(sz3, g_pFsCache->cChildHashed), kwFmtU64(sz4, g_pFsCache->cChildHashCollisions)); cMisses = g_pFsCache->cLookups - g_pFsCache->cPathHashHits - g_pFsCache->cWalkHits; off += sprintf(&szBuf[off], "%s %14s lookups: %s (%u%%) path hash hits, %s (%u%%) walks hits, %s (%u%%) misses\n", szPrf, kwFmtU64(sz1, g_pFsCache->cLookups), kwFmtU64(sz2, g_pFsCache->cPathHashHits), (unsigned)(g_pFsCache->cPathHashHits * (KU64)100 / K_MAX(g_pFsCache->cLookups, 1)), kwFmtU64(sz3, g_pFsCache->cWalkHits), (unsigned)(g_pFsCache->cWalkHits * (KU64)100 / K_MAX(g_pFsCache->cLookups, 1)), kwFmtU64(sz4, cMisses), (unsigned)(cMisses * (KU64)100 / K_MAX(g_pFsCache->cLookups, 1))); off += sprintf(&szBuf[off], "%s %14s child searches, %s (%u%%) hash hits\n", szPrf, kwFmtU64(sz1, g_pFsCache->cChildSearches), kwFmtU64(sz2, g_pFsCache->cChildHashHits), (unsigned)(g_pFsCache->cChildHashHits * (KU64)100 / K_MAX(g_pFsCache->cChildSearches, 1))); off += sprintf(&szBuf[off], "%s %14s name changes, growing %s times (%u%%)\n", szPrf, kwFmtU64(sz1, g_pFsCache->cNameChanges), kwFmtU64(sz2, g_pFsCache->cNameGrowths), (unsigned)(g_pFsCache->cNameGrowths * 100 / K_MAX(g_pFsCache->cNameChanges, 1)) ); #ifdef WITH_HASH_CACHE off += sprintf(&szBuf[off], "%s %14s hashes calculated, %s cache hits (%u%%), %s fallbacks, %s partial\n", szPrf, kwFmtU64(sz1, g_cHashes), kwFmtU64(sz2, g_cHashesCached), (unsigned)(g_cHashesCached * 100 / K_MAX(g_cHashes, 1)), kwFmtU64(sz3, g_cHashesFallbacks), kwFmtU64(sz4, g_cHashesPartial)); off += sprintf(&szBuf[off], "%s %14s MD5: %s SHA-1: %s SHA-256: %s SHA-512: %s\n", szPrf, "", kwFmtU64(sz1, g_cHashesMd5), kwFmtU64(sz2, g_cHashesSha1), kwFmtU64(sz3, g_cHashesSha256), kwFmtU64(sz4, g_cHashesSha512)); #endif /* * Process & Memory details. */ if (!GetProcessHandleCount(GetCurrentProcess(), &cHandles)) cHandles = 0; MemInfo.cb = sizeof(MemInfo); if (!GetProcessMemoryInfo(GetCurrentProcess(), (PPROCESS_MEMORY_COUNTERS)&MemInfo, sizeof(MemInfo))) memset(&MemInfo, 0, sizeof(MemInfo)); off += sprintf(&szBuf[off], "%s %14s handles; %s page faults; %s bytes page file, peaking at %s bytes\n", szPrf, kwFmtU64(sz1, cHandles), kwFmtU64(sz2, MemInfo.PageFaultCount), kwFmtU64(sz3, MemInfo.PagefileUsage), kwFmtU64(sz4, MemInfo.PeakPagefileUsage)); off += sprintf(&szBuf[off], "%s %14s bytes working set, peaking at %s bytes; %s byte private\n", szPrf, kwFmtU64(sz1, MemInfo.WorkingSetSize), kwFmtU64(sz2, MemInfo.PeakWorkingSetSize), kwFmtU64(sz3, MemInfo.PrivateUsage)); off += sprintf(&szBuf[off], "%s %14s bytes non-paged pool, peaking at %s bytes; %s bytes paged pool, peaking at %s bytes\n", szPrf, kwFmtU64(sz1, MemInfo.QuotaNonPagedPoolUsage), kwFmtU64(sz2, MemInfo.QuotaPeakNonPagedPoolUsage), kwFmtU64(sz3, MemInfo.QuotaPagedPoolUsage), kwFmtU64(sz4, MemInfo.QuotaPeakPagedPoolUsage)); if (!GetProcessIoCounters(GetCurrentProcess(), &IoCounters)) memset(&IoCounters, 0, sizeof(IoCounters)); off += sprintf(&szBuf[off], "%s %14s bytes in %s reads [src: OS]\n", szPrf, kwFmtU64(sz1, IoCounters.ReadTransferCount), kwFmtU64(sz2, IoCounters.ReadOperationCount)); off += sprintf(&szBuf[off], "%s %14s bytes in %s writes [src: OS]\n", szPrf, kwFmtU64(sz1, IoCounters.WriteTransferCount), kwFmtU64(sz2, IoCounters.WriteOperationCount)); off += sprintf(&szBuf[off], "%s %14s bytes in %s other I/O operations [src: OS]\n", szPrf, kwFmtU64(sz1, IoCounters.OtherTransferCount), kwFmtU64(sz2, IoCounters.OtherOperationCount)); MemStatus.dwLength = sizeof(MemStatus); if (!GlobalMemoryStatusEx(&MemStatus)) memset(&MemStatus, 0, sizeof(MemStatus)); off += sprintf(&szBuf[off], "%s %14s bytes used VA, %#" KX64_PRI " bytes available\n", szPrf, kwFmtU64(sz1, MemStatus.ullTotalVirtual - MemStatus.ullAvailVirtual), MemStatus.ullAvailVirtual); off += sprintf(&szBuf[off], "%s %14u %% system memory load\n", szPrf, MemStatus.dwMemoryLoad); maybe_con_fwrite(szBuf, off, 1, stdout); fflush(stdout); } /** * Handles what comes after --test. * * @returns Exit code. * @param argc Number of arguments after --test. * @param argv Arguments after --test. */ static int kwTestRun(int argc, char **argv) { int i; int j; int rcExit; int cRepeats; char szCwd[MAX_PATH]; const char *pszCwd = getcwd(szCwd, sizeof(szCwd)); KU32 cEnvVars; char **papszEnvVars; const char *pszSpecialEnv = ""; const char *pszSpecialEnvFull = NULL; KBOOL fWatcomBrainDamange = K_FALSE; KBOOL fNoPchCaching = K_FALSE; /* * Parse arguments. */ /* Repeat count. */ i = 0; if (i >= argc) return kwErrPrintfRc(2, "--test takes an repeat count argument or '--'!\n"); if (strcmp(argv[i], "--") != 0) { cRepeats = atoi(argv[i]); if (cRepeats <= 0) return kwErrPrintfRc(2, "The repeat count '%s' is zero, negative or invalid!\n", argv[i]); i++; /* Optional directory change. */ if ( i < argc && ( strcmp(argv[i], "--chdir") == 0 || strcmp(argv[i], "-C") == 0 ) ) { i++; if (i >= argc) return kwErrPrintfRc(2, "--chdir takes an argument!\n"); pszCwd = argv[i++]; } /* Optional watcom flag directory change. */ if ( i < argc && ( strcmp(argv[i], "--wcc-brain-damage") == 0 || strcmp(argv[i], "--watcom-brain-damage") == 0) ) { fWatcomBrainDamange = K_TRUE; i++; } /* Optional watcom flag directory change. */ if ( i < argc && strcmp(argv[i], "--no-pch-caching") == 0) { fNoPchCaching = K_TRUE; i++; } /* Optional directory change. */ if ( i < argc && ( strcmp(argv[i], "--set-special") == 0 || strcmp(argv[i], "-s") == 0 ) ) { i++; if (i >= argc) return kwErrPrintfRc(2, "--set-special takes an argument!\n"); pszSpecialEnvFull = argv[i++]; putenv(pszSpecialEnvFull); pszSpecialEnv = strdup(pszSpecialEnvFull); *strchr(pszSpecialEnv, '=') = '\0'; } /* Trigger breakpoint */ if ( i < argc && strcmp(argv[i], "--breakpoint") == 0) { __debugbreak(); i++; } /* Check for '--'. */ if (i >= argc) return kwErrPrintfRc(2, "Missing '--'\n"); if (strcmp(argv[i], "--") != 0) return kwErrPrintfRc(2, "Expected '--' found '%s'\n", argv[i]); i++; } else { cRepeats = 1; i++; } if (i >= argc) return kwErrPrintfRc(2, "Nothing to execute after '--'!\n"); /* * Duplicate the environment. */ cEnvVars = 0; while (environ[cEnvVars] != NULL) cEnvVars++; papszEnvVars = (char **)kHlpAllocZ(sizeof(papszEnvVars[0]) * (cEnvVars + 2)); /* * Do the job. */ rcExit = 0; for (j = 0; j < cRepeats; j++) { memcpy(papszEnvVars, environ, sizeof(papszEnvVars[0]) * cEnvVars); rcExit = kSubmitHandleJobUnpacked(argv[i], pszCwd, argc - i, &argv[i], fWatcomBrainDamange, cEnvVars, papszEnvVars, pszSpecialEnv, fNoPchCaching, 0, NULL); KW_LOG(("rcExit=%d\n", rcExit)); kwSandboxCleanupLate(&g_Sandbox); } if (getenv("KWORKER_STATS") != NULL) kwPrintStats(); # ifdef WITH_LOG_FILE if (g_hLogFile != INVALID_HANDLE_VALUE && g_hLogFile != NULL) CloseHandle(g_hLogFile); # endif return rcExit; } /** * Reads @a pszFile into memory and chops it up into an argument vector. * * @returns Pointer to the argument vector on success, NULL on failure. * @param pszFile The file to load. * @param pcArgs Where to return the number of arguments. * @param ppszFileContent Where to return the allocation. */ static char **kwFullTestLoadArgvFile(const char *pszFile, int *pcArgs, char **ppszFileContent) { char **papszArgs = NULL; FILE *pFile = fopen(pszFile, "r"); if (pFile) { long cbFile; if ( fseek(pFile, 0, SEEK_END) == 0 && (cbFile = ftell(pFile)) >= 0 && fseek(pFile, 0, SEEK_SET) == 0) { char *pszFile = kHlpAllocZ(cbFile + 3); if (pszFile) { size_t cbRead = fread(pszFile, 1, cbFile + 1, pFile); if ( feof(pFile) && !ferror(pFile)) { size_t off = 0; int cArgs = 0; int cAllocated = 0; char ch; pszFile[cbRead] = '\0'; pszFile[cbRead + 1] = '\0'; pszFile[cbRead + 2] = '\0'; while ((ch = pszFile[off]) != '\0') { char *pszArg; switch (ch) { case ' ': case '\t': case '\n': case '\r': off++; continue; case '\\': if (pszFile[off + 1] == '\n' || pszFile[off + 1] == '\r') { off += 2; continue; } /* fall thru */ default: pszArg = &pszFile[off]; do ch = pszFile[++off]; while (ch != '\0' && ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r'); pszFile[off++] = '\0'; break; case '\'': pszArg = &pszFile[++off]; while ((ch = pszFile[off]) != '\0' && ch != '\'') off++; pszFile[off++] = '\0'; break; case '\"': /** @todo escape sequences */ pszArg = &pszFile[++off]; while ((ch = pszFile[off]) != '\0' && ch != '"') off++; pszFile[off++] = '\0'; break; } if (cArgs + 1 >= cAllocated) { void *pvNew; cAllocated = cAllocated ? cAllocated * 2 : 16; pvNew = kHlpRealloc(papszArgs, cAllocated * sizeof(papszArgs[0])); if (pvNew) papszArgs = (char **)pvNew; else { kHlpFree(papszArgs); papszArgs = NULL; break; } } papszArgs[cArgs] = pszArg; papszArgs[++cArgs] = NULL; } *pcArgs = cArgs; } else kwErrPrintf("Error reading '%s'!\n", pszFile); } else kwErrPrintf("Error allocating %lu bytes!\n", cbFile + 2); } else kwErrPrintf("Error seeking '%s'!\n", pszFile); fclose(pFile); } else kwErrPrintf("Error opening '%s'!\n", pszFile); return papszArgs; } /** * Appends a string to an string vector (arguments or enviornment). * * @returns 0 on success, non-zero on failure (exit code). * @param ppapszVector Pointer to the string pointer array. * @param pcEntries Pointer to the array size. * @param pszAppend The string to append. */ static int kwFullTestVectorAppend(const char ***ppapszVector, KU32 *pcEntries, char const *pszAppend) { KU32 cEntries = *pcEntries; if (!(cEntries & 15)) { void *pvNew = kHlpRealloc((void *)*ppapszVector, sizeof(char *) * (cEntries + 16 + 1)); if (pvNew) *ppapszVector = (const char **)pvNew; else return kwErrPrintfRc(2, "Out of memory!\n"); } (*ppapszVector)[cEntries] = pszAppend; (*ppapszVector)[++cEntries] = NULL; *pcEntries = cEntries; return 0; } /** * Parses arguments for --full-test. * * @returns 0 on success, non-zero on failure (exit code). */ static int kwFullTestRunParseArgs(PKWONETEST *ppHead, int *piState, int argc, char **argv, const char *pszDefaultCwd, int cRecursions, const char *pszJobSrc) { PKWONETEST pCur = *ppHead; int i; for (i = 0; i < argc; i++) { int rc = 0; const char *pszArg = argv[i]; if (*pszArg == 'k') { if (kHlpStrComp(pszArg, "kSubmit") == 0) { if (*piState != 0) { pCur = (PKWONETEST)kHlpAllocZ(sizeof(*pCur)); if (!pCur) return kwErrPrintfRc(2, "Out of memory!\n"); pCur->fVirgin = K_TRUE; pCur->pszCwd = pszDefaultCwd; pCur->cRuns = 1; pCur->pNext = *ppHead; *ppHead = pCur; *piState = 0; } else if (!pCur->fVirgin) return kwErrPrintfRc(2, "Unexpected 'kSubmit' as argument #%u\n", i); pCur->pszJobSrc = pszJobSrc; pCur->iJobSrc = i; continue; /* (to stay virgin) */ } /* Ignore "kWorker 378172/62:" sequences that kmk/kSubmit spews out on failure. */ if ( kHlpStrComp(pszArg, "kWorker") == 0 && i + 1 < argc && (unsigned)(argv[i + 1][0] - '0') <= 9) { i++; continue; } } if ( *pszArg == '-' && ( *piState == 0 || pszArg[1] == '@')) { const char *pszValue = NULL; char ch = *++pszArg; pszArg++; if (ch == '-') { ch = '\0'; if (*pszArg == '\0') /* -- */ *piState = 2; /* Translate or handle long options: */ else if (kHlpStrComp(pszArg, "putenv") == 0 || kHlpStrComp(pszArg, "set") == 0) ch = 'E'; else if (kHlpStrComp(pszArg, "special-env") == 0) ch = 's'; else if (kHlpStrComp(pszArg, "default-env") == 0) { unsigned i; pCur->cEnvVars = 0; for (i = 0; environ[i] && rc == 0; i++) rc = kwFullTestVectorAppend(&pCur->papszEnvVars, &pCur->cEnvVars, kHlpStrDup(environ[i])); /* leaks; unchecked */ } else if (kHlpStrComp(pszArg, "chdir") == 0) ch = 'C'; else if (kHlpStrComp(pszArg, "post-cmd") == 0) ch = 'P'; else if (kHlpStrComp(pszArg, "response-file") == 0) ch = '@'; else if (kHlpStrComp(pszArg, "runs") == 0) ch = 'R'; else if (kHlpStrComp(pszArg, "watcom-brain-damage") == 0) pCur->fWatcomBrainDamange = K_TRUE; else if (kHlpStrComp(pszArg, "no-pch-caching") == 0) pCur->fNoPchCaching = K_TRUE; else if (kHlpStrComp(pszArg, "executable") == 0) ch = 'e'; else if (kHlpStrComp(pszArg, "breakpoint") == 0) { __debugbreak(); continue; /* (to stay virgin) */ } else return kwErrPrintfRc(2, "Unknown option: --%s\n", pszArg); pszArg = ""; } while (ch != '\0' && rc == 0) { /* Fetch value if needed: */ switch (ch) { case '@': case 'e': case 'E': case 's': case 'C': case 'R': if (*pszArg == ':' || *pszArg == '=') pszValue = &pszArg[1]; else if (*pszArg) pszValue = pszArg; else if (i + 1 < argc) pszValue = argv[++i]; else return kwErrPrintfRc(2, "Option -%c takes a value\n", ch); pszArg = ""; break; } /* Handle the option: */ switch (ch) { case 'E': rc = kwFullTestVectorAppend(&pCur->papszEnvVars, &pCur->cEnvVars, pszValue); break; case 'C': pCur->pszCwd = pszValue; break; case 's': pCur->pszSpecialEnv = pszValue; break; case 'e': pCur->pszExecutable = pszValue; break; case 'P': *piState = 1; if (*pszArg) return kwErrPrintfRc(2, "Option -P cannot be followed by other options!\n"); break; case 'R': pCur->cRuns = atoi(pszValue); if ((int)pCur->cRuns < 0) return kwErrPrintfRc(2, "Option -R takes a positive (or zero) integer as value: %s\n", pszValue); break; case '@': if (cRecursions < 5) { char *pszLeaked = NULL; int cArgs = 0; char **papszArgsLeaked = kwFullTestLoadArgvFile(pszValue, &cArgs, &pszLeaked); if (papszArgsLeaked) { rc = kwFullTestRunParseArgs(ppHead, piState, cArgs, papszArgsLeaked, pszDefaultCwd, cRecursions + 1, pszValue); pCur = *ppHead; } else return 2; } else return kwErrPrintfRc(2, "Too deep response file nesting!\n"); break; } /* next */ ch = *pszArg++; } } else if (*piState == 2) rc = kwFullTestVectorAppend(&pCur->papszArgs, &pCur->cArgs, pszArg); else if (*piState == 1) { if (pszArg[0] != '-' || pszArg[1] != '-' || pszArg[2] != '\0') rc = kwFullTestVectorAppend(&pCur->papszPostCmdArgs, &pCur->cPostCmdArgs, pszArg); else *piState = 2; } else return kwErrPrintfRc(2, "Unexpected argument: %s\n", pszArg); if (rc) return rc; pCur->fVirgin = K_FALSE; } return 0; } /** * Handles what comes after --full-test. * * @returns Exit code. * @param argc Number of arguments after --full-test. * @param argv Arguments after --full-test. */ static int kwFullTestRun(int argc, char **argv) { char szDefaultCwd[MAX_PATH]; const char *pszDefaultCwd = getcwd(szDefaultCwd, sizeof(szDefaultCwd)); KWONETEST FirstTest; PKWONETEST pHead = &FirstTest; PKWONETEST pCur; int iState = 0; int rcExit; /* * Parse arguments. */ kHlpMemSet(&FirstTest, 0, sizeof(FirstTest)); FirstTest.pszJobSrc = "command-line"; FirstTest.iJobSrc = 1; FirstTest.fVirgin = K_TRUE; FirstTest.pszCwd = pszDefaultCwd; FirstTest.cRuns = 1; rcExit = kwFullTestRunParseArgs(&pHead, &iState, argc, argv, pszDefaultCwd, 0, "command-line"); if (rcExit) return rcExit; /* * Do the job. LIFO ordering (see kSubmit). */ for (pCur = pHead; pCur; pCur = pCur->pNext) { if (!pCur->pszExecutable && pCur->papszArgs) pCur->pszExecutable = pCur->papszArgs[0]; if ( pCur->pszExecutable && pCur->cArgs > 0 && pCur->cEnvVars > 0) { size_t const cbEnvVarCopy = sizeof(pCur->papszEnvVars[0]) * (pCur->cEnvVars + 1); char ** const papszEnvVarsCopy = (char **)kHlpDup(pCur->papszEnvVars, cbEnvVarCopy); unsigned iRun; for (iRun = 0; iRun < pCur->cRuns; iRun++) { rcExit = kSubmitHandleJobUnpacked(pCur->pszExecutable, pCur->pszCwd, pCur->cArgs, pCur->papszArgs, pCur->fWatcomBrainDamange, pCur->cEnvVars, pCur->papszEnvVars, pCur->pszSpecialEnv, pCur->fNoPchCaching, pCur->cPostCmdArgs, pCur->papszPostCmdArgs); KW_LOG(("rcExit=%d\n", rcExit)); kwSandboxCleanupLate(&g_Sandbox); memcpy((void *)pCur->papszEnvVars, papszEnvVarsCopy, cbEnvVarCopy); } kHlpFree(papszEnvVarsCopy); } else rcExit = kwErrPrintfRc(2, "Job is underspecified! %s%s%s (Job started with argument #%u, %s)\n", pCur->pszExecutable ? "" : " No executable!", pCur->cArgs < 1 ? " No arguments!" : "", pCur->cEnvVars < 1 ? " No environment!" : "", pCur->iJobSrc, pCur->pszJobSrc); } if (getenv("KWORKER_STATS") != NULL) kwPrintStats(); # ifdef WITH_LOG_FILE if (g_hLogFile != INVALID_HANDLE_VALUE && g_hLogFile != NULL) CloseHandle(g_hLogFile); # endif return rcExit; } /** * Helper for main() argument handling that sets the processor group if * possible. */ static void kwSetProcessorGroup(unsigned long uGroup) { typedef BOOL (WINAPI *PFNSETTHREADGROUPAFFINITY)(HANDLE, const GROUP_AFFINITY*, GROUP_AFFINITY *); HMODULE const hmodKernel32 = GetModuleHandleW(L"KERNEL32.DLL"); PFNSETTHREADGROUPAFFINITY pfnSetThreadGroupAffinity; pfnSetThreadGroupAffinity = (PFNSETTHREADGROUPAFFINITY)GetProcAddress(hmodKernel32, "SetThreadGroupAffinity"); if (pfnSetThreadGroupAffinity) { GROUP_AFFINITY OldAff = { 0, 0, 0, 0, 0 }; GROUP_AFFINITY NewAff = { 0, (WORD)uGroup, 0, 0, 0 }; NewAff.Mask = win_get_processor_group_active_mask((WORD)uGroup); if (NewAff.Mask && (WORD)uGroup == uGroup) { if (!pfnSetThreadGroupAffinity(GetCurrentThread(), &NewAff, &OldAff)) kwErrPrintf("Failed to set processor group to %lu (%p): %u\n", uGroup, NewAff.Mask, GetLastError()); } else if (GetLastError() == NO_ERROR) kwErrPrintf("Cannot set processor group to %lu: No active processors in group!\n", uGroup); else kwErrPrintf("Cannot set processor group to %lu: GetLogicalProcessorInformationEx failed: %u\n", uGroup, GetLastError()); } else { OSVERSIONINFOA VerInfo = {0}; if (VerInfo.dwMajorVersion > 6 || (VerInfo.dwMajorVersion == 6 && VerInfo.dwMinorVersion >= 1)) kwErrPrintf("Cannot set processor group to %lu: SetThreadGroupAffinity no found! (Windows version %lu.%lu)\n", uGroup, VerInfo.dwMajorVersion, VerInfo.dwMinorVersion); } } int main(int argc, char **argv) { #if defined(KBUILD_OS_WINDOWS) && defined(KBUILD_ARCH_X86) PVOID pvVecXcptHandler = AddVectoredExceptionHandler(0 /*called last*/, kwSandboxVecXcptEmulateChained); #endif KSIZE cbMsgBuf = 0; KU8 *pbMsgBuf = NULL; int i; HANDLE hPipe = INVALID_HANDLE_VALUE; const char *pszTmp; KFSLOOKUPERROR enmIgnored; DWORD dwType; #ifdef WITH_CONSOLE_OUTPUT_BUFFERING HANDLE hCurProc = GetCurrentProcess(); PPEB pPeb = kwSandboxGetProcessEnvironmentBlock(); PMY_RTL_USER_PROCESS_PARAMETERS pProcessParams = (PMY_RTL_USER_PROCESS_PARAMETERS)pPeb->ProcessParameters; #endif #if defined(KBUILD_OS_WINDOWS) && defined(KBUILD_ARCH_X86) K_NOREF(pvVecXcptHandler); #endif #ifdef WITH_FIXED_VIRTUAL_ALLOCS /* * Reserve memory for cl.exe */ for (i = 0; i < K_ELEMENTS(g_aFixedVirtualAllocs); i++) { g_aFixedVirtualAllocs[i].fInUse = K_FALSE; g_aFixedVirtualAllocs[i].pvReserved = VirtualAlloc((void *)g_aFixedVirtualAllocs[i].uFixed, g_aFixedVirtualAllocs[i].cbFixed, MEM_RESERVE, PAGE_READWRITE); if ( !g_aFixedVirtualAllocs[i].pvReserved || g_aFixedVirtualAllocs[i].pvReserved != (void *)g_aFixedVirtualAllocs[i].uFixed) { kwErrPrintf("Failed to reserve %p LB %#x: %u\n", g_aFixedVirtualAllocs[i].uFixed, g_aFixedVirtualAllocs[i].cbFixed, GetLastError()); if (g_aFixedVirtualAllocs[i].pvReserved) { VirtualFree(g_aFixedVirtualAllocs[i].pvReserved, g_aFixedVirtualAllocs[i].cbFixed, MEM_RELEASE); g_aFixedVirtualAllocs[i].pvReserved = NULL; } } } #endif /* * Register our Control-C and Control-Break handlers. */ if (!SetConsoleCtrlHandler(kwSandboxCtrlHandler, TRUE /*fAdd*/)) return kwErrPrintfRc(3, "SetConsoleCtrlHandler failed: %u\n", GetLastError()); /* * Create the cache and mark the temporary directory as using the custom revision. */ g_pFsCache = kFsCacheCreate(KFSCACHE_F_MISSING_OBJECTS | KFSCACHE_F_MISSING_PATHS); if (!g_pFsCache) return kwErrPrintfRc(3, "kFsCacheCreate failed!\n"); pszTmp = getenv("TEMP"); if (pszTmp && *pszTmp != '\0') kFsCacheSetupCustomRevisionForTree(g_pFsCache, kFsCacheLookupA(g_pFsCache, pszTmp, &enmIgnored)); pszTmp = getenv("TMP"); if (pszTmp && *pszTmp != '\0') kFsCacheSetupCustomRevisionForTree(g_pFsCache, kFsCacheLookupA(g_pFsCache, pszTmp, &enmIgnored)); pszTmp = getenv("TMPDIR"); if (pszTmp && *pszTmp != '\0') kFsCacheSetupCustomRevisionForTree(g_pFsCache, kFsCacheLookupA(g_pFsCache, pszTmp, &enmIgnored)); /* * Make g_abDefLdBuf executable. */ if (!VirtualProtect(g_abDefLdBuf, sizeof(g_abDefLdBuf), PAGE_EXECUTE_READWRITE, &dwType)) return kwErrPrintfRc(3, "VirtualProtect(%p, %#x, PAGE_EXECUTE_READWRITE,NULL) failed: %u\n", g_abDefLdBuf, sizeof(g_abDefLdBuf), GetLastError()); InitializeCriticalSection(&g_Sandbox.HandlesLock); InitializeCriticalSection(&g_Sandbox.VirtualAllocLock); #ifdef WITH_CONSOLE_OUTPUT_BUFFERING /* * Get and duplicate the console handles. */ /* Standard output. */ g_Sandbox.StdOut.hOutput = pProcessParams->StandardOutput; if (!DuplicateHandle(hCurProc, pProcessParams->StandardOutput, hCurProc, &g_Sandbox.StdOut.hBackup, GENERIC_WRITE, FALSE /*fInherit*/, DUPLICATE_SAME_ACCESS)) kHlpAssertFailedStmt(g_Sandbox.StdOut.hBackup = pProcessParams->StandardOutput); dwType = GetFileType(g_Sandbox.StdOut.hOutput); g_Sandbox.StdOut.fIsConsole = dwType == FILE_TYPE_CHAR; g_Sandbox.StdOut.fFileType = (dwType & ~FILE_TYPE_REMOTE) < 0xf ? (KU8)((dwType & ~FILE_TYPE_REMOTE) | (dwType >> 8)) : KU8_MAX; g_Sandbox.HandleStdOut.enmType = KWHANDLETYPE_OUTPUT_BUF; g_Sandbox.HandleStdOut.cRefs = 0x10001; g_Sandbox.HandleStdOut.dwDesiredAccess = GENERIC_WRITE; g_Sandbox.HandleStdOut.tidOwner = KU32_MAX; g_Sandbox.HandleStdOut.u.pOutBuf = &g_Sandbox.StdOut; g_Sandbox.HandleStdOut.hHandle = g_Sandbox.StdOut.hOutput; if (g_Sandbox.StdOut.hOutput != INVALID_HANDLE_VALUE) { if (kwSandboxHandleTableEnter(&g_Sandbox, &g_Sandbox.HandleStdOut, g_Sandbox.StdOut.hOutput)) g_Sandbox.cFixedHandles++; else return kwErrPrintfRc(3, "kwSandboxHandleTableEnter failed for StdOut (%p)!\n", g_Sandbox.StdOut.hOutput); } KWOUT_LOG(("StdOut: hOutput=%p (%p) fIsConsole=%d dwType=%#x\n", g_Sandbox.StdOut.hOutput, g_Sandbox.StdOut.hBackup, g_Sandbox.StdOut.fIsConsole, dwType)); /* Standard error. */ g_Sandbox.StdErr.hOutput = pProcessParams->StandardError; if (!DuplicateHandle(hCurProc, pProcessParams->StandardError, hCurProc, &g_Sandbox.StdErr.hBackup, GENERIC_WRITE, FALSE /*fInherit*/, DUPLICATE_SAME_ACCESS)) kHlpAssertFailedStmt(g_Sandbox.StdErr.hBackup = pProcessParams->StandardError); dwType = GetFileType(g_Sandbox.StdErr.hOutput); g_Sandbox.StdErr.fIsConsole = dwType == FILE_TYPE_CHAR; g_Sandbox.StdErr.fFileType = (dwType & ~FILE_TYPE_REMOTE) < 0xf ? (KU8)((dwType & ~FILE_TYPE_REMOTE) | (dwType >> 8)) : KU8_MAX; g_Sandbox.HandleStdErr.enmType = KWHANDLETYPE_OUTPUT_BUF; g_Sandbox.HandleStdErr.cRefs = 0x10001; g_Sandbox.HandleStdErr.dwDesiredAccess = GENERIC_WRITE; g_Sandbox.HandleStdErr.tidOwner = KU32_MAX; g_Sandbox.HandleStdErr.u.pOutBuf = &g_Sandbox.StdErr; g_Sandbox.HandleStdErr.hHandle = g_Sandbox.StdErr.hOutput; if ( g_Sandbox.StdErr.hOutput != INVALID_HANDLE_VALUE && g_Sandbox.StdErr.hOutput != g_Sandbox.StdOut.hOutput) { if (kwSandboxHandleTableEnter(&g_Sandbox, &g_Sandbox.HandleStdErr, g_Sandbox.StdErr.hOutput)) g_Sandbox.cFixedHandles++; else return kwErrPrintfRc(3, "kwSandboxHandleTableEnter failed for StdErr (%p)!\n", g_Sandbox.StdErr.hOutput); } KWOUT_LOG(("StdErr: hOutput=%p (%p) fIsConsole=%d dwType=%#x\n", g_Sandbox.StdErr.hOutput, g_Sandbox.StdErr.hBackup, g_Sandbox.StdErr.fIsConsole, dwType)); /* Combined console buffer. */ if (g_Sandbox.StdErr.fIsConsole) { g_Sandbox.Combined.hOutput = g_Sandbox.StdErr.hBackup; g_Sandbox.Combined.uCodepage = GetConsoleCP(); } else if (g_Sandbox.StdOut.fIsConsole) { g_Sandbox.Combined.hOutput = g_Sandbox.StdOut.hBackup; g_Sandbox.Combined.uCodepage = GetConsoleCP(); } else { g_Sandbox.Combined.hOutput = INVALID_HANDLE_VALUE; g_Sandbox.Combined.uCodepage = CP_ACP; } KWOUT_LOG(("Combined: hOutput=%p uCodepage=%d\n", g_Sandbox.Combined.hOutput, g_Sandbox.Combined.uCodepage)); #endif /* WITH_CONSOLE_OUTPUT_BUFFERING */ /* * Parse arguments. */ for (i = 1; i < argc; i++) { if (strcmp(argv[i], "--pipe") == 0) { i++; if (i < argc) { char *pszEnd = NULL; unsigned __int64 u64Value = _strtoui64(argv[i], &pszEnd, 16); if ( *argv[i] && pszEnd != NULL && *pszEnd == '\0' && u64Value != 0 && u64Value != (uintptr_t)INVALID_HANDLE_VALUE && (uintptr_t)u64Value == u64Value) hPipe = (HANDLE)(uintptr_t)u64Value; else return kwErrPrintfRc(2, "Invalid --pipe argument: %s\n", argv[i]); } else return kwErrPrintfRc(2, "--pipe takes an argument!\n"); } else if (strcmp(argv[i], "--volatile") == 0) { i++; if (i < argc) kFsCacheSetupCustomRevisionForTree(g_pFsCache, kFsCacheLookupA(g_pFsCache, argv[i], &enmIgnored)); else return kwErrPrintfRc(2, "--volatile takes an argument!\n"); } else if (strcmp(argv[i], "--test") == 0) return kwTestRun(argc - i - 1, &argv[i + 1]); else if (strcmp(argv[i], "--full-test") == 0) return kwFullTestRun(argc - i - 1, &argv[i + 1]); else if (strcmp(argv[i], "--priority") == 0) { i++; if (i < argc) { char *pszEnd = NULL; unsigned long uValue = strtoul(argv[i], &pszEnd, 16); if ( *argv[i] && pszEnd != NULL && *pszEnd == '\0' && uValue >= 1 && uValue <= 5) { DWORD dwClass; int dwPriority; switch (uValue) { case 1: dwClass = IDLE_PRIORITY_CLASS; dwPriority = THREAD_PRIORITY_IDLE; break; case 2: dwClass = BELOW_NORMAL_PRIORITY_CLASS; dwPriority = THREAD_PRIORITY_BELOW_NORMAL; break; default: case 3: dwClass = NORMAL_PRIORITY_CLASS; dwPriority = THREAD_PRIORITY_NORMAL; break; case 4: dwClass = HIGH_PRIORITY_CLASS; dwPriority = INT_MAX; break; case 5: dwClass = REALTIME_PRIORITY_CLASS; dwPriority = INT_MAX; break; } SetPriorityClass(GetCurrentProcess(), dwClass); if (dwPriority != INT_MAX) SetThreadPriority(GetCurrentThread(), dwPriority); } else return kwErrPrintfRc(2, "Invalid --priority argument: %s\n", argv[i]); } else return kwErrPrintfRc(2, "--priority takes an argument!\n"); } else if (strcmp(argv[i], "--group") == 0) { i++; if (i < argc) { char *pszEnd = NULL; unsigned long uValue = strtoul(argv[i], &pszEnd, 16); if ( *argv[i] && pszEnd != NULL && *pszEnd == '\0' && uValue == (WORD)uValue) kwSetProcessorGroup(uValue); else return kwErrPrintfRc(2, "Invalid --priority argument: %s\n", argv[i]); } else return kwErrPrintfRc(2, "--priority takes an argument!\n"); } else if ( strcmp(argv[i], "--verbose") == 0 || strcmp(argv[i], "-v") == 0) g_cVerbose++; else if ( strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-?") == 0) { printf("usage: kWorker [--volatile dir] [--priority <1-5>] [--group <processor-grp>\n" "usage: kWorker <--help|-h>\n" "usage: kWorker <--version|-V>\n" "usage: kWorker [--volatile dir] --full-test kSubmit ...\n" "usage: kWorker [--volatile dir] --test [<times> [--chdir <dir>] [--breakpoint] -- args\n" "\n" "This is an internal kmk program that is used via the builtin_kSubmit.\n"); return 0; } else if ( strcmp(argv[i], "--version") == 0 || strcmp(argv[i], "-V") == 0) return kbuild_version(argv[0]); else return kwErrPrintfRc(2, "Unknown argument '%s'\n", argv[i]); } /* * If no --pipe argument, then assume its standard input. * We need to carefully replace the CRT stdin with a handle to "nul". */ if (hPipe == INVALID_HANDLE_VALUE) { hPipe = GetStdHandle(STD_INPUT_HANDLE); if (GetFileType(hPipe) == FILE_TYPE_PIPE) { HANDLE hDuplicate = INVALID_HANDLE_VALUE; if (DuplicateHandle(GetCurrentProcess(), hPipe, GetCurrentProcess(), &hDuplicate, 0, FALSE, DUPLICATE_SAME_ACCESS)) { int fdNul = _wopen(L"nul", O_RDWR | O_BINARY); if (fdNul >= 0) { if (_dup2(fdNul, 0) >= 0) { close(fdNul); hPipe = hDuplicate; } else return kwErrPrintfRc(2, "DuplicateHandle pipe failed: %u\n", GetLastError()); } else return kwErrPrintfRc(2, "DuplicateHandle pipe failed: %u\n", GetLastError()); } else return kwErrPrintfRc(2, "DuplicateHandle pipe failed: %u\n", GetLastError()); } else return kwErrPrintfRc(2, "No --pipe <pipe-handle> argument and standard input is not a valid pipe handle (%#x, %u)\n", GetFileType(hPipe), GetLastError()); } else if (GetFileType(hPipe) != FILE_TYPE_PIPE) return kwErrPrintfRc(2, "The specified --pipe %p is not a pipe handle: type %#x (last err %u)!\n", GetFileType(hPipe), GetLastError()); g_hPipe = hPipe; /* * Serve the pipe. */ for (;;) { KU32 cbMsg = 0; int rc = kSubmitReadIt(hPipe, &cbMsg, sizeof(cbMsg), K_TRUE /*fShutdownOkay*/); if (rc == 0) { /* Make sure the message length is within sane bounds. */ if ( cbMsg > 4 && cbMsg <= 256*1024*1024) { /* Reallocate the message buffer if necessary. We add 4 zero bytes. */ if (cbMsg + 4 <= cbMsgBuf) { /* likely */ } else { cbMsgBuf = K_ALIGN_Z(cbMsg + 4, 2048); pbMsgBuf = kHlpRealloc(pbMsgBuf, cbMsgBuf); if (!pbMsgBuf) return kwErrPrintfRc(1, "Failed to allocate %u bytes for a message buffer!\n", cbMsgBuf); } /* Read the whole message into the buffer, making sure there is are a 4 zero bytes following it. */ *(KU32 *)pbMsgBuf = cbMsg; rc = kSubmitReadIt(hPipe, &pbMsgBuf[sizeof(cbMsg)], cbMsg - sizeof(cbMsg), K_FALSE /*fShutdownOkay*/); if (rc == 0) { const char *psz; pbMsgBuf[cbMsg] = '\0'; pbMsgBuf[cbMsg + 1] = '\0'; pbMsgBuf[cbMsg + 2] = '\0'; pbMsgBuf[cbMsg + 3] = '\0'; /* The first string after the header is the command. */ psz = (const char *)&pbMsgBuf[sizeof(cbMsg)]; if ( strcmp(psz, "JOB") == 0 && g_rcCtrlC == 0) { struct { KI32 rcExitCode; KU8 bExiting; KU8 abZero[3]; } Reply; Reply.rcExitCode = kSubmitHandleJob(psz, cbMsg - sizeof(cbMsg)); Reply.bExiting = g_fRestart; Reply.abZero[0] = 0; Reply.abZero[1] = 0; Reply.abZero[2] = 0; rc = kSubmitWriteIt(hPipe, &Reply, sizeof(Reply)); if ( rc == 0 && !g_fRestart) { kwSandboxCleanupLate(&g_Sandbox); if (g_rcCtrlC == 0) continue; } } else rc = kwErrPrintfRc(-1, "Unknown command: '%s'\n", psz); } } else rc = kwErrPrintfRc(-1, "Bogus message length: %u (%#x)\n", cbMsg, cbMsg); } /* * If we're exitting because we're restarting, we need to delay till * kmk/kSubmit has read the result. Windows documentation says it * immediately discards pipe buffers once the pipe is broken by the * server (us). So, We flush the buffer and queues a 1 byte read * waiting for kSubmit to close the pipe when it receives the * bExiting = K_TRUE result. */ if (g_fRestart) { DWORD cbIgnored = 1; KU8 b; FlushFileBuffers(hPipe); ReadFile(hPipe, &b, 1, &cbIgnored, NULL); } CloseHandle(hPipe); #ifdef WITH_LOG_FILE if (g_hLogFile != INVALID_HANDLE_VALUE && g_hLogFile != NULL) CloseHandle(g_hLogFile); #endif if (getenv("KWORKER_STATS") != NULL) kwPrintStats(); return g_rcCtrlC != 0 ? g_rcCtrlC : rc > 0 ? 0 : 1; } } /** @page pg_kWorker kSubmit / kWorker * * @section sec_kWorker_Motivation Motivation / Inspiration * * The kSubmit / kWorker combo was conceived as a way to speed up VirtualBox * builds on machines "infested" by Anti Virus protection and disk encryption * software. Build times jumping from 35-40 min to 77-82 min after the machine * got "infected". * * Speeing up builting of Boot Sector Kit \#3 was also hightly desirable. It is * mainly a bunch of tiny assembly and C files being compiler a million times. * As some of us OS/2 users maybe recalls, the Watcom make program can run its * own toolchain from within the same process, saving a lot of process creation * and teardown overhead. * * * @section sec_kWorker_kSubmit About kSubmit * * When wanting to execute a job in a kWorker instance, it must be submitted * using the kmk_builtin_kSubmit command in kmk. As the name suggest, this is * built into kmk and does not exist as an external program. The reason for * this is that it keep track of the kWorker instances. * * The kSubmit command has the --32-bit and --64-bit options for selecting * between 32-bit and 64-bit worker instance. We generally assume the user of * the command knows which bit count the executable has, so kSubmit is spared * the extra work of finding out. * * The kSubmit command shares a environment and current directory manipulation * with the kRedirect command, but not the file redirection. So long no file * operation is involed, kSubmit is a drop in kRedirect replacement. This is * hand for tools like OpenWatcom, NASM and YASM which all require environment * and/or current directory changes to work. * * Unlike the kRedirect command, the kSubmit command can also specify an * internall post command to be executed after the main command succeeds. * Currently only kmk_builtin_kDepObj is supported. kDepObj gathers dependency * information from Microsoft COFF object files and Watcom OMF object files and * is scheduled to replace kDepIDB. * * * @section sec_kWorker_Interaction kSubmit / kWorker interaction * * The kmk_builtin_kSubmit communicates with the kWorker instances over pipes. * A job request is written by kSubmit and kWorker read, unpacks it and executes * it. When the job is completed, kWorker writes a short reply with the exit * code and an internal status indicating whether it is going to restart. * * The kWorker intance will reply to kSubmit before completing all the internal * cleanup work, so as not to delay the next job execution unnecessarily. This * includes checking its own memory consumption and checking whether it needs * restarting. So, a decision to restart unfortunately have to wait till after * the next job has completed. This is a little bit unfortunate if the next job * requires a lot of memory and kWorker has already leaked/used a lot. * * * @section sec_kWorker_How_Works How kWorker Works * * kWorker will load the executable specified by kSubmit into memory and call * it's entrypoint in a lightly sandbox'ed environment. * * * @subsection ssec_kWorker_Loaing Image loading * * kWorker will manually load all the executable images into memory, fix them * up, and make a copy of the virgin image so it can be restored using memcpy * the next time it is used. * * Imported functions are monitored and replacements used for a few of them. * These replacements are serve the following purposes: * - Provide a different command line. * - Provide a different environment. * - Intercept process termination. * - Intercept thread creation (only linker is allowed to create threads). * - Intercept file reading for caching (header files, ++) as file system * access is made even slower by anti-virus software. * - Intercept crypto hash APIs to cache MD5 digests of header files * (c1.dll / c1xx.dll spends a noticable bit of time doing MD5). * - Intercept temporary files (%TEMP%/_CL_XXXXXXyy) to keep the entirely * in memory as writing files grows expensive with encryption and * anti-virus software active. * - Intercept some file system queries to use the kFsCache instead of * going to the kernel and slowly worm thru the AV filter driver. * - Intercept standard output/error and console writes to aggressivly * buffer the output. The MS CRT does not buffer either when it goes to * the console, resulting in terrible performance and mixing up output * with other compile jobs. * This also allows us to filter out the annoying source file announcements * by cl.exe. * - Intercept VirtualAlloc and VirtualFree to prevent * CL.EXE/C1.DLL/C1XX.DLL from leaking some 72MB internal allocat area. * - Intercept FlsAlloc/FlsFree to make sure the allocations are freed and * the callbacks run after each job. * - Intercept HeapCreate/HeapFree to reduce leaks from statically linked * executables and tools using custom heaps (like the microsoft linker). * [exectuable images only] * - Intercept atexit and _onexit registration to be able run them after * each job instead of crashing as kWorker exits. This also helps avoid * some leaks. [executable image only] * * DLLs falls into two categories, system DLLs which we always load using the * native loader, and tool DLLs which can be handled like the executable or * optionally using the native loader. We maintain a hardcoded white listing of * tool DLLs we trust to load using the native loader. * * Imports of natively loaded DLLs are processed too, but we only replace a * subset of the functions compared to natively loaded excutable and DLL images. * * DLLs are never unloaded and we cache LoadLibrary requests (hash the input). * This is to speed up job execution. * * It was thought that we needed to restore (memcpy) natively loaded tool DLLs * for each job run, but so far this hasn't been necessary. * * * @subsection ssec_kWorker_Optimizing Optimizing the Compiler * * The Visual Studio 2010 C/C++ compiler does a poor job at processing header * files and uses a whole bunch of temporary files (in %TEMP%) for passing * intermediate representation between the first (c1/c1xx.dll) and second pass * (c2.dll). * * kWorker helps the compiler as best as it can. Given a little knowledge about * stable and volatile file system areas, it can do a lot of caching that a * normal compiler driver cannot easily do when given a single file. * * * @subsubsection sssec_kWorker_Headers Cache Headers Files and Searches * * The preprocessor part will open and process header files exactly as they are * encountered in the source files. If string.h is included by the main source * and five other header files, it will be searched for (include path), opened, * read, MD5-summed, and pre-processed six times. The last five times is just a * waste of time because of the guards or \#pragma once. A smart compiler would * make a little extra effort and realize this. * * kWorker will cache help the preprocessor by remembering places where the * header was not found with help of kFsCache, and cache the file in memory when * found. The first part is taken care of by intercepting GetFileAttributesW, * and the latter by intercepting CreateFileW, ReadFile and CloseFile. Once * cached, the file is kept open and the CreateFileW call returns a duplicate of * that handle. An internal handle table is used by ReadFile and CloseFile to * keep track of intercepted handles (also used for temporary file, temporary * file mappings, console buffering, and standard out/err buffering). * * PS. The header search optimization also comes in handy when cl.exe goes on * thru the whole PATH looking for c1/c1xx.exe and c2.exe after finding * c1/c1xx.dll and c2.dll. My guess is that the compiler team can * optionally compile the three pass DLLs as executables during development * and problem analysis. * * * @subsubsection sssec_kWorker_Temp_Files Temporary Files In Memory * * The issues of the temporary files is pretty severe on the Dell machine used * for benchmarking with full AV and encryption. The synthetic benchmark * improved by 30% when kWorker implemented measures to keep them entirely in * memory. * * kWorker implement these by recognizing the filename pattern in CreateFileW * and creating/opening the given file as needed. The handle returned is a * duplicate of the current process, thus giving us a good chance of catching * API calls we're not intercepting. * * In addition to CreateFileW, we also need to intercept GetFileType, ReadFile, * WriteFile, SetFilePointer+Ex, SetEndOfFile, and CloseFile. The 2nd pass * additionally requires GetFileSize+Ex, CreateFileMappingW, MapViewOfFile and * UnmapViewOfFile. * * * @section sec_kWorker_Numbers Some measurements. * * - r2881 building src/VBox/Runtime: * - without: 2m01.016388s = 120.016388 s * - with: 1m15.165069s = 75.165069 s => 120.016388s - 75.165069s = 44.851319s => 44.85/120.02 = 37% speed up. * - r2884 building vbox/debug (r110512): * - without: 11m14.446609s = 674.446609 s * - with: 9m01.017344s = 541.017344 s => 674.446609s - 541.017344s = 133.429265 => 133.43/674.45 = 19% speed up * - r2896 building vbox/debug (r110577): * - with: 8m31.182384s = 511.182384 s => 674.446609s - 511.182384s = 163.264225 = 163.26/674.45 = 24% speed up * - r2920 building vbox/debug (r110702) on Skylake (W10/amd64, only standard * MS Defender as AV): * - without: 10m24.990389s = 624.990389s * - with: 08m04.738184s = 484.738184s * - delta: 624.99s - 484.74s = 140.25s * - saved: 140.25/624.99 = 22% faster * * * @subsection subsec_kWorker_Early_Numbers Early Experiments * * These are some early experiments doing 1024 compilations of * VBoxBS2Linker.cpp using a hard coded command line and looping in kWorker's * main function: * * Skylake (W10/amd64, only stdandard MS defender): * - cmd 1: 48 /1024 = 0x0 (0.046875) [for /l %i in (1,1,1024) do ...] * - kmk 1: 44 /1024 = 0x0 (0.04296875) [all: ; 1024 x cl.exe] * - run 1: 37 /1024 = 0x0 (0.0361328125) [just process creation gain] * - run 2: 34 /1024 = 0x0 (0.033203125) [get file attribs] * - run 3: 32.77 /1024 = 0x0 (0.032001953125) [read caching of headers] * - run 4: 32.67 /1024 = 0x0 (0.031904296875) [loader tweaking] * - run 5: 29.144/1024 = 0x0 (0.0284609375) [with temp files in memory] * * Dell (W7/amd64, infected by mcafee): * - kmk 1: 285.278/1024 = 0x0 (0.278591796875) * - run 1: 134.503/1024 = 0x0 (0.1313505859375) [w/o temp files in memory] * - run 2: 78.161/1024 = 0x0 (0.0763291015625) [with temp files in memory] * * The command line: * @code{.cpp} "\"E:/vbox/svn/trunk/tools/win.x86/vcc/v10sp1/bin/amd64/cl.exe\" -c -c -TP -nologo -Zi -Zi -Zl -GR- -EHsc -GF -Zc:wchar_t- -Oy- -MT -W4 -Wall -wd4065 -wd4996 -wd4127 -wd4706 -wd4201 -wd4214 -wd4510 -wd4512 -wd4610 -wd4514 -wd4820 -wd4365 -wd4987 -wd4710 -wd4061 -wd4986 -wd4191 -wd4574 -wd4917 -wd4711 -wd4611 -wd4571 -wd4324 -wd4505 -wd4263 -wd4264 -wd4738 -wd4242 -wd4244 -WX -RTCsu -IE:/vbox/svn/trunk/tools/win.x86/vcc/v10sp1/include -IE:/vbox/svn/trunk/tools/win.x86/vcc/v10sp1/atlmfc/include -IE:/vbox/svn/trunk/tools/win.x86/sdk/v7.1/Include -IE:/vbox/svn/trunk/include -IE:/vbox/svn/trunk/out/win.amd64/debug -IE:/vbox/svn/trunk/tools/win.x86/vcc/v10sp1/include -IE:/vbox/svn/trunk/tools/win.x86/vcc/v10sp1/atlmfc/include -DVBOX -DVBOX_WITH_64_BITS_GUESTS -DVBOX_WITH_REM -DVBOX_WITH_RAW_MODE -DDEBUG -DDEBUG_bird -DDEBUG_USERNAME=bird -DRT_OS_WINDOWS -D__WIN__ -DRT_ARCH_AMD64 -D__AMD64__ -D__WIN64__ -DVBOX_WITH_DEBUGGER -DRT_LOCK_STRICT -DRT_LOCK_STRICT_ORDER -DIN_RING3 -DLOG_DISABLED -DIN_BLD_PROG -D_CRT_SECURE_NO_DEPRECATE -FdE:/vbox/svn/trunk/out/win.amd64/debug/obj/VBoxBs2Linker/VBoxBs2Linker-obj.pdb -FD -FoE:/vbox/svn/trunk/out/win.amd64/debug/obj/VBoxBs2Linker/VBoxBs2Linker.obj E:\\vbox\\svn\\trunk\\src\\VBox\\ValidationKit\\bootsectors\\VBoxBs2Linker.cpp" * @endcode */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/��������������������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377504�014260� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/md5.h���������������������������������������������������������������������������0000664�0001750�0001750�00000000615�14670377415�015121� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MD5_H #define MD5_H #include "mytypes.h" struct MD5Context { uint32_t buf[4]; uint32_t bits[2]; unsigned char in[64]; }; void MD5Init(struct MD5Context *); void MD5Update(struct MD5Context *, const unsigned char *, unsigned); void MD5Final(unsigned char digest[16], struct MD5Context *); void MD5Transform(uint32_t buf[4], uint32_t in[16]); #endif /* !MD5_H */ �������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/md5.c���������������������������������������������������������������������������0000664�0001750�0001750�00000017524�14670377415�015123� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. */ #include <string.h> #include "md5.h" #define uint32 uint32_t #include "k/kDefs.h" #if K_ENDIAN == K_ENDIAN_LITTLE # define byteReverse(buf, len) do { /* Nothing */ } while (0) #else /* * Note: this code is harmless on little-endian machines. */ void byteReverse(unsigned char *buf, unsigned longs) { uint32 t; do { t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | ((unsigned) buf[1] << 8 | buf[0]); *(uint32 *) buf = t; buf += 4; } while (--longs); } #endif /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ void MD5Init(struct MD5Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; ctx->buf[3] = 0x10325476; ctx->bits[0] = 0; ctx->bits[1] = 0; } /* * Update context to reflect the concatenation of another buffer full * of bytes. */ void MD5Update(struct MD5Context *ctx, const unsigned char *buf, unsigned len) { uint32 t; /* Update bitcount */ t = ctx->bits[0]; if ((ctx->bits[0] = t + ((uint32) len << 3)) < t) ctx->bits[1]++; /* Carry from low to high */ ctx->bits[1] += len >> 29; t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ /* Handle any leading odd-sized chunks */ if (t) { unsigned char *p = (unsigned char *) ctx->in + t; t = 64 - t; if (len < t) { memcpy(p, buf, len); return; } memcpy(p, buf, t); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32 *) ctx->in); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { memcpy(ctx->in, buf, 64); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32 *) ctx->in); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ memcpy(ctx->in, buf, len); } /* * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void MD5Final(unsigned char digest[16], struct MD5Context *ctx) { unsigned count; unsigned char *p; /* Compute number of bytes mod 64 */ count = (ctx->bits[0] >> 3) & 0x3F; /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ p = ctx->in + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ count = 64 - 1 - count; /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32 *) ctx->in); /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count - 8); } byteReverse(ctx->in, 14); /* Append length in bits and transform */ ((uint32 *) ctx->in)[14] = ctx->bits[0]; ((uint32 *) ctx->in)[15] = ctx->bits[1]; MD5Transform(ctx->buf, (uint32 *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } /* The four core functions - F1 is optimized somewhat */ /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f, w, x, y, z, data, s) \ ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ void MD5Transform(uint32 buf[4], uint32 in[16]) { register uint32 a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/�������������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377515�015524� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/��������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�016421� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Makefile.kmk��������������������������������������������������������0000664�0001750�0001750�00000006370�14670377514�020650� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kHlp - The Helper API, sub-makefile. # # # Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. SUB_DEPTH = .. include $(PATH_KBUILD)/subheader.kmk # # kHlpBaseStatic # LIBRARIES += kHlpBareStatic kHlpBareStatic_TEMPLATE = kStuffLIB kHlpBareStatic_SOURCES = \ Generic/kHlpMemChr.c \ Generic/kHlpMemComp.c \ Generic/kHlpMemPComp.c \ Generic/kHlpMemICompAscii.c \ Generic/kHlpMemCopy.c \ Generic/kHlpMemPCopy.c \ Generic/kHlpMemMove.c \ Generic/kHlpMemPMove.c \ Generic/kHlpMemSet.c \ Generic/kHlpMemPSet.c \ Generic/kHlpStrCat.c \ Generic/kHlpStrPCat.c \ Generic/kHlpStrNCat.c \ Generic/kHlpStrNPCat.c \ Generic/kHlpStrChr.c \ Generic/kHlpStrRChr.c \ Generic/kHlpStrComp.c \ Generic/kHlpStrPComp.c \ Generic/kHlpStrNComp.c \ Generic/kHlpStrNPComp.c \ Generic/kHlpStrICompAscii.c \ Generic/kHlpStrIPCompAscii.c \ Generic/kHlpStrNICompAscii.c \ Generic/kHlpStrNIPCompAscii.c \ Generic/kHlpStrCopy.c \ Generic/kHlpStrPCopy.c \ Generic/kHlpStrLen.c \ Generic/kHlpStrNLen.c \ Generic/kHlpInt2Ascii.c \ \ Generic/kHlpGetEnvUZ.c \ \ Generic/kHlpGetExt.c \ Generic/kHlpGetFilename.c \ Generic/kHlpIsFilenameOnly.c \ \ Generic/kHlpPage.c \ \ Bare/kHlpBareAssert.c \ Bare/kHlpBareHeap.c \ Bare/kHlpBareEnv.c \ Bare/kHlpBareProcess.c \ Bare/kHlpBareThread.c \ kHlpBareStatic_SOURCES.darwin = \ Bare/kHlpSys-darwin.c # # kCrtStatic # LIBRARIES += kHlpCRTStatic kHlpCRTStatic_TEMPLATE = kStuffLIB kHlpCRTStatic_SOURCES = \ Generic/kHlpMemPComp.c \ Generic/kHlpMemICompAscii.c \ Generic/kHlpStrPCat.c \ Generic/kHlpStrNPCat.c \ Generic/kHlpStrPComp.c \ Generic/kHlpStrNPComp.c \ Generic/kHlpStrICompAscii.c \ Generic/kHlpStrIPCompAscii.c \ Generic/kHlpStrNICompAscii.c \ Generic/kHlpStrNIPCompAscii.c \ Generic/kHlpStrPCopy.c \ Generic/kHlpStrNLen.c \ Generic/kHlpInt2Ascii.c \ \ Generic/kHlpGetEnvUZ.c \ \ Generic/kHlpGetExt.c \ Generic/kHlpGetFilename.c \ Generic/kHlpIsFilenameOnly.c \ \ Generic/kHlpPage.c \ \ CRT/kHlpCRTAlloc.cpp \ CRT/kHlpCRTEnv.cpp \ CRT/kHlpCRTString.cpp \ kHlpCRTStatic_SOURCES.darwin = \ Bare/kHlpSys-darwin.c # Generate the rules include $(PATH_KBUILD)/subfooter.kmk ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/CRT/����������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�017051� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/CRT/kHlpCRTAlloc.cpp������������������������������������������������0000664�0001750�0001750�00000004215�14670377514�022001� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpCRTAlloc.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpAlloc - Memory Allocation, CRT based implementation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpAlloc.h> #include <stdlib.h> #include <string.h> KHLP_DECL(void *) kHlpAlloc(KSIZE cb) { return malloc(cb); } KHLP_DECL(void *) kHlpAllocZ(KSIZE cb) { return calloc(1, cb); } KHLP_DECL(void *) kHlpDup(const void *pv, KSIZE cb) { void *pvDup = kHlpAlloc(cb); if (pvDup) return memcpy(pvDup, pv, cb); return NULL; } KHLP_DECL(char *) kHlpStrDup(const char *psz) { size_t cb = strlen(psz) + 1; return (char *)kHlpDup(psz, cb); } KHLP_DECL(void *) kHlpRealloc(void *pv, KSIZE cb) { return realloc(pv, cb); } KHLP_DECL(void) kHlpFree(void *pv) { if (pv) free(pv); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/CRT/kHlpCRTEnv.cpp��������������������������������������������������0000664�0001750�0001750�00000003761�14670377514�021504� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpCRTEnv.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpEnv - Environment Manipulation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpEnv.h> #include <k/kHlpString.h> #include <k/kErrors.h> #include <stdlib.h> KHLP_DECL(int) kHlpGetEnv(const char *pszVar, char *pszVal, KSIZE cchVal) { int rc = 0; const char *pszValue = getenv(pszVar); if (pszValue) { KSIZE cch = kHlpStrLen((const char *)pszValue); if (cchVal > cch) kHlpMemCopy(pszVal, pszValue, cch + 1); else rc = KERR_BUFFER_OVERFLOW; } else rc = KERR_ENVVAR_NOT_FOUND; return rc; } ���������������kbuild-3608/src/lib/kStuff/kHlp/CRT/kHlpCRTString.cpp�����������������������������������������������0000664�0001750�0001750�00000006746�14670377514�022230� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpCRTString.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - String And Memory Routines, CRT based implementation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> #include <string.h> #ifndef kHlpMemChr void *kHlpMemChr(const void *pv, int ch, KSIZE cb) { return (void *)memchr(pv, ch, cb); } #endif #ifndef kHlpMemComp int kHlpMemComp(const void *pv1, const void *pv2, KSIZE cb) { return memcmp(pv1, pv2, cb); } #endif #ifndef kHlpMemCopy void *kHlpMemCopy(void *pv1, const void *pv2, KSIZE cb) { return memcpy(pv1, pv2, cb); } #endif #ifndef kHlpMemPCopy void *kHlpMemPCopy(void *pv1, const void *pv2, KSIZE cb) { return (KU8 *)memcpy(pv1, pv2, cb) + cb; } #endif #ifndef kHlpMemMove void *kHlpMemMove(void *pv1, const void *pv2, KSIZE cb) { return memmove(pv1, pv2, cb); } #endif #ifndef kHlpMemPMove void *kHlpMemPMove(void *pv1, const void *pv2, KSIZE cb) { return (KU8 *)memmove(pv1, pv2, cb) + cb; } #endif #ifndef kHlpMemSet void *kHlpMemSet(void *pv1, int ch, KSIZE cb) { return memset(pv1, ch, cb); } #endif #ifndef kHlpMemPSet void *kHlpMemPSet(void *pv1, int ch, KSIZE cb) { return (KU8 *)memset(pv1, ch, cb) + cb; } #endif #ifndef kHlpStrCat char *kHlpStrCat(char *psz1, const char *psz2) { return strcat(psz1, psz2); } #endif #ifndef kHlpStrNCat char *kHlpStrNCat(char *psz1, const char *psz2, KSIZE cb) { return strncat(psz1, psz2, cb); } #endif #ifndef kHlpStrChr char *kHlpStrChr(const char *psz, int ch) { return (char *)strchr(psz, ch); } #endif #ifndef kHlpStrRChr char *kHlpStrRChr(const char *psz, int ch) { return (char *)strrchr(psz, ch); } #endif #ifndef kHlpStrComp int kHlpStrComp(const char *psz1, const char *psz2) { return strcmp(psz1, psz2); } #endif #ifndef kHlpStrNComp int kHlpStrNComp(const char *psz1, const char *psz2, KSIZE cch) { return strncmp(psz1, psz2, cch); } #endif #ifndef kHlpStrCopy char *kHlpStrCopy(char *psz1, const char *psz2) { return strcpy(psz1, psz2); } #endif #ifndef kHlpStrLen KSIZE kHlpStrLen(const char *psz1) { return strlen(psz1); } #endif ��������������������������kbuild-3608/src/lib/kStuff/kHlp/Bare/���������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�017272� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Bare/kHlpBareThread.c�����������������������������������������������0000664�0001750�0001750�00000005526�14670377514�022266� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpBareThread.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - Thread Manipulation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpThread.h> #if K_OS == K_OS_DARWIN # include <mach/mach_time.h> #elif K_OS == K_OS_LINUX # include <k/kHlpSys.h> #elif K_OS == K_OS_OS2 # define INCL_BASE # define INCL_ERRORS # include <os2.h> #elif K_OS == K_OS_WINDOWS # include <Windows.h> #else # error "port me" #endif /** * Sleep for a number of milliseconds. * @param cMillies Number of milliseconds to sleep. */ void kHlpSleep(unsigned cMillies) { #if K_OS == K_OS_DARWIN static struct mach_timebase_info s_Info; static KBOOL s_fNanoseconds = K_UNKNOWN; KU64 uNow = mach_absolute_time(); KU64 uDeadline; KU64 uPeriod; if (s_fNanoseconds == K_UNKNOWN) { if (mach_timebase_info(&s_Info)) s_fNanoseconds = K_TRUE; /* the easy way out */ else if (s_Info.denom == s_Info.numer) s_fNanoseconds = K_TRUE; else s_fNanoseconds = K_FALSE; } uPeriod = (KU64)cMillies * 1000 * 1000; if (!s_fNanoseconds) uPeriod = (double)uPeriod * s_Info.denom / s_Info.numer; /* Use double to avoid 32-bit trouble. */ uDeadline = uNow + uPeriod; mach_wait_until(uDeadline); #elif K_OS == K_OS_LINUX /** @todo find the right syscall... */ #elif K_OS == K_OS_OS2 DosSleep(cMillies); #elif K_OS == K_OS_WINDOWS Sleep(cMillies); #else usleep(cMillies * 1000); #endif } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Bare/kHlpSys-darwin.c�����������������������������������������������0000664�0001750�0001750�00000024462�14670377514�022325� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpSys-darwin.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #include <k/kHlpSys.h> #include <unistd.h> #include <errno.h> #include <dlfcn.h> #include <sys/mman.h> #include <mach/mach_time.h> #define USE_DARWIN_SYSCALLS #if K_ARCH == K_ARCH_X86_32 # define DARWIN_SYSCALL(name, code) \ asm("\ .text \n\ .globl _" #name " \n\ _" #name ": \n\ mov $ " #code ", %eax \n\ call 1f \n\ 1: \n\ pop %edx \n\ mov %esp, %ecx \n\ sysenter \n\ jnae 2f \n\ ret \n\ 2: \n\ neg %eax \n\ ret \n\ ") # define DARWIN_SYSCALL_RET64(name, code) \ asm("\ .text \n\ .globl _" #name " \n\ _" #name ": \n\ mov $ " #code ", %eax \n\ int $0x80 \n\ jnae 2f \n\ ret \n\ 2: \n\ neg %eax \n\ mov $0xffffffff, %edx \n\ ret \n\ ") # define DARWIN_SYSCALL_NOERR(name, code) \ asm("\ .text \n\ .globl _" #name " \n\ _" #name ": \n\ mov $ " #code ", %eax \n\ call 1f \n\ 1: \n\ pop %edx \n\ mov %esp, %ecx \n\ sysenter \n\ ret \n\ ") #elif K_ARCH == K_ARCH_AMD64 # define DARWIN_SYSCALL(name, code) \ asm("\ .text \n\ .globl _" #name " \n\ _" #name ": \n\ mov $ " #code ", %eax \n\ mov %rcx, %r10 \n\ sysenter \n\ jnae 2f \n\ ret \n\ 2: \n\ neg %eax \n\ movsx %eax, %rax \n\ ret \n\ ") # define DARWIN_SYSCALL_RET64(name, code) DARWIN_SYSCALL_RET(name, code) # define DARWIN_SYSCALL_NOERR(name, code) \ asm("\ .text \n\ .globl _" #name " \n\ _" #name ": \n\ mov $ " #code ", %eax \n\ mov %rcx, %r10 \n\ sysenter \n\ ret \n\ ") #else # error later... #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_readlink, 0x000c003a); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_readlink, 0x0200003a); #else KSSIZE kHlpSys_readlink(const char *pszPath, char *pszBuf, KSIZE cbBuf) { KSSIZE cbRet = readlink(pszPath, pszBuf, cbBuf); return cbRet >= 0 ? cbRet : -errno; } #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_open, 0x000c0005); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_open, 0x02000005); #else int kHlpSys_open(const char *filename, int flags, int mode) { int fd = open(filename, flags, mode); return fd >= 0 ? fd : -errno; } #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_close, 0x000c0006); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_close, 0x02000006); #else int kHlpSys_close(int fd) { if (!close(fd)) return 0; return -errno; } #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL_RET64(kHlpSys_lseek, 0x000000c7); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL_RET64(kHlpSys_lseek, 0x020000c7); #else KFOFF kHlpSys_lseek(int fd, int whench, KFOFF off) { KFOFF offRet = lseek(fd, whench, off); return offRet >= 0 ? offRet : -errno; } #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_read, 0x000c0003); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_read, 0x02000003); #else KSSIZE kHlpSys_read(int fd, void *pvBuf, KSIZE cbBuf) { KSSIZE cbRead = read(fd, pvBuf, cbBuf); return cbRead >= 0 ? cbRead : -errno; } #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_write, 0x000c0004); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_write, 0x02000004); #else KSSIZE kHlpSys_write(int fd, const void *pvBuf, KSIZE cbBuf) { KSSIZE cbWritten = write(fd, pvBuf, cbBuf); return cbWritten >= 0 ? cbWritten : -errno; } #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_mmap, 0x020000c5); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_mmap, 0x020000c5); #else void *kHlpSys_mmap(void *addr, KSIZE len, int prot, int flags, int fd, KI64 off) { void *pv = mmap(addr, len, prot, flags, fd, off); return pv != (void *)-1 ? pv : errno < 256 ? (void *)(long)errno : (void *)(long)ENOMEM; } #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_mprotect, 0x000c004a); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_mprotect, 0x0200004a); #else int kHlpSys_mprotect(void *addr, KSIZE len, int prot) { if (!mprotect(addr, len, prot)) return 0; return -errno; } #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_munmap, 0x00080049); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_munmap, 0x02000049); #else int kHlpSys_munmap(void *addr, KSIZE len) { if (!munmap(addr, len)) return 0; return -errno; } #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_exit, 0x00040001); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(kHlpSys_exit, 0x02000001); #else void kHlpSys_exit(int rc) { _Exit(rc); } #endif /* * Some other stuff we'll be needing - Move to an appropriate place? */ #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL_NOERR(mach_task_self, 0xffffffe4); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL_NOERR(mach_task_self, 0xffffffe4); #endif //#if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) //DARWIN_SYSCALL(semaphore_create, 0x00040001); //#elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) //DARWIN_SYSCALL(semaphore_create, 0x02000001); //#endif #ifdef USE_DARWIN_SYSCALLS kern_return_t semaphore_create(task_t t, semaphore_t *ps, int p, int v) { return 0; } #endif //#if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) //DARWIN_SYSCALL(semaphore_destroy, 0x00040001); //#elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) //DARWIN_SYSCALL(semaphore_destroy, 0x02000001); //#endif #ifdef USE_DARWIN_SYSCALLS kern_return_t semaphore_destroy(task_t t, semaphore_t s) { return 0; } #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(semaphore_wait, 0xffffffdc); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(semaphore_wait, 0xffffffdc); #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(semaphore_signal, 0xffffffdf); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(semaphore_signal, 0xffffffdf); #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(mach_wait_until, 0xffffffa6); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(mach_wait_until, 0xffffffa6); #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(mach_timebase_info, 0xffffffa7); #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) DARWIN_SYSCALL(mach_timebase_info, 0xffffffa7); #endif #if K_ARCH == K_ARCH_X86_32 && defined(USE_DARWIN_SYSCALLS) asm("\n\ .text \n\ .globl _mach_absolute_time \n\ _mach_absolute_time: \n\ mov $0xffff1700, %edx \n\ jmp *%edx\n"); /* common page stuff. */ #elif K_ARCH == K_ARCH_AMD64 && defined(USE_DARWIN_SYSCALLS) #endif void *dlopen(const char *pszModule, int fFlags) { return NULL; } int dlclose(void *pvMod) { } void *dlsym(void *pvMod, const char *pszSymbol) { return NULL; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Bare/kHlpBareEnv.c��������������������������������������������������0000664�0001750�0001750�00000005710�14670377514�021602� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpBareEnv.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - Environment Manipulation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpEnv.h> #include <k/kHlpString.h> #include <k/kErrors.h> #if K_OS == K_OS_DARWIN #elif K_OS == K_OS_LINUX #elif K_OS == K_OS_OS2 # define INCL_BASE # define INCL_ERRORS # include <os2.h> #elif K_OS == K_OS_WINDOWS # include <Windows.h> #else # error "port me" #endif KHLP_DECL(int) kHlpGetEnv(const char *pszVar, char *pszVal, KSIZE cchVal) { #if K_OS == K_OS_DARWIN /** @todo need to figure out where the stuff is or how it's inherited on darwin ... */ return KERR_ENVVAR_NOT_FOUND; #elif K_OS == K_OS_LINUX /** @todo either read /proc/self/environ or figure out where in the memory the initial environment is... */ return KERR_ENVVAR_NOT_FOUND; #elif K_OS == K_OS_OS2 PSZ pszValue = NULL; int rc; *pszVal = '\0'; rc = DosScanEnv((PCSZ)pszVar, &pszValue); if (!rc) { KSIZE cch = kHlpStrLen((const char *)pszValue); if (cchVal > cch) kHlpMemCopy(pszVal, pszValue, cch + 1); else rc = KERR_BUFFER_OVERFLOW; } else rc = KERR_ENVVAR_NOT_FOUND; return rc; #elif K_OS == K_OS_WINDOWS DWORD cch; SetLastError(0); cch = GetEnvironmentVariable(pszVar, pszVal, cchVal); if (cch > 0 && cch < cchVal) return 0; *pszVal = '\0'; if (cch >= cchVal) return KERR_BUFFER_OVERFLOW; if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) return KERR_ENVVAR_NOT_FOUND; return GetLastError(); #else # error "Port me" #endif } ��������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Bare/Makefile.kup���������������������������������������������������0000664�0001750�0001750�00000000000�14670377514�021516� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Bare/kHlpBare-gcc.c�������������������������������������������������0000664�0001750�0001750�00000011721�14670377514�021662� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpBare-gcc.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - The Dynamic Loader, Helper Functions for GCC. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #include <k/kLdr.h> #include "kHlp.h" /******************************************************************************* * Global Variables * *******************************************************************************/ void *memchr(const void *pv, int ch, KSIZE cb) { const char *pb = pv; while (cb-- > 0) { if (*pb == ch) return (void *)pb; pb++; } return 0; } int memcmp(const void *pv1, const void *pv2, KSIZE cb) { /* * Pointer size pointer size. */ if ( cb > 16 && !((KUPTR)pv1 & (sizeof(void *) - 1)) && !((KUPTR)pv2 & (sizeof(void *) - 1)) ) { const KUPTR *pu1 = pv1; const KUPTR *pu2 = pv2; while (cb >= sizeof(KUPTR)) { const KUPTR u1 = *pu1++; const KUPTR u2 = *pu2++; if (u1 != u2) return u1 > u2 ? 1 : -1; cb -= sizeof(KUPTR); } if (!cb) return 0; pv1 = (const void *)pu1; pv2 = (const void *)pu2; } /* * Byte by byte. */ if (cb) { const unsigned char *pb1 = pv1; const unsigned char *pb2 = pv2; while (cb-- > 0) { const unsigned char b1 = *pb1++; const unsigned char b2 = *pb2++; if (b1 != b2) return b1 > b2 ? 1 : -1; } } return 0; } void *memcpy(void *pv1, const void *pv2, KSIZE cb) { void *pv1Start = pv1; /* * Pointer size pointer size. */ if ( cb > 16 && !((KUPTR)pv1 & (sizeof(void *) - 1)) && !((KUPTR)pv2 & (sizeof(void *) - 1)) ) { KUPTR *pu1 = pv1; const KUPTR *pu2 = pv2; while (cb >= sizeof(KUPTR)) { cb -= sizeof(KUPTR); *pu1++ = *pu2++; } if (!cb) return 0; pv1 = (void *)pu1; pv2 = (const void *)pu2; } /* * byte by byte */ if (cb) { unsigned char *pb1 = pv1; const unsigned char *pb2 = pv2; while (cb-- > 0) *pb1++ = *pb2++; } return pv1Start; } void *memset(void *pv, int ch, KSIZE cb) { void *pvStart = pv; /* * Pointer size pointer size. */ if ( cb > 16 && !((KUPTR)pv & (sizeof(void *) - 1))) { KUPTR *pu = pv; KUPTR u = ch | (ch << 8); u |= u << 16; #if K_ARCH_BITS >= 64 u |= u << 32; #endif #if K_ARCH_BITS >= 128 u |= u << 64; #endif while (cb >= sizeof(KUPTR)) { cb -= sizeof(KUPTR); *pu++ = u; } } /* * Byte by byte */ if (cb) { unsigned char *pb = pv; while (cb-- > 0) *pb++ = ch; } return pvStart; } int strcmp(const char *psz1, const char *psz2) { for (;;) { const char ch1 = *psz1++; const char ch2 = *psz2++; if (ch1 != ch2) return (int)ch1 - (int)ch2; if (!ch1) return 0; } } int strncmp(const char *psz1, const char *psz2, KSIZE cch) { while (cch-- > 0) { const char ch1 = *psz1++; const char ch2 = *psz2++; if (ch1 != ch2) return (int)ch1 - (int)ch2; if (!ch1) break; } return 0; } char *strchr(const char *psz, int ch) { for (;;) { const char chCur = *psz; if (chCur == ch) return (char *)psz; if (!chCur) return 0; psz++; } } KSIZE strlen(const char *psz) { const char *pszStart = psz; while (*psz) psz++; return psz - pszStart; } �����������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Bare/kHlpBareAssert.c�����������������������������������������������0000664�0001750�0001750�00000007556�14670377514�022325� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpBareAssert.c 82 2016-08-22 21:01:51Z bird $ */ /** @file * kHlpBare - Assert Backend. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpAssert.h> #include <k/kHlpString.h> #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS # include <k/kHlpSys.h> #elif K_OS == K_OS_OS2 # define INCL_BASE # define INCL_ERRORS # include <os2.h> #elif K_OS == K_OS_WINDOWS # include <Windows.h> #else # error "port me" #endif /** * Writes a assert string with unix lineendings. * * @param pszMsg The string. */ static void kHlpAssertWrite(const char *pszMsg) { #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS KSIZE cchMsg = kHlpStrLen(pszMsg); kHlpSys_write(2 /* stderr */, pszMsg, cchMsg); #elif K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS /* * Line by line. */ ULONG cbWritten; const char *pszNl = kHlpStrChr(pszMsg, '\n'); while (pszNl) { cbWritten = pszNl - pszMsg; # if K_OS == K_OS_OS2 if (cbWritten) DosWrite((HFILE)2, pszMsg, cbWritten, &cbWritten); DosWrite((HFILE)2, "\r\n", 2, &cbWritten); # else /* K_OS == K_OS_WINDOWS */ if (cbWritten) WriteFile((HANDLE)STD_ERROR_HANDLE, pszMsg, cbWritten, &cbWritten, NULL); WriteFile((HANDLE)STD_ERROR_HANDLE, "\r\n", 2, &cbWritten, NULL); # endif /* next */ pszMsg = pszNl + 1; pszNl = kHlpStrChr(pszMsg, '\n'); } /* * Remaining incomplete line. */ if (*pszMsg) { cbWritten = kHlpStrLen(pszMsg); # if K_OS == K_OS_OS2 DosWrite((HFILE)2, pszMsg, cbWritten, &cbWritten); # else /* K_OS == K_OS_WINDOWS */ WriteFile((HANDLE)STD_ERROR_HANDLE, pszMsg, cbWritten, &cbWritten, NULL); # endif } #else # error "port me" #endif } KHLP_DECL(void) kHlpAssertMsg1(const char *pszExpr, const char *pszFile, unsigned iLine, const char *pszFunction) { char szLine[16]; kHlpAssertWrite("\n!!!kLdr Assertion Failed!!!\nExpression: "); kHlpAssertWrite(pszExpr); kHlpAssertWrite("\nAt: "); kHlpAssertWrite(pszFile); kHlpAssertWrite("("); kHlpAssertWrite(kHlpInt2Ascii(szLine, sizeof(szLine), iLine, 10)); kHlpAssertWrite(") "); kHlpAssertWrite(pszFunction); kHlpAssertWrite("\n"); } KHLP_DECL(void) kHlpAssertMsg2(const char *pszFormat, ...) { kHlpAssertWrite(pszFormat); } ��������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Bare/kHlpBareProcess.c����������������������������������������������0000664�0001750�0001750�00000004605�14670377514�022472� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpBareProcess.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - Process Management */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpProcess.h> #include <k/kHlpAssert.h> #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS # include <k/kHlpSys.h> #elif K_OS == K_OS_OS2 # define INCL_BASE # define INCL_ERRORS # include <os2.h> #elif K_OS == K_OS_WINDOWS # include <Windows.h> #else # error "port me" #endif /** * Terminate the process. * * @param rc The exit status. */ void kHlpExit(int rc) { for (;;) { #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS kHlpSys_exit(rc); #elif K_OS == K_OS_OS2 DosExit(EXIT_PROCESS, rc); #elif K_OS == K_OS_WINDOWS TerminateProcess(GetCurrentProcess(), rc); #else # error "Port me" #endif kHlpAssert(!"Impossible"); } } ���������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Bare/kHlpBareHeap.c�������������������������������������������������0000664�0001750�0001750�00000050117�14670377514�021730� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpBareHeap.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - Heap. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #define KHLPHEAP_STRICT /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpAlloc.h> #include <k/kHlpString.h> #include <k/kHlpAssert.h> #if K_OS == K_OS_OS2 # define INCL_BASE # define INCL_ERRORS # include <os2.h> #elif K_OS == K_OS_WINDOWS # include <Windows.h> #else # include <k/kHlpAlloc.h> #endif /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * A heap block. */ typedef struct KHLPHEAPBLOCK { /** Next block in the global list. */ struct KHLPHEAPBLOCK *pNext; /** Previous block in the global list. */ struct KHLPHEAPBLOCK *pPrev; /** The size of this block including this header. */ KSIZE cb; /** The flags. */ KSIZE fFlags; } KHLPHEAPBLOCK, *PKHLPHEAPBLOCK; /** Indicates whether the block is free (set) or allocated (clear). */ #define KHLPHEAPBLOCK_FLAG_FREE ((KSIZE)1) /** Valid flag mask. */ #define KHLPHEAPBLOCK_FLAG_MASK ((KSIZE)1) /** Checks if the block is freed. */ #define KHLPHEAPBLOCK_IS_FREE(pB) ( (pB)->fFlags & KHLPHEAPBLOCK_FLAG_FREE ) /** Check if the block is allocated. */ #define KHLPHEAPBLOCK_IS_ALLOCATED(pB) !KHLPHEAPBLOCK_IS_FREE(pB) /** Checks if the two blocks are adjacent. * Assumes pB1 < pB2. */ #define KHLPHEAPBLOCK_IS_ADJACENT(pB1, pB2) \ ( ((KUPTR)(pB1) + (pB1)->cb) == (KUPTR)(pB2) ) /** The block alignment. */ #define KHLPHEAPBLOCK_ALIGNMENT sizeof(KHLPHEAPBLOCK) /** @def KHLPHEAP_ASSERT * Heap assertion. */ /** @def KHLPHEAP_ASSERT_BLOCK * Assert that a heap block is valid. */ /** @def KHLPHEAP_ASSERT_FREE * Assert that a heap free block is valid. */ #ifdef KHLPHEAP_STRICT # define KHLPHEAP_ASSERT(expr) kHlpAssert(expr) # define KHLPHEAP_ASSERT_BLOCK(pHeap, pBlock) \ do { \ KHLPHEAP_ASSERT(!((pBlock)->fFlags & ~KHLPHEAPBLOCK_FLAG_MASK)); \ KHLPHEAP_ASSERT(!((pBlock)->cb & (KHLPHEAPBLOCK_ALIGNMENT - 1))); \ KHLPHEAP_ASSERT((KUPTR)(pBlock)->pPrev < (KUPTR)(pBlock)); \ KHLPHEAP_ASSERT((KUPTR)(pBlock)->pNext > (KUPTR)(pBlock) || !(pBlock)->pNext); \ } while (0) # define KHLPHEAP_ASSERT_FREE(pHeap, pFree) \ do { \ KHLPHEAP_ASSERT_BLOCK(pHeap, &(pFree)->Core); \ KHLPHEAP_ASSERT((KUPTR)(pFree)->pPrev < (KUPTR)(pFree)); \ KHLPHEAP_ASSERT((KUPTR)(pFree)->pNext > (KUPTR)(pFree) || !(pFree)->pNext); \ } while (0) #else # define KHLPHEAP_ASSERT(expr) do { } while (0) # define KHLPHEAP_ASSERT_BLOCK(pH, pB) do { } while (0) # define KHLPHEAP_ASSERT_FREE(pH, pF) do { } while (0) #endif /** * A free heap block. */ typedef struct KHLPHEAPFREE { /** The core bit which we have in common with used blocks. */ KHLPHEAPBLOCK Core; /** The next free block. */ struct KHLPHEAPFREE *pNext; /** The previous free block. */ struct KHLPHEAPFREE *pPrev; } KHLPHEAPFREE, *PKHLPHEAPFREE; /** * A heap segment. */ typedef struct KHLPHEAPSEG { /** The base address of the segment. */ void *pvBase; /** The length of the segment (in bytes). */ KSIZE cb; } KHLPHEAPSEG, *PKHLPHEAPSEG; /** * Bundle of heap segments. */ typedef struct KHLPHEAPSEGS { /** Pointer to the next segment bundle. */ struct KHLPHEAPSEGS *pNext; /** The number of segments used. */ KU32 cSegs; /** Array of chunks. */ KHLPHEAPSEG aSegs[64]; } KHLPHEAPSEGS, *PKHLPHEAPSEGS; /** * Heap anchor block. */ typedef struct KHLPHEAPANCHOR { /** Head of the block list. */ PKHLPHEAPBLOCK pHead; /** Tail of the block list. */ PKHLPHEAPBLOCK pTail; /** Head of the free list. */ PKHLPHEAPFREE pFreeHead; /** Head segment bundle. * The order of this list is important, but a bit peculiar. * Logically, SegsHead::pNext is the tail pointer. */ KHLPHEAPSEGS SegsHead; } KHLPHEAPANCHOR, *PKHLPHEAPANCHOR; /******************************************************************************* * Global Variables * *******************************************************************************/ /** The heap anchor block. */ static KHLPHEAPANCHOR g_Heap; /******************************************************************************* * Internal Functions * *******************************************************************************/ static int khlpHeapInit(PKHLPHEAPANCHOR pHeap); static void khlpHeapDelete(PKHLPHEAPANCHOR pHeap); static void * khlpHeapAlloc(PKHLPHEAPANCHOR pHeap, KSIZE cb); static void khlpHeapFree(PKHLPHEAPANCHOR pHeap, void *pv); static KSIZE khlpHeapBlockSize(PKHLPHEAPANCHOR pHeap, void *pv); static void khlpHeapDonate(PKHLPHEAPANCHOR pHeap, void *pv, KSIZE cb); static int khlpHeapSegAlloc(PKHLPHEAPSEG pSeg, KSIZE cb); static void khlpHeapSegFree(PKHLPHEAPSEG pSeg); /** * Initializes the kLdr heap. * * @returns 0 on success, non-zero OS specific status code on failure. */ KHLP_DECL(int) kHlpHeapInit(void) { return khlpHeapInit(&g_Heap); } /** * Terminates the kLdr heap. */ KHLP_DECL(void) kHlpHeapTerm(void) { khlpHeapDelete(&g_Heap); } KHLP_DECL(void *) kHlpAlloc(KSIZE cb) { return khlpHeapAlloc(&g_Heap, cb); } KHLP_DECL(void *) kHlpAllocZ(KSIZE cb) { void *pv = khlpHeapAlloc(&g_Heap, cb); if (pv) kHlpMemSet(pv, 0, cb); return pv; } KHLP_DECL(void *) kHlpDup(const void *pv, KSIZE cb) { void *pvNew = khlpHeapAlloc(&g_Heap, cb); if (pvNew) kHlpMemCopy(pvNew, pv, cb); return pvNew; } KHLP_DECL(char *) kHlpStrDup(const char *psz) { return (char *)kHlpDup(psz, kHlpStrLen(psz) + 1); } KHLP_DECL(void *) kHlpRealloc(void *pv, KSIZE cb) { void *pvNew; if (!cb) { kHlpFree(pv); pvNew = NULL; } else if (!pv) pvNew = khlpHeapAlloc(&g_Heap, cb); else { KSIZE cbToCopy = khlpHeapBlockSize(&g_Heap, pv); pvNew = khlpHeapAlloc(&g_Heap, cb); if (pvNew) { kHlpMemCopy(pvNew, pv, cb); kHlpFree(pv); } } return pvNew; } KHLP_DECL(void) kHlpFree(void *pv) { khlpHeapFree(&g_Heap, pv); } /** * Donates memory to the heap. * * @param pv The address of the memory. * @param cb The amount of memory. */ KHLP_DECL(void) kHlpHeapDonate(void *pv, KSIZE cb) { khlpHeapDonate(&g_Heap, pv, cb); } /** * Initializes the heap anchor. * * @returns 0 on success, non-zero on failure. * @param pHeap The heap anchor to be initialized. */ static int khlpHeapInit(PKHLPHEAPANCHOR pHeap) { pHeap->pHead = NULL; pHeap->pTail = NULL; pHeap->pFreeHead = NULL; pHeap->SegsHead.pNext = NULL; pHeap->SegsHead.cSegs = 0; return 0; } /** * Deletes a heap. * This will free all resources (memory) associated with the heap. * * @param pHeap The heap to be deleted. */ static void khlpHeapDelete(PKHLPHEAPANCHOR pHeap) { /* * Free the segments, LIFO order. * The head element is the last to be free, while the * head.pNext is really the tail pointer - neat or what? */ while ( pHeap->SegsHead.cSegs || pHeap->SegsHead.pNext) { /* find the tail. */ KU32 iSeg; PKHLPHEAPSEGS pSegs = pHeap->SegsHead.pNext; if (!pSegs) pSegs = &pHeap->SegsHead; else { pHeap->SegsHead.pNext = pSegs->pNext; pSegs->pNext = NULL; } /* free the segments */ iSeg = pSegs->cSegs; while (iSeg-- > 0) khlpHeapSegFree(&pSegs->aSegs[iSeg]); pSegs->cSegs = 0; } /* Zap the anchor. */ pHeap->pHead = NULL; pHeap->pTail = NULL; pHeap->pFreeHead = NULL; pHeap->SegsHead.pNext = NULL; pHeap->SegsHead.cSegs = 0; } /** * Internal heap block allocator. */ static void * kldrHeapAllocSub(PKHLPHEAPANCHOR pHeap, KSIZE cb) { /* * Find a fitting free block. */ const KSIZE cbReq = K_ALIGN_Z(cb + sizeof(KHLPHEAPBLOCK), KHLPHEAPBLOCK_ALIGNMENT); PKHLPHEAPFREE pCur = pHeap->pFreeHead; while (pCur) { if (pCur->Core.cb >= cbReq) { if (pCur->Core.cb != cbReq) { /* check and see if there is a better match close by. */ PKHLPHEAPFREE pCur2 = pCur->pNext; unsigned i = 16; while (i-- > 0 && pCur2) { if (pCur2->Core.cb >= cbReq) { if (pCur2->Core.cb == cbReq) { pCur = pCur2; break; } if (pCur2->Core.cb < pCur->Core.cb) pCur = pCur2; } /* next */ KHLPHEAP_ASSERT_FREE(pHeap, pCur2); pCur2 = pCur2->pNext; } } break; } /* next */ KHLPHEAP_ASSERT_FREE(pHeap, pCur); pCur = pCur->pNext; } if (!pCur) return NULL; KHLPHEAP_ASSERT_FREE(pHeap, pCur); /* * Do we need to split out a block? */ if (pCur->Core.cb - cbReq >= KHLPHEAPBLOCK_ALIGNMENT * 2) { PKHLPHEAPBLOCK pNew; pCur->Core.cb -= cbReq; pNew = (PKHLPHEAPBLOCK)((KUPTR)pCur + pCur->Core.cb); pNew->fFlags = 0; pNew->cb = cbReq; pNew->pNext = pCur->Core.pNext; if (pNew->pNext) pNew->pNext->pPrev = pNew; else pHeap->pTail = pNew; pNew->pPrev = &pCur->Core; pCur->Core.pNext = pNew; KHLPHEAP_ASSERT_FREE(pHeap, pCur); KHLPHEAP_ASSERT_BLOCK(pHeap, pNew); return pNew + 1; } /* * No, just unlink it from the free list and return. */ if (pCur->pNext) pCur->pNext->pPrev = pCur->pPrev; if (pCur->pPrev) pCur->pPrev->pNext = pCur->pNext; else pHeap->pFreeHead = pCur->pNext; pCur->Core.fFlags &= ~KHLPHEAPBLOCK_FLAG_FREE; KHLPHEAP_ASSERT_BLOCK(pHeap, &pCur->Core); return &pCur->Core + 1; } /** * Allocate a heap block. * * @returns Pointer to the allocated heap block on success. On failure NULL is returned. * @param pHeap The heap. * @param cb The requested heap block size. */ static void * khlpHeapAlloc(PKHLPHEAPANCHOR pHeap, KSIZE cb) { void *pv; /* adjust the requested block size. */ cb = K_ALIGN_Z(cb, KHLPHEAPBLOCK_ALIGNMENT); if (!cb) cb = KHLPHEAPBLOCK_ALIGNMENT; /* try allocate the block. */ pv = kldrHeapAllocSub(pHeap, cb); if (!pv) { /* * Failed, add another segment and try again. */ KHLPHEAPSEG Seg; if (khlpHeapSegAlloc(&Seg, cb + sizeof(KHLPHEAPSEGS) + sizeof(KHLPHEAPBLOCK) * 16)) return NULL; /* donate before insterting the segment, this makes sure we got heap to expand the segment list. */ khlpHeapDonate(pHeap, Seg.pvBase, Seg.cb); /* insert the segment. */ if (pHeap->SegsHead.cSegs < sizeof(pHeap->SegsHead.aSegs) / sizeof(pHeap->SegsHead.aSegs[0])) pHeap->SegsHead.aSegs[pHeap->SegsHead.cSegs++] = Seg; else if ( pHeap->SegsHead.pNext && pHeap->SegsHead.pNext->cSegs < sizeof(pHeap->SegsHead.aSegs) / sizeof(pHeap->SegsHead.aSegs[0])) pHeap->SegsHead.pNext->aSegs[pHeap->SegsHead.pNext->cSegs++] = Seg; else { PKHLPHEAPSEGS pSegs = (PKHLPHEAPSEGS)kldrHeapAllocSub(pHeap, sizeof(*pSegs)); KHLPHEAP_ASSERT(pSegs); pSegs->pNext = pHeap->SegsHead.pNext; pHeap->SegsHead.pNext = pSegs; pSegs->aSegs[0] = Seg; pSegs->cSegs = 1; } /* retry (should succeed) */ pv = kldrHeapAllocSub(pHeap, cb); KHLPHEAP_ASSERT(pv); } return pv; } /** * Frees a heap block. * * @param pHeap The heap. * @param pv The pointer returned by khlpHeapAlloc(). */ static void khlpHeapFree(PKHLPHEAPANCHOR pHeap, void *pv) { PKHLPHEAPFREE pFree, pLeft, pRight; /* ignore NULL pointers. */ if (!pv) return; pFree = (PKHLPHEAPFREE)((PKHLPHEAPBLOCK)pv - 1); KHLPHEAP_ASSERT_BLOCK(pHeap, &pFree->Core); KHLPHEAP_ASSERT(KHLPHEAPBLOCK_IS_ALLOCATED(&pFree->Core)); /* * Merge or link with left node? */ pLeft = (PKHLPHEAPFREE)pFree->Core.pPrev; if ( pLeft && KHLPHEAPBLOCK_IS_FREE(&pLeft->Core) && KHLPHEAPBLOCK_IS_ADJACENT(&pLeft->Core, &pFree->Core) ) { /* merge left */ pLeft->Core.pNext = pFree->Core.pNext; if (pFree->Core.pNext) pFree->Core.pNext->pPrev = &pLeft->Core; else pHeap->pTail = &pLeft->Core; pLeft->Core.cb += pFree->Core.cb; pFree->Core.fFlags = ~0; pFree = pLeft; } else { /* link left */ while (pLeft && !KHLPHEAPBLOCK_IS_FREE(&pLeft->Core)) pLeft = (PKHLPHEAPFREE)pLeft->Core.pPrev; if (pLeft) { pFree->pPrev = pLeft; pFree->pNext = pLeft->pNext; if (pLeft->pNext) pLeft->pNext->pPrev = pFree; pLeft->pNext = pFree; } else { pFree->pPrev = NULL; pFree->pNext = pHeap->pFreeHead; if (pHeap->pFreeHead) pHeap->pFreeHead->pPrev = pFree; pHeap->pFreeHead = pFree; } pFree->Core.fFlags |= KHLPHEAPBLOCK_FLAG_FREE; } KHLPHEAP_ASSERT_FREE(pHeap, pFree); /* * Merge right? */ pRight = (PKHLPHEAPFREE)pFree->Core.pNext; if ( pRight && KHLPHEAPBLOCK_IS_FREE(&pRight->Core) && KHLPHEAPBLOCK_IS_ADJACENT(&pFree->Core, pRight) ) { /* unlink pRight from the global list. */ pFree->Core.pNext = pRight->Core.pNext; if (pRight->Core.pNext) pRight->Core.pNext->pPrev = &pFree->Core; else pHeap->pTail = &pFree->Core; /* unlink pRight from the free list. */ pFree->pNext = pRight->pNext; if (pRight->pNext) pRight->pNext->pPrev = pFree; /* update size and invalidate pRight. */ pFree->Core.cb += pRight->Core.cb; pRight->Core.fFlags = ~0; } } /** * Calcs the size of a heap block. * * @returns The block size (in bytes). * @param pHeap The heap. * @param pv Pointer to an in-use heap block. */ static KSIZE khlpHeapBlockSize(PKHLPHEAPANCHOR pHeap, void *pv) { PKHLPHEAPBLOCK pBlock = (PKHLPHEAPBLOCK)pv - 1; KHLPHEAP_ASSERT_BLOCK(pHeap, pBlock); KHLPHEAP_ASSERT(KHLPHEAPBLOCK_IS_ALLOCATED(pBlock)); return (KU8 *)pBlock->pNext - (KU8 *)pv; } /** * Donates memory to the heap. * * The donated memory is returned to the donator when the heap is deleted. * * @param pHeap The heap * @param pv The pointer to the donated memory. * @param cb Size of the donated memory. */ static void khlpHeapDonate(PKHLPHEAPANCHOR pHeap, void *pv, KSIZE cb) { PKHLPHEAPBLOCK pBlock; /* * Don't bother with small donations. */ if (cb < KHLPHEAPBLOCK_ALIGNMENT * 4) return; /* * Align the donation on a heap block boundrary. */ if ((KUPTR)pv & (KHLPHEAPBLOCK_ALIGNMENT - 1)) { cb -= (KUPTR)pv & 31; pv = K_ALIGN_P(pv, KHLPHEAPBLOCK_ALIGNMENT); } cb &= ~(KSIZE)(KHLPHEAPBLOCK_ALIGNMENT - 1); /* * Create an allocated block, link it and free it. */ pBlock = (PKHLPHEAPBLOCK)pv; pBlock->pNext = NULL; pBlock->pPrev = NULL; pBlock->cb = cb; pBlock->fFlags = 0; /* insert */ if ((KUPTR)pBlock < (KUPTR)pHeap->pHead) { /* head */ pBlock->pNext = pHeap->pHead; pHeap->pHead->pPrev = pBlock; pHeap->pHead = pBlock; } else if ((KUPTR)pBlock > (KUPTR)pHeap->pTail) { if (pHeap->pTail) { /* tail */ pBlock->pPrev = pHeap->pTail; pHeap->pTail->pNext = pBlock; pHeap->pTail = pBlock; } else { /* first */ pHeap->pHead = pBlock; pHeap->pTail = pBlock; } } else { /* in list (unlikely) */ PKHLPHEAPBLOCK pPrev = pHeap->pHead; PKHLPHEAPBLOCK pCur = pPrev->pNext; for (;;) { KHLPHEAP_ASSERT_BLOCK(pHeap, pCur); if ((KUPTR)pCur > (KUPTR)pBlock) break; pPrev = pCur; pCur = pCur->pNext; } pBlock->pNext = pCur; pBlock->pPrev = pPrev; pPrev->pNext = pBlock; pCur->pPrev = pBlock; } KHLPHEAP_ASSERT_BLOCK(pHeap, pBlock); /* free it */ khlpHeapFree(pHeap, pBlock + 1); } /** * Allocates a new segment. * * @returns 0 on success, non-zero OS status code on failure. * @param pSeg Where to put the info about the allocated segment. * @param cbMin The minimum segment size. */ static int khlpHeapSegAlloc(PKHLPHEAPSEG pSeg, KSIZE cbMin) { #if K_OS == K_OS_OS2 APIRET rc; pSeg->cb = (cbMin + 0xffff) & ~(KSIZE)0xffff; pSeg->pvBase = NULL; rc = DosAllocMem(&pSeg->pvBase, pSeg->cb, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_ANY); if (rc == ERROR_INVALID_PARAMETER) rc = DosAllocMem(&pSeg->pvBase, pSeg->cb, PAG_COMMIT | PAG_READ | PAG_WRITE); if (rc) { pSeg->pvBase = NULL; pSeg->cb = 0; return rc; } #elif K_OS == K_OS_WINDOWS pSeg->cb = (cbMin + 0xffff) & ~(KSIZE)0xffff; pSeg->pvBase = VirtualAlloc(NULL, pSeg->cb, MEM_COMMIT, PAGE_READWRITE); if (!pSeg->pvBase) { pSeg->cb = 0; return GetLastError(); } #else int rc; pSeg->cb = (cbMin + 0xffff) & ~(KSIZE)0xffff; pSeg->pvBase = NULL; rc = kHlpPageAlloc(&pSeg->pvBase, pSeg->cb, KPROT_READWRITE, K_FALSE); if (rc) { pSeg->pvBase = NULL; pSeg->cb = 0; return rc; } #endif return 0; } /** * Frees a segment. * * @param pSeg The segment to be freed. */ static void khlpHeapSegFree(PKHLPHEAPSEG pSeg) { #if K_OS == K_OS_OS2 APIRET rc = DosFreeMem(pSeg->pvBase); KHLPHEAP_ASSERT(!rc); (void)rc; #elif K_OS == K_OS_WINDOWS BOOL fRc = VirtualFree(pSeg->pvBase, 0 /*pSeg->cb*/, MEM_RELEASE); KHLPHEAP_ASSERT(fRc); (void)fRc; #else int rc = kHlpPageFree(pSeg->pvBase, pSeg->cb); KHLPHEAP_ASSERT(!rc); (void)rc; #endif } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�017775� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrNCat.c�����������������������������������������������0000664�0001750�0001750�00000003476�14670377514�022310� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrNCat.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNCat. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrNCat(char *psz1, const char *psz2, KSIZE cb) { char ch; char *pszDst = psz1; while (*pszDst != '\0') pszDst++; while (cb-- > 0) { ch = *psz2++; if (!ch) break; *pszDst++ = ch; } *pszDst = '\0'; return psz1; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrIPCompAscii.c����������������������������������������0000664�0001750�0001750�00000004007�14670377514�023552� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrIPCompAscii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrIPCompAscii. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrIPCompAscii(const char *psz1, const char *psz2) { for (;;) { char ch1 = *psz1; char ch2 = *psz2; if (ch1 != ch2) { if (ch1 <= 'Z' && ch1 >= 'A') ch1 += 'a' - 'A'; if (ch2 <= 'Z' && ch2 >= 'A') ch2 += 'a' - 'A'; if (ch1 != ch2) return (char *)psz1; } if (!ch1) return (char *)psz1; psz1++; psz2++; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpGetExt.c������������������������������������������������0000664�0001750�0001750�00000005172�14670377514�022165� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpGetExt.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpPath - kHlpGetExt and kHlpGetSuff. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpPath.h> #include <k/kHlpString.h> /** * Gets the filename suffix. * * @returns Pointer to where the suffix starts within the string pointed to by pszFilename. * @returns Pointer to the terminator char if no suffix. * @param pszFilename The filename to parse. */ KHLP_DECL(char *) kHlpGetSuff(const char *pszFilename) { const char *pszDot = NULL; pszFilename = kHlpGetFilename(pszFilename); for (;;) { char ch = *pszFilename; if (ch == '.') { while ((ch = *++pszFilename) == '.') /* nothing */; if (ch) pszDot = pszFilename - 1; } if (!ch) return (char *)(pszDot ? pszDot : pszFilename); pszFilename++; } } /** * Gets the filename extention. * * @returns Pointer to where the extension starts within the string pointed to by pszFilename. * @returns Pointer to the terminator char if no extension. * @param pszFilename The filename to parse. */ KHLP_DECL(char *) kHlpGetExt(const char *pszFilename) { char *psz = kHlpGetSuff(pszFilename); return *psz ? psz + 1 : psz; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrCat.c������������������������������������������������0000664�0001750�0001750�00000003377�14670377514�022172� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrCat.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrCat. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrCat(char *psz1, const char *psz2) { char ch; char *pszDst = psz1; while (*pszDst != '\0') pszDst++; do { ch = *psz2++; *pszDst++ = ch; } while (ch != '\0'); return psz1; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrNLen.c�����������������������������������������������0000664�0001750�0001750�00000003263�14670377514�022311� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrNLen.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNLen. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(KSIZE) kHlpStrNLen(const char *psz, KSIZE cchMax) { const char *pszEnd = psz; while (cchMax-- > 0 && *pszEnd) pszEnd++; return pszEnd - psz; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpMemComp.c�����������������������������������������������0000664�0001750�0001750�00000004150�14670377514�022315� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpMemComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemComp. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(int) kHlpMemComp(const void *pv1, const void *pv2, KSIZE cb) { union { const void *pv; const KU8 *pb; const KUPTR *pu; } u1, u2; u1.pv = pv1; u2.pv = pv2; if (cb >= 32) { while (cb > sizeof(KUPTR)) { cb -= sizeof(KUPTR); if (*u1.pu != *u2.pu) return *u1.pu > *u2.pu ? 1 : -1; u1.pu++; u2.pu++; } } while (cb-- > 0) { if (u1.pb != u2.pb) return u1.pb > u2.pb ? 1 : -1; u1.pb++; u2.pb++; } return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpIsFilenameOnly.c����������������������������������������0000664�0001750�0001750�00000004150�14670377514�023636� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpIsFilenameOnly.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpPath - kHlpIsFilenameOnly. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpPath.h> #include <k/kHlpString.h> /** * Checks if this is only a filename or if it contains any kind * of drive, directory, or server specs. * * @returns 1 if this is a filename only. * @returns 0 of it's isn't only a filename. * @param pszFilename The filename to parse. */ KHLP_DECL(int) kHlpIsFilenameOnly(const char *pszFilename) { for (;;) { const char ch = *pszFilename++; #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS if (ch == '/' || ch == '\\' || ch == ':') #else if (ch == '/') #endif return 0; if (!ch) return 1; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrPComp.c����������������������������������������������0000664�0001750�0001750�00000003442�14670377514�022472� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrPComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrPComp. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrPComp(const char *psz1, const char *psz2) { for (;;) { char ch1 = *psz1; char ch2 = *psz2; if (ch1 != ch2) return (char *)psz1; if (!ch1) return NULL; psz1++; psz2++; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpMemPMove.c����������������������������������������������0000664�0001750�0001750�00000005050�14670377514�022445� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpMemPMove.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemPMove. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(void *) kHlpMemPMove(void *pv1, const void *pv2, KSIZE cb) { union { void *pv; KU8 *pb; KUPTR *pu; } u1; union { const void *pv; volatile KU8 *pb; volatile KUPTR *pu; } u2; u1.pv = pv1; u2.pv = pv2; if ((KUPTR)u1.pb <= (KUPTR)u2.pb) { /* forwards copy */ if (cb >= 32) { while (cb > sizeof(KUPTR)) { KUPTR u = *u2.pu++; *u1.pu++ = u; cb -= sizeof(KUPTR); } } while (cb-- > 0) { KU8 b = *u2.pb++; *u1.pb++ = b; } return u1.pb; } /* backwards copy */ u1.pb += cb; u2.pb += cb; if (cb >= 32) { while (cb > sizeof(KUPTR)) { KUPTR u = *--u2.pu; *--u1.pu = u; cb -= sizeof(KUPTR); } } while (cb-- > 0) { KU8 b = *--u2.pb; *--u1.pb = b; } return (KU8 *)pv1 + cb; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpMemPCopy.c����������������������������������������������0000664�0001750�0001750�00000004004�14670377514�022447� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpMemPCopy.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemPCopy. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(void *) kHlpMemPCopy(void *pv1, const void *pv2, KSIZE cb) { union { void *pv; KU8 *pb; KUPTR *pu; } u1; union { const void *pv; const KU8 *pb; const KUPTR *pu; } u2; u1.pv = pv1; u2.pv = pv2; if (cb >= 32) { while (cb > sizeof(KUPTR)) { cb -= sizeof(KUPTR); *u1.pu++ = *u2.pu++; } } while (cb-- > 0) *u1.pb++ = *u2.pb++; return u1.pb; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpMemICompAscii.c�����������������������������������������0000664�0001750�0001750�00000004622�14670377514�023403� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpMemICompAscii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemICompAscii. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(int) kHlpMemICompAscii(const void *pv1, const void *pv2, KSIZE cb) { union { const void *pv; const KU8 *pb; const KUPTR *pu; } u1, u2; u1.pv = pv1; u2.pv = pv2; if (cb >= 32) { while (cb > sizeof(KUPTR)) { if (*u1.pu != *u2.pu) break; /* hand it on to the byte-by-byte routine. */ u1.pu++; u2.pu++; cb -= sizeof(KUPTR); } } while (cb-- > 0) { if (u1.pb != u2.pb) { KU8 ch1 = *u1.pb; KU8 ch2 = *u2.pb; if (ch1 <= 'Z' && ch1 >= 'A') ch1 += 'a' - 'A'; if (ch2 <= 'Z' && ch2 >= 'A') ch2 += 'a' - 'A'; if (ch1 != ch2) return ch1 > ch2 ? 1 : -1; } u1.pb++; u2.pb++; } return 0; } ��������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpGetFilename.c�������������������������������������������0000664�0001750�0001750�00000004727�14670377514�023152� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpGetFilename.c 85 2016-09-06 03:21:04Z bird $ */ /** @file * kHlpPath - kHlpGetFilename. */ /* * Copyright (c) 2006-2016 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpPath.h> #include <k/kHlpString.h> /** * Get the pointer to the filename part of the name. * * @returns Pointer to where the filename starts within the string pointed to by pszFilename. * @returns Pointer to the terminator char if no filename. * @param pszFilename The filename to parse. */ KHLP_DECL(char *) kHlpGetFilename(const char *pszFilename) { const char *pszLast = pszFilename; for (;;) { char ch = *pszFilename; #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS if (ch == '/' || ch == '\\' || ch == ':') { while ((ch = *++pszFilename) == '/' || ch == '\\' || ch == ':') /* nothing */; pszLast = pszFilename; } #else if (ch == '/') { while ((ch = *++pszFilename) == '/') /* betsuni */; pszLast = pszFilename; } #endif if (ch) pszFilename++; else return (char *)pszLast; } } �����������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpInt2Ascii.c���������������������������������������������0000664�0001750�0001750�00000005231�14670377514�022546� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpInt2Ascii.c 113 2018-07-12 11:34:27Z bird $ */ /** @file * kHlpString - kHlpInt2Ascii. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> /** * Converts an signed integer to an ascii string. * * @returns psz. * @param psz Pointer to the output buffer. * @param cch The size of the output buffer. * @param lVal The value. * @param iBase The base to format it. (2,8,10 or 16) */ KHLP_DECL(char *) kHlpInt2Ascii(char *psz, KSIZE cch, long lVal, unsigned iBase) { static const char s_szDigits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; char *pszRet = psz; if (psz != NULL) { if (cch >= (lVal < 0 ? 3U : 2U)) { /* prefix */ if (lVal < 0) { *psz++ = '-'; cch--; lVal = -lVal; } /* the digits */ do { *psz++ = s_szDigits[lVal % iBase]; cch--; lVal /= iBase; } while (lVal && cch > 1); /* overflow indicator */ if (lVal) psz[-1] = '+'; } else if (cch > 1) *psz++ = '+'; else if (cch < 1) return pszRet; *psz = '\0'; } return pszRet; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrNPCat.c����������������������������������������������0000664�0001750�0001750�00000003460�14670377514�022421� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrNPCat.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNPCat. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrNPCat(char *pszDst, const char *pszSrc, KSIZE cb) { char ch; while (*pszDst != '\0') pszDst++; while (cb-- > 0) { ch = *pszSrc++; if (!ch) break; *pszDst++ = ch; } *pszDst = '\0'; return pszDst; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrNIPCompAscii.c���������������������������������������0000664�0001750�0001750�00000004040�14670377514�023665� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrNIPCompAscii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNIPCompAscii. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrNIPCompAscii(const char *psz1, const char *psz2, KSIZE cb) { while (cb-- > 0) { char ch1 = *psz1; char ch2 = *psz2; if (ch1 != ch2) { if (ch1 <= 'Z' && ch1 >= 'A') ch1 += 'a' - 'A'; if (ch2 <= 'Z' && ch2 >= 'A') ch2 += 'a' - 'A'; if (ch1 != ch2) return (char *)psz1; } if (!ch1) break; psz1++; psz2++; } return NULL; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrRChr.c�����������������������������������������������0000664�0001750�0001750�00000003572�14670377514�022316� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrRChr.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrRChr. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrRChr(const char *psz, int ch) { char *pszLast; if (!ch) { while (*psz) psz++; return (char *)psz; } pszLast = NULL; for (;;) { int chCur = *psz; if (chCur == ch) pszLast = (char *)psz; else if (!chCur) return pszLast; psz++; } } ��������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrChr.c������������������������������������������������0000664�0001750�0001750�00000003504�14670377514�022167� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrChr.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrChr. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrChr(const char *psz, int ch) { if (!ch) { while (*psz) psz++; return (char *)psz; } for (;;) { int chCur = *psz; if (chCur == ch) return (char *)psz; if (!chCur) return NULL; psz++; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrComp.c�����������������������������������������������0000664�0001750�0001750�00000003436�14670377514�022355� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrComp. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(int) kHlpStrComp(const char *psz1, const char *psz2) { for (;;) { char ch1 = *psz1; char ch2 = *psz2; if (ch1 != ch2) return ch1 > ch2 ? 1 : -1; if (!ch1) return 0; psz1++; psz2++; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrICompAscii.c�����������������������������������������0000664�0001750�0001750�00000003773�14670377514�023443� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrICompAscii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrICompAscii. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(int) kHlpStrICompAscii(const char *psz1, const char *psz2) { for (;;) { char ch1 = *psz1; char ch2 = *psz2; if (ch1 != ch2) { if (ch1 <= 'Z' && ch1 >= 'A') ch1 += 'a' - 'A'; if (ch2 <= 'Z' && ch2 >= 'A') ch2 += 'a' - 'A'; if (ch1 != ch2) return ch1 > ch2 ? 1 : -1; } if (!ch1) return 0; psz1++; psz2++; } } �����kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpPage.c��������������������������������������������������0000664�0001750�0001750�00000024325�14670377514�021642� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpPage.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlp - Generic Page Memory Functions. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpAlloc.h> #include <k/kHlpAssert.h> #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS # include <k/kHlpSys.h> # include <sys/mman.h> #elif K_OS == K_OS_OS2 # define INCL_BASE # define INCL_ERRORS # include <os2.h> #elif K_OS == K_OS_WINDOWS # include <Windows.h> #else # error "port me" #endif /******************************************************************************* * Global Variables * *******************************************************************************/ #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS /* nothing */ #elif K_OS == K_OS_OS2 /** The base of the loader stub object. <kLdr Hack> * The OS/2 exe stub consists of a single data object. When allocating memory * for an executable, we'll have to reuse this. */ static void *g_pvStub = NULL; /** The size of the stub object - 0 if no stub. <kLdr Hack> */ static KSIZE g_cbStub = 0; #elif K_OS == K_OS_WINDOWS /** The system info. */ static SYSTEM_INFO g_SystemInfo; #else # error "port me" #endif #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS static int kHlpPageProtToNative(KPROT enmProt) { switch (enmProt) { case KPROT_NOACCESS: return PROT_NONE; case KPROT_READONLY: return PROT_READ; case KPROT_READWRITE: return PROT_READ | PROT_WRITE; case KPROT_EXECUTE: return PROT_EXEC; case KPROT_EXECUTE_READ: return PROT_EXEC | PROT_READ; case KPROT_EXECUTE_READWRITE: return PROT_EXEC | PROT_READ | PROT_WRITE; default: kHlpAssert(0); return ~0U; } } #elif K_OS == K_OS_OS2 static ULONG kHlpPageProtToNative(KPROT enmProt) { switch (enmProt) { case KPROT_NOACCESS: return PAG_EXECUTE | PAG_READ | PAG_WRITE; case KPROT_READONLY: return PAG_COMMIT | PAG_READ; case KPROT_READWRITE: return PAG_COMMIT | PAG_READ | PAG_WRITE; case KPROT_EXECUTE: return PAG_COMMIT | PAG_EXECUTE; case KPROT_EXECUTE_READ: return PAG_COMMIT | PAG_EXECUTE | PAG_READ; case KPROT_EXECUTE_READWRITE: return PAG_COMMIT | PAG_EXECUTE | PAG_READ | PAG_WRITE; default: kHlpAssert(0); return ~0U; } } #elif K_OS == K_OS_WINDOWS static DWORD kHlpPageProtToNative(KPROT enmProt) { switch (enmProt) { case KPROT_NOACCESS: return PAGE_NOACCESS; case KPROT_READONLY: return PAGE_READONLY; case KPROT_READWRITE: return PAGE_READWRITE; case KPROT_EXECUTE: return PAGE_EXECUTE; case KPROT_EXECUTE_READ: return PAGE_EXECUTE_READ; case KPROT_EXECUTE_READWRITE: return PAGE_EXECUTE_READWRITE; default: kHlpAssert(0); return ~0U; } } #endif /** * Allocate a chunk of memory with page granularity. * * @returns 0 on success, non-zero OS status code on failure. * @param ppv Where to store the address of the allocated memory. * If fFixed is set, *ppv will on entry contain the desired address (page aligned). * @param cb Number of bytes. Page aligned. * @param enmProt The new protection. Copy-on-write is invalid. */ KHLP_DECL(int) kHlpPageAlloc(void **ppv, KSIZE cb, KPROT enmProt, KBOOL fFixed) { #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS void *pv; pv = kHlpSys_mmap(fFixed ? *ppv : NULL, cb, kHlpPageProtToNative(enmProt), fFixed ? MAP_FIXED | MAP_ANON: MAP_ANON, -1, 0); if ((KIPTR)pv < 256) { kHlpAssert(0); return (int)(KIPTR)pv; /** @todo convert errno to kErrors */ } *ppv = pv; return 0; #elif K_OS == K_OS_OS2 APIRET rc; ULONG fFlags = kHlpPageProtToNative(enmProt); if (!fFixed) { /* simple */ rc = DosAllocMem(ppv, cb, fFlags | OBJ_ANY); if (rc == ERROR_INVALID_PARAMETER) rc = DosAllocMem(ppv, cb, fFlags); } else { /* not so simple. */ /** @todo I've got code for this in libc somewhere. */ rc = -1; } if (!rc) return 0; kHlpAssert(0); return rc; #elif K_OS == K_OS_WINDOWS /* (We don't have to care about the stub here, because the stub will be unmapped before we get here.) */ int rc; DWORD fProt = kHlpPageProtToNative(enmProt); if (!g_SystemInfo.dwPageSize) GetSystemInfo(&g_SystemInfo); *ppv = VirtualAlloc(fFixed ? *ppv : NULL, cb, MEM_COMMIT, fProt); if (*ppv != NULL) return 0; rc = GetLastError(); kHlpAssert(0); return rc; #else # error "port me" #endif } /** * Change the protection of one or more pages in an allocation. * * (This will of course only work correctly on memory allocated by kHlpPageAlloc().) * * @returns 0 on success, non-zero OS status code on failure. * @param pv First page. Page aligned. * @param cb Number of bytes. Page aligned. * @param enmProt The new protection. Copy-on-write is invalid. */ KHLP_DECL(int) kHlpPageProtect(void *pv, KSIZE cb, KPROT enmProt) { #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS int rc; rc = kHlpSys_mprotect(pv, cb, kHlpPageProtToNative(enmProt)); if (!rc) return 0; /** @todo convert errno -> kErrors */ kHlpAssert(0); return rc; #elif K_OS == K_OS_OS2 APIRET rc; ULONG fFlags = kHlpPageProtToNative(enmProt); /* * The non-stub pages. */ rc = DosSetMem(pv, cb, fFlags); if (rc && fFlags != PAG_DECOMMIT) rc = DosSetMem(pv, cb, fFlags | PAG_COMMIT); if (rc) { /* Try page by page. */ while (cb > 0) { rc = DosSetMem(pv, 0x1000, fFlags); if (rc && fFlags != PAG_DECOMMIT) rc = DosSetMem(pv, 0x1000, fFlags | PAG_COMMIT); if (rc) return rc; pv = (void *)((KUPTR)pv + 0x1000); cb -= 0x1000; } } kHlpAssert(!rc); return rc; #elif K_OS == K_OS_WINDOWS DWORD fOldProt = 0; DWORD fProt = kHlpPageProtToNative(enmProt); int rc = 0; if (!VirtualProtect(pv, cb, fProt, &fOldProt)) { rc = GetLastError(); kHlpAssert(0); } return rc; #else # error "port me" #endif } /** * Free memory allocated by kHlpPageAlloc(). * * @returns 0 on success, non-zero OS status code on failure. * @param pv The address returned by kHlpPageAlloc(). * @param cb The byte count requested from kHlpPageAlloc(). */ KHLP_DECL(int) kHlpPageFree(void *pv, KSIZE cb) { #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS int rc; rc = kHlpSys_munmap(pv, cb); if (!rc) return 0; /** @todo convert errno -> kErrors */ return rc; #elif K_OS == K_OS_OS2 APIRET rc; /* * Deal with any portion overlapping with the stub. */ KUPTR offStub = (KUPTR)pv - (KUPTR)g_pvStub; if (offStub < g_cbStub) { /* decommit the pages in the stub. */ KSIZE cbStub = K_MIN(g_cbStub - offStub, cb); rc = DosSetMem(pv, cbStub, PAG_DECOMMIT); if (rc) { /* Page by page, ignoring errors after the first success. */ while (cbStub > 0) { if (!DosSetMem(pv, 0x1000, PAG_DECOMMIT)) rc = 0; pv = (void *)((KUPTR)pv + 0x1000); cbStub -= 0x1000; cb -= 0x1000; } if (rc) { kHlpAssert(!rc); return rc; } } else { cb -= cbStub; if (!cb) return 0; pv = (void *)((KUPTR)pv + cbStub); } } /* * Free the object. */ rc = DosFreeMem(pv); kHlpAssert(!rc); return rc; #elif K_OS == K_OS_WINDOWS /* * Free the object. */ int rc = 0; if (!VirtualFree(pv, 0 /*cb*/, MEM_RELEASE)) { rc = GetLastError(); kHlpAssert(0); } return rc; #else # error "port me" #endif } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrNPComp.c���������������������������������������������0000664�0001750�0001750�00000003501�14670377514�022604� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrNPComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNPComp. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrNPComp(const char *psz1, const char *psz2, KSIZE cb) { while (cb-- > 0) { char ch1 = *psz1; char ch2 = *psz2; if (ch1 != ch2) return (char *)psz1; if (!ch1) break; psz1++; psz2++; } return NULL; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpMemMove.c�����������������������������������������������0000664�0001750�0001750�00000005132�14670377514�022326� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpMemMove.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemMove. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(void *) kHlpMemMove(void *pv1, const void *pv2, KSIZE cb) { union { void *pv; KU8 *pb; KUPTR *pu; } u1; union { const void *pv; volatile KU8 *pb; volatile KUPTR *pu; } u2; u1.pv = pv1; u2.pv = pv2; if ((KUPTR)u1.pb <= (KUPTR)u2.pb) { /* forward copy */ if (cb >= 32) { while (cb > sizeof(KUPTR)) { KUPTR u = *u2.pu++; *u1.pu++ = u; cb -= sizeof(KUPTR); } } while (cb-- > 0) { KU8 b = *u2.pb++; *u1.pb++ = b; } } else { /* backwards copy */ u1.pb += cb; u2.pb += cb; if (cb >= 32) { while (cb > sizeof(KUPTR)) { KUPTR u = *--u2.pu; *--u1.pu = u; cb -= sizeof(KUPTR); } } while (cb-- > 0) { KU8 b = *--u2.pb; *--u1.pb = b; } } return pv1; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrNComp.c����������������������������������������������0000664�0001750�0001750�00000003475�14670377514�022476� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrNComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNComp. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(int) kHlpStrNComp(const char *psz1, const char *psz2, KSIZE cb) { while (cb-- > 0) { char ch1 = *psz1; char ch2 = *psz2; if (ch1 != ch2) return ch1 > ch2 ? 1 : -1; if (!ch1) break; psz1++; psz2++; } return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrLen.c������������������������������������������������0000664�0001750�0001750�00000003222�14670377514�022166� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrLen.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrLen. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(KSIZE) kHlpStrLen(const char *psz) { const char *pszEnd = psz; while (*pszEnd) pszEnd++; return pszEnd - psz; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpMemChr.c������������������������������������������������0000664�0001750�0001750�00000003373�14670377514�022141� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpMemChr.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemChr. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(void *) kHlpMemChr(const void *pv1, int ch, KSIZE cb) { const KU8 b = ch; const KU8 *pb = (const KU8 *)pv1; while (cb-- > 0) { if (*pb == b) return (void *)pb; pb++; } return NULL; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrNICompAscii.c����������������������������������������0000664�0001750�0001750�00000004033�14670377514�023547� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrNICompAscii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNICompAscii. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(int) kHlpStrNICompAscii(const char *psz1, const char *psz2, KSIZE cb) { while (cb-- > 0) { char ch1 = *psz1; char ch2 = *psz2; if (ch1 != ch2) { if (ch1 <= 'Z' && ch1 >= 'A') ch1 += 'a' - 'A'; if (ch2 <= 'Z' && ch2 >= 'A') ch2 += 'a' - 'A'; if (ch1 != ch2) return ch1 > ch2 ? 1 : -1; } if (!ch1) break; psz1++; psz2++; } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpGetEnvUZ.c����������������������������������������������0000664�0001750�0001750�00000006047�14670377514�022436� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpGetEnvUZ.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpEnv - kHlpGetEnvUZ. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpEnv.h> #include <k/kHlpString.h> /** * Gets an environment variable and converts it to a KSIZE. * * @returns 0 and *pcb on success. * @returns On failure see kHlpGetEnv. * @param pszVar The name of the variable. * @param pcb Where to put the value. */ KHLP_DECL(int) kHlpGetEnvUZ(const char *pszVar, KSIZE *pcb) { KSIZE cb; unsigned uBase; char szVal[64]; KSIZE cchVal = sizeof(szVal); const char *psz; int rc; *pcb = 0; rc = kHlpGetEnv(pszVar, szVal, cchVal); if (rc) return rc; /* figure out the base. */ uBase = 10; psz = szVal; if ( *psz == '0' && (psz[1] == 'x' || psz[1] == 'X')) { uBase = 16; psz += 2; } /* convert it up to the first unknown char. */ cb = 0; for(;;) { const char ch = *psz; unsigned uDigit; if (!ch) break; else if (ch >= '0' && ch <= '9') uDigit = ch - '0'; else if (ch >= 'a' && ch <= 'z') uDigit = ch - 'a' + 10; else if (ch >= 'A' && ch <= 'Z') uDigit = ch - 'A' + 10; else break; if (uDigit >= uBase) break; /* add the digit */ cb *= uBase; cb += uDigit; psz++; } /* check for unit */ if (*psz == 'm' || *psz == 'M') cb *= 1024*1024; else if (*psz == 'k' ||*psz == 'K') cb *= 1024; else if (*psz == 'g' || *psz == 'G') cb *= 1024*1024*1024; *pcb = cb; return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpMemPComp.c����������������������������������������������0000664�0001750�0001750�00000004155�14670377514�022442� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpMemPComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemPComp. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(void *) kHlpMemPComp(const void *pv1, const void *pv2, KSIZE cb) { union { const void *pv; const KU8 *pb; const KUPTR *pu; } u1, u2; u1.pv = pv1; u2.pv = pv2; if (cb >= 32) { while (cb > sizeof(KUPTR)) { if (*u1.pu != *u2.pu) break; /* over to mr. byte-by-byte */ u1.pu++; u2.pu++; cb -= sizeof(KUPTR); } } while (cb-- > 0) { if (u1.pb != u2.pb) return (void *)u1.pb; u1.pb++; u2.pb++; } return NULL; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrPCopy.c����������������������������������������������0000664�0001750�0001750�00000003254�14670377514�022507� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrPCopy.c 83 2016-08-30 18:38:12Z bird $ */ /** @file * kHlpString - kHlpStrPCopy. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrPCopy(char *pszDst, const char *pszSrc) { char ch; do *pszDst++ = ch = *pszSrc++; while (ch); return pszDst - 1; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrCopy.c�����������������������������������������������0000664�0001750�0001750�00000003270�14670377514�022365� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrCopy.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrCopy. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrCopy(char *pszDst, const char *pszSrc) { char ch; char *psz = pszDst; do *psz++ = ch = *pszSrc; while (ch); return pszDst; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpStrPCat.c�����������������������������������������������0000664�0001750�0001750�00000003361�14670377514�022303� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpStrPCat.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrPCat. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(char *) kHlpStrPCat(char *pszDst, const char *psz2) { char ch; while (*pszDst != '\0') pszDst++; do { ch = *psz2++; *pszDst++ = ch; } while (ch != '\0'); return pszDst - 1; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpMemSet.c������������������������������������������������0000664�0001750�0001750�00000004127�14670377514�022156� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpMemSet.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemSet. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(void *) kHlpMemSet(void *pv1, int ch, KSIZE cb) { union { void *pv; KU8 *pb; KUPTR *pu; } u1; u1.pv = pv1; if (cb >= 32) { KUPTR u = ch & 0xff; #if K_ARCH_BITS > 8 u |= u << 8; #endif #if K_ARCH_BITS > 16 u |= u << 16; #endif #if K_ARCH_BITS > 32 u |= u << 32; #endif #if K_ARCH_BITS > 64 u |= u << 64; #endif while (cb > sizeof(KUPTR)) { cb -= sizeof(KUPTR); *u1.pu++ = u; } } while (cb-- > 0) *u1.pb++ = ch; return pv1; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpMemPSet.c�����������������������������������������������0000664�0001750�0001750�00000004135�14670377514�022275� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpMemPSet.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemPSet. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(void *) kHlpMemPSet(void *pv1, int ch, KSIZE cb) { union { void *pv; KU8 *pb; KUPTR *pu; } u1; u1.pv = pv1; if (cb >= 32) { KUPTR u = ch & 0xff; #if K_ARCH_BITS > 8 u |= u << 8; #endif #if K_ARCH_BITS > 16 u |= u << 16; #endif #if K_ARCH_BITS > 32 u |= u << 32; #endif #if K_ARCH_BITS > 64 u |= u << 64; #endif while (cb > sizeof(KUPTR)) { cb -= sizeof(KUPTR); *u1.pu++ = u; } } while (cb-- > 0) *u1.pb++ = ch; return u1.pb; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kHlp/Generic/kHlpMemCopy.c�����������������������������������������������0000664�0001750�0001750�00000003777�14670377514�022347� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpMemCopy.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemCopy. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kHlpString.h> KHLP_DECL(void *) kHlpMemCopy(void *pv1, const void *pv2, KSIZE cb) { union { void *pv; KU8 *pb; KUPTR *pu; } u1; union { const void *pv; const KU8 *pb; const KUPTR *pu; } u2; u1.pv = pv1; u2.pv = pv2; if (cb >= 32) { while (cb > sizeof(KUPTR)) { cb -= sizeof(KUPTR); *u1.pu++ = *u2.pu++; } } while (cb-- > 0) *u1.pb++ = *u2.pb++; return pv1; } �kbuild-3608/src/lib/kStuff/Makefile.kmk�������������������������������������������������������������0000664�0001750�0001750�00000003554�14670377515�017754� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kStuff - Top-level makefile. # # # Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # DEPTH = . include $(PATH_KBUILD)/subheader.kmk include $(PATH_SUB_CURRENT)/kCpu/Makefile.kmk include $(PATH_SUB_CURRENT)/kDbg/Makefile.kmk include $(PATH_SUB_CURRENT)/kErr/Makefile.kmk include $(PATH_SUB_CURRENT)/kLdr/Makefile.kmk include $(PATH_SUB_CURRENT)/kRdr/Makefile.kmk include $(PATH_SUB_CURRENT)/kHlp/Makefile.kmk ifn1of ($(KBUILD_TARGET), darwin) include $(PATH_SUB_CURRENT)/kProfiler2/Makefile.kmk endif LIBRARIES += kStuffStatic kStuffStatic_TEMPLATE = kStuffLIB kStuffStatic_SOURCES = \ $(TARGET_kCpuStatic) \ $(TARGET_kDbgStatic) \ $(TARGET_kErrStatic) \ $(TARGET_kLdrStatic) \ $(TARGET_kRdrStatic) include $(PATH_KBUILD)/subfooter.kmk ����������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/Copyright����������������������������������������������������������������0000664�0001750�0001750�00000002144�14670377514�017417� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������All kStuff files are: Copyright (c) 2006-2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kRdr/��������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�016425� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kRdr/kRdr.cpp������������������������������������������������������������0000664�0001750�0001750�00000021571�14670377514�020041� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRdr.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kRdr - The File Provider. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "kRdrInternal.h" /******************************************************************************* * Global Variables * *******************************************************************************/ /** The list of file providers. */ static PCKRDROPS g_pRdrHead = &g_kRdrFileOps; /** * Adds a new file provider. * * @param pAdd The new file provider. */ KRDR_DECL(void) kRdrAddProvider(PKRDROPS pAdd) { pAdd->pNext = g_pRdrHead; g_pRdrHead = pAdd; } /** * Tries to opens a file. * * @returns 0 on success, OS status code on failure. * @param ppRdr Where to store the file provider instance. * @param pszFilename The filename. */ KRDR_DECL(int) kRdrOpen(PPKRDR ppRdr, const char *pszFilename) { int rc = -1; PCKRDROPS pCur; for (pCur = g_pRdrHead; pCur; pCur = pCur->pNext) { rc = pCur->pfnCreate(ppRdr, pszFilename); if (!rc) return 0; } return rc; } /** * Closes the file. * * @returns 0 on success, OS specific error code on failure. * On failure, the file provider instance will be in an indeterminate state - don't touch it! * @param pRdr The file provider instance. */ KRDR_DECL(int) kRdrClose(PKRDR pRdr) { KRDR_VALIDATE(pRdr); return pRdr->pOps->pfnDestroy(pRdr); } /** Read bits from the file. * * @returns 0 on success, OS specific error code on failure. * @param pRdr The file provider instance. * @param pvBuf Where to put the bits. * @param cb The number of bytes to read. * @param off Where to start reading. */ KRDR_DECL(int) kRdrRead(PKRDR pRdr, void *pvBuf, KSIZE cb, KFOFF off) { KRDR_VALIDATE(pRdr); return pRdr->pOps->pfnRead(pRdr, pvBuf, cb, off); } /** Map all the file bits into memory (read only). * * @returns 0 on success, OS specific error code on failure. * @param pRdr The file provider instance. * @param ppvBits Where to store the address of the mapping. * The size can be obtained using pfnSize. */ KRDR_DECL(int) kRdrAllMap(PKRDR pRdr, const void **ppvBits) { KRDR_VALIDATE(pRdr); return pRdr->pOps->pfnAllMap(pRdr, ppvBits); } /** Unmap a file bits mapping obtained by KRDROPS::pfnAllMap. * * @returns 0 on success, OS specific error code on failure. * @param pRdr The file provider instance. * @param pvBits The mapping address. */ KRDR_DECL(int) kRdrAllUnmap(PKRDR pRdr, const void *pvBits) { KRDR_VALIDATE(pRdr); return pRdr->pOps->pfnAllUnmap(pRdr, pvBits); } /** Get the file size. * * @returns The file size. Returns -1 on failure. * @param pRdr The file provider instance. */ KRDR_DECL(KFOFF) kRdrSize(PKRDR pRdr) { KRDR_VALIDATE(pRdr); return pRdr->pOps->pfnSize(pRdr); } /** Get the file pointer offset. * * @returns The file pointer offset. Returns -1 on failure. * @param pRdr The file provider instance. */ KRDR_DECL(KFOFF) kRdrTell(PKRDR pRdr) { KRDR_VALIDATE(pRdr); return pRdr->pOps->pfnTell(pRdr); } /** Get the file name. * * @returns The file name. Returns NULL on failure. * @param pRdr The file provider instance. */ KRDR_DECL(const char *) kRdrName(PKRDR pRdr) { KRDR_VALIDATE_EX(pRdr, NULL); return pRdr->pOps->pfnName(pRdr); } /** Get the native file handle if possible. * * @returns The native file handle. Returns -1 if not available. * @param pRdr The file provider instance. */ KRDR_DECL(KIPTR) kRdrNativeFH(PKRDR pRdr) { KRDR_VALIDATE_EX(pRdr, -1); return pRdr->pOps->pfnNativeFH(pRdr); } /** * Gets the page size used when mapping sections of the file. * * @returns The page size. * @param pRdr The file provider instance. */ KRDR_DECL(KSIZE) kRdrPageSize(PKRDR pRdr) { KRDR_VALIDATE_EX(pRdr, 0x10000); return pRdr->pOps->pfnPageSize(pRdr); } /** * Maps the segments of a image into memory. * * The file reader will be using the RVA member of each segment to figure out where * it goes relative to the image base address. * * @returns 0 on success, OS specific error code on failure. * @param pRdr The file provider instance. * @param ppvBase On input when fFixed is set, this contains the base address of the mapping. * On output this contains the base of the image mapping. * @param cSegments The number of segments in the array pointed to by paSegments. * @param paSegments The segments thats going to be mapped. * @param fFixed If set, the address at *ppvBase should be the base address of the mapping. */ KRDR_DECL(int) kRdrMap(PKRDR pRdr, void **ppvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed) { KRDR_VALIDATE(pRdr); return pRdr->pOps->pfnMap(pRdr, ppvBase, cSegments, paSegments, fFixed); } /** * Reloads dirty pages in mapped image. * * @returns 0 on success, OS specific error code on failure. * @param pRdr The file provider instance. * @param pvBase The base address of the image mapping. * @param cSegments The number of segments in the array pointed to by paSegments. * @param paSegments The segments thats going to be mapped. */ KRDR_DECL(int) kRdrRefresh(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments) { KRDR_VALIDATE(pRdr); return pRdr->pOps->pfnRefresh(pRdr, pvBase, cSegments, paSegments); } /** * Protects or unprotects an image mapping. * * This is typically used for getting write access to read or execute only * pages while applying fixups. * * @returns 0 on success, OS specific error code on failure. * @param pRdr The file provider instance. * @param pvBase The base address of the image mapping. * @param cSegments The number of segments in the array pointed to by paSegments. * @param paSegments The segments thats going to be mapped. * @param fUnprotectOrProtect When set the all mapped segments are made writable. * When clean the segment protection is restored. */ KRDR_DECL(int) kRdrProtect(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect) { KRDR_VALIDATE(pRdr); return pRdr->pOps->pfnProtect(pRdr, pvBase, cSegments, paSegments, fUnprotectOrProtect); } /** * Unmaps a image mapping. * * @returns 0 on success, OS specific error code on failure. * @param pRdr The file provider instance. * @param pvBase The base address of the image mapping. * @param cSegments The number of segments in the array pointed to by paSegments. * @param paSegments The segments thats going to be mapped. */ KRDR_DECL(int) kRdrUnmap(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments) { KRDR_VALIDATE(pRdr); return pRdr->pOps->pfnUnmap(pRdr, pvBase, cSegments, paSegments); } /** * We're done reading from the file but would like to keep file mappings. * * If the OS support closing the file handle while the file is mapped, * the reader should do so. * * @param pRdr The file provider instance. */ KRDR_DECL(void) kRdrDone(PKRDR pRdr) { KRDR_VALIDATE_VOID(pRdr); pRdr->pOps->pfnDone(pRdr); } ���������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kRdr/Makefile.kmk��������������������������������������������������������0000664�0001750�0001750�00000003051�14670377514�020645� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kRdr - The File Provider, sub-makefile. # # # Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. SUB_DEPTH = .. include $(PATH_KBUILD)/subheader.kmk # # kRdrStatic - The file provider module. # LIBRARIES += kRdrStatic kRdrStatic_TEMPLATE = kStuffLIB kRdrStatic_DEFS = KDBG_BUILDING kRdrStatic_SOURCES = \ kRdr.cpp \ kRdrFile.cpp \ kRdrBuffered.cpp # Generate the rules include $(PATH_KBUILD)/subfooter.kmk ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kRdr/kRdrFile.cpp��������������������������������������������������������0000664�0001750�0001750�00000111746�14670377514�020645� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRdrFile.cpp 81 2016-08-18 22:10:38Z bird $ */ /** @file * kRdrFile - The Native File Provider */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "kRdrInternal.h" #include <k/kHlpAlloc.h> #include <k/kHlpString.h> #include <k/kErrors.h> #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS # include <k/kHlpSys.h> # include <sys/fcntl.h> # include <sys/mman.h> # include <unistd.h> #elif K_OS == K_OS_OS2 # define INCL_ERRORS # define INCL_BASE # include <os2.h> #elif K_OS == K_OS_WINDOWS # define WIN32_NO_STATUS # include <Windows.h> # include <ntsecapi.h> # include <ntstatus.h> # ifdef __cplusplus extern "C" { # endif /** @todo find a non-conflicting header with NTSTATUS, NTAPI, ++ */ typedef LONG NTSTATUS; #define NT_SUCCESS(x) ((x)>=0) typedef struct _OBJECT_ATTRIBUTES { ULONG Length; HANDLE RootDirectory; PUNICODE_STRING ObjectName; ULONG Attributes; PVOID SecurityDescriptor; PVOID SecurityQualityOfService; } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES; typedef enum _SECTION_INHERIT { ViewShare = 1, ViewUnmap = 2 } SECTION_INHERIT; # define NTOSAPI __declspec(dllimport) # define NtCurrentProcess() GetCurrentProcess() # ifndef MEM_DOS_LIM # define MEM_DOS_LIM 0x40000000UL # endif NTOSAPI NTSTATUS NTAPI NtCreateSection( OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER SectionSize OPTIONAL, IN ULONG Protect, IN ULONG Attributes, IN HANDLE FileHandle OPTIONAL ); NTOSAPI NTSTATUS NTAPI NtMapViewOfSection( IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG ZeroBits, IN ULONG CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect ); NTOSAPI NTSTATUS NTAPI NtUnmapViewOfSection( IN HANDLE ProcessHandle, IN PVOID BaseAddress ); NTOSAPI NTSTATUS NTAPI NtClose( IN HANDLE Handle ); NTOSAPI NTSTATUS NTAPI ZwProtectVirtualMemory( IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN OUT PSIZE_T ProtectSize, IN ULONG NewProtect, OUT PULONG OldProtect ); # define NtProtectVirtualMemory ZwProtectVirtualMemory NTOSAPI NTSTATUS NTAPI NtAllocateVirtualMemory( IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG ZeroBits, IN OUT PSIZE_T AllocationSize, IN ULONG AllocationType, IN ULONG Protect ); NTOSAPI NTSTATUS NTAPI NtFreeVirtualMemory( IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN OUT PSIZE_T FreeSize, IN ULONG FreeType ); # ifdef __cplusplus } # endif #else # error "port me" #endif /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Prepared stuff. */ typedef struct KRDRFILEPREP { /** The address of the prepared region. */ void *pv; /** The size of the prepared region. */ KSIZE cb; #if K_OS == K_OS_WINDOWS /** Handle to the section created to map the file. */ HANDLE hSection; #endif } KRDRFILEPREP, *PKRDRFILEPREP; /** * The file provier instance for native files. */ typedef struct KRDRFILE { /** The file reader vtable. */ KRDR Core; /** The file handle. */ #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS int File; #elif K_OS == K_OS_OS2 HFILE File; #elif K_OS == K_OS_WINDOWS HANDLE File; #else # error "Port me!" #endif /** The current file offset. */ KFOFF off; /** The file size. */ KFOFF cb; /** Array where we stuff the mapping area data. */ KRDRFILEPREP aPreps[4]; /** The number of current preps. */ KU32 cPreps; /** Number of mapping references. */ KI32 cMappings; /** The memory mapping. */ void *pvMapping; /** The filename. */ char szFilename[1]; } KRDRFILE, *PKRDRFILE; /******************************************************************************* * Internal Functions * *******************************************************************************/ static void krdrFileDone(PKRDR pRdr); static int krdrFileUnmap(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments); static int krdrFileGenericUnmap(PKRDR pRdr, PKRDRFILEPREP pPrep, KU32 cSegments, PCKLDRSEG paSegments); static int krdrFileProtect(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect); static int krdrFileGenericProtect(PKRDR pRdr, PKRDRFILEPREP pPrep, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect); static int krdrFileRefresh(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments); static int krdrFileGenericRefresh(PKRDR pRdr, PKRDRFILEPREP pPrep, KU32 cSegments, PCKLDRSEG paSegments); static int krdrFileMap(PKRDR pRdr, void **ppvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed); static int krdrFileGenericMap(PKRDR pRdr, PKRDRFILEPREP pPrep, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed); static KSIZE krdrFilePageSize(PKRDR pRdr); static const char *krdrFileName(PKRDR pRdr); static KIPTR krdrFileNativeFH(PKRDR pRdr); static KFOFF krdrFileTell(PKRDR pRdr); static KFOFF krdrFileSize(PKRDR pRdr); static int krdrFileAllUnmap(PKRDR pRdr, const void *pvBits); static int krdrFileAllMap(PKRDR pRdr, const void **ppvBits); static int krdrFileRead(PKRDR pRdr, void *pvBuf, KSIZE cb, KFOFF off); static int krdrFileDestroy(PKRDR pRdr); static int krdrFileCreate(PPKRDR ppRdr, const char *pszFilename); /******************************************************************************* * Global Variables * *******************************************************************************/ /** Native file provider operations. */ const KRDROPS g_kRdrFileOps = { "native file", NULL, krdrFileCreate, krdrFileDestroy, krdrFileRead, krdrFileAllMap, krdrFileAllUnmap, krdrFileSize, krdrFileTell, krdrFileName, krdrFileNativeFH, krdrFilePageSize, krdrFileMap, krdrFileRefresh, krdrFileProtect, krdrFileUnmap, krdrFileDone, 42 }; #if K_OS == K_OS_WINDOWS /** * Converts a kLdr segment protection to NT protection for a mapping. * * @returns Nt page protection. * @param enmProt kLdr protection. */ static ULONG krdrFileGetNtMapProt(KPROT enmProt) { switch (enmProt) { case KPROT_NOACCESS: return PAGE_NOACCESS; case KPROT_READONLY: return PAGE_READONLY; case KPROT_READWRITE: return PAGE_READWRITE; case KPROT_WRITECOPY: return PAGE_WRITECOPY; case KPROT_EXECUTE: return PAGE_EXECUTE; case KPROT_EXECUTE_READ: return PAGE_EXECUTE_READ; case KPROT_EXECUTE_READWRITE: return PAGE_EXECUTE_READWRITE; case KPROT_EXECUTE_WRITECOPY: return PAGE_EXECUTE_WRITECOPY; default: return ~(ULONG)0; } } /** * Converts a kLdr segment protection to NT protection for a allocation. * * @returns Nt page protection. * @param enmProt kLdr protection. */ static ULONG krdrFileGetNtAllocProt(KPROT enmProt) { switch (enmProt) { case KPROT_NOACCESS: return PAGE_NOACCESS; case KPROT_READONLY: return PAGE_READONLY; case KPROT_WRITECOPY: case KPROT_READWRITE: return PAGE_READWRITE; case KPROT_EXECUTE: return PAGE_EXECUTE; case KPROT_EXECUTE_READ: return PAGE_EXECUTE_READ; case KPROT_EXECUTE_WRITECOPY: case KPROT_EXECUTE_READWRITE: return PAGE_EXECUTE_READWRITE; default: return ~(ULONG)0; } } #endif /** @copydoc KRDROPS::pfnDone */ static void krdrFileDone(PKRDR pRdr) { } /** * Finds a prepared mapping region. * * @returns Pointer to the aPrep entry. * @param pFile The instance data. * @param pv The base of the region. */ static PKRDRFILEPREP krdrFileFindPrepExact(PKRDRFILE pFile, void *pv) { KI32 i = pFile->cPreps; while (i-- > 0) if (pFile->aPreps[i].pv == pv) return &pFile->aPreps[i]; return NULL; } /** @copydoc KRDROPS::pfnUnmap */ static int krdrFileUnmap(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; PKRDRFILEPREP pPrep = krdrFileFindPrepExact(pRdrFile, pvBase); int rc; if (!pPrep) return KERR_INVALID_PARAMETER; #if K_OS == K_OS_WINDOWS if (pPrep->hSection != NULL) { /** @todo implement me. */ return -1; } #endif rc = krdrFileGenericUnmap(pRdr, pPrep, cSegments, paSegments); /* remove the mapping data on success. */ if (!rc) { pRdrFile->cPreps--; if (pPrep != &pRdrFile->aPreps[pRdrFile->cPreps]) *pPrep = pRdrFile->aPreps[pRdrFile->cPreps]; } return rc; } /** Generic implementation of krdrFileUnmap. */ static int krdrFileGenericUnmap(PKRDR pRdr, PKRDRFILEPREP pPrep, KU32 cSegments, PCKLDRSEG paSegments) { krdrFileGenericProtect(pRdr, pPrep, cSegments, paSegments, 1 /* unprotect */); return kHlpPageFree(pPrep->pv, pPrep->cb); } /** @copydoc KRDROPS::pfnProtect */ static int krdrFileProtect(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; PKRDRFILEPREP pPrep = krdrFileFindPrepExact(pRdrFile, pvBase); if (!pPrep) return KERR_INVALID_PARAMETER; #if K_OS == K_OS_WINDOWS if (pPrep->hSection != NULL) { /** @todo implement me. */ return -1; } #endif return krdrFileGenericProtect(pRdr, pPrep, cSegments, paSegments, fUnprotectOrProtect); } /** Generic implementation of krdrFileProtect. */ static int krdrFileGenericProtect(PKRDR pRdr, PKRDRFILEPREP pPrep, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect) { KU32 i; /* * Iterate the segments and apply memory protection changes. */ for (i = 0; i < cSegments; i++) { int rc; void *pv; KPROT enmProt; if (paSegments[i].RVA == NIL_KLDRADDR) continue; /* calc new protection. */ enmProt = (KPROT)paSegments[i].enmProt; /** @todo drop cast */ if (fUnprotectOrProtect) { switch (enmProt) { case KPROT_NOACCESS: case KPROT_READONLY: case KPROT_READWRITE: case KPROT_WRITECOPY: enmProt = KPROT_READWRITE; break; case KPROT_EXECUTE: case KPROT_EXECUTE_READ: case KPROT_EXECUTE_READWRITE: case KPROT_EXECUTE_WRITECOPY: enmProt = KPROT_EXECUTE_READWRITE; break; default: kRdrAssert(!"bad enmProt"); return -1; } } else { /* copy on write -> normal write. */ if (enmProt == KPROT_EXECUTE_WRITECOPY) enmProt = KPROT_EXECUTE_READWRITE; else if (enmProt == KPROT_WRITECOPY) enmProt = KPROT_READWRITE; } pv = (KU8 *)pPrep->pv + paSegments[i].RVA; rc = kHlpPageProtect(pv, paSegments[i].cbMapped, enmProt); if (rc) break; } return 0; } /** @copydoc KRDROPS::pfnRefresh */ static int krdrFileRefresh(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; PKRDRFILEPREP pPrep = krdrFileFindPrepExact(pRdrFile, pvBase); if (!pPrep) return KERR_INVALID_PARAMETER; #if K_OS == K_OS_WINDOWS if (pPrep->hSection != NULL) { /** @todo implement me. */ return -1; } #endif return krdrFileGenericRefresh(pRdr, pPrep, cSegments, paSegments); } /** Generic implementation of krdrFileRefresh. */ static int krdrFileGenericRefresh(PKRDR pRdr, PKRDRFILEPREP pPrep, KU32 cSegments, PCKLDRSEG paSegments) { int rc; int rc2; KU32 i; /* * Make everything writable again. */ rc = krdrFileGenericProtect(pRdr, pPrep, cSegments, paSegments, 1 /* unprotect */); if (rc) { krdrFileGenericProtect(pRdr, pPrep, cSegments, paSegments, 0 /* protect */); return rc; } /* * Clear everything. */ /** @todo only zero the areas not covered by raw file bits. */ kHlpMemSet(pPrep->pv, 0, pPrep->cb); /* * Reload all the segments. * We could possibly skip some segments, but we currently have * no generic way of figuring out which at the moment. */ for (i = 0; i < cSegments; i++) { void *pv; if ( paSegments[i].RVA == NIL_KLDRADDR || paSegments[i].cbFile <= 0) continue; pv = (KU8 *)pPrep->pv + paSegments[i].RVA; rc = pRdr->pOps->pfnRead(pRdr, pv, paSegments[i].cbFile, paSegments[i].offFile); if (rc) break; } /* * Protect the bits again. */ rc2 = krdrFileGenericProtect(pRdr, pPrep, cSegments, paSegments, 0 /* protect */); if (rc2 && rc) rc = rc2; return rc; } /** @copydoc KRDROPS::pfnMap */ static int krdrFileMap(PKRDR pRdr, void **ppvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; PKRDRFILEPREP pPrep = &pRdrFile->aPreps[pRdrFile->cPreps]; KLDRSIZE cbTotal; const KSIZE cbPage = pRdr->pOps->pfnPageSize(pRdr); int rc; KU32 i; if (pRdrFile->cPreps >= K_ELEMENTS(pRdrFile->aPreps)) return KRDR_ERR_TOO_MANY_MAPPINGS; /* * Calc the total mapping space needed. */ cbTotal = 0; for (i = 0; i < cSegments; i++) { KLDRSIZE uRVASegmentEnd; if (paSegments[i].RVA == NIL_KLDRADDR) continue; uRVASegmentEnd = paSegments[i].RVA + paSegments[i].cbMapped; if (cbTotal < uRVASegmentEnd) cbTotal = uRVASegmentEnd; } pPrep->cb = (KSIZE)cbTotal; if (pPrep->cb != cbTotal) return KLDR_ERR_ADDRESS_OVERFLOW; pPrep->cb = (pPrep->cb + (cbPage - 1)) & ~(cbPage- 1); #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS /** @todo */ #elif K_OS == K_OS_WINDOWS /* * The NT memory mapped file API sucks in a lot of ways. Unless you're actually * trying to map a PE image and the kernel can parse the file for it self, the * API just isn't up to scratch. * * Problems: * 1. Reserving memory for the views is risky because you can't reserve and * map into the reserved space. So, other threads might grab the memory * before we get to it. * 2. The page aligning of file offsets makes it impossible to map most * executable images since these are commonly sector aligned. * 3. When mapping a read+execute file, its not possible to create section * larger than the file since the section size is bound to the data file * size. This wouldn't have been such a problem if it was possible to * map views beyond the section restriction, i.e. have a file size and * view size. * 4. Only x86 can map views at page granularity it seems, and that only * using an undocument flag. The default granularity is 64KB. * 5. There is more crappyness here... * * So, first we'll have to check if we can the file using the crappy NT APIs. * Chances are we can't. */ for (i = 0; i < cSegments; i++) { if (paSegments[i].RVA == NIL_KLDRADDR) continue; /* The file backing of the segments must be page aligned. */ if ( paSegments[i].cbFile > 0 && paSegments[i].offFile & (cbPage - 1)) break; /* Only page alignment gaps between the file size and the mapping size. */ if ( paSegments[i].cbFile > 0 && (paSegments[i].cbFile & ~(cbPage - 1)) != (paSegments[i].cbMapped & ~(cbPage - 1)) ) break; /* The mapping addresses of the segments must be page aligned. * Non-x86 will probably require 64KB alignment here. */ if (paSegments[i].RVA & (cbPage - 1)) break; /* If we do have to allocate the segment it's RVA must be 64KB aligned. */ if ( paSegments[i].cbFile > 0 && (paSegments[i].RVA & 0xffff)) break; } /** @todo if this is a PE image, we might just try a SEC_IMAGE mapping. It'll work if the host and image machines matches. */ if (i == cSegments) { /* WOW! it may work out! Incredible! */ SIZE_T ViewSize; LARGE_INTEGER SectionOffset; LARGE_INTEGER MaxiumSize; NTSTATUS Status; PVOID pv; MaxiumSize.QuadPart = pRdr->pOps->pfnSize(pRdr); if (MaxiumSize.QuadPart > (LONGLONG)cbTotal) MaxiumSize.QuadPart = cbTotal; Status = NtCreateSection(&pPrep->hSection, SECTION_MAP_EXECUTE | SECTION_MAP_READ, /* desired access */ NULL, /* object attributes */ &MaxiumSize, PAGE_EXECUTE_WRITECOPY, /* page attributes */ SEC_COMMIT, /* section attributes */ pRdrFile->File); if (!NT_SUCCESS(Status)) return (int)Status; /* * Determin the base address. */ if (fFixed) pPrep->pv = *ppvBase; else { pv = NULL; ViewSize = (KSIZE)cbTotal; Status = NtAllocateVirtualMemory(NtCurrentProcess(), &pv, 0, /* ZeroBits */ &ViewSize, MEM_RESERVE, PAGE_READONLY); if (NT_SUCCESS(Status)) { pPrep->pv = *ppvBase = pv; ViewSize = 0; Status = NtFreeVirtualMemory(NtCurrentProcess(), &pv, &ViewSize, MEM_RELEASE); } if (!NT_SUCCESS(Status)) { NtClose(pPrep->hSection); return Status; } } /* * Map the segments. */ for (i = 0; i < cSegments; i++) { ULONG fPageProt; if (paSegments[i].RVA == NIL_KLDRADDR) continue; pv = (KU8 *)pPrep->pv + paSegments[i].RVA; if (paSegments[i].cbFile > 0) { SectionOffset.QuadPart = paSegments[i].offFile; ViewSize = paSegments[i].cbFile; fPageProt = krdrFileGetNtMapProt(paSegments[i].enmProt); /* STATUS_MAPPED_ALIGNMENT STATUS_CONFLICTING_ADDRESSES STATUS_INVALID_VIEW_SIZE */ Status = NtMapViewOfSection(pPrep->hSection, NtCurrentProcess(), &pv, 0, /* ZeroBits */ 0, /* CommitSize */ &SectionOffset, /* SectionOffset */ &ViewSize, ViewUnmap, MEM_DOS_LIM, /* AllocationType */ fPageProt); /* do we have to zero anything? */ if ( NT_SUCCESS(Status) && 0/*later*/) { /*ULONG OldPageProt = 0; NtProtectVirtualMemory(NtCurrentProcess(), &pv, &ViewSize, , */ } } else { ViewSize = paSegments[i].cbMapped; fPageProt = krdrFileGetNtAllocProt(paSegments[i].enmProt); Status = NtAllocateVirtualMemory(NtCurrentProcess(), &pv, 0, /* ZeroBits */ &ViewSize, MEM_COMMIT, fPageProt); } if (!NT_SUCCESS(Status)) break; } /* * On success, commit the mapping and return. */ if (NT_SUCCESS(Status)) { pRdrFile->cPreps++; return 0; } /* bail out and fall back on the generic code. */ while (i-- > 0) { PVOID pv; if (paSegments[i].RVA == NIL_KLDRADDR) continue; pv = (KU8 *)pPrep->pv + paSegments[i].RVA; if (paSegments[i].cbFile > 0) NtUnmapViewOfSection(NtCurrentProcess(), pv); else NtFreeVirtualMemory(NtCurrentProcess(), &pv, NULL, MEM_RELEASE); } NtClose(pPrep->hSection); } /* else: fall back to the generic code */ pPrep->hSection = NULL; #endif /* * Use the generic map emulation. */ pPrep->pv = fFixed ? *ppvBase : NULL; rc = krdrFileGenericMap(pRdr, pPrep, cSegments, paSegments, fFixed); if (!rc) { *ppvBase = pPrep->pv; pRdrFile->cPreps++; } return rc; } /** Generic implementation of krdrFileMap. */ static int krdrFileGenericMap(PKRDR pRdr, PKRDRFILEPREP pPrep, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed) { int rc; KU32 i; /* * Generic mapping code using kHlpPageAlloc(), kHlpPageFree() and kHlpPageProtect(). */ rc = kHlpPageAlloc(&pPrep->pv, pPrep->cb, KPROT_EXECUTE_READWRITE, fFixed); if (rc) return rc; /* * Load the data. */ for (i = 0; i < cSegments; i++) { void *pv; if ( paSegments[i].RVA == NIL_KLDRADDR || paSegments[i].cbFile <= 0) continue; pv = (KU8 *)pPrep->pv + paSegments[i].RVA; rc = pRdr->pOps->pfnRead(pRdr, pv, paSegments[i].cbFile, paSegments[i].offFile); if (rc) break; } /* * Set segment protection. */ if (!rc) { rc = krdrFileGenericProtect(pRdr, pPrep, cSegments, paSegments, 0 /* protect */); if (!rc) return 0; krdrFileGenericProtect(pRdr, pPrep, cSegments, paSegments, 1 /* unprotect */); } /* bailout */ kHlpPageFree(pPrep->pv, pPrep->cb); return rc; } /** @copydoc KRDROPS::pfnPageSize */ static KSIZE krdrFilePageSize(PKRDR pRdr) { #if K_OS == K_OS_DARWIN return 0x1000; /** @todo find some header somewhere... */ #elif K_OS == K_OS_LINUX return 0x1000; /** @todo find some header somewhere... */ #elif K_OS == K_OS_OS2 /* The page size on OS/2 wont change anytime soon. :-) */ return 0x1000; #elif K_OS == K_OS_WINDOWS SYSTEM_INFO SysInfo; GetSystemInfo(&SysInfo); return SysInfo.dwPageSize; /*return SysInfo.dwAllocationGranularity;*/ #else # error "port me" #endif } /** @copydoc KRDROPS::pfnName */ static const char *krdrFileName(PKRDR pRdr) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; return &pRdrFile->szFilename[0]; } static KIPTR krdrFileNativeFH(PKRDR pRdr) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_OS2 \ || K_OS == K_OS_SOLARIS \ || K_OS == K_OS_WINDOWS return (KIPTR)pRdrFile->File; #else # error "port me" #endif } /** @copydoc KRDROPS::pfnTell */ static KFOFF krdrFileTell(PKRDR pRdr) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; /* * If the offset is undefined, try figure out what it is. */ if (pRdrFile->off == -1) { #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS pRdrFile->off = kHlpSys_lseek(pRdrFile->File, SEEK_CUR, 0); if (pRdrFile->off < 0) pRdrFile->off = -1; #elif K_OS == K_OS_OS2 ULONG ulNew; APIRET rc = DosSetFilePtr(pRdrFile->File, 0, FILE_CURRENT, &ulNew); if (rc) return -1; pRdrFile->off = ulNew; #elif K_OS == K_OS_WINDOWS LONG offHigh = 0; LONG offLow; int rc; SetLastError(0); offLow = SetFilePointer(pRdrFile->File, 0, &offHigh, FILE_CURRENT); rc = GetLastError(); if (rc) return -1; pRdrFile->off = ((KFOFF)offHigh << 32) | offLow; #else # error "port me." #endif } return pRdrFile->off; } /** @copydoc KRDROPS::pfnSize */ static KFOFF krdrFileSize(PKRDR pRdr) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; return pRdrFile->cb; } /** @copydoc KRDROPS::pfnAllUnmap */ static int krdrFileAllUnmap(PKRDR pRdr, const void *pvBits) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; /* check for underflow */ if (pRdrFile->cMappings <= 0) return KERR_INVALID_PARAMETER; /* decrement usage counter, free mapping if no longer in use. */ if (!--pRdrFile->cMappings) { kHlpFree(pRdrFile->pvMapping); pRdrFile->pvMapping = NULL; } return 0; } /** @copydoc KRDROPS::pfnAllMap */ static int krdrFileAllMap(PKRDR pRdr, const void **ppvBits) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; /* * Do we need to map it? */ if (!pRdrFile->pvMapping) { int rc; KFOFF cbFile = pRdrFile->Core.pOps->pfnSize(pRdr); KSIZE cb = (KSIZE)cbFile; if (cb != cbFile) return KERR_NO_MEMORY; pRdrFile->pvMapping = kHlpAlloc(cb); if (!pRdrFile->pvMapping) return KERR_NO_MEMORY; rc = pRdrFile->Core.pOps->pfnRead(pRdr, pRdrFile->pvMapping, cb, 0); if (rc) { kHlpFree(pRdrFile->pvMapping); pRdrFile->pvMapping = NULL; return rc; } pRdrFile->cMappings = 0; } *ppvBits = pRdrFile->pvMapping; pRdrFile->cMappings++; return 0; } /** @copydoc KRDROPS::pfnRead */ static int krdrFileRead(PKRDR pRdr, void *pvBuf, KSIZE cb, KFOFF off) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; /* * Do a seek if needed. */ if (pRdrFile->off != off) { #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS pRdrFile->off = kHlpSys_lseek(pRdrFile->File, SEEK_SET, off); if (pRdrFile->off < 0) { int rc = (int)-pRdrFile->off; pRdrFile->off = -1; return -rc; } #elif K_OS == K_OS_OS2 ULONG ulNew; APIRET rc; rc = DosSetFilePtr(pRdrFile->File, off, FILE_BEGIN, &ulNew); if (rc) { pRdrFile->off = -1; return rc; } #elif K_OS == K_OS_WINDOWS LONG offHigh; LONG offLow; offHigh = (LONG)(off >> 32); offLow = SetFilePointer(pRdrFile->File, (LONG)off, &offHigh, FILE_BEGIN); if ( offLow != (LONG)off || offHigh != (LONG)(off >> 32)) { int rc = GetLastError(); if (!rc) rc = KERR_GENERAL_FAILURE; pRdrFile->off = -1; return rc; } #else # error "port me." #endif } /* * Do the read. */ #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS { KSSIZE cbRead; cbRead = kHlpSys_read(pRdrFile->File, pvBuf, cb); if (cbRead != cb) { pRdrFile->off = -1; if (cbRead < 0) return -cbRead; return KERR_GENERAL_FAILURE; } } #elif K_OS == K_OS_OS2 { ULONG cbRead = 0; APIRET rc = DosRead(pRdrFile->File, pvBuf, cb, &cbRead); if (rc) { pRdrFile->off = -1; return rc; } if (cbRead != cb) { pRdrFile->off = -1; return KERR_GENERAL_FAILURE; } } #elif K_OS == K_OS_WINDOWS { DWORD cbRead = 0; if (!ReadFile(pRdrFile->File, pvBuf, cb, &cbRead, NULL)) { int rc = GetLastError(); if (!rc) rc = KERR_GENERAL_FAILURE; pRdrFile->off = -1; return rc; } if (cbRead != cb) { pRdrFile->off = -1; return KERR_GENERAL_FAILURE; } } #else # error "port me." #endif pRdrFile->off = off + cb; return 0; } /** @copydoc KRDROPS::pfnDestroy */ static int krdrFileDestroy(PKRDR pRdr) { PKRDRFILE pRdrFile = (PKRDRFILE)pRdr; int rc; #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS rc = kHlpSys_close(pRdrFile->File); #elif K_OS == K_OS_OS2 rc = DosClose(pRdrFile->File); #elif K_OS == K_OS_WINDOWS rc = 0; if (!CloseHandle(pRdrFile->File)) rc = GetLastError(); #else # error "port me" #endif if (pRdrFile->pvMapping) { kHlpFree(pRdrFile->pvMapping); pRdrFile->pvMapping = NULL; } kHlpFree(pRdr); return rc; } /** @copydoc KRDROPS::pfnCreate */ static int krdrFileCreate(PPKRDR ppRdr, const char *pszFilename) { KSIZE cchFilename; PKRDRFILE pRdrFile; /* * Open the file, determin its size and correct filename. */ #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS int File; KFOFF cb; KFOFF rc; char szFilename[1024]; cchFilename = kHlpStrLen(pszFilename); if (cchFilename >= sizeof(szFilename)) return KERR_OUT_OF_RANGE; kHlpMemCopy(szFilename, pszFilename, cchFilename + 1); /** @todo normalize the filename. */ # ifdef O_BINARY File = kHlpSys_open(pszFilename, O_RDONLY | O_BINARY, 0); # else File = kHlpSys_open(pszFilename, O_RDONLY, 0); # endif if (File < 0) return -File; cb = kHlpSys_lseek(File, SEEK_END, 0); rc = kHlpSys_lseek(File, SEEK_SET, 0); if ( cb < 0 || rc < 0) { kHlpSys_close(File); return cb < 0 ? -cb : -rc; } #elif K_OS == K_OS_OS2 ULONG ulAction = 0; FILESTATUS3 Info; APIRET rc; HFILE File = 0; KFOFF cb; char szFilename[CCHMAXPATH]; if ((uintptr_t)pszFilename >= 0x20000000) { char *psz; cchFilename = kHlpStrLen(szFilename); psz = (char *)kHlpAllocA(cchFilename + 1); kHlpMemCopy(psz, pszFilename, cchFilename + 1); pszFilename = psz; } rc = DosOpen((PCSZ)pszFilename, &File, &ulAction, 0, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYWRITE | OPEN_ACCESS_READONLY | OPEN_FLAGS_RANDOMSEQUENTIAL, NULL); if (rc) return rc; rc = DosQueryPathInfo((PCSZ)pszFilename, FIL_QUERYFULLNAME, szFilename, sizeof(szFilename)); if (rc) { DosClose(File); return rc; } rc = DosQueryFileInfo(File, FIL_STANDARD, &Info, sizeof(Info)); if (rc) { DosClose(File); return rc; } cb = Info.cbFile; #elif K_OS == K_OS_WINDOWS SECURITY_ATTRIBUTES SecAttr; DWORD High; DWORD Low; int rc; HANDLE File; KFOFF cb; char szFilename[MAX_PATH]; SecAttr.bInheritHandle = FALSE; SecAttr.lpSecurityDescriptor = NULL; SecAttr.nLength = 0; File = CreateFile(pszFilename, GENERIC_READ | GENERIC_EXECUTE, FILE_SHARE_READ, &SecAttr, OPEN_EXISTING, 0, NULL); if (File == INVALID_HANDLE_VALUE) return GetLastError(); if (!GetFullPathName(pszFilename, sizeof(szFilename), szFilename, NULL)) { rc = GetLastError(); CloseHandle(File); return rc; } SetLastError(0); Low = GetFileSize(File, &High); rc = GetLastError(); if (rc) { CloseHandle(File); return rc; } cb = ((KFOFF)High << 32) | Low; #else # error "port me" #endif /* * Allocate the reader instance. */ cchFilename = kHlpStrLen(szFilename); pRdrFile = (PKRDRFILE)kHlpAlloc(sizeof(*pRdrFile) + cchFilename); if (!pRdrFile) { #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS kHlpSys_close(File); #elif K_OS == K_OS_OS2 DosClose(File); #elif K_OS == K_OS_WINDOWS CloseHandle(File); #else # error "port me" #endif return KERR_NO_MEMORY; } /* * Initialize it and return successfully. */ pRdrFile->Core.u32Magic = KRDR_MAGIC; pRdrFile->Core.pOps = &g_kRdrFileOps; pRdrFile->File = File; pRdrFile->cb = cb; pRdrFile->off = 0; pRdrFile->cPreps = 0; pRdrFile->cMappings = 0; pRdrFile->pvMapping = NULL; kHlpMemCopy(&pRdrFile->szFilename[0], szFilename, cchFilename + 1); *ppRdr = &pRdrFile->Core; return 0; } ��������������������������kbuild-3608/src/lib/kStuff/kRdr/kRdrBuffered.cpp����������������������������������������������������0000664�0001750�0001750�00000055465�14670377514�021515� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRdrBuffered.cpp 79 2016-07-27 14:25:09Z bird $ */ /** @file * kRdrBuffered - Buffered File Provider. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "kRdrInternal.h" #include <k/kHlpAlloc.h> #include <k/kHlpString.h> /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * The buffered file provier instance. * This is just a wrapper around another file provider. */ typedef struct KRDRBUF { /** The file reader vtable. */ KRDR Core; /** The actual file provider that we're wrapping. */ PKRDR pRdr; /** The current file offset. */ KFOFF offFile; /** The file size. */ KFOFF cbFile; /** The offset of the buffer. */ KFOFF offBuf; /** The offset of the end of the buffer. */ KFOFF offBufEnd; /** The number of valid buffer bytes. */ KSIZE cbBufValid; /** The size of the buffer. */ KSIZE cbBuf; /** The buffer. */ KU8 *pbBuf; /** Whether the pRdr instance should be closed together with us or not. */ KBOOL fCloseIt; /** Set if the buffer has been messed up by kRdrBufLineQ. */ KBOOL fTainedByLineQ; } KRDRBUF, *PKRDRBUF; /******************************************************************************* * Internal Functions * *******************************************************************************/ static void krdrBufDone(PKRDR pRdr); static int krdrBufUnmap(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments); static int krdrBufProtect(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect); static int krdrBufRefresh(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments); static int krdrBufMap(PKRDR pRdr, void **ppvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed); static KSIZE krdrBufPageSize(PKRDR pRdr); static const char *krdrBufName(PKRDR pRdr); static KIPTR krdrBufNativeFH(PKRDR pRdr); static KFOFF krdrBufTell(PKRDR pRdr); static KFOFF krdrBufSize(PKRDR pRdr); static int krdrBufAllUnmap(PKRDR pRdr, const void *pvBits); static int krdrBufAllMap(PKRDR pRdr, const void **ppvBits); static int krdrBufRead(PKRDR pRdr, void *pvBuf, KSIZE cb, KFOFF off); static int krdrBufDestroy(PKRDR pRdr); static int krdrBufCreate(PPKRDR ppRdr, const char *pszFilename); /******************************************************************************* * Global Variables * *******************************************************************************/ /** Native file provider operations. * * @remark This is not in the file provider list as its intended for wrapping * other kRdr instances. */ static const KRDROPS g_krdrBufOps = { "Buffered kRdr", NULL, krdrBufCreate, krdrBufDestroy, krdrBufRead, krdrBufAllMap, krdrBufAllUnmap, krdrBufSize, krdrBufTell, krdrBufName, krdrBufNativeFH, krdrBufPageSize, krdrBufMap, krdrBufRefresh, krdrBufProtect, krdrBufUnmap, krdrBufDone, 42 }; /** @copydoc KRDROPS::pfnDone */ static void krdrBufDone(PKRDR pRdr) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->pRdr->pOps->pfnDone(pThis->pRdr); } /** @copydoc KRDROPS::pfnUnmap */ static int krdrBufUnmap(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->pRdr->pOps->pfnUnmap(pThis->pRdr, pvBase, cSegments, paSegments); } /** @copydoc KRDROPS::pfnProtect */ static int krdrBufProtect(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->pRdr->pOps->pfnProtect(pThis->pRdr, pvBase, cSegments, paSegments, fUnprotectOrProtect); } /** @copydoc KRDROPS::pfnRefresh */ static int krdrBufRefresh(PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->pRdr->pOps->pfnRefresh(pThis->pRdr, pvBase, cSegments, paSegments); } /** @copydoc KRDROPS::pfnMap */ static int krdrBufMap(PKRDR pRdr, void **ppvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->pRdr->pOps->pfnMap(pThis->pRdr, ppvBase, cSegments, paSegments, fFixed); } /** @copydoc KRDROPS::pfnPageSize */ static KSIZE krdrBufPageSize(PKRDR pRdr) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->pRdr->pOps->pfnPageSize(pThis->pRdr); } /** @copydoc KRDROPS::pfnName */ static const char *krdrBufName(PKRDR pRdr) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->pRdr->pOps->pfnName(pThis->pRdr); } /** @copydoc KRDROPS::pfnNativeFH */ static KIPTR krdrBufNativeFH(PKRDR pRdr) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->pRdr->pOps->pfnNativeFH(pThis->pRdr); } /** @copydoc KRDROPS::pfnTell */ static KFOFF krdrBufTell(PKRDR pRdr) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->offFile; } /** @copydoc KRDROPS::pfnSize */ static KFOFF krdrBufSize(PKRDR pRdr) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->cbFile; } /** @copydoc KRDROPS::pfnAllUnmap */ static int krdrBufAllUnmap(PKRDR pRdr, const void *pvBits) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->pRdr->pOps->pfnAllUnmap(pThis->pRdr, pvBits); } /** @copydoc KRDROPS::pfnAllMap */ static int krdrBufAllMap(PKRDR pRdr, const void **ppvBits) { PKRDRBUF pThis = (PKRDRBUF)pRdr; return pThis->pRdr->pOps->pfnAllMap(pThis->pRdr, ppvBits); } /** * Fills the buffer with file bits starting at the specified offset. * * @returns 0 on success, pfnRead error code on failure. * @param pThis The instance. * @param off Where to start reading. */ static int krdrBufFillBuffer(PKRDRBUF pThis, KFOFF off) { kRdrAssert(off < pThis->cbFile); /* Reposition the buffer if it's past the end of the file so that we maximize its usability. We leave one unused byte at the end of the buffer so kRdrBufLineQ can terminate its string properly. Of course, this might end up re-reading a lot of stuff for no future gain, but whatever... */ kRdrAssert(pThis->cbBuf <= pThis->cbFile + 1); KFOFF cbLeft = pThis->cbFile - off; KSIZE cbRead = pThis->cbBuf; if ((KSSIZE)cbRead - 1 >= cbLeft) { cbRead--; off = pThis->cbFile - cbRead; } int rc = pThis->pRdr->pOps->pfnRead(pThis->pRdr, pThis->pbBuf, cbRead, off); if (!rc) { pThis->offBuf = off; pThis->offBufEnd = off + cbRead; pThis->cbBufValid = cbRead; } else { pThis->offBuf = pThis->offBufEnd = 0; pThis->cbBufValid = 0; } pThis->fTainedByLineQ = K_FALSE; return rc; } /** @copydoc KRDROPS::pfnRead */ static int krdrBufRead(PKRDR pRdr, void *pvBuf, KSIZE cb, KFOFF off) { PKRDRBUF pThis = (PKRDRBUF)pRdr; /* * We need to validate and update the file offset before * we start making partial reads from the buffer and stuff. */ KFOFF offEnd = off + cb; if ( off >= pThis->cbFile || offEnd > pThis->cbFile || offEnd < off) return KERR_OUT_OF_RANGE; /* includes EOF. */ pThis->offFile = offEnd; if (!cb) return 0; /* * Scratch the buffer if kRdrBufLineQ has tained it. */ if (pThis->fTainedByLineQ) { pThis->offBuf = pThis->offBufEnd = 0; pThis->cbBufValid = 0; } /* * Is any part of the request in the buffer? * * We will currently ignore buffer hits in the middle of the * request because it's annoying to implement and it's * questionable whether it'll benefit much performance wise. */ if (pThis->cbBufValid > 0) { if (off >= pThis->offBuf) { if (off < pThis->offBufEnd) { /* head (or all) of the request is in the buffer. */ KSIZE cbMaxChunk = (KSIZE)(pThis->offBufEnd - off); KSIZE cbChunk = K_MIN(cb, cbMaxChunk); kHlpMemCopy(pvBuf, &pThis->pbBuf[off - pThis->offBuf], cbChunk); if (cbChunk == cb) return 0; cb -= cbChunk; pvBuf = (KU8 *)pvBuf + cbChunk; off += cbChunk; } } else if ( offEnd > pThis->offBuf && offEnd <= pThis->offBufEnd) { /* the end of the request is in the buffer. */ KSIZE cbChunk = (KSIZE)(pThis->offBufEnd - (offEnd)); kHlpMemCopy((KU8 *)pvBuf + (pThis->offBuf - off), pThis->pbBuf, cbChunk); kRdrAssert(cbChunk < cb); cb -= cbChunk; offEnd -= cbChunk; } } /* * If the buffer is larger than the read request, read a full buffer * starting at the requested offset. Otherwise perform an unbuffered * read. */ if (pThis->cbBuf > cb) { int rc = krdrBufFillBuffer(pThis, off); if (rc) return rc; if (pThis->offBuf == off) kHlpMemCopy(pvBuf, pThis->pbBuf, cb); else { kRdrAssert(off > pThis->offBuf); kRdrAssert(off + cb <= pThis->offBufEnd); kHlpMemCopy(pvBuf, pThis->pbBuf + (off - pThis->offBuf), cb); } } else { int rc = pThis->pRdr->pOps->pfnRead(pThis->pRdr, pvBuf, cb, off); if (rc) return rc; } return 0; } /** @copydoc KRDROPS::pfnDestroy */ static int krdrBufDestroy(PKRDR pRdr) { PKRDRBUF pThis = (PKRDRBUF)pRdr; /* Close the kRdr instance that we're wrapping. */ if (pThis->fCloseIt) { int rc = pThis->pRdr->pOps->pfnDestroy(pThis->pRdr); if (rc) return rc; pThis->fCloseIt = K_FALSE; pThis->pRdr = NULL; } kHlpFree(pThis->pbBuf); pThis->pbBuf = NULL; kHlpFree(pRdr); return 0; } /** @copydoc KRDROPS::pfnCreate */ static int krdrBufCreate(PPKRDR ppRdr, const char *pszFilename) { K_NOREF(ppRdr); K_NOREF(pszFilename); return KERR_NOT_IMPLEMENTED; } /** * Worker for kRdrBufOpen and kRdrBufWrap. * * It's essentially kRdrBufWrap without error checking. * * @returns 0 on success, one of the kErrors status code on failure. * @param ppRdr Where to store the new file provider instance. * @param pRdrWrapped The file provider instance to buffer. * @param fCloseIt Whether it the pRdrWrapped instance should be closed * when the new instance is closed. */ static int krdrBufWrapIt(PPKRDR ppRdr, PKRDR pRdrWrapped, KBOOL fCloseIt) { PKRDRBUF pThis = (PKRDRBUF)kHlpAlloc(sizeof(*pThis)); if (pThis) { pThis->Core.u32Magic = KRDR_MAGIC; pThis->Core.pOps = &g_krdrBufOps; pThis->pRdr = pRdrWrapped; pThis->offFile = pRdrWrapped->pOps->pfnTell(pRdrWrapped); pThis->cbFile = pRdrWrapped->pOps->pfnSize(pRdrWrapped); pThis->offBuf = pThis->offBufEnd = 0; pThis->cbBufValid = 0; pThis->fCloseIt = fCloseIt; pThis->fTainedByLineQ = K_FALSE; if (pThis->cbFile < 128*1024) pThis->cbBuf = (KSIZE)pThis->cbFile + 1; /* need space for the kRdrBufLineQ terminator. */ else pThis->cbBuf = 64*1024; pThis->pbBuf = (KU8 *)kHlpAlloc(pThis->cbBuf); if (pThis->pbBuf) { *ppRdr = &pThis->Core; return 0; } pThis->Core.u32Magic = 0; kHlpFree(pThis); } return KERR_NO_MEMORY; } /** * Opens a file provider with a buffered wrapper. * * @returns 0 on success, KERR_* on failure. * @param ppRdr Where to store the buffered file reader instance on success. * @param pszFilename The name of the file that should be opened. */ KRDR_DECL(int) kRdrBufOpen(PPKRDR ppRdr, const char *pszFilename) { kRdrAssertPtrReturn(ppRdr, KERR_INVALID_POINTER); *ppRdr = NULL; PKRDR pRdrWrapped; int rc = kRdrOpen(&pRdrWrapped, pszFilename); if (!rc) { rc = krdrBufWrapIt(ppRdr, pRdrWrapped, K_TRUE); if (rc) kRdrClose(pRdrWrapped); } return rc; } /** * Creates a buffered file provider instance for an existing one. * * @returns 0 on success, KERR_* on failure. * @param ppRdr Where to store the new file provider pointer. * @param pRdr The file provider instance to wrap. * @param fCLoseIt Whether it the wrapped reader should be automatically * closed when the wrapper closes. */ KRDR_DECL(int) kRdrBufWrap(PPKRDR ppRdr, PKRDR pRdr, KBOOL fCloseIt) { KRDR_VALIDATE(pRdr); return krdrBufWrapIt(ppRdr, pRdr, fCloseIt); } /** * Checks whether the file provider instance is of the buffered type or not. * * @returns K_TRUE if it is, otherwise K_FALSE. * @param pRdr The file provider instance to check. */ KRDR_DECL(KBOOL) kRdrBufIsBuffered(PKRDR pRdr) { KRDR_VALIDATE_EX(pRdr, K_FALSE); return pRdr->pOps == &g_krdrBufOps; } /** * Reads a line from a buffered file provider. * * The trailing '\n' or '\r\n' is stripped. * * @returns 0 on success. KERR_* on failure. * @retval KRDR_ERR_LINE_TOO_LONG if the line is too long to fit in the passed in buffer. * @retval KRDR_ERR_NOT_BUFFERED_RDR if pRdr isn't a buffered reader. * @param pRdr The buffered file reader. * @param pszLine Where to store the line. * @param cbLine The size of the the line buffer. */ KRDR_DECL(int) kRdrBufLine(PKRDR pRdr, char *pszLine, KSIZE cbLine) { return kRdrBufLineEx(pRdr, pszLine, &cbLine); } /** * Reads a line from a buffered file provider. * * The trailing '\n' or '\r\n' is stripped. * * @returns 0 on success. KERR_* on failure. * @retval KRDR_ERR_LINE_TOO_LONG if the line is too long to fit in the passed in buffer. * @retval KRDR_ERR_NOT_BUFFERED_RDR if pRdr isn't a buffered reader. * @param pRdr The buffered file reader. * @param pszLine Where to store the line. * @param pcbLine The size of the the line buffer on input, the length of the * returned line on output. */ KRDR_DECL(int) kRdrBufLineEx(PKRDR pRdr, char *pszLine, KSIZE *pcbLine) { /* * Validate input. */ kRdrAssertPtrReturn(pcbLine, KERR_INVALID_POINTER); KSIZE cbLeft = *pcbLine; *pcbLine = 0; kRdrAssertReturn(cbLeft > 0, KERR_INVALID_PARAMETER); KRDR_VALIDATE(pRdr); kRdrAssertReturn(pRdr->pOps != &g_krdrBufOps, KRDR_ERR_NOT_BUFFERED_RDR); kRdrAssertPtrReturn(pszLine, KERR_INVALID_POINTER); /* check for EOF */ PKRDRBUF pThis = (PKRDRBUF)pRdr; if (pThis->offFile >= pThis->cbFile) { kRdrAssert(pThis->offFile == pThis->cbFile); *pszLine = '\0'; *pcbLine = 0; return KERR_EOF; } /* * Scratch the buffer if kRdrBufLineQ has tained it. */ if (pThis->fTainedByLineQ) { pThis->offBuf = pThis->offBufEnd = 0; pThis->cbBufValid = 0; } /* * Buffered read loop. * * The overflow logic is a bit fishy wrt to overflowing at an "\r\n" * that arrives at a buffer boundrary. The current policy is to try * our best to not to fail with overflow in the EOL sequence or EOF. * If it's the end of the buffer, it will not be refilled just to * check for this because that's too much work. */ cbLeft--; /* reserve space for the terminator. */ char *pszOut = pszLine; for (;;) { /* * Do we need to (re-)fill the buffer or does it contain something * that we can work on already? */ if ( !pThis->cbBufValid || pThis->offFile >= pThis->offBufEnd || pThis->offFile < pThis->offBuf) { int rc = krdrBufFillBuffer(pThis, pThis->offFile); if (rc) { *pszOut = '\0'; return rc; } } /* * Parse the buffer looking for the EOL indicator. */ kRdrAssert(pThis->offFile >= pThis->offBuf && pThis->offFile < pThis->offBufEnd); kRdrAssert(sizeof(char) == sizeof(*pThis->pbBuf)); const char * const pszStart = (const char *)&pThis->pbBuf[pThis->offFile - pThis->offBuf]; const char * const pszEnd = (const char *)&pThis->pbBuf[pThis->cbBufValid]; const char *psz = pszStart; while (psz < pszEnd) { const char ch = *psz; if (ch == '\n') { /* found the EOL, update file position and line length. */ pThis->offFile += psz - pszStart + 1; *pcbLine += psz - pszStart; /* terminate the string, checking for "\r\n" first. */ if ( *pcbLine && pszOut[-1] == '\r') { *pcbLine -= 1; pszOut--; } *pszOut = '\0'; return 0; } if (!cbLeft) { /* the line is *probably* too long. */ pThis->offFile += psz - pszStart; *pcbLine += psz - pszStart; *pszOut = '\0'; /* The only possible case where the line actually isn't too long is if we're at a "\r\n" sequence. We will re-fill the buffer if necessary to check for the '\n' as it's not that much work. */ if ( ch == '\r' && pThis->offFile + 2 <= pThis->cbFile) { if (psz + 1 >= pszEnd) { int rc = krdrBufFillBuffer(pThis, pThis->offFile); if (rc) { *pszOut = '\0'; return rc; } } psz = (const char *)&pThis->pbBuf[pThis->offFile - pThis->offBuf]; kRdrAssert(*psz == '\r'); if (psz[1] == '\n') { *pcbLine -= 1; pszOut[-1] = '\0'; pThis->offFile += 2; return 0; } } return KRDR_ERR_LINE_TOO_LONG; } /* copy and advance */ *pszOut++ = ch; cbLeft--; psz++; } /* advance past the buffer and check for EOF. */ *pcbLine += pszEnd - pszStart; pThis->offFile = pThis->offBufEnd; if (pThis->offFile >= pThis->cbFile) { kRdrAssert(pThis->offFile == pThis->cbFile); *pszOut = '\0'; return 0; } } } /** * Worker for kRdrBufLineQ that searches the current buffer for EOL or EOF. * * When a EOF marker is found * * * @returns NULL if EOL/EOF isn't found the buffer. * @param pThis The buffered reader instance. */ static const char * krdrBufLineQWorker(PKRDRBUF pThis) { kRdrAssert(pThis->offFile >= pThis->offBuf && pThis->offFile < pThis->offBufEnd); /* * Search the buffer. */ kRdrAssert(sizeof(char) == sizeof(*pThis->pbBuf)); const char * const pszStart = (const char *)&pThis->pbBuf[pThis->offFile - pThis->offBuf]; const char * const pszEnd = (const char *)&pThis->pbBuf[pThis->cbBufValid]; char *psz = (char *)pszStart; while (psz < pszEnd) { char ch = *psz; if (ch == '\n') { pThis->offFile += psz - pszStart; pThis->fTainedByLineQ = K_TRUE; *psz = '\0'; if ( psz > pszStart && psz[-1] == '\r') *--psz = '\0'; return pszStart; } psz++; } /* * Check for EOF. There must be room for a terminator char here. */ if ( pThis->offBufEnd >= pThis->cbFile && (pThis->offBufEnd - pThis->offBuf) < (KSSIZE)pThis->cbBuf) { pThis->offFile = pThis->cbFile; pThis->pbBuf[pThis->cbBufValid] = '\0'; return pszStart; } return NULL; } /** * Get the pointer to the next next line in the buffer. * The returned line is zero terminated. * * @returns A pointer to the line on success. This becomes invalid * upon the next call to this kRdr instance. * @returns NULL on EOF, read error of if the line was too long. * @param pRdr The buffered file reader. */ KRDR_DECL(const char *) kRdrBufLineQ(PKRDR pRdr) { /* * Validate input. */ KRDR_VALIDATE_EX(pRdr, NULL); kRdrAssertReturn(pRdr->pOps != &g_krdrBufOps, NULL); /* check for EOF */ PKRDRBUF pThis = (PKRDRBUF)pRdr; if (pThis->offFile >= pThis->cbFile) { kRdrAssert(pThis->offFile == pThis->cbFile); return NULL; } /* * Search the current buffer if possible */ if ( pThis->cbBufValid && pThis->offFile >= pThis->offBuf && pThis->offFile < pThis->offBufEnd) { const char *psz = krdrBufLineQWorker(pThis); if (psz) return psz; } /* * Fill the buffer in an optimal way and look for the EOL/EOF (again). */ int rc = krdrBufFillBuffer(pThis, pThis->offFile); if (rc) return NULL; return krdrBufLineQWorker(pThis); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kRdr/kRdrInternal.h������������������������������������������������������0000664�0001750�0001750�00000010375�14670377514�021203� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRdrInternal.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kRdr - Internal Header. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kRdrInternal_h___ #define ___kRdrInternal_h___ #include <k/kHlpAssert.h> #include <k/kMagics.h> #include <k/kRdrAll.h> #include <k/kErrors.h> #ifdef __cplusplus extern "C" { #endif /** @defgroup grp_kRdrInternal - Internals * @internal * @addtogroup grp_kRdr * @{ */ /** @def KRDR_STRICT * If defined the kRdr assertions and other runtime checks will be enabled. */ #ifdef K_ALL_STRICT # undef KRDR_STRICT # define KRDR_STRICT #endif /** @name Our Assert macros * @{ */ #ifdef KRDR_STRICT # define kRdrAssert(expr) kHlpAssert(expr) # define kRdrAssertReturn(expr, rcRet) kHlpAssertReturn(expr, rcRet) # define kRdrAssertMsg(expr, msg) kHlpAssertMsg(expr, msg) # define kRdrAssertMsgReturn(expr, msg, rcRet) kHlpAssertMsgReturn(expr, msg, rcRet) #else /* !KRDR_STRICT */ # define kRdrAssert(expr) do { } while (0) # define kRdrAssertReturn(expr, rcRet) do { if (!(expr)) return (rcRet); } while (0) # define kRdrAssertMsg(expr, msg) do { } while (0) # define kRdrAssertMsgReturn(expr, msg, rcRet) do { if (!(expr)) return (rcRet); } while (0) #endif /* !KRDR_STRICT */ #define kRdrAssertPtr(ptr) kRdrAssertMsg(K_VALID_PTR(ptr), ("%s = %p\n", #ptr, (ptr))) #define kRdrAssertPtrReturn(ptr, rcRet) kRdrAssertMsgReturn(K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet)), (rcRet)) #define kRdrAssertPtrNull(ptr) kRdrAssertMsg(!(ptr) || K_VALID_PTR(ptr), ("%s = %p\n", #ptr, (ptr))) #define kRdrAssertPtrNullReturn(ptr, rcRet) kRdrAssertMsgReturn(!(ptr) || K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet)), (rcRet)) #define kRdrAssertRC(rc) kRdrAssertMsg((rc) == 0, ("%s = %d\n", #rc, (rc))) #define kRdrAssertRCReturn(rc, rcRet) kRdrAssertMsgReturn((rc) == 0, ("%s = %d -> %d\n", #rc, (rc), (rcRet)), (rcRet)) #define kRdrAssertFailed() kRdrAssert(0) #define kRdrAssertFailedReturn(rcRet) kRdrAssertReturn(0, (rcRet)) #define kRdrAssertMsgFailed(msg) kRdrAssertMsg(0, msg) #define kRdrAssertMsgFailedReturn(msg, rcRet) kRdrAssertMsgReturn(0, msg, (rcRet)) /** @} */ /** Return / crash validation of a reader argument. */ #define KRDR_VALIDATE_EX(pRdr, rc) \ do { \ if ( (pRdr)->u32Magic != KRDR_MAGIC \ || (pRdr)->pOps == NULL \ )\ { \ return (rc); \ } \ } while (0) /** Return / crash validation of a reader argument. */ #define KRDR_VALIDATE(pRdr) \ KRDR_VALIDATE_EX(pRdr, KERR_INVALID_PARAMETER) /** Return / crash validation of a reader argument. */ #define KRDR_VALIDATE_VOID(pRdr) \ do { \ if ( !K_VALID_PTR(pRdr) \ || (pRdr)->u32Magic != KRDR_MAGIC \ || (pRdr)->pOps == NULL \ )\ { \ return; \ } \ } while (0) /** @name Built-in Providers * @{ */ extern const KRDROPS g_kRdrFileOps; /** @} */ /** @} */ #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/Config.kmk���������������������������������������������������������������0000664�0001750�0001750�00000011570�14670377514�017440� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Config.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kBuild configuration for kStuff # # # Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # # This is where we install during the build. # PATH_INS := $(PATH_OUT)/kStuff # # Templates for the kStuff. # TEMPLATE_kStuff = kStuff Template TEMPLATE_kStuff_TOOL = GXX3 TEMPLATE_kStuff_TOOL.darwin = GXX4MACHO TEMPLATE_kStuff_TOOL.os2 = GXX3OMF TEMPLATE_kStuff_TOOL.solaris = GXX3PLAIN TEMPLATE_kStuff_TOOL.win.x86 = VCC70 TEMPLATE_kStuff_TOOL.win.amd64 = VCC80AMD64 TEMPLATE_kStuff_SDKS.win.x86 = WINPSDK W2K3DDKX86 TEMPLATE_kStuff_SDKS.win.amd64 = WINPSDK W2K3DDKAMD64 TEMPLATE_kStuff_DEFS.freebsd = KS_OS_FREEBSD TEMPLATE_kStuff_DEFS.darwin = KS_OS_DARWIN TEMPLATE_kStuff_DEFS.linux = KS_OS_LINUX TEMPLATE_kStuff_DEFS.netbsd = KS_OS_NETBSD TEMPLATE_kStuff_DEFS.openbsd = KS_OS_OPENBSD TEMPLATE_kStuff_DEFS.os2 = KS_OS_OS2 TEMPLATE_kStuff_DEFS.solaris = KS_OS_SOLARIS TEMPLATE_kStuff_DEFS.win = KS_OS_WINDOWS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS TEMPLATE_kStuff_DEFS.x86 = KS_BITS=32 TEMPLATE_kStuff_DEFS.amd64 = KS_BITS=64 TEMPLATE_kStuff_INCS = $(PATH_ROOT)/include TEMPLATE_kStuff_ASTOOL = YASM TEMPLATE_kStuff_ASTOOL.os2 = NASM TEMPLATE_kStuff_ASFLAGS.freebsd = -f elf TEMPLATE_kStuff_ASFLAGS.linux = -f elf TEMPLATE_kStuff_ASFLAGS.os2 = -f omf TEMPLATE_kStuff_ASFLAGS.win.x86 = -f win32 -g cv8 TEMPLATE_kStuff_ASFLAGS.win.amd64= -f win64 -g cv8 TEMPLATE_kStuff_CFLAGS.darwin = -g -fno-common TEMPLATE_kStuff_CFLAGS.freebsd = -g TEMPLATE_kStuff_CFLAGS.linux = -g TEMPLATE_kStuff_CFLAGS.os2 = -g TEMPLATE_kStuff_CFLAGS.win = -Zi -Zl -W3 -GF -GR- TEMPLATE_kStuff_CFLAGS.win.x86 = -MD TEMPLATE_kStuff_CFLAGS.win.amd64 = -MT ifneq ($(BUILD_TYPE),debug) TEMPLATE_kStuff_CFLAGS.freebsd += -O3 TEMPLATE_kStuff_CFLAGS.linux += -O3 TEMPLATE_kStuff_CFLAGS.os2 += -O3 TEMPLATE_kStuff_CFLAGS.win += -O2b2 else TEMPLATE_kStuff_CFLAGS.win += -Od endif TEMPLATE_kStuff_CXXFLAGS.darwin = -g -fno-exceptions -fno-common TEMPLATE_kStuff_CXXFLAGS.freebsd = -g -fno-exceptions TEMPLATE_kStuff_CXXFLAGS.linux = -g -fno-exceptions TEMPLATE_kStuff_CXXFLAGS.os2 = -g -fno-exceptions TEMPLATE_kStuff_CXXFLAGS.win = -Zi -Zl -W3 -GF -GR- TEMPLATE_kStuff_CXXFLAGS.win.x86 = -MD TEMPLATE_kStuff_CXXFLAGS.win.amd64 = -MT ifneq ($(BUILD_TYPE),debug) TEMPLATE_kStuff_CXXFLAGS.freebsd+= -O3 TEMPLATE_kStuff_CXXFLAGS.linux += -O3 TEMPLATE_kStuff_CXXFLAGS.os2 += -O3 TEMPLATE_kStuff_CXXFLAGS.win += -O2b2 else TEMPLATE_kStuff_CXXFLAGS.win += -Od endif TEMPLATE_kStuff_LDFLAGS.freebsd = -g TEMPLATE_kStuff_LDFLAGS.linux = -g TEMPLATE_kStuff_LDFLAGS.os2 = -g TEMPLATE_kStuff_LDFLAGS.win = /DEBUG /NODEFAULTLIB TEMPLATE_kStuff_LIBS.freebsd = TEMPLATE_kStuff_LIBS.linux = TEMPLATE_kStuff_LIBS.os2 = TEMPLATE_kStuff_LIBS.win = \ $(PATH_SDK_WINPSDK_LIB)/psapi.Lib TEMPLATE_kStuff_LIBS.win.x86 = \ $(PATH_TOOL_VCC70_LIB)/msvcrt.lib \ $(PATH_TOOL_VCC70_LIB)/msvcprt.lib \ $(PATH_TOOL_VCC70_LIB)/oldnames.lib \ $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib TEMPLATE_kStuff_LIBS.win.amd64 = \ $(PATH_TOOL_VCC80AMD64_LIB)/libcmt.lib \ $(PATH_TOOL_VCC80AMD64_LIB)/oldnames.lib \ $(PATH_SDK_W2K3DDKAMD64_LIB)/ntdll.lib TEMPLATE_kStuffEXE = kStuff Executable Template TEMPLATE_kStuffEXE_EXTENDS = kStuff TEMPLATE_kStuffEXE_DEFS = $(TEMPLATE_kStuff) KS_EXE_TARGET TEMPLATE_kStuffLIB = kStuff Library Template TEMPLATE_kStuffLIB_EXTENDS = kStuff TEMPLATE_kStuffLIB_DEFS = $(TEMPLATE_kStuff) KS_LIB_TARGET TEMPLATE_kStuffDLL = kStuff DLL Template TEMPLATE_kStuffDLL_EXTENDS = kStuff TEMPLATE_kStuffDLL_DEFS = $(TEMPLATE_kStuff) KS_DLL_TARGET TEMPLATE_kStuffDLL_LDFLAGS.os2 = $(TEMPLATE_kStuff_LDFLAGS.os2) -Zdll ����������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kErr/��������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�016426� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kErr/Makefile.kmk��������������������������������������������������������0000664�0001750�0001750�00000003665�14670377514�020661� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kErr - The Status Code API, sub-makefile. # # # Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. SUB_DEPTH = .. include $(PATH_KBUILD)/subheader.kmk # # kHlpBaseStatic # LIBRARIES += kErrStatic kErrStatic_TEMPLATE = kStuffLIB kErrStatic_SOURCES = \ kErrName.c kErrName.c_DEPS = $(PATH_TARGET)/kErrNameConsts.h kErrName.c_INCS = $(PATH_TARGET) # # Generate case statements for kErrName(). # $(PATH_TARGET)/kErrNameConsts.h: $(PATH_SUB_ROOT)/include/k/kErrors.h $(MAKEFILE_CURRENT) | $(call DIRDEP,$(PATH_TARGET)) $(RM) -f $@ $(SED) \ -e '/^#define *\(K[A-Z_]*ERR_[^ ()]*\) .*$$/!d' \ -e 's/^#define *\(K[A-Z_]*ERR_[^ ()]*\) .*$$/ERR_CONST(\1)/' \ -e '/K[A-Z_]*ERR_[A-Z0-9_]*BASE/d' \ -e '/K[A-Z_]*ERR_[A-Z0-9_]*END/d' \ $< > $@ # Generate the rules include $(PATH_KBUILD)/subfooter.kmk ���������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kErr/kErrName.c����������������������������������������������������������0000664�0001750�0001750�00000003717�14670377514�020306� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kErrName.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kErr - Status Code API, kErrName. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kErr.h> #include <k/kErrors.h> /** * Translate the error code into a string containing * the error constant. * * @returns Read only string with the constant name. * @param rc The kErrors status code. */ KERR_DECL(const char *) kErrName(int rc) { switch (rc) { case 0: return "SUCCESS"; #define ERR_CONST(c) case c: return #c; #include "kErrNameConsts.h" #undef ERR_CONST default: return "KERR_UNKNOWN_ERROR"; } } �������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/��������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�016417� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrMod.c�����������������������������������������������������������0000664�0001750�0001750�00000105634�14670377513�020127� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrMod.c 81 2016-08-18 22:10:38Z bird $ */ /** @file * kLdr - The Module Interpreter. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include "kLdrInternal.h" #include <k/kCpu.h> #include <k/kLdrFmts/mz.h> #if 1 /* testing headers */ # include <k/kLdrFmts/pe.h> # include <k/kLdrFmts/lx.h> # include <k/kLdrFmts/mach-o.h> #endif /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def KLDRMOD_STRICT * Define KLDRMOD_STRICT to enabled strict checks in KLDRMOD. */ #define KLDRMOD_STRICT 1 /** @def KLDRMOD_ASSERT * Assert that an expression is true when KLDR_STRICT is defined. */ #ifdef KLDRMOD_STRICT # define KLDRMOD_ASSERT(expr) kHlpAssert(expr) #else # define KLDRMOD_ASSERT(expr) do {} while (0) #endif /** Return / crash validation of a module argument. */ #define KLDRMOD_VALIDATE_EX(pMod, rc) \ do { \ if ( (pMod)->u32Magic != KLDRMOD_MAGIC \ || (pMod)->pOps == NULL \ )\ { \ return (rc); \ } \ } while (0) /** Return / crash validation of a module argument. */ #define KLDRMOD_VALIDATE(pMod) \ KLDRMOD_VALIDATE_EX(pMod, KERR_INVALID_PARAMETER) /** Return / crash validation of a module argument. */ #define KLDRMOD_VALIDATE_VOID(pMod) \ do { \ if ( (pMod)->u32Magic != KLDRMOD_MAGIC \ || (pMod)->pOps == NULL \ )\ { \ return; \ } \ } while (0) /******************************************************************************* * Global Variables * *******************************************************************************/ /** The list of module interpreters. */ static PCKLDRMODOPS g_pModInterpreterHead = NULL; /******************************************************************************* * Internal Functions * *******************************************************************************/ /** * Open a executable image by file name. * * @returns 0 on success and *ppMod pointing to a module instance. * On failure, a non-zero OS specific error code is returned. * @param pszFilename The filename to open. * @param fFlags Flags, MBZ. * @param enmCpuArch The desired CPU architecture. KCPUARCH_UNKNOWN means * anything goes, but with a preference for the current * host architecture. * @param ppMod Where to store the module handle. */ int kLdrModOpen(const char *pszFilename, KU32 fFlags, KCPUARCH enmCpuArch, PPKLDRMOD ppMod) { /* * Open the file using a bit provider. */ PKRDR pRdr; int rc = kRdrOpen(&pRdr, pszFilename); if (!rc) { rc = kLdrModOpenFromRdr(pRdr, fFlags, enmCpuArch, ppMod); if (!rc) return 0; kRdrClose(pRdr); } return rc; } /** * Select image from the FAT according to the enmCpuArch and fFlag. * * @returns 0 on success and *poffHdr set to the image header. * On failure, a non-zero error code is returned. * * @param pRdr The file provider instance to use. * @param fFlags Flags, MBZ. * @param enmCpuArch The desired CPU architecture. KCPUARCH_UNKNOWN means * anything goes, but with a preference for the current * host architecture. * @param u32Magic The FAT magic. * @param poffHdr Where to store the offset of the selected image. */ static int kldrModOpenFromRdrSelectImageFromFAT(PKRDR pRdr, KU32 fFlags, KCPUARCH enmCpuArch, KU32 u32Magic, KLDRFOFF *poffHdr) { int rcRet = KLDR_ERR_CPU_ARCH_MISMATCH; KLDRFOFF off = *poffHdr + sizeof(KU32); KLDRFOFF offEndFAT; KBOOL fCpuArchWhatever; KU32 cArchs; KU32 iArch; int rc; K_NOREF(fFlags); /* Read fat_header_t::nfat_arch. */ rc = kRdrRead(pRdr, &cArchs, sizeof(cArchs), off); if (rc) return rc; off += sizeof(KU32); if (u32Magic == IMAGE_FAT_SIGNATURE_OE) cArchs = K_E2E_U32(cArchs); if (cArchs == 0) return KLDR_ERR_FAT_INVALID; /* Deal with KCPUARCH_UNKNOWN. */ fCpuArchWhatever = enmCpuArch == KCPUARCH_UNKNOWN; if (fCpuArchWhatever) { KCPU enmCpuIgnored; kCpuGetArchAndCpu(&enmCpuArch, &enmCpuIgnored); } /* * Iterate the architecture list. */ offEndFAT = off + cArchs * sizeof(fat_arch_t); for (iArch = 0; iArch < cArchs; iArch++) { KCPUARCH enmEntryArch; fat_arch_t Arch; rc = kRdrRead(pRdr, &Arch, sizeof(Arch), off); if (rc) return rc; off += sizeof(Arch); if (u32Magic == IMAGE_FAT_SIGNATURE_OE) { Arch.cputype = K_E2E_U32(Arch.cputype); Arch.cpusubtype = K_E2E_U32(Arch.cpusubtype); Arch.offset = K_E2E_U32(Arch.offset); Arch.size = K_E2E_U32(Arch.size); Arch.align = K_E2E_U32(Arch.align); } /* Simple validation. */ if ( (KLDRFOFF)Arch.offset < offEndFAT || (KLDRFOFF)Arch.offset >= kRdrSize(pRdr) || Arch.align >= 32 || Arch.offset & ((KU32_C(1) << Arch.align) - KU32_C(1))) return KLDR_ERR_FAT_INVALID; /* deal with the cputype and cpusubtype. (See similar code in kLdrModMachO.c.) */ switch (Arch.cputype) { case CPU_TYPE_X86: enmEntryArch = KCPUARCH_X86_32; switch (Arch.cpusubtype) { case CPU_SUBTYPE_I386_ALL: /*case CPU_SUBTYPE_386: ^^ ;*/ case CPU_SUBTYPE_486: case CPU_SUBTYPE_486SX: /*case CPU_SUBTYPE_586: vv */ case CPU_SUBTYPE_PENT: case CPU_SUBTYPE_PENTPRO: case CPU_SUBTYPE_PENTII_M3: case CPU_SUBTYPE_PENTII_M5: case CPU_SUBTYPE_CELERON: case CPU_SUBTYPE_CELERON_MOBILE: case CPU_SUBTYPE_PENTIUM_3: case CPU_SUBTYPE_PENTIUM_3_M: case CPU_SUBTYPE_PENTIUM_3_XEON: case CPU_SUBTYPE_PENTIUM_M: case CPU_SUBTYPE_PENTIUM_4: case CPU_SUBTYPE_PENTIUM_4_M: case CPU_SUBTYPE_XEON: case CPU_SUBTYPE_XEON_MP: break; default: return KLDR_ERR_FAT_UNSUPPORTED_CPU_SUBTYPE; } break; case CPU_TYPE_X86_64: enmEntryArch = KCPUARCH_AMD64; switch (Arch.cpusubtype & ~CPU_SUBTYPE_MASK) { case CPU_SUBTYPE_X86_64_ALL: break; default: return KLDR_ERR_FAT_UNSUPPORTED_CPU_SUBTYPE; } break; default: enmEntryArch = KCPUARCH_UNKNOWN; break; } /* * Finally the actual image selecting. * * Return immediately on a perfect match. Otherwise continue looking, * if we're none too picky, remember the first image in case we don't * get lucky. */ if (enmEntryArch == enmCpuArch) { *poffHdr = Arch.offset; return 0; } if ( fCpuArchWhatever && rcRet == KLDR_ERR_CPU_ARCH_MISMATCH) { *poffHdr = Arch.offset; rcRet = 0; } } return rcRet; } /** * Open a executable image from a file provider instance. * * @returns 0 on success and *ppMod pointing to a module instance. * On failure, a non-zero OS specific error code is returned. * @param pRdr The file provider instance to use. * On success, the ownership of the instance is taken by the * module and the caller must not ever touch it again. * (The instance is not closed on failure, the call has to do that.) * @param fFlags Flags, MBZ. * @param enmCpuArch The desired CPU architecture. KCPUARCH_UNKNOWN means * anything goes, but with a preference for the current * host architecture. * @param ppMod Where to store the module handle. */ int kLdrModOpenFromRdr(PKRDR pRdr, KU32 fFlags, KCPUARCH enmCpuArch, PPKLDRMOD ppMod) { union { KU32 u32; KU16 u16; KU16 au16[2]; KU8 au8[4]; } u; KLDRFOFF offHdr = 0; int rc; kHlpAssertReturn(!(fFlags & ~KLDRMOD_OPEN_FLAGS_VALID_MASK), KERR_INVALID_PARAMETER); for (;;) { /* * Try figure out what kind of image this is. * Always read the 'new header' if we encounter MZ. */ rc = kRdrRead(pRdr, &u, sizeof(u), offHdr); if (rc) return rc; if ( u.u16 == IMAGE_DOS_SIGNATURE && kRdrSize(pRdr) > (KFOFF)sizeof(IMAGE_DOS_HEADER)) { rc = kRdrRead(pRdr, &u, sizeof(u.u32), K_OFFSETOF(IMAGE_DOS_HEADER, e_lfanew)); if (rc) return rc; if ((KLDRFOFF)u.u32 < kRdrSize(pRdr)) { offHdr = u.u32; rc = kRdrRead(pRdr, &u, sizeof(u.u32), offHdr); if (rc) return rc; } else u.u16 = IMAGE_DOS_SIGNATURE; } /* * Handle FAT images too here (one only). */ if ( ( u.u32 == IMAGE_FAT_SIGNATURE || u.u32 == IMAGE_FAT_SIGNATURE_OE) && offHdr == 0) { rc = kldrModOpenFromRdrSelectImageFromFAT(pRdr, fFlags, enmCpuArch, u.u32, &offHdr); if (rc) return rc; if (offHdr) continue; } break; } /* * Use the magic to select the appropriate image interpreter head on. */ if (u.u16 == IMAGE_DOS_SIGNATURE) rc = KLDR_ERR_MZ_NOT_SUPPORTED; else if (u.u16 == IMAGE_NE_SIGNATURE) rc = KLDR_ERR_NE_NOT_SUPPORTED; else if (u.u16 == IMAGE_LX_SIGNATURE) rc = g_kLdrModLXOps.pfnCreate(&g_kLdrModLXOps, pRdr, fFlags, enmCpuArch, offHdr, ppMod); else if (u.u16 == IMAGE_LE_SIGNATURE) rc = KLDR_ERR_LE_NOT_SUPPORTED; else if (u.u32 == IMAGE_NT_SIGNATURE) rc = g_kLdrModPEOps.pfnCreate(&g_kLdrModPEOps, pRdr, fFlags, enmCpuArch, offHdr, ppMod); else if ( u.u32 == IMAGE_MACHO32_SIGNATURE || u.u32 == IMAGE_MACHO32_SIGNATURE_OE || u.u32 == IMAGE_MACHO64_SIGNATURE || u.u32 == IMAGE_MACHO64_SIGNATURE_OE) rc = g_kLdrModMachOOps.pfnCreate(&g_kLdrModMachOOps, pRdr, fFlags, enmCpuArch, offHdr, ppMod); else if (u.u32 == IMAGE_ELF_SIGNATURE) rc = KLDR_ERR_ELF_NOT_SUPPORTED; else rc = KLDR_ERR_UNKNOWN_FORMAT; /* * If no head on hit, let each interpreter have a go. */ if (rc) { PCKLDRMODOPS pOps; for (pOps = g_pModInterpreterHead; pOps; pOps = pOps->pNext) { int rc2 = pOps->pfnCreate(pOps, pRdr, fFlags, enmCpuArch, offHdr, ppMod); if (!rc2) return rc; } *ppMod = NULL; } return rc; } /** * Closes an open module. * * The caller is responsible for calling kLdrModUnmap() and kLdrFreeTLS() * before closing the module. * * @returns 0 on success, non-zero on failure. The module instance state * is unknown on failure, it's best not to touch it. * @param pMod The module. */ int kLdrModClose(PKLDRMOD pMod) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnDestroy(pMod); } /** * Queries a symbol by name or ordinal number. * * @returns 0 and *puValue and *pfKind on success. * KLDR_ERR_SYMBOL_NOT_FOUND is returned if the symbol wasn't found. * Other failures could stem from bad executable format failures, * read failure in case pvBits isn't specified and no mapping should be used. * @param pMod The module. * @param pvBits Optional pointer to bits returned by kLdrModGetBits() currently located at BaseAddress. * This can be used by some module interpreters to reduce memory consumption. * @param BaseAddress The module base address to use when calculating the symbol value. * There are two special values that can be used: * KLDRMOD_BASEADDRESS_LINK and KLDRMOD_BASEADDRESS_MAP. * @param iSymbol The symbol ordinal. (optional) * @param pchSymbol The symbol name. (optional) * Important, this doesn't have to be a null-terminated string. * @param cchSymbol The length of the symbol name. * @param pszVersion The symbol version. NULL if not versioned. * @param pfnGetForwarder The callback to use when resolving a forwarder symbol. This is optional * and if not specified KLDR_ERR_FORWARDER is returned instead. * @param pvUser The user argument for the pfnGetForwarder callback. * @param puValue Where to store the symbol value. (optional) * @param pfKind On input one of the KLDRSYMKIND_REQ_* #defines. * On output the symbol kind. (optional) */ int kLdrModQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind) { KLDRMOD_VALIDATE(pMod); if (!puValue && !pfKind) return KERR_INVALID_PARAMETER; if (puValue) *puValue = 0; if (pfKind) K_VALIDATE_FLAGS(*pfKind, KLDRSYMKIND_REQ_SEGMENTED); return pMod->pOps->pfnQuerySymbol(pMod, pvBits, BaseAddress, iSymbol, pchSymbol, cchSymbol, pszVersion, pfnGetForwarder, pvUser, puValue, pfKind); } /** * Enumerate the symbols in the module. * * @returns 0 on success and non-zero a status code on failure. * @param pMod The module which symbols should be enumerated. * @param pvBits Optional pointer to bits returned by kLdrModGetBits() currently located at BaseAddress. * This can be used by some module interpreters to reduce memory consumption. * @param BaseAddress The module base address to use when calculating the symbol values. * There are two special values that could be can: * KLDRMOD_BASEADDRESS_LINK and KLDRMOD_BASEADDRESS_MAP. * @param fFlags The enumeration flags. A combination of the KLDRMOD_ENUM_SYMS_FLAGS_* \#defines. * @param pfnCallback The enumeration callback function. * @param pvUser The user argument to the callback function. */ int kLdrModEnumSymbols(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser) { KLDRMOD_VALIDATE(pMod); K_VALIDATE_FLAGS(fFlags, KLDRMOD_ENUM_SYMS_FLAGS_ALL); return pMod->pOps->pfnEnumSymbols(pMod, pvBits, BaseAddress, fFlags, pfnCallback, pvUser); } /** * Get the name of an import module by ordinal number. * * @returns 0 and name in pszName on success. * On buffer overruns KERR_BUFFER_OVERFLOW will be returned. * On other failures and appropriate error code is returned. * @param pMod The module. * @param pvBits Optional pointer to bits returned by kLdrModGetBits(). * This can be used by some module interpreters to reduce memory consumption. * @param iImport The import module ordinal number. * @param pszName Where to store the name. * @param cchName The size of the name buffer. */ int kLdrModGetImport(PKLDRMOD pMod, const void *pvBits, KU32 iImport, char *pszName, KSIZE cchName) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnGetImport(pMod, pvBits, iImport, pszName, cchName); } /** * Get the number of import modules. * * @returns The number of import modules. -1 if something really bad happens. * @param pMod The module. * @param pvBits Optional pointer to bits returned by kLdrModGetBits(). * This can be used by some module interpreters to reduce memory consumption. */ KI32 kLdrModNumberOfImports(PKLDRMOD pMod, const void *pvBits) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnNumberOfImports(pMod, pvBits); } /** * Checks if this module can be executed by the specified arch+cpu. * * @returns 0 if it can, KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE if it can't. * Other failures may occur and cause other return values. * @param pMod The module. * @param pvBits Optional pointer to bits returned by kLdrModGetBits(). * This can be used by some module interpreters to reduce memory consumption. * @param enmArch The CPU architecture. * @param enmCpu The CPU series/model. */ int kLdrModCanExecuteOn(PKLDRMOD pMod, const void *pvBits, KCPUARCH enmArch, KCPU enmCpu) { KLDRMOD_VALIDATE(pMod); if (pMod->pOps->pfnCanExecuteOn) return pMod->pOps->pfnCanExecuteOn(pMod, pvBits, enmArch, enmCpu); return kCpuCompare(pMod->enmArch, pMod->enmCpu, enmArch, enmCpu); } /** * Gets the image stack info. * * @returns 0 on success, non-zero on failure. * @param pMod * @param pvBits Optional pointer to bits returned by kLdrModGetBits() currently located at BaseAddress. * This can be used by some module interpreters to reduce memory consumption. * @param BaseAddress The module base address to use when calculating the stack address. * There are two special values that can be used: * KLDRMOD_BASEADDRESS_LINK and KLDRMOD_BASEADDRESS_MAP. * @param pStackInfo The stack information. */ int kLdrModGetStackInfo(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRSTACKINFO pStackInfo) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnGetStackInfo(pMod, pvBits, BaseAddress, pStackInfo); } /** * Queries the main entrypoint of the module. * * Only executable are supposed to have an main entrypoint, though some object and DLL * formats will also allow this. * * @returns 0 and *pMainEPAddress on success. Non-zero status code on failure. * @param pMod The module. * @param pvBits Optional pointer to bits returned by kLdrModGetBits() currently located at BaseAddress. * This can be used by some module interpreters to reduce memory consumption. * @param BaseAddress The module base address to use when calculating the entrypoint address. * There are two special values that can be used: * KLDRMOD_BASEADDRESS_LINK and KLDRMOD_BASEADDRESS_MAP. * @param pMainEPAddress Where to store the entry point address. */ int kLdrModQueryMainEntrypoint(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRADDR pMainEPAddress) { KLDRMOD_VALIDATE(pMod); *pMainEPAddress = 0; return pMod->pOps->pfnQueryMainEntrypoint(pMod, pvBits, BaseAddress, pMainEPAddress); } /** * Queries the image UUID, if the image has one. * * @returns 0 and *pvUuid. Non-zero status code on failure. * @param pMod The module. * @param pvBits Optional pointer to bits returned by kLdrModGetBits() currently located at BaseAddress. * This can be used by some module interpreters to reduce memory consumption. * @param pvUuid Where to store the UUID. * @param cbUuid Size of the UUID buffer, must be at least 16 bytes. */ int kLdrModQueryImageUuid(PKLDRMOD pMod, const void *pvBits, void *pvUuid, KSIZE cbUuid) { KLDRMOD_VALIDATE(pMod); if (cbUuid < 16) return KERR_INVALID_SIZE; if (pMod->pOps->pfnQueryImageUuid) return pMod->pOps->pfnQueryImageUuid(pMod, pvBits, pvUuid, cbUuid); return KLDR_ERR_NO_IMAGE_UUID; } /** * Queries info about a resource. * * If there are multiple resources matching the criteria, the best or * first match will be return. * * * @returns 0 on success. * @returns Whatever non-zero status returned by pfnCallback (enumeration was stopped). * @returns non-zero kLdr or native status code on failure. * * @param pMod The module. * @param pvBits Optional pointer to bits returned by kLdrModGetBits() currently located at BaseAddress. * This can be used by some module interpreters to reduce memory consumption. * @param BaseAddress The module base address to use when calculating the resource addresses. * There are two special values that can be used: * KLDRMOD_BASEADDRESS_LINK and KLDRMOD_BASEADDRESS_MAP. * @param idType The resource type id to match if not NIL_KLDRMOD_RSRC_TYPE_ID. * @param pszType The resource type name to match if no NULL. * @param idName The resource name id to match if not NIL_KLDRMOD_RSRC_NAME_ID. * @param pszName The resource name to match if not NULL. * @param idLang The language id to match. * @param pfnCallback The callback function. * @param pvUser The user argument for the callback. */ int kLdrModQueryResource(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, PKLDRADDR pAddrRsrc, KSIZE *pcbRsrc) { KLDRMOD_VALIDATE(pMod); if (!pAddrRsrc && !pcbRsrc) return KERR_INVALID_PARAMETER; if (pAddrRsrc) *pAddrRsrc = NIL_KLDRADDR; if (pcbRsrc) *pcbRsrc = 0; return pMod->pOps->pfnQueryResource(pMod, pvBits, BaseAddress, idType, pszType, idName, pszName, idLang, pAddrRsrc, pcbRsrc); } /** * Enumerates the resources matching the specfied criteria. * * * @returns 0 on success. * @returns Whatever non-zero status returned by pfnCallback (enumeration was stopped). * @returns non-zero kLdr or native status code on failure. * * @param pMod The module. * @param pvBits Optional pointer to bits returned by kLdrModGetBits() currently located at BaseAddress. * This can be used by some module interpreters to reduce memory consumption. * @param BaseAddress The module base address to use when calculating the resource addresses. * There are two special values that can be used: * KLDRMOD_BASEADDRESS_LINK and KLDRMOD_BASEADDRESS_MAP. * @param idType The resource type id to match if not NIL_KLDRMOD_RSRC_TYPE_ID. * @param pszType The resource type name to match if no NULL. * @param idName The resource name id to match if not NIL_KLDRMOD_RSRC_NAME_ID. * @param pszName The resource name to match if not NULL. * @param idLang The language id to match. * @param pfnCallback The callback function. * @param pvUser The user argument for the callback. */ int kLdrModEnumResources(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, PFNKLDRENUMRSRC pfnCallback, void *pvUser) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnEnumResources(pMod, pvBits, BaseAddress, idType, pszType, idName, pszName, idLang, pfnCallback, pvUser); } /** * Enumerate the debug info formats contained in the executable image. * * @returns 0 on success, non-zero OS or kLdr status code on failure, or non-zero callback status. * @param pMod The module. * @param pvBits Optional pointer to bits returned by kLdrModGetBits(). * This can be used by some module interpreters to reduce memory consumption. * @param pfnCallback The callback function. * @param pvUser The user argument. * @see pg_kDbg for the debug info reader. */ int kLdrModEnumDbgInfo(PKLDRMOD pMod, const void *pvBits, PFNKLDRENUMDBG pfnCallback, void *pvUser) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnEnumDbgInfo(pMod, pvBits, pfnCallback, pvUser); } /** * Checks if the module has debug info embedded or otherwise associated with it. * * @returns 0 if it has debug info, KLDR_ERR_NO_DEBUG_INFO if no debug info, * and non-zero OS or kLdr status code on failure. * @param pMod The module. * @param pvBits Optional pointer to bits returned by kLdrModGetBits(). * This can be used by some module interpreters to reduce memory consumption. */ int kLdrModHasDbgInfo(PKLDRMOD pMod, const void *pvBits) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnHasDbgInfo(pMod, pvBits); } /** * May free up some resources held by the module. * * @todo define exactly what it possible to do after this call. * * @returns 0 on success, KLDR_ERR_* on failure. * @param pMod The module. */ int kLdrModMostlyDone(PKLDRMOD pMod) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnMostlyDone(pMod); } /** * Maps the module into the memory of the caller. * * On success the actual addresses for the segments can be found in MapAddress * member of each segment in the segment array. * * @returns 0 on success, non-zero OS or kLdr status code on failure. * @param pMod The module to be mapped. * @remark kLdr only supports one mapping at a time of a module. */ int kLdrModMap(PKLDRMOD pMod) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnMap(pMod); } /** * Unmaps a module previously mapped by kLdrModMap(). * * @returns 0 on success, non-zero OS or kLdr status code on failure. * @param pMod The module to unmap. */ int kLdrModUnmap(PKLDRMOD pMod) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnUnmap(pMod); } /** * Reloads all dirty pages in a module previously mapped by kLdrModMap(). * * The module interpreter may omit code pages if it can safely apply code * fixups again in a subsequent kLdrModFixupMapping() call. * * The caller is responsible for freeing TLS before calling this function. * * @returns 0 on success, non-zero OS or kLdr status code on failure. * @param pMod The module. */ int kLdrModReload(PKLDRMOD pMod) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnReload(pMod); } /** * Fixup the mapping made by kLdrModMap(). * * The caller is only responsible for not calling this function more than * once without doing kLDrModReload() inbetween. * * @returns 0 on success, non-zero OS or kLdr status code on failure. * @param pMod The module. * @param pfnGetImport The callback for resolving external (imported) symbols. * @param pvUser The callback user argument. */ int kLdrModFixupMapping(PKLDRMOD pMod, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnFixupMapping(pMod, pfnGetImport, pvUser); } /** * Get the size of the mapped module. * * @returns The size of the mapped module (in bytes). * @param pMod The module. */ KLDRADDR kLdrModSize(PKLDRMOD pMod) { KLDRMOD_VALIDATE_EX(pMod, 0); return pMod->pOps->pfnSize(pMod); } /** * Gets the module bits. * * The module interpreter will fill a mapping allocated by the caller with the * module bits reallocated to the specified address. * * @returns 0 on succes, non-zero OS or kLdr status code on failure. * @param pMod The module. * @param pvBits Where to put the bits. * @param BaseAddress The base address that should correspond to the first byte in pvBits * upon return. * @param pfnGetImport The callback ufor resolving external (imported) symbols. * @param pvUser The callback user argument. */ int kLdrModGetBits(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnGetBits(pMod, pvBits, BaseAddress, pfnGetImport, pvUser); } /** * Relocates the module bits previously obtained by kLdrModGetBits(). * * @returns 0 on succes, non-zero OS or kLdr status code on failure. * @param pMod The module. * @param pvBits Where to put the bits. * @param NewBaseAddress The new base address. * @param OldBaseAddress The old base address (i.e. the one specified to kLdrModGetBits() or as * NewBaseAddressto the previous kLdrModRelocateBits() call). * @param pfnGetImport The callback ufor resolving external (imported) symbols. * @param pvUser The callback user argument. */ int kLdrModRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnRelocateBits(pMod, pvBits, NewBaseAddress, OldBaseAddress, pfnGetImport, pvUser); } /** * Allocates Thread Local Storage for module mapped by kLdrModMap(). * * Calling kLdrModAllocTLS() more than once without calling kLdrModFreeTLS() * between each invocation is not supported. * * @returns 0 on success, non-zero OS or kLdr status code on failure. * @param pMod The module. * @param pvMapping The external mapping address or RTLDRMOD_INT_MAP. */ int kLdrModAllocTLS(PKLDRMOD pMod, void *pvMapping) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnAllocTLS(pMod, pvMapping); } /** * Frees Thread Local Storage previously allocated by kLdrModAllocTLS(). * * The caller is responsible for only calling kLdrModFreeTLS() once * after calling kLdrModAllocTLS(). * * @returns 0 on success, non-zero OS or kLdr status code on failure. * @param pMod The module. * @param pvMapping The external mapping address or RTLDRMOD_INT_MAP. */ void kLdrModFreeTLS(PKLDRMOD pMod, void *pvMapping) { KLDRMOD_VALIDATE_VOID(pMod); pMod->pOps->pfnFreeTLS(pMod, pvMapping); } /** * Call the module initializiation function of a mapped module (if any). * * @returns 0 on success or no init function, non-zero on init function failure or invalid pMod. * @param pMod The module. * @param pvMapping The external mapping address or RTLDRMOD_INT_MAP. * @param uHandle The module handle to use if any of the init functions requires the module handle. */ int kLdrModCallInit(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnCallInit(pMod, pvMapping, uHandle); } /** * Call the module termination function of a mapped module (if any). * * @returns 0 on success or no term function, non-zero on invalid pMod. * @param pMod The module. * @param pvMapping The external mapping address or RTLDRMOD_INT_MAP. * @param uHandle The module handle to use if any of the term functions requires the module handle. * * @remark Termination function failure will be ignored by the module interpreter. */ int kLdrModCallTerm(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle) { KLDRMOD_VALIDATE(pMod); return pMod->pOps->pfnCallTerm(pMod, pvMapping, uHandle); } /** * Call the thread attach or detach function of a mapped module (if any). * * Any per-thread TLS initialization/termination will have to be done at this time too. * * @returns 0 on success or no attach/detach function, non-zero on attach failure or invalid pMod. * @param pMod The module. * @param pvMapping The external mapping address or RTLDRMOD_INT_MAP. * @param uHandle The module handle to use if any of the thread attach/detach functions * requires the module handle. * * @remark Detach function failure will be ignored by the module interpreter. */ int kLdrModCallThread(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle, unsigned fAttachingOrDetaching) { KLDRMOD_VALIDATE(pMod); K_VALIDATE_FLAGS(fAttachingOrDetaching, 1); return pMod->pOps->pfnCallThread(pMod, pvMapping, uHandle, fAttachingOrDetaching); } ����������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/Makefile.kmk��������������������������������������������������������0000664�0001750�0001750�00000013207�14670377513�020642� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kLdr - The Dynamic Loader, sub-makefile. # # # Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. SUB_DEPTH = .. include $(PATH_KBUILD)/subheader.kmk #todo: include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk # # Template for testcases. # TEMPLATE_TST = Testcase template ifeq ($(BUILD_TARGET),win) ifeq ($(BUILD_TARGET_ARCH), x86) TEMPLATE_TST_TOOL = VCC70 TEMPLATE_TST_CFLAGS = -W3 -Zi -Zl -MD TEMPLATE_TST_LIBS = $(PATH_TOOL_VCC70_LIB)/msvcrt.lib else TEMPLATE_TST_TOOL = VCC80AMD64 TEMPLATE_TST_CFLAGS = -W3 -Zi -Zl -MD TEMPLATE_TST_LIBS = $(PATH_TOOL_VCC80AMD64_LIB)/msvcrt.lib endif TEMPLATE_TST_CFLAGS.release = -O2 TEMPLATE_TST_ASFLAGS = -f win TEMPLATE_TST_DEFS = __WIN__ TEMPLATE_TST_SDKS = WINPSDK W2K3DDK else ifeq ($(BUILD_TARGET),os2) TEMPLATE_TST_TOOL = GCC3OMF TEMPLATE_TST_ASFLAGS = -f obj TEMPLATE_TST_LIBS = os2 gcc end else ifeq ($(BUILD_TARGET),darwin) TEMPLATE_TST_TOOL = GCC4MACHO TEMPLATE_TST_ASFLAGS = -f macho TEMPLATE_TST_LIBS = #os2 gcc end else TEMPLATE_TST_TOOL = GCC3 TEMPLATE_TST_ASFLAGS = -f elf TEMPLATE_TST_LIBS = gcc endif TEMPLATE_TST_CFLAGS = -Wall -pedantic -g -std=gnu99 TEMPLATE_TST_CFLAGS.release = -O2 TEMPLATE_TST_LDFLAGS = endif TEMPLATE_TST_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include # # The kLdr DLL. # DLLS += kLdr kLdr_ASTOOL = NASM ifeq ($(BUILD_TARGET),win) ifeq ($(BUILD_TARGET_ARCH),x86) kLdr_TOOL = VCC70 kLdr_CFLAGS = -W3 -Zl -ML kLdr_LDFLAGS = -Entry:DllMain@12 -Debug kLdr_LIBS = \ $(PATH_TOOL_VCC70_LIB)/LIBC.lib \ $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib else kLdr_TOOL = VCC80AMD64 kLdr_ASTOOL = YASM kLdr_CFLAGS = -W3 -Zl -MT kLdr_LDFLAGS = -Entry:DllMain -Debug kLdr_LIBS = \ $(PATH_TOOL_VCC80AMD64_LIB)/LIBCMT.lib \ $(PATH_SDK_W2K3DDKAMD64_LIB)/ntdll.lib endif kLdr_ASFLAGS = -f win kLdr_DEFS = __WIN__ kLdr_SDKS.x86 = WIN32SDK W2K3DDKX86 kLdr_SDKS.amd64 = WIN64SDK W2K3DDKAMD64 else ifeq ($(BUILD_TARGET),os2) kLdr_TOOL = GCC3OMF kLdr_ASFLAGS = -f obj kLdr_LIBS = os2 gcc end else ifeq ($(BUILD_TARGET),darwin) kLdr_TOOL = GCC4MACHO kLdr_ASFLAGS = -f macho kLdr_LIBS = #os2 gcc end else kLdr_TOOL = GCC3 kLdr_ASFLAGS = -f elf kLdr_LIBS = gcc endif kLdr_CFLAGS = -Wall -pedantic kLdr_LDFLAGS = -nostdlib endif kLdr_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include kLdr_SOURCES = \ kLdr.c \ kLdrDyld.c \ kLdrDyldFind.c \ kLdrDyldMod.c \ kLdrDyldOS.c \ kLdrDyLdSem.c \ kLdrMod.c \ kLdrModLX.c \ kLdrModMachO.c \ kLdrModNative.c \ kLdrModPE.c kLdr_SOURCES.os2 = \ kLdr-os2.def \ kLdr-os2.c \ kLdrA-os2.asm kLdr_SOURCES.win = \ kLdr-win.def \ kLdr-win.c kLdr_LIBS += \ $(PATH_LIB)/kRdrStatic$(SUFF_LIB) \ $(PATH_LIB)/kCpuStatic$(SUFF_LIB) \ $(PATH_LIB)/kHlpBareStatic$(SUFF_LIB) \ $(PATH_LIB)/kErrStatic$(SUFF_LIB) # # A static edition of kLdr. # LIBRARIES += kLdrStatic kLdrStatic_TEMPLATE = kStuffLIB kLdrStatic_SDKS.win = WINPSDK W2K3DDK kLdrStatic_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include kLdrStatic_DEFS.darwin = __DARWIN__ kLdrStatic_DEFS.os2 = __OS2__ kLdrStatic_DEFS.win = __WIN__ kLdrStatic_SOURCES = $(kLdr_SOURCES) # # The OS/2 stub program. # PROGRAMS.os2 = kLdrExeStub-os2 kLdrExeStub-os2_TOOL = GCC3OMF kLdrExeStub-os2_ASTOOL = NASM kLdrExeStub-os2_ASFLAGS = -f obj #kLdrExeStub-os2_LDFLAGS = -nostdlib kLdrExeStub-os2_LDFLAGS = -nostdlib -Zstack 64 kLdrExeStub-os2_LIBS = $(TARGET_kLdr) #kLdrExeStub-os2_SOURCES = kLdrExeStub-os2.asm kLdrExeStub-os2_SOURCES = kLdrExeStub-os2A.asm kLdrExeStub-os2.c # # The Windows stub program. # PROGRAMS.win = kLdrExeStub-win kLdrExeStub-win_TOOL.win.x86 = VCC70 kLdrExeStub-win_TOOL.win.amd64 = VCC80AMD64 kLdrExeStub-win_SDKS.x86 = WIN32SDK kLdrExeStub-win_SDKS.amd64 = WIN64SDK kLdrExeStub-win_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include kLdrExeStub-win_DEFS = __WIN__ kLdrExeStub-win_CFLAGS = -W3 -Zl kLdrExeStub-win_CFLAGS.debug = -Zi kLdrExeStub-win_LDFLAGS = -Entry:WindowsMain -SubSystem:Console -FIXED:NO kLdrExeStub-win_LIBS = $(TARGET_kLdr:.dll=.lib) kLdrExeStub-win_SOURCES = kLdrExeStub-win.c ## ## The (stub) utility. ## #PROGRAMS = kLdrUtil # # Heap testcase. # #PROGRAMS += tstkLdrHeap tstkLdrHeap_TEMPLATE = TST tstkLdrHeap_SOURCES = \ tstkLdrHeap.c \ kHlp.c \ kHlpHeap.c \ kHlpMem.c \ kHlpPath.c \ kHlpSem.c \ kHlpStr.c \ # # Heap testcase. # PROGRAMS += tstkLdrMod tstkLdrMod_TEMPLATE = TST tstkLdrMod_SOURCES = \ tstkLdrMod.c ifeq ($(BUILD_TARGET),win) tstkLdrMod_LIBS = $(TARGET_kLdr:.dll=.lib) else tstkLdrMod_LIBS = $(TARGET_kLdr) endif # Generate rules. include $(PATH_KBUILD)/subfooter.kmk �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdr-os2.def��������������������������������������������������������0000664�0001750�0001750�00000005466�14670377513�020506� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; $Id: kLdr-os2.def 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - The Dynamic Loader, OS/2 Linker Definition File. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; LIBRARY kLdr INITINSTANCE TERMINSTANCE DATA MULTIPLE EXPORTS ; The file reader API _kRdrAddProvider _kRdrOpen _kRdrClose _kRdrRead _kRdrAllMap _kRdrAllUnmap _kRdrSize _kRdrTell _kRdrName _kRdrPageSize _kRdrMap _kRdrRefresh _kRdrProtect _kRdrUnmap _kRdrDone ; The module interpreter API _kLdrModOpen _kLdrModOpenFromRdr _kLdrModOpenNative _kLdrModOpenNativeByHandle _kLdrModClose _kLdrModQuerySymbol _kLdrModEnumSymbols _kLdrModGetImport _kLdrModNumberOfImports _kLdrModCanExecuteOn _kLdrModGetStackInfo _kLdrModQueryMainEntrypoint _kLdrModEnumDbgInfo _kLdrModHasDbgInfo _kLdrModMap _kLdrModUnmap _kLdrModAllocTLS _kLdrModFreeTLS _kLdrModReload _kLdrModFixupMapping _kLdrModCallInit _kLdrModCallTerm _kLdrModCallThread _kLdrModSize _kLdrModGetBits _kLdrModRelocateBits ; Process Bootstrapping _kLdrDyldLoadExe ; Dynamic loading _kLdrDyldLoad _kLdrDyldUnload _kLdrDyldFindByName _kLdrDyldFindByAddress _kLdrDyldGetName _kLdrDyldGetFilename _kLdrDyldQuerySymbol ; OS/2 API wrappers: ; kLdrLoadModule ; kLdrFreeModule ; kLdrQueryModuleHandle ; kLdrQueryModuleName ; kLdrQueryProcAddr ; kLdrQueryProcType ; kLdrQueryModFromEIP ; kLdrReplaceModule ; kLdrGetResource ; kLdrFreeResource ; kLdrQueryResourceSize ; dlfcn API wrappers: ; _kLdrDlOpen ; _kLdrDlClose ; _kLdrDlError ; _kLdrDlSym ; _kLdrDlFunc ; Error APIs: _kErrStr ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrExeStub-os2A.asm������������������������������������������������0000664�0001750�0001750�00000002635�14670377514�022125� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; $Id: kLdrExeStub-os2A.asm 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - OS/2 Loader Stub, entry point thingy... ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; segment TEXT32 public CLASS=CODE align=16 use32 extern OS2Main ..start: jmp OS2Main segment DATA32 stack CLASS=DATA align=16 use32 global WEAK$ZERO WEAK$ZERO EQU 0 ���������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdr-win.c����������������������������������������������������������0000664�0001750�0001750�00000004540�14670377514�020255� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdr-win.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, Windows Specifics. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <Windows.h> #include <k/kLdr.h> #include "kLdrInternal.h" /** * The DLL main function. * * @returns TRUE / FALSE. * @param hDllHandle The dll handle. * @param dwReason The reason we're being called. * @param lpReserved Reserved. */ BOOL __stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved) { switch (dwReason) { case DLL_PROCESS_ATTACH: { int rc = kldrInit(); return rc == 0; } case DLL_PROCESS_DETACH: kldrTerm(); return TRUE; case DLL_THREAD_ATTACH: { //int rc = kLdrDyldThreadAttach(); //return rc == 0; return TRUE; } case DLL_THREAD_DETACH: //kLdrDyldThreadDetach(); return TRUE; default: return FALSE; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrDyldSem.c�������������������������������������������������������0000664�0001750�0001750�00000011757�14670377513�020753� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrDyldSem.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, Semaphore Helper Functions. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kDefs.h> #include <k/kHlpSem.h> #include <k/kHlpAssert.h> #if K_OS == K_OS_DARWIN # include <mach/mach.h> # undef mach_task_self /* don't use the macro (if we're using bare helpers ) */ #elif K_OS == K_OS_OS2 # define INCL_BASE # define INCL_ERRORS # include <os2.h> #elif K_OS == K_OS_WINDOWS # include <Windows.h> #else # error "port me" #endif /******************************************************************************* * Global Variables * *******************************************************************************/ #if K_OS == K_OS_DARWIN /** The loader sempahore. */ static semaphore_t g_Semaphore = MACH_PORT_NULL; #elif K_OS == K_OS_OS2 /** The loader sempahore. */ static HMTX g_hmtx; #elif K_OS == K_OS_WINDOWS /** The loader sempahore. */ static CRITICAL_SECTION g_CritSect; #else # error "port me" #endif /** * Initializes the loader semaphore. * * @returns 0 on success, non-zero OS status code on failure. */ int kLdrDyldSemInit(void) { #if K_OS == K_OS_DARWIN kern_return_t krc; krc = semaphore_create(mach_task_self(), &g_Semaphore, SYNC_POLICY_FIFO, 0); if (krc != KERN_SUCCESS) return krc; #elif K_OS == K_OS_OS2 APIRET rc; g_hmtx = NULLHANDLE; rc = DosCreateMutexSem(NULL, &g_hmtx, 0, FALSE); if (rc) return rc; #elif K_OS == K_OS_WINDOWS InitializeCriticalSection(&g_CritSect); #else # error "port me" #endif return 0; } /** * Terminates the loader semaphore. */ void kLdrDyldSemTerm(void) { #if K_OS == K_OS_DARWIN kern_return_t krc; semaphore_t Semaphore = g_Semaphore; g_Semaphore = MACH_PORT_NULL; krc = semaphore_destroy(mach_task_self(), Semaphore); kHlpAssert(krc == KERN_SUCCESS); (void)krc; #elif K_OS == K_OS_OS2 HMTX hmtx = g_hmtx; g_hmtx = NULLHANDLE; DosCloseMutexSem(hmtx); #elif K_OS == K_OS_WINDOWS DeleteCriticalSection(&g_CritSect); #else # error "port me" #endif } /** * Requests the loader sempahore ownership. * This can be done recursivly. * * @returns 0 on success, non-zero OS status code on failure. */ int kLdrDyldSemRequest(void) { #if K_OS == K_OS_DARWIN /* not sure about this... */ kern_return_t krc; do krc = semaphore_wait(g_Semaphore); while (krc == KERN_ABORTED); if (krc == KERN_SUCCESS) return 0; return krc; #elif K_OS == K_OS_OS2 APIRET rc = DosRequestMutexSem(g_hmtx, 5000); if (rc == ERROR_TIMEOUT || rc == ERROR_SEM_TIMEOUT || rc == ERROR_INTERRUPT) { unsigned i = 0; do { /** @todo check for deadlocks etc. */ rc = DosRequestMutexSem(g_hmtx, 1000); } while ( ( rc == ERROR_TIMEOUT || rc == ERROR_SEM_TIMEOUT || rc == ERROR_INTERRUPT) && i++ < 120); } return rc; #elif K_OS == K_OS_WINDOWS EnterCriticalSection(&g_CritSect); return 0; #else # error "port me" #endif } /** * Releases the loader semaphore ownership. * The caller is responsible for making sure it's the semaphore owner! */ void kLdrDyldSemRelease(void) { #if K_OS == K_OS_DARWIN /* not too sure about this... */ kern_return_t krc = semaphore_signal(g_Semaphore); kHlpAssert(krc == KERN_SUCCESS); (void)krc; #elif K_OS == K_OS_OS2 APIRET rc = DosReleaseMutexSem(g_hmtx); kHlpAssert(!rc); (void)rc; #elif K_OS == K_OS_WINDOWS LeaveCriticalSection(&g_CritSect); #else # error "port me" #endif } �����������������kbuild-3608/src/lib/kStuff/kLdr/kLdrExeStub-win.c���������������������������������������������������0000664�0001750�0001750�00000004357�14670377513�021562� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrExeStub-win.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Windows Loader Stub. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include <Windows.h> #include "kLdrInternal.h" /******************************************************************************* * Global Variables * *******************************************************************************/ /** The stub arguments. */ static const KLDREXEARGS g_Args = { /* .fFlags = */ KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT, /* .enmSearch = */ KLDRDYLD_SEARCH_WINDOWS, /* .szExecutable = */ "tst-0", /* just while testing */ /* .szDefPrefix = */ "", /* .szDefSuffix = */ "", /* .szLibPath = */ "" }; /** * Windows 'main'. */ int WindowsMain(void) { kLdrDyldLoadExe(&g_Args, NULL); /* won't happen */ return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdr.c��������������������������������������������������������������0000664�0001750�0001750�00000010453�14670377514�017462� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdr.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** @mainpage kLdr - The Dynamic Loader * * The purpose of kLdr is to provide a generic interface for querying * information about and loading executable image modules. * * kLdr defines the term executable image to include all kinds of files that contains * binary code that can be executed on a CPU - linker objects (OBJs/Os), shared * objects (SOs), dynamic link libraries (DLLs), executables (EXEs), and all kinds * of kernel modules / device drivers (SYSs). * * kLdr provides two types of services: * -# Inspect or/and load individual modules (kLdrMod). * -# Work as a dynamic loader - construct and maintain an address space (kLdrDy). * * The kLdrMod API works on KLDRMOD structures where all the internals are exposed, while * the kLdrDy API works opque KLDRDY structures. KLDRDY are in reality simple wrappers * around KLDRMOD with some extra linking and attributes. * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include "kLdrInternal.h" /******************************************************************************* * Global Variables * *******************************************************************************/ /** Flag indicating whether we've initialized the loader or not. * * 0 if not initialized. * -1 if we're initializing or terminating. * 1 if we've successfully initialized it. * -2 if initialization failed. */ static int volatile g_fInitialized; /** * Initializes the loader. * @returns 0 on success, non-zero OS status code on failure. */ int kldrInit(void) { int rc; /* check we're already good. */ if (g_fInitialized == 1) return 0; /* a tiny serialization effort. */ for (;;) { if (g_fInitialized == 1) return 0; if (g_fInitialized == -2) return -1; /** @todo atomic test and set if we care. */ if (g_fInitialized == 0) { g_fInitialized = -1; break; } kHlpSleep(1); } /* * Do the initialization. */ rc = kHlpHeapInit(); if (!rc) { rc = kLdrDyldSemInit(); if (!rc) { rc = kldrDyldInit(); if (!rc) { g_fInitialized = 1; return 0; } kLdrDyldSemTerm(); } kHlpHeapTerm(); } g_fInitialized = -2; return rc; } /** * Terminates the loader. */ void kldrTerm(void) { /* can't terminate unless it's initialized. */ if (g_fInitialized != 1) return; g_fInitialized = -1; /* * Do the termination. */ kLdrDyldSemTerm(); kHlpHeapTerm(); /* done */ g_fInitialized = 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrDyldFind.c������������������������������������������������������0000664�0001750�0001750�00000114050�14670377513�021075� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrDyldFind.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, File Searching Methods. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include "kLdrInternal.h" #if K_OS == K_OS_LINUX # include <k/kHlpSys.h> #elif K_OS == K_OS_OS2 # define INCL_BASE # define INCL_ERRORS # include <os2.h> # ifndef LIBPATHSTRICT # define LIBPATHSTRICT 3 # endif extern APIRET APIENTRY DosQueryHeaderInfo(HMODULE hmod, ULONG ulIndex, PVOID pvBuffer, ULONG cbBuffer, ULONG ulSubFunction); # define QHINF_EXEINFO 1 /* NE exeinfo. */ # define QHINF_READRSRCTBL 2 /* Reads from the resource table. */ # define QHINF_READFILE 3 /* Reads from the executable file. */ # define QHINF_LIBPATHLENGTH 4 /* Gets the libpath length. */ # define QHINF_LIBPATH 5 /* Gets the entire libpath. */ # define QHINF_FIXENTRY 6 /* NE only */ # define QHINF_STE 7 /* NE only */ # define QHINF_MAPSEL 8 /* NE only */ #elif K_OS == K_OS_WINDOWS # undef IMAGE_DOS_SIGNATURE # undef IMAGE_NT_SIGNATURE # include <Windows.h> #endif /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def KLDRDYLDFIND_STRICT * Define KLDRDYLDFIND_STRICT to enabled strict checks in kLdrDyldFind. */ #define KLDRDYLDFIND_STRICT 1 /** @def KLDRDYLDFIND_ASSERT * Assert that an expression is true when KLDRDYLDFIND_STRICT is defined. */ #ifdef KLDRDYLDFIND_STRICT # define KLDRDYLDFIND_ASSERT(expr) kHlpAssert(expr) #else # define KLDRDYLDFIND_ASSERT(expr) do {} while (0) #endif /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Search arguments. * This avoids a bunch of unnecessary string lengths and calculations. */ typedef struct KLDRDYLDFINDARGS { const char *pszName; KSIZE cchName; const char *pszPrefix; KSIZE cchPrefix; const char *pszSuffix; KSIZE cchSuffix; KSIZE cchMaxLength; KLDRDYLDSEARCH enmSearch; KU32 fFlags; PPKRDR ppRdr; } KLDRDYLDFINDARGS, *PKLDRDYLDFINDARGS; typedef const KLDRDYLDFINDARGS *PCKLDRDYLDFINDARGS; /******************************************************************************* * Global Variables * *******************************************************************************/ /** @name The kLdr search method parameters. * @{ */ /** The kLdr EXE search path. * During EXE searching the it's initialized with the values of the KLDR_PATH and * the PATH env.vars. Both ';' and ':' can be used as separators. */ char kLdrDyldExePath[8192]; /** The kLdr DLL search path. * During initialization the KLDR_LIBRARY_PATH env.var. and the path in the * executable stub is appended. Both ';' and ':' can be used as separators. */ char kLdrDyldLibraryPath[8192]; /** The kLdr application directory. * This is initialized when the executable is 'loaded' or by a kLdr user. */ char kLdrDyldAppDir[260]; /** The default kLdr DLL prefix. * This is initialized with the KLDR_DEF_PREFIX env.var. + the prefix in the executable stub. */ char kLdrDyldDefPrefix[16]; /** The default kLdr DLL suffix. * This is initialized with the KLDR_DEF_SUFFIX env.var. + the prefix in the executable stub. */ char kLdrDyldDefSuffix[16]; /** @} */ /** @name The OS/2 search method parameters. * @{ */ /** The OS/2 LIBPATH. * This is queried from the os2krnl on OS/2, while on other systems initialized using * the KLDR_OS2_LIBPATH env.var. */ char kLdrDyldOS2Libpath[2048]; /** The OS/2 LIBPATHSTRICT ("T" or '\0'). * This is queried from the os2krnl on OS/2, while on other systems initialized using * the KLDR_OS2_LIBPATHSTRICT env.var. */ char kLdrDyldOS2LibpathStrict[8]; /** The OS/2 BEGINLIBPATH. * This is queried from the os2krnl on OS/2, while on other systems initialized using * the KLDR_OS2_BEGINLIBPATH env.var. */ char kLdrDyldOS2BeginLibpath[2048]; /** The OS/2 ENDLIBPATH. * This is queried from the os2krnl on OS/2, while on other systems initialized using * the KLDR_OS2_ENDLIBPATH env.var. */ char kLdrDyldOS2EndLibpath[2048]; /** @} */ /** @name The Windows search method parameters. * @{ */ /** The Windows application directory. * This is initialized when the executable is 'loaded' or by a kLdr user. */ char kLdrDyldWindowsAppDir[260]; /** The Windows system directory. * This is queried from the Win32/64 subsystem on Windows, while on other systems * initialized using the KLDR_WINDOWS_SYSTEM_DIR env.var. */ char kLdrDyldWindowsSystemDir[260]; /** The Windows directory. * This is queried from the Win32/64 subsystem on Windows, while on other systems * initialized using the KLDR_WINDOWS_DIR env.var. */ char kLdrDyldWindowsDir[260]; /** The Windows path. * This is queried from the PATH env.var. on Windows, while on other systems * initialized using the KLDR_WINDOWS_PATH env.var. and falling back on * the PATH env.var. if it wasn't found. */ char kLdrDyldWindowsPath[8192]; /** @} */ /** @name The Common Unix search method parameters. * @{ */ /** The Common Unix library path. * Initialized from the env.var. KLDR_UNIX_LIBRARY_PATH or LD_LIBRARY_PATH or the * former wasn't found. */ char kLdrDyldUnixLibraryPath[8192]; /** The Common Unix system library path. */ char kLdrDyldUnixSystemLibraryPath[1024] = "/lib;/usr/lib"; /** @} */ /** @todo Deal with DT_RUNPATH and DT_RPATH. */ /** @todo ld.so.cache? */ /******************************************************************************* * Internal Functions * *******************************************************************************/ static int kldrDyldFindDoDllSearch(const char *pszName, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKRDR ppRdr); static int kldrDyldFindDoExeSearch(const char *pszName, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKRDR ppRdr); static int kldrDyldFindTryOpen(const char *pszFilename, PPKRDR ppRdr); static int kldrDyldFindTryOpenPath(const char *pchPath, KSIZE cchPath, PCKLDRDYLDFINDARGS pArgs); static int kldrDyldFindEnumeratePath(const char *pszSearchPath, PCKLDRDYLDFINDARGS pArgs); static int kldrDyldFindGetDefaults(KLDRDYLDSEARCH *penmSearch, const char **pszPrefix, const char **pszSuffix, const char *pszName, KU32 fFlags); /** * Initializes the find paths. * * @returns 0 on success, non-zero on failure. */ int kldrDyldFindInit(void) { KSIZE cch; int rc; char szTmp[sizeof(kLdrDyldDefSuffix)]; /* * The kLdr search parameters. */ rc = kHlpGetEnv("KLDR_LIBRARY_PATH", kLdrDyldLibraryPath, sizeof(kLdrDyldLibraryPath)); rc = kHlpGetEnv("KLDR_DEF_PREFIX", szTmp, sizeof(szTmp)); if (!rc) kHlpMemCopy(kLdrDyldDefPrefix, szTmp, sizeof(szTmp)); rc = kHlpGetEnv("KLDR_DEF_SUFFIX", szTmp, sizeof(szTmp)); if (!rc) kHlpMemCopy(kLdrDyldDefSuffix, szTmp, sizeof(szTmp)); /* * The OS/2 search parameters. */ #if K_OS == K_OS_OS2 rc = DosQueryHeaderInfo(NULLHANDLE, 0, kLdrDyldOS2Libpath, sizeof(kLdrDyldOS2Libpath), QHINF_LIBPATH); if (rc) return rc; rc = DosQueryExtLIBPATH((PSZ)kLdrDyldOS2LibpathStrict, LIBPATHSTRICT); if (rc) kLdrDyldOS2LibpathStrict[0] = '\0'; rc = DosQueryExtLIBPATH((PSZ)kLdrDyldOS2BeginLibpath, BEGIN_LIBPATH); if (rc) kLdrDyldOS2BeginLibpath[0] = '\0'; rc = DosQueryExtLIBPATH((PSZ)kLdrDyldOS2EndLibpath, END_LIBPATH); if (rc) kLdrDyldOS2EndLibpath[0] = '\0'; #else kHlpGetEnv("KLDR_OS2_LIBPATH", kLdrDyldOS2Libpath, sizeof(kLdrDyldOS2Libpath)); kHlpGetEnv("KLDR_OS2_LIBPATHSTRICT", kLdrDyldOS2LibpathStrict, sizeof(kLdrDyldOS2LibpathStrict)); if ( kLdrDyldOS2LibpathStrict[0] == 'T' || kLdrDyldOS2LibpathStrict[0] == 't') kLdrDyldOS2LibpathStrict[0] = 'T'; else kLdrDyldOS2LibpathStrict[0] = '\0'; kLdrDyldOS2LibpathStrict[1] = '\0'; kHlpGetEnv("KLDR_OS2_BEGINLIBPATH", kLdrDyldOS2BeginLibpath, sizeof(kLdrDyldOS2BeginLibpath)); kHlpGetEnv("KLDR_OS2_ENDLIBPATH", kLdrDyldOS2EndLibpath, sizeof(kLdrDyldOS2EndLibpath)); #endif /* * The windows search parameters. */ #if K_OS == K_OS_WINDOWS cch = GetSystemDirectory(kLdrDyldWindowsSystemDir, sizeof(kLdrDyldWindowsSystemDir)); if (cch >= sizeof(kLdrDyldWindowsSystemDir)) return (rc = GetLastError()) ? rc : -1; cch = GetWindowsDirectory(kLdrDyldWindowsDir, sizeof(kLdrDyldWindowsDir)); if (cch >= sizeof(kLdrDyldWindowsDir)) return (rc = GetLastError()) ? rc : -1; kHlpGetEnv("PATH", kLdrDyldWindowsPath, sizeof(kLdrDyldWindowsPath)); #else kHlpGetEnv("KLDR_WINDOWS_SYSTEM_DIR", kLdrDyldWindowsSystemDir, sizeof(kLdrDyldWindowsSystemDir)); kHlpGetEnv("KLDR_WINDOWS_DIR", kLdrDyldWindowsDir, sizeof(kLdrDyldWindowsDir)); rc = kHlpGetEnv("KLDR_WINDOWS_PATH", kLdrDyldWindowsPath, sizeof(kLdrDyldWindowsPath)); if (rc) kHlpGetEnv("PATH", kLdrDyldWindowsPath, sizeof(kLdrDyldWindowsPath)); #endif /* * The Unix search parameters. */ rc = kHlpGetEnv("KLDR_UNIX_LIBRARY_PATH", kLdrDyldUnixLibraryPath, sizeof(kLdrDyldUnixLibraryPath)); if (rc) kHlpGetEnv("LD_LIBRARY_PATH", kLdrDyldUnixLibraryPath, sizeof(kLdrDyldUnixLibraryPath)); (void)cch; return 0; } /** * Lazily initialize the two application directory paths. */ static void kldrDyldFindLazyInitAppDir(void) { if (!kLdrDyldAppDir[0]) { #if K_OS == K_OS_DARWIN /** @todo implement this! */ kLdrDyldWindowsAppDir[0] = kLdrDyldAppDir[0] = '.'; kLdrDyldWindowsAppDir[1] = kLdrDyldAppDir[1] = '\0'; #elif K_OS == K_OS_LINUX KSSIZE cch = kHlpSys_readlink("/proc/self/exe", kLdrDyldAppDir, sizeof(kLdrDyldAppDir) - 1); if (cch > 0) { kLdrDyldAppDir[cch] = '\0'; *kHlpGetFilename(kLdrDyldAppDir) = '\0'; kHlpMemCopy(kLdrDyldWindowsAppDir, kLdrDyldAppDir, sizeof(kLdrDyldAppDir)); } else { kLdrDyldWindowsAppDir[0] = kLdrDyldAppDir[0] = '.'; kLdrDyldWindowsAppDir[1] = kLdrDyldAppDir[1] = '\0'; } #elif K_OS == K_OS_OS2 PPIB pPib; PTIB pTib; APIRET rc; DosGetInfoBlocks(&pTib, &pPib); rc = DosQueryModuleName(pPib->pib_hmte, sizeof(kLdrDyldAppDir), kLdrDyldAppDir); if (!rc) { *kHlpGetFilename(kLdrDyldAppDir) = '\0'; kHlpMemCopy(kLdrDyldWindowsAppDir, kLdrDyldAppDir, sizeof(kLdrDyldAppDir)); } else { kLdrDyldWindowsAppDir[0] = kLdrDyldAppDir[0] = '.'; kLdrDyldWindowsAppDir[1] = kLdrDyldAppDir[1] = '\0'; } #elif K_OS == K_OS_WINDOWS DWORD dwSize = GetModuleFileName(NULL /* the executable */, kLdrDyldAppDir, sizeof(kLdrDyldAppDir)); if (dwSize > 0) { *kHlpGetFilename(kLdrDyldAppDir) = '\0'; kHlpMemCopy(kLdrDyldWindowsAppDir, kLdrDyldAppDir, sizeof(kLdrDyldAppDir)); } else { kLdrDyldWindowsAppDir[0] = kLdrDyldAppDir[0] = '.'; kLdrDyldWindowsAppDir[1] = kLdrDyldAppDir[1] = '\0'; } #else # error "Port me" #endif } } /** * Locates and opens a module using the specified search method. * * @returns 0 and *ppMod on success, non-zero OS specific error on failure. * * @param pszName Partial or complete name, it's specific to the search method to determin which. * @param pszPrefix Prefix than can be used when searching. * @param pszSuffix Suffix than can be used when searching. * @param enmSearch The file search method to apply. * @param fFlags Search flags. * @param ppMod Where to store the file provider instance on success. */ int kldrDyldFindNewModule(const char *pszName, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod) { int rc; PKRDR pRdr = NULL; *ppMod = NULL; /* * If this isn't just a filename, we the caller has specified a file * that should be opened directly and not a module name to be searched for. */ if (!kHlpIsFilenameOnly(pszName)) rc = kldrDyldFindTryOpen(pszName, &pRdr); else if (!(fFlags & KLDRDYLD_LOAD_FLAGS_EXECUTABLE)) rc = kldrDyldFindDoDllSearch(pszName, pszPrefix, pszSuffix, enmSearch, fFlags, &pRdr); else rc = kldrDyldFindDoExeSearch(pszName, pszPrefix, pszSuffix, enmSearch, fFlags, &pRdr); if (!rc) { #ifdef KLDRDYLDFIND_STRICT /* Sanity check of kldrDyldFindExistingModule. */ if (fFlags & KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE) { const char *pszFilename = kRdrName(pRdr); const KSIZE cchFilename = kHlpStrLen(pszFilename); PKLDRDYLDMOD pCur; for (pCur = kLdrDyldHead; pCur; pCur = pCur->Load.pNext) KLDRDYLDFIND_ASSERT( pCur->pMod->cchFilename != cchFilename || kHlpMemComp(pCur->pMod->pszFilename, pszFilename, cchFilename)); } #endif /* * Check for matching non-global modules that should be promoted. */ if (!(fFlags & KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE)) { const char *pszFilename = kRdrName(pRdr); const KSIZE cchFilename = kHlpStrLen(pszFilename); PKLDRDYLDMOD pCur; for (pCur = kLdrDyldHead; pCur; pCur = pCur->Load.pNext) { if ( !pCur->fGlobalOrSpecific && pCur->pMod->cchFilename == cchFilename && !kHlpMemComp(pCur->pMod->pszFilename, pszFilename, cchFilename)) { kRdrClose(pRdr); kldrDyldModMarkGlobal(pCur); *ppMod = pCur; return 0; } KLDRDYLDFIND_ASSERT( pCur->pMod->cchFilename != cchFilename || kHlpMemComp(pCur->pMod->pszFilename, pszFilename, cchFilename)); } } /* * Create a new module. */ rc = kldrDyldModCreate(pRdr, fFlags, ppMod); if (rc) kRdrClose(pRdr); } return rc; } /** * Searches for a DLL file using the specified method. * * @returns 0 on success and *ppMod pointing to the new module. * @returns KLDR_ERR_MODULE_NOT_FOUND if the specified file couldn't be opened. * @returns non-zero kLdr or OS specific status code on other failures. * @param pszName The name. * @param pszPrefix The prefix, optional. * @param pszSuffix The suffix, optional. * @param enmSearch The search method. * @param fFlags The load/search flags. * @param ppRdr Where to store the pointer to the file provider instance on success. */ static int kldrDyldFindDoDllSearch(const char *pszName, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKRDR ppRdr) { int rc; KLDRDYLDFINDARGS Args; /* * Initialize the argument structure and resolve defaults. */ Args.enmSearch = enmSearch; Args.pszPrefix = pszPrefix; Args.pszSuffix = pszSuffix; rc = kldrDyldFindGetDefaults(&Args.enmSearch, &Args.pszPrefix, &Args.pszSuffix, pszName, fFlags); if (rc) return rc; Args.pszName = pszName; Args.cchName = kHlpStrLen(pszName); Args.cchPrefix = Args.pszPrefix ? kHlpStrLen(Args.pszPrefix) : 0; Args.cchSuffix = Args.pszSuffix ? kHlpStrLen(Args.pszSuffix) : 0; Args.cchMaxLength = Args.cchName + Args.cchSuffix + Args.cchPrefix; Args.fFlags = fFlags; Args.ppRdr = ppRdr; /* * Apply the specified search method. */ /** @todo get rid of the strlen() on the various paths here! */ switch (Args.enmSearch) { case KLDRDYLD_SEARCH_KLDR: { kldrDyldFindLazyInitAppDir(); if (kLdrDyldAppDir[0] != '\0') { rc = kldrDyldFindTryOpenPath(kLdrDyldAppDir, kHlpStrLen(kLdrDyldAppDir), &Args); if (rc != KLDR_ERR_MODULE_NOT_FOUND) break; } rc = kldrDyldFindTryOpenPath(".", 1, &Args); if (rc != KLDR_ERR_MODULE_NOT_FOUND) break; rc = kldrDyldFindEnumeratePath(kLdrDyldLibraryPath, &Args); break; } case KLDRDYLD_SEARCH_OS2: { rc = kldrDyldFindEnumeratePath(kLdrDyldOS2BeginLibpath, &Args); if (rc != KLDR_ERR_MODULE_NOT_FOUND) break; rc = kldrDyldFindEnumeratePath(kLdrDyldOS2Libpath, &Args); if (rc != KLDR_ERR_MODULE_NOT_FOUND) break; rc = kldrDyldFindEnumeratePath(kLdrDyldOS2EndLibpath, &Args); break; } case KLDRDYLD_SEARCH_WINDOWS: case KLDRDYLD_SEARCH_WINDOWS_ALTERED: { kldrDyldFindLazyInitAppDir(); rc = kldrDyldFindTryOpenPath(kLdrDyldWindowsAppDir, kHlpStrLen(kLdrDyldWindowsAppDir), &Args); if (rc != KLDR_ERR_MODULE_NOT_FOUND) break; if (Args.enmSearch == KLDRDYLD_SEARCH_WINDOWS_ALTERED) { rc = kldrDyldFindTryOpenPath(".", 1, &Args); if (rc != KLDR_ERR_MODULE_NOT_FOUND) break; } rc = kldrDyldFindTryOpenPath(kLdrDyldWindowsSystemDir, kHlpStrLen(kLdrDyldWindowsSystemDir), &Args); if (rc != KLDR_ERR_MODULE_NOT_FOUND) break; rc = kldrDyldFindTryOpenPath(kLdrDyldWindowsDir, kHlpStrLen(kLdrDyldWindowsDir), &Args); if (rc != KLDR_ERR_MODULE_NOT_FOUND) break; if (Args.enmSearch == KLDRDYLD_SEARCH_WINDOWS) { rc = kldrDyldFindTryOpenPath(".", 1, &Args); if (rc != KLDR_ERR_MODULE_NOT_FOUND) break; } rc = kldrDyldFindEnumeratePath(kLdrDyldWindowsPath, &Args); break; } case KLDRDYLD_SEARCH_UNIX_COMMON: { rc = kldrDyldFindEnumeratePath(kLdrDyldUnixLibraryPath, &Args); if (rc == KLDR_ERR_MODULE_NOT_FOUND) break; rc = kldrDyldFindEnumeratePath(kLdrDyldUnixSystemLibraryPath, &Args); break; } default: kHlpAssert(!"internal error"); return -1; } return rc; } /** * Searches for an EXE file using the specified method. * * @returns 0 on success and *ppMod pointing to the new module. * @returns KLDR_ERR_MODULE_NOT_FOUND if the specified file couldn't be opened. * @returns non-zero kLdr or OS specific status code on other failures. * @param pszName The name. * @param pszPrefix The prefix, optional. * @param pszSuffix The suffix, optional. * @param enmSearch The search method. * @param fFlags The load/search flags. * @param ppRdr Where to store the pointer to the file provider instance on success. */ static int kldrDyldFindDoExeSearch(const char *pszName, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKRDR ppRdr) { int rc; KLDRDYLDFINDARGS Args; /* * Initialize the argument structure and resolve defaults. */ Args.enmSearch = enmSearch; Args.pszPrefix = pszPrefix; Args.pszSuffix = pszSuffix; rc = kldrDyldFindGetDefaults(&Args.enmSearch, &Args.pszPrefix, &Args.pszSuffix, pszName, fFlags); if (rc) return rc; Args.pszName = pszName; Args.cchName = kHlpStrLen(pszName); Args.cchPrefix = Args.pszPrefix ? kHlpStrLen(Args.pszPrefix) : 0; Args.cchSuffix = Args.pszSuffix ? kHlpStrLen(Args.pszSuffix) : 0; Args.cchMaxLength = Args.cchName + Args.cchSuffix + Args.cchPrefix; Args.fFlags = fFlags; Args.ppRdr = ppRdr; /* * If we're bootstrapping a process, we'll start by looking in the * application directory and the check out the path. */ if (g_fBootstrapping) { kldrDyldFindLazyInitAppDir(); if (kLdrDyldAppDir[0] != '\0') { rc = kldrDyldFindTryOpenPath(kLdrDyldAppDir, kHlpStrLen(kLdrDyldAppDir), &Args); if (rc != KLDR_ERR_MODULE_NOT_FOUND) return rc; } } /* * Search the EXE search path. Initialize it the first time around. */ if (!kLdrDyldExePath[0]) { KSIZE cch; kHlpGetEnv("KLDR_EXE_PATH", kLdrDyldExePath, sizeof(kLdrDyldExePath) - 10); cch = kHlpStrLen(kLdrDyldExePath); kLdrDyldExePath[cch++] = ';'; kHlpGetEnv("PATH", &kLdrDyldExePath[cch], sizeof(kLdrDyldExePath) - cch); } return kldrDyldFindEnumeratePath(kLdrDyldExePath, &Args); } /** * Try open the specfied file. * * @returns 0 on success and *ppMod pointing to the new module. * @returns KLDR_ERR_MODULE_NOT_FOUND if the specified file couldn't be opened. * @returns non-zero kLdr or OS specific status code on other failures. * @param pszFilename The filename. * @param ppRdr Where to store the pointer to the new module. */ static int kldrDyldFindTryOpen(const char *pszFilename, PPKRDR ppRdr) { int rc; /* * Try open the file. */ rc = kRdrOpen(ppRdr, pszFilename); if (!rc) return 0; /** @todo deal with return codes properly. */ if (rc >= KERR_BASE && rc <= KERR_END) return rc; return KLDR_ERR_MODULE_NOT_FOUND; } /** * Composes a filename from the specified directory path, * prefix (optional), name and suffix (optional, will try with and without). * * @param pchPath The directory path - this doesn't have to be null terminated. * @param cchPath The length of the path. * @param pArgs The search argument structure. * * @returns See kldrDyldFindTryOpen */ static int kldrDyldFindTryOpenPath(const char *pchPath, KSIZE cchPath, PCKLDRDYLDFINDARGS pArgs) { static char s_szFilename[1024]; char *psz; int rc; /* * Ignore any attempts at opening empty paths. * This can happen when a *Dir globals is empty. */ if (!cchPath) return KLDR_ERR_MODULE_NOT_FOUND; /* ignore */ /* * Limit check first. */ if (cchPath + 1 + pArgs->cchMaxLength >= sizeof(s_szFilename)) { KLDRDYLDFIND_ASSERT(!"too long"); return KLDR_ERR_MODULE_NOT_FOUND; /* ignore */ } /* * The directory path. */ kHlpMemCopy(s_szFilename, pchPath, cchPath); psz = &s_szFilename[cchPath]; if (psz[-1] != '/' #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS && psz[-1] != '\\' && psz[-1] != ':' #endif ) *psz++ = '/'; /* * The name. */ if (pArgs->cchPrefix) { kHlpMemCopy(psz, pArgs->pszPrefix, pArgs->cchPrefix); psz += pArgs->cchPrefix; } kHlpMemCopy(psz, pArgs->pszName, pArgs->cchName); psz += pArgs->cchName; if (pArgs->cchSuffix) { kHlpMemCopy(psz, pArgs->pszSuffix, pArgs->cchSuffix); psz += pArgs->cchSuffix; } *psz = '\0'; /* * Try open it. */ rc = kldrDyldFindTryOpen(s_szFilename, pArgs->ppRdr); /* If we're opening an executable, try again without the suffix.*/ if ( rc && pArgs->cchSuffix && (pArgs->fFlags & KLDRDYLD_LOAD_FLAGS_EXECUTABLE)) { psz -= pArgs->cchSuffix; *psz = '\0'; rc = kldrDyldFindTryOpen(s_szFilename, pArgs->ppRdr); } return rc; } /** * Enumerates the specfied path. * * @returns Any return code from the kldrDyldFindTryOpenPath() which isn't KLDR_ERR_MODULE_NOT_FOUND. * @returns KLDR_ERR_MODULE_NOT_FOUND if the end of the search path was reached. * @param pszSearchPath The search path to enumeare. * @param pArgs The search argument structure. */ static int kldrDyldFindEnumeratePath(const char *pszSearchPath, PCKLDRDYLDFINDARGS pArgs) { const char *psz = pszSearchPath; for (;;) { const char *pszEnd; KSIZE cchPath; /* * Trim. */ while (*psz == ';' || *psz == ':') psz++; if (*psz == '\0') return KLDR_ERR_MODULE_NOT_FOUND; /* * Find the end. */ pszEnd = psz + 1; while ( *pszEnd != '\0' && *pszEnd != ';' #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS && ( *pszEnd != ':' || ( pszEnd - psz == 1 && ( (*psz >= 'A' && *psz <= 'Z') || (*psz >= 'a' && *psz <= 'z') ) ) ) #else && *pszEnd != ':' #endif ) pszEnd++; /* * If not empty path, try open the module using it. */ cchPath = pszEnd - psz; if (cchPath > 0) { int rc; rc = kldrDyldFindTryOpenPath(psz, cchPath, pArgs); if (rc != KLDR_ERR_MODULE_NOT_FOUND) return rc; } /* next */ psz = pszEnd; } } /** * Resolve default search method, prefix and suffix. * * @returns 0 on success, KERR_INVALID_PARAMETER on failure. * @param penmSearch The search method. In/Out. * @param ppszPrefix The prefix. In/Out. * @param ppszSuffix The suffix. In/Out. * @param pszName The name. In. * @param fFlags The load/search flags. */ static int kldrDyldFindGetDefaults(KLDRDYLDSEARCH *penmSearch, const char **ppszPrefix, const char **ppszSuffix, const char *pszName, KU32 fFlags) { unsigned fCaseSensitive; /* * Fixup search method alias. */ if (*penmSearch == KLDRDYLD_SEARCH_HOST) #if K_OS == K_OS_DARWIN /** @todo *penmSearch = KLDRDYLD_SEARCH_DARWIN; */ *penmSearch = KLDRDYLD_SEARCH_UNIX_COMMON; #elif K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS *penmSearch = KLDRDYLD_SEARCH_UNIX_COMMON; #elif K_OS == K_OS_OS2 *penmSearch = KLDRDYLD_SEARCH_OS2; #elif K_OS == K_OS_WINDOWS *penmSearch = KLDRDYLD_SEARCH_WINDOWS; #else # error "Port me" #endif /* * Apply search method specific prefix/suffix. */ switch (*penmSearch) { case KLDRDYLD_SEARCH_KLDR: if (!*ppszPrefix && kLdrDyldDefPrefix[0]) *ppszPrefix = kLdrDyldDefPrefix; if (!*ppszSuffix && kLdrDyldDefSuffix[0]) *ppszSuffix = kLdrDyldDefSuffix; fCaseSensitive = 1; break; case KLDRDYLD_SEARCH_OS2: if (!*ppszSuffix) *ppszSuffix = !(fFlags & KLDRDYLD_LOAD_FLAGS_EXECUTABLE) ? ".dll" : ".exe"; fCaseSensitive = 0; break; case KLDRDYLD_SEARCH_WINDOWS: case KLDRDYLD_SEARCH_WINDOWS_ALTERED: if (!*ppszSuffix) *ppszSuffix = !(fFlags & KLDRDYLD_LOAD_FLAGS_EXECUTABLE) ? ".dll" : ".exe"; fCaseSensitive = 0; break; case KLDRDYLD_SEARCH_UNIX_COMMON: fCaseSensitive = 1; break; default: KLDRDYLDFIND_ASSERT(!"invalid search method"); return KERR_INVALID_PARAMETER; } /* * Drop the suffix if it's already included in the name. */ if (*ppszSuffix) { const KSIZE cchName = kHlpStrLen(pszName); const KSIZE cchSuffix = kHlpStrLen(*ppszSuffix); if ( cchName > cchSuffix && ( fCaseSensitive ? !kHlpMemComp(pszName + cchName - cchSuffix, *ppszSuffix, cchSuffix) : !kHlpMemICompAscii(pszName + cchName - cchSuffix, *ppszSuffix, cchSuffix)) ) *ppszSuffix = NULL; } return 0; } /** * Locates an already open module using the specified search method. * * @returns 0 and *ppMod on success, non-zero OS specific error on failure. * * @param pszName Partial or complete name, it's specific to the search method to determin which. * @param pszPrefix Prefix than can be used when searching. * @param pszSuffix Suffix than can be used when searching. * @param enmSearch The file search method to apply. * @param fFlags Search flags. * @param ppMod Where to store the file provider instance on success. */ int kldrDyldFindExistingModule(const char *pszName, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod) { int rc; unsigned fOS2LibpathStrict; *ppMod = NULL; /* * Don't bother if no modules are loaded yet. */ if (!kLdrDyldHead) return KLDR_ERR_MODULE_NOT_FOUND; /* * Defaults. */ rc = kldrDyldFindGetDefaults(&enmSearch, &pszPrefix, &pszSuffix, pszName, fFlags); if (rc) return rc; /* * If this isn't just a filename, the caller has specified a file * that should be opened directly and not a module name to be searched for. * * In order to do the right thing we'll have to open the file and get the * correct filename for it. * * The OS/2 libpath strict method require us to find the correct DLL first. */ fOS2LibpathStrict = 0; if ( !kHlpIsFilenameOnly(pszName) || (fOS2LibpathStrict = ( enmSearch == KLDRDYLD_SEARCH_OS2 && kLdrDyldOS2LibpathStrict[0] == 'T') ) ) { PKRDR pRdr; if (fOS2LibpathStrict) rc = kldrDyldFindDoDllSearch(pszName, pszPrefix, pszSuffix, enmSearch, fFlags, &pRdr); else rc = kldrDyldFindTryOpen(pszName, &pRdr); if (!rc) { /* do a filename based search. */ const char *pszFilename = kRdrName(pRdr); const KSIZE cchFilename = kHlpStrLen(pszFilename); PKLDRDYLDMOD pCur; rc = KLDR_ERR_MODULE_NOT_FOUND; for (pCur = kLdrDyldHead; pCur; pCur = pCur->Load.pNext) { if ( pCur->pMod->cchFilename == cchFilename && !kHlpMemComp(pCur->pMod->pszFilename, pszFilename, cchFilename)) { *ppMod = pCur; rc = 0; break; } } kRdrClose(pRdr); } } else { const KSIZE cchName = kHlpStrLen(pszName); const KSIZE cchPrefix = pszPrefix ? kHlpStrLen(pszPrefix) : 0; const KSIZE cchSuffix = pszSuffix ? kHlpStrLen(pszSuffix) : 0; const char *pszNameSuffix = kHlpGetSuff(pszName); PKLDRDYLDMOD pCur = kLdrDyldHead; /* * Some of the methods are case insensitive (ASCII), others are case sensitive. * To avoid having todo indirect calls to the compare functions here, we split * ways even if it means a lot of duplicate code. */ if ( enmSearch == KLDRDYLD_SEARCH_OS2 || enmSearch == KLDRDYLD_SEARCH_WINDOWS || enmSearch == KLDRDYLD_SEARCH_WINDOWS_ALTERED) { const unsigned fNameHasSuffix = pszNameSuffix && kHlpStrLen(pszNameSuffix) == cchSuffix && !kHlpMemICompAscii(pszNameSuffix, pszName + cchName - cchSuffix, cchSuffix); for (; pCur; pCur = pCur->Load.pNext) { /* match global / specific */ if ( !pCur->fGlobalOrSpecific && !(fFlags & KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE)) continue; /* match name */ if ( pCur->pMod->cchName == cchName && !kHlpMemICompAscii(pCur->pMod->pszName, pszName, cchName)) break; if (cchPrefix) { if ( pCur->pMod->cchName == cchName + cchPrefix && !kHlpMemICompAscii(pCur->pMod->pszName, pszPrefix, cchPrefix) && !kHlpMemICompAscii(pCur->pMod->pszName + cchPrefix, pszName, cchName)) break; } if (cchSuffix) { if ( pCur->pMod->cchName == cchName + cchSuffix && !kHlpMemICompAscii(pCur->pMod->pszName + cchName, pszSuffix, cchSuffix) && !kHlpMemICompAscii(pCur->pMod->pszName, pszName, cchName)) break; if ( fNameHasSuffix && pCur->pMod->cchName == cchName - cchSuffix && !kHlpMemICompAscii(pCur->pMod->pszName, pszName, cchName - cchSuffix)) break; if (cchPrefix) { if ( pCur->pMod->cchName == cchName + cchPrefix + cchSuffix && !kHlpMemICompAscii(pCur->pMod->pszName, pszPrefix, cchPrefix) && !kHlpMemICompAscii(pCur->pMod->pszName + cchPrefix, pszName, cchName) && !kHlpMemICompAscii(pCur->pMod->pszName + cchPrefix + cchName, pszSuffix, cchSuffix)) break; if ( fNameHasSuffix && pCur->pMod->cchName == cchName + cchPrefix - cchSuffix && !kHlpMemICompAscii(pCur->pMod->pszName, pszPrefix, cchPrefix) && !kHlpMemICompAscii(pCur->pMod->pszName + cchPrefix, pszName, cchName - cchSuffix)) break; } } } } else { const unsigned fNameHasSuffix = pszNameSuffix && kHlpStrLen(pszNameSuffix) == cchSuffix && kHlpMemComp(pszNameSuffix, pszName + cchName - cchSuffix, cchSuffix); for (; pCur; pCur = pCur->Load.pNext) { /* match global / specific */ if ( !pCur->fGlobalOrSpecific && !(fFlags & KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE)) continue; /* match name */ if ( pCur->pMod->cchName == cchName && !kHlpMemComp(pCur->pMod->pszName, pszName, cchName)) break; if (cchPrefix) { if ( pCur->pMod->cchName == cchName + cchPrefix && !kHlpMemComp(pCur->pMod->pszName, pszPrefix, cchPrefix) && !kHlpMemComp(pCur->pMod->pszName + cchPrefix, pszName, cchName)) break; } if (cchSuffix) { if ( pCur->pMod->cchName == cchName + cchSuffix && !kHlpMemComp(pCur->pMod->pszName + cchName, pszSuffix, cchSuffix) && !kHlpMemComp(pCur->pMod->pszName, pszName, cchName)) break; if ( fNameHasSuffix && pCur->pMod->cchName == cchName - cchSuffix && !kHlpMemComp(pCur->pMod->pszName, pszName, cchName - cchSuffix)) break; if (cchPrefix) { if ( pCur->pMod->cchName == cchName + cchPrefix + cchSuffix && !kHlpMemComp(pCur->pMod->pszName, pszPrefix, cchPrefix) && !kHlpMemComp(pCur->pMod->pszName + cchPrefix, pszName, cchName) && !kHlpMemComp(pCur->pMod->pszName + cchPrefix + cchName, pszSuffix, cchSuffix)) break; if ( pCur->pMod->cchName == cchName + cchPrefix - cchSuffix && !kHlpMemComp(pCur->pMod->pszName, pszPrefix, cchPrefix) && !kHlpMemComp(pCur->pMod->pszName + cchPrefix, pszName, cchName - cchSuffix)) break; } } } } /* search result. */ if (pCur) { *ppMod = pCur; rc = 0; } else rc = KLDR_ERR_MODULE_NOT_FOUND; } return rc; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrModMachO.c������������������������������������������������������0000664�0001750�0001750�00000437231�14670377513�021040� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrModMachO.c 112 2018-07-04 09:37:39Z bird $ */ /** @file * kLdr - The Module Interpreter for the MACH-O format. */ /* * Copyright (c) 2006-2013 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include "kLdrInternal.h" #include <k/kLdrFmts/mach-o.h> /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def KLDRMODMACHO_STRICT * Define KLDRMODMACHO_STRICT to enabled strict checks in KLDRMODMACHO. */ #define KLDRMODMACHO_STRICT 1 /** @def KLDRMODMACHO_ASSERT * Assert that an expression is true when KLDR_STRICT is defined. */ #ifdef KLDRMODMACHO_STRICT # define KLDRMODMACHO_ASSERT(expr) kHlpAssert(expr) #else # define KLDRMODMACHO_ASSERT(expr) do {} while (0) #endif /** @def KLDRMODMACHO_CHECK_RETURN * Checks that an expression is true and return if it isn't. * This is a debug aid. */ #ifdef KLDRMODMACHO_STRICT2 # define KLDRMODMACHO_CHECK_RETURN(expr, rc) kHlpAssertReturn(expr, rc) #else # define KLDRMODMACHO_CHECK_RETURN(expr, rc) do { if (!(expr)) { return (rc); } } while (0) #endif /** @def KLDRMODMACHO_CHECK_RETURN * Checks that an expression is true and return if it isn't. * This is a debug aid. */ #ifdef KLDRMODMACHO_STRICT2 # define KLDRMODMACHO_FAILED_RETURN(rc) kHlpAssertFailedReturn(rc) #else # define KLDRMODMACHO_FAILED_RETURN(rc) return (rc) #endif /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Mach-O section details. */ typedef struct KLDRMODMACHOSECT { /** The size of the section (in bytes). */ KLDRSIZE cb; /** The link address of this section. */ KLDRADDR LinkAddress; /** The RVA of this section. */ KLDRADDR RVA; /** The file offset of this section. * This is -1 if the section doesn't have a file backing. */ KLDRFOFF offFile; /** The number of fixups. */ KU32 cFixups; /** The array of fixups. (lazy loaded) */ macho_relocation_info_t *paFixups; /** The file offset of the fixups for this section. * This is -1 if the section doesn't have any fixups. */ KLDRFOFF offFixups; /** Mach-O section flags. */ KU32 fFlags; /** kLdr segment index. */ KU32 iSegment; /** Pointer to the Mach-O section structure. */ void *pvMachoSection; } KLDRMODMACHOSECT, *PKLDRMODMACHOSECT; /** * Extra per-segment info. * * This is corresponds to a kLdr segment, not a Mach-O segment! */ typedef struct KLDRMODMACHOSEG { /** The orignal segment number (in case we had to resort it). */ KU32 iOrgSegNo; /** The number of sections in the segment. */ KU32 cSections; /** Pointer to the sections belonging to this segment. * The array resides in the big memory chunk allocated for * the module handle, so it doesn't need freeing. */ PKLDRMODMACHOSECT paSections; } KLDRMODMACHOSEG, *PKLDRMODMACHOSEG; /** * Instance data for the Mach-O MH_OBJECT module interpreter. * @todo interpret the other MH_* formats. */ typedef struct KLDRMODMACHO { /** Pointer to the module. (Follows the section table.) */ PKLDRMOD pMod; /** Pointer to the RDR file mapping of the raw file bits. NULL if not mapped. */ const void *pvBits; /** Pointer to the user mapping. */ void *pvMapping; /** The module open flags. */ KU32 fOpenFlags; /** The offset of the image. (FAT fun.) */ KLDRFOFF offImage; /** The link address. */ KLDRADDR LinkAddress; /** The size of the mapped image. */ KLDRADDR cbImage; /** Whether we're capable of loading the image. */ KBOOL fCanLoad; /** Whether we're creating a global offset table segment. * This dependes on the cputype and image type. */ KBOOL fMakeGot; /** The size of a indirect GOT jump stub entry. * This is 0 if not needed. */ KU8 cbJmpStub; /** Effective file type. If the original was a MH_OBJECT file, the * corresponding MH_DSYM needs the segment translation of a MH_OBJECT too. * The MH_DSYM normally has a separate __DWARF segment, but this is * automatically skipped during the transation. */ KU8 uEffFileType; /** Pointer to the load commands. (endian converted) */ KU8 *pbLoadCommands; /** The Mach-O header. (endian converted) * @remark The reserved field is only valid for real 64-bit headers. */ mach_header_64_t Hdr; /** The offset of the symbol table. */ KLDRFOFF offSymbols; /** The number of symbols. */ KU32 cSymbols; /** The pointer to the loaded symbol table. */ void *pvaSymbols; /** The offset of the string table. */ KLDRFOFF offStrings; /** The size of the of the string table. */ KU32 cchStrings; /** Pointer to the loaded string table. */ char *pchStrings; /** The image UUID, all zeros if not found. */ KU8 abImageUuid[16]; /** The RVA of the Global Offset Table. */ KLDRADDR GotRVA; /** The RVA of the indirect GOT jump stubs. */ KLDRADDR JmpStubsRVA; /** The number of sections. */ KU32 cSections; /** Pointer to the section array running in parallel to the Mach-O one. */ PKLDRMODMACHOSECT paSections; /** Array of segments parallel to the one in KLDRMOD. */ KLDRMODMACHOSEG aSegments[1]; } KLDRMODMACHO, *PKLDRMODMACHO; /******************************************************************************* * Internal Functions * *******************************************************************************/ #if 0 static KI32 kldrModMachONumberOfImports(PKLDRMOD pMod, const void *pvBits); #endif static int kldrModMachORelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); static int kldrModMachODoCreate(PKRDR pRdr, KLDRFOFF offImage, KU32 fOpenFlags, PKLDRMODMACHO *ppMod); static int kldrModMachOPreParseLoadCommands(KU8 *pbLoadCommands, const mach_header_32_t *pHdr, PKRDR pRdr, KLDRFOFF offImage, KU32 fOpenFlags, KU32 *pcSegments, KU32 *pcSections, KU32 *pcbStringPool, PKBOOL pfCanLoad, PKLDRADDR pLinkAddress, KU8 *puEffFileType); static int kldrModMachOParseLoadCommands(PKLDRMODMACHO pModMachO, char *pbStringPool, KU32 cbStringPool); static int kldrModMachOAdjustBaseAddress(PKLDRMODMACHO pModMachO, PKLDRADDR pBaseAddress); /*static int kldrModMachOLoadLoadCommands(PKLDRMODMACHO pModMachO);*/ static int kldrModMachOLoadObjSymTab(PKLDRMODMACHO pModMachO); static int kldrModMachOLoadFixups(PKLDRMODMACHO pModMachO, KLDRFOFF offFixups, KU32 cFixups, macho_relocation_info_t **ppaFixups); static int kldrModMachOMapVirginBits(PKLDRMODMACHO pModMachO); static int kldrModMachODoQuerySymbol32Bit(PKLDRMODMACHO pModMachO, const macho_nlist_32_t *paSyms, KU32 cSyms, const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KU32 cchSymbol, PKLDRADDR puValue, KU32 *pfKind); static int kldrModMachODoQuerySymbol64Bit(PKLDRMODMACHO pModMachO, const macho_nlist_64_t *paSyms, KU32 cSyms, const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KU32 cchSymbol, PKLDRADDR puValue, KU32 *pfKind); static int kldrModMachODoEnumSymbols32Bit(PKLDRMODMACHO pModMachO, const macho_nlist_32_t *paSyms, KU32 cSyms, const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser); static int kldrModMachODoEnumSymbols64Bit(PKLDRMODMACHO pModMachO, const macho_nlist_64_t *paSyms, KU32 cSyms, const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser); static int kldrModMachOObjDoImports(PKLDRMODMACHO pModMachO, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); static int kldrModMachOObjDoFixups(PKLDRMODMACHO pModMachO, void *pvMapping, KLDRADDR NewBaseAddress); static int kldrModMachOFixupSectionGeneric32Bit(PKLDRMODMACHO pModMachO, KU8 *pbSectBits, PKLDRMODMACHOSECT pFixupSect, macho_nlist_32_t *paSyms, KU32 cSyms, KLDRADDR NewBaseAddress); static int kldrModMachOFixupSectionAMD64(PKLDRMODMACHO pModMachO, KU8 *pbSectBits, PKLDRMODMACHOSECT pFixupSect, macho_nlist_64_t *paSyms, KU32 cSyms, KLDRADDR NewBaseAddress); static int kldrModMachOMakeGOT(PKLDRMODMACHO pModMachO, void *pvBits, KLDRADDR NewBaseAddress); /*static int kldrModMachODoFixups(PKLDRMODMACHO pModMachO, void *pvMapping, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress); static int kldrModMachODoImports(PKLDRMODMACHO pModMachO, void *pvMapping, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser);*/ /** * Create a loader module instance interpreting the executable image found * in the specified file provider instance. * * @returns 0 on success and *ppMod pointing to a module instance. * On failure, a non-zero OS specific error code is returned. * @param pOps Pointer to the registered method table. * @param pRdr The file provider instance to use. * @param fFlags Flags, MBZ. * @param enmCpuArch The desired CPU architecture. KCPUARCH_UNKNOWN means * anything goes, but with a preference for the current * host architecture. * @param offNewHdr The offset of the new header in MZ files. -1 if not found. * @param ppMod Where to store the module instance pointer. */ static int kldrModMachOCreate(PCKLDRMODOPS pOps, PKRDR pRdr, KU32 fFlags, KCPUARCH enmCpuArch, KLDRFOFF offNewHdr, PPKLDRMOD ppMod) { PKLDRMODMACHO pModMachO; int rc; /* * Create the instance data and do a minimal header validation. */ rc = kldrModMachODoCreate(pRdr, offNewHdr == -1 ? 0 : offNewHdr, fFlags, &pModMachO); if (!rc) { /* * Match up against the requested CPU architecture. */ if ( enmCpuArch == KCPUARCH_UNKNOWN || pModMachO->pMod->enmArch == enmCpuArch) { pModMachO->pMod->pOps = pOps; pModMachO->pMod->u32Magic = KLDRMOD_MAGIC; *ppMod = pModMachO->pMod; return 0; } rc = KLDR_ERR_CPU_ARCH_MISMATCH; } if (pModMachO) { kHlpFree(pModMachO->pbLoadCommands); kHlpFree(pModMachO); } return rc; } /** * Separate function for reading creating the Mach-O module instance to * simplify cleanup on failure. */ static int kldrModMachODoCreate(PKRDR pRdr, KLDRFOFF offImage, KU32 fOpenFlags, PKLDRMODMACHO *ppModMachO) { union { mach_header_32_t Hdr32; mach_header_64_t Hdr64; } s; PKLDRMODMACHO pModMachO; PKLDRMOD pMod; KU8 *pbLoadCommands; KU32 cSegments = 0; /* (MSC maybe used uninitialized) */ KU32 cSections = 0; /* (MSC maybe used uninitialized) */ KU32 cbStringPool = 0; /* (MSC maybe used uninitialized) */ KSIZE cchFilename; KSIZE cb; KBOOL fMakeGot; KBOOL fCanLoad = K_TRUE; KLDRADDR LinkAddress = NIL_KLDRADDR; /* (MSC maybe used uninitialized) */ KU8 cbJmpStub; KU8 uEffFileType = 0; /* (MSC maybe used uninitialized) */ int rc; *ppModMachO = NULL; kHlpAssert(&s.Hdr32.magic == &s.Hdr64.magic); kHlpAssert(&s.Hdr32.flags == &s.Hdr64.flags); /* * Read the Mach-O header. */ rc = kRdrRead(pRdr, &s, sizeof(s), offImage); if (rc) return rc; if ( s.Hdr32.magic != IMAGE_MACHO32_SIGNATURE && s.Hdr32.magic != IMAGE_MACHO64_SIGNATURE ) { if ( s.Hdr32.magic == IMAGE_MACHO32_SIGNATURE_OE || s.Hdr32.magic == IMAGE_MACHO64_SIGNATURE_OE) return KLDR_ERR_MACHO_OTHER_ENDIAN_NOT_SUPPORTED; return KLDR_ERR_UNKNOWN_FORMAT; } /* sanity checks. */ if ( s.Hdr32.sizeofcmds > kRdrSize(pRdr) - sizeof(mach_header_32_t) || s.Hdr32.sizeofcmds < sizeof(load_command_t) * s.Hdr32.ncmds || (s.Hdr32.flags & ~MH_VALID_FLAGS)) return KLDR_ERR_MACHO_BAD_HEADER; switch (s.Hdr32.cputype) { case CPU_TYPE_X86: fMakeGot = K_FALSE; cbJmpStub = 0; break; case CPU_TYPE_X86_64: fMakeGot = s.Hdr32.filetype == MH_OBJECT; cbJmpStub = fMakeGot ? 8 : 0; break; default: return KLDR_ERR_MACHO_UNSUPPORTED_MACHINE; } if ( s.Hdr32.filetype != MH_OBJECT && s.Hdr32.filetype != MH_EXECUTE && s.Hdr32.filetype != MH_DYLIB && s.Hdr32.filetype != MH_BUNDLE && s.Hdr32.filetype != MH_DSYM && s.Hdr32.filetype != MH_KEXT_BUNDLE) return KLDR_ERR_MACHO_UNSUPPORTED_FILE_TYPE; /* * Read and pre-parse the load commands to figure out how many segments we'll be needing. */ pbLoadCommands = kHlpAlloc(s.Hdr32.sizeofcmds); if (!pbLoadCommands) return KERR_NO_MEMORY; rc = kRdrRead(pRdr, pbLoadCommands, s.Hdr32.sizeofcmds, s.Hdr32.magic == IMAGE_MACHO32_SIGNATURE || s.Hdr32.magic == IMAGE_MACHO32_SIGNATURE_OE ? sizeof(mach_header_32_t) + offImage : sizeof(mach_header_64_t) + offImage); if (!rc) rc = kldrModMachOPreParseLoadCommands(pbLoadCommands, &s.Hdr32, pRdr, offImage, fOpenFlags, &cSegments, &cSections, &cbStringPool, &fCanLoad, &LinkAddress, &uEffFileType); if (rc) { kHlpFree(pbLoadCommands); return rc; } cSegments += fMakeGot; /* * Calc the instance size, allocate and initialize it. */ cchFilename = kHlpStrLen(kRdrName(pRdr)); cb = K_ALIGN_Z( K_OFFSETOF(KLDRMODMACHO, aSegments[cSegments]) + sizeof(KLDRMODMACHOSECT) * cSections, 16) + K_OFFSETOF(KLDRMOD, aSegments[cSegments]) + cchFilename + 1 + cbStringPool; pModMachO = (PKLDRMODMACHO)kHlpAlloc(cb); if (!pModMachO) return KERR_NO_MEMORY; *ppModMachO = pModMachO; pModMachO->pbLoadCommands = pbLoadCommands; pModMachO->offImage = offImage; /* KLDRMOD */ pMod = (PKLDRMOD)((KU8 *)pModMachO + K_ALIGN_Z( K_OFFSETOF(KLDRMODMACHO, aSegments[cSegments]) + sizeof(KLDRMODMACHOSECT) * cSections, 16)); pMod->pvData = pModMachO; pMod->pRdr = pRdr; pMod->pOps = NULL; /* set upon success. */ pMod->cSegments = cSegments; pMod->cchFilename = (KU32)cchFilename; pMod->pszFilename = (char *)&pMod->aSegments[pMod->cSegments]; kHlpMemCopy((char *)pMod->pszFilename, kRdrName(pRdr), cchFilename + 1); pMod->pszName = kHlpGetFilename(pMod->pszFilename); pMod->cchName = (KU32)(cchFilename - (pMod->pszName - pMod->pszFilename)); pMod->fFlags = 0; switch (s.Hdr32.cputype) { case CPU_TYPE_X86: pMod->enmArch = KCPUARCH_X86_32; pMod->enmEndian = KLDRENDIAN_LITTLE; switch (s.Hdr32.cpusubtype) { case CPU_SUBTYPE_I386_ALL: /* == CPU_SUBTYPE_386 */ pMod->enmCpu = KCPU_X86_32_BLEND; break; case CPU_SUBTYPE_486: pMod->enmCpu = KCPU_I486; break; case CPU_SUBTYPE_486SX: pMod->enmCpu = KCPU_I486SX; break; case CPU_SUBTYPE_PENT: /* == CPU_SUBTYPE_586 */ pMod->enmCpu = KCPU_I586; break; case CPU_SUBTYPE_PENTPRO: case CPU_SUBTYPE_PENTII_M3: case CPU_SUBTYPE_PENTII_M5: case CPU_SUBTYPE_CELERON: case CPU_SUBTYPE_CELERON_MOBILE: case CPU_SUBTYPE_PENTIUM_3: case CPU_SUBTYPE_PENTIUM_3_M: case CPU_SUBTYPE_PENTIUM_3_XEON: pMod->enmCpu = KCPU_I686; break; case CPU_SUBTYPE_PENTIUM_M: case CPU_SUBTYPE_PENTIUM_4: case CPU_SUBTYPE_PENTIUM_4_M: case CPU_SUBTYPE_XEON: case CPU_SUBTYPE_XEON_MP: pMod->enmCpu = KCPU_P4; break; default: /* Hack for kextutil output. */ if ( s.Hdr32.cpusubtype == 0 && s.Hdr32.filetype == MH_OBJECT) break; return KLDR_ERR_MACHO_UNSUPPORTED_MACHINE; } break; case CPU_TYPE_X86_64: pMod->enmArch = KCPUARCH_AMD64; pMod->enmEndian = KLDRENDIAN_LITTLE; switch (s.Hdr32.cpusubtype & ~CPU_SUBTYPE_MASK) { case CPU_SUBTYPE_X86_64_ALL: pMod->enmCpu = KCPU_AMD64_BLEND; break; default: return KLDR_ERR_MACHO_UNSUPPORTED_MACHINE; } break; default: return KLDR_ERR_MACHO_UNSUPPORTED_MACHINE; } pMod->enmFmt = KLDRFMT_MACHO; switch (s.Hdr32.filetype) { case MH_OBJECT: pMod->enmType = KLDRTYPE_OBJECT; break; case MH_EXECUTE: pMod->enmType = KLDRTYPE_EXECUTABLE_FIXED; break; case MH_DYLIB: pMod->enmType = KLDRTYPE_SHARED_LIBRARY_RELOCATABLE; break; case MH_BUNDLE: pMod->enmType = KLDRTYPE_SHARED_LIBRARY_RELOCATABLE; break; case MH_KEXT_BUNDLE:pMod->enmType = KLDRTYPE_SHARED_LIBRARY_RELOCATABLE; break; case MH_DSYM: pMod->enmType = KLDRTYPE_DEBUG_INFO; break; default: return KLDR_ERR_MACHO_UNSUPPORTED_FILE_TYPE; } pMod->u32Magic = 0; /* set upon success. */ /* KLDRMODMACHO */ pModMachO->pMod = pMod; pModMachO->pvBits = NULL; pModMachO->pvMapping = NULL; pModMachO->fOpenFlags = fOpenFlags; pModMachO->Hdr = s.Hdr64; if ( s.Hdr32.magic == IMAGE_MACHO32_SIGNATURE || s.Hdr32.magic == IMAGE_MACHO32_SIGNATURE_OE) pModMachO->Hdr.reserved = 0; pModMachO->LinkAddress = LinkAddress; pModMachO->cbImage = 0; pModMachO->fCanLoad = fCanLoad; pModMachO->fMakeGot = fMakeGot; pModMachO->cbJmpStub = cbJmpStub; pModMachO->uEffFileType = uEffFileType; pModMachO->offSymbols = 0; pModMachO->cSymbols = 0; pModMachO->pvaSymbols = NULL; pModMachO->offStrings = 0; pModMachO->cchStrings = 0; pModMachO->pchStrings = NULL; kHlpMemSet(pModMachO->abImageUuid, 0, sizeof(pModMachO->abImageUuid)); pModMachO->GotRVA = NIL_KLDRADDR; pModMachO->JmpStubsRVA = NIL_KLDRADDR; pModMachO->cSections = cSections; pModMachO->paSections = (PKLDRMODMACHOSECT)&pModMachO->aSegments[pModMachO->pMod->cSegments]; /* * Setup the KLDRMOD segment array. */ rc = kldrModMachOParseLoadCommands(pModMachO, (char *)pMod->pszFilename + pMod->cchFilename + 1, cbStringPool); if (rc) return rc; /* * We're done. */ return 0; } /** * Converts, validates and preparses the load commands before we carve * out the module instance. * * The conversion that's preformed is format endian to host endian. The * preparsing has to do with segment counting, section counting and string pool * sizing. * * Segment are created in two different ways, depending on the file type. * * For object files there is only one segment command without a given segment * name. The sections inside that segment have different segment names and are * not sorted by their segname attribute. We create one segment for each * section, with the segment name being 'segname.sectname' in order to hopefully * keep the names unique. Debug sections does not get segments. * * For non-object files, one kLdr segment is created for each Mach-O segment. * Debug segments is not exposed by kLdr via the kLdr segment table, but via the * debug enumeration callback API. * * @returns 0 on success. * @returns KLDR_ERR_MACHO_* on failure. * @param pbLoadCommands The load commands to parse. * @param pHdr The header. * @param pRdr The file reader. * @param offImage The image header (FAT fun). * @param pcSegments Where to store the segment count. * @param pcSegments Where to store the section count. * @param pcbStringPool Where to store the string pool size. * @param pfCanLoad Where to store the can-load-image indicator. * @param pLinkAddress Where to store the image link address (i.e. the * lowest segment address). */ static int kldrModMachOPreParseLoadCommands(KU8 *pbLoadCommands, const mach_header_32_t *pHdr, PKRDR pRdr, KLDRFOFF offImage, KU32 fOpenFlags, KU32 *pcSegments, KU32 *pcSections, KU32 *pcbStringPool, PKBOOL pfCanLoad, PKLDRADDR pLinkAddress, KU8 *puEffFileType) { union { KU8 *pb; load_command_t *pLoadCmd; segment_command_32_t *pSeg32; segment_command_64_t *pSeg64; thread_command_t *pThread; symtab_command_t *pSymTab; uuid_command_t *pUuid; } u; const KU64 cbFile = kRdrSize(pRdr) - offImage; KU32 cSegments = 0; KU32 cSections = 0; KSIZE cbStringPool = 0; KU32 cLeft = pHdr->ncmds; KU32 cbLeft = pHdr->sizeofcmds; KU8 *pb = pbLoadCommands; int cSegmentCommands = 0; int cSymbolTabs = 0; int fConvertEndian = pHdr->magic == IMAGE_MACHO32_SIGNATURE_OE || pHdr->magic == IMAGE_MACHO64_SIGNATURE_OE; KU8 uEffFileType = *puEffFileType = pHdr->filetype; *pcSegments = 0; *pcSections = 0; *pcbStringPool = 0; *pfCanLoad = K_TRUE; *pLinkAddress = ~(KLDRADDR)0; while (cLeft-- > 0) { u.pb = pb; /* * Convert and validate command header. */ KLDRMODMACHO_CHECK_RETURN(cbLeft >= sizeof(load_command_t), KLDR_ERR_MACHO_BAD_LOAD_COMMAND); if (fConvertEndian) { u.pLoadCmd->cmd = K_E2E_U32(u.pLoadCmd->cmd); u.pLoadCmd->cmdsize = K_E2E_U32(u.pLoadCmd->cmdsize); } KLDRMODMACHO_CHECK_RETURN(u.pLoadCmd->cmdsize <= cbLeft, KLDR_ERR_MACHO_BAD_LOAD_COMMAND); cbLeft -= u.pLoadCmd->cmdsize; pb += u.pLoadCmd->cmdsize; /* * Convert endian if needed, parse and validate the command. */ switch (u.pLoadCmd->cmd) { case LC_SEGMENT_32: { segment_command_32_t *pSrcSeg = (segment_command_32_t *)u.pLoadCmd; section_32_t *pFirstSect = (section_32_t *)(pSrcSeg + 1); section_32_t *pSect = pFirstSect; KU32 cSectionsLeft = pSrcSeg->nsects; KU64 offSect = 0; /* Convert and verify the segment. */ KLDRMODMACHO_CHECK_RETURN(u.pLoadCmd->cmdsize >= sizeof(segment_command_32_t), KLDR_ERR_MACHO_BAD_LOAD_COMMAND); KLDRMODMACHO_CHECK_RETURN( pHdr->magic == IMAGE_MACHO32_SIGNATURE_OE || pHdr->magic == IMAGE_MACHO32_SIGNATURE, KLDR_ERR_MACHO_BIT_MIX); if (fConvertEndian) { pSrcSeg->vmaddr = K_E2E_U32(pSrcSeg->vmaddr); pSrcSeg->vmsize = K_E2E_U32(pSrcSeg->vmsize); pSrcSeg->fileoff = K_E2E_U32(pSrcSeg->fileoff); pSrcSeg->filesize = K_E2E_U32(pSrcSeg->filesize); pSrcSeg->maxprot = K_E2E_U32(pSrcSeg->maxprot); pSrcSeg->initprot = K_E2E_U32(pSrcSeg->initprot); pSrcSeg->nsects = K_E2E_U32(pSrcSeg->nsects); pSrcSeg->flags = K_E2E_U32(pSrcSeg->flags); } /* Validation code shared with the 64-bit variant. */ #define VALIDATE_AND_ADD_SEGMENT(a_cBits) \ do { \ KBOOL fSkipSeg = !kHlpStrComp(pSrcSeg->segname, "__DWARF") /* Note: Not for non-object files. */ \ || ( !kHlpStrComp(pSrcSeg->segname, "__CTF") /* Their CTF tool did/does weird things, */ \ && pSrcSeg->vmsize == 0) /* overlapping vmaddr and zero vmsize. */ \ || (cSectionsLeft > 0 && (pFirstSect->flags & S_ATTR_DEBUG)); \ \ /* MH_DSYM files for MH_OBJECT files must have MH_OBJECT segment translation. */ \ if ( uEffFileType == MH_DSYM \ && cSegmentCommands == 0 \ && pSrcSeg->segname[0] == '\0') \ *puEffFileType = uEffFileType = MH_OBJECT; \ \ KLDRMODMACHO_CHECK_RETURN( pSrcSeg->filesize == 0 \ || ( pSrcSeg->fileoff <= cbFile \ && (KU64)pSrcSeg->fileoff + pSrcSeg->filesize <= cbFile), \ KLDR_ERR_MACHO_BAD_LOAD_COMMAND); \ KLDRMODMACHO_CHECK_RETURN( pSrcSeg->filesize <= pSrcSeg->vmsize \ || (fSkipSeg && !kHlpStrComp(pSrcSeg->segname, "__CTF") /* see above */), \ KLDR_ERR_MACHO_BAD_LOAD_COMMAND); \ KLDRMODMACHO_CHECK_RETURN(!(~pSrcSeg->maxprot & pSrcSeg->initprot), \ KLDR_ERR_MACHO_BAD_LOAD_COMMAND); \ KLDRMODMACHO_CHECK_RETURN(!(pSrcSeg->flags & ~(SG_HIGHVM | SG_FVMLIB | SG_NORELOC | SG_PROTECTED_VERSION_1)), \ KLDR_ERR_MACHO_BAD_LOAD_COMMAND); \ KLDRMODMACHO_CHECK_RETURN( pSrcSeg->nsects * sizeof(section_##a_cBits##_t) \ <= u.pLoadCmd->cmdsize - sizeof(segment_command_##a_cBits##_t), \ KLDR_ERR_MACHO_BAD_LOAD_COMMAND); \ KLDRMODMACHO_CHECK_RETURN( uEffFileType != MH_OBJECT \ || cSegmentCommands == 0 \ || ( cSegmentCommands == 1 \ && uEffFileType == MH_OBJECT \ && pHdr->filetype == MH_DSYM \ && fSkipSeg), \ KLDR_ERR_MACHO_BAD_OBJECT_FILE); \ cSegmentCommands++; \ \ /* Add the segment, if not object file. */ \ if (!fSkipSeg && uEffFileType != MH_OBJECT) \ { \ cbStringPool += kHlpStrNLen(&pSrcSeg->segname[0], sizeof(pSrcSeg->segname)) + 1; \ cSegments++; \ if (cSegments == 1) /* The link address is set by the first segment. */ \ *pLinkAddress = pSrcSeg->vmaddr; \ } \ } while (0) VALIDATE_AND_ADD_SEGMENT(32); /* * Convert, validate and parse the sections. */ cSectionsLeft = pSrcSeg->nsects; pFirstSect = pSect = (section_32_t *)(pSrcSeg + 1); while (cSectionsLeft-- > 0) { if (fConvertEndian) { pSect->addr = K_E2E_U32(pSect->addr); pSect->size = K_E2E_U32(pSect->size); pSect->offset = K_E2E_U32(pSect->offset); pSect->align = K_E2E_U32(pSect->align); pSect->reloff = K_E2E_U32(pSect->reloff); pSect->nreloc = K_E2E_U32(pSect->nreloc); pSect->flags = K_E2E_U32(pSect->flags); pSect->reserved1 = K_E2E_U32(pSect->reserved1); pSect->reserved2 = K_E2E_U32(pSect->reserved2); } /* Validation code shared with the 64-bit variant. */ #define VALIDATE_AND_ADD_SECTION(a_cBits) \ do { \ int fFileBits; \ \ /* validate */ \ if (uEffFileType != MH_OBJECT) \ KLDRMODMACHO_CHECK_RETURN(!kHlpStrComp(pSect->segname, pSrcSeg->segname),\ KLDR_ERR_MACHO_BAD_SECTION); \ \ switch (pSect->flags & SECTION_TYPE) \ { \ case S_ZEROFILL: \ KLDRMODMACHO_CHECK_RETURN(!pSect->reserved1, KLDR_ERR_MACHO_BAD_SECTION); \ KLDRMODMACHO_CHECK_RETURN(!pSect->reserved2, KLDR_ERR_MACHO_BAD_SECTION); \ fFileBits = 0; \ break; \ case S_REGULAR: \ case S_CSTRING_LITERALS: \ case S_COALESCED: \ case S_4BYTE_LITERALS: \ case S_8BYTE_LITERALS: \ case S_16BYTE_LITERALS: \ KLDRMODMACHO_CHECK_RETURN(!pSect->reserved1, KLDR_ERR_MACHO_BAD_SECTION); \ KLDRMODMACHO_CHECK_RETURN(!pSect->reserved2, KLDR_ERR_MACHO_BAD_SECTION); \ fFileBits = 1; \ break; \ \ case S_SYMBOL_STUBS: \ KLDRMODMACHO_CHECK_RETURN(!pSect->reserved1, KLDR_ERR_MACHO_BAD_SECTION); \ /* reserved2 == stub size. 0 has been seen (corecrypto.kext) */ \ KLDRMODMACHO_CHECK_RETURN(pSect->reserved2 < 64, KLDR_ERR_MACHO_BAD_SECTION); \ fFileBits = 1; \ break; \ \ case S_NON_LAZY_SYMBOL_POINTERS: \ case S_LAZY_SYMBOL_POINTERS: \ case S_LAZY_DYLIB_SYMBOL_POINTERS: \ /* (reserved 1 = is indirect symbol table index) */ \ KLDRMODMACHO_CHECK_RETURN(!pSect->reserved2, KLDR_ERR_MACHO_BAD_SECTION); \ *pfCanLoad = K_FALSE; \ fFileBits = -1; /* __DATA.__got in the 64-bit mach_kernel has bits, any things without bits? */ \ break; \ \ case S_MOD_INIT_FUNC_POINTERS: \ /** @todo this requires a query API or flag... (e.g. C++ constructors) */ \ KLDRMODMACHO_CHECK_RETURN(fOpenFlags & KLDRMOD_OPEN_FLAGS_FOR_INFO, \ KLDR_ERR_MACHO_UNSUPPORTED_INIT_SECTION); \ /* Falls through. */ \ case S_MOD_TERM_FUNC_POINTERS: \ /** @todo this requires a query API or flag... (e.g. C++ destructors) */ \ KLDRMODMACHO_CHECK_RETURN(fOpenFlags & KLDRMOD_OPEN_FLAGS_FOR_INFO, \ KLDR_ERR_MACHO_UNSUPPORTED_TERM_SECTION); \ KLDRMODMACHO_CHECK_RETURN(!pSect->reserved1, KLDR_ERR_MACHO_BAD_SECTION); \ KLDRMODMACHO_CHECK_RETURN(!pSect->reserved2, KLDR_ERR_MACHO_BAD_SECTION); \ fFileBits = 1; \ break; /* ignored */ \ \ case S_LITERAL_POINTERS: \ case S_DTRACE_DOF: \ KLDRMODMACHO_CHECK_RETURN(!pSect->reserved1, KLDR_ERR_MACHO_BAD_SECTION); \ KLDRMODMACHO_CHECK_RETURN(!pSect->reserved2, KLDR_ERR_MACHO_BAD_SECTION); \ fFileBits = 1; \ break; \ \ case S_INTERPOSING: \ case S_GB_ZEROFILL: \ KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_UNSUPPORTED_SECTION); \ \ default: \ KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_UNKNOWN_SECTION); \ } \ KLDRMODMACHO_CHECK_RETURN(!(pSect->flags & ~( S_ATTR_PURE_INSTRUCTIONS | S_ATTR_NO_TOC | S_ATTR_STRIP_STATIC_SYMS \ | S_ATTR_NO_DEAD_STRIP | S_ATTR_LIVE_SUPPORT | S_ATTR_SELF_MODIFYING_CODE \ | S_ATTR_DEBUG | S_ATTR_SOME_INSTRUCTIONS | S_ATTR_EXT_RELOC \ | S_ATTR_LOC_RELOC | SECTION_TYPE)), \ KLDR_ERR_MACHO_BAD_SECTION); \ KLDRMODMACHO_CHECK_RETURN((pSect->flags & S_ATTR_DEBUG) == (pFirstSect->flags & S_ATTR_DEBUG), \ KLDR_ERR_MACHO_MIXED_DEBUG_SECTION_FLAGS); \ \ KLDRMODMACHO_CHECK_RETURN(pSect->addr - pSrcSeg->vmaddr <= pSrcSeg->vmsize, \ KLDR_ERR_MACHO_BAD_SECTION); \ KLDRMODMACHO_CHECK_RETURN( pSect->addr - pSrcSeg->vmaddr + pSect->size <= pSrcSeg->vmsize \ || !kHlpStrComp(pSrcSeg->segname, "__CTF") /* see above */, \ KLDR_ERR_MACHO_BAD_SECTION); \ KLDRMODMACHO_CHECK_RETURN(pSect->align < 31, \ KLDR_ERR_MACHO_BAD_SECTION); \ /* Workaround for buggy ld64 (or as, llvm, ++) that produces a misaligned __TEXT.__unwind_info. */ \ /* Seen: pSect->align = 4, pSect->addr = 0x5ebe14. Just adjust the alignment down. */ \ if ( ((K_BIT32(pSect->align) - KU32_C(1)) & pSect->addr) \ && pSect->align == 4 \ && kHlpStrComp(pSect->sectname, "__unwind_info") == 0) \ pSect->align = 2; \ KLDRMODMACHO_CHECK_RETURN(!((K_BIT32(pSect->align) - KU32_C(1)) & pSect->addr), \ KLDR_ERR_MACHO_BAD_SECTION); \ KLDRMODMACHO_CHECK_RETURN(!((K_BIT32(pSect->align) - KU32_C(1)) & pSrcSeg->vmaddr), \ KLDR_ERR_MACHO_BAD_SECTION); \ \ /* Adjust the section offset before we check file offset. */ \ offSect = (offSect + K_BIT64(pSect->align) - KU64_C(1)) & ~(K_BIT64(pSect->align) - KU64_C(1)); \ if (pSect->addr) \ { \ KLDRMODMACHO_CHECK_RETURN(offSect <= pSect->addr - pSrcSeg->vmaddr, KLDR_ERR_MACHO_BAD_SECTION); \ if (offSect < pSect->addr - pSrcSeg->vmaddr) \ offSect = pSect->addr - pSrcSeg->vmaddr; \ } \ \ if (fFileBits && pSect->offset == 0 && pSrcSeg->fileoff == 0 && pHdr->filetype == MH_DSYM) \ fFileBits = 0; \ if (fFileBits) \ { \ if (uEffFileType != MH_OBJECT) \ { \ KLDRMODMACHO_CHECK_RETURN(pSect->offset == pSrcSeg->fileoff + offSect, \ KLDR_ERR_MACHO_NON_CONT_SEG_BITS); \ KLDRMODMACHO_CHECK_RETURN(pSect->offset - pSrcSeg->fileoff <= pSrcSeg->filesize, \ KLDR_ERR_MACHO_BAD_SECTION); \ } \ KLDRMODMACHO_CHECK_RETURN(pSect->offset <= cbFile, \ KLDR_ERR_MACHO_BAD_SECTION); \ KLDRMODMACHO_CHECK_RETURN((KU64)pSect->offset + pSect->size <= cbFile, \ KLDR_ERR_MACHO_BAD_SECTION); \ } \ else \ KLDRMODMACHO_CHECK_RETURN(pSect->offset == 0, KLDR_ERR_MACHO_BAD_SECTION); \ \ if (!pSect->nreloc) \ KLDRMODMACHO_CHECK_RETURN(!pSect->reloff, \ KLDR_ERR_MACHO_BAD_SECTION); \ else \ { \ KLDRMODMACHO_CHECK_RETURN(pSect->reloff <= cbFile, \ KLDR_ERR_MACHO_BAD_SECTION); \ KLDRMODMACHO_CHECK_RETURN( (KU64)pSect->reloff \ + (KLDRFOFF)pSect->nreloc * sizeof(macho_relocation_info_t) \ <= cbFile, \ KLDR_ERR_MACHO_BAD_SECTION); \ } \ \ /* Validate against file type (pointless?) and count the section, for object files add segment. */ \ switch (uEffFileType) \ { \ case MH_OBJECT: \ if ( !(pSect->flags & S_ATTR_DEBUG) \ && kHlpStrComp(pSect->segname, "__DWARF")) \ { \ cbStringPool += kHlpStrNLen(&pSect->segname[0], sizeof(pSect->segname)) + 1; \ cbStringPool += kHlpStrNLen(&pSect->sectname[0], sizeof(pSect->sectname)) + 1; \ cSegments++; \ if (cSegments == 1) /* The link address is set by the first segment. */ \ *pLinkAddress = pSect->addr; \ } \ /* Falls through. */ \ case MH_EXECUTE: \ case MH_DYLIB: \ case MH_BUNDLE: \ case MH_DSYM: \ case MH_KEXT_BUNDLE: \ cSections++; \ break; \ default: \ KLDRMODMACHO_FAILED_RETURN(KERR_INVALID_PARAMETER); \ } \ \ /* Advance the section offset, since we're also aligning it. */ \ offSect += pSect->size; \ } while (0) /* VALIDATE_AND_ADD_SECTION */ VALIDATE_AND_ADD_SECTION(32); /* next */ pSect++; } break; } case LC_SEGMENT_64: { segment_command_64_t *pSrcSeg = (segment_command_64_t *)u.pLoadCmd; section_64_t *pFirstSect = (section_64_t *)(pSrcSeg + 1); section_64_t *pSect = pFirstSect; KU32 cSectionsLeft = pSrcSeg->nsects; KU64 offSect = 0; /* Convert and verify the segment. */ KLDRMODMACHO_CHECK_RETURN(u.pLoadCmd->cmdsize >= sizeof(segment_command_64_t), KLDR_ERR_MACHO_BAD_LOAD_COMMAND); KLDRMODMACHO_CHECK_RETURN( pHdr->magic == IMAGE_MACHO64_SIGNATURE_OE || pHdr->magic == IMAGE_MACHO64_SIGNATURE, KLDR_ERR_MACHO_BIT_MIX); if (fConvertEndian) { pSrcSeg->vmaddr = K_E2E_U64(pSrcSeg->vmaddr); pSrcSeg->vmsize = K_E2E_U64(pSrcSeg->vmsize); pSrcSeg->fileoff = K_E2E_U64(pSrcSeg->fileoff); pSrcSeg->filesize = K_E2E_U64(pSrcSeg->filesize); pSrcSeg->maxprot = K_E2E_U32(pSrcSeg->maxprot); pSrcSeg->initprot = K_E2E_U32(pSrcSeg->initprot); pSrcSeg->nsects = K_E2E_U32(pSrcSeg->nsects); pSrcSeg->flags = K_E2E_U32(pSrcSeg->flags); } VALIDATE_AND_ADD_SEGMENT(64); /* * Convert, validate and parse the sections. */ while (cSectionsLeft-- > 0) { if (fConvertEndian) { pSect->addr = K_E2E_U64(pSect->addr); pSect->size = K_E2E_U64(pSect->size); pSect->offset = K_E2E_U32(pSect->offset); pSect->align = K_E2E_U32(pSect->align); pSect->reloff = K_E2E_U32(pSect->reloff); pSect->nreloc = K_E2E_U32(pSect->nreloc); pSect->flags = K_E2E_U32(pSect->flags); pSect->reserved1 = K_E2E_U32(pSect->reserved1); pSect->reserved2 = K_E2E_U32(pSect->reserved2); } VALIDATE_AND_ADD_SECTION(64); /* next */ pSect++; } break; } /* LC_SEGMENT_64 */ case LC_SYMTAB: { KSIZE cbSym; if (fConvertEndian) { u.pSymTab->symoff = K_E2E_U32(u.pSymTab->symoff); u.pSymTab->nsyms = K_E2E_U32(u.pSymTab->nsyms); u.pSymTab->stroff = K_E2E_U32(u.pSymTab->stroff); u.pSymTab->strsize = K_E2E_U32(u.pSymTab->strsize); } /* verify */ cbSym = pHdr->magic == IMAGE_MACHO32_SIGNATURE || pHdr->magic == IMAGE_MACHO32_SIGNATURE_OE ? sizeof(macho_nlist_32_t) : sizeof(macho_nlist_64_t); if ( u.pSymTab->symoff >= cbFile || (KU64)u.pSymTab->symoff + u.pSymTab->nsyms * cbSym > cbFile) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_LOAD_COMMAND); if ( u.pSymTab->stroff >= cbFile || (KU64)u.pSymTab->stroff + u.pSymTab->strsize > cbFile) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_LOAD_COMMAND); /* only one string in objects, please. */ cSymbolTabs++; if ( uEffFileType == MH_OBJECT && cSymbolTabs != 1) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_OBJECT_FILE); break; } case LC_DYSYMTAB: /** @todo deal with this! */ break; case LC_THREAD: case LC_UNIXTHREAD: { KU32 *pu32 = (KU32 *)(u.pb + sizeof(load_command_t)); KU32 cItemsLeft = (u.pThread->cmdsize - sizeof(load_command_t)) / sizeof(KU32); while (cItemsLeft) { /* convert & verify header items ([0] == flavor, [1] == KU32 count). */ if (cItemsLeft < 2) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_LOAD_COMMAND); if (fConvertEndian) { pu32[0] = K_E2E_U32(pu32[0]); pu32[1] = K_E2E_U32(pu32[1]); } if (pu32[1] + 2 > cItemsLeft) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_LOAD_COMMAND); /* convert & verify according to flavor. */ switch (pu32[0]) { /** @todo */ default: break; } /* next */ cItemsLeft -= pu32[1] + 2; pu32 += pu32[1] + 2; } break; } case LC_UUID: if (u.pUuid->cmdsize != sizeof(uuid_command_t)) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_LOAD_COMMAND); /** @todo Check anything here need converting? */ break; case LC_CODE_SIGNATURE: if (u.pUuid->cmdsize != sizeof(linkedit_data_command_t)) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_LOAD_COMMAND); break; case LC_VERSION_MIN_MACOSX: case LC_VERSION_MIN_IPHONEOS: if (u.pUuid->cmdsize != sizeof(version_min_command_t)) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_LOAD_COMMAND); break; case LC_SOURCE_VERSION: /* Harmless. It just gives a clue regarding the source code revision/version. */ case LC_DATA_IN_CODE: /* Ignore */ case LC_DYLIB_CODE_SIGN_DRS:/* Ignore */ /** @todo valid command size. */ break; case LC_FUNCTION_STARTS: /** @todo dylib++ */ /* Ignore for now. */ break; case LC_ID_DYLIB: /** @todo dylib */ case LC_LOAD_DYLIB: /** @todo dylib */ case LC_LOAD_DYLINKER: /** @todo dylib */ case LC_TWOLEVEL_HINTS: /** @todo dylib */ case LC_LOAD_WEAK_DYLIB: /** @todo dylib */ case LC_ID_DYLINKER: /** @todo dylib */ case LC_RPATH: /** @todo dylib */ case LC_SEGMENT_SPLIT_INFO: /** @todo dylib++ */ case LC_REEXPORT_DYLIB: /** @todo dylib */ case LC_DYLD_INFO: /** @todo dylib */ case LC_DYLD_INFO_ONLY: /** @todo dylib */ case LC_LOAD_UPWARD_DYLIB: /** @todo dylib */ case LC_DYLD_ENVIRONMENT: /** @todo dylib */ case LC_MAIN: /** @todo parse this and find and entry point or smth. */ /** @todo valid command size. */ if (!(fOpenFlags & KLDRMOD_OPEN_FLAGS_FOR_INFO)) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_UNSUPPORTED_LOAD_COMMAND); *pfCanLoad = K_FALSE; break; case LC_LOADFVMLIB: case LC_IDFVMLIB: case LC_IDENT: case LC_FVMFILE: case LC_PREPAGE: case LC_PREBOUND_DYLIB: case LC_ROUTINES: case LC_ROUTINES_64: case LC_SUB_FRAMEWORK: case LC_SUB_UMBRELLA: case LC_SUB_CLIENT: case LC_SUB_LIBRARY: case LC_PREBIND_CKSUM: case LC_SYMSEG: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_UNSUPPORTED_LOAD_COMMAND); default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_UNKNOWN_LOAD_COMMAND); } } /* be strict. */ if (cbLeft) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_LOAD_COMMAND); switch (uEffFileType) { case MH_OBJECT: case MH_EXECUTE: case MH_DYLIB: case MH_BUNDLE: case MH_DSYM: case MH_KEXT_BUNDLE: if (!cSegments) KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_OBJECT_FILE); break; } *pcSegments = cSegments; *pcSections = cSections; *pcbStringPool = (KU32)cbStringPool; return 0; } /** * Parses the load commands after we've carved out the module instance. * * This fills in the segment table and perhaps some other properties. * * @returns 0 on success. * @returns KLDR_ERR_MACHO_* on failure. * @param pModMachO The module. * @param pbStringPool The string pool * @param cbStringPool The size of the string pool. */ static int kldrModMachOParseLoadCommands(PKLDRMODMACHO pModMachO, char *pbStringPool, KU32 cbStringPool) { union { const KU8 *pb; const load_command_t *pLoadCmd; const segment_command_32_t *pSeg32; const segment_command_64_t *pSeg64; const symtab_command_t *pSymTab; const uuid_command_t *pUuid; } u; KU32 cLeft = pModMachO->Hdr.ncmds; KU32 cbLeft = pModMachO->Hdr.sizeofcmds; const KU8 *pb = pModMachO->pbLoadCommands; PKLDRSEG pDstSeg = &pModMachO->pMod->aSegments[0]; PKLDRMODMACHOSEG pSegExtra = &pModMachO->aSegments[0]; PKLDRMODMACHOSECT pSectExtra = pModMachO->paSections; const KU32 cSegments = pModMachO->pMod->cSegments; PKLDRSEG pSegItr; K_NOREF(cbStringPool); while (cLeft-- > 0) { u.pb = pb; cbLeft -= u.pLoadCmd->cmdsize; pb += u.pLoadCmd->cmdsize; /* * Convert endian if needed, parse and validate the command. */ switch (u.pLoadCmd->cmd) { case LC_SEGMENT_32: { const segment_command_32_t *pSrcSeg = (const segment_command_32_t *)u.pLoadCmd; section_32_t *pFirstSect = (section_32_t *)(pSrcSeg + 1); section_32_t *pSect = pFirstSect; KU32 cSectionsLeft = pSrcSeg->nsects; /* Adds a segment, used by the macro below and thus shared with the 64-bit segment variant. */ #define NEW_SEGMENT(a_cBits, a_achName1, a_fObjFile, a_achName2, a_SegAddr, a_cbSeg, a_fFileBits, a_offFile, a_cbFile) \ do { \ pDstSeg->pvUser = NULL; \ pDstSeg->pchName = pbStringPool; \ pDstSeg->cchName = (KU32)kHlpStrNLen(a_achName1, sizeof(a_achName1)); \ kHlpMemCopy(pbStringPool, a_achName1, pDstSeg->cchName); \ pbStringPool += pDstSeg->cchName; \ if (a_fObjFile) \ { /* MH_OBJECT: Add '.sectname' - sections aren't sorted by segments. */ \ KSIZE cchName2 = kHlpStrNLen(a_achName2, sizeof(a_achName2)); \ *pbStringPool++ = '.'; \ kHlpMemCopy(pbStringPool, a_achName2, cchName2); \ pbStringPool += cchName2; \ pDstSeg->cchName += (KU32)cchName2; \ } \ *pbStringPool++ = '\0'; \ pDstSeg->SelFlat = 0; \ pDstSeg->Sel16bit = 0; \ pDstSeg->fFlags = 0; \ pDstSeg->enmProt = KPROT_EXECUTE_WRITECOPY; /** @todo fixme! */ \ pDstSeg->cb = (a_cbSeg); \ pDstSeg->Alignment = 1; /* updated while parsing sections. */ \ pDstSeg->LinkAddress = (a_SegAddr); \ if (a_fFileBits) \ { \ pDstSeg->offFile = (KLDRFOFF)((a_offFile) + pModMachO->offImage); \ pDstSeg->cbFile = (KLDRFOFF)(a_cbFile); \ } \ else \ { \ pDstSeg->offFile = -1; \ pDstSeg->cbFile = -1; \ } \ pDstSeg->RVA = (a_SegAddr) - pModMachO->LinkAddress; \ pDstSeg->cbMapped = 0; \ pDstSeg->MapAddress = 0; \ \ pSegExtra->iOrgSegNo = (KU32)(pSegExtra - &pModMachO->aSegments[0]); \ pSegExtra->cSections = 0; \ pSegExtra->paSections = pSectExtra; \ } while (0) /* Closes the new segment - part of NEW_SEGMENT. */ #define CLOSE_SEGMENT() \ do { \ pSegExtra->cSections = (KU32)(pSectExtra - pSegExtra->paSections); \ pSegExtra++; \ pDstSeg++; \ } while (0) /* Shared with the 64-bit variant. */ #define ADD_SEGMENT_AND_ITS_SECTIONS(a_cBits) \ do { \ KBOOL fAddSegOuter = K_FALSE; \ \ /* \ * Check that the segment name is unique. We couldn't do that \ * in the preparsing stage. \ */ \ if (pModMachO->uEffFileType != MH_OBJECT) \ for (pSegItr = &pModMachO->pMod->aSegments[0]; pSegItr != pDstSeg; pSegItr++) \ if (!kHlpStrNComp(pSegItr->pchName, pSrcSeg->segname, sizeof(pSrcSeg->segname))) \ KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_DUPLICATE_SEGMENT_NAME); \ \ /* \ * Create a new segment, unless we're supposed to skip this one. \ */ \ if ( pModMachO->uEffFileType != MH_OBJECT \ && (cSectionsLeft == 0 || !(pFirstSect->flags & S_ATTR_DEBUG)) \ && kHlpStrComp(pSrcSeg->segname, "__DWARF") \ && kHlpStrComp(pSrcSeg->segname, "__CTF") ) \ { \ NEW_SEGMENT(a_cBits, pSrcSeg->segname, K_FALSE /*a_fObjFile*/, 0 /*a_achName2*/, \ pSrcSeg->vmaddr, pSrcSeg->vmsize, \ pSrcSeg->filesize != 0, pSrcSeg->fileoff, pSrcSeg->filesize); \ fAddSegOuter = K_TRUE; \ } \ \ /* \ * Convert and parse the sections. \ */ \ while (cSectionsLeft-- > 0) \ { \ /* New segment if object file. */ \ KBOOL fAddSegInner = K_FALSE; \ if ( pModMachO->uEffFileType == MH_OBJECT \ && !(pSect->flags & S_ATTR_DEBUG) \ && kHlpStrComp(pSrcSeg->segname, "__DWARF") \ && kHlpStrComp(pSrcSeg->segname, "__CTF") ) \ { \ kHlpAssert(!fAddSegOuter); \ NEW_SEGMENT(a_cBits, pSect->segname, K_TRUE /*a_fObjFile*/, pSect->sectname, \ pSect->addr, pSect->size, \ pSect->offset != 0, pSect->offset, pSect->size); \ fAddSegInner = K_TRUE; \ } \ \ /* Section data extract. */ \ pSectExtra->cb = pSect->size; \ pSectExtra->RVA = pSect->addr - pDstSeg->LinkAddress; \ pSectExtra->LinkAddress = pSect->addr; \ if (pSect->offset) \ pSectExtra->offFile = pSect->offset + pModMachO->offImage; \ else \ pSectExtra->offFile = -1; \ pSectExtra->cFixups = pSect->nreloc; \ pSectExtra->paFixups = NULL; \ if (pSect->nreloc) \ pSectExtra->offFixups = pSect->reloff + pModMachO->offImage; \ else \ pSectExtra->offFixups = -1; \ pSectExtra->fFlags = pSect->flags; \ pSectExtra->iSegment = (KU32)(pSegExtra - &pModMachO->aSegments[0]); \ pSectExtra->pvMachoSection = pSect; \ \ /* Update the segment alignment, if we're not skipping it. */ \ if ( (fAddSegOuter || fAddSegInner) \ && pDstSeg->Alignment < ((KLDRADDR)1 << pSect->align)) \ pDstSeg->Alignment = (KLDRADDR)1 << pSect->align; \ \ /* Next section, and if object file next segment. */ \ pSectExtra++; \ pSect++; \ if (fAddSegInner) \ CLOSE_SEGMENT(); \ } \ \ /* Close the segment and advance. */ \ if (fAddSegOuter) \ CLOSE_SEGMENT(); \ } while (0) /* ADD_SEGMENT_AND_ITS_SECTIONS */ ADD_SEGMENT_AND_ITS_SECTIONS(32); break; } case LC_SEGMENT_64: { const segment_command_64_t *pSrcSeg = (const segment_command_64_t *)u.pLoadCmd; section_64_t *pFirstSect = (section_64_t *)(pSrcSeg + 1); section_64_t *pSect = pFirstSect; KU32 cSectionsLeft = pSrcSeg->nsects; ADD_SEGMENT_AND_ITS_SECTIONS(64); break; } case LC_SYMTAB: switch (pModMachO->uEffFileType) { case MH_OBJECT: case MH_EXECUTE: case MH_DYLIB: /** @todo ??? */ case MH_BUNDLE: /** @todo ??? */ case MH_DSYM: case MH_KEXT_BUNDLE: pModMachO->offSymbols = u.pSymTab->symoff + pModMachO->offImage; pModMachO->cSymbols = u.pSymTab->nsyms; pModMachO->offStrings = u.pSymTab->stroff + pModMachO->offImage; pModMachO->cchStrings = u.pSymTab->strsize; break; } break; case LC_UUID: kHlpMemCopy(pModMachO->abImageUuid, u.pUuid->uuid, sizeof(pModMachO->abImageUuid)); break; default: break; } /* command switch */ } /* while more commands */ kHlpAssert(pDstSeg == &pModMachO->pMod->aSegments[cSegments - pModMachO->fMakeGot]); /* * Adjust mapping addresses calculating the image size. */ { KBOOL fLoadLinkEdit = K_FALSE; PKLDRMODMACHOSECT pSectExtraItr; KLDRADDR uNextRVA = 0; KLDRADDR cb; KU32 cSegmentsToAdjust = cSegments - pModMachO->fMakeGot; KU32 c; for (;;) { /* Check if there is __DWARF segment at the end and make sure it's left out of the RVA negotiations and image loading. */ if ( cSegmentsToAdjust > 0 && !kHlpStrComp(pModMachO->pMod->aSegments[cSegmentsToAdjust - 1].pchName, "__DWARF")) { cSegmentsToAdjust--; pModMachO->pMod->aSegments[cSegmentsToAdjust].RVA = NIL_KLDRADDR; pModMachO->pMod->aSegments[cSegmentsToAdjust].cbMapped = 0; continue; } /* If we're skipping the __LINKEDIT segment, check for it and adjust the number of segments we'll be messing with here. ASSUMES it's last (by now anyway). */ if ( !fLoadLinkEdit && cSegmentsToAdjust > 0 && !kHlpStrComp(pModMachO->pMod->aSegments[cSegmentsToAdjust - 1].pchName, "__LINKEDIT")) { cSegmentsToAdjust--; pModMachO->pMod->aSegments[cSegmentsToAdjust].RVA = NIL_KLDRADDR; pModMachO->pMod->aSegments[cSegmentsToAdjust].cbMapped = 0; continue; } break; } /* Adjust RVAs. */ c = cSegmentsToAdjust; for (pDstSeg = &pModMachO->pMod->aSegments[0]; c-- > 0; pDstSeg++) { cb = pDstSeg->RVA - uNextRVA; if (cb >= 0x00100000) /* 1MB */ { pDstSeg->RVA = uNextRVA; pModMachO->pMod->fFlags |= KLDRMOD_FLAGS_NON_CONTIGUOUS_LINK_ADDRS; } uNextRVA = pDstSeg->RVA + KLDR_ALIGN_ADDR(pDstSeg->cb, pDstSeg->Alignment); } /* Calculate the cbMapping members. */ c = cSegmentsToAdjust; for (pDstSeg = &pModMachO->pMod->aSegments[0]; c-- > 1; pDstSeg++) { cb = pDstSeg[1].RVA - pDstSeg->RVA; pDstSeg->cbMapped = (KSIZE)cb == cb ? (KSIZE)cb : KSIZE_MAX; } cb = KLDR_ALIGN_ADDR(pDstSeg->cb, pDstSeg->Alignment); pDstSeg->cbMapped = (KSIZE)cb == cb ? (KSIZE)cb : KSIZE_MAX; /* Set the image size. */ pModMachO->cbImage = pDstSeg->RVA + cb; /* Fixup the section RVAs (internal). */ c = cSegmentsToAdjust; uNextRVA = pModMachO->cbImage; pDstSeg = &pModMachO->pMod->aSegments[0]; for (pSectExtraItr = pModMachO->paSections; pSectExtraItr != pSectExtra; pSectExtraItr++) { if (pSectExtraItr->iSegment < c) pSectExtraItr->RVA += pDstSeg[pSectExtraItr->iSegment].RVA; else { pSectExtraItr->RVA = uNextRVA; uNextRVA += KLDR_ALIGN_ADDR(pSectExtraItr->cb, 64); } } } /* * Make the GOT segment if necessary. */ if (pModMachO->fMakeGot) { KU32 cbPtr = ( pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE) ? sizeof(KU32) : sizeof(KU64); KU32 cbGot = pModMachO->cSymbols * cbPtr; KU32 cbJmpStubs; pModMachO->GotRVA = pModMachO->cbImage; if (pModMachO->cbJmpStub) { cbGot = K_ALIGN_Z(cbGot, 64); pModMachO->JmpStubsRVA = pModMachO->GotRVA + cbGot; cbJmpStubs = pModMachO->cbJmpStub * pModMachO->cSymbols; } else { pModMachO->JmpStubsRVA = NIL_KLDRADDR; cbJmpStubs = 0; } pDstSeg = &pModMachO->pMod->aSegments[cSegments - 1]; pDstSeg->pvUser = NULL; pDstSeg->pchName = "GOT"; pDstSeg->cchName = 3; pDstSeg->SelFlat = 0; pDstSeg->Sel16bit = 0; pDstSeg->fFlags = 0; pDstSeg->enmProt = KPROT_READONLY; pDstSeg->cb = cbGot + cbJmpStubs; pDstSeg->Alignment = 64; pDstSeg->LinkAddress = pModMachO->LinkAddress + pModMachO->GotRVA; pDstSeg->offFile = -1; pDstSeg->cbFile = -1; pDstSeg->RVA = pModMachO->GotRVA; pDstSeg->cbMapped = (KSIZE)KLDR_ALIGN_ADDR(cbGot + cbJmpStubs, pDstSeg->Alignment); pDstSeg->MapAddress = 0; pSegExtra->iOrgSegNo = KU32_MAX; pSegExtra->cSections = 0; pSegExtra->paSections = NULL; pModMachO->cbImage += pDstSeg->cbMapped; } return 0; } /** @copydoc KLDRMODOPS::pfnDestroy */ static int kldrModMachODestroy(PKLDRMOD pMod) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; int rc = 0; KU32 i, j; KLDRMODMACHO_ASSERT(!pModMachO->pvMapping); i = pMod->cSegments; while (i-- > 0) { j = pModMachO->aSegments[i].cSections; while (j-- > 0) { kHlpFree(pModMachO->aSegments[i].paSections[j].paFixups); pModMachO->aSegments[i].paSections[j].paFixups = NULL; } } if (pMod->pRdr) { rc = kRdrClose(pMod->pRdr); pMod->pRdr = NULL; } pMod->u32Magic = 0; pMod->pOps = NULL; kHlpFree(pModMachO->pbLoadCommands); pModMachO->pbLoadCommands = NULL; kHlpFree(pModMachO->pchStrings); pModMachO->pchStrings = NULL; kHlpFree(pModMachO->pvaSymbols); pModMachO->pvaSymbols = NULL; kHlpFree(pModMachO); return rc; } /** * Gets the right base address. * * @returns 0 on success. * @returns A non-zero status code if the BaseAddress isn't right. * @param pModMachO The interpreter module instance * @param pBaseAddress The base address, IN & OUT. Optional. */ static int kldrModMachOAdjustBaseAddress(PKLDRMODMACHO pModMachO, PKLDRADDR pBaseAddress) { /* * Adjust the base address. */ if (*pBaseAddress == KLDRMOD_BASEADDRESS_MAP) *pBaseAddress = pModMachO->pMod->aSegments[0].MapAddress; else if (*pBaseAddress == KLDRMOD_BASEADDRESS_LINK) *pBaseAddress = pModMachO->LinkAddress; return 0; } /** * Resolves a linker generated symbol. * * The Apple linker generates symbols indicating the start and end of sections * and segments. This function checks for these and returns the right value. * * @returns 0 or KLDR_ERR_SYMBOL_NOT_FOUND. * @param pModMachO The interpreter module instance. * @param pMod The generic module instance. * @param pchSymbol The symbol. * @param cchSymbol The length of the symbol. * @param BaseAddress The base address to apply when calculating the * value. * @param puValue Where to return the symbol value. */ static int kldrModMachOQueryLinkerSymbol(PKLDRMODMACHO pModMachO, PKLDRMOD pMod, const char *pchSymbol, KSIZE cchSymbol, KLDRADDR BaseAddress, PKLDRADDR puValue) { /* * Match possible name prefixes. */ static const struct { const char *pszPrefix; KU8 cchPrefix; KBOOL fSection; KBOOL fStart; } s_aPrefixes[] = { { "section$start$", (KU8)sizeof("section$start$") - 1, K_TRUE, K_TRUE }, { "section$end$", (KU8)sizeof("section$end$") - 1, K_TRUE, K_FALSE}, { "segment$start$", (KU8)sizeof("segment$start$") - 1, K_FALSE, K_TRUE }, { "segment$end$", (KU8)sizeof("segment$end$") - 1, K_FALSE, K_FALSE}, }; KSIZE cchSectName = 0; const char *pchSectName = ""; KSIZE cchSegName = 0; const char *pchSegName = NULL; KU32 iPrefix = K_ELEMENTS(s_aPrefixes) - 1; KU32 iSeg; KLDRADDR uValue; for (;;) { KU8 const cchPrefix = s_aPrefixes[iPrefix].cchPrefix; if ( cchSymbol > cchPrefix && kHlpStrNComp(pchSymbol, s_aPrefixes[iPrefix].pszPrefix, cchPrefix) == 0) { pchSegName = pchSymbol + cchPrefix; cchSegName = cchSymbol - cchPrefix; break; } /* next */ if (!iPrefix) return KLDR_ERR_SYMBOL_NOT_FOUND; iPrefix--; } /* * Split the remainder into segment and section name, if necessary. */ if (s_aPrefixes[iPrefix].fSection) { pchSectName = kHlpMemChr(pchSegName, '$', cchSegName); if (!pchSectName) return KLDR_ERR_SYMBOL_NOT_FOUND; cchSegName = pchSectName - pchSegName; pchSectName++; cchSectName = cchSymbol - (pchSectName - pchSymbol); } /* * Locate the segment. */ if (!pMod->cSegments) return KLDR_ERR_SYMBOL_NOT_FOUND; for (iSeg = 0; iSeg < pMod->cSegments; iSeg++) { if ( pMod->aSegments[iSeg].cchName >= cchSegName && kHlpMemComp(pMod->aSegments[iSeg].pchName, pchSegName, cchSegName) == 0) { section_32_t const *pSect; if ( pMod->aSegments[iSeg].cchName == cchSegName && pModMachO->Hdr.filetype != MH_OBJECT /* Good enough for __DWARF segs in MH_DHSYM, I hope. */) break; pSect = (section_32_t *)pModMachO->aSegments[iSeg].paSections[0].pvMachoSection; if ( pModMachO->uEffFileType == MH_OBJECT && pMod->aSegments[iSeg].cchName > cchSegName + 1 && pMod->aSegments[iSeg].pchName[cchSegName] == '.' && kHlpStrNComp(&pMod->aSegments[iSeg].pchName[cchSegName + 1], pSect->sectname, sizeof(pSect->sectname)) == 0 && pMod->aSegments[iSeg].cchName - cchSegName - 1 <= sizeof(pSect->sectname) ) break; } } if (iSeg >= pMod->cSegments) return KLDR_ERR_SYMBOL_NOT_FOUND; if (!s_aPrefixes[iPrefix].fSection) { /* * Calculate the segment start/end address. */ uValue = pMod->aSegments[iSeg].RVA; if (!s_aPrefixes[iPrefix].fStart) uValue += pMod->aSegments[iSeg].cb; } else { /* * Locate the section. */ KU32 iSect = pModMachO->aSegments[iSeg].cSections; if (!iSect) return KLDR_ERR_SYMBOL_NOT_FOUND; for (;;) { section_32_t *pSect = (section_32_t *)pModMachO->aSegments[iSeg].paSections[iSect].pvMachoSection; if ( cchSectName <= sizeof(pSect->sectname) && kHlpMemComp(pSect->sectname, pchSectName, cchSectName) == 0 && ( cchSectName == sizeof(pSect->sectname) || pSect->sectname[cchSectName] == '\0') ) break; /* next */ if (!iSect) return KLDR_ERR_SYMBOL_NOT_FOUND; iSect--; } uValue = pModMachO->aSegments[iSeg].paSections[iSect].RVA; if (!s_aPrefixes[iPrefix].fStart) uValue += pModMachO->aSegments[iSeg].paSections[iSect].cb; } /* * Convert from RVA to load address. */ uValue += BaseAddress; if (puValue) *puValue = uValue; return 0; } /** @copydoc kLdrModQuerySymbol */ static int kldrModMachOQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; int rc; K_NOREF(pvBits); K_NOREF(pszVersion); K_NOREF(pfnGetForwarder); K_NOREF(pvUser); /* * Resolve defaults. */ rc = kldrModMachOAdjustBaseAddress(pModMachO, &BaseAddress); if (rc) return rc; /* * Refuse segmented requests for now. */ KLDRMODMACHO_CHECK_RETURN( !pfKind || (*pfKind & KLDRSYMKIND_REQ_TYPE_MASK) == KLDRSYMKIND_REQ_FLAT, KLDR_ERR_TODO); /* * Take action according to file type. */ if ( pModMachO->Hdr.filetype == MH_OBJECT || pModMachO->Hdr.filetype == MH_EXECUTE /** @todo dylib, execute, dsym: symbols */ || pModMachO->Hdr.filetype == MH_DYLIB || pModMachO->Hdr.filetype == MH_BUNDLE || pModMachO->Hdr.filetype == MH_DSYM || pModMachO->Hdr.filetype == MH_KEXT_BUNDLE) { rc = kldrModMachOLoadObjSymTab(pModMachO); if (!rc) { if ( pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE) rc = kldrModMachODoQuerySymbol32Bit(pModMachO, (macho_nlist_32_t *)pModMachO->pvaSymbols, pModMachO->cSymbols, pModMachO->pchStrings, pModMachO->cchStrings, BaseAddress, iSymbol, pchSymbol, (KU32)cchSymbol, puValue, pfKind); else rc = kldrModMachODoQuerySymbol64Bit(pModMachO, (macho_nlist_64_t *)pModMachO->pvaSymbols, pModMachO->cSymbols, pModMachO->pchStrings, pModMachO->cchStrings, BaseAddress, iSymbol, pchSymbol, (KU32)cchSymbol, puValue, pfKind); } /* * Check for link-editor generated symbols and supply what we can. * * As small service to clients that insists on adding a '_' prefix * before querying symbols, we will ignore the prefix. */ if ( rc == KLDR_ERR_SYMBOL_NOT_FOUND && cchSymbol > sizeof("section$end$") - 1 && ( pchSymbol[0] == 's' || (pchSymbol[1] == 's' && pchSymbol[0] == '_') ) && kHlpMemChr(pchSymbol, '$', cchSymbol) ) { if (pchSymbol[0] == '_') rc = kldrModMachOQueryLinkerSymbol(pModMachO, pMod, pchSymbol + 1, cchSymbol - 1, BaseAddress, puValue); else rc = kldrModMachOQueryLinkerSymbol(pModMachO, pMod, pchSymbol, cchSymbol, BaseAddress, puValue); } } else rc = KLDR_ERR_TODO; return rc; } /** * Lookup a symbol in a 32-bit symbol table. * * @returns See kLdrModQuerySymbol. * @param pModMachO * @param paSyms Pointer to the symbol table. * @param cSyms Number of symbols in the table. * @param pchStrings Pointer to the string table. * @param cchStrings Size of the string table. * @param BaseAddress Adjusted base address, see kLdrModQuerySymbol. * @param iSymbol See kLdrModQuerySymbol. * @param pchSymbol See kLdrModQuerySymbol. * @param cchSymbol See kLdrModQuerySymbol. * @param puValue See kLdrModQuerySymbol. * @param pfKind See kLdrModQuerySymbol. */ static int kldrModMachODoQuerySymbol32Bit(PKLDRMODMACHO pModMachO, const macho_nlist_32_t *paSyms, KU32 cSyms, const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KU32 cchSymbol, PKLDRADDR puValue, KU32 *pfKind) { /* * Find a valid symbol matching the search criteria. */ if (iSymbol == NIL_KLDRMOD_SYM_ORDINAL) { /* simplify validation. */ if (cchStrings <= cchSymbol) return KLDR_ERR_SYMBOL_NOT_FOUND; cchStrings -= cchSymbol; /* external symbols are usually at the end, so search the other way. */ for (iSymbol = cSyms - 1; iSymbol != KU32_MAX; iSymbol--) { const char *psz; /* Skip irrellevant and non-public symbols. */ if (paSyms[iSymbol].n_type & MACHO_N_STAB) continue; if ((paSyms[iSymbol].n_type & MACHO_N_TYPE) == MACHO_N_UNDF) continue; if (!(paSyms[iSymbol].n_type & MACHO_N_EXT)) /*??*/ continue; if (paSyms[iSymbol].n_type & MACHO_N_PEXT) /*??*/ continue; /* get name */ if (!paSyms[iSymbol].n_un.n_strx) continue; if ((KU32)paSyms[iSymbol].n_un.n_strx >= cchStrings) continue; psz = &pchStrings[paSyms[iSymbol].n_un.n_strx]; if (psz[cchSymbol]) continue; if (kHlpMemComp(psz, pchSymbol, cchSymbol)) continue; /* match! */ break; } if (iSymbol == KU32_MAX) return KLDR_ERR_SYMBOL_NOT_FOUND; } else { if (iSymbol >= cSyms) return KLDR_ERR_SYMBOL_NOT_FOUND; if (paSyms[iSymbol].n_type & MACHO_N_STAB) return KLDR_ERR_SYMBOL_NOT_FOUND; if ((paSyms[iSymbol].n_type & MACHO_N_TYPE) == MACHO_N_UNDF) return KLDR_ERR_SYMBOL_NOT_FOUND; } /* * Calc the return values. */ if (pfKind) { if ( pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE) *pfKind = KLDRSYMKIND_32BIT | KLDRSYMKIND_NO_TYPE; else *pfKind = KLDRSYMKIND_64BIT | KLDRSYMKIND_NO_TYPE; if (paSyms[iSymbol].n_desc & N_WEAK_DEF) *pfKind |= KLDRSYMKIND_WEAK; } switch (paSyms[iSymbol].n_type & MACHO_N_TYPE) { case MACHO_N_SECT: { PKLDRMODMACHOSECT pSect; KLDRADDR offSect; KLDRMODMACHO_CHECK_RETURN((KU32)(paSyms[iSymbol].n_sect - 1) < pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL); pSect = &pModMachO->paSections[paSyms[iSymbol].n_sect - 1]; offSect = paSyms[iSymbol].n_value - pSect->LinkAddress; KLDRMODMACHO_CHECK_RETURN( offSect <= pSect->cb || ( paSyms[iSymbol].n_sect == 1 /* special hack for __mh_execute_header */ && offSect == 0U - pSect->RVA && pModMachO->uEffFileType != MH_OBJECT), KLDR_ERR_MACHO_BAD_SYMBOL); if (puValue) *puValue = BaseAddress + pSect->RVA + offSect; if ( pfKind && (pSect->fFlags & (S_ATTR_PURE_INSTRUCTIONS | S_ATTR_SELF_MODIFYING_CODE))) *pfKind = (*pfKind & ~KLDRSYMKIND_TYPE_MASK) | KLDRSYMKIND_CODE; break; } case MACHO_N_ABS: if (puValue) *puValue = paSyms[iSymbol].n_value; /*if (pfKind) pfKind |= KLDRSYMKIND_ABS;*/ break; case MACHO_N_PBUD: case MACHO_N_INDR: /** @todo implement indirect and prebound symbols. */ default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); } return 0; } /** * Lookup a symbol in a 64-bit symbol table. * * @returns See kLdrModQuerySymbol. * @param pModMachO * @param paSyms Pointer to the symbol table. * @param cSyms Number of symbols in the table. * @param pchStrings Pointer to the string table. * @param cchStrings Size of the string table. * @param BaseAddress Adjusted base address, see kLdrModQuerySymbol. * @param iSymbol See kLdrModQuerySymbol. * @param pchSymbol See kLdrModQuerySymbol. * @param cchSymbol See kLdrModQuerySymbol. * @param puValue See kLdrModQuerySymbol. * @param pfKind See kLdrModQuerySymbol. */ static int kldrModMachODoQuerySymbol64Bit(PKLDRMODMACHO pModMachO, const macho_nlist_64_t *paSyms, KU32 cSyms, const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KU32 cchSymbol, PKLDRADDR puValue, KU32 *pfKind) { /* * Find a valid symbol matching the search criteria. */ if (iSymbol == NIL_KLDRMOD_SYM_ORDINAL) { /* simplify validation. */ if (cchStrings <= cchSymbol) return KLDR_ERR_SYMBOL_NOT_FOUND; cchStrings -= cchSymbol; /* external symbols are usually at the end, so search the other way. */ for (iSymbol = cSyms - 1; iSymbol != KU32_MAX; iSymbol--) { const char *psz; /* Skip irrellevant and non-public symbols. */ if (paSyms[iSymbol].n_type & MACHO_N_STAB) continue; if ((paSyms[iSymbol].n_type & MACHO_N_TYPE) == MACHO_N_UNDF) continue; if (!(paSyms[iSymbol].n_type & MACHO_N_EXT)) /*??*/ continue; if (paSyms[iSymbol].n_type & MACHO_N_PEXT) /*??*/ continue; /* get name */ if (!paSyms[iSymbol].n_un.n_strx) continue; if ((KU32)paSyms[iSymbol].n_un.n_strx >= cchStrings) continue; psz = &pchStrings[paSyms[iSymbol].n_un.n_strx]; if (psz[cchSymbol]) continue; if (kHlpMemComp(psz, pchSymbol, cchSymbol)) continue; /* match! */ break; } if (iSymbol == KU32_MAX) return KLDR_ERR_SYMBOL_NOT_FOUND; } else { if (iSymbol >= cSyms) return KLDR_ERR_SYMBOL_NOT_FOUND; if (paSyms[iSymbol].n_type & MACHO_N_STAB) return KLDR_ERR_SYMBOL_NOT_FOUND; if ((paSyms[iSymbol].n_type & MACHO_N_TYPE) == MACHO_N_UNDF) return KLDR_ERR_SYMBOL_NOT_FOUND; } /* * Calc the return values. */ if (pfKind) { if ( pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE) *pfKind = KLDRSYMKIND_32BIT | KLDRSYMKIND_NO_TYPE; else *pfKind = KLDRSYMKIND_64BIT | KLDRSYMKIND_NO_TYPE; if (paSyms[iSymbol].n_desc & N_WEAK_DEF) *pfKind |= KLDRSYMKIND_WEAK; } switch (paSyms[iSymbol].n_type & MACHO_N_TYPE) { case MACHO_N_SECT: { PKLDRMODMACHOSECT pSect; KLDRADDR offSect; KLDRMODMACHO_CHECK_RETURN((KU32)(paSyms[iSymbol].n_sect - 1) < pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL); pSect = &pModMachO->paSections[paSyms[iSymbol].n_sect - 1]; offSect = paSyms[iSymbol].n_value - pSect->LinkAddress; KLDRMODMACHO_CHECK_RETURN( offSect <= pSect->cb || ( paSyms[iSymbol].n_sect == 1 /* special hack for __mh_execute_header */ && offSect == 0U - pSect->RVA && pModMachO->uEffFileType != MH_OBJECT), KLDR_ERR_MACHO_BAD_SYMBOL); if (puValue) *puValue = BaseAddress + pSect->RVA + offSect; if ( pfKind && (pSect->fFlags & (S_ATTR_PURE_INSTRUCTIONS | S_ATTR_SELF_MODIFYING_CODE))) *pfKind = (*pfKind & ~KLDRSYMKIND_TYPE_MASK) | KLDRSYMKIND_CODE; break; } case MACHO_N_ABS: if (puValue) *puValue = paSyms[iSymbol].n_value; /*if (pfKind) pfKind |= KLDRSYMKIND_ABS;*/ break; case MACHO_N_PBUD: case MACHO_N_INDR: /** @todo implement indirect and prebound symbols. */ default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); } return 0; } /** @copydoc kLdrModEnumSymbols */ static int kldrModMachOEnumSymbols(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; int rc; K_NOREF(pvBits); /* * Resolve defaults. */ rc = kldrModMachOAdjustBaseAddress(pModMachO, &BaseAddress); if (rc) return rc; /* * Take action according to file type. */ if ( pModMachO->Hdr.filetype == MH_OBJECT || pModMachO->Hdr.filetype == MH_EXECUTE /** @todo dylib, execute, dsym: symbols */ || pModMachO->Hdr.filetype == MH_DYLIB || pModMachO->Hdr.filetype == MH_BUNDLE || pModMachO->Hdr.filetype == MH_DSYM || pModMachO->Hdr.filetype == MH_KEXT_BUNDLE) { rc = kldrModMachOLoadObjSymTab(pModMachO); if (!rc) { if ( pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE) rc = kldrModMachODoEnumSymbols32Bit(pModMachO, (macho_nlist_32_t *)pModMachO->pvaSymbols, pModMachO->cSymbols, pModMachO->pchStrings, pModMachO->cchStrings, BaseAddress, fFlags, pfnCallback, pvUser); else rc = kldrModMachODoEnumSymbols64Bit(pModMachO, (macho_nlist_64_t *)pModMachO->pvaSymbols, pModMachO->cSymbols, pModMachO->pchStrings, pModMachO->cchStrings, BaseAddress, fFlags, pfnCallback, pvUser); } } else KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); return rc; } /** * Enum a 32-bit symbol table. * * @returns See kLdrModQuerySymbol. * @param pModMachO * @param paSyms Pointer to the symbol table. * @param cSyms Number of symbols in the table. * @param pchStrings Pointer to the string table. * @param cchStrings Size of the string table. * @param BaseAddress Adjusted base address, see kLdrModEnumSymbols. * @param fFlags See kLdrModEnumSymbols. * @param pfnCallback See kLdrModEnumSymbols. * @param pvUser See kLdrModEnumSymbols. */ static int kldrModMachODoEnumSymbols32Bit(PKLDRMODMACHO pModMachO, const macho_nlist_32_t *paSyms, KU32 cSyms, const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser) { const KU32 fKindBase = pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE ? KLDRSYMKIND_32BIT : KLDRSYMKIND_64BIT; KU32 iSym; int rc; /* * Iterate the symbol table. */ for (iSym = 0; iSym < cSyms; iSym++) { KU32 fKind; KLDRADDR uValue; const char *psz; KSIZE cch; /* Skip debug symbols and undefined symbols. */ if (paSyms[iSym].n_type & MACHO_N_STAB) continue; if ((paSyms[iSym].n_type & MACHO_N_TYPE) == MACHO_N_UNDF) continue; /* Skip non-public symbols unless they are requested explicitly. */ if (!(fFlags & KLDRMOD_ENUM_SYMS_FLAGS_ALL)) { if (!(paSyms[iSym].n_type & MACHO_N_EXT)) /*??*/ continue; if (paSyms[iSym].n_type & MACHO_N_PEXT) /*??*/ continue; if (!paSyms[iSym].n_un.n_strx) continue; } /* * Gather symbol info */ /* name */ KLDRMODMACHO_CHECK_RETURN((KU32)paSyms[iSym].n_un.n_strx < cchStrings, KLDR_ERR_MACHO_BAD_SYMBOL); psz = &pchStrings[paSyms[iSym].n_un.n_strx]; cch = kHlpStrLen(psz); if (!cch) psz = NULL; /* kind & value */ fKind = fKindBase; if (paSyms[iSym].n_desc & N_WEAK_DEF) fKind |= KLDRSYMKIND_WEAK; switch (paSyms[iSym].n_type & MACHO_N_TYPE) { case MACHO_N_SECT: { PKLDRMODMACHOSECT pSect; KLDRMODMACHO_CHECK_RETURN((KU32)(paSyms[iSym].n_sect - 1) < pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL); pSect = &pModMachO->paSections[paSyms[iSym].n_sect - 1]; uValue = paSyms[iSym].n_value - pSect->LinkAddress; KLDRMODMACHO_CHECK_RETURN( uValue <= pSect->cb || ( paSyms[iSym].n_sect == 1 /* special hack for __mh_execute_header */ && uValue == 0U - pSect->RVA && pModMachO->uEffFileType != MH_OBJECT), KLDR_ERR_MACHO_BAD_SYMBOL); uValue += BaseAddress + pSect->RVA; if (pSect->fFlags & (S_ATTR_PURE_INSTRUCTIONS | S_ATTR_SELF_MODIFYING_CODE)) fKind |= KLDRSYMKIND_CODE; else fKind |= KLDRSYMKIND_NO_TYPE; break; } case MACHO_N_ABS: uValue = paSyms[iSym].n_value; fKind |= KLDRSYMKIND_NO_TYPE /*KLDRSYMKIND_ABS*/; break; case MACHO_N_PBUD: case MACHO_N_INDR: /** @todo implement indirect and prebound symbols. */ default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); } /* * Do callback. */ rc = pfnCallback(pModMachO->pMod, iSym, psz, cch, NULL, uValue, fKind, pvUser); if (rc) return rc; } return 0; } /** * Enum a 64-bit symbol table. * * @returns See kLdrModQuerySymbol. * @param pModMachO * @param paSyms Pointer to the symbol table. * @param cSyms Number of symbols in the table. * @param pchStrings Pointer to the string table. * @param cchStrings Size of the string table. * @param BaseAddress Adjusted base address, see kLdrModEnumSymbols. * @param fFlags See kLdrModEnumSymbols. * @param pfnCallback See kLdrModEnumSymbols. * @param pvUser See kLdrModEnumSymbols. */ static int kldrModMachODoEnumSymbols64Bit(PKLDRMODMACHO pModMachO, const macho_nlist_64_t *paSyms, KU32 cSyms, const char *pchStrings, KU32 cchStrings, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser) { const KU32 fKindBase = pModMachO->Hdr.magic == IMAGE_MACHO64_SIGNATURE || pModMachO->Hdr.magic == IMAGE_MACHO64_SIGNATURE_OE ? KLDRSYMKIND_64BIT : KLDRSYMKIND_32BIT; KU32 iSym; int rc; /* * Iterate the symbol table. */ for (iSym = 0; iSym < cSyms; iSym++) { KU32 fKind; KLDRADDR uValue; const char *psz; KSIZE cch; /* Skip debug symbols and undefined symbols. */ if (paSyms[iSym].n_type & MACHO_N_STAB) continue; if ((paSyms[iSym].n_type & MACHO_N_TYPE) == MACHO_N_UNDF) continue; /* Skip non-public symbols unless they are requested explicitly. */ if (!(fFlags & KLDRMOD_ENUM_SYMS_FLAGS_ALL)) { if (!(paSyms[iSym].n_type & MACHO_N_EXT)) /*??*/ continue; if (paSyms[iSym].n_type & MACHO_N_PEXT) /*??*/ continue; if (!paSyms[iSym].n_un.n_strx) continue; } /* * Gather symbol info */ /* name */ KLDRMODMACHO_CHECK_RETURN((KU32)paSyms[iSym].n_un.n_strx < cchStrings, KLDR_ERR_MACHO_BAD_SYMBOL); psz = &pchStrings[paSyms[iSym].n_un.n_strx]; cch = kHlpStrLen(psz); if (!cch) psz = NULL; /* kind & value */ fKind = fKindBase; if (paSyms[iSym].n_desc & N_WEAK_DEF) fKind |= KLDRSYMKIND_WEAK; switch (paSyms[iSym].n_type & MACHO_N_TYPE) { case MACHO_N_SECT: { PKLDRMODMACHOSECT pSect; KLDRMODMACHO_CHECK_RETURN((KU32)(paSyms[iSym].n_sect - 1) < pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL); pSect = &pModMachO->paSections[paSyms[iSym].n_sect - 1]; uValue = paSyms[iSym].n_value - pSect->LinkAddress; KLDRMODMACHO_CHECK_RETURN( uValue <= pSect->cb || ( paSyms[iSym].n_sect == 1 /* special hack for __mh_execute_header */ && uValue == 0U - pSect->RVA && pModMachO->uEffFileType != MH_OBJECT), KLDR_ERR_MACHO_BAD_SYMBOL); uValue += BaseAddress + pSect->RVA; if (pSect->fFlags & (S_ATTR_PURE_INSTRUCTIONS | S_ATTR_SELF_MODIFYING_CODE)) fKind |= KLDRSYMKIND_CODE; else fKind |= KLDRSYMKIND_NO_TYPE; break; } case MACHO_N_ABS: uValue = paSyms[iSym].n_value; fKind |= KLDRSYMKIND_NO_TYPE /*KLDRSYMKIND_ABS*/; break; case MACHO_N_PBUD: case MACHO_N_INDR: /** @todo implement indirect and prebound symbols. */ default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); } /* * Do callback. */ rc = pfnCallback(pModMachO->pMod, iSym, psz, cch, NULL, uValue, fKind, pvUser); if (rc) return rc; } return 0; } /** @copydoc kLdrModGetImport */ static int kldrModMachOGetImport(PKLDRMOD pMod, const void *pvBits, KU32 iImport, char *pszName, KSIZE cchName) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; K_NOREF(pvBits); K_NOREF(iImport); K_NOREF(pszName); K_NOREF(cchName); if (pModMachO->Hdr.filetype == MH_OBJECT) return KLDR_ERR_IMPORT_ORDINAL_OUT_OF_BOUNDS; /* later */ return KLDR_ERR_IMPORT_ORDINAL_OUT_OF_BOUNDS; } /** @copydoc kLdrModNumberOfImports */ static KI32 kldrModMachONumberOfImports(PKLDRMOD pMod, const void *pvBits) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; K_NOREF(pvBits); if (pModMachO->Hdr.filetype == MH_OBJECT) return 0; /* later */ return 0; } /** @copydoc kLdrModGetStackInfo */ static int kldrModMachOGetStackInfo(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRSTACKINFO pStackInfo) { /*PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData;*/ K_NOREF(pMod); K_NOREF(pvBits); K_NOREF(BaseAddress); pStackInfo->Address = NIL_KLDRADDR; pStackInfo->LinkAddress = NIL_KLDRADDR; pStackInfo->cbStack = pStackInfo->cbStackThread = 0; /* later */ return 0; } /** @copydoc kLdrModQueryMainEntrypoint */ static int kldrModMachOQueryMainEntrypoint(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRADDR pMainEPAddress) { #if 0 PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; int rc; /* * Resolve base address alias if any. */ rc = kldrModMachOBitsAndBaseAddress(pModMachO, NULL, &BaseAddress); if (rc) return rc; /* * Convert the address from the header. */ *pMainEPAddress = pModMachO->Hdrs.OptionalHeader.AddressOfEntryPoint ? BaseAddress + pModMachO->Hdrs.OptionalHeader.AddressOfEntryPoint : NIL_KLDRADDR; #else *pMainEPAddress = NIL_KLDRADDR; K_NOREF(pvBits); K_NOREF(BaseAddress); K_NOREF(pMod); #endif return 0; } /** @copydoc kLdrModQueryImageUuid */ static int kldrModMachOQueryImageUuid(PKLDRMOD pMod, const void *pvBits, void *pvUuid, KSIZE cbUuid) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; K_NOREF(pvBits); kHlpMemSet(pvUuid, 0, cbUuid); if (kHlpMemComp(pvUuid, pModMachO->abImageUuid, sizeof(pModMachO->abImageUuid)) == 0) return KLDR_ERR_NO_IMAGE_UUID; kHlpMemCopy(pvUuid, pModMachO->abImageUuid, sizeof(pModMachO->abImageUuid)); return 0; } /** @copydoc kLdrModEnumDbgInfo */ static int kldrModMachOEnumDbgInfo(PKLDRMOD pMod, const void *pvBits, PFNKLDRENUMDBG pfnCallback, void *pvUser) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; int rc = 0; KU32 iSect; K_NOREF(pvBits); for (iSect = 0; iSect < pModMachO->cSections; iSect++) { section_32_t *pMachOSect = pModMachO->paSections[iSect].pvMachoSection; /* (32-bit & 64-bit starts the same way) */ char szTmp[sizeof(pMachOSect->sectname) + 1]; if (kHlpStrComp(pMachOSect->segname, "__DWARF")) continue; kHlpMemCopy(szTmp, pMachOSect->sectname, sizeof(pMachOSect->sectname)); szTmp[sizeof(pMachOSect->sectname)] = '\0'; rc = pfnCallback(pMod, iSect, KLDRDBGINFOTYPE_DWARF, 0, 0, szTmp, pModMachO->paSections[iSect].offFile, pModMachO->paSections[iSect].LinkAddress, pModMachO->paSections[iSect].cb, NULL, pvUser); if (rc != 0) break; } return rc; } /** @copydoc kLdrModHasDbgInfo */ static int kldrModMachOHasDbgInfo(PKLDRMOD pMod, const void *pvBits) { /*PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData;*/ #if 0 /* * Base this entirely on the presence of a debug directory. */ if ( pModMachO->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size < sizeof(IMAGE_DEBUG_DIRECTORY) /* screw borland linkers */ || !pModMachO->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress) return KLDR_ERR_NO_DEBUG_INFO; return 0; #else K_NOREF(pMod); K_NOREF(pvBits); return KLDR_ERR_NO_DEBUG_INFO; #endif } /** @copydoc kLdrModMap */ static int kldrModMachOMap(PKLDRMOD pMod) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; unsigned fFixed; KU32 i; void *pvBase; int rc; if (!pModMachO->fCanLoad) return KLDR_ERR_TODO; /* * Already mapped? */ if (pModMachO->pvMapping) return KLDR_ERR_ALREADY_MAPPED; /* * Map it. */ /* fixed image? */ fFixed = pMod->enmType == KLDRTYPE_EXECUTABLE_FIXED || pMod->enmType == KLDRTYPE_SHARED_LIBRARY_FIXED; if (!fFixed) pvBase = NULL; else { pvBase = (void *)(KUPTR)pMod->aSegments[0].LinkAddress; if ((KUPTR)pvBase != pMod->aSegments[0].LinkAddress) return KLDR_ERR_ADDRESS_OVERFLOW; } /* try do the prepare */ rc = kRdrMap(pMod->pRdr, &pvBase, pMod->cSegments, pMod->aSegments, fFixed); if (rc) return rc; /* * Update the segments with their map addresses. */ for (i = 0; i < pMod->cSegments; i++) { if (pMod->aSegments[i].RVA != NIL_KLDRADDR) pMod->aSegments[i].MapAddress = (KUPTR)pvBase + (KUPTR)pMod->aSegments[i].RVA; } pModMachO->pvMapping = pvBase; return 0; } /** @copydoc kLdrModUnmap */ static int kldrModMachOUnmap(PKLDRMOD pMod) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; KU32 i; int rc; /* * Mapped? */ if (!pModMachO->pvMapping) return KLDR_ERR_NOT_MAPPED; /* * Try unmap the image. */ rc = kRdrUnmap(pMod->pRdr, pModMachO->pvMapping, pMod->cSegments, pMod->aSegments); if (rc) return rc; /* * Update the segments to reflect that they aren't mapped any longer. */ pModMachO->pvMapping = NULL; for (i = 0; i < pMod->cSegments; i++) pMod->aSegments[i].MapAddress = 0; return 0; } /** @copydoc kLdrModAllocTLS */ static int kldrModMachOAllocTLS(PKLDRMOD pMod, void *pvMapping) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; /* * Mapped? */ if ( pvMapping == KLDRMOD_INT_MAP && !pModMachO->pvMapping ) return KLDR_ERR_NOT_MAPPED; return 0; } /** @copydoc kLdrModFreeTLS */ static void kldrModMachOFreeTLS(PKLDRMOD pMod, void *pvMapping) { K_NOREF(pMod); K_NOREF(pvMapping); } /** @copydoc kLdrModReload */ static int kldrModMachOReload(PKLDRMOD pMod) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; /* * Mapped? */ if (!pModMachO->pvMapping) return KLDR_ERR_NOT_MAPPED; /* the file provider does it all */ return kRdrRefresh(pMod->pRdr, pModMachO->pvMapping, pMod->cSegments, pMod->aSegments); } /** @copydoc kLdrModFixupMapping */ static int kldrModMachOFixupMapping(PKLDRMOD pMod, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; int rc, rc2; /* * Mapped? */ if (!pModMachO->pvMapping) return KLDR_ERR_NOT_MAPPED; /* * Before doing anything we'll have to make all pages writable. */ rc = kRdrProtect(pMod->pRdr, pModMachO->pvMapping, pMod->cSegments, pMod->aSegments, 1 /* unprotect */); if (rc) return rc; /* * Resolve imports and apply base relocations. */ rc = kldrModMachORelocateBits(pMod, pModMachO->pvMapping, (KUPTR)pModMachO->pvMapping, pModMachO->LinkAddress, pfnGetImport, pvUser); /* * Restore protection. */ rc2 = kRdrProtect(pMod->pRdr, pModMachO->pvMapping, pMod->cSegments, pMod->aSegments, 0 /* protect */); if (!rc && rc2) rc = rc2; return rc; } /** * MH_OBJECT: Resolves undefined symbols (imports). * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModMachO The Mach-O module interpreter instance. * @param pfnGetImport The callback for resolving an imported symbol. * @param pvUser User argument to the callback. */ static int kldrModMachOObjDoImports(PKLDRMODMACHO pModMachO, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { const KU32 cSyms = pModMachO->cSymbols; KU32 iSym; int rc; /* * Ensure that we've got the symbol table and section fixups handy. */ rc = kldrModMachOLoadObjSymTab(pModMachO); if (rc) return rc; /* * Iterate the symbol table and resolve undefined symbols. * We currently ignore REFERENCE_TYPE. */ if ( pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE) { macho_nlist_32_t *paSyms = (macho_nlist_32_t *)pModMachO->pvaSymbols; for (iSym = 0; iSym < cSyms; iSym++) { /* skip stabs */ if (paSyms[iSym].n_type & MACHO_N_STAB) continue; if ((paSyms[iSym].n_type & MACHO_N_TYPE) == MACHO_N_UNDF) { const char *pszSymbol; KSIZE cchSymbol; KU32 fKind = KLDRSYMKIND_REQ_FLAT; KLDRADDR Value = NIL_KLDRADDR; /** @todo Implement N_REF_TO_WEAK. */ KLDRMODMACHO_CHECK_RETURN(!(paSyms[iSym].n_desc & N_REF_TO_WEAK), KLDR_ERR_TODO); /* Get the symbol name. */ KLDRMODMACHO_CHECK_RETURN((KU32)paSyms[iSym].n_un.n_strx < pModMachO->cchStrings, KLDR_ERR_MACHO_BAD_SYMBOL); pszSymbol = &pModMachO->pchStrings[paSyms[iSym].n_un.n_strx]; cchSymbol = kHlpStrLen(pszSymbol); /* Check for linker defined symbols relating to sections and segments. */ if ( cchSymbol > sizeof("section$end$") - 1 && *pszSymbol == 's' && kHlpMemChr(pszSymbol, '$', cchSymbol)) rc = kldrModMachOQueryLinkerSymbol(pModMachO, pModMachO->pMod, pszSymbol, cchSymbol, BaseAddress, &Value); else rc = KLDR_ERR_SYMBOL_NOT_FOUND; /* Ask the user for an address to the symbol. */ if (rc) rc = pfnGetImport(pModMachO->pMod, NIL_KLDRMOD_IMPORT, iSym, pszSymbol, cchSymbol, NULL, &Value, &fKind, pvUser); if (rc) { /* weak reference? */ if (!(paSyms[iSym].n_desc & N_WEAK_REF)) break; Value = 0; } /* Update the symbol. */ paSyms[iSym].n_value = (KU32)Value; if (paSyms[iSym].n_value != Value) { rc = KLDR_ERR_ADDRESS_OVERFLOW; break; } } else if (paSyms[iSym].n_desc & N_WEAK_DEF) { /** @todo implement weak symbols. */ /*return KLDR_ERR_TODO; - ignored for now. */ } } } else { /* (Identical to the 32-bit code, just different paSym type. (and n_strx is unsigned)) */ macho_nlist_64_t *paSyms = (macho_nlist_64_t *)pModMachO->pvaSymbols; for (iSym = 0; iSym < cSyms; iSym++) { /* skip stabs */ if (paSyms[iSym].n_type & MACHO_N_STAB) continue; if ((paSyms[iSym].n_type & MACHO_N_TYPE) == MACHO_N_UNDF) { const char *pszSymbol; KSIZE cchSymbol; KU32 fKind = KLDRSYMKIND_REQ_FLAT; KLDRADDR Value = NIL_KLDRADDR; /** @todo Implement N_REF_TO_WEAK. */ KLDRMODMACHO_CHECK_RETURN(!(paSyms[iSym].n_desc & N_REF_TO_WEAK), KLDR_ERR_TODO); /* Get the symbol name. */ KLDRMODMACHO_CHECK_RETURN(paSyms[iSym].n_un.n_strx < pModMachO->cchStrings, KLDR_ERR_MACHO_BAD_SYMBOL); pszSymbol = &pModMachO->pchStrings[paSyms[iSym].n_un.n_strx]; cchSymbol = kHlpStrLen(pszSymbol); /* Check for linker defined symbols relating to sections and segments. */ if ( cchSymbol > sizeof("section$end$") - 1 && *pszSymbol == 's' && kHlpMemChr(pszSymbol, '$', cchSymbol)) rc = kldrModMachOQueryLinkerSymbol(pModMachO, pModMachO->pMod, pszSymbol, cchSymbol, BaseAddress, &Value); else rc = KLDR_ERR_SYMBOL_NOT_FOUND; /* Ask the user for an address to the symbol. */ if (rc) rc = pfnGetImport(pModMachO->pMod, NIL_KLDRMOD_IMPORT, iSym, pszSymbol, cchSymbol, NULL, &Value, &fKind, pvUser); if (rc) { /* weak reference? */ if (!(paSyms[iSym].n_desc & N_WEAK_REF)) break; Value = 0; } /* Update the symbol. */ paSyms[iSym].n_value = Value; if (paSyms[iSym].n_value != Value) { rc = KLDR_ERR_ADDRESS_OVERFLOW; break; } } else if (paSyms[iSym].n_desc & N_WEAK_DEF) { /** @todo implement weak symbols. */ /*return KLDR_ERR_TODO; - ignored for now. */ } } } return rc; } /** * MH_OBJECT: Applies base relocations to a (unprotected) image mapping. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModMachO The Mach-O module interpreter instance. * @param pvMapping The mapping to fixup. * @param NewBaseAddress The address to fixup the mapping to. * @param OldBaseAddress The address the mapping is currently fixed up to. */ static int kldrModMachOObjDoFixups(PKLDRMODMACHO pModMachO, void *pvMapping, KLDRADDR NewBaseAddress) { KU32 iSeg; int rc; /* * Ensure that we've got the symbol table and section fixups handy. */ rc = kldrModMachOLoadObjSymTab(pModMachO); if (rc) return rc; /* * Iterate over the segments and their sections and apply fixups. */ for (iSeg = rc = 0; !rc && iSeg < pModMachO->pMod->cSegments; iSeg++) { PKLDRMODMACHOSEG pSeg = &pModMachO->aSegments[iSeg]; KU32 iSect; for (iSect = 0; iSect < pSeg->cSections; iSect++) { PKLDRMODMACHOSECT pSect = &pSeg->paSections[iSect]; KU8 *pbSectBits; /* skip sections without fixups. */ if (!pSect->cFixups) continue; /* lazy load (and endian convert) the fixups. */ if (!pSect->paFixups) { rc = kldrModMachOLoadFixups(pModMachO, pSect->offFixups, pSect->cFixups, &pSect->paFixups); if (rc) break; } /* * Apply the fixups. */ pbSectBits = (KU8 *)pvMapping + (KUPTR)pSect->RVA; if (pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE) /** @todo this aint right. */ rc = kldrModMachOFixupSectionGeneric32Bit(pModMachO, pbSectBits, pSect, (macho_nlist_32_t *)pModMachO->pvaSymbols, pModMachO->cSymbols, NewBaseAddress); else if ( pModMachO->Hdr.magic == IMAGE_MACHO64_SIGNATURE && pModMachO->Hdr.cputype == CPU_TYPE_X86_64) rc = kldrModMachOFixupSectionAMD64(pModMachO, pbSectBits, pSect, (macho_nlist_64_t *)pModMachO->pvaSymbols, pModMachO->cSymbols, NewBaseAddress); else KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); if (rc) break; } } return rc; } /** * Applies generic fixups to a section in an image of the same endian-ness * as the host CPU. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModMachO The Mach-O module interpreter instance. * @param pbSectBits Pointer to the section bits. * @param pFixupSect The section being fixed up. * @param NewBaseAddress The new base image address. */ static int kldrModMachOFixupSectionGeneric32Bit(PKLDRMODMACHO pModMachO, KU8 *pbSectBits, PKLDRMODMACHOSECT pFixupSect, macho_nlist_32_t *paSyms, KU32 cSyms, KLDRADDR NewBaseAddress) { const macho_relocation_info_t *paFixups = pFixupSect->paFixups; const KU32 cFixups = pFixupSect->cFixups; KSIZE cbSectBits = (KSIZE)pFixupSect->cb; const KU8 *pbSectVirginBits; KU32 iFixup; KLDRPU uFixVirgin; KLDRPU uFix; KLDRADDR SymAddr = ~(KLDRADDR)0; int rc; /* * Find the virgin bits. */ if (pFixupSect->offFile != -1) { rc = kldrModMachOMapVirginBits(pModMachO); if (rc) return rc; pbSectVirginBits = (const KU8 *)pModMachO->pvBits + pFixupSect->offFile; } else pbSectVirginBits = NULL; /* * Iterate the fixups and apply them. */ for (iFixup = 0; iFixup < cFixups; iFixup++) { union { macho_relocation_info_t r; scattered_relocation_info_t s; } Fixup; Fixup.r = paFixups[iFixup]; if (!(Fixup.r.r_address & R_SCATTERED)) { /* sanity */ if ((KU32)Fixup.r.r_address >= cbSectBits) return KLDR_ERR_BAD_FIXUP; /* calc fixup addresses. */ uFix.pv = pbSectBits + Fixup.r.r_address; uFixVirgin.pv = pbSectVirginBits ? (KU8 *)pbSectVirginBits + Fixup.r.r_address : 0; /* * Calc the symbol value. */ /* Calc the linked symbol address / addend. */ switch (Fixup.r.r_length) { /** @todo Deal with unaligned accesses on non x86 platforms. */ case 0: SymAddr = *uFixVirgin.pi8; break; case 1: SymAddr = *uFixVirgin.pi16; break; case 2: SymAddr = *uFixVirgin.pi32; break; case 3: SymAddr = *uFixVirgin.pi64; break; } if (Fixup.r.r_pcrel) SymAddr += Fixup.r.r_address + pFixupSect->LinkAddress; /* Add symbol / section address. */ if (Fixup.r.r_extern) { const macho_nlist_32_t *pSym; if (Fixup.r.r_symbolnum >= cSyms) return KLDR_ERR_BAD_FIXUP; pSym = &paSyms[Fixup.r.r_symbolnum]; if (pSym->n_type & MACHO_N_STAB) return KLDR_ERR_BAD_FIXUP; switch (pSym->n_type & MACHO_N_TYPE) { case MACHO_N_SECT: { PKLDRMODMACHOSECT pSymSect; KLDRMODMACHO_CHECK_RETURN((KU32)pSym->n_sect - 1 <= pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL); pSymSect = &pModMachO->paSections[pSym->n_sect - 1]; SymAddr += pSym->n_value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress; break; } case MACHO_N_UNDF: case MACHO_N_ABS: SymAddr += pSym->n_value; break; case MACHO_N_INDR: case MACHO_N_PBUD: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_SYMBOL); } } else if (Fixup.r.r_symbolnum != R_ABS) { PKLDRMODMACHOSECT pSymSect; if (Fixup.r.r_symbolnum > pModMachO->cSections) return KLDR_ERR_BAD_FIXUP; pSymSect = &pModMachO->paSections[Fixup.r.r_symbolnum - 1]; SymAddr -= pSymSect->LinkAddress; SymAddr += pSymSect->RVA + NewBaseAddress; } /* adjust for PC relative */ if (Fixup.r.r_pcrel) SymAddr -= Fixup.r.r_address + pFixupSect->RVA + NewBaseAddress; } else { PKLDRMODMACHOSECT pSymSect; KU32 iSymSect; KLDRADDR Value; /* sanity */ KLDRMODMACHO_ASSERT(Fixup.s.r_scattered); if ((KU32)Fixup.s.r_address >= cbSectBits) return KLDR_ERR_BAD_FIXUP; /* calc fixup addresses. */ uFix.pv = pbSectBits + Fixup.s.r_address; uFixVirgin.pv = pbSectVirginBits ? (KU8 *)pbSectVirginBits + Fixup.s.r_address : 0; /* * Calc the symbol value. */ /* The addend is stored in the code. */ switch (Fixup.s.r_length) { case 0: SymAddr = *uFixVirgin.pi8; break; case 1: SymAddr = *uFixVirgin.pi16; break; case 2: SymAddr = *uFixVirgin.pi32; break; case 3: SymAddr = *uFixVirgin.pi64; break; } if (Fixup.s.r_pcrel) SymAddr += Fixup.s.r_address; Value = Fixup.s.r_value; SymAddr -= Value; /* (-> addend only) */ /* Find the section number from the r_value. */ pSymSect = NULL; for (iSymSect = 0; iSymSect < pModMachO->cSections; iSymSect++) { KLDRADDR off = Value - pModMachO->paSections[iSymSect].LinkAddress; if (off < pModMachO->paSections[iSymSect].cb) { pSymSect = &pModMachO->paSections[iSymSect]; break; } else if (off == pModMachO->paSections[iSymSect].cb) /* edge case */ pSymSect = &pModMachO->paSections[iSymSect]; } if (!pSymSect) return KLDR_ERR_BAD_FIXUP; /* Calc the symbol address. */ SymAddr += Value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress; if (Fixup.s.r_pcrel) SymAddr -= Fixup.s.r_address + pFixupSect->RVA + NewBaseAddress; Fixup.r.r_length = ((scattered_relocation_info_t *)&paFixups[iFixup])->r_length; Fixup.r.r_type = ((scattered_relocation_info_t *)&paFixups[iFixup])->r_type; } /* * Write back the fixed up value. */ if (Fixup.r.r_type == GENERIC_RELOC_VANILLA) { switch (Fixup.r.r_length) { case 0: *uFix.pu8 = (KU8)SymAddr; break; case 1: *uFix.pu16 = (KU16)SymAddr; break; case 2: *uFix.pu32 = (KU32)SymAddr; break; case 3: *uFix.pu64 = (KU64)SymAddr; break; } } else if (Fixup.r.r_type <= GENERIC_RELOC_LOCAL_SECTDIFF) return KLDR_ERR_MACHO_UNSUPPORTED_FIXUP_TYPE; else return KLDR_ERR_BAD_FIXUP; } return 0; } /** * Applies AMD64 fixups to a section. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModMachO The Mach-O module interpreter instance. * @param pbSectBits Pointer to the section bits. * @param pFixupSect The section being fixed up. * @param NewBaseAddress The new base image address. */ static int kldrModMachOFixupSectionAMD64(PKLDRMODMACHO pModMachO, KU8 *pbSectBits, PKLDRMODMACHOSECT pFixupSect, macho_nlist_64_t *paSyms, KU32 cSyms, KLDRADDR NewBaseAddress) { const macho_relocation_info_t *paFixups = pFixupSect->paFixups; const KU32 cFixups = pFixupSect->cFixups; KSIZE cbSectBits = (KSIZE)pFixupSect->cb; const KU8 *pbSectVirginBits; KU32 iFixup; KLDRPU uFixVirgin; KLDRPU uFix; KLDRADDR SymAddr; int rc; /* * Find the virgin bits. */ if (pFixupSect->offFile != -1) { rc = kldrModMachOMapVirginBits(pModMachO); if (rc) return rc; pbSectVirginBits = (const KU8 *)pModMachO->pvBits + pFixupSect->offFile; } else pbSectVirginBits = NULL; /* * Iterate the fixups and apply them. */ for (iFixup = 0; iFixup < cFixups; iFixup++) { union { macho_relocation_info_t r; scattered_relocation_info_t s; } Fixup; Fixup.r = paFixups[iFixup]; /* AMD64 doesn't use scattered fixups. */ KLDRMODMACHO_CHECK_RETURN(!(Fixup.r.r_address & R_SCATTERED), KLDR_ERR_BAD_FIXUP); /* sanity */ KLDRMODMACHO_CHECK_RETURN((KU32)Fixup.r.r_address < cbSectBits, KLDR_ERR_BAD_FIXUP); /* calc fixup addresses. */ uFix.pv = pbSectBits + Fixup.r.r_address; uFixVirgin.pv = pbSectVirginBits ? (KU8 *)pbSectVirginBits + Fixup.r.r_address : 0; /* * Calc the symbol value. */ /* Calc the linked symbol address / addend. */ switch (Fixup.r.r_length) { /** @todo Deal with unaligned accesses on non x86 platforms. */ case 2: SymAddr = *uFixVirgin.pi32; break; case 3: SymAddr = *uFixVirgin.pi64; break; default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_BAD_FIXUP); } /* Add symbol / section address. */ if (Fixup.r.r_extern) { const macho_nlist_64_t *pSym; KLDRMODMACHO_CHECK_RETURN(Fixup.r.r_symbolnum < cSyms, KLDR_ERR_BAD_FIXUP); pSym = &paSyms[Fixup.r.r_symbolnum]; KLDRMODMACHO_CHECK_RETURN(!(pSym->n_type & MACHO_N_STAB), KLDR_ERR_BAD_FIXUP); switch (Fixup.r.r_type) { /* GOT references just needs to have their symbol verified. Later, we'll optimize GOT building here using a parallel sym->got array. */ case X86_64_RELOC_GOT_LOAD: case X86_64_RELOC_GOT: switch (pSym->n_type & MACHO_N_TYPE) { case MACHO_N_SECT: case MACHO_N_UNDF: case MACHO_N_ABS: break; case MACHO_N_INDR: case MACHO_N_PBUD: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_SYMBOL); } SymAddr = sizeof(KU64) * Fixup.r.r_symbolnum + pModMachO->GotRVA + NewBaseAddress; KLDRMODMACHO_CHECK_RETURN(Fixup.r.r_length == 2, KLDR_ERR_BAD_FIXUP); SymAddr -= 4; break; /* Verify the r_pcrel field for signed fixups on the way into the default case. */ case X86_64_RELOC_BRANCH: case X86_64_RELOC_SIGNED: case X86_64_RELOC_SIGNED_1: case X86_64_RELOC_SIGNED_2: case X86_64_RELOC_SIGNED_4: KLDRMODMACHO_CHECK_RETURN(Fixup.r.r_pcrel, KLDR_ERR_BAD_FIXUP); /* Falls through. */ default: { /* Adjust with fixup specific addend and vierfy unsigned/r_pcrel. */ switch (Fixup.r.r_type) { case X86_64_RELOC_UNSIGNED: KLDRMODMACHO_CHECK_RETURN(!Fixup.r.r_pcrel, KLDR_ERR_BAD_FIXUP); break; case X86_64_RELOC_BRANCH: KLDRMODMACHO_CHECK_RETURN(Fixup.r.r_length == 2, KLDR_ERR_BAD_FIXUP); SymAddr -= 4; break; case X86_64_RELOC_SIGNED: case X86_64_RELOC_SIGNED_1: case X86_64_RELOC_SIGNED_2: case X86_64_RELOC_SIGNED_4: SymAddr -= 4; break; default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_BAD_FIXUP); } switch (pSym->n_type & MACHO_N_TYPE) { case MACHO_N_SECT: { PKLDRMODMACHOSECT pSymSect; KLDRMODMACHO_CHECK_RETURN((KU32)pSym->n_sect - 1 <= pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL); pSymSect = &pModMachO->paSections[pSym->n_sect - 1]; SymAddr += pSym->n_value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress; break; } case MACHO_N_UNDF: /* branch to an external symbol may have to take a short detour. */ if ( Fixup.r.r_type == X86_64_RELOC_BRANCH && SymAddr + Fixup.r.r_address + pFixupSect->RVA + NewBaseAddress - pSym->n_value + KU64_C(0x80000000) >= KU64_C(0xffffff20)) SymAddr += pModMachO->cbJmpStub * Fixup.r.r_symbolnum + pModMachO->JmpStubsRVA + NewBaseAddress; else SymAddr += pSym->n_value; break; case MACHO_N_ABS: SymAddr += pSym->n_value; break; case MACHO_N_INDR: case MACHO_N_PBUD: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_SYMBOL); } break; } /* * This is a weird customer, it will always be follows by an UNSIGNED fixup. */ case X86_64_RELOC_SUBTRACTOR: { macho_relocation_info_t Fixup2; /* Deal with the SUBTRACT symbol first, by subtracting it from SymAddr. */ switch (pSym->n_type & MACHO_N_TYPE) { case MACHO_N_SECT: { PKLDRMODMACHOSECT pSymSect; KLDRMODMACHO_CHECK_RETURN((KU32)pSym->n_sect - 1 <= pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL); pSymSect = &pModMachO->paSections[pSym->n_sect - 1]; SymAddr -= pSym->n_value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress; break; } case MACHO_N_UNDF: case MACHO_N_ABS: SymAddr -= pSym->n_value; break; case MACHO_N_INDR: case MACHO_N_PBUD: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_SYMBOL); } /* Load the 2nd fixup, check sanity. */ iFixup++; KLDRMODMACHO_CHECK_RETURN(!Fixup.r.r_pcrel && iFixup < cFixups, KLDR_ERR_BAD_FIXUP); Fixup2 = paFixups[iFixup]; KLDRMODMACHO_CHECK_RETURN( Fixup2.r_address == Fixup.r.r_address && Fixup2.r_length == Fixup.r.r_length && Fixup2.r_type == X86_64_RELOC_UNSIGNED && !Fixup2.r_pcrel && Fixup2.r_symbolnum < cSyms, KLDR_ERR_BAD_FIXUP); if (Fixup2.r_extern) { KLDRMODMACHO_CHECK_RETURN(Fixup2.r_symbolnum < cSyms, KLDR_ERR_BAD_FIXUP); pSym = &paSyms[Fixup2.r_symbolnum]; KLDRMODMACHO_CHECK_RETURN(!(pSym->n_type & MACHO_N_STAB), KLDR_ERR_BAD_FIXUP); /* Add it's value to SymAddr. */ switch (pSym->n_type & MACHO_N_TYPE) { case MACHO_N_SECT: { PKLDRMODMACHOSECT pSymSect; KLDRMODMACHO_CHECK_RETURN((KU32)pSym->n_sect - 1 <= pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL); pSymSect = &pModMachO->paSections[pSym->n_sect - 1]; SymAddr += pSym->n_value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress; break; } case MACHO_N_UNDF: case MACHO_N_ABS: SymAddr += pSym->n_value; break; case MACHO_N_INDR: case MACHO_N_PBUD: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_MACHO_BAD_SYMBOL); } } else if (Fixup2.r_symbolnum != R_ABS) { PKLDRMODMACHOSECT pSymSect; KLDRMODMACHO_CHECK_RETURN(Fixup2.r_symbolnum <= pModMachO->cSections, KLDR_ERR_BAD_FIXUP); pSymSect = &pModMachO->paSections[Fixup2.r_symbolnum - 1]; SymAddr += pSymSect->RVA + NewBaseAddress; } else KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_BAD_FIXUP); } break; } } else { /* verify against fixup type and make adjustments */ switch (Fixup.r.r_type) { case X86_64_RELOC_UNSIGNED: KLDRMODMACHO_CHECK_RETURN(!Fixup.r.r_pcrel, KLDR_ERR_BAD_FIXUP); break; case X86_64_RELOC_BRANCH: KLDRMODMACHO_CHECK_RETURN(Fixup.r.r_pcrel, KLDR_ERR_BAD_FIXUP); SymAddr += 4; /* dunno what the assmbler/linker really is doing here... */ break; case X86_64_RELOC_SIGNED: case X86_64_RELOC_SIGNED_1: case X86_64_RELOC_SIGNED_2: case X86_64_RELOC_SIGNED_4: KLDRMODMACHO_CHECK_RETURN(Fixup.r.r_pcrel, KLDR_ERR_BAD_FIXUP); break; /*case X86_64_RELOC_GOT_LOAD:*/ /*case X86_64_RELOC_GOT: */ /*case X86_64_RELOC_SUBTRACTOR: - must be r_extern=1 says as. */ default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_BAD_FIXUP); } if (Fixup.r.r_symbolnum != R_ABS) { PKLDRMODMACHOSECT pSymSect; KLDRMODMACHO_CHECK_RETURN(Fixup.r.r_symbolnum <= pModMachO->cSections, KLDR_ERR_BAD_FIXUP); pSymSect = &pModMachO->paSections[Fixup.r.r_symbolnum - 1]; SymAddr -= pSymSect->LinkAddress; SymAddr += pSymSect->RVA + NewBaseAddress; if (Fixup.r.r_pcrel) SymAddr += Fixup.r.r_address; } } /* adjust for PC relative */ if (Fixup.r.r_pcrel) SymAddr -= Fixup.r.r_address + pFixupSect->RVA + NewBaseAddress; /* * Write back the fixed up value. */ switch (Fixup.r.r_length) { case 3: *uFix.pu64 = (KU64)SymAddr; break; case 2: KLDRMODMACHO_CHECK_RETURN(Fixup.r.r_pcrel || Fixup.r.r_type == X86_64_RELOC_SUBTRACTOR, KLDR_ERR_BAD_FIXUP); KLDRMODMACHO_CHECK_RETURN((KI32)SymAddr == (KI64)SymAddr, KLDR_ERR_ADDRESS_OVERFLOW); *uFix.pu32 = (KU32)SymAddr; break; default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_BAD_FIXUP); } } return 0; } /** * Loads the symbol table for a MH_OBJECT file. * * The symbol table is pointed to by KLDRMODMACHO::pvaSymbols. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModMachO The Mach-O module interpreter instance. */ static int kldrModMachOLoadObjSymTab(PKLDRMODMACHO pModMachO) { int rc = 0; if ( !pModMachO->pvaSymbols && pModMachO->cSymbols) { KSIZE cbSyms; KSIZE cbSym; void *pvSyms; void *pvStrings; /* sanity */ KLDRMODMACHO_CHECK_RETURN( pModMachO->offSymbols && (!pModMachO->cchStrings || pModMachO->offStrings), KLDR_ERR_MACHO_BAD_OBJECT_FILE); /* allocate */ cbSym = pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE ? sizeof(macho_nlist_32_t) : sizeof(macho_nlist_64_t); cbSyms = pModMachO->cSymbols * cbSym; KLDRMODMACHO_CHECK_RETURN(cbSyms / cbSym == pModMachO->cSymbols, KLDR_ERR_SIZE_OVERFLOW); rc = KERR_NO_MEMORY; pvSyms = kHlpAlloc(cbSyms); if (pvSyms) { if (pModMachO->cchStrings) pvStrings = kHlpAlloc(pModMachO->cchStrings); else pvStrings = kHlpAllocZ(4); if (pvStrings) { /* read */ rc = kRdrRead(pModMachO->pMod->pRdr, pvSyms, cbSyms, pModMachO->offSymbols); if (!rc && pModMachO->cchStrings) rc = kRdrRead(pModMachO->pMod->pRdr, pvStrings, pModMachO->cchStrings, pModMachO->offStrings); if (!rc) { pModMachO->pvaSymbols = pvSyms; pModMachO->pchStrings = (char *)pvStrings; /* perform endian conversion? */ if (pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE) { KU32 cLeft = pModMachO->cSymbols; macho_nlist_32_t *pSym = (macho_nlist_32_t *)pvSyms; while (cLeft-- > 0) { pSym->n_un.n_strx = K_E2E_U32(pSym->n_un.n_strx); pSym->n_desc = (KI16)K_E2E_U16(pSym->n_desc); pSym->n_value = K_E2E_U32(pSym->n_value); pSym++; } } else if (pModMachO->Hdr.magic == IMAGE_MACHO64_SIGNATURE_OE) { KU32 cLeft = pModMachO->cSymbols; macho_nlist_64_t *pSym = (macho_nlist_64_t *)pvSyms; while (cLeft-- > 0) { pSym->n_un.n_strx = K_E2E_U32(pSym->n_un.n_strx); pSym->n_desc = (KI16)K_E2E_U16(pSym->n_desc); pSym->n_value = K_E2E_U64(pSym->n_value); pSym++; } } return 0; } kHlpFree(pvStrings); } kHlpFree(pvSyms); } } else KLDRMODMACHO_ASSERT(pModMachO->pchStrings || pModMachO->Hdr.filetype == MH_DSYM); return rc; } /** * Loads the fixups at the given address and performs endian * conversion if necessary. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModMachO The Mach-O module interpreter instance. * @param offFixups The file offset of the fixups. * @param cFixups The number of fixups to load. * @param ppaFixups Where to put the pointer to the allocated fixup array. */ static int kldrModMachOLoadFixups(PKLDRMODMACHO pModMachO, KLDRFOFF offFixups, KU32 cFixups, macho_relocation_info_t **ppaFixups) { macho_relocation_info_t *paFixups; KSIZE cbFixups; int rc; /* allocate the memory. */ cbFixups = cFixups * sizeof(*paFixups); KLDRMODMACHO_CHECK_RETURN(cbFixups / sizeof(*paFixups) == cFixups, KLDR_ERR_SIZE_OVERFLOW); paFixups = (macho_relocation_info_t *)kHlpAlloc(cbFixups); if (!paFixups) return KERR_NO_MEMORY; /* read the fixups. */ rc = kRdrRead(pModMachO->pMod->pRdr, paFixups, cbFixups, offFixups); if (!rc) { *ppaFixups = paFixups; /* do endian conversion if necessary. */ if ( pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE || pModMachO->Hdr.magic == IMAGE_MACHO64_SIGNATURE_OE) { KU32 iFixup; for (iFixup = 0; iFixup < cFixups; iFixup++) { KU32 *pu32 = (KU32 *)&paFixups[iFixup]; pu32[0] = K_E2E_U32(pu32[0]); pu32[1] = K_E2E_U32(pu32[1]); } } } else kHlpFree(paFixups); return rc; } /** * Maps the virgin file bits into memory if not already done. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModMachO The Mach-O module interpreter instance. */ static int kldrModMachOMapVirginBits(PKLDRMODMACHO pModMachO) { int rc = 0; if (!pModMachO->pvBits) rc = kRdrAllMap(pModMachO->pMod->pRdr, &pModMachO->pvBits); return rc; } /** @copydoc kLdrModCallInit */ static int kldrModMachOCallInit(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle) { /* later */ K_NOREF(pMod); K_NOREF(pvMapping); K_NOREF(uHandle); return 0; } /** @copydoc kLdrModCallTerm */ static int kldrModMachOCallTerm(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle) { /* later */ K_NOREF(pMod); K_NOREF(pvMapping); K_NOREF(uHandle); return 0; } /** @copydoc kLdrModCallThread */ static int kldrModMachOCallThread(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle, unsigned fAttachingOrDetaching) { /* Relevant for Mach-O? */ K_NOREF(pMod); K_NOREF(pvMapping); K_NOREF(uHandle); K_NOREF(fAttachingOrDetaching); return 0; } /** @copydoc kLdrModSize */ static KLDRADDR kldrModMachOSize(PKLDRMOD pMod) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; return pModMachO->cbImage; } /** @copydoc kLdrModGetBits */ static int kldrModMachOGetBits(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; KU32 i; int rc; if (!pModMachO->fCanLoad) return KLDR_ERR_TODO; /* * Zero the entire buffer first to simplify things. */ kHlpMemSet(pvBits, 0, (KSIZE)pModMachO->cbImage); /* * When possible use the segment table to load the data. */ for (i = 0; i < pMod->cSegments; i++) { /* skip it? */ if ( pMod->aSegments[i].cbFile == -1 || pMod->aSegments[i].offFile == -1 || pMod->aSegments[i].LinkAddress == NIL_KLDRADDR || !pMod->aSegments[i].Alignment) continue; rc = kRdrRead(pMod->pRdr, (KU8 *)pvBits + pMod->aSegments[i].RVA, pMod->aSegments[i].cbFile, pMod->aSegments[i].offFile); if (rc) return rc; } /* * Perform relocations. */ return kldrModMachORelocateBits(pMod, pvBits, BaseAddress, pModMachO->LinkAddress, pfnGetImport, pvUser); } /** @copydoc kLdrModRelocateBits */ static int kldrModMachORelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMODMACHO pModMachO = (PKLDRMODMACHO)pMod->pvData; int rc; K_NOREF(OldBaseAddress); /* * Call workers to do the jobs. */ if (pModMachO->Hdr.filetype == MH_OBJECT) { rc = kldrModMachOObjDoImports(pModMachO, NewBaseAddress, pfnGetImport, pvUser); if (!rc) rc = kldrModMachOObjDoFixups(pModMachO, pvBits, NewBaseAddress); } else rc = KLDR_ERR_TODO; /*{ rc = kldrModMachODoFixups(pModMachO, pvBits, NewBaseAddress, OldBaseAddress, pfnGetImport, pvUser); if (!rc) rc = kldrModMachODoImports(pModMachO, pvBits, pfnGetImport, pvUser); }*/ /* * Construct the global offset table if necessary, it's always the last * segment when present. */ if (!rc && pModMachO->fMakeGot) rc = kldrModMachOMakeGOT(pModMachO, pvBits, NewBaseAddress); return rc; } /** * Builds the GOT. * * Assumes the symbol table has all external symbols resolved correctly and that * the bits has been cleared up front. */ static int kldrModMachOMakeGOT(PKLDRMODMACHO pModMachO, void *pvBits, KLDRADDR NewBaseAddress) { KU32 iSym = pModMachO->cSymbols; if ( pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE || pModMachO->Hdr.magic == IMAGE_MACHO32_SIGNATURE_OE) { macho_nlist_32_t const *paSyms = (macho_nlist_32_t const *)pModMachO->pvaSymbols; KU32 *paGOT = (KU32 *)((KU8 *)pvBits + pModMachO->GotRVA); while (iSym-- > 0) switch (paSyms[iSym].n_type & MACHO_N_TYPE) { case MACHO_N_SECT: { PKLDRMODMACHOSECT pSymSect; KLDRMODMACHO_CHECK_RETURN((KU32)paSyms[iSym].n_sect - 1 <= pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL); pSymSect = &pModMachO->paSections[paSyms[iSym].n_sect - 1]; paGOT[iSym] = (KU32)(paSyms[iSym].n_value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress); break; } case MACHO_N_UNDF: case MACHO_N_ABS: paGOT[iSym] = paSyms[iSym].n_value; break; } } else { macho_nlist_64_t const *paSyms = (macho_nlist_64_t const *)pModMachO->pvaSymbols; KU64 *paGOT = (KU64 *)((KU8 *)pvBits + pModMachO->GotRVA); while (iSym-- > 0) { switch (paSyms[iSym].n_type & MACHO_N_TYPE) { case MACHO_N_SECT: { PKLDRMODMACHOSECT pSymSect; KLDRMODMACHO_CHECK_RETURN((KU32)paSyms[iSym].n_sect - 1 <= pModMachO->cSections, KLDR_ERR_MACHO_BAD_SYMBOL); pSymSect = &pModMachO->paSections[paSyms[iSym].n_sect - 1]; paGOT[iSym] = paSyms[iSym].n_value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress; break; } case MACHO_N_UNDF: case MACHO_N_ABS: paGOT[iSym] = paSyms[iSym].n_value; break; } } if (pModMachO->JmpStubsRVA != NIL_KLDRADDR) { iSym = pModMachO->cSymbols; switch (pModMachO->Hdr.cputype) { /* * AMD64 is simple since the GOT and the indirect jmps are parallel * arrays with entries of the same size. The relative offset will * be the the same for each entry, kind of nice. :-) */ case CPU_TYPE_X86_64: { KU64 *paJmps = (KU64 *)((KU8 *)pvBits + pModMachO->JmpStubsRVA); KI32 off; KU64 u64Tmpl; union { KU8 ab[8]; KU64 u64; } Tmpl; /* create the template. */ off = (KI32)(pModMachO->GotRVA - (pModMachO->JmpStubsRVA + 6)); Tmpl.ab[0] = 0xff; /* jmp [GOT-entry wrt RIP] */ Tmpl.ab[1] = 0x25; Tmpl.ab[2] = off & 0xff; Tmpl.ab[3] = (off >> 8) & 0xff; Tmpl.ab[4] = (off >> 16) & 0xff; Tmpl.ab[5] = (off >> 24) & 0xff; Tmpl.ab[6] = 0xcc; Tmpl.ab[7] = 0xcc; u64Tmpl = Tmpl.u64; /* copy the template to every jmp table entry. */ while (iSym-- > 0) paJmps[iSym] = u64Tmpl; break; } default: KLDRMODMACHO_FAILED_RETURN(KLDR_ERR_TODO); } } } return 0; } /** * The Mach-O module interpreter method table. */ KLDRMODOPS g_kLdrModMachOOps = { "Mach-O", NULL, kldrModMachOCreate, kldrModMachODestroy, kldrModMachOQuerySymbol, kldrModMachOEnumSymbols, kldrModMachOGetImport, kldrModMachONumberOfImports, NULL /* can execute one is optional */, kldrModMachOGetStackInfo, kldrModMachOQueryMainEntrypoint, kldrModMachOQueryImageUuid, NULL, NULL, kldrModMachOEnumDbgInfo, kldrModMachOHasDbgInfo, kldrModMachOMap, kldrModMachOUnmap, kldrModMachOAllocTLS, kldrModMachOFreeTLS, kldrModMachOReload, kldrModMachOFixupMapping, kldrModMachOCallInit, kldrModMachOCallTerm, kldrModMachOCallThread, kldrModMachOSize, kldrModMachOGetBits, kldrModMachORelocateBits, NULL, /** @todo mostly done */ 42 /* the end */ }; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/tg/�����������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�017031� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/tg/kLdr.tws���������������������������������������������������������0000664�0001750�0001750�00000000254�14670377514�020465� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������workspace.diagram.active = <oiref:design#Class#id83t9setug73fpetug74ah.diagram:oiref> workspace.diagram.open.0 = <oiref:design#Class#id83t9setug73fpetug74ah.diagram:oiref> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/tg/KLDRSTATE.gif����������������������������������������������������0000664�0001750�0001750�00000033726�14670377514�021070� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������GIF89adf÷�����ÿÿÿ��€���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������,����df�þ�H° Áƒ*\Ȱ¡Ã‡@œH±¢Å‹3jÜȱ£Ç CŠI²¤É“¨\‰²¥Ë—0cÊœI³¦Í›8G®Ü©2§ÏŸ@ƒ J´¨Ñš<y]Ê´©Ó§P£J˜TéÔ«X³jÝʵ+ê;½ŠK¶¬Ù³:Á²D˶­Û·p·ªí·®Ý»x󶜫·¯ß¿€T+¸°áȽ‚M̸±ãÇBÃBžL¹²e’/kÞ̹³ÂÌžC‹í4éÓ¨Sß5­ºµë×]YÞM»¶QÙ¶sëÞ7ïßÀƒsô-¼¸ñã ‰#_Î<¸òæÐ£Ï~.½ºõÑÔ¯kß^9;÷ïàþ{O¾|ÞñæÓ«g‹~½û÷WMˇO¿~ÖùÛÛßÏß&èÿý(àP� ¤ß€&Rf *èàƒ/5ÀVhaCRxá†$ч†(bD–8â‰(´VŠ,¦¸b‹0ЍaŒ47×8æ¨#_5öèÙŒþù(äe@ÞTäHºu¤‘I6)^JtÑ´¤“TÊ¥Q3 @•\ž—k F9a”N9e—h:$˜f˜_›·ešt²÷eAšX –_ÎYçŸd­‰gœ„ZÅ'FZú è¢V":¨‰zöfJ(Êè¥S‰%]yv*§¥˜†ª&”ó‰¹â¡%*êªOé¡Lþª²úç™ â–çgª(’«Å*+fŠëWÂJÊ•¯¿VÙÓdŽé¡˜o®uª°/.[ì£rUš,—µR g¤×î9©›…~›ë«Çj»-•â–ë’Û.¤¾ñŠ”ºë69¯§c¾Ho~Ò*Ù¦Ù+%¾ù"¹¯·ç¢ .¸·2Üp›;VlñÅ7"œ°Ýþëñ¡írún†¨^‹²s "Å“Ò íÈ+wjjÌÉŦqÊùLœÁYÞŒóº¼*Ç3¬>ÿl´N6ƒzôÒ Ý[ÑLG}eÒRWí‘Ó0¡lõÖa!Ô\ÓˆñØd{í’Öa÷hvªT§­pQkŸ”¨ÒnÇw×é‚]·þ‹·i57Ý{³x·Eƒ7]©ÞŸX8ÞRý xâ(.Þµä©:¹”S$@Ùœ“}øç—«ýÔ礗nú騧®zê¡cÕê°—îx촷α_™Ûbî9ñ®û†¾3ù{ÂÁ9|θ|_Å+¯`óR:¿-ôYJŸ,õ°Zÿ+ö½1Ýù÷à‡/þøä—Ý{òKs¿\ðêGè½è8µöû5²þÑòg?óô‹}>ÿ郟ðô’?P8û« ~L¶ªNlwÿS Ã*P7 ” Ä¦×² b0‚ôÐ:£ j0b|˜à@xBnï]+ŒŸ—T8BFŽ…\YÊ@äÁݘ0‡þ|¡[ôC¾ŒxG¼¡ ˜D 5qDE ¡ÑzÈ›(¥|X¬Êu²ÈÅ,†ÇŠ?¡bË #Æ]Œ8lUtʈ4î q€ñi1ãÆ4ú=lj#‰³¤¤ ‹"Ù¡ÕvÞˆ”ˆ0‹ŽTyÜS‚-cCWSäq½^’eqjÖÌä3Ä^ñq8Øš&Gé,fq2ˆŒ³%«çI2LdÎzɺ&ÉÚôñQ!—.c2Wii‹v ¦®\‰Ë]Êrƒ½ª%múh•!ó˜Îtaª”éa‘XÄì¿ö4°1&“š¯¹e± %±n ,`Ò$âhMã9Ä•Û4& Kö•uN”$þ,æÈ^éH_ÚÓFí,¤'!ö-Xt—OLÎ?ÉÏrîSO³ŒfB¹Ð*´’ï„Y¤4ÉÉSm>l(µšEJkÁÉ”ÏB%EÁiÑ%ÈŒÔIE[3G“€ô“. L'(S–Ò17ÝËÕÌ…®@ª%«Ì^ÞôÔ™6­#(tä°x—Ôî-µ85-IPµªÃimr˜œ")JfC«^(YõSS“Öž*–}h>s)QzÎ/§Wl;ų֩=ta“¼äéM³ºS§WÝ«a¶ªÇxžZ›Bg­Ð)BVž5Œ]ÌlUúzÍz–‹œuÔ_ÙO~Ú`½ìõZM¾úŸpuþ,¼:Xw‘£‡Íkb[»ØÐ"ª«·«>K 3¦S¨xE+kêÚcí·©El¶^ËÖ¦R÷¥ñ]U³¶Üß´uW¾…ÍvÝ·[æööº¶¼¨eýÞÐ|wAíuÍxï:]¦6·:óEn}±j]Uöî³dënK{ àX¿¹Uny½Û_"!8ººeo|;óÞìN3kË/Ró†^ÒT8’ŽK†Õ»ÞLξù† ]é6îÄ“L1Œ-3â亸U¤c·§9ãî°¸ÄD™(Z-'Ç2Ç›©±j…²9sÎtÑi²“§¼ÙÒqFÉ 6 í¶Ìå.÷:^³˜ÇÜåýX©£#³þéf§æ/W§Ípf3œU',Cx5ýûâ™ ‹#—ÇÏm±s‹íh=ÿyÏÜ þÌ#h :ÏgD4y éï4Í3\ô¡7lc)þ¬Ðh¹4ŸñÀMËÄfµ¥-iúfzЬæô’á¢ê:šÚ¦¨.K­ëSwZÄ•¶µ¯gý–]kÇØcu¢)]jò({Ò¯þt¯qýkZ›×²Î²§q†l±<ÛÕ}¾ö±[Mn;5ÛÐÃÖ6°ÏélßùÑì^µ»½íN[«¹”¸9oG×{cÝVL¹Óîx ›ÚÄNõ®Ø\1<ŽýÆ´µÇøpó:\Þ§w óYÃÊŽ;â£.6ÇþSèq~gÜßJ‚a £ê_/Þ,—¹0Žpuo¼¬/Ä9~^óGwy?ÿøÉ%ÄŠÇ8è&ï¹Æ‹-dVùëàø®¶’šÞ@ªë˜çQg¶¦uDþ—Ê`Çb¨ÃNö²s16]×cÂ!h£+¼QC9ѯ¬oþ´õÛi_j>ìvsŸ,ïz×¶¦ ©MQÇ<£ÎUQ3u•Ê©úu!“µú v\býÝåÐö÷à-ïÀwG¤Ãa¤<OGxÈWÞò¦¿¸Ôëyù¸¿\óŠïhJ…K\ÕÇL“%¥Yq£VÙÿñ>¢ï`p¿JVÚ›ÔVÄ?)ÀŒk{ˆh²³7m¿xýå§>S€ªàKþ[WÓÂ5®sllG M»NôvÌ#]Ë_PÚš °ëå8Û/0ï‹¡Òú—žÝ|k_ªÏ$[Û$"Ä/ìg[Æ"[·ªåGÞWX(}#G~åG€¨u„uZ¸€çz™7w YãWx(|”EN(J‘G{*b°7Næ$‚x‚ïg‚38‚¶²|±eN8}¶e ÅXA–}ý·}¡”5¨r(XX3 Å€ž·@NM=8WÜYÈx!È„ø„Bó.n^gsgV…Qò71hõw€…~|H~%~óä~à·†9ˆ„?ø†÷g…ú'…¯W†ž÷þ#-3ã2.Ã|}8J¾§|’(\ñ—|3†r—G>؈Ñ'‰›X{X-ÀʼnÅÇ@‘‰µŠÖˆ–Ø‚„ˆˆÏuˆd(póŠ X]µˆ}˜7‹…H‹=c‹r‡‹¿¨‹È‹°è^˜Ø‹û!„ØUŒD(R•ŒÇXÌxc†È»˜dÒhŒÔ¸Y§t(ÇæÙèÕaàx‹âxeäèŒæØŽ±xá¸fWX\eú¸áƒÿ—ŽÁ¸ŽÚŒÊhç¨`î˜òXgþ¨vr¡WŽ éÖñhw UϨ‘fÈŽ9ô‘«%‘�)–‘ÿø(ÉH$ùóè‘sˆþ "é'‹Ù`­' 3¹z¹v%9Ži’뱓>É’E¹È”7¹E+ùx?y6fGSMÙ“:)eü¨#Ké”/919 DÙ‘Ti“-9sÓ•*9•¢5‘H)”ÝqaÀç•nx7– ”h éfL1—jI‘y—a’z¹—Y9y<ùD–xÝ8˜KÁ—O!}÷%‰‘y,“)—…™–9a•WÙ™;ecÁ™ž9šúšÄø˜tys¶š¬Ùštv®›²9›´;fé’ØHµI:r¶›³ù¾œŸÓ›ÂYœqù–}Y—ë¶u膚ÉémûÖrÏ™’¤Æœí6E¨u°þvk¸¹•~·\—š§ÒÆk ’)gp؆C¥hàٜݩŽ"§žBçœöùvÖIsñó™ŸPwžl‰Ÿïy÷  7çŸëY ~ùoÄso*ž¾8 úù ì wúŸ ʟ鉠õ¹Ÿ9qštŠžz¡ :¢ªkѹsšÑÆmš¡ÚŸ&Ú¡ª É¶¢Òá˜(Z¢åžŠ—ð¢Ò‰£ãù¢öfž2J¢ßù£ðy£=ZwóGrªw¢Pz¥ŠY¥97¥Vº¤)ŠvÏ$s(¢Xªœ~g~4¦E¥Aª‹‡×@JH¦^š™j¤sN§kZ¦GÚBG…)3‡¡fʤ ‡tþ×S"• <ª§ÎE¨BÔ§W×¢íy’ç§“c˜Ft¨ÎQ©(f¤Ô9¤5*§ú¥°Bš„¡J¦ vv©BŠŽuºF‰¡©Õ¦Zi¯ú¨±êc¬j”ÍØ8Õ²Šzžê¢® y<8PšÈ6¿Š'‹€³:UÇŠxÉ*¬ÀJ§„7{4yÓJKËÊS;s­œÇ’Û*†lg­5‰„÷*ÜäˆÅT©Á:…¡4|¨hRŸx|’²®¨~±…¥a®4„ÏZ.x.ô÷y– €‡Û…†ê†³ÅKäÚ¯»Z«ùN*؃c€Ét°Ìjø—„ZøXº‡úšN¿$±´j˜¶Ê¯‡þ‚4¤±ï˜îXÏ"Y6øJ<˜‡#Eƒk~_¹¡Ã©+K‡oȰ/¦ ¨”åÊ…%G²¤U‚àg´‹´"³Ø:±*[¬¿'°[€oꊺpXØ}{¨‡U¨{iز‡÷³>ª¨ÄŠ®ÔÚ°çÔ‰%µ¯Ÿ§´ˆI´”¸ŠžH¯¢¨øZŠ|k¨ÏÁ¶Mê¶B«µb)†x‹²ä)‡Õе𩏹 ¹ ‡¤`¹);¹p{2V‹¹8™«’«¬½zŸ[plwºCû©ò –Ma¸fF–ªK¹¬«¡‹ûº³Ë ÷ʼn:§•»—¹»œˆ¼#¹¹¤©Z1ÄËtÉkË{˜¼z»Þ ¼«¹Ãþ[½¾Ê¦A«½G»FÞ+ Ü‹¸ã 7ÏÛ¶¼{¾®½¿Ûºj¢¾¡¾ðÛ¾YK¿3ŠcØ+º©›¿ã¯Tqµûu¹À:¿ÓK±îk¿æË¿O"» Œ¨þ›­«‹¨¬¢ ì¸å;ªÒÛ˜,¥×kÁä;¤)`!%»Í[v°œ£l½¼§)üb+ ûÛÀ·úµ ½Ý{œ7À3LªçZÀ|Œ™ïêŠ?|§7º9¬Á<,À…¡bì»Æ ø[Ä#ìZO¼ÀUÄÈÛ*—9IÁªH6ÅÌÄ"!š¤išÌ¡Æ%|V–·hü¯Maœ«yvœÇb¾Jœ®NášþÄ©fߡDzCÈqÌÇsü¿3 £JzÆ]|ÃŒ ¤ÛÛªÂ뤊Ão ª–<¡T<ÉȪyÚɘœ¥› ¨V<ÄgqÄö¤¢üÁŸ\Ê]êÈžœ“°l£­|Ë,L¤,úÈŠü¸I*É£Œ©ºÛq¬,ËÁ|›‘\̧l»‡ûËÊÜÄ@¡µ,ªË|¿è p1jÌ®LËÉ|ÉÛ\¿šÜÍœ¬Í¸Lú¼£}·„ÂHõÆîl1Ù\Í‚Ê`‰¬=DûÍœ‹«³lÏ¥·Ïù¼>éÌÏŽjÀÌÜÃø,Ð[{ÐàŠÎõŒÐ…UÎÐ ÅäìÐ^,ÏѼLÍϽ;Ñ Eq.Úy-ÌÑrÌ¥"Ò!Íþ¾ÉüEµi‰¦)½Ðþ|¼¿ Ó©dÓ1ÝË3-Ó�m§ÚºÄ9 ÁǬÒöõµÊjÔA-Ô ]Ñ{…ÔŒãÔIíÇCMÐüŨŒdÕQ­ÓS ÎG7ÐxƒÕYÂ+¸:Æ©TaÖaí¬c-ÒúƒÖ–¤Ê·ÓÐýLF$­==ÒÓÁÎi-ÖÑy=š{­ÔkMÉF¬×­Î}ÍÒd؇ЃMÔ‹ ØØxÍËdÉØ“Í´[ýϑ홙}};ÍÔñüÙ•MÕólʤí×mÍÏœÚdýئÝÈ®­ØªÚ¼5Û° ڌڸ½Ú´}Ú±ÜÛ„ýÛ «­RíWÁrÏhr×µÍÛMǰþ%Òp½brÜæ8×rë|tËOGt±êÚ1¹‡±­(@¶­Õïág«°G±4û²ñç°ë³õSך=m(ˆ#ë‡cKAZ‡‚ø€xjÞ›MÓøMzI؈#Øß‚e³ï±öw*n]!ÎMÜÂæ³ /ÞXc«‰! ‡Žm7ö­Ö¦†áíÚµ¬H°îíáMH%W®sÝ”žoê„뉂[&ŠGPn|£(3¨ã–Í×›ÕK]5þÚ±fä¹6IÎÖ\ÖÂ-ÝÎÓC¹ÝSåJ^Ðn4áYNâ¥]å›ZÝ—òäÃ-Û_nàM®æÝñÎQi×#S4fÝÒcæ¾íºê<vÛþú›duçnÆÍºGx…1‡ÔL.ç¶³ç\-è®ÛÚ æÑͲˆbÀÂèœç\êUìJ¸ùšIÏç·bE‚>È{„ʃélîèM(/jˆ.þ„<n‡8k²–^'ªnåK;›‚¾â {+ë á u<¹.Ú}Nz.›°Ì.ë1HqÎᙫ;ÇNådÉÜhØìõ±H…ÎîÒáÛ 2é»®è!ûâi 쯮BñMì—xëiRíè]î.JŒ8s‡„ïõ—ï;0·GŠ%§VðÞÜ€>階ÊA–Ä4î!H¦ÔŠ®„ß ñØ •^? ß!ò.Øt</)I¾„Ï!Oþä[&<tŠÍÇQcÞâR} Oc#<Oñš½îÜ„KµÕâèÒ^¾ß%%éZ­ïVÈóÛºóX¸"ôÜRó?°…Ü »³JoõLÏN¯,P¿y«ÃõßÝžÇíæ9ó2ôßË®³ë÷‡<¾àYŸ”ãö3nHÌðÞî#5ëö:¸Ì}’[Ï.]Oç?‚öb÷ä^Ò‡?øN¢ø1Ï»M_÷…¿ªtÿ;Oé×®õ”ÏðšOï0‰ù•?çœ/úžø•cö3ù¦?äD¿ê¹Üøïúk¯ëܸޝ/£æ`Šû³Þû±/øˆOá»çæL$X\7™ú¶þŸÊÄ_üÆú÷Ýè©LæÌZÆ­ü&ìeáÆªŸYlLíÇÏçfaÈè/Èz^þÖïé_)üþÒOòìŸé¶ýŒÒüÕoÿ长[þÜ�@à@‚ 4�áB†6„QâDŠ-^ŒøãFŽ=~RäH’%Kj4IeJ‰+=ºdSæÌ�0iÞÄ™SçNž=mžì™päÏ E‹5šTéR¦MA" õ¦TŠT^}ŠUëV®]“Z}¹lF¯e³šE›VíZ²4Dz|Û0.Û²séÞÅ›w¦]‹|‡þÕ¸¦`Â… §ô[U,àÃl7†9ïã–‹£JVKófÎ[5CþüÜ1tèΈKŸF=yªå¤S_~[6W×k_=Ûémݽ}Oä]0¸bØ¿7ž\9r‡¬Ï*÷ ]úôÖ«•榮“yvo͸ûÞñåÍ uëü#øîìÏ¿Çû]}Xø¦ëߟ.ÿºxüÕûÿÿM¿¯øP´”MÀãD·,MÁ£„¸ /ŒL °Ã°"÷:.ë,.ĶLDѱ,1Å…>t1Æ4Œ®EQÂQF¯¢‘'wÌq w$ò wúH!—,²É ÓÛÏÆ™ÌI+‘\ñIÿš|¨Ë+¿ÌéHí(ŒÑË*ÁD3&1Ã$ÓE3‡LSÇ5qJþ’H…îŒ3O“æÌ’>'ñ„SO7û¬qË?TÐù„ÒP.U4Òõõ±Í)%ÅtFJ±”Ò;D?5TQG%µTSOE5UUW5Só%¯SÌ%ŒVW½‚U¦:7³µÖ[¹ËUMKëµ°bÝmÓ1emŒ¹ŸÞ|±9ô˜:Ùùì#ÑÑYV®´�ÀÚå”e“Yb¡¼S£tñtRi×…ÔKwÛ=“[q{ VDs s–Þ*¡=àwý}“=pï \:‡5]&~XÚ–ØàpÆWa‰ë¬_Šÿ­øÓ‰?V·â0¸ã7ŽU[É<.d™e6säš-NYå×òÅö9ïþž`w!¾ù]œu^ÙÞ ö5Ö˜»d·&våmµhzFzg–ueZ°j…¥嬵VºPŸyåUä“s»ã­Áv9ÃÁe»m´Ë®t߆1¤ÛîÓxÞ³ëÀ¾®Ul¿ÝƛӸ!#Ükÿ»eovîÇ!ùm})'–UÏ?=tÑE¿sÆ5ïyÒ-¯Ût~Q\ï¦/ìÛu¹_–ó×ù.Ýö½%×òìmyoÝ÷ÁaJv¯Y7¾rÜËÕý÷ ko^z¸'>sâ«ßø¥•?~{îgç:Êèɇúñõ<ùó—ç}tùç§¿~ûïŸ÷ççŸ}æÇn\ì¼g6Õ!nz(+Þ½þè¾òe+{·;`ï0¶@’´¯‚‚ ߃è&A!µÊ6cý·ºý!á·˜@†Ç…sû› 1øÂhƒ¤’Jæu³üÅ+D)|ŸŸ°W@Q+ˆZ! [H2›í‡5`Þ‚hàÏŠW´bqØÁüElfVƒ! £¨¸–F‹gDcÕ¸F6¶Ño„#+“µ¬Ž9¤8D!Ê&Ž„ã 9HB®cTÚ´ŒH—Eöqs|4ЗÙô ­‰ÿšdfôx½àñOÃÎÔB†£¨ñm“ì¤#‹”IÓ±#œ¡·$¹>Úœ2uß›"ˆ\ ¹]R²„¿´Ð,iþyD[ ’é¥õ†I­b20•‘¼R2í&Í`Ž1we”Ó2±BÍ9Zzؼ”6›ÂÍíñ™È9‘¦NYz“¹ £8™)Fsâœe’ç8›yAóÝsPù¼ëI@UÚ  =0ŠNaô˜ u§ §e%vª¬¢ÝЍBËùI‡>Ôyi7)ÚQžK£¨,¨’HjÏÈ-”ŒžäÒJY J—^¦«”)AµRN¦4›9})M{ªS†F¨AÝiM¿ySƒu©BE)Q5ÕP§ž4>…gÓYÕwê§Q-ªJAxQIi‰ÝSjW™º(•´•«%2+DÓŠU·âÔdoeLÌ’:þT)úS—ˆÄk^ñøÑ¹ZU«­Y`ý“Xò©am*cKÉÖ±6õ)[g6YÕUÖ¤_½%4cZJÎNŠ´ëc§úÉÓ–­µlj1+ÚG‘ÕZjójaA{XŠvѵ/ñ-jCÛ×µþô·ýSa™Ù aѹÏߢ ;]ê×—»].m  Û"t\Ú®j_™šîζAåE®pèZ\í?è%îxøËôò6·Ç±®HKz¢<kd•œ#XBÕ-© Å.ôÍ*Fï‹ËSK‰õé/ OXÍCJx¶yð…/ûTð ÷¥êêaˆëå@6]KˆŸ&µ:͇í*Ù$ãþ€‰*sA°_)ÜÒ™ÞuÅRg†Ïa Óì’‰µšÀ ö_Ù_!²z•ËÏ«([wtòY7åòùÇ’%€¿ècܺUÉw…r{±Keg°“Iö∳EøxÙ‹<´äÇ`œÈ,‡2ÏPòœBg#­—¹ro–à|I±zÈ&¾s–‘i&2¹Ò`ì ¹¬åìÆ·ÃrÕ’^_9úUZÐøìD#÷ùa«.hL]WÝÖz£PÝP˼kØúdÖòE5Í¢öbªµ“5õY‰=J Z8¿æ4›Ï¹ÚŸÚÀzïµsÌÞëVAêãn¶7íìN‹WÍ޶ᵳߓþhÛП/=Ó§nê°»‚îžr,íËc Ò;?âîö†Õzhôõ{Üë8¢ó]_óÛÚ¯wÂ+,[CvVÕÅxÆWåoéhÜãÔÅ÷šõÝp\›ãб÷PBnkмä醸¿ù»r¿ÛÞ)_Ûy%¾ã–Û<Ñý÷pÞš÷|áRÞî¼YHj”ï\¿FùDnòâ1½ãN¿uxÍKí©ÃÜÏüź…µ^q®¿¼@Ô³:¶g>îmœç{5x‘…öv²|ì.‡»µí—°µãݘӎwÒãžv’ÇfèO)úÝ}.ï¸?Yáëûãíþw·»Yé_Ÿ¸áé¾o¨O¾ðöúŒßN6'þžòR <ºÏ¾Å´^êC6}¹·žú®¯>æ´žë_{i÷Øây§:·ÿ*Þ¼÷ðþl…¯z`ŸáÇÿ=èm¿üÚ7ŸíïŽ~Ùzä3žø×?z›³.}îž<Ú?Ïó«lüB{æ·Ï4éß³A¿Ëžì´7»ÐåXùí[üQ_¿×Ë¿µ3?r#¯:3$É«¹ð‹¿þ+½ýã¿LŽ:·@Ü>,@”¿uK¢ ì< |ºŽÑ½õ¤�ìœu;AT<<?ɨ¢“A,:#<ŒœÁT•dÁÓó´ìëŒBÂ!$Â"L@l #TÂ%4B d¿çk?Ý`BB¤)´þBûë +L£*ÔÂ"Œ@íûA0+Ý(A}r?,\<£ò2œ§ DCä@|Zí:Cè3·ú3.2¤C7´ÃÙëÁ1̽=d>($D¤©9¤ªê+Dñ»¦‚<5äÃ'DÂü§G<ÄH\DêAGÔÃD”@FlÁÑĤÄAœÄîSÀ˜BÄRTÄStB< §NdÅOÔD¿QÔ<OtÀLüBγ+Kä(Ðð –ð­2ƒC_ CüûEY¼Äº£ ½Ò³cü¼;LÅe D]ŒBf3ÄÍŠC^¬;ÀûÃ<¼ÆYÔ00Ò28i;TÌ<NÇfÜ7sD6J Å^|CQGRtdžƒÇ•ð,iÔ0ßþÃ{ÌErÌÆ1Ã=Æt|ÅjdG| Fg,¤3+ƒÁ¾€ ÇXlLJ ¡a„1Û(FÂóFd¤ÆuÄÅTELtE‹„E9Æ“4EPôA•¬DfÔHZ¤Ç>¼H–¤I—lE˜¬ÇM,ÉÄFP Á¢üÆXŒ+Äž¬E£I‰+×cCïJ>[tÊiÔ¬hJ‚$Êy´Ê£ 'hÜÊ|ÜÅ”TÆ…|"nËš,KŸÄÉ•4ˆ1Ik´Iu¼Àü§~Dɬ|ɦôÊFœ’^«CŒ¬K´¼Ky|"ÁÜK¨D?¿ŒÉ³”lKÆÌ”I’¼É$?dÊ›”D ¤Ë$ËÍ4ËœdÈ´ÑÁþÔŒ®«œžÆôLoº©4LÓäËδKÏûGÛŒ¸Ç$ÌÉ|ÍSL9ÙtLÀHÒtËÏÄ˪ä"Í43à•ÛÔË[œÍ´\Ìß<Nô°¤´G°ÄM•€¿‚äɼÌÃìÆ‚+.B1R22;H”%˜´xl¦# áÜ/eúËý|Jå<O’šX6Z{øü3‚i2ƒÌ3 CγsÍÛüÊþD+­SЭ—‰D³/,XC3#ùÎm Oß„PÖOàƒ‰«´V3ȱò dKµQòP­|¶MNÎOÈôC¸4OAs =³hÔNeÑQÃÐþÚ@ÄŒËNÅήôÑ8þÐQ‹J)H*ÑQURêìKëÎÜÌN$ÒeÓ³k¡ È"í cS±5ÝRË|/&Ïî|ÒØB½ÌHÒò¤Ìê,QþÄJÿ¤cœŒ=ÅOpœP'N:mC]Ê¥Mò¼9å+McÔHµS%Ñ.sÔ¡ÄSÞ¸?½‹C]NåÊOýÉ ÔD¾J­³KåQIýÕ¤Õ,²¢GÝÔ:UU1…RýãÒ4™TÄTéT_=œ`%Ï&åÎ^º=EdÍÔëÔTãœ?GKŒ“ÖòSeÕÓDÕfͰk%ÖùƒUo½¿aM®ÆK^SÏ7mÓeÏŽŒÏØ,WÌ<×Xµ<îã< þeµ/ãÇ;ÃR>íQfmPQ]Uý,¿pU$1»PNƒG6UÊÊtU{ÅWm}¸[µ@´…WŽ]NF“Ø}Ë4üÒïÃX+]Q8]Q#íÒ|ÍU½WseÕ„=YUëW€•²?›ÒÝÖ«ÖŠ%Îb·pUQ^«1ú¼::ZƒØzý–Š„Y õÙ‡ûÕ˜ÍHH•Ún¥Ø™ÕÀo!Ô¦ Ù0-Xœ#UÜ8ÂirZ ÜQ™ýVN=Û¶Ö][Ã+[aü@^JÛq%YÔÀÁZõÛSáÁcÍÛ  Un%Œ.DÜÄ…#׉[EÍÖå Åu#.”ÜAòÆÔ‘ÝÚÚ<.0­ ¨E×e-ÎÎZþ„MUÇ…\Î%]]M×hÛ;íÍÕ ÝQݬ=XÕ•]Ûµ²de]ÑÝÜÝ\øáÝÒ Þ%^ÃÝ]×õ\õÒãÕݵPÈޕЙt^¶Ù‚EÞmÈêU[¡Å^é½Ý>åÞâµX¹…M\_ßåZÍ•UOM_í%X9Ýð5Þ÷íÞõý^âÝNµ_ú-_Ô]ÞºÉþÅ\­mßSí_ФÖåÍ^Øåßv`Óe_åeÞ¿‚`õ•àü_^Ý nÙ©¥àžÖ ôà aó]T÷½à>ÝÌ…ßö`ž`V`ŽáÁÅ`8àµM`Öàç`Ü-a¦ÝŸµÞý¥Þ!N]á aðåþàúÍP%þà"Þ ~a(ÖÎÆáéÕá`ËöaùâÎÊ/¾á°e`'¾bÊŒNÞbÿ`"Ö Kã7~âÂUãSË:FcƒaÂeLÅìa;^ã½5(Avã>áÇâéaNî ã‰Ebò›G®ÞHfd?.d!æãžÕ_ >¼¿eÏa\Bâ6åˆÅ[EÎãN嵄ÛW^bPVe\Vþdžåÿ5A­Ó6nbÆ_1>âûÍ`MÎe¸¨Z>fI6fJ>aþPÓ÷|2ª¡ÐŽ´æwÕåg•åFþãfb6+P‚ PICÐcSf´Åe+>ßu.'~MÐ/žQ3ŽŠeÍøþuf½…f*f ¢]Ó e±yÞå¾pÖ{n[bÞg8Žf¸ZØxFÙ ¥g¢³ç]`dvå’•<x¾4œ…XøDŒ‚fËŠ^ä×%cï¥-5ÝPF#6Q 9n ¦h|Îä‘öfè½Z•›èÐéVÎdL6–¯ÅéXvçbÞf—¶iñÉŸNãdg— >�êf£ngOv[¡¦ê1îé¨Þ˜Öi™&é¬jë³jŒæé¯èøå´&œÞÞfj~æpV×uŠê^Ù·®j¨ëIFeÝ„=¶¶áaÎg@Nèä½<½¾j¢Žc¥F@À†aÁžé²®iMBjºÞ븦åËN?Çþ݃ì¦Ögþ¹¾XÄ&ë·na.í§N꺦J¬6‹ ®nk¯^jv.iÈŽ¼ÕÖlÂîk¬õ¿±ökÓþfÔvjÛãì¦m‹ëÝ6 $íà¶íåfn|y[alšVî³æe <näöìÈîMNA [AàöíÂžÛØè[µfo.ô›ë–ììžì¼¨Üú¶ïêÖíÄF艹ûÞBÿ&ÂVbí~2k•âÛnfðŽníΣ¯áï.pù–j[vðùF‹è ïS†b?XÊ`CøÎð‹éëÕ[ØÞï§5âðÎvYvm6wMZÌ‹q‹Kn]èví�Fß‚ƒgåè+=çpÊÖo¾Îla¾q]þ4-ÍÙÙ"¿ðÚUlж`ÔÊX è‡}QD²ˆÆkÃŽcì6q)'±•ÅP•íqJr‡òÐ>rƒÎW½Y›5³-²‡Åñ£®â_so®W ƒqAWZ¦5ô'/mF"s#wóæß«›n…†ëF¯òê ð2—ð¹«p íEÇlJ§ ñ×qfäH¿cCîêNNt>ówõ<WñóψöÖõ]çõ^§ŸÖžrSÊÏæ)u~ŽpNGÔê)vEGèGvãYv0ßt ÓôaŠv=WpK}öËÕj`¯u?Èõ¹v"ÏöWÝvÛw6/÷ö ÐdŸtòfG¸þ‚‘[oóÏ­åc7wuW÷O—÷yçw\¿•Ç÷Ï–9`vau¾w€GxHWøI/eU¯¥€Ÿ÷ˆ?íUnøƒ_÷.Œ@±÷WÇö†yÓ@ä0Ÿ n'ðÚ®3xE1x\ùáùsùŽ/x•¯öøFöpwœ?wÞæ_oï‰ßx™·ø6 7̉ù®¸ë—ÝÍ[.z¦ŸyiM¨yiÇn©ßŽT¸· ÔK?ú$vzcgyª7& < U“îön“vûo7ú~FÏúl×y}ñ4Åû¢FõÔ{ñ.n!J²rFg;×pÄcø«ù²O–­Gé†íh)]Щ`{N~ûgô$w6gWÛãþµŸü ?ïÄŸvÏ­}è#Íûõ|óî{¬×ùŠÏ®4¿óx&Òêç}r×wÒ÷ÁÆ?ôES—ñÕÇýÖý¬‡ýíÞ²Ïwtã×}Å7ÃQ{_cþJ§õãý\#îÆfý/gö—W›(ùªíÀ¶|v\ѵÿÉoÄþѧ/§Ùâ÷~×qõïs”+ÿÇ>¾%¡�,hð „ 2lèð!Ĉ`ñ"ÆŒ7rìèñ#È"G’,i#€“*W²Ü˜²%̘&_ʬió&Ê”4qòìéÓ"�Š?‡-ês§Ñ¤‘*mš‘©Ó¨-^„*õêР±ríþzÔ«R«`¿Ž-ë’*J³jaj]ëö­K¸<ÅÊZ×+ZtïÖmË÷/^À1÷ I¸ðͼqÿõ»ô0ãÈ!!K~ZY%åË=3kvêø)çÎCW&}Ù´h¶©×~0p5l¨ÏŽ\;vÉÛ¸k:V¼ûwUàz…/&¾ÙøÕ¶¾‘ãÖ Ø¹`èÌÓNoT"öìÚ·sïîý;øð«»&oSºùÊѧË^îû¾íÏ'Ú;~}ÏÓñÃåOÜ}­½–Ÿmû‘ p¶×ZU ˜˜Õ9ØÜƒ› ÕÑr¾5a`j8Ó‡‰]¨‡!®T"W(v¥¢h,'`†&ºåbT4Jeciþ2ÊtŸŽÏEøc9•P1ÉÈá(Ù’»]'”QJ9%•UZiÐG ©åIëq)sM†õåpd’Ä£™j‰YÔšFµ]š†”‘qZ—ä‹v–§§zsæÄgrxþ§ç›©1ø' w†™¥…¶ègƒ‰Ö(¨pŽòe©f0bä¦zب¤KXg¨öQš ¡¥êUd§Z¶Ê£q¾J›�WÚz+®¹ê e¬iΊ˜—ª*¬Y¿ªI,Pmåš±&6Kæ³cE{—VËÒ9m~Ø©íŠÄVk-¢ÈþÄ-§€’[ַ껨¸î%ºîŠÊBÚnRð:+)©C $/¸ôŽéoŠ¡Öº+þÁRò;/À¦&<¬À;ü0ÄK<1Å[|1 g¥ñÄbüñÅß‚<2Éòr<éÉŠ¦ÌæÊå¶ìæË Ç¢½4Ï<îÍ6çLÖΞöL`ÍýàÐ?ƒh´ÏH«¦ô|EÍ4}P§ç4ÐRÛeu¯Xw©5f\Ÿêµz`ç&vždŸi¶HT›­v€hOæöol7 wØtÇ&÷‚vo©·¡|ïíwp€&x™„ïi8“ˆn8Þ^7nÞã•R”âpV9ª‹^9µœcžùáŸ#-º’‚Ót:ç>^NøK­§®ºâ¤;Iùæ¯Ãç9ë´Ëþóî’箓íáþ{íÁo8<ëùïîêŒ+¿þ|·Í3}çÒóY0öS¦Þ;è©â‹<âܳ$þŽÖOェäæþÝè³¶Ü€ý…¾™Ž¢¾8¦A»ûèZV{þö7?P!©8—ê—ÝØ·¾þI«A®{é¦ÀÕL0m3ú߯· ¶ˆÌ Rò—1´qpp,àæîן®~Ðêüž—"’­„™ò`¨4è6ž‡ø¢¡Øx˜£z ˆ`bâˆ(,’Ð…_Bb—Œè8'r Š3‘"׬,¾ ‹ZÓbaÀèÀ쑱J^Äšaç«v1±…æ{¡¸ÚXC*ºŠg´Z…§ÄôÝQjy¼Í5BîìÕ“•#HÈžþLˆŒ£Ÿâ7Ç7>1‘‘’ ·eÉEB­‘·Ûc©žTÆQ’Ò;™Ô×&=I=ý€ò‡£Rå*aÖÊ.F’“±LÙaY“å–4•¥._Žî]9ä1'i®\Š,™ÊÔÀJ)͆8Ì™ATUɲ©Ímr“—Ö<¢Çº™M‘‰³œû¦ˆÎuž‡ì|'¬ÏyŽÏô¼çÑÔ‰Ï}ÖMŸüügárÐÐt=èäŠÐƒê²X EhCý÷P‚F´hE?xQ~f´Cå¨=?ŠÏŽFO¤# ©IçIRVÒ®¥)EçJU–—²3¦*S!M¿iÓ….§ëÜé¿èS Tþ¨Cu&P륻£•xIeª#¼§BU~ΣjUwÕ¬"¥\¥'§)Ö‡|Õ[Æü^YC Lµ¦­³ d[ëøVuIrlÅóHAò)³¸>²¯z5 ivÂé¯~­ß‰&?x{b쟌:Å è5Ž­¬æ¶fØ5ίԹZZ:-•Y.},SkÚžâ4Š›Elg1DüµT¨¢U-j?‹[Ü‚ö®¹‰àku”GÔ@%¯==®mk{ÚÖÍöZ¼MímäÜ 7±U.r±Û[Ýn)¹Kn§›58jö¹Ííh³»ZÁÒV½*l-fÂ+Þ¯¡²kgyo¤n[ÛË6×þ99c›Ùøw¾Ô…«DeI¤¸j±MQ]76ù6xPÂ¥KG¥[á©éË*¦ð†ãæ*ß|˜Á!æðáJŸ¸}õ pMÜb µÆ6¾ñvX<㾽ط®ÜñS<àËÈeëp-iälux)J^òÜ.ìYHÊ"攇ŸleÈ8ÉTÞrÞ„|Ú`‚ÅЂñu\æ0âÇZ^séz\b8ªŠ*>f•élB$›7ÆzfWb4ç?ÙY~3¡g‡e'9ѾãsBÓœgGÓæÌCÆ3¥»ggÓ2ÓqkóíéÊYÔ£¾¡˜9-ÈIŸÛ"±©[Ä@g¹Ñ²þ&µŒê4è[ïYÊ%3¯{Mk/#KÃÁŽê«/ýãc÷°Ô¶f¶m@mãXC;vhvµ_——ŒV+Ûžƒu±…émçý Ïjw! £Ët¡›zªlf»ÝÍLdÆ{•Ñ”ö4«YïXš³ßþî÷¾“ùï‘sàâ ¸x±Šp¿)|ázk¸Ã1ñ‰—›âWõÅñŒƒ“ã߸ǿr‹ƒ|ä~4ùÄKŽr¥©|åFk¹Ës„Ã|æ+c¯²mîiœYç­Æ¯Ï ô [¿D/ziÎk£+ýÖSmºÐËSs¨û+ÂT?µÕ¯>ê©kÝPøu×јðŸœ­d¹YÏ.sûô×0I“þ°Úo† ž[°nbuÜÓ÷ý6–¹Og–w%I• qýêsÇàs›\Ôm×–'Â{ÞÍŽ3îž7ñ¨ |ÎqRØÈßœeŸíïb±{ùk¥ãç97ç+¹×Ê—É»£/Þ-ùÔ_Ïó¢Çüqsßx£žöšd{]¿m þ¿‘ Kï}ï2T+ùÊ®°¥åüçßëÙÔg#µ¯?vëk_ï~î>ö¹þP~½üÆ?lÃ={ô/ÿûìO_ößÏYõËþâ¯ÿƒe5}ü—Èüw«ûý‚5Êþ `œÑŸ þ­_2™ú1`FYŒA`†Y0`jÚªa`j zSúʼ`ï¦É½™_é[ ê‰Áµ  ^Ì 6Ì BLÁÍ 6Å TáàfžZ¦þ … aY!^Ùr•&¡‹1aU-¡òX2N!óY¡OU!ÎÚÒ”vááGÑÝŠá±hNš¡C‰žRT{µ!C%º!ëÍá?1Ôßå¡^r”ãýa2e žT!Þ!–â=—"ªTÅ5â ö™éAbð�˜qM"%nÏ…^&“%^bv¢§$Dæ‰"ò D)š¢=D*ª¢<±bϹ¢íô]¤ÉâòˆE(Ú¢ÝI¢.ÊÛ%õ¢'¢�;������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/tg/default.txvpck���������������������������������������������������0000664�0001750�0001750�00000000440�14670377514�021714� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <nodeSet version="1.0"> <view uin="id309n7etug73fpetug73wh"> <property name="$metaclass" value="Package Diagram"/> <property name="@__options" value=""/> <property name="$defaultDiagram" value=""/> </view> </nodeSet> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/tg/kLdr.tpr���������������������������������������������������������0000664�0001750�0001750�00000003707�14670377514�020463� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������[Project] Language=cpp Root.0=$PROJECT_DIR$ Root.0.access=writable Root.0.file_types=cpp_source;cpp_header;diagram Root.0.package_prefix= Version=3.0 projectfile.encoding=MS932 Root.1=$TGH$/jdk/jre/lib/rt.jar Root.1.access=import Root.1.non_removable= [workspace] Developer.CodingWorkspace={{0,2,-1,0,0,0,0,0,0,1,0,50,75,25,-1,-1,-1,-1}${0,1,-1,0,0,0,0,1,0,1,0,50,75,25,-1,-1,-1,-1}${0,3,-1,0,0,0,0,1,0,1,0,66,50,25,-1,-1,-1,-1}${0,3,-1,0,0,0,0,1,0,1,0,66,50,25,-1,-1,-1,-1}${0,-1,-1,0,0,0,0,0,0,1,0,5,5,5,-1,-1,-1,-1}${0,5,-1,0,0,0,0,0,0,1,0,50,50,25,-1,-1,-1,-1}${0,4,-1,0,0,0,0,1,0,1,1,66,50,25,-1,-1,-1,-1}${0,7,-1,0,0,0,0,0,0,1,0,50,50,75,-1,-1,-1,-1}} Developer.DebugWorkspace={{0,2,-1,0,0,0,0,0,0,1,0,50,75,25,-1,-1,-1,-1}${0,1,-1,0,0,0,0,1,0,1,1,50,75,25,-1,-1,-1,-1}${0,3,-1,0,0,0,0,0,0,1,0,50,50,25,-1,-1,-1,-1}${0,3,-1,0,0,0,0,0,0,1,0,50,50,25,-1,-1,-1,-1}${0,-1,-1,0,0,0,0,0,0,1,0,5,5,5,-1,-1,-1,-1}${0,4,-1,0,0,0,0,0,0,1,0,50,50,25,-1,-1,-1,-1}${0,0,-1,0,0,0,0,1,0,1,0,75,5,5,-1,-1,-1,-1}${0,7,-1,0,0,0,0,0,0,1,0,50,50,75,-1,-1,-1,-1}} Developer.DesignWorkspace={{0,2,-1,0,0,0,0,1,0,1,0,50,75,22,-1,-1,-1,-1}${0,1,-1,0,0,0,0,0,0,1,0,50,75,22,-1,-1,-1,-1}${0,3,-1,0,0,0,0,1,0,1,0,50,50,22,-1,-1,-1,-1}${0,3,-1,0,0,0,0,1,0,1,0,50,50,22,-1,-1,-1,-1}${0,-1,-1,0,0,0,0,0,0,1,0,5,5,5,-1,-1,-1,-1}${0,4,-1,0,0,0,0,1,0,1,1,50,50,22,-1,-1,-1,-1}${0,0,-1,0,0,0,0,0,0,1,0,75,5,5,-1,-1,-1,-1}${0,7,-1,0,0,0,0,0,0,1,0,50,50,75,-1,-1,-1,-1}} Developer.kLdr={{0,2,-1,0,0,0,0,1,0,1,1,50,75,22,-1,-1,-1,-1}${0,1,-1,0,0,0,0,0,0,1,0,50,75,22,-1,-1,-1,-1}${0,3,-1,0,0,0,0,1,0,1,0,50,50,22,-1,-1,-1,-1}${0,3,-1,0,0,0,0,1,0,1,0,50,50,22,-1,-1,-1,-1}${0,-1,-1,0,0,0,0,0,0,1,0,5,5,5,-1,-1,-1,-1}${0,4,-1,0,0,0,0,1,0,1,0,50,50,22,-1,-1,-1,-1}${0,0,-1,0,0,0,0,0,0,1,0,75,5,5,-1,-1,-1,-1}${0,7,-1,0,0,0,0,0,0,1,0,50,50,75,-1,-1,-1,-1}} names.Developer={kLdr,DesignWorkspace,CodingWorkspace,DebugWorkspace} [vcs] provider.class=CVS LAN [lastOpenProjectName] Developer=kLdr [model] showDiagramContents=true ���������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/tg/KLDRSTATE.txvstc�������������������������������������������������0000664�0001750�0001750�00000114613�14670377514�021651� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <nodeSet version="1.0"> <view uin="id83t9setug73fpetug74ah"> <property name="$metaclass" value="State Diagram"/> <property name="@__options" value=""/> <reference df-class-name="reference" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="90,40,80,40"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd.linkid7iy6aetug73fpetugal1c:id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd"> <property name="sourceAnchor" value="130,80"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="130,110"/> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd.linkid14j0oetug73fpetugbmyx:id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd"> <property name="sourceAnchor" value="90,70"/> <property name="bendpoints" value="30,70,30,1000"/> <property name="targetAnchor" value="150,1000"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="linklabel:$transitionInplaceEditing:design:link:::id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd.linkid14j0oetug73fpetugbmyx:id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd"> <property name="bounds" value="10,50,77,16"/> </reference> </reference> </reference> <reference df-class-name="reference1" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid67r7zetug73fpetug87g4"> <property name="$shortcutReference" value="true"/> <property name="background_color" value="0,0,0"/> <property name="bounds" value="120,0,12,12"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid67r7zetug73fpetug87g4.linkid2j70ketug73fpetug8gs8:id83t9setug73fpetug74ah.nodeid67r7zetug73fpetug87g4"> <property name="sourceAnchor" value="126,12"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="126,40"/> </reference> </reference> <reference df-class-name="reference2" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="90,110,80,40"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak.linkid7cno0etug73fpetuganpl:id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak"> <property name="sourceAnchor" value="130,150"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="130,190"/> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak.linkid4elkbetug73fpetugbpa9:id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak"> <property name="sourceAnchor" value="90,140"/> <property name="bendpoints" value="30,140,30,990"/> <property name="targetAnchor" value="150,990"/> <property name="bounds_setted_by_user" value="true"/> </reference> </reference> <reference df-class-name="reference3" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="320,110,110,40"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9.linkidd5q0etug73fpetugl30f:id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9"> <property name="sourceAnchor" value="380,150"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="380,190"/> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9.linkid2yl8cetug73fpetugl74g:id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9"> <property name="sourceAnchor" value="430,140"/> <property name="bendpoints" value="550,140,550,840"/> <property name="targetAnchor" value="284,840"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="linklabel:$transitionInplaceEditing:design:link:::id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9.linkid2yl8cetug73fpetugl74g:id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9"> <property name="bounds" value="470,120,77,16"/> </reference> </reference> </reference> <reference df-class-name="reference4" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="80,190,135,40"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l.linkidr4phetug73fpetugcezv:id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l"> <property name="sourceAnchor" value="130,230"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="130,270"/> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l.linkid82puetug73fpetugbwui:id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l"> <property name="sourceAnchor" value="80,220"/> <property name="bendpoints" value="30,220,30,980"/> <property name="targetAnchor" value="150,980"/> <property name="bounds_setted_by_user" value="true"/> </reference> </reference> <reference df-class-name="reference5" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="90,270,80,40"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj.linkid4fiuhetug73fpetugbs4x:id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj"> <property name="sourceAnchor" value="90,300"/> <property name="bendpoints" value="30,300,30,970"/> <property name="targetAnchor" value="150,970"/> <property name="bounds_setted_by_user" value="true"/> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj.linkid8ewc7etug73fpetughpzu:id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj"> <property name="sourceAnchor" value="130,310"/> <property name="bendpoints" value="130,330,190,330"/> <property name="targetAnchor" value="190,350"/> <property name="bounds_setted_by_user" value="true"/> </reference> </reference> <reference df-class-name="reference6" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="150,950,134,60"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg.linkid80127etug73fpetugd66b:id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg"> <property name="sourceAnchor" value="210,1010"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="210,1040"/> </reference> </reference> <reference df-class-name="reference7" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7vd8retug73fpetugcr3e"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="150,1040,134,40"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid7vd8retug73fpetugcr3e.linkid8h4qnetug73fpetugf6j3:id83t9setug73fpetug74ah.nodeid7vd8retug73fpetugcr3e"> <property name="sourceAnchor" value="208,1080"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="208,1110"/> </reference> </reference> <reference df-class-name="reference8" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid417yeetug73fpetugeb3p"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="150,880,134,40"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid417yeetug73fpetugeb3p.linkid6ngyletug73fpetugehbp:id83t9setug73fpetug74ah.nodeid417yeetug73fpetugeb3p"> <property name="sourceAnchor" value="210,920"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="210,950"/> </reference> </reference> <reference df-class-name="reference9" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="150,790,134,60"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5.linkid6vibeetug73fpetugephi:id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"> <property name="sourceAnchor" value="210,850"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="210,880"/> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5.linkid1izxmetug73fpetugesem:id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"> <property name="sourceAnchor" value="260,790"/> <property name="bendpoints" value="260,770,590,770,590,90,380,90"/> <property name="targetAnchor" value="380,110"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="linklabel:$transitionInplaceEditing:design:link:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5.linkid1izxmetug73fpetugesem:id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"> <property name="bounds" value="290,750,84,16"/> </reference> </reference> </reference> <reference df-class-name="reference10" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid17bz7etug73fpetugf23i"> <property name="$shortcutReference" value="true"/> <property name="background_color" value="0,0,0"/> <property name="bounds" value="200,1110,15,15"/> </reference> <reference df-class-name="reference11" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="150,380,129,40"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i.linkidy5coetug73fpetughmwy:id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i"> <property name="sourceAnchor" value="210,420"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="210,460"/> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i.linkid989qmetug73fpetugi623:id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i"> <property name="sourceAnchor" value="150,410"/> <property name="bendpoints" value="60,410,60,810"/> <property name="targetAnchor" value="150,810"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="linklabel:$transitionInplaceEditing:design:link:::id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i.linkid989qmetug73fpetugi623:id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i"> <property name="bounds" value="50,390,94,16"/> </reference> </reference> </reference> <reference df-class-name="reference12" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="150,460,134,40"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj.linkid7b0d0etug73fpetughibe:id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj"> <property name="sourceAnchor" value="284,490"/> <property name="bendpoints" value="460,490"/> <property name="targetAnchor" value="460,540"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="linklabel:$transitionInplaceEditing:design:link:::id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj.linkid7b0d0etug73fpetughibe:id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj"> <property name="bounds" value="290,490,42,16"/> </reference> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj.linkid2yeeuetug73fpetughfff:id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj"> <property name="sourceAnchor" value="210,500"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="210,540"/> </reference> </reference> <reference df-class-name="reference13" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid8048etug73fpetugfpwv"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="150,540,134,50"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid8048etug73fpetugfpwv.linkid5imvsetug73fpetughcca:id83t9setug73fpetug74ah.nodeid8048etug73fpetugfpwv"> <property name="sourceAnchor" value="210,590"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="210,630"/> </reference> </reference> <reference df-class-name="reference14" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="150,630,131,40"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3.linkid7ockpetuqdc66etuqdq4c:id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3"> <property name="sourceAnchor" value="281,650"/> <property name="bendpoints" value="310,650,310,570"/> <property name="targetAnchor" value="284,570"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="linklabel:$transitionInplaceEditing:design:link:::id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3.linkid7ockpetuqdc66etuqdq4c:id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3"> <property name="bounds" value="290,650,84,16"/> </reference> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3.linkid3jvhdetug73fpetugiz5h:id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3"> <property name="sourceAnchor" value="210,670"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="210,710"/> </reference> </reference> <reference df-class-name="reference15" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid3z4oketug73fpetuggjl4"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="410,540,121,50"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid3z4oketug73fpetuggjl4.linkidotudetug73fpetugilak:id83t9setug73fpetug74ah.nodeid3z4oketug73fpetuggjl4"> <property name="sourceAnchor" value="460,590"/> <property name="bendpoints" value="460,910"/> <property name="targetAnchor" value="284,910"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="linklabel:$transitionInplaceEditing:design:link:::id83t9setug73fpetug74ah.nodeid3z4oketug73fpetuggjl4.linkidotudetug73fpetugilak:id83t9setug73fpetug74ah.nodeid3z4oketug73fpetuggjl4"> <property name="bounds" value="470,600,45,16"/> </reference> </reference> </reference> <reference df-class-name="reference16" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid9bbfsetug73fpetugirr0"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="150,710,134,40"/> <property name="bounds_setted_by_user" value="true"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid9bbfsetug73fpetugirr0.linkids5u8etug73fpetugj2bq:id83t9setug73fpetug74ah.nodeid9bbfsetug73fpetugirr0"> <property name="sourceAnchor" value="210,750"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="210,790"/> </reference> </reference> <reference df-class-name="reference17" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="290,190,189,40"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4.linkid529snetug73fpetuglmq0:id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4"> <property name="sourceAnchor" value="479,220"/> <property name="bendpoints" value="550,220,550,830"/> <property name="targetAnchor" value="284,830"/> <property name="bounds_setted_by_user" value="true"/> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4.linkid733w4etug73fpetuglagw:id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4"> <property name="sourceAnchor" value="380,230"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="380,270"/> </reference> </reference> <reference df-class-name="reference18" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65"> <property name="$shortcutReference" value="true"/> <property name="bounds" value="320,270,118,40"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65.linkidcf8yetug73fpetuglj2g:id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65"> <property name="sourceAnchor" value="438,300"/> <property name="bendpoints" value="550,300,550,820"/> <property name="targetAnchor" value="284,820"/> <property name="bounds_setted_by_user" value="true"/> </reference> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65.linkid5watyetug73fpetugle5c:id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65"> <property name="sourceAnchor" value="380,310"/> <property name="bendpoints" value="380,330,230,330"/> <property name="targetAnchor" value="230,350"/> <property name="bounds_setted_by_user" value="true"/> </reference> </reference> <reference df-class-name="reference19" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6yrvpetui3nn8etui62p3"> <property name="$shortcutReference" value="true"/> <property name="background_color" value="0,0,0"/> <property name="bounds" value="180,350,60,6"/> <reference referencedUin="design:link:::id83t9setug73fpetug74ah.nodeid6yrvpetui3nn8etui62p3.linkid4uffpetui3nn8etui6xmx:id83t9setug73fpetug74ah.nodeid6yrvpetui3nn8etui62p3"> <property name="sourceAnchor" value="210,356"/> <property name="bendpoints" value=""/> <property name="targetAnchor" value="210,380"/> <reference referencedUin="linklabel:$transitionInplaceEditing:design:link:::id83t9setug73fpetug74ah.nodeid6yrvpetui3nn8etui62p3.linkid4uffpetui3nn8etui6xmx:id83t9setug73fpetug74ah.nodeid6yrvpetui3nn8etui62p3"> <property name="bounds" value="220,360,122,16"/> </reference> </reference> </reference> </view> <node uin="id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd"> <property name="$metaclass" value="State"/> <property name="$name" value="Open"/> <link uin="id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd.linkid7iy6aetug73fpetugal1c"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd.linkid14j0oetug73fpetugbmyx"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd"/> <property name="$metaclass" value="Transition"/> <property name="$event_name" value="done (failed)"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid67r7zetug73fpetug87g4"> <property name="$metaclass" value="Start State"/> <property name="$name" value="StartState1"/> <link uin="id83t9setug73fpetug74ah.nodeid67r7zetug73fpetug87g4.linkid2j70ketug73fpetug8gs8"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid4wa62etug73fpetug7hpd"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid67r7zetug73fpetug87g4"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak"> <property name="$metaclass" value="State"/> <property name="$name" value="Mapped"/> <link uin="id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak.linkid7cno0etug73fpetuganpl"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak.linkid4elkbetug73fpetugbpa9"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidd21uetug73fpetug8kak"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9"> <property name="$metaclass" value="State"/> <property name="$name" value="Reloaded"/> <link uin="id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9.linkidd5q0etug73fpetugl30f"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9.linkid2yl8cetug73fpetugl74g"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9"/> <property name="$metaclass" value="Transition"/> <property name="$event_name" value="done (failed)"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l"> <property name="$metaclass" value="State"/> <property name="$name" value="LoadedPrerequisites"/> <link uin="id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l.linkid82puetug73fpetugbwui"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l.linkidr4phetug73fpetugcezv"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7et8etug73fpetug938l"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj"> <property name="$metaclass" value="State"/> <property name="$name" value="FixedUp"/> <link uin="id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj.linkid4fiuhetug73fpetugbs4x"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj.linkid8ewc7etug73fpetughpzu"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6yrvpetui3nn8etui62p3"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid71qrcetug73fpetuga3zj"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg"> <property name="$metaclass" value="State"/> <property name="$name" value="PendingDestroy"/> <link uin="id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg.linkid80127etug73fpetugd66b"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7vd8retug73fpetugcr3e"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid7vd8retug73fpetugcr3e"> <property name="$metaclass" value="State"/> <property name="$name" value="Destroyed"/> <link uin="id83t9setug73fpetug74ah.nodeid7vd8retug73fpetugcr3e.linkid8h4qnetug73fpetugf6j3"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid17bz7etug73fpetugf23i"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7vd8retug73fpetugcr3e"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid417yeetug73fpetugeb3p"> <property name="$metaclass" value="State"/> <property name="$name" value="GC"/> <link uin="id83t9setug73fpetug74ah.nodeid417yeetug73fpetugeb3p.linkid6ngyletug73fpetugehbp"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid3wom6etug73fpetugb9cg"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid417yeetug73fpetugeb3p"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"> <property name="$metaclass" value="State"/> <property name="$name" value="PendingGC"/> <link uin="id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5.linkid6vibeetug73fpetugephi"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid417yeetug73fpetugeb3p"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5.linkid1izxmetug73fpetugesem"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidq28metug73fpetug8uf9"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"/> <property name="$metaclass" value="Transition"/> <property name="$event_name" value="Loaded again"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid17bz7etug73fpetugf23i"> <property name="$metaclass" value="End State"/> <property name="$name" value="EndState1"/> </node> <node uin="id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i"> <property name="$metaclass" value="State"/> <property name="$name" value="PendingInitialization"/> <link uin="id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i.linkidy5coetug73fpetughmwy"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i.linkid989qmetug73fpetugi623"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i"/> <property name="$metaclass" value="Transition"/> <property name="$event_name" value="Other init failure"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj"> <property name="$metaclass" value="State"/> <property name="$name" value="Initializing"/> <link uin="id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj.linkid2yeeuetug73fpetughfff"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid8048etug73fpetugfpwv"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj.linkid7b0d0etug73fpetughibe"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid3z4oketug73fpetuggjl4"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid2vt9ietug73fpetugfjhj"/> <property name="$metaclass" value="Transition"/> <property name="$event_name" value="Failed"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid8048etug73fpetugfpwv"> <property name="$metaclass" value="State"/> <property name="$name" value="Good"/> <link uin="id83t9setug73fpetug74ah.nodeid8048etug73fpetugfpwv.linkid5imvsetug73fpetughcca"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid8048etug73fpetugfpwv"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3"> <property name="$metaclass" value="State"/> <property name="$name" value="PendingTermination"/> <link uin="id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3.linkid3jvhdetug73fpetugiz5h"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid9bbfsetug73fpetugirr0"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3.linkid7ockpetuqdc66etuqdq4c"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid8048etug73fpetugfpwv"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeidswftetug73fpetugfwd3"/> <property name="$metaclass" value="Transition"/> <property name="$event_name" value="Loaded again"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid3z4oketug73fpetuggjl4"> <property name="$metaclass" value="State"/> <property name="$name" value="InitializationFailed"/> <link uin="id83t9setug73fpetug74ah.nodeid3z4oketug73fpetuggjl4.linkidotudetug73fpetugilak"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid417yeetug73fpetugeb3p"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid3z4oketug73fpetuggjl4"/> <property name="$metaclass" value="Transition"/> <property name="$event_name" value="Do GC"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid9bbfsetug73fpetugirr0"> <property name="$metaclass" value="State"/> <property name="$name" value="Terminating"/> <link uin="id83t9setug73fpetug74ah.nodeid9bbfsetug73fpetugirr0.linkids5u8etug73fpetugj2bq"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid9bbfsetug73fpetugirr0"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4"> <property name="$metaclass" value="State"/> <property name="$name" value="ReloadedLoadedPrerequisites"/> <link uin="id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4.linkid733w4etug73fpetuglagw"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4.linkid529snetug73fpetuglmq0"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6t6upetug73fpetugj6k4"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65"> <property name="$metaclass" value="State"/> <property name="$name" value="ReloadedFixedUp"/> <link uin="id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65.linkid5watyetug73fpetugle5c"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6yrvpetui3nn8etui62p3"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65"/> <property name="$metaclass" value="Transition"/> </link> <link uin="id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65.linkidcf8yetug73fpetuglj2g"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid7q41getug73fpetugejq5"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid5e0mxetug73fpetugjk65"/> <property name="$metaclass" value="Transition"/> </link> </node> <node uin="id83t9setug73fpetug74ah.nodeid6yrvpetui3nn8etui62p3"> <property name="$orientation" value="horizontal"/> <property name="$metaclass" value="Synchronization Bar"/> <property name="$name" value="SyncBar1"/> <link uin="id83t9setug73fpetug74ah.nodeid6yrvpetui3nn8etui62p3.linkid4uffpetui3nn8etui6xmx"> <participant role="Supplier" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6b4f8etug73fpetugfa3i"/> <participant role="Client" referencedUin="design:node:::id83t9setug73fpetug74ah.nodeid6yrvpetui3nn8etui62p3"/> <property name="$metaclass" value="Transition"/> <property name="$event_name" value="Fixed up all modules"/> </link> </node> </nodeSet> ���������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/tstkLdrMod.c��������������������������������������������������������0000664�0001750�0001750�00000055315�14670377514�020663� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tstkLdrMod.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Module interpreter testcase. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include <k/kErr.h> #include <k/kErrors.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** The default base address used in the tests. */ #define MY_BASEADDRESS 0x2400000 /******************************************************************************* * Global Variables * *******************************************************************************/ /** The numbers of errors. */ static int g_cErrors = 0; /** * Report failure. */ static int Failure(const char *pszFormat, ...) { va_list va; g_cErrors++; printf("tstLdrMod: "); va_start(va, pszFormat); vprintf(pszFormat, va); va_end(va); printf("\n"); return 1; } /** Dummy import resolver callback. */ static int BasicTestsGetImport(PKLDRMOD pMod, KU32 iImport, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PKLDRADDR puValue, KU32 *pfKind, void *pvUser) { *puValue = 0xdeadface; *pfKind = KLDRSYMKIND_NO_BIT | KLDRSYMKIND_NO_TYPE; return 0; } /** * Verbose memcmp(). */ static int TestMemComp(const void *pv1, const void *pv2, KSIZE cb) { KSIZE off; const KU8 *pb1 = (const KU8 *)pv1; const KU8 *pb2 = (const KU8 *)pv2; if (!memcmp(pb1, pb2, cb)) return 0; printf("Mismatching blocks pv1=%p pv2=%p cb=%#x:\n", pv1, pv2, cb); for (off = 0; off < cb; off++) { if (pb1[off] == pb2[off]) continue; printf("%08x %02x != %02x\n", off, pb1[off], pb2[off]); } return memcmp(pb1, pb2, cb); /* lazy */ } /** * Performs basic relocation tests. */ static int BasicTestsRelocate(PKLDRMOD pMod, void *pvBits, void *pvBits2) { const KSIZE cbImage = (KSIZE)kLdrModSize(pMod); int rc; printf("* Relocation test...\n"); /* * Get the same bits again to check that we get the same result. */ memset(pvBits2, 0xfe, cbImage); rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL); if (rc) return Failure("failed to get image bits, rc=%d (%s) (a)", rc, kErrName(rc)); if (TestMemComp(pvBits2, pvBits, cbImage)) return Failure("relocation test failed, mismatching bits (a)"); /* * Short relocation round trip. */ rc = kLdrModRelocateBits(pMod, pvBits2, 0x1000, (KUPTR)pvBits, BasicTestsGetImport, NULL); if (rc) return Failure("failed to relocate, rc=%d (%s) (b1)", rc, kErrName(rc)); rc = kLdrModRelocateBits(pMod, pvBits2, (KUPTR)pvBits, 0x1000, BasicTestsGetImport, NULL); if (rc) return Failure("failed to relocate, rc=%d (%s) (b2)", rc, kErrName(rc)); if (TestMemComp(pvBits2, pvBits, cbImage)) return Failure("relocation test failed, mismatching bits (b)"); /* * Longer trip where we also check the intermediate results. */ /* stage one */ rc = kLdrModRelocateBits(pMod, pvBits, 0x1000000, (KUPTR)pvBits, BasicTestsGetImport, NULL); if (rc) return Failure("failed to relocate, rc=%d (%s) (c1)", rc, kErrName(rc)); memset(pvBits2, 0xfe, cbImage); rc = kLdrModGetBits(pMod, pvBits2, 0x1000000, BasicTestsGetImport, NULL); if (rc) return Failure("failed to get image bits, rc=%d (%s) (c1)", rc, kErrName(rc)); if (TestMemComp(pvBits2, pvBits, cbImage)) return Failure("relocation test failed, mismatching bits (c1)"); /* stage two */ rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0x1010000, 0x1000000, BasicTestsGetImport, NULL); if (rc) return Failure("failed to relocate, rc=%d (%s) (c2)", rc, kErrName(rc)); memset(pvBits2, 0xef, cbImage); rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL); if (rc) return Failure("failed to get image bits, rc=%d (%s) (c2)", rc, kErrName(rc)); if (TestMemComp(pvBits2, pvBits, cbImage)) return Failure("relocation test failed, mismatching bits (c2)"); /* stage three */ rc = kLdrModRelocateBits(pMod, pvBits, MY_BASEADDRESS, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL); if (rc) return Failure("failed to relocate, rc=%d (%s) (c3)", rc, kErrName(rc)); memset(pvBits2, 0xef, cbImage); rc = kLdrModGetBits(pMod, pvBits2, MY_BASEADDRESS, BasicTestsGetImport, NULL); if (rc) return Failure("failed to get image bits, rc=%d (%s) (c3)", rc, kErrName(rc)); if (TestMemComp(pvBits2, pvBits, cbImage)) return Failure("relocation test failed, mismatching bits (c3)"); /* stage four */ rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0 / 2 - 0x10000, MY_BASEADDRESS, BasicTestsGetImport, NULL); if (rc) return Failure("failed to relocate, rc=%d %(s) (c4)", rc, kErrName(rc)); memset(pvBits2, 0xdc, cbImage); rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL); if (rc) return Failure("failed to get image bits, rc=%d (%s) (c4)", rc, kErrName(rc)); if (TestMemComp(pvBits2, pvBits, cbImage)) return Failure("relocation test failed, mismatching bits (c4)"); /* return */ rc = kLdrModRelocateBits(pMod, pvBits, (KUPTR)pvBits, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL); if (rc) return Failure("failed to relocate, rc=%d (%s) (c5)", rc, kErrName(rc)); memset(pvBits2, 0xcd, cbImage); rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL); if (rc) return Failure("failed to get image bits, rc=%d (%s) (c5)", rc, kErrName(rc)); if (TestMemComp(pvBits2, pvBits, cbImage)) return Failure("relocation test failed, mismatching bits (c5)"); return 0; } /** * Dump symbols and check that we can query each of them recursivly. */ static int BasicTestsEnumSymCallback(PKLDRMOD pMod, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, KLDRADDR uValue, KU32 fKind, void *pvUser) { KLDRADDR uValue2; KU32 fKind2; int rc; /* dump */ printf("#0x%08x: %016" PRI_KLDRADDR " %#08x", iSymbol, uValue, fKind); if (pchSymbol) printf(" %.*s", cchSymbol, pchSymbol); printf("\n"); /* query by ordinal */ if (iSymbol != NIL_KLDRMOD_SYM_ORDINAL) { fKind2 = 0; rc = kLdrModQuerySymbol(pMod, pvUser, MY_BASEADDRESS, iSymbol, NULL, 0, NULL, NULL, NULL, &uValue2, &fKind2); if (rc) return Failure("Couldn't find symbol %#x (%.*s) by ordinal. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc)); if (uValue != uValue2) return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/ord) pvBits=%p", iSymbol, cchSymbol, pchSymbol, uValue, uValue2, pvUser); if (fKind != fKind2) return Failure("Symbol %#x (%.*s): Kind mismatch %#x != %#x (enum!=query/ord) pvBits=%p", iSymbol, cchSymbol, pchSymbol, fKind, fKind2, pvUser); } /* query by name. */ if (pchSymbol) { fKind2 = 0; rc = kLdrModQuerySymbol(pMod, pvUser, MY_BASEADDRESS, NIL_KLDRMOD_SYM_ORDINAL, pchSymbol, cchSymbol, pszVersion, NULL, NULL, &uValue2, &fKind2); if (rc) return Failure("Couldn't find symbol %#x (%.*s) by name. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc)); if (uValue != uValue2) return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/name) pvBits=%p", iSymbol, cchSymbol, pchSymbol, uValue, uValue2, pvUser); if (fKind != fKind2) return Failure("Symbol %#x (%.*s): Kind mismatch %#x != %#x (enum!=query/name) pvBits=%p", iSymbol, cchSymbol, pchSymbol, fKind, fKind2, pvUser); } return 0; } /** * Dump debugger information and check it for correctness. */ static int BasicTestEnumDbgInfoCallback(PKLDRMOD pMod, KU32 iDbgInfo, KLDRDBGINFOTYPE enmType, KI16 iMajorVer, KI16 iMinorVer, KLDRFOFF offFile, KLDRADDR LinkAddress, KLDRSIZE cb, const char *pszExtFile, void *pvUser) { printf("#0x%08x: enmType=%d %d.%d offFile=0x%" PRI_KLDRADDR " LinkAddress=%" PRI_KLDRADDR " cb=%" PRI_KLDRSIZE " pvUser=%p\n", iDbgInfo, enmType, iMajorVer, iMinorVer, (KLDRADDR)offFile, LinkAddress, cb, pvUser); if (pszExtFile) printf(" pszExtFile=%p '%s'\n", pszExtFile, pszExtFile); if (enmType >= KLDRDBGINFOTYPE_END || enmType <= KLDRDBGINFOTYPE_INVALID) return Failure("Bad enmType"); if (pvUser != NULL) return Failure("pvUser"); return 0; } /** * Performs the basic module loader test on the specified module and image bits. */ static int BasicTestsSub2(PKLDRMOD pMod, void *pvBits) { KI32 cImports; KI32 i; int rc; KU32 fKind; KLDRADDR Value; KLDRADDR MainEPAddress; KLDRSTACKINFO StackInfo; printf("* Testing queries with pvBits=%p...\n", pvBits); /* * Get the import modules. */ cImports = kLdrModNumberOfImports(pMod, pvBits); printf("cImports=%d\n", cImports); if (cImports < 0) return Failure("failed to query the number of import, cImports=%d", cImports); for (i = 0; i < cImports; i++) { char szImportModule[260]; rc = kLdrModGetImport(pMod, pvBits, i, szImportModule, sizeof(szImportModule)); if (rc) return Failure("failed to get import module name, rc=%d (%s). (%.260s)", rc, kErrName(rc), szImportModule); printf("import #%d: '%s'\n", i, szImportModule); } /* * Query stack info. */ StackInfo.Address = ~(KLDRADDR)42; StackInfo.LinkAddress = ~(KLDRADDR)42; StackInfo.cbStack = ~(KLDRSIZE)42; StackInfo.cbStackThread = ~(KLDRSIZE)42; rc = kLdrModGetStackInfo(pMod, pvBits, MY_BASEADDRESS, &StackInfo); if (rc) return Failure("kLdrModGetStackInfo failed with rc=%d (%s)", rc, kErrName(rc)); printf("Stack: Address=%016" PRI_KLDRADDR " LinkAddress=%016" PRI_KLDRADDR "\n" " cbStack=%016" PRI_KLDRSIZE " cbStackThread=%016" PRI_KLDRSIZE "\n", StackInfo.Address, StackInfo.LinkAddress, StackInfo.cbStack, StackInfo.cbStackThread); if (StackInfo.Address == ~(KLDRADDR)42) return Failure("Bad StackInfo.Address"); if (StackInfo.LinkAddress == ~(KLDRADDR)42) return Failure("Bad StackInfo.LinkAddress"); if (StackInfo.cbStack == ~(KLDRSIZE)42) return Failure("Bad StackInfo.cbStack"); if (StackInfo.cbStackThread == ~(KLDRSIZE)42) return Failure("Bad StackInfo.cbStackThread"); /* * Query entrypoint. */ MainEPAddress = ~(KLDRADDR)42; rc = kLdrModQueryMainEntrypoint(pMod, pvBits, MY_BASEADDRESS, &MainEPAddress); if (rc) return Failure("kLdrModQueryMainEntrypoint failed with rc=%d (%s)", rc, kErrName(rc)); printf("Entrypoint: %016" PRI_KLDRADDR "\n", MainEPAddress); if (MainEPAddress == ~(KLDRADDR)42) return Failure("MainEPAddress wasn't set."); if (MainEPAddress != NIL_KLDRADDR && MainEPAddress < MY_BASEADDRESS) return Failure("Bad MainEPAddress (a)."); if (MainEPAddress != NIL_KLDRADDR && MainEPAddress >= MY_BASEADDRESS + kLdrModSize(pMod)) return Failure("Bad MainEPAddress (b)."); /* * Debugger information. */ rc = kLdrModHasDbgInfo(pMod, pvBits); if (!rc) printf("Has Debugger Information\n"); else if (rc == KLDR_ERR_NO_DEBUG_INFO) printf("NO Debugger Information\n"); else return Failure("kLdrModHasDbgInfo failed with rc=%d (%s)", rc, kErrName(rc)); rc = kLdrModEnumDbgInfo(pMod, pvBits, BasicTestEnumDbgInfoCallback, NULL); if (rc) return Failure("kLdrModEnumDbgInfo failed with rc=%d (%s)", rc, kErrName(rc)); /* * Negative symbol query tests. */ fKind = 0; Value = 0x0badc0de; rc = kLdrModQuerySymbol(pMod, pvBits, MY_BASEADDRESS, NIL_KLDRMOD_SYM_ORDINAL - 20, NULL, 0, NULL, NULL, NULL, &Value, &fKind); if (rc) { if (Value != 0) return Failure("Value wasn't cleared on failure."); } fKind = 0; Value = 0x0badc0de; rc = kLdrModQuerySymbol(pMod, pvBits, MY_BASEADDRESS, NIL_KLDRMOD_SYM_ORDINAL, NULL, 0, NULL, NULL, NULL, &Value, &fKind); if (!rc) return Failure("NIL ordinal succeeded!"); if (Value != 0) return Failure("Value wasn't cleared on failure."); /* * Enumerate and query all symbols. */ printf("\n" "Symbols:\n"); rc = kLdrModEnumSymbols(pMod, pvBits, MY_BASEADDRESS, 0, BasicTestsEnumSymCallback, pvBits); if (rc) return Failure("kLdrModEnumSymbols failed with rc=%d (%s)", rc, kErrName(rc)); /*int kLdrModCanExecuteOn(PKLDRMOD pMod, const void *pvBits, KCPUARCH enmArch, KCPU enmCpu); */ return 0; } /** * Performs the basic module loader test on the specified module */ static int BasicTestsSub(PKLDRMOD pMod) { int rc; KU32 i; void *pvBits; KSIZE cbImage; /* * Check/dump the module structure. */ printf("pMod=%p u32Magic=%#x cSegments=%d\n", (void *)pMod, pMod->u32Magic, pMod->cSegments); printf("enmType=%d enmFmt=%d enmArch=%d enmCpu=%d enmEndian=%d\n", pMod->enmType, pMod->enmFmt, pMod->enmArch, pMod->enmCpu, pMod->enmEndian); printf("Filename: %s (%d bytes)\n", pMod->pszFilename, pMod->cchFilename); printf(" Name: %s (%d bytes)\n", pMod->pszName, pMod->cchName); printf("\n"); if (pMod->u32Magic != KLDRMOD_MAGIC) return Failure("Bad u32Magic"); if (strlen(pMod->pszFilename) != pMod->cchFilename) return Failure("Bad cchFilename"); if (strlen(pMod->pszName) != pMod->cchName) return Failure("Bad cchName"); if (pMod->enmFmt >= KLDRFMT_END || pMod->enmFmt <= KLDRFMT_INVALID) return Failure("Bad enmFmt"); if (pMod->enmType >= KLDRTYPE_END || pMod->enmType <= KLDRTYPE_INVALID) return Failure("Bad enmType: %d", pMod->enmType); if (!K_ARCH_IS_VALID(pMod->enmArch)) return Failure("Bad enmArch"); if (pMod->enmCpu >= KCPU_END || pMod->enmCpu <= KCPU_INVALID) return Failure("Bad enmCpu"); if (pMod->enmEndian >= KLDRENDIAN_END || pMod->enmEndian <= KLDRENDIAN_INVALID) return Failure("Bad enmEndian"); for (i = 0; i < pMod->cSegments; i++) { printf("seg #%d: pvUser=%p enmProt=%d Name: '%.*s' (%d bytes)\n", i, pMod->aSegments[i].pvUser, pMod->aSegments[i].enmProt, pMod->aSegments[i].cchName, pMod->aSegments[i].pchName, pMod->aSegments[i].cchName); printf("LinkAddress: %016" PRI_KLDRADDR " cb: %016" PRI_KLDRSIZE " Alignment=%08" PRI_KLDRADDR " \n", pMod->aSegments[i].LinkAddress, pMod->aSegments[i].cb, pMod->aSegments[i].Alignment); printf(" RVA: %016" PRI_KLDRADDR " cbMapped: %016" PRI_KLDRSIZE " MapAddress=%p\n", pMod->aSegments[i].RVA, (KLDRSIZE)pMod->aSegments[i].cbMapped, (void *)pMod->aSegments[i].MapAddress); printf(" offFile: %016" PRI_KLDRADDR " cbFile: %016" PRI_KLDRSIZE "\n", (KLDRADDR)pMod->aSegments[i].offFile, (KLDRSIZE)pMod->aSegments[i].cbFile); printf("\n"); if (pMod->aSegments[i].pvUser != NULL) return Failure("Bad pvUser"); if (pMod->aSegments[i].enmProt >= KPROT_END || pMod->aSegments[i].enmProt <= KPROT_INVALID) return Failure("Bad enmProt"); if (pMod->aSegments[i].MapAddress != 0) return Failure("Bad MapAddress"); if (pMod->aSegments[i].cbMapped < pMod->aSegments[i].cb) return Failure("Bad cbMapped (1)"); if (pMod->aSegments[i].cbMapped && !pMod->aSegments[i].Alignment) return Failure("Bad cbMapped (2)"); if (pMod->aSegments[i].cbMapped > kLdrModSize(pMod)) return Failure("Bad cbMapped (3)"); if ( pMod->aSegments[i].Alignment && (pMod->aSegments[i].RVA & (pMod->aSegments[i].Alignment - 1))) return Failure("Bad RVA (1)"); if (pMod->aSegments[i].RVA != NIL_KLDRADDR && !pMod->aSegments[i].Alignment) return Failure("Bad RVA (2)"); if ( pMod->aSegments[i].RVA != NIL_KLDRADDR && pMod->aSegments[i].RVA >= kLdrModSize(pMod)) return Failure("Bad RVA (3)"); if ( pMod->aSegments[i].RVA != NIL_KLDRADDR && pMod->aSegments[i].RVA + pMod->aSegments[i].cbMapped > kLdrModSize(pMod)) return Failure("Bad RVA/cbMapped (4)"); if (pMod->aSegments[i].LinkAddress != NIL_KLDRADDR && !pMod->aSegments[i].Alignment) return Failure("Bad LinkAddress"); if ( pMod->aSegments[i].LinkAddress != NIL_KLDRADDR && (pMod->aSegments[i].LinkAddress) & (pMod->aSegments[i].Alignment - 1)) return Failure("Bad LinkAddress alignment"); if (pMod->aSegments[i].offFile != -1 && pMod->aSegments[i].cbFile == -1) return Failure("Bad offFile"); if (pMod->aSegments[i].offFile == -1 && pMod->aSegments[i].cbFile != -1) return Failure("Bad cbFile"); } /* * Get image the size and query the image bits. */ printf("* Testing user mapping...\n"); cbImage = (KSIZE)kLdrModSize(pMod); if (cbImage != kLdrModSize(pMod)) return Failure("aborting test because the image is too huge!"); pvBits = malloc((KSIZE)cbImage); if (!pvBits) return Failure("failed to allocate %d bytes for the image", cbImage); rc = kLdrModGetBits(pMod, pvBits, (KUPTR)pvBits, BasicTestsGetImport, NULL); if (rc) return Failure("failed to get image bits, rc=%d (%s)", rc, kErrName(rc)); /* * Another cleanup nesting. */ rc = BasicTestsSub2(pMod, pvBits); if (!rc) { /* * Test relocating the bits in a few different ways before we're done with them. */ void *pvBits2 = malloc((KSIZE)cbImage); if (pvBits2) { rc = BasicTestsRelocate(pMod, pvBits, pvBits2); free(pvBits2); } else rc = Failure("failed to allocate %d bytes for the 2nd image", cbImage); } free(pvBits); return rc; } /** * Tests the mapping related api, after mapping. */ static int BasicTestsSubMap2(PKLDRMOD pMod) { int rc; rc = kLdrModFixupMapping(pMod, BasicTestsGetImport, NULL); if (rc) return Failure("kLdrModFixupMapping (a) failed, rc=%d (%s)", rc, kErrName(rc)); rc = kLdrModReload(pMod); if (rc) return Failure("kLdrModReload (a) failed, rc=%d (%s)", rc, kErrName(rc)); rc = kLdrModReload(pMod); if (rc) return Failure("kLdrModReload (b) failed, rc=%d (%s)", rc, kErrName(rc)); rc = kLdrModFixupMapping(pMod, BasicTestsGetImport, NULL); if (rc) return Failure("kLdrModFixupMapping (b) failed, rc=%d (%s)", rc, kErrName(rc)); rc = kLdrModAllocTLS(pMod); if (rc) return Failure("kLdrModAllocTLS (a) failed, rc=%d (%s)", rc, kErrName(rc)); kLdrModFreeTLS(pMod); rc = kLdrModAllocTLS(pMod); if (rc) return Failure("kLdrModAllocTLS (b) failed, rc=%d (%s)", rc, kErrName(rc)); kLdrModFreeTLS(pMod); /* * Repeat the BasicTestsSub2 with pvBits as NULL to test module * interpreters that can utilize the mapping. */ rc = BasicTestsSub2(pMod, NULL); if (rc) return Failure("BasicTestsSub2 in Map2 failed, rc=%d (%s)", rc, kErrName(rc)); return 0; } /** * Tests the mapping related api. */ static int BasicTestsSubMap(PKLDRMOD pMod) { int rc, rc2; printf("* Mapping tests...\n"); rc = kLdrModMap(pMod); if (rc) return Failure("kLdrModMap failed, rc=%d (%s)", rc, kErrName(rc)); rc = BasicTestsSubMap2(pMod); rc2 = kLdrModUnmap(pMod); if (rc2) { Failure("kLdrModUnmap failed, rc=%d (%s)", rc2, kErrName(rc2)); rc = rc ? rc : rc2; } printf("* Mapping tests done.\n"); return rc; } /** * Performs basic module loader tests on the specified file. */ static int BasicTests(const char *pszFilename) { PKLDRMOD pMod; int rc, rc2; printf("tstLdrMod: Testing '%s'", pszFilename); rc = kLdrModOpen(pszFilename, &pMod); if (!rc) { rc = BasicTestsSub(pMod); if (!rc) rc = BasicTestsSubMap(pMod); if (!rc) rc = BasicTestsSub2(pMod, NULL); rc2 = kLdrModClose(pMod); if (rc2) Failure("failed to close '%s', rc=%d (%s)", pszFilename, rc, kErrName(rc)); if (rc2 && !rc) rc = rc2; } else Failure("Failed to open '%s', rc=%d (%s)", pszFilename, rc, kErrName(rc)); return rc ? 1 : 0; } int main(int argc, char **argv) { BasicTests(argv[argc-1]); if (!g_cErrors) printf("tstLdrMod: SUCCESS\n"); else printf("tstLdrMod: FAILURE - %d errors\n", g_cErrors); return !!g_cErrors; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrInternal.h������������������������������������������������������0000664�0001750�0001750�00000040315�14670377513�021163� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrInternal.h 117 2020-03-15 15:23:36Z bird $ */ /** @file * kLdr - The Dynamic Loader, internal header. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kLdrInternal_h___ #define ___kLdrInternal_h___ #include <k/kHlp.h> #include <k/kRdr.h> #ifdef __cplusplus extern "C" { #endif #if !defined(__X86__) && !defined(__AMD64__) # if defined(__i386__) || defined(_M_IX86) # define __X86__ # elif defined(__x86_64__) || defined(_M_X64) || defined(__AMD64__) || defined(_M_AMD64) # define __AMD64__ # else # error "can't figure out the target arch." # endif #endif /* ignore definitions in winnt.h */ #undef IMAGE_DOS_SIGNATURE #undef IMAGE_NT_SIGNATURE /** @name Signatures we know * @{ */ /** ELF signature ("\x7fELF"). */ #define IMAGE_ELF_SIGNATURE K_LE2H_U32(0x7f | ('E' << 8) | ((KU32)'L' << 16) | ((KU32)'F' << 24)) /** PE signature ("PE\0\0"). */ #define IMAGE_NT_SIGNATURE K_LE2H_U32('P' | ('E' << 8)) /** LX signature ("LX") */ #define IMAGE_LX_SIGNATURE K_LE2H_U16('L' | ('X' << 8)) /** LE signature ("LE") */ #define IMAGE_LE_SIGNATURE K_LE2H_U16('L' | ('E' << 8)) /** NE signature ("NE") */ #define IMAGE_NE_SIGNATURE K_LE2H_U16('N' | ('E' << 8)) /** MZ signature ("MZ"). */ #define IMAGE_DOS_SIGNATURE K_LE2H_U16('M' | ('Z' << 8)) /** The FAT signature (universal binaries). */ #define IMAGE_FAT_SIGNATURE KU32_C(0xcafebabe) /** The FAT signature (universal binaries), other endian. */ #define IMAGE_FAT_SIGNATURE_OE KU32_C(0xbebafeca) /** The 32-bit Mach-O signature. */ #define IMAGE_MACHO32_SIGNATURE KU32_C(0xfeedface) /** The 32-bit Mach-O signature, other endian. */ #define IMAGE_MACHO32_SIGNATURE_OE KU32_C(0xcefaedfe) /** The 64-bit Mach-O signature. */ #define IMAGE_MACHO64_SIGNATURE KU32_C(0xfeedfacf) /** The 64-bit Mach-O signature, other endian. */ #define IMAGE_MACHO64_SIGNATURE_OE KU32_C(0xfefaedfe) /** @} */ /** @defgroup grp_kLdrInternal Internals * @internal * @{ */ KI32 kldrModLXDoCall(KUPTR uEntrypoint, KUPTR uHandle, KU32 uOp, void *pvReserved); KI32 kldrModPEDoCall(KUPTR uEntrypoint, KUPTR uHandle, KU32 uOp, void *pvReserved); /** * The state of a dynamic loader module. * @image html KLDRSTATE.gif "The state diagram" */ typedef enum KLDRSTATE { /** The usual invalid 0 enum. */ KLDRSTATE_INVALID = 0, /** The module has just been opened and linked into the load list. * * Prev state: - * Next state: MAPPED, PENDING_DESTROY */ KLDRSTATE_OPEN, /** The module segments has been mapped into the process memory. * * Prev state: OPEN * Next state: LOADED_PREREQUISITES, PENDING_DESTROY */ KLDRSTATE_MAPPED, /** The module has been reloaded and needs to be fixed up again. * This can occure when the loader is called recursivly. * * The reason RELOADED modules must go back to the PENDING_GC state is * because we want to guard against uninit order issues, and therefore * doesn't unmap modules untill all pending termintation callbacks has * been executed. * * Prev state: PENDING_GC * Next state: RELOADED_LOADED_PREREQUISITES, PENDING_GC */ KLDRSTATE_RELOADED, /** The immediate prerequisites have been loaded. * * Prev state: MAPPED * Next state: FIXED_UP, PENDING_DESTROY */ KLDRSTATE_LOADED_PREREQUISITES, /** The immediate prerequisites have been loaded for a reloaded module. * * Prev state: RELOADED * Next state: RELOADED_FIXED_UP, PENDING_GC */ KLDRSTATE_RELOADED_LOADED_PREREQUISITES, /** Fixups has been applied. * * Prev state: LOADED_PREREQUISITES * Next state: PENDING_INITIALIZATION, PENDING_DESTROY */ KLDRSTATE_FIXED_UP, /** Fixups has been applied. * * Prev state: RELOADED_LOADED_PREREQUISITES * Next state: PENDING_INITIALIZATION, PENDING_GC */ KLDRSTATE_RELOADED_FIXED_UP, /** Pending initialization. * While the module is in this state the loader is in reentrant mode. * * Prev state: FIXED_UP, RELOADED_FIXED_UP * Next state: INITIALIZATION, PENDING_GC */ KLDRSTATE_PENDING_INITIALIZATION, /** Initializing. * While the module is in this state the loader is in reentrant mode. * * Prev state: PENDING_INITIALIZATION * Next state: GOOD, PENDING_GC */ KLDRSTATE_INITIALIZING, /** Initialization failed. * * This is somewhat similar to PENDING_GC except that, a module * in this state cannot be reloaded untill we've done GC. This ensures * that a init failure during recursive loading is propagated up. * * While the module is in this state the loader is in reentrant mode. * * Prev state: INITIALIZING * Next state: GC */ KLDRSTATE_INITIALIZATION_FAILED, /** The module has been successfully loaded and initialized. * While the module is in this state the loader can be in reentrant * or 'unused' mode. * * Prev state: INITIALIZING * Next state: PENDING_TERMINATION */ KLDRSTATE_GOOD, /** Pending termination, reference count is 0. * While the module is in this state the loader is in reentrant mode. * Prerequisite modules are dropped when a module enters this state. * * Prev state: GOOD * Next state: TERMINATING, GOOD */ KLDRSTATE_PENDING_TERMINATION, /** Terminating, reference count is still 0. * While the module is in this state the loader is in reentrant mode. * * Prev state: PENDING_TERMINATION * Next state: PENDING_GC */ KLDRSTATE_TERMINATING, /** Pending garbage collection. * Prerequisite modules are dropped when a module enters this state (if not done already). * * Prev state: TERMINATING, PENDING_INITIALIZATION, INITIALIZATION_FAILED * Next state: GC, RELOADED */ KLDRSTATE_PENDING_GC, /** Being garbage collected. * * Prev state: PENDING_GC, INITIALIZATION_FAILED * Next state: PENDING_DESTROY, DESTROYED */ KLDRSTATE_GC, /** The module has be unlinked, but there are still stack references to it. * * Prev state: GC, FIXED_UP, LOADED_PREREQUISITES, MAPPED, OPEN * Next state: DESTROYED */ KLDRSTATE_PENDING_DESTROY, /** The module has been destroyed but not freed yet. * * This happens when a module ends up being destroyed when cRefs > 0. The * module structure will be freed when cRefs reaches 0. * * Prev state: GC, PENDING_DESTROY */ KLDRSTATE_DESTROYED, /** The end of valid states (exclusive) */ KLDRSTATE_END = KLDRSTATE_DESTROYED, /** The usual 32-bit blowup. */ KLDRSTATE_32BIT_HACK = 0x7fffffff } KLDRSTATE; /** * Dynamic loader module. */ typedef struct KLDRDYLDMOD { /** Magic number. */ KU32 u32MagicHead; /** The module state. */ KLDRSTATE enmState; /** The module. */ PKLDRMOD pMod; /** The module handle. */ HKLDRMOD hMod; /** The total number of references. */ KU32 cRefs; /** The number of dependency references. */ KU32 cDepRefs; /** The number of dynamic load references. */ KU32 cDynRefs; /** Set if this is the executable module. * When clear, the module is a shared object or relocatable object. */ KU32 fExecutable : 1; /** Global DLL (set) or specific DLL (clear). */ KU32 fGlobalOrSpecific : 1; /** Whether the module contains bindable symbols in the global unix namespace. */ KU32 fBindable : 1; /** Set if linked into the global init list. */ KU32 fInitList : 1; /** Already loaded or checked prerequisites. * This flag is used when loading prerequisites, when set it means that * this module is already seen and shouldn't be processed again. */ KU32 fAlreadySeen : 1; /** Set if the module is currently mapped. * This is used to avoid unnecessary calls to kLdrModUnmap during cleanup. */ KU32 fMapped : 1; /** Set if TLS allocation has been done. (part of the mapping). */ KU32 fAllocatedTLS : 1; /** Reserved for future use. */ KU32 f25Reserved : 25; /** The load list linkage. */ struct { /** The next module in the list. */ struct KLDRDYLDMOD *pNext; /** The prev module in the list. */ struct KLDRDYLDMOD *pPrev; } Load; /** The initialization and termination list linkage. * If non-recursive initialization is used, the module will be pushed on * the initialization list. * A module will be linked into the termination list upon a successful * return from module initialization. */ struct { /** The next module in the list. */ struct KLDRDYLDMOD *pNext; /** The prev module in the list. */ struct KLDRDYLDMOD *pPrev; } InitTerm; /** The bind order list linkage. * The module is not in this list when fBindable is clear. */ struct { /** The next module in the list. */ struct KLDRDYLDMOD *pNext; /** The prev module in the list. */ struct KLDRDYLDMOD *pPrev; } Bind; /** The number of prerequisite modules in the prereq array. */ KU32 cPrereqs; /** Pointer to an array of prerequisite module pointers. * This array is only filled when in the states starting with * KLDRSTATE_LOADED_PREREQUISITES thru KLDRSTATE_GOOD. */ struct KLDRDYLDMOD **papPrereqs; /** Magic number. */ KU32 u32MagicTail; } KLDRDYLDMOD, *PKLDRDYLDMOD, **PPKLDRDYLDMOD; /** KLDRDYLDMOD magic value. (Fuyumi Soryo) */ #define KLDRDYMOD_MAGIC 0x19590106 /** Return / crash validation of a module handle argument. */ #define KLDRDYLD_VALIDATE_HKLDRMOD(hMod) \ do { \ if ( (hMod) == NIL_HKLDRMOD \ || (hMod)->u32MagicHead != KLDRDYMOD_MAGIC \ || (hMod)->u32MagicTail != KLDRDYMOD_MAGIC) \ { \ return KERR_INVALID_HANDLE; \ } \ } while (0) int kldrInit(void); void kldrTerm(void); int kldrDyldInit(void); void kldrDyldTerm(void); void kldrDyldDoLoadExe(PKLDRDYLDMOD pExe); int kldrDyldFailure(int rc, const char *pszFormat, ...); int kldrDyldOSStartExe(KUPTR uMainEntrypoint, void *pvStack, KSIZE cbStack); void *kldrDyldOSAllocStack(KSIZE cb); int kldrDyldFindInit(void); int kldrDyldFindNewModule(const char *pszName, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod); int kldrDyldFindExistingModule(const char *pszName, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod); int kldrDyldGetPrerequisite(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PKLDRDYLDMOD pDep, PPKLDRDYLDMOD ppMod); int kldrDyldModCreate(PKRDR pRdr, KU32 fFlags, PPKLDRDYLDMOD ppMod); void kldrDyldModDestroy(PKLDRDYLDMOD pMod); void kldrDyldModAddRef(PKLDRDYLDMOD pMod); void kldrDyldModDeref(PKLDRDYLDMOD pMod); void kldrDyldModAddDep(PKLDRDYLDMOD pMod, PKLDRDYLDMOD pDep); void kldrDyldModRemoveDep(PKLDRDYLDMOD pMod, PKLDRDYLDMOD pDep); int kldrDyldModDynamicLoad(PKLDRDYLDMOD pMod); int kldrDyldModDynamicUnload(PKLDRDYLDMOD pMod); void kldrDyldModMarkGlobal(PKLDRDYLDMOD pMod); void kldrDyldModMarkSpecific(PKLDRDYLDMOD pMod); void kldrDyldModSetBindable(PKLDRDYLDMOD pMod, unsigned fDeep); void kldrDyldModClearBindable(PKLDRDYLDMOD pMod); int kldrDyldModMap(PKLDRDYLDMOD pMod); int kldrDyldModUnmap(PKLDRDYLDMOD pMod); int kldrDyldModLoadPrerequisites(PKLDRDYLDMOD pMod, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags); int kldrDyldModCheckPrerequisites(PKLDRDYLDMOD pMod); void kldrDyldModUnloadPrerequisites(PKLDRDYLDMOD pMod); int kldrDyldModFixup(PKLDRDYLDMOD pMod); int kldrDyldModCallInit(PKLDRDYLDMOD pMod); void kldrDyldModCallTerm(PKLDRDYLDMOD pMod); int kldrDyldModReload(PKLDRDYLDMOD pMod); int kldrDyldModAttachThread(PKLDRDYLDMOD pMod); void kldrDyldModDetachThread(PKLDRDYLDMOD pMod); int kldrDyldModGetMainStack(PKLDRDYLDMOD pMod, void **ppvStack, KSIZE *pcbStack); int kldrDyldModStartExe(PKLDRDYLDMOD pMod); int kldrDyldModGetName(PKLDRDYLDMOD pMod, char *pszName, KSIZE cchName); int kldrDyldModGetFilename(PKLDRDYLDMOD pMod, char *pszFilename, KSIZE cchFilename); int kldrDyldModQuerySymbol(PKLDRDYLDMOD pMod, KU32 uSymbolOrdinal, const char *pszSymbolName, KUPTR *puValue, KU32 *pfKind); /** Pointer to the head module (the executable). * (This is exported, so no prefix.) */ extern PKLDRDYLDMOD kLdrDyldHead; /** Pointer to the tail module. * (This is exported, so no prefix.) */ extern PKLDRDYLDMOD kLdrDyldTail; /** Pointer to the head module of the initialization list. * The outermost load call will pop elements from this list in LIFO order (i.e. * from the tail). The list is only used during non-recursive initialization * and may therefore share the pNext/pPrev members with the termination list * since we don't push a module onto the termination list untill it has been * successfully initialized. */ extern PKLDRDYLDMOD g_pkLdrDyldInitHead; /** Pointer to the tail module of the initalization list. */ extern PKLDRDYLDMOD g_pkLdrDyldInitTail; /** Pointer to the head module of the termination order list. */ extern PKLDRDYLDMOD g_pkLdrDyldTermHead; /** Pointer to the tail module of the termination order list. */ extern PKLDRDYLDMOD g_pkLdrDyldTermTail; /** Pointer to the head module of the bind order list. * The modules in this list makes up the global namespace used when binding symbol unix fashion. */ extern PKLDRDYLDMOD g_pkLdrDyldBindHead; /** Pointer to the tail module of the bind order list. */ extern PKLDRDYLDMOD g_pkLdrDyldBindTail; /** Indicates that the other MainStack globals have been filled in. */ extern unsigned g_fkLdrDyldDoneMainStack; /** Whether the stack was allocated seperatly or was part of the executable. */ extern unsigned g_fkLdrDyldMainStackAllocated; /** Pointer to the main stack object. */ extern void *g_pvkLdrDyldMainStack; /** The size of the main stack object. */ extern KSIZE g_cbkLdrDyldMainStack; /** The global error buffer. */ extern char g_szkLdrDyldError[1024]; extern char kLdrDyldExePath[8192]; extern char kLdrDyldLibraryPath[8192]; extern char kLdrDyldDefPrefix[16]; extern char kLdrDyldDefSuffix[16]; extern int g_fBootstrapping; /** @name The Loader semaphore * @{ */ int kLdrDyldSemInit(void); void kLdrDyldSemTerm(void); int kLdrDyldSemRequest(void); void kLdrDyldSemRelease(void); /** @} */ /** @name Module interpreter method tables * @{ */ extern KLDRMODOPS g_kLdrModLXOps; extern KLDRMODOPS g_kLdrModMachOOps; extern KLDRMODOPS g_kLdrModNativeOps; extern KLDRMODOPS g_kLdrModPEOps; /** @} */ /** @} */ #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrHlp.h�����������������������������������������������������������0000664�0001750�0001750�00000000425�14670377514�020131� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� int kldrHlpGetEnv(const char *pszVar, char *pszVal, KSIZE cchVal); int kldrHlpGetEnvUZ(const char *pszVar, KSIZE *pcb); void kldrHlpExit(int rc); void kldrHlpSleep(unsigned cMillies); char *kldrHlpInt2Ascii(char *psz, KSIZE cch, long lVal, unsigned iBase); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrDyld.c����������������������������������������������������������0000664�0001750�0001750�00000136657�14670377513�020315� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrDyld.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include "kLdrInternal.h" /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def KLDRDYLD_STRICT * Define KLDRDYLD_STRICT to enabled strict checks in kLdrDyld. */ #define KLDRDYLD_STRICT 1 /** @def KLDRDYLD_ASSERT * Assert that an expression is true when KLDRDYLD_STRICT is defined. */ #ifdef KLDRDYLD_STRICT # define KLDRDYLD_ASSERT(expr) kHlpAssert(expr) #else # define KLDRDYLD_ASSERT(expr) do {} while (0) #endif /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /******************************************************************************* * Global Variables * *******************************************************************************/ /** Pointer to the executable module. * (This is exported, so no prefix.) */ PKLDRDYLDMOD kLdrDyldExe = NULL; /** Pointer to the head module (the executable). * (This is exported, so no prefix.) */ PKLDRDYLDMOD kLdrDyldHead = NULL; /** Pointer to the tail module. * (This is exported, so no prefix.) */ PKLDRDYLDMOD kLdrDyldTail = NULL; /** Pointer to the head module of the initialization list. * The outermost load call will pop elements from this list in LIFO order (i.e. * from the tail). The list is only used during non-recursive initialization * and may therefore share the pNext/pPrev members with the termination list * since we don't push a module onto the termination list untill it has been * successfully initialized. */ PKLDRDYLDMOD g_pkLdrDyldInitHead; /** Pointer to the tail module of the initalization list.*/ PKLDRDYLDMOD g_pkLdrDyldInitTail; /** Pointer to the head module of the termination order list. * This is a LIFO just like the the init list. */ PKLDRDYLDMOD g_pkLdrDyldTermHead; /** Pointer to the tail module of the termination order list. */ PKLDRDYLDMOD g_pkLdrDyldTermTail; /** Pointer to the head module of the bind order list. * The modules in this list makes up the global namespace used when binding symbol unix fashion. */ PKLDRDYLDMOD g_pkLdrDyldBindHead; /** Pointer to the tail module of the bind order list. */ PKLDRDYLDMOD g_pkLdrDyldBindTail; /** Flag indicating bootstrap time. * When set the error behaviour changes. Any kind of serious failure * is fatal and will terminate the process. */ int g_fBootstrapping; /** The global error buffer. */ char g_szkLdrDyldError[1024]; /** The default flags. */ KU32 kLdrDyldFlags = 0; /** The default search method. */ KLDRDYLDSEARCH kLdrDyldSearch = KLDRDYLD_SEARCH_HOST; /** @name The main stack. * @{ */ /** Indicates that the other MainStack globals have been filled in. */ unsigned g_fkLdrDyldDoneMainStack = 0; /** Whether the stack was allocated seperatly or was part of the executable. */ unsigned g_fkLdrDyldMainStackAllocated = 0; /** Pointer to the main stack object. */ void *g_pvkLdrDyldMainStack = NULL; /** The size of the main stack object. */ KSIZE g_cbkLdrDyldMainStack = 0; /** @} */ /** The load stack. * This contains frames with modules affected by active loads. * * Each kLdrDyldLoad and kLdrDyldLoadExe call will create a new stack frame containing * all the modules involved in the operation. The modules will be ordered in recursive * init order within the frame. */ static PPKLDRDYLDMOD g_papStackMods; /** The number of used entries in the g_papStackMods array. */ static KU32 g_cStackMods; /** The number of entries allocated for the g_papStackMods array. */ static KU32 g_cStackModsAllocated; /** Number of active load calls. */ static KU32 g_cActiveLoadCalls; /** Number of active unload calls. */ static KU32 g_cActiveUnloadCalls; /** Total number of load calls. */ static KU32 g_cTotalLoadCalls; /** Total mumber of unload calls. */ static KU32 g_cTotalUnloadCalls; /** Boolean flag indicating that GC is active. */ static KU32 g_fActiveGC; /******************************************************************************* * Internal Functions * *******************************************************************************/ /** @name API worker routines. * @internal * @{ */ void kldrDyldDoLoadExeStackSwitch(PKLDRDYLDMOD pExe, void *pvStack, KSIZE cbStack); static int kldrDyldDoLoad(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod, char *pszErr, KSIZE cchErr); static int kldrDyldDoLoad2(PKLDRDYLDMOD pLoadedMod, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags); static int kldrDyldDoLoadPrerequisites(PKLDRDYLDMOD pMod, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags); static int kldrDyldDoUnload(PKLDRDYLDMOD pMod); static int kldrDyldDoFindByName(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod); static int kldrDyldDoFindByAddress(KUPTR Address, PPKLDRDYLDMOD ppMod, KU32 *piSegment, KUPTR *poffSegment); static int kldrDyldDoGetName(PKLDRDYLDMOD pMod, char *pszName, KSIZE cchName); static int kldrDyldDoGetFilename(PKLDRDYLDMOD pMod, char *pszFilename, KSIZE cchFilename); static int kldrDyldDoQuerySymbol(PKLDRDYLDMOD pMod, KU32 uSymbolOrdinal, const char *pszSymbolName, KUPTR *pValue, KU32 *pfKind); /** @} */ /** @name Misc load/unload workers * @internal * @{ */ static void kldrDyldDoModuleTerminationAndGarabageCollection(void); /** @} */ /** @name The load stack. * @internal * @{ */ static KU32 kldrDyldStackNewFrame(PKLDRDYLDMOD pMod); static int kldrDyldStackAddModule(PKLDRDYLDMOD pMod); static int kldrDyldStackFrameCompleted(void); static void kldrDyldStackCleanupOne(PKLDRDYLDMOD pMod, int rc); static void kldrDyldStackDropFrame(KU32 iLoad1st, KU32 iLoadEnd, int rc); /** @} */ static int kldrDyldCopyError(int rc, char *pszErr, KSIZE cchErr); /** * Initialize the dynamic loader. */ int kldrDyldInit(void) { kLdrDyldHead = kLdrDyldTail = NULL; g_pkLdrDyldTermHead = g_pkLdrDyldTermTail = NULL; g_pkLdrDyldBindHead = g_pkLdrDyldBindTail = NULL; kLdrDyldFlags = 0; g_szkLdrDyldError[0] = '\0'; g_fkLdrDyldDoneMainStack = 0; g_fkLdrDyldMainStackAllocated = 0; g_pvkLdrDyldMainStack = NULL; g_cbkLdrDyldMainStack = 0; return kldrDyldFindInit(); } /** * Terminate the dynamic loader. */ void kldrDyldTerm(void) { } /** * Bootstrap an executable. * * This is called from the executable stub to replace the stub and run the * executable specified in the argument package. * * Since this is boostrap time there isn't anything to return to. So, instead * the process will be terminated upon failure. * * We also have to keep in mind that this function is called on a small, small, * stack and therefore any kind of large stack objects or deep recursions must * be avoided. Since loading the executable will involve more or less all * operations in the loader, this restriction really applies everywhere. * * @param pArgs Pointer to the argument package residing in the executable stub. * @param pvOS OS specific argument. */ #ifndef __OS2__ /* kLdrDyldLoadExe is implemented in assembly on OS/2. */ void kLdrDyldLoadExe(PCKLDREXEARGS pArgs, void *pvOS) #else void kldrDyldLoadExe(PCKLDREXEARGS pArgs, void *pvOS) #endif { void *pvStack; KSIZE cbStack; PKLDRDYLDMOD pExe; int rc; /* * Indicate that we're boostrapping and ensure that initialization was successful. */ g_fBootstrapping = 1; rc = kldrInit(); if (rc) kldrDyldFailure(rc, "Init failure, rc=%d", rc); /* * Validate the argument package. */ if (pArgs->fFlags & ~( KLDRYDLD_LOAD_FLAGS_GLOBAL_SYMBOLS | KLDRYDLD_LOAD_FLAGS_DEEP_SYMBOLS | KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT | KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE)) kldrDyldFailure(KERR_INVALID_PARAMETER, "Bad fFlags=%#x", pArgs->fFlags); if ( pArgs->enmSearch <= KLDRDYLD_SEARCH_INVALID || pArgs->enmSearch >= KLDRDYLD_SEARCH_END) kldrDyldFailure(KERR_INVALID_PARAMETER, "Bad enmSearch=%d", pArgs->enmSearch); /* * Set defaults. */ kLdrDyldFlags |= (pArgs->fFlags & KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT); kLdrDyldSearch = pArgs->enmSearch; /** @todo make sense of this default prefix/suffix stuff. */ if (pArgs->szDefPrefix[0] != '\0') kHlpMemCopy(kLdrDyldDefPrefix, pArgs->szDefPrefix, K_MIN(sizeof(pArgs->szDefPrefix), sizeof(kLdrDyldDefPrefix))); if (pArgs->szDefSuffix[0] != '\0') kHlpMemCopy(kLdrDyldDefSuffix, pArgs->szDefSuffix, K_MIN(sizeof(pArgs->szDefSuffix), sizeof(kLdrDyldDefSuffix))); /** @todo append that path to the one for the specified search method. */ /** @todo create a function for doing this, an exposed api preferably. */ /* append path */ cbStack = sizeof(kLdrDyldLibraryPath) - kHlpStrLen(kLdrDyldLibraryPath); /* borrow cbStack for a itty bit. */ kHlpMemCopy(kLdrDyldLibraryPath, pArgs->szLibPath, K_MIN(sizeof(pArgs->szLibPath), cbStack)); kLdrDyldLibraryPath[sizeof(kLdrDyldLibraryPath) - 1] = '\0'; /* * Make sure we own the loader semaphore (necessary for init). */ rc = kLdrDyldSemRequest(); if (rc) kldrDyldFailure(rc, "Sem req. failure, rc=%d", rc); /* * Open and map the executable module before we join paths with kLdrDyldLoad(). */ rc = kldrDyldFindNewModule(pArgs->szExecutable, NULL, NULL, pArgs->enmSearch, pArgs->fFlags | KLDRDYLD_LOAD_FLAGS_EXECUTABLE, &pExe); if (rc) kldrDyldFailure(rc, "Can't find/open the executable '%s', rc=%d", pArgs->szExecutable, rc); rc = kldrDyldModMap(pExe); if (rc) kldrDyldFailure(rc, "Failed to map the executable '%s', rc=%d", pExe->pMod->pszFilename, rc); kLdrDyldExe = pExe; /* * Query the stack and go to OS specific code to * setup and switch stack. The OS specific code will call us * back at kldrDyldDoLoadExe. */ rc = kldrDyldModGetMainStack(pExe, &pvStack, &cbStack); if (rc) kldrDyldFailure(rc, "Failed to map the executable '%s', rc=%d", pExe->pMod->pszFilename, rc); kldrDyldDoLoadExeStackSwitch(pExe, pvStack, cbStack); kldrDyldFailure(-1, "Failed to setup the stack for '%s'.", pExe->pMod->pszFilename); } /** * Loads a module into the current process. * * @returns 0 on success, non-zero native OS status code or kLdr status code on failure. * @param pszDll The name of the dll to open. * @param pszPrefix Prefix to use when searching. * @param pszSuffix Suffix to use when searching. * @param enmSearch Method to use when locating the module and any modules it may depend on. * @param fFlags Flags, a combintation of the KLDRYDLD_LOAD_FLAGS_* \#defines. * @param phMod Where to store the handle to the loaded module. * @param pszErr Where to store extended error information. (optional) * @param cchErr The size of the buffer pointed to by pszErr. */ int kLdrDyldLoad(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PHKLDRMOD phMod, char *pszErr, KSIZE cchErr) { int rc; /* validate arguments and initialize return values. */ if (pszErr && cchErr) *pszErr = '\0'; *phMod = NIL_HKLDRMOD; K_VALIDATE_STRING(pszDll); K_VALIDATE_OPTIONAL_STRING(pszPrefix); K_VALIDATE_OPTIONAL_STRING(pszSuffix); K_VALIDATE_ENUM(enmSearch, KLDRDYLD_SEARCH); K_VALIDATE_OPTIONAL_BUFFER(pszErr, cchErr); /* get the semaphore and do the job. */ rc = kLdrDyldSemRequest(); if (!rc) { PKLDRDYLDMOD pMod = NULL; g_cTotalLoadCalls++; g_cActiveLoadCalls++; rc = kldrDyldDoLoad(pszDll, pszPrefix, pszSuffix, enmSearch, fFlags, &pMod, pszErr, cchErr); g_cActiveLoadCalls--; kldrDyldDoModuleTerminationAndGarabageCollection(); kLdrDyldSemRelease(); *phMod = pMod ? pMod->hMod : NIL_HKLDRMOD; } return rc; } /** * Unloads a module loaded by kLdrDyldLoad. * * @returns 0 on success, non-zero native OS status code or kLdr status code on failure. * @param hMod Module handle. */ int kLdrDyldUnload(HKLDRMOD hMod) { int rc; /* validate */ KLDRDYLD_VALIDATE_HKLDRMOD(hMod); /* get sem & do work */ rc = kLdrDyldSemRequest(); if (!rc) { g_cTotalUnloadCalls++; g_cActiveUnloadCalls++; rc = kldrDyldDoUnload(hMod); g_cActiveUnloadCalls--; kldrDyldDoModuleTerminationAndGarabageCollection(); kLdrDyldSemRelease(); } return rc; } /** * Finds a module by name or filename. * * This call does not increase any reference counters and must not be * paired with kLdrDyldUnload() like kLdrDyldLoad(). * * @returns 0 on success. * @returns KLDR_ERR_MODULE_NOT_FOUND or some I/O error on failure. * @param pszDll The name of the dll to look for. * @param pszPrefix Prefix than can be used when searching. * @param pszSuffix Suffix than can be used when searching. * @param enmSearch Method to use when locating the module. * @param fFlags Flags, a combintation of the KLDRYDLD_LOAD_FLAGS_* \#defines. * @param phMod Where to store the handle of the module on success. */ int kLdrDyldFindByName(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PHKLDRMOD phMod) { int rc; /* validate & initialize */ *phMod = NIL_HKLDRMOD; K_VALIDATE_STRING(pszDll); /* get sem & do work */ rc = kLdrDyldSemRequest(); if (!rc) { PKLDRDYLDMOD pMod = NULL; rc = kldrDyldDoFindByName(pszDll, pszPrefix, pszSuffix, enmSearch, fFlags, &pMod); kLdrDyldSemRelease(); *phMod = pMod ? pMod->hMod : NIL_HKLDRMOD; } return rc; } /** * Finds a module by address. * * This call does not increase any reference counters and must not be * paired with kLdrDyldUnload() like kLdrDyldLoad(). * * @returns 0 on success. * @returns KLDR_ERR_MODULE_NOT_FOUND on failure. * @param Address The address believed to be within some module. * @param phMod Where to store the module handle on success. * @param piSegment Where to store the segment number. (optional) * @param poffSegment Where to store the offset into the segment. (optional) */ int kLdrDyldFindByAddress(KUPTR Address, PHKLDRMOD phMod, KU32 *piSegment, KUPTR *poffSegment) { int rc; /* validate & initialize */ *phMod = NIL_HKLDRMOD; if (piSegment) *piSegment = ~(KU32)0; if (poffSegment) *poffSegment = ~(KUPTR)0; /* get sem & do work */ rc = kLdrDyldSemRequest(); if (!rc) { PKLDRDYLDMOD pMod = NULL; rc = kldrDyldDoFindByAddress(Address, &pMod, piSegment, poffSegment); kLdrDyldSemRelease(); *phMod = pMod ? pMod->hMod : NIL_HKLDRMOD; } return rc; } /** * Gets the module name. * * @returns 0 on success and pszName filled with the name. * @returns KERR_INVALID_HANDLE or KERR_BUFFER_OVERFLOW on failure. * @param hMod The module handle. * @param pszName Where to put the name. * @param cchName The size of the name buffer. * @see kLdrDyldGetFilename */ int kLdrDyldGetName(HKLDRMOD hMod, char *pszName, KSIZE cchName) { int rc; /* validate */ if (pszName && cchName) *pszName = '\0'; KLDRDYLD_VALIDATE_HKLDRMOD(hMod); K_VALIDATE_BUFFER(pszName, cchName); /* get sem & do work */ rc = kLdrDyldSemRequest(); if (!rc) { rc = kldrDyldDoGetName(hMod, pszName, cchName); kLdrDyldSemRelease(); } return rc; } /** * Gets the module filename. * * @returns 0 on success and pszFilename filled with the name. * @returns KERR_INVALID_HANDLE or KERR_BUFFER_OVERFLOW on failure. * @param hMod The module handle. * @param pszFilename Where to put the filename. * @param cchFilename The size of the filename buffer. * @see kLdrDyldGetName */ int kLdrDyldGetFilename(HKLDRMOD hMod, char *pszFilename, KSIZE cchFilename) { int rc; /* validate & initialize */ if (pszFilename && cchFilename); *pszFilename = '\0'; KLDRDYLD_VALIDATE_HKLDRMOD(hMod); K_VALIDATE_BUFFER(pszFilename, cchFilename); /* get sem & do work */ rc = kLdrDyldSemRequest(); if (!rc) { rc = kldrDyldDoGetFilename(hMod, pszFilename, cchFilename); kLdrDyldSemRelease(); } return rc; } /** * Queries the value and type of a symbol. * * @returns 0 on success and pValue and pfKind set. * @returns KERR_INVALID_HANDLE or KLDR_ERR_SYMBOL_NOT_FOUND on failure. * @param hMod The module handle. * @param uSymbolOrdinal The symbol ordinal. This is ignored if pszSymbolName is non-zero. * @param pszSymbolName The symbol name. * @param pszSymbolVersion The symbol version. Optional. * @param pValue Where to put the symbol value. Optional if pfKind is non-zero. * @param pfKind Where to put the symbol kind flags. Optional if pValue is non-zero. */ int kLdrDyldQuerySymbol(HKLDRMOD hMod, KU32 uSymbolOrdinal, const char *pszSymbolName, const char *pszSymbolVersion, KUPTR *pValue, KU32 *pfKind) { int rc; /* validate & initialize */ if (pfKind) *pfKind = 0; if (pValue) *pValue = 0; if (!pfKind && !pValue) return KERR_INVALID_PARAMETER; KLDRDYLD_VALIDATE_HKLDRMOD(hMod); K_VALIDATE_OPTIONAL_STRING(pszSymbolName); /* get sem & do work */ rc = kLdrDyldSemRequest(); if (!rc) { rc = kldrDyldDoQuerySymbol(hMod, uSymbolOrdinal, pszSymbolName, pValue, pfKind); kLdrDyldSemRelease(); } return rc; } /** * Worker kLdrDoLoadExe(). * Used after we've switch to the final process stack. * * @param pExe The executable module. * @internal */ void kldrDyldDoLoadExe(PKLDRDYLDMOD pExe) { int rc; /* * Load the executable module with its prerequisites and initialize them. */ g_cActiveLoadCalls++; rc = kldrDyldDoLoad2(pExe, NULL, NULL, kLdrDyldSearch, kLdrDyldFlags | KLDRDYLD_LOAD_FLAGS_EXECUTABLE); if (rc) kldrDyldFailure(rc, "load 2 failed for '%s', rc=%d", pExe->pMod->pszFilename); g_cActiveLoadCalls--; kldrDyldDoModuleTerminationAndGarabageCollection(); /* * Invoke the executable entry point. */ kldrDyldModStartExe(pExe); kldrDyldFailure(-1, "failed to invoke main!"); } /** * Worker for kLdrDyldLoad() and helper for kLdrDyldLoadExe(). * @internal */ static int kldrDyldDoLoad(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod, char *pszErr, KSIZE cchErr) { int rc; /* * Try find the module among the ones that's already loaded. */ rc = kldrDyldFindExistingModule(pszDll, pszPrefix, pszSuffix, enmSearch, fFlags, ppMod); if (!rc) { switch ((*ppMod)->enmState) { /* * Prerequisites are ok, so nothing to do really. */ case KLDRSTATE_GOOD: case KLDRSTATE_INITIALIZING: return kldrDyldModDynamicLoad(*ppMod); /* * The module can't be loaded because it failed to initialize. */ case KLDRSTATE_INITIALIZATION_FAILED: return KLDR_ERR_MODULE_INIT_FAILED_ALREADY; /* * Prerequisites needs loading / reattaching and the module * (may depending on fFlags) needs to be initialized. */ case KLDRSTATE_PENDING_INITIALIZATION: break; /* * Prerequisites needs to be loaded again */ case KLDRSTATE_PENDING_TERMINATION: break; /* * The module has been terminated so it need to be reloaded, have it's * prereqs loaded, fixed up and initialized before we can use it again. */ case KLDRSTATE_PENDING_GC: rc = kldrDyldModReload(*ppMod); if (rc) return kldrDyldCopyError(rc, pszErr, cchErr); break; /* * Forget it, we don't know how to deal with re-initialization here. */ case KLDRSTATE_TERMINATING: KLDRDYLD_ASSERT(!"KLDR_ERR_MODULE_TERMINATING"); return KLDR_ERR_MODULE_TERMINATING; /* * Invalid state. */ default: KLDRDYLD_ASSERT(!"invalid state"); break; } } else { /* * We'll have to load it from file. */ rc = kldrDyldFindNewModule(pszDll, pszPrefix, pszSuffix, enmSearch, fFlags, ppMod); if (rc) return kldrDyldCopyError(rc, pszErr, cchErr); rc = kldrDyldModMap(*ppMod); } /* * Join cause with kLdrDyldLoadExe. */ if (!rc) rc = kldrDyldDoLoad2(*ppMod, pszPrefix, pszSuffix, enmSearch, fFlags); else kldrDyldStackCleanupOne(*ppMod, rc); /* * Copy any error or warning to the error buffer. */ return kldrDyldCopyError(rc, pszErr, cchErr); } /** * 2nd half of kLdrDyldLoad() and kLdrDyldLoadExe(). * * @internal */ static int kldrDyldDoLoad2(PKLDRDYLDMOD pLoadedMod, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags) { /* * Load prerequisites. */ KU32 i; KU32 iLoad1st = kldrDyldStackNewFrame(pLoadedMod); int rc = kldrDyldDoLoadPrerequisites(pLoadedMod, pszPrefix, pszSuffix, enmSearch, fFlags); KU32 iLoadEnd = kldrDyldStackFrameCompleted(); if (rc) { kldrDyldModAddRef(pLoadedMod); kldrDyldStackCleanupOne(pLoadedMod, rc); /* in case it didn't get pushed onto the stack. */ kldrDyldModDeref(pLoadedMod); } /* * Apply fixups. */ for (i = iLoad1st; !rc && i < iLoadEnd; i++) { PKLDRDYLDMOD pMod = g_papStackMods[i]; if ( pMod->enmState == KLDRSTATE_LOADED_PREREQUISITES || pMod->enmState == KLDRSTATE_RELOADED_LOADED_PREREQUISITES) rc = kldrDyldModFixup(pMod); } /* * Advance fixed up module onto initialization. */ for (i = iLoad1st; !rc && i < iLoadEnd; i++) { PKLDRDYLDMOD pMod = g_papStackMods[i]; if ( pMod->enmState == KLDRSTATE_FIXED_UP || pMod->enmState == KLDRSTATE_RELOADED_FIXED_UP) pMod->enmState = KLDRSTATE_PENDING_INITIALIZATION; KLDRDYLD_ASSERT( pMod->enmState == KLDRSTATE_PENDING_INITIALIZATION || pMod->enmState == KLDRSTATE_GOOD); } /* * Call the initializers if we're loading in recursive mode or * if we're the outermost load call. */ if (fFlags & KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT) { for (i = iLoad1st; !rc && i < iLoadEnd; i++) { PKLDRDYLDMOD pMod = g_papStackMods[i]; if (pMod->enmState == KLDRSTATE_PENDING_INITIALIZATION) rc = kldrDyldModCallInit(pMod); else if (pMod->enmState == KLDRSTATE_INITIALIZATION_FAILED) rc = KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED_ALREADY; else KLDRDYLD_ASSERT(g_papStackMods[i]->enmState == KLDRSTATE_GOOD); } #ifdef KLDRDYLD_STRICT for (i = iLoad1st; !rc && i < iLoadEnd; i++) KLDRDYLD_ASSERT(g_papStackMods[i]->enmState == KLDRSTATE_GOOD); #endif } else if (g_cActiveLoadCalls <= 1) { while (!rc && g_pkLdrDyldInitHead) { PKLDRDYLDMOD pMod = g_pkLdrDyldInitHead; g_pkLdrDyldInitHead = pMod->InitTerm.pNext; if (pMod->InitTerm.pNext) pMod->InitTerm.pNext->InitTerm.pPrev = NULL; else g_pkLdrDyldInitTail = NULL; pMod->fInitList = 0; rc = kldrDyldModCallInit(pMod); } } /* * Complete the load by incrementing the dynamic load count of the * requested module (return handle is already set). */ if (!rc) { if (fFlags & KLDRDYLD_LOAD_FLAGS_EXECUTABLE) { pLoadedMod->cDepRefs++; /* just make it stick. */ pLoadedMod->cRefs++; } else rc = kldrDyldModDynamicLoad(pLoadedMod); } kldrDyldStackDropFrame(iLoad1st, iLoadEnd, rc); return rc; } /** * kldrDyldDoLoad() helper which will load prerequisites and * build the initialization array / list. * * @returns 0 on success, non-zero error code on failure. * @param pMod The module to start at. * @param pszPrefix Prefix to use when searching. * @param pszSuffix Suffix to use when searching. * @param enmSearch Method to use when locating the module and any modules it may depend on. * @param fFlags Flags, a combintation of the KLDRYDLD_LOAD_FLAGS_* \#defines. */ static int kldrDyldDoLoadPrerequisites(PKLDRDYLDMOD pMod, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags) { static struct { /** The module. */ PKLDRDYLDMOD pMod; /** The number of prerequisite modules left to process. * This starts at ~0U to inidicate that we need to load/check prerequisistes. */ unsigned cLeft; } s_aEntries[64]; unsigned cEntries; int rc = 0; /* Prerequisites are always global and they just aren't executables. */ fFlags &= ~(KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE | KLDRDYLD_LOAD_FLAGS_EXECUTABLE); /* push the first entry. */ s_aEntries[0].pMod = pMod; s_aEntries[0].cLeft = ~0U; cEntries = 1; /* * The recursion loop. */ while (!rc && cEntries > 0) { const unsigned i = cEntries - 1; pMod = s_aEntries[i].pMod; if (s_aEntries[i].cLeft == ~0U) { /* * Load prerequisite modules. */ switch (pMod->enmState) { /* * Load immediate prerequisite modules and push the ones needing * attention onto the stack. */ case KLDRSTATE_MAPPED: case KLDRSTATE_RELOADED: case KLDRSTATE_PENDING_TERMINATION: rc = kldrDyldModLoadPrerequisites(pMod, pszPrefix, pszSuffix, enmSearch, fFlags); KLDRDYLD_ASSERT( pMod->enmState == KLDRSTATE_GOOD || pMod->enmState == KLDRSTATE_RELOADED_LOADED_PREREQUISITES || pMod->enmState == KLDRSTATE_LOADED_PREREQUISITES || rc); if (!rc) s_aEntries[i].cLeft = pMod->cPrereqs; break; /* * Check its prerequisite modules the first time around. */ case KLDRSTATE_PENDING_INITIALIZATION: if (pMod->fAlreadySeen) break; pMod->fAlreadySeen = 1; s_aEntries[i].cLeft = pMod->cPrereqs; break; /* * These are ok. */ case KLDRSTATE_LOADED_PREREQUISITES: case KLDRSTATE_RELOADED_LOADED_PREREQUISITES: case KLDRSTATE_INITIALIZING: case KLDRSTATE_GOOD: s_aEntries[i].cLeft = 0; break; /* * All other stats are invalid. */ default: KLDRDYLD_ASSERT(!"invalid state"); break; } } else if (s_aEntries[i].cLeft > 0) { /* * Recurse down into the next prereq. */ KLDRDYLD_ASSERT(s_aEntries[i].cLeft <= pMod->cPrereqs); if (cEntries < sizeof(s_aEntries) / sizeof(s_aEntries[0])) { s_aEntries[cEntries].cLeft = ~(KU32)0; s_aEntries[cEntries].pMod = pMod->papPrereqs[pMod->cPrereqs - s_aEntries[i].cLeft]; s_aEntries[i].cLeft--; cEntries++; } else rc = KLDR_ERR_PREREQUISITE_RECURSED_TOO_DEEPLY; } else { /* * We're done with this module, record it for init/cleanup. */ cEntries--; if (pMod->enmState != KLDRSTATE_GOOD) { kldrDyldStackAddModule(pMod); if ( !(fFlags & KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT) && !pMod->fInitList) { pMod->fInitList = 1; pMod->InitTerm.pNext = NULL; pMod->InitTerm.pPrev = g_pkLdrDyldInitTail; if (g_pkLdrDyldInitTail) g_pkLdrDyldInitTail->InitTerm.pNext = pMod; else g_pkLdrDyldInitHead = pMod; g_pkLdrDyldInitTail = pMod; } } } } return rc; } /** * Gets prerequisite module. * * This will try load the requested module if necessary, returning it in the MAPPED state. * * @returns 0 on success. * @returns KLDR_ERR_MODULE_NOT_FOUND or I/O error on failure. * @param pszDll The name of the dll to look for. * @param pszPrefix Prefix than can be used when searching. * @param pszSuffix Suffix than can be used when searching. * @param enmSearch Method to use when locating the module. * @param fFlags Flags, a combintation of the KLDRYDLD_LOAD_FLAGS_* \#defines. * @param pDep The depentant module. * @param ppMod Where to put the module we get. */ int kldrDyldGetPrerequisite(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PKLDRDYLDMOD pDep, PPKLDRDYLDMOD ppMod) { int rc; PKLDRDYLDMOD pMod; *ppMod = NULL; /* * Try find the module among the ones that's already loaded. * * This is very similar to the kldrDyldDoLoad code, except it has to deal with * a couple of additional states and occurs only during prerequisite loading * and the action taken is a little bit different. */ rc = kldrDyldFindExistingModule(pszDll, pszPrefix, pszSuffix, enmSearch, fFlags, &pMod); if (!rc) { switch (pMod->enmState) { /* * These are good. */ case KLDRSTATE_MAPPED: case KLDRSTATE_RELOADED: case KLDRSTATE_LOADED_PREREQUISITES: case KLDRSTATE_RELOADED_LOADED_PREREQUISITES: case KLDRSTATE_PENDING_INITIALIZATION: case KLDRSTATE_INITIALIZING: case KLDRSTATE_GOOD: case KLDRSTATE_PENDING_TERMINATION: break; /* * The module has been terminated so it need to be reloaded, have it's * prereqs loaded, fixed up and initialized before we can use it again. */ case KLDRSTATE_PENDING_GC: rc = kldrDyldModReload(pMod); break; /* * The module can't be loaded because it failed to initialize already. */ case KLDRSTATE_INITIALIZATION_FAILED: rc = KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED; break; /* * Forget it, no idea how to deal with re-initialization. */ case KLDRSTATE_TERMINATING: return KLDR_ERR_PREREQUISITE_MODULE_TERMINATING; /* * Invalid state. */ default: KLDRDYLD_ASSERT(!"invalid state"); break; } } else { /* * We'll have to load it from file. */ rc = kldrDyldFindNewModule(pszDll, pszPrefix, pszSuffix, enmSearch, fFlags, &pMod); if (!rc) rc = kldrDyldModMap(pMod); } /* * On success add dependency. */ if (!rc) { kldrDyldModAddDep(pMod, pDep); *ppMod = pMod; } return rc; } /** * Starts a new load stack frame. * * @returns Where the new stack frame starts. * @param pLoadMod The module being loaded (only used for asserting). */ static KU32 kldrDyldStackNewFrame(PKLDRDYLDMOD pLoadMod) { /* * Clear the fAlreadySeen flags. */ PKLDRDYLDMOD pMod = kLdrDyldHead; while (pMod) { pMod->fAlreadySeen = 0; #ifdef KLDRDYLD_ASSERT switch (pMod->enmState) { case KLDRSTATE_MAPPED: case KLDRSTATE_RELOADED: /* only the just loaded module can be in this state. */ KLDRDYLD_ASSERT(pMod == pLoadMod); break; case KLDRSTATE_PENDING_INITIALIZATION: case KLDRSTATE_INITIALIZING: case KLDRSTATE_PENDING_TERMINATION: case KLDRSTATE_PENDING_GC: case KLDRSTATE_TERMINATING: case KLDRSTATE_INITIALIZATION_FAILED: case KLDRSTATE_PENDING_DESTROY: /* requires recursion. */ KLDRDYLD_ASSERT(g_cActiveLoadCalls + g_cActiveLoadCalls + g_fActiveGC > 1); break; case KLDRSTATE_GOOD: /* requires nothing. */ break; default: KLDRDYLD_ASSERT(!"Invalid state"); break; } #endif /* next */ pMod = pMod->Load.pNext; } return g_cStackMods; } /** * Records the module. * * @return 0 on success, KERR_NO_MEMORY if we can't expand the table. * @param pMod The module to record. */ static int kldrDyldStackAddModule(PKLDRDYLDMOD pMod) { /* * Grow the stack if necessary. */ if (g_cStackMods + 1 > g_cStackModsAllocated) { KU32 cNew = g_cStackModsAllocated ? g_cStackModsAllocated * 2 : 128; void *pvOld = g_papStackMods; void *pvNew = kHlpAlloc(cNew * sizeof(g_papStackMods[0])); if (!pvNew) return KERR_NO_MEMORY; kHlpMemCopy(pvNew, pvOld, g_cStackMods * sizeof(g_papStackMods[0])); g_papStackMods = (PPKLDRDYLDMOD)pvNew; kHlpFree(pvOld); } /* * Add a reference and push the module onto the stack. */ kldrDyldModAddRef(pMod); g_papStackMods[g_cStackMods++] = pMod; return 0; } /** * The frame has been completed. * * @returns Where the frame ends. */ static int kldrDyldStackFrameCompleted(void) { return g_cStackMods; } /** * Worker routine for kldrDyldStackDropFrame() and kldrDyldDoLoad(). * * @param pMod The module to perform cleanups on. * @param rc Used for state verification. */ static void kldrDyldStackCleanupOne(PKLDRDYLDMOD pMod, int rc) { switch (pMod->enmState) { /* * Just push it along to the PENDING_DESTROY state. */ case KLDRSTATE_MAPPED: KLDRDYLD_ASSERT(rc); kldrDyldModUnmap(pMod); KLDRDYLD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_DESTROY); break; /* * Move back to PENDING_GC. */ case KLDRSTATE_RELOADED: KLDRDYLD_ASSERT(rc); pMod->enmState = KLDRSTATE_PENDING_GC; break; /* * Unload prerequisites and unmap the modules. */ case KLDRSTATE_LOADED_PREREQUISITES: case KLDRSTATE_FIXED_UP: KLDRDYLD_ASSERT(rc); kldrDyldModUnloadPrerequisites(pMod); KLDRDYLD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_DESTROY); kldrDyldModUnmap(pMod); KLDRDYLD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_DESTROY); break; /* * Unload prerequisites and push it back to PENDING_GC. */ case KLDRSTATE_RELOADED_LOADED_PREREQUISITES: case KLDRSTATE_RELOADED_FIXED_UP: kldrDyldModUnloadPrerequisites(pMod); KLDRDYLD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_GC); break; /* * Nothing to do, just asserting sanity. */ case KLDRSTATE_INITIALIZING: /* Implies there is another load going on. */ KLDRDYLD_ASSERT(g_cActiveLoadCalls > 1); break; case KLDRSTATE_TERMINATING: /* GC in progress. */ KLDRDYLD_ASSERT(g_fActiveGC); break; case KLDRSTATE_PENDING_TERMINATION: case KLDRSTATE_PENDING_INITIALIZATION: case KLDRSTATE_PENDING_GC: case KLDRSTATE_PENDING_DESTROY: KLDRDYLD_ASSERT(rc); break; case KLDRSTATE_GOOD: break; /* * Bad states. */ default: KLDRDYLD_ASSERT(!"drop frame bad state (a)"); break; } } /** * Done with the stack frame, dereference all the modules in it. * * @param iLoad1st The start of the stack frame. * @param iLoadEnd The end of the stack frame. * @param rc Used for state verification. */ static void kldrDyldStackDropFrame(KU32 iLoad1st, KU32 iLoadEnd, int rc) { KU32 i; KLDRDYLD_ASSERT(iLoad1st <= g_cStackMods); KLDRDYLD_ASSERT(iLoadEnd == g_cStackMods); /* * First pass: Do all the cleanups we can, but don't destroy anything just yet. */ i = iLoadEnd; while (i-- > iLoad1st) { PKLDRDYLDMOD pMod = g_papStackMods[i]; kldrDyldStackCleanupOne(pMod, rc); } /* * Second pass: Release the references so modules pending destruction * can be completely removed. */ for (i = iLoad1st; i < iLoadEnd ; i++) { PKLDRDYLDMOD pMod = g_papStackMods[i]; /* * Revalidate the module state. */ switch (pMod->enmState) { case KLDRSTATE_INITIALIZING: case KLDRSTATE_TERMINATING: case KLDRSTATE_PENDING_TERMINATION: case KLDRSTATE_PENDING_INITIALIZATION: case KLDRSTATE_PENDING_GC: case KLDRSTATE_PENDING_DESTROY: case KLDRSTATE_GOOD: break; default: KLDRDYLD_ASSERT(!"drop frame bad state (b)"); break; } /* * Release it. */ kldrDyldModDeref(pMod); } /* * Drop the stack frame. */ g_cStackMods = iLoad1st; } /** * Do garbage collection. * * This isn't doing anything unless it's called from the last * load or unload call. */ static void kldrDyldDoModuleTerminationAndGarabageCollection(void) { PKLDRDYLDMOD pMod; /* * We don't do anything until we're got rid of all recursive calls. * This will ensure that we get the most optimal termination order and * that we don't unload anything too early. */ if (g_cActiveLoadCalls || g_cActiveUnloadCalls || g_fActiveGC) return; g_fActiveGC = 1; do { /* * 1. Release prerequisites for any left over modules. */ for (pMod = kLdrDyldHead; pMod; pMod = pMod->Load.pNext) { kldrDyldModAddRef(pMod); switch (pMod->enmState) { case KLDRSTATE_GOOD: case KLDRSTATE_PENDING_GC: case KLDRSTATE_PENDING_TERMINATION: break; case KLDRSTATE_INITIALIZATION_FAILED: /* just in case */ case KLDRSTATE_PENDING_INITIALIZATION: kldrDyldModUnloadPrerequisites(pMod); break; default: KLDRDYLD_ASSERT(!"invalid GC state (a)"); break; } kldrDyldModDeref(pMod); } /* * 2. Do init calls until we encounter somebody calling load/unload. */ for (pMod = g_pkLdrDyldTermHead; pMod; pMod = pMod->InitTerm.pNext) { int fRestart = 0; kldrDyldModAddRef(pMod); switch (pMod->enmState) { case KLDRSTATE_GOOD: case KLDRSTATE_PENDING_GC: break; case KLDRSTATE_PENDING_TERMINATION: { const KU32 cTotalLoadCalls = g_cTotalLoadCalls; const KU32 cTotalUnloadCalls = g_cTotalUnloadCalls; kldrDyldModCallTerm(pMod); fRestart = cTotalLoadCalls != g_cTotalLoadCalls || cTotalUnloadCalls != g_cTotalUnloadCalls; break; } default: KLDRDYLD_ASSERT(!"invalid GC state (b)"); break; } kldrDyldModDeref(pMod); if (fRestart) break; } } while (pMod); /* * Unmap and destroy modules pending for GC. */ pMod = kLdrDyldHead; while (pMod) { PKLDRDYLDMOD pNext = pMod->Load.pNext; kldrDyldModAddRef(pMod); switch (pMod->enmState) { case KLDRSTATE_INITIALIZATION_FAILED: case KLDRSTATE_PENDING_GC: KLDRDYLD_ASSERT(!pMod->cDepRefs); KLDRDYLD_ASSERT(!pMod->cDynRefs); pMod->enmState = KLDRSTATE_GC; kldrDyldModUnmap(pMod); KLDRDYLD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_DESTROY); kldrDyldModDestroy(pMod); KLDRDYLD_ASSERT(pMod->enmState == KLDRSTATE_DESTROYED); break; case KLDRSTATE_GOOD: break; default: KLDRDYLD_ASSERT(!"invalid GC state (c)"); break; } kldrDyldModDeref(pMod); /* next */ pMod = pNext; } g_fActiveGC = 0; } /** * Worker for kLdrDyldUnload(). * @internal */ static int kldrDyldDoUnload(PKLDRDYLDMOD pMod) { return kldrDyldModDynamicUnload(pMod); } /** * Worker for kLdrDyldFindByName(). * @internal */ static int kldrDyldDoFindByName(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod) { return kldrDyldFindExistingModule(pszDll, pszPrefix, pszSuffix, enmSearch, fFlags, ppMod); } /** * Worker for kLdrDyldFindByAddress(). * @internal */ static int kldrDyldDoFindByAddress(KUPTR Address, PPKLDRDYLDMOD ppMod, KU32 *piSegment, KUPTR *poffSegment) { /* Scan the segments of each module in the load list. */ PKLDRDYLDMOD pMod = kLdrDyldHead; while (pMod) { KU32 iSeg; for (iSeg = 0; iSeg < pMod->pMod->cSegments; iSeg++) { KLDRADDR off = (KLDRADDR)Address - pMod->pMod->aSegments[iSeg].MapAddress; if (off < pMod->pMod->aSegments[iSeg].cb) { *ppMod = pMod->hMod; if (piSegment) *piSegment = iSeg; if (poffSegment) *poffSegment = (KUPTR)off; return 0; } } /* next */ pMod = pMod->Load.pNext; } return KLDR_ERR_MODULE_NOT_FOUND; } /** * Worker for kLdrDyldGetName(). * @internal */ static int kldrDyldDoGetName(PKLDRDYLDMOD pMod, char *pszName, KSIZE cchName) { return kldrDyldModGetName(pMod, pszName, cchName); } /** * Worker for kLdrDyldGetFilename(). * @internal */ static int kldrDyldDoGetFilename(PKLDRDYLDMOD pMod, char *pszFilename, KSIZE cchFilename) { return kldrDyldModGetFilename(pMod, pszFilename, cchFilename); } /** * Worker for kLdrDyldQuerySymbol(). * @internal */ static int kldrDyldDoQuerySymbol(PKLDRDYLDMOD pMod, KU32 uSymbolOrdinal, const char *pszSymbolName, KUPTR *pValue, KU32 *pfKind) { return kldrDyldModQuerySymbol(pMod, uSymbolOrdinal, pszSymbolName, pValue, pfKind); } /** * Panic / failure * * @returns rc if we're in a position where we can return. * @param rc Return code. * @param pszFormat Message string. Limited fprintf like formatted. * @param ... Message string arguments. */ int kldrDyldFailure(int rc, const char *pszFilename, ...) { /** @todo print it. */ if (g_fBootstrapping); kHlpExit(1); return rc; } /** * Copies the error string to the user buffer. * * @returns rc. * @param rc The status code. * @param pszErr Where to copy the error string to. * @param cchErr The size of the destination buffer. */ static int kldrDyldCopyError(int rc, char *pszErr, KSIZE cchErr) { KSIZE cchToCopy; /* if no error string, format the rc into a string. */ if (!g_szkLdrDyldError[0] && rc) kHlpInt2Ascii(g_szkLdrDyldError, sizeof(g_szkLdrDyldError), rc, 10); /* copy it if we got something. */ if (cchErr && pszErr && g_szkLdrDyldError[0]) { cchToCopy = kHlpStrLen(g_szkLdrDyldError); if (cchToCopy >= cchErr) cchToCopy = cchErr - 1; kHlpMemCopy(pszErr, g_szkLdrDyldError, cchToCopy); pszErr[cchToCopy] = '\0'; } return rc; } ���������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrDyldMod.c�������������������������������������������������������0000664�0001750�0001750�00000111571�14670377513�020741� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrDyldMod.c 81 2016-08-18 22:10:38Z bird $ */ /** @file * kLdr - The Dynamic Loader, Dyld module methods. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include "kLdrInternal.h" /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def KLDRDYLDMOD_STRICT * Define KLDRDYLDMOD_STRICT to enabled strict checks in kLdrDyld. */ #define KLDRDYLDMOD_STRICT 1 /** @def KLDRDYLDMOD_ASSERT * Assert that an expression is true when KLDRDYLD_STRICT is defined. */ #ifdef KLDRDYLDMOD_STRICT # define KLDRDYLDMOD_ASSERT(expr) kHlpAssert(expr) #else # define KLDRDYLDMOD_ASSERT(expr) do {} while (0) #endif /******************************************************************************* * Internal Functions * *******************************************************************************/ static void kldrDyldModUnlink(PKLDRDYLDMOD pMod); /** * Creates a module from the specified file provider instance. * * @returns 0 on success and *ppMod pointing to the new instance. * On failure a non-zero kLdr status code is returned. * @param pRdr The file provider instance. * @param fFlags Load/search flags. * @param ppMod Where to put the pointer to the new module on success. */ int kldrDyldModCreate(PKRDR pRdr, KU32 fFlags, PPKLDRDYLDMOD ppMod) { PKLDRDYLDMOD pMod; PKLDRMOD pRawMod; int rc; *ppMod = NULL; /** @todo deal with fFlags (exec/dll) */ /** @todo Check up the cpu architecture. */ /* * Try open an module interpreter. */ rc = kLdrModOpenFromRdr(pRdr, 0 /*fFlags*/, KCPUARCH_UNKNOWN, &pRawMod); if (rc) return kldrDyldFailure(rc, "%s: %rc", kRdrName(pRdr), rc); /* * Match the module aginst the load flags. */ switch (pRawMod->enmType) { case KLDRTYPE_EXECUTABLE_FIXED: case KLDRTYPE_EXECUTABLE_RELOCATABLE: case KLDRTYPE_EXECUTABLE_PIC: if (!(fFlags & KLDRDYLD_LOAD_FLAGS_EXECUTABLE)) { kLdrModClose(pRawMod); return KLDR_ERR_NOT_EXE; } break; case KLDRTYPE_OBJECT: /* We can handle these as DLLs. */ case KLDRTYPE_SHARED_LIBRARY_FIXED: case KLDRTYPE_SHARED_LIBRARY_RELOCATABLE: case KLDRTYPE_SHARED_LIBRARY_PIC: case KLDRTYPE_FORWARDER_DLL: if (fFlags & KLDRDYLD_LOAD_FLAGS_EXECUTABLE) { kLdrModClose(pRawMod); return KLDR_ERR_NOT_DLL; } break; default: KLDRDYLDMOD_ASSERT(!"Bad enmType!"); case KLDRTYPE_CORE: return fFlags & KLDRDYLD_LOAD_FLAGS_EXECUTABLE ? KLDR_ERR_NOT_EXE : KLDR_ERR_NOT_DLL; } /* * Allocate a new dyld module. */ pMod = (PKLDRDYLDMOD)kHlpAlloc(sizeof(*pMod)); if (pMod) { pMod->enmState = KLDRSTATE_OPEN; pMod->pMod = pRawMod; pMod->hMod = pMod; pMod->cDepRefs = pMod->cDynRefs = pMod->cRefs = 0; switch (pRawMod->enmType) { case KLDRTYPE_EXECUTABLE_FIXED: case KLDRTYPE_EXECUTABLE_RELOCATABLE: case KLDRTYPE_EXECUTABLE_PIC: pMod->fExecutable = 1; break; default: pMod->fExecutable = 0; break; } pMod->fGlobalOrSpecific = 0; pMod->fBindable = 0; pMod->fInitList = 0; pMod->fAlreadySeen = 0; pMod->fMapped = 0; pMod->fAllocatedTLS = 0; pMod->f25Reserved = 0; pMod->InitTerm.pNext = NULL; pMod->InitTerm.pPrev = NULL; pMod->Bind.pNext = NULL; pMod->Bind.pPrev = NULL; pMod->cPrereqs = 0; pMod->papPrereqs = NULL; pMod->u32MagicHead = KLDRDYMOD_MAGIC; pMod->u32MagicTail = KLDRDYMOD_MAGIC; /* it. */ pMod->Load.pNext = NULL; pMod->Load.pPrev = kLdrDyldTail; if (kLdrDyldTail) kLdrDyldTail->Load.pNext = pMod; else kLdrDyldHead = pMod; kLdrDyldTail = pMod; /* deal with the remaining flags. */ if (fFlags & KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE) kldrDyldModMarkSpecific(pMod); else kldrDyldModMarkGlobal(pMod); if (fFlags & KLDRYDLD_LOAD_FLAGS_GLOBAL_SYMBOLS) kldrDyldModSetBindable(pMod, 0 /* not deep binable */); else kldrDyldModClearBindable(pMod); /* * We're good. */ *ppMod = pMod; rc = 0; } else { kLdrModClose(pRawMod); rc = KERR_NO_MEMORY; } return rc; } /** * Creates a module for a native module. * * @returns 0 on success and *ppMod pointing to the new instance. * On failure a non-zero kLdr status code is returned. * @param hNativeModule The native handle. * @param ppMod Where to put the pointer to the new module on success. * @remark This function ain't finalized yet. */ int kldrDyldModCreateNative(KUPTR hNativeModule) { #if 0 /* * Check if this module is already loaded by the native OS loader. */ rc = kld { #if K_OS == K_OS_OS2 HMODULE hmod = NULLHANDLE; APIRET rc = DosQueryModuleHandle(kRdrName(pRdr), &hmod); if (!rc) #elif K_OS == K_OS_WINDOWS HMODULE hmod = NULL; if (GetModuleHandle(kRdrName(pRdr)) #else # error "Port me" #endif } #endif return -1; } /** * Destroys a module pending destruction. * * @param pMod The module in question. */ void kldrDyldModDestroy(PKLDRDYLDMOD pMod) { int rc; /* * Validate the state. */ switch (pMod->enmState) { case KLDRSTATE_PENDING_DESTROY: case KLDRSTATE_GC: break; default: KLDRDYLDMOD_ASSERT(!"Invalid state"); break; } KLDRDYLDMOD_ASSERT(!pMod->fInitList); KLDRDYLDMOD_ASSERT(!pMod->cDynRefs); KLDRDYLDMOD_ASSERT(!pMod->cDepRefs); /* * Ensure that the module is unmapped. */ if (pMod->fAllocatedTLS) { kLdrModFreeTLS(pMod->pMod, KLDRMOD_INT_MAP); pMod->fAllocatedTLS = 0; } if (pMod->fMapped) { rc = kLdrModUnmap(pMod->pMod); KLDRDYLDMOD_ASSERT(!rc); pMod->fMapped = 0; } /* * Ensure it's unlinked from all chains. */ if (pMod->enmState < KLDRSTATE_PENDING_DESTROY) kldrDyldModUnlink(pMod); /* * Free everything associated with the module. */ /* the prerequisite array. */ if (pMod->papPrereqs) { KU32 i = pMod->cPrereqs; while (i-- > 0) { KLDRDYLDMOD_ASSERT(pMod->papPrereqs[i] == NULL); pMod->papPrereqs[i] = NULL; } kHlpFree(pMod->papPrereqs); pMod->papPrereqs = NULL; pMod->cPrereqs = 0; } /* the module interpreter. */ if (pMod->pMod) { rc = kLdrModClose(pMod->pMod); KLDRDYLDMOD_ASSERT(!rc); pMod->pMod = NULL; } /* * Finally, change the module state and free the module if * there are not more references to it. If somebody is still * referencing it, postpone the freeing to Deref. */ pMod->enmState = KLDRSTATE_DESTROYED; if (!pMod->cRefs) { pMod->u32MagicHead = 1; pMod->u32MagicTail = 2; kHlpFree(pMod); } } /** * Unlinks the module from any list it might be in. * It is assumed that the module is at least linked into the load list. * * @param pMod The moduel. */ static void kldrDyldModUnlink(PKLDRDYLDMOD pMod) { /* load list */ if (pMod->Load.pNext) pMod->Load.pNext->Load.pPrev = pMod->Load.pPrev; else kLdrDyldTail = pMod->Load.pPrev; if (pMod->Load.pPrev) pMod->Load.pPrev->Load.pNext = pMod->Load.pNext; else kLdrDyldHead = pMod->Load.pNext; /* bind list */ if (pMod->fBindable) kldrDyldModClearBindable(pMod); /* init term */ if (pMod->fInitList) { KLDRDYLDMOD_ASSERT(pMod->enmState < KLDRSTATE_INITIALIZATION_FAILED); pMod->fInitList = 0; if (pMod->InitTerm.pNext) pMod->InitTerm.pNext->InitTerm.pPrev = pMod->InitTerm.pPrev; else g_pkLdrDyldInitTail = pMod->InitTerm.pPrev; if (pMod->InitTerm.pPrev) pMod->InitTerm.pPrev->InitTerm.pNext = pMod->InitTerm.pNext; else g_pkLdrDyldInitHead = pMod->InitTerm.pNext; } else if (pMod->enmState > KLDRSTATE_INITIALIZATION_FAILED) { KLDRDYLDMOD_ASSERT(pMod->enmState >= KLDRSTATE_GOOD); if (pMod->InitTerm.pNext) pMod->InitTerm.pNext->InitTerm.pPrev = pMod->InitTerm.pPrev; else g_pkLdrDyldTermTail = pMod->InitTerm.pPrev; if (pMod->InitTerm.pPrev) pMod->InitTerm.pPrev->InitTerm.pNext = pMod->InitTerm.pNext; else g_pkLdrDyldTermHead = pMod->InitTerm.pNext; } pMod->InitTerm.pNext = NULL; pMod->InitTerm.pPrev = NULL; } /** * Marks a module as bindable, i.e. it'll be considered when * resolving names the unix way. * * @param pMod The module. * @param fDeep When set the module will be inserted at the head of the * module list used to resolve symbols. This means that the * symbols in this module will be prefered of all the other * modules. */ void kldrDyldModSetBindable(PKLDRDYLDMOD pMod, unsigned fDeep) { KLDRDYLDMOD_ASSERT(pMod->enmState >= KLDRSTATE_OPEN && pMod->enmState < KLDRSTATE_PENDING_GC); if (!pMod->fBindable) { pMod->fBindable = 1; if (!fDeep) { pMod->Bind.pNext = NULL; pMod->Bind.pPrev = g_pkLdrDyldBindTail; if (g_pkLdrDyldBindTail) g_pkLdrDyldBindTail->Bind.pNext = pMod; else g_pkLdrDyldBindHead = pMod; g_pkLdrDyldBindTail = pMod; } else { pMod->Bind.pPrev = NULL; pMod->Bind.pNext = g_pkLdrDyldBindHead; if (g_pkLdrDyldBindHead) g_pkLdrDyldBindHead->Bind.pPrev = pMod; else g_pkLdrDyldBindTail = pMod; g_pkLdrDyldBindHead = pMod; } } } /** * Marks a module as not bindable, i.e. it will not be considered when * resolving names the unix way. * * @param pMod The module. */ void kldrDyldModClearBindable(PKLDRDYLDMOD pMod) { KLDRDYLDMOD_ASSERT(pMod->enmState >= KLDRSTATE_OPEN && pMod->enmState < KLDRSTATE_PENDING_DESTROY); if (pMod->fBindable) { pMod->fBindable = 0; if (pMod->Bind.pPrev) pMod->Bind.pPrev->Bind.pNext = pMod->Bind.pNext; else g_pkLdrDyldBindHead = pMod->Bind.pNext; if (pMod->Bind.pNext) pMod->Bind.pNext->Bind.pPrev = pMod->Bind.pPrev; else g_pkLdrDyldBindTail = pMod->Bind.pPrev; pMod->Bind.pNext = NULL; pMod->Bind.pPrev = NULL; } } /** * Marks the module as global instead of being specific. * * A global module can be a matching result when the request * doesn't specify a path. A specific module will not match * unless the path also matches. * * @param pMod The module. */ void kldrDyldModMarkGlobal(PKLDRDYLDMOD pMod) { pMod->fGlobalOrSpecific = 1; } /** * Marks the module as specific instead of global. * * See kldrDyldModMarkGlobal for an explanation of the two terms. * * @param pMod The module. */ void kldrDyldModMarkSpecific(PKLDRDYLDMOD pMod) { pMod->fGlobalOrSpecific = 0; } /** * Adds a reference to the module making sure it won't be freed just yet. * * @param pMod The module. */ void kldrDyldModAddRef(PKLDRDYLDMOD pMod) { pMod->cRefs++; } /** * Dereference a module. * * @param pMod */ void kldrDyldModDeref(PKLDRDYLDMOD pMod) { /* validate input */ KLDRDYLDMOD_ASSERT(pMod->cRefs > 0); KLDRDYLDMOD_ASSERT(pMod->cRefs >= pMod->cDepRefs + pMod->cDynRefs); KLDRDYLDMOD_ASSERT(pMod->enmState > KLDRSTATE_INVALID && pMod->enmState <= KLDRSTATE_END); /* decrement. */ if (pMod->cRefs > 0) pMod->cRefs--; /* execute delayed freeing. */ if ( pMod->enmState == KLDRSTATE_DESTROYED && !pMod->cRefs) { pMod->u32MagicHead = 1; pMod->u32MagicTail = 2; kHlpFree(pMod); } } /** * Increment the count of modules depending on this module. * * @param pMod The module. * @param pDep The module which depends on us. */ void kldrDyldModAddDep(PKLDRDYLDMOD pMod, PKLDRDYLDMOD pDep) { (void)pDep; /* validate state */ switch (pMod->enmState) { case KLDRSTATE_MAPPED: case KLDRSTATE_RELOADED: case KLDRSTATE_LOADED_PREREQUISITES: case KLDRSTATE_RELOADED_LOADED_PREREQUISITES: case KLDRSTATE_PENDING_INITIALIZATION: case KLDRSTATE_INITIALIZING: case KLDRSTATE_GOOD: break; default: KLDRDYLDMOD_ASSERT(!"invalid state"); break; } KLDRDYLDMOD_ASSERT(pMod->enmState > KLDRSTATE_INVALID && pMod->enmState <= KLDRSTATE_END); pMod->cRefs++; pMod->cDepRefs++; } /** * Drop a dependency. * * @param pMod The module. * @param pDep The module which depends on us. */ void kldrDyldModRemoveDep(PKLDRDYLDMOD pMod, PKLDRDYLDMOD pDep) { KLDRDYLDMOD_ASSERT(pMod->cDepRefs > 0); if (pMod->cDepRefs == 0) return; KLDRDYLDMOD_ASSERT(pMod->cDepRefs <= pMod->cRefs); KLDRDYLDMOD_ASSERT(pMod->enmState >= KLDRSTATE_MAPPED && pMod->enmState <= KLDRSTATE_PENDING_DESTROY); pMod->cRefs--; pMod->cDepRefs--; if ( pMod->cDepRefs > 0 || pMod->cDynRefs > 0) return; /* * The module should be unloaded. */ kldrDyldModUnloadPrerequisites(pMod); } /** * Increment the dynamic load count. * * @returns 0 * @param pMod The module. */ int kldrDyldModDynamicLoad(PKLDRDYLDMOD pMod) { KLDRDYLDMOD_ASSERT( pMod->enmState == KLDRSTATE_GOOD || pMod->enmState == KLDRSTATE_PENDING_INITIALIZATION || pMod->enmState == KLDRSTATE_INITIALIZING); pMod->cRefs++; pMod->cDynRefs++; return 0; } /** * Decrement the dynamic load count of the module and unload the module * if the total reference count reaches zero. * * This may cause a cascade of unloading to occure. See kldrDyldModUnloadPrerequisites(). * * @returns status code. * @retval 0 on success. * @retval KLDR_ERR_NOT_LOADED_DYNAMICALLY if the module wasn't loaded dynamically. * @param pMod The module to unload. */ int kldrDyldModDynamicUnload(PKLDRDYLDMOD pMod) { if (pMod->cDynRefs == 0) return KLDR_ERR_NOT_LOADED_DYNAMICALLY; KLDRDYLDMOD_ASSERT(pMod->cDynRefs <= pMod->cRefs); KLDRDYLDMOD_ASSERT(pMod->enmState == KLDRSTATE_GOOD); pMod->cRefs--; pMod->cDynRefs--; if ( pMod->cDynRefs > 0 || pMod->cDepRefs > 0) return 0; /* * The module should be unloaded. */ kldrDyldModUnloadPrerequisites(pMod); return 0; } /** * Worker for kldrDyldModUnloadPrerequisites. * * @returns The number of modules that now can be unloaded. * @param pMod The module in question. */ static KU32 kldrDyldModUnloadPrerequisitesOne(PKLDRDYLDMOD pMod) { PKLDRDYLDMOD pMod2; KU32 cToUnload = 0; KU32 i; KLDRDYLDMOD_ASSERT(pMod->papPrereqs || !pMod->cPrereqs); /* * Release the one in this module. */ for (i = 0; i < pMod->cPrereqs; i++) { pMod2 = pMod->papPrereqs[i]; if (pMod2) { pMod->papPrereqs[i] = NULL; /* do the derefering ourselves or we'll end up in a recursive loop here. */ KLDRDYLDMOD_ASSERT(pMod2->cDepRefs > 0); KLDRDYLDMOD_ASSERT(pMod2->cRefs >= pMod2->cDepRefs); pMod2->cDepRefs--; pMod2->cRefs--; cToUnload += !pMod2->cDepRefs && !pMod2->cDynRefs; } } /* * Change the state */ switch (pMod->enmState) { case KLDRSTATE_LOADED_PREREQUISITES: case KLDRSTATE_FIXED_UP: pMod->enmState = KLDRSTATE_PENDING_DESTROY; kldrDyldModUnlink(pMod); break; case KLDRSTATE_PENDING_INITIALIZATION: pMod->enmState = KLDRSTATE_PENDING_GC; break; case KLDRSTATE_RELOADED_FIXED_UP: case KLDRSTATE_RELOADED_LOADED_PREREQUISITES: case KLDRSTATE_GOOD: pMod->enmState = KLDRSTATE_PENDING_TERMINATION; break; case KLDRSTATE_INITIALIZATION_FAILED: break; default: KLDRDYLDMOD_ASSERT(!"invalid state"); break; } return cToUnload; } /** * This is the heart of the unload code. * * It will recursivly (using the load list) initiate module unloading * of all affected modules. * * This function will cause a state transition to PENDING_DESTROY, PENDING_GC * or PENDING_TERMINATION depending on the module state. There is one exception * to this, and that's INITIALIZATION_FAILED, where the state will not be changed. * * @param pMod The module which prerequisites should be unloaded. */ void kldrDyldModUnloadPrerequisites(PKLDRDYLDMOD pMod) { KU32 cToUnload; /* sanity */ #ifdef KLDRDYLD_STRICT { PKLDRDYLDMOD pMod2; for (pMod2 = kLdrDyldHead; pMod2; pMod2 = pMod2->Load.pNext) KLDRDYLDMOD_ASSERT(pMod2->enmState != KLDRSTATE_GOOD || pMod2->cRefs); } #endif KLDRDYLDMOD_ASSERT(pMod->papPrereqs); /* * Unload prereqs of the module we're called on first. */ cToUnload = kldrDyldModUnloadPrerequisitesOne(pMod); /* * Iterate the load list in a cyclic manner until there are no more * modules that can be pushed on into unloading. */ while (cToUnload) { cToUnload = 0; for (pMod = kLdrDyldHead; pMod; pMod = pMod->Load.pNext) { if ( pMod->cDepRefs || pMod->cDynRefs || pMod->enmState >= KLDRSTATE_PENDING_TERMINATION || pMod->enmState < KLDRSTATE_LOADED_PREREQUISITES) continue; cToUnload += kldrDyldModUnloadPrerequisitesOne(pMod); } } } /** * Loads the prerequisite modules this module depends on. * * To find each of the prerequisite modules this method calls * kldrDyldGetPrerequisite() and it will make sure the modules * are added to the load stack frame. * * @returns 0 on success, non-zero native OS or kLdr status code on failure. * The state is changed to LOADED_PREREQUISITES or RELOADED_LOADED_PREREQUISITES. * @param pMod The module. * @param pszPrefix Prefix to use when searching. * @param pszSuffix Suffix to use when searching. * @param enmSearch Method to use when locating the module and any modules it may depend on. * @param fFlags Flags, a combintation of the KLDRYDLD_LOAD_FLAGS_* \#defines. */ int kldrDyldModLoadPrerequisites(PKLDRDYLDMOD pMod, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags) { KI32 cPrereqs; KU32 i; int rc = 0; /* sanity */ switch (pMod->enmState) { case KLDRSTATE_MAPPED: case KLDRSTATE_RELOADED: break; default: KLDRDYLDMOD_ASSERT(!"invalid state"); return -1; } /* * Query number of prerequiste modules and allocate the array. */ cPrereqs = kLdrModNumberOfImports(pMod->pMod, NULL); kHlpAssert(cPrereqs >= 0); if (pMod->cPrereqs != cPrereqs) { KLDRDYLDMOD_ASSERT(!pMod->papPrereqs); pMod->papPrereqs = (PPKLDRDYLDMOD)kHlpAllocZ(sizeof(pMod->papPrereqs[0]) * cPrereqs); if (!pMod->papPrereqs) return KERR_NO_MEMORY; pMod->cPrereqs = cPrereqs; } else KLDRDYLDMOD_ASSERT(pMod->papPrereqs || !pMod->cPrereqs); /* * Iterate the prerequisites and load them. */ for (i = 0; i < pMod->cPrereqs; i++) { static char s_szPrereq[260]; PKLDRDYLDMOD pPrereqMod; KLDRDYLDMOD_ASSERT(pMod->papPrereqs[i] == NULL); rc = kLdrModGetImport(pMod->pMod, NULL, i, s_szPrereq, sizeof(s_szPrereq)); if (rc) break; rc = kldrDyldGetPrerequisite(s_szPrereq, pszPrefix, pszSuffix, enmSearch, fFlags, pMod, &pPrereqMod); if (rc) break; pMod->papPrereqs[i] = pPrereqMod; } /* change the state regardless of what happend. */ if (pMod->enmState == KLDRSTATE_MAPPED) pMod->enmState = KLDRSTATE_LOADED_PREREQUISITES; else pMod->enmState = KLDRSTATE_RELOADED_LOADED_PREREQUISITES; return rc; } /** * Maps an open module. * * On success the module will be in the MAPPED state. * * @returns 0 on success, non-zero native OS or kLdr status code on failure. * @param pMod The module which needs to be unmapped and set pending for destruction. */ int kldrDyldModMap(PKLDRDYLDMOD pMod) { int rc; /* sanity */ KLDRDYLDMOD_ASSERT(pMod->enmState == KLDRSTATE_OPEN); KLDRDYLDMOD_ASSERT(!pMod->fMapped); if (pMod->fMapped) return 0; /* do the job. */ rc = kLdrModMap(pMod->pMod); if (!rc) { rc = kLdrModAllocTLS(pMod->pMod, KLDRMOD_INT_MAP); if (!rc) { /** @todo TLS */ pMod->fMapped = 1; pMod->enmState = KLDRSTATE_MAPPED; } else kLdrModUnmap(pMod->pMod); } return rc; } /** * Unmaps the module, unlinks it from everywhere marks it PENDING_DESTROY. * * @returns 0 on success, non-zero native OS or kLdr status code on failure. * @param pMod The module which needs to be unmapped and set pending for destruction. */ int kldrDyldModUnmap(PKLDRDYLDMOD pMod) { int rc; /* sanity */ KLDRDYLDMOD_ASSERT(pMod->cRefs > 0); KLDRDYLDMOD_ASSERT(pMod->fMapped); switch (pMod->enmState) { case KLDRSTATE_MAPPED: case KLDRSTATE_GC: case KLDRSTATE_PENDING_DESTROY: break; default: KLDRDYLDMOD_ASSERT(!"invalid state"); return -1; } /* do the job. */ if (pMod->fAllocatedTLS) { kLdrModFreeTLS(pMod->pMod, KLDRMOD_INT_MAP); pMod->fAllocatedTLS = 0; } rc = kLdrModUnmap(pMod->pMod); if (!rc) { pMod->fMapped = 0; if (pMod->enmState < KLDRSTATE_PENDING_DESTROY) { pMod->enmState = KLDRSTATE_PENDING_DESTROY; kldrDyldModUnlink(pMod); } } return rc; } /** * Reloads the module. * * Reloading means that all modified pages are restored to their original * state. Whether this includes the code segments depends on whether the fixups * depend on the addend in the place they are fixing up - so it's format specific. * * @returns 0 on success, non-zero native OS or kLdr status code on failure. * @param pMod The module which needs to be unmapped and set pending for destruction. */ int kldrDyldModReload(PKLDRDYLDMOD pMod) { int rc; /* sanity */ KLDRDYLDMOD_ASSERT(pMod->cRefs > 0); KLDRDYLDMOD_ASSERT(pMod->fMapped); switch (pMod->enmState) { case KLDRSTATE_MAPPED: case KLDRSTATE_GC: case KLDRSTATE_PENDING_DESTROY: break; default: KLDRDYLDMOD_ASSERT(!"invalid state"); return -1; } /* Free TLS before reloading. */ if (pMod->fAllocatedTLS) { kLdrModFreeTLS(pMod->pMod, KLDRMOD_INT_MAP); pMod->fAllocatedTLS = 0; } /* Let the module interpreter do the reloading of the mapping. */ rc = kLdrModReload(pMod->pMod); if (!rc) { rc = kLdrModAllocTLS(pMod->pMod, KLDRMOD_INT_MAP); if (!rc) { pMod->fAllocatedTLS = 1; pMod->enmState = KLDRSTATE_RELOADED; } } return rc; } /** * @copydoc FNKLDRMODGETIMPORT * pvUser points to the KLDRDYLDMOD. */ static int kldrDyldModFixupGetImportCallback(PKLDRMOD pMod, KU32 iImport, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PKLDRADDR puValue, KU32 *pfKind, void *pvUser) { static int s_cRecursiveCalls = 0; PKLDRDYLDMOD pDyldMod = (PKLDRDYLDMOD)pvUser; int rc; /* guard against too deep forwarder recursion. */ if (s_cRecursiveCalls >= 5) return KLDR_ERR_TOO_LONG_FORWARDER_CHAIN; s_cRecursiveCalls++; if (iImport != NIL_KLDRMOD_IMPORT) { /* specific import module search. */ PKLDRDYLDMOD pPrereqMod; KLDRDYLDMOD_ASSERT(iImport < pDyldMod->cPrereqs); pPrereqMod = pDyldMod->papPrereqs[iImport]; KLDRDYLDMOD_ASSERT(pPrereqMod); KLDRDYLDMOD_ASSERT(pPrereqMod->u32MagicHead == KLDRDYMOD_MAGIC); KLDRDYLDMOD_ASSERT(pPrereqMod->u32MagicTail == KLDRDYMOD_MAGIC); KLDRDYLDMOD_ASSERT(pPrereqMod->enmState < KLDRSTATE_TERMINATING); rc = kLdrModQuerySymbol(pPrereqMod->pMod, NULL, KLDRMOD_BASEADDRESS_MAP, iSymbol, pchSymbol, cchSymbol, pszVersion, kldrDyldModFixupGetImportCallback, pPrereqMod, puValue, pfKind); if (rc) { if (pchSymbol) kldrDyldFailure(rc, "%s[%d]->%s.%.*s%s", pDyldMod->pMod->pszName, iImport, pPrereqMod->pMod->pszName, cchSymbol, pchSymbol, pszVersion ? pszVersion : ""); else kldrDyldFailure(rc, "%s[%d]->%s.%d%s", pDyldMod->pMod->pszName, iImport, pPrereqMod->pMod->pszName, iSymbol, pszVersion ? pszVersion : ""); } } else { /* bind list search. */ unsigned fFound = 0; PKLDRDYLDMOD pBindMod = g_pkLdrDyldBindHead; rc = 0; while (pBindMod) { KU32 fKind; KLDRADDR uValue; rc = kLdrModQuerySymbol(pBindMod->pMod, NULL, KLDRMOD_BASEADDRESS_MAP, iSymbol, pchSymbol, cchSymbol, pszVersion, kldrDyldModFixupGetImportCallback, pBindMod, &uValue, &fKind); if ( !rc && ( !fFound || !(fKind & KLDRSYMKIND_WEAK) ) ) { *pfKind = fKind; *puValue = uValue; fFound = 1; if (!(fKind & KLDRSYMKIND_WEAK)) break; } /* next */ pBindMod = pBindMod->Bind.pNext; } rc = fFound ? 0 : KLDR_ERR_SYMBOL_NOT_FOUND; if (!fFound) { if (pchSymbol) kldrDyldFailure(rc, "%s->%.*s%s", pDyldMod->pMod->pszName, cchSymbol, pchSymbol, pszVersion ? pszVersion : ""); else kldrDyldFailure(rc, "%s->%d%s", pDyldMod->pMod->pszName, iSymbol, pszVersion ? pszVersion : ""); } } s_cRecursiveCalls--; return rc; } /** * Applies fixups to a module which prerequisistes has been * successfully loaded. * * @returns 0 on success, non-zero native OS or kLdr status code on failure. * @param pMod The module which needs to be unmapped and set pending for destruction. */ int kldrDyldModFixup(PKLDRDYLDMOD pMod) { int rc; /* sanity */ KLDRDYLDMOD_ASSERT(pMod->cRefs > 0); KLDRDYLDMOD_ASSERT( pMod->enmState == KLDRSTATE_LOADED_PREREQUISITES || pMod->enmState == KLDRSTATE_RELOADED_LOADED_PREREQUISITES); /* do the job */ rc = kLdrModFixupMapping(pMod->pMod, kldrDyldModFixupGetImportCallback, pMod);/** @todo fixme. */ if (!rc) pMod->enmState = KLDRSTATE_FIXED_UP; return rc; } /** * Calls the module initialization entry point if any. * * This is considered to be a module specific thing and leave if * to the module interpreter. They will have to deal with different * module init practices between platforms should there be any. * * @returns 0 and state changed to GOOD on success. * Non-zero OS or kLdr status code and status changed to INITIALIZATION_FAILED on failure. * @param pMod The module that should be initialized. */ int kldrDyldModCallInit(PKLDRDYLDMOD pMod) { int rc; KLDRDYLDMOD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_INITIALIZATION); KLDRDYLDMOD_ASSERT(!pMod->fInitList); pMod->enmState = KLDRSTATE_INITIALIZING; rc = kLdrModCallInit(pMod->pMod, KLDRMOD_INT_MAP, (KUPTR)pMod->hMod); if (!rc) { pMod->enmState = KLDRSTATE_GOOD; /* push it onto the termination list.*/ pMod->InitTerm.pPrev = NULL; pMod->InitTerm.pNext = g_pkLdrDyldTermHead; if (g_pkLdrDyldTermHead) g_pkLdrDyldTermHead->InitTerm.pPrev = pMod; else g_pkLdrDyldTermTail = pMod; g_pkLdrDyldTermHead = pMod; } else pMod->enmState = KLDRSTATE_INITIALIZATION_FAILED; return rc; } /** * Calls the module termination entry point if any. * * This'll change the module status to PENDING_GC. * * @param pMod The module that should be initialized. */ void kldrDyldModCallTerm(PKLDRDYLDMOD pMod) { KLDRDYLDMOD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_TERMINATION); pMod->enmState = KLDRSTATE_TERMINATING; kLdrModCallTerm(pMod->pMod, KLDRMOD_INT_MAP, (KUPTR)pMod->hMod); pMod->enmState = KLDRSTATE_PENDING_GC; /* unlinking on destruction. */ } /** * Calls the thread attach entry point if any. * * @returns 0 on success, non-zero on failure. * @param pMod The module. */ int kldrDyldModAttachThread(PKLDRDYLDMOD pMod) { KLDRDYLDMOD_ASSERT(pMod->enmState == KLDRSTATE_GOOD); return kLdrModCallThread(pMod->pMod, KLDRMOD_INT_MAP, (KUPTR)pMod->hMod, 1 /* attach */); } /** * Calls the thread detach entry point if any. * * @returns 0 on success, non-zero on failure. * @param pMod The module. */ void kldrDyldModDetachThread(PKLDRDYLDMOD pMod) { KLDRDYLDMOD_ASSERT(pMod->enmState == KLDRSTATE_GOOD); kLdrModCallThread(pMod->pMod, KLDRMOD_INT_MAP, (KUPTR)pMod->hMod, 0 /* detach */); } /** * Gets the main stack, allocate it if necessary. * * @returns 0 on success, non-zero native OS or kLdr status code on failure. * @param pMod The module. * @param ppvStack Where to store the address of the stack (lowest address). * @param pcbStack Where to store the size of the stack. */ int kldrDyldModGetMainStack(PKLDRDYLDMOD pMod, void **ppvStack, KSIZE *pcbStack) { int rc = 0; KLDRSTACKINFO StackInfo; KLDRDYLDMOD_ASSERT(pMod->fExecutable); /* * Since we might have to allocate the stack ourselves, and there will only * ever be one main stack, we'll be keeping the main stack info in globals. */ if (!g_fkLdrDyldDoneMainStack) { rc = kLdrModGetStackInfo(pMod->pMod, NULL, KLDRMOD_BASEADDRESS_MAP, &StackInfo); if (!rc) { /* check if there is a stack size override/default. */ KSIZE cbDefOverride; if (kHlpGetEnvUZ("KLDR_MAIN_STACK_SIZE", &cbDefOverride)) cbDefOverride = 0; /* needs allocating? */ if ( StackInfo.LinkAddress == NIL_KLDRADDR || StackInfo.cbStack < cbDefOverride) { KSIZE cbStack = (KSIZE)K_MAX(StackInfo.cbStack, cbDefOverride); g_pvkLdrDyldMainStack = kldrDyldOSAllocStack(cbStack); if (g_pvkLdrDyldMainStack) { g_cbkLdrDyldMainStack = cbStack; g_fkLdrDyldMainStackAllocated = 1; } else rc = KLDR_ERR_MAIN_STACK_ALLOC_FAILED; } else { KLDRDYLDMOD_ASSERT(StackInfo.Address != NIL_KLDRADDR); KLDRDYLDMOD_ASSERT(StackInfo.cbStack > 0); g_fkLdrDyldMainStackAllocated = 0; g_pvkLdrDyldMainStack = (void *)(KUPTR)StackInfo.Address; KLDRDYLDMOD_ASSERT((KUPTR)g_pvkLdrDyldMainStack == StackInfo.Address); g_cbkLdrDyldMainStack = (KSIZE)StackInfo.cbStack; KLDRDYLDMOD_ASSERT(StackInfo.cbStack == g_cbkLdrDyldMainStack); } } if (!rc) g_fkLdrDyldDoneMainStack = 1; } if (!rc) { if (ppvStack) *ppvStack = g_pvkLdrDyldMainStack; if (pcbStack) *pcbStack = g_cbkLdrDyldMainStack; } return rc; } /** * This starts the executable module. * * @returns non-zero OS or kLdr status code on failure. * (won't return on success.) * @param pMod The executable module. */ int kldrDyldModStartExe(PKLDRDYLDMOD pMod) { int rc; KLDRADDR MainEPAddress; void *pvStack; KSIZE cbStack; KLDRDYLDMOD_ASSERT(pMod->fExecutable); rc = kLdrModQueryMainEntrypoint(pMod->pMod, NULL, KLDRMOD_BASEADDRESS_MAP, &MainEPAddress); if (rc) return rc; rc = kldrDyldModGetMainStack(pMod, &pvStack, &cbStack); if (rc) return rc; return kldrDyldOSStartExe((KUPTR)MainEPAddress, pvStack, cbStack); } /** * Gets the module name. * * @returns 0 on success, KERR_BUFFER_OVERFLOW on failure. * @param pMod The module. * @param pszName Where to store the name. * @param cchName The size of the name buffer. */ int kldrDyldModGetName(PKLDRDYLDMOD pMod, char *pszName, KSIZE cchName) { KSIZE cch = K_MIN(cchName, pMod->pMod->cchName + 1); if (cch) { kHlpMemCopy(pszName, pMod->pMod->pszName, cch - 1); pszName[cch - 1] = '\0'; } return cchName <= pMod->pMod->cchName ? KERR_BUFFER_OVERFLOW : 0; } /** * Gets the module filename. * * @returns 0 on success, KERR_BUFFER_OVERFLOW on failure. * @param pMod The module. * @param pszFilename Where to store the filename. * @param cchFilename The size of the filename buffer. */ int kldrDyldModGetFilename(PKLDRDYLDMOD pMod, char *pszFilename, KSIZE cchFilename) { KSIZE cch = K_MIN(cchFilename, pMod->pMod->cchFilename + 1); if (cch) { kHlpMemCopy(pszFilename, pMod->pMod->pszFilename, cch - 1); pszFilename[cch - 1] = '\0'; } return cchFilename <= pMod->pMod->cchFilename ? KERR_BUFFER_OVERFLOW : 0; } /** * Gets the address/value of a symbol in the specified module. * * @returns 0 on success, KLDR_ERR_SYMBOL_NOT_FOUND on failure. * @param pMod The module. * @param uSymbolOrdinal The symbol ordinal 0. This is ignored if the name is non-zero. * @param pszSymbolName The symbol name. Can be NULL. * @param puValue Where to store the value. optional. * @param pfKind Where to store the symbol kind. optional. */ int kldrDyldModQuerySymbol(PKLDRDYLDMOD pMod, KU32 uSymbolOrdinal, const char *pszSymbolName, KUPTR *puValue, KU32 *pfKind) { int rc; KLDRADDR uValue = 0; KU32 fKind = 0; rc = kLdrModQuerySymbol(pMod->pMod, NULL, KLDRMOD_BASEADDRESS_MAP, uSymbolOrdinal, pszSymbolName, kHlpStrLen(pszSymbolName), NULL, kldrDyldModFixupGetImportCallback, pMod, &uValue, &fKind); if (!rc) { if (puValue) { *puValue = (KUPTR)uValue; KLDRDYLDMOD_ASSERT(*puValue == uValue); } if (pfKind) *pfKind = fKind; } return rc; } ���������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/tstkLdrHeap.c�������������������������������������������������������0000664�0001750�0001750�00000013211�14670377513�021005� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tstkLdrHeap.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Heap testcase. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include <k/kHlp.h> #include <stdio.h> #include <stdlib.h> /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ #define CHECK_FATAL(expr) \ do { if (!(expr)) { printf("tstkLdrHeap(%d): FATAL FAILURE - %s\n", __LINE__, #expr); return 1; } \ } while (0) #define CHECK(expr) \ do { if (!(expr)) { printf("tstkLdrHeap(%d): ERROR - %s\n", __LINE__, #expr); cErrors++; kHlpAssertBreakpoint();} \ } while (0) /** * Get a random size. * @returns random size. */ static unsigned RandSize(void) { unsigned i = (unsigned)rand() % (256*1024 - 1); return i ? i : 1; } /** * Get a random index. * @returns random index. * @param cEntries The number of entries in the table. */ static unsigned RandIdx(unsigned cEntries) { unsigned i = (unsigned)rand(); while (i >= cEntries) i >>= 1; return i; } #if 0 # define kHlpAlloc(a) malloc(a) # define kHlpFree(a) free(a) #endif int main() { int cErrors = 0; int rc; #define MAX_ALLOCS 256 static struct { void *pv; unsigned cb; } s_aAllocs[MAX_ALLOCS]; unsigned cAllocs; unsigned i; unsigned j; /* * Some simple init / term. */ rc = kHlpHeapInit(); CHECK_FATAL(!rc); kHlpHeapTerm(); rc = kHlpHeapInit(); CHECK_FATAL(!rc); kHlpHeapTerm(); /* * Simple alloc all, free all in FIFO order. */ rc = kHlpHeapInit(); CHECK_FATAL(!rc); /* 1. allocate all slots. */ for (i = 0; i < MAX_ALLOCS; i++) { s_aAllocs[i].cb = RandSize(); s_aAllocs[i].pv = kHlpAlloc(s_aAllocs[i].cb); CHECK(s_aAllocs[i].pv); } /* 2. free all slots. */ for (i = 0; i < MAX_ALLOCS; i++) kHlpFree(s_aAllocs[i].pv); /* terminate */ kHlpHeapTerm(); /* * Simple alloc all, free all in LIFO order. */ rc = kHlpHeapInit(); CHECK_FATAL(!rc); /* 1. allocate all slots. */ for (i = 0; i < MAX_ALLOCS; i++) { s_aAllocs[i].cb = RandSize(); s_aAllocs[i].pv = kHlpAlloc(s_aAllocs[i].cb); CHECK(s_aAllocs[i].pv); } /* 2. free all slots. */ i = MAX_ALLOCS; while (i-- > 0) kHlpFree(s_aAllocs[i].pv); /* terminate */ kHlpHeapTerm(); /* * Bunch of allocations, free half, allocate and free in pairs, free all. */ rc = kHlpHeapInit(); CHECK_FATAL(!rc); /* 1. allocate all slots. */ for (i = 0; i < MAX_ALLOCS; i++) { s_aAllocs[i].cb = RandSize(); s_aAllocs[i].pv = kHlpAlloc(s_aAllocs[i].cb); CHECK(s_aAllocs[i].pv); } cAllocs = MAX_ALLOCS; /* 2. free half (random order). */ while (cAllocs > MAX_ALLOCS / 2) { i = RandIdx(cAllocs); kHlpFree(s_aAllocs[i].pv); cAllocs--; if (i != cAllocs) s_aAllocs[i] = s_aAllocs[cAllocs]; } /* 3. lots of alloc and free activity. */ for (j = 0; j < MAX_ALLOCS * 32; j++) { /* allocate */ unsigned cMax = RandIdx(MAX_ALLOCS / 4) + 1; while (cAllocs < MAX_ALLOCS && cMax-- > 0) { i = cAllocs; s_aAllocs[i].cb = RandSize(); s_aAllocs[i].pv = kHlpAlloc(s_aAllocs[i].cb); CHECK(s_aAllocs[i].pv); cAllocs++; } /* free */ cMax = RandIdx(MAX_ALLOCS / 4) + 1; while (cAllocs > MAX_ALLOCS / 2 && cMax-- > 0) { i = RandIdx(cAllocs); kHlpFree(s_aAllocs[i].pv); cAllocs--; if (i != cAllocs) s_aAllocs[i] = s_aAllocs[cAllocs]; } } /* 4. free all */ while (cAllocs > 0) { i = RandIdx(cAllocs); kHlpFree(s_aAllocs[i].pv); cAllocs--; if (i != cAllocs) s_aAllocs[i] = s_aAllocs[cAllocs]; } /* terminate */ kHlpHeapTerm(); /* summary */ if (!cErrors) printf("tstkLdrHeap: SUCCESS\n"); else printf("tstkLdrHeap: FAILURE - %d errors\n", cErrors); return !!cErrors; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrModPE.c���������������������������������������������������������0000664�0001750�0001750�00000215144�14670377514�020353� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrModPE.c 117 2020-03-15 15:23:36Z bird $ */ /** @file * kLdr - The Module Interpreter for the Portable Executable (PE) Format. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include "kLdrInternal.h" #include <k/kLdrFmts/pe.h> /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def KLDRMODPE_STRICT * Define KLDRMODPE_STRICT to enabled strict checks in KLDRMODPE. */ #define KLDRMODPE_STRICT 1 /** @def KLDRMODPE_ASSERT * Assert that an expression is true when KLDR_STRICT is defined. */ #ifdef KLDRMODPE_STRICT # define KLDRMODPE_ASSERT(expr) kHlpAssert(expr) #else # define KLDRMODPE_ASSERT(expr) do {} while (0) #endif /** @def KLDRMODPE_RVA2TYPE * Converts a RVA to a pointer of the specified type. * @param pvBits The bits (image base). * @param uRVA The image relative virtual address. * @param type The type to cast to. */ #define KLDRMODPE_RVA2TYPE(pvBits, uRVA, type) \ ( (type) ((KUPTR)(pvBits) + (KUPTR)(uRVA)) ) /** @def KLDRMODPE_VALID_RVA * Checks that the specified RVA value is non-zero and within the bounds of the image. * @returns true/false. * @param pModPE The PE module interpreter instance. * @param uRVA The RVA to validate. */ #define KLDRMODPE_VALID_RVA(pModPE, uRVA) \ ( (uRVA) && (uRVA) < (pModPE)->Hdrs.OptionalHeader.SizeOfImage ) /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Instance data for the PE module interpreter. */ typedef struct KLDRMODPE { /** Pointer to the module. (Follows the section table.) */ PKLDRMOD pMod; /** Pointer to the RDR mapping of the raw file bits. NULL if not mapped. */ const void *pvBits; /** Pointer to the user mapping. */ const void *pvMapping; /** Reserved flags. */ KU32 f32Reserved; /** The number of imported modules. * If ~(KU32)0 this hasn't been determined yet. */ KU32 cImportModules; /** The offset of the NT headers. */ KLDRFOFF offHdrs; /** Copy of the NT headers. */ IMAGE_NT_HEADERS64 Hdrs; /** The section header table . */ IMAGE_SECTION_HEADER aShdrs[1]; } KLDRMODPE, *PKLDRMODPE; /******************************************************************************* * Internal Functions * *******************************************************************************/ static KI32 kldrModPENumberOfImports(PKLDRMOD pMod, const void *pvBits); static int kldrModPERelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); static int kldrModPEDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODPE *ppMod); /*static void kldrModPEDoLoadConfigConversion(PIMAGE_LOAD_CONFIG_DIRECTORY64 pLoadCfg); */ static int kLdrModPEDoOptionalHeaderValidation(PKLDRMODPE pModPE); static int kLdrModPEDoSectionHeadersValidation(PKLDRMODPE pModPE); static void kldrModPEDoOptionalHeaderConversion(PIMAGE_OPTIONAL_HEADER64 pOptionalHeader); static int kldrModPEDoForwarderQuery(PKLDRMODPE pModPE, const void *pvBits, const char *pszForwarder, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser, PKLDRADDR puValue, KU32 *pfKind); static int kldrModPEDoFixups(PKLDRMODPE pModPE, void *pvMapping, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress); static int kldrModPEDoImports32Bit(PKLDRMODPE pModPE, void *pvMapping, const IMAGE_IMPORT_DESCRIPTOR *pImpDesc, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); static int kldrModPEDoImports64Bit(PKLDRMODPE pModPE, void *pvMapping, const IMAGE_IMPORT_DESCRIPTOR *pImpDesc, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); static int kldrModPEDoImports(PKLDRMODPE pModPE, void *pvMapping, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); static int kldrModPEDoCallDLL(PKLDRMODPE pModPE, void *pvMapping, unsigned uOp, KUPTR uHandle); static int kldrModPEDoCallTLS(PKLDRMODPE pModPE, void *pvMapping, unsigned uOp, KUPTR uHandle); /** * Create a loader module instance interpreting the executable image found * in the specified file provider instance. * * @returns 0 on success and *ppMod pointing to a module instance. * On failure, a non-zero OS specific error code is returned. * @param pOps Pointer to the registered method table. * @param pRdr The file provider instance to use. * @param fFlags Flags, MBZ. * @param enmCpuArch The desired CPU architecture. KCPUARCH_UNKNOWN means * anything goes, but with a preference for the current * host architecture. * @param offNewHdr The offset of the new header in MZ files. -1 if not found. * @param ppMod Where to store the module instance pointer. */ static int kldrModPECreate(PCKLDRMODOPS pOps, PKRDR pRdr, KU32 fFlags, KCPUARCH enmCpuArch, KLDRFOFF offNewHdr, PPKLDRMOD ppMod) { PKLDRMODPE pModPE; int rc; K_NOREF(fFlags); /* * Create the instance data and do a minimal header validation. */ rc = kldrModPEDoCreate(pRdr, offNewHdr, &pModPE); if (!rc) { /* * Match up against the requested CPU architecture. */ if ( enmCpuArch == KCPUARCH_UNKNOWN || pModPE->pMod->enmArch == enmCpuArch) { pModPE->pMod->pOps = pOps; pModPE->pMod->u32Magic = KLDRMOD_MAGIC; *ppMod = pModPE->pMod; return 0; } rc = KLDR_ERR_CPU_ARCH_MISMATCH; } kHlpFree(pModPE); return rc; } /** * Separate function for reading creating the PE module instance to * simplify cleanup on failure. */ static int kldrModPEDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODPE *ppModPE) { struct { KU32 Signature; IMAGE_FILE_HEADER FileHdr; } s; PKLDRMODPE pModPE; PKLDRMOD pMod; KSIZE cb; KSIZE cchFilename; KLDRFOFF off; KU32 i; int rc; *ppModPE = NULL; /* * Read the signature and file header. */ rc = kRdrRead(pRdr, &s, sizeof(s), offNewHdr > 0 ? offNewHdr : 0); if (rc) return rc; if (s.Signature != IMAGE_NT_SIGNATURE) return KLDR_ERR_UNKNOWN_FORMAT; /* sanity checks. */ if ( s.FileHdr.NumberOfSections > 4096 || ( s.FileHdr.SizeOfOptionalHeader != sizeof(IMAGE_OPTIONAL_HEADER32) && s.FileHdr.SizeOfOptionalHeader != sizeof(IMAGE_OPTIONAL_HEADER64)) || !(s.FileHdr.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE) ) return KLDR_ERR_PE_BAD_FILE_HEADER; if ( s.FileHdr.Machine != IMAGE_FILE_MACHINE_I386 && s.FileHdr.Machine != IMAGE_FILE_MACHINE_AMD64 ) return KLDR_ERR_PE_UNSUPPORTED_MACHINE; /* * Calc the instance size, allocate and initialize it. */ cchFilename = kHlpStrLen(kRdrName(pRdr)); cb = K_ALIGN_Z(K_OFFSETOF(KLDRMODPE, aShdrs[s.FileHdr.NumberOfSections]), 16) + K_OFFSETOF(KLDRMOD, aSegments[s.FileHdr.NumberOfSections + 1]) + cchFilename + 1; pModPE = (PKLDRMODPE)kHlpAlloc(cb); if (!pModPE) return KERR_NO_MEMORY; *ppModPE = pModPE; /* KLDRMOD */ pMod = (PKLDRMOD)((KU8 *)pModPE + K_ALIGN_Z(K_OFFSETOF(KLDRMODPE, aShdrs[s.FileHdr.NumberOfSections]), 16)); pMod->pvData = pModPE; pMod->pRdr = pRdr; pMod->pOps = NULL; /* set upon success. */ pMod->cSegments = s.FileHdr.NumberOfSections + 1; pMod->cchFilename = (KU32)cchFilename; pMod->pszFilename = (char *)&pMod->aSegments[pMod->cSegments]; kHlpMemCopy((char *)pMod->pszFilename, kRdrName(pRdr), cchFilename + 1); pMod->pszName = kHlpGetFilename(pMod->pszFilename); pMod->cchName = (KU32)(cchFilename - (pMod->pszName - pMod->pszFilename)); pMod->fFlags = 0; switch (s.FileHdr.Machine) { case IMAGE_FILE_MACHINE_I386: pMod->enmCpu = KCPU_I386; pMod->enmArch = KCPUARCH_X86_32; pMod->enmEndian = KLDRENDIAN_LITTLE; break; case IMAGE_FILE_MACHINE_AMD64: pMod->enmCpu = KCPU_K8; pMod->enmArch = KCPUARCH_AMD64; pMod->enmEndian = KLDRENDIAN_LITTLE; break; default: kHlpAssert(0); break; } pMod->enmFmt = KLDRFMT_PE; if (s.FileHdr.Characteristics & IMAGE_FILE_DLL) pMod->enmType = !(s.FileHdr.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) ? KLDRTYPE_SHARED_LIBRARY_RELOCATABLE : KLDRTYPE_SHARED_LIBRARY_FIXED; else pMod->enmType = !(s.FileHdr.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) ? KLDRTYPE_EXECUTABLE_RELOCATABLE : KLDRTYPE_EXECUTABLE_FIXED; pMod->u32Magic = 0; /* set upon success. */ /* KLDRMODPE */ pModPE->pMod = pMod; pModPE->pvBits = NULL; pModPE->pvMapping = NULL; pModPE->f32Reserved = 0; pModPE->cImportModules = ~(KU32)0; pModPE->offHdrs = offNewHdr >= 0 ? offNewHdr : 0; pModPE->Hdrs.Signature = s.Signature; pModPE->Hdrs.FileHeader = s.FileHdr; /* * Read the optional header and the section table. */ off = pModPE->offHdrs + sizeof(pModPE->Hdrs.Signature) + sizeof(pModPE->Hdrs.FileHeader); rc = kRdrRead(pRdr, &pModPE->Hdrs.OptionalHeader, pModPE->Hdrs.FileHeader.SizeOfOptionalHeader, off); if (rc) return rc; if (pModPE->Hdrs.FileHeader.SizeOfOptionalHeader != sizeof(pModPE->Hdrs.OptionalHeader)) kldrModPEDoOptionalHeaderConversion(&pModPE->Hdrs.OptionalHeader); off += pModPE->Hdrs.FileHeader.SizeOfOptionalHeader; rc = kRdrRead(pRdr, &pModPE->aShdrs[0], sizeof(IMAGE_SECTION_HEADER) * pModPE->Hdrs.FileHeader.NumberOfSections, off); if (rc) return rc; /* * Validate the two. */ rc = kLdrModPEDoOptionalHeaderValidation(pModPE); if (rc) return rc; for (i = 0; i < pModPE->Hdrs.FileHeader.NumberOfSections; i++) { rc = kLdrModPEDoSectionHeadersValidation(pModPE); if (rc) return rc; } /* * Setup the KLDRMOD segment array. */ /* The implied headers section. */ pMod->aSegments[0].pvUser = NULL; pMod->aSegments[0].pchName = "TheHeaders"; pMod->aSegments[0].cchName = sizeof("TheHeaders") - 1; pMod->aSegments[0].enmProt = KPROT_READONLY; pMod->aSegments[0].cb = pModPE->Hdrs.OptionalHeader.SizeOfHeaders; pMod->aSegments[0].Alignment = pModPE->Hdrs.OptionalHeader.SectionAlignment; pMod->aSegments[0].LinkAddress = pModPE->Hdrs.OptionalHeader.ImageBase; pMod->aSegments[0].offFile = 0; pMod->aSegments[0].cbFile = pModPE->Hdrs.OptionalHeader.SizeOfHeaders; pMod->aSegments[0].RVA = 0; if (pMod->cSegments > 1) pMod->aSegments[0].cbMapped = pModPE->aShdrs[0].VirtualAddress; else pMod->aSegments[0].cbMapped = pModPE->Hdrs.OptionalHeader.SizeOfHeaders; pMod->aSegments[0].MapAddress = 0; /* The section headers. */ for (i = 0; i < pModPE->Hdrs.FileHeader.NumberOfSections; i++) { const char *pch; KU32 cb2; /* unused */ pMod->aSegments[i + 1].pvUser = NULL; pMod->aSegments[i + 1].MapAddress = 0; pMod->aSegments[i + 1].SelFlat = 0; pMod->aSegments[i + 1].Sel16bit = 0; pMod->aSegments[i + 1].fFlags = 0; /* name */ pMod->aSegments[i + 1].pchName = pch = (const char *)&pModPE->aShdrs[i].Name[0]; cb2 = IMAGE_SIZEOF_SHORT_NAME; while ( cb2 > 0 && (pch[cb2 - 1] == ' ' || pch[cb2 - 1] == '\0')) cb2--; pMod->aSegments[i + 1].cchName = cb2; /* size and addresses */ if (!(pModPE->aShdrs[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD)) { /* Kluge to deal with wlink ".reloc" sections that has a VirtualSize of 0 bytes. */ cb2 = pModPE->aShdrs[i].Misc.VirtualSize; if (!cb2) cb2 = K_ALIGN_Z(pModPE->aShdrs[i].SizeOfRawData, pModPE->Hdrs.OptionalHeader.SectionAlignment); pMod->aSegments[i + 1].cb = pModPE->aShdrs[i].Misc.VirtualSize; pMod->aSegments[i + 1].LinkAddress = pModPE->aShdrs[i].VirtualAddress + pModPE->Hdrs.OptionalHeader.ImageBase; pMod->aSegments[i + 1].RVA = pModPE->aShdrs[i].VirtualAddress; pMod->aSegments[i + 1].cbMapped = cb2; if (i + 2 < pMod->cSegments) pMod->aSegments[i + 1].cbMapped= pModPE->aShdrs[i + 1].VirtualAddress - pModPE->aShdrs[i].VirtualAddress; } else { pMod->aSegments[i + 1].cb = 0; pMod->aSegments[i + 1].cbMapped = 0; pMod->aSegments[i + 1].LinkAddress = NIL_KLDRADDR; pMod->aSegments[i + 1].RVA = 0; } /* file location */ pMod->aSegments[i + 1].offFile = pModPE->aShdrs[i].PointerToRawData; pMod->aSegments[i + 1].cbFile = pModPE->aShdrs[i].SizeOfRawData; if ( pMod->aSegments[i + 1].cbMapped > 0 /* if mapped */ && (KLDRSIZE)pMod->aSegments[i + 1].cbFile > pMod->aSegments[i + 1].cbMapped) pMod->aSegments[i + 1].cbFile = (KLDRFOFF)(pMod->aSegments[i + 1].cbMapped); /* protection */ switch ( pModPE->aShdrs[i].Characteristics & (IMAGE_SCN_MEM_SHARED | IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE)) { case 0: case IMAGE_SCN_MEM_SHARED: pMod->aSegments[i + 1].enmProt = KPROT_NOACCESS; break; case IMAGE_SCN_MEM_READ: case IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_SHARED: pMod->aSegments[i + 1].enmProt = KPROT_READONLY; break; case IMAGE_SCN_MEM_WRITE: case IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_READ: pMod->aSegments[i + 1].enmProt = KPROT_WRITECOPY; break; case IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_SHARED: case IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_SHARED | IMAGE_SCN_MEM_READ: pMod->aSegments[i + 1].enmProt = KPROT_READWRITE; break; case IMAGE_SCN_MEM_EXECUTE: case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_SHARED: pMod->aSegments[i + 1].enmProt = KPROT_EXECUTE; break; case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ: case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_SHARED: pMod->aSegments[i + 1].enmProt = KPROT_EXECUTE_READ; break; case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_WRITE: case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_READ: pMod->aSegments[i + 1].enmProt = KPROT_EXECUTE_WRITECOPY; break; case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_SHARED: case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_SHARED | IMAGE_SCN_MEM_READ: pMod->aSegments[i + 1].enmProt = KPROT_EXECUTE_READWRITE; break; } /* alignment. */ switch (pModPE->aShdrs[i].Characteristics & IMAGE_SCN_ALIGN_MASK) { case 0: /* hope this is right... */ pMod->aSegments[i + 1].Alignment = pModPE->Hdrs.OptionalHeader.SectionAlignment; break; case IMAGE_SCN_ALIGN_1BYTES: pMod->aSegments[i + 1].Alignment = 1; break; case IMAGE_SCN_ALIGN_2BYTES: pMod->aSegments[i + 1].Alignment = 2; break; case IMAGE_SCN_ALIGN_4BYTES: pMod->aSegments[i + 1].Alignment = 4; break; case IMAGE_SCN_ALIGN_8BYTES: pMod->aSegments[i + 1].Alignment = 8; break; case IMAGE_SCN_ALIGN_16BYTES: pMod->aSegments[i + 1].Alignment = 16; break; case IMAGE_SCN_ALIGN_32BYTES: pMod->aSegments[i + 1].Alignment = 32; break; case IMAGE_SCN_ALIGN_64BYTES: pMod->aSegments[i + 1].Alignment = 64; break; case IMAGE_SCN_ALIGN_128BYTES: pMod->aSegments[i + 1].Alignment = 128; break; case IMAGE_SCN_ALIGN_256BYTES: pMod->aSegments[i + 1].Alignment = 256; break; case IMAGE_SCN_ALIGN_512BYTES: pMod->aSegments[i + 1].Alignment = 512; break; case IMAGE_SCN_ALIGN_1024BYTES: pMod->aSegments[i + 1].Alignment = 1024; break; case IMAGE_SCN_ALIGN_2048BYTES: pMod->aSegments[i + 1].Alignment = 2048; break; case IMAGE_SCN_ALIGN_4096BYTES: pMod->aSegments[i + 1].Alignment = 4096; break; case IMAGE_SCN_ALIGN_8192BYTES: pMod->aSegments[i + 1].Alignment = 8192; break; default: kHlpAssert(0); pMod->aSegments[i + 1].Alignment = 0; break; } } /* * We're done. */ *ppModPE = pModPE; return 0; } /** * Converts a 32-bit optional header to a 64-bit one * * @param pOptHdr The optional header to convert. */ static void kldrModPEDoOptionalHeaderConversion(PIMAGE_OPTIONAL_HEADER64 pOptHdr) { /* volatile everywhere! */ IMAGE_OPTIONAL_HEADER32 volatile *pOptHdr32 = (IMAGE_OPTIONAL_HEADER32 volatile *)pOptHdr; IMAGE_OPTIONAL_HEADER64 volatile *pOptHdr64 = pOptHdr; KU32 volatile *pu32Dst; KU32 volatile *pu32Src; KU32 volatile *pu32SrcLast; KU32 u32; /* From LoaderFlags and out the difference is 4 * 32-bits. */ pu32Dst = (KU32 *)&pOptHdr64->DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] - 1; pu32Src = (KU32 *)&pOptHdr32->DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] - 1; pu32SrcLast = (KU32 *)&pOptHdr32->LoaderFlags; while (pu32Src >= pu32SrcLast) *pu32Dst-- = *pu32Src--; /* The previous 4 fields are 32/64 and needs special attention. */ pOptHdr64->SizeOfHeapCommit = pOptHdr32->SizeOfHeapCommit; pOptHdr64->SizeOfHeapReserve = pOptHdr32->SizeOfHeapReserve; pOptHdr64->SizeOfStackCommit = pOptHdr32->SizeOfStackCommit; u32 = pOptHdr32->SizeOfStackReserve; pOptHdr64->SizeOfStackReserve = u32; /* * The rest matches except for BaseOfData which has been merged into ImageBase in the 64-bit version. * Thus, ImageBase needs some special treatement. It will probably work fine assigning one to the * other since this is all declared volatile, but taking now chances, we'll use a temp variable. */ u32 = pOptHdr32->ImageBase; pOptHdr64->ImageBase = u32; } #if 0 /** * Converts a 32-bit load config directory to a 64 bit one. * * @param pOptHdr The load config to convert. */ static void kldrModPEDoLoadConfigConversion(PIMAGE_LOAD_CONFIG_DIRECTORY64 pLoadCfg) { /* volatile everywhere! */ IMAGE_LOAD_CONFIG_DIRECTORY32 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32 volatile *)pLoadCfg; IMAGE_LOAD_CONFIG_DIRECTORY64 volatile *pLoadCfg64 = pLoadCfg; KU32 u32; pLoadCfg64->SEHandlerCount = pLoadCfg32->SEHandlerCount; pLoadCfg64->SEHandlerTable = pLoadCfg32->SEHandlerTable; pLoadCfg64->SecurityCookie = pLoadCfg32->SecurityCookie; pLoadCfg64->EditList = pLoadCfg32->EditList; pLoadCfg64->Reserved1 = pLoadCfg32->Reserved1; pLoadCfg64->CSDVersion = pLoadCfg32->CSDVersion; /* (ProcessHeapFlags switched place with ProcessAffinityMask, but we're * more than 16 byte off by now so it doesn't matter.) */ pLoadCfg64->ProcessHeapFlags = pLoadCfg32->ProcessHeapFlags; pLoadCfg64->ProcessAffinityMask = pLoadCfg32->ProcessAffinityMask; pLoadCfg64->VirtualMemoryThreshold = pLoadCfg32->VirtualMemoryThreshold; pLoadCfg64->MaximumAllocationSize = pLoadCfg32->MaximumAllocationSize; pLoadCfg64->LockPrefixTable = pLoadCfg32->LockPrefixTable; pLoadCfg64->DeCommitTotalFreeThreshold = pLoadCfg32->DeCommitTotalFreeThreshold; u32 = pLoadCfg32->DeCommitFreeBlockThreshold; pLoadCfg64->DeCommitFreeBlockThreshold = u32; /* the remainder matches. */ } #endif /** * Internal worker which validates the section headers. */ static int kLdrModPEDoOptionalHeaderValidation(PKLDRMODPE pModPE) { const unsigned fIs32Bit = pModPE->Hdrs.FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32); /* the magic */ if ( pModPE->Hdrs.OptionalHeader.Magic != (fIs32Bit ? IMAGE_NT_OPTIONAL_HDR32_MAGIC : IMAGE_NT_OPTIONAL_HDR64_MAGIC)) return KLDR_ERR_PE_BAD_OPTIONAL_HEADER; /** @todo validate more */ return 0; } /** * Internal worker which validates the section headers. */ static int kLdrModPEDoSectionHeadersValidation(PKLDRMODPE pModPE) { /** @todo validate shdrs */ K_NOREF(pModPE); return 0; } /** @copydoc KLDRMODOPS::pfnDestroy */ static int kldrModPEDestroy(PKLDRMOD pMod) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; int rc = 0; KLDRMODPE_ASSERT(!pModPE->pvMapping); if (pMod->pRdr) { rc = kRdrClose(pMod->pRdr); pMod->pRdr = NULL; } pMod->u32Magic = 0; pMod->pOps = NULL; kHlpFree(pModPE); return rc; } /** * Performs the mapping of the image. * * This can be used to do the internal mapping as well as the * user requested mapping. fForReal indicates which is desired. * * @returns 0 on success, non-zero OS or kLdr status code on failure. * @param pModPE The interpreter module instance * @param fForReal If set, do the user mapping. if clear, do the internal mapping. */ static int kldrModPEDoMap(PKLDRMODPE pModPE, unsigned fForReal) { PKLDRMOD pMod = pModPE->pMod; KBOOL fFixed; void *pvBase; int rc; KU32 i; /* * Map it. */ /* fixed image? */ fFixed = fForReal && ( pMod->enmType == KLDRTYPE_EXECUTABLE_FIXED || pMod->enmType == KLDRTYPE_SHARED_LIBRARY_FIXED); if (!fFixed) pvBase = NULL; else { pvBase = (void *)(KUPTR)pMod->aSegments[0].LinkAddress; if ((KUPTR)pvBase != pMod->aSegments[0].LinkAddress) return KLDR_ERR_ADDRESS_OVERFLOW; } /* try do the prepare */ rc = kRdrMap(pMod->pRdr, &pvBase, pMod->cSegments, pMod->aSegments, fFixed); if (rc) return rc; /* * Update the segments with their map addresses. */ if (fForReal) { for (i = 0; i < pMod->cSegments; i++) { if (pMod->aSegments[i].RVA != NIL_KLDRADDR) pMod->aSegments[i].MapAddress = (KUPTR)pvBase + (KUPTR)pMod->aSegments[i].RVA; } pModPE->pvMapping = pvBase; } else pModPE->pvBits = pvBase; return 0; } /** * Unmaps a image mapping. * * This can be used to do the internal mapping as well as the * user requested mapping. fForReal indicates which is desired. * * @returns 0 on success, non-zero OS or kLdr status code on failure. * @param pModPE The interpreter module instance * @param pvMapping The mapping to unmap. */ static int kldrModPEDoUnmap(PKLDRMODPE pModPE, const void *pvMapping) { PKLDRMOD pMod = pModPE->pMod; int rc; KU32 i; /* * Try unmap the image. */ rc = kRdrUnmap(pMod->pRdr, (void *)pvMapping, pMod->cSegments, pMod->aSegments); if (rc) return rc; /* * Update the segments to reflect that they aren't mapped any longer. */ if (pModPE->pvMapping == pvMapping) { pModPE->pvMapping = NULL; for (i = 0; i < pMod->cSegments; i++) pMod->aSegments[i].MapAddress = 0; } if (pModPE->pvBits == pvMapping) pModPE->pvBits = NULL; return 0; } /** * Gets usable bits and the right base address. * * @returns 0 on success. * @returns A non-zero status code if the BaseAddress isn't right or some problem is encountered * featch in a temp mapping the bits. * @param pModPE The interpreter module instance * @param ppvBits The bits address, IN & OUT. * @param pBaseAddress The base address, IN & OUT. Optional. */ static int kldrModPEBitsAndBaseAddress(PKLDRMODPE pModPE, const void **ppvBits, PKLDRADDR pBaseAddress) { int rc = 0; /* * Correct the base address. * * We don't use the base address for interpreting the bits in this * interpreter, which makes things relativly simple. */ if (pBaseAddress) { if (*pBaseAddress == KLDRMOD_BASEADDRESS_MAP) *pBaseAddress = pModPE->pMod->aSegments[0].MapAddress; else if (*pBaseAddress == KLDRMOD_BASEADDRESS_LINK) *pBaseAddress = pModPE->Hdrs.OptionalHeader.ImageBase; } /* * Get bits. */ if (ppvBits && !*ppvBits) { if (pModPE->pvMapping) *ppvBits = pModPE->pvMapping; else if (pModPE->pvBits) *ppvBits = pModPE->pvBits; else { /* create an internal mapping. */ rc = kldrModPEDoMap(pModPE, 0 /* not for real */); if (rc) return rc; KLDRMODPE_ASSERT(pModPE->pvBits); *ppvBits = pModPE->pvBits; } } return 0; } /** @copydoc kLdrModQuerySymbol */ static int kldrModPEQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; const KU32 *paExportRVAs; const IMAGE_EXPORT_DIRECTORY *pExpDir; KU32 iExpOrd; KU32 uRVA; int rc; /* * Make sure we've got mapped bits and resolve any base address aliases. */ rc = kldrModPEBitsAndBaseAddress(pModPE, &pvBits, &BaseAddress); if (rc) return rc; if ( pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size < sizeof(IMAGE_EXPORT_DIRECTORY)) return KLDR_ERR_SYMBOL_NOT_FOUND; if (pszVersion && *pszVersion) return KLDR_ERR_SYMBOL_NOT_FOUND; pExpDir = KLDRMODPE_RVA2TYPE(pvBits, pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress, PIMAGE_EXPORT_DIRECTORY); if (!pchSymbol) { /* * Simple, calculate the unbased ordinal and bounds check it. */ iExpOrd = iSymbol - pExpDir->Base; if (iExpOrd >= K_MAX(pExpDir->NumberOfNames, pExpDir->NumberOfFunctions)) return KLDR_ERR_SYMBOL_NOT_FOUND; } else { /* * Do a binary search for the name. * (The name table is sorted in ascending ordered by the linker.) */ const KU32 *paRVANames = KLDRMODPE_RVA2TYPE(pvBits, pExpDir->AddressOfNames, const KU32 *); const KU16 *paOrdinals = KLDRMODPE_RVA2TYPE(pvBits, pExpDir->AddressOfNameOrdinals, const KU16 *); KI32 iStart = 1; /* one based binary searching is simpler. */ KI32 iEnd = pExpDir->NumberOfNames; for (;;) { KI32 i; int diff; const char *pszName; /* done? */ if (iStart > iEnd) { #ifdef KLDRMODPE_STRICT /* Make sure the linker and we both did our job right. */ for (i = 0; i < (KI32)pExpDir->NumberOfNames; i++) { pszName = KLDRMODPE_RVA2TYPE(pvBits, paRVANames[i], const char *); KLDRMODPE_ASSERT(kHlpStrNComp(pszName, pchSymbol, cchSymbol) || pszName[cchSymbol]); KLDRMODPE_ASSERT(i == 0 || kHlpStrComp(pszName, KLDRMODPE_RVA2TYPE(pvBits, paRVANames[i - 1], const char *))); } #endif return KLDR_ERR_SYMBOL_NOT_FOUND; } i = (iEnd - iStart) / 2 + iStart; pszName = KLDRMODPE_RVA2TYPE(pvBits, paRVANames[i - 1], const char *); diff = kHlpStrNComp(pszName, pchSymbol, cchSymbol); if (!diff) diff = pszName[cchSymbol] - 0; if (diff < 0) iStart = i + 1; /* The symbol must be after the current name. */ else if (diff) iEnd = i - 1; /* The symbol must be before the current name. */ else { iExpOrd = paOrdinals[i - 1]; /* match! */ break; } } } /* * Lookup the address in the 'symbol' table. */ paExportRVAs = KLDRMODPE_RVA2TYPE(pvBits, pExpDir->AddressOfFunctions, const KU32 *); uRVA = paExportRVAs[iExpOrd]; if ( uRVA - pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress < pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size) return kldrModPEDoForwarderQuery(pModPE, pvBits, KLDRMODPE_RVA2TYPE(pvBits, uRVA, const char *), pfnGetForwarder, pvUser, puValue, pfKind); /* * Set the return value. */ if (puValue) *puValue = BaseAddress + uRVA; if (pfKind) *pfKind = (pModPE->Hdrs.FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32) ? KLDRSYMKIND_32BIT : KLDRSYMKIND_64BIT) | KLDRSYMKIND_NO_TYPE; return 0; } /** * Deal with a forwarder entry. * * We do this seprately from kldrModPEQuerySymbol because the code is clumsy (as is all PE code * thanks to the descriptive field names), and because it uses quite a bit more stack and we're * trying to avoid allocating stack unless we have to. * * @returns See kLdrModQuerySymbol. * @param pModPE The PE module interpreter instance. * @param pvBits Where to read the image from. * @param pszForwarder The forwarder entry name. * @param pfnGetForwarder The callback for resolving forwarder symbols. (optional) * @param pvUser The user argument for the callback. * @param puValue Where to put the value. (optional) * @param pfKind Where to put the symbol kind. (optional) */ static int kldrModPEDoForwarderQuery(PKLDRMODPE pModPE, const void *pvBits, const char *pszForwarder, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind) { const IMAGE_IMPORT_DESCRIPTOR *paImpDir; KU32 iImpModule; KU32 cchImpModule; const char *pszSymbol; KU32 iSymbol; int rc; if (!pfnGetForwarder) return KLDR_ERR_FORWARDER_SYMBOL; /* * Separate the name into a module name and a symbol name or ordinal. * * The module name ends at the first dot ('.'). * After the dot follows either a symbol name or a hash ('#') + ordinal. */ pszSymbol = pszForwarder; while (*pszSymbol != '.') pszSymbol++; if (!*pszSymbol) return KLDR_ERR_PE_BAD_FORWARDER; cchImpModule = (KU32)(pszSymbol - pszForwarder); pszSymbol++; /* skip the dot */ if (!*pszSymbol) return KLDR_ERR_PE_BAD_FORWARDER; if (*pszSymbol == '#') { unsigned uBase; pszSymbol++; /* skip the hash */ /* base detection */ uBase = 10; if (pszSymbol[0] == '0' && (pszSymbol[1] == 'x' || pszSymbol[1] == 'X')) { uBase = 16; pszSymbol += 2; } /* ascii to integer */ iSymbol = 0; for (;;) { /* convert char to digit. */ unsigned uDigit = *pszSymbol++; if (uDigit >= '0' && uDigit <= '9') uDigit -= '0'; else if (uDigit >= 'a' && uDigit <= 'z') uDigit -= 'a' + 10; else if (uDigit >= 'A' && uDigit <= 'Z') uDigit -= 'A' + 10; else if (!uDigit) break; else return KLDR_ERR_PE_BAD_FORWARDER; if (uDigit >= uBase) return KLDR_ERR_PE_BAD_FORWARDER; /* insert the digit */ iSymbol *= uBase; iSymbol += uDigit; } pszSymbol = NULL; /* no symbol name. */ } else iSymbol = NIL_KLDRMOD_SYM_ORDINAL; /* no ordinal number. */ /* * Find the import module name. * * We ASSUME the linker will make sure there is an import * entry for the module... not sure if this is right though. */ if ( !pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size || !pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress) return KLDR_ERR_PE_FORWARDER_IMPORT_NOT_FOUND; paImpDir = KLDRMODPE_RVA2TYPE(pvBits, pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress, const IMAGE_IMPORT_DESCRIPTOR *); kldrModPENumberOfImports(pModPE->pMod, pvBits); for (iImpModule = 0; iImpModule < pModPE->cImportModules; iImpModule++) { const char *pszName = KLDRMODPE_RVA2TYPE(pvBits, paImpDir[iImpModule].Name, const char *); KSIZE cchName = kHlpStrLen(pszName); if ( ( cchName == cchImpModule || ( cchName > cchImpModule && pszName[cchImpModule] == '.' && (pszName[cchImpModule + 1] == 'd' || pszName[cchImpModule + 1] == 'D') && (pszName[cchImpModule + 2] == 'l' || pszName[cchImpModule + 2] == 'L') && (pszName[cchImpModule + 3] == 'l' || pszName[cchImpModule + 3] == 'L')) ) && kHlpMemICompAscii(pszName, pszForwarder, cchImpModule) ) { /* * Now the rest is up to the callback (almost). */ rc = pfnGetForwarder(pModPE->pMod, iImpModule, iSymbol, pszSymbol, pszSymbol ? kHlpStrLen(pszSymbol) : 0, NULL, puValue, pfKind, pvUser); if (!rc && pfKind) *pfKind |= KLDRSYMKIND_FORWARDER; return rc; } } return KLDR_ERR_PE_FORWARDER_IMPORT_NOT_FOUND; } /** @copydoc kLdrModEnumSymbols */ static int kldrModPEEnumSymbols(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; const KU32 *paFunctions; const IMAGE_EXPORT_DIRECTORY *pExpDir; const KU32 *paRVANames; const KU16 *paOrdinals; KU32 iFunction; KU32 cFunctions; KU32 cNames; int rc; K_NOREF(fFlags); /* * Make sure we've got mapped bits and resolve any base address aliases. */ rc = kldrModPEBitsAndBaseAddress(pModPE, &pvBits, &BaseAddress); if (rc) return rc; if ( pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size < sizeof(IMAGE_EXPORT_DIRECTORY)) return 0; /* no exports to enumerate, return success. */ pExpDir = KLDRMODPE_RVA2TYPE(pvBits, pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress, PIMAGE_EXPORT_DIRECTORY); /* * Enumerate the ordinal exports. */ paRVANames = KLDRMODPE_RVA2TYPE(pvBits, pExpDir->AddressOfNames, const KU32 *); paOrdinals = KLDRMODPE_RVA2TYPE(pvBits, pExpDir->AddressOfNameOrdinals, const KU16 *); paFunctions = KLDRMODPE_RVA2TYPE(pvBits, pExpDir->AddressOfFunctions, const KU32 *); cFunctions = pExpDir->NumberOfFunctions; cNames = pExpDir->NumberOfNames; for (iFunction = 0; iFunction < cFunctions; iFunction++) { unsigned fFoundName; KU32 iName; const KU32 uRVA = paFunctions[iFunction]; const KLDRADDR uValue = BaseAddress + uRVA; KU32 fKind = (pModPE->Hdrs.FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32) ? KLDRSYMKIND_32BIT : KLDRSYMKIND_64BIT) | KLDRSYMKIND_NO_TYPE; if ( uRVA - pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress < pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size) fKind |= KLDRSYMKIND_FORWARDER; /* * Any symbol names? */ fFoundName = 0; for (iName = 0; iName < cNames; iName++) { const char *pszName; if (paOrdinals[iName] != iFunction) continue; fFoundName = 1; pszName = KLDRMODPE_RVA2TYPE(pvBits, paRVANames[iName], const char *); rc = pfnCallback(pMod, iFunction + pExpDir->Base, pszName, kHlpStrLen(pszName), NULL, uValue, fKind, pvUser); if (rc) return rc; } /* * If no names, call once with the ordinal only. */ if (!fFoundName) { rc = pfnCallback(pMod, iFunction + pExpDir->Base, NULL, 0, NULL, uValue, fKind, pvUser); if (rc) return rc; } } return 0; } /** @copydoc kLdrModGetImport */ static int kldrModPEGetImport(PKLDRMOD pMod, const void *pvBits, KU32 iImport, char *pszName, KSIZE cchName) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; const IMAGE_IMPORT_DESCRIPTOR *pImpDesc; const char *pszImportName; KSIZE cchImportName; int rc; /* * Make sure we've got mapped bits and resolve any base address aliases. */ rc = kldrModPEBitsAndBaseAddress(pModPE, &pvBits, NULL); if (rc) return rc; /* * Simple bounds check. */ if (iImport >= (KU32)kldrModPENumberOfImports(pMod, pvBits)) return KLDR_ERR_IMPORT_ORDINAL_OUT_OF_BOUNDS; /* * Get the name. */ pImpDesc = KLDRMODPE_RVA2TYPE(pvBits, pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress + sizeof(IMAGE_IMPORT_DESCRIPTOR) * iImport, const IMAGE_IMPORT_DESCRIPTOR *); pszImportName = KLDRMODPE_RVA2TYPE(pvBits, pImpDesc->Name, const char *); cchImportName = kHlpStrLen(pszImportName); if (cchImportName < cchName) { kHlpMemCopy(pszName, pszImportName, cchImportName + 1); rc = 0; } else { kHlpMemCopy(pszName, pszImportName, cchName); if (cchName) pszName[cchName - 1] = '\0'; rc = KERR_BUFFER_OVERFLOW; } return rc; } /** @copydoc kLdrModNumberOfImports */ static KI32 kldrModPENumberOfImports(PKLDRMOD pMod, const void *pvBits) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; if (pModPE->cImportModules == ~(KU32)0) { /* * We'll have to walk the import descriptors to figure out their number. * First, make sure we've got mapped bits. */ if (kldrModPEBitsAndBaseAddress(pModPE, &pvBits, NULL)) return -1; pModPE->cImportModules = 0; if ( pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size && pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress) { const IMAGE_IMPORT_DESCRIPTOR *pImpDesc; pImpDesc = KLDRMODPE_RVA2TYPE(pvBits, pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress, const IMAGE_IMPORT_DESCRIPTOR *); while (pImpDesc->Name && pImpDesc->FirstThunk) { pModPE->cImportModules++; pImpDesc++; } } } return pModPE->cImportModules; } /** @copydoc kLdrModGetStackInfo */ static int kldrModPEGetStackInfo(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRSTACKINFO pStackInfo) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; K_NOREF(pvBits); K_NOREF(BaseAddress); pStackInfo->Address = NIL_KLDRADDR; pStackInfo->LinkAddress = NIL_KLDRADDR; pStackInfo->cbStack = pStackInfo->cbStackThread = pModPE->Hdrs.OptionalHeader.SizeOfStackReserve; return 0; } /** @copydoc kLdrModQueryMainEntrypoint */ static int kldrModPEQueryMainEntrypoint(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRADDR pMainEPAddress) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; int rc; K_NOREF(pvBits); /* * Resolve base address alias if any. */ rc = kldrModPEBitsAndBaseAddress(pModPE, NULL, &BaseAddress); if (rc) return rc; /* * Convert the address from the header. */ *pMainEPAddress = pModPE->Hdrs.OptionalHeader.AddressOfEntryPoint ? BaseAddress + pModPE->Hdrs.OptionalHeader.AddressOfEntryPoint : NIL_KLDRADDR; return 0; } /** @copydoc kLdrModEnumDbgInfo */ static int kldrModPEEnumDbgInfo(PKLDRMOD pMod, const void *pvBits, PFNKLDRENUMDBG pfnCallback, void *pvUser) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; const IMAGE_DEBUG_DIRECTORY *pDbgDir; KU32 iDbgInfo; KU32 cb; int rc; /* * Check that there is a debug directory first. */ cb = pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size; if ( cb < sizeof(IMAGE_DEBUG_DIRECTORY) /* screw borland linkers */ || !pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress) return 0; /* * Make sure we've got mapped bits. */ rc = kldrModPEBitsAndBaseAddress(pModPE, &pvBits, NULL); if (rc) return rc; /* * Enumerate the debug directory. */ pDbgDir = KLDRMODPE_RVA2TYPE(pvBits, pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress, const IMAGE_DEBUG_DIRECTORY *); for (iDbgInfo = 0;; iDbgInfo++, pDbgDir++, cb -= sizeof(IMAGE_DEBUG_DIRECTORY)) { KLDRDBGINFOTYPE enmDbgInfoType; /* convert the type. */ switch (pDbgDir->Type) { case IMAGE_DEBUG_TYPE_UNKNOWN: case IMAGE_DEBUG_TYPE_FPO: case IMAGE_DEBUG_TYPE_COFF: /*stabs dialect??*/ case IMAGE_DEBUG_TYPE_MISC: case IMAGE_DEBUG_TYPE_EXCEPTION: case IMAGE_DEBUG_TYPE_FIXUP: case IMAGE_DEBUG_TYPE_BORLAND: default: enmDbgInfoType = KLDRDBGINFOTYPE_UNKNOWN; break; case IMAGE_DEBUG_TYPE_CODEVIEW: enmDbgInfoType = KLDRDBGINFOTYPE_CODEVIEW; break; } rc = pfnCallback(pMod, iDbgInfo, enmDbgInfoType, pDbgDir->MajorVersion, pDbgDir->MinorVersion, NULL, pDbgDir->PointerToRawData ? (KLDRFOFF)pDbgDir->PointerToRawData : -1, pDbgDir->AddressOfRawData ? pDbgDir->AddressOfRawData : NIL_KLDRADDR, pDbgDir->SizeOfData, NULL, pvUser); if (rc) break; /* next */ if (cb <= sizeof(IMAGE_DEBUG_DIRECTORY)) break; } return rc; } /** @copydoc kLdrModHasDbgInfo */ static int kldrModPEHasDbgInfo(PKLDRMOD pMod, const void *pvBits) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; K_NOREF(pvBits); /* * Base this entirely on the presence of a debug directory. */ if ( pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size < sizeof(IMAGE_DEBUG_DIRECTORY) /* screw borland linkers */ || !pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress) return KLDR_ERR_NO_DEBUG_INFO; return 0; } /** @copydoc kLdrModMap */ static int kldrModPEMap(PKLDRMOD pMod) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; int rc; /* * Already mapped? */ if (pModPE->pvMapping) return KLDR_ERR_ALREADY_MAPPED; /* * We've got a common worker which does this. */ rc = kldrModPEDoMap(pModPE, 1 /* the real thing */); if (rc) return rc; KLDRMODPE_ASSERT(pModPE->pvMapping); return 0; } /** @copydoc kLdrModUnmap */ static int kldrModPEUnmap(PKLDRMOD pMod) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; int rc; /* * Mapped? */ if (!pModPE->pvMapping) return KLDR_ERR_NOT_MAPPED; /* * We've got a common worker which does this. */ rc = kldrModPEDoUnmap(pModPE, pModPE->pvMapping); if (rc) return rc; KLDRMODPE_ASSERT(!pModPE->pvMapping); return 0; } /** @copydoc kLdrModAllocTLS */ static int kldrModPEAllocTLS(PKLDRMOD pMod, void *pvMapping) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; /* * Mapped? */ if (pvMapping == KLDRMOD_INT_MAP) { pvMapping = (void *)pModPE->pvMapping; if (!pvMapping) return KLDR_ERR_NOT_MAPPED; } /* * If no TLS directory then there is nothing to do. */ if ( !pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].Size || !pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress) return 0; /** @todo implement TLS. */ return -1; } /** @copydoc kLdrModFreeTLS */ static void kldrModPEFreeTLS(PKLDRMOD pMod, void *pvMapping) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; /* * Mapped? */ if (pvMapping == KLDRMOD_INT_MAP) { pvMapping = (void *)pModPE->pvMapping; if (!pvMapping) return; } /* * If no TLS directory then there is nothing to do. */ if ( !pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].Size || !pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress) return; /** @todo implement TLS. */ return; } /** @copydoc kLdrModReload */ static int kldrModPEReload(PKLDRMOD pMod) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; /* * Mapped? */ if (!pModPE->pvMapping) return KLDR_ERR_NOT_MAPPED; /* the file provider does it all */ return kRdrRefresh(pMod->pRdr, (void *)pModPE->pvMapping, pMod->cSegments, pMod->aSegments); } /** @copydoc kLdrModFixupMapping */ static int kldrModPEFixupMapping(PKLDRMOD pMod, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; int rc, rc2; /* * Mapped? */ if (!pModPE->pvMapping) return KLDR_ERR_NOT_MAPPED; /* * Before doing anything we'll have to make all pages writable. */ rc = kRdrProtect(pMod->pRdr, (void *)pModPE->pvMapping, pMod->cSegments, pMod->aSegments, 1 /* unprotect */); if (rc) return rc; /* * Apply base relocations. */ rc = kldrModPEDoFixups(pModPE, (void *)pModPE->pvMapping, (KUPTR)pModPE->pvMapping, pModPE->Hdrs.OptionalHeader.ImageBase); /* * Resolve imports. */ if (!rc) rc = kldrModPEDoImports(pModPE, (void *)pModPE->pvMapping, pfnGetImport, pvUser); /* * Restore protection. */ rc2 = kRdrProtect(pMod->pRdr, (void *)pModPE->pvMapping, pMod->cSegments, pMod->aSegments, 0 /* protect */); if (!rc && rc2) rc = rc2; return rc; } /** * Applies base relocations to a (unprotected) image mapping. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModPE The PE module interpreter instance. * @param pvMapping The mapping to fixup. * @param NewBaseAddress The address to fixup the mapping to. * @param OldBaseAddress The address the mapping is currently fixed up to. */ static int kldrModPEDoFixups(PKLDRMODPE pModPE, void *pvMapping, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress) { const KLDRADDR Delta = NewBaseAddress - OldBaseAddress; KU32 cbLeft = pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size; const IMAGE_BASE_RELOCATION *pBR, *pFirstBR; /* * Don't don anything if the delta is 0 or there aren't any relocations. */ if ( !Delta || !cbLeft || !pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress) return 0; /* * Process the fixups block by block. * (These blocks appears to be 4KB on all archs despite the native page size.) */ pBR = pFirstBR = KLDRMODPE_RVA2TYPE(pvMapping, pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress, const IMAGE_BASE_RELOCATION *); while ( cbLeft > sizeof(IMAGE_BASE_RELOCATION) && pBR->SizeOfBlock >= sizeof(IMAGE_BASE_RELOCATION) /* paranoia */) { union { KU8 *pu8; KU16 *pu16; KU32 *pu32; KU64 *pu64; } uChunk, u; const KU16 *poffFixup = (const KU16 *)(pBR + 1); const KU32 cbBlock = K_MIN(cbLeft, pBR->SizeOfBlock) - sizeof(IMAGE_BASE_RELOCATION); /* more caution... */ KU32 cFixups = cbBlock / sizeof(poffFixup[0]); uChunk.pu8 = KLDRMODPE_RVA2TYPE(pvMapping, pBR->VirtualAddress, KU8 *); /* * Loop thru the fixups in this chunk. */ while (cFixups > 0) { u.pu8 = uChunk.pu8 + (*poffFixup & 0xfff); switch (*poffFixup >> 12) /* ordered by value. */ { /* 0 - Alignment placeholder. */ case IMAGE_REL_BASED_ABSOLUTE: break; /* 1 - 16-bit, add 2nd 16-bit part of the delta. (rare) */ case IMAGE_REL_BASED_HIGH: *u.pu16 += (KU16)(Delta >> 16); break; /* 2 - 16-bit, add 1st 16-bit part of the delta. (rare) */ case IMAGE_REL_BASED_LOW: *u.pu16 += (KU16)Delta; break; /* 3 - 32-bit, add delta. (frequent in 32-bit images) */ case IMAGE_REL_BASED_HIGHLOW: *u.pu32 += (KU32)Delta; break; /* 4 - 16-bit, add 2nd 16-bit of the delta, sign adjust for the lower 16-bit. one arg. (rare) */ case IMAGE_REL_BASED_HIGHADJ: { KI32 i32; if (cFixups <= 1) return KLDR_ERR_PE_BAD_FIXUP; i32 = (KU32)*u.pu16 << 16; i32 |= *++poffFixup; cFixups--; /* the addend argument */ i32 += (KU32)Delta; i32 += 0x8000; *u.pu16 = (KU16)(i32 >> 16); break; } /* 5 - 32-bit MIPS JMPADDR, no implemented. */ case IMAGE_REL_BASED_MIPS_JMPADDR: *u.pu32 = (*u.pu32 & 0xc0000000) | ((KU32)((*u.pu32 << 2) + (KU32)Delta) >> 2); break; /* 6 - Intra section? Reserved value in later specs. Not implemented. */ case IMAGE_REL_BASED_SECTION: KLDRMODPE_ASSERT(!"SECTION"); return KLDR_ERR_PE_BAD_FIXUP; /* 7 - Relative intra section? Reserved value in later specs. Not implemented. */ case IMAGE_REL_BASED_REL32: KLDRMODPE_ASSERT(!"SECTION"); return KLDR_ERR_PE_BAD_FIXUP; /* 8 - reserved according to binutils... */ case 8: KLDRMODPE_ASSERT(!"RESERVERED8"); return KLDR_ERR_PE_BAD_FIXUP; /* 9 - IA64_IMM64 (/ MIPS_JMPADDR16), no specs nor need to support the platform yet. * Bet this requires more code than all the other fixups put together in good IA64 spirit :-) */ case IMAGE_REL_BASED_IA64_IMM64: KLDRMODPE_ASSERT(!"IA64_IMM64 / MIPS_JMPADDR16"); return KLDR_ERR_PE_BAD_FIXUP; /* 10 - 64-bit, add delta. (frequently in 64-bit images) */ case IMAGE_REL_BASED_DIR64: *u.pu64 += (KU64)Delta; break; /* 11 - 16-bit, add 3rd 16-bit of the delta, sign adjust for the lower 32-bit. two args. (rare) */ case IMAGE_REL_BASED_HIGH3ADJ: { KI64 i64; if (cFixups <= 2) return KLDR_ERR_PE_BAD_FIXUP; i64 = (KU64)*u.pu16 << 32 | ((KU32)poffFixup[2] << 16) | poffFixup[1]; i64 += Delta; i64 += 0x80008000UL; *u.pu16 = (KU16)(i64 >> 32); /* skip the addends arguments */ poffFixup += 2; cFixups -= 2; break; } /* the rest are yet to be defined.*/ default: return KLDR_ERR_PE_BAD_FIXUP; } /* * Next relocation. */ poffFixup++; cFixups--; } /* * Next block. */ cbLeft -= pBR->SizeOfBlock; pBR = (PIMAGE_BASE_RELOCATION)((KUPTR)pBR + pBR->SizeOfBlock); } return 0; } /** * Resolves imports. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModPE The PE module interpreter instance. * @param pvMapping The mapping which imports should be resolved. * @param pfnGetImport The callback for resolving an imported symbol. * @param pvUser User argument to the callback. */ static int kldrModPEDoImports(PKLDRMODPE pModPE, void *pvMapping, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { const IMAGE_IMPORT_DESCRIPTOR *pImpDesc; /* * If no imports, there is nothing to do. */ kldrModPENumberOfImports(pModPE->pMod, pvMapping); if (!pModPE->cImportModules) return 0; pImpDesc = KLDRMODPE_RVA2TYPE(pvMapping, pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress, const IMAGE_IMPORT_DESCRIPTOR *); if (pModPE->Hdrs.FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32)) return kldrModPEDoImports32Bit(pModPE, pvMapping, pImpDesc, pfnGetImport, pvUser); return kldrModPEDoImports64Bit(pModPE, pvMapping, pImpDesc, pfnGetImport, pvUser); } /** * Resolves imports, 32-bit image. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModPE The PE module interpreter instance. * @param pvMapping The mapping which imports should be resolved. * @param pImpDesc Pointer to the first import descriptor. * @param pfnGetImport The callback for resolving an imported symbol. * @param pvUser User argument to the callback. */ static int kldrModPEDoImports32Bit(PKLDRMODPE pModPE, void *pvMapping, const IMAGE_IMPORT_DESCRIPTOR *pImpDesc, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMOD pMod = pModPE->pMod; KU32 iImp; /* * Iterate the import descriptors. */ for (iImp = 0; iImp < pModPE->cImportModules; iImp++, pImpDesc++) { PIMAGE_THUNK_DATA32 pFirstThunk = KLDRMODPE_RVA2TYPE(pvMapping, pImpDesc->FirstThunk, PIMAGE_THUNK_DATA32); const IMAGE_THUNK_DATA32 *pThunk = pImpDesc->u.OriginalFirstThunk ? KLDRMODPE_RVA2TYPE(pvMapping, pImpDesc->u.OriginalFirstThunk, const IMAGE_THUNK_DATA32 *) : KLDRMODPE_RVA2TYPE(pvMapping, pImpDesc->FirstThunk, const IMAGE_THUNK_DATA32 *); /* Iterate the thunks. */ while (pThunk->u1.Ordinal != 0) { KLDRADDR Value; KU32 fKind = KLDRSYMKIND_REQ_FLAT; int rc; /* Ordinal or name import? */ if (IMAGE_SNAP_BY_ORDINAL32(pThunk->u1.Ordinal)) rc = pfnGetImport(pMod, iImp, IMAGE_ORDINAL32(pThunk->u1.Ordinal), NULL, 0, NULL, &Value, &fKind, pvUser); else if (KLDRMODPE_VALID_RVA(pModPE, pThunk->u1.Ordinal)) { const IMAGE_IMPORT_BY_NAME *pName = KLDRMODPE_RVA2TYPE(pvMapping, pThunk->u1.Ordinal, const IMAGE_IMPORT_BY_NAME *); rc = pfnGetImport(pMod, iImp, NIL_KLDRMOD_SYM_ORDINAL, (const char *)pName->Name, kHlpStrLen((const char *)pName->Name), NULL, &Value, &fKind, pvUser); } else { KLDRMODPE_ASSERT(!"bad 32-bit import"); return KLDR_ERR_PE_BAD_IMPORT; } if (rc) return rc; /* Apply it. */ pFirstThunk->u1.Function = (KU32)Value; if (pFirstThunk->u1.Function != Value) { KLDRMODPE_ASSERT(!"overflow"); return KLDR_ERR_ADDRESS_OVERFLOW; } /* next */ pThunk++; pFirstThunk++; } } return 0; } /** * Resolves imports, 64-bit image. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pModPE The PE module interpreter instance. * @param pvMapping The mapping which imports should be resolved. * @param pImpDesc Pointer to the first import descriptor. * @param pfnGetImport The callback for resolving an imported symbol. * @param pvUser User argument to the callback. */ static int kldrModPEDoImports64Bit(PKLDRMODPE pModPE, void *pvMapping, const IMAGE_IMPORT_DESCRIPTOR *pImpDesc, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMOD pMod = pModPE->pMod; KU32 iImp; /* * Iterate the import descriptors. */ for (iImp = 0; iImp < pModPE->cImportModules; iImp++, pImpDesc++) { PIMAGE_THUNK_DATA64 pFirstThunk = KLDRMODPE_RVA2TYPE(pvMapping, pImpDesc->FirstThunk, PIMAGE_THUNK_DATA64); const IMAGE_THUNK_DATA64 *pThunk = pImpDesc->u.OriginalFirstThunk ? KLDRMODPE_RVA2TYPE(pvMapping, pImpDesc->u.OriginalFirstThunk, const IMAGE_THUNK_DATA64 *) : KLDRMODPE_RVA2TYPE(pvMapping, pImpDesc->FirstThunk, const IMAGE_THUNK_DATA64 *); /* Iterate the thunks. */ while (pThunk->u1.Ordinal != 0) { KLDRADDR Value; KU32 fKind = KLDRSYMKIND_REQ_FLAT; int rc; /* Ordinal or name import? */ if (IMAGE_SNAP_BY_ORDINAL64(pThunk->u1.Ordinal)) rc = pfnGetImport(pMod, iImp, (KU32)IMAGE_ORDINAL64(pThunk->u1.Ordinal), NULL, 0, NULL, &Value, &fKind, pvUser); else if (KLDRMODPE_VALID_RVA(pModPE, pThunk->u1.Ordinal)) { const IMAGE_IMPORT_BY_NAME *pName = KLDRMODPE_RVA2TYPE(pvMapping, pThunk->u1.Ordinal, const IMAGE_IMPORT_BY_NAME *); rc = pfnGetImport(pMod, iImp, NIL_KLDRMOD_SYM_ORDINAL, (const char *)pName->Name, kHlpStrLen((const char *)pName->Name), NULL, &Value, &fKind, pvUser); } else { KLDRMODPE_ASSERT(!"bad 64-bit import"); return KLDR_ERR_PE_BAD_IMPORT; } if (rc) return rc; /* Apply it. */ pFirstThunk->u1.Function = Value; /* next */ pThunk++; pFirstThunk++; } } return 0; } /** @copydoc kLdrModCallInit */ static int kldrModPECallInit(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; int rc; /* * Mapped? */ if (pvMapping == KLDRMOD_INT_MAP) { pvMapping = (void *)pModPE->pvMapping; if (!pvMapping) return KLDR_ERR_NOT_MAPPED; } /* * Do TLS callbacks first and then call the init/term function if it's a DLL. */ rc = kldrModPEDoCallTLS(pModPE, pvMapping, DLL_PROCESS_ATTACH, uHandle); if ( !rc && (pModPE->Hdrs.FileHeader.Characteristics & IMAGE_FILE_DLL)) { rc = kldrModPEDoCallDLL(pModPE, pvMapping, DLL_PROCESS_ATTACH, uHandle); if (rc) kldrModPEDoCallTLS(pModPE, pvMapping, DLL_PROCESS_DETACH, uHandle); } return rc; } /** * Call the DLL entrypoint. * * @returns 0 on success. * @returns KLDR_ERR_MODULE_INIT_FAILED or KLDR_ERR_THREAD_ATTACH_FAILED on failure. * @param pModPE The PE module interpreter instance. * @param pvMapping The module mapping to use (resolved). * @param uOp The operation (DLL_*). * @param uHandle The module handle to present. */ static int kldrModPEDoCallDLL(PKLDRMODPE pModPE, void *pvMapping, unsigned uOp, KUPTR uHandle) { int rc; /* * If no entrypoint there isn't anything to be done. */ if (!pModPE->Hdrs.OptionalHeader.AddressOfEntryPoint) return 0; /* * Invoke the entrypoint and convert the boolean result to a kLdr status code. */ rc = kldrModPEDoCall((KUPTR)pvMapping + pModPE->Hdrs.OptionalHeader.AddressOfEntryPoint, uHandle, uOp, NULL); if (rc) rc = 0; else if (uOp == DLL_PROCESS_ATTACH) rc = KLDR_ERR_MODULE_INIT_FAILED; else if (uOp == DLL_THREAD_ATTACH) rc = KLDR_ERR_THREAD_ATTACH_FAILED; else /* detach: ignore failures */ rc = 0; return rc; } /** * Call the TLS entrypoints. * * @returns 0 on success. * @returns KLDR_ERR_THREAD_ATTACH_FAILED on failure. * @param pModPE The PE module interpreter instance. * @param pvMapping The module mapping to use (resolved). * @param uOp The operation (DLL_*). * @param uHandle The module handle to present. */ static int kldrModPEDoCallTLS(PKLDRMODPE pModPE, void *pvMapping, unsigned uOp, KUPTR uHandle) { /** @todo implement TLS support. */ K_NOREF(pModPE); K_NOREF(pvMapping); K_NOREF(uOp); K_NOREF(uHandle); return 0; } /** * Do a 3 parameter callback. * * @returns 32-bit callback return. * @param uEntrypoint The address of the function to be called. * @param uHandle The first argument, the module handle. * @param uOp The second argumnet, the reason we're calling. * @param pvReserved The third argument, reserved argument. (figure this one out) */ KI32 kldrModPEDoCall(KUPTR uEntrypoint, KUPTR uHandle, KU32 uOp, void *pvReserved) { KI32 rc; /** @todo try/except */ #if defined(__X86__) || defined(__i386__) || defined(_M_IX86) /* * Be very careful. * Not everyone will have got the calling convention right. */ # ifdef __GNUC__ __asm__ __volatile__( "pushl %2\n\t" "pushl %1\n\t" "pushl %0\n\t" "lea 12(%%esp), %2\n\t" "call *%3\n\t" "movl %2, %%esp\n\t" : "=a" (rc) : "d" (uOp), "S" (0), "c" (uEntrypoint), "0" (uHandle)); # elif defined(_MSC_VER) __asm { mov eax, [uHandle] mov edx, [uOp] mov ecx, 0 mov ebx, [uEntrypoint] push edi mov edi, esp push ecx push edx push eax call ebx mov esp, edi pop edi mov [rc], eax } # else # error "port me!" # endif #elif defined(__AMD64__) || defined(__x86_64__) || defined(_M_IX86) /* * For now, let's just get the work done... */ /** @todo Deal with GCC / MSC differences in some sensible way. */ int (*pfn)(KUPTR uHandle, KU32 uOp, void *pvReserved); pfn = (int (*)(KUPTR uHandle, KU32 uOp, void *pvReserved))uEntrypoint; rc = pfn(uHandle, uOp, NULL); #else # error "port me" #endif K_NOREF(pvReserved); return rc; } /** @copydoc kLdrModCallTerm */ static int kldrModPECallTerm(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; /* * Mapped? */ if (pvMapping == KLDRMOD_INT_MAP) { pvMapping = (void *)pModPE->pvMapping; if (!pvMapping) return KLDR_ERR_NOT_MAPPED; } /* * Do TLS callbacks first. */ kldrModPEDoCallTLS(pModPE, pvMapping, DLL_PROCESS_DETACH, uHandle); if (pModPE->Hdrs.FileHeader.Characteristics & IMAGE_FILE_DLL) kldrModPEDoCallDLL(pModPE, pvMapping, DLL_PROCESS_DETACH, uHandle); return 0; } /** @copydoc kLdrModCallThread */ static int kldrModPECallThread(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle, unsigned fAttachingOrDetaching) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; unsigned uOp = fAttachingOrDetaching ? DLL_THREAD_ATTACH : DLL_THREAD_DETACH; int rc; /* * Mapped? */ if (pvMapping == KLDRMOD_INT_MAP) { pvMapping = (void *)pModPE->pvMapping; if (!pvMapping) return KLDR_ERR_NOT_MAPPED; } /* * Do TLS callbacks first and then call the init/term function if it's a DLL. */ rc = kldrModPEDoCallTLS(pModPE, pvMapping, uOp, uHandle); if (!fAttachingOrDetaching) rc = 0; if ( !rc && (pModPE->Hdrs.FileHeader.Characteristics & IMAGE_FILE_DLL)) { rc = kldrModPEDoCallDLL(pModPE, pvMapping, uOp, uHandle); if (!fAttachingOrDetaching) rc = 0; if (rc) kldrModPEDoCallTLS(pModPE, pvMapping, uOp, uHandle); } return rc; } /** @copydoc kLdrModSize */ static KLDRADDR kldrModPESize(PKLDRMOD pMod) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; return pModPE->Hdrs.OptionalHeader.SizeOfImage; } /** @copydoc kLdrModGetBits */ static int kldrModPEGetBits(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; KU32 i; int rc; /* * Zero the entire buffer first to simplify things. */ kHlpMemSet(pvBits, 0, pModPE->Hdrs.OptionalHeader.SizeOfImage); /* * Iterate the segments and read the data within them. */ for (i = 0; i < pMod->cSegments; i++) { /* skip it? */ if ( pMod->aSegments[i].cbFile == -1 || pMod->aSegments[i].offFile == -1 || pMod->aSegments[i].LinkAddress == NIL_KLDRADDR || !pMod->aSegments[i].Alignment) continue; rc = kRdrRead(pMod->pRdr, (KU8 *)pvBits + (pMod->aSegments[i].LinkAddress - pModPE->Hdrs.OptionalHeader.ImageBase), pMod->aSegments[i].cbFile, pMod->aSegments[i].offFile); if (rc) return rc; } /* * Perform relocations. */ return kldrModPERelocateBits(pMod, pvBits, BaseAddress, pModPE->Hdrs.OptionalHeader.ImageBase, pfnGetImport, pvUser); } /** @copydoc kLdrModRelocateBits */ static int kldrModPERelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData; int rc; /* * Call workers to do the jobs. */ rc = kldrModPEDoFixups(pModPE, pvBits, NewBaseAddress, OldBaseAddress); if (!rc) rc = kldrModPEDoImports(pModPE, pvBits, pfnGetImport, pvUser); return rc; } /** * The PE module interpreter method table. */ KLDRMODOPS g_kLdrModPEOps = { "PE", NULL, kldrModPECreate, kldrModPEDestroy, kldrModPEQuerySymbol, kldrModPEEnumSymbols, kldrModPEGetImport, kldrModPENumberOfImports, NULL /* can execute one is optional */, kldrModPEGetStackInfo, kldrModPEQueryMainEntrypoint, NULL /* pfnQueryImageUuid */, NULL, /** @todo resources */ NULL, /** @todo resources */ kldrModPEEnumDbgInfo, kldrModPEHasDbgInfo, kldrModPEMap, kldrModPEUnmap, kldrModPEAllocTLS, kldrModPEFreeTLS, kldrModPEReload, kldrModPEFixupMapping, kldrModPECallInit, kldrModPECallTerm, kldrModPECallThread, kldrModPESize, kldrModPEGetBits, kldrModPERelocateBits, NULL, /** @todo mostly done */ 42 /* the end */ }; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdr-os2.c����������������������������������������������������������0000664�0001750�0001750�00000003775�14670377514�020174� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdr-os2.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, OS/2 Specifics. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #define INCL_BASE #include <os2.h> #include <k/kLdr.h> #include "kLdrInternal.h" /** * The DLL main function. * * @returns TRUE / FALSE. * @param hmod The dll handle. * @param fFlags Flags. */ ULONG _System _DLL_InitTerm(HMODULE hmod, ULONG fFlags) { switch (fFlags) { case 0: { int rc = kldrInit(); return rc == 0; } case 1: kldrTerm(); return TRUE; default: return FALSE; } } ���kbuild-3608/src/lib/kStuff/kLdr/kLdrExeStub-os2.asm�������������������������������������������������0000664�0001750�0001750�00000004317�14670377514�022023� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; $Id: kLdrExeStub-os2.asm 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - OS/2 Loader Stub. ; ; This file contains a 64kb code/data/stack segment which is used to kick off ; the loader dll that loads the process. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; struc KLDRARGS .fFlags resd 1 .enmSearch resd 1 .szExecutable resb 260 .szDefPrefix resb 16 .szDefSuffix resb 16 .szLibPath resb (4096 - (4 + 4 + 16 + 16 + 260)) endstruc extern _kLdrDyldLoadExe segment DATA32 stack CLASS=DATA align=16 use32 ..start: push args jmp _kLdrDyldLoadExe ; ; Argument structure. ; align 4 args: istruc KLDRARGS at KLDRARGS.fFlags, dd 0 at KLDRARGS.enmSearch, dd 2 ;KLDRDYLD_SEARCH_HOST at KLDRARGS.szDefPrefix, db '' at KLDRARGS.szDefSuffix, db '.dll' ; at KLDRARGS.szExecutable, db 'tst-0.exe' at KLDRARGS.szLibPath, db '' iend segment STACK32 stack CLASS=STACK align=16 use32 ; pad up to 64KB. resb 60*1024 global WEAK$ZERO WEAK$ZERO EQU 0 group DGROUP, DATA32 STACK32 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/Doxyfile������������������������������������������������������������0000664�0001750�0001750�00000144173�14670377514�020137� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Doxyfile 1.5.0 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = kLdr # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = docs # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, # Italian, Japanese, Japanese-en (Japanese with English messages), Korean, # Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, # Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # This tag can be used to specify the encoding used in the generated output. # The encoding is not always determined by the language that is chosen, # but also whether or not the output is meant for Windows or non-Windows users. # In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES # forces the Windows encoding (this is the default for the Windows binary), # whereas setting the tag to NO uses a Unix-style encoding (the default for # all platforms other than Windows). USE_WINDOWS_ENCODING = YES # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. JAVADOC_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to # include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = YES # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from the # version control system). Doxygen will invoke the program by executing (via # popen()) the command <command> <input-file>, where <command> is the value of # the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py FILE_PATTERNS = *.c *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = tst* # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = tg # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command <filter> <input-file>, where <filter> # is the value of the INPUT_FILTER tag, and <input-file> is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentstion. REFERENCES_LINK_SOURCE = NO # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = NO #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = YES # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = NO # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a caller dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected # functions only using the \callergraph command. CALLER_GRAPH = YES # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that a graph may be further truncated if the graph's # image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH # and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), # the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, which results in a white background. # Warning: Depending on the platform used, enabling this option may lead to # badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrExeStub-os2.c���������������������������������������������������0000664�0001750�0001750�00000004354�14670377514�021466� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrExeStub-os2.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - OS/2 C Loader Stub. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include <os2.h> /******************************************************************************* * Global Variables * *******************************************************************************/ /** The stub arguments. */ static const KLDREXEARGS g_Args = { /* .fFlags = */ KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT, /* .enmSearch = */ KLDRDYLD_SEARCH_OS2, /* .szExecutable = */ "tst-0", /* just while testing */ /* .szDefPrefix = */ "", /* .szDefSuffix = */ ".dll", /* .szLibPath = */ "" }; /** * OS/2 'main'. */ int _System OS2Main(HMODULE hmod, ULONG ulReserved, PCH pszzEnv, PCH pszzCmdLine) { return kLdrDyldLoadExe(&g_Args, &hmod); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdr-win.def��������������������������������������������������������0000664�0001750�0001750�00000005337�14670377514�020576� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; $Id: kLdr-win.def 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - The Dynamic Loader, Windows Linker Definition File. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; LIBRARY kLdr EXPORTS ; The file reader API kRdrAddProvider kRdrOpen kRdrClose kRdrRead kRdrAllMap kRdrAllUnmap kRdrSize kRdrTell kRdrName kRdrPageSize kRdrMap kRdrRefresh kRdrProtect kRdrUnmap kRdrDone ; The module interpreter API kLdrModOpen kLdrModOpenFromRdr kLdrModOpenNative kLdrModOpenNativeByHandle kLdrModClose kLdrModQuerySymbol kLdrModEnumSymbols kLdrModGetImport kLdrModNumberOfImports kLdrModCanExecuteOn kLdrModGetStackInfo kLdrModQueryMainEntrypoint kLdrModEnumDbgInfo kLdrModHasDbgInfo kLdrModMap kLdrModUnmap kLdrModAllocTLS kLdrModFreeTLS kLdrModReload kLdrModFixupMapping kLdrModCallInit kLdrModCallTerm kLdrModCallThread kLdrModSize kLdrModGetBits kLdrModRelocateBits ; Process Bootstrapping kLdrDyldLoadExe ; Dynamic loading kLdrDyldLoad kLdrDyldUnload kLdrDyldFindByName kLdrDyldFindByAddress kLdrDyldGetName kLdrDyldGetFilename kLdrDyldQuerySymbol ; OS/2 API wrappers: ; kLdrLoadModule ; kLdrFreeModule ; kLdrQueryModuleHandle ; kLdrQueryModuleName ; kLdrQueryProcAddr ; kLdrQueryProcType ; kLdrQueryModFromEIP ; kLdrReplaceModule ; kLdrGetResource ; kLdrFreeResource ; kLdrQueryResourceSize ; dlfcn API wrappers: ; _kLdrDlOpen ; _kLdrDlClose ; _kLdrDlError ; _kLdrDlSym ; _kLdrDlFunc ; Error APIs: kErrName �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrModNative.c�����������������������������������������������������0000664�0001750�0001750�00000117156�14670377513�021300� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrModNative.c 117 2020-03-15 15:23:36Z bird $ */ /** @file * kLdr - The Module Interpreter for the Native Loaders. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include "kLdrInternal.h" #if K_OS == K_OS_OS2 # define INCL_BASE # include <os2.h> # ifndef LIBPATHSTRICT # define LIBPATHSTRICT 3 # endif extern APIRET DosQueryHeaderInfo(HMODULE hmod, ULONG ulIndex, PVOID pvBuffer, ULONG cbBuffer, ULONG ulSubFunction); # define QHINF_EXEINFO 1 /* NE exeinfo. */ # define QHINF_READRSRCTBL 2 /* Reads from the resource table. */ # define QHINF_READFILE 3 /* Reads from the executable file. */ # define QHINF_LIBPATHLENGTH 4 /* Gets the libpath length. */ # define QHINF_LIBPATH 5 /* Gets the entire libpath. */ # define QHINF_FIXENTRY 6 /* NE only */ # define QHINF_STE 7 /* NE only */ # define QHINF_MAPSEL 8 /* NE only */ #elif K_OS == K_OS_WINDOWS # undef IMAGE_NT_SIGNATURE # undef IMAGE_DOS_SIGNATURE # include <windows.h> # ifndef IMAGE_SCN_TYPE_NOLOAD # define IMAGE_SCN_TYPE_NOLOAD 0x00000002 # endif /*#elif defined(__NT__) #include <winnt.h> */ #elif K_OS == K_OS_DARWIN # include <dlfcn.h> # include <errno.h> #else # error "port me" #endif /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def KLDRMODNATIVE_STRICT * Define KLDRMODNATIVE_STRICT to enabled strict checks in KLDRMODNATIVE. */ #define KLDRMODNATIVE_STRICT 1 /** @def KLDRMODNATIVE_ASSERT * Assert that an expression is true when KLDR_STRICT is defined. */ #ifdef KLDRMODNATIVE_STRICT # define KLDRMODNATIVE_ASSERT(expr) kHlpAssert(expr) #else # define KLDRMODNATIVE_ASSERT(expr) do {} while (0) #endif #if K_OS == K_OS_WINDOWS /** @def KLDRMODNATIVE_RVA2TYPE * Converts a RVA to a pointer of the specified type. * @param pvBits The bits (image base). * @param uRVA The image relative virtual address. * @param type The type to cast to. */ # define KLDRMODNATIVE_RVA2TYPE(pvBits, uRVA, type) \ ( (type) ((KUPTR)(pvBits) + (uRVA)) ) #endif /* PE OSes */ /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Instance data for the module interpreter for the Native Loaders. */ typedef struct KLDRMODNATIVE { /** Pointer to the module. (Follows the section table.) */ PKLDRMOD pMod; /** Reserved flags. */ KU32 f32Reserved; /** The number of imported modules. * If ~(KU32)0 this hasn't been determined yet. */ KU32 cImportModules; #if K_OS == K_OS_OS2 /** The module handle. */ HMODULE hmod; #elif K_OS == K_OS_WINDOWS /** The module handle. */ HANDLE hmod; /** Pointer to the NT headers. */ const IMAGE_NT_HEADERS *pNtHdrs; /** Pointer to the section header array. */ const IMAGE_SECTION_HEADER *paShdrs; #elif K_OS == K_OS_DARWIN /** The dlopen() handle.*/ void *pvMod; #else # error "Port me" #endif } KLDRMODNATIVE, *PKLDRMODNATIVE; /******************************************************************************* * Internal Functions * *******************************************************************************/ static KI32 kldrModNativeNumberOfImports(PKLDRMOD pMod, const void *pvBits); /********************************************************************************************************************************* * Global Variables * *********************************************************************************************************************************/ extern KLDRMODOPS g_kLdrModNativeOps; /** * Use native loader to load the file opened by pRdr. * * @returns 0 on success and *ppMod pointing to a module instance. * On failure, a non-zero OS specific error code is returned. * @param pOps Pointer to the registered method table. * @param pRdr The file provider instance to use. * @param offNewHdr The offset of the new header in MZ files. -1 if not found. * @param ppMod Where to store the module instance pointer. */ static int kldrModNativeCreate(PCKLDRMODOPS pOps, PKRDR pRdr, KU32 fFlags, KCPUARCH enmCpuArch, KLDRFOFF offNewHdr, PPKLDRMOD ppMod) { int rc = kLdrModOpenNative(kRdrName(pRdr), fFlags, ppMod); if (rc) return rc; rc = kRdrClose(pRdr); KLDRMODNATIVE_ASSERT(!rc); return 0; } /** * Loads a module using the native module loader. * * @returns 0 on success. * @returns non-zero native or kLdr status code on failure. * @param pszFilename The filename or module name to be loaded. * @param fFlags Module open flags, KLDRMOD_OPEN_FLAGS_XXX. * @param ppMod Where to store the module interpreter instance pointer. */ int kLdrModOpenNative(const char *pszFilename, KU32 fFlags, PPKLDRMOD ppMod) { int rc; /* * Load the image. */ #if K_OS == K_OS_OS2 HMODULE hmod; kHlpAssertReturn(!(fFlags & ~KLDRMOD_OPEN_FLAGS_VALID_MASK), KERR_INVALID_PARAMETER); rc = DosLoadModule(NULL, 0, (PCSZ)pszFilename, &hmod); if (rc) return rc; rc = kLdrModOpenNativeByHandle((KUPTR)hmod, fFlags, ppMod); if (rc) DosFreeModule(hmod); #elif K_OS == K_OS_WINDOWS HMODULE hmod; kHlpAssertReturn(!(fFlags & ~KLDRMOD_OPEN_FLAGS_VALID_MASK), KERR_INVALID_PARAMETER); hmod = LoadLibrary(pszFilename); if (!hmod) return GetLastError(); rc = kLdrModOpenNativeByHandle((KUPTR)hmod, fFlags, ppMod); if (rc) FreeLibrary(hmod); #elif K_OS == K_OS_DARWIN void *pvMod; kHlpAssertReturn(!(fFlags & ~KLDRMOD_OPEN_FLAGS_VALID_MASK), KERR_INVALID_PARAMETER); pvMod = dlopen(pszFilename, 0); if (!pvMod) return ENOENT; rc = kLdrModOpenNativeByHandle((KUPTR)pvMod, fFlags, ppMod); if (rc) dlclose(pvMod); #else # error "Port me" #endif return rc; } /** * Creates a native module interpret for an already module already * loaded by the native loader. * * @returns 0 on success. * @returns non-zero native or kLdr status code on failure. * @param pszFilename The filename or module name to be loaded. * @param fFlags Module open flags, KLDRMOD_OPEN_FLAGS_XXX. * @param ppMod Where to store the module interpreter instance pointer. * @remark This will not make the native loader increment the load count. */ int kLdrModOpenNativeByHandle(KUPTR uHandle, KU32 fFlags, PPKLDRMOD ppMod) { KSIZE cb; KU32 cchFilename; KU32 cSegments; PKLDRMOD pMod; PKLDRMODNATIVE pModNative; /* * Delcare variables, parse the module header or whatever and determin the * size of the module instance. */ #if K_OS == K_OS_OS2 char szFilename[CCHMAXPATH]; int rc; /* get the filename. */ rc = DosQueryModuleName((HMODULE)uHandle, sizeof(szFilename), szFilename); if (rc) { KLDRMODNATIVE_ASSERT(rc); szFilename[0] = '\0'; } /* get the segment count. */ /** @todo DosQueryHeaderInfo should be able to get us what we want on OS/2. */ cSegments = 1; #elif K_OS == K_OS_WINDOWS DWORD dw; char szFilename[MAX_PATH]; const IMAGE_NT_HEADERS *pNtHdrs; const IMAGE_SECTION_HEADER *paShdrs; const IMAGE_DOS_HEADER *pDosHdr = (const IMAGE_DOS_HEADER *)uHandle; unsigned i; /* get the filename. */ dw = GetModuleFileName((HANDLE)uHandle, szFilename, sizeof(szFilename)); if (dw <= 0) { KLDRMODNATIVE_ASSERT(dw <= 0); szFilename[0] = '\0'; } /* get the segment count. */ if (pDosHdr->e_magic == IMAGE_DOS_SIGNATURE) pNtHdrs = (const IMAGE_NT_HEADERS *)((KUPTR)pDosHdr + pDosHdr->e_lfanew); else pNtHdrs = (const IMAGE_NT_HEADERS *)pDosHdr; if (pNtHdrs->Signature != IMAGE_NT_SIGNATURE) { KLDRMODNATIVE_ASSERT(!"bad signature"); return KLDR_ERR_UNKNOWN_FORMAT; } if (pNtHdrs->FileHeader.SizeOfOptionalHeader != sizeof(IMAGE_OPTIONAL_HEADER)) { KLDRMODNATIVE_ASSERT(!"bad optional header size"); return KLDR_ERR_UNKNOWN_FORMAT; } cSegments = pNtHdrs->FileHeader.NumberOfSections + 1; paShdrs = (const IMAGE_SECTION_HEADER *)(pNtHdrs + 1); #elif K_OS == K_OS_DARWIN char szFilename[1] = ""; cSegments = 0; /** @todo Figure out the Mac OS X dynamic loader. */ #else # error "Port me" #endif kHlpAssertReturn(!(fFlags & ~KLDRMOD_OPEN_FLAGS_VALID_MASK), KERR_INVALID_PARAMETER); /* * Calc the instance size, allocate and initialize it. */ cchFilename = (KU32)kHlpStrLen(szFilename); cb = K_ALIGN_Z(sizeof(KLDRMODNATIVE), 16) + K_OFFSETOF(KLDRMOD, aSegments[cSegments]) + cchFilename + 1; pModNative = (PKLDRMODNATIVE)kHlpAlloc(cb); if (!pModNative) return KERR_NO_MEMORY; /* KLDRMOD */ pMod = (PKLDRMOD)((KU8 *)pModNative + K_ALIGN_Z(sizeof(KLDRMODNATIVE), 16)); pMod->pvData = pModNative; pMod->pRdr = NULL; pMod->pOps = NULL; /* set upon success. */ pMod->cSegments = cSegments; pMod->cchFilename = cchFilename; pMod->pszFilename = (char *)&pMod->aSegments[pMod->cSegments]; kHlpMemCopy((char *)pMod->pszFilename, szFilename, cchFilename + 1); pMod->pszName = kHlpGetFilename(pMod->pszFilename); /** @todo get soname */ pMod->cchName = cchFilename - (KU32)(pMod->pszName - pMod->pszFilename); pMod->fFlags = fFlags; #if defined(__i386__) || defined(__X86__) || defined(_M_IX86) pMod->enmCpu = KCPU_I386; pMod->enmArch = KCPUARCH_X86_32; pMod->enmEndian = KLDRENDIAN_LITTLE; #elif defined(__X86_64__) || defined(__x86_64__) || defined(__AMD64__) || defined(_M_IX64) pMod->enmCpu = KCPU_K8; pMod->enmArch = KCPUARCH_AMD64; pMod->enmEndian = KLDRENDIAN_LITTLE; #else # error "Port me" #endif pMod->enmFmt = KLDRFMT_NATIVE; pMod->enmType = KLDRTYPE_SHARED_LIBRARY_RELOCATABLE; pMod->u32Magic = 0; /* set upon success. */ /* KLDRMODNATIVE */ pModNative->pMod = pMod; pModNative->f32Reserved = 0; pModNative->cImportModules = ~(KU32)0; /* * Set native instance data. */ #if K_OS == K_OS_OS2 pModNative->hmod = (HMODULE)uHandle; /* just fake a segment for now. */ pMod->aSegments[0].pvUser = NULL; pMod->aSegments[0].pchName = "fake"; pMod->aSegments[0].cchName = sizeof("fake") - 1; pMod->aSegments[0].enmProt = KPROT_NOACCESS; pMod->aSegments[0].cb = 0; pMod->aSegments[0].Alignment = 0; pMod->aSegments[0].LinkAddress = NIL_KLDRADDR; pMod->aSegments[0].offFile = -1; pMod->aSegments[0].cbFile = 0; pMod->aSegments[0].RVA = NIL_KLDRADDR; pMod->aSegments[0].cbMapped = 0; pMod->aSegments[0].MapAddress = 0; #elif K_OS == K_OS_WINDOWS pModNative->hmod = (HMODULE)uHandle; pModNative->pNtHdrs = pNtHdrs; pModNative->paShdrs = paShdrs; if (pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_DLL) pMod->enmType = !(pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) ? KLDRTYPE_SHARED_LIBRARY_RELOCATABLE : KLDRTYPE_SHARED_LIBRARY_FIXED; else pMod->enmType = !(pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) ? KLDRTYPE_EXECUTABLE_RELOCATABLE : KLDRTYPE_EXECUTABLE_FIXED; /* The implied headers section. */ pMod->aSegments[0].pvUser = NULL; pMod->aSegments[0].pchName = "TheHeaders"; pMod->aSegments[0].cchName = sizeof("TheHeaders") - 1; pMod->aSegments[0].enmProt = KPROT_READONLY; pMod->aSegments[0].cb = pNtHdrs->OptionalHeader.SizeOfHeaders; pMod->aSegments[0].Alignment = pNtHdrs->OptionalHeader.SectionAlignment; pMod->aSegments[0].LinkAddress = pNtHdrs->OptionalHeader.ImageBase; pMod->aSegments[0].offFile = 0; pMod->aSegments[0].cbFile = pNtHdrs->OptionalHeader.SizeOfHeaders; pMod->aSegments[0].RVA = 0; if (pMod->cSegments > 1) pMod->aSegments[0].cbMapped = paShdrs[0].VirtualAddress; else pMod->aSegments[0].cbMapped = pNtHdrs->OptionalHeader.SizeOfHeaders; pMod->aSegments[0].MapAddress = uHandle; /* The section headers. */ for (i = 0; i < pNtHdrs->FileHeader.NumberOfSections; i++) { const char *pch; KU32 cchSegName; /* unused */ pMod->aSegments[i + 1].pvUser = NULL; /* name */ pMod->aSegments[i + 1].pchName = pch = &paShdrs[i].Name[0]; cchSegName = IMAGE_SIZEOF_SHORT_NAME; while ( cchSegName > 0 && (pch[cchSegName - 1] == ' ' || pch[cchSegName - 1] == '\0')) cchSegName--; pMod->aSegments[i + 1].cchName = cchSegName; /* size and addresses */ if (!(paShdrs[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD)) { pMod->aSegments[i + 1].cb = paShdrs[i].Misc.VirtualSize; pMod->aSegments[i + 1].RVA = paShdrs[i].VirtualAddress; pMod->aSegments[i + 1].LinkAddress = paShdrs[i].VirtualAddress + pNtHdrs->OptionalHeader.ImageBase; pMod->aSegments[i + 1].MapAddress = paShdrs[i].VirtualAddress + uHandle; pMod->aSegments[i + 1].cbMapped = paShdrs[i].Misc.VirtualSize; if (i + 2 < pMod->cSegments) pMod->aSegments[i + 1].cbMapped = paShdrs[i + 1].VirtualAddress - paShdrs[i].VirtualAddress; } else { pMod->aSegments[i + 1].cb = 0; pMod->aSegments[i + 1].cbMapped = 0; pMod->aSegments[i + 1].LinkAddress = NIL_KLDRADDR; pMod->aSegments[i + 1].RVA = 0; pMod->aSegments[i + 1].MapAddress = 0; } /* file location */ pMod->aSegments[i + 1].offFile = paShdrs[i].PointerToRawData; pMod->aSegments[i + 1].cbFile = paShdrs[i].SizeOfRawData; if ( pMod->aSegments[i + 1].cbMapped > 0 /* if mapped */ && (KLDRSIZE)pMod->aSegments[i + 1].cbFile > pMod->aSegments[i + 1].cbMapped) pMod->aSegments[i + 1].cbFile = (KLDRFOFF)pMod->aSegments[i + 1].cbMapped; /* protection */ switch ( paShdrs[i].Characteristics & (IMAGE_SCN_MEM_SHARED | IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE)) { case 0: case IMAGE_SCN_MEM_SHARED: pMod->aSegments[i + 1].enmProt = KPROT_NOACCESS; break; case IMAGE_SCN_MEM_READ: case IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_SHARED: pMod->aSegments[i + 1].enmProt = KPROT_READONLY; break; case IMAGE_SCN_MEM_WRITE: case IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_READ: pMod->aSegments[i + 1].enmProt = KPROT_WRITECOPY; break; case IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_SHARED: case IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_SHARED | IMAGE_SCN_MEM_READ: pMod->aSegments[i + 1].enmProt = KPROT_READWRITE; break; case IMAGE_SCN_MEM_EXECUTE: case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_SHARED: pMod->aSegments[i + 1].enmProt = KPROT_EXECUTE; break; case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ: case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_SHARED: pMod->aSegments[i + 1].enmProt = KPROT_EXECUTE_READ; break; case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_WRITE: case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_READ: pMod->aSegments[i + 1].enmProt = KPROT_EXECUTE_WRITECOPY; break; case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_SHARED: case IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_SHARED | IMAGE_SCN_MEM_READ: pMod->aSegments[i + 1].enmProt = KPROT_EXECUTE_READWRITE; break; } /* alignment. */ switch (paShdrs[i].Characteristics & IMAGE_SCN_ALIGN_MASK) { case 0: /* hope this is right... */ pMod->aSegments[i + 1].Alignment = pNtHdrs->OptionalHeader.SectionAlignment; break; case IMAGE_SCN_ALIGN_1BYTES: pMod->aSegments[i + 1].Alignment = 1; break; case IMAGE_SCN_ALIGN_2BYTES: pMod->aSegments[i + 1].Alignment = 2; break; case IMAGE_SCN_ALIGN_4BYTES: pMod->aSegments[i + 1].Alignment = 4; break; case IMAGE_SCN_ALIGN_8BYTES: pMod->aSegments[i + 1].Alignment = 8; break; case IMAGE_SCN_ALIGN_16BYTES: pMod->aSegments[i + 1].Alignment = 16; break; case IMAGE_SCN_ALIGN_32BYTES: pMod->aSegments[i + 1].Alignment = 32; break; case IMAGE_SCN_ALIGN_64BYTES: pMod->aSegments[i + 1].Alignment = 64; break; case IMAGE_SCN_ALIGN_128BYTES: pMod->aSegments[i + 1].Alignment = 128; break; case IMAGE_SCN_ALIGN_256BYTES: pMod->aSegments[i + 1].Alignment = 256; break; case IMAGE_SCN_ALIGN_512BYTES: pMod->aSegments[i + 1].Alignment = 512; break; case IMAGE_SCN_ALIGN_1024BYTES: pMod->aSegments[i + 1].Alignment = 1024; break; case IMAGE_SCN_ALIGN_2048BYTES: pMod->aSegments[i + 1].Alignment = 2048; break; case IMAGE_SCN_ALIGN_4096BYTES: pMod->aSegments[i + 1].Alignment = 4096; break; case IMAGE_SCN_ALIGN_8192BYTES: pMod->aSegments[i + 1].Alignment = 8192; break; default: kHlpAssert(0); pMod->aSegments[i + 1].Alignment = 0; break; } } #elif K_OS == K_OS_DARWIN /** @todo Figure out the Mac OS X dynamic loader. */ #else # error "Port me" #endif /* * We're done. */ pMod->u32Magic = KLDRMOD_MAGIC; pMod->pOps = &g_kLdrModNativeOps; *ppMod = pMod; return 0; } /** @copydoc KLDRMODOPS::pfnDestroy */ static int kldrModNativeDestroy(PKLDRMOD pMod) { PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData; int rc; #if K_OS == K_OS_OS2 rc = DosFreeModule(pModNative->hmod); #elif K_OS == K_OS_WINDOWS if (FreeLibrary(pModNative->hmod)) rc = 0; else rc = GetLastError(); #elif K_OS == K_OS_DARWIN dlclose(pModNative->pvMod); #else # error "Port me" #endif pMod->u32Magic = 0; pMod->pOps = NULL; kHlpFree(pModNative); return rc; } /** @copydoc kLdrModQuerySymbol */ static int kldrModNativeQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind) { PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData; const char *pszSymbol = pchSymbol; #if K_OS == K_OS_OS2 APIRET rc; PFN pfn; #elif K_OS == K_OS_WINDOWS FARPROC pfn; #elif K_OS == K_OS_DARWIN void *pfn; #else # error "Port me" #endif /* make stack copy of the symbol if it isn't zero terminated. */ if (pszSymbol && pszSymbol[cchSymbol]) { char *pszCopy = kHlpAllocA(cchSymbol + 1); kHlpMemCopy(pszCopy, pchSymbol, cchSymbol); pszCopy[cchSymbol] = '\0'; pszSymbol = pszCopy; } #if K_OS == K_OS_OS2 if (!pchSymbol && iSymbol >= 0x10000) return KLDR_ERR_SYMBOL_NOT_FOUND; if (puValue) { rc = DosQueryProcAddr(pModNative->hmod, pszSymbol ? 0 : iSymbol, (PCSZ)pszSymbol, &pfn); if (rc) return rc == ERROR_PROC_NOT_FOUND ? KLDR_ERR_SYMBOL_NOT_FOUND : rc; *puValue = (KUPTR)pfn; } if (pfKind) { ULONG ulProcType; rc = DosQueryProcType(pModNative->hmod, pszSymbol ? 0 : iSymbol, (PCSZ)pszSymbol, &ulProcType); if (rc) { if (puValue) *puValue = 0; return rc == ERROR_PROC_NOT_FOUND ? KLDR_ERR_SYMBOL_NOT_FOUND : rc; } *pfKind = (ulProcType & PT_32BIT ? KLDRSYMKIND_32BIT : KLDRSYMKIND_16BIT) | KLDRSYMKIND_NO_TYPE; } #elif K_OS == K_OS_WINDOWS if (!pszSymbol && iSymbol >= 0x10000) return KLDR_ERR_SYMBOL_NOT_FOUND; pfn = GetProcAddress(pModNative->hmod, pszSymbol ? pszSymbol : (const char *)(KUPTR)iSymbol); if (puValue) *puValue = (KUPTR)pfn; if (pfKind) *pfKind = (pModNative->pNtHdrs->FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32) ? KLDRSYMKIND_32BIT : KLDRSYMKIND_16BIT) | KLDRSYMKIND_NO_TYPE; #elif K_OS == K_OS_DARWIN if (!pszSymbol && iSymbol != NIL_KLDRMOD_SYM_ORDINAL) return KLDR_ERR_SYMBOL_NOT_FOUND; pfn = dlsym(pModNative->pvMod, pszSymbol); if (!pfn) return KLDR_ERR_SYMBOL_NOT_FOUND; if (puValue) *puValue = (KUPTR)pfn; if (pfKind) *pfKind = (sizeof(KUPTR) == 4 ? KLDRSYMKIND_32BIT : KLDRSYMKIND_64BIT) | KLDRSYMKIND_NO_TYPE; #else # error "Port me" #endif return 0; } /** @copydoc kLdrModEnumSymbols */ static int kldrModNativeEnumSymbols(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser) { PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData; #if K_OS == K_OS_OS2 /** @todo implement export enumeration on OS/2. */ (void)pModNative; return ERROR_NOT_SUPPORTED; #elif K_OS == K_OS_WINDOWS || defined(__NT__) const KU32 *paFunctions; const IMAGE_EXPORT_DIRECTORY *pExpDir; const KU32 *paRVANames; const KU16 *paOrdinals; KU32 iFunction; KU32 cFunctions; KU32 cNames; int rc; /* * Make sure we've got mapped bits and resolve any base address aliases. */ if ( pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size < sizeof(IMAGE_EXPORT_DIRECTORY)) return 0; /* no exports to enumerate, return success. */ pExpDir = KLDRMODNATIVE_RVA2TYPE(pModNative->hmod, pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress, PIMAGE_EXPORT_DIRECTORY); /* * Enumerate the ordinal exports. */ paRVANames = KLDRMODNATIVE_RVA2TYPE(pModNative->hmod, pExpDir->AddressOfNames, const KU32 *); paOrdinals = KLDRMODNATIVE_RVA2TYPE(pModNative->hmod, pExpDir->AddressOfNameOrdinals, const KU16 *); paFunctions = KLDRMODNATIVE_RVA2TYPE(pModNative->hmod, pExpDir->AddressOfFunctions, const KU32 *); cFunctions = pExpDir->NumberOfFunctions; cNames = pExpDir->NumberOfNames; for (iFunction = 0; iFunction < cFunctions; iFunction++) { unsigned fFoundName; KU32 iName; const KU32 uRVA = paFunctions[iFunction]; const KLDRADDR uValue = BaseAddress + uRVA; KU32 fKind = (pModNative->pNtHdrs->FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32) ? KLDRSYMKIND_32BIT : KLDRSYMKIND_64BIT) | KLDRSYMKIND_NO_TYPE; if ( uRVA - pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress < pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size) fKind |= KLDRSYMKIND_FORWARDER; /* * Any symbol names? */ fFoundName = 0; for (iName = 0; iName < cNames; iName++) { const char *pszName; if (paOrdinals[iName] != iFunction) continue; fFoundName = 1; pszName = KLDRMODNATIVE_RVA2TYPE(pModNative->hmod, paRVANames[iName], const char *); rc = pfnCallback(pMod, iFunction + pExpDir->Base, pszName, strlen(pszName), NULL, uValue, fKind, pvUser); if (rc) return rc; } /* * If no names, call once with the ordinal only. */ if (!fFoundName) { rc = pfnCallback(pMod, iFunction + pExpDir->Base, NULL, 0, NULL, uValue, fKind, pvUser); if (rc) return rc; } } return 0; #elif K_OS == K_OS_DARWIN /** @todo implement enumeration on darwin. */ (void)pModNative; return KLDR_ERR_TODO; #else # error "Port me" #endif } /** @copydoc kLdrModGetImport */ static int kldrModNativeGetImport(PKLDRMOD pMod, const void *pvBits, KU32 iImport, char *pszName, KSIZE cchName) { PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData; #if K_OS == K_OS_OS2 /** @todo implement import enumeration on OS/2. */ (void)pModNative; return ERROR_NOT_SUPPORTED; #elif K_OS == K_OS_WINDOWS || defined(__NT__) const IMAGE_IMPORT_DESCRIPTOR *pImpDesc; const char *pszImportName; KSIZE cchImportName; int rc; /* * Simple bounds check. */ if (iImport >= (KU32)kldrModNativeNumberOfImports(pMod, pvBits)) return KLDR_ERR_IMPORT_ORDINAL_OUT_OF_BOUNDS; /* * Get the name. */ pImpDesc = KLDRMODNATIVE_RVA2TYPE(pModNative->hmod, pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress + sizeof(IMAGE_IMPORT_DESCRIPTOR) * iImport, const IMAGE_IMPORT_DESCRIPTOR *); pszImportName = KLDRMODNATIVE_RVA2TYPE(pModNative->hmod, pImpDesc->Name, const char *); cchImportName = kHlpStrLen(pszImportName); if (cchImportName < cchName) { kHlpMemCopy(pszName, pszImportName, cchImportName + 1); rc = 0; } else { kHlpMemCopy(pszName, pszImportName, cchName); if (cchName) pszName[cchName - 1] = '\0'; rc = KERR_BUFFER_OVERFLOW; } return rc; #elif K_OS == K_OS_DARWIN /** @todo Implement import enumeration on darwin. */ (void)pModNative; return KLDR_ERR_TODO; #else # error "Port me" #endif } /** @copydoc kLdrModNumberOfImports */ static KI32 kldrModNativeNumberOfImports(PKLDRMOD pMod, const void *pvBits) { PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData; #if K_OS == K_OS_OS2 /** @todo implement import counting on OS/2. */ (void)pModNative; return -1; #elif K_OS == K_OS_WINDOWS || defined(__NT__) if (pModNative->cImportModules == ~(KU32)0) { /* * We'll have to walk the import descriptors to figure out their number. */ pModNative->cImportModules = 0; if ( pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size && pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress) { const IMAGE_IMPORT_DESCRIPTOR *pImpDesc; pImpDesc = KLDRMODNATIVE_RVA2TYPE(pModNative->hmod, pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress, const IMAGE_IMPORT_DESCRIPTOR *); while (pImpDesc->Name && pImpDesc->FirstThunk) { pModNative->cImportModules++; pImpDesc++; } } } return pModNative->cImportModules; #elif K_OS == K_OS_DARWIN /** @todo Implement import counting on Darwin. */ (void)pModNative; return -1; #else # error "Port me" #endif } /** @copydoc kLdrModGetStackInfo */ static int kldrModNativeGetStackInfo(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRSTACKINFO pStackInfo) { PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData; #if K_OS == K_OS_OS2 /** @todo implement stack info on OS/2. */ (void)pModNative; return ERROR_NOT_SUPPORTED; #elif K_OS == K_OS_WINDOWS || defined(__NT__) pStackInfo->Address = NIL_KLDRADDR; pStackInfo->LinkAddress = NIL_KLDRADDR; pStackInfo->cbStack = pStackInfo->cbStackThread = pModNative->pNtHdrs->OptionalHeader.SizeOfStackReserve; return 0; #elif K_OS == K_OS_DARWIN /** @todo Implement stack info on Darwin. */ (void)pModNative; return KLDR_ERR_TODO; #else # error "Port me" #endif } /** @copydoc kLdrModQueryMainEntrypoint */ static int kldrModNativeQueryMainEntrypoint(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRADDR pMainEPAddress) { PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData; #if K_OS == K_OS_OS2 /** @todo implement me on OS/2. */ (void)pModNative; return ERROR_NOT_SUPPORTED; #elif K_OS == K_OS_WINDOWS || defined(__NT__) /* * Convert the address from the header. */ *pMainEPAddress = pModNative->pNtHdrs->OptionalHeader.AddressOfEntryPoint ? BaseAddress + pModNative->pNtHdrs->OptionalHeader.AddressOfEntryPoint : NIL_KLDRADDR; return 0; #elif K_OS == K_OS_DARWIN /** @todo Implement me on Darwin. */ (void)pModNative; return KLDR_ERR_TODO; #else # error "Port me" #endif } /** @copydoc kLdrModEnumDbgInfo */ static int kldrModNativeEnumDbgInfo(PKLDRMOD pMod, const void *pvBits, PFNKLDRENUMDBG pfnCallback, void *pvUser) { PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData; #if K_OS == K_OS_OS2 /** @todo implement me on OS/2. */ (void)pModNative; return ERROR_NOT_SUPPORTED; #elif K_OS == K_OS_WINDOWS || defined(__NT__) const IMAGE_DEBUG_DIRECTORY *pDbgDir; KU32 iDbgInfo; KU32 cb; int rc; /* * Check that there is a debug directory first. */ cb = pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size; if ( cb < sizeof(IMAGE_DEBUG_DIRECTORY) /* screw borland linkers */ || !pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress) return 0; /* * Enumerate the debug directory. */ pDbgDir = KLDRMODNATIVE_RVA2TYPE(pModNative->hmod, pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress, const IMAGE_DEBUG_DIRECTORY *); for (iDbgInfo = 0;; iDbgInfo++, pDbgDir++, cb -= sizeof(IMAGE_DEBUG_DIRECTORY)) { KLDRDBGINFOTYPE enmDbgInfoType; /* convert the type. */ switch (pDbgDir->Type) { case IMAGE_DEBUG_TYPE_UNKNOWN: case IMAGE_DEBUG_TYPE_FPO: case IMAGE_DEBUG_TYPE_COFF: /*stabs dialect??*/ case IMAGE_DEBUG_TYPE_MISC: case IMAGE_DEBUG_TYPE_EXCEPTION: case IMAGE_DEBUG_TYPE_FIXUP: case IMAGE_DEBUG_TYPE_BORLAND: default: enmDbgInfoType = KLDRDBGINFOTYPE_UNKNOWN; break; case IMAGE_DEBUG_TYPE_CODEVIEW: enmDbgInfoType = KLDRDBGINFOTYPE_CODEVIEW; break; } rc = pfnCallback(pMod, iDbgInfo, enmDbgInfoType, pDbgDir->MajorVersion, pDbgDir->MinorVersion, NULL /*pszPartNm*/, pDbgDir->PointerToRawData ? pDbgDir->PointerToRawData : -1, pDbgDir->AddressOfRawData ? pDbgDir->AddressOfRawData : NIL_KLDRADDR, pDbgDir->SizeOfData, NULL /*pszExtFile*/, pvUser); if (rc) break; /* next */ if (cb <= sizeof(IMAGE_DEBUG_DIRECTORY)) break; } return rc; #elif K_OS == K_OS_DARWIN /** @todo Implement me on Darwin. */ (void)pModNative; return KLDR_ERR_TODO; #else # error "Port me" #endif } /** @copydoc kLdrModHasDbgInfo */ static int kldrModNativeHasDbgInfo(PKLDRMOD pMod, const void *pvBits) { PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData; #if K_OS == K_OS_OS2 /** @todo implement me on OS/2. */ (void)pModNative; return KLDR_ERR_NO_DEBUG_INFO; #elif K_OS == K_OS_WINDOWS || defined(__NT__) /* * Base this entirely on the presence of a debug directory. */ if ( pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size < sizeof(IMAGE_DEBUG_DIRECTORY) /* screw borland linkers */ || !pModNative->pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress) return KLDR_ERR_NO_DEBUG_INFO; return 0; #elif K_OS == K_OS_DARWIN /** @todo Implement me on Darwin. */ (void)pModNative; return KLDR_ERR_NO_DEBUG_INFO; #else # error "Port me" #endif } /** @copydoc kLdrModMap */ static int kldrModNativeMap(PKLDRMOD pMod) { return 0; } /** @copydoc kLdrModUnmap */ static int kldrModNativeUnmap(PKLDRMOD pMod) { return 0; } /** @copydoc kLdrModAllocTLS */ static int kldrModNativeAllocTLS(PKLDRMOD pMod, void *pvMapping) { return 0; } /** @copydoc kLdrModFreeTLS */ static void kldrModNativeFreeTLS(PKLDRMOD pMod, void *pvMapping) { } /** @copydoc kLdrModReload */ static int kldrModNativeReload(PKLDRMOD pMod) { return 0; } /** @copydoc kLdrModFixupMapping */ static int kldrModNativeFixupMapping(PKLDRMOD pMod, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { return 0; } #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS || defined(__NT__) /** Common worker on platforms where there is one entrypoint which does both. */ static int kLdrModNativeCallInitTerm(PKLDRMODNATIVE pModNative, KUPTR uHandle, KBOOL fInit) { # if K_OS == K_OS_WINDOWS || defined(__NT__) /* No TLS init/term for now. */ KU32 const uRvaEntrypoint = pModNative->pNtHdrs->OptionalHeader.AddressOfEntryPoint; if ( uRvaEntrypoint != 0 && uRvaEntrypoint < pModNative->pNtHdrs->OptionalHeader.SizeOfCode && (pModNative->pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_DLL)) { KI32 rc = kldrModPEDoCall(uRvaEntrypoint + (KUPTR)pModNative->hmod, uHandle, fInit ? DLL_PROCESS_ATTACH : DLL_PROCESS_DETACH, NULL /*pvReserved*/); if (rc) return 0; return fInit ? KLDR_ERR_MODULE_INIT_FAILED : KLDR_ERR_THREAD_ATTACH_FAILED; } # elif K_OS == K_OS_OS2 //KI32 kldrModLXDoCall(KUPTR uEntrypoint, KUPTR uHandle, KU32 uOp, void *pvReserved) # endif return 0; } #endif /** @copydoc kLdrModCallInit */ static int kldrModNativeCallInit(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle) { #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS || defined(__NT__) if (pMod->fFlags & KLDRMOD_OPEN_FLAGS_NATIVE_ALLOW_INIT_TERM) return kLdrModNativeCallInitTerm((PKLDRMODNATIVE)pMod->pvData, uHandle, K_TRUE /*fInit*/); #endif return 0; } /** @copydoc kLdrModCallTerm */ static int kldrModNativeCallTerm(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle) { #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS || defined(__NT__) if (pMod->fFlags & KLDRMOD_OPEN_FLAGS_NATIVE_ALLOW_INIT_TERM) return kLdrModNativeCallInitTerm((PKLDRMODNATIVE)pMod->pvData, uHandle, K_FALSE /*fInit*/); #endif return 0; } /** @copydoc kLdrModCallThread */ static int kldrModNativeCallThread(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle, unsigned fAttachingOrDetaching) { return 0; } /** @copydoc kLdrModSize */ static KLDRADDR kldrModNativeSize(PKLDRMOD pMod) { #if K_OS == K_OS_OS2 return 0; /* don't bother */ #elif K_OS == K_OS_WINDOWS || defined(__NT__) /* just because we can. */ PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData; return pModNative->pNtHdrs->OptionalHeader.SizeOfImage; #elif K_OS == K_OS_DARWIN /** @todo Implement me on Darwin. */ return 0; #else # error "Port me" #endif } /** @copydoc kLdrModGetBits */ static int kldrModNativeGetBits(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { #if K_OS == K_OS_OS2 return ERROR_NOT_SUPPORTED; /* don't bother */ #elif K_OS == K_OS_WINDOWS || defined(__NT__) return ERROR_NOT_SUPPORTED; /* don't bother even if we could implement this. */ #elif K_OS == K_OS_DARWIN return KLDR_ERR_TODO; /* don't bother. */ #else # error "Port me" #endif } /** @copydoc kLdrModRelocateBits */ static int kldrModNativeRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { #if K_OS == K_OS_OS2 return ERROR_NOT_SUPPORTED; /* don't bother */ #elif K_OS == K_OS_WINDOWS || defined(__NT__) return ERROR_NOT_SUPPORTED; /* don't bother even if we could implement this. */ #elif K_OS == K_OS_DARWIN return KLDR_ERR_TODO; /* don't bother. */ #else # error "Port me" #endif } /** * The native module interpreter method table. */ KLDRMODOPS g_kLdrModNativeOps = { "Native", NULL, kldrModNativeCreate, kldrModNativeDestroy, kldrModNativeQuerySymbol, kldrModNativeEnumSymbols, kldrModNativeGetImport, kldrModNativeNumberOfImports, NULL /* can execute one is optional */, kldrModNativeGetStackInfo, kldrModNativeQueryMainEntrypoint, NULL /* pfnQueryImageUuid */, NULL /* fixme */, NULL /* fixme */, kldrModNativeEnumDbgInfo, kldrModNativeHasDbgInfo, kldrModNativeMap, kldrModNativeUnmap, kldrModNativeAllocTLS, kldrModNativeFreeTLS, kldrModNativeReload, kldrModNativeFixupMapping, kldrModNativeCallInit, kldrModNativeCallTerm, kldrModNativeCallThread, kldrModNativeSize, kldrModNativeGetBits, kldrModNativeRelocateBits, NULL /* fixme */, 42 /* the end */ }; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrModLX.c���������������������������������������������������������0000664�0001750�0001750�00000260436�14670377513�020375� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrModLX.c 117 2020-03-15 15:23:36Z bird $ */ /** @file * kLdr - The Module Interpreter for the Linear eXecutable (LX) Format. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include "kLdrInternal.h" #include <k/kLdrFmts/lx.h> /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def KLDRMODLX_STRICT * Define KLDRMODLX_STRICT to enabled strict checks in KLDRMODLX. */ #define KLDRMODLX_STRICT 1 /** @def KLDRMODLX_ASSERT * Assert that an expression is true when KLDR_STRICT is defined. */ #ifdef KLDRMODLX_STRICT # define KLDRMODLX_ASSERT(expr) kHlpAssert(expr) #else # define KLDRMODLX_ASSERT(expr) do {} while (0) #endif /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Instance data for the LX module interpreter. */ typedef struct KLDRMODLX { /** Pointer to the module. (Follows the section table.) */ PKLDRMOD pMod; /** Pointer to the user mapping. */ const void *pvMapping; /** The size of the mapped LX image. */ KSIZE cbMapped; /** Reserved flags. */ KU32 f32Reserved; /** The offset of the LX header. */ KLDRFOFF offHdr; /** Copy of the LX header. */ struct e32_exe Hdr; /** Pointer to the loader section. * Allocated together with this strcture. */ const KU8 *pbLoaderSection; /** Pointer to the last byte in the loader section. */ const KU8 *pbLoaderSectionLast; /** Pointer to the object table in the loader section. */ const struct o32_obj *paObjs; /** Pointer to the object page map table in the loader section. */ const struct o32_map *paPageMappings; /** Pointer to the resource table in the loader section. */ const struct rsrc32 *paRsrcs; /** Pointer to the resident name table in the loader section. */ const KU8 *pbResNameTab; /** Pointer to the entry table in the loader section. */ const KU8 *pbEntryTab; /** Pointer to the non-resident name table. */ KU8 *pbNonResNameTab; /** Pointer to the last byte in the non-resident name table. */ const KU8 *pbNonResNameTabLast; /** Pointer to the fixup section. */ KU8 *pbFixupSection; /** Pointer to the last byte in the fixup section. */ const KU8 *pbFixupSectionLast; /** Pointer to the fixup page table within pvFixupSection. */ const KU32 *paoffPageFixups; /** Pointer to the fixup record table within pvFixupSection. */ const KU8 *pbFixupRecs; /** Pointer to the import module name table within pvFixupSection. */ const KU8 *pbImportMods; /** Pointer to the import module name table within pvFixupSection. */ const KU8 *pbImportProcs; } KLDRMODLX, *PKLDRMODLX; /******************************************************************************* * Internal Functions * *******************************************************************************/ static int kldrModLXHasDbgInfo(PKLDRMOD pMod, const void *pvBits); static int kldrModLXRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); static int kldrModLXDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODLX *ppModLX); static const KU8 *kldrModLXDoNameTableLookupByOrdinal(const KU8 *pbNameTable, KSSIZE cbNameTable, KU32 iOrdinal); static int kldrModLXDoNameLookup(PKLDRMODLX pModLX, const char *pchSymbol, KSIZE cchSymbol, KU32 *piSymbol); static const KU8 *kldrModLXDoNameTableLookupByName(const KU8 *pbNameTable, KSSIZE cbNameTable, const char *pchSymbol, KSIZE cchSymbol); static int kldrModLXDoLoadBits(PKLDRMODLX pModLX, void *pvBits); static int kldrModLXDoIterDataUnpacking(KU8 *pbDst, const KU8 *pbSrc, int cbSrc); static int kldrModLXDoIterData2Unpacking(KU8 *pbDst, const KU8 *pbSrc, int cbSrc); static void kLdrModLXMemCopyW(KU8 *pbDst, const KU8 *pbSrc, int cb); static int kldrModLXDoProtect(PKLDRMODLX pModLX, void *pvBits, unsigned fUnprotectOrProtect); static int kldrModLXDoCallDLL(PKLDRMODLX pModLX, void *pvMapping, unsigned uOp, KUPTR uHandle); static int kldrModLXDoForwarderQuery(PKLDRMODLX pModLX, const struct e32_entry *pEntry, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind); static int kldrModLXDoLoadFixupSection(PKLDRMODLX pModLX); static int kldrModLXDoReloc(KU8 *pbPage, int off, KLDRADDR PageAddress, const struct r32_rlc *prlc, int iSelector, KLDRADDR uValue, KU32 fKind); /** * Create a loader module instance interpreting the executable image found * in the specified file provider instance. * * @returns 0 on success and *ppMod pointing to a module instance. * On failure, a non-zero OS specific error code is returned. * @param pOps Pointer to the registered method table. * @param pRdr The file provider instance to use. * @param fFlags Flags, MBZ. * @param enmCpuArch The desired CPU architecture. KCPUARCH_UNKNOWN means * anything goes, but with a preference for the current * host architecture. * @param offNewHdr The offset of the new header in MZ files. -1 if not found. * @param ppMod Where to store the module instance pointer. */ static int kldrModLXCreate(PCKLDRMODOPS pOps, PKRDR pRdr, KU32 fFlags, KCPUARCH enmCpuArch, KLDRFOFF offNewHdr, PPKLDRMOD ppMod) { PKLDRMODLX pModLX; int rc; K_NOREF(fFlags); /* * Create the instance data and do a minimal header validation. */ rc = kldrModLXDoCreate(pRdr, offNewHdr, &pModLX); if (!rc) { /* * Match up against the requested CPU architecture. */ if ( enmCpuArch == KCPUARCH_UNKNOWN || pModLX->pMod->enmArch == enmCpuArch) { pModLX->pMod->pOps = pOps; pModLX->pMod->u32Magic = KLDRMOD_MAGIC; *ppMod = pModLX->pMod; return 0; } rc = KLDR_ERR_CPU_ARCH_MISMATCH; } kHlpFree(pModLX); return rc; } /** * Separate function for reading creating the LX module instance to * simplify cleanup on failure. */ static int kldrModLXDoCreate(PKRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODLX *ppModLX) { struct e32_exe Hdr; PKLDRMODLX pModLX; PKLDRMOD pMod; KSIZE cb; KSIZE cchFilename; KSIZE offLdrStuff; KU32 off, offEnd; KU32 i; int rc; int fCanOptimizeMapping; KU32 NextRVA; *ppModLX = NULL; /* * Read the signature and file header. */ rc = kRdrRead(pRdr, &Hdr, sizeof(Hdr), offNewHdr > 0 ? offNewHdr : 0); if (rc) return rc; if ( Hdr.e32_magic[0] != E32MAGIC1 || Hdr.e32_magic[1] != E32MAGIC2) return KLDR_ERR_UNKNOWN_FORMAT; /* We're not interested in anything but x86 images. */ if ( Hdr.e32_level != E32LEVEL || Hdr.e32_border != E32LEBO || Hdr.e32_worder != E32LEWO || Hdr.e32_cpu < E32CPU286 || Hdr.e32_cpu > E32CPU486 || Hdr.e32_pagesize != OBJPAGELEN ) return KLDR_ERR_LX_BAD_HEADER; /* Some rough sanity checks. */ offEnd = kRdrSize(pRdr) >= (KLDRFOFF)~(KU32)16 ? ~(KU32)16 : (KU32)kRdrSize(pRdr); if ( Hdr.e32_itermap > offEnd || Hdr.e32_datapage > offEnd || Hdr.e32_nrestab > offEnd || Hdr.e32_nrestab + Hdr.e32_cbnrestab > offEnd || Hdr.e32_ldrsize > offEnd - offNewHdr - sizeof(Hdr) || Hdr.e32_fixupsize > offEnd - offNewHdr - sizeof(Hdr) || Hdr.e32_fixupsize + Hdr.e32_ldrsize > offEnd - offNewHdr - sizeof(Hdr)) return KLDR_ERR_LX_BAD_HEADER; /* Verify the loader section. */ offEnd = Hdr.e32_objtab + Hdr.e32_ldrsize; if (Hdr.e32_objtab < sizeof(Hdr)) return KLDR_ERR_LX_BAD_LOADER_SECTION; off = Hdr.e32_objtab + sizeof(struct o32_obj) * Hdr.e32_objcnt; if (off > offEnd) return KLDR_ERR_LX_BAD_LOADER_SECTION; if ( Hdr.e32_objmap && (Hdr.e32_objmap < off || Hdr.e32_objmap > offEnd)) return KLDR_ERR_LX_BAD_LOADER_SECTION; if ( Hdr.e32_rsrccnt && ( Hdr.e32_rsrctab < off || Hdr.e32_rsrctab > offEnd || Hdr.e32_rsrctab + sizeof(struct rsrc32) * Hdr.e32_rsrccnt > offEnd)) return KLDR_ERR_LX_BAD_LOADER_SECTION; if ( Hdr.e32_restab && (Hdr.e32_restab < off || Hdr.e32_restab > offEnd - 2)) return KLDR_ERR_LX_BAD_LOADER_SECTION; if ( Hdr.e32_enttab && (Hdr.e32_enttab < off || Hdr.e32_enttab >= offEnd)) return KLDR_ERR_LX_BAD_LOADER_SECTION; if ( Hdr.e32_dircnt && (Hdr.e32_dirtab < off || Hdr.e32_dirtab > offEnd - 2)) return KLDR_ERR_LX_BAD_LOADER_SECTION; /* Verify the fixup section. */ off = offEnd; offEnd = off + Hdr.e32_fixupsize; if ( Hdr.e32_fpagetab && (Hdr.e32_fpagetab < off || Hdr.e32_fpagetab > offEnd)) { /* * wlink mixes the fixup section and the loader section. */ off = Hdr.e32_fpagetab; offEnd = off + Hdr.e32_fixupsize; Hdr.e32_ldrsize = off - Hdr.e32_objtab; } if ( Hdr.e32_frectab && (Hdr.e32_frectab < off || Hdr.e32_frectab > offEnd)) return KLDR_ERR_LX_BAD_FIXUP_SECTION; if ( Hdr.e32_impmod && (Hdr.e32_impmod < off || Hdr.e32_impmod > offEnd || Hdr.e32_impmod + Hdr.e32_impmodcnt > offEnd)) return KLDR_ERR_LX_BAD_FIXUP_SECTION; if ( Hdr.e32_impproc && (Hdr.e32_impproc < off || Hdr.e32_impproc > offEnd)) return KLDR_ERR_LX_BAD_FIXUP_SECTION; /* * Calc the instance size, allocate and initialize it. */ cchFilename = kHlpStrLen(kRdrName(pRdr)); cb = K_ALIGN_Z(sizeof(KLDRMODLX), 8) + K_ALIGN_Z(K_OFFSETOF(KLDRMOD, aSegments[Hdr.e32_objcnt + 1]), 8) + K_ALIGN_Z(cchFilename + 1, 8); offLdrStuff = cb; cb += Hdr.e32_ldrsize + 2; /* +2 for two extra zeros. */ pModLX = (PKLDRMODLX)kHlpAlloc(cb); if (!pModLX) return KERR_NO_MEMORY; *ppModLX = pModLX; /* KLDRMOD */ pMod = (PKLDRMOD)((KU8 *)pModLX + K_ALIGN_Z(sizeof(KLDRMODLX), 8)); pMod->pvData = pModLX; pMod->pRdr = pRdr; pMod->pOps = NULL; /* set upon success. */ pMod->cSegments = Hdr.e32_objcnt; pMod->cchFilename = (KU32)cchFilename; pMod->pszFilename = (char *)K_ALIGN_P(&pMod->aSegments[pMod->cSegments], 8); kHlpMemCopy((char *)pMod->pszFilename, kRdrName(pRdr), cchFilename + 1); pMod->pszName = NULL; /* finalized further down */ pMod->cchName = 0; pMod->fFlags = 0; switch (Hdr.e32_cpu) { case E32CPU286: pMod->enmCpu = KCPU_I80286; pMod->enmArch = KCPUARCH_X86_16; break; case E32CPU386: pMod->enmCpu = KCPU_I386; pMod->enmArch = KCPUARCH_X86_32; break; case E32CPU486: pMod->enmCpu = KCPU_I486; pMod->enmArch = KCPUARCH_X86_32; break; } pMod->enmEndian = KLDRENDIAN_LITTLE; pMod->enmFmt = KLDRFMT_LX; switch (Hdr.e32_mflags & E32MODMASK) { case E32MODEXE: pMod->enmType = !(Hdr.e32_mflags & E32NOINTFIX) ? KLDRTYPE_EXECUTABLE_RELOCATABLE : KLDRTYPE_EXECUTABLE_FIXED; break; case E32MODDLL: case E32PROTDLL: case E32MODPROTDLL: pMod->enmType = !(Hdr.e32_mflags & E32SYSDLL) ? KLDRTYPE_SHARED_LIBRARY_RELOCATABLE : KLDRTYPE_SHARED_LIBRARY_FIXED; break; case E32MODPDEV: case E32MODVDEV: pMod->enmType = KLDRTYPE_SHARED_LIBRARY_RELOCATABLE; break; } pMod->u32Magic = 0; /* set upon success. */ /* KLDRMODLX */ pModLX->pMod = pMod; pModLX->pvMapping = 0; pModLX->cbMapped = 0; pModLX->f32Reserved = 0; pModLX->offHdr = offNewHdr >= 0 ? offNewHdr : 0; kHlpMemCopy(&pModLX->Hdr, &Hdr, sizeof(Hdr)); pModLX->pbLoaderSection = (KU8 *)pModLX + offLdrStuff; pModLX->pbLoaderSectionLast = pModLX->pbLoaderSection + pModLX->Hdr.e32_ldrsize - 1; pModLX->paObjs = NULL; pModLX->paPageMappings = NULL; pModLX->paRsrcs = NULL; pModLX->pbResNameTab = NULL; pModLX->pbEntryTab = NULL; pModLX->pbNonResNameTab = NULL; pModLX->pbNonResNameTabLast = NULL; pModLX->pbFixupSection = NULL; pModLX->pbFixupSectionLast = NULL; pModLX->paoffPageFixups = NULL; pModLX->pbFixupRecs = NULL; pModLX->pbImportMods = NULL; pModLX->pbImportProcs = NULL; /* * Read the loader data. */ rc = kRdrRead(pRdr, (void *)pModLX->pbLoaderSection, pModLX->Hdr.e32_ldrsize, pModLX->Hdr.e32_objtab + pModLX->offHdr); if (rc) return rc; ((KU8 *)pModLX->pbLoaderSectionLast)[1] = 0; ((KU8 *)pModLX->pbLoaderSectionLast)[2] = 0; if (pModLX->Hdr.e32_objcnt) pModLX->paObjs = (const struct o32_obj *)pModLX->pbLoaderSection; if (pModLX->Hdr.e32_objmap) pModLX->paPageMappings = (const struct o32_map *)(pModLX->pbLoaderSection + pModLX->Hdr.e32_objmap - pModLX->Hdr.e32_objtab); if (pModLX->Hdr.e32_rsrccnt) pModLX->paRsrcs = (const struct rsrc32 *)(pModLX->pbLoaderSection + pModLX->Hdr.e32_rsrctab - pModLX->Hdr.e32_objtab); if (pModLX->Hdr.e32_restab) pModLX->pbResNameTab = pModLX->pbLoaderSection + pModLX->Hdr.e32_restab - pModLX->Hdr.e32_objtab; if (pModLX->Hdr.e32_enttab) pModLX->pbEntryTab = pModLX->pbLoaderSection + pModLX->Hdr.e32_enttab - pModLX->Hdr.e32_objtab; /* * Get the soname from the resident name table. * Very convenient that it's the 0 ordinal, because then we get a * free string terminator. * (The table entry consists of a pascal string followed by a 16-bit ordinal.) */ if (pModLX->pbResNameTab) pMod->pszName = (const char *)kldrModLXDoNameTableLookupByOrdinal(pModLX->pbResNameTab, pModLX->pbLoaderSectionLast - pModLX->pbResNameTab + 1, 0); if (!pMod->pszName) return KLDR_ERR_LX_NO_SONAME; pMod->cchName = *(const KU8 *)pMod->pszName++; if (pMod->cchName != kHlpStrLen(pMod->pszName)) return KLDR_ERR_LX_BAD_SONAME; /* * Quick validation of the object table. */ cb = 0; for (i = 0; i < pMod->cSegments; i++) { if (pModLX->paObjs[i].o32_base & (OBJPAGELEN - 1)) return KLDR_ERR_LX_BAD_OBJECT_TABLE; if (pModLX->paObjs[i].o32_base + pModLX->paObjs[i].o32_size <= pModLX->paObjs[i].o32_base) return KLDR_ERR_LX_BAD_OBJECT_TABLE; if (pModLX->paObjs[i].o32_mapsize > (pModLX->paObjs[i].o32_size + (OBJPAGELEN - 1))) return KLDR_ERR_LX_BAD_OBJECT_TABLE; if ( pModLX->paObjs[i].o32_mapsize && ( (KU8 *)&pModLX->paPageMappings[pModLX->paObjs[i].o32_pagemap] > pModLX->pbLoaderSectionLast || (KU8 *)&pModLX->paPageMappings[pModLX->paObjs[i].o32_pagemap + pModLX->paObjs[i].o32_mapsize] > pModLX->pbLoaderSectionLast)) return KLDR_ERR_LX_BAD_OBJECT_TABLE; if (i > 0 && !(pModLX->paObjs[i].o32_flags & OBJRSRC)) { if (pModLX->paObjs[i].o32_base <= pModLX->paObjs[i - 1].o32_base) return KLDR_ERR_LX_BAD_OBJECT_TABLE; if (pModLX->paObjs[i].o32_base < pModLX->paObjs[i - 1].o32_base + pModLX->paObjs[i - 1].o32_mapsize) return KLDR_ERR_LX_BAD_OBJECT_TABLE; } } /* * Check if we can optimize the mapping by using a different * object alignment. The linker typically uses 64KB alignment, * we can easily get away with page alignment in most cases. */ fCanOptimizeMapping = !(Hdr.e32_mflags & (E32NOINTFIX | E32SYSDLL)); NextRVA = 0; /* * Setup the KLDRMOD segment array. */ for (i = 0; i < pMod->cSegments; i++) { /* unused */ pMod->aSegments[i].pvUser = NULL; pMod->aSegments[i].MapAddress = 0; pMod->aSegments[i].pchName = NULL; pMod->aSegments[i].cchName = 0; pMod->aSegments[i].offFile = -1; pMod->aSegments[i].cbFile = -1; pMod->aSegments[i].SelFlat = 0; pMod->aSegments[i].Sel16bit = 0; /* flags */ pMod->aSegments[i].fFlags = 0; if (pModLX->paObjs[i].o32_flags & OBJBIGDEF) pMod->aSegments[i].fFlags = KLDRSEG_FLAG_16BIT; if (pModLX->paObjs[i].o32_flags & OBJALIAS16) pMod->aSegments[i].fFlags = KLDRSEG_FLAG_OS2_ALIAS16; if (pModLX->paObjs[i].o32_flags & OBJCONFORM) pMod->aSegments[i].fFlags = KLDRSEG_FLAG_OS2_CONFORM; if (pModLX->paObjs[i].o32_flags & OBJIOPL) pMod->aSegments[i].fFlags = KLDRSEG_FLAG_OS2_IOPL; /* size and addresses */ pMod->aSegments[i].Alignment = OBJPAGELEN; pMod->aSegments[i].cb = pModLX->paObjs[i].o32_size; pMod->aSegments[i].LinkAddress = pModLX->paObjs[i].o32_base; pMod->aSegments[i].RVA = NextRVA; if ( fCanOptimizeMapping || i + 1 >= pMod->cSegments || (pModLX->paObjs[i].o32_flags & OBJRSRC) || (pModLX->paObjs[i + 1].o32_flags & OBJRSRC)) pMod->aSegments[i].cbMapped = K_ALIGN_Z(pModLX->paObjs[i].o32_size, OBJPAGELEN); else pMod->aSegments[i].cbMapped = pModLX->paObjs[i + 1].o32_base - pModLX->paObjs[i].o32_base; NextRVA += (KU32)pMod->aSegments[i].cbMapped; /* protection */ switch ( pModLX->paObjs[i].o32_flags & (OBJSHARED | OBJREAD | OBJWRITE | OBJEXEC)) { case 0: case OBJSHARED: pMod->aSegments[i].enmProt = KPROT_NOACCESS; break; case OBJREAD: case OBJREAD | OBJSHARED: pMod->aSegments[i].enmProt = KPROT_READONLY; break; case OBJWRITE: case OBJWRITE | OBJREAD: pMod->aSegments[i].enmProt = KPROT_WRITECOPY; break; case OBJWRITE | OBJSHARED: case OBJWRITE | OBJSHARED | OBJREAD: pMod->aSegments[i].enmProt = KPROT_READWRITE; break; case OBJEXEC: case OBJEXEC | OBJSHARED: pMod->aSegments[i].enmProt = KPROT_EXECUTE; break; case OBJEXEC | OBJREAD: case OBJEXEC | OBJREAD | OBJSHARED: pMod->aSegments[i].enmProt = KPROT_EXECUTE_READ; break; case OBJEXEC | OBJWRITE: case OBJEXEC | OBJWRITE | OBJREAD: pMod->aSegments[i].enmProt = KPROT_EXECUTE_WRITECOPY; break; case OBJEXEC | OBJWRITE | OBJSHARED: case OBJEXEC | OBJWRITE | OBJSHARED | OBJREAD: pMod->aSegments[i].enmProt = KPROT_EXECUTE_READWRITE; break; } if ((pModLX->paObjs[i].o32_flags & (OBJREAD | OBJWRITE | OBJEXEC | OBJRSRC)) == OBJRSRC) pMod->aSegments[i].enmProt = KPROT_READONLY; /*pMod->aSegments[i].f16bit = !(pModLX->paObjs[i].o32_flags & OBJBIGDEF) pMod->aSegments[i].fIOPL = !(pModLX->paObjs[i].o32_flags & OBJIOPL) pMod->aSegments[i].fConforming = !(pModLX->paObjs[i].o32_flags & OBJCONFORM) */ } /* set the mapping size */ pModLX->cbMapped = NextRVA; /* * We're done. */ *ppModLX = pModLX; return 0; } /** @copydoc KLDRMODOPS::pfnDestroy */ static int kldrModLXDestroy(PKLDRMOD pMod) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; int rc = 0; KLDRMODLX_ASSERT(!pModLX->pvMapping); if (pMod->pRdr) { rc = kRdrClose(pMod->pRdr); pMod->pRdr = NULL; } if (pModLX->pbNonResNameTab) { kHlpFree(pModLX->pbNonResNameTab); pModLX->pbNonResNameTab = NULL; } if (pModLX->pbFixupSection) { kHlpFree(pModLX->pbFixupSection); pModLX->pbFixupSection = NULL; } pMod->u32Magic = 0; pMod->pOps = NULL; kHlpFree(pModLX); return rc; } /** * Resolved base address aliases. * * @param pModLX The interpreter module instance * @param pBaseAddress The base address, IN & OUT. */ static void kldrModLXResolveBaseAddress(PKLDRMODLX pModLX, PKLDRADDR pBaseAddress) { if (*pBaseAddress == KLDRMOD_BASEADDRESS_MAP) *pBaseAddress = pModLX->pMod->aSegments[0].MapAddress; else if (*pBaseAddress == KLDRMOD_BASEADDRESS_LINK) *pBaseAddress = pModLX->pMod->aSegments[0].LinkAddress; } /** @copydoc kLdrModQuerySymbol */ static int kldrModLXQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; KU32 iOrdinal; int rc; const struct b32_bundle *pBundle; K_NOREF(pvBits); K_NOREF(pszVersion); /* * Give up at once if there is no entry table. */ if (!pModLX->Hdr.e32_enttab) return KLDR_ERR_SYMBOL_NOT_FOUND; /* * Translate the symbol name into an ordinal. */ if (pchSymbol) { rc = kldrModLXDoNameLookup(pModLX, pchSymbol, cchSymbol, &iSymbol); if (rc) return rc; } /* * Iterate the entry table. * (The entry table is made up of bundles of similar exports.) */ iOrdinal = 1; pBundle = (const struct b32_bundle *)pModLX->pbEntryTab; while (pBundle->b32_cnt && iOrdinal <= iSymbol) { static const KSIZE s_cbEntry[] = { 0, 3, 5, 5, 7 }; /* * Check for a hit first. */ iOrdinal += pBundle->b32_cnt; if (iSymbol < iOrdinal) { KU32 offObject; const struct e32_entry *pEntry = (const struct e32_entry *)((KUPTR)(pBundle + 1) + (iSymbol - (iOrdinal - pBundle->b32_cnt)) * s_cbEntry[pBundle->b32_type]); /* * Calculate the return address. */ kldrModLXResolveBaseAddress(pModLX, &BaseAddress); switch (pBundle->b32_type) { /* empty bundles are place holders unused ordinal ranges. */ case EMPTY: return KLDR_ERR_SYMBOL_NOT_FOUND; /* e32_flags + a 16-bit offset. */ case ENTRY16: offObject = pEntry->e32_variant.e32_offset.offset16; if (pfKind) *pfKind = KLDRSYMKIND_16BIT | KLDRSYMKIND_NO_TYPE; break; /* e32_flags + a 16-bit offset + a 16-bit callgate selector. */ case GATE16: offObject = pEntry->e32_variant.e32_callgate.offset; if (pfKind) *pfKind = KLDRSYMKIND_16BIT | KLDRSYMKIND_CODE; break; /* e32_flags + a 32-bit offset. */ case ENTRY32: offObject = pEntry->e32_variant.e32_offset.offset32; if (pfKind) *pfKind = KLDRSYMKIND_32BIT; break; /* e32_flags + 16-bit import module ordinal + a 32-bit procname or ordinal. */ case ENTRYFWD: return kldrModLXDoForwarderQuery(pModLX, pEntry, pfnGetForwarder, pvUser, puValue, pfKind); default: /* anyone actually using TYPEINFO will end up here. */ KLDRMODLX_ASSERT(!"Bad bundle type"); return KLDR_ERR_LX_BAD_BUNDLE; } /* * Validate the object number and calc the return address. */ if ( pBundle->b32_obj <= 0 || pBundle->b32_obj > pMod->cSegments) return KLDR_ERR_LX_BAD_BUNDLE; if (puValue) *puValue = BaseAddress + offObject + pMod->aSegments[pBundle->b32_obj - 1].RVA; return 0; } /* * Skip the bundle. */ if (pBundle->b32_type > ENTRYFWD) { KLDRMODLX_ASSERT(!"Bad type"); /** @todo figure out TYPEINFO. */ return KLDR_ERR_LX_BAD_BUNDLE; } if (pBundle->b32_type == 0) pBundle = (const struct b32_bundle *)((const KU8 *)pBundle + 2); else pBundle = (const struct b32_bundle *)((const KU8 *)(pBundle + 1) + s_cbEntry[pBundle->b32_type] * pBundle->b32_cnt); } return KLDR_ERR_SYMBOL_NOT_FOUND; } /** * Do name lookup. * * @returns See kLdrModQuerySymbol. * @param pModLX The module to lookup the symbol in. * @param pchSymbol The symbol to lookup. * @param cchSymbol The symbol name length. * @param piSymbol Where to store the symbol ordinal. */ static int kldrModLXDoNameLookup(PKLDRMODLX pModLX, const char *pchSymbol, KSIZE cchSymbol, KU32 *piSymbol) { /* * First do a hash table lookup. */ /** @todo hash name table for speed. */ /* * Search the name tables. */ const KU8 *pbName = kldrModLXDoNameTableLookupByName(pModLX->pbResNameTab, pModLX->pbLoaderSectionLast - pModLX->pbResNameTab + 1, pchSymbol, cchSymbol); if (!pbName) { if (!pModLX->pbNonResNameTab) { /* lazy load it */ /** @todo non-resident name table. */ } if (pModLX->pbNonResNameTab) pbName = kldrModLXDoNameTableLookupByName(pModLX->pbResNameTab, pModLX->pbNonResNameTabLast - pModLX->pbResNameTab + 1, pchSymbol, cchSymbol); } if (!pbName) return KLDR_ERR_SYMBOL_NOT_FOUND; *piSymbol = *(const KU16 *)(pbName + 1 + *pbName); return 0; } #if 0 /** * Hash a symbol using the algorithm from sdbm. * * The following was is the documenation of the orignal sdbm functions: * * This algorithm was created for sdbm (a public-domain reimplementation of * ndbm) database library. it was found to do well in scrambling bits, * causing better distribution of the keys and fewer splits. it also happens * to be a good general hashing function with good distribution. the actual * function is hash(i) = hash(i - 1) * 65599 + str[i]; what is included below * is the faster version used in gawk. [there is even a faster, duff-device * version] the magic constant 65599 was picked out of thin air while * experimenting with different constants, and turns out to be a prime. * this is one of the algorithms used in berkeley db (see sleepycat) and * elsewhere. */ static KU32 kldrModLXDoHash(const char *pchSymbol, KU8 cchSymbol) { KU32 hash = 0; int ch; while ( cchSymbol-- > 0 && (ch = *(unsigned const char *)pchSymbol++)) hash = ch + (hash << 6) + (hash << 16) - hash; return hash; } #endif /** * Lookup a name table entry by name. * * @returns Pointer to the name table entry if found. * @returns NULL if not found. * @param pbNameTable Pointer to the name table that should be searched. * @param cbNameTable The size of the name table. * @param pchSymbol The name of the symbol we're looking for. * @param cchSymbol The length of the symbol name. */ static const KU8 *kldrModLXDoNameTableLookupByName(const KU8 *pbNameTable, KSSIZE cbNameTable, const char *pchSymbol, KSIZE cchSymbol) { /* * Determin the namelength up front so we can skip anything which doesn't matches the length. */ KU8 cbSymbol8Bit = (KU8)cchSymbol; if (cbSymbol8Bit != cchSymbol) return NULL; /* too long. */ /* * Walk the name table. */ while (*pbNameTable != 0 && cbNameTable > 0) { const KU8 cbName = *pbNameTable; cbNameTable -= cbName + 1 + 2; if (cbNameTable < 0) break; if ( cbName == cbSymbol8Bit && !kHlpMemComp(pbNameTable + 1, pchSymbol, cbName)) return pbNameTable; /* next entry */ pbNameTable += cbName + 1 + 2; } return NULL; } /** * Deal with a forwarder entry. * * @returns See kLdrModQuerySymbol. * @param pModLX The PE module interpreter instance. * @param pEntry The forwarder entry. * @param pfnGetForwarder The callback for resolving forwarder symbols. (optional) * @param pvUser The user argument for the callback. * @param puValue Where to put the value. (optional) * @param pfKind Where to put the symbol kind. (optional) */ static int kldrModLXDoForwarderQuery(PKLDRMODLX pModLX, const struct e32_entry *pEntry, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind) { int rc; KU32 iSymbol; const char *pchSymbol; KU8 cchSymbol; if (!pfnGetForwarder) return KLDR_ERR_FORWARDER_SYMBOL; /* * Validate the entry import module ordinal. */ if ( !pEntry->e32_variant.e32_fwd.modord || pEntry->e32_variant.e32_fwd.modord > pModLX->Hdr.e32_impmodcnt) return KLDR_ERR_LX_BAD_FORWARDER; /* * Figure out the parameters. */ if (pEntry->e32_flags & FWD_ORDINAL) { iSymbol = pEntry->e32_variant.e32_fwd.value; pchSymbol = NULL; /* no symbol name. */ cchSymbol = 0; } else { const KU8 *pbName; /* load the fixup section if necessary. */ if (!pModLX->pbImportProcs) { rc = kldrModLXDoLoadFixupSection(pModLX); if (rc) return rc; } /* Make name pointer. */ pbName = pModLX->pbImportProcs + pEntry->e32_variant.e32_fwd.value; if ( pbName >= pModLX->pbFixupSectionLast || pbName < pModLX->pbFixupSection || !*pbName) return KLDR_ERR_LX_BAD_FORWARDER; /* check for '#' name. */ if (pbName[1] == '#') { KU8 cbLeft = *pbName; const KU8 *pb = pbName + 1; unsigned uBase; /* base detection */ uBase = 10; if ( cbLeft > 1 && pb[1] == '0' && (pb[2] == 'x' || pb[2] == 'X')) { uBase = 16; pb += 2; cbLeft -= 2; } /* ascii to integer */ iSymbol = 0; while (cbLeft-- > 0) { /* convert char to digit. */ unsigned uDigit = *pb++; if (uDigit >= '0' && uDigit <= '9') uDigit -= '0'; else if (uDigit >= 'a' && uDigit <= 'z') uDigit -= 'a' + 10; else if (uDigit >= 'A' && uDigit <= 'Z') uDigit -= 'A' + 10; else if (!uDigit) break; else return KLDR_ERR_LX_BAD_FORWARDER; if (uDigit >= uBase) return KLDR_ERR_LX_BAD_FORWARDER; /* insert the digit */ iSymbol *= uBase; iSymbol += uDigit; } if (!iSymbol) return KLDR_ERR_LX_BAD_FORWARDER; pchSymbol = NULL; /* no symbol name. */ cchSymbol = 0; } else { pchSymbol = (char *)pbName + 1; cchSymbol = *pbName; iSymbol = NIL_KLDRMOD_SYM_ORDINAL; } } /* * Resolve the forwarder. */ rc = pfnGetForwarder(pModLX->pMod, pEntry->e32_variant.e32_fwd.modord - 1, iSymbol, pchSymbol, cchSymbol, NULL, puValue, pfKind, pvUser); if (!rc && pfKind) *pfKind |= KLDRSYMKIND_FORWARDER; return rc; } /** * Loads the fixup section from the executable image. * * The fixup section isn't loaded until it's accessed. It's also freed by kLdrModDone(). * * @returns 0 on success, non-zero kLdr or native status code on failure. * @param pModLX The PE module interpreter instance. */ static int kldrModLXDoLoadFixupSection(PKLDRMODLX pModLX) { int rc; KU32 off; void *pv; pv = kHlpAlloc(pModLX->Hdr.e32_fixupsize); if (!pv) return KERR_NO_MEMORY; off = pModLX->Hdr.e32_objtab + pModLX->Hdr.e32_ldrsize; rc = kRdrRead(pModLX->pMod->pRdr, pv, pModLX->Hdr.e32_fixupsize, off + pModLX->offHdr); if (!rc) { pModLX->pbFixupSection = pv; pModLX->pbFixupSectionLast = pModLX->pbFixupSection + pModLX->Hdr.e32_fixupsize; KLDRMODLX_ASSERT(!pModLX->paoffPageFixups); if (pModLX->Hdr.e32_fpagetab) pModLX->paoffPageFixups = (const KU32 *)(pModLX->pbFixupSection + pModLX->Hdr.e32_fpagetab - off); KLDRMODLX_ASSERT(!pModLX->pbFixupRecs); if (pModLX->Hdr.e32_frectab) pModLX->pbFixupRecs = pModLX->pbFixupSection + pModLX->Hdr.e32_frectab - off; KLDRMODLX_ASSERT(!pModLX->pbImportMods); if (pModLX->Hdr.e32_impmod) pModLX->pbImportMods = pModLX->pbFixupSection + pModLX->Hdr.e32_impmod - off; KLDRMODLX_ASSERT(!pModLX->pbImportProcs); if (pModLX->Hdr.e32_impproc) pModLX->pbImportProcs = pModLX->pbFixupSection + pModLX->Hdr.e32_impproc - off; } else kHlpFree(pv); return rc; } /** @copydoc kLdrModEnumSymbols */ static int kldrModLXEnumSymbols(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; const struct b32_bundle *pBundle; KU32 iOrdinal; int rc = 0; K_NOREF(pvBits); K_NOREF(fFlags); kldrModLXResolveBaseAddress(pModLX, &BaseAddress); /* * Enumerate the entry table. * (The entry table is made up of bundles of similar exports.) */ iOrdinal = 1; pBundle = (const struct b32_bundle *)pModLX->pbEntryTab; while (pBundle->b32_cnt && iOrdinal) { static const KSIZE s_cbEntry[] = { 0, 3, 5, 5, 7 }; /* * Enum the entries in the bundle. */ if (pBundle->b32_type != EMPTY) { const struct e32_entry *pEntry; KSIZE cbEntry; KLDRADDR BundleRVA; unsigned cLeft; /* Validate the bundle. */ switch (pBundle->b32_type) { case ENTRY16: case GATE16: case ENTRY32: if ( pBundle->b32_obj <= 0 || pBundle->b32_obj > pMod->cSegments) return KLDR_ERR_LX_BAD_BUNDLE; BundleRVA = pMod->aSegments[pBundle->b32_obj - 1].RVA; break; case ENTRYFWD: BundleRVA = 0; break; default: /* anyone actually using TYPEINFO will end up here. */ KLDRMODLX_ASSERT(!"Bad bundle type"); return KLDR_ERR_LX_BAD_BUNDLE; } /* iterate the bundle entries. */ cbEntry = s_cbEntry[pBundle->b32_type]; pEntry = (const struct e32_entry *)(pBundle + 1); cLeft = pBundle->b32_cnt; while (cLeft-- > 0) { KLDRADDR uValue; KU32 fKind; int fFoundName; const KU8 *pbName; /* * Calc the symbol value and kind. */ switch (pBundle->b32_type) { /* e32_flags + a 16-bit offset. */ case ENTRY16: uValue = BaseAddress + BundleRVA + pEntry->e32_variant.e32_offset.offset16; fKind = KLDRSYMKIND_16BIT | KLDRSYMKIND_NO_TYPE; break; /* e32_flags + a 16-bit offset + a 16-bit callgate selector. */ case GATE16: uValue = BaseAddress + BundleRVA + pEntry->e32_variant.e32_callgate.offset; fKind = KLDRSYMKIND_16BIT | KLDRSYMKIND_CODE; break; /* e32_flags + a 32-bit offset. */ case ENTRY32: uValue = BaseAddress + BundleRVA + pEntry->e32_variant.e32_offset.offset32; fKind = KLDRSYMKIND_32BIT; break; /* e32_flags + 16-bit import module ordinal + a 32-bit procname or ordinal. */ case ENTRYFWD: uValue = 0; /** @todo implement enumeration of forwarders properly. */ fKind = KLDRSYMKIND_FORWARDER; break; default: /* shut up gcc. */ uValue = 0; fKind = KLDRSYMKIND_NO_BIT | KLDRSYMKIND_NO_TYPE; break; } /* * Any symbol names? */ fFoundName = 0; /* resident name table. */ pbName = pModLX->pbResNameTab; if (pbName) { do { pbName = kldrModLXDoNameTableLookupByOrdinal(pbName, pModLX->pbLoaderSectionLast - pbName + 1, iOrdinal); if (!pbName) break; fFoundName = 1; rc = pfnCallback(pMod, iOrdinal, (const char *)pbName + 1, *pbName, NULL, uValue, fKind, pvUser); if (rc) return rc; /* skip to the next entry */ pbName += 1 + *pbName + 2; } while (pbName < pModLX->pbLoaderSectionLast); } /* resident name table. */ pbName = pModLX->pbNonResNameTab; /** @todo lazy load the non-resident name table. */ if (pbName) { do { pbName = kldrModLXDoNameTableLookupByOrdinal(pbName, pModLX->pbNonResNameTabLast - pbName + 1, iOrdinal); if (!pbName) break; fFoundName = 1; rc = pfnCallback(pMod, iOrdinal, (const char *)pbName + 1, *pbName, NULL, uValue, fKind, pvUser); if (rc) return rc; /* skip to the next entry */ pbName += 1 + *pbName + 2; } while (pbName < pModLX->pbLoaderSectionLast); } /* * If no names, call once with the ordinal only. */ if (!fFoundName) { rc = pfnCallback(pMod, iOrdinal, NULL, 0, NULL, uValue, fKind, pvUser); if (rc) return rc; } /* next */ iOrdinal++; pEntry = (const struct e32_entry *)((KUPTR)pEntry + cbEntry); } } /* * The next bundle. */ if (pBundle->b32_type > ENTRYFWD) { KLDRMODLX_ASSERT(!"Bad type"); /** @todo figure out TYPEINFO. */ return KLDR_ERR_LX_BAD_BUNDLE; } if (pBundle->b32_type == 0) pBundle = (const struct b32_bundle *)((const KU8 *)pBundle + 2); else pBundle = (const struct b32_bundle *)((const KU8 *)(pBundle + 1) + s_cbEntry[pBundle->b32_type] * pBundle->b32_cnt); } return 0; } /** * Lookup a name table entry by ordinal. * * @returns Pointer to the name table entry if found. * @returns NULL if not found. * @param pbNameTable Pointer to the name table that should be searched. * @param cbNameTable The size of the name table. * @param iOrdinal The ordinal to search for. */ static const KU8 *kldrModLXDoNameTableLookupByOrdinal(const KU8 *pbNameTable, KSSIZE cbNameTable, KU32 iOrdinal) { while (*pbNameTable != 0 && cbNameTable > 0) { const KU8 cbName = *pbNameTable; KU32 iName; cbNameTable -= cbName + 1 + 2; if (cbNameTable < 0) break; iName = *(pbNameTable + cbName + 1) | ((unsigned)*(pbNameTable + cbName + 2) << 8); if (iName == iOrdinal) return pbNameTable; /* next entry */ pbNameTable += cbName + 1 + 2; } return NULL; } /** @copydoc kLdrModGetImport */ static int kldrModLXGetImport(PKLDRMOD pMod, const void *pvBits, KU32 iImport, char *pszName, KSIZE cchName) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; const KU8 *pb; int rc; K_NOREF(pvBits); /* * Validate */ if (iImport >= pModLX->Hdr.e32_impmodcnt) return KLDR_ERR_IMPORT_ORDINAL_OUT_OF_BOUNDS; /* * Lazy loading the fixup section. */ if (!pModLX->pbImportMods) { rc = kldrModLXDoLoadFixupSection(pModLX); if (rc) return rc; } /* * Iterate the module import table until we reach the requested import ordinal. */ pb = pModLX->pbImportMods; while (iImport-- > 0) pb += *pb + 1; /* * Copy out the result. */ if (*pb < cchName) { kHlpMemCopy(pszName, pb + 1, *pb); pszName[*pb] = '\0'; rc = 0; } else { kHlpMemCopy(pszName, pb + 1, cchName); if (cchName) pszName[cchName - 1] = '\0'; rc = KERR_BUFFER_OVERFLOW; } return rc; } /** @copydoc kLdrModNumberOfImports */ static KI32 kldrModLXNumberOfImports(PKLDRMOD pMod, const void *pvBits) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; K_NOREF(pvBits); return pModLX->Hdr.e32_impmodcnt; } /** @copydoc kLdrModGetStackInfo */ static int kldrModLXGetStackInfo(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRSTACKINFO pStackInfo) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; const KU32 i = pModLX->Hdr.e32_stackobj; K_NOREF(pvBits); if ( i && i <= pMod->cSegments && pModLX->Hdr.e32_esp <= pMod->aSegments[i - 1].LinkAddress + pMod->aSegments[i - 1].cb && pModLX->Hdr.e32_stacksize && pModLX->Hdr.e32_esp - pModLX->Hdr.e32_stacksize >= pMod->aSegments[i - 1].LinkAddress) { kldrModLXResolveBaseAddress(pModLX, &BaseAddress); pStackInfo->LinkAddress = pModLX->Hdr.e32_esp - pModLX->Hdr.e32_stacksize; pStackInfo->Address = BaseAddress + pMod->aSegments[i - 1].RVA + pModLX->Hdr.e32_esp - pModLX->Hdr.e32_stacksize - pMod->aSegments[i - 1].LinkAddress; } else { pStackInfo->Address = NIL_KLDRADDR; pStackInfo->LinkAddress = NIL_KLDRADDR; } pStackInfo->cbStack = pModLX->Hdr.e32_stacksize; pStackInfo->cbStackThread = 0; return 0; } /** @copydoc kLdrModQueryMainEntrypoint */ static int kldrModLXQueryMainEntrypoint(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRADDR pMainEPAddress) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; K_NOREF(pvBits); /* * Convert the address from the header. */ kldrModLXResolveBaseAddress(pModLX, &BaseAddress); *pMainEPAddress = pModLX->Hdr.e32_startobj && pModLX->Hdr.e32_startobj <= pMod->cSegments && pModLX->Hdr.e32_eip < pMod->aSegments[pModLX->Hdr.e32_startobj - 1].cb ? BaseAddress + pMod->aSegments[pModLX->Hdr.e32_startobj - 1].RVA + pModLX->Hdr.e32_eip : NIL_KLDRADDR; return 0; } /** @copydoc kLdrModEnumDbgInfo */ static int kldrModLXEnumDbgInfo(PKLDRMOD pMod, const void *pvBits, PFNKLDRENUMDBG pfnCallback, void *pvUser) { /*PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData;*/ K_NOREF(pfnCallback); K_NOREF(pvUser); /* * Quit immediately if no debug info. */ if (kldrModLXHasDbgInfo(pMod, pvBits)) return 0; #if 0 /* * Read the debug info and look for familiar magics and structures. */ /** @todo */ #endif return 0; } /** @copydoc kLdrModHasDbgInfo */ static int kldrModLXHasDbgInfo(PKLDRMOD pMod, const void *pvBits) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; K_NOREF(pvBits); /* * Don't curretnly bother with linkers which doesn't advertise it in the header. */ if ( !pModLX->Hdr.e32_debuginfo || !pModLX->Hdr.e32_debuglen) return KLDR_ERR_NO_DEBUG_INFO; return 0; } /** @copydoc kLdrModMap */ static int kldrModLXMap(PKLDRMOD pMod) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; unsigned fFixed; void *pvBase; int rc; /* * Already mapped? */ if (pModLX->pvMapping) return KLDR_ERR_ALREADY_MAPPED; /* * Allocate memory for it. */ /* fixed image? */ fFixed = pMod->enmType == KLDRTYPE_EXECUTABLE_FIXED || pMod->enmType == KLDRTYPE_SHARED_LIBRARY_FIXED; if (!fFixed) pvBase = NULL; else { pvBase = (void *)(KUPTR)pMod->aSegments[0].LinkAddress; if ((KUPTR)pvBase != pMod->aSegments[0].LinkAddress) return KLDR_ERR_ADDRESS_OVERFLOW; } rc = kHlpPageAlloc(&pvBase, pModLX->cbMapped, KPROT_EXECUTE_READWRITE, fFixed); if (rc) return rc; /* * Load the bits, apply page protection, and update the segment table. */ rc = kldrModLXDoLoadBits(pModLX, pvBase); if (!rc) rc = kldrModLXDoProtect(pModLX, pvBase, 0 /* protect */); if (!rc) { KU32 i; for (i = 0; i < pMod->cSegments; i++) { if (pMod->aSegments[i].RVA != NIL_KLDRADDR) pMod->aSegments[i].MapAddress = (KUPTR)pvBase + (KUPTR)pMod->aSegments[i].RVA; } pModLX->pvMapping = pvBase; } else kHlpPageFree(pvBase, pModLX->cbMapped); return rc; } /** * Loads the LX pages into the specified memory mapping. * * @returns 0 on success. * @returns non-zero kLdr or OS status code on failure. * * @param pModLX The LX module interpreter instance. * @param pvBits Where to load the bits. */ static int kldrModLXDoLoadBits(PKLDRMODLX pModLX, void *pvBits) { const PKRDR pRdr = pModLX->pMod->pRdr; KU8 *pbTmpPage = NULL; int rc = 0; KU32 i; /* * Iterate the segments. */ for (i = 0; i < pModLX->Hdr.e32_objcnt; i++) { const struct o32_obj * const pObj = &pModLX->paObjs[i]; const KU32 cPages = (KU32)(pModLX->pMod->aSegments[i].cbMapped / OBJPAGELEN); KU32 iPage; KU8 *pbPage = (KU8 *)pvBits + (KUPTR)pModLX->pMod->aSegments[i].RVA; /* * Iterate the page map pages. */ for (iPage = 0; !rc && iPage < pObj->o32_mapsize; iPage++, pbPage += OBJPAGELEN) { const struct o32_map *pMap = &pModLX->paPageMappings[iPage + pObj->o32_pagemap - 1]; switch (pMap->o32_pageflags) { case VALID: if (pMap->o32_pagesize == OBJPAGELEN) rc = kRdrRead(pRdr, pbPage, OBJPAGELEN, pModLX->Hdr.e32_datapage + (pMap->o32_pagedataoffset << pModLX->Hdr.e32_pageshift)); else if (pMap->o32_pagesize < OBJPAGELEN) { rc = kRdrRead(pRdr, pbPage, pMap->o32_pagesize, pModLX->Hdr.e32_datapage + (pMap->o32_pagedataoffset << pModLX->Hdr.e32_pageshift)); kHlpMemSet(pbPage + pMap->o32_pagesize, 0, OBJPAGELEN - pMap->o32_pagesize); } else rc = KLDR_ERR_LX_BAD_PAGE_MAP; break; case ITERDATA: case ITERDATA2: /* make sure we've got a temp page .*/ if (!pbTmpPage) { pbTmpPage = kHlpAlloc(OBJPAGELEN + 256); if (!pbTmpPage) break; } /* validate the size. */ if (pMap->o32_pagesize > OBJPAGELEN + 252) { rc = KLDR_ERR_LX_BAD_PAGE_MAP; break; } /* read it and ensure 4 extra zero bytes. */ rc = kRdrRead(pRdr, pbTmpPage, pMap->o32_pagesize, pModLX->Hdr.e32_datapage + (pMap->o32_pagedataoffset << pModLX->Hdr.e32_pageshift)); if (rc) break; kHlpMemSet(pbTmpPage + pMap->o32_pagesize, 0, 4); /* unpack it into the image page. */ if (pMap->o32_pageflags == ITERDATA2) rc = kldrModLXDoIterData2Unpacking(pbPage, pbTmpPage, pMap->o32_pagesize); else rc = kldrModLXDoIterDataUnpacking(pbPage, pbTmpPage, pMap->o32_pagesize); break; case INVALID: /* we're probably not dealing correctly with INVALID pages... */ case ZEROED: kHlpMemSet(pbPage, 0, OBJPAGELEN); break; case RANGE: KLDRMODLX_ASSERT(!"RANGE"); /* Falls through. */ default: rc = KLDR_ERR_LX_BAD_PAGE_MAP; break; } } if (rc) break; /* * Zero the remaining pages. */ if (iPage < cPages) kHlpMemSet(pbPage, 0, (cPages - iPage) * OBJPAGELEN); } if (pbTmpPage) kHlpFree(pbTmpPage); return rc; } /** * Unpacks iterdata (aka EXEPACK). * * @returns 0 on success, non-zero kLdr status code on failure. * @param pbDst Where to put the uncompressed data. (Assumes OBJPAGELEN size.) * @param pbSrc The compressed source data. * @param cbSrc The file size of the compressed data. The source buffer * contains 4 additional zero bytes. */ static int kldrModLXDoIterDataUnpacking(KU8 *pbDst, const KU8 *pbSrc, int cbSrc) { const struct LX_Iter *pIter = (const struct LX_Iter *)pbSrc; int cbDst = OBJPAGELEN; /* Validate size of data. */ if (cbSrc >= (int)OBJPAGELEN - 2) return KLDR_ERR_LX_BAD_ITERDATA; /* * Expand the page. */ while (cbSrc > 0 && pIter->LX_nIter) { if (pIter->LX_nBytes == 1) { /* * Special case - one databyte. */ cbDst -= pIter->LX_nIter; if (cbDst < 0) return KLDR_ERR_LX_BAD_ITERDATA; cbSrc -= 4 + 1; if (cbSrc < -4) return KLDR_ERR_LX_BAD_ITERDATA; kHlpMemSet(pbDst, pIter->LX_Iterdata, pIter->LX_nIter); pbDst += pIter->LX_nIter; pIter++; } else { /* * General. */ int i; cbDst -= pIter->LX_nIter * pIter->LX_nBytes; if (cbDst < 0) return KLDR_ERR_LX_BAD_ITERDATA; cbSrc -= 4 + pIter->LX_nBytes; if (cbSrc < -4) return KLDR_ERR_LX_BAD_ITERDATA; for (i = pIter->LX_nIter; i > 0; i--, pbDst += pIter->LX_nBytes) kHlpMemCopy(pbDst, &pIter->LX_Iterdata, pIter->LX_nBytes); pIter = (struct LX_Iter *)((char*)pIter + 4 + pIter->LX_nBytes); } } /* * Zero remainder of the page. */ if (cbDst > 0) kHlpMemSet(pbDst, 0, cbDst); return 0; } /** * Unpacks iterdata (aka EXEPACK). * * @returns 0 on success, non-zero kLdr status code on failure. * @param pbDst Where to put the uncompressed data. (Assumes OBJPAGELEN size.) * @param pbSrc The compressed source data. * @param cbSrc The file size of the compressed data. The source buffer * contains 4 additional zero bytes. */ static int kldrModLXDoIterData2Unpacking(KU8 *pbDst, const KU8 *pbSrc, int cbSrc) { int cbDst = OBJPAGELEN; while (cbSrc > 0) { /* * Bit 0 and 1 is the encoding type. */ switch (*pbSrc & 0x03) { /* * * 0 1 2 3 4 5 6 7 * type | | * ---------------- * cb <cb bytes of data> * * Bits 2-7 is, if not zero, the length of an uncompressed run * starting at the following byte. * * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 * type | | | | | | * ---------------- ---------------------- ----------------------- * zero cb char to multiply * * If the bits are zero, the following two bytes describes a 1 byte interation * run. First byte is count, second is the byte to copy. A count of zero is * means end of data, and we simply stops. In that case the rest of the data * should be zero. */ case 0: { if (*pbSrc) { const int cb = *pbSrc >> 2; cbDst -= cb; if (cbDst < 0) return KLDR_ERR_LX_BAD_ITERDATA2; cbSrc -= cb + 1; if (cbSrc < 0) return KLDR_ERR_LX_BAD_ITERDATA2; kHlpMemCopy(pbDst, ++pbSrc, cb); pbDst += cb; pbSrc += cb; } else if (cbSrc < 2) return KLDR_ERR_LX_BAD_ITERDATA2; else { const int cb = pbSrc[1]; if (!cb) goto l_endloop; cbDst -= cb; if (cbDst < 0) return KLDR_ERR_LX_BAD_ITERDATA2; cbSrc -= 3; if (cbSrc < 0) return KLDR_ERR_LX_BAD_ITERDATA2; kHlpMemSet(pbDst, pbSrc[2], cb); pbDst += cb; pbSrc += 3; } break; } /* * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 * type | | | | | | * ---- ------- ------------------------- * cb1 cb2 - 3 offset <cb1 bytes of data> * * Two bytes layed out as described above, followed by cb1 bytes of data to be copied. * The cb2(+3) and offset describes an amount of data to be copied from the expanded * data relative to the current position. The data copied as you would expect it to be. */ case 1: { cbSrc -= 2; if (cbSrc < 0) return KLDR_ERR_LX_BAD_ITERDATA2; else { const unsigned off = ((unsigned)pbSrc[1] << 1) | (*pbSrc >> 7); const int cb1 = (*pbSrc >> 2) & 3; const int cb2 = ((*pbSrc >> 4) & 7) + 3; pbSrc += 2; cbSrc -= cb1; if (cbSrc < 0) return KLDR_ERR_LX_BAD_ITERDATA2; cbDst -= cb1; if (cbDst < 0) return KLDR_ERR_LX_BAD_ITERDATA2; kHlpMemCopy(pbDst, pbSrc, cb1); pbDst += cb1; pbSrc += cb1; if (off > OBJPAGELEN - (unsigned)cbDst) return KLDR_ERR_LX_BAD_ITERDATA2; cbDst -= cb2; if (cbDst < 0) return KLDR_ERR_LX_BAD_ITERDATA2; kHlpMemMove(pbDst, pbDst - off, cb2); pbDst += cb2; } break; } /* * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 * type | | | | * ---- ---------------------------------- * cb-3 offset * * Two bytes layed out as described above. * The cb(+3) and offset describes an amount of data to be copied from the expanded * data relative to the current position. * * If offset == 1 the data is not copied as expected, but in the memcpyw manner. */ case 2: { cbSrc -= 2; if (cbSrc < 0) return KLDR_ERR_LX_BAD_ITERDATA2; else { const unsigned off = ((unsigned)pbSrc[1] << 4) | (*pbSrc >> 4); const int cb = ((*pbSrc >> 2) & 3) + 3; pbSrc += 2; if (off > OBJPAGELEN - (unsigned)cbDst) return KLDR_ERR_LX_BAD_ITERDATA2; cbDst -= cb; if (cbDst < 0) return KLDR_ERR_LX_BAD_ITERDATA2; kLdrModLXMemCopyW(pbDst, pbDst - off, cb); pbDst += cb; } break; } /* * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 * type | | | | | | * ---------- ---------------- ---------------------------------- * cb1 cb2 offset <cb1 bytes of data> * * Three bytes layed out as described above, followed by cb1 bytes of data to be copied. * The cb2 and offset describes an amount of data to be copied from the expanded * data relative to the current position. * * If offset == 1 the data is not copied as expected, but in the memcpyw manner. */ case 3: { cbSrc -= 3; if (cbSrc < 0) return KLDR_ERR_LX_BAD_ITERDATA2; else { const int cb1 = (*pbSrc >> 2) & 0xf; const int cb2 = ((pbSrc[1] & 0xf) << 2) | (*pbSrc >> 6); const unsigned off = ((unsigned)pbSrc[2] << 4) | (pbSrc[1] >> 4); pbSrc += 3; cbSrc -= cb1; if (cbSrc < 0) return KLDR_ERR_LX_BAD_ITERDATA2; cbDst -= cb1; if (cbDst < 0) return KLDR_ERR_LX_BAD_ITERDATA2; kHlpMemCopy(pbDst, pbSrc, cb1); pbDst += cb1; pbSrc += cb1; if (off > OBJPAGELEN - (unsigned)cbDst) return KLDR_ERR_LX_BAD_ITERDATA2; cbDst -= cb2; if (cbDst < 0) return KLDR_ERR_LX_BAD_ITERDATA2; kLdrModLXMemCopyW(pbDst, pbDst - off, cb2); pbDst += cb2; } break; } } /* type switch. */ } /* unpack loop */ l_endloop: /* * Zero remainder of the page. */ if (cbDst > 0) kHlpMemSet(pbDst, 0, cbDst); return 0; } /** * Special memcpy employed by the iterdata2 algorithm. * * Emulate a 16-bit memcpy (copying 16-bit at a time) and the effects this * has if src is very close to the destination. * * @param pbDst Destination pointer. * @param pbSrc Source pointer. Will always be <= pbDst. * @param cb Amount of data to be copied. * @remark This assumes that unaligned word and dword access is fine. */ static void kLdrModLXMemCopyW(KU8 *pbDst, const KU8 *pbSrc, int cb) { switch (pbDst - pbSrc) { case 0: case 1: case 2: case 3: /* 16-bit copy (unaligned) */ if (cb & 1) *pbDst++ = *pbSrc++; for (cb >>= 1; cb > 0; cb--, pbDst += 2, pbSrc += 2) *(KU16 *)pbDst = *(const KU16 *)pbSrc; break; default: /* 32-bit copy (unaligned) */ if (cb & 1) *pbDst++ = *pbSrc++; if (cb & 2) { *(KU16 *)pbDst = *(const KU16 *)pbSrc; pbDst += 2; pbSrc += 2; } for (cb >>= 2; cb > 0; cb--, pbDst += 4, pbSrc += 4) *(KU32 *)pbDst = *(const KU32 *)pbSrc; break; } } /** * Unprotects or protects the specified image mapping. * * @returns 0 on success. * @returns non-zero kLdr or OS status code on failure. * * @param pModLX The LX module interpreter instance. * @param pvBits The mapping to protect. * @param UnprotectOrProtect If 1 unprotect (i.e. make all writable), otherwise * protect according to the object table. */ static int kldrModLXDoProtect(PKLDRMODLX pModLX, void *pvBits, unsigned fUnprotectOrProtect) { KU32 i; PKLDRMOD pMod = pModLX->pMod; /* * Change object protection. */ for (i = 0; i < pMod->cSegments; i++) { int rc; void *pv; KPROT enmProt; /* calc new protection. */ enmProt = pMod->aSegments[i].enmProt; if (fUnprotectOrProtect) { switch (enmProt) { case KPROT_NOACCESS: case KPROT_READONLY: case KPROT_READWRITE: case KPROT_WRITECOPY: enmProt = KPROT_READWRITE; break; case KPROT_EXECUTE: case KPROT_EXECUTE_READ: case KPROT_EXECUTE_READWRITE: case KPROT_EXECUTE_WRITECOPY: enmProt = KPROT_EXECUTE_READWRITE; break; default: KLDRMODLX_ASSERT(!"bad enmProt"); return -1; } } else { /* copy on write -> normal write. */ if (enmProt == KPROT_EXECUTE_WRITECOPY) enmProt = KPROT_EXECUTE_READWRITE; else if (enmProt == KPROT_WRITECOPY) enmProt = KPROT_READWRITE; } /* calc the address and set page protection. */ pv = (KU8 *)pvBits + pMod->aSegments[i].RVA; rc = kHlpPageProtect(pv, pMod->aSegments[i].cbMapped, enmProt); if (rc) break; /** @todo the gap page should be marked NOACCESS! */ } return 0; } /** @copydoc kLdrModUnmap */ static int kldrModLXUnmap(PKLDRMOD pMod) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; KU32 i; int rc; /* * Mapped? */ if (!pModLX->pvMapping) return KLDR_ERR_NOT_MAPPED; /* * Free the mapping and update the segments. */ rc = kHlpPageFree((void *)pModLX->pvMapping, pModLX->cbMapped); KLDRMODLX_ASSERT(!rc); pModLX->pvMapping = NULL; for (i = 0; i < pMod->cSegments; i++) pMod->aSegments[i].MapAddress = 0; return rc; } /** @copydoc kLdrModAllocTLS */ static int kldrModLXAllocTLS(PKLDRMOD pMod, void *pvMapping) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; /* no tls, just do the error checking. */ if ( pvMapping == KLDRMOD_INT_MAP && pModLX->pvMapping) return KLDR_ERR_NOT_MAPPED; return 0; } /** @copydoc kLdrModFreeTLS */ static void kldrModLXFreeTLS(PKLDRMOD pMod, void *pvMapping) { /* no tls. */ K_NOREF(pMod); K_NOREF(pvMapping); } /** @copydoc kLdrModReload */ static int kldrModLXReload(PKLDRMOD pMod) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; int rc, rc2; /* * Mapped? */ if (!pModLX->pvMapping) return KLDR_ERR_NOT_MAPPED; /* * Before doing anything we'll have to make all pages writable. */ rc = kldrModLXDoProtect(pModLX, (void *)pModLX->pvMapping, 1 /* unprotect */); if (rc) return rc; /* * Load the bits again. */ rc = kldrModLXDoLoadBits(pModLX, (void *)pModLX->pvMapping); /* * Restore protection. */ rc2 = kldrModLXDoProtect(pModLX, (void *)pModLX->pvMapping, 0 /* protect */); if (!rc && rc2) rc = rc2; return rc; } /** @copydoc kLdrModFixupMapping */ static int kldrModLXFixupMapping(PKLDRMOD pMod, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; int rc, rc2; /* * Mapped? */ if (!pModLX->pvMapping) return KLDR_ERR_NOT_MAPPED; /* * Before doing anything we'll have to make all pages writable. */ rc = kldrModLXDoProtect(pModLX, (void *)pModLX->pvMapping, 1 /* unprotect */); if (rc) return rc; /* * Apply fixups and resolve imports. */ rc = kldrModLXRelocateBits(pMod, (void *)pModLX->pvMapping, (KUPTR)pModLX->pvMapping, pMod->aSegments[0].LinkAddress, pfnGetImport, pvUser); /* * Restore protection. */ rc2 = kldrModLXDoProtect(pModLX, (void *)pModLX->pvMapping, 0 /* protect */); if (!rc && rc2) rc = rc2; return rc; } /** @copydoc kLdrModCallInit */ static int kldrModLXCallInit(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; int rc; /* * Mapped? */ if (pvMapping == KLDRMOD_INT_MAP) { pvMapping = (void *)pModLX->pvMapping; if (!pvMapping) return KLDR_ERR_NOT_MAPPED; } /* * Do TLS callbacks first and then call the init/term function if it's a DLL. */ if ((pModLX->Hdr.e32_mflags & E32MODMASK) == E32MODDLL) rc = kldrModLXDoCallDLL(pModLX, pvMapping, 0 /* attach */, uHandle); else rc = 0; return rc; } /** * Call the DLL entrypoint. * * @returns 0 on success. * @returns KLDR_ERR_MODULE_INIT_FAILED or KLDR_ERR_THREAD_ATTACH_FAILED on failure. * @param pModLX The LX module interpreter instance. * @param pvMapping The module mapping to use (resolved). * @param uOp The operation (DLL_*). * @param uHandle The module handle to present. */ static int kldrModLXDoCallDLL(PKLDRMODLX pModLX, void *pvMapping, unsigned uOp, KUPTR uHandle) { int rc; /* * If no entrypoint there isn't anything to be done. */ if ( !pModLX->Hdr.e32_startobj || pModLX->Hdr.e32_startobj > pModLX->Hdr.e32_objcnt) return 0; /* * Invoke the entrypoint and convert the boolean result to a kLdr status code. */ rc = kldrModLXDoCall((KUPTR)pvMapping + (KUPTR)pModLX->pMod->aSegments[pModLX->Hdr.e32_startobj - 1].RVA + pModLX->Hdr.e32_eip, uHandle, uOp, NULL); if (rc) rc = 0; else if (uOp == 0 /* attach */) rc = KLDR_ERR_MODULE_INIT_FAILED; else /* detach: ignore failures */ rc = 0; return rc; } /** * Do a 3 parameter callback. * * @returns 32-bit callback return. * @param uEntrypoint The address of the function to be called. * @param uHandle The first argument, the module handle. * @param uOp The second argumnet, the reason we're calling. * @param pvReserved The third argument, reserved argument. (figure this one out) */ KI32 kldrModLXDoCall(KUPTR uEntrypoint, KUPTR uHandle, KU32 uOp, void *pvReserved) { #if defined(__X86__) || defined(__i386__) || defined(_M_IX86) KI32 rc; /** @todo try/except */ /* * Paranoia. */ # ifdef __GNUC__ __asm__ __volatile__( "pushl %2\n\t" "pushl %1\n\t" "pushl %0\n\t" "lea 12(%%esp), %2\n\t" "call *%3\n\t" "movl %2, %%esp\n\t" : "=a" (rc) : "d" (uOp), "S" (0), "c" (uEntrypoint), "0" (uHandle)); # elif defined(_MSC_VER) __asm { mov eax, [uHandle] mov edx, [uOp] mov ecx, 0 mov ebx, [uEntrypoint] push edi mov edi, esp push ecx push edx push eax call ebx mov esp, edi pop edi mov [rc], eax } # else # error "port me!" # endif K_NOREF(pvReserved); return rc; #else K_NOREF(uEntrypoint); K_NOREF(uHandle); K_NOREF(uOp); K_NOREF(pvReserved); return KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; #endif } /** @copydoc kLdrModCallTerm */ static int kldrModLXCallTerm(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; /* * Mapped? */ if (pvMapping == KLDRMOD_INT_MAP) { pvMapping = (void *)pModLX->pvMapping; if (!pvMapping) return KLDR_ERR_NOT_MAPPED; } /* * Do the call. */ if ((pModLX->Hdr.e32_mflags & E32MODMASK) == E32MODDLL) kldrModLXDoCallDLL(pModLX, pvMapping, 1 /* detach */, uHandle); return 0; } /** @copydoc kLdrModCallThread */ static int kldrModLXCallThread(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle, unsigned fAttachingOrDetaching) { /* no thread attach/detach callout. */ K_NOREF(pMod); K_NOREF(pvMapping); K_NOREF(uHandle); K_NOREF(fAttachingOrDetaching); return 0; } /** @copydoc kLdrModSize */ static KLDRADDR kldrModLXSize(PKLDRMOD pMod) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; return pModLX->cbMapped; } /** @copydoc kLdrModGetBits */ static int kldrModLXGetBits(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; int rc; /* * Load the image bits. */ rc = kldrModLXDoLoadBits(pModLX, pvBits); if (rc) return rc; /* * Perform relocations. */ return kldrModLXRelocateBits(pMod, pvBits, BaseAddress, pMod->aSegments[0].LinkAddress, pfnGetImport, pvUser); } /** @copydoc kLdrModRelocateBits */ static int kldrModLXRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser) { PKLDRMODLX pModLX = (PKLDRMODLX)pMod->pvData; KU32 iSeg; int rc; /* * Do we need to to *anything*? */ if ( NewBaseAddress == OldBaseAddress && NewBaseAddress == pModLX->paObjs[0].o32_base && !pModLX->Hdr.e32_impmodcnt) return 0; /* * Load the fixup section. */ if (!pModLX->pbFixupSection) { rc = kldrModLXDoLoadFixupSection(pModLX); if (rc) return rc; } /* * Iterate the segments. */ for (iSeg = 0; iSeg < pModLX->Hdr.e32_objcnt; iSeg++) { const struct o32_obj * const pObj = &pModLX->paObjs[iSeg]; KLDRADDR PageAddress = NewBaseAddress + pModLX->pMod->aSegments[iSeg].RVA; KU32 iPage; KU8 *pbPage = (KU8 *)pvBits + (KUPTR)pModLX->pMod->aSegments[iSeg].RVA; /* * Iterate the page map pages. */ for (iPage = 0, rc = 0; !rc && iPage < pObj->o32_mapsize; iPage++, pbPage += OBJPAGELEN, PageAddress += OBJPAGELEN) { const KU8 * const pbFixupRecEnd = pModLX->pbFixupRecs + pModLX->paoffPageFixups[iPage + pObj->o32_pagemap]; const KU8 *pb = pModLX->pbFixupRecs + pModLX->paoffPageFixups[iPage + pObj->o32_pagemap - 1]; KLDRADDR uValue = NIL_KLDRADDR; KU32 fKind = 0; int iSelector; /* sanity */ if (pbFixupRecEnd < pb) return KLDR_ERR_BAD_FIXUP; if (pbFixupRecEnd - 1 > pModLX->pbFixupSectionLast) return KLDR_ERR_BAD_FIXUP; if (pb < pModLX->pbFixupSection) return KLDR_ERR_BAD_FIXUP; /* * Iterate the fixup record. */ while (pb < pbFixupRecEnd) { union _rel { const KU8 * pb; const struct r32_rlc *prlc; } u; u.pb = pb; pb += 3 + (u.prlc->nr_stype & NRCHAIN ? 0 : 1); /* place pch at the 4th member. */ /* * Figure out the target. */ switch (u.prlc->nr_flags & NRRTYP) { /* * Internal fixup. */ case NRRINT: { KU16 iTrgObject; KU32 offTrgObject; /* the object */ if (u.prlc->nr_flags & NR16OBJMOD) { iTrgObject = *(const KU16 *)pb; pb += 2; } else iTrgObject = *pb++; iTrgObject--; if (iTrgObject >= pModLX->Hdr.e32_objcnt) return KLDR_ERR_BAD_FIXUP; /* the target */ if ((u.prlc->nr_stype & NRSRCMASK) != NRSSEG) { if (u.prlc->nr_flags & NR32BITOFF) { offTrgObject = *(const KU32 *)pb; pb += 4; } else { offTrgObject = *(const KU16 *)pb; pb += 2; } /* calculate the symbol info. */ uValue = offTrgObject + NewBaseAddress + pMod->aSegments[iTrgObject].RVA; } else uValue = NewBaseAddress + pMod->aSegments[iTrgObject].RVA; if ( (u.prlc->nr_stype & NRALIAS) || (pMod->aSegments[iTrgObject].fFlags & KLDRSEG_FLAG_16BIT)) iSelector = pMod->aSegments[iTrgObject].Sel16bit; else iSelector = pMod->aSegments[iTrgObject].SelFlat; fKind = 0; break; } /* * Import by symbol ordinal. */ case NRRORD: { KU16 iModule; KU32 iSymbol; /* the module ordinal */ if (u.prlc->nr_flags & NR16OBJMOD) { iModule = *(const KU16 *)pb; pb += 2; } else iModule = *pb++; iModule--; if (iModule >= pModLX->Hdr.e32_impmodcnt) return KLDR_ERR_BAD_FIXUP; #if 1 if (u.prlc->nr_flags & NRICHAIN) return KLDR_ERR_BAD_FIXUP; #endif /* . */ if (u.prlc->nr_flags & NR32BITOFF) { iSymbol = *(const KU32 *)pb; pb += 4; } else if (!(u.prlc->nr_flags & NR8BITORD)) { iSymbol = *(const KU16 *)pb; pb += 2; } else iSymbol = *pb++; /* resolve it. */ rc = pfnGetImport(pMod, iModule, iSymbol, NULL, 0, NULL, &uValue, &fKind, pvUser); if (rc) return rc; iSelector = -1; break; } /* * Import by symbol name. */ case NRRNAM: { KU32 iModule; KU16 offSymbol; const KU8 *pbSymbol; /* the module ordinal */ if (u.prlc->nr_flags & NR16OBJMOD) { iModule = *(const KU16 *)pb; pb += 2; } else iModule = *pb++; iModule--; if (iModule >= pModLX->Hdr.e32_impmodcnt) return KLDR_ERR_BAD_FIXUP; #if 1 if (u.prlc->nr_flags & NRICHAIN) return KLDR_ERR_BAD_FIXUP; #endif /* . */ if (u.prlc->nr_flags & NR32BITOFF) { offSymbol = *(const KU32 *)pb; pb += 4; } else if (!(u.prlc->nr_flags & NR8BITORD)) { offSymbol = *(const KU16 *)pb; pb += 2; } else offSymbol = *pb++; pbSymbol = pModLX->pbImportProcs + offSymbol; if ( pbSymbol < pModLX->pbImportProcs || pbSymbol > pModLX->pbFixupSectionLast) return KLDR_ERR_BAD_FIXUP; /* resolve it. */ rc = pfnGetImport(pMod, iModule, NIL_KLDRMOD_SYM_ORDINAL, (const char *)pbSymbol + 1, *pbSymbol, NULL, &uValue, &fKind, pvUser); if (rc) return rc; iSelector = -1; break; } case NRRENT: KLDRMODLX_ASSERT(!"NRRENT"); /* Falls through. */ default: iSelector = -1; break; } /* addend */ if (u.prlc->nr_flags & NRADD) { if (u.prlc->nr_flags & NR32BITADD) { uValue += *(const KU32 *)pb; pb += 4; } else { uValue += *(const KU16 *)pb; pb += 2; } } /* * Deal with the 'source' (i.e. the place that should be modified - very logical). */ if (!(u.prlc->nr_stype & NRCHAIN)) { int off = u.prlc->r32_soff; /* common / simple */ if ( (u.prlc->nr_stype & NRSRCMASK) == NROFF32 && off >= 0 && off <= (int)OBJPAGELEN - 4) *(KU32 *)&pbPage[off] = (KU32)uValue; else if ( (u.prlc->nr_stype & NRSRCMASK) == NRSOFF32 && off >= 0 && off <= (int)OBJPAGELEN - 4) *(KU32 *)&pbPage[off] = (KU32)(uValue - (PageAddress + off + 4)); else { /* generic */ rc = kldrModLXDoReloc(pbPage, off, PageAddress, u.prlc, iSelector, uValue, fKind); if (rc) return rc; } } else if (!(u.prlc->nr_flags & NRICHAIN)) { const KI16 *poffSrc = (const KI16 *)pb; KU8 c = u.pb[2]; /* common / simple */ if ((u.prlc->nr_stype & NRSRCMASK) == NROFF32) { while (c-- > 0) { int off = *poffSrc++; if (off >= 0 && off <= (int)OBJPAGELEN - 4) *(KU32 *)&pbPage[off] = (KU32)uValue; else { rc = kldrModLXDoReloc(pbPage, off, PageAddress, u.prlc, iSelector, uValue, fKind); if (rc) return rc; } } } else if ((u.prlc->nr_stype & NRSRCMASK) == NRSOFF32) { while (c-- > 0) { int off = *poffSrc++; if (off >= 0 && off <= (int)OBJPAGELEN - 4) *(KU32 *)&pbPage[off] = (KU32)(uValue - (PageAddress + off + 4)); else { rc = kldrModLXDoReloc(pbPage, off, PageAddress, u.prlc, iSelector, uValue, fKind); if (rc) return rc; } } } else { while (c-- > 0) { rc = kldrModLXDoReloc(pbPage, *poffSrc++, PageAddress, u.prlc, iSelector, uValue, fKind); if (rc) return rc; } } pb = (const KU8 *)poffSrc; } else { /* This is a pain because it will require virgin pages on a relocation. */ KLDRMODLX_ASSERT(!"NRICHAIN"); return KLDR_ERR_LX_NRICHAIN_NOT_SUPPORTED; } } } } return 0; } /** * Applies the relocation to one 'source' in a page. * * This takes care of the more esotic case while the common cases * are dealt with seperately. * * @returns 0 on success, non-zero kLdr status code on failure. * @param pbPage The page in which to apply the fixup. * @param off Page relative offset of where to apply the offset. * @param uValue The target value. * @param fKind The target kind. */ static int kldrModLXDoReloc(KU8 *pbPage, int off, KLDRADDR PageAddress, const struct r32_rlc *prlc, int iSelector, KLDRADDR uValue, KU32 fKind) { #pragma pack(1) /* just to be sure */ union { KU8 ab[6]; KU32 off32; KU16 off16; KU8 off8; struct { KU16 off; KU16 Sel; } Far16; struct { KU32 off; KU16 Sel; } Far32; } uData; #pragma pack() const KU8 *pbSrc; KU8 *pbDst; KU8 cb; K_NOREF(fKind); /* * Compose the fixup data. */ switch (prlc->nr_stype & NRSRCMASK) { case NRSBYT: uData.off8 = (KU8)uValue; cb = 1; break; case NRSSEG: if (iSelector == -1) { /* fixme */ } uData.off16 = iSelector; cb = 2; break; case NRSPTR: if (iSelector == -1) { /* fixme */ } uData.Far16.off = (KU16)uValue; uData.Far16.Sel = iSelector; cb = 4; break; case NRSOFF: uData.off16 = (KU16)uValue; cb = 2; break; case NRPTR48: if (iSelector == -1) { /* fixme */ } uData.Far32.off = (KU32)uValue; uData.Far32.Sel = iSelector; cb = 6; break; case NROFF32: uData.off32 = (KU32)uValue; cb = 4; break; case NRSOFF32: uData.off32 = (KU32)(uValue - (PageAddress + off + 4)); cb = 4; break; default: return KLDR_ERR_LX_BAD_FIXUP_SECTION; /** @todo fix error, add more checks! */ } /* * Apply it. This is sloooow... */ pbSrc = &uData.ab[0]; pbDst = pbPage + off; while (cb-- > 0) { if (off > (int)OBJPAGELEN) break; if (off >= 0) *pbDst = *pbSrc; pbSrc++; pbDst++; } return 0; } /** * The LX module interpreter method table. */ KLDRMODOPS g_kLdrModLXOps = { "LX", NULL, kldrModLXCreate, kldrModLXDestroy, kldrModLXQuerySymbol, kldrModLXEnumSymbols, kldrModLXGetImport, kldrModLXNumberOfImports, NULL /* can execute one is optional */, kldrModLXGetStackInfo, kldrModLXQueryMainEntrypoint, NULL /* pfnQueryImageUuid */, NULL /* fixme */, NULL /* fixme */, kldrModLXEnumDbgInfo, kldrModLXHasDbgInfo, kldrModLXMap, kldrModLXUnmap, kldrModLXAllocTLS, kldrModLXFreeTLS, kldrModLXReload, kldrModLXFixupMapping, kldrModLXCallInit, kldrModLXCallTerm, kldrModLXCallThread, kldrModLXSize, kldrModLXGetBits, kldrModLXRelocateBits, NULL /* fixme: pfnMostlyDone */, 42 /* the end */ }; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/�����������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�020232� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tstExeMainStub.c�������������������������������������������0000664�0001750�0001750�00000004630�14670377514�023320� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tstExeMainStub.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr testcase - DLL Stub. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "tst.h" #if K_OS == K_OS_OS2 # define INCL_BASE # include <os2.h> #elif K_OS == K_OS_WINDOWS /* nothing */ #elif K_OS == K_OS_NT # include <ddk/ntapi.h> /** @todo fix the nt port. */ #else # error "port me" #endif extern int main(); #if K_OS == K_OS_OS2 /** * OS/2 'main'. */ ULONG _System OS2Main(HMODULE hmod, ULONG fFlag, ULONG ulReserved, PSZ pszzEnv, PSZ pszzCmdLine) { int rc; rc = main(); return rc; } #elif K_OS == K_OS_WINDOWS /** * Windows'main' */ int WindowsMain(void) { int rc; rc = main(); return rc; } #elif K_OS == K_OS_NT /** * Windows NT 'main' */ VOID NtProcess(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved) { int rc; rc = main(); /* (no way around this) */ for (;;) ZwTerminateProcess(NtCurrentProcess(), rc); } #else # error "port me" #endif ��������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tstDllMainStub.c�������������������������������������������0000664�0001750�0001750�00000004137�14670377514�023314� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tstDllMainStub.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr testcase - DLL Stub. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "tst.h" #if K_OS == K_OS_OS2 # define INCL_BASE # include <os2.h> #elif K_OS == K_OS_WINDOWS # include <windows.h> #elif K_OS == K_OS_DARWIN /* later */ #else # error "port me" #endif #if K_OS == K_OS_OS2 /** * OS/2 DLL 'main' */ ULONG _System _DLL_InitTerm(HMODULE hmod, ULONG fFlag) { return TRUE; } #elif K_OS == K_OS_WINDOWS /** * Window DLL 'main' */ BOOL __stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved) { return TRUE; } #elif K_OS == K_OS_DARWIN /* later */ #else # error "port me" #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-2-d.c��������������������������������������������������0000664�0001750�0001750�00000000212�14670377514�021563� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "d"; MY_IMPORT(int) FuncA(void); MY_EXPORT(int) FuncD(void) { return FuncA(); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-2-c.c��������������������������������������������������0000664�0001750�0001750�00000000212�14670377514�021562� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "c"; MY_IMPORT(int) FuncA(void); MY_EXPORT(int) FuncC(void) { return FuncA(); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst.h������������������������������������������������������0000664�0001750�0001750�00000003442�14670377513�021217� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tst.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr testcase header. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___tst_h___ #define ___tst_h___ #include <k/kLdr.h> #include <k/kHlp.h> #if K_OS == K_OS_OS2 \ || K_OS == K_OS_WINDOWS # define MY_EXPORT(type) __declspec(dllexport) type /*# define MY_IMPORT(type) extern __declspec(dllimport) type*/ # define MY_IMPORT(type) extern type #else # define MY_EXPORT(type) type # define MY_IMPORT(type) extern type #endif #if K_OS == K_OS_OS2 \ || K_OS == K_OS_DARWIN # define MY_NAME(a) "_" a #else # define MY_NAME(a) a #endif extern const char *g_pszName; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/Makefile.kmk�����������������������������������������������0000664�0001750�0001750�00000022461�14670377514�022460� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kBuild Makefile for the kLdr testcases. # # # Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # generate rules. DEPTH ?= ../.. SUB_DEPTH = ../.. include $(PATH_KBUILD)/subheader.kmk # # Templates for the testcases. # TEMPLATE_TST = Testcase template ifeq ($(BUILD_TARGET),win) ifeq ($(BUILD_TARGET_ARCH),x86) TEMPLATE_TST_TOOL = VCC70 TEMPLATE_TST_CFLAGS = -W3 -Zi -Zl -MD TEMPLATE_TST_CXXFLAGS = -W3 -Zi -Zl -MD TEMPLATE_TST_LIBS = \ $(PATH_TOOL_VCC70_LIB)/oldnames.lib \ $(PATH_TOOL_VCC70_LIB)/msvcrt.lib else TEMPLATE_TST_TOOL = VCC80AMD64 TEMPLATE_TST_CFLAGS = -W3 -Zi -Zl -MD TEMPLATE_TST_CXXFLAGS = -W3 -Zi -Zl -MD TEMPLATE_TST_LIBS = \ $(PATH_TOOL_VCC80AMD64_LIB)/oldnames.lib \ $(PATH_TOOL_VCC80AMD64_LIB)/msvcrt.lib endif TEMPLATE_TST_CFLAGS.release = -O2 TEMPLATE_TST_CXXFLAGS.release = -O2 TEMPLATE_TST_ASFLAGS = -f win TEMPLATE_TST_DEFS = __WIN__ TEMPLATE_TST_SDKS.x86 = WIN32SDK TEMPLATE_TST_SDKS.amd64 = WIN64SDK else TEMPLATE_TST_CFLAGS = -Wall -pedantic -g TEMPLATE_TST_CFLAGS.release = -O2 TEMPLATE_TST_LDFLAGS = ifneq ($(filter os2,$(BUILD_TARGET)),) TEMPLATE_TST_TOOL = GCC3OMF TEMPLATE_TST_ASFLAGS = -f obj TEMPLATE_TST_LIBS = os2 gcc end else ifneq ($(filter darwin,$(BUILD_TARGET)),) TEMPLATE_TST_TOOL = GCC4MACHO TEMPLATE_TST_ASFLAGS = -f macho TEMPLATE_TST_DEFS = __DARWIN__ TEMPLATE_TST_LIBS = else TEMPLATE_TST_TOOL = GCC3 TEMPLATE_TST_ASFLAGS = -f elf TEMPLATE_TST_LIBS = gcc endif endif TEMPLATE_TST_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include TEMPLATE_TSTPROG = Testcase program template TEMPLATE_TSTPROG_EXTENDS = TST TEMPLATE_TSTDLL = Testcase dll template TEMPLATE_TSTDLL_EXTENDS = TST TEMPLATE_TSTBARE = Bare bone testcase template ifeq ($(BUILD_TARGET),win) ifeq ($(BUILD_TARGET_ARCH),x86) TEMPLATE_TSTBARE_TOOL = VCC70 else TEMPLATE_TSTBARE_TOOL = VCC80AMD64 endif TEMPLATE_TSTBARE_CFLAGS = -W3 -Zi -Zl TEMPLATE_TSTBARE_CFLAGS.release = -O2 TEMPLATE_TSTBARE_CXXFLAGS = -W3 -Zi -Zl TEMPLATE_TSTBARE_CXXFLAGS.release = -O2 TEMPLATE_TSTBARE_ASFLAGS = -f win TEMPLATE_TSTBARE_DEFS = __WIN__ TEMPLATE_TSTBARE_SDKS.x86 = WIN32SDK TEMPLATE_TSTBARE_SDKS.amd64 = WIN64SDK else TEMPLATE_TSTBARE_CFLAGS = -Wall -pedantic -g TEMPLATE_TSTBARE_CFLAGS.release = -O2 TEMPLATE_TSTBARE_LDFLAGS = -nostdlib -lgcc ifeq ($(filter-out os2,$(BUILD_TARGET)),) TEMPLATE_TSTBARE_TOOL = GCC3OMF TEMPLATE_TSTBARE_ASFLAGS = -f obj TEMPLATE_TSTBARE_ASTOOL = NASM TEMPLATE_TSTBARE_DEFS = main=main_wrapped TEMPLATE_TSTBARE_LIBS = os2 else ifeq ($(filter-out darwin,$(BUILD_TARGET)),) TEMPLATE_TSTBARE_TOOL = GCC4MACHO TEMPLATE_TSTBARE_ASFLAGS = -f macho TEMPLATE_TSTBARE_ASTOOL = NASM TEMPLATE_TSTBARE_DEFS = __DARWIN__ TEMPLATE_TSTBARE_LIBS = TEMPLATE_TSTBARE_CFLAGS += -static -fno-common TEMPLATE_TSTBARE_LDFLAGS += -nostdlib -r else TEMPLATE_TSTBARE_TOOL = GCC3 TEMPLATE_TSTBARE_ASFLAGS = -f elf TEMPLATE_TSTBARE_LIBS = gcc endif endif TEMPLATE_TSTBARE_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include TEMPLATE_TSTBAREPROG = Bare bone testcase program template TEMPLATE_TSTBAREPROG_EXTENDS = TSTBARE ifneq ($(filter win win32 win64,$(BUILD_TARGET)),) TEMPLATE_TSTBAREPROG_LDFLAGS += -Entry:WindowsMain -FIXED:NO else TEMPLATE_TSTBAREPROG_LDFLAGS.nt += -FIXED:NO endif TEMPLATE_TSTBAREDLL = Bare bone testcase dll template TEMPLATE_TSTBAREDLL_EXTENDS = TSTBARE ifeq ($(BUILD_TARGET),win) TEMPLATE_TSTBAREDLL_LDFLAGS += -Entry:DllMain else ifeq ($(BUILD_TARGET),darwin) # TEMPLATE_TSTBAREDLL_CFLAGS += -dynamiclib # TEMPLATE_TSTBAREDLL_LDFLAGS += -dynamiclib endif # # tst-0: four dlls, three of which depends on the 4th and no external dependencies. # The purpose of this testcase is to debug the dynamic loader without # messing with the native loader at all. # PROGRAMS += tst-0 tst-0-driver DLLS += tst-0-a tst-0-b tst-0-c tst-0-d tst-0-driver_TEMPLATE = TSTPROG tst-0-driver_SOURCES = tst-0-driver.c tst-0-a_TEMPLATE = TSTBAREDLL tst-0-a_SOURCES = tst-0-a.c tstDllMainStub.c tst-0-a_SOURCES.os2= tstDllMainStub-os2.asm tst-0-b_TEMPLATE = TSTBAREDLL tst-0-b_SOURCES = tst-0-b.c tstDllMainStub.c tst-0-b_SOURCES.os2= tstDllMainStub-os2.asm tst-0-c_TEMPLATE = TSTBAREDLL tst-0-c_SOURCES = tst-0-c.c tstDllMainStub.c tst-0-c_SOURCES.os2= tstDllMainStub-os2.asm tst-0-d_TEMPLATE = TSTBAREDLL tst-0-d_SOURCES = tst-0-d.c tstDllMainStub.c tst-0-d_SOURCES.os2= tstDllMainStub-os2.asm tst-0_TEMPLATE = TSTBAREPROG tst-0_SOURCES = tst-0.c tstExeMainStub.c tst-0_SOURCES.os2= tstExeMainStub-os2.asm ifeq ($(BUILD_TARGET),win) tst-0-driver_LIBS= $(PATH_LIB)/kLdr.lib tst-0-a_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib tst-0-b_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib tst-0-c_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib tst-0_LIBS = $(TARGET_tst-0-a:.dll=.lib) $(TARGET_tst-0-b:.dll=.lib) $(TARGET_tst-0-c:.dll=.lib) else tst-0-driver_LIBS= $(PATH_DLL)/kLdr$(SUFF_DLL) tst-0-a_LIBS = $(subst -a,-d,$(TARGET_tst-0-a)) tst-0-b_LIBS = $(subst -b,-d,$(TARGET_tst-0-b)) tst-0-c_LIBS = $(subst -c,-d,$(TARGET_tst-0-c)) tst-0_LIBS = $(TARGET_tst-0-a) $(TARGET_tst-0-b) $(TARGET_tst-0-c) endif # # tst-1: four dlls, three of which depends on the 4th and the testcase depends on those three again. # PROGRAMS += tst-1 DLLS += tst-1-a tst-1-b tst-1-c tst-1-d tst-1-a_TEMPLATE = TSTDLL tst-1-a_SOURCES = tst-1-a.c tstDllMain.c tst-1-b_TEMPLATE = TSTDLL tst-1-b_SOURCES = tst-1-b.c tstDllMain.c tst-1-c_TEMPLATE = TSTDLL tst-1-c_SOURCES = tst-1-c.c tstDllMain.c tst-1-d_TEMPLATE = TSTDLL tst-1-d_SOURCES = tst-1-d.c tstDllMain.c tst-1_TEMPLATE = TSTPROG tst-1_SOURCES = tst-1.c ifeq ($(BUILD_TARGET),win) tst-1-a_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib tst-1-b_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib tst-1-c_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib tst-1_LIBS = $(TARGET_tst-1-a:.dll=.lib) $(TARGET_tst-1-b:.dll=.lib) $(TARGET_tst-1-c:.dll=.lib) else tst-1-a_LIBS = $(subst -a,-d,$(TARGET_tst-1-a)) tst-1-b_LIBS = $(subst -b,-d,$(TARGET_tst-1-b)) tst-1-c_LIBS = $(subst -c,-d,$(TARGET_tst-1-c)) tst-1_LIBS = $(TARGET_tst-1-a) $(TARGET_tst-1-b) $(TARGET_tst-1-c) endif # # tst-2: four dlls, three of which depends on the 1st, and the testcase depends on those all of them. # PROGRAMS += tst-2 DLLS += tst-2-a tst-2-b tst-2-c tst-2-d tst-2-a_TEMPLATE = TSTDLL tst-2-a_SOURCES = tst-2-a.c tstDllMain.c tst-2-b_TEMPLATE = TSTDLL tst-2-b_SOURCES = tst-2-b.c tstDllMain.c tst-2-c_TEMPLATE = TSTDLL tst-2-c_SOURCES = tst-2-c.c tstDllMain.c tst-2-d_TEMPLATE = TSTDLL tst-2-d_SOURCES = tst-2-d.c tstDllMain.c tst-2_TEMPLATE = TSTPROG tst-2_SOURCES = tst-2.c ifeq ($(BUILD_TARGET),win) tst-2-b_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib tst-2-c_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib tst-2-d_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib tst-2_LIBS = $(TARGET_tst-2-b:.dll=.lib) $(TARGET_tst-2-c:.dll=.lib) $(TARGET_tst-2-d:.dll=.lib) $(TARGET_tst-2-a:.dll=.lib) else tst-2-b_LIBS = $(subst -b,-a,$(TARGET_tst-2-b)) tst-2-c_LIBS = $(subst -c,-a,$(TARGET_tst-2-c)) tst-2-d_LIBS = $(subst -d,-a,$(TARGET_tst-2-d)) tst-2_LIBS = $(TARGET_tst-2-a) $(TARGET_tst-2-b) $(TARGET_tst-2-c) $(TARGET_tst-2-d) endif # # tst-3: Single module. # PROGRAMS += tst-3-driver ifeq ($(BUILD_TARGET),darwin) SYSMODS += tst-3 else DLLS += tst-3 LIBRARIES.win += tst-3-imp LIBRARIES.os2 += tst-3-imp endif tst-3_TEMPLATE = TSTBAREDLL tst-3_SOURCES = tst-3.c tst-3-ext.c tstDllMainStub.c tst-3_SOURCES.os2= tstDllMainStub-os2.asm tst-3_LIBS.os2 = $(TARGET_tst-3-imp) tst-3_LIBS.win = $(TARGET_tst-3-imp) tst-3-imp_TEMPLATE = TSTBAREDLL tst-3-imp_SOURCES.win = tst-3-imp-win.def tst-3-imp_SOURCES.os2 = tst-3-imp-os2.def tst-3-driver_TEMPLATE = TSTPROG tst-3-driver_SOURCES = tst-3-driver.c ifeq ($(BUILD_TARGET),win) tst-3-driver_LIBS = $(PATH_LIB)/kLdr.lib else tst-3-driver_LIBS = $(PATH_DLL)/kLdr$(SUFF_DLL) endif # generate rules. include $(PATH_KBUILD)/subfooter.kmk ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-0-c.c��������������������������������������������������0000664�0001750�0001750�00000000266�14670377514�021571� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "c"; MY_IMPORT(int) FuncD(void); MY_EXPORT(int) FuncC(void) { return FuncD() | (g_pszName[0] == 'c' ? 0x420000 : 0x0100); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-3-imp-os2.def������������������������������������������0000664�0001750�0001750�00000002460�14670377514�023152� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; $Id: tst-3-imp-os2.def 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - Dynamic Loader testcase no. 3, Fake module import library - OS/2. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; LIBRARY tst-3-imp EXPORTS _Tst3Ext ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-0-driver.c���������������������������������������������0000664�0001750�0001750�00000052361�14670377513�022644� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tst-0-driver.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Dynamic Loader testcase no. 0, Driver. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "tst.h" #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** Select the appropriate KLDRSYMKIND bit define. */ #define MY_KLDRSYMKIND_BITS ( sizeof(void *) == 4 ? KLDRSYMKIND_32BIT : KLDRSYMKIND_64BIT ) /******************************************************************************* * Global Variables * *******************************************************************************/ /** The numbers of errors. */ static int g_cErrors = 0; /** * Report failure. */ static int Failure(const char *pszFormat, ...) { va_list va; g_cErrors++; printf("tst-0-driver: "); va_start(va, pszFormat); vprintf(pszFormat, va); va_end(va); printf("\n"); return 1; } int main(int argc, char **argv) { const char *pszErrInit = "Error, szErr wasn't zapped"; char szErr[512]; char szBuf[512]; char *psz; KSIZE cch; HKLDRMOD hMod; int rc; /* * The first thing to do is a simple load / unload test * using the tst-0-a library (it'll drag in tst-0-d). */ printf("tst-0-driver: Basic API test using 'tst-0-a'...\n"); hMod = (HKLDRMOD)0xffffeeee; strcpy(szErr, pszErrInit); rc = kLdrDyldLoad("tst-0-a", NULL, NULL, KLDRDYLD_SEARCH_HOST, KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT, &hMod, szErr, sizeof(szErr)); if (rc) Failure("kLdrDyldLoad(\"tst-0\",...) failed, rc=%d (%#x). szErr='%s'.\n", rc, rc, szErr); if (!strcmp(szErr, pszErrInit)) Failure("szErr wasn't set.\n"); if (hMod == (HKLDRMOD)0xffffeeee) Failure("hMod wasn't set.\n"); if (hMod == NIL_HKLDRMOD && !rc) Failure("rc=0 but hMod=NIL_HKLDRMOD\n"); if (!rc) { HKLDRMOD hMod2; HKLDRMOD hMod3; printf("tst-0-driver: hMod=%p ('tst-0-a')\n", (void *)hMod); /* * Simple test of kLdrDyldFindByName. */ hMod2 = (HKLDRMOD)0xffffeeee; rc = kLdrDyldFindByName("tst-0", NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hMod2); if (!rc) Failure("kLdrDyldFindByName(\"tst-0\",,,) didn't fail!\n"); if (rc && hMod2 != NIL_HKLDRMOD) Failure("hMod2 wasn't set correctly on kLdrDyldFindByName failure!\n"); hMod2 = (HKLDRMOD)0xffffeeee; rc = kLdrDyldFindByName("tst-0-a", NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hMod2); if (rc) Failure("kLdrDyldFindByName(\"tst-0-a\",,,) failed, rc=%d (%#x)\n", rc, rc); if (!rc && hMod2 != hMod) Failure("kLdrDyldFindByName(\"tst-0-a\",,,) returned the wrong module handle: %p instead of %p\n", (void *)hMod2, (void *)hMod); hMod2 = (HKLDRMOD)0xffffeeee; rc = kLdrDyldFindByName("tst-0-d", NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hMod2); if (!rc) printf("tst-0-driver: hMod2=%p ('tst-0-d')\n", (void *)hMod2); else Failure("kLdrDyldFindByName(\"tst-0-d\",,,) failed, rc=%d (%#x)\n", rc, rc); /* * Get the name and filename for each of the two modules. */ rc = kLdrDyldGetName(hMod2, szBuf, sizeof(szBuf)); if (!rc) { printf("tst-0-driver: name: '%s' ('tst-0-d')\n", szBuf); psz = strstr(szBuf, "-0-"); if ( !psz || strnicmp(psz, "-0-d", sizeof("-0-d") - 1)) Failure("kLdrDyldGetName(\"tst-0-d\",,,) -> '%s': pattern '-0-d' not found\n", szBuf); /* overflow test. */ cch = strlen(szBuf); szBuf[cch + 1] = szBuf[cch] = szBuf[cch - 1] = 'x'; szBuf[cch + 2] = '\0'; rc = kLdrDyldGetName(hMod2, szBuf, cch); if (rc == KERR_BUFFER_OVERFLOW) { if (!szBuf[0]) Failure("kLdrDyldGetName didn't return partial result on overflow\n"); else if (szBuf[cch - 1]) Failure("kLdrDyldGetName didn't terminate partial result correctly overflow: '%s'\n", szBuf); else if (szBuf[cch] != 'x') Failure("kLdrDyldGetName exceeded the buffer limit on partial overflow: '%s'\n", szBuf); } else Failure("kLdrDyldGetName(\"tst-0-d\",,,) -> rc=%d (%#x) instead of KERR_BUFFER_OVERFLOW\n", rc, rc); /* check that we can query the module by the returned name. */ rc = kLdrDyldGetName(hMod2, szBuf, sizeof(szBuf)); if (!rc) { hMod3 = (HKLDRMOD)0xffffeeee; rc = kLdrDyldFindByName(szBuf, NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hMod3); if (rc || hMod3 != hMod2) Failure("kLdrDyldFindByName(\"%s\",,,) failed, rc=%d (%#x) hMod3=%p hMod2=%p\n", szBuf, rc, rc, (void *)hMod3, (void *)hMod2); } else Failure("kLdrDyldGetName(\"tst-0-d\",,,) failed (b), rc=%d (%#x)\n", rc, rc); } else Failure("kLdrDyldGetName(\"tst-0-d\",,,) failed, rc=%d (%#x)\n", rc, rc); rc = kLdrDyldGetFilename(hMod2, szBuf, sizeof(szBuf)); if (!rc) { printf("tst-0-driver: filename: '%s' ('tst-0-d')\n", szBuf); /* overflow test. */ cch = strlen(szBuf); szBuf[cch + 1] = szBuf[cch] = szBuf[cch - 1] = 'x'; szBuf[cch + 2] = '\0'; rc = kLdrDyldGetFilename(hMod2, szBuf, cch); if (rc == KERR_BUFFER_OVERFLOW) { if (!szBuf[0]) Failure("kLdrDyldGetFilename didn't return partial result on overflow\n"); else if (szBuf[cch - 1]) Failure("kLdrDyldGetFilename didn't terminate partial result correctly overflow: '%s'\n", szBuf); else if (szBuf[cch] != 'x') Failure("kLdrDyldGetFilename exceeded the buffer limit on partial overflow: '%s'\n", szBuf); } else Failure("kLdrDyldGetFilename(\"tst-0-d\",,,) -> rc=%d (%#x) instead of KERR_BUFFER_OVERFLOW\n", rc, rc); /* check that we can query the module by the returned filename. */ rc = kLdrDyldGetFilename(hMod2, szBuf, sizeof(szBuf)); if (!rc) { hMod3 = (HKLDRMOD)0xffffeeee; rc = kLdrDyldFindByName(szBuf, NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hMod3); if (rc || hMod3 != hMod2) Failure("kLdrDyldFindByName(\"%s\",,,) failed, rc=%d (%#x) hMod3=%p hMod2=%p\n", szBuf, rc, rc, (void *)hMod3, (void *)hMod2); } else Failure("kLdrDyldGetName(\"tst-0-d\",,,) failed (b), rc=%d (%#x)\n", rc, rc); } else Failure("kLdrDyldGetFilename(\"tst-0-d\",,,) failed, rc=%d (%#x)\n", rc, rc); /* the other module */ rc = kLdrDyldGetName(hMod, szBuf, sizeof(szBuf)); if (!rc) { printf("tst-0-driver: name: '%s' ('tst-0-a')\n", szBuf); psz = strstr(szBuf, "-0-"); if ( !psz || strnicmp(psz, "-0-a", sizeof("-0-a") - 1)) Failure("kLdrDyldGetName(\"tst-0-a\",,,) -> '%s': pattern '-0-a' not found\n", szBuf); /* check that we can query the module by the returned name. */ hMod3 = (HKLDRMOD)0xffffeeee; rc = kLdrDyldFindByName(szBuf, NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hMod3); if (rc || hMod3 != hMod) Failure("kLdrDyldFindByName(\"%s\",,,) failed, rc=%d (%#x) hMod3=%p hMod=%p\n", szBuf, rc, rc, (void *)hMod3, (void *)hMod); } else Failure("kLdrDyldGetName(\"tst-0-a\",,,) failed, rc=%d (%#x)\n", rc, rc); rc = kLdrDyldGetFilename(hMod, szBuf, sizeof(szBuf)); if (!rc) { printf("tst-0-driver: filename: '%s' ('tst-0-a')\n", szBuf); /* check that we can query the module by the returned filename. */ hMod3 = (HKLDRMOD)0xffffeeee; rc = kLdrDyldFindByName(szBuf, NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hMod3); if (rc || hMod3 != hMod) Failure("kLdrDyldFindByName(\"%s\",,,) failed, rc=%d (%#x) hMod3=%p hMod=%p\n", szBuf, rc, rc, (void *)hMod3, (void *)hMod); } else Failure("kLdrDyldGetFilename(\"tst-0-a\",,,) failed, rc=%d (%#x)\n", rc, rc); /* * Resolve the symbol exported by each of the two modules and call them. */ if (!g_cErrors) { KUPTR uValue; KU32 fKind; fKind = 0xffeeffee; uValue = ~(KUPTR)42; rc = kLdrDyldQuerySymbol(hMod, NIL_KLDRMOD_SYM_ORDINAL, MY_NAME("FuncA"), NULL, &uValue, &fKind); if (!rc) { if (uValue == ~(KUPTR)42) Failure("kLdrDyldQuerySymbol(\"tst-0-a\",,\"FuncA\",): uValue wasn't set.\n"); if (fKind == 0xffeeffee) Failure("kLdrDyldQuerySymbol(\"tst-0-a\",,\"FuncA\",): fKind wasn't set.\n"); if ( (fKind & KLDRSYMKIND_BIT_MASK) != KLDRSYMKIND_NO_BIT && (fKind & KLDRSYMKIND_BIT_MASK) != MY_KLDRSYMKIND_BITS) Failure("fKind=%#x indicates a different code 'bit' mode than we running at.\n", fKind); if ( (fKind & KLDRSYMKIND_TYPE_MASK) != KLDRSYMKIND_NO_TYPE && (fKind & KLDRSYMKIND_TYPE_MASK) != KLDRSYMKIND_CODE) Failure("fKind=%#x indicates that \"FuncA\" isn't code.\n", fKind); if (fKind & KLDRSYMKIND_FORWARDER) Failure("fKind=%#x indicates that \"FuncA\" is a forwarder. it isn't.\n", fKind); /* call it. */ if (!g_cErrors) { int (*pfnFuncA)(void) = (int (*)(void))uValue; rc = pfnFuncA(); if (rc != 0x42000042) Failure("FuncA returned %#x expected 0x42000042\n", rc); } /* * Test kLdrDyldFindByAddress now that we've got an address. */ hMod3 = (HKLDRMOD)0xeeeeffff; rc = kLdrDyldFindByAddress(uValue, &hMod3, NULL, NULL); if (!rc) { KUPTR offSegment; KU32 iSegment; if (hMod3 != hMod) Failure("kLdrDyldFindByAddress(%#p/*FuncA*/, \"tst-0-a\",,,) return incorrect hMod3=%p instead of %p.\n", uValue, hMod3, hMod); hMod3 = (HKLDRMOD)0xeeeeffff; iSegment = 0x42424242; rc = kLdrDyldFindByAddress(uValue, &hMod3, &iSegment, &offSegment); if (!rc) { if (hMod3 != hMod) Failure("Bad hMod3 on 2nd kLdrDyldFindByAddress call.\n"); if (iSegment > 0x1000) /* safe guess */ Failure("Bad iSegment=%#x\n", iSegment); if (offSegment > 0x100000) /* guesswork */ Failure("Bad offSegment=%p\n", (void *)offSegment); } else Failure("kLdrDyldFindByAddress(%#p/*FuncA*/, \"tst-0-a\",,,) failed (b), rc=%d (%#x)\n", uValue, rc, rc); /* negative test */ hMod3 = (HKLDRMOD)0xeeeeffff; iSegment = 0x42424242; offSegment = 0x87654321; rc = kLdrDyldFindByAddress(~(KUPTR)16, &hMod3, &iSegment, &offSegment); if (!rc) Failure("negative kLdrDyldFindByAddress test returned successfully!\n"); if (iSegment != ~(KU32)0) Failure("negative kLdrDyldFindByAddress: bad iSegment=%#x\n", iSegment); if (offSegment != ~(KUPTR)0) Failure("negative kLdrDyldFindByAddress: bad offSegment=%p\n", (void *)offSegment); if (hMod3 != NIL_HKLDRMOD) Failure("negative kLdrDyldFindByAddress: bad hMod3=%p\n", (void *)hMod3); } else Failure("kLdrDyldFindByAddress(%#p/*FuncA*/, \"tst-0-a\",,,) failed, rc=%d (%#x)\n", uValue, rc, rc); } else Failure("kLdrDyldQuerySymbol(\"tst-0-a\",,\"FuncA\",) failed, rc=%d (%#x)\n", rc, rc); fKind = 0xffeeffee; uValue = ~(KUPTR)42; rc = kLdrDyldQuerySymbol(hMod2, NIL_KLDRMOD_SYM_ORDINAL, MY_NAME("FuncD"), NULL, &uValue, &fKind); if (!rc) { if (uValue == ~(KUPTR)42) Failure("kLdrDyldQuerySymbol(\"tst-0-d\",,\"FuncD\",): uValue wasn't set.\n"); if (fKind == 0xffeeffee) Failure("kLdrDyldQuerySymbol(\"tst-0-d\",,\"FuncD\",): fKind wasn't set.\n"); if ( (fKind & KLDRSYMKIND_BIT_MASK) != KLDRSYMKIND_NO_BIT && (fKind & KLDRSYMKIND_BIT_MASK) != MY_KLDRSYMKIND_BITS) Failure("fKind=%#x indicates a different code 'bit' mode than we running at.\n", fKind); if ( (fKind & KLDRSYMKIND_TYPE_MASK) != KLDRSYMKIND_NO_TYPE && (fKind & KLDRSYMKIND_TYPE_MASK) != KLDRSYMKIND_CODE) Failure("fKind=%#x indicates that \"FuncD\" isn't code.\n", fKind); if (fKind & KLDRSYMKIND_FORWARDER) Failure("fKind=%#x indicates that \"FuncD\" is a forwarder. it isn't.\n", fKind); /* call it. */ if (!g_cErrors) { int (*pfnFuncD)(void) = (int (*)(void))uValue; rc = pfnFuncD(); if (rc != 0x42000000) Failure("FuncD returned %#x expected 0x42000000\n", rc); } /* use the address to get the module handle. */ hMod3 = (HKLDRMOD)0xeeeeffff; rc = kLdrDyldFindByAddress(uValue, &hMod3, NULL, NULL); if (!rc) { if (hMod3 != hMod2) Failure("kLdrDyldFindByAddress(%#p/*FuncD*/,,,) return incorrect hMod3=%p instead of %p.\n", uValue, hMod3, hMod2); } else Failure("kLdrDyldFindByAddress(%#p/*FuncD*/,,,) failed, rc=%d (%#x)\n", uValue, rc, rc); } else Failure("kLdrDyldQuerySymbol(\"tst-0-a\",,\"FuncA\",) failed, rc=%d (%#x)\n", rc, rc); } /* * Finally unload it. */ rc = kLdrDyldUnload(hMod); if (rc) Failure("kLdrDyldUnload() failed. rc=%d (%#x)\n", rc, rc); if (!rc) { rc = kLdrDyldFindByName("tst-0-d", NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hMod2); if (rc != KLDR_ERR_MODULE_NOT_FOUND) Failure("kLdrDyldFindByName(\"tst-0-d\",,,) return rc=%d (%#x), expected KLDR_ERR_MODULE_NOT_FOUND\n", rc, rc); rc = kLdrDyldFindByName("tst-0-a", NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hMod2); if (rc != KLDR_ERR_MODULE_NOT_FOUND) Failure("kLdrDyldFindByName(\"tst-0-a\",,,) return rc=%d (%#x), expected KLDR_ERR_MODULE_NOT_FOUND\n", rc, rc); } } /* * Now do what tst-0 would do; load the three dlls, resolve and call their functions. */ if (!g_cErrors) { HKLDRMOD hModA; int (*pfnFuncA)(void); HKLDRMOD hModB; int (*pfnFuncB)(void); HKLDRMOD hModC; int (*pfnFuncC)(void); KUPTR uValue; rc = kLdrDyldLoad("tst-0-a", NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hModA, NULL, 0); if (rc) Failure("kLdrDyldLoad(\"tst-0-a\",,,,) -> %d (%#x)\n", rc, rc); if (!rc) { rc = kLdrDyldLoad("tst-0-b", NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hModB, szErr, sizeof(szErr)); if (rc) Failure("kLdrDyldLoad(\"tst-0-b\",,,,) -> %d (%#x) szErr='%s'\n", rc, rc, szErr); } if (!rc) { rc = kLdrDyldLoad("tst-0-c", NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hModC, szErr, sizeof(szErr)); if (rc) Failure("kLdrDyldLoad(\"tst-0-c\",,,,) -> %d (%#x) szErr='%s'\n", rc, rc, szErr); } if (!rc) { rc = kLdrDyldQuerySymbol(hModA, NIL_KLDRMOD_SYM_ORDINAL, MY_NAME("FuncA"), NULL, &uValue, NULL); if (!rc) pfnFuncA = (int (*)(void))uValue; else Failure("kLdrDyldQuerySymbol(,,\"FuncA\",,) -> %d (%#x)\n", rc, rc); } if (!rc) { rc = kLdrDyldQuerySymbol(hModB, NIL_KLDRMOD_SYM_ORDINAL, MY_NAME("FuncB"), NULL, &uValue, NULL); if (!rc) pfnFuncB = (int (*)(void))uValue; else Failure("kLdrDyldQuerySymbol(,,\"FuncB\",,) -> %d (%#x)\n", rc, rc); } if (!rc) { rc = kLdrDyldQuerySymbol(hModC, NIL_KLDRMOD_SYM_ORDINAL, MY_NAME("FuncC"), NULL, &uValue, NULL); if (!rc) pfnFuncC = (int (*)(void))uValue; else Failure("kLdrDyldQuerySymbol(,,\"FuncA\",,) -> %d (%#x)\n", rc, rc); } if (!rc) { int u = pfnFuncA() | pfnFuncB() | pfnFuncC(); if (u == 0x42424242) printf("tst-0-driver: FuncA/B/C => %#x (correct)\n", u); else Failure("FuncA/B/C => %#x\n", u); rc = kLdrDyldUnload(hModA); if (rc) Failure("Unload A failed, rc=%d (%#x)\n", rc, rc); u = pfnFuncB() | pfnFuncC(); if (u != 0x42424200) Failure("FuncB/C returns %#x instead of 0x42424200 after unloading A\n", u); rc = kLdrDyldUnload(hModB); if (rc) Failure("Unload B failed, rc=%d (%#x)\n", rc, rc); u = pfnFuncC(); if (u != 0x42420000) Failure("FuncC returns %#x instead of 0x42420000 after unloading A\n", u); rc = kLdrDyldUnload(hModC); if (rc) Failure("Unload C failed, rc=%d (%#x)\n", rc, rc); rc = kLdrDyldFindByName("tst-0-d", NULL, NULL, KLDRDYLD_SEARCH_HOST, 0, &hMod); if (rc != KLDR_ERR_MODULE_NOT_FOUND) Failure("Query for \"tst-0-d\" after unloading A,B and C returns rc=%d (%#x) instead of KLDR_ERR_MODULE_NOT_FOUND\n", rc, rc); } } /* * Now invoke the executable stub which launches the tst-0 program. */ if (!g_cErrors) { /// @todo } /* * Summary */ if (!g_cErrors) printf("tst-0-driver: SUCCESS\n"); else printf("tst-0-driver: FAILURE - %d errors\n", g_cErrors); return !!g_cErrors; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-3-imp-win.def������������������������������������������0000664�0001750�0001750�00000002462�14670377513�023245� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; $Id: tst-3-imp-win.def 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - Dynamic Loader testcase no. 3, Fake module import library - Windows. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; LIBRARY tst-3-imp EXPORTS Tst3Ext ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-0-a.c��������������������������������������������������0000664�0001750�0001750�00000000262�14670377513�021562� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "a"; MY_IMPORT(int) FuncD(void); MY_EXPORT(int) FuncA(void) { return FuncD() | (g_pszName[0] == 'a' ? 0x42 : 0x0001); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-0.c����������������������������������������������������0000664�0001750�0001750�00000000335�14670377514�021346� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" MY_IMPORT(int) FuncA(void); MY_IMPORT(int) FuncB(void); MY_IMPORT(int) FuncC(void); int main() { unsigned u; u = FuncA() | FuncB() | FuncC(); return u == 0x42424242 ? 0 : 1; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-1-a.c��������������������������������������������������0000664�0001750�0001750�00000000212�14670377514�021557� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "a"; MY_IMPORT(int) FuncD(void); MY_EXPORT(int) FuncA(void) { return FuncD(); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-3.c����������������������������������������������������0000664�0001750�0001750�00000004172�14670377513�021353� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tst-3.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Dynamic Loader testcase no. 3, Driver. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #include "tst.h" int g_i1 = 1; int g_i2 = 2; int *g_pi1 = &g_i1; extern int Tst3Sub(int); int (*g_pfnTst3Sub)(int) = &Tst3Sub; MY_IMPORT(int) Tst3Ext(int); int (*g_pfnTst3Ext)(int) = &Tst3Ext; char g_achBss[256]; MY_EXPORT(int) Tst3(int iFortyTwo) { int rc; if (iFortyTwo != 42) return 0; if (g_i1 != 1) return 1; if (g_i2 != 2) return 2; if (g_pi1 != &g_i1) return 3; if (g_pfnTst3Sub != &Tst3Sub) return 4; rc = Tst3Sub(iFortyTwo); if (rc != g_pfnTst3Sub(iFortyTwo)) return 5; rc = Tst3Ext(iFortyTwo); if (rc != 42) return 6; rc = g_pfnTst3Ext(iFortyTwo); if (rc != 42) return 7; for (rc = 0; rc < sizeof(g_achBss); rc++) if (g_achBss[rc]) return 8; if (g_achBss[0] || g_achBss[1] || g_achBss[255]) return 9; return 42; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-3-ext.c������������������������������������������������0000664�0001750�0001750�00000002571�14670377513�022152� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tst-3-ext.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Dynamic Loader testcase no. 3, 2nd object module. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #include "tst.h" extern int g_i1; int Tst3Sub(int iFortyTwo) { return iFortyTwo * 11 * g_i1; } ���������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tstExeMainStub-os2.asm�������������������������������������0000664�0001750�0001750�00000002621�14670377513�024354� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; $Id: tstExeMainStub-os2.asm 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - OS/2 entry point thingy... ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; segment TEXT32 public CLASS=CODE align=16 use32 extern OS2Main ..start: jmp OS2Main segment DATA32 stack CLASS=DATA align=16 use32 global WEAK$ZERO WEAK$ZERO EQU 0 ���������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-1-d.c��������������������������������������������������0000664�0001750�0001750�00000000145�14670377514�021567� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "d"; MY_EXPORT(int) FuncD(void) { return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-1-b.c��������������������������������������������������0000664�0001750�0001750�00000000212�14670377514�021560� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "b"; MY_IMPORT(int) FuncD(void); MY_EXPORT(int) FuncB(void) { return FuncD(); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-0-b.c��������������������������������������������������0000664�0001750�0001750�00000000264�14670377513�021565� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "b"; MY_IMPORT(int) FuncD(void); MY_EXPORT(int) FuncB(void) { return FuncD() | (g_pszName[0] == 'b' ? 0x4200 : 0x0010); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tstDllMain.c�����������������������������������������������0000664�0001750�0001750�00000011570�14670377513�022454� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tstDllMain.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr testcase. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "tst.h" #if K_OS == K_OS_OS2 # define INCL_BASE # include <os2.h> # include <string.h> #elif K_OS == K_OS_WINDOWS # include <windows.h> # include <string.h> #elif K_OS == K_OS_DARWIN # include <unistd.h> # include <string.h> #else # error "port me" #endif /******************************************************************************* * Internal Functions * *******************************************************************************/ void tstWrite(const char *psz); #if K_OS == K_OS_OS2 /** * OS/2 DLL 'main' */ ULONG _System _DLL_InitTerm(HMODULE hmod, ULONG fFlags) { switch (fFlags) { case 0: tstWrite("init: "); tstWrite(g_pszName); tstWrite("\n"); return TRUE; case 1: tstWrite("term: "); tstWrite(g_pszName); tstWrite("\n"); return TRUE; default: tstWrite("!invalid!: "); tstWrite(g_pszName); tstWrite("\n"); return FALSE; } } #elif K_OS == K_OS_WINDOWS /** * OS/2 DLL 'main' */ BOOL __stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved) { switch (dwReason) { case DLL_PROCESS_ATTACH: tstWrite("init: "); tstWrite(g_pszName); tstWrite("\n"); return TRUE; case DLL_PROCESS_DETACH: tstWrite("term: "); tstWrite(g_pszName); tstWrite("\n"); return TRUE; case DLL_THREAD_ATTACH: tstWrite("thread init: "); tstWrite(g_pszName); tstWrite("\n"); return TRUE; case DLL_THREAD_DETACH: tstWrite("thread term: "); tstWrite(g_pszName); tstWrite("\n"); return TRUE; default: tstWrite("!invalid!: "); tstWrite(g_pszName); tstWrite("\n"); return FALSE; } } #elif K_OS == K_OS_DARWIN /* later */ #else # error "port me" #endif /** * Writes a string with unix lineendings. * * @param pszMsg The string. */ void tstWrite(const char *pszMsg) { #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS /* * Line by line. */ ULONG cbWritten; const char *pszNl = strchr(pszMsg, '\n'); while (pszNl) { cbWritten = pszNl - pszMsg; #if K_OS == K_OS_OS2 if (cbWritten) DosWrite((HFILE)2, pszMsg, cbWritten, &cbWritten); DosWrite((HFILE)2, "\r\n", 2, &cbWritten); #else if (cbWritten) WriteFile((HANDLE)STD_ERROR_HANDLE, pszMsg, cbWritten, &cbWritten, NULL); WriteFile((HANDLE)STD_ERROR_HANDLE, "\r\n", 2, &cbWritten, NULL); #endif /* next */ pszMsg = pszNl + 1; pszNl = strchr(pszMsg, '\n'); } /* * Remaining incomplete line. */ if (*pszMsg) { cbWritten = strlen(pszMsg); #if K_OS == K_OS_OS2 DosWrite((HFILE)2, pszMsg, cbWritten, &cbWritten); #else WriteFile((HANDLE)STD_ERROR_HANDLE, pszMsg, cbWritten, &cbWritten, NULL); #endif } #elif K_OS == K_OS_DARWIN write(STDERR_FILENO, pszMsg, strlen(pszMsg)); #else # error "port me" #endif } ����������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-2-b.c��������������������������������������������������0000664�0001750�0001750�00000000212�14670377514�021561� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "b"; MY_IMPORT(int) FuncA(void); MY_EXPORT(int) FuncB(void) { return FuncA(); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tstDllMainStub-os2.asm�������������������������������������0000664�0001750�0001750�00000002635�14670377514�024354� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; $Id: tstDllMainStub-os2.asm 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - OS/2 entry point thingy... ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; segment TEXT32 public CLASS=CODE align=16 use32 extern _DLL_InitTerm ..start: jmp _DLL_InitTerm segment DATA32 stack CLASS=DATA align=16 use32 global WEAK$ZERO WEAK$ZERO EQU 0 ���������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/bin/�������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�021002� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/bin/tst-3.rel.darwin.x86�����������������������������������0000664�0001750�0001750�00000005360�14670377514�024373� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Îúíþ������������l��� ���������������������������`��ˆ��P���������������__text����������__TEXT��������������:��ˆ������Ø����������������__data����������__DATA����������<�����Ä�����X�����������������__common��������__DATA����������`�������������������������������������p��Q���<��´�����P���������������������������������������������������������������������U‰åSƒìƒ}*t1ÀƒÄ[]Ã=L��…¿���ƒ=H��…¼���=D��L��…Ž���=@��%��uLÇ$*���èÎ���‰ÃÇ$*���ÿ@��9ÃumÇ$*���èŠÿÿÿƒø*uzÇ$*���ÿ<��ƒø*t¸���éxÿÿÿ¸���énÿÿÿ€=`���uº`��¹_��9ÑtG¶BƒÂ„Àtñ¸���éBÿÿÿ¸���é8ÿÿÿ¸���é.ÿÿÿ¸���é$ÿÿÿ¸���éÿÿÿ¸���éÿÿÿ€=a���u €=_���t ¸ ���éôþÿÿ¸*���éêþÿÿU‰å‹U¯L��’B]Ã������%��L�������� � `��� `��°�� `��«�����£�����„�����r���P�� b�����S�����E�����A�����5�����1�����$����������.������������������P�� U���d��������d�����Ì���f�������Í���<�������Ü���€�����������.����������D-���������D0��������DJ��������D2��������D4�"�������D6�/�������D8�?�������D:�K�������D;�Y�������D=�j�������D>�v�������D@�{�������DA�ˆ�������D8�—�������DD�¡�������DC�´�������DD�¸�������DF�Ã�������D6�Í�������D;�×�������D2�á�������D4�ë�������D>�õ�������DF�ÿ���ê���$-�����ö��� �,������@�.������€�������;��À������<��à��%��=��$���%������N��%��>�� ������J�� � �����V�� �!�����c��€�������r�� �$�����†�� �'�����š�� �)�����ª��€�������¹��€�������Õ��€�������ä��€���������€�������.��d��%��/��d�%��g��d�%��ª��f�������«��<�������º��€�����������.��%������D!�%������D!�+������D#�8��È��$!�%��×�� � ����è��€���������$����������N��:����d��:����d�����L��d�����”��f�������•��<�������¤��€�������²��d���������������L�����%�� �����`�������L�������H�� �����<��.�����@��<�����D��C��������������_Tst3�_g_achBss�_g_i1�_g_i2�_g_pfnTst3Ext�_g_pfnTst3Sub�_g_pi1�_Tst3Ext�_Tst3Sub�/Users/bird/vax/gdrive/coding/libc/trunk/kLdr/testcase/�/Users/bird/vax/gdrive/coding/libc/trunk/kLdr/testcase/tst-3.c��gcc2_compiled.�:t(0,1)=(0,1)�Tst3:F(0,2)�iFortyTwo:p(0,2)�rc:r(0,2)�int:t(0,2)=r(0,2);-2147483648;2147483647;����g_i1:G(0,2)�g_i2:G(0,2)�g_pi1:G(0,3)�:t(0,3)=*(0,2)�g_pfnTst3Sub:G(0,4)�g_pfnTst3Ext:G(0,4)�g_achBss:G(0,5)�:t(0,4)=*(0,6)�:t(0,5)=ar(0,7);0;255;(0,8)�:t(0,6)=f(0,2)�long unsigned int:t(0,7)=r(0,7);0;037777777777;�char:t(0,8)=r(0,8);0;127;��/Users/bird/vax/gdrive/coding/libc/trunk/kLdr/testcase/�/Users/bird/vax/gdrive/coding/libc/trunk/kLdr/testcase/tst-3-ext.c��gcc2_compiled.�:t(0,1)=(0,1)�Tst3Sub:F(0,2)�iFortyTwo:p(0,2)�int:t(0,2)=r(0,2);-2147483648;2147483647;���/Users/bird/vax/gdrive/coding/libc/trunk/kLdr/testcase/�/Users/bird/vax/gdrive/coding/libc/trunk/kLdr/testcase/tstDllMainStub.c��gcc2_compiled.�:t(0,1)=(0,1)�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/bin/tst-3.dll.win.x86��������������������������������������0000664�0001750�0001750�00000006000�14670377514�023665� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������MZ�������ÿÿ��¸�������@�����������������������������������È���º�´ Í!¸LÍ!This program cannot be run in DOS mode. $�������ÁEðÜ…$ž…$ž…$ž€(Æ$ž…$Ÿ„$ž€(Á†$ž€(„$ž€(Ä„$žRich…$ž��������PE��L�&;ÒE��������à�!  ����������P������ ��������������������������P������������������������������€ ��A���, ��(����������������������������@��4��� ���������������������������������������������� �����������������������������.text���b����������������������� ��`.rdata��%��� ��������������������@��@.data��� ���0��������������������@��À.reloc��@����@������ ��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������U‹ìQƒ}*t3Àé��ƒ=�0�t ¸���é��ƒ=0�t ¸���éï���=0��0�t ¸���éÙ���= 0�0�t ¸���éÃ���‹EPèÄ���ƒÄ‰Eü‹MQÿ 0�ƒÄ9Eüt ¸���é˜���‹URèÅ���ƒÄ‰Eüƒ}ü*t¸���ë|‹EPÿ0�ƒÄ‰Eüƒ}ü*t¸���ë_ÇEü����ë ‹MüƒÁ‰Mü}ü���s‹Uü¾‚ 0�…Àt¸���ë/ë×¾ 0�…Éu¾!0�…Òu ¾1�…Àt¸ ���ë¸*���‹å]ÃÌÌÌÌÌÌU‹ì‹EkÀ ¯�0�]ÃÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ì¸���] �ÿ%� ���������������������������������������������������������������������������������������������������������������������������������������������������������������\ ������������������&;ÒE�������a���Ä ��Ä��T ����������f ��� ����������������������\ ��������Tst3Ext�tst-3-imp.dll�����������������&;ÒE����² �����������¨ ��¬ ��° �����¼ ����tst-3.dll�Tst3����RSDSåw$ôÓãM´Éì8`J0���G:\coding\libc\trunk\out\win.x86\debug\obj\kLdr\testcase\tst-3\tst-3.pdb�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������0�0�\����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������$���0&090=0O0S0x0°0è0ü011<1^1�0�����0 00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-2-a.c��������������������������������������������������0000664�0001750�0001750�00000000145�14670377514�021565� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "a"; MY_EXPORT(int) FuncA(void) { return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-0-d.c��������������������������������������������������0000664�0001750�0001750�00000000215�14670377514�021564� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "d"; MY_EXPORT(int) FuncD(void) { return g_pszName[0] == 'd' ? 0x42000000 : 0x1000; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-3-driver.c���������������������������������������������0000664�0001750�0001750�00000015314�14670377514�022645� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tst-3-driver.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Dynamic Loader testcase no. 3, Driver. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "tst.h" #include <k/kErr.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef _MSC_VER # include <malloc.h> #endif /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** Select the appropriate KLDRSYMKIND bit define. */ #define MY_KLDRSYMKIND_BITS ( sizeof(void *) == 4 ? KLDRSYMKIND_32BIT : KLDRSYMKIND_64BIT ) /******************************************************************************* * Global Variables * *******************************************************************************/ /** The numbers of errors. */ static int g_cErrors = 0; /** * Report failure. */ static int Failure(const char *pszFormat, ...) { va_list va; g_cErrors++; printf("tst-3-driver: "); va_start(va, pszFormat); vprintf(pszFormat, va); va_end(va); printf("\n"); return 1; } /** * External symbol used by the testcase module. */ static int Tst3Ext(int iFortyTwo) { if (iFortyTwo != 42) return 256; return 42; } /** * Callback for resolving the Tst3Ext import. */ static int GetImport(PKLDRMOD pMod, KU32 iImport, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PKLDRADDR puValue, KU32 *pfKind, void *pvUser) { if (*pfKind != KLDRSYMKIND_REQ_FLAT) return -1; if ( !strncmp(pchSymbol, "Tst3Ext", strlen("Tst3Ext")) || !strncmp(pchSymbol, "_Tst3Ext", strlen("_Tst3Ext"))) { *puValue = (KUPTR)&Tst3Ext; *pfKind = KLDRSYMKIND_CODE | (sizeof(pfKind) == 4 ? KLDRSYMKIND_32BIT : KLDRSYMKIND_64BIT); return 0; } return -2; } /** * Performs the tests on one module. * @returns non sense. */ int TestModule(const char *pszFile) { PKLDRMOD pMod; KLDRSIZE cbImage; void *pvBits; int rc; printf("tst-3-driver: testing '%s'...\n", pszFile); /* open it. */ rc = kLdrModOpen(pszFile, &pMod); if (rc) return Failure("kLdrModOpen(%s,) -> %#d (%s)\n", pszFile, rc, kErrName(rc)); /* get bits. */ cbImage = kLdrModSize(pMod); pvBits = malloc((KSIZE)cbImage + 0xfff); if (pvBits) { void *pvBits2 = (void *)( ((KUPTR)pvBits + 0xfff) & ~(KUPTR)0xfff ); KLDRADDR BaseAddress = (KUPTR)pvBits2; rc = kLdrModGetBits(pMod, pvBits2, BaseAddress, GetImport, NULL); if (!rc) { KLDRADDR EntryPoint; /* call into it */ rc = kLdrModQuerySymbol(pMod, pvBits2, BaseAddress, NIL_KLDRMOD_SYM_ORDINAL, "_Tst3", strlen("_Tst3"), NULL, NULL, NULL, &EntryPoint, NULL); if (rc == KLDR_ERR_SYMBOL_NOT_FOUND) rc = kLdrModQuerySymbol(pMod, pvBits2, BaseAddress, NIL_KLDRMOD_SYM_ORDINAL, "Tst3", strlen("Tst3"), NULL, NULL, NULL, &EntryPoint, NULL); if (!rc) { int (*pfnEntryPoint)(int) = (int (*)(int)) ((KUPTR)EntryPoint); rc = pfnEntryPoint(42); if (rc == 42) { /* relocate twice and try again. */ rc = kLdrModRelocateBits(pMod, pvBits2, BaseAddress + 0x22000, BaseAddress, GetImport, NULL); if (!rc) { rc = kLdrModRelocateBits(pMod, pvBits2, BaseAddress, BaseAddress + 0x22000, GetImport, NULL); if (!rc) { rc = pfnEntryPoint(42); if (rc == 42) { printf("tst-3-driver: success.\n"); } else Failure("pfnEntryPoint(42) -> %d (2nd)\n", rc); } else Failure("kLdrModRelocateBits(,,, + 0x22000,,,) -> %#x (%s)\n", rc, kErrName(rc)); } else Failure("kLdrModRelocateBits(,, + 0x22000,,,,) -> %#x (%s)\n", rc, kErrName(rc)); } else Failure("pfnEntryPoint(42) -> %d (1st)\n", rc); } else Failure("kLdrModQuerySymbol -> %#x (%s)\n", rc, kErrName(rc)); } else Failure("kLdrModGetBits -> %#x (%s)\n", rc, kErrName(rc)); free(pvBits); } else Failure("malloc(%lx) -> NULL\n", (long)cbImage); /* clean up */ rc = kLdrModClose(pMod); if (rc) Failure("kLdrModOpen(%s,) -> %#x (%s)\n", pszFile, rc, kErrName(rc)); return 0; } int main(int argc, char **argv) { int i; /* * Test all the given modules (requires arguments). */ for (i = 1; i < argc; i++) { TestModule(argv[i]); } /* * Summary */ if (!g_cErrors) printf("tst-3-driver: SUCCESS\n"); else printf("tst-3-driver: FAILURE - %d errors\n", g_cErrors); return !!g_cErrors; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-2.c����������������������������������������������������0000664�0001750�0001750�00000000553�14670377514�021352� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" MY_IMPORT(int) FuncA(void); MY_IMPORT(int) FuncB(void); MY_IMPORT(int) FuncC(void); MY_IMPORT(int) FuncD(void); int main() { printf("graph:\n" " tst-2 -> b -> a\n" " c -> a\n" " d -> a\n" " a\n"); return FuncA() + FuncB() + FuncC() + FuncD(); } �����������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-1-c.c��������������������������������������������������0000664�0001750�0001750�00000000212�14670377514�021561� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" const char *g_pszName = "c"; MY_IMPORT(int) FuncD(void); MY_EXPORT(int) FuncC(void) { return FuncD(); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/testcase/tst-1.c����������������������������������������������������0000664�0001750�0001750�00000000473�14670377513�021351� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "tst.h" #include <stdio.h> MY_IMPORT(int) FuncA(void); MY_IMPORT(int) FuncB(void); MY_IMPORT(int) FuncC(void); int main() { printf("graph:\n" " tst-1 -> a -> d\n" " b -> d\n" " c -> d\n"); return FuncA() + FuncB() + FuncC(); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrDyldOS.c��������������������������������������������������������0000664�0001750�0001750�00000007211�14670377514�020537� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdrDyldOS.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, OS specific operations. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kLdr.h> #include "kLdrInternal.h" #if K_OS == K_OS_OS2 # define INCL_BASE # define INCL_ERRORS # include <os2.h> #elif K_OS == K_OS_WINDOWS # undef IMAGE_DOS_SIGNATURE # undef IMAGE_NT_SIGNATURE # include <Windows.h> #else # include <k/kHlpAlloc.h> #endif /** * Allocates a stack. * * @returns Pointer to the stack. NULL on allocation failure (assumes out of memory). * @param cb The size of the stack. This shall be page aligned. * If 0, a OS specific default stack size will be employed. */ void *kldrDyldOSAllocStack(KSIZE cb) { #if K_OS == K_OS_OS2 APIRET rc; PVOID pv; if (!cb) cb = 1 * 1024*1024; /* 1MB */ rc = DosAllocMem(&pv, cb, OBJ_TILE | PAG_COMMIT | PAG_WRITE | PAG_READ); if (rc == NO_ERROR) return pv; return NULL; #elif K_OS == K_OS_WINDOWS if (!cb) cb = 1 *1024*1024; /* 1MB */ return VirtualAlloc(NULL, cb, MEM_COMMIT, PAGE_READWRITE); #else void *pv; if (!cb) cb = 1 * 1024*1024; /* 1MB */ if (!kHlpPageAlloc(&pv, cb, KPROT_READWRITE, K_FALSE)) return pv; return NULL; #endif } /** * Invokes the main executable entry point with whatever * parameters specific to the host OS and/or module format. * * @returns * @param uMainEPAddress The address of the main entry point. * @param pvStack Pointer to the stack object. * @param cbStack The size of the stack object. */ int kldrDyldOSStartExe(KUPTR uMainEPAddress, void *pvStack, KSIZE cbStack) { #if K_OS == K_OS_WINDOWS /* * Invoke the entrypoint on the current stack for now. * Deal with other formats and stack switching another day. */ int rc; int (*pfnEP)(void); pfnEP = (int (*)(void))uMainEPAddress; rc = pfnEP(); TerminateProcess(GetCurrentProcess(), rc); kHlpAssert(!"TerminateProcess failed"); for (;;) TerminateProcess(GetCurrentProcess(), rc); #endif return -1; } void kldrDyldDoLoadExeStackSwitch(PKLDRDYLDMOD pExe, void *pvStack, KSIZE cbStack) { /*kHlpAssert(!"not implemented");*/ /** @todo implement this properly! */ kldrDyldDoLoadExe(pExe); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kLdr/kLdrA-os2.asm�������������������������������������������������������0000664�0001750�0001750�00000003745�14670377514�020630� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; $Id: kLdrA-os2.asm 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - The Dynamic Loader, OS/2 Assembly Helpers. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; segment TEXT32 public align=16 CLASS=CODE use32 ; ; _DLL_InitTerm ; ..start: extern _DLL_InitTerm jmp _DLL_InitTerm ; ; kLdrLoadExe wrapper which loads the bootstrap stack. ; global _kLdrDyldLoadExe _kLdrDyldLoadExe: push ebp mov ebp, esp ; switch stack. ; extern _abStack ; lea esp, [_abStack + 8192 - 4] push dword [ebp + 8 + 20] push dword [ebp + 8 + 16] push dword [ebp + 8 + 12] push dword [ebp + 8 + 8] ; call worker on the new stack. extern _kldrDyldLoadExe call _kldrDyldLoadExe ; we shouldn't return! we_re_not_supposed_to_get_here: int3 int3 jmp short we_re_not_supposed_to_get_here ���������������������������kbuild-3608/src/lib/kStuff/kDbg/��������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�016372� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgModPE.cpp�������������������������������������������������������0000664�0001750�0001750�00000033365�14670377514�020644� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgModPE.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, PE Module (Generic). */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "kDbg.h" #include "kDbgInternal.h" #include <kLdrModPE.h> #include <string.h> /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * A dbghelp based PE debug reader. */ typedef struct KDBGMODPE { /** The common module core. */ KDBGMOD Core; /** The image size. */ uint32_t cbImage; /** The number of sections. (We've added the implicit header section.) */ int32_t cSections; /** The section headers (variable size). The first section is the * implicit header section.*/ IMAGE_SECTION_HEADER aSections[1]; } KDBGMODPE, *PKDBGMODPE; /** * Calcs the RVA for a segment:offset address. * * @returns IPRT status code. * * @param pModPe The PE debug module instance. * @param iSegment The segment number. Special segments are dealt with as well. * @param off The segment offset. * @param puRVA Where to store the RVA on success. */ static int kDbgModPeSegOffToRVA(PKDBGMODPE pModPe, int32_t iSegment, KDBGADDR off, uint32_t *puRVA) { if (iSegment >= 0) { kDbgAssertMsgReturn(iSegment < pModPe->cSections, ("iSegment=%x cSections=%x\n", iSegment, pModPe->cSections), KDBG_ERR_INVALID_ADDRESS); kDbgAssertMsgReturn(off < pModPe->aSections[iSegment].Misc.VirtualSize, ("off=" PRI_KDBGADDR " VirtualSize=%x\n", off, pModPe->aSections[iSegment].Misc.VirtualSize), KDBG_ERR_INVALID_ADDRESS); *puRVA = pModPe->aSections[iSegment].VirtualAddress + (uint32_t)off; return 0; } if (iSegment == KDBGSEG_RVA) { kDbgAssertMsgReturn(off < pModPe->cbImage, ("off=" PRI_KDBGADDR ", cbImage=%x\n", off, pModPe->cbImage), KDBG_ERR_INVALID_ADDRESS); *puRVA = (uint32_t)off; return 0; } kDbgAssertMsgFailedReturn(("iSegment=%d\n", iSegment), KDBG_ERR_INVALID_ADDRESS); } /** * Calcs the segment:offset address for a RVA. * * @returns IPRT status code. * * @param pModPe The PE debug module instance. * @param uRVA The RVA. * @param piSegment Where to store the segment number. * @param poff Where to store the segment offset. */ static int kDbgModPeRVAToSegOff(PKDBGMODPE pModPe, uint32_t uRVA, int32_t *piSegment, KDBGADDR *poff) { kDbgAssertMsgReturn(uRVA < pModPe->cbImage, ("uRVA=%x, cbImage=%x\n", uRVA, pModPe->cbImage), KDBG_ERR_INVALID_ADDRESS); for (int32_t iSegment = 0; iSegment < pModPe->cSections; iSegment++) { /** @todo should probably be less strict about address in the alignment gaps. */ uint32_t off = uRVA - pModPe->aSections[iSegment].VirtualAddress; if (off < pModPe->aSections[iSegment].Misc.VirtualSize) { *poff = off; *piSegment = iSegment; return 0; } } kDbgAssertMsgFailedReturn(("uRVA=%x\n", uRVA), KDBG_ERR_INVALID_ADDRESS); } /** * @copydoc KDBGMODOPS::pfnQueryLine */ static int kDbgModPeQueryLine(PKDBGMOD pMod, int32_t iSegment, KDBGADDR off, PKDBGLINE pLine) { PKDBGMODPE pModPe = (PKDBGMODPE)pMod; /* * Translate the address to an RVA. */ uint32_t uRVA; int rc = kDbgModPeSegOffToRVA(pModPe, iSegment, off, &uRVA); if (!rc) { #if 0 DWORD64 off; IMAGEHLP_LINE64 Line; Line.SizeOfStruct = sizeof(Line); if (g_pfnSymGetLineFromAddr64(pModPe->hSymInst, pModPe->ImageBase + uRVA, &off, &Line)) { pLine->RVA = (KDBGADDR)(Line.Address - pModPe->ImageBase); rc = kDbgModPeRVAToSegOff(pModPe, pLine->RVA, &pLine->iSegment, &pLine->offSegment); pLine->iLine = Line.LineNumber; pLine->cchFile = strlen(Line.FileName); if (pLine->cchFile >= sizeof(pLine->szFile)) pLine->cchFile = sizeof(pLine->szFile) - 1; memcpy(pLine->szFile, Line.FileName, pLine->cchFile + 1); } else { DWORD Err = GetLastError(); rc = kDbgModPeConvWinError(Err); } #endif rc = KERR_NOT_IMPLEMENTED; } return rc; } /** * @copydoc KDBGMODOPS::pfnQuerySymbol */ static int kDbgModPeQuerySymbol(PKDBGMOD pMod, int32_t iSegment, KDBGADDR off, PKDBGSYMBOL pSym) { PKDBGMODPE pModPe = (PKDBGMODPE)pMod; /* * Translate the address to an RVA. */ uint32_t uRVA; int rc = kDbgModPeSegOffToRVA(pModPe, iSegment, off, &uRVA); if (!rc) { #if 0 DWORD64 off; union { SYMBOL_INFO Sym; char achBuffer[sizeof(SYMBOL_INFO) + KDBG_SYMBOL_MAX]; } Buf; Buf.Sym.SizeOfStruct = sizeof(SYMBOL_INFO); Buf.Sym.MaxNameLen = KDBG_SYMBOL_MAX; if (g_pfnSymFromAddr(pModPe->hSymInst, pModPe->ImageBase + uRVA, &off, &Buf.Sym)) { pSym->cb = Buf.Sym.Size; pSym->fFlags = 0; if (Buf.Sym.Flags & SYMFLAG_FUNCTION) pSym->fFlags |= KDBGSYM_FLAGS_CODE; else if (Buf.Sym.Flags & SYMFLAG_CONSTANT) pSym->fFlags |= KDBGSYM_FLAGS_ABS; /** @todo SYMFLAG_CONSTANT must be tested - documentation is too brief to say what is really meant here.*/ else pSym->fFlags |= KDBGSYM_FLAGS_DATA; if (Buf.Sym.Flags & SYMFLAG_EXPORT) pSym->fFlags |= KDBGSYM_FLAGS_EXPORTED; if ((Buf.Sym.Flags & (SYMFLAG_VALUEPRESENT | SYMFLAG_CONSTANT)) == (SYMFLAG_VALUEPRESENT | SYMFLAG_CONSTANT)) { pSym->iSegment = KDBGSEG_ABS; pSym->offSegment = (KDBGADDR)Buf.Sym.Value; pSym->RVA = (KDBGADDR)Buf.Sym.Value; } else { pSym->RVA = (KDBGADDR)(Buf.Sym.Address - pModPe->ImageBase); rc = kDbgModPeRVAToSegOff(pModPe, pSym->RVA, &pSym->iSegment, &pSym->offSegment); } pSym->cchName = (uint16_t)Buf.Sym.NameLen; if (pSym->cchName >= sizeof(pSym->szName)) pSym->cchName = sizeof(pSym->szName) - 1; memcpy(pSym->szName, Buf.Sym.Name, Buf.Sym.NameLen); pSym->szName[Buf.Sym.NameLen] = '\0'; } else { DWORD Err = GetLastError(); rc = kDbgModPeConvWinError(Err); } #endif rc = KERR_NOT_IMPLEMENTED; } return rc; } /** * @copydoc KDBGMODOPS::pfnClose */ static int kDbgModPeClose(PKDBGMOD pMod) { PKDBGMODPE pModPe = (PKDBGMODPE)pMod; //if (g_pfnSymCleanup(pModPe->hSymInst)) // return 0; // //DWORD Err = GetLastError(); //int rc = kDbgModPeConvWinError(Err); //kDbgAssertMsgFailed(("SymInitialize failed: Err=%d rc=%Rrc\n", Err, rc)); //return rc; return KERR_NOT_IMPLEMENTED; } /** * Opens the debug info for a PE image using the windows dbghelp library. * * @returns IPRT status code. * * @param pFile The handle to the module. * @param offHdr The offset of the PE header. * @param pszModulePath The path to the module. * @param ppDbgMod Where to store the module handle. * */ int kdbgModPEOpen(PKDBGHLPFILE pFile, int64_t offHdr, const char *pszModulePath, PKDBGMOD *ppDbgMod) { /* * We need to read the section headers and get the image size. */ IMAGE_FILE_HEADER FHdr; int rc = kDbgHlpReadAt(pFile, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS32, FileHeader), &FHdr, sizeof(FHdr)); kDbgAssertRCReturn(rc, rc); uint32_t cbImage; if (FHdr.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32)) rc = kDbgHlpReadAt(pFile, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader.SizeOfImage), &cbImage, sizeof(cbImage)); else if (FHdr.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER64)) rc = kDbgHlpReadAt(pFile, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS64, OptionalHeader.SizeOfImage), &cbImage, sizeof(cbImage)); else kDbgAssertFailedReturn(KDBG_ERR_BAD_EXE_FORMAT); kDbgAssertRCReturn(rc, rc); /* * Allocate the module and read/construct the section headers. */ PKDBGMODPE pModPe = (PKDBGMODPE)kDbgHlpAlloc(KDBG_OFFSETOF(KDBGMODPE, aSections[FHdr.NumberOfSections + 2])); kDbgAssertReturn(pModPe, KERR_NO_MEMORY); pModPe->Core.u32Magic = KDBGMOD_MAGIC; pModPe->Core.pOps = &g_kDbgModPeOps; pModPe->Core.pFile = pFile; pModPe->cbImage = cbImage; pModPe->cSections = 1 + FHdr.NumberOfSections; rc = kDbgHlpReadAt(pFile, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader) + FHdr.SizeOfOptionalHeader, &pModPe->aSections[1], sizeof(pModPe->aSections[0]) * FHdr.NumberOfSections); if (!rc) { PIMAGE_SECTION_HEADER pSH = &pModPe->aSections[0]; memcpy(pSH->Name, "headers", sizeof(pSH->Name)); pSH->Misc.VirtualSize = pModPe->aSections[1].VirtualAddress; pSH->VirtualAddress = 0; pSH->SizeOfRawData = pSH->Misc.VirtualSize; pSH->PointerToRawData = 0; pSH->PointerToRelocations = 0; pSH->PointerToLinenumbers = 0; pSH->NumberOfRelocations = 0; pSH->NumberOfLinenumbers = 0; pSH->Characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ; uint32_t uTheEnd = pModPe->aSections[FHdr.NumberOfSections].VirtualAddress + pModPe->aSections[FHdr.NumberOfSections].Misc.VirtualSize; if (uTheEnd < cbImage) { pSH = &pModPe->aSections[pModPe->cSections++]; memcpy(pSH->Name, "tail\0\0\0", sizeof(pSH->Name)); pSH->Misc.VirtualSize = cbImage - uTheEnd; pSH->VirtualAddress = uTheEnd; pSH->SizeOfRawData = pSH->Misc.VirtualSize; pSH->PointerToRawData = 0; pSH->PointerToRelocations = 0; pSH->PointerToLinenumbers = 0; pSH->NumberOfRelocations = 0; pSH->NumberOfLinenumbers = 0; pSH->Characteristics = IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_ALIGN_1BYTES | IMAGE_SCN_MEM_READ; } #if 0 /* * Find a new dbghelp handle. * * We assume 4GB of handles outlast most debugging sessions, or in anyways that * when we start reusing handles they are no longer in use. :-) */ static volatile uint32_t s_u32LastHandle = 1; HANDLE hSymInst = (HANDLE)ASMAtomicIncU32(&s_u32LastHandle); while ( hSymInst == INVALID_HANDLE_VALUE || hSymInst == (HANDLE)0 || hSymInst == GetCurrentProcess()) hSymInst = (HANDLE)ASMAtomicIncU32(&s_u32LastHandle); /* * Initialize dbghelp and try open the specified module. */ if (g_pfnSymInitialize(hSymInst, NULL, FALSE)) { g_pfnSymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_AUTO_PUBLICS | SYMOPT_ALLOW_ABSOLUTE_SYMBOLS); kDbgHlpSeek(pFile, 0); /* don't know if this is required or not... */ DWORD64 ImageBase = g_pfnSymLoadModule64(hSymInst, (HANDLE)File, pszModulePath, NULL, 0x00400000, 0); if (ImageBase) { pModPe->hSymInst = hSymInst; pModPe->ImageBase = ImageBase; *ppDbgMod = &pModPe->Core; return rc; } DWORD Err = GetLastError(); rc = kDbgModPeConvWinError(Err); kDbgAssertMsgFailed(("SymLoadModule64 failed: Err=%d rc=%Rrc\n", Err, rc)); g_pfnSymCleanup(hSymInst); } else { DWORD Err = GetLastError(); rc = kDbgModPeConvWinError(Err); kDbgAssertMsgFailed(("SymInitialize failed: Err=%d rc=%Rrc\n", Err, rc)); } #endif rc = KERR_NOT_IMPLEMENTED; } else kDbgAssertRC(rc); kDbgHlpFree(pModPe); return rc; } /** * Methods for a PE module. */ const KDBGMODOPS g_kDbgModPeOps = { "PE", kDbgModPeClose, kDbgModPeQuerySymbol, kDbgModPeQueryLine }; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/Makefile.kmk��������������������������������������������������������0000664�0001750�0001750�00000004212�14670377514�020612� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kDbg - The Debug Info Reader, sub-makefile. # # # Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. SUB_DEPTH = .. include $(PATH_KBUILD)/subheader.kmk # # kDbg - The profiler module. # #DLLS += kDbg - disabled for now. kDbg_TEMPLATE = kStuffDLL kDbg_DEFS = KDBG_BUILDING KDBG_RESIDES_IN_DLL kDbg_SOURCES := \ kDbgModule.cpp \ kDbgModLdr.cpp \ kDbgLine.cpp \ kDbgSymbol.cpp kDbg_SOURCES.win += \ kDbgModWinDbgHelp.cpp # # kDbgStatic - The profiler module. # LIBRARIES += kDbgStatic kDbgStatic_TEMPLATE = kStuffLIB kDbgStatic_DEFS = KDBG_BUILDING kDbgStatic_SOURCES = $(kDbg_SOURCES) kDbgStatic_SOURCES.win = $(kDbg_SOURCES.win) # # kDbgDump - Test program which dumps whatever is thrown at it. # PROGRAMS += kDbgDump kDbgDump_TEMPLATE = kStuffEXE kDbgDump_SOURCES = kDbgDump.cpp kDbgDump_LIBS = \ $(TARGET_kDbgStatic) \ $(subst kDbg,kLdr,$(TARGET_kDbgStatic)) \ $(subst kDbg,kRdr,$(TARGET_kDbgStatic)) \ $(subst kDbg,kHlpCRT,$(TARGET_kDbgStatic)) # Generate the rules include $(PATH_KBUILD)/subfooter.kmk ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgHlpCrt.cpp������������������������������������������������������0000664�0001750�0001750�00000012216�14670377514�021064� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgHlpCrt.cpp 77 2016-06-22 17:03:55Z bird $ */ /** @file * kDbg - The Debug Info Reader, Helpers, CRT Based Implementation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "kDbgHlp.h" #include "kDbg.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #ifdef _MSC_VER # include <io.h> #endif /** * The stdio base implementation of KDBGHLPFILE. */ typedef struct KDBGHLPFILE { /** Pointer to the stdio file stream. */ FILE *pStrm; } KDBGHLPFILE; /** @def HAVE_FSEEKO * Define HAVE_FSEEKO to indicate that fseeko and ftello should be used. */ #if !defined(_MSC_VER) # define HAVE_FSEEKO #endif void *kDbgHlpAlloc(size_t cb) { return malloc(cb); } void *kDbgHlpAllocZ(size_t cb) { return calloc(1, cb); } void *kDbgHlpAllocDup(const void *pv, size_t cb) { void *pvNew = malloc(cb); if (pvNew) memcpy(pvNew, pv, cb); return pvNew; } void *kDbgHlpReAlloc(void *pv, size_t cb) { return realloc(pv, cb); } void kDbgHlpFree(void *pv) { free(pv); } int kDbgHlpCrtConvErrno(int rc) { switch (rc) { case 0: return 0; case EINVAL: return KERR_INVALID_PARAMETER; case ENOMEM: return KERR_NO_MEMORY; case EISDIR: case ENOENT: return KERR_FILE_NOT_FOUND; default: return KERR_GENERAL_FAILURE; } } int kDbgHlpOpenRO(const char *pszFilename, PKDBGHLPFILE *ppFile) { PKDBGHLPFILE pFile = (PKDBGHLPFILE)kDbgHlpAlloc(sizeof(*pFile)); if (!pFile) return KERR_NO_MEMORY; pFile->pStrm = fopen(pszFilename, "rb"); if (pFile->pStrm) { *ppFile = pFile; return 0; } return kDbgHlpCrtConvErrno(errno); } void kDbgHlpClose(PKDBGHLPFILE pFile) { if (pFile) { fclose(pFile->pStrm); pFile->pStrm = NULL; kDbgHlpFree(pFile); } } uintptr_t kDbgHlpNativeFileHandle(PKDBGHLPFILE pFile) { int fd = fileno(pFile->pStrm); #ifdef _MSC_VER return _get_osfhandle(fd); #else return fd; #endif } int64_t kDbgHlpFileSize(PKDBGHLPFILE pFile) { int64_t cbFile; int64_t offCur = kDbgHlpTell(pFile); if (offCur >= 0) { if (kDbgHlpSeekByEnd(pFile, 0) == 0) cbFile = kDbgHlpTell(pFile); else cbFile = -1; kDbgHlpSeek(pFile, offCur); } else cbFile = -1; return cbFile; } int kDbgHlpReadAt(PKDBGHLPFILE pFile, int64_t off, void *pv, size_t cb) { int rc = kDbgHlpSeek(pFile, off); if (!rc) rc = kDbgHlpRead(pFile, pv, cb); return rc; } int kDbgHlpRead(PKDBGHLPFILE pFile, void *pv, size_t cb) { if (fread(pv, cb, 1, pFile->pStrm) == 1) return 0; return -1; } int kDbgHlpSeek(PKDBGHLPFILE pFile, int64_t off) { #ifdef HAVE_FSEEKO if (!fseeko(pFile->pStrm, off, SEEK_SET)) return 0; #else long l = (long)off; if (l != off) return KERR_OUT_OF_RANGE; if (!fseek(pFile->pStrm, l, SEEK_SET)) return 0; #endif return kDbgHlpCrtConvErrno(errno); } int kDbgHlpSeekByCur(PKDBGHLPFILE pFile, int64_t off) { #ifdef HAVE_FSEEKO if (!fseeko(pFile->pStrm, off, SEEK_CUR)) return 0; #else long l = (long)off; if (l != off) return KERR_OUT_OF_RANGE; if (!fseek(pFile->pStrm, l, SEEK_CUR)) return 0; #endif return kDbgHlpCrtConvErrno(errno); } int kDbgHlpSeekByEnd(PKDBGHLPFILE pFile, int64_t off) { #ifdef HAVE_FSEEKO if (!fseeko(pFile->pStrm, -off, SEEK_END)) return 0; #else long l = (long)off; if (l != off) return KERR_OUT_OF_RANGE; if (!fseek(pFile->pStrm, -l, SEEK_END)) return 0; #endif return kDbgHlpCrtConvErrno(errno); } int64_t kDbgHlpTell(PKDBGHLPFILE pFile) { #ifdef HAVE_FSEEKO return ftello(pFile->pStrm); #else return ftell(pFile->pStrm); #endif } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgModWinDbgHelp.cpp�����������������������������������������������0000664�0001750�0001750�00000062471�14670377514�022323� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgModWinDbgHelp.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, DbgHelp Based Reader. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <Windows.h> #define _IMAGEHLP64 #include <DbgHelp.h> #include "kDbgInternal.h" #include <k/kHlpAlloc.h> #include <k/kHlpString.h> /******************************************************************************* * Global Variables * *******************************************************************************/ /** The dbghelp.dll module handle. */ static HMODULE g_hDbgHelp = NULL; /** Pointer to the dbhelp.dll SymInitialize function. */ static BOOL (WINAPI *g_pfnSymInitialize)(IN HANDLE,IN LPSTR,IN BOOL); /** Pointer to the dbhelp.dll SymCleanup function. */ static BOOL (WINAPI *g_pfnSymCleanup)(IN HANDLE); /** Pointer to the dbhelp.dll SymSetOptions function. */ static DWORD (WINAPI *g_pfnSymSetOptions)(IN DWORD); /** Pointer to the dbhelp.dll SymLoadModule64 function. */ static DWORD64 (WINAPI *g_pfnSymLoadModule64)(IN HANDLE, IN HANDLE, IN PCSTR, IN PCSTR ModuleName, IN DWORD64, IN DWORD); /** Pointer to the dbhelp.dll SymFromAddr function. */ static DWORD (WINAPI *g_pfnSymFromAddr)(IN HANDLE, IN DWORD64, OUT PDWORD64, OUT PSYMBOL_INFO); /** Pointer to the dbhelp.dll SymGetLineFromAddr64 function. */ static DWORD (WINAPI *g_pfnSymGetLineFromAddr64)(IN HANDLE, IN DWORD64, OUT PDWORD64, OUT PIMAGEHLP_LINE64); /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * A dbghelp based PE debug reader. */ typedef struct KDBGMODDBGHELP { /** The common module core. */ KDBGMOD Core; /** The image base. */ DWORD64 ImageBase; /** The "process" handle we present dbghelp. */ HANDLE hSymInst; /** The image size. */ KU32 cbImage; /** The number of sections. (We've added the implicit header section.) */ KI32 cSections; /** The section headers (variable size). The first section is the * implicit header section.*/ IMAGE_SECTION_HEADER aSections[1]; } KDBGMODDBGHELP, *PKDBGMODDBGHELP; /** * Convers a Windows error to kDbg error code. * * @returns kDbg status code. * @param rc The Windows error. */ static int kdbgModDHConvWinError(DWORD rc) { switch (rc) { case 0: return 0; default: return KERR_GENERAL_FAILURE; } } /** * Calcs the RVA for a segment:offset address. * * @returns IPRT status code. * * @param pModDH The PE debug module instance. * @param iSegment The segment number. Special segments are dealt with as well. * @param off The segment offset. * @param puRVA Where to store the RVA on success. */ static int kdbgModDHSegOffToRVA(PKDBGMODDBGHELP pModDH, KI32 iSegment, KDBGADDR off, KU32 *puRVA) { if (iSegment >= 0) { kDbgAssertMsgReturn(iSegment < pModDH->cSections, ("iSegment=%x cSections=%x\n", iSegment, pModDH->cSections), KDBG_ERR_INVALID_ADDRESS); kDbgAssertMsgReturn(off < pModDH->aSections[iSegment].Misc.VirtualSize, ("off=" PRI_KDBGADDR " VirtualSize=%x\n", off, pModDH->aSections[iSegment].Misc.VirtualSize), KDBG_ERR_INVALID_ADDRESS); *puRVA = pModDH->aSections[iSegment].VirtualAddress + (KU32)off; return 0; } if (iSegment == KDBGSEG_RVA) { kDbgAssertMsgReturn(off < pModDH->cbImage, ("off=" PRI_KDBGADDR ", cbImage=%x\n", off, pModDH->cbImage), KDBG_ERR_INVALID_ADDRESS); *puRVA = (KU32)off; return 0; } kDbgAssertMsgFailedReturn(("iSegment=%d\n", iSegment), KDBG_ERR_INVALID_ADDRESS); } /** * Calcs the segment:offset address for a RVA. * * @returns IPRT status code. * * @param pModDH The PE debug module instance. * @param uRVA The RVA. * @param piSegment Where to store the segment number. * @param poff Where to store the segment offset. */ static int kdbgModDHRVAToSegOff(PKDBGMODDBGHELP pModDH, KU32 uRVA, KI32 *piSegment, KDBGADDR *poff) { kDbgAssertMsgReturn(uRVA < pModDH->cbImage, ("uRVA=%x, cbImage=%x\n", uRVA, pModDH->cbImage), KDBG_ERR_INVALID_ADDRESS); for (KI32 iSegment = 0; iSegment < pModDH->cSections; iSegment++) { /** @todo should probably be less strict about address in the alignment gaps. */ KU32 off = uRVA - pModDH->aSections[iSegment].VirtualAddress; if (off < pModDH->aSections[iSegment].Misc.VirtualSize) { *poff = off; *piSegment = iSegment; return 0; } } kDbgAssertMsgFailedReturn(("uRVA=%x\n", uRVA), KDBG_ERR_INVALID_ADDRESS); } /** * @copydoc KDBGMODOPS::pfnQueryLine */ static int kdbgModDHQueryLine(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PKDBGLINE pLine) { PKDBGMODDBGHELP pModDH = (PKDBGMODDBGHELP)pMod; /* * Translate the address to an RVA. */ KU32 uRVA; int rc = kdbgModDHSegOffToRVA(pModDH, iSegment, off, &uRVA); if (!rc) { DWORD64 off; IMAGEHLP_LINE64 Line; Line.SizeOfStruct = sizeof(Line); if (g_pfnSymGetLineFromAddr64(pModDH->hSymInst, pModDH->ImageBase + uRVA, &off, &Line)) { pLine->RVA = (KDBGADDR)(Line.Address - pModDH->ImageBase); rc = kdbgModDHRVAToSegOff(pModDH, (KU32)pLine->RVA, &pLine->iSegment, &pLine->offSegment); pLine->iLine = Line.LineNumber; KSIZE cchFile = kHlpStrLen(Line.FileName); pLine->cchFile = cchFile < sizeof(pLine->szFile) ? (KU16)cchFile : (KU16)sizeof(pLine->szFile) - 1; kHlpMemCopy(pLine->szFile, Line.FileName, pLine->cchFile); pLine->szFile[pLine->cchFile] = '\0'; } else { DWORD Err = GetLastError(); rc = kdbgModDHConvWinError(Err); } } return rc; } /** * @copydoc KDBGMODOPS::pfnQuerySymbol */ static int kdbgModDHQuerySymbol(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PKDBGSYMBOL pSym) { PKDBGMODDBGHELP pModDH = (PKDBGMODDBGHELP)pMod; /* * Translate the address to an RVA. */ KU32 uRVA; int rc = kdbgModDHSegOffToRVA(pModDH, iSegment, off, &uRVA); if (!rc) { DWORD64 off; union { SYMBOL_INFO Sym; char achBuffer[sizeof(SYMBOL_INFO) + KDBG_SYMBOL_MAX]; } Buf; Buf.Sym.SizeOfStruct = sizeof(SYMBOL_INFO); Buf.Sym.MaxNameLen = KDBG_SYMBOL_MAX; if (g_pfnSymFromAddr(pModDH->hSymInst, pModDH->ImageBase + uRVA, &off, &Buf.Sym)) { pSym->cb = Buf.Sym.Size; pSym->Address = NIL_KDBGADDR; pSym->fFlags = 0; if (Buf.Sym.Flags & SYMFLAG_FUNCTION) pSym->fFlags |= KDBGSYM_FLAGS_CODE; else if (Buf.Sym.Flags & SYMFLAG_CONSTANT) pSym->fFlags |= KDBGSYM_FLAGS_ABS; /** @todo SYMFLAG_CONSTANT must be tested - documentation is too brief to say what is really meant here.*/ else pSym->fFlags |= KDBGSYM_FLAGS_DATA; if (Buf.Sym.Flags & SYMFLAG_EXPORT) pSym->fFlags |= KDBGSYM_FLAGS_EXPORTED; if ((Buf.Sym.Flags & (SYMFLAG_VALUEPRESENT | SYMFLAG_CONSTANT)) == (SYMFLAG_VALUEPRESENT | SYMFLAG_CONSTANT)) { pSym->iSegment = KDBGSEG_ABS; pSym->offSegment = (KDBGADDR)Buf.Sym.Value; pSym->RVA = (KDBGADDR)Buf.Sym.Value; } else { pSym->RVA = (KDBGADDR)(Buf.Sym.Address - pModDH->ImageBase); rc = kdbgModDHRVAToSegOff(pModDH, (KU32)pSym->RVA, &pSym->iSegment, &pSym->offSegment); } pSym->cchName = (KU16)Buf.Sym.NameLen; if (pSym->cchName >= sizeof(pSym->szName)) pSym->cchName = sizeof(pSym->szName) - 1; kHlpMemCopy(pSym->szName, Buf.Sym.Name, Buf.Sym.NameLen); pSym->szName[Buf.Sym.NameLen] = '\0'; } else { DWORD Err = GetLastError(); rc = kdbgModDHConvWinError(Err); } } return rc; } /** * @copydoc KDBGMODOPS::pfnClose */ static int kdbgModDHClose(PKDBGMOD pMod) { PKDBGMODDBGHELP pModDH = (PKDBGMODDBGHELP)pMod; if (g_pfnSymCleanup(pModDH->hSymInst)) return 0; DWORD Err = GetLastError(); int rc = kdbgModDHConvWinError(Err); kDbgAssertMsgFailed(("SymInitialize failed: Err=%d rc=%d\n", Err, rc)); return rc; } /** * Checks if the specified dbghelp.dll is usable. * * @returns IPRT status code. * * @param pszPath the path to the dbghelp.dll. */ static int kdbgModDHTryDbgHelp(const char *pszPath, KU32 *pu32FileVersionMS, KU32 *pu32FileVersionLS) { int rc; DWORD dwHandle = 0; DWORD cb = GetFileVersionInfoSize(pszPath, &dwHandle); if (cb > 0) { void *pvBuf = alloca(cb); if (GetFileVersionInfo(pszPath, dwHandle, cb, pvBuf)) { UINT cbValue = 0; VS_FIXEDFILEINFO *pFileInfo; if (VerQueryValue(pvBuf, "\\", (void **)&pFileInfo, &cbValue)) { /** @todo somehow reject 64-bit .dlls when in 32-bit mode... dwFileOS is completely useless. */ if ( *pu32FileVersionMS < pFileInfo->dwFileVersionMS || ( *pu32FileVersionMS == pFileInfo->dwFileVersionMS && *pu32FileVersionLS > pFileInfo->dwFileVersionLS)) { *pu32FileVersionMS = pFileInfo->dwFileVersionMS; *pu32FileVersionLS = pFileInfo->dwFileVersionLS; } if (pFileInfo->dwFileVersionMS >= 0x60004) rc = 0; else rc = KDBG_ERR_DBGHLP_VERSION_MISMATCH; } else rc = KERR_GENERAL_FAILURE; } else rc = kdbgModDHConvWinError(GetLastError()); } else rc = kdbgModDHConvWinError(GetLastError()); return rc; } /** * Find the dbghelp.dll */ static int kdbgModDHFindDbgHelp(char *pszPath, KSIZE cchPath) { /* * Try the current directory. */ KU32 FileVersionMS = 0; KU32 FileVersionLS = 0; int rc = KERR_GENERAL_FAILURE; static char s_szDbgHelp[] = "\\dbghelp.dll"; if (GetCurrentDirectory((DWORD)(cchPath - sizeof(s_szDbgHelp) + 1), pszPath)) { strcat(pszPath, s_szDbgHelp); int rc2 = kdbgModDHTryDbgHelp(pszPath, &FileVersionMS, &FileVersionLS); if (!rc2) return rc2; if (rc != KDBG_ERR_DBGHLP_VERSION_MISMATCH) rc = rc2; } /* * Try the application directory. */ if (GetModuleFileName(NULL, pszPath, (DWORD)(cchPath - sizeof(s_szDbgHelp) + 1))) { kHlpStrCat(kHlpStrRChr(pszPath, '\\'), s_szDbgHelp); int rc2 = kdbgModDHTryDbgHelp(pszPath, &FileVersionMS, &FileVersionLS); if (!rc) return rc2; if (rc != KDBG_ERR_DBGHLP_VERSION_MISMATCH) rc = rc2; } /* * Try the windows directory. */ if (GetSystemDirectory(pszPath, (DWORD)(cchPath - sizeof(s_szDbgHelp) + 1))) { kHlpStrCat(pszPath, s_szDbgHelp); int rc2 = kdbgModDHTryDbgHelp(pszPath, &FileVersionMS, &FileVersionLS); if (!rc2) return rc2; if (rc != KDBG_ERR_DBGHLP_VERSION_MISMATCH) rc = rc2; } /* * Try the windows directory. */ if (GetWindowsDirectory(pszPath, (DWORD)(cchPath - sizeof(s_szDbgHelp) + 1))) { kHlpStrCat(pszPath, s_szDbgHelp); int rc2 = kdbgModDHTryDbgHelp(pszPath, &FileVersionMS, &FileVersionLS); if (!rc2) return rc2; if (rc != KDBG_ERR_DBGHLP_VERSION_MISMATCH) rc = rc2; } /* * Try the path. */ /** @todo find the actual path specs, I'm probably not doing this 100% correctly here. */ DWORD cb = GetEnvironmentVariable("PATH", NULL, 0) + 64; char *pszSearchPath = (char *) alloca(cb); if (GetEnvironmentVariable("PATH", pszSearchPath, cb) < cb) { char *psz = pszSearchPath; while (*psz) { /* find the end of the path. */ char *pszEnd = kHlpStrChr(psz, ';'); if (!pszEnd) pszEnd = kHlpStrChr(psz, '\0'); if (pszEnd != psz) { /* construct filename and try it out */ kHlpMemCopy(pszPath, psz, pszEnd - psz); kHlpMemCopy(&pszPath[pszEnd - psz], s_szDbgHelp, sizeof(s_szDbgHelp)); int rc2 = kdbgModDHTryDbgHelp(pszPath, &FileVersionMS, &FileVersionLS); if (!rc2) return rc2; if (rc != KDBG_ERR_DBGHLP_VERSION_MISMATCH) rc = rc2; } /* next path */ if (!*pszEnd) break; psz = pszEnd + 1; } } if (rc == KDBG_ERR_DBGHLP_VERSION_MISMATCH) kDbgAssertMsgFailed(("dbghelp.dll found, but it was ancient! The highest file version found was 0x%08x'%08x.\n" "This program require a file version of at least 0x00060004'00000000. Please download\n" "the latest windbg and use the dbghelp.dll from that package. Just put it somewhere in\n" "the PATH and we'll find it.\n", FileVersionMS, FileVersionLS)); else kDbgAssertMsgFailed(("dbghelp.dll was not found! Download the latest windbg and use the dbghelp.dll\n" "from that package - just put it somewhere in the PATH and we'll find it.\n")); return rc; } /** * Loads the dbghelp.dll, check that it's the right version, and * resolves all the symbols we need. * * @returns IPRT status code. */ static int kdbgModDHLoadDbgHelp(void) { if (g_hDbgHelp) return 0; /* primitive locking - make some useful API for this kind of spinning! */ static volatile long s_lLock = 0; while (InterlockedCompareExchange(&s_lLock, 1, 0)) while (s_lLock) Sleep(1); if (g_hDbgHelp) { InterlockedExchange(&s_lLock, 0); return 0; } /* * Load it - try current dir first. */ char szPath[260]; int rc = kdbgModDHFindDbgHelp(szPath, sizeof(szPath)); if (rc) { InterlockedExchange(&s_lLock, 0); return rc; } HMODULE hmod = LoadLibraryEx(szPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (!hmod) { DWORD Err = GetLastError(); int rc = kdbgModDHConvWinError(Err); InterlockedExchange(&s_lLock, 0); kDbgAssertMsgFailedReturn(("Failed to load '%s', Err=%d rc=%d\n", szPath, Err, rc), rc); } /* * Check the API version (too). */ LPAPI_VERSION (WINAPI *pfnImagehlpApiVersion)(VOID); FARPROC *ppfn = (FARPROC *)&pfnImagehlpApiVersion; *ppfn = GetProcAddress(hmod, "ImagehlpApiVersion"); if (*ppfn) { LPAPI_VERSION pVersion = pfnImagehlpApiVersion(); if ( pVersion && ( pVersion->MajorVersion > 4 || (pVersion->MajorVersion == 4 && pVersion->MinorVersion > 0) || (pVersion->MajorVersion == 4 && pVersion->MinorVersion == 0 && pVersion->Revision >= 5) ) ) { /* * Resolve the entrypoints we need. */ static const struct { const char *pszName; FARPROC *ppfn; } s_aFunctions[] = { { "SymInitialize", (FARPROC *)&g_pfnSymInitialize }, { "SymCleanup", (FARPROC *)&g_pfnSymCleanup }, { "SymSetOptions", (FARPROC *)&g_pfnSymSetOptions }, { "SymLoadModule64", (FARPROC *)&g_pfnSymLoadModule64 }, { "SymFromAddr", (FARPROC *)&g_pfnSymFromAddr }, { "SymFromAddr", (FARPROC *)&g_pfnSymFromAddr }, { "SymGetLineFromAddr64", (FARPROC *)&g_pfnSymGetLineFromAddr64 }, }; for (unsigned i = 0; i < K_ELEMENTS(s_aFunctions); i++) { FARPROC pfn = GetProcAddress(hmod, s_aFunctions[i].pszName); if (!pfn) { DWORD Err = GetLastError(); rc = kdbgModDHConvWinError(Err); kDbgAssertMsgFailed(("Failed to resolve %s in dbghelp, Err=%d rc=%d\n", s_aFunctions[i].pszName, Err, rc)); break; } *s_aFunctions[i].ppfn = pfn; } if (!rc) { g_hDbgHelp = hmod; Sleep(1); InterlockedExchange(&s_lLock, 0); return 0; } } else { rc = KDBG_ERR_DBGHLP_VERSION_MISMATCH; kDbgAssertMsgFailed(("ImagehlpApiVersion -> %p and MajorVersion=%d.\n", pVersion, pVersion ? pVersion->MajorVersion : 0)); } } else { DWORD Err = GetLastError(); rc = kdbgModDHConvWinError(Err); kDbgAssertMsgFailed(("Failed to resolve ImagehlpApiVersionEx in dbghelp, Err=%d rc=%d\n", Err, rc)); } FreeLibrary(hmod); InterlockedExchange(&s_lLock, 0); return rc; } /** * @copydoc KDBGMODOPS::pfnOpen */ static int kdbgModDHOpen(PKDBGMOD *ppMod, PKRDR pRdr, KBOOL fCloseRdr, KFOFF off, KFOFF cb, struct KLDRMOD *pLdrMod) { /* * This reader doesn't support partial files. * Also weed out small files early on as they cannot be * PE images and will only cause read errors */ if ( off != 0 || cb != KFOFF_MAX) return KDBG_ERR_UNKOWN_FORMAT; if (kRdrSize(pRdr) < sizeof(IMAGE_NT_HEADERS32) + sizeof(IMAGE_SECTION_HEADER)) return KDBG_ERR_UNKOWN_FORMAT; /* * We need to read the section headers and get the image size. */ /* Find the PE header magic. */ KU32 offHdr = 0; KU32 u32Magic; int rc = kRdrRead(pRdr, &u32Magic, sizeof(u32Magic), 0); kDbgAssertRCReturn(rc, rc); if ((KU16)u32Magic == IMAGE_DOS_SIGNATURE) { rc = kRdrRead(pRdr, &offHdr, sizeof(offHdr), K_OFFSETOF(IMAGE_DOS_HEADER, e_lfanew)); kDbgAssertRCReturn(rc, rc); if (!offHdr) return KDBG_ERR_FORMAT_NOT_SUPPORTED; if ( offHdr < sizeof(IMAGE_DOS_SIGNATURE) || offHdr >= kRdrSize(pRdr) - 4) return KDBG_ERR_BAD_EXE_FORMAT; rc = kRdrRead(pRdr, &u32Magic, sizeof(u32Magic), offHdr); kDbgAssertRCReturn(rc, rc); } if (u32Magic != IMAGE_NT_SIGNATURE) return KDBG_ERR_FORMAT_NOT_SUPPORTED; /* read the file header and the image size in the optional header.. */ IMAGE_FILE_HEADER FHdr; rc = kRdrRead(pRdr, &FHdr, sizeof(FHdr), offHdr + K_OFFSETOF(IMAGE_NT_HEADERS32, FileHeader)); kDbgAssertRCReturn(rc, rc); KU32 cbImage; if (FHdr.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32)) rc = kRdrRead(pRdr, &cbImage, sizeof(cbImage), offHdr + K_OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader.SizeOfImage)); else if (FHdr.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER64)) rc = kRdrRead(pRdr, &cbImage, sizeof(cbImage), offHdr + K_OFFSETOF(IMAGE_NT_HEADERS64, OptionalHeader.SizeOfImage)); else kDbgAssertFailedReturn(KDBG_ERR_BAD_EXE_FORMAT); kDbgAssertRCReturn(rc, rc); /* * Load dbghelp.dll. */ rc = kdbgModDHLoadDbgHelp(); if (rc) return rc; /* * Allocate the module and read/construct the section headers. */ PKDBGMODDBGHELP pModDH = (PKDBGMODDBGHELP)kHlpAlloc(K_OFFSETOF(KDBGMODDBGHELP, aSections[FHdr.NumberOfSections + 2])); kDbgAssertReturn(pModDH, KERR_NO_MEMORY); pModDH->Core.u32Magic = KDBGMOD_MAGIC; pModDH->Core.pOps = &g_kDbgModWinDbgHelpOpen; pModDH->Core.pRdr = pRdr; pModDH->Core.fCloseRdr = fCloseRdr; pModDH->Core.pLdrMod = pLdrMod; pModDH->cbImage = cbImage; pModDH->cSections = 1 + FHdr.NumberOfSections; rc = kRdrRead(pRdr, &pModDH->aSections[1], sizeof(pModDH->aSections[0]) * FHdr.NumberOfSections, offHdr + K_OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader) + FHdr.SizeOfOptionalHeader); if (!rc) { PIMAGE_SECTION_HEADER pSH = &pModDH->aSections[0]; kHlpMemCopy(pSH->Name, "headers", sizeof(pSH->Name)); pSH->Misc.VirtualSize = pModDH->aSections[1].VirtualAddress; pSH->VirtualAddress = 0; pSH->SizeOfRawData = pSH->Misc.VirtualSize; pSH->PointerToRawData = 0; pSH->PointerToRelocations = 0; pSH->PointerToLinenumbers = 0; pSH->NumberOfRelocations = 0; pSH->NumberOfLinenumbers = 0; pSH->Characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ; KU32 uTheEnd = pModDH->aSections[FHdr.NumberOfSections].VirtualAddress + pModDH->aSections[FHdr.NumberOfSections].Misc.VirtualSize; if (uTheEnd < cbImage) { pSH = &pModDH->aSections[pModDH->cSections++]; kHlpMemCopy(pSH->Name, "tail\0\0\0", sizeof(pSH->Name)); pSH->Misc.VirtualSize = cbImage - uTheEnd; pSH->VirtualAddress = uTheEnd; pSH->SizeOfRawData = pSH->Misc.VirtualSize; pSH->PointerToRawData = 0; pSH->PointerToRelocations = 0; pSH->PointerToLinenumbers = 0; pSH->NumberOfRelocations = 0; pSH->NumberOfLinenumbers = 0; pSH->Characteristics = IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_ALIGN_1BYTES | IMAGE_SCN_MEM_READ; } /* * Find a new dbghelp handle. * * We assume 4GB of handles outlast most debugging sessions, or in anyways that * when we start reusing handles they are no longer in use. :-) */ static volatile long s_u32LastHandle = 1; HANDLE hSymInst = (HANDLE)InterlockedIncrement(&s_u32LastHandle); while ( hSymInst == INVALID_HANDLE_VALUE || hSymInst == (HANDLE)0 || hSymInst == GetCurrentProcess()) hSymInst = (HANDLE)InterlockedIncrement(&s_u32LastHandle); /* * Initialize dbghelp and try open the specified module. */ if (g_pfnSymInitialize(hSymInst, NULL, FALSE)) { g_pfnSymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_AUTO_PUBLICS | SYMOPT_ALLOW_ABSOLUTE_SYMBOLS); KIPTR NativeFH = kRdrNativeFH(pRdr); DWORD64 ImageBase = g_pfnSymLoadModule64(hSymInst, NativeFH == -1 ? NULL : (HANDLE)NativeFH, kRdrName(pRdr), NULL, 0x00400000, 0); if (ImageBase) { pModDH->hSymInst = hSymInst; pModDH->ImageBase = ImageBase; *ppMod = &pModDH->Core; return rc; } DWORD Err = GetLastError(); rc = kdbgModDHConvWinError(Err); kDbgAssertMsgFailed(("SymLoadModule64 failed: Err=%d rc=%d\n", Err, rc)); g_pfnSymCleanup(hSymInst); } else { DWORD Err = GetLastError(); rc = kdbgModDHConvWinError(Err); kDbgAssertMsgFailed(("SymInitialize failed: Err=%d rc=%d\n", Err, rc)); } } else kDbgAssertRC(rc); kHlpFree(pModDH); return rc; } /** * Methods for a PE module. */ KDBGMODOPS const g_kDbgModWinDbgHelpOpen = { "Windows DbgHelp", NULL, kdbgModDHOpen, kdbgModDHClose, kdbgModDHQuerySymbol, kdbgModDHQueryLine, "Windows DbgHelp" }; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgHlp.h�����������������������������������������������������������0000664�0001750�0001750�00000022277�14670377514�020070� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgHlp.h 78 2016-07-13 15:52:04Z bird $ */ /** @file * kDbg - The Debug Info Reader, Internal Header. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kDbgHlp_h___ #define ___kDbgHlp_h___ #include <k/kDbgBase.h> #ifdef __cplusplus extern "C" { #endif /** @defgroup grp_kDbgHlpHeap kDbg Internal Heap APIs. * @internal * @{ */ /** * Allocates memory. * * @returns Pointer to the allocated memory. * NULL on failure. * @param cb The number of bytes to allocate. */ void *kDbgHlpAlloc(size_t cb); /** * Allocates memory like kDbgHlpAlloc, except that it's zeroed. * * @returns Pointer to the allocated memory. * NULL on failure. * @param cb The number of bytes to allocate. */ void *kDbgHlpAllocZ(size_t cb); /** * Combination of kDbgHlpAlloc and memcpy. * * @returns Pointer to the duplicate. * NULL on failure. * * @param pv The memory to be duplicate. * @param cb The size of the block. */ void *kDbgHlpAllocDup(const void *pv, size_t cb); /** * Reallocates a memory block returned by kDbgHlpAlloc, kDbgHlpAllocZ * kDbgHlpAllocDup or this function. * * The content of new memory added to the memory block is undefined. * * @returns Pointer to the allocated memory. * NULL on failure, the old block remains intact. * @param pv The memory block to reallocate. * If NULL this function will work like kDbgHlpAlloc. * @param cb The number of bytes to allocate. * If 0 this function will work like kDbgHlpFree. */ void *kDbgHlpRealloc(void *pv, size_t cb); /** * Frees memory allocated by kDbgHlpAlloc, kDbgHlpAllocZ * kDbgHlpAllocDup, or kDbgHlpRealloc. * * @param pv */ void kDbgHlpFree(void *pv); /** @} */ /** @defgroup grp_kDbgHlpFile kDbg Internal File Access APIs. * @internal * @{ */ /** * Opens the specified file as read-only, buffered if possible. * * @returns 0 on success, or the appropriate KDBG_ERR_* on failure. * * @param pszFilename The file to open. * @param ppFile Where to store the handle to the open file. */ int kDbgHlpOpenRO(const char *pszFilename, PKDBGHLPFILE *ppFile); /** * Closes a file opened by kDbgHlpOpenRO. * * @param pFile The file handle. */ void kDbgHlpClose(PKDBGHLPFILE pFile); /** * Gets the native file handle. * * @return The native file handle. * -1 on failure. * @param pFile The file handle. */ uintptr_t kDbgHlpNativeFileHandle(PKDBGHLPFILE pFile); /** * Gets the size of an open file. * * @returns The file size in bytes on success. * On failure -1 is returned. * @param pFile The file handle. */ int64_t kDbgHlpFileSize(PKDBGHLPFILE pFile); /** * Reads a number of bytes at a specified file location. * * This will change the current file position to off + cb on success, * while on failure the position will be undefined. * * @returns The file size in bytes on success. * On failure -1 is returned. * @param pFile The file handle. * @param off Where to read. * @param pv Where to store the data. * @param cb How much to read. */ int kDbgHlpReadAt(PKDBGHLPFILE pFile, int64_t off, void *pv, size_t cb); /** * Reads a number of bytes at the current file position. * * This will advance the current file position by cb bytes on success * while on failure the position will be undefined. * * @returns The file size in bytes on success. * On failure -1 is returned. * @param pFile The file handle. * @param pv Where to store the data. * @param cb How much to read. * @param off Where to read. */ int kDbgHlpRead(PKDBGHLPFILE pFile, void *pv, size_t cb); /** * Sets the current file position. * * @returns 0 on success, and KDBG_ERR_* on failure. * @param pFile The file handle. * @param off The desired file position. */ int kDbgHlpSeek(PKDBGHLPFILE pFile, int64_t off); /** * Move the file position relative to the current one. * * @returns 0 on success, and KDBG_ERR_* on failure. * @param pFile The file handle. * @param off How much to move the file position by. */ int kDbgHlpSeekByCur(PKDBGHLPFILE pFile, int64_t off); /** * Move the file position relative to the end of the file. * * @returns 0 on success, and KDBG_ERR_* on failure. * @param pFile The file handle. * @param off The offset relative to the end, positive number. */ int kDbgHlpSeekByEnd(PKDBGHLPFILE pFile, int64_t off); /** * Gets the current file position. * * @returns The current file position on success. * -1 on failure. * @param pFile The file handle. */ int64_t kDbgHlpTell(PKDBGHLPFILE pFile); /** @} */ /** @defgroup grp_kDbgHlpAssert kDbg Internal Assertion Macros. * @internal * @{ */ #ifdef _MSC_VER # define kDbgAssertBreakpoint() do { __debugbreak(); } while (0) #else # define kDbgAssertBreakpoint() do { __asm__ __volatile__ ("int3"); } while (0) #endif /** * Helper function that displays the first part of the assertion message. * * @param pszExpr The expression. * @param pszFile The file name. * @param iLine The line number is the file. * @param pszFunction The function name. */ void kDbgAssertMsg1(const char *pszExpr, const char *pszFile, unsigned iLine, const char *pszFunction); /** * Helper function that displays custom assert message. * * @param pszFormat Format string that get passed to vprintf. * @param ... Format arguments. */ void kDbgAssertMsg2(const char *pszFormat, ...); #ifdef KDBG_STRICT # define kDbgAssert(expr) \ do { \ if (!(expr)) \ { \ kDbgAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kDbgAssertBreakpoint(); \ } \ } while (0) # define kDbgAssertReturn(expr, rcRet) \ do { \ if (!(expr)) \ { \ kDbgAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kDbgAssertBreakpoint(); \ return (rcRet); \ } \ } while (0) # define kDbgAssertMsg(expr, msg) \ do { \ if (!(expr)) \ { \ kDbgAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kDbgAssertMsg2 msg; \ kDbgAssertBreakpoint(); \ } \ } while (0) # define kDbgAssertMsgReturn(expr, msg, rcRet) \ do { \ if (!(expr)) \ { \ kDbgAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kDbgAssertMsg2 msg; \ kDbgAssertBreakpoint(); \ return (rcRet); \ } \ } while (0) #else /* !KDBG_STRICT */ # define kDbgAssert(expr) do { } while (0) # define kDbgAssertReturn(expr, rcRet) do { if (!(expr)) return (rcRet); } while (0) # define kDbgAssertMsg(expr, msg) do { } while (0) # define kDbgAssertMsgReturn(expr, msg, rcRet) do { if (!(expr)) return (rcRet); } while (0) #endif /* !KDBG_STRICT */ #define kDbgAssertPtr(ptr) kDbgAssertMsg(KDBG_VALID_PTR(ptr), ("%s = %p\n", #ptr, (ptr))) #define kDbgAssertPtrReturn(ptr, rcRet) kDbgAssertMsgReturn(KDBG_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet)), (rcRet)) #define kDbgAssertPtrNull(ptr) kDbgAssertMsg(!(ptr) || KDBG_VALID_PTR(ptr), ("%s = %p\n", #ptr, (ptr))) #define kDbgAssertPtrNullReturn(ptr, rcRet) kDbgAssertMsgReturn(!(ptr) || KDBG_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet)), (rcRet)) #define kDbgAssertRC(rc) kDbgAssertMsg((rc) == 0, ("%s = %d\n", #rc, (rc))) #define kDbgAssertRCReturn(rc, rcRet) kDbgAssertMsgReturn((rc) == 0, ("%s = %d -> %d\n", #rc, (rc), (rcRet)), (rcRet)) #define kDbgAssertFailed() kDbgAssert(0) #define kDbgAssertFailedReturn(rcRet) kDbgAssertReturn(0, (rcRet)) #define kDbgAssertMsgFailed(msg) kDbgAssertMsg(0, msg) #define kDbgAssertMsgFailedReturn(msg, rcRet) kDbgAssertMsgReturn(0, msg, (rcRet)) /** @} */ #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgModLdr.cpp������������������������������������������������������0000664�0001750�0001750�00000006011�14670377514�021045� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgModLdr.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, kLdr Based. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kDbg.h> #include <k/kLdr.h> #include "kDbgInternal.h" /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * A kLdr based debug reader. */ typedef struct KDBGMODLDR { /** The common module core. */ KDBGMOD Core; /** Pointer to the loader module. */ PKLDRMOD pLdrMod; } KDBGMODLDR, *PKDBGMODLDR; /** * @copydoc KDBGMODOPS::pfnQueryLine */ static int kDbgModLdrQueryLine(PKDBGMOD pMod, KI32 iSegment, KDBGADDR uOffset, PKDBGLINE pLine) { //PKDBGMODLDR pThis = (PKDBGMODLDR)pMod; return KERR_NOT_IMPLEMENTED; } /** * @copydoc KDBGMODOPS::pfnQuerySymbol */ static int kDbgModLdrQuerySymbol(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PKDBGSYMBOL pSym) { //PKDBGMODLDR pThis = (PKDBGMODLDR)pMod; return KERR_NOT_IMPLEMENTED; } /** * @copydoc KDBGMODOPS::pfnClose */ static int kDbgModLdrClose(PKDBGMOD pMod) { //PKDBGMODLDr pThis = (PKDBGMODLDR)pMod; return KERR_NOT_IMPLEMENTED; } /** * @copydocs KDBGMODOPS::pfnOpen. */ static int kDbgModLdrOpen(PKDBGMOD *ppMod, PKRDR pRdr, KBOOL fCloseRdr, KFOFF off, KFOFF cb, struct KLDRMOD *pLdrMod) { return KERR_NOT_IMPLEMENTED; } /** * Methods for a PE module. */ const KDBGMODOPS g_kDbgModLdr = { "kLdr", NULL, kDbgModLdrOpen, kDbgModLdrClose, kDbgModLdrQuerySymbol, kDbgModLdrQueryLine, "kLdr" }; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgSymbol.cpp������������������������������������������������������0000664�0001750�0001750�00000005222�14670377514�021134� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgSymbol.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Symbols. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "kDbgInternal.h" #include <k/kHlpAlloc.h> /** * Duplicates a symbol. * * To save heap space, the returned symbol will not own more heap space than * it strictly need to. So, it's not possible to append stuff to the symbol * or anything of that kind. * * @returns Pointer to the duplicate. * This must be freed using kDbgSymbolFree(). * @param pSymbol The symbol to be duplicated. */ KDBG_DECL(PKDBGSYMBOL) kDbgSymbolDup(PCKDBGSYMBOL pSymbol) { kDbgAssertPtrReturn(pSymbol, NULL); KSIZE cb = K_OFFSETOF(KDBGSYMBOL, szName[pSymbol->cchName + 1]); PKDBGSYMBOL pNewSymbol = (PKDBGSYMBOL)kHlpDup(pSymbol, cb); if (pNewSymbol) pNewSymbol->cbSelf = cb; return pNewSymbol; } /** * Frees a symbol obtained from the kDbg API. * * @returns 0 on success. * @returns KERR_INVALID_POINTER if pSymbol isn't a valid pointer. * * @param pSymbol The symbol to be freed. The null pointer is ignored. */ KDBG_DECL(int) kDbgSymbolFree(PKDBGSYMBOL pSymbol) { if (!pSymbol) { kDbgAssertPtrReturn(pSymbol, KERR_INVALID_POINTER); pSymbol->cbSelf = 0; kHlpFree(pSymbol); } return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgLine.cpp��������������������������������������������������������0000664�0001750�0001750�00000005177�14670377514�020567� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgLine.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Read, Line Numbers. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "kDbgInternal.h" #include <k/kHlpAlloc.h> /** * Duplicates a line number. * * To save heap space, the returned line number will not own more heap space * than it strictly need to. So, it's not possible to append stuff to the symbol * or anything of that kind. * * @returns Pointer to the duplicate. * This must be freed using kDbgSymbolFree(). * @param pLine The line number to be duplicated. */ KDBG_DECL(PKDBGLINE) kDbgLineDup(PCKDBGLINE pLine) { kDbgAssertPtrReturn(pLine, NULL); KSIZE cb = K_OFFSETOF(KDBGLINE, szFile[pLine->cchFile + 1]); PKDBGLINE pNewLine = (PKDBGLINE)kHlpDup(pLine, cb); if (pNewLine) pNewLine->cbSelf = cb; return pNewLine; } /** * Frees a line number obtained from the kDbg API. * * @returns 0 on success. * @returns KERR_INVALID_POINTER if pLine isn't a valid pointer. * * @param pLine The line number to be freed. The null pointer is ignored. */ KDBG_DECL(int) kDbgLineFree(PKDBGLINE pLine) { if (pLine) { kDbgAssertPtrReturn(pLine, KERR_INVALID_POINTER); pLine->cbSelf = 0; kHlpFree(pLine); } return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgInternal.h������������������������������������������������������0000664�0001750�0001750�00000013155�14670377514�021114� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgInternal.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Internal Header. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kDbgInternal_h___ #define ___kDbgInternal_h___ #include <k/kHlpAssert.h> #include <k/kMagics.h> #include <k/kErrors.h> #include <k/kDbgAll.h> /** @defgroup grp_kDbgInternal Internal * @internal * @addtogroup grp_kDbg * @{ */ /** @def KDBG_STRICT * If defined the kDbg assertions and other runtime checks will be enabled. */ #ifdef K_ALL_STRICT # undef KDBG_STRICT # define KDBG_STRICT #endif /** @name Our Assert macros * @{ */ #ifdef KDBG_STRICT # define kDbgAssert(expr) kHlpAssert(expr) # define kDbgAssertReturn(expr, rcRet) kHlpAssertReturn(expr, rcRet) # define kDbgAssertReturnVoid(expr) kHlpAssertReturnVoid(expr) # define kDbgAssertMsg(expr, msg) kHlpAssertMsg(expr, msg) # define kDbgAssertMsgReturn(expr, msg, rcRet) kHlpAssertMsgReturn(expr, msg, rcRet) # define kDbgAssertMsgReturnVoid(expr, msg) kHlpAssertMsgReturnVoid(expr, msg) #else /* !KDBG_STRICT */ # define kDbgAssert(expr) do { } while (0) # define kDbgAssertReturn(expr, rcRet) do { if (!(expr)) return (rcRet); } while (0) # define kDbgAssertMsg(expr, msg) do { } while (0) # define kDbgAssertMsgReturn(expr, msg, rcRet) do { if (!(expr)) return (rcRet); } while (0) #endif /* !KDBG_STRICT */ #define kDbgAssertPtr(ptr) kDbgAssertMsg(K_VALID_PTR(ptr), ("%s = %p\n", #ptr, (ptr))) #define kDbgAssertPtrReturn(ptr, rcRet) kDbgAssertMsgReturn(K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet)), (rcRet)) #define kDbgAssertPtrReturnVoid(ptr) kDbgAssertMsgReturnVoid(K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet))) #define kDbgAssertPtrNull(ptr) kDbgAssertMsg(!(ptr) || K_VALID_PTR(ptr), ("%s = %p\n", #ptr, (ptr))) #define kDbgAssertPtrNullReturn(ptr, rcRet) kDbgAssertMsgReturn(!(ptr) || K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet)), (rcRet)) #define kDbgAssertPtrNullReturnVoid(ptr) kDbgAssertMsgReturnVoid(!(ptr) || K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet))) #define kDbgAssertRC(rc) kDbgAssertMsg((rc) == 0, ("%s = %d\n", #rc, (rc))) #define kDbgAssertRCReturn(rc, rcRet) kDbgAssertMsgReturn((rc) == 0, ("%s = %d -> %d\n", #rc, (rc), (rcRet)), (rcRet)) #define kDbgAssertRCReturnVoid(rc) kDbgAssertMsgReturnVoid((rc) == 0, ("%s = %d -> %d\n", #rc, (rc), (rcRet))) #define kDbgAssertFailed() kDbgAssert(0) #define kDbgAssertFailedReturn(rcRet) kDbgAssertReturn(0, (rcRet)) #define kDbgAssertFailedReturnVoid() kDbgAssertReturnVoid(0) #define kDbgAssertMsgFailed(msg) kDbgAssertMsg(0, msg) #define kDbgAssertMsgFailedReturn(msg, rcRet) kDbgAssertMsgReturn(0, msg, (rcRet)) #define kDbgAssertMsgFailedReturnVoid(msg) kDbgAssertMsgReturnVoid(0, msg) /** @} */ /** Return / crash validation of a reader argument. */ #define KDBGMOD_VALIDATE_EX(pDbgMod, rc) \ do { \ kDbgAssertPtrReturn((pDbgMod), (rc)); \ kDbgAssertReturn((pDbgMod)->u32Magic == KDBGMOD_MAGIC, (rc)); \ kDbgAssertReturn((pDbgMod)->pOps != NULL, (rc)); \ } while (0) /** Return / crash validation of a reader argument. */ #define KDBGMOD_VALIDATE(pDbgMod) \ do { \ kDbgAssertPtrReturn((pDbgMod), KERR_INVALID_POINTER); \ kDbgAssertReturn((pDbgMod)->u32Magic == KDBGMOD_MAGIC, KERR_INVALID_HANDLE); \ kDbgAssertReturn((pDbgMod)->pOps != NULL, KERR_INVALID_HANDLE); \ } while (0) /** Return / crash validation of a reader argument. */ #define KDBGMOD_VALIDATE_VOID(pDbgMod) \ do { \ kDbgAssertPtrReturnVoid((pDbgMod)); \ kDbgAssertReturnVoid((pDbgMod)->u32Magic == KDBGMOD_MAGIC); \ kDbgAssertReturnVoid((pDbgMod)->pOps != NULL); \ } while (0) #ifdef __cplusplus extern "C" { #endif /** @name Built-in Debug Module Readers * @{ */ extern KDBGMODOPS const g_kDbgModWinDbgHelpOpen; extern KDBGMODOPS const g_kDbgModLdr; extern KDBGMODOPS const g_kDbgModCv8; extern KDBGMODOPS const g_kDbgModDwarf; extern KDBGMODOPS const g_kDbgModHll; extern KDBGMODOPS const g_kDbgModStabs; extern KDBGMODOPS const g_kDbgModSym; extern KDBGMODOPS const g_kDbgModMapILink; extern KDBGMODOPS const g_kDbgModMapMSLink; extern KDBGMODOPS const g_kDbgModMapNm; extern KDBGMODOPS const g_kDbgModMapWLink; /** @} */ #ifdef __cplusplus } #endif /** @} */ #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgModule.cpp������������������������������������������������������0000664�0001750�0001750�00000037143�14670377514�021123� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgModule.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Module API. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "kDbgInternal.h" #include <k/kHlpString.h> #include <k/kHlpAlloc.h> /******************************************************************************* * Global Variables * *******************************************************************************/ /** * The built-in debug module readers. */ static PCKDBGMODOPS const g_aBuiltIns[] = { #if K_OS == K_OS_WINDOWS &g_kDbgModWinDbgHelpOpen, #endif &g_kDbgModLdr, // &g_kDbgModCv8, // &g_kDbgModDwarf, // &g_kDbgModHll, // &g_kDbgModStabs, // &g_kDbgModSym, // &g_kDbgModMapILink, // &g_kDbgModMapMSLink, // &g_kDbgModMapNm, // &g_kDbgModMapWLink }; /** * The debug module readers registered at runtime. */ static PKDBGMODOPS g_pHead = NULL; /** * Register a debug module reader with the kDbgModule component. * * Dynamically registered readers are kept in FIFO order, and external * readers will be tried after the builtin ones. * * Like all other kDbg APIs serializing is left to the caller. * * @returns 0 on success. * @returns KERR_INVALID_POINTER if pOps is missing bits. * @returns KERR_INVALID_PARAMETER if pOps is already in the list. * @param pOps The reader method table, kDbg takes owner ship of * this. This must be writeable as the pNext pointer * will be update. It must also stick around for as * long as kDbg is in use. */ KDBG_DECL(int) kDbgModuleRegisterReader(PKDBGMODOPS pOps) { /* * Validate input. */ kDbgAssertPtrReturn(pOps, KERR_INVALID_POINTER); kDbgAssertPtrReturn(pOps->pszName, KERR_INVALID_POINTER); kDbgAssertPtrReturn(pOps->pfnOpen, KERR_INVALID_POINTER); kDbgAssertPtrReturn(pOps->pfnClose, KERR_INVALID_POINTER); kDbgAssertPtrReturn(pOps->pfnQuerySymbol, KERR_INVALID_POINTER); kDbgAssertPtrReturn(pOps->pfnQueryLine, KERR_INVALID_POINTER); kDbgAssertPtrReturn(pOps->pszName2, KERR_INVALID_POINTER); if (kHlpStrComp(pOps->pszName, pOps->pszName2)) return KERR_INVALID_PARAMETER; kDbgAssertReturn(pOps->pNext == NULL, KERR_INVALID_PARAMETER); /* * Link it into the list. */ if (!g_pHead) g_pHead = pOps; else { PKDBGMODOPS pPrev = g_pHead; while (pPrev->pNext) pPrev = pPrev->pNext; kDbgAssertReturn(pPrev != pOps, KERR_INVALID_PARAMETER); pPrev->pNext = pOps; } return 0; } /** * Deregister a debug module reader previously registered using * the kDbgModuleRegisterReader API. * * Deregistering a reader does not mean that non of its functions * will be called after successful return, it only means that it * will no longer be subjected to new module. * * @returns 0 on success. * @returns KERR_INVALID_POINTER if pOps isn't a valid pointer. * @returns KERR_INVALID_PARAMETER if pOps wasn't registered. * @param pOps The debug module method table to deregister. */ KDBG_DECL(int) kDbgModuleDeregisterReader(PKDBGMODOPS pOps) { /* * Validate the pointer. */ kDbgAssertPtrReturn(pOps, KERR_INVALID_POINTER); /* * Find it in the list and unlink it. */ if (g_pHead == pOps) g_pHead = pOps->pNext; else { PKDBGMODOPS pPrev = g_pHead; while (pPrev && pPrev->pNext != pOps) pPrev = pPrev->pNext; if (!pPrev) return KERR_INVALID_PARAMETER; pPrev->pNext = pOps->pNext; } pOps->pNext = NULL; return 0; } /** * Worker for the kDbgModuleOpen* APIs. * * This will make sure the reader is buffered. I will also take care of * closing the reader opened by kDbgModuleOpen on failure. * * @returns 0 on success. An appropriate kErrors status code on failure. * @param ppDbgMod Where to store the new debug module reader instance. * @param pRdr The file provider. * @param fCloseRdr Whether pRdr should be close or not. This applies both * to the failure path and to the success path, where it'll * be close when the module is closed by kDbgModuleClose(). * @param off The offset into the file where the debug info is supposed * to be found. * This is 0 if the entire file is the subject. * @param cb The size of the debug info part of the file. * This is KFOFF_MAX if the entire file is the subject. * @param pLdrMod An optional kLdrMod association. */ static int kdbgModuleOpenWorker(PPKDBGMOD ppDbgMod, PKRDR pRdr, KBOOL fCloseRdr, KFOFF off, KFOFF cb, struct KLDRMOD *pLdrMod) { /* * If the reader isn't buffered create a buffered wrapper for it. */ int rc; PKRDR pRdrWrapped = NULL; if (!kRdrBufIsBuffered(pRdr)) { rc = kRdrBufWrap(&pRdrWrapped, pRdr, fCloseRdr); if (rc) { if (fCloseRdr) kRdrClose(pRdr); return rc; } pRdr = pRdrWrapped; } /* * Walk the built-in table and the list of registered readers * and let each of them have a go at the file. Stop and return * on the first one returning successfully. */ rc = KDBG_ERR_UNKOWN_FORMAT; for (KSIZE i = 0; i < K_ELEMENTS(g_aBuiltIns); i++) if (g_aBuiltIns[i]->pfnOpen) { int rc2 = g_aBuiltIns[i]->pfnOpen(ppDbgMod, pRdr, fCloseRdr, off, cb, pLdrMod); if (!rc2) return 0; if (rc2 != KDBG_ERR_UNKOWN_FORMAT && rc == KDBG_ERR_UNKOWN_FORMAT) rc = rc2; } for (PKDBGMODOPS pCur = g_pHead; pCur; pCur = pCur->pNext) if (pCur->pfnOpen) { int rc2 = pCur->pfnOpen(ppDbgMod, pRdr, fCloseRdr, off, cb, pLdrMod); if (!rc2) return 0; if (rc2 != KDBG_ERR_UNKOWN_FORMAT && rc == KDBG_ERR_UNKOWN_FORMAT) rc = rc2; } if (pRdrWrapped) kRdrClose(pRdrWrapped); else if (fCloseRdr) kRdrClose(pRdr); return rc; } /** * Opens a debug module reader for the specified file or file section * * @returns kStuff status code. * @param ppDbgMod Where to store the debug module reader handle. * @param pRdr The file reader. * @param off The offset of the file section. If the entire file, pass 0. * @param cb The size of the file section. If the entire file, pass KFOFF_MAX. * @param pLdrMod Associated kLdr module that the kDbg component can use to * verify and suplement the debug info found in the file specified * by pszFilename. The module will be used by kDbg for as long as * the returned kDbg module remains open. * This is an optional parameter, pass NULL if no kLdr module at hand. */ KDBG_DECL(int) kDbgModuleOpenFilePart(PPKDBGMOD ppDbgMod, PKRDR pRdr, KFOFF off, KFOFF cb, struct KLDRMOD *pLdrMod) { /* * Validate input. */ kDbgAssertPtrReturn(ppDbgMod, KERR_INVALID_POINTER); kDbgAssertPtrReturn(pRdr, KERR_INVALID_POINTER); kDbgAssertPtrNullReturn(pLdrMod, KERR_INVALID_POINTER); kDbgAssertMsgReturn(off >= 0 && off < KFOFF_MAX, (KFOFF_PRI "\n", off), KERR_INVALID_OFFSET); kDbgAssertMsgReturn(cb >= 0 && cb <= KFOFF_MAX, (KFOFF_PRI "\n", cb), KERR_INVALID_SIZE); kDbgAssertMsgReturn(off + cb > off, ("off=" KFOFF_PRI " cb=" KFOFF_PRI "\n", off, cb), KERR_INVALID_RANGE); *ppDbgMod = NULL; /* * Hand it over to the internal worker. */ return kdbgModuleOpenWorker(ppDbgMod, pRdr, K_FALSE /* fCloseRdr */, off, cb, pLdrMod); } /** * Opens a debug module reader for the specified file. * * @returns kStuff status code. * @param ppDbgMod Where to store the debug module reader handle. * @param pRdr The file reader. * @param pLdrMod Associated kLdr module that the kDbg component can use to * verify and suplement the debug info found in the file specified * by pszFilename. The module will be used by kDbg for as long as * the returned kDbg module remains open. * This is an optional parameter, pass NULL if no kLdr module at hand. */ KDBG_DECL(int) kDbgModuleOpenFile(PPKDBGMOD ppDbgMod, PKRDR pRdr, struct KLDRMOD *pLdrMod) { return kDbgModuleOpenFilePart(ppDbgMod, pRdr, 0, KFOFF_MAX, pLdrMod); } /** * Opens the debug info for a specified executable module. * * @returns kStuff status code. * @param ppDbgMod Where to store the debug module handle. * @param pszFilename The name of the file containing debug info and/or which * debug info is wanted. * @param pLdrMod Associated kLdr module that the kDbg component can use to * verify and suplement the debug info found in the file specified * by pszFilename. The module will be used by kDbg for as long as * the returned kDbg module remains open. * This is an optional parameter, pass NULL if no kLdr module at hand. */ KDBG_DECL(int) kDbgModuleOpen(PPKDBGMOD ppDbgMod, const char *pszFilename, struct KLDRMOD *pLdrMod) { /* * Validate input. */ kDbgAssertPtrReturn(ppDbgMod, KERR_INVALID_POINTER); kDbgAssertPtrReturn(pszFilename, KERR_INVALID_POINTER); kDbgAssertMsgReturn(*pszFilename, ("%p\n", pszFilename), KERR_INVALID_PARAMETER); kDbgAssertPtrNullReturn(pLdrMod, KERR_INVALID_POINTER); *ppDbgMod = NULL; /* * Open the file and see if we can read it. */ PKRDR pRdr; int rc = kRdrBufOpen(&pRdr, pszFilename); if (rc) return rc; rc = kdbgModuleOpenWorker(ppDbgMod, pRdr, K_TRUE /* fCloseRdr */, 0, KFOFF_MAX, pLdrMod); return rc; } /** * Closes the module. * * @returns IPRT status code. * @param pMod The module handle. */ KDBG_DECL(int) kDbgModuleClose(PKDBGMOD pMod) { KDBGMOD_VALIDATE(pMod); int rc = pMod->pOps->pfnClose(pMod); if (!rc) { pMod->u32Magic++; kHlpFree(pMod); } return rc; } /** * Gets a symbol by segment:offset. * This will be approximated to the nearest symbol if there is no exact match. * * @returns IPRT status code. * @param pMod The module. * @param iSegment The segment this offset is relative to. * The -1 segment is special, it means that the addres is relative to * the image base. The image base is where the first bit of the image * is mapped during load. * @param off The offset into the segment. * @param pSym Where to store the symbol details. */ KDBG_DECL(int) kDbgModuleQuerySymbol(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PKDBGSYMBOL pSym) { KDBGMOD_VALIDATE(pMod); kDbgAssertPtrReturn(pSym, KERR_INVALID_POINTER); return pMod->pOps->pfnQuerySymbol(pMod, iSegment, off, pSym); } /** * Gets & allocates a symbol by segment:offset. * This will be approximated to the nearest symbol if there is no exact match. * * @returns IPRT status code. * @param pMod The module. * @param iSegment The segment this offset is relative to. * The -1 segment is special, it means that the addres is relative to * the image base. The image base is where the first bit of the image * is mapped during load. * @param off The offset into the segment. * @param ppSym Where to store the pointer to the symbol info. * Free the returned symbol using kDbgSymbolFree(). */ KDBG_DECL(int) kDbgModuleQuerySymbolA(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PPKDBGSYMBOL ppSym) { kDbgAssertPtrReturn(ppSym, KERR_INVALID_POINTER); KDBGSYMBOL Sym; int rc = kDbgModuleQuerySymbol(pMod, iSegment, off, &Sym); if (!rc) { *ppSym = kDbgSymbolDup(&Sym); if (!*ppSym) rc = KERR_NO_MEMORY; } else *ppSym = NULL; return rc; } /** * Gets a line number entry by segment:offset. * This will be approximated to the nearest line number there is no exact match. * * @returns IPRT status code. * @param pMod The module. * @param iSegment The segment this offset is relative to. * The -1 segment is special, it means that the addres is relative to * the image base. The image base is where the first bit of the image * is mapped during load. * @param off The offset into the segment. * @param pLine Where to store the line number details. */ KDBG_DECL(int) kDbgModuleQueryLine(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PKDBGLINE pLine) { KDBGMOD_VALIDATE(pMod); kDbgAssertPtrReturn(pLine, KERR_INVALID_POINTER); return pMod->pOps->pfnQueryLine(pMod, iSegment, off, pLine); } /** * Gets & allocates a line number entry by segment:offset. * This will be approximated to the nearest line number there is no exact match. * * @returns IPRT status code. * @param pMod The module. * @param iSegment The segment this offset is relative to. * The -1 segment is special, it means that the addres is relative to * the image base. The image base is where the first bit of the image * is mapped during load. * @param off The offset into the segment. * @param ppLine Where to store the pointer to the line number info. * Free the returned line number using kDbgLineFree(). */ KDBG_DECL(int) kDbgModuleQueryLineA(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PPKDBGLINE ppLine) { kDbgAssertPtrReturn(ppLine, KERR_INVALID_POINTER); KDBGLINE Line; int rc = kDbgModuleQueryLine(pMod, iSegment, off, &Line); if (!rc) { *ppLine = kDbgLineDup(&Line); if (!*ppLine) rc = KERR_NO_MEMORY; } else *ppLine = NULL; return rc; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgSpace.cpp�������������������������������������������������������0000664�0001750�0001750�00000013731�14670377514�020726� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgSpace.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Address Space Manager. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "kDbgInternal.h" #include <k/kHlpAlloc.h> #include <k/kHlpString.h> #include <k/kAvl.h> /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** Pointer to a name space module. */ typedef struct KDBGSPACEMOD *PKDBGSPACEMOD; /** * Tracks a module segment in the address space. * * These segments are organized in two trees, by address in the * KDBGSPACE::pSegRoot tree and by selector value in the * KDBGSPACE::pSegSelRoot tree. * * While the debug module reader could easily provide us with * segment names and it could perhaps be interesting to lookup * a segment by its name in some situations, this has been * considered too much bother for now. :-) */ typedef struct KDBGSPACESEG { /** The module segment index. */ KI32 iSegment; /** The address space module structure this segment belongs to. */ PKDBGSPACEMOD pSpaceMod; } KDBGSPACESEG; typedef KDBGSPACESEG *PKDBGSPACESEG; /** * Track a module in the name space. * * Each module in the address space can be addressed efficiently * by module name. The module name has to be unique. */ typedef struct KDBGSPACEMOD { /** The module name hash. */ KU32 u32Hash; /** The length of the module name. */ KU32 cchName; /** The module name. */ char *pszName; /** The next module in the same bucket. */ PKDBGSPACEMOD pNext; /** Pointer to the debug module reader. */ PKDBGMOD pMod; /** The number of segments. */ KU32 cSegs; /** The segment array. (variable length) */ KDBGSPACESEG aSegs[1]; } KDBGSPACEMOD; typedef struct KDBGCACHEDSYM *PKDBGCACHEDSYM; /** * A cached symbol. */ typedef struct KDBGCACHEDSYM { /** The symbol name hash. */ KU32 u32Hash; /** The next symbol in the same bucket. */ PKDBGCACHEDSYM pNext; /** The next symbol belonging to the same module as this. */ PKDBGCACHEDSYM pNextMod; /** The cached symbol information. */ KDBGSYMBOL Sym; } KDBGCACHEDSYM; /** * A symbol cache. */ typedef struct KDBGSYMCACHE { /** The symbol cache magic. (KDBGSYMCACHE_MAGIC) */ KU32 u32Magic; /** The maximum number of symbols.*/ KU32 cMax; /** The current number of symbols.*/ KU32 cCur; /** The number of hash buckets. */ KU32 cBuckets; /** The address lookup tree. */ PKDBGADDRAVL pAddrTree; /** Array of hash buckets. * The size is selected according to the cache size. */ PKDBGCACHEDSYM *paBuckets[1]; } KDBGSYMCACHE; typedef KDBGSYMCACHE *PKDBGSYMCACHE; /** * A user symbol record. * * The user symbols are organized in the KDBGSPACE::pUserRoot tree * and form an overlay that overrides the debug info retrieved from * the KDBGSPACE::pSegRoot tree. * * In the current implementation the user symbols are unique and * one would have to first delete a symbol in order to add another * at the same address. This may be changed later, perhaps. */ typedef struct KDBGSPACEUSERSYM { } KDBGSPACEUSERSYM; typedef KDBGSPACEUSERSYM *PKDBGSPACEUSERSYM; /** * Address space. */ typedef struct KDBGSPACE { /** The addresspace magic. (KDBGSPACE_MAGIC) */ KU32 u32Magic; /** User defined address space identifier or data pointer. */ KUPTR uUser; /** The name of the address space. (Optional) */ const char *pszName; } KDBGSPACE; /** Pointer to an address space. */ typedef struct KDBGSPACE *PKDBGSPACE; /** Pointer to an address space pointer. */ typedef PKDBGSPACE *PPKDBGSPACE; KDBG_DECL(int) kDbgSpaceCreate(PPDBGSPACE ppSpace, KDBGADDR LowAddr, DBGADDR HighAddr, KUPTR uUser, const char *pszName) { /* * Validate input. */ kDbgAssertPtrReturn(ppSpace); *ppSpace = NULL; kDbgAssertPtrNullReturn(pszName); kDbgAssertReturn(LowAddr < HighAddr); /* * Create and initialize the address space. */ PKDBGSPACE pSpace = (PKDBGSPACE)kHlpAlloc(sizeof(*pSpace)); if (!pSpace) return KERR_NO_MEMORY; pSpace->u32Magic = KDBGSPACE_MAGIC; pSpace->uUser = uUser; pSpace->pszName = pszName; } ���������������������������������������kbuild-3608/src/lib/kStuff/kDbg/kDbgDump.cpp��������������������������������������������������������0000664�0001750�0001750�00000012235�14670377514�020576� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgDump.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbgDump - Debug Info Dumper. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kDbg.h> #include <string.h> #include <stdio.h> /******************************************************************************* * Global Variables * *******************************************************************************/ /** @name Options * @{ */ static int g_fGlobalSyms = 1; static int g_fPrivateSyms = 1; static int g_fLineNumbers = 0; /** @} */ /** * Dumps one file. * * @returns main exit status. * @param pszFile The file to dump (path to it). */ static int DumpFile(const char *pszFile) { PKDBGMOD pDbgMod; int rc = kDbgModuleOpen(&pDbgMod, pszFile, NULL); if (rc) { printf("kDbgDump: error: kDbgModuleOpen('%s',) failed with rc=%d.\n", pszFile, rc); return 1; } return 0; } /** * Prints the version number * @return 0 */ static int ShowVersion() { printf("kDbgDump v0.0.1\n"); return 0; } /** * Prints the program syntax. * * @returns 1 * @param argv0 The program name. */ static int ShowSyntax(const char *argv0) { ShowVersion(); printf("syntax: %s [options] <files>\n" "\n", argv0); return 1; } int main(int argc, char **argv) { int rcRet = 0; /* * Parse arguments. */ int fArgsDone = 0; for (int i = 1; i < argc; i++) { const char *psz = argv[i]; if (!fArgsDone && psz[0] == '-' && psz[1]) { /* convert long option to short. */ if (*++psz == '-') { psz++; if (!*psz) /* -- */ { fArgsDone = 1; continue; } if (!strcmp(psz, "line-numbers")) psz = "l"; else if (!strcmp(psz, "no-line-numbers")) psz = "L"; else if (!strcmp(psz, "global-syms") || !strcmp(psz, "public-syms")) psz = "g"; else if (!strcmp(psz, "no-global-syms") || !strcmp(psz, "no-public-syms")) psz = "G"; else if (!strcmp(psz, "privat-syms") || !strcmp(psz, "local-syms")) psz = "p"; else if (!strcmp(psz, "no-privat-syms") || !strcmp(psz, "no-local-syms")) psz = "P"; else if (!strcmp(psz, "version")) psz = "v"; else if (!strcmp(psz, "help")) psz = "h"; else { fprintf(stderr, "%s: syntax error: unknown option '--%s'\n", argv[0], psz); return 1; } } /* eat short options. */ while (*psz) switch (*psz++) { case 'l': g_fLineNumbers = 1; break; case 'L': g_fLineNumbers = 0; break; case 'p': g_fPrivateSyms = 1; break; case 'P': g_fPrivateSyms = 0; break; case 'g': g_fGlobalSyms = 1; break; case 'G': g_fGlobalSyms = 0; break; case '?': case 'H': case 'h': return ShowSyntax(argv[0]); case 'v': return ShowVersion(); default: fprintf(stderr, "%s: syntax error: unknown option '-%c'.\n", argv[0], psz[-1]); return 1; } } else { /* Dump does it's own bitching if something goes wrong. */ int rc = DumpFile(psz); if (rc && !rcRet) rc = rcRet; } } return rcRet; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kCpu/��������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377515�016426� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kCpu/Makefile.kmk��������������������������������������������������������0000664�0001750�0001750�00000002712�14670377515�020651� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kCpu - The CPU and Architecture API, sub-makefile. # # # Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. SUB_DEPTH = .. include $(PATH_KBUILD)/subheader.kmk LIBRARIES += kCpuStatic kCpuStatic_TEMPLATE = kStuffLIB kCpuStatic_SOURCES = \ kCpuCompare.c \ kCpuGetArchAndCpu.c include $(PATH_KBUILD)/subfooter.kmk ������������������������������������������������������kbuild-3608/src/lib/kStuff/kCpu/kCpuCompare.c�������������������������������������������������������0000664�0001750�0001750�00000011347�14670377514�021010� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kCpuCompare.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kCpu - kCpuCompare. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kCpu.h> #include <k/kErrors.h> /** * Compares arch+cpu some code was generated for with a arch+cpu for executing it * to see if it'll work out fine or not. * * @returns 0 if the code is compatible with the cpu. * @returns KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE if the arch+cpu isn't compatible with the code. * * @param enmCodeArch The architecture the code was generated for. * @param enmCodeCpu The cpu the code was generated for. * @param enmArch The architecture to run it on. * @param enmCpu The cpu to run it on. */ KCPU_DECL(int) kCpuCompare(KCPUARCH enmCodeArch, KCPU enmCodeCpu, KCPUARCH enmArch, KCPU enmCpu) { /* * Compare arch and cpu. */ if (enmCodeArch != enmArch) return KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; /* exact match is nice. */ if (enmCodeCpu == enmCpu) return 0; switch (enmArch) { case K_ARCH_X86_16: if (enmCpu < KCPU_FIRST_X86_16 || enmCpu > KCPU_LAST_X86_16) return KERR_INVALID_PARAMETER; /* intel? */ if (enmCodeCpu <= KCPU_CORE2_16) { /* also intel? */ if (enmCpu <= KCPU_CORE2_16) return enmCodeCpu <= enmCpu ? 0 : KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; switch (enmCpu) { case KCPU_K6_16: return enmCodeCpu <= KCPU_I586 ? 0 : KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; case KCPU_K7_16: case KCPU_K8_16: default: return enmCodeCpu <= KCPU_I686 ? 0 : KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; } } /* amd */ return enmCpu >= KCPU_K6_16 && enmCpu <= KCPU_K8_16 ? 0 : KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; case K_ARCH_X86_32: if (enmCpu < KCPU_FIRST_X86_32 || enmCpu > KCPU_LAST_X86_32) return KERR_INVALID_PARAMETER; /* blend? */ if (enmCodeCpu == KCPU_X86_32_BLEND) return 0; /* intel? */ if (enmCodeCpu <= KCPU_CORE2_32) { /* also intel? */ if (enmCpu <= KCPU_CORE2_32) return enmCodeCpu <= enmCpu ? 0 : KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; switch (enmCpu) { case KCPU_K6: return enmCodeCpu <= KCPU_I586 ? 0 : KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; case KCPU_K7: case KCPU_K8_32: default: return enmCodeCpu <= KCPU_I686 ? 0 : KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; } } /* amd */ return enmCpu >= KCPU_K6 && enmCpu <= KCPU_K8_32 ? 0 : KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; case K_ARCH_AMD64: if (enmCpu < KCPU_FIRST_AMD64 || enmCpu > KCPU_LAST_AMD64) return KERR_INVALID_PARAMETER; /* blend? */ if (enmCodeCpu == KCPU_AMD64_BLEND) return 0; /* this is simple for now. */ return KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; default: break; } return KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kCpu/kCpuGetArchAndCpu.c�������������������������������������������������0000664�0001750�0001750�00000004034�14670377514�022025� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kCpuGetArchAndCpu.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kCpu - kCpuGetArchAndCpu. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kCpu.h> /** * Gets the arch+cpu of the calling cpu. * * @param penmArch Where to store the cpu architecture. * @param penmCpu Where to store the cpu brand/model. */ KCPU_DECL(void) kCpuGetArchAndCpu(PKCPUARCH penmArch, PKCPU penmCpu) { #if K_ARCH == K_ARCH_AMD64 *penmArch = KCPUARCH_AMD64; *penmCpu = KCPU_AMD64_BLEND; /** @todo check it using cpu. */ #elif K_ARCH == K_ARCH_X86_32 *penmArch = KCPUARCH_X86_32; *penmCpu = KCPU_X86_32_BLEND; /** @todo check it using cpu. */ #else # error "Port me" #endif } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/�����������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377512�017144� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/���������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377513�017377� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kDbgAll.h������������������������������������������������������0000664�0001750�0001750�00000014042�14670377513�021051� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgAll.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Read, All Details and Dependencies Included. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kDbgAll_h___ #define ___k_kDbgAll_h___ #include <k/kDefs.h> #include <k/kTypes.h> #include <k/kRdr.h> #include <k/kLdr.h> #include <k/kDbg.h> #ifdef __cplusplus extern "C" { #endif /** @defgroup grp_kDbgAll All * @addtogroup grp_kDbg * @{ */ /** * The debug module method table. */ typedef struct KDBGMODOPS { /** The name of the reader. */ const char *pszName; /** Pointer to the next debug module readers. * This is only used for dynamically registered readers. */ struct KDBGMODOPS *pNext; /** * Tries to open the module. * * @returns 0 on success, KDBG_ERR on failure. * @param ppMod Where to store the module that's been opened. * @param pRdr The file provider. * @param fCloseRdrs Whether the reader should be closed or not when the module is destroyed. * @param off The file offset of the debug info. This is 0 if there isn't * any specfic debug info section and the reader should start * looking for debug info at the start of the file. * @param cb The size of the debug info in the file. INT64_MAX if we don't * know or there isn't any particular debug info section in the file. * @param pLdrMod The associated loader module. This can be NULL. */ int (*pfnOpen)(PKDBGMOD *ppMod, PKRDR pRdr, KBOOL fCloseRdr, KFOFF off, KFOFF cb, struct KLDRMOD *pLdrMod); /** * Closes the module. * * This should free all resources associated with the module * except the pMod which is freed by the caller. * * @returns IPRT status code. * @param pMod The module. */ int (*pfnClose)(PKDBGMOD pMod); /** * Gets a symbol by segment:offset. * This will be approximated to the nearest symbol if there is no exact match. * * @returns 0 on success. KLDR_ERR_* on failure. * @param pMod The module. * @param iSegment The segment this offset is relative to. * The -1 segment is special, it means that the addres is relative to * the image base. The image base is where the first bit of the image * is mapped during load. * @param off The offset into the segment. * @param pSym Where to store the symbol details. */ int (*pfnQuerySymbol)(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PKDBGSYMBOL pSym); /** * Gets a line number entry by segment:offset. * This will be approximated to the nearest line number there is no exact match. * * @returns 0 on success. KLDR_ERR_* on failure. * @param pMod The module. * @param iSegment The segment this offset is relative to. * The -1 segment is special, it means that the addres is relative to * the image base. The image base is where the first bit of the image * is mapped during load. * @param off The offset into the segment. * @param pLine Where to store the line number details. */ int (*pfnQueryLine)(PKDBGMOD pMod, KI32 iSegment, KDBGADDR uOffset, PKDBGLINE pLine); /** This is just to make sure you've initialized all the fields. * Must be identical to pszName. */ const char *pszName2; } KDBGMODOPS; /** Pointer to a module method table. */ typedef KDBGMODOPS *PKDBGMODOPS; /** Pointer to a const module method table. */ typedef const KDBGMODOPS *PCKDBGMODOPS; /** * Register a debug module reader with the kDbgModule component. * * Dynamically registered readers are kept in FIFO order, and external * readers will be tried after the builtin ones. * * @returns 0 on success. * @returns KERR_INVALID_POINTER if pOps is missing bits. * @returns KERR_INVALID_PARAMETER if pOps is already in the list. * @param pOps The reader method table, kDbg takes owner ship of * this. This must be writeable as the pNext pointer * will be update. It must also stick around for as * long as kDbg is in use. */ KDBG_DECL(int) kDbgModuleRegisterReader(PKDBGMODOPS pOps); /** * Internal representation of a debug module. */ typedef struct KDBGMOD { /** Magic value (KDBGMOD_MAGIC). */ KI32 u32Magic; /** Pointer to the method table. */ PCKDBGMODOPS pOps; /** The file provider for the file containing the debug info. */ PKRDR pRdr; /** Whether or not to close pRdr. */ KBOOL fCloseRdr; /** The associated kLdr module. This may be NULL. */ PKLDRMOD pLdrMod; } KDBGMOD; /** @}*/ #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kDefs.h��������������������������������������������������������0000664�0001750�0001750�00000050524�14670377513�020612� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDefs.h 120 2022-02-18 02:00:53Z bird $ */ /** @file * kTypes - Defines and Macros. */ /* * Copyright (c) 2006-2017 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kDefs_h___ #define ___k_kDefs_h___ /** @defgroup grp_kDefs kDefs - Defines and Macros * @{ */ /** @name Operative System Identifiers. * These are the value that the K_OS \#define can take. * @{ */ /** Unknown OS. */ #define K_OS_UNKNOWN 0 /** Darwin - aka Mac OS X. */ #define K_OS_DARWIN 1 /** DragonFly BSD. */ #define K_OS_DRAGONFLY 2 /** FreeBSD. */ #define K_OS_FREEBSD 3 /** GNU/Hurd. */ #define K_OS_GNU_HURD 4 /** GNU/kFreeBSD. */ #define K_OS_GNU_KFBSD 5 /** GNU/kNetBSD or GNU/NetBSD or whatever the decide to call it. */ #define K_OS_GNU_KNBSD 6 /** Haiku. */ #define K_OS_HAIKU 7 /** Linux. */ #define K_OS_LINUX 8 /** NetBSD. */ #define K_OS_NETBSD 9 /** NT (native). */ #define K_OS_NT 10 /** OpenBSD*/ #define K_OS_OPENBSD 11 /** OS/2 */ #define K_OS_OS2 12 /** Solaris */ #define K_OS_SOLARIS 13 /** Windows. */ #define K_OS_WINDOWS 14 /** The max K_OS_* value (exclusive). */ #define K_OS_MAX 15 /** @} */ /** @def K_OS * Indicates which OS we're targetting. It's a \#define with is * assigned one of the K_OS_* defines above. * * So to test if we're on FreeBSD do the following: * @code * #if K_OS == K_OS_FREEBSD * some_funky_freebsd_specific_stuff(); * #endif * @endcode */ #ifndef K_OS # if defined(__APPLE__) # define K_OS K_OS_DARWIN # elif defined(__DragonFly__) # define K_OS K_OS_DRAGONFLY # elif defined(__FreeBSD__) # define K_OS K_OS_FREEBSD # elif defined(__FreeBSD_kernel__) # define K_OS K_OS_GNU_KFBSD # elif defined(__gnu_hurd__) # define K_OS K_OS_GNU_HURD # elif defined(__gnu_linux__) # define K_OS K_OS_LINUX # elif defined(__NetBSD__) /*??*/ # define K_OS K_OS_NETBSD # elif defined(__NetBSD_kernel__) # define K_OS K_OS_GNU_KNBSD # elif defined(__OpenBSD__) /*??*/ # define K_OS K_OS_OPENBSD # elif defined(__OS2__) # define K_OS K_OS_OS2 # elif defined(__sun__) || defined(__SunOS__) || defined(__sun) || defined(__SunOS) # define K_OS K_OS_SOLARIS # elif defined(_WIN32) || defined(_WIN64) # define K_OS K_OS_WINDOWS # elif defined(__haiku__) || defined(__HAIKU__) # define K_OS K_OS_HAIKU # else # error "Port Me" # endif #endif #if K_OS < K_OS_UNKNOWN || K_OS >= K_OS_MAX # error "Invalid K_OS value." #endif /** @name Architecture bit width. * @{ */ #define K_ARCH_BIT_8 0x0100 /**< 8-bit */ #define K_ARCH_BIT_16 0x0200 /**< 16-bit */ #define K_ARCH_BIT_32 0x0400 /**< 32-bit */ #define K_ARCH_BIT_64 0x0800 /**< 64-bit */ #define K_ARCH_BIT_128 0x1000 /**< 128-bit */ #define K_ARCH_BIT_MASK 0x1f00 /**< The bit mask. */ #define K_ARCH_BIT_SHIFT 5 /**< Shift count for producing the width in bits. */ #define K_ARCH_BYTE_SHIFT 8 /**< Shift count for producing the width in bytes. */ /** @} */ /** @name Architecture Endianness. * @{ */ #define K_ARCH_END_LITTLE 0x2000 /**< Little-endian. */ #define K_ARCH_END_BIG 0x4000 /**< Big-endian. */ #define K_ARCH_END_BI 0x6000 /**< Bi-endian, can be switched. */ #define K_ARCH_END_MASK 0x6000 /**< The endian mask. */ #define K_ARCH_END_SHIFT 13 /**< Shift count for converting between this K_ENDIAN_*. */ /** @} */ /** @name Architecture Identifiers. * These are the value that the K_ARCH \#define can take. *@{ */ /** Unknown CPU architecture. */ #define K_ARCH_UNKNOWN ( 0 ) /** Clone or Intel 16-bit x86. */ #define K_ARCH_X86_16 ( 1 | K_ARCH_BIT_16 | K_ARCH_END_LITTLE) /** Clone or Intel 32-bit x86. */ #define K_ARCH_X86_32 ( 1 | K_ARCH_BIT_32 | K_ARCH_END_LITTLE) /** AMD64 (including clones). */ #define K_ARCH_AMD64 ( 2 | K_ARCH_BIT_64 | K_ARCH_END_LITTLE) /** Itanic (64-bit). */ #define K_ARCH_IA64 ( 3 | K_ARCH_BIT_64 | K_ARCH_END_BI) /** ALPHA (64-bit). */ #define K_ARCH_ALPHA ( 4 | K_ARCH_BIT_64 | K_ARCH_END_BI) /** ALPHA limited to 32-bit. */ #define K_ARCH_ALPHA_32 ( 4 | K_ARCH_BIT_32 | K_ARCH_END_BI) /** 32-bit ARM. */ #define K_ARCH_ARM_32 ( 5 | K_ARCH_BIT_32 | K_ARCH_END_BI) /** 64-bit ARM. */ #define K_ARCH_ARM_64 ( 5 | K_ARCH_BIT_64 | K_ARCH_END_BI) /** Motorola 68000 (32-bit). */ #define K_ARCH_M68K ( 6 | K_ARCH_BIT_32 | K_ARCH_END_BIG) /** 32-bit MIPS. */ #define K_ARCH_MIPS_32 ( 7 | K_ARCH_BIT_32 | K_ARCH_END_BI) /** 64-bit MIPS. */ #define K_ARCH_MIPS_64 ( 7 | K_ARCH_BIT_64 | K_ARCH_END_BI) /** 32-bit PA-RISC. */ #define K_ARCH_PARISC_32 ( 8 | K_ARCH_BIT_32 | K_ARCH_END_BI) /** 64-bit PA-RISC. */ #define K_ARCH_PARISC_64 ( 8 | K_ARCH_BIT_64 | K_ARCH_END_BI) /** 32-bit PowerPC. */ #define K_ARCH_POWERPC_32 ( 9 | K_ARCH_BIT_32 | K_ARCH_END_BI) /** 64-bit PowerPC. */ #define K_ARCH_POWERPC_64 ( 9 | K_ARCH_BIT_64 | K_ARCH_END_BI) /** 32(31)-bit S390. */ #define K_ARCH_S390_32 (10 | K_ARCH_BIT_32 | K_ARCH_END_BIG) /** 64-bit S390. */ #define K_ARCH_S390_64 (10 | K_ARCH_BIT_64 | K_ARCH_END_BIG) /** 32-bit SuperH. */ #define K_ARCH_SH_32 (11 | K_ARCH_BIT_32 | K_ARCH_END_BI) /** 64-bit SuperH. */ #define K_ARCH_SH_64 (11 | K_ARCH_BIT_64 | K_ARCH_END_BI) /** 32-bit SPARC. */ #define K_ARCH_SPARC_32 (12 | K_ARCH_BIT_32 | K_ARCH_END_BIG) /** 64-bit SPARC. */ #define K_ARCH_SPARC_64 (12 | K_ARCH_BIT_64 | K_ARCH_END_BI) /** 32-bit RISC-V, little endian. */ #define K_ARCH_RISCV_32 (13 | K_ARCH_BIT_32 | K_ARCH_END_LITTLE) /** 32-bit RISC-V, big endian. */ #define K_ARCH_RISCV_32_BE (13 | K_ARCH_BIT_32 | K_ARCH_END_BIG) /** 64-bit RISC-V, little endian. */ #define K_ARCH_RISCV_64 (13 | K_ARCH_BIT_64 | K_ARCH_END_LITTLE) /** 64-bit RISC-V, big endian. */ #define K_ARCH_RISCV_64_BE (13 | K_ARCH_BIT_64 | K_ARCH_END_BIG) /** The end of the valid architecture values (exclusive). */ #define K_ARCH_MAX (12+1) /** @} */ /** @def K_ARCH * The value of this \#define indicates which architecture we're targetting. */ #ifndef K_ARCH /* detection based on compiler defines. */ # if defined(__amd64__) || defined(__x86_64__) || defined(__AMD64__) || defined(_M_X64) || defined(__amd64) # define K_ARCH K_ARCH_AMD64 # elif defined(__i386__) || defined(__x86__) || defined(__X86__) || defined(_M_IX86) || defined(__i386) # define K_ARCH K_ARCH_X86_32 # elif defined(__ia64__) || defined(__IA64__) || defined(_M_IA64) # define K_ARCH K_ARCH_IA64 # elif defined(__alpha__) # define K_ARCH K_ARCH_ALPHA # elif defined(__arm__) || defined(__arm32__) # define K_ARCH K_ARCH_ARM_32 # elif defined(__aarch64__) || defined(__arm64__) # define K_ARCH K_ARCH_ARM_64 # elif defined(__hppa__) && defined(__LP64__) # define K_ARCH K_ARCH_PARISC_64 # elif defined(__hppa__) # define K_ARCH K_ARCH_PARISC_32 # elif defined(__m68k__) # define K_ARCH K_ARCH_M68K # elif defined(__mips64) # define K_ARCH K_ARCH_MIPS_64 # elif defined(__mips__) # define K_ARCH K_ARCH_MIPS_32 # elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) # define K_ARCH K_ARCH_POWERPC_64 # elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) # define K_ARCH K_ARCH_POWERPC_32 # elif defined(__riscv) # if __BYTE_ORDER__ == WORDS_BIG_ENDIAN # if defined(__riscv32) || __riscv_xlen+0 == 32 # define K_ARCH K_ARCH_RISCV_32_BE # else # define K_ARCH K_ARCH_RISCV_64_BE # endif # elif defined(__riscv32) || __riscv_xlen+0 == 32 # define K_ARCH K_ARCH_RISCV_32 # else # define K_ARCH K_ARCH_RISCV_64 # endif # elif defined(__sparcv9__) || defined(__sparcv9) # define K_ARCH K_ARCH_SPARC_64 # elif defined(__sparc__) || defined(__sparc) # define K_ARCH K_ARCH_SPARC_32 # elif defined(__s390x__) # define K_ARCH K_ARCH_S390_64 # elif defined(__s390__) # define K_ARCH K_ARCH_S390_32 # elif defined(__sh__) # if !defined(__SH5__) # define K_ARCH K_ARCH_SH_32 # else # if __SH5__ == 64 # define K_ARCH K_ARCH_SH_64 # else # define K_ARCH K_ARCH_SH_32 # endif # endif # else # error "Port Me" # endif #else /* validate the user specified value. */ # if (K_ARCH & K_ARCH_BIT_MASK) != K_ARCH_BIT_8 \ && (K_ARCH & K_ARCH_BIT_MASK) != K_ARCH_BIT_16 \ && (K_ARCH & K_ARCH_BIT_MASK) != K_ARCH_BIT_32 \ && (K_ARCH & K_ARCH_BIT_MASK) != K_ARCH_BIT_64 \ && (K_ARCH & K_ARCH_BIT_MASK) != K_ARCH_BIT_128 # error "Invalid K_ARCH value (bit)" # endif # if (K_ARCH & K_ARCH_END_MASK) != K_ARCH_END_LITTLE \ && (K_ARCH & K_ARCH_END_MASK) != K_ARCH_END_BIG \ && (K_ARCH & K_ARCH_END_MASK) != K_ARCH_END_BI # error "Invalid K_ARCH value (endian)" # endif # if (K_ARCH & ~(K_ARCH_BIT_MASK | K_ARCH_BIT_END_MASK)) < K_ARCH_UNKNOWN \ || (K_ARCH & ~(K_ARCH_BIT_MASK | K_ARCH_BIT_END_MASK)) >= K_ARCH_MAX # error "Invalid K_ARCH value" # endif #endif /** @def K_ARCH_IS_VALID * Check if the architecture identifier is valid. * @param arch The K_ARCH_* define to examin. */ #define K_ARCH_IS_VALID(arch) ( ( ((arch) & K_ARCH_BIT_MASK) == K_ARCH_BIT_8 \ || ((arch) & K_ARCH_BIT_MASK) == K_ARCH_BIT_16 \ || ((arch) & K_ARCH_BIT_MASK) == K_ARCH_BIT_32 \ || ((arch) & K_ARCH_BIT_MASK) == K_ARCH_BIT_64 \ || ((arch) & K_ARCH_BIT_MASK) == K_ARCH_BIT_128) \ && \ ( ((arch) & K_ARCH_END_MASK) == K_ARCH_END_LITTLE \ || ((arch) & K_ARCH_END_MASK) == K_ARCH_END_BIG \ || ((arch) & K_ARCH_END_MASK) == K_ARCH_END_BI) \ && \ ( ((arch) & ~(K_ARCH_BIT_MASK | K_ARCH_END_MASK)) >= K_ARCH_UNKNOWN \ && ((arch) & ~(K_ARCH_BIT_MASK | K_ARCH_END_MASK)) < K_ARCH_MAX) \ ) /** @def K_ARCH_BITS_EX * Determin the architure byte width of the specified architecture. * @param arch The K_ARCH_* define to examin. */ #define K_ARCH_BITS_EX(arch) ( ((arch) & K_ARCH_BIT_MASK) >> K_ARCH_BIT_SHIFT ) /** @def K_ARCH_BYTES_EX * Determin the architure byte width of the specified architecture. * @param arch The K_ARCH_* define to examin. */ #define K_ARCH_BYTES_EX(arch) ( ((arch) & K_ARCH_BIT_MASK) >> K_ARCH_BYTE_SHIFT ) /** @def K_ARCH_ENDIAN_EX * Determin the K_ENDIAN value for the specified architecture. * @param arch The K_ARCH_* define to examin. */ #define K_ARCH_ENDIAN_EX(arch) ( ((arch) & K_ARCH_END_MASK) >> K_ARCH_END_SHIFT ) /** @def K_ARCH_BITS * Determin the target architure bit width. */ #define K_ARCH_BITS K_ARCH_BITS_EX(K_ARCH) /** @def K_ARCH_BYTES * Determin the target architure byte width. */ #define K_ARCH_BYTES K_ARCH_BYTES_EX(K_ARCH) /** @def K_ARCH_ENDIAN * Determin the target K_ENDIAN value. */ #define K_ARCH_ENDIAN K_ARCH_ENDIAN_EX(K_ARCH) /** @name Endianness Identifiers. * These are the value that the K_ENDIAN \#define can take. * @{ */ #define K_ENDIAN_LITTLE 1 /**< Little-endian. */ #define K_ENDIAN_BIG 2 /**< Big-endian. */ #define K_ENDIAN_BI 3 /**< Bi-endian, can be switched. Only used with K_ARCH. */ /** @} */ /** @def K_ENDIAN * The value of this \#define indicates the target endianness. * * @remark It's necessary to define this (or add the necessary deduction here) * on bi-endian architectures. */ #ifndef K_ENDIAN /* use K_ARCH if possible. */ # if K_ARCH_ENDIAN != K_ENDIAN_BI # define K_ENDIAN K_ARCH_ENDIAN # elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) # if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ # define K_ENDIAN K_ENDIAN_LITTLE # elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ # define K_ENDIAN K_ENDIAN_BIG # else # error "Port Me or define K_ENDIAN." # endif # else # error "Port Me or define K_ENDIAN." # endif #else /* validate the user defined value. */ # if K_ENDIAN != K_ENDIAN_LITTLE \ && K_ENDIAN != K_ENDIAN_BIG # error "K_ENDIAN must either be defined as K_ENDIAN_LITTLE or as K_ENDIAN_BIG." # endif #endif /** @name Endian Conversion * @{ */ /** @def K_E2E_U16 * Convert the endian of an unsigned 16-bit value. */ # define K_E2E_U16(u16) ( (KU16) (((u16) >> 8) | ((u16) << 8)) ) /** @def K_E2E_U32 * Convert the endian of an unsigned 32-bit value. */ # define K_E2E_U32(u32) ( ( ((u32) & KU32_C(0xff000000)) >> 24 ) \ | ( ((u32) & KU32_C(0x00ff0000)) >> 8 ) \ | ( ((u32) & KU32_C(0x0000ff00)) << 8 ) \ | ( ((u32) & KU32_C(0x000000ff)) << 24 ) \ ) /** @def K_E2E_U64 * Convert the endian of an unsigned 64-bit value. */ # define K_E2E_U64(u64) ( ( ((u64) & KU64_C(0xff00000000000000)) >> 56 ) \ | ( ((u64) & KU64_C(0x00ff000000000000)) >> 40 ) \ | ( ((u64) & KU64_C(0x0000ff0000000000)) >> 24 ) \ | ( ((u64) & KU64_C(0x000000ff00000000)) >> 8 ) \ | ( ((u64) & KU64_C(0x00000000ff000000)) << 8 ) \ | ( ((u64) & KU64_C(0x0000000000ff0000)) << 24 ) \ | ( ((u64) & KU64_C(0x000000000000ff00)) << 40 ) \ | ( ((u64) & KU64_C(0x00000000000000ff)) << 56 ) \ ) /** @def K_LE2H_U16 * Unsigned 16-bit little-endian to host endian. */ /** @def K_LE2H_U32 * Unsigned 32-bit little-endian to host endian. */ /** @def K_LE2H_U64 * Unsigned 64-bit little-endian to host endian. */ /** @def K_BE2H_U16 * Unsigned 16-bit big-endian to host endian. */ /** @def K_BE2H_U32 * Unsigned 32-bit big-endian to host endian. */ /** @def K_BE2H_U64 * Unsigned 64-bit big-endian to host endian. */ #if K_ENDIAN == K_ENDIAN_LITTLE # define K_LE2H_U16(u16) ((KU16)(u16)) # define K_LE2H_U32(u32) ((KU32)(u32)) # define K_LE2H_U64(u64) ((KU64)(u32)) # define K_BE2H_U16(u16) K_E2E_U16(u16) # define K_BE2H_U32(u32) K_E2E_U32(u32) # define K_BE2H_U64(u64) K_E2E_U64(u64) #else # define K_LE2H_U16(u16) K_E2E_U16(u16) # define K_LE2H_U32(u32) K_E2E_U32(u32) # define K_LE2H_U64(u64) K_E2E_U64(u64) # define K_BE2H_U16(u16) ((KU16)(u16)) # define K_BE2H_U32(u32) ((KU32)(u32)) # define K_BE2H_U64(u64) ((KU64)(u32)) #endif /** @def K_INLINE * How to say 'inline' in both C and C++ dialects. * @param type The return type. */ #ifdef __cplusplus # if defined(__GNUC__) # define K_INLINE static inline # else # define K_INLINE inline # endif #else # if defined(__GNUC__) # define K_INLINE static __inline__ # elif defined(_MSC_VER) # define K_INLINE static __inline # else # error "Port Me" # endif #endif /** @def K_EXPORT * What to put in front of an exported function. */ #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS # define K_EXPORT __declspec(dllexport) #else # define K_EXPORT #endif /** @def K_IMPORT * What to put in front of an imported function. */ #if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS # define K_IMPORT __declspec(dllimport) #else # define K_IMPORT extern #endif /** @def K_DECL_EXPORT * Declare an exported function. * @param type The return type. */ #define K_DECL_EXPORT(type) K_EXPORT type /** @def K_DECL_IMPORT * Declare an import function. * @param type The return type. */ #define K_DECL_IMPORT(type) K_IMPORT type /** @def K_DECL_INLINE * Declare an inline function. * @param type The return type. * @remark Don't use on (class) methods. */ #define K_DECL_INLINE(type) K_INLINE type /** Get the minimum of two values. */ #define K_MIN(a, b) ( (a) <= (b) ? (a) : (b) ) /** Get the maximum of two values. */ #define K_MAX(a, b) ( (a) >= (b) ? (a) : (b) ) /** Calculate the offset of a structure member. */ #define K_OFFSETOF(strct, memb) ( (KSIZE)( &((strct *)0)->memb ) ) /** Align a size_t value. */ #define K_ALIGN_Z(val, align) ( ((val) + ((align) - 1)) & ~(KSIZE)((align) - 1) ) /** Align a void * value. */ #define K_ALIGN_P(pv, align) ( (void *)( ((KUPTR)(pv) + ((align) - 1)) & ~(KUPTR)((align) - 1) ) ) /** Number of elements in an array. */ #define K_ELEMENTS(a) ( sizeof(a) / sizeof((a)[0]) ) /** Checks if the specified pointer is a valid address or not. */ #define K_VALID_PTR(ptr) ( (KUPTR)(ptr) + 0x1000U >= 0x2000U ) /** Makes a 32-bit bit mask. */ #define K_BIT32(bit) ( KU32_C(1) << (bit)) /** Makes a 64-bit bit mask. */ #define K_BIT64(bit) ( KU64_C(1) << (bit)) /** Shuts up unused parameter and unused variable warnings. */ #define K_NOREF(var) ( (void)(var) ) /** @name Parameter validation macros * @{ */ /** Return/Crash validation of a string argument. */ #define K_VALIDATE_STRING(str) \ do { \ if (!K_VALID_PTR(str)) \ return KERR_INVALID_POINTER; \ kHlpStrLen(str); \ } while (0) /** Return/Crash validation of an optional string argument. */ #define K_VALIDATE_OPTIONAL_STRING(str) \ do { \ if (str) \ K_VALIDATE_STRING(str); \ } while (0) /** Return/Crash validation of an output buffer. */ #define K_VALIDATE_BUFFER(buf, cb) \ do { \ if (!K_VALID_PTR(buf)) \ return KERR_INVALID_POINTER; \ if ((cb) != 0) \ { \ KU8 __b; \ KU8 volatile *__pb = (KU8 volatile *)(buf); \ KSIZE __cbPage1 = 0x1000 - ((KUPTR)(__pb) & 0xfff); /* ASSUMES page size! */ \ __b = *__pb; *__pb = 0xff; *__pb = __b; \ if ((cb) > __cbPage1) \ { \ KSIZE __cb = (cb) - __cbPage1; \ __pb -= __cbPage1; \ for (;;) \ { \ __b = *__pb; *__pb = 0xff; *__pb = __b; \ if (__cb < 0x1000) \ break; \ __pb += 0x1000; \ __cb -= 0x1000; \ } \ } \ } \ else \ return KERR_INVALID_PARAMETER; \ } while (0) /** Return/Crash validation of an optional output buffer. */ #define K_VALIDATE_OPTIONAL_BUFFER(buf, cb) \ do { \ if ((buf) && (cb) != 0) \ K_VALIDATE_BUFFER(buf, cb); \ } while (0) /** Return validation of an enum argument. */ #define K_VALIDATE_ENUM(arg, enumname) \ do { \ if ((arg) <= enumname##_INVALID || (arg) >= enumname##_END) \ return KERR_INVALID_PARAMETER; \ } while (0) /** Return validation of a flags argument. */ #define K_VALIDATE_FLAGS(arg, AllowedMask) \ do { \ if ((arg) & ~(AllowedMask)) \ return KERR_INVALID_PARAMETER; \ } while (0) /** @} */ /** @def NULL * The nil pointer value. */ #ifndef NULL # ifdef __cplusplus # define NULL 0 # else # define NULL ((void *)0) # endif #endif /** @} */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/�������������������������������������������������������0000775�0001750�0001750�00000000000�14670377513�020752� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbRemoveBestFit.h�������������������������������������0000664�0001750�0001750�00000005606�14670377513�024307� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbRemoveBestFit.h 35 2009-11-08 19:39:03Z bird $ */ /** @file * kRbTmpl - Templated Red-Black Trees, Remove Best Fitting Node. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Finds the best fitting node in the tree for the given Key value and removes the node. * * @returns Pointer to the removed node. * @param pRoot Pointer to the Red-Back tree's root structure. * @param Key The Key of which is to be found a best fitting match for.. * @param fAbove K_TRUE: Returned node is have the closest key to Key from above. * K_FALSE: Returned node is have the closest key to Key from below. * * @remark This implementation uses GetBestFit and then Remove and might therefore * not be the most optimal kind of implementation, but it reduces the complexity * code size, and the likelyhood for bugs. */ KRB_DECL(KRBNODE *) KRB_FN(RemoveBestFit)(KRBROOT *pRoot, KRBKEY Key, KBOOL fAbove) { /* * If we find anything we'll have to remove the node and return it. * Now, if duplicate keys are allowed we'll remove a duplicate before * removing the in-tree node as this is way cheaper. */ KRBNODE *pNode = KRB_FN(GetBestFit)(pRoot, Key, fAbove); if (pNode != NULL) { #ifdef KRB_EQUAL_ALLOWED KRB_WRITE_LOCK(pRoot); /** @todo the locking isn't quite sane here. :-/ */ if (pNode->mpList != KRB_NULL) { KRBNODE *pRet = KRB_GET_POINTER(&pNode->mpList); KRB_SET_POINTER_NULL(&pNode->mpList, &pRet->mpList); KRB_CACHE_INVALIDATE_NODE(pRoot, pNode, pNode->mKey); KRB_WRITE_UNLOCK(pRoot); return pRet; } KRB_WRITE_UNLOCK(pRoot); #endif pNode = KRB_FN(Remove)(pRoot, pNode->mKey); } return pNode; } ��������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbAssert.h��������������������������������������������0000664�0001750�0001750�00000011074�14670377513�023026� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbAssert.h 38 2009-11-10 00:01:38Z bird $ */ /** @file * kRbTmpl - Templated Red-Black Trees, Assert Valid Tree. */ /* * Copyright (c) 2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Internal helper for KRB_FN(Assert) * * @returns The number of black nodes. -1 is return if the tree is invalid. * @param pRoot The root of the (sub-)tree to assert. */ K_DECL_INLINE(int) KRB_FN(AssertRecurse)(KRBNODE *pRoot) { int cLeft; int cRight; if (!pRoot) /* leafs are black. */ return 1; #ifdef KRB_EQUAL_ALLOWED /* equal nodes are equal :) */ if (pNode->mpList != KRB_NULL) { KRBROOT *pEqual; for (pEqual = KRB_GET_POINTER(&pNode->mpList); pEqual; pEqual = KRB_GET_POINTER_NULL(&pEqual->mpList)) kHlpAssertReturn(K_CMP_E(pEqual->mKey, pNode->mKey), -1); } #endif /* binary tree. */ kHlpAssertReturn(pRoot->mpLeft != KRB_NULL && KRB_CMP_G(KRB_GET_POINTER(&pRoot->mpLeft)->mpKey, pRoot->mKey), -1); kHlpAssertReturn(pRoot->mpRight != KRB_NULL && KRB_CMP_G(pRoot->mKey, KRB_GET_POINTER(&pRoot->mpRigth)->mpKey), -1); /* both children of red nodes are black. */ kHlpAssertReturn(!KRB_IS_RED(pRoot) || (!KRB_IS_RED(pRoot->mpLeft) && !KRB_IS_RED(pRoot->mpRight)), -1); /* all paths to leafs contains the same number of black nodes. */ cLeft = KRB_FN(AssertRecurse)(KRB_GET_POINTER_NULL(&pRoot->mpLeft)); cRight = KRB_FN(AssertRecurse)(KRB_GET_POINTER_NULL(&pRoot->mpRight)); kHlpAssertMsgReturn(cLeft == cRight || cLeft == -1 || cRight == -1, ("%d vs. %d\n", cLeft, cRight), -1); return cLeft + !KRB_IS_RED(pRoot); } /** * Asserts the validity of the Red-Black tree. * * This method is using recursion and may therefore consume quite a bit of stack * on a large tree. * * @returns K_TRUE if valid. * @returns K_FALSE if invalid, assertion raised on each violation. * @param pRoot Pointer to the Red-Back tree's root structure. */ KRB_DECL(KBOOL) KRB_FN(Assert)(KRBROOT *pRoot) { KBOOL fRc = K_TRUE; #ifdef KRB_CACHE_SIZE unsigned i; #endif KRBNODE *pNode; KRB_READ_LOCK(pRoot); if (pRoot->mpRoot == KRB_NULL) { KRB_READ_UNLOCK(pRoot); return 0; } #ifdef KRB_CACHE_SIZE /* * Validate the cache. */ for (i = 0; i < (KRB_CACHE_SIZE); i++) if (pRoot->maLookthru[i] != KRB_NULL) { KRBNODE pCache = KRB_GET_POINTER(&pRoot->maLookthru[i]); /** @todo ranges */ kHlpAssertMsgStmt(i == KRB_CACHE_HASH(pCache->Key), ("Invalid cache entry %u, hashed to %u\n", i, KRB_CACHE_HASH(pCache->Key)), fRc = K_FALSE); pNode = KRB_GET_POINTER(&pRoot->mpRoot); while (pNode) { if (KRB_CMP_E(pCache->mKey, pNode->mKey)) { kHlpAssertMsgStmt(pNode == pCache, ("Invalid cache entry %u=%p, found %p\n", i, pCache, pNode), fRc = K_FALSE); break; } if (KRB_CMP_G(pCache->mKey, pNode->mKey)) pNode = KRB_GET_POINTER_NULL(&pNode->mRight); else pNode = KRB_GET_POINTER_NULL(&pNode->mLeft); } kHlpAssertMsgStmt(pNode, ("Invalid cache entry %u/%p - not found\n", i, pCache), fRc = K_FALSE); } #endif /* * Recurse thru the tree. */ if (KRB_FN(AssertRecurse)(KRB_GET_POINTER(&pRoot->mpRoot)) == -1) fRc = K_FALSE; KRB_READ_UNLOCK(pRoot); return fRc; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbGetWithParent.h�������������������������������������0000664�0001750�0001750�00000004544�14670377513�024316� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbGetWithParent.h 35 2009-11-08 19:39:03Z bird $ */ /** @file * kRbTmpl - Templated Red-Black Trees, Get Node With Parent. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Gets a node from the tree and its parent node (if any). * The tree remains unchanged. * * @returns Pointer to the node holding the given key. * @param pRoot Pointer to the Red-Back tree's root structure. * @param ppParent Pointer to a variable which will hold the pointer to the partent node on * return. When no node is found, this will hold the last searched node. * @param Key Key value of the node which is to be found. */ KRB_DECL(KRBNODE *) KRB_FN(GetWithParent)(KRBROOT *pRoot, KRBNODE **ppParent, KRBKEY Key) { register KRBNODE *pNode; register KRBNODE *pParent; KRB_READ_LOCK(pRoot); pParent = NULL; pNode = KRB_GET_POINTER_NULL(&pRoot->mpRoot); while ( pNode != NULL && KRB_CMP_NE(pNode->mKey, Key)) { pParent = pNode; if (KRB_CMP_G(pNode->mKey, Key)) pNode = KRB_GET_POINTER_NULL(&pNode->mpLeft); else pNode = KRB_GET_POINTER_NULL(&pNode->mpRight); } KRB_READ_UNLOCK(pRoot); *ppParent = pParent; return pNode; } ������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbRemove2.h�������������������������������������������0000664�0001750�0001750�00000010606�14670377513�023104� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbRemove2.h 35 2009-11-08 19:39:03Z bird $ */ /** @file * kRbTmpl - Templated Red-Black Trees, Remove A Specific Node. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Removes the specified node from the tree. * * @returns Pointer to the removed node (NULL if not in the tree) * @param pRoot Pointer to the Red-Back tree's root structure. * @param Key The Key of which is to be found a best fitting match for.. * * @remark This implementation isn't the most efficient, but this short and * easier to manage. */ KRB_DECL(KRBNODE *) KRB_FN(Remove2)(KRBROOT *pRoot, KRBNODE *pNode) { #ifdef KRB_EQUAL_ALLOWED /* * Find the right node by key and see if it's what we want. */ KRBNODE *pParent; KRBNODE *pCurNode = KRB_FN(GetWithParent)(pRoot, pNode->mKey, &pParent); if (!pCurNode) return NULL; KRB_WRITE_LOCK(pRoot); /** @todo the locking here isn't 100% sane. The only way to archive that is by no calling worker functions. */ if (pCurNode != pNode) { /* * It's not the one we want, but it could be in the duplicate list. */ while (pCurNode->mpList != KRB_NULL) { KRBNODE *pNext = KRB_GET_POINTER(&pCurNode->mpList); if (pNext == pNode) { KRB_SET_POINTER_NULL(&pCurNode->mpList, KRB_GET_POINTER_NULL(&pNode->mpList)); pNode->mpList = KRB_NULL; KRB_CACHE_INVALIDATE_NODE(pRoot, pNode, pNode->mKey); KRB_WRITE_UNLOCK(pRoot); return pNode; } pCurNode = pNext; } KRB_WRITE_UNLOCK(pRoot); return NULL; } /* * Ok, it's the one we want alright. * * Simply remove it if it's the only one with they Key, * if there are duplicates we'll have to unlink it and * insert the first duplicate in our place. */ if (pNode->mpList == KRB_NULL) { KRB_WRITE_UNLOCK(pRoot); KRB_FN(Remove)(pRoot, pNode->mKey); } else { KRBNODE *pNewUs = KRB_GET_POINTER(&pNode->mpList); pNewUs->mHeight = pNode->mHeight; if (pNode->mpLeft != KRB_NULL) KRB_SET_POINTER(&pNewUs->mpLeft, KRB_GET_POINTER(&pNode->mpLeft)) else pNewUs->mpLeft = KRB_NULL; if (pNode->mpRight != KRB_NULL) KRB_SET_POINTER(&pNewUs->mpRight, KRB_GET_POINTER(&pNode->mpRight)) else pNewUs->mpRight = KRB_NULL; if (pParent) { if (KRB_GET_POINTER_NULL(&pParent->mpLeft) == pNode) KRB_SET_POINTER(&pParent->mpLeft, pNewUs); else KRB_SET_POINTER(&pParent->mpRight, pNewUs); } else KRB_SET_POINTER(&pRoot->mpRoot, pNewUs); KRB_CACHE_INVALIDATE_NODE(pRoot, pNode, pNode->mKey); KRB_WRITE_UNLOCK(pRoot); } return pNode; #else /* * Delete it, if we got the wrong one, reinsert it. * * This ASSUMS that the caller is NOT going to hand us a lot * of wrong nodes but just uses this API for his convenience. */ KRBNODE *pRemovedNode = KRB_FN(Remove)(pRoot, pNode->mKey); if (pRemovedNode == pNode) return pRemovedNode; KRB_FN(Insert)(pRoot, pRemovedNode); return NULL; #endif } ��������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbUndef.h���������������������������������������������0000664�0001750�0001750�00000004150�14670377513�022623� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbUndef.h 35 2009-11-08 19:39:03Z bird $ */ /** @file * kRbTmpl - Undefines All Macros (both config and temp). */ /* * Copyright (c) 2006-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /* * The configuration. */ #undef KRB_EQUAL_ALLOWED #undef KRB_CHECK_FOR_EQUAL_INSERT #undef KRB_MAX_STACK #undef KRB_RANGE #undef KRB_OFFSET #undef KRB_STD_KEY_COMP #undef KRB_CACHE_SIZE #undef KRB_CACHE_HASH #undef KRB_LOCKED #undef KRB_WRITE_LOCK #undef KRB_WRITE_UNLOCK #undef KRB_READ_LOCK #undef KRB_READ_UNLOCK #undef KRBKEY #undef KRBNODE #undef KRBTREEPTR #undef KRBROOT #undef KRB_FN #undef KRB_TYPE #undef KRB_INT #undef KRB_DECL #undef mKey #undef mKeyLast #undef mfIsRed #undef mpLeft #undef mpRight #undef mpList #undef mpRoot #undef maLookthru #undef KRB_CMP_G #undef KRB_CMP_E #undef KRB_CMP_NE #undef KRB_R_IS_IDENTICAL #undef KRB_R_IS_INTERSECTING #undef KRB_R_IS_IN_RANGE /* * Internal ones. */ #undef KRB_IS_RED #undef KRB_NULL #undef KRB_GET_POINTER #undef KRB_GET_POINTER_NULL #undef KRB_SET_POINTER #undef KRB_SET_POINTER_NULL ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbDestroy.h�������������������������������������������0000664�0001750�0001750�00000010312�14670377513�023210� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbDestroy.h 35 2009-11-08 19:39:03Z bird $ */ /** @file * kRbTmpl - Templated Red-Black Trees, Destroy the tree. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Destroys the specified tree, starting with the root node and working our way down. * * @returns 0 on success. * @returns Return value from callback on failure. On failure, the tree will be in * an unbalanced condition and only further calls to the Destroy should be * made on it. Note that the node we fail on will be considered dead and * no action is taken to link it back into the tree. * @param pRoot Pointer to the Red-Back tree's root structure. * @param pfnCallBack Pointer to callback function. * @param pvUser User parameter passed on to the callback function. */ KRB_DECL(int) KRB_FN(Destroy)(KRBROOT *pRoot, KRB_TYPE(PFN,CALLBACK) pfnCallBack, void *pvUser) { #ifdef KRB_CACHE_SIZE unsigned i; #endif unsigned cEntries; KRBNODE *apEntries[KRB_MAX_STACK]; int rc; KRB_WRITE_LOCK(pRoot); if (pRoot->mpRoot == KRB_NULL) { KRB_WRITE_UNLOCK(pRoot); return 0; } #ifdef KRB_CACHE_SIZE /* * Kill the lookthru cache. */ for (i = 0; i < (KRB_CACHE_SIZE); i++) pRoot->maLookthru[i] = KRB_NULL; #endif cEntries = 1; apEntries[0] = KRB_GET_POINTER(&pRoot->mpRoot); while (cEntries > 0) { /* * Process the subtrees first. */ KRBNODE *pNode = apEntries[cEntries - 1]; if (pNode->mpLeft != KRB_NULL) apEntries[cEntries++] = KRB_GET_POINTER(&pNode->mpLeft); else if (pNode->mpRight != KRB_NULL) apEntries[cEntries++] = KRB_GET_POINTER(&pNode->mpRight); else { #ifdef KRB_EQUAL_ALLOWED /* * Process nodes with the same key. */ while (pNode->pList != KRB_NULL) { KRBNODE *pEqual = KRB_GET_POINTER(&pNode->pList); KRB_SET_POINTER(&pNode->pList, KRB_GET_POINTER_NULL(&pEqual->pList)); pEqual->pList = KRB_NULL; rc = pfnCallBack(pEqual, pvUser); if (rc) { KRB_WRITE_UNLOCK(pRoot); return rc; } } #endif /* * Unlink the node. */ if (--cEntries > 0) { KRBNODE *pParent = apEntries[cEntries - 1]; if (KRB_GET_POINTER(&pParent->mpLeft) == pNode) pParent->mpLeft = KRB_NULL; else pParent->mpRight = KRB_NULL; } else pRoot->mpRoot = KRB_NULL; kHlpAssert(pNode->mpLeft == KRB_NULL); kHlpAssert(pNode->mpRight == KRB_NULL); rc = pfnCallBack(pNode, pvUser); if (rc) { KRB_WRITE_UNLOCK(pRoot); return rc; } } } /* while */ kHlpAssert(pRoot->mpRoot == KRB_NULL); KRB_WRITE_UNLOCK(pRoot); return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbGetBestFit.h����������������������������������������0000664�0001750�0001750�00000007402�14670377513�023565� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbGetBestFit.h 35 2009-11-08 19:39:03Z bird $ */ /** @file * kRbTmpl - Templated Red-Black Trees, Get Best Fitting Node. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Finds the best fitting node in the tree for the given Key value. * * @returns Pointer to the best fitting node found. * @param pRoot Pointer to the Red-Back tree's root structure. * @param Key The Key of which is to be found a best fitting match for.. * @param fAbove K_TRUE: Returned node is have the closest key to Key from above. * K_FALSE: Returned node is have the closest key to Key from below. * @sketch The best fitting node is always located in the searchpath above you. * >= (above): The node where you last turned left. * <= (below): the node where you last turned right. */ KRB_DECL(KRBNODE *) KRB_FN(GetBestFit)(KRBROOT *pRoot, KRBKEY Key, KBOOL fAbove) { register KRBNODE *pNode; KRBNODE *pNodeLast; KRB_READ_LOCK(pLook); if (pRoot->mpRoot == KRB_NULL) { KRB_READ_UNLOCK(pLook); return NULL; } pNode = KRB_GET_POINTER(&pRoot->mpRoot); pNodeLast = NULL; if (fAbove) { /* pNode->mKey >= Key */ while (KRB_CMP_NE(pNode->mKey, Key)) { if (KRB_CMP_G(pNode->mKey, Key)) { if (pNode->mpLeft == KRB_NULL) { KRB_READ_UNLOCK(pLook); return pNode; } pNodeLast = pNode; pNode = KRB_GET_POINTER(&pNode->mpLeft); } else { if (pNode->mpRight == KRB_NULL) { KRB_READ_UNLOCK(pLook); return pNodeLast; } pNode = KRB_GET_POINTER(&pNode->mpRight); } } } else { /* pNode->mKey <= Key */ while (KRB_CMP_NE(pNode->mKey, Key)) { if (KRB_CMP_G(pNode->mKey, Key)) { if (pNode->mpLeft == KRB_NULL) { KRB_READ_UNLOCK(pLook); return pNodeLast; } pNode = KRB_GET_POINTER(&pNode->mpLeft); } else { if (pNode->mpRight == KRB_NULL) { KRB_READ_UNLOCK(pLook); return pNode; } pNodeLast = pNode; pNode = KRB_GET_POINTER(&pNode->mpRight); } } } /* perfect match or nothing. */ KRB_READ_UNLOCK(pLook); return pNode; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbEnum.h����������������������������������������������0000664�0001750�0001750�00000014573�14670377513�022500� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbEnum.h 35 2009-11-08 19:39:03Z bird $ */ /** @file * kRbTmpl - Templated Red-Black Trees, Node Enumeration. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Enumeration control data. * * This is initialized by BeginEnum and used by GetNext to figure out what * to do next. */ typedef struct KRB_TYPE(,ENUMDATA) { KBOOL fFromLeft; KI8 cEntries; KU8 achFlags[KRB_MAX_STACK]; KRBNODE * aEntries[KRB_MAX_STACK]; } KRB_TYPE(,ENUMDATA), *KRB_TYPE(P,ENUMDATA); /** * Ends an enumeration. * * The purpose of this function is to unlock the tree should the Red-Black tree * implementation include locking. It's good practice to call it anyway even if * the tree doesn't do any locking. * * @param pEnumData Pointer to enumeration control data. */ KRB_DECL(void) KRB_FN(EndEnum)(KRB_TYPE(,ENUMDATA) *pEnumData) { KRBROOT pRoot = pEnumData->pRoot; pEnumData->pRoot = NULL; if (pRoot) KRB_READ_UNLOCK(pEnumData->pRoot); } /** * Get the next node in the tree enumeration. * * The current implementation of this function willl not walk the mpList * chain like the DoWithAll function does. This may be changed later. * * @returns Pointer to the next node in the tree. * NULL is returned when the end of the tree has been reached, * it is not necessary to call EndEnum in this case. * @param pEnumData Pointer to enumeration control data. */ KRB_DECL(KRBNODE *) KRB_FN(GetNext)(KRB_TYPE(,ENUMDATA) *pEnumData) { if (pEnumData->fFromLeft) { /* from left */ while (pEnumData->cEntries > 0) { KRBNODE *pNode = pEnumData->aEntries[pEnumData->cEntries - 1]; /* left */ if (pEnumData->achFlags[pEnumData->cEntries - 1] == 0) { pEnumData->achFlags[pEnumData->cEntries - 1]++; if (pNode->mpLeft != KRB_NULL) { pEnumData->achFlags[pEnumData->cEntries] = 0; /* 0 left, 1 center, 2 right */ pEnumData->aEntries[pEnumData->cEntries++] = KRB_GET_POINTER(&pNode->mpLeft); continue; } } /* center */ if (pEnumData->achFlags[pEnumData->cEntries - 1] == 1) { pEnumData->achFlags[pEnumData->cEntries - 1]++; return pNode; } /* right */ pEnumData->cEntries--; if (pNode->mpRight != KRB_NULL) { pEnumData->achFlags[pEnumData->cEntries] = 0; pEnumData->aEntries[pEnumData->cEntries++] = KRB_GET_POINTER(&pNode->mpRight); } } /* while */ } else { /* from right */ while (pEnumData->cEntries > 0) { KRBNODE *pNode = pEnumData->aEntries[pEnumData->cEntries - 1]; /* right */ if (pEnumData->achFlags[pEnumData->cEntries - 1] == 0) { pEnumData->achFlags[pEnumData->cEntries - 1]++; if (pNode->mpRight != KRB_NULL) { pEnumData->achFlags[pEnumData->cEntries] = 0; /* 0 right, 1 center, 2 left */ pEnumData->aEntries[pEnumData->cEntries++] = KRB_GET_POINTER(&pNode->mpRight); continue; } } /* center */ if (pEnumData->achFlags[pEnumData->cEntries - 1] == 1) { pEnumData->achFlags[pEnumData->cEntries - 1]++; return pNode; } /* left */ pEnumData->cEntries--; if (pNode->mpLeft != KRB_NULL) { pEnumData->achFlags[pEnumData->cEntries] = 0; pEnumData->aEntries[pEnumData->cEntries++] = KRB_GET_POINTER(&pNode->mpLeft); } } /* while */ } /* * Call EndEnum. */ KRB_FN(EndEnum)(pEnumData); return NULL; } /** * Starts an enumeration of all nodes in the given tree. * * The current implementation of this function will not walk the mpList * chain like the DoWithAll function does. This may be changed later. * * @returns Pointer to the first node in the enumeration. * If NULL is returned the tree is empty calling EndEnum isn't * strictly necessary (although it will do no harm). * @param pRoot Pointer to the Red-Back tree's root structure. * @param pEnumData Pointer to enumeration control data. * @param fFromLeft K_TRUE: Left to right. * K_FALSE: Right to left. */ KRB_DECL(KRBNODE *) KRB_FN(BeginEnum)(KRBROOT *pRoot, KRB_TYPE(,ENUMDATA) *pEnumData, KBOOL fFromLeft) { KRB_READ_LOCK(pRoot); pEnumData->pRoot = pRoot; if (pRoot->mpRoot != KRB_NULL) { pEnumData->fFromLeft = fFromLeft; pEnumData->cEntries = 1; pEnumData->aEntries[0] = KRB_GET_POINTER(pRoot->mpRoot); pEnumData->achFlags[0] = 0; } else pEnumData->cEntries = 0; return KRB_FN(GetNext)(pEnumData); } �������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbBase.h����������������������������������������������0000664�0001750�0001750�00000046117�14670377513�022445� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbBase.h 38 2009-11-10 00:01:38Z bird $ */ /** @file * kRbTmpl - Templated Red-Black Trees, The Mandatory Base Code. */ /* * Copyright (c) 2001-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** @page pg_kAvlTmpl Template Configuration. * * This is a templated implementation of Red-Black trees in C. The template * parameters relates to the kind of key used and how duplicates are treated. * * \#define KRB_EQUAL_ALLOWED * Define this to tell us that equal keys are allowed. * Then Equal keys will be put in a list pointed to by KRBNODE::pList. * This is by default not defined. * * \#define KRB_CHECK_FOR_EQUAL_INSERT * Define this to enable insert check for equal nodes. * This is by default not defined. * * \#define KRB_MAX_STACK * Use this to specify the max number of stack entries the stack will use when * inserting and removing nodes from the tree. The size should be something like * log2(<max nodes>) + 3 * Must be defined. * * \#define KRB_RANGE * Define this to enable key ranges. * * \#define KRB_OFFSET * Define this to link the tree together using self relative offset * instead of memory pointers, thus making the entire tree relocatable * provided all the nodes - including the root node variable - are moved * the exact same distance. * * \#define KRB_CACHE_SIZE * Define this to employ a lookthru cache (direct) to speed up lookup for * some usage patterns. The value should be the number of members of the array. * * \#define KRB_CACHE_HASH(Key) * Define this to specify a more efficient translation of the key into * a lookthru array index. The default is key % size. * For some key types this is required as the default will not compile. * * \#define KRB_LOCKED * Define this if you wish for the tree to be locked via the * KRB_WRITE_LOCK, KRB_WRITE_UNLOCK, KRB_READ_LOCK and * KRB_READ_UNLOCK macros. If not defined the tree will not be subject * do any kind of locking and the problem of concurrency is left the user. * * \#define KRB_WRITE_LOCK(pRoot) * Lock the tree for writing. * * \#define KRB_WRITE_UNLOCK(pRoot) * Counteracts KRB_WRITE_LOCK. * * \#define KRB_READ_LOCK(pRoot) * Lock the tree for reading. * * \#define KRB_READ_UNLOCK(pRoot) * Counteracts KRB_READ_LOCK. * * \#define KRBKEY * Define this to the name of the AVL key type. * * \#define KRB_STD_KEY_COMP * Define this to use the standard key compare macros. If not set all the * compare operations for KRBKEY have to be defined: KRB_CMP_G, KRB_CMP_E, KRB_CMP_NE, * KRB_R_IS_IDENTICAL, KRB_R_IS_INTERSECTING and KRB_R_IS_IN_RANGE. The * latter three are only required when KRB_RANGE is defined. * * \#define KRBNODE * Define this to the name (typedef) of the AVL node structure. This * structure must have a mpLeft, mpRight, mKey and mHeight member. * If KRB_RANGE is defined a mKeyLast is also required. * If KRB_EQUAL_ALLOWED is defined a mpList member is required. * It's possible to use other member names by redefining the names. * * \#define KRBTREEPTR * Define this to the name (typedef) of the tree pointer type. This is * required when KRB_OFFSET is defined. When not defined it defaults * to KRBNODE *. * * \#define KRBROOT * Define this to the name (typedef) of the AVL root structure. This * is optional. However, if specified it must at least have a mpRoot * member of KRBTREEPTR type. If KRB_CACHE_SIZE is non-zero a * maLookthru[KRB_CACHE_SIZE] member of the KRBTREEPTR type is also * required. * * \#define KRB_FN * Use this to alter the names of the AVL functions. * Must be defined. * * \#define KRB_TYPE(prefix, name) * Use this to make external type names and unique. The prefix may be empty. * Must be defined. * * \#define KRB_INT(name) * Use this to make internal type names and unique. The prefix may be empty. * Must be defined. * * \#define KRB_DECL(rettype) * Function declaration macro that should be set according to the scope * the instantiated template should have. For instance an inlined scope * (private or public) should K_DECL_INLINE(rettype) here. * * This version of the kAVL tree offers the option of inlining the entire * implementation. This depends on the compiler doing a decent job in both * making use of the inlined code and to eliminate const variables. */ /******************************************************************************* * Internal Functions * *******************************************************************************/ #include <k/kDefs.h> #include <k/kTypes.h> #include <k/kHlpAssert.h> /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def KRB_GET_POINTER * Reads a 'pointer' value. * * @returns The native pointer. * @param pp Pointer to the pointer to read. * @internal */ /** @def KRB_GET_POINTER_NULL * Reads a 'pointer' value which can be KRB_NULL. * * @returns The native pointer. * @returns NULL pointer if KRB_NULL. * @param pp Pointer to the pointer to read. * @internal */ /** @def KRB_SET_POINTER * Writes a 'pointer' value. * For offset-based schemes offset relative to pp is calculated and assigned to *pp. * * @returns stored pointer. * @param pp Pointer to where to store the pointer. * @param p Native pointer to assign to *pp. * @internal */ /** @def KRB_SET_POINTER_NULL * Writes a 'pointer' value which can be KRB_NULL. * * For offset-based schemes offset relative to pp is calculated and assigned to *pp, * if p is not KRB_NULL of course. * * @returns stored pointer. * @param pp Pointer to where to store the pointer. * @param pp2 Pointer to where to pointer to assign to pp. This can be KRB_NULL * @internal */ #ifndef KRBTREEPTR # define KRBTREEPTR KRBNODE * #endif #ifndef KRBROOT # define KRBROOT KRB_TYPE(,ROOT) # define KRB_NEED_KRBROOT #endif #ifdef KRB_CACHE_SIZE # ifndef KRB_CACHE_HASH # define KRB_CACHE_HASH(Key) ( (Key) % (KRB_CACHE_SIZE) ) # endif #elif defined(KRB_CACHE_HASH) # error "KRB_CACHE_HASH without KRB_CACHE_SIZE!" #endif #ifdef KRB_CACHE_SIZE # define KRB_CACHE_INVALIDATE_NODE(pRoot, pNode, Key) \ do { \ KRBTREEPTR **ppEntry = &pRoot->maLookthru[KRB_CACHE_HASH(Key)]; \ if ((pNode) == KRB_GET_POINTER_NULL(ppEntry)) \ *ppEntry = KRB_NULL; \ } while (0) #else # define KRB_CACHE_INVALIDATE_NODE(pRoot, pNode, Key) do { } while (0) #endif #ifndef KRB_LOCKED # define KRB_WRITE_LOCK(pRoot) do { } while (0) # define KRB_WRITE_UNLOCK(pRoot) do { } while (0) # define KRB_READ_LOCK(pRoot) do { } while (0) # define KRB_READ_UNLOCK(pRoot) do { } while (0) #endif #ifdef KRB_OFFSET # define KRB_GET_POINTER(pp) ( (KRBNODE *)((KIPTR)(pp) + *(pp)) ) # define KRB_GET_POINTER_NULL(pp) ( *(pp) != KRB_NULL ? KRB_GET_POINTER(pp) : NULL ) # define KRB_SET_POINTER(pp, p) ( (*(pp)) = ((KIPTR)(p) - (KIPTR)(pp)) ) # define KRB_SET_POINTER_NULL(pp, pp2) ( (*(pp)) = *(pp2) != KRB_NULL ? (KIPTR)KRB_GET_POINTER(pp2) - (KIPTR)(pp) : KRB_NULL ) #else # define KRB_GET_POINTER(pp) ( *(pp) ) # define KRB_GET_POINTER_NULL(pp) ( *(pp) ) # define KRB_SET_POINTER(pp, p) ( (*(pp)) = (p) ) # define KRB_SET_POINTER_NULL(pp, pp2) ( (*(pp)) = *(pp2) ) #endif /** @def KRB_NULL * The NULL 'pointer' equivalent. */ #ifdef KRB_OFFSET # define KRB_NULL 0 #else # define KRB_NULL NULL #endif #ifdef KRB_STD_KEY_COMP # define KRB_CMP_G(key1, key2) ( (key1) > (key2) ) # define KRB_CMP_E(key1, key2) ( (key1) == (key2) ) # define KRB_CMP_NE(key1, key2) ( (key1) != (key2) ) # ifdef KRB_RANGE # define KRB_R_IS_IDENTICAL(key1B, key2B, key1E, key2E) ( (key1B) == (key2B) && (key1E) == (key2E) ) # define KRB_R_IS_INTERSECTING(key1B, key2B, key1E, key2E) ( (key1B) <= (key2E) && (key1E) >= (key2B) ) # define KRB_R_IS_IN_RANGE(key1B, key1E, key2) KRB_R_IS_INTERSECTING(key1B, key2, key1E, key2) # endif #endif #ifndef KRB_RANGE # define KRB_R_IS_INTERSECTING(key1B, key2B, key1E, key2E) KRB_CMP_E(key1B, key2B) # define KRB_R_IS_IDENTICAL(key1B, key2B, key1E, key2E) KRB_CMP_E(key1B, key2B) #endif /** Is the node red or black? * @returns true / false * @param pNode Pointer to the node in question. * @remarks All NULL pointers are considered black leaf nodes. */ #define KRB_IS_RED(pNode) ( (pNode) != NULL && (pNode)->mfIsRed ) /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Stack used to avoid recursive calls during insert and removal. */ typedef struct { unsigned cEntries; KRBTREEPTR *aEntries[KRB_MAX_STACK]; } KRB_INT(STACK); /** * The callback used by the Destroy and DoWithAll functions. */ typedef int (* KRB_TYPE(PFN,CALLBACK))(KRBNODE *, void *); #ifdef KRB_NEED_KRBROOT /** * The Red-Black tree root structure. */ typedef struct { KRBTREEPTR mpRoot; # ifdef KRB_CACHE_SIZE KRBTREEPTR maLookthru[KRB_CACHE_SIZE]; # endif } KRBROOT; #endif /** * Initializes the root of the Red-Black tree. * * @param pTree Pointer to the root structure. */ KRB_DECL(void) KRB_FN(Init)(KRBROOT *pRoot) { #ifdef KRB_CACHE_SIZE unsigned i; #endif pRoot->mpRoot = KRB_NULL; #ifdef KRB_CACHE_SIZE for (i = 0; i < (KRB_CACHE_SIZE); i++) pRoot->maLookthru[i] = KRB_NULL; #endif } /** * Rotates the tree to the left (shift direction) and recolors the nodes. * * @pre * * 2 4 * / \ / \ * 1 4 ==> 2 5 * / \ / \ * 3 5 1 3 * * @endpre * * @returns The new root node. * @param pRoot The root node. * * @remarks This will not update any pointer <tt>to</tt> the root node! */ K_DECL_INLINE(KRBNODE *) KAVL_FN(RotateLeft)(KRBNODE *pRoot) { KRBNODE *pNewRoot = pRoot->mRight; pRoot->mRight = pNewRoot->mLeft; pNewRoot->mLeft = pRoot; pRoot->mfIsRed = 1; pNewRoot->mfIsRed = 0; return pNewRoot; } /** * Rotates the tree to the right (shift direction) and recolors the nodes. * * @pre * * 4 2 * / \ / \ * 2 5 ==> 1 4 * / \ / \ * 1 3 3 5 * * @endpre * * @returns The new root node. * @param pRoot The root node. * * @remarks This will not update any pointer <tt>to</tt> the root node! */ K_DECL_INLINE(KRBNODE *) KAVL_FN(RotateRight)(KRBNODE *pRoot) { KRBNODE *pNewRoot = pRoot->mLeft; pRoot->mLeft = pNewRoot->mRight; pNewRoot->mRight = pRoot; pRoot->mfIsRed = 1; pNewRoot->mfIsRed = 0; return pNewRoot; } /** * Performs a double left rotation with recoloring. * * @pre * * 2 2 4 * / \ / \ / \ * 1 6 ==> 1 4 ==> 2 6 * / \ / \ / \ / \ * 4 7 3 6 1 3 5 7 * / \ / \ * 3 5 5 7 * @endpre * * @returns The new root node. * @param pRoot The root node. * * @remarks This will not update any pointer <tt>to</tt> the root node! */ K_DECL_INLINE(KRBNODE *) KAVL_FN(DoubleRotateLeft)(KRBNODE *pRoot) { pRoot->mRight = KAVL_FN(RotateRight)(pRoot->mRight); return KAVL_FN(RotateLeft)(pRoot); } /** * Performs a double right rotation with recoloring. * * @pre * 6 6 4 * / \ / \ / \ * 2 7 4 7 2 6 * / \ ==> / \ ==> / \ / \ * 1 4 2 5 1 3 5 7 * / \ / \ * 3 5 1 3 * * @endpre * * @returns The new root node. * @param pRoot The root node. * * @remarks This will not update any pointer <tt>to</tt> the root node! */ K_DECL_INLINE(KRBNODE *) KAVL_FN(DoubleRotateRight)(KRBNODE *pRoot) { pRoot->mLeft = KAVL_FN(RotateLeft)(pRoot->mLeft); return KAVL_FN(RotateRight)(pRoot); } /** * Inserts a node into the Red-Black tree. * @returns K_TRUE if inserted. * K_FALSE if node exists in tree. * @param pRoot Pointer to the Red-Back tree's root structure. * @param pNode Pointer to the node which is to be added. */ KRB_DECL(KBOOL) KRB_FN(Insert)(KRBROOT *pRoot, KRBNODE *pNode) { KRBTREEPTR *ppCurNode = &pRoot->mpRoot; register KRBKEY Key = pNode->mKey; #ifdef KRB_RANGE register KRBKEY KeyLast = pNode->mKeyLast; #endif #ifdef KRB_RANGE if (Key > KeyLast) return K_FALSE; #endif KRB_WRITE_LOCK(pRoot); Stack.cEntries = 0; while (*ppCurNode != KRB_NULL) { register KRBNODE *pCurNode = KRB_GET_POINTER(ppCurNode); kHlpAssert(Stack.cEntries < KRB_MAX_STACK); Stack.aEntries[Stack.cEntries++] = ppCurNode; #ifdef KRB_EQUAL_ALLOWED if (KRB_R_IS_IDENTICAL(pCurNode->mKey, Key, pCurNode->mKeyLast, KeyLast)) { /* * If equal then we'll use a list of equal nodes. */ pNode->mpLeft = pNode->mpRight = KRB_NULL; pNode->mHeight = 0; KRB_SET_POINTER_NULL(&pNode->mpList, &pCurNode->mpList); KRB_SET_POINTER(&pCurNode->mpList, pNode); KRB_WRITE_UNLOCK(pRoot); return K_TRUE; } #endif #ifdef KRB_CHECK_FOR_EQUAL_INSERT if (KRB_R_IS_INTERSECTING(pCurNode->mKey, Key, pCurNode->mKeyLast, KeyLast)) { KRB_WRITE_UNLOCK(pRoot); return K_FALSE; } #endif if (KRB_CMP_G(pCurNode->mKey, Key)) ppCurNode = &pCurNode->mpLeft; else ppCurNode = &pCurNode->mpRight; } pNode->mpLeft = pNode->mpRight = KRB_NULL; #ifdef KRB_EQUAL_ALLOWED pNode->mpList = KRB_NULL; #endif pNode->mHeight = 1; KRB_SET_POINTER(ppCurNode, pNode); KRB_FN(Rebalance)(&Stack); KRB_WRITE_UNLOCK(pRoot); return K_TRUE; } /** * Removes a node from the Red-Black tree. * @returns Pointer to the node. * @param pRoot Pointer to the Red-Back tree's root structure. * @param Key Key value of the node which is to be removed. * @sketch Find the node which is to be removed: * LOOP until not found * BEGIN * Add node pointer pointer to the AVL-stack. * IF the keys matches THEN break! * IF remove key < node key THEN * left * ELSE * right * END * IF found THEN * BEGIN * IF left node not empty THEN * BEGIN * Find the right most node in the left tree while adding the pointer to the pointer to it's parent to the stack: * Start at left node. * LOOP until right node is empty * BEGIN * Add to stack. * go right. * END * Link out the found node. * Replace the node which is to be removed with the found node. * Correct the stack entry for the pointer to the left tree. * END * ELSE * BEGIN * Move up right node. * Remove last stack entry. * END * Balance tree using stack. * END * return pointer to the removed node (if found). */ KRB_DECL(KRBNODE *) KRB_FN(Remove)(KRBROOT *pRoot, KRBKEY Key) { KRB_INT(STACK) Stack; KRBTREEPTR *ppDeleteNode = &pRoot->mpRoot; register KRBNODE *pDeleteNode; KRB_WRITE_LOCK(pRoot); Stack.cEntries = 0; for (;;) { if (*ppDeleteNode == KRB_NULL) { KRB_WRITE_UNLOCK(pRoot); return NULL; } pDeleteNode = KRB_GET_POINTER(ppDeleteNode); kHlpAssert(Stack.cEntries < KRB_MAX_STACK); Stack.aEntries[Stack.cEntries++] = ppDeleteNode; if (KRB_CMP_E(pDeleteNode->mKey, Key)) break; if (KRB_CMP_G(pDeleteNode->mKey, Key)) ppDeleteNode = &pDeleteNode->mpLeft; else ppDeleteNode = &pDeleteNode->mpRight; } if (pDeleteNode->mpLeft != KRB_NULL) { /* find the rightmost node in the left tree. */ const unsigned iStackEntry = Stack.cEntries; KRBTREEPTR *ppLeftLeast = &pDeleteNode->mpLeft; register KRBNODE *pLeftLeast = KRB_GET_POINTER(ppLeftLeast); while (pLeftLeast->mpRight != KRB_NULL) { kHlpAssert(Stack.cEntries < KRB_MAX_STACK); Stack.aEntries[Stack.cEntries++] = ppLeftLeast; ppLeftLeast = &pLeftLeast->mpRight; pLeftLeast = KRB_GET_POINTER(ppLeftLeast); } /* link out pLeftLeast */ KRB_SET_POINTER_NULL(ppLeftLeast, &pLeftLeast->mpLeft); /* link it in place of the delete node. */ KRB_SET_POINTER_NULL(&pLeftLeast->mpLeft, &pDeleteNode->mpLeft); KRB_SET_POINTER_NULL(&pLeftLeast->mpRight, &pDeleteNode->mpRight); pLeftLeast->mHeight = pDeleteNode->mHeight; KRB_SET_POINTER(ppDeleteNode, pLeftLeast); Stack.aEntries[iStackEntry] = &pLeftLeast->mpLeft; } else { KRB_SET_POINTER_NULL(ppDeleteNode, &pDeleteNode->mpRight); Stack.cEntries--; } KRB_FN(Rebalance)(&Stack); KRB_CACHE_INVALIDATE_NODE(pRoot, pDeleteNode, Key); KRB_WRITE_UNLOCK(pRoot); return pDeleteNode; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbGet.h�����������������������������������������������0000664�0001750�0001750�00000005340�14670377513�022303� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbGet.h 35 2009-11-08 19:39:03Z bird $ */ /** @file * kRbTmpl - Templated Red-Black Trees, Get a Node. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Gets a node from the tree (does not remove it!) * * @returns Pointer to the node holding the given key. * @param pRoot Pointer to the Red-Back tree's root structure. * @param Key Key value of the node which is to be found. */ KRB_DECL(KRBNODE *) KRB_FN(Get)(KRBROOT *pRoot, KRBKEY Key) { KRBNODE *pNode; #ifdef KRB_CACHE_SIZE KRBTREEPTR *ppEntry; #endif KRB_READ_LOCK(pRoot); if (pRoot->mpRoot == KRB_NULL) { KRB_READ_UNLOCK(pRoot); return NULL; } #ifdef KRB_CACHE_SIZE ppEntry = &pRoot->maLookthru[KRB_CACHE_HASH(Key)]; pNode = KRB_GET_POINTER_NULL(ppEntry); if (!pNode || KRB_CMP_NE(pNode->mKey, Key)) #endif { pNode = KRB_GET_POINTER(&pRoot->mpRoot); while (KRB_CMP_NE(pNode->mKey, Key)) { if (KRB_CMP_G(pNode->mKey, Key)) { if (pNode->mpLeft == KRB_NULL) { KRB_READ_UNLOCK(pRoot); return NULL; } pNode = KRB_GET_POINTER(&pNode->mpLeft); } else { if (pNode->mpRight == KRB_NULL) { KRB_READ_UNLOCK(pRoot); return NULL; } pNode = KRB_GET_POINTER(&pNode->mpRight); } } #ifdef KRB_CACHE_SIZE KRB_SET_POINTER(ppEntry, pNode); #endif } KRB_READ_UNLOCK(pRoot); return pNode; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbTmpl/kRbDoWithAll.h�����������������������������������������0000664�0001750�0001750�00000012632�14670377513�023415� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbDoWithAll.h 35 2009-11-08 19:39:03Z bird $ */ /** @file * kRbTmpl - Templated Red-Black Trees, The Callback Iterator. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Stack used by DoWithAll to avoid recusive function calls. */ typedef struct { unsigned cEntries; KRBNODE *aEntries[KRB_MAX_STACK]; char achFlags[KRB_MAX_STACK]; KRBROOT pRoot; } KRB_INT(STACK2); /** * Iterates thru all nodes in the given tree. * * @returns 0 on success. Return from callback on failure. * @param pRoot Pointer to the Red-Back tree's root structure. * @param fFromLeft K_TRUE: Left to right. * K_FALSE: Right to left. * @param pfnCallBack Pointer to callback function. * @param pvUser User parameter passed on to the callback function. */ KRB_DECL(int) KRB_FN(DoWithAll)(KRBROOT *pRoot, KBOOL fFromLeft, KRB_TYPE(PFN,CALLBACK) pfnCallBack, void *pvUser) { KRB_INT(STACK2) Stack; KRBNODE *pNode; #ifdef KRB_EQUAL_ALLOWED KRBNODE *pEqual; #endif int rc; KRB_READ_LOCK(pRoot); if (pRoot->mpRoot == KRB_NULL) { KRB_READ_UNLOCK(pRoot); return 0; } Stack.cEntries = 1; Stack.achFlags[0] = 0; Stack.aEntries[0] = KRB_GET_POINTER(&pRoot->mpRoot); if (fFromLeft) { /* from left */ while (Stack.cEntries > 0) { pNode = Stack.aEntries[Stack.cEntries - 1]; /* left */ if (!Stack.achFlags[Stack.cEntries - 1]++) { if (pNode->mpLeft != KRB_NULL) { Stack.achFlags[Stack.cEntries] = 0; /* 0 first, 1 last */ Stack.aEntries[Stack.cEntries++] = KRB_GET_POINTER(&pNode->mpLeft); continue; } } /* center */ rc = pfnCallBack(pNode, pvUser); if (rc) return rc; #ifdef KRB_EQUAL_ALLOWED if (pNode->mpList != KRB_NULL) for (pEqual = KRB_GET_POINTER(&pNode->mpList); pEqual; pEqual = KRB_GET_POINTER_NULL(&pEqual->mpList)) { rc = pfnCallBack(pEqual, pvUser); if (rc) { KRB_READ_UNLOCK(pRoot); return rc; } } #endif /* right */ Stack.cEntries--; if (pNode->mpRight != KRB_NULL) { Stack.achFlags[Stack.cEntries] = 0; Stack.aEntries[Stack.cEntries++] = KRB_GET_POINTER(&pNode->mpRight); } } /* while */ } else { /* from right */ while (Stack.cEntries > 0) { pNode = Stack.aEntries[Stack.cEntries - 1]; /* right */ if (!Stack.achFlags[Stack.cEntries - 1]++) { if (pNode->mpRight != KRB_NULL) { Stack.achFlags[Stack.cEntries] = 0; /* 0 first, 1 last */ Stack.aEntries[Stack.cEntries++] = KRB_GET_POINTER(&pNode->mpRight); continue; } } /* center */ rc = pfnCallBack(pNode, pvUser); if (rc) return rc; #ifdef KRB_EQUAL_ALLOWED if (pNode->mpList != KRB_NULL) for (pEqual = KRB_GET_POINTER(&pNode->mpList); pEqual; pEqual = KRB_GET_POINTER_NULL(&pEqual->pList)) { rc = pfnCallBack(pEqual, pvUser); if (rc) { KRB_READ_UNLOCK(pRoot); return rc; } } #endif /* left */ Stack.cEntries--; if (pNode->mpLeft != KRB_NULL) { Stack.achFlags[Stack.cEntries] = 0; Stack.aEntries[Stack.cEntries++] = KRB_GET_POINTER(&pNode->mpLeft); } } /* while */ } KRB_READ_UNLOCK(pRoot); return 0; } ������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kHlpEnv.h������������������������������������������������������0000664�0001750�0001750�00000003241�14670377513�021117� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpEnv.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpEnv - Environment Manipulation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpEnv_h___ #define ___k_kHlpEnv_h___ #include <k/kHlpDefs.h> #include <k/kTypes.h> /** @defgroup grp_kHlpEnv kHlpEnv - Environment Manipulation * @addtogroup grp_kHlp * @{*/ #ifdef __cplusplus extern "C" { #endif KHLP_DECL(int) kHlpGetEnv(const char *pszVar, char *pszVal, KSIZE cchVal); KHLP_DECL(int) kHlpGetEnvUZ(const char *pszVar, KSIZE *pcb); #ifdef __cplusplus } #endif /** @} */ #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRbU32.h�������������������������������������������������������0000664�0001750�0001750�00000004430�14670377513�020561� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRbU32.h 35 2009-11-08 19:39:03Z bird $ */ /** @file * kRb - Red-Black Tree Implementation, KU32 keys. */ /* * Copyright (c) 2006-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kRbU32_h___ #define ___k_kRbU32_h___ typedef struct KRBU32 { KU32 mKey; KBOOL mfRed; struct KRBU32 *mpLeft; struct KRBU32 *mpRight; } KRBU32; typedef KRBU32 *PRBU32; typedef KRBU32 **PPRBU32; /*#define KRB_EQUAL_ALLOWED*/ #define KRB_CHECK_FOR_EQUAL_INSERT /*#define KRB_RANGE */ /*#define KRB_OFFSET */ #define KRB_MAX_STACK 48 #define KRB_STD_KEY_COMP #define KRBKEY KU32 #define KRBNODE KRBU32 #define KRB_FN(name) kRbU32 ## name #define KRB_TYPE(prefix,name) prefix ## KRBU32 ## name #define KRB_INT(name) KRBU32INT ## name #define KRB_DECL(rettype) K_DECL_INLINE(rettype) #include <k/kRbTmpl/kRbBase.h> #include <k/kRbTmpl/kRbDoWithAll.h> #include <k/kRbTmpl/kRbEnum.h> #include <k/kRbTmpl/kRbGet.h> #include <k/kRbTmpl/kRbGetBestFit.h> #include <k/kRbTmpl/kRbGetWithParent.h> #include <k/kRbTmpl/kRbRemove2.h> #include <k/kRbTmpl/kRbRemoveBestFit.h> #include <k/kRbTmpl/kRbUndef.h> #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kErrors.h������������������������������������������������������0000664�0001750�0001750�00000040645�14670377513�021210� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kErrors.h 58 2013-10-12 20:18:21Z bird $ */ /** @file * kErrors - Status Codes. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kErrors_h___ #define ___k_kErrors_h___ /** @defgroup grp_kErrors Status Codes. * @{ */ /** The base of the kErrors status codes. */ #define KERR_BASE 42000 /** @name General * @{ */ /** The base of the general status codes. */ #define KERR_GENERAL_BASE (KERR_BASE) /** Generic error. */ #define KERR_GENERAL_FAILURE (KERR_GENERAL_BASE + 1) /** Out of memory. */ #define KERR_NO_MEMORY (KERR_GENERAL_BASE + 2) /** Hit some unimplemented functionality - feel free to implement it :-) . */ #define KERR_NOT_IMPLEMENTED (KERR_GENERAL_BASE + 3) /** An environment variable wasn't found. */ #define KERR_ENVVAR_NOT_FOUND (KERR_GENERAL_BASE + 4) /** Buffer overflow. */ #define KERR_BUFFER_OVERFLOW (KERR_GENERAL_BASE + 5) /** @}*/ /** @name Input Validation * @{ */ /** The base of the input validation status codes. */ #define KERR_INPUT_BASE (KERR_GENERAL_BASE + 6) /** An API was given an invalid parameter. */ #define KERR_INVALID_PARAMETER (KERR_INPUT_BASE + 0) /** A pointer argument is not valid. */ #define KERR_INVALID_POINTER (KERR_INPUT_BASE + 1) /** A handle argument is not valid. */ #define KERR_INVALID_HANDLE (KERR_INPUT_BASE + 2) /** An offset argument is not valid. */ #define KERR_INVALID_OFFSET (KERR_INPUT_BASE + 3) /** A size argument is not valid. */ #define KERR_INVALID_SIZE (KERR_INPUT_BASE + 4) /** A range argument is not valid. */ #define KERR_INVALID_RANGE (KERR_INPUT_BASE + 5) /** A parameter is out of range. */ #define KERR_OUT_OF_RANGE (KERR_INPUT_BASE + 6) /** @} */ /** @name File System and I/O * @{ */ /** The base of the file system and I/O status cdoes. */ #define KERR_FILE_SYSTEM_AND_IO_BASE (KERR_INPUT_BASE + 7) /** The specified file was not found. */ #define KERR_FILE_NOT_FOUND (KERR_FILE_SYSTEM_AND_IO_BASE + 0) /** End of file. */ #define KERR_EOF (KERR_FILE_SYSTEM_AND_IO_BASE + 1) /** @} */ /** @name kDbg Specific * @{ */ /** The base of the kDbg specific status codes. */ #define KDBG_ERR_BASE (KERR_FILE_SYSTEM_AND_IO_BASE + 2) /** The (module) format isn't known to use. */ #define KDBG_ERR_UNKOWN_FORMAT (KDBG_ERR_BASE + 0) /** The (module) format isn't supported by this kDbg build. */ #define KDBG_ERR_FORMAT_NOT_SUPPORTED (KDBG_ERR_BASE + 1) /** The (module) format isn't supported by this kDbg build. */ #define KDBG_ERR_BAD_EXE_FORMAT (KDBG_ERR_BASE + 2) /** A specified address or an address found in the debug info is invalid. */ #define KDBG_ERR_INVALID_ADDRESS (KDBG_ERR_BASE + 3) /** The dbghelp.dll is too old or something like that. */ #define KDBG_ERR_DBGHLP_VERSION_MISMATCH (KDBG_ERR_BASE + 4) /** @} */ /** @name kRdr Specific * @{ */ /** the base of the kRdr specific status codes. */ #define KRDR_ERR_BASE (KDBG_ERR_BASE + 5) /** The file reader can't take more concurrent mappings. */ #define KRDR_ERR_TOO_MANY_MAPPINGS (KRDR_ERR_BASE + 0) /** The pRdr instance passed to a kRdrBuf* API isn't a buffered instance. */ #define KRDR_ERR_NOT_BUFFERED_RDR (KRDR_ERR_BASE + 1) /** The line is too long to fit in the buffer passed to kRdrBufLine or kRdrBufLineEx. */ #define KRDR_ERR_LINE_TOO_LONG (KRDR_ERR_BASE + 2) /** @} */ /** @name kLdr Specific * @{ */ /** The base of the kLdr specific status codes. */ #define KLDR_ERR_BASE (KRDR_ERR_BASE + 3) /** The image format is unknown. */ #define KLDR_ERR_UNKNOWN_FORMAT (KLDR_ERR_BASE + 0) /** The MZ image format isn't supported by this kLdr build. */ #define KLDR_ERR_MZ_NOT_SUPPORTED (KLDR_ERR_BASE + 1) /** The NE image format isn't supported by this kLdr build. */ #define KLDR_ERR_NE_NOT_SUPPORTED (KLDR_ERR_BASE + 2) /** The LX image format isn't supported by this kLdr build. */ #define KLDR_ERR_LX_NOT_SUPPORTED (KLDR_ERR_BASE + 3) /** The LE image format isn't supported by this kLdr build. */ #define KLDR_ERR_LE_NOT_SUPPORTED (KLDR_ERR_BASE + 4) /** The PE image format isn't supported by this kLdr build. */ #define KLDR_ERR_PE_NOT_SUPPORTED (KLDR_ERR_BASE + 5) /** The ELF image format isn't supported by this kLdr build. */ #define KLDR_ERR_ELF_NOT_SUPPORTED (KLDR_ERR_BASE + 6) /** The mach-o image format isn't supported by this kLdr build. */ #define KLDR_ERR_MACHO_NOT_SUPPORTED (KLDR_ERR_BASE + 7) /** The FAT image format isn't supported by this kLdr build or * a direct open was attempt without going thru the FAT file provider. * FAT images are also known as Universal Binaries. */ #define KLDR_ERR_FAT_NOT_SUPPORTED (KLDR_ERR_BASE + 8) /** The a.out image format isn't supported by this kLdr build. */ #define KLDR_ERR_AOUT_NOT_SUPPORTED (KLDR_ERR_BASE + 9) /** The module wasn't loaded dynamically. */ #define KLDR_ERR_NOT_LOADED_DYNAMICALLY (KLDR_ERR_BASE + 10) /** The module wasn't found. */ #define KLDR_ERR_MODULE_NOT_FOUND (KLDR_ERR_BASE + 11) /** A prerequisit module wasn't found. */ #define KLDR_ERR_PREREQUISITE_MODULE_NOT_FOUND (KLDR_ERR_BASE + 12) /** The module is being terminated and can therefore not be loaded. */ #define KLDR_ERR_MODULE_TERMINATING (KLDR_ERR_BASE + 13) /** A prerequisit module is being terminated and can therefore not be loaded. */ #define KLDR_ERR_PREREQUISITE_MODULE_TERMINATING (KLDR_ERR_BASE + 14) /** The module initialization failed. */ #define KLDR_ERR_MODULE_INIT_FAILED (KLDR_ERR_BASE + 15) /** The initialization of a prerequisite module failed. */ #define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED (KLDR_ERR_BASE + 16) /** The module has already failed initialization and can't be attempted reloaded until * after we've finished garbage collection. */ #define KLDR_ERR_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 17) /** A prerequisite module has already failed initialization and can't be attempted * reloaded until after we've finished garbage collection. */ #define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 18) /** Prerequisite recursed too deeply. */ #define KLDR_ERR_PREREQUISITE_RECURSED_TOO_DEEPLY (KLDR_ERR_BASE + 19) /** Failed to allocate the main stack. */ #define KLDR_ERR_MAIN_STACK_ALLOC_FAILED (KLDR_ERR_BASE + 20) /** Symbol not found. */ #define KLDR_ERR_SYMBOL_NOT_FOUND (KLDR_ERR_BASE + 21) /** A forward symbol was encountered but the caller didn't provide any means to resolve it. */ #define KLDR_ERR_FORWARDER_SYMBOL (KLDR_ERR_BASE + 22) /** Encountered a bad fixup. */ #define KLDR_ERR_BAD_FIXUP (KLDR_ERR_BASE + 23) /** The import ordinal was out of bounds. */ #define KLDR_ERR_IMPORT_ORDINAL_OUT_OF_BOUNDS (KLDR_ERR_BASE + 24) /** A forwarder chain was too long. */ #define KLDR_ERR_TOO_LONG_FORWARDER_CHAIN (KLDR_ERR_BASE + 25) /** The module has no debug info. */ #define KLDR_ERR_NO_DEBUG_INFO (KLDR_ERR_BASE + 26) /** The module is already mapped. * kLdrModMap() can only be called once (without kLdrModUnmap() in between). */ #define KLDR_ERR_ALREADY_MAPPED (KLDR_ERR_BASE + 27) /** The module was not mapped. * kLdrModUnmap() should not called without being preceeded by a kLdrModMap(). */ #define KLDR_ERR_NOT_MAPPED (KLDR_ERR_BASE + 28) /** Couldn't fit the address value into the field. Typically a relocation kind of error. */ #define KLDR_ERR_ADDRESS_OVERFLOW (KLDR_ERR_BASE + 29) /** Couldn't fit a calculated size value into the native size type of the host. */ #define KLDR_ERR_SIZE_OVERFLOW (KLDR_ERR_BASE + 30) /** Thread attach failed. */ #define KLDR_ERR_THREAD_ATTACH_FAILED (KLDR_ERR_BASE + 31) /** The module wasn't a DLL or object file. */ #define KLDR_ERR_NOT_DLL (KLDR_ERR_BASE + 32) /** The module wasn't an EXE. */ #define KLDR_ERR_NOT_EXE (KLDR_ERR_BASE + 33) /** Not implemented yet. */ #define KLDR_ERR_TODO (KLDR_ERR_BASE + 34) /** No image matching the requested CPU. */ #define KLDR_ERR_CPU_ARCH_MISMATCH (KLDR_ERR_BASE + 35) /** Invalid FAT image header. */ #define KLDR_ERR_FAT_INVALID (KLDR_ERR_BASE + 36) /** Unsupported CPU subtype found in a FAT entry. */ #define KLDR_ERR_FAT_UNSUPPORTED_CPU_SUBTYPE (KLDR_ERR_BASE + 37) /** The image has no UUID. */ #define KLDR_ERR_NO_IMAGE_UUID (KLDR_ERR_BASE + 38) /** Duplicate segment name. */ #define KLDR_ERR_DUPLICATE_SEGMENT_NAME (KLDR_ERR_BASE + 39) /** @} */ /** @name kLdrModPE Specific * @{ */ /** The base of the kLdrModPE specific status codes. */ #define KLDR_ERR_PE_BASE (KLDR_ERR_BASE + 40) /** The machine isn't supported by the interpreter. */ #define KLDR_ERR_PE_UNSUPPORTED_MACHINE (KLDR_ERR_PE_BASE + 0) /** The file handler isn't valid. */ #define KLDR_ERR_PE_BAD_FILE_HEADER (KLDR_ERR_PE_BASE + 1) /** The the optional headers isn't valid. */ #define KLDR_ERR_PE_BAD_OPTIONAL_HEADER (KLDR_ERR_PE_BASE + 2) /** One of the section headers aren't valid. */ #define KLDR_ERR_PE_BAD_SECTION_HEADER (KLDR_ERR_PE_BASE + 3) /** Bad forwarder entry. */ #define KLDR_ERR_PE_BAD_FORWARDER (KLDR_ERR_PE_BASE + 4) /** Forwarder module not found in the import descriptor table. */ #define KLDR_ERR_PE_FORWARDER_IMPORT_NOT_FOUND (KLDR_ERR_PE_BASE + 5) /** Bad PE fixups. */ #define KLDR_ERR_PE_BAD_FIXUP (KLDR_ERR_PE_BASE + 6) /** Bad PE import (thunk). */ #define KLDR_ERR_PE_BAD_IMPORT (KLDR_ERR_PE_BASE + 7) /** @} */ /** @name kLdrModLX Specific * @{ */ /** The base of the kLdrModLX specific status codes. */ #define KLDR_ERR_LX_BASE (KLDR_ERR_PE_BASE + 8) /** validation of LX header failed. */ #define KLDR_ERR_LX_BAD_HEADER (KLDR_ERR_LX_BASE + 0) /** validation of the loader section (in the LX header) failed. */ #define KLDR_ERR_LX_BAD_LOADER_SECTION (KLDR_ERR_LX_BASE + 1) /** validation of the fixup section (in the LX header) failed. */ #define KLDR_ERR_LX_BAD_FIXUP_SECTION (KLDR_ERR_LX_BASE + 2) /** validation of the LX object table failed. */ #define KLDR_ERR_LX_BAD_OBJECT_TABLE (KLDR_ERR_LX_BASE + 3) /** A bad page map entry was encountered. */ #define KLDR_ERR_LX_BAD_PAGE_MAP (KLDR_ERR_LX_BASE + 4) /** Bad iterdata (EXEPACK) data. */ #define KLDR_ERR_LX_BAD_ITERDATA (KLDR_ERR_LX_BASE + 5) /** Bad iterdata2 (EXEPACK2) data. */ #define KLDR_ERR_LX_BAD_ITERDATA2 (KLDR_ERR_LX_BASE + 6) /** Bad bundle data. */ #define KLDR_ERR_LX_BAD_BUNDLE (KLDR_ERR_LX_BASE + 7) /** No soname. */ #define KLDR_ERR_LX_NO_SONAME (KLDR_ERR_LX_BASE + 8) /** Bad soname. */ #define KLDR_ERR_LX_BAD_SONAME (KLDR_ERR_LX_BASE + 9) /** Bad forwarder entry. */ #define KLDR_ERR_LX_BAD_FORWARDER (KLDR_ERR_LX_BASE + 10) /** internal fixup chain isn't implemented yet. */ #define KLDR_ERR_LX_NRICHAIN_NOT_SUPPORTED (KLDR_ERR_LX_BASE + 11) /** @} */ /** @name kLdrModMachO Specific * @{ */ /** The base of the kLdrModMachO specific status codes. */ #define KLDR_ERR_MACHO_BASE (KLDR_ERR_LX_BASE + 12) /** Only native endian Mach-O files are supported. */ #define KLDR_ERR_MACHO_OTHER_ENDIAN_NOT_SUPPORTED (KLDR_ERR_MACHO_BASE + 0) /** The Mach-O header is bad or contains new and unsupported features. */ #define KLDR_ERR_MACHO_BAD_HEADER (KLDR_ERR_MACHO_BASE + 1) /** The file type isn't supported. */ #define KLDR_ERR_MACHO_UNSUPPORTED_FILE_TYPE (KLDR_ERR_MACHO_BASE + 2) /** The machine (cputype / cpusubtype combination) isn't supported. */ #define KLDR_ERR_MACHO_UNSUPPORTED_MACHINE (KLDR_ERR_MACHO_BASE + 3) /** Bad load command(s). */ #define KLDR_ERR_MACHO_BAD_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 4) /** Encountered an unknown load command.*/ #define KLDR_ERR_MACHO_UNKNOWN_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 5) /** Encountered a load command that's not implemented.*/ #define KLDR_ERR_MACHO_UNSUPPORTED_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 6) /** Bad section. */ #define KLDR_ERR_MACHO_BAD_SECTION (KLDR_ERR_MACHO_BASE + 7) /** Encountered a section type that's not implemented.*/ #define KLDR_ERR_MACHO_UNSUPPORTED_SECTION (KLDR_ERR_MACHO_BASE + 8) /** Encountered a init function section. */ #define KLDR_ERR_MACHO_UNSUPPORTED_INIT_SECTION (KLDR_ERR_MACHO_BASE + 9) /** Encountered a term function section. */ #define KLDR_ERR_MACHO_UNSUPPORTED_TERM_SECTION (KLDR_ERR_MACHO_BASE + 10) /** Encountered a section type that's not known to the loader. (probably invalid) */ #define KLDR_ERR_MACHO_UNKNOWN_SECTION (KLDR_ERR_MACHO_BASE + 11) /** The sections aren't ordered by segment as expected by the loader. */ #define KLDR_ERR_MACHO_BAD_SECTION_ORDER (KLDR_ERR_MACHO_BASE + 12) /** The image is 32-bit and contains 64-bit load commands or vise versa. */ #define KLDR_ERR_MACHO_BIT_MIX (KLDR_ERR_MACHO_BASE + 13) /** Bad MH_OBJECT file. */ #define KLDR_ERR_MACHO_BAD_OBJECT_FILE (KLDR_ERR_MACHO_BASE + 14) /** Bad symbol table entry. */ #define KLDR_ERR_MACHO_BAD_SYMBOL (KLDR_ERR_MACHO_BASE + 15) /** Unsupported fixup type. */ #define KLDR_ERR_MACHO_UNSUPPORTED_FIXUP_TYPE (KLDR_ERR_MACHO_BASE + 16) /** Both debug and non-debug sections in segment. */ #define KLDR_ERR_MACHO_MIXED_DEBUG_SECTION_FLAGS (KLDR_ERR_MACHO_BASE + 17) /** The segment bits are non-contiguous in the file. */ #define KLDR_ERR_MACHO_NON_CONT_SEG_BITS (KLDR_ERR_MACHO_BASE + 18) /** @} */ /** @name kCpu Specific * @{ */ /** The base of the kCpu specific status codes. */ #define KCPU_ERR_BASE (KLDR_ERR_MACHO_BASE + 19) /** The specified ARCH+CPU pairs aren't compatible. */ #define KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE (KCPU_ERR_BASE + 0) /** @} */ /** End of the valid status codes. */ #define KERR_END (KCPU_ERR_BASE + 1) /** @}*/ #endif �������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlU32.h������������������������������������������������������0000664�0001750�0001750�00000004426�14670377513�020745� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlU32.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvl - AVL Tree Implementation, KU32 keys. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kAvlU32_h___ #define ___k_kAvlU32_h___ typedef struct KAVLU32 { KU32 mKey; KU8 mHeight; struct KAVLU32 *mpLeft; struct KAVLU32 *mpRight; } KAVLU32, *PKAVLU32, **PPKAVLU32; /*#define KAVL_EQUAL_ALLOWED*/ #define KAVL_CHECK_FOR_EQUAL_INSERT #define KAVL_MAX_STACK 32 /*#define KAVL_RANGE */ /*#define KAVL_OFFSET */ #define KAVL_STD_KEY_COMP #define KAVLKEY KU32 #define KAVLNODE KAVLU32 #define KAVL_FN(name) kAvlU32 ## name #define KAVL_TYPE(prefix,name) prefix ## KAVLU32 ## name #define KAVL_INT(name) KAVLU32INT ## name #define KAVL_DECL(rettype) K_DECL_INLINE(rettype) #include <k/kAvlTmpl/kAvlBase.h> #include <k/kAvlTmpl/kAvlDoWithAll.h> #include <k/kAvlTmpl/kAvlEnum.h> #include <k/kAvlTmpl/kAvlGet.h> #include <k/kAvlTmpl/kAvlGetBestFit.h> #include <k/kAvlTmpl/kAvlGetWithParent.h> #include <k/kAvlTmpl/kAvlRemove2.h> #include <k/kAvlTmpl/kAvlRemoveBestFit.h> #include <k/kAvlTmpl/kAvlUndef.h> #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kMagics.h������������������������������������������������������0000664�0001750�0001750�00000003110�14670377513�021121� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kMagics.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kMagics - Various Magic Constants. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kMagics_h___ #define ___k_kMagics_h___ /** The magic for KRDR::u32Magic. (Katsu Aki (Katsuaki Nakamura)) * @ingroup grp_kRdrAll */ #define KRDR_MAGIC 0x19610919 /** The magic value for the debug module structure. (Some manga artist) * @ingroup grp_kDbgAll */ #define KDBGMOD_MAGIC 0x19200501 #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kCpu.h���������������������������������������������������������0000664�0001750�0001750�00000004020�14670377513�020446� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kCpu.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kCpu - The CPU and Architecture API. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kCpu_h___ #define ___k_kCpu_h___ #include <k/kDefs.h> #include <k/kTypes.h> #include <k/kCpus.h> /** @defgroup grp_kCpu kCpu - The CPU And Architecture API * @{ */ /** @def KCPU_DECL * Declares a kCpu function according to build context. * @param type The return type. */ #if defined(KCPU_BUILDING_DYNAMIC) # define KCPU_DECL(type) K_DECL_EXPORT(type) #elif defined(KCPU_BUILT_DYNAMIC) # define KCPU_DECL(type) K_DECL_IMPORT(type) #else # define KCPU_DECL(type) type #endif #ifdef __cplusplus extern "C" { #endif KCPU_DECL(void) kCpuGetArchAndCpu(PKCPUARCH penmArch, PKCPU penmCpu); KCPU_DECL(int) kCpuCompare(KCPUARCH enmCodeArch, KCPU enmCodeCpu, KCPUARCH enmArch, KCPU enmCpu); #ifdef __cplusplus } #endif /** @} */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kHlpPath.h�����������������������������������������������������0000664�0001750�0001750�00000003375�14670377513�021273� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpPath.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpPath - Path Manipulation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpPath_h___ #define ___k_kHlpPath_h___ #include <k/kHlpDefs.h> #include <k/kTypes.h> /** @defgroup grp_kHlpPath kHlpPath - Path Manipulation * @addtogroup grp_kHlp * @{*/ #ifdef __cplusplus extern "C" { #endif KHLP_DECL(char *) kHlpGetFilename(const char *pszFilename); KHLP_DECL(char *) kHlpGetSuff(const char *pszFilename); KHLP_DECL(char *) kHlpGetExt(const char *pszFilename); KHLP_DECL(int) kHlpIsFilenameOnly(const char *pszFilename); #ifdef __cplusplus } #endif /** @} */ #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kHlpAssert.h���������������������������������������������������0000664�0001750�0001750�00000031377�14670377513�021643� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpAssert.h 119 2021-12-19 13:01:47Z bird $ */ /** @file * kHlpAssert - Assertion Macros. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kHlpAssert_h___ #define ___kHlpAssert_h___ #include <k/kHlpDefs.h> #ifdef __cplusplus extern "C" { #endif /** @defgroup grp_kHlpAssert - Assertion Macros * @addtogroup grp_kHlp * @{ */ /** @def K_STRICT * Assertions are enabled when K_STRICT is \#defined. */ /** @def kHlpAssertBreakpoint * Emits a breakpoint instruction or somehow triggers a debugger breakpoint. */ #ifdef _MSC_VER # define kHlpAssertBreakpoint() do { __debugbreak(); } while (0) #elif defined(__GNUC__) && K_OS == K_OS_SOLARIS && (K_ARCH == K_ARCH_AMD64 || K_ARCH == K_ARCH_X86_32) # define kHlpAssertBreakpoint() do { __asm__ __volatile__ ("int $3"); } while (0) #elif defined(__GNUC__) && (K_ARCH == K_ARCH_AMD64 || K_ARCH == K_ARCH_X86_32 || K_ARCH == K_ARCH_X86_16) # define kHlpAssertBreakpoint() do { __asm__ __volatile__ ("int3"); } while (0) #elif defined(__GNUC__) && (K_ARCH == K_ARCH_ARM_64 || K_ARCH == K_ARCH_ARM_32) /* probably not supported by older ARM CPUs */ # define kHlpAssertBreakpoint() do { __asm__ __volatile__ ("brk #0x1"); } while (0) #elif defined(__GNUC__) && (K_ARCH == K_ARCH_SPARC_32) # define kHlpAssertBreakpoint() do { __asm__ __volatile__ ("unimp 0"); } while (0) /*??*/ #elif defined(__GNUC__) && (K_ARCH == K_ARCH_SPARC_64) # define kHlpAssertBreakpoint() do { __asm__ __volatile__ ("illtrap 0"); } while (0) /*??*/ #else # error "Port Me" #endif /** @def K_FUNCTION * Undecorated function name macro expanded by the compiler. */ #if defined(__GNUC__) # define K_FUNCTION __func__ #else # define K_FUNCTION __FUNCTION__ #endif #ifdef K_STRICT # define kHlpAssert(expr) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ } \ } while (0) # define kHlpAssertStmt(expr, stmt) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ stmt; \ } \ } while (0) # define kHlpAssertReturn(expr, rcRet) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ return (rcRet); \ } \ } while (0) # define kHlpAssertStmtReturn(expr, stmt, rcRet) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ stmt; \ return (rcRet); \ } \ } while (0) # define kHlpAssertReturnVoid(expr) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ return; \ } \ } while (0) # define kHlpAssertStmtReturnVoid(expr, stmt) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ stmt; \ return; \ } \ } while (0) # define kHlpAssertMsg(expr, msg) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ } \ } while (0) # define kHlpAssertMsgStmt(expr, msg, stmt) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ stmt; \ } \ } while (0) # define kHlpAssertMsgReturn(expr, msg, rcRet) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ return (rcRet); \ } \ } while (0) # define kHlpAssertMsgStmtReturn(expr, msg, stmt, rcRet) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ stmt; \ return (rcRet); \ } \ } while (0) # define kHlpAssertMsgReturnVoid(expr, msg) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ return; \ } \ } while (0) # define kHlpAssertMsgStmtReturnVoid(expr, msg, stmt) \ do { \ if (!(expr)) \ { \ kHlpAssertMsg1(#expr, __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ stmt; \ return; \ } \ } while (0) /* Same as above, only no expression. */ # define kHlpAssertFailed() \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ } while (0) # define kHlpAssertFailedStmt(stmt) \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ stmt; \ } while (0) # define kHlpAssertFailedReturn(rcRet) \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ return (rcRet); \ } while (0) # define kHlpAssertFailedStmtReturn(stmt, rcRet) \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ stmt; \ return (rcRet); \ } while (0) # define kHlpAssertFailedReturnVoid() \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ return; \ } while (0) # define kHlpAssertFailedStmtReturnVoid(stmt) \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertBreakpoint(); \ stmt; \ return; \ } while (0) # define kHlpAssertMsgFailed(msg) \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ } while (0) # define kHlpAssertMsgFailedStmt(msg, stmt) \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ stmt; \ } while (0) # define kHlpAssertMsgFailedReturn(msg, rcRet) \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ return (rcRet); \ } while (0) # define kHlpAssertMsgFailedStmtReturn(msg, stmt, rcRet) \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ stmt; \ return (rcRet); \ } while (0) # define kHlpAssertMsgFailedReturnVoid(msg) \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ return; \ } while (0) # define kHlpAssertMsgFailedStmtReturnVoid(msg, stmt) \ do { \ kHlpAssertMsg1("failed", __FILE__, __LINE__, K_FUNCTION); \ kHlpAssertMsg2 msg; \ kHlpAssertBreakpoint(); \ stmt; \ return; \ } while (0) #else /* !K_STRICT */ # define kHlpAssert(expr) do { } while (0) # define kHlpAssertStmt(expr, stmt) do { if (!(expr)) { stmt; } } while (0) # define kHlpAssertReturn(expr, rcRet) do { if (!(expr)) return (rcRet); } while (0) # define kHlpAssertStmtReturn(expr, stmt, rcRet) do { if (!(expr)) { stmt; return (rcRet); } } while (0) # define kHlpAssertReturnVoid(expr) do { if (!(expr)) return; } while (0) # define kHlpAssertStmtReturnVoid(expr, stmt) do { if (!(expr)) { stmt; return; } } while (0) # define kHlpAssertMsg(expr, msg) do { } while (0) # define kHlpAssertMsgStmt(expr, msg, stmt) do { if (!(expr)) { stmt; } } while (0) # define kHlpAssertMsgReturn(expr, msg, rcRet) do { if (!(expr)) return (rcRet); } while (0) # define kHlpAssertMsgStmtReturn(expr, msg, stmt, rcRet) do { if (!(expr)) { stmt; return (rcRet); } } while (0) # define kHlpAssertMsgReturnVoid(expr, msg) do { if (!(expr)) return; } while (0) # define kHlpAssertMsgStmtReturnVoid(expr, msg, stmt) do { if (!(expr)) { stmt; return; } } while (0) /* Same as above, only no expression: */ # define kHlpAssertFailed() do { } while (0) # define kHlpAssertFailedStmt(stmt) do { stmt; } while (0) # define kHlpAssertFailedReturn(rcRet) do { return (rcRet); } while (0) # define kHlpAssertFailedStmtReturn(stmt, rcRet) do { stmt; return (rcRet); } while (0) # define kHlpAssertFailedReturnVoid() do { return; } while (0) # define kHlpAssertFailedStmtReturnVoid(stmt) do { stmt; return; } while (0) # define kHlpAssertMsgFailed(msg) do { } while (0) # define kHlpAssertMsgFailedStmt(msg, stmt) do { stmt; } while (0) # define kHlpAssertMsgFailedReturn(msg, rcRet) do { return (rcRet); } while (0) # define kHlpAssertMsgFailedStmtReturn(msg, stmt, rcRet) do { { stmt; return (rcRet); } } while (0) # define kHlpAssertMsgFailedReturnVoid(msg) do { return; } while (0) # define kHlpAssertMsgFailedStmtReturnVoid(msg, stmt) do { stmt; return; } while (0) #endif /* !K_STRICT */ #define kHlpAssertPtr(ptr) kHlpAssertMsg(K_VALID_PTR(ptr), ("%s = %p\n", #ptr, (ptr))) #define kHlpAssertPtrReturn(ptr, rcRet) kHlpAssertMsgReturn(K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet)), (rcRet)) #define kHlpAssertPtrReturn(ptr, rcRet) kHlpAssertMsgReturn(K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet)), (rcRet)) #define kHlpAssertPtrReturnVoid(ptr) kHlpAssertMsgReturnVoid(K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet))) #define kHlpAssertPtrNull(ptr) kHlpAssertMsg(!(ptr) || K_VALID_PTR(ptr), ("%s = %p\n", #ptr, (ptr))) #define kHlpAssertPtrNullReturn(ptr, rcRet) kHlpAssertMsgReturn(!(ptr) || K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet)), (rcRet)) #define kHlpAssertPtrNullReturnVoid(ptr) kHlpAssertMsgReturnVoid(!(ptr) || K_VALID_PTR(ptr), ("%s = %p -> %d\n", #ptr, (ptr), (rcRet))) #define kHlpAssertRC(rc) kHlpAssertMsg((rc) == 0, ("%s = %d\n", #rc, (rc))) #define kHlpAssertRCReturn(rc, rcRet) kHlpAssertMsgReturn((rc) == 0, ("%s = %d -> %d\n", #rc, (rc), (rcRet)), (rcRet)) #define kHlpAssertRCReturnVoid(rc) kHlpAssertMsgReturnVoid((rc) == 0, ("%s = %d -> %d\n", #rc, (rc), (rcRet))) /** * Helper function that displays the first part of the assertion message. * * @param pszExpr The expression. * @param pszFile The file name. * @param iLine The line number is the file. * @param pszFunction The function name. * @internal */ KHLP_DECL(void) kHlpAssertMsg1(const char *pszExpr, const char *pszFile, unsigned iLine, const char *pszFunction); /** * Helper function that displays custom assert message. * * @param pszFormat Format string that get passed to vprintf. * @param ... Format arguments. * @internal */ KHLP_DECL(void) kHlpAssertMsg2(const char *pszFormat, ...); /** @} */ #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kHlp.h���������������������������������������������������������0000664�0001750�0001750�00000003172�14670377513�020451� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlp - Helpers, All Of Them. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlp_h___ #define ___k_kHlp_h___ #include <k/kDefs.h> #include <k/kTypes.h> #include <k/kErrors.h> #include <k/kHlpAlloc.h> #include <k/kHlpAssert.h> #include <k/kHlpEnv.h> #include <k/kHlpPath.h> #include <k/kHlpProcess.h> #include <k/kHlpSem.h> #include <k/kHlpString.h> #include <k/kHlpThread.h> /** @defgroup grp_kHlp kHlp - Helper Functions * @{ */ /** @} */ #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvloU32.h�����������������������������������������������������0000664�0001750�0001750�00000005035�14670377513�021121� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvloU32.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvl - AVL Tree Implementation, KU32 keys, Offset Based. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kAvloU32_h___ #define ___k_kAvloU32_h___ typedef KI32 KAVLOU32PTR; typedef struct KAVLOU32 { KU32 u32; KU8 cFloorsToGo; KAVLOU32PTR offLeft; KAVLOU32PTR offRight; } KAVLOU32, *PKAVLOU32, **PPKAVLOU32; #define mKey u32 #define mHeight cFloorsToGo #define mpLeft offLeft #define mpRight offRight /*#define KAVL_EQUAL_ALLOWED*/ #define KAVL_CHECK_FOR_EQUAL_INSERT #define KAVL_MAX_STACK 32 /*#define KAVL_RANGE */ #define KAVL_OFFSET #define KAVL_STD_KEY_COMP #define KAVLKEY KU32 #define KAVLTREEPTR KAVLOU32PTR #define KAVLNODE KAVLOU32 #define KAVL_FN(name) kAvloU32 ## name #define KAVL_TYPE(prefix,name) prefix ## KAVLOU32 ## name #define KAVL_INT(name) KAVLOU32INT ## name #define KAVL_DECL(rettype) K_DECL_INLINE(rettype) #include <k/kAvlTmpl/kAvlBase.h> #include <k/kAvlTmpl/kAvlDoWithAll.h> #include <k/kAvlTmpl/kAvlEnum.h> #include <k/kAvlTmpl/kAvlGet.h> #include <k/kAvlTmpl/kAvlGetBestFit.h> #include <k/kAvlTmpl/kAvlGetWithParent.h> #include <k/kAvlTmpl/kAvlRemove2.h> #include <k/kAvlTmpl/kAvlRemoveBestFit.h> #include <k/kAvlTmpl/kAvlUndef.h> #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kErr.h���������������������������������������������������������0000664�0001750�0001750�00000004016�14670377513�020454� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kErr.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kErr - Status Code API. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kErr_h___ #define ___k_kErr_h___ /** @defgroup grp_kErr kErr - Status Code API * @{ */ /** @def KERR_DECL * Declares a kRdr function according to build context. * @param type The return type. */ #if defined(KERR_BUILDING_DYNAMIC) # define KERR_DECL(type) K_DECL_EXPORT(type) #elif defined(KRDR_BUILT_DYNAMIC) # define KERR_DECL(type) K_DECL_IMPORT(type) #else # define KERR_DECL(type) type #endif #ifdef __cplusplus extern "C" { #endif KERR_DECL(const char *) kErrName(int rc); KERR_DECL(int) kErrFromErrno(int); KERR_DECL(int) kErrFromOS2(unsigned long rcOs2); KERR_DECL(int) kErrFromNtStatus(long rcNtStatus); KERR_DECL(int) kErrFromMach(int rcMach); KERR_DECL(int) kErrFromDarwin(int rcDarwin); #ifdef __cplusplus } #endif /** @} */ #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/������������������������������������������������������0000775�0001750�0001750�00000000000�14670377513�021131� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/kAvlUndef.h�������������������������������������������0000664�0001750�0001750�00000004210�14670377513�023156� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlUndef.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Undefines All Macros (both config and temp). */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /* * The configuration. */ #undef KAVL_EQUAL_ALLOWED #undef KAVL_CHECK_FOR_EQUAL_INSERT #undef KAVL_MAX_STACK #undef KAVL_RANGE #undef KAVL_OFFSET #undef KAVL_STD_KEY_COMP #undef KAVL_LOOKTHRU #undef KAVL_LOOKTHRU_HASH #undef KAVL_LOCKED #undef KAVL_WRITE_LOCK #undef KAVL_WRITE_UNLOCK #undef KAVL_READ_LOCK #undef KAVL_READ_UNLOCK #undef KAVLKEY #undef KAVLNODE #undef KAVLTREEPTR #undef KAVLROOT #undef KAVL_FN #undef KAVL_TYPE #undef KAVL_INT #undef KAVL_DECL #undef mKey #undef mKeyLast #undef mHeight #undef mpLeft #undef mpRight #undef mpList #undef mpRoot #undef maLookthru /* * The internal macros. */ #undef KAVL_HEIGHTOF #undef KAVL_GET_POINTER #undef KAVL_GET_POINTER_NULL #undef KAVL_SET_POINTER #undef KAVL_SET_POINTER_NULL #undef KAVL_NULL #undef KAVL_G #undef KAVL_E #undef KAVL_NE #undef KAVL_R_IS_IDENTICAL #undef KAVL_R_IS_INTERSECTING #undef KAVL_R_IS_IN_RANGE ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/kAvlGetWithParent.h�����������������������������������0000664�0001750�0001750�00000004540�14670377513�024650� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlGetWithParent.h 34 2009-11-08 19:38:40Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Get Node With Parent. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Gets a node from the tree and its parent node (if any). * The tree remains unchanged. * * @returns Pointer to the node holding the given key. * @param pRoot Pointer to the AVL-tree root structure. * @param ppParent Pointer to a variable which will hold the pointer to the partent node on * return. When no node is found, this will hold the last searched node. * @param Key Key value of the node which is to be found. */ KAVL_DECL(KAVLNODE *) KAVL_FN(GetWithParent)(KAVLROOT *pRoot, KAVLNODE **ppParent, KAVLKEY Key) { register KAVLNODE *pNode; register KAVLNODE *pParent; KAVL_READ_LOCK(pRoot); pParent = NULL; pNode = KAVL_GET_POINTER_NULL(&pRoot->mpRoot); while ( pNode != NULL && KAVL_NE(pNode->mKey, Key)) { pParent = pNode; if (KAVL_G(pNode->mKey, Key)) pNode = KAVL_GET_POINTER_NULL(&pNode->mpLeft); else pNode = KAVL_GET_POINTER_NULL(&pNode->mpRight); } KAVL_READ_UNLOCK(pRoot); *ppParent = pParent; return pNode; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/kAvlGetBestFit.h��������������������������������������0000664�0001750�0001750�00000007403�14670377513�024124� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlGetBestFit.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Get Best Fitting Node. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Finds the best fitting node in the tree for the given Key value. * * @returns Pointer to the best fitting node found. * @param pRoot Pointer to the AVL-tree root structure. * @param Key The Key of which is to be found a best fitting match for.. * @param fAbove K_TRUE: Returned node is have the closest key to Key from above. * K_FALSE: Returned node is have the closest key to Key from below. * @sketch The best fitting node is always located in the searchpath above you. * >= (above): The node where you last turned left. * <= (below): the node where you last turned right. */ KAVL_DECL(KAVLNODE *) KAVL_FN(GetBestFit)(KAVLROOT *pRoot, KAVLKEY Key, KBOOL fAbove) { register KAVLNODE *pNode; KAVLNODE *pNodeLast; KAVL_READ_LOCK(pLook); if (pRoot->mpRoot == KAVL_NULL) { KAVL_READ_UNLOCK(pLook); return NULL; } pNode = KAVL_GET_POINTER(&pRoot->mpRoot); pNodeLast = NULL; if (fAbove) { /* pNode->mKey >= Key */ while (KAVL_NE(pNode->mKey, Key)) { if (KAVL_G(pNode->mKey, Key)) { if (pNode->mpLeft == KAVL_NULL) { KAVL_READ_UNLOCK(pLook); return pNode; } pNodeLast = pNode; pNode = KAVL_GET_POINTER(&pNode->mpLeft); } else { if (pNode->mpRight == KAVL_NULL) { KAVL_READ_UNLOCK(pLook); return pNodeLast; } pNode = KAVL_GET_POINTER(&pNode->mpRight); } } } else { /* pNode->mKey <= Key */ while (KAVL_NE(pNode->mKey, Key)) { if (KAVL_G(pNode->mKey, Key)) { if (pNode->mpLeft == KAVL_NULL) { KAVL_READ_UNLOCK(pLook); return pNodeLast; } pNode = KAVL_GET_POINTER(&pNode->mpLeft); } else { if (pNode->mpRight == KAVL_NULL) { KAVL_READ_UNLOCK(pLook); return pNode; } pNodeLast = pNode; pNode = KAVL_GET_POINTER(&pNode->mpRight); } } } /* perfect match or nothing. */ KAVL_READ_UNLOCK(pLook); return pNode; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/kAvlGet.h���������������������������������������������0000664�0001750�0001750�00000005363�14670377513�022646� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlGet.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Get a Node. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Gets a node from the tree (does not remove it!) * * @returns Pointer to the node holding the given key. * @param pRoot Pointer to the AVL-tree root structure. * @param Key Key value of the node which is to be found. */ KAVL_DECL(KAVLNODE *) KAVL_FN(Get)(KAVLROOT *pRoot, KAVLKEY Key) { KAVLNODE *pNode; #ifdef KAVL_LOOKTHRU_CACHE KAVLTREEPTR *ppEntry; #endif KAVL_READ_LOCK(pRoot); if (pRoot->mpRoot == KAVL_NULL) { KAVL_READ_UNLOCK(pRoot); return NULL; } #ifdef KAVL_LOOKTHRU_CACHE ppEntry = &pRoot->maLookthru[KAVL_LOOKTHRU_HASH(Key)]; pNode = KAVL_GET_POINTER_NULL(ppEntry); if (!pNode || KAVL_NE(pNode->mKey, Key)) #endif { pNode = KAVL_GET_POINTER(&pRoot->mpRoot); while (KAVL_NE(pNode->mKey, Key)) { if (KAVL_G(pNode->mKey, Key)) { if (pNode->mpLeft == KAVL_NULL) { KAVL_READ_UNLOCK(pRoot); return NULL; } pNode = KAVL_GET_POINTER(&pNode->mpLeft); } else { if (pNode->mpRight == KAVL_NULL) { KAVL_READ_UNLOCK(pRoot); return NULL; } pNode = KAVL_GET_POINTER(&pNode->mpRight); } } #ifdef KAVL_LOOKTHRU_CACHE KAVL_SET_POINTER(ppEntry, pNode); #endif } KAVL_READ_UNLOCK(pRoot); return pNode; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/kAvlDoWithAll.h���������������������������������������0000664�0001750�0001750�00000013017�14670377513�023751� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlDoWithAll.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, The Callback Iterator. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Stack used by DoWithAll to avoid recusive function calls. */ typedef struct { unsigned cEntries; KAVLNODE *aEntries[KAVL_MAX_STACK]; char achFlags[KAVL_MAX_STACK]; KAVLROOT pRoot; } KAVL_INT(STACK2); /** * Iterates thru all nodes in the given tree. * * @returns 0 on success. Return from callback on failure. * @param pRoot Pointer to the AVL-tree root structure. * @param fFromLeft K_TRUE: Left to right. * K_FALSE: Right to left. * @param pfnCallBack Pointer to callback function. * @param pvUser User parameter passed on to the callback function. */ KAVL_DECL(int) KAVL_FN(DoWithAll)(KAVLROOT *pRoot, KBOOL fFromLeft, KAVL_TYPE(PFN,CALLBACK) pfnCallBack, void *pvUser) { KAVL_INT(STACK2) AVLStack; KAVLNODE *pNode; #ifdef KAVL_EQUAL_ALLOWED KAVLNODE *pEqual; #endif int rc; KAVL_READ_LOCK(pRoot); if (pRoot->mpRoot == KAVL_NULL) { KAVL_READ_UNLOCK(pRoot); return 0; } AVLStack.cEntries = 1; AVLStack.achFlags[0] = 0; AVLStack.aEntries[0] = KAVL_GET_POINTER(&pRoot->mpRoot); if (fFromLeft) { /* from left */ while (AVLStack.cEntries > 0) { pNode = AVLStack.aEntries[AVLStack.cEntries - 1]; /* left */ if (!AVLStack.achFlags[AVLStack.cEntries - 1]++) { if (pNode->mpLeft != KAVL_NULL) { AVLStack.achFlags[AVLStack.cEntries] = 0; /* 0 first, 1 last */ AVLStack.aEntries[AVLStack.cEntries++] = KAVL_GET_POINTER(&pNode->mpLeft); continue; } } /* center */ rc = pfnCallBack(pNode, pvUser); if (rc) return rc; #ifdef KAVL_EQUAL_ALLOWED if (pNode->mpList != KAVL_NULL) for (pEqual = KAVL_GET_POINTER(&pNode->mpList); pEqual; pEqual = KAVL_GET_POINTER_NULL(&pEqual->mpList)) { rc = pfnCallBack(pEqual, pvUser); if (rc) { KAVL_READ_UNLOCK(pRoot); return rc; } } #endif /* right */ AVLStack.cEntries--; if (pNode->mpRight != KAVL_NULL) { AVLStack.achFlags[AVLStack.cEntries] = 0; AVLStack.aEntries[AVLStack.cEntries++] = KAVL_GET_POINTER(&pNode->mpRight); } } /* while */ } else { /* from right */ while (AVLStack.cEntries > 0) { pNode = AVLStack.aEntries[AVLStack.cEntries - 1]; /* right */ if (!AVLStack.achFlags[AVLStack.cEntries - 1]++) { if (pNode->mpRight != KAVL_NULL) { AVLStack.achFlags[AVLStack.cEntries] = 0; /* 0 first, 1 last */ AVLStack.aEntries[AVLStack.cEntries++] = KAVL_GET_POINTER(&pNode->mpRight); continue; } } /* center */ rc = pfnCallBack(pNode, pvUser); if (rc) return rc; #ifdef KAVL_EQUAL_ALLOWED if (pNode->mpList != KAVL_NULL) for (pEqual = KAVL_GET_POINTER(&pNode->mpList); pEqual; pEqual = KAVL_GET_POINTER_NULL(&pEqual->pList)) { rc = pfnCallBack(pEqual, pvUser); if (rc) { KAVL_READ_UNLOCK(pRoot); return rc; } } #endif /* left */ AVLStack.cEntries--; if (pNode->mpLeft != KAVL_NULL) { AVLStack.achFlags[AVLStack.cEntries] = 0; AVLStack.aEntries[AVLStack.cEntries++] = KAVL_GET_POINTER(&pNode->mpLeft); } } /* while */ } KAVL_READ_UNLOCK(pRoot); return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/kAvlBase.h��������������������������������������������0000664�0001750�0001750�00000054406�14670377513�023003� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlBase.h 36 2009-11-09 22:49:02Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, The Mandatory Base Code. */ /* * Copyright (c) 2001-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** @page pg_kAvlTmpl Template Configuration. * * This is a templated implementation of AVL trees in C. The template * parameters relates to the kind of key used and how duplicates are * treated. * * \#define KAVL_EQUAL_ALLOWED * Define this to tell us that equal keys are allowed. * Then Equal keys will be put in a list pointed to by KAVLNODE::pList. * This is by default not defined. * * \#define KAVL_CHECK_FOR_EQUAL_INSERT * Define this to enable insert check for equal nodes. * This is by default not defined. * * \#define KAVL_MAX_STACK * Use this to specify the max number of stack entries the stack will use when * inserting and removing nodes from the tree. The size should be something like * log2(<max nodes>) + 3 * Must be defined. * * \#define KAVL_RANGE * Define this to enable key ranges. * * \#define KAVL_OFFSET * Define this to link the tree together using self relative offset * instead of memory pointers, thus making the entire tree relocatable * provided all the nodes - including the root node variable - are moved * the exact same distance. * * \#define KAVL_LOOKTHRU * Define this to employ a lookthru cache (direct) to speed up lookup for * some usage patterns. The value should be the number of members of the * array. * * \#define KAVL_LOOKTHRU_HASH(Key) * Define this to specify a more efficient translation of the key into * a lookthru array index. The default is key % size. * For some key types this is required as the default will not compile. * * \#define KAVL_LOCKED * Define this if you wish for the tree to be locked via the * KAVL_WRITE_LOCK, KAVL_WRITE_UNLOCK, KAVL_READ_LOCK and * KAVL_READ_UNLOCK macros. If not defined the tree will not be subject * do any kind of locking and the problem of concurrency is left the user. * * \#define KAVL_WRITE_LOCK(pRoot) * Lock the tree for writing. * * \#define KAVL_WRITE_UNLOCK(pRoot) * Counteracts KAVL_WRITE_LOCK. * * \#define KAVL_READ_LOCK(pRoot) * Lock the tree for reading. * * \#define KAVL_READ_UNLOCK(pRoot) * Counteracts KAVL_READ_LOCK. * * \#define KAVLKEY * Define this to the name of the AVL key type. * * \#define KAVL_STD_KEY_COMP * Define this to use the standard key compare macros. If not set all the * compare operations for KAVLKEY have to be defined: KAVL_G, KAVL_E, KAVL_NE, * KAVL_R_IS_IDENTICAL, KAVL_R_IS_INTERSECTING and KAVL_R_IS_IN_RANGE. The * latter three are only required when KAVL_RANGE is defined. * * \#define KAVLNODE * Define this to the name (typedef) of the AVL node structure. This * structure must have a mpLeft, mpRight, mKey and mHeight member. * If KAVL_RANGE is defined a mKeyLast is also required. * If KAVL_EQUAL_ALLOWED is defined a mpList member is required. * It's possible to use other member names by redefining the names. * * \#define KAVLTREEPTR * Define this to the name (typedef) of the tree pointer type. This is * required when KAVL_OFFSET is defined. When not defined it defaults * to KAVLNODE *. * * \#define KAVLROOT * Define this to the name (typedef) of the AVL root structure. This * is optional. However, if specified it must at least have a mpRoot * member of KAVLTREEPTR type. If KAVL_LOOKTHRU is non-zero a * maLookthru[KAVL_LOOKTHRU] member of the KAVLTREEPTR type is also * required. * * \#define KAVL_FN * Use this to alter the names of the AVL functions. * Must be defined. * * \#define KAVL_TYPE(prefix, name) * Use this to make external type names and unique. The prefix may be empty. * Must be defined. * * \#define KAVL_INT(name) * Use this to make internal type names and unique. The prefix may be empty. * Must be defined. * * \#define KAVL_DECL(rettype) * Function declaration macro that should be set according to the scope * the instantiated template should have. For instance an inlined scope * (private or public) should K_DECL_INLINE(rettype) here. * * This version of the kAVL tree offers the option of inlining the entire * implementation. This depends on the compiler doing a decent job in both * making use of the inlined code and to eliminate const variables. */ /******************************************************************************* * Internal Functions * *******************************************************************************/ #include <k/kDefs.h> #include <k/kTypes.h> #include <k/kHlpAssert.h> /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ #define KAVL_HEIGHTOF(pNode) ((KU8)((pNode) != NULL ? (pNode)->mHeight : 0)) /** @def KAVL_GET_POINTER * Reads a 'pointer' value. * * @returns The native pointer. * @param pp Pointer to the pointer to read. * @internal */ /** @def KAVL_GET_POINTER_NULL * Reads a 'pointer' value which can be KAVL_NULL. * * @returns The native pointer. * @returns NULL pointer if KAVL_NULL. * @param pp Pointer to the pointer to read. * @internal */ /** @def KAVL_SET_POINTER * Writes a 'pointer' value. * For offset-based schemes offset relative to pp is calculated and assigned to *pp. * * @returns stored pointer. * @param pp Pointer to where to store the pointer. * @param p Native pointer to assign to *pp. * @internal */ /** @def KAVL_SET_POINTER_NULL * Writes a 'pointer' value which can be KAVL_NULL. * * For offset-based schemes offset relative to pp is calculated and assigned to *pp, * if p is not KAVL_NULL of course. * * @returns stored pointer. * @param pp Pointer to where to store the pointer. * @param pp2 Pointer to where to pointer to assign to pp. This can be KAVL_NULL * @internal */ #ifndef KAVLTREEPTR # define KAVLTREEPTR KAVLNODE * #endif #ifndef KAVLROOT # define KAVLROOT KAVL_TYPE(,ROOT) # define KAVL_NEED_KAVLROOT #endif #ifdef KAVL_LOOKTHRU # ifndef KAVL_LOOKTHRU_HASH # define KAVL_LOOKTHRU_HASH(Key) ( (Key) % (KAVL_LOOKTHRU) ) # endif #elif defined(KAVL_LOOKTHRU_HASH) # error "KAVL_LOOKTHRU_HASH without KAVL_LOOKTHRU!" #endif #ifdef KAVL_LOOKTHRU # define KAVL_LOOKTHRU_INVALIDATE_NODE(pRoot, pNode, Key) \ do { \ KAVLTREEPTR **ppEntry = &pRoot->maLookthru[KAVL_LOOKTHRU_HASH(Key)]; \ if ((pNode) == KAVL_GET_POINTER_NULL(ppEntry)) \ *ppEntry = KAVL_NULL; \ } while (0) #else # define KAVL_LOOKTHRU_INVALIDATE_NODE(pRoot, pNode, Key) do { } while (0) #endif #ifndef KAVL_LOCKED # define KAVL_WRITE_LOCK(pRoot) do { } while (0) # define KAVL_WRITE_UNLOCK(pRoot) do { } while (0) # define KAVL_READ_LOCK(pRoot) do { } while (0) # define KAVL_READ_UNLOCK(pRoot) do { } while (0) #endif #ifdef KAVL_OFFSET # define KAVL_GET_POINTER(pp) ( (KAVLNODE *)((KIPTR)(pp) + *(pp)) ) # define KAVL_GET_POINTER_NULL(pp) ( *(pp) != KAVL_NULL ? KAVL_GET_POINTER(pp) : NULL ) # define KAVL_SET_POINTER(pp, p) ( (*(pp)) = ((KIPTR)(p) - (KIPTR)(pp)) ) # define KAVL_SET_POINTER_NULL(pp, pp2) ( (*(pp)) = *(pp2) != KAVL_NULL ? (KIPTR)KAVL_GET_POINTER(pp2) - (KIPTR)(pp) : KAVL_NULL ) #else # define KAVL_GET_POINTER(pp) ( *(pp) ) # define KAVL_GET_POINTER_NULL(pp) ( *(pp) ) # define KAVL_SET_POINTER(pp, p) ( (*(pp)) = (p) ) # define KAVL_SET_POINTER_NULL(pp, pp2) ( (*(pp)) = *(pp2) ) #endif /** @def KAVL_NULL * The NULL 'pointer' equivalent. */ #ifdef KAVL_OFFSET # define KAVL_NULL 0 #else # define KAVL_NULL NULL #endif #ifdef KAVL_STD_KEY_COMP # define KAVL_G(key1, key2) ( (key1) > (key2) ) # define KAVL_E(key1, key2) ( (key1) == (key2) ) # define KAVL_NE(key1, key2) ( (key1) != (key2) ) # ifdef KAVL_RANGE # define KAVL_R_IS_IDENTICAL(key1B, key2B, key1E, key2E) ( (key1B) == (key2B) && (key1E) == (key2E) ) # define KAVL_R_IS_INTERSECTING(key1B, key2B, key1E, key2E) ( (key1B) <= (key2E) && (key1E) >= (key2B) ) # define KAVL_R_IS_IN_RANGE(key1B, key1E, key2) KAVL_R_IS_INTERSECTING(key1B, key2, key1E, key2) # endif #endif #ifndef KAVL_RANGE # define KAVL_R_IS_INTERSECTING(key1B, key2B, key1E, key2E) KAVL_E(key1B, key2B) # define KAVL_R_IS_IDENTICAL(key1B, key2B, key1E, key2E) KAVL_E(key1B, key2B) #endif /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Stack used to avoid recursive calls during insert and removal. */ typedef struct { unsigned cEntries; KAVLTREEPTR *aEntries[KAVL_MAX_STACK]; } KAVL_INT(STACK); /** * The callback used by the Destroy and DoWithAll functions. */ typedef int (* KAVL_TYPE(PFN,CALLBACK))(KAVLNODE *, void *); #ifdef KAVL_NEED_KAVLROOT /** * The AVL root structure. */ typedef struct { KAVLTREEPTR mpRoot; # ifdef KAVL_LOOKTHRU KAVLTREEPTR maLookthru[KAVL_LOOKTHRU]; # endif } KAVLROOT; #endif /** * Rewinds a stack of node pointer pointers, rebalancing the tree. * * @param pStack Pointer to stack to rewind. * @sketch LOOP thru all stack entries * BEGIN * Get pointer to pointer to node (and pointer to node) from the stack. * IF 2 higher left subtree than in right subtree THEN * BEGIN * IF higher (or equal) left-sub-subtree than right-sub-subtree THEN * * n+2|n+3 * / \ / \ * n+2 n ==> n+1 n+1|n+2 * / \ / \ * n+1 n|n+1 n|n+1 n * * Or with keys: * * 4 2 * / \ / \ * 2 5 ==> 1 4 * / \ / \ * 1 3 3 5 * * ELSE * * n+2 * / \ / \ * n+2 n n+1 n+1 * / \ ==> / \ / \ * n n+1 n L R n * / \ * L R * * Or with keys: * 6 4 * / \ / \ * 2 7 ==> 2 6 * / \ / \ / \ * 1 4 1 3 5 7 * / \ * 3 5 * END * ELSE IF 2 higher in right subtree than in left subtree THEN * BEGIN * Same as above but left <==> right. (invert the picture) * ELSE * IF correct height THEN break * ELSE correct height. * END */ K_DECL_INLINE(void) KAVL_FN(Rebalance)(KAVL_INT(STACK) *pStack) { while (pStack->cEntries > 0) { KAVLTREEPTR *ppNode = pStack->aEntries[--pStack->cEntries]; KAVLNODE *pNode = KAVL_GET_POINTER(ppNode); KAVLNODE *pLeftNode = KAVL_GET_POINTER_NULL(&pNode->mpLeft); KU8 uLeftHeight = KAVL_HEIGHTOF(pLeftNode); KAVLNODE *pRightNode = KAVL_GET_POINTER_NULL(&pNode->mpRight); KU8 uRightHeight = KAVL_HEIGHTOF(pRightNode); if (uRightHeight + 1 < uLeftHeight) { KAVLNODE *pLeftLeftNode = KAVL_GET_POINTER_NULL(&pLeftNode->mpLeft); KAVLNODE *pLeftRightNode = KAVL_GET_POINTER_NULL(&pLeftNode->mpRight); KU8 uLeftRightHeight = KAVL_HEIGHTOF(pLeftRightNode); if (KAVL_HEIGHTOF(pLeftLeftNode) >= uLeftRightHeight) { KAVL_SET_POINTER_NULL(&pNode->mpLeft, &pLeftNode->mpRight); KAVL_SET_POINTER(&pLeftNode->mpRight, pNode); pLeftNode->mHeight = (KU8)(1 + (pNode->mHeight = (KU8)(1 + uLeftRightHeight))); KAVL_SET_POINTER(ppNode, pLeftNode); } else { KAVL_SET_POINTER_NULL(&pLeftNode->mpRight, &pLeftRightNode->mpLeft); KAVL_SET_POINTER_NULL(&pNode->mpLeft, &pLeftRightNode->mpRight); KAVL_SET_POINTER(&pLeftRightNode->mpLeft, pLeftNode); KAVL_SET_POINTER(&pLeftRightNode->mpRight, pNode); pLeftNode->mHeight = pNode->mHeight = uLeftRightHeight; pLeftRightNode->mHeight = uLeftHeight; KAVL_SET_POINTER(ppNode, pLeftRightNode); } } else if (uLeftHeight + 1 < uRightHeight) { KAVLNODE *pRightLeftNode = KAVL_GET_POINTER_NULL(&pRightNode->mpLeft); KU8 uRightLeftHeight = KAVL_HEIGHTOF(pRightLeftNode); KAVLNODE *pRightRightNode = KAVL_GET_POINTER_NULL(&pRightNode->mpRight); if (KAVL_HEIGHTOF(pRightRightNode) >= uRightLeftHeight) { KAVL_SET_POINTER_NULL(&pNode->mpRight, &pRightNode->mpLeft); KAVL_SET_POINTER(&pRightNode->mpLeft, pNode); pRightNode->mHeight = (KU8)(1 + (pNode->mHeight = (KU8)(1 + uRightLeftHeight))); KAVL_SET_POINTER(ppNode, pRightNode); } else { KAVL_SET_POINTER_NULL(&pRightNode->mpLeft, &pRightLeftNode->mpRight); KAVL_SET_POINTER_NULL(&pNode->mpRight, &pRightLeftNode->mpLeft); KAVL_SET_POINTER(&pRightLeftNode->mpRight, pRightNode); KAVL_SET_POINTER(&pRightLeftNode->mpLeft, pNode); pRightNode->mHeight = pNode->mHeight = uRightLeftHeight; pRightLeftNode->mHeight = uRightHeight; KAVL_SET_POINTER(ppNode, pRightLeftNode); } } else { KU8 uHeight = (KU8)(K_MAX(uLeftHeight, uRightHeight) + 1); if (uHeight == pNode->mHeight) break; pNode->mHeight = uHeight; } } } /** * Initializes the root of the AVL-tree. * * @param pTree Pointer to the root structure. */ KAVL_DECL(void) KAVL_FN(Init)(KAVLROOT *pRoot) { #ifdef KAVL_LOOKTHRU unsigned i; #endif pRoot->mpRoot = KAVL_NULL; #ifdef KAVL_LOOKTHRU for (i = 0; i < (KAVL_LOOKTHRU); i++) pRoot->maLookthru[i] = KAVL_NULL; #endif } /** * Inserts a node into the AVL-tree. * @returns K_TRUE if inserted. * K_FALSE if node exists in tree. * @param pRoot Pointer to the AVL-tree root structure. * @param pNode Pointer to the node which is to be added. * @sketch Find the location of the node (using binary tree algorithm.): * LOOP until NULL leaf pointer * BEGIN * Add node pointer pointer to the AVL-stack. * IF new-node-key < node key THEN * left * ELSE * right * END * Fill in leaf node and insert it. * Rebalance the tree. */ KAVL_DECL(KBOOL) KAVL_FN(Insert)(KAVLROOT *pRoot, KAVLNODE *pNode) { KAVL_INT(STACK) AVLStack; KAVLTREEPTR *ppCurNode = &pRoot->mpRoot; register KAVLKEY Key = pNode->mKey; #ifdef KAVL_RANGE register KAVLKEY KeyLast = pNode->mKeyLast; #endif #ifdef KAVL_RANGE if (Key > KeyLast) return K_FALSE; #endif KAVL_WRITE_LOCK(pRoot); AVLStack.cEntries = 0; while (*ppCurNode != KAVL_NULL) { register KAVLNODE *pCurNode = KAVL_GET_POINTER(ppCurNode); kHlpAssert(AVLStack.cEntries < KAVL_MAX_STACK); AVLStack.aEntries[AVLStack.cEntries++] = ppCurNode; #ifdef KAVL_EQUAL_ALLOWED if (KAVL_R_IS_IDENTICAL(pCurNode->mKey, Key, pCurNode->mKeyLast, KeyLast)) { /* * If equal then we'll use a list of equal nodes. */ pNode->mpLeft = pNode->mpRight = KAVL_NULL; pNode->mHeight = 0; KAVL_SET_POINTER_NULL(&pNode->mpList, &pCurNode->mpList); KAVL_SET_POINTER(&pCurNode->mpList, pNode); KAVL_WRITE_UNLOCK(pRoot); return K_TRUE; } #endif #ifdef KAVL_CHECK_FOR_EQUAL_INSERT if (KAVL_R_IS_INTERSECTING(pCurNode->mKey, Key, pCurNode->mKeyLast, KeyLast)) { KAVL_WRITE_UNLOCK(pRoot); return K_FALSE; } #endif if (KAVL_G(pCurNode->mKey, Key)) ppCurNode = &pCurNode->mpLeft; else ppCurNode = &pCurNode->mpRight; } pNode->mpLeft = pNode->mpRight = KAVL_NULL; #ifdef KAVL_EQUAL_ALLOWED pNode->mpList = KAVL_NULL; #endif pNode->mHeight = 1; KAVL_SET_POINTER(ppCurNode, pNode); KAVL_FN(Rebalance)(&AVLStack); KAVL_WRITE_UNLOCK(pRoot); return K_TRUE; } /** * Removes a node from the AVL-tree. * @returns Pointer to the node. * @param pRoot Pointer to the AVL-tree root structure. * @param Key Key value of the node which is to be removed. * @sketch Find the node which is to be removed: * LOOP until not found * BEGIN * Add node pointer pointer to the AVL-stack. * IF the keys matches THEN break! * IF remove key < node key THEN * left * ELSE * right * END * IF found THEN * BEGIN * IF left node not empty THEN * BEGIN * Find the right most node in the left tree while adding the pointer to the pointer to it's parent to the stack: * Start at left node. * LOOP until right node is empty * BEGIN * Add to stack. * go right. * END * Link out the found node. * Replace the node which is to be removed with the found node. * Correct the stack entry for the pointer to the left tree. * END * ELSE * BEGIN * Move up right node. * Remove last stack entry. * END * Balance tree using stack. * END * return pointer to the removed node (if found). */ KAVL_DECL(KAVLNODE *) KAVL_FN(Remove)(KAVLROOT *pRoot, KAVLKEY Key) { KAVL_INT(STACK) AVLStack; KAVLTREEPTR *ppDeleteNode = &pRoot->mpRoot; register KAVLNODE *pDeleteNode; KAVL_WRITE_LOCK(pRoot); AVLStack.cEntries = 0; for (;;) { if (*ppDeleteNode == KAVL_NULL) { KAVL_WRITE_UNLOCK(pRoot); return NULL; } pDeleteNode = KAVL_GET_POINTER(ppDeleteNode); kHlpAssert(AVLStack.cEntries < KAVL_MAX_STACK); AVLStack.aEntries[AVLStack.cEntries++] = ppDeleteNode; if (KAVL_E(pDeleteNode->mKey, Key)) break; if (KAVL_G(pDeleteNode->mKey, Key)) ppDeleteNode = &pDeleteNode->mpLeft; else ppDeleteNode = &pDeleteNode->mpRight; } if (pDeleteNode->mpLeft != KAVL_NULL) { /* find the rightmost node in the left tree. */ const unsigned iStackEntry = AVLStack.cEntries; KAVLTREEPTR *ppLeftLeast = &pDeleteNode->mpLeft; register KAVLNODE *pLeftLeast = KAVL_GET_POINTER(ppLeftLeast); while (pLeftLeast->mpRight != KAVL_NULL) { kHlpAssert(AVLStack.cEntries < KAVL_MAX_STACK); AVLStack.aEntries[AVLStack.cEntries++] = ppLeftLeast; ppLeftLeast = &pLeftLeast->mpRight; pLeftLeast = KAVL_GET_POINTER(ppLeftLeast); } /* link out pLeftLeast */ KAVL_SET_POINTER_NULL(ppLeftLeast, &pLeftLeast->mpLeft); /* link it in place of the delete node. */ KAVL_SET_POINTER_NULL(&pLeftLeast->mpLeft, &pDeleteNode->mpLeft); KAVL_SET_POINTER_NULL(&pLeftLeast->mpRight, &pDeleteNode->mpRight); pLeftLeast->mHeight = pDeleteNode->mHeight; KAVL_SET_POINTER(ppDeleteNode, pLeftLeast); AVLStack.aEntries[iStackEntry] = &pLeftLeast->mpLeft; } else { KAVL_SET_POINTER_NULL(ppDeleteNode, &pDeleteNode->mpRight); AVLStack.cEntries--; } KAVL_FN(Rebalance)(&AVLStack); KAVL_LOOKTHRU_INVALIDATE_NODE(pRoot, pDeleteNode, Key); KAVL_WRITE_UNLOCK(pRoot); return pDeleteNode; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/kAvlEnum.h��������������������������������������������0000664�0001750�0001750�00000014612�14670377513�023030� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlEnum.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Node Enumeration. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Enumeration control data. * * This is initialized by BeginEnum and used by GetNext to figure out what * to do next. */ typedef struct KAVL_TYPE(,ENUMDATA) { KBOOL fFromLeft; KI8 cEntries; KU8 achFlags[KAVL_MAX_STACK]; KAVLNODE * aEntries[KAVL_MAX_STACK]; } KAVL_TYPE(,ENUMDATA), *KAVL_TYPE(P,ENUMDATA); /** * Ends an enumeration. * * The purpose of this function is to unlock the tree should the * AVL implementation include locking. It's good practice to call * it anyway even if the tree doesn't do any locking. * * @param pEnumData Pointer to enumeration control data. */ KAVL_DECL(void) KAVL_FN(EndEnum)(KAVL_TYPE(,ENUMDATA) *pEnumData) { KAVLROOT pRoot = pEnumData->pRoot; pEnumData->pRoot = NULL; if (pRoot) KAVL_READ_UNLOCK(pEnumData->pRoot); } /** * Get the next node in the tree enumeration. * * The current implementation of this function willl not walk the mpList * chain like the DoWithAll function does. This may be changed later. * * @returns Pointer to the next node in the tree. * NULL is returned when the end of the tree has been reached, * it is not necessary to call EndEnum in this case. * @param pEnumData Pointer to enumeration control data. */ KAVL_DECL(KAVLNODE *) KAVL_FN(GetNext)(KAVL_TYPE(,ENUMDATA) *pEnumData) { if (pEnumData->fFromLeft) { /* from left */ while (pEnumData->cEntries > 0) { KAVLNODE *pNode = pEnumData->aEntries[pEnumData->cEntries - 1]; /* left */ if (pEnumData->achFlags[pEnumData->cEntries - 1] == 0) { pEnumData->achFlags[pEnumData->cEntries - 1]++; if (pNode->mpLeft != KAVL_NULL) { pEnumData->achFlags[pEnumData->cEntries] = 0; /* 0 left, 1 center, 2 right */ pEnumData->aEntries[pEnumData->cEntries++] = KAVL_GET_POINTER(&pNode->mpLeft); continue; } } /* center */ if (pEnumData->achFlags[pEnumData->cEntries - 1] == 1) { pEnumData->achFlags[pEnumData->cEntries - 1]++; return pNode; } /* right */ pEnumData->cEntries--; if (pNode->mpRight != KAVL_NULL) { pEnumData->achFlags[pEnumData->cEntries] = 0; pEnumData->aEntries[pEnumData->cEntries++] = KAVL_GET_POINTER(&pNode->mpRight); } } /* while */ } else { /* from right */ while (pEnumData->cEntries > 0) { KAVLNODE *pNode = pEnumData->aEntries[pEnumData->cEntries - 1]; /* right */ if (pEnumData->achFlags[pEnumData->cEntries - 1] == 0) { pEnumData->achFlags[pEnumData->cEntries - 1]++; if (pNode->mpRight != KAVL_NULL) { pEnumData->achFlags[pEnumData->cEntries] = 0; /* 0 right, 1 center, 2 left */ pEnumData->aEntries[pEnumData->cEntries++] = KAVL_GET_POINTER(&pNode->mpRight); continue; } } /* center */ if (pEnumData->achFlags[pEnumData->cEntries - 1] == 1) { pEnumData->achFlags[pEnumData->cEntries - 1]++; return pNode; } /* left */ pEnumData->cEntries--; if (pNode->mpLeft != KAVL_NULL) { pEnumData->achFlags[pEnumData->cEntries] = 0; pEnumData->aEntries[pEnumData->cEntries++] = KAVL_GET_POINTER(&pNode->mpLeft); } } /* while */ } /* * Call EndEnum. */ KAVL_FN(EndEnum)(pEnumData); return NULL; } /** * Starts an enumeration of all nodes in the given AVL tree. * * The current implementation of this function will not walk the mpList * chain like the DoWithAll function does. This may be changed later. * * @returns Pointer to the first node in the enumeration. * If NULL is returned the tree is empty calling EndEnum isn't * strictly necessary (although it will do no harm). * @param pRoot Pointer to the AVL-tree root structure. * @param pEnumData Pointer to enumeration control data. * @param fFromLeft K_TRUE: Left to right. * K_FALSE: Right to left. */ KAVL_DECL(KAVLNODE *) KAVL_FN(BeginEnum)(KAVLROOT *pRoot, KAVL_TYPE(,ENUMDATA) *pEnumData, KBOOL fFromLeft) { KAVL_READ_LOCK(pRoot); pEnumData->pRoot = pRoot; if (pRoot->mpRoot != KAVL_NULL) { pEnumData->fFromLeft = fFromLeft; pEnumData->cEntries = 1; pEnumData->aEntries[0] = KAVL_GET_POINTER(pRoot->mpRoot); pEnumData->achFlags[0] = 0; } else pEnumData->cEntries = 0; return KAVL_FN(GetNext)(pEnumData); } ����������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/kAvlDestroy.h�����������������������������������������0000664�0001750�0001750�00000010335�14670377513�023553� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlDestroy.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Destroy the tree. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Destroys the specified tree, starting with the root node and working our way down. * * @returns 0 on success. * @returns Return value from callback on failure. On failure, the tree will be in * an unbalanced condition and only further calls to the Destroy should be * made on it. Note that the node we fail on will be considered dead and * no action is taken to link it back into the tree. * @param pRoot Pointer to the AVL-tree root structure. * @param pfnCallBack Pointer to callback function. * @param pvUser User parameter passed on to the callback function. */ KAVL_DECL(int) KAVL_FN(Destroy)(KAVLROOT *pRoot, KAVL_TYPE(PFN,CALLBACK) pfnCallBack, void *pvUser) { #ifdef KAVL_LOOKTHRU unsigned i; #endif unsigned cEntries; KAVLNODE *apEntries[KAVL_MAX_STACK]; int rc; KAVL_WRITE_LOCK(pRoot); if (pRoot->mpRoot == KAVL_NULL) { KAVL_WRITE_UNLOCK(pRoot); return 0; } #ifdef KAVL_LOOKTHRU /* * Kill the lookthru cache. */ for (i = 0; i < (KAVL_LOOKTHRU); i++) pRoot->maLookthru[i] = KAVL_NULL; #endif cEntries = 1; apEntries[0] = KAVL_GET_POINTER(&pRoot->mpRoot); while (cEntries > 0) { /* * Process the subtrees first. */ KAVLNODE *pNode = apEntries[cEntries - 1]; if (pNode->mpLeft != KAVL_NULL) apEntries[cEntries++] = KAVL_GET_POINTER(&pNode->mpLeft); else if (pNode->mpRight != KAVL_NULL) apEntries[cEntries++] = KAVL_GET_POINTER(&pNode->mpRight); else { #ifdef KAVL_EQUAL_ALLOWED /* * Process nodes with the same key. */ while (pNode->pList != KAVL_NULL) { KAVLNODE *pEqual = KAVL_GET_POINTER(&pNode->pList); KAVL_SET_POINTER(&pNode->pList, KAVL_GET_POINTER_NULL(&pEqual->pList)); pEqual->pList = KAVL_NULL; rc = pfnCallBack(pEqual, pvUser); if (rc) { KAVL_WRITE_UNLOCK(pRoot); return rc; } } #endif /* * Unlink the node. */ if (--cEntries > 0) { KAVLNODE *pParent = apEntries[cEntries - 1]; if (KAVL_GET_POINTER(&pParent->mpLeft) == pNode) pParent->mpLeft = KAVL_NULL; else pParent->mpRight = KAVL_NULL; } else pRoot->mpRoot = KAVL_NULL; kHlpAssert(pNode->mpLeft == KAVL_NULL); kHlpAssert(pNode->mpRight == KAVL_NULL); rc = pfnCallBack(pNode, pvUser); if (rc) { KAVL_WRITE_UNLOCK(pRoot); return rc; } } } /* while */ kHlpAssert(pRoot->mpRoot == KAVL_NULL); KAVL_WRITE_UNLOCK(pRoot); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/kAvlRemoveBestFit.h�����������������������������������0000664�0001750�0001750�00000005617�14670377513�024647� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlRemoveBestFit.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Remove Best Fitting Node. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Finds the best fitting node in the tree for the given Key value and removes the node. * * @returns Pointer to the removed node. * @param pRoot Pointer to the AVL-tree root structure. * @param Key The Key of which is to be found a best fitting match for.. * @param fAbove K_TRUE: Returned node is have the closest key to Key from above. * K_FALSE: Returned node is have the closest key to Key from below. * * @remark This implementation uses GetBestFit and then Remove and might therefore * not be the most optimal kind of implementation, but it reduces the complexity * code size, and the likelyhood for bugs. */ KAVL_DECL(KAVLNODE *) KAVL_FN(RemoveBestFit)(KAVLROOT *pRoot, KAVLKEY Key, KBOOL fAbove) { /* * If we find anything we'll have to remove the node and return it. * Now, if duplicate keys are allowed we'll remove a duplicate before * removing the in-tree node as this is way cheaper. */ KAVLNODE *pNode = KAVL_FN(GetBestFit)(pRoot, Key, fAbove); if (pNode != NULL) { #ifdef KAVL_EQUAL_ALLOWED KAVL_WRITE_LOCK(pRoot); /** @todo the locking isn't quite sane here. :-/ */ if (pNode->mpList != KAVL_NULL) { KAVLNODE *pRet = KAVL_GET_POINTER(&pNode->mpList); KAVL_SET_POINTER_NULL(&pNode->mpList, &pRet->mpList); KAVL_LOOKTHRU_INVALIDATE_NODE(pRoot, pNode, pNode->mKey); KAVL_WRITE_UNLOCK(pRoot); return pRet; } KAVL_WRITE_UNLOCK(pRoot); #endif pNode = KAVL_FN(Remove)(pRoot, pNode->mKey); } return pNode; } �����������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlTmpl/kAvlRemove2.h�����������������������������������������0000664�0001750�0001750�00000010652�14670377513�023443� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlRemove2.h 34 2009-11-08 19:38:40Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Remove A Specific Node. */ /* * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Removes the specified node from the tree. * * @returns Pointer to the removed node (NULL if not in the tree) * @param pRoot Pointer to the AVL-tree root structure. * @param Key The Key of which is to be found a best fitting match for.. * * @remark This implementation isn't the most efficient, but this short and * easier to manage. */ KAVL_DECL(KAVLNODE *) KAVL_FN(Remove2)(KAVLROOT *pRoot, KAVLNODE *pNode) { #ifdef KAVL_EQUAL_ALLOWED /* * Find the right node by key and see if it's what we want. */ KAVLNODE *pParent; KAVLNODE *pCurNode = KAVL_FN(GetWithParent)(pRoot, pNode->mKey, &pParent); if (!pCurNode) return NULL; KAVL_WRITE_LOCK(pRoot); /** @todo the locking here isn't 100% sane. The only way to archive that is by no calling worker functions. */ if (pCurNode != pNode) { /* * It's not the one we want, but it could be in the duplicate list. */ while (pCurNode->mpList != KAVL_NULL) { KAVLNODE *pNext = KAVL_GET_POINTER(&pCurNode->mpList); if (pNext == pNode) { KAVL_SET_POINTER_NULL(&pCurNode->mpList, KAVL_GET_POINTER_NULL(&pNode->mpList)); pNode->mpList = KAVL_NULL; KAVL_LOOKTHRU_INVALIDATE_NODE(pRoot, pNode, pNode->mKey); KAVL_WRITE_UNLOCK(pRoot); return pNode; } pCurNode = pNext; } KAVL_WRITE_UNLOCK(pRoot); return NULL; } /* * Ok, it's the one we want alright. * * Simply remove it if it's the only one with they Key, * if there are duplicates we'll have to unlink it and * insert the first duplicate in our place. */ if (pNode->mpList == KAVL_NULL) { KAVL_WRITE_UNLOCK(pRoot); KAVL_FN(Remove)(pRoot, pNode->mKey); } else { KAVLNODE *pNewUs = KAVL_GET_POINTER(&pNode->mpList); pNewUs->mHeight = pNode->mHeight; if (pNode->mpLeft != KAVL_NULL) KAVL_SET_POINTER(&pNewUs->mpLeft, KAVL_GET_POINTER(&pNode->mpLeft)) else pNewUs->mpLeft = KAVL_NULL; if (pNode->mpRight != KAVL_NULL) KAVL_SET_POINTER(&pNewUs->mpRight, KAVL_GET_POINTER(&pNode->mpRight)) else pNewUs->mpRight = KAVL_NULL; if (pParent) { if (KAVL_GET_POINTER_NULL(&pParent->mpLeft) == pNode) KAVL_SET_POINTER(&pParent->mpLeft, pNewUs); else KAVL_SET_POINTER(&pParent->mpRight, pNewUs); } else KAVL_SET_POINTER(&pRoot->mpRoot, pNewUs); KAVL_LOOKTHRU_INVALIDATE_NODE(pRoot, pNode, pNode->mKey); KAVL_WRITE_UNLOCK(pRoot); } return pNode; #else /* * Delete it, if we got the wrong one, reinsert it. * * This ASSUMS that the caller is NOT going to hand us a lot * of wrong nodes but just uses this API for his convenience. */ KAVLNODE *pRemovedNode = KAVL_FN(Remove)(pRoot, pNode->mKey); if (pRemovedNode == pNode) return pRemovedNode; KAVL_FN(Insert)(pRoot, pRemovedNode); return NULL; #endif } ��������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kDbg.h���������������������������������������������������������0000664�0001750�0001750�00000017231�14670377513�020423� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbg.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kDbg_h___ #define ___k_kDbg_h___ #include <k/kDefs.h> #include <k/kTypes.h> #include <k/kRdr.h> #ifdef __cplusplus extern "C" { #endif /** @defgroup grp_kDbg Debug Info Reader * @{ */ /** @def KDBG_DECL * Declares a kDbg function according to build context. * @param type The return type. */ #if defined(KDBG_BUILDING_DYNAMIC) # define KDBG_DECL(type) K_DECL_EXPORT(type) #elif defined(KDBG_BUILT_DYNAMIC) # define KDBG_DECL(type) K_DECL_IMPORT(type) #else # define KDBG_DECL(type) type #endif /** The kDbg address type. */ typedef KU64 KDBGADDR; /** Pointer to a kDbg address. */ typedef KDBGADDR *PKDBGADDR; /** Pointer to a const kDbg address. */ typedef const KDBGADDR *PCKDBGADDR; /** @def KDBGADDR_PRI * printf format type. */ #define KDBGADDR_PRI KX64_PRI /** @def KDBGADDR_MAX * Max kDbg address value. */ #define KDBGADDR_MAX KU64_C(0xfffffffffffffffe) /** @def KDBGADDR_C * kDbg address constant. * @param c The constant value. */ #define KDBGADDR_C(c) KU64_C(c) /** NIL address. */ #define NIL_KDBGADDR KU64_MAX /** @name Special Segments * @{ */ /** Relative Virtual Address. * The specified offset is relative to the image base. The image base is the lowest memory * address used by the image when loaded with the address assignments indicated in the image. */ #define KDBGSEG_RVA (-1) /** Absolute segment. The offset isn't relative to anything. */ #define KDBGSEG_ABS (-2) /** @} */ /** The max filename path length used by the debug reader. */ #define KDBG_PATH_MAX 260 /** * Line number details. */ typedef struct KDBGLINE { /** The relative virtual address. */ KDBGADDR RVA; /** The offset into the segment. */ KDBGADDR offSegment; /** The segment number. */ KI32 iSegment; /** The Line number. */ KU32 iLine; /** The actual size of this structure. */ KU16 cbSelf; /** The length of the filename. */ KU16 cchFile; /** The name of the file this line number relates to. */ char szFile[KDBG_PATH_MAX]; } KDBGLINE; /** Pointer to line number details. */ typedef KDBGLINE *PKDBGLINE; /** Pointer to const line number details. */ typedef const KDBGLINE *PCKDBGLINE; /** Pointer to a pointer to line number details. */ typedef PKDBGLINE *PPKDBGLINE; /** * Duplicates a line number. * * To save heap space, the returned line number will not own more heap space * than it strictly need to. So, it's not possible to append stuff to the symbol * or anything of that kind. * * @returns Pointer to the duplicate. * This must be freed using RTDbgSymbolFree(). * @param pLine The line number to be duplicated. */ KDBG_DECL(PKDBGLINE) kDbgLineDup(PCKDBGLINE pLine); /** * Frees a line number obtained from the RTDbg API. * * @returns VINF_SUCCESS on success. * @returns KERR_INVALID_POINTER if a NULL pointer or an !KDBG_VALID_PTR() is passed in. * * @param pLine The line number to be freed. */ KDBG_DECL(int) kDbgLineFree(PKDBGLINE pLine); /** @name Symbol Flags. * @{ */ /** The symbol is weak. */ #define KDBGSYM_FLAGS_WEAK KU32_C(0x00000000) /** The symbol is absolute. * (This also indicated by the segment number.) */ #define KDBGSYM_FLAGS_ABS KU32_C(0x00000001) /** The symbol is exported. */ #define KDBGSYM_FLAGS_EXPORTED KU32_C(0x00000002) /** The symbol is a function/method/procedure/whatever-executable-code. */ #define KDBGSYM_FLAGS_CODE KU32_C(0x00000004) /** The symbol is some kind of data. */ #define KDBGSYM_FLAGS_DATA KU32_C(0x00000008) /** @} */ /** The max symbol name length used by the debug reader. */ #define KDBG_SYMBOL_MAX 384 /** * Symbol details. */ typedef struct KDBGSYMBOL { /** The adddress of this symbol in the relevant space. * This is NIL_KDBGADDR unless the information was * returned by a kDbgSpace API. */ KDBGADDR Address; /** The relative virtual address. */ KDBGADDR RVA; /** The symbol size. * This is not a reliable field, it could be a bad guess. Ignore if zero. */ KDBGADDR cb; /** The offset into the segment. */ KDBGADDR offSegment; /** The segment number. */ KI32 iSegment; /** The symbol flags. */ KU32 fFlags; /** @todo type info. */ /** The actual size of this structure. */ KU16 cbSelf; /** The length of the symbol name. */ KU16 cchName; /** The symbol name. */ char szName[KDBG_SYMBOL_MAX]; } KDBGSYMBOL; /** Pointer to symbol details. */ typedef KDBGSYMBOL *PKDBGSYMBOL; /** Pointer to const symbol details. */ typedef const KDBGSYMBOL *PCKDBGSYMBOL; /** Pointer to a pointer to symbol details. */ typedef PKDBGSYMBOL *PPKDBGSYMBOL; /** * Duplicates a symbol. * * To save heap space, the returned symbol will not own more heap space than * it strictly need to. So, it's not possible to append stuff to the symbol * or anything of that kind. * * @returns Pointer to the duplicate. * This must be freed using kDbgSymbolFree(). * @param pSymbol The symbol to be freed. */ KDBG_DECL(PKDBGSYMBOL) kDbgSymbolDup(PCKDBGSYMBOL pSymbol); /** * Frees a symbol obtained from the kDbg API. * * @returns VINF_SUCCESS on success. * @returns KERR_INVALID_POINTER if a NULL pointer or an !KDBG_VALID_PTR() is passed in. * * @param pSymbol The symbol to be freed. */ KDBG_DECL(int) kDbgSymbolFree(PKDBGSYMBOL pSymbol); /** Pointer to a debug module. */ typedef struct KDBGMOD *PKDBGMOD; /** Pointer to a debug module pointer. */ typedef PKDBGMOD *PPKDBGMOD; KDBG_DECL(int) kDbgModuleOpen(PPKDBGMOD ppDbgMod, const char *pszFilename, struct KLDRMOD *pLdrMod); KDBG_DECL(int) kDbgModuleOpenFile(PPKDBGMOD ppDbgMod, PKRDR pRdr, struct KLDRMOD *pLdrMod); KDBG_DECL(int) kDbgModuleOpenFilePart(PPKDBGMOD ppDbgMod, PKRDR pRdr, KFOFF off, KFOFF cb, struct KLDRMOD *pLdrMod); KDBG_DECL(int) kDbgModuleClose(PKDBGMOD pMod); KDBG_DECL(int) kDbgModuleQuerySymbol(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PKDBGSYMBOL pSym); KDBG_DECL(int) kDbgModuleQuerySymbolA(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PPKDBGSYMBOL ppSym); KDBG_DECL(int) kDbgModuleQueryLine(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PKDBGLINE pLine); KDBG_DECL(int) kDbgModuleQueryLineA(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PPKDBGLINE ppLine); /** @} */ #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kHlpString.h���������������������������������������������������0000664�0001750�0001750�00000012007�14670377513�021635� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpString.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - String And Memory Routines. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpString_h___ #define ___k_kHlpString_h___ #include <k/kHlpDefs.h> #include <k/kTypes.h> #if 0 /* optimize / fix this later */ #ifdef __GNUC__ /** memchr */ # define kHlpMemChr(a,b,c) __builtin_memchr(a,b,c) /** memcmp */ # define kHlpMemComp(a,b,c) __builtin_memcmp(a,b,c) /** memcpy */ # define kHlpMemCopy(a,b,c) __builtin_memcpy(a,b,c) /** memset */ # define kHlpMemSet(a,b,c) __builtin_memset(a,b,c) /** strchr */ # define kHlpStrChr(a, b) __builtin_strchr(a, b) /** strcmp */ # define kHlpStrComp(a, b) __builtin_strcmp(a, b) /** strncmp */ # define kHlpStrNComp(a,b,c) __builtin_strncmp(a, b, c) /** strlen */ # define kHlpStrLen(a) __builtin_strlen(a) #elif defined(_MSC_VER) # pragma intrinsic(memcmp, memcpy, memset, strcmp, strlen) /** memcmp */ # define kHlpMemComp(a,b,c) memcmp(a,b,c) /** memcpy */ # define kHlpMemCopy(a,b,c) memcpy(a,b,c) /** memset */ # define kHlpMemSet(a,b,c) memset(a,b,c) /** strcmp */ # define kHlpStrComp(a, b) strcmp(a, b) /** strlen */ # define kHlpStrLen(a) strlen(a) #else # error "Port Me" #endif #endif /* disabled */ #ifdef __cplusplus extern "C" { #endif #ifndef kHlpMemChr KHLP_DECL(void *) kHlpMemChr(const void *pv, int ch, KSIZE cb); #endif #ifndef kHlpMemComp KHLP_DECL(int) kHlpMemComp(const void *pv1, const void *pv2, KSIZE cb); #endif #ifndef kHlpMemComp KHLP_DECL(void *) kHlpMemPComp(const void *pv1, const void *pv2, KSIZE cb); #endif #ifndef kHlpMemCopy KHLP_DECL(void *) kHlpMemCopy(void *pv1, const void *pv2, KSIZE cb); #endif #ifndef kHlpMemPCopy KHLP_DECL(void *) kHlpMemPCopy(void *pv1, const void *pv2, KSIZE cb); #endif #ifndef kHlpMemMove KHLP_DECL(void *) kHlpMemMove(void *pv1, const void *pv2, KSIZE cb); #endif #ifndef kHlpMemPMove KHLP_DECL(void *) kHlpMemPMove(void *pv1, const void *pv2, KSIZE cb); #endif #ifndef kHlpMemSet KHLP_DECL(void *) kHlpMemSet(void *pv1, int ch, KSIZE cb); #endif #ifndef kHlpMemPSet KHLP_DECL(void *) kHlpMemPSet(void *pv1, int ch, KSIZE cb); #endif KHLP_DECL(int) kHlpMemICompAscii(const void *pv1, const void *pv2, KSIZE cb); #ifndef kHlpStrCat KHLP_DECL(char *) kHlpStrCat(char *psz1, const char *psz2); #endif #ifndef kHlpStrPCat KHLP_DECL(char *) kHlpStrPCat(char *psz1, const char *psz2); #endif #ifndef kHlpStrNCat KHLP_DECL(char *) kHlpStrNCat(char *psz1, const char *psz2, KSIZE cb); #endif #ifndef kHlpStrPNCat KHLP_DECL(char *) kHlpStrNPCat(char *psz1, const char *psz2, KSIZE cb); #endif #ifndef kHlpStrChr KHLP_DECL(char *) kHlpStrChr(const char *psz, int ch); #endif #ifndef kHlpStrRChr KHLP_DECL(char *) kHlpStrRChr(const char *psz, int ch); #endif #ifndef kHlpStrComp KHLP_DECL(int) kHlpStrComp(const char *psz1, const char *psz2); #endif KHLP_DECL(char *) kHlpStrPComp(const char *psz1, const char *psz2); #ifndef kHlpStrNComp KHLP_DECL(int) kHlpStrNComp(const char *psz1, const char *psz2, KSIZE cch); #endif KHLP_DECL(char *) kHlpStrNPComp(const char *psz1, const char *psz2, KSIZE cch); KHLP_DECL(int) kHlpStrICompAscii(const char *pv1, const char *pv2); KHLP_DECL(char *) kHlpStrIPCompAscii(const char *pv1, const char *pv2); KHLP_DECL(int) kHlpStrNICompAscii(const char *pv1, const char *pv2, KSIZE cch); KHLP_DECL(char *) kHlpStrNIPCompAscii(const char *pv1, const char *pv2, KSIZE cch); #ifndef kHlpStrCopy KHLP_DECL(char *) kHlpStrCopy(char *psz1, const char *psz2); #endif #ifndef kHlpStrPCopy KHLP_DECL(char *) kHlpStrPCopy(char *psz1, const char *psz2); #endif #ifndef kHlpStrLen KHLP_DECL(KSIZE) kHlpStrLen(const char *psz1); #endif #ifndef kHlpStrNLen KHLP_DECL(KSIZE) kHlpStrNLen(const char *psz, KSIZE cchMax); #endif KHLP_DECL(char *) kHlpInt2Ascii(char *psz, KSIZE cch, long lVal, unsigned iBase); #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRdr.h���������������������������������������������������������0000664�0001750�0001750�00000006334�14670377513�020460� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRdr.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kRdr - The File Provider. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kRdr_h___ #define ___kRdr_h___ #include <k/kDefs.h> #include <k/kTypes.h> /** @defgroup grp_kRdr kRdr - The File Provider * @{ */ /** @def KRDR_DECL * Declares a kRdr function according to build context. * @param type The return type. */ #if defined(KRDR_BUILDING_DYNAMIC) # define KRDR_DECL(type) K_DECL_EXPORT(type) #elif defined(KRDR_BUILT_DYNAMIC) # define KRDR_DECL(type) K_DECL_IMPORT(type) #else # define KRDR_DECL(type) type #endif #ifdef __cplusplus extern "C" { #endif KRDR_DECL(int) kRdrOpen( PPKRDR ppRdr, const char *pszFilename); KRDR_DECL(int) kRdrClose( PKRDR pRdr); KRDR_DECL(int) kRdrRead( PKRDR pRdr, void *pvBuf, KSIZE cb, KFOFF off); KRDR_DECL(int) kRdrAllMap( PKRDR pRdr, const void **ppvBits); KRDR_DECL(int) kRdrAllUnmap( PKRDR pRdr, const void *pvBits); KRDR_DECL(KFOFF) kRdrSize( PKRDR pRdr); KRDR_DECL(KFOFF) kRdrTell( PKRDR pRdr); KRDR_DECL(const char *) kRdrName( PKRDR pRdr); KRDR_DECL(KIPTR) kRdrNativeFH( PKRDR pRdr); KRDR_DECL(KSIZE) kRdrPageSize( PKRDR pRdr); KRDR_DECL(int) kRdrMap( PKRDR pRdr, void **ppvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed); KRDR_DECL(int) kRdrRefresh( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments); KRDR_DECL(int) kRdrProtect( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect); KRDR_DECL(int) kRdrUnmap( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments); KRDR_DECL(void) kRdrDone( PKRDR pRdr); KRDR_DECL(int) kRdrBufOpen(PPKRDR ppRdr, const char *pszFilename); KRDR_DECL(int) kRdrBufWrap(PPKRDR ppRdr, PKRDR pRdr, KBOOL fCloseIt); KRDR_DECL(KBOOL) kRdrBufIsBuffered(PKRDR pRdr); KRDR_DECL(int) kRdrBufLine(PKRDR pRdr, char *pszLine, KSIZE cbLine); KRDR_DECL(int) kRdrBufLineEx(PKRDR pRdr, char *pszLine, KSIZE *pcbLine); KRDR_DECL(const char *) kRdrBufLineQ(PKRDR pRdr); #ifdef __cplusplus } #endif /** @} */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kCpus.h��������������������������������������������������������0000664�0001750�0001750�00000010162�14670377513�020635� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kCpus.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kCpus - CPU Identifiers. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kCpus_h___ #define ___k_kCpus_h___ /** @defgroup grp_kCpus kCpus - CPU Identifiers * @see the kCpu API for functions operating on the CPU type. * @{ */ /** * CPU Architectures. * * The constants used by this enum has the same values as * the K_ARCH_* #defines defined by k/kDefs.h. */ typedef enum KCPUARCH { /** @copydoc K_ARCH_UNKNOWN */ KCPUARCH_UNKNOWN = K_ARCH_UNKNOWN, /** @copydoc K_ARCH_X86_16 */ KCPUARCH_X86_16 = K_ARCH_X86_16, /** @copydoc K_ARCH_X86_32 */ KCPUARCH_X86_32 = K_ARCH_X86_32, /** @copydoc K_ARCH_AMD64 */ KCPUARCH_AMD64 = K_ARCH_AMD64, /** @copydoc K_ARCH_IA64 */ KCPUARCH_IA64 = K_ARCH_IA64, /** @copydoc K_ARCH_ALPHA */ KCPUARCH_ALPHA = K_ARCH_ALPHA, /** @copydoc K_ARCH_ALPHA_32 */ KCPUARCH_ALPHA_32 = K_ARCH_ALPHA_32, /** @copydoc K_ARCH_ARM_32 */ KCPUARCH_ARM_32 = K_ARCH_ARM_32, /** @copydoc K_ARCH_ARM_64 */ KCPUARCH_ARM_64 = K_ARCH_ARM_64, /** @copydoc K_ARCH_MIPS_32 */ KCPUARCH_MIPS_32 = K_ARCH_MIPS_32, /** @copydoc K_ARCH_MIPS_64 */ KCPUARCH_MIPS_64 = K_ARCH_MIPS_64, /** @copydoc K_ARCH_POWERPC_32 */ KCPUARCH_POWERPC_32 = K_ARCH_POWERPC_32, /** @copydoc K_ARCH_POWERPC_64 */ KCPUARCH_POWERPC_64 = K_ARCH_POWERPC_64, /** @copydoc K_ARCH_SPARC_32 */ KCPUARCH_SPARC_32 = K_ARCH_SPARC_32, /** @copydoc K_ARCH_SPARC_64 */ KCPUARCH_SPARC_64 = K_ARCH_SPARC_64, /** Hack to blow the type up to 32-bit. */ KCPUARCH_32BIT_HACK = 0x7fffffff } KCPUARCH; /** Pointer to a CPU architecture type. */ typedef KCPUARCH *PKCPUARCH; /** Pointer to a const CPU architecture type. */ typedef const KCPUARCH *PCKCPUARCH; /** * CPU models. */ typedef enum KCPU { /** The usual invalid cpu. */ KCPU_INVALID = 0, /** @name K_ARCH_X86_16 * @{ */ KCPU_I8086, KCPU_I8088, KCPU_I80186, KCPU_I80286, KCPU_I386_16, KCPU_I486_16, KCPU_I486SX_16, KCPU_I586_16, KCPU_I686_16, KCPU_P4_16, KCPU_CORE2_16, KCPU_K6_16, KCPU_K7_16, KCPU_K8_16, KCPU_FIRST_X86_16 = KCPU_I8086, KCPU_LAST_X86_16 = KCPU_K8_16, /** @} */ /** @name K_ARCH_X86_32 * @{ */ KCPU_X86_32_BLEND, KCPU_I386, KCPU_I486, KCPU_I486SX, KCPU_I586, KCPU_I686, KCPU_P4, KCPU_CORE2_32, KCPU_K6, KCPU_K7, KCPU_K8_32, KCPU_FIRST_X86_32 = KCPU_I386, KCPU_LAST_X86_32 = KCPU_K8_32, /** @} */ /** @name K_ARCH_AMD64 * @{ */ KCPU_AMD64_BLEND, KCPU_K8, KCPU_P4_64, KCPU_CORE2, KCPU_FIRST_AMD64 = KCPU_K8, KCPU_LAST_AMD64 = KCPU_CORE2, /** @} */ /** The end of the valid cpu values (exclusive). */ KCPU_END, /** Hack to blow the type up to 32-bit. */ KCPU_32BIT_HACK = 0x7fffffff } KCPU; /** Pointer to a CPU type. */ typedef KCPU *PKCPU; /** Pointer to a const CPU type. */ typedef const KCPU *PCKCPU; /** @} */ #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kTypes.h�������������������������������������������������������0000664�0001750�0001750�00000044501�14670377513�021033� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kTypes.h 95 2016-09-26 07:23:08Z bird $ */ /** @file * kTypes - Typedefs And Related Constants And Macros. */ /* * Copyright (c) 2006-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kTypes_h___ #define ___k_kTypes_h___ #include <k/kDefs.h> /** @defgroup grp_kTypes kTypes - Typedefs And Related Constants And Macros * @{ */ /** @typedef KI64 * 64-bit signed integer. */ /** @typedef KU64 * 64-bit unsigned integer. */ /** @def KI64_C * 64-bit signed integer constant. * @param c The constant value. */ /** @def KU64_C * 64-bit unsigned integer constant. * @param c The constant value. */ /** @def KI64_PRI * 64-bit signed integer printf format. */ /** @def KU64_PRI * 64-bit unsigned integer printf format. */ /** @def KX64_PRI * 64-bit signed and unsigned integer hexadecimal printf format. */ /** @typedef KI32 * 32-bit signed integer. */ /** @typedef KU32 * 32-bit unsigned integer. */ /** @def KI32_C * 32-bit signed integer constant. * @param c The constant value. */ /** @def KU32_C * 32-bit unsigned integer constant. * @param c The constant value. */ /** @def KI32_PRI * 32-bit signed integer printf format. */ /** @def KU32_PRI * 32-bit unsigned integer printf format. */ /** @def KX32_PRI * 32-bit signed and unsigned integer hexadecimal printf format. */ /** @typedef KI16 * 16-bit signed integer. */ /** @typedef KU16 * 16-bit unsigned integer. */ /** @def KI16_C * 16-bit signed integer constant. * @param c The value. */ /** @def KU16_C * 16-bit unsigned integer constant. * @param c The value. */ /** @def KI16_PRI * 16-bit signed integer printf format. */ /** @def KU16_PRI * 16-bit unsigned integer printf format. */ /** @def KX16_PRI * 16-bit signed and unsigned integer hexadecimal printf format. */ /** @typedef KI8 * 8-bit signed integer. */ /** @typedef KU8 * 8-bit unsigned integer. */ /** @def KI8_C * 8-bit signed integer constant. * @param c The constant value. */ /** @def KU8_C * 8-bit unsigned integer constant. * @param c The constant value. */ /** @def KI8_PRI * 8-bit signed integer printf format. */ /** @def KU8_PRI * 8-bit unsigned integer printf format. */ /** @def KX8_PRI * 8-bit signed and unsigned integer hexadecimal printf format. */ /** @typedef KSIZE * Memory size type; unsigned integer. */ /** @typedef KSSIZE * Memory size type; signed integer. */ /** @def KSIZE_C * Memory size constant. * @param c The constant value. */ /** @def KSSIZE_C * Memory size constant. * @param c The constant value. */ /** @def KSIZE_MAX * Memory size max constant.*/ /** @def KSSIZE_MAX * Memory size max constant.*/ /** @def KSSIZE_MIN * Memory size min constant.*/ /** @def KSIZE_PRI * Memory size default printf format (hex). */ /** @def KSIZE_PRI_U * Memory size unsigned decimal printf format. */ /** @def KSIZE_PRI_I * Memory size signed decimal printf format. */ /** @def KSIZE_PRI_X * Memory size hexadecimal printf format. */ /** @def KSSIZE_PRI * Memory size default printf format (hex). */ /** @def KSSIZE_PRI_U * Memory size unsigned decimal printf format. */ /** @def KSSIZE_PRI_I * Memory size signed decimal printf format. */ /** @def KSSIZE_PRI_X * Memory size hexadecimal printf format. */ /** @typedef KIPTR * Signed integer type capable of containing a pointer value. */ /** @typedef KUPTR * Unsigned integer type capable of containing a pointer value. */ /** @def KIPTR_C * Signed pointer constant. * @param c The constant value. */ /** @def KUPTR_C * Unsigned pointer constant. * @param c The constant value. */ /** @def KIPTR_MAX * Signed pointer max constant.*/ /** @def KIPTR_MIN * Signed pointer min constant.*/ /** @def KUPTR_MAX * Unsigned pointer max constant.*/ /** @def KIPTR_PRI * Signed pointer printf format. */ /** @def KUPTR_PRI * Unsigned pointer printf format. */ #if K_ARCH_BITS == 32 /* ASSUMES int == long == 32-bit, short == 16-bit, char == 8-bit. */ # ifdef _MSC_VER typedef signed __int64 KI64; typedef unsigned __int64 KU64; #define KI64_PRI "I64d" #define KU64_PRI "I64u" #define KX64_PRI "I64x" # else typedef signed long long int KI64; typedef unsigned long long int KU64; #define KI64_PRI "lld" #define KU64_PRI "llu" #define KX64_PRI "llx" # endif typedef signed int KI32; typedef unsigned int KU32; typedef signed short int KI16; typedef unsigned short int KU16; typedef signed char KI8; typedef unsigned char KU8; #define KI64_C(c) (c ## LL) #define KU64_C(c) (c ## ULL) #define KI32_C(c) (c) #define KU32_C(c) (c ## U) #define KI16_C(c) (c) #define KU16_C(c) (c) #define KI8_C(c) (c) #define KU8_C(c) (c) #define KI32_PRI "d" #define KU32_PRI "u" #define KX32_PRI "x" #define KI16_PRI "d" #define KU16_PRI "u" #define KX16_PRI "x" #define KI8_PRI "d" #define KU8_PRI "u" #define KX8_PRI "x" typedef KI32 KSSIZE; #define KSSIZE(c) KI32_C(c) #define KSSIZE_MAX KI32_MAX #define KSSIZE_MIN KI32_MIN #define KSSIZE_PRI KX32_PRI typedef KU32 KSIZE; #define KSIZE_C(c) KU32_C(c) #define KSIZE_MAX KU32_MAX #define KSIZE_PRI KX32_PRI #define KSIZE_PRI_U KU32_PRI #define KSIZE_PRI_I KI32_PRI #define KSIZE_PRI_X KX32_PRI #define KIPTR_C(c) KI32_C(c) typedef KI32 KIPTR; #define KIPTR_MAX KI32_MAX #define KIPTR_MIN KI32_MIN #define KIPTR_PRI KX32_PRI typedef KU32 KUPTR; #define KUPTR_C(c) KU32_C(c) #define KUPTR_MAX KU32_MAX #define KUPTR_PRI KX32_PRI #elif K_ARCH_BITS == 64 # if K_OS == K_OS_WINDOWS # if _MSC_VER typedef signed __int64 KI64; typedef unsigned __int64 KU64; # define KI64_PRI "I64d" # define KU64_PRI "I64u" # define KX64_PRI "I64x" # else typedef signed long long int KI64; typedef unsigned long long int KU64; # define KI64_PRI "lld" # define KU64_PRI "llu" # define KX64_PRI "llx" # endif # define KI64_C(c) (c ## LL) # define KU64_C(c) (c ## ULL) # else typedef signed long int KI64; typedef unsigned long int KU64; # define KI64_C(c) (c ## L) # define KU64_C(c) (c ## UL) # define KI64_PRI "ld" # define KU64_PRI "lu" # define KX64_PRI "lx" # endif typedef signed int KI32; typedef unsigned int KU32; typedef signed short KI16; typedef unsigned short KU16; typedef signed char KI8; typedef unsigned char KU8; #define KI32_C(c) (c) #define KU32_C(c) (c ## U) #define KI16_C(c) (c) #define KU16_C(c) (c) #define KI8_C(c) (c) #define KU8_C(c) (c) #define KI32_PRI "d" #define KU32_PRI "u" #define KX32_PRI "x" #define KI16_PRI "d" #define KU16_PRI "u" #define KX16_PRI "x" #define KI8_PRI "d" #define KU8_PRI "u" #define KX8_PRI "x" typedef KI64 KSSIZE; #define KSSIZE(c) KI64_C(c) #define KSSIZE_MAX KI64_MAX #define KSSIZE_MIN KI64_MIN #define KSSIZE_PRI KX64_PRI #define KSSIZE_PRI_U KU64_PRI #define KSSIZE_PRI_I KI64_PRI #define KSSIZE_PRI_X KX64_PRI typedef KU64 KSIZE; #define KSIZE_C(c) KU64_C(c) #define KSIZE_MAX KU64_MAX #define KSIZE_PRI_U KU64_PRI #define KSIZE_PRI_I KI64_PRI #define KSIZE_PRI_X KX64_PRI #define KSIZE_PRI KX64_PRI typedef KI64 KIPTR; #define KIPTR_C(c) KI64_C(c) #define KIPTR_MAX KI64_MAX #define KIPTR_MIN KI64_MIN #define KIPTR_PRI KX64_PRI typedef KU64 KUPTR; #define KUPTR_C(c) KU64_C(c) #define KUPTR_MAX KU64_MAX #define KUPTR_PRI KX64_PRI #else # error "Port Me" #endif /** Min KI8 value. */ #define KI8_MIN (KI8_C(-0x7f) - 1) /** Min KI16 value. */ #define KI16_MIN (KI16_C(-0x7fff) - 1) /** Min KI32 value. */ #define KI32_MIN (KI32_C(-0x7fffffff) - 1) /** Min KI64 value. */ #define KI64_MIN (KI64_C(-0x7fffffffffffffff) - 1) /** Max KI8 value. */ #define KI8_MAX KI8_C(0x7f) /** Max KI16 value. */ #define KI16_MAX KI16_C(0x7fff) /** Max KI32 value. */ #define KI32_MAX KI32_C(0x7fffffff) /** Max KI64 value. */ #define KI64_MAX KI64_C(0x7fffffffffffffff) /** Max KU8 value. */ #define KU8_MAX KU8_C(0xff) /** Max KU16 value. */ #define KU16_MAX KU16_C(0xffff) /** Max KU32 value. */ #define KU32_MAX KU32_C(0xffffffff) /** Max KU64 value. */ #define KU64_MAX KU64_C(0xffffffffffffffff) /** File offset. */ typedef KI64 KFOFF; /** Pointer a file offset. */ typedef KFOFF *PFOFF; /** Pointer a const file offset. */ typedef KFOFF *PCFOFF; /** The min value for the KFOFF type. */ #define KFOFF_MIN KI64_MIN /** The max value for the KFOFF type. */ #define KFOFF_MAX KI64_MAX /** File offset contstant. * @param c The constant value. */ #define KFOFF_C(c) KI64_C(c) /** File offset printf format. */ #define KFOFF_PRI KI64_PRI /** * Memory Protection. */ typedef enum KPROT { /** The usual invalid 0. */ KPROT_INVALID = 0, /** No access (page not present). */ KPROT_NOACCESS, /** Read only. */ KPROT_READONLY, /** Read & write. */ KPROT_READWRITE, /** Read & copy on write. */ KPROT_WRITECOPY, /** Execute only. */ KPROT_EXECUTE, /** Execute & read. */ KPROT_EXECUTE_READ, /** Execute, read & write. */ KPROT_EXECUTE_READWRITE, /** Execute, read & copy on write. */ KPROT_EXECUTE_WRITECOPY, /** The usual end value. (exclusive) */ KPROT_END, /** Blow the type up to 32-bits. */ KPROT_32BIT_HACK = 0x7fffffff } KPROT; /** Pointer to a memory protection enum. */ typedef KPROT *PKPROT; /** Pointer to a const memory protection enum. */ typedef KPROT const *PCKPROT; /** Boolean. * This can be used as a tri-state type, but then you *must* do == checks. */ typedef KI8 KBOOL; /** Pointer to a boolean value. */ typedef KBOOL *PKBOOL; /** Pointer to a const boolean value. */ typedef KBOOL const *PCKBOOL; /** Maxium value the KBOOL type can hold (officially). */ #define KBOOL_MIN KI8_C(-1) /** Maxium value the KBOOL type can hold (officially). */ #define KBOOL_MAX KI8_C(1) /** The KBOOL printf format. */ #define KBOOL_PRI KU8_PRI /** Boolean true constant. */ #define K_TRUE KI8_C(1) /** Boolean false constant. */ #define K_FALSE KI8_C(0) /** Boolean unknown constant (the third state). */ #define K_UNKNOWN KI8_C(-1) /** * Integer union. */ typedef union KUINT { KFOFF iBig; /**< The biggest member. */ KBOOL fBool; /**< Boolean. */ KU8 b; /**< unsigned 8-bit. */ KU8 u8; /**< unsigned 8-bit. */ KI8 i8; /**< signed 8-bit. */ KU16 u16; /**< unsigned 16-bit. */ KI16 i16; /**< signed 16-bit. */ KU32 u32; /**< unsigned 32-bit. */ KI32 i32; /**< signed 32-bit. */ KU64 u64; /**< unsigned 64-bit. */ KI64 i64; /**< signed 64-bit. */ KSIZE cbUnsign; /**< unsigned size. */ KSSIZE cbSign; /**< signed size. */ KFOFF offFile; /**< file offset. */ KUPTR uPtr; /**< unsigned pointer. */ KIPTR iPtr; /**< signed pointer. */ void *pv; /**< void pointer. */ char ch; /**< char. */ unsigned char uch; /**< unsigned char. */ signed char chSigned; /**< signed char. */ unsigned short uShort; /**< Unsigned short. */ signed short iShort; /**< Signed short. */ unsigned int uInt; /**< Unsigned int. */ signed int iInt; /**< Signed int. */ unsigned long uLong; /**< Unsigned long. */ signed long iLong; /**< Signed long. */ } KUINT; /** * Integer pointer union. */ typedef union KPUINT { KFOFF *piBig; /**< The biggest member. */ KBOOL *pfBool; /**< Boolean. */ KU8 *pb; /**< unsigned 8-bit. */ KU8 *pu8; /**< unsigned 8-bit. */ KI8 *pi8; /**< signed 8-bit. */ KU16 *pu16; /**< unsigned 16-bit. */ KI16 *pi16; /**< signed 16-bit. */ KU32 *pu32; /**< unsigned 32-bit. */ KI32 *pi32; /**< signed 32-bit. */ KU64 *pu64; /**< unsigned 64-bit. */ KI64 *pi64; /**< signed 64-bit. */ KSIZE *pcbUnsign; /**< unsigned size. */ KSSIZE *pcbSign; /**< signed size. */ KFOFF *poffFile; /**< file offset. */ KUPTR *puPtr; /**< unsigned pointer. */ KIPTR *piPtr; /**< signed pointer. */ void **ppv; /**< void pointer pointer. */ void *pv; /**< void pointer. */ char *pch; /**< char. */ char *psz; /**< zero terminated string. */ unsigned char *puch; /**< unsigned char. */ signed char *pchSigned; /**< signed char. */ unsigned short *puShort; /**< Unsigned short. */ signed short *piShort; /**< Signed short. */ unsigned int *puInt; /**< Unsigned int. */ signed int *piInt; /**< Signed int. */ unsigned long *puLong; /**< Unsigned long. */ signed long *piLong; /**< Signed long. */ } KPUINT; /** * Integer const pointer union. */ typedef union KPCUINT { KFOFF const *piBig; /**< The biggest member. */ KBOOL const *pfBool; /**< Boolean. */ KU8 const *pb; /**< byte. */ KU8 const *pu8; /**< unsigned 8-bit. */ KI8 const *pi8; /**< signed 8-bit. */ KU16 const *pu16; /**< unsigned 16-bit. */ KI16 const *pi16; /**< signed 16-bit. */ KU32 const *pu32; /**< unsigned 32-bit. */ KI32 const *pi32; /**< signed 32-bit. */ KU64 const *pu64; /**< unsigned 64-bit. */ KI64 const *pi64; /**< signed 64-bit. */ KSIZE const *pcbUnsign; /**< unsigned size. */ KSSIZE const *pcbSign; /**< signed size. */ KFOFF const *poffFile; /**< file offset. */ KUPTR const *puPtr; /**< unsigned pointer. */ KIPTR const *piPtr; /**< signed pointer. */ void const **ppv; /**< void pointer pointer. */ void const *pv; /**< void pointer. */ char const *pch; /**< char. */ char const *psz; /**< zero terminated string. */ unsigned char const *puch; /**< unsigned char. */ signed char const *pchSigned; /**< signed char. */ unsigned short const *puShort; /**< Unsigned short. */ signed short const *piShort; /**< Signed short. */ unsigned int const *puInt; /**< Unsigned int. */ signed int const *piInt; /**< Signed int. */ unsigned long const *puLong; /**< Unsigned long. */ signed long const *piLong; /**< Signed long. */ } KPCUINT; /** @name Forward Declarations / Handle Types. * @{ */ /** Pointer to a file provider instance. */ typedef struct KRDR *PKRDR; /** Pointer to a file provider instance pointer. */ typedef struct KRDR **PPKRDR; /** Pointer to a loader segment. */ typedef struct KLDRSEG *PKLDRSEG; /** Pointer to a loader segment. */ typedef const struct KLDRSEG *PCKLDRSEG; /** @} */ /** @} */ #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kHlpSys.h������������������������������������������������������0000664�0001750�0001750�00000004565�14670377513�021157� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpSys.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpSys - System Call Prototypes. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpSys_h___ #define ___k_kHlpSys_h___ #include <k/kHlpDefs.h> #include <k/kTypes.h> /** @defgroup grp_kHlpSys kHlpSys - System Call Prototypes * @addtogroup grp_kHlp * @{*/ #ifdef __cplusplus extern "C" { #endif /* common unix stuff. */ #if K_OS == K_OS_DARWIN \ || K_OS == K_OS_FREEBSD \ || K_OS == K_OS_LINUX \ || K_OS == K_OS_NETBSD \ || K_OS == K_OS_OPENBSD \ || K_OS == K_OS_SOLARIS KSSIZE kHlpSys_readlink(const char *pszPath, char *pszBuf, KSIZE cbBuf); int kHlpSys_open(const char *filename, int flags, int mode); int kHlpSys_close(int fd); KFOFF kHlpSys_lseek(int fd, int whench, KFOFF off); KSSIZE kHlpSys_read(int fd, void *pvBuf, KSIZE cbBuf); KSSIZE kHlpSys_write(int fd, const void *pvBuf, KSIZE cbBuf); void *kHlpSys_mmap(void *addr, KSIZE len, int prot, int flags, int fd, KI64 off); int kHlpSys_mprotect(void *addr, KSIZE len, int prot); int kHlpSys_munmap(void *addr, KSIZE len); void kHlpSys_exit(int rc); #endif /* specific */ #if K_OS == K_OS_DARWIN #elif K_OS == K_OS_LINUX #endif #ifdef __cplusplus } #endif /** @} */ #endif �������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kHlpAlloc.h����������������������������������������������������0000664�0001750�0001750�00000004557�14670377513�021434� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpAlloc.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpAlloc - Memory Allocation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpAlloc_h___ #define ___k_kHlpAlloc_h___ #include <k/kHlpDefs.h> #include <k/kTypes.h> /** @defgroup grp_kHlpAlloc kHlpAlloc - Memory Allocation * @addtogroup grp_kHlp * @{*/ /** @def kHlpAllocA * The alloca() wrapper. */ #ifdef __GNUC__ # define kHlpAllocA(a) __builtin_alloca(a) #elif defined(_MSC_VER) # include <malloc.h> # define kHlpAllocA(a) alloca(a) #else # error "Port Me." #endif #ifdef __cplusplus extern "C" { #endif KHLP_DECL(void *) kHlpAlloc(KSIZE cb); KHLP_DECL(void *) kHlpAllocZ(KSIZE cb); KHLP_DECL(void *) kHlpDup(const void *pv, KSIZE cb); KHLP_DECL(char *) kHlpStrDup(const char *psz); KHLP_DECL(void *) kHlpRealloc(void *pv, KSIZE cb); KHLP_DECL(void) kHlpFree(void *pv); KHLP_DECL(int) kHlpPageAlloc(void **ppv, KSIZE cb, KPROT enmProt, KBOOL fFixed); KHLP_DECL(int) kHlpPageProtect(void *pv, KSIZE cb, KPROT enmProt); KHLP_DECL(int) kHlpPageFree(void *pv, KSIZE cb); KHLP_DECL(int) kHlpHeapInit(void); KHLP_DECL(void) kHlpHeapTerm(void); KHLP_DECL(void) kHlpHeapDonate(void *pv, KSIZE cb); #ifdef __cplusplus } #endif /** @} */ #endif �������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kDbgBase.h�����������������������������������������������������0000664�0001750�0001750�00000021221�14670377513�021210� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kDbgBase.h 40 2010-02-02 16:02:15Z bird $ */ /** @file * kDbg - The Debug Info Reader, Base Definitions and Typedefs. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kDbgBase_h___ #define ___kDbgBase_h___ #include <k/kDefs.h> #include <k/kTypes.h> /** @defgroup grp_kDbgBase kDbgBase - Base Definitions And Typedefs * @{ */ /* * kDbg depend on size_t, [u]intNN_t, [u]intptr_t and some related constants. * If KDBG_ALREADY_INCLUDED_STD_TYPES or KCOMMON_ALREADY_INCLUDED_STD_TYPES * is defined, these has already been defined. */ #if !defined(KDBG_ALREADY_INCLUDED_STD_TYPES) && !defined(KCOMMON_ALREADY_INCLUDED_STD_TYPES) # define KCOMMON_ALREADY_INCLUDED_STD_TYPES 1 # include <sys/types.h> # include <stddef.h> # ifdef _MSC_VER typedef signed char int8_t; typedef unsigned char uint8_t; typedef signed short int16_t; typedef unsigned short uint16_t; typedef signed int int32_t; typedef unsigned int uint32_t; typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; typedef int64_t intmax_t; typedef uint64_t uintmax_t; # define UINT8_C(c) (c) # define UINT16_C(c) (c) # define UINT32_C(c) (c ## U) # define UINT64_C(c) (c ## ULL) # define INT8_C(c) (c) # define INT16_C(c) (c) # define INT32_C(c) (c) # define INT64_C(c) (c ## LL) # define INT8_MIN (INT8_C(-0x7f) - 1) # define INT16_MIN (INT16_C(-0x7fff) - 1) # define INT32_MIN (INT32_C(-0x7fffffff) - 1) # define INT64_MIN (INT64_C(-0x7fffffffffffffff) - 1) # define INT8_MAX INT8_C(0x7f) # define INT16_MAX INT16_C(0x7fff) # define INT32_MAX INT32_C(0x7fffffff) # define INT64_MAX INT64_C(0x7fffffffffffffff) # define UINT8_MAX UINT8_C(0xff) # define UINT16_MAX UINT16_C(0xffff) # define UINT32_MAX UINT32_C(0xffffffff) # define UINT64_MAX UINT64_C(0xffffffffffffffff) # else # include <stdint.h> # endif #endif /* !KDBG_ALREADY_INCLUDED_STD_TYPES && !KCOMMON_ALREADY_INCLUDED_STD_TYPES */ /** @def KDBG_CALL * The calling convention used by the kDbg functions. */ #if defined(_MSC_VER) || defined(__OS2__) # define KDBG_CALL __cdecl #else # define KDBG_CALL #endif #ifdef DOXYGEN_RUNNING /** @def KDBG_BUILDING * Define KDBG_BUILDING to indicate that kDbg is being built. */ # define KDBG_BUILDING /** @def KDBG_RESIDES_IN_DLL * Define KDBG_RESIDES_IN_DLL to indicate that kDbg resides in a DLL. */ # define KDBG_RESIDES_IN_DLL #endif /** @def KDBG_DECL * Macro for defining public functions. */ #if defined(KDBG_RESIDES_IN_DLL) \ && (defined(_MSC_VER) || defined(__OS2__)) # ifdef KDBG_BUILDING # define KDBG_DECL(type) __declspec(dllexport) type # else # define KDBG_DECL(type) __declspec(dllimport) type # endif #else # define KDBG_DECL(type) type #endif /** @def KDBG_INLINE * Macro for defining an inline function. */ #ifdef __cplusplus # if defined(__GNUC__) # define KDBG_INLINE(type) static inline type # else # define KDBG_INLINE(type) inline type # endif #else # if defined(__GNUC__) # define KDBG_INLINE(type) static __inline__ type # elif defined(_MSC_VER) # define KDBG_INLINE(type) _inline type # else # error "Port me" # endif #endif /** The kDbg address type. */ typedef uint64_t KDBGADDR; /** Pointer to a kLdr address. */ typedef KDBGADDR *PKDBGADDR; /** Pointer to a const kLdr address. */ typedef const KDBGADDR *PCKDBGADDR; /** NIL address. */ #define NIL_KDBGADDR (~(uint64_t)0) /** @def PRI_KDBGADDR * printf format type. */ #ifdef _MSC_VER # define PRI_KDBGADDR "I64x" #else # define PRI_KDBGADDR "llx" #endif /** Get the minimum of two values. */ #define KDBG_MIN(a, b) ((a) <= (b) ? (a) : (b)) /** Get the maximum of two values. */ #define KDBG_MAX(a, b) ((a) >= (b) ? (a) : (b)) /** Calculate the offset of a structure member. */ #define KDBG_OFFSETOF(strct, memb) ( (size_t)( &((strct *)0)->memb ) ) /** Align a size_t value. */ #define KDBG_ALIGN_Z(val, align) ( ((val) + ((align) - 1)) & ~(size_t)((align) - 1) ) /** Align a void * value. */ #define KDBG_ALIGN_P(pv, align) ( (void *)( ((uintptr_t)(pv) + ((align) - 1)) & ~(uintptr_t)((align) - 1) ) ) /** Align a size_t value. */ #define KDBG_ALIGN_ADDR(val, align) ( ((val) + ((align) - 1)) & ~(KDBGADDR)((align) - 1) ) /** Number of elements in an array. */ #define KDBG_ELEMENTS(a) ( sizeof(a) / sizeof((a)[0]) ) /** @def KDBG_VALID_PTR * Checks if the specified pointer is a valid address or not. */ #define KDBG_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U ) /** @def KDBG_LITTLE_ENDIAN * The kDbg build is for a little endian target. */ /** @def KDBG_BIG_ENDIAN * The kDbg build is for a big endian target. */ #if !defined(KDBG_LITTLE_ENDIAN) && !defined(KDBG_BIG_ENDIAN) # define KDBG_LITTLE_ENDIAN #endif #ifdef DOXYGEN_RUNNING # define KDBG_BIG_ENDIAN #endif /** @name Endian Conversion * @{ */ /** @def KDBG_E2E_U16 * Convert the endian of an unsigned 16-bit value. */ # define KDBG_E2E_U16(u16) ( (uint16_t) (((u16) >> 8) | ((u16) << 8)) ) /** @def KDBG_E2E_U32 * Convert the endian of an unsigned 32-bit value. */ # define KDBG_E2E_U32(u32) ( ( ((u32) & UINT32_C(0xff000000)) >> 24 ) \ | ( ((u32) & UINT32_C(0x00ff0000)) >> 8 ) \ | ( ((u32) & UINT32_C(0x0000ff00)) << 8 ) \ | ( ((u32) & UINT32_C(0x000000ff)) << 24 ) \ ) /** @def KDBG_E2E_U64 * Convert the endian of an unsigned 64-bit value. */ # define KDBG_E2E_U64(u64) ( ( ((u64) & UINT64_C(0xff00000000000000)) >> 56 ) \ | ( ((u64) & UINT64_C(0x00ff000000000000)) >> 40 ) \ | ( ((u64) & UINT64_C(0x0000ff0000000000)) >> 24 ) \ | ( ((u64) & UINT64_C(0x000000ff00000000)) >> 8 ) \ | ( ((u64) & UINT64_C(0x00000000ff000000)) << 8 ) \ | ( ((u64) & UINT64_C(0x0000000000ff0000)) << 24 ) \ | ( ((u64) & UINT64_C(0x000000000000ff00)) << 40 ) \ | ( ((u64) & UINT64_C(0x00000000000000ff)) << 56 ) \ ) /** @def KDBG_LE2H_U16 * Unsigned 16-bit little-endian to host endian. */ /** @def KDBG_LE2H_U32 * Unsigned 32-bit little-endian to host endian. */ /** @def KDBG_LE2H_U64 * Unsigned 64-bit little-endian to host endian. */ /** @def KDBG_BE2H_U16 * Unsigned 16-bit big-endian to host endian. */ /** @def KDBG_BE2H_U32 * Unsigned 32-bit big-endian to host endian. */ /** @def KDBG_BE2H_U64 * Unsigned 64-bit big-endian to host endian. */ #ifdef KDBG_LITTLE_ENDIAN # define KDBG_LE2H_U16(u16) ((uint16_t)(u16)) # define KDBG_LE2H_U32(u32) ((uint32_t)(u32)) # define KDBG_LE2H_U64(u64) ((uint32_t)(u32)) # define KDBG_BE2H_U16(u16) KDBG_E2E_U16(u16) # define KDBG_BE2H_U32(u32) KDBG_E2E_U32(u32) # define KDBG_BE2H_U64(u64) KDBG_E2E_U64(u64) #elif defined(KDBG_BIG_ENDIAN) # define KDBG_LE2H_U16(u16) KDBG_E2E_U16(u16) # define KDBG_LE2H_U32(u32) KDBG_E2E_U32(u32) # define KDBG_LE2H_U32(u64) KDBG_E2E_U64(u64) # define KDBG_BE2H_U16(u16) ((uint16_t)(u16)) # define KDBG_BE2H_U32(u32) ((uint32_t)(u32)) # define KDBG_BE2H_U64(u64) ((uint32_t)(u32)) #else # error "KDBG_BIG_ENDIAN or KDBG_LITTLE_ENDIAN is supposed to be defined." #endif /** @} */ /** @} */ #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kRdrAll.h������������������������������������������������������0000664�0001750�0001750�00000010175�14670377513�021107� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kRdrAll.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kRdr - The File Provider, All Details and Dependencies Included. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kRdrAll_h___ #define ___k_kRdrAll_h___ #include <k/kDefs.h> #include <k/kLdr.h> #include <k/kRdr.h> #ifdef __cplusplus extern "C" { #endif /** @defgroup grp_kRdrAll All * @addtogroup grp_kRdr * @{ */ /** * File provider instance operations. */ typedef struct KRDROPS { /** The name of this file provider. */ const char *pszName; /** Pointer to the next file provider. */ const struct KRDROPS *pNext; /** Try create a new file provider instance. * * @returns 0 on success, OS specific error code on failure. * @param ppRdr Where to store the file provider instance. * @param pszFilename The filename to open. */ int (* pfnCreate)( PPKRDR ppRdr, const char *pszFilename); /** Destroy the file provider instance. * * @returns 0 on success, OS specific error code on failure. * On failure, the file provider instance will be in an indeterminate state - don't touch it! * @param pRdr The file provider instance. */ int (* pfnDestroy)( PKRDR pRdr); /** @copydoc kRdrRead */ int (* pfnRead)( PKRDR pRdr, void *pvBuf, KSIZE cb, KFOFF off); /** @copydoc kRdrAllMap */ int (* pfnAllMap)( PKRDR pRdr, const void **ppvBits); /** @copydoc kRdrAllUnmap */ int (* pfnAllUnmap)(PKRDR pRdr, const void *pvBits); /** @copydoc kRdrSize */ KFOFF (* pfnSize)( PKRDR pRdr); /** @copydoc kRdrTell */ KFOFF (* pfnTell)( PKRDR pRdr); /** @copydoc kRdrName */ const char * (* pfnName)(PKRDR pRdr); /** @copydoc kRdrNativeFH */ KIPTR (* pfnNativeFH)(PKRDR pRdr); /** @copydoc kRdrPageSize */ KSIZE (* pfnPageSize)(PKRDR pRdr); /** @copydoc kRdrMap */ int (* pfnMap)( PKRDR pRdr, void **ppvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed); /** @copydoc kRdrRefresh */ int (* pfnRefresh)( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments); /** @copydoc kRdrProtect */ int (* pfnProtect)( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect); /** @copydoc kRdrUnmap */ int (* pfnUnmap)( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments); /** @copydoc kRdrDone */ void (* pfnDone)( PKRDR pRdr); /** The usual non-zero dummy that makes sure we've initialized all members. */ KU32 u32Dummy; } KRDROPS; /** Pointer to file provider operations. */ typedef KRDROPS *PKRDROPS; /** Pointer to const file provider operations. */ typedef const KRDROPS *PCKRDROPS; /** * File provider instance core. */ typedef struct KRDR { /** Magic number (KRDR_MAGIC). */ KU32 u32Magic; /** Pointer to the file provider operations. */ PCKRDROPS pOps; } KRDR; void kRdrAddProvider(PKRDROPS pAdd); /** @} */ #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kLdrFmts/������������������������������������������������������0000775�0001750�0001750�00000000000�14670377513�021125� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kLdrFmts/pe.h��������������������������������������������������0000664�0001750�0001750�00000043231�14670377513�021705� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: pe.h 92 2016-09-08 15:31:37Z bird $ */ /** @file * PE structures, types and defines. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kLdrFmts_pe_h___ #define ___k_kLdrFmts_pe_h___ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kTypes.h> #include <k/kDefs.h> /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ #ifndef IMAGE_NT_SIGNATURE # define IMAGE_NT_SIGNATURE K_LE2H_U32('P' | ('E' << 8)) #endif /* file header */ #define IMAGE_FILE_MACHINE_UNKNOWN 0x0000 #define IMAGE_FILE_MACHINE_I386 0x014c #define IMAGE_FILE_MACHINE_AMD64 0x8664 #define IMAGE_FILE_MACHINE_ARM 0x01c0 #define IMAGE_FILE_MACHINE_ARMNT 0x01c4 #define IMAGE_FILE_MACHINE_ARM64 0xaa64 #define IMAGE_FILE_MACHINE_EBC 0x0ebc #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 #define IMAGE_FILE_16BIT_MACHINE 0x0040 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 #define IMAGE_FILE_32BIT_MACHINE 0x0100 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800 #define IMAGE_FILE_SYSTEM 0x1000 #define IMAGE_FILE_DLL 0x2000 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 /** Raw UUID byte for the ANON_OBJECT_HEADER_BIGOBJ::ClassID value. * These make out {d1baa1c7-baee-4ba9-af20-faf66aa4dcb8}. */ #define ANON_OBJECT_HEADER_BIGOBJ_CLS_ID_BYTES \ 0xc7, 0xa1, 0xba, 0xd1,/*-*/ 0xee, 0xba,/*-*/ 0xa9, 0x4b,/*-*/ 0xaf, 0x20,/*-*/ 0xfa, 0xf6, 0x6a, 0xa4, 0xdc, 0xb8 /* optional header */ #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10B #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20B #define IMAGE_SUBSYSTEM_UNKNOWN 0x0 #define IMAGE_SUBSYSTEM_NATIVE 0x1 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 0x2 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 0x3 #define IMAGE_SUBSYSTEM_OS2_GUI 0x4 #define IMAGE_SUBSYSTEM_OS2_CUI 0x5 #define IMAGE_SUBSYSTEM_POSIX_CUI 0x7 #define IMAGE_LIBRARY_PROCESS_INIT 0x0001 #define IMAGE_LIBRARY_PROCESS_TERM 0x0002 #define IMAGE_LIBRARY_THREAD_INIT 0x0004 #define IMAGE_LIBRARY_THREAD_TERM 0x0008 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 0x10 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0x0 #define IMAGE_DIRECTORY_ENTRY_IMPORT 0x1 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 0x2 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 0x3 #define IMAGE_DIRECTORY_ENTRY_SECURITY 0x4 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 0x5 #define IMAGE_DIRECTORY_ENTRY_DEBUG 0x6 #define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 0x7 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT IMAGE_DIRECTORY_ENTRY_ARCHITECTURE #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 0x8 #define IMAGE_DIRECTORY_ENTRY_TLS 0x9 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 0xa #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 0xb #define IMAGE_DIRECTORY_ENTRY_IAT 0xc #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 0xd #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 0xe /* section header */ #define IMAGE_SIZEOF_SHORT_NAME 0x8 #define IMAGE_SCN_TYPE_REG 0x00000000 #define IMAGE_SCN_TYPE_DSECT 0x00000001 #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 #define IMAGE_SCN_TYPE_GROUP 0x00000004 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 #define IMAGE_SCN_TYPE_COPY 0x00000010 #define IMAGE_SCN_CNT_CODE 0x00000020 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 #define IMAGE_SCN_LNK_OTHER 0x00000100 #define IMAGE_SCN_LNK_INFO 0x00000200 #define IMAGE_SCN_TYPE_OVER 0x00000400 #define IMAGE_SCN_LNK_REMOVE 0x00000800 #define IMAGE_SCN_LNK_COMDAT 0x00001000 #define IMAGE_SCN_MEM_PROTECTED 0x00004000 #define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000 #define IMAGE_SCN_GPREL 0x00008000 #define IMAGE_SCN_MEM_FARDATA 0x00008000 #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000 #define IMAGE_SCN_MEM_16BIT 0x00020000 #define IMAGE_SCN_MEM_LOCKED 0x00040000 #define IMAGE_SCN_MEM_PRELOAD 0x00080000 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000 #define IMAGE_SCN_ALIGN_MASK 0x00F00000 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 #define IMAGE_SCN_MEM_SHARED 0x10000000 #define IMAGE_SCN_MEM_EXECUTE 0x20000000 #define IMAGE_SCN_MEM_READ 0x40000000 #define IMAGE_SCN_MEM_WRITE 0x80000000 /* relocations */ #define IMAGE_REL_BASED_ABSOLUTE 0x0 #define IMAGE_REL_BASED_HIGH 0x1 #define IMAGE_REL_BASED_LOW 0x2 #define IMAGE_REL_BASED_HIGHLOW 0x3 #define IMAGE_REL_BASED_HIGHADJ 0x4 #define IMAGE_REL_BASED_MIPS_JMPADDR 0x5 #define IMAGE_REL_BASED_SECTION 0x6 #define IMAGE_REL_BASED_REL32 0x7 /*#define IMAGE_REL_BASED_RESERVED1 0x8 */ #define IMAGE_REL_BASED_MIPS_JMPADDR16 0x9 #define IMAGE_REL_BASED_IA64_IMM64 0x9 #define IMAGE_REL_BASED_DIR64 0xa #define IMAGE_REL_BASED_HIGH3ADJ 0xb /* imports */ #define IMAGE_ORDINAL_FLAG32 0x80000000 #define IMAGE_ORDINAL32(ord) ((ord) & 0xffff) #define IMAGE_SNAP_BY_ORDINAL32(ord) (!!((ord) & IMAGE_ORDINAL_FLAG32)) #define IMAGE_ORDINAL_FLAG64 0x8000000000000000ULL #define IMAGE_ORDINAL64(ord) ((ord) & 0xffff) #define IMAGE_SNAP_BY_ORDINAL64(ord) (!!((ord) & IMAGE_ORDINAL_FLAG64)) /* dll/tls entry points argument */ #define DLL_PROCESS_DETACH 0 #define DLL_PROCESS_ATTACH 1 #define DLL_THREAD_ATTACH 2 #define DLL_THREAD_DETACH 3 /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ #pragma pack(4) typedef struct _IMAGE_FILE_HEADER { KU16 Machine; KU16 NumberOfSections; KU32 TimeDateStamp; KU32 PointerToSymbolTable; KU32 NumberOfSymbols; KU16 SizeOfOptionalHeader; KU16 Characteristics; } IMAGE_FILE_HEADER; typedef IMAGE_FILE_HEADER *PIMAGE_FILE_HEADER; typedef struct _ANON_OBJECT_HEADER { KU16 Sig1; KU16 Sig2; KU16 Version; /**< >= 1 */ KU16 Machine; KU32 TimeDataStamp; KU8 ClassID[16]; KU32 SizeOfData; } ANON_OBJECT_HEADER; typedef ANON_OBJECT_HEADER *PANON_OBJECT_HEADER; typedef struct _ANON_OBJECT_HEADER_V2 { KU16 Sig1; KU16 Sig2; KU16 Version; /**< >= 2 */ KU16 Machine; KU32 TimeDataStamp; KU8 ClassID[16]; KU32 SizeOfData; /* New fields for Version >= 2: */ KU32 Flags; KU32 MetaDataSize; /**< CLR metadata */ KU32 MetaDataOffset; } ANON_OBJECT_HEADER_V2; typedef ANON_OBJECT_HEADER_V2 *PANON_OBJECT_HEADER_V2; typedef struct _ANON_OBJECT_HEADER_BIGOBJ { KU16 Sig1; KU16 Sig2; KU16 Version; /**< >= 2 */ KU16 Machine; KU32 TimeDataStamp; KU8 ClassID[16]; /**< ANON_OBJECT_HEADER_BIGOBJ_CLS_ID_BYTES */ KU32 SizeOfData; /* New fields for Version >= 2: */ KU32 Flags; KU32 MetaDataSize; /**< CLR metadata */ KU32 MetaDataOffset; /* Specific for bigobj: */ KU32 NumberOfSections; KU32 PointerToSymbolTable; KU32 NumberOfSymbols; } ANON_OBJECT_HEADER_BIGOBJ; typedef ANON_OBJECT_HEADER_BIGOBJ *PANON_OBJECT_HEADER_BIGOBJ; typedef struct _IMAGE_DATA_DIRECTORY { KU32 VirtualAddress; KU32 Size; } IMAGE_DATA_DIRECTORY; typedef IMAGE_DATA_DIRECTORY *PIMAGE_DATA_DIRECTORY; typedef struct _IMAGE_OPTIONAL_HEADER32 { KU16 Magic; KU8 MajorLinkerVersion; KU8 MinorLinkerVersion; KU32 SizeOfCode; KU32 SizeOfInitializedData; KU32 SizeOfUninitializedData; KU32 AddressOfEntryPoint; KU32 BaseOfCode; KU32 BaseOfData; KU32 ImageBase; KU32 SectionAlignment; KU32 FileAlignment; KU16 MajorOperatingSystemVersion; KU16 MinorOperatingSystemVersion; KU16 MajorImageVersion; KU16 MinorImageVersion; KU16 MajorSubsystemVersion; KU16 MinorSubsystemVersion; KU32 Win32VersionValue; KU32 SizeOfImage; KU32 SizeOfHeaders; KU32 CheckSum; KU16 Subsystem; KU16 DllCharacteristics; KU32 SizeOfStackReserve; KU32 SizeOfStackCommit; KU32 SizeOfHeapReserve; KU32 SizeOfHeapCommit; KU32 LoaderFlags; KU32 NumberOfRvaAndSizes; IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; } IMAGE_OPTIONAL_HEADER32; typedef IMAGE_OPTIONAL_HEADER32 *PIMAGE_OPTIONAL_HEADER32; typedef struct _IMAGE_OPTIONAL_HEADER64 { KU16 Magic; KU8 MajorLinkerVersion; KU8 MinorLinkerVersion; KU32 SizeOfCode; KU32 SizeOfInitializedData; KU32 SizeOfUninitializedData; KU32 AddressOfEntryPoint; KU32 BaseOfCode; KU64 ImageBase; KU32 SectionAlignment; KU32 FileAlignment; KU16 MajorOperatingSystemVersion; KU16 MinorOperatingSystemVersion; KU16 MajorImageVersion; KU16 MinorImageVersion; KU16 MajorSubsystemVersion; KU16 MinorSubsystemVersion; KU32 Win32VersionValue; KU32 SizeOfImage; KU32 SizeOfHeaders; KU32 CheckSum; KU16 Subsystem; KU16 DllCharacteristics; KU64 SizeOfStackReserve; KU64 SizeOfStackCommit; KU64 SizeOfHeapReserve; KU64 SizeOfHeapCommit; KU32 LoaderFlags; KU32 NumberOfRvaAndSizes; IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; } IMAGE_OPTIONAL_HEADER64; typedef IMAGE_OPTIONAL_HEADER64 *PIMAGE_OPTIONAL_HEADER64; typedef struct _IMAGE_NT_HEADERS { KU32 Signature; IMAGE_FILE_HEADER FileHeader; IMAGE_OPTIONAL_HEADER32 OptionalHeader; } IMAGE_NT_HEADERS32; typedef IMAGE_NT_HEADERS32 *PIMAGE_NT_HEADERS32; typedef struct _IMAGE_NT_HEADERS64 { KU32 Signature; IMAGE_FILE_HEADER FileHeader; IMAGE_OPTIONAL_HEADER64 OptionalHeader; } IMAGE_NT_HEADERS64; typedef IMAGE_NT_HEADERS64 *PIMAGE_NT_HEADERS64; typedef struct _IMAGE_SECTION_HEADER { KU8 Name[IMAGE_SIZEOF_SHORT_NAME]; union { KU32 PhysicalAddress; KU32 VirtualSize; } Misc; KU32 VirtualAddress; KU32 SizeOfRawData; KU32 PointerToRawData; KU32 PointerToRelocations; KU32 PointerToLinenumbers; KU16 NumberOfRelocations; KU16 NumberOfLinenumbers; KU32 Characteristics; } IMAGE_SECTION_HEADER; typedef IMAGE_SECTION_HEADER *PIMAGE_SECTION_HEADER; typedef struct _IMAGE_BASE_RELOCATION { KU32 VirtualAddress; KU32 SizeOfBlock; } IMAGE_BASE_RELOCATION; typedef IMAGE_BASE_RELOCATION *PIMAGE_BASE_RELOCATION; typedef struct _IMAGE_EXPORT_DIRECTORY { KU32 Characteristics; KU32 TimeDateStamp; KU16 MajorVersion; KU16 MinorVersion; KU32 Name; KU32 Base; KU32 NumberOfFunctions; KU32 NumberOfNames; KU32 AddressOfFunctions; KU32 AddressOfNames; KU32 AddressOfNameOrdinals; } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; typedef struct _IMAGE_IMPORT_DESCRIPTOR { union { KU32 Characteristics; KU32 OriginalFirstThunk; } u; KU32 TimeDateStamp; KU32 ForwarderChain; KU32 Name; KU32 FirstThunk; } IMAGE_IMPORT_DESCRIPTOR; typedef IMAGE_IMPORT_DESCRIPTOR *PIMAGE_IMPORT_DESCRIPTOR; typedef struct _IMAGE_IMPORT_BY_NAME { KU16 Hint; KU8 Name[1]; } IMAGE_IMPORT_BY_NAME; typedef IMAGE_IMPORT_BY_NAME *PIMAGE_IMPORT_BY_NAME; /* The image_thunk_data32/64 structures are not very helpful except for getting RSI. keep them around till all the code has been converted. */ typedef struct _IMAGE_THUNK_DATA64 { union { KU64 ForwarderString; KU64 Function; KU64 Ordinal; KU64 AddressOfData; } u1; } IMAGE_THUNK_DATA64; typedef IMAGE_THUNK_DATA64 *PIMAGE_THUNK_DATA64; typedef struct _IMAGE_THUNK_DATA32 { union { KU32 ForwarderString; KU32 Function; KU32 Ordinal; KU32 AddressOfData; } u1; } IMAGE_THUNK_DATA32; typedef IMAGE_THUNK_DATA32 *PIMAGE_THUNK_DATA32; typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32 { KU32 Size; KU32 TimeDateStamp; KU16 MajorVersion; KU16 MinorVersion; KU32 GlobalFlagsClear; KU32 GlobalFlagsSet; KU32 CriticalSectionDefaultTimeout; KU32 DeCommitFreeBlockThreshold; KU32 DeCommitTotalFreeThreshold; KU32 LockPrefixTable; KU32 MaximumAllocationSize; KU32 VirtualMemoryThreshold; KU32 ProcessHeapFlags; KU32 ProcessAffinityMask; KU16 CSDVersion; KU16 Reserved1; KU32 EditList; KU32 SecurityCookie; KU32 SEHandlerTable; KU32 SEHandlerCount; } IMAGE_LOAD_CONFIG_DIRECTORY32; typedef IMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY32; typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64 { KU32 Size; KU32 TimeDateStamp; KU16 MajorVersion; KU16 MinorVersion; KU32 GlobalFlagsClear; KU32 GlobalFlagsSet; KU32 CriticalSectionDefaultTimeout; KU64 DeCommitFreeBlockThreshold; KU64 DeCommitTotalFreeThreshold; KU64 LockPrefixTable; KU64 MaximumAllocationSize; KU64 VirtualMemoryThreshold; KU64 ProcessAffinityMask; KU32 ProcessHeapFlags; KU16 CSDVersion; KU16 Reserved1; KU64 EditList; KU64 SecurityCookie; KU64 SEHandlerTable; KU64 SEHandlerCount; } IMAGE_LOAD_CONFIG_DIRECTORY64; typedef IMAGE_LOAD_CONFIG_DIRECTORY64 *PIMAGE_LOAD_CONFIG_DIRECTORY64; typedef struct _IMAGE_DEBUG_DIRECTORY { KU32 Characteristics; KU32 TimeDateStamp; KU16 MajorVersion; KU16 MinorVersion; KU32 Type; KU32 SizeOfData; KU32 AddressOfRawData; KU32 PointerToRawData; } IMAGE_DEBUG_DIRECTORY; typedef IMAGE_DEBUG_DIRECTORY *PIMAGE_DEBUG_DIRECTORY; #define IMAGE_DEBUG_TYPE_UNKNOWN 0 #define IMAGE_DEBUG_TYPE_COFF 1 #define IMAGE_DEBUG_TYPE_CODEVIEW 2 /* 4.0 */ #define IMAGE_DEBUG_TYPE_FPO 3 /* FPO = frame pointer omission */ #define IMAGE_DEBUG_TYPE_MISC 4 #define IMAGE_DEBUG_TYPE_EXCEPTION 5 #define IMAGE_DEBUG_TYPE_FIXUP 6 #define IMAGE_DEBUG_TYPE_BORLAND 9 typedef struct _IMAGE_TLS_DIRECTORY32 { KU32 StartAddressOfRawData; KU32 EndAddressOfRawData; KU32 AddressOfIndex; KU32 AddressOfCallBacks; KU32 SizeOfZeroFill; KU32 Characteristics; } IMAGE_TLS_DIRECTORY32; typedef IMAGE_TLS_DIRECTORY32 *PIMAGE_TLS_DIRECTORY32; typedef struct _IMAGE_TLS_DIRECTORY64 { KU64 StartAddressOfRawData; KU64 EndAddressOfRawData; KU64 AddressOfIndex; KU64 AddressOfCallBacks; KU32 SizeOfZeroFill; KU32 Characteristics; } IMAGE_TLS_DIRECTORY64; typedef IMAGE_TLS_DIRECTORY64 *PIMAGE_TLS_DIRECTORY64; #pragma pack() #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kLdrFmts/mz.h��������������������������������������������������0000664�0001750�0001750�00000004042�14670377513�021724� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: mz.h 31 2009-07-01 21:08:06Z bird $ */ /** @file * MZ structures, types and defines. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kLdrFmts_mz_h___ #define ___k_kLdrFmts_mz_h___ #include <k/kDefs.h> #include <k/kTypes.h> #pragma pack(1) /* not required */ typedef struct _IMAGE_DOS_HEADER { KU16 e_magic; KU16 e_cblp; KU16 e_cp; KU16 e_crlc; KU16 e_cparhdr; KU16 e_minalloc; KU16 e_maxalloc; KU16 e_ss; KU16 e_sp; KU16 e_csum; KU16 e_ip; KU16 e_cs; KU16 e_lfarlc; KU16 e_ovno; KU16 e_res[4]; KU16 e_oemid; KU16 e_oeminfo; KU16 e_res2[10]; KU32 e_lfanew; } IMAGE_DOS_HEADER; typedef IMAGE_DOS_HEADER *PIMAGE_DOS_HEADER; #ifndef IMAGE_DOS_SIGNATURE # define IMAGE_DOS_SIGNATURE K_LE2H_U16('M' | ('Z' << 8)) #endif #pragma pack() #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kLdrFmts/lx.h��������������������������������������������������0000664�0001750�0001750�00000036101�14670377513�021722� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id $ */ /** @file * LX structures, types and defines. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kLdrFmts_lx_h___ #define ___k_kLdrFmts_lx_h___ #include <k/kDefs.h> #include <k/kTypes.h> #ifndef IMAGE_OS2_SIGNATURE_LX /** LX signature ("LX") */ # define IMAGE_LX_SIGNATURE K_LE2H_U16('L' | ('X' << 8)) #endif #pragma pack(1) /** * Linear eXecutable header. * This structure is exactly 196 bytes long. */ struct e32_exe { KU8 e32_magic[2]; KU8 e32_border; KU8 e32_worder; KU32 e32_level; KU16 e32_cpu; KU16 e32_os; KU32 e32_ver; KU32 e32_mflags; KU32 e32_mpages; KU32 e32_startobj; KU32 e32_eip; KU32 e32_stackobj; KU32 e32_esp; KU32 e32_pagesize; KU32 e32_pageshift; /** The size of the fixup section. * The fixup section consists of the fixup page table, the fixup record table, * the import module table, and the import procedure name table. */ KU32 e32_fixupsize; KU32 e32_fixupsum; /** The size of the resident loader section. * This includes the object table, the object page map table, the resource table, the resident name table, * the entry table, the module format directives table, and the page checksum table (?). */ KU32 e32_ldrsize; /** The checksum of the loader section. 0 if not calculated. */ KU32 e32_ldrsum; /** The offset of the object table relative to this structure. */ KU32 e32_objtab; /** Count of objects. */ KU32 e32_objcnt; /** The offset of the object page map table relative to this structure. */ KU32 e32_objmap; /** The offset of the object iterated pages (whatever this is used for) relative to the start of the file. */ KU32 e32_itermap; /** The offset of the resource table relative to this structure. */ KU32 e32_rsrctab; /** The number of entries in the resource table. */ KU32 e32_rsrccnt; /** The offset of the resident name table relative to this structure. */ KU32 e32_restab; /** The offset of the entry (export) table relative to this structure. */ KU32 e32_enttab; /** The offset of the module format directives table relative to this structure. */ KU32 e32_dirtab; /** The number of entries in the module format directives table. */ KU32 e32_dircnt; /** The offset of the fixup page table relative to this structure. */ KU32 e32_fpagetab; /** The offset of the fixup record table relative to this structure. */ KU32 e32_frectab; /** The offset of the import module name table relative to this structure. */ KU32 e32_impmod; /** The number of entries in the import module name table. */ KU32 e32_impmodcnt; /** The offset of the import procedure name table relative to this structure. */ KU32 e32_impproc; /** The offset of the page checksum table relative to this structure. */ KU32 e32_pagesum; /** The offset of the data pages relative to the start of the file. */ KU32 e32_datapage; /** The number of preload pages (ignored). */ KU32 e32_preload; /** The offset of the non-resident name table relative to the start of the file. */ KU32 e32_nrestab; /** The size of the non-resident name table. */ KU32 e32_cbnrestab; KU32 e32_nressum; KU32 e32_autodata; KU32 e32_debuginfo; KU32 e32_debuglen; KU32 e32_instpreload; KU32 e32_instdemand; KU32 e32_heapsize; KU32 e32_stacksize; KU8 e32_res3[20]; }; /** e32_magic[0] */ #define E32MAGIC1 'L' /** e32_magic[1] */ #define E32MAGIC2 'X' /** MAKEWORD(e32_magic[0], e32_magic[1]) */ #define E32MAGIC 0x584c /** e32_border - little endian */ #define E32LEBO 0 /** e32_border - big endian */ #define E32BEBO 1 /** e32_worder - little endian */ #define E32LEWO 0 /** e32_worder - big endian */ #define E32BEWO 1 /** e32_level */ #define E32LEVEL KU32_C(0) /** e32_cpu - 80286 */ #define E32CPU286 1 /** e32_cpu - 80386 */ #define E32CPU386 2 /** e32_cpu - 80486 */ #define E32CPU486 3 /** e32_pagesize */ #define OBJPAGELEN KU32_C(0x1000) /** @name e32_mflags * @{ */ /** App Type: Fullscreen only. */ #define E32NOPMW KU32_C(0x00000100) /** App Type: PM API. */ #define E32PMAPI KU32_C(0x00000300) /** App Type: PM VIO compatible. */ #define E32PMW KU32_C(0x00000200) /** Application type mask. */ #define E32APPMASK KU32_C(0x00000300) /** Executable module. */ #define E32MODEXE KU32_C(0x00000000) /** Dynamic link library (DLL / library) module. */ #define E32MODDLL KU32_C(0x00008000) /** Protected memory DLL. */ #define E32PROTDLL KU32_C(0x00010000) /** Physical Device Driver. */ #define E32MODPDEV KU32_C(0x00020000) /** Virtual Device Driver. */ #define E32MODVDEV KU32_C(0x00028000) /** Device driver */ #define E32DEVICE E32MODPDEV /** Dynamic link library (DLL / library) module. */ #define E32NOTP E32MODDLL /** Protected memory DLL. */ #define E32MODPROTDLL (E32MODDLL | E32PROTDLL) /** Module Type mask. */ #define E32MODMASK KU32_C(0x00038000) /** Not loadable (linker error). */ #define E32NOLOAD KU32_C(0x00002000) /** No internal fixups. */ #define E32NOINTFIX KU32_C(0x00000010) /** No external fixups (i.e. imports). */ #define E32NOEXTFIX KU32_C(0x00000020) /** System DLL, no internal fixups. */ #define E32SYSDLL KU32_C(0x00000008) /** Global (set) or per instance (cleared) library initialization. */ #define E32LIBINIT KU32_C(0x00000004) /** Global (set) or per instance (cleared) library termination. */ #define E32LIBTERM KU32_C(0x40000000) /** Indicates when set in an executable that the process isn't SMP safe. */ #define E32NOTMPSAFE KU32_C(0x00080000) /** @} */ /** @name Relocations (aka Fixups). * @{ */ typedef union _offset { KU16 offset16; KU32 offset32; } offset; /** A relocation. * @remark this structure isn't very usable since LX relocations comes in too many size variations. */ struct r32_rlc { KU8 nr_stype; KU8 nr_flags; KI16 r32_soff; KU16 r32_objmod; union targetid { offset intref; union extfixup { offset proc; KU32 ord; } extref; struct addfixup { KU16 entry; offset addval; } addfix; } r32_target; KU16 r32_srccount; KU16 r32_chain; }; /** @name Some attempt at size constanstants. * @{ */ #define RINTSIZE16 8 #define RINTSIZE32 10 #define RORDSIZE 8 #define RNAMSIZE16 8 #define RNAMSIZE32 10 #define RADDSIZE16 10 #define RADDSIZE32 12 /** @} */ /** @name nr_stype (source flags) * @{ */ #define NRSBYT 0x00 #define NRSSEG 0x02 #define NRSPTR 0x03 #define NRSOFF 0x05 #define NRPTR48 0x06 #define NROFF32 0x07 #define NRSOFF32 0x08 #define NRSTYP 0x0f #define NRSRCMASK 0x0f #define NRALIAS 0x10 #define NRCHAIN 0x20 /** @} */ /** @name nr_flags (target flags) * @{ */ #define NRRINT 0x00 #define NRRORD 0x01 #define NRRNAM 0x02 #define NRRENT 0x03 #define NRRTYP 0x03 #define NRADD 0x04 #define NRICHAIN 0x08 #define NR32BITOFF 0x10 #define NR32BITADD 0x20 #define NR16OBJMOD 0x40 #define NR8BITORD 0x80 /** @} */ /** @} */ /** @name The Object Table (aka segment table) * @{ */ /** The Object Table Entry. */ struct o32_obj { /** The size of the object. */ KU32 o32_size; /** The base address of the object. */ KU32 o32_base; /** Object flags. */ KU32 o32_flags; /** Page map index. */ KU32 o32_pagemap; /** Page map size. (doesn't need to be o32_size >> page shift). */ KU32 o32_mapsize; /** Reserved */ KU32 o32_reserved; }; /** @name o32_flags * @{ */ /** Read access. */ #define OBJREAD KU32_C(0x00000001) /** Write access. */ #define OBJWRITE KU32_C(0x00000002) /** Execute access. */ #define OBJEXEC KU32_C(0x00000004) /** Resource object. */ #define OBJRSRC KU32_C(0x00000008) /** The object is discarable (i.e. don't swap, just load in pages from the executable). * This overlaps a bit with object type. */ #define OBJDISCARD KU32_C(0x00000010) /** The object is shared. */ #define OBJSHARED KU32_C(0x00000020) /** The object has preload pages. */ #define OBJPRELOAD KU32_C(0x00000040) /** The object has invalid pages. */ #define OBJINVALID KU32_C(0x00000080) /** Non-permanent, link386 bug. */ #define LNKNONPERM KU32_C(0x00000600) /** Non-permanent, correct 'value'. */ #define OBJNONPERM KU32_C(0x00000000) /** Obj Type: The object is permanent and swappable. */ #define OBJPERM KU32_C(0x00000100) /** Obj Type: The object is permanent and resident (i.e. not swappable). */ #define OBJRESIDENT KU32_C(0x00000200) /** Obj Type: The object is resident and contigious. */ #define OBJCONTIG KU32_C(0x00000300) /** Obj Type: The object is permanent and long locable. */ #define OBJDYNAMIC KU32_C(0x00000400) /** Object type mask. */ #define OBJTYPEMASK KU32_C(0x00000700) /** x86: The object require an 16:16 alias. */ #define OBJALIAS16 KU32_C(0x00001000) /** x86: Big/Default selector setting, i.e. toggle 32-bit or 16-bit. */ #define OBJBIGDEF KU32_C(0x00002000) /** x86: conforming selector setting (weird stuff). */ #define OBJCONFORM KU32_C(0x00004000) /** x86: IOPL. */ #define OBJIOPL KU32_C(0x00008000) /** @} */ /** A Object Page Map Entry. */ struct o32_map { /** The file offset of the page. */ KU32 o32_pagedataoffset; /** The number of bytes of raw page data. */ KU16 o32_pagesize; /** Per page flags describing how the page is encoded in the file. */ KU16 o32_pageflags; }; /** @name o32 o32_pageflags * @{ */ /** Raw page (uncompressed) in the file. */ #define VALID KU16_C(0x0000) /** RLE encoded page in file. */ #define ITERDATA KU16_C(0x0001) /** Invalid page, nothing in the file. */ #define INVALID KU16_C(0x0002) /** Zero page, nothing in file. */ #define ZEROED KU16_C(0x0003) /** range of pages (what is this?) */ #define RANGE KU16_C(0x0004) /** Compressed page in file. */ #define ITERDATA2 KU16_C(0x0005) /** @} */ /** Iteration Record format (RLE compressed page). */ struct LX_Iter { /** Number of iterations. */ KU16 LX_nIter; /** The number of bytes that's being iterated. */ KU16 LX_nBytes; /** The bytes. */ KU8 LX_Iterdata; }; /** @} */ /** A Resource Table Entry */ struct rsrc32 { /** Resource Type. */ KU16 type; /** Resource ID. */ KU16 name; /** Resource size in bytes. */ KU32 cb; /** The index of the object containing the resource. */ KU16 obj; /** Offset of the resource that within the object. */ KU32 offset; }; /** @name The Entry Table (aka Export Table) * @{ */ /** Entry bundle. * Header descripting up to 255 entries that follows immediatly after this structure. */ struct b32_bundle { /** The number of entries. */ KU8 b32_cnt; /** The type of bundle. */ KU8 b32_type; /** The index of the object containing these entry points. */ KU16 b32_obj; }; /** @name b32_type * @{ */ /** Empty bundle, filling up unused ranges of ordinals. */ #define EMPTY 0x00 /** 16-bit offset entry point. */ #define ENTRY16 0x01 /** 16-bit callgate entry point. */ #define GATE16 0x02 /** 32-bit offset entry point. */ #define ENTRY32 0x03 /** Forwarder entry point. */ #define ENTRYFWD 0x04 /** Typing information present indicator. */ #define TYPEINFO 0x80 /** @} */ /** Entry point. */ struct e32_entry { /** Entry point flags */ KU8 e32_flags; /* Entry point flags */ union entrykind { /** ENTRY16 or ENTRY32. */ offset e32_offset; /** GATE16 */ struct callgate { /** Offset into segment. */ KU16 offset; /** The callgate selector */ KU16 callgate; } e32_callgate; /** ENTRYFWD */ struct fwd { /** Module ordinal number (i.e. into the import module table). */ KU16 modord; /** Procedure name or ordinal number. */ KU32 value; } e32_fwd; } e32_variant; }; /** @name e32_flags * @{ */ /** Exported entry (set) or private entry (clear). */ #define E32EXPORT 0x01 /** Uses shared data. */ #define E32SHARED 0x02 /** Parameter word count mask. */ #define E32PARAMS 0xf8 /** ENTRYFWD: Imported by ordinal (set) or by name (clear). */ #define FWD_ORDINAL 0x01 /** @} */ /** @name dunno * @{ */ #define FIXENT16 3 #define FIXENT32 5 #define GATEENT16 5 #define FWDENT 7 /** @} */ #pragma pack() #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kLdrFmts/mach-o.h����������������������������������������������0000664�0001750�0001750�00000133213�14670377513�022445� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: mach-o.h 63 2013-10-30 02:00:14Z bird $ */ /** @file * Mach-0 structures, types and defines. */ /* * Copyright (c) 2006-2012 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kLdrFmts_mach_o_h___ #define ___k_kLdrFmts_mach_o_h___ #include <k/kDefs.h> #include <k/kTypes.h> /** @defgroup grp_mach_o The Mach-O Structures, Types, and Defines. * @{ */ #ifndef IMAGE_FAT_SIGNATURE /** The FAT signature (universal binaries). */ # define IMAGE_FAT_SIGNATURE KU32_C(0xcafebabe) #endif #ifndef IMAGE_FAT_SIGNATURE_OE /** The FAT signature (universal binaries), other endian. */ # define IMAGE_FAT_SIGNATURE_OE KU32_C(0xbebafeca) #endif /** * The fat header found at the start of universal binaries. * It is followed by \a nfat_arch numbers of \a fat_arch structures. */ typedef struct fat_header { KU32 magic; KU32 nfat_arch; } fat_header_t; /** * Description of fat file item. */ typedef struct fat_arch { KI32 cputype; KI32 cpusubtype; KU32 offset; KU32 size; KU32 align; /**< Power of 2. */ } fat_arch_t; #ifndef IMAGE_MACHO32_SIGNATURE /** The 32-bit Mach-O signature. */ # define IMAGE_MACHO32_SIGNATURE KU32_C(0xfeedface) #endif #ifndef IMAGE_MACHO32_SIGNATURE_OE /** The 32-bit Mach-O signature, other endian. */ # define IMAGE_MACHO32_SIGNATURE_OE KU32_C(0xcefaedfe) #endif #define MH_MAGIC IMAGE_MACHO32_SIGNATURE #define MH_CIGAM IMAGE_MACHO32_SIGNATURE_OE /** * 32-bit Mach-O header. * This is followed by \a ncmds number of load commands. * @see mach_header_64 */ typedef struct mach_header_32 { KU32 magic; KI32 cputype; KI32 cpusubtype; KU32 filetype; KU32 ncmds; KU32 sizeofcmds; KU32 flags; } mach_header_32_t; #ifndef IMAGE_MACHO64_SIGNATURE /** The 64-bit Mach-O signature. */ # define IMAGE_MACHO64_SIGNATURE KU32_C(0xfeedfacf) #endif #ifndef IMAGE_MACHO64_SIGNATURE_OE /** The 64-bit Mach-O signature, other endian. */ # define IMAGE_MACHO64_SIGNATURE_OE KU32_C(0xfefaedfe) #endif #define MH_MAGIC_64 IMAGE_MACHO64_SIGNATURE #define MH_CIGAM_64 IMAGE_MACHO64_SIGNATURE_OE /** * 64-bit Mach-O header. * This is followed by \a ncmds number of load commands. * @see mach_header */ typedef struct mach_header_64 { KU32 magic; KI32 cputype; KI32 cpusubtype; KU32 filetype; KU32 ncmds; KU32 sizeofcmds; KU32 flags; KU32 reserved; /**< (for proper struct and command alignment I guess) */ } mach_header_64_t; /** @name File types (mach_header_64::filetype, mach_header_32::filetype) * @{ */ #define MH_OBJECT KU32_C(1) /**< Object (relocatable). */ #define MH_EXECUTE KU32_C(2) /**< Executable (demand paged). */ #define MH_FVMLIB KU32_C(3) /**< Fixed VM shared library. */ #define MH_CORE KU32_C(4) /**< Core file. */ #define MH_PRELOAD KU32_C(5) /**< Preloaded executable. */ #define MH_DYLIB KU32_C(6) /**< Dynamically bound shared library. */ #define MH_DYLINKER KU32_C(7) /**< Dynamic linker. */ #define MH_BUNDLE KU32_C(8) /**< Dymamically bound bundle. */ #define MH_DYLIB_STUB KU32_C(9) /**< Shared library stub for static linking. */ #define MH_DSYM KU32_C(10)/**< Debug symbols. */ #define MH_KEXT_BUNDLE KU32_C(11)/**< Kernel extension (introduced with the AMD64 kernel). */ /** @} */ /** @name Mach-O Header flags (mach_header_64::flags, mach_header_32::flags) * @{ */ #define MH_NOUNDEFS KU32_C(0x00000001) /**< No undefined symbols. */ #define MH_INCRLINK KU32_C(0x00000002) /**< Partial increment link output. */ #define MH_DYLDLINK KU32_C(0x00000004) /**< Food for the dynamic linker, not for ld. */ #define MH_BINDATLOAD KU32_C(0x00000008) /**< Bind all undefined symbols at load time. */ #define MH_PREBOUND KU32_C(0x00000010) /**< Contains prebound undefined symbols. */ #define MH_SPLIT_SEGS KU32_C(0x00000020) /**< Read-only and read-write segments are split. */ #define MH_LAZY_INIT KU32_C(0x00000040) /**< Obsolete flag for doing lazy init when data is written. */ #define MH_TWOLEVEL KU32_C(0x00000080) /**< Uses two-level name space bindings. */ #define MH_FORCE_FLAT KU32_C(0x00000100) /**< Task: The executable forces all images to use flat name space bindings. */ #define MH_NOMULTIDEFS KU32_C(0x00000200) /**< No multiple symbol definitions, safe to use two-level namespace hints. */ #define MH_NOFIXPREBINDING KU32_C(0x00000400) /**< The dynamic linker should not notify the prebinding agent about this executable. */ #define MH_PREBINDABLE KU32_C(0x00000800) /**< Not prebound, but it can be. Invalid if MH_PREBOUND is set. */ #define MH_ALLMODSBOUND KU32_C(0x00001000) /**< Binds to all two-level namespace modules of preqs. Requires MH_PREBINDABLE and MH_TWOLEVEL to be set. */ #define MH_SUBSECTIONS_VIA_SYMBOLS KU32_C(0x00002000) /**< Safe to divide sections into sub-sections via symbols for dead code stripping. */ #define MH_CANONICAL KU32_C(0x00004000) /**< Canonicalized via unprebind. */ #define MH_WEAK_DEFINES KU32_C(0x00008000) /**< The (finally) linked image has weak symbols. */ #define MH_BINDS_TO_WEAK KU32_C(0x00010000) /**< The (finally) linked image uses weak symbols. */ #define MH_ALLOW_STACK_EXECUTION KU32_C(0x00020000) /**< Task: allow stack execution. (MH_EXECUTE only) */ #define MH_ROOT_SAFE KU32_C(0x00040000) /**< Binary safe for root execution. */ #define MH_SETUID_SAFE KU32_C(0x00080000) /**< Binary safe for set-uid execution. */ #define MH_NO_REEXPORTED_DYLIBS KU32_C(0x00100000) /**< No reexported dylibs. */ #define MH_PIE KU32_C(0x00200000) /**< Address space randomization. (MH_EXECUTE only) */ #define MH_DEAD_STRIPPABLE_DYLIB KU32_C(0x00400000) /**< Drop dylib dependency if not used. (MH_DYLIB only) */ #define MH_HAS_TLV_DESCRIPTORS KU32_C(0x00800000) /**< Has a S_TRHEAD_LOCAL_VARIABLES section. TLS support. */ #define MH_NO_HEAP_EXECUTION KU32_C(0x01000000) /**< Task: no heap execution. (MH_EXECUTE only) */ #define MH_VALID_FLAGS KU32_C(0x01ffffff) /**< Mask containing the defined flags. */ /** @} */ /** @name CPU types / bits (mach_header_64::cputype, mach_header_32::cputype, fat_arch::cputype) * @{ */ #define CPU_ARCH_MASK KI32_C(0xff000000) #define CPU_ARCH_ABI64 KI32_C(0x01000000) #define CPU_TYPE_ANY KI32_C(-1) #define CPU_TYPE_VAX KI32_C(1) #define CPU_TYPE_MC680x0 KI32_C(6) #define CPU_TYPE_X86 KI32_C(7) #define CPU_TYPE_I386 CPU_TYPE_X86 #define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64) #define CPU_TYPE_MC98000 KI32_C(10) #define CPU_TYPE_HPPA KI32_C(11) #define CPU_TYPE_MC88000 KI32_C(13) #define CPU_TYPE_SPARC KI32_C(14) #define CPU_TYPE_I860 KI32_C(15) #define CPU_TYPE_POWERPC KI32_C(18) #define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64) /** @} */ /** @name CPU subtypes (mach_header_64::cpusubtype, mach_header_32::cpusubtype, fat_arch::cpusubtype) * @{ */ #define CPU_SUBTYPE_MULTIPLE KI32_C(-1) #define CPU_SUBTYPE_LITTLE_ENDIAN KI32_C(0) /**< figure this one out. */ #define CPU_SUBTYPE_BIG_ENDIAN KI32_C(1) /**< ditto */ /* VAX */ #define CPU_SUBTYPE_VAX_ALL KI32_C(0) #define CPU_SUBTYPE_VAX780 KI32_C(1) #define CPU_SUBTYPE_VAX785 KI32_C(2) #define CPU_SUBTYPE_VAX750 KI32_C(3) #define CPU_SUBTYPE_VAX730 KI32_C(4) #define CPU_SUBTYPE_UVAXI KI32_C(5) #define CPU_SUBTYPE_UVAXII KI32_C(6) #define CPU_SUBTYPE_VAX8200 KI32_C(7) #define CPU_SUBTYPE_VAX8500 KI32_C(8) #define CPU_SUBTYPE_VAX8600 KI32_C(9) #define CPU_SUBTYPE_VAX8650 KI32_C(10) #define CPU_SUBTYPE_VAX8800 KI32_C(11) #define CPU_SUBTYPE_UVAXIII KI32_C(12) /* MC680xx */ #define CPU_SUBTYPE_MC680x0_ALL KI32_C(1) #define CPU_SUBTYPE_MC68030 KI32_C(1) #define CPU_SUBTYPE_MC68040 KI32_C(2) #define CPU_SUBTYPE_MC68030_ONLY KI32_C(3) /* I386 */ #define CPU_SUBTYPE_INTEL(fam, model) ( (KI32)(((model) << 4) | (fam)) ) #define CPU_SUBTYPE_INTEL_FAMILY(subtype) ( (subtype) & 0xf ) #define CPU_SUBTYPE_INTEL_MODEL(subtype) ( (subtype) >> 4 ) #define CPU_SUBTYPE_INTEL_FAMILY_MAX 0xf #define CPU_SUBTYPE_INTEL_MODEL_ALL 0 #define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0) #define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0) #define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0) #define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) #define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0) #define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0) #define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1) #define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3) #define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5) #define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6) #define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7) #define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0) #define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1) #define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2) #define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0) #define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0) #define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1) #define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0) #define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1) #define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0) #define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1) /* X86 */ #define CPU_SUBTYPE_X86_ALL KI32_C(3) /* CPU_SUBTYPE_I386_ALL */ #define CPU_SUBTYPE_X86_64_ALL KI32_C(3) /* CPU_SUBTYPE_I386_ALL */ #define CPU_SUBTYPE_X86_ARCH1 KI32_C(4) /* CPU_SUBTYPE_I486_ALL */ /* MIPS */ #define CPU_SUBTYPE_MIPS_ALL KI32_C(0) #define CPU_SUBTYPE_MIPS_R2300 KI32_C(1) #define CPU_SUBTYPE_MIPS_R2600 KI32_C(2) #define CPU_SUBTYPE_MIPS_R2800 KI32_C(3) #define CPU_SUBTYPE_MIPS_R2000a KI32_C(4) #define CPU_SUBTYPE_MIPS_R2000 KI32_C(5) #define CPU_SUBTYPE_MIPS_R3000a KI32_C(6) #define CPU_SUBTYPE_MIPS_R3000 KI32_C(7) /* MC98000 (PowerPC) */ #define CPU_SUBTYPE_MC98000_ALL KI32_C(0) #define CPU_SUBTYPE_MC98601 KI32_C(1) /* HP-PA */ #define CPU_SUBTYPE_HPPA_ALL KI32_C(0) #define CPU_SUBTYPE_HPPA_7100 KI32_C(0) #define CPU_SUBTYPE_HPPA_7100LC KI32_C(1) /* MC88000 */ #define CPU_SUBTYPE_MC88000_ALL KI32_C(0) #define CPU_SUBTYPE_MC88100 KI32_C(1) #define CPU_SUBTYPE_MC88110 KI32_C(2) /* SPARC */ #define CPU_SUBTYPE_SPARC_ALL KI32_C(0) /* I860 */ #define CPU_SUBTYPE_I860_ALL KI32_C(0) #define CPU_SUBTYPE_I860_860 KI32_C(1) /* PowerPC */ #define CPU_SUBTYPE_POWERPC_ALL KI32_C(0) #define CPU_SUBTYPE_POWERPC_601 KI32_C(1) #define CPU_SUBTYPE_POWERPC_602 KI32_C(2) #define CPU_SUBTYPE_POWERPC_603 KI32_C(3) #define CPU_SUBTYPE_POWERPC_603e KI32_C(4) #define CPU_SUBTYPE_POWERPC_603ev KI32_C(5) #define CPU_SUBTYPE_POWERPC_604 KI32_C(6) #define CPU_SUBTYPE_POWERPC_604e KI32_C(7) #define CPU_SUBTYPE_POWERPC_620 KI32_C(8) #define CPU_SUBTYPE_POWERPC_750 KI32_C(9) #define CPU_SUBTYPE_POWERPC_7400 KI32_C(10) #define CPU_SUBTYPE_POWERPC_7450 KI32_C(11) #define CPU_SUBTYPE_POWERPC_Max KI32_C(10) #define CPU_SUBTYPE_POWERPC_SCVger KI32_C(11) #define CPU_SUBTYPE_POWERPC_970 KI32_C(100) /* Subtype capability / feature bits, added in 10.5. X86 only? */ #define CPU_SUBTYPE_MASK KU32_C(0xff000000) #define CPU_SUBTYPE_LIB64 KU32_C(0x8000000) /** @} */ /** @defgroup grp_macho_o_lc Load Commands * @{ */ /** * The load command common core structure. * * After the Mach-O header follows an array of variable sized * load command which all has this header in common. */ typedef struct load_command { KU32 cmd; /**< The load command id. */ KU32 cmdsize; /**< The size of the command (including this header). */ } load_command_t; /** @name Load Command IDs (load_command::cmd) * @{ */ /** Flag that when set requires the dynamic linker to fail if it doesn't * grok the command. The dynamic linker will otherwise ignore commands it * doesn't understand. Introduced with Mac OS X 10.1. */ #define LC_REQ_DYLD KU32_C(0x80000000) #define LC_SEGMENT_32 KU32_C(0x01) /**< Segment to be mapped (32-bit). See segment_command_32. */ #define LC_SYMTAB KU32_C(0x02) /**< 'stab' symbol table. See symtab_command. */ #define LC_SYMSEG KU32_C(0x03) /**< Obsoleted gdb symbol table. */ #define LC_THREAD KU32_C(0x04) /**< Thread. See thread_command. */ #define LC_UNIXTHREAD KU32_C(0x05) /**< Unix thread (includes stack and stuff). See thread_command. */ #define LC_LOADFVMLIB KU32_C(0x06) /**< Load a specified fixed VM shared library (obsolete?). See fvmlib_command. */ #define LC_IDFVMLIB KU32_C(0x07) /**< Fixed VM shared library id (obsolete?). See fvmlib_command. */ #define LC_IDENT KU32_C(0x08) /**< Identification info (obsolete). See ident_command. */ #define LC_FVMFILE KU32_C(0x09) /**< Fixed VM file inclusion (internal). See fvmfile_command. */ #define LC_PREPAGE KU32_C(0x0a) /**< Prepage command (internal). See ?? */ #define LC_DYSYMTAB KU32_C(0x0b) /**< Symbol table for dynamic linking. See dysymtab_command. */ #define LC_LOAD_DYLIB KU32_C(0x0c) /**< Load a dynamically linked shared library. See dylib_command. */ #define LC_ID_DYLIB KU32_C(0x0d) /**< Dynamically linked share library ident. See dylib_command. */ #define LC_LOAD_DYLINKER KU32_C(0x0e) /**< Load a dynamical link editor. See dylinker_command. */ #define LC_ID_DYLINKER KU32_C(0x0f) /**< Dynamic link editor ident. See dylinker_command. */ #define LC_PREBOUND_DYLIB KU32_C(0x10) /**< Prebound modules for dynamically linking of a shared lib. See prebound_dylib_command. */ #define LC_ROUTINES KU32_C(0x11) /**< Image routines. See routines_command_32. */ #define LC_SUB_FRAMEWORK KU32_C(0x12) /**< Sub framework. See sub_framework_command. */ #define LC_SUB_UMBRELLA KU32_C(0x13) /**< Sub umbrella. See sub_umbrella_command. */ #define LC_SUB_CLIENT KU32_C(0x14) /**< Sub client. See sub_client_command. */ #define LC_SUB_LIBRARY KU32_C(0x15) /**< Sub library. See sub_library_command. */ #define LC_TWOLEVEL_HINTS KU32_C(0x16) /**< Two-level namespace lookup hints. See twolevel_hints_command. */ #define LC_PREBIND_CKSUM KU32_C(0x17) /**< Prebind checksum. See prebind_cksum_command. */ #define LC_LOAD_WEAK_DYLIB (KU32_C(0x18) | LC_REQ_DYLD) /**< Dylib that can be missing, all symbols weak. See dylib_command. */ #define LC_SEGMENT_64 KU32_C(0x19) /**< segment to be mapped (64-bit). See segment_command_32. */ #define LC_ROUTINES_64 KU32_C(0x1a) /**< Image routines (64-bit). See routines_command_32. */ #define LC_UUID KU32_C(0x1b) /**< The UUID of the object module. See uuid_command. */ #define LC_RPATH (KU32_C(0x1c) | LC_REQ_DYLD) /**< Runpth additions. See rpath_command. */ #define LC_CODE_SIGNATURE KU32_C(0x1d) /**< Code signature location. See linkedit_data_command. */ #define LC_SEGMENT_SPLIT_INFO KU32_C(0x1e)/**< Segment split info location. See linkedit_data_command. */ #define LC_REEXPORT_DYLIB (KU32_C(0x1f) | LC_REQ_DYLD)/**< Load and re-export the given dylib - DLL forwarding. See dylib_command. */ #define LC_LAZY_LOAD_DYLIB KU32_C(0x20) /**< Delays loading of the given dylib until used. See dylib_command? */ #define LC_ENCRYPTION_INFO KU32_C(0x21) /**< Segment encryption information. See encryption_info_command. */ #define LC_DYLD_INFO KU32_C(0x22) /**< Compressed dylib relocation information, alternative present. See dyld_info_command. */ #define LC_DYLD_INFO_ONLY (KU32_C(0x22) | LC_REQ_DYLD) /**< Compressed dylib relocation information, no alternative. See dyld_info_command. */ #define LC_LOAD_UPWARD_DYLIB KU32_C(0x23) /**< ???? */ #define LC_VERSION_MIN_MACOSX KU32_C(0x24) /**< The image requires the given Mac OS X version. See version_min_command. */ #define LC_VERSION_MIN_IPHONEOS KU32_C(0x25) /**< The image requires the given iOS version. See version_min_command. */ #define LC_FUNCTION_STARTS KU32_C(0x26) /**< Where to find the compress function start addresses. See linkedit_data_command. */ #define LC_DYLD_ENVIRONMENT KU32_C(0x27) /**< Environment variable for the dynamic linker. See dylinker_command. */ #define LC_MAIN (KU32_C(0x28) | LC_REQ_DYLD) /**< Simpler alternative to LC_UNIXTHREAD. */ #define LC_DATA_IN_CODE KU32_C(0x29) /**< Table of data in the the text section. */ #define LC_SOURCE_VERSION KU32_C(0x2a) /**< Source code revision / version hint. */ #define LC_DYLIB_CODE_SIGN_DRS KU32_C(0x2b) /**< Code signing designated requirements copied from dylibs prequisites. */ /** @} */ /** * Load Command String. */ typedef struct lc_str { /** Offset of the string relative to the load_command structure. * The string is zero-terminated. the size of the load command * is zero padded up to a multiple of 4 bytes. */ KU32 offset; } lc_str_t; /** * Segment load command (32-bit). */ typedef struct segment_command_32 { KU32 cmd; /**< LC_SEGMENT */ KU32 cmdsize; /**< sizeof(self) + sections. */ char segname[16]; /**< The segment name. */ KU32 vmaddr; /**< Memory address of this segment. */ KU32 vmsize; /**< Size of this segment. */ KU32 fileoff; /**< The file location of the segment. */ KU32 filesize; /**< The file size of the segment. */ KU32 maxprot; /**< Maximum VM protection. */ KU32 initprot; /**< Initial VM protection. */ KU32 nsects; /**< Number of section desciptors following this structure. */ KU32 flags; /**< Flags (SG_*). */ } segment_command_32_t; /** * Segment load command (64-bit). * Same as segment_command_32 except 4 members has been blown up to 64-bit. */ typedef struct segment_command_64 { KU32 cmd; /**< LC_SEGMENT */ KU32 cmdsize; /**< sizeof(self) + sections. */ char segname[16]; /**< The segment name. */ KU64 vmaddr; /**< Memory address of this segment. */ KU64 vmsize; /**< Size of this segment. */ KU64 fileoff; /**< The file location of the segment. */ KU64 filesize; /**< The file size of the segment. */ KU32 maxprot; /**< Maximum VM protection. */ KU32 initprot; /**< Initial VM protection. */ KU32 nsects; /**< Number of section desciptors following this structure. */ KU32 flags; /**< Flags (SG_*). */ } segment_command_64_t; /** @name Segment flags (segment_command_64::flags, segment_command_32::flags) * @{ */ /** Map the file bits in the top end of the memory area for the segment * instead of the low end. Intended for stacks in core dumps. * The part of the segment memory not covered by file bits will be zeroed. */ #define SG_HIGHVM KU32_C(0x00000001) /** This segment is the virtual memory allocated by a fixed VM library. * (Used for overlap checking in the linker.) */ #define SG_FVMLIB KU32_C(0x00000002) /** No relocations for or symbols that's relocated to in this segment. * The segment can therefore safely be replaced. */ #define SG_NORELOC KU32_C(0x00000004) /** The segment is protected. * The first page isn't protected if it starts at file offset 0 * (so that the mach header and this load command can be easily mapped). */ #define SG_PROTECTED_VERSION_1 KU32_C(0x00000008) /** @} */ /** * 32-bit section (part of a segment load command). */ typedef struct section_32 { char sectname[16]; /**< The section name. */ char segname[16]; /**< The name of the segment this section goes into. */ KU32 addr; /**< The memory address of this section. */ KU32 size; /**< The size of this section. */ KU32 offset; /**< The file offset of this section. */ KU32 align; /**< The section alignment (**2). */ KU32 reloff; /**< The file offset of the relocations. */ KU32 nreloc; /**< The number of relocations. */ KU32 flags; /**< The section flags; section type and attribs */ KU32 reserved1; /**< Reserved / offset / index. */ KU32 reserved2; /**< Reserved / count / sizeof. */ } section_32_t; /** * 64-bit section (part of a segment load command). */ typedef struct section_64 { char sectname[16]; /**< The section name. */ char segname[16]; /**< The name of the segment this section goes into. */ KU64 addr; /**< The memory address of this section. */ KU64 size; /**< The size of this section. */ KU32 offset; /**< The file offset of this section. */ KU32 align; /**< The section alignment (**2). */ KU32 reloff; /**< The file offset of the relocations. */ KU32 nreloc; /**< The number of relocations. */ KU32 flags; /**< The section flags; section type and attribs */ KU32 reserved1; /**< Reserved / offset / index. */ KU32 reserved2; /**< Reserved / count / sizeof. */ KU32 reserved3; /**< (Just) Reserved. */ } section_64_t; /** @name Section flags (section_64::flags, section_32::flags) * @{ */ /** Section type mask. */ #define SECTION_TYPE KU32_C(0x000000ff) /** Regular section. */ #define S_REGULAR 0x00 /** Zero filled section. */ #define S_ZEROFILL 0x01 /** C literals. */ #define S_CSTRING_LITERALS 0x02 /** 4 byte literals. */ #define S_4BYTE_LITERALS 0x03 /** 8 byte literals. */ #define S_8BYTE_LITERALS 0x04 /** Pointer to literals. */ #define S_LITERAL_POINTERS 0x05 /** Section containing non-lazy symbol pointers. * Reserved1 == start index in the indirect symbol table. */ #define S_NON_LAZY_SYMBOL_POINTERS 0x06 /** Section containing lazy symbol pointers. * Reserved1 == start index in the indirect symbol table. */ #define S_LAZY_SYMBOL_POINTERS 0x07 /** Section containing symbol stubs. * Reserved2 == stub size. */ #define S_SYMBOL_STUBS 0x08 /** Section containing function pointers for module initialization. . */ #define S_MOD_INIT_FUNC_POINTERS 0x09 /** Section containing function pointers for module termination. . */ #define S_MOD_TERM_FUNC_POINTERS 0x0a /** Section containing symbols that are to be coalesced. */ #define S_COALESCED 0x0b /** Zero filled section that be larger than 4GB. */ #define S_GB_ZEROFILL 0x0c /** Section containing pairs of function pointers for interposing. */ #define S_INTERPOSING 0x0d /** 16 byte literals. */ #define S_16BYTE_LITERALS 0x0e /** DTrace byte code / definitions (DOF = DTrace object format). */ #define S_DTRACE_DOF 0x0f /** Section containing pointers to symbols in lazily loaded dylibs. */ #define S_LAZY_DYLIB_SYMBOL_POINTERS 0x10 /** Section attribute mask. */ #define SECTION_ATTRIBUTES KU32_C(0xffffff00) /** User settable attribute mask. */ #define SECTION_ATTRIBUTES_USR KU32_C(0xff000000) /** Pure instruction (code). */ #define S_ATTR_PURE_INSTRUCTIONS KU32_C(0x80000000) /** ranlib, ignore my symbols... */ #define S_ATTR_NO_TOC KU32_C(0x40000000) /** May strip static symbols when linking int a MH_DYLDLINK file. */ #define S_ATTR_STRIP_STATIC_SYMS KU32_C(0x20000000) /** No dead stripping. */ #define S_ATTR_NO_DEAD_STRIP KU32_C(0x10000000) /** Live support. */ #define S_ATTR_LIVE_SUPPORT KU32_C(0x08000000) /** Contains self modifying code (generally i386 code stub for dyld). */ #define S_ATTR_SELF_MODIFYING_CODE KU32_C(0x04000000) /** Debug info (DWARF usually). */ #define S_ATTR_DEBUG KU32_C(0x02000000) /** System settable attribute mask. */ #define SECTION_ATTRIBUTES_SYS KU32_C(0x00ffff00) /** Contains some instructions (code). */ #define S_ATTR_SOME_INSTRUCTIONS KU32_C(0x00000400) /** Has external relocations. */ #define S_ATTR_EXT_RELOC KU32_C(0x00000200) /** Has internal (local) relocations. */ #define S_ATTR_LOC_RELOC KU32_C(0x00000100) /** @} */ /** @name Known Segment and Section Names. * Some of these implies special linker behaviour. * @{ */ /** Page zero - not-present page for catching invalid access. (MH_EXECUTE typically) */ #define SEG_PAGEZERO "__PAGEZERO" /** Traditional UNIX text segment. * Defaults to R-X. */ #define SEG_TEXT "__TEXT" /** The text part of SEG_TEXT. */ #define SECT_TEXT "__text" /** The fvmlib initialization. */ #define SECT_FVMLIB_INIT0 "__fvmlib_init0" /** The section following the fvmlib initialization. */ #define SECT_FVMLIB_INIT1 "__fvmlib_init1" /** The traditional UNIX data segment. (DGROUP to DOS and OS/2 people.) */ #define SEG_DATA "__DATA" /** The initialized data section. */ #define SECT_DATA "__data" /** The uninitialized data section. */ #define SECT_BSS "__bss" /** The common symbol section. */ #define SECT_COMMON "__common" /** Objective-C runtime segment. */ #define SEG_OBJC "__OBJC" /** Objective-C symbol table section. */ #define SECT_OBJC_SYMBOLS "__symbol_table" /** Objective-C module information section. */ #define SECT_OBJC_MODULES "__module_info" /** Objective-C string table section. */ #define SECT_OBJC_STRINGS "__selector_strs" /** Objective-C string table section. */ #define SECT_OBJC_REFS "__selector_refs" /** Icon segment. */ #define SEG_ICON "__ICON" /** The icon headers. */ #define SECT_ICON_HEADER "__header" /** The icons in the TIFF format. */ #define SECT_ICON_TIFF "__tiff" /** ld -seglinkedit segment containing all the structs create and maintained * by the linker. MH_EXECUTE and MH_FVMLIB only. */ #define SEG_LINKEDIT "__LINKEDIT" /** The unix stack segment. */ #define SEG_UNIXSTACK "__UNIXSTACK" /** The segment for the self modifying code for dynamic linking. * Implies RWX permissions. */ #define SEG_IMPORT "__IMPORT" /** @} */ /** @todo fvmlib */ /** @todo fvmlib_command (LC_IDFVMLIB or LC_LOADFVMLIB) */ /** @todo dylib */ /** @todo dylib_command (LC_ID_DYLIB, LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, * LC_REEXPORT_DYLIB, LC_LAZY_LOAD_DYLIB) */ /** @todo sub_framework_command (LC_SUB_FRAMEWORK) */ /** @todo sub_client_command (LC_SUB_CLIENT) */ /** @todo sub_umbrella_command (LC_SUB_UMBRELLA) */ /** @todo sub_library_command (LC_SUB_LIBRARY) */ /** @todo prebound_dylib_command (LC_PREBOUND_DYLIB) */ /** @todo dylinker_command (LC_ID_DYLINKER or LC_LOAD_DYLINKER, * LC_DYLD_ENVIRONMENT) */ /** * Thread command. * * State description of a thread that is to be created. The description * is made up of a number of state structures preceded by a 32-bit flavor * and 32-bit count field stating the kind of stat structure and it's size * in KU32 items respecitvly. * * LC_UNIXTHREAD differs from LC_THREAD in that it implies stack creation * and that it's started with the typical main(int, char **, char **) frame * on the stack. */ typedef struct thread_command { KU32 cmd; /**< LC_UNIXTHREAD or LC_THREAD. */ KU32 cmdsize; /**< The size of the command (including this header). */ } thread_command_t; /** @todo routines_command (LC_ROUTINES) */ /** @todo routines_command_64 (LC_ROUTINES_64) */ /** * Symbol table command. * Contains a.out style symbol table with some tricks. */ typedef struct symtab_command { KU32 cmd; /**< LC_SYMTAB */ KU32 cmdsize; /** sizeof(symtab_command_t) */ KU32 symoff; /** The file offset of the symbol table. */ KU32 nsyms; /** The number of symbols in the symbol table. */ KU32 stroff; /** The file offset of the string table. */ KU32 strsize; /** The size of the string table. */ } symtab_command_t; /** @todo dysymtab_command (LC_DYSYMTAB) */ /** @todo dylib_table_of_contents */ /** @todo dylib_module_32 */ /** @todo dylib_module_64 */ /** @todo dylib_reference */ /** @todo twolevel_hints_command (LC_TWOLEVEL_HINTS) */ /** @todo twolevel_hint */ /** @todo prebind_cksum_command (LC_PREBIND_CKSUM) */ /** * UUID generated by ld. */ typedef struct uuid_command { KU32 cmd; /**< LC_UUID */ KU32 cmdsize; /**< sizeof(uuid_command_t) */ KU8 uuid[16]; /** The UUID bytes. */ } uuid_command_t; /** @todo symseg_command (LC_SYMSEG) */ /** @todo ident_command (LC_IDENT) */ /** @todo fvmfile_command (LC_FVMFILE) */ /** @todo rpath_command (LC_RPATH) */ typedef struct linkedit_data_command { KU32 cmd; /**< LC_CODE_SIGNATURE, LC_SEGMENT_SPLIT_INFO, LC_FUNCTION_STARTS */ KU32 cmdsize; /**< size of this structure. */ KU32 dataoff; /**< Offset into the file of the data. */ KU32 datasize; /**< The size of the data. */ } linkedit_data_command_t; /** @todo encryption_info_command (LC_ENCRYPTION_INFO) */ /** @todo dyld_info_command (LC_DYLD_INFO, LC_DYLD_INFO_ONLY) */ typedef struct version_min_command { KU32 cmd; /**< LC_VERSION_MIN_MACOSX, LC_VERSION_MIN_IPHONEOS */ KU32 cmdsize; /**< size of this structure. */ KU32 version; /**< 31..16=major, 15..8=minor, 7..0=patch. */ KU32 reserved; /**< MBZ. */ } version_min_command_t; /** @} */ /** @defgroup grp_macho_o_syms Symbol Table * @{ */ /** * The 32-bit Mach-O version of the nlist structure. * * This differs from the a.out nlist struct in that the unused n_other field * was renamed to n_sect and used for keeping the relevant section number. * @remark This structure is not name mach_nlist_32 in the Apple headers, but nlist. */ typedef struct macho_nlist_32 { union { KI32 n_strx; /**< Offset (index) into the string table. 0 means "". */ } n_un; KU8 n_type; /**< Symbol type. */ KU8 n_sect; /**< Section number of NO_SECT. */ KI16 n_desc; /**< Type specific, debug info details mostly.*/ KU32 n_value; /**< The symbol value or stab offset. */ } macho_nlist_32_t; /** * The 64-bit Mach-O version of the nlist structure. * @see macho_nlist_32 */ typedef struct macho_nlist_64 { union { KU32 n_strx; /**< Offset (index) into the string table. 0 means "". */ } n_un; KU8 n_type; /**< Symbol type. */ KU8 n_sect; /**< Section number of NO_SECT. */ KI16 n_desc; /**< Type specific, debug info details mostly.*/ KU64 n_value; /**< The symbol value or stab offset. */ } macho_nlist_64_t; /** @name Symbol Type Constants (macho_nlist_32_t::n_type, macho_nlist_64_t::n_type) * * In the Mach-O world n_type is somewhat similar to a.out, meaning N_EXT, N_UNDF, N_ABS * and the debug symbols are essentially the same, but the remaining stuff is different. * The main reason for this is that the encoding of section has been moved to n_sect * to permit up to 255 sections instead of the fixed 3 a.out sections (not counting * the abs symbols and set vectors). * * To avoid confusion with a.out the Mach-O constants has been fitted with a MACHO_ * prefix here. * * Common symbols (aka communal symbols and comdefs) are represented by * n_type = MACHO_N_EXT | MACHO_N_UNDF, n_sect = NO_SECT and n_value giving * the size. * * * Symbol table entries can be inserted directly in the assembly code using * this notation: * @code * .stabs "n_name", n_type, n_sect, n_desc, n_value * @endcode * * (1) The line number is optional, GCC doesn't set it. * (2) The type is optional, GCC doesn't set it. * (3) The binutil header is "skeptical" about the line. I'm skeptical about the whole thing... :-) * (M) Mach-O specific? * (S) Sun specific? * @{ */ /* Base masks. */ #define MACHO_N_EXT KU8_C(0x01) /**< External symbol (when set) (N_EXT). */ #define MACHO_N_TYPE KU8_C(0x0e) /**< Symbol type (N_TYPE without the 8th bit). */ #define MACHO_N_PEXT KU8_C(0x10) /**< Private extern symbol (when set). (M) */ #define MACHO_N_STAB KU8_C(0xe0) /**< Debug symbol mask (N_STAB). */ /* MACHO_N_TYPE values. */ #define MACHO_N_UNDF KU8_C(0x00) /**< MACHO_N_TYPE: Undefined symbol (N_UNDF). n_sect = NO_SECT. */ #define MACHO_N_ABS KU8_C(0x02) /**< MACHO_N_TYPE: Absolute symbol (N_UNDF). n_sect = NO_SECT. */ #define MACHO_N_INDR KU8_C(0x0a) /**< MACHO_N_TYPE: Indirect symbol, n_value is the index of the symbol. (M) */ #define MACHO_N_PBUD KU8_C(0x0c) /**< MACHO_N_TYPE: Prebound undefined symbo (defined in a dylib). (M) */ #define MACHO_N_SECT KU8_C(0x0e) /**< MACHO_N_TYPE: Defined in the section given by n_sects. (M) */ /* Debug symbols. */ #define MACHO_N_GSYM KU8_C(0x20) /**< Global variable. "name",, NO_SECT, type, 0 (2) */ #define MACHO_N_FNAME KU8_C(0x22) /**< Function name (F77). "name",, NO_SECT, 0, 0 */ #define MACHO_N_FUN KU8_C(0x24) /**< Function / text var. "name",, section, line, address (1) */ #define MACHO_N_STSYM KU8_C(0x26) /**< Static data symbol. "name",, section, type, address (2) */ #define MACHO_N_LCSYM KU8_C(0x28) /**< static bss symbol. "name",, section, type, address (2) */ /* omits N_MAIN and N_ROSYM. */ #define MACHO_N_BNSYM KU8_C(0x2e) /**< Begin nsect symbol. 0,, section, 0, address (M) */ #define MACHO_N_PC KU8_C(0x30) /**< Global pascal symbol. "name",, NO_SECT, subtype?, line (3) */ /* omits N_NSYMS, N_NOMAP and N_OBJ. */ #define MACHO_N_OPT KU8_C(0x3c) /**< Options for the debugger related to the language of the source file. "options?",,,, */ #define MACHO_N_RSYM KU8_C(0x40) /**< Register variable. "name",, NO_SECT, type, register */ /* omits N_M2C */ #define MACHO_N_SLINE KU8_C(0x44) /**< Source line. 0,, section, line, address */ /* omits N_DSLINE, N_BSLINE / N_BROWS, N_DEFD and N_FLINE. */ #define MACHO_N_ENSYM KU8_C(0x4e) /**< End nsect symbol. 0,, section, 0, address (M) */ /* omits N_EHDECL / N_MOD2 and N_CATCH. */ #define MACHO_N_SSYM KU8_C(0x60) /**< Struct/union element. "name",, NO_SECT, type, offset */ /* omits N_ENDM */ #define MACHO_N_SO KU8_C(0x64) /**< Source file name. "fname",, section, 0, address */ #define MACHO_N_OSO KU8_C(0x66) /**< Object file name. "fname",, 0, 0, st_mtime (M?) */ /* omits N_ALIAS */ #define MACHO_N_LSYM KU8_C(0x80) /**< Stack variable. "name",, NO_SECT, type, frame_offset */ #define MACHO_N_BINCL KU8_C(0x82) /**< Begin #include. "fname",, NO_SECT, 0, sum? */ #define MACHO_N_SOL KU8_C(0x84) /**< #included file. "fname",, section, 0, start_address (S) */ #define MACHO_N_PARAMS KU8_C(0x86) /**< Compiler params. "params",, NO_SECT, 0, 0 */ #define MACHO_N_VERSION KU8_C(0x88) /**< Compiler version. "version",, NO_SECT, 0, 0 */ #define MACHO_N_OLEVEL KU8_C(0x8A) /**< Compiler -O level. "level",, NO_SECT, 0, 0 */ #define MACHO_N_PSYM KU8_C(0xa0) /**< Parameter variable. "name",, NO_SECT, type, frame_offset */ #define MACHO_N_EINCL KU8_C(0xa2) /**< End #include. "fname",, NO_SECT, 0, 0 (S) */ #define MACHO_N_ENTRY KU8_C(0xa4) /**< Alternate entry point. "name",, section, line, address */ #define MACHO_N_LBRAC KU8_C(0xc0) /**< Left bracket. 0,, NO_SECT, nesting_level, address */ #define MACHO_N_EXCL KU8_C(0xc2) /**< Deleted include file. "fname",, NO_SECT, 0, sum? (S) */ /* omits N_SCOPE */ #define MACHO_N_RBRAC KU8_C(0xe0) /**< Right bracket. 0,, NO_SECT, nesting_level, address */ #define MACHO_N_BCOMM KU8_C(0xe2) /**< Begin common. "name",, NO_SECT?, 0, 0 */ #define MACHO_N_ECOMM KU8_C(0xe4) /**< End common. "name",, section, 0, 0 */ #define MACHO_N_ECOML KU8_C(0xe8) /**< End local common. 0,, section, 0, address */ #define MACHO_N_LENG KU8_C(0xfe) /**< Length-value of the preceding entry. "name",, NO_SECT, 0, length */ /** @} */ /** @name Symbol Description Bits (macho_nlist_32_t::n_desc, macho_nlist_64_t::n_desc) * * Mach-O puts the n_desc field to a number of uses, like lazy binding , library * ordinal numbers for -twolevel_namespace, stripping and weak symbol handling. * * @remark The REFERENCE_FLAGS_* are really not flags in the normal sense (bit), * they are more like enum values. * @{ */ #define REFERENCE_TYPE KU16_C(0x000f) /**< The reference type mask. */ #define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0 /**< Normal undefined symbol. */ #define REFERENCE_FLAG_UNDEFINED_LAZY 1 /**< Lazy undefined symbol. */ #define REFERENCE_FLAG_DEFINED 2 /**< Defined symbol (dynamic linking). */ #define REFERENCE_FLAG_PRIVATE_DEFINED 3 /**< Defined private symbol (dynamic linking). */ #define REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY 4 /**< Normal undefined private symbol. */ #define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5 /**< Lazy undefined private symbol. */ #define REFERENCED_DYNAMICALLY KU16_C(0x0010) /**< Don't strip. */ /** Get the dynamic library ordinal. */ #define GET_LIBRARY_ORDINAL(n_desc) \ (((n_desc) >> 8) & 0xff) /** Set the dynamic library ordinal. */ #define SET_LIBRARY_ORDINAL(n_desc, ordinal) \ (n_desc) = (((n_desc) & 0xff) | (((ordinal) & 0xff) << 8)) #define SELF_LIBRARY_ORDINAL 0x00 /**< Special ordinal for refering to onself. */ #define MAX_LIBRARY_ORDINAL 0xfd /**< Maximum ordinal number. */ #define DYNAMIC_LOOKUP_ORDINAL 0xfe /**< Special ordinal number for dynamic lookup. (Mac OS X 10.3 and later) */ #define EXECUTABLE_ORDINAL 0xff /**< Special ordinal number for the executable. */ /** Only MH_OBJECT: Never dead strip me! */ #define N_NO_DEAD_STRIP KU16_C(0x0020) /** Not MH_OBJECT: Discarded symbol. */ #define N_DESC_DISCARDED KU16_C(0x0020) /** Weak external symbol. Symbol can be missing, in which case it's will have the value 0. */ #define N_WEAK_REF KU16_C(0x0040) /** Weak symbol definition. The symbol can be overridden by another weak * symbol already present or by a non-weak (strong) symbol definition. * Currently only supported for coalesed symbols. * @remark This bit means something differently for undefined symbols, see N_REF_TO_WEAK. */ #define N_WEAK_DEF KU16_C(0x0080) /** Reference to a weak symbol, resolve using flat namespace searching. * @remark This bit means something differently for defined symbols, see N_WEAK_DEF. */ #define N_REF_TO_WEAK KU16_C(0x0080) /** @} */ /** @} */ /** @defgroup grp_macho_o_relocs Relocations * @{ */ /** * Relocation entry. * * Differs from a.out in the meaning of r_symbolnum when r_extern=0 and * that r_pad is made into r_type. * * @remark This structure and type has been prefixed with macho_ to avoid * confusion with the original a.out type. */ typedef struct macho_relocation_info { KI32 r_address; /**< Section relative address of the fixup. The top bit (signed) indicates that this is a scattered relocation if set, see scattered_relocation_info_t. */ KU32 r_symbolnum : 24, /**< r_extern=1: Symbol table index, relocate with the address of this symbol. r_extern=0: Section ordinal, relocate with the address of this section. */ r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. */ r_length : 2, /**< Fixup length: 0=KU8, 1=KU16, 2=KU32, 3=KU64. */ r_extern : 1, /**< External or internal fixup, decides the r_symbolnum interpretation.. */ r_type : 4; /**< Relocation type; 0 is standard, non-zero are machine specific. */ } macho_relocation_info_t; /** Special section ordinal value for absolute relocations. */ #define R_ABS 0 /** Flag in r_address indicating that the relocation is of the * scattered_relocation_info_t kind and not macho_relocation_info_t. */ #define R_SCATTERED KU32_C(0x80000000) /** * Scattered relocation. * * This is a hack mainly for RISC machines which restricts section size * to 16MB among other things. * * The reason for the big/little endian differences here is of course because * of the R_SCATTERED mask and the way bitfields are implemented by the * C/C++ compilers. */ typedef struct scattered_relocation_info { #if K_ENDIAN == K_ENDIAN_LITTLE KU32 r_address : 24, /**< Section relative address of the fixup. (macho_relocation_info_t::r_address) */ r_type : 4, /**< Relocation type; 0 is standard, non-zero are machine specific. (macho_relocation_info_t::r_type) */ r_length : 2, /**< Fixup length: 0=KU8, 1=KU16, 2=KU32, 3=KU64. (macho_relocation_info_t::r_length) */ r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. (macho_relocation_info_t::r_pcrel) */ r_scattered : 1; /**< Set if scattered relocation, clear if normal relocation. */ #elif K_ENDIAN == K_ENDIAN_BIG KU32 r_scattered : 1, /**< Set if scattered relocation, clear if normal relocation. */ r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. (macho_relocation_info_t::r_pcrel) */ r_length : 2, /**< Fixup length: 0=KU8, 1=KU16, 2=KU32, 3=KU64. (macho_relocation_info_t::r_length) */ r_type : 4, /**< Relocation type; 0 is standard, non-zero are machine specific. (macho_relocation_info_t::r_type) */ r_address : 24; /**< Section relative address of the fixup. (macho_relocation_info_t::r_address) */ #else # error "Neither K_ENDIAN isn't LITTLE or BIG!" #endif KI32 r_value; /**< The value the fixup is refering to (without offset added). */ } scattered_relocation_info_t; /** * Relocation type values for a generic implementation (for r_type). */ typedef enum reloc_type_generic { GENERIC_RELOC_VANILLA = 0, /**< Standard relocation. */ GENERIC_RELOC_PAIR, /**< Follows GENERIC_RELOC_SECTDIFF. */ GENERIC_RELOC_SECTDIFF, /**< ??? */ GENERIC_RELOC_PB_LA_PTR, /**< Prebound lazy pointer whatever that. */ GENERIC_RELOC_LOCAL_SECTDIFF /**< ??? */ } reloc_type_generic_t; /** * Relocation type values for AMD64 (for r_type). */ typedef enum reloc_type_x86_64 { X86_64_RELOC_UNSIGNED = 0, /**< Absolute address. */ X86_64_RELOC_SIGNED, /**< Signed displacement. */ X86_64_RELOC_BRANCH, /**< Branch displacement (jmp/call, adj by size). */ X86_64_RELOC_GOT_LOAD, /**< GOT entry load. */ X86_64_RELOC_GOT, /**< GOT reference. */ X86_64_RELOC_SUBTRACTOR, /**< ??. */ X86_64_RELOC_SIGNED_1, /**< Signed displacement with a -1 added. */ X86_64_RELOC_SIGNED_2, /**< Signed displacement with a -2 added. */ X86_64_RELOC_SIGNED_4 /**< Signed displacement with a -4 added. */ } reloc_type_x86_64_t; /** @} */ /** @} */ #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kHlpThread.h���������������������������������������������������0000664�0001750�0001750�00000003117�14670377513�021600� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpThread.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpThread - Thread Manipulation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpThread_h___ #define ___k_kHlpThread_h___ #include <k/kHlpDefs.h> #include <k/kTypes.h> /** @defgroup grp_kHlpThread kHlpThread - Thread Management * @addtogroup grp_kHlp * @{*/ #ifdef __cplusplus extern "C" { #endif KHLP_DECL(void) kHlpSleep(unsigned cMillies); #ifdef __cplusplus } #endif /** @} */ #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kHlpSem.h������������������������������������������������������0000664�0001750�0001750�00000002773�14670377513�021124� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpSem.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpSem - Semaphores. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpSem_h___ #define ___k_kHlpSem_h___ #include <k/kHlpDefs.h> #include <k/kTypes.h> /** @defgroup grp_kHlpSem kHlpSem - Semaphore * @addtogroup grp_kHlp * @{*/ #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif /** @} */ #endif �����kbuild-3608/src/lib/kStuff/include/k/kHlpDefs.h�����������������������������������������������������0000664�0001750�0001750�00000003357�14670377513�021260� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpDefs.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpDefs - Helper Definitions. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpDefs_h___ #define ___k_kHlpDefs_h___ #include <k/kDefs.h> /** @defgroup grp_kHlpDefs - Definitions * @addtogroup grp_kHlp * @{ */ /** @def KHLP_DECL * Declares a kHlp function according to build context. * @param type The return type. */ #if defined(KHLP_BUILDING_DYNAMIC) # define KHLP_DECL(type) K_DECL_EXPORT(type) #elif defined(KHLP_BUILT_DYNAMIC) # define KHLP_DECL(type) K_DECL_IMPORT(type) #else # define KHLP_DECL(type) type #endif /** @} */ #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kAvlrU32.h�����������������������������������������������������0000664�0001750�0001750�00000004636�14670377513�021132� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kAvlrU32.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvl - AVL Tree Implementation, KU32 key ranges. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kAvlrU32_h___ #define ___k_kAvlrU32_h___ typedef struct KAVLRU32 { KU32 u32Start; KU32 u32Last; struct KAVLRU32 *mpLeft; struct KAVLRU32 *mpRight; KU8 mHeight; } KAVLRU32, *PKAVLRU32, **PPKAVLRU32; #define mKey u32Start #define mKeyLast u32Last /*#define KAVL_EQUAL_ALLOWED*/ #define KAVL_CHECK_FOR_EQUAL_INSERT #define KAVL_MAX_STACK 32 #define KAVL_RANGE /*#define KAVL_OFFSET */ #define KAVL_STD_KEY_COMP #define KAVLKEY KU32 #define KAVLNODE KAVLRU32 #define KAVL_FN(name) kAvlrU32 ## name #define KAVL_TYPE(prefix,name) prefix ## KAVLRU32 ## name #define KAVL_INT(name) KAVLRU32INT ## name #define KAVL_DECL(rettype) K_DECL_INLINE(rettype) #include <k/kAvlTmpl/kAvlBase.h> #include <k/kAvlTmpl/kAvlDoWithAll.h> #include <k/kAvlTmpl/kAvlEnum.h> #include <k/kAvlTmpl/kAvlGet.h> #include <k/kAvlTmpl/kAvlGetBestFit.h> #include <k/kAvlTmpl/kAvlGetWithParent.h> #include <k/kAvlTmpl/kAvlRemove2.h> #include <k/kAvlTmpl/kAvlRemoveBestFit.h> #include <k/kAvlTmpl/kAvlUndef.h> #endif ��������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kHlpProcess.h��������������������������������������������������0000664�0001750�0001750�00000003107�14670377513�022006� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kHlpProcess.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpProcess - Process Management. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpProcess_h___ #define ___k_kHlpProcess_h___ #include <k/kHlpDefs.h> #include <k/kTypes.h> /** @defgroup grp_kHlpProcess kHlpProcess - Process Management * @addtogroup grp_kHlp * @{*/ #ifdef __cplusplus extern "C" { #endif KHLP_DECL(void) kHlpExit(int rc); #ifdef __cplusplus } #endif /** @} */ #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/include/k/kLdr.h���������������������������������������������������������0000664�0001750�0001750�00000117404�14670377513�020453� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kLdr.h 117 2020-03-15 15:23:36Z bird $ */ /** @file * kLdr - The Dynamic Loader. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kLdr_h___ #define ___k_kLdr_h___ #ifdef __cplusplus extern "C" { #endif /* * Include the base typedefs and macros. */ #include <k/kDefs.h> #include <k/kTypes.h> #include <k/kCpus.h> /** @defgroup grp_kLdrBasic kLdr Basic Types * @{ */ /** The kLdr address type. */ typedef KU64 KLDRADDR; /** Pointer to a kLdr address. */ typedef KLDRADDR *PKLDRADDR; /** Pointer to a const kLdr address. */ typedef const KLDRADDR *PCKLDRADDR; /** NIL address. */ #define NIL_KLDRADDR (~(KU64)0) /** @def PRI_KLDRADDR * printf format type. */ #ifdef _MSC_VER # define PRI_KLDRADDR "I64x" #else # define PRI_KLDRADDR "llx" #endif /** Align a KSIZE value. */ #define KLDR_ALIGN_ADDR(val, align) ( ((val) + ((align) - 1)) & ~(KLDRADDR)((align) - 1) ) /** The kLdr size type. */ typedef KU64 KLDRSIZE; /** Pointer to a kLdr size. */ typedef KLDRSIZE *PKLDRSIZE; /** Pointer to a const kLdr size. */ typedef const KLDRSIZE *PCKLDRSIZE; /** @def PRI_KLDRSIZE * printf format type. */ #ifdef _MSC_VER # define PRI_KLDRSIZE "I64x" #else # define PRI_KLDRSIZE "llx" #endif /** The kLdr file offset type. */ typedef long KLDRFOFF; /** Pointer to a kLdr file offset type. */ typedef KLDRFOFF *PKLDRFOFF; /** Pointer to a const kLdr file offset type. */ typedef const KLDRFOFF *PCKLDRFOFF; /** @def PRI_KLDRFOFF * printf format type. */ #define PRI_KLDRFOFF "lx" /** * Union of all the integer types. */ typedef union KLDRU { KI8 i8; /**< KI8 view. */ KU8 u8; /**< KU8 view. */ KI16 i16; /**< KI16 view. */ KU16 u16; /**< KU16 view. */ KI32 i32; /**< KI32 view. */ KU32 u32; /**< KU32 view. */ KI64 i64; /**< KI64 view. */ KU64 u64; /**< KU64 view. */ KI8 ai8[8]; /**< KI8 array view . */ KU8 au8[8]; /**< KU8 array view. */ KI16 ai16[4];/**< KI16 array view . */ KU16 au16[4];/**< KU16 array view. */ KI32 ai32[2];/**< KI32 array view . */ KU32 au32[2];/**< KU32 array view. */ signed char ch; /**< signed char view. */ unsigned char uch; /**< unsigned char view. */ signed short s; /**< signed short view. */ unsigned short us; /**< unsigned short view. */ signed int i; /**< signed int view. */ unsigned int u; /**< unsigned int view. */ signed long l; /**< signed long view. */ unsigned long ul; /**< unsigned long view. */ void *pv; /**< void pointer view. */ KLDRADDR Addr; /**< kLdr address view. */ KLDRSIZE Size; /**< kLdr size view. */ } KLDRU; /** Pointer to an integer union. */ typedef KLDRU *PKLDRU; /** Pointer to a const integer union. */ typedef const KLDRU *PCKLDRU; /** * Union of pointers to all the integer types. */ typedef union KLDRPU { KI8 *pi8; /**< KI8 view. */ KU8 *pu8; /**< KU8 view. */ KI16 *pi16; /**< KI16 view. */ KU16 *pu16; /**< KU16 view. */ KI32 *pi32; /**< KI32 view. */ KU32 *pu32; /**< KU32 view. */ KI64 *pi64; /**< KI64 view. */ KU64 *pu64; /**< KU64 view. */ signed char *pch; /**< signed char view. */ unsigned char *puch; /**< unsigned char view. */ signed short *ps; /**< signed short view. */ unsigned short *pus; /**< unsigned short view. */ signed int *pi; /**< signed int view. */ unsigned int *pu; /**< unsigned int view. */ signed long *pl; /**< signed long view. */ unsigned long *pul; /**< unsigned long view. */ void *pv; /**< void pointer view. */ } KLDRPU; /** Pointer to an integer pointer union. */ typedef KLDRPU *PKLDRPU; /** Pointer to a const integer pointer union. */ typedef const KLDRPU *PCKLDRPU; /** @} */ /** @defgroup grp_kLdrMod kLdrMod - The executable image intepreter * @{ */ /** * Debug info type (from the loader point of view). */ typedef enum KLDRDBGINFOTYPE { /** The usual invalid enum value. */ KLDRDBGINFOTYPE_INVALID = 0, /** Unknown debug info format. */ KLDRDBGINFOTYPE_UNKNOWN, /** Stabs. */ KLDRDBGINFOTYPE_STABS, /** Debug With Arbitrary Record Format (DWARF). */ KLDRDBGINFOTYPE_DWARF, /** Microsoft Codeview debug info. */ KLDRDBGINFOTYPE_CODEVIEW, /** Watcom debug info. */ KLDRDBGINFOTYPE_WATCOM, /** IBM High Level Language debug info.. */ KLDRDBGINFOTYPE_HLL, /** The end of the valid debug info values (exclusive). */ KLDRDBGINFOTYPE_END, /** Blow the type up to 32-bit. */ KLDRDBGINFOTYPE_32BIT_HACK = 0x7fffffff } KLDRDBGINFOTYPE; /** Pointer to a kLdr debug info type. */ typedef KLDRDBGINFOTYPE *PKLDRDBGINFOTYPE; /** * Stack information. */ typedef struct KLDRSTACKINFO { /** The base address of the stack (sub) segment. * Set this to NIL_KLDRADDR if the module doesn't include any stack segment. */ KLDRADDR Address; /** The base address of the stack (sub) segment, link address. * Set this to NIL_KLDRADDR if the module doesn't include any stack (sub)segment. */ KLDRADDR LinkAddress; /** The stack size of the main thread. * If no stack (sub)segment in the module, this is the stack size of the main thread. * If the module doesn't contain this kind of information this field will be set to 0. */ KLDRSIZE cbStack; /** The stack size of non-main threads. * If the module doesn't contain this kind of information this field will be set to 0. */ KLDRSIZE cbStackThread; } KLDRSTACKINFO; /** Pointer to stack information. */ typedef KLDRSTACKINFO *PKLDRSTACKINFO; /** Pointer to const stack information. */ typedef const KLDRSTACKINFO *PCKLDRSTACKINFO; /** * Loader segment. */ typedef struct KLDRSEG { /** Variable free to use for the kLdr user. */ void *pvUser; /** The segment name. (Might not be zero terminated!) */ const char *pchName; /** The length of the segment name. */ KU32 cchName; /** The flat selector to use for the segment (i.e. data/code). * Primarily a way for the user to specify selectors for the LX/LE and NE interpreters. */ KU16 SelFlat; /** The 16-bit selector to use for the segment. * Primarily a way for the user to specify selectors for the LX/LE and NE interpreters. */ KU16 Sel16bit; /** Segment flags. */ KU32 fFlags; /** The segment protection. */ KPROT enmProt; /** The size of the segment. */ KLDRSIZE cb; /** The required segment alignment. * The to 0 if the segment isn't supposed to be mapped. */ KLDRADDR Alignment; /** The link address. * Set to NIL_KLDRADDR if the segment isn't supposed to be * mapped or if the image doesn't have link addresses. */ KLDRADDR LinkAddress; /** File offset of the segment. * Set to -1 if no file backing (like BSS). */ KLDRFOFF offFile; /** Size of the file bits of the segment. * Set to -1 if no file backing (like BSS). */ KLDRFOFF cbFile; /** The relative virtual address when mapped. * Set to NIL_KLDRADDR if the segment isn't supposed to be mapped. */ KLDRADDR RVA; /** The size of the segment including the alignment gap up to the next segment when mapped. */ KSIZE cbMapped; /** The address the segment was mapped at by kLdrModMap(). * Set to 0 if not mapped. */ KUPTR MapAddress; } KLDRSEG; /** @name Segment flags * @{ */ /** The segment is 16-bit. When not set the default of the target architecture is assumed. */ #define KLDRSEG_FLAG_16BIT 1 /** The segment requires a 16-bit selector alias. (OS/2) */ #define KLDRSEG_FLAG_OS2_ALIAS16 2 /** Conforming segment (x86 weirdness). (OS/2) */ #define KLDRSEG_FLAG_OS2_CONFORM 4 /** IOPL (ring-2) segment. (OS/2) */ #define KLDRSEG_FLAG_OS2_IOPL 8 /** @} */ /** * Loader module format. */ typedef enum KLDRFMT { /** The usual invalid 0 format. */ KLDRFMT_INVALID = 0, /** The native OS loader. */ KLDRFMT_NATIVE, /** The AOUT loader. */ KLDRFMT_AOUT, /** The ELF loader. */ KLDRFMT_ELF, /** The LX loader. */ KLDRFMT_LX, /** The Mach-O loader. */ KLDRFMT_MACHO, /** The PE loader. */ KLDRFMT_PE, /** The end of the valid format values (exclusive). */ KLDRFMT_END, /** Hack to blow the type up to 32-bit. */ KLDRFMT_32BIT_HACK = 0x7fffffff } KLDRFMT; /** * Loader module type. */ typedef enum KLDRTYPE { /** The usual invalid 0 type. */ KLDRTYPE_INVALID = 0, /** Object file. */ KLDRTYPE_OBJECT, /** Executable module, fixed load address. */ KLDRTYPE_EXECUTABLE_FIXED, /** Executable module, relocatable, non-fixed load address. */ KLDRTYPE_EXECUTABLE_RELOCATABLE, /** Executable module, position independent code, non-fixed load address. */ KLDRTYPE_EXECUTABLE_PIC, /** Shared library, fixed load address. * Typically a system library. */ KLDRTYPE_SHARED_LIBRARY_FIXED, /** Shared library, relocatable, non-fixed load address. */ KLDRTYPE_SHARED_LIBRARY_RELOCATABLE, /** Shared library, position independent code, non-fixed load address. */ KLDRTYPE_SHARED_LIBRARY_PIC, /** DLL that contains no code or data only imports and exports. (Chiefly OS/2.) */ KLDRTYPE_FORWARDER_DLL, /** Core or dump. */ KLDRTYPE_CORE, /** Debug module (debug info with empty code & data segments). */ KLDRTYPE_DEBUG_INFO, /** The end of the valid types values (exclusive). */ KLDRTYPE_END, /** Hack to blow the type up to 32-bit. */ KLDRTYPE_32BIT_HACK = 0x7fffffff } KLDRTYPE; /** * Loader endian indicator. */ typedef enum KLDRENDIAN { /** The usual invalid endian. */ KLDRENDIAN_INVALID, /** Little endian. */ KLDRENDIAN_LITTLE, /** Bit endian. */ KLDRENDIAN_BIG, /** Endianness doesn't have a meaning in the context. */ KLDRENDIAN_NA, /** The end of the valid endian values (exclusive). */ KLDRENDIAN_END, /** Hack to blow the type up to 32-bit. */ KLDRENDIAN_32BIT_HACK = 0x7fffffff } KLDRENDIAN; /** @name KLDRMOD::fFlags * @{ */ /** The link address doesn't form a contiguous image, from the first to the * last segment. */ #define KLDRMOD_FLAGS_NON_CONTIGUOUS_LINK_ADDRS K_BIT32(0) /** @} */ /** Pointer to a module interpreter method table. */ typedef struct KLDRMODOPS *PKLDRMODOPS; /** Pointer to const module interpreter methods table. */ typedef const struct KLDRMODOPS *PCKLDRMODOPS; /** * Module interpreter instance. * All members are read only unless you're kLdrMod or the module interpreter. */ typedef struct KLDRMOD { /** Magic number (KLDRMOD_MAGIC). */ KU32 u32Magic; /** The format of this module. */ KLDRFMT enmFmt; /** The type of module. */ KLDRTYPE enmType; /** The CPU architecture this module was built for. */ KCPUARCH enmArch; /** The minium cpu this module was built for. * This might not be accurate, so use kLdrModCanExecuteOn() to check. */ KCPU enmCpu; /** The endian used by the module. */ KLDRENDIAN enmEndian; /** Module open flags, KLDRMOD_OPEN_FLAGS_XXX. */ KU32 fFlags; /** The filename length (bytes). */ KU32 cchFilename; /** The filename. */ const char *pszFilename; /** The module name. */ const char *pszName; /** The module name length (bytes). */ KU32 cchName; /** The number of segments in the module. */ KU32 cSegments; /** Pointer to the loader methods. * Not meant for calling directly thru! */ PCKLDRMODOPS pOps; /** Pointer to the read instance. (Can be NULL after kLdrModDone().)*/ PKRDR pRdr; /** The module data. */ void *pvData; /** Segments. (variable size, can be zero) */ KLDRSEG aSegments[1]; } KLDRMOD, *PKLDRMOD, **PPKLDRMOD; /** The magic for KLDRMOD::u32Magic. (Kosuke Fujishima) */ #define KLDRMOD_MAGIC 0x19640707 /** Special base address value alias for the link address. */ #define KLDRMOD_BASEADDRESS_LINK (~(KLDRADDR)1) /** Special base address value alias for the actual load address (must be mapped). */ #define KLDRMOD_BASEADDRESS_MAP (~(KLDRADDR)2) /** Special import module ordinal value used to indicate that there is no * specific module associated with the requested symbol. */ #define NIL_KLDRMOD_IMPORT (~(KU32)0) /** Special symbol ordinal value used to indicate that the symbol * only has a string name. */ #define NIL_KLDRMOD_SYM_ORDINAL (~(KU32)0) /** @name Load symbol kind flags. * @{ */ /** The bitness doesn't matter. */ #define KLDRSYMKIND_NO_BIT 0x00000000 /** 16-bit symbol. */ #define KLDRSYMKIND_16BIT 0x00000001 /** 32-bit symbol. */ #define KLDRSYMKIND_32BIT 0x00000002 /** 64-bit symbol. */ #define KLDRSYMKIND_64BIT 0x00000003 /** Mask out the bit.*/ #define KLDRSYMKIND_BIT_MASK 0x00000003 /** We don't know the type of symbol. */ #define KLDRSYMKIND_NO_TYPE 0x00000000 /** The symbol is a code object (method/function/procedure/whateveryouwannacallit). */ #define KLDRSYMKIND_CODE 0x00000010 /** The symbol is a data object. */ #define KLDRSYMKIND_DATA 0x00000020 /** Mask out the symbol type. */ #define KLDRSYMKIND_TYPE_MASK 0x00000030 /** Valid symbol kind mask. */ #define KLDRSYMKIND_MASK 0x00000033 /** Weak symbol. */ #define KLDRSYMKIND_WEAK 0x00000100 /** Forwarder symbol. */ #define KLDRSYMKIND_FORWARDER 0x00000200 /** Request a flat symbol address. */ #define KLDRSYMKIND_REQ_FLAT 0x00000000 /** Request a segmented symbol address. */ #define KLDRSYMKIND_REQ_SEGMENTED 0x40000000 /** Request type mask. */ #define KLDRSYMKIND_REQ_TYPE_MASK 0x40000000 /** @} */ /** @name kLdrModEnumSymbols flags. * @{ */ /** Returns ALL kinds of symbols. The default is to only return public/exported symbols. */ #define KLDRMOD_ENUM_SYMS_FLAGS_ALL 0x00000001 /** @} */ /** * Callback for resolving imported symbols when applying fixups. * * @returns 0 on success and *pValue and *pfKind filled. * @returns Non-zero OS specific or kLdr status code on failure. * * @param pMod The module which fixups are begin applied. * @param iImport The import module ordinal number or NIL_KLDRMOD_IMPORT. * @param iSymbol The symbol ordinal number or NIL_KLDRMOD_SYM_ORDINAL. * @param pchSymbol The symbol name. Can be NULL if iSymbol isn't nil. Doesn't have to be null-terminated. * @param cchSymbol The length of the symbol. * @param pszVersion The symbol version. NULL if not versioned. * @param puValue Where to store the symbol value. * @param pfKind Where to store the symbol kind flags. * @param pvUser The user parameter specified to the relocation function. */ typedef int FNKLDRMODGETIMPORT(PKLDRMOD pMod, KU32 iImport, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PKLDRADDR puValue, KU32 *pfKind, void *pvUser); /** Pointer to a import callback. */ typedef FNKLDRMODGETIMPORT *PFNKLDRMODGETIMPORT; /** * Symbol enumerator callback. * * @returns 0 if enumeration should continue. * @returns non-zero if the enumeration should stop. This status code will then be returned by kLdrModEnumSymbols(). * * @param pMod The module which symbols are being enumerated.s * @param iSymbol The symbol ordinal number or NIL_KLDRMOD_SYM_ORDINAL. * @param pchSymbol The symbol name. This can be NULL if there is a symbol ordinal. * This can also be an empty string if the symbol doesn't have a name * or it's name has been stripped. * Important, this doesn't have to be a null-terminated string. * @param cchSymbol The length of the symbol. * @param pszVersion The symbol version. NULL if not versioned. * @param uValue The symbol value. * @param fKind The symbol kind flags. * @param pvUser The user parameter specified to kLdrModEnumSymbols(). */ typedef int FNKLDRMODENUMSYMS(PKLDRMOD pMod, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, KLDRADDR uValue, KU32 fKind, void *pvUser); /** Pointer to a symbol enumerator callback. */ typedef FNKLDRMODENUMSYMS *PFNKLDRMODENUMSYMS; /** * Debug info enumerator callback. * * @returns 0 to continue the enumeration. * @returns non-zero if the enumeration should stop. This status code will then be returned by kLdrModEnumDbgInfo(). * * @param pMod The module. * @param iDbgInfo The debug info ordinal number / id. * @param enmType The debug info type. * @param iMajorVer The major version number of the debug info format. -1 if unknow - implies invalid iMinorVer. * @param iMinorVer The minor version number of the debug info format. -1 when iMajorVer is -1. * @param pszPartNm The name of the debug info part, NULL if not applicable. * @param offFile The file offset *if* this type has one specific location in the executable image file. * This is -1 if there isn't any specific file location. * @param LinkAddress The link address of the debug info if it's loadable. NIL_KLDRADDR if not loadable. * @param cb The size of the debug information. -1 is used if this isn't applicable. * @param pszExtFile This points to the name of an external file containing the debug info. * This is NULL if there isn't any external file. * @param pvUser The user parameter specified to kLdrModEnumDbgInfo. */ typedef int FNKLDRENUMDBG(PKLDRMOD pMod, KU32 iDbgInfo, KLDRDBGINFOTYPE enmType, KI16 iMajorVer, KI16 iMinorVer, const char *pszPartNm, KLDRFOFF offFile, KLDRADDR LinkAddress, KLDRSIZE cb, const char *pszExtFile, void *pvUser); /** Pointer to a debug info enumerator callback. */ typedef FNKLDRENUMDBG *PFNKLDRENUMDBG; /** * Resource enumerator callback. * * @returns 0 to continue the enumeration. * @returns non-zero if the enumeration should stop. This status code will then be returned by kLdrModEnumResources(). * * @param pMod The module. * @param idType The resource type id. NIL_KLDRMOD_RSRC_TYPE_ID if no type id. * @param pszType The resource type name. NULL if no type name. * @param idName The resource id. NIL_KLDRMOD_RSRC_NAME_ID if no id. * @param pszName The resource name. NULL if no name. * @param idLang The language id. * @param AddrRsrc The address value for the resource. * @param cbRsrc The size of the resource. * @param pvUser The user parameter specified to kLdrModEnumDbgInfo. */ typedef int FNKLDRENUMRSRC(PKLDRMOD pMod, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, KLDRADDR AddrRsrc, KLDRSIZE cbRsrc, void *pvUser); /** Pointer to a resource enumerator callback. */ typedef FNKLDRENUMRSRC *PFNKLDRENUMRSRC; /** NIL resource name ID. */ #define NIL_KLDRMOD_RSRC_NAME_ID ( ~(KU32)0 ) /** NIL resource type ID. */ #define NIL_KLDRMOD_RSRC_TYPE_ID ( ~(KU32)0 ) /** @name Language ID * * Except for the special IDs #defined here, the values are considered * format specific for now since it's only used by the PE resources. * * @{ */ /** NIL language ID. */ #define NIL_KLDR_LANG_ID ( ~(KU32)0 ) /** Special language id value for matching any language. */ #define KLDR_LANG_ID_ANY ( ~(KU32)1 ) /** Special language id value indicating language neutral. */ #define KLDR_LANG_ID_NEUTRAL ( ~(KU32)2 ) /** Special language id value indicating user default language. */ #define KLDR_LANG_ID_USER_DEFAULT ( ~(KU32)3 ) /** Special language id value indicating system default language. */ #define KLDR_LANG_ID_SYS_DEFAULT ( ~(KU32)4 ) /** Special language id value indicating default custom locale. */ #define KLDR_LANG_ID_CUSTOM_DEFAULT ( ~(KU32)5 ) /** Special language id value indicating unspecified custom locale. */ #define KLDR_LANG_ID_CUSTOM_UNSPECIFIED ( ~(KU32)6 ) /** Special language id value indicating default custom MUI locale. */ #define KLDR_LANG_ID_UI_CUSTOM_DEFAULT ( ~(KU32)7 ) /** @} */ /** @name KLDRMOD_OPEN_FLAGS_XXX - Module Open Flags * @{ */ /** Indicates that we won't be loading the module, we're just getting * information (like symbols and line numbers) out of it. */ #define KLDRMOD_OPEN_FLAGS_FOR_INFO K_BIT32(0) /** Native: Non-stub kLdrModCallInit & kLdrModCallTerm. */ #define KLDRMOD_OPEN_FLAGS_NATIVE_ALLOW_INIT_TERM K_BIT32(1) /** Mask of valid flags. */ #define KLDRMOD_OPEN_FLAGS_VALID_MASK KU32_C(0x00000003) /** @} */ int kLdrModOpen(const char *pszFilename, KU32 fFlags, KCPUARCH enmCpuArch, PPKLDRMOD ppMod); int kLdrModOpenFromRdr(PKRDR pRdr, KU32 fFlags, KCPUARCH enmCpuArch, PPKLDRMOD ppMod); int kLdrModOpenNative(const char *pszFilename, KU32 fFlags, PPKLDRMOD ppMod); int kLdrModOpenNativeByHandle(KUPTR uHandle, KU32 fFlags, PPKLDRMOD ppMod); int kLdrModClose(PKLDRMOD pMod); int kLdrModQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind); int kLdrModEnumSymbols(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser); int kLdrModGetImport(PKLDRMOD pMod, const void *pvBits, KU32 iImport, char *pszName, KSIZE cchName); KI32 kLdrModNumberOfImports(PKLDRMOD pMod, const void *pvBits); int kLdrModCanExecuteOn(PKLDRMOD pMod, const void *pvBits, KCPUARCH enmArch, KCPU enmCpu); int kLdrModGetStackInfo(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRSTACKINFO pStackInfo); int kLdrModQueryMainEntrypoint(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRADDR pMainEPAddress); int kLdrModQueryImageUuid(PKLDRMOD pMod, const void *pvBits, void *pvUuid, KSIZE cbUuid); int kLdrModQueryResource(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, PKLDRADDR pAddrRsrc, KSIZE *pcbRsrc); int kLdrModEnumResources(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, PFNKLDRENUMRSRC pfnCallback, void *pvUser); int kLdrModEnumDbgInfo(PKLDRMOD pMod, const void *pvBits, PFNKLDRENUMDBG pfnCallback, void *pvUser); int kLdrModHasDbgInfo(PKLDRMOD pMod, const void *pvBits); int kLdrModMostlyDone(PKLDRMOD pMod); /** @name Operations On The Internally Managed Mapping * @{ */ int kLdrModMap(PKLDRMOD pMod); int kLdrModUnmap(PKLDRMOD pMod); int kLdrModReload(PKLDRMOD pMod); int kLdrModFixupMapping(PKLDRMOD pMod, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); /** @} */ /** @name Operations On The Externally Managed Mappings * @{ */ KLDRADDR kLdrModSize(PKLDRMOD pMod); int kLdrModGetBits(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); int kLdrModRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); /** @} */ /** @name Operations on both internally and externally managed mappings. * @{ */ /** Special pvMapping value to pass to kLdrModAllocTLS, * kLdrModFreeTLS, kLdrModCallInit, kLdrModCallTerm, and kLdrModCallThread that * specifies the internal mapping (kLdrModMap). */ #define KLDRMOD_INT_MAP ((void *)~(KUPTR)0) int kLdrModAllocTLS(PKLDRMOD pMod, void *pvMapping); void kLdrModFreeTLS(PKLDRMOD pMod, void *pvMapping); int kLdrModCallInit(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle); int kLdrModCallTerm(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle); int kLdrModCallThread(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle, unsigned fAttachingOrDetaching); /** @} */ /** * The loader module operation. */ typedef struct KLDRMODOPS { /** The name of this module interpreter. */ const char *pszName; /** Pointer to the next module interpreter. */ PCKLDRMODOPS pNext; /** * Create a loader module instance interpreting the executable image found * in the specified file provider instance. * * @returns 0 on success and *ppMod pointing to a module instance. * On failure, a non-zero OS specific error code is returned. * @param pOps Pointer to the registered method table. * @param pRdr The file provider instance to use. * @param fFlags Flags, MBZ. * @param enmCpuArch The desired CPU architecture. KCPUARCH_UNKNOWN means * anything goes, but with a preference for the current * host architecture. * @param offNewHdr The offset of the new header in MZ files. -1 if not found. * @param ppMod Where to store the module instance pointer. */ int (* pfnCreate)(PCKLDRMODOPS pOps, PKRDR pRdr, KU32 fFlags, KCPUARCH enmCpuArch, KLDRFOFF offNewHdr, PPKLDRMOD ppMod); /** * Destroys an loader module instance. * * The caller is responsible for calling kLdrModUnmap() and kLdrFreeTLS() first. * * @returns 0 on success, non-zero on failure. The module instance state * is unknown on failure, it's best not to touch it. * @param pMod The module. */ int (* pfnDestroy)(PKLDRMOD pMod); /** @copydoc kLdrModQuerySymbol */ int (* pfnQuerySymbol)(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind); /** @copydoc kLdrModEnumSymbols */ int (* pfnEnumSymbols)(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser); /** @copydoc kLdrModGetImport */ int (* pfnGetImport)(PKLDRMOD pMod, const void *pvBits, KU32 iImport, char *pszName, KSIZE cchName); /** @copydoc kLdrModNumberOfImports */ KI32 (* pfnNumberOfImports)(PKLDRMOD pMod, const void *pvBits); /** @copydoc kLdrModCanExecuteOn */ int (* pfnCanExecuteOn)(PKLDRMOD pMod, const void *pvBits, KCPUARCH enmArch, KCPU enmCpu); /** @copydoc kLdrModGetStackInfo */ int (* pfnGetStackInfo)(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRSTACKINFO pStackInfo); /** @copydoc kLdrModQueryMainEntrypoint */ int (* pfnQueryMainEntrypoint)(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRADDR pMainEPAddress); /** @copydoc kLdrModQueryImageUuid */ int (* pfnQueryImageUuid)(PKLDRMOD pMod, const void *pvBits, void *pvUuid, KSIZE pcbUuid); /** @copydoc kLdrModQueryResource */ int (* pfnQueryResource)(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, PKLDRADDR pAddrRsrc, KSIZE *pcbRsrc); /** @copydoc kLdrModEnumResources */ int (* pfnEnumResources)(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, PFNKLDRENUMRSRC pfnCallback, void *pvUser); /** @copydoc kLdrModEnumDbgInfo */ int (* pfnEnumDbgInfo)(PKLDRMOD pMod, const void *pvBits, PFNKLDRENUMDBG pfnCallback, void *pvUser); /** @copydoc kLdrModHasDbgInfo */ int (* pfnHasDbgInfo)(PKLDRMOD pMod, const void *pvBits); /** @copydoc kLdrModMap */ int (* pfnMap)(PKLDRMOD pMod); /** @copydoc kLdrModUnmap */ int (* pfnUnmap)(PKLDRMOD pMod); /** @copydoc kLdrModAllocTLS */ int (* pfnAllocTLS)(PKLDRMOD pMod, void *pvMapping); /** @copydoc kLdrModFreeTLS */ void (*pfnFreeTLS)(PKLDRMOD pMod, void *pvMapping); /** @copydoc kLdrModReload */ int (* pfnReload)(PKLDRMOD pMod); /** @copydoc kLdrModFixupMapping */ int (* pfnFixupMapping)(PKLDRMOD pMod, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); /** @copydoc kLdrModCallInit */ int (* pfnCallInit)(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle); /** @copydoc kLdrModCallTerm */ int (* pfnCallTerm)(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle); /** @copydoc kLdrModCallThread */ int (* pfnCallThread)(PKLDRMOD pMod, void *pvMapping, KUPTR uHandle, unsigned fAttachingOrDetaching); /** @copydoc kLdrModSize */ KLDRADDR (* pfnSize)(PKLDRMOD pMod); /** @copydoc kLdrModGetBits */ int (* pfnGetBits)(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); /** @copydoc kLdrModRelocateBits */ int (* pfnRelocateBits)(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); /** @copydoc kLdrModMostlyDone */ int (* pfnMostlyDone)(PKLDRMOD pMod); /** Dummy which should be assigned a non-zero value. */ KU32 uEndOfStructure; } KLDRMODOPS; /** @} */ /** @defgroup grp_kLdrDyld kLdrDyld - The dynamic loader * @{ */ /** The handle to a dynamic loader module. */ typedef struct KLDRDYLDMOD *HKLDRMOD; /** Pointer to the handle to a dynamic loader module. */ typedef HKLDRMOD *PHKLDRMOD; /** NIL handle value. */ #define NIL_HKLDRMOD ((HKLDRMOD)0) /** * File search method. * * In addition to it's own way of finding files, kLdr emulates * the methods employed by the most popular systems. */ typedef enum KLDRDYLDSEARCH { /** The usual invalid file search method. */ KLDRDYLD_SEARCH_INVALID = 0, /** Uses the kLdr file search method. * @todo invent me. */ KLDRDYLD_SEARCH_KLDR, /** Use the emulation closest to the host system. */ KLDRDYLD_SEARCH_HOST, /** Emulate the OS/2 file search method. * On non-OS/2 systems, BEGINLIBPATH, LIBPATH, ENDLIBPATH and LIBPATHSTRICT are * taken form the environment. */ KLDRDYLD_SEARCH_OS2, /** Emulate the standard window file search method. */ KLDRDYLD_SEARCH_WINDOWS, /** Emulate the alternative window file search method. */ KLDRDYLD_SEARCH_WINDOWS_ALTERED, /** Emulate the most common UNIX file search method. */ KLDRDYLD_SEARCH_UNIX_COMMON, /** End of the valid file search method values. */ KLDRDYLD_SEARCH_END, /** Hack to blow the type up to 32-bit. */ KLDRDYLD_SEARCH_32BIT_HACK = 0x7fffffff } KLDRDYLDSEARCH; /** @name kLdrDyldLoad and kLdrDyldFindByName flags. * @{ */ /** The symbols in the module should be loaded into the global unix namespace. * If not specified, the symbols are local and can only be referenced directly. */ #define KLDRYDLD_LOAD_FLAGS_GLOBAL_SYMBOLS 0x00000001 /** The symbols in the module should be loaded into the global unix namespace and * it's symbols should take precedence over all currently loaded modules. * This implies KLDRYDLD_LOAD_FLAGS_GLOBAL_SYMBOLS. */ #define KLDRYDLD_LOAD_FLAGS_DEEP_SYMBOLS 0x00000002 /** The module shouldn't be found by a global module search. * If not specified, the module can be found by unspecified module searches, * typical used when loading import/dep modules. */ #define KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE 0x00000004 /** Do a recursive initialization calls instead of defering them to the outermost call. */ #define KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT 0x00000008 /** We're loading the executable module. * @internal */ #define KLDRDYLD_LOAD_FLAGS_EXECUTABLE 0x40000000 /** @} */ int kLdrDyldLoad(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PHKLDRMOD phMod, char *pszErr, KSIZE cchErr); int kLdrDyldUnload(HKLDRMOD hMod); int kLdrDyldFindByName(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PHKLDRMOD phMod); int kLdrDyldFindByAddress(KUPTR Address, PHKLDRMOD phMod, KU32 *piSegment, KUPTR *poffSegment); int kLdrDyldGetName(HKLDRMOD hMod, char *pszName, KSIZE cchName); int kLdrDyldGetFilename(HKLDRMOD hMod, char *pszFilename, KSIZE cchFilename); int kLdrDyldQuerySymbol(HKLDRMOD hMod, KU32 uSymbolOrdinal, const char *pszSymbolName, const char *pszSymbolVersion, KUPTR *pValue, KU32 *pfKind); int kLdrDyldQueryResource(HKLDRMOD hMod, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, void **pvRsrc, KSIZE *pcbRsrc); int kLdrDyldEnumResources(HKLDRMOD hMod, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, PFNKLDRENUMRSRC pfnCallback, void *pvUser); /** @name OS/2 like API * @{ */ #if defined(__OS2__) # define KLDROS2API _System #else # define KLDROS2API #endif int kLdrDosLoadModule(char *pszObject, KSIZE cbObject, const char *pszModule, PHKLDRMOD phMod); int kLdrDosFreeModule(HKLDRMOD hMod); int kLdrDosQueryModuleHandle(const char *pszModname, PHKLDRMOD phMod); int kLdrDosQueryModuleName(HKLDRMOD hMod, KSIZE cchName, char *pszName); int kLdrDosQueryProcAddr(HKLDRMOD hMod, KU32 iOrdinal, const char *pszProcName, void **ppvProcAddr); int kLdrDosQueryProcType(HKLDRMOD hMod, KU32 iOrdinal, const char *pszProcName, KU32 *pfProcType); int kLdrDosQueryModFromEIP(PHKLDRMOD phMod, KU32 *piObject, KSIZE cbName, char *pszName, KUPTR *poffObject, KUPTR ulEIP); int kLdrDosReplaceModule(const char *pszOldModule, const char *pszNewModule, const char *pszBackupModule); int kLdrDosGetResource(HKLDRMOD hMod, KU32 idType, KU32 idName, void **pvResAddr); int kLdrDosQueryResourceSize(HKLDRMOD hMod, KU32 idType, KU32 idName, KU32 *pcb); int kLdrDosFreeResource(void *pvResAddr); /** @} */ /** @name POSIX like API * @{ */ HKLDRMOD kLdrDlOpen(const char *pszLibrary, int fFlags); const char *kLdrDlError(void); void * kLdrDlSym(HKLDRMOD hMod, const char *pszSymbol); int kLdrDlClose(HKLDRMOD hMod); /** @todo GNU extensions */ /** @} */ /** @name Win32 like API * @{ */ #if defined(_MSC_VER) # define KLDRWINAPI __stdcall #else # define KLDRWINAPI #endif HKLDRMOD KLDRWINAPI kLdrWLoadLibrary(const char *pszFilename); HKLDRMOD KLDRWINAPI kLdrWLoadLibraryEx(const char *pszFilename, void *hFileReserved, KU32 fFlags); KU32 KLDRWINAPI kLdrWGetModuleFileName(HKLDRMOD hMod, char *pszModName, KSIZE cchModName); HKLDRMOD KLDRWINAPI kLdrWGetModuleHandle(const char *pszFilename); int KLDRWINAPI kLdrWGetModuleHandleEx(KU32 fFlags, const char *pszFilename, HKLDRMOD hMod); void * KLDRWINAPI kLdrWGetProcAddress(HKLDRMOD hMod, const char *pszProcName); KU32 KLDRWINAPI kLdrWGetDllDirectory(KSIZE cchDir, char *pszDir); int KLDRWINAPI kLdrWSetDllDirectory(const char *pszDir); int KLDRWINAPI kLdrWFreeLibrary(HKLDRMOD hMod); int KLDRWINAPI kLdrWDisableThreadLibraryCalls(HKLDRMOD hMod); /** The handle to a resource that's been found. */ typedef struct KLDRWRSRCFOUND *HKLDRWRSRCFOUND; /** The handle to a loaded resource. */ typedef struct KLDRWRSRCLOADED *HKLDRWRSRCLOADED; HKLDRWRSRCFOUND KLDRWINAPI kLdrWFindResource(HKLDRMOD hMod, const char *pszType, const char *pszName); HKLDRWRSRCFOUND KLDRWINAPI kLdrWFindResourceEx(HKLDRMOD hMod, const char *pszType, const char *pszName, KU16 idLang); KU32 KLDRWINAPI kLdrWSizeofResource(HKLDRMOD hMod, HKLDRWRSRCFOUND hFoundRsrc); HKLDRWRSRCLOADED KLDRWINAPI kLdrWLoadResource(HKLDRMOD hMod, HKLDRWRSRCFOUND hFoundRsrc); void *KLDRWINAPI kLdrWLockResource(HKLDRMOD hMod, HKLDRWRSRCLOADED hLoadedRsrc); int KLDRWINAPI kLdrWFreeResource(HKLDRMOD hMod, HKLDRWRSRCLOADED hLoadedRsrc); typedef int (KLDRWINAPI *PFNKLDRWENUMRESTYPE)(HKLDRMOD hMod, const char *pszType, KUPTR uUser); int KLDRWINAPI kLdrWEnumResourceTypes(HKLDRMOD hMod, PFNKLDRWENUMRESTYPE pfnEnum, KUPTR uUser); int KLDRWINAPI kLdrWEnumResourceTypesEx(HKLDRMOD hMod, PFNKLDRWENUMRESTYPE pfnEnum, KUPTR uUser, KU32 fFlags, KU16 idLang); typedef int (KLDRWINAPI *PFNKLDRWENUMRESNAME)(HKLDRMOD hMod, const char *pszType, char *pszName, KUPTR uUser); int KLDRWINAPI kLdrWEnumResourceNames(HKLDRMOD hMod, const char *pszType, PFNKLDRWENUMRESNAME pfnEnum, KUPTR uUser); int KLDRWINAPI kLdrWEnumResourceNamesEx(HKLDRMOD hMod, const char *pszType, PFNKLDRWENUMRESNAME pfnEnum, KUPTR uUser, KU32 fFlags, KU16 idLang); typedef int (KLDRWINAPI *PFNKLDRWENUMRESLANG)(HKLDRMOD hMod, const char *pszType, const char *pszName, KU16 idLang, KUPTR uUser); int KLDRWINAPI kLdrWEnumResourceLanguages(HKLDRMOD hMod, const char *pszType, const char *pszName, PFNKLDRWENUMRESLANG pfnEnum, KUPTR uUser); int KLDRWINAPI kLdrWEnumResourceLanguagesEx(HKLDRMOD hMod, const char *pszType, const char *pszName, PFNKLDRWENUMRESLANG pfnEnum, KUPTR uUser, KU32 fFlags, KU16 idLang); /** @} */ /** @name Process Bootstrapping * @{ */ /** * Argument package from the stub. */ typedef struct KLDREXEARGS { /** Load & search flags, some which will become defaults. */ KU32 fFlags; /** The default search method. */ KLDRDYLDSEARCH enmSearch; /** The executable file that the stub is supposed to load. */ char szExecutable[260]; /** The default prefix used when searching for DLLs. */ char szDefPrefix[16]; /** The default suffix used when searching for DLLs. */ char szDefSuffix[16]; /** The LD_LIBRARY_PATH prefix for the process.. */ char szLibPath[4096 - sizeof(KU32) - sizeof(KLDRDYLDSEARCH) - 16 - 16 - 260]; } KLDREXEARGS, *PKLDREXEARGS; /** Pointer to a const argument package from the stub. */ typedef const KLDREXEARGS *PCKLDREXEARGS; void kLdrLoadExe(PCKLDREXEARGS pArgs, void *pvOS); /** @todo fix this mess... */ void kLdrDyldLoadExe(PCKLDREXEARGS pArgs, void *pvOS); /** @} */ /** @} */ /** @} */ #ifdef __cplusplus } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kTable/������������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�016725� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kTable/testcase/���������������������������������������������������������0000775�0001750�0001750�00000000000�14670377514�020540� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/��������������������������������������������������������������0000775�0001750�0001750�00000000000�14670377515�017543� 5����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/prfamd64msc.asm�����������������������������������������������0000664�0001750�0001750�00000032535�14670377514�022402� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; $Id: prfamd64msc.asm 29 2009-07-01 20:30:29Z bird $; ;; @file ; kProfiler Mark 2 - Microsoft C/C++ Compiler Interaction, AMD64. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; [section .data] ; g_fCalibrated: dd 0 g_OverheadAdj: dd 0 [section .text] extern KPRF_ENTER extern KPRF_LEAVE global _penter global _pexit ;ifdef UNDEFINED global common_return_path global common_overhead global common_no_overhead global calibrate global calib_inner_update_minimum global calib_inner_next global calib_outer_dec global calib_outer_inc global calib_done global calib_nullproc ;endif ;; ; On x86 the call to this function has been observed to be put before ; creating the stack frame, as the very first instruction in the function. ; ; Thus the stack layout is as follows: ; 24 return address of the calling function. ; 20 our return address - the address of the calling function + 5. ; 1c eax ; 18 edx ; 14 eflags ; 10 ecx ; c tsc high - param 3 ; 8 tsc low ; 4 frame pointer - param 2 ; 0 function ptr - param 1 ; ; align 16 _penter: ; save volatile register and get the time stamp. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; setting up the enter call frame mov r8d, edx shl r8, 32 or r8, rax ; param 3 - the timestamp mov [rsp + 20h], r8 ; save the tsc for later use. lea rdx, [rsp + 8*8 + 28h] ; Param 2 - default frame pointer mov rcx, [rdx] ; Param 1 - The function address ; MSC seems to put the _penter both before and after the typical sub rsp, xxh ; statement as if it cannot quite make up its mind. We'll try adjust for this ; to make the unwinding a bit more accurate wrt to longjmp/throw. But since ; there are also an uneven amount of push/pop around the _penter/_pexit we ; can never really make a perfect job of it. sigh. cmp word [rcx - 5 - 4], 08348h ; sub rsp, imm8 jne .not_byte_sub cmp byte [rcx - 5 - 2], 0ech jne .not_byte_sub movzx eax, byte [rcx - 5 - 1] ; imm8 add rdx, rax jmp .call_prf_enter .not_byte_sub: cmp word [rcx - 5 - 7], 08148h ; sub rsp, imm32 jne .not_dword_sub cmp byte [rcx - 5 - 5], 0ech jne .not_dword_sub mov eax, [rcx - 5 - 4] ; imm32 add rdx, rax ; jmp .call_prf_enter .not_dword_sub: .call_prf_enter: call KPRF_ENTER jmp common_return_path ;; ; On x86 the call to this function has been observed to be put right before ; return instruction. This fact matters since since we have to calc the same ; stack address as in _penter. ; ; Thus the stack layout is as follows: ; 24 return address of the calling function. ; 20 our return address - the address of the calling function + 5. ; 1c eax ; 18 edx ; 14 eflags ; 10 ecx ; c tsc high - param 3 ; 8 tsc low ; 4 frame pointer - param 2 ; 0 function ptr - param 1 ; ; align 16 _pexit: ; save volatile register and get the time stamp. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; setting up the enter call frame mov r8d, edx shl r8, 32 or r8, rax ; param 3 - the timestamp mov [rsp + 20h], r8 ; save the tsc for later use. lea rdx, [rsp + 8*8 + 28h] ; Param 2 - frame pointer. mov rcx, [rdx] ; Param 1 - The function address ; MSC some times put the _pexit before the add rsp, xxh. To try match up with ; any adjustments made in _penter, we'll try detect this. cmp word [rcx], 08348h ; add rsp, imm8 jne .not_byte_sub cmp byte [rcx + 2], 0c4h jne .not_byte_sub movzx eax, byte [rcx + 3] ; imm8 add rdx, rax jmp .call_prf_leave .not_byte_sub: cmp word [rcx], 08148h ; add rsp, imm32 jne .not_dword_sub cmp byte [rcx + 2], 0c4h jne .not_dword_sub mov eax, [rcx + 3] ; imm32 add rdx, rax ; jmp .call_prf_leave .not_dword_sub: .call_prf_leave: call KPRF_LEAVE jmp common_return_path ;; ; This is the common return path for both the enter and exit hooks. ; It's kept common because we can then use the same overhead adjustment ; and save some calibration efforts. It also saves space :-) align 16 common_return_path: ; Update overhead test rax, rax jz common_no_overhead cmp byte [g_fCalibrated wrt rip], 0 jnz common_overhead call calibrate common_overhead: mov rcx, rax ; rcx <- pointer to overhead counter. mov eax, [g_OverheadAdj wrt rip]; apply the adjustment before reading tsc sub [rsp + 20h], rax rdtsc shl rdx, 32 or rdx, rax ; rdx = 64-bit timestamp sub rdx, [rsp + 20h] ; rdx = elapsed lock add [rcx], rdx ; update counter. common_no_overhead: ; restore volatile registers. add rsp, 28h pop r11 pop r10 pop r9 pop r8 pop rcx popfq pop rdx pop rax ret ;; ; Data rsi points to while we're calibrating. struc CALIBDATA .Overhead resq 1 .Profiled resq 1 .EnterTS resq 1 .Min resq 1 endstruc align 16 ;; ; Do necessary calibrations. ; calibrate: ; prolog - save everything push rbp pushfq push rax ; pushaq push rbx push rcx push rdx push rdi push rsi push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 mov rbp, rsp sub rsp, CALIBDATA_size mov rsi, rsp ; rsi points to the CALIBDATA and rsp, -16 ; ; Indicate that we have finished calibrating. ; mov eax, 1 xchg dword [g_fCalibrated wrt rip], eax ; ; The outer loop - find the right adjustment. ; mov ebx, 200h ; loop counter. calib_outer_loop: ; ; The inner loop - calls the function number of times to establish a ; good minimum value ; mov ecx, 200h mov dword [rsi + CALIBDATA.Min], 0ffffffffh mov dword [rsi + CALIBDATA.Min + 4], 07fffffffh calib_inner_loop: ; zero the overhead and profiled times. xor eax, eax mov [rsi + CALIBDATA.Overhead], rax mov [rsi + CALIBDATA.Profiled], rax call calib_nullproc ; subtract the overhead mov rax, [rsi + CALIBDATA.Profiled] sub rax, [rsi + CALIBDATA.Overhead] ; update the minimum value. bt rax, 63 jc near calib_outer_dec ; if negative, just simplify and shortcut cmp rax, [rsi + CALIBDATA.Min] jge calib_inner_next calib_inner_update_minimum: mov [rsi + CALIBDATA.Min], rax calib_inner_next: loop calib_inner_loop ; Is the minimum value acceptable? test dword [rsi + CALIBDATA.Min + 4], 80000000h jnz calib_outer_dec ; simplify if negative. cmp dword [rsi + CALIBDATA.Min + 4], 0 jnz calib_outer_inc ; this shouldn't be possible cmp dword [rsi + CALIBDATA.Min], 1fh jbe calib_outer_dec ; too low - 2 ticks per pair is the minimum! ;cmp dword [rsi + CALIBDATA.Min], 30h ;jbe calib_done ; this is fine! cmp dword [rsi + CALIBDATA.Min], 70h ; - a bit weird... jbe calib_outer_next ; do the full 200h*200h iteration calib_outer_inc: inc dword [g_OverheadAdj wrt rip] jmp calib_outer_next calib_outer_dec: cmp dword [g_OverheadAdj wrt rip], 1 je calib_done dec dword [g_OverheadAdj wrt rip] calib_outer_next: dec ebx jnz calib_outer_loop calib_done: ; epilog - restore it all. mov rsp, rbp pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop rsi pop rdi pop rdx pop rcx pop rbx pop rax popfq pop rbp ret ;; ; The calibration _penter - this must be identical to the real thing except for the KPRF call. align 16 calib_penter: ; This part must be identical past the rdtsc. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; store the entry / stack frame. mov r8d, edx shl r8, 32 or r8, rax mov [rsp + 20h], r8 mov [rsi + CALIBDATA.EnterTS], r8 lea rax, [rsi + CALIBDATA.Overhead] jmp common_overhead ;; ; The calibration _pexit - this must be identical to the real thing except for the KPRF call. align 16 calib_pexit: ; This part must be identical past the rdtsc. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; store the entry / stack frame. mov r8d, edx shl r8, 32 or r8, rax mov [rsp + 20h], r8 sub r8, [rsi + CALIBDATA.EnterTS] add [rsi + CALIBDATA.Profiled], r8 lea rax, [rsi + CALIBDATA.EnterTS] jmp common_overhead ;; ; The 'function' we're profiling. ; The general idea is that each pair should take something like 2-10 ticks. ; ; (Btw. If we don't use multiple pairs here, we end up with the wrong result.) align 16 calib_nullproc: call calib_penter ;0 call calib_pexit call calib_penter ;1 call calib_pexit call calib_penter ;2 call calib_pexit call calib_penter ;3 call calib_pexit call calib_penter ;4 call calib_pexit call calib_penter ;5 call calib_pexit call calib_penter ;6 call calib_pexit call calib_penter ;7 call calib_pexit call calib_penter ;8 call calib_pexit call calib_penter ;9 call calib_pexit call calib_penter ;a call calib_pexit call calib_penter ;b call calib_pexit call calib_penter ;c call calib_pexit call calib_penter ;d call calib_pexit call calib_penter ;e call calib_pexit call calib_penter ;f call calib_pexit ret ; ; Dummy stack check function. ; global __chkstk __chkstk: ret �������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/prfcorepost.cpp.h���������������������������������������������0000664�0001750�0001750�00000002660�14670377514�023046� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: prfcorepost.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Post-Code Template. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /* * Clean up all our defines. */ #undef KPRF_OFFSETOF #undef KPRF_ALIGN #undef KPRF_SETMIN_ALIGN #undef KPRF_PTR2OFF #undef KPRF_OFF2PTREx #undef KPRF_OFF2PTR ��������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2WinApi-gencode.sed���������������������������������������0000664�0001750�0001750�00000007156�14670377514�023746� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: kPrf2WinApi-gencode.sed 29 2009-07-01 20:30:29Z bird $ ## @file # Generate code (for kernel32). # # # Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # Example: # BOOL WINAPI FindActCtxSectionGuid( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, const GUID * lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); # # Should be turned into: # typedef BOOL WINAPI FN_FindActCtxSectionGuid( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, const GUID * lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); # __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindActCtxSectionGuid( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, const GUID * lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ) # { # static FN_FindActCtxSectionGuid *pfn = 0; # if (!pfn) # kPrfWrapResolve((void **)&pfn, "FindActCtxSectionGuid", &g_Kernel32); # return pfn( dwFlags, lpExtensionGuid, ulSectionId, lpGuidToFind, ReturnedData ); # } # # Ignore empty lines. /^[[:space:]]*$/b delete # Some hacks. /([[:space:]]*VOID[[:space:]]*)/b no_hacking_void s/([[:space:]]*\([A-Z][A-Z0-9_]*\)[[:space:]]*)/( \1 a)/ :no_hacking_void # Save the pattern space. h # Make the typedef. s/[[:space:]]\([A-Za-z_][A-Za-z0-9_]*\)(/ FN_\1(/ s/^/typedef / p # Function definition g s/\n//g s/\r//g s/[[:space:]]\([A-Za-z_][A-Za-z0-9_]*\)(/ kPrf2Wrap_\1(/ s/^/__declspec(dllexport) / s/;// p i\ { # static FN_FindActCtxSectionGuid *pfn = 0; # if (!pfn) g s/^.*[[:space:]]\([A-Za-z_][A-Za-z0-9_]*\)(.*$/ static FN_\1 *pfn = 0;/ p i\ if (!pfn) # kPrfWrapResolve((void **)&pfn, "FindActCtxSectionGuid", &g_Kernel32); g s/^.*[[:space:]]\([A-Za-z_][A-Za-z0-9_]*\)(.*$/ kPrf2WrapResolve((void **)\&pfn, "\1\", \&g_Kernel32);/ p # The invocation and return statement. # Some trouble here.... g /^VOID WINAPI/b void_return /^void WINAPI/b void_return /^VOID __cdecl/b void_return /^void __cdecl/b void_return /^VOID NTAPI/b void_return /^void NTAPI/b void_return s/^.*(/ return pfn(/ b morph_params :void_return s/^.*(/ pfn(/ :morph_params s/ *\[\] *// s/ \*/ /g s/, *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *)\)/, \1/g s/( *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *[,)]\)/( \1/g s/, *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *,\)/, \1/g s/, *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *,\)/, \1/g s/, *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *,\)/, \1/g s/, *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *,\)/, \1/g s/( VOID )/ ()/ s/( void )/ ()/ p i\ } i\ # Done :delete d ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2WinApi-dumpbin.sed���������������������������������������0000664�0001750�0001750�00000004354�14670377514�023775� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: kPrf2WinApi-dumpbin.sed 29 2009-07-01 20:30:29Z bird $ ## @file # Strip down dumpbin /export output. # # # Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # # State switch # x /^exports$/b exports /^summary$/b summary b header # # Header # :header x /^[[:space:]][[:space:]]*ordinal[[:space:]]*name[[:space:]]*$/b switch_to_exports b drop_line # # Exports # :switch_to_exports s/^.*$/exports/ h b drop_line :exports x /^[[:space:]][[:space:]]*Summary[[:space:]]*$/b switch_to_summary s/^[[:space:]]*// s/[[:space:]]*$// s/[[:space:]][[:space:]]*/ /g /^$/b drop_line # Filter out APIs that hasn't been implemented. /AddLocalAlternateComputerNameA/b drop_line /AddLocalAlternateComputerNameW/b drop_line /EnumerateLocalComputerNamesA/b drop_line /EnumerateLocalComputerNamesW/b drop_line /RemoveLocalAlternateComputerNameA/b drop_line /RemoveLocalAlternateComputerNameW/b drop_line /SetLocalPrimaryComputerNameA/b drop_line /SetLocalPrimaryComputerNameW/b drop_line /__C_specific_handler/b drop_line /__misaligned_access/b drop_line /_local_unwind/b drop_line b end # # Summary # :switch_to_summary s/^.*$/summary/ h b drop_line :summary x b drop_line # # Tail # :drop_line d :end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.h���������������������������������������0000664�0001750�0001750�00000003003�14670377514�024010� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kPrf2WinApiWrapperHlp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * Helpers for the Windows API wrapper DLL. */ /* * Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ typedef struct KPRF2WRAPDLL { HMODULE hmod; char szName[32]; } KPRF2WRAPDLL; typedef KPRF2WRAPDLL *PKPRF2WRAPDLL; typedef KPRF2WRAPDLL const *PCKPRF2WRAPDLL; FARPROC kPrf2WrapResolve(void **ppfn, const char *pszName, PKPRF2WRAPDLL pDll); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/prfcore.cpp.h�������������������������������������������������0000664�0001750�0001750�00000050261�14670377514�022140� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: prfcore.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Code Template. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Gets a function, create a new one if necessary. */ static KPRF_TYPE(P,FUNC) KPRF_NAME(GetFunction)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(,UPTR) uPC) { /* * Perform a binary search of the function lookup table. */ KPRF_TYPE(P,FUNC) paFunctions = KPRF_OFF2PTR(P,FUNC, pHdr->offFunctions, pHdr); KPRF_FUNCS_READ_LOCK(); KI32 iStart = 0; KI32 iLast = pHdr->cFunctions - 1; KI32 i = iLast / 2; for (;;) { KU32 iFunction = pHdr->aiFunctions[i]; KPRF_TYPE(,IPTR) iDiff = uPC - paFunctions[iFunction].uEntryPtr; if (!iDiff) { KPRF_FUNCS_READ_UNLOCK(); return &paFunctions[iFunction]; } if (iLast == iStart) break; if (iDiff < 0) iLast = i - 1; else iStart = i + 1; if (iLast < iStart) break; i = iStart + (iLast - iStart) / 2; } KPRF_FUNCS_READ_UNLOCK(); /* * It wasn't found, try add it. */ if (pHdr->cFunctions < pHdr->cMaxFunctions) return KPRF_NAME(NewFunction)(pHdr, uPC); return NULL; } /** * Unwind one frame. */ static KU64* KPRF_NAME(UnwindOne)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(P,STACK) pStack, KPRF_TYPE(,UPTR) uPC, KU64 TS) { /* * Pop off the frame and update the frame below / thread. */ KPRF_TYPE(P,FRAME) pFrame = &pStack->aFrames[--pStack->cFrames]; KU64 *pCurOverheadTicks; if (pStack->cFrames) { KPRF_TYPE(P,FRAME) pTopFrame = pFrame - 1; pTopFrame->OverheadTicks += pFrame->OverheadTicks + pFrame->CurOverheadTicks; pTopFrame->SleepTicks += pFrame->SleepTicks; pTopFrame->OnTopOfStackStart = TS; pTopFrame->CurOverheadTicks = 0; pCurOverheadTicks = &pTopFrame->CurOverheadTicks; } else { KPRF_TYPE(P,THREAD) pThread = KPRF_OFF2PTR(P,THREAD, pStack->offThread, pHdr); pThread->ProfiledTicks += TS - pFrame->OnStackStart - pFrame->CurOverheadTicks - pFrame->OverheadTicks - pFrame->SleepTicks; pThread->OverheadTicks += pFrame->OverheadTicks + pFrame->CurOverheadTicks; pThread->SleepTicks += pFrame->SleepTicks; pCurOverheadTicks = &pThread->OverheadTicks; } /* * Update the function (if any). */ if (pFrame->offFunction) { KPRF_TYPE(P,FUNC) pFunc = KPRF_OFF2PTR(P,FUNC, pFrame->offFunction, pHdr); /* Time on stack */ KU64 Ticks = TS - pFrame->OnStackStart; Ticks -= pFrame->OverheadTicks + pFrame->CurOverheadTicks + pFrame->SleepTicks; /** @todo adjust overhead */ KPRF_ASSERT(!(Ticks >> 63)); if (pFunc->OnStack.MinTicks > Ticks) KPRF_ATOMIC_SET64(&pFunc->OnStack.MinTicks, Ticks); if (pFunc->OnStack.MaxTicks < Ticks) KPRF_ATOMIC_SET64(&pFunc->OnStack.MaxTicks, Ticks); KPRF_ATOMIC_ADD64(&pFunc->OnStack.SumTicks, Ticks); /* Time on top of stack */ Ticks = TS - pFrame->OnTopOfStackStart; Ticks -= pFrame->CurOverheadTicks; Ticks += pFrame->OnTopOfStackTicks; /** @todo adjust overhead */ KPRF_ASSERT(!(Ticks >> 63)); if (pFunc->OnTopOfStack.MinTicks > Ticks) KPRF_ATOMIC_SET64(&pFunc->OnTopOfStack.MinTicks, Ticks); if (pFunc->OnTopOfStack.MaxTicks < Ticks) KPRF_ATOMIC_SET64(&pFunc->OnTopOfStack.MaxTicks, Ticks); KPRF_ATOMIC_ADD64(&pFunc->OnTopOfStack.SumTicks, Ticks); /* calls */ if (pFrame->cCalls) KPRF_ATOMIC_ADD64(&pFunc->cCalls, pFrame->cCalls); } return pCurOverheadTicks; } /** * Unwinds the stack. * * On MSC+AMD64 we have to be very very careful here, because the uFramePtr cannot be trusted. */ static KU64* KPRF_NAME(UnwindInt)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(P,STACK) pStack, KPRF_TYPE(,UPTR) uPC, KPRF_TYPE(,UPTR) uFramePtr, KU64 TS) { /** @todo need to deal with alternative stacks! */ /* * Pop the stack until we're down below the current frame (uFramePtr). */ KI32 iFrame = pStack->cFrames - 1; KPRF_TYPE(P,FRAME) pFrame = &pStack->aFrames[iFrame]; /* the most frequent case first. */ #if K_OS == K_OS_WINDOWS && K_ARCH == K_ARCH_AMD64 if ( uFramePtr == pFrame->uFramePtr || ( pFrame->uFramePtr < uFramePtr && iFrame > 0 && pFrame[-1].uFramePtr > uFramePtr)) return KPRF_NAME(UnwindOne)(pHdr, pStack, uPC, TS); #else if (uFramePtr == pFrame->uFramePtr) return KPRF_NAME(UnwindOne)(pHdr, pStack, uPC, TS); #endif /* none? */ if (pFrame->uFramePtr > uFramePtr) return &pFrame->CurOverheadTicks; /* one or more, possibly all */ KU64 *pCurOverheadTicks = KPRF_NAME(UnwindOne)(pHdr, pStack, uPC, TS); pFrame--; if ( iFrame > 0 #if K_OS == K_OS_WINDOWS && K_ARCH == K_ARCH_AMD64 && pFrame->uFramePtr <= uFramePtr && pFrame[-1].uFramePtr > uFramePtr) #else && pFrame->uFramePtr <= uFramePtr) #endif { KPRF_TYPE(P,THREAD) pThread = KPRF_OFF2PTR(P,THREAD, pStack->offThread, pHdr); pThread->cUnwinds++; /* (This is the reason for what looks like a bad loop unrolling.) */ pCurOverheadTicks = KPRF_NAME(UnwindOne)(pHdr, pStack, uPC, TS); iFrame -= 2; pFrame--; #if K_OS == K_OS_WINDOWS && K_ARCH == K_ARCH_AMD64 while ( iFrame > 0 && pFrame->uFramePtr <= uFramePtr && pFrame[-1].uFramePtr > uFramePtr) #else while ( iFrame >= 0 && pFrame->uFramePtr <= uFramePtr) #endif { pCurOverheadTicks = KPRF_NAME(UnwindOne)(pHdr, pStack, uPC, TS); iFrame--; pFrame--; } } return pCurOverheadTicks; } /** * Enter function. * * @returns Where to account overhead. * @returns NULL if profiling is inactive. * * @param uPC The program counter register. (not relative) * @param uFramePtr The stack frame address. This must match the one passed to kPrfLeave. (not relative) * @param TS The timestamp when we entered into the profiler. * This must not be modified touched! * * @internal ? */ KPRF_DECL_FUNC(KU64 *, Enter)(KPRF_TYPE(,UPTR) uPC, KPRF_TYPE(,UPTR) uFramePtr, const KU64 TS) { /* * Is profiling active ? */ if (!KPRF_IS_ACTIVE()) return NULL; /* * Get the header and adjust input addresses. */ KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); if (!pHdr) return NULL; const KPRF_TYPE(,UPTR) uBasePtr = pHdr->uBasePtr; if (uBasePtr) { uFramePtr -= uBasePtr; uPC -= uBasePtr; } /* * Get the current thread. Reject unknown, inactive (in whatever way), * and thread which has performed a stack switch. */ KPRF_TYPE(P,THREAD) pThread = KPRF_GET_THREAD(); if (!pThread) return NULL; KPRF_TYPE(,THREADSTATE) enmThreadState = pThread->enmState; if ( enmThreadState != KPRF_TYPE(,THREADSTATE_ACTIVE) && enmThreadState != KPRF_TYPE(,THREADSTATE_OVERFLOWED) ) return NULL; if (pThread->uStackBasePtr < uFramePtr) /* ASSUMES stack direction */ { pThread->cStackSwitchRejects++; return NULL; } pThread->enmState = KPRF_TYPE(,THREADSTATE_SUSPENDED); /* * Update the thread statistics. */ pThread->cCalls++; KPRF_TYPE(,UPTR) cbStack = pThread->uStackBasePtr - uFramePtr; /* ASSUMES stack direction */ if (pThread->cbMaxStack < cbStack) pThread->cbMaxStack = cbStack; /* * Check if an longjmp or throw has taken place. * This check will not work if a stack switch has taken place (can fix that later). */ KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pThread->offStack, pHdr); KU32 iFrame = pStack->cFrames; KPRF_TYPE(P,FRAME) pFrame = &pStack->aFrames[iFrame]; if ( iFrame #if K_OS == K_OS_WINDOWS && K_ARCH == K_ARCH_AMD64 && 0) /* don't bother her yet because of _penter/_pexit frame problems. */ #else && pThread->uStackBasePtr >= uFramePtr /* ASSUMES stack direction */ && pFrame[-1].uFramePtr + (KPRF_BITS - 8) / 8 < uFramePtr) /* ASSUMES stack direction */ #endif { KPRF_NAME(UnwindInt)(pHdr, pStack, uPC, uFramePtr, TS); iFrame = pStack->cFrames; } /* * Allocate a new stack frame. */ if (iFrame >= pHdr->cMaxStackFrames) { /* overflow */ pThread->enmState = KPRF_TYPE(,THREADSTATE_OVERFLOWED); pThread->cOverflows += enmThreadState != KPRF_TYPE(,THREADSTATE_OVERFLOWED); return &pStack->aFrames[iFrame - 1].CurOverheadTicks; } pStack->cFrames++; /* * Update the old top frame if any. */ if (iFrame) { KPRF_TYPE(P,FRAME) pOldFrame = pFrame - 1; pOldFrame->OnTopOfStackTicks += TS - pOldFrame->OnTopOfStackStart; pOldFrame->cCalls++; } /* * Fill in the new frame. */ pFrame->CurOverheadTicks = 0; pFrame->OverheadTicks = 0; pFrame->SleepTicks = 0; pFrame->OnStackStart = TS; pFrame->OnTopOfStackStart = TS; pFrame->OnTopOfStackTicks = 0; pFrame->cCalls = 0; pFrame->uFramePtr = uFramePtr; /* * Find the relevant function. */ KPRF_TYPE(P,FUNC) pFunc = KPRF_NAME(GetFunction)(pHdr, uPC); if (pFunc) { pFrame->offFunction = KPRF_PTR2OFF(pFunc, pHdr); pFunc->cOnStack++; } else pFrame->offFunction = 0; /* * Nearly done, We only have to reactivate the thread and account overhead. * The latter is delegated to the caller. */ pThread->enmState = KPRF_TYPE(,THREADSTATE_ACTIVE); return &pFrame->CurOverheadTicks; } /** * Leave function. * * @returns Where to account overhead. * @returns NULL if profiling is inactive. * * @param uPC The program counter register. * @param uFramePtr The stack frame address. This must match the one passed to kPrfEnter. * @param TS The timestamp when we entered into the profiler. * This must not be modified because the caller could be using it! * @internal */ KPRF_DECL_FUNC(KU64 *, Leave)(KPRF_TYPE(,UPTR) uPC, KPRF_TYPE(,UPTR) uFramePtr, const KU64 TS) { /* * Is profiling active ? */ if (!KPRF_IS_ACTIVE()) return NULL; /* * Get the header and adjust input addresses. */ KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); if (!pHdr) return NULL; const KPRF_TYPE(,UPTR) uBasePtr = pHdr->uBasePtr; if (uBasePtr) { uFramePtr -= uBasePtr; uPC -= uBasePtr; } /* * Get the current thread and suspend profiling of the thread until we leave this function. * Also reject threads which aren't active in some way. */ KPRF_TYPE(P,THREAD) pThread = KPRF_GET_THREAD(); if (!pThread) return NULL; KPRF_TYPE(,THREADSTATE) enmThreadState = pThread->enmState; if ( enmThreadState != KPRF_TYPE(,THREADSTATE_ACTIVE) && enmThreadState != KPRF_TYPE(,THREADSTATE_OVERFLOWED) ) return NULL; KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pThread->offStack, pHdr); if (!pStack->cFrames) return NULL; pThread->enmState = KPRF_TYPE(,THREADSTATE_SUSPENDED); /* * Unwind the stack down to and including the entry indicated by uFramePtr. * Leave it to the caller to update the overhead. */ KU64 *pCurOverheadTicks = KPRF_NAME(UnwindInt)(pHdr, pStack, uPC, uFramePtr, TS); pThread->enmState = enmThreadState; return pCurOverheadTicks; } /** * Register the current thread. * * A thread can only be profiled if it has been registered by a call to this function. * * @param uPC The program counter register. * @param uStackBasePtr The base of the stack. */ KPRF_DECL_FUNC(KPRF_TYPE(P,THREAD), RegisterThread)(KPRF_TYPE(,UPTR) uStackBasePtr, const char *pszName) { /* * Get the header and adjust input address. * (It doesn't matter whether we're active or not.) */ KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); if (!pHdr) return NULL; const KPRF_TYPE(,UPTR) uBasePtr = pHdr->uBasePtr; if (uBasePtr) uStackBasePtr -= uBasePtr; /* * Allocate a thread and a stack. */ KPRF_THREADS_LOCK(); if (pHdr->cThreads < pHdr->cMaxThreads) { KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pHdr->offStacks, pHdr); KU32 cLeft = pHdr->cMaxStacks; do { if (!pStack->offThread) { /* init the stack. */ pStack->cFrames = 0; pStack->offThread = pHdr->offThreads + pHdr->cbThread * pHdr->cThreads++; pHdr->cStacks++; /* init the thread */ KPRF_TYPE(P,THREAD) pThread = KPRF_OFF2PTR(P,THREAD, pStack->offThread, pHdr); pThread->ThreadId = KPRF_GET_THREADID(); unsigned i = 0; if (pszName) while (i < sizeof(pThread->szName) - 1 && *pszName) pThread->szName[i++] = *pszName++; while (i < sizeof(pThread->szName)) pThread->szName[i++] = '\0'; pThread->enmState = KPRF_TYPE(,THREADSTATE_SUSPENDED); pThread->Reserved0 = KPRF_TYPE(,THREADSTATE_TERMINATED); pThread->uStackBasePtr = uStackBasePtr; pThread->cbMaxStack = 0; pThread->cCalls = 0; pThread->cOverflows = 0; pThread->cStackSwitchRejects = 0; pThread->cUnwinds = 0; pThread->ProfiledTicks = 0; pThread->OverheadTicks = 0; pThread->SleepTicks = 0; pThread->offStack = KPRF_PTR2OFF(pStack, pHdr); /* set the thread and make it active. */ KPRF_THREADS_UNLOCK(); KPRF_SET_THREAD(pThread); pThread->enmState = KPRF_TYPE(,THREADSTATE_ACTIVE); return pThread; } /* next */ pStack = KPRF_TYPE(P,STACK)(((KPRF_TYPE(,UPTR))pStack + pHdr->cbStack)); } while (--cLeft > 0); } KPRF_THREADS_UNLOCK(); return NULL; } /** * Terminates a thread. * * To terminate the current thread use DeregisterThread(), because that * cleans up the TLS entry too. * * @param pHdr The profiler data set header. * @param pThread The thread to terminate. * @param TS The timestamp to use when terminating the thread. */ KPRF_DECL_FUNC(void, TerminateThread)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(P,THREAD) pThread, KU64 TS) { if (pThread->enmState == KPRF_TYPE(,THREADSTATE_TERMINATED)) return; pThread->enmState = KPRF_TYPE(,THREADSTATE_TERMINATED); /* * Unwind the entire stack. */ if (pThread->offStack) { KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pThread->offStack, pHdr); for (KU32 cFrames = pStack->cFrames; cFrames > 0; cFrames--) KPRF_NAME(UnwindOne)(pHdr, pStack, 0, TS); /* * Free the stack. */ pThread->offStack = 0; KPRF_THREADS_LOCK(); pStack->offThread = 0; pHdr->cStacks--; KPRF_THREADS_UNLOCK(); } } /** * Deregister (terminate) the current thread. */ KPRF_DECL_FUNC(void, DeregisterThread)(void) { KU64 TS = KPRF_NOW(); /* * Get the header, then get the thread and mark it terminated. * (It doesn't matter whether we're active or not.) */ KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); if (!pHdr) return; KPRF_TYPE(P,THREAD) pThread = KPRF_GET_THREAD(); KPRF_SET_THREAD(NULL); if (!pThread) return; KPRF_NAME(TerminateThread)(pHdr, pThread, TS); } /** * Resumes / restarts a thread. * * @param fReset If set the stack is reset. */ KPRF_DECL_FUNC(void, ResumeThread)(int fReset) { KU64 TS = KPRF_NOW(); /* * Get the header, then get the thread and mark it terminated. * (It doesn't matter whether we're active or not.) */ KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); if (!pHdr) return; KPRF_TYPE(P,THREAD) pThread = KPRF_GET_THREAD(); if (!pThread) return; if (pThread->enmState != KPRF_TYPE(,THREADSTATE_SUSPENDED)) return; /* * Reset (unwind) the stack? */ KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pThread->offStack, pHdr); if (fReset) { KU32 cFrames = pStack->cFrames; while (cFrames-- > 0) KPRF_NAME(UnwindOne)(pHdr, pStack, 0, TS); } /* * If we've got any thing on the stack, we'll have to stop the sleeping period. */ else if (pStack->cFrames > 0) { KPRF_TYPE(P,FRAME) pFrame = &pStack->aFrames[pStack->cFrames - 1]; /* update the sleeping time and set the start of the new top-of-stack period. */ pFrame->SleepTicks += TS - pFrame->OnTopOfStackStart; pFrame->OnTopOfStackStart = TS; } /** @todo we're not accounting overhead here! */ /* * We're done, switch the thread to active state. */ pThread->enmState = KPRF_TYPE(,THREADSTATE_ACTIVE); } /** * Suspend / completes a thread. * * The thread will be in a suspend state where the time will be accounted for as sleeping. * * @param fUnwind If set the stack is unwound and the thread statistics updated. */ KPRF_DECL_FUNC(void, SuspendThread)(int fUnwind) { KU64 TS = KPRF_NOW(); /* * Get the header, then get the thread and mark it terminated. * (It doesn't matter whether we're active or not.) */ KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); if (!pHdr) return; KPRF_TYPE(P,THREAD) pThread = KPRF_GET_THREAD(); if (!pThread) return; if ( pThread->enmState != KPRF_TYPE(,THREADSTATE_ACTIVE) && pThread->enmState != KPRF_TYPE(,THREADSTATE_OVERFLOWED) && (pThread->enmState != KPRF_TYPE(,THREADSTATE_SUSPENDED) || fUnwind)) return; pThread->enmState = KPRF_TYPE(,THREADSTATE_SUSPENDED); /* * Unwind the stack? */ KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pThread->offStack, pHdr); if (fUnwind) { KU32 cFrames = pStack->cFrames; while (cFrames-- > 0) KPRF_NAME(UnwindOne)(pHdr, pStack, 0, TS); } /* * If we've got any thing on the stack, we'll have to record the sleeping period * of the thread. If not we'll ignore it (for now at least). */ else if (pStack->cFrames > 0) { KPRF_TYPE(P,FRAME) pFrame = &pStack->aFrames[pStack->cFrames - 1]; /* update the top of stack time and set the start of the sleep period. */ pFrame->OnTopOfStackTicks += TS - pFrame->OnTopOfStackStart; pFrame->OnTopOfStackStart = TS; } /** @todo we're not accounting overhead here! */ } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/prfcore.h.h���������������������������������������������������0000664�0001750�0001750�00000033034�14670377514�021604� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: prfcore.h.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Header Template. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** @def KPRF_NAME * Mixed case name macro. */ #ifndef KPRF_NAME # define KPRF_NAME(Name) Name #endif /** @def KPRF_TYPE * Upper case type name macro. */ #ifndef KPRF_TYPE # define KPRF_TYPE(Prefix,Name) Prefix##Name #endif /** @type KPRF_DECL_FUNC * The calling convention used. */ #ifndef KPRF_DECL_FUNC # define KPRF_DECL_FUNC(type, name) type name #endif /** @def KPRF_BITS * The bitsize of the format. */ #ifndef KPRF_BITS # define KPRF_BITS 32 #endif /** @type UPTR * The basic unsigned interger pointer type. */ /** @type IPTR * The basic signed interger pointer type. */ #if KPRF_BITS == 16 typedef KU16 KPRF_TYPE(,UPTR); typedef KI16 KPRF_TYPE(,IPTR); #elif KPRF_BITS == 32 typedef KU32 KPRF_TYPE(,UPTR); typedef KI32 KPRF_TYPE(,IPTR); #elif KPRF_BITS == 64 typedef KU64 KPRF_TYPE(,UPTR); typedef KI64 KPRF_TYPE(,IPTR); #else # error "KPRF_BITS has an invalid value. Supported values are 16, 32 and 64." #endif /** @type KPRF_TYPE(P,UPTR) * Pointer to the basic pointer type. */ typedef KPRF_TYPE(,UPTR) *KPRF_TYPE(P,UPTR); /** * Various constants. */ enum KPRF_TYPE(,CONSTANTS) { /** Magic for the profiler header. (Unix Epoc) */ KPRF_TYPE(,HDR_MAGIC) = 0x19700101 }; /** * The profile data header. */ typedef struct KPRF_TYPE(,HDR) { /** [0] The magic number for file data. (KPRF_TYPE(,HDR_MAGIC)) */ KU32 u32Magic; /** [4] KPRF_BITS. */ KU32 cFormatBits; /** [8] The base address which all pointers should be relative to. */ KPRF_TYPE(,UPTR) uBasePtr; #if KPRF_BITS <= 16 /** [a] Reserved. */ KU16 u16Reserved; #endif #if KPRF_BITS <= 32 /** [c] Reserved. */ KU32 u32Reserved; #endif /** [10] The size of this data set. */ KU32 cb; /** [10] The allocated data set size. */ KU32 cbAllocated; /** [18] The max number of functions the function table can hold. */ KU32 cMaxFunctions; /** [1c] The current number of functions in the function table. */ KU32 cFunctions; /** [20] The offset of the function table (relative to this header). */ KU32 offFunctions; /** [24] The size of a function entry. */ KU32 cbFunction; /** [28] The max number of bytes the module segments can occupy. */ KU32 cbMaxModSegs; /** [2c] The current size of the module segment records. */ KU32 cbModSegs; /** [30] The offset of the module segment records (relative to this header). */ KU32 offModSegs; /** [34] The max number of threads the thread table can contain. */ KU32 cMaxThreads; /** [38] The current number of threads in the thread table. */ KU32 cThreads; /** [3c] The offset of the thread table (relative to this header). */ KU32 offThreads; /** [40] The size of a thread entry. */ KU32 cbThread; /** [44] The max number of stacks the stack table can contain. */ KU32 cMaxStacks; /** [48] The max number of stacks. * Unlike the other members, the stacks can be reused. It follows that * this count doesn't specify the number of used slots from the start. */ KU32 cStacks; /** [4c] The offset of the thread table (relative to this header). * This is usually 0 in a stored data set. */ KU32 offStacks; /** [50] The size of a stack. */ KU32 cbStack; /** [54] The maxium stack depth. */ KU32 cMaxStackFrames; /** [58] The process commandline. * Might not always apply is will be 0 in those cases. This is normally written * where the stacks used to be. */ KU32 offCommandLine; /** [5c] The length of the command line. (excludes the terminator). */ KU32 cchCommandLine; /** [60] The function lookup table (it contains indexes). * This is sorted by address so that a binary search can be performed. * Access to this table is managed externally, but generally a read/write lock is employed. */ KU32 aiFunctions[1]; } KPRF_TYPE(,HDR); /** Pointer to a profiler data header. */ typedef KPRF_TYPE(,HDR) *KPRF_TYPE(P,HDR); /** Pointer to a const profiler data header. */ typedef const KPRF_TYPE(,HDR) *KPRF_TYPE(PC,HDR); /** * Time statistics. */ typedef struct KPRF_TYPE(,TIMESTAT) /** @todo bad names and descriptions! */ { /** The minimum period */ KU64 volatile MinTicks; /** The maximum period */ KU64 volatile MaxTicks; /** The sum of all periods. */ KU64 volatile SumTicks; } KPRF_TYPE(,TIMESTAT); /** Pointer to time statistics. */ typedef KPRF_TYPE(,TIMESTAT) *KPRF_TYPE(P,TIMESTAT); /** Pointer to const time statistics. */ typedef const KPRF_TYPE(,TIMESTAT) *KPRF_TYPE(PC,TIMESTAT); /** * A Module Segment. */ typedef struct KPRF_TYPE(,MODSEG) { /** The address of the segment. (relative address) */ KPRF_TYPE(,UPTR) uBasePtr; /** The size of the segment minus one (so the entire address space can be covered). */ KPRF_TYPE(,UPTR) cbSegmentMinusOne; /** The segment number. (0 based) */ KU32 iSegment; /** Flag indicating whether this segment is loaded or not. * (A 16-bit value was choosen out of convenience, all that's stored is 0 or 1 anyway.) */ KU16 fLoaded; /** The length of the path. * This is used to calculate the length of the record: offsetof(MODSEG, szPath) + cchPath + 1 */ KU16 cchPath; /** The module name. */ char szPath[1]; } KPRF_TYPE(,MODSEG); /** Pointer to a module segment. */ typedef KPRF_TYPE(,MODSEG) *KPRF_TYPE(P,MODSEG); /** Pointer to a const module segment. */ typedef const KPRF_TYPE(,MODSEG) *KPRF_TYPE(PC,MODSEG); /** * The profiler data for a function. */ typedef struct KPRF_TYPE(,FUNC) { /** The entry address of the function. (relative address) * This is the return address of the entry hook (_mcount, _penter, _ProfileHook32, ...). */ KPRF_TYPE(,UPTR) uEntryPtr; /** Offset (relative to the profiler header) of the module segment to which this function belongs. */ KU32 offModSeg; /** The number times on the stack. */ KU64 volatile cOnStack; /** The number of calls made from this function. */ KU64 volatile cCalls; /** Time on stack. */ KPRF_TYPE(,TIMESTAT) OnStack; /** Time on top of the stack, i.e. executing. */ KPRF_TYPE(,TIMESTAT) OnTopOfStack; /** @todo recursion */ } KPRF_TYPE(,FUNC); /** Pointer to the profiler data for a function. */ typedef KPRF_TYPE(,FUNC) *KPRF_TYPE(P,FUNC); /** Pointer to the const profiler data for a function. */ typedef const KPRF_TYPE(,FUNC) *KPRF_TYPE(PC,FUNC); /** * Stack frame. */ typedef struct KPRF_TYPE(,FRAME) { /** The accumulated overhead. * Over head is accumulated by the parent frame when a child is poped off the stack. */ KU64 OverheadTicks; /** The current (top of stack) overhead. */ KU64 CurOverheadTicks; /** The accumulated sleep ticks. * It's possible to notify the profiler that the thread is being put into a wait/sleep/yield * state. The time spent sleeping is transfered to the parent frame when poping of a child one. */ KU64 SleepTicks; /** The start of the on-stack period. */ KU64 OnStackStart; /** The accumulated time on top (excludes overhead (sleep doesn't apply here obviously)). */ KU64 OnTopOfStackTicks; /** The start of the current on-top-of-stack period. * This is also to mark the start of a sleeping period, the ResumeThread function will always * treat it as the start of the suspend period. */ KU64 OnTopOfStackStart; /** The number of calls made from this stack frame. */ KU64 cCalls; /** Stack address of this frame. * This is used to detect throw and longjmp, and is also used to deal with overflow. (relative address) */ KPRF_TYPE(,UPTR) uFramePtr; /** Offset (relative to the profiler header) to the function record. * This is 0 if we're out of function space. */ KU32 offFunction; } KPRF_TYPE(,FRAME); /** Pointer to a stack frame. */ typedef KPRF_TYPE(,FRAME) *KPRF_TYPE(P,FRAME); /** Pointer to a const stack frame. */ typedef const KPRF_TYPE(,FRAME) *KPRF_TYPE(PC,FRAME); /** * Stack. */ typedef struct KPRF_TYPE(,STACK) { /** The offset (relative to the profiler header) of the thread owning the stack. * This is zero if not in use, and non-zero if in use. */ KU32 offThread; /** The number of active stack frames. */ KU32 cFrames; /** The stack frames. * The actual size of this array is specified in the header. */ KPRF_TYPE(,FRAME) aFrames[1]; } KPRF_TYPE(,STACK); /** Pointer to a stack. */ typedef KPRF_TYPE(,STACK) *KPRF_TYPE(P,STACK); /** Pointer to a const stack. */ typedef const KPRF_TYPE(,STACK) *KPRF_TYPE(PC,STACK); /** * The thread state. */ typedef enum KPRF_TYPE(,THREADSTATE) { /** The thread hasn't been used yet. */ KPRF_TYPE(,THREADSTATE_UNUSED) = 0, /** The thread is activly being profiled. * A thread is added in the suspended state and then activated when * starting to execute the first function. */ KPRF_TYPE(,THREADSTATE_ACTIVE), /** The thread is currently suspended from profiling. * Upon entering profiler code the thread is suspended, it's reactivated * upon normal return. */ KPRF_TYPE(,THREADSTATE_SUSPENDED), /** The thread is currently suspended due of stack overflow. * When we overflow the stack frame array, the thread enter the overflow state. In this * state nothing is profiled but we keep looking for the exit of the top frame. */ KPRF_TYPE(,THREADSTATE_OVERFLOWED), /** The thread is terminated. * When we received a thread termination notification the thread is unwinded, statistics * updated and the state changed to terminated. A terminated thread cannot be revivied. */ KPRF_TYPE(,THREADSTATE_TERMINATED), /** Ensure 32-bit size. */ KPRF_TYPE(,THREADSTATE_32BIT_HACK) = 0x7fffffff } KPRF_TYPE(,THREADSTATE); /** * Thread statistics and stack. */ typedef struct KPRF_TYPE(,THREAD) { /** The native thread id. */ KU64 ThreadId; /** The thread name. (optional) */ char szName[32]; /** The thread current thread state. */ KPRF_TYPE(,THREADSTATE) enmState; /** Alignment. */ KPRF_TYPE(,THREADSTATE) Reserved0; /** The base pointer of the thread stack. (relative address) */ KPRF_TYPE(,UPTR) uStackBasePtr; /** The maximum depth of the thread stack (bytes). */ KPRF_TYPE(,UPTR) cbMaxStack; /** The number of calls done by this thread. */ KU64 cCalls; /** The number of times the stack overflowed. */ KU64 cOverflows; /** The number of times stack entries has been rejected because of a stack switch. */ KU64 cStackSwitchRejects; /** The number of times the stack has been unwinded more than one frame. */ KU64 cUnwinds; /** The profiled ticks. (This does not include sleep or overhead ticks.) * This is the accumulated on-stack values for the final stack frames. */ KU64 ProfiledTicks; /** The accumulated overhead of this thread. */ KU64 OverheadTicks; /** The accumulated sleep ticks for this thread. * See KPRF_TYPE(,FRAME)::SleepTicks for details. */ KU64 SleepTicks; /** The offset of the stack. */ KU32 offStack; } KPRF_TYPE(,THREAD); /** Pointer to a thread. */ typedef KPRF_TYPE(,THREAD) *KPRF_TYPE(P,THREAD); /** Pointer to a const thread. */ typedef const KPRF_TYPE(,THREAD) *KPRF_TYPE(PC,THREAD); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/Makefile.kmk��������������������������������������������������0000664�0001750�0001750�00000021341�14670377514�021764� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kProfiler Mark 2, sub-makefile. # # # Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. SUB_DEPTH = .. include $(PATH_KBUILD)/subheader.kmk #LIBRARIES += kPrf2GC kPrf2R0 DLLS += kPrf2 PROGRAMS += kPrf2Read # # Our template. # TEMPLATE_kPrf2 = kProfiler Template if1of ($(BUILD_TARGET), win) TEMPLATE_kPrf2_EXTENDS = kStuff else # Eliminate these TEMPLATE_kPrf2_TOOL = GCC3 TEMPLATE_kPrf2_TOOL.os2 = GCC3OMF TEMPLATE_kPrf2_TOOL.win.x86 = VCC70 TEMPLATE_kPrf2_TOOL.win.amd64 = VCC80AMD64 TEMPLATE_kPrf2_ASTOOL = YASM TEMPLATE_kPrf2_ASTOOL.os2 = NASM TEMPLATE_kPrf2_SDKS.win = WINPSDK TEMPLATE_kPrf2_CXXFLAGS.freebsd = -g TEMPLATE_kPrf2_CXXFLAGS.linux = -g TEMPLATE_kPrf2_CXXFLAGS.os2 = -g TEMPLATE_kPrf2_CXXFLAGS.win = -Zi -Zl -W3 -GF -GR- TEMPLATE_kPrf2_CXXFLAGS.win.amd64 = -GS- #-FAcs ifneq ($(BUILD_TYPE),debug) TEMPLATE_kPrf2_CXXFLAGS.freebsd+= -O3 TEMPLATE_kPrf2_CXXFLAGS.linux += -O3 TEMPLATE_kPrf2_CXXFLAGS.os2 += -O3 TEMPLATE_kPrf2_CXXFLAGS.win += -O2b2 endif TEMPLATE_kPrf2_ASFLAGS.freebsd = -f elf TEMPLATE_kPrf2_ASFLAGS.linux = -f elf TEMPLATE_kPrf2_ASFLAGS.os2 = -f omf TEMPLATE_kPrf2_ASFLAGS.win.x86 = -f win32 -g cv8 TEMPLATE_kPrf2_ASFLAGS.win.amd64 = -f win64 -g cv8 TEMPLATE_kPrf2_INCS = \ ../include TEMPLATE_kPrf2_LDFLAGS.freebsd = -g TEMPLATE_kPrf2_LDFLAGS.linux = -g TEMPLATE_kPrf2_LDFLAGS.os2 = -g TEMPLATE_kPrf2_LDFLAGS.win = /DEBUG TEMPLATE_kPrf2_LIBS.freebsd = TEMPLATE_kPrf2_LIBS.linux = TEMPLATE_kPrf2_LIBS.os2 = TEMPLATE_kPrf2_LIBS.win = \ $(PATH_SDK_WINPSDK_LIB)/psapi.Lib TEMPLATE_kPrf2_LIBS.win.x86 = \ $(PATH_TOOL_VCC70_LIB)/libcmt.lib \ $(PATH_TOOL_VCC70_LIB)/oldnames.lib TEMPLATE_kPrf2_LIBS.win.amd64 = \ $(PATH_TOOL_VCC80AMD64_LIB)/oldnames.lib \ $(PATH_TOOL_VCC80AMD64_LIB)/libcmt.lib endif # # kPrf2 - The profiler module. # kPrf2_TEMPLATE = kPrf2 kPrf2_DEFS.x86 = KPRF_BITS=32 kPrf2_DEFS.amd64 = KPRF_BITS=64 kPrf2_LDFLAGS.win.amd64 = -Entry:DllMain kPrf2_SOURCES = \ kProfileR3.cpp # kProfileGC.cpp # kProfileR0.cpp kPrf2_SOURCES.win = \ dllmain-win.cpp \ kPrf2WinApiWrapperHlp.c \ prf$(BUILD_TARGET_ARCH)msc.asm \ kPrf2-win-$(BUILD_TARGET_ARCH).def prfx86msc.asm_DEFS.win.x86 = \ KPRF_ENTER=_KPrfEnter \ KPRF_LEAVE=_KPrfLeave prfamd64msc.asm_DEFS.win.amd64 = \ KPRF_ENTER=KPrfEnter \ KPRF_LEAVE=KPrfLeave # # kPrf2Read - The read & producer of statistics. # kPrf2Read_TEMPLATE = kStuffEXE kPrf2Read_SOURCES = \ kPrf2Read.cpp kPrf2Read_LIBS = \ $(PATH_LIB)/kDbgStatic$(SUFF_LIB) \ $(PATH_LIB)/kRdrStatic$(SUFF_LIB) \ $(PATH_LIB)/kHlpCRTStatic$(SUFF_LIB) # # kPrf2WinApiWrappers # IMPORT_LIBS.win += kPrf2WinApiWrappersImp kPrf2WinApiWrappersImp_TEMPLATE = kStuffEXE kPrf2WinApiWrappersImp_SOURCES.x86 = kPrf2WinApiWrappersImp-x86.def kPrf2WinApiWrappersImp_SOURCES.amd64 = kPrf2WinApiWrappersImp-amd64.def DLLS.win += kPrf2WinApiWrappers kPrf2WinApiWrappers_TEMPLATE = kPrf2 kPrf2WinApiWrappers_CFLAGS = -GH -Gh kPrf2WinApiWrappers_LDFLAGS.win.x86 = -Entry:DllMain@12 kPrf2WinApiWrappers_LDFLAGS.win.amd64 = -Entry:DllMain kPrf2WinApiWrappers_SOURCES = \ kPrf2WinApiWrappers.c \ kPrf2WinApiWrappersImp-$(BUILD_TARGET_ARCH).def kPrf2WinApiWrappers_LIBS = \ $(PATH_kPrf2)/kPrf2.lib ifeq (0,1) kPrf2WinApiWrappers-kernel32.h: $(SED) -f kPrf2WinApi-pre.sed --output $@.tmp \ $(PATH_SDK_WINPSDK_INC)/WinBase.h \ $(PATH_SDK_WINPSDK_INC)/WinCon.h \ $(PATH_SDK_WINPSDK_INC)/WinNLS.h \ $(PATH_SDK_WINPSDK_INC)/WinVer.h \ $(PATH_SDK_WINPSDK_INC)/WinNT.h \ $(PATH_SDK_WINPSDK_INC)/TlHelp32.h $(APPEND) $@.tmp 'BOOL WINAPI ReplaceFile( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved );' $(APPEND) $@.tmp 'BOOL WINAPI SetConsoleCursor( PVOID pvUnknown1, PVOID pvUnknown2 );' $(APPEND) $@.tmp 'LPCH WINAPI GetEnvironmentStringsA( VOID );' $(APPEND) $@.tmp 'BOOL WINAPI GetBinaryType( LPCSTR lpApplicationName, LPDWORD lpBinaryType );' $(APPEND) $@.tmp 'WORD NTAPI RtlCaptureStackBackTrace( DWORD FramesToSkip, DWORD FramesToCapture, PVOID * BackTrace, PDWORD BackTraceHash );' $(APPEND) $@.tmp 'PVOID RtlFillMemory( PVOID pv, int ch, SIZE_T cb );' $(APPEND) $@.tmp 'PVOID RtlZeroMemory( PVOID pv, SIZE_T cb );' $(APPEND) $@.tmp 'PVOID RtlMoveMemory( PVOID pvDst, PVOID pvSrc, SIZE_T cb );' $(APPEND) $@.tmp 'VOID NTAPI RtlUnwind( PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue );' $(APPEND) $@.tmp 'VOID NTAPI RtlUnwindEx( FRAME_POINTERS TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable );' $(APPEND) $@.tmp 'ULONGLONG WINAPI RtlVirtualUnwind( ULONG HandlerType, ULONGLONG ImageBase, ULONGLONG ControlPC, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT ContextRecord, PBOOLEAN InFunction, PFRAME_POINTERS EstablisherFrame, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers );' $(APPEND) $@.tmp 'PVOID WINAPI RtlPcToFileHeader( PVOID PcValue, PVOID * BaseOfImage );' $(APPEND) $@.tmp 'PVOID WINAPI RtlLookupFunctionEntry( ULONGLONG ControlPC, PULONGLONG ImageBase, PULONGLONG TargetGp );' $(APPEND) $@.tmp 'void WINAPI RtlRaiseException(PEXCEPTION_RECORD pXcpRec);' $(APPEND) $@.tmp 'int WINAPI uaw_lstrcmpW( LPCUWSTR lpString1, LPCUWSTR lpString2 );' $(APPEND) $@.tmp 'int WINAPI uaw_lstrcmpiW( LPCUWSTR lpString1, LPCUWSTR lpString2 );' $(APPEND) $@.tmp 'int WINAPI uaw_lstrlenW( LPCUWSTR lpString );' $(APPEND) $@.tmp 'LPUWSTR WINAPI uaw_wcschr( LPCUWSTR lpString, WCHAR wc );' $(APPEND) $@.tmp 'LPUWSTR WINAPI uaw_wcscpy( LPUWSTR lpDst, LPCUWSTR lpSrc );' $(APPEND) $@.tmp 'int WINAPI uaw_wcsicmp( LPCUWSTR lp1, LPCUWSTR lp2 );' $(APPEND) $@.tmp 'SIZE_T WINAPI uaw_wcslen( LPCUWSTR lp1 );' $(APPEND) $@.tmp 'LPUWSTR WINAPI uaw_wcsrchr( LPCUWSTR lpString, WCHAR wc );' $(APPEND) $@.tmp 'LPSTR WINAPI lstrcat( LPSTR lpString1, LPCSTR lpString2 );' $(APPEND) $@.tmp 'int WINAPI lstrcmp( LPCSTR lpString1, LPCSTR lpString2 );' $(APPEND) $@.tmp 'int WINAPI lstrcmpi( LPCSTR lpString1, LPCSTR lpString2 );' $(APPEND) $@.tmp 'LPSTR WINAPI lstrcpy( LPSTR lpString1, LPCSTR lpString2 );' $(APPEND) $@.tmp 'LPSTR WINAPI lstrcpyn( LPSTR lpString1, LPCSTR lpString2, int iMaxLength );' $(APPEND) $@.tmp 'int WINAPI lstrlen( LPCSTR lpString );' $(SED) -f kPrf2WinApi-gencode.sed --output $@ $@.tmp $(RM) -f $@.tmp kPrf2WinApiWrappersImp-$(KBUILD_TARGET_ARCH).def: $(RM) -f $@ $(PATH_TOOL_$(TEMPLATE_kStuff_TOOL.win.$(BUILD_TARGET_ARCH))_BIN)/dumpbin.exe /EXPORTS /OUT:$@.tmp $(PATH_SDK_WINPSDK_LIB)/Kernel32.lib $(SED) -f kPrf2WinApi-dumpbin.sed --output $@.tmp2 $@.tmp $(APPEND) $@ 'LIBRARY kPrf2WinApiWrappers' $(APPEND) $@ 'EXPORTS' $(SED) -f kPrf2WinApi-genimp.sed --append $@ $@.tmp2 $(RM) -f $@.tmp $@.tmp2 endif # # A simple testcase. # PROGRAMS.win.x86 += tst tst_TOOL = VCC70 tst_SDKS = WINPSDK tst_CFLAGS = -GH -Gh -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 tst_SOURCES = tst.c tst.c_CFLAGS = -Od tst_LDFLAGS = /DEBUG tst_LIBS = \ $(PATH_TOOL_VCC70_LIB)/msvcrt.lib \ $(PATH_TOOL_VCC70_LIB)/msvcprt.lib \ $(PATH_TOOL_VCC70_LIB)/oldnames.lib \ $(PATH_kPrf2)/kPrf2.lib PROGRAMS += tstlongjmp tstlongjmp_TEMPLATE = kStuffEXE tstlongjmp_CFLAGS.win = -GH -Gh -Zi tstlongjmp_SOURCES = tstlongjmp.c tstlongjmp_LIBS = \ $(PATH_kPrf2)/kPrf2.lib # Generate the rules include $(PATH_KBUILD)/subfooter.kmk # # Aliases for .cpp.h files so we can more easily do syntax checking from the editor. # CORE := $(wildcard *core*.cpp.h *core*.h.h) $(CORE:.h=.o) $(CORE:.h=.obj) : kProfileR3.o READ := $(wildcard *read*.cpp.h *read*.h.h) $(READ:.h=.o) $(READ:.h=.obj) : kPrf2Read.o �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/tstlongjmp.c��������������������������������������������������0000664�0001750�0001750�00000001727�14670377514�022116� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #include <setjmp.h> #include <time.h> /* just try trick the compiler into not optimizing stuff by making it "uncertain" which path to take. */ int always_true(void) { time_t t = time(NULL); if (t == time(NULL)) return 1; if (t != time(NULL)) return 1; if (t == time(NULL)) return 1; if (t != time(NULL)) return 1; return 0; } jmp_buf g_JmpBuf; int onelevel(void) { if (always_true()) longjmp(g_JmpBuf, 1); return 0; } int twolevels_inner(void) { if (always_true()) longjmp(g_JmpBuf, 1); return 0; } int twolevels_outer(void) { int rc; always_true(); rc = twolevels_inner(); always_true(); return rc; } int main() { int rc = 1; /* first */ if (!setjmp(g_JmpBuf)) rc = onelevel(); /* second */ if (!setjmp(g_JmpBuf)) rc = twolevels_outer(); return rc != 1; } �����������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/prfcorefunction.cpp.h�����������������������������������������0000664�0001750�0001750�00000007534�14670377514�023713� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: prfcorefunction.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core NewFunction Code Template. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Creates a new function. * * @returns Pointer to the new function. * @returns NULL if we're out of space. */ static KPRF_TYPE(P,FUNC) KPRF_NAME(NewFunction)(KPRF_TYPE(P,HDR) pHdr,KPRF_TYPE(,UPTR) uPC) { /* * First find the position of the function (it might actually have been inserted by someone else by now too). */ KPRF_FUNCS_WRITE_LOCK(); KPRF_TYPE(P,FUNC) paFunctions = KPRF_OFF2PTR(P,FUNC, pHdr->offFunctions, pHdr); KI32 iStart = 0; KI32 iLast = pHdr->cFunctions - 1; KI32 i = iLast / 2; for (;;) { KU32 iFunction = pHdr->aiFunctions[i]; KPRF_TYPE(,IPTR) iDiff = uPC - paFunctions[iFunction].uEntryPtr; if (!iDiff) { KPRF_FUNCS_WRITE_UNLOCK(); return &paFunctions[iFunction]; } if (iLast == iStart) break; if (iDiff < 0) iLast = i - 1; else iStart = i + 1; if (iLast < iStart) break; i = iStart + (iLast - iStart) / 2; } /* * Adjust the index so we're exactly in the right spot. * (I've too much of a headache to figure out if the above loop leaves us where we should be.) */ const KI32 iNew = pHdr->cFunctions; if (paFunctions[pHdr->aiFunctions[i]].uEntryPtr > uPC) { while ( i > 0 && paFunctions[pHdr->aiFunctions[i - 1]].uEntryPtr > uPC) i--; } else { while ( i < iNew && paFunctions[pHdr->aiFunctions[i]].uEntryPtr < uPC) i++; } /* * Ensure that there still is space for the function. */ if (iNew >= (KI32)pHdr->cMaxFunctions) { KPRF_FUNCS_WRITE_UNLOCK(); return NULL; } pHdr->cFunctions++; KPRF_TYPE(P,FUNC) pNew = &paFunctions[iNew]; /* init the new function entry */ pNew->uEntryPtr = uPC; pNew->offModSeg = 0; pNew->cOnStack = 0; pNew->cCalls = 0; pNew->OnStack.MinTicks = ~(KU64)0; pNew->OnStack.MaxTicks = 0; pNew->OnStack.SumTicks = 0; pNew->OnTopOfStack.MinTicks = ~(KU64)0; pNew->OnTopOfStack.MaxTicks = 0; pNew->OnTopOfStack.SumTicks = 0; /* shift the function index array and insert the new one. */ KI32 j = iNew; while (j > i) { pHdr->aiFunctions[j] = pHdr->aiFunctions[j - 1]; j--; } pHdr->aiFunctions[i] = iNew; KPRF_FUNCS_WRITE_UNLOCK(); /* * Record the module segment (i.e. add it if it's new). */ pNew->offModSeg = KPRF_NAME(RecordModSeg)(pHdr, uPC); return pNew; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/prfcorereloc.cpp.h��������������������������������������������0000664�0001750�0001750�00000003470�14670377514�023165� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: prfcorereloc.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core SetBasePtr Code Template. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Set (or modify) the base pointer for the profiler. * * The purpose of the base pointer is to allow profiling of relocatable code. Set the * base pointer right after initializing the data set, and update it when relocating * the code (both by calling this function), and Bob's your uncle! :-) * * @param pHdr The header returned from the initializer. * @param uBasePtr The new base pointer value. */ KPRF_DECL_FUNC(void, SetBasePtr)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(,UPTR) uBasePtr) { pHdr->uBasePtr = uBasePtr; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2WinApi-pre.sed�������������������������������������������0000664�0001750�0001750�00000006157�14670377514�023130� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: kPrf2WinApi-pre.sed 29 2009-07-01 20:30:29Z bird $ ## @file # This SED script will try normalize a windows header # in order to make it easy to pick out function prototypes. # # # Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # Drop all preprocessor lines (#if/#else/#endif/#define/#undef/#pragma/comments) # (we don't bother with multi line comments ATM.) /^[[:space:]]*#/b drop_line /^[[:space:]]*\/\//b drop_line # Drop empty lines. /^[[:space:]]*$/b drop_line # Drop trailing comments and trailing whitespace s/[[:space:]][[:space:]]*\/\.*$//g s,[[:space:]][[:space:]]*/\*[^*/]*\*/[[:space:]]*$,,g s/[[:space:]][[:space:]]*$//g # Pick out the WINBASEAPI stuff (WinBase.h) /^WINBASEAPI/b winapi /^NTSYSAPI/b winapi /^WINAPI$/b winapi_perhaps /^APIENTRY$/b winapi_perhaps h d b end # No WINBASEAPI, so we'll have to carefully check the hold buffer. :winapi_perhaps x /^[A-Z][A-Z0-9_][A-Z0-9_]*[A-Z0-9]$/!b drop_line G s/\r/ /g s/\n/ /g b winapi # Make it one line and a bit standardized :winapi /;/b winapi_got_it N b winapi :winapi_got_it s/\n/ /g s/[[:space:]][[:space:]]*\/\*[^*/]*\*\/[[:space:]]*//g s/[[:space:]][[:space:]]*(/(/g s/)[[:space:]][[:space:]]*/)/g s/(\([^[:space:]]\)/( \1/g s/\([^[:space:]]\))/\1 )/g s/[*]\([^[:space:]]\)/* \1/g s/\([^[:space:]]\)[*]/\1 */g s/[[:space:]][[:space:]]*/ /g s/[[:space:]][[:space:]]*,/,/g s/,/, /g s/,[[:space:]][[:space:]]*/, /g # Drop the nasty bit of the sal.h / SpecString.h stuff. s/[[:space:]]__[a-z][a-z_]*([^()]*)[[:space:]]*/ /g s/[[:space:]]__out[a-z_]*[[:space:]]*/ /g s/[[:space:]]__in[a-z_]*[[:space:]]*/ /g s/[[:space:]]__deref[a-z_]*[[:space:]]*/ /g s/[[:space:]]__reserved[[:space:]]*/ /g s/[[:space:]]__nullnullterminated[[:space:]]*/ /g s/[[:space:]]__checkReturn[[:space:]]*/ /g # Drop some similar stuff. s/[[:space:]]OPTIONAL[[:space:]]/ /g s/[[:space:]]OPTIONAL,/ ,/g # The __declspec() bit isn't necessary s/WINBASEAPI *// s/NTSYSAPI *// s/DECLSPEC_NORETURN *// s/__declspec([^()]*) *// # Normalize spaces. s/[[:space:]]/ /g # Clear the hold space x s/^.*$// x b end :drop_line s/^.*$// h d :end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/tst.c���������������������������������������������������������0000664�0001750�0001750�00000001274�14670377514�020524� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <stdio.h> #ifdef _MSC_VER void __cdecl _penter(void); void __cdecl _pexit(void); __declspec(naked) int naked(void) { __asm { call _penter call _pexit xor eax, eax ret } } #endif int bar(void) { unsigned i; for (i = 0; i < 1000; i += 7) i += i & 1; return i; } int foo(void) { unsigned i, rc = 0; for (i = 0; i < 1000; i++) rc += bar(); #ifdef _MSC_VER for (; i < 2000; i++) rc += naked(); #endif return i; } int main() { int rc; printf("hello"); fflush(stdout); rc = foo(); printf("world\n"); return rc; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/kProfileR3.cpp������������������������������������������������0000664�0001750�0001750�00000130140�14670377514�022225� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kProfileR3.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - The Ring-3 Implementation. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <k/kDefs.h> #if K_OS == K_OS_WINDOWS # include <windows.h> # include <psapi.h> # include <malloc.h> # if _MSC_VER >= 1400 # include <intrin.h> # define HAVE_INTRIN # endif #elif K_OS == K_OS_LINUX || K_OS == K_OS_FREEBSD # define KPRF_USE_PTHREAD # include <pthread.h> # include <stdint.h> # define KPRF_USE_MMAN # include <sys/mman.h> # include <sys/fcntl.h> # include <unistd.h> # include <stdlib.h> # ifndef O_BINARY # define O_BINARY 0 # endif #elif K_OS == K_OS_OS2 # define INCL_BASE # include <os2.h> # include <stdint.h> # include <sys/fmutex.h> #else # error "not ported to this OS..." #endif #include <k/kDefs.h> #include <k/kTypes.h> /* * Instantiate the header. */ #define KPRF_NAME(Suffix) KPrf##Suffix #define KPRF_TYPE(Prefix,Suffix) Prefix##KPRF##Suffix #if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 # define KPRF_DECL_FUNC(type, name) extern "C" __declspec(dllexport) type __cdecl KPRF_NAME(name) #else # define KPRF_DECL_FUNC(type, name) extern "C" type KPRF_NAME(name) #endif #if 1 # ifdef __GNUC__ # define KPRF_ASSERT(expr) do { if (!(expr)) { __asm__ __volatile__("int3\n\tnop\n\t");} } while (0) # else # define KPRF_ASSERT(expr) do { if (!(expr)) { __debugbreak(); } } while (0) # endif #else # define KPRF_ASSERT(expr) do { } while (0) #endif #include "prfcore.h.h" /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** Mutex lock type. */ #if defined(KPRF_USE_PTHREAD) typedef pthread_mutex_t KPRF_TYPE(,MUTEX); #elif K_OS == K_OS_WINDOWS typedef CRITICAL_SECTION KPRF_TYPE(,MUTEX); #elif K_OS == K_OS_OS2 typedef struct _fmutex KPRF_TYPE(,MUTEX); #endif /** Pointer to a mutex lock. */ typedef KPRF_TYPE(,MUTEX) *KPRF_TYPE(P,MUTEX); #if defined(KPRF_USE_PTHREAD) /** Read/Write lock type. */ typedef pthread_rwlock_t KPRF_TYPE(,RWLOCK); #elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 /** Read/Write lock state. */ typedef enum KPRF_TYPE(,RWLOCKSTATE) { RWLOCK_STATE_UNINITIALIZED = 0, RWLOCK_STATE_SHARED, RWLOCK_STATE_LOCKING, RWLOCK_STATE_EXCLUSIVE, RWLOCK_STATE_32BIT_HACK = 0x7fffffff } KPRF_TYPE(,RWLOCKSTATE); /** Update the state. */ #define KPRF_RWLOCK_SETSTATE(pRWLock, enmNewState) \ kPrfAtomicSet32((volatile KU32 *)&(pRWLock)->enmState, (KU32)(enmNewState)) /** Read/Write lock type. */ typedef struct KPRF_TYPE(,RWLOCK) { /** This mutex serialize the access and updating of the members * of this structure. */ KPRF_TYPE(,MUTEX) Mutex; /** The current number of readers. */ KU32 cReaders; /** The number of readers waiting. */ KU32 cReadersWaiting; /** The current number of waiting writers. */ KU32 cWritersWaiting; # if K_OS == K_OS_WINDOWS /** The handle of the event object on which the waiting readers block. (manual reset). */ HANDLE hevReaders; /** The handle of the event object on which the waiting writers block. (manual reset). */ HANDLE hevWriters; # elif K_OS == K_OS_OS2 /** The handle of the event semaphore on which the waiting readers block. */ HEV hevReaders; /** The handle of the event semaphore on which the waiting writers block. */ HEV hevWriters; # endif /** The current state of the read-write lock. */ KPRF_TYPE(,RWLOCKSTATE) enmState; } KPRF_TYPE(,RWLOCK); #endif /** Pointer to a Read/Write lock. */ typedef KPRF_TYPE(,RWLOCK) *KPRF_TYPE(P,RWLOCK); /******************************************************************************* * Global Variables * *******************************************************************************/ /** The TLS index / key. */ #if K_OS == K_OS_WINDOWS static DWORD g_dwThreadTLS = TLS_OUT_OF_INDEXES; #elif defined(KPRF_USE_PTHREAD) static pthread_key_t g_ThreadKey = (pthread_key_t)-1; #elif K_OS == K_OS_OS2 static KPRF_TYPE(P,THREAD) *g_ppThread = NULL; #else # error "Not ported to your OS - or you're missing the OS define(s)." #endif /** Pointer to the profiler header. */ static KPRF_TYPE(P,HDR) g_pHdr = NULL; #define KPRF_GET_HDR() g_pHdr /** Whether the profiler is enabled or not. */ static bool g_fEnabled = false; #define KPRF_IS_ACTIVE() g_fEnabled /** The mutex protecting the threads in g_pHdr. */ static KPRF_TYPE(,MUTEX) g_ThreadsMutex; /** The mutex protecting the module segments in g_pHdr. */ static KPRF_TYPE(,MUTEX) g_ModSegsMutex; /** The read-write lock protecting the functions in g_pHdr. */ static KPRF_TYPE(,RWLOCK) g_FunctionsRWLock; /******************************************************************************* * Internal Functions * *******************************************************************************/ static KPRF_TYPE(P,THREAD) kPrfGetThreadAutoReg(void); #ifdef KPRF_USE_PTHREAD static void kPrfPThreadKeyDtor(void *pvThread); #endif /** * Gets the pointer to the profiler data for the current thread. * * This implementation automatically adds unknown threads. * * @returns Pointer to the profiler thread data. * @returns NULL if we're out of thread space. */ static inline KPRF_TYPE(P,THREAD) kPrfGetThread(void) { KPRF_TYPE(P,THREAD) pThread; /* Win32/64 */ #if K_OS == K_OS_WINDOWS pThread = (KPRF_TYPE(P,THREAD))TlsGetValue(g_dwThreadTLS); /* Posix Threads */ #elif defined(KPRF_USE_PTHREAD) pThread = (KPRF_TYPE(P,THREAD))pthread_getspecific(g_ThreadKey); #elif K_OS == K_OS_OS2 pThread = *g_ppThread; #else # error not implemented #endif if (!pThread) pThread = kPrfGetThreadAutoReg(); return pThread; } #define KPRF_GET_THREAD() kPrfGetThread() /** * The the ID of the current thread. * * @returns The thread id. */ static inline KUPTR kPrfGetThreadId(void) { /* Win32/64 */ #if K_OS == K_OS_WINDOWS KUPTR ThreadId = (KUPTR)GetCurrentThreadId(); /* Posix Threads */ #elif defined(KPRF_USE_PTHREAD) KUPTR ThreadId = (KUPTR)pthread_self(); #elif K_OS == K_OS_OS2 PTIB pTib; PPIB pPib; DosGetInfoBlocks(&pTib, &pPib); ThreadId = pTib->tib_ptib2->tib2_ultid; #else # error not implemented #endif return ThreadId; } #define KPRF_GET_THREADID() kPrfGetThreadId() /** * The the ID of the current process. * * @returns The process id. */ static inline KUPTR kPrfGetProcessId(void) { /* Win32/64 */ #if K_OS == K_OS_WINDOWS KUPTR ThreadId = (KUPTR)GetProcessId(GetCurrentProcess()); #elif K_OS == K_OS_OS2 PTIB pTib; PPIB pPib; DosGetInfoBlocks(&pTib, &pPib); ThreadId = pPib->pib_pid; #else KUPTR ThreadId = (KUPTR)getpid(); #endif return ThreadId; } #define KPRF_GET_PROCESSID() kPrfGetProcessId() /** * Sets the pointer to the profiler data for the current thread. * * We require fast access to the profiler thread data, so we store * it in a TLS (thread local storage) item/key where the implementation * allows that. * * @param pThread The pointer to the profiler thread data for the current thread. */ static inline void kPrfSetThread(KPRF_TYPE(P,THREAD) pThread) { /* Win32/64 */ #if K_OS == K_OS_WINDOWS BOOL fRc = TlsSetValue(g_dwThreadTLS, pThread); /* Posix Threads */ #elif defined(KPRF_USE_PTHREAD) int rc = pthread_setspecific(g_ThreadKey, pThread); #elif K_OS == K_OS_OS2 *g_ppThread = pThread; #else # error not implemented #endif } #define KPRF_SET_THREAD(pThread) kPrfSetThread(pThread) /** * Get the now timestamp. * This must correspond to what the assembly code are doing. */ static inline KU64 kPrfNow(void) { #if defined(HAVE_INTRIN) return __rdtsc(); # else union { KU64 u64; struct { KU32 u32Lo; KU32 u32Hi; } s; } u; # if defined(__GNUC__) __asm__ __volatile__ ("rdtsc\n\t" : "=a" (u.s.u32Lo), "=d" (u.s.u32Hi)); # else __asm { rdtsc mov [u.s.u32Lo], eax mov [u.s.u32Hi], edx } # endif return u.u64; #endif } #define KPRF_NOW() kPrfNow() /** * Atomically set a 32-bit value. */ static inline void kPrfAtomicSet32(volatile KU32 *pu32, const KU32 u32) { #if defined(HAVE_INTRIN) _InterlockedExchange((long volatile *)pu32, (const long)u32); #elif defined(__GNUC__) __asm__ __volatile__("xchgl %0, %1\n\t" : "=m" (*pu32) : "r" (u32)); #elif _MSC_VER __asm { mov edx, [pu32] mov eax, [u32] xchg [edx], eax } #else *pu32 = u32; #endif } #define KPRF_ATOMIC_SET32(a,b) kPrfAtomicSet32(a, b) /** * Atomically set a 64-bit value. */ static inline void kPrfAtomicSet64(volatile KU64 *pu64, KU64 u64) { #if defined(HAVE_INTRIN) && KPRF_BITS == 64 _InterlockedExchange64((KI64 *)pu64, (const KI64)u64); #elif defined(__GNUC__) && KPRF_BITS == 64 __asm__ __volatile__("xchgq %0, %1\n\t" : "=m" (*pu64) : "r" (u64)); #elif defined(__GNUC__) && KPRF_BITS == 32 __asm__ __volatile__("1:\n\t" "lock; cmpxchg8b %1\n\t" "jnz 1b\n\t" : "=A" (u64), "=m" (*pu64) : "0" (*pu64), "b" ( (KU32)u64 ), "c" ( (KU32)(u64 >> 32) )); #elif _MSC_VER __asm { mov ebx, dword ptr [u64] mov ecx, dword ptr [u64 + 4] mov esi, pu64 mov eax, dword ptr [esi] mov edx, dword ptr [esi + 4] retry: lock cmpxchg8b [esi] jnz retry } #else *pu64 = u64; #endif } #define KPRF_ATOMIC_SET64(a,b) kPrfAtomicSet64(a, b) /** * Atomically add a 32-bit integer to another. */ static inline void kPrfAtomicAdd32(volatile KU32 *pu32, const KU32 u32) { #if defined(HAVE_INTRIN) _InterlockedExchangeAdd((volatile long *)pu32, (const long)u32); #elif defined(__GNUC__) __asm__ __volatile__("lock; addl %0, %1\n\t" : "=m" (*pu32) : "r" (u32)); #elif _MSC_VER __asm { mov edx, [pu32] mov eax, dword ptr [u32] lock add [edx], eax } #else *pu32 += u32; #endif } #define KPRF_ATOMIC_ADD32(a,b) kPrfAtomicAdd32(a, b) #define KPRF_ATOMIC_INC32(a) kPrfAtomicAdd32(a, 1); #define KPRF_ATOMIC_DEC32(a) kPrfAtomicAdd32(a, (KU32)-1); /** * Atomically add a 64-bit integer to another. * Atomically isn't quite required, just a non-corruptive manner, assuming all updates are adds. */ static inline void kPrfAtomicAdd64(volatile KU64 *pu64, const KU64 u64) { #if defined(HAVE_INTRIN) && KPRF_BITS == 64 _InterlockedExchangeAdd64((volatile KI64 *)pu64, (const KI64)u64); #elif defined(__GNUC__) && KPRF_BITS == 64 __asm__ __volatile__("lock; addq %0, %1\n\t" : "=m" (*pu64) : "r" (u64)); #elif defined(__GNUC__) && KPRF_BITS == 32 __asm__ __volatile__("lock; addl %0, %2\n\t" "lock; adcl %1, %3\n\t" : "=m" (*(volatile KU32 *)pu64), "=m" (*((volatile KU32 *)pu64 + 1)) : "r" ((KU32)u64), "r" ((KU32)(u64 >> 32))); #elif _MSC_VER __asm { mov edx, [pu64] mov eax, dword ptr [u64] mov ecx, dword ptr [u64 + 4] lock add [edx], eax lock adc [edx + 4], ecx } #else *pu64 += u64; #endif } #define KPRF_ATOMIC_ADD64(a,b) kPrfAtomicAdd64(a, b) #define KPRF_ATOMIC_INC64(a) kPrfAtomicAdd64(a, 1); /** * Initializes a mutex. * * @returns 0 on success. * @returns -1 on failure. * @param pMutex The mutex to init. */ static int kPrfMutexInit(KPRF_TYPE(P,MUTEX) pMutex) { #if defined(KPRF_USE_PTHREAD) if (!pthread_mutex_init(pMutex, NULL)); return 0; return -1; #elif K_OS == K_OS_WINDOWS InitializeCriticalSection(pMutex); return 0; #elif K_OS == K_OS_OS2 if (!_fmutex_create(pMutex, 0)) return 0; return -1; #endif } /** * Deletes a mutex. * * @param pMutex The mutex to delete. */ static void kPrfMutexDelete(KPRF_TYPE(P,MUTEX) pMutex) { #if defined(KPRF_USE_PTHREAD) pthread_mutex_destroy(pMutex); #elif K_OS == K_OS_WINDOWS DeleteCriticalSection(pMutex); #elif K_OS == K_OS_OS2 _fmutex_close(pMutex); #endif } /** * Locks a mutex. * @param pMutex The mutex lock. */ static inline void kPrfMutexAcquire(KPRF_TYPE(P,MUTEX) pMutex) { #if K_OS == K_OS_WINDOWS EnterCriticalSection(pMutex); #elif defined(KPRF_USE_PTHREAD) pthread_mutex_lock(pMutex); #elif K_OS == K_OS_OS2 fmutex_request(pMutex); #endif } /** * Unlocks a mutex. * @param pMutex The mutex lock. */ static inline void kPrfMutexRelease(KPRF_TYPE(P,MUTEX) pMutex) { #if K_OS == K_OS_WINDOWS LeaveCriticalSection(pMutex); #elif defined(KPRF_USE_PTHREAD) pthread_mutex_lock(pMutex); #elif K_OS == K_OS_OS2 fmutex_request(pMutex); #endif } #define KPRF_THREADS_LOCK() kPrfMutexAcquire(&g_ThreadsMutex) #define KPRF_THREADS_UNLOCK() kPrfMutexRelease(&g_ThreadsMutex) #define KPRF_MODSEGS_LOCK() kPrfMutexAcquire(&g_ModSegsMutex) #define KPRF_MODSEGS_UNLOCK() kPrfMutexRelease(&g_ModSegsMutex) /** * Initializes a read-write lock. * * @returns 0 on success. * @returns -1 on failure. * @param pRWLock The read-write lock to initialize. */ static inline int kPrfRWLockInit(KPRF_TYPE(P,RWLOCK) pRWLock) { #if defined(KPRF_USE_PTHREAD) if (!pthread_rwlock_init(pRWLock, NULL)) return 0; return -1; #elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 if (kPrfMutexInit(&pRWLock->Mutex)) return -1; pRWLock->cReaders = 0; pRWLock->cReadersWaiting = 0; pRWLock->cWritersWaiting = 0; pRWLock->enmState = RWLOCK_STATE_SHARED; # if K_OS == K_OS_WINDOWS pRWLock->hevReaders = CreateEvent(NULL, TRUE, TRUE, NULL); pRWLock->hevWriters = CreateEvent(NULL, FALSE, FALSE, NULL); if ( pRWLock->hevReaders != INVALID_HANDLE_VALUE && pRWLock->hevWriters != INVALID_HANDLE_VALUE) return 0; CloseHandle(pRWLock->hevReaders); CloseHandle(pRWLock->hevWriters); # elif K_OS == K_OS_OS2 APIRET rc = DosCreateEventSem(NULL, &pRWLock->hevReaders, 0, TRUE); if (!rc) { rc = DosCreateEventSem(NULL, &pRWLock->hevWriters, 0, TRUE); if (!rc) return 0; pRWLock->hevWriters = NULLHANDLE; DosCloseEventSem(pRWLock->hevReaders); } pRWLock->hevReaders = NULLHANDLE; # endif pRWLock->enmState = RWLOCK_STATE_UNINITIALIZED; kPrfMutexDelete(&pRWLock->Mutex); return -1; #endif } /** * Deleters a read-write lock. * * @param pRWLock The read-write lock to delete. */ static inline void kPrfRWLockDelete(KPRF_TYPE(P,RWLOCK) pRWLock) { #if defined(KPRF_USE_PTHREAD) pthread_rwlock_destroy(pRWLock); #elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) return; pRWLock->enmState = RWLOCK_STATE_UNINITIALIZED; kPrfMutexDelete(&pRWLock->Mutex); pRWLock->cReaders = 0; pRWLock->cReadersWaiting = 0; pRWLock->cWritersWaiting = 0; # if K_OS == K_OS_WINDOWS CloseHandle(pRWLock->hevReaders); pRWLock->hevReaders = INVALID_HANDLE_VALUE; CloseHandle(pRWLock->hevWriters); pRWLock->hevWriters = INVALID_HANDLE_VALUE; # elif K_OS == K_OS_OS2 DosCloseEventSem(pRWLock->hevReaders); pRWLock->hevReaders = NULLHANDLE; DosCloseEventSem(pRWLock->hevWriters); pRWLock->hevWriters = NULLHANDLE; # endif #endif } /** * Acquires read access to the read-write lock. * @param pRWLock The read-write lock. */ static inline void kPrfRWLockAcquireRead(KPRF_TYPE(P,RWLOCK) pRWLock) { #if defined(KPRF_USE_PTHREAD) pthread_rwlock_rdlock(pRWLock); #elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) return; kPrfMutexAcquire(&pRWLock->Mutex); if (pRWLock->enmState == RWLOCK_STATE_SHARED) { KPRF_ATOMIC_INC32(&pRWLock->cReaders); kPrfMutexRelease(&pRWLock->Mutex); return; } for (;;) { /* have to wait */ KPRF_ATOMIC_INC32(&pRWLock->cReadersWaiting); # if K_OS == K_OS_WINDOWS HANDLE hev = pRWLock->hevReaders; ResetEvent(hev); # elif K_OS == K_OS_OS2 HEV hev = pRWLock->hevReaders; ULONG cIgnored; DosResetEventSem(hev, &cIgnored); # endif kPrfMutexRelease(&pRWLock->Mutex); # if K_OS == K_OS_WINDOWS switch (WaitForSingleObject(hev, INFINITE)) { case WAIT_IO_COMPLETION: case WAIT_TIMEOUT: case WAIT_OBJECT_0: break; case WAIT_ABANDONED: default: return; } # elif K_OS == K_OS_OS2 switch (DosWaitEventSem(hev, SEM_INDEFINITE_WAIT)) { case NO_ERROR: case ERROR_SEM_TIMEOUT: case ERROR_TIMEOUT: case ERROR_INTERRUPT: break; default: return; } # endif kPrfMutexAcquire(&pRWLock->Mutex); if (pRWLock->enmState == RWLOCK_STATE_SHARED) { KPRF_ATOMIC_INC32(&pRWLock->cReaders); KPRF_ATOMIC_DEC32(&pRWLock->cReadersWaiting); kPrfMutexRelease(&pRWLock->Mutex); return; } } #endif } /** * Releases read access to the read-write lock. * @param pRWLock The read-write lock. */ static inline void kPrfRWLockReleaseRead(KPRF_TYPE(P,RWLOCK) pRWLock) { #if defined(KPRF_USE_PTHREAD) pthread_rwlock_unlock(pRWLock); #elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) return; /* * If we're still in the shared state, or if there * are more readers out there, or if there are no * waiting writers, all we have to do is decrement an leave. * * That's the most frequent, thing and should be fast. */ kPrfMutexAcquire(&pRWLock->Mutex); KPRF_ATOMIC_DEC32(&pRWLock->cReaders); if ( pRWLock->enmState == RWLOCK_STATE_SHARED || pRWLock->cReaders || !pRWLock->cWritersWaiting) { kPrfMutexRelease(&pRWLock->Mutex); return; } /* * Wake up one (or more on OS/2) waiting writers. */ # if K_OS == K_OS_WINDOWS SetEvent(pRWLock->hevWriters); # elif K_OS == K_OS_OS2 DosPostEvent(pRWLock->hevwriters); # endif kPrfMutexRelease(&pRWLock->Mutex); #endif } /** * Acquires write access to the read-write lock. * @param pRWLock The read-write lock. */ static inline void kPrfRWLockAcquireWrite(KPRF_TYPE(P,RWLOCK) pRWLock) { #if defined(KPRF_USE_PTHREAD) pthread_rwlock_wrlock(pRWLock); #elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) return; kPrfMutexAcquire(&pRWLock->Mutex); if ( !pRWLock->cReaders && ( pRWLock->enmState == RWLOCK_STATE_SHARED || pRWLock->enmState == RWLOCK_STATE_LOCKING) ) { KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_EXCLUSIVE); kPrfMutexRelease(&pRWLock->Mutex); return; } /* * We'll have to wait. */ if (pRWLock->enmState == RWLOCK_STATE_SHARED) KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_LOCKING); KPRF_ATOMIC_INC32(&pRWLock->cWritersWaiting); for (;;) { # if K_OS == K_OS_WINDOWS HANDLE hev = pRWLock->hevWriters; # elif K_OS == K_OS_OS2 HEV hev = pRWLock->hevWriters; # endif kPrfMutexRelease(&pRWLock->Mutex); # if K_OS == K_OS_WINDOWS switch (WaitForSingleObject(hev, INFINITE)) { case WAIT_IO_COMPLETION: case WAIT_TIMEOUT: case WAIT_OBJECT_0: break; case WAIT_ABANDONED: default: KPRF_ATOMIC_DEC32(&pRWLock->cWritersWaiting); return; } # elif K_OS == K_OS_OS2 switch (DosWaitEventSem(hev, SEM_INDEFINITE_WAIT)) { case NO_ERROR: case ERROR_SEM_TIMEOUT: case ERROR_TIMEOUT: case ERROR_INTERRUPT: break; default: KPRF_ATOMIC_DEC32(&pRWLock->cWritersWaiting); return; } ULONG cIgnored; DosResetEventSem(hev, &cIgnored); # endif /* * Try acquire the lock. */ kPrfMutexAcquire(&pRWLock->Mutex); if ( !pRWLock->cReaders && ( pRWLock->enmState == RWLOCK_STATE_SHARED || pRWLock->enmState == RWLOCK_STATE_LOCKING) ) { KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_EXCLUSIVE); KPRF_ATOMIC_DEC32(&pRWLock->cWritersWaiting); kPrfMutexRelease(&pRWLock->Mutex); return; } } #endif } /** * Releases write access to the read-write lock. * @param pRWLock The read-write lock. */ static inline void kPrfRWLockReleaseWrite(KPRF_TYPE(P,RWLOCK) pRWLock) { #if defined(KPRF_USE_PTHREAD) pthread_rwlock_unlock(pRWLock); #elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) return; /* * The common thing is that there are noone waiting. * But, before that usual paranoia. */ kPrfMutexAcquire(&pRWLock->Mutex); if (pRWLock->enmState != RWLOCK_STATE_EXCLUSIVE) { kPrfMutexRelease(&pRWLock->Mutex); return; } if ( !pRWLock->cReadersWaiting && !pRWLock->cWritersWaiting) { KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_SHARED); kPrfMutexRelease(&pRWLock->Mutex); return; } /* * Someone is waiting, wake them up as we change the state. */ # if K_OS == K_OS_WINDOWS HANDLE hev = INVALID_HANDLE_VALUE; # elif K_OS == K_OS_OS2 HEV hev = NULLHANDLE; # endif if (pRWLock->cWritersWaiting) { KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_LOCKING); hev = pRWLock->hevWriters; } else { KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_SHARED); hev = pRWLock->hevReaders; } # if K_OS == K_OS_WINDOWS SetEvent(hev); # elif K_OS == K_OS_OS2 DosPostEvent(pRWLock->hevwriters); # endif kPrfMutexRelease(&pRWLock->Mutex); #endif } #define KPRF_FUNCS_WRITE_LOCK() kPrfRWLockAcquireWrite(&g_FunctionsRWLock) #define KPRF_FUNCS_WRITE_UNLOCK() kPrfRWLockReleaseWrite(&g_FunctionsRWLock) #define KPRF_FUNCS_READ_LOCK() kPrfRWLockAcquireRead(&g_FunctionsRWLock) #define KPRF_FUNCS_READ_UNLOCK() kPrfRWLockReleaseRead(&g_FunctionsRWLock) /** * Finds the module segment which the address belongs to. * */ static int kPrfGetModSeg(KPRF_TYPE(,UPTR) uAddress, char *pszPath, KU32 cchPath, KU32 *piSegment, KPRF_TYPE(P,UPTR) puBasePtr, KPRF_TYPE(P,UPTR) pcbSegmentMinusOne) { #if K_OS == K_OS_WINDOWS /* * Enumerate the module handles. */ HANDLE hProcess = GetCurrentProcess(); DWORD cbNeeded = 0; HMODULE hModIgnored; if ( !EnumProcessModules(hProcess, &hModIgnored, sizeof(hModIgnored), &cbNeeded) && GetLastError() != ERROR_BUFFER_OVERFLOW) /** figure out what this actually returns */ cbNeeded = 256 * sizeof(HMODULE); cbNeeded += sizeof(HMODULE) * 32; HMODULE *pahModules = (HMODULE *)alloca(cbNeeded); if (EnumProcessModules(hProcess, pahModules, cbNeeded, &cbNeeded)) { const unsigned cModules = cbNeeded / sizeof(HMODULE); for (unsigned i = 0; i < cModules; i++) { __try { const KUPTR uImageBase = (KUPTR)pahModules[i]; union { KU8 *pu8; PIMAGE_DOS_HEADER pDos; PIMAGE_NT_HEADERS pNt; PIMAGE_NT_HEADERS32 pNt32; PIMAGE_NT_HEADERS64 pNt64; KUPTR u; } u; u.u = uImageBase; /* reject modules higher than the address. */ if (uAddress < u.u) continue; /* Skip past the MZ header */ if (u.pDos->e_magic == IMAGE_DOS_SIGNATURE) u.pu8 += u.pDos->e_lfanew; /* Ignore anything which isn't an NT header. */ if (u.pNt->Signature != IMAGE_NT_SIGNATURE) continue; /* Extract necessary info from the optional header (comes in 32-bit and 64-bit variations, we simplify a bit). */ KU32 cbImage; PIMAGE_SECTION_HEADER paSHs; if (u.pNt->FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32)) { paSHs = (PIMAGE_SECTION_HEADER)(u.pNt32 + 1); cbImage = u.pNt32->OptionalHeader.SizeOfImage; } else if (u.pNt->FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER64)) { paSHs = (PIMAGE_SECTION_HEADER)(u.pNt64 + 1); cbImage = u.pNt64->OptionalHeader.SizeOfImage; } else continue; /* Is our address within the image size */ KUPTR uRVA = uAddress - (KUPTR)pahModules[i]; if (uRVA >= cbImage) continue; /* * Iterate the section headers and figure which section we're in. * (segment == section + 1) */ const KU32 cSHs = u.pNt->FileHeader.NumberOfSections; if (uRVA < paSHs[0].VirtualAddress) { /* the implicit header section */ *puBasePtr = uImageBase; *pcbSegmentMinusOne = paSHs[0].VirtualAddress - 1; *piSegment = 0; } else { KU32 iSH = 0; for (;;) { if (iSH >= cSHs) { /* this shouldn't happen, but in case it does simply deal with it. */ *puBasePtr = paSHs[iSH - 1].VirtualAddress + paSHs[iSH - 1].Misc.VirtualSize + uImageBase; *pcbSegmentMinusOne = cbImage - *puBasePtr; *piSegment = iSH + 1; break; } if (uRVA - paSHs[iSH].VirtualAddress < paSHs[iSH].Misc.VirtualSize) { *puBasePtr = paSHs[iSH].VirtualAddress + uImageBase; *pcbSegmentMinusOne = paSHs[iSH].Misc.VirtualSize; *piSegment = iSH + 1; break; } iSH++; } } /* * Finally, get the module name. * There are multiple ways, try them all before giving up. */ if ( !GetModuleFileNameEx(hProcess, pahModules[i], pszPath, cchPath) && !GetModuleFileName(pahModules[i], pszPath, cchPath) && !GetMappedFileName(hProcess, (PVOID)uAddress, pszPath, cchPath) && !GetModuleBaseName(hProcess, pahModules[i], pszPath, cchPath)) *pszPath = '\0'; return 0; } __except (EXCEPTION_EXECUTE_HANDLER) { } } } #elif K_OS == K_OS_OS2 /* * Just ask the loader. */ ULONG offObj = 0; ULONG iObj = 0; HMODULE hmod = NULLHANDLE; APIRET rc = DosQueryModFromEIP(&hmod, &iObj, cchPath, pszPath, &offObj, uAddress); if (!rc) { *piSegment = iObj; *puBasePtr = uAddress - offObj; *pcbSegmentMinusOne = KPRF_ALIGN(offObj, 0x1000) - 1; /* minimum size */ /* * Query the page attributes starting at the current page. The query will not enter * into the next object since PAG_BASE is requested. */ ULONG cb = ~0UL; ULONG fFlags = ~0UL; uAddress &= ~(KUPTR)0xfff; rc = DosQueryMem((PVOID)(uAddress, &cb, &fFlags); if (!rc) { *pcbSegmentMinusOne = (offObj & ~(KUPTR)0xfff) + KPRF_ALIGN(cb, 0x1000) - 1; if ((fFlags & PAG_BASE) && cb <= 0x1000) /* don't quite remember if PAG_BASE returns one page or not */ { cb = ~0UL; fFlags = ~0UL; rc = DosQueryMem((PVOID)(uAddress + 0x1000), &cb, &fFlags); if (!rc & !(fFlags & (PAG_BASE | PAG_FREE))) *pcbSegmentMinusOne += KPRF_ALIGN(cb, 0x1000); } } return 0; } #endif /* The common fallback */ *pszPath = '\0'; *piSegment = 0; *puBasePtr = 0; *pcbSegmentMinusOne = ~(KPRF_TYPE(,UPTR))0; return -1; } #define KPRF_GET_MODSEG(uAddress, pszPath, cchPath, piSegment, puBasePtr, pcbSegmentMinusOne) \ kPrfGetModSeg(uAddress, pszPath, cchPath, piSegment, puBasePtr, pcbSegmentMinusOne) /* * Instantiate the implementation */ #include "prfcorepre.cpp.h" #include "prfcoremodseg.cpp.h" #include "prfcorefunction.cpp.h" #include "prfcore.cpp.h" #include "prfcoreinit.cpp.h" #include "prfcoreterm.cpp.h" #include "prfcorepost.cpp.h" /** * Registers an unknown thread. * * @returns Pointer to the registered thread. */ static KPRF_TYPE(P,THREAD) kPrfGetThreadAutoReg(void) { KUPTR uStackBasePtr; #if 0 /** @todo I'm sure Win32 has a way of obtaining the top and bottom of the stack, OS/2 did... * Some limit stuff in posix / ansi also comes to mind... */ #elif K_OS == K_OS_OS2 PTIB pTib; PPIB pPib; DosGetInfoBlocks(&pTib, &pPib); /* never fails except if you give it bad input, thus 'Get' not 'Query'. */ /* I never recall which of these is the right one... */ uStackBasePtr = (KUPTR)pTib->tib_pstack < (KUPTR)pTib->tib_pstack_limit ? (KUPTR)pTib->tib_pstack : (KUPTR)pTib->tib_pstack_limit; #else /* the default is top of the current stack page (assuming a page to be 4KB) */ uStackBasePtr = (KUPTR)&uStackBasePtr; uStackBasePtr = (uStackBasePtr + 0xfff) & ~(KUPTR)0xfff; #endif return KPRF_NAME(RegisterThread)(uStackBasePtr, ""); } /** * Get a env.var. variable. * * @returns pszValue. * @param pszVar The variable name. * @param pszValue Where to store the value. * @param cchValue The size of the value buffer. * @param pszDefault The default value. */ static char *kPrfGetEnvString(const char *pszVar, char *pszValue, KU32 cchValue, const char *pszDefault) { #if K_OS == K_OS_WINDOWS if (GetEnvironmentVariable(pszVar, pszValue, cchValue)) return pszValue; #elif K_OS == K_OS_OS2 PSZ pszValue; if ( !DosScanEnv((PCSZ)pszVar, &pszValue) && !*pszValue) pszDefault = pszValue; #else const char *pszTmp = getenv(pszVar); if (pszTmp) pszDefault = pszTmp; #endif /* * Copy the result into the buffer. */ char *psz = pszValue; while (*pszDefault && cchValue-- > 1) *psz++ = *pszDefault++; *psz = '\0'; return pszValue; } /** * The the value of an env.var. * * @returns The value of the env.var. * @returns The default if the value was not found. * @param pszVar The variable name. * @param uDefault The default value. */ static KU32 kPrfGetEnvValue(const char *pszVar, KU32 uDefault) { #if K_OS == K_OS_WINDOWS char szBuf[128]; const char *pszValue = szBuf; if (!GetEnvironmentVariable(pszVar, szBuf, sizeof(szBuf))) pszValue = NULL; #elif K_OS == K_OS_OS2 PSZ pszValue; if (DosScanEnv((PCSZ)pszVar, &pszValue)) pszValue = NULL; #else const char *pszValue = getenv(pszVar); #endif /* * Discard the obvious stuff. */ if (!pszValue) return uDefault; while (*pszValue == ' ' || *pszValue == '\t') pszValue++; if (!*pszValue) return uDefault; /* * Interpret the value. */ unsigned uBase = 10; KU32 uValue = 0; const char *psz = pszValue; /* prefix - only hex */ if (*psz == '0' && (psz[1] == 'x' || psz[1] == 'X')) { uBase = 16; psz += 2; } /* read the value */ while (*psz) { unsigned char ch = (unsigned char)*psz; if (ch >= '0' && ch <= '9') ch -= '0'; else if ( uBase > 10 && ch >= 'a' && ch <= 'f') ch -= 'a' + 10; else if ( uBase > 10 && ch >= 'a' && ch <= 'F') ch -= 'a' + 10; else break; uValue *= uBase; uValue += ch; psz++; } /* postfixes */ switch (*psz) { case 'm': case 'M': uValue *= 1024*1024; break; case 'k': case 'K': uValue *= 1024; break; } /* * If the value is still 0, we return the default. */ return uValue ? uValue : uDefault; } /** * Allocates memory. * * @returns Pointer to the allocated memory. * @returns NULL on failure. * @param cb The amount of memory (in bytes) to allocate. */ static void *kPrfAllocMem(KU32 cb) { #if K_OS == K_OS_WINDOWS void *pv = VirtualAlloc(NULL, cb, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #elif defined(KPRF_USE_MMAN) void *pv = mmap(NULL, cb, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #elif K_OS == K_OS_OS2 void *pv; # ifdef INCL_DOSEXAPIS if (DosAllocMemEx(&pv, cb, PAG_READ | PAG_WRITE | PAG_EXECUTE | PAG_COMMIT | OBJ_FORK))s # else if (DosAllocMem(&pv, cb, PAG_READ | PAG_WRITE | PAG_EXECUTE | PAG_COMMIT)) # endif pvBuf = NULL; #else # error not implemented #endif return pv; } /** * Frees memory. * * @param pv The memory to free. */ static void kPrfFreeMem(void *pv) { #if K_OS == K_OS_WINDOWS VirtualFree(pv, 0, MEM_RELEASE); #elif defined(KPRF_USE_MMAN) munmap(pv, 0); /** @todo check if 0 is allowed here.. */ #elif K_OS == K_OS_OS2 # ifdef INCL_DOSEXAPIS DosFreeMemEx(&pv); # else DosFreeMem(&pv); # endif #else # error not implemented #endif } /** * Writes a data buffer to a new file. * * Any existing file will be overwritten. * * * @returns 0 on success. * @returns -1 on failure. * * @param pszName The name of the file. * @param pvData The data to write. * @param cbData The amount of data to write. */ static int kPrfWriteFile(const char *pszName, const void *pvData, KU32 cbData) { #if K_OS == K_OS_WINDOWS int rc = -1; HANDLE hFile = CreateFile(pszName,GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, INVALID_HANDLE_VALUE); if (hFile != INVALID_HANDLE_VALUE) { DWORD dwWritten; if ( WriteFile(hFile, pvData, cbData, &dwWritten, NULL) && dwWritten == cbData) rc = 0; CloseHandle(hFile); } return rc; #elif K_OS == K_OS_OS2 HFILE hFile; ULONG ulAction = 0; APIRET rc = DosOpen(pszName, &hFile, &ulAction, cbData, FILE_NORMAL, OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW, OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE | OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_SEQUENTIAL, NULL); if (!rc) { ULONG cbWritten; rc = DosWrite(hFile, pvData, cbData, &cbWritten); if (!rc && cbWritten != cbData) rc = -1; DosClose(hFile); } return rc ? -1 : 0; #else int rc = -1; int fd = open(pszName, O_WRONLY | O_CREAT | O_BINARY | O_TRUNC, 0666); if (fd >= 0) { if (write(fd, pvData, cbData) == cbData) rc = 0; close(fd); } return rc; #endif } /** * Initializes and start the profiling. * * This should typically be called from some kind of module init * function, so we can start profiling upon/before entering main(). * * @returns 0 on success * @returns -1 on failure. * */ int kPrfInitialize(void) { /* * Only initialize once. */ if (KPRF_GET_HDR()) return 0; /* * Initial suggestions. */ KU32 cbModSegs = kPrfGetEnvValue("KPRF2_CBMODSEGS", 128*1024); KU32 cFunctions = kPrfGetEnvValue("KPRF2_CFUNCTIONS", 8192); KU32 cThreads = kPrfGetEnvValue("KPRF2_CTHREADS", 256); KU32 cStacks = kPrfGetEnvValue("KPRF2_CSTACKS", 48); KU32 cFrames = kPrfGetEnvValue("KPRF2_CFRAMES", 448); KU32 fAffinity = kPrfGetEnvValue("KPRF2_AFFINITY", 0); KU32 cb = KPRF_NAME(CalcSize)(cFunctions, cbModSegs, cThreads, cStacks, cFrames); /* * Allocate and initialize the data set. */ void *pvBuf = kPrfAllocMem(cb); if (!pvBuf) return -1; KPRF_TYPE(P,HDR) pHdr = KPRF_NAME(Init)(pvBuf, cb, cFunctions, cbModSegs, cThreads, cStacks, cFrames); if (pHdr) { /* * Initialize semaphores. */ if (!kPrfMutexInit(&g_ThreadsMutex)) { if (!kPrfMutexInit(&g_ModSegsMutex)) { if (!kPrfRWLockInit(&g_FunctionsRWLock)) { /* * Allocate the TLS entry. */ #if K_OS == K_OS_WINDOWS g_dwThreadTLS = TlsAlloc(); if (g_dwThreadTLS != TLS_OUT_OF_INDEXES) #elif defined(KPRF_USE_PTHREAD) int rc = pthread_key_create(&g_ThreadKey, kPrfPThreadKeyDtor); if (!rc) #elif K_OS == K_OS_OS2 int rc = DosAllocThreadLocalMemory(sizeof(void *), (PULONG*)&g_ppThread); /** @todo check if this is a count or a size. */ if (!rc) #endif { /* * Apply the affinity mask, if specified. */ if (fAffinity) { #if K_OS == K_OS_WINDOWS SetProcessAffinityMask(GetCurrentProcess(), fAffinity); #endif } g_pHdr = pHdr; g_fEnabled = true; return 0; } kPrfRWLockDelete(&g_FunctionsRWLock); } kPrfMutexDelete(&g_ModSegsMutex); } kPrfMutexDelete(&g_ThreadsMutex); } } kPrfFreeMem(pvBuf); return -1; } /** * Stops, dumps, and terminates the profiling. * * This should typically be called from some kind of module destruction * function, so we can profile parts of the termination sequence too. * * @returns 0 on success * @returns -1 on failure. * */ int kPrfTerminate(void) { /* * Stop the profiling. * As a safety precaution, sleep a little bit to allow threads * still at large inside profiler code some time to get out. */ g_fEnabled = false; KPRF_TYPE(P,HDR) pHdr = g_pHdr; g_pHdr = NULL; if (!pHdr) return -1; #if K_OS == K_OS_WINDOWS Sleep(10); #elif K_OS == K_OS_OS2 DosSleep(10); #else usleep(10000); #endif /* * Unwind all active threads and so forth. */ KPRF_NAME(TerminateAll)(pHdr); /* * Use the stack space to fill in process details. */ #if K_OS == K_OS_WINDOWS /* all is one single string */ const char *pszCommandLine = GetCommandLine(); if (pszCommandLine) KPRF_NAME(SetCommandLine)(pHdr, 1, &pszCommandLine); #elif K_OS == K_OS_OS2 || K_OS == K_OS_OS2 PTIB pTib; PPIB pPib; DosGetInfoBlocks(&pTib, &pPib); if (pPib->pib_pchcmd) { /* Tradition say that the commandline is made up of two zero terminate strings * - first the executable name, then the arguments. Similar to what unix does, * only completely mocked up because of the CMD.EXE tradition. */ const char *apszArgs[2]; apszArgs[0] = pPib->pib_pchcmd; apszArgs[1] = pPib->pib_pchcmd; while (apszArgs[1][0]) apszArgs[1]++; apszArgs[1]++; KPRF_NAME(SetCommandLine)(pHdr, 2, apszArgs); } #else /* linux can read /proc/self/something I guess. Don't know about the rest... */ #endif /* * Write the file to disk. */ char szName[260 + 16]; kPrfGetEnvString("KPRF2_FILE", szName, sizeof(szName) - 16, "kPrf2-"); /* append the process id */ KUPTR pid = kPrfGetProcessId(); char *psz = szName; while (*psz) psz++; static char s_szDigits[0x11] = "0123456789abcdef"; KU32 uShift = KPRF_BITS - 4; while ( uShift > 0 && !(pid & (0xf << uShift))) uShift -= 4; *psz++ = s_szDigits[(pid >> uShift) & 0xf]; while (uShift > 0) { uShift -= 4; *psz++ = s_szDigits[(pid >> uShift) & 0xf]; } /* .kPrf2 */ *psz++ = '.'; *psz++ = 'k'; *psz++ = 'P'; *psz++ = 'r'; *psz++ = 'f'; *psz++ = '2'; *psz++ = '\0'; /* write the file. */ int rc = kPrfWriteFile(szName, pHdr, pHdr->cb); /* * Free resources. */ kPrfFreeMem(pHdr); #if K_OS == K_OS_WINDOWS TlsFree(g_dwThreadTLS); g_dwThreadTLS = TLS_OUT_OF_INDEXES; #elif defined(KPRF_USE_PTHREAD) pthread_key_delete(g_ThreadKey); g_ThreadKey = (pthread_key_t)-1; #elif K_OS == K_OS_OS2 DosFreeThreadLocalMemory((PULONG)g_ppThread); g_ppThread = NULL; #else # error "port me!" #endif kPrfMutexDelete(&g_ThreadsMutex); kPrfMutexDelete(&g_ModSegsMutex); kPrfRWLockDelete(&g_FunctionsRWLock); return rc; } /** * Terminate the current thread. */ void kPrfTerminateThread(void) { KPRF_NAME(DeregisterThread)(); } #ifdef KPRF_USE_PTHREAD /** * TLS destructor. */ static void kPrfPThreadKeyDtor(void *pvThread) { KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); if (pHdr) { KPRF_TYPE(P,THREAD) pThread = (KPRF_TYPE(P,THREAD))pvThread; pthread_setspecific(g_ThreadKey, pvThread); KPRF_NAME(TerminateThread)(pHdr, pThread, KPRF_NOW()); pthread_setspecific(g_ThreadKey, NULL); } } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappers-kernel32.h��������������������������������0000664�0001750�0001750�00001563620�14670377515�025174� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������typedef PVOID WINAPI FN_EncodePointer( PVOID Ptr ); __declspec(dllexport) PVOID WINAPI kPrf2Wrap_EncodePointer( PVOID Ptr ) { static FN_EncodePointer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EncodePointer", &g_Kernel32); return pfn( Ptr ); } typedef PVOID WINAPI FN_DecodePointer( PVOID Ptr ); __declspec(dllexport) PVOID WINAPI kPrf2Wrap_DecodePointer( PVOID Ptr ) { static FN_DecodePointer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DecodePointer", &g_Kernel32); return pfn( Ptr ); } typedef PVOID WINAPI FN_EncodeSystemPointer( PVOID Ptr ); __declspec(dllexport) PVOID WINAPI kPrf2Wrap_EncodeSystemPointer( PVOID Ptr ) { static FN_EncodeSystemPointer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EncodeSystemPointer", &g_Kernel32); return pfn( Ptr ); } typedef PVOID WINAPI FN_DecodeSystemPointer( PVOID Ptr ); __declspec(dllexport) PVOID WINAPI kPrf2Wrap_DecodeSystemPointer( PVOID Ptr ) { static FN_DecodeSystemPointer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DecodeSystemPointer", &g_Kernel32); return pfn( Ptr ); } typedef DWORD WINAPI FN_GetFreeSpace( UINT a); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFreeSpace( UINT a) { static FN_GetFreeSpace *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFreeSpace", &g_Kernel32); return pfn( a); } typedef LONG WINAPI FN_InterlockedIncrement( LONG volatile * lpAddend ); __declspec(dllexport) LONG WINAPI kPrf2Wrap_InterlockedIncrement( LONG volatile * lpAddend ) { static FN_InterlockedIncrement *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InterlockedIncrement", &g_Kernel32); return pfn( lpAddend ); } typedef LONG WINAPI FN_InterlockedDecrement( LONG volatile * lpAddend ); __declspec(dllexport) LONG WINAPI kPrf2Wrap_InterlockedDecrement( LONG volatile * lpAddend ) { static FN_InterlockedDecrement *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InterlockedDecrement", &g_Kernel32); return pfn( lpAddend ); } typedef LONG WINAPI FN_InterlockedExchange( LONG volatile * Target, LONG Value ); __declspec(dllexport) LONG WINAPI kPrf2Wrap_InterlockedExchange( LONG volatile * Target, LONG Value ) { static FN_InterlockedExchange *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InterlockedExchange", &g_Kernel32); return pfn( Target, Value ); } typedef LONG WINAPI FN_InterlockedExchangeAdd( LONG volatile * Addend, LONG Value ); __declspec(dllexport) LONG WINAPI kPrf2Wrap_InterlockedExchangeAdd( LONG volatile * Addend, LONG Value ) { static FN_InterlockedExchangeAdd *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InterlockedExchangeAdd", &g_Kernel32); return pfn( Addend, Value ); } typedef LONG WINAPI FN_InterlockedCompareExchange( LONG volatile * Destination, LONG Exchange, LONG Comperand ); __declspec(dllexport) LONG WINAPI kPrf2Wrap_InterlockedCompareExchange( LONG volatile * Destination, LONG Exchange, LONG Comperand ) { static FN_InterlockedCompareExchange *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InterlockedCompareExchange", &g_Kernel32); return pfn( Destination, Exchange, Comperand ); } typedef LONGLONG WINAPI FN_InterlockedCompareExchange64( LONGLONG volatile * Destination, LONGLONG Exchange, LONGLONG Comperand ); __declspec(dllexport) LONGLONG WINAPI kPrf2Wrap_InterlockedCompareExchange64( LONGLONG volatile * Destination, LONGLONG Exchange, LONGLONG Comperand ) { static FN_InterlockedCompareExchange64 *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InterlockedCompareExchange64", &g_Kernel32); return pfn( Destination, Exchange, Comperand ); } typedef VOID WINAPI FN_InitializeSListHead( PSLIST_HEADER ListHead ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_InitializeSListHead( PSLIST_HEADER ListHead ) { static FN_InitializeSListHead *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InitializeSListHead", &g_Kernel32); pfn( ListHead ); } typedef PSLIST_ENTRY WINAPI FN_InterlockedPopEntrySList( PSLIST_HEADER ListHead ); __declspec(dllexport) PSLIST_ENTRY WINAPI kPrf2Wrap_InterlockedPopEntrySList( PSLIST_HEADER ListHead ) { static FN_InterlockedPopEntrySList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InterlockedPopEntrySList", &g_Kernel32); return pfn( ListHead ); } typedef PSLIST_ENTRY WINAPI FN_InterlockedPushEntrySList( PSLIST_HEADER ListHead, PSLIST_ENTRY ListEntry ); __declspec(dllexport) PSLIST_ENTRY WINAPI kPrf2Wrap_InterlockedPushEntrySList( PSLIST_HEADER ListHead, PSLIST_ENTRY ListEntry ) { static FN_InterlockedPushEntrySList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InterlockedPushEntrySList", &g_Kernel32); return pfn( ListHead, ListEntry ); } typedef PSLIST_ENTRY WINAPI FN_InterlockedFlushSList( PSLIST_HEADER ListHead ); __declspec(dllexport) PSLIST_ENTRY WINAPI kPrf2Wrap_InterlockedFlushSList( PSLIST_HEADER ListHead ) { static FN_InterlockedFlushSList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InterlockedFlushSList", &g_Kernel32); return pfn( ListHead ); } typedef USHORT WINAPI FN_QueryDepthSList( PSLIST_HEADER ListHead ); __declspec(dllexport) USHORT WINAPI kPrf2Wrap_QueryDepthSList( PSLIST_HEADER ListHead ) { static FN_QueryDepthSList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "QueryDepthSList", &g_Kernel32); return pfn( ListHead ); } typedef BOOL WINAPI FN_FreeResource( HGLOBAL hResData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeResource( HGLOBAL hResData ) { static FN_FreeResource *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FreeResource", &g_Kernel32); return pfn( hResData ); } typedef LPVOID WINAPI FN_LockResource( HGLOBAL hResData ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_LockResource( HGLOBAL hResData ) { static FN_LockResource *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LockResource", &g_Kernel32); return pfn( hResData ); } typedef BOOL WINAPI FN_FreeLibrary( HMODULE hLibModule ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeLibrary( HMODULE hLibModule ) { static FN_FreeLibrary *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FreeLibrary", &g_Kernel32); return pfn( hLibModule ); } typedef VOID WINAPI FN_FreeLibraryAndExitThread( HMODULE hLibModule, DWORD dwExitCode ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_FreeLibraryAndExitThread( HMODULE hLibModule, DWORD dwExitCode ) { static FN_FreeLibraryAndExitThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FreeLibraryAndExitThread", &g_Kernel32); pfn( hLibModule, dwExitCode ); } typedef BOOL WINAPI FN_DisableThreadLibraryCalls( HMODULE hLibModule ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DisableThreadLibraryCalls( HMODULE hLibModule ) { static FN_DisableThreadLibraryCalls *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DisableThreadLibraryCalls", &g_Kernel32); return pfn( hLibModule ); } typedef FARPROC WINAPI FN_GetProcAddress( HMODULE hModule, LPCSTR lpProcName ); __declspec(dllexport) FARPROC WINAPI kPrf2Wrap_GetProcAddress( HMODULE hModule, LPCSTR lpProcName ) { static FN_GetProcAddress *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcAddress", &g_Kernel32); return pfn( hModule, lpProcName ); } typedef DWORD WINAPI FN_GetVersion( VOID ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetVersion( VOID ) { static FN_GetVersion *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVersion", &g_Kernel32); return pfn (); } typedef HGLOBAL WINAPI FN_GlobalAlloc( UINT uFlags, SIZE_T dwBytes ); __declspec(dllexport) HGLOBAL WINAPI kPrf2Wrap_GlobalAlloc( UINT uFlags, SIZE_T dwBytes ) { static FN_GlobalAlloc *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalAlloc", &g_Kernel32); return pfn( uFlags, dwBytes ); } typedef HGLOBAL WINAPI FN_GlobalReAlloc( HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags ); __declspec(dllexport) HGLOBAL WINAPI kPrf2Wrap_GlobalReAlloc( HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags ) { static FN_GlobalReAlloc *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalReAlloc", &g_Kernel32); return pfn( hMem, dwBytes, uFlags ); } typedef SIZE_T WINAPI FN_GlobalSize( HGLOBAL hMem ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_GlobalSize( HGLOBAL hMem ) { static FN_GlobalSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalSize", &g_Kernel32); return pfn( hMem ); } typedef UINT WINAPI FN_GlobalFlags( HGLOBAL hMem ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GlobalFlags( HGLOBAL hMem ) { static FN_GlobalFlags *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalFlags", &g_Kernel32); return pfn( hMem ); } typedef LPVOID WINAPI FN_GlobalLock( HGLOBAL hMem ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_GlobalLock( HGLOBAL hMem ) { static FN_GlobalLock *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalLock", &g_Kernel32); return pfn( hMem ); } typedef HGLOBAL WINAPI FN_GlobalHandle( LPCVOID pMem ); __declspec(dllexport) HGLOBAL WINAPI kPrf2Wrap_GlobalHandle( LPCVOID pMem ) { static FN_GlobalHandle *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalHandle", &g_Kernel32); return pfn( pMem ); } typedef BOOL WINAPI FN_GlobalUnlock( HGLOBAL hMem ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GlobalUnlock( HGLOBAL hMem ) { static FN_GlobalUnlock *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalUnlock", &g_Kernel32); return pfn( hMem ); } typedef HGLOBAL WINAPI FN_GlobalFree( HGLOBAL hMem ); __declspec(dllexport) HGLOBAL WINAPI kPrf2Wrap_GlobalFree( HGLOBAL hMem ) { static FN_GlobalFree *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalFree", &g_Kernel32); return pfn( hMem ); } typedef SIZE_T WINAPI FN_GlobalCompact( DWORD dwMinFree ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_GlobalCompact( DWORD dwMinFree ) { static FN_GlobalCompact *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalCompact", &g_Kernel32); return pfn( dwMinFree ); } typedef VOID WINAPI FN_GlobalFix( HGLOBAL hMem ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_GlobalFix( HGLOBAL hMem ) { static FN_GlobalFix *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalFix", &g_Kernel32); pfn( hMem ); } typedef VOID WINAPI FN_GlobalUnfix( HGLOBAL hMem ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_GlobalUnfix( HGLOBAL hMem ) { static FN_GlobalUnfix *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalUnfix", &g_Kernel32); pfn( hMem ); } typedef LPVOID WINAPI FN_GlobalWire( HGLOBAL hMem ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_GlobalWire( HGLOBAL hMem ) { static FN_GlobalWire *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalWire", &g_Kernel32); return pfn( hMem ); } typedef BOOL WINAPI FN_GlobalUnWire( HGLOBAL hMem ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GlobalUnWire( HGLOBAL hMem ) { static FN_GlobalUnWire *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalUnWire", &g_Kernel32); return pfn( hMem ); } typedef VOID WINAPI FN_GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) { static FN_GlobalMemoryStatus *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalMemoryStatus", &g_Kernel32); pfn( lpBuffer ); } typedef BOOL WINAPI FN_GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpBuffer ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpBuffer ) { static FN_GlobalMemoryStatusEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalMemoryStatusEx", &g_Kernel32); return pfn( lpBuffer ); } typedef HLOCAL WINAPI FN_LocalAlloc( UINT uFlags, SIZE_T uBytes ); __declspec(dllexport) HLOCAL WINAPI kPrf2Wrap_LocalAlloc( UINT uFlags, SIZE_T uBytes ) { static FN_LocalAlloc *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalAlloc", &g_Kernel32); return pfn( uFlags, uBytes ); } typedef HLOCAL WINAPI FN_LocalReAlloc( HLOCAL hMem, SIZE_T uBytes, UINT uFlags ); __declspec(dllexport) HLOCAL WINAPI kPrf2Wrap_LocalReAlloc( HLOCAL hMem, SIZE_T uBytes, UINT uFlags ) { static FN_LocalReAlloc *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalReAlloc", &g_Kernel32); return pfn( hMem, uBytes, uFlags ); } typedef LPVOID WINAPI FN_LocalLock( HLOCAL hMem ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_LocalLock( HLOCAL hMem ) { static FN_LocalLock *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalLock", &g_Kernel32); return pfn( hMem ); } typedef HLOCAL WINAPI FN_LocalHandle( LPCVOID pMem ); __declspec(dllexport) HLOCAL WINAPI kPrf2Wrap_LocalHandle( LPCVOID pMem ) { static FN_LocalHandle *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalHandle", &g_Kernel32); return pfn( pMem ); } typedef BOOL WINAPI FN_LocalUnlock( HLOCAL hMem ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LocalUnlock( HLOCAL hMem ) { static FN_LocalUnlock *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalUnlock", &g_Kernel32); return pfn( hMem ); } typedef SIZE_T WINAPI FN_LocalSize( HLOCAL hMem ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_LocalSize( HLOCAL hMem ) { static FN_LocalSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalSize", &g_Kernel32); return pfn( hMem ); } typedef UINT WINAPI FN_LocalFlags( HLOCAL hMem ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_LocalFlags( HLOCAL hMem ) { static FN_LocalFlags *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalFlags", &g_Kernel32); return pfn( hMem ); } typedef HLOCAL WINAPI FN_LocalFree( HLOCAL hMem ); __declspec(dllexport) HLOCAL WINAPI kPrf2Wrap_LocalFree( HLOCAL hMem ) { static FN_LocalFree *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalFree", &g_Kernel32); return pfn( hMem ); } typedef SIZE_T WINAPI FN_LocalShrink( HLOCAL hMem, UINT cbNewSize ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_LocalShrink( HLOCAL hMem, UINT cbNewSize ) { static FN_LocalShrink *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalShrink", &g_Kernel32); return pfn( hMem, cbNewSize ); } typedef SIZE_T WINAPI FN_LocalCompact( UINT uMinFree ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_LocalCompact( UINT uMinFree ) { static FN_LocalCompact *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalCompact", &g_Kernel32); return pfn( uMinFree ); } typedef BOOL WINAPI FN_FlushInstructionCache( HANDLE hProcess, LPCVOID lpBaseAddress, SIZE_T dwSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlushInstructionCache( HANDLE hProcess, LPCVOID lpBaseAddress, SIZE_T dwSize ) { static FN_FlushInstructionCache *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FlushInstructionCache", &g_Kernel32); return pfn( hProcess, lpBaseAddress, dwSize ); } typedef LPVOID WINAPI FN_VirtualAlloc( LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_VirtualAlloc( LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ) { static FN_VirtualAlloc *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VirtualAlloc", &g_Kernel32); return pfn( lpAddress, dwSize, flAllocationType, flProtect ); } typedef BOOL WINAPI FN_VirtualFree( LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualFree( LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType ) { static FN_VirtualFree *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VirtualFree", &g_Kernel32); return pfn( lpAddress, dwSize, dwFreeType ); } typedef BOOL WINAPI FN_VirtualProtect( LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualProtect( LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect ) { static FN_VirtualProtect *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VirtualProtect", &g_Kernel32); return pfn( lpAddress, dwSize, flNewProtect, lpflOldProtect ); } typedef SIZE_T WINAPI FN_VirtualQuery( LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_VirtualQuery( LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength ) { static FN_VirtualQuery *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VirtualQuery", &g_Kernel32); return pfn( lpAddress, lpBuffer, dwLength ); } typedef LPVOID WINAPI FN_VirtualAllocEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_VirtualAllocEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ) { static FN_VirtualAllocEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VirtualAllocEx", &g_Kernel32); return pfn( hProcess, lpAddress, dwSize, flAllocationType, flProtect ); } typedef UINT WINAPI FN_GetWriteWatch( DWORD dwFlags, PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID * lpAddresses, ULONG_PTR * lpdwCount, PULONG lpdwGranularity ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetWriteWatch( DWORD dwFlags, PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID * lpAddresses, ULONG_PTR * lpdwCount, PULONG lpdwGranularity ) { static FN_GetWriteWatch *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetWriteWatch", &g_Kernel32); return pfn( dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity ); } typedef UINT WINAPI FN_ResetWriteWatch( LPVOID lpBaseAddress, SIZE_T dwRegionSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_ResetWriteWatch( LPVOID lpBaseAddress, SIZE_T dwRegionSize ) { static FN_ResetWriteWatch *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ResetWriteWatch", &g_Kernel32); return pfn( lpBaseAddress, dwRegionSize ); } typedef SIZE_T WINAPI FN_GetLargePageMinimum( VOID ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_GetLargePageMinimum( VOID ) { static FN_GetLargePageMinimum *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLargePageMinimum", &g_Kernel32); return pfn (); } typedef UINT WINAPI FN_EnumSystemFirmwareTables( DWORD FirmwareTableProviderSignature, PVOID pFirmwareTableEnumBuffer, DWORD BufferSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_EnumSystemFirmwareTables( DWORD FirmwareTableProviderSignature, PVOID pFirmwareTableEnumBuffer, DWORD BufferSize ) { static FN_EnumSystemFirmwareTables *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumSystemFirmwareTables", &g_Kernel32); return pfn( FirmwareTableProviderSignature, pFirmwareTableEnumBuffer, BufferSize ); } typedef UINT WINAPI FN_GetSystemFirmwareTable( DWORD FirmwareTableProviderSignature, DWORD FirmwareTableID, PVOID pFirmwareTableBuffer, DWORD BufferSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemFirmwareTable( DWORD FirmwareTableProviderSignature, DWORD FirmwareTableID, PVOID pFirmwareTableBuffer, DWORD BufferSize ) { static FN_GetSystemFirmwareTable *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemFirmwareTable", &g_Kernel32); return pfn( FirmwareTableProviderSignature, FirmwareTableID, pFirmwareTableBuffer, BufferSize ); } typedef BOOL WINAPI FN_VirtualFreeEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualFreeEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType ) { static FN_VirtualFreeEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VirtualFreeEx", &g_Kernel32); return pfn( hProcess, lpAddress, dwSize, dwFreeType ); } typedef BOOL WINAPI FN_VirtualProtectEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualProtectEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect ) { static FN_VirtualProtectEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VirtualProtectEx", &g_Kernel32); return pfn( hProcess, lpAddress, dwSize, flNewProtect, lpflOldProtect ); } typedef SIZE_T WINAPI FN_VirtualQueryEx( HANDLE hProcess, LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_VirtualQueryEx( HANDLE hProcess, LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength ) { static FN_VirtualQueryEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VirtualQueryEx", &g_Kernel32); return pfn( hProcess, lpAddress, lpBuffer, dwLength ); } typedef HANDLE WINAPI FN_HeapCreate( DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_HeapCreate( DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize ) { static FN_HeapCreate *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapCreate", &g_Kernel32); return pfn( flOptions, dwInitialSize, dwMaximumSize ); } typedef BOOL WINAPI FN_HeapDestroy( HANDLE hHeap ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapDestroy( HANDLE hHeap ) { static FN_HeapDestroy *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapDestroy", &g_Kernel32); return pfn( hHeap ); } typedef LPVOID WINAPI FN_HeapAlloc( HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_HeapAlloc( HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes ) { static FN_HeapAlloc *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapAlloc", &g_Kernel32); return pfn( hHeap, dwFlags, dwBytes ); } typedef LPVOID WINAPI FN_HeapReAlloc( HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_HeapReAlloc( HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes ) { static FN_HeapReAlloc *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapReAlloc", &g_Kernel32); return pfn( hHeap, dwFlags, lpMem, dwBytes ); } typedef BOOL WINAPI FN_HeapFree( HANDLE hHeap, DWORD dwFlags, LPVOID lpMem ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapFree( HANDLE hHeap, DWORD dwFlags, LPVOID lpMem ) { static FN_HeapFree *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapFree", &g_Kernel32); return pfn( hHeap, dwFlags, lpMem ); } typedef SIZE_T WINAPI FN_HeapSize( HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_HeapSize( HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem ) { static FN_HeapSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapSize", &g_Kernel32); return pfn( hHeap, dwFlags, lpMem ); } typedef BOOL WINAPI FN_HeapValidate( HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapValidate( HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem ) { static FN_HeapValidate *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapValidate", &g_Kernel32); return pfn( hHeap, dwFlags, lpMem ); } typedef SIZE_T WINAPI FN_HeapCompact( HANDLE hHeap, DWORD dwFlags ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_HeapCompact( HANDLE hHeap, DWORD dwFlags ) { static FN_HeapCompact *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapCompact", &g_Kernel32); return pfn( hHeap, dwFlags ); } typedef HANDLE WINAPI FN_GetProcessHeap( VOID ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_GetProcessHeap( VOID ) { static FN_GetProcessHeap *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessHeap", &g_Kernel32); return pfn (); } typedef DWORD WINAPI FN_GetProcessHeaps( DWORD NumberOfHeaps, PHANDLE ProcessHeaps ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProcessHeaps( DWORD NumberOfHeaps, PHANDLE ProcessHeaps ) { static FN_GetProcessHeaps *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessHeaps", &g_Kernel32); return pfn( NumberOfHeaps, ProcessHeaps ); } typedef BOOL WINAPI FN_HeapLock( HANDLE hHeap ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapLock( HANDLE hHeap ) { static FN_HeapLock *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapLock", &g_Kernel32); return pfn( hHeap ); } typedef BOOL WINAPI FN_HeapUnlock( HANDLE hHeap ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapUnlock( HANDLE hHeap ) { static FN_HeapUnlock *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapUnlock", &g_Kernel32); return pfn( hHeap ); } typedef BOOL WINAPI FN_HeapWalk( HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapWalk( HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry ) { static FN_HeapWalk *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapWalk", &g_Kernel32); return pfn( hHeap, lpEntry ); } typedef BOOL WINAPI FN_HeapSetInformation( HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation, SIZE_T HeapInformationLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapSetInformation( HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation, SIZE_T HeapInformationLength ) { static FN_HeapSetInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapSetInformation", &g_Kernel32); return pfn( HeapHandle, HeapInformationClass, HeapInformation, HeapInformationLength ); } typedef BOOL WINAPI FN_HeapQueryInformation( HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation, SIZE_T HeapInformationLength, PSIZE_T ReturnLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapQueryInformation( HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation, SIZE_T HeapInformationLength, PSIZE_T ReturnLength ) { static FN_HeapQueryInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "HeapQueryInformation", &g_Kernel32); return pfn( HeapHandle, HeapInformationClass, HeapInformation, HeapInformationLength, ReturnLength ); } typedef BOOL WINAPI FN_GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType ) { static FN_GetBinaryTypeA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetBinaryTypeA", &g_Kernel32); return pfn( lpApplicationName, lpBinaryType ); } typedef BOOL WINAPI FN_GetBinaryTypeW( LPCWSTR lpApplicationName, LPDWORD lpBinaryType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetBinaryTypeW( LPCWSTR lpApplicationName, LPDWORD lpBinaryType ) { static FN_GetBinaryTypeW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetBinaryTypeW", &g_Kernel32); return pfn( lpApplicationName, lpBinaryType ); } typedef DWORD WINAPI FN_GetShortPathNameA( LPCSTR lpszLongPath, LPSTR lpszShortPath, DWORD cchBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetShortPathNameA( LPCSTR lpszLongPath, LPSTR lpszShortPath, DWORD cchBuffer ) { static FN_GetShortPathNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetShortPathNameA", &g_Kernel32); return pfn( lpszLongPath, lpszShortPath, cchBuffer ); } typedef DWORD WINAPI FN_GetShortPathNameW( LPCWSTR lpszLongPath, LPWSTR lpszShortPath, DWORD cchBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetShortPathNameW( LPCWSTR lpszLongPath, LPWSTR lpszShortPath, DWORD cchBuffer ) { static FN_GetShortPathNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetShortPathNameW", &g_Kernel32); return pfn( lpszLongPath, lpszShortPath, cchBuffer ); } typedef DWORD WINAPI FN_GetLongPathNameA( LPCSTR lpszShortPath, LPSTR lpszLongPath, DWORD cchBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLongPathNameA( LPCSTR lpszShortPath, LPSTR lpszLongPath, DWORD cchBuffer ) { static FN_GetLongPathNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLongPathNameA", &g_Kernel32); return pfn( lpszShortPath, lpszLongPath, cchBuffer ); } typedef DWORD WINAPI FN_GetLongPathNameW( LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLongPathNameW( LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer ) { static FN_GetLongPathNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLongPathNameW", &g_Kernel32); return pfn( lpszShortPath, lpszLongPath, cchBuffer ); } typedef BOOL WINAPI FN_GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR lpProcessAffinityMask, PDWORD_PTR lpSystemAffinityMask ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR lpProcessAffinityMask, PDWORD_PTR lpSystemAffinityMask ) { static FN_GetProcessAffinityMask *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessAffinityMask", &g_Kernel32); return pfn( hProcess, lpProcessAffinityMask, lpSystemAffinityMask ); } typedef BOOL WINAPI FN_SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR dwProcessAffinityMask ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR dwProcessAffinityMask ) { static FN_SetProcessAffinityMask *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetProcessAffinityMask", &g_Kernel32); return pfn( hProcess, dwProcessAffinityMask ); } typedef BOOL WINAPI FN_GetProcessHandleCount( HANDLE hProcess, PDWORD pdwHandleCount ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessHandleCount( HANDLE hProcess, PDWORD pdwHandleCount ) { static FN_GetProcessHandleCount *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessHandleCount", &g_Kernel32); return pfn( hProcess, pdwHandleCount ); } typedef BOOL WINAPI FN_GetProcessTimes( HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessTimes( HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ) { static FN_GetProcessTimes *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessTimes", &g_Kernel32); return pfn( hProcess, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime ); } typedef BOOL WINAPI FN_GetProcessIoCounters( HANDLE hProcess, PIO_COUNTERS lpIoCounters ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessIoCounters( HANDLE hProcess, PIO_COUNTERS lpIoCounters ) { static FN_GetProcessIoCounters *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessIoCounters", &g_Kernel32); return pfn( hProcess, lpIoCounters ); } typedef BOOL WINAPI FN_GetProcessWorkingSetSize( HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessWorkingSetSize( HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize ) { static FN_GetProcessWorkingSetSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessWorkingSetSize", &g_Kernel32); return pfn( hProcess, lpMinimumWorkingSetSize, lpMaximumWorkingSetSize ); } typedef BOOL WINAPI FN_GetProcessWorkingSetSizeEx( HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize, PDWORD Flags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessWorkingSetSizeEx( HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize, PDWORD Flags ) { static FN_GetProcessWorkingSetSizeEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessWorkingSetSizeEx", &g_Kernel32); return pfn( hProcess, lpMinimumWorkingSetSize, lpMaximumWorkingSetSize, Flags ); } typedef BOOL WINAPI FN_SetProcessWorkingSetSize( HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetProcessWorkingSetSize( HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize ) { static FN_SetProcessWorkingSetSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetProcessWorkingSetSize", &g_Kernel32); return pfn( hProcess, dwMinimumWorkingSetSize, dwMaximumWorkingSetSize ); } typedef BOOL WINAPI FN_SetProcessWorkingSetSizeEx( HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize, DWORD Flags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetProcessWorkingSetSizeEx( HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize, DWORD Flags ) { static FN_SetProcessWorkingSetSizeEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetProcessWorkingSetSizeEx", &g_Kernel32); return pfn( hProcess, dwMinimumWorkingSetSize, dwMaximumWorkingSetSize, Flags ); } typedef HANDLE WINAPI FN_OpenProcess( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenProcess( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId ) { static FN_OpenProcess *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenProcess", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, dwProcessId ); } typedef HANDLE WINAPI FN_GetCurrentProcess( VOID ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_GetCurrentProcess( VOID ) { static FN_GetCurrentProcess *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentProcess", &g_Kernel32); return pfn (); } typedef DWORD WINAPI FN_GetCurrentProcessId( VOID ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCurrentProcessId( VOID ) { static FN_GetCurrentProcessId *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentProcessId", &g_Kernel32); return pfn (); } typedef VOID WINAPI FN_ExitProcess( UINT uExitCode ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_ExitProcess( UINT uExitCode ) { static FN_ExitProcess *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ExitProcess", &g_Kernel32); pfn( uExitCode ); } typedef BOOL WINAPI FN_TerminateProcess( HANDLE hProcess, UINT uExitCode ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_TerminateProcess( HANDLE hProcess, UINT uExitCode ) { static FN_TerminateProcess *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TerminateProcess", &g_Kernel32); return pfn( hProcess, uExitCode ); } typedef BOOL WINAPI FN_GetExitCodeProcess( HANDLE hProcess, LPDWORD lpExitCode ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetExitCodeProcess( HANDLE hProcess, LPDWORD lpExitCode ) { static FN_GetExitCodeProcess *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetExitCodeProcess", &g_Kernel32); return pfn( hProcess, lpExitCode ); } typedef VOID WINAPI FN_FatalExit( int ExitCode ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_FatalExit( int ExitCode ) { static FN_FatalExit *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FatalExit", &g_Kernel32); pfn( ExitCode ); } typedef LPCH WINAPI FN_GetEnvironmentStrings( VOID ); __declspec(dllexport) LPCH WINAPI kPrf2Wrap_GetEnvironmentStrings( VOID ) { static FN_GetEnvironmentStrings *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetEnvironmentStrings", &g_Kernel32); return pfn (); } typedef LPWCH WINAPI FN_GetEnvironmentStringsW( VOID ); __declspec(dllexport) LPWCH WINAPI kPrf2Wrap_GetEnvironmentStringsW( VOID ) { static FN_GetEnvironmentStringsW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetEnvironmentStringsW", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_SetEnvironmentStringsA( LPCH NewEnvironment ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEnvironmentStringsA( LPCH NewEnvironment ) { static FN_SetEnvironmentStringsA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetEnvironmentStringsA", &g_Kernel32); return pfn( NewEnvironment ); } typedef BOOL WINAPI FN_SetEnvironmentStringsW( LPWCH NewEnvironment ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEnvironmentStringsW( LPWCH NewEnvironment ) { static FN_SetEnvironmentStringsW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetEnvironmentStringsW", &g_Kernel32); return pfn( NewEnvironment ); } typedef BOOL WINAPI FN_FreeEnvironmentStringsA( LPCH a); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeEnvironmentStringsA( LPCH a) { static FN_FreeEnvironmentStringsA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FreeEnvironmentStringsA", &g_Kernel32); return pfn( a); } typedef BOOL WINAPI FN_FreeEnvironmentStringsW( LPWCH a); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeEnvironmentStringsW( LPWCH a) { static FN_FreeEnvironmentStringsW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FreeEnvironmentStringsW", &g_Kernel32); return pfn( a); } typedef VOID WINAPI FN_RaiseException( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments, CONST ULONG_PTR * lpArguments ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_RaiseException( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments, CONST ULONG_PTR * lpArguments ) { static FN_RaiseException *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RaiseException", &g_Kernel32); pfn( dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments ); } typedef LONG WINAPI FN_UnhandledExceptionFilter( struct _EXCEPTION_POINTERS * ExceptionInfo ); __declspec(dllexport) LONG WINAPI kPrf2Wrap_UnhandledExceptionFilter( struct _EXCEPTION_POINTERS * ExceptionInfo ) { static FN_UnhandledExceptionFilter *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "UnhandledExceptionFilter", &g_Kernel32); return pfn( ExceptionInfo ); } typedef LPTOP_LEVEL_EXCEPTION_FILTER WINAPI FN_SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter ); __declspec(dllexport) LPTOP_LEVEL_EXCEPTION_FILTER WINAPI kPrf2Wrap_SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter ) { static FN_SetUnhandledExceptionFilter *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetUnhandledExceptionFilter", &g_Kernel32); return pfn( lpTopLevelExceptionFilter ); } typedef LPVOID WINAPI FN_CreateFiber( SIZE_T dwStackSize, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_CreateFiber( SIZE_T dwStackSize, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter ) { static FN_CreateFiber *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateFiber", &g_Kernel32); return pfn( dwStackSize, lpStartAddress, lpParameter ); } typedef LPVOID WINAPI FN_CreateFiberEx( SIZE_T dwStackCommitSize, SIZE_T dwStackReserveSize, DWORD dwFlags, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_CreateFiberEx( SIZE_T dwStackCommitSize, SIZE_T dwStackReserveSize, DWORD dwFlags, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter ) { static FN_CreateFiberEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateFiberEx", &g_Kernel32); return pfn( dwStackCommitSize, dwStackReserveSize, dwFlags, lpStartAddress, lpParameter ); } typedef VOID WINAPI FN_DeleteFiber( LPVOID lpFiber ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_DeleteFiber( LPVOID lpFiber ) { static FN_DeleteFiber *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteFiber", &g_Kernel32); pfn( lpFiber ); } typedef LPVOID WINAPI FN_ConvertThreadToFiber( LPVOID lpParameter ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_ConvertThreadToFiber( LPVOID lpParameter ) { static FN_ConvertThreadToFiber *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ConvertThreadToFiber", &g_Kernel32); return pfn( lpParameter ); } typedef LPVOID WINAPI FN_ConvertThreadToFiberEx( LPVOID lpParameter, DWORD dwFlags ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_ConvertThreadToFiberEx( LPVOID lpParameter, DWORD dwFlags ) { static FN_ConvertThreadToFiberEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ConvertThreadToFiberEx", &g_Kernel32); return pfn( lpParameter, dwFlags ); } typedef BOOL WINAPI FN_ConvertFiberToThread( VOID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ConvertFiberToThread( VOID ) { static FN_ConvertFiberToThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ConvertFiberToThread", &g_Kernel32); return pfn (); } typedef VOID WINAPI FN_SwitchToFiber( LPVOID lpFiber ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_SwitchToFiber( LPVOID lpFiber ) { static FN_SwitchToFiber *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SwitchToFiber", &g_Kernel32); pfn( lpFiber ); } typedef BOOL WINAPI FN_SwitchToThread( VOID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SwitchToThread( VOID ) { static FN_SwitchToThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SwitchToThread", &g_Kernel32); return pfn (); } typedef HANDLE WINAPI FN_CreateThread( LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateThread( LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ) { static FN_CreateThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateThread", &g_Kernel32); return pfn( lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId ); } typedef HANDLE WINAPI FN_CreateRemoteThread( HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateRemoteThread( HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ) { static FN_CreateRemoteThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateRemoteThread", &g_Kernel32); return pfn( hProcess, lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId ); } typedef HANDLE WINAPI FN_GetCurrentThread( VOID ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_GetCurrentThread( VOID ) { static FN_GetCurrentThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentThread", &g_Kernel32); return pfn (); } typedef DWORD WINAPI FN_GetCurrentThreadId( VOID ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCurrentThreadId( VOID ) { static FN_GetCurrentThreadId *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentThreadId", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_SetThreadStackGuarantee( PULONG StackSizeInBytes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetThreadStackGuarantee( PULONG StackSizeInBytes ) { static FN_SetThreadStackGuarantee *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetThreadStackGuarantee", &g_Kernel32); return pfn( StackSizeInBytes ); } typedef DWORD WINAPI FN_GetProcessIdOfThread( HANDLE Thread ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProcessIdOfThread( HANDLE Thread ) { static FN_GetProcessIdOfThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessIdOfThread", &g_Kernel32); return pfn( Thread ); } typedef DWORD WINAPI FN_GetThreadId( HANDLE Thread ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetThreadId( HANDLE Thread ) { static FN_GetThreadId *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetThreadId", &g_Kernel32); return pfn( Thread ); } typedef DWORD WINAPI FN_GetProcessId( HANDLE Process ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProcessId( HANDLE Process ) { static FN_GetProcessId *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessId", &g_Kernel32); return pfn( Process ); } typedef DWORD WINAPI FN_GetCurrentProcessorNumber( VOID ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCurrentProcessorNumber( VOID ) { static FN_GetCurrentProcessorNumber *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentProcessorNumber", &g_Kernel32); return pfn (); } typedef DWORD_PTR WINAPI FN_SetThreadAffinityMask( HANDLE hThread, DWORD_PTR dwThreadAffinityMask ); __declspec(dllexport) DWORD_PTR WINAPI kPrf2Wrap_SetThreadAffinityMask( HANDLE hThread, DWORD_PTR dwThreadAffinityMask ) { static FN_SetThreadAffinityMask *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetThreadAffinityMask", &g_Kernel32); return pfn( hThread, dwThreadAffinityMask ); } typedef DWORD WINAPI FN_SetThreadIdealProcessor( HANDLE hThread, DWORD dwIdealProcessor ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetThreadIdealProcessor( HANDLE hThread, DWORD dwIdealProcessor ) { static FN_SetThreadIdealProcessor *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetThreadIdealProcessor", &g_Kernel32); return pfn( hThread, dwIdealProcessor ); } typedef BOOL WINAPI FN_SetProcessPriorityBoost( HANDLE hProcess, BOOL bDisablePriorityBoost ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetProcessPriorityBoost( HANDLE hProcess, BOOL bDisablePriorityBoost ) { static FN_SetProcessPriorityBoost *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetProcessPriorityBoost", &g_Kernel32); return pfn( hProcess, bDisablePriorityBoost ); } typedef BOOL WINAPI FN_GetProcessPriorityBoost( HANDLE hProcess, PBOOL pDisablePriorityBoost ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessPriorityBoost( HANDLE hProcess, PBOOL pDisablePriorityBoost ) { static FN_GetProcessPriorityBoost *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessPriorityBoost", &g_Kernel32); return pfn( hProcess, pDisablePriorityBoost ); } typedef BOOL WINAPI FN_RequestWakeupLatency( LATENCY_TIME latency ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_RequestWakeupLatency( LATENCY_TIME latency ) { static FN_RequestWakeupLatency *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RequestWakeupLatency", &g_Kernel32); return pfn( latency ); } typedef BOOL WINAPI FN_IsSystemResumeAutomatic( VOID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsSystemResumeAutomatic( VOID ) { static FN_IsSystemResumeAutomatic *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsSystemResumeAutomatic", &g_Kernel32); return pfn (); } typedef HANDLE WINAPI FN_OpenThread( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenThread( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId ) { static FN_OpenThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenThread", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, dwThreadId ); } typedef BOOL WINAPI FN_SetThreadPriority( HANDLE hThread, int nPriority ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetThreadPriority( HANDLE hThread, int nPriority ) { static FN_SetThreadPriority *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetThreadPriority", &g_Kernel32); return pfn( hThread, nPriority ); } typedef BOOL WINAPI FN_SetThreadPriorityBoost( HANDLE hThread, BOOL bDisablePriorityBoost ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetThreadPriorityBoost( HANDLE hThread, BOOL bDisablePriorityBoost ) { static FN_SetThreadPriorityBoost *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetThreadPriorityBoost", &g_Kernel32); return pfn( hThread, bDisablePriorityBoost ); } typedef BOOL WINAPI FN_GetThreadPriorityBoost( HANDLE hThread, PBOOL pDisablePriorityBoost ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetThreadPriorityBoost( HANDLE hThread, PBOOL pDisablePriorityBoost ) { static FN_GetThreadPriorityBoost *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetThreadPriorityBoost", &g_Kernel32); return pfn( hThread, pDisablePriorityBoost ); } typedef int WINAPI FN_GetThreadPriority( HANDLE hThread ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetThreadPriority( HANDLE hThread ) { static FN_GetThreadPriority *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetThreadPriority", &g_Kernel32); return pfn( hThread ); } typedef BOOL WINAPI FN_GetThreadTimes( HANDLE hThread, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetThreadTimes( HANDLE hThread, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ) { static FN_GetThreadTimes *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetThreadTimes", &g_Kernel32); return pfn( hThread, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime ); } typedef BOOL WINAPI FN_GetThreadIOPendingFlag( HANDLE hThread, PBOOL lpIOIsPending ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetThreadIOPendingFlag( HANDLE hThread, PBOOL lpIOIsPending ) { static FN_GetThreadIOPendingFlag *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetThreadIOPendingFlag", &g_Kernel32); return pfn( hThread, lpIOIsPending ); } typedef VOID WINAPI FN_ExitThread( DWORD dwExitCode ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_ExitThread( DWORD dwExitCode ) { static FN_ExitThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ExitThread", &g_Kernel32); pfn( dwExitCode ); } typedef BOOL WINAPI FN_TerminateThread( HANDLE hThread, DWORD dwExitCode ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_TerminateThread( HANDLE hThread, DWORD dwExitCode ) { static FN_TerminateThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TerminateThread", &g_Kernel32); return pfn( hThread, dwExitCode ); } typedef BOOL WINAPI FN_GetExitCodeThread( HANDLE hThread, LPDWORD lpExitCode ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetExitCodeThread( HANDLE hThread, LPDWORD lpExitCode ) { static FN_GetExitCodeThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetExitCodeThread", &g_Kernel32); return pfn( hThread, lpExitCode ); } typedef BOOL WINAPI FN_GetThreadSelectorEntry( HANDLE hThread, DWORD dwSelector, LPLDT_ENTRY lpSelectorEntry ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetThreadSelectorEntry( HANDLE hThread, DWORD dwSelector, LPLDT_ENTRY lpSelectorEntry ) { static FN_GetThreadSelectorEntry *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetThreadSelectorEntry", &g_Kernel32); return pfn( hThread, dwSelector, lpSelectorEntry ); } typedef EXECUTION_STATE WINAPI FN_SetThreadExecutionState( EXECUTION_STATE esFlags ); __declspec(dllexport) EXECUTION_STATE WINAPI kPrf2Wrap_SetThreadExecutionState( EXECUTION_STATE esFlags ) { static FN_SetThreadExecutionState *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetThreadExecutionState", &g_Kernel32); return pfn( esFlags ); } typedef DWORD WINAPI FN_GetLastError( VOID ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLastError( VOID ) { static FN_GetLastError *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLastError", &g_Kernel32); return pfn (); } typedef VOID WINAPI FN_SetLastError( DWORD dwErrCode ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_SetLastError( DWORD dwErrCode ) { static FN_SetLastError *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetLastError", &g_Kernel32); pfn( dwErrCode ); } typedef VOID WINAPI FN_RestoreLastError( DWORD dwErrCode ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_RestoreLastError( DWORD dwErrCode ) { static FN_RestoreLastError *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RestoreLastError", &g_Kernel32); pfn( dwErrCode ); } typedef BOOL WINAPI FN_GetOverlappedResult( HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetOverlappedResult( HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait ) { static FN_GetOverlappedResult *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetOverlappedResult", &g_Kernel32); return pfn( hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait ); } typedef HANDLE WINAPI FN_CreateIoCompletionPort( HANDLE FileHandle, HANDLE ExistingCompletionPort, ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateIoCompletionPort( HANDLE FileHandle, HANDLE ExistingCompletionPort, ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads ) { static FN_CreateIoCompletionPort *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateIoCompletionPort", &g_Kernel32); return pfn( FileHandle, ExistingCompletionPort, CompletionKey, NumberOfConcurrentThreads ); } typedef BOOL WINAPI FN_GetQueuedCompletionStatus( HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred, PULONG_PTR lpCompletionKey, LPOVERLAPPED * lpOverlapped, DWORD dwMilliseconds ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetQueuedCompletionStatus( HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred, PULONG_PTR lpCompletionKey, LPOVERLAPPED * lpOverlapped, DWORD dwMilliseconds ) { static FN_GetQueuedCompletionStatus *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetQueuedCompletionStatus", &g_Kernel32); return pfn( CompletionPort, lpNumberOfBytesTransferred, lpCompletionKey, lpOverlapped, dwMilliseconds ); } typedef BOOL WINAPI FN_PostQueuedCompletionStatus( HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred, ULONG_PTR dwCompletionKey, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_PostQueuedCompletionStatus( HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred, ULONG_PTR dwCompletionKey, LPOVERLAPPED lpOverlapped ) { static FN_PostQueuedCompletionStatus *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "PostQueuedCompletionStatus", &g_Kernel32); return pfn( CompletionPort, dwNumberOfBytesTransferred, dwCompletionKey, lpOverlapped ); } typedef UINT WINAPI FN_SetErrorMode( UINT uMode ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_SetErrorMode( UINT uMode ) { static FN_SetErrorMode *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetErrorMode", &g_Kernel32); return pfn( uMode ); } typedef BOOL WINAPI FN_ReadProcessMemory( HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T * lpNumberOfBytesRead ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadProcessMemory( HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T * lpNumberOfBytesRead ) { static FN_ReadProcessMemory *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadProcessMemory", &g_Kernel32); return pfn( hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead ); } typedef BOOL WINAPI FN_WriteProcessMemory( HANDLE hProcess, LPVOID lpBaseAddress, LPCVOID lpBuffer, SIZE_T nSize, SIZE_T * lpNumberOfBytesWritten ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteProcessMemory( HANDLE hProcess, LPVOID lpBaseAddress, LPCVOID lpBuffer, SIZE_T nSize, SIZE_T * lpNumberOfBytesWritten ) { static FN_WriteProcessMemory *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteProcessMemory", &g_Kernel32); return pfn( hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesWritten ); } typedef BOOL WINAPI FN_GetThreadContext( HANDLE hThread, LPCONTEXT lpContext ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetThreadContext( HANDLE hThread, LPCONTEXT lpContext ) { static FN_GetThreadContext *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetThreadContext", &g_Kernel32); return pfn( hThread, lpContext ); } typedef BOOL WINAPI FN_SetThreadContext( HANDLE hThread, CONST CONTEXT * lpContext ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetThreadContext( HANDLE hThread, CONST CONTEXT * lpContext ) { static FN_SetThreadContext *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetThreadContext", &g_Kernel32); return pfn( hThread, lpContext ); } typedef DWORD WINAPI FN_SuspendThread( HANDLE hThread ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SuspendThread( HANDLE hThread ) { static FN_SuspendThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SuspendThread", &g_Kernel32); return pfn( hThread ); } typedef DWORD WINAPI FN_ResumeThread( HANDLE hThread ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_ResumeThread( HANDLE hThread ) { static FN_ResumeThread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ResumeThread", &g_Kernel32); return pfn( hThread ); } typedef DWORD WINAPI FN_QueueUserAPC( PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_QueueUserAPC( PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData ) { static FN_QueueUserAPC *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "QueueUserAPC", &g_Kernel32); return pfn( pfnAPC, hThread, dwData ); } typedef BOOL WINAPI FN_IsDebuggerPresent( VOID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsDebuggerPresent( VOID ) { static FN_IsDebuggerPresent *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsDebuggerPresent", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_CheckRemoteDebuggerPresent( HANDLE hProcess, PBOOL pbDebuggerPresent ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CheckRemoteDebuggerPresent( HANDLE hProcess, PBOOL pbDebuggerPresent ) { static FN_CheckRemoteDebuggerPresent *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CheckRemoteDebuggerPresent", &g_Kernel32); return pfn( hProcess, pbDebuggerPresent ); } typedef VOID WINAPI FN_DebugBreak( VOID ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_DebugBreak( VOID ) { static FN_DebugBreak *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DebugBreak", &g_Kernel32); pfn (); } typedef BOOL WINAPI FN_WaitForDebugEvent( LPDEBUG_EVENT lpDebugEvent, DWORD dwMilliseconds ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WaitForDebugEvent( LPDEBUG_EVENT lpDebugEvent, DWORD dwMilliseconds ) { static FN_WaitForDebugEvent *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WaitForDebugEvent", &g_Kernel32); return pfn( lpDebugEvent, dwMilliseconds ); } typedef BOOL WINAPI FN_ContinueDebugEvent( DWORD dwProcessId, DWORD dwThreadId, DWORD dwContinueStatus ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ContinueDebugEvent( DWORD dwProcessId, DWORD dwThreadId, DWORD dwContinueStatus ) { static FN_ContinueDebugEvent *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ContinueDebugEvent", &g_Kernel32); return pfn( dwProcessId, dwThreadId, dwContinueStatus ); } typedef BOOL WINAPI FN_DebugActiveProcess( DWORD dwProcessId ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DebugActiveProcess( DWORD dwProcessId ) { static FN_DebugActiveProcess *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DebugActiveProcess", &g_Kernel32); return pfn( dwProcessId ); } typedef BOOL WINAPI FN_DebugActiveProcessStop( DWORD dwProcessId ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DebugActiveProcessStop( DWORD dwProcessId ) { static FN_DebugActiveProcessStop *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DebugActiveProcessStop", &g_Kernel32); return pfn( dwProcessId ); } typedef BOOL WINAPI FN_DebugSetProcessKillOnExit( BOOL KillOnExit ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DebugSetProcessKillOnExit( BOOL KillOnExit ) { static FN_DebugSetProcessKillOnExit *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DebugSetProcessKillOnExit", &g_Kernel32); return pfn( KillOnExit ); } typedef BOOL WINAPI FN_DebugBreakProcess( HANDLE Process ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DebugBreakProcess( HANDLE Process ) { static FN_DebugBreakProcess *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DebugBreakProcess", &g_Kernel32); return pfn( Process ); } typedef VOID WINAPI FN_InitializeCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_InitializeCriticalSection( LPCRITICAL_SECTION lpCriticalSection ) { static FN_InitializeCriticalSection *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InitializeCriticalSection", &g_Kernel32); pfn( lpCriticalSection ); } typedef VOID WINAPI FN_EnterCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_EnterCriticalSection( LPCRITICAL_SECTION lpCriticalSection ) { static FN_EnterCriticalSection *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnterCriticalSection", &g_Kernel32); pfn( lpCriticalSection ); } typedef VOID WINAPI FN_LeaveCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_LeaveCriticalSection( LPCRITICAL_SECTION lpCriticalSection ) { static FN_LeaveCriticalSection *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LeaveCriticalSection", &g_Kernel32); pfn( lpCriticalSection ); } typedef BOOL WINAPI FN_InitializeCriticalSectionAndSpinCount( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_InitializeCriticalSectionAndSpinCount( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount ) { static FN_InitializeCriticalSectionAndSpinCount *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InitializeCriticalSectionAndSpinCount", &g_Kernel32); return pfn( lpCriticalSection, dwSpinCount ); } typedef DWORD WINAPI FN_SetCriticalSectionSpinCount( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetCriticalSectionSpinCount( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount ) { static FN_SetCriticalSectionSpinCount *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetCriticalSectionSpinCount", &g_Kernel32); return pfn( lpCriticalSection, dwSpinCount ); } typedef BOOL WINAPI FN_TryEnterCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_TryEnterCriticalSection( LPCRITICAL_SECTION lpCriticalSection ) { static FN_TryEnterCriticalSection *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TryEnterCriticalSection", &g_Kernel32); return pfn( lpCriticalSection ); } typedef VOID WINAPI FN_DeleteCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_DeleteCriticalSection( LPCRITICAL_SECTION lpCriticalSection ) { static FN_DeleteCriticalSection *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteCriticalSection", &g_Kernel32); pfn( lpCriticalSection ); } typedef BOOL WINAPI FN_SetEvent( HANDLE hEvent ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEvent( HANDLE hEvent ) { static FN_SetEvent *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetEvent", &g_Kernel32); return pfn( hEvent ); } typedef BOOL WINAPI FN_ResetEvent( HANDLE hEvent ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ResetEvent( HANDLE hEvent ) { static FN_ResetEvent *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ResetEvent", &g_Kernel32); return pfn( hEvent ); } typedef BOOL WINAPI FN_PulseEvent( HANDLE hEvent ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_PulseEvent( HANDLE hEvent ) { static FN_PulseEvent *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "PulseEvent", &g_Kernel32); return pfn( hEvent ); } typedef BOOL WINAPI FN_ReleaseSemaphore( HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReleaseSemaphore( HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount ) { static FN_ReleaseSemaphore *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReleaseSemaphore", &g_Kernel32); return pfn( hSemaphore, lReleaseCount, lpPreviousCount ); } typedef BOOL WINAPI FN_ReleaseMutex( HANDLE hMutex ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReleaseMutex( HANDLE hMutex ) { static FN_ReleaseMutex *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReleaseMutex", &g_Kernel32); return pfn( hMutex ); } typedef DWORD WINAPI FN_WaitForSingleObject( HANDLE hHandle, DWORD dwMilliseconds ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_WaitForSingleObject( HANDLE hHandle, DWORD dwMilliseconds ) { static FN_WaitForSingleObject *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WaitForSingleObject", &g_Kernel32); return pfn( hHandle, dwMilliseconds ); } typedef DWORD WINAPI FN_WaitForMultipleObjects( DWORD nCount, CONST HANDLE * lpHandles, BOOL bWaitAll, DWORD dwMilliseconds ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_WaitForMultipleObjects( DWORD nCount, CONST HANDLE * lpHandles, BOOL bWaitAll, DWORD dwMilliseconds ) { static FN_WaitForMultipleObjects *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WaitForMultipleObjects", &g_Kernel32); return pfn( nCount, lpHandles, bWaitAll, dwMilliseconds ); } typedef VOID WINAPI FN_Sleep( DWORD dwMilliseconds ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_Sleep( DWORD dwMilliseconds ) { static FN_Sleep *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Sleep", &g_Kernel32); pfn( dwMilliseconds ); } typedef HGLOBAL WINAPI FN_LoadResource( HMODULE hModule, HRSRC hResInfo ); __declspec(dllexport) HGLOBAL WINAPI kPrf2Wrap_LoadResource( HMODULE hModule, HRSRC hResInfo ) { static FN_LoadResource *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LoadResource", &g_Kernel32); return pfn( hModule, hResInfo ); } typedef DWORD WINAPI FN_SizeofResource( HMODULE hModule, HRSRC hResInfo ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SizeofResource( HMODULE hModule, HRSRC hResInfo ) { static FN_SizeofResource *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SizeofResource", &g_Kernel32); return pfn( hModule, hResInfo ); } typedef ATOM WINAPI FN_GlobalDeleteAtom( ATOM nAtom ); __declspec(dllexport) ATOM WINAPI kPrf2Wrap_GlobalDeleteAtom( ATOM nAtom ) { static FN_GlobalDeleteAtom *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalDeleteAtom", &g_Kernel32); return pfn( nAtom ); } typedef BOOL WINAPI FN_InitAtomTable( DWORD nSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_InitAtomTable( DWORD nSize ) { static FN_InitAtomTable *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InitAtomTable", &g_Kernel32); return pfn( nSize ); } typedef ATOM WINAPI FN_DeleteAtom( ATOM nAtom ); __declspec(dllexport) ATOM WINAPI kPrf2Wrap_DeleteAtom( ATOM nAtom ) { static FN_DeleteAtom *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteAtom", &g_Kernel32); return pfn( nAtom ); } typedef UINT WINAPI FN_SetHandleCount( UINT uNumber ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_SetHandleCount( UINT uNumber ) { static FN_SetHandleCount *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetHandleCount", &g_Kernel32); return pfn( uNumber ); } typedef DWORD WINAPI FN_GetLogicalDrives( VOID ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLogicalDrives( VOID ) { static FN_GetLogicalDrives *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLogicalDrives", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_LockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh ) { static FN_LockFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LockFile", &g_Kernel32); return pfn( hFile, dwFileOffsetLow, dwFileOffsetHigh, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh ); } typedef BOOL WINAPI FN_UnlockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_UnlockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh ) { static FN_UnlockFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "UnlockFile", &g_Kernel32); return pfn( hFile, dwFileOffsetLow, dwFileOffsetHigh, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh ); } typedef BOOL WINAPI FN_LockFileEx( HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LockFileEx( HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped ) { static FN_LockFileEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LockFileEx", &g_Kernel32); return pfn( hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, lpOverlapped ); } typedef BOOL WINAPI FN_UnlockFileEx( HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_UnlockFileEx( HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped ) { static FN_UnlockFileEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "UnlockFileEx", &g_Kernel32); return pfn( hFile, dwReserved, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh, lpOverlapped ); } typedef BOOL WINAPI FN_GetFileInformationByHandle( HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileInformationByHandle( HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation ) { static FN_GetFileInformationByHandle *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileInformationByHandle", &g_Kernel32); return pfn( hFile, lpFileInformation ); } typedef DWORD WINAPI FN_GetFileType( HANDLE hFile ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFileType( HANDLE hFile ) { static FN_GetFileType *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileType", &g_Kernel32); return pfn( hFile ); } typedef DWORD WINAPI FN_GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh ) { static FN_GetFileSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileSize", &g_Kernel32); return pfn( hFile, lpFileSizeHigh ); } typedef BOOL WINAPI FN_GetFileSizeEx( HANDLE hFile, PLARGE_INTEGER lpFileSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileSizeEx( HANDLE hFile, PLARGE_INTEGER lpFileSize ) { static FN_GetFileSizeEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileSizeEx", &g_Kernel32); return pfn( hFile, lpFileSize ); } typedef HANDLE WINAPI FN_GetStdHandle( DWORD nStdHandle ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_GetStdHandle( DWORD nStdHandle ) { static FN_GetStdHandle *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetStdHandle", &g_Kernel32); return pfn( nStdHandle ); } typedef BOOL WINAPI FN_SetStdHandle( DWORD nStdHandle, HANDLE hHandle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetStdHandle( DWORD nStdHandle, HANDLE hHandle ) { static FN_SetStdHandle *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetStdHandle", &g_Kernel32); return pfn( nStdHandle, hHandle ); } typedef BOOL WINAPI FN_WriteFile( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteFile( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped ) { static FN_WriteFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteFile", &g_Kernel32); return pfn( hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped ); } typedef BOOL WINAPI FN_ReadFile( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadFile( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) { static FN_ReadFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadFile", &g_Kernel32); return pfn( hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped ); } typedef BOOL WINAPI FN_FlushFileBuffers( HANDLE hFile ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlushFileBuffers( HANDLE hFile ) { static FN_FlushFileBuffers *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FlushFileBuffers", &g_Kernel32); return pfn( hFile ); } typedef BOOL WINAPI FN_DeviceIoControl( HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeviceIoControl( HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped ) { static FN_DeviceIoControl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeviceIoControl", &g_Kernel32); return pfn( hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped ); } typedef BOOL WINAPI FN_RequestDeviceWakeup( HANDLE hDevice ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_RequestDeviceWakeup( HANDLE hDevice ) { static FN_RequestDeviceWakeup *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RequestDeviceWakeup", &g_Kernel32); return pfn( hDevice ); } typedef BOOL WINAPI FN_CancelDeviceWakeupRequest( HANDLE hDevice ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CancelDeviceWakeupRequest( HANDLE hDevice ) { static FN_CancelDeviceWakeupRequest *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CancelDeviceWakeupRequest", &g_Kernel32); return pfn( hDevice ); } typedef BOOL WINAPI FN_GetDevicePowerState( HANDLE hDevice, BOOL * pfOn ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDevicePowerState( HANDLE hDevice, BOOL * pfOn ) { static FN_GetDevicePowerState *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDevicePowerState", &g_Kernel32); return pfn( hDevice, pfOn ); } typedef BOOL WINAPI FN_SetMessageWaitingIndicator( HANDLE hMsgIndicator, ULONG ulMsgCount ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetMessageWaitingIndicator( HANDLE hMsgIndicator, ULONG ulMsgCount ) { static FN_SetMessageWaitingIndicator *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetMessageWaitingIndicator", &g_Kernel32); return pfn( hMsgIndicator, ulMsgCount ); } typedef BOOL WINAPI FN_SetEndOfFile( HANDLE hFile ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEndOfFile( HANDLE hFile ) { static FN_SetEndOfFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetEndOfFile", &g_Kernel32); return pfn( hFile ); } typedef DWORD WINAPI FN_SetFilePointer( HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetFilePointer( HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod ) { static FN_SetFilePointer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFilePointer", &g_Kernel32); return pfn( hFile, lDistanceToMove, lpDistanceToMoveHigh, dwMoveMethod ); } typedef BOOL WINAPI FN_SetFilePointerEx( HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFilePointerEx( HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod ) { static FN_SetFilePointerEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFilePointerEx", &g_Kernel32); return pfn( hFile, liDistanceToMove, lpNewFilePointer, dwMoveMethod ); } typedef BOOL WINAPI FN_FindClose( HANDLE hFindFile ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindClose( HANDLE hFindFile ) { static FN_FindClose *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindClose", &g_Kernel32); return pfn( hFindFile ); } typedef BOOL WINAPI FN_GetFileTime( HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileTime( HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime ) { static FN_GetFileTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileTime", &g_Kernel32); return pfn( hFile, lpCreationTime, lpLastAccessTime, lpLastWriteTime ); } typedef BOOL WINAPI FN_SetFileTime( HANDLE hFile, CONST FILETIME * lpCreationTime, CONST FILETIME * lpLastAccessTime, CONST FILETIME * lpLastWriteTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileTime( HANDLE hFile, CONST FILETIME * lpCreationTime, CONST FILETIME * lpLastAccessTime, CONST FILETIME * lpLastWriteTime ) { static FN_SetFileTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFileTime", &g_Kernel32); return pfn( hFile, lpCreationTime, lpLastAccessTime, lpLastWriteTime ); } typedef BOOL WINAPI FN_SetFileValidData( HANDLE hFile, LONGLONG ValidDataLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileValidData( HANDLE hFile, LONGLONG ValidDataLength ) { static FN_SetFileValidData *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFileValidData", &g_Kernel32); return pfn( hFile, ValidDataLength ); } typedef BOOL WINAPI FN_SetFileShortNameA( HANDLE hFile, LPCSTR lpShortName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileShortNameA( HANDLE hFile, LPCSTR lpShortName ) { static FN_SetFileShortNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFileShortNameA", &g_Kernel32); return pfn( hFile, lpShortName ); } typedef BOOL WINAPI FN_SetFileShortNameW( HANDLE hFile, LPCWSTR lpShortName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileShortNameW( HANDLE hFile, LPCWSTR lpShortName ) { static FN_SetFileShortNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFileShortNameW", &g_Kernel32); return pfn( hFile, lpShortName ); } typedef BOOL WINAPI FN_CloseHandle( HANDLE hObject ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CloseHandle( HANDLE hObject ) { static FN_CloseHandle *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CloseHandle", &g_Kernel32); return pfn( hObject ); } typedef BOOL WINAPI FN_DuplicateHandle( HANDLE hSourceProcessHandle, HANDLE hSourceHandle, HANDLE hTargetProcessHandle, LPHANDLE lpTargetHandle, DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwOptions ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DuplicateHandle( HANDLE hSourceProcessHandle, HANDLE hSourceHandle, HANDLE hTargetProcessHandle, LPHANDLE lpTargetHandle, DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwOptions ) { static FN_DuplicateHandle *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DuplicateHandle", &g_Kernel32); return pfn( hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, lpTargetHandle, dwDesiredAccess, bInheritHandle, dwOptions ); } typedef BOOL WINAPI FN_GetHandleInformation( HANDLE hObject, LPDWORD lpdwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetHandleInformation( HANDLE hObject, LPDWORD lpdwFlags ) { static FN_GetHandleInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetHandleInformation", &g_Kernel32); return pfn( hObject, lpdwFlags ); } typedef BOOL WINAPI FN_SetHandleInformation( HANDLE hObject, DWORD dwMask, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetHandleInformation( HANDLE hObject, DWORD dwMask, DWORD dwFlags ) { static FN_SetHandleInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetHandleInformation", &g_Kernel32); return pfn( hObject, dwMask, dwFlags ); } typedef DWORD WINAPI FN_LoadModule( LPCSTR lpModuleName, LPVOID lpParameterBlock ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_LoadModule( LPCSTR lpModuleName, LPVOID lpParameterBlock ) { static FN_LoadModule *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LoadModule", &g_Kernel32); return pfn( lpModuleName, lpParameterBlock ); } typedef UINT WINAPI FN_WinExec( LPCSTR lpCmdLine, UINT uCmdShow ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_WinExec( LPCSTR lpCmdLine, UINT uCmdShow ) { static FN_WinExec *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WinExec", &g_Kernel32); return pfn( lpCmdLine, uCmdShow ); } typedef BOOL WINAPI FN_ClearCommBreak( HANDLE hFile ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ClearCommBreak( HANDLE hFile ) { static FN_ClearCommBreak *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ClearCommBreak", &g_Kernel32); return pfn( hFile ); } typedef BOOL WINAPI FN_ClearCommError( HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpStat ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ClearCommError( HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpStat ) { static FN_ClearCommError *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ClearCommError", &g_Kernel32); return pfn( hFile, lpErrors, lpStat ); } typedef BOOL WINAPI FN_SetupComm( HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetupComm( HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue ) { static FN_SetupComm *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetupComm", &g_Kernel32); return pfn( hFile, dwInQueue, dwOutQueue ); } typedef BOOL WINAPI FN_EscapeCommFunction( HANDLE hFile, DWORD dwFunc ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EscapeCommFunction( HANDLE hFile, DWORD dwFunc ) { static FN_EscapeCommFunction *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EscapeCommFunction", &g_Kernel32); return pfn( hFile, dwFunc ); } typedef BOOL WINAPI FN_GetCommConfig( HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommConfig( HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ) { static FN_GetCommConfig *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCommConfig", &g_Kernel32); return pfn( hCommDev, lpCC, lpdwSize ); } typedef BOOL WINAPI FN_GetCommMask( HANDLE hFile, LPDWORD lpEvtMask ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommMask( HANDLE hFile, LPDWORD lpEvtMask ) { static FN_GetCommMask *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCommMask", &g_Kernel32); return pfn( hFile, lpEvtMask ); } typedef BOOL WINAPI FN_GetCommProperties( HANDLE hFile, LPCOMMPROP lpCommProp ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommProperties( HANDLE hFile, LPCOMMPROP lpCommProp ) { static FN_GetCommProperties *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCommProperties", &g_Kernel32); return pfn( hFile, lpCommProp ); } typedef BOOL WINAPI FN_GetCommModemStatus( HANDLE hFile, LPDWORD lpModemStat ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommModemStatus( HANDLE hFile, LPDWORD lpModemStat ) { static FN_GetCommModemStatus *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCommModemStatus", &g_Kernel32); return pfn( hFile, lpModemStat ); } typedef BOOL WINAPI FN_GetCommState( HANDLE hFile, LPDCB lpDCB ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommState( HANDLE hFile, LPDCB lpDCB ) { static FN_GetCommState *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCommState", &g_Kernel32); return pfn( hFile, lpDCB ); } typedef BOOL WINAPI FN_GetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts ) { static FN_GetCommTimeouts *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCommTimeouts", &g_Kernel32); return pfn( hFile, lpCommTimeouts ); } typedef BOOL WINAPI FN_PurgeComm( HANDLE hFile, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_PurgeComm( HANDLE hFile, DWORD dwFlags ) { static FN_PurgeComm *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "PurgeComm", &g_Kernel32); return pfn( hFile, dwFlags ); } typedef BOOL WINAPI FN_SetCommBreak( HANDLE hFile ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCommBreak( HANDLE hFile ) { static FN_SetCommBreak *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetCommBreak", &g_Kernel32); return pfn( hFile ); } typedef BOOL WINAPI FN_SetCommConfig( HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCommConfig( HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize ) { static FN_SetCommConfig *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetCommConfig", &g_Kernel32); return pfn( hCommDev, lpCC, dwSize ); } typedef BOOL WINAPI FN_SetCommMask( HANDLE hFile, DWORD dwEvtMask ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCommMask( HANDLE hFile, DWORD dwEvtMask ) { static FN_SetCommMask *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetCommMask", &g_Kernel32); return pfn( hFile, dwEvtMask ); } typedef BOOL WINAPI FN_SetCommState( HANDLE hFile, LPDCB lpDCB ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCommState( HANDLE hFile, LPDCB lpDCB ) { static FN_SetCommState *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetCommState", &g_Kernel32); return pfn( hFile, lpDCB ); } typedef BOOL WINAPI FN_SetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts ) { static FN_SetCommTimeouts *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetCommTimeouts", &g_Kernel32); return pfn( hFile, lpCommTimeouts ); } typedef BOOL WINAPI FN_TransmitCommChar( HANDLE hFile, char cChar ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_TransmitCommChar( HANDLE hFile, char cChar ) { static FN_TransmitCommChar *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TransmitCommChar", &g_Kernel32); return pfn( hFile, cChar ); } typedef BOOL WINAPI FN_WaitCommEvent( HANDLE hFile, LPDWORD lpEvtMask, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WaitCommEvent( HANDLE hFile, LPDWORD lpEvtMask, LPOVERLAPPED lpOverlapped ) { static FN_WaitCommEvent *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WaitCommEvent", &g_Kernel32); return pfn( hFile, lpEvtMask, lpOverlapped ); } typedef DWORD WINAPI FN_SetTapePosition( HANDLE hDevice, DWORD dwPositionMethod, DWORD dwPartition, DWORD dwOffsetLow, DWORD dwOffsetHigh, BOOL bImmediate ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetTapePosition( HANDLE hDevice, DWORD dwPositionMethod, DWORD dwPartition, DWORD dwOffsetLow, DWORD dwOffsetHigh, BOOL bImmediate ) { static FN_SetTapePosition *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetTapePosition", &g_Kernel32); return pfn( hDevice, dwPositionMethod, dwPartition, dwOffsetLow, dwOffsetHigh, bImmediate ); } typedef DWORD WINAPI FN_GetTapePosition( HANDLE hDevice, DWORD dwPositionType, LPDWORD lpdwPartition, LPDWORD lpdwOffsetLow, LPDWORD lpdwOffsetHigh ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTapePosition( HANDLE hDevice, DWORD dwPositionType, LPDWORD lpdwPartition, LPDWORD lpdwOffsetLow, LPDWORD lpdwOffsetHigh ) { static FN_GetTapePosition *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTapePosition", &g_Kernel32); return pfn( hDevice, dwPositionType, lpdwPartition, lpdwOffsetLow, lpdwOffsetHigh ); } typedef DWORD WINAPI FN_PrepareTape( HANDLE hDevice, DWORD dwOperation, BOOL bImmediate ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_PrepareTape( HANDLE hDevice, DWORD dwOperation, BOOL bImmediate ) { static FN_PrepareTape *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "PrepareTape", &g_Kernel32); return pfn( hDevice, dwOperation, bImmediate ); } typedef DWORD WINAPI FN_EraseTape( HANDLE hDevice, DWORD dwEraseType, BOOL bImmediate ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_EraseTape( HANDLE hDevice, DWORD dwEraseType, BOOL bImmediate ) { static FN_EraseTape *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EraseTape", &g_Kernel32); return pfn( hDevice, dwEraseType, bImmediate ); } typedef DWORD WINAPI FN_CreateTapePartition( HANDLE hDevice, DWORD dwPartitionMethod, DWORD dwCount, DWORD dwSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_CreateTapePartition( HANDLE hDevice, DWORD dwPartitionMethod, DWORD dwCount, DWORD dwSize ) { static FN_CreateTapePartition *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateTapePartition", &g_Kernel32); return pfn( hDevice, dwPartitionMethod, dwCount, dwSize ); } typedef DWORD WINAPI FN_WriteTapemark( HANDLE hDevice, DWORD dwTapemarkType, DWORD dwTapemarkCount, BOOL bImmediate ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_WriteTapemark( HANDLE hDevice, DWORD dwTapemarkType, DWORD dwTapemarkCount, BOOL bImmediate ) { static FN_WriteTapemark *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteTapemark", &g_Kernel32); return pfn( hDevice, dwTapemarkType, dwTapemarkCount, bImmediate ); } typedef DWORD WINAPI FN_GetTapeStatus( HANDLE hDevice ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTapeStatus( HANDLE hDevice ) { static FN_GetTapeStatus *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTapeStatus", &g_Kernel32); return pfn( hDevice ); } typedef DWORD WINAPI FN_GetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPDWORD lpdwSize, LPVOID lpTapeInformation ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPDWORD lpdwSize, LPVOID lpTapeInformation ) { static FN_GetTapeParameters *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTapeParameters", &g_Kernel32); return pfn( hDevice, dwOperation, lpdwSize, lpTapeInformation ); } typedef DWORD WINAPI FN_SetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPVOID lpTapeInformation ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPVOID lpTapeInformation ) { static FN_SetTapeParameters *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetTapeParameters", &g_Kernel32); return pfn( hDevice, dwOperation, lpTapeInformation ); } typedef BOOL WINAPI FN_Beep( DWORD dwFreq, DWORD dwDuration ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Beep( DWORD dwFreq, DWORD dwDuration ) { static FN_Beep *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Beep", &g_Kernel32); return pfn( dwFreq, dwDuration ); } typedef int WINAPI FN_MulDiv( int nNumber, int nNumerator, int nDenominator ); __declspec(dllexport) int WINAPI kPrf2Wrap_MulDiv( int nNumber, int nNumerator, int nDenominator ) { static FN_MulDiv *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MulDiv", &g_Kernel32); return pfn( nNumber, nNumerator, nDenominator ); } typedef VOID WINAPI FN_GetSystemTime( LPSYSTEMTIME lpSystemTime ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_GetSystemTime( LPSYSTEMTIME lpSystemTime ) { static FN_GetSystemTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemTime", &g_Kernel32); pfn( lpSystemTime ); } typedef VOID WINAPI FN_GetSystemTimeAsFileTime( LPFILETIME lpSystemTimeAsFileTime ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_GetSystemTimeAsFileTime( LPFILETIME lpSystemTimeAsFileTime ) { static FN_GetSystemTimeAsFileTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemTimeAsFileTime", &g_Kernel32); pfn( lpSystemTimeAsFileTime ); } typedef BOOL WINAPI FN_SetSystemTime( CONST SYSTEMTIME * lpSystemTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSystemTime( CONST SYSTEMTIME * lpSystemTime ) { static FN_SetSystemTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetSystemTime", &g_Kernel32); return pfn( lpSystemTime ); } typedef VOID WINAPI FN_GetLocalTime( LPSYSTEMTIME lpSystemTime ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_GetLocalTime( LPSYSTEMTIME lpSystemTime ) { static FN_GetLocalTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLocalTime", &g_Kernel32); pfn( lpSystemTime ); } typedef BOOL WINAPI FN_SetLocalTime( CONST SYSTEMTIME * lpSystemTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetLocalTime( CONST SYSTEMTIME * lpSystemTime ) { static FN_SetLocalTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetLocalTime", &g_Kernel32); return pfn( lpSystemTime ); } typedef VOID WINAPI FN_GetSystemInfo( LPSYSTEM_INFO lpSystemInfo ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_GetSystemInfo( LPSYSTEM_INFO lpSystemInfo ) { static FN_GetSystemInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemInfo", &g_Kernel32); pfn( lpSystemInfo ); } typedef BOOL WINAPI FN_SetSystemFileCacheSize( SIZE_T MinimumFileCacheSize, SIZE_T MaximumFileCacheSize, DWORD Flags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSystemFileCacheSize( SIZE_T MinimumFileCacheSize, SIZE_T MaximumFileCacheSize, DWORD Flags ) { static FN_SetSystemFileCacheSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetSystemFileCacheSize", &g_Kernel32); return pfn( MinimumFileCacheSize, MaximumFileCacheSize, Flags ); } typedef BOOL WINAPI FN_GetSystemFileCacheSize( PSIZE_T lpMinimumFileCacheSize, PSIZE_T lpMaximumFileCacheSize, PDWORD lpFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSystemFileCacheSize( PSIZE_T lpMinimumFileCacheSize, PSIZE_T lpMaximumFileCacheSize, PDWORD lpFlags ) { static FN_GetSystemFileCacheSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemFileCacheSize", &g_Kernel32); return pfn( lpMinimumFileCacheSize, lpMaximumFileCacheSize, lpFlags ); } typedef BOOL WINAPI FN_GetSystemRegistryQuota( PDWORD pdwQuotaAllowed, PDWORD pdwQuotaUsed ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSystemRegistryQuota( PDWORD pdwQuotaAllowed, PDWORD pdwQuotaUsed ) { static FN_GetSystemRegistryQuota *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemRegistryQuota", &g_Kernel32); return pfn( pdwQuotaAllowed, pdwQuotaUsed ); } typedef BOOL WINAPI FN_GetSystemTimes( LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSystemTimes( LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ) { static FN_GetSystemTimes *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemTimes", &g_Kernel32); return pfn( lpIdleTime, lpKernelTime, lpUserTime ); } typedef VOID WINAPI FN_GetNativeSystemInfo( LPSYSTEM_INFO lpSystemInfo ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_GetNativeSystemInfo( LPSYSTEM_INFO lpSystemInfo ) { static FN_GetNativeSystemInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNativeSystemInfo", &g_Kernel32); pfn( lpSystemInfo ); } typedef BOOL WINAPI FN_IsProcessorFeaturePresent( DWORD ProcessorFeature ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsProcessorFeaturePresent( DWORD ProcessorFeature ) { static FN_IsProcessorFeaturePresent *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsProcessorFeaturePresent", &g_Kernel32); return pfn( ProcessorFeature ); } typedef BOOL WINAPI FN_SystemTimeToTzSpecificLocalTime( LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SystemTimeToTzSpecificLocalTime( LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime ) { static FN_SystemTimeToTzSpecificLocalTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SystemTimeToTzSpecificLocalTime", &g_Kernel32); return pfn( lpTimeZoneInformation, lpUniversalTime, lpLocalTime ); } typedef BOOL WINAPI FN_TzSpecificLocalTimeToSystemTime( LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_TzSpecificLocalTimeToSystemTime( LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime ) { static FN_TzSpecificLocalTimeToSystemTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TzSpecificLocalTimeToSystemTime", &g_Kernel32); return pfn( lpTimeZoneInformation, lpLocalTime, lpUniversalTime ); } typedef DWORD WINAPI FN_GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation ) { static FN_GetTimeZoneInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTimeZoneInformation", &g_Kernel32); return pfn( lpTimeZoneInformation ); } typedef BOOL WINAPI FN_SetTimeZoneInformation( CONST TIME_ZONE_INFORMATION * lpTimeZoneInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetTimeZoneInformation( CONST TIME_ZONE_INFORMATION * lpTimeZoneInformation ) { static FN_SetTimeZoneInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetTimeZoneInformation", &g_Kernel32); return pfn( lpTimeZoneInformation ); } typedef BOOL WINAPI FN_SystemTimeToFileTime( CONST SYSTEMTIME * lpSystemTime, LPFILETIME lpFileTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SystemTimeToFileTime( CONST SYSTEMTIME * lpSystemTime, LPFILETIME lpFileTime ) { static FN_SystemTimeToFileTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SystemTimeToFileTime", &g_Kernel32); return pfn( lpSystemTime, lpFileTime ); } typedef BOOL WINAPI FN_FileTimeToLocalFileTime( CONST FILETIME * lpFileTime, LPFILETIME lpLocalFileTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FileTimeToLocalFileTime( CONST FILETIME * lpFileTime, LPFILETIME lpLocalFileTime ) { static FN_FileTimeToLocalFileTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FileTimeToLocalFileTime", &g_Kernel32); return pfn( lpFileTime, lpLocalFileTime ); } typedef BOOL WINAPI FN_LocalFileTimeToFileTime( CONST FILETIME * lpLocalFileTime, LPFILETIME lpFileTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LocalFileTimeToFileTime( CONST FILETIME * lpLocalFileTime, LPFILETIME lpFileTime ) { static FN_LocalFileTimeToFileTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LocalFileTimeToFileTime", &g_Kernel32); return pfn( lpLocalFileTime, lpFileTime ); } typedef BOOL WINAPI FN_FileTimeToSystemTime( CONST FILETIME * lpFileTime, LPSYSTEMTIME lpSystemTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FileTimeToSystemTime( CONST FILETIME * lpFileTime, LPSYSTEMTIME lpSystemTime ) { static FN_FileTimeToSystemTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FileTimeToSystemTime", &g_Kernel32); return pfn( lpFileTime, lpSystemTime ); } typedef LONG WINAPI FN_CompareFileTime( CONST FILETIME * lpFileTime1, CONST FILETIME * lpFileTime2 ); __declspec(dllexport) LONG WINAPI kPrf2Wrap_CompareFileTime( CONST FILETIME * lpFileTime1, CONST FILETIME * lpFileTime2 ) { static FN_CompareFileTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CompareFileTime", &g_Kernel32); return pfn( lpFileTime1, lpFileTime2 ); } typedef BOOL WINAPI FN_FileTimeToDosDateTime( CONST FILETIME * lpFileTime, LPWORD lpFatDate, LPWORD lpFatTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FileTimeToDosDateTime( CONST FILETIME * lpFileTime, LPWORD lpFatDate, LPWORD lpFatTime ) { static FN_FileTimeToDosDateTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FileTimeToDosDateTime", &g_Kernel32); return pfn( lpFileTime, lpFatDate, lpFatTime ); } typedef BOOL WINAPI FN_DosDateTimeToFileTime( WORD wFatDate, WORD wFatTime, LPFILETIME lpFileTime ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DosDateTimeToFileTime( WORD wFatDate, WORD wFatTime, LPFILETIME lpFileTime ) { static FN_DosDateTimeToFileTime *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DosDateTimeToFileTime", &g_Kernel32); return pfn( wFatDate, wFatTime, lpFileTime ); } typedef DWORD WINAPI FN_GetTickCount( VOID ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTickCount( VOID ) { static FN_GetTickCount *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTickCount", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_SetSystemTimeAdjustment( DWORD dwTimeAdjustment, BOOL bTimeAdjustmentDisabled ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSystemTimeAdjustment( DWORD dwTimeAdjustment, BOOL bTimeAdjustmentDisabled ) { static FN_SetSystemTimeAdjustment *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetSystemTimeAdjustment", &g_Kernel32); return pfn( dwTimeAdjustment, bTimeAdjustmentDisabled ); } typedef BOOL WINAPI FN_GetSystemTimeAdjustment( PDWORD lpTimeAdjustment, PDWORD lpTimeIncrement, PBOOL lpTimeAdjustmentDisabled ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSystemTimeAdjustment( PDWORD lpTimeAdjustment, PDWORD lpTimeIncrement, PBOOL lpTimeAdjustmentDisabled ) { static FN_GetSystemTimeAdjustment *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemTimeAdjustment", &g_Kernel32); return pfn( lpTimeAdjustment, lpTimeIncrement, lpTimeAdjustmentDisabled ); } typedef DWORD WINAPI FN_FormatMessageA( DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, va_list * Arguments ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_FormatMessageA( DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, va_list * Arguments ) { static FN_FormatMessageA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FormatMessageA", &g_Kernel32); return pfn( dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments ); } typedef DWORD WINAPI FN_FormatMessageW( DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, va_list * Arguments ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_FormatMessageW( DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, va_list * Arguments ) { static FN_FormatMessageW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FormatMessageW", &g_Kernel32); return pfn( dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments ); } typedef BOOL WINAPI FN_CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize ) { static FN_CreatePipe *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreatePipe", &g_Kernel32); return pfn( hReadPipe, hWritePipe, lpPipeAttributes, nSize ); } typedef BOOL WINAPI FN_ConnectNamedPipe( HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ConnectNamedPipe( HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped ) { static FN_ConnectNamedPipe *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ConnectNamedPipe", &g_Kernel32); return pfn( hNamedPipe, lpOverlapped ); } typedef BOOL WINAPI FN_DisconnectNamedPipe( HANDLE hNamedPipe ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DisconnectNamedPipe( HANDLE hNamedPipe ) { static FN_DisconnectNamedPipe *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DisconnectNamedPipe", &g_Kernel32); return pfn( hNamedPipe ); } typedef BOOL WINAPI FN_SetNamedPipeHandleState( HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetNamedPipeHandleState( HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout ) { static FN_SetNamedPipeHandleState *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetNamedPipeHandleState", &g_Kernel32); return pfn( hNamedPipe, lpMode, lpMaxCollectionCount, lpCollectDataTimeout ); } typedef BOOL WINAPI FN_GetNamedPipeInfo( HANDLE hNamedPipe, LPDWORD lpFlags, LPDWORD lpOutBufferSize, LPDWORD lpInBufferSize, LPDWORD lpMaxInstances ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNamedPipeInfo( HANDLE hNamedPipe, LPDWORD lpFlags, LPDWORD lpOutBufferSize, LPDWORD lpInBufferSize, LPDWORD lpMaxInstances ) { static FN_GetNamedPipeInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNamedPipeInfo", &g_Kernel32); return pfn( hNamedPipe, lpFlags, lpOutBufferSize, lpInBufferSize, lpMaxInstances ); } typedef BOOL WINAPI FN_PeekNamedPipe( HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail, LPDWORD lpBytesLeftThisMessage ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_PeekNamedPipe( HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail, LPDWORD lpBytesLeftThisMessage ) { static FN_PeekNamedPipe *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "PeekNamedPipe", &g_Kernel32); return pfn( hNamedPipe, lpBuffer, nBufferSize, lpBytesRead, lpTotalBytesAvail, lpBytesLeftThisMessage ); } typedef BOOL WINAPI FN_TransactNamedPipe( HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_TransactNamedPipe( HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, LPOVERLAPPED lpOverlapped ) { static FN_TransactNamedPipe *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TransactNamedPipe", &g_Kernel32); return pfn( hNamedPipe, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesRead, lpOverlapped ); } typedef HANDLE WINAPI FN_CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) { static FN_CreateMailslotA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateMailslotA", &g_Kernel32); return pfn( lpName, nMaxMessageSize, lReadTimeout, lpSecurityAttributes ); } typedef HANDLE WINAPI FN_CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) { static FN_CreateMailslotW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateMailslotW", &g_Kernel32); return pfn( lpName, nMaxMessageSize, lReadTimeout, lpSecurityAttributes ); } typedef BOOL WINAPI FN_GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize, LPDWORD lpNextSize, LPDWORD lpMessageCount, LPDWORD lpReadTimeout ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize, LPDWORD lpNextSize, LPDWORD lpMessageCount, LPDWORD lpReadTimeout ) { static FN_GetMailslotInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetMailslotInfo", &g_Kernel32); return pfn( hMailslot, lpMaxMessageSize, lpNextSize, lpMessageCount, lpReadTimeout ); } typedef BOOL WINAPI FN_SetMailslotInfo( HANDLE hMailslot, DWORD lReadTimeout ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetMailslotInfo( HANDLE hMailslot, DWORD lReadTimeout ) { static FN_SetMailslotInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetMailslotInfo", &g_Kernel32); return pfn( hMailslot, lReadTimeout ); } typedef LPVOID WINAPI FN_MapViewOfFile( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_MapViewOfFile( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap ) { static FN_MapViewOfFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MapViewOfFile", &g_Kernel32); return pfn( hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap ); } typedef BOOL WINAPI FN_FlushViewOfFile( LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlushViewOfFile( LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush ) { static FN_FlushViewOfFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FlushViewOfFile", &g_Kernel32); return pfn( lpBaseAddress, dwNumberOfBytesToFlush ); } typedef BOOL WINAPI FN_UnmapViewOfFile( LPCVOID lpBaseAddress ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_UnmapViewOfFile( LPCVOID lpBaseAddress ) { static FN_UnmapViewOfFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "UnmapViewOfFile", &g_Kernel32); return pfn( lpBaseAddress ); } typedef BOOL WINAPI FN_EncryptFileA( LPCSTR lpFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EncryptFileA( LPCSTR lpFileName ) { static FN_EncryptFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EncryptFileA", &g_Kernel32); return pfn( lpFileName ); } typedef BOOL WINAPI FN_EncryptFileW( LPCWSTR lpFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EncryptFileW( LPCWSTR lpFileName ) { static FN_EncryptFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EncryptFileW", &g_Kernel32); return pfn( lpFileName ); } typedef BOOL WINAPI FN_DecryptFileA( LPCSTR lpFileName, DWORD dwReserved ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DecryptFileA( LPCSTR lpFileName, DWORD dwReserved ) { static FN_DecryptFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DecryptFileA", &g_Kernel32); return pfn( lpFileName, dwReserved ); } typedef BOOL WINAPI FN_DecryptFileW( LPCWSTR lpFileName, DWORD dwReserved ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DecryptFileW( LPCWSTR lpFileName, DWORD dwReserved ) { static FN_DecryptFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DecryptFileW", &g_Kernel32); return pfn( lpFileName, dwReserved ); } typedef BOOL WINAPI FN_FileEncryptionStatusA( LPCSTR lpFileName, LPDWORD lpStatus ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FileEncryptionStatusA( LPCSTR lpFileName, LPDWORD lpStatus ) { static FN_FileEncryptionStatusA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FileEncryptionStatusA", &g_Kernel32); return pfn( lpFileName, lpStatus ); } typedef BOOL WINAPI FN_FileEncryptionStatusW( LPCWSTR lpFileName, LPDWORD lpStatus ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FileEncryptionStatusW( LPCWSTR lpFileName, LPDWORD lpStatus ) { static FN_FileEncryptionStatusW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FileEncryptionStatusW", &g_Kernel32); return pfn( lpFileName, lpStatus ); } typedef DWORD WINAPI FN_OpenEncryptedFileRawA( LPCSTR lpFileName, ULONG ulFlags, PVOID * pvContext ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_OpenEncryptedFileRawA( LPCSTR lpFileName, ULONG ulFlags, PVOID * pvContext ) { static FN_OpenEncryptedFileRawA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenEncryptedFileRawA", &g_Kernel32); return pfn( lpFileName, ulFlags, pvContext ); } typedef DWORD WINAPI FN_OpenEncryptedFileRawW( LPCWSTR lpFileName, ULONG ulFlags, PVOID * pvContext ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_OpenEncryptedFileRawW( LPCWSTR lpFileName, ULONG ulFlags, PVOID * pvContext ) { static FN_OpenEncryptedFileRawW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenEncryptedFileRawW", &g_Kernel32); return pfn( lpFileName, ulFlags, pvContext ); } typedef DWORD WINAPI FN_ReadEncryptedFileRaw( PFE_EXPORT_FUNC pfExportCallback, PVOID pvCallbackContext, PVOID pvContext ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_ReadEncryptedFileRaw( PFE_EXPORT_FUNC pfExportCallback, PVOID pvCallbackContext, PVOID pvContext ) { static FN_ReadEncryptedFileRaw *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadEncryptedFileRaw", &g_Kernel32); return pfn( pfExportCallback, pvCallbackContext, pvContext ); } typedef DWORD WINAPI FN_WriteEncryptedFileRaw( PFE_IMPORT_FUNC pfImportCallback, PVOID pvCallbackContext, PVOID pvContext ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_WriteEncryptedFileRaw( PFE_IMPORT_FUNC pfImportCallback, PVOID pvCallbackContext, PVOID pvContext ) { static FN_WriteEncryptedFileRaw *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteEncryptedFileRaw", &g_Kernel32); return pfn( pfImportCallback, pvCallbackContext, pvContext ); } typedef VOID WINAPI FN_CloseEncryptedFileRaw( PVOID pvContext ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_CloseEncryptedFileRaw( PVOID pvContext ) { static FN_CloseEncryptedFileRaw *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CloseEncryptedFileRaw", &g_Kernel32); pfn( pvContext ); } typedef int WINAPI FN_lstrcmpA( LPCSTR lpString1, LPCSTR lpString2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmpA( LPCSTR lpString1, LPCSTR lpString2 ) { static FN_lstrcmpA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcmpA", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef int WINAPI FN_lstrcmpW( LPCWSTR lpString1, LPCWSTR lpString2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmpW( LPCWSTR lpString1, LPCWSTR lpString2 ) { static FN_lstrcmpW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcmpW", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef int WINAPI FN_lstrcmpiA( LPCSTR lpString1, LPCSTR lpString2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmpiA( LPCSTR lpString1, LPCSTR lpString2 ) { static FN_lstrcmpiA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcmpiA", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef int WINAPI FN_lstrcmpiW( LPCWSTR lpString1, LPCWSTR lpString2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmpiW( LPCWSTR lpString1, LPCWSTR lpString2 ) { static FN_lstrcmpiW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcmpiW", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef LPSTR WINAPI FN_lstrcpynA( LPSTR lpString1, LPCSTR lpString2, int iMaxLength ); __declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcpynA( LPSTR lpString1, LPCSTR lpString2, int iMaxLength ) { static FN_lstrcpynA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcpynA", &g_Kernel32); return pfn( lpString1, lpString2, iMaxLength ); } typedef LPWSTR WINAPI FN_lstrcpynW( LPWSTR lpString1, LPCWSTR lpString2, int iMaxLength ); __declspec(dllexport) LPWSTR WINAPI kPrf2Wrap_lstrcpynW( LPWSTR lpString1, LPCWSTR lpString2, int iMaxLength ) { static FN_lstrcpynW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcpynW", &g_Kernel32); return pfn( lpString1, lpString2, iMaxLength ); } typedef LPSTR WINAPI FN_lstrcpyA( LPSTR lpString1, LPCSTR lpString2 ); __declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcpyA( LPSTR lpString1, LPCSTR lpString2 ) { static FN_lstrcpyA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcpyA", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef LPWSTR WINAPI FN_lstrcpyW( LPWSTR lpString1, LPCWSTR lpString2 ); __declspec(dllexport) LPWSTR WINAPI kPrf2Wrap_lstrcpyW( LPWSTR lpString1, LPCWSTR lpString2 ) { static FN_lstrcpyW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcpyW", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef LPSTR WINAPI FN_lstrcatA( LPSTR lpString1, LPCSTR lpString2 ); __declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcatA( LPSTR lpString1, LPCSTR lpString2 ) { static FN_lstrcatA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcatA", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef LPWSTR WINAPI FN_lstrcatW( LPWSTR lpString1, LPCWSTR lpString2 ); __declspec(dllexport) LPWSTR WINAPI kPrf2Wrap_lstrcatW( LPWSTR lpString1, LPCWSTR lpString2 ) { static FN_lstrcatW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcatW", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef int WINAPI FN_lstrlenA( LPCSTR lpString ); __declspec(dllexport) int WINAPI kPrf2Wrap_lstrlenA( LPCSTR lpString ) { static FN_lstrlenA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrlenA", &g_Kernel32); return pfn( lpString ); } typedef int WINAPI FN_lstrlenW( LPCWSTR lpString ); __declspec(dllexport) int WINAPI kPrf2Wrap_lstrlenW( LPCWSTR lpString ) { static FN_lstrlenW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrlenW", &g_Kernel32); return pfn( lpString ); } typedef HFILE WINAPI FN_OpenFile( LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle ); __declspec(dllexport) HFILE WINAPI kPrf2Wrap_OpenFile( LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle ) { static FN_OpenFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenFile", &g_Kernel32); return pfn( lpFileName, lpReOpenBuff, uStyle ); } typedef HFILE WINAPI FN__lopen( LPCSTR lpPathName, int iReadWrite ); __declspec(dllexport) HFILE WINAPI kPrf2Wrap__lopen( LPCSTR lpPathName, int iReadWrite ) { static FN__lopen *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "_lopen", &g_Kernel32); return pfn( lpPathName, iReadWrite ); } typedef HFILE WINAPI FN__lcreat( LPCSTR lpPathName, int iAttribute ); __declspec(dllexport) HFILE WINAPI kPrf2Wrap__lcreat( LPCSTR lpPathName, int iAttribute ) { static FN__lcreat *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "_lcreat", &g_Kernel32); return pfn( lpPathName, iAttribute ); } typedef UINT WINAPI FN__lread( HFILE hFile, LPVOID lpBuffer, UINT uBytes ); __declspec(dllexport) UINT WINAPI kPrf2Wrap__lread( HFILE hFile, LPVOID lpBuffer, UINT uBytes ) { static FN__lread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "_lread", &g_Kernel32); return pfn( hFile, lpBuffer, uBytes ); } typedef UINT WINAPI FN__lwrite( HFILE hFile, LPCCH lpBuffer, UINT uBytes ); __declspec(dllexport) UINT WINAPI kPrf2Wrap__lwrite( HFILE hFile, LPCCH lpBuffer, UINT uBytes ) { static FN__lwrite *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "_lwrite", &g_Kernel32); return pfn( hFile, lpBuffer, uBytes ); } typedef long WINAPI FN__hread( HFILE hFile, LPVOID lpBuffer, long lBytes ); __declspec(dllexport) long WINAPI kPrf2Wrap__hread( HFILE hFile, LPVOID lpBuffer, long lBytes ) { static FN__hread *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "_hread", &g_Kernel32); return pfn( hFile, lpBuffer, lBytes ); } typedef long WINAPI FN__hwrite( HFILE hFile, LPCCH lpBuffer, long lBytes ); __declspec(dllexport) long WINAPI kPrf2Wrap__hwrite( HFILE hFile, LPCCH lpBuffer, long lBytes ) { static FN__hwrite *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "_hwrite", &g_Kernel32); return pfn( hFile, lpBuffer, lBytes ); } typedef HFILE WINAPI FN__lclose( HFILE hFile ); __declspec(dllexport) HFILE WINAPI kPrf2Wrap__lclose( HFILE hFile ) { static FN__lclose *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "_lclose", &g_Kernel32); return pfn( hFile ); } typedef LONG WINAPI FN__llseek( HFILE hFile, LONG lOffset, int iOrigin ); __declspec(dllexport) LONG WINAPI kPrf2Wrap__llseek( HFILE hFile, LONG lOffset, int iOrigin ) { static FN__llseek *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "_llseek", &g_Kernel32); return pfn( hFile, lOffset, iOrigin ); } typedef BOOL WINAPI FN_IsTextUnicode( CONST VOID * lpv, int iSize, LPINT lpiResult ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsTextUnicode( CONST VOID * lpv, int iSize, LPINT lpiResult ) { static FN_IsTextUnicode *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsTextUnicode", &g_Kernel32); return pfn( lpv, iSize, lpiResult ); } typedef DWORD WINAPI FN_FlsAlloc( PFLS_CALLBACK_FUNCTION lpCallback ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_FlsAlloc( PFLS_CALLBACK_FUNCTION lpCallback ) { static FN_FlsAlloc *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FlsAlloc", &g_Kernel32); return pfn( lpCallback ); } typedef PVOID WINAPI FN_FlsGetValue( DWORD dwFlsIndex ); __declspec(dllexport) PVOID WINAPI kPrf2Wrap_FlsGetValue( DWORD dwFlsIndex ) { static FN_FlsGetValue *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FlsGetValue", &g_Kernel32); return pfn( dwFlsIndex ); } typedef BOOL WINAPI FN_FlsSetValue( DWORD dwFlsIndex, PVOID lpFlsData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlsSetValue( DWORD dwFlsIndex, PVOID lpFlsData ) { static FN_FlsSetValue *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FlsSetValue", &g_Kernel32); return pfn( dwFlsIndex, lpFlsData ); } typedef BOOL WINAPI FN_FlsFree( DWORD dwFlsIndex ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlsFree( DWORD dwFlsIndex ) { static FN_FlsFree *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FlsFree", &g_Kernel32); return pfn( dwFlsIndex ); } typedef DWORD WINAPI FN_TlsAlloc( VOID ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_TlsAlloc( VOID ) { static FN_TlsAlloc *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TlsAlloc", &g_Kernel32); return pfn (); } typedef LPVOID WINAPI FN_TlsGetValue( DWORD dwTlsIndex ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_TlsGetValue( DWORD dwTlsIndex ) { static FN_TlsGetValue *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TlsGetValue", &g_Kernel32); return pfn( dwTlsIndex ); } typedef BOOL WINAPI FN_TlsSetValue( DWORD dwTlsIndex, LPVOID lpTlsValue ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_TlsSetValue( DWORD dwTlsIndex, LPVOID lpTlsValue ) { static FN_TlsSetValue *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TlsSetValue", &g_Kernel32); return pfn( dwTlsIndex, lpTlsValue ); } typedef BOOL WINAPI FN_TlsFree( DWORD dwTlsIndex ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_TlsFree( DWORD dwTlsIndex ) { static FN_TlsFree *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TlsFree", &g_Kernel32); return pfn( dwTlsIndex ); } typedef DWORD WINAPI FN_SleepEx( DWORD dwMilliseconds, BOOL bAlertable ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SleepEx( DWORD dwMilliseconds, BOOL bAlertable ) { static FN_SleepEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SleepEx", &g_Kernel32); return pfn( dwMilliseconds, bAlertable ); } typedef DWORD WINAPI FN_WaitForSingleObjectEx( HANDLE hHandle, DWORD dwMilliseconds, BOOL bAlertable ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_WaitForSingleObjectEx( HANDLE hHandle, DWORD dwMilliseconds, BOOL bAlertable ) { static FN_WaitForSingleObjectEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WaitForSingleObjectEx", &g_Kernel32); return pfn( hHandle, dwMilliseconds, bAlertable ); } typedef DWORD WINAPI FN_WaitForMultipleObjectsEx( DWORD nCount, CONST HANDLE * lpHandles, BOOL bWaitAll, DWORD dwMilliseconds, BOOL bAlertable ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_WaitForMultipleObjectsEx( DWORD nCount, CONST HANDLE * lpHandles, BOOL bWaitAll, DWORD dwMilliseconds, BOOL bAlertable ) { static FN_WaitForMultipleObjectsEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WaitForMultipleObjectsEx", &g_Kernel32); return pfn( nCount, lpHandles, bWaitAll, dwMilliseconds, bAlertable ); } typedef DWORD WINAPI FN_SignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, DWORD dwMilliseconds, BOOL bAlertable ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, DWORD dwMilliseconds, BOOL bAlertable ) { static FN_SignalObjectAndWait *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SignalObjectAndWait", &g_Kernel32); return pfn( hObjectToSignal, hObjectToWaitOn, dwMilliseconds, bAlertable ); } typedef BOOL WINAPI FN_ReadFileEx( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadFileEx( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) { static FN_ReadFileEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadFileEx", &g_Kernel32); return pfn( hFile, lpBuffer, nNumberOfBytesToRead, lpOverlapped, lpCompletionRoutine ); } typedef BOOL WINAPI FN_WriteFileEx( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteFileEx( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) { static FN_WriteFileEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteFileEx", &g_Kernel32); return pfn( hFile, lpBuffer, nNumberOfBytesToWrite, lpOverlapped, lpCompletionRoutine ); } typedef BOOL WINAPI FN_BackupRead( HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, BOOL bAbort, BOOL bProcessSecurity, LPVOID * lpContext ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_BackupRead( HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, BOOL bAbort, BOOL bProcessSecurity, LPVOID * lpContext ) { static FN_BackupRead *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BackupRead", &g_Kernel32); return pfn( hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, bAbort, bProcessSecurity, lpContext ); } typedef BOOL WINAPI FN_BackupSeek( HANDLE hFile, DWORD dwLowBytesToSeek, DWORD dwHighBytesToSeek, LPDWORD lpdwLowByteSeeked, LPDWORD lpdwHighByteSeeked, LPVOID * lpContext ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_BackupSeek( HANDLE hFile, DWORD dwLowBytesToSeek, DWORD dwHighBytesToSeek, LPDWORD lpdwLowByteSeeked, LPDWORD lpdwHighByteSeeked, LPVOID * lpContext ) { static FN_BackupSeek *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BackupSeek", &g_Kernel32); return pfn( hFile, dwLowBytesToSeek, dwHighBytesToSeek, lpdwLowByteSeeked, lpdwHighByteSeeked, lpContext ); } typedef BOOL WINAPI FN_BackupWrite( HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, BOOL bAbort, BOOL bProcessSecurity, LPVOID * lpContext ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_BackupWrite( HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, BOOL bAbort, BOOL bProcessSecurity, LPVOID * lpContext ) { static FN_BackupWrite *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BackupWrite", &g_Kernel32); return pfn( hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, bAbort, bProcessSecurity, lpContext ); } typedef BOOL WINAPI FN_ReadFileScatter( HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToRead, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadFileScatter( HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToRead, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped ) { static FN_ReadFileScatter *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadFileScatter", &g_Kernel32); return pfn( hFile, aSegmentArray, nNumberOfBytesToRead, lpReserved, lpOverlapped ); } typedef BOOL WINAPI FN_WriteFileGather( HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToWrite, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteFileGather( HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToWrite, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped ) { static FN_WriteFileGather *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteFileGather", &g_Kernel32); return pfn( hFile, aSegmentArray, nNumberOfBytesToWrite, lpReserved, lpOverlapped ); } typedef HANDLE WINAPI FN_CreateMutexA( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateMutexA( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName ) { static FN_CreateMutexA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateMutexA", &g_Kernel32); return pfn( lpMutexAttributes, bInitialOwner, lpName ); } typedef HANDLE WINAPI FN_CreateMutexW( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCWSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateMutexW( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCWSTR lpName ) { static FN_CreateMutexW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateMutexW", &g_Kernel32); return pfn( lpMutexAttributes, bInitialOwner, lpName ); } typedef HANDLE WINAPI FN_OpenMutexA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenMutexA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ) { static FN_OpenMutexA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenMutexA", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpName ); } typedef HANDLE WINAPI FN_OpenMutexW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenMutexW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ) { static FN_OpenMutexW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenMutexW", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpName ); } typedef HANDLE WINAPI FN_CreateEventA( LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateEventA( LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName ) { static FN_CreateEventA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateEventA", &g_Kernel32); return pfn( lpEventAttributes, bManualReset, bInitialState, lpName ); } typedef HANDLE WINAPI FN_CreateEventW( LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateEventW( LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName ) { static FN_CreateEventW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateEventW", &g_Kernel32); return pfn( lpEventAttributes, bManualReset, bInitialState, lpName ); } typedef HANDLE WINAPI FN_OpenEventA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenEventA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ) { static FN_OpenEventA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenEventA", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpName ); } typedef HANDLE WINAPI FN_OpenEventW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenEventW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ) { static FN_OpenEventW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenEventW", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpName ); } typedef HANDLE WINAPI FN_CreateSemaphoreA( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateSemaphoreA( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName ) { static FN_CreateSemaphoreA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateSemaphoreA", &g_Kernel32); return pfn( lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName ); } typedef HANDLE WINAPI FN_CreateSemaphoreW( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateSemaphoreW( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName ) { static FN_CreateSemaphoreW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateSemaphoreW", &g_Kernel32); return pfn( lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName ); } typedef HANDLE WINAPI FN_OpenSemaphoreA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenSemaphoreA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ) { static FN_OpenSemaphoreA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenSemaphoreA", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpName ); } typedef HANDLE WINAPI FN_OpenSemaphoreW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenSemaphoreW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ) { static FN_OpenSemaphoreW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenSemaphoreW", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpName ); } typedef HANDLE WINAPI FN_CreateWaitableTimerA( LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCSTR lpTimerName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateWaitableTimerA( LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCSTR lpTimerName ) { static FN_CreateWaitableTimerA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateWaitableTimerA", &g_Kernel32); return pfn( lpTimerAttributes, bManualReset, lpTimerName ); } typedef HANDLE WINAPI FN_CreateWaitableTimerW( LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCWSTR lpTimerName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateWaitableTimerW( LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCWSTR lpTimerName ) { static FN_CreateWaitableTimerW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateWaitableTimerW", &g_Kernel32); return pfn( lpTimerAttributes, bManualReset, lpTimerName ); } typedef HANDLE WINAPI FN_OpenWaitableTimerA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpTimerName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenWaitableTimerA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpTimerName ) { static FN_OpenWaitableTimerA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenWaitableTimerA", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpTimerName ); } typedef HANDLE WINAPI FN_OpenWaitableTimerW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpTimerName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenWaitableTimerW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpTimerName ) { static FN_OpenWaitableTimerW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenWaitableTimerW", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpTimerName ); } typedef BOOL WINAPI FN_SetWaitableTimer( HANDLE hTimer, const LARGE_INTEGER * lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, BOOL fResume ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetWaitableTimer( HANDLE hTimer, const LARGE_INTEGER * lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, BOOL fResume ) { static FN_SetWaitableTimer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetWaitableTimer", &g_Kernel32); return pfn( hTimer, lpDueTime, lPeriod, pfnCompletionRoutine, lpArgToCompletionRoutine, fResume ); } typedef BOOL WINAPI FN_CancelWaitableTimer( HANDLE hTimer ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CancelWaitableTimer( HANDLE hTimer ) { static FN_CancelWaitableTimer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CancelWaitableTimer", &g_Kernel32); return pfn( hTimer ); } typedef HANDLE WINAPI FN_CreateFileMappingA( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateFileMappingA( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName ) { static FN_CreateFileMappingA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateFileMappingA", &g_Kernel32); return pfn( hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName ); } typedef HANDLE WINAPI FN_CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName ) { static FN_CreateFileMappingW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateFileMappingW", &g_Kernel32); return pfn( hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName ); } typedef HANDLE WINAPI FN_OpenFileMappingA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenFileMappingA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ) { static FN_OpenFileMappingA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenFileMappingA", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpName ); } typedef HANDLE WINAPI FN_OpenFileMappingW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenFileMappingW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ) { static FN_OpenFileMappingW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenFileMappingW", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpName ); } typedef DWORD WINAPI FN_GetLogicalDriveStringsA( DWORD nBufferLength, LPSTR lpBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLogicalDriveStringsA( DWORD nBufferLength, LPSTR lpBuffer ) { static FN_GetLogicalDriveStringsA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLogicalDriveStringsA", &g_Kernel32); return pfn( nBufferLength, lpBuffer ); } typedef DWORD WINAPI FN_GetLogicalDriveStringsW( DWORD nBufferLength, LPWSTR lpBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLogicalDriveStringsW( DWORD nBufferLength, LPWSTR lpBuffer ) { static FN_GetLogicalDriveStringsW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLogicalDriveStringsW", &g_Kernel32); return pfn( nBufferLength, lpBuffer ); } typedef HANDLE WINAPI FN_CreateMemoryResourceNotification( MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateMemoryResourceNotification( MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType ) { static FN_CreateMemoryResourceNotification *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateMemoryResourceNotification", &g_Kernel32); return pfn( NotificationType ); } typedef BOOL WINAPI FN_QueryMemoryResourceNotification( HANDLE ResourceNotificationHandle, PBOOL ResourceState ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueryMemoryResourceNotification( HANDLE ResourceNotificationHandle, PBOOL ResourceState ) { static FN_QueryMemoryResourceNotification *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "QueryMemoryResourceNotification", &g_Kernel32); return pfn( ResourceNotificationHandle, ResourceState ); } typedef HMODULE WINAPI FN_LoadLibraryA( LPCSTR lpLibFileName ); __declspec(dllexport) HMODULE WINAPI kPrf2Wrap_LoadLibraryA( LPCSTR lpLibFileName ) { static FN_LoadLibraryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LoadLibraryA", &g_Kernel32); return pfn( lpLibFileName ); } typedef HMODULE WINAPI FN_LoadLibraryW( LPCWSTR lpLibFileName ); __declspec(dllexport) HMODULE WINAPI kPrf2Wrap_LoadLibraryW( LPCWSTR lpLibFileName ) { static FN_LoadLibraryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LoadLibraryW", &g_Kernel32); return pfn( lpLibFileName ); } typedef HMODULE WINAPI FN_LoadLibraryExA( LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ); __declspec(dllexport) HMODULE WINAPI kPrf2Wrap_LoadLibraryExA( LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ) { static FN_LoadLibraryExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LoadLibraryExA", &g_Kernel32); return pfn( lpLibFileName, hFile, dwFlags ); } typedef HMODULE WINAPI FN_LoadLibraryExW( LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ); __declspec(dllexport) HMODULE WINAPI kPrf2Wrap_LoadLibraryExW( LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ) { static FN_LoadLibraryExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LoadLibraryExW", &g_Kernel32); return pfn( lpLibFileName, hFile, dwFlags ); } typedef DWORD WINAPI FN_GetModuleFileNameA( HMODULE hModule, LPCH lpFilename, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetModuleFileNameA( HMODULE hModule, LPCH lpFilename, DWORD nSize ) { static FN_GetModuleFileNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetModuleFileNameA", &g_Kernel32); return pfn( hModule, lpFilename, nSize ); } typedef DWORD WINAPI FN_GetModuleFileNameW( HMODULE hModule, LPWCH lpFilename, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetModuleFileNameW( HMODULE hModule, LPWCH lpFilename, DWORD nSize ) { static FN_GetModuleFileNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetModuleFileNameW", &g_Kernel32); return pfn( hModule, lpFilename, nSize ); } typedef HMODULE WINAPI FN_GetModuleHandleA( LPCSTR lpModuleName ); __declspec(dllexport) HMODULE WINAPI kPrf2Wrap_GetModuleHandleA( LPCSTR lpModuleName ) { static FN_GetModuleHandleA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetModuleHandleA", &g_Kernel32); return pfn( lpModuleName ); } typedef HMODULE WINAPI FN_GetModuleHandleW( LPCWSTR lpModuleName ); __declspec(dllexport) HMODULE WINAPI kPrf2Wrap_GetModuleHandleW( LPCWSTR lpModuleName ) { static FN_GetModuleHandleW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetModuleHandleW", &g_Kernel32); return pfn( lpModuleName ); } typedef BOOL WINAPI FN_GetModuleHandleExA( DWORD dwFlags, LPCSTR lpModuleName, HMODULE * phModule ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetModuleHandleExA( DWORD dwFlags, LPCSTR lpModuleName, HMODULE * phModule ) { static FN_GetModuleHandleExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetModuleHandleExA", &g_Kernel32); return pfn( dwFlags, lpModuleName, phModule ); } typedef BOOL WINAPI FN_GetModuleHandleExW( DWORD dwFlags, LPCWSTR lpModuleName, HMODULE * phModule ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetModuleHandleExW( DWORD dwFlags, LPCWSTR lpModuleName, HMODULE * phModule ) { static FN_GetModuleHandleExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetModuleHandleExW", &g_Kernel32); return pfn( dwFlags, lpModuleName, phModule ); } typedef BOOL WINAPI FN_NeedCurrentDirectoryForExePathA( LPCSTR ExeName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_NeedCurrentDirectoryForExePathA( LPCSTR ExeName ) { static FN_NeedCurrentDirectoryForExePathA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "NeedCurrentDirectoryForExePathA", &g_Kernel32); return pfn( ExeName ); } typedef BOOL WINAPI FN_NeedCurrentDirectoryForExePathW( LPCWSTR ExeName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_NeedCurrentDirectoryForExePathW( LPCWSTR ExeName ) { static FN_NeedCurrentDirectoryForExePathW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "NeedCurrentDirectoryForExePathW", &g_Kernel32); return pfn( ExeName ); } typedef BOOL WINAPI FN_CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) { static FN_CreateProcessA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateProcessA", &g_Kernel32); return pfn( lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); } typedef BOOL WINAPI FN_CreateProcessW( LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessW( LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) { static FN_CreateProcessW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateProcessW", &g_Kernel32); return pfn( lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); } typedef BOOL WINAPI FN_SetProcessShutdownParameters( DWORD dwLevel, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetProcessShutdownParameters( DWORD dwLevel, DWORD dwFlags ) { static FN_SetProcessShutdownParameters *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetProcessShutdownParameters", &g_Kernel32); return pfn( dwLevel, dwFlags ); } typedef BOOL WINAPI FN_GetProcessShutdownParameters( LPDWORD lpdwLevel, LPDWORD lpdwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessShutdownParameters( LPDWORD lpdwLevel, LPDWORD lpdwFlags ) { static FN_GetProcessShutdownParameters *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessShutdownParameters", &g_Kernel32); return pfn( lpdwLevel, lpdwFlags ); } typedef DWORD WINAPI FN_GetProcessVersion( DWORD ProcessId ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProcessVersion( DWORD ProcessId ) { static FN_GetProcessVersion *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProcessVersion", &g_Kernel32); return pfn( ProcessId ); } typedef VOID WINAPI FN_FatalAppExitA( UINT uAction, LPCSTR lpMessageText ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_FatalAppExitA( UINT uAction, LPCSTR lpMessageText ) { static FN_FatalAppExitA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FatalAppExitA", &g_Kernel32); pfn( uAction, lpMessageText ); } typedef VOID WINAPI FN_FatalAppExitW( UINT uAction, LPCWSTR lpMessageText ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_FatalAppExitW( UINT uAction, LPCWSTR lpMessageText ) { static FN_FatalAppExitW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FatalAppExitW", &g_Kernel32); pfn( uAction, lpMessageText ); } typedef VOID WINAPI FN_GetStartupInfoA( LPSTARTUPINFOA lpStartupInfo ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_GetStartupInfoA( LPSTARTUPINFOA lpStartupInfo ) { static FN_GetStartupInfoA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetStartupInfoA", &g_Kernel32); pfn( lpStartupInfo ); } typedef VOID WINAPI FN_GetStartupInfoW( LPSTARTUPINFOW lpStartupInfo ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_GetStartupInfoW( LPSTARTUPINFOW lpStartupInfo ) { static FN_GetStartupInfoW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetStartupInfoW", &g_Kernel32); pfn( lpStartupInfo ); } typedef LPSTR WINAPI FN_GetCommandLineA( VOID ); __declspec(dllexport) LPSTR WINAPI kPrf2Wrap_GetCommandLineA( VOID ) { static FN_GetCommandLineA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCommandLineA", &g_Kernel32); return pfn (); } typedef LPWSTR WINAPI FN_GetCommandLineW( VOID ); __declspec(dllexport) LPWSTR WINAPI kPrf2Wrap_GetCommandLineW( VOID ) { static FN_GetCommandLineW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCommandLineW", &g_Kernel32); return pfn (); } typedef DWORD WINAPI FN_GetEnvironmentVariableA( LPCSTR lpName, LPSTR lpBuffer, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetEnvironmentVariableA( LPCSTR lpName, LPSTR lpBuffer, DWORD nSize ) { static FN_GetEnvironmentVariableA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetEnvironmentVariableA", &g_Kernel32); return pfn( lpName, lpBuffer, nSize ); } typedef DWORD WINAPI FN_GetEnvironmentVariableW( LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetEnvironmentVariableW( LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize ) { static FN_GetEnvironmentVariableW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetEnvironmentVariableW", &g_Kernel32); return pfn( lpName, lpBuffer, nSize ); } typedef BOOL WINAPI FN_SetEnvironmentVariableA( LPCSTR lpName, LPCSTR lpValue ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEnvironmentVariableA( LPCSTR lpName, LPCSTR lpValue ) { static FN_SetEnvironmentVariableA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetEnvironmentVariableA", &g_Kernel32); return pfn( lpName, lpValue ); } typedef BOOL WINAPI FN_SetEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpValue ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpValue ) { static FN_SetEnvironmentVariableW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetEnvironmentVariableW", &g_Kernel32); return pfn( lpName, lpValue ); } typedef DWORD WINAPI FN_ExpandEnvironmentStringsA( LPCSTR lpSrc, LPSTR lpDst, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_ExpandEnvironmentStringsA( LPCSTR lpSrc, LPSTR lpDst, DWORD nSize ) { static FN_ExpandEnvironmentStringsA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ExpandEnvironmentStringsA", &g_Kernel32); return pfn( lpSrc, lpDst, nSize ); } typedef DWORD WINAPI FN_ExpandEnvironmentStringsW( LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_ExpandEnvironmentStringsW( LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize ) { static FN_ExpandEnvironmentStringsW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ExpandEnvironmentStringsW", &g_Kernel32); return pfn( lpSrc, lpDst, nSize ); } typedef DWORD WINAPI FN_GetFirmwareEnvironmentVariableA( LPCSTR lpName, LPCSTR lpGuid, PVOID pBuffer, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFirmwareEnvironmentVariableA( LPCSTR lpName, LPCSTR lpGuid, PVOID pBuffer, DWORD nSize ) { static FN_GetFirmwareEnvironmentVariableA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFirmwareEnvironmentVariableA", &g_Kernel32); return pfn( lpName, lpGuid, pBuffer, nSize ); } typedef DWORD WINAPI FN_GetFirmwareEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pBuffer, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFirmwareEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pBuffer, DWORD nSize ) { static FN_GetFirmwareEnvironmentVariableW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFirmwareEnvironmentVariableW", &g_Kernel32); return pfn( lpName, lpGuid, pBuffer, nSize ); } typedef BOOL WINAPI FN_SetFirmwareEnvironmentVariableA( LPCSTR lpName, LPCSTR lpGuid, PVOID pValue, DWORD nSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFirmwareEnvironmentVariableA( LPCSTR lpName, LPCSTR lpGuid, PVOID pValue, DWORD nSize ) { static FN_SetFirmwareEnvironmentVariableA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFirmwareEnvironmentVariableA", &g_Kernel32); return pfn( lpName, lpGuid, pValue, nSize ); } typedef BOOL WINAPI FN_SetFirmwareEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pValue, DWORD nSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFirmwareEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pValue, DWORD nSize ) { static FN_SetFirmwareEnvironmentVariableW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFirmwareEnvironmentVariableW", &g_Kernel32); return pfn( lpName, lpGuid, pValue, nSize ); } typedef VOID WINAPI FN_OutputDebugStringA( LPCSTR lpOutputString ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_OutputDebugStringA( LPCSTR lpOutputString ) { static FN_OutputDebugStringA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OutputDebugStringA", &g_Kernel32); pfn( lpOutputString ); } typedef VOID WINAPI FN_OutputDebugStringW( LPCWSTR lpOutputString ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_OutputDebugStringW( LPCWSTR lpOutputString ) { static FN_OutputDebugStringW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OutputDebugStringW", &g_Kernel32); pfn( lpOutputString ); } typedef HRSRC WINAPI FN_FindResourceA( HMODULE hModule, LPCSTR lpName, LPCSTR lpType ); __declspec(dllexport) HRSRC WINAPI kPrf2Wrap_FindResourceA( HMODULE hModule, LPCSTR lpName, LPCSTR lpType ) { static FN_FindResourceA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindResourceA", &g_Kernel32); return pfn( hModule, lpName, lpType ); } typedef HRSRC WINAPI FN_FindResourceW( HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType ); __declspec(dllexport) HRSRC WINAPI kPrf2Wrap_FindResourceW( HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType ) { static FN_FindResourceW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindResourceW", &g_Kernel32); return pfn( hModule, lpName, lpType ); } typedef HRSRC WINAPI FN_FindResourceExA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLanguage ); __declspec(dllexport) HRSRC WINAPI kPrf2Wrap_FindResourceExA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLanguage ) { static FN_FindResourceExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindResourceExA", &g_Kernel32); return pfn( hModule, lpType, lpName, wLanguage ); } typedef HRSRC WINAPI FN_FindResourceExW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage ); __declspec(dllexport) HRSRC WINAPI kPrf2Wrap_FindResourceExW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage ) { static FN_FindResourceExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindResourceExW", &g_Kernel32); return pfn( hModule, lpType, lpName, wLanguage ); } typedef BOOL WINAPI FN_EnumResourceTypesA( HMODULE hModule, ENUMRESTYPEPROCA lpEnumFunc, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceTypesA( HMODULE hModule, ENUMRESTYPEPROCA lpEnumFunc, LONG_PTR lParam ) { static FN_EnumResourceTypesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumResourceTypesA", &g_Kernel32); return pfn( hModule, lpEnumFunc, lParam ); } typedef BOOL WINAPI FN_EnumResourceTypesW( HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceTypesW( HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG_PTR lParam ) { static FN_EnumResourceTypesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumResourceTypesW", &g_Kernel32); return pfn( hModule, lpEnumFunc, lParam ); } typedef BOOL WINAPI FN_EnumResourceNamesA( HMODULE hModule, LPCSTR lpType, ENUMRESNAMEPROCA lpEnumFunc, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceNamesA( HMODULE hModule, LPCSTR lpType, ENUMRESNAMEPROCA lpEnumFunc, LONG_PTR lParam ) { static FN_EnumResourceNamesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumResourceNamesA", &g_Kernel32); return pfn( hModule, lpType, lpEnumFunc, lParam ); } typedef BOOL WINAPI FN_EnumResourceNamesW( HMODULE hModule, LPCWSTR lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceNamesW( HMODULE hModule, LPCWSTR lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG_PTR lParam ) { static FN_EnumResourceNamesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumResourceNamesW", &g_Kernel32); return pfn( hModule, lpType, lpEnumFunc, lParam ); } typedef BOOL WINAPI FN_EnumResourceLanguagesA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, ENUMRESLANGPROCA lpEnumFunc, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceLanguagesA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, ENUMRESLANGPROCA lpEnumFunc, LONG_PTR lParam ) { static FN_EnumResourceLanguagesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumResourceLanguagesA", &g_Kernel32); return pfn( hModule, lpType, lpName, lpEnumFunc, lParam ); } typedef BOOL WINAPI FN_EnumResourceLanguagesW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, ENUMRESLANGPROCW lpEnumFunc, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceLanguagesW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, ENUMRESLANGPROCW lpEnumFunc, LONG_PTR lParam ) { static FN_EnumResourceLanguagesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumResourceLanguagesW", &g_Kernel32); return pfn( hModule, lpType, lpName, lpEnumFunc, lParam ); } typedef HANDLE WINAPI FN_BeginUpdateResourceA( LPCSTR pFileName, BOOL bDeleteExistingResources ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_BeginUpdateResourceA( LPCSTR pFileName, BOOL bDeleteExistingResources ) { static FN_BeginUpdateResourceA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BeginUpdateResourceA", &g_Kernel32); return pfn( pFileName, bDeleteExistingResources ); } typedef HANDLE WINAPI FN_BeginUpdateResourceW( LPCWSTR pFileName, BOOL bDeleteExistingResources ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_BeginUpdateResourceW( LPCWSTR pFileName, BOOL bDeleteExistingResources ) { static FN_BeginUpdateResourceW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BeginUpdateResourceW", &g_Kernel32); return pfn( pFileName, bDeleteExistingResources ); } typedef BOOL WINAPI FN_UpdateResourceA( HANDLE hUpdate, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_UpdateResourceA( HANDLE hUpdate, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb ) { static FN_UpdateResourceA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "UpdateResourceA", &g_Kernel32); return pfn( hUpdate, lpType, lpName, wLanguage, lpData, cb ); } typedef BOOL WINAPI FN_UpdateResourceW( HANDLE hUpdate, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_UpdateResourceW( HANDLE hUpdate, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb ) { static FN_UpdateResourceW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "UpdateResourceW", &g_Kernel32); return pfn( hUpdate, lpType, lpName, wLanguage, lpData, cb ); } typedef BOOL WINAPI FN_EndUpdateResourceA( HANDLE hUpdate, BOOL fDiscard ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EndUpdateResourceA( HANDLE hUpdate, BOOL fDiscard ) { static FN_EndUpdateResourceA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EndUpdateResourceA", &g_Kernel32); return pfn( hUpdate, fDiscard ); } typedef BOOL WINAPI FN_EndUpdateResourceW( HANDLE hUpdate, BOOL fDiscard ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EndUpdateResourceW( HANDLE hUpdate, BOOL fDiscard ) { static FN_EndUpdateResourceW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EndUpdateResourceW", &g_Kernel32); return pfn( hUpdate, fDiscard ); } typedef ATOM WINAPI FN_GlobalAddAtomA( LPCSTR lpString ); __declspec(dllexport) ATOM WINAPI kPrf2Wrap_GlobalAddAtomA( LPCSTR lpString ) { static FN_GlobalAddAtomA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalAddAtomA", &g_Kernel32); return pfn( lpString ); } typedef ATOM WINAPI FN_GlobalAddAtomW( LPCWSTR lpString ); __declspec(dllexport) ATOM WINAPI kPrf2Wrap_GlobalAddAtomW( LPCWSTR lpString ) { static FN_GlobalAddAtomW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalAddAtomW", &g_Kernel32); return pfn( lpString ); } typedef ATOM WINAPI FN_GlobalFindAtomA( LPCSTR lpString ); __declspec(dllexport) ATOM WINAPI kPrf2Wrap_GlobalFindAtomA( LPCSTR lpString ) { static FN_GlobalFindAtomA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalFindAtomA", &g_Kernel32); return pfn( lpString ); } typedef ATOM WINAPI FN_GlobalFindAtomW( LPCWSTR lpString ); __declspec(dllexport) ATOM WINAPI kPrf2Wrap_GlobalFindAtomW( LPCWSTR lpString ) { static FN_GlobalFindAtomW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalFindAtomW", &g_Kernel32); return pfn( lpString ); } typedef UINT WINAPI FN_GlobalGetAtomNameA( ATOM nAtom, LPSTR lpBuffer, int nSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GlobalGetAtomNameA( ATOM nAtom, LPSTR lpBuffer, int nSize ) { static FN_GlobalGetAtomNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalGetAtomNameA", &g_Kernel32); return pfn( nAtom, lpBuffer, nSize ); } typedef UINT WINAPI FN_GlobalGetAtomNameW( ATOM nAtom, LPWSTR lpBuffer, int nSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GlobalGetAtomNameW( ATOM nAtom, LPWSTR lpBuffer, int nSize ) { static FN_GlobalGetAtomNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GlobalGetAtomNameW", &g_Kernel32); return pfn( nAtom, lpBuffer, nSize ); } typedef ATOM WINAPI FN_AddAtomA( LPCSTR lpString ); __declspec(dllexport) ATOM WINAPI kPrf2Wrap_AddAtomA( LPCSTR lpString ) { static FN_AddAtomA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAtomA", &g_Kernel32); return pfn( lpString ); } typedef ATOM WINAPI FN_AddAtomW( LPCWSTR lpString ); __declspec(dllexport) ATOM WINAPI kPrf2Wrap_AddAtomW( LPCWSTR lpString ) { static FN_AddAtomW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAtomW", &g_Kernel32); return pfn( lpString ); } typedef ATOM WINAPI FN_FindAtomA( LPCSTR lpString ); __declspec(dllexport) ATOM WINAPI kPrf2Wrap_FindAtomA( LPCSTR lpString ) { static FN_FindAtomA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindAtomA", &g_Kernel32); return pfn( lpString ); } typedef ATOM WINAPI FN_FindAtomW( LPCWSTR lpString ); __declspec(dllexport) ATOM WINAPI kPrf2Wrap_FindAtomW( LPCWSTR lpString ) { static FN_FindAtomW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindAtomW", &g_Kernel32); return pfn( lpString ); } typedef UINT WINAPI FN_GetAtomNameA( ATOM nAtom, LPSTR lpBuffer, int nSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetAtomNameA( ATOM nAtom, LPSTR lpBuffer, int nSize ) { static FN_GetAtomNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetAtomNameA", &g_Kernel32); return pfn( nAtom, lpBuffer, nSize ); } typedef UINT WINAPI FN_GetAtomNameW( ATOM nAtom, LPWSTR lpBuffer, int nSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetAtomNameW( ATOM nAtom, LPWSTR lpBuffer, int nSize ) { static FN_GetAtomNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetAtomNameW", &g_Kernel32); return pfn( nAtom, lpBuffer, nSize ); } typedef UINT WINAPI FN_GetProfileIntA( LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetProfileIntA( LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault ) { static FN_GetProfileIntA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProfileIntA", &g_Kernel32); return pfn( lpAppName, lpKeyName, nDefault ); } typedef UINT WINAPI FN_GetProfileIntW( LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetProfileIntW( LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault ) { static FN_GetProfileIntW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProfileIntW", &g_Kernel32); return pfn( lpAppName, lpKeyName, nDefault ); } typedef DWORD WINAPI FN_GetProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize ) { static FN_GetProfileStringA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProfileStringA", &g_Kernel32); return pfn( lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize ); } typedef DWORD WINAPI FN_GetProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize ) { static FN_GetProfileStringW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProfileStringW", &g_Kernel32); return pfn( lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize ); } typedef BOOL WINAPI FN_WriteProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString ) { static FN_WriteProfileStringA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteProfileStringA", &g_Kernel32); return pfn( lpAppName, lpKeyName, lpString ); } typedef BOOL WINAPI FN_WriteProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString ) { static FN_WriteProfileStringW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteProfileStringW", &g_Kernel32); return pfn( lpAppName, lpKeyName, lpString ); } typedef DWORD WINAPI FN_GetProfileSectionA( LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProfileSectionA( LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize ) { static FN_GetProfileSectionA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProfileSectionA", &g_Kernel32); return pfn( lpAppName, lpReturnedString, nSize ); } typedef DWORD WINAPI FN_GetProfileSectionW( LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProfileSectionW( LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize ) { static FN_GetProfileSectionW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetProfileSectionW", &g_Kernel32); return pfn( lpAppName, lpReturnedString, nSize ); } typedef BOOL WINAPI FN_WriteProfileSectionA( LPCSTR lpAppName, LPCSTR lpString ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteProfileSectionA( LPCSTR lpAppName, LPCSTR lpString ) { static FN_WriteProfileSectionA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteProfileSectionA", &g_Kernel32); return pfn( lpAppName, lpString ); } typedef BOOL WINAPI FN_WriteProfileSectionW( LPCWSTR lpAppName, LPCWSTR lpString ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteProfileSectionW( LPCWSTR lpAppName, LPCWSTR lpString ) { static FN_WriteProfileSectionW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteProfileSectionW", &g_Kernel32); return pfn( lpAppName, lpString ); } typedef UINT WINAPI FN_GetPrivateProfileIntA( LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetPrivateProfileIntA( LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName ) { static FN_GetPrivateProfileIntA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileIntA", &g_Kernel32); return pfn( lpAppName, lpKeyName, nDefault, lpFileName ); } typedef UINT WINAPI FN_GetPrivateProfileIntW( LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault, LPCWSTR lpFileName ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetPrivateProfileIntW( LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault, LPCWSTR lpFileName ) { static FN_GetPrivateProfileIntW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileIntW", &g_Kernel32); return pfn( lpAppName, lpKeyName, nDefault, lpFileName ); } typedef DWORD WINAPI FN_GetPrivateProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName ) { static FN_GetPrivateProfileStringA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileStringA", &g_Kernel32); return pfn( lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize, lpFileName ); } typedef DWORD WINAPI FN_GetPrivateProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName ) { static FN_GetPrivateProfileStringW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileStringW", &g_Kernel32); return pfn( lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize, lpFileName ); } typedef BOOL WINAPI FN_WritePrivateProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString, LPCSTR lpFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString, LPCSTR lpFileName ) { static FN_WritePrivateProfileStringA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileStringA", &g_Kernel32); return pfn( lpAppName, lpKeyName, lpString, lpFileName ); } typedef BOOL WINAPI FN_WritePrivateProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName ) { static FN_WritePrivateProfileStringW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileStringW", &g_Kernel32); return pfn( lpAppName, lpKeyName, lpString, lpFileName ); } typedef DWORD WINAPI FN_GetPrivateProfileSectionA( LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileSectionA( LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName ) { static FN_GetPrivateProfileSectionA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileSectionA", &g_Kernel32); return pfn( lpAppName, lpReturnedString, nSize, lpFileName ); } typedef DWORD WINAPI FN_GetPrivateProfileSectionW( LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileSectionW( LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName ) { static FN_GetPrivateProfileSectionW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileSectionW", &g_Kernel32); return pfn( lpAppName, lpReturnedString, nSize, lpFileName ); } typedef BOOL WINAPI FN_WritePrivateProfileSectionA( LPCSTR lpAppName, LPCSTR lpString, LPCSTR lpFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileSectionA( LPCSTR lpAppName, LPCSTR lpString, LPCSTR lpFileName ) { static FN_WritePrivateProfileSectionA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileSectionA", &g_Kernel32); return pfn( lpAppName, lpString, lpFileName ); } typedef BOOL WINAPI FN_WritePrivateProfileSectionW( LPCWSTR lpAppName, LPCWSTR lpString, LPCWSTR lpFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileSectionW( LPCWSTR lpAppName, LPCWSTR lpString, LPCWSTR lpFileName ) { static FN_WritePrivateProfileSectionW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileSectionW", &g_Kernel32); return pfn( lpAppName, lpString, lpFileName ); } typedef DWORD WINAPI FN_GetPrivateProfileSectionNamesA( LPSTR lpszReturnBuffer, DWORD nSize, LPCSTR lpFileName ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileSectionNamesA( LPSTR lpszReturnBuffer, DWORD nSize, LPCSTR lpFileName ) { static FN_GetPrivateProfileSectionNamesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileSectionNamesA", &g_Kernel32); return pfn( lpszReturnBuffer, nSize, lpFileName ); } typedef DWORD WINAPI FN_GetPrivateProfileSectionNamesW( LPWSTR lpszReturnBuffer, DWORD nSize, LPCWSTR lpFileName ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileSectionNamesW( LPWSTR lpszReturnBuffer, DWORD nSize, LPCWSTR lpFileName ) { static FN_GetPrivateProfileSectionNamesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileSectionNamesW", &g_Kernel32); return pfn( lpszReturnBuffer, nSize, lpFileName ); } typedef BOOL WINAPI FN_GetPrivateProfileStructA( LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetPrivateProfileStructA( LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile ) { static FN_GetPrivateProfileStructA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileStructA", &g_Kernel32); return pfn( lpszSection, lpszKey, lpStruct, uSizeStruct, szFile ); } typedef BOOL WINAPI FN_GetPrivateProfileStructW( LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetPrivateProfileStructW( LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile ) { static FN_GetPrivateProfileStructW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileStructW", &g_Kernel32); return pfn( lpszSection, lpszKey, lpStruct, uSizeStruct, szFile ); } typedef BOOL WINAPI FN_WritePrivateProfileStructA( LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileStructA( LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile ) { static FN_WritePrivateProfileStructA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileStructA", &g_Kernel32); return pfn( lpszSection, lpszKey, lpStruct, uSizeStruct, szFile ); } typedef BOOL WINAPI FN_WritePrivateProfileStructW( LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileStructW( LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile ) { static FN_WritePrivateProfileStructW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileStructW", &g_Kernel32); return pfn( lpszSection, lpszKey, lpStruct, uSizeStruct, szFile ); } typedef UINT WINAPI FN_GetDriveTypeA( LPCSTR lpRootPathName ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetDriveTypeA( LPCSTR lpRootPathName ) { static FN_GetDriveTypeA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDriveTypeA", &g_Kernel32); return pfn( lpRootPathName ); } typedef UINT WINAPI FN_GetDriveTypeW( LPCWSTR lpRootPathName ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetDriveTypeW( LPCWSTR lpRootPathName ) { static FN_GetDriveTypeW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDriveTypeW", &g_Kernel32); return pfn( lpRootPathName ); } typedef UINT WINAPI FN_GetSystemDirectoryA( LPSTR lpBuffer, UINT uSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemDirectoryA( LPSTR lpBuffer, UINT uSize ) { static FN_GetSystemDirectoryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemDirectoryA", &g_Kernel32); return pfn( lpBuffer, uSize ); } typedef UINT WINAPI FN_GetSystemDirectoryW( LPWSTR lpBuffer, UINT uSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemDirectoryW( LPWSTR lpBuffer, UINT uSize ) { static FN_GetSystemDirectoryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemDirectoryW", &g_Kernel32); return pfn( lpBuffer, uSize ); } typedef DWORD WINAPI FN_GetTempPathA( DWORD nBufferLength, LPSTR lpBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTempPathA( DWORD nBufferLength, LPSTR lpBuffer ) { static FN_GetTempPathA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTempPathA", &g_Kernel32); return pfn( nBufferLength, lpBuffer ); } typedef DWORD WINAPI FN_GetTempPathW( DWORD nBufferLength, LPWSTR lpBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTempPathW( DWORD nBufferLength, LPWSTR lpBuffer ) { static FN_GetTempPathW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTempPathW", &g_Kernel32); return pfn( nBufferLength, lpBuffer ); } typedef UINT WINAPI FN_GetTempFileNameA( LPCSTR lpPathName, LPCSTR lpPrefixString, UINT uUnique, LPSTR lpTempFileName ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetTempFileNameA( LPCSTR lpPathName, LPCSTR lpPrefixString, UINT uUnique, LPSTR lpTempFileName ) { static FN_GetTempFileNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTempFileNameA", &g_Kernel32); return pfn( lpPathName, lpPrefixString, uUnique, lpTempFileName ); } typedef UINT WINAPI FN_GetTempFileNameW( LPCWSTR lpPathName, LPCWSTR lpPrefixString, UINT uUnique, LPWSTR lpTempFileName ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetTempFileNameW( LPCWSTR lpPathName, LPCWSTR lpPrefixString, UINT uUnique, LPWSTR lpTempFileName ) { static FN_GetTempFileNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTempFileNameW", &g_Kernel32); return pfn( lpPathName, lpPrefixString, uUnique, lpTempFileName ); } typedef UINT WINAPI FN_GetWindowsDirectoryA( LPSTR lpBuffer, UINT uSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetWindowsDirectoryA( LPSTR lpBuffer, UINT uSize ) { static FN_GetWindowsDirectoryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetWindowsDirectoryA", &g_Kernel32); return pfn( lpBuffer, uSize ); } typedef UINT WINAPI FN_GetWindowsDirectoryW( LPWSTR lpBuffer, UINT uSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetWindowsDirectoryW( LPWSTR lpBuffer, UINT uSize ) { static FN_GetWindowsDirectoryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetWindowsDirectoryW", &g_Kernel32); return pfn( lpBuffer, uSize ); } typedef UINT WINAPI FN_GetSystemWindowsDirectoryA( LPSTR lpBuffer, UINT uSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemWindowsDirectoryA( LPSTR lpBuffer, UINT uSize ) { static FN_GetSystemWindowsDirectoryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemWindowsDirectoryA", &g_Kernel32); return pfn( lpBuffer, uSize ); } typedef UINT WINAPI FN_GetSystemWindowsDirectoryW( LPWSTR lpBuffer, UINT uSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemWindowsDirectoryW( LPWSTR lpBuffer, UINT uSize ) { static FN_GetSystemWindowsDirectoryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemWindowsDirectoryW", &g_Kernel32); return pfn( lpBuffer, uSize ); } typedef UINT WINAPI FN_GetSystemWow64DirectoryA( LPSTR lpBuffer, UINT uSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemWow64DirectoryA( LPSTR lpBuffer, UINT uSize ) { static FN_GetSystemWow64DirectoryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemWow64DirectoryA", &g_Kernel32); return pfn( lpBuffer, uSize ); } typedef UINT WINAPI FN_GetSystemWow64DirectoryW( LPWSTR lpBuffer, UINT uSize ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemWow64DirectoryW( LPWSTR lpBuffer, UINT uSize ) { static FN_GetSystemWow64DirectoryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemWow64DirectoryW", &g_Kernel32); return pfn( lpBuffer, uSize ); } typedef BOOLEAN WINAPI FN_Wow64EnableWow64FsRedirection( BOOLEAN Wow64FsEnableRedirection ); __declspec(dllexport) BOOLEAN WINAPI kPrf2Wrap_Wow64EnableWow64FsRedirection( BOOLEAN Wow64FsEnableRedirection ) { static FN_Wow64EnableWow64FsRedirection *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Wow64EnableWow64FsRedirection", &g_Kernel32); return pfn( Wow64FsEnableRedirection ); } typedef BOOL WINAPI FN_Wow64DisableWow64FsRedirection( PVOID * OldValue ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Wow64DisableWow64FsRedirection( PVOID * OldValue ) { static FN_Wow64DisableWow64FsRedirection *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Wow64DisableWow64FsRedirection", &g_Kernel32); return pfn( OldValue ); } typedef BOOL WINAPI FN_Wow64RevertWow64FsRedirection( PVOID OlValue ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Wow64RevertWow64FsRedirection( PVOID OlValue ) { static FN_Wow64RevertWow64FsRedirection *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Wow64RevertWow64FsRedirection", &g_Kernel32); return pfn( OlValue ); } typedef BOOL WINAPI FN_SetCurrentDirectoryA( LPCSTR lpPathName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCurrentDirectoryA( LPCSTR lpPathName ) { static FN_SetCurrentDirectoryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetCurrentDirectoryA", &g_Kernel32); return pfn( lpPathName ); } typedef BOOL WINAPI FN_SetCurrentDirectoryW( LPCWSTR lpPathName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCurrentDirectoryW( LPCWSTR lpPathName ) { static FN_SetCurrentDirectoryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetCurrentDirectoryW", &g_Kernel32); return pfn( lpPathName ); } typedef DWORD WINAPI FN_GetCurrentDirectoryA( DWORD nBufferLength, LPSTR lpBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCurrentDirectoryA( DWORD nBufferLength, LPSTR lpBuffer ) { static FN_GetCurrentDirectoryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentDirectoryA", &g_Kernel32); return pfn( nBufferLength, lpBuffer ); } typedef DWORD WINAPI FN_GetCurrentDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCurrentDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer ) { static FN_GetCurrentDirectoryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentDirectoryW", &g_Kernel32); return pfn( nBufferLength, lpBuffer ); } typedef BOOL WINAPI FN_SetDllDirectoryA( LPCSTR lpPathName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetDllDirectoryA( LPCSTR lpPathName ) { static FN_SetDllDirectoryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetDllDirectoryA", &g_Kernel32); return pfn( lpPathName ); } typedef BOOL WINAPI FN_SetDllDirectoryW( LPCWSTR lpPathName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetDllDirectoryW( LPCWSTR lpPathName ) { static FN_SetDllDirectoryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetDllDirectoryW", &g_Kernel32); return pfn( lpPathName ); } typedef DWORD WINAPI FN_GetDllDirectoryA( DWORD nBufferLength, LPSTR lpBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetDllDirectoryA( DWORD nBufferLength, LPSTR lpBuffer ) { static FN_GetDllDirectoryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDllDirectoryA", &g_Kernel32); return pfn( nBufferLength, lpBuffer ); } typedef DWORD WINAPI FN_GetDllDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetDllDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer ) { static FN_GetDllDirectoryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDllDirectoryW", &g_Kernel32); return pfn( nBufferLength, lpBuffer ); } typedef BOOL WINAPI FN_GetDiskFreeSpaceA( LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDiskFreeSpaceA( LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters ) { static FN_GetDiskFreeSpaceA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDiskFreeSpaceA", &g_Kernel32); return pfn( lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters ); } typedef BOOL WINAPI FN_GetDiskFreeSpaceW( LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDiskFreeSpaceW( LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters ) { static FN_GetDiskFreeSpaceW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDiskFreeSpaceW", &g_Kernel32); return pfn( lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters ); } typedef BOOL WINAPI FN_GetDiskFreeSpaceExA( LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDiskFreeSpaceExA( LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ) { static FN_GetDiskFreeSpaceExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDiskFreeSpaceExA", &g_Kernel32); return pfn( lpDirectoryName, lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes ); } typedef BOOL WINAPI FN_GetDiskFreeSpaceExW( LPCWSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDiskFreeSpaceExW( LPCWSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ) { static FN_GetDiskFreeSpaceExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDiskFreeSpaceExW", &g_Kernel32); return pfn( lpDirectoryName, lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes ); } typedef BOOL WINAPI FN_CreateDirectoryA( LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateDirectoryA( LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) { static FN_CreateDirectoryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateDirectoryA", &g_Kernel32); return pfn( lpPathName, lpSecurityAttributes ); } typedef BOOL WINAPI FN_CreateDirectoryW( LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateDirectoryW( LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) { static FN_CreateDirectoryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateDirectoryW", &g_Kernel32); return pfn( lpPathName, lpSecurityAttributes ); } typedef BOOL WINAPI FN_CreateDirectoryExA( LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateDirectoryExA( LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) { static FN_CreateDirectoryExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateDirectoryExA", &g_Kernel32); return pfn( lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes ); } typedef BOOL WINAPI FN_CreateDirectoryExW( LPCWSTR lpTemplateDirectory, LPCWSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateDirectoryExW( LPCWSTR lpTemplateDirectory, LPCWSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) { static FN_CreateDirectoryExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateDirectoryExW", &g_Kernel32); return pfn( lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes ); } typedef BOOL WINAPI FN_RemoveDirectoryA( LPCSTR lpPathName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_RemoveDirectoryA( LPCSTR lpPathName ) { static FN_RemoveDirectoryA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RemoveDirectoryA", &g_Kernel32); return pfn( lpPathName ); } typedef BOOL WINAPI FN_RemoveDirectoryW( LPCWSTR lpPathName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_RemoveDirectoryW( LPCWSTR lpPathName ) { static FN_RemoveDirectoryW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RemoveDirectoryW", &g_Kernel32); return pfn( lpPathName ); } typedef DWORD WINAPI FN_GetFullPathNameA( LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR * lpFilePart ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFullPathNameA( LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR * lpFilePart ) { static FN_GetFullPathNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFullPathNameA", &g_Kernel32); return pfn( lpFileName, nBufferLength, lpBuffer, lpFilePart ); } typedef DWORD WINAPI FN_GetFullPathNameW( LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR * lpFilePart ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFullPathNameW( LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR * lpFilePart ) { static FN_GetFullPathNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFullPathNameW", &g_Kernel32); return pfn( lpFileName, nBufferLength, lpBuffer, lpFilePart ); } typedef BOOL WINAPI FN_DefineDosDeviceA( DWORD dwFlags, LPCSTR lpDeviceName, LPCSTR lpTargetPath ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DefineDosDeviceA( DWORD dwFlags, LPCSTR lpDeviceName, LPCSTR lpTargetPath ) { static FN_DefineDosDeviceA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DefineDosDeviceA", &g_Kernel32); return pfn( dwFlags, lpDeviceName, lpTargetPath ); } typedef BOOL WINAPI FN_DefineDosDeviceW( DWORD dwFlags, LPCWSTR lpDeviceName, LPCWSTR lpTargetPath ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DefineDosDeviceW( DWORD dwFlags, LPCWSTR lpDeviceName, LPCWSTR lpTargetPath ) { static FN_DefineDosDeviceW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DefineDosDeviceW", &g_Kernel32); return pfn( dwFlags, lpDeviceName, lpTargetPath ); } typedef DWORD WINAPI FN_QueryDosDeviceA( LPCSTR lpDeviceName, LPSTR lpTargetPath, DWORD ucchMax ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_QueryDosDeviceA( LPCSTR lpDeviceName, LPSTR lpTargetPath, DWORD ucchMax ) { static FN_QueryDosDeviceA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "QueryDosDeviceA", &g_Kernel32); return pfn( lpDeviceName, lpTargetPath, ucchMax ); } typedef DWORD WINAPI FN_QueryDosDeviceW( LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_QueryDosDeviceW( LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax ) { static FN_QueryDosDeviceW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "QueryDosDeviceW", &g_Kernel32); return pfn( lpDeviceName, lpTargetPath, ucchMax ); } typedef HANDLE WINAPI FN_CreateFileA( LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateFileA( LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ) { static FN_CreateFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateFileA", &g_Kernel32); return pfn( lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile ); } typedef HANDLE WINAPI FN_CreateFileW( LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateFileW( LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ) { static FN_CreateFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateFileW", &g_Kernel32); return pfn( lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile ); } typedef HANDLE WINAPI FN_ReOpenFile( HANDLE hOriginalFile, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwFlagsAndAttributes ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_ReOpenFile( HANDLE hOriginalFile, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwFlagsAndAttributes ) { static FN_ReOpenFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReOpenFile", &g_Kernel32); return pfn( hOriginalFile, dwDesiredAccess, dwShareMode, dwFlagsAndAttributes ); } typedef BOOL WINAPI FN_SetFileAttributesA( LPCSTR lpFileName, DWORD dwFileAttributes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileAttributesA( LPCSTR lpFileName, DWORD dwFileAttributes ) { static FN_SetFileAttributesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFileAttributesA", &g_Kernel32); return pfn( lpFileName, dwFileAttributes ); } typedef BOOL WINAPI FN_SetFileAttributesW( LPCWSTR lpFileName, DWORD dwFileAttributes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileAttributesW( LPCWSTR lpFileName, DWORD dwFileAttributes ) { static FN_SetFileAttributesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFileAttributesW", &g_Kernel32); return pfn( lpFileName, dwFileAttributes ); } typedef DWORD WINAPI FN_GetFileAttributesA( LPCSTR lpFileName ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFileAttributesA( LPCSTR lpFileName ) { static FN_GetFileAttributesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileAttributesA", &g_Kernel32); return pfn( lpFileName ); } typedef DWORD WINAPI FN_GetFileAttributesW( LPCWSTR lpFileName ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFileAttributesW( LPCWSTR lpFileName ) { static FN_GetFileAttributesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileAttributesW", &g_Kernel32); return pfn( lpFileName ); } typedef BOOL WINAPI FN_GetFileAttributesExA( LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileAttributesExA( LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ) { static FN_GetFileAttributesExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileAttributesExA", &g_Kernel32); return pfn( lpFileName, fInfoLevelId, lpFileInformation ); } typedef BOOL WINAPI FN_GetFileAttributesExW( LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileAttributesExW( LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ) { static FN_GetFileAttributesExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileAttributesExW", &g_Kernel32); return pfn( lpFileName, fInfoLevelId, lpFileInformation ); } typedef DWORD WINAPI FN_GetCompressedFileSizeA( LPCSTR lpFileName, LPDWORD lpFileSizeHigh ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCompressedFileSizeA( LPCSTR lpFileName, LPDWORD lpFileSizeHigh ) { static FN_GetCompressedFileSizeA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCompressedFileSizeA", &g_Kernel32); return pfn( lpFileName, lpFileSizeHigh ); } typedef DWORD WINAPI FN_GetCompressedFileSizeW( LPCWSTR lpFileName, LPDWORD lpFileSizeHigh ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCompressedFileSizeW( LPCWSTR lpFileName, LPDWORD lpFileSizeHigh ) { static FN_GetCompressedFileSizeW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCompressedFileSizeW", &g_Kernel32); return pfn( lpFileName, lpFileSizeHigh ); } typedef BOOL WINAPI FN_DeleteFileA( LPCSTR lpFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteFileA( LPCSTR lpFileName ) { static FN_DeleteFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteFileA", &g_Kernel32); return pfn( lpFileName ); } typedef BOOL WINAPI FN_DeleteFileW( LPCWSTR lpFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteFileW( LPCWSTR lpFileName ) { static FN_DeleteFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteFileW", &g_Kernel32); return pfn( lpFileName ); } typedef BOOL WINAPI FN_CheckNameLegalDOS8Dot3A( LPCSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces , PBOOL pbNameLegal ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CheckNameLegalDOS8Dot3A( LPCSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces , PBOOL pbNameLegal ) { static FN_CheckNameLegalDOS8Dot3A *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CheckNameLegalDOS8Dot3A", &g_Kernel32); return pfn( lpName, lpOemName, OemNameSize, pbNameContainsSpaces , pbNameLegal ); } typedef BOOL WINAPI FN_CheckNameLegalDOS8Dot3W( LPCWSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces , PBOOL pbNameLegal ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CheckNameLegalDOS8Dot3W( LPCWSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces , PBOOL pbNameLegal ) { static FN_CheckNameLegalDOS8Dot3W *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CheckNameLegalDOS8Dot3W", &g_Kernel32); return pfn( lpName, lpOemName, OemNameSize, pbNameContainsSpaces , pbNameLegal ); } typedef HANDLE WINAPI FN_FindFirstFileExA( LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstFileExA( LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ) { static FN_FindFirstFileExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstFileExA", &g_Kernel32); return pfn( lpFileName, fInfoLevelId, lpFindFileData, fSearchOp, lpSearchFilter, dwAdditionalFlags ); } typedef HANDLE WINAPI FN_FindFirstFileExW( LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstFileExW( LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ) { static FN_FindFirstFileExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstFileExW", &g_Kernel32); return pfn( lpFileName, fInfoLevelId, lpFindFileData, fSearchOp, lpSearchFilter, dwAdditionalFlags ); } typedef HANDLE WINAPI FN_FindFirstFileA( LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstFileA( LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData ) { static FN_FindFirstFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstFileA", &g_Kernel32); return pfn( lpFileName, lpFindFileData ); } typedef HANDLE WINAPI FN_FindFirstFileW( LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstFileW( LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData ) { static FN_FindFirstFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstFileW", &g_Kernel32); return pfn( lpFileName, lpFindFileData ); } typedef BOOL WINAPI FN_FindNextFileA( HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextFileA( HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData ) { static FN_FindNextFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindNextFileA", &g_Kernel32); return pfn( hFindFile, lpFindFileData ); } typedef BOOL WINAPI FN_FindNextFileW( HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextFileW( HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData ) { static FN_FindNextFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindNextFileW", &g_Kernel32); return pfn( hFindFile, lpFindFileData ); } typedef DWORD WINAPI FN_SearchPathA( LPCSTR lpPath, LPCSTR lpFileName, LPCSTR lpExtension, DWORD nBufferLength, LPSTR lpBuffer, LPSTR * lpFilePart ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SearchPathA( LPCSTR lpPath, LPCSTR lpFileName, LPCSTR lpExtension, DWORD nBufferLength, LPSTR lpBuffer, LPSTR * lpFilePart ) { static FN_SearchPathA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SearchPathA", &g_Kernel32); return pfn( lpPath, lpFileName, lpExtension, nBufferLength, lpBuffer, lpFilePart ); } typedef DWORD WINAPI FN_SearchPathW( LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR * lpFilePart ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SearchPathW( LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR * lpFilePart ) { static FN_SearchPathW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SearchPathW", &g_Kernel32); return pfn( lpPath, lpFileName, lpExtension, nBufferLength, lpBuffer, lpFilePart ); } typedef BOOL WINAPI FN_CopyFileA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CopyFileA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists ) { static FN_CopyFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CopyFileA", &g_Kernel32); return pfn( lpExistingFileName, lpNewFileName, bFailIfExists ); } typedef BOOL WINAPI FN_CopyFileW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CopyFileW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists ) { static FN_CopyFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CopyFileW", &g_Kernel32); return pfn( lpExistingFileName, lpNewFileName, bFailIfExists ); } typedef BOOL WINAPI FN_CopyFileExA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CopyFileExA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ) { static FN_CopyFileExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CopyFileExA", &g_Kernel32); return pfn( lpExistingFileName, lpNewFileName, lpProgressRoutine, lpData, pbCancel, dwCopyFlags ); } typedef BOOL WINAPI FN_CopyFileExW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CopyFileExW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ) { static FN_CopyFileExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CopyFileExW", &g_Kernel32); return pfn( lpExistingFileName, lpNewFileName, lpProgressRoutine, lpData, pbCancel, dwCopyFlags ); } typedef BOOL WINAPI FN_MoveFileA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName ) { static FN_MoveFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MoveFileA", &g_Kernel32); return pfn( lpExistingFileName, lpNewFileName ); } typedef BOOL WINAPI FN_MoveFileW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName ) { static FN_MoveFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MoveFileW", &g_Kernel32); return pfn( lpExistingFileName, lpNewFileName ); } typedef BOOL WINAPI FN_MoveFileExA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileExA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags ) { static FN_MoveFileExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MoveFileExA", &g_Kernel32); return pfn( lpExistingFileName, lpNewFileName, dwFlags ); } typedef BOOL WINAPI FN_MoveFileExW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileExW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags ) { static FN_MoveFileExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MoveFileExW", &g_Kernel32); return pfn( lpExistingFileName, lpNewFileName, dwFlags ); } typedef BOOL WINAPI FN_MoveFileWithProgressA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileWithProgressA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags ) { static FN_MoveFileWithProgressA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MoveFileWithProgressA", &g_Kernel32); return pfn( lpExistingFileName, lpNewFileName, lpProgressRoutine, lpData, dwFlags ); } typedef BOOL WINAPI FN_MoveFileWithProgressW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileWithProgressW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags ) { static FN_MoveFileWithProgressW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MoveFileWithProgressW", &g_Kernel32); return pfn( lpExistingFileName, lpNewFileName, lpProgressRoutine, lpData, dwFlags ); } typedef BOOL WINAPI FN_ReplaceFileA( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReplaceFileA( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ) { static FN_ReplaceFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReplaceFileA", &g_Kernel32); return pfn( lpReplacedFileName, lpReplacementFileName, lpBackupFileName, dwReplaceFlags, lpExclude, lpReserved ); } typedef BOOL WINAPI FN_ReplaceFileW( LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileName, LPCWSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReplaceFileW( LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileName, LPCWSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ) { static FN_ReplaceFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReplaceFileW", &g_Kernel32); return pfn( lpReplacedFileName, lpReplacementFileName, lpBackupFileName, dwReplaceFlags, lpExclude, lpReserved ); } typedef BOOL WINAPI FN_CreateHardLinkA( LPCSTR lpFileName, LPCSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateHardLinkA( LPCSTR lpFileName, LPCSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) { static FN_CreateHardLinkA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateHardLinkA", &g_Kernel32); return pfn( lpFileName, lpExistingFileName, lpSecurityAttributes ); } typedef BOOL WINAPI FN_CreateHardLinkW( LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateHardLinkW( LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) { static FN_CreateHardLinkW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateHardLinkW", &g_Kernel32); return pfn( lpFileName, lpExistingFileName, lpSecurityAttributes ); } typedef HANDLE WINAPI FN_FindFirstStreamW( LPCWSTR lpFileName, STREAM_INFO_LEVELS InfoLevel, LPVOID lpFindStreamData, DWORD dwFlags ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstStreamW( LPCWSTR lpFileName, STREAM_INFO_LEVELS InfoLevel, LPVOID lpFindStreamData, DWORD dwFlags ) { static FN_FindFirstStreamW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstStreamW", &g_Kernel32); return pfn( lpFileName, InfoLevel, lpFindStreamData, dwFlags ); } typedef BOOL APIENTRY FN_FindNextStreamW( HANDLE hFindStream, LPVOID lpFindStreamData ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_FindNextStreamW( HANDLE hFindStream, LPVOID lpFindStreamData ) { static FN_FindNextStreamW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindNextStreamW", &g_Kernel32); return pfn( hFindStream, lpFindStreamData ); } typedef HANDLE WINAPI FN_CreateNamedPipeA( LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateNamedPipeA( LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) { static FN_CreateNamedPipeA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateNamedPipeA", &g_Kernel32); return pfn( lpName, dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes ); } typedef HANDLE WINAPI FN_CreateNamedPipeW( LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateNamedPipeW( LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) { static FN_CreateNamedPipeW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateNamedPipeW", &g_Kernel32); return pfn( lpName, dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes ); } typedef BOOL WINAPI FN_GetNamedPipeHandleStateA( HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPSTR lpUserName, DWORD nMaxUserNameSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNamedPipeHandleStateA( HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPSTR lpUserName, DWORD nMaxUserNameSize ) { static FN_GetNamedPipeHandleStateA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNamedPipeHandleStateA", &g_Kernel32); return pfn( hNamedPipe, lpState, lpCurInstances, lpMaxCollectionCount, lpCollectDataTimeout, lpUserName, nMaxUserNameSize ); } typedef BOOL WINAPI FN_GetNamedPipeHandleStateW( HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPWSTR lpUserName, DWORD nMaxUserNameSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNamedPipeHandleStateW( HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPWSTR lpUserName, DWORD nMaxUserNameSize ) { static FN_GetNamedPipeHandleStateW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNamedPipeHandleStateW", &g_Kernel32); return pfn( hNamedPipe, lpState, lpCurInstances, lpMaxCollectionCount, lpCollectDataTimeout, lpUserName, nMaxUserNameSize ); } typedef BOOL WINAPI FN_CallNamedPipeA( LPCSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CallNamedPipeA( LPCSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut ) { static FN_CallNamedPipeA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CallNamedPipeA", &g_Kernel32); return pfn( lpNamedPipeName, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesRead, nTimeOut ); } typedef BOOL WINAPI FN_CallNamedPipeW( LPCWSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CallNamedPipeW( LPCWSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut ) { static FN_CallNamedPipeW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CallNamedPipeW", &g_Kernel32); return pfn( lpNamedPipeName, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesRead, nTimeOut ); } typedef BOOL WINAPI FN_WaitNamedPipeA( LPCSTR lpNamedPipeName, DWORD nTimeOut ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WaitNamedPipeA( LPCSTR lpNamedPipeName, DWORD nTimeOut ) { static FN_WaitNamedPipeA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WaitNamedPipeA", &g_Kernel32); return pfn( lpNamedPipeName, nTimeOut ); } typedef BOOL WINAPI FN_WaitNamedPipeW( LPCWSTR lpNamedPipeName, DWORD nTimeOut ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WaitNamedPipeW( LPCWSTR lpNamedPipeName, DWORD nTimeOut ) { static FN_WaitNamedPipeW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WaitNamedPipeW", &g_Kernel32); return pfn( lpNamedPipeName, nTimeOut ); } typedef BOOL WINAPI FN_SetVolumeLabelA( LPCSTR lpRootPathName, LPCSTR lpVolumeName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetVolumeLabelA( LPCSTR lpRootPathName, LPCSTR lpVolumeName ) { static FN_SetVolumeLabelA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetVolumeLabelA", &g_Kernel32); return pfn( lpRootPathName, lpVolumeName ); } typedef BOOL WINAPI FN_SetVolumeLabelW( LPCWSTR lpRootPathName, LPCWSTR lpVolumeName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetVolumeLabelW( LPCWSTR lpRootPathName, LPCWSTR lpVolumeName ) { static FN_SetVolumeLabelW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetVolumeLabelW", &g_Kernel32); return pfn( lpRootPathName, lpVolumeName ); } typedef VOID WINAPI FN_SetFileApisToOEM( VOID ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_SetFileApisToOEM( VOID ) { static FN_SetFileApisToOEM *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFileApisToOEM", &g_Kernel32); pfn (); } typedef VOID WINAPI FN_SetFileApisToANSI( VOID ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_SetFileApisToANSI( VOID ) { static FN_SetFileApisToANSI *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFileApisToANSI", &g_Kernel32); pfn (); } typedef BOOL WINAPI FN_AreFileApisANSI( VOID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AreFileApisANSI( VOID ) { static FN_AreFileApisANSI *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AreFileApisANSI", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_GetVolumeInformationA( LPCSTR lpRootPathName, LPSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumeInformationA( LPCSTR lpRootPathName, LPSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ) { static FN_GetVolumeInformationA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVolumeInformationA", &g_Kernel32); return pfn( lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize ); } typedef BOOL WINAPI FN_GetVolumeInformationW( LPCWSTR lpRootPathName, LPWSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPWSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumeInformationW( LPCWSTR lpRootPathName, LPWSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPWSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ) { static FN_GetVolumeInformationW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVolumeInformationW", &g_Kernel32); return pfn( lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize ); } typedef BOOL WINAPI FN_CancelIo( HANDLE hFile ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CancelIo( HANDLE hFile ) { static FN_CancelIo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CancelIo", &g_Kernel32); return pfn( hFile ); } typedef BOOL WINAPI FN_ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName ) { static FN_ClearEventLogA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ClearEventLogA", &g_Kernel32); return pfn( hEventLog, lpBackupFileName ); } typedef BOOL WINAPI FN_ClearEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ClearEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ) { static FN_ClearEventLogW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ClearEventLogW", &g_Kernel32); return pfn( hEventLog, lpBackupFileName ); } typedef BOOL WINAPI FN_BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName ) { static FN_BackupEventLogA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BackupEventLogA", &g_Kernel32); return pfn( hEventLog, lpBackupFileName ); } typedef BOOL WINAPI FN_BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ) { static FN_BackupEventLogW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BackupEventLogW", &g_Kernel32); return pfn( hEventLog, lpBackupFileName ); } typedef BOOL WINAPI FN_CloseEventLog( HANDLE hEventLog ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CloseEventLog( HANDLE hEventLog ) { static FN_CloseEventLog *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CloseEventLog", &g_Kernel32); return pfn( hEventLog ); } typedef BOOL WINAPI FN_DeregisterEventSource( HANDLE hEventLog ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeregisterEventSource( HANDLE hEventLog ) { static FN_DeregisterEventSource *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeregisterEventSource", &g_Kernel32); return pfn( hEventLog ); } typedef BOOL WINAPI FN_NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent ) { static FN_NotifyChangeEventLog *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "NotifyChangeEventLog", &g_Kernel32); return pfn( hEventLog, hEvent ); } typedef BOOL WINAPI FN_GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords ) { static FN_GetNumberOfEventLogRecords *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNumberOfEventLogRecords", &g_Kernel32); return pfn( hEventLog, NumberOfRecords ); } typedef BOOL WINAPI FN_GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord ) { static FN_GetOldestEventLogRecord *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetOldestEventLogRecord", &g_Kernel32); return pfn( hEventLog, OldestRecord ); } typedef HANDLE WINAPI FN_OpenEventLogA( LPCSTR lpUNCServerName, LPCSTR lpSourceName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenEventLogA( LPCSTR lpUNCServerName, LPCSTR lpSourceName ) { static FN_OpenEventLogA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenEventLogA", &g_Kernel32); return pfn( lpUNCServerName, lpSourceName ); } typedef HANDLE WINAPI FN_OpenEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ) { static FN_OpenEventLogW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenEventLogW", &g_Kernel32); return pfn( lpUNCServerName, lpSourceName ); } typedef HANDLE WINAPI FN_RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName ) { static FN_RegisterEventSourceA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RegisterEventSourceA", &g_Kernel32); return pfn( lpUNCServerName, lpSourceName ); } typedef HANDLE WINAPI FN_RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ) { static FN_RegisterEventSourceW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RegisterEventSourceW", &g_Kernel32); return pfn( lpUNCServerName, lpSourceName ); } typedef HANDLE WINAPI FN_OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName ) { static FN_OpenBackupEventLogA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenBackupEventLogA", &g_Kernel32); return pfn( lpUNCServerName, lpFileName ); } typedef HANDLE WINAPI FN_OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName ) { static FN_OpenBackupEventLogW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenBackupEventLogW", &g_Kernel32); return pfn( lpUNCServerName, lpFileName ); } typedef BOOL WINAPI FN_ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD * pnBytesRead, DWORD * pnMinNumberOfBytesNeeded ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD * pnBytesRead, DWORD * pnMinNumberOfBytesNeeded ) { static FN_ReadEventLogA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadEventLogA", &g_Kernel32); return pfn( hEventLog, dwReadFlags, dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded ); } typedef BOOL WINAPI FN_ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD * pnBytesRead, DWORD * pnMinNumberOfBytesNeeded ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD * pnBytesRead, DWORD * pnMinNumberOfBytesNeeded ) { static FN_ReadEventLogW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadEventLogW", &g_Kernel32); return pfn( hEventLog, dwReadFlags, dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded ); } typedef BOOL WINAPI FN_ReportEventA( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR * lpStrings, LPVOID lpRawData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReportEventA( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR * lpStrings, LPVOID lpRawData ) { static FN_ReportEventA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReportEventA", &g_Kernel32); return pfn( hEventLog, wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData ); } typedef BOOL WINAPI FN_ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR * lpStrings, LPVOID lpRawData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR * lpStrings, LPVOID lpRawData ) { static FN_ReportEventW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReportEventW", &g_Kernel32); return pfn( hEventLog, wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData ); } typedef BOOL WINAPI FN_GetEventLogInformation( HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetEventLogInformation( HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded ) { static FN_GetEventLogInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetEventLogInformation", &g_Kernel32); return pfn( hEventLog, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded ); } typedef BOOL WINAPI FN_DuplicateToken( HANDLE ExistingTokenHandle, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, PHANDLE DuplicateTokenHandle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DuplicateToken( HANDLE ExistingTokenHandle, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, PHANDLE DuplicateTokenHandle ) { static FN_DuplicateToken *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DuplicateToken", &g_Kernel32); return pfn( ExistingTokenHandle, ImpersonationLevel, DuplicateTokenHandle ); } typedef BOOL WINAPI FN_GetKernelObjectSecurity( HANDLE Handle, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetKernelObjectSecurity( HANDLE Handle, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ) { static FN_GetKernelObjectSecurity *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetKernelObjectSecurity", &g_Kernel32); return pfn( Handle, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded ); } typedef BOOL WINAPI FN_ImpersonateNamedPipeClient( HANDLE hNamedPipe ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ImpersonateNamedPipeClient( HANDLE hNamedPipe ) { static FN_ImpersonateNamedPipeClient *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ImpersonateNamedPipeClient", &g_Kernel32); return pfn( hNamedPipe ); } typedef BOOL WINAPI FN_ImpersonateSelf( SECURITY_IMPERSONATION_LEVEL ImpersonationLevel ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ImpersonateSelf( SECURITY_IMPERSONATION_LEVEL ImpersonationLevel ) { static FN_ImpersonateSelf *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ImpersonateSelf", &g_Kernel32); return pfn( ImpersonationLevel ); } typedef BOOL WINAPI FN_RevertToSelf( VOID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_RevertToSelf( VOID ) { static FN_RevertToSelf *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RevertToSelf", &g_Kernel32); return pfn (); } typedef BOOL APIENTRY FN_SetThreadToken( PHANDLE Thread, HANDLE Token ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_SetThreadToken( PHANDLE Thread, HANDLE Token ) { static FN_SetThreadToken *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetThreadToken", &g_Kernel32); return pfn( Thread, Token ); } typedef BOOL WINAPI FN_AccessCheck( PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheck( PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus ) { static FN_AccessCheck *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheck", &g_Kernel32); return pfn( pSecurityDescriptor, ClientToken, DesiredAccess, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus ); } typedef BOOL WINAPI FN_AccessCheckByType( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByType( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus ) { static FN_AccessCheckByType *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheckByType", &g_Kernel32); return pfn( pSecurityDescriptor, PrincipalSelfSid, ClientToken, DesiredAccess, ObjectTypeList, ObjectTypeListLength, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus ); } typedef BOOL WINAPI FN_AccessCheckByTypeResultList( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccessList, LPDWORD AccessStatusList ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeResultList( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccessList, LPDWORD AccessStatusList ) { static FN_AccessCheckByTypeResultList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeResultList", &g_Kernel32); return pfn( pSecurityDescriptor, PrincipalSelfSid, ClientToken, DesiredAccess, ObjectTypeList, ObjectTypeListLength, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccessList, AccessStatusList ); } typedef BOOL WINAPI FN_OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle ) { static FN_OpenProcessToken *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenProcessToken", &g_Kernel32); return pfn( ProcessHandle, DesiredAccess, TokenHandle ); } typedef BOOL WINAPI FN_OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, PHANDLE TokenHandle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, PHANDLE TokenHandle ) { static FN_OpenThreadToken *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenThreadToken", &g_Kernel32); return pfn( ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle ); } typedef BOOL WINAPI FN_GetTokenInformation( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetTokenInformation( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength ) { static FN_GetTokenInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTokenInformation", &g_Kernel32); return pfn( TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength ); } typedef BOOL WINAPI FN_SetTokenInformation( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetTokenInformation( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength ) { static FN_SetTokenInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetTokenInformation", &g_Kernel32); return pfn( TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength ); } typedef BOOL WINAPI FN_AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength ) { static FN_AdjustTokenPrivileges *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AdjustTokenPrivileges", &g_Kernel32); return pfn( TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength ); } typedef BOOL WINAPI FN_AdjustTokenGroups( HANDLE TokenHandle, BOOL ResetToDefault, PTOKEN_GROUPS NewState, DWORD BufferLength, PTOKEN_GROUPS PreviousState, PDWORD ReturnLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AdjustTokenGroups( HANDLE TokenHandle, BOOL ResetToDefault, PTOKEN_GROUPS NewState, DWORD BufferLength, PTOKEN_GROUPS PreviousState, PDWORD ReturnLength ) { static FN_AdjustTokenGroups *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AdjustTokenGroups", &g_Kernel32); return pfn( TokenHandle, ResetToDefault, NewState, BufferLength, PreviousState, ReturnLength ); } typedef BOOL WINAPI FN_PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult ) { static FN_PrivilegeCheck *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "PrivilegeCheck", &g_Kernel32); return pfn( ClientToken, RequiredPrivileges, pfResult ); } typedef BOOL WINAPI FN_AccessCheckAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ) { static FN_AccessCheckAndAuditAlarmA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheckAndAuditAlarmA", &g_Kernel32); return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, pfGenerateOnClose ); } typedef BOOL WINAPI FN_AccessCheckAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, LPWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, LPWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ) { static FN_AccessCheckAndAuditAlarmW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheckAndAuditAlarmW", &g_Kernel32); return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, pfGenerateOnClose ); } typedef BOOL WINAPI FN_AccessCheckByTypeAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ) { static FN_AccessCheckByTypeAndAuditAlarmA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeAndAuditAlarmA", &g_Kernel32); return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, pfGenerateOnClose ); } typedef BOOL WINAPI FN_AccessCheckByTypeAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ) { static FN_AccessCheckByTypeAndAuditAlarmW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeAndAuditAlarmW", &g_Kernel32); return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, pfGenerateOnClose ); } typedef BOOL WINAPI FN_AccessCheckByTypeResultListAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeResultListAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ) { static FN_AccessCheckByTypeResultListAndAuditAlarmA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeResultListAndAuditAlarmA", &g_Kernel32); return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatusList, pfGenerateOnClose ); } typedef BOOL WINAPI FN_AccessCheckByTypeResultListAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeResultListAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ) { static FN_AccessCheckByTypeResultListAndAuditAlarmW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeResultListAndAuditAlarmW", &g_Kernel32); return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatusList, pfGenerateOnClose ); } typedef BOOL WINAPI FN_AccessCheckByTypeResultListAndAuditAlarmByHandleA( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeResultListAndAuditAlarmByHandleA( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ) { static FN_AccessCheckByTypeResultListAndAuditAlarmByHandleA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeResultListAndAuditAlarmByHandleA", &g_Kernel32); return pfn( SubsystemName, HandleId, ClientToken, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatusList, pfGenerateOnClose ); } typedef BOOL WINAPI FN_AccessCheckByTypeResultListAndAuditAlarmByHandleW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeResultListAndAuditAlarmByHandleW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ) { static FN_AccessCheckByTypeResultListAndAuditAlarmByHandleW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeResultListAndAuditAlarmByHandleW", &g_Kernel32); return pfn( SubsystemName, HandleId, ClientToken, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatusList, pfGenerateOnClose ); } typedef BOOL WINAPI FN_ObjectOpenAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, LPBOOL GenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectOpenAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, LPBOOL GenerateOnClose ) { static FN_ObjectOpenAuditAlarmA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ObjectOpenAuditAlarmA", &g_Kernel32); return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, pSecurityDescriptor, ClientToken, DesiredAccess, GrantedAccess, Privileges, ObjectCreation, AccessGranted, GenerateOnClose ); } typedef BOOL WINAPI FN_ObjectOpenAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, LPWSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, LPBOOL GenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectOpenAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, LPWSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, LPBOOL GenerateOnClose ) { static FN_ObjectOpenAuditAlarmW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ObjectOpenAuditAlarmW", &g_Kernel32); return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, pSecurityDescriptor, ClientToken, DesiredAccess, GrantedAccess, Privileges, ObjectCreation, AccessGranted, GenerateOnClose ); } typedef BOOL WINAPI FN_ObjectPrivilegeAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectPrivilegeAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted ) { static FN_ObjectPrivilegeAuditAlarmA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ObjectPrivilegeAuditAlarmA", &g_Kernel32); return pfn( SubsystemName, HandleId, ClientToken, DesiredAccess, Privileges, AccessGranted ); } typedef BOOL WINAPI FN_ObjectPrivilegeAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectPrivilegeAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted ) { static FN_ObjectPrivilegeAuditAlarmW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ObjectPrivilegeAuditAlarmW", &g_Kernel32); return pfn( SubsystemName, HandleId, ClientToken, DesiredAccess, Privileges, AccessGranted ); } typedef BOOL WINAPI FN_ObjectCloseAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectCloseAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ) { static FN_ObjectCloseAuditAlarmA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ObjectCloseAuditAlarmA", &g_Kernel32); return pfn( SubsystemName, HandleId, GenerateOnClose ); } typedef BOOL WINAPI FN_ObjectCloseAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectCloseAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ) { static FN_ObjectCloseAuditAlarmW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ObjectCloseAuditAlarmW", &g_Kernel32); return pfn( SubsystemName, HandleId, GenerateOnClose ); } typedef BOOL WINAPI FN_ObjectDeleteAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectDeleteAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ) { static FN_ObjectDeleteAuditAlarmA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ObjectDeleteAuditAlarmA", &g_Kernel32); return pfn( SubsystemName, HandleId, GenerateOnClose ); } typedef BOOL WINAPI FN_ObjectDeleteAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectDeleteAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ) { static FN_ObjectDeleteAuditAlarmW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ObjectDeleteAuditAlarmW", &g_Kernel32); return pfn( SubsystemName, HandleId, GenerateOnClose ); } typedef BOOL WINAPI FN_PrivilegedServiceAuditAlarmA( LPCSTR SubsystemName, LPCSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_PrivilegedServiceAuditAlarmA( LPCSTR SubsystemName, LPCSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOL AccessGranted ) { static FN_PrivilegedServiceAuditAlarmA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "PrivilegedServiceAuditAlarmA", &g_Kernel32); return pfn( SubsystemName, ServiceName, ClientToken, Privileges, AccessGranted ); } typedef BOOL WINAPI FN_PrivilegedServiceAuditAlarmW( LPCWSTR SubsystemName, LPCWSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_PrivilegedServiceAuditAlarmW( LPCWSTR SubsystemName, LPCWSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOL AccessGranted ) { static FN_PrivilegedServiceAuditAlarmW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "PrivilegedServiceAuditAlarmW", &g_Kernel32); return pfn( SubsystemName, ServiceName, ClientToken, Privileges, AccessGranted ); } typedef BOOL WINAPI FN_IsWellKnownSid( PSID pSid, WELL_KNOWN_SID_TYPE WellKnownSidType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsWellKnownSid( PSID pSid, WELL_KNOWN_SID_TYPE WellKnownSidType ) { static FN_IsWellKnownSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsWellKnownSid", &g_Kernel32); return pfn( pSid, WellKnownSidType ); } typedef BOOL WINAPI FN_CreateWellKnownSid( WELL_KNOWN_SID_TYPE WellKnownSidType, PSID DomainSid, PSID pSid, DWORD * cbSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateWellKnownSid( WELL_KNOWN_SID_TYPE WellKnownSidType, PSID DomainSid, PSID pSid, DWORD * cbSid ) { static FN_CreateWellKnownSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateWellKnownSid", &g_Kernel32); return pfn( WellKnownSidType, DomainSid, pSid, cbSid ); } typedef BOOL WINAPI FN_EqualDomainSid( PSID pSid1, PSID pSid2, BOOL * pfEqual ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EqualDomainSid( PSID pSid1, PSID pSid2, BOOL * pfEqual ) { static FN_EqualDomainSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EqualDomainSid", &g_Kernel32); return pfn( pSid1, pSid2, pfEqual ); } typedef BOOL WINAPI FN_GetWindowsAccountDomainSid( PSID pSid, PSID pDomainSid, DWORD * cbDomainSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetWindowsAccountDomainSid( PSID pSid, PSID pDomainSid, DWORD * cbDomainSid ) { static FN_GetWindowsAccountDomainSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetWindowsAccountDomainSid", &g_Kernel32); return pfn( pSid, pDomainSid, cbDomainSid ); } typedef BOOL WINAPI FN_IsValidSid( PSID pSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidSid( PSID pSid ) { static FN_IsValidSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsValidSid", &g_Kernel32); return pfn( pSid ); } typedef BOOL WINAPI FN_EqualSid( PSID pSid1, PSID pSid2 ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EqualSid( PSID pSid1, PSID pSid2 ) { static FN_EqualSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EqualSid", &g_Kernel32); return pfn( pSid1, pSid2 ); } typedef BOOL WINAPI FN_EqualPrefixSid( PSID pSid1, PSID pSid2 ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EqualPrefixSid( PSID pSid1, PSID pSid2 ) { static FN_EqualPrefixSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EqualPrefixSid", &g_Kernel32); return pfn( pSid1, pSid2 ); } typedef DWORD WINAPI FN_GetSidLengthRequired( UCHAR nSubAuthorityCount ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetSidLengthRequired( UCHAR nSubAuthorityCount ) { static FN_GetSidLengthRequired *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSidLengthRequired", &g_Kernel32); return pfn( nSubAuthorityCount ); } typedef BOOL WINAPI FN_AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID * pSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID * pSid ) { static FN_AllocateAndInitializeSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AllocateAndInitializeSid", &g_Kernel32); return pfn( pIdentifierAuthority, nSubAuthorityCount, nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, pSid ); } typedef PVOID WINAPI FN_FreeSid( PSID pSid ); __declspec(dllexport) PVOID WINAPI kPrf2Wrap_FreeSid( PSID pSid ) { static FN_FreeSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FreeSid", &g_Kernel32); return pfn( pSid ); } typedef BOOL WINAPI FN_InitializeSid( PSID Sid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_InitializeSid( PSID Sid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount ) { static FN_InitializeSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InitializeSid", &g_Kernel32); return pfn( Sid, pIdentifierAuthority, nSubAuthorityCount ); } typedef PSID_IDENTIFIER_AUTHORITY WINAPI FN_GetSidIdentifierAuthority( PSID pSid ); __declspec(dllexport) PSID_IDENTIFIER_AUTHORITY WINAPI kPrf2Wrap_GetSidIdentifierAuthority( PSID pSid ) { static FN_GetSidIdentifierAuthority *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSidIdentifierAuthority", &g_Kernel32); return pfn( pSid ); } typedef PDWORD WINAPI FN_GetSidSubAuthority( PSID pSid, DWORD nSubAuthority ); __declspec(dllexport) PDWORD WINAPI kPrf2Wrap_GetSidSubAuthority( PSID pSid, DWORD nSubAuthority ) { static FN_GetSidSubAuthority *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSidSubAuthority", &g_Kernel32); return pfn( pSid, nSubAuthority ); } typedef PUCHAR WINAPI FN_GetSidSubAuthorityCount( PSID pSid ); __declspec(dllexport) PUCHAR WINAPI kPrf2Wrap_GetSidSubAuthorityCount( PSID pSid ) { static FN_GetSidSubAuthorityCount *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSidSubAuthorityCount", &g_Kernel32); return pfn( pSid ); } typedef DWORD WINAPI FN_GetLengthSid( PSID pSid ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLengthSid( PSID pSid ) { static FN_GetLengthSid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLengthSid", &g_Kernel32); return pfn( pSid ); } typedef BOOL WINAPI FN_CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid ) { static FN_CopySid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CopySid", &g_Kernel32); return pfn( nDestinationSidLength, pDestinationSid, pSourceSid ); } typedef BOOL WINAPI FN_AreAllAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AreAllAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ) { static FN_AreAllAccessesGranted *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AreAllAccessesGranted", &g_Kernel32); return pfn( GrantedAccess, DesiredAccess ); } typedef BOOL WINAPI FN_AreAnyAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AreAnyAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ) { static FN_AreAnyAccessesGranted *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AreAnyAccessesGranted", &g_Kernel32); return pfn( GrantedAccess, DesiredAccess ); } typedef VOID WINAPI FN_MapGenericMask( PDWORD AccessMask, PGENERIC_MAPPING GenericMapping ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_MapGenericMask( PDWORD AccessMask, PGENERIC_MAPPING GenericMapping ) { static FN_MapGenericMask *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MapGenericMask", &g_Kernel32); pfn( AccessMask, GenericMapping ); } typedef BOOL WINAPI FN_IsValidAcl( PACL pAcl ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidAcl( PACL pAcl ) { static FN_IsValidAcl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsValidAcl", &g_Kernel32); return pfn( pAcl ); } typedef BOOL WINAPI FN_InitializeAcl( PACL pAcl, DWORD nAclLength, DWORD dwAclRevision ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_InitializeAcl( PACL pAcl, DWORD nAclLength, DWORD dwAclRevision ) { static FN_InitializeAcl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InitializeAcl", &g_Kernel32); return pfn( pAcl, nAclLength, dwAclRevision ); } typedef BOOL WINAPI FN_GetAclInformation( PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetAclInformation( PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass ) { static FN_GetAclInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetAclInformation", &g_Kernel32); return pfn( pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass ); } typedef BOOL WINAPI FN_SetAclInformation( PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetAclInformation( PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass ) { static FN_SetAclInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetAclInformation", &g_Kernel32); return pfn( pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass ); } typedef BOOL WINAPI FN_AddAce( PACL pAcl, DWORD dwAceRevision, DWORD dwStartingAceIndex, LPVOID pAceList, DWORD nAceListLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAce( PACL pAcl, DWORD dwAceRevision, DWORD dwStartingAceIndex, LPVOID pAceList, DWORD nAceListLength ) { static FN_AddAce *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAce", &g_Kernel32); return pfn( pAcl, dwAceRevision, dwStartingAceIndex, pAceList, nAceListLength ); } typedef BOOL WINAPI FN_DeleteAce( PACL pAcl, DWORD dwAceIndex ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteAce( PACL pAcl, DWORD dwAceIndex ) { static FN_DeleteAce *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteAce", &g_Kernel32); return pfn( pAcl, dwAceIndex ); } typedef BOOL WINAPI FN_GetAce( PACL pAcl, DWORD dwAceIndex, LPVOID * pAce ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetAce( PACL pAcl, DWORD dwAceIndex, LPVOID * pAce ) { static FN_GetAce *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetAce", &g_Kernel32); return pfn( pAcl, dwAceIndex, pAce ); } typedef BOOL WINAPI FN_AddAccessAllowedAce( PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessAllowedAce( PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid ) { static FN_AddAccessAllowedAce *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAccessAllowedAce", &g_Kernel32); return pfn( pAcl, dwAceRevision, AccessMask, pSid ); } typedef BOOL WINAPI FN_AddAccessAllowedAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessAllowedAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ) { static FN_AddAccessAllowedAceEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAccessAllowedAceEx", &g_Kernel32); return pfn( pAcl, dwAceRevision, AceFlags, AccessMask, pSid ); } typedef BOOL WINAPI FN_AddAccessDeniedAce( PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessDeniedAce( PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid ) { static FN_AddAccessDeniedAce *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAccessDeniedAce", &g_Kernel32); return pfn( pAcl, dwAceRevision, AccessMask, pSid ); } typedef BOOL WINAPI FN_AddAccessDeniedAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessDeniedAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ) { static FN_AddAccessDeniedAceEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAccessDeniedAceEx", &g_Kernel32); return pfn( pAcl, dwAceRevision, AceFlags, AccessMask, pSid ); } typedef BOOL WINAPI FN_AddAuditAccessAce( PACL pAcl, DWORD dwAceRevision, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAuditAccessAce( PACL pAcl, DWORD dwAceRevision, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ) { static FN_AddAuditAccessAce *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAuditAccessAce", &g_Kernel32); return pfn( pAcl, dwAceRevision, dwAccessMask, pSid, bAuditSuccess, bAuditFailure ); } typedef BOOL WINAPI FN_AddAuditAccessAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAuditAccessAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ) { static FN_AddAuditAccessAceEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAuditAccessAceEx", &g_Kernel32); return pfn( pAcl, dwAceRevision, AceFlags, dwAccessMask, pSid, bAuditSuccess, bAuditFailure ); } typedef BOOL WINAPI FN_AddAccessAllowedObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessAllowedObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid ) { static FN_AddAccessAllowedObjectAce *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAccessAllowedObjectAce", &g_Kernel32); return pfn( pAcl, dwAceRevision, AceFlags, AccessMask, ObjectTypeGuid, InheritedObjectTypeGuid, pSid ); } typedef BOOL WINAPI FN_AddAccessDeniedObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessDeniedObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid ) { static FN_AddAccessDeniedObjectAce *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAccessDeniedObjectAce", &g_Kernel32); return pfn( pAcl, dwAceRevision, AceFlags, AccessMask, ObjectTypeGuid, InheritedObjectTypeGuid, pSid ); } typedef BOOL WINAPI FN_AddAuditAccessObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAuditAccessObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ) { static FN_AddAuditAccessObjectAce *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddAuditAccessObjectAce", &g_Kernel32); return pfn( pAcl, dwAceRevision, AceFlags, AccessMask, ObjectTypeGuid, InheritedObjectTypeGuid, pSid, bAuditSuccess, bAuditFailure ); } typedef BOOL WINAPI FN_FindFirstFreeAce( PACL pAcl, LPVOID * pAce ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindFirstFreeAce( PACL pAcl, LPVOID * pAce ) { static FN_FindFirstFreeAce *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstFreeAce", &g_Kernel32); return pfn( pAcl, pAce ); } typedef BOOL WINAPI FN_InitializeSecurityDescriptor( PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_InitializeSecurityDescriptor( PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision ) { static FN_InitializeSecurityDescriptor *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "InitializeSecurityDescriptor", &g_Kernel32); return pfn( pSecurityDescriptor, dwRevision ); } typedef BOOL WINAPI FN_IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR pSecurityDescriptor ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR pSecurityDescriptor ) { static FN_IsValidSecurityDescriptor *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsValidSecurityDescriptor", &g_Kernel32); return pfn( pSecurityDescriptor ); } typedef DWORD WINAPI FN_GetSecurityDescriptorLength( PSECURITY_DESCRIPTOR pSecurityDescriptor ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetSecurityDescriptorLength( PSECURITY_DESCRIPTOR pSecurityDescriptor ) { static FN_GetSecurityDescriptorLength *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorLength", &g_Kernel32); return pfn( pSecurityDescriptor ); } typedef BOOL WINAPI FN_GetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision ) { static FN_GetSecurityDescriptorControl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorControl", &g_Kernel32); return pfn( pSecurityDescriptor, pControl, lpdwRevision ); } typedef BOOL WINAPI FN_SetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet ) { static FN_SetSecurityDescriptorControl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorControl", &g_Kernel32); return pfn( pSecurityDescriptor, ControlBitsOfInterest, ControlBitsToSet ); } typedef BOOL WINAPI FN_SetSecurityDescriptorDacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSecurityDescriptorDacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted ) { static FN_SetSecurityDescriptorDacl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorDacl", &g_Kernel32); return pfn( pSecurityDescriptor, bDaclPresent, pDacl, bDaclDefaulted ); } typedef BOOL WINAPI FN_GetSecurityDescriptorDacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL * pDacl, LPBOOL lpbDaclDefaulted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSecurityDescriptorDacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL * pDacl, LPBOOL lpbDaclDefaulted ) { static FN_GetSecurityDescriptorDacl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorDacl", &g_Kernel32); return pfn( pSecurityDescriptor, lpbDaclPresent, pDacl, lpbDaclDefaulted ); } typedef BOOL WINAPI FN_SetSecurityDescriptorSacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bSaclPresent, PACL pSacl, BOOL bSaclDefaulted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSecurityDescriptorSacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bSaclPresent, PACL pSacl, BOOL bSaclDefaulted ) { static FN_SetSecurityDescriptorSacl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorSacl", &g_Kernel32); return pfn( pSecurityDescriptor, bSaclPresent, pSacl, bSaclDefaulted ); } typedef BOOL WINAPI FN_GetSecurityDescriptorSacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent, PACL * pSacl, LPBOOL lpbSaclDefaulted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSecurityDescriptorSacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent, PACL * pSacl, LPBOOL lpbSaclDefaulted ) { static FN_GetSecurityDescriptorSacl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorSacl", &g_Kernel32); return pfn( pSecurityDescriptor, lpbSaclPresent, pSacl, lpbSaclDefaulted ); } typedef BOOL WINAPI FN_SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner, BOOL bOwnerDefaulted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner, BOOL bOwnerDefaulted ) { static FN_SetSecurityDescriptorOwner *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorOwner", &g_Kernel32); return pfn( pSecurityDescriptor, pOwner, bOwnerDefaulted ); } typedef BOOL WINAPI FN_GetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID * pOwner, LPBOOL lpbOwnerDefaulted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID * pOwner, LPBOOL lpbOwnerDefaulted ) { static FN_GetSecurityDescriptorOwner *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorOwner", &g_Kernel32); return pfn( pSecurityDescriptor, pOwner, lpbOwnerDefaulted ); } typedef BOOL WINAPI FN_SetSecurityDescriptorGroup( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pGroup, BOOL bGroupDefaulted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSecurityDescriptorGroup( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pGroup, BOOL bGroupDefaulted ) { static FN_SetSecurityDescriptorGroup *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorGroup", &g_Kernel32); return pfn( pSecurityDescriptor, pGroup, bGroupDefaulted ); } typedef BOOL WINAPI FN_GetSecurityDescriptorGroup( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID * pGroup, LPBOOL lpbGroupDefaulted ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSecurityDescriptorGroup( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID * pGroup, LPBOOL lpbGroupDefaulted ) { static FN_GetSecurityDescriptorGroup *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorGroup", &g_Kernel32); return pfn( pSecurityDescriptor, pGroup, lpbGroupDefaulted ); } typedef DWORD WINAPI FN_SetSecurityDescriptorRMControl( PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetSecurityDescriptorRMControl( PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl ) { static FN_SetSecurityDescriptorRMControl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorRMControl", &g_Kernel32); return pfn( SecurityDescriptor, RMControl ); } typedef DWORD WINAPI FN_GetSecurityDescriptorRMControl( PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetSecurityDescriptorRMControl( PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl ) { static FN_GetSecurityDescriptorRMControl *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorRMControl", &g_Kernel32); return pfn( SecurityDescriptor, RMControl ); } typedef BOOL WINAPI FN_CreatePrivateObjectSecurity( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, BOOL IsDirectoryObject, HANDLE Token, PGENERIC_MAPPING GenericMapping ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreatePrivateObjectSecurity( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, BOOL IsDirectoryObject, HANDLE Token, PGENERIC_MAPPING GenericMapping ) { static FN_CreatePrivateObjectSecurity *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreatePrivateObjectSecurity", &g_Kernel32); return pfn( ParentDescriptor, CreatorDescriptor, NewDescriptor, IsDirectoryObject, Token, GenericMapping ); } typedef BOOL WINAPI FN_ConvertToAutoInheritPrivateObjectSecurity( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CurrentSecurityDescriptor, PSECURITY_DESCRIPTOR * NewSecurityDescriptor, GUID * ObjectType, BOOLEAN IsDirectoryObject, PGENERIC_MAPPING GenericMapping ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ConvertToAutoInheritPrivateObjectSecurity( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CurrentSecurityDescriptor, PSECURITY_DESCRIPTOR * NewSecurityDescriptor, GUID * ObjectType, BOOLEAN IsDirectoryObject, PGENERIC_MAPPING GenericMapping ) { static FN_ConvertToAutoInheritPrivateObjectSecurity *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ConvertToAutoInheritPrivateObjectSecurity", &g_Kernel32); return pfn( ParentDescriptor, CurrentSecurityDescriptor, NewSecurityDescriptor, ObjectType, IsDirectoryObject, GenericMapping ); } typedef BOOL WINAPI FN_CreatePrivateObjectSecurityEx( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, GUID * ObjectType, BOOL IsContainerObject, ULONG AutoInheritFlags, HANDLE Token, PGENERIC_MAPPING GenericMapping ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreatePrivateObjectSecurityEx( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, GUID * ObjectType, BOOL IsContainerObject, ULONG AutoInheritFlags, HANDLE Token, PGENERIC_MAPPING GenericMapping ) { static FN_CreatePrivateObjectSecurityEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreatePrivateObjectSecurityEx", &g_Kernel32); return pfn( ParentDescriptor, CreatorDescriptor, NewDescriptor, ObjectType, IsContainerObject, AutoInheritFlags, Token, GenericMapping ); } typedef BOOL WINAPI FN_CreatePrivateObjectSecurityWithMultipleInheritance( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, GUID * *ObjectTypes, ULONG GuidCount, BOOL IsContainerObject, ULONG AutoInheritFlags, HANDLE Token, PGENERIC_MAPPING GenericMapping ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreatePrivateObjectSecurityWithMultipleInheritance( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, GUID * *ObjectTypes, ULONG GuidCount, BOOL IsContainerObject, ULONG AutoInheritFlags, HANDLE Token, PGENERIC_MAPPING GenericMapping ) { static FN_CreatePrivateObjectSecurityWithMultipleInheritance *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreatePrivateObjectSecurityWithMultipleInheritance", &g_Kernel32); return pfn( ParentDescriptor, CreatorDescriptor, NewDescriptor, ObjectTypes, GuidCount, IsContainerObject, AutoInheritFlags, Token, GenericMapping ); } typedef BOOL WINAPI FN_SetPrivateObjectSecurity( SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR * ObjectsSecurityDescriptor, PGENERIC_MAPPING GenericMapping, HANDLE Token ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetPrivateObjectSecurity( SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR * ObjectsSecurityDescriptor, PGENERIC_MAPPING GenericMapping, HANDLE Token ) { static FN_SetPrivateObjectSecurity *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetPrivateObjectSecurity", &g_Kernel32); return pfn( SecurityInformation, ModificationDescriptor, ObjectsSecurityDescriptor, GenericMapping, Token ); } typedef BOOL WINAPI FN_SetPrivateObjectSecurityEx( SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR * ObjectsSecurityDescriptor, ULONG AutoInheritFlags, PGENERIC_MAPPING GenericMapping, HANDLE Token ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetPrivateObjectSecurityEx( SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR * ObjectsSecurityDescriptor, ULONG AutoInheritFlags, PGENERIC_MAPPING GenericMapping, HANDLE Token ) { static FN_SetPrivateObjectSecurityEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetPrivateObjectSecurityEx", &g_Kernel32); return pfn( SecurityInformation, ModificationDescriptor, ObjectsSecurityDescriptor, AutoInheritFlags, GenericMapping, Token ); } typedef BOOL WINAPI FN_GetPrivateObjectSecurity( PSECURITY_DESCRIPTOR ObjectDescriptor, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ResultantDescriptor, DWORD DescriptorLength, PDWORD ReturnLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetPrivateObjectSecurity( PSECURITY_DESCRIPTOR ObjectDescriptor, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ResultantDescriptor, DWORD DescriptorLength, PDWORD ReturnLength ) { static FN_GetPrivateObjectSecurity *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPrivateObjectSecurity", &g_Kernel32); return pfn( ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength ); } typedef BOOL WINAPI FN_DestroyPrivateObjectSecurity( PSECURITY_DESCRIPTOR * ObjectDescriptor ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DestroyPrivateObjectSecurity( PSECURITY_DESCRIPTOR * ObjectDescriptor ) { static FN_DestroyPrivateObjectSecurity *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DestroyPrivateObjectSecurity", &g_Kernel32); return pfn( ObjectDescriptor ); } typedef BOOL WINAPI FN_MakeSelfRelativeSD( PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, LPDWORD lpdwBufferLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MakeSelfRelativeSD( PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, LPDWORD lpdwBufferLength ) { static FN_MakeSelfRelativeSD *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MakeSelfRelativeSD", &g_Kernel32); return pfn( pAbsoluteSecurityDescriptor, pSelfRelativeSecurityDescriptor, lpdwBufferLength ); } typedef BOOL WINAPI FN_MakeAbsoluteSD( PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, LPDWORD lpdwAbsoluteSecurityDescriptorSize, PACL pDacl, LPDWORD lpdwDaclSize, PACL pSacl, LPDWORD lpdwSaclSize, PSID pOwner, LPDWORD lpdwOwnerSize, PSID pPrimaryGroup, LPDWORD lpdwPrimaryGroupSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MakeAbsoluteSD( PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, LPDWORD lpdwAbsoluteSecurityDescriptorSize, PACL pDacl, LPDWORD lpdwDaclSize, PACL pSacl, LPDWORD lpdwSaclSize, PSID pOwner, LPDWORD lpdwOwnerSize, PSID pPrimaryGroup, LPDWORD lpdwPrimaryGroupSize ) { static FN_MakeAbsoluteSD *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MakeAbsoluteSD", &g_Kernel32); return pfn( pSelfRelativeSecurityDescriptor, pAbsoluteSecurityDescriptor, lpdwAbsoluteSecurityDescriptorSize, pDacl, lpdwDaclSize, pSacl, lpdwSaclSize, pOwner, lpdwOwnerSize, pPrimaryGroup, lpdwPrimaryGroupSize ); } typedef BOOL WINAPI FN_MakeAbsoluteSD2( PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, LPDWORD lpdwBufferSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MakeAbsoluteSD2( PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, LPDWORD lpdwBufferSize ) { static FN_MakeAbsoluteSD2 *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MakeAbsoluteSD2", &g_Kernel32); return pfn( pSelfRelativeSecurityDescriptor, lpdwBufferSize ); } typedef BOOL WINAPI FN_SetFileSecurityA( LPCSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileSecurityA( LPCSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ) { static FN_SetFileSecurityA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFileSecurityA", &g_Kernel32); return pfn( lpFileName, SecurityInformation, pSecurityDescriptor ); } typedef BOOL WINAPI FN_SetFileSecurityW( LPCWSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileSecurityW( LPCWSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ) { static FN_SetFileSecurityW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetFileSecurityW", &g_Kernel32); return pfn( lpFileName, SecurityInformation, pSecurityDescriptor ); } typedef BOOL WINAPI FN_GetFileSecurityA( LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileSecurityA( LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ) { static FN_GetFileSecurityA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileSecurityA", &g_Kernel32); return pfn( lpFileName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded ); } typedef BOOL WINAPI FN_GetFileSecurityW( LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileSecurityW( LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ) { static FN_GetFileSecurityW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileSecurityW", &g_Kernel32); return pfn( lpFileName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded ); } typedef BOOL WINAPI FN_SetKernelObjectSecurity( HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetKernelObjectSecurity( HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor ) { static FN_SetKernelObjectSecurity *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetKernelObjectSecurity", &g_Kernel32); return pfn( Handle, SecurityInformation, SecurityDescriptor ); } typedef HANDLE WINAPI FN_FindFirstChangeNotificationA( LPCSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstChangeNotificationA( LPCSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter ) { static FN_FindFirstChangeNotificationA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstChangeNotificationA", &g_Kernel32); return pfn( lpPathName, bWatchSubtree, dwNotifyFilter ); } typedef HANDLE WINAPI FN_FindFirstChangeNotificationW( LPCWSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstChangeNotificationW( LPCWSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter ) { static FN_FindFirstChangeNotificationW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstChangeNotificationW", &g_Kernel32); return pfn( lpPathName, bWatchSubtree, dwNotifyFilter ); } typedef BOOL WINAPI FN_FindNextChangeNotification( HANDLE hChangeHandle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextChangeNotification( HANDLE hChangeHandle ) { static FN_FindNextChangeNotification *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindNextChangeNotification", &g_Kernel32); return pfn( hChangeHandle ); } typedef BOOL WINAPI FN_FindCloseChangeNotification( HANDLE hChangeHandle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindCloseChangeNotification( HANDLE hChangeHandle ) { static FN_FindCloseChangeNotification *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindCloseChangeNotification", &g_Kernel32); return pfn( hChangeHandle ); } typedef BOOL WINAPI FN_ReadDirectoryChangesW( HANDLE hDirectory, LPVOID lpBuffer, DWORD nBufferLength, BOOL bWatchSubtree, DWORD dwNotifyFilter, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadDirectoryChangesW( HANDLE hDirectory, LPVOID lpBuffer, DWORD nBufferLength, BOOL bWatchSubtree, DWORD dwNotifyFilter, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) { static FN_ReadDirectoryChangesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadDirectoryChangesW", &g_Kernel32); return pfn( hDirectory, lpBuffer, nBufferLength, bWatchSubtree, dwNotifyFilter, lpBytesReturned, lpOverlapped, lpCompletionRoutine ); } typedef BOOL WINAPI FN_VirtualLock( LPVOID lpAddress, SIZE_T dwSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualLock( LPVOID lpAddress, SIZE_T dwSize ) { static FN_VirtualLock *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VirtualLock", &g_Kernel32); return pfn( lpAddress, dwSize ); } typedef BOOL WINAPI FN_VirtualUnlock( LPVOID lpAddress, SIZE_T dwSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualUnlock( LPVOID lpAddress, SIZE_T dwSize ) { static FN_VirtualUnlock *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VirtualUnlock", &g_Kernel32); return pfn( lpAddress, dwSize ); } typedef LPVOID WINAPI FN_MapViewOfFileEx( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress ); __declspec(dllexport) LPVOID WINAPI kPrf2Wrap_MapViewOfFileEx( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress ) { static FN_MapViewOfFileEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MapViewOfFileEx", &g_Kernel32); return pfn( hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap, lpBaseAddress ); } typedef BOOL WINAPI FN_SetPriorityClass( HANDLE hProcess, DWORD dwPriorityClass ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetPriorityClass( HANDLE hProcess, DWORD dwPriorityClass ) { static FN_SetPriorityClass *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetPriorityClass", &g_Kernel32); return pfn( hProcess, dwPriorityClass ); } typedef DWORD WINAPI FN_GetPriorityClass( HANDLE hProcess ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPriorityClass( HANDLE hProcess ) { static FN_GetPriorityClass *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetPriorityClass", &g_Kernel32); return pfn( hProcess ); } typedef BOOL WINAPI FN_IsBadReadPtr( CONST VOID * lp, UINT_PTR ucb ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadReadPtr( CONST VOID * lp, UINT_PTR ucb ) { static FN_IsBadReadPtr *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsBadReadPtr", &g_Kernel32); return pfn( lp, ucb ); } typedef BOOL WINAPI FN_IsBadWritePtr( LPVOID lp, UINT_PTR ucb ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadWritePtr( LPVOID lp, UINT_PTR ucb ) { static FN_IsBadWritePtr *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsBadWritePtr", &g_Kernel32); return pfn( lp, ucb ); } typedef BOOL WINAPI FN_IsBadHugeReadPtr( CONST VOID * lp, UINT_PTR ucb ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadHugeReadPtr( CONST VOID * lp, UINT_PTR ucb ) { static FN_IsBadHugeReadPtr *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsBadHugeReadPtr", &g_Kernel32); return pfn( lp, ucb ); } typedef BOOL WINAPI FN_IsBadHugeWritePtr( LPVOID lp, UINT_PTR ucb ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadHugeWritePtr( LPVOID lp, UINT_PTR ucb ) { static FN_IsBadHugeWritePtr *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsBadHugeWritePtr", &g_Kernel32); return pfn( lp, ucb ); } typedef BOOL WINAPI FN_IsBadCodePtr( FARPROC lpfn ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadCodePtr( FARPROC lpfn ) { static FN_IsBadCodePtr *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsBadCodePtr", &g_Kernel32); return pfn( lpfn ); } typedef BOOL WINAPI FN_IsBadStringPtrA( LPCSTR lpsz, UINT_PTR ucchMax ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadStringPtrA( LPCSTR lpsz, UINT_PTR ucchMax ) { static FN_IsBadStringPtrA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsBadStringPtrA", &g_Kernel32); return pfn( lpsz, ucchMax ); } typedef BOOL WINAPI FN_IsBadStringPtrW( LPCWSTR lpsz, UINT_PTR ucchMax ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadStringPtrW( LPCWSTR lpsz, UINT_PTR ucchMax ) { static FN_IsBadStringPtrW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsBadStringPtrW", &g_Kernel32); return pfn( lpsz, ucchMax ); } typedef BOOL WINAPI FN_LookupAccountSidA( LPCSTR lpSystemName, PSID Sid, LPSTR Name, LPDWORD cchName, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupAccountSidA( LPCSTR lpSystemName, PSID Sid, LPSTR Name, LPDWORD cchName, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ) { static FN_LookupAccountSidA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LookupAccountSidA", &g_Kernel32); return pfn( lpSystemName, Sid, Name, cchName, ReferencedDomainName, cchReferencedDomainName, peUse ); } typedef BOOL WINAPI FN_LookupAccountSidW( LPCWSTR lpSystemName, PSID Sid, LPWSTR Name, LPDWORD cchName, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupAccountSidW( LPCWSTR lpSystemName, PSID Sid, LPWSTR Name, LPDWORD cchName, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ) { static FN_LookupAccountSidW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LookupAccountSidW", &g_Kernel32); return pfn( lpSystemName, Sid, Name, cchName, ReferencedDomainName, cchReferencedDomainName, peUse ); } typedef BOOL WINAPI FN_LookupAccountNameA( LPCSTR lpSystemName, LPCSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupAccountNameA( LPCSTR lpSystemName, LPCSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ) { static FN_LookupAccountNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LookupAccountNameA", &g_Kernel32); return pfn( lpSystemName, lpAccountName, Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse ); } typedef BOOL WINAPI FN_LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ) { static FN_LookupAccountNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LookupAccountNameW", &g_Kernel32); return pfn( lpSystemName, lpAccountName, Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse ); } typedef BOOL WINAPI FN_LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid ) { static FN_LookupPrivilegeValueA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeValueA", &g_Kernel32); return pfn( lpSystemName, lpName, lpLuid ); } typedef BOOL WINAPI FN_LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid ) { static FN_LookupPrivilegeValueW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeValueW", &g_Kernel32); return pfn( lpSystemName, lpName, lpLuid ); } typedef BOOL WINAPI FN_LookupPrivilegeNameA( LPCSTR lpSystemName, PLUID lpLuid, LPSTR lpName, LPDWORD cchName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeNameA( LPCSTR lpSystemName, PLUID lpLuid, LPSTR lpName, LPDWORD cchName ) { static FN_LookupPrivilegeNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeNameA", &g_Kernel32); return pfn( lpSystemName, lpLuid, lpName, cchName ); } typedef BOOL WINAPI FN_LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName, LPDWORD cchName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName, LPDWORD cchName ) { static FN_LookupPrivilegeNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeNameW", &g_Kernel32); return pfn( lpSystemName, lpLuid, lpName, cchName ); } typedef BOOL WINAPI FN_LookupPrivilegeDisplayNameA( LPCSTR lpSystemName, LPCSTR lpName, LPSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeDisplayNameA( LPCSTR lpSystemName, LPCSTR lpName, LPSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId ) { static FN_LookupPrivilegeDisplayNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeDisplayNameA", &g_Kernel32); return pfn( lpSystemName, lpName, lpDisplayName, cchDisplayName, lpLanguageId ); } typedef BOOL WINAPI FN_LookupPrivilegeDisplayNameW( LPCWSTR lpSystemName, LPCWSTR lpName, LPWSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeDisplayNameW( LPCWSTR lpSystemName, LPCWSTR lpName, LPWSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId ) { static FN_LookupPrivilegeDisplayNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeDisplayNameW", &g_Kernel32); return pfn( lpSystemName, lpName, lpDisplayName, cchDisplayName, lpLanguageId ); } typedef BOOL WINAPI FN_AllocateLocallyUniqueId( PLUID Luid ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AllocateLocallyUniqueId( PLUID Luid ) { static FN_AllocateLocallyUniqueId *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AllocateLocallyUniqueId", &g_Kernel32); return pfn( Luid ); } typedef BOOL WINAPI FN_BuildCommDCBA( LPCSTR lpDef, LPDCB lpDCB ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_BuildCommDCBA( LPCSTR lpDef, LPDCB lpDCB ) { static FN_BuildCommDCBA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BuildCommDCBA", &g_Kernel32); return pfn( lpDef, lpDCB ); } typedef BOOL WINAPI FN_BuildCommDCBW( LPCWSTR lpDef, LPDCB lpDCB ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_BuildCommDCBW( LPCWSTR lpDef, LPDCB lpDCB ) { static FN_BuildCommDCBW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BuildCommDCBW", &g_Kernel32); return pfn( lpDef, lpDCB ); } typedef BOOL WINAPI FN_BuildCommDCBAndTimeoutsA( LPCSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_BuildCommDCBAndTimeoutsA( LPCSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts ) { static FN_BuildCommDCBAndTimeoutsA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BuildCommDCBAndTimeoutsA", &g_Kernel32); return pfn( lpDef, lpDCB, lpCommTimeouts ); } typedef BOOL WINAPI FN_BuildCommDCBAndTimeoutsW( LPCWSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_BuildCommDCBAndTimeoutsW( LPCWSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts ) { static FN_BuildCommDCBAndTimeoutsW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BuildCommDCBAndTimeoutsW", &g_Kernel32); return pfn( lpDef, lpDCB, lpCommTimeouts ); } typedef BOOL WINAPI FN_CommConfigDialogA( LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CommConfigDialogA( LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC ) { static FN_CommConfigDialogA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CommConfigDialogA", &g_Kernel32); return pfn( lpszName, hWnd, lpCC ); } typedef BOOL WINAPI FN_CommConfigDialogW( LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CommConfigDialogW( LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC ) { static FN_CommConfigDialogW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CommConfigDialogW", &g_Kernel32); return pfn( lpszName, hWnd, lpCC ); } typedef BOOL WINAPI FN_GetDefaultCommConfigA( LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDefaultCommConfigA( LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ) { static FN_GetDefaultCommConfigA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDefaultCommConfigA", &g_Kernel32); return pfn( lpszName, lpCC, lpdwSize ); } typedef BOOL WINAPI FN_GetDefaultCommConfigW( LPCWSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDefaultCommConfigW( LPCWSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ) { static FN_GetDefaultCommConfigW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDefaultCommConfigW", &g_Kernel32); return pfn( lpszName, lpCC, lpdwSize ); } typedef BOOL WINAPI FN_SetDefaultCommConfigA( LPCSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetDefaultCommConfigA( LPCSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize ) { static FN_SetDefaultCommConfigA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetDefaultCommConfigA", &g_Kernel32); return pfn( lpszName, lpCC, dwSize ); } typedef BOOL WINAPI FN_SetDefaultCommConfigW( LPCWSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetDefaultCommConfigW( LPCWSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize ) { static FN_SetDefaultCommConfigW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetDefaultCommConfigW", &g_Kernel32); return pfn( lpszName, lpCC, dwSize ); } typedef BOOL WINAPI FN_GetComputerNameA( LPSTR lpBuffer, LPDWORD nSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetComputerNameA( LPSTR lpBuffer, LPDWORD nSize ) { static FN_GetComputerNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetComputerNameA", &g_Kernel32); return pfn( lpBuffer, nSize ); } typedef BOOL WINAPI FN_GetComputerNameW( LPWSTR lpBuffer, LPDWORD nSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetComputerNameW( LPWSTR lpBuffer, LPDWORD nSize ) { static FN_GetComputerNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetComputerNameW", &g_Kernel32); return pfn( lpBuffer, nSize ); } typedef BOOL WINAPI FN_SetComputerNameA( LPCSTR lpComputerName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetComputerNameA( LPCSTR lpComputerName ) { static FN_SetComputerNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetComputerNameA", &g_Kernel32); return pfn( lpComputerName ); } typedef BOOL WINAPI FN_SetComputerNameW( LPCWSTR lpComputerName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetComputerNameW( LPCWSTR lpComputerName ) { static FN_SetComputerNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetComputerNameW", &g_Kernel32); return pfn( lpComputerName ); } typedef BOOL WINAPI FN_GetComputerNameExA( COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD nSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetComputerNameExA( COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD nSize ) { static FN_GetComputerNameExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetComputerNameExA", &g_Kernel32); return pfn( NameType, lpBuffer, nSize ); } typedef BOOL WINAPI FN_GetComputerNameExW( COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetComputerNameExW( COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize ) { static FN_GetComputerNameExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetComputerNameExW", &g_Kernel32); return pfn( NameType, lpBuffer, nSize ); } typedef BOOL WINAPI FN_SetComputerNameExA( COMPUTER_NAME_FORMAT NameType, LPCSTR lpBuffer ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetComputerNameExA( COMPUTER_NAME_FORMAT NameType, LPCSTR lpBuffer ) { static FN_SetComputerNameExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetComputerNameExA", &g_Kernel32); return pfn( NameType, lpBuffer ); } typedef BOOL WINAPI FN_SetComputerNameExW( COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetComputerNameExW( COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer ) { static FN_SetComputerNameExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetComputerNameExW", &g_Kernel32); return pfn( NameType, lpBuffer ); } typedef BOOL WINAPI FN_DnsHostnameToComputerNameA( LPCSTR Hostname, LPSTR ComputerName, LPDWORD nSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DnsHostnameToComputerNameA( LPCSTR Hostname, LPSTR ComputerName, LPDWORD nSize ) { static FN_DnsHostnameToComputerNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DnsHostnameToComputerNameA", &g_Kernel32); return pfn( Hostname, ComputerName, nSize ); } typedef BOOL WINAPI FN_DnsHostnameToComputerNameW( LPCWSTR Hostname, LPWSTR ComputerName, LPDWORD nSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DnsHostnameToComputerNameW( LPCWSTR Hostname, LPWSTR ComputerName, LPDWORD nSize ) { static FN_DnsHostnameToComputerNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DnsHostnameToComputerNameW", &g_Kernel32); return pfn( Hostname, ComputerName, nSize ); } typedef BOOL WINAPI FN_GetUserNameA( LPSTR lpBuffer, LPDWORD pcbBuffer ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetUserNameA( LPSTR lpBuffer, LPDWORD pcbBuffer ) { static FN_GetUserNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetUserNameA", &g_Kernel32); return pfn( lpBuffer, pcbBuffer ); } typedef BOOL WINAPI FN_GetUserNameW( LPWSTR lpBuffer, LPDWORD pcbBuffer ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetUserNameW( LPWSTR lpBuffer, LPDWORD pcbBuffer ) { static FN_GetUserNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetUserNameW", &g_Kernel32); return pfn( lpBuffer, pcbBuffer ); } typedef BOOL WINAPI FN_LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ) { static FN_LogonUserA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LogonUserA", &g_Kernel32); return pfn( lpszUsername, lpszDomain, lpszPassword, dwLogonType, dwLogonProvider, phToken ); } typedef BOOL WINAPI FN_LogonUserW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LogonUserW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ) { static FN_LogonUserW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LogonUserW", &g_Kernel32); return pfn( lpszUsername, lpszDomain, lpszPassword, dwLogonType, dwLogonProvider, phToken ); } typedef BOOL WINAPI FN_LogonUserExA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID * ppLogonSid, PVOID * ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LogonUserExA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID * ppLogonSid, PVOID * ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits ) { static FN_LogonUserExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LogonUserExA", &g_Kernel32); return pfn( lpszUsername, lpszDomain, lpszPassword, dwLogonType, dwLogonProvider, phToken, ppLogonSid, ppProfileBuffer, pdwProfileLength, pQuotaLimits ); } typedef BOOL WINAPI FN_LogonUserExW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID * ppLogonSid, PVOID * ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_LogonUserExW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID * ppLogonSid, PVOID * ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits ) { static FN_LogonUserExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LogonUserExW", &g_Kernel32); return pfn( lpszUsername, lpszDomain, lpszPassword, dwLogonType, dwLogonProvider, phToken, ppLogonSid, ppProfileBuffer, pdwProfileLength, pQuotaLimits ); } typedef BOOL WINAPI FN_ImpersonateLoggedOnUser( HANDLE hToken ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ImpersonateLoggedOnUser( HANDLE hToken ) { static FN_ImpersonateLoggedOnUser *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ImpersonateLoggedOnUser", &g_Kernel32); return pfn( hToken ); } typedef BOOL WINAPI FN_CreateProcessAsUserA( HANDLE hToken, LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessAsUserA( HANDLE hToken, LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) { static FN_CreateProcessAsUserA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateProcessAsUserA", &g_Kernel32); return pfn( hToken, lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); } typedef BOOL WINAPI FN_CreateProcessAsUserW( HANDLE hToken, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessAsUserW( HANDLE hToken, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) { static FN_CreateProcessAsUserW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateProcessAsUserW", &g_Kernel32); return pfn( hToken, lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); } typedef BOOL WINAPI FN_CreateProcessWithLogonW( LPCWSTR lpUsername, LPCWSTR lpDomain, LPCWSTR lpPassword, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessWithLogonW( LPCWSTR lpUsername, LPCWSTR lpDomain, LPCWSTR lpPassword, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) { static FN_CreateProcessWithLogonW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateProcessWithLogonW", &g_Kernel32); return pfn( lpUsername, lpDomain, lpPassword, dwLogonFlags, lpApplicationName, lpCommandLine, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); } typedef BOOL WINAPI FN_CreateProcessWithTokenW( HANDLE hToken, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessWithTokenW( HANDLE hToken, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) { static FN_CreateProcessWithTokenW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateProcessWithTokenW", &g_Kernel32); return pfn( hToken, dwLogonFlags, lpApplicationName, lpCommandLine, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); } typedef BOOL APIENTRY FN_ImpersonateAnonymousToken( HANDLE ThreadHandle ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_ImpersonateAnonymousToken( HANDLE ThreadHandle ) { static FN_ImpersonateAnonymousToken *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ImpersonateAnonymousToken", &g_Kernel32); return pfn( ThreadHandle ); } typedef BOOL WINAPI FN_DuplicateTokenEx( HANDLE hExistingToken, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, PHANDLE phNewToken ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DuplicateTokenEx( HANDLE hExistingToken, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, PHANDLE phNewToken ) { static FN_DuplicateTokenEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DuplicateTokenEx", &g_Kernel32); return pfn( hExistingToken, dwDesiredAccess, lpTokenAttributes, ImpersonationLevel, TokenType, phNewToken ); } typedef BOOL APIENTRY FN_CreateRestrictedToken( HANDLE ExistingTokenHandle, DWORD Flags, DWORD DisableSidCount, PSID_AND_ATTRIBUTES SidsToDisable, DWORD DeletePrivilegeCount, PLUID_AND_ATTRIBUTES PrivilegesToDelete, DWORD RestrictedSidCount, PSID_AND_ATTRIBUTES SidsToRestrict, PHANDLE NewTokenHandle ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_CreateRestrictedToken( HANDLE ExistingTokenHandle, DWORD Flags, DWORD DisableSidCount, PSID_AND_ATTRIBUTES SidsToDisable, DWORD DeletePrivilegeCount, PLUID_AND_ATTRIBUTES PrivilegesToDelete, DWORD RestrictedSidCount, PSID_AND_ATTRIBUTES SidsToRestrict, PHANDLE NewTokenHandle ) { static FN_CreateRestrictedToken *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateRestrictedToken", &g_Kernel32); return pfn( ExistingTokenHandle, Flags, DisableSidCount, SidsToDisable, DeletePrivilegeCount, PrivilegesToDelete, RestrictedSidCount, SidsToRestrict, NewTokenHandle ); } typedef BOOL WINAPI FN_IsTokenRestricted( HANDLE TokenHandle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsTokenRestricted( HANDLE TokenHandle ) { static FN_IsTokenRestricted *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsTokenRestricted", &g_Kernel32); return pfn( TokenHandle ); } typedef BOOL WINAPI FN_IsTokenUntrusted( HANDLE TokenHandle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsTokenUntrusted( HANDLE TokenHandle ) { static FN_IsTokenUntrusted *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsTokenUntrusted", &g_Kernel32); return pfn( TokenHandle ); } typedef BOOL APIENTRY FN_CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember ) { static FN_CheckTokenMembership *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CheckTokenMembership", &g_Kernel32); return pfn( TokenHandle, SidToCheck, IsMember ); } typedef BOOL WINAPI FN_RegisterWaitForSingleObject( PHANDLE phNewWaitObject, HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_RegisterWaitForSingleObject( PHANDLE phNewWaitObject, HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags ) { static FN_RegisterWaitForSingleObject *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RegisterWaitForSingleObject", &g_Kernel32); return pfn( phNewWaitObject, hObject, Callback, Context, dwMilliseconds, dwFlags ); } typedef HANDLE WINAPI FN_RegisterWaitForSingleObjectEx( HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_RegisterWaitForSingleObjectEx( HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags ) { static FN_RegisterWaitForSingleObjectEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RegisterWaitForSingleObjectEx", &g_Kernel32); return pfn( hObject, Callback, Context, dwMilliseconds, dwFlags ); } typedef BOOL WINAPI FN_UnregisterWait( HANDLE WaitHandle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_UnregisterWait( HANDLE WaitHandle ) { static FN_UnregisterWait *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "UnregisterWait", &g_Kernel32); return pfn( WaitHandle ); } typedef BOOL WINAPI FN_UnregisterWaitEx( HANDLE WaitHandle, HANDLE CompletionEvent ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_UnregisterWaitEx( HANDLE WaitHandle, HANDLE CompletionEvent ) { static FN_UnregisterWaitEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "UnregisterWaitEx", &g_Kernel32); return pfn( WaitHandle, CompletionEvent ); } typedef BOOL WINAPI FN_QueueUserWorkItem( LPTHREAD_START_ROUTINE Function, PVOID Context, ULONG Flags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueueUserWorkItem( LPTHREAD_START_ROUTINE Function, PVOID Context, ULONG Flags ) { static FN_QueueUserWorkItem *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "QueueUserWorkItem", &g_Kernel32); return pfn( Function, Context, Flags ); } typedef BOOL WINAPI FN_BindIoCompletionCallback( HANDLE FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function, ULONG Flags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_BindIoCompletionCallback( HANDLE FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function, ULONG Flags ) { static FN_BindIoCompletionCallback *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "BindIoCompletionCallback", &g_Kernel32); return pfn( FileHandle, Function, Flags ); } typedef HANDLE WINAPI FN_CreateTimerQueue( VOID ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateTimerQueue( VOID ) { static FN_CreateTimerQueue *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateTimerQueue", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_CreateTimerQueueTimer( PHANDLE phNewTimer, HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, ULONG Flags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateTimerQueueTimer( PHANDLE phNewTimer, HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, ULONG Flags ) { static FN_CreateTimerQueueTimer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateTimerQueueTimer", &g_Kernel32); return pfn( phNewTimer, TimerQueue, Callback, Parameter, DueTime, Period, Flags ); } typedef BOOL WINAPI FN_ChangeTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer, ULONG DueTime, ULONG Period ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ChangeTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer, ULONG DueTime, ULONG Period ) { static FN_ChangeTimerQueueTimer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ChangeTimerQueueTimer", &g_Kernel32); return pfn( TimerQueue, Timer, DueTime, Period ); } typedef BOOL WINAPI FN_DeleteTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer, HANDLE CompletionEvent ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer, HANDLE CompletionEvent ) { static FN_DeleteTimerQueueTimer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteTimerQueueTimer", &g_Kernel32); return pfn( TimerQueue, Timer, CompletionEvent ); } typedef BOOL WINAPI FN_DeleteTimerQueueEx( HANDLE TimerQueue, HANDLE CompletionEvent ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteTimerQueueEx( HANDLE TimerQueue, HANDLE CompletionEvent ) { static FN_DeleteTimerQueueEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteTimerQueueEx", &g_Kernel32); return pfn( TimerQueue, CompletionEvent ); } typedef HANDLE WINAPI FN_SetTimerQueueTimer( HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, BOOL PreferIo ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_SetTimerQueueTimer( HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, BOOL PreferIo ) { static FN_SetTimerQueueTimer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetTimerQueueTimer", &g_Kernel32); return pfn( TimerQueue, Callback, Parameter, DueTime, Period, PreferIo ); } typedef BOOL WINAPI FN_CancelTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CancelTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer ) { static FN_CancelTimerQueueTimer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CancelTimerQueueTimer", &g_Kernel32); return pfn( TimerQueue, Timer ); } typedef BOOL WINAPI FN_DeleteTimerQueue( HANDLE TimerQueue ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteTimerQueue( HANDLE TimerQueue ) { static FN_DeleteTimerQueue *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteTimerQueue", &g_Kernel32); return pfn( TimerQueue ); } typedef BOOL WINAPI FN_GetCurrentHwProfileA( LPHW_PROFILE_INFOA lpHwProfileInfo ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCurrentHwProfileA( LPHW_PROFILE_INFOA lpHwProfileInfo ) { static FN_GetCurrentHwProfileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentHwProfileA", &g_Kernel32); return pfn( lpHwProfileInfo ); } typedef BOOL WINAPI FN_GetCurrentHwProfileW( LPHW_PROFILE_INFOW lpHwProfileInfo ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCurrentHwProfileW( LPHW_PROFILE_INFOW lpHwProfileInfo ) { static FN_GetCurrentHwProfileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentHwProfileW", &g_Kernel32); return pfn( lpHwProfileInfo ); } typedef BOOL WINAPI FN_QueryPerformanceCounter( LARGE_INTEGER * lpPerformanceCount ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueryPerformanceCounter( LARGE_INTEGER * lpPerformanceCount ) { static FN_QueryPerformanceCounter *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "QueryPerformanceCounter", &g_Kernel32); return pfn( lpPerformanceCount ); } typedef BOOL WINAPI FN_QueryPerformanceFrequency( LARGE_INTEGER * lpFrequency ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueryPerformanceFrequency( LARGE_INTEGER * lpFrequency ) { static FN_QueryPerformanceFrequency *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "QueryPerformanceFrequency", &g_Kernel32); return pfn( lpFrequency ); } typedef BOOL WINAPI FN_GetVersionExA( LPOSVERSIONINFOA lpVersionInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVersionExA( LPOSVERSIONINFOA lpVersionInformation ) { static FN_GetVersionExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVersionExA", &g_Kernel32); return pfn( lpVersionInformation ); } typedef BOOL WINAPI FN_GetVersionExW( LPOSVERSIONINFOW lpVersionInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVersionExW( LPOSVERSIONINFOW lpVersionInformation ) { static FN_GetVersionExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVersionExW", &g_Kernel32); return pfn( lpVersionInformation ); } typedef BOOL WINAPI FN_VerifyVersionInfoA( LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_VerifyVersionInfoA( LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask ) { static FN_VerifyVersionInfoA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerifyVersionInfoA", &g_Kernel32); return pfn( lpVersionInformation, dwTypeMask, dwlConditionMask ); } typedef BOOL WINAPI FN_VerifyVersionInfoW( LPOSVERSIONINFOEXW lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_VerifyVersionInfoW( LPOSVERSIONINFOEXW lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask ) { static FN_VerifyVersionInfoW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerifyVersionInfoW", &g_Kernel32); return pfn( lpVersionInformation, dwTypeMask, dwlConditionMask ); } typedef BOOL WINAPI FN_GetSystemPowerStatus( LPSYSTEM_POWER_STATUS lpSystemPowerStatus ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSystemPowerStatus( LPSYSTEM_POWER_STATUS lpSystemPowerStatus ) { static FN_GetSystemPowerStatus *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemPowerStatus", &g_Kernel32); return pfn( lpSystemPowerStatus ); } typedef BOOL WINAPI FN_SetSystemPowerState( BOOL fSuspend, BOOL fForce ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSystemPowerState( BOOL fSuspend, BOOL fForce ) { static FN_SetSystemPowerState *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetSystemPowerState", &g_Kernel32); return pfn( fSuspend, fForce ); } typedef BOOL WINAPI FN_AllocateUserPhysicalPages( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AllocateUserPhysicalPages( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray ) { static FN_AllocateUserPhysicalPages *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AllocateUserPhysicalPages", &g_Kernel32); return pfn( hProcess, NumberOfPages, PageArray ); } typedef BOOL WINAPI FN_FreeUserPhysicalPages( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeUserPhysicalPages( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray ) { static FN_FreeUserPhysicalPages *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FreeUserPhysicalPages", &g_Kernel32); return pfn( hProcess, NumberOfPages, PageArray ); } typedef BOOL WINAPI FN_MapUserPhysicalPages( PVOID VirtualAddress, ULONG_PTR NumberOfPages, PULONG_PTR PageArray ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MapUserPhysicalPages( PVOID VirtualAddress, ULONG_PTR NumberOfPages, PULONG_PTR PageArray ) { static FN_MapUserPhysicalPages *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MapUserPhysicalPages", &g_Kernel32); return pfn( VirtualAddress, NumberOfPages, PageArray ); } typedef BOOL WINAPI FN_MapUserPhysicalPagesScatter( PVOID * VirtualAddresses, ULONG_PTR NumberOfPages, PULONG_PTR PageArray ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_MapUserPhysicalPagesScatter( PVOID * VirtualAddresses, ULONG_PTR NumberOfPages, PULONG_PTR PageArray ) { static FN_MapUserPhysicalPagesScatter *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MapUserPhysicalPagesScatter", &g_Kernel32); return pfn( VirtualAddresses, NumberOfPages, PageArray ); } typedef HANDLE WINAPI FN_CreateJobObjectA( LPSECURITY_ATTRIBUTES lpJobAttributes, LPCSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateJobObjectA( LPSECURITY_ATTRIBUTES lpJobAttributes, LPCSTR lpName ) { static FN_CreateJobObjectA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateJobObjectA", &g_Kernel32); return pfn( lpJobAttributes, lpName ); } typedef HANDLE WINAPI FN_CreateJobObjectW( LPSECURITY_ATTRIBUTES lpJobAttributes, LPCWSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateJobObjectW( LPSECURITY_ATTRIBUTES lpJobAttributes, LPCWSTR lpName ) { static FN_CreateJobObjectW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateJobObjectW", &g_Kernel32); return pfn( lpJobAttributes, lpName ); } typedef HANDLE WINAPI FN_OpenJobObjectA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenJobObjectA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ) { static FN_OpenJobObjectA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenJobObjectA", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpName ); } typedef HANDLE WINAPI FN_OpenJobObjectW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenJobObjectW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ) { static FN_OpenJobObjectW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "OpenJobObjectW", &g_Kernel32); return pfn( dwDesiredAccess, bInheritHandle, lpName ); } typedef BOOL WINAPI FN_AssignProcessToJobObject( HANDLE hJob, HANDLE hProcess ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AssignProcessToJobObject( HANDLE hJob, HANDLE hProcess ) { static FN_AssignProcessToJobObject *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AssignProcessToJobObject", &g_Kernel32); return pfn( hJob, hProcess ); } typedef BOOL WINAPI FN_TerminateJobObject( HANDLE hJob, UINT uExitCode ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_TerminateJobObject( HANDLE hJob, UINT uExitCode ) { static FN_TerminateJobObject *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "TerminateJobObject", &g_Kernel32); return pfn( hJob, uExitCode ); } typedef BOOL WINAPI FN_QueryInformationJobObject( HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength, LPDWORD lpReturnLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueryInformationJobObject( HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength, LPDWORD lpReturnLength ) { static FN_QueryInformationJobObject *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "QueryInformationJobObject", &g_Kernel32); return pfn( hJob, JobObjectInformationClass, lpJobObjectInformation, cbJobObjectInformationLength, lpReturnLength ); } typedef BOOL WINAPI FN_SetInformationJobObject( HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetInformationJobObject( HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength ) { static FN_SetInformationJobObject *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetInformationJobObject", &g_Kernel32); return pfn( hJob, JobObjectInformationClass, lpJobObjectInformation, cbJobObjectInformationLength ); } typedef BOOL WINAPI FN_IsProcessInJob( HANDLE ProcessHandle, HANDLE JobHandle, PBOOL Result ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsProcessInJob( HANDLE ProcessHandle, HANDLE JobHandle, PBOOL Result ) { static FN_IsProcessInJob *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsProcessInJob", &g_Kernel32); return pfn( ProcessHandle, JobHandle, Result ); } typedef BOOL WINAPI FN_CreateJobSet( ULONG NumJob, PJOB_SET_ARRAY UserJobSet, ULONG Flags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateJobSet( ULONG NumJob, PJOB_SET_ARRAY UserJobSet, ULONG Flags ) { static FN_CreateJobSet *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateJobSet", &g_Kernel32); return pfn( NumJob, UserJobSet, Flags ); } typedef PVOID WINAPI FN_AddVectoredExceptionHandler( ULONG First, PVECTORED_EXCEPTION_HANDLER Handler ); __declspec(dllexport) PVOID WINAPI kPrf2Wrap_AddVectoredExceptionHandler( ULONG First, PVECTORED_EXCEPTION_HANDLER Handler ) { static FN_AddVectoredExceptionHandler *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddVectoredExceptionHandler", &g_Kernel32); return pfn( First, Handler ); } typedef ULONG WINAPI FN_RemoveVectoredExceptionHandler( PVOID Handle ); __declspec(dllexport) ULONG WINAPI kPrf2Wrap_RemoveVectoredExceptionHandler( PVOID Handle ) { static FN_RemoveVectoredExceptionHandler *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RemoveVectoredExceptionHandler", &g_Kernel32); return pfn( Handle ); } typedef PVOID WINAPI FN_AddVectoredContinueHandler( ULONG First, PVECTORED_EXCEPTION_HANDLER Handler ); __declspec(dllexport) PVOID WINAPI kPrf2Wrap_AddVectoredContinueHandler( ULONG First, PVECTORED_EXCEPTION_HANDLER Handler ) { static FN_AddVectoredContinueHandler *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddVectoredContinueHandler", &g_Kernel32); return pfn( First, Handler ); } typedef ULONG WINAPI FN_RemoveVectoredContinueHandler( PVOID Handle ); __declspec(dllexport) ULONG WINAPI kPrf2Wrap_RemoveVectoredContinueHandler( PVOID Handle ) { static FN_RemoveVectoredContinueHandler *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RemoveVectoredContinueHandler", &g_Kernel32); return pfn( Handle ); } typedef HANDLE WINAPI FN_FindFirstVolumeA( LPSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstVolumeA( LPSTR lpszVolumeName, DWORD cchBufferLength ) { static FN_FindFirstVolumeA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstVolumeA", &g_Kernel32); return pfn( lpszVolumeName, cchBufferLength ); } typedef HANDLE WINAPI FN_FindFirstVolumeW( LPWSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstVolumeW( LPWSTR lpszVolumeName, DWORD cchBufferLength ) { static FN_FindFirstVolumeW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstVolumeW", &g_Kernel32); return pfn( lpszVolumeName, cchBufferLength ); } typedef BOOL WINAPI FN_FindNextVolumeA( HANDLE hFindVolume, LPSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextVolumeA( HANDLE hFindVolume, LPSTR lpszVolumeName, DWORD cchBufferLength ) { static FN_FindNextVolumeA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindNextVolumeA", &g_Kernel32); return pfn( hFindVolume, lpszVolumeName, cchBufferLength ); } typedef BOOL WINAPI FN_FindNextVolumeW( HANDLE hFindVolume, LPWSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextVolumeW( HANDLE hFindVolume, LPWSTR lpszVolumeName, DWORD cchBufferLength ) { static FN_FindNextVolumeW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindNextVolumeW", &g_Kernel32); return pfn( hFindVolume, lpszVolumeName, cchBufferLength ); } typedef BOOL WINAPI FN_FindVolumeClose( HANDLE hFindVolume ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindVolumeClose( HANDLE hFindVolume ) { static FN_FindVolumeClose *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindVolumeClose", &g_Kernel32); return pfn( hFindVolume ); } typedef HANDLE WINAPI FN_FindFirstVolumeMountPointA( LPCSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstVolumeMountPointA( LPCSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ) { static FN_FindFirstVolumeMountPointA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstVolumeMountPointA", &g_Kernel32); return pfn( lpszRootPathName, lpszVolumeMountPoint, cchBufferLength ); } typedef HANDLE WINAPI FN_FindFirstVolumeMountPointW( LPCWSTR lpszRootPathName, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstVolumeMountPointW( LPCWSTR lpszRootPathName, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ) { static FN_FindFirstVolumeMountPointW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindFirstVolumeMountPointW", &g_Kernel32); return pfn( lpszRootPathName, lpszVolumeMountPoint, cchBufferLength ); } typedef BOOL WINAPI FN_FindNextVolumeMountPointA( HANDLE hFindVolumeMountPoint, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextVolumeMountPointA( HANDLE hFindVolumeMountPoint, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ) { static FN_FindNextVolumeMountPointA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindNextVolumeMountPointA", &g_Kernel32); return pfn( hFindVolumeMountPoint, lpszVolumeMountPoint, cchBufferLength ); } typedef BOOL WINAPI FN_FindNextVolumeMountPointW( HANDLE hFindVolumeMountPoint, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextVolumeMountPointW( HANDLE hFindVolumeMountPoint, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ) { static FN_FindNextVolumeMountPointW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindNextVolumeMountPointW", &g_Kernel32); return pfn( hFindVolumeMountPoint, lpszVolumeMountPoint, cchBufferLength ); } typedef BOOL WINAPI FN_FindVolumeMountPointClose( HANDLE hFindVolumeMountPoint ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindVolumeMountPointClose( HANDLE hFindVolumeMountPoint ) { static FN_FindVolumeMountPointClose *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindVolumeMountPointClose", &g_Kernel32); return pfn( hFindVolumeMountPoint ); } typedef BOOL WINAPI FN_SetVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPCSTR lpszVolumeName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPCSTR lpszVolumeName ) { static FN_SetVolumeMountPointA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetVolumeMountPointA", &g_Kernel32); return pfn( lpszVolumeMountPoint, lpszVolumeName ); } typedef BOOL WINAPI FN_SetVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPCWSTR lpszVolumeName ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPCWSTR lpszVolumeName ) { static FN_SetVolumeMountPointW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetVolumeMountPointW", &g_Kernel32); return pfn( lpszVolumeMountPoint, lpszVolumeName ); } typedef BOOL WINAPI FN_DeleteVolumeMountPointA( LPCSTR lpszVolumeMountPoint ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteVolumeMountPointA( LPCSTR lpszVolumeMountPoint ) { static FN_DeleteVolumeMountPointA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteVolumeMountPointA", &g_Kernel32); return pfn( lpszVolumeMountPoint ); } typedef BOOL WINAPI FN_DeleteVolumeMountPointW( LPCWSTR lpszVolumeMountPoint ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteVolumeMountPointW( LPCWSTR lpszVolumeMountPoint ) { static FN_DeleteVolumeMountPointW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeleteVolumeMountPointW", &g_Kernel32); return pfn( lpszVolumeMountPoint ); } typedef BOOL WINAPI FN_GetVolumeNameForVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumeNameForVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPSTR lpszVolumeName, DWORD cchBufferLength ) { static FN_GetVolumeNameForVolumeMountPointA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVolumeNameForVolumeMountPointA", &g_Kernel32); return pfn( lpszVolumeMountPoint, lpszVolumeName, cchBufferLength ); } typedef BOOL WINAPI FN_GetVolumeNameForVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPWSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumeNameForVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPWSTR lpszVolumeName, DWORD cchBufferLength ) { static FN_GetVolumeNameForVolumeMountPointW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVolumeNameForVolumeMountPointW", &g_Kernel32); return pfn( lpszVolumeMountPoint, lpszVolumeName, cchBufferLength ); } typedef BOOL WINAPI FN_GetVolumePathNameA( LPCSTR lpszFileName, LPSTR lpszVolumePathName, DWORD cchBufferLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumePathNameA( LPCSTR lpszFileName, LPSTR lpszVolumePathName, DWORD cchBufferLength ) { static FN_GetVolumePathNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVolumePathNameA", &g_Kernel32); return pfn( lpszFileName, lpszVolumePathName, cchBufferLength ); } typedef BOOL WINAPI FN_GetVolumePathNameW( LPCWSTR lpszFileName, LPWSTR lpszVolumePathName, DWORD cchBufferLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumePathNameW( LPCWSTR lpszFileName, LPWSTR lpszVolumePathName, DWORD cchBufferLength ) { static FN_GetVolumePathNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVolumePathNameW", &g_Kernel32); return pfn( lpszFileName, lpszVolumePathName, cchBufferLength ); } typedef BOOL WINAPI FN_GetVolumePathNamesForVolumeNameA( LPCSTR lpszVolumeName, LPCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumePathNamesForVolumeNameA( LPCSTR lpszVolumeName, LPCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength ) { static FN_GetVolumePathNamesForVolumeNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVolumePathNamesForVolumeNameA", &g_Kernel32); return pfn( lpszVolumeName, lpszVolumePathNames, cchBufferLength, lpcchReturnLength ); } typedef BOOL WINAPI FN_GetVolumePathNamesForVolumeNameW( LPCWSTR lpszVolumeName, LPWCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumePathNamesForVolumeNameW( LPCWSTR lpszVolumeName, LPWCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength ) { static FN_GetVolumePathNamesForVolumeNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetVolumePathNamesForVolumeNameW", &g_Kernel32); return pfn( lpszVolumeName, lpszVolumePathNames, cchBufferLength, lpcchReturnLength ); } typedef HANDLE WINAPI FN_CreateActCtxA( PCACTCTXA pActCtx ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateActCtxA( PCACTCTXA pActCtx ) { static FN_CreateActCtxA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateActCtxA", &g_Kernel32); return pfn( pActCtx ); } typedef HANDLE WINAPI FN_CreateActCtxW( PCACTCTXW pActCtx ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateActCtxW( PCACTCTXW pActCtx ) { static FN_CreateActCtxW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateActCtxW", &g_Kernel32); return pfn( pActCtx ); } typedef VOID WINAPI FN_AddRefActCtx( HANDLE hActCtx ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_AddRefActCtx( HANDLE hActCtx ) { static FN_AddRefActCtx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddRefActCtx", &g_Kernel32); pfn( hActCtx ); } typedef VOID WINAPI FN_ReleaseActCtx( HANDLE hActCtx ); __declspec(dllexport) VOID WINAPI kPrf2Wrap_ReleaseActCtx( HANDLE hActCtx ) { static FN_ReleaseActCtx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReleaseActCtx", &g_Kernel32); pfn( hActCtx ); } typedef BOOL WINAPI FN_ZombifyActCtx( HANDLE hActCtx ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ZombifyActCtx( HANDLE hActCtx ) { static FN_ZombifyActCtx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ZombifyActCtx", &g_Kernel32); return pfn( hActCtx ); } typedef BOOL WINAPI FN_ActivateActCtx( HANDLE hActCtx, ULONG_PTR * lpCookie ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ActivateActCtx( HANDLE hActCtx, ULONG_PTR * lpCookie ) { static FN_ActivateActCtx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ActivateActCtx", &g_Kernel32); return pfn( hActCtx, lpCookie ); } typedef BOOL WINAPI FN_DeactivateActCtx( DWORD dwFlags, ULONG_PTR ulCookie ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeactivateActCtx( DWORD dwFlags, ULONG_PTR ulCookie ) { static FN_DeactivateActCtx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "DeactivateActCtx", &g_Kernel32); return pfn( dwFlags, ulCookie ); } typedef BOOL WINAPI FN_GetCurrentActCtx( HANDLE * lphActCtx ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCurrentActCtx( HANDLE * lphActCtx ) { static FN_GetCurrentActCtx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentActCtx", &g_Kernel32); return pfn( lphActCtx ); } typedef BOOL WINAPI FN_FindActCtxSectionStringA( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, LPCSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindActCtxSectionStringA( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, LPCSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ) { static FN_FindActCtxSectionStringA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindActCtxSectionStringA", &g_Kernel32); return pfn( dwFlags, lpExtensionGuid, ulSectionId, lpStringToFind, ReturnedData ); } typedef BOOL WINAPI FN_FindActCtxSectionStringW( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, LPCWSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindActCtxSectionStringW( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, LPCWSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ) { static FN_FindActCtxSectionStringW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindActCtxSectionStringW", &g_Kernel32); return pfn( dwFlags, lpExtensionGuid, ulSectionId, lpStringToFind, ReturnedData ); } typedef BOOL WINAPI FN_FindActCtxSectionGuid( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, const GUID * lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindActCtxSectionGuid( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, const GUID * lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ) { static FN_FindActCtxSectionGuid *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FindActCtxSectionGuid", &g_Kernel32); return pfn( dwFlags, lpExtensionGuid, ulSectionId, lpGuidToFind, ReturnedData ); } typedef BOOL WINAPI FN_QueryActCtxW( DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInstance, ULONG ulInfoClass, PVOID pvBuffer, SIZE_T cbBuffer, SIZE_T * pcbWrittenOrRequired ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueryActCtxW( DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInstance, ULONG ulInfoClass, PVOID pvBuffer, SIZE_T cbBuffer, SIZE_T * pcbWrittenOrRequired ) { static FN_QueryActCtxW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "QueryActCtxW", &g_Kernel32); return pfn( dwFlags, hActCtx, pvSubInstance, ulInfoClass, pvBuffer, cbBuffer, pcbWrittenOrRequired ); } typedef BOOL WINAPI FN_ProcessIdToSessionId( DWORD dwProcessId, DWORD * pSessionId ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ProcessIdToSessionId( DWORD dwProcessId, DWORD * pSessionId ) { static FN_ProcessIdToSessionId *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ProcessIdToSessionId", &g_Kernel32); return pfn( dwProcessId, pSessionId ); } typedef DWORD WINAPI FN_WTSGetActiveConsoleSessionId( ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_WTSGetActiveConsoleSessionId( ) { static FN_WTSGetActiveConsoleSessionId *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WTSGetActiveConsoleSessionId", &g_Kernel32); return pfn( ); } typedef BOOL WINAPI FN_IsWow64Process( HANDLE hProcess, PBOOL Wow64Process ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsWow64Process( HANDLE hProcess, PBOOL Wow64Process ) { static FN_IsWow64Process *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsWow64Process", &g_Kernel32); return pfn( hProcess, Wow64Process ); } typedef BOOL WINAPI FN_GetLogicalProcessorInformation( PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, PDWORD ReturnedLength ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetLogicalProcessorInformation( PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, PDWORD ReturnedLength ) { static FN_GetLogicalProcessorInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLogicalProcessorInformation", &g_Kernel32); return pfn( Buffer, ReturnedLength ); } typedef BOOL WINAPI FN_GetNumaHighestNodeNumber( PULONG HighestNodeNumber ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumaHighestNodeNumber( PULONG HighestNodeNumber ) { static FN_GetNumaHighestNodeNumber *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNumaHighestNodeNumber", &g_Kernel32); return pfn( HighestNodeNumber ); } typedef BOOL WINAPI FN_GetNumaProcessorNode( UCHAR Processor, PUCHAR NodeNumber ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumaProcessorNode( UCHAR Processor, PUCHAR NodeNumber ) { static FN_GetNumaProcessorNode *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNumaProcessorNode", &g_Kernel32); return pfn( Processor, NodeNumber ); } typedef BOOL WINAPI FN_GetNumaNodeProcessorMask( UCHAR Node, PULONGLONG ProcessorMask ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumaNodeProcessorMask( UCHAR Node, PULONGLONG ProcessorMask ) { static FN_GetNumaNodeProcessorMask *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNumaNodeProcessorMask", &g_Kernel32); return pfn( Node, ProcessorMask ); } typedef BOOL WINAPI FN_GetNumaAvailableMemoryNode( UCHAR Node, PULONGLONG AvailableBytes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumaAvailableMemoryNode( UCHAR Node, PULONGLONG AvailableBytes ) { static FN_GetNumaAvailableMemoryNode *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNumaAvailableMemoryNode", &g_Kernel32); return pfn( Node, AvailableBytes ); } typedef BOOL WINAPI FN_PeekConsoleInputA( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_PeekConsoleInputA( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ) { static FN_PeekConsoleInputA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "PeekConsoleInputA", &g_Kernel32); return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead ); } typedef BOOL WINAPI FN_PeekConsoleInputW( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_PeekConsoleInputW( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ) { static FN_PeekConsoleInputW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "PeekConsoleInputW", &g_Kernel32); return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead ); } typedef BOOL WINAPI FN_ReadConsoleInputA( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleInputA( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ) { static FN_ReadConsoleInputA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadConsoleInputA", &g_Kernel32); return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead ); } typedef BOOL WINAPI FN_ReadConsoleInputW( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleInputW( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ) { static FN_ReadConsoleInputW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadConsoleInputW", &g_Kernel32); return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead ); } typedef BOOL WINAPI FN_WriteConsoleInputA( IN HANDLE hConsoleInput, IN CONST INPUT_RECORD * lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsWritten ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleInputA( IN HANDLE hConsoleInput, IN CONST INPUT_RECORD * lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsWritten ) { static FN_WriteConsoleInputA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteConsoleInputA", &g_Kernel32); return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsWritten ); } typedef BOOL WINAPI FN_WriteConsoleInputW( IN HANDLE hConsoleInput, IN CONST INPUT_RECORD * lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsWritten ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleInputW( IN HANDLE hConsoleInput, IN CONST INPUT_RECORD * lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsWritten ) { static FN_WriteConsoleInputW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteConsoleInputW", &g_Kernel32); return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsWritten ); } typedef BOOL WINAPI FN_ReadConsoleOutputA( IN HANDLE hConsoleOutput, OUT PCHAR_INFO lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpReadRegion ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleOutputA( IN HANDLE hConsoleOutput, OUT PCHAR_INFO lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpReadRegion ) { static FN_ReadConsoleOutputA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadConsoleOutputA", &g_Kernel32); return pfn( hConsoleOutput, lpBuffer, dwBufferSize, dwBufferCoord, lpReadRegion ); } typedef BOOL WINAPI FN_ReadConsoleOutputW( IN HANDLE hConsoleOutput, OUT PCHAR_INFO lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpReadRegion ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleOutputW( IN HANDLE hConsoleOutput, OUT PCHAR_INFO lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpReadRegion ) { static FN_ReadConsoleOutputW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadConsoleOutputW", &g_Kernel32); return pfn( hConsoleOutput, lpBuffer, dwBufferSize, dwBufferCoord, lpReadRegion ); } typedef BOOL WINAPI FN_WriteConsoleOutputA( IN HANDLE hConsoleOutput, IN CONST CHAR_INFO * lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpWriteRegion ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleOutputA( IN HANDLE hConsoleOutput, IN CONST CHAR_INFO * lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpWriteRegion ) { static FN_WriteConsoleOutputA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteConsoleOutputA", &g_Kernel32); return pfn( hConsoleOutput, lpBuffer, dwBufferSize, dwBufferCoord, lpWriteRegion ); } typedef BOOL WINAPI FN_WriteConsoleOutputW( IN HANDLE hConsoleOutput, IN CONST CHAR_INFO * lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpWriteRegion ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleOutputW( IN HANDLE hConsoleOutput, IN CONST CHAR_INFO * lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpWriteRegion ) { static FN_WriteConsoleOutputW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteConsoleOutputW", &g_Kernel32); return pfn( hConsoleOutput, lpBuffer, dwBufferSize, dwBufferCoord, lpWriteRegion ); } typedef BOOL WINAPI FN_ReadConsoleOutputCharacterA( IN HANDLE hConsoleOutput, OUT LPSTR lpCharacter, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfCharsRead ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleOutputCharacterA( IN HANDLE hConsoleOutput, OUT LPSTR lpCharacter, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfCharsRead ) { static FN_ReadConsoleOutputCharacterA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadConsoleOutputCharacterA", &g_Kernel32); return pfn( hConsoleOutput, lpCharacter, nLength, dwReadCoord, lpNumberOfCharsRead ); } typedef BOOL WINAPI FN_ReadConsoleOutputCharacterW( IN HANDLE hConsoleOutput, OUT LPWSTR lpCharacter, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfCharsRead ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleOutputCharacterW( IN HANDLE hConsoleOutput, OUT LPWSTR lpCharacter, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfCharsRead ) { static FN_ReadConsoleOutputCharacterW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadConsoleOutputCharacterW", &g_Kernel32); return pfn( hConsoleOutput, lpCharacter, nLength, dwReadCoord, lpNumberOfCharsRead ); } typedef BOOL WINAPI FN_ReadConsoleOutputAttribute( IN HANDLE hConsoleOutput, OUT LPWORD lpAttribute, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfAttrsRead ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleOutputAttribute( IN HANDLE hConsoleOutput, OUT LPWORD lpAttribute, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfAttrsRead ) { static FN_ReadConsoleOutputAttribute *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadConsoleOutputAttribute", &g_Kernel32); return pfn( hConsoleOutput, lpAttribute, nLength, dwReadCoord, lpNumberOfAttrsRead ); } typedef BOOL WINAPI FN_WriteConsoleOutputCharacterA( IN HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleOutputCharacterA( IN HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ) { static FN_WriteConsoleOutputCharacterA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteConsoleOutputCharacterA", &g_Kernel32); return pfn( hConsoleOutput, lpCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten ); } typedef BOOL WINAPI FN_WriteConsoleOutputCharacterW( IN HANDLE hConsoleOutput, IN LPCWSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleOutputCharacterW( IN HANDLE hConsoleOutput, IN LPCWSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ) { static FN_WriteConsoleOutputCharacterW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteConsoleOutputCharacterW", &g_Kernel32); return pfn( hConsoleOutput, lpCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten ); } typedef BOOL WINAPI FN_WriteConsoleOutputAttribute( IN HANDLE hConsoleOutput, IN CONST WORD * lpAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleOutputAttribute( IN HANDLE hConsoleOutput, IN CONST WORD * lpAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten ) { static FN_WriteConsoleOutputAttribute *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteConsoleOutputAttribute", &g_Kernel32); return pfn( hConsoleOutput, lpAttribute, nLength, dwWriteCoord, lpNumberOfAttrsWritten ); } typedef BOOL WINAPI FN_FillConsoleOutputCharacterA( IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FillConsoleOutputCharacterA( IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ) { static FN_FillConsoleOutputCharacterA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FillConsoleOutputCharacterA", &g_Kernel32); return pfn( hConsoleOutput, cCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten ); } typedef BOOL WINAPI FN_FillConsoleOutputCharacterW( IN HANDLE hConsoleOutput, IN WCHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FillConsoleOutputCharacterW( IN HANDLE hConsoleOutput, IN WCHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ) { static FN_FillConsoleOutputCharacterW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FillConsoleOutputCharacterW", &g_Kernel32); return pfn( hConsoleOutput, cCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten ); } typedef BOOL WINAPI FN_FillConsoleOutputAttribute( IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FillConsoleOutputAttribute( IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten ) { static FN_FillConsoleOutputAttribute *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FillConsoleOutputAttribute", &g_Kernel32); return pfn( hConsoleOutput, wAttribute, nLength, dwWriteCoord, lpNumberOfAttrsWritten ); } typedef BOOL WINAPI FN_GetConsoleMode( IN HANDLE hConsoleHandle, OUT LPDWORD lpMode ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetConsoleMode( IN HANDLE hConsoleHandle, OUT LPDWORD lpMode ) { static FN_GetConsoleMode *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleMode", &g_Kernel32); return pfn( hConsoleHandle, lpMode ); } typedef BOOL WINAPI FN_GetNumberOfConsoleInputEvents( IN HANDLE hConsoleInput, OUT LPDWORD lpNumberOfEvents ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumberOfConsoleInputEvents( IN HANDLE hConsoleInput, OUT LPDWORD lpNumberOfEvents ) { static FN_GetNumberOfConsoleInputEvents *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNumberOfConsoleInputEvents", &g_Kernel32); return pfn( hConsoleInput, lpNumberOfEvents ); } typedef BOOL WINAPI FN_GetConsoleScreenBufferInfo( IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetConsoleScreenBufferInfo( IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo ) { static FN_GetConsoleScreenBufferInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleScreenBufferInfo", &g_Kernel32); return pfn( hConsoleOutput, lpConsoleScreenBufferInfo ); } typedef COORD WINAPI FN_GetLargestConsoleWindowSize( IN HANDLE hConsoleOutput ); __declspec(dllexport) COORD WINAPI kPrf2Wrap_GetLargestConsoleWindowSize( IN HANDLE hConsoleOutput ) { static FN_GetLargestConsoleWindowSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLargestConsoleWindowSize", &g_Kernel32); return pfn( hConsoleOutput ); } typedef BOOL WINAPI FN_GetConsoleCursorInfo( IN HANDLE hConsoleOutput, OUT PCONSOLE_CURSOR_INFO lpConsoleCursorInfo ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetConsoleCursorInfo( IN HANDLE hConsoleOutput, OUT PCONSOLE_CURSOR_INFO lpConsoleCursorInfo ) { static FN_GetConsoleCursorInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleCursorInfo", &g_Kernel32); return pfn( hConsoleOutput, lpConsoleCursorInfo ); } typedef BOOL WINAPI FN_GetCurrentConsoleFont( IN HANDLE hConsoleOutput, IN BOOL bMaximumWindow, OUT PCONSOLE_FONT_INFO lpConsoleCurrentFont ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCurrentConsoleFont( IN HANDLE hConsoleOutput, IN BOOL bMaximumWindow, OUT PCONSOLE_FONT_INFO lpConsoleCurrentFont ) { static FN_GetCurrentConsoleFont *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrentConsoleFont", &g_Kernel32); return pfn( hConsoleOutput, bMaximumWindow, lpConsoleCurrentFont ); } typedef COORD WINAPI FN_GetConsoleFontSize( IN HANDLE hConsoleOutput, IN DWORD nFont ); __declspec(dllexport) COORD WINAPI kPrf2Wrap_GetConsoleFontSize( IN HANDLE hConsoleOutput, IN DWORD nFont ) { static FN_GetConsoleFontSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleFontSize", &g_Kernel32); return pfn( hConsoleOutput, nFont ); } typedef BOOL WINAPI FN_GetConsoleSelectionInfo( OUT PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetConsoleSelectionInfo( OUT PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo ) { static FN_GetConsoleSelectionInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleSelectionInfo", &g_Kernel32); return pfn( lpConsoleSelectionInfo ); } typedef BOOL WINAPI FN_GetNumberOfConsoleMouseButtons( OUT LPDWORD lpNumberOfMouseButtons ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumberOfConsoleMouseButtons( OUT LPDWORD lpNumberOfMouseButtons ) { static FN_GetNumberOfConsoleMouseButtons *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNumberOfConsoleMouseButtons", &g_Kernel32); return pfn( lpNumberOfMouseButtons ); } typedef BOOL WINAPI FN_SetConsoleMode( IN HANDLE hConsoleHandle, IN DWORD dwMode ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleMode( IN HANDLE hConsoleHandle, IN DWORD dwMode ) { static FN_SetConsoleMode *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleMode", &g_Kernel32); return pfn( hConsoleHandle, dwMode ); } typedef BOOL WINAPI FN_SetConsoleActiveScreenBuffer( IN HANDLE hConsoleOutput ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleActiveScreenBuffer( IN HANDLE hConsoleOutput ) { static FN_SetConsoleActiveScreenBuffer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleActiveScreenBuffer", &g_Kernel32); return pfn( hConsoleOutput ); } typedef BOOL WINAPI FN_FlushConsoleInputBuffer( IN HANDLE hConsoleInput ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlushConsoleInputBuffer( IN HANDLE hConsoleInput ) { static FN_FlushConsoleInputBuffer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FlushConsoleInputBuffer", &g_Kernel32); return pfn( hConsoleInput ); } typedef BOOL WINAPI FN_SetConsoleScreenBufferSize( IN HANDLE hConsoleOutput, IN COORD dwSize ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleScreenBufferSize( IN HANDLE hConsoleOutput, IN COORD dwSize ) { static FN_SetConsoleScreenBufferSize *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleScreenBufferSize", &g_Kernel32); return pfn( hConsoleOutput, dwSize ); } typedef BOOL WINAPI FN_SetConsoleCursorPosition( IN HANDLE hConsoleOutput, IN COORD dwCursorPosition ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleCursorPosition( IN HANDLE hConsoleOutput, IN COORD dwCursorPosition ) { static FN_SetConsoleCursorPosition *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleCursorPosition", &g_Kernel32); return pfn( hConsoleOutput, dwCursorPosition ); } typedef BOOL WINAPI FN_SetConsoleCursorInfo( IN HANDLE hConsoleOutput, IN CONST CONSOLE_CURSOR_INFO * lpConsoleCursorInfo ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleCursorInfo( IN HANDLE hConsoleOutput, IN CONST CONSOLE_CURSOR_INFO * lpConsoleCursorInfo ) { static FN_SetConsoleCursorInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleCursorInfo", &g_Kernel32); return pfn( hConsoleOutput, lpConsoleCursorInfo ); } typedef BOOL WINAPI FN_ScrollConsoleScreenBufferA( IN HANDLE hConsoleOutput, IN CONST SMALL_RECT * lpScrollRectangle, IN CONST SMALL_RECT * lpClipRectangle, IN COORD dwDestinationOrigin, IN CONST CHAR_INFO * lpFill ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ScrollConsoleScreenBufferA( IN HANDLE hConsoleOutput, IN CONST SMALL_RECT * lpScrollRectangle, IN CONST SMALL_RECT * lpClipRectangle, IN COORD dwDestinationOrigin, IN CONST CHAR_INFO * lpFill ) { static FN_ScrollConsoleScreenBufferA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ScrollConsoleScreenBufferA", &g_Kernel32); return pfn( hConsoleOutput, lpScrollRectangle, lpClipRectangle, dwDestinationOrigin, lpFill ); } typedef BOOL WINAPI FN_ScrollConsoleScreenBufferW( IN HANDLE hConsoleOutput, IN CONST SMALL_RECT * lpScrollRectangle, IN CONST SMALL_RECT * lpClipRectangle, IN COORD dwDestinationOrigin, IN CONST CHAR_INFO * lpFill ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ScrollConsoleScreenBufferW( IN HANDLE hConsoleOutput, IN CONST SMALL_RECT * lpScrollRectangle, IN CONST SMALL_RECT * lpClipRectangle, IN COORD dwDestinationOrigin, IN CONST CHAR_INFO * lpFill ) { static FN_ScrollConsoleScreenBufferW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ScrollConsoleScreenBufferW", &g_Kernel32); return pfn( hConsoleOutput, lpScrollRectangle, lpClipRectangle, dwDestinationOrigin, lpFill ); } typedef BOOL WINAPI FN_SetConsoleWindowInfo( IN HANDLE hConsoleOutput, IN BOOL bAbsolute, IN CONST SMALL_RECT * lpConsoleWindow ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleWindowInfo( IN HANDLE hConsoleOutput, IN BOOL bAbsolute, IN CONST SMALL_RECT * lpConsoleWindow ) { static FN_SetConsoleWindowInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleWindowInfo", &g_Kernel32); return pfn( hConsoleOutput, bAbsolute, lpConsoleWindow ); } typedef BOOL WINAPI FN_SetConsoleTextAttribute( IN HANDLE hConsoleOutput, IN WORD wAttributes ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleTextAttribute( IN HANDLE hConsoleOutput, IN WORD wAttributes ) { static FN_SetConsoleTextAttribute *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleTextAttribute", &g_Kernel32); return pfn( hConsoleOutput, wAttributes ); } typedef BOOL WINAPI FN_SetConsoleCtrlHandler( IN PHANDLER_ROUTINE HandlerRoutine, IN BOOL Add ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleCtrlHandler( IN PHANDLER_ROUTINE HandlerRoutine, IN BOOL Add ) { static FN_SetConsoleCtrlHandler *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleCtrlHandler", &g_Kernel32); return pfn( HandlerRoutine, Add ); } typedef BOOL WINAPI FN_GenerateConsoleCtrlEvent( IN DWORD dwCtrlEvent, IN DWORD dwProcessGroupId ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GenerateConsoleCtrlEvent( IN DWORD dwCtrlEvent, IN DWORD dwProcessGroupId ) { static FN_GenerateConsoleCtrlEvent *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GenerateConsoleCtrlEvent", &g_Kernel32); return pfn( dwCtrlEvent, dwProcessGroupId ); } typedef BOOL WINAPI FN_AllocConsole( VOID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AllocConsole( VOID ) { static FN_AllocConsole *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AllocConsole", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_FreeConsole( VOID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeConsole( VOID ) { static FN_FreeConsole *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FreeConsole", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_AttachConsole( IN DWORD dwProcessId ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_AttachConsole( IN DWORD dwProcessId ) { static FN_AttachConsole *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AttachConsole", &g_Kernel32); return pfn( dwProcessId ); } typedef DWORD WINAPI FN_GetConsoleTitleA( OUT LPSTR lpConsoleTitle, IN DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetConsoleTitleA( OUT LPSTR lpConsoleTitle, IN DWORD nSize ) { static FN_GetConsoleTitleA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleTitleA", &g_Kernel32); return pfn( lpConsoleTitle, nSize ); } typedef DWORD WINAPI FN_GetConsoleTitleW( OUT LPWSTR lpConsoleTitle, IN DWORD nSize ); __declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetConsoleTitleW( OUT LPWSTR lpConsoleTitle, IN DWORD nSize ) { static FN_GetConsoleTitleW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleTitleW", &g_Kernel32); return pfn( lpConsoleTitle, nSize ); } typedef BOOL WINAPI FN_SetConsoleTitleA( IN LPCSTR lpConsoleTitle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleTitleA( IN LPCSTR lpConsoleTitle ) { static FN_SetConsoleTitleA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleTitleA", &g_Kernel32); return pfn( lpConsoleTitle ); } typedef BOOL WINAPI FN_SetConsoleTitleW( IN LPCWSTR lpConsoleTitle ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleTitleW( IN LPCWSTR lpConsoleTitle ) { static FN_SetConsoleTitleW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleTitleW", &g_Kernel32); return pfn( lpConsoleTitle ); } typedef BOOL WINAPI FN_ReadConsoleA( IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN LPVOID lpReserved ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleA( IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN LPVOID lpReserved ) { static FN_ReadConsoleA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadConsoleA", &g_Kernel32); return pfn( hConsoleInput, lpBuffer, nNumberOfCharsToRead, lpNumberOfCharsRead, lpReserved ); } typedef BOOL WINAPI FN_ReadConsoleW( IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN LPVOID lpReserved ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleW( IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN LPVOID lpReserved ) { static FN_ReadConsoleW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReadConsoleW", &g_Kernel32); return pfn( hConsoleInput, lpBuffer, nNumberOfCharsToRead, lpNumberOfCharsRead, lpReserved ); } typedef BOOL WINAPI FN_WriteConsoleA( IN HANDLE hConsoleOutput, IN CONST VOID * lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, IN LPVOID lpReserved ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleA( IN HANDLE hConsoleOutput, IN CONST VOID * lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, IN LPVOID lpReserved ) { static FN_WriteConsoleA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteConsoleA", &g_Kernel32); return pfn( hConsoleOutput, lpBuffer, nNumberOfCharsToWrite, lpNumberOfCharsWritten, lpReserved ); } typedef BOOL WINAPI FN_WriteConsoleW( IN HANDLE hConsoleOutput, IN CONST VOID * lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, IN LPVOID lpReserved ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleW( IN HANDLE hConsoleOutput, IN CONST VOID * lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, IN LPVOID lpReserved ) { static FN_WriteConsoleW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WriteConsoleW", &g_Kernel32); return pfn( hConsoleOutput, lpBuffer, nNumberOfCharsToWrite, lpNumberOfCharsWritten, lpReserved ); } typedef HANDLE WINAPI FN_CreateConsoleScreenBuffer( IN DWORD dwDesiredAccess, IN DWORD dwShareMode, IN CONST SECURITY_ATTRIBUTES * lpSecurityAttributes, IN DWORD dwFlags, IN LPVOID lpScreenBufferData ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateConsoleScreenBuffer( IN DWORD dwDesiredAccess, IN DWORD dwShareMode, IN CONST SECURITY_ATTRIBUTES * lpSecurityAttributes, IN DWORD dwFlags, IN LPVOID lpScreenBufferData ) { static FN_CreateConsoleScreenBuffer *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateConsoleScreenBuffer", &g_Kernel32); return pfn( dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwFlags, lpScreenBufferData ); } typedef UINT WINAPI FN_GetConsoleCP( VOID ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetConsoleCP( VOID ) { static FN_GetConsoleCP *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleCP", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_SetConsoleCP( IN UINT wCodePageID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleCP( IN UINT wCodePageID ) { static FN_SetConsoleCP *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleCP", &g_Kernel32); return pfn( wCodePageID ); } typedef UINT WINAPI FN_GetConsoleOutputCP( VOID ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetConsoleOutputCP( VOID ) { static FN_GetConsoleOutputCP *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleOutputCP", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_SetConsoleOutputCP( IN UINT wCodePageID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleOutputCP( IN UINT wCodePageID ) { static FN_SetConsoleOutputCP *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleOutputCP", &g_Kernel32); return pfn( wCodePageID ); } typedef BOOL APIENTRY FN_GetConsoleDisplayMode( OUT LPDWORD lpModeFlags ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_GetConsoleDisplayMode( OUT LPDWORD lpModeFlags ) { static FN_GetConsoleDisplayMode *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleDisplayMode", &g_Kernel32); return pfn( lpModeFlags ); } typedef HWND APIENTRY FN_GetConsoleWindow( VOID ); __declspec(dllexport) HWND APIENTRY kPrf2Wrap_GetConsoleWindow( VOID ) { static FN_GetConsoleWindow *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleWindow", &g_Kernel32); return pfn (); } typedef DWORD APIENTRY FN_GetConsoleProcessList( OUT LPDWORD lpdwProcessList, IN DWORD dwProcessCount ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleProcessList( OUT LPDWORD lpdwProcessList, IN DWORD dwProcessCount ) { static FN_GetConsoleProcessList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleProcessList", &g_Kernel32); return pfn( lpdwProcessList, dwProcessCount ); } typedef BOOL APIENTRY FN_AddConsoleAliasA( IN LPSTR Source, IN LPSTR Target, IN LPSTR ExeName ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_AddConsoleAliasA( IN LPSTR Source, IN LPSTR Target, IN LPSTR ExeName ) { static FN_AddConsoleAliasA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddConsoleAliasA", &g_Kernel32); return pfn( Source, Target, ExeName ); } typedef BOOL APIENTRY FN_AddConsoleAliasW( IN LPWSTR Source, IN LPWSTR Target, IN LPWSTR ExeName ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_AddConsoleAliasW( IN LPWSTR Source, IN LPWSTR Target, IN LPWSTR ExeName ) { static FN_AddConsoleAliasW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "AddConsoleAliasW", &g_Kernel32); return pfn( Source, Target, ExeName ); } typedef DWORD APIENTRY FN_GetConsoleAliasA( IN LPSTR Source, OUT LPSTR TargetBuffer, IN DWORD TargetBufferLength, IN LPSTR ExeName ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasA( IN LPSTR Source, OUT LPSTR TargetBuffer, IN DWORD TargetBufferLength, IN LPSTR ExeName ) { static FN_GetConsoleAliasA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasA", &g_Kernel32); return pfn( Source, TargetBuffer, TargetBufferLength, ExeName ); } typedef DWORD APIENTRY FN_GetConsoleAliasW( IN LPWSTR Source, OUT LPWSTR TargetBuffer, IN DWORD TargetBufferLength, IN LPWSTR ExeName ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasW( IN LPWSTR Source, OUT LPWSTR TargetBuffer, IN DWORD TargetBufferLength, IN LPWSTR ExeName ) { static FN_GetConsoleAliasW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasW", &g_Kernel32); return pfn( Source, TargetBuffer, TargetBufferLength, ExeName ); } typedef DWORD APIENTRY FN_GetConsoleAliasesLengthA( IN LPSTR ExeName ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasesLengthA( IN LPSTR ExeName ) { static FN_GetConsoleAliasesLengthA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasesLengthA", &g_Kernel32); return pfn( ExeName ); } typedef DWORD APIENTRY FN_GetConsoleAliasesLengthW( IN LPWSTR ExeName ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasesLengthW( IN LPWSTR ExeName ) { static FN_GetConsoleAliasesLengthW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasesLengthW", &g_Kernel32); return pfn( ExeName ); } typedef DWORD APIENTRY FN_GetConsoleAliasExesLengthA( VOID ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasExesLengthA( VOID ) { static FN_GetConsoleAliasExesLengthA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasExesLengthA", &g_Kernel32); return pfn (); } typedef DWORD APIENTRY FN_GetConsoleAliasExesLengthW( VOID ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasExesLengthW( VOID ) { static FN_GetConsoleAliasExesLengthW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasExesLengthW", &g_Kernel32); return pfn (); } typedef DWORD APIENTRY FN_GetConsoleAliasesA( OUT LPSTR AliasBuffer, IN DWORD AliasBufferLength, IN LPSTR ExeName ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasesA( OUT LPSTR AliasBuffer, IN DWORD AliasBufferLength, IN LPSTR ExeName ) { static FN_GetConsoleAliasesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasesA", &g_Kernel32); return pfn( AliasBuffer, AliasBufferLength, ExeName ); } typedef DWORD APIENTRY FN_GetConsoleAliasesW( OUT LPWSTR AliasBuffer, IN DWORD AliasBufferLength, IN LPWSTR ExeName ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasesW( OUT LPWSTR AliasBuffer, IN DWORD AliasBufferLength, IN LPWSTR ExeName ) { static FN_GetConsoleAliasesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasesW", &g_Kernel32); return pfn( AliasBuffer, AliasBufferLength, ExeName ); } typedef DWORD APIENTRY FN_GetConsoleAliasExesA( OUT LPSTR ExeNameBuffer, IN DWORD ExeNameBufferLength ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasExesA( OUT LPSTR ExeNameBuffer, IN DWORD ExeNameBufferLength ) { static FN_GetConsoleAliasExesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasExesA", &g_Kernel32); return pfn( ExeNameBuffer, ExeNameBufferLength ); } typedef DWORD APIENTRY FN_GetConsoleAliasExesW( OUT LPWSTR ExeNameBuffer, IN DWORD ExeNameBufferLength ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasExesW( OUT LPWSTR ExeNameBuffer, IN DWORD ExeNameBufferLength ) { static FN_GetConsoleAliasExesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasExesW", &g_Kernel32); return pfn( ExeNameBuffer, ExeNameBufferLength ); } typedef BOOL WINAPI FN_IsValidCodePage( UINT CodePage ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidCodePage( UINT CodePage ) { static FN_IsValidCodePage *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsValidCodePage", &g_Kernel32); return pfn( CodePage ); } typedef UINT WINAPI FN_GetACP( void ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetACP( void ) { static FN_GetACP *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetACP", &g_Kernel32); return pfn (); } typedef UINT WINAPI FN_GetOEMCP( void ); __declspec(dllexport) UINT WINAPI kPrf2Wrap_GetOEMCP( void ) { static FN_GetOEMCP *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetOEMCP", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_GetCPInfo( UINT CodePage, LPCPINFO lpCPInfo ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCPInfo( UINT CodePage, LPCPINFO lpCPInfo ) { static FN_GetCPInfo *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCPInfo", &g_Kernel32); return pfn( CodePage, lpCPInfo ); } typedef BOOL WINAPI FN_GetCPInfoExA( UINT CodePage, DWORD dwFlags, LPCPINFOEXA lpCPInfoEx ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCPInfoExA( UINT CodePage, DWORD dwFlags, LPCPINFOEXA lpCPInfoEx ) { static FN_GetCPInfoExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCPInfoExA", &g_Kernel32); return pfn( CodePage, dwFlags, lpCPInfoEx ); } typedef BOOL WINAPI FN_GetCPInfoExW( UINT CodePage, DWORD dwFlags, LPCPINFOEXW lpCPInfoEx ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCPInfoExW( UINT CodePage, DWORD dwFlags, LPCPINFOEXW lpCPInfoEx ) { static FN_GetCPInfoExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCPInfoExW", &g_Kernel32); return pfn( CodePage, dwFlags, lpCPInfoEx ); } typedef BOOL WINAPI FN_IsDBCSLeadByte( BYTE TestChar ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsDBCSLeadByte( BYTE TestChar ) { static FN_IsDBCSLeadByte *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsDBCSLeadByte", &g_Kernel32); return pfn( TestChar ); } typedef BOOL WINAPI FN_IsDBCSLeadByteEx( UINT CodePage, BYTE TestChar ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsDBCSLeadByteEx( UINT CodePage, BYTE TestChar ) { static FN_IsDBCSLeadByteEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsDBCSLeadByteEx", &g_Kernel32); return pfn( CodePage, TestChar ); } typedef int WINAPI FN_MultiByteToWideChar( UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar ); __declspec(dllexport) int WINAPI kPrf2Wrap_MultiByteToWideChar( UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar ) { static FN_MultiByteToWideChar *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "MultiByteToWideChar", &g_Kernel32); return pfn( CodePage, dwFlags, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar ); } typedef int WINAPI FN_WideCharToMultiByte( UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar ); __declspec(dllexport) int WINAPI kPrf2Wrap_WideCharToMultiByte( UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar ) { static FN_WideCharToMultiByte *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "WideCharToMultiByte", &g_Kernel32); return pfn( CodePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar ); } typedef int WINAPI FN_CompareStringA( LCID Locale, DWORD dwCmpFlags, LPCSTR lpString1, int cchCount1, LPCSTR lpString2, int cchCount2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_CompareStringA( LCID Locale, DWORD dwCmpFlags, LPCSTR lpString1, int cchCount1, LPCSTR lpString2, int cchCount2 ) { static FN_CompareStringA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CompareStringA", &g_Kernel32); return pfn( Locale, dwCmpFlags, lpString1, cchCount1, lpString2, cchCount2 ); } typedef int WINAPI FN_CompareStringW( LCID Locale, DWORD dwCmpFlags, LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, int cchCount2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_CompareStringW( LCID Locale, DWORD dwCmpFlags, LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, int cchCount2 ) { static FN_CompareStringW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CompareStringW", &g_Kernel32); return pfn( Locale, dwCmpFlags, lpString1, cchCount1, lpString2, cchCount2 ); } typedef int WINAPI FN_LCMapStringA( LCID Locale, DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest ); __declspec(dllexport) int WINAPI kPrf2Wrap_LCMapStringA( LCID Locale, DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest ) { static FN_LCMapStringA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LCMapStringA", &g_Kernel32); return pfn( Locale, dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest ); } typedef int WINAPI FN_LCMapStringW( LCID Locale, DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest ); __declspec(dllexport) int WINAPI kPrf2Wrap_LCMapStringW( LCID Locale, DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest ) { static FN_LCMapStringW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "LCMapStringW", &g_Kernel32); return pfn( Locale, dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest ); } typedef int WINAPI FN_GetLocaleInfoA( LCID Locale, LCTYPE LCType, LPSTR lpLCData, int cchData ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetLocaleInfoA( LCID Locale, LCTYPE LCType, LPSTR lpLCData, int cchData ) { static FN_GetLocaleInfoA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLocaleInfoA", &g_Kernel32); return pfn( Locale, LCType, lpLCData, cchData ); } typedef int WINAPI FN_GetLocaleInfoW( LCID Locale, LCTYPE LCType, LPWSTR lpLCData, int cchData ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetLocaleInfoW( LCID Locale, LCTYPE LCType, LPWSTR lpLCData, int cchData ) { static FN_GetLocaleInfoW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetLocaleInfoW", &g_Kernel32); return pfn( Locale, LCType, lpLCData, cchData ); } typedef BOOL WINAPI FN_SetLocaleInfoA( LCID Locale, LCTYPE LCType, LPCSTR lpLCData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetLocaleInfoA( LCID Locale, LCTYPE LCType, LPCSTR lpLCData ) { static FN_SetLocaleInfoA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetLocaleInfoA", &g_Kernel32); return pfn( Locale, LCType, lpLCData ); } typedef BOOL WINAPI FN_SetLocaleInfoW( LCID Locale, LCTYPE LCType, LPCWSTR lpLCData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetLocaleInfoW( LCID Locale, LCTYPE LCType, LPCWSTR lpLCData ) { static FN_SetLocaleInfoW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetLocaleInfoW", &g_Kernel32); return pfn( Locale, LCType, lpLCData ); } typedef int WINAPI FN_GetCalendarInfoA( LCID Locale, CALID Calendar, CALTYPE CalType, LPSTR lpCalData, int cchData, LPDWORD lpValue ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetCalendarInfoA( LCID Locale, CALID Calendar, CALTYPE CalType, LPSTR lpCalData, int cchData, LPDWORD lpValue ) { static FN_GetCalendarInfoA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCalendarInfoA", &g_Kernel32); return pfn( Locale, Calendar, CalType, lpCalData, cchData, lpValue ); } typedef int WINAPI FN_GetCalendarInfoW( LCID Locale, CALID Calendar, CALTYPE CalType, LPWSTR lpCalData, int cchData, LPDWORD lpValue ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetCalendarInfoW( LCID Locale, CALID Calendar, CALTYPE CalType, LPWSTR lpCalData, int cchData, LPDWORD lpValue ) { static FN_GetCalendarInfoW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCalendarInfoW", &g_Kernel32); return pfn( Locale, Calendar, CalType, lpCalData, cchData, lpValue ); } typedef BOOL WINAPI FN_SetCalendarInfoA( LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCalendarInfoA( LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData ) { static FN_SetCalendarInfoA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetCalendarInfoA", &g_Kernel32); return pfn( Locale, Calendar, CalType, lpCalData ); } typedef BOOL WINAPI FN_SetCalendarInfoW( LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCalendarInfoW( LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData ) { static FN_SetCalendarInfoW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetCalendarInfoW", &g_Kernel32); return pfn( Locale, Calendar, CalType, lpCalData ); } typedef int WINAPI FN_GetTimeFormatA( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpTime, LPCSTR lpFormat, LPSTR lpTimeStr, int cchTime ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetTimeFormatA( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpTime, LPCSTR lpFormat, LPSTR lpTimeStr, int cchTime ) { static FN_GetTimeFormatA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTimeFormatA", &g_Kernel32); return pfn( Locale, dwFlags, lpTime, lpFormat, lpTimeStr, cchTime ); } typedef int WINAPI FN_GetTimeFormatW( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, int cchTime ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetTimeFormatW( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, int cchTime ) { static FN_GetTimeFormatW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetTimeFormatW", &g_Kernel32); return pfn( Locale, dwFlags, lpTime, lpFormat, lpTimeStr, cchTime ); } typedef int WINAPI FN_GetDateFormatA( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpDate, LPCSTR lpFormat, LPSTR lpDateStr, int cchDate ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetDateFormatA( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpDate, LPCSTR lpFormat, LPSTR lpDateStr, int cchDate ) { static FN_GetDateFormatA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDateFormatA", &g_Kernel32); return pfn( Locale, dwFlags, lpDate, lpFormat, lpDateStr, cchDate ); } typedef int WINAPI FN_GetDateFormatW( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpDate, LPCWSTR lpFormat, LPWSTR lpDateStr, int cchDate ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetDateFormatW( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpDate, LPCWSTR lpFormat, LPWSTR lpDateStr, int cchDate ) { static FN_GetDateFormatW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetDateFormatW", &g_Kernel32); return pfn( Locale, dwFlags, lpDate, lpFormat, lpDateStr, cchDate ); } typedef int WINAPI FN_GetNumberFormatA( LCID Locale, DWORD dwFlags, LPCSTR lpValue, CONST NUMBERFMTA * lpFormat, LPSTR lpNumberStr, int cchNumber ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetNumberFormatA( LCID Locale, DWORD dwFlags, LPCSTR lpValue, CONST NUMBERFMTA * lpFormat, LPSTR lpNumberStr, int cchNumber ) { static FN_GetNumberFormatA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNumberFormatA", &g_Kernel32); return pfn( Locale, dwFlags, lpValue, lpFormat, lpNumberStr, cchNumber ); } typedef int WINAPI FN_GetNumberFormatW( LCID Locale, DWORD dwFlags, LPCWSTR lpValue, CONST NUMBERFMTW * lpFormat, LPWSTR lpNumberStr, int cchNumber ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetNumberFormatW( LCID Locale, DWORD dwFlags, LPCWSTR lpValue, CONST NUMBERFMTW * lpFormat, LPWSTR lpNumberStr, int cchNumber ) { static FN_GetNumberFormatW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNumberFormatW", &g_Kernel32); return pfn( Locale, dwFlags, lpValue, lpFormat, lpNumberStr, cchNumber ); } typedef int WINAPI FN_GetCurrencyFormatA( LCID Locale, DWORD dwFlags, LPCSTR lpValue, CONST CURRENCYFMTA * lpFormat, LPSTR lpCurrencyStr, int cchCurrency ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetCurrencyFormatA( LCID Locale, DWORD dwFlags, LPCSTR lpValue, CONST CURRENCYFMTA * lpFormat, LPSTR lpCurrencyStr, int cchCurrency ) { static FN_GetCurrencyFormatA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrencyFormatA", &g_Kernel32); return pfn( Locale, dwFlags, lpValue, lpFormat, lpCurrencyStr, cchCurrency ); } typedef int WINAPI FN_GetCurrencyFormatW( LCID Locale, DWORD dwFlags, LPCWSTR lpValue, CONST CURRENCYFMTW * lpFormat, LPWSTR lpCurrencyStr, int cchCurrency ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetCurrencyFormatW( LCID Locale, DWORD dwFlags, LPCWSTR lpValue, CONST CURRENCYFMTW * lpFormat, LPWSTR lpCurrencyStr, int cchCurrency ) { static FN_GetCurrencyFormatW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetCurrencyFormatW", &g_Kernel32); return pfn( Locale, dwFlags, lpValue, lpFormat, lpCurrencyStr, cchCurrency ); } typedef BOOL WINAPI FN_EnumCalendarInfoA( CALINFO_ENUMPROCA lpCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumCalendarInfoA( CALINFO_ENUMPROCA lpCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType ) { static FN_EnumCalendarInfoA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumCalendarInfoA", &g_Kernel32); return pfn( lpCalInfoEnumProc, Locale, Calendar, CalType ); } typedef BOOL WINAPI FN_EnumCalendarInfoW( CALINFO_ENUMPROCW lpCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumCalendarInfoW( CALINFO_ENUMPROCW lpCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType ) { static FN_EnumCalendarInfoW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumCalendarInfoW", &g_Kernel32); return pfn( lpCalInfoEnumProc, Locale, Calendar, CalType ); } typedef BOOL WINAPI FN_EnumCalendarInfoExA( CALINFO_ENUMPROCEXA lpCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumCalendarInfoExA( CALINFO_ENUMPROCEXA lpCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType ) { static FN_EnumCalendarInfoExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumCalendarInfoExA", &g_Kernel32); return pfn( lpCalInfoEnumProcEx, Locale, Calendar, CalType ); } typedef BOOL WINAPI FN_EnumCalendarInfoExW( CALINFO_ENUMPROCEXW lpCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumCalendarInfoExW( CALINFO_ENUMPROCEXW lpCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType ) { static FN_EnumCalendarInfoExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumCalendarInfoExW", &g_Kernel32); return pfn( lpCalInfoEnumProcEx, Locale, Calendar, CalType ); } typedef BOOL WINAPI FN_EnumTimeFormatsA( TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumTimeFormatsA( TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags ) { static FN_EnumTimeFormatsA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumTimeFormatsA", &g_Kernel32); return pfn( lpTimeFmtEnumProc, Locale, dwFlags ); } typedef BOOL WINAPI FN_EnumTimeFormatsW( TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumTimeFormatsW( TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags ) { static FN_EnumTimeFormatsW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumTimeFormatsW", &g_Kernel32); return pfn( lpTimeFmtEnumProc, Locale, dwFlags ); } typedef BOOL WINAPI FN_EnumDateFormatsA( DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumDateFormatsA( DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags ) { static FN_EnumDateFormatsA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumDateFormatsA", &g_Kernel32); return pfn( lpDateFmtEnumProc, Locale, dwFlags ); } typedef BOOL WINAPI FN_EnumDateFormatsW( DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumDateFormatsW( DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags ) { static FN_EnumDateFormatsW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumDateFormatsW", &g_Kernel32); return pfn( lpDateFmtEnumProc, Locale, dwFlags ); } typedef BOOL WINAPI FN_EnumDateFormatsExA( DATEFMT_ENUMPROCEXA lpDateFmtEnumProcEx, LCID Locale, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumDateFormatsExA( DATEFMT_ENUMPROCEXA lpDateFmtEnumProcEx, LCID Locale, DWORD dwFlags ) { static FN_EnumDateFormatsExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumDateFormatsExA", &g_Kernel32); return pfn( lpDateFmtEnumProcEx, Locale, dwFlags ); } typedef BOOL WINAPI FN_EnumDateFormatsExW( DATEFMT_ENUMPROCEXW lpDateFmtEnumProcEx, LCID Locale, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumDateFormatsExW( DATEFMT_ENUMPROCEXW lpDateFmtEnumProcEx, LCID Locale, DWORD dwFlags ) { static FN_EnumDateFormatsExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumDateFormatsExW", &g_Kernel32); return pfn( lpDateFmtEnumProcEx, Locale, dwFlags ); } typedef BOOL WINAPI FN_IsValidLanguageGroup( LGRPID LanguageGroup, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidLanguageGroup( LGRPID LanguageGroup, DWORD dwFlags ) { static FN_IsValidLanguageGroup *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsValidLanguageGroup", &g_Kernel32); return pfn( LanguageGroup, dwFlags ); } typedef BOOL WINAPI FN_GetNLSVersion( NLS_FUNCTION Function, LCID Locale, LPNLSVERSIONINFO lpVersionInformation ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNLSVersion( NLS_FUNCTION Function, LCID Locale, LPNLSVERSIONINFO lpVersionInformation ) { static FN_GetNLSVersion *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetNLSVersion", &g_Kernel32); return pfn( Function, Locale, lpVersionInformation ); } typedef BOOL WINAPI FN_IsNLSDefinedString( NLS_FUNCTION Function, DWORD dwFlags, LPNLSVERSIONINFO lpVersionInformation, LPCWSTR lpString, INT cchStr ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsNLSDefinedString( NLS_FUNCTION Function, DWORD dwFlags, LPNLSVERSIONINFO lpVersionInformation, LPCWSTR lpString, INT cchStr ) { static FN_IsNLSDefinedString *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsNLSDefinedString", &g_Kernel32); return pfn( Function, dwFlags, lpVersionInformation, lpString, cchStr ); } typedef BOOL WINAPI FN_IsValidLocale( LCID Locale, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidLocale( LCID Locale, DWORD dwFlags ) { static FN_IsValidLocale *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "IsValidLocale", &g_Kernel32); return pfn( Locale, dwFlags ); } typedef int WINAPI FN_GetGeoInfoA( GEOID Location, GEOTYPE GeoType, LPSTR lpGeoData, int cchData, LANGID LangId ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetGeoInfoA( GEOID Location, GEOTYPE GeoType, LPSTR lpGeoData, int cchData, LANGID LangId ) { static FN_GetGeoInfoA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetGeoInfoA", &g_Kernel32); return pfn( Location, GeoType, lpGeoData, cchData, LangId ); } typedef int WINAPI FN_GetGeoInfoW( GEOID Location, GEOTYPE GeoType, LPWSTR lpGeoData, int cchData, LANGID LangId ); __declspec(dllexport) int WINAPI kPrf2Wrap_GetGeoInfoW( GEOID Location, GEOTYPE GeoType, LPWSTR lpGeoData, int cchData, LANGID LangId ) { static FN_GetGeoInfoW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetGeoInfoW", &g_Kernel32); return pfn( Location, GeoType, lpGeoData, cchData, LangId ); } typedef BOOL WINAPI FN_EnumSystemGeoID( GEOCLASS GeoClass, GEOID ParentGeoId, GEO_ENUMPROC lpGeoEnumProc ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemGeoID( GEOCLASS GeoClass, GEOID ParentGeoId, GEO_ENUMPROC lpGeoEnumProc ) { static FN_EnumSystemGeoID *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumSystemGeoID", &g_Kernel32); return pfn( GeoClass, ParentGeoId, lpGeoEnumProc ); } typedef GEOID WINAPI FN_GetUserGeoID( GEOCLASS GeoClass ); __declspec(dllexport) GEOID WINAPI kPrf2Wrap_GetUserGeoID( GEOCLASS GeoClass ) { static FN_GetUserGeoID *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetUserGeoID", &g_Kernel32); return pfn( GeoClass ); } typedef BOOL WINAPI FN_SetUserGeoID( GEOID GeoId ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetUserGeoID( GEOID GeoId ) { static FN_SetUserGeoID *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetUserGeoID", &g_Kernel32); return pfn( GeoId ); } typedef LCID WINAPI FN_ConvertDefaultLocale( LCID Locale ); __declspec(dllexport) LCID WINAPI kPrf2Wrap_ConvertDefaultLocale( LCID Locale ) { static FN_ConvertDefaultLocale *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ConvertDefaultLocale", &g_Kernel32); return pfn( Locale ); } typedef LCID WINAPI FN_GetThreadLocale( void ); __declspec(dllexport) LCID WINAPI kPrf2Wrap_GetThreadLocale( void ) { static FN_GetThreadLocale *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetThreadLocale", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_SetThreadLocale( LCID Locale ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetThreadLocale( LCID Locale ) { static FN_SetThreadLocale *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetThreadLocale", &g_Kernel32); return pfn( Locale ); } typedef LANGID WINAPI FN_GetSystemDefaultUILanguage( void ); __declspec(dllexport) LANGID WINAPI kPrf2Wrap_GetSystemDefaultUILanguage( void ) { static FN_GetSystemDefaultUILanguage *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemDefaultUILanguage", &g_Kernel32); return pfn (); } typedef LANGID WINAPI FN_GetUserDefaultUILanguage( void ); __declspec(dllexport) LANGID WINAPI kPrf2Wrap_GetUserDefaultUILanguage( void ) { static FN_GetUserDefaultUILanguage *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetUserDefaultUILanguage", &g_Kernel32); return pfn (); } typedef LANGID WINAPI FN_GetSystemDefaultLangID( void ); __declspec(dllexport) LANGID WINAPI kPrf2Wrap_GetSystemDefaultLangID( void ) { static FN_GetSystemDefaultLangID *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemDefaultLangID", &g_Kernel32); return pfn (); } typedef LANGID WINAPI FN_GetUserDefaultLangID( void ); __declspec(dllexport) LANGID WINAPI kPrf2Wrap_GetUserDefaultLangID( void ) { static FN_GetUserDefaultLangID *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetUserDefaultLangID", &g_Kernel32); return pfn (); } typedef LCID WINAPI FN_GetSystemDefaultLCID( void ); __declspec(dllexport) LCID WINAPI kPrf2Wrap_GetSystemDefaultLCID( void ) { static FN_GetSystemDefaultLCID *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetSystemDefaultLCID", &g_Kernel32); return pfn (); } typedef LCID WINAPI FN_GetUserDefaultLCID( void ); __declspec(dllexport) LCID WINAPI kPrf2Wrap_GetUserDefaultLCID( void ) { static FN_GetUserDefaultLCID *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetUserDefaultLCID", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_GetStringTypeExA( LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetStringTypeExA( LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType ) { static FN_GetStringTypeExA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetStringTypeExA", &g_Kernel32); return pfn( Locale, dwInfoType, lpSrcStr, cchSrc, lpCharType ); } typedef BOOL WINAPI FN_GetStringTypeExW( LCID Locale, DWORD dwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetStringTypeExW( LCID Locale, DWORD dwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType ) { static FN_GetStringTypeExW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetStringTypeExW", &g_Kernel32); return pfn( Locale, dwInfoType, lpSrcStr, cchSrc, lpCharType ); } typedef BOOL WINAPI FN_GetStringTypeA( LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetStringTypeA( LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType ) { static FN_GetStringTypeA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetStringTypeA", &g_Kernel32); return pfn( Locale, dwInfoType, lpSrcStr, cchSrc, lpCharType ); } typedef BOOL WINAPI FN_GetStringTypeW( DWORD dwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetStringTypeW( DWORD dwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType ) { static FN_GetStringTypeW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetStringTypeW", &g_Kernel32); return pfn( dwInfoType, lpSrcStr, cchSrc, lpCharType ); } typedef int WINAPI FN_FoldStringA( DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest ); __declspec(dllexport) int WINAPI kPrf2Wrap_FoldStringA( DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest ) { static FN_FoldStringA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FoldStringA", &g_Kernel32); return pfn( dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest ); } typedef int WINAPI FN_FoldStringW( DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest ); __declspec(dllexport) int WINAPI kPrf2Wrap_FoldStringW( DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest ) { static FN_FoldStringW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "FoldStringW", &g_Kernel32); return pfn( dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest ); } typedef BOOL WINAPI FN_EnumSystemLanguageGroupsA( LANGUAGEGROUP_ENUMPROCA lpLanguageGroupEnumProc, DWORD dwFlags, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemLanguageGroupsA( LANGUAGEGROUP_ENUMPROCA lpLanguageGroupEnumProc, DWORD dwFlags, LONG_PTR lParam ) { static FN_EnumSystemLanguageGroupsA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumSystemLanguageGroupsA", &g_Kernel32); return pfn( lpLanguageGroupEnumProc, dwFlags, lParam ); } typedef BOOL WINAPI FN_EnumSystemLanguageGroupsW( LANGUAGEGROUP_ENUMPROCW lpLanguageGroupEnumProc, DWORD dwFlags, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemLanguageGroupsW( LANGUAGEGROUP_ENUMPROCW lpLanguageGroupEnumProc, DWORD dwFlags, LONG_PTR lParam ) { static FN_EnumSystemLanguageGroupsW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumSystemLanguageGroupsW", &g_Kernel32); return pfn( lpLanguageGroupEnumProc, dwFlags, lParam ); } typedef BOOL WINAPI FN_EnumLanguageGroupLocalesA( LANGGROUPLOCALE_ENUMPROCA lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, DWORD dwFlags, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumLanguageGroupLocalesA( LANGGROUPLOCALE_ENUMPROCA lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, DWORD dwFlags, LONG_PTR lParam ) { static FN_EnumLanguageGroupLocalesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumLanguageGroupLocalesA", &g_Kernel32); return pfn( lpLangGroupLocaleEnumProc, LanguageGroup, dwFlags, lParam ); } typedef BOOL WINAPI FN_EnumLanguageGroupLocalesW( LANGGROUPLOCALE_ENUMPROCW lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, DWORD dwFlags, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumLanguageGroupLocalesW( LANGGROUPLOCALE_ENUMPROCW lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, DWORD dwFlags, LONG_PTR lParam ) { static FN_EnumLanguageGroupLocalesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumLanguageGroupLocalesW", &g_Kernel32); return pfn( lpLangGroupLocaleEnumProc, LanguageGroup, dwFlags, lParam ); } typedef BOOL WINAPI FN_EnumUILanguagesA( UILANGUAGE_ENUMPROCA lpUILanguageEnumProc, DWORD dwFlags, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumUILanguagesA( UILANGUAGE_ENUMPROCA lpUILanguageEnumProc, DWORD dwFlags, LONG_PTR lParam ) { static FN_EnumUILanguagesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumUILanguagesA", &g_Kernel32); return pfn( lpUILanguageEnumProc, dwFlags, lParam ); } typedef BOOL WINAPI FN_EnumUILanguagesW( UILANGUAGE_ENUMPROCW lpUILanguageEnumProc, DWORD dwFlags, LONG_PTR lParam ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumUILanguagesW( UILANGUAGE_ENUMPROCW lpUILanguageEnumProc, DWORD dwFlags, LONG_PTR lParam ) { static FN_EnumUILanguagesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumUILanguagesW", &g_Kernel32); return pfn( lpUILanguageEnumProc, dwFlags, lParam ); } typedef BOOL WINAPI FN_EnumSystemLocalesA( LOCALE_ENUMPROCA lpLocaleEnumProc, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemLocalesA( LOCALE_ENUMPROCA lpLocaleEnumProc, DWORD dwFlags ) { static FN_EnumSystemLocalesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumSystemLocalesA", &g_Kernel32); return pfn( lpLocaleEnumProc, dwFlags ); } typedef BOOL WINAPI FN_EnumSystemLocalesW( LOCALE_ENUMPROCW lpLocaleEnumProc, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemLocalesW( LOCALE_ENUMPROCW lpLocaleEnumProc, DWORD dwFlags ) { static FN_EnumSystemLocalesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumSystemLocalesW", &g_Kernel32); return pfn( lpLocaleEnumProc, dwFlags ); } typedef BOOL WINAPI FN_EnumSystemCodePagesA( CODEPAGE_ENUMPROCA lpCodePageEnumProc, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemCodePagesA( CODEPAGE_ENUMPROCA lpCodePageEnumProc, DWORD dwFlags ) { static FN_EnumSystemCodePagesA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumSystemCodePagesA", &g_Kernel32); return pfn( lpCodePageEnumProc, dwFlags ); } typedef BOOL WINAPI FN_EnumSystemCodePagesW( CODEPAGE_ENUMPROCW lpCodePageEnumProc, DWORD dwFlags ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemCodePagesW( CODEPAGE_ENUMPROCW lpCodePageEnumProc, DWORD dwFlags ) { static FN_EnumSystemCodePagesW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "EnumSystemCodePagesW", &g_Kernel32); return pfn( lpCodePageEnumProc, dwFlags ); } typedef DWORD APIENTRY FN_VerFindFileA( DWORD uFlags, LPSTR szFileName, LPSTR szWinDir, LPSTR szAppDir, LPSTR szCurDir, PUINT lpuCurDirLen, LPSTR szDestDir, PUINT lpuDestDirLen ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerFindFileA( DWORD uFlags, LPSTR szFileName, LPSTR szWinDir, LPSTR szAppDir, LPSTR szCurDir, PUINT lpuCurDirLen, LPSTR szDestDir, PUINT lpuDestDirLen ) { static FN_VerFindFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerFindFileA", &g_Kernel32); return pfn( uFlags, szFileName, szWinDir, szAppDir, szCurDir, lpuCurDirLen, szDestDir, lpuDestDirLen ); } typedef DWORD APIENTRY FN_VerFindFileW( DWORD uFlags, LPWSTR szFileName, LPWSTR szWinDir, LPWSTR szAppDir, LPWSTR szCurDir, PUINT lpuCurDirLen, LPWSTR szDestDir, PUINT lpuDestDirLen ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerFindFileW( DWORD uFlags, LPWSTR szFileName, LPWSTR szWinDir, LPWSTR szAppDir, LPWSTR szCurDir, PUINT lpuCurDirLen, LPWSTR szDestDir, PUINT lpuDestDirLen ) { static FN_VerFindFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerFindFileW", &g_Kernel32); return pfn( uFlags, szFileName, szWinDir, szAppDir, szCurDir, lpuCurDirLen, szDestDir, lpuDestDirLen ); } typedef DWORD APIENTRY FN_VerInstallFileA( DWORD uFlags, LPSTR szSrcFileName, LPSTR szDestFileName, LPSTR szSrcDir, LPSTR szDestDir, LPSTR szCurDir, LPSTR szTmpFile, PUINT lpuTmpFileLen ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerInstallFileA( DWORD uFlags, LPSTR szSrcFileName, LPSTR szDestFileName, LPSTR szSrcDir, LPSTR szDestDir, LPSTR szCurDir, LPSTR szTmpFile, PUINT lpuTmpFileLen ) { static FN_VerInstallFileA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerInstallFileA", &g_Kernel32); return pfn( uFlags, szSrcFileName, szDestFileName, szSrcDir, szDestDir, szCurDir, szTmpFile, lpuTmpFileLen ); } typedef DWORD APIENTRY FN_VerInstallFileW( DWORD uFlags, LPWSTR szSrcFileName, LPWSTR szDestFileName, LPWSTR szSrcDir, LPWSTR szDestDir, LPWSTR szCurDir, LPWSTR szTmpFile, PUINT lpuTmpFileLen ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerInstallFileW( DWORD uFlags, LPWSTR szSrcFileName, LPWSTR szDestFileName, LPWSTR szSrcDir, LPWSTR szDestDir, LPWSTR szCurDir, LPWSTR szTmpFile, PUINT lpuTmpFileLen ) { static FN_VerInstallFileW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerInstallFileW", &g_Kernel32); return pfn( uFlags, szSrcFileName, szDestFileName, szSrcDir, szDestDir, szCurDir, szTmpFile, lpuTmpFileLen ); } typedef DWORD APIENTRY FN_GetFileVersionInfoSizeA( LPCSTR lptstrFilename, LPDWORD lpdwHandle ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetFileVersionInfoSizeA( LPCSTR lptstrFilename, LPDWORD lpdwHandle ) { static FN_GetFileVersionInfoSizeA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileVersionInfoSizeA", &g_Kernel32); return pfn( lptstrFilename, lpdwHandle ); } typedef DWORD APIENTRY FN_GetFileVersionInfoSizeW( LPCWSTR lptstrFilename, LPDWORD lpdwHandle ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetFileVersionInfoSizeW( LPCWSTR lptstrFilename, LPDWORD lpdwHandle ) { static FN_GetFileVersionInfoSizeW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileVersionInfoSizeW", &g_Kernel32); return pfn( lptstrFilename, lpdwHandle ); } typedef BOOL APIENTRY FN_GetFileVersionInfoA( LPCSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_GetFileVersionInfoA( LPCSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData ) { static FN_GetFileVersionInfoA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileVersionInfoA", &g_Kernel32); return pfn( lptstrFilename, dwHandle, dwLen, lpData ); } typedef BOOL APIENTRY FN_GetFileVersionInfoW( LPCWSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_GetFileVersionInfoW( LPCWSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData ) { static FN_GetFileVersionInfoW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetFileVersionInfoW", &g_Kernel32); return pfn( lptstrFilename, dwHandle, dwLen, lpData ); } typedef DWORD APIENTRY FN_VerLanguageNameA( DWORD wLang, LPSTR szLang, DWORD nSize ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerLanguageNameA( DWORD wLang, LPSTR szLang, DWORD nSize ) { static FN_VerLanguageNameA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerLanguageNameA", &g_Kernel32); return pfn( wLang, szLang, nSize ); } typedef DWORD APIENTRY FN_VerLanguageNameW( DWORD wLang, LPWSTR szLang, DWORD nSize ); __declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerLanguageNameW( DWORD wLang, LPWSTR szLang, DWORD nSize ) { static FN_VerLanguageNameW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerLanguageNameW", &g_Kernel32); return pfn( wLang, szLang, nSize ); } typedef BOOL APIENTRY FN_VerQueryValueA( const LPVOID pBlock, LPSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_VerQueryValueA( const LPVOID pBlock, LPSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ) { static FN_VerQueryValueA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerQueryValueA", &g_Kernel32); return pfn( pBlock, lpSubBlock, lplpBuffer, puLen ); } typedef BOOL APIENTRY FN_VerQueryValueW( const LPVOID pBlock, LPWSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ); __declspec(dllexport) BOOL APIENTRY kPrf2Wrap_VerQueryValueW( const LPVOID pBlock, LPWSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ) { static FN_VerQueryValueW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerQueryValueW", &g_Kernel32); return pfn( pBlock, lpSubBlock, lplpBuffer, puLen ); } typedef VOID __cdecl FN_RtlRestoreContext( IN PCONTEXT ContextRecord, IN struct _EXCEPTION_RECORD * ExceptionRecord ); __declspec(dllexport) VOID __cdecl kPrf2Wrap_RtlRestoreContext( IN PCONTEXT ContextRecord, IN struct _EXCEPTION_RECORD * ExceptionRecord ) { static FN_RtlRestoreContext *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlRestoreContext", &g_Kernel32); pfn( ContextRecord, ExceptionRecord ); } typedef BOOLEAN __cdecl FN_RtlAddFunctionTable( IN PRUNTIME_FUNCTION FunctionTable, IN DWORD EntryCount, IN DWORD64 BaseAddress ); __declspec(dllexport) BOOLEAN __cdecl kPrf2Wrap_RtlAddFunctionTable( IN PRUNTIME_FUNCTION FunctionTable, IN DWORD EntryCount, IN DWORD64 BaseAddress ) { static FN_RtlAddFunctionTable *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlAddFunctionTable", &g_Kernel32); return pfn( FunctionTable, EntryCount, BaseAddress ); } typedef BOOLEAN __cdecl FN_RtlInstallFunctionTableCallback( IN DWORD64 TableIdentifier, IN DWORD64 BaseAddress, IN DWORD Length, IN PGET_RUNTIME_FUNCTION_CALLBACK Callback, IN PVOID Context, IN PCWSTR OutOfProcessCallbackDll ); __declspec(dllexport) BOOLEAN __cdecl kPrf2Wrap_RtlInstallFunctionTableCallback( IN DWORD64 TableIdentifier, IN DWORD64 BaseAddress, IN DWORD Length, IN PGET_RUNTIME_FUNCTION_CALLBACK Callback, IN PVOID Context, IN PCWSTR OutOfProcessCallbackDll ) { static FN_RtlInstallFunctionTableCallback *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlInstallFunctionTableCallback", &g_Kernel32); return pfn( TableIdentifier, BaseAddress, Length, Callback, Context, OutOfProcessCallbackDll ); } typedef BOOLEAN __cdecl FN_RtlDeleteFunctionTable( IN PRUNTIME_FUNCTION FunctionTable ); __declspec(dllexport) BOOLEAN __cdecl kPrf2Wrap_RtlDeleteFunctionTable( IN PRUNTIME_FUNCTION FunctionTable ) { static FN_RtlDeleteFunctionTable *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlDeleteFunctionTable", &g_Kernel32); return pfn( FunctionTable ); } typedef VOID NTAPI FN_RtlInitializeSListHead( IN PSLIST_HEADER ListHead ); __declspec(dllexport) VOID NTAPI kPrf2Wrap_RtlInitializeSListHead( IN PSLIST_HEADER ListHead ) { static FN_RtlInitializeSListHead *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlInitializeSListHead", &g_Kernel32); pfn( ListHead ); } typedef PSLIST_ENTRY NTAPI FN_RtlFirstEntrySList( IN const SLIST_HEADER * ListHead ); __declspec(dllexport) PSLIST_ENTRY NTAPI kPrf2Wrap_RtlFirstEntrySList( IN const SLIST_HEADER * ListHead ) { static FN_RtlFirstEntrySList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlFirstEntrySList", &g_Kernel32); return pfn( ListHead ); } typedef PSLIST_ENTRY NTAPI FN_RtlInterlockedPopEntrySList( IN PSLIST_HEADER ListHead ); __declspec(dllexport) PSLIST_ENTRY NTAPI kPrf2Wrap_RtlInterlockedPopEntrySList( IN PSLIST_HEADER ListHead ) { static FN_RtlInterlockedPopEntrySList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlInterlockedPopEntrySList", &g_Kernel32); return pfn( ListHead ); } typedef PSLIST_ENTRY NTAPI FN_RtlInterlockedPushEntrySList( IN PSLIST_HEADER ListHead, IN PSLIST_ENTRY ListEntry ); __declspec(dllexport) PSLIST_ENTRY NTAPI kPrf2Wrap_RtlInterlockedPushEntrySList( IN PSLIST_HEADER ListHead, IN PSLIST_ENTRY ListEntry ) { static FN_RtlInterlockedPushEntrySList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlInterlockedPushEntrySList", &g_Kernel32); return pfn( ListHead, ListEntry ); } typedef PSLIST_ENTRY NTAPI FN_RtlInterlockedFlushSList( IN PSLIST_HEADER ListHead ); __declspec(dllexport) PSLIST_ENTRY NTAPI kPrf2Wrap_RtlInterlockedFlushSList( IN PSLIST_HEADER ListHead ) { static FN_RtlInterlockedFlushSList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlInterlockedFlushSList", &g_Kernel32); return pfn( ListHead ); } typedef WORD NTAPI FN_RtlQueryDepthSList( IN PSLIST_HEADER ListHead ); __declspec(dllexport) WORD NTAPI kPrf2Wrap_RtlQueryDepthSList( IN PSLIST_HEADER ListHead ) { static FN_RtlQueryDepthSList *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlQueryDepthSList", &g_Kernel32); return pfn( ListHead ); } typedef VOID NTAPI FN_RtlCaptureContext( OUT PCONTEXT ContextRecord ); __declspec(dllexport) VOID NTAPI kPrf2Wrap_RtlCaptureContext( OUT PCONTEXT ContextRecord ) { static FN_RtlCaptureContext *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlCaptureContext", &g_Kernel32); pfn( ContextRecord ); } typedef SIZE_T NTAPI FN_RtlCompareMemory( const VOID * Source1, const VOID * Source2, SIZE_T Length ); __declspec(dllexport) SIZE_T NTAPI kPrf2Wrap_RtlCompareMemory( const VOID * Source1, const VOID * Source2, SIZE_T Length ) { static FN_RtlCompareMemory *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlCompareMemory", &g_Kernel32); return pfn( Source1, Source2, Length ); } typedef ULONGLONG NTAPI FN_VerSetConditionMask( IN ULONGLONG ConditionMask, IN DWORD TypeMask, IN BYTE Condition ); __declspec(dllexport) ULONGLONG NTAPI kPrf2Wrap_VerSetConditionMask( IN ULONGLONG ConditionMask, IN DWORD TypeMask, IN BYTE Condition ) { static FN_VerSetConditionMask *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "VerSetConditionMask", &g_Kernel32); return pfn( ConditionMask, TypeMask, Condition ); } typedef DWORD NTAPI FN_RtlSetHeapInformation( IN PVOID HeapHandle, IN HEAP_INFORMATION_CLASS HeapInformationClass, IN PVOID HeapInformation , IN SIZE_T HeapInformationLength ); __declspec(dllexport) DWORD NTAPI kPrf2Wrap_RtlSetHeapInformation( IN PVOID HeapHandle, IN HEAP_INFORMATION_CLASS HeapInformationClass, IN PVOID HeapInformation , IN SIZE_T HeapInformationLength ) { static FN_RtlSetHeapInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlSetHeapInformation", &g_Kernel32); return pfn( HeapHandle, HeapInformationClass, HeapInformation , HeapInformationLength ); } typedef DWORD NTAPI FN_RtlQueryHeapInformation( IN PVOID HeapHandle, IN HEAP_INFORMATION_CLASS HeapInformationClass, OUT PVOID HeapInformation , IN SIZE_T HeapInformationLength , OUT PSIZE_T ReturnLength ); __declspec(dllexport) DWORD NTAPI kPrf2Wrap_RtlQueryHeapInformation( IN PVOID HeapHandle, IN HEAP_INFORMATION_CLASS HeapInformationClass, OUT PVOID HeapInformation , IN SIZE_T HeapInformationLength , OUT PSIZE_T ReturnLength ) { static FN_RtlQueryHeapInformation *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlQueryHeapInformation", &g_Kernel32); return pfn( HeapHandle, HeapInformationClass, HeapInformation , HeapInformationLength , ReturnLength ); } typedef HANDLE WINAPI FN_CreateToolhelp32Snapshot( DWORD dwFlags, DWORD th32ProcessID ); __declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateToolhelp32Snapshot( DWORD dwFlags, DWORD th32ProcessID ) { static FN_CreateToolhelp32Snapshot *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "CreateToolhelp32Snapshot", &g_Kernel32); return pfn( dwFlags, th32ProcessID ); } typedef BOOL WINAPI FN_Heap32ListFirst( HANDLE hSnapshot, LPHEAPLIST32 lphl ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Heap32ListFirst( HANDLE hSnapshot, LPHEAPLIST32 lphl ) { static FN_Heap32ListFirst *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Heap32ListFirst", &g_Kernel32); return pfn( hSnapshot, lphl ); } typedef BOOL WINAPI FN_Heap32ListNext( HANDLE hSnapshot, LPHEAPLIST32 lphl ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Heap32ListNext( HANDLE hSnapshot, LPHEAPLIST32 lphl ) { static FN_Heap32ListNext *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Heap32ListNext", &g_Kernel32); return pfn( hSnapshot, lphl ); } typedef BOOL WINAPI FN_Heap32First( LPHEAPENTRY32 lphe, DWORD th32ProcessID, ULONG_PTR th32HeapID ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Heap32First( LPHEAPENTRY32 lphe, DWORD th32ProcessID, ULONG_PTR th32HeapID ) { static FN_Heap32First *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Heap32First", &g_Kernel32); return pfn( lphe, th32ProcessID, th32HeapID ); } typedef BOOL WINAPI FN_Heap32Next( LPHEAPENTRY32 lphe ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Heap32Next( LPHEAPENTRY32 lphe ) { static FN_Heap32Next *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Heap32Next", &g_Kernel32); return pfn( lphe ); } typedef BOOL WINAPI FN_Toolhelp32ReadProcessMemory( DWORD th32ProcessID, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T cbRead, SIZE_T * lpNumberOfBytesRead ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Toolhelp32ReadProcessMemory( DWORD th32ProcessID, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T cbRead, SIZE_T * lpNumberOfBytesRead ) { static FN_Toolhelp32ReadProcessMemory *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Toolhelp32ReadProcessMemory", &g_Kernel32); return pfn( th32ProcessID, lpBaseAddress, lpBuffer, cbRead, lpNumberOfBytesRead ); } typedef BOOL WINAPI FN_Process32FirstW( HANDLE hSnapshot, LPPROCESSENTRY32W lppe ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Process32FirstW( HANDLE hSnapshot, LPPROCESSENTRY32W lppe ) { static FN_Process32FirstW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Process32FirstW", &g_Kernel32); return pfn( hSnapshot, lppe ); } typedef BOOL WINAPI FN_Process32NextW( HANDLE hSnapshot, LPPROCESSENTRY32W lppe ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Process32NextW( HANDLE hSnapshot, LPPROCESSENTRY32W lppe ) { static FN_Process32NextW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Process32NextW", &g_Kernel32); return pfn( hSnapshot, lppe ); } typedef BOOL WINAPI FN_Process32First( HANDLE hSnapshot, LPPROCESSENTRY32 lppe ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Process32First( HANDLE hSnapshot, LPPROCESSENTRY32 lppe ) { static FN_Process32First *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Process32First", &g_Kernel32); return pfn( hSnapshot, lppe ); } typedef BOOL WINAPI FN_Process32Next( HANDLE hSnapshot, LPPROCESSENTRY32 lppe ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Process32Next( HANDLE hSnapshot, LPPROCESSENTRY32 lppe ) { static FN_Process32Next *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Process32Next", &g_Kernel32); return pfn( hSnapshot, lppe ); } typedef BOOL WINAPI FN_Thread32First( HANDLE hSnapshot, LPTHREADENTRY32 lpte ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Thread32First( HANDLE hSnapshot, LPTHREADENTRY32 lpte ) { static FN_Thread32First *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Thread32First", &g_Kernel32); return pfn( hSnapshot, lpte ); } typedef BOOL WINAPI FN_Thread32Next( HANDLE hSnapshot, LPTHREADENTRY32 lpte ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Thread32Next( HANDLE hSnapshot, LPTHREADENTRY32 lpte ) { static FN_Thread32Next *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Thread32Next", &g_Kernel32); return pfn( hSnapshot, lpte ); } typedef BOOL WINAPI FN_Module32FirstW( HANDLE hSnapshot, LPMODULEENTRY32W lpme ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Module32FirstW( HANDLE hSnapshot, LPMODULEENTRY32W lpme ) { static FN_Module32FirstW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Module32FirstW", &g_Kernel32); return pfn( hSnapshot, lpme ); } typedef BOOL WINAPI FN_Module32NextW( HANDLE hSnapshot, LPMODULEENTRY32W lpme ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Module32NextW( HANDLE hSnapshot, LPMODULEENTRY32W lpme ) { static FN_Module32NextW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Module32NextW", &g_Kernel32); return pfn( hSnapshot, lpme ); } typedef BOOL WINAPI FN_Module32First( HANDLE hSnapshot, LPMODULEENTRY32 lpme ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Module32First( HANDLE hSnapshot, LPMODULEENTRY32 lpme ) { static FN_Module32First *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Module32First", &g_Kernel32); return pfn( hSnapshot, lpme ); } typedef BOOL WINAPI FN_Module32Next( HANDLE hSnapshot, LPMODULEENTRY32 lpme ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_Module32Next( HANDLE hSnapshot, LPMODULEENTRY32 lpme ) { static FN_Module32Next *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "Module32Next", &g_Kernel32); return pfn( hSnapshot, lpme ); } typedef BOOL WINAPI FN_ReplaceFile( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReplaceFile( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ) { static FN_ReplaceFile *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "ReplaceFile", &g_Kernel32); return pfn( lpReplacedFileName, lpReplacementFileName, lpBackupFileName, dwReplaceFlags, lpExclude, lpReserved ); } typedef BOOL WINAPI FN_SetConsoleCursor( PVOID pvUnknown1, PVOID pvUnknown2 ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleCursor( PVOID pvUnknown1, PVOID pvUnknown2 ) { static FN_SetConsoleCursor *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "SetConsoleCursor", &g_Kernel32); return pfn( pvUnknown1, pvUnknown2 ); } typedef LPCH WINAPI FN_GetEnvironmentStringsA( VOID ); __declspec(dllexport) LPCH WINAPI kPrf2Wrap_GetEnvironmentStringsA( VOID ) { static FN_GetEnvironmentStringsA *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetEnvironmentStringsA", &g_Kernel32); return pfn (); } typedef BOOL WINAPI FN_GetBinaryType( LPCSTR lpApplicationName, LPDWORD lpBinaryType ); __declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetBinaryType( LPCSTR lpApplicationName, LPDWORD lpBinaryType ) { static FN_GetBinaryType *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "GetBinaryType", &g_Kernel32); return pfn( lpApplicationName, lpBinaryType ); } typedef WORD NTAPI FN_RtlCaptureStackBackTrace( DWORD FramesToSkip, DWORD FramesToCapture, PVOID * BackTrace, PDWORD BackTraceHash ); __declspec(dllexport) WORD NTAPI kPrf2Wrap_RtlCaptureStackBackTrace( DWORD FramesToSkip, DWORD FramesToCapture, PVOID * BackTrace, PDWORD BackTraceHash ) { static FN_RtlCaptureStackBackTrace *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlCaptureStackBackTrace", &g_Kernel32); return pfn( FramesToSkip, FramesToCapture, BackTrace, BackTraceHash ); } typedef PVOID FN_RtlFillMemory( PVOID pv, int ch, SIZE_T cb ); __declspec(dllexport) PVOID kPrf2Wrap_RtlFillMemory( PVOID pv, int ch, SIZE_T cb ) { static FN_RtlFillMemory *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlFillMemory", &g_Kernel32); return pfn( pv, ch, cb ); } typedef PVOID FN_RtlZeroMemory( PVOID pv, SIZE_T cb ); __declspec(dllexport) PVOID kPrf2Wrap_RtlZeroMemory( PVOID pv, SIZE_T cb ) { static FN_RtlZeroMemory *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlZeroMemory", &g_Kernel32); return pfn( pv, cb ); } typedef PVOID FN_RtlMoveMemory( PVOID pvDst, PVOID pvSrc, SIZE_T cb ); __declspec(dllexport) PVOID kPrf2Wrap_RtlMoveMemory( PVOID pvDst, PVOID pvSrc, SIZE_T cb ) { static FN_RtlMoveMemory *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlMoveMemory", &g_Kernel32); return pfn( pvDst, pvSrc, cb ); } typedef VOID NTAPI FN_RtlUnwind( PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue ); __declspec(dllexport) VOID NTAPI kPrf2Wrap_RtlUnwind( PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue ) { static FN_RtlUnwind *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlUnwind", &g_Kernel32); pfn( TargetFrame, TargetIp, ExceptionRecord, ReturnValue ); } typedef VOID NTAPI FN_RtlUnwindEx( FRAME_POINTERS TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable ); __declspec(dllexport) VOID NTAPI kPrf2Wrap_RtlUnwindEx( FRAME_POINTERS TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable ) { static FN_RtlUnwindEx *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlUnwindEx", &g_Kernel32); pfn( TargetFrame, TargetIp, ExceptionRecord, ReturnValue, ContextRecord, HistoryTable ); } typedef ULONGLONG WINAPI FN_RtlVirtualUnwind( ULONG HandlerType, ULONGLONG ImageBase, ULONGLONG ControlPC, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT ContextRecord, PBOOLEAN InFunction, PFRAME_POINTERS EstablisherFrame, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers ); __declspec(dllexport) ULONGLONG WINAPI kPrf2Wrap_RtlVirtualUnwind( ULONG HandlerType, ULONGLONG ImageBase, ULONGLONG ControlPC, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT ContextRecord, PBOOLEAN InFunction, PFRAME_POINTERS EstablisherFrame, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers ) { static FN_RtlVirtualUnwind *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlVirtualUnwind", &g_Kernel32); return pfn( HandlerType, ImageBase, ControlPC, FunctionEntry, ContextRecord, InFunction, EstablisherFrame, ContextPointers ); } typedef PVOID WINAPI FN_RtlPcToFileHeader( PVOID PcValue, PVOID * BaseOfImage ); __declspec(dllexport) PVOID WINAPI kPrf2Wrap_RtlPcToFileHeader( PVOID PcValue, PVOID * BaseOfImage ) { static FN_RtlPcToFileHeader *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlPcToFileHeader", &g_Kernel32); return pfn( PcValue, BaseOfImage ); } typedef PVOID WINAPI FN_RtlLookupFunctionEntry( ULONGLONG ControlPC, PULONGLONG ImageBase, PULONGLONG TargetGp ); __declspec(dllexport) PVOID WINAPI kPrf2Wrap_RtlLookupFunctionEntry( ULONGLONG ControlPC, PULONGLONG ImageBase, PULONGLONG TargetGp ) { static FN_RtlLookupFunctionEntry *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlLookupFunctionEntry", &g_Kernel32); return pfn( ControlPC, ImageBase, TargetGp ); } typedef void WINAPI FN_RtlRaiseException(PEXCEPTION_RECORD pXcpRec); __declspec(dllexport) void WINAPI kPrf2Wrap_RtlRaiseException(PEXCEPTION_RECORD pXcpRec) { static FN_RtlRaiseException *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "RtlRaiseException", &g_Kernel32); pfn( pXcpRec); } typedef int WINAPI FN_uaw_lstrcmpW( LPCUWSTR lpString1, LPCUWSTR lpString2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_uaw_lstrcmpW( LPCUWSTR lpString1, LPCUWSTR lpString2 ) { static FN_uaw_lstrcmpW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "uaw_lstrcmpW", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef int WINAPI FN_uaw_lstrcmpiW( LPCUWSTR lpString1, LPCUWSTR lpString2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_uaw_lstrcmpiW( LPCUWSTR lpString1, LPCUWSTR lpString2 ) { static FN_uaw_lstrcmpiW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "uaw_lstrcmpiW", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef int WINAPI FN_uaw_lstrlenW( LPCUWSTR lpString ); __declspec(dllexport) int WINAPI kPrf2Wrap_uaw_lstrlenW( LPCUWSTR lpString ) { static FN_uaw_lstrlenW *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "uaw_lstrlenW", &g_Kernel32); return pfn( lpString ); } typedef LPUWSTR WINAPI FN_uaw_wcschr( LPCUWSTR lpString, WCHAR wc ); __declspec(dllexport) LPUWSTR WINAPI kPrf2Wrap_uaw_wcschr( LPCUWSTR lpString, WCHAR wc ) { static FN_uaw_wcschr *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "uaw_wcschr", &g_Kernel32); return pfn( lpString, wc ); } typedef LPUWSTR WINAPI FN_uaw_wcscpy( LPUWSTR lpDst, LPCUWSTR lpSrc ); __declspec(dllexport) LPUWSTR WINAPI kPrf2Wrap_uaw_wcscpy( LPUWSTR lpDst, LPCUWSTR lpSrc ) { static FN_uaw_wcscpy *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "uaw_wcscpy", &g_Kernel32); return pfn( lpDst, lpSrc ); } typedef int WINAPI FN_uaw_wcsicmp( LPCUWSTR lp1, LPCUWSTR lp2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_uaw_wcsicmp( LPCUWSTR lp1, LPCUWSTR lp2 ) { static FN_uaw_wcsicmp *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "uaw_wcsicmp", &g_Kernel32); return pfn( lp1, lp2 ); } typedef SIZE_T WINAPI FN_uaw_wcslen( LPCUWSTR lp1 ); __declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_uaw_wcslen( LPCUWSTR lp1 ) { static FN_uaw_wcslen *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "uaw_wcslen", &g_Kernel32); return pfn( lp1 ); } typedef LPUWSTR WINAPI FN_uaw_wcsrchr( LPCUWSTR lpString, WCHAR wc ); __declspec(dllexport) LPUWSTR WINAPI kPrf2Wrap_uaw_wcsrchr( LPCUWSTR lpString, WCHAR wc ) { static FN_uaw_wcsrchr *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "uaw_wcsrchr", &g_Kernel32); return pfn( lpString, wc ); } typedef LPSTR WINAPI FN_lstrcat( LPSTR lpString1, LPCSTR lpString2 ); __declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcat( LPSTR lpString1, LPCSTR lpString2 ) { static FN_lstrcat *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcat", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef int WINAPI FN_lstrcmp( LPCSTR lpString1, LPCSTR lpString2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmp( LPCSTR lpString1, LPCSTR lpString2 ) { static FN_lstrcmp *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcmp", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef int WINAPI FN_lstrcmpi( LPCSTR lpString1, LPCSTR lpString2 ); __declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmpi( LPCSTR lpString1, LPCSTR lpString2 ) { static FN_lstrcmpi *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcmpi", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef LPSTR WINAPI FN_lstrcpy( LPSTR lpString1, LPCSTR lpString2 ); __declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcpy( LPSTR lpString1, LPCSTR lpString2 ) { static FN_lstrcpy *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcpy", &g_Kernel32); return pfn( lpString1, lpString2 ); } typedef LPSTR WINAPI FN_lstrcpyn( LPSTR lpString1, LPCSTR lpString2, int iMaxLength ); __declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcpyn( LPSTR lpString1, LPCSTR lpString2, int iMaxLength ) { static FN_lstrcpyn *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrcpyn", &g_Kernel32); return pfn( lpString1, lpString2, iMaxLength ); } typedef int WINAPI FN_lstrlen( LPCSTR lpString ); __declspec(dllexport) int WINAPI kPrf2Wrap_lstrlen( LPCSTR lpString ) { static FN_lstrlen *pfn = 0; if (!pfn) kPrf2WrapResolve((void **)&pfn, "lstrlen", &g_Kernel32); return pfn( lpString ); } ����������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappersImp-amd64.def������������������������������0000664�0001750�0001750�00000117534�14670377514�025434� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������LIBRARY kPrf2WinApiWrappers EXPORTS ActivateActCtx=kPrf2Wrap_ActivateActCtx AddAtomA=kPrf2Wrap_AddAtomA AddAtomW=kPrf2Wrap_AddAtomW AddConsoleAliasA=kPrf2Wrap_AddConsoleAliasA AddConsoleAliasW=kPrf2Wrap_AddConsoleAliasW AddRefActCtx=kPrf2Wrap_AddRefActCtx AddVectoredContinueHandler=kPrf2Wrap_AddVectoredContinueHandler AddVectoredExceptionHandler=kPrf2Wrap_AddVectoredExceptionHandler AllocConsole=kPrf2Wrap_AllocConsole AllocateUserPhysicalPages=kPrf2Wrap_AllocateUserPhysicalPages AreFileApisANSI=kPrf2Wrap_AreFileApisANSI AssignProcessToJobObject=kPrf2Wrap_AssignProcessToJobObject AttachConsole=kPrf2Wrap_AttachConsole BackupRead=kPrf2Wrap_BackupRead BackupSeek=kPrf2Wrap_BackupSeek BackupWrite=kPrf2Wrap_BackupWrite Beep=kPrf2Wrap_Beep BeginUpdateResourceA=kPrf2Wrap_BeginUpdateResourceA BeginUpdateResourceW=kPrf2Wrap_BeginUpdateResourceW BindIoCompletionCallback=kPrf2Wrap_BindIoCompletionCallback BuildCommDCBA=kPrf2Wrap_BuildCommDCBA BuildCommDCBAndTimeoutsA=kPrf2Wrap_BuildCommDCBAndTimeoutsA BuildCommDCBAndTimeoutsW=kPrf2Wrap_BuildCommDCBAndTimeoutsW BuildCommDCBW=kPrf2Wrap_BuildCommDCBW CallNamedPipeA=kPrf2Wrap_CallNamedPipeA CallNamedPipeW=kPrf2Wrap_CallNamedPipeW CancelDeviceWakeupRequest=kPrf2Wrap_CancelDeviceWakeupRequest CancelIo=kPrf2Wrap_CancelIo CancelTimerQueueTimer=kPrf2Wrap_CancelTimerQueueTimer CancelWaitableTimer=kPrf2Wrap_CancelWaitableTimer ChangeTimerQueueTimer=kPrf2Wrap_ChangeTimerQueueTimer CheckNameLegalDOS8Dot3A=kPrf2Wrap_CheckNameLegalDOS8Dot3A CheckNameLegalDOS8Dot3W=kPrf2Wrap_CheckNameLegalDOS8Dot3W CheckRemoteDebuggerPresent=kPrf2Wrap_CheckRemoteDebuggerPresent ClearCommBreak=kPrf2Wrap_ClearCommBreak ClearCommError=kPrf2Wrap_ClearCommError CloseHandle=kPrf2Wrap_CloseHandle CommConfigDialogA=kPrf2Wrap_CommConfigDialogA CommConfigDialogW=kPrf2Wrap_CommConfigDialogW CompareFileTime=kPrf2Wrap_CompareFileTime CompareStringA=kPrf2Wrap_CompareStringA CompareStringW=kPrf2Wrap_CompareStringW ConnectNamedPipe=kPrf2Wrap_ConnectNamedPipe ContinueDebugEvent=kPrf2Wrap_ContinueDebugEvent ConvertDefaultLocale=kPrf2Wrap_ConvertDefaultLocale ConvertFiberToThread=kPrf2Wrap_ConvertFiberToThread ConvertThreadToFiber=kPrf2Wrap_ConvertThreadToFiber ConvertThreadToFiberEx=kPrf2Wrap_ConvertThreadToFiberEx CopyFileA=kPrf2Wrap_CopyFileA CopyFileExA=kPrf2Wrap_CopyFileExA CopyFileExW=kPrf2Wrap_CopyFileExW CopyFileW=kPrf2Wrap_CopyFileW CreateActCtxA=kPrf2Wrap_CreateActCtxA CreateActCtxW=kPrf2Wrap_CreateActCtxW CreateConsoleScreenBuffer=kPrf2Wrap_CreateConsoleScreenBuffer CreateDirectoryA=kPrf2Wrap_CreateDirectoryA CreateDirectoryExA=kPrf2Wrap_CreateDirectoryExA CreateDirectoryExW=kPrf2Wrap_CreateDirectoryExW CreateDirectoryW=kPrf2Wrap_CreateDirectoryW CreateEventA=kPrf2Wrap_CreateEventA CreateEventW=kPrf2Wrap_CreateEventW CreateFiber=kPrf2Wrap_CreateFiber CreateFiberEx=kPrf2Wrap_CreateFiberEx CreateFileA=kPrf2Wrap_CreateFileA CreateFileMappingA=kPrf2Wrap_CreateFileMappingA CreateFileMappingW=kPrf2Wrap_CreateFileMappingW CreateFileW=kPrf2Wrap_CreateFileW CreateHardLinkA=kPrf2Wrap_CreateHardLinkA CreateHardLinkW=kPrf2Wrap_CreateHardLinkW CreateIoCompletionPort=kPrf2Wrap_CreateIoCompletionPort CreateJobObjectA=kPrf2Wrap_CreateJobObjectA CreateJobObjectW=kPrf2Wrap_CreateJobObjectW CreateJobSet=kPrf2Wrap_CreateJobSet CreateMailslotA=kPrf2Wrap_CreateMailslotA CreateMailslotW=kPrf2Wrap_CreateMailslotW CreateMemoryResourceNotification=kPrf2Wrap_CreateMemoryResourceNotification CreateMutexA=kPrf2Wrap_CreateMutexA CreateMutexW=kPrf2Wrap_CreateMutexW CreateNamedPipeA=kPrf2Wrap_CreateNamedPipeA CreateNamedPipeW=kPrf2Wrap_CreateNamedPipeW CreatePipe=kPrf2Wrap_CreatePipe CreateProcessA=kPrf2Wrap_CreateProcessA CreateProcessW=kPrf2Wrap_CreateProcessW CreateRemoteThread=kPrf2Wrap_CreateRemoteThread CreateSemaphoreA=kPrf2Wrap_CreateSemaphoreA CreateSemaphoreW=kPrf2Wrap_CreateSemaphoreW CreateTapePartition=kPrf2Wrap_CreateTapePartition CreateThread=kPrf2Wrap_CreateThread CreateTimerQueue=kPrf2Wrap_CreateTimerQueue CreateTimerQueueTimer=kPrf2Wrap_CreateTimerQueueTimer CreateToolhelp32Snapshot=kPrf2Wrap_CreateToolhelp32Snapshot CreateWaitableTimerA=kPrf2Wrap_CreateWaitableTimerA CreateWaitableTimerW=kPrf2Wrap_CreateWaitableTimerW DeactivateActCtx=kPrf2Wrap_DeactivateActCtx DebugActiveProcess=kPrf2Wrap_DebugActiveProcess DebugActiveProcessStop=kPrf2Wrap_DebugActiveProcessStop DebugBreak=kPrf2Wrap_DebugBreak DebugBreakProcess=kPrf2Wrap_DebugBreakProcess DebugSetProcessKillOnExit=kPrf2Wrap_DebugSetProcessKillOnExit DecodePointer=kPrf2Wrap_DecodePointer DecodeSystemPointer=kPrf2Wrap_DecodeSystemPointer DefineDosDeviceA=kPrf2Wrap_DefineDosDeviceA DefineDosDeviceW=kPrf2Wrap_DefineDosDeviceW DeleteAtom=kPrf2Wrap_DeleteAtom DeleteCriticalSection=kPrf2Wrap_DeleteCriticalSection DeleteFiber=kPrf2Wrap_DeleteFiber DeleteFileA=kPrf2Wrap_DeleteFileA DeleteFileW=kPrf2Wrap_DeleteFileW DeleteTimerQueue=kPrf2Wrap_DeleteTimerQueue DeleteTimerQueueEx=kPrf2Wrap_DeleteTimerQueueEx DeleteTimerQueueTimer=kPrf2Wrap_DeleteTimerQueueTimer DeleteVolumeMountPointA=kPrf2Wrap_DeleteVolumeMountPointA DeleteVolumeMountPointW=kPrf2Wrap_DeleteVolumeMountPointW DeviceIoControl=kPrf2Wrap_DeviceIoControl DisableThreadLibraryCalls=kPrf2Wrap_DisableThreadLibraryCalls DisconnectNamedPipe=kPrf2Wrap_DisconnectNamedPipe DnsHostnameToComputerNameA=kPrf2Wrap_DnsHostnameToComputerNameA DnsHostnameToComputerNameW=kPrf2Wrap_DnsHostnameToComputerNameW DosDateTimeToFileTime=kPrf2Wrap_DosDateTimeToFileTime DuplicateHandle=kPrf2Wrap_DuplicateHandle EncodePointer=kPrf2Wrap_EncodePointer EncodeSystemPointer=kPrf2Wrap_EncodeSystemPointer EndUpdateResourceA=kPrf2Wrap_EndUpdateResourceA EndUpdateResourceW=kPrf2Wrap_EndUpdateResourceW EnterCriticalSection=kPrf2Wrap_EnterCriticalSection EnumCalendarInfoA=kPrf2Wrap_EnumCalendarInfoA EnumCalendarInfoExA=kPrf2Wrap_EnumCalendarInfoExA EnumCalendarInfoExW=kPrf2Wrap_EnumCalendarInfoExW EnumCalendarInfoW=kPrf2Wrap_EnumCalendarInfoW EnumDateFormatsA=kPrf2Wrap_EnumDateFormatsA EnumDateFormatsExA=kPrf2Wrap_EnumDateFormatsExA EnumDateFormatsExW=kPrf2Wrap_EnumDateFormatsExW EnumDateFormatsW=kPrf2Wrap_EnumDateFormatsW EnumLanguageGroupLocalesA=kPrf2Wrap_EnumLanguageGroupLocalesA EnumLanguageGroupLocalesW=kPrf2Wrap_EnumLanguageGroupLocalesW EnumResourceLanguagesA=kPrf2Wrap_EnumResourceLanguagesA EnumResourceLanguagesW=kPrf2Wrap_EnumResourceLanguagesW EnumResourceNamesA=kPrf2Wrap_EnumResourceNamesA EnumResourceNamesW=kPrf2Wrap_EnumResourceNamesW EnumResourceTypesA=kPrf2Wrap_EnumResourceTypesA EnumResourceTypesW=kPrf2Wrap_EnumResourceTypesW EnumSystemCodePagesA=kPrf2Wrap_EnumSystemCodePagesA EnumSystemCodePagesW=kPrf2Wrap_EnumSystemCodePagesW EnumSystemFirmwareTables=kPrf2Wrap_EnumSystemFirmwareTables EnumSystemGeoID=kPrf2Wrap_EnumSystemGeoID EnumSystemLanguageGroupsA=kPrf2Wrap_EnumSystemLanguageGroupsA EnumSystemLanguageGroupsW=kPrf2Wrap_EnumSystemLanguageGroupsW EnumSystemLocalesA=kPrf2Wrap_EnumSystemLocalesA EnumSystemLocalesW=kPrf2Wrap_EnumSystemLocalesW EnumTimeFormatsA=kPrf2Wrap_EnumTimeFormatsA EnumTimeFormatsW=kPrf2Wrap_EnumTimeFormatsW EnumUILanguagesA=kPrf2Wrap_EnumUILanguagesA EnumUILanguagesW=kPrf2Wrap_EnumUILanguagesW EraseTape=kPrf2Wrap_EraseTape EscapeCommFunction=kPrf2Wrap_EscapeCommFunction ExitProcess=kPrf2Wrap_ExitProcess ExitThread=kPrf2Wrap_ExitThread ExpandEnvironmentStringsA=kPrf2Wrap_ExpandEnvironmentStringsA ExpandEnvironmentStringsW=kPrf2Wrap_ExpandEnvironmentStringsW FatalAppExitA=kPrf2Wrap_FatalAppExitA FatalAppExitW=kPrf2Wrap_FatalAppExitW FatalExit=kPrf2Wrap_FatalExit FileTimeToDosDateTime=kPrf2Wrap_FileTimeToDosDateTime FileTimeToLocalFileTime=kPrf2Wrap_FileTimeToLocalFileTime FileTimeToSystemTime=kPrf2Wrap_FileTimeToSystemTime FillConsoleOutputAttribute=kPrf2Wrap_FillConsoleOutputAttribute FillConsoleOutputCharacterA=kPrf2Wrap_FillConsoleOutputCharacterA FillConsoleOutputCharacterW=kPrf2Wrap_FillConsoleOutputCharacterW FindActCtxSectionGuid=kPrf2Wrap_FindActCtxSectionGuid FindActCtxSectionStringA=kPrf2Wrap_FindActCtxSectionStringA FindActCtxSectionStringW=kPrf2Wrap_FindActCtxSectionStringW FindAtomA=kPrf2Wrap_FindAtomA FindAtomW=kPrf2Wrap_FindAtomW FindClose=kPrf2Wrap_FindClose FindCloseChangeNotification=kPrf2Wrap_FindCloseChangeNotification FindFirstChangeNotificationA=kPrf2Wrap_FindFirstChangeNotificationA FindFirstChangeNotificationW=kPrf2Wrap_FindFirstChangeNotificationW FindFirstFileA=kPrf2Wrap_FindFirstFileA FindFirstFileExA=kPrf2Wrap_FindFirstFileExA FindFirstFileExW=kPrf2Wrap_FindFirstFileExW FindFirstFileW=kPrf2Wrap_FindFirstFileW FindFirstStreamW=kPrf2Wrap_FindFirstStreamW FindFirstVolumeA=kPrf2Wrap_FindFirstVolumeA FindFirstVolumeMountPointA=kPrf2Wrap_FindFirstVolumeMountPointA FindFirstVolumeMountPointW=kPrf2Wrap_FindFirstVolumeMountPointW FindFirstVolumeW=kPrf2Wrap_FindFirstVolumeW FindNextChangeNotification=kPrf2Wrap_FindNextChangeNotification FindNextFileA=kPrf2Wrap_FindNextFileA FindNextFileW=kPrf2Wrap_FindNextFileW FindNextStreamW=kPrf2Wrap_FindNextStreamW FindNextVolumeA=kPrf2Wrap_FindNextVolumeA FindNextVolumeMountPointA=kPrf2Wrap_FindNextVolumeMountPointA FindNextVolumeMountPointW=kPrf2Wrap_FindNextVolumeMountPointW FindNextVolumeW=kPrf2Wrap_FindNextVolumeW FindResourceA=kPrf2Wrap_FindResourceA FindResourceExA=kPrf2Wrap_FindResourceExA FindResourceExW=kPrf2Wrap_FindResourceExW FindResourceW=kPrf2Wrap_FindResourceW FindVolumeClose=kPrf2Wrap_FindVolumeClose FindVolumeMountPointClose=kPrf2Wrap_FindVolumeMountPointClose FlsAlloc=kPrf2Wrap_FlsAlloc FlsFree=kPrf2Wrap_FlsFree FlsGetValue=kPrf2Wrap_FlsGetValue FlsSetValue=kPrf2Wrap_FlsSetValue FlushConsoleInputBuffer=kPrf2Wrap_FlushConsoleInputBuffer FlushFileBuffers=kPrf2Wrap_FlushFileBuffers FlushInstructionCache=kPrf2Wrap_FlushInstructionCache FlushViewOfFile=kPrf2Wrap_FlushViewOfFile FoldStringA=kPrf2Wrap_FoldStringA FoldStringW=kPrf2Wrap_FoldStringW FormatMessageA=kPrf2Wrap_FormatMessageA FormatMessageW=kPrf2Wrap_FormatMessageW FreeConsole=kPrf2Wrap_FreeConsole FreeEnvironmentStringsA=kPrf2Wrap_FreeEnvironmentStringsA FreeEnvironmentStringsW=kPrf2Wrap_FreeEnvironmentStringsW FreeLibrary=kPrf2Wrap_FreeLibrary FreeLibraryAndExitThread=kPrf2Wrap_FreeLibraryAndExitThread FreeResource=kPrf2Wrap_FreeResource FreeUserPhysicalPages=kPrf2Wrap_FreeUserPhysicalPages GenerateConsoleCtrlEvent=kPrf2Wrap_GenerateConsoleCtrlEvent GetACP=kPrf2Wrap_GetACP GetAtomNameA=kPrf2Wrap_GetAtomNameA GetAtomNameW=kPrf2Wrap_GetAtomNameW GetBinaryType=kPrf2Wrap_GetBinaryType GetBinaryTypeA=kPrf2Wrap_GetBinaryTypeA GetBinaryTypeW=kPrf2Wrap_GetBinaryTypeW GetCPInfo=kPrf2Wrap_GetCPInfo GetCPInfoExA=kPrf2Wrap_GetCPInfoExA GetCPInfoExW=kPrf2Wrap_GetCPInfoExW GetCalendarInfoA=kPrf2Wrap_GetCalendarInfoA GetCalendarInfoW=kPrf2Wrap_GetCalendarInfoW GetCommConfig=kPrf2Wrap_GetCommConfig GetCommMask=kPrf2Wrap_GetCommMask GetCommModemStatus=kPrf2Wrap_GetCommModemStatus GetCommProperties=kPrf2Wrap_GetCommProperties GetCommState=kPrf2Wrap_GetCommState GetCommTimeouts=kPrf2Wrap_GetCommTimeouts GetCommandLineA=kPrf2Wrap_GetCommandLineA GetCommandLineW=kPrf2Wrap_GetCommandLineW GetCompressedFileSizeA=kPrf2Wrap_GetCompressedFileSizeA GetCompressedFileSizeW=kPrf2Wrap_GetCompressedFileSizeW GetComputerNameA=kPrf2Wrap_GetComputerNameA GetComputerNameExA=kPrf2Wrap_GetComputerNameExA GetComputerNameExW=kPrf2Wrap_GetComputerNameExW GetComputerNameW=kPrf2Wrap_GetComputerNameW GetConsoleAliasA=kPrf2Wrap_GetConsoleAliasA GetConsoleAliasExesA=kPrf2Wrap_GetConsoleAliasExesA GetConsoleAliasExesLengthA=kPrf2Wrap_GetConsoleAliasExesLengthA GetConsoleAliasExesLengthW=kPrf2Wrap_GetConsoleAliasExesLengthW GetConsoleAliasExesW=kPrf2Wrap_GetConsoleAliasExesW GetConsoleAliasW=kPrf2Wrap_GetConsoleAliasW GetConsoleAliasesA=kPrf2Wrap_GetConsoleAliasesA GetConsoleAliasesLengthA=kPrf2Wrap_GetConsoleAliasesLengthA GetConsoleAliasesLengthW=kPrf2Wrap_GetConsoleAliasesLengthW GetConsoleAliasesW=kPrf2Wrap_GetConsoleAliasesW GetConsoleCP=kPrf2Wrap_GetConsoleCP GetConsoleCursorInfo=kPrf2Wrap_GetConsoleCursorInfo GetConsoleDisplayMode=kPrf2Wrap_GetConsoleDisplayMode GetConsoleFontSize=kPrf2Wrap_GetConsoleFontSize GetConsoleMode=kPrf2Wrap_GetConsoleMode GetConsoleOutputCP=kPrf2Wrap_GetConsoleOutputCP GetConsoleProcessList=kPrf2Wrap_GetConsoleProcessList GetConsoleScreenBufferInfo=kPrf2Wrap_GetConsoleScreenBufferInfo GetConsoleSelectionInfo=kPrf2Wrap_GetConsoleSelectionInfo GetConsoleTitleA=kPrf2Wrap_GetConsoleTitleA GetConsoleTitleW=kPrf2Wrap_GetConsoleTitleW GetConsoleWindow=kPrf2Wrap_GetConsoleWindow GetCurrencyFormatA=kPrf2Wrap_GetCurrencyFormatA GetCurrencyFormatW=kPrf2Wrap_GetCurrencyFormatW GetCurrentActCtx=kPrf2Wrap_GetCurrentActCtx GetCurrentConsoleFont=kPrf2Wrap_GetCurrentConsoleFont GetCurrentDirectoryA=kPrf2Wrap_GetCurrentDirectoryA GetCurrentDirectoryW=kPrf2Wrap_GetCurrentDirectoryW GetCurrentProcess=kPrf2Wrap_GetCurrentProcess GetCurrentProcessId=kPrf2Wrap_GetCurrentProcessId GetCurrentProcessorNumber=kPrf2Wrap_GetCurrentProcessorNumber GetCurrentThread=kPrf2Wrap_GetCurrentThread GetCurrentThreadId=kPrf2Wrap_GetCurrentThreadId GetDateFormatA=kPrf2Wrap_GetDateFormatA GetDateFormatW=kPrf2Wrap_GetDateFormatW GetDefaultCommConfigA=kPrf2Wrap_GetDefaultCommConfigA GetDefaultCommConfigW=kPrf2Wrap_GetDefaultCommConfigW GetDevicePowerState=kPrf2Wrap_GetDevicePowerState GetDiskFreeSpaceA=kPrf2Wrap_GetDiskFreeSpaceA GetDiskFreeSpaceExA=kPrf2Wrap_GetDiskFreeSpaceExA GetDiskFreeSpaceExW=kPrf2Wrap_GetDiskFreeSpaceExW GetDiskFreeSpaceW=kPrf2Wrap_GetDiskFreeSpaceW GetDllDirectoryA=kPrf2Wrap_GetDllDirectoryA GetDllDirectoryW=kPrf2Wrap_GetDllDirectoryW GetDriveTypeA=kPrf2Wrap_GetDriveTypeA GetDriveTypeW=kPrf2Wrap_GetDriveTypeW GetEnvironmentStrings=kPrf2Wrap_GetEnvironmentStrings GetEnvironmentStringsA=kPrf2Wrap_GetEnvironmentStringsA GetEnvironmentStringsW=kPrf2Wrap_GetEnvironmentStringsW GetEnvironmentVariableA=kPrf2Wrap_GetEnvironmentVariableA GetEnvironmentVariableW=kPrf2Wrap_GetEnvironmentVariableW GetExitCodeProcess=kPrf2Wrap_GetExitCodeProcess GetExitCodeThread=kPrf2Wrap_GetExitCodeThread GetFileAttributesA=kPrf2Wrap_GetFileAttributesA GetFileAttributesExA=kPrf2Wrap_GetFileAttributesExA GetFileAttributesExW=kPrf2Wrap_GetFileAttributesExW GetFileAttributesW=kPrf2Wrap_GetFileAttributesW GetFileInformationByHandle=kPrf2Wrap_GetFileInformationByHandle GetFileSize=kPrf2Wrap_GetFileSize GetFileSizeEx=kPrf2Wrap_GetFileSizeEx GetFileTime=kPrf2Wrap_GetFileTime GetFileType=kPrf2Wrap_GetFileType GetFirmwareEnvironmentVariableA=kPrf2Wrap_GetFirmwareEnvironmentVariableA GetFirmwareEnvironmentVariableW=kPrf2Wrap_GetFirmwareEnvironmentVariableW GetFullPathNameA=kPrf2Wrap_GetFullPathNameA GetFullPathNameW=kPrf2Wrap_GetFullPathNameW GetGeoInfoA=kPrf2Wrap_GetGeoInfoA GetGeoInfoW=kPrf2Wrap_GetGeoInfoW GetHandleInformation=kPrf2Wrap_GetHandleInformation GetLargePageMinimum=kPrf2Wrap_GetLargePageMinimum GetLargestConsoleWindowSize=kPrf2Wrap_GetLargestConsoleWindowSize GetLastError=kPrf2Wrap_GetLastError GetLocalTime=kPrf2Wrap_GetLocalTime GetLocaleInfoA=kPrf2Wrap_GetLocaleInfoA GetLocaleInfoW=kPrf2Wrap_GetLocaleInfoW GetLogicalDriveStringsA=kPrf2Wrap_GetLogicalDriveStringsA GetLogicalDriveStringsW=kPrf2Wrap_GetLogicalDriveStringsW GetLogicalDrives=kPrf2Wrap_GetLogicalDrives GetLogicalProcessorInformation=kPrf2Wrap_GetLogicalProcessorInformation GetLongPathNameA=kPrf2Wrap_GetLongPathNameA GetLongPathNameW=kPrf2Wrap_GetLongPathNameW GetMailslotInfo=kPrf2Wrap_GetMailslotInfo GetModuleFileNameA=kPrf2Wrap_GetModuleFileNameA GetModuleFileNameW=kPrf2Wrap_GetModuleFileNameW GetModuleHandleA=kPrf2Wrap_GetModuleHandleA GetModuleHandleExA=kPrf2Wrap_GetModuleHandleExA GetModuleHandleExW=kPrf2Wrap_GetModuleHandleExW GetModuleHandleW=kPrf2Wrap_GetModuleHandleW GetNLSVersion=kPrf2Wrap_GetNLSVersion GetNamedPipeHandleStateA=kPrf2Wrap_GetNamedPipeHandleStateA GetNamedPipeHandleStateW=kPrf2Wrap_GetNamedPipeHandleStateW GetNamedPipeInfo=kPrf2Wrap_GetNamedPipeInfo GetNativeSystemInfo=kPrf2Wrap_GetNativeSystemInfo GetNumaAvailableMemoryNode=kPrf2Wrap_GetNumaAvailableMemoryNode GetNumaHighestNodeNumber=kPrf2Wrap_GetNumaHighestNodeNumber GetNumaNodeProcessorMask=kPrf2Wrap_GetNumaNodeProcessorMask GetNumaProcessorNode=kPrf2Wrap_GetNumaProcessorNode GetNumberFormatA=kPrf2Wrap_GetNumberFormatA GetNumberFormatW=kPrf2Wrap_GetNumberFormatW GetNumberOfConsoleInputEvents=kPrf2Wrap_GetNumberOfConsoleInputEvents GetNumberOfConsoleMouseButtons=kPrf2Wrap_GetNumberOfConsoleMouseButtons GetOEMCP=kPrf2Wrap_GetOEMCP GetOverlappedResult=kPrf2Wrap_GetOverlappedResult GetPriorityClass=kPrf2Wrap_GetPriorityClass GetPrivateProfileIntA=kPrf2Wrap_GetPrivateProfileIntA GetPrivateProfileIntW=kPrf2Wrap_GetPrivateProfileIntW GetPrivateProfileSectionA=kPrf2Wrap_GetPrivateProfileSectionA GetPrivateProfileSectionNamesA=kPrf2Wrap_GetPrivateProfileSectionNamesA GetPrivateProfileSectionNamesW=kPrf2Wrap_GetPrivateProfileSectionNamesW GetPrivateProfileSectionW=kPrf2Wrap_GetPrivateProfileSectionW GetPrivateProfileStringA=kPrf2Wrap_GetPrivateProfileStringA GetPrivateProfileStringW=kPrf2Wrap_GetPrivateProfileStringW GetPrivateProfileStructA=kPrf2Wrap_GetPrivateProfileStructA GetPrivateProfileStructW=kPrf2Wrap_GetPrivateProfileStructW GetProcAddress=kPrf2Wrap_GetProcAddress GetProcessAffinityMask=kPrf2Wrap_GetProcessAffinityMask GetProcessHandleCount=kPrf2Wrap_GetProcessHandleCount GetProcessHeap=kPrf2Wrap_GetProcessHeap GetProcessHeaps=kPrf2Wrap_GetProcessHeaps GetProcessId=kPrf2Wrap_GetProcessId GetProcessIdOfThread=kPrf2Wrap_GetProcessIdOfThread GetProcessIoCounters=kPrf2Wrap_GetProcessIoCounters GetProcessPriorityBoost=kPrf2Wrap_GetProcessPriorityBoost GetProcessShutdownParameters=kPrf2Wrap_GetProcessShutdownParameters GetProcessTimes=kPrf2Wrap_GetProcessTimes GetProcessVersion=kPrf2Wrap_GetProcessVersion GetProcessWorkingSetSize=kPrf2Wrap_GetProcessWorkingSetSize GetProcessWorkingSetSizeEx=kPrf2Wrap_GetProcessWorkingSetSizeEx GetProfileIntA=kPrf2Wrap_GetProfileIntA GetProfileIntW=kPrf2Wrap_GetProfileIntW GetProfileSectionA=kPrf2Wrap_GetProfileSectionA GetProfileSectionW=kPrf2Wrap_GetProfileSectionW GetProfileStringA=kPrf2Wrap_GetProfileStringA GetProfileStringW=kPrf2Wrap_GetProfileStringW GetQueuedCompletionStatus=kPrf2Wrap_GetQueuedCompletionStatus GetShortPathNameA=kPrf2Wrap_GetShortPathNameA GetShortPathNameW=kPrf2Wrap_GetShortPathNameW GetStartupInfoA=kPrf2Wrap_GetStartupInfoA GetStartupInfoW=kPrf2Wrap_GetStartupInfoW GetStdHandle=kPrf2Wrap_GetStdHandle GetStringTypeA=kPrf2Wrap_GetStringTypeA GetStringTypeExA=kPrf2Wrap_GetStringTypeExA GetStringTypeExW=kPrf2Wrap_GetStringTypeExW GetStringTypeW=kPrf2Wrap_GetStringTypeW GetSystemDefaultLCID=kPrf2Wrap_GetSystemDefaultLCID GetSystemDefaultLangID=kPrf2Wrap_GetSystemDefaultLangID GetSystemDefaultUILanguage=kPrf2Wrap_GetSystemDefaultUILanguage GetSystemDirectoryA=kPrf2Wrap_GetSystemDirectoryA GetSystemDirectoryW=kPrf2Wrap_GetSystemDirectoryW GetSystemFileCacheSize=kPrf2Wrap_GetSystemFileCacheSize GetSystemFirmwareTable=kPrf2Wrap_GetSystemFirmwareTable GetSystemInfo=kPrf2Wrap_GetSystemInfo GetSystemPowerStatus=kPrf2Wrap_GetSystemPowerStatus GetSystemRegistryQuota=kPrf2Wrap_GetSystemRegistryQuota GetSystemTime=kPrf2Wrap_GetSystemTime GetSystemTimeAdjustment=kPrf2Wrap_GetSystemTimeAdjustment GetSystemTimeAsFileTime=kPrf2Wrap_GetSystemTimeAsFileTime GetSystemTimes=kPrf2Wrap_GetSystemTimes GetSystemWindowsDirectoryA=kPrf2Wrap_GetSystemWindowsDirectoryA GetSystemWindowsDirectoryW=kPrf2Wrap_GetSystemWindowsDirectoryW GetSystemWow64DirectoryA=kPrf2Wrap_GetSystemWow64DirectoryA GetSystemWow64DirectoryW=kPrf2Wrap_GetSystemWow64DirectoryW GetTapeParameters=kPrf2Wrap_GetTapeParameters GetTapePosition=kPrf2Wrap_GetTapePosition GetTapeStatus=kPrf2Wrap_GetTapeStatus GetTempFileNameA=kPrf2Wrap_GetTempFileNameA GetTempFileNameW=kPrf2Wrap_GetTempFileNameW GetTempPathA=kPrf2Wrap_GetTempPathA GetTempPathW=kPrf2Wrap_GetTempPathW GetThreadContext=kPrf2Wrap_GetThreadContext GetThreadIOPendingFlag=kPrf2Wrap_GetThreadIOPendingFlag GetThreadId=kPrf2Wrap_GetThreadId GetThreadLocale=kPrf2Wrap_GetThreadLocale GetThreadPriority=kPrf2Wrap_GetThreadPriority GetThreadPriorityBoost=kPrf2Wrap_GetThreadPriorityBoost GetThreadSelectorEntry=kPrf2Wrap_GetThreadSelectorEntry GetThreadTimes=kPrf2Wrap_GetThreadTimes GetTickCount=kPrf2Wrap_GetTickCount GetTimeFormatA=kPrf2Wrap_GetTimeFormatA GetTimeFormatW=kPrf2Wrap_GetTimeFormatW GetTimeZoneInformation=kPrf2Wrap_GetTimeZoneInformation GetUserDefaultLCID=kPrf2Wrap_GetUserDefaultLCID GetUserDefaultLangID=kPrf2Wrap_GetUserDefaultLangID GetUserDefaultUILanguage=kPrf2Wrap_GetUserDefaultUILanguage GetUserGeoID=kPrf2Wrap_GetUserGeoID GetVersion=kPrf2Wrap_GetVersion GetVersionExA=kPrf2Wrap_GetVersionExA GetVersionExW=kPrf2Wrap_GetVersionExW GetVolumeInformationA=kPrf2Wrap_GetVolumeInformationA GetVolumeInformationW=kPrf2Wrap_GetVolumeInformationW GetVolumeNameForVolumeMountPointA=kPrf2Wrap_GetVolumeNameForVolumeMountPointA GetVolumeNameForVolumeMountPointW=kPrf2Wrap_GetVolumeNameForVolumeMountPointW GetVolumePathNameA=kPrf2Wrap_GetVolumePathNameA GetVolumePathNameW=kPrf2Wrap_GetVolumePathNameW GetVolumePathNamesForVolumeNameA=kPrf2Wrap_GetVolumePathNamesForVolumeNameA GetVolumePathNamesForVolumeNameW=kPrf2Wrap_GetVolumePathNamesForVolumeNameW GetWindowsDirectoryA=kPrf2Wrap_GetWindowsDirectoryA GetWindowsDirectoryW=kPrf2Wrap_GetWindowsDirectoryW GetWriteWatch=kPrf2Wrap_GetWriteWatch GlobalAddAtomA=kPrf2Wrap_GlobalAddAtomA GlobalAddAtomW=kPrf2Wrap_GlobalAddAtomW GlobalAlloc=kPrf2Wrap_GlobalAlloc GlobalCompact=kPrf2Wrap_GlobalCompact GlobalDeleteAtom=kPrf2Wrap_GlobalDeleteAtom GlobalFindAtomA=kPrf2Wrap_GlobalFindAtomA GlobalFindAtomW=kPrf2Wrap_GlobalFindAtomW GlobalFix=kPrf2Wrap_GlobalFix GlobalFlags=kPrf2Wrap_GlobalFlags GlobalFree=kPrf2Wrap_GlobalFree GlobalGetAtomNameA=kPrf2Wrap_GlobalGetAtomNameA GlobalGetAtomNameW=kPrf2Wrap_GlobalGetAtomNameW GlobalHandle=kPrf2Wrap_GlobalHandle GlobalLock=kPrf2Wrap_GlobalLock GlobalMemoryStatus=kPrf2Wrap_GlobalMemoryStatus GlobalMemoryStatusEx=kPrf2Wrap_GlobalMemoryStatusEx GlobalReAlloc=kPrf2Wrap_GlobalReAlloc GlobalSize=kPrf2Wrap_GlobalSize GlobalUnWire=kPrf2Wrap_GlobalUnWire GlobalUnfix=kPrf2Wrap_GlobalUnfix GlobalUnlock=kPrf2Wrap_GlobalUnlock GlobalWire=kPrf2Wrap_GlobalWire Heap32First=kPrf2Wrap_Heap32First Heap32ListFirst=kPrf2Wrap_Heap32ListFirst Heap32ListNext=kPrf2Wrap_Heap32ListNext Heap32Next=kPrf2Wrap_Heap32Next HeapAlloc=kPrf2Wrap_HeapAlloc HeapCompact=kPrf2Wrap_HeapCompact HeapCreate=kPrf2Wrap_HeapCreate HeapDestroy=kPrf2Wrap_HeapDestroy HeapFree=kPrf2Wrap_HeapFree HeapLock=kPrf2Wrap_HeapLock HeapQueryInformation=kPrf2Wrap_HeapQueryInformation HeapReAlloc=kPrf2Wrap_HeapReAlloc HeapSetInformation=kPrf2Wrap_HeapSetInformation HeapSize=kPrf2Wrap_HeapSize HeapUnlock=kPrf2Wrap_HeapUnlock HeapValidate=kPrf2Wrap_HeapValidate HeapWalk=kPrf2Wrap_HeapWalk InitAtomTable=kPrf2Wrap_InitAtomTable InitializeCriticalSection=kPrf2Wrap_InitializeCriticalSection InitializeCriticalSectionAndSpinCount=kPrf2Wrap_InitializeCriticalSectionAndSpinCount InitializeSListHead=kPrf2Wrap_InitializeSListHead InterlockedFlushSList=kPrf2Wrap_InterlockedFlushSList InterlockedPopEntrySList=kPrf2Wrap_InterlockedPopEntrySList InterlockedPushEntrySList=kPrf2Wrap_InterlockedPushEntrySList IsBadCodePtr=kPrf2Wrap_IsBadCodePtr IsBadHugeReadPtr=kPrf2Wrap_IsBadHugeReadPtr IsBadHugeWritePtr=kPrf2Wrap_IsBadHugeWritePtr IsBadReadPtr=kPrf2Wrap_IsBadReadPtr IsBadStringPtrA=kPrf2Wrap_IsBadStringPtrA IsBadStringPtrW=kPrf2Wrap_IsBadStringPtrW IsBadWritePtr=kPrf2Wrap_IsBadWritePtr IsDBCSLeadByte=kPrf2Wrap_IsDBCSLeadByte IsDBCSLeadByteEx=kPrf2Wrap_IsDBCSLeadByteEx IsDebuggerPresent=kPrf2Wrap_IsDebuggerPresent IsNLSDefinedString=kPrf2Wrap_IsNLSDefinedString IsProcessInJob=kPrf2Wrap_IsProcessInJob IsProcessorFeaturePresent=kPrf2Wrap_IsProcessorFeaturePresent IsSystemResumeAutomatic=kPrf2Wrap_IsSystemResumeAutomatic IsValidCodePage=kPrf2Wrap_IsValidCodePage IsValidLanguageGroup=kPrf2Wrap_IsValidLanguageGroup IsValidLocale=kPrf2Wrap_IsValidLocale IsWow64Process=kPrf2Wrap_IsWow64Process LCMapStringA=kPrf2Wrap_LCMapStringA LCMapStringW=kPrf2Wrap_LCMapStringW LeaveCriticalSection=kPrf2Wrap_LeaveCriticalSection LoadLibraryA=kPrf2Wrap_LoadLibraryA LoadLibraryExA=kPrf2Wrap_LoadLibraryExA LoadLibraryExW=kPrf2Wrap_LoadLibraryExW LoadLibraryW=kPrf2Wrap_LoadLibraryW LoadModule=kPrf2Wrap_LoadModule LoadResource=kPrf2Wrap_LoadResource LocalAlloc=kPrf2Wrap_LocalAlloc LocalCompact=kPrf2Wrap_LocalCompact LocalFileTimeToFileTime=kPrf2Wrap_LocalFileTimeToFileTime LocalFlags=kPrf2Wrap_LocalFlags LocalFree=kPrf2Wrap_LocalFree LocalHandle=kPrf2Wrap_LocalHandle LocalLock=kPrf2Wrap_LocalLock LocalReAlloc=kPrf2Wrap_LocalReAlloc LocalShrink=kPrf2Wrap_LocalShrink LocalSize=kPrf2Wrap_LocalSize LocalUnlock=kPrf2Wrap_LocalUnlock LockFile=kPrf2Wrap_LockFile LockFileEx=kPrf2Wrap_LockFileEx LockResource=kPrf2Wrap_LockResource MapUserPhysicalPages=kPrf2Wrap_MapUserPhysicalPages MapUserPhysicalPagesScatter=kPrf2Wrap_MapUserPhysicalPagesScatter MapViewOfFile=kPrf2Wrap_MapViewOfFile MapViewOfFileEx=kPrf2Wrap_MapViewOfFileEx Module32First=kPrf2Wrap_Module32First Module32FirstW=kPrf2Wrap_Module32FirstW Module32Next=kPrf2Wrap_Module32Next Module32NextW=kPrf2Wrap_Module32NextW MoveFileA=kPrf2Wrap_MoveFileA MoveFileExA=kPrf2Wrap_MoveFileExA MoveFileExW=kPrf2Wrap_MoveFileExW MoveFileW=kPrf2Wrap_MoveFileW MoveFileWithProgressA=kPrf2Wrap_MoveFileWithProgressA MoveFileWithProgressW=kPrf2Wrap_MoveFileWithProgressW MulDiv=kPrf2Wrap_MulDiv MultiByteToWideChar=kPrf2Wrap_MultiByteToWideChar NeedCurrentDirectoryForExePathA=kPrf2Wrap_NeedCurrentDirectoryForExePathA NeedCurrentDirectoryForExePathW=kPrf2Wrap_NeedCurrentDirectoryForExePathW OpenEventA=kPrf2Wrap_OpenEventA OpenEventW=kPrf2Wrap_OpenEventW OpenFile=kPrf2Wrap_OpenFile OpenFileMappingA=kPrf2Wrap_OpenFileMappingA OpenFileMappingW=kPrf2Wrap_OpenFileMappingW OpenJobObjectA=kPrf2Wrap_OpenJobObjectA OpenJobObjectW=kPrf2Wrap_OpenJobObjectW OpenMutexA=kPrf2Wrap_OpenMutexA OpenMutexW=kPrf2Wrap_OpenMutexW OpenProcess=kPrf2Wrap_OpenProcess OpenSemaphoreA=kPrf2Wrap_OpenSemaphoreA OpenSemaphoreW=kPrf2Wrap_OpenSemaphoreW OpenThread=kPrf2Wrap_OpenThread OpenWaitableTimerA=kPrf2Wrap_OpenWaitableTimerA OpenWaitableTimerW=kPrf2Wrap_OpenWaitableTimerW OutputDebugStringA=kPrf2Wrap_OutputDebugStringA OutputDebugStringW=kPrf2Wrap_OutputDebugStringW PeekConsoleInputA=kPrf2Wrap_PeekConsoleInputA PeekConsoleInputW=kPrf2Wrap_PeekConsoleInputW PeekNamedPipe=kPrf2Wrap_PeekNamedPipe PostQueuedCompletionStatus=kPrf2Wrap_PostQueuedCompletionStatus PrepareTape=kPrf2Wrap_PrepareTape Process32First=kPrf2Wrap_Process32First Process32FirstW=kPrf2Wrap_Process32FirstW Process32Next=kPrf2Wrap_Process32Next Process32NextW=kPrf2Wrap_Process32NextW ProcessIdToSessionId=kPrf2Wrap_ProcessIdToSessionId PulseEvent=kPrf2Wrap_PulseEvent PurgeComm=kPrf2Wrap_PurgeComm QueryActCtxW=kPrf2Wrap_QueryActCtxW QueryDepthSList=kPrf2Wrap_QueryDepthSList QueryDosDeviceA=kPrf2Wrap_QueryDosDeviceA QueryDosDeviceW=kPrf2Wrap_QueryDosDeviceW QueryInformationJobObject=kPrf2Wrap_QueryInformationJobObject QueryMemoryResourceNotification=kPrf2Wrap_QueryMemoryResourceNotification QueryPerformanceCounter=kPrf2Wrap_QueryPerformanceCounter QueryPerformanceFrequency=kPrf2Wrap_QueryPerformanceFrequency QueueUserAPC=kPrf2Wrap_QueueUserAPC QueueUserWorkItem=kPrf2Wrap_QueueUserWorkItem RaiseException=kPrf2Wrap_RaiseException ReOpenFile=kPrf2Wrap_ReOpenFile ReadConsoleA=kPrf2Wrap_ReadConsoleA ReadConsoleInputA=kPrf2Wrap_ReadConsoleInputA ReadConsoleInputW=kPrf2Wrap_ReadConsoleInputW ReadConsoleOutputA=kPrf2Wrap_ReadConsoleOutputA ReadConsoleOutputAttribute=kPrf2Wrap_ReadConsoleOutputAttribute ReadConsoleOutputCharacterA=kPrf2Wrap_ReadConsoleOutputCharacterA ReadConsoleOutputCharacterW=kPrf2Wrap_ReadConsoleOutputCharacterW ReadConsoleOutputW=kPrf2Wrap_ReadConsoleOutputW ReadConsoleW=kPrf2Wrap_ReadConsoleW ReadDirectoryChangesW=kPrf2Wrap_ReadDirectoryChangesW ReadFile=kPrf2Wrap_ReadFile ReadFileEx=kPrf2Wrap_ReadFileEx ReadFileScatter=kPrf2Wrap_ReadFileScatter ReadProcessMemory=kPrf2Wrap_ReadProcessMemory RegisterWaitForSingleObject=kPrf2Wrap_RegisterWaitForSingleObject RegisterWaitForSingleObjectEx=kPrf2Wrap_RegisterWaitForSingleObjectEx ReleaseActCtx=kPrf2Wrap_ReleaseActCtx ReleaseMutex=kPrf2Wrap_ReleaseMutex ReleaseSemaphore=kPrf2Wrap_ReleaseSemaphore RemoveDirectoryA=kPrf2Wrap_RemoveDirectoryA RemoveDirectoryW=kPrf2Wrap_RemoveDirectoryW RemoveVectoredContinueHandler=kPrf2Wrap_RemoveVectoredContinueHandler RemoveVectoredExceptionHandler=kPrf2Wrap_RemoveVectoredExceptionHandler ReplaceFile=kPrf2Wrap_ReplaceFile ReplaceFileA=kPrf2Wrap_ReplaceFileA ReplaceFileW=kPrf2Wrap_ReplaceFileW RequestDeviceWakeup=kPrf2Wrap_RequestDeviceWakeup RequestWakeupLatency=kPrf2Wrap_RequestWakeupLatency ResetEvent=kPrf2Wrap_ResetEvent ResetWriteWatch=kPrf2Wrap_ResetWriteWatch RestoreLastError=kPrf2Wrap_RestoreLastError ResumeThread=kPrf2Wrap_ResumeThread RtlAddFunctionTable=kPrf2Wrap_RtlAddFunctionTable RtlCaptureContext=kPrf2Wrap_RtlCaptureContext RtlCaptureStackBackTrace=kPrf2Wrap_RtlCaptureStackBackTrace RtlCompareMemory=kPrf2Wrap_RtlCompareMemory RtlDeleteFunctionTable=kPrf2Wrap_RtlDeleteFunctionTable RtlFillMemory=kPrf2Wrap_RtlFillMemory RtlInstallFunctionTableCallback=kPrf2Wrap_RtlInstallFunctionTableCallback RtlLookupFunctionEntry=kPrf2Wrap_RtlLookupFunctionEntry RtlMoveMemory=kPrf2Wrap_RtlMoveMemory RtlPcToFileHeader=kPrf2Wrap_RtlPcToFileHeader RtlRaiseException=kPrf2Wrap_RtlRaiseException RtlRestoreContext=kPrf2Wrap_RtlRestoreContext RtlUnwind=kPrf2Wrap_RtlUnwind RtlUnwindEx=kPrf2Wrap_RtlUnwindEx RtlVirtualUnwind=kPrf2Wrap_RtlVirtualUnwind RtlZeroMemory=kPrf2Wrap_RtlZeroMemory ScrollConsoleScreenBufferA=kPrf2Wrap_ScrollConsoleScreenBufferA ScrollConsoleScreenBufferW=kPrf2Wrap_ScrollConsoleScreenBufferW SearchPathA=kPrf2Wrap_SearchPathA SearchPathW=kPrf2Wrap_SearchPathW SetCalendarInfoA=kPrf2Wrap_SetCalendarInfoA SetCalendarInfoW=kPrf2Wrap_SetCalendarInfoW SetCommBreak=kPrf2Wrap_SetCommBreak SetCommConfig=kPrf2Wrap_SetCommConfig SetCommMask=kPrf2Wrap_SetCommMask SetCommState=kPrf2Wrap_SetCommState SetCommTimeouts=kPrf2Wrap_SetCommTimeouts SetComputerNameA=kPrf2Wrap_SetComputerNameA SetComputerNameExA=kPrf2Wrap_SetComputerNameExA SetComputerNameExW=kPrf2Wrap_SetComputerNameExW SetComputerNameW=kPrf2Wrap_SetComputerNameW SetConsoleActiveScreenBuffer=kPrf2Wrap_SetConsoleActiveScreenBuffer SetConsoleCP=kPrf2Wrap_SetConsoleCP SetConsoleCtrlHandler=kPrf2Wrap_SetConsoleCtrlHandler SetConsoleCursor=kPrf2Wrap_SetConsoleCursor SetConsoleCursorInfo=kPrf2Wrap_SetConsoleCursorInfo SetConsoleCursorPosition=kPrf2Wrap_SetConsoleCursorPosition SetConsoleMode=kPrf2Wrap_SetConsoleMode SetConsoleOutputCP=kPrf2Wrap_SetConsoleOutputCP SetConsoleScreenBufferSize=kPrf2Wrap_SetConsoleScreenBufferSize SetConsoleTextAttribute=kPrf2Wrap_SetConsoleTextAttribute SetConsoleTitleA=kPrf2Wrap_SetConsoleTitleA SetConsoleTitleW=kPrf2Wrap_SetConsoleTitleW SetConsoleWindowInfo=kPrf2Wrap_SetConsoleWindowInfo SetCriticalSectionSpinCount=kPrf2Wrap_SetCriticalSectionSpinCount SetCurrentDirectoryA=kPrf2Wrap_SetCurrentDirectoryA SetCurrentDirectoryW=kPrf2Wrap_SetCurrentDirectoryW SetDefaultCommConfigA=kPrf2Wrap_SetDefaultCommConfigA SetDefaultCommConfigW=kPrf2Wrap_SetDefaultCommConfigW SetDllDirectoryA=kPrf2Wrap_SetDllDirectoryA SetDllDirectoryW=kPrf2Wrap_SetDllDirectoryW SetEndOfFile=kPrf2Wrap_SetEndOfFile SetEnvironmentStringsA=kPrf2Wrap_SetEnvironmentStringsA SetEnvironmentStringsW=kPrf2Wrap_SetEnvironmentStringsW SetEnvironmentVariableA=kPrf2Wrap_SetEnvironmentVariableA SetEnvironmentVariableW=kPrf2Wrap_SetEnvironmentVariableW SetErrorMode=kPrf2Wrap_SetErrorMode SetEvent=kPrf2Wrap_SetEvent SetFileApisToANSI=kPrf2Wrap_SetFileApisToANSI SetFileApisToOEM=kPrf2Wrap_SetFileApisToOEM SetFileAttributesA=kPrf2Wrap_SetFileAttributesA SetFileAttributesW=kPrf2Wrap_SetFileAttributesW SetFilePointer=kPrf2Wrap_SetFilePointer SetFilePointerEx=kPrf2Wrap_SetFilePointerEx SetFileShortNameA=kPrf2Wrap_SetFileShortNameA SetFileShortNameW=kPrf2Wrap_SetFileShortNameW SetFileTime=kPrf2Wrap_SetFileTime SetFileValidData=kPrf2Wrap_SetFileValidData SetFirmwareEnvironmentVariableA=kPrf2Wrap_SetFirmwareEnvironmentVariableA SetFirmwareEnvironmentVariableW=kPrf2Wrap_SetFirmwareEnvironmentVariableW SetHandleCount=kPrf2Wrap_SetHandleCount SetHandleInformation=kPrf2Wrap_SetHandleInformation SetInformationJobObject=kPrf2Wrap_SetInformationJobObject SetLastError=kPrf2Wrap_SetLastError SetLocalTime=kPrf2Wrap_SetLocalTime SetLocaleInfoA=kPrf2Wrap_SetLocaleInfoA SetLocaleInfoW=kPrf2Wrap_SetLocaleInfoW SetMailslotInfo=kPrf2Wrap_SetMailslotInfo SetMessageWaitingIndicator=kPrf2Wrap_SetMessageWaitingIndicator SetNamedPipeHandleState=kPrf2Wrap_SetNamedPipeHandleState SetPriorityClass=kPrf2Wrap_SetPriorityClass SetProcessAffinityMask=kPrf2Wrap_SetProcessAffinityMask SetProcessPriorityBoost=kPrf2Wrap_SetProcessPriorityBoost SetProcessShutdownParameters=kPrf2Wrap_SetProcessShutdownParameters SetProcessWorkingSetSize=kPrf2Wrap_SetProcessWorkingSetSize SetProcessWorkingSetSizeEx=kPrf2Wrap_SetProcessWorkingSetSizeEx SetStdHandle=kPrf2Wrap_SetStdHandle SetSystemFileCacheSize=kPrf2Wrap_SetSystemFileCacheSize SetSystemPowerState=kPrf2Wrap_SetSystemPowerState SetSystemTime=kPrf2Wrap_SetSystemTime SetSystemTimeAdjustment=kPrf2Wrap_SetSystemTimeAdjustment SetTapeParameters=kPrf2Wrap_SetTapeParameters SetTapePosition=kPrf2Wrap_SetTapePosition SetThreadAffinityMask=kPrf2Wrap_SetThreadAffinityMask SetThreadContext=kPrf2Wrap_SetThreadContext SetThreadExecutionState=kPrf2Wrap_SetThreadExecutionState SetThreadIdealProcessor=kPrf2Wrap_SetThreadIdealProcessor SetThreadLocale=kPrf2Wrap_SetThreadLocale SetThreadPriority=kPrf2Wrap_SetThreadPriority SetThreadPriorityBoost=kPrf2Wrap_SetThreadPriorityBoost SetThreadStackGuarantee=kPrf2Wrap_SetThreadStackGuarantee SetTimeZoneInformation=kPrf2Wrap_SetTimeZoneInformation SetTimerQueueTimer=kPrf2Wrap_SetTimerQueueTimer SetUnhandledExceptionFilter=kPrf2Wrap_SetUnhandledExceptionFilter SetUserGeoID=kPrf2Wrap_SetUserGeoID SetVolumeLabelA=kPrf2Wrap_SetVolumeLabelA SetVolumeLabelW=kPrf2Wrap_SetVolumeLabelW SetVolumeMountPointA=kPrf2Wrap_SetVolumeMountPointA SetVolumeMountPointW=kPrf2Wrap_SetVolumeMountPointW SetWaitableTimer=kPrf2Wrap_SetWaitableTimer SetupComm=kPrf2Wrap_SetupComm SignalObjectAndWait=kPrf2Wrap_SignalObjectAndWait SizeofResource=kPrf2Wrap_SizeofResource Sleep=kPrf2Wrap_Sleep SleepEx=kPrf2Wrap_SleepEx SuspendThread=kPrf2Wrap_SuspendThread SwitchToFiber=kPrf2Wrap_SwitchToFiber SwitchToThread=kPrf2Wrap_SwitchToThread SystemTimeToFileTime=kPrf2Wrap_SystemTimeToFileTime SystemTimeToTzSpecificLocalTime=kPrf2Wrap_SystemTimeToTzSpecificLocalTime TerminateJobObject=kPrf2Wrap_TerminateJobObject TerminateProcess=kPrf2Wrap_TerminateProcess TerminateThread=kPrf2Wrap_TerminateThread Thread32First=kPrf2Wrap_Thread32First Thread32Next=kPrf2Wrap_Thread32Next TlsAlloc=kPrf2Wrap_TlsAlloc TlsFree=kPrf2Wrap_TlsFree TlsGetValue=kPrf2Wrap_TlsGetValue TlsSetValue=kPrf2Wrap_TlsSetValue Toolhelp32ReadProcessMemory=kPrf2Wrap_Toolhelp32ReadProcessMemory TransactNamedPipe=kPrf2Wrap_TransactNamedPipe TransmitCommChar=kPrf2Wrap_TransmitCommChar TryEnterCriticalSection=kPrf2Wrap_TryEnterCriticalSection TzSpecificLocalTimeToSystemTime=kPrf2Wrap_TzSpecificLocalTimeToSystemTime UnhandledExceptionFilter=kPrf2Wrap_UnhandledExceptionFilter UnlockFile=kPrf2Wrap_UnlockFile UnlockFileEx=kPrf2Wrap_UnlockFileEx UnmapViewOfFile=kPrf2Wrap_UnmapViewOfFile UnregisterWait=kPrf2Wrap_UnregisterWait UnregisterWaitEx=kPrf2Wrap_UnregisterWaitEx UpdateResourceA=kPrf2Wrap_UpdateResourceA UpdateResourceW=kPrf2Wrap_UpdateResourceW VerLanguageNameA=kPrf2Wrap_VerLanguageNameA VerLanguageNameW=kPrf2Wrap_VerLanguageNameW VerSetConditionMask=kPrf2Wrap_VerSetConditionMask VerifyVersionInfoA=kPrf2Wrap_VerifyVersionInfoA VerifyVersionInfoW=kPrf2Wrap_VerifyVersionInfoW VirtualAlloc=kPrf2Wrap_VirtualAlloc VirtualAllocEx=kPrf2Wrap_VirtualAllocEx VirtualFree=kPrf2Wrap_VirtualFree VirtualFreeEx=kPrf2Wrap_VirtualFreeEx VirtualLock=kPrf2Wrap_VirtualLock VirtualProtect=kPrf2Wrap_VirtualProtect VirtualProtectEx=kPrf2Wrap_VirtualProtectEx VirtualQuery=kPrf2Wrap_VirtualQuery VirtualQueryEx=kPrf2Wrap_VirtualQueryEx VirtualUnlock=kPrf2Wrap_VirtualUnlock WTSGetActiveConsoleSessionId=kPrf2Wrap_WTSGetActiveConsoleSessionId WaitCommEvent=kPrf2Wrap_WaitCommEvent WaitForDebugEvent=kPrf2Wrap_WaitForDebugEvent WaitForMultipleObjects=kPrf2Wrap_WaitForMultipleObjects WaitForMultipleObjectsEx=kPrf2Wrap_WaitForMultipleObjectsEx WaitForSingleObject=kPrf2Wrap_WaitForSingleObject WaitForSingleObjectEx=kPrf2Wrap_WaitForSingleObjectEx WaitNamedPipeA=kPrf2Wrap_WaitNamedPipeA WaitNamedPipeW=kPrf2Wrap_WaitNamedPipeW WideCharToMultiByte=kPrf2Wrap_WideCharToMultiByte WinExec=kPrf2Wrap_WinExec Wow64DisableWow64FsRedirection=kPrf2Wrap_Wow64DisableWow64FsRedirection Wow64EnableWow64FsRedirection=kPrf2Wrap_Wow64EnableWow64FsRedirection Wow64RevertWow64FsRedirection=kPrf2Wrap_Wow64RevertWow64FsRedirection WriteConsoleA=kPrf2Wrap_WriteConsoleA WriteConsoleInputA=kPrf2Wrap_WriteConsoleInputA WriteConsoleInputW=kPrf2Wrap_WriteConsoleInputW WriteConsoleOutputA=kPrf2Wrap_WriteConsoleOutputA WriteConsoleOutputAttribute=kPrf2Wrap_WriteConsoleOutputAttribute WriteConsoleOutputCharacterA=kPrf2Wrap_WriteConsoleOutputCharacterA WriteConsoleOutputCharacterW=kPrf2Wrap_WriteConsoleOutputCharacterW WriteConsoleOutputW=kPrf2Wrap_WriteConsoleOutputW WriteConsoleW=kPrf2Wrap_WriteConsoleW WriteFile=kPrf2Wrap_WriteFile WriteFileEx=kPrf2Wrap_WriteFileEx WriteFileGather=kPrf2Wrap_WriteFileGather WritePrivateProfileSectionA=kPrf2Wrap_WritePrivateProfileSectionA WritePrivateProfileSectionW=kPrf2Wrap_WritePrivateProfileSectionW WritePrivateProfileStringA=kPrf2Wrap_WritePrivateProfileStringA WritePrivateProfileStringW=kPrf2Wrap_WritePrivateProfileStringW WritePrivateProfileStructA=kPrf2Wrap_WritePrivateProfileStructA WritePrivateProfileStructW=kPrf2Wrap_WritePrivateProfileStructW WriteProcessMemory=kPrf2Wrap_WriteProcessMemory WriteProfileSectionA=kPrf2Wrap_WriteProfileSectionA WriteProfileSectionW=kPrf2Wrap_WriteProfileSectionW WriteProfileStringA=kPrf2Wrap_WriteProfileStringA WriteProfileStringW=kPrf2Wrap_WriteProfileStringW WriteTapemark=kPrf2Wrap_WriteTapemark ZombifyActCtx=kPrf2Wrap_ZombifyActCtx _hread=kPrf2Wrap__hread _hwrite=kPrf2Wrap__hwrite _lclose=kPrf2Wrap__lclose _lcreat=kPrf2Wrap__lcreat _llseek=kPrf2Wrap__llseek _lopen=kPrf2Wrap__lopen _lread=kPrf2Wrap__lread _lwrite=kPrf2Wrap__lwrite lstrcat=kPrf2Wrap_lstrcat lstrcatA=kPrf2Wrap_lstrcatA lstrcatW=kPrf2Wrap_lstrcatW lstrcmp=kPrf2Wrap_lstrcmp lstrcmpA=kPrf2Wrap_lstrcmpA lstrcmpW=kPrf2Wrap_lstrcmpW lstrcmpi=kPrf2Wrap_lstrcmpi lstrcmpiA=kPrf2Wrap_lstrcmpiA lstrcmpiW=kPrf2Wrap_lstrcmpiW lstrcpy=kPrf2Wrap_lstrcpy lstrcpyA=kPrf2Wrap_lstrcpyA lstrcpyW=kPrf2Wrap_lstrcpyW lstrcpyn=kPrf2Wrap_lstrcpyn lstrcpynA=kPrf2Wrap_lstrcpynA lstrcpynW=kPrf2Wrap_lstrcpynW lstrlen=kPrf2Wrap_lstrlen lstrlenA=kPrf2Wrap_lstrlenA lstrlenW=kPrf2Wrap_lstrlenW uaw_lstrcmpW=kPrf2Wrap_uaw_lstrcmpW uaw_lstrcmpiW=kPrf2Wrap_uaw_lstrcmpiW uaw_lstrlenW=kPrf2Wrap_uaw_lstrlenW uaw_wcschr=kPrf2Wrap_uaw_wcschr uaw_wcscpy=kPrf2Wrap_uaw_wcscpy uaw_wcsicmp=kPrf2Wrap_uaw_wcsicmp uaw_wcslen=kPrf2Wrap_uaw_wcslen uaw_wcsrchr=kPrf2Wrap_uaw_wcsrchr ��������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.c���������������������������������������0000664�0001750�0001750�00000003607�14670377514�024015� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kPrf2WinApiWrapperHlp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * Helpers for the Windows API wrapper DLL. */ /* * Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include <Windows.h> #include "kPRf2WinApiWRapperHlp.h" FARPROC kPrf2WrapResolve(void **ppfn, const char *pszName, PKPRF2WRAPDLL pDll) { FARPROC pfn; HMODULE hmod = pDll->hmod; if (hmod == INVALID_HANDLE_VALUE) { hmod = LoadLibraryA(pDll->szName); pDll->hmod = hmod; } pfn = GetProcAddress(hmod, pszName); *ppfn = (void *)pfn; return pfn; } �������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/kProfileR3.h��������������������������������������������������0000664�0001750�0001750�00000002632�14670377514�021676� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: kProfileR3.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Internal header, Ring-3. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kProfileR3_h___ #define ___kProfileR3_h___ int kPrfInitialize(void); int kPrfTerminate(void); void kPrfTerminateThread(void); #endif ������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2WinApi-genimp.sed����������������������������������������0000664�0001750�0001750�00000003076�14670377514�023616� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id: kPrf2WinApi-genimp.sed 29 2009-07-01 20:30:29Z bird $ ## # Generate imports from normalized dumpbin output. # # # Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # Normalize the input a bit. s/[[:space:]][[:space:]]*/ /g s/^[[:space:]]// s/[[:space:]]$// /^$/b drop_line # Expects a single name - no ordinals yet. /\@/b have_at s/^\(.*\)$/ \1=kPrf2Wrap_\1/ b end :have_at h s/^\([^ ]\)\(@[0-9]*\)$/ \1\2=kPrf2Wrap_\1/ p g s/^\([^ ]\)\(@[0-9]*\)$/ \1=kPrf2Wrap_\1/ b end :drop_line d b end :end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kbuild-3608/src/lib/kStuff/kProfiler2/prfreader.cpp.h�����������������������������������������������0000664�0001750�0001750�00000162131�14670377514�022452� 0����������������������������������������������������������������������������������������������������ustar �locutus�������������������������locutus����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: prfreader.cpp.h 77 2016-06-22 17:03:55Z bird $ */ /** @file * kProfiler Mark 2 - Reader Code Template. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Validates the non-header parts of a data-set. * * @returns true if valid. * @returns false if invalid. (written description to pOut) * * @param pHdr Pointer to the data set. * @param cb The size of the data set. * @param pOut Where to write error messages. */ static bool KPRF_NAME(IsValid)(KPRF_TYPE(PC,HDR) pHdr, KU32 cb, FILE *pOut) { KPRF_TYPE(,UPTR) uMaxPtr = ~(KPRF_TYPE(,UPTR))0 - pHdr->uBasePtr; /* * Iterate the module segments. */ KU32 off = pHdr->offModSegs; while (off < pHdr->offModSegs + pHdr->cbModSegs) { KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(PC,MODSEG, off, pHdr); KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]); cbCur = KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR)); if (cbCur + off > pHdr->offModSegs + pHdr->cbModSegs) { fprintf(pOut, "The module segment record at 0x%x is too long!\n", off); return false; } if (pCur->uBasePtr > uMaxPtr) fprintf(pOut, "warning: The module segment record at 0x%x has a too high base address.\n", off); if (strlen(pCur->szPath) != pCur->cchPath) { fprintf(pOut, "The module segment record at 0x%x has an invalid path length 0x%x it the actual length is 0x%x\n", off, pCur->cchPath, strlen(pCur->szPath)); return false; } /* next */ off += cbCur; } /* * Iterate the functions. */ KPRF_TYPE(PC,FUNC) paFuncs = KPRF_OFF2PTR(PC,FUNC, pHdr->offFunctions, pHdr); for (KU32 i = 0; i < pHdr->cFunctions; i++) { KPRF_TYPE(PC,FUNC) pCur = &paFuncs[i]; if (pCur->uEntryPtr > uMaxPtr) fprintf(pOut, "warning: Function 0x%x has a too high base address.\n", i); if (pCur->offModSeg) { if ( pCur->offModSeg < pHdr->offModSegs || pCur->offModSeg >= pHdr->offModSegs + pHdr->cbModSegs || pCur->offModSeg != KPRF_ALIGN(pCur->offModSeg, sizeof(pCur->uEntryPtr)) ) { fprintf(pOut, "Function 0x%x has an invalid offModSeg value (0x%x).\n", i, pCur->offModSeg); return false; } /** @todo more validation here.. */ } } /* * Validate the threads. */ KPRF_TYPE(PC,THREAD) paThreads = KPRF_OFF2PTR(PC,THREAD, pHdr->offThreads, pHdr); for (KU32 i = 0; i < pHdr->cThreads; i++) { KPRF_TYPE(PC,THREAD) pCur = &paThreads[i]; if (pCur->uStackBasePtr > uMaxPtr) fprintf(pOut, "warning: Thread 0x%x has a too high base address.\n", i); switch (pCur->enmState) { case KPRF_TYPE(,THREADSTATE_ACTIVE): case KPRF_TYPE(,THREADSTATE_SUSPENDED): case KPRF_TYPE(,THREADSTATE_OVERFLOWED): case KPRF_TYPE(,THREADSTATE_TERMINATED): break; default: fprintf(pOut, "Thread 0x%x has an invalid state value (0x%x).\n", i, pCur->enmState); return false; } } return true; } /** * Dumps a file of a particular format. * * @returns 0 on success. (you might want to check the pOut state) * @returns -1 on failure. * * @param pHdr Pointer to the data set. * @param pOut The output file. This is opened for text writing. * @param pReader The reader object. */ static int KPRF_NAME(Dump)(KPRF_TYPE(PC,HDR) pHdr, FILE *pOut) { /* * Any commandline? */ if (pHdr->offCommandLine) fprintf(pOut, "Commandline: %s (%d bytes)\n", (char *)KPRF_OFF2PTR(PC,MODSEG, pHdr->offCommandLine, pHdr), /* stupid, stupid, type hacking. */ pHdr->cchCommandLine); /* * Dump the module segments. */ fprintf(pOut, "Module Segments: off=0x%x 0x%x/0x%x (bytes)\n" "----------------\n", pHdr->offModSegs, pHdr->cbModSegs, pHdr->cbMaxModSegs); KU32 off = pHdr->offModSegs; while (off < pHdr->offModSegs + pHdr->cbModSegs) { KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(PC,MODSEG, off, pHdr); KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]); cbCur = KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR)); fprintf(pOut, "0x%04x: iSegment=0x%08x uBasePtr=%" KPRF_FMT_UPTR " szPath='%s' (%d bytes)\n", off, pCur->iSegment, pCur->uBasePtr, pCur->szPath, pCur->cchPath); /* next */ off += cbCur; } fprintf(pOut, "\n"); /* * Dump the functions. */ fprintf(pOut, "Functions: off=0x%x 0x%x/0x%x\n" "----------\n", pHdr->offFunctions, pHdr->cFunctions, pHdr->cMaxFunctions); KPRF_TYPE(PC,FUNC) paFuncs = KPRF_OFF2PTR(PC,FUNC, pHdr->offFunctions, pHdr); for (KU32 i = 0; i < pHdr->cFunctions; i++) { KPRF_TYPE(PC,FUNC) pCur = &paFuncs[i]; fprintf(pOut, "0x%04x: uEntryPtr=%" KPRF_FMT_UPTR " cOnStack=0x%" KPRF_FMT_X64 " cCalls=0x%" KPRF_FMT_X64 "\n" " OnStack={0x%" KPRF_FMT_X64 ", 0x%" KPRF_FMT_X64 ", 0x%" KPRF_FMT_X64 "}\n" " OnTopOfStack={0x%" KPRF_FMT_X64 ", 0x%" KPRF_FMT_X64 ", 0x%" KPRF_FMT_X64 "}\n", i, pCur->uEntryPtr, pCur->cOnStack, pCur->cCalls, pCur->OnStack.MinTicks, pCur->OnStack.MaxTicks, pCur->OnStack.SumTicks, pCur->OnTopOfStack.MinTicks, pCur->OnTopOfStack.MaxTicks, pCur->OnTopOfStack.SumTicks); if (pCur->offModSeg) { KPRF_TYPE(PC,MODSEG) pModSeg = KPRF_OFF2PTR(PC,MODSEG, pCur->offModSeg, pHdr); fprintf(pOut, " offModSeg=0x%08x iSegment=0x%02x uBasePtr=%" KPRF_FMT_UPTR " szPath='%s' (%d bytes)\n", pCur->offModSeg, pModSeg->iSegment, pModSeg->uBasePtr, pModSeg->szPath, pModSeg->cchPath); #if 1 PKDBGMOD pMod; int rc = kDbgModuleOpen(&pMod, pModSeg->szPath, NULL /* pLdrMod */); if (!rc) { KDBGSYMBOL Sym; rc = kDbgModuleQuerySymbol(pMod, pModSeg->iSegment, pCur->uEntryPtr - pModSeg->uBasePtr, &Sym); if (!rc) { fprintf(pOut, " %s\n", Sym.szName); } kDbgModuleClose(pMod); } #endif } } fprintf(pOut, "\n"); /* * Dump the threads. */ fprintf(pOut, "Threads: off=0x%x 0x%x/0x%x (Stacks=0x%x/0x%x cMaxStackFrames=0x%x)\n" "--------\n", pHdr->offThreads, pHdr->cThreads, pHdr->cMaxThreads, pHdr->cStacks, pHdr->cMaxStacks, pHdr->cMaxStackFrames); KPRF_TYPE(PC,THREAD) paThreads = KPRF_OFF2PTR(PC,THREAD, pHdr->offThreads, pHdr); for (KU32 i = 0; i < pHdr->cThreads; i++) { KPRF_TYPE(PC,THREAD) pCur = &paThreads[i]; fprintf(pOut, "0x%02x: ThreadId=0x%08" KPRF_FMT_X64 " enmState=%d szName='%s'\n" " uStackBasePtr=%" KPRF_FMT_UPTR " cbMaxStack=%" KPRF_FMT_UPTR "\n" " cCalls=0x%" KPRF_FMT_X64 " cOverflows=0x%" KPRF_FMT_X64 " cStackSwitchRejects=0x%" KPRF_FMT_X64 "\n" " cUnwinds=0x%" KPRF_FMT_X64 " ProfiledTicks=0x%" KPRF_FMT_X64 " OverheadTicks=0x%" KPRF_FMT_X64 "\n", i, pCur->ThreadId, pCur->enmState, pCur->szName, pCur->uStackBasePtr, pCur->cbMaxStack, pCur->cCalls, pCur->cOverflows, pCur->cStackSwitchRejects, pCur->cUnwinds, pCur->ProfiledTicks, pCur->OverheadTicks); } return 0; } /** Pointer to a report module. * @internal */ typedef struct KPRF_TYPE(,REPORTMOD) *KPRF_TYPE(P,REPORTMOD); /** Pointer to a report module segment. * @internal */ typedef struct KPRF_TYPE(,REPORTMODSEG) *KPRF_TYPE(P,REPORTMODSEG); /** * A report module segment. * * @internal */ typedef struct KPRF_TYPE(,REPORTMODSEG) { /** AVL node core. The key is the data set offset of the module segment record. */ KDBGADDR offSegment; struct KPRF_TYPE(,REPORTMODSEG) *mpLeft; /**< AVL left branch. */ struct KPRF_TYPE(,REPORTMODSEG) *mpRight; /**< AVL rigth branch. */ /** Pointer to the next segment for the module. */ KPRF_TYPE(P,REPORTMODSEG) pNext; /** Pointer to the module segment data in the data set. */ KPRF_TYPE(PC,MODSEG) pModSeg; /** Pointer to the module this segment belongs to. */ KPRF_TYPE(P,REPORTMOD) pMod; /** The time this segment has spent on the stack.. */ KU64 OnStackTicks; /** The time this segment has spent on the top of the stack.. */ KU64 OnTopOfStackTicks; /** The number of profiled functions from this segment. */ KU32 cFunctions; KU8 mHeight; /**< AVL Subtree height. */ } KPRF_TYPE(,REPORTMODSEG), *KPRF_TYPE(P,REPORTMODSEG); /** * A report module segment. * * @internal */ typedef struct KPRF_TYPE(,REPORTMOD) { /** The module number. */ KU32 iMod; /** Pointer to the next module in the list. */ KPRF_TYPE(P,REPORTMOD) pNext; /** Pointer to the list of segments belonging to this module. */ KPRF_TYPE(P,REPORTMODSEG) pFirstSeg; /** The debug module handle. */ PKDBGMOD pDbgMod; /** The time this segment has spent on the stack.. */ KU64 OnStackTicks; /** The time this segment has spent on the top of the stack.. */ KU64 OnTopOfStackTicks; /** The number of profiled functions from this segment. */ KU32 cFunctions; } KPRF_TYPE(,REPORTMOD), *KPRF_TYPE(P,REPORTMOD); /** * A report function. * * @internal */ typedef struct KPRF_TYPE(,REPORTFUNC) { /** Pointer to the function data in the data set. */ KPRF_TYPE(PC,FUNC) pFunc; /** Pointer to the module segment this function belongs to. (can be NULL) */ KPRF_TYPE(P,REPORTMODSEG) pModSeg; /** Pointer to the function symbol. */ PKDBGSYMBOL pSym; /** Pointer to the function line number. */ PKDBGLINE pLine; } KPRF_TYPE(,REPORTFUNC), *KPRF_TYPE(P,REPORTFUNC); /** * Compares two REPROTFUNC records to determin which has the higher on-stack time. */ static int KPRF_NAME(FuncCompareOnStack)(const void *pv1, const void *pv2) { KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; if (p1->OnStack.SumTicks > p2->OnStack.SumTicks) return -1; if (p1->OnStack.SumTicks < p2->OnStack.SumTicks) return 1; if (p1->OnStack.MaxTicks > p2->OnStack.MaxTicks) return -1; if (p1->OnStack.MaxTicks < p2->OnStack.MaxTicks) return 1; if (p1->OnStack.MinTicks > p2->OnStack.MinTicks) return -1; if (p1->OnStack.MinTicks < p2->OnStack.MinTicks) return 1; if (p1 < p2) return -1; return 1; } /** * Compares two REPROTFUNC records to determin which has the higher on-stack average time. */ static int KPRF_NAME(FuncCompareOnStackAvg)(const void *pv1, const void *pv2) { KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; if (p1->OnStack.SumTicks / p1->cOnStack > p2->OnStack.SumTicks / p2->cOnStack) return -1; if (p1->OnStack.SumTicks / p1->cOnStack < p2->OnStack.SumTicks / p2->cOnStack) return 1; return KPRF_NAME(FuncCompareOnStack)(pv1, pv2); } /** * Compares two REPROTFUNC records to determin which has the higher on-stack min time. */ static int KPRF_NAME(FuncCompareOnStackMin)(const void *pv1, const void *pv2) { KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; if (p1->OnStack.MinTicks > p2->OnStack.MinTicks) return -1; if (p1->OnStack.MinTicks < p2->OnStack.MinTicks) return 1; return KPRF_NAME(FuncCompareOnStack)(pv1, pv2); } /** * Compares two REPROTFUNC records to determin which has the higher on-stack max time. */ static int KPRF_NAME(FuncCompareOnStackMax)(const void *pv1, const void *pv2) { KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; if (p1->OnStack.MaxTicks > p2->OnStack.MaxTicks) return -1; if (p1->OnStack.MaxTicks < p2->OnStack.MaxTicks) return 1; return KPRF_NAME(FuncCompareOnStack)(pv1, pv2); } /** * Compares two REPROTFUNC records to determin which has the higher on-stack time. */ static int KPRF_NAME(FuncCompareOnTopOfStack)(const void *pv1, const void *pv2) { KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; if (p1->OnTopOfStack.SumTicks > p2->OnTopOfStack.SumTicks) return -1; if (p1->OnTopOfStack.SumTicks < p2->OnTopOfStack.SumTicks) return 1; if (p1->OnTopOfStack.MaxTicks > p2->OnTopOfStack.MaxTicks) return -1; if (p1->OnTopOfStack.MaxTicks < p2->OnTopOfStack.MaxTicks) return 1; if (p1->OnTopOfStack.MinTicks > p2->OnTopOfStack.MinTicks) return -1; if (p1->OnTopOfStack.MinTicks < p2->OnTopOfStack.MinTicks) return 1; if (p1 < p2) return -1; return 1; } /** * Compares two REPROTFUNC records to determin which has the higher on-stack average time. */ static int KPRF_NAME(FuncCompareOnTopOfStackAvg)(const void *pv1, const void *pv2) { KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; if (p1->OnTopOfStack.SumTicks / p1->cOnStack > p2->OnTopOfStack.SumTicks / p2->cOnStack) return -1; if (p1->OnTopOfStack.SumTicks / p1->cOnStack < p2->OnTopOfStack.SumTicks / p2->cOnStack) return 1; return KPRF_NAME(FuncCompareOnTopOfStack)(pv1, pv2); } /** * Compares two REPROTFUNC records to determin which has the higher on-stack min time. */ static int KPRF_NAME(FuncCompareOnTopOfStackMin)(const void *pv1, const void *pv2) { KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; if (p1->OnTopOfStack.MinTicks > p2->OnTopOfStack.MinTicks) return -1; if (p1->OnTopOfStack.MinTicks < p2->OnTopOfStack.MinTicks) return 1; return KPRF_NAME(FuncCompareOnTopOfStack)(pv1, pv2); } /** * Compares two REPROTFUNC records to determin which has the higher on-stack min time. */ static int KPRF_NAME(FuncCompareOnTopOfStackMax)(const void *pv1, const void *pv2) { KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; if (p1->OnTopOfStack.MaxTicks > p2->OnTopOfStack.MaxTicks) return -1; if (p1->OnTopOfStack.MaxTicks < p2->OnTopOfStack.MaxTicks) return 1; return KPRF_NAME(FuncCompareOnTopOfStack)(pv1, pv2); } /** * Compares two REPROTFUNC records to determin which has the higher call to count. */ static int KPRF_NAME(FuncCompareCallsTo)(const void *pv1, const void *pv2) { KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; if (p1->cOnStack > p2->cOnStack) return -1; if (p1->cOnStack < p2->cOnStack) return 1; return KPRF_NAME(FuncCompareOnStack)(pv1, pv2); } /** * Compares two REPROTFUNC records to determin which has the higher call from count. */ static int KPRF_NAME(FuncCompareCallsFrom)(const void *pv1, const void *pv2) { KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; if (p1->cCalls > p2->cCalls) return -1; if (p1->cCalls < p2->cCalls) return 1; return KPRF_NAME(FuncCompareOnTopOfStack)(pv1, pv2); } /** * A report thread. * * @internal */ typedef struct KPRF_TYPE(,REPORTTHREAD) { /** Pointer to the thread data in the data set. */ KPRF_TYPE(PC,THREAD) pThread; } KPRF_TYPE(,REPORTTHREAD), *KPRF_TYPE(P,REPORTTHREAD); /** * Data-set analysis report. * * This is an internal structure to store temporary data between the * analysis stage and the priting state. * * @internal */ typedef struct KPRF_TYPE(,REPORT) { /** Pointer to the data set. */ KPRF_TYPE(PC,HDR) pHdr; /** @name Data-set item wrappers. * @{ */ /** Pointer to the array of threads. */ KPRF_TYPE(P,REPORTTHREAD) paThreads; /** Pointer to the array of functions. */ KPRF_TYPE(P,REPORTFUNC) paFunctions; /** Pointer to the head of the module list. */ KPRF_TYPE(P,REPORTMOD) pFirstMod; /** The number of modules in the list. */ KU32 cMods; /** The module segment tree. (Only kAvl cares about this.) */ KPRF_TYPE(P,REPORTMODSEG) pModSegTree; /** The number of module segments in the tree. */ KU32 cModSegs; /** @} */ /** @name Sorting. * @{ */ /** Pointer to the array of threads. */ KPRF_TYPE(P,REPORTTHREAD) *papSortedThreads; /** Pointer to the array of functions. */ KPRF_TYPE(P,REPORTFUNC) *papSortedFunctions; /** @} */ /** @name Accumulated Thread Data. * @{ */ /** Sum of the profiled ticks. */ KU64 ProfiledTicks; /** Sum of the overhead ticks. */ KU64 OverheadTicks; /** Sum of the sleep ticks. */ KU64 SleepTicks; /** Sum of calls performed. */ KU64 cCalls; /** @} */ } KPRF_TYPE(,REPORT), *KPRF_TYPE(P,REPORT), **KPRF_TYPE(PP,REPORT); /* Instantiate the AVL tree code. */ #define KAVL_CHECK_FOR_EQUAL_INSERT #define KAVL_MAX_STACK 32 #define KAVL_STD_KEY_COMP #define mKey offSegment #define KAVLKEY KDBGADDR #define KAVLNODE KPRF_TYPE(,REPORTMODSEG) #define mpRoot pModSegTree #define KAVLROOT KPRF_TYPE(,REPORT) #define KAVL_FN(name) KPRF_NAME(ReportTree ## name) #define KAVL_TYPE(prefix,name) KPRF_TYPE(prefix, REPORTMODESEG ## name) #define KAVL_INT(name) KPRF_NAME(REPORTMODESEGINT ## name) #define KAVL_DECL(type) K_DECL_INLINE(type) #include <k/kAvlTmpl/kAvlBase.h> #include <k/kAvlTmpl/kAvlDestroy.h> #include <k/kAvlTmpl/kAvlGet.h> #include <k/kAvlTmpl/kAvlUndef.h> /** * Allocates and initializes a report. * * @returns Pointer to the report on success. * @returns NULL on failure. */ static KPRF_TYPE(P,REPORT) KPRF_NAME(NewReport)(KPRF_TYPE(PC,HDR) pHdr) { /* * Allocate memory for the report. * Everything but the mods and modsegs is allocated in the same block as the report. */ KSIZE cb = KPRF_ALIGN(KPRF_SIZEOF(REPORT), 32); KUPTR offThreads = cb; cb += KPRF_ALIGN(KPRF_SIZEOF(REPORTTHREAD) * pHdr->cThreads, 32); KUPTR offFunctions = cb; cb += KPRF_ALIGN(KPRF_SIZEOF(REPORTFUNC) * pHdr->cFunctions, 32); KUPTR offSortedThreads = cb; cb += KPRF_ALIGN(sizeof(KPRF_TYPE(P,REPORTTHREAD)) * pHdr->cThreads, 32); KUPTR offSortedFunctions = cb; cb += KPRF_ALIGN(sizeof(KPRF_TYPE(P,REPORTFUNC)) * pHdr->cFunctions, 32); KPRF_TYPE(P,REPORT) pReport = (KPRF_TYPE(P,REPORT))malloc(cb); if (!pReport) return NULL; /* * Initialize it. */ pReport->pHdr = pHdr; pReport->paThreads = (KPRF_TYPE(P,REPORTTHREAD))((KU8 *)pReport + offThreads); pReport->paFunctions = (KPRF_TYPE(P,REPORTFUNC))((KU8 *)pReport + offFunctions); pReport->pFirstMod = NULL; pReport->cMods = 0; KPRF_NAME(ReportTreeInit)(pReport); pReport->cModSegs = 0; pReport->papSortedThreads = (KPRF_TYPE(P,REPORTTHREAD) *)((KU8 *)pReport + offSortedThreads); pReport->papSortedFunctions = (KPRF_TYPE(P,REPORTFUNC) *)((KU8 *)pReport + offSortedFunctions); pReport->ProfiledTicks = 0; pReport->OverheadTicks = 0; pReport->SleepTicks = 0; pReport->cCalls = 0; return pReport; } /** * AVL callback for deleting a module segment node. * * @returns 0 * @param pCore The tree node to delete. * @param pvParam User parameter, ignored. */ static int KPRF_NAME(DeleteModSeg)(KPRF_TYPE(P,REPORTMODSEG) pCore, void *pvParam) { free(pCore); return 0; } /** * Releases all the resources held be a report. * * @param pReport The report to delete. */ static void KPRF_NAME(DeleteReport)(KPRF_TYPE(P,REPORT) pReport) { /* * The list and AVL. */ while (pReport->pFirstMod) { KPRF_TYPE(P,REPORTMOD) pFree = pReport->pFirstMod; pReport->pFirstMod = pFree->pNext; kDbgModuleClose(pFree->pDbgMod); free(pFree); } KPRF_NAME(ReportTreeDestroy)(pReport, KPRF_NAME(DeleteModSeg), NULL); /* * The function debug info. */ KU32 i = pReport->pHdr->cFunctions; while (i-- > 0) { kDbgSymbolFree(pReport->paFunctions[i].pSym); kDbgLineFree(pReport->paFunctions[i].pLine); } /* * The report it self. */ pReport->pHdr = NULL; free(pReport); } /** * Builds the module segment tree and the list of modules. * * @returns 0 on success. * @returns -1 on failure. * @param pReport The report to work on. */ static int KPRF_NAME(AnalyzeModSegs)(KPRF_TYPE(P,REPORT) pReport) { const KU32 offEnd = pReport->pHdr->offModSegs + pReport->pHdr->cbModSegs; KU32 off = pReport->pHdr->offModSegs; while (off < offEnd) { KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(PC,MODSEG, off, pReport->pHdr); KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]); cbCur = KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR)); /* * Create a new modseg record. */ KPRF_TYPE(P,REPORTMODSEG) pSeg = (KPRF_TYPE(P,REPORTMODSEG))malloc(sizeof(*pSeg)); if (!pSeg) return -1; pSeg->offSegment = off; pSeg->pModSeg = pCur; pSeg->pMod = NULL; /* below */ pSeg->OnStackTicks = 0; pSeg->OnTopOfStackTicks = 0; pSeg->cFunctions = 0; if (!KPRF_NAME(ReportTreeInsert)(pReport, pSeg)) { free(pSeg); return -1; } pReport->cModSegs++; /* * Search for the module record. */ KPRF_TYPE(P,REPORTMOD) pMod = pReport->pFirstMod; while ( pMod && ( pMod->pFirstSeg->pModSeg->cchPath != pCur->cchPath || memcmp(pMod->pFirstSeg->pModSeg->szPath, pCur->szPath, pCur->cchPath))) pMod = pMod->pNext; if (pMod) { /** @todo sort segments */ pSeg->pMod = pMod; pSeg->pNext = pMod->pFirstSeg; pMod->pFirstSeg = pSeg; } else { KPRF_TYPE(P,REPORTMOD) pMod = (KPRF_TYPE(P,REPORTMOD))malloc(sizeof(*pMod) + pCur->cchPath); if (!pMod) return -1; pSeg->pMod = pMod; pSeg->pNext = NULL; pMod->iMod = pReport->cMods++; pMod->pNext = pReport->pFirstMod; pReport->pFirstMod = pMod; pMod->pFirstSeg = pSeg; pMod->pDbgMod = NULL; pMod->OnStackTicks = 0; pMod->OnTopOfStackTicks = 0; pMod->cFunctions = 0; int rc = kDbgModuleOpen(&pMod->pDbgMod, pSeg->pModSeg->szPath, NULL /* kLdrMod */); if (rc) pMod->pDbgMod = NULL; } /* next */ off += cbCur; } return 0; } /** * Initializes the function arrays. * * @returns 0 on success. * @returns -1 on failure. * @param pReport The report to work on. */ static int KPRF_NAME(AnalyseFunctions)(KPRF_TYPE(P,REPORT) pReport) { KU32 iFunc = pReport->pHdr->cFunctions; KPRF_TYPE(PC,FUNC) pFunc = KPRF_OFF2PTR(PC,FUNC, pReport->pHdr->offFunctions + iFunc * sizeof(*pFunc), pReport->pHdr); KPRF_TYPE(P,REPORTFUNC) pReportFunc = &pReport->paFunctions[iFunc]; while (iFunc-- > 0) { pFunc--; pReportFunc--; pReport->papSortedFunctions[iFunc] = pReportFunc; pReportFunc->pFunc = pFunc; pReportFunc->pModSeg = KPRF_NAME(ReportTreeGet)(pReport, pFunc->offModSeg); pReportFunc->pSym = NULL; pReportFunc->pLine = NULL; if (pReportFunc->pModSeg) { /* Collect module segment and module statistics. */ KPRF_TYPE(P,REPORTMODSEG) pModSeg = pReportFunc->pModSeg; pModSeg->cFunctions++; pModSeg->OnStackTicks += pFunc->OnStack.SumTicks; pModSeg->OnTopOfStackTicks += pFunc->OnTopOfStack.SumTicks; KPRF_TYPE(P,REPORTMOD) pMod = pModSeg->pMod; pMod->cFunctions++; pMod->OnStackTicks += pFunc->OnStack.SumTicks; pMod->OnTopOfStackTicks += pFunc->OnTopOfStack.SumTicks; /* Get debug info. */ KDBGADDR offSegment = pFunc->uEntryPtr - pModSeg->pModSeg->uBasePtr; int rc = kDbgModuleQuerySymbolA(pMod->pDbgMod, pModSeg->pModSeg->iSegment, offSegment, &pReportFunc->pSym); /** @todo check displacement! */ if (rc) pReportFunc->pSym = NULL; rc = kDbgModuleQueryLineA(pMod->pDbgMod, pModSeg->pModSeg->iSegment, offSegment, &pReportFunc->pLine); if (rc) pReportFunc->pLine = NULL; } } return 0; } /** * Initializes the thread arrays. * * @returns 0 on success. * @returns -1 on failure. * @param pReport The report to work on. */ static int KPRF_NAME(AnalyseThreads)(KPRF_TYPE(P,REPORT) pReport) { KU32 iThread = pReport->pHdr->cThreads; KPRF_TYPE(PC,THREAD) pThread = KPRF_OFF2PTR(PC,THREAD, pReport->pHdr->offThreads + iThread * sizeof(*pThread), pReport->pHdr); KPRF_TYPE(P,REPORTTHREAD) pReportThread = &pReport->paThreads[iThread]; while (iThread-- > 0) { pThread--; pReportThread--; pReport->papSortedThreads[iThread] = pReportThread; pReportThread->pThread = pThread; /* collect statistics */ pReport->ProfiledTicks += pThread->ProfiledTicks; pReport->OverheadTicks += pThread->OverheadTicks; pReport->SleepTicks += pThread->SleepTicks; pReport->cCalls += pThread->cCalls; } return 0; } /** * Analyses the data set, producing a report. * * @returns 0 on success. * @returns -1 on failure. * * @param pHdr The data set. * @param ppReport Where to store the report. */ static int KPRF_NAME(Analyse)(KPRF_TYPE(PC,HDR) pHdr, KPRF_TYPE(PP,REPORT) ppReport) { *ppReport = NULL; /* allocate it */ KPRF_TYPE(P,REPORT) pReport = KPRF_NAME(NewReport)(pHdr); if (!pReport) return -1; /* read module segments */ int rc = KPRF_NAME(AnalyzeModSegs)(pReport); if (!rc) { /* read functions. */ rc = KPRF_NAME(AnalyseFunctions)(pReport); if (!rc) { /* read threads */ rc = KPRF_NAME(AnalyseThreads)(pReport); if (!rc) { *ppReport = pReport; return 0; } } } KPRF_NAME(DeleteReport)(pReport); return rc; } /** * Writes row with 32-bit value. * @internal */ static void KPRF_NAME(HtmlWriteRowU32X32)(FILE *pOut, const char *pszName, KU32 u32, const char *pszUnit) { fprintf(pOut, " <tr>\n" " <th>%s</th>\n" " <td colspan=\"6\">%u (0x%x)%s%s</td>\n" " </tr>\n", pszName, u32, u32, pszUnit ? " " : "", pszUnit ? pszUnit : ""); } /** * Writes row with 32-bit value. * @internal */ static void KPRF_NAME(HtmlWriteRowU32)(FILE *pOut, const char *pszName, KU32 u32, const char *pszUnit) { fprintf(pOut, " <tr>\n" " <th>%s</th>\n" " <td colspan=\"6\">%u%s%s</td>\n" " </tr>\n", pszName, u32, pszUnit ? " " : "", pszUnit ? pszUnit : ""); } /** * Writes row with 64-bit value. * @internal */ static void KPRF_NAME(HtmlWriteRowU64)(FILE *pOut, const char *pszName, KU64 u64, const char *pszUnit) { fprintf(pOut, " <tr>\n" " <th>%s</th>\n" " <td colspan=\"6\">% " KPRF_FMT_U64 " (0x%" KPRF_FMT_X64 ")%s%s</td>\n" " </tr>\n", pszName, u64, u64, pszUnit ? " " : "", pszUnit ? pszUnit : ""); } /** * Writes row with 64-bit hex value. * @internal */ static void KPRF_NAME(HtmlWriteRowX64)(FILE *pOut, const char *pszName, KU64 u64, const char *pszUnit) { fprintf(pOut, " <tr>\n" " <th>%s</th>\n" " <td colspan=\"6\">0x%" KPRF_FMT_X64 "%s%s</td>\n" " </tr>\n", pszName, u64, pszUnit ? " " : "", pszUnit ? pszUnit : ""); } /** * Writes a ticks. */ static void KPRF_NAME(HtmlWriteParts)(FILE *pOut, KU64 cTicks, KU64 cTotalTicks) { /** U+2030 PER MILLE SIGN */ static const KU8 s_szPerMilleSignUtf8[4] = { 0xe2, 0x80, 0xb0, 0}; if (cTicks * 100 / cTotalTicks) { KU32 u = (KU32)((cTicks * 1000) / cTotalTicks); fprintf(pOut, "%u.%01u%%", u / 10, u %10); } else //if (cTicks * 100000 / cTotalTicks) { KU32 u = (KU32)((cTicks * 100000) / cTotalTicks); fprintf(pOut, "%u.%02u%s", u / 100, u % 100, s_szPerMilleSignUtf8); } /* else if (cTicks * 1000000 / cTotalTicks) fprintf(pOut, "%u ppm", (unsigned)((cTicks * 1000000) / cTotalTicks)); else fprintf(pOut, "%u ppb", (unsigned)((cTicks * 1000000000) / cTotalTicks)); */ } /** * Writes a ticks. */ static void KPRF_NAME(HtmlWriteTicks)(FILE *pOut, KU64 cTicks, KU64 cTotalTicks) { fprintf(pOut, "%" KPRF_FMT_U64 "", cTicks); if (cTotalTicks) { fprintf(pOut, "</td><td class=\"PartsRow\">"); KPRF_NAME(HtmlWriteParts)(pOut, cTicks, cTotalTicks); } } /** * Writes row with ticks value. * * @param pOut Where to write. * @aaran pszName The row name. * @param cTicks The tick count. * @param cTotalTicks If non-zero, this is used for cTicks / cTotalTicks. * @internal */ static void KPRF_NAME(HtmlWriteRowTicks)(FILE *pOut, const char *pszName, KU64 cTicks, KU64 cTotalTicks) { fprintf(pOut, " <tr>\n" " <th class=\"TicksRow\">%s</th>\n" " <td class=\"TicksRow\">", pszName); KPRF_NAME(HtmlWriteTicks)(pOut, cTicks, cTotalTicks); fprintf(pOut, "</td><td colspan=\"%d\"/>\n" " </tr>\n", cTotalTicks ? 4 : 5); } /** * Writes row with a time stat value. * * @param pOut Where to write. * @aaran pszName The row name. * @param cTicks The tick count. * @param cTotalTicks If non-zero, this is used for cTicks / cTotalTicks. * @internal */ static void KPRF_NAME(HtmlWriteRowTimeStat)(FILE *pOut, const char *pszName, KPRF_TYPE(PC,TIMESTAT) pTimeStat, KU64 cTotalTicks) { fprintf(pOut, " <tr>\n" " <th class=\"TicksRow\">%s</th>\n" " <td class=\"TicksRow\">", pszName); KPRF_NAME(HtmlWriteTicks)(pOut, pTimeStat->SumTicks, cTotalTicks); fprintf(pOut, "</td>\n" " <td class=\"MinMaxTicksRow\">"); KPRF_NAME(HtmlWriteTicks)(pOut, pTimeStat->MinTicks, cTotalTicks); fprintf(pOut, "</td>\n" " <td class=\"MinMaxTicksRow\">"); KPRF_NAME(HtmlWriteTicks)(pOut, pTimeStat->MaxTicks, cTotalTicks); fprintf(pOut, "</td>\n" " </tr>\n"); } /** * Writes row with calls value. * * @param pOut Where to write. * @aaran pszName The row name. * @param cCalls The call count. * @param cTotalCalls This is used for cCalls / cTotalCalls. * @internal */ static void KPRF_NAME(HtmlWriteRowCalls)(FILE *pOut, const char *pszName, KU64 cCalls, KU64 cTotalCalls) { fprintf(pOut, " <tr>\n" " <th class=\"CallsRow\">%s</th>\n" " <td class=\"CallsRow\">%" KPRF_FMT_U64"</td><td class=\"PartsRow\">", pszName, cCalls); KPRF_NAME(HtmlWriteParts)(pOut, cCalls, cTotalCalls); fprintf(pOut, "</td><td colspan=4></td>" " </tr>\n"); } /** * Writes row with pointer value. * @internal */ static void KPRF_NAME(HtmlWriteRowUPTR)(FILE *pOut, const char *pszName, KPRF_TYPE(,UPTR) uPtr, const char *pszUnit) { fprintf(pOut, " <tr>\n" " <th>%s</th>\n" " <td colspan=\"6\">%" KPRF_FMT_UPTR "%s%s</td>\n" " </tr>\n", pszName, uPtr, pszUnit ? " " : "", pszUnit ? pszUnit : ""); } /** * Writes row with string value. * @internal */ static void KPRF_NAME(HtmlWriteRowString)(FILE *pOut, const char *pszName, const char *pszClass, const char *pszFormat, ...) { fprintf(pOut, " <tr>\n" " <th>%s</th>\n" " <td%s%s%s colspan=\"6\">", pszName, pszClass ? " class=\"" : "", pszClass ? pszClass : "", pszClass ? "\"" : ""); va_list va; va_start(va, pszFormat); vfprintf(pOut, pszFormat, va); va_end(va); fprintf(pOut, "</td>\n" " </tr>\n"); } /** * The first column */ typedef enum KPRF_TYPE(,FIRSTCOLUMN) { KPRF_TYPE(,FIRSTCOLUMN_ON_STACK) = 0, KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK), KPRF_TYPE(,FIRSTCOLUMN_CALLS_TO), KPRF_TYPE(,FIRSTCOLUMN_CALLS_FROM), KPRF_TYPE(,FIRSTCOLUMN_MAX) } KPRF_TYPE(,FIRSTCOLUMN); /** * Prints the table with the sorted functions. * The tricky bit is that the sorted column should be to the left of the function name. */ static void KPRF_NAME(HtmlWriteSortedFunctions)(KPRF_TYPE(P,REPORT) pReport, FILE *pOut, const char *pszName, const char *pszTitle, KPRF_TYPE(,FIRSTCOLUMN) enmFirst) { fprintf(pOut, "<h2><a name=\"%s\">%s</a></h2>\n" "\n", pszName, pszTitle); fprintf(pOut, "<table class=\"FunctionsSorted\">\n" " <tr>\n" " <th/>\n"); static const char *s_pszHeaders[KPRF_TYPE(,FIRSTCOLUMN_MAX) * 2] = { " <th colspan=8><a href=\"#Functions-TimeOnStack\">Time On Stack</a> (ticks)</th>\n", " <th colspan=2><a href=\"#Functions-TimeOnStack\">Sum</a></th>\n" " <th colspan=2><a href=\"#Functions-TimeOnStack-Min\">Min</a></th>\n" " <th colspan=2><a href=\"#Functions-TimeOnStack-Avg\">Average</a></th>\n" " <th colspan=2><a href=\"#Functions-TimeOnStack-Max\">Max</a></th>\n", " <th colspan=8><a href=\"#Functions-TimeOnTopOfStack\">Time On To Top</a> (ticks)</th>\n", " <th colspan=2><a href=\"#Functions-TimeOnTopOfStack\">Sum</a></th>\n" " <th colspan=2><a href=\"#Functions-TimeOnTopOfStack-Min\">Min</a></th>\n" " <th colspan=2><a href=\"#Functions-TimeOnTopOfStack-Avg\">Average</a></th>\n" " <th colspan=2><a href=\"#Functions-TimeOnTopOfStack-Max\">Max</a></th>\n", " <th colspan=2><a href=\"#Functions-CallsTo\">Calls To</a></th>\n", " <th/><th/>\n", " <th colspan=2><a href=\"#Functions-CallsFrom\">Calls From</a></th>\n", " <th/><th/>\n", }; fprintf(pOut, "%s", s_pszHeaders[enmFirst * 2]); fprintf(pOut, " <th>Function</th>\n"); for (unsigned i = (enmFirst + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX); i != enmFirst; i = (i + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX)) fprintf(pOut, "%s", s_pszHeaders[i * 2]); fprintf(pOut, " </tr>\n" " <tr>\n" " <th/>\n"); fprintf(pOut, "%s", s_pszHeaders[enmFirst * 2 + 1]); fprintf(pOut, " <th/>\n"); for (unsigned i = (enmFirst + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX); i != enmFirst; i = (i + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX)) fprintf(pOut, "%s", s_pszHeaders[i * 2 + 1]); fprintf(pOut, " </tr>\n"); for (KU32 iFunc = 0; iFunc < pReport->pHdr->cFunctions; iFunc++) { KPRF_TYPE(P,REPORTFUNC) pReportFunc = pReport->papSortedFunctions[iFunc]; KPRF_TYPE(PC,FUNC) pFunc = pReportFunc->pFunc; fprintf(pOut, " <tr>\n" " <td>%u</td>\n", iFunc); unsigned i = enmFirst; do { switch (i) { case KPRF_TYPE(,FIRSTCOLUMN_ON_STACK): fprintf(pOut, " <td class=\"Ticks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", pFunc->OnStack.SumTicks); KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.SumTicks, pReport->ProfiledTicks); fprintf(pOut, "</td>\n" " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", pFunc->OnStack.MinTicks); KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.MinTicks, pReport->ProfiledTicks); fprintf(pOut, "</td>\n" " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", pFunc->OnStack.SumTicks / pFunc->cOnStack); KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.MinTicks, pReport->ProfiledTicks); fprintf(pOut, "</td>\n" " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", pFunc->OnStack.MaxTicks); KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.MaxTicks, pReport->ProfiledTicks); fprintf(pOut, "</td>\n"); break; case KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK): fprintf(pOut, " <td class=\"Ticks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", pFunc->OnTopOfStack.SumTicks); KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.SumTicks, pReport->ProfiledTicks); fprintf(pOut, "</td>\n" " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", pFunc->OnTopOfStack.MinTicks); KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.MinTicks, pReport->ProfiledTicks); fprintf(pOut, "</td>\n" " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", pFunc->OnTopOfStack.SumTicks / pFunc->cOnStack); KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.MinTicks, pReport->ProfiledTicks); fprintf(pOut, "</td>\n" " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", pFunc->OnTopOfStack.MaxTicks); KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.MaxTicks, pReport->ProfiledTicks); fprintf(pOut, "</td>\n"); break; case KPRF_TYPE(,FIRSTCOLUMN_CALLS_TO): fprintf(pOut, " <td class=\"Calls\">%" KPRF_FMT_U64 "</td><td Class=\"Parts\">", pFunc->cOnStack); KPRF_NAME(HtmlWriteParts)(pOut, pFunc->cOnStack, pReport->cCalls); fprintf(pOut, "</td>\n"); break; case KPRF_TYPE(,FIRSTCOLUMN_CALLS_FROM): fprintf(pOut, " <td class=\"Calls\">%" KPRF_FMT_U64 "</td><td Class=\"Parts\">", pFunc->cCalls); KPRF_NAME(HtmlWriteParts)(pOut, pFunc->cCalls, pReport->cCalls); fprintf(pOut, "</td>\n"); break; default: break; } /* inject the function column */ if (i == enmFirst) { fprintf(pOut, " <td><a href=\"#Func-%u\">", (unsigned)(uintptr_t)(pReportFunc - pReport->paFunctions)); if (pReportFunc->pSym) fprintf(pOut, "%s</a></td>\n", pReportFunc->pSym->szName); else fprintf(pOut, "%" KPRF_FMT_UPTR "</a></td>\n", pFunc->uEntryPtr); } /* next */ i = (i + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX); } while (i != enmFirst); fprintf(pOut, " </tr>\n"); } fprintf(pOut, "</table>\n" "\n"); } /** * Writes an HTML report. * * @returns 0 on success. * @returns -1 on failure. * @param pReport The report to put into HTML. * @param pOut The file stream to write the HTML to. */ static int KPRF_NAME(WriteHtmlReport)(KPRF_TYPE(P,REPORT) pReport, FILE *pOut) { KPRF_TYPE(PC,HDR) pHdr = pReport->pHdr; /* * Write the standard html. */ fprintf(pOut, "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" "<html>\n" "<head>\n" " <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n" " <title>kProfiler 2 - %s\n" "\n" "\n" "\n" , pHdr->offCommandLine ? (const char *)KPRF_OFF2PTR(P,FUNC, pHdr->offCommandLine, pHdr) : "" ); /* * Table of contents. */ fprintf(pOut, "

Table of Contents

\n" "\n" "\n" "\n" "\n"); /* * Summary. */ fprintf(pOut, "

1.0 Summary

\n" "\n" "

\n" "\n"); if (pHdr->offCommandLine) KPRF_NAME(HtmlWriteRowString)(pOut, "Command Line", NULL, "%s", (const char *)KPRF_OFF2PTR(P,FUNC, pHdr->offCommandLine, pHdr)); KPRF_NAME(HtmlWriteRowU32X32)(pOut, "Threads", pHdr->cThreads, NULL); KPRF_NAME(HtmlWriteRowU32X32)(pOut, "Modules", pReport->cMods, NULL); KPRF_NAME(HtmlWriteRowU32X32)(pOut, "Functions", pHdr->cFunctions, NULL); KPRF_NAME(HtmlWriteRowTicks)(pOut, "Profiled", pReport->ProfiledTicks, pReport->ProfiledTicks); KPRF_NAME(HtmlWriteRowTicks)(pOut, "Sleep", pReport->SleepTicks, pReport->ProfiledTicks); KPRF_NAME(HtmlWriteRowTicks)(pOut, "Overhead", pReport->OverheadTicks, pReport->ProfiledTicks + pReport->OverheadTicks); KPRF_NAME(HtmlWriteRowCalls)(pOut, "Recorded Calls", pReport->cCalls, pReport->cCalls); fprintf(pOut, "\n"); KPRF_NAME(HtmlWriteRowString)(pOut, "kProfiler Version ", NULL, "Mark 2 Alpha 1"); KPRF_NAME(HtmlWriteRowString)(pOut, "kProfiler Build Time ", NULL, __DATE__ " " __TIME__); fprintf(pOut, "
 
\n" "

\n" "\n" "\n"); /* * Functions. */ fprintf(pOut, "

2.0 Functions

\n" "\n"); qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnStack)); KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnStack", "2.1 Time On Stack", KPRF_TYPE(,FIRSTCOLUMN_ON_STACK)); qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnStackAvg)); KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnStack-Avg", "2.2.1 Time On Stack - Average", KPRF_TYPE(,FIRSTCOLUMN_ON_STACK)); qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnStackMin)); KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnStack-Min", "2.2.2 Time On Stack - Min", KPRF_TYPE(,FIRSTCOLUMN_ON_STACK)); qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnStackMax)); KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnStack-Max", "2.2.3 Time On Stack - Max", KPRF_TYPE(,FIRSTCOLUMN_ON_STACK)); qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnTopOfStack)); KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnTopOfStack", "2.2 Time On Top Of Stack", KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK)); qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnTopOfStackAvg)); KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnTopOfStack-Avg","2.2.1 Time On Top Of Stack - Average", KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK)); qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnTopOfStackMin)); KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnTopOfStack-Min","2.2.2 Time On Top Of Stack - Min", KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK)); qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnTopOfStackMax)); KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnTopOfStack-Max","2.2.3 Time On Top Of Stack - Max", KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK)); qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareCallsTo)); KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-CallsTo", "2.4 Calls To", KPRF_TYPE(,FIRSTCOLUMN_CALLS_TO)); qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareCallsFrom)); KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-CallsFrom", "2.5 Calls From", KPRF_TYPE(,FIRSTCOLUMN_CALLS_FROM)); fprintf(pOut, "

2.5 Function Details

\n" "\n" "

\n" "\n"); for (KU32 iFunc = 0; iFunc < pHdr->cFunctions; iFunc++) { KPRF_TYPE(P,REPORTFUNC) pReportFunc = &pReport->paFunctions[iFunc]; KPRF_TYPE(PC,FUNC) pFunc = pReportFunc->pFunc; fprintf(pOut, "\n", iFunc); KPRF_NAME(HtmlWriteRowU32)(pOut, "Function No.", iFunc, NULL); if (pReportFunc->pSym) KPRF_NAME(HtmlWriteRowString)(pOut, "Name", "Name", "%s", pReportFunc->pSym->szName); if (pReportFunc->pLine) KPRF_NAME(HtmlWriteRowString)(pOut, "Location", NULL, "%s Line #%d", pReportFunc->pLine->szFile, pReportFunc->pLine->szFile, pReportFunc->pLine->iLine); if (pReportFunc->pModSeg) { KPRF_NAME(HtmlWriteRowString)(pOut, "Module", NULL, "%s", pReportFunc->pModSeg->pMod->iMod, pReportFunc->pModSeg->pModSeg->szPath); KPRF_NAME(HtmlWriteRowString)(pOut, "Segment:Offset", NULL, "%x:%" KPRF_FMT_UPTR, pReportFunc->pModSeg->pModSeg->iSegment, pFunc->uEntryPtr - pReportFunc->pModSeg->pModSeg->uBasePtr); } KPRF_NAME(HtmlWriteRowUPTR)(pOut, "Address", pFunc->uEntryPtr, NULL); KPRF_NAME(HtmlWriteRowTimeStat)(pOut, "On Stack", &pFunc->OnStack, pReport->ProfiledTicks); KPRF_NAME(HtmlWriteRowTimeStat)(pOut, "On Top Of Stack", &pFunc->OnTopOfStack, pReport->ProfiledTicks); KPRF_NAME(HtmlWriteRowCalls)(pOut, "Calls To", pFunc->cOnStack, pReport->cCalls); KPRF_NAME(HtmlWriteRowCalls)(pOut, "Calls From", pFunc->cCalls, pReport->cCalls); fprintf(pOut, "\n"); } fprintf(pOut, "
 
\n" "

\n" "\n"); /* * Threads. */ fprintf(pOut, "

3.0 Threads

\n" "\n" "

\n" "\n"); for (KU32 iThread = 0; iThread < pHdr->cThreads; iThread++) { KPRF_TYPE(PC,THREAD) pThread = pReport->paThreads[iThread].pThread; fprintf(pOut, "\n", iThread); KPRF_NAME(HtmlWriteRowU32)(pOut, "Thread No.", iThread, NULL); KPRF_NAME(HtmlWriteRowX64)(pOut, "Thread Id", pThread->ThreadId, NULL); if (pThread->szName[0]) KPRF_NAME(HtmlWriteRowString)(pOut, "Name", "Name", "%s", pThread->szName); KPRF_NAME(HtmlWriteRowUPTR)(pOut, "Stack Base Address", pThread->uStackBasePtr, NULL); KPRF_NAME(HtmlWriteRowUPTR)(pOut, "Max Stack Depth", pThread->cbMaxStack, "bytes"); //KPRF_NAME(HtmlWriteRowUPTR)(pOut, "Max Stack Depth", pThread->cMaxFrames, "frames"); /** @todo max stack frames! */ KPRF_NAME(HtmlWriteRowTicks)(pOut, "Profiled", pThread->ProfiledTicks, pReport->ProfiledTicks); KPRF_NAME(HtmlWriteRowTicks)(pOut, "Sleep", pThread->SleepTicks, pReport->ProfiledTicks); KPRF_NAME(HtmlWriteRowTicks)(pOut, "Overhead", pThread->OverheadTicks, pReport->ProfiledTicks + pReport->OverheadTicks); KPRF_NAME(HtmlWriteRowCalls)(pOut, "Recorded Calls", pThread->cCalls, pReport->cCalls); KPRF_NAME(HtmlWriteRowU64)(pOut, "Unwinds", pThread->cUnwinds, NULL); KPRF_NAME(HtmlWriteRowU64)(pOut, "Profiler Stack Overflows", pThread->cOverflows, NULL); KPRF_NAME(HtmlWriteRowU64)(pOut, "Profiler Stack Switch Rejects", pThread->cStackSwitchRejects, NULL); fprintf(pOut, "\n"); } fprintf(pOut, "
 
\n" "

\n" "\n"); /* * Modules. */ fprintf(pOut, "

4.0 Modules

\n" "\n" "

\n" "\n"); KPRF_TYPE(P,REPORTMOD) pMod = pReport->pFirstMod; KU32 iMod = 0; while (pMod) { fprintf(pOut, "\n" "\n", iMod, iMod); KPRF_NAME(HtmlWriteRowU32)(pOut, "Module No.", iMod, NULL); KPRF_NAME(HtmlWriteRowString)(pOut, "Name", "Name", "%s", pMod->pFirstSeg->pModSeg->szPath); for (KPRF_TYPE(P,REPORTMODSEG) pSeg = pMod->pFirstSeg; pSeg; pSeg = pSeg->pNext) { char szName[64]; sprintf(szName, "Segment No.%u - Base", pSeg->pModSeg->iSegment); KPRF_NAME(HtmlWriteRowUPTR)(pOut, szName, pSeg->pModSeg->uBasePtr, NULL); sprintf(szName, "Segment No.%u - Size", pSeg->pModSeg->iSegment); KPRF_NAME(HtmlWriteRowUPTR)(pOut, szName, pSeg->pModSeg->cbSegmentMinusOne + 1 > pSeg->pModSeg->cbSegmentMinusOne ? pSeg->pModSeg->cbSegmentMinusOne + 1 : pSeg->pModSeg->cbSegmentMinusOne, NULL); } KPRF_NAME(HtmlWriteRowTicks)(pOut, "On Stack", pMod->OnStackTicks, pReport->ProfiledTicks); KPRF_NAME(HtmlWriteRowTicks)(pOut, "On Top Of Stack", pMod->OnTopOfStackTicks, pReport->ProfiledTicks); KPRF_NAME(HtmlWriteRowU32)(pOut, "Functions", pMod->cFunctions, NULL); fprintf(pOut, "\n"); /* next */ iMod++; pMod = pMod->pNext; } fprintf(pOut, "
 
\n" "

\n" "\n"); /* * The End. */ fprintf(pOut, "\n" "\n"); return 0; } kbuild-3608/src/lib/kStuff/kProfiler2/prfcoreterm.cpp.h0000664000175000017500000001031514670377514023024 0ustar locutuslocutus/* $Id: prfcoreterm.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Termination Code Template. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Unwinds and terminates all the threads, and frees the stack space. * * @returns The new data set size. (pHdr->cb) * @param pHdr The profiler data set header. */ KPRF_DECL_FUNC(KU32, TerminateAll)(KPRF_TYPE(P,HDR) pHdr) { KU64 TS = KPRF_NOW(); if (!pHdr) return 0; /* * Iterate the threads and terminate all which are non-terminated. */ KPRF_TYPE(P,THREAD) paThread = KPRF_OFF2PTR(P,THREAD, pHdr->offThreads, pHdr); for (KU32 i = 0; i < pHdr->cThreads; i++) { KPRF_TYPE(P,THREAD) pCur = &paThread[i]; switch (pCur->enmState) { /* these states needs no work. */ case KPRF_TYPE(,THREADSTATE_TERMINATED): case KPRF_TYPE(,THREADSTATE_UNUSED): default: break; /* these are active and requires unwinding.*/ case KPRF_TYPE(,THREADSTATE_ACTIVE): case KPRF_TYPE(,THREADSTATE_SUSPENDED): case KPRF_TYPE(,THREADSTATE_OVERFLOWED): KPRF_NAME(TerminateThread)(pHdr, pCur, TS); break; } } /* * Free the stacks. */ if (pHdr->offStacks) { /* only if the stack is at the end of the data set. */ const KU32 cbStacks = KPRF_ALIGN(pHdr->cMaxStacks * pHdr->cbStack, 32); if (pHdr->offStacks + cbStacks == pHdr->cb) pHdr->cb -= cbStacks; pHdr->offStacks = 0; } return pHdr->cb; } /** * Sets the commandline. * * This is typically done after TerminateAll, when the stacks has * been freed up and there is plenty free space. * * @returns The new data set size. (pHdr->cb) * @param pHdr The profiler data set header. * @param cArgs The number of arguments in the array. * @param papszArgs Pointer to an array of arguments. */ KPRF_DECL_FUNC(KU32, SetCommandLine)(KPRF_TYPE(P,HDR) pHdr, unsigned cArgs, const char * const *papszArgs) { if (!pHdr) return 0; /* * Any space at all? */ if (pHdr->cb + 16 > pHdr->cbAllocated) /* 16 bytes min */ return pHdr->cb; /* * Encode untill we run out of space. */ pHdr->offCommandLine = pHdr->cb; char *psz = (char *)pHdr + pHdr->cb; char *pszMax = (char *)pHdr + pHdr->cbAllocated - 1; for (unsigned i = 0; i < cArgs && psz + 7 < pszMax; i++) { if (i > 0) *psz++ = ' '; *psz++ = '\''; const char *pszArg = papszArgs[i]; while (psz < pszMax) { char ch = *pszArg++; if (!ch) break; if (ch == '\'') { if (psz + 1 >= pszMax) break; *psz++ = '\\'; } *psz++ = ch; } if (psz < pszMax) *psz++ = '\''; } *psz++ = '\0'; pHdr->cb = psz - (char *)pHdr; pHdr->cchCommandLine = pHdr->cb - pHdr->offCommandLine - 1; return pHdr->cb; } kbuild-3608/src/lib/kStuff/kProfiler2/prfcorepre.cpp.h0000664000175000017500000001256714670377514022656 0ustar locutuslocutus/* $Id: prfcorepre.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Pre-Code Template. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** @def KPRF_OFF2PTR * Internal helper for converting a offset to a pointer. * @internal */ #define KPRF_OFF2PTR(TypePrefix, TypeName, off, pHdr) \ ( (KPRF_TYPE(TypePrefix, TypeName)) ((off) + (KPRF_TYPE(,UPTR))pHdr) ) /** @def KPRF_PTR2OFF * Internal helper for converting a pointer to a offset. * @internal */ #define KPRF_PTR2OFF(ptr, pHdr) \ ( (KPRF_TYPE(,UPTR))(ptr) - (KPRF_TYPE(,UPTR))(pHdr) ) /** @def KPRF_ALIGN * The usual align macro. * @internal */ #define KPRF_ALIGN(n, align) ( ((n) + ( (align) - 1)) & ~((align) - 1) ) /** @def KPRF_SETMIN_ALIGN * Ensures a minimum and aligned value. * @internal */ #define KPRF_SETMIN_ALIGN(n, min, align) \ do { \ if ((n) < (min)) \ (n) = (min); \ else { \ const KU32 u32 = ((n) + ( (align) - 1)) & ~((align) - 1); \ if (u32 >= (n)) \ (n) = u32; \ } \ } while (0) /** @def KPRF_OFFSETOF * My usual extended OFFSETOF macro, except this returns KU32 and mangles the type name. * @internal */ #define KPRF_OFFSETOF(kPrfType, Member) ( (KU32)(KUPTR)&((KPRF_TYPE(P,kPrfType))0)->Member ) /** @def PRF_SIZEOF * Size of a kPrf type. * @internal */ #define KPRF_SIZEOF(kPrfType) sizeof(KPRF_TYPE(,kPrfType)) /** @def KPRF_NOW * Gets the current timestamp. */ #ifndef KPRF_NOW # error "KPRF_NOW isn't defined!" #endif /** @def KRPF_IS_ACTIVE * Checks if profiling is activated or not. * The idea is to use some global variable for disabling and enabling * profiling in order to deal with init/term issues. */ #ifndef KPRF_IS_ACTIVE # define KPRF_IS_ACTIVE() 1 #endif /** @def KPRF_GET_HDR * Gets the pointer to the profiler data header. */ #ifndef KPRF_GET_HDR # error "KPRF_GET_HDR isn't defined!" #endif /** @def KPRF_GET_THREADID * Gets native thread id. This must be unique. */ #ifndef KPRF_GET_THREADID # error "KPRF_GET_THREADID isn't defined!" #endif /** @def KPRF_SET_THREAD * Sets the pointer to the current thread so we can get to it * without doing a linear search by thread id. */ #ifndef KPRF_SET_THREAD # error "KPRF_SET_THREAD isn't defined!" #endif /** @def KPRF_GET_THREAD * Gets the pointer to the current thread as set by KPRF_SET_THREAD. */ #ifndef KPRF_GET_THREAD # error "KPRF_GET_THREAD isn't defined!" #endif /** @def KPRF_MODSEGS_LOCK * Lock the module segment for updating. */ #ifndef KPRF_MODSEGS_LOCK # define KPRF_MODSEGS_LOCK() do { } while (0) #endif /** @def KPRF_MODSEGS_UNLOCK * Unlock the module segments. */ #ifndef KPRF_MODSEGS_UNLOCK # define KPRF_MODSEGS_UNLOCK() do { } while (0) #endif /** @def KPRF_THREADS_LOCK * Lock the threads for updating. */ #ifndef KPRF_THREADS_LOCK # define KPRF_THREADS_LOCK() do { } while (0) #endif /** @def KPRF_THREADS_UNLOCK * Unlock the threads. */ #ifndef KPRF_THREADS_UNLOCK # define KPRF_THREADS_UNLOCK() do { } while (0) #endif /** @def KPRF_FUNCS_READ_LOCK * Lock the functions for reading. */ #ifndef KPRF_FUNCS_READ_LOCK # define KPRF_FUNCS_READ_LOCK() do { } while (0) #endif /** @def KPRF_FUNCS_READ_UNLOCK * Releases a read lock on the functions. */ #ifndef KPRF_FUNCS_READ_UNLOCK # define KPRF_FUNCS_READ_UNLOCK() do { } while (0) #endif /** @def KPRF_FUNCS_WRITE_LOCK * Lock the functions for updating. */ #ifndef KPRF_FUNCS_WRITE_LOCK # define KPRF_FUNCS_WRITE_LOCK() do { } while (0) #endif /** @def KPRF_FUNCS_WRITE_UNLOCK * Releases a write lock on the functions. */ #ifndef KPRF_FUNCS_WRITE_UNLOCK # define KPRF_FUNCS_WRITE_UNLOCK() do { } while (0) #endif /** @def KPRF_ATOMIC_SET32 * Atomically set a 32-bit value. */ #ifndef KPRF_ATOMIC_SET32 # define KPRF_ATOMIC_SET32(pu32, u32) do { *(pu32) = (u32); } while (0) #endif /** @def KPRF_ATOMIC_SET64 * Atomically (well, in a safe way) adds to a 64-bit value. */ #ifndef KPRF_ATOMIC_ADD64 # define KPRF_ATOMIC_ADD64(pu64, u64) do { *(pu64) += (u64); } while (0) #endif /** @def KPRF_ATOMIC_SET64 * Atomically (well, in a safe way) increments a 64-bit value. */ #ifndef KPRF_ATOMIC_INC64 # define KPRF_ATOMIC_INC64(pu64) KPRF_ATOMIC_ADD64(pu64, 1) #endif kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2Read.cpp0000664000175000017500000003475514670377514022044 0ustar locutuslocutus/* $Id: kPrf2Read.cpp 77 2016-06-22 17:03:55Z bird $ */ /** @file * kProfiler Mark 2 - The reader and producer of statistics. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include #include #include /** @def KPRF_OFF2PTR * Internal helper for converting a offset to a pointer. * @internal */ #define KPRF_OFF2PTR(TypePrefix, TypeName, off, pHdr) \ ( (KPRF_TYPE(TypePrefix, TypeName)) ((off) + (KUPTR)pHdr) ) /** @def KPRF_ALIGN * The usual align macro. * @internal */ #define KPRF_ALIGN(n, align) ( ((n) + ( (align) - 1)) & ~((align) - 1) ) /** @def KPRF_OFFSETOF * My usual extended offsetof macro, except this returns KU32 and mangles the type name. * @internal */ #define KPRF_OFFSETOF(kPrfType, Member) ( (KU32)(KUPTR)&((KPRF_TYPE(P,kPrfType))0)->Member ) /** @def PRF_SIZEOF * Size of a kPrf type. * @internal */ #define KPRF_SIZEOF(kPrfType) sizeof(KPRF_TYPE(,kPrfType)) #ifdef _MSC_VER # define KPRF_FMT_U64 "I64u" # define KPRF_FMT_X64 "I64x" # define KPRF_FMT_I64 "I64d" #else # define KPRF_FMT_X64 "llx" # define KPRF_FMT_U64 "llu" # define KPRF_FMT_I64 "lld" #endif /* * Instantiate the readers. */ /* 32-bit */ #define KPRF_NAME(Suffix) KPrf32##Suffix #define KPRF_TYPE(Prefix,Suffix) Prefix##KPRF32##Suffix #define KPRF_BITS 32 #define KPRF_FMT_UPTR "#010x" #include "prfcore.h.h" #include "prfreader.cpp.h" #undef KPRF_FMT_UPTR #undef KPRF_NAME #undef KPRF_TYPE #undef KPRF_BITS /* 64-bit */ #define KPRF_NAME(Suffix) KPrf64##Suffix #define KPRF_TYPE(Prefix,Suffix) Prefix##KPRF64##Suffix #define KPRF_BITS 64 #ifdef _MSC_VER # define KPRF_FMT_UPTR "#018I64x" #else # define KPRF_FMT_UPTR "#018llx" #endif #include "prfcore.h.h" #include "prfreader.cpp.h" #undef KPRF_FMT_UPTR #undef KPRF_NAME #undef KPRF_TYPE #undef KPRF_BITS /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Header union type. */ typedef union KPRFHDR { KPRF32HDR Hdr32; KPRF64HDR Hdr64; } KPRFHDR; typedef KPRFHDR *PKPRFHDR; typedef const KPRFHDR *PCKPRFHDR; /** * Read the data set into memory. * * @returns Pointer to the loaded data set. (release using free()). * * @param pszFilename The path to the profiler data set. * @param pcb Where to store the size of the data set. * @param pOut Where to write errors. */ PKPRFHDR kPrfLoad(const char *pszFilename, KU32 *pcb, FILE *pOut) { FILE *pFile = fopen(pszFilename, "rb"); if (!pFile) { fprintf(pOut, "Cannot open '%s' for reading!\n", pszFilename); return NULL; } /* * Read the file into memory. */ long cbFile; if ( !fseek(pFile, 0, SEEK_END) && (cbFile = ftell(pFile)) >= 0 && !fseek(pFile, 0, SEEK_SET) ) { if (pcb) *pcb = cbFile; void *pvData = malloc(cbFile); if (pvData) { if (fread(pvData, cbFile, 1, pFile)) { fclose(pFile); return (PKPRFHDR)pvData; } fprintf(pOut, "Failed reading '%s' into memory!\n", pszFilename); free(pvData); } else fprintf(pOut, "Failed to allocate %ld bytes of memory for reading the file '%s' into!\n", cbFile, pszFilename); } else fprintf(pOut, "Failed to determin the size of '%s'!\n", pszFilename); fclose(pFile); return NULL; } /** * Validates the data set * * @returns true if valid. * @returns false if invalid. * * @param pHdr Pointer to the data set. * @param cb The size of the data set. * @param pOut Where to write error messages. */ static bool kPrfIsValidate(PCKPRFHDR pHdr, KU32 cb, FILE *pOut) { /* * We ASSUMES that the header is identicial with the exception * of the uBasePtr size. (this is padded out and the upper bits are all zero) */ if ( pHdr->Hdr32.u32Magic != KPRF32HDR_MAGIC && pHdr->Hdr32.u32Magic != KPRF64HDR_MAGIC) { fprintf(pOut, "Invalid magic %#x\n", pHdr->Hdr32.u32Magic); return false; } if ( pHdr->Hdr32.cFormatBits != 32 && pHdr->Hdr32.cFormatBits != 64) { fprintf(pOut, "Invalid/Unsupported bit count %u\n", pHdr->Hdr32.cFormatBits); return false; } if (pHdr->Hdr32.cb > cb) { fprintf(pOut, "Data set size mismatch. Header say %#x, input is %#x\n", pHdr->Hdr32.cb, cb); return false; } #define KPRF_VALIDATE_SIZE(MemBaseName, cb32, cb64) do {\ if (pHdr->Hdr32.cb##MemBaseName > (pHdr->Hdr32.cFormatBits == 32 ? cb32 : cb64)) \ { \ fprintf(pOut, "cb" #MemBaseName " was expected to be %#x but is %#x. Probably a format change, rebuild.\n", \ (unsigned)(pHdr->Hdr32.cFormatBits == 32 ? cb32 : cb64), pHdr->Hdr32.cb##MemBaseName); \ return false; \ }\ } while (0) KPRF_VALIDATE_SIZE(Function, sizeof(KPRF32FUNC), sizeof(KPRF64FUNC)); KPRF_VALIDATE_SIZE(Thread, sizeof(KPRF32THREAD), sizeof(KPRF64THREAD)); KPRF_VALIDATE_SIZE(Stack, (KU32)&((PKPRF32STACK)0)->aFrames[pHdr->Hdr32.cMaxStackFrames], (KU32)&((PKPRF64STACK)0)->aFrames[pHdr->Hdr32.cMaxStackFrames]); KUPTR cbHeader = (KUPTR)&pHdr->Hdr32.aiFunctions[pHdr->Hdr32.cFunctions] - (KUPTR)pHdr; if ( cbHeader != (KU32)cbHeader || cbHeader >= cb) { fprintf(pOut, "cFunctions (%#x) is too large to fit the lookup table inside the data set.\n", pHdr->Hdr32.cFunctions); return false; } /* The space assignment is hereby required to be equal to the member order in the header. */ KU32 offMin = cbHeader; #define KPRF_VALIDATE_OFF(off, name) do {\ if ( off > 0 \ && off < offMin) \ { \ fprintf(pOut, #name " (%#x) is overlapping with other element or invalid space assignment order.\n", off); \ return false; \ }\ if (off >= cb) \ { \ fprintf(pOut, #name " (%#x) is outside the data set (%#x)\n", off, cb); \ return false; \ }\ } while (0) #define KPRF_VALIDATE_MEM(MemBaseName) do {\ KPRF_VALIDATE_OFF(pHdr->Hdr32.off##MemBaseName##s, off##MemBaseName##s); \ if ( pHdr->Hdr32.off##MemBaseName##s \ && ( pHdr->Hdr32.off##MemBaseName##s + pHdr->Hdr32.cb##MemBaseName * pHdr->Hdr32.cMax##MemBaseName##s > cb \ || pHdr->Hdr32.off##MemBaseName##s + pHdr->Hdr32.cb##MemBaseName * pHdr->Hdr32.cMax##MemBaseName##s < pHdr->Hdr32.off##MemBaseName##s)\ ) \ { \ fprintf(pOut, #MemBaseName " (%#x) is outside the data set (%#x)\n", \ pHdr->Hdr32.off##MemBaseName##s + pHdr->Hdr32.cb##MemBaseName * pHdr->Hdr32.cMax##MemBaseName##s, cb); \ return false; \ }\ if (pHdr->Hdr32.c##MemBaseName##s > pHdr->Hdr32.cMax##MemBaseName##s) \ { \ fprintf(pOut, "c" #MemBaseName " (%#x) higher than the max (%#x)\n", \ pHdr->Hdr32.c##MemBaseName##s, pHdr->Hdr32.cMax##MemBaseName##s); \ return false; \ } \ if (pHdr->Hdr32.off##MemBaseName##s) \ offMin += pHdr->Hdr32.cb##MemBaseName * pHdr->Hdr32.cMax##MemBaseName##s; \ } while (0) KPRF_VALIDATE_MEM(Function); KPRF_VALIDATE_OFF(pHdr->Hdr32.offModSegs, offModSegs); if (pHdr->Hdr32.offModSegs) KPRF_VALIDATE_OFF(pHdr->Hdr32.offModSegs + pHdr->Hdr32.cbMaxModSegs, cbMaxModSegs); if (pHdr->Hdr32.cbModSegs > pHdr->Hdr32.cbMaxModSegs) { fprintf(pOut, "ccbModSegs (%#x) higher than the max (%#x)\n", pHdr->Hdr32.cbModSegs, pHdr->Hdr32.cbMaxModSegs); return false; } if (pHdr->Hdr32.offModSegs) \ offMin += pHdr->Hdr32.cbMaxModSegs; \ KPRF_VALIDATE_MEM(Thread); KPRF_VALIDATE_MEM(Stack); KPRF_VALIDATE_OFF(pHdr->Hdr32.offCommandLine, offCommandLine); KPRF_VALIDATE_OFF(pHdr->Hdr32.offCommandLine + pHdr->Hdr32.cchCommandLine, cchCommandLine); /* * Validate the function lookup table */ for (KU32 i = 0; i < pHdr->Hdr32.cFunctions; i++) if (pHdr->Hdr32.aiFunctions[i] >= pHdr->Hdr32.cFunctions) { fprintf(pOut, "Function lookup entry %#x is invalid: index %#x, max is %#x\n", i, pHdr->Hdr32.aiFunctions[i], pHdr->Hdr32.cFunctions); return false; } /* * Validate the functions. */ switch (pHdr->Hdr32.cFormatBits) { case 32: return KPrf32IsValid(&pHdr->Hdr32, cb, pOut); case 64: return KPrf64IsValid(&pHdr->Hdr64, cb, pOut); } return false; #undef KPRF_VALIDATE_SIZE #undef KPRF_VALIDATE_MEM #undef KPRF_VALIDATE_OFF } /** * Dumps a kProfiler 2 format file. * * @returns 0 on success. * @returns -1 on failure. * * @param pszFilename The path to the profiler data set. * @param pOut Where to write the output. */ int KPrfDumpFile(const char *pszFilename, FILE *pOut) { /* * Load and validate the data set. */ KU32 cb; PKPRFHDR pHdr = kPrfLoad(pszFilename, &cb, pOut); if (!pHdr) return -1; if (!kPrfIsValidate(pHdr, cb, pOut)) return -1; /* * Switch to the appropirate dumper routine. */ int rc; switch (pHdr->Hdr32.cFormatBits) { case 32: rc = KPrf32Dump(&pHdr->Hdr32, pOut); break; case 64: rc = KPrf64Dump(&pHdr->Hdr64, pOut); break; default: fprintf(stderr, "Unsupported bit count %d\n", pHdr->Hdr32.cFormatBits); rc = -1; break; } return rc; } /** * Creates a HTML report from a kProfiler 2 format file. * * @returns 0 on success. * @returns -1 on failure. * * @param pszFilename The path to the profiler data set. * @param pOut Where to write the output. */ int KPrfHtmlReport(const char *pszFilename, FILE *pOut) { /* * Load and validate the data set. */ KU32 cb; PKPRFHDR pHdr = kPrfLoad(pszFilename, &cb, pOut); if (!pHdr) return -1; if (!kPrfIsValidate(pHdr, cb, pOut)) return -1; /* * Switch to the appropirate dumper routine. */ int rc; switch (pHdr->Hdr32.cFormatBits) { case 32: { PKPRF32REPORT pReport; rc = KPrf32Analyse(&pHdr->Hdr32, &pReport); if (!rc) { rc = KPrf32WriteHtmlReport(pReport, pOut); if (rc) fprintf(stderr, "Error while writing HTML report for '%s'\n", pszFilename); KPrf32DeleteReport(pReport); } else fprintf(stderr, "Analysis of '%s' failed!\n", pszFilename); break; } case 64: { PKPRF64REPORT pReport; rc = KPrf64Analyse(&pHdr->Hdr64, &pReport); if (!rc) { rc = KPrf64WriteHtmlReport(pReport, pOut); if (rc) fprintf(stderr, "Error while writing HTML report for '%s'\n", pszFilename); KPrf64DeleteReport(pReport); } else fprintf(stderr, "Analysis of '%s' failed!\n", pszFilename); break; } default: fprintf(stderr, "Unsupported bit count %d\n", pHdr->Hdr32.cFormatBits); rc = -1; break; } return rc; } /** * Prints the usage. */ static int Usage(void) { printf("kProfiler MK2 - Reader & Producer of Statistics\n" "usage: kPrf2Read [-r|-d] [[-r|-d] file2 []]\n" ); return 1; } int main(int argc, char **argv) { /* * Parse arguments. */ if (argc <= 1) return Usage(); enum { OP_DUMP, OP_HTML } enmOp = OP_DUMP; for (int i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { case 'h': case 'H': case '?': case '-': return Usage(); case 'd': enmOp = OP_DUMP; break; case 'r': enmOp = OP_HTML; break; default: printf("Syntax error: Unknown argument '%s'\n", argv[i]); return 1; } } else { int rc; switch (enmOp) { case OP_DUMP: rc = KPrfDumpFile(argv[i], stdout); break; case OP_HTML: rc = KPrfHtmlReport(argv[i], stdout); break; } if (rc) return rc; } } return 0; } kbuild-3608/src/lib/kStuff/kProfiler2/kPrfReader.h0000664000175000017500000000167514670377515021752 0ustar locutuslocutus #include typedef /** * Debug info cache. * * An objects of this class acts a frontend to the low-level * debug info readers. */ class kPrfDebugInfoCache { public: kPrfDebugInfoCache(unsigned cMaxModules = ~0U); ~kPrfDebugInfoCache(); /** Resolves a symbol in a specific module. */ int findSymbol(); int findLine(); }; /** * Internal class which does the reader job behind the API / commandline tool. */ class kPrfReader { public: kPrfReader(const char *pszDataSetPath); ~kPrfReader(); /** Analyses the data set. */ int analyse(int fSomeOptionsIHaventFiguredOutYet); /** Writes the analysis report as HTML. */ int reportAsHtml(FILE *pOut); /** Dumps the data set in a raw fashion to the specified file stream. */ int dump(FILE *pOut); protected: /** Pointer to the debug info cache object. */ kPrfDebugInfoCache *pDbgCache; }; kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappersImp-x86.def0000664000175000017500000010636214670377514025143 0ustar locutuslocutusLIBRARY kPrf2WinApiWrappers EXPORTS _ActivateActCtx@8 _ActivateActCtx@8 _AddAtomA@4 _AddAtomA@4 _AddAtomW@4 _AddAtomW@4 _AddConsoleAliasA@12 _AddConsoleAliasA@12 _AddConsoleAliasW@12 _AddConsoleAliasW@12 _AddRefActCtx@4 _AddRefActCtx@4 _AddVectoredContinueHandler@8 _AddVectoredContinueHandler@8 _AddVectoredExceptionHandler@8 _AddVectoredExceptionHandler@8 _AllocConsole@0 _AllocConsole@0 _AllocateUserPhysicalPages@12 _AllocateUserPhysicalPages@12 _AreFileApisANSI@0 _AreFileApisANSI@0 _AssignProcessToJobObject@8 _AssignProcessToJobObject@8 _AttachConsole@4 _AttachConsole@4 _BackupRead@28 _BackupRead@28 _BackupSeek@24 _BackupSeek@24 _BackupWrite@28 _BackupWrite@28 _Beep@8 _Beep@8 _BeginUpdateResourceA@8 _BeginUpdateResourceA@8 _BeginUpdateResourceW@8 _BeginUpdateResourceW@8 _BindIoCompletionCallback@12 _BindIoCompletionCallback@12 _BuildCommDCBA@8 _BuildCommDCBA@8 _BuildCommDCBAndTimeoutsA@12 _BuildCommDCBAndTimeoutsA@12 _BuildCommDCBAndTimeoutsW@12 _BuildCommDCBAndTimeoutsW@12 _BuildCommDCBW@8 _BuildCommDCBW@8 _CallNamedPipeA@28 _CallNamedPipeA@28 _CallNamedPipeW@28 _CallNamedPipeW@28 _CancelDeviceWakeupRequest@4 _CancelDeviceWakeupRequest@4 _CancelIo@4 _CancelIo@4 _CancelTimerQueueTimer@8 _CancelTimerQueueTimer@8 _CancelWaitableTimer@4 _CancelWaitableTimer@4 _ChangeTimerQueueTimer@16 _ChangeTimerQueueTimer@16 _CheckNameLegalDOS8Dot3A@20 _CheckNameLegalDOS8Dot3A@20 _CheckNameLegalDOS8Dot3W@20 _CheckNameLegalDOS8Dot3W@20 _CheckRemoteDebuggerPresent@8 _CheckRemoteDebuggerPresent@8 _ClearCommBreak@4 _ClearCommBreak@4 _ClearCommError@12 _ClearCommError@12 _CloseHandle@4 _CloseHandle@4 _CommConfigDialogA@12 _CommConfigDialogA@12 _CommConfigDialogW@12 _CommConfigDialogW@12 _CompareFileTime@8 _CompareFileTime@8 _CompareStringA@24 _CompareStringA@24 _CompareStringW@24 _CompareStringW@24 _ConnectNamedPipe@8 _ConnectNamedPipe@8 _ContinueDebugEvent@12 _ContinueDebugEvent@12 _ConvertDefaultLocale@4 _ConvertDefaultLocale@4 _ConvertFiberToThread@0 _ConvertFiberToThread@0 _ConvertThreadToFiber@4 _ConvertThreadToFiber@4 _ConvertThreadToFiberEx@8 _ConvertThreadToFiberEx@8 _CopyFileA@12 _CopyFileA@12 _CopyFileExA@24 _CopyFileExA@24 _CopyFileExW@24 _CopyFileExW@24 _CopyFileW@12 _CopyFileW@12 _CreateActCtxA@4 _CreateActCtxA@4 _CreateActCtxW@4 _CreateActCtxW@4 _CreateConsoleScreenBuffer@20 _CreateConsoleScreenBuffer@20 _CreateDirectoryA@8 _CreateDirectoryA@8 _CreateDirectoryExA@12 _CreateDirectoryExA@12 _CreateDirectoryExW@12 _CreateDirectoryExW@12 _CreateDirectoryW@8 _CreateDirectoryW@8 _CreateEventA@16 _CreateEventA@16 _CreateEventW@16 _CreateEventW@16 _CreateFiber@12 _CreateFiber@12 _CreateFiberEx@20 _CreateFiberEx@20 _CreateFileA@28 _CreateFileA@28 _CreateFileMappingA@24 _CreateFileMappingA@24 _CreateFileMappingW@24 _CreateFileMappingW@24 _CreateFileW@28 _CreateFileW@28 _CreateHardLinkA@12 _CreateHardLinkA@12 _CreateHardLinkW@12 _CreateHardLinkW@12 _CreateIoCompletionPort@16 _CreateIoCompletionPort@16 _CreateJobObjectA@8 _CreateJobObjectA@8 _CreateJobObjectW@8 _CreateJobObjectW@8 _CreateJobSet@12 _CreateJobSet@12 _CreateMailslotA@16 _CreateMailslotA@16 _CreateMailslotW@16 _CreateMailslotW@16 _CreateMemoryResourceNotification@4 _CreateMemoryResourceNotification@4 _CreateMutexA@12 _CreateMutexA@12 _CreateMutexW@12 _CreateMutexW@12 _CreateNamedPipeA@32 _CreateNamedPipeA@32 _CreateNamedPipeW@32 _CreateNamedPipeW@32 _CreatePipe@16 _CreatePipe@16 _CreateProcessA@40 _CreateProcessA@40 _CreateProcessW@40 _CreateProcessW@40 _CreateRemoteThread@28 _CreateRemoteThread@28 _CreateSemaphoreA@16 _CreateSemaphoreA@16 _CreateSemaphoreW@16 _CreateSemaphoreW@16 _CreateTapePartition@16 _CreateTapePartition@16 _CreateThread@24 _CreateThread@24 _CreateTimerQueue@0 _CreateTimerQueue@0 _CreateTimerQueueTimer@28 _CreateTimerQueueTimer@28 _CreateToolhelp32Snapshot@8 _CreateToolhelp32Snapshot@8 _CreateWaitableTimerA@12 _CreateWaitableTimerA@12 _CreateWaitableTimerW@12 _CreateWaitableTimerW@12 _DeactivateActCtx@8 _DeactivateActCtx@8 _DebugActiveProcess@4 _DebugActiveProcess@4 _DebugActiveProcessStop@4 _DebugActiveProcessStop@4 _DebugBreak@0 _DebugBreak@0 _DebugBreakProcess@4 _DebugBreakProcess@4 _DebugSetProcessKillOnExit@4 _DebugSetProcessKillOnExit@4 _DecodePointer@4 _DecodePointer@4 _DecodeSystemPointer@4 _DecodeSystemPointer@4 _DefineDosDeviceA@12 _DefineDosDeviceA@12 _DefineDosDeviceW@12 _DefineDosDeviceW@12 _DeleteAtom@4 _DeleteAtom@4 _DeleteCriticalSection@4 _DeleteCriticalSection@4 _DeleteFiber@4 _DeleteFiber@4 _DeleteFileA@4 _DeleteFileA@4 _DeleteFileW@4 _DeleteFileW@4 _DeleteTimerQueue@4 _DeleteTimerQueue@4 _DeleteTimerQueueEx@8 _DeleteTimerQueueEx@8 _DeleteTimerQueueTimer@12 _DeleteTimerQueueTimer@12 _DeleteVolumeMountPointA@4 _DeleteVolumeMountPointA@4 _DeleteVolumeMountPointW@4 _DeleteVolumeMountPointW@4 _DeviceIoControl@32 _DeviceIoControl@32 _DisableThreadLibraryCalls@4 _DisableThreadLibraryCalls@4 _DisconnectNamedPipe@4 _DisconnectNamedPipe@4 _DnsHostnameToComputerNameA@12 _DnsHostnameToComputerNameA@12 _DnsHostnameToComputerNameW@12 _DnsHostnameToComputerNameW@12 _DosDateTimeToFileTime@12 _DosDateTimeToFileTime@12 _DuplicateHandle@28 _DuplicateHandle@28 _EncodePointer@4 _EncodePointer@4 _EncodeSystemPointer@4 _EncodeSystemPointer@4 _EndUpdateResourceA@8 _EndUpdateResourceA@8 _EndUpdateResourceW@8 _EndUpdateResourceW@8 _EnterCriticalSection@4 _EnterCriticalSection@4 _EnumCalendarInfoA@16 _EnumCalendarInfoA@16 _EnumCalendarInfoExA@16 _EnumCalendarInfoExA@16 _EnumCalendarInfoExW@16 _EnumCalendarInfoExW@16 _EnumCalendarInfoW@16 _EnumCalendarInfoW@16 _EnumDateFormatsA@12 _EnumDateFormatsA@12 _EnumDateFormatsExA@12 _EnumDateFormatsExA@12 _EnumDateFormatsExW@12 _EnumDateFormatsExW@12 _EnumDateFormatsW@12 _EnumDateFormatsW@12 _EnumLanguageGroupLocalesA@16 _EnumLanguageGroupLocalesA@16 _EnumLanguageGroupLocalesW@16 _EnumLanguageGroupLocalesW@16 _EnumResourceLanguagesA@20 _EnumResourceLanguagesA@20 _EnumResourceLanguagesW@20 _EnumResourceLanguagesW@20 _EnumResourceNamesA@16 _EnumResourceNamesA@16 _EnumResourceNamesW@16 _EnumResourceNamesW@16 _EnumResourceTypesA@12 _EnumResourceTypesA@12 _EnumResourceTypesW@12 _EnumResourceTypesW@12 _EnumSystemCodePagesA@8 _EnumSystemCodePagesA@8 _EnumSystemCodePagesW@8 _EnumSystemCodePagesW@8 _EnumSystemFirmwareTables@12 _EnumSystemFirmwareTables@12 _EnumSystemGeoID@12 _EnumSystemGeoID@12 _EnumSystemLanguageGroupsA@12 _EnumSystemLanguageGroupsA@12 _EnumSystemLanguageGroupsW@12 _EnumSystemLanguageGroupsW@12 _EnumSystemLocalesA@8 _EnumSystemLocalesA@8 _EnumSystemLocalesW@8 _EnumSystemLocalesW@8 _EnumTimeFormatsA@12 _EnumTimeFormatsA@12 _EnumTimeFormatsW@12 _EnumTimeFormatsW@12 _EnumUILanguagesA@12 _EnumUILanguagesA@12 _EnumUILanguagesW@12 _EnumUILanguagesW@12 _EraseTape@12 _EraseTape@12 _EscapeCommFunction@8 _EscapeCommFunction@8 _ExitProcess@4 _ExitProcess@4 _ExitThread@4 _ExitThread@4 _ExpandEnvironmentStringsA@12 _ExpandEnvironmentStringsA@12 _ExpandEnvironmentStringsW@12 _ExpandEnvironmentStringsW@12 _FatalAppExitA@8 _FatalAppExitA@8 _FatalAppExitW@8 _FatalAppExitW@8 _FatalExit@4 _FatalExit@4 _FileTimeToDosDateTime@12 _FileTimeToDosDateTime@12 _FileTimeToLocalFileTime@8 _FileTimeToLocalFileTime@8 _FileTimeToSystemTime@8 _FileTimeToSystemTime@8 _FillConsoleOutputAttribute@20 _FillConsoleOutputAttribute@20 _FillConsoleOutputCharacterA@20 _FillConsoleOutputCharacterA@20 _FillConsoleOutputCharacterW@20 _FillConsoleOutputCharacterW@20 _FindActCtxSectionGuid@20 _FindActCtxSectionGuid@20 _FindActCtxSectionStringA@20 _FindActCtxSectionStringA@20 _FindActCtxSectionStringW@20 _FindActCtxSectionStringW@20 _FindAtomA@4 _FindAtomA@4 _FindAtomW@4 _FindAtomW@4 _FindClose@4 _FindClose@4 _FindCloseChangeNotification@4 _FindCloseChangeNotification@4 _FindFirstChangeNotificationA@12 _FindFirstChangeNotificationA@12 _FindFirstChangeNotificationW@12 _FindFirstChangeNotificationW@12 _FindFirstFileA@8 _FindFirstFileA@8 _FindFirstFileExA@24 _FindFirstFileExA@24 _FindFirstFileExW@24 _FindFirstFileExW@24 _FindFirstFileW@8 _FindFirstFileW@8 _FindFirstStreamW@16 _FindFirstStreamW@16 _FindFirstVolumeA@8 _FindFirstVolumeA@8 _FindFirstVolumeMountPointA@12 _FindFirstVolumeMountPointA@12 _FindFirstVolumeMountPointW@12 _FindFirstVolumeMountPointW@12 _FindFirstVolumeW@8 _FindFirstVolumeW@8 _FindNextChangeNotification@4 _FindNextChangeNotification@4 _FindNextFileA@8 _FindNextFileA@8 _FindNextFileW@8 _FindNextFileW@8 _FindNextStreamW@8 _FindNextStreamW@8 _FindNextVolumeA@12 _FindNextVolumeA@12 _FindNextVolumeMountPointA@12 _FindNextVolumeMountPointA@12 _FindNextVolumeMountPointW@12 _FindNextVolumeMountPointW@12 _FindNextVolumeW@12 _FindNextVolumeW@12 _FindResourceA@12 _FindResourceA@12 _FindResourceExA@16 _FindResourceExA@16 _FindResourceExW@16 _FindResourceExW@16 _FindResourceW@12 _FindResourceW@12 _FindVolumeClose@4 _FindVolumeClose@4 _FindVolumeMountPointClose@4 _FindVolumeMountPointClose@4 _FlsAlloc@4 _FlsAlloc@4 _FlsFree@4 _FlsFree@4 _FlsGetValue@4 _FlsGetValue@4 _FlsSetValue@8 _FlsSetValue@8 _FlushConsoleInputBuffer@4 _FlushConsoleInputBuffer@4 _FlushFileBuffers@4 _FlushFileBuffers@4 _FlushInstructionCache@12 _FlushInstructionCache@12 _FlushViewOfFile@8 _FlushViewOfFile@8 _FoldStringA@20 _FoldStringA@20 _FoldStringW@20 _FoldStringW@20 _FormatMessageA@28 _FormatMessageA@28 _FormatMessageW@28 _FormatMessageW@28 _FreeConsole@0 _FreeConsole@0 _FreeEnvironmentStringsA@4 _FreeEnvironmentStringsA@4 _FreeEnvironmentStringsW@4 _FreeEnvironmentStringsW@4 _FreeLibrary@4 _FreeLibrary@4 _FreeLibraryAndExitThread@8 _FreeLibraryAndExitThread@8 _FreeResource@4 _FreeResource@4 _FreeUserPhysicalPages@12 _FreeUserPhysicalPages@12 _GenerateConsoleCtrlEvent@8 _GenerateConsoleCtrlEvent@8 _GetACP@0 _GetACP@0 _GetAtomNameA@12 _GetAtomNameA@12 _GetAtomNameW@12 _GetAtomNameW@12 _GetBinaryType@8 _GetBinaryType@8 _GetBinaryTypeA@8 _GetBinaryTypeA@8 _GetBinaryTypeW@8 _GetBinaryTypeW@8 _GetCPInfo@8 _GetCPInfo@8 _GetCPInfoExA@12 _GetCPInfoExA@12 _GetCPInfoExW@12 _GetCPInfoExW@12 _GetCalendarInfoA@24 _GetCalendarInfoA@24 _GetCalendarInfoW@24 _GetCalendarInfoW@24 _GetCommConfig@12 _GetCommConfig@12 _GetCommMask@8 _GetCommMask@8 _GetCommModemStatus@8 _GetCommModemStatus@8 _GetCommProperties@8 _GetCommProperties@8 _GetCommState@8 _GetCommState@8 _GetCommTimeouts@8 _GetCommTimeouts@8 _GetCommandLineA@0 _GetCommandLineA@0 _GetCommandLineW@0 _GetCommandLineW@0 _GetCompressedFileSizeA@8 _GetCompressedFileSizeA@8 _GetCompressedFileSizeW@8 _GetCompressedFileSizeW@8 _GetComputerNameA@8 _GetComputerNameA@8 _GetComputerNameExA@12 _GetComputerNameExA@12 _GetComputerNameExW@12 _GetComputerNameExW@12 _GetComputerNameW@8 _GetComputerNameW@8 _GetConsoleAliasA@16 _GetConsoleAliasA@16 _GetConsoleAliasExesA@8 _GetConsoleAliasExesA@8 _GetConsoleAliasExesLengthA@0 _GetConsoleAliasExesLengthA@0 _GetConsoleAliasExesLengthW@0 _GetConsoleAliasExesLengthW@0 _GetConsoleAliasExesW@8 _GetConsoleAliasExesW@8 _GetConsoleAliasW@16 _GetConsoleAliasW@16 _GetConsoleAliasesA@12 _GetConsoleAliasesA@12 _GetConsoleAliasesLengthA@4 _GetConsoleAliasesLengthA@4 _GetConsoleAliasesLengthW@4 _GetConsoleAliasesLengthW@4 _GetConsoleAliasesW@12 _GetConsoleAliasesW@12 _GetConsoleCP@0 _GetConsoleCP@0 _GetConsoleCursorInfo@8 _GetConsoleCursorInfo@8 _GetConsoleDisplayMode@4 _GetConsoleDisplayMode@4 _GetConsoleFontSize@8 _GetConsoleFontSize@8 _GetConsoleMode@8 _GetConsoleMode@8 _GetConsoleOutputCP@0 _GetConsoleOutputCP@0 _GetConsoleProcessList@8 _GetConsoleProcessList@8 _GetConsoleScreenBufferInfo@8 _GetConsoleScreenBufferInfo@8 _GetConsoleSelectionInfo@4 _GetConsoleSelectionInfo@4 _GetConsoleTitleA@8 _GetConsoleTitleA@8 _GetConsoleTitleW@8 _GetConsoleTitleW@8 _GetConsoleWindow@0 _GetConsoleWindow@0 _GetCurrencyFormatA@24 _GetCurrencyFormatA@24 _GetCurrencyFormatW@24 _GetCurrencyFormatW@24 _GetCurrentActCtx@4 _GetCurrentActCtx@4 _GetCurrentConsoleFont@12 _GetCurrentConsoleFont@12 _GetCurrentDirectoryA@8 _GetCurrentDirectoryA@8 _GetCurrentDirectoryW@8 _GetCurrentDirectoryW@8 _GetCurrentProcess@0 _GetCurrentProcess@0 _GetCurrentProcessId@0 _GetCurrentProcessId@0 _GetCurrentProcessorNumber@0 _GetCurrentProcessorNumber@0 _GetCurrentThread@0 _GetCurrentThread@0 _GetCurrentThreadId@0 _GetCurrentThreadId@0 _GetDateFormatA@24 _GetDateFormatA@24 _GetDateFormatW@24 _GetDateFormatW@24 _GetDefaultCommConfigA@12 _GetDefaultCommConfigA@12 _GetDefaultCommConfigW@12 _GetDefaultCommConfigW@12 _GetDevicePowerState@8 _GetDevicePowerState@8 _GetDiskFreeSpaceA@20 _GetDiskFreeSpaceA@20 _GetDiskFreeSpaceExA@16 _GetDiskFreeSpaceExA@16 _GetDiskFreeSpaceExW@16 _GetDiskFreeSpaceExW@16 _GetDiskFreeSpaceW@20 _GetDiskFreeSpaceW@20 _GetDllDirectoryA@8 _GetDllDirectoryA@8 _GetDllDirectoryW@8 _GetDllDirectoryW@8 _GetDriveTypeA@4 _GetDriveTypeA@4 _GetDriveTypeW@4 _GetDriveTypeW@4 _GetEnvironmentStrings@0 _GetEnvironmentStrings@0 _GetEnvironmentStringsA@0 _GetEnvironmentStringsA@0 _GetEnvironmentStringsW@0 _GetEnvironmentStringsW@0 _GetEnvironmentVariableA@12 _GetEnvironmentVariableA@12 _GetEnvironmentVariableW@12 _GetEnvironmentVariableW@12 _GetExitCodeProcess@8 _GetExitCodeProcess@8 _GetExitCodeThread@8 _GetExitCodeThread@8 _GetFileAttributesA@4 _GetFileAttributesA@4 _GetFileAttributesExA@12 _GetFileAttributesExA@12 _GetFileAttributesExW@12 _GetFileAttributesExW@12 _GetFileAttributesW@4 _GetFileAttributesW@4 _GetFileInformationByHandle@8 _GetFileInformationByHandle@8 _GetFileSize@8 _GetFileSize@8 _GetFileSizeEx@8 _GetFileSizeEx@8 _GetFileTime@16 _GetFileTime@16 _GetFileType@4 _GetFileType@4 _GetFirmwareEnvironmentVariableA@16 _GetFirmwareEnvironmentVariableA@16 _GetFirmwareEnvironmentVariableW@16 _GetFirmwareEnvironmentVariableW@16 _GetFullPathNameA@16 _GetFullPathNameA@16 _GetFullPathNameW@16 _GetFullPathNameW@16 _GetGeoInfoA@20 _GetGeoInfoA@20 _GetGeoInfoW@20 _GetGeoInfoW@20 _GetHandleInformation@8 _GetHandleInformation@8 _GetLargePageMinimum@0 _GetLargePageMinimum@0 _GetLargestConsoleWindowSize@4 _GetLargestConsoleWindowSize@4 _GetLastError@0 _GetLastError@0 _GetLocalTime@4 _GetLocalTime@4 _GetLocaleInfoA@16 _GetLocaleInfoA@16 _GetLocaleInfoW@16 _GetLocaleInfoW@16 _GetLogicalDriveStringsA@8 _GetLogicalDriveStringsA@8 _GetLogicalDriveStringsW@8 _GetLogicalDriveStringsW@8 _GetLogicalDrives@0 _GetLogicalDrives@0 _GetLogicalProcessorInformation@8 _GetLogicalProcessorInformation@8 _GetLongPathNameA@12 _GetLongPathNameA@12 _GetLongPathNameW@12 _GetLongPathNameW@12 _GetMailslotInfo@20 _GetMailslotInfo@20 _GetModuleFileNameA@12 _GetModuleFileNameA@12 _GetModuleFileNameW@12 _GetModuleFileNameW@12 _GetModuleHandleA@4 _GetModuleHandleA@4 _GetModuleHandleExA@12 _GetModuleHandleExA@12 _GetModuleHandleExW@12 _GetModuleHandleExW@12 _GetModuleHandleW@4 _GetModuleHandleW@4 _GetNLSVersion@12 _GetNLSVersion@12 _GetNamedPipeHandleStateA@28 _GetNamedPipeHandleStateA@28 _GetNamedPipeHandleStateW@28 _GetNamedPipeHandleStateW@28 _GetNamedPipeInfo@20 _GetNamedPipeInfo@20 _GetNativeSystemInfo@4 _GetNativeSystemInfo@4 _GetNumaAvailableMemoryNode@8 _GetNumaAvailableMemoryNode@8 _GetNumaHighestNodeNumber@4 _GetNumaHighestNodeNumber@4 _GetNumaNodeProcessorMask@8 _GetNumaNodeProcessorMask@8 _GetNumaProcessorNode@8 _GetNumaProcessorNode@8 _GetNumberFormatA@24 _GetNumberFormatA@24 _GetNumberFormatW@24 _GetNumberFormatW@24 _GetNumberOfConsoleInputEvents@8 _GetNumberOfConsoleInputEvents@8 _GetNumberOfConsoleMouseButtons@4 _GetNumberOfConsoleMouseButtons@4 _GetOEMCP@0 _GetOEMCP@0 _GetOverlappedResult@16 _GetOverlappedResult@16 _GetPriorityClass@4 _GetPriorityClass@4 _GetPrivateProfileIntA@16 _GetPrivateProfileIntA@16 _GetPrivateProfileIntW@16 _GetPrivateProfileIntW@16 _GetPrivateProfileSectionA@16 _GetPrivateProfileSectionA@16 _GetPrivateProfileSectionNamesA@12 _GetPrivateProfileSectionNamesA@12 _GetPrivateProfileSectionNamesW@12 _GetPrivateProfileSectionNamesW@12 _GetPrivateProfileSectionW@16 _GetPrivateProfileSectionW@16 _GetPrivateProfileStringA@24 _GetPrivateProfileStringA@24 _GetPrivateProfileStringW@24 _GetPrivateProfileStringW@24 _GetPrivateProfileStructA@20 _GetPrivateProfileStructA@20 _GetPrivateProfileStructW@20 _GetPrivateProfileStructW@20 _GetProcAddress@8 _GetProcAddress@8 _GetProcessAffinityMask@12 _GetProcessAffinityMask@12 _GetProcessHandleCount@8 _GetProcessHandleCount@8 _GetProcessHeap@0 _GetProcessHeap@0 _GetProcessHeaps@8 _GetProcessHeaps@8 _GetProcessId@4 _GetProcessId@4 _GetProcessIdOfThread@4 _GetProcessIdOfThread@4 _GetProcessIoCounters@8 _GetProcessIoCounters@8 _GetProcessPriorityBoost@8 _GetProcessPriorityBoost@8 _GetProcessShutdownParameters@8 _GetProcessShutdownParameters@8 _GetProcessTimes@20 _GetProcessTimes@20 _GetProcessVersion@4 _GetProcessVersion@4 _GetProcessWorkingSetSize@12 _GetProcessWorkingSetSize@12 _GetProcessWorkingSetSizeEx@16 _GetProcessWorkingSetSizeEx@16 _GetProfileIntA@12 _GetProfileIntA@12 _GetProfileIntW@12 _GetProfileIntW@12 _GetProfileSectionA@12 _GetProfileSectionA@12 _GetProfileSectionW@12 _GetProfileSectionW@12 _GetProfileStringA@20 _GetProfileStringA@20 _GetProfileStringW@20 _GetProfileStringW@20 _GetQueuedCompletionStatus@20 _GetQueuedCompletionStatus@20 _GetShortPathNameA@12 _GetShortPathNameA@12 _GetShortPathNameW@12 _GetShortPathNameW@12 _GetStartupInfoA@4 _GetStartupInfoA@4 _GetStartupInfoW@4 _GetStartupInfoW@4 _GetStdHandle@4 _GetStdHandle@4 _GetStringTypeA@20 _GetStringTypeA@20 _GetStringTypeExA@20 _GetStringTypeExA@20 _GetStringTypeExW@20 _GetStringTypeExW@20 _GetStringTypeW@16 _GetStringTypeW@16 _GetSystemDefaultLCID@0 _GetSystemDefaultLCID@0 _GetSystemDefaultLangID@0 _GetSystemDefaultLangID@0 _GetSystemDefaultUILanguage@0 _GetSystemDefaultUILanguage@0 _GetSystemDirectoryA@8 _GetSystemDirectoryA@8 _GetSystemDirectoryW@8 _GetSystemDirectoryW@8 _GetSystemFileCacheSize@12 _GetSystemFileCacheSize@12 _GetSystemFirmwareTable@16 _GetSystemFirmwareTable@16 _GetSystemInfo@4 _GetSystemInfo@4 _GetSystemPowerStatus@4 _GetSystemPowerStatus@4 _GetSystemRegistryQuota@8 _GetSystemRegistryQuota@8 _GetSystemTime@4 _GetSystemTime@4 _GetSystemTimeAdjustment@12 _GetSystemTimeAdjustment@12 _GetSystemTimeAsFileTime@4 _GetSystemTimeAsFileTime@4 _GetSystemTimes@12 _GetSystemTimes@12 _GetSystemWindowsDirectoryA@8 _GetSystemWindowsDirectoryA@8 _GetSystemWindowsDirectoryW@8 _GetSystemWindowsDirectoryW@8 _GetSystemWow64DirectoryA@8 _GetSystemWow64DirectoryA@8 _GetSystemWow64DirectoryW@8 _GetSystemWow64DirectoryW@8 _GetTapeParameters@16 _GetTapeParameters@16 _GetTapePosition@20 _GetTapePosition@20 _GetTapeStatus@4 _GetTapeStatus@4 _GetTempFileNameA@16 _GetTempFileNameA@16 _GetTempFileNameW@16 _GetTempFileNameW@16 _GetTempPathA@8 _GetTempPathA@8 _GetTempPathW@8 _GetTempPathW@8 _GetThreadContext@8 _GetThreadContext@8 _GetThreadIOPendingFlag@8 _GetThreadIOPendingFlag@8 _GetThreadId@4 _GetThreadId@4 _GetThreadLocale@0 _GetThreadLocale@0 _GetThreadPriority@4 _GetThreadPriority@4 _GetThreadPriorityBoost@8 _GetThreadPriorityBoost@8 _GetThreadSelectorEntry@12 _GetThreadSelectorEntry@12 _GetThreadTimes@20 _GetThreadTimes@20 _GetTickCount@0 _GetTickCount@0 _GetTimeFormatA@24 _GetTimeFormatA@24 _GetTimeFormatW@24 _GetTimeFormatW@24 _GetTimeZoneInformation@4 _GetTimeZoneInformation@4 _GetUserDefaultLCID@0 _GetUserDefaultLCID@0 _GetUserDefaultLangID@0 _GetUserDefaultLangID@0 _GetUserDefaultUILanguage@0 _GetUserDefaultUILanguage@0 _GetUserGeoID@4 _GetUserGeoID@4 _GetVersion@0 _GetVersion@0 _GetVersionExA@4 _GetVersionExA@4 _GetVersionExW@4 _GetVersionExW@4 _GetVolumeInformationA@32 _GetVolumeInformationA@32 _GetVolumeInformationW@32 _GetVolumeInformationW@32 _GetVolumeNameForVolumeMountPointA@12 _GetVolumeNameForVolumeMountPointA@12 _GetVolumeNameForVolumeMountPointW@12 _GetVolumeNameForVolumeMountPointW@12 _GetVolumePathNameA@12 _GetVolumePathNameA@12 _GetVolumePathNameW@12 _GetVolumePathNameW@12 _GetVolumePathNamesForVolumeNameA@16 _GetVolumePathNamesForVolumeNameA@16 _GetVolumePathNamesForVolumeNameW@16 _GetVolumePathNamesForVolumeNameW@16 _GetWindowsDirectoryA@8 _GetWindowsDirectoryA@8 _GetWindowsDirectoryW@8 _GetWindowsDirectoryW@8 _GetWriteWatch@24 _GetWriteWatch@24 _GlobalAddAtomA@4 _GlobalAddAtomA@4 _GlobalAddAtomW@4 _GlobalAddAtomW@4 _GlobalAlloc@8 _GlobalAlloc@8 _GlobalCompact@4 _GlobalCompact@4 _GlobalDeleteAtom@4 _GlobalDeleteAtom@4 _GlobalFindAtomA@4 _GlobalFindAtomA@4 _GlobalFindAtomW@4 _GlobalFindAtomW@4 _GlobalFix@4 _GlobalFix@4 _GlobalFlags@4 _GlobalFlags@4 _GlobalFree@4 _GlobalFree@4 _GlobalGetAtomNameA@12 _GlobalGetAtomNameA@12 _GlobalGetAtomNameW@12 _GlobalGetAtomNameW@12 _GlobalHandle@4 _GlobalHandle@4 _GlobalLock@4 _GlobalLock@4 _GlobalMemoryStatus@4 _GlobalMemoryStatus@4 _GlobalMemoryStatusEx@4 _GlobalMemoryStatusEx@4 _GlobalReAlloc@12 _GlobalReAlloc@12 _GlobalSize@4 _GlobalSize@4 _GlobalUnWire@4 _GlobalUnWire@4 _GlobalUnfix@4 _GlobalUnfix@4 _GlobalUnlock@4 _GlobalUnlock@4 _GlobalWire@4 _GlobalWire@4 _Heap32First@12 _Heap32First@12 _Heap32ListFirst@8 _Heap32ListFirst@8 _Heap32ListNext@8 _Heap32ListNext@8 _Heap32Next@4 _Heap32Next@4 _HeapAlloc@12 _HeapAlloc@12 _HeapCompact@8 _HeapCompact@8 _HeapCreate@12 _HeapCreate@12 _HeapDestroy@4 _HeapDestroy@4 _HeapFree@12 _HeapFree@12 _HeapLock@4 _HeapLock@4 _HeapQueryInformation@20 _HeapQueryInformation@20 _HeapReAlloc@16 _HeapReAlloc@16 _HeapSetInformation@16 _HeapSetInformation@16 _HeapSize@12 _HeapSize@12 _HeapUnlock@4 _HeapUnlock@4 _HeapValidate@12 _HeapValidate@12 _HeapWalk@8 _HeapWalk@8 _InitAtomTable@4 _InitAtomTable@4 _InitializeCriticalSection@4 _InitializeCriticalSection@4 _InitializeCriticalSectionAndSpinCount@8 _InitializeCriticalSectionAndSpinCount@8 _InitializeSListHead@4 _InitializeSListHead@4 _InterlockedCompareExchange64@20 _InterlockedCompareExchange64@20 _InterlockedCompareExchange@12 _InterlockedCompareExchange@12 _InterlockedDecrement@4 _InterlockedDecrement@4 _InterlockedExchange@8 _InterlockedExchange@8 _InterlockedExchangeAdd@8 _InterlockedExchangeAdd@8 _InterlockedFlushSList@4 _InterlockedFlushSList@4 _InterlockedIncrement@4 _InterlockedIncrement@4 _InterlockedPopEntrySList@4 _InterlockedPopEntrySList@4 _InterlockedPushEntrySList@8 _InterlockedPushEntrySList@8 _IsBadCodePtr@4 _IsBadCodePtr@4 _IsBadHugeReadPtr@8 _IsBadHugeReadPtr@8 _IsBadHugeWritePtr@8 _IsBadHugeWritePtr@8 _IsBadReadPtr@8 _IsBadReadPtr@8 _IsBadStringPtrA@8 _IsBadStringPtrA@8 _IsBadStringPtrW@8 _IsBadStringPtrW@8 _IsBadWritePtr@8 _IsBadWritePtr@8 _IsDBCSLeadByte@4 _IsDBCSLeadByte@4 _IsDBCSLeadByteEx@8 _IsDBCSLeadByteEx@8 _IsDebuggerPresent@0 _IsDebuggerPresent@0 _IsNLSDefinedString@20 _IsNLSDefinedString@20 _IsProcessInJob@12 _IsProcessInJob@12 _IsProcessorFeaturePresent@4 _IsProcessorFeaturePresent@4 _IsSystemResumeAutomatic@0 _IsSystemResumeAutomatic@0 _IsValidCodePage@4 _IsValidCodePage@4 _IsValidLanguageGroup@8 _IsValidLanguageGroup@8 _IsValidLocale@8 _IsValidLocale@8 _IsWow64Process@8 _IsWow64Process@8 _LCMapStringA@24 _LCMapStringA@24 _LCMapStringW@24 _LCMapStringW@24 _LeaveCriticalSection@4 _LeaveCriticalSection@4 _LoadLibraryA@4 _LoadLibraryA@4 _LoadLibraryExA@12 _LoadLibraryExA@12 _LoadLibraryExW@12 _LoadLibraryExW@12 _LoadLibraryW@4 _LoadLibraryW@4 _LoadModule@8 _LoadModule@8 _LoadResource@8 _LoadResource@8 _LocalAlloc@8 _LocalAlloc@8 _LocalCompact@4 _LocalCompact@4 _LocalFileTimeToFileTime@8 _LocalFileTimeToFileTime@8 _LocalFlags@4 _LocalFlags@4 _LocalFree@4 _LocalFree@4 _LocalHandle@4 _LocalHandle@4 _LocalLock@4 _LocalLock@4 _LocalReAlloc@12 _LocalReAlloc@12 _LocalShrink@8 _LocalShrink@8 _LocalSize@4 _LocalSize@4 _LocalUnlock@4 _LocalUnlock@4 _LockFile@20 _LockFile@20 _LockFileEx@24 _LockFileEx@24 _LockResource@4 _LockResource@4 _MapUserPhysicalPages@12 _MapUserPhysicalPages@12 _MapUserPhysicalPagesScatter@12 _MapUserPhysicalPagesScatter@12 _MapViewOfFile@20 _MapViewOfFile@20 _MapViewOfFileEx@24 _MapViewOfFileEx@24 _Module32First@8 _Module32First@8 _Module32FirstW@8 _Module32FirstW@8 _Module32Next@8 _Module32Next@8 _Module32NextW@8 _Module32NextW@8 _MoveFileA@8 _MoveFileA@8 _MoveFileExA@12 _MoveFileExA@12 _MoveFileExW@12 _MoveFileExW@12 _MoveFileW@8 _MoveFileW@8 _MoveFileWithProgressA@20 _MoveFileWithProgressA@20 _MoveFileWithProgressW@20 _MoveFileWithProgressW@20 _MulDiv@12 _MulDiv@12 _MultiByteToWideChar@24 _MultiByteToWideChar@24 _NeedCurrentDirectoryForExePathA@4 _NeedCurrentDirectoryForExePathA@4 _NeedCurrentDirectoryForExePathW@4 _NeedCurrentDirectoryForExePathW@4 _OpenEventA@12 _OpenEventA@12 _OpenEventW@12 _OpenEventW@12 _OpenFile@12 _OpenFile@12 _OpenFileMappingA@12 _OpenFileMappingA@12 _OpenFileMappingW@12 _OpenFileMappingW@12 _OpenJobObjectA@12 _OpenJobObjectA@12 _OpenJobObjectW@12 _OpenJobObjectW@12 _OpenMutexA@12 _OpenMutexA@12 _OpenMutexW@12 _OpenMutexW@12 _OpenProcess@12 _OpenProcess@12 _OpenSemaphoreA@12 _OpenSemaphoreA@12 _OpenSemaphoreW@12 _OpenSemaphoreW@12 _OpenThread@12 _OpenThread@12 _OpenWaitableTimerA@12 _OpenWaitableTimerA@12 _OpenWaitableTimerW@12 _OpenWaitableTimerW@12 _OutputDebugStringA@4 _OutputDebugStringA@4 _OutputDebugStringW@4 _OutputDebugStringW@4 _PeekConsoleInputA@16 _PeekConsoleInputA@16 _PeekConsoleInputW@16 _PeekConsoleInputW@16 _PeekNamedPipe@24 _PeekNamedPipe@24 _PostQueuedCompletionStatus@16 _PostQueuedCompletionStatus@16 _PrepareTape@12 _PrepareTape@12 _Process32First@8 _Process32First@8 _Process32FirstW@8 _Process32FirstW@8 _Process32Next@8 _Process32Next@8 _Process32NextW@8 _Process32NextW@8 _ProcessIdToSessionId@8 _ProcessIdToSessionId@8 _PulseEvent@4 _PulseEvent@4 _PurgeComm@8 _PurgeComm@8 _QueryActCtxW@28 _QueryActCtxW@28 _QueryDepthSList@4 _QueryDepthSList@4 _QueryDosDeviceA@12 _QueryDosDeviceA@12 _QueryDosDeviceW@12 _QueryDosDeviceW@12 _QueryInformationJobObject@20 _QueryInformationJobObject@20 _QueryMemoryResourceNotification@8 _QueryMemoryResourceNotification@8 _QueryPerformanceCounter@4 _QueryPerformanceCounter@4 _QueryPerformanceFrequency@4 _QueryPerformanceFrequency@4 _QueueUserAPC@12 _QueueUserAPC@12 _QueueUserWorkItem@12 _QueueUserWorkItem@12 _RaiseException@16 _RaiseException@16 _ReOpenFile@16 _ReOpenFile@16 _ReadConsoleA@20 _ReadConsoleA@20 _ReadConsoleInputA@16 _ReadConsoleInputA@16 _ReadConsoleInputW@16 _ReadConsoleInputW@16 _ReadConsoleOutputA@20 _ReadConsoleOutputA@20 _ReadConsoleOutputAttribute@20 _ReadConsoleOutputAttribute@20 _ReadConsoleOutputCharacterA@20 _ReadConsoleOutputCharacterA@20 _ReadConsoleOutputCharacterW@20 _ReadConsoleOutputCharacterW@20 _ReadConsoleOutputW@20 _ReadConsoleOutputW@20 _ReadConsoleW@20 _ReadConsoleW@20 _ReadDirectoryChangesW@32 _ReadDirectoryChangesW@32 _ReadFile@20 _ReadFile@20 _ReadFileEx@20 _ReadFileEx@20 _ReadFileScatter@20 _ReadFileScatter@20 _ReadProcessMemory@20 _ReadProcessMemory@20 _RegisterWaitForSingleObject@24 _RegisterWaitForSingleObject@24 _RegisterWaitForSingleObjectEx@20 _RegisterWaitForSingleObjectEx@20 _ReleaseActCtx@4 _ReleaseActCtx@4 _ReleaseMutex@4 _ReleaseMutex@4 _ReleaseSemaphore@12 _ReleaseSemaphore@12 _RemoveDirectoryA@4 _RemoveDirectoryA@4 _RemoveDirectoryW@4 _RemoveDirectoryW@4 _RemoveVectoredContinueHandler@4 _RemoveVectoredContinueHandler@4 _RemoveVectoredExceptionHandler@4 _RemoveVectoredExceptionHandler@4 _ReplaceFile@24 _ReplaceFile@24 _ReplaceFileA@24 _ReplaceFileA@24 _ReplaceFileW@24 _ReplaceFileW@24 _RequestDeviceWakeup@4 _RequestDeviceWakeup@4 _RequestWakeupLatency@4 _RequestWakeupLatency@4 _ResetEvent@4 _ResetEvent@4 _ResetWriteWatch@8 _ResetWriteWatch@8 _RestoreLastError@4 _RestoreLastError@4 _ResumeThread@4 _ResumeThread@4 _RtlCaptureContext@4 _RtlCaptureContext@4 _RtlCaptureStackBackTrace@16 _RtlCaptureStackBackTrace@16 _RtlFillMemory@12 _RtlFillMemory@12 _RtlMoveMemory@12 _RtlMoveMemory@12 _RtlUnwind@16 _RtlUnwind@16 _RtlZeroMemory@8 _RtlZeroMemory@8 _ScrollConsoleScreenBufferA@20 _ScrollConsoleScreenBufferA@20 _ScrollConsoleScreenBufferW@20 _ScrollConsoleScreenBufferW@20 _SearchPathA@24 _SearchPathA@24 _SearchPathW@24 _SearchPathW@24 _SetCalendarInfoA@16 _SetCalendarInfoA@16 _SetCalendarInfoW@16 _SetCalendarInfoW@16 _SetCommBreak@4 _SetCommBreak@4 _SetCommConfig@12 _SetCommConfig@12 _SetCommMask@8 _SetCommMask@8 _SetCommState@8 _SetCommState@8 _SetCommTimeouts@8 _SetCommTimeouts@8 _SetComputerNameA@4 _SetComputerNameA@4 _SetComputerNameExA@8 _SetComputerNameExA@8 _SetComputerNameExW@8 _SetComputerNameExW@8 _SetComputerNameW@4 _SetComputerNameW@4 _SetConsoleActiveScreenBuffer@4 _SetConsoleActiveScreenBuffer@4 _SetConsoleCP@4 _SetConsoleCP@4 _SetConsoleCtrlHandler@8 _SetConsoleCtrlHandler@8 _SetConsoleCursor@8 _SetConsoleCursor@8 _SetConsoleCursorInfo@8 _SetConsoleCursorInfo@8 _SetConsoleCursorPosition@8 _SetConsoleCursorPosition@8 _SetConsoleMode@8 _SetConsoleMode@8 _SetConsoleOutputCP@4 _SetConsoleOutputCP@4 _SetConsoleScreenBufferSize@8 _SetConsoleScreenBufferSize@8 _SetConsoleTextAttribute@8 _SetConsoleTextAttribute@8 _SetConsoleTitleA@4 _SetConsoleTitleA@4 _SetConsoleTitleW@4 _SetConsoleTitleW@4 _SetConsoleWindowInfo@12 _SetConsoleWindowInfo@12 _SetCriticalSectionSpinCount@8 _SetCriticalSectionSpinCount@8 _SetCurrentDirectoryA@4 _SetCurrentDirectoryA@4 _SetCurrentDirectoryW@4 _SetCurrentDirectoryW@4 _SetDefaultCommConfigA@12 _SetDefaultCommConfigA@12 _SetDefaultCommConfigW@12 _SetDefaultCommConfigW@12 _SetDllDirectoryA@4 _SetDllDirectoryA@4 _SetDllDirectoryW@4 _SetDllDirectoryW@4 _SetEndOfFile@4 _SetEndOfFile@4 _SetEnvironmentStringsA@4 _SetEnvironmentStringsA@4 _SetEnvironmentStringsW@4 _SetEnvironmentStringsW@4 _SetEnvironmentVariableA@8 _SetEnvironmentVariableA@8 _SetEnvironmentVariableW@8 _SetEnvironmentVariableW@8 _SetErrorMode@4 _SetErrorMode@4 _SetEvent@4 _SetEvent@4 _SetFileApisToANSI@0 _SetFileApisToANSI@0 _SetFileApisToOEM@0 _SetFileApisToOEM@0 _SetFileAttributesA@8 _SetFileAttributesA@8 _SetFileAttributesW@8 _SetFileAttributesW@8 _SetFilePointer@16 _SetFilePointer@16 _SetFilePointerEx@20 _SetFilePointerEx@20 _SetFileShortNameA@8 _SetFileShortNameA@8 _SetFileShortNameW@8 _SetFileShortNameW@8 _SetFileTime@16 _SetFileTime@16 _SetFileValidData@12 _SetFileValidData@12 _SetFirmwareEnvironmentVariableA@16 _SetFirmwareEnvironmentVariableA@16 _SetFirmwareEnvironmentVariableW@16 _SetFirmwareEnvironmentVariableW@16 _SetHandleCount@4 _SetHandleCount@4 _SetHandleInformation@12 _SetHandleInformation@12 _SetInformationJobObject@16 _SetInformationJobObject@16 _SetLastError@4 _SetLastError@4 _SetLocalTime@4 _SetLocalTime@4 _SetLocaleInfoA@12 _SetLocaleInfoA@12 _SetLocaleInfoW@12 _SetLocaleInfoW@12 _SetMailslotInfo@8 _SetMailslotInfo@8 _SetMessageWaitingIndicator@8 _SetMessageWaitingIndicator@8 _SetNamedPipeHandleState@16 _SetNamedPipeHandleState@16 _SetPriorityClass@8 _SetPriorityClass@8 _SetProcessAffinityMask@8 _SetProcessAffinityMask@8 _SetProcessPriorityBoost@8 _SetProcessPriorityBoost@8 _SetProcessShutdownParameters@8 _SetProcessShutdownParameters@8 _SetProcessWorkingSetSize@12 _SetProcessWorkingSetSize@12 _SetProcessWorkingSetSizeEx@16 _SetProcessWorkingSetSizeEx@16 _SetStdHandle@8 _SetStdHandle@8 _SetSystemFileCacheSize@12 _SetSystemFileCacheSize@12 _SetSystemPowerState@8 _SetSystemPowerState@8 _SetSystemTime@4 _SetSystemTime@4 _SetSystemTimeAdjustment@8 _SetSystemTimeAdjustment@8 _SetTapeParameters@12 _SetTapeParameters@12 _SetTapePosition@24 _SetTapePosition@24 _SetThreadAffinityMask@8 _SetThreadAffinityMask@8 _SetThreadContext@8 _SetThreadContext@8 _SetThreadExecutionState@4 _SetThreadExecutionState@4 _SetThreadIdealProcessor@8 _SetThreadIdealProcessor@8 _SetThreadLocale@4 _SetThreadLocale@4 _SetThreadPriority@8 _SetThreadPriority@8 _SetThreadPriorityBoost@8 _SetThreadPriorityBoost@8 _SetThreadStackGuarantee@4 _SetThreadStackGuarantee@4 _SetTimeZoneInformation@4 _SetTimeZoneInformation@4 _SetTimerQueueTimer@24 _SetTimerQueueTimer@24 _SetUnhandledExceptionFilter@4 _SetUnhandledExceptionFilter@4 _SetUserGeoID@4 _SetUserGeoID@4 _SetVolumeLabelA@8 _SetVolumeLabelA@8 _SetVolumeLabelW@8 _SetVolumeLabelW@8 _SetVolumeMountPointA@8 _SetVolumeMountPointA@8 _SetVolumeMountPointW@8 _SetVolumeMountPointW@8 _SetWaitableTimer@24 _SetWaitableTimer@24 _SetupComm@12 _SetupComm@12 _SignalObjectAndWait@16 _SignalObjectAndWait@16 _SizeofResource@8 _SizeofResource@8 _Sleep@4 _Sleep@4 _SleepEx@8 _SleepEx@8 _SuspendThread@4 _SuspendThread@4 _SwitchToFiber@4 _SwitchToFiber@4 _SwitchToThread@0 _SwitchToThread@0 _SystemTimeToFileTime@8 _SystemTimeToFileTime@8 _SystemTimeToTzSpecificLocalTime@12 _SystemTimeToTzSpecificLocalTime@12 _TerminateJobObject@8 _TerminateJobObject@8 _TerminateProcess@8 _TerminateProcess@8 _TerminateThread@8 _TerminateThread@8 _Thread32First@8 _Thread32First@8 _Thread32Next@8 _Thread32Next@8 _TlsAlloc@0 _TlsAlloc@0 _TlsFree@4 _TlsFree@4 _TlsGetValue@4 _TlsGetValue@4 _TlsSetValue@8 _TlsSetValue@8 _Toolhelp32ReadProcessMemory@20 _Toolhelp32ReadProcessMemory@20 _TransactNamedPipe@28 _TransactNamedPipe@28 _TransmitCommChar@8 _TransmitCommChar@8 _TryEnterCriticalSection@4 _TryEnterCriticalSection@4 _TzSpecificLocalTimeToSystemTime@12 _TzSpecificLocalTimeToSystemTime@12 _UnhandledExceptionFilter@4 _UnhandledExceptionFilter@4 _UnlockFile@20 _UnlockFile@20 _UnlockFileEx@20 _UnlockFileEx@20 _UnmapViewOfFile@4 _UnmapViewOfFile@4 _UnregisterWait@4 _UnregisterWait@4 _UnregisterWaitEx@8 _UnregisterWaitEx@8 _UpdateResourceA@24 _UpdateResourceA@24 _UpdateResourceW@24 _UpdateResourceW@24 _VerLanguageNameA@12 _VerLanguageNameA@12 _VerLanguageNameW@12 _VerLanguageNameW@12 _VerSetConditionMask@16 _VerSetConditionMask@16 _VerifyVersionInfoA@16 _VerifyVersionInfoA@16 _VerifyVersionInfoW@16 _VerifyVersionInfoW@16 _VirtualAlloc@16 _VirtualAlloc@16 _VirtualAllocEx@20 _VirtualAllocEx@20 _VirtualFree@12 _VirtualFree@12 _VirtualFreeEx@16 _VirtualFreeEx@16 _VirtualLock@8 _VirtualLock@8 _VirtualProtect@16 _VirtualProtect@16 _VirtualProtectEx@20 _VirtualProtectEx@20 _VirtualQuery@12 _VirtualQuery@12 _VirtualQueryEx@16 _VirtualQueryEx@16 _VirtualUnlock@8 _VirtualUnlock@8 _WTSGetActiveConsoleSessionId@0 _WTSGetActiveConsoleSessionId@0 _WaitCommEvent@12 _WaitCommEvent@12 _WaitForDebugEvent@8 _WaitForDebugEvent@8 _WaitForMultipleObjects@16 _WaitForMultipleObjects@16 _WaitForMultipleObjectsEx@20 _WaitForMultipleObjectsEx@20 _WaitForSingleObject@8 _WaitForSingleObject@8 _WaitForSingleObjectEx@12 _WaitForSingleObjectEx@12 _WaitNamedPipeA@8 _WaitNamedPipeA@8 _WaitNamedPipeW@8 _WaitNamedPipeW@8 _WideCharToMultiByte@32 _WideCharToMultiByte@32 _WinExec@8 _WinExec@8 _Wow64DisableWow64FsRedirection@4 _Wow64DisableWow64FsRedirection@4 _Wow64EnableWow64FsRedirection@4 _Wow64EnableWow64FsRedirection@4 _Wow64RevertWow64FsRedirection@4 _Wow64RevertWow64FsRedirection@4 _WriteConsoleA@20 _WriteConsoleA@20 _WriteConsoleInputA@16 _WriteConsoleInputA@16 _WriteConsoleInputW@16 _WriteConsoleInputW@16 _WriteConsoleOutputA@20 _WriteConsoleOutputA@20 _WriteConsoleOutputAttribute@20 _WriteConsoleOutputAttribute@20 _WriteConsoleOutputCharacterA@20 _WriteConsoleOutputCharacterA@20 _WriteConsoleOutputCharacterW@20 _WriteConsoleOutputCharacterW@20 _WriteConsoleOutputW@20 _WriteConsoleOutputW@20 _WriteConsoleW@20 _WriteConsoleW@20 _WriteFile@20 _WriteFile@20 _WriteFileEx@20 _WriteFileEx@20 _WriteFileGather@20 _WriteFileGather@20 _WritePrivateProfileSectionA@12 _WritePrivateProfileSectionA@12 _WritePrivateProfileSectionW@12 _WritePrivateProfileSectionW@12 _WritePrivateProfileStringA@16 _WritePrivateProfileStringA@16 _WritePrivateProfileStringW@16 _WritePrivateProfileStringW@16 _WritePrivateProfileStructA@20 _WritePrivateProfileStructA@20 _WritePrivateProfileStructW@20 _WritePrivateProfileStructW@20 _WriteProcessMemory@20 _WriteProcessMemory@20 _WriteProfileSectionA@8 _WriteProfileSectionA@8 _WriteProfileSectionW@8 _WriteProfileSectionW@8 _WriteProfileStringA@12 _WriteProfileStringA@12 _WriteProfileStringW@12 _WriteProfileStringW@12 _WriteTapemark@16 _WriteTapemark@16 _ZombifyActCtx@4 _ZombifyActCtx@4 __hread@12 __hread@12 __hwrite@12 __hwrite@12 __lclose@4 __lclose@4 __lcreat@8 __lcreat@8 __llseek@12 __llseek@12 __lopen@8 __lopen@8 __lread@12 __lread@12 __lwrite@12 __lwrite@12 _lstrcat@8 _lstrcat@8 _lstrcatA@8 _lstrcatA@8 _lstrcatW@8 _lstrcatW@8 _lstrcmp@8 _lstrcmp@8 _lstrcmpA@8 _lstrcmpA@8 _lstrcmpW@8 _lstrcmpW@8 _lstrcmpi@8 _lstrcmpi@8 _lstrcmpiA@8 _lstrcmpiA@8 _lstrcmpiW@8 _lstrcmpiW@8 _lstrcpy@8 _lstrcpy@8 _lstrcpyA@8 _lstrcpyA@8 _lstrcpyW@8 _lstrcpyW@8 _lstrcpyn@12 _lstrcpyn@12 _lstrcpynA@12 _lstrcpynA@12 _lstrcpynW@12 _lstrcpynW@12 _lstrlen@4 _lstrlen@4 _lstrlenA@4 _lstrlenA@4 _lstrlenW@4 _lstrlenW@4 kbuild-3608/src/lib/kStuff/kProfiler2/prfx86msc.asm0000664000175000017500000002523414670377514022112 0ustar locutuslocutus; $Id: prfx86msc.asm 29 2009-07-01 20:30:29Z bird $ ;; @file ; kProfiler Mark 2 - Microsoft C/C++ Compiler Interaction, x86. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; [section .data] ; g_fCalibrated: dd 0 g_OverheadAdj: dd 0 [section .text] extern KPRF_ENTER extern KPRF_LEAVE global __penter global __pexit ;ifdef UNDEFINED global common_return_path global common_overhead global common_no_overhead global calibrate global calib_inner_update_minimum global calib_inner_next global calib_outer_dec global calib_outer_inc global calib_done global calib_nullproc ;endif ;; ; On x86 the call to this function has been observed to be put before ; creating the stack frame, as the very first instruction in the function. ; ; Thus the stack layout is as follows: ; 24 return address of the calling function. ; 20 our return address - the address of the calling function + 5. ; 1c eax ; 18 edx ; 14 eflags ; 10 ecx ; c tsc high - param 3 ; 8 tsc low ; 4 frame pointer - param 2 ; 0 function ptr - param 1 ; ; align 16 __penter: ; save volatile register and get the time stamp. push eax push edx rdtsc pushfd push ecx ; setting up the enter call frame (cdecl). sub esp, 4 + 4 + 8 mov [esp + 0ch], edx ; Param 3 - the timestamp mov [esp + 08h], eax lea edx, [esp + 24h] ; Param 2 - frame pointer (pointer to the return address of the function calling us) mov [esp + 04h], edx mov eax, [esp + 20h] ; Param 1 - The function address sub eax, 5 ; call instruction mov [esp], eax call KPRF_ENTER jmp common_return_path ;; ; On x86 the call to this function has been observed to be put right before ; return instruction. This fact matters since since we have to calc the same ; stack address as in _penter. ; ; Thus the stack layout is as follows: ; 24 return address of the calling function. ; 20 our return address - the address of the calling function + 5. ; 1c eax ; 18 edx ; 14 eflags ; 10 ecx ; c tsc high - param 3 ; 8 tsc low ; 4 frame pointer - param 2 ; 0 function ptr - param 1 ; ; align 16 __pexit: ; save volatile register and get the time stamp. push eax push edx rdtsc pushfd push ecx ; setting up the leave call frame (cdecl). sub esp, 4 + 4 + 8 mov [esp + 0ch], edx ; Param 3 - the timestamp mov [esp + 08h], eax lea edx, [esp + 24h] ; Param 2 - frame pointer (pointer to the return address of the function calling us) mov [esp + 04h], edx mov eax, [esp + 20h] ; Param 1 - Some address in the function. sub eax, 5 ; call instruction mov [esp], eax call KPRF_LEAVE jmp common_return_path ;; ; This is the common return path for both the enter and exit hooks. ; It's kept common because we can then use the same overhead adjustment ; and save some calibration efforts. It also saves space :-) align 16 common_return_path: ; Update overhead test eax, eax jz common_no_overhead cmp byte [g_fCalibrated], 0 jnz common_overhead call calibrate common_overhead: mov ecx, eax ; ecx <- pointer to overhead counter. mov eax, [g_OverheadAdj] ; apply the adjustment before reading tsc sub [esp + 08h], eax sbb dword [esp + 0ch], 0 rdtsc sub eax, [esp + 08h] sbb edx, [esp + 0ch] add [ecx], eax adc [ecx + 4], edx common_no_overhead: add esp, 4 + 4 + 8 ; restore volatile registers. pop ecx popfd pop edx pop eax ret ;; ; Data esi points to while we're calibrating. struc CALIBDATA .OverheadLo resd 1 .OverheadHi resd 1 .ProfiledLo resd 1 .ProfiledHi resd 1 .EnterTSLo resd 1 .EnterTSHi resd 1 .MinLo resd 1 .MinHi resd 1 endstruc align 16 ;; ; Do necessary calibrations. ; calibrate: ; prolog push ebp mov ebp, esp pushfd pushad sub esp, CALIBDATA_size mov esi, esp ; esi points to the CALIBDATA ; ; Indicate that we have finished calibrating. ; mov eax, 1 xchg dword [g_fCalibrated], eax ; ; The outer loop - find the right adjustment. ; mov ebx, 200h ; loop counter. calib_outer_loop: ; ; The inner loop - calls the function number of times to establish a ; good minimum value ; mov ecx, 200h mov dword [esi + CALIBDATA.MinLo], 0ffffffffh mov dword [esi + CALIBDATA.MinHi], 07fffffffh calib_inner_loop: ; zero the overhead and profiled times. xor eax, eax mov [esi + CALIBDATA.OverheadLo], eax mov [esi + CALIBDATA.OverheadHi], eax mov [esi + CALIBDATA.ProfiledLo], eax mov [esi + CALIBDATA.ProfiledHi], eax call calib_nullproc ; subtract the overhead mov eax, [esi + CALIBDATA.ProfiledLo] mov edx, [esi + CALIBDATA.ProfiledHi] sub eax, [esi + CALIBDATA.OverheadLo] sbb edx, [esi + CALIBDATA.OverheadHi] ; update the minimum value. test edx, 080000000h jnz near calib_outer_dec ; if negative, just simplify and shortcut cmp edx, [esi + CALIBDATA.MinHi] jg calib_inner_next jl calib_inner_update_minimum cmp eax, [esi + CALIBDATA.MinLo] jge calib_inner_next calib_inner_update_minimum: mov [esi + CALIBDATA.MinLo], eax mov [esi + CALIBDATA.MinHi], edx calib_inner_next: loop calib_inner_loop ; Is the minimum value acceptable? test dword [esi + CALIBDATA.MinHi], 80000000h jnz calib_outer_dec ; simplify if negative. cmp dword [esi + CALIBDATA.MinHi], 0 jnz calib_outer_inc ; this shouldn't be possible cmp dword [esi + CALIBDATA.MinLo], 1fh jbe calib_outer_dec ; too low - 2 ticks per pair is the minimum! cmp dword [esi + CALIBDATA.MinLo], 30h jbe calib_done ; this is fine! calib_outer_inc: inc dword [g_OverheadAdj] jmp calib_outer_next calib_outer_dec: cmp dword [g_OverheadAdj], 1 je calib_done dec dword [g_OverheadAdj] calib_outer_next: dec ebx jnz calib_outer_loop calib_done: ; epilog add esp, CALIBDATA_size popad popfd leave ret ;; ; The calibration __penter - this must be identical to the real thing except for the KPRF call. align 16 calib_penter: ; This part must be identical push eax push edx rdtsc pushfd push ecx ; store the entry mov [esi + CALIBDATA.EnterTSLo], eax mov [esi + CALIBDATA.EnterTSHi], edx ; create the call frame push edx push eax push 0 push 0 lea eax, [esi + CALIBDATA.OverheadLo] jmp common_overhead ;; ; The calibration __pexit - this must be identical to the real thing except for the KPRF call. align 16 calib_pexit: ; This part must be identical push eax push edx rdtsc pushfd push ecx ; update the time push eax push edx sub eax, [esi + CALIBDATA.EnterTSLo] sbb edx, [esi + CALIBDATA.EnterTSHi] add [esi + CALIBDATA.ProfiledLo], eax adc [esi + CALIBDATA.ProfiledHi], edx pop edx pop eax ; create the call frame push edx push eax push 0 push 0 lea eax, [esi + CALIBDATA.EnterTSLo] jmp common_overhead ;; ; The 'function' we're profiling. ; The general idea is that each pair should take something like 2-10 ticks. ; ; (Btw. If we don't use multiple pairs here, we end up with the wrong result.) align 16 calib_nullproc: call calib_penter ;0 call calib_pexit call calib_penter ;1 call calib_pexit call calib_penter ;2 call calib_pexit call calib_penter ;3 call calib_pexit call calib_penter ;4 call calib_pexit call calib_penter ;5 call calib_pexit call calib_penter ;6 call calib_pexit call calib_penter ;7 call calib_pexit call calib_penter ;8 call calib_pexit call calib_penter ;9 call calib_pexit call calib_penter ;a call calib_pexit call calib_penter ;b call calib_pexit call calib_penter ;c call calib_pexit call calib_penter ;d call calib_pexit call calib_penter ;e call calib_pexit call calib_penter ;f call calib_pexit ret kbuild-3608/src/lib/kStuff/kProfiler2/dllmain-win.cpp0000664000175000017500000000520114670377514022457 0ustar locutuslocutus/* $Id: dllmain-win.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - The Windows DllMain for the profiler DLL. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include "kProfileR3.h" /** * The DLL Main for the kPrf DLL. * * This is required because we need to initialize the profiler at some point * and because we need to know when threads terminate. (We don't care about * when threads get created, we simply pick them up when we see them the * first time.) * * @returns Success indicator. * @param hInstDll The instance handle of the DLL. (i.e. the module handle) * @param fdwReason The reason why we're here. This is a 'flag' for reasons of * tradition, it's really a kind of enum. * @param pReserved Reserved / undocumented something. */ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, PVOID pReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: if (kPrfInitialize()) return FALSE; break; case DLL_PROCESS_DETACH: kPrfTerminate(); break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: kPrfTerminateThread(); break; } return TRUE; } kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2-win-amd64.def0000664000175000017500000000253014670377514022712 0ustar locutuslocutus; $Id: kPrf2-win-amd64.def 29 2009-07-01 20:30:29Z bird $LIBRARY kPrf2 ;; @file ; kProfiler Mark 2 - Windows Linker Definition File, AMD64. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; LIBRARY kPrf2 EXPORTS _penter _pexit KPrfInit kPrf2WrapResolve kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2-win-x86.def0000664000175000017500000000250614670377514022427 0ustar locutuslocutus; $Id: kPrf2-win-x86.def 29 2009-07-01 20:30:29Z bird $ ;; @file ; kProfiler Mark 2 - Windows Linker Definition File, x86. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; LIBRARY kPrf2 EXPORTS _penter _pexit KPrfInit kPrf2WrapResolve kbuild-3608/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappers.c0000664000175000017500000000714214670377514023532 0ustar locutuslocutus/* $Id: kPrf2WinApiWrappers.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * Wrappers for a number of common Windows APIs. */ /* * Copyright (c) 2008 Knut St. Osmundsen * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* * Header Files * *******************************************************************************/ #define _ADVAPI32_ #define _KERNEL32_ #define _WIN32_WINNT 0x0600 #define UNICODE #include #include #include #include "kPrf2WinApiWrapperHlp.h" #if K_ARCH == K_ARCH_X86_32 typedef PVOID PRUNTIME_FUNCTION; typedef FARPROC PGET_RUNTIME_FUNCTION_CALLBACK; #endif /* RtlUnwindEx is used by msvcrt on amd64, but winnt.h only defines it for IA64... */ typedef struct _FRAME_POINTERS { ULONGLONG MemoryStackFp; ULONGLONG BackingStoreFp; } FRAME_POINTERS, *PFRAME_POINTERS; typedef PVOID PUNWIND_HISTORY_TABLE; typedef PVOID PKNONVOLATILE_CONTEXT_POINTERS; /******************************************************************************* * Global Variables * *******************************************************************************/ KPRF2WRAPDLL g_Kernel32 = { INVALID_HANDLE_VALUE, "KERNEL32" }; /* * Include the generated code. */ #include "kPrf2WinApiWrappers-kernel32.h" /* TODO (amd64): AddLocalAlternateComputerNameA AddLocalAlternateComputerNameW EnumerateLocalComputerNamesA EnumerateLocalComputerNamesW RemoveLocalAlternateComputerNameA RemoveLocalAlternateComputerNameW RtlLookupFunctionEntry RtlPcToFileHeader RtlRaiseException RtlVirtualUnwind SetConsoleCursor SetLocalPrimaryComputerNameA SetLocalPrimaryComputerNameW __C_specific_handler __misaligned_access _local_unwind */ /** * The DLL Main for the Windows API wrapper DLL. * * @returns Success indicator. * @param hInstDll The instance handle of the DLL. (i.e. the module handle) * @param fdwReason The reason why we're here. This is a 'flag' for reasons of * tradition, it's really a kind of enum. * @param pReserved Reserved / undocumented something. */ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, PVOID pReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return TRUE; } kbuild-3608/src/lib/kStuff/kProfiler2/prfcoreinit.cpp.h0000664000175000017500000001447414670377514023032 0ustar locutuslocutus/* $Id: prfcoreinit.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Initialization Code Template. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Calculates the size of the profiler data set. * * @returns The size of the data set in bytes. * * @param cMaxFunctions The max number of functions. * @param cbMaxModSeg The max bytes for module segments. * @param cMaxThreads The max number of threads. * @param cMaxStacks The max number of stacks. (should be less or equal to the max number of threads) * @param cMaxStackFrames The max number of frames on each of the stacks. * * @remark This function does not input checks, it only aligns it. The caller is * responsible for the input to make some sense. */ KPRF_DECL_FUNC(KU32, CalcSize)(KU32 cMaxFunctions, KU32 cbMaxModSegs, KU32 cMaxThreads, KU32 cMaxStacks, KU32 cMaxStackFrames) { /* * Normalize input. */ KPRF_SETMIN_ALIGN(cMaxFunctions, 16, 16); KPRF_SETMIN_ALIGN(cbMaxModSegs, KPRF_SIZEOF(MODSEG), 32); KPRF_SETMIN_ALIGN(cMaxThreads, 1, 1); KPRF_SETMIN_ALIGN(cMaxStacks, 1, 1); KPRF_SETMIN_ALIGN(cMaxStackFrames, 32, 32); /* * Calc the size from the input. * We do not take overflows into account, stupid user means stupid result. */ KU32 cb = KPRF_OFFSETOF(HDR, aiFunctions[cMaxFunctions]); KU32 cbTotal = KPRF_ALIGN(cb, 32); cb = cMaxFunctions * KPRF_SIZEOF(FUNC); cbTotal += KPRF_ALIGN(cb, 32); cbTotal += cbMaxModSegs; cb = cMaxThreads * KPRF_SIZEOF(THREAD); cbTotal += KPRF_ALIGN(cb, 32); cb = cMaxStacks * KPRF_SIZEOF(STACK); cbTotal += KPRF_ALIGN(cb, 32); cb = cMaxStackFrames * cMaxStacks * KPRF_SIZEOF(FRAME); cbTotal += KPRF_ALIGN(cb, 32); return cbTotal; } /** * Initializes the profiler data set. * * @returns Pointer to the initialized profiler header on success. * @returns NULL if the input doesn't add up. * * @param pvData Where to initialize the profiler data set. * @param cbData The size of the available data. * @param cMaxFunctions The max number of functions. * @param cbMaxModSeg The max bytes for module segments. * @param cMaxThreads The max number of threads. * @param cMaxStacks The max number of stacks. (should be less or equal to the max number of threads) * @param cMaxStackFrames The max number of frames on each of the stacks. * */ KPRF_DECL_FUNC(KPRF_TYPE(P,HDR), Init)(void *pvData, KU32 cbData, KU32 cMaxFunctions, KU32 cbMaxModSegs, KU32 cMaxThreads, KU32 cMaxStacks, KU32 cMaxStackFrames) { /* * Normalize the input. */ if (!pvData) return NULL; KPRF_SETMIN_ALIGN(cMaxFunctions, 16, 16); KPRF_SETMIN_ALIGN(cbMaxModSegs, KPRF_SIZEOF(MODSEG), 32); KPRF_SETMIN_ALIGN(cMaxThreads, 1, 1); KPRF_SETMIN_ALIGN(cMaxStacks, 1, 1); KPRF_SETMIN_ALIGN(cMaxStackFrames, 32, 32); /* * The header. */ KU32 off = 0; KU32 cb = KPRF_OFFSETOF(HDR, aiFunctions[cMaxFunctions]); cb = KPRF_ALIGN(cb, 32); if (cbData < off + cb || off > off + cb) return NULL; KPRF_TYPE(P,HDR) pHdr = (KPRF_TYPE(P,HDR))pvData; /* the core header */ pHdr->u32Magic = 0; /* Set at the very end */ pHdr->cFormatBits = KPRF_BITS; pHdr->uBasePtr = 0; /* Can be set afterwards using SetBasePtr. */ #if KPRF_BITS <= 16 pHdr->u16Reserved = 0; #endif #if KPRF_BITS <= 32 pHdr->u32Reserved = 0; #endif pHdr->cb = cbData; pHdr->cbAllocated = cbData; /* functions */ off += cb; cb = cMaxFunctions * KPRF_SIZEOF(FUNC); cb = KPRF_ALIGN(cb, 32); if (cbData < off + cb || off > off + cb) return NULL; pHdr->cMaxFunctions = cMaxFunctions; pHdr->cFunctions = 0; pHdr->offFunctions = off; pHdr->cbFunction = KPRF_SIZEOF(FUNC); /* modsegs */ off += cb; cb = KPRF_ALIGN(cbMaxModSegs, 32); if (cbData < off + cb || off > off + cb) return NULL; pHdr->cbMaxModSegs = cbMaxModSegs; pHdr->cbModSegs = 0; pHdr->offModSegs = off; /* threads */ off += cb; cb = cMaxThreads * KPRF_SIZEOF(THREAD); cb = KPRF_ALIGN(cb, 32); if (cbData < off + cb || off > off + cb) return NULL; pHdr->cMaxThreads = cMaxThreads; pHdr->cThreads = 0; pHdr->offThreads = off; pHdr->cbThread = KPRF_SIZEOF(THREAD); /* stacks */ off += cb; cb = cMaxStacks * KPRF_OFFSETOF(STACK, aFrames[cMaxStackFrames]); cb = KPRF_ALIGN(cb, 32); if (cbData < off + cb || off > off + cb) return NULL; pHdr->cMaxStacks = cMaxStacks; pHdr->cStacks = 0; pHdr->offStacks = off; pHdr->cbStack = KPRF_OFFSETOF(STACK, aFrames[cMaxStackFrames]); pHdr->cMaxStackFrames = cMaxStackFrames; /* commandline */ pHdr->offCommandLine = 0; pHdr->cchCommandLine = 0; /* the final size */ pHdr->cb = off + cb; /* * Done. */ pHdr->u32Magic = KPRF_TYPE(,HDR_MAGIC); return pHdr; } kbuild-3608/src/lib/kStuff/kProfiler2/prfcoremodseg.cpp.h0000664000175000017500000001610614670377514023337 0ustar locutuslocutus/* $Id: prfcoremodseg.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Module Segment Code Template. */ /* * Copyright (c) 2006-2007 Knut St. Osmundsen * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Adds a module segment. * * @returns Offset to the module if existing or successfully added * @returns 0 if not found. * * @param pHdr The profiler header. * @param pModSeg Pointer to the module segment to insert (it's copied of course). * @param off The offset into the modseg area which has been searched. * (This is relative to the first moddule segment record (at pHdr->offModSegs).) */ static KU32 KPRF_NAME(InsertModSeg)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(PC,MODSEG) pModSeg, KU32 off) { /* * Lookup the module segment, inserting it if not found (and there is room). */ for (;;) { if (off >= pHdr->cbModSegs) { /* * It was the end, let's try insert it. * * This is where we lock the modseg stuff. The deal is that we * serialize the actual inserting without blocking lookups. This * means that we may end up with potential racing inserts, but * unless there is a large amount of modules being profiled that's * probably not going to be much of a problem. Anyway if we race, * we'll simply have to search the new additions before we add our * own stuff. */ KPRF_MODSEGS_LOCK(); if (off >= pHdr->cbModSegs) { KU32 cbModSeg = KPRF_OFFSETOF(MODSEG, szPath[pModSeg->cchPath + 1]); cbModSeg = KPRF_ALIGN(cbModSeg, KPRF_SIZEOF(UPTR)); if (off + cbModSeg <= pHdr->cbMaxModSegs) { KPRF_TYPE(P,MODSEG) pNew = KPRF_OFF2PTR(P,MODSEG, off + pHdr->offModSegs, pHdr); pNew->uBasePtr = pModSeg->uBasePtr; pNew->cbSegmentMinusOne = pModSeg->cbSegmentMinusOne; pNew->iSegment = pModSeg->iSegment; pNew->fLoaded = pModSeg->fLoaded; pNew->cchPath = pModSeg->cchPath; KI32 iPath = pModSeg->cchPath; do pNew->szPath[iPath] = pModSeg->szPath[iPath]; while (--iPath >= 0); /* commit it */ KPRF_ATOMIC_SET32(&pHdr->cbModSegs, off + cbModSeg); off += pHdr->offModSegs; } else off = 0; KPRF_MODSEGS_UNLOCK(); return off; } KPRF_MODSEGS_UNLOCK(); /* someone raced us, check the new entries. */ } /* * Match? */ KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(P,MODSEG, off + pHdr->offModSegs, pHdr); if ( pCur->uBasePtr == pModSeg->uBasePtr && pCur->fLoaded == pModSeg->fLoaded && pCur->cchPath == pModSeg->cchPath && pCur->iSegment == pModSeg->iSegment && pCur->cbSegmentMinusOne == pModSeg->cbSegmentMinusOne ) { KI32 iPath = pModSeg->cchPath; for (;;) { if (!iPath--) return off + pHdr->offModSegs; if (pModSeg->szPath[iPath] != pCur->szPath[iPath]) break; } /* didn't match, continue searching */ } KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]); off += KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR)); } } /** * Queries data for and inserts a new module segment. * * * @returns Offset to the module if existing or successfully added * @returns 0 if not found. * * @param pHdr The profiler header. * @param uPC Address within the module. * @param off The offset into the modseg area which has been searched. * (This is relative to the first moddule segment record (at pHdr->offModSegs).) */ static KU32 KPRF_NAME(NewModSeg)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(,UPTR) uPC, KU32 off) { /* * Query the module name and object of the function. */ #pragma pack(1) struct { KPRF_TYPE(,MODSEG) ModSeg; char szMorePath[260]; } s; #pragma pack() if (KPRF_GET_MODSEG(uPC + pHdr->uBasePtr, s.ModSeg.szPath, sizeof(s.ModSeg.szPath) + sizeof(s.szMorePath), &s.ModSeg.iSegment, &s.ModSeg.uBasePtr, &s.ModSeg.cbSegmentMinusOne)) return 0; s.ModSeg.uBasePtr -= pHdr->uBasePtr; s.ModSeg.fLoaded = 1; s.ModSeg.cchPath = 0; while (s.ModSeg.szPath[s.ModSeg.cchPath]) s.ModSeg.cchPath++; return KPRF_NAME(InsertModSeg)(pHdr, &s.ModSeg, off); } /** * Record a module segment. * * This is an internal worker for recording a module segment when adding * a new function. * * @returns Offset to the module if existing or successfully added * @returns 0 if not found. * * @param pHdr The profiler header. * @param uPC Address within the module. */ static KU32 KPRF_NAME(RecordModSeg)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(,UPTR) uPC) { /* * Lookup the module segment, inserting it if not found (and there is room). */ KU32 off = 0; KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(P,MODSEG, pHdr->offModSegs, pHdr); const KU32 cbModSegs = pHdr->cbModSegs; for (;;) { /* done and not found? */ if (off >= cbModSegs) return KPRF_NAME(NewModSeg)(pHdr, uPC, off); /* * Match? */ if ( pCur->fLoaded && uPC - pCur->uBasePtr <= pCur->cbSegmentMinusOne) return off + pHdr->offModSegs; KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]); cbCur = KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR)); off += cbCur; pCur = (KPRF_TYPE(PC,MODSEG))((KU8 *)pCur + cbCur); } } kbuild-3608/src/lib/quote_argv.c0000664000175000017500000002067414670377415016612 0ustar locutuslocutus/* $Id: quote_argv.c 3235 2018-10-28 14:15:29Z bird $ */ /** @file * quote_argv - Correctly quote argv for spawn, windows specific. */ /* * Copyright (c) 2007-2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "quote_argv.h" #include #include #include #ifndef KBUILD_OS_WINDOWS # error "KBUILD_OS_WINDOWS not defined" #endif /** * Checks if this is an Watcom option where we must just pass thru the string * as-is. * * This is currnetly only used for -d (defining macros). * * @returns 1 if pass-thru, 0 if not. * @param pszArg The argument to consider. */ static int isWatcomPassThruOption(const char *pszArg) { char ch = *pszArg++; if (ch != '-' && ch != '/') return 0; ch = *pszArg++; switch (ch) { /* Example: -d+VAR="string-value" */ case 'd': if (ch == '+') ch = *pszArg++; if (!isalpha(ch) && ch != '_') return 0; return 1; default: return 0; } } /** * Replaces arguments in need of quoting. * * For details on how MSC parses the command line, see "Parsing C Command-Line * Arguments": http://msdn.microsoft.com/en-us/library/a1y7w461.aspx * * @returns 0 on success, -1 if out of memory. * @param argc The argument count. * @param argv The argument vector. * @param fWatcomBrainDamage Set if we're catering for wcc, wcc386 or similar * OpenWatcom tools. They seem to follow some * ancient or home made quoting convention. * @param fFreeOrLeak Whether to free replaced argv members * (non-zero), or just leak them (zero). This * depends on which argv you're working on. * Suggest doing the latter if it's main()'s argv. */ int quote_argv(int argc, char **argv, int fWatcomBrainDamage, int fFreeOrLeak) { int i; for (i = 0; i < argc; i++) { char *const pszOrgOrg = argv[i]; const char *pszOrg = pszOrgOrg; size_t cchOrg = strlen(pszOrg); const char *pszQuotes = (const char *)memchr(pszOrg, '"', cchOrg); const char *pszProblem = NULL; if ( pszQuotes || cchOrg == 0 || (pszProblem = (const char *)memchr(pszOrg, ' ', cchOrg)) != NULL || (pszProblem = (const char *)memchr(pszOrg, '\t', cchOrg)) != NULL || (pszProblem = (const char *)memchr(pszOrg, '\n', cchOrg)) != NULL || (pszProblem = (const char *)memchr(pszOrg, '\r', cchOrg)) != NULL || (pszProblem = (const char *)memchr(pszOrg, '&', cchOrg)) != NULL || (pszProblem = (const char *)memchr(pszOrg, '>', cchOrg)) != NULL || (pszProblem = (const char *)memchr(pszOrg, '<', cchOrg)) != NULL || (pszProblem = (const char *)memchr(pszOrg, '|', cchOrg)) != NULL || (pszProblem = (const char *)memchr(pszOrg, '%', cchOrg)) != NULL || (pszProblem = (const char *)memchr(pszOrg, '\'', cchOrg)) != NULL || ( !fWatcomBrainDamage && (pszProblem = (const char *)memchr(pszOrg, '=', cchOrg)) != NULL) || ( fWatcomBrainDamage && (pszProblem = (const char *)memchr(pszOrg, '\\', cchOrg)) != NULL) ) { char ch; int fComplicated = pszQuotes || (cchOrg > 0 && pszOrg[cchOrg - 1] == '\\'); size_t cchNew = fComplicated ? cchOrg * 2 + 2 : cchOrg + 2; char *pszNew = (char *)malloc(cchNew + 1 /*term*/); if (!pszNew) return -1; argv[i] = pszNew; /* Watcom does not grok stuff like "-i=c:\program files\watcom\h", it think it's a source specification. In that case the quote must follow the equal sign. */ if (fWatcomBrainDamage) { size_t cchUnquoted = 0; if (pszOrg[0] == '@') /* Response file quoting: @"file name.rsp" */ cchUnquoted = 1; else if (pszOrg[0] == '-' || pszOrg[0] == '/') /* Switch quoting. */ { const char *pszNeedQuoting; if (isWatcomPassThruOption(pszOrg)) { argv[i] = pszOrgOrg; free(pszNew); continue; /* No quoting needed, skip to the next argument. */ } pszNeedQuoting = (const char *)memchr(pszOrg, '=', cchOrg); /* For -i=dir and similar. */ if ( pszNeedQuoting == NULL || (uintptr_t)pszNeedQuoting > (uintptr_t)(pszProblem ? pszProblem : pszQuotes)) pszNeedQuoting = pszProblem ? pszProblem : pszQuotes; else pszNeedQuoting++; cchUnquoted = pszNeedQuoting - pszOrg; } if (cchUnquoted) { memcpy(pszNew, pszOrg, cchUnquoted); pszNew += cchUnquoted; pszOrg += cchUnquoted; cchOrg -= cchUnquoted; } } *pszNew++ = '"'; if (fComplicated) { while ((ch = *pszOrg++) != '\0') { if (ch == '"') { *pszNew++ = '\\'; *pszNew++ = '"'; } else if (ch == '\\') { /* Backslashes are a bit complicated, they depends on whether a quotation mark follows them or not. They only require escaping if one does. */ unsigned cSlashes = 1; while ((ch = *pszOrg) == '\\') { pszOrg++; cSlashes++; } if (ch == '"' || ch == '\0') /* We put a " at the EOS. */ { while (cSlashes-- > 0) { *pszNew++ = '\\'; *pszNew++ = '\\'; } } else while (cSlashes-- > 0) *pszNew++ = '\\'; } else *pszNew++ = ch; } } else { memcpy(pszNew, pszOrg, cchOrg); pszNew += cchOrg; } *pszNew++ = '"'; *pszNew = '\0'; if (fFreeOrLeak) free(pszOrgOrg); } } /*for (i = 0; i < argc; i++) fprintf(stderr, "argv[%u]=%s;;\n", i, argv[i]);*/ return 0; } kbuild-3608/src/lib/win_get_processor_group_active_mask.h0000664000175000017500000000314214670377415023747 0ustar locutuslocutus/* $Id: win_get_processor_group_active_mask.h 3354 2020-06-05 02:04:25Z bird $ */ /** @file * win_get_processor_group_active_mask - Helper. */ /* * Copyright (c) 2020 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___lib_win_get_processor_group_active_mask_h___ #define ___lib_win_get_processor_group_active_mask_h___ extern KAFFINITY win_get_processor_group_active_mask(unsigned iGroup); #endif kbuild-3608/src/lib/mytypes.h0000664000175000017500000000333714670377415016152 0ustar locutuslocutus/* $Id: mytypes.h 2851 2016-08-31 17:30:52Z bird $ */ /** @file * mytypes - wrapper that ensures the necessary uintXY_t types are defined. */ /* * Copyright (c) 2007-2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___mytypes_h___ #define ___mytypes_h___ #include #include /* MSC: intptr_t */ #include #if defined(_MSC_VER) typedef unsigned int uint32_t; typedef signed int int32_t; typedef unsigned char uint8_t; typedef signed char int8_t; #else # include #endif #endif kbuild-3608/src/lib/kDep.c0000664000175000017500000005173614670377415015324 0ustar locutuslocutus/* $Id: kDep.c 3315 2020-03-31 01:12:19Z bird $ */ /** @file * kDep - Common Dependency Managemnt Code. */ /* * Copyright (c) 2004-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #ifdef KMK /* For when it gets compiled and linked into kmk. */ # include "makeint.h" #endif #include #include #include #include #include #include #include #include "k/kDefs.h" #include "k/kTypes.h" #if K_OS == K_OS_WINDOWS # define USE_WIN_MMAP # include # include # include "nt_fullpath.h" # include "nt/ntstat.h" #else # include # include # include #endif #include "kDep.h" #ifdef KWORKER extern int kwFsPathExists(const char *pszPath); #endif /********************************************************************************************************************************* * Defined Constants And Macros * *********************************************************************************************************************************/ /* For the GNU/hurd weirdo. */ #if !defined(PATH_MAX) && !defined(_MAX_PATH) # define PATH_MAX 4096 #endif /** * Initializes the dep instance. * * @param pThis The dep instance to init. */ void depInit(PDEPGLOBALS pThis) { pThis->pDeps = NULL; } /** * Cleans up the dep instance (frees resources). * * @param pThis The dep instance to cleanup. */ void depCleanup(PDEPGLOBALS pThis) { PDEP pDep = pThis->pDeps; pThis->pDeps = NULL; while (pDep) { PDEP pFree = pDep; pDep = pDep->pNext; free(pFree); } } /** * Corrects all slashes to unix slashes. * * @returns pszFilename. * @param pszFilename The filename to correct. */ static char *fixslash(char *pszFilename) { char *psz = pszFilename; while ((psz = strchr(psz, '\\')) != NULL) *psz++ = '/'; return pszFilename; } #if K_OS == K_OS_OS2 /** * Corrects the case of a path. * * @param pszPath Pointer to the path, both input and output. * The buffer must be able to hold one more byte than the string length. */ static void fixcase(char *pszFilename) { return; } #elif K_OS != K_OS_WINDOWS /** * Corrects the case of a path. * * @param pszPath Pointer to the path, both input and output. */ static void fixcase(char *pszFilename) { char *psz; /* * Skip the root. */ psz = pszFilename; while (*psz == '/') psz++; /* * Iterate all the components. */ while (*psz) { char chSlash; struct stat s; char *pszStart = psz; /* * Find the next slash (or end of string) and terminate the string there. */ while (*psz != '/' && *psz) psz++; chSlash = *psz; *psz = '\0'; /* * Does this part exist? * If not we'll enumerate the directory and search for an case-insensitive match. */ if (stat(pszFilename, &s)) { struct dirent *pEntry; DIR *pDir; if (pszStart == pszFilename) pDir = opendir(*pszFilename ? pszFilename : "."); else { pszStart[-1] = '\0'; pDir = opendir(pszFilename); pszStart[-1] = '/'; } if (!pDir) { *psz = chSlash; break; /* giving up, if we fail to open the directory. */ } while ((pEntry = readdir(pDir)) != NULL) { if (!strcasecmp(pEntry->d_name, pszStart)) { strcpy(pszStart, pEntry->d_name); break; } } closedir(pDir); if (!pEntry) { *psz = chSlash; break; /* giving up if not found. */ } } /* restore the slash and press on. */ *psz = chSlash; while (*psz == '/') psz++; } return; } #endif /* !OS/2 && !Windows */ /** * 'Optimizes' and corrects the dependencies. */ void depOptimize(PDEPGLOBALS pThis, int fFixCase, int fQuiet, const char *pszIgnoredExt) { /* * Walk the list correct the names and re-insert them. */ size_t cchIgnoredExt = pszIgnoredExt ? strlen(pszIgnoredExt) : 0; PDEP pDepOrg = pThis->pDeps; PDEP pDep = pThis->pDeps; pThis->pDeps = NULL; for (; pDep; pDep = pDep->pNext) { #ifndef PATH_MAX char szFilename[_MAX_PATH + 1]; #else char szFilename[PATH_MAX + 1]; #endif char *pszFilename; #if !defined(KWORKER) && !defined(KMK) struct stat s; #endif /* * Skip some fictive names like and . */ if ( pDep->szFilename[0] == '<' && pDep->szFilename[pDep->cchFilename - 1] == '>') continue; pszFilename = pDep->szFilename; /* * Skip pszIgnoredExt if given. */ if ( pszIgnoredExt && pDep->cchFilename > cchIgnoredExt && memcmp(&pDep->szFilename[pDep->cchFilename - cchIgnoredExt], pszIgnoredExt, cchIgnoredExt) == 0) continue; #if K_OS != K_OS_OS2 && K_OS != K_OS_WINDOWS /* * Skip any drive letters from compilers running in wine. */ if (pszFilename[1] == ':') pszFilename += 2; #endif /* * The microsoft compilers are notoriously screwing up the casing. * This will screw up kmk (/ GNU Make). */ if (fFixCase) { #if K_OS == K_OS_WINDOWS nt_fullpath_cached(pszFilename, szFilename, sizeof(szFilename)); fixslash(szFilename); #else strcpy(szFilename, pszFilename); fixslash(szFilename); fixcase(szFilename); #endif pszFilename = szFilename; } /* * Check that the file exists before we start depending on it. */ errno = 0; #ifdef KWORKER if (!kwFsPathExists(pszFilename)) #elif defined(KMK) if (!file_exists_p(pszFilename)) #elif K_OS == K_OS_WINDOWS if (birdStatModTimeOnly(pszFilename, &s.st_mtim, 1 /*fFollowLink*/) != 0) #else if (stat(pszFilename, &s) != 0) #endif { if ( !fQuiet || errno != ENOENT || ( pszFilename[0] != '/' && pszFilename[0] != '\\' && ( !isalpha(pszFilename[0]) || pszFilename[1] != ':' || ( pszFilename[2] != '/' && pszFilename[2] != '\\'))) ) fprintf(stderr, "kDep: Skipping '%s' - %s!\n", pszFilename, strerror(errno)); continue; } /* * Insert the corrected dependency. */ depAdd(pThis, pszFilename, strlen(pszFilename)); } /* * Free the old ones. */ while (pDepOrg) { pDep = pDepOrg; pDepOrg = pDepOrg->pNext; free(pDep); } } /** * Write a filename that contains characters that needs escaping. * * @param pOutput The output stream. * @param pszFile The filename. * @param cchFile The length of the filename. * @param fDep Whether this is for a dependency file or a target file. */ int depNeedsEscaping(const char *pszFile, size_t cchFile, int fDependency) { return memchr(pszFile, ' ', cchFile) != NULL || memchr(pszFile, '\t', cchFile) != NULL || memchr(pszFile, '#', cchFile) != NULL || memchr(pszFile, '=', cchFile) != NULL || memchr(pszFile, ';', cchFile) != NULL || memchr(pszFile, '$', cchFile) != NULL || memchr(pszFile, fDependency ? '|' : '%', cchFile) != NULL; } /** * Write a filename that contains characters that needs escaping. * * @param pOutput The output stream. * @param pszFile The filename. * @param cchFile The length of the filename. * @param fDep Whether this is for a dependency file or a target file. */ void depEscapedWrite(FILE *pOutput, const char *pszFile, size_t cchFile, int fDepenency) { size_t cchWritten = 0; size_t off = 0; while (off < cchFile) { char const ch = pszFile[off]; switch (ch) { default: off++; break; /* * Escaped by slash, but any preceeding slashes must be escaped too. * A couple of characters are only escaped on one side of the ':'. */ case '%': /* target side only */ case '|': /* dependency side only */ if (ch != (fDepenency ? '|' : '%')) { off++; break; } /* fall thru */ case ' ': case '\t': case '#': case '=': /** @todo buggy GNU make handling */ case ';': /** @todo buggy GNU make handling */ if (cchWritten < off) fwrite(&pszFile[cchWritten], off - cchWritten, 1, pOutput); if (off == 0 || pszFile[off - 1] != '\\') { fputc('\\', pOutput); cchWritten = off; /* We write the escaped character with the next bunch. */ } else { size_t cchSlashes = 1; while (cchSlashes < off && pszFile[off - cchSlashes - 1] == '\\') cchSlashes++; fwrite(&pszFile[off - cchSlashes], cchSlashes, 1, pOutput); cchWritten = off - 1; /* Write a preceeding slash and the escaped character with the next bunch. */ } off += 1; break; /* * Escaped by doubling it. * Implemented by including in the pending writeout job as well as in the next one. */ case '$': fwrite(&pszFile[cchWritten], off - cchWritten + 1, 1, pOutput); cchWritten = off++; /* write it again the next time */ break; } } /* Remainder: */ if (cchWritten < cchFile) fwrite(&pszFile[cchWritten], cchFile - cchWritten, 1, pOutput); } /** * Escapes all trailing trailing slashes in a filename that ends with such. */ static void depPrintTrailngSlashEscape(FILE *pOutput, const char *pszFilename, size_t cchFilename) { size_t cchSlashes = 1; while (cchSlashes < cchFilename && pszFilename[cchFilename - cchSlashes - 1] == '\\') cchSlashes++; fwrite(&pszFilename[cchFilename - cchSlashes], cchSlashes, 1, pOutput); } /** * Prints the dependency chain. * * @param pThis The 'dep' instance. * @param pOutput Output stream. */ void depPrintChain(PDEPGLOBALS pThis, FILE *pOutput) { static char const g_szEntryText[] = " \\\n\t"; static char const g_szTailText[] = "\n\n"; static char const g_szTailSlashText[] = " \\\n\n"; PDEP pDep; for (pDep = pThis->pDeps; pDep; pDep = pDep->pNext) { fwrite(g_szEntryText, sizeof(g_szEntryText) - 1, 1, pOutput); if (!pDep->fNeedsEscaping) fwrite(pDep->szFilename, pDep->cchFilename, 1, pOutput); else depEscapedWrite(pOutput, pDep->szFilename, pDep->cchFilename, 1 /*fDependency*/); if (pDep->fTrailingSlash) { /* Escape only if more dependencies. If last, we must add a line continuation or it won't work. */ if (pDep->pNext) depPrintTrailngSlashEscape(pOutput, pDep->szFilename, pDep->cchFilename); else { fwrite(g_szTailSlashText, sizeof(g_szTailSlashText), 1, pOutput); return; } } } fwrite(g_szTailText, sizeof(g_szTailText) - 1, 1, pOutput); } /** * Prints the dependency chain with a preceeding target. * * @param pThis The 'dep' instance. * @param pOutput Output stream. * @param pszTarget The target filename. * @param fEscapeTarget Whether to consider escaping the target. */ void depPrintTargetWithDeps(PDEPGLOBALS pThis, FILE *pOutput, const char *pszTarget, int fEscapeTarget) { static char const g_szSeparator[] = ":"; size_t const cchTarget = strlen(pszTarget); if (!fEscapeTarget || !depNeedsEscaping(pszTarget, cchTarget, 0 /*fDependency*/)) fwrite(pszTarget, cchTarget, 1, pOutput); else depEscapedWrite(pOutput, pszTarget, cchTarget, 0 /*fDependency*/); if (cchTarget == 0 || pszTarget[cchTarget - 1] != '\\') { /* likely */ } else depPrintTrailngSlashEscape(pOutput, pszTarget, cchTarget); fwrite(g_szSeparator, sizeof(g_szSeparator) - 1, 1, pOutput); depPrintChain(pThis, pOutput); } /** * Prints empty dependency stubs for all dependencies. * * @param pThis The 'dep' instance. * @param pOutput Output stream. */ void depPrintStubs(PDEPGLOBALS pThis, FILE *pOutput) { static char g_szTailText[] = ":\n\n"; PDEP pDep; for (pDep = pThis->pDeps; pDep; pDep = pDep->pNext) { if (!pDep->fNeedsEscaping && memchr(pDep->szFilename, '%', pDep->cchFilename) == 0) fwrite(pDep->szFilename, pDep->cchFilename, 1, pOutput); else depEscapedWrite(pOutput, pDep->szFilename, pDep->cchFilename, 0 /*fDependency*/); if (pDep->cchFilename == 0 || !pDep->fTrailingSlash) { /* likely */ } else depPrintTrailngSlashEscape(pOutput, pDep->szFilename, pDep->cchFilename); fwrite(g_szTailText, sizeof(g_szTailText) - 1, 1, pOutput); } } /* sdbm: This algorithm was created for sdbm (a public-domain reimplementation of ndbm) database library. it was found to do well in scrambling bits, causing better distribution of the keys and fewer splits. it also happens to be a good general hashing function with good distribution. the actual function is hash(i) = hash(i - 1) * 65599 + str[i]; what is included below is the faster version used in gawk. [there is even a faster, duff-device version] the magic constant 65599 was picked out of thin air while experimenting with different constants, and turns out to be a prime. this is one of the algorithms used in berkeley db (see sleepycat) and elsewhere. */ static unsigned sdbm(const char *str, size_t size) { unsigned hash = 0; int c; while (size-- > 0 && (c = *(unsigned const char *)str++)) hash = c + (hash << 6) + (hash << 16) - hash; return hash; } /** * Adds a dependency. * * @returns Pointer to the allocated dependency. * @param pThis The 'dep' instance. * @param pszFilename The filename. Does not need to be terminated. * @param cchFilename The length of the filename. */ PDEP depAdd(PDEPGLOBALS pThis, const char *pszFilename, size_t cchFilename) { unsigned uHash = sdbm(pszFilename, cchFilename); PDEP pDep; PDEP pDepPrev; /* * Check if we've already got this one. */ pDepPrev = NULL; for (pDep = pThis->pDeps; pDep; pDepPrev = pDep, pDep = pDep->pNext) if ( pDep->uHash == uHash && pDep->cchFilename == cchFilename && !memcmp(pDep->szFilename, pszFilename, cchFilename)) return pDep; /* * Add it. */ pDep = (PDEP)malloc(sizeof(*pDep) + cchFilename); if (!pDep) { fprintf(stderr, "\nOut of memory! (requested %lx bytes)\n\n", (unsigned long)(sizeof(*pDep) + cchFilename)); exit(1); } pDep->cchFilename = cchFilename; memcpy(pDep->szFilename, pszFilename, cchFilename); pDep->szFilename[cchFilename] = '\0'; pDep->fNeedsEscaping = depNeedsEscaping(pszFilename, cchFilename, 1 /*fDependency*/); pDep->fTrailingSlash = cchFilename > 0 && pszFilename[cchFilename - 1] == '\\'; pDep->uHash = uHash; if (pDepPrev) { pDep->pNext = pDepPrev->pNext; pDepPrev->pNext = pDep; } else { pDep->pNext = pThis->pDeps; pThis->pDeps = pDep; } return pDep; } /** * Performs a hexdump. */ void depHexDump(const KU8 *pb, size_t cb, size_t offBase) { const unsigned cchWidth = 16; size_t off = 0; while (off < cb) { unsigned i; printf("%s%0*lx %04lx:", off ? "\n" : "", (int)sizeof(pb) * 2, (unsigned long)offBase + (unsigned long)off, (unsigned long)off); for (i = 0; i < cchWidth && off + i < cb ; i++) printf(off + i < cb ? !(i & 7) && i ? "-%02x" : " %02x" : " ", pb[i]); while (i++ < cchWidth) printf(" "); printf(" "); for (i = 0; i < cchWidth && off + i < cb; i++) { const KU8 u8 = pb[i]; printf("%c", u8 < 127 && u8 >= 32 ? u8 : '.'); } off += cchWidth; pb += cchWidth; } printf("\n"); } /** * Reads the file specified by the pInput file stream into memory. * * @returns The address of the memory mapping on success. This must be * freed by calling depFreeFileMemory. * * @param pInput The file stream to load or map into memory. * @param pcbFile Where to return the mapping (file) size. * @param ppvOpaque Opaque data when mapping, otherwise NULL. */ void *depReadFileIntoMemory(FILE *pInput, size_t *pcbFile, void **ppvOpaque) { void *pvFile; long cbFile; /* * Figure out file size. */ #if defined(_MSC_VER) cbFile = _filelength(fileno(pInput)); if (cbFile < 0) #else if ( fseek(pInput, 0, SEEK_END) < 0 || (cbFile = ftell(pInput)) < 0 || fseek(pInput, 0, SEEK_SET)) #endif { fprintf(stderr, "kDep: error: Failed to determin file size.\n"); return NULL; } if (pcbFile) *pcbFile = cbFile; /* * Try mmap first. */ #ifdef USE_WIN_MMAP { HANDLE hMapObj = CreateFileMapping((HANDLE)_get_osfhandle(fileno(pInput)), NULL, PAGE_READONLY, 0, cbFile, NULL); if (hMapObj != NULL) { pvFile = MapViewOfFile(hMapObj, FILE_MAP_READ, 0, 0, cbFile); if (pvFile) { *ppvOpaque = hMapObj; return pvFile; } fprintf(stderr, "kDep: warning: MapViewOfFile failed, %d.\n", GetLastError()); CloseHandle(hMapObj); } else fprintf(stderr, "kDep: warning: CreateFileMapping failed, %d.\n", GetLastError()); } #endif /* * Allocate memory and read the file. */ pvFile = malloc(cbFile + 1); if (pvFile) { if (fread(pvFile, cbFile, 1, pInput)) { ((KU8 *)pvFile)[cbFile] = '\0'; *ppvOpaque = NULL; return pvFile; } fprintf(stderr, "kDep: error: Failed to read %ld bytes.\n", cbFile); free(pvFile); } else fprintf(stderr, "kDep: error: Failed to allocate %ld bytes (file mapping).\n", cbFile); return NULL; } /** * Free resources allocated by depReadFileIntoMemory. * * @param pvFile The address of the memory mapping. * @param pvOpaque The opaque value returned together with the mapping. */ void depFreeFileMemory(void *pvFile, void *pvOpaque) { #if defined(USE_WIN_MMAP) if (pvOpaque) { UnmapViewOfFile(pvFile); CloseHandle(pvOpaque); return; } #endif free(pvFile); } kbuild-3608/src/lib/dos2unix.c0000664000175000017500000002347214670377415016210 0ustar locutuslocutus/* $Id: dos2unix.c 3114 2017-10-29 18:02:04Z bird $ */ /** @file * dos2unix - Line ending conversion routines. */ /* * Copyright (c) 2017 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include "dos2unix.h" #include #include #include #if K_OS == K_OS_WINDOWS # include #else # include #endif #include #ifndef O_BINARY # ifdef _O_BINARY # define O_BINARY _O_BINARY # else # define O_BINARY 0 # endif #endif /********************************************************************************************************************************* * Defined Constants And Macros * *********************************************************************************************************************************/ #define STACK_BUF_SIZE 0x20000 #define DOS2UNIX_LF 0x0a #define DOS2UNIX_CR 0x0d /** * Does a line ending analysis of the given file. * * @returns 0 on success, errno value on open or read error. * @param pszFilename The path to the file * @param pfStyle Where to return the DOS2UNIX_STYLE_XXX and * DOS2UNIX_F_XXX flags. * @param pcDosEols Where to return the number of DOS end-of-line * sequences found. Optional. * @param pcUnixEols Where to return the number of UNIX end-of-line * sequences found. */ int dos2unix_analyze_file(const char *pszFilename, KU32 *pfStyle, KSIZE *pcDosEols, KSIZE *pcUnixEols) { int iRet = 0; int fd = open(pszFilename, O_RDONLY | O_BINARY); if (fd >= 0) { iRet = dos2unix_analyze_fd(fd, pfStyle, pcDosEols, pcUnixEols); close(fd); } else { iRet = errno; *pfStyle = DOS2UNIX_STYLE_NONE; if (pcUnixEols) *pcUnixEols = 0; if (pcDosEols) *pcDosEols = 0; } return iRet; } /** * Does a line ending analysis of the given file descriptor. * * @returns 0 on success, errno value on open or read error. * @param fd The file descriptor to analyze. Caller must * place this as the desired position. * @param pfStyle Where to return the DOS2UNIX_STYLE_XXX and * DOS2UNIX_F_XXX flags. * @param pcDosEols Where to return the number of DOS end-of-line * sequences found. Optional. * @param pcUnixEols Where to return the number of UNIX end-of-line * sequences found. */ int dos2unix_analyze_fd(int fd, KU32 *pfStyle, KSIZE *pcDosEols, KSIZE *pcUnixEols) { KSIZE cUnixEols = 0; KSIZE cDosEols = 0; KSIZE cLoneCrs = 0; KBOOL fPendingCr = K_FALSE; int iRet = 0; /* * Do the analysis. */ *pfStyle = DOS2UNIX_STYLE_NONE; for (;;) { char achBuf[STACK_BUF_SIZE]; int cchRead = read(fd, achBuf, sizeof(achBuf)); if (cchRead > 0) { int off = 0; if (fPendingCr) { if (achBuf[0] == DOS2UNIX_LF) { off++; cDosEols++; } else cLoneCrs++; fPendingCr = K_FALSE; } while (off < cchRead) { char ch = achBuf[off++]; if ((unsigned char)ch > (unsigned char)DOS2UNIX_CR) { /* likely */ } else if (ch == DOS2UNIX_CR) { if (off < cchRead && achBuf[off] == DOS2UNIX_CR) cDosEols++; else { fPendingCr = K_TRUE; while (off < cchRead) { ch = achBuf[off++]; if (ch != DOS2UNIX_CR) { if (ch == DOS2UNIX_LF) cDosEols++; else cLoneCrs++; fPendingCr = K_FALSE; break; } cLoneCrs++; } } } else if (ch == DOS2UNIX_LF) cUnixEols++; else if (ch == '\0') *pfStyle |= DOS2UNIX_F_BINARY; } } else { if (cchRead < 0) iRet = errno; if (fPendingCr) cLoneCrs++; break; } } /* * Set return values. */ if (cUnixEols > 0 && cDosEols == 0) *pfStyle |= DOS2UNIX_STYLE_UNIX; else if (cDosEols > 0 && cUnixEols == 0) *pfStyle |= DOS2UNIX_STYLE_DOS; else if (cDosEols != 0 && cUnixEols != 0) *pfStyle |= DOS2UNIX_STYLE_MIXED; if (pcUnixEols) *pcUnixEols = cUnixEols; if (pcDosEols) *pcDosEols = cDosEols; return iRet; } /** * Converts a buffer to unix line (LF) endings. * * @retval K_TRUE if pending CR. The caller must handle this case. * @retval K_FALSE if no pending CR. * * @param pchSrc The input buffer. * @param cchSrc Number of characters to convert from the input * buffer. * @param pchDst The output buffer. This must be at least as big as * the input. It is okay if this overlaps with the * source buffer, as long as this is at the same or a * lower address. * @param pcchDst Where to return the number of characters in the * output buffer. */ KBOOL dos2unix_convert_to_unix(const char *pchSrc, KSIZE cchSrc, char *pchDst, KSIZE *pcchDst) { KSIZE offDst = 0; while (cchSrc-- > 0) { char ch = *pchSrc++; if ((unsigned char)ch != (unsigned char)DOS2UNIX_CR) pchDst[offDst++] = ch; else if (cchSrc > 0 && *pchSrc == DOS2UNIX_LF) { pchDst[offDst++] = DOS2UNIX_LF; cchSrc--; pchSrc++; } else if (cchSrc == 0) { *pcchDst = offDst; return K_TRUE; } else pchDst[offDst++] = ch; } *pcchDst = offDst; return K_FALSE; } /** * Converts a buffer to DOS (CRLF) endings. * * @retval K_TRUE if pending CR. The caller must handle this case. * @retval K_FALSE if no pending CR. * * @param pchSrc The input buffer. * @param cchSrc Number of characters to convert from the input * buffer. * @param pchDst The output buffer. This must be at least _twice_ as * big as the input. It is okay if the top half of the * buffer overlaps with the source buffer. * @param pcchDst Where to return the number of characters in the * output buffer. */ KBOOL dos2unix_convert_to_dos(const char *pchSrc, KSIZE cchSrc, char *pchDst, KSIZE *pcchDst) { KSIZE offDst = 0; while (cchSrc-- > 0) { char ch = *pchSrc++; if ((unsigned char)ch > (unsigned char)DOS2UNIX_CR) pchDst[offDst++] = ch; else if (ch == DOS2UNIX_CR) { /* We treat CR kind of like an escape character. */ do { if (cchSrc > 0) { pchDst[offDst++] = ch; cchSrc--; ch = *pchSrc++; } else { *pcchDst = offDst; return K_TRUE; } } while (ch == DOS2UNIX_CR); pchDst[offDst++] = ch; } else if (ch == DOS2UNIX_LF) { pchDst[offDst++] = DOS2UNIX_CR; pchDst[offDst++] = DOS2UNIX_LF; } else pchDst[offDst++] = ch; } *pcchDst = offDst; return K_FALSE; } kbuild-3608/src/lib/nt/0000775000175000017500000000000014670377415014702 5ustar locutuslocutuskbuild-3608/src/lib/nt/tstkFsCache.c0000664000175000017500000002402114670377415017247 0ustar locutuslocutus/* $Id: tstkFsCache.c 3381 2020-06-12 11:36:10Z bird $ */ /** @file * kFsCache testcase. */ /* * Copyright (c) 2020 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include #include #include #include #include "kFsCache.h" #include /********************************************************************************************************************************* * Global Variables * *********************************************************************************************************************************/ static unsigned g_cErrors = 0; /********************************************************************************************************************************* * Defined Constants And Macros * *********************************************************************************************************************************/ #define CHECK_RETV(a_Expr) do { \ if (!(a_Expr)) \ { \ g_cErrors++; \ fprintf(stderr, "error(%u): %s\n", __LINE__, #a_Expr);\ return; \ } \ } while (0) #define CHECK(a_Expr) do { \ if (!(a_Expr)) \ { \ g_cErrors++; \ fprintf(stderr, "error(%u): %s\n", __LINE__, #a_Expr);\ } \ } while (0) static int myMkDir(const char *pszPath) { if (_mkdir(pszPath) == 0) return 0; fprintf(stderr, "_mkdir(%s) -> errno=%d\n", pszPath, errno); return -1; } static int myCreateFile(const char *pszPath) { FILE *pFile = fopen(pszPath, "w"); if (pFile) { fclose(pFile); return 0; } fprintf(stderr, "fopen(%s,w) -> errno=%d\n", pszPath, errno); return -1; } static void test1(const char *pszWorkDir) { char szPath[4096]; size_t cchWorkDir = strlen(pszWorkDir); PKFSCACHE pCache; KFSLOOKUPERROR enmLookupError; PKFSOBJ pFsObj; CHECK_RETV(cchWorkDir < sizeof(szPath) - 1024); memcpy(szPath, pszWorkDir, cchWorkDir); cchWorkDir += sprintf(&szPath[cchWorkDir], "\\tstkFsCache%u", _getpid()); CHECK_RETV(myMkDir(szPath) == 0); pCache = kFsCacheCreate(KFSCACHE_F_MISSING_OBJECTS | KFSCACHE_F_MISSING_PATHS); CHECK_RETV(pCache != NULL); enmLookupError = (KFSLOOKUPERROR)-1; CHECK((pFsObj = kFsCacheLookupA(pCache, szPath, &enmLookupError)) != NULL); #if 0 /* * Accidentally left out the '\' in front of the filename, so it ended up in * a temp dir with almost 1000 files and that triggered a refresh issue. */ /* Negative lookup followed by creation of that file. */ enmLookupError = (KFSLOOKUPERROR)-1; sprintf(&szPath[cchWorkDir], "file1.txt"); CHECK((pFsObj = kFsCacheLookupA(pCache, szPath, &enmLookupError)) != NULL); if (pFsObj) CHECK(pFsObj->bObjType == KFSOBJ_TYPE_MISSING); CHECK(myCreateFile(szPath) == 0); CHECK((pFsObj = kFsCacheLookupA(pCache, szPath, &enmLookupError)) != NULL); if (pFsObj) CHECK(pFsObj->bObjType == KFSOBJ_TYPE_MISSING); kFsCacheInvalidateAll(pCache); CHECK((pFsObj = kFsCacheLookupA(pCache, szPath, &enmLookupError)) != NULL); if (pFsObj) { CHECK(pFsObj->bObjType == KFSOBJ_TYPE_FILE); if (pFsObj->bObjType != KFSOBJ_TYPE_FILE) fprintf(stderr, "bObjType=%d\n", pFsObj->bObjType); } #endif /* * Try emulate the temp issue above. Seem to require several files. * (The problem was related to long/short filename updating.) */ szPath[cchWorkDir++] = '\\'; sprintf(&szPath[cchWorkDir], "longfilename1.txt"); CHECK(myCreateFile(szPath) == 0); sprintf(&szPath[cchWorkDir], "longfilename2.txt"); CHECK(myCreateFile(szPath) == 0); #if 1 /* no file 3 */ sprintf(&szPath[cchWorkDir], "longfilename4.txt"); CHECK(myCreateFile(szPath) == 0); sprintf(&szPath[cchWorkDir], "longfilename5.txt"); CHECK(myCreateFile(szPath) == 0); /* no file 6 */ sprintf(&szPath[cchWorkDir], "longfilename7.txt"); CHECK(myCreateFile(szPath) == 0); #endif enmLookupError = (KFSLOOKUPERROR)-1; sprintf(&szPath[cchWorkDir], "longfilename3.txt"); CHECK((pFsObj = kFsCacheLookupA(pCache, szPath, &enmLookupError)) != NULL); CHECK(pFsObj && pFsObj->bObjType == KFSOBJ_TYPE_MISSING); enmLookupError = (KFSLOOKUPERROR)-1; sprintf(&szPath[cchWorkDir], "longfilename6.txt"); CHECK((pFsObj = kFsCacheLookupA(pCache, szPath, &enmLookupError)) != NULL); CHECK(pFsObj && pFsObj->bObjType == KFSOBJ_TYPE_MISSING); sprintf(&szPath[cchWorkDir], "longfilename3.txt"); CHECK(myCreateFile(szPath) == 0); sprintf(&szPath[cchWorkDir], "longfilename6.txt"); CHECK(myCreateFile(szPath) == 0); sprintf(&szPath[cchWorkDir], "longfilename3.txt"); CHECK((pFsObj = kFsCacheLookupA(pCache, szPath, &enmLookupError)) != NULL); CHECK(pFsObj && pFsObj->bObjType == KFSOBJ_TYPE_MISSING); sprintf(&szPath[cchWorkDir], "longfilename6.txt"); CHECK((pFsObj = kFsCacheLookupA(pCache, szPath, &enmLookupError)) != NULL); CHECK(pFsObj && pFsObj->bObjType == KFSOBJ_TYPE_MISSING); kFsCacheInvalidateAll(pCache); sprintf(&szPath[cchWorkDir], "longfilename3.txt"); CHECK((pFsObj = kFsCacheLookupA(pCache, szPath, &enmLookupError)) != NULL); if (pFsObj) { CHECK(pFsObj->bObjType == KFSOBJ_TYPE_FILE); if (pFsObj->bObjType != KFSOBJ_TYPE_FILE) fprintf(stderr, "bObjType=%d\n", pFsObj->bObjType); } sprintf(&szPath[cchWorkDir], "longfilename6.txt"); CHECK((pFsObj = kFsCacheLookupA(pCache, szPath, &enmLookupError)) != NULL); if (pFsObj) { CHECK(pFsObj->bObjType == KFSOBJ_TYPE_FILE); if (pFsObj->bObjType != KFSOBJ_TYPE_FILE) fprintf(stderr, "bObjType=%d\n", pFsObj->bObjType); } } static int usage(int rcExit) { printf("usage: tstkFsCache [--workdir dir]\n" "\n" "Test program of the kFsCache. May leave stuff behind in the work\n" "directory requiring manual cleanup.\n" ); return rcExit; } int main(int argc, char **argv) { const char *pszWorkDir = NULL; int i; /* * Parse arguments. */ for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { const char *pszValue; const char *psz = &argv[i][1]; char chOpt; chOpt = *psz++; if (chOpt == '-') { /* Convert long to short option. */ if (!strcmp(psz, "workdir")) chOpt = 'w'; else if (!strcmp(psz, "help")) chOpt = '?'; else if (!strcmp(psz, "version")) chOpt = 'V'; else return usage(2); psz = ""; } /* * Requires value? */ switch (chOpt) { case 'w': if (*psz) pszValue = psz; else if (++i < argc) pszValue = argv[i]; else { fprintf(stderr, "The '-%c' option takes a value.\n", chOpt); return 2; } break; default: pszValue = NULL; break; } switch (chOpt) { case 'w': pszWorkDir = pszValue; break; case '?': return usage(0); case 'V': printf("0.0.0\n"); return 0; /* * Invalid argument. */ default: fprintf(stderr, "syntax error: Invalid option '%s'.\n", argv[i]); return 2; } } else { fprintf(stderr, "syntax error: Invalid argument '%s'.\n", argv[i]); return 2; } } /* * Resolve defaults. */ if (!pszWorkDir) { pszWorkDir = getenv("TEMP"); if (!pszWorkDir) pszWorkDir = "."; } /* * Do the testing. */ test1(pszWorkDir); if (!g_cErrors) printf("Success!\n"); else printf("Failed - %u errors!\n", g_cErrors); return g_cErrors == 0 ? 0 : 1; } kbuild-3608/src/lib/nt/nthlp.h0000664000175000017500000001240314670377415016200 0ustar locutuslocutus/* $Id: nthlp.h 3337 2020-04-22 17:56:36Z bird $ */ /** @file * MSC + NT helper functions. */ /* * Copyright (c) 2005-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___nt_nthlp_h #define ___nt_nthlp_h #include "ntstuff.h" #include "nttypes.h" /** Lazy resolving of the NTDLL imports. */ #define birdResolveImports() do { if (g_fResolvedNtImports) {} else birdResolveImportsWorker(); } while (0) void birdResolveImportsWorker(void); extern int g_fResolvedNtImports; void *birdTmpAlloc(size_t cb); void birdTmpFree(void *pv); void *birdMemAlloc(size_t cb); void *birdMemAllocZ(size_t cb); void birdMemFree(void *pv); int birdSetErrnoFromNt(MY_NTSTATUS rcNt); int birdSetErrnoFromWin32(DWORD dwErr); int birdSetErrnoToNoMem(void); int birdSetErrnoToInvalidArg(void); int birdSetErrnoToBadFileNo(void); HANDLE birdOpenFile(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs); HANDLE birdOpenFileW(const wchar_t *pwszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs); HANDLE birdOpenFileEx(HANDLE hRoot, const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs); HANDLE birdOpenFileExW(HANDLE hRoot, const wchar_t *pwszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs); HANDLE birdOpenParentDir(HANDLE hRoot, const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, MY_UNICODE_STRING *pNameUniStr); HANDLE birdOpenParentDirW(HANDLE hRoot, const wchar_t *pwszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, MY_UNICODE_STRING *pNameUniStr); MY_NTSTATUS birdOpenFileUniStr(HANDLE hRoot, MY_UNICODE_STRING *pNtPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, HANDLE *phFile); HANDLE birdOpenCurrentDirectory(void); void birdCloseFile(HANDLE hFile); int birdIsPathDirSpec(const char *pszPath); int birdDosToNtPath(const char *pszPath, MY_UNICODE_STRING *pNtPath); int birdDosToNtPathW(const wchar_t *pwszPath, MY_UNICODE_STRING *pNtPath); int birdDosToRelativeNtPath(const char *pszPath, MY_UNICODE_STRING *pNtPath); int birdDosToRelativeNtPathW(const wchar_t *pszPath, MY_UNICODE_STRING *pNtPath); void birdFreeNtPath(MY_UNICODE_STRING *pNtPath); static __inline void birdNtTimeToTimeSpec(__int64 iNtTime, BirdTimeSpec_T *pTimeSpec) { iNtTime -= BIRD_NT_EPOCH_OFFSET_UNIX_100NS; pTimeSpec->tv_sec = iNtTime / 10000000; pTimeSpec->tv_nsec = (iNtTime % 10000000) * 100; } static __inline __int64 birdNtTimeFromTimeSpec(BirdTimeSpec_T const *pTimeSpec) { __int64 iNtTime = pTimeSpec->tv_sec * 10000000; iNtTime += pTimeSpec->tv_nsec / 100; iNtTime += BIRD_NT_EPOCH_OFFSET_UNIX_100NS; return iNtTime; } static __inline void birdNtTimeToTimeVal(__int64 iNtTime, BirdTimeVal_T *pTimeVal) { iNtTime -= BIRD_NT_EPOCH_OFFSET_UNIX_100NS; pTimeVal->tv_sec = iNtTime / 10000000; pTimeVal->tv_usec = (iNtTime % 10000000) / 10; } static __inline __int64 birdNtTimeFromTimeVal(BirdTimeVal_T const *pTimeVal) { __int64 iNtTime = pTimeVal->tv_sec * 10000000; iNtTime += pTimeVal->tv_usec * 10; iNtTime += BIRD_NT_EPOCH_OFFSET_UNIX_100NS; return iNtTime; } #endif kbuild-3608/src/lib/nt/tstNtFts.c0000664000175000017500000002035414670377415016643 0ustar locutuslocutus /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #ifndef USE_OLD_FTS # include "fts-nt.h" #else # include "kmkbuiltin/ftsfake.h" #endif #include #include #include #include static int usage(const char *argv0) { printf("usage: %s [options] \n", argv0); printf("\n" "options:\n" " -d, --see-dot\n" " FTS_SEEDOT\n" " -p, --physical\n" " FTS_PHYSICAL\n" " -l, --logical\n" " FTS_LOGICAL\n" " -H, --dereference-command-line\n" " FTS_COMFOLLOW\n" " -L, --dereference\n" " Follow symbolic links while scanning directories.\n" " -P, --no-dereference\n" " Do not follow symbolic links while scanning directories.\n" " -c, --no-chdir\n" " FTS_NOCHDIR\n" " -s, --no-stat\n" " FTS_NOSTAT\n" " -x, --one-file-system\n" " FTS_XDEV\n" " -q, --quiet\n" " Quiet operation, no output.\n" " -v, --verbose\n" " Verbose operation (default).\n" ); return 0; } int main(int argc, char **argv) { FTS *pFts; int i; int rcExit = 0; int cVerbosity = 1; int fFollowLinks = 0; int fFtsFlags = 0; unsigned fDoneOptions = 0; unsigned cFtsArgs = 0; char const **papszFtsArgs = calloc(argc + 1, sizeof(char *)); /* * Parse options and heap up non-options. */ for (i = 1; i < argc; i++) { const char *pszArg = argv[i]; if (*pszArg == '-' && !fDoneOptions) { char chOpt = *++pszArg; pszArg++; if (chOpt == '-') { if (!chOpt) { fDoneOptions = 1; continue; } if (strcmp(pszArg, "help") == 0) chOpt = 'h'; else if (strcmp(pszArg, "version") == 0) chOpt = 'V'; else if (strcmp(pszArg, "see-dot") == 0) chOpt = 'd'; else if (strcmp(pszArg, "physical") == 0) chOpt = 'p'; else if (strcmp(pszArg, "logical") == 0) chOpt = 'l'; else if (strcmp(pszArg, "dereference-command-line") == 0) chOpt = 'H'; else if (strcmp(pszArg, "no-chdir") == 0) chOpt = 'c'; else if (strcmp(pszArg, "no-stat") == 0) chOpt = 's'; else if (strcmp(pszArg, "one-file-system") == 0) chOpt = 'x'; else if (strcmp(pszArg, "quiet") == 0) chOpt = 'q'; else if (strcmp(pszArg, "verbose") == 0) chOpt = 'v'; else if (strcmp(pszArg, "no-ansi") == 0) chOpt = 'w'; else { fprintf(stderr, "syntax error: Unknown option: %s (%s)\n", argv[i], pszArg); return 2; } pszArg = ""; } do { switch (chOpt) { case '?': case 'h': return usage(argv[0]); case 'V': printf("v0.0.0\n"); return 0; case 'd': fFtsFlags |= FTS_SEEDOT; break; case 'l': fFtsFlags |= FTS_LOGICAL; break; case 'p': fFtsFlags |= FTS_PHYSICAL; break; case 'H': fFtsFlags |= FTS_COMFOLLOW; break; case 'c': fFtsFlags |= FTS_NOCHDIR; break; case 's': fFtsFlags |= FTS_NOSTAT; break; case 'x': fFtsFlags |= FTS_XDEV; break; #ifdef FTS_NO_ANSI case 'w': fFtsFlags |= FTS_NO_ANSI; break; #endif case 'L': fFollowLinks = 1; break; case 'P': fFollowLinks = 0; break; case 'q': cVerbosity = 0; break; case 'v': cVerbosity++; break; default: fprintf(stderr, "syntax error: Unknown option: -%c (%s)\n", chOpt, argv[i]); return 2; } chOpt = *pszArg++; } while (chOpt != '\0'); } else papszFtsArgs[cFtsArgs++] = pszArg; } #ifdef USE_OLD_FTS if (papszFtsArgs[0] == NULL) { fprintf(stderr, "Nothing to do\n"); return 1; } #endif /* * Do the traversal. */ errno = 0; pFts = fts_open((char **)papszFtsArgs, fFtsFlags, NULL /*pfnCompare*/); if (pFts) { for (;;) { FTSENT *pFtsEnt = fts_read(pFts); if (pFtsEnt) { const char *pszState; switch (pFtsEnt->fts_info) { case FTS_D: pszState = "D"; break; case FTS_DC: pszState = "DC"; break; case FTS_DEFAULT: pszState = "DEFAULT"; break; case FTS_DNR: pszState = "DNR"; break; case FTS_DOT: pszState = "DOT"; break; case FTS_DP: pszState = "DP"; break; case FTS_ERR: pszState = "ERR"; break; case FTS_F: pszState = "F"; break; case FTS_INIT: pszState = "INIT"; break; case FTS_NS: pszState = "NS"; break; case FTS_NSOK: pszState = "NSOK"; break; case FTS_SL: pszState = "SL"; break; case FTS_SLNONE: pszState = "SLNONE"; break; default: pszState = "Invalid"; rcExit = 1; break; } if (cVerbosity > 0) { #ifdef FTS_NO_ANSI if (fFtsFlags & FTS_NO_ANSI) printf("%8s %ls\n", pszState, pFtsEnt->fts_wcsaccpath); else #endif printf("%8s %s\n", pszState, pFtsEnt->fts_accpath); } if ( pFtsEnt->fts_info == FTS_SL && pFtsEnt->fts_number == 0 && fFollowLinks && ( (fFtsFlags & FTS_COMFOLLOW) || pFtsEnt->fts_level > FTS_ROOTLEVEL) ) { pFtsEnt->fts_number++; fts_set(pFts, pFtsEnt, FTS_FOLLOW); } } else { if (errno != 0) { fprintf(stderr, "fts_read failed: errno=%d\n", errno); rcExit = 1; } break; } } /* enum loop */ errno = 0; i = fts_close(pFts); if (i != 0) { fprintf(stderr, "fts_close failed: errno=%d\n", errno); rcExit = 1; } } else { fprintf(stderr, "fts_open failed: errno=%d (cFtsArgs=%u)\n", errno, cFtsArgs); rcExit = 1; } return rcExit; } kbuild-3608/src/lib/nt/ntdir.h0000664000175000017500000001234014670377415016173 0ustar locutuslocutus/* $Id: ntdir.h 3005 2016-11-06 00:07:37Z bird $ */ /** @file * MSC + NT opendir, readdir, closedir and friends. */ /* * Copyright (c) 2005-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___nt_ntdir_h #define ___nt_ntdir_h #include "nttypes.h" #include "ntstat.h" typedef struct dirent { /** Optional stat information. * Only provided if using birdDirOpenExtraInfo(). */ BirdStat_T d_stat; /** The record length. */ unsigned __int16 d_reclen; /** The name length. */ unsigned __int16 d_namlen; /** The name type. */ unsigned char d_type; /** The name. */ char d_name[512 - sizeof(BirdStat_T) - 2 - 2 - 1]; } BirdDirEntry_T; typedef struct direntw { /** Optional stat information. * Only provided if using birdDirOpenExtraInfo(). */ BirdStat_T d_stat; /** The record length. */ unsigned __int16 d_reclen; /** The name length (in wchar_t). */ unsigned __int16 d_namlen; /** The name type. */ unsigned char d_type; /** The name. */ wchar_t d_name[512 - sizeof(BirdStat_T) - 2 - 2 - 1]; } BirdDirEntryW_T; #define d_ino d_stat.st_ino; /** @name d_type values. * @{ */ #define DT_UNKNOWN 0 #define DT_FIFO 1 #define DT_CHR 2 #define DT_DIR 4 #define DT_BLK 6 #define DT_REG 8 #define DT_LNK 10 #define DT_SOCK 12 #define DT_WHT 14 /** @} */ /** @name BIRDDIR_F_XXX - birdDirOpenFromHandle & BirdDir_T::fFlags * @{ */ /** birdDirClose should also close pvHandle. */ #define BIRDDIR_F_CLOSE_HANDLE 1U /** birdDirClose should not close the handle. */ #define BIRDDIR_F_KEEP_HANDLE 0U /** Provide extra info (stat). */ #define BIRDDIR_F_EXTRA_INFO 2U /** Whether to restart the scan. */ #define BIRDDIR_F_RESTART_SCAN 4U /** Set if the BirdDir_T structure is statically allocated. */ #define BIRDDIR_F_STATIC_ALLOC 8U /** @} */ typedef struct BirdDir { /** Magic value. */ unsigned uMagic; /** Flags. */ unsigned fFlags; /** The directory handle. */ void *pvHandle; /** The device number (st_dev). */ unsigned __int64 uDev; /** The current position. */ long offPos; /** Set if we haven't yet read anything. */ int fFirst; /** Set if we have data in the buffer. */ int fHaveData; /** The info type we're querying. */ int iInfoClass; /** The current buffer position. */ unsigned offBuf; /** The number of bytes allocated for pabBuf. */ unsigned cbBuf; /** Buffer of size cbBuf. */ unsigned char *pabBuf; /** Static directory entry. */ union { BirdDirEntry_T DirEntry; BirdDirEntryW_T DirEntryW; } u; } BirdDir_T; /** Magic value for BirdDir. */ #define BIRD_DIR_MAGIC 0x19731120 BirdDir_T *birdDirOpen(const char *pszPath); BirdDir_T *birdDirOpenExtraInfo(const char *pszPath); BirdDir_T *birdDirOpenExW(void *hRoot, const wchar_t *pwszPath, const wchar_t *pwszFilter, unsigned fFlags); BirdDir_T *birdDirOpenFromHandle(void *hDir, const void *pvReserved, unsigned fFlags); BirdDir_T *birdDirOpenFromHandleWithReuse(BirdDir_T *pDir, void *pvHandle, const void *pvReserved, unsigned fFlags); BirdDirEntry_T *birdDirRead(BirdDir_T *pDir); BirdDirEntryW_T *birdDirReadW(BirdDir_T *pDir); long birdDirTell(BirdDir_T *pDir); void birdDirSeek(BirdDir_T *pDir, long offDir); int birdDirClose(BirdDir_T *pDir); #define opendir birdDirOpen #define readdir birdDirRead #define telldir birdDirTell #define seekdir birdDirSeek #define rewinddir(a_pDir, a_offDir) birdDirSeek(a_pDir, 0) #define closedir birdDirClose #define _D_NAMLEN(a_pEnt) ((a_pEnt)->d_namlen) typedef BirdDir_T DIR; #endif kbuild-3608/src/lib/nt/kFsCache.c0000664000175000017500000054121214670377415016522 0ustar locutuslocutus/* $Id: kFsCache.c 3381 2020-06-12 11:36:10Z bird $ */ /** @file * ntdircache.c - NT directory content cache. */ /* * Copyright (c) 2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include #include "nthlp.h" #include "ntstat.h" #include #include #include #ifdef _MSC_VER # include #endif //#include //#include //#include //#include #include "kFsCache.h" /********************************************************************************************************************************* * Defined Constants And Macros * *********************************************************************************************************************************/ /** @def KFSCACHE_LOG2 * More logging. */ #if 0 # define KFSCACHE_LOG2(a) KFSCACHE_LOG(a) #else # define KFSCACHE_LOG2(a) do { } while (0) #endif /** The minimum time between a directory last populated time and its * modification time for the cache to consider it up-to-date. * * This helps work around races between us reading a directory and someone else * adding / removing files and directories to /from it. Given that the * effective time resolution typically is around 2000Hz these days, unless you * use the new *TimePrecise API variants, there is plenty of room for a race * here. * * The current value is 20ms in NT time units (100ns each), which translates * to a 50Hz time update frequency. */ #define KFSCACHE_MIN_LAST_POPULATED_VS_WRITE (20*1000*10) /********************************************************************************************************************************* * Structures and Typedefs * *********************************************************************************************************************************/ /** * Used by the code re-populating a directory. */ typedef struct KFSDIRREPOP { /** The old papChildren array. */ PKFSOBJ *papOldChildren; /** Number of children in the array. */ KU32 cOldChildren; /** The index into papOldChildren we expect to find the next entry. */ KU32 iNextOldChild; /** Add this to iNextOldChild . */ KI32 cNextOldChildInc; /** Pointer to the cache (name changes). */ PKFSCACHE pCache; } KFSDIRREPOP; /** Pointer to directory re-population data. */ typedef KFSDIRREPOP *PKFSDIRREPOP; /********************************************************************************************************************************* * Internal Functions * *********************************************************************************************************************************/ static KBOOL kFsCacheRefreshObj(PKFSCACHE pCache, PKFSOBJ pObj, KFSLOOKUPERROR *penmError); /** * Retains a reference to a cache object, internal version. * * @returns pObj * @param pObj The object. */ K_INLINE PKFSOBJ kFsCacheObjRetainInternal(PKFSOBJ pObj) { KU32 cRefs = ++pObj->cRefs; kHlpAssert(cRefs < 16384); K_NOREF(cRefs); return pObj; } #ifndef NDEBUG /** * Debug printing. * @param pszFormat Debug format string. * @param ... Format argument. */ void kFsCacheDbgPrintfV(const char *pszFormat, va_list va) { if (1) { DWORD const dwSavedErr = GetLastError(); fprintf(stderr, "debug: "); vfprintf(stderr, pszFormat, va); SetLastError(dwSavedErr); } } /** * Debug printing. * @param pszFormat Debug format string. * @param ... Format argument. */ void kFsCacheDbgPrintf(const char *pszFormat, ...) { if (1) { va_list va; va_start(va, pszFormat); kFsCacheDbgPrintfV(pszFormat, va); va_end(va); } } #endif /* !NDEBUG */ /** * Hashes a string. * * @returns 32-bit string hash. * @param pszString String to hash. */ static KU32 kFsCacheStrHash(const char *pszString) { /* This algorithm was created for sdbm (a public-domain reimplementation of ndbm) database library. it was found to do well in scrambling bits, causing better distribution of the keys and fewer splits. it also happens to be a good general hashing function with good distribution. the actual function is hash(i) = hash(i - 1) * 65599 + str[i]; what is included below is the faster version used in gawk. [there is even a faster, duff-device version] the magic constant 65599 was picked out of thin air while experimenting with different constants, and turns out to be a prime. this is one of the algorithms used in berkeley db (see sleepycat) and elsewhere. */ KU32 uHash = 0; KU32 uChar; while ((uChar = (unsigned char)*pszString++) != 0) uHash = uChar + (uHash << 6) + (uHash << 16) - uHash; return uHash; } /** * Hashes a string. * * @returns The string length. * @param pszString String to hash. * @param puHash Where to return the 32-bit string hash. */ static KSIZE kFsCacheStrHashEx(const char *pszString, KU32 *puHash) { const char * const pszStart = pszString; KU32 uHash = 0; KU32 uChar; while ((uChar = (unsigned char)*pszString) != 0) { uHash = uChar + (uHash << 6) + (uHash << 16) - uHash; pszString++; } *puHash = uHash; return pszString - pszStart; } /** * Hashes a substring. * * @returns 32-bit substring hash. * @param pchString Pointer to the substring (not terminated). * @param cchString The length of the substring. */ static KU32 kFsCacheStrHashN(const char *pchString, KSIZE cchString) { KU32 uHash = 0; while (cchString-- > 0) { KU32 uChar = (unsigned char)*pchString++; uHash = uChar + (uHash << 6) + (uHash << 16) - uHash; } return uHash; } /** * Hashes a UTF-16 string. * * @returns The string length in wchar_t units. * @param pwszString String to hash. * @param puHash Where to return the 32-bit string hash. */ static KSIZE kFsCacheUtf16HashEx(const wchar_t *pwszString, KU32 *puHash) { const wchar_t * const pwszStart = pwszString; KU32 uHash = 0; KU32 uChar; while ((uChar = *pwszString) != 0) { uHash = uChar + (uHash << 6) + (uHash << 16) - uHash; pwszString++; } *puHash = uHash; return pwszString - pwszStart; } /** * Hashes a UTF-16 substring. * * @returns 32-bit substring hash. * @param pwcString Pointer to the substring (not terminated). * @param cchString The length of the substring (in wchar_t's). */ static KU32 kFsCacheUtf16HashN(const wchar_t *pwcString, KSIZE cwcString) { KU32 uHash = 0; while (cwcString-- > 0) { KU32 uChar = *pwcString++; uHash = uChar + (uHash << 6) + (uHash << 16) - uHash; } return uHash; } /** * For use when kFsCacheIAreEqualW hit's something non-trivial. * * @returns K_TRUE if equal, K_FALSE if different. * @param pwcName1 The first string. * @param pwcName2 The second string. * @param cwcName The length of the two strings (in wchar_t's). */ KBOOL kFsCacheIAreEqualSlowW(const wchar_t *pwcName1, const wchar_t *pwcName2, KU16 cwcName) { MY_UNICODE_STRING UniStr1 = { cwcName * sizeof(wchar_t), cwcName * sizeof(wchar_t), (wchar_t *)pwcName1 }; MY_UNICODE_STRING UniStr2 = { cwcName * sizeof(wchar_t), cwcName * sizeof(wchar_t), (wchar_t *)pwcName2 }; return g_pfnRtlEqualUnicodeString(&UniStr1, &UniStr2, TRUE /*fCaseInsensitive*/); } /** * Compares two UTF-16 strings in a case-insensitive fashion. * * You would think we should be using _wscnicmp here instead, however it is * locale dependent and defaults to ASCII upper/lower handling setlocale hasn't * been called. * * @returns K_TRUE if equal, K_FALSE if different. * @param pwcName1 The first string. * @param pwcName2 The second string. * @param cwcName The length of the two strings (in wchar_t's). */ K_INLINE KBOOL kFsCacheIAreEqualW(const wchar_t *pwcName1, const wchar_t *pwcName2, KU32 cwcName) { while (cwcName > 0) { wchar_t wc1 = *pwcName1; wchar_t wc2 = *pwcName2; if (wc1 == wc2) { /* not unlikely */ } else if ( (KU16)wc1 < (KU16)0xc0 /* U+00C0 is the first upper/lower letter after 'z'. */ && (KU16)wc2 < (KU16)0xc0) { /* ASCII upper case. */ if ((KU16)wc1 - (KU16)0x61 < (KU16)26) wc1 &= ~(wchar_t)0x20; if ((KU16)wc2 - (KU16)0x61 < (KU16)26) wc2 &= ~(wchar_t)0x20; if (wc1 != wc2) return K_FALSE; } else return kFsCacheIAreEqualSlowW(pwcName1, pwcName2, (KU16)cwcName); pwcName2++; pwcName1++; cwcName--; } return K_TRUE; } /** * Looks for '..' in the path. * * @returns K_TRUE if '..' component found, K_FALSE if not. * @param pszPath The path. * @param cchPath The length of the path. */ static KBOOL kFsCacheHasDotDotA(const char *pszPath, KSIZE cchPath) { const char *pchDot = (const char *)kHlpMemChr(pszPath, '.', cchPath); while (pchDot) { if (pchDot[1] != '.') { pchDot++; pchDot = (const char *)kHlpMemChr(pchDot, '.', &pszPath[cchPath] - pchDot); } else { char ch; if ( (ch = pchDot[2]) != '\0' && IS_SLASH(ch)) { if (pchDot == pszPath) return K_TRUE; ch = pchDot[-1]; if ( IS_SLASH(ch) || ch == ':') return K_TRUE; } pchDot = (const char *)kHlpMemChr(pchDot + 2, '.', &pszPath[cchPath] - pchDot - 2); } } return K_FALSE; } /** * Looks for '..' in the path. * * @returns K_TRUE if '..' component found, K_FALSE if not. * @param pwszPath The path. * @param cwcPath The length of the path (in wchar_t's). */ static KBOOL kFsCacheHasDotDotW(const wchar_t *pwszPath, KSIZE cwcPath) { const wchar_t *pwcDot = wmemchr(pwszPath, '.', cwcPath); while (pwcDot) { if (pwcDot[1] != '.') { pwcDot++; pwcDot = wmemchr(pwcDot, '.', &pwszPath[cwcPath] - pwcDot); } else { wchar_t wch; if ( (wch = pwcDot[2]) != '\0' && IS_SLASH(wch)) { if (pwcDot == pwszPath) return K_TRUE; wch = pwcDot[-1]; if ( IS_SLASH(wch) || wch == ':') return K_TRUE; } pwcDot = wmemchr(pwcDot + 2, '.', &pwszPath[cwcPath] - pwcDot - 2); } } return K_FALSE; } /** * Creates an ANSI hash table entry for the given path. * * @returns The hash table entry or NULL if out of memory. * @param pCache The hash * @param pFsObj The resulting object. * @param pszPath The path. * @param cchPath The length of the path. * @param uHashPath The hash of the path. * @param fAbsolute Whether it can be refreshed using an absolute * lookup or requires the slow treatment. * @parma idxMissingGen The missing generation index. * @param idxHashTab The hash table index of the path. * @param enmError The lookup error. */ static PKFSHASHA kFsCacheCreatePathHashTabEntryA(PKFSCACHE pCache, PKFSOBJ pFsObj, const char *pszPath, KU32 cchPath, KU32 uHashPath, KU32 idxHashTab, BOOL fAbsolute, KU32 idxMissingGen, KFSLOOKUPERROR enmError) { PKFSHASHA pHashEntry = (PKFSHASHA)kHlpAlloc(sizeof(*pHashEntry) + cchPath + 1); if (pHashEntry) { pHashEntry->uHashPath = uHashPath; pHashEntry->cchPath = (KU16)cchPath; pHashEntry->fAbsolute = fAbsolute; pHashEntry->idxMissingGen = (KU8)idxMissingGen; pHashEntry->enmError = enmError; pHashEntry->pszPath = (const char *)kHlpMemCopy(pHashEntry + 1, pszPath, cchPath + 1); if (pFsObj) { pHashEntry->pFsObj = kFsCacheObjRetainInternal(pFsObj); pHashEntry->uCacheGen = pFsObj->bObjType != KFSOBJ_TYPE_MISSING ? pCache->auGenerations[ pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerationsMissing[pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; pFsObj->cPathHashRefs += 1; // for debugging } else { pHashEntry->pFsObj = NULL; if (enmError != KFSLOOKUPERROR_UNSUPPORTED) pHashEntry->uCacheGen = pCache->auGenerationsMissing[idxMissingGen]; else pHashEntry->uCacheGen = KFSOBJ_CACHE_GEN_IGNORE; } pHashEntry->pNext = pCache->apAnsiPaths[idxHashTab]; pCache->apAnsiPaths[idxHashTab] = pHashEntry; pCache->cbAnsiPaths += sizeof(*pHashEntry) + cchPath + 1; pCache->cAnsiPaths++; if (pHashEntry->pNext) pCache->cAnsiPathCollisions++; } return pHashEntry; } /** * Creates an UTF-16 hash table entry for the given path. * * @returns The hash table entry or NULL if out of memory. * @param pCache The hash * @param pFsObj The resulting object. * @param pwszPath The path. * @param cwcPath The length of the path (in wchar_t's). * @param uHashPath The hash of the path. * @param fAbsolute Whether it can be refreshed using an absolute * lookup or requires the slow treatment. * @parma idxMissingGen The missing generation index. * @param idxHashTab The hash table index of the path. * @param enmError The lookup error. */ static PKFSHASHW kFsCacheCreatePathHashTabEntryW(PKFSCACHE pCache, PKFSOBJ pFsObj, const wchar_t *pwszPath, KU32 cwcPath, KU32 uHashPath, KU32 idxHashTab, BOOL fAbsolute, KU32 idxMissingGen, KFSLOOKUPERROR enmError) { PKFSHASHW pHashEntry = (PKFSHASHW)kHlpAlloc(sizeof(*pHashEntry) + (cwcPath + 1) * sizeof(wchar_t)); if (pHashEntry) { pHashEntry->uHashPath = uHashPath; pHashEntry->cwcPath = cwcPath; pHashEntry->fAbsolute = fAbsolute; pHashEntry->idxMissingGen = (KU8)idxMissingGen; pHashEntry->enmError = enmError; pHashEntry->pwszPath = (const wchar_t *)kHlpMemCopy(pHashEntry + 1, pwszPath, (cwcPath + 1) * sizeof(wchar_t)); if (pFsObj) { pHashEntry->pFsObj = kFsCacheObjRetainInternal(pFsObj); pHashEntry->uCacheGen = pFsObj->bObjType != KFSOBJ_TYPE_MISSING ? pCache->auGenerations[ pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerationsMissing[pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; pFsObj->cPathHashRefs += 1; // for debugging } else { pHashEntry->pFsObj = NULL; if (enmError != KFSLOOKUPERROR_UNSUPPORTED) pHashEntry->uCacheGen = pCache->auGenerationsMissing[idxMissingGen]; else pHashEntry->uCacheGen = KFSOBJ_CACHE_GEN_IGNORE; } pHashEntry->pNext = pCache->apUtf16Paths[idxHashTab]; pCache->apUtf16Paths[idxHashTab] = pHashEntry; pCache->cbUtf16Paths += sizeof(*pHashEntry) + (cwcPath + 1) * sizeof(wchar_t); pCache->cUtf16Paths++; if (pHashEntry->pNext) pCache->cAnsiPathCollisions++; } return pHashEntry; } /** * Links the child in under the parent. * * @returns K_TRUE on success, K_FALSE if out of memory. * @param pParent The parent node. * @param pChild The child node. */ static KBOOL kFsCacheDirAddChild(PKFSCACHE pCache, PKFSDIR pParent, PKFSOBJ pChild, KFSLOOKUPERROR *penmError) { if (pParent->cChildren >= pParent->cChildrenAllocated) { void *pvNew = kHlpRealloc(pParent->papChildren, (pParent->cChildrenAllocated + 16) * sizeof(pParent->papChildren[0])); if (!pvNew) return K_FALSE; pParent->papChildren = (PKFSOBJ *)pvNew; pParent->cChildrenAllocated += 16; pCache->cbObjects += 16 * sizeof(pParent->papChildren[0]); } pParent->papChildren[pParent->cChildren++] = kFsCacheObjRetainInternal(pChild); return K_TRUE; } /** * Creates a new cache object. * * @returns Pointer (with 1 reference) to the new object. The object will not * be linked to the parent directory yet. * * NULL if we're out of memory. * * @param pCache The cache. * @param pParent The parent directory. * @param pszName The ANSI name. * @param cchName The length of the ANSI name. * @param pwszName The UTF-16 name. * @param cwcName The length of the UTF-16 name. * @param pszShortName The ANSI short name, NULL if none. * @param cchShortName The length of the ANSI short name, 0 if none. * @param pwszShortName The UTF-16 short name, NULL if none. * @param cwcShortName The length of the UTF-16 short name, 0 if none. * @param bObjType The objct type. * @param penmError Where to explain failures. */ PKFSOBJ kFsCacheCreateObject(PKFSCACHE pCache, PKFSDIR pParent, char const *pszName, KU16 cchName, wchar_t const *pwszName, KU16 cwcName, #ifdef KFSCACHE_CFG_SHORT_NAMES char const *pszShortName, KU16 cchShortName, wchar_t const *pwszShortName, KU16 cwcShortName, #endif KU8 bObjType, KFSLOOKUPERROR *penmError) { /* * Allocate the object. */ KBOOL const fDirish = bObjType != KFSOBJ_TYPE_FILE && bObjType != KFSOBJ_TYPE_OTHER; KSIZE const cbObj = fDirish ? sizeof(KFSDIR) : sizeof(KFSOBJ); KSIZE const cbNames = (cwcName + 1) * sizeof(wchar_t) + cchName + 1 #ifdef KFSCACHE_CFG_SHORT_NAMES + (cwcShortName > 0 ? (cwcShortName + 1) * sizeof(wchar_t) + cchShortName + 1 : 0) #endif ; PKFSOBJ pObj; kHlpAssert(pCache->u32Magic == KFSCACHE_MAGIC); pObj = (PKFSOBJ)kHlpAlloc(cbObj + cbNames); if (pObj) { KU8 *pbExtra = (KU8 *)pObj + cbObj; KFSCACHE_LOCK(pCache); /** @todo reduce the amount of work done holding the lock */ pCache->cbObjects += cbObj + cbNames; pCache->cObjects++; /* * Initialize the object. */ pObj->u32Magic = KFSOBJ_MAGIC; pObj->cRefs = 1; pObj->uCacheGen = bObjType != KFSOBJ_TYPE_MISSING ? pCache->auGenerations[pParent->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerationsMissing[pParent->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; pObj->bObjType = bObjType; pObj->fHaveStats = K_FALSE; pObj->cPathHashRefs = 0; pObj->idxUserDataLock = KU8_MAX; pObj->fFlags = pParent->Obj.fFlags & KFSOBJ_F_INHERITED_MASK; pObj->pParent = pParent; pObj->uNameHash = 0; pObj->pNextNameHash = NULL; pObj->pNameAlloc = NULL; pObj->pUserDataHead = NULL; #ifdef KFSCACHE_CFG_UTF16 pObj->cwcParent = pParent->Obj.cwcParent + pParent->Obj.cwcName + !!pParent->Obj.cwcName; pObj->pwszName = (wchar_t *)kHlpMemCopy(pbExtra, pwszName, cwcName * sizeof(wchar_t)); pObj->cwcName = cwcName; pbExtra += cwcName * sizeof(wchar_t); *pbExtra++ = '\0'; *pbExtra++ = '\0'; # ifdef KFSCACHE_CFG_SHORT_NAMES pObj->cwcShortParent = pParent->Obj.cwcShortParent + pParent->Obj.cwcShortName + !!pParent->Obj.cwcShortName; if (cwcShortName) { pObj->pwszShortName = (wchar_t *)kHlpMemCopy(pbExtra, pwszShortName, cwcShortName * sizeof(wchar_t)); pObj->cwcShortName = cwcShortName; pbExtra += cwcShortName * sizeof(wchar_t); *pbExtra++ = '\0'; *pbExtra++ = '\0'; } else { pObj->pwszShortName = pObj->pwszName; pObj->cwcShortName = cwcName; } # endif #endif pObj->cchParent = pParent->Obj.cchParent + pParent->Obj.cchName + !!pParent->Obj.cchName; pObj->pszName = (char *)kHlpMemCopy(pbExtra, pszName, cchName); pObj->cchName = cchName; pbExtra += cchName; *pbExtra++ = '\0'; # ifdef KFSCACHE_CFG_SHORT_NAMES pObj->cchShortParent = pParent->Obj.cchShortParent + pParent->Obj.cchShortName + !!pParent->Obj.cchShortName; if (cchShortName) { pObj->pszShortName = (char *)kHlpMemCopy(pbExtra, pszShortName, cchShortName); pObj->cchShortName = cchShortName; pbExtra += cchShortName; *pbExtra++ = '\0'; } else { pObj->pszShortName = pObj->pszName; pObj->cchShortName = cchName; } #endif kHlpAssert(pbExtra - (KU8 *)pObj == cbObj); /* * Type specific initialization. */ if (fDirish) { PKFSDIR pDirObj = (PKFSDIR)pObj; pDirObj->cChildren = 0; pDirObj->cChildrenAllocated = 0; pDirObj->papChildren = NULL; pDirObj->fHashTabMask = 0; pDirObj->papHashTab = NULL; pDirObj->hDir = INVALID_HANDLE_VALUE; pDirObj->uDevNo = pParent->uDevNo; pDirObj->iLastWrite = 0; pDirObj->iLastPopulated = 0; pDirObj->fPopulated = K_FALSE; } KFSCACHE_UNLOCK(pCache); } else *penmError = KFSLOOKUPERROR_OUT_OF_MEMORY; return pObj; } /** * Creates a new object given wide char names. * * This function just converts the paths and calls kFsCacheCreateObject. * * * @returns Pointer (with 1 reference) to the new object. The object will not * be linked to the parent directory yet. * * NULL if we're out of memory. * * @param pCache The cache. * @param pParent The parent directory. * @param pszName The ANSI name. * @param cchName The length of the ANSI name. * @param pwszName The UTF-16 name. * @param cwcName The length of the UTF-16 name. * @param pwszShortName The UTF-16 short name, NULL if none. * @param cwcShortName The length of the UTF-16 short name, 0 if none. * @param bObjType The objct type. * @param penmError Where to explain failures. */ PKFSOBJ kFsCacheCreateObjectW(PKFSCACHE pCache, PKFSDIR pParent, wchar_t const *pwszName, KU32 cwcName, #ifdef KFSCACHE_CFG_SHORT_NAMES wchar_t const *pwszShortName, KU32 cwcShortName, #endif KU8 bObjType, KFSLOOKUPERROR *penmError) { /* Convert names to ANSI first so we know their lengths. */ char szName[KFSCACHE_CFG_MAX_ANSI_NAME]; int cchName = WideCharToMultiByte(CP_ACP, 0, pwszName, cwcName, szName, sizeof(szName) - 1, NULL, NULL); if (cchName >= 0) { #ifdef KFSCACHE_CFG_SHORT_NAMES char szShortName[12*3 + 1]; int cchShortName = 0; if ( cwcShortName == 0 || (cchShortName = WideCharToMultiByte(CP_ACP, 0, pwszShortName, cwcShortName, szShortName, sizeof(szShortName) - 1, NULL, NULL)) > 0) #endif { /* No locking needed here, kFsCacheCreateObject takes care of that. */ return kFsCacheCreateObject(pCache, pParent, szName, cchName, pwszName, cwcName, #ifdef KFSCACHE_CFG_SHORT_NAMES szShortName, cchShortName, pwszShortName, cwcShortName, #endif bObjType, penmError); } } *penmError = KFSLOOKUPERROR_ANSI_CONVERSION_ERROR; return NULL; } /** * Creates a missing object. * * This is used for caching negative results. * * @returns Pointer to the newly created object on success (already linked into * pParent). No reference. * * NULL on failure. * * @param pCache The cache. * @param pParent The parent directory. * @param pchName The name. * @param cchName The length of the name. * @param penmError Where to return failure explanations. */ static PKFSOBJ kFsCacheCreateMissingA(PKFSCACHE pCache, PKFSDIR pParent, const char *pchName, KU32 cchName, KFSLOOKUPERROR *penmError) { /* * Just convert the name to UTF-16 and call kFsCacheCreateObject to do the job. */ wchar_t wszName[KFSCACHE_CFG_MAX_PATH]; int cwcName = MultiByteToWideChar(CP_ACP, 0, pchName, cchName, wszName, KFSCACHE_CFG_MAX_UTF16_NAME - 1); if (cwcName > 0) { /** @todo check that it actually doesn't exists before we add it. We should not * trust the directory enumeration here, or maybe we should?? */ PKFSOBJ pMissing = kFsCacheCreateObject(pCache, pParent, pchName, cchName, wszName, cwcName, #ifdef KFSCACHE_CFG_SHORT_NAMES NULL, 0, NULL, 0, #endif KFSOBJ_TYPE_MISSING, penmError); if (pMissing) { KBOOL fRc = kFsCacheDirAddChild(pCache, pParent, pMissing, penmError); kFsCacheObjRelease(pCache, pMissing); return fRc ? pMissing : NULL; } return NULL; } *penmError = KFSLOOKUPERROR_UTF16_CONVERSION_ERROR; return NULL; } /** * Creates a missing object, UTF-16 version. * * This is used for caching negative results. * * @returns Pointer to the newly created object on success (already linked into * pParent). No reference. * * NULL on failure. * * @param pCache The cache. * @param pParent The parent directory. * @param pwcName The name. * @param cwcName The length of the name. * @param penmError Where to return failure explanations. */ static PKFSOBJ kFsCacheCreateMissingW(PKFSCACHE pCache, PKFSDIR pParent, const wchar_t *pwcName, KU32 cwcName, KFSLOOKUPERROR *penmError) { /** @todo check that it actually doesn't exists before we add it. We should not * trust the directory enumeration here, or maybe we should?? */ PKFSOBJ pMissing = kFsCacheCreateObjectW(pCache, pParent, pwcName, cwcName, #ifdef KFSCACHE_CFG_SHORT_NAMES NULL, 0, #endif KFSOBJ_TYPE_MISSING, penmError); if (pMissing) { KBOOL fRc = kFsCacheDirAddChild(pCache, pParent, pMissing, penmError); kFsCacheObjRelease(pCache, pMissing); return fRc ? pMissing : NULL; } return NULL; } /** * Does the growing of names. * * @returns pCur * @param pCache The cache. * @param pCur The object. * @param pchName The name (not necessarily terminated). * @param cchName Name length. * @param pwcName The UTF-16 name (not necessarily terminated). * @param cwcName The length of the UTF-16 name in wchar_t's. * @param pchShortName The short name. * @param cchShortName The length of the short name. This is 0 if no short * name. * @param pwcShortName The short UTF-16 name. * @param cwcShortName The length of the short UTF-16 name. This is 0 if * no short name. */ static PKFSOBJ kFsCacheRefreshGrowNames(PKFSCACHE pCache, PKFSOBJ pCur, const char *pchName, KU32 cchName, wchar_t const *pwcName, KU32 cwcName #ifdef KFSCACHE_CFG_SHORT_NAMES , const char *pchShortName, KU32 cchShortName, wchar_t const *pwcShortName, KU32 cwcShortName #endif ) { PKFSOBJNAMEALLOC pNameAlloc; char *pch; KU32 cbNeeded; pCache->cNameGrowths++; /* * Figure out our requirements. */ cbNeeded = sizeof(KU32) + cchName + 1; #ifdef KFSCACHE_CFG_UTF16 cbNeeded += (cwcName + 1) * sizeof(wchar_t); #endif #ifdef KFSCACHE_CFG_SHORT_NAMES cbNeeded += cchShortName + !!cchShortName; # ifdef KFSCACHE_CFG_UTF16 cbNeeded += (cwcShortName + !!cwcShortName) * sizeof(wchar_t); # endif #endif cbNeeded = K_ALIGN_Z(cbNeeded, 8); /* Memory will likely be 8 or 16 byte aligned, so we might just claim it. */ /* * Allocate memory. */ pNameAlloc = pCur->pNameAlloc; if (!pNameAlloc) { pNameAlloc = (PKFSOBJNAMEALLOC)kHlpAlloc(cbNeeded); if (!pNameAlloc) return pCur; pCache->cbObjects += cbNeeded; pCur->pNameAlloc = pNameAlloc; pNameAlloc->cb = cbNeeded; } else if (pNameAlloc->cb < cbNeeded) { pNameAlloc = (PKFSOBJNAMEALLOC)kHlpRealloc(pNameAlloc, cbNeeded); if (!pNameAlloc) return pCur; pCache->cbObjects += cbNeeded - pNameAlloc->cb; pCur->pNameAlloc = pNameAlloc; pNameAlloc->cb = cbNeeded; } /* * Copy out the new names, starting with the wide char ones to avoid misaligning them. */ pch = &pNameAlloc->abSpace[0]; #ifdef KFSCACHE_CFG_UTF16 pCur->pwszName = (wchar_t *)pch; pCur->cwcName = cwcName; pch = kHlpMemPCopy(pch, pwcName, cwcName * sizeof(wchar_t)); *pch++ = '\0'; *pch++ = '\0'; # ifdef KFSCACHE_CFG_SHORT_NAMES if (cwcShortName == 0) { pCur->pwszShortName = pCur->pwszName; pCur->cwcShortName = pCur->cwcName; } else { pCur->pwszShortName = (wchar_t *)pch; pCur->cwcShortName = cwcShortName; pch = kHlpMemPCopy(pch, pwcShortName, cwcShortName * sizeof(wchar_t)); *pch++ = '\0'; *pch++ = '\0'; } # endif #endif pCur->pszName = pch; pCur->cchName = cchName; pch = kHlpMemPCopy(pch, pchName, cchName); *pch++ = '\0'; #ifdef KFSCACHE_CFG_SHORT_NAMES if (cchShortName == 0) { pCur->pszShortName = pCur->pszName; pCur->cchShortName = pCur->cchName; } else { pCur->pszShortName = pch; pCur->cchShortName = cchShortName; pch = kHlpMemPCopy(pch, pchShortName, cchShortName); *pch++ = '\0'; } #endif return pCur; } /** * Worker for kFsCacheDirFindOldChild that refreshes the file ID value on an * object found by name. * * @returns pCur. * @param pDirRePop Repopulation data. * @param pCur The object to check the names of. * @param idFile The file ID. */ static PKFSOBJ kFsCacheDirRefreshOldChildFileId(PKFSDIRREPOP pDirRePop, PKFSOBJ pCur, KI64 idFile) { KFSCACHE_LOG(("Refreshing %s/%s/ - %s changed file ID from %#llx -> %#llx...\n", pCur->pParent->Obj.pParent->Obj.pszName, pCur->pParent->Obj.pszName, pCur->pszName, pCur->Stats.st_ino, idFile)); pCur->Stats.st_ino = idFile; /** @todo inform user data items... */ return pCur; } /** * Worker for kFsCacheDirFindOldChild that checks the names after an old object * has been found the file ID. * * @returns pCur. * @param pDirRePop Repopulation data. * @param pCur The object to check the names of. * @param pwcName The file name. * @param cwcName The length of the filename (in wchar_t's). * @param pwcShortName The short name, if present. * @param cwcShortName The length of the short name (in wchar_t's). */ static PKFSOBJ kFsCacheDirRefreshOldChildName(PKFSDIRREPOP pDirRePop, PKFSOBJ pCur, wchar_t const *pwcName, KU32 cwcName #ifdef KFSCACHE_CFG_SHORT_NAMES , wchar_t const *pwcShortName, KU32 cwcShortName #endif ) { char szName[KFSCACHE_CFG_MAX_ANSI_NAME]; int cchName; pDirRePop->pCache->cNameChanges++; /* * Convert the names to ANSI first, that way we know all the lengths. */ cchName = WideCharToMultiByte(CP_ACP, 0, pwcName, cwcName, szName, sizeof(szName) - 1, NULL, NULL); if (cchName >= 0) { #ifdef KFSCACHE_CFG_SHORT_NAMES char szShortName[12*3 + 1]; int cchShortName = 0; if ( cwcShortName == 0 || (cchShortName = WideCharToMultiByte(CP_ACP, 0, pwcShortName, cwcShortName, szShortName, sizeof(szShortName) - 1, NULL, NULL)) > 0) #endif { /* * Shortening is easy for non-directory objects, for * directory object we're only good when the length doesn't change * on any of the components (cchParent et al). * * This deals with your typical xxxx.ext.tmp -> xxxx.ext renames. */ if ( cchName <= pCur->cchName #ifdef KFSCACHE_CFG_UTF16 && cwcName <= pCur->cwcName #endif #ifdef KFSCACHE_CFG_SHORT_NAMES && ( cchShortName == 0 || ( cchShortName <= pCur->cchShortName && pCur->pszShortName != pCur->pszName # ifdef KFSCACHE_CFG_UTF16 && cwcShortName <= pCur->cwcShortName && pCur->pwszShortName != pCur->pwszName # endif ) ) #endif ) { if ( pCur->bObjType != KFSOBJ_TYPE_DIR || ( cchName == pCur->cchName #ifdef KFSCACHE_CFG_UTF16 && cwcName == pCur->cwcName #endif #ifdef KFSCACHE_CFG_SHORT_NAMES && ( cchShortName == 0 || ( cchShortName == pCur->cchShortName # ifdef KFSCACHE_CFG_UTF16 && cwcShortName == pCur->cwcShortName ) # endif ) #endif ) ) { KFSCACHE_LOG(("Refreshing %ls - name changed to '%*.*ls'\n", pCur->pwszName, cwcName, cwcName, pwcName)); *(char *)kHlpMemPCopy((void *)pCur->pszName, szName, cchName) = '\0'; pCur->cchName = cchName; #ifdef KFSCACHE_CFG_UTF16 *(wchar_t *)kHlpMemPCopy((void *)pCur->pwszName, pwcName, cwcName * sizeof(wchar_t)) = '\0'; pCur->cwcName = cwcName; #endif #ifdef KFSCACHE_CFG_SHORT_NAMES *(char *)kHlpMemPCopy((void *)pCur->pszShortName, szShortName, cchShortName) = '\0'; pCur->cchShortName = cchShortName; # ifdef KFSCACHE_CFG_UTF16 *(wchar_t *)kHlpMemPCopy((void *)pCur->pwszShortName, pwcShortName, cwcShortName * sizeof(wchar_t)) = '\0'; pCur->cwcShortName = cwcShortName; # endif #endif return pCur; } } return kFsCacheRefreshGrowNames(pDirRePop->pCache, pCur, szName, cchName, pwcName, cwcName, #ifdef KFSCACHE_CFG_SHORT_NAMES szShortName, cchShortName, pwcShortName, cwcShortName #endif ); } } fprintf(stderr, "kFsCacheDirRefreshOldChildName: WideCharToMultiByte error\n"); return pCur; } /** * Worker for kFsCacheDirFindOldChild that checks the names after an old object * has been found by the file ID. * * @returns pCur. * @param pDirRePop Repopulation data. * @param pCur The object to check the names of. * @param pwcName The file name. * @param cwcName The length of the filename (in wchar_t's). * @param pwcShortName The short name, if present. * @param cwcShortName The length of the short name (in wchar_t's). */ K_INLINE PKFSOBJ kFsCacheDirCheckOldChildName(PKFSDIRREPOP pDirRePop, PKFSOBJ pCur, wchar_t const *pwcName, KU32 cwcName #ifdef KFSCACHE_CFG_SHORT_NAMES , wchar_t const *pwcShortName, KU32 cwcShortName #endif ) { if ( pCur->cwcName == cwcName && kHlpMemComp(pCur->pwszName, pwcName, cwcName * sizeof(wchar_t)) == 0) { #ifdef KFSCACHE_CFG_SHORT_NAMES if (cwcShortName == 0 ? pCur->pwszShortName == pCur->pwszName || ( pCur->cwcShortName == cwcName && kHlpMemComp(pCur->pwszShortName, pCur->pwszName, cwcName * sizeof(wchar_t)) == 0) : pCur->cwcShortName == cwcShortName && kHlpMemComp(pCur->pwszShortName, pwcShortName, cwcShortName * sizeof(wchar_t)) == 0 ) #endif { return pCur; } } #ifdef KFSCACHE_CFG_SHORT_NAMES return kFsCacheDirRefreshOldChildName(pDirRePop, pCur, pwcName, cwcName, pwcShortName, cwcShortName); #else return kFsCacheDirRefreshOldChildName(pDirRePop, pCur, pwcName, cwcName); #endif } /** * Worker for kFsCachePopuplateOrRefreshDir that locates an old child object * while re-populating a directory. * * @returns Pointer to the existing object if found, NULL if not. * @param pDirRePop Repopulation data. * @param idFile The file ID, 0 if none. * @param pwcName The file name. * @param cwcName The length of the filename (in wchar_t's). * @param pwcShortName The short name, if present. * @param cwcShortName The length of the short name (in wchar_t's). */ static PKFSOBJ kFsCacheDirFindOldChildSlow(PKFSDIRREPOP pDirRePop, KI64 idFile, wchar_t const *pwcName, KU32 cwcName #ifdef KFSCACHE_CFG_SHORT_NAMES , wchar_t const *pwcShortName, KU32 cwcShortName #endif ) { KU32 cOldChildren = pDirRePop->cOldChildren; KU32 const iNextOldChild = K_MIN(pDirRePop->iNextOldChild, cOldChildren - 1); KU32 iCur; KI32 cInc; KI32 cDirLefts; kHlpAssertReturn(cOldChildren > 0, NULL); /* * Search by file ID first, if we've got one. * ASSUMES that KU32 wraps around when -1 is added to 0. */ if ( idFile != 0 && idFile != KI64_MAX && idFile != KI64_MIN) { cInc = pDirRePop->cNextOldChildInc; kHlpAssert(cInc == -1 || cInc == 1); for (cDirLefts = 2; cDirLefts > 0; cDirLefts--) { for (iCur = iNextOldChild; iCur < cOldChildren; iCur += cInc) { PKFSOBJ pCur = pDirRePop->papOldChildren[iCur]; if (pCur->Stats.st_ino == idFile) { /* Remove it and check the name. */ pDirRePop->cOldChildren = --cOldChildren; if (iCur < cOldChildren) pDirRePop->papOldChildren[iCur] = pDirRePop->papOldChildren[cOldChildren]; else cInc = -1; pDirRePop->cNextOldChildInc = cInc; pDirRePop->iNextOldChild = iCur + cInc; #ifdef KFSCACHE_CFG_SHORT_NAMES return kFsCacheDirCheckOldChildName(pDirRePop, pCur, pwcName, cwcName, pwcShortName, cwcShortName); #else return kFsCacheDirCheckOldChildName(pDirRePop, pCur, pwcName, cwcName, pwcShortName, cwcShortName); #endif } } cInc = -cInc; } } /* * Search by name. * ASSUMES that KU32 wraps around when -1 is added to 0. */ cInc = pDirRePop->cNextOldChildInc; kHlpAssert(cInc == -1 || cInc == 1); for (cDirLefts = 2; cDirLefts > 0; cDirLefts--) { for (iCur = iNextOldChild; iCur < cOldChildren; iCur += cInc) { PKFSOBJ pCur = pDirRePop->papOldChildren[iCur]; if ( ( pCur->cwcName == cwcName && kFsCacheIAreEqualW(pCur->pwszName, pwcName, cwcName)) #ifdef KFSCACHE_CFG_SHORT_NAMES || ( pCur->cwcShortName == cwcName && pCur->pwszShortName != pCur->pwszName && kFsCacheIAreEqualW(pCur->pwszShortName, pwcName, cwcName)) #endif ) { /* Do this first so the compiler can share the rest with the above file ID return. */ if (pCur->Stats.st_ino == idFile) { /* likely */ } else pCur = kFsCacheDirRefreshOldChildFileId(pDirRePop, pCur, idFile); /* Remove it and check the name. */ pDirRePop->cOldChildren = --cOldChildren; if (iCur < cOldChildren) pDirRePop->papOldChildren[iCur] = pDirRePop->papOldChildren[cOldChildren]; else cInc = -1; pDirRePop->cNextOldChildInc = cInc; pDirRePop->iNextOldChild = iCur + cInc; #ifdef KFSCACHE_CFG_SHORT_NAMES return kFsCacheDirCheckOldChildName(pDirRePop, pCur, pwcName, cwcName, pwcShortName, cwcShortName); #else return kFsCacheDirCheckOldChildName(pDirRePop, pCur, pwcName, cwcName, pwcShortName, cwcShortName); #endif } } cInc = -cInc; } return NULL; } /** * Worker for kFsCachePopuplateOrRefreshDir that locates an old child object * while re-populating a directory. * * @returns Pointer to the existing object if found, NULL if not. * @param pDirRePop Repopulation data. * @param idFile The file ID, 0 if none. * @param pwcName The file name. * @param cwcName The length of the filename (in wchar_t's). * @param pwcShortName The short name, if present. * @param cwcShortName The length of the short name (in wchar_t's). */ K_INLINE PKFSOBJ kFsCacheDirFindOldChild(PKFSDIRREPOP pDirRePop, KI64 idFile, wchar_t const *pwcName, KU32 cwcName #ifdef KFSCACHE_CFG_SHORT_NAMES , wchar_t const *pwcShortName, KU32 cwcShortName #endif ) { /* * We only check the iNextOldChild element here, hoping that the compiler * will actually inline this code, letting the slow version of the function * do the rest. */ KU32 cOldChildren = pDirRePop->cOldChildren; if (cOldChildren > 0) { KU32 const iNextOldChild = K_MIN(pDirRePop->iNextOldChild, cOldChildren - 1); PKFSOBJ pCur = pDirRePop->papOldChildren[iNextOldChild]; if ( pCur->Stats.st_ino == idFile && idFile != 0 && idFile != KI64_MAX && idFile != KI64_MIN) pCur = kFsCacheDirCheckOldChildName(pDirRePop, pCur, pwcName, cwcName, pwcShortName, cwcShortName); else if ( pCur->cwcName == cwcName && kHlpMemComp(pCur->pwszName, pwcName, cwcName * sizeof(wchar_t)) == 0) { if (pCur->Stats.st_ino == idFile) { /* likely */ } else pCur = kFsCacheDirRefreshOldChildFileId(pDirRePop, pCur, idFile); #ifdef KFSCACHE_CFG_SHORT_NAMES if (cwcShortName == 0 ? pCur->pwszShortName == pCur->pwszName || ( pCur->cwcShortName == cwcName && kHlpMemComp(pCur->pwszShortName, pCur->pwszName, cwcName * sizeof(wchar_t)) == 0) : pCur->cwcShortName == cwcShortName && kHlpMemComp(pCur->pwszShortName, pwcShortName, cwcShortName * sizeof(wchar_t)) == 0 ) { /* likely */ } else pCur = kFsCacheDirRefreshOldChildName(pDirRePop, pCur, pwcName, cwcName, pwcShortName, cwcShortName); #endif } else pCur = NULL; if (pCur) { /* * Got a match. Remove the child from the array, replacing it with * the last element. (This means we're reversing the second half of * the elements, which is why we need cNextOldChildInc.) */ pDirRePop->cOldChildren = --cOldChildren; if (iNextOldChild < cOldChildren) pDirRePop->papOldChildren[iNextOldChild] = pDirRePop->papOldChildren[cOldChildren]; pDirRePop->iNextOldChild = iNextOldChild + pDirRePop->cNextOldChildInc; return pCur; } #ifdef KFSCACHE_CFG_SHORT_NAMES return kFsCacheDirFindOldChildSlow(pDirRePop, idFile, pwcName, cwcName, pwcShortName, cwcShortName); #else return kFsCacheDirFindOldChildSlow(pDirRePop, idFile, pwcName, cwcName); #endif } return NULL; } /** * Does the initial directory populating or refreshes it if it has been * invalidated. * * This assumes the parent directory is opened. * * @returns K_TRUE on success, K_FALSE on error. * @param pCache The cache. * @param pDir The directory. * @param penmError Where to store K_FALSE explanation. */ static KBOOL kFsCachePopuplateOrRefreshDir(PKFSCACHE pCache, PKFSDIR pDir, KFSLOOKUPERROR *penmError) { KBOOL fRefreshing = K_FALSE; KFSDIRREPOP DirRePop = { NULL, 0, 0, 0, NULL }; MY_UNICODE_STRING UniStrStar = { 1 * sizeof(wchar_t), 2 * sizeof(wchar_t), L"*" }; FILETIME Now; /** @todo May have to make this more flexible wrt information classes since * older windows versions (XP, w2K) might not correctly support the * ones with file ID on all file systems. */ #ifdef KFSCACHE_CFG_SHORT_NAMES MY_FILE_INFORMATION_CLASS const enmInfoClassWithId = MyFileIdBothDirectoryInformation; MY_FILE_INFORMATION_CLASS enmInfoClass = MyFileIdBothDirectoryInformation; #else MY_FILE_INFORMATION_CLASS const enmInfoClassWithId = MyFileIdFullDirectoryInformation; MY_FILE_INFORMATION_CLASS enmInfoClass = MyFileIdFullDirectoryInformation; #endif MY_NTSTATUS rcNt; MY_IO_STATUS_BLOCK Ios; union { /* Include the structures for better alignment. */ MY_FILE_ID_BOTH_DIR_INFORMATION WithId; MY_FILE_ID_FULL_DIR_INFORMATION NoId; /** Buffer padding. We're using a 56KB buffer here to avoid size troubles * with CIFS and such that starts at 64KB. */ KU8 abBuf[56*1024]; } uBuf; /* * Open the directory. */ if (pDir->hDir == INVALID_HANDLE_VALUE) { MY_OBJECT_ATTRIBUTES ObjAttr; MY_UNICODE_STRING UniStr; kHlpAssert(!pDir->fPopulated); Ios.Information = -1; Ios.u.Status = -1; UniStr.Buffer = (wchar_t *)pDir->Obj.pwszName; UniStr.Length = (USHORT)(pDir->Obj.cwcName * sizeof(wchar_t)); UniStr.MaximumLength = UniStr.Length + sizeof(wchar_t); kHlpAssertStmtReturn(pDir->Obj.pParent, *penmError = KFSLOOKUPERROR_INTERNAL_ERROR, K_FALSE); kHlpAssertStmtReturn(pDir->Obj.pParent->hDir != INVALID_HANDLE_VALUE, *penmError = KFSLOOKUPERROR_INTERNAL_ERROR, K_FALSE); MyInitializeObjectAttributes(&ObjAttr, &UniStr, OBJ_CASE_INSENSITIVE, pDir->Obj.pParent->hDir, NULL /*pSecAttr*/); /** @todo FILE_OPEN_REPARSE_POINT? */ rcNt = g_pfnNtCreateFile(&pDir->hDir, FILE_READ_DATA | FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES | SYNCHRONIZE, &ObjAttr, &Ios, NULL, /*cbFileInitialAlloc */ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, NULL, /*pEaBuffer*/ 0); /*cbEaBuffer*/ if (MY_NT_SUCCESS(rcNt)) { /* likely */ } else { pDir->hDir = INVALID_HANDLE_VALUE; *penmError = KFSLOOKUPERROR_DIR_OPEN_ERROR; return K_FALSE; } } /* * When re-populating, we replace papChildren in the directory and pick * from the old one as we go along. */ else if (pDir->fPopulated) { KU32 cAllocated; void *pvNew; /* Make sure we really need to do this first. */ if (!pDir->fNeedRePopulating) { if ( pDir->Obj.uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pDir->Obj.uCacheGen == pCache->auGenerations[pDir->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN]) return K_TRUE; if ( kFsCacheRefreshObj(pCache, &pDir->Obj, penmError) && !pDir->fNeedRePopulating) return K_TRUE; } /* Yes we do need to. */ cAllocated = K_ALIGN_Z(pDir->cChildren, 16); pvNew = kHlpAlloc(sizeof(pDir->papChildren[0]) * cAllocated); if (pvNew) { DirRePop.papOldChildren = pDir->papChildren; DirRePop.cOldChildren = pDir->cChildren; DirRePop.iNextOldChild = 0; DirRePop.cNextOldChildInc = 1; DirRePop.pCache = pCache; pDir->cChildren = 0; pDir->cChildrenAllocated = cAllocated; pDir->papChildren = (PKFSOBJ *)pvNew; } else { *penmError = KFSLOOKUPERROR_OUT_OF_MEMORY; return K_FALSE; } fRefreshing = K_TRUE; } if (!fRefreshing) KFSCACHE_LOG(("Populating %s...\n", pDir->Obj.pszName)); else KFSCACHE_LOG(("Refreshing %s...\n", pDir->Obj.pszName)); /* * Enumerate the directory content. * * Note! The "*" filter is necessary because kFsCacheRefreshObj may have * previously quried a single file name and just passing NULL would * restart that single file name query. */ GetSystemTimeAsFileTime(&Now); pDir->iLastPopulated = ((KI64)Now.dwHighDateTime << 32) | Now.dwLowDateTime; Ios.Information = -1; Ios.u.Status = -1; rcNt = g_pfnNtQueryDirectoryFile(pDir->hDir, NULL, /* hEvent */ NULL, /* pfnApcComplete */ NULL, /* pvApcCompleteCtx */ &Ios, &uBuf, sizeof(uBuf), enmInfoClass, FALSE, /* fReturnSingleEntry */ &UniStrStar, /* Filter / restart pos. */ TRUE); /* fRestartScan */ while (MY_NT_SUCCESS(rcNt)) { /* * Process the entries in the buffer. */ KSIZE offBuf = 0; for (;;) { union { KU8 *pb; #ifdef KFSCACHE_CFG_SHORT_NAMES MY_FILE_ID_BOTH_DIR_INFORMATION *pWithId; MY_FILE_BOTH_DIR_INFORMATION *pNoId; #else MY_FILE_ID_FULL_DIR_INFORMATION *pWithId; MY_FILE_FULL_DIR_INFORMATION *pNoId; #endif } uPtr; PKFSOBJ pCur; KU32 offNext; KU32 cbMinCur; wchar_t *pwchFilename; /* ASSUME only the FileName member differs between the two structures. */ uPtr.pb = &uBuf.abBuf[offBuf]; if (enmInfoClass == enmInfoClassWithId) { pwchFilename = &uPtr.pWithId->FileName[0]; cbMinCur = (KU32)((uintptr_t)&uPtr.pWithId->FileName[0] - (uintptr_t)uPtr.pWithId); cbMinCur += uPtr.pNoId->FileNameLength; } else { pwchFilename = &uPtr.pNoId->FileName[0]; cbMinCur = (KU32)((uintptr_t)&uPtr.pNoId->FileName[0] - (uintptr_t)uPtr.pNoId); cbMinCur += uPtr.pNoId->FileNameLength; } /* We need to skip the '.' and '..' entries. */ if ( *pwchFilename != '.' || uPtr.pNoId->FileNameLength > 4 || !( uPtr.pNoId->FileNameLength == 2 || ( uPtr.pNoId->FileNameLength == 4 && pwchFilename[1] == '.') ) ) { KBOOL fRc; KU8 const bObjType = uPtr.pNoId->FileAttributes & FILE_ATTRIBUTE_DIRECTORY ? KFSOBJ_TYPE_DIR : uPtr.pNoId->FileAttributes & (FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_REPARSE_POINT) ? KFSOBJ_TYPE_OTHER : KFSOBJ_TYPE_FILE; /* * If refreshing, we must first see if this directory entry already * exists. */ if (!fRefreshing) pCur = NULL; else { pCur = kFsCacheDirFindOldChild(&DirRePop, enmInfoClass == enmInfoClassWithId ? uPtr.pWithId->FileId.QuadPart : 0, pwchFilename, uPtr.pWithId->FileNameLength / sizeof(wchar_t) #ifdef KFSCACHE_CFG_SHORT_NAMES , uPtr.pWithId->ShortName, uPtr.pWithId->ShortNameLength / sizeof(wchar_t) #endif ); if (pCur) { if (pCur->bObjType == bObjType) { if (pCur->bObjType == KFSOBJ_TYPE_DIR) { PKFSDIR pCurDir = (PKFSDIR)pCur; if ( !pCurDir->fPopulated || ( pCurDir->iLastWrite == uPtr.pWithId->LastWriteTime.QuadPart && (pCur->fFlags & KFSOBJ_F_WORKING_DIR_MTIME) && pCurDir->iLastPopulated - pCurDir->iLastWrite >= KFSCACHE_MIN_LAST_POPULATED_VS_WRITE )) { /* kind of likely */ } else { KFSCACHE_LOG(("Refreshing %s/%s/ - %s/ needs re-populating...\n", pDir->Obj.pParent->Obj.pszName, pDir->Obj.pszName, pCur->pszName)); pCurDir->fNeedRePopulating = K_TRUE; } } if (pCur->uCacheGen != KFSOBJ_CACHE_GEN_IGNORE) pCur->uCacheGen = pCache->auGenerations[pCur->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; } else if (pCur->bObjType == KFSOBJ_TYPE_MISSING) { KFSCACHE_LOG(("Refreshing %s/%s/ - %s appeared as %u, was missing.\n", pDir->Obj.pParent->Obj.pszName, pDir->Obj.pszName, pCur->pszName, bObjType)); pCur->bObjType = bObjType; if (pCur->uCacheGen != KFSOBJ_CACHE_GEN_IGNORE) pCur->uCacheGen = pCache->auGenerations[pCur->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; } else { KFSCACHE_LOG(("Refreshing %s/%s/ - %s changed type from %u to %u! Dropping old object.\n", pDir->Obj.pParent->Obj.pszName, pDir->Obj.pszName, pCur->pszName, pCur->bObjType, bObjType)); kFsCacheObjRelease(pCache, pCur); pCur = NULL; } } else KFSCACHE_LOG(("Refreshing %s/%s/ - %*.*ls added.\n", pDir->Obj.pParent->Obj.pszName, pDir->Obj.pszName, uPtr.pNoId->FileNameLength / sizeof(wchar_t), uPtr.pNoId->FileNameLength / sizeof(wchar_t), pwchFilename)); } if (!pCur) { /* * Create the entry (not linked yet). */ pCur = kFsCacheCreateObjectW(pCache, pDir, pwchFilename, uPtr.pNoId->FileNameLength / sizeof(wchar_t), #ifdef KFSCACHE_CFG_SHORT_NAMES uPtr.pNoId->ShortName, uPtr.pNoId->ShortNameLength / sizeof(wchar_t), #endif bObjType, penmError); if (!pCur) return K_FALSE; kHlpAssert(pCur->cRefs == 1); } #ifdef KFSCACHE_CFG_SHORT_NAMES if (enmInfoClass == enmInfoClassWithId) birdStatFillFromFileIdBothDirInfo(&pCur->Stats, uPtr.pWithId); else birdStatFillFromFileBothDirInfo(&pCur->Stats, uPtr.pNoId); #else if (enmInfoClass == enmInfoClassWithId) birdStatFillFromFileIdFullDirInfo(&pCur->Stats, uPtr.pWithId); else birdStatFillFromFileFullDirInfo(&pCur->Stats, uPtr.pNoId); #endif pCur->Stats.st_dev = pDir->uDevNo; pCur->fHaveStats = K_TRUE; /* * Add the entry to the directory. */ fRc = kFsCacheDirAddChild(pCache, pDir, pCur, penmError); kFsCacheObjRelease(pCache, pCur); if (fRc) { /* likely */ } else { rcNt = STATUS_NO_MEMORY; break; } } /* * When seeing '.' we update the directory info. */ else if (uPtr.pNoId->FileNameLength == 2) { pDir->iLastWrite = uPtr.pNoId->LastWriteTime.QuadPart; #ifdef KFSCACHE_CFG_SHORT_NAMES if (enmInfoClass == enmInfoClassWithId) birdStatFillFromFileIdBothDirInfo(&pDir->Obj.Stats, uPtr.pWithId); else birdStatFillFromFileBothDirInfo(&pDir->Obj.Stats, uPtr.pNoId); #else if (enmInfoClass == enmInfoClassWithId) birdStatFillFromFileIdFullDirInfo(&pDir->Obj.Stats, uPtr.pWithId); else birdStatFillFromFileFullDirInfo(&pDir->Obj.Stats, uPtr.pNoId); #endif } /* * Advance. */ offNext = uPtr.pNoId->NextEntryOffset; if ( offNext >= cbMinCur && offNext < sizeof(uBuf)) offBuf += offNext; else break; } /* * Read the next chunk. */ rcNt = g_pfnNtQueryDirectoryFile(pDir->hDir, NULL, /* hEvent */ NULL, /* pfnApcComplete */ NULL, /* pvApcCompleteCtx */ &Ios, &uBuf, sizeof(uBuf), enmInfoClass, FALSE, /* fReturnSingleEntry */ &UniStrStar, /* Filter / restart pos. */ FALSE); /* fRestartScan */ } if (rcNt == MY_STATUS_NO_MORE_FILES) { /* * If refreshing, add missing children objects and ditch the rest. * We ignore errors while adding missing children (lazy bird). */ if (!fRefreshing) { /* more likely */ } else { while (DirRePop.cOldChildren > 0) { KFSLOOKUPERROR enmErrorIgn; PKFSOBJ pOldChild = DirRePop.papOldChildren[--DirRePop.cOldChildren]; if (pOldChild->bObjType == KFSOBJ_TYPE_MISSING) kFsCacheDirAddChild(pCache, pDir, pOldChild, &enmErrorIgn); else { KFSCACHE_LOG(("Refreshing %s/%s/ - %s was removed.\n", pDir->Obj.pParent->Obj.pszName, pDir->Obj.pszName, pOldChild->pszName)); kHlpAssert(pOldChild->bObjType != KFSOBJ_TYPE_DIR); /* Remove from hash table. */ if (pOldChild->uNameHash != 0) { KU32 idx = pOldChild->uNameHash & pDir->fHashTabMask; PKFSOBJ pPrev = pDir->papHashTab[idx]; if (pPrev == pOldChild) pDir->papHashTab[idx] = pOldChild->pNextNameHash; else { while (pPrev && pPrev->pNextNameHash != pOldChild) pPrev = pPrev->pNextNameHash; kHlpAssert(pPrev); if (pPrev) pPrev->pNextNameHash = pOldChild->pNextNameHash; } pOldChild->uNameHash = 0; } } kFsCacheObjRelease(pCache, pOldChild); } kHlpFree(DirRePop.papOldChildren); } /* * Mark the directory as fully populated and up to date. */ pDir->fPopulated = K_TRUE; pDir->fNeedRePopulating = K_FALSE; if (pDir->Obj.uCacheGen != KFSOBJ_CACHE_GEN_IGNORE) pDir->Obj.uCacheGen = pCache->auGenerations[pDir->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; return K_TRUE; } /* * If we failed during refresh, add back remaining old children. */ if (!fRefreshing) { while (DirRePop.cOldChildren > 0) { KFSLOOKUPERROR enmErrorIgn; PKFSOBJ pOldChild = DirRePop.papOldChildren[--DirRePop.cOldChildren]; kFsCacheDirAddChild(pCache, pDir, pOldChild, &enmErrorIgn); kFsCacheObjRelease(pCache, pOldChild); } kHlpFree(DirRePop.papOldChildren); } kHlpAssertMsgFailed(("%#x\n", rcNt)); *penmError = KFSLOOKUPERROR_DIR_READ_ERROR; return K_TRUE; } /** * Does the initial directory populating or refreshes it if it has been * invalidated. * * This assumes the parent directory is opened. * * @returns K_TRUE on success, K_FALSE on error. * @param pCache The cache. * @param pDir The directory. * @param penmError Where to store K_FALSE explanation. Optional. */ KBOOL kFsCacheDirEnsurePopuplated(PKFSCACHE pCache, PKFSDIR pDir, KFSLOOKUPERROR *penmError) { KFSLOOKUPERROR enmIgnored; KBOOL fRet; KFSCACHE_LOCK(pCache); if ( pDir->fPopulated && !pDir->fNeedRePopulating && ( pDir->Obj.uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pDir->Obj.uCacheGen == pCache->auGenerations[pDir->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN]) ) fRet = K_TRUE; else fRet = kFsCachePopuplateOrRefreshDir(pCache, pDir, penmError ? penmError : &enmIgnored); KFSCACHE_UNLOCK(pCache); return fRet; } /** * Checks whether the modified timestamp differs on this directory. * * @returns K_TRUE if possibly modified, K_FALSE if definitely not modified. * @param pDir The directory.. */ static KBOOL kFsCacheDirIsModified(PKFSDIR pDir) { if ( pDir->hDir != INVALID_HANDLE_VALUE && (pDir->Obj.fFlags & KFSOBJ_F_WORKING_DIR_MTIME) ) { if (!pDir->fNeedRePopulating) { MY_IO_STATUS_BLOCK Ios; MY_FILE_BASIC_INFORMATION BasicInfo; MY_NTSTATUS rcNt; Ios.Information = -1; Ios.u.Status = -1; rcNt = g_pfnNtQueryInformationFile(pDir->hDir, &Ios, &BasicInfo, sizeof(BasicInfo), MyFileBasicInformation); if (MY_NT_SUCCESS(rcNt)) { if ( BasicInfo.LastWriteTime.QuadPart != pDir->iLastWrite || pDir->iLastPopulated - pDir->iLastWrite < KFSCACHE_MIN_LAST_POPULATED_VS_WRITE) { pDir->fNeedRePopulating = K_TRUE; return K_TRUE; } return K_FALSE; } } } /* The cache root never changes. */ else if (!pDir->Obj.pParent) return K_FALSE; return K_TRUE; } static KBOOL kFsCacheRefreshMissing(PKFSCACHE pCache, PKFSOBJ pMissing, KFSLOOKUPERROR *penmError) { /* * If we can, we start by checking whether the parent directory * has been modified. If it has, we need to check if this entry * was added or not, most likely it wasn't added. */ if (!kFsCacheDirIsModified(pMissing->pParent)) { KFSCACHE_LOG(("Parent of missing not written to %s/%s\n", pMissing->pParent->Obj.pszName, pMissing->pszName)); pMissing->uCacheGen = pCache->auGenerationsMissing[pMissing->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; } else { MY_UNICODE_STRING UniStr; MY_OBJECT_ATTRIBUTES ObjAttr; MY_FILE_BASIC_INFORMATION BasicInfo; MY_NTSTATUS rcNt; UniStr.Buffer = (wchar_t *)pMissing->pwszName; UniStr.Length = (USHORT)(pMissing->cwcName * sizeof(wchar_t)); UniStr.MaximumLength = UniStr.Length + sizeof(wchar_t); kHlpAssert(pMissing->pParent->hDir != INVALID_HANDLE_VALUE); MyInitializeObjectAttributes(&ObjAttr, &UniStr, OBJ_CASE_INSENSITIVE, pMissing->pParent->hDir, NULL /*pSecAttr*/); rcNt = g_pfnNtQueryAttributesFile(&ObjAttr, &BasicInfo); if (!MY_NT_SUCCESS(rcNt)) { /* * Probably more likely that a missing node stays missing. */ pMissing->uCacheGen = pCache->auGenerationsMissing[pMissing->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; KFSCACHE_LOG(("Still missing %s/%s\n", pMissing->pParent->Obj.pszName, pMissing->pszName)); } else { /* * We must metamorphose this node. This is tedious business * because we need to check the file name casing. We might * just as well update the parent directory... */ KU8 const bObjType = BasicInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY ? KFSOBJ_TYPE_DIR : BasicInfo.FileAttributes & (FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_REPARSE_POINT) ? KFSOBJ_TYPE_OTHER : KFSOBJ_TYPE_FILE; KFSCACHE_LOG(("Birth of %s/%s as %d with attribs %#x...\n", pMissing->pParent->Obj.pszName, pMissing->pszName, bObjType, BasicInfo.FileAttributes)); pMissing->bObjType = bObjType; /* (auGenerations[] - 1): make sure it's not considered up to date */ pMissing->uCacheGen = pCache->auGenerations[pMissing->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] - 1; /* Trigger parent directory repopulation. */ if (pMissing->pParent->fPopulated) pMissing->pParent->fNeedRePopulating = K_TRUE; /** * @todo refresh missing object names when it appears. */ } } return K_TRUE; } static KBOOL kFsCacheRefreshMissingIntermediateDir(PKFSCACHE pCache, PKFSOBJ pMissing, KFSLOOKUPERROR *penmError) { if (kFsCacheRefreshMissing(pCache, pMissing, penmError)) { if ( pMissing->bObjType == KFSOBJ_TYPE_DIR || pMissing->bObjType == KFSOBJ_TYPE_MISSING) return K_TRUE; *penmError = KFSLOOKUPERROR_PATH_COMP_NOT_DIR; } return K_FALSE; } /** * Generic object refresh. * * This does not refresh the content of directories. * * @returns K_TRUE on success. K_FALSE and *penmError on failure. * @param pCache The cache. * @param pObj The object. * @param penmError Where to return error info. */ static KBOOL kFsCacheRefreshObj(PKFSCACHE pCache, PKFSOBJ pObj, KFSLOOKUPERROR *penmError) { KBOOL fRc; /* * Since we generally assume nothing goes away in this cache, we only really * have a hard time with negative entries. So, missing stuff goes to * complicated land. */ if (pObj->bObjType == KFSOBJ_TYPE_MISSING) fRc = kFsCacheRefreshMissing(pCache, pObj, penmError); else { /* * This object is supposed to exist, so all we need to do is query essential * stats again. Since we've already got handles on directories, there are * two ways to go about this. */ union { MY_FILE_NETWORK_OPEN_INFORMATION FullInfo; MY_FILE_STANDARD_INFORMATION StdInfo; #ifdef KFSCACHE_CFG_SHORT_NAMES MY_FILE_ID_BOTH_DIR_INFORMATION WithId; //MY_FILE_BOTH_DIR_INFORMATION NoId; #else MY_FILE_ID_FULL_DIR_INFORMATION WithId; //MY_FILE_FULL_DIR_INFORMATION NoId; #endif KU8 abPadding[ sizeof(wchar_t) * KFSCACHE_CFG_MAX_UTF16_NAME + sizeof(MY_FILE_ID_BOTH_DIR_INFORMATION)]; } uBuf; MY_IO_STATUS_BLOCK Ios; MY_NTSTATUS rcNt; if ( pObj->bObjType != KFSOBJ_TYPE_DIR || ((PKFSDIR)pObj)->hDir == INVALID_HANDLE_VALUE) { #if 1 /* This always works and doesn't mess up NtQueryDirectoryFile. */ MY_UNICODE_STRING UniStr; MY_OBJECT_ATTRIBUTES ObjAttr; UniStr.Buffer = (wchar_t *)pObj->pwszName; UniStr.Length = (USHORT)(pObj->cwcName * sizeof(wchar_t)); UniStr.MaximumLength = UniStr.Length + sizeof(wchar_t); kHlpAssert(pObj->pParent->hDir != INVALID_HANDLE_VALUE); MyInitializeObjectAttributes(&ObjAttr, &UniStr, OBJ_CASE_INSENSITIVE, pObj->pParent->hDir, NULL /*pSecAttr*/); rcNt = g_pfnNtQueryFullAttributesFile(&ObjAttr, &uBuf.FullInfo); if (MY_NT_SUCCESS(rcNt)) { pObj->Stats.st_size = uBuf.FullInfo.EndOfFile.QuadPart; birdNtTimeToTimeSpec(uBuf.FullInfo.CreationTime.QuadPart, &pObj->Stats.st_birthtim); birdNtTimeToTimeSpec(uBuf.FullInfo.ChangeTime.QuadPart, &pObj->Stats.st_ctim); birdNtTimeToTimeSpec(uBuf.FullInfo.LastWriteTime.QuadPart, &pObj->Stats.st_mtim); birdNtTimeToTimeSpec(uBuf.FullInfo.LastAccessTime.QuadPart, &pObj->Stats.st_atim); pObj->Stats.st_attribs = uBuf.FullInfo.FileAttributes; pObj->Stats.st_blksize = 65536; pObj->Stats.st_blocks = (uBuf.FullInfo.AllocationSize.QuadPart + BIRD_STAT_BLOCK_SIZE - 1) / BIRD_STAT_BLOCK_SIZE; } #else /* This alternative lets us keep the inode number up to date and detect name case changes. Update: This doesn't work on windows 7, it ignores the UniStr and continue with the "*" search. So, we're using the above query instead for the time being. */ MY_UNICODE_STRING UniStr; # ifdef KFSCACHE_CFG_SHORT_NAMES MY_FILE_INFORMATION_CLASS enmInfoClass = MyFileIdBothDirectoryInformation; # else MY_FILE_INFORMATION_CLASS enmInfoClass = MyFileIdFullDirectoryInformation; # endif UniStr.Buffer = (wchar_t *)pObj->pwszName; UniStr.Length = (USHORT)(pObj->cwcName * sizeof(wchar_t)); UniStr.MaximumLength = UniStr.Length + sizeof(wchar_t); kHlpAssert(pObj->pParent->hDir != INVALID_HANDLE_VALUE); Ios.Information = -1; Ios.u.Status = -1; rcNt = g_pfnNtQueryDirectoryFile(pObj->pParent->hDir, NULL, /* hEvent */ NULL, /* pfnApcComplete */ NULL, /* pvApcCompleteCtx */ &Ios, &uBuf, sizeof(uBuf), enmInfoClass, TRUE, /* fReturnSingleEntry */ &UniStr, /* Filter / restart pos. */ TRUE); /* fRestartScan */ if (MY_NT_SUCCESS(rcNt)) { if (pObj->Stats.st_ino == uBuf.WithId.FileId.QuadPart) KFSCACHE_LOG(("Refreshing %s/%s, no ID change...\n", pObj->pParent->Obj.pszName, pObj->pszName)); else if ( pObj->cwcName == uBuf.WithId.FileNameLength / sizeof(wchar_t) # ifdef KFSCACHE_CFG_SHORT_NAMES && ( uBuf.WithId.ShortNameLength == 0 ? pObj->pwszName == pObj->pwszShortName || ( pObj->cwcName == pObj->cwcShortName && memcmp(pObj->pwszName, pObj->pwszShortName, pObj->cwcName * sizeof(wchar_t)) == 0) : pObj->cwcShortName == uBuf.WithId.ShortNameLength / sizeof(wchar_t) && memcmp(pObj->pwszShortName, uBuf.WithId.ShortName, uBuf.WithId.ShortNameLength) == 0 ) # endif && memcmp(pObj->pwszName, uBuf.WithId.FileName, uBuf.WithId.FileNameLength) == 0 ) { KFSCACHE_LOG(("Refreshing %s/%s, ID changed %#llx -> %#llx...\n", pObj->pParent->Obj.pszName, pObj->pszName, pObj->Stats.st_ino, uBuf.WithId.FileId.QuadPart)); pObj->Stats.st_ino = uBuf.WithId.FileId.QuadPart; } else { KFSCACHE_LOG(("Refreshing %s/%s, ID changed %#llx -> %#llx and names too...\n", pObj->pParent->Obj.pszName, pObj->pszName, pObj->Stats.st_ino, uBuf.WithId.FileId.QuadPart)); fprintf(stderr, "kFsCacheRefreshObj - ID + name change not implemented!!\n"); fflush(stderr); __debugbreak(); pObj->Stats.st_ino = uBuf.WithId.FileId.QuadPart; /** @todo implement as needed. */ } pObj->Stats.st_size = uBuf.WithId.EndOfFile.QuadPart; birdNtTimeToTimeSpec(uBuf.WithId.CreationTime.QuadPart, &pObj->Stats.st_birthtim); birdNtTimeToTimeSpec(uBuf.WithId.ChangeTime.QuadPart, &pObj->Stats.st_ctim); birdNtTimeToTimeSpec(uBuf.WithId.LastWriteTime.QuadPart, &pObj->Stats.st_mtim); birdNtTimeToTimeSpec(uBuf.WithId.LastAccessTime.QuadPart, &pObj->Stats.st_atim); pObj->Stats.st_attribs = uBuf.WithId.FileAttributes; pObj->Stats.st_blksize = 65536; pObj->Stats.st_blocks = (uBuf.WithId.AllocationSize.QuadPart + BIRD_STAT_BLOCK_SIZE - 1) / BIRD_STAT_BLOCK_SIZE; } #endif if (MY_NT_SUCCESS(rcNt)) { pObj->uCacheGen = pCache->auGenerations[pObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; fRc = K_TRUE; } else { /* ouch! */ kHlpAssertMsgFailed(("%#x\n", rcNt)); fprintf(stderr, "kFsCacheRefreshObj - rcNt=%#x on non-dir - not implemented!\n", rcNt); __debugbreak(); fRc = K_FALSE; } } else { /* * An open directory. Query information via the handle, the * file ID shouldn't have been able to change, so we can use * NtQueryInformationFile. Right... */ PKFSDIR pDir = (PKFSDIR)pObj; Ios.Information = -1; Ios.u.Status = -1; rcNt = g_pfnNtQueryInformationFile(pDir->hDir, &Ios, &uBuf.FullInfo, sizeof(uBuf.FullInfo), MyFileNetworkOpenInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) { pObj->Stats.st_size = uBuf.FullInfo.EndOfFile.QuadPart; birdNtTimeToTimeSpec(uBuf.FullInfo.CreationTime.QuadPart, &pObj->Stats.st_birthtim); birdNtTimeToTimeSpec(uBuf.FullInfo.ChangeTime.QuadPart, &pObj->Stats.st_ctim); birdNtTimeToTimeSpec(uBuf.FullInfo.LastWriteTime.QuadPart, &pObj->Stats.st_mtim); birdNtTimeToTimeSpec(uBuf.FullInfo.LastAccessTime.QuadPart, &pObj->Stats.st_atim); pObj->Stats.st_attribs = uBuf.FullInfo.FileAttributes; pObj->Stats.st_blksize = 65536; pObj->Stats.st_blocks = (uBuf.FullInfo.AllocationSize.QuadPart + BIRD_STAT_BLOCK_SIZE - 1) / BIRD_STAT_BLOCK_SIZE; if ( pDir->iLastWrite == uBuf.FullInfo.LastWriteTime.QuadPart && (pObj->fFlags & KFSOBJ_F_WORKING_DIR_MTIME) && pDir->iLastPopulated - pDir->iLastWrite >= KFSCACHE_MIN_LAST_POPULATED_VS_WRITE) KFSCACHE_LOG(("Refreshing %s/%s/ - no re-populating necessary.\n", pObj->pParent->Obj.pszName, pObj->pszName)); else { KFSCACHE_LOG(("Refreshing %s/%s/ - needs re-populating...\n", pObj->pParent->Obj.pszName, pObj->pszName)); pDir->fNeedRePopulating = K_TRUE; #if 0 /* Refresh the link count. */ rcNt = g_pfnNtQueryInformationFile(pDir->hDir, &Ios, &StdInfo, sizeof(StdInfo), FileStandardInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.s.Status; if (MY_NT_SUCCESS(rcNt)) pObj->Stats.st_nlink = StdInfo.NumberOfLinks; #endif } } if (MY_NT_SUCCESS(rcNt)) { pObj->uCacheGen = pCache->auGenerations[pObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; fRc = K_TRUE; } else { /* ouch! */ kHlpAssertMsgFailed(("%#x\n", rcNt)); fprintf(stderr, "kFsCacheRefreshObj - rcNt=%#x on dir - not implemented!\n", rcNt); fflush(stderr); __debugbreak(); fRc = K_FALSE; } } } return fRc; } /** * Looks up a drive letter. * * Will enter the drive if necessary. * * @returns Pointer to the root directory of the drive or an update-to-date * missing node. * @param pCache The cache. * @param chLetter The uppercased drive letter. * @param fFlags Lookup flags, KFSCACHE_LOOKUP_F_XXX. * @param penmError Where to return details as to why the lookup * failed. */ static PKFSOBJ kFsCacheLookupDrive(PKFSCACHE pCache, char chLetter, KU32 fFlags, KFSLOOKUPERROR *penmError) { KU32 const uNameHash = chLetter - 'A'; PKFSOBJ pCur = pCache->RootDir.papHashTab[uNameHash]; KU32 cLeft; PKFSOBJ *ppCur; MY_UNICODE_STRING NtPath; wchar_t wszTmp[8]; char szTmp[4]; /* * Custom drive letter hashing. */ kHlpAssert((uNameHash & pCache->RootDir.fHashTabMask) == uNameHash); while (pCur) { if ( pCur->uNameHash == uNameHash && pCur->cchName == 2 && pCur->pszName[0] == chLetter && pCur->pszName[1] == ':') { if (pCur->bObjType == KFSOBJ_TYPE_DIR) return pCur; if ( (fFlags & KFSCACHE_LOOKUP_F_NO_REFRESH) || kFsCacheRefreshMissingIntermediateDir(pCache, pCur, penmError)) return pCur; return NULL; } pCur = pCur->pNextNameHash; } /* * Make 100% sure it's not there. */ cLeft = pCache->RootDir.cChildren; ppCur = pCache->RootDir.papChildren; while (cLeft-- > 0) { pCur = *ppCur++; if ( pCur->cchName == 2 && pCur->pszName[0] == chLetter && pCur->pszName[1] == ':') { if (pCur->bObjType == KFSOBJ_TYPE_DIR) return pCur; kHlpAssert(pCur->bObjType == KFSOBJ_TYPE_MISSING); if ( (fFlags & KFSCACHE_LOOKUP_F_NO_REFRESH) || kFsCacheRefreshMissingIntermediateDir(pCache, pCur, penmError)) return pCur; return NULL; } } if (fFlags & KFSCACHE_LOOKUP_F_NO_INSERT) { *penmError = KFSLOOKUPERROR_PATH_COMP_NOT_FOUND; /* close enough */ return NULL; } /* * Need to add it. We always keep the drive letters open for the benefit * of kFsCachePopuplateOrRefreshDir and others. */ wszTmp[0] = szTmp[0] = chLetter; wszTmp[1] = szTmp[1] = ':'; wszTmp[2] = szTmp[2] = '\\'; wszTmp[3] = '.'; wszTmp[4] = '\0'; szTmp[2] = '\0'; NtPath.Buffer = NULL; NtPath.Length = 0; NtPath.MaximumLength = 0; if (g_pfnRtlDosPathNameToNtPathName_U(wszTmp, &NtPath, NULL, NULL)) { HANDLE hDir; MY_NTSTATUS rcNt; rcNt = birdOpenFileUniStr(NULL /*hRoot*/, &NtPath, FILE_READ_DATA | FILE_LIST_DIRECTORY | FILE_READ_ATTRIBUTES | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE, &hDir); birdFreeNtPath(&NtPath); if (MY_NT_SUCCESS(rcNt)) { PKFSDIR pDir = (PKFSDIR)kFsCacheCreateObject(pCache, &pCache->RootDir, szTmp, 2, wszTmp, 2, #ifdef KFSCACHE_CFG_SHORT_NAMES NULL, 0, NULL, 0, #endif KFSOBJ_TYPE_DIR, penmError); if (pDir) { /* * We need a little bit of extra info for a drive root. These things are typically * inherited by subdirectories down the tree, so, we do it all here for till that changes. */ union { MY_FILE_FS_VOLUME_INFORMATION VolInfo; MY_FILE_FS_ATTRIBUTE_INFORMATION FsAttrInfo; char abPadding[sizeof(MY_FILE_FS_VOLUME_INFORMATION) + 512]; } uBuf; MY_IO_STATUS_BLOCK Ios; KBOOL fRc; kHlpAssert(pDir->hDir == INVALID_HANDLE_VALUE); pDir->hDir = hDir; if (birdStatHandle(hDir, &pDir->Obj.Stats, pDir->Obj.pszName) == 0) { pDir->Obj.fHaveStats = K_TRUE; pDir->uDevNo = pDir->Obj.Stats.st_dev; } else { /* Just in case. */ pDir->Obj.fHaveStats = K_FALSE; rcNt = birdQueryVolumeDeviceNumber(hDir, &uBuf.VolInfo, sizeof(uBuf), &pDir->uDevNo); kHlpAssertMsg(MY_NT_SUCCESS(rcNt), ("%#x\n", rcNt)); } /* Get the file system. */ pDir->Obj.fFlags &= ~(KFSOBJ_F_NTFS | KFSOBJ_F_WORKING_DIR_MTIME); Ios.Information = -1; Ios.u.Status = -1; rcNt = g_pfnNtQueryVolumeInformationFile(hDir, &Ios, &uBuf.FsAttrInfo, sizeof(uBuf), MyFileFsAttributeInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) { if ( uBuf.FsAttrInfo.FileSystemName[0] == 'N' && uBuf.FsAttrInfo.FileSystemName[1] == 'T' && uBuf.FsAttrInfo.FileSystemName[2] == 'F' && uBuf.FsAttrInfo.FileSystemName[3] == 'S' && uBuf.FsAttrInfo.FileSystemName[4] == '\0') { DWORD dwDriveType = GetDriveTypeW(wszTmp); if ( dwDriveType == DRIVE_FIXED || dwDriveType == DRIVE_RAMDISK) pDir->Obj.fFlags |= KFSOBJ_F_NTFS | KFSOBJ_F_WORKING_DIR_MTIME; } } /* * Link the new drive letter into the root dir. */ fRc = kFsCacheDirAddChild(pCache, &pCache->RootDir, &pDir->Obj, penmError); kFsCacheObjRelease(pCache, &pDir->Obj); if (fRc) { pDir->Obj.pNextNameHash = pCache->RootDir.papHashTab[uNameHash]; pCache->RootDir.papHashTab[uNameHash] = &pDir->Obj; return &pDir->Obj; } return NULL; } g_pfnNtClose(hDir); return NULL; } /* Assume it doesn't exist if this happens... This may be a little to restrictive wrt status code checks. */ kHlpAssertMsgStmtReturn( rcNt == MY_STATUS_OBJECT_NAME_NOT_FOUND || rcNt == MY_STATUS_OBJECT_PATH_NOT_FOUND || rcNt == MY_STATUS_OBJECT_PATH_INVALID || rcNt == MY_STATUS_OBJECT_PATH_SYNTAX_BAD, ("%#x\n", rcNt), *penmError = KFSLOOKUPERROR_DIR_OPEN_ERROR, NULL); } else { kHlpAssertFailed(); *penmError = KFSLOOKUPERROR_OUT_OF_MEMORY; return NULL; } /* * Maybe create a missing entry. */ if (pCache->fFlags & KFSCACHE_F_MISSING_OBJECTS) { PKFSOBJ pMissing = kFsCacheCreateObject(pCache, &pCache->RootDir, szTmp, 2, wszTmp, 2, #ifdef KFSCACHE_CFG_SHORT_NAMES NULL, 0, NULL, 0, #endif KFSOBJ_TYPE_MISSING, penmError); if (pMissing) { KBOOL fRc = kFsCacheDirAddChild(pCache, &pCache->RootDir, pMissing, penmError); kFsCacheObjRelease(pCache, pMissing); return fRc ? pMissing : NULL; } } else { /** @todo this isn't necessary correct for a root spec. */ *penmError = KFSLOOKUPERROR_PATH_COMP_NOT_FOUND; } return NULL; } /** * Slow path that allocates the child hash table and enters the given one. * * Allocation fialures are ignored. * * @param pCache The cache (for stats). * @param pDir The directory. * @param uNameHash The name hash to enter @a pChild under. * @param pChild The child to enter into the hash table. */ static void kFsCacheDirAllocHashTabAndEnterChild(PKFSCACHE pCache, PKFSDIR pDir, KU32 uNameHash, PKFSOBJ pChild) { if (uNameHash != 0) /* paranoia ^ 4! */ { /* * Double the current number of children and round up to a multiple of * two so we can avoid division. */ KU32 cbHashTab; KU32 cEntries; kHlpAssert(pDir->cChildren > 0); if (pDir->cChildren <= KU32_MAX / 4) { #if defined(_MSC_VER) && 1 KU32 cEntriesRaw = pDir->cChildren * 2; KU32 cEntriesShift; kHlpAssert(sizeof(cEntries) == (unsigned long)); if (_BitScanReverse(&cEntriesShift, cEntriesRaw)) { if ( K_BIT32(cEntriesShift) < cEntriesRaw && cEntriesShift < 31U) cEntriesShift++; cEntries = K_BIT32(cEntriesShift); } else { kHlpAssertFailed(); cEntries = KU32_MAX / 2 + 1; } #else cEntries = pDir->cChildren * 2 - 1; cEntries |= cEntries >> 1; cEntries |= cEntries >> 2; cEntries |= cEntries >> 4; cEntries |= cEntries >> 8; cEntries |= cEntries >> 16; cEntries++; #endif } else cEntries = KU32_MAX / 2 + 1; kHlpAssert((cEntries & (cEntries - 1)) == 0); cbHashTab = cEntries * sizeof(pDir->papHashTab[0]); pDir->papHashTab = (PKFSOBJ *)kHlpAllocZ(cbHashTab); if (pDir->papHashTab) { KU32 idx; pDir->fHashTabMask = cEntries - 1; pCache->cbObjects += cbHashTab; pCache->cChildHashTabs++; pCache->cChildHashEntriesTotal += cEntries; /* * Insert it. */ pChild->uNameHash = uNameHash; idx = uNameHash & (pDir->fHashTabMask); pChild->pNextNameHash = pDir->papHashTab[idx]; pDir->papHashTab[idx] = pChild; pCache->cChildHashed++; } } } /** * Look up a child node, ANSI version. * * @returns Pointer to the child if found, NULL if not. * @param pCache The cache. * @param pParent The parent directory to search. * @param pchName The child name to search for (not terminated). * @param cchName The length of the child name. */ static PKFSOBJ kFsCacheFindChildA(PKFSCACHE pCache, PKFSDIR pParent, const char *pchName, KU32 cchName) { /* * Check for '.' first ('..' won't appear). */ if (cchName != 1 || *pchName != '.') { PKFSOBJ *ppCur; KU32 cLeft; KU32 uNameHash; /* * Do hash table lookup. * * This caches previous lookups, which should be useful when looking up * intermediate directories at least. */ if (pParent->papHashTab != NULL) { PKFSOBJ pCur; uNameHash = kFsCacheStrHashN(pchName, cchName); pCur = pParent->papHashTab[uNameHash & pParent->fHashTabMask]; while (pCur) { if ( pCur->uNameHash == uNameHash && ( ( pCur->cchName == cchName && _mbsnicmp(pCur->pszName, pchName, cchName) == 0) #ifdef KFSCACHE_CFG_SHORT_NAMES || ( pCur->cchShortName == cchName && pCur->pszShortName != pCur->pszName && _mbsnicmp(pCur->pszShortName, pchName, cchName) == 0) #endif ) ) { pCache->cChildHashHits++; pCache->cChildSearches++; return pCur; } pCur = pCur->pNextNameHash; } } else uNameHash = 0; /* * Do linear search. */ cLeft = pParent->cChildren; ppCur = pParent->papChildren; while (cLeft-- > 0) { PKFSOBJ pCur = *ppCur++; if ( ( pCur->cchName == cchName && _mbsnicmp(pCur->pszName, pchName, cchName) == 0) #ifdef KFSCACHE_CFG_SHORT_NAMES || ( pCur->cchShortName == cchName && pCur->pszShortName != pCur->pszName && _mbsnicmp(pCur->pszShortName, pchName, cchName) == 0) #endif ) { /* * Consider entering it into the parent hash table. * Note! We hash the input, not the name we found. */ if ( pCur->uNameHash == 0 && pParent->cChildren >= 2) { if (pParent->papHashTab) { if (uNameHash != 0) { KU32 idxNameHash = uNameHash & pParent->fHashTabMask; pCur->uNameHash = uNameHash; pCur->pNextNameHash = pParent->papHashTab[idxNameHash]; pParent->papHashTab[idxNameHash] = pCur; if (pCur->pNextNameHash) pCache->cChildHashCollisions++; pCache->cChildHashed++; } } else kFsCacheDirAllocHashTabAndEnterChild(pCache, pParent, kFsCacheStrHashN(pchName, cchName), pCur); } pCache->cChildSearches++; return pCur; } } pCache->cChildSearches++; return NULL; } return &pParent->Obj; } /** * Look up a child node, UTF-16 version. * * @returns Pointer to the child if found, NULL if not. * @param pCache The cache. * @param pParent The parent directory to search. * @param pwcName The child name to search for (not terminated). * @param cwcName The length of the child name (in wchar_t's). */ static PKFSOBJ kFsCacheFindChildW(PKFSCACHE pCache, PKFSDIR pParent, const wchar_t *pwcName, KU32 cwcName) { /* * Check for '.' first ('..' won't appear). */ if (cwcName != 1 || *pwcName != '.') { PKFSOBJ *ppCur; KU32 cLeft; KU32 uNameHash; /* * Do hash table lookup. * * This caches previous lookups, which should be useful when looking up * intermediate directories at least. */ if (pParent->papHashTab != NULL) { PKFSOBJ pCur; uNameHash = kFsCacheUtf16HashN(pwcName, cwcName); pCur = pParent->papHashTab[uNameHash & pParent->fHashTabMask]; while (pCur) { if ( pCur->uNameHash == uNameHash && ( ( pCur->cwcName == cwcName && kFsCacheIAreEqualW(pCur->pwszName, pwcName, cwcName)) #ifdef KFSCACHE_CFG_SHORT_NAMES || ( pCur->cwcShortName == cwcName && pCur->pwszShortName != pCur->pwszName && kFsCacheIAreEqualW(pCur->pwszShortName, pwcName, cwcName)) #endif ) ) { pCache->cChildHashHits++; pCache->cChildSearches++; return pCur; } pCur = pCur->pNextNameHash; } } else uNameHash = 0; /* * Do linear search. */ cLeft = pParent->cChildren; ppCur = pParent->papChildren; while (cLeft-- > 0) { PKFSOBJ pCur = *ppCur++; if ( ( pCur->cwcName == cwcName && kFsCacheIAreEqualW(pCur->pwszName, pwcName, cwcName)) #ifdef KFSCACHE_CFG_SHORT_NAMES || ( pCur->cwcShortName == cwcName && pCur->pwszShortName != pCur->pwszName && kFsCacheIAreEqualW(pCur->pwszShortName, pwcName, cwcName)) #endif ) { /* * Consider entering it into the parent hash table. * Note! We hash the input, not the name we found. */ if ( pCur->uNameHash == 0 && pParent->cChildren >= 4) { if (pParent->papHashTab) { if (uNameHash != 0) { KU32 idxNameHash = uNameHash & pParent->fHashTabMask; pCur->uNameHash = uNameHash; pCur->pNextNameHash = pParent->papHashTab[idxNameHash]; pParent->papHashTab[idxNameHash] = pCur; if (pCur->pNextNameHash) pCache->cChildHashCollisions++; pCache->cChildHashed++; } } else kFsCacheDirAllocHashTabAndEnterChild(pCache, pParent, kFsCacheUtf16HashN(pwcName, cwcName), pCur); } pCache->cChildSearches++; return pCur; } } pCache->cChildSearches++; return NULL; } return &pParent->Obj; } /** * Looks up a UNC share, ANSI version. * * We keep both the server and share in the root directory entry. This means we * have to clean up the entry name before we can insert it. * * @returns Pointer to the share root directory or an update-to-date missing * node. * @param pCache The cache. * @param pszPath The path. * @param fFlags Lookup flags, KFSCACHE_LOOKUP_F_XXX. * @param poff Where to return the root dire. * @param penmError Where to return details as to why the lookup * failed. */ static PKFSOBJ kFsCacheLookupUncShareA(PKFSCACHE pCache, const char *pszPath, KU32 fFlags, KU32 *poff, KFSLOOKUPERROR *penmError) { /* * Special case: Long path prefix w/ drive letter following it. * Note! Must've been converted from wide char to ANSI. */ if ( IS_SLASH(pszPath[0]) && IS_SLASH(pszPath[1]) && pszPath[2] == '?' && IS_SLASH(pszPath[3]) && IS_ALPHA(pszPath[4]) && pszPath[5] == ':' && IS_SLASH(pszPath[6]) ) { *poff = 4 + 2; return kFsCacheLookupDrive(pCache, pszPath[4], fFlags, penmError); } #if 0 /* later */ KU32 offStartServer; KU32 offEndServer; KU32 offStartShare; KU32 offEnd = 2; while (IS_SLASH(pszPath[offEnd])) offEnd++; offStartServer = offEnd; while ( (ch = pszPath[offEnd]) != '\0' && !IS_SLASH(ch)) offEnd++; offEndServer = offEnd; if (ch != '\0') { /* likely */ } else { *penmError = KFSLOOKUPERROR_NOT_FOUND; return NULL; } while (IS_SLASH(pszPath[offEnd])) offEnd++; offStartServer = offEnd; while ( (ch = pszPath[offEnd]) != '\0' && !IS_SLASH(ch)) offEnd++; #endif *penmError = KFSLOOKUPERROR_UNSUPPORTED; return NULL; } /** * Looks up a UNC share, UTF-16 version. * * We keep both the server and share in the root directory entry. This means we * have to clean up the entry name before we can insert it. * * @returns Pointer to the share root directory or an update-to-date missing * node. * @param pCache The cache. * @param pwszPath The path. * @param fFlags Lookup flags, KFSCACHE_LOOKUP_F_XXX. * @param poff Where to return the root dir. * @param penmError Where to return details as to why the lookup * failed. */ static PKFSOBJ kFsCacheLookupUncShareW(PKFSCACHE pCache, const wchar_t *pwszPath, KU32 fFlags, KU32 *poff, KFSLOOKUPERROR *penmError) { /* * Special case: Long path prefix w/ drive letter following it. */ if ( IS_SLASH(pwszPath[0]) && IS_SLASH(pwszPath[1]) && pwszPath[2] == '?' && IS_SLASH(pwszPath[3]) && IS_ALPHA(pwszPath[4]) && pwszPath[5] == ':' && IS_SLASH(pwszPath[6]) ) { *poff = 4 + 2; return kFsCacheLookupDrive(pCache, (char)pwszPath[4], fFlags, penmError); } #if 0 /* later */ KU32 offStartServer; KU32 offEndServer; KU32 offStartShare; KU32 offEnd = 2; while (IS_SLASH(pwszPath[offEnd])) offEnd++; offStartServer = offEnd; while ( (ch = pwszPath[offEnd]) != '\0' && !IS_SLASH(ch)) offEnd++; offEndServer = offEnd; if (ch != '\0') { /* likely */ } else { *penmError = KFSLOOKUPERROR_NOT_FOUND; return NULL; } while (IS_SLASH(pwszPath[offEnd])) offEnd++; offStartServer = offEnd; while ( (ch = pwszPath[offEnd]) != '\0' && !IS_SLASH(ch)) offEnd++; #endif *penmError = KFSLOOKUPERROR_UNSUPPORTED; return NULL; } /** * Walks an full path relative to the given directory, ANSI version. * * This will create any missing nodes while walking. * * The caller will have to do the path hash table insertion of the result. * * @returns Pointer to the tree node corresponding to @a pszPath. * NULL on lookup failure, see @a penmError for details. * @param pCache The cache. * @param pParent The directory to start the lookup in. * @param pszPath The path to walk. * @param cchPath The length of the path. * @param fFlags Lookup flags, KFSCACHE_LOOKUP_F_XXX. * @param penmError Where to return details as to why the lookup * failed. * @param ppLastAncestor Where to return the last parent element found * (referenced) in case of error like an path/file * not found problem. Optional. */ PKFSOBJ kFsCacheLookupRelativeToDirA(PKFSCACHE pCache, PKFSDIR pParent, const char *pszPath, KU32 cchPath, KU32 fFlags, KFSLOOKUPERROR *penmError, PKFSOBJ *ppLastAncestor) { /* * Walk loop. */ KU32 off = 0; if (ppLastAncestor) *ppLastAncestor = NULL; KFSCACHE_LOCK(pCache); for (;;) { PKFSOBJ pChild; /* * Find the end of the component, counting trailing slashes. */ char ch; KU32 cchSlashes = 0; KU32 offEnd = off + 1; while ((ch = pszPath[offEnd]) != '\0') { if (!IS_SLASH(ch)) offEnd++; else { do cchSlashes++; while (IS_SLASH(pszPath[offEnd + cchSlashes])); break; } } /* * Do we need to populate or refresh this directory first? */ if ( !pParent->fNeedRePopulating && pParent->fPopulated && ( pParent->Obj.uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pParent->Obj.uCacheGen == pCache->auGenerations[pParent->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN]) ) { /* likely */ } else if ( (fFlags & (KFSCACHE_LOOKUP_F_NO_INSERT | KFSCACHE_LOOKUP_F_NO_REFRESH)) || kFsCachePopuplateOrRefreshDir(pCache, pParent, penmError)) { /* likely */ } else { if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } /* * Search the current node for the name. * * If we don't find it, we may insert a missing node depending on * the cache configuration. */ pChild = kFsCacheFindChildA(pCache, pParent, &pszPath[off], offEnd - off); if (pChild != NULL) { /* probably likely */ } else { if ( (pCache->fFlags & KFSCACHE_F_MISSING_OBJECTS) && !(fFlags & KFSCACHE_LOOKUP_F_NO_INSERT)) pChild = kFsCacheCreateMissingA(pCache, pParent, &pszPath[off], offEnd - off, penmError); if (cchSlashes == 0 || offEnd + cchSlashes >= cchPath) { if (pChild) { kFsCacheObjRetainInternal(pChild); KFSCACHE_UNLOCK(pCache); return pChild; } *penmError = KFSLOOKUPERROR_NOT_FOUND; } else *penmError = KFSLOOKUPERROR_PATH_COMP_NOT_FOUND; if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } /* Advance off and check if we're done already. */ off = offEnd + cchSlashes; if ( cchSlashes == 0 || off >= cchPath) { if ( pChild->bObjType != KFSOBJ_TYPE_MISSING || pChild->uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pChild->uCacheGen == pCache->auGenerationsMissing[pChild->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] || (fFlags & KFSCACHE_LOOKUP_F_NO_REFRESH) || kFsCacheRefreshMissing(pCache, pChild, penmError) ) { /* likely */ } else { if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } kFsCacheObjRetainInternal(pChild); KFSCACHE_UNLOCK(pCache); return pChild; } /* * Check that it's a directory. If a missing entry, we may have to * refresh it and re-examin it. */ if (pChild->bObjType == KFSOBJ_TYPE_DIR) pParent = (PKFSDIR)pChild; else if (pChild->bObjType != KFSOBJ_TYPE_MISSING) { *penmError = KFSLOOKUPERROR_PATH_COMP_NOT_DIR; if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } else if ( pChild->uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pChild->uCacheGen == pCache->auGenerationsMissing[pChild->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] || (fFlags & KFSCACHE_LOOKUP_F_NO_REFRESH)) { *penmError = KFSLOOKUPERROR_PATH_COMP_NOT_FOUND; if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } else if (kFsCacheRefreshMissingIntermediateDir(pCache, pChild, penmError)) pParent = (PKFSDIR)pChild; else { if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } } /* not reached */ KFSCACHE_UNLOCK(pCache); return NULL; } /** * Walks an full path relative to the given directory, UTF-16 version. * * This will create any missing nodes while walking. * * The caller will have to do the path hash table insertion of the result. * * @returns Pointer to the tree node corresponding to @a pszPath. * NULL on lookup failure, see @a penmError for details. * @param pCache The cache. * @param pParent The directory to start the lookup in. * @param pszPath The path to walk. No dot-dot bits allowed! * @param cchPath The length of the path. * @param fFlags Lookup flags, KFSCACHE_LOOKUP_F_XXX. * @param penmError Where to return details as to why the lookup * failed. * @param ppLastAncestor Where to return the last parent element found * (referenced) in case of error like an path/file * not found problem. Optional. */ PKFSOBJ kFsCacheLookupRelativeToDirW(PKFSCACHE pCache, PKFSDIR pParent, const wchar_t *pwszPath, KU32 cwcPath, KU32 fFlags, KFSLOOKUPERROR *penmError, PKFSOBJ *ppLastAncestor) { /* * Walk loop. */ KU32 off = 0; if (ppLastAncestor) *ppLastAncestor = NULL; KFSCACHE_LOCK(pCache); for (;;) { PKFSOBJ pChild; /* * Find the end of the component, counting trailing slashes. */ wchar_t wc; KU32 cwcSlashes = 0; KU32 offEnd = off + 1; while ((wc = pwszPath[offEnd]) != '\0') { if (!IS_SLASH(wc)) offEnd++; else { do cwcSlashes++; while (IS_SLASH(pwszPath[offEnd + cwcSlashes])); break; } } /* * Do we need to populate or refresh this directory first? */ if ( !pParent->fNeedRePopulating && pParent->fPopulated && ( pParent->Obj.uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pParent->Obj.uCacheGen == pCache->auGenerations[pParent->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN]) ) { /* likely */ } else if ( (fFlags & (KFSCACHE_LOOKUP_F_NO_INSERT | KFSCACHE_LOOKUP_F_NO_REFRESH)) || kFsCachePopuplateOrRefreshDir(pCache, pParent, penmError)) { /* likely */ } else { if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } /* * Search the current node for the name. * * If we don't find it, we may insert a missing node depending on * the cache configuration. */ pChild = kFsCacheFindChildW(pCache, pParent, &pwszPath[off], offEnd - off); if (pChild != NULL) { /* probably likely */ } else { if ( (pCache->fFlags & KFSCACHE_F_MISSING_OBJECTS) && !(fFlags & KFSCACHE_LOOKUP_F_NO_INSERT)) pChild = kFsCacheCreateMissingW(pCache, pParent, &pwszPath[off], offEnd - off, penmError); if (cwcSlashes == 0 || offEnd + cwcSlashes >= cwcPath) { if (pChild) { kFsCacheObjRetainInternal(pChild); KFSCACHE_UNLOCK(pCache); return pChild; } *penmError = KFSLOOKUPERROR_NOT_FOUND; } else *penmError = KFSLOOKUPERROR_PATH_COMP_NOT_FOUND; if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } /* Advance off and check if we're done already. */ off = offEnd + cwcSlashes; if ( cwcSlashes == 0 || off >= cwcPath) { if ( pChild->bObjType != KFSOBJ_TYPE_MISSING || pChild->uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pChild->uCacheGen == pCache->auGenerationsMissing[pChild->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] || (fFlags & KFSCACHE_LOOKUP_F_NO_REFRESH) || kFsCacheRefreshMissing(pCache, pChild, penmError) ) { /* likely */ } else { if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } kFsCacheObjRetainInternal(pChild); KFSCACHE_UNLOCK(pCache); return pChild; } /* * Check that it's a directory. If a missing entry, we may have to * refresh it and re-examin it. */ if (pChild->bObjType == KFSOBJ_TYPE_DIR) pParent = (PKFSDIR)pChild; else if (pChild->bObjType != KFSOBJ_TYPE_MISSING) { *penmError = KFSLOOKUPERROR_PATH_COMP_NOT_DIR; if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } else if ( pChild->uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pChild->uCacheGen == pCache->auGenerationsMissing[pChild->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] || (fFlags & KFSCACHE_LOOKUP_F_NO_REFRESH) ) { *penmError = KFSLOOKUPERROR_PATH_COMP_NOT_FOUND; if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } else if (kFsCacheRefreshMissingIntermediateDir(pCache, pChild, penmError)) pParent = (PKFSDIR)pChild; else { if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj); KFSCACHE_UNLOCK(pCache); return NULL; } } KFSCACHE_UNLOCK(pCache); return NULL; } /** * Walk the file system tree for the given absolute path, entering it into the * hash table. * * This will create any missing nodes while walking. * * The caller will have to do the path hash table insertion of the result. * * @returns Pointer to the tree node corresponding to @a pszPath. * NULL on lookup failure, see @a penmError for details. * @param pCache The cache. * @param pszPath The path to walk. No dot-dot bits allowed! * @param cchPath The length of the path. * @param fFlags Lookup flags, KFSCACHE_LOOKUP_F_XXX. * @param penmError Where to return details as to why the lookup * failed. * @param ppLastAncestor Where to return the last parent element found * (referenced) in case of error an path/file not * found problem. Optional. */ static PKFSOBJ kFsCacheLookupAbsoluteA(PKFSCACHE pCache, const char *pszPath, KU32 cchPath, KU32 fFlags, KFSLOOKUPERROR *penmError, PKFSOBJ *ppLastAncestor) { PKFSOBJ pRoot; KU32 cchSlashes; KU32 offEnd; KFSCACHE_LOG2(("kFsCacheLookupAbsoluteA(%s)\n", pszPath)); /* * The root "directory" needs special handling, so we keep it outside the * main search loop. (Special: Cannot enumerate it, UNCs, ++.) */ cchSlashes = 0; if ( pszPath[1] == ':' && IS_ALPHA(pszPath[0])) { /* Drive letter. */ offEnd = 2; kHlpAssert(IS_SLASH(pszPath[2])); pRoot = kFsCacheLookupDrive(pCache, toupper(pszPath[0]), fFlags, penmError); } else if ( IS_SLASH(pszPath[0]) && IS_SLASH(pszPath[1]) ) pRoot = kFsCacheLookupUncShareA(pCache, pszPath, fFlags, &offEnd, penmError); else { *penmError = KFSLOOKUPERROR_UNSUPPORTED; return NULL; } if (pRoot) { /* likely */ } else return NULL; /* Count slashes trailing the root spec. */ if (offEnd < cchPath) { kHlpAssert(IS_SLASH(pszPath[offEnd])); do cchSlashes++; while (IS_SLASH(pszPath[offEnd + cchSlashes])); } /* Done already? */ if (offEnd >= cchPath) { if ( pRoot->uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pRoot->uCacheGen == ( pRoot->bObjType != KFSOBJ_TYPE_MISSING ? pCache->auGenerations[ pRoot->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerationsMissing[pRoot->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]) || (fFlags & KFSCACHE_LOOKUP_F_NO_REFRESH) || kFsCacheRefreshObj(pCache, pRoot, penmError)) return kFsCacheObjRetainInternal(pRoot); if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(pRoot); return NULL; } /* Check that we've got a valid result and not a cached negative one. */ if (pRoot->bObjType == KFSOBJ_TYPE_DIR) { /* likely */ } else { kHlpAssert(pRoot->bObjType == KFSOBJ_TYPE_MISSING); kHlpAssert( pRoot->uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pRoot->uCacheGen == pCache->auGenerationsMissing[pRoot->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]); return pRoot; } /* * Now that we've found a valid root directory, lookup the * remainder of the path starting with it. */ return kFsCacheLookupRelativeToDirA(pCache, (PKFSDIR)pRoot, &pszPath[offEnd + cchSlashes], cchPath - offEnd - cchSlashes, fFlags, penmError, ppLastAncestor); } /** * Walk the file system tree for the given absolute path, UTF-16 version. * * This will create any missing nodes while walking. * * The caller will have to do the path hash table insertion of the result. * * @returns Pointer to the tree node corresponding to @a pszPath. * NULL on lookup failure, see @a penmError for details. * @param pCache The cache. * @param pwszPath The path to walk. * @param cwcPath The length of the path (in wchar_t's). * @param fFlags Lookup flags, KFSCACHE_LOOKUP_F_XXX. * @param penmError Where to return details as to why the lookup * failed. * @param ppLastAncestor Where to return the last parent element found * (referenced) in case of error an path/file not * found problem. Optional. */ static PKFSOBJ kFsCacheLookupAbsoluteW(PKFSCACHE pCache, const wchar_t *pwszPath, KU32 cwcPath, KU32 fFlags, KFSLOOKUPERROR *penmError, PKFSOBJ *ppLastAncestor) { PKFSDIR pParent = &pCache->RootDir; PKFSOBJ pRoot; KU32 off; KU32 cwcSlashes; KU32 offEnd; KFSCACHE_LOG2(("kFsCacheLookupAbsoluteW(%ls)\n", pwszPath)); /* * The root "directory" needs special handling, so we keep it outside the * main search loop. (Special: Cannot enumerate it, UNCs, ++.) */ cwcSlashes = 0; off = 0; if ( pwszPath[1] == ':' && IS_ALPHA(pwszPath[0])) { /* Drive letter. */ offEnd = 2; kHlpAssert(IS_SLASH(pwszPath[2])); pRoot = kFsCacheLookupDrive(pCache, toupper(pwszPath[0]), fFlags, penmError); } else if ( IS_SLASH(pwszPath[0]) && IS_SLASH(pwszPath[1]) ) pRoot = kFsCacheLookupUncShareW(pCache, pwszPath, fFlags, &offEnd, penmError); else { *penmError = KFSLOOKUPERROR_UNSUPPORTED; return NULL; } if (pRoot) { /* likely */ } else return NULL; /* Count slashes trailing the root spec. */ if (offEnd < cwcPath) { kHlpAssert(IS_SLASH(pwszPath[offEnd])); do cwcSlashes++; while (IS_SLASH(pwszPath[offEnd + cwcSlashes])); } /* Done already? */ if (offEnd >= cwcPath) { if ( pRoot->uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pRoot->uCacheGen == (pRoot->bObjType != KFSOBJ_TYPE_MISSING ? pCache->auGenerations[ pRoot->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerationsMissing[pRoot->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]) || (fFlags & KFSCACHE_LOOKUP_F_NO_REFRESH) || kFsCacheRefreshObj(pCache, pRoot, penmError)) return kFsCacheObjRetainInternal(pRoot); if (ppLastAncestor) *ppLastAncestor = kFsCacheObjRetainInternal(pRoot); return NULL; } /* Check that we've got a valid result and not a cached negative one. */ if (pRoot->bObjType == KFSOBJ_TYPE_DIR) { /* likely */ } else { kHlpAssert(pRoot->bObjType == KFSOBJ_TYPE_MISSING); kHlpAssert( pRoot->uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pRoot->uCacheGen == pCache->auGenerationsMissing[pRoot->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]); return pRoot; } /* * Now that we've found a valid root directory, lookup the * remainder of the path starting with it. */ return kFsCacheLookupRelativeToDirW(pCache, (PKFSDIR)pRoot, &pwszPath[offEnd + cwcSlashes], cwcPath - offEnd - cwcSlashes, fFlags, penmError, ppLastAncestor); } /** * This deals with paths that are relative and paths that contains '..' * elements, ANSI version. * * @returns Pointer to object corresponding to @a pszPath on success. * NULL if this isn't a path we care to cache. * * @param pCache The cache. * @param pszPath The path. * @param cchPath The length of the path. * @param fFlags Lookup flags, KFSCACHE_LOOKUP_F_XXX. * @param penmError Where to return details as to why the lookup * failed. * @param ppLastAncestor Where to return the last parent element found * (referenced) in case of error an path/file not * found problem. Optional. */ static PKFSOBJ kFsCacheLookupSlowA(PKFSCACHE pCache, const char *pszPath, KU32 cchPath, KU32 fFlags, KFSLOOKUPERROR *penmError, PKFSOBJ *ppLastAncestor) { /* * We just call GetFullPathNameA here to do the job as getcwd and _getdcwd * ends up calling it anyway. */ char szFull[KFSCACHE_CFG_MAX_PATH]; UINT cchFull = GetFullPathNameA(pszPath, sizeof(szFull), szFull, NULL); if ( cchFull >= 3 && cchFull < sizeof(szFull)) { KFSCACHE_LOG2(("kFsCacheLookupSlowA(%s)\n", pszPath)); return kFsCacheLookupAbsoluteA(pCache, szFull, cchFull, fFlags, penmError, ppLastAncestor); } /* The path is too long! */ kHlpAssertMsgFailed(("'%s' -> cchFull=%u\n", pszPath, cchFull)); *penmError = cchFull >= 3 ? KFSLOOKUPERROR_PATH_TOO_LONG : KFSLOOKUPERROR_PATH_TOO_SHORT; return NULL; } /** * This deals with paths that are relative and paths that contains '..' * elements, UTF-16 version. * * @returns Pointer to object corresponding to @a pszPath on success. * NULL if this isn't a path we care to cache. * * @param pCache The cache. * @param pwszPath The path. * @param cwcPath The length of the path (in wchar_t's). * @param fFlags Lookup flags, KFSCACHE_LOOKUP_F_XXX. * @param penmError Where to return details as to why the lookup * failed. * @param ppLastAncestor Where to return the last parent element found * (referenced) in case of error an path/file not * found problem. Optional. */ static PKFSOBJ kFsCacheLookupSlowW(PKFSCACHE pCache, const wchar_t *pwszPath, KU32 wcwPath, KU32 fFlags, KFSLOOKUPERROR *penmError, PKFSOBJ *ppLastAncestor) { /* * We just call GetFullPathNameA here to do the job as getcwd and _getdcwd * ends up calling it anyway. */ wchar_t wszFull[KFSCACHE_CFG_MAX_PATH]; UINT cwcFull = GetFullPathNameW(pwszPath, KFSCACHE_CFG_MAX_PATH, wszFull, NULL); if ( cwcFull >= 3 && cwcFull < KFSCACHE_CFG_MAX_PATH) { KFSCACHE_LOG2(("kFsCacheLookupSlowA(%ls)\n", pwszPath)); return kFsCacheLookupAbsoluteW(pCache, wszFull, cwcFull, fFlags, penmError, ppLastAncestor); } /* The path is too long! */ kHlpAssertMsgFailed(("'%ls' -> cwcFull=%u\n", pwszPath, cwcFull)); *penmError = cwcFull >= 3 ? KFSLOOKUPERROR_PATH_TOO_LONG : KFSLOOKUPERROR_PATH_TOO_SHORT; return NULL; } /** * Refreshes a path hash that has expired, ANSI version. * * @returns pHash on success, NULL if removed. * @param pCache The cache. * @param pHashEntry The path hash. * @param idxHashTab The hash table entry. */ static PKFSHASHA kFsCacheRefreshPathA(PKFSCACHE pCache, PKFSHASHA pHashEntry, KU32 idxHashTab) { PKFSOBJ pLastAncestor = NULL; if (!pHashEntry->pFsObj) { if (pHashEntry->fAbsolute) pHashEntry->pFsObj = kFsCacheLookupAbsoluteA(pCache, pHashEntry->pszPath, pHashEntry->cchPath, 0 /*fFlags*/, &pHashEntry->enmError, &pLastAncestor); else pHashEntry->pFsObj = kFsCacheLookupSlowA(pCache, pHashEntry->pszPath, pHashEntry->cchPath, 0 /*fFlags*/, &pHashEntry->enmError, &pLastAncestor); } else { KU8 bOldType = pHashEntry->pFsObj->bObjType; KFSLOOKUPERROR enmError; if (kFsCacheRefreshObj(pCache, pHashEntry->pFsObj, &enmError)) { if (pHashEntry->pFsObj->bObjType == bOldType) { } else { pHashEntry->pFsObj->cPathHashRefs -= 1; kFsCacheObjRelease(pCache, pHashEntry->pFsObj); if (pHashEntry->fAbsolute) pHashEntry->pFsObj = kFsCacheLookupAbsoluteA(pCache, pHashEntry->pszPath, pHashEntry->cchPath, 0 /*fFlags*/, &pHashEntry->enmError, &pLastAncestor); else pHashEntry->pFsObj = kFsCacheLookupSlowA(pCache, pHashEntry->pszPath, pHashEntry->cchPath, 0 /*fFlags*/, &pHashEntry->enmError, &pLastAncestor); } } else { fprintf(stderr, "kFsCacheRefreshPathA - refresh failure handling not implemented!\n"); __debugbreak(); /** @todo just remove this entry. */ return NULL; } } if (pLastAncestor && !pHashEntry->pFsObj) pHashEntry->idxMissingGen = pLastAncestor->fFlags & KFSOBJ_F_USE_CUSTOM_GEN; pHashEntry->uCacheGen = !pHashEntry->pFsObj ? pCache->auGenerationsMissing[pHashEntry->idxMissingGen] : pHashEntry->pFsObj->bObjType == KFSOBJ_TYPE_MISSING ? pCache->auGenerationsMissing[pHashEntry->pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerations[ pHashEntry->pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; if (pLastAncestor) kFsCacheObjRelease(pCache, pLastAncestor); return pHashEntry; } /** * Refreshes a path hash that has expired, UTF-16 version. * * @returns pHash on success, NULL if removed. * @param pCache The cache. * @param pHashEntry The path hash. * @param idxHashTab The hash table entry. */ static PKFSHASHW kFsCacheRefreshPathW(PKFSCACHE pCache, PKFSHASHW pHashEntry, KU32 idxHashTab) { PKFSOBJ pLastAncestor = NULL; if (!pHashEntry->pFsObj) { if (pHashEntry->fAbsolute) pHashEntry->pFsObj = kFsCacheLookupAbsoluteW(pCache, pHashEntry->pwszPath, pHashEntry->cwcPath, 0 /*fFlags*/, &pHashEntry->enmError, &pLastAncestor); else pHashEntry->pFsObj = kFsCacheLookupSlowW(pCache, pHashEntry->pwszPath, pHashEntry->cwcPath, 0 /*fFlags*/, &pHashEntry->enmError, &pLastAncestor); } else { KU8 bOldType = pHashEntry->pFsObj->bObjType; KFSLOOKUPERROR enmError; if (kFsCacheRefreshObj(pCache, pHashEntry->pFsObj, &enmError)) { if (pHashEntry->pFsObj->bObjType == bOldType) { } else { pHashEntry->pFsObj->cPathHashRefs -= 1; kFsCacheObjRelease(pCache, pHashEntry->pFsObj); if (pHashEntry->fAbsolute) pHashEntry->pFsObj = kFsCacheLookupAbsoluteW(pCache, pHashEntry->pwszPath, pHashEntry->cwcPath, 0 /*fFlags*/, &pHashEntry->enmError, &pLastAncestor); else pHashEntry->pFsObj = kFsCacheLookupSlowW(pCache, pHashEntry->pwszPath, pHashEntry->cwcPath, 0 /*fFlags*/, &pHashEntry->enmError, &pLastAncestor); } } else { fprintf(stderr, "kFsCacheRefreshPathW - refresh failure handling not implemented!\n"); fflush(stderr); __debugbreak(); /** @todo just remove this entry. */ return NULL; } } if (pLastAncestor && !pHashEntry->pFsObj) pHashEntry->idxMissingGen = pLastAncestor->fFlags & KFSOBJ_F_USE_CUSTOM_GEN; pHashEntry->uCacheGen = !pHashEntry->pFsObj ? pCache->auGenerationsMissing[pHashEntry->idxMissingGen] : pHashEntry->pFsObj->bObjType == KFSOBJ_TYPE_MISSING ? pCache->auGenerationsMissing[pHashEntry->pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerations[ pHashEntry->pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN]; if (pLastAncestor) kFsCacheObjRelease(pCache, pLastAncestor); return pHashEntry; } /** * Internal lookup worker that looks up a KFSOBJ for the given ANSI path with * length and hash. * * This will first try the hash table. If not in the hash table, the file * system cache tree is walked, missing bits filled in and finally a hash table * entry is created. * * Only drive letter paths are cachable. We don't do any UNC paths at this * point. * * @returns Reference to object corresponding to @a pszPath on success, this * must be released by kFsCacheObjRelease. * NULL if not a path we care to cache. * @param pCache The cache. * @param pchPath The path to lookup. * @param cchPath The path length. * @param uHashPath The hash of the path. * @param penmError Where to return details as to why the lookup * failed. */ static PKFSOBJ kFsCacheLookupHashedA(PKFSCACHE pCache, const char *pchPath, KU32 cchPath, KU32 uHashPath, KFSLOOKUPERROR *penmError) { /* * Do hash table lookup of the path. */ KU32 idxHashTab = uHashPath % K_ELEMENTS(pCache->apAnsiPaths); PKFSHASHA pHashEntry = pCache->apAnsiPaths[idxHashTab]; kHlpAssert(pCache->u32Magic == KFSCACHE_MAGIC); if (pHashEntry) { do { if ( pHashEntry->uHashPath == uHashPath && pHashEntry->cchPath == cchPath && kHlpMemComp(pHashEntry->pszPath, pchPath, cchPath) == 0) { PKFSOBJ pFsObj; if ( pHashEntry->uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pHashEntry->uCacheGen == ( (pFsObj = pHashEntry->pFsObj) != NULL ? pFsObj->bObjType != KFSOBJ_TYPE_MISSING ? pCache->auGenerations[ pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerationsMissing[pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerationsMissing[pHashEntry->idxMissingGen]) || (pHashEntry = kFsCacheRefreshPathA(pCache, pHashEntry, idxHashTab)) ) { pCache->cLookups++; pCache->cPathHashHits++; KFSCACHE_LOG2(("kFsCacheLookupA(%*.*s) - hit %p\n", cchPath, cchPath, pchPath, pHashEntry->pFsObj)); *penmError = pHashEntry->enmError; if (pHashEntry->pFsObj) return kFsCacheObjRetainInternal(pHashEntry->pFsObj); return NULL; } break; } pHashEntry = pHashEntry->pNext; } while (pHashEntry); } /* * Create an entry for it by walking the file system cache and filling in the blanks. */ if ( cchPath > 0 && cchPath < KFSCACHE_CFG_MAX_PATH) { PKFSOBJ pFsObj; KBOOL fAbsolute; PKFSOBJ pLastAncestor = NULL; /* Is absolute without any '..' bits? */ if ( cchPath >= 3 && ( ( pchPath[1] == ':' /* Drive letter */ && IS_SLASH(pchPath[2]) && IS_ALPHA(pchPath[0]) ) || ( IS_SLASH(pchPath[0]) /* UNC */ && IS_SLASH(pchPath[1]) ) ) && !kFsCacheHasDotDotA(pchPath, cchPath) ) { pFsObj = kFsCacheLookupAbsoluteA(pCache, pchPath, cchPath, 0 /*fFlags*/, penmError, &pLastAncestor); fAbsolute = K_TRUE; } else { pFsObj = kFsCacheLookupSlowA(pCache, pchPath, cchPath, 0 /*fFlags*/, penmError, &pLastAncestor); fAbsolute = K_FALSE; } if ( pFsObj || ( (pCache->fFlags & KFSCACHE_F_MISSING_PATHS) && *penmError != KFSLOOKUPERROR_PATH_TOO_LONG) || *penmError == KFSLOOKUPERROR_UNSUPPORTED ) kFsCacheCreatePathHashTabEntryA(pCache, pFsObj, pchPath, cchPath, uHashPath, idxHashTab, fAbsolute, pLastAncestor ? pLastAncestor->fFlags & KFSOBJ_F_USE_CUSTOM_GEN : 0, *penmError); if (pLastAncestor) kFsCacheObjRelease(pCache, pLastAncestor); pCache->cLookups++; if (pFsObj) pCache->cWalkHits++; return pFsObj; } *penmError = cchPath > 0 ? KFSLOOKUPERROR_PATH_TOO_LONG : KFSLOOKUPERROR_PATH_TOO_SHORT; return NULL; } /** * Internal lookup worker that looks up a KFSOBJ for the given UTF-16 path with * length and hash. * * This will first try the hash table. If not in the hash table, the file * system cache tree is walked, missing bits filled in and finally a hash table * entry is created. * * Only drive letter paths are cachable. We don't do any UNC paths at this * point. * * @returns Reference to object corresponding to @a pwcPath on success, this * must be released by kFsCacheObjRelease. * NULL if not a path we care to cache. * @param pCache The cache. * @param pwcPath The path to lookup. * @param cwcPath The length of the path (in wchar_t's). * @param uHashPath The hash of the path. * @param penmError Where to return details as to why the lookup * failed. */ static PKFSOBJ kFsCacheLookupHashedW(PKFSCACHE pCache, const wchar_t *pwcPath, KU32 cwcPath, KU32 uHashPath, KFSLOOKUPERROR *penmError) { /* * Do hash table lookup of the path. */ KU32 idxHashTab = uHashPath % K_ELEMENTS(pCache->apAnsiPaths); PKFSHASHW pHashEntry = pCache->apUtf16Paths[idxHashTab]; kHlpAssert(pCache->u32Magic == KFSCACHE_MAGIC); if (pHashEntry) { do { if ( pHashEntry->uHashPath == uHashPath && pHashEntry->cwcPath == cwcPath && kHlpMemComp(pHashEntry->pwszPath, pwcPath, cwcPath) == 0) { PKFSOBJ pFsObj; if ( pHashEntry->uCacheGen == KFSOBJ_CACHE_GEN_IGNORE || pHashEntry->uCacheGen == ((pFsObj = pHashEntry->pFsObj) != NULL ? pFsObj->bObjType != KFSOBJ_TYPE_MISSING ? pCache->auGenerations[ pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerationsMissing[pFsObj->fFlags & KFSOBJ_F_USE_CUSTOM_GEN] : pCache->auGenerationsMissing[pHashEntry->idxMissingGen]) || (pHashEntry = kFsCacheRefreshPathW(pCache, pHashEntry, idxHashTab)) ) { pCache->cLookups++; pCache->cPathHashHits++; KFSCACHE_LOG2(("kFsCacheLookupW(%*.*ls) - hit %p\n", cwcPath, cwcPath, pwcPath, pHashEntry->pFsObj)); *penmError = pHashEntry->enmError; if (pHashEntry->pFsObj) return kFsCacheObjRetainInternal(pHashEntry->pFsObj); return NULL; } break; } pHashEntry = pHashEntry->pNext; } while (pHashEntry); } /* * Create an entry for it by walking the file system cache and filling in the blanks. */ if ( cwcPath > 0 && cwcPath < KFSCACHE_CFG_MAX_PATH) { PKFSOBJ pFsObj; KBOOL fAbsolute; PKFSOBJ pLastAncestor = NULL; /* Is absolute without any '..' bits? */ if ( cwcPath >= 3 && ( ( pwcPath[1] == ':' /* Drive letter */ && IS_SLASH(pwcPath[2]) && IS_ALPHA(pwcPath[0]) ) || ( IS_SLASH(pwcPath[0]) /* UNC */ && IS_SLASH(pwcPath[1]) ) ) && !kFsCacheHasDotDotW(pwcPath, cwcPath) ) { pFsObj = kFsCacheLookupAbsoluteW(pCache, pwcPath, cwcPath, 0 /*fFlags*/, penmError, &pLastAncestor); fAbsolute = K_TRUE; } else { pFsObj = kFsCacheLookupSlowW(pCache, pwcPath, cwcPath, 0 /*fFlags*/, penmError, &pLastAncestor); fAbsolute = K_FALSE; } if ( pFsObj || ( (pCache->fFlags & KFSCACHE_F_MISSING_PATHS) && *penmError != KFSLOOKUPERROR_PATH_TOO_LONG) || *penmError == KFSLOOKUPERROR_UNSUPPORTED ) kFsCacheCreatePathHashTabEntryW(pCache, pFsObj, pwcPath, cwcPath, uHashPath, idxHashTab, fAbsolute, pLastAncestor ? pLastAncestor->fFlags & KFSOBJ_F_USE_CUSTOM_GEN : 0, *penmError); if (pLastAncestor) kFsCacheObjRelease(pCache, pLastAncestor); pCache->cLookups++; if (pFsObj) pCache->cWalkHits++; return pFsObj; } *penmError = cwcPath > 0 ? KFSLOOKUPERROR_PATH_TOO_LONG : KFSLOOKUPERROR_PATH_TOO_SHORT; return NULL; } /** * Looks up a KFSOBJ for the given ANSI path. * * This will first try the hash table. If not in the hash table, the file * system cache tree is walked, missing bits filled in and finally a hash table * entry is created. * * Only drive letter paths are cachable. We don't do any UNC paths at this * point. * * @returns Reference to object corresponding to @a pszPath on success, this * must be released by kFsCacheObjRelease. * NULL if not a path we care to cache. * @param pCache The cache. * @param pszPath The path to lookup. * @param penmError Where to return details as to why the lookup * failed. */ PKFSOBJ kFsCacheLookupA(PKFSCACHE pCache, const char *pszPath, KFSLOOKUPERROR *penmError) { KU32 uHashPath; KU32 cchPath = (KU32)kFsCacheStrHashEx(pszPath, &uHashPath); PKFSOBJ pObj; KFSCACHE_LOCK(pCache); pObj = kFsCacheLookupHashedA(pCache, pszPath, cchPath, uHashPath, penmError); KFSCACHE_UNLOCK(pCache); return pObj; } /** * Looks up a KFSOBJ for the given UTF-16 path. * * This will first try the hash table. If not in the hash table, the file * system cache tree is walked, missing bits filled in and finally a hash table * entry is created. * * Only drive letter paths are cachable. We don't do any UNC paths at this * point. * * @returns Reference to object corresponding to @a pwszPath on success, this * must be released by kFsCacheObjRelease. * NULL if not a path we care to cache. * @param pCache The cache. * @param pwszPath The path to lookup. * @param penmError Where to return details as to why the lookup * failed. */ PKFSOBJ kFsCacheLookupW(PKFSCACHE pCache, const wchar_t *pwszPath, KFSLOOKUPERROR *penmError) { KU32 uHashPath; KU32 cwcPath = (KU32)kFsCacheUtf16HashEx(pwszPath, &uHashPath); PKFSOBJ pObj; KFSCACHE_LOCK(pCache); pObj = kFsCacheLookupHashedW(pCache, pwszPath, cwcPath, uHashPath, penmError); KFSCACHE_UNLOCK(pCache); return pObj; } /** * Looks up a KFSOBJ for the given ANSI path. * * This will first try the hash table. If not in the hash table, the file * system cache tree is walked, missing bits filled in and finally a hash table * entry is created. * * Only drive letter paths are cachable. We don't do any UNC paths at this * point. * * @returns Reference to object corresponding to @a pchPath on success, this * must be released by kFsCacheObjRelease. * NULL if not a path we care to cache. * @param pCache The cache. * @param pchPath The path to lookup (does not need to be nul * terminated). * @param cchPath The path length. * @param penmError Where to return details as to why the lookup * failed. */ PKFSOBJ kFsCacheLookupWithLengthA(PKFSCACHE pCache, const char *pchPath, KSIZE cchPath, KFSLOOKUPERROR *penmError) { KU32 uHashPath = kFsCacheStrHashN(pchPath, cchPath); PKFSOBJ pObj; KFSCACHE_LOCK(pCache); pObj = kFsCacheLookupHashedA(pCache, pchPath, (KU32)cchPath, uHashPath, penmError); KFSCACHE_UNLOCK(pCache); return pObj; } /** * Looks up a KFSOBJ for the given UTF-16 path. * * This will first try the hash table. If not in the hash table, the file * system cache tree is walked, missing bits filled in and finally a hash table * entry is created. * * Only drive letter paths are cachable. We don't do any UNC paths at this * point. * * @returns Reference to object corresponding to @a pwchPath on success, this * must be released by kFsCacheObjRelease. * NULL if not a path we care to cache. * @param pCache The cache. * @param pwcPath The path to lookup (does not need to be nul * terminated). * @param cwcPath The path length (in wchar_t's). * @param penmError Where to return details as to why the lookup * failed. */ PKFSOBJ kFsCacheLookupWithLengthW(PKFSCACHE pCache, const wchar_t *pwcPath, KSIZE cwcPath, KFSLOOKUPERROR *penmError) { KU32 uHashPath = kFsCacheUtf16HashN(pwcPath, cwcPath); PKFSOBJ pObj; KFSCACHE_LOCK(pCache); pObj = kFsCacheLookupHashedW(pCache, pwcPath, (KU32)cwcPath, uHashPath, penmError); KFSCACHE_UNLOCK(pCache); return pObj; } /** * Wrapper around kFsCacheLookupA that drops KFSOBJ_TYPE_MISSING and returns * KFSLOOKUPERROR_NOT_FOUND instead. * * @returns Reference to object corresponding to @a pszPath on success, this * must be released by kFsCacheObjRelease. * NULL if not a path we care to cache. * @param pCache The cache. * @param pszPath The path to lookup. * @param penmError Where to return details as to why the lookup * failed. */ PKFSOBJ kFsCacheLookupNoMissingA(PKFSCACHE pCache, const char *pszPath, KFSLOOKUPERROR *penmError) { PKFSOBJ pObj; KFSCACHE_LOCK(pCache); /* probably not necessary */ pObj = kFsCacheLookupA(pCache, pszPath, penmError); if (pObj) { if (pObj->bObjType != KFSOBJ_TYPE_MISSING) { KFSCACHE_UNLOCK(pCache); return pObj; } kFsCacheObjRelease(pCache, pObj); *penmError = KFSLOOKUPERROR_NOT_FOUND; } KFSCACHE_UNLOCK(pCache); return NULL; } /** * Wrapper around kFsCacheLookupW that drops KFSOBJ_TYPE_MISSING and returns * KFSLOOKUPERROR_NOT_FOUND instead. * * @returns Reference to object corresponding to @a pszPath on success, this * must be released by kFsCacheObjRelease. * NULL if not a path we care to cache. * @param pCache The cache. * @param pwszPath The path to lookup. * @param penmError Where to return details as to why the lookup * failed. */ PKFSOBJ kFsCacheLookupNoMissingW(PKFSCACHE pCache, const wchar_t *pwszPath, KFSLOOKUPERROR *penmError) { PKFSOBJ pObj; KFSCACHE_LOCK(pCache); /* probably not necessary */ pObj = kFsCacheLookupW(pCache, pwszPath, penmError); if (pObj) { if (pObj->bObjType != KFSOBJ_TYPE_MISSING) { KFSCACHE_UNLOCK(pCache); return pObj; } kFsCacheObjRelease(pCache, pObj); *penmError = KFSLOOKUPERROR_NOT_FOUND; } KFSCACHE_UNLOCK(pCache); return NULL; } /** * Destroys a cache object which has a zero reference count. * * @returns 0 * @param pCache The cache. * @param pObj The object. * @param pszWhere Where it was released from. */ KU32 kFsCacheObjDestroy(PKFSCACHE pCache, PKFSOBJ pObj, const char *pszWhere) { kHlpAssert(pObj->cRefs == 0); kHlpAssert(pObj->pParent == NULL); kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC); KFSCACHE_LOCK(pCache); KFSCACHE_LOG(("Destroying %s/%s, type=%d, pObj=%p, pszWhere=%s\n", pObj->pParent ? pObj->pParent->Obj.pszName : "", pObj->pszName, pObj->bObjType, pObj, pszWhere)); if (pObj->cPathHashRefs != 0) { fprintf(stderr, "Destroying %s/%s, type=%d, path hash entries: %d!\n", pObj->pParent ? pObj->pParent->Obj.pszName : "", pObj->pszName, pObj->bObjType, pObj->cPathHashRefs); fflush(stderr); __debugbreak(); } /* * Invalidate the structure. */ pObj->u32Magic = ~KFSOBJ_MAGIC; /* * Destroy any user data first. */ while (pObj->pUserDataHead != NULL) { PKFSUSERDATA pUserData = pObj->pUserDataHead; pObj->pUserDataHead = pUserData->pNext; if (pUserData->pfnDestructor) pUserData->pfnDestructor(pCache, pObj, pUserData); kHlpFree(pUserData); } /* * Do type specific destruction */ switch (pObj->bObjType) { case KFSOBJ_TYPE_MISSING: /* nothing else to do here */ pCache->cbObjects -= sizeof(KFSDIR); break; case KFSOBJ_TYPE_DIR: { PKFSDIR pDir = (PKFSDIR)pObj; KU32 cChildren = pDir->cChildren; pCache->cbObjects -= sizeof(*pDir) + K_ALIGN_Z(cChildren, 16) * sizeof(pDir->papChildren) + (pDir->fHashTabMask + !!pDir->fHashTabMask) * sizeof(pDir->papHashTab[0]); pDir->cChildren = 0; while (cChildren-- > 0) kFsCacheObjRelease(pCache, pDir->papChildren[cChildren]); kHlpFree(pDir->papChildren); pDir->papChildren = NULL; kHlpFree(pDir->papHashTab); pDir->papHashTab = NULL; break; } case KFSOBJ_TYPE_FILE: case KFSOBJ_TYPE_OTHER: pCache->cbObjects -= sizeof(*pObj); break; default: KFSCACHE_UNLOCK(pCache); return 0; } /* * Common bits. */ pCache->cbObjects -= pObj->cchName + 1; #ifdef KFSCACHE_CFG_UTF16 pCache->cbObjects -= (pObj->cwcName + 1) * sizeof(wchar_t); #endif #ifdef KFSCACHE_CFG_SHORT_NAMES if (pObj->pszName != pObj->pszShortName) { pCache->cbObjects -= pObj->cchShortName + 1; # ifdef KFSCACHE_CFG_UTF16 pCache->cbObjects -= (pObj->cwcShortName + 1) * sizeof(wchar_t); # endif } #endif pCache->cObjects--; if (pObj->pNameAlloc) { pCache->cbObjects -= pObj->pNameAlloc->cb; kHlpFree(pObj->pNameAlloc); } KFSCACHE_UNLOCK(pCache); kHlpFree(pObj); return 0; } /** * Releases a reference to a cache object. * * @returns New reference count. * @param pCache The cache. * @param pObj The object. */ #undef kFsCacheObjRelease KU32 kFsCacheObjRelease(PKFSCACHE pCache, PKFSOBJ pObj) { if (pObj) { KU32 cRefs; kHlpAssert(pCache->u32Magic == KFSCACHE_MAGIC); kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC); cRefs = _InterlockedDecrement(&pObj->cRefs); if (cRefs) return cRefs; return kFsCacheObjDestroy(pCache, pObj, "kFsCacheObjRelease"); } return 0; } /** * Debug version of kFsCacheObjRelease * * @returns New reference count. * @param pCache The cache. * @param pObj The object. * @param pszWhere Where it's invoked from. */ KU32 kFsCacheObjReleaseTagged(PKFSCACHE pCache, PKFSOBJ pObj, const char *pszWhere) { if (pObj) { KU32 cRefs; kHlpAssert(pCache->u32Magic == KFSCACHE_MAGIC); kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC); cRefs = _InterlockedDecrement(&pObj->cRefs); if (cRefs) return cRefs; return kFsCacheObjDestroy(pCache, pObj, pszWhere); } return 0; } /** * Retains a reference to a cahce object. * * @returns New reference count. * @param pObj The object. */ KU32 kFsCacheObjRetain(PKFSOBJ pObj) { KU32 cRefs; kHlpAssert(pCache->u32Magic == KFSCACHE_MAGIC); kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC); cRefs = _InterlockedIncrement(&pObj->cRefs); kHlpAssert(cRefs < 16384); return cRefs; } /** * Associates an item of user data with the given object. * * If the data needs cleaning up before being free, set the * PKFSUSERDATA::pfnDestructor member of the returned structure. * * @returns Pointer to the user data on success. * NULL if out of memory or key already in use. * * @param pCache The cache. * @param pObj The object. * @param uKey The user data key. * @param cbUserData The size of the user data. */ PKFSUSERDATA kFsCacheObjAddUserData(PKFSCACHE pCache, PKFSOBJ pObj, KUPTR uKey, KSIZE cbUserData) { kHlpAssert(cbUserData >= sizeof(*pNew)); KFSCACHE_OBJUSERDATA_LOCK(pCache, pObj); if (kFsCacheObjGetUserData(pCache, pObj, uKey) == NULL) { PKFSUSERDATA pNew = (PKFSUSERDATA)kHlpAllocZ(cbUserData); if (pNew) { pNew->uKey = uKey; pNew->pfnDestructor = NULL; pNew->pNext = pObj->pUserDataHead; pObj->pUserDataHead = pNew; KFSCACHE_OBJUSERDATA_UNLOCK(pCache, pObj); return pNew; } } KFSCACHE_OBJUSERDATA_UNLOCK(pCache, pObj); return NULL; } /** * Retrieves an item of user data associated with the given object. * * @returns Pointer to the associated user data if found, otherwise NULL. * @param pCache The cache. * @param pObj The object. * @param uKey The user data key. */ PKFSUSERDATA kFsCacheObjGetUserData(PKFSCACHE pCache, PKFSOBJ pObj, KUPTR uKey) { PKFSUSERDATA pCur; kHlpAssert(pCache->u32Magic == KFSCACHE_MAGIC); kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC); KFSCACHE_OBJUSERDATA_LOCK(pCache, pObj); for (pCur = pObj->pUserDataHead; pCur; pCur = pCur->pNext) if (pCur->uKey == uKey) { KFSCACHE_OBJUSERDATA_UNLOCK(pCache, pObj); return pCur; } KFSCACHE_OBJUSERDATA_UNLOCK(pCache, pObj); return NULL; } /** * Determins the idxUserDataLock value. * * Called by KFSCACHE_OBJUSERDATA_LOCK when idxUserDataLock is set to KU8_MAX. * * @returns The proper idxUserDataLock value. * @param pCache The cache. * @param pObj The object. */ KU8 kFsCacheObjGetUserDataLockIndex(PKFSCACHE pCache, PKFSOBJ pObj) { KU8 idxUserDataLock = pObj->idxUserDataLock; if (idxUserDataLock == KU8_MAX) { KFSCACHE_LOCK(pCache); idxUserDataLock = pObj->idxUserDataLock; if (idxUserDataLock == KU8_MAX) { idxUserDataLock = pCache->idxUserDataNext++; idxUserDataLock %= K_ELEMENTS(pCache->auUserDataLocks); pObj->idxUserDataLock = idxUserDataLock; } KFSCACHE_UNLOCK(pCache); } return idxUserDataLock; } /** * Gets the full path to @a pObj, ANSI version. * * @returns K_TRUE on success, K_FALSE on buffer overflow (nothing stored). * @param pObj The object to get the full path to. * @param pszPath Where to return the path * @param cbPath The size of the output buffer. * @param chSlash The slash to use. */ KBOOL kFsCacheObjGetFullPathA(PKFSOBJ pObj, char *pszPath, KSIZE cbPath, char chSlash) { /** @todo No way of to do locking here w/o pCache parameter; need to verify * that we're only access static data! */ KSIZE off = pObj->cchParent; kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC); if (off > 0) { KSIZE offEnd = off + pObj->cchName; if (offEnd < cbPath) { PKFSDIR pAncestor; pszPath[off + pObj->cchName] = '\0'; memcpy(&pszPath[off], pObj->pszName, pObj->cchName); for (pAncestor = pObj->pParent; off > 0; pAncestor = pAncestor->Obj.pParent) { kHlpAssert(off > 1); kHlpAssert(pAncestor != NULL); kHlpAssert(pAncestor->Obj.cchName > 0); pszPath[--off] = chSlash; off -= pAncestor->Obj.cchName; kHlpAssert(pAncestor->Obj.cchParent == off); memcpy(&pszPath[off], pAncestor->Obj.pszName, pAncestor->Obj.cchName); } return K_TRUE; } } else { KBOOL const fDriveLetter = pObj->cchName == 2 && pObj->pszName[2] == ':'; off = pObj->cchName; if (off + fDriveLetter < cbPath) { memcpy(pszPath, pObj->pszName, off); if (fDriveLetter) pszPath[off++] = chSlash; pszPath[off] = '\0'; return K_TRUE; } } return K_FALSE; } /** * Gets the full path to @a pObj, UTF-16 version. * * @returns K_TRUE on success, K_FALSE on buffer overflow (nothing stored). * @param pObj The object to get the full path to. * @param pszPath Where to return the path * @param cbPath The size of the output buffer. * @param wcSlash The slash to use. */ KBOOL kFsCacheObjGetFullPathW(PKFSOBJ pObj, wchar_t *pwszPath, KSIZE cwcPath, wchar_t wcSlash) { /** @todo No way of to do locking here w/o pCache parameter; need to verify * that we're only access static data! */ KSIZE off = pObj->cwcParent; kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC); if (off > 0) { KSIZE offEnd = off + pObj->cwcName; if (offEnd < cwcPath) { PKFSDIR pAncestor; pwszPath[off + pObj->cwcName] = '\0'; memcpy(&pwszPath[off], pObj->pwszName, pObj->cwcName * sizeof(wchar_t)); for (pAncestor = pObj->pParent; off > 0; pAncestor = pAncestor->Obj.pParent) { kHlpAssert(off > 1); kHlpAssert(pAncestor != NULL); kHlpAssert(pAncestor->Obj.cwcName > 0); pwszPath[--off] = wcSlash; off -= pAncestor->Obj.cwcName; kHlpAssert(pAncestor->Obj.cwcParent == off); memcpy(&pwszPath[off], pAncestor->Obj.pwszName, pAncestor->Obj.cwcName * sizeof(wchar_t)); } return K_TRUE; } } else { KBOOL const fDriveLetter = pObj->cchName == 2 && pObj->pszName[2] == ':'; off = pObj->cwcName; if (off + fDriveLetter < cwcPath) { memcpy(pwszPath, pObj->pwszName, off * sizeof(wchar_t)); if (fDriveLetter) pwszPath[off++] = wcSlash; pwszPath[off] = '\0'; return K_TRUE; } } return K_FALSE; } #ifdef KFSCACHE_CFG_SHORT_NAMES /** * Gets the full short path to @a pObj, ANSI version. * * @returns K_TRUE on success, K_FALSE on buffer overflow (nothing stored). * @param pObj The object to get the full path to. * @param pszPath Where to return the path * @param cbPath The size of the output buffer. * @param chSlash The slash to use. */ KBOOL kFsCacheObjGetFullShortPathA(PKFSOBJ pObj, char *pszPath, KSIZE cbPath, char chSlash) { /** @todo No way of to do locking here w/o pCache parameter; need to verify * that we're only access static data! */ KSIZE off = pObj->cchShortParent; kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC); if (off > 0) { KSIZE offEnd = off + pObj->cchShortName; if (offEnd < cbPath) { PKFSDIR pAncestor; pszPath[off + pObj->cchShortName] = '\0'; memcpy(&pszPath[off], pObj->pszShortName, pObj->cchShortName); for (pAncestor = pObj->pParent; off > 0; pAncestor = pAncestor->Obj.pParent) { kHlpAssert(off > 1); kHlpAssert(pAncestor != NULL); kHlpAssert(pAncestor->Obj.cchShortName > 0); pszPath[--off] = chSlash; off -= pAncestor->Obj.cchShortName; kHlpAssert(pAncestor->Obj.cchShortParent == off); memcpy(&pszPath[off], pAncestor->Obj.pszShortName, pAncestor->Obj.cchShortName); } return K_TRUE; } } else { KBOOL const fDriveLetter = pObj->cchShortName == 2 && pObj->pszShortName[2] == ':'; off = pObj->cchShortName; if (off + fDriveLetter < cbPath) { memcpy(pszPath, pObj->pszShortName, off); if (fDriveLetter) pszPath[off++] = chSlash; pszPath[off] = '\0'; return K_TRUE; } } return K_FALSE; } /** * Gets the full short path to @a pObj, UTF-16 version. * * @returns K_TRUE on success, K_FALSE on buffer overflow (nothing stored). * @param pObj The object to get the full path to. * @param pszPath Where to return the path * @param cbPath The size of the output buffer. * @param wcSlash The slash to use. */ KBOOL kFsCacheObjGetFullShortPathW(PKFSOBJ pObj, wchar_t *pwszPath, KSIZE cwcPath, wchar_t wcSlash) { /** @todo No way of to do locking here w/o pCache parameter; need to verify * that we're only access static data! */ KSIZE off = pObj->cwcShortParent; kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC); if (off > 0) { KSIZE offEnd = off + pObj->cwcShortName; if (offEnd < cwcPath) { PKFSDIR pAncestor; pwszPath[off + pObj->cwcShortName] = '\0'; memcpy(&pwszPath[off], pObj->pwszShortName, pObj->cwcShortName * sizeof(wchar_t)); for (pAncestor = pObj->pParent; off > 0; pAncestor = pAncestor->Obj.pParent) { kHlpAssert(off > 1); kHlpAssert(pAncestor != NULL); kHlpAssert(pAncestor->Obj.cwcShortName > 0); pwszPath[--off] = wcSlash; off -= pAncestor->Obj.cwcShortName; kHlpAssert(pAncestor->Obj.cwcShortParent == off); memcpy(&pwszPath[off], pAncestor->Obj.pwszShortName, pAncestor->Obj.cwcShortName * sizeof(wchar_t)); } return K_TRUE; } } else { KBOOL const fDriveLetter = pObj->cchShortName == 2 && pObj->pszShortName[2] == ':'; off = pObj->cwcShortName; if (off + fDriveLetter < cwcPath) { memcpy(pwszPath, pObj->pwszShortName, off * sizeof(wchar_t)); if (fDriveLetter) pwszPath[off++] = wcSlash; pwszPath[off] = '\0'; return K_TRUE; } } return K_FALSE; } #endif /* KFSCACHE_CFG_SHORT_NAMES */ /** * Read the specified bits from the files into the given buffer, simple version. * * @returns K_TRUE on success (all requested bytes read), * K_FALSE on any kind of failure. * * @param pCache The cache. * @param pFileObj The file object. * @param offStart Where to start reading. * @param pvBuf Where to store what we read. * @param cbToRead How much to read (exact). */ KBOOL kFsCacheFileSimpleOpenReadClose(PKFSCACHE pCache, PKFSOBJ pFileObj, KU64 offStart, void *pvBuf, KSIZE cbToRead) { /* * Open the file relative to the parent directory. */ MY_NTSTATUS rcNt; HANDLE hFile; MY_IO_STATUS_BLOCK Ios; MY_OBJECT_ATTRIBUTES ObjAttr; MY_UNICODE_STRING UniStr; kHlpAssertReturn(pFileObj->bObjType == KFSOBJ_TYPE_FILE, K_FALSE); kHlpAssert(pFileObj->pParent); kHlpAssertReturn(pFileObj->pParent->hDir != INVALID_HANDLE_VALUE, K_FALSE); kHlpAssertReturn(offStart == 0, K_FALSE); /** @todo when needed */ Ios.Information = -1; Ios.u.Status = -1; UniStr.Buffer = (wchar_t *)pFileObj->pwszName; UniStr.Length = (USHORT)(pFileObj->cwcName * sizeof(wchar_t)); UniStr.MaximumLength = UniStr.Length + sizeof(wchar_t); /** @todo potential race against kFsCacheInvalidateDeletedDirectoryA */ MyInitializeObjectAttributes(&ObjAttr, &UniStr, OBJ_CASE_INSENSITIVE, pFileObj->pParent->hDir, NULL /*pSecAttr*/); rcNt = g_pfnNtCreateFile(&hFile, GENERIC_READ | SYNCHRONIZE, &ObjAttr, &Ios, NULL, /*cbFileInitialAlloc */ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, NULL, /*pEaBuffer*/ 0); /*cbEaBuffer*/ if (MY_NT_SUCCESS(rcNt)) { LARGE_INTEGER offFile; offFile.QuadPart = offStart; Ios.Information = -1; Ios.u.Status = -1; rcNt = g_pfnNtReadFile(hFile, NULL /*hEvent*/, NULL /*pfnApcComplete*/, NULL /*pvApcCtx*/, &Ios, pvBuf, (KU32)cbToRead, !offStart ? &offFile : NULL, NULL /*puKey*/); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) { if (Ios.Information == cbToRead) { g_pfnNtClose(hFile); return K_TRUE; } KFSCACHE_LOG(("Error reading %#x bytes from '%ls': Information=%p\n", pFileObj->pwszName, Ios.Information)); } else KFSCACHE_LOG(("Error reading %#x bytes from '%ls': %#x\n", pFileObj->pwszName, rcNt)); g_pfnNtClose(hFile); } else KFSCACHE_LOG(("Error opening '%ls' for caching: %#x\n", pFileObj->pwszName, rcNt)); return K_FALSE; } /** * Invalidate all cache entries of missing files. * * @param pCache The cache. */ void kFsCacheInvalidateMissing(PKFSCACHE pCache) { kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC); KFSCACHE_LOCK(pCache); pCache->auGenerationsMissing[0]++; kHlpAssert(pCache->uGenerationMissing < KU32_MAX); KFSCACHE_LOG(("Invalidate missing %#x\n", pCache->auGenerationsMissing[0])); KFSCACHE_UNLOCK(pCache); } /** * Recursively close directories. */ static void kFsCacheCloseDirs(PKFSOBJ *papChildren, KU32 cChildren) { while (cChildren-- > 0) { PKFSDIR pDir = (PKFSDIR)papChildren[cChildren]; if (pDir && pDir->Obj.bObjType == KFSOBJ_TYPE_DIR) { if (pDir->hDir != INVALID_HANDLE_VALUE) { g_pfnNtClose(pDir->hDir); pDir->hDir = INVALID_HANDLE_VALUE; } kFsCacheCloseDirs(pDir->papChildren, pDir->cChildren); } } } /** * Worker for kFsCacheInvalidateAll and kFsCacheInvalidateAllAndCloseDirs */ static void kFsCacheInvalidateAllWorker(PKFSCACHE pCache, KBOOL fCloseDirs, KBOOL fIncludingRoot) { kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC); KFSCACHE_LOCK(pCache); pCache->auGenerationsMissing[0]++; kHlpAssert(pCache->auGenerationsMissing[0] < KU32_MAX); pCache->auGenerationsMissing[1]++; kHlpAssert(pCache->auGenerationsMissing[1] < KU32_MAX); pCache->auGenerations[0]++; kHlpAssert(pCache->auGenerations[0] < KU32_MAX); pCache->auGenerations[1]++; kHlpAssert(pCache->auGenerations[1] < KU32_MAX); if (fCloseDirs) { kFsCacheCloseDirs(pCache->RootDir.papChildren, pCache->RootDir.cChildren); if (fCloseDirs && pCache->RootDir.hDir != INVALID_HANDLE_VALUE) { g_pfnNtClose(pCache->RootDir.hDir); pCache->RootDir.hDir = INVALID_HANDLE_VALUE; } } KFSCACHE_LOG(("Invalidate all - default: %#x/%#x, custom: %#x/%#x\n", pCache->auGenerationsMissing[0], pCache->auGenerations[0], pCache->auGenerationsMissing[1], pCache->auGenerations[1])); KFSCACHE_UNLOCK(pCache); } /** * Invalidate all cache entries (regular, custom & missing). * * @param pCache The cache. */ void kFsCacheInvalidateAll(PKFSCACHE pCache) { kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC); kFsCacheInvalidateAllWorker(pCache, K_FALSE, K_FALSE); } /** * Invalidate all cache entries (regular, custom & missing) and close all the * directory handles. * * @param pCache The cache. * @param fIncludingRoot Close the root directory handle too. */ void kFsCacheInvalidateAllAndCloseDirs(PKFSCACHE pCache, KBOOL fIncludingRoot) { kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC); kFsCacheInvalidateAllWorker(pCache, K_TRUE, fIncludingRoot); } /** * Invalidate all cache entries with custom generation handling set. * * @see kFsCacheSetupCustomRevisionForTree, KFSOBJ_F_USE_CUSTOM_GEN * @param pCache The cache. */ void kFsCacheInvalidateCustomMissing(PKFSCACHE pCache) { kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC); KFSCACHE_LOCK(pCache); pCache->auGenerationsMissing[1]++; kHlpAssert(pCache->auGenerationsMissing[1] < KU32_MAX); KFSCACHE_LOG(("Invalidate missing custom %#x\n", pCache->auGenerationsMissing[1])); KFSCACHE_UNLOCK(pCache); } /** * Invalidate all cache entries with custom generation handling set, both * missing and regular present entries. * * @see kFsCacheSetupCustomRevisionForTree, KFSOBJ_F_USE_CUSTOM_GEN * @param pCache The cache. */ void kFsCacheInvalidateCustomBoth(PKFSCACHE pCache) { kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC); KFSCACHE_LOCK(pCache); pCache->auGenerations[1]++; kHlpAssert(pCache->auGenerations[1] < KU32_MAX); pCache->auGenerationsMissing[1]++; kHlpAssert(pCache->auGenerationsMissing[1] < KU32_MAX); KFSCACHE_LOG(("Invalidate both custom %#x/%#x\n", pCache->auGenerationsMissing[1], pCache->auGenerations[1])); KFSCACHE_UNLOCK(pCache); } /** * Applies the given flags to all the objects in a tree. * * @param pRoot Where to start applying the flag changes. * @param fAndMask The AND mask. * @param fOrMask The OR mask. */ static void kFsCacheApplyFlagsToTree(PKFSDIR pRoot, KU32 fAndMask, KU32 fOrMask) { PKFSOBJ *ppCur = ((PKFSDIR)pRoot)->papChildren; KU32 cLeft = ((PKFSDIR)pRoot)->cChildren; while (cLeft-- > 0) { PKFSOBJ pCur = *ppCur++; if (pCur->bObjType != KFSOBJ_TYPE_DIR) pCur->fFlags = (fAndMask & pCur->fFlags) | fOrMask; else kFsCacheApplyFlagsToTree((PKFSDIR)pCur, fAndMask, fOrMask); } pRoot->Obj.fFlags = (fAndMask & pRoot->Obj.fFlags) | fOrMask; } /** * Sets up using custom revisioning for the specified directory tree or file. * * There are some restrictions of the current implementation: * - If the root of the sub-tree is ever deleted from the cache (i.e. * deleted in real life and reflected in the cache), the setting is lost. * - It is not automatically applied to the lookup paths caches. * * @returns K_TRUE on success, K_FALSE on failure. * @param pCache The cache. * @param pRoot The root of the subtree. A non-directory is * fine, like a missing node. */ KBOOL kFsCacheSetupCustomRevisionForTree(PKFSCACHE pCache, PKFSOBJ pRoot) { if (pRoot) { KFSCACHE_LOCK(pCache); if (pRoot->bObjType == KFSOBJ_TYPE_DIR) kFsCacheApplyFlagsToTree((PKFSDIR)pRoot, KU32_MAX, KFSOBJ_F_USE_CUSTOM_GEN); else pRoot->fFlags |= KFSOBJ_F_USE_CUSTOM_GEN; KFSCACHE_UNLOCK(pCache); return K_TRUE; } return K_FALSE; } /** * Invalidates a deleted directory, ANSI version. * * @returns K_TRUE if found and is a non-root directory. Otherwise K_FALSE. * @param pCache The cache. * @param pszDir The directory. */ KBOOL kFsCacheInvalidateDeletedDirectoryA(PKFSCACHE pCache, const char *pszDir) { KU32 cchDir = (KU32)kHlpStrLen(pszDir); KFSLOOKUPERROR enmError; PKFSOBJ pFsObj; KFSCACHE_LOCK(pCache); /* Is absolute without any '..' bits? */ if ( cchDir >= 3 && ( ( pszDir[1] == ':' /* Drive letter */ && IS_SLASH(pszDir[2]) && IS_ALPHA(pszDir[0]) ) || ( IS_SLASH(pszDir[0]) /* UNC */ && IS_SLASH(pszDir[1]) ) ) && !kFsCacheHasDotDotA(pszDir, cchDir) ) pFsObj = kFsCacheLookupAbsoluteA(pCache, pszDir, cchDir, KFSCACHE_LOOKUP_F_NO_INSERT | KFSCACHE_LOOKUP_F_NO_REFRESH, &enmError, NULL); else pFsObj = kFsCacheLookupSlowA(pCache, pszDir, cchDir, KFSCACHE_LOOKUP_F_NO_INSERT | KFSCACHE_LOOKUP_F_NO_REFRESH, &enmError, NULL); if (pFsObj) { /* Is directory? */ if (pFsObj->bObjType == KFSOBJ_TYPE_DIR) { if (pFsObj->pParent != &pCache->RootDir) { PKFSDIR pDir = (PKFSDIR)pFsObj; KFSCACHE_LOG(("kFsCacheInvalidateDeletedDirectoryA: %s hDir=%p\n", pszDir, pDir->hDir)); if (pDir->hDir != INVALID_HANDLE_VALUE) { g_pfnNtClose(pDir->hDir); pDir->hDir = INVALID_HANDLE_VALUE; } pDir->fNeedRePopulating = K_TRUE; pDir->Obj.uCacheGen = pCache->auGenerations[pDir->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN] - 1; kFsCacheObjRelease(pCache, &pDir->Obj); KFSCACHE_UNLOCK(pCache); return K_TRUE; } KFSCACHE_LOG(("kFsCacheInvalidateDeletedDirectoryA: Trying to invalidate a root directory was deleted! %s\n", pszDir)); } else KFSCACHE_LOG(("kFsCacheInvalidateDeletedDirectoryA: Trying to invalidate a non-directory: bObjType=%d %s\n", pFsObj->bObjType, pszDir)); kFsCacheObjRelease(pCache, pFsObj); } else KFSCACHE_LOG(("kFsCacheInvalidateDeletedDirectoryA: '%s' was not found\n", pszDir)); KFSCACHE_UNLOCK(pCache); return K_FALSE; } PKFSCACHE kFsCacheCreate(KU32 fFlags) { PKFSCACHE pCache; birdResolveImports(); pCache = (PKFSCACHE)kHlpAllocZ(sizeof(*pCache)); if (pCache) { /* Dummy root dir entry. */ pCache->RootDir.Obj.u32Magic = KFSOBJ_MAGIC; pCache->RootDir.Obj.cRefs = 1; pCache->RootDir.Obj.uCacheGen = KFSOBJ_CACHE_GEN_IGNORE; pCache->RootDir.Obj.bObjType = KFSOBJ_TYPE_DIR; pCache->RootDir.Obj.fHaveStats = K_FALSE; pCache->RootDir.Obj.pParent = NULL; pCache->RootDir.Obj.pszName = ""; pCache->RootDir.Obj.cchName = 0; pCache->RootDir.Obj.cchParent = 0; #ifdef KFSCACHE_CFG_UTF16 pCache->RootDir.Obj.cwcName = 0; pCache->RootDir.Obj.cwcParent = 0; pCache->RootDir.Obj.pwszName = L""; #endif #ifdef KFSCACHE_CFG_SHORT_NAMES pCache->RootDir.Obj.pszShortName = NULL; pCache->RootDir.Obj.cchShortName = 0; pCache->RootDir.Obj.cchShortParent = 0; # ifdef KFSCACHE_CFG_UTF16 pCache->RootDir.Obj.cwcShortName; pCache->RootDir.Obj.cwcShortParent; pCache->RootDir.Obj.pwszShortName; # endif #endif pCache->RootDir.cChildren = 0; pCache->RootDir.cChildrenAllocated = 0; pCache->RootDir.papChildren = NULL; pCache->RootDir.hDir = INVALID_HANDLE_VALUE; pCache->RootDir.fHashTabMask = 255; /* 256: 26 drive letters and 102 UNCs before we're half ways. */ pCache->RootDir.papHashTab = (PKFSOBJ *)kHlpAllocZ(256 * sizeof(pCache->RootDir.papHashTab[0])); if (pCache->RootDir.papHashTab) { /* The cache itself. */ pCache->u32Magic = KFSCACHE_MAGIC; pCache->fFlags = fFlags; pCache->auGenerations[0] = KU32_MAX / 4; pCache->auGenerations[1] = KU32_MAX / 32; pCache->auGenerationsMissing[0] = KU32_MAX / 256; pCache->auGenerationsMissing[1] = 1; pCache->cObjects = 1; pCache->cbObjects = sizeof(pCache->RootDir) + (pCache->RootDir.fHashTabMask + 1) * sizeof(pCache->RootDir.papHashTab[0]); pCache->cPathHashHits = 0; pCache->cWalkHits = 0; pCache->cChildSearches = 0; pCache->cChildHashHits = 0; pCache->cChildHashed = 0; pCache->cChildHashTabs = 1; pCache->cChildHashEntriesTotal = pCache->RootDir.fHashTabMask + 1; pCache->cChildHashCollisions = 0; pCache->cNameChanges = 0; pCache->cNameGrowths = 0; pCache->cAnsiPaths = 0; pCache->cAnsiPathCollisions = 0; pCache->cbAnsiPaths = 0; #ifdef KFSCACHE_CFG_UTF16 pCache->cUtf16Paths = 0; pCache->cUtf16PathCollisions = 0; pCache->cbUtf16Paths = 0; #endif #ifdef KFSCACHE_CFG_LOCKING { KSIZE idx = K_ELEMENTS(pCache->auUserDataLocks); while (idx-- > 0) InitializeCriticalSection(&pCache->auUserDataLocks[idx].CritSect); InitializeCriticalSection(&pCache->u.CritSect); } #endif return pCache; } kHlpFree(pCache); } return NULL; } kbuild-3608/src/lib/nt/fts-nt.c0000664000175000017500000011576114670377415016274 0ustar locutuslocutus/* $Id: fts-nt.c 3535 2021-12-20 23:32:28Z bird $ */ /** @file * Source for the NT port of BSD fts.c. * * @copyright 1990, 1993, 1994 The Regents of the University of California. All rights reserved. * @copyright NT modifications Copyright (C) 2016 knut st. osmundsen * @licenses BSD3 * * * Some hints about how the code works. * * The input directories & files are entered into a pseudo root directory and * processed one after another, depth first. * * Directories are completely read into memory first and arranged as linked * list anchored on FTS::fts_cur. fts_read does a pop-like operation on that * list, freeing the nodes after they've been completely processed. * Subdirectories are returned twice by fts_read, the first time when it * decends into it (FTS_D), and the second time as it ascends from it (FTS_DP). * * In parallel to fts_read, there's the fts_children API that fetches the * directory content in a similar manner, but for the consumption of the API * caller rather than FTS itself. The result hangs on FTS::fts_child so it can * be freed when the directory changes or used by fts_read when it is called * upon to enumerate the directory. * * * The NT port of the code does away with the directory changing in favor of * using directory relative opens (present in NT since for ever, just not * exposed thru Win32). A new FTSENT member fts_dirfd has been added to make * this possible for API users too. * * Note! When using Win32 APIs with path input relative to the current * directory, the internal DOS <-> NT path converter will expand it to a * full path and subject it to the 260 char limit. * * The richer NT directory enumeration API allows us to do away with all the * stat() calls, and not have to do link counting and other interesting things * to try speed things up. (You typical stat() implementation on windows is * actually a directory enum call with the name of the file as filter.) */ /*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $ */ #if 0 #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #endif /* LIBC_SCCS and not lint */ #endif #include #include "fts-nt.h" #include #include #include #include "nthlp.h" #include "ntdir.h" #include "ntopenat.h" /* for AT_FDCWD */ #include //debug static FTSENT *fts_alloc(FTS *sp, char const *name, size_t namelen, wchar_t const *wcsname, size_t cwcname); static FTSENT *fts_alloc_ansi(FTS *sp, char const *name, size_t namelen); static FTSENT *fts_alloc_utf16(FTS *sp, wchar_t const *wcsname, size_t cwcname); static void nt_fts_free_alloc_cache(FTS *sp); static FTSENT *fts_build(FTS *, int); static void fts_lfree(FTSENT *); static void fts_load(FTS *, FTSENT *); static size_t fts_maxarglen(char * const *); static size_t fts_maxarglenw(wchar_t * const *); static void fts_padjust(FTS *, FTSENT *); static void fts_padjustw(FTS *, FTSENT *); static int fts_palloc(FTS *, size_t, size_t); static FTSENT *fts_sort(FTS *, FTSENT *, size_t); static int fts_stat(FTS *, FTSENT *, int, HANDLE); static int fts_process_stats(FTSENT *, BirdStat_T const *); #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2]))) #define CLR(opt) (sp->fts_options &= ~(opt)) #define ISSET(opt) (sp->fts_options & (opt)) #define SET(opt) (sp->fts_options |= (opt)) /* fts_build flags */ #define BCHILD 1 /* fts_children */ #define BNAMES 2 /* fts_children, names only */ #define BREAD 3 /* fts_read */ /* NT needs these: */ #define MAXPATHLEN 260 #define MAX(a, b) ( (a) >= (b) ? (a) : (b) ) /** Enables BirdDir_T reuse. (Saves malloc and free calls.) */ #define FTS_WITH_DIRHANDLE_REUSE /** Enables allocation statistics. */ //#define FTS_WITH_STATISTICS /** Enables FTSENT allocation cache. */ #define FTS_WITH_ALLOC_CACHE /** Number of size buckets for the FTSENT allocation cache. */ #define FTS_NUM_FREE_BUCKETS 64 /** Shift for converting size to free bucket index. */ #define FTS_FREE_BUCKET_SHIFT 4 /** The FTSENT allocation alignment. */ #define FTS_ALIGN_FTSENT (1U << FTS_FREE_BUCKET_SHIFT) /* * Internal representation of an FTS, including extra implementation * details. The FTS returned from fts_open points to this structure's * ftsp_fts member (and can be cast to an _fts_private as required) */ struct _fts_private { FTS ftsp_fts; #ifdef FTS_WITH_DIRHANDLE_REUSE /** Statically allocate directory handle. */ BirdDir_T dirhandle; #endif #ifdef FTS_WITH_ALLOC_CACHE /** Number of free entries in the above buckets. */ size_t numfree; # ifdef FTS_WITH_STATISTICS size_t allocs; size_t hits; size_t misses; # endif /** Free FTSENT buckets (by size). * This is to avoid hitting the heap, which is a little sluggish on windows. */ struct { FTSENT *head; } freebuckets[FTS_NUM_FREE_BUCKETS]; #endif }; static FTS * FTSCALL nt_fts_open_common(char * const *argv, wchar_t * const *wcsargv, int options, int (*compar)(const FTSENT * const *, const FTSENT * const *)) { struct _fts_private *priv; FTS *sp; FTSENT *p, *root; FTSENT *parent, *tmp; size_t len, nitems; birdResolveImports(); /* Options check. */ if (options & ~FTS_OPTIONMASK) { errno = EINVAL; return (NULL); } /* fts_open() requires at least one path */ if (wcsargv ? *wcsargv == NULL : *argv == NULL) { errno = EINVAL; return (NULL); } /* Allocate/initialize the stream. */ if ((priv = calloc(1, sizeof(*priv))) == NULL) return (NULL); sp = &priv->ftsp_fts; sp->fts_compar = compar; sp->fts_options = options; SET(FTS_NOCHDIR); /* NT: FTS_NOCHDIR is always on (for external consumes) */ sp->fts_cwd_fd = AT_FDCWD; /* Shush, GCC. */ tmp = NULL; /* * Start out with 1K of path space, and enough, in any case, * to hold the user's paths. */ if (fts_palloc(sp, MAX(argv ? fts_maxarglen(argv) : 1, MAXPATHLEN), MAX(wcsargv ? fts_maxarglenw(wcsargv) : 1, MAXPATHLEN)) ) goto mem1; /* Allocate/initialize root's parent. */ if ((parent = fts_alloc(sp, NULL, 0, NULL, 0)) == NULL) goto mem2; parent->fts_level = FTS_ROOTPARENTLEVEL; /* Allocate/initialize root(s). */ for (root = NULL, nitems = 0; wcsargv ? *wcsargv != NULL : *argv != NULL; ++nitems) { /* NT: We need to do some small input transformations to make this and the API user code happy. 1. Lone drive letters get a dot appended so it won't matter if a slash is appended afterwards. 2. DOS slashes are converted to UNIX ones. */ wchar_t *wcslash; if (wcsargv) { len = wcslen(*wcsargv); if (len == 2 && wcsargv[0][1] == ':') { wchar_t wcsdrive[4]; wcsdrive[0] = wcsargv[0][0]; wcsdrive[1] = ':'; wcsdrive[2] = '.'; wcsdrive[3] = '\0'; p = fts_alloc_utf16(sp, wcsdrive, 3); } else { p = fts_alloc_utf16(sp, *wcsargv, len); } wcsargv++; } else { len = strlen(*argv); if (len == 2 && argv[0][1] == ':') { char szdrive[4]; szdrive[0] = argv[0][0]; szdrive[1] = ':'; szdrive[2] = '.'; szdrive[3] = '\0'; p = fts_alloc_ansi(sp, szdrive, 3); } else { p = fts_alloc_ansi(sp, *argv, len); } argv++; } if (p != NULL) { /* likely */ } else { goto mem3; } wcslash = wcschr(p->fts_wcsname, '\\'); while (wcslash != NULL) { *wcslash++ = '/'; wcslash = wcschr(p->fts_wcsname, '\\'); } if (p->fts_name) { char *slash = strchr(p->fts_name, '\\'); while (slash != NULL) { *slash++ = '/'; slash = strchr(p->fts_name, '\\'); } } p->fts_level = FTS_ROOTLEVEL; p->fts_parent = parent; p->fts_accpath = p->fts_name; p->fts_wcsaccpath = p->fts_wcsname; p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW), INVALID_HANDLE_VALUE); /* Command-line "." and ".." are real directories. */ if (p->fts_info == FTS_DOT) p->fts_info = FTS_D; /* * If comparison routine supplied, traverse in sorted * order; otherwise traverse in the order specified. */ if (compar) { p->fts_link = root; root = p; } else { p->fts_link = NULL; if (root == NULL) tmp = root = p; else { tmp->fts_link = p; tmp = p; } } } if (compar && nitems > 1) root = fts_sort(sp, root, nitems); /* * Allocate a dummy pointer and make fts_read think that we've just * finished the node before the root(s); set p->fts_info to FTS_INIT * so that everything about the "current" node is ignored. */ if ((sp->fts_cur = fts_alloc(sp, NULL, 0, NULL, 0)) == NULL) goto mem3; sp->fts_cur->fts_link = root; sp->fts_cur->fts_info = FTS_INIT; return (sp); mem3: fts_lfree(root); free(parent); mem2: free(sp->fts_path); free(sp->fts_wcspath); mem1: free(sp); return (NULL); } FTS * FTSCALL nt_fts_open(char * const *argv, int options, int (*compar)(const FTSENT * const *, const FTSENT * const *)) { return nt_fts_open_common(argv, NULL, options, compar); } FTS * FTSCALL nt_fts_openw(wchar_t * const *argv, int options, int (*compar)(const FTSENT * const *, const FTSENT * const *)) { return nt_fts_open_common(NULL, argv, options, compar); } /** * Called by fts_read for FTS_ROOTLEVEL entries only. */ static void fts_load(FTS *sp, FTSENT *p) { size_t len; wchar_t *pwc; /* * Load the stream structure for the next traversal. Since we don't * actually enter the directory until after the preorder visit, set * the fts_accpath field specially so the chdir gets done to the right * place and the user can access the first node. From fts_open it's * known that the path will fit. */ if (!(sp->fts_options & FTS_NO_ANSI)) { char *cp; len = p->fts_pathlen = p->fts_namelen; memmove(sp->fts_path, p->fts_name, len + 1); cp = strrchr(p->fts_name, '/'); if (cp != NULL && (cp != p->fts_name || cp[1])) { len = strlen(++cp); memmove(p->fts_name, cp, len + 1); p->fts_namelen = len; } p->fts_accpath = p->fts_path = sp->fts_path; } len = p->fts_cwcpath = p->fts_cwcname; memmove(sp->fts_wcspath, p->fts_wcsname, (len + 1) * sizeof(wchar_t)); pwc = wcsrchr(p->fts_wcsname, '/'); if (pwc != NULL && (pwc != p->fts_wcsname || pwc[1])) { len = wcslen(++pwc); memmove(p->fts_wcsname, pwc, (len + 1) * sizeof(wchar_t)); p->fts_cwcname = len; } p->fts_wcsaccpath = p->fts_wcspath = sp->fts_wcspath; sp->fts_dev = p->fts_dev; } int FTSCALL nt_fts_close(FTS *sp) { FTSENT *freep, *p; /*int saved_errno;*/ /* * This still works if we haven't read anything -- the dummy structure * points to the root list, so we step through to the end of the root * list which has a valid parent pointer. */ if (sp->fts_cur) { for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) { freep = p; p = p->fts_link != NULL ? p->fts_link : p->fts_parent; free(freep); } free(p); } /* Free up child linked list, sort array, path buffer. */ if (sp->fts_child) fts_lfree(sp->fts_child); if (sp->fts_array) free(sp->fts_array); free(sp->fts_path); free(sp->fts_wcspath); #ifdef FTS_WITH_ALLOC_CACHE # ifdef FTS_WITH_STATISTICS { struct _fts_private *priv = (struct _fts_private *)sp; fprintf(stderr, "numfree=%u allocs=%u hits=%u (%uppt) misses=%u (%uppt) other=%u\n", priv->numfree, priv->allocs, priv->hits, (unsigned)((double)priv->hits * 1000.0 / priv->allocs), priv->misses, (unsigned)((double)priv->misses * 1000.0 / priv->allocs), priv->allocs - priv->misses - priv->hits); } # endif #endif nt_fts_free_alloc_cache(sp); #ifdef FTS_WITH_DIRHANDLE_REUSE birdDirClose(&((struct _fts_private *)sp)->dirhandle); #endif /* Free up the stream pointer. */ free(sp); return (0); } /** * Frees a FTSENT structure by way of the allocation cache. */ static void fts_free_entry(FTS *sp, FTSENT *tmp) { if (tmp != NULL) { struct _fts_private *priv = (struct _fts_private *)sp; #ifdef FTS_WITH_ALLOC_CACHE size_t idx; #endif if (tmp->fts_dirfd == INVALID_HANDLE_VALUE) { /* There are probably more files than directories out there. */ } else { birdCloseFile(tmp->fts_dirfd); tmp->fts_dirfd = INVALID_HANDLE_VALUE; } #ifdef FTS_WITH_ALLOC_CACHE idx = (tmp->fts_alloc_size - sizeof(FTSENT)) >> FTS_FREE_BUCKET_SHIFT; if (idx < FTS_NUM_FREE_BUCKETS) { tmp->fts_link = priv->freebuckets[idx].head; priv->freebuckets[idx].head = tmp; } else { tmp->fts_link = priv->freebuckets[FTS_NUM_FREE_BUCKETS - 1].head; priv->freebuckets[FTS_NUM_FREE_BUCKETS - 1].head = tmp; } priv->numfree++; #else free(tmp); #endif } } /* * Special case of "/" at the end of the path so that slashes aren't * appended which would cause paths to be written as "....//foo". */ #define NAPPEND(p) ( p->fts_pathlen - (p->fts_path[p->fts_pathlen - 1] == '/') ) #define NAPPENDW(p) ( p->fts_cwcpath - (p->fts_wcspath[p->fts_cwcpath - 1] == L'/') ) FTSENT * FTSCALL nt_fts_read(FTS *sp) { FTSENT *p, *tmp; int instr; wchar_t *pwc; /* Set current node pointer. */ p = sp->fts_cur; /* If finished or unrecoverable error, return NULL. */ if (p != NULL && !ISSET(FTS_STOP)) { /* likely */ } else { return (NULL); } /* Save and zero out user instructions. */ instr = p->fts_instr; p->fts_instr = FTS_NOINSTR; /* Any type of file may be re-visited; re-stat and re-turn. */ if (instr != FTS_AGAIN) { /* likely */ } else { p->fts_info = fts_stat(sp, p, 0, INVALID_HANDLE_VALUE); return (p); } /* * Following a symlink -- SLNONE test allows application to see * SLNONE and recover. If indirecting through a symlink, have * keep a pointer to current location. If unable to get that * pointer, follow fails. * * NT: Since we don't change directory, we just set FTS_SYMFOLLOW * here in case a API client checks it. */ if ( instr != FTS_FOLLOW || (p->fts_info != FTS_SL && p->fts_info != FTS_SLNONE)) { /* likely */ } else { p->fts_info = fts_stat(sp, p, 1, INVALID_HANDLE_VALUE); if (p->fts_info == FTS_D /*&& !ISSET(FTS_NOCHDIR)*/) { p->fts_flags |= FTS_SYMFOLLOW; } return (p); } /* Directory in pre-order. */ if (p->fts_info == FTS_D) { /* If skipped or crossed mount point, do post-order visit. */ if ( instr == FTS_SKIP || (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) { if (sp->fts_child) { fts_lfree(sp->fts_child); sp->fts_child = NULL; } p->fts_info = FTS_DP; return (p); } /* Rebuild if only read the names and now traversing. */ if (sp->fts_child != NULL && ISSET(FTS_NAMEONLY)) { CLR(FTS_NAMEONLY); fts_lfree(sp->fts_child); sp->fts_child = NULL; } /* * Cd to the subdirectory. * * If have already read and now fail to chdir, whack the list * to make the names come out right, and set the parent errno * so the application will eventually get an error condition. * Set the FTS_DONTCHDIR flag so that when we logically change * directories back to the parent we don't do a chdir. * * If haven't read do so. If the read fails, fts_build sets * FTS_STOP or the fts_info field of the node. */ if (sp->fts_child == NULL) { p = fts_build(sp, BREAD); if (p != NULL) { /* likely */ } else { if (ISSET(FTS_STOP)) return (NULL); return sp->fts_cur; } } else { p = sp->fts_child; sp->fts_child = NULL; } goto name; } /* Move to the next node on this level. */ next: tmp = p; if ((p = p->fts_link) != NULL) { /* * If reached the top, return to the original directory (or * the root of the tree), and load the paths for the next root. */ if (p->fts_level != FTS_ROOTLEVEL) { /* likely */ } else { fts_free_entry(sp, tmp); fts_load(sp, p); return (sp->fts_cur = p); } /* * User may have called fts_set on the node. If skipped, * ignore. If followed, get a file descriptor so we can * get back if necessary. */ if (p->fts_instr != FTS_SKIP) { /* likely */ } else { fts_free_entry(sp, tmp); goto next; } if (p->fts_instr != FTS_FOLLOW) { /* likely */ } else { p->fts_info = fts_stat(sp, p, 1, INVALID_HANDLE_VALUE); /* NT: See above regarding fts_flags. */ if (p->fts_info == FTS_D) { p->fts_flags |= FTS_SYMFOLLOW; } p->fts_instr = FTS_NOINSTR; } fts_free_entry(sp, tmp); name: if (!(sp->fts_options & FTS_NO_ANSI)) { char *t = sp->fts_path + NAPPEND(p->fts_parent); *t++ = '/'; memmove(t, p->fts_name, p->fts_namelen + 1); } pwc = sp->fts_wcspath + NAPPENDW(p->fts_parent); *pwc++ = '/'; memmove(pwc, p->fts_wcsname, (p->fts_cwcname + 1) * sizeof(wchar_t)); return (sp->fts_cur = p); } /* Move up to the parent node. */ p = tmp->fts_parent; if (p->fts_level != FTS_ROOTPARENTLEVEL) { /* likely */ } else { /* * Done; free everything up and set errno to 0 so the user * can distinguish between error and EOF. */ fts_free_entry(sp, tmp); fts_free_entry(sp, p); errno = 0; return (sp->fts_cur = NULL); } /* NUL terminate the pathname. */ if (!(sp->fts_options & FTS_NO_ANSI)) sp->fts_path[p->fts_pathlen] = '\0'; sp->fts_wcspath[ p->fts_cwcpath] = '\0'; /* * Return to the parent directory. If at a root node or came through * a symlink, go back through the file descriptor. Otherwise, cd up * one directory. * * NT: We're doing no fchdir, but we need to close the directory handle. */ if (p->fts_dirfd != INVALID_HANDLE_VALUE) { birdCloseFile(p->fts_dirfd); p->fts_dirfd = INVALID_HANDLE_VALUE; } fts_free_entry(sp, tmp); p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP; return (sp->fts_cur = p); } /* * Fts_set takes the stream as an argument although it's not used in this * implementation; it would be necessary if anyone wanted to add global * semantics to fts using fts_set. An error return is allowed for similar * reasons. */ /* ARGSUSED */ int FTSCALL nt_fts_set(FTS *sp, FTSENT *p, int instr) { if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW && instr != FTS_NOINSTR && instr != FTS_SKIP) { errno = EINVAL; return (1); } p->fts_instr = instr; return (0); } FTSENT * FTSCALL nt_fts_children(FTS *sp, int instr) { FTSENT *p; if (instr != 0 && instr != FTS_NAMEONLY) { errno = EINVAL; return (NULL); } /* Set current node pointer. */ p = sp->fts_cur; /* * Errno set to 0 so user can distinguish empty directory from * an error. */ errno = 0; /* Fatal errors stop here. */ if (ISSET(FTS_STOP)) return (NULL); /* Return logical hierarchy of user's arguments. */ if (p->fts_info == FTS_INIT) return (p->fts_link); /* * If not a directory being visited in pre-order, stop here. Could * allow FTS_DNR, assuming the user has fixed the problem, but the * same effect is available with FTS_AGAIN. */ if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */) return (NULL); /* Free up any previous child list. */ if (sp->fts_child != NULL) { fts_lfree(sp->fts_child); sp->fts_child = NULL; /* (bird - double free for _open(".") failure in original) */ } /* NT: Some BSD utility sets FTS_NAMEONLY? We don't really need this optimization, but since it only hurts that utility, it can stay. */ if (instr == FTS_NAMEONLY) { assert(0); /* don't specify FTS_NAMEONLY on NT. */ SET(FTS_NAMEONLY); instr = BNAMES; } else instr = BCHILD; return (sp->fts_child = fts_build(sp, instr)); } #ifndef fts_get_clientptr #error "fts_get_clientptr not defined" #endif void * (FTSCALL fts_get_clientptr)(FTS *sp) { return (fts_get_clientptr(sp)); } #ifndef fts_get_stream #error "fts_get_stream not defined" #endif FTS * (FTSCALL fts_get_stream)(FTSENT *p) { return (fts_get_stream(p)); } void FTSCALL nt_fts_set_clientptr(FTS *sp, void *clientptr) { sp->fts_clientptr = clientptr; } /* * This is the tricky part -- do not casually change *anything* in here. The * idea is to build the linked list of entries that are used by fts_children * and fts_read. There are lots of special cases. * * The real slowdown in walking the tree is the stat calls. If FTS_NOSTAT is * set and it's a physical walk (so that symbolic links can't be directories), * we can do things quickly. First, if it's a 4.4BSD file system, the type * of the file is in the directory entry. Otherwise, we assume that the number * of subdirectories in a node is equal to the number of links to the parent. * The former skips all stat calls. The latter skips stat calls in any leaf * directories and for any files after the subdirectories in the directory have * been found, cutting the stat calls by about 2/3. * * NT: We do not do any link counting or stat avoiding, which invalidates the * above warnings. This function is very simple for us. */ static FTSENT * fts_build(FTS *sp, int type) { BirdDirEntryW_T *dp; FTSENT *p, *cur; FTSENT * volatile head,* volatile *tailp; /* volatile is to prevent aliasing trouble */ DIR *dirp; int saved_errno, doadjust, doadjust_utf16; long level; size_t len, cwcdir, maxlen, cwcmax, nitems; unsigned fDirOpenFlags; /* Set current node pointer. */ cur = sp->fts_cur; /* * Open the directory for reading. If this fails, we're done. * If being called from fts_read, set the fts_info field. * * NT: We do a two stage open so we can keep the directory handle around * after we've enumerated the directory. The dir handle is used by * us here and by the API users to more efficiently and safely open * members of the directory. */ fDirOpenFlags = BIRDDIR_F_EXTRA_INFO | BIRDDIR_F_KEEP_HANDLE; if (cur->fts_dirfd == INVALID_HANDLE_VALUE) { if (cur->fts_parent->fts_dirfd != INVALID_HANDLE_VALUE) { /* (This works fine for symlinks too, since we follow them.) */ cur->fts_dirfd = birdOpenFileExW(cur->fts_parent->fts_dirfd, cur->fts_wcsname, FILE_READ_DATA | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE); } else { cur->fts_dirfd = birdOpenFileW(cur->fts_wcsaccpath, FILE_READ_DATA | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE); } if (cur->fts_dirfd != INVALID_HANDLE_VALUE) { /* likely */ } else goto l_open_err; } else { fDirOpenFlags |= BIRDDIR_F_RESTART_SCAN; } #ifdef FTS_WITH_DIRHANDLE_REUSE dirp = birdDirOpenFromHandleWithReuse(&((struct _fts_private *)sp)->dirhandle, cur->fts_dirfd, NULL, fDirOpenFlags | BIRDDIR_F_STATIC_ALLOC); #else dirp = birdDirOpenFromHandle(cur->fts_dirfd, NULL, fDirOpenFlags); #endif if (dirp == NULL) { l_open_err: if (type == BREAD) { cur->fts_info = FTS_DNR; cur->fts_errno = errno; } return (NULL); } /* * Figure out the max file name length that can be stored in the * current path -- the inner loop allocates more path as necessary. * We really wouldn't have to do the maxlen calculations here, we * could do them in fts_read before returning the path, but it's a * lot easier here since the length is part of the dirent structure. */ if (sp->fts_options & FTS_NO_ANSI) { len = 0; maxlen = 0x10000; } else { len = NAPPEND(cur); len++; maxlen = sp->fts_pathlen - len; } cwcdir = NAPPENDW(cur); cwcdir++; cwcmax = sp->fts_cwcpath - len; level = cur->fts_level + 1; /* Read the directory, attaching each entry to the `link' pointer. */ doadjust = doadjust_utf16 = 0; nitems = 0; head = NULL; tailp = &head; while ((dp = birdDirReadW(dirp)) != NULL) { if (ISSET(FTS_SEEDOT) || !ISDOT(dp->d_name)) { /* assume dirs have two or more entries */ } else { continue; } if ((p = fts_alloc_utf16(sp, dp->d_name, dp->d_namlen)) != NULL) { /* likely */ } else { goto mem1; } /* include space for NUL */ if (p->fts_namelen < maxlen && p->fts_cwcname < cwcmax) { /* likely */ } else { void *oldaddr = sp->fts_path; wchar_t *oldwcspath = sp->fts_wcspath; if (fts_palloc(sp, p->fts_namelen >= maxlen ? len + p->fts_namelen + 1 : 0, p->fts_cwcname >= cwcmax ? cwcdir + p->fts_cwcname + 1 : 0)) { mem1: /* * No more memory for path or structures. Save * errno, free up the current structure and the * structures already allocated. */ saved_errno = errno; if (p) free(p); fts_lfree(head); #ifndef FTS_WITH_DIRHANDLE_REUSE birdDirClose(dirp); #endif birdCloseFile(cur->fts_dirfd); cur->fts_dirfd = INVALID_HANDLE_VALUE; cur->fts_info = FTS_ERR; SET(FTS_STOP); errno = saved_errno; return (NULL); } /* Did realloc() change the pointer? */ doadjust |= oldaddr != sp->fts_path; doadjust_utf16 |= oldwcspath != sp->fts_wcspath; maxlen = sp->fts_pathlen - len; cwcmax = sp->fts_cwcpath - cwcdir; } p->fts_level = level; p->fts_parent = sp->fts_cur; p->fts_pathlen = len + p->fts_namelen; p->fts_cwcpath = cwcdir + p->fts_cwcname; p->fts_accpath = p->fts_path; p->fts_wcsaccpath = p->fts_wcspath; p->fts_stat = dp->d_stat; p->fts_info = fts_process_stats(p, &dp->d_stat); /* We walk in directory order so "ls -f" doesn't get upset. */ p->fts_link = NULL; *tailp = p; tailp = &p->fts_link; ++nitems; } #ifndef FTS_WITH_DIRHANDLE_REUSE birdDirClose(dirp); #endif /* * If realloc() changed the address of the path, adjust the * addresses for the rest of the tree and the dir list. */ if (doadjust) fts_padjust(sp, head); if (doadjust_utf16) fts_padjustw(sp, head); /* If didn't find anything, return NULL. */ if (!nitems) { if (type == BREAD) cur->fts_info = FTS_DP; return (NULL); } /* Sort the entries. */ if (sp->fts_compar && nitems > 1) head = fts_sort(sp, head, nitems); return (head); } /** * @note Only used on NT with input arguments, FTS_AGAIN, and links that needs * following. On link information is generally retrieved during directory * enumeration on NT, in line with it's DOS/OS2/FAT API heritage. */ static int fts_stat(FTS *sp, FTSENT *p, int follow, HANDLE dfd) { int saved_errno; const wchar_t *wcspath; if (dfd == INVALID_HANDLE_VALUE) { wcspath = p->fts_wcsaccpath; } else { wcspath = p->fts_wcsname; } /* * If doing a logical walk, or application requested FTS_FOLLOW, do * a stat(2). If that fails, check for a non-existent symlink. If * fail, set the errno from the stat call. */ if (ISSET(FTS_LOGICAL) || follow) { if (birdStatAtW(dfd, wcspath, &p->fts_stat, 1 /*fFollowLink*/)) { saved_errno = errno; if (birdStatAtW(dfd, wcspath, &p->fts_stat, 0 /*fFollowLink*/)) { p->fts_errno = saved_errno; goto err; } errno = 0; if (S_ISLNK(p->fts_stat.st_mode)) return (FTS_SLNONE); } } else if (birdStatAtW(dfd, wcspath, &p->fts_stat, 0 /*fFollowLink*/)) { p->fts_errno = errno; err: memset(&p->fts_stat, 0, sizeof(struct stat)); return (FTS_NS); } return fts_process_stats(p, &p->fts_stat); } /* Shared between fts_stat and fts_build. */ static int fts_process_stats(FTSENT *p, BirdStat_T const *sbp) { if (S_ISDIR(sbp->st_mode)) { FTSENT *t; fts_dev_t dev; fts_ino_t ino; /* * Set the device/inode. Used to find cycles and check for * crossing mount points. Also remember the link count, used * in fts_build to limit the number of stat calls. It is * understood that these fields are only referenced if fts_info * is set to FTS_D. */ dev = p->fts_dev = sbp->st_dev; ino = p->fts_ino = sbp->st_ino; p->fts_nlink = sbp->st_nlink; if (ISDOT(p->fts_wcsname)) return (FTS_DOT); /* * Cycle detection is done by brute force when the directory * is first encountered. If the tree gets deep enough or the * number of symbolic links to directories is high enough, * something faster might be worthwhile. */ for (t = p->fts_parent; t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent) if (ino == t->fts_ino && dev == t->fts_dev) { p->fts_cycle = t; return (FTS_DC); } return (FTS_D); } if (S_ISLNK(sbp->st_mode)) return (FTS_SL); if (S_ISREG(sbp->st_mode)) return (FTS_F); return (FTS_DEFAULT); } /* * The comparison function takes pointers to pointers to FTSENT structures. * Qsort wants a comparison function that takes pointers to void. * (Both with appropriate levels of const-poisoning, of course!) * Use a trampoline function to deal with the difference. */ static int fts_compar(const void *a, const void *b) { FTS *parent; parent = (*(const FTSENT * const *)a)->fts_fts; return (*parent->fts_compar)(a, b); } static FTSENT * fts_sort(FTS *sp, FTSENT *head, size_t nitems) { FTSENT **ap, *p; /* * Construct an array of pointers to the structures and call qsort(3). * Reassemble the array in the order returned by qsort. If unable to * sort for memory reasons, return the directory entries in their * current order. Allocate enough space for the current needs plus * 40 so don't realloc one entry at a time. */ if (nitems > sp->fts_nitems) { void *ptr; sp->fts_nitems = nitems + 40; ptr = realloc(sp->fts_array, sp->fts_nitems * sizeof(FTSENT *)); if (ptr != NULL) { sp->fts_array = ptr; } else { free(sp->fts_array); sp->fts_array = NULL; sp->fts_nitems = 0; return (head); } } for (ap = sp->fts_array, p = head; p; p = p->fts_link) *ap++ = p; qsort(sp->fts_array, nitems, sizeof(FTSENT *), fts_compar); for (head = *(ap = sp->fts_array); --nitems; ++ap) ap[0]->fts_link = ap[1]; ap[0]->fts_link = NULL; return (head); } static FTSENT * fts_alloc(FTS *sp, char const *name, size_t namelen, wchar_t const *wcsname, size_t cwcname) { struct _fts_private *priv = (struct _fts_private *)sp; FTSENT *p; size_t len; #ifdef FTS_WITH_ALLOC_CACHE size_t aligned; size_t idx; #endif #if defined(FTS_WITH_STATISTICS) && defined(FTS_WITH_ALLOC_CACHE) priv->allocs++; #endif /* * The file name is a variable length array. Allocate the FTSENT * structure and the file name. */ len = sizeof(FTSENT) + (cwcname + 1) * sizeof(wchar_t); if (!(sp->fts_options & FTS_NO_ANSI)) len += namelen + 1; /* * To speed things up we cache entries. This code is a little insane, * but that's preferable to slow code. */ #ifdef FTS_WITH_ALLOC_CACHE aligned = (len + FTS_ALIGN_FTSENT + 1) & ~(size_t)(FTS_ALIGN_FTSENT - 1); idx = ((aligned - sizeof(FTSENT)) >> FTS_FREE_BUCKET_SHIFT); if ( idx < FTS_NUM_FREE_BUCKETS && (p = priv->freebuckets[idx].head) && p->fts_alloc_size >= len) { priv->freebuckets[idx].head = p->fts_link; priv->numfree--; # ifdef FTS_WITH_STATISTICS priv->hits++; # endif } else { # ifdef FTS_WITH_STATISTICS priv->misses++; # endif p = malloc(aligned); if (p) { p->fts_alloc_size = (unsigned)aligned; } else { nt_fts_free_alloc_cache(sp); p = malloc(len); if (!p) return NULL; p->fts_alloc_size = (unsigned)len; } } #else /* !FTS_WITH_ALLOC_CACHE */ p = malloc(len); if (p) { p->fts_alloc_size = (unsigned)len; } else { return NULL; } #endif /* !FTS_WITH_ALLOC_CACHE */ /* Copy the names and guarantee NUL termination. */ p->fts_wcsname = (wchar_t *)(p + 1); memcpy(p->fts_wcsname, wcsname, cwcname * sizeof(wchar_t)); p->fts_wcsname[cwcname] = '\0'; p->fts_cwcname = cwcname; if (!(sp->fts_options & FTS_NO_ANSI)) { p->fts_name = (char *)(p->fts_wcsname + cwcname + 1); memcpy(p->fts_name, name, namelen); p->fts_name[namelen] = '\0'; p->fts_namelen = namelen; } else { p->fts_name = NULL; p->fts_namelen = 0; } p->fts_path = sp->fts_path; p->fts_wcspath = sp->fts_wcspath; p->fts_statp = &p->fts_stat; p->fts_errno = 0; p->fts_flags = 0; p->fts_instr = FTS_NOINSTR; p->fts_number = 0; p->fts_pointer = NULL; p->fts_fts = sp; p->fts_dirfd = INVALID_HANDLE_VALUE; return (p); } /** * Converts the ANSI name to UTF-16 and calls fts_alloc. * * @returns Pointer to allocated and mostly initialized FTSENT structure on * success. NULL on failure, caller needs to record it. * @param sp Pointer to FTS instance. * @param name The ANSI name. * @param namelen The ANSI name length. */ static FTSENT * fts_alloc_ansi(FTS *sp, char const *name, size_t namelen) { MY_UNICODE_STRING UniStr; MY_ANSI_STRING AnsiStr; MY_NTSTATUS rcNt; FTSENT *pRet; UniStr.Buffer = NULL; UniStr.MaximumLength = UniStr.Length = 0; AnsiStr.Buffer = (char *)name; AnsiStr.Length = AnsiStr.MaximumLength = (USHORT)namelen; rcNt = g_pfnRtlAnsiStringToUnicodeString(&UniStr, &AnsiStr, TRUE /*fAllocate*/); if (NT_SUCCESS(rcNt)) { pRet = fts_alloc(sp, name, namelen, UniStr.Buffer, UniStr.Length / sizeof(wchar_t)); HeapFree(GetProcessHeap(), 0, UniStr.Buffer); } else { pRet = NULL; } return pRet; } /** * Converts the UTF-16 name to ANSI (if necessary) and calls fts_alloc. * * @returns Pointer to allocated and mostly initialized FTSENT structure on * success. NULL on failure, caller needs to record it. * @param sp Pointer to the FTS instance. * @param wcsname The UTF-16 name. * @param cwcname The UTF-16 name length. */ static FTSENT * fts_alloc_utf16(FTS *sp, wchar_t const *wcsname, size_t cwcname) { FTSENT *pRet; if (sp->fts_options & FTS_NO_ANSI) { pRet = fts_alloc(sp, NULL, 0, wcsname, cwcname); } else { MY_UNICODE_STRING UniStr; MY_ANSI_STRING AnsiStr; MY_NTSTATUS rcNt; UniStr.Buffer = (wchar_t *)wcsname; UniStr.MaximumLength = UniStr.Length = (USHORT)(cwcname * sizeof(wchar_t)); AnsiStr.Buffer = NULL; AnsiStr.Length = AnsiStr.MaximumLength = 0; rcNt = g_pfnRtlUnicodeStringToAnsiString(&AnsiStr, &UniStr, TRUE /*fAllocate*/); if (NT_SUCCESS(rcNt)) { pRet = fts_alloc(sp, AnsiStr.Buffer, AnsiStr.Length, wcsname, cwcname); HeapFree(GetProcessHeap(), 0, AnsiStr.Buffer); } else { pRet = NULL; } } return pRet; } /** * Frees up the FTSENT allocation cache. * * Used by nt_fts_close, but also called by fts_alloc on alloc failure. * * @param sp Pointer to the FTS instance. */ static void nt_fts_free_alloc_cache(FTS *sp) { #ifdef FTS_WITH_ALLOC_CACHE struct _fts_private *priv = (struct _fts_private *)sp; unsigned i = K_ELEMENTS(priv->freebuckets); while (i-- > 0) { FTSENT *cur = priv->freebuckets[i].head; priv->freebuckets[i].head = NULL; while (cur) { FTSENT *freeit = cur; cur = cur->fts_link; free(freeit); } } priv->numfree = 0; #else (void)sp; #endif } static void fts_lfree(FTSENT *head) { FTSENT *p; /* Free a linked list of structures. */ while ((p = head)) { head = head->fts_link; assert(p->fts_dirfd == INVALID_HANDLE_VALUE); free(p); } } /* * Allow essentially unlimited paths; find, rm, ls should all work on any tree. * Most systems will allow creation of paths much longer than MAXPATHLEN, even * though the kernel won't resolve them. Add the size (not just what's needed) * plus 256 bytes so don't realloc the path 2 bytes at a time. */ static int fts_palloc(FTS *sp, size_t more, size_t cwcmore) { void *ptr; /** @todo Isn't more and cwcmore minimum buffer sizes rather than what needs * to be added to the buffer?? This code makes no sense when looking at * the way the caller checks things out! */ if (more) { sp->fts_pathlen += more + 256; ptr = realloc(sp->fts_path, sp->fts_pathlen); if (ptr) { sp->fts_path = ptr; } else { free(sp->fts_path); sp->fts_path = NULL; free(sp->fts_wcspath); sp->fts_wcspath = NULL; return 1; } } if (cwcmore) { sp->fts_cwcpath += cwcmore + 256; ptr = realloc(sp->fts_wcspath, sp->fts_cwcpath); if (ptr) { sp->fts_wcspath = ptr; } else { free(sp->fts_path); sp->fts_path = NULL; free(sp->fts_wcspath); sp->fts_wcspath = NULL; return 1; } } return 0; } /* * When the path is realloc'd, have to fix all of the pointers in structures * already returned. */ static void fts_padjust(FTS *sp, FTSENT *head) { FTSENT *p; char *addr = sp->fts_path; #define ADJUST(p) do { \ if ((p)->fts_accpath != (p)->fts_name) { \ (p)->fts_accpath = \ (char *)addr + ((p)->fts_accpath - (p)->fts_path); \ } \ (p)->fts_path = addr; \ } while (0) /* Adjust the current set of children. */ for (p = sp->fts_child; p; p = p->fts_link) ADJUST(p); /* Adjust the rest of the tree, including the current level. */ for (p = head; p->fts_level >= FTS_ROOTLEVEL;) { ADJUST(p); p = p->fts_link ? p->fts_link : p->fts_parent; } } /* * When the UTF-16 path is realloc'd, have to fix all of the pointers in * structures already returned. */ static void fts_padjustw(FTS *sp, FTSENT *head) { FTSENT *p; wchar_t *addr = sp->fts_wcspath; #define ADJUSTW(p) \ do { \ if ((p)->fts_wcsaccpath != (p)->fts_wcsname) \ (p)->fts_wcsaccpath = addr + ((p)->fts_wcsaccpath - (p)->fts_wcspath); \ (p)->fts_wcspath = addr; \ } while (0) /* Adjust the current set of children. */ for (p = sp->fts_child; p; p = p->fts_link) ADJUSTW(p); /* Adjust the rest of the tree, including the current level. */ for (p = head; p->fts_level >= FTS_ROOTLEVEL;) { ADJUSTW(p); p = p->fts_link ? p->fts_link : p->fts_parent; } } static size_t fts_maxarglen(char * const *argv) { size_t len, max; for (max = 0; *argv; ++argv) if ((len = strlen(*argv)) > max) max = len; return (max + 1); } /** Returns the max string size (including term). */ static size_t fts_maxarglenw(wchar_t * const *argv) { size_t max = 0; for (; *argv; ++argv) { size_t len = wcslen(*argv); if (len > max) max = len; } return max + 1; } kbuild-3608/src/lib/nt/nt_child_inject_standard_handles.h0000664000175000017500000000214214670377415023550 0ustar locutuslocutus/* $Id: nt_child_inject_standard_handles.h 3179 2018-03-22 19:50:04Z bird $ */ /** @file * Injecting standard handles into a child process. */ /* * Copyright (c) 2004-2018 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ #ifndef ___nt_child_inject_standard_handles #define ___nt_child_inject_standard_handles int nt_child_inject_standard_handles(HANDLE hProcess, BOOL pafReplace[3], HANDLE pahHandles[3], char *pszErr, size_t cbErr); #endif kbuild-3608/src/lib/nt/ntstat.c0000664000175000017500000011346614670377415016376 0ustar locutuslocutus/* $Id: ntstat.c 3485 2020-09-21 12:25:08Z bird $ */ /** @file * MSC + NT stat, lstat and fstat. */ /* * Copyright (c) 2005-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include #include "ntstuff.h" #include "nthlp.h" #include "ntstat.h" #undef stat static int birdIsExecutableExtension(const char *pszExt) { switch (pszExt[0]) { default: return 0; case 'e': /* exe */ return pszExt[1] == 'x' && pszExt[2] == 'e' && pszExt[3] == '\0'; case 'b': /* bat */ return pszExt[1] == 'a' && pszExt[2] == 't' && pszExt[3] == '\0'; case 'v': /* vbs */ return pszExt[1] == 'b' && pszExt[2] == 's' && pszExt[3] == '\0'; case 'c': /* com and cmd */ return (pszExt[1] == 'o' && pszExt[2] == 'm' && pszExt[3] == '\0') || (pszExt[1] == 'm' && pszExt[2] == 'd' && pszExt[3] == '\0'); } } static int birdIsFileExecutable(const char *pszName) { if (pszName) { const char *pszExt = NULL; char szExt[8]; size_t cchExt; unsigned i; char ch; /* Look for a 3 char extension. */ ch = *pszName++; if (!ch) return 0; while ((ch = *pszName++) != '\0') if (ch == '.') pszExt = pszName; if (!pszExt) return 0; pszExt++; cchExt = pszName - pszExt; if (cchExt != 3) return 0; /* Copy the extension out and lower case it. Fail immediately on non-alpha chars. */ for (i = 0; i < cchExt; i++, pszExt++) { ch = *pszExt; if (ch >= 'a' && ch <= 'z') { /* likely */ } else if (ch >= 'A' && ch <= 'Z') ch += 'a' - 'A'; else return 0; szExt[i] = ch; } szExt[i] = '\0'; return birdIsExecutableExtension(szExt); } return 0; } /** * @a pwcName could be the full path. */ static int birdIsFileExecutableW(WCHAR const *pwcName, size_t cwcName) { char szExt[8]; unsigned cchExt; unsigned i; WCHAR const *pwc; /* Look for a 3 char extension. */ if (cwcName > 2 && pwcName[cwcName - 2] == '.') return 0; else if (cwcName > 3 && pwcName[cwcName - 3] == '.') return 0; else if (cwcName > 4 && pwcName[cwcName - 4] == '.') cchExt = 3; else return 0; /* Copy the extension out and lower case it. Fail immediately on non-alpha chars. */ pwc = &pwcName[cwcName - cchExt]; for (i = 0; i < cchExt; i++, pwc++) { WCHAR wc = *pwc; if (wc >= 'a' && wc <= 'z') { /* likely */ } else if (wc >= 'A' && wc <= 'Z') wc += 'a' - 'A'; else return 0; szExt[i] = (char)wc; } szExt[i] = '\0'; return birdIsExecutableExtension(szExt); } static unsigned short birdFileInfoToMode(ULONG fAttribs, ULONG uReparseTag, const char *pszName, const wchar_t *pwszName, size_t cbNameW, unsigned __int8 *pfIsDirSymlink, unsigned __int8 *pfIsMountPoint) { unsigned short fMode; /* File type. */ *pfIsDirSymlink = 0; *pfIsMountPoint = 0; if (!(fAttribs & FILE_ATTRIBUTE_REPARSE_POINT)) { if (fAttribs & FILE_ATTRIBUTE_DIRECTORY) fMode = S_IFDIR; else fMode = S_IFREG; } else { switch (uReparseTag) { case IO_REPARSE_TAG_SYMLINK: *pfIsDirSymlink = !!(fAttribs & FILE_ATTRIBUTE_DIRECTORY); fMode = S_IFLNK; break; case IO_REPARSE_TAG_MOUNT_POINT: *pfIsMountPoint = 1; default: if (fAttribs & FILE_ATTRIBUTE_DIRECTORY) fMode = S_IFDIR; else fMode = S_IFREG; break; } } /* Access mask. */ fMode |= S_IROTH | S_IRGRP | S_IRUSR; if (!(fAttribs & FILE_ATTRIBUTE_READONLY)) fMode |= S_IWOTH | S_IWGRP | S_IWUSR; if ( (fAttribs & FILE_ATTRIBUTE_DIRECTORY) || (pwszName ? birdIsFileExecutableW(pwszName, cbNameW / sizeof(wchar_t)) : birdIsFileExecutable(pszName)) ) fMode |= S_IXOTH | S_IXGRP | S_IXUSR; return fMode; } /** * Fills in a stat structure from an MY_FILE_ID_FULL_DIR_INFORMATION entry. * * @param pStat The stat structure. * @param pBuf The MY_FILE_ID_FULL_DIR_INFORMATION entry. * @remarks Caller sets st_dev. */ void birdStatFillFromFileIdFullDirInfo(BirdStat_T *pStat, MY_FILE_ID_FULL_DIR_INFORMATION const *pBuf) { pStat->st_mode = birdFileInfoToMode(pBuf->FileAttributes, pBuf->EaSize, NULL /*pszPath*/, pBuf->FileName, pBuf->FileNameLength, &pStat->st_isdirsymlink, &pStat->st_ismountpoint); pStat->st_padding0[0] = 0; pStat->st_padding0[1] = 0; pStat->st_size = pBuf->EndOfFile.QuadPart; birdNtTimeToTimeSpec(pBuf->CreationTime.QuadPart, &pStat->st_birthtim); birdNtTimeToTimeSpec(pBuf->ChangeTime.QuadPart, &pStat->st_ctim); birdNtTimeToTimeSpec(pBuf->LastWriteTime.QuadPart, &pStat->st_mtim); birdNtTimeToTimeSpec(pBuf->LastAccessTime.QuadPart, &pStat->st_atim); pStat->st_ino = pBuf->FileId.QuadPart; pStat->st_nlink = 1; pStat->st_rdev = 0; pStat->st_uid = 0; pStat->st_gid = 0; pStat->st_padding1 = 0; pStat->st_attribs = pBuf->FileAttributes; pStat->st_blksize = 65536; pStat->st_blocks = (pBuf->AllocationSize.QuadPart + BIRD_STAT_BLOCK_SIZE - 1) / BIRD_STAT_BLOCK_SIZE; } /** * Fills in a stat structure from an MY_FILE_ID_BOTH_DIR_INFORMATION entry. * * @param pStat The stat structure. * @param pBuf The MY_FILE_ID_BOTH_DIR_INFORMATION entry. * @remarks Caller sets st_dev. */ void birdStatFillFromFileIdBothDirInfo(BirdStat_T *pStat, MY_FILE_ID_BOTH_DIR_INFORMATION const *pBuf) { pStat->st_mode = birdFileInfoToMode(pBuf->FileAttributes, pBuf->EaSize, NULL /*pszPath*/, pBuf->FileName, pBuf->FileNameLength, &pStat->st_isdirsymlink, &pStat->st_ismountpoint); pStat->st_padding0[0] = 0; pStat->st_padding0[1] = 0; pStat->st_size = pBuf->EndOfFile.QuadPart; birdNtTimeToTimeSpec(pBuf->CreationTime.QuadPart, &pStat->st_birthtim); birdNtTimeToTimeSpec(pBuf->ChangeTime.QuadPart, &pStat->st_ctim); birdNtTimeToTimeSpec(pBuf->LastWriteTime.QuadPart, &pStat->st_mtim); birdNtTimeToTimeSpec(pBuf->LastAccessTime.QuadPart, &pStat->st_atim); pStat->st_ino = pBuf->FileId.QuadPart; pStat->st_nlink = 1; pStat->st_rdev = 0; pStat->st_uid = 0; pStat->st_gid = 0; pStat->st_padding1 = 0; pStat->st_attribs = pBuf->FileAttributes; pStat->st_blksize = 65536; pStat->st_blocks = (pBuf->AllocationSize.QuadPart + BIRD_STAT_BLOCK_SIZE - 1) / BIRD_STAT_BLOCK_SIZE; } /** * Fills in a stat structure from an MY_FILE_BOTH_DIR_INFORMATION entry. * * @param pStat The stat structure. * @param pBuf The MY_FILE_BOTH_DIR_INFORMATION entry. * @remarks Caller sets st_dev. */ void birdStatFillFromFileBothDirInfo(BirdStat_T *pStat, MY_FILE_BOTH_DIR_INFORMATION const *pBuf) { pStat->st_mode = birdFileInfoToMode(pBuf->FileAttributes, pBuf->EaSize, NULL /*pszPath*/, pBuf->FileName, pBuf->FileNameLength, &pStat->st_isdirsymlink, &pStat->st_ismountpoint); pStat->st_padding0[0] = 0; pStat->st_padding0[1] = 0; pStat->st_size = pBuf->EndOfFile.QuadPart; birdNtTimeToTimeSpec(pBuf->CreationTime.QuadPart, &pStat->st_birthtim); birdNtTimeToTimeSpec(pBuf->ChangeTime.QuadPart, &pStat->st_ctim); birdNtTimeToTimeSpec(pBuf->LastWriteTime.QuadPart, &pStat->st_mtim); birdNtTimeToTimeSpec(pBuf->LastAccessTime.QuadPart, &pStat->st_atim); pStat->st_ino = 0; pStat->st_nlink = 1; pStat->st_rdev = 0; pStat->st_uid = 0; pStat->st_gid = 0; pStat->st_padding1 = 0; pStat->st_attribs = pBuf->FileAttributes; pStat->st_blksize = 65536; pStat->st_blocks = (pBuf->AllocationSize.QuadPart + BIRD_STAT_BLOCK_SIZE - 1) / BIRD_STAT_BLOCK_SIZE; } int birdStatHandle2(HANDLE hFile, BirdStat_T *pStat, const char *pszPath, const wchar_t *pwszPath) { int rc; MY_NTSTATUS rcNt; #if 0 ULONG cbAll = sizeof(MY_FILE_ALL_INFORMATION) + 0x10000; MY_FILE_ALL_INFORMATION *pAll = (MY_FILE_ALL_INFORMATION *)birdTmpAlloc(cbAll); if (pAll) { MY_IO_STATUS_BLOCK Ios; Ios.Information = 0; Ios.u.Status = -1; rcNt = g_pfnNtQueryInformationFile(hFile, &Ios, pAll, cbAll, MyFileAllInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) { pStat->st_mode = birdFileInfoToMode(pAll->BasicInformation.FileAttributes, pszPath, pAll->NameInformation.FileNamepAll->NameInformation.FileNameLength, hFile, &pStat->st_isdirsymlink, &pStat->st_ismountpoint); pStat->st_padding0[0] = 0; pStat->st_padding0[1] = 0; pStat->st_size = pAll->StandardInformation.EndOfFile.QuadPart; birdNtTimeToTimeSpec(pAll->BasicInformation.CreationTime.QuadPart, &pStat->st_birthtim); birdNtTimeToTimeSpec(pAll->BasicInformation.ChangeTime.QuadPart, &pStat->st_ctim); birdNtTimeToTimeSpec(pAll->BasicInformation.LastWriteTime.QuadPart, &pStat->st_mtim); birdNtTimeToTimeSpec(pAll->BasicInformation.LastAccessTime.QuadPart, &pStat->st_atim); pStat->st_ino = pAll->InternalInformation.IndexNumber.QuadPart; pStat->st_nlink = pAll->StandardInformation.NumberOfLinks; pStat->st_rdev = 0; pStat->st_uid = 0; pStat->st_gid = 0; pStat->st_padding1 = 0; pStat->st_attribs = pAll->StandardInformation.FileAttributes; pStat->st_blksize = 65536; pStat->st_blocks = (pAll->StandardInformation.AllocationSize.QuadPart + BIRD_STAT_BLOCK_SIZE - 1) / BIRD_STAT_BLOCK_SIZE; /* Get the serial number, reusing the buffer from above. */ rcNt = g_pfnNtQueryVolumeInformationFile(hFile, &Ios, pAll, cbAll, MyFileFsVolumeInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) { MY_FILE_FS_VOLUME_INFORMATION const *pVolInfo = (MY_FILE_FS_VOLUME_INFORMATION const *)pAll; pStat->st_dev = pVolInfo->VolumeSerialNumber | (pVolInfo->VolumeCreationTime.QuadPart << 32); rc = 0; } else { pStat->st_dev = 0; rc = birdSetErrnoFromNt(rcNt); } } else rc = birdSetErrnoFromNt(rcNt); } else rc = birdSetErrnoToNoMem(); #else ULONG cbNameInfo = 0; MY_FILE_NAME_INFORMATION *pNameInfo = NULL; MY_FILE_STANDARD_INFORMATION StdInfo; MY_FILE_BASIC_INFORMATION BasicInfo; MY_FILE_INTERNAL_INFORMATION InternalInfo; MY_FILE_ATTRIBUTE_TAG_INFORMATION TagInfo; MY_IO_STATUS_BLOCK Ios; Ios.Information = 0; Ios.u.Status = -1; rcNt = g_pfnNtQueryInformationFile(hFile, &Ios, &StdInfo, sizeof(StdInfo), MyFileStandardInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) rcNt = g_pfnNtQueryInformationFile(hFile, &Ios, &BasicInfo, sizeof(BasicInfo), MyFileBasicInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) rcNt = g_pfnNtQueryInformationFile(hFile, &Ios, &InternalInfo, sizeof(InternalInfo), MyFileInternalInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) { if (!(BasicInfo.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) TagInfo.ReparseTag = 0; else { MY_NTSTATUS rcNt2 = g_pfnNtQueryInformationFile(hFile, &Ios, &TagInfo, sizeof(TagInfo), MyFileAttributeTagInformation); if ( !MY_NT_SUCCESS(rcNt2) || !MY_NT_SUCCESS(Ios.u.Status)) TagInfo.ReparseTag = 0; } } if ( MY_NT_SUCCESS(rcNt) && !pszPath && !pwszPath && !(BasicInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { cbNameInfo = 0x10020; pNameInfo = (MY_FILE_NAME_INFORMATION *)alloca(cbNameInfo); rcNt = g_pfnNtQueryInformationFile(hFile, &Ios, pNameInfo, cbNameInfo, MyFileNameInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; } if (MY_NT_SUCCESS(rcNt)) { pStat->st_mode = birdFileInfoToMode(BasicInfo.FileAttributes, TagInfo.ReparseTag, pszPath, pNameInfo ? pNameInfo->FileName : pwszPath, pNameInfo ? pNameInfo->FileNameLength : pwszPath ? wcslen(pwszPath) * sizeof(wchar_t) : 0, &pStat->st_isdirsymlink, &pStat->st_ismountpoint); pStat->st_padding0[0] = 0; pStat->st_padding0[1] = 0; pStat->st_size = StdInfo.EndOfFile.QuadPart; birdNtTimeToTimeSpec(BasicInfo.CreationTime.QuadPart, &pStat->st_birthtim); birdNtTimeToTimeSpec(BasicInfo.ChangeTime.QuadPart, &pStat->st_ctim); birdNtTimeToTimeSpec(BasicInfo.LastWriteTime.QuadPart, &pStat->st_mtim); birdNtTimeToTimeSpec(BasicInfo.LastAccessTime.QuadPart, &pStat->st_atim); pStat->st_ino = InternalInfo.IndexNumber.QuadPart; pStat->st_nlink = StdInfo.NumberOfLinks; pStat->st_rdev = 0; pStat->st_uid = 0; pStat->st_gid = 0; pStat->st_padding1 = 0; pStat->st_attribs = BasicInfo.FileAttributes; pStat->st_blksize = 65536; pStat->st_blocks = (StdInfo.AllocationSize.QuadPart + BIRD_STAT_BLOCK_SIZE - 1) / BIRD_STAT_BLOCK_SIZE; /* Get the serial number, reusing the buffer from above. */ if (!cbNameInfo) { cbNameInfo = sizeof(MY_FILE_FS_VOLUME_INFORMATION) + 1024; pNameInfo = (MY_FILE_NAME_INFORMATION *)alloca(cbNameInfo); } rcNt = g_pfnNtQueryVolumeInformationFile(hFile, &Ios, pNameInfo, cbNameInfo, MyFileFsVolumeInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) { MY_FILE_FS_VOLUME_INFORMATION const *pVolInfo = (MY_FILE_FS_VOLUME_INFORMATION const *)pNameInfo; pStat->st_dev = pVolInfo->VolumeSerialNumber | (pVolInfo->VolumeCreationTime.QuadPart << 32); rc = 0; } else { pStat->st_dev = 0; rc = birdSetErrnoFromNt(rcNt); } } else rc = birdSetErrnoFromNt(rcNt); #endif return rc; } int birdStatHandle(HANDLE hFile, BirdStat_T *pStat, const char *pszPath) { return birdStatHandle2(hFile, pStat, pszPath, NULL); } /** * Generates a device number from the volume information. * * @returns Device number. * @param pVolInfo Volume information. */ unsigned __int64 birdVolumeInfoToDeviceNumber(const MY_FILE_FS_VOLUME_INFORMATION *pVolInfo) { return pVolInfo->VolumeSerialNumber | (pVolInfo->VolumeCreationTime.QuadPart << 32); } /** * Quries the volume information and generates a device number from it. * * @returns NT status code. * @param hFile The file/dir/whatever to query the volume info * and device number for. * @param pVolInfo User provided buffer for volume information. * @param cbVolInfo The size of the buffer. * @param puDevNo Where to return the device number. This is set * to zero on failure. */ MY_NTSTATUS birdQueryVolumeDeviceNumber(HANDLE hFile, MY_FILE_FS_VOLUME_INFORMATION *pVolInfo, size_t cbVolInfo, unsigned __int64 *puDevNo) { MY_IO_STATUS_BLOCK Ios; MY_NTSTATUS rcNt; Ios.u.Status = -1; Ios.Information = -1; pVolInfo->VolumeSerialNumber = 0; pVolInfo->VolumeCreationTime.QuadPart = 0; rcNt = g_pfnNtQueryVolumeInformationFile(hFile, &Ios, pVolInfo, (LONG)cbVolInfo, MyFileFsVolumeInformation); if (MY_NT_SUCCESS(rcNt)) { *puDevNo = birdVolumeInfoToDeviceNumber(pVolInfo); return Ios.u.Status; } *puDevNo = 0; return rcNt; } static int birdStatInternal(HANDLE hRoot, const char *pszPath, BirdStat_T *pStat, int fFollow) { int rc; HANDLE hFile = birdOpenFileEx(hRoot, pszPath, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_OPEN_FOR_BACKUP_INTENT | (fFollow ? 0 : FILE_OPEN_REPARSE_POINT), OBJ_CASE_INSENSITIVE); if (hFile != INVALID_HANDLE_VALUE) { rc = birdStatHandle2(hFile, pStat, pszPath, NULL); birdCloseFile(hFile); if (rc || !pStat->st_ismountpoint) { /* very likely */ } else { /* * If we hit a mount point (NTFS volume mounted under an empty NTFS directory), * we should return information about what's mounted there rather than the * directory it is mounted at as this is what UNIX does. */ hFile = birdOpenFileEx(hRoot, pszPath, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_OPEN_FOR_BACKUP_INTENT, OBJ_CASE_INSENSITIVE); if (hFile != INVALID_HANDLE_VALUE) { rc = birdStatHandle2(hFile, pStat, pszPath, NULL); pStat->st_ismountpoint = 2; birdCloseFile(hFile); } } #if 0 { static char s_szPrev[256]; size_t cchPath = strlen(pszPath); if (memcmp(s_szPrev, pszPath, cchPath >= 255 ? 255 : cchPath + 1) == 0) fprintf(stderr, "stat: %s -> rc/errno=%d/%u\n", pszPath, rc, errno); else memcpy(s_szPrev, pszPath, cchPath + 1); } #endif //fprintf(stderr, "stat: %s -> rc/errno=%d/%u\n", pszPath, rc, errno); } else { //fprintf(stderr, "stat: %s -> %u\n", pszPath, GetLastError()); /* * On things like pagefile.sys we may get sharing violation. We fall * back on directory enumeration for dealing with that. */ if ( errno == ETXTBSY && strchr(pszPath, '*') == NULL /* Serious paranoia... */ && strchr(pszPath, '?') == NULL) { MY_UNICODE_STRING NameUniStr; hFile = birdOpenParentDir(hRoot, pszPath, FILE_READ_DATA | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE, &NameUniStr); if (hFile != INVALID_HANDLE_VALUE) { MY_FILE_ID_FULL_DIR_INFORMATION *pBuf; ULONG cbBuf = sizeof(*pBuf) + NameUniStr.MaximumLength + 1024; MY_IO_STATUS_BLOCK Ios; MY_NTSTATUS rcNt; pBuf = (MY_FILE_ID_FULL_DIR_INFORMATION *)alloca(cbBuf); Ios.u.Status = -1; Ios.Information = -1; rcNt = g_pfnNtQueryDirectoryFile(hFile, NULL, NULL, NULL, &Ios, pBuf, cbBuf, MyFileIdFullDirectoryInformation, FALSE, &NameUniStr, TRUE); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) { /* * Convert the data. */ birdStatFillFromFileIdFullDirInfo(pStat, pBuf); /* Get the serial number, reusing the buffer from above. */ rcNt = birdQueryVolumeDeviceNumber(hFile, (MY_FILE_FS_VOLUME_INFORMATION *)pBuf, cbBuf, &pStat->st_dev); if (MY_NT_SUCCESS(rcNt)) rc = 0; else rc = birdSetErrnoFromNt(rcNt); } birdFreeNtPath(&NameUniStr); birdCloseFile(hFile); if (MY_NT_SUCCESS(rcNt)) return 0; birdSetErrnoFromNt(rcNt); } } rc = -1; } return rc; } static int birdStatInternalW(HANDLE hRoot, const wchar_t *pwszPath, BirdStat_T *pStat, int fFollow) { int rc; HANDLE hFile = birdOpenFileExW(hRoot, pwszPath, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_OPEN_FOR_BACKUP_INTENT | (fFollow ? 0 : FILE_OPEN_REPARSE_POINT), OBJ_CASE_INSENSITIVE); if (hFile != INVALID_HANDLE_VALUE) { rc = birdStatHandle2(hFile, pStat, NULL, pwszPath); birdCloseFile(hFile); if (rc || !pStat->st_ismountpoint) { /* very likely */ } else { /* * If we hit a mount point (NTFS volume mounted under an empty NTFS directory), * we should return information about what's mounted there rather than the * directory it is mounted at as this is what UNIX does. */ hFile = birdOpenFileExW(hRoot, pwszPath, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_OPEN_FOR_BACKUP_INTENT, OBJ_CASE_INSENSITIVE); if (hFile != INVALID_HANDLE_VALUE) { rc = birdStatHandle2(hFile, pStat, NULL, pwszPath); pStat->st_ismountpoint = 2; birdCloseFile(hFile); } } } else { /* * On things like pagefile.sys we may get sharing violation. We fall * back on directory enumeration for dealing with that. */ if ( errno == ETXTBSY && wcschr(pwszPath, '*') == NULL /* Serious paranoia... */ && wcschr(pwszPath, '?') == NULL) { MY_UNICODE_STRING NameUniStr; hFile = birdOpenParentDirW(hRoot, pwszPath, FILE_READ_DATA | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE, &NameUniStr); if (hFile != INVALID_HANDLE_VALUE) { MY_FILE_ID_FULL_DIR_INFORMATION *pBuf; ULONG cbBuf = sizeof(*pBuf) + NameUniStr.MaximumLength + 1024; MY_IO_STATUS_BLOCK Ios; MY_NTSTATUS rcNt; pBuf = (MY_FILE_ID_FULL_DIR_INFORMATION *)alloca(cbBuf); Ios.u.Status = -1; Ios.Information = -1; rcNt = g_pfnNtQueryDirectoryFile(hFile, NULL, NULL, NULL, &Ios, pBuf, cbBuf, MyFileIdFullDirectoryInformation, FALSE, &NameUniStr, TRUE); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) { /* * Convert the data. */ birdStatFillFromFileIdFullDirInfo(pStat, pBuf); /* Get the serial number, reusing the buffer from above. */ rcNt = birdQueryVolumeDeviceNumber(hFile, (MY_FILE_FS_VOLUME_INFORMATION *)pBuf, cbBuf, &pStat->st_dev); if (MY_NT_SUCCESS(rcNt)) rc = 0; else rc = birdSetErrnoFromNt(rcNt); } birdFreeNtPath(&NameUniStr); birdCloseFile(hFile); if (MY_NT_SUCCESS(rcNt)) return 0; birdSetErrnoFromNt(rcNt); } } rc = -1; } return rc; } /** * Implements UNIX fstat(). */ int birdStatOnFd(int fd, BirdStat_T *pStat) { int rc; HANDLE hFile = (HANDLE)_get_osfhandle(fd); if (hFile != INVALID_HANDLE_VALUE) { DWORD fFileType; birdResolveImports(); SetLastError(NO_ERROR); fFileType = GetFileType(hFile) & ~FILE_TYPE_REMOTE; switch (fFileType) { case FILE_TYPE_DISK: rc = birdStatHandle2(hFile, pStat, NULL, NULL); break; case FILE_TYPE_CHAR: case FILE_TYPE_PIPE: if (fFileType == FILE_TYPE_PIPE) pStat->st_mode = S_IFIFO | 0666; else pStat->st_mode = S_IFCHR | 0666; pStat->st_padding0[0] = 0; pStat->st_padding0[1] = 0; pStat->st_size = 0; pStat->st_atim.tv_sec = 0; pStat->st_atim.tv_nsec = 0; pStat->st_mtim.tv_sec = 0; pStat->st_mtim.tv_nsec = 0; pStat->st_ctim.tv_sec = 0; pStat->st_ctim.tv_nsec = 0; pStat->st_birthtim.tv_sec = 0; pStat->st_birthtim.tv_nsec = 0; pStat->st_ino = 0; pStat->st_dev = 0; pStat->st_rdev = 0; pStat->st_uid = 0; pStat->st_gid = 0; pStat->st_padding1 = 0; pStat->st_attribs = fFileType == FILE_TYPE_PIPE ? FILE_ATTRIBUTE_NORMAL : FILE_ATTRIBUTE_DEVICE; pStat->st_blksize = 512; pStat->st_blocks = 0; if (fFileType == FILE_TYPE_PIPE) { DWORD cbAvail; if (PeekNamedPipe(hFile, NULL, 0, NULL, &cbAvail, NULL)) pStat->st_size = cbAvail; } rc = 0; break; case FILE_TYPE_UNKNOWN: default: if (GetLastError() == NO_ERROR) rc = birdSetErrnoToBadFileNo(); else rc = birdSetErrnoFromWin32(GetLastError()); break; } } else rc = -1; return rc; } /** * Special case that only gets the file size and nothing else. */ int birdStatOnFdJustSize(int fd, __int64 *pcbFile) { int rc; HANDLE hFile = (HANDLE)_get_osfhandle(fd); if (hFile != INVALID_HANDLE_VALUE) { LARGE_INTEGER cbLocal; if (GetFileSizeEx(hFile, &cbLocal)) { *pcbFile = cbLocal.QuadPart; rc = 0; } else { BirdStat_T Stat; rc = birdStatOnFd(fd, &Stat); if (rc == 0) *pcbFile = Stat.st_size; } } else rc = -1; return rc; } /** * Implements UNIX stat(). */ int birdStatFollowLink(const char *pszPath, BirdStat_T *pStat) { return birdStatInternal(NULL, pszPath, pStat, 1 /*fFollow*/); } /** * Implements UNIX stat(). */ int birdStatFollowLinkW(const wchar_t *pwszPath, BirdStat_T *pStat) { return birdStatInternalW(NULL, pwszPath, pStat, 1 /*fFollow*/); } /** * Implements UNIX lstat(). */ int birdStatOnLink(const char *pszPath, BirdStat_T *pStat) { return birdStatInternal(NULL, pszPath, pStat, 0 /*fFollow*/); } /** * Implements UNIX lstat(). */ int birdStatOnLinkW(const wchar_t *pwszPath, BirdStat_T *pStat) { return birdStatInternalW(NULL, pwszPath, pStat, 0 /*fFollow*/); } /** * Implements an API like UNIX fstatat(). * * @returns 0 on success, -1 and errno on failure. * @param hRoot NT handle pwszPath is relative to. * @param pszPath The path. * @param pStat Where to return stats. * @param fFollowLink Whether to follow links. */ int birdStatAt(HANDLE hRoot, const char *pszPath, BirdStat_T *pStat, int fFollowLink) { return birdStatInternal(hRoot, pszPath, pStat, fFollowLink != 0); } /** * Implements an API like UNIX fstatat(). * * @returns 0 on success, -1 and errno on failure. * @param hRoot NT handle pwszPath is relative to. * @param pwszPath The path. * @param pStat Where to return stats. * @param fFollowLink Whether to follow links. */ int birdStatAtW(HANDLE hRoot, const wchar_t *pwszPath, BirdStat_T *pStat, int fFollowLink) { return birdStatInternalW(hRoot, pwszPath, pStat, fFollowLink != 0); } /** * Internal worker for birdStatModTimeOnly. */ static int birdStatOnlyInternal(const char *pszPath, int fFollowLink, MY_FILE_BASIC_INFORMATION *pBasicInfo) { int rc; HANDLE hFile = birdOpenFile(pszPath, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_OPEN_FOR_BACKUP_INTENT | (fFollowLink ? 0 : FILE_OPEN_REPARSE_POINT), OBJ_CASE_INSENSITIVE); if (hFile != INVALID_HANDLE_VALUE) { MY_NTSTATUS rcNt = 0; MY_IO_STATUS_BLOCK Ios; Ios.Information = 0; Ios.u.Status = -1; if (pBasicInfo) { rcNt = g_pfnNtQueryInformationFile(hFile, &Ios, pBasicInfo, sizeof(*pBasicInfo), MyFileBasicInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; } birdCloseFile(hFile); if (MY_NT_SUCCESS(rcNt)) rc = 0; else { birdSetErrnoFromNt(rcNt); rc = -1; } } else { //fprintf(stderr, "stat: %s -> %u\n", pszPath, GetLastError()); /* On things like pagefile.sys we may get sharing violation. */ if (GetLastError() == ERROR_SHARING_VIOLATION) { /** @todo Fall back on the parent directory enum if we run into a sharing * violation. */ } rc = -1; } return rc; } /** * Special function for getting the modification time. */ int birdStatModTimeOnly(const char *pszPath, BirdTimeSpec_T *pTimeSpec, int fFollowLink) { /* * Convert the path and call NtQueryFullAttributesFile. * * Note! NtQueryAttributesFile cannot be used as it only returns attributes. */ MY_UNICODE_STRING NtPath; birdResolveImports(); if (birdDosToNtPath(pszPath, &NtPath) == 0) { MY_OBJECT_ATTRIBUTES ObjAttr; MY_FILE_NETWORK_OPEN_INFORMATION Info; MY_NTSTATUS rcNt; memset(&Info, 0xfe, sizeof(Info)); MyInitializeObjectAttributes(&ObjAttr, &NtPath, OBJ_CASE_INSENSITIVE, NULL /*hRoot*/, NULL /*pSecAttr*/); rcNt = g_pfnNtQueryFullAttributesFile(&ObjAttr, &Info); birdFreeNtPath(&NtPath); if (MY_NT_SUCCESS(rcNt)) { birdNtTimeToTimeSpec(Info.LastWriteTime.QuadPart, pTimeSpec); /* Do the trailing slash check. */ if ( (Info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !birdIsPathDirSpec(pszPath)) { MY_FILE_BASIC_INFORMATION BasicInfo; if ( !(Info.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) || !fFollowLink) return 0; /* Fallback on birdStatOnlyInternal to follow the reparse point. */ if (!birdStatOnlyInternal(pszPath, fFollowLink, &BasicInfo)) { birdNtTimeToTimeSpec(BasicInfo.LastWriteTime.QuadPart, pTimeSpec); return 0; } } else errno = ENOTDIR; } else birdSetErrnoFromNt(rcNt); } return -1; } /** * Special function for getting the file mode. */ int birdStatModeOnly(const char *pszPath, unsigned __int16 *pMode, int fFollowLink) { /* * Convert the path and call NtQueryFullAttributesFile. */ MY_UNICODE_STRING NtPath; birdResolveImports(); if (birdDosToNtPath(pszPath, &NtPath) == 0) { MY_OBJECT_ATTRIBUTES ObjAttr; MY_FILE_BASIC_INFORMATION Info; MY_NTSTATUS rcNt; memset(&Info, 0xfe, sizeof(Info)); MyInitializeObjectAttributes(&ObjAttr, &NtPath, OBJ_CASE_INSENSITIVE, NULL /*hRoot*/, NULL /*pSecAttr*/); rcNt = g_pfnNtQueryAttributesFile(&ObjAttr, &Info); if (MY_NT_SUCCESS(rcNt)) { unsigned __int8 isdirsymlink = 0; unsigned __int8 ismountpoint = 0; *pMode = birdFileInfoToMode(Info.FileAttributes, 0, pszPath, NtPath.Buffer, NtPath.Length, &isdirsymlink, &ismountpoint); /* Do the trailing slash check. */ if ( (Info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !birdIsPathDirSpec(pszPath)) { if ( !(Info.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) || !fFollowLink) { birdFreeNtPath(&NtPath); return 0; } /* Fallback on birdStatOnlyInternal to follow the reparse point. */ if (!birdStatOnlyInternal(pszPath, fFollowLink, &Info)) { *pMode = birdFileInfoToMode(Info.FileAttributes, 0, pszPath, NtPath.Buffer, NtPath.Length, &isdirsymlink, &ismountpoint); birdFreeNtPath(&NtPath); return 0; } } else errno = ENOTDIR; } else birdSetErrnoFromNt(rcNt); birdFreeNtPath(&NtPath); } return -1; } kbuild-3608/src/lib/nt/tstNtStat.c0000664000175000017500000001205014670377415017014 0ustar locutuslocutus/* $Id: tstNtStat.c 3007 2016-11-06 16:46:43Z bird $ */ /** @file * Manual lstat/stat testcase. */ /* * Copyright (c) 2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include "ntstat.h" static int IsLeapYear(int iYear) { return iYear % 4 == 0 && ( iYear % 100 != 0 || iYear % 400 == 0); } static int DaysInMonth(int iYear, int iMonth) { switch (iMonth) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6: case 9: case 11: return 30; case 2: return IsLeapYear(iYear) ? 29 : 28; default: *(void **)(size_t)iMonth = 0; /* crash! */ return 0; } } static char *FormatTimeSpec(char *pszBuf, BirdTimeSpec_T const *pTimeSpec) { if (pTimeSpec->tv_sec >= 0) { int iYear = 1970; int iMonth = 1; int iDay = 1; int iHour = 0; int iMin = 0; int iSec = 0; __int64 cSecs = pTimeSpec->tv_sec; /* lazy bird approach, find date, day by day */ while (cSecs >= 24*3600) { if ( iDay < 28 || iDay < DaysInMonth(iYear, iMonth)) iDay++; else { if (iMonth < 12) iMonth++; else { iYear++; iMonth = 1; } iDay = 1; } cSecs -= 24*3600; } iHour = (int)cSecs / 3600; cSecs %= 3600; iMin = (int)cSecs / 60; iSec = (int)cSecs % 60; sprintf(pszBuf, "%04d-%02d-%02dT%02u:%02u:%02u.%09u (%I64d.%09u)", iYear, iMonth, iDay, iHour, iMin, iSec, pTimeSpec->tv_nsec, pTimeSpec->tv_sec, pTimeSpec->tv_nsec); } else sprintf(pszBuf, "%I64d.%09u (before 1970-01-01)", pTimeSpec->tv_sec, pTimeSpec->tv_nsec); return pszBuf; } int main(int argc, char **argv) { int rc = 0; int i; for (i = 1; i < argc; i++) { struct stat st; if (lstat(argv[i], &st) == 0) { char szBuf[256]; printf("%s:\n", argv[i]); printf(" st_mode: %o\n", st.st_mode); printf(" st_isdirsymlink: %d\n", st.st_isdirsymlink); printf(" st_ismountpoint: %d\n", st.st_ismountpoint); printf(" st_size: %I64u (%#I64x)\n", st.st_size, st.st_size); printf(" st_atim: %s\n", FormatTimeSpec(szBuf, &st.st_atim)); printf(" st_mtim: %s\n", FormatTimeSpec(szBuf, &st.st_mtim)); printf(" st_ctim: %s\n", FormatTimeSpec(szBuf, &st.st_ctim)); printf(" st_birthtim: %s\n", FormatTimeSpec(szBuf, &st.st_birthtim)); printf(" st_ino: %#I64x\n", st.st_ino); printf(" st_dev: %#I64x\n", st.st_dev); printf(" st_nlink: %u\n", st.st_nlink); printf(" st_rdev: %#x\n", st.st_rdev); printf(" st_uid: %d\n", st.st_uid); printf(" st_gid: %d\n", st.st_gid); printf(" st_blksize: %d (%#x)\n", st.st_blksize, st.st_blksize); printf(" st_blocks: %I64u (%#I64x)\n", st.st_blocks, st.st_blocks); } else { fprintf(stderr, "stat failed on '%s': errno=%u\n", argv[i], errno); rc = 1; } } return rc; } kbuild-3608/src/lib/nt/nthlpfs.c0000664000175000017500000004773614670377415016545 0ustar locutuslocutus/* $Id: nthlpfs.c 3223 2018-03-31 02:29:56Z bird $ */ /** @file * MSC + NT helpers for file system related functions. */ /* * Copyright (c) 2005-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "nthlp.h" #include #include #include #include /******************************************************************************* * Global Variables * *******************************************************************************/ static int g_fHaveOpenReparsePoint = -1; static int birdHasTrailingSlash(const char *pszPath) { char ch, ch2; /* Skip leading slashes. */ while ((ch = *pszPath) == '/' || ch == '\\') pszPath++; if (ch == '\0') return 0; /* Find the last char. */ while ((ch2 = *++pszPath) != '\0') ch = ch2; return ch == '/' || ch == '\\' || ch == ':'; } static int birdHasTrailingSlashW(const wchar_t *pwszPath) { wchar_t wc, wc2; /* Skip leading slashes. */ while ((wc = *pwszPath) == '/' || wc == '\\') pwszPath++; if (wc == '\0') return 0; /* Find the last char. */ while ((wc2 = *++pwszPath) != '\0') wc = wc2; return wc == '/' || wc == '\\' || wc == ':'; } int birdIsPathDirSpec(const char *pszPath) { char ch, ch2; /* Check for empty string. */ ch = *pszPath; if (ch == '\0') return 0; /* Find the last char. */ while ((ch2 = *++pszPath) != '\0') ch = ch2; return ch == '/' || ch == '\\' || ch == ':'; } static int birdIsPathDirSpecW(const wchar_t *pwszPath) { wchar_t wc, wc2; /* Check for empty string. */ wc = *pwszPath; if (wc == '\0') return 0; /* Find the last char. */ while ((wc2 = *++pwszPath) != '\0') wc = wc2; return wc == '/' || wc == '\\' || wc == ':'; } int birdDosToNtPath(const char *pszPath, MY_UNICODE_STRING *pNtPath) { MY_NTSTATUS rcNt; WCHAR wszTmp[4096]; MY_UNICODE_STRING TmpUniStr; MY_ANSI_STRING Src; birdResolveImports(); pNtPath->Length = pNtPath->MaximumLength = 0; pNtPath->Buffer = NULL; /* * Convert the input to wide char. */ Src.Buffer = (PCHAR)pszPath; Src.MaximumLength = Src.Length = (USHORT)strlen(pszPath); TmpUniStr.Length = 0; TmpUniStr.MaximumLength = sizeof(wszTmp) - sizeof(WCHAR); TmpUniStr.Buffer = wszTmp; rcNt = g_pfnRtlAnsiStringToUnicodeString(&TmpUniStr, &Src, FALSE); if (MY_NT_SUCCESS(rcNt)) { if (TmpUniStr.Length > 0 && !(TmpUniStr.Length & 1)) { wszTmp[TmpUniStr.Length / sizeof(WCHAR)] = '\0'; /* * Convert the wide DOS path to an NT path. */ if (g_pfnRtlDosPathNameToNtPathName_U(wszTmp, pNtPath, NULL, FALSE)) return 0; } rcNt = -1; } return birdSetErrnoFromNt(rcNt); } int birdDosToNtPathW(const wchar_t *pwszPath, MY_UNICODE_STRING *pNtPath) { birdResolveImports(); pNtPath->Length = pNtPath->MaximumLength = 0; pNtPath->Buffer = NULL; /* * Convert the wide DOS path to an NT path. */ if (g_pfnRtlDosPathNameToNtPathName_U(pwszPath, pNtPath, NULL, FALSE)) return 0; return birdSetErrnoFromNt(STATUS_NO_MEMORY); } /** * Converts UNIX slashes to DOS ones. * * @returns 0 * @param pNtPath The relative NT path to fix up. */ static int birdFixRelativeNtPathSlashesAndReturn0(MY_UNICODE_STRING *pNtPath) { size_t cwcLeft = pNtPath->Length / sizeof(wchar_t); wchar_t *pwcStart = pNtPath->Buffer; wchar_t *pwcHit; /* Convert slashes. */ while ((pwcHit = wmemchr(pwcStart, '/', cwcLeft)) != NULL) { *pwcHit = '\\'; cwcLeft -= pwcHit - pwcStart; pwcHit = pwcStart; } #if 0 /* Strip trailing slashes (NT doesn't like them). */ while ( pNtPath->Length >= sizeof(wchar_t) && pNtPath->Buffer[(pNtPath->Length - sizeof(wchar_t)) / sizeof(wchar_t)] == '\\') { pNtPath->Length -= sizeof(wchar_t); pNtPath->Buffer[pNtPath->Length / sizeof(wchar_t)] = '\0'; } /* If it was all trailing slashes we convert it to a dot path. */ if ( pNtPath->Length == 0 && pNtPath->MaximumLength >= sizeof(wchar_t) * 2) { pNtPath->Length = sizeof(wchar_t); pNtPath->Buffer[0] = '.'; pNtPath->Buffer[1] = '\0'; } #endif return 0; } /** * Similar to birdDosToNtPath, but it does call RtlDosPathNameToNtPathName_U. * * @returns 0 on success, -1 + errno on failure. * @param pszPath The relative path. * @param pNtPath Where to return the NT path. Call birdFreeNtPath when done. */ int birdDosToRelativeNtPath(const char *pszPath, MY_UNICODE_STRING *pNtPath) { MY_NTSTATUS rcNt; MY_ANSI_STRING Src; birdResolveImports(); /* * Just convert to wide char. */ pNtPath->Length = pNtPath->MaximumLength = 0; pNtPath->Buffer = NULL; Src.Buffer = (PCHAR)pszPath; Src.MaximumLength = Src.Length = (USHORT)strlen(pszPath); rcNt = g_pfnRtlAnsiStringToUnicodeString(pNtPath, &Src, TRUE /* Allocate */); if (MY_NT_SUCCESS(rcNt)) return birdFixRelativeNtPathSlashesAndReturn0(pNtPath); return birdSetErrnoFromNt(rcNt); } /** * Similar to birdDosToNtPathW, but it does call RtlDosPathNameToNtPathName_U. * * @returns 0 on success, -1 + errno on failure. * @param pwszPath The relative path. * @param pNtPath Where to return the NT path. Call birdFreeNtPath when done. */ int birdDosToRelativeNtPathW(const wchar_t *pwszPath, MY_UNICODE_STRING *pNtPath) { size_t cwcPath = wcslen(pwszPath); if (cwcPath < 0xfffe) { pNtPath->Length = (USHORT)(cwcPath * sizeof(wchar_t)); pNtPath->MaximumLength = pNtPath->Length + sizeof(wchar_t); pNtPath->Buffer = HeapAlloc(GetProcessHeap(), 0, pNtPath->MaximumLength); if (pNtPath->Buffer) { memcpy(pNtPath->Buffer, pwszPath, pNtPath->MaximumLength); return birdFixRelativeNtPathSlashesAndReturn0(pNtPath); } errno = ENOMEM; } else errno = ENAMETOOLONG; return -1; } /** * Frees a string returned by birdDosToNtPath, birdDosToNtPathW or * birdDosToRelativeNtPath. * * @param pNtPath The the NT path to free. */ void birdFreeNtPath(MY_UNICODE_STRING *pNtPath) { HeapFree(GetProcessHeap(), 0, pNtPath->Buffer); pNtPath->Buffer = NULL; pNtPath->Length = 0; pNtPath->MaximumLength = 0; } MY_NTSTATUS birdOpenFileUniStr(HANDLE hRoot, MY_UNICODE_STRING *pNtPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, HANDLE *phFile) { MY_IO_STATUS_BLOCK Ios; MY_OBJECT_ATTRIBUTES ObjAttr; MY_NTSTATUS rcNt; birdResolveImports(); if ( (fCreateOptions & FILE_OPEN_REPARSE_POINT) && g_fHaveOpenReparsePoint == 0) fCreateOptions &= ~FILE_OPEN_REPARSE_POINT; Ios.Information = -1; Ios.u.Status = 0; MyInitializeObjectAttributes(&ObjAttr, pNtPath, fObjAttribs, hRoot, NULL /*pSecAttr*/); rcNt = g_pfnNtCreateFile(phFile, fDesiredAccess, &ObjAttr, &Ios, NULL, /* cbFileInitialAlloc */ fFileAttribs, fShareAccess, fCreateDisposition, fCreateOptions, NULL, /* pEaBuffer */ 0); /* cbEaBuffer*/ if ( rcNt == STATUS_INVALID_PARAMETER && g_fHaveOpenReparsePoint < 0 && (fCreateOptions & FILE_OPEN_REPARSE_POINT)) { fCreateOptions &= ~FILE_OPEN_REPARSE_POINT; Ios.Information = -1; Ios.u.Status = 0; MyInitializeObjectAttributes(&ObjAttr, pNtPath, fObjAttribs, NULL /*hRoot*/, NULL /*pSecAttr*/); rcNt = g_pfnNtCreateFile(phFile, fDesiredAccess, &ObjAttr, &Ios, NULL, /* cbFileInitialAlloc */ fFileAttribs, fShareAccess, fCreateDisposition, fCreateOptions, NULL, /* pEaBuffer */ 0); /* cbEaBuffer*/ if (rcNt != STATUS_INVALID_PARAMETER) g_fHaveOpenReparsePoint = 0; } return rcNt; } HANDLE birdOpenFile(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs) { MY_UNICODE_STRING NtPath; MY_NTSTATUS rcNt; /* * Adjust inputs. */ if (birdIsPathDirSpec(pszPath)) fCreateOptions |= FILE_DIRECTORY_FILE; /* * Convert the path and call birdOpenFileUniStr to do the real work. */ if (birdDosToNtPath(pszPath, &NtPath) == 0) { HANDLE hFile; rcNt = birdOpenFileUniStr(NULL /*hRoot*/, &NtPath, fDesiredAccess, fFileAttribs, fShareAccess, fCreateDisposition, fCreateOptions, fObjAttribs, &hFile); birdFreeNtPath(&NtPath); if (MY_NT_SUCCESS(rcNt)) return hFile; birdSetErrnoFromNt(rcNt); } return INVALID_HANDLE_VALUE; } HANDLE birdOpenFileW(const wchar_t *pwszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs) { MY_UNICODE_STRING NtPath; MY_NTSTATUS rcNt; /* * Adjust inputs. */ if (birdIsPathDirSpecW(pwszPath)) fCreateOptions |= FILE_DIRECTORY_FILE; /* * Convert the path and call birdOpenFileUniStr to do the real work. */ if (birdDosToNtPathW(pwszPath, &NtPath) == 0) { HANDLE hFile; rcNt = birdOpenFileUniStr(NULL /*hRoot*/, &NtPath, fDesiredAccess, fFileAttribs, fShareAccess, fCreateDisposition, fCreateOptions, fObjAttribs, &hFile); birdFreeNtPath(&NtPath); if (MY_NT_SUCCESS(rcNt)) return hFile; birdSetErrnoFromNt(rcNt); } return INVALID_HANDLE_VALUE; } HANDLE birdOpenFileEx(HANDLE hRoot, const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs) { MY_UNICODE_STRING NtPath; MY_NTSTATUS rcNt; /* * Adjust inputs. */ if (birdIsPathDirSpec(pszPath)) fCreateOptions |= FILE_DIRECTORY_FILE; /* * Convert the path and call birdOpenFileUniStr to do the real work. */ if (hRoot == INVALID_HANDLE_VALUE) hRoot = NULL; if ((hRoot != NULL ? birdDosToRelativeNtPath(pszPath, &NtPath) : birdDosToNtPath(pszPath, &NtPath)) == 0) { HANDLE hFile; rcNt = birdOpenFileUniStr(hRoot, &NtPath, fDesiredAccess, fFileAttribs, fShareAccess, fCreateDisposition, fCreateOptions, fObjAttribs, &hFile); birdFreeNtPath(&NtPath); if (MY_NT_SUCCESS(rcNt)) return hFile; birdSetErrnoFromNt(rcNt); } return INVALID_HANDLE_VALUE; } HANDLE birdOpenFileExW(HANDLE hRoot, const wchar_t *pwszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs) { MY_UNICODE_STRING NtPath; MY_NTSTATUS rcNt; /* * Adjust inputs. */ if (birdIsPathDirSpecW(pwszPath)) fCreateOptions |= FILE_DIRECTORY_FILE; /* * Convert the path (could save ourselves this if pwszPath is perfect) and * call birdOpenFileUniStr to do the real work. */ if (hRoot == INVALID_HANDLE_VALUE) hRoot = NULL; if ((hRoot != NULL ? birdDosToRelativeNtPathW(pwszPath, &NtPath) : birdDosToNtPathW(pwszPath, &NtPath)) == 0) { HANDLE hFile; rcNt = birdOpenFileUniStr(hRoot, &NtPath, fDesiredAccess, fFileAttribs, fShareAccess, fCreateDisposition, fCreateOptions, fObjAttribs, &hFile); birdFreeNtPath(&NtPath); if (MY_NT_SUCCESS(rcNt)) return hFile; birdSetErrnoFromNt(rcNt); } return INVALID_HANDLE_VALUE; } static HANDLE birdOpenParentDirCommon(HANDLE hRoot, MY_UNICODE_STRING *pNtPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, MY_UNICODE_STRING *pNameUniStr) { MY_NTSTATUS rcNt; /* * Strip the path down to the directory. */ USHORT offName = pNtPath->Length / sizeof(WCHAR); USHORT cwcName = offName; WCHAR wc = 0; while ( offName > 0 && (wc = pNtPath->Buffer[offName - 1]) != '\\' && wc != '/' && wc != ':') offName--; if ( offName > 0 || (hRoot != NULL && cwcName > 0)) { cwcName -= offName; /* Make a copy of the file name, if requested. */ rcNt = STATUS_SUCCESS; if (pNameUniStr) { pNameUniStr->Length = cwcName * sizeof(WCHAR); pNameUniStr->MaximumLength = pNameUniStr->Length + sizeof(WCHAR); pNameUniStr->Buffer = (WCHAR *)HeapAlloc(GetProcessHeap(), 0, pNameUniStr->MaximumLength); if (pNameUniStr->Buffer) { memcpy(pNameUniStr->Buffer, &pNtPath->Buffer[offName], pNameUniStr->Length); pNameUniStr->Buffer[cwcName] = '\0'; } else rcNt = STATUS_NO_MEMORY; } /* Chop, chop. */ // Bad idea, breaks \\?\c:\pagefile.sys. //while ( offName > 0 // Bad idea, breaks \\?\c:\pagefile.sys. // && ( (wc = pNtPath->Buffer[offName - 1]) == '\\' // Bad idea, breaks \\?\c:\pagefile.sys. // || wc == '/')) // Bad idea, breaks \\?\c:\pagefile.sys. // offName--; if (offName == 0) pNtPath->Buffer[offName++] = '.'; /* Hack for dir handle + dir entry name. */ pNtPath->Length = offName * sizeof(WCHAR); pNtPath->Buffer[offName] = '\0'; if (MY_NT_SUCCESS(rcNt)) { /* * Finally, try open the directory. */ HANDLE hFile; fCreateOptions |= FILE_DIRECTORY_FILE; rcNt = birdOpenFileUniStr(hRoot, pNtPath, fDesiredAccess, fFileAttribs, fShareAccess, fCreateDisposition, fCreateOptions, fObjAttribs, &hFile); if (MY_NT_SUCCESS(rcNt)) { birdFreeNtPath(pNtPath); return hFile; } } if (pNameUniStr) birdFreeNtPath(pNameUniStr); } else rcNt = STATUS_INVALID_PARAMETER; birdFreeNtPath(pNtPath); birdSetErrnoFromNt(rcNt); return INVALID_HANDLE_VALUE; } HANDLE birdOpenParentDir(HANDLE hRoot, const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, MY_UNICODE_STRING *pNameUniStr) { /* * Convert the path and join up with the UTF-16 version (it'll free NtPath). */ MY_UNICODE_STRING NtPath; if (hRoot == INVALID_HANDLE_VALUE) hRoot = NULL; if ( hRoot == NULL ? birdDosToNtPath(pszPath, &NtPath) == 0 : birdDosToRelativeNtPath(pszPath, &NtPath) == 0) return birdOpenParentDirCommon(hRoot, &NtPath, fDesiredAccess, fFileAttribs, fShareAccess, fCreateDisposition, fCreateOptions, fObjAttribs, pNameUniStr); return INVALID_HANDLE_VALUE; } HANDLE birdOpenParentDirW(HANDLE hRoot, const wchar_t *pwszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, MY_UNICODE_STRING *pNameUniStr) { /* * Convert the path and join up with the ansi version (it'll free NtPath). */ MY_UNICODE_STRING NtPath; if (hRoot == INVALID_HANDLE_VALUE) hRoot = NULL; if ( hRoot == NULL ? birdDosToNtPathW(pwszPath, &NtPath) == 0 : birdDosToRelativeNtPathW(pwszPath, &NtPath) == 0) return birdOpenParentDirCommon(hRoot, &NtPath, fDesiredAccess, fFileAttribs, fShareAccess, fCreateDisposition, fCreateOptions, fObjAttribs, pNameUniStr); return INVALID_HANDLE_VALUE; } /** * Returns a handle to the current working directory of the process. * * @returns CWD handle with FILE_TRAVERSE and SYNCHRONIZE access. May return * INVALID_HANDLE_VALUE w/ errno for invalid CWD. */ HANDLE birdOpenCurrentDirectory(void) { PMY_RTL_USER_PROCESS_PARAMETERS pProcParams; MY_NTSTATUS rcNt; HANDLE hRet = INVALID_HANDLE_VALUE; birdResolveImports(); /* * We'll try get this from the PEB. */ g_pfnRtlAcquirePebLock(); pProcParams = (PMY_RTL_USER_PROCESS_PARAMETERS)MY_NT_CURRENT_PEB()->ProcessParameters; if (pProcParams != NULL) rcNt = g_pfnNtDuplicateObject(MY_NT_CURRENT_PROCESS, pProcParams->CurrentDirectory.Handle, MY_NT_CURRENT_PROCESS, &hRet, FILE_TRAVERSE | SYNCHRONIZE, 0 /*fAttribs*/, 0 /*fOptions*/); else rcNt = STATUS_INVALID_PARAMETER; g_pfnRtlReleasePebLock(); if (MY_NT_SUCCESS(rcNt)) return hRet; /* * Fallback goes thru birdOpenFileW. */ return birdOpenFileW(L".", FILE_TRAVERSE | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE); } void birdCloseFile(HANDLE hFile) { birdResolveImports(); g_pfnNtClose(hFile); } kbuild-3608/src/lib/nt/Makefile.kup0000664000175000017500000000000014670377415017126 0ustar locutuslocutuskbuild-3608/src/lib/nt/ntunlink.c0000664000175000017500000001775714670377415016731 0ustar locutuslocutus/* $Id: ntunlink.c 3504 2021-12-15 22:50:14Z bird $ */ /** @file * MSC + NT unlink and variations. */ /* * Copyright (c) 2005-2017 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "ntunlink.h" #include "ntstuff.h" #include "nthlp.h" static MY_NTSTATUS birdMakeWritable(HANDLE hRoot, MY_UNICODE_STRING *pNtPath) { MY_NTSTATUS rcNt; HANDLE hFile; rcNt = birdOpenFileUniStr(hRoot, pNtPath, FILE_WRITE_ATTRIBUTES | FILE_READ_ATTRIBUTES | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE, &hFile); if (MY_NT_SUCCESS(rcNt)) { MY_FILE_BASIC_INFORMATION BasicInfo; MY_IO_STATUS_BLOCK Ios; DWORD dwAttr; Ios.Information = -1; Ios.u.Status = -1; memset(&BasicInfo, 0, sizeof(BasicInfo)); rcNt = g_pfnNtQueryInformationFile(hFile, &Ios, &BasicInfo, sizeof(BasicInfo), MyFileBasicInformation); if (MY_NT_SUCCESS(rcNt) && MY_NT_SUCCESS(Ios.u.Status) && BasicInfo.FileAttributes != FILE_ATTRIBUTE_READONLY) dwAttr = BasicInfo.FileAttributes & ~FILE_ATTRIBUTE_READONLY; else dwAttr = FILE_ATTRIBUTE_NORMAL; memset(&BasicInfo, 0, sizeof(BasicInfo)); BasicInfo.FileAttributes = dwAttr; Ios.Information = -1; Ios.u.Status = -1; rcNt = g_pfnNtSetInformationFile(hFile, &Ios, &BasicInfo, sizeof(BasicInfo), MyFileBasicInformation); birdCloseFile(hFile); } return rcNt; } static int birdUnlinkInternal(HANDLE hRoot, const char *pszFile, const wchar_t *pwszFile, int fReadOnlyToo, int fFast) { MY_UNICODE_STRING NtPath; int rc; if (hRoot == INVALID_HANDLE_VALUE) hRoot = NULL; if (hRoot == NULL) { if (pwszFile) rc = birdDosToNtPathW(pwszFile, &NtPath); else rc = birdDosToNtPath(pszFile, &NtPath); } else { if (pwszFile) rc = birdDosToRelativeNtPathW(pwszFile, &NtPath); else rc = birdDosToRelativeNtPath(pszFile, &NtPath); } if (rc == 0) { MY_NTSTATUS rcNt; if (fFast) { /* This uses FILE_DELETE_ON_CLOSE. Probably only suitable when in a hurry... */ MY_OBJECT_ATTRIBUTES ObjAttr; MyInitializeObjectAttributes(&ObjAttr, &NtPath, OBJ_CASE_INSENSITIVE, hRoot, NULL /*pSecAttr*/); rcNt = g_pfnNtDeleteFile(&ObjAttr); /* In case some file system does things differently than NTFS. */ if (rcNt == STATUS_CANNOT_DELETE && fReadOnlyToo) { birdMakeWritable(hRoot, &NtPath); rcNt = g_pfnNtDeleteFile(&ObjAttr); } } else { /* Use the set information stuff. Probably more reliable. */ HANDLE hFile; for (;;) { rcNt = birdOpenFileUniStr(hRoot, &NtPath, DELETE | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, FILE_OPEN_FOR_BACKUP_INTENT | FILE_OPEN_REPARSE_POINT, OBJ_CASE_INSENSITIVE, &hFile); if (MY_NT_SUCCESS(rcNt)) { MY_FILE_DISPOSITION_INFORMATION DispInfo; MY_IO_STATUS_BLOCK Ios; DispInfo.DeleteFile = TRUE; Ios.Information = -1; Ios.u.Status = -1; rcNt = g_pfnNtSetInformationFile(hFile, &Ios, &DispInfo, sizeof(DispInfo), MyFileDispositionInformation); birdCloseFile(hFile); } if (rcNt != STATUS_CANNOT_DELETE || !fReadOnlyToo) break; fReadOnlyToo = 0; birdMakeWritable(hRoot, &NtPath); } } birdFreeNtPath(&NtPath); if (MY_NT_SUCCESS(rcNt)) rc = 0; else rc = birdSetErrnoFromNt(rcNt); } return rc; } int birdUnlink(const char *pszFile) { return birdUnlinkInternal(NULL /*hRoot*/, pszFile, NULL /*pwszFile*/, 0 /*fReadOnlyToo*/, 0 /*fFast*/); } int birdUnlinkW(const wchar_t *pwszFile) { return birdUnlinkInternal(NULL /*hRoot*/, NULL /*pwszFile*/, pwszFile, 0 /*fReadOnlyToo*/, 0 /*fFast*/); } int birdUnlinkEx(void *hRoot, const char *pszFile) { return birdUnlinkInternal((HANDLE)hRoot, pszFile, NULL /*pwszFile*/, 0 /*fReadOnlyToo*/, 0 /*fFast*/); } int birdUnlinkExW(void *hRoot, const wchar_t *pwszFile) { return birdUnlinkInternal((HANDLE)hRoot, NULL /*pszFile*/, pwszFile, 0 /*fReadOnlyToo*/, 0 /*fFast*/); } int birdUnlinkForced(const char *pszFile) { return birdUnlinkInternal(NULL /*hRoot*/, pszFile, NULL /*pwszFile*/, 1 /*fReadOnlyToo*/, 0 /*fFast*/); } int birdUnlinkForcedW(const wchar_t *pwszFile) { return birdUnlinkInternal(NULL /*hRoot*/, NULL /*pszFile*/, pwszFile, 1 /*fReadOnlyToo*/, 0 /*fFast*/); } int birdUnlinkForcedEx(void *hRoot, const char *pszFile) { return birdUnlinkInternal((HANDLE)hRoot, pszFile, NULL /*pwszFile*/, 1 /*fReadOnlyToo*/, 0 /*fFast*/); } int birdUnlinkForcedExW(void *hRoot, const wchar_t *pwszFile) { return birdUnlinkInternal((HANDLE)hRoot, NULL /*pszFile*/, pwszFile, 1 /*fReadOnlyToo*/, 0 /*fFast*/); } int birdUnlinkForcedFast(const char *pszFile) { return birdUnlinkInternal(NULL /*hRoot*/, pszFile, NULL /*pwszFile*/, 1 /*fReadOnlyToo*/, 1 /*fFast*/); } int birdUnlinkForcedFastW(const wchar_t *pwszFile) { return birdUnlinkInternal(NULL /*hRoot*/, NULL /*pszFile*/, pwszFile, 1 /*fReadOnlyToo*/, 1 /*fFast*/); } int birdUnlinkForcedFastEx(void *hRoot, const char *pszFile) { return birdUnlinkInternal((HANDLE)hRoot, pszFile, NULL /*pwszFile*/, 1 /*fReadOnlyToo*/, 1 /*fFast*/); } int birdUnlinkForcedFastExW(void *hRoot, const wchar_t *pwszFile) { return birdUnlinkInternal((HANDLE)hRoot, NULL /*pszFile*/, pwszFile, 1 /*fReadOnlyToo*/, 1 /*fFast*/); } kbuild-3608/src/lib/nt/kFsCache.h0000664000175000017500000005561214670377415016533 0ustar locutuslocutus/* $Id: kFsCache.h 3381 2020-06-12 11:36:10Z bird $ */ /** @file * kFsCache.c - NT directory content cache. */ /* * Copyright (c) 2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___lib_nt_kFsCache_h___ #define ___lib_nt_kFsCache_h___ #include #include "ntstat.h" #ifndef NDEBUG # include #endif /** @def KFSCACHE_CFG_UTF16 * Whether to compile in the UTF-16 names support. */ #define KFSCACHE_CFG_UTF16 1 /** @def KFSCACHE_CFG_SHORT_NAMES * Whether to compile in the short name support. */ #define KFSCACHE_CFG_SHORT_NAMES 1 /** @def KFSCACHE_CFG_PATH_HASH_TAB_SIZE * Size of the path hash table. */ #define KFSCACHE_CFG_PATH_HASH_TAB_SIZE 99991 /** The max length paths we consider. */ #define KFSCACHE_CFG_MAX_PATH 1024 /** The max ANSI name length. */ #define KFSCACHE_CFG_MAX_ANSI_NAME (256*3 + 16) /** The max UTF-16 name length. */ #define KFSCACHE_CFG_MAX_UTF16_NAME (256*2 + 16) /** Enables locking of the cache and thereby making it thread safe. */ #define KFSCACHE_CFG_LOCKING 1 /** Special KFSOBJ::uCacheGen number indicating that it does not apply. */ #define KFSOBJ_CACHE_GEN_IGNORE KU32_MAX /** @name KFSOBJ_TYPE_XXX - KFSOBJ::bObjType * @{ */ /** Directory, type KFSDIR. */ #define KFSOBJ_TYPE_DIR KU8_C(0x01) /** Regular file - type KFSOBJ. */ #define KFSOBJ_TYPE_FILE KU8_C(0x02) /** Other file - type KFSOBJ. */ #define KFSOBJ_TYPE_OTHER KU8_C(0x03) /** Caching of a negative result - type KFSOBJ. * @remarks We will allocate enough space for the largest cache node, so this * can metamorph into any other object should it actually turn up. */ #define KFSOBJ_TYPE_MISSING KU8_C(0x04) ///** Invalidated entry flag. */ //#define KFSOBJ_TYPE_F_INVALID KU8_C(0x20) /** @} */ /** @name KFSOBJ_F_XXX - KFSOBJ::fFlags * @{ */ /** Use custom generation. * @remarks This is given the value 1, as we use it as an index into * KFSCACHE::auGenerations, 0 being the default. */ #define KFSOBJ_F_USE_CUSTOM_GEN KU32_C(0x00000001) /** Whether the file system update the modified timestamp of directories * when something is removed from it or added to it. * @remarks They say NTFS is the only windows filesystem doing this. */ #define KFSOBJ_F_WORKING_DIR_MTIME KU32_C(0x00000002) /** NTFS file system volume. */ #define KFSOBJ_F_NTFS KU32_C(0x80000000) /** Flags that are automatically inherited. */ #define KFSOBJ_F_INHERITED_MASK KU32_C(0xffffffff) /** @} */ #define IS_ALPHA(ch) ( ((ch) >= 'A' && (ch) <= 'Z') || ((ch) >= 'a' && (ch) <= 'z') ) #define IS_SLASH(ch) ((ch) == '\\' || (ch) == '/') /** Pointer to a cache. */ typedef struct KFSCACHE *PKFSCACHE; /** Pointer to a core object. */ typedef struct KFSOBJ *PKFSOBJ; /** Pointer to a directory object. */ typedef struct KFSDIR *PKFSDIR; /** Pointer to a directory hash table entry. */ typedef struct KFSOBJHASH *PKFSOBJHASH; /** Pointer to a user data item. */ typedef struct KFSUSERDATA *PKFSUSERDATA; /** * User data item associated with a cache node. */ typedef struct KFSUSERDATA { /** Pointer to the next piece of user data. */ PKFSUSERDATA pNext; /** The key identifying this user. */ KUPTR uKey; /** The destructor. */ void (*pfnDestructor)(PKFSCACHE pCache, PKFSOBJ pObj, PKFSUSERDATA pData); } KFSUSERDATA; /** * Storage for name strings for the unlikely event that they should grow in * length after the KFSOBJ was created. */ typedef struct KFSOBJNAMEALLOC { /** Size of the allocation. */ KU32 cb; /** The space for names. */ char abSpace[1]; } KFSOBJNAMEALLOC; /** Name growth allocation. */ typedef KFSOBJNAMEALLOC *PKFSOBJNAMEALLOC; /** * Base cache node. */ typedef struct KFSOBJ { /** Magic value (KFSOBJ_MAGIC). */ KU32 u32Magic; /** Number of references. */ KU32 volatile cRefs; /** The cache generation, see KFSOBJ_CACHE_GEN_IGNORE. */ KU32 uCacheGen; /** The object type, KFSOBJ_TYPE_XXX. */ KU8 bObjType; /** Set if the Stats member is valid, clear if not. */ KBOOL fHaveStats; /** Internal debug field for counting path hash references. * @internal */ KU8 cPathHashRefs; /** Index into KFSCACHE::auUserData. */ KU8 idxUserDataLock; /** Flags, KFSOBJ_F_XXX. */ KU32 fFlags; /** Hash value of the name inserted into the parent hash table. * This is 0 if not inserted. Names are only hashed and inserted as they are * first found thru linear searching of its siblings, and which name it is * dependens on the lookup function (W or A) and whether the normal name or * short name seems to have matched. * * @note It was ruled out as too much work to hash and track all four names, * so instead this minimalist approach was choosen in stead. */ KU32 uNameHash; /** Pointer to the next child with the same name hash value. */ PKFSOBJ pNextNameHash; /** Pointer to the parent (directory). * This is only NULL for a root. */ PKFSDIR pParent; /** The directory name. (Allocated after the structure.) */ const char *pszName; /** The length of pszName. */ KU16 cchName; /** The length of the parent path (up to where pszName starts). * @note This is valuable when constructing an absolute path to this node by * means of the parent pointer (no need for recursion). */ KU16 cchParent; #ifdef KFSCACHE_CFG_UTF16 /** The length of pwszName (in wchar_t's). */ KU16 cwcName; /** The length of the parent UTF-16 path (in wchar_t's). * @note This is valuable when constructing an absolute path to this node by * means of the parent pointer (no need for recursion). */ KU16 cwcParent; /** The UTF-16 object name. (Allocated after the structure.) */ const wchar_t *pwszName; #endif #ifdef KFSCACHE_CFG_SHORT_NAMES /** The short object name. (Allocated after the structure, could be same * as pszName.) */ const char *pszShortName; /** The length of pszShortName. */ KU16 cchShortName; /** The length of the short parent path (up to where pszShortName starts). */ KU16 cchShortParent; # ifdef KFSCACHE_CFG_UTF16 /** The length of pwszShortName (in wchar_t's). */ KU16 cwcShortName; /** The length of the short parent UTF-16 path (in wchar_t's). */ KU16 cwcShortParent; /** The UTF-16 short object name. (Allocated after the structure, possibly * same as pwszName.) */ const wchar_t *pwszShortName; # endif #endif /** Allocation for handling name length increases. */ PKFSOBJNAMEALLOC pNameAlloc; /** Pointer to the first user data item */ PKFSUSERDATA pUserDataHead; /** Stats - only valid when fHaveStats is set. */ BirdStat_T Stats; } KFSOBJ; /** The magic for a KFSOBJ structure (Thelonious Sphere Monk). */ #define KFSOBJ_MAGIC KU32_C(0x19171010) /** * Directory node in the cache. */ typedef struct KFSDIR { /** The core object information. */ KFSOBJ Obj; /** Child objects. */ PKFSOBJ *papChildren; /** The number of child objects. */ KU32 cChildren; /** The allocated size of papChildren. */ KU32 cChildrenAllocated; /** Pointer to the child hash table. */ PKFSOBJ *papHashTab; /** The mask shift of the hash table. * Hash table size is a power of two, this is the size minus one. * * @remarks The hash table is optional and populated by lookup hits. The * assumption being that a lookup is repeated and will choose a good * name to hash on. We've got up to 4 different hashes, so this * was the easy way out. */ KU32 fHashTabMask; /** Handle to the directory (we generally keep it open). */ #ifndef DECLARE_HANDLE KUPTR hDir; #else HANDLE hDir; #endif /** The device number we queried/inherited when opening it. */ KU64 uDevNo; /** The last write time sampled the last time the directory was refreshed. * @remarks May differ from st_mtim because it will be updated when the * parent directory is refreshed. */ KI64 iLastWrite; /** The time that iLastWrite was read. */ KI64 iLastPopulated; /** Set if populated. */ KBOOL fPopulated; /** Set if it needs re-populated. */ KBOOL fNeedRePopulating; } KFSDIR; /** * Lookup errors. */ typedef enum KFSLOOKUPERROR { /** Lookup was a success. */ KFSLOOKUPERROR_SUCCESS = 0, /** A path component was not found. */ KFSLOOKUPERROR_PATH_COMP_NOT_FOUND, /** A path component is not a directory. */ KFSLOOKUPERROR_PATH_COMP_NOT_DIR, /** The final path entry is not a directory (trailing slash). */ KFSLOOKUPERROR_NOT_DIR, /** Not found. */ KFSLOOKUPERROR_NOT_FOUND, /** The path is too long. */ KFSLOOKUPERROR_PATH_TOO_LONG, /** The path is too short. */ KFSLOOKUPERROR_PATH_TOO_SHORT, /** Unsupported path type. */ KFSLOOKUPERROR_UNSUPPORTED, /** We're out of memory. */ KFSLOOKUPERROR_OUT_OF_MEMORY, /** Error opening directory. */ KFSLOOKUPERROR_DIR_OPEN_ERROR, /** Error reading directory. */ KFSLOOKUPERROR_DIR_READ_ERROR, /** UTF-16 to ANSI conversion error. */ KFSLOOKUPERROR_ANSI_CONVERSION_ERROR, /** ANSI to UTF-16 conversion error. */ KFSLOOKUPERROR_UTF16_CONVERSION_ERROR, /** Internal error. */ KFSLOOKUPERROR_INTERNAL_ERROR } KFSLOOKUPERROR; /** Pointer to an ANSI path hash table entry. */ typedef struct KFSHASHA *PKFSHASHA; /** * ANSI file system path hash table entry. * The path hash table allows us to skip parsing and walking a path. */ typedef struct KFSHASHA { /** Next entry with the same hash table slot. */ PKFSHASHA pNext; /** Path hash value. */ KU32 uHashPath; /** The path length. */ KU16 cchPath; /** Set if aboslute path. */ KBOOL fAbsolute; /** Index into KFSCACHE:auGenerationsMissing when pFsObj is NULL. */ KU8 idxMissingGen; /** The cache generation ID. */ KU32 uCacheGen; /** The lookup error (when pFsObj is NULL). */ KFSLOOKUPERROR enmError; /** The path. (Allocated after the structure.) */ const char *pszPath; /** Pointer to the matching FS object. * This is NULL for negative path entries? */ PKFSOBJ pFsObj; } KFSHASHA; #ifdef KFSCACHE_CFG_UTF16 /** Pointer to an UTF-16 path hash table entry. */ typedef struct KFSHASHW *PKFSHASHW; /** * UTF-16 file system path hash table entry. The path hash table allows us * to skip parsing and walking a path. */ typedef struct KFSHASHW { /** Next entry with the same hash table slot. */ PKFSHASHW pNext; /** Path hash value. */ KU32 uHashPath; /** The path length (in wchar_t units). */ KU16 cwcPath; /** Set if aboslute path. */ KBOOL fAbsolute; /** Index into KFSCACHE:auGenerationsMissing when pFsObj is NULL. */ KU8 idxMissingGen; /** The cache generation ID. */ KU32 uCacheGen; /** The lookup error (when pFsObj is NULL). */ KFSLOOKUPERROR enmError; /** The path. (Allocated after the structure.) */ const wchar_t *pwszPath; /** Pointer to the matching FS object. * This is NULL for negative path entries? */ PKFSOBJ pFsObj; } KFSHASHW; #endif /** @def KFSCACHE_LOCK * Locks the cache exclusively. */ /** @def KFSCACHE_UNLOCK * Counterpart to KFSCACHE_LOCK. */ /** @def KFSCACHE_OBJUSERDATA_LOCK * Locks the user data list of an object exclusively. */ /** @def KFSCACHE_OBJUSERDATA_UNLOCK * Counterpart to KFSCACHE_OBJUSERDATA_LOCK. */ #ifdef KFSCACHE_CFG_LOCKING # define KFSCACHE_LOCK(a_pCache) EnterCriticalSection(&(a_pCache)->u.CritSect) # define KFSCACHE_UNLOCK(a_pCache) LeaveCriticalSection(&(a_pCache)->u.CritSect) # define KFSCACHE_OBJUSERDATA_LOCK(a_pCache, a_pObj) do { \ KU8 idxUserDataLock = (a_pObj)->idxUserDataLock; \ if (idxUserDataLock != KU8_MAX) \ { /* likely */ } \ else \ idxUserDataLock = kFsCacheObjGetUserDataLockIndex(a_pCache, a_pObj); \ idxUserDataLock &= (KU8)(K_ELEMENTS((a_pCache)->auUserDataLocks) - 1); \ EnterCriticalSection(&(a_pCache)->auUserDataLocks[idxUserDataLock].CritSect); \ } while (0) # define KFSCACHE_OBJUSERDATA_UNLOCK(a_pCache, a_pObj) \ LeaveCriticalSection(&(a_pCache)->auUserDataLocks[(a_pObj)->idxUserDataLock & (K_ELEMENTS((a_pCache)->auUserDataLocks) - 1)].CritSect) #else # define KFSCACHE_LOCK(a_pCache) do { } while (0) # define KFSCACHE_UNLOCK(a_pCache) do { } while (0) # define KFSCACHE_OBJUSERDATA_LOCK(a_pCache, a_pObj) do { } while (0) # define KFSCACHE_OBJUSERDATA_UNLOCK(a_pCache, a_pObj) do { } while (0) #endif /** @name KFSCACHE_F_XXX * @{ */ /** Whether to cache missing directory entries (KFSOBJ_TYPE_MISSING). */ #define KFSCACHE_F_MISSING_OBJECTS KU32_C(0x00000001) /** Whether to cache missing paths. */ #define KFSCACHE_F_MISSING_PATHS KU32_C(0x00000002) /** @} */ /** * Directory cache instance. */ typedef struct KFSCACHE { /** Magic value (KFSCACHE_MAGIC). */ KU32 u32Magic; /** Cache flags. */ KU32 fFlags; /** The default and custom cache generations for stuff that exists, indexed by * KFSOBJ_F_USE_CUSTOM_GEN. * * The custom generation can be used to invalidate parts of the file system that * are known to be volatile without triggering refreshing of the more static * parts. Like the 'out' directory in a kBuild setup or a 'TEMP' directory are * expected to change and you need to invalidate the caching of these frequently * to stay on top of things. Whereas the sources, headers, compilers, sdk, * ddks, windows directory and such generally doesn't change all that often. */ KU32 auGenerations[2]; /** The current cache generation for missing objects, negative results, ++. * This comes with a custom variant too. Indexed by KFSOBJ_F_USE_CUSTOM_GEN. */ KU32 auGenerationsMissing[2]; /** Number of cache objects. */ KSIZE cObjects; /** Memory occupied by the cache object structures. */ KSIZE cbObjects; /** Number of lookups. */ KSIZE cLookups; /** Number of hits in the path hash tables. */ KSIZE cPathHashHits; /** Number of hits walking the file system hierarchy. */ KSIZE cWalkHits; /** Number of child searches. */ KSIZE cChildSearches; /** Number of cChildLookups resolved thru hash table hits. */ KSIZE cChildHashHits; /** The number of child hash tables. */ KSIZE cChildHashTabs; /** The sum of all child hash table sizes. */ KSIZE cChildHashEntriesTotal; /** Number of children inserted into the hash tables. */ KSIZE cChildHashed; /** Number of collisions in the child hash tables. */ KSIZE cChildHashCollisions; /** Number times a object name changed. */ KSIZE cNameChanges; /** Number times a object name grew and needed KFSOBJNAMEALLOC. * (Subset of cNameChanges) */ KSIZE cNameGrowths; /** The root directory. */ KFSDIR RootDir; #ifdef KFSCACHE_CFG_LOCKING union { # ifdef _WINBASE_ CRITICAL_SECTION CritSect; # endif KU64 abPadding[2 * 4 + 4 * sizeof(void *)]; } /** Critical section protecting the cache. */ u, /** Critical section protecting the pUserDataHead of objects. * @note Array size must be a power of two. */ auUserDataLocks[8]; /** The next auUserData index. */ KU8 idxUserDataNext; #endif /** File system hash table for ANSI filename strings. */ PKFSHASHA apAnsiPaths[KFSCACHE_CFG_PATH_HASH_TAB_SIZE]; /** Number of paths in the apAnsiPaths hash table. */ KSIZE cAnsiPaths; /** Number of collisions in the apAnsiPaths hash table. */ KSIZE cAnsiPathCollisions; /** Amount of memory used by the path entries. */ KSIZE cbAnsiPaths; #ifdef KFSCACHE_CFG_UTF16 /** Number of paths in the apUtf16Paths hash table. */ KSIZE cUtf16Paths; /** Number of collisions in the apUtf16Paths hash table. */ KSIZE cUtf16PathCollisions; /** Amount of memory used by the UTF-16 path entries. */ KSIZE cbUtf16Paths; /** File system hash table for UTF-16 filename strings. */ PKFSHASHW apUtf16Paths[KFSCACHE_CFG_PATH_HASH_TAB_SIZE]; #endif } KFSCACHE; /** Magic value for KFSCACHE::u32Magic (Jon Batiste). */ #define KFSCACHE_MAGIC KU32_C(0x19861111) /** @def KW_LOG * Generic logging. * @param a Argument list for kFsCacheDbgPrintf */ #if 1 /*def NDEBUG - enable when needed! */ # define KFSCACHE_LOG(a) do { } while (0) #else # define KFSCACHE_LOG(a) kFsCacheDbgPrintf a void kFsCacheDbgPrintfV(const char *pszFormat, va_list va); void kFsCacheDbgPrintf(const char *pszFormat, ...); #endif KBOOL kFsCacheDirEnsurePopuplated(PKFSCACHE pCache, PKFSDIR pDir, KFSLOOKUPERROR *penmError); KBOOL kFsCacheDirAddChild(PKFSCACHE pCache, PKFSDIR pParent, PKFSOBJ pChild, KFSLOOKUPERROR *penmError); PKFSOBJ kFsCacheCreateObject(PKFSCACHE pCache, PKFSDIR pParent, char const *pszName, KU16 cchName, wchar_t const *pwszName, KU16 cwcName, #ifdef KFSCACHE_CFG_SHORT_NAMES char const *pszShortName, KU16 cchShortName, wchar_t const *pwszShortName, KU16 cwcShortName, #endif KU8 bObjType, KFSLOOKUPERROR *penmError); PKFSOBJ kFsCacheCreateObjectW(PKFSCACHE pCache, PKFSDIR pParent, wchar_t const *pwszName, KU32 cwcName, #ifdef KFSCACHE_CFG_SHORT_NAMES wchar_t const *pwszShortName, KU32 cwcShortName, #endif KU8 bObjType, KFSLOOKUPERROR *penmError); PKFSOBJ kFsCacheLookupA(PKFSCACHE pCache, const char *pszPath, KFSLOOKUPERROR *penmError); PKFSOBJ kFsCacheLookupW(PKFSCACHE pCache, const wchar_t *pwszPath, KFSLOOKUPERROR *penmError); PKFSOBJ kFsCacheLookupRelativeToDirA(PKFSCACHE pCache, PKFSDIR pParent, const char *pszPath, KU32 cchPath, KU32 fFlags, KFSLOOKUPERROR *penmError, PKFSOBJ *ppLastAncestor); PKFSOBJ kFsCacheLookupRelativeToDirW(PKFSCACHE pCache, PKFSDIR pParent, const wchar_t *pwszPath, KU32 cwcPath, KU32 fFlags, KFSLOOKUPERROR *penmError, PKFSOBJ *ppLastAncestor); PKFSOBJ kFsCacheLookupWithLengthA(PKFSCACHE pCache, const char *pchPath, KSIZE cchPath, KFSLOOKUPERROR *penmError); PKFSOBJ kFsCacheLookupWithLengthW(PKFSCACHE pCache, const wchar_t *pwcPath, KSIZE cwcPath, KFSLOOKUPERROR *penmError); PKFSOBJ kFsCacheLookupNoMissingA(PKFSCACHE pCache, const char *pszPath, KFSLOOKUPERROR *penmError); PKFSOBJ kFsCacheLookupNoMissingW(PKFSCACHE pCache, const wchar_t *pwszPath, KFSLOOKUPERROR *penmError); /** @name KFSCACHE_LOOKUP_F_XXX - lookup flags * @{ */ /** No inserting new cache entries. * This effectively prevent directories from being repopulated too. */ #define KFSCACHE_LOOKUP_F_NO_INSERT KU32_C(1) /** No refreshing cache entries. */ #define KFSCACHE_LOOKUP_F_NO_REFRESH KU32_C(2) /** @} */ KU32 kFsCacheObjRelease(PKFSCACHE pCache, PKFSOBJ pObj); KU32 kFsCacheObjReleaseTagged(PKFSCACHE pCache, PKFSOBJ pObj, const char *pszWhere); #ifndef NDEBUG /* enable to debug object release. */ # define kFsCacheObjRelease(a_pCache, a_pObj) kFsCacheObjReleaseTagged(a_pCache, a_pObj, __FUNCTION__) #endif KU32 kFsCacheObjRetain(PKFSOBJ pObj); PKFSUSERDATA kFsCacheObjAddUserData(PKFSCACHE pCache, PKFSOBJ pObj, KUPTR uKey, KSIZE cbUserData); PKFSUSERDATA kFsCacheObjGetUserData(PKFSCACHE pCache, PKFSOBJ pObj, KUPTR uKey); KU8 kFsCacheObjGetUserDataLockIndex(PKFSCACHE pCache, PKFSOBJ pObj); KBOOL kFsCacheObjGetFullPathA(PKFSOBJ pObj, char *pszPath, KSIZE cbPath, char chSlash); KBOOL kFsCacheObjGetFullPathW(PKFSOBJ pObj, wchar_t *pwszPath, KSIZE cwcPath, wchar_t wcSlash); KBOOL kFsCacheObjGetFullShortPathA(PKFSOBJ pObj, char *pszPath, KSIZE cbPath, char chSlash); KBOOL kFsCacheObjGetFullShortPathW(PKFSOBJ pObj, wchar_t *pwszPath, KSIZE cwcPath, wchar_t wcSlash); KBOOL kFsCacheFileSimpleOpenReadClose(PKFSCACHE pCache, PKFSOBJ pFileObj, KU64 offStart, void *pvBuf, KSIZE cbToRead); PKFSCACHE kFsCacheCreate(KU32 fFlags); void kFsCacheDestroy(PKFSCACHE); void kFsCacheInvalidateMissing(PKFSCACHE pCache); void kFsCacheInvalidateAll(PKFSCACHE pCache); void kFsCacheInvalidateAllAndCloseDirs(PKFSCACHE pCache, KBOOL fIncludingRoot); void kFsCacheInvalidateCustomMissing(PKFSCACHE pCache); void kFsCacheInvalidateCustomBoth(PKFSCACHE pCache); KBOOL kFsCacheSetupCustomRevisionForTree(PKFSCACHE pCache, PKFSOBJ pRoot); KBOOL kFsCacheInvalidateDeletedDirectoryA(PKFSCACHE pCache, const char *pszDir); #endif kbuild-3608/src/lib/nt/ntutimes.h0000664000175000017500000000337414670377415016732 0ustar locutuslocutus/* $Id: ntutimes.h 3060 2017-09-21 15:11:07Z bird $ */ /** @file * MSC + NT utimes and lutimes. */ /* * Copyright (c) 2005-2017 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___nt_ntutimes_h #define ___nt_ntutimes_h #include "nttypes.h" int birdUtimes(const char *pszFile, BirdTimeVal_T paTimes[2]); int birdLUtimes(const char *pszFile, BirdTimeVal_T paTimes[2]); #undef utimes #define utimes(a_pszPath, a_paTimes) birdUtimes(a_pszPath, a_paTimes) #undef lutimes #define lutimes(a_pszPath, a_paTimes) birdLUtimes(a_pszPath, a_paTimes) #endif kbuild-3608/src/lib/nt/fts-nt.h0000664000175000017500000001755514670377415016303 0ustar locutuslocutus/* $Id: fts-nt.h 3535 2021-12-20 23:32:28Z bird $ */ /** @file * Header for the NT port of BSD fts.h. * * @copyright Copyright (c) 1989, 1993 The Regents of the University of California. All rights reserved. * @copyright NT modifications Copyright (C) 2016 knut st. osmundsen * @licenses BSD3 */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)fts.h 8.3 (Berkeley) 8/14/94 * $FreeBSD$ * */ #ifndef INCLUDED_FTS_NT_H #define INCLUDED_FTS_NT_H #include #include #include "ntstat.h" /* ensure correct stat structure */ typedef uint64_t fts_dev_t; typedef uint64_t fts_ino_t; typedef uint32_t fts_nlink_t; #ifdef _WINNT_ typedef HANDLE fts_fd_t; # define NT_FTS_INVALID_HANDLE_VALUE INVALID_HANDLE_VALUE #else typedef void * fts_fd_t; # define NT_FTS_INVALID_HANDLE_VALUE ((void *)~(uintptr_t)0) #endif #define FTSCALL __cdecl typedef struct { struct _ftsent *fts_cur; /* current node */ struct _ftsent *fts_child; /* linked list of children */ struct _ftsent **fts_array; /* sort array */ fts_dev_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ size_t fts_pathlen; /* sizeof(path) */ wchar_t *fts_wcspath; /* NT: UTF-16 path for this descent. */ size_t fts_cwcpath; /* NT: size of fts_wcspath buffer */ size_t fts_nitems; /* elements in the sort array */ int (FTSCALL *fts_compar) /* compare function */ (const struct _ftsent * const *, const struct _ftsent * const *); #define FTS_COMFOLLOW 0x001 /* follow command line symlinks */ #define FTS_LOGICAL 0x002 /* logical walk */ #define FTS_NOCHDIR 0x004 /* don't change directories */ #define FTS_NOSTAT 0x008 /* don't get stat info */ #define FTS_PHYSICAL 0x010 /* physical walk */ #define FTS_SEEDOT 0x020 /* return dot and dot-dot */ #define FTS_XDEV 0x040 /* don't cross devices */ #if 0 /* No whiteout on NT. */ #define FTS_WHITEOUT 0x080 /* return whiteout information */ #endif #define FTS_CWDFD 0x100 /* For gnulib fts compatibility, enables fts_cwd_fd. */ #define FTS_TIGHT_CYCLE_CHECK 0x200 /* Ignored currently */ #define FTS_NO_ANSI 0x40000000 /* NT: No ansi name or access path. */ #define FTS_OPTIONMASK 0x400003ff /* valid user option mask */ #define FTS_NAMEONLY 0x10000 /* (private) child names only */ #define FTS_STOP 0x20000 /* (private) unrecoverable error */ int fts_options; /* fts_open options, global flags */ int fts_cwd_fd; /* FTS_CWDFD: AT_FDCWD or a virtual CWD file descriptor. */ void *fts_clientptr; /* thunk for sort function */ } FTS; typedef struct _ftsent { struct _ftsent *fts_cycle; /* cycle node */ struct _ftsent *fts_parent; /* parent directory */ struct _ftsent *fts_link; /* next file in directory */ int64_t fts_number; /* local numeric value */ #define fts_bignum fts_number /* XXX non-std, should go away */ void *fts_pointer; /* local address value */ char *fts_accpath; /* access path */ wchar_t *fts_wcsaccpath; /* NT: UTF-16 access path */ char *fts_path; /* root path */ wchar_t *fts_wcspath; /* NT: UTF-16 root path */ int fts_errno; /* errno for this node */ size_t fts_alloc_size; /* internal - size of the allocation for this entry. */ fts_fd_t fts_dirfd; /* NT: Handle to the directory (NT_FTS_)INVALID_HANDLE_VALUE if not valid */ size_t fts_pathlen; /* strlen(fts_path) */ size_t fts_cwcpath; /* NT: length of fts_wcspath. */ size_t fts_namelen; /* strlen(fts_name) */ size_t fts_cwcname; /* NT: length of fts_wcsname. */ fts_ino_t fts_ino; /* inode */ fts_dev_t fts_dev; /* device */ fts_nlink_t fts_nlink; /* link count */ #define FTS_ROOTPARENTLEVEL -1 #define FTS_ROOTLEVEL 0 long fts_level; /* depth (-1 to N) */ #define FTS_D 1 /* preorder directory */ #define FTS_DC 2 /* directory that causes cycles */ #define FTS_DEFAULT 3 /* none of the above */ #define FTS_DNR 4 /* unreadable directory */ #define FTS_DOT 5 /* dot or dot-dot */ #define FTS_DP 6 /* postorder directory */ #define FTS_ERR 7 /* error; errno is set */ #define FTS_F 8 /* regular file */ #define FTS_INIT 9 /* initialized only */ #define FTS_NS 10 /* stat(2) failed */ #define FTS_NSOK 11 /* no stat(2) requested */ #define FTS_SL 12 /* symbolic link */ #define FTS_SLNONE 13 /* symbolic link without target */ #define FTS_W 14 /* whiteout object */ int fts_info; /* user status for FTSENT structure */ #define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ #define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ #define FTS_ISW 0x04 /* this is a whiteout object */ unsigned fts_flags; /* private flags for FTSENT structure */ #define FTS_AGAIN 1 /* read node again */ #define FTS_FOLLOW 2 /* follow symbolic link */ #define FTS_NOINSTR 3 /* no instructions */ #define FTS_SKIP 4 /* discard node */ int fts_instr; /* fts_set() instructions */ struct stat *fts_statp; /* stat(2) information */ char *fts_name; /* file name */ wchar_t *fts_wcsname; /* NT: UTF-16 file name. */ FTS *fts_fts; /* back pointer to main FTS */ BirdStat_T fts_stat; /* NT: We always got stat info. */ } FTSENT; #ifdef __cplusplus extern "C" { #endif FTSENT *FTSCALL nt_fts_children(FTS *, int); int FTSCALL nt_fts_close(FTS *); void *FTSCALL nt_fts_get_clientptr(FTS *); #define fts_get_clientptr(fts) ((fts)->fts_clientptr) FTS *FTSCALL nt_fts_get_stream(FTSENT *); #define fts_get_stream(ftsent) ((ftsent)->fts_fts) FTS *FTSCALL nt_fts_open(char * const *, int, int (FTSCALL*)(const FTSENT * const *, const FTSENT * const *)); FTS *FTSCALL nt_fts_openw(wchar_t * const *, int, int (FTSCALL*)(const FTSENT * const *, const FTSENT * const *)); FTSENT *FTSCALL nt_fts_read(FTS *); int FTSCALL nt_fts_set(FTS *, FTSENT *, int); void FTSCALL nt_fts_set_clientptr(FTS *, void *); /* API mappings. */ #define fts_children(a_pFts, a_iInstr) nt_fts_children(a_pFts, a_iInstr) #define fts_close(a_pFts) nt_fts_close(a_pFts) #define fts_open(a_papszArgs, a_fOptions, a_pfnCompare) nt_fts_open(a_papszArgs, a_fOptions, a_pfnCompare) #define fts_read(a_pFts) nt_fts_read(a_pFts) #define fts_set(a_pFts, a_pFtsEntry, a_iInstr) nt_fts_set(a_pFts, a_pFtsEntry, a_iInstr) #define fts_set_clientptr(a_pFts, a_pvUser) nt_fts_set_clientptr(a_pFts, a_pvUser) #ifdef __cplusplus } #endif #endif /* !INCLUDED_FTS_NT_H */ kbuild-3608/src/lib/nt/ntutimes.c0000664000175000017500000000721714670377415016725 0ustar locutuslocutus/* $Id: ntutimes.c 3097 2017-10-14 03:52:44Z bird $ */ /** @file * MSC + NT utimes and lutimes */ /* * Copyright (c) 2005-2017 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "ntutimes.h" #include "ntstuff.h" #include "nthlp.h" static int birdUtimesInternal(const char *pszPath, BirdTimeVal_T paTimes[2], int fFollowLink) { HANDLE hFile = birdOpenFileEx(NULL, pszPath, FILE_WRITE_ATTRIBUTES | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, FILE_OPEN_FOR_BACKUP_INTENT | (fFollowLink ? 0 : FILE_OPEN_REPARSE_POINT), OBJ_CASE_INSENSITIVE); if (hFile != INVALID_HANDLE_VALUE) { MY_FILE_BASIC_INFORMATION Info; MY_IO_STATUS_BLOCK Ios; MY_NTSTATUS rcNt; memset(&Info, 0, sizeof(Info)); if (paTimes) { Info.LastAccessTime.QuadPart = birdNtTimeFromTimeVal(&paTimes[0]); Info.LastWriteTime.QuadPart = birdNtTimeFromTimeVal(&paTimes[1]); } else { /** @todo replace this with something from ntdll */ FILETIME Now; GetSystemTimeAsFileTime(&Now); Info.LastAccessTime.HighPart = Now.dwHighDateTime; Info.LastAccessTime.LowPart = Now.dwLowDateTime; Info.LastWriteTime.HighPart = Now.dwHighDateTime; Info.LastWriteTime.LowPart = Now.dwLowDateTime; } Ios.Information = -1; Ios.u.Status = -1; rcNt = g_pfnNtSetInformationFile(hFile, &Ios, &Info, sizeof(Info), MyFileBasicInformation); birdCloseFile(hFile); if (MY_NT_SUCCESS(rcNt)) return 0; birdSetErrnoFromNt(rcNt); } return -1; } int birdUtimes(const char *pszFile, BirdTimeVal_T paTimes[2]) { return birdUtimesInternal(pszFile, paTimes, 1 /*fFollowLink*/); } int birdLUtimes(const char *pszFile, BirdTimeVal_T paTimes[2]) { return birdUtimesInternal(pszFile, paTimes, 0 /*fFollowLink*/); } kbuild-3608/src/lib/nt/ntunlink.h0000664000175000017500000000423514670377415016721 0ustar locutuslocutus/* $Id: ntunlink.h 3060 2017-09-21 15:11:07Z bird $ */ /** @file * MSC + NT unlink and variations. */ /* * Copyright (c) 2005-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___nt_ntunlink_h #define ___nt_ntunlink_h #include "nttypes.h" #include int birdUnlink(const char *pszFile); int birdUnlinkW(const wchar_t *pwszFile); int birdUnlinkEx(void *hRoot, const char *pszFile); int birdUnlinkExW(void *hRoot, const wchar_t *pwszFile); int birdUnlinkForced(const char *pszFile); int birdUnlinkForcedW(const wchar_t *pwszFile); int birdUnlinkForcedEx(void *hRoot, const char *pszFile); int birdUnlinkForcedExW(void *hRoot, const wchar_t *pszFile); int birdUnlinkForcedFast(const char *pszFile); int birdUnlinkForcedFastW(const wchar_t *pwszFile); int birdUnlinkForcedFastEx(void *hRoot, const char *pszFile); int birdUnlinkForcedFastExW(void *hRoot, const wchar_t *pwszFile); #undef unlink #define unlink(a_pszPath) birdUnlinkForced(a_pszPath) #endif kbuild-3608/src/lib/nt/ntdir.c0000664000175000017500000005330014670377415016167 0ustar locutuslocutus/* $Id: ntdir.c 3007 2016-11-06 16:46:43Z bird $ */ /** @file * MSC + NT opendir, readdir, telldir, seekdir, and closedir. */ /* * Copyright (c) 2005-2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include #include #include "ntstuff.h" #include "nthlp.h" #include "ntdir.h" /** * Implements opendir. */ BirdDir_T *birdDirOpen(const char *pszPath) { HANDLE hDir = birdOpenFile(pszPath, FILE_READ_DATA | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE); if (hDir != INVALID_HANDLE_VALUE) { BirdDir_T *pDir = birdDirOpenFromHandle((void *)hDir, NULL, BIRDDIR_F_CLOSE_HANDLE); if (pDir) return pDir; birdCloseFile(hDir); } return NULL; } /** * Alternative opendir, with extra stat() info returned by readdir(). */ BirdDir_T *birdDirOpenExtraInfo(const char *pszPath) { HANDLE hDir = birdOpenFile(pszPath, FILE_READ_DATA | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE); if (hDir != INVALID_HANDLE_VALUE) { BirdDir_T *pDir = birdDirOpenFromHandle((void *)hDir, NULL, BIRDDIR_F_CLOSE_HANDLE | BIRDDIR_F_EXTRA_INFO); if (pDir) return pDir; birdCloseFile(hDir); } return NULL; } BirdDir_T *birdDirOpenExW(void *hRoot, const wchar_t *pwszPath, const wchar_t *pwszFilter, unsigned fFlags) { HANDLE hDir = birdOpenFileExW((HANDLE)hRoot, pwszPath, FILE_READ_DATA | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE); if (hDir != INVALID_HANDLE_VALUE) { BirdDir_T *pDir = birdDirOpenFromHandle((void *)hDir, pwszFilter, fFlags | BIRDDIR_F_CLOSE_HANDLE); if (pDir) return pDir; birdCloseFile(hDir); } return NULL; } /** * Internal worker for birdStatModTimeOnly. */ BirdDir_T *birdDirOpenFromHandle(void *pvHandle, const void *pvReserved, unsigned fFlags) { if (!pvReserved && !(fFlags & BIRDDIR_F_STATIC_ALLOC)) { /* * Allocate and initialize the directory enum handle. */ BirdDir_T *pDir = (BirdDir_T *)birdMemAlloc(sizeof(*pDir)); if (pDir) { pDir->uMagic = BIRD_DIR_MAGIC; pDir->fFlags = fFlags; pDir->pvHandle = pvHandle; pDir->uDev = 0; pDir->offPos = 0; pDir->fHaveData = 0; pDir->fFirst = 1; pDir->iInfoClass = fFlags & BIRDDIR_F_EXTRA_INFO ? MyFileIdFullDirectoryInformation : MyFileNamesInformation; pDir->offBuf = 0; pDir->cbBuf = 0; pDir->pabBuf = NULL; return pDir; } } else { assert(!(fFlags & BIRDDIR_F_STATIC_ALLOC)); assert(pvReserved == NULL); } birdSetErrnoToInvalidArg(); return NULL; } /** * Special API that takes a preallocated BirdDir_T and can be called again * without involving birdDirClose. * * */ BirdDir_T *birdDirOpenFromHandleWithReuse(BirdDir_T *pDir, void *pvHandle, const void *pvReserved, unsigned fFlags) { if (!pvReserved) { /* * Allocate and initialize the directory enum handle. */ if (pDir) { if (pDir->uMagic == BIRD_DIR_MAGIC) { if ( (pDir->fFlags & BIRDDIR_F_CLOSE_HANDLE) && pDir->pvHandle != INVALID_HANDLE_VALUE) birdCloseFile((HANDLE)pDir->pvHandle); } else { pDir->cbBuf = 0; pDir->pabBuf = NULL; pDir->uMagic = BIRD_DIR_MAGIC; } pDir->pvHandle = pvHandle; pDir->fFlags = fFlags; pDir->uDev = 0; pDir->offPos = 0; pDir->fHaveData = 0; pDir->fFirst = 1; pDir->iInfoClass = fFlags & BIRDDIR_F_EXTRA_INFO ? MyFileIdFullDirectoryInformation : MyFileNamesInformation; pDir->offBuf = 0; return pDir; } } else assert(pvReserved == NULL); birdSetErrnoToInvalidArg(); return NULL; } static int birdDirReadMore(BirdDir_T *pDir) { MY_NTSTATUS rcNt; MY_IO_STATUS_BLOCK Ios; int fFirst; /* * Retrieve the volume serial number + creation time and create the * device number the first time around. Also allocate a buffer. */ fFirst = pDir->fFirst; if (fFirst) { union { MY_FILE_FS_VOLUME_INFORMATION VolInfo; unsigned char abBuf[1024]; } uBuf; Ios.Information = 0; Ios.u.Status = -1; rcNt = g_pfnNtQueryVolumeInformationFile((HANDLE)pDir->pvHandle, &Ios, &uBuf, sizeof(uBuf), MyFileFsVolumeInformation); if (MY_NT_SUCCESS(rcNt)) rcNt = Ios.u.Status; if (MY_NT_SUCCESS(rcNt)) pDir->uDev = uBuf.VolInfo.VolumeSerialNumber | (uBuf.VolInfo.VolumeCreationTime.QuadPart << 32); else pDir->uDev = 0; if (!pDir->pabBuf) { /* * Allocate a buffer. * * Better not exceed 64KB or CIFS may throw a fit. Also, on win10/64 * here there is a noticable speedup when going one byte below 64KB. */ pDir->cbBuf = 0xffe0; pDir->pabBuf = birdMemAlloc(pDir->cbBuf); if (!pDir->pabBuf) return birdSetErrnoToNoMem(); } pDir->fFirst = 0; } /* * Read another buffer full. */ Ios.Information = 0; Ios.u.Status = -1; rcNt = g_pfnNtQueryDirectoryFile((HANDLE)pDir->pvHandle, NULL, /* hEvent */ NULL, /* pfnApcComplete */ NULL, /* pvApcCompleteCtx */ &Ios, pDir->pabBuf, pDir->cbBuf, (MY_FILE_INFORMATION_CLASS)pDir->iInfoClass, FALSE, /* fReturnSingleEntry */ NULL, /* Filter / restart pos. */ pDir->fFlags & BIRDDIR_F_RESTART_SCAN ? TRUE : FALSE); /* fRestartScan */ if (!MY_NT_SUCCESS(rcNt)) { int rc; if (rcNt == MY_STATUS_NO_MORE_FILES) rc = 0; else rc = birdSetErrnoFromNt(rcNt); pDir->fHaveData = 0; pDir->offBuf = pDir->cbBuf; return rc; } pDir->offBuf = 0; pDir->fHaveData = 1; pDir->fFlags &= ~BIRDDIR_F_RESTART_SCAN; return 0; } static int birdDirCopyNameToEntry(WCHAR const *pwcName, ULONG cbName, BirdDirEntry_T *pEntry) { int cchOut = WideCharToMultiByte(CP_ACP, 0, pwcName, cbName / sizeof(WCHAR), pEntry->d_name, sizeof(pEntry->d_name) - 1, NULL, NULL); if (cchOut > 0) { pEntry->d_name[cchOut] = '\0'; pEntry->d_namlen = (unsigned __int16)cchOut; pEntry->d_reclen = (unsigned __int16)((size_t)&pEntry->d_name[cchOut + 1] - (size_t)pEntry); return 0; } return -1; } /** * Deals with mount points. * * @param pDir The directory handle. * @param pInfo The NT entry information. * @param pEntryStat The stats for the mount point directory that needs * updating (a d_stat member). */ static void birdDirUpdateMountPointInfo(BirdDir_T *pDir, MY_FILE_ID_FULL_DIR_INFORMATION *pInfo, BirdStat_T *pEntryStat) { /* * Try open the root directory of the mount. * (Can't use birdStatAtW here because the name isn't terminated.) */ HANDLE hRoot = INVALID_HANDLE_VALUE; MY_NTSTATUS rcNt; MY_UNICODE_STRING Name; Name.Buffer = pInfo->FileName; Name.Length = Name.MaximumLength = (USHORT)pInfo->FileNameLength; rcNt = birdOpenFileUniStr((HANDLE)pDir->pvHandle, &Name, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_OPEN_FOR_BACKUP_INTENT, OBJ_CASE_INSENSITIVE, &hRoot); if (MY_NT_SUCCESS(rcNt)) { int iSavedErrno = errno; BirdStat_T RootStat; if (birdStatHandle(hRoot, &RootStat, NULL) == 0) { RootStat.st_ismountpoint = 2; *pEntryStat = RootStat; } birdCloseFile(hRoot); errno = iSavedErrno; } /* else: don't mind failures, we've got some info. */ } /** * Implements readdir_r(). * * @remarks birdDirReadReentrantW is a copy of this. Keep them in sync! */ int birdDirReadReentrant(BirdDir_T *pDir, BirdDirEntry_T *pEntry, BirdDirEntry_T **ppResult) { int fSkipEntry; *ppResult = NULL; if (!pDir || pDir->uMagic != BIRD_DIR_MAGIC) return birdSetErrnoToBadFileNo(); do { ULONG offNext; ULONG cbMinCur; /* * Read more? */ if (!pDir->fHaveData) { if (birdDirReadMore(pDir) != 0) return -1; if (!pDir->fHaveData) return 0; } /* * Convert the NT data to the unixy output structure. */ fSkipEntry = 0; switch (pDir->iInfoClass) { case MyFileNamesInformation: { MY_FILE_NAMES_INFORMATION *pInfo = (MY_FILE_NAMES_INFORMATION *)&pDir->pabBuf[pDir->offBuf]; if ( pDir->offBuf >= pDir->cbBuf - MIN_SIZEOF_MY_FILE_NAMES_INFORMATION || pInfo->FileNameLength >= pDir->cbBuf || pDir->offBuf + pInfo->FileNameLength + MIN_SIZEOF_MY_FILE_NAMES_INFORMATION > pDir->cbBuf) { fSkipEntry = 1; pDir->fHaveData = 0; continue; } memset(&pEntry->d_stat, 0, sizeof(pEntry->d_stat)); pEntry->d_stat.st_mode = S_IFMT; pEntry->d_type = DT_UNKNOWN; pEntry->d_reclen = 0; pEntry->d_namlen = 0; if (birdDirCopyNameToEntry(pInfo->FileName, pInfo->FileNameLength, pEntry) != 0) fSkipEntry = 1; cbMinCur = MIN_SIZEOF_MY_FILE_NAMES_INFORMATION + pInfo->FileNameLength; offNext = pInfo->NextEntryOffset; break; } case MyFileIdFullDirectoryInformation: { MY_FILE_ID_FULL_DIR_INFORMATION *pInfo = (MY_FILE_ID_FULL_DIR_INFORMATION *)&pDir->pabBuf[pDir->offBuf]; if ( pDir->offBuf >= pDir->cbBuf - MIN_SIZEOF_MY_FILE_ID_FULL_DIR_INFORMATION || pInfo->FileNameLength >= pDir->cbBuf || pDir->offBuf + pInfo->FileNameLength + MIN_SIZEOF_MY_FILE_ID_FULL_DIR_INFORMATION > pDir->cbBuf) { fSkipEntry = 1; pDir->fHaveData = 0; continue; } pEntry->d_type = DT_UNKNOWN; pEntry->d_reclen = 0; pEntry->d_namlen = 0; if (birdDirCopyNameToEntry(pInfo->FileName, pInfo->FileNameLength, pEntry) != 0) fSkipEntry = 1; birdStatFillFromFileIdFullDirInfo(&pEntry->d_stat, pInfo); pEntry->d_stat.st_dev = pDir->uDev; switch (pEntry->d_stat.st_mode & S_IFMT) { case S_IFREG: pEntry->d_type = DT_REG; break; case S_IFDIR: pEntry->d_type = DT_DIR; break; case S_IFLNK: pEntry->d_type = DT_LNK; break; case S_IFIFO: pEntry->d_type = DT_FIFO; break; case S_IFCHR: pEntry->d_type = DT_CHR; break; default: #ifndef NDEBUG __debugbreak(); #endif pEntry->d_type = DT_UNKNOWN; break; } if (pEntry->d_stat.st_ismountpoint != 1) { /* likely. */ } else birdDirUpdateMountPointInfo(pDir, pInfo, &pEntry->d_stat); cbMinCur = MIN_SIZEOF_MY_FILE_ID_FULL_DIR_INFORMATION + pInfo->FileNameLength; offNext = pInfo->NextEntryOffset; break; } default: return birdSetErrnoToBadFileNo(); } /* * Advance. */ if ( offNext >= cbMinCur && offNext < pDir->cbBuf) pDir->offBuf += offNext; else { pDir->fHaveData = 0; pDir->offBuf = pDir->cbBuf; } pDir->offPos++; } while (fSkipEntry); /* * Successful return. */ *ppResult = pEntry; return 0; } /** * Implements readdir(). */ BirdDirEntry_T *birdDirRead(BirdDir_T *pDir) { BirdDirEntry_T *pRet = NULL; birdDirReadReentrant(pDir, &pDir->u.DirEntry, &pRet); return pRet; } static int birdDirCopyNameToEntryW(WCHAR const *pwcName, ULONG cbName, BirdDirEntryW_T *pEntry) { ULONG cwcName = cbName / sizeof(wchar_t); if (cwcName < sizeof(pEntry->d_name)) { memcpy(pEntry->d_name, pwcName, cbName); pEntry->d_name[cwcName] = '\0'; pEntry->d_namlen = (unsigned __int16)cwcName; pEntry->d_reclen = (unsigned __int16)((size_t)&pEntry->d_name[cwcName + 1] - (size_t)pEntry); return 0; } return -1; } /** * Implements readdir_r(), UTF-16 version. * * @remarks This is a copy of birdDirReadReentrant where only the name handling * and entry type differs. Remember to keep them in sync! */ int birdDirReadReentrantW(BirdDir_T *pDir, BirdDirEntryW_T *pEntry, BirdDirEntryW_T **ppResult) { int fSkipEntry; *ppResult = NULL; if (!pDir || pDir->uMagic != BIRD_DIR_MAGIC) return birdSetErrnoToBadFileNo(); do { ULONG offNext; ULONG cbMinCur; /* * Read more? */ if (!pDir->fHaveData) { if (birdDirReadMore(pDir) != 0) return -1; if (!pDir->fHaveData) return 0; } /* * Convert the NT data to the unixy output structure. */ fSkipEntry = 0; switch (pDir->iInfoClass) { case MyFileNamesInformation: { MY_FILE_NAMES_INFORMATION *pInfo = (MY_FILE_NAMES_INFORMATION *)&pDir->pabBuf[pDir->offBuf]; if ( pDir->offBuf >= pDir->cbBuf - MIN_SIZEOF_MY_FILE_NAMES_INFORMATION || pInfo->FileNameLength >= pDir->cbBuf || pDir->offBuf + pInfo->FileNameLength + MIN_SIZEOF_MY_FILE_NAMES_INFORMATION > pDir->cbBuf) { fSkipEntry = 1; pDir->fHaveData = 0; continue; } memset(&pEntry->d_stat, 0, sizeof(pEntry->d_stat)); pEntry->d_stat.st_mode = S_IFMT; pEntry->d_type = DT_UNKNOWN; pEntry->d_reclen = 0; pEntry->d_namlen = 0; if (birdDirCopyNameToEntryW(pInfo->FileName, pInfo->FileNameLength, pEntry) != 0) fSkipEntry = 1; cbMinCur = MIN_SIZEOF_MY_FILE_NAMES_INFORMATION + pInfo->FileNameLength; offNext = pInfo->NextEntryOffset; break; } case MyFileIdFullDirectoryInformation: { MY_FILE_ID_FULL_DIR_INFORMATION *pInfo = (MY_FILE_ID_FULL_DIR_INFORMATION *)&pDir->pabBuf[pDir->offBuf]; if ( pDir->offBuf >= pDir->cbBuf - MIN_SIZEOF_MY_FILE_ID_FULL_DIR_INFORMATION || pInfo->FileNameLength >= pDir->cbBuf || pDir->offBuf + pInfo->FileNameLength + MIN_SIZEOF_MY_FILE_ID_FULL_DIR_INFORMATION > pDir->cbBuf) { fSkipEntry = 1; pDir->fHaveData = 0; continue; } pEntry->d_type = DT_UNKNOWN; pEntry->d_reclen = 0; pEntry->d_namlen = 0; if (birdDirCopyNameToEntryW(pInfo->FileName, pInfo->FileNameLength, pEntry) != 0) fSkipEntry = 1; birdStatFillFromFileIdFullDirInfo(&pEntry->d_stat, pInfo); pEntry->d_stat.st_dev = pDir->uDev; switch (pEntry->d_stat.st_mode & S_IFMT) { case S_IFREG: pEntry->d_type = DT_REG; break; case S_IFDIR: pEntry->d_type = DT_DIR; break; case S_IFLNK: pEntry->d_type = DT_LNK; break; case S_IFIFO: pEntry->d_type = DT_FIFO; break; case S_IFCHR: pEntry->d_type = DT_CHR; break; default: #ifndef NDEBUG __debugbreak(); #endif pEntry->d_type = DT_UNKNOWN; break; } if (pEntry->d_stat.st_ismountpoint != 1) { /* likely. */ } else birdDirUpdateMountPointInfo(pDir, pInfo, &pEntry->d_stat); cbMinCur = MIN_SIZEOF_MY_FILE_ID_FULL_DIR_INFORMATION + pInfo->FileNameLength; offNext = pInfo->NextEntryOffset; break; } default: return birdSetErrnoToBadFileNo(); } /* * Advance. */ if ( offNext >= cbMinCur && offNext < pDir->cbBuf) pDir->offBuf += offNext; else { pDir->fHaveData = 0; pDir->offBuf = pDir->cbBuf; } pDir->offPos++; } while (fSkipEntry); /* * Successful return. */ *ppResult = pEntry; return 0; } /** * Implements readdir(). */ BirdDirEntryW_T *birdDirReadW(BirdDir_T *pDir) { BirdDirEntryW_T *pRet = NULL; birdDirReadReentrantW(pDir, &pDir->u.DirEntryW, &pRet); return pRet; } /** * Implements telldir(). */ long birdDirTell(BirdDir_T *pDir) { if (!pDir || pDir->uMagic != BIRD_DIR_MAGIC) return birdSetErrnoToBadFileNo(); return pDir->offPos; } void birdDirSeek(BirdDir_T *pDir, long offDir); /** * Implements closedir(). */ int birdDirClose(BirdDir_T *pDir) { if (!pDir || pDir->uMagic != BIRD_DIR_MAGIC) return birdSetErrnoToBadFileNo(); pDir->uMagic++; if (pDir->fFlags & BIRDDIR_F_CLOSE_HANDLE) birdCloseFile((HANDLE)pDir->pvHandle); pDir->pvHandle = (void *)INVALID_HANDLE_VALUE; birdMemFree(pDir->pabBuf); pDir->pabBuf = NULL; if (!(pDir->fFlags & BIRDDIR_F_STATIC_ALLOC)) birdMemFree(pDir); return 0; } kbuild-3608/src/lib/nt/nt_child_inject_standard_handles.c0000664000175000017500000004547114670377415023557 0ustar locutuslocutus/* $Id: nt_child_inject_standard_handles.c 3584 2023-01-20 15:29:36Z bird $ */ /** @file * Injecting standard handles into a child process. */ /* * Copyright (c) 2004-2018 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include #include #include #include #include #include "nt_child_inject_standard_handles.h" /** * Wrapper around ReadProcessMemory in case WOW64 tricks are needed. * * @returns Success indicator. * @param hProcess The target process. * @param ullSrc The source address (in @a hProcess). * @param pvDst The target address (this process). * @param cbToRead How much to read. * @param pcbRead Where to return how much was actually read. */ static BOOL MyReadProcessMemory(HANDLE hProcess, ULONGLONG ullSrc, void *pvDst, SIZE_T cbToRead, SIZE_T *pcbRead) { #if K_ARCH_BITS != 64 if (ullSrc + cbToRead - 1 > ~(uintptr_t)0) { typedef NTSTATUS(NTAPI *PFN_NtWow64ReadVirtualMemory64)(HANDLE, ULONGLONG, PVOID, ULONGLONG, PULONGLONG); static PFN_NtWow64ReadVirtualMemory64 volatile s_pfnNtWow64ReadVirtualMemory64= NULL; static BOOL volatile s_fInitialized = FALSE; PFN_NtWow64ReadVirtualMemory64 pfnNtWow64ReadVirtualMemory64 = s_pfnNtWow64ReadVirtualMemory64; if (!pfnNtWow64ReadVirtualMemory64 && !s_fInitialized) { *(FARPROC *)&pfnNtWow64ReadVirtualMemory64 = GetProcAddress(GetModuleHandleA("NTDLL.DLL"), "NtWow64ReadVirtualMemory64"); s_pfnNtWow64ReadVirtualMemory64 = pfnNtWow64ReadVirtualMemory64; } if (pfnNtWow64ReadVirtualMemory64) { struct { ULONGLONG volatile ullBefore; ULONGLONG cbRead64; ULONGLONG volatile ullAfter; } Wtf = { ~(ULONGLONG)0, 0, ~(ULONGLONG)0 }; NTSTATUS rcNt = pfnNtWow64ReadVirtualMemory64(hProcess, ullSrc, pvDst, cbToRead, &Wtf.cbRead64); *pcbRead = (SIZE_T)Wtf.cbRead64; SetLastError(rcNt); /* lazy bird */ return NT_SUCCESS(rcNt); } } #endif return ReadProcessMemory(hProcess, (void *)(uintptr_t)ullSrc, pvDst, cbToRead, pcbRead); } /** * Wrapper around WriteProcessMemory in case WOW64 tricks are needed. * * @returns Success indicator. * @param hProcess The target process. * @param ullDst The target address (in @a hProcess). * @param pvSrc The source address (this process). * @param cbToWrite How much to write. * @param pcbWritten Where to return how much was actually written. */ static BOOL MyWriteProcessMemory(HANDLE hProcess, ULONGLONG ullDst, void const *pvSrc, SIZE_T cbToWrite, SIZE_T *pcbWritten) { #if K_ARCH_BITS != 64 if (ullDst + cbToWrite - 1 > ~(uintptr_t)0) { typedef NTSTATUS (NTAPI *PFN_NtWow64WriteVirtualMemory64)(HANDLE, ULONGLONG, VOID const *, ULONGLONG, PULONGLONG); static PFN_NtWow64WriteVirtualMemory64 volatile s_pfnNtWow64WriteVirtualMemory64= NULL; static BOOL volatile s_fInitialized = FALSE; PFN_NtWow64WriteVirtualMemory64 pfnNtWow64WriteVirtualMemory64 = s_pfnNtWow64WriteVirtualMemory64; if (!pfnNtWow64WriteVirtualMemory64 && !s_fInitialized) { *(FARPROC *)&pfnNtWow64WriteVirtualMemory64 = GetProcAddress(GetModuleHandleA("NTDLL.DLL"), "NtWow64WriteVirtualMemory64"); s_pfnNtWow64WriteVirtualMemory64 = pfnNtWow64WriteVirtualMemory64; } if (pfnNtWow64WriteVirtualMemory64) { struct { ULONGLONG volatile ullBefore; ULONGLONG cbWritten64; ULONGLONG volatile ullAfter; } Wtf = { ~(ULONGLONG)0, 0, ~(ULONGLONG)0 }; NTSTATUS rcNt = pfnNtWow64WriteVirtualMemory64(hProcess, ullDst, pvSrc, cbToWrite, &Wtf.cbWritten64); *pcbWritten = (SIZE_T)Wtf.cbWritten64; SetLastError(rcNt); /* lazy bird */ return NT_SUCCESS(rcNt); } } #endif return WriteProcessMemory(hProcess, (void *)(uintptr_t)ullDst, pvSrc, cbToWrite, pcbWritten); } /** * Injects standard handles into a child process (created suspended). * * @returns 0 on success. On failure a non-zero windows error or NT status, * with details in @a pszErr. * @param hProcess The child process (created suspended). * @param pafReplace Selects which handles to actually replace (TRUE) and * which to leave as-is (FALSE). The first entry is * starndard input, second is standard output, and the * final is standard error. * @param pahHandles The handle in the current process to inject into the * child process. This runs parallel to pafReplace. The * values NULL and INVALID_HANDLE_VALUE will be written * directly to the child without duplication. * @param pszErr Pointer to error message buffer. * @param cbErr Size of error message buffer. */ int nt_child_inject_standard_handles(HANDLE hProcess, BOOL pafReplace[3], HANDLE pahHandles[3], char *pszErr, size_t cbErr) { typedef NTSTATUS (NTAPI *PFN_NtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG); static PFN_NtQueryInformationProcess volatile s_pfnNtQueryInformationProcess = NULL; PFN_NtQueryInformationProcess pfnNtQueryInformationProcess; #if K_ARCH_BITS != 64 static PFN_NtQueryInformationProcess volatile s_pfnNtWow64QueryInformationProcess64 = NULL; PFN_NtQueryInformationProcess pfnNtWow64QueryInformationProcess64; static BOOL s_fHostIs64Bit = K_ARCH_BITS == 64; static BOOL volatile s_fCheckedHost = FALSE; #endif static const unsigned s_offProcessParametersInPeb32 = 0x10; static const unsigned s_offProcessParametersInPeb64 = 0x20; static const unsigned s_offStandardInputInProcParams32 = 0x18; static const unsigned s_offStandardInputInProcParams64 = 0x20; static const char * const s_apszNames[3] = { "standard input", "standard output", "standard error" }; ULONG cbActual1 = 0; union { PROCESS_BASIC_INFORMATION Natural; struct { NTSTATUS ExitStatus; ULONGLONG PebBaseAddress; ULONGLONG AffinityMask; ULONG BasePriority; ULONGLONG UniqueProcessId; ULONGLONG InheritedFromUniqueProcessId; } Wow64; } BasicInfo = { { 0, 0, } }; ULONGLONG ullBasicInfoPeb; NTSTATUS rcNt; ULONGLONG ullPeb32 = 0; ULONGLONG ullPeb64 = 0; ULONGLONG ullProcParams32 = 0; ULONGLONG ullProcParams64 = 0; DWORD au32Handles[3] = { 0, 0, 0 }; ULONGLONG au64Handles[3] = { 0, 0, 0 }; unsigned iFirstToInject; unsigned cHandlesToInject; unsigned i; /* * Analyze the input to figure out exactly what we need to do. */ iFirstToInject = 0; while (iFirstToInject < 3 && !pafReplace[iFirstToInject]) iFirstToInject++; if (iFirstToInject >= 3) return 0; cHandlesToInject = 3 - iFirstToInject; while ( cHandlesToInject > 1 && !pafReplace[iFirstToInject + cHandlesToInject - 1]) cHandlesToInject--; #if K_ARCH_BITS != 64 /* * Determine host bit count first time through. */ if (!s_fCheckedHost) { BOOL fAmIWow64 = FALSE; if ( IsWow64Process(GetCurrentProcess(), &fAmIWow64) && fAmIWow64) s_fHostIs64Bit = TRUE; else s_fHostIs64Bit = FALSE; s_fCheckedHost = TRUE; } #endif /* * Resolve NT API first time through. */ pfnNtQueryInformationProcess = s_pfnNtQueryInformationProcess; #if K_ARCH_BITS != 64 pfnNtWow64QueryInformationProcess64 = s_pfnNtWow64QueryInformationProcess64; #endif if (!pfnNtQueryInformationProcess) { HMODULE hmodNtDll = GetModuleHandleA("NTDLL.DLL"); #if K_ARCH_BITS != 64 *(FARPROC *)&pfnNtWow64QueryInformationProcess64 = GetProcAddress(hmodNtDll, "NtWow64QueryInformationProcess64"); s_pfnNtWow64QueryInformationProcess64 = pfnNtWow64QueryInformationProcess64; #endif *(FARPROC *)&pfnNtQueryInformationProcess = GetProcAddress(hmodNtDll, "NtQueryInformationProcess"); if (!pfnNtQueryInformationProcess) { _snprintf(pszErr, cbErr, "The NtQueryInformationProcess API was not found in NTDLL"); return ERROR_PROC_NOT_FOUND; } s_pfnNtQueryInformationProcess = pfnNtQueryInformationProcess; } /* * Get the PEB address. * * If we're a WOW64 process, we must use NtWow64QueryInformationProcess64 * here or the PEB address will be set to zero for 64-bit children. */ #if K_ARCH_BITS != 64 if (s_fHostIs64Bit && pfnNtWow64QueryInformationProcess64) { rcNt = pfnNtWow64QueryInformationProcess64(hProcess, ProcessBasicInformation, &BasicInfo.Wow64, sizeof(BasicInfo.Wow64), &cbActual1); if (!NT_SUCCESS(rcNt)) { _snprintf(pszErr, cbErr, "NtWow64QueryInformationProcess64 failed: %#x", rcNt); return rcNt; } if ((ULONGLONG)BasicInfo.Wow64.PebBaseAddress < 0x1000) { _snprintf(pszErr, cbErr, "NtWow64QueryInformationProcess64 returned bad PebBaseAddress: %#llx", BasicInfo.Wow64.PebBaseAddress); return ERROR_INVALID_ADDRESS; } ullBasicInfoPeb = BasicInfo.Wow64.PebBaseAddress; } else #endif { rcNt = pfnNtQueryInformationProcess(hProcess, ProcessBasicInformation, &BasicInfo.Natural, sizeof(BasicInfo.Natural), &cbActual1); if (!NT_SUCCESS(rcNt)) { _snprintf(pszErr, cbErr, "NtQueryInformationProcess failed: %#x", rcNt); return rcNt; } if ((uintptr_t)BasicInfo.Natural.PebBaseAddress < 0x1000) { _snprintf(pszErr, cbErr, "NtQueryInformationProcess returned bad PebBaseAddress: %#llx", (ULONGLONG)BasicInfo.Natural.PebBaseAddress); return ERROR_INVALID_ADDRESS; } ullBasicInfoPeb = (uintptr_t)BasicInfo.Natural.PebBaseAddress; } /* * Get the 32-bit PEB if it's a WOW64 process. * This query should return 0 for non-WOW64 processes, but we quietly * ignore failures and assume non-WOW64 child. */ #if K_ARCH_BITS != 64 if (!s_fHostIs64Bit) ullPeb32 = ullBasicInfoPeb; else #endif { ULONG_PTR uPeb32Ptr = 0; cbActual1 = 0; rcNt = pfnNtQueryInformationProcess(hProcess, ProcessWow64Information, &uPeb32Ptr, sizeof(uPeb32Ptr), &cbActual1); if (NT_SUCCESS(rcNt) && uPeb32Ptr != 0) { ullPeb32 = uPeb32Ptr; ullPeb64 = ullBasicInfoPeb; #if K_ARCH_BITS != 64 assert(ullPeb64 != ullPeb32); if (ullPeb64 == ullPeb32) ullPeb64 = 0; #endif } else { assert(NT_SUCCESS(rcNt)); ullPeb64 = ullBasicInfoPeb; } } /* * Read the process parameter pointers. */ if (ullPeb32) { DWORD uProcParamPtr = 0; SIZE_T cbRead = 0; if ( MyReadProcessMemory(hProcess, ullPeb32 + s_offProcessParametersInPeb32, &uProcParamPtr, sizeof(uProcParamPtr), &cbRead) && cbRead == sizeof(uProcParamPtr)) ullProcParams32 = uProcParamPtr; else { DWORD dwErr = GetLastError(); _snprintf(pszErr, cbErr, "Failed to read PEB32!ProcessParameter at %#llx: %u/%#x (%u read)", ullPeb32 + s_offProcessParametersInPeb32, dwErr, dwErr, cbRead); return dwErr ? dwErr : -1; } if (uProcParamPtr < 0x1000) { _snprintf(pszErr, cbErr, "Bad PEB32!ProcessParameter value: %#llx", ullProcParams32); return ERROR_INVALID_ADDRESS; } } if (ullPeb64) { ULONGLONG uProcParamPtr = 0; SIZE_T cbRead = 0; if ( MyReadProcessMemory(hProcess, ullPeb64 + s_offProcessParametersInPeb64, &uProcParamPtr, sizeof(uProcParamPtr), &cbRead) && cbRead == sizeof(uProcParamPtr)) ullProcParams64 = uProcParamPtr; else { DWORD dwErr = GetLastError(); _snprintf(pszErr, cbErr, "Failed to read PEB64!ProcessParameter at %p: %u/%#x (%u read)", ullPeb64 + s_offProcessParametersInPeb64, dwErr, dwErr, cbRead); return dwErr ? dwErr : -1; } if (uProcParamPtr < 0x1000) { _snprintf(pszErr, cbErr, "Bad PEB64!ProcessParameter value: %#llx", uProcParamPtr); return ERROR_INVALID_ADDRESS; } } /* * If we're replacing standard input and standard error but not standard * output, we must read the standard output handle. We ASSUME that in * WOW64 processes the two PEBs have the same value, saving a read. */ if (iFirstToInject == 0 && cHandlesToInject == 3 && !pafReplace[1]) { if (ullProcParams64) { SIZE_T cbRead = 0; if ( MyReadProcessMemory(hProcess, ullProcParams64 + s_offStandardInputInProcParams64 + sizeof(au64Handles[0]), &au64Handles[1], sizeof(au64Handles[1]), &cbRead) && cbRead == sizeof(au64Handles[1])) au32Handles[1] = (DWORD)au64Handles[1]; else { DWORD dwErr = GetLastError(); _snprintf(pszErr, cbErr, "Failed to read ProcessParameter64!StandardOutput at %#llx: %u/%#x (%u read)", ullProcParams64 + s_offStandardInputInProcParams64 + sizeof(au64Handles[0]), dwErr, dwErr, cbRead); return dwErr ? dwErr : -1; } } else if (ullProcParams32) { SIZE_T cbRead = 0; if ( !MyReadProcessMemory(hProcess, ullProcParams32 + s_offStandardInputInProcParams32 + sizeof(au32Handles[0]), &au32Handles[1], sizeof(au32Handles[1]), &cbRead) || cbRead != sizeof(au32Handles[1])) { DWORD dwErr = GetLastError(); _snprintf(pszErr, cbErr, "Failed to read ProcessParameter32!StandardOutput at %#llx: %u/%#x (%u read)", ullProcParams32 + s_offStandardInputInProcParams32 + sizeof(au32Handles[0]), dwErr, dwErr, cbRead); return dwErr ? dwErr : -1; } } } /* * Duplicate the handles into process, preparing the two handle arrays * that we'll write to the guest afterwards. */ for (i = iFirstToInject; i < 3; i++) if (pafReplace[i]) { HANDLE hInChild = pahHandles[i]; if ( hInChild == NULL || hInChild == INVALID_HANDLE_VALUE || DuplicateHandle(GetCurrentProcess(), pahHandles[i], hProcess, &hInChild, 0 /*fDesiredAccess*/, TRUE /*fInheritable*/, DUPLICATE_SAME_ACCESS)) { au32Handles[i] = (DWORD)(uintptr_t)hInChild; au64Handles[i] = (uintptr_t)hInChild; } else { DWORD dwErr = GetLastError(); _snprintf(pszErr, cbErr, "Failed to duplicate handle %p into the child as %s: %u", pahHandles[i], s_apszNames[i], dwErr); return dwErr ? dwErr : -1; } } /* * Write the handle arrays to the child. * * If we're a WOW64 we need to use NtWow64WriteVirtualMemory64 instead of * WriteProcessMemory because the latter fails with ERROR_NOACCESS (998). * So, we use a wrapper for doing the writing. */ if (ullProcParams32) { ULONGLONG ullDst = ullProcParams32 + s_offStandardInputInProcParams32 + iFirstToInject * sizeof(au32Handles[0]); SIZE_T cbToWrite = cHandlesToInject * sizeof(au32Handles[0]); SIZE_T cbWritten = 0; if ( !MyWriteProcessMemory(hProcess, ullDst, &au32Handles[iFirstToInject], cbToWrite, &cbWritten) || cbWritten != cbToWrite) { DWORD dwErr = GetLastError(); _snprintf(pszErr, cbErr, "Failed to write handles to ProcessParameter32 (%#llx LB %u): %u/%#x (%u written)", ullDst, cbToWrite, dwErr, dwErr, cbWritten); return dwErr ? dwErr : ERROR_MORE_DATA; } } if (ullProcParams64) { ULONGLONG ullDst = ullProcParams64 + s_offStandardInputInProcParams64 + iFirstToInject * sizeof(au64Handles[0]); SIZE_T cbToWrite = cHandlesToInject * sizeof(au64Handles[0]); SIZE_T cbWritten = 0; if ( !MyWriteProcessMemory(hProcess, ullDst, &au64Handles[iFirstToInject], cbToWrite, &cbWritten) || cbWritten != cbToWrite) { DWORD dwErr = GetLastError(); _snprintf(pszErr, cbErr, "Failed to write handles to ProcessParameter64 (%#llx LB %u): %u/%#x (%u written)", ullDst, cbToWrite, dwErr, dwErr, cbWritten); return dwErr ? dwErr : ERROR_MORE_DATA; } } /* Done successfully! */ return 0; } kbuild-3608/src/lib/nt/nttypes.h0000664000175000017500000000360014670377415016560 0ustar locutuslocutus/* $Id: nttypes.h 3060 2017-09-21 15:11:07Z bird $ */ /** @file * MSC + NT basic & common types, various definitions. */ /* * Copyright (c) 2005-2017 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___nt_nttypes_h #define ___nt_nttypes_h #include typedef struct BirdTimeVal { __int64 tv_sec; __int32 tv_usec; __int32 tv_padding0; } BirdTimeVal_T; typedef struct BirdTimeSpec { __int64 tv_sec; __int32 tv_nsec; __int32 tv_padding0; } BirdTimeSpec_T; /** The distance between the NT and unix epochs given in NT time (units of 100 * ns). */ #define BIRD_NT_EPOCH_OFFSET_UNIX_100NS 116444736000000000LL #endif kbuild-3608/src/lib/nt/ntopenat.c0000664000175000017500000001251714670377415016704 0ustar locutuslocutus/* $Id: ntdir.c 3007 2016-11-06 16:46:43Z bird $ */ /** @file * MSC + NT openat API. */ /* * Copyright (c) 2005-2021 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include #include #include "ntstuff.h" #include "nthlp.h" #include "ntopenat.h" #include "ntstat.h" #define IS_ALPHA(ch) ( ((ch) >= 'A' && (ch) <= 'Z') || ((ch) >= 'a' && (ch) <= 'z') ) #define IS_SLASH(ch) ((ch) == '\\' || (ch) == '/') static int birdOpenInt(const char *pszPath, int fFlags, unsigned __int16 fMode) { /* * Try open it using the CRT's open function, but deal with opening * directories as the CRT doesn't allow doing that. */ int const iErrnoSaved = errno; int iErrno; int fd = open(pszPath, fFlags, fMode); if ( fd < 0 && ((iErrno = errno) == EACCES || iErrno == ENOENT || iErrno == EISDIR || iErrno == EINVAL /*CIFS*/) && (fFlags & (_O_WRONLY | _O_RDWR | _O_RDONLY)) == _O_RDONLY && (fFlags & (_O_CREAT | _O_TRUNC | _O_EXCL)) == 0 ) { BirdStat_T Stat; if (!birdStatFollowLink(pszPath, &Stat)) { if (S_ISDIR(Stat.st_mode)) { HANDLE hDir; errno = iErrnoSaved; hDir = birdOpenFile(pszPath, FILE_READ_DATA | FILE_READ_ATTRIBUTES | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE); if (hDir != INVALID_HANDLE_VALUE) { fd = _open_osfhandle((intptr_t)hDir, fFlags); if (fd >= 0) return fd; birdCloseFile(hDir); } } else errno = EACCES; } else errno = EACCES; } return fd; } int birdOpen(const char *pszPath, int fFlags, ...) { unsigned __int16 fMode; va_list va; va_start(va, fFlags); fMode = va_arg(va, unsigned __int16); va_end(va); return birdOpenInt(pszPath, fFlags, fMode); } /** * Implements opendir. */ int birdOpenAt(int fdDir, const char *pszPath, int fFlags, ...) { HANDLE hDir; /* * Retrieve the mode mask. */ unsigned __int16 fMode; va_list va; va_start(va, fFlags); fMode = va_arg(va, unsigned __int16); va_end(va); /* * Just call 'open' directly if we can get away with it: */ if (fdDir == AT_FDCWD) return birdOpenInt(pszPath, fFlags, fMode); if (IS_SLASH(pszPath[0])) { if (IS_SLASH(pszPath[1]) && !IS_SLASH(pszPath[2]) && pszPath[2] != '\0') return birdOpenInt(pszPath, fFlags, fMode); } else if (IS_ALPHA(pszPath[0]) && pszPath[1] == ':') { if (IS_SLASH(pszPath[2])) return birdOpenInt(pszPath, fFlags, fMode); /* * Drive letter relative path like "C:kernel32.dll". * We could try use fdDir as the CWD here if it refers to the same drive, * however that's can be implemented later... */ return birdOpenInt(pszPath, fFlags, fMode); } /* * Otherwise query the path of fdDir and construct an absolute path from all that. * This isn't atomic and safe and stuff, but it gets the work done for now. */ hDir = (HANDLE)_get_osfhandle(fdDir); if (hDir != INVALID_HANDLE_VALUE) { /** @todo implement me. */ __debugbreak(); errno = EBADF; } return -1; } kbuild-3608/src/lib/nt/ntstuff.h0000664000175000017500000005414314670377415016553 0ustar locutuslocutus/* $Id: ntstuff.h 3223 2018-03-31 02:29:56Z bird $ */ /** @file * Definitions, types, prototypes and globals for NT. */ /* * Copyright (c) 2005-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___nt_ntstuff_h #define ___nt_ntstuff_h #define timeval timeval_Windows #define WIN32_NO_STATUS #include #include #undef WIN32_NO_STATUS #include #undef timeval #include /** @defgroup grp_nt_ntstuff NT Stuff * @{ */ typedef LONG MY_NTSTATUS; typedef ULONG MY_ACCESS_MASK; typedef struct MY_IO_STATUS_BLOCK { union { MY_NTSTATUS Status; PVOID Pointer; } u; ULONG_PTR Information; } MY_IO_STATUS_BLOCK; typedef VOID WINAPI MY_IO_APC_ROUTINE(PVOID, MY_IO_STATUS_BLOCK *, ULONG); typedef struct MY_UNICODE_STRING { USHORT Length; USHORT MaximumLength; PWSTR Buffer; } MY_UNICODE_STRING; typedef struct MY_STRING { USHORT Length; USHORT MaximumLength; PCHAR Buffer; } MY_STRING; typedef MY_STRING MY_ANSI_STRING; typedef struct MY_CURDIR { UNICODE_STRING DosPath; HANDLE Handle; } MY_CURDIR; typedef MY_CURDIR *PMY_CURDIR; typedef struct MY_RTL_DRIVE_LETTER_CURDIR { USHORT Flags; USHORT Length; ULONG TimeStamp; MY_ANSI_STRING DosPath; } MY_RTL_DRIVE_LETTER_CURDIR; typedef MY_RTL_DRIVE_LETTER_CURDIR *PRTL_DRIVE_LETTER_CURDIR; typedef struct MY_RTL_USER_PROCESS_PARAMETERS { ULONG MaximumLength; ULONG Length; ULONG Flags; ULONG DebugFlags; HANDLE ConsoleHandle; ULONG ConsoleFlags; HANDLE StandardInput; HANDLE StandardOutput; HANDLE StandardError; MY_CURDIR CurrentDirectory; MY_UNICODE_STRING DllPath; MY_UNICODE_STRING ImagePathName; MY_UNICODE_STRING CommandLine; PWSTR Environment; ULONG StartingX; ULONG StartingY; ULONG CountX; ULONG CountY; ULONG CountCharsX; ULONG CountCharsY; ULONG FillAttribute; ULONG WindowFlags; ULONG ShowWindowFlags; MY_UNICODE_STRING WindowTitle; MY_UNICODE_STRING DesktopInfo; MY_UNICODE_STRING ShellInfo; MY_UNICODE_STRING RuntimeInfo; MY_RTL_DRIVE_LETTER_CURDIR CurrentDirectories[0x20]; SIZE_T EnvironmentSize; /* >= Vista+ */ SIZE_T EnvironmentVersion; /* >= Windows 7. */ PVOID PackageDependencyData; /* >= Windows 8 or Windows 8.1. */ ULONG ProcessGroupId; /* >= Windows 8 or Windows 8.1. */ } MY_RTL_USER_PROCESS_PARAMETERS; typedef MY_RTL_USER_PROCESS_PARAMETERS *PMY_RTL_USER_PROCESS_PARAMETERS; typedef struct MY_OBJECT_ATTRIBUTES { ULONG Length; HANDLE RootDirectory; MY_UNICODE_STRING *ObjectName; ULONG Attributes; PVOID SecurityDescriptor; PVOID SecurityQualityOfService; } MY_OBJECT_ATTRIBUTES; #define MyInitializeObjectAttributes(a_pAttr, a_pName, a_fAttribs, a_hRoot, a_pSecDesc) \ do { \ (a_pAttr)->Length = sizeof(MY_OBJECT_ATTRIBUTES); \ (a_pAttr)->RootDirectory = (a_hRoot); \ (a_pAttr)->Attributes = (a_fAttribs); \ (a_pAttr)->ObjectName = (a_pName); \ (a_pAttr)->SecurityDescriptor = (a_pSecDesc); \ (a_pAttr)->SecurityQualityOfService = NULL; \ } while (0) typedef struct MY_FILE_BASIC_INFORMATION { LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; ULONG FileAttributes; } MY_FILE_BASIC_INFORMATION; typedef struct MY_FILE_STANDARD_INFORMATION { LARGE_INTEGER AllocationSize; LARGE_INTEGER EndOfFile; ULONG NumberOfLinks; BOOLEAN DeletePending; BOOLEAN Directory; } MY_FILE_STANDARD_INFORMATION; typedef struct MY_FILE_NETWORK_OPEN_INFORMATION { LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; LARGE_INTEGER AllocationSize; LARGE_INTEGER EndOfFile; ULONG FileAttributes; ULONG AlignmentPadding; } MY_FILE_NETWORK_OPEN_INFORMATION; typedef struct MY_FILE_INTERNAL_INFORMATION { LARGE_INTEGER IndexNumber; } MY_FILE_INTERNAL_INFORMATION; typedef struct MY_FILE_EA_INFORMATION { ULONG EaSize; } MY_FILE_EA_INFORMATION; typedef struct MY_FILE_ACCESS_INFORMATION { ACCESS_MASK AccessFlags; } MY_FILE_ACCESS_INFORMATION; typedef struct MY_FILE_POSITION_INFORMATION { LARGE_INTEGER CurrentByteOffset; } MY_FILE_POSITION_INFORMATION; typedef struct MY_FILE_MODE_INFORMATION { ULONG Mode; } MY_FILE_MODE_INFORMATION; typedef struct MY_FILE_ALIGNMENT_INFORMATION { ULONG AlignmentRequirement; } MY_FILE_ALIGNMENT_INFORMATION; typedef struct MY_FILE_NAME_INFORMATION { ULONG FileNameLength; WCHAR FileName[1]; } MY_FILE_NAME_INFORMATION; typedef struct MY_FILE_ALL_INFORMATION { MY_FILE_BASIC_INFORMATION BasicInformation; MY_FILE_STANDARD_INFORMATION StandardInformation; MY_FILE_INTERNAL_INFORMATION InternalInformation; MY_FILE_EA_INFORMATION EaInformation; MY_FILE_ACCESS_INFORMATION AccessInformation; MY_FILE_POSITION_INFORMATION PositionInformation; MY_FILE_MODE_INFORMATION ModeInformation; MY_FILE_ALIGNMENT_INFORMATION AlignmentInformation; MY_FILE_NAME_INFORMATION NameInformation; } MY_FILE_ALL_INFORMATION; typedef struct MY_FILE_ATTRIBUTE_TAG_INFORMATION { ULONG FileAttributes; ULONG ReparseTag; } MY_FILE_ATTRIBUTE_TAG_INFORMATION; typedef struct MY_FILE_NAMES_INFORMATION { ULONG NextEntryOffset; ULONG FileIndex; ULONG FileNameLength; WCHAR FileName[1]; } MY_FILE_NAMES_INFORMATION; /** The sizeof(MY_FILE_NAMES_INFORMATION) without the FileName. */ #define MIN_SIZEOF_MY_FILE_NAMES_INFORMATION (4 + 4 + 4) typedef struct MY_FILE_ID_FULL_DIR_INFORMATION { ULONG NextEntryOffset; ULONG FileIndex; LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; LARGE_INTEGER EndOfFile; LARGE_INTEGER AllocationSize; ULONG FileAttributes; ULONG FileNameLength; ULONG EaSize; LARGE_INTEGER FileId; WCHAR FileName[1]; } MY_FILE_ID_FULL_DIR_INFORMATION; /** The sizeof(MY_FILE_NAMES_INFORMATION) without the FileName. */ #define MIN_SIZEOF_MY_FILE_ID_FULL_DIR_INFORMATION ( (size_t)&((MY_FILE_ID_FULL_DIR_INFORMATION *)0)->FileName ) typedef struct MY_FILE_BOTH_DIR_INFORMATION { ULONG NextEntryOffset; ULONG FileIndex; LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; LARGE_INTEGER EndOfFile; LARGE_INTEGER AllocationSize; ULONG FileAttributes; ULONG FileNameLength; ULONG EaSize; CCHAR ShortNameLength; WCHAR ShortName[12]; WCHAR FileName[1]; } MY_FILE_BOTH_DIR_INFORMATION; /** The sizeof(MY_FILE_BOTH_DIR_INFORMATION) without the FileName. */ #define MIN_SIZEOF_MY_FILE_BOTH_DIR_INFORMATION ( (size_t)&((MY_FILE_BOTH_DIR_INFORMATION *)0)->FileName ) typedef struct MY_FILE_ID_BOTH_DIR_INFORMATION { ULONG NextEntryOffset; ULONG FileIndex; LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; LARGE_INTEGER EndOfFile; LARGE_INTEGER AllocationSize; ULONG FileAttributes; ULONG FileNameLength; ULONG EaSize; CCHAR ShortNameLength; WCHAR ShortName[12]; LARGE_INTEGER FileId; WCHAR FileName[1]; } MY_FILE_ID_BOTH_DIR_INFORMATION; /** The sizeof(MY_FILE_NAMES_INFORMATION) without the FileName. */ #define MIN_SIZEOF_MY_FILE_ID_BOTH_DIR_INFORMATION ( (size_t)&((MY_FILE_ID_BOTH_DIR_INFORMATION *)0)->FileName ) typedef struct MY_FILE_DISPOSITION_INFORMATION { BOOLEAN DeleteFile; } MY_FILE_DISPOSITION_INFORMATION; typedef enum MY_FILE_INFORMATION_CLASS { MyFileDirectoryInformation = 1, MyFileFullDirectoryInformation, /* = 2 */ MyFileBothDirectoryInformation, /* = 3 */ MyFileBasicInformation, /* = 4 */ MyFileStandardInformation, /* = 5 */ MyFileInternalInformation, /* = 6 */ MyFileEaInformation, /* = 7 */ MyFileAccessInformation, /* = 8 */ MyFileNameInformation, /* = 9 */ MyFileRenameInformation, /* = 10 */ MyFileLinkInformation, /* = 11 */ MyFileNamesInformation, /* = 12 */ MyFileDispositionInformation, /* = 13 */ MyFilePositionInformation, /* = 14 */ MyFileFullEaInformation, /* = 15 */ MyFileModeInformation, /* = 16 */ MyFileAlignmentInformation, /* = 17 */ MyFileAllInformation, /* = 18 */ MyFileAllocationInformation, /* = 19 */ MyFileEndOfFileInformation, /* = 20 */ MyFileAlternateNameInformation, /* = 21 */ MyFileStreamInformation, /* = 22 */ MyFilePipeInformation, /* = 23 */ MyFilePipeLocalInformation, /* = 24 */ MyFilePipeRemoteInformation, /* = 25 */ MyFileMailslotQueryInformation, /* = 26 */ MyFileMailslotSetInformation, /* = 27 */ MyFileCompressionInformation, /* = 28 */ MyFileObjectIdInformation, /* = 29 */ MyFileCompletionInformation, /* = 30 */ MyFileMoveClusterInformation, /* = 31 */ MyFileQuotaInformation, /* = 32 */ MyFileReparsePointInformation, /* = 33 */ MyFileNetworkOpenInformation, /* = 34 */ MyFileAttributeTagInformation, /* = 35 */ MyFileTrackingInformation, /* = 36 */ MyFileIdBothDirectoryInformation, /* = 37 */ MyFileIdFullDirectoryInformation, /* = 38 */ MyFileValidDataLengthInformation, /* = 39 */ MyFileShortNameInformation, /* = 40 */ MyFileIoCompletionNotificationInformation, /* = 41 */ MyFileIoStatusBlockRangeInformation, /* = 42 */ MyFileIoPriorityHintInformation, /* = 43 */ MyFileSfioReserveInformation, /* = 44 */ MyFileSfioVolumeInformation, /* = 45 */ MyFileHardLinkInformation, /* = 46 */ MyFileProcessIdsUsingFileInformation, /* = 47 */ MyFileNormalizedNameInformation, /* = 48 */ MyFileNetworkPhysicalNameInformation, /* = 49 */ MyFileIdGlobalTxDirectoryInformation, /* = 50 */ MyFileIsRemoteDeviceInformation, /* = 51 */ MyFileAttributeCacheInformation, /* = 52 */ MyFileNumaNodeInformation, /* = 53 */ MyFileStandardLinkInformation, /* = 54 */ MyFileRemoteProtocolInformation, /* = 55 */ MyFileMaximumInformation } MY_FILE_INFORMATION_CLASS; typedef struct MY_FILE_FS_VOLUME_INFORMATION { LARGE_INTEGER VolumeCreationTime; ULONG VolumeSerialNumber; ULONG VolumeLabelLength; BOOLEAN SupportsObjects; WCHAR VolumeLabel[1]; } MY_FILE_FS_VOLUME_INFORMATION; typedef struct _MY_FILE_FS_ATTRIBUTE_INFORMATION { ULONG FileSystemAttributes; LONG MaximumComponentNameLength; ULONG FileSystemNameLength; WCHAR FileSystemName[1]; } MY_FILE_FS_ATTRIBUTE_INFORMATION; typedef enum MY_FSINFOCLASS { MyFileFsVolumeInformation = 1, MyFileFsLabelInformation, /* = 2 */ MyFileFsSizeInformation, /* = 3 */ MyFileFsDeviceInformation, /* = 4 */ MyFileFsAttributeInformation, /* = 5 */ MyFileFsControlInformation, /* = 6 */ MyFileFsFullSizeInformation, /* = 7 */ MyFileFsObjectIdInformation, /* = 8 */ MyFileFsDriverPathInformation, /* = 9 */ MyFileFsVolumeFlagsInformation, /* = 10 */ MyFileFsMaximumInformation } MY_FS_INFORMATION_CLASS; typedef struct MY_RTLP_CURDIR_REF { LONG RefCount; HANDLE Handle; } MY_RTLP_CURDIR_REF; typedef struct MY_RTL_RELATIVE_NAME_U { MY_UNICODE_STRING RelativeName; HANDLE ContainingDirectory; MY_RTLP_CURDIR_REF CurDirRef; } MY_RTL_RELATIVE_NAME_U; #ifndef OBJ_INHERIT # define OBJ_INHERIT 0x00000002U # define OBJ_PERMANENT 0x00000010U # define OBJ_EXCLUSIVE 0x00000020U # define OBJ_CASE_INSENSITIVE 0x00000040U # define OBJ_OPENIF 0x00000080U # define OBJ_OPENLINK 0x00000100U # define OBJ_KERNEL_HANDLE 0x00000200U # define OBJ_FORCE_ACCESS_CHECK 0x00000400U # define OBJ_VALID_ATTRIBUTES 0x000007f2U #endif #ifndef FILE_OPEN # define FILE_SUPERSEDE 0x00000000U # define FILE_OPEN 0x00000001U # define FILE_CREATE 0x00000002U # define FILE_OPEN_IF 0x00000003U # define FILE_OVERWRITE 0x00000004U # define FILE_OVERWRITE_IF 0x00000005U # define FILE_MAXIMUM_DISPOSITION 0x00000005U #endif #ifndef FILE_DIRECTORY_FILE # define FILE_DIRECTORY_FILE 0x00000001U # define FILE_WRITE_THROUGH 0x00000002U # define FILE_SEQUENTIAL_ONLY 0x00000004U # define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008U # define FILE_SYNCHRONOUS_IO_ALERT 0x00000010U # define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020U # define FILE_NON_DIRECTORY_FILE 0x00000040U # define FILE_CREATE_TREE_CONNECTION 0x00000080U # define FILE_COMPLETE_IF_OPLOCKED 0x00000100U # define FILE_NO_EA_KNOWLEDGE 0x00000200U # define FILE_OPEN_REMOTE_INSTANCE 0x00000400U # define FILE_RANDOM_ACCESS 0x00000800U # define FILE_DELETE_ON_CLOSE 0x00001000U # define FILE_OPEN_BY_FILE_ID 0x00002000U # define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000U # define FILE_NO_COMPRESSION 0x00008000U # define FILE_RESERVE_OPFILTER 0x00100000U # define FILE_OPEN_REPARSE_POINT 0x00200000U # define FILE_OPEN_NO_RECALL 0x00400000U # define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000U #endif #ifndef DUPLICATE_CLOSE_SOURCE /* For the misnomer NtDuplicateObject. */ # define DUPLICATE_CLOSE_SOURCE 0x00000001U # define DUPLICATE_SAME_ACCESS 0x00000002U #endif #ifndef DUPLICATE_SAME_ATTRIBUTES # define DUPLICATE_SAME_ATTRIBUTES 0x00000004U #endif /** @name NT status codes and associated macros. * @{ */ #define MY_NT_SUCCESS(a_ntRc) ((MY_NTSTATUS)(a_ntRc) >= 0) #define MY_NT_FAILURE(a_ntRc) ((MY_NTSTATUS)(a_ntRc) < 0) #define MY_STATUS_NO_MORE_FILES ((MY_NTSTATUS)0x80000006) #define MY_STATUS_OBJECT_NAME_INVALID ((MY_NTSTATUS)0xc0000033) #define MY_STATUS_OBJECT_NAME_NOT_FOUND ((MY_NTSTATUS)0xc0000034) #define MY_STATUS_OBJECT_PATH_INVALID ((MY_NTSTATUS)0xc0000039) #define MY_STATUS_OBJECT_PATH_NOT_FOUND ((MY_NTSTATUS)0xc000003a) #define MY_STATUS_OBJECT_PATH_SYNTAX_BAD ((MY_NTSTATUS)0xc000003b) /** @} */ /** The pseudohandle for the current process. */ #define MY_NT_CURRENT_PROCESS ((HANDLE)~(uintptr_t)0) /** The pseudohandle for the current thread. */ #define MY_NT_CURRENT_THREAD ((HANDLE)~(uintptr_t)1) typedef struct MY_CLIENT_ID { HANDLE UniqueProcess; HANDLE UniqueThread; } MY_CLIENT_ID; /** Partial TEB. */ typedef struct MY_PARTIAL_TEB { NT_TIB NtTib; PVOID EnvironmentPointer; MY_CLIENT_ID ClientId; PVOID ActiveRpcHandle; PVOID ThreadLocalStoragePointer; PPEB ProcessEnvironmentBlock; KU32 LastErrorValue; KU32 CountOfOwnedCriticalSections; PVOID CsrClientThread; PVOID Win32ThreadInfo; } MY_PARTIAL_TEB; /** Internal macro for reading uintptr_t sized TEB members. */ #if K_ARCH == K_ARCH_AMD64 # define MY_NT_READ_TEB_WORKER(a_offTebMember) ( __readgsqword(a_offTebMember) ) #elif K_ARCH == K_ARCH_X86_32 # define MY_NT_READ_TEB_WORKER(a_offTebMember) ( __readfsdword(a_offTebMember) ) #else # error "Port me!" #endif /** Get the PEB pointer. * @remark Needs stddef.h. */ #define MY_NT_CURRENT_PEB() ( (PPEB)MY_NT_READ_TEB_WORKER(offsetof(MY_PARTIAL_TEB, ProcessEnvironmentBlock)) ) /** Get the TEB pointer. * @remark Needs stddef.h. */ #define MY_NT_CURRENT_TEB() ( (PTEB)MY_NT_READ_TEB_WORKER(offsetof(NT_TIB, Self)) ) /******************************************************************************* * Global Variables * *******************************************************************************/ extern MY_NTSTATUS (WINAPI * g_pfnNtClose)(HANDLE); extern MY_NTSTATUS (WINAPI * g_pfnNtCreateFile)(PHANDLE, MY_ACCESS_MASK, MY_OBJECT_ATTRIBUTES *, MY_IO_STATUS_BLOCK *, PLARGE_INTEGER, ULONG, ULONG, ULONG, ULONG, PVOID, ULONG); extern MY_NTSTATUS (WINAPI * g_pfnNtDeleteFile)(MY_OBJECT_ATTRIBUTES *); extern MY_NTSTATUS (WINAPI * g_pfnNtDuplicateObject)(HANDLE hSrcProc, HANDLE hSrc, HANDLE hDstProc, HANDLE *phRet, MY_ACCESS_MASK fDesiredAccess, ULONG fAttribs, ULONG fOptions); extern MY_NTSTATUS (WINAPI * g_pfnNtReadFile)(HANDLE hFile, HANDLE hEvent, MY_IO_APC_ROUTINE *pfnApc, PVOID pvApcCtx, MY_IO_STATUS_BLOCK *, PVOID pvBuf, ULONG cbToRead, PLARGE_INTEGER poffFile, PULONG puKey); extern MY_NTSTATUS (WINAPI * g_pfnNtQueryInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FILE_INFORMATION_CLASS); extern MY_NTSTATUS (WINAPI * g_pfnNtQueryVolumeInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FS_INFORMATION_CLASS); extern MY_NTSTATUS (WINAPI * g_pfnNtQueryDirectoryFile)(HANDLE, HANDLE, MY_IO_APC_ROUTINE *, PVOID, MY_IO_STATUS_BLOCK *, PVOID, ULONG, MY_FILE_INFORMATION_CLASS, BOOLEAN, MY_UNICODE_STRING *, BOOLEAN); extern MY_NTSTATUS (WINAPI * g_pfnNtQueryAttributesFile)(MY_OBJECT_ATTRIBUTES *, MY_FILE_BASIC_INFORMATION *); extern MY_NTSTATUS (WINAPI * g_pfnNtQueryFullAttributesFile)(MY_OBJECT_ATTRIBUTES *, MY_FILE_NETWORK_OPEN_INFORMATION *); extern MY_NTSTATUS (WINAPI * g_pfnNtSetInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FILE_INFORMATION_CLASS); extern BOOLEAN (WINAPI * g_pfnRtlDosPathNameToNtPathName_U)(PCWSTR, MY_UNICODE_STRING *, PCWSTR *, MY_RTL_RELATIVE_NAME_U *); extern MY_NTSTATUS (WINAPI * g_pfnRtlAnsiStringToUnicodeString)(MY_UNICODE_STRING *, MY_ANSI_STRING const *, BOOLEAN); extern MY_NTSTATUS (WINAPI * g_pfnRtlUnicodeStringToAnsiString)(MY_ANSI_STRING *, MY_UNICODE_STRING *, BOOLEAN); extern BOOLEAN (WINAPI * g_pfnRtlEqualUnicodeString)(MY_UNICODE_STRING const *pUniStr1, MY_UNICODE_STRING const *pUniStr2, BOOLEAN fCaseInsensitive); extern BOOLEAN (WINAPI * g_pfnRtlEqualString)(MY_ANSI_STRING const *pAnsiStr1, MY_ANSI_STRING const *pAnsiStr2, BOOLEAN fCaseInsensitive); extern UCHAR (WINAPI * g_pfnRtlUpperChar)(UCHAR uch); extern ULONG (WINAPI * g_pfnRtlNtStatusToDosError)(MY_NTSTATUS rcNt); extern VOID (WINAPI * g_pfnRtlAcquirePebLock)(VOID); extern VOID (WINAPI * g_pfnRtlReleasePebLock)(VOID); /** @} */ #endif kbuild-3608/src/lib/nt/nthlpcore.c0000664000175000017500000004553114670377415017054 0ustar locutuslocutus/* $Id: nthlpcore.c 3534 2021-12-20 23:31:55Z bird $ */ /** @file * MSC + NT core helpers functions and globals. */ /* * Copyright (c) 2005-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include "nthlp.h" #ifndef NDEBUG # include #endif /******************************************************************************* * Global Variables * *******************************************************************************/ MY_NTSTATUS (WINAPI *g_pfnNtClose)(HANDLE); MY_NTSTATUS (WINAPI *g_pfnNtCreateFile)(PHANDLE, MY_ACCESS_MASK, MY_OBJECT_ATTRIBUTES *, MY_IO_STATUS_BLOCK *, PLARGE_INTEGER, ULONG, ULONG, ULONG, ULONG, PVOID, ULONG); MY_NTSTATUS (WINAPI *g_pfnNtDeleteFile)(MY_OBJECT_ATTRIBUTES *); MY_NTSTATUS (WINAPI *g_pfnNtDuplicateObject)(HANDLE hSrcProc, HANDLE hSrc, HANDLE hDstProc, HANDLE *phRet, MY_ACCESS_MASK fDesiredAccess, ULONG fAttribs, ULONG fOptions); MY_NTSTATUS (WINAPI *g_pfnNtReadFile)(HANDLE hFile, HANDLE hEvent, MY_IO_APC_ROUTINE *pfnApc, PVOID pvApcCtx, MY_IO_STATUS_BLOCK *, PVOID pvBuf, ULONG cbToRead, PLARGE_INTEGER poffFile, PULONG puKey); MY_NTSTATUS (WINAPI *g_pfnNtQueryInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FILE_INFORMATION_CLASS); MY_NTSTATUS (WINAPI *g_pfnNtQueryVolumeInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FS_INFORMATION_CLASS); MY_NTSTATUS (WINAPI *g_pfnNtQueryDirectoryFile)(HANDLE, HANDLE, MY_IO_APC_ROUTINE *, PVOID, MY_IO_STATUS_BLOCK *, PVOID, ULONG, MY_FILE_INFORMATION_CLASS, BOOLEAN, MY_UNICODE_STRING *, BOOLEAN); MY_NTSTATUS (WINAPI *g_pfnNtQueryAttributesFile)(MY_OBJECT_ATTRIBUTES *, MY_FILE_BASIC_INFORMATION *); MY_NTSTATUS (WINAPI *g_pfnNtQueryFullAttributesFile)(MY_OBJECT_ATTRIBUTES *, MY_FILE_NETWORK_OPEN_INFORMATION *); MY_NTSTATUS (WINAPI *g_pfnNtSetInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FILE_INFORMATION_CLASS); BOOLEAN (WINAPI *g_pfnRtlDosPathNameToNtPathName_U)(PCWSTR, MY_UNICODE_STRING *, PCWSTR *, MY_RTL_RELATIVE_NAME_U *); MY_NTSTATUS (WINAPI *g_pfnRtlAnsiStringToUnicodeString)(MY_UNICODE_STRING *, MY_ANSI_STRING const *, BOOLEAN); MY_NTSTATUS (WINAPI *g_pfnRtlUnicodeStringToAnsiString)(MY_ANSI_STRING *, MY_UNICODE_STRING *, BOOLEAN); BOOLEAN (WINAPI *g_pfnRtlEqualUnicodeString)(MY_UNICODE_STRING const *, MY_UNICODE_STRING const *, BOOLEAN); BOOLEAN (WINAPI *g_pfnRtlEqualString)(MY_ANSI_STRING const *, MY_ANSI_STRING const *, BOOLEAN); UCHAR (WINAPI *g_pfnRtlUpperChar)(UCHAR uch); ULONG (WINAPI *g_pfnRtlNtStatusToDosError)(MY_NTSTATUS rcNt); VOID (WINAPI *g_pfnRtlAcquirePebLock)(VOID); VOID (WINAPI *g_pfnRtlReleasePebLock)(VOID); static struct { FARPROC *ppfn; const char *pszName; } const g_apfnDynamicNtdll[] = { { (FARPROC *)&g_pfnNtClose, "NtClose" }, { (FARPROC *)&g_pfnNtCreateFile, "NtCreateFile" }, { (FARPROC *)&g_pfnNtDeleteFile, "NtDeleteFile" }, { (FARPROC *)&g_pfnNtDuplicateObject, "NtDuplicateObject" }, { (FARPROC *)&g_pfnNtReadFile, "NtReadFile" }, { (FARPROC *)&g_pfnNtQueryInformationFile, "NtQueryInformationFile" }, { (FARPROC *)&g_pfnNtQueryVolumeInformationFile, "NtQueryVolumeInformationFile" }, { (FARPROC *)&g_pfnNtQueryDirectoryFile, "NtQueryDirectoryFile" }, { (FARPROC *)&g_pfnNtQueryAttributesFile, "NtQueryAttributesFile" }, { (FARPROC *)&g_pfnNtQueryFullAttributesFile, "NtQueryFullAttributesFile" }, { (FARPROC *)&g_pfnNtSetInformationFile, "NtSetInformationFile" }, { (FARPROC *)&g_pfnRtlDosPathNameToNtPathName_U, "RtlDosPathNameToNtPathName_U" }, { (FARPROC *)&g_pfnRtlAnsiStringToUnicodeString, "RtlAnsiStringToUnicodeString" }, { (FARPROC *)&g_pfnRtlUnicodeStringToAnsiString, "RtlUnicodeStringToAnsiString" }, { (FARPROC *)&g_pfnRtlEqualUnicodeString, "RtlEqualUnicodeString" }, { (FARPROC *)&g_pfnRtlEqualString, "RtlEqualString" }, { (FARPROC *)&g_pfnRtlUpperChar, "RtlUpperChar" }, { (FARPROC *)&g_pfnRtlNtStatusToDosError, "RtlNtStatusToDosError" }, { (FARPROC *)&g_pfnRtlAcquirePebLock, "RtlAcquirePebLock" }, { (FARPROC *)&g_pfnRtlReleasePebLock, "RtlReleasePebLock" }, }; /** Set to 1 if we've successfully resolved the imports, otherwise 0. */ int g_fResolvedNtImports = 0; void birdResolveImportsWorker(void) { HMODULE hMod = LoadLibraryW(L"ntdll.dll"); int i = sizeof(g_apfnDynamicNtdll) / sizeof(g_apfnDynamicNtdll[0]); while (i-- > 0) { const char *pszSym = g_apfnDynamicNtdll[i].pszName; FARPROC pfn; *g_apfnDynamicNtdll[i].ppfn = pfn = GetProcAddress(hMod, pszSym); if (!pfn) { /* Write short message and die. */ static const char s_szMsg[] = "\r\nFatal error resolving NTDLL.DLL symbols!\r\nSymbol: "; DWORD cbWritten; if ( !WriteFile(GetStdHandle(STD_ERROR_HANDLE), s_szMsg, sizeof(s_szMsg) - 1, &cbWritten, NULL) || !WriteFile(GetStdHandle(STD_ERROR_HANDLE), pszSym, (DWORD)strlen(pszSym), &cbWritten, NULL) || !WriteFile(GetStdHandle(STD_ERROR_HANDLE), "\r\n", sizeof("\r\n") - 1, &cbWritten, NULL) ) *(void **)(size_t)i = NULL; ExitProcess(127); } } g_fResolvedNtImports = 1; } void *birdTmpAlloc(size_t cb) { return malloc(cb); } void birdTmpFree(void *pv) { if (pv) free(pv); } void *birdMemAlloc(size_t cb) { return malloc(cb); } void *birdMemAllocZ(size_t cb) { return calloc(cb, 1); } void birdMemFree(void *pv) { if (pv) free(pv); } int birdErrnoFromNtStatus(MY_NTSTATUS rcNt) { switch (rcNt) { /* EPERM = 1 */ case STATUS_CANNOT_DELETE: return EPERM; /* ENOENT = 2 */ case STATUS_NOT_FOUND: case STATUS_OBJECT_NAME_NOT_FOUND: case STATUS_OBJECT_PATH_NOT_FOUND: case STATUS_OBJECT_NAME_INVALID: case STATUS_INVALID_COMPUTER_NAME: case STATUS_VARIABLE_NOT_FOUND: case STATUS_MESSAGE_NOT_FOUND: case STATUS_DLL_NOT_FOUND: case STATUS_ORDINAL_NOT_FOUND: case STATUS_ENTRYPOINT_NOT_FOUND: case STATUS_PATH_NOT_COVERED: case STATUS_BAD_NETWORK_PATH: case STATUS_DFS_EXIT_PATH_FOUND: case RPC_NT_OBJECT_NOT_FOUND: case STATUS_DELETE_PENDING: return ENOENT; /* ESRCH = 3 */ case STATUS_PROCESS_NOT_IN_JOB: return ESRCH; /* EINTR = 4 */ case STATUS_ALERTED: case STATUS_USER_APC: return EINTR; /* EIO = 5 */ /* ENXIO = 6 */ /* E2BIG = 7 */ /* ENOEXEC = 8 */ case STATUS_INVALID_IMAGE_FORMAT: case STATUS_INVALID_IMAGE_NE_FORMAT: case STATUS_INVALID_IMAGE_LE_FORMAT: case STATUS_INVALID_IMAGE_NOT_MZ: case STATUS_INVALID_IMAGE_PROTECT: case STATUS_INVALID_IMAGE_WIN_16: case STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT: case STATUS_IMAGE_CHECKSUM_MISMATCH: case STATUS_IMAGE_MP_UP_MISMATCH: case STATUS_IMAGE_MACHINE_TYPE_MISMATCH: case STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE: case STATUS_SYSTEM_IMAGE_BAD_SIGNATURE: case STATUS_SECTION_NOT_IMAGE: case STATUS_INVALID_IMAGE_WIN_32: case STATUS_INVALID_IMAGE_WIN_64: case STATUS_INVALID_IMAGE_HASH: case STATUS_IMAGE_CERT_REVOKED: return ENOEXEC; /* EBADF = 9 */ case STATUS_INVALID_HANDLE: case STATUS_PORT_CLOSED: case STATUS_OPLOCK_HANDLE_CLOSED: case STATUS_HANDLES_CLOSED: case STATUS_FILE_FORCED_CLOSED: return EBADF; /* ECHILD = 10 */ /* EAGAIN = 11 */ case STATUS_WMI_TRY_AGAIN: case STATUS_GRAPHICS_TRY_AGAIN_LATER: case STATUS_GRAPHICS_TRY_AGAIN_NOW: return EAGAIN; /* ENOMEM = 12 */ case STATUS_NO_MEMORY: case STATUS_HV_INSUFFICIENT_MEMORY: case STATUS_INSUFFICIENT_RESOURCES: case STATUS_REMOTE_RESOURCES: case STATUS_INSUFF_SERVER_RESOURCES: return ENOMEM; /* EACCES = 13 */ case STATUS_ACCESS_DENIED: case STATUS_NETWORK_ACCESS_DENIED: case RPC_NT_PROXY_ACCESS_DENIED: case STATUS_CTX_SHADOW_DENIED: case STATUS_CTX_WINSTATION_ACCESS_DENIED: return EACCES; /* EFAULT = 14 */ case STATUS_ACCESS_VIOLATION: case STATUS_HARDWARE_MEMORY_ERROR: return EFAULT; /* EBUSY = 16 */ case STATUS_PIPE_BUSY: case STATUS_RESOURCE_IN_USE: return EBUSY; /* EEXIST = 17 */ case STATUS_OBJECT_NAME_EXISTS: case STATUS_OBJECT_NAME_COLLISION: case STATUS_DUPLICATE_NAME: return EEXIST; /* EXDEV = 18 */ case STATUS_NOT_SAME_DEVICE: return EXDEV; /* ENODEV = 19 */ /* ENOTDIR = 20 */ case STATUS_NOT_A_DIRECTORY: case STATUS_DIRECTORY_IS_A_REPARSE_POINT: case STATUS_OBJECT_PATH_SYNTAX_BAD: case STATUS_OBJECT_PATH_INVALID: case STATUS_OBJECT_TYPE_MISMATCH: return ENOTDIR; /* EISDIR = 21 */ case STATUS_FILE_IS_A_DIRECTORY: return EISDIR; /* EINVAL = 22 */ case STATUS_INVALID_PARAMETER: case STATUS_INVALID_PARAMETER_1: case STATUS_INVALID_PARAMETER_2: case STATUS_INVALID_PARAMETER_3: case STATUS_INVALID_PARAMETER_4: case STATUS_INVALID_PARAMETER_5: case STATUS_INVALID_PARAMETER_6: case STATUS_INVALID_PARAMETER_7: case STATUS_INVALID_PARAMETER_8: case STATUS_INVALID_PARAMETER_9: case STATUS_INVALID_PARAMETER_10: case STATUS_INVALID_PARAMETER_11: case STATUS_INVALID_PARAMETER_12: case STATUS_INVALID_PARAMETER_MIX: return EINVAL; /* ENFILE = 23 */ /* EMFILE = 24 */ case STATUS_TOO_MANY_OPENED_FILES: return EMFILE; /* ENOTTY = 25 */ /* EFBIG = 27 */ /* ENOSPC = 28 */ case STATUS_DISK_FULL: return ENOSPC; /* ESPIPE = 29 */ /* EROFS = 30 */ /* EMLINK = 31 */ /* EPIPE = 32 */ case STATUS_PIPE_BROKEN: case RPC_NT_PIPE_CLOSED: return EPIPE; /* EDOM = 33 */ /* ERANGE = 34 */ /* EDEADLK = 36 */ case STATUS_POSSIBLE_DEADLOCK: return EDEADLK; /* ENAMETOOLONG = 38 */ case STATUS_NAME_TOO_LONG: return ENAMETOOLONG; /* ENOLCK = 39 */ /* ENOSYS = 40 */ case STATUS_NOT_SUPPORTED: return ENOSYS; /* ENOTEMPTY = 41 */ case STATUS_DIRECTORY_NOT_EMPTY: return ENOTEMPTY; /* EILSEQ = 42 */ /* EADDRINUSE = 100 */ /* EADDRNOTAVAIL = 101 */ /* EAFNOSUPPORT = 102 */ /* EALREADY = 103 */ case STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED: case STATUS_DEVICE_ALREADY_ATTACHED: case STATUS_PORT_ALREADY_SET: case STATUS_IMAGE_ALREADY_LOADED: case STATUS_TOKEN_ALREADY_IN_USE: case STATUS_IMAGE_ALREADY_LOADED_AS_DLL: case STATUS_ADDRESS_ALREADY_EXISTS: case STATUS_ADDRESS_ALREADY_ASSOCIATED: return EALREADY; /* EBADMSG = 104 */ /* ECANCELED = 105 */ /* ECONNABORTED = 106 */ /* ECONNREFUSED = 107 */ /* ECONNRESET = 108 */ /* EDESTADDRREQ = 109 */ /* EHOSTUNREACH = 110 */ case STATUS_HOST_UNREACHABLE: return EHOSTUNREACH; /* EIDRM = 111 */ /* EINPROGRESS = 112 */ /* EISCONN = 113 */ /* ELOOP = 114 */ /* EMSGSIZE = 115 */ /* ENETDOWN = 116 */ /* ENETRESET = 117 */ /* ENETUNREACH = 118 */ case STATUS_NETWORK_UNREACHABLE: return ENETUNREACH; /* ENOBUFS = 119 */ /* ENODATA = 120 */ /* ENOLINK = 121 */ /* ENOMSG = 122 */ /* ENOPROTOOPT = 123 */ /* ENOSR = 124 */ /* ENOSTR = 125 */ /* ENOTCONN = 126 */ /* ENOTRECOVERABLE = 127 */ /* ENOTSOCK = 128 */ /* ENOTSUP = 129 */ /* EOPNOTSUPP = 130 */ /* EOTHER = 131 */ /* EOVERFLOW = 132 */ /* EOWNERDEAD = 133 */ /* EPROTO = 134 */ /* EPROTONOSUPPORT = 135 */ /* EPROTOTYPE = 136 */ /* ETIME = 137 */ /* ETIMEDOUT = 138 */ case STATUS_VIRTUAL_CIRCUIT_CLOSED: case STATUS_TIMEOUT: return ETIMEDOUT; /* ETXTBSY = 139 */ case STATUS_SHARING_VIOLATION: return ETXTBSY; /* EWOULDBLOCK = 140 */ } #ifndef NDEBUG __debugbreak(); fprintf(stderr, "rcNt=%#x (%d)\n", rcNt, rcNt); #endif return EINVAL; } int birdSetErrnoFromNt(MY_NTSTATUS rcNt) { errno = birdErrnoFromNtStatus(rcNt); #if 0 { ULONG rcWin32; _doserrno = rcWin32 = g_pfnRtlNtStatusToDosError(rcNt); SetLastError(rcWin32); } #endif return -1; } int birdSetErrnoFromWin32(DWORD dwErr) { switch (dwErr) { default: case ERROR_INVALID_FUNCTION: errno = EINVAL; break; case ERROR_FILE_NOT_FOUND: errno = ENOENT; break; case ERROR_PATH_NOT_FOUND: errno = ENOENT; break; case ERROR_TOO_MANY_OPEN_FILES: errno = EMFILE; break; case ERROR_ACCESS_DENIED: errno = EACCES; break; case ERROR_INVALID_HANDLE: errno = EBADF; break; case ERROR_ARENA_TRASHED: errno = ENOMEM; break; case ERROR_NOT_ENOUGH_MEMORY: errno = ENOMEM; break; case ERROR_INVALID_BLOCK: errno = ENOMEM; break; case ERROR_BAD_ENVIRONMENT: errno = E2BIG; break; case ERROR_BAD_FORMAT: errno = ENOEXEC; break; case ERROR_INVALID_ACCESS: errno = EINVAL; break; case ERROR_INVALID_DATA: errno = EINVAL; break; case ERROR_INVALID_DRIVE: errno = ENOENT; break; case ERROR_CURRENT_DIRECTORY: errno = EACCES; break; case ERROR_NOT_SAME_DEVICE: errno = EXDEV; break; case ERROR_NO_MORE_FILES: errno = ENOENT; break; case ERROR_LOCK_VIOLATION: errno = EACCES; break; case ERROR_BAD_NETPATH: errno = ENOENT; break; case ERROR_NETWORK_ACCESS_DENIED: errno = EACCES; break; case ERROR_BAD_NET_NAME: errno = ENOENT; break; case ERROR_FILE_EXISTS: errno = EEXIST; break; case ERROR_CANNOT_MAKE: errno = EACCES; break; case ERROR_FAIL_I24: errno = EACCES; break; case ERROR_INVALID_PARAMETER: errno = EINVAL; break; case ERROR_NO_PROC_SLOTS: errno = EAGAIN; break; case ERROR_DRIVE_LOCKED: errno = EACCES; break; case ERROR_BROKEN_PIPE: errno = EPIPE; break; case ERROR_DISK_FULL: errno = ENOSPC; break; case ERROR_INVALID_TARGET_HANDLE: errno = EBADF; break; case ERROR_WAIT_NO_CHILDREN: errno = ECHILD; break; case ERROR_CHILD_NOT_COMPLETE: errno = ECHILD; break; case ERROR_DIRECT_ACCESS_HANDLE: errno = EBADF; break; case ERROR_NEGATIVE_SEEK: errno = EINVAL; break; case ERROR_SEEK_ON_DEVICE: errno = EACCES; break; case ERROR_DIR_NOT_EMPTY: errno = ENOTEMPTY; break; case ERROR_NOT_LOCKED: errno = EACCES; break; case ERROR_BAD_PATHNAME: errno = ENOENT; break; case ERROR_MAX_THRDS_REACHED: errno = EAGAIN; break; case ERROR_LOCK_FAILED: errno = EACCES; break; case ERROR_ALREADY_EXISTS: errno = EEXIST; break; case ERROR_FILENAME_EXCED_RANGE: errno = ENOENT; break; case ERROR_NESTING_NOT_ALLOWED: errno = EAGAIN; break; #ifdef EMLINK case ERROR_TOO_MANY_LINKS: errno = EMLINK; break; #endif case ERROR_SHARING_VIOLATION: errno = ETXTBSY; break; } return -1; } int birdSetErrnoToNoMem(void) { errno = ENOMEM; return -1; } int birdSetErrnoToInvalidArg(void) { errno = EINVAL; return -1; } int birdSetErrnoToBadFileNo(void) { errno = EBADF; return -1; } kbuild-3608/src/lib/nt/ntstat.h0000664000175000017500000001241614670377415016374 0ustar locutuslocutus/* $Id: ntstat.h 3485 2020-09-21 12:25:08Z bird $ */ /** @file * MSC + NT stat, lstat and fstat implementation and wrappers. */ /* * Copyright (c) 2005-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___nt_ntstat_h #define ___nt_ntstat_h #include "nttypes.h" #include #include #include #undef stat #undef lstat #undef fstat /** The distance between the NT and unix epochs given in NT time (units of 100 * ns). */ #define BIRD_NT_EPOCH_OFFSET_UNIX_100NS 116444736000000000LL typedef struct BirdStat { unsigned __int16 st_mode; unsigned __int8 st_isdirsymlink; /**< Set if directory symlink. */ unsigned __int8 st_ismountpoint; /**< Set if mount point; 1 if not followed, 2 if followed (lstat & readdir only). */ unsigned __int16 st_padding0[2]; __int64 st_size; BirdTimeSpec_T st_atim; BirdTimeSpec_T st_mtim; BirdTimeSpec_T st_ctim; BirdTimeSpec_T st_birthtim; unsigned __int64 st_ino; unsigned __int64 st_dev; unsigned __int32 st_nlink; unsigned __int16 st_rdev; __int16 st_uid; __int16 st_gid; unsigned __int16 st_padding1; unsigned __int32 st_attribs; unsigned __int32 st_blksize; __int64 st_blocks; } BirdStat_T; #define BIRD_STAT_BLOCK_SIZE 512 #define st_atime st_atim.tv_sec #define st_ctime st_ctim.tv_sec #define st_mtime st_mtim.tv_sec #define st_birthtime st_birthtim.tv_sec int birdStatFollowLink(const char *pszPath, BirdStat_T *pStat); int birdStatFollowLinkW(const wchar_t *pwszPath, BirdStat_T *pStat); int birdStatOnLink(const char *pszPath, BirdStat_T *pStat); int birdStatOnLinkW(const wchar_t *pwszPath, BirdStat_T *pStat); int birdStatAt(void *hRoot, const char *pszPath, BirdStat_T *pStat, int fFollowLink); int birdStatAtW(void *hRoot, const wchar_t *pwszPath, BirdStat_T *pStat, int fFollowLink); int birdStatOnFd(int fd, BirdStat_T *pStat); int birdStatOnFdJustSize(int fd, __int64 *pcbFile); int birdStatModTimeOnly(const char *pszPath, BirdTimeSpec_T *pTimeSpec, int fFollowLink); int birdStatModeOnly(const char *pszPath, unsigned __int16 *pMode, int fFollowLink); #ifdef ___nt_ntstuff_h int birdStatHandle(HANDLE hFile, BirdStat_T *pStat, const char *pszPath); void birdStatFillFromFileIdFullDirInfo(BirdStat_T *pStat, MY_FILE_ID_FULL_DIR_INFORMATION const *pBuf); void birdStatFillFromFileIdBothDirInfo(BirdStat_T *pStat, MY_FILE_ID_BOTH_DIR_INFORMATION const *pBuf); void birdStatFillFromFileBothDirInfo(BirdStat_T *pStat, MY_FILE_BOTH_DIR_INFORMATION const *pBuf); MY_NTSTATUS birdQueryVolumeDeviceNumber(HANDLE hFile, MY_FILE_FS_VOLUME_INFORMATION *pVolInfo, size_t cbVolInfo, unsigned __int64 *puDevNo); unsigned __int64 birdVolumeInfoToDeviceNumber(MY_FILE_FS_VOLUME_INFORMATION const *pVolInfo); #endif #define STAT_REDEFINED_ALREADY #define stat BirdStat #define BirdStat(a_pszPath, a_pStat) birdStatFollowLink(a_pszPath, a_pStat) #define lstat(a_pszPath, a_pStat) birdStatOnLink(a_pszPath, a_pStat) #define fstat(a_fd, a_pStat) birdStatOnFd(a_fd, a_pStat) #ifndef _S_IFLNK # define _S_IFLNK 0xa000 #endif #ifndef S_IFLNK # define S_IFLNK _S_IFLNK #endif #ifndef S_IFIFO # define S_IFIFO _S_IFIFO #endif #ifndef S_ISLNK # define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK) #endif #ifndef S_ISDIR # define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) #endif #ifndef S_ISREG # define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) #endif #define S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) #define S_IXUSR _S_IEXEC #define S_IWUSR _S_IWRITE #define S_IRUSR _S_IREAD #define S_IRWXG 0000070 #define S_IRGRP 0000040 #define S_IWGRP 0000020 #define S_IXGRP 0000010 #define S_IRWXO 0000007 #define S_IROTH 0000004 #define S_IWOTH 0000002 #define S_IXOTH 0000001 #define S_ISUID 0004000 #define S_ISGID 0002000 #define ALLPERMS 0000777 #endif kbuild-3608/src/lib/nt/ntopenat.h0000664000175000017500000000320414670377415016702 0ustar locutuslocutus/* $Id: ntdir.h 3005 2016-11-06 00:07:37Z bird $ */ /** @file * MSC + NT openat. */ /* * Copyright (c) 2005-2021 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___nt_ntopenat_h #define ___nt_ntopenat_h #include "nttypes.h" extern int birdOpenAt(int fdDir, const char *pszPath, int fFlags, ...); #define openat birdOpenAt #define AT_FDCWD (-987654321) #endif kbuild-3608/src/lib/Makefile.kmk0000664000175000017500000000532414670377415016506 0ustar locutuslocutus# $Id: Makefile.kmk 3551 2022-01-29 02:57:33Z bird $ ## @file # Sub-makefile for various libraries and stuff. # # # Copyright (c) 2006-2016 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # SUB_DEPTH = ../.. include $(KBUILD_PATH)/subheader.kmk LIBRARIES += kDep kDep_TEMPLATE = LIB kDep_DEFS.win += NEED_ISBLANK=1 __WIN32__=1 kDep_SOURCES = kDep.c kDep_NOINST = 1 LIBRARIES += kUtil kUtil_TEMPLATE = LIB kUtil_DEFS.win = __WIN__ kUtil_SOURCES = \ crc32.c \ md5.c \ maybe_con_write.c \ maybe_con_fwrite.c \ is_console.c \ dos2unix.c \ kbuild_version.c \ version_compare.c kUtil_SOURCES.win = \ get_codepage.c \ msc_buffered_printf.c \ win_get_processor_group_active_mask.c \ nt_fullpath.c \ nt_fullpath_cached.c \ quote_argv.c \ quoted_spawn.c \ nt/nthlpcore.c \ nt/nthlpfs.c \ nt/ntdir.c \ nt/ntstat.c \ nt/ntunlink.c \ nt/ntutimes.c \ nt/nt_child_inject_standard_handles.c \ nt/fts-nt.c \ nt/kFsCache.c \ kStuff/kHlp/CRT/kHlpCRTString.cpp \ kStuff/kHlp/CRT/kHlpCRTAlloc.cpp kUtil_SOURCES.solaris = \ restartable-syscall-wrappers.c #kUtil_SOURCES.linux = \ # restartable-syscall-wrappers.c kUtil_NOINST = 1 kbuild_version.c_DEFS = KBUILD_SVN_REV=$(KBUILD_SVN_REV) LIBRARIES.win += kWinStartup kWinStartup_TEMPLATE = LIB kWinStartup_SOURCES = startuphacks-win.c kWinStartup_NOINST = 1 PROGRAMS += wrapper wrapper_TEMPLATE = BIN wrapper_SOURCES = wrapper.c wrapper_NOINST = 1 PROGRAMS.win += tstNtStat tstNtStat_TEMPLATE = BIN tstNtStat_SOURCES = nt/tstNtStat.c tstNtStat_LIBS = $(LIB_KUTIL) tstNtStat_NOINST = 1 PROGRAMS.win += tstNtFts tstNtFts_TEMPLATE = BIN tstNtFts_SOURCES = nt/tstNtFts.c nt/fts-nt.c tstNtFts_LIBS = $(LIB_KUTIL) tstNtFts_NOINST = 1 PROGRAMS.win += tstkFsCache tstkFsCache_TEMPLATE = BIN tstkFsCache_SOURCES = nt/tstkFsCache.c tstkFsCache_LIBS = $(LIB_KUTIL) tstkFsCache_NOINST = 1 PROGRAMS += tstVersionCompare tstVersionCompare_TEMPLATE = BIN tstVersionCompare_SOURCES = version_compare.c tstVersionCompare_DEFS = TEST tstVersionCompare_NOINST = 1 include $(FILE_KBUILD_SUB_FOOTER) kbuild-3608/src/lib/win_get_processor_group_active_mask.c0000664000175000017500000000725314670377415023751 0ustar locutuslocutus/* $Id: win_get_processor_group_active_mask.c 3356 2020-06-05 02:09:14Z bird $ */ /** @file * win_get_processor_group_active_mask - Helper. */ /* * Copyright (c) 2020 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include #include #include "win_get_processor_group_active_mask.h" KAFFINITY win_get_processor_group_active_mask(unsigned iGroup) { union { SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Info; SYSTEM_INFO SysInfo; char ab[8192]; } uBuf; typedef BOOL (WINAPI *PFNGETLOGICALPROCESSORINFORMATIONEX)(LOGICAL_PROCESSOR_RELATIONSHIP, SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *, DWORD *); static PFNGETLOGICALPROCESSORINFORMATIONEX volatile s_pfnGetLogicalProcessorInformationEx = NULL; static HMODULE volatile s_hmodKernel32 = NULL; PFNGETLOGICALPROCESSORINFORMATIONEX pfnGetLogicalProcessorInformationEx = s_pfnGetLogicalProcessorInformationEx; if (!pfnGetLogicalProcessorInformationEx) { if (!s_hmodKernel32) { HMODULE hmodKernel32 = GetModuleHandleW(L"KERNEL32.DLL"); s_hmodKernel32 = hmodKernel32; s_pfnGetLogicalProcessorInformationEx = pfnGetLogicalProcessorInformationEx = (PFNGETLOGICALPROCESSORINFORMATIONEX)GetProcAddress(hmodKernel32, "GetLogicalProcessorInformationEx"); } } SetLastError(0); if (pfnGetLogicalProcessorInformationEx) { DWORD cbBuf; memset(&uBuf, 0, sizeof(uBuf)); uBuf.Info.Size = cbBuf = sizeof(uBuf); if (pfnGetLogicalProcessorInformationEx(RelationGroup, &uBuf.Info, &cbBuf)) { SetLastError(0); if (iGroup < uBuf.Info.Group.MaximumGroupCount) return uBuf.Info.Group.GroupInfo[iGroup].ActiveProcessorMask; } } else if (iGroup == 0) { GetSystemInfo(&uBuf.SysInfo); return uBuf.SysInfo.dwActiveProcessorMask; } return 0; } kbuild-3608/src/lib/kbuild_version.h0000664000175000017500000000277314670377415017462 0ustar locutuslocutus/* $Id: kbuild_version.h 2851 2016-08-31 17:30:52Z bird $ */ /** @file * kbuild_version(), helper function. */ /* * Copyright (c) 2007-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___lib_kbuild_version_h___ #define ___lib_kbuild_version_h___ int kbuild_version(const char *argv0); #endif kbuild-3608/src/lib/kDep.h0000664000175000017500000000564414670377415015326 0ustar locutuslocutus/* $Id: kDep.h 3315 2020-03-31 01:12:19Z bird $ */ /** @file * kDep - Common Dependency Managemnt Code. */ /* * Copyright (c) 2004-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___kDep_h #define ___kDep_h /** A dependency. */ typedef struct DEP { /** Next dependency in the list. */ struct DEP *pNext; /** The filename hash. */ unsigned uHash; /** Set if needs escaping. */ char fNeedsEscaping; /** Set if filename ends with a slash and may require special processing. */ char fTrailingSlash; /** The length of the filename. */ size_t cchFilename; /** The filename. */ char szFilename[4]; } DEP, *PDEP; typedef struct DEPGLOBALS { /** List of dependencies. */ PDEP pDeps; } DEPGLOBALS; typedef DEPGLOBALS *PDEPGLOBALS; extern void depInit(PDEPGLOBALS pThis); extern void depCleanup(PDEPGLOBALS pThis); extern PDEP depAdd(PDEPGLOBALS pThis, const char *pszFilename, size_t cchFilename); extern void depOptimize(PDEPGLOBALS pThis, int fFixCase, int fQuiet, const char *pszIgnoredExt); extern int depNeedsEscaping(const char *pszFile, size_t cchFile, int fDependency); extern void depEscapedWrite(FILE *pOutput, const char *pszFile, size_t cchFile, int fDepenency); extern void depPrintChain(PDEPGLOBALS pThis, FILE *pOutput); extern void depPrintTargetWithDeps(PDEPGLOBALS pThis, FILE *pOutput, const char *pszTarget, int fEscapeTarget); extern void depPrintStubs(PDEPGLOBALS pThis, FILE *pOutput); extern void *depReadFileIntoMemory(FILE *pInput, size_t *pcbFile, void **ppvOpaque); extern void depFreeFileMemory(void *pvFile, void *pvOpaque); #ifdef ___k_kTypes_h___ extern void depHexDump(const KU8 *pb, size_t cb, size_t offBase); #endif #endif kbuild-3608/src/lib/restartable-syscall-wrappers.c0000664000175000017500000002073114670377415022251 0ustar locutuslocutus/* $Id: restartable-syscall-wrappers.c 2851 2016-08-31 17:30:52Z bird $ */ /** @file * restartable-syscall-wrappers.c - Workaround for annoying S11 "features". * * The symptoms are that open or mkdir occationally fails with EINTR when * receiving SIGCHLD at the wrong time. With a enough cores, this start * happening on a regular basis. * * The workaround here is to create our own wrappers for these syscalls which * will restart the syscall when appropriate. This depends on the libc * providing alternative names for the syscall entry points. */ /* * Copyright (c) 2011-2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #ifdef KBUILD_OS_SOLARIS # include /* Try drag in feature_tests.h. */ # include # undef _RESTRICT_KYWD # define _RESTRICT_KYWD # undef __PRAGMA_REDEFINE_EXTNAME #endif #include #include #include #include #include #include #include #include /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** Mangle a syscall name to it's weak alias. */ #ifdef KBUILD_OS_SOLARIS # define WRAP(a_name) _##a_name #elif defined(KBUILD_OS_LINUX) # define WRAP(a_name) __##a_name #else # error "Port Me" #endif /** Mangle a syscall name with optional '64' suffix. */ #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 # define WRAP64(a_name) WRAP(a_name)##64 #else # define WRAP64(a_name) WRAP(a_name) #endif /** Check whether errno indicates restart. */ #ifdef ERESTART # define SHOULD_RESTART() (errno == EINTR || errno == ERESTART) #else # define SHOULD_RESTART() (errno == EINTR) #endif /** Used by XSTR. */ #define XSTR_INNER(x) #x /** Returns the expanded argument as a string. */ #define XSTR(x) XSTR_INNER(x) static int dlsym_libc(const char *pszSymbol, void **ppvSym) { static void *s_pvLibc = NULL; void *pvLibc; void *pvSym; /* * Use the RTLD_NEXT dl feature if present, it's designed for doing * exactly what we want here. */ #ifdef RTLD_NEXT pvSym = dlsym(RTLD_NEXT, pszSymbol); if (pvSym) { *ppvSym = pvSym; return 0; } #endif /* * Open libc. */ pvLibc = s_pvLibc; if (!pvLibc) { #ifdef RTLD_NOLOAD unsigned fFlags = RTLD_NOLOAD | RTLD_NOW; #else unsigned fFlags = RTLD_GLOBAL | RTLD_NOW; #endif #ifdef KBUILD_OS_LINUX pvLibc = dlopen("/lib/libc.so.6", fFlags); #else pvLibc = dlopen("/lib/libc.so", fFlags); #endif if (!pvLibc) { fprintf(stderr, "restartable-syscall-wrappers: failed to dlopen libc for resolving %s: %s\n", pszSymbol, dlerror()); errno = ENOSYS; return -1; } /** @todo check standard symbol? */ } /* * Resolve the symbol. */ pvSym = dlsym(pvLibc, pszSymbol); if (!pvSym) { fprintf(stderr, "restartable-syscall-wrappers: failed to resolve %s: %s\n", pszSymbol, dlerror()); errno = ENOSYS; return -1; } *ppvSym = pvSym; return 0; } #undef open int open(const char *pszPath, int fFlags, ...) { mode_t fMode; va_list va; int fd; static union { int (* pfnReal)(const char *, int, ...); void *pvSym; } s_u; if ( !s_u.pfnReal && dlsym_libc("open", &s_u.pvSym) != 0) return -1; va_start(va, fFlags); fMode = va_arg(va, mode_t); va_end(va); do fd = s_u.pfnReal(pszPath, fFlags, fMode); while (fd == -1 && SHOULD_RESTART()); return fd; } #undef open64 int open64(const char *pszPath, int fFlags, ...) { mode_t fMode; va_list va; int fd; static union { int (* pfnReal)(const char *, int, ...); void *pvSym; } s_u; if ( !s_u.pfnReal && dlsym_libc("open64", &s_u.pvSym) != 0) return -1; va_start(va, fFlags); fMode = va_arg(va, mode_t); va_end(va); do fd = s_u.pfnReal(pszPath, fFlags, fMode); while (fd == -1 && SHOULD_RESTART()); return fd; } #define WRAP_FN(a_Name, a_ParamsWithTypes, a_ParamsNoType, a_RetType, a_RetFailed) \ a_RetType a_Name a_ParamsWithTypes \ { \ static union \ { \ a_RetType (* pfnReal) a_ParamsWithTypes; \ void *pvSym; \ } s_u; \ a_RetType rc; \ \ if ( !s_u.pfnReal \ && dlsym_libc(#a_Name, &s_u.pvSym) != 0) \ return a_RetFailed; \ \ do \ rc = s_u.pfnReal a_ParamsNoType; \ while (rc == a_RetFailed && SHOULD_RESTART()); \ return rc; \ } typedef int ignore_semi_colon_##a_Name #undef mkdir WRAP_FN(mkdir, (const char *pszPath, mode_t fMode), (pszPath, fMode), int, -1); #undef rmdir WRAP_FN(rmdir, (const char *pszPath, mode_t fMode), (pszPath, fMode), int, -1); #undef unlink WRAP_FN(unlink, (const char *pszPath), (pszPath), int, -1); #undef remove WRAP_FN(remove, (const char *pszPath), (pszPath), int, -1); #undef symlink WRAP_FN(symlink, (const char *pszFrom, const char *pszTo), (pszFrom, pszTo), int, -1); #undef link WRAP_FN(link, (const char *pszFrom, const char *pszTo), (pszFrom, pszTo), int, -1); #undef stat WRAP_FN(stat, (const char *pszPath, struct stat *pStBuf), (pszPath, pStBuf), int, -1); #undef lstat WRAP_FN(lstat, (const char *pszPath, struct stat *pStBuf), (pszPath, pStBuf), int, -1); #undef stat64 WRAP_FN(stat64, (const char *pszPath, struct stat64 *pStBuf), (pszPath, pStBuf), int, -1); #undef lstat64 WRAP_FN(lstat64, (const char *pszPath, struct stat64 *pStBuf), (pszPath, pStBuf), int, -1); #undef read WRAP_FN(read, (int fd, void *pvBuf, size_t cbBuf), (fd, pvBuf, cbBuf), ssize_t, -1); #undef write WRAP_FN(write, (int fd, void *pvBuf, size_t cbBuf), (fd, pvBuf, cbBuf), ssize_t, -1); #undef fopen WRAP_FN(fopen, (const char *pszPath, const char *pszMode), (pszPath, pszMode), FILE *, NULL); #undef fopen64 WRAP_FN(fopen64, (const char *pszPath, const char *pszMode), (pszPath, pszMode), FILE *, NULL); #undef chmod WRAP_FN(chmod, (const char *pszPath, mode_t fMode), (pszPath, fMode), int, -1); #undef lchmod WRAP_FN(lchmod, (const char *pszPath, mode_t fMode), (pszPath, fMode), int, -1); #undef chown WRAP_FN(chown, (const char *pszPath, uid_t uid, gid_t gid), (pszPath, uid, gid), int, -1); #undef lchown WRAP_FN(lchown, (const char *pszPath, uid_t uid, gid_t gid), (pszPath, uid, gid), int, -1); #undef utime WRAP_FN(utime, (const char *pszPath, const struct utimbuf *pTimes), (pszPath, pTimes), int, -1); #undef utimes WRAP_FN(utimes, (const char *pszPath, const struct timeval *paTimes), (pszPath, paTimes), int, -1); #undef pathconf WRAP_FN(pathconf, (const char *pszPath, int iCfgNm), (pszPath, iCfgNm), long, -1); #undef readlink WRAP_FN(readlink, (const char *pszPath, char *pszBuf, size_t cbBuf), (pszPath, pszBuf, cbBuf), ssize_t, -1); kbuild-3608/src/lib/quote_argv.h0000664000175000017500000000311114670377415016602 0ustar locutuslocutus/* $Id: quote_argv.h 2912 2016-09-14 13:36:15Z bird $ */ /** @file * quote_argv - Correctly quote argv for spawn, windows specific. */ /* * Copyright (c) 2007-2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___quote_argv_h___ #define ___quote_argv_h___ #include "mytypes.h" extern int quote_argv(int argc, char **argv, int fWatcomBrainDamage, int fFreeOrLeak); #endif kbuild-3608/src/lib/crc32.h0000664000175000017500000000017014670377415015344 0ustar locutuslocutus#ifndef ___crc32_h__ #define ___crc32_h__ #include "mytypes.h" uint32_t crc32(uint32_t, const void *, size_t); #endif kbuild-3608/src/lib/startuphacks-win.c0000664000175000017500000001434214670377415017740 0ustar locutuslocutus/* $Id: startuphacks-win.c 2413 2010-09-11 17:43:04Z bird $ */ /** @file * kBuild - Alternative argument parser for the windows startup code. * * @todo Update license when SED is updated. */ /* * Copyright (c) 2006-2010 knut st. osmundsen * * parse_args(): Copyright (c) 1992-1998 by Eberhard Mattes * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include /******************************************************************************* * Internal Functions * *******************************************************************************/ static int parse_args(const char *pszSrc, char **argv, char *pchPool); /******************************************************************************* * Global Variables * *******************************************************************************/ /** argument count found by parse_args(). */ static int g_cArgs = 0; /** the argument vector, for __getmainargs(). */ static char **g_papszArgs = NULL; int __cdecl _setargv(void) { static char s_szProgramName[MAX_PATH + 1]; const char *pszCmdLine; char *pszCmdLineBuf; int cb; /* * Set the program name. */ GetModuleFileName(NULL, s_szProgramName, MAX_PATH); s_szProgramName[MAX_PATH] = '\0'; #if _MSC_VER >= 1400 && !defined(CRTDLL) && !defined(_DLL) _set_pgmptr(s_szProgramName); #endif /* * Get the commandline, use the program name if nothings available. */ pszCmdLine = (const char *)GetCommandLineA(); if (!pszCmdLine || !*pszCmdLine) pszCmdLine = s_szProgramName; /* * Parse the argument commandline emitting the unix argument vector. */ cb = parse_args(pszCmdLine, NULL, NULL); g_papszArgs = malloc(sizeof(*g_papszArgs) * (g_cArgs + 2)); if (!g_papszArgs) return -1; pszCmdLineBuf = malloc(cb); if (!pszCmdLineBuf) return -1; parse_args(pszCmdLine, g_papszArgs, pszCmdLineBuf); g_papszArgs[g_cArgs] = g_papszArgs[g_cArgs + 1] = NULL; /* set return variables */ __argc = g_cArgs; __argv = g_papszArgs; return 0; } /* when linking with the crtexe.c, the __getmainargs() call will redo the _setargv job inside the msvc*.dll. */ int __cdecl __getmainargs(int *pargc, char ***pargv, char ***penvp, int dowildcard, /*_startupinfo*/ void *startinfo) { __argc = *pargc = g_cArgs; __argv = *pargv = g_papszArgs; *penvp = _environ; return 0; } #if defined(_M_IX86) int (__cdecl * _imp____getmainargs)(int *, char ***, char ***, int, /*_startupinfo*/ void *) = __getmainargs; #else int (__cdecl * __imp___getmainargs)(int *, char ***, char ***, int, /*_startupinfo*/ void *) = __getmainargs; #endif /** * Parses the argument string passed in as pszSrc. * * @returns size of the processed arguments. * @param pszSrc Pointer to the commandline that's to be parsed. * @param argv Pointer to argument vector to put argument pointers in. NULL allowed. * @param pchPool Pointer to memory pchPool to put the arguments into. NULL allowed. */ static int parse_args(const char *pszSrc, char **argv, char *pchPool) { int bs; char chQuote; char *pfFlags; int cbArgs; #define PUTC(c) do { ++cbArgs; if (pchPool != NULL) *pchPool++ = (c); } while (0) #define PUTV do { ++g_cArgs; if (argv != NULL) *argv++ = pchPool; } while (0) #define WHITE(c) ((c) == ' ' || (c) == '\t') #define _ARG_DQUOTE 0x01 /* Argument quoted (") */ #define _ARG_RESPONSE 0x02 /* Argument read from response file */ #define _ARG_WILDCARD 0x04 /* Argument expanded from wildcard */ #define _ARG_ENV 0x08 /* Argument from environment */ #define _ARG_NONZERO 0x80 /* Always set, to avoid end of string */ g_cArgs = 0; cbArgs = 0; #if 0 /* argv[0] */ PUTC((char)_ARG_NONZERO); PUTV; for (;;) { PUTC(*pszSrc); if (*pszSrc == 0) break; ++pszSrc; } ++pszSrc; #endif for (;;) { while (WHITE(*pszSrc)) ++pszSrc; if (*pszSrc == 0) break; pfFlags = pchPool; PUTC((char)_ARG_NONZERO); PUTV; bs = 0; chQuote = 0; for (;;) { if (!chQuote ? (*pszSrc == '"' || *pszSrc == '\'') : *pszSrc == chQuote) { while (bs >= 2) { PUTC('\\'); bs -= 2; } if (bs & 1) PUTC(*pszSrc); else { chQuote = chQuote ? 0 : *pszSrc; if (pfFlags != NULL) *pfFlags |= _ARG_DQUOTE; } bs = 0; } else if (*pszSrc == '\\') ++bs; else { while (bs != 0) { PUTC('\\'); --bs; } if (*pszSrc == 0 || (WHITE(*pszSrc) && !chQuote)) break; PUTC(*pszSrc); } ++pszSrc; } PUTC(0); } return cbArgs; } kbuild-3608/src/lib/maybe_con_fwrite.c0000664000175000017500000001147114670377415017745 0ustar locutuslocutus/* $Id: maybe_con_fwrite.c 3547 2022-01-29 02:39:47Z bird $ */ /** @file * maybe_con_write - Optimized console output on windows. */ /* * Copyright (c) 2016-2018 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include "console.h" #ifdef KBUILD_OS_WINDOWS # include #endif #include #ifdef _MSC_VER # include #endif /** * Drop-in fwrite replacement for optimizing console output on windows. * * * @returns Units written; 0 & errno on failure. * @param pvBuf What to write. * @param cbUnit How much to write in each unit. * @param cUnits How many units to write. * @param pFile The file to write to. */ size_t maybe_con_fwrite(void const *pvBuf, size_t cbUnit, size_t cUnits, FILE *pFile) { #ifdef KBUILD_OS_WINDOWS /* * If it's a TTY, do our own conversion to wide char and call _cputws. */ if ( cbUnit > 0 && cUnits > 0 && cbUnit < (unsigned)INT_MAX / 4 && cUnits < (unsigned)INT_MAX / 4 && (pFile == stdout || pFile == stderr)) { int fd = fileno(pFile); if (fd >= 0) { HANDLE hCon = (HANDLE)_get_osfhandle(fd); if ( hCon != INVALID_HANDLE_VALUE && hCon != NULL) { if (is_console_handle((intptr_t)hCon)) { /* Use a stack buffer if we can, falling back on the heap for larger writes: */ wchar_t awcBuf[1024]; wchar_t *pawcBuf; wchar_t *pawcBufFree = NULL; size_t cbToWrite = cbUnit * cUnits; size_t cwcBuf = cbToWrite * 2 + 16; if (cwcBuf < sizeof(awcBuf) / sizeof(awcBuf[0])) { pawcBuf = awcBuf; cwcBuf = sizeof(awcBuf) / sizeof(awcBuf[0]); } else pawcBufFree = pawcBuf = (wchar_t *)malloc(cwcBuf * sizeof(wchar_t)); if (pawcBuf) { int cwcToWrite = MultiByteToWideChar(get_crt_codepage(), 0 /*dwFlags*/, pvBuf, (int)cbToWrite, pawcBuf, (int)(cwcBuf - 1)); if (cwcToWrite > 0) { int rc; pawcBuf[cwcToWrite] = '\0'; /* Let the CRT do the rest. At least the Visual C++ 2010 CRT sources indicates _cputws will do the right thing. */ fflush(pFile); rc = _cputws(pawcBuf); if (pawcBufFree) free(pawcBufFree); if (rc >= 0) return cUnits; return 0; } free(pawcBufFree); } } } } } #endif /* * Semi regular write handling. */ return fwrite(pvBuf, cbUnit, cUnits, pFile); } kbuild-3608/src/lib/nt_fullpath_cached.c0000664000175000017500000001226214670377415020237 0ustar locutuslocutus/* $Id: nt_fullpath_cached.c 2849 2016-08-30 14:28:46Z bird $ */ /** @file * fixcase - fixes the case of paths, windows specific. */ /* * Copyright (c) 2004-2010 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include #include #include #include #include #include "nt_fullpath.h" /********************************************************************************************************************************* * Structures and Typedefs * *********************************************************************************************************************************/ typedef struct NTFULLPATHENTRY { /** Pointer to the next entry with the same hash table index. */ struct NTFULLPATHENTRY *pNext; /** The input hash. */ unsigned uHash; /** The input length. */ unsigned cchInput; /** Length of the result. */ unsigned cchResult; /** The result string (stored immediately after this structure). */ const char *pszResult; /** The input string (variable length). */ char szInput[1]; } NTFULLPATHENTRY; typedef NTFULLPATHENTRY *PNTFULLPATHENTRY; /********************************************************************************************************************************* * Global Variables * *********************************************************************************************************************************/ /** Number of result in the nt_fullpath cache. */ size_t g_cNtFullPathHashEntries = 0; /** Number of bytes used for nt_fullpath cache result entries. */ size_t g_cbNtFullPathHashEntries = 0; /** Number of hash table collsioins in the nt_fullpath cache. */ size_t g_cNtFullPathHashCollisions = 0; /** Hash table. */ PNTFULLPATHENTRY g_apNtFullPathHashTab[16381]; /** * A nt_fullpath frontend which caches the result of previous calls. */ void nt_fullpath_cached(const char *pszPath, char *pszFull, size_t cchFull) { PNTFULLPATHENTRY pEntry; unsigned cchInput; unsigned idx; unsigned cchResult; /* We use the sdbm hash algorithm here (see kDep.c for full details). */ unsigned const char *puch = (unsigned const char *)pszPath; unsigned uHash = 0; unsigned uChar; while ((uChar = *puch++) != 0) uHash = uChar + (uHash << 6) + (uHash << 16) - uHash; cchInput = (unsigned)((uintptr_t)&puch[-1] - (uintptr_t)pszPath); /* Do the cache lookup. */ idx = uHash % (sizeof(g_apNtFullPathHashTab) / sizeof(g_apNtFullPathHashTab[0])); for (pEntry = g_apNtFullPathHashTab[idx]; pEntry != NULL; pEntry = pEntry->pNext) if ( pEntry->uHash == uHash && pEntry->cchInput == cchInput && memcmp(pEntry->szInput, pszPath, cchInput) == 0) { if (cchFull > pEntry->cchResult) memcpy(pszFull, pEntry->pszResult, pEntry->cchResult + 1); else { assert(0); memcpy(pszFull, pEntry->pszResult, cchFull); pszFull[cchFull - 1] = '\0'; } return; } /* Make the call... */ nt_fullpath(pszPath, pszFull, cchFull); /* ... and cache the result. */ cchResult = (unsigned)strlen(pszFull); pEntry = malloc(sizeof(*pEntry) + cchInput + cchResult + 1); if (pEntry) { g_cbNtFullPathHashEntries += sizeof(*pEntry) + cchInput + cchResult + 1; pEntry->cchInput = cchInput; pEntry->cchResult = cchResult; pEntry->pszResult = &pEntry->szInput[cchInput + 1]; pEntry->uHash = uHash; memcpy(pEntry->szInput, pszPath, cchInput + 1); memcpy((char *)pEntry->pszResult, pszFull, cchResult + 1); pEntry->pNext = g_apNtFullPathHashTab[idx]; if (pEntry->pNext) g_cNtFullPathHashCollisions++; g_apNtFullPathHashTab[idx] = pEntry; g_cNtFullPathHashEntries++; } } kbuild-3608/src/lib/console.h0000664000175000017500000000364314670377415016102 0ustar locutuslocutus/* $Id: console.h 3547 2022-01-29 02:39:47Z bird $ */ /** @file * console related functions. */ /* * Copyright (c) 2016-2018 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___lib_console_h___ #define ___lib_console_h___ #include #ifdef _MSC_VER # include # ifndef ssize_t typedef intptr_t ssize_t; # endif #else # include #endif #ifdef KBUILD_OS_WINDOWS # include "get_codepage.h" #endif #ifdef KBUILD_OS_WINDOWS extern int is_console_handle(intptr_t hHandle); #endif extern int is_console(int fd); extern ssize_t maybe_con_write(int fd, void const *pvBuf, size_t cbToWrite); extern size_t maybe_con_fwrite(void const *pvBuf, size_t cbUnit, size_t cUnits, FILE *pFile); #endif kbuild-3608/src/lib/wrapper.c0000664000175000017500000000657714670377415016124 0ustar locutuslocutus/* $Id: wrapper.c 2851 2016-08-31 17:30:52Z bird $ */ /** @file * Wrapper program for various debugging purposes. */ /* * Copyright (c) 2007-2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include #ifdef _MSC_VER # include #else # include #endif int main(int argc, char **argv, char **envp) { const char *pszLogTo = getenv("WRAPPER_LOGTO"); const char *pszLogFileArgs = getenv("WRAPPER_LOGFILEARGS"); const char *pszLogEnv = getenv("WRAPPER_LOGENV"); const char *pszExec = getenv("WRAPPER_EXEC"); const char *pszSigSegv = getenv("WRAPPER_SIGSEGV"); const char *pszRetVal = getenv("WRAPPER_RETVAL"); int i; if (pszLogTo) { FILE *pLog = fopen(pszLogTo, "a"); if (pLog) { fprintf(pLog, "+++ %s pid=%ld +++\n", argv[0], (long)getpid()); for (i = 1; i < argc; i++) { fprintf(pLog, "argv[%d]: '%s'\n", i, argv[i]); if (pszLogFileArgs) { FILE *pArg = fopen(argv[i], "r"); if (pArg) { int iLine = 0; static char szLine[64*1024]; while (fgets(szLine, sizeof(szLine), pArg) && iLine++ < 42) fprintf(pLog, "%2d: %s", iLine, szLine); fclose(pArg); } } } if (pszLogEnv) for (i = 0; envp[i]; i++) fprintf(pLog, "envp[%d]: '%s'\n", i, envp[i]); fprintf(pLog, "--- %s pid=%ld ---\n", argv[0], (long)getpid()); fclose(pLog); } } if (pszSigSegv) { char *pchIllegal = (char *)1; pchIllegal[0] = '\0'; } if (pszExec) { /** @todo */ } return pszRetVal ? atol(pszRetVal) : 1; } kbuild-3608/src/lib/nt_fullpath.c0000664000175000017500000004521114670377415016750 0ustar locutuslocutus/* $Id: nt_fullpath.c 3174 2018-03-21 21:37:52Z bird $ */ /** @file * fixcase - fixes the case of paths, windows specific. */ /* * Copyright (c) 2004-2010 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include #include #include #include #include "nt_fullpath.h" /* * Corrects the case of a path. * Expects a fullpath! * Added by bird for the $(abspath ) function and w32ify */ static void w32_fixcase(char *pszPath) { #if 0 /* no mp safe */ static char s_szLast[260]; size_t cchLast; #endif #ifndef NDEBUG # define my_assert(expr) \ do { \ if (!(expr)) { \ printf("my_assert: %s, file %s, line %d\npszPath=%s\npsz=%s\n", \ #expr, __FILE__, __LINE__, pszPath, psz); \ __debugbreak(); \ exit(1); \ } \ } while (0) #else # define my_assert(expr) do {} while (0) #endif char *psz = pszPath; if (*psz == '/' || *psz == '\\') { if (psz[1] == '/' || psz[1] == '\\') { /* UNC */ my_assert(psz[1] == '/' || psz[1] == '\\'); my_assert(psz[2] != '/' && psz[2] != '\\'); /* skip server name */ psz += 2; while (*psz != '\\' && *psz != '/') { if (!*psz) return; *psz++ = toupper(*psz); } /* skip the share name */ psz++; my_assert(*psz != '/' && *psz != '\\'); while (*psz != '\\' && *psz != '/') { if (!*psz) return; *psz++ = toupper(*psz); } my_assert(*psz == '/' || *psz == '\\'); psz++; } else { /* Unix spec */ psz++; } } else { /* Drive letter */ my_assert(psz[1] == ':'); *psz = toupper(*psz); my_assert(psz[0] >= 'A' && psz[0] <= 'Z'); my_assert(psz[2] == '/' || psz[2] == '\\'); psz += 3; } #if 0 /* not mp safe */ /* * Try make use of the result from the previous call. * This is ignorant to slashes and similar, but may help even so. */ if ( s_szLast[0] == pszPath[0] && (psz - pszPath == 1 || s_szLast[1] == pszPath[1]) && (psz - pszPath <= 2 || s_szLast[2] == pszPath[2]) ) { char *pszLast = &s_szLast[psz - pszPath]; char *pszCur = psz; char *pszSrc0 = pszLast; char *pszDst0 = pszCur; for (;;) { const char ch1 = *pszCur; const char ch2 = *pszLast; if ( ch1 != ch2 && (ch1 != '\\' || ch2 != '/') && (ch1 != '/' || ch2 != '\\') && tolower(ch1) != tolower(ch2) && toupper(ch1) != toupper(ch2)) break; if (ch1 == '/' || ch1 == '\\') { psz = pszCur + 1; *pszLast = ch1; /* preserve the slashes */ } else if (ch1 == '\0') { psz = pszCur; break; } pszCur++; pszLast++; } if (psz != pszDst0) memcpy(pszDst0, pszSrc0, psz - pszDst0); } #endif /* * Pointing to the first char after the unc or drive specifier, * or in case of a cache hit, the first non-matching char (following a slash of course). */ while (*psz) { WIN32_FIND_DATA FindFileData; HANDLE hDir; char chSaved0; char chSaved1; char *pszEnd; int iLongNameDiff; size_t cch; /* find the end of the component. */ pszEnd = psz; while (*pszEnd && *pszEnd != '/' && *pszEnd != '\\') pszEnd++; cch = pszEnd - psz; /* replace the end with "?\0" */ chSaved0 = pszEnd[0]; chSaved1 = pszEnd[1]; pszEnd[0] = '?'; pszEnd[1] = '\0'; /* find the right filename. */ hDir = FindFirstFile(pszPath, &FindFileData); pszEnd[1] = chSaved1; if (!hDir) { #if 0 /* not MP safe */ cchLast = psz - pszPath; memcpy(s_szLast, pszPath, cchLast + 1); s_szLast[cchLast + 1] = '\0'; #endif pszEnd[0] = chSaved0; return; } pszEnd[0] = '\0'; while ( (iLongNameDiff = stricmp(FindFileData.cFileName, psz)) && stricmp(FindFileData.cAlternateFileName, psz)) { if (!FindNextFile(hDir, &FindFileData)) { #if 0 /* not MP safe */ cchLast = psz - pszPath; memcpy(s_szLast, pszPath, cchLast + 1); s_szLast[cchLast + 1] = '\0'; #endif pszEnd[0] = chSaved0; return; } } pszEnd[0] = chSaved0; if ( iLongNameDiff /* matched the short name */ || !FindFileData.cAlternateFileName[0] /* no short name */ || !memchr(psz, ' ', cch)) /* no spaces in the matching name */ memcpy(psz, !iLongNameDiff ? FindFileData.cFileName : FindFileData.cAlternateFileName, cch); else { /* replace spacy name with the short name. */ const size_t cchAlt = strlen(FindFileData.cAlternateFileName); const size_t cchDelta = cch - cchAlt; my_assert(cchAlt > 0); if (!cchDelta) memcpy(psz, FindFileData.cAlternateFileName, cch); else { size_t cbLeft = strlen(pszEnd) + 1; if ((psz - pszPath) + cbLeft + cchAlt <= _MAX_PATH) { memmove(psz + cchAlt, pszEnd, cbLeft); pszEnd -= cchDelta; memcpy(psz, FindFileData.cAlternateFileName, cchAlt); } else fprintf(stderr, "kBuild: case & space fixed filename is growing too long (%d bytes)! '%s'\n", (psz - pszPath) + cbLeft + cchAlt, pszPath); } } my_assert(pszEnd[0] == chSaved0); FindClose(hDir); /* advance to the next component */ if (!chSaved0) { psz = pszEnd; break; } psz = pszEnd + 1; my_assert(*psz != '/' && *psz != '\\'); } #if 0 /* not MP safe */ /* *psz == '\0', the end. */ cchLast = psz - pszPath; memcpy(s_szLast, pszPath, cchLast + 1); #endif #undef my_assert } #define MY_FileNameInformation 9 typedef struct _MY_FILE_NAME_INFORMATION { ULONG FileNameLength; WCHAR FileName[1]; } MY_FILE_NAME_INFORMATION, *PMY_FILE_NAME_INFORMATION; #define MY_FileInternalInformation 6 typedef struct _MY_FILE_INTERNAL_INFORMATION { LARGE_INTEGER IndexNumber; } MY_FILE_INTERNAL_INFORMATION, *PMY_FILE_INTERNAL_INFORMATION; #define MY_FileFsVolumeInformation 1 typedef struct _MY_FILE_FS_VOLUME_INFORMATION { LARGE_INTEGER VolumeCreationTime; ULONG VolumeSerialNumber; ULONG VolumeLabelLength; BOOLEAN SupportsObjects; WCHAR VolumeLabel[/*1*/128]; } MY_FILE_FS_VOLUME_INFORMATION, *PMY_FILE_FS_VOLUME_INFORMATION; #define MY_FileFsAttributeInformation 5 typedef struct _MY_FILE_FS_ATTRIBUTE_INFORMATION { ULONG FileSystemAttributes; LONG MaximumComponentNameLength; ULONG FileSystemNameLength; WCHAR FileSystemName[/*1*/64]; } MY_FILE_FS_ATTRIBUTE_INFORMATION, *PMY_FILE_FS_ATTRIBUTE_INFORMATION; #define MY_FileFsDeviceInformation 4 typedef struct MY_FILE_FS_DEVICE_INFORMATION { ULONG DeviceType; ULONG Characteristics; } MY_FILE_FS_DEVICE_INFORMATION, *PMY_FILE_FS_DEVICE_INFORMATION; #define MY_FILE_DEVICE_DISK 7 #define MY_FILE_DEVICE_DISK_FILE_SYSTEM 8 #define MY_FILE_DEVICE_FILE_SYSTEM 9 #define MY_FILE_DEVICE_VIRTUAL_DISK 36 typedef struct { union { LONG Status; PVOID Pointer; }; ULONG_PTR Information; } MY_IO_STATUS_BLOCK, *PMY_IO_STATUS_BLOCK; static BOOL g_fInitialized = FALSE; static int g_afNtfsDrives['Z' - 'A' + 1]; static MY_FILE_FS_VOLUME_INFORMATION g_aVolumeInfo['Z' - 'A' + 1]; static LONG (NTAPI *g_pfnNtQueryInformationFile)(HANDLE FileHandle, PMY_IO_STATUS_BLOCK IoStatusBlock, PVOID FileInformation, ULONG Length, ULONG FileInformationClass); static LONG (NTAPI *g_pfnNtQueryVolumeInformationFile)(HANDLE FileHandle, PMY_IO_STATUS_BLOCK IoStatusBlock, PVOID FsInformation, ULONG Length, ULONG FsInformationClass); int nt_get_filename_info(const char *pszPath, char *pszFull, size_t cchFull) { char abBuf[8192]; PMY_FILE_NAME_INFORMATION pFileNameInfo = (PMY_FILE_NAME_INFORMATION)abBuf; PMY_FILE_FS_VOLUME_INFORMATION pFsVolInfo = (PMY_FILE_FS_VOLUME_INFORMATION)abBuf; MY_IO_STATUS_BLOCK Ios; LONG rcNt; HANDLE hFile; int cchOut; char *psz; int iDrv; int rc; /* * Check for NtQueryInformationFile the first time around. */ if (!g_fInitialized) { g_fInitialized = TRUE; if (!getenv("KMK_DONT_USE_NT_QUERY_INFORMATION_FILE")) { *(FARPROC *)&g_pfnNtQueryInformationFile = GetProcAddress(LoadLibrary("ntdll.dll"), "NtQueryInformationFile"); *(FARPROC *)&g_pfnNtQueryVolumeInformationFile = GetProcAddress(LoadLibrary("ntdll.dll"), "NtQueryVolumeInformationFile"); } if ( g_pfnNtQueryInformationFile && g_pfnNtQueryVolumeInformationFile) { unsigned i; for (i = 0; i < sizeof(g_afNtfsDrives) / sizeof(g_afNtfsDrives[0]); i++ ) g_afNtfsDrives[i] = -1; } else { g_pfnNtQueryVolumeInformationFile = NULL; g_pfnNtQueryInformationFile = NULL; } } if (!g_pfnNtQueryInformationFile) return -1; /* * The FileNameInformation we get is relative to where the volume is mounted, * so we have to extract the driveletter prefix ourselves. * * FIXME: This will probably not work for volumes mounted in NTFS sub-directories. */ psz = pszFull; if (pszPath[0] == '\\' || pszPath[0] == '/') { /* unc or root of volume */ if ( (pszPath[1] == '\\' || pszPath[1] == '/') && (pszPath[2] != '\\' || pszPath[2] == '/')) { #if 0 /* don't bother with unc yet. */ /* unc - we get the server + name back */ *psz++ = '\\'; #endif return -1; } /* root slash */ *psz++ = _getdrive() + 'A' - 1; *psz++ = ':'; } else if (pszPath[1] == ':' && isalpha(pszPath[0])) { /* drive letter */ *psz++ = toupper(pszPath[0]); *psz++ = ':'; } else { /* relative */ *psz++ = _getdrive() + 'A' - 1; *psz++ = ':'; } iDrv = *pszFull - 'A'; /* * Fat32 doesn't return filenames with the correct case, so restrict it * to NTFS volumes for now. */ if (g_afNtfsDrives[iDrv] == -1) { /* FSCTL_GET_REPARSE_POINT? Enumerate mount points? */ g_afNtfsDrives[iDrv] = 0; psz[0] = '\\'; psz[1] = '\0'; #if 1 hFile = CreateFile(pszFull, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if (hFile != INVALID_HANDLE_VALUE) { PMY_FILE_FS_ATTRIBUTE_INFORMATION pFsAttrInfo = (PMY_FILE_FS_ATTRIBUTE_INFORMATION)abBuf; memset(&Ios, 0, sizeof(Ios)); rcNt = g_pfnNtQueryVolumeInformationFile(hFile, &Ios, abBuf, sizeof(abBuf), MY_FileFsAttributeInformation); if ( rcNt >= 0 //&& pFsAttrInfo->FileSystemNameLength == 4 && pFsAttrInfo->FileSystemName[0] == 'N' && pFsAttrInfo->FileSystemName[1] == 'T' && pFsAttrInfo->FileSystemName[2] == 'F' && pFsAttrInfo->FileSystemName[3] == 'S' && pFsAttrInfo->FileSystemName[4] == '\0') { memset(&Ios, 0, sizeof(Ios)); rcNt = g_pfnNtQueryVolumeInformationFile(hFile, &Ios, &g_aVolumeInfo[iDrv], sizeof(MY_FILE_FS_VOLUME_INFORMATION), MY_FileFsVolumeInformation); if (rcNt >= 0) { DWORD dwDriveType = GetDriveType(pszFull); if ( dwDriveType == DRIVE_FIXED || dwDriveType == DRIVE_RAMDISK) g_afNtfsDrives[iDrv] = 1; } } CloseHandle(hFile); } #else { char szFSName[32]; if ( GetVolumeInformation(pszFull, NULL, 0, /* volume name */ NULL, /* serial number */ NULL, /* max component */ NULL, /* volume attribs */ szFSName, sizeof(szFSName)) && !strcmp(szFSName, "NTFS")) { g_afNtfsDrives[iDrv] = 1; } } #endif } if (!g_afNtfsDrives[iDrv]) return -1; /* * Try open the path and query its file name information. */ hFile = CreateFile(pszPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if (hFile != INVALID_HANDLE_VALUE) { /* check that the driver letter is correct first (reparse / symlink issues). */ memset(&Ios, 0, sizeof(Ios)); rcNt = g_pfnNtQueryVolumeInformationFile(hFile, &Ios, pFsVolInfo, sizeof(*pFsVolInfo), MY_FileFsVolumeInformation); if (rcNt >= 0) { /** @todo do a quick search and try correct the drive letter? */ if ( pFsVolInfo->VolumeCreationTime.QuadPart == g_aVolumeInfo[iDrv].VolumeCreationTime.QuadPart && pFsVolInfo->VolumeSerialNumber == g_aVolumeInfo[iDrv].VolumeSerialNumber) { memset(&Ios, 0, sizeof(Ios)); rcNt = g_pfnNtQueryInformationFile(hFile, &Ios, abBuf, sizeof(abBuf), MY_FileNameInformation); if (rcNt >= 0) { cchOut = WideCharToMultiByte(CP_ACP, 0, pFileNameInfo->FileName, pFileNameInfo->FileNameLength / sizeof(WCHAR), psz, (int)(cchFull - (psz - pszFull) - 2), NULL, NULL); if (cchOut > 0) { const char *pszEnd; #if 0 /* upper case the server and share */ if (fUnc) { for (psz++; *psz != '/' && *psz != '\\'; psz++) *psz = toupper(*psz); for (psz++; *psz != '/' && *psz != '\\'; psz++) *psz = toupper(*psz); } #endif /* add trailing slash on directories if input has it. */ pszEnd = strchr(pszPath, '\0'); if ( (pszEnd[-1] == '/' || pszEnd[-1] == '\\') && psz[cchOut - 1] != '\\' && psz[cchOut - 1] != '//') psz[cchOut++] = '\\'; /* make sure it's terminated */ psz[cchOut] = '\0'; rc = 0; } else rc = -3; } else rc = -4; } else rc = -5; } else rc = -6; CloseHandle(hFile); } else rc = -7; return rc; } /** * Somewhat similar to fullpath, except that it will fix * the case of existing path components. */ void nt_fullpath(const char *pszPath, char *pszFull, size_t cchFull) { #if 0 static int s_cHits = 0; static int s_cFallbacks = 0; #endif /* * The simple case, the file / dir / whatever exists and can be * queried without problems and spaces. */ if (nt_get_filename_info(pszPath, pszFull, cchFull) == 0) { /** @todo make nt_get_filename_info return spaceless path. */ if (strchr(pszFull, ' ')) w32_fixcase(pszFull); #if 0 fprintf(stdout, "nt #%d - %s\n", ++s_cHits, pszFull); fprintf(stdout, " #%d - %s\n", s_cHits, pszPath); #endif return; } if (g_pfnNtQueryInformationFile) { /* do _fullpath and drop off path elements until we get a hit... - later */ } /* * For now, simply fall back on the old method. */ _fullpath(pszFull, pszPath, cchFull); w32_fixcase(pszFull); #if 0 fprintf(stderr, "fb #%d - %s\n", ++s_cFallbacks, pszFull); fprintf(stderr, " #%d - %s\n", s_cFallbacks, pszPath); #endif } kbuild-3608/src/lib/test-eintr-bug-2.c0000664000175000017500000000722514670377415017443 0ustar locutuslocutus /******************************************************************************* * Header Files * *******************************************************************************/ #define _BSD_SOURCE #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include /******************************************************************************* * Global Variables * *******************************************************************************/ /** The number of signals. */ static volatile long g_cSigs = 0; /** Number of signals received on threads other than the main one. */ static volatile long g_cSigsOther = 0; /** Whether to shutdown or not. */ static volatile int g_fShutdown = 0; /** The handle of the main thread. */ static pthread_t g_hMainThread; static void SigHandler(int iSig) { g_cSigs++; if (pthread_self() != g_hMainThread) g_cSigsOther++; (void)iSig; } static void NanoSleep(unsigned long cNanoSecs) { struct timespec Ts; Ts.tv_sec = 0; Ts.tv_nsec = cNanoSecs; nanosleep(&Ts, NULL); } static void *ThreadProc(void *pvIgnored) { int volatile i = 0; while (!g_fShutdown) { // NanoSleep(850); if (g_fShutdown) break; pthread_kill(g_hMainThread, SIGALRM); for (i = 6666; i > 0; i--) /* nothing */; } return NULL; } int main(int argc, char **argv) { void (*rcSig)(int); pthread_t hThread; char szName[1024]; int i; int rc; /* * Set up the signal handlers. */ rcSig = bsd_signal(SIGALRM, SigHandler); if (rcSig != SIG_ERR) rcSig = bsd_signal(SIGCHLD, SigHandler); if (rcSig == SIG_ERR) { fprintf(stderr, "bsd_signal failed: %s\n", strerror(errno)); return 1; } if (argc == 2) /* testing... */ { siginterrupt(SIGALRM, 1); siginterrupt(SIGCHLD, 1); } /* * Kick off a thread that will signal us like there was no tomorrow. */ g_hMainThread = pthread_self(); rc = pthread_create(&hThread, NULL, ThreadProc, NULL); if (rc != 0) { fprintf(stderr, "pthread_create failed: %s\n", strerror(rc)); return 1; } /* * Do path related stuff. */ snprintf(szName, sizeof(szName), "%s-test2", argv[0]); for (i = 0; i < 100*1000*1000; i++) { struct stat St; int fd; rc = stat(argv[0], &St); if (rc == 0 || errno != EINTR) rc = stat(szName, &St); if (errno == EINTR && rc != 0) { printf("iteration %d: stat: %u\n", i, errno); break; } fd = open(szName, O_CREAT | O_RDWR, 0666); if (errno == EINTR && fd < 0) { printf("iteration %d: open: %u\n", i, errno); break; } close(fd); rc = unlink(szName); if (errno == EINTR && rc != 0) { printf("iteration %d: unlink: %u\n", i, errno); break; } /* Show progress info */ if ((i % 100000) == 0) { printf("."); if ((i % 1000000) == 0) printf("[%d/%ld/%ld]\n", i, g_cSigs, g_cSigsOther); fflush(stdout); } } g_fShutdown = 1; if (rc) printf("No EINTR in %d iterations - system is working nicely!\n", i); NanoSleep(10000000); return rc ? 1 : 0; } kbuild-3608/src/lib/maybe_con_write.c0000664000175000017500000001146014670377415017575 0ustar locutuslocutus/* $Id: maybe_con_write.c 3547 2022-01-29 02:39:47Z bird $ */ /** @file * maybe_con_write - Optimized console output on windows. */ /* * Copyright (c) 2016-2018 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include "console.h" #ifdef KBUILD_OS_WINDOWS # include #endif #include #ifdef _MSC_VER # include typedef unsigned int to_write_t; #else typedef size_t to_write_t; #endif /** * Drop-in write replacement for optimizing console output on windows. * * @returns Number of bytes written, -1 + errno on failure. * @param fd The file descript to write to. * @param pvBuf What to write. * @param cbToWrite How much to write. */ ssize_t maybe_con_write(int fd, void const *pvBuf, size_t cbToWrite) { ssize_t cbWritten; #ifdef KBUILD_OS_WINDOWS /* * If it's a TTY, do our own conversion to wide char and * call WriteConsoleW directly. */ if (cbToWrite > 0 && cbToWrite < INT_MAX / 2) { HANDLE hCon = (HANDLE)_get_osfhandle(fd); if ( hCon != INVALID_HANDLE_VALUE && hCon != NULL) { if (is_console_handle((intptr_t)hCon)) { wchar_t awcBuf[1024]; wchar_t *pawcBuf; wchar_t *pawcBufFree = NULL; size_t cwcBuf = cbToWrite * 2 + 16; if (cwcBuf < sizeof(awcBuf) / sizeof(awcBuf[0])) { pawcBuf = awcBuf; cwcBuf = sizeof(awcBuf) / sizeof(awcBuf[0]); } else pawcBufFree = pawcBuf = (wchar_t *)malloc(cwcBuf * sizeof(wchar_t)); if (pawcBuf) { int cwcToWrite = MultiByteToWideChar(get_crt_codepage(), 0 /*dwFlags*/, pvBuf, (int)cbToWrite, pawcBuf, (int)(cwcBuf - 1)); if (cwcToWrite > 0) { int rc; pawcBuf[cwcToWrite] = '\0'; /* Let the CRT do the rest. At least the Visual C++ 2010 CRT sources indicates _cputws will do the right thing. */ rc = _cputws(pawcBuf); if (pawcBufFree) free(pawcBufFree); if (rc >= 0) return cbToWrite; return -1; } free(pawcBufFree); } } } } #endif /* * Semi regular write handling. */ cbWritten = write(fd, pvBuf, (to_write_t)cbToWrite); if (cbWritten == (ssize_t)cbToWrite) { /* likely */ } else if (cbWritten >= 0 || errno == EINTR) { if (cbWritten < 0) cbWritten = 0; while (cbWritten < (ssize_t)cbToWrite) { ssize_t cbThis = write(fd, (char *)pvBuf + cbWritten, (to_write_t)(cbToWrite - cbWritten)); if (cbThis >= 0) cbWritten += cbThis; else if (errno != EINTR) return -1; } } return cbWritten; } kbuild-3608/src/lib/crc32.c0000664000175000017500000001460714670377415015351 0ustar locutuslocutus/* $NetBSD: crc.c,v 1.18 2006/09/04 20:01:10 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * James W. Williams of NASA Goddard Space Flight Center. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /*#if HAVE_NBTOOL_CONFIG_H #include "nbtool_config.h" #endif*/ /*#include #if defined(__RCSID) && !defined(lint) #if 0 static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93"; #else __RCSID("$NetBSD: crc.c,v 1.18 2006/09/04 20:01:10 dsl Exp $"); #endif #endif*/ /* not lint */ #include /*#include #include "extern.h"*/ #include "mytypes.h" #define u_int32_t uint32_t static const u_int32_t crctab[] = { 0x0, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; #if 0 /* * Compute a POSIX 1003.2 checksum. This routine has been broken out so that * other programs can use it. It takes a file descriptor to read from and * locations to store the crc and the number of bytes read. It returns 0 on * success and 1 on failure. Errno is set on failure. */ int crc(int fd, u_int32_t *cval, off_t *clen) { u_char *p; int nr; u_int32_t thecrc; off_t len; u_char buf[16 * 1024]; #endif #define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)] #if 0 thecrc = 0; len = 0; while ((nr = read(fd, buf, sizeof(buf))) > 0) for (len += nr, p = buf; nr--; ++p) { COMPUTE(thecrc, *p); } if (nr < 0) return 1; *clen = len; /* Include the length of the file. */ for (; len != 0; len >>= 8) { COMPUTE(thecrc, len & 0xff); } *cval = ~thecrc; return 0; } #endif /* These two are rather more useful to the outside world */ uint32_t crc32(uint32_t thecrc, const void *buf, size_t len) { const uint8_t *p = buf; for (p = buf; len; p++, len--) COMPUTE(thecrc, *p); return thecrc; } #if 0 uint32_t crc_byte(uint32_t thecrc, unsigned int byte_val) { COMPUTE(thecrc, byte_val & 0xff); return thecrc; } #endif kbuild-3608/src/lib/dos2unix.h0000664000175000017500000000413114670377415016204 0ustar locutuslocutus/* $Id: dos2unix.h 3114 2017-10-29 18:02:04Z bird $ */ /** @file * dos2unix - Line ending conversion routines. */ /* * Copyright (c) 2017 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___lib_dos2unix_h___ #define ___lib_dos2unix_h___ #include #define DOS2UNIX_STYLE_NONE 0x00 #define DOS2UNIX_STYLE_DOS 0x01 #define DOS2UNIX_STYLE_UNIX 0x02 #define DOS2UNIX_STYLE_MIXED 0x03 #define DOS2UNIX_STYLE_MASK 0x03 #define DOS2UNIX_F_BINARY 0x80 /**< Probably a binary file. */ int dos2unix_analyze_file(const char *pszFilename, KU32 *pfStyle, KSIZE *pcDosEols, KSIZE *pcUnixEols); int dos2unix_analyze_fd(int fd, KU32 *pfStyle, KSIZE *pcDosEols, KSIZE *pcUnixEols); KBOOL dos2unix_convert_to_unix(const char *pchSrc, KSIZE cchSrc, char *pchDst, KSIZE *pcchDst); KBOOL dos2unix_convert_to_dos(const char *pchSrc, KSIZE cchSrc, char *pchDst, KSIZE *pcchDst); #endif kbuild-3608/src/lib/get_codepage.c0000664000175000017500000000457414670377415017045 0ustar locutuslocutus/* $Id: get_codepage.c 3546 2022-01-29 02:37:06Z bird $ */ /** @file * get_codepage - Gets the current codepage (as per CRT). */ /* * Copyright (c) 2016-2021 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include "console.h" #include #include #if _MSC_VER < 1900 _CRTIMP UINT __cdecl ___lc_codepage_func(void); #endif /** * Returns the active codepage as per the CRT. * * @returns Code page. */ unsigned get_crt_codepage(void) { /* We use the CRT internal function ___lc_codepage_func for getting the codepage. It was made public/official in UCRT. */ unsigned uCodepage = ___lc_codepage_func(); if (uCodepage == 0) uCodepage = GetACP(); return uCodepage; } /** * Returns GetACP(). */ unsigned get_ansi_codepage(void) { return GetACP(); } kbuild-3608/src/lib/get_codepage.h0000664000175000017500000000310214670377415017034 0ustar locutuslocutus/* $Id: get_codepage.h 3546 2022-01-29 02:37:06Z bird $ */ /** @file * Codepage related functions. */ /* * Copyright (c) 2021 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___lib_get_codepage_h___ #define ___lib_get_codepage_h___ #include extern unsigned get_crt_codepage(void); extern unsigned get_ansi_codepage(void); #define MY_CP_UTF8 65001 #endif kbuild-3608/src/lib/version_compare.c0000664000175000017500000002117114670377415017622 0ustar locutuslocutus/* $Id: version_compare.c 3551 2022-01-29 02:57:33Z bird $ */ /** @file * version_compare - version compare. */ /* * Copyright (c) 2020 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include "version_compare.h" #include #include #include /** * Simple quantification of the pre-release designations (alpha2, beta1, rc1). * * @returns ~0U if not a pre-release designation, lesser values if it is. * @note Case is ignored. */ static const char *check_release_type(char ch, const char *psz, unsigned *puValue) { const char * const pszStart = psz; *puValue = ~0U; switch (ch) { default: return psz; case 'r': case 'R': ch = *psz++; if (ch != 'c' && ch != 'C') return pszStart; *puValue = ~0U/4 * 2; break; case 'b': case 'B': ch = *psz++; if (ch != 'e' && ch != 'E') return pszStart; ch = *psz++; if (ch != 't' && ch != 'T') return pszStart; ch = *psz++; if (ch != 'a' && ch != 'A') return pszStart; *puValue = ~0U/4; break; case 'a': case 'A': ch = *psz++; if (ch != 'l' && ch != 'L') return pszStart; ch = *psz++; if (ch != 'p' && ch != 'P') return pszStart; ch = *psz++; if (ch != 'h' && ch != 'H') return pszStart; ch = *psz++; if (ch != 'a' && ch != 'A') return pszStart; *puValue = 0; break; } /* The next must be an non-alpha character, if a digit we add it to the value. */ ch = *psz; if (isdigit(ch)) { long int lSub = strtol(psz, (char **)&psz, 10); if (lSub >= ~0U / 4) lSub = ~0U / 4 - 1; *puValue += (unsigned)lSub; } else if (isalpha(ch)) return pszStart; return psz; } /** * Deals with returns, mainly from the string compare part. */ static int compare_failed(char ch1, char ch2) { if (ch1 == '~') return -1; if (ch2 == '~') return 1; if (ch1 == '\0' || ch1 == '/') /* treat '/' similar to '\0' to deal with the v14.2/ vs v14.2.11.9/ case. */ return -1; if (ch2 == '\0' || ch2 == '/') return 1; if (isdigit(ch1)) return -1; if (isdigit(ch2)) return 1; if (isalpha(ch1)) return isalpha(ch2) ? (int)ch1 - (int)ch2 : -1; if (isalpha(ch2)) return 1; return (int)ch1 - (int)ch2; } int version_compare(const char *psz1, const char *psz2) { for (;;) { int diff; /* Work non-digits: */ char ch1 = *psz1++; char ch2 = *psz2++; for (;;) { if (ch1 == ch2) { if (ch1 != '\0') { if (isdigit(ch1)) break; ch1 = *psz1++; ch2 = *psz2++; } else return 0; } else if (isdigit(ch1) && isdigit(ch2)) break; else return compare_failed(ch1, ch2); } /* Skip leading zeros */ while (ch1 == '0') ch1 = *psz1++; while (ch2 == '0') ch2 = *psz2++; /* Compare digits. */ for (diff = 0;;) { if (isdigit(ch1)) { if (isdigit(ch2)) { if (diff == 0) diff = (int)ch1 - (int)ch2; ch1 = *psz1++; ch2 = *psz2++; } else return 1; /* The number in psz1 is longer and therefore larger. */ } else if (isdigit(ch2)) return -1; /* The number in psz1 is shorter and therefore smaller. */ else if (diff != 0) return diff; else break; } /* Neither ch1 nor ch2 is a digit at this point, but complete the comparisons of the two before looping. We check for alpha, beta, rc suffixes here (mainly to correctly order 1.2.3r4567890 after 1.2.3rc1) */ { unsigned uType1 = ~0; unsigned uType2 = ~0; psz1 = check_release_type(ch1, psz1, &uType1); psz2 = check_release_type(ch2, psz2, &uType2); if (uType1 != uType2) return uType1 < uType2 ? -1 : 1; if (ch1 != ch2 && uType1 == ~0U) return compare_failed(ch1, ch2); if (ch1 == '\0') return 0; } } } #ifdef TEST # include int main() { static const struct { int rcExpect; const char *psz1, *psz2; } s_aTests[] = { { 0, "", "" }, { 0, "a", "a" }, { 0, "ab", "ab" }, { 0, "abc", "abc" }, { 0, "001", "1" }, { 0, "000", "0" }, { -1, "0", "a" }, { -1, "0", "1" }, { -1, "0", "9" }, { -1, "0", "99" }, { -1, "9", "99" }, { -1, "98", "99" }, { 0, "asdfasdf", "asdfasdf" }, { -1, "asdfasdf", "asdfasdfz" }, { +1, "asdfasdfz", "asdfasdf" }, { 0, "a1s2d3f4", "a1s2d3f4" }, { 0, "a01s002d003f004", "a1s2d3f4" }, { 0, "a1s2d3f4", "a01s002d003f004" }, { 0, "kBuild-0.099.7", "kBuild-0.99.00007" }, { +1, "kBuild-0.099.7", "kBuild-0.99.00007rc1" }, { +1, "kBuild-0.099.7rc2", "kBuild-0.99.7beta3" }, { -1, "kBuild-0.099.7alpha", "kBuild-0.99.7beta3" }, { -1, "kBuild-0.099.7alpha", "kBuild-0.99.7beta3" }, { -1, "kBuild-0.099.7alpha", "kBuild-0.99.7alpha1" }, { 0, "kBuild-0.099.7ALPHA1", "kBuild-0.99.7alpha1" }, { -1, "kBuild-0.099.7BETA1", "kBuild-0.99.7rC1" }, { -1, "kBuild-0.099", "kBuild-0.99.0" }, { +1, "kBuild-0.099", "kBuild-0.99~" }, { +1, "1.2.3r4567890", "1.2.3rc1" }, { +1, "1.2.3r4567890", "1.2.3RC1" }, { -1, "/tools/win.amd64/vcc/v14.2/Tools", "/tools/win.amd64/vcc/v14.2.11.9/Tools" }, { -1, "/tools/win.amd64/vcc/v14.2/Tools", "/tools/win.amd64/vcc/v14.211.9/Tools" }, { -1, "/tools/win.amd64/vcc/v14.2/Tools", "/tools/win.amd64/vcc/v14.2r2/Tools" }, { -1, "/tools/win.amd64/vcc/v14.2/Tools", "/tools/win.amd64/vcc/v14.2-r2/Tools" }, }; unsigned cErrors = 0; unsigned i; for (i = 0; i < sizeof(s_aTests) / sizeof(s_aTests[0]); i++) { int rc = version_compare(s_aTests[i].psz1, s_aTests[i].psz2); int rcExpect = s_aTests[i].rcExpect; if (rc != (rcExpect < 0 ? -1 : rcExpect > 0 ? 1 : 0)) { fprintf(stderr, "error: Test #%u: %d, expected %d: '%s' vs '%s'\n", i, rc, rcExpect, s_aTests[i].psz1, s_aTests[i].psz2); cErrors++; } } return cErrors == 0 ? 0 : 1; } #endif kbuild-3608/src/lib/quoted_spawn.h0000664000175000017500000000313514670377415017145 0ustar locutuslocutus/* $Id: quoted_spawn.h 2851 2016-08-31 17:30:52Z bird $ */ /** @file * quote_spawn - Correctly Quote The _spawnvp arguments, windows specific. */ /* * Copyright (c) 2010-2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___quoted_spawn_h___ #define ___quoted_spawn_h___ #include "mytypes.h" intptr_t quoted_spawnvp(int fMode, const char *pszExecPath, const char * const *papszArgs); #endif kbuild-3608/src/lib/quoted_spawn.c0000664000175000017500000002075514670377415017147 0ustar locutuslocutus/* $Id: quoted_spawn.c 2851 2016-08-31 17:30:52Z bird $ */ /** @file * quote_spawn - Correctly Quote The _spawnvp arguments, windows specific. */ /* * Copyright (c) 2010-2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "quoted_spawn.h" #include #include #include #include #include #include /** * Tests if a strings needs quoting. * * @returns 1 if needs, 0 if it doesn't. * @param pszArg The string in question. */ static int quoted_spawn_need_quoting(const char *pszArg) { for (;;) switch (*pszArg++) { case 0: return 0; case ' ': case '"': case '&': case '>': case '<': case '|': case '%': /* Quote the control chars (tab is included). */ case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: return 1; } } /** * Frees any quoted arguments. * * @returns NULL. * @param papszArgsOrg The original argument vector. * @param papszArgsQuoted The quoted argument vector. * @param cArgs The number of arguments in the vector. */ static const char * const * quoted_spawn_free(const char * const *papszArgsOrg, const char * const *papszArgsQuoted, unsigned cArgs) { if ( papszArgsOrg != papszArgsQuoted && papszArgsQuoted != NULL) { int iSavedErrno = errno; /* A bit of paranoia. */ unsigned i = cArgs; while (i-- > 0) if (papszArgsQuoted[i] != papszArgsOrg[i]) free((char *)papszArgsQuoted[i]); free((void *)papszArgsQuoted); errno = iSavedErrno; } return NULL; } /** * Quote an argument string. * * @returns Quoted argument string (new). * @param pszArgOrg The original string. */ static const char *quoted_spawn_quote_arg(const char *pszArgOrg) { size_t cchArgOrg = strlen(pszArgOrg); size_t cchArgNew = 1 + cchArgOrg * 2 + 1 + 1; char *pszArgNew = malloc(cchArgNew); if (pszArgNew) { char ch; char *pszDst = pszArgNew; *pszDst++ = '"'; while ((ch = *pszArgOrg++)) { if (ch == '\\') { size_t cSlashes = 1; for (;;) { *pszDst++ = '\\'; ch = *pszArgOrg; if (ch != '\\') break; pszArgOrg++; cSlashes++; } if (ch == '"' || ch == '\0') { while (cSlashes-- > 0) *pszDst++ = '\\'; if (ch == '\0') break; *pszDst++ = '\\'; *pszDst++ = '"'; } } else if (ch == '"') { *pszDst++ = '\\'; *pszDst++ = '"'; } else *pszDst++ = ch; } *pszDst++ = '"'; *pszDst = '\0'; assert((size_t)(pszDst - pszArgNew) < cchArgNew - 1); } return pszArgNew; } /** * Quotes the arguments in an argument vector, producing a new vector. * * @returns The quoted argument vector. * @param papszArgsOrg The vector which arguments to quote. * @param iFirstArg The first argument that needs quoting. * @param pcArgs Where to return the argument count. */ static const char * const * quoted_spawn_quote_vector(const char * const *papszArgsOrg, unsigned iFirstArg, unsigned *pcArgs) { const char **papszArgsQuoted; unsigned cArgs; unsigned iArg; /* finish counting them and allocate the result array. */ cArgs = iFirstArg; while (papszArgsOrg[cArgs]) cArgs++; *pcArgs = cArgs; papszArgsQuoted = (const char **)calloc(sizeof(const char *), cArgs + 1); if (!papszArgsQuoted) return NULL; /* Process the arguments up to the first quoted one (no need to re-examine them). */ for (iArg = 0; iArg < iFirstArg; iArg++) papszArgsQuoted[iArg] = papszArgsOrg[iArg]; papszArgsQuoted[iArg] = quoted_spawn_quote_arg(papszArgsOrg[iArg]); if (!papszArgsQuoted[iArg]) return quoted_spawn_free(papszArgsOrg, papszArgsQuoted, cArgs); /* Process the remaining arguments. */ while (iArg < cArgs) { if (!quoted_spawn_need_quoting(papszArgsOrg[iArg])) papszArgsQuoted[iArg] = papszArgsOrg[iArg]; else { papszArgsQuoted[iArg] = quoted_spawn_quote_arg(papszArgsOrg[iArg]); if (!papszArgsQuoted[iArg]) return quoted_spawn_free(papszArgsOrg, papszArgsQuoted, cArgs); } iArg++; } return papszArgsQuoted; } /** * Checks if any of the arguments in the vector needs quoting and does the job. * * @returns If anything needs quoting a new vector is returned, otherwise the * original is returned. * @param papszArgsOrg The argument vector to check. * @param pcArgs Where to return the argument count. */ static const char * const * quoted_spawn_maybe_quote(const char * const *papszArgsOrg, unsigned *pcArgs) { unsigned iArg; for (iArg = 0; papszArgsOrg[iArg]; iArg++) if (quoted_spawn_need_quoting(papszArgsOrg[iArg])) return quoted_spawn_quote_vector(papszArgsOrg, iArg, pcArgs); *pcArgs = iArg; return papszArgsOrg; } /** * Wrapper for _spawnvp. * * @returns The process handle, see _spawnvp for details. * @param fMode The spawn mode, see _spawnvp for details. * @param pszExecPath The path to the executable, or just the name * if a PATH search is desired. * @param papszArgs The arguments to pass to the new process. */ intptr_t quoted_spawnvp(int fMode, const char *pszExecPath, const char * const *papszArgs) { intptr_t hProcess; unsigned cArgs; const char * const *papszArgsQuoted = quoted_spawn_maybe_quote(papszArgs, &cArgs); if (papszArgsQuoted) { //unsigned i; //fprintf(stderr, "debug: spawning '%s'\n", pszExecPath); //for (i = 0; i < cArgs; i++) // fprintf(stderr, "debug: #%02u: '%s'\n", i, papszArgsQuoted[i]); hProcess = _spawnvp(fMode, pszExecPath, papszArgsQuoted); quoted_spawn_free(papszArgs, papszArgsQuoted, cArgs); } else { errno = ENOMEM; hProcess = -1; } return hProcess; } kbuild-3608/src/lib/testcase/0000775000175000017500000000000014670377415016074 5ustar locutuslocutuskbuild-3608/src/lib/testcase/unix-text.txt0000664000175000017500000000255414670377415020610 0ustar locutuslocutusLorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, kbuild-3608/src/lib/testcase/mixed-text.txt0000664000175000017500000000261114670377415020725 0ustar locutuslocutusLorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, kbuild-3608/src/lib/testcase/dos2unix-test.cmd0000664000175000017500000000241314670377415021311 0ustar locutuslocutus@setlocal @set INSPROG="E:\kBuild\svn\trunk\out\win.amd64\debug\stage\kBuild\bin\win.amd64\kmk_install.exe" @set TMPFILE="e:\tmp\tmp.txt" @set CMPPROG="E:\kBuild\svn\trunk\kBuild\bin\win.amd64\kmk_cmp.exe" @set RMPROG="E:\kBuild\svn\trunk\kBuild\bin\win.amd64\kmk_rm.exe" @%RMPROG% -f -- %TMPFILE% @echo ... dos2unix ... %INSPROG% --dos2unix dos-text.txt %TMPFILE% @if not errorlevel 0 goto end %CMPPROG% -- %TMPFILE% unix-text.txt @if not errorlevel 0 goto end %INSPROG% --dos2unix unix-text.txt %TMPFILE% @if not errorlevel 0 goto end %CMPPROG% -- %TMPFILE% unix-text.txt @if not errorlevel 0 goto end %INSPROG% --dos2unix mixed-text.txt %TMPFILE% @if not errorlevel 0 goto end %CMPPROG% -- %TMPFILE% unix-text.txt @if not errorlevel 0 goto end @echo ... unix2dos ... %INSPROG% --unix2dos unix-text.txt %TMPFILE% @if not errorlevel 0 goto end %CMPPROG% -- %TMPFILE% dos-text.txt @if not errorlevel 0 goto end %INSPROG% --unix2dos dos-text.txt %TMPFILE% @if not errorlevel 0 goto end %CMPPROG% -- %TMPFILE% dos-text.txt @if not errorlevel 0 goto end %INSPROG% --unix2dos mixed-text.txt %TMPFILE% @if not errorlevel 0 goto end %CMPPROG% -- %TMPFILE% dos-text.txt @if not errorlevel 0 goto end @%RMPROG% -f -- %TMPFILE% :end @endlocal kbuild-3608/src/lib/testcase/dos-text.txt0000664000175000017500000000261714670377415020412 0ustar locutuslocutusLorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, kbuild-3608/src/lib/nt_fullpath.h0000664000175000017500000000223714670377415016756 0ustar locutuslocutus/* $Id: nt_fullpath.h 2849 2016-08-30 14:28:46Z bird $ */ /** @file * fixcase - fixes the case of paths, windows specific. */ /* * Copyright (c) 2004-2016 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ #ifndef ___lib_nt_fullpath_h___ #define ___lib_nt_fullpath_h___ #ifdef __cpluslus extern "C" #endif extern void nt_fullpath(const char *pszPath, char *pszFull, size_t cchFull); extern void nt_fullpath_cached(const char *pszPath, char *pszFull, size_t cchFull); #ifdef __cpluslus } #endif #endif kbuild-3608/src/lib/kbuild_version.c0000664000175000017500000000446714670377415017457 0ustar locutuslocutus/* $Id: kbuild_version.c 2851 2016-08-31 17:30:52Z bird $ */ /** @file * kbuild_version(), helper function. */ /* * Copyright (c) 2007-2013 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "kbuild_version.h" #include #include /** * Prints the kBuild version message and returns 0. * * @returns 0 * @param argv0 The argv0. */ int kbuild_version(const char *argv0) { const char *tmp; /* skip the path */ for (tmp = strpbrk(argv0, "\\/:"); tmp; tmp = strpbrk(argv0, "\\/:")) argv0 = tmp + 1; /* find the end, ignoring extenions */ tmp = strrchr(argv0, '.'); if (!tmp) tmp = strchr(argv0, '\0'); printf("%.*s - kBuild version %d.%d.%d (r%u)\n", (int)(tmp - argv0), argv0, KBUILD_VERSION_MAJOR, KBUILD_VERSION_MINOR, KBUILD_VERSION_PATCH, KBUILD_SVN_REV); return 0; } kbuild-3608/src/lib/test-eintr-bug-1.c0000664000175000017500000000436614670377415017445 0ustar locutuslocutus /******************************************************************************* * Header Files * *******************************************************************************/ //#define _XOPEN_SOURCE //#define _BSD_SOURCE #include #include #include #include #include #include volatile unsigned long g_cInts = 0; static void SigAlaramHandler(int iSig) { g_cInts++; (void)iSig; } int main(int argc, char **argv) { struct itimerval TmrVal; void (*rcSig)(int); int i; int rc; char szName[256]; /* * Set up the timer signal. */ rcSig = bsd_signal(SIGALRM, SigAlaramHandler); if (rcSig == SIG_ERR) { fprintf(stderr, "bsd_signal failed: %s\n", strerror(errno)); return 1; } if (argc == 2) /* testing... */ siginterrupt(SIGALRM, 1); memset(&TmrVal, '\0', sizeof(TmrVal)); TmrVal.it_interval.tv_sec = TmrVal.it_value.tv_sec = 0; TmrVal.it_interval.tv_usec = TmrVal.it_value.tv_usec = 1; rc = setitimer(ITIMER_REAL, &TmrVal, NULL); if (rc != 0) { fprintf(stderr, "setitimer failed: %s\n", strerror(errno)); return 1; } printf("interval %d.%06d\n", (int)TmrVal.it_interval.tv_sec, (int)TmrVal.it_interval.tv_usec); /* * Do path related stuff. */ snprintf(szName, sizeof(szName), "%s/fooled/you", argv[0]); for (i = 0; i < 100*1000*1000; i++) { struct stat St; rc = stat(argv[0], &St); if (rc == 0) rc = stat(szName, &St); if (rc != 0 && errno == EINTR) { printf("iteration %d: stat: %s (%u)\n", i, strerror(errno), errno); break; } if ((i % 100000) == 0) { printf("."); if ((i % 1000000) == 0) printf("[%u/%lu]", i, g_cInts); fflush(stdout); } } if (!rc) printf("No EINTR in %d iterations - system is working nicely!\n", i); TmrVal.it_interval.tv_sec = TmrVal.it_value.tv_sec = 0; TmrVal.it_interval.tv_usec = TmrVal.it_value.tv_usec = 0; setitimer(ITIMER_REAL, &TmrVal, NULL); return rc ? 1 : 0; } kbuild-3608/src/lib/msc_buffered_printf.c0000664000175000017500000002030014670377415020426 0ustar locutuslocutus/* $Id: msc_buffered_printf.c 3547 2022-01-29 02:39:47Z bird $ */ /** @file * printf, vprintf, fprintf, puts, fputs console optimizations for Windows/MSC. */ /* * Copyright (c) 2016 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include #include #include #include #include #include #include #include "console.h" #undef printf #undef vprintf #undef fprintf #undef puts #undef fputs #pragma warning(disable: 4273) /* inconsistent dll linkage*/ #ifndef KWORKER # define DLL_IMPORT __declspec(dllexport) #else # define DLL_IMPORT #endif /** * Replaces printf for MSC to speed up console output. * * @returns chars written on success, -1 and errno on failure. * @param pszFormat The format string. * @param ... Format arguments. */ DLL_IMPORT int __cdecl printf(const char *pszFormat, ...) { int cchRet; va_list va; va_start(va, pszFormat); cchRet = vprintf(pszFormat, va); va_end(va); return cchRet; } /** * Replaces vprintf for MSC to speed up console output. * * @returns chars written on success, -1 and errno on failure. * @param pszFormat The format string. * @param va Format arguments. */ DLL_IMPORT int __cdecl vprintf(const char *pszFormat, va_list va) { /* * If it's a TTY, try format into a stack buffer and output using our * console optimized fwrite wrapper. */ if (*pszFormat != '\0') { int fd = fileno(stdout); if (fd >= 0) { if (is_console(fd)) { char *pszTmp = (char *)alloca(16384); va_list va2 = va; int cchRet = vsnprintf(pszTmp, 16384, pszFormat, va2); if (cchRet < 16384 - 1) return (int)maybe_con_fwrite(pszTmp, cchRet, 1, stdout); } } } /* * Fallback. */ return vfprintf(stdout, pszFormat, va); } /** * Replaces fprintf for MSC to speed up console output. * * @returns chars written on success, -1 and errno on failure. * @param pFile The output file/stream. * @param pszFormat The format string. * @param va Format arguments. */ DLL_IMPORT int __cdecl fprintf(FILE *pFile, const char *pszFormat, ...) { va_list va; int cchRet; /* * If it's a TTY, try format into a stack buffer and output using our * console optimized fwrite wrapper. */ if (*pszFormat != '\0') { int fd = fileno(pFile); if (fd >= 0) { if (is_console(fd)) { char *pszTmp = (char *)alloca(16384); if (pszTmp) { va_start(va, pszFormat); cchRet = vsnprintf(pszTmp, 16384, pszFormat, va); va_end(va); if (cchRet < 16384 - 1) return (int)maybe_con_fwrite(pszTmp, cchRet, 1, pFile); } } } } /* * Fallback. */ va_start(va, pszFormat); cchRet = vfprintf(pFile, pszFormat, va); va_end(va); return cchRet; } /** * Replaces puts for MSC to speed up console output. * * @returns Units written; 0 & errno on failure. * @param pszString The string to write. (newline is appended) */ DLL_IMPORT int __cdecl puts(const char *pszString) { /* * If it's a TTY, we convert it to a wide char string with a newline * appended right here. Going thru maybe_con_fwrite is just extra * buffering due to the added newline. */ size_t cchString = strlen(pszString); size_t cch; if (cchString > 0 && cchString < INT_MAX / 2) { int fd = fileno(stdout); if (fd >= 0) { if (is_console(fd)) { HANDLE hCon = (HANDLE)_get_osfhandle(fd); if ( hCon != INVALID_HANDLE_VALUE && hCon != NULL) { wchar_t awcBuf[1024]; wchar_t *pawcBuf; wchar_t *pawcBufFree = NULL; size_t cwcBuf = cchString * 2 + 16 + 1; /* +1 for added newline */ if (cwcBuf < sizeof(awcBuf) / sizeof(awcBuf[0])) { pawcBuf = awcBuf; cwcBuf = sizeof(awcBuf) / sizeof(awcBuf[0]); } else pawcBufFree = pawcBuf = (wchar_t *)malloc(cwcBuf * sizeof(wchar_t)); if (pawcBuf) { int cwcToWrite = MultiByteToWideChar(get_crt_codepage(), 0 /*dwFlags*/, pszString, (int)cchString, pawcBuf, (int)(cwcBuf - 1)); if (cwcToWrite > 0) { int rc; pawcBuf[cwcToWrite++] = '\n'; pawcBuf[cwcToWrite] = '\0'; /* Let the CRT do the rest. At least the Visual C++ 2010 CRT sources indicates _cputws will do the right thing. */ fflush(stdout); rc = _cputws(pawcBuf); if (pawcBufFree) free(pawcBufFree); if (rc >= 0) return 0; return -1; } free(pawcBufFree); } } } } } /* * Fallback. */ cch = fwrite(pszString, cchString, 1, stdout); if (cch == cchString) { if (putc('\n', stdout) != EOF) return 0; } return -1; } /** * Replaces puts for MSC to speed up console output. * * @returns Units written; 0 & errno on failure. * @param pszString The string to write (no newline added). * @param pFile The output file. */ DLL_IMPORT int __cdecl fputs(const char *pszString, FILE *pFile) { size_t cchString = strlen(pszString); size_t cch = maybe_con_fwrite(pszString, cchString, 1, pFile); if (cch == cchString) return 0; return -1; } void * const __imp_printf = (void *)(uintptr_t)printf; void * const __imp_vprintf = (void *)(uintptr_t)vprintf; void * const __imp_fprintf = (void *)(uintptr_t)fprintf; void * const __imp_puts = (void *)(uintptr_t)puts; void * const __imp_fputs = (void *)(uintptr_t)fputs; kbuild-3608/src/lib/version_compare.h0000664000175000017500000000300614670377415017624 0ustar locutuslocutus/* $Id: version_compare.h 3394 2020-07-01 20:24:52Z bird $ */ /** @file * version_compare - version compare. */ /* * Copyright (c) 2020 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ #ifndef ___version_compare_h___ #define ___version_compare_h___ int version_compare(const char *psz1, const char *psz2); #endif kbuild-3608/src/lib/is_console.c0000664000175000017500000000477014670377415016572 0ustar locutuslocutus/* $Id: is_console.c 3188 2018-03-24 15:32:26Z bird $ */ /** @file * is_console - checks if a file descriptor is the console. */ /* * Copyright (c) 2016-2018 knut st. osmundsen * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Alternatively, the content of this file may be used under the terms of the * GPL version 2 or later, or LGPL version 2.1 or later. */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include "console.h" #ifdef KBUILD_OS_WINDOWS # include #endif #ifdef _MSC_VER # include #else # include #endif #ifdef KBUILD_OS_WINDOWS /** * Checks if @a hHandle is a console handle. * @returns 1 if it is, 0 if not. */ int is_console_handle(intptr_t hHandle) { DWORD fMode; if (GetConsoleMode((HANDLE)hHandle, &fMode)) return 1; return 0; } #endif /** * Checks if @a fd is a console handle. * @returns 1 if it is, 0 if not. */ int is_console(int fd) { #ifdef KBUILD_OS_WINDOWS intptr_t hNative = _get_osfhandle(fd); if (hNative != (intptr_t)INVALID_HANDLE_VALUE) return is_console_handle(hNative); return 0; #else return isatty(fd); #endif } kbuild-3608/src/Makefile.kmk0000664000175000017500000000276514670377472015751 0ustar locutuslocutus# $Id: Makefile.kmk 3539 2021-12-21 12:21:29Z bird $ ## @file # Sub-makefile for the source directory. # # # Copyright (c) 2004-2010 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # SUB_DEPTH = .. include $(KBUILD_PATH)/subheader.kmk include $(PATH_SUB_CURRENT)/lib/Makefile.kmk include $(PATH_SUB_CURRENT)/sed/Makefile.kmk include $(PATH_SUB_CURRENT)/kmk/Makefile.kmk include $(PATH_SUB_CURRENT)/kash/Makefile.kmk include $(PATH_SUB_CURRENT)/kDepPre/Makefile.kmk include $(PATH_SUB_CURRENT)/kObjCache/Makefile.kmk include $(PATH_SUB_CURRENT)/misc/Makefile.kmk ifeq ($(KBUILD_TARGET),win) include $(PATH_SUB_CURRENT)/kLibTweaker/Makefile.kmk include $(PATH_SUB_CURRENT)/kDeDup/Makefile.kmk include $(PATH_SUB_CURRENT)/kWorker/Makefile.kmk endif if1of ($(KBUILD_TARGET), win) include $(PATH_SUB_CURRENT)/grep/Makefile.kmk endif include $(FILE_KBUILD_SUB_FOOTER) kbuild-3608/src/kash/0000775000175000017500000000000014670377416014442 5ustar locutuslocutuskbuild-3608/src/kash/mystring.c0000664000175000017500000000645214670377416016471 0ustar locutuslocutus/* $NetBSD: mystring.c,v 1.16 2003/08/07 09:05:35 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)mystring.c 8.2 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: mystring.c,v 1.16 2003/08/07 09:05:35 agc Exp $"); #endif /* not lint */ #endif /* * String functions. * * equal(s1, s2) Return true if strings are equal. * scopy(from, to) Copy a string. * scopyn(from, to, n) Like scopy, but checks for overflow. * number(s) Convert a string of digits to an integer. * is_number(s) Return true if s is a string of digits. */ #include #include "shell.h" #include "syntax.h" #include "error.h" #include "mystring.h" char nullstr[1]; /* zero length string */ /* * equal - #defined in mystring.h */ /* * scopy - #defined in mystring.h */ /* * scopyn - copy a string from "from" to "to", truncating the string * if necessary. "To" is always nul terminated, even if * truncation is performed. "Size" is the size of "to". */ void scopyn(const char *from, char *to, ssize_t size) { while (--size > 0) { if ((*to++ = *from++) == '\0') return; } *to = '\0'; } /* * prefix -- see if pfx is a prefix of string. */ int prefix(const char *pfx, const char *string) { while (*pfx) { if (*pfx++ != *string++) return 0; } return 1; } /* * Convert a string of digits to an integer, printing an error message on * failure. */ int number(shinstance *psh, const char *s) { if (! is_number(s)) error(psh, "Illegal number: %s", s); return atoi(s); } /* * Check for a valid number. This should be elsewhere. */ int is_number(const char *p) { do { if (! is_digit(*p)) return 0; } while (*++p != '\0'); return 1; } kbuild-3608/src/kash/memalloc.h0000664000175000017500000001573214670377416016414 0ustar locutuslocutus/* $NetBSD: memalloc.h,v 1.14 2003/08/07 09:05:34 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)memalloc.h 8.2 (Berkeley) 5/4/95 */ struct stackmark { struct stack_block *stackp; char *stacknxt; int stacknleft; #ifdef KASH_SEPARATE_PARSER_ALLOCATOR unsigned pstacksize; #endif struct stackmark *marknext; }; /*extern char *stacknxt; extern int stacknleft; extern int sstrnleft; extern int herefd;*/ pointer ckmalloc(struct shinstance *, size_t); pointer ckrealloc(struct shinstance *, pointer, size_t); char *savestr(struct shinstance *, const char *); #define ckfree(psh, p) sh_free(psh, (pointer)(p)) #ifndef SH_MEMALLOC_NO_STACK pointer stalloc(struct shinstance *, size_t); char *stsavestr(struct shinstance *, const char *); void stunalloc(struct shinstance *, pointer); void setstackmark(struct shinstance *, struct stackmark *); void popstackmark(struct shinstance *, struct stackmark *); void growstackblock(struct shinstance *); void grabstackblock(struct shinstance *, int); char *growstackstr(struct shinstance *); char *makestrspace(struct shinstance *); char *grabstackstr(struct shinstance *, char *); /* was #define using stalloc */ void ungrabstackstr(struct shinstance *, char *, char *); #define stackblock(psh) (psh)->stacknxt #define stackblocksize(psh) (psh)->stacknleft #define STARTSTACKSTR(psh, p) p = stackblock(psh), (psh)->sstrnleft = stackblocksize(psh) #define STPUTC(psh, c, p) (--(psh)->sstrnleft >= 0? (*p++ = (c)) : (p = growstackstr(psh), *p++ = (c))) #define CHECKSTRSPACE(psh, n, p) { if ((psh)->sstrnleft < n) p = makestrspace(psh); } #define USTPUTC(psh, c, p) do { kHlpAssert((psh)->sstrnleft > 0); \ kHlpAssert(p - (char *)stackblock(psh) == stackblocksize(psh) - (psh)->sstrnleft); \ --(psh)->sstrnleft; *p++ = (c); } while (0) #define STACKSTRNUL(psh, p) ((psh)->sstrnleft == 0? (p = growstackstr(psh), *p = '\0') : (*p = '\0')) #define STUNPUTC(psh, p) (++(psh)->sstrnleft, --p) #define STADJUST(psh, amount, p) (p += (amount), (psh)->sstrnleft -= (amount)) #endif /* SH_MEMALLOC_NO_STACK */ /** @name Stack allocator for parser. * This is a stripped down version of the general stack allocator interface for * the exclusive use of the parser, so that parsetrees can be shared with * subshells by simple reference counting. * @{ */ #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block; unsigned pstackretain(struct pstack_block *); void pstackpop(struct shinstance *, unsigned); unsigned pstackrelease(struct shinstance *, struct pstack_block *, const char *); unsigned pstackretainpush(struct shinstance *, struct pstack_block *); struct pstack_block *pstackallocpush(struct shinstance *); void pstackmarkdone(struct pstack_block *); #endif void *pstalloc(struct shinstance *, size_t); union node; union node *pstallocnode(struct shinstance *, size_t); struct nodelist; struct nodelist *pstalloclist(struct shinstance *); char *pstsavestr(struct shinstance *, const char *); /* was: stsavestr */ char *pstmakestrspace(struct shinstance *, size_t, char *); /* was: makestrspace / growstackstr */ char *pstputcgrow(struct shinstance *, char *, char); char *pstgrabstr(struct shinstance *, char *); /* was: grabstackstr / grabstackblock*/ #ifdef KASH_SEPARATE_PARSER_ALLOCATOR # define PSTBLOCK(psh) ((psh)->curpstack->nextbyte) # define PSTARTSTACKSTR(psh, p) do { \ pstack_block *pstmacro = (psh)->curpstack; \ pstmacro->strleft = pstmacro->avail; \ (p) = pstmacro->nextbyte; \ } while (0) # define PSTCHECKSTRSPACE(psh, n, p) do { \ if ((psh)->curpstack->strleft >= (n)) {/*likely*/} \ else { (p) = pstmakestrspace(psh, (n), (p)); kHlpAssert((psh)->curpstack->strleft >= (n)); } \ } while (0) # define PSTUPUTC(psh, c, p) do { \ kHlpAssert((psh)->curpstack->strleft > 0); \ (psh)->curpstack->strleft -= 1; \ *(p)++ = (c); \ } while (0) # define PSTPUTC(psh, c, p) do { \ if ((ssize_t)--(psh)->curpstack->strleft >= 0) *(p)++ = (c); \ else (p) = pstputcgrow(psh, (p), (c)); \ } while (0) # define PSTPUTSTRN(psh, str, n, p) do { \ pstack_block *pstmacro = (psh)->curpstack; \ if (pstmacro->strleft >= (size_t)(n)) {/*likely?*/} \ else (p) = pstmakestrspace(psh, (n), (p)); \ pstmacro->strleft -= (n); \ memcpy((p), (str), (n)); \ (p) += (n); \ } while (0) #else # define PSTBLOCK(psh) ((psh)->stacknxt) # define PSTARTSTACKSTR(psh, p) do { (p) = (psh)->stacknxt; (psh)->sstrnleft = (psh)->stacknleft; } while (0) # define PSTCHECKSTRSPACE(psh, n, p) do { if ((psh)->sstrnleft >= (n)) {/*likely*/} \ else { (p) = pstmakestrspace(psh, (n), (p)); kHlpAssert((psh)->sstrnleft >= (n)); } } while (0) # define PSTUPUTC(psh, c, p) do { kHlpAssert((psh)->sstrnleft > 0); --(psh)->sstrnleft; *(p)++ = (c); } while (0) # define PSTPUTC(psh, c, p) do { if (--(psh)->sstrnleft >= 0) *(p)++ = (c); else (p) = pstputcgrow(psh, (p), (c)); } while (0) # define PSTPUTSTRN(psh, str, n, p) do { if ((psh)->sstrnleft >= (size_t)(n)) {/*likely?*/} else (p) = pstmakestrspace(psh, (n), (p)); \ memcpy((p), (str), (n)); (psh)->sstrnleft -= (n); (p) += (n); } while (0) #endif /** @} */ kbuild-3608/src/kash/shheap.h0000664000175000017500000000245414670377416016070 0ustar locutuslocutus/* $Id: shheap.h 2416 2010-09-14 00:30:30Z bird $ */ /** @file * The shell memory heap methods. */ /* * Copyright (c) 2009-2010 knut st. osmundsen * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef ___shheap_h #define ___shheap_h #include "shtypes.h" /* heap */ int shheap_init(void *phead); void *shheap_get_head(void); int shheap_fork_copy_to_child(void *); void *sh_malloc(shinstance *, size_t); void *sh_calloc(shinstance *, size_t, size_t); void *sh_realloc(shinstance *, void *, size_t); char *sh_strdup(shinstance *, const char *); void sh_free(shinstance *, void *); #endif kbuild-3608/src/kash/trap.h0000664000175000017500000000437114670377416015566 0ustar locutuslocutus/* $NetBSD: trap.h,v 1.17 2003/08/07 09:05:39 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)trap.h 8.3 (Berkeley) 6/5/95 */ /*extern int pendingsigs;*/ #ifndef SH_FORKED_MODE void subshellinittrap(shinstance *, shinstance *); #endif int trapcmd(struct shinstance *, int, char **); void clear_traps(struct shinstance *); void setsignal(struct shinstance *, int); void ignoresig(struct shinstance *, int); void onsig(struct shinstance *, int); void dotrap(struct shinstance *); void setinteractive(struct shinstance *, int); int exitshell2(struct shinstance *, int); SH_NORETURN_1 void exitshell(struct shinstance *, int) SH_NORETURN_2; kbuild-3608/src/kash/miscbltin.h0000664000175000017500000000322714670377416016603 0ustar locutuslocutus/* $NetBSD: miscbltin.h,v 1.3 2003/08/21 17:57:53 christos Exp $ */ /* * Copyright (c) 1997 Christos Zoulas. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ int readcmd(struct shinstance *, int, char **); int umaskcmd(struct shinstance *, int, char **); int ulimitcmd(struct shinstance *, int, char **); kbuild-3608/src/kash/expand.c0000664000175000017500000010373314670377416016074 0ustar locutuslocutus/* $NetBSD: expand.c,v 1.71 2005/06/01 15:41:19 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; #else __RCSID("$NetBSD: expand.c,v 1.71 2005/06/01 15:41:19 lukem Exp $"); #endif /* not lint */ #endif #include #include #include #include /* * Routines to expand arguments to commands. We have to deal with * backquotes, shell variables, and file metacharacters. */ #include "shell.h" #include "main.h" #include "nodes.h" #include "eval.h" #include "expand.h" #include "syntax.h" #include "parser.h" #include "jobs.h" #include "options.h" #include "var.h" #include "input.h" #include "output.h" #include "memalloc.h" #include "error.h" #include "mystring.h" #include "show.h" #include "shinstance.h" ///* // * Structure specifying which parts of the string should be searched // * for IFS characters. // */ // //struct ifsregion { // struct ifsregion *next; /* next region in list */ // int begoff; /* offset of start of region */ // int endoff; /* offset of end of region */ // int inquotes; /* search for nul bytes only */ //}; // // //char *expdest; /* output of current string */ //struct nodelist *argbackq; /* list of back quote expressions */ //struct ifsregion ifsfirst; /* first struct in list of ifs regions */ //struct ifsregion *ifslastp; /* last struct in list */ //struct arglist exparg; /* holds expanded arg list */ STATIC void argstr(shinstance *, char *, int); STATIC void expari(shinstance *, int); STATIC char *exptilde(shinstance *, char *, int); STATIC void expbackq(shinstance *, union node *, int, int); STATIC int subevalvar(shinstance *, char *, char *, int, int, int, int); STATIC char *evalvar(shinstance *, char *, int); STATIC int varisset(shinstance *, char *, int); STATIC void varvalue(shinstance *, char *, int, int, int); STATIC void recordregion(shinstance *, int, int, int); STATIC void removerecordregions(shinstance *, int); STATIC void ifsbreakup(shinstance *, char *, struct arglist *); STATIC void ifsfree(shinstance *); STATIC void expandmeta(shinstance *, struct strlist *, int); STATIC void expmeta(shinstance *, char *, char *); STATIC void addfname(shinstance *, char *); STATIC struct strlist *expsort(struct strlist *); STATIC struct strlist *msort(struct strlist *, int); STATIC int pmatch(char *, char *, int); STATIC char *cvtnum(shinstance *, int, char *); STATIC char *cvtnum64(shinstance *, KI64, char *); /* * Expand shell variables and backquotes inside a here document. */ void expandhere(shinstance *psh, union node *arg, int fd) { psh->herefd = fd; expandarg(psh, arg, (struct arglist *)NULL, 0); xwrite(psh, fd, stackblock(psh), psh->expdest - stackblock(psh)); } /* * Perform variable substitution and command substitution on an argument, * placing the resulting list of arguments in arglist. If EXP_FULL is true, * perform splitting and file name expansion. When arglist is NULL, perform * here document expansion. */ void expandarg(shinstance *psh, union node *arg, struct arglist *arglist, int flag) { struct strlist *sp; char *p; psh->argbackq = arg->narg.backquote; STARTSTACKSTR(psh, psh->expdest); psh->ifsfirst.next = NULL; psh->ifslastp = NULL; argstr(psh, arg->narg.text, flag); if (arglist == NULL) { return; /* here document expanded */ } STPUTC(psh, '\0', psh->expdest); p = grabstackstr(psh, psh->expdest); TRACE2((psh, "expandarg: p='%s'\n", p)); psh->exparg.lastp = &psh->exparg.list; /* * TODO - EXP_REDIR */ if (flag & EXP_FULL) { ifsbreakup(psh, p, &psh->exparg); *psh->exparg.lastp = NULL; psh->exparg.lastp = &psh->exparg.list; expandmeta(psh, psh->exparg.list, flag); } else { if (flag & EXP_REDIR) /*XXX - for now, just remove escapes */ rmescapes(psh, p); sp = (struct strlist *)stalloc(psh, sizeof (struct strlist)); sp->text = p; *psh->exparg.lastp = sp; psh->exparg.lastp = &sp->next; } ifsfree(psh); *psh->exparg.lastp = NULL; if (psh->exparg.list) { *arglist->lastp = psh->exparg.list; arglist->lastp = psh->exparg.lastp; } } /* * Perform variable and command substitution. * If EXP_FULL is set, output CTLESC characters to allow for further processing. * Otherwise treat $@ like $* since no splitting will be performed. */ STATIC void argstr(shinstance *psh, char *p, int flag) { char c; int quotes = flag & (EXP_FULL | EXP_CASE); /* do CTLESC */ int firsteq = 1; const char *ifs = NULL; int ifs_split = EXP_IFS_SPLIT; if (flag & EXP_IFS_SPLIT) ifs = ifsset(psh) ? ifsval(psh) : " \t\n"; if (*p == '~' && (flag & (EXP_TILDE | EXP_VARTILDE))) p = exptilde(psh, p, flag); for (;;) { switch (c = *p++) { case '\0': case CTLENDVAR: /* end of expanding yyy in ${xxx-yyy} */ return; case CTLQUOTEMARK: /* "$@" syntax adherence hack */ if (p[0] == CTLVAR && p[2] == '@' && p[3] == '=') break; if ((flag & EXP_FULL) != 0) STPUTC(psh, c, psh->expdest); ifs_split = 0; break; case CTLQUOTEEND: ifs_split = EXP_IFS_SPLIT; break; case CTLESC: if (quotes) STPUTC(psh, c, psh->expdest); c = *p++; STPUTC(psh, c, psh->expdest); break; case CTLVAR: p = evalvar(psh, p, (flag & ~EXP_IFS_SPLIT) | (flag & ifs_split)); break; case CTLBACKQ: case CTLBACKQ|CTLQUOTE: expbackq(psh, psh->argbackq->n, c & CTLQUOTE, flag); psh->argbackq = psh->argbackq->next; break; case CTLENDARI: expari(psh, flag); break; case ':': case '=': /* * sort of a hack - expand tildes in variable * assignments (after the first '=' and after ':'s). */ STPUTC(psh, c, psh->expdest); if (flag & EXP_VARTILDE && *p == '~') { if (c == '=') { if (firsteq) firsteq = 0; else break; } p = exptilde(psh, p, flag); } break; default: STPUTC(psh, c, psh->expdest); if (flag & EXP_IFS_SPLIT & ifs_split && strchr(ifs, c) != NULL) { /* We need to get the output split here... */ recordregion(psh, (int)(psh->expdest - stackblock(psh) - 1), (int)(psh->expdest - stackblock(psh)), 0); } break; } } } STATIC char * exptilde(shinstance *psh, char *p, int flag) { char c, *startp = p; const char *home; int quotes = flag & (EXP_FULL | EXP_CASE); while ((c = *p) != '\0') { switch(c) { case CTLESC: return (startp); case CTLQUOTEMARK: return (startp); case ':': if (flag & EXP_VARTILDE) goto done; break; case '/': goto done; } p++; } done: *p = '\0'; if (*(startp+1) == '\0') { if ((home = lookupvar(psh, "HOME")) == NULL) goto lose; } else { if ((home = sh_gethomedir(psh, startp+1)) == NULL) goto lose; } if (*home == '\0') goto lose; *p = c; while ((c = *home++) != '\0') { if (quotes && SQSYNTAX[(int)c] == CCTL) STPUTC(psh, CTLESC, psh->expdest); STPUTC(psh, c, psh->expdest); } return (p); lose: *p = c; return (startp); } STATIC void removerecordregions(shinstance *psh, int endoff) { if (psh->ifslastp == NULL) return; if (psh->ifsfirst.endoff > endoff) { while (psh->ifsfirst.next != NULL) { struct ifsregion *ifsp; INTOFF; ifsp = psh->ifsfirst.next->next; ckfree(psh, psh->ifsfirst.next); psh->ifsfirst.next = ifsp; INTON; } if (psh->ifsfirst.begoff > endoff) psh->ifslastp = NULL; else { psh->ifslastp = &psh->ifsfirst; psh->ifsfirst.endoff = endoff; } return; } psh->ifslastp = &psh->ifsfirst; while (psh->ifslastp->next && psh->ifslastp->next->begoff < endoff) psh->ifslastp=psh->ifslastp->next; while (psh->ifslastp->next != NULL) { struct ifsregion *ifsp; INTOFF; ifsp = psh->ifslastp->next->next; ckfree(psh, psh->ifslastp->next); psh->ifslastp->next = ifsp; INTON; } if (psh->ifslastp->endoff > endoff) psh->ifslastp->endoff = endoff; } /* * Expand arithmetic expression. Backup to start of expression, * evaluate, place result in (backed up) result, adjust string position. */ STATIC void expari(shinstance *psh, int flag) { char *p, *start; int result; int begoff; int quotes = flag & (EXP_FULL | EXP_CASE); int quoted; /* ifsfree(); */ /* * This routine is slightly over-complicated for * efficiency. First we make sure there is * enough space for the result, which may be bigger * than the expression if we add exponentation. Next we * scan backwards looking for the start of arithmetic. If the * next previous character is a CTLESC character, then we * have to rescan starting from the beginning since CTLESC * characters have to be processed left to right. */ #if INT_MAX / 1000000000 >= 10 || INT_MIN / 1000000000 <= -10 #error "integers with more than 10 digits are not supported" #endif CHECKSTRSPACE(psh, 12 - 2, psh->expdest); USTPUTC(psh, '\0', psh->expdest); start = stackblock(psh); p = psh->expdest - 1; while (*p != CTLARI && p >= start) --p; if (*p != CTLARI) error(psh, "missing CTLARI (shouldn't happen)"); if (p > start && *(p-1) == CTLESC) for (p = start; *p != CTLARI; p++) if (*p == CTLESC) p++; if (p[1] == '"') quoted=1; else quoted=0; begoff = (int)(p - start); removerecordregions(psh, begoff); if (quotes) rmescapes(psh, p+2); result = arith(psh, p+2); fmtstr(p, 12, "%d", result); while (*p++) ; if (quoted == 0) recordregion(psh, begoff, (int)(p - 1 - start), 0); result = (int)(psh->expdest - p + 1); STADJUST(psh, -result, psh->expdest); } /* * Expand stuff in backwards quotes. */ STATIC void expbackq(shinstance *psh, union node *cmd, int quoted, int flag) { struct backcmd in; int i; char buf[128]; char *p; char *dest = psh->expdest; struct ifsregion saveifs, *savelastp; struct nodelist *saveargbackq; char lastc; int startloc = (int)(dest - stackblock(psh)); char const *syntax = quoted? DQSYNTAX : BASESYNTAX; int saveherefd; int quotes = flag & (EXP_FULL | EXP_CASE); #ifdef SH_DEAL_WITH_CRLF int pending_cr = 0; #endif INTOFF; saveifs = psh->ifsfirst; savelastp = psh->ifslastp; saveargbackq = psh->argbackq; saveherefd = psh->herefd; psh->herefd = -1; p = grabstackstr(psh, dest); evalbackcmd(psh, cmd, &in); ungrabstackstr(psh, p, dest); psh->ifsfirst = saveifs; psh->ifslastp = savelastp; psh->argbackq = saveargbackq; psh->herefd = saveherefd; p = in.buf; lastc = '\0'; for (;;) { if (--in.nleft < 0) { if (in.fd < 0) break; while ((i = shfile_read(&psh->fdtab, in.fd, buf, sizeof buf)) < 0 && errno == EINTR); TRACE((psh, "expbackq: read returns %d\n", i)); if (i <= 0) break; p = buf; in.nleft = i - 1; } lastc = *p++; #ifdef SH_DEAL_WITH_CRLF if (pending_cr) { pending_cr = 0; if (lastc != '\n') { if (quotes && syntax[(int)'\r'] == CCTL) STPUTC(psh, CTLESC, dest); STPUTC(psh, '\r', dest); } } if (lastc == '\r') pending_cr = '\r'; else #endif if (lastc != '\0') { if (quotes && syntax[(int)lastc] == CCTL) STPUTC(psh, CTLESC, dest); STPUTC(psh, lastc, dest); } } #ifdef SH_DEAL_WITH_CRLF if (pending_cr) { if (quotes && syntax[(int)'\r'] == CCTL) STPUTC(psh, CTLESC, dest); STPUTC(psh, '\r', dest); } #endif /* Eat all trailing newlines */ p = stackblock(psh) + startloc; while (dest > p && dest[-1] == '\n') STUNPUTC(psh, dest); if (in.fd >= 0) shfile_close(&psh->fdtab, in.fd); if (in.buf) ckfree(psh, in.buf); if (in.jp) psh->back_exitstatus = waitforjob(psh, in.jp); if (quoted == 0) recordregion(psh, startloc, (int)(dest - stackblock(psh)), 0); TRACE((psh, "evalbackq: size=%d: \"%.*s\"\n", (dest - stackblock(psh)) - startloc, (dest - stackblock(psh)) - startloc, stackblock(psh) + startloc)); psh->expdest = dest; INTON; } STATIC int subevalvar(shinstance *psh, char *p, char *str, int strloc, int subtype, int startloc, int varflags) { char *startp; char *loc = NULL; char *q; int c = 0; int saveherefd = psh->herefd; struct nodelist *saveargbackq = psh->argbackq; int amount; psh->herefd = -1; argstr(psh, p, 0); STACKSTRNUL(psh, psh->expdest); psh->herefd = saveherefd; psh->argbackq = saveargbackq; startp = stackblock(psh) + startloc; if (str == NULL) str = stackblock(psh) + strloc; switch (subtype) { case VSASSIGN: setvar(psh, str, startp, 0); amount = (int)(startp - psh->expdest); STADJUST(psh, amount, psh->expdest); varflags &= ~VSNUL; if (c != 0) *loc = c; return 1; case VSQUESTION: if (*p != CTLENDVAR) { outfmt(&psh->errout, "%s\n", startp); error(psh, (char *)NULL); } error(psh, "%.*s: parameter %snot set", p - str - 1, str, (varflags & VSNUL) ? "null or " : nullstr); /* NOTREACHED */ case VSTRIMLEFT: for (loc = startp; loc < str; loc++) { c = *loc; *loc = '\0'; if (patmatch(psh, str, startp, varflags & VSQUOTE)) goto recordleft; *loc = c; if ((varflags & VSQUOTE) && *loc == CTLESC) loc++; } return 0; case VSTRIMLEFTMAX: for (loc = str - 1; loc >= startp;) { c = *loc; *loc = '\0'; if (patmatch(psh, str, startp, varflags & VSQUOTE)) goto recordleft; *loc = c; loc--; if ((varflags & VSQUOTE) && loc > startp && *(loc - 1) == CTLESC) { for (q = startp; q < loc; q++) if (*q == CTLESC) q++; if (q > loc) loc--; } } return 0; case VSTRIMRIGHT: for (loc = str - 1; loc >= startp;) { if (patmatch(psh, str, loc, varflags & VSQUOTE)) goto recordright; loc--; if ((varflags & VSQUOTE) && loc > startp && *(loc - 1) == CTLESC) { for (q = startp; q < loc; q++) if (*q == CTLESC) q++; if (q > loc) loc--; } } return 0; case VSTRIMRIGHTMAX: for (loc = startp; loc < str - 1; loc++) { if (patmatch(psh, str, loc, varflags & VSQUOTE)) goto recordright; if ((varflags & VSQUOTE) && *loc == CTLESC) loc++; } return 0; default: sh_abort(psh); } recordleft: *loc = c; amount = (int)(((str - 1) - (loc - startp)) - psh->expdest); STADJUST(psh, amount, psh->expdest); while (loc != str - 1) *startp++ = *loc++; return 1; recordright: amount = (int)(loc - psh->expdest); STADJUST(psh, amount, psh->expdest); STPUTC(psh, '\0', psh->expdest); STADJUST(psh, -1, psh->expdest); return 1; } /* * Expand a variable, and return a pointer to the next character in the * input string. */ STATIC char * evalvar(shinstance *psh, char *p, int flag) { int subtype; int varflags; char *var; char *val; int patloc; int c; int set; int special; int startloc; int varlen; int apply_ifs; int quotes = flag & (EXP_FULL | EXP_CASE); varflags = (unsigned char)*p++; subtype = varflags & VSTYPE; var = p; special = !is_name(*p); p = strchr(p, '=') + 1; again: /* jump here after setting a variable with ${var=text} */ if (special) { set = varisset(psh, var, varflags & VSNUL); val = NULL; } else { val = lookupvar(psh, var); if (val == NULL || ((varflags & VSNUL) && val[0] == '\0')) { val = NULL; set = 0; } else set = 1; } varlen = 0; startloc = (int)(psh->expdest - stackblock(psh)); if (!set && uflag(psh)) { switch (subtype) { case VSNORMAL: case VSTRIMLEFT: case VSTRIMLEFTMAX: case VSTRIMRIGHT: case VSTRIMRIGHTMAX: case VSLENGTH: error(psh, "%.*s: parameter not set", p - var - 1, var); /* NOTREACHED */ } } if (set && subtype != VSPLUS) { /* insert the value of the variable */ if (special) { varvalue(psh, var, varflags & VSQUOTE, subtype, flag); if (subtype == VSLENGTH) { varlen = (int)(psh->expdest - stackblock(psh) - startloc); STADJUST(psh, -varlen, psh->expdest); } } else { char const *syntax = (varflags & VSQUOTE) ? DQSYNTAX : BASESYNTAX; if (subtype == VSLENGTH) { for (;*val; val++) varlen++; } else { while (*val) { if (quotes && syntax[(int)*val] == CCTL) STPUTC(psh, CTLESC, psh->expdest); STPUTC(psh, *val++, psh->expdest); } } } } apply_ifs = ((varflags & VSQUOTE) == 0 || (*var == '@' && psh->shellparam.nparam != 1)); switch (subtype) { case VSLENGTH: psh->expdest = cvtnum(psh, varlen, psh->expdest); break; case VSNORMAL: break; case VSPLUS: set = !set; /* FALLTHROUGH */ case VSMINUS: if (!set) { argstr(psh, p, flag | (apply_ifs ? EXP_IFS_SPLIT : 0)); /* * ${x-a b c} doesn't get split, but removing the * 'apply_ifs = 0' apparantly breaks ${1+"$@"}.. * ${x-'a b' c} should generate 2 args. */ /* We should have marked stuff already */ apply_ifs = 0; } break; case VSTRIMLEFT: case VSTRIMLEFTMAX: case VSTRIMRIGHT: case VSTRIMRIGHTMAX: if (!set) break; /* * Terminate the string and start recording the pattern * right after it */ STPUTC(psh, '\0', psh->expdest); patloc = (int)(psh->expdest - stackblock(psh)); if (subevalvar(psh, p, NULL, patloc, subtype, startloc, varflags) == 0) { int amount = (int)(psh->expdest - stackblock(psh) - patloc) + 1; STADJUST(psh, -amount, psh->expdest); } /* Remove any recorded regions beyond start of variable */ removerecordregions(psh, startloc); apply_ifs = 1; break; case VSASSIGN: case VSQUESTION: if (set) break; if (subevalvar(psh, p, var, 0, subtype, startloc, varflags)) { varflags &= ~VSNUL; /* * Remove any recorded regions beyond * start of variable */ removerecordregions(psh, startloc); goto again; } apply_ifs = 0; break; default: sh_abort(psh); } if (apply_ifs) recordregion(psh, startloc, (int)(psh->expdest - stackblock(psh)), varflags & VSQUOTE); if (subtype != VSNORMAL) { /* skip to end of alternative */ int nesting = 1; for (;;) { if ((c = *p++) == CTLESC) p++; else if (c == CTLBACKQ || c == (CTLBACKQ|CTLQUOTE)) { if (set) psh->argbackq = psh->argbackq->next; } else if (c == CTLVAR) { if ((*p++ & VSTYPE) != VSNORMAL) nesting++; } else if (c == CTLENDVAR) { if (--nesting == 0) break; } } } return p; } /* * Test whether a specialized variable is set. */ STATIC int varisset(shinstance *psh, char *name, int nulok) { if (*name == '!') return psh->backgndpid != -1; else if (*name == '@' || *name == '*') { if (*psh->shellparam.p == NULL) return 0; if (nulok) { char **av; for (av = psh->shellparam.p; *av; av++) if (**av != '\0') return 1; return 0; } } else if (is_digit(*name)) { char *ap; int num = atoi(name); if (num > psh->shellparam.nparam) return 0; if (num == 0) ap = psh->arg0; else ap = psh->shellparam.p[num - 1]; if (nulok && (ap == NULL || *ap == '\0')) return 0; } return 1; } /* * Add the value of a specialized variable to the stack string. */ STATIC void varvalue(shinstance *psh, char *name, int quoted, int subtype, int flag) { int num; char *p; int i; char sep; char **ap; char const *syntax; #define STRTODEST(p) \ do {\ if (flag & (EXP_FULL | EXP_CASE) && subtype != VSLENGTH) { \ syntax = quoted? DQSYNTAX : BASESYNTAX; \ while (*p) { \ if (syntax[(int)*p] == CCTL) \ STPUTC(psh, CTLESC, psh->expdest); \ STPUTC(psh, *p++, psh->expdest); \ } \ } else \ while (*p) \ STPUTC(psh, *p++, psh->expdest); \ } while (0) switch (*name) { case '$': #ifndef SH_FORKED_MODE psh->expdest = cvtnum64(psh, psh->rootpid, psh->expdest); break; #else num = psh->rootpid; goto numvar; #endif case '?': num = psh->exitstatus; goto numvar; case '#': num = psh->shellparam.nparam; numvar: psh->expdest = cvtnum(psh, num, psh->expdest); break; case '!': #ifndef SH_FORKED_MODE psh->expdest = cvtnum64(psh, psh->backgndpid, psh->expdest); break; #else num = psh->backgndpid; goto numvar; #endif case '-': for (i = 0; psh->optlist[i].name; i++) { if (psh->optlist[i].val) STPUTC(psh, psh->optlist[i].letter, psh->expdest); } break; case '@': if (flag & EXP_FULL && quoted) { for (ap = psh->shellparam.p ; (p = *ap++) != NULL ; ) { STRTODEST(p); if (*ap) STPUTC(psh, '\0', psh->expdest); } break; } /* fall through */ case '*': if (ifsset(psh) != 0) sep = ifsval(psh)[0]; else sep = ' '; for (ap = psh->shellparam.p ; (p = *ap++) != NULL ; ) { STRTODEST(p); if (*ap && sep) STPUTC(psh, sep, psh->expdest); } break; case '0': p = psh->arg0; STRTODEST(p); break; default: if (is_digit(*name)) { num = atoi(name); if (num > 0 && num <= psh->shellparam.nparam) { p = psh->shellparam.p[num - 1]; STRTODEST(p); } } break; } } /* * Record the fact that we have to scan this region of the * string for IFS characters. */ STATIC void recordregion(shinstance *psh, int start, int end, int inquotes) { struct ifsregion *ifsp; if (psh->ifslastp == NULL) { ifsp = &psh->ifsfirst; } else { if (psh->ifslastp->endoff == start && psh->ifslastp->inquotes == inquotes) { /* extend previous area */ psh->ifslastp->endoff = end; return; } ifsp = (struct ifsregion *)ckmalloc(psh, sizeof (struct ifsregion)); psh->ifslastp->next = ifsp; } psh->ifslastp = ifsp; psh->ifslastp->next = NULL; psh->ifslastp->begoff = start; psh->ifslastp->endoff = end; psh->ifslastp->inquotes = inquotes; } /* * Break the argument string into pieces based upon IFS and add the * strings to the argument list. The regions of the string to be * searched for IFS characters have been stored by recordregion. */ STATIC void ifsbreakup(shinstance *psh, char *string, struct arglist *arglist) { struct ifsregion *ifsp; struct strlist *sp; char *start; char *p; char *q; const char *ifs; const char *ifsspc; int inquotes; start = string; ifsspc = NULL; inquotes = 0; if (psh->ifslastp == NULL) { /* Return entire argument, IFS doesn't apply to any of it */ sp = (struct strlist *)stalloc(psh, sizeof *sp); sp->text = start; *arglist->lastp = sp; arglist->lastp = &sp->next; return; } ifs = ifsset(psh) ? ifsval(psh) : " \t\n"; for (ifsp = &psh->ifsfirst; ifsp != NULL; ifsp = ifsp->next) { p = string + ifsp->begoff; inquotes = ifsp->inquotes; ifsspc = NULL; while (p < string + ifsp->endoff) { q = p; if (*p == CTLESC) p++; if (inquotes) { /* Only NULs (probably from "$@") end args */ if (*p != 0) { p++; continue; } } else { if (!strchr(ifs, *p)) { p++; continue; } ifsspc = strchr(" \t\n", *p); /* Ignore IFS whitespace at start */ if (q == start && ifsspc != NULL) { p++; start = p; continue; } } /* Save this argument... */ *q = '\0'; sp = (struct strlist *)stalloc(psh, sizeof *sp); sp->text = start; *arglist->lastp = sp; arglist->lastp = &sp->next; p++; if (ifsspc != NULL) { /* Ignore further trailing IFS whitespace */ for (; p < string + ifsp->endoff; p++) { q = p; if (*p == CTLESC) p++; if (strchr(ifs, *p) == NULL) { p = q; break; } if (strchr(" \t\n", *p) == NULL) { p++; break; } } } start = p; } } /* * Save anything left as an argument. * Traditionally we have treated 'IFS=':'; set -- x$IFS' as * generating 2 arguments, the second of which is empty. * Some recent clarification of the Posix spec say that it * should only generate one.... */ if (*start /* || (!ifsspc && start > string) */) { sp = (struct strlist *)stalloc(psh, sizeof *sp); sp->text = start; *arglist->lastp = sp; arglist->lastp = &sp->next; } } STATIC void ifsfree(shinstance *psh) { while (psh->ifsfirst.next != NULL) { struct ifsregion *ifsp; INTOFF; ifsp = psh->ifsfirst.next->next; ckfree(psh, psh->ifsfirst.next); psh->ifsfirst.next = ifsp; INTON; } psh->ifslastp = NULL; psh->ifsfirst.next = NULL; } /* * Expand shell metacharacters. At this point, the only control characters * should be escapes. The results are stored in the list psh->exparg. */ //char *expdir; STATIC void expandmeta(shinstance *psh, struct strlist *str, int flag) { char *p; struct strlist **savelastp; struct strlist *sp; char c; /* TODO - EXP_REDIR */ while (str) { if (fflag(psh)) goto nometa; p = str->text; for (;;) { /* fast check for meta chars */ if ((c = *p++) == '\0') goto nometa; if (c == '*' || c == '?' || c == '[' || c == '!') break; } savelastp = psh->exparg.lastp; INTOFF; if (psh->expdir == NULL) { size_t i = strlen(str->text); psh->expdir = ckmalloc(psh, i < 2048 ? 2048 : i); /* XXX */ } expmeta(psh, psh->expdir, str->text); ckfree(psh, psh->expdir); psh->expdir = NULL; INTON; if (psh->exparg.lastp == savelastp) { /* * no matches */ nometa: *psh->exparg.lastp = str; rmescapes(psh, str->text); psh->exparg.lastp = &str->next; } else { *psh->exparg.lastp = NULL; *savelastp = sp = expsort(*savelastp); while (sp->next != NULL) sp = sp->next; psh->exparg.lastp = &sp->next; } str = str->next; } } /* * Do metacharacter (i.e. *, ?, [...]) expansion. */ STATIC void expmeta(shinstance *psh, char *enddir, char *name) { char *p; const char *cp; char *q; char *start; char *endname; int metaflag; struct stat statb; shdir *dirp; shdirent *dp; int atend; int matchdot; metaflag = 0; start = name; for (p = name ; ; p++) { if (*p == '*' || *p == '?') metaflag = 1; else if (*p == '[') { q = p + 1; if (*q == '!') q++; for (;;) { while (*q == CTLQUOTEMARK) q++; if (*q == CTLESC) q++; if (*q == '/' || *q == '\0') break; if (*++q == ']') { metaflag = 1; break; } } } else if (*p == '!' && p[1] == '!' && (p == name || p[-1] == '/')) { metaflag = 1; } else if (*p == '\0') break; else if (*p == CTLQUOTEMARK) continue; else if (*p == CTLESC) p++; if (*p == '/') { if (metaflag) break; start = p + 1; } } if (metaflag == 0) { /* we've reached the end of the file name */ if (enddir != psh->expdir) metaflag++; for (p = name ; ; p++) { if (*p == CTLQUOTEMARK) continue; if (*p == CTLESC) p++; *enddir++ = *p; if (*p == '\0') break; } if (metaflag == 0 || shfile_lstat(&psh->fdtab, psh->expdir, &statb) >= 0) addfname(psh, psh->expdir); TRACE2((psh, "expandarg: return #1 (metaflag=%d)\n", metaflag)); return; } endname = p; if (start != name) { p = name; while (p < start) { while (*p == CTLQUOTEMARK) p++; if (*p == CTLESC) p++; *enddir++ = *p++; } } if (enddir == psh->expdir) { cp = "."; } else if (enddir == psh->expdir + 1 && *psh->expdir == '/') { cp = "/"; } else { cp = psh->expdir; enddir[-1] = '\0'; } if ((dirp = shfile_opendir(&psh->fdtab, cp)) == NULL) { TRACE2((psh, "expandarg: return #2 (shfile_opendir(,%s) failed)\n", cp)); return; } if (enddir != psh->expdir) enddir[-1] = '/'; if (*endname == 0) { atend = 1; } else { atend = 0; *endname++ = '\0'; } matchdot = 0; p = start; while (*p == CTLQUOTEMARK) p++; if (*p == CTLESC) p++; if (*p == '.') matchdot++; while (! int_pending() && (dp = shfile_readdir(dirp)) != NULL) { if (dp->name[0] == '.' && ! matchdot) continue; if (patmatch(psh, start, dp->name, 0)) { if (atend) { scopy(dp->name, enddir); addfname(psh, psh->expdir); } else { for (p = enddir, cp = dp->name; (*p++ = *cp++) != '\0';) continue; p[-1] = '/'; expmeta(psh, p, endname); } } } shfile_closedir(dirp); if (! atend) endname[-1] = '/'; } /* * Add a file name to the list. */ STATIC void addfname(shinstance *psh, char *name) { char *p; struct strlist *sp; p = stalloc(psh, strlen(name) + 1); scopy(name, p); sp = (struct strlist *)stalloc(psh, sizeof *sp); sp->text = p; *psh->exparg.lastp = sp; psh->exparg.lastp = &sp->next; } /* * Sort the results of file name expansion. It calculates the number of * strings to sort and then calls msort (short for merge sort) to do the * work. */ STATIC struct strlist * expsort(struct strlist *str) { int len; struct strlist *sp; len = 0; for (sp = str ; sp ; sp = sp->next) len++; return msort(str, len); } STATIC struct strlist * msort(struct strlist *list, int len) { struct strlist *p, *q = NULL; struct strlist **lpp; int half; int n; if (len <= 1) return list; half = len >> 1; p = list; for (n = half ; --n >= 0 ; ) { q = p; p = p->next; } q->next = NULL; /* terminate first half of list */ q = msort(list, half); /* sort first half of list */ p = msort(p, len - half); /* sort second half */ lpp = &list; for (;;) { if (strcmp(p->text, q->text) < 0) { *lpp = p; lpp = &p->next; if ((p = *lpp) == NULL) { *lpp = q; break; } } else { *lpp = q; lpp = &q->next; if ((q = *lpp) == NULL) { *lpp = p; break; } } } return list; } /* * Returns true if the pattern matches the string. */ int patmatch(shinstance *psh, char *pattern, char *string, int squoted) { #ifdef notdef if (pattern[0] == '!' && pattern[1] == '!') return 1 - pmatch(pattern + 2, string); else #endif return pmatch(pattern, string, squoted); } STATIC int pmatch(char *pattern, char *string, int squoted) { char *p, *q; char c; p = pattern; q = string; for (;;) { switch (c = *p++) { case '\0': goto breakloop; case CTLESC: if (squoted && *q == CTLESC) q++; if (*q++ != *p++) return 0; break; case CTLQUOTEMARK: continue; case '?': if (squoted && *q == CTLESC) q++; if (*q++ == '\0') return 0; break; case '*': c = *p; while (c == CTLQUOTEMARK || c == '*') c = *++p; if (c != CTLESC && c != CTLQUOTEMARK && c != '?' && c != '*' && c != '[') { while (*q != c) { if (squoted && *q == CTLESC && q[1] == c) break; if (*q == '\0') return 0; if (squoted && *q == CTLESC) q++; q++; } } do { if (pmatch(p, q, squoted)) return 1; if (squoted && *q == CTLESC) q++; } while (*q++ != '\0'); return 0; case '[': { char *endp; int invert, found; char chr; endp = p; if (*endp == '!') endp++; for (;;) { while (*endp == CTLQUOTEMARK) endp++; if (*endp == '\0') goto dft; /* no matching ] */ if (*endp == CTLESC) endp++; if (*++endp == ']') break; } invert = 0; if (*p == '!') { invert++; p++; } found = 0; chr = *q++; if (squoted && chr == CTLESC) chr = *q++; if (chr == '\0') return 0; c = *p++; do { if (c == CTLQUOTEMARK) continue; if (c == CTLESC) c = *p++; if (*p == '-' && p[1] != ']') { p++; while (*p == CTLQUOTEMARK) p++; if (*p == CTLESC) p++; if (chr >= c && chr <= *p) found = 1; p++; } else { if (chr == c) found = 1; } } while ((c = *p++) != ']'); if (found == invert) return 0; break; } dft: default: if (squoted && *q == CTLESC) q++; if (*q++ != c) return 0; break; } } breakloop: if (*q != '\0') return 0; return 1; } /* * Remove any CTLESC characters from a string. */ void rmescapes(shinstance *psh, char *str) { char *p, *q; p = str; while (*p != CTLESC && *p != CTLQUOTEMARK) { if (*p++ == '\0') return; } q = p; while (*p) { if (*p == CTLQUOTEMARK) { p++; continue; } if (*p == CTLESC) p++; *q++ = *p++; } *q = '\0'; } /* * See if a pattern matches in a case statement. */ int casematch(shinstance *psh, union node *pattern, char *val) { struct stackmark smark; int result; char *p; setstackmark(psh, &smark); psh->argbackq = pattern->narg.backquote; STARTSTACKSTR(psh, psh->expdest); psh->ifslastp = NULL; argstr(psh, pattern->narg.text, EXP_TILDE | EXP_CASE); STPUTC(psh, '\0', psh->expdest); p = grabstackstr(psh, psh->expdest); result = patmatch(psh, p, val, 0); popstackmark(psh, &smark); return result; } /* * Our own itoa(). */ STATIC char * cvtnum(shinstance *psh, int num, char *buf) { char temp[32]; char *p = &temp[sizeof(temp) - 1]; int neg = num < 0; if (neg) num = -num; *p = '\0'; do { *--p = num % 10 + '0'; } while ((num /= 10) != 0); if (neg) *--p = '-'; while (*p) STPUTC(psh, *p++, buf); return buf; } STATIC char * cvtnum64(shinstance *psh, KI64 num, char *buf) { char temp[32]; char *p = &temp[sizeof(temp) - 1]; int neg = num < 0; if (neg) num = -num; *p = '\0'; do { *--p = num % 10 + '0'; } while ((num /= 10) != 0); if (neg) *--p = '-'; while (*p) STPUTC(psh, *p++, buf); return buf; } /* * Do most of the work for wordexp(3). */ int wordexpcmd(shinstance *psh, int argc, char **argv) { size_t len; int i; out1fmt(psh, "%d", argc - 1); out1c(psh, '\0'); for (i = 1, len = 0; i < argc; i++) len += strlen(argv[i]); out1fmt(psh, "%zd", len); out1c(psh, '\0'); for (i = 1; i < argc; i++) { out1str(psh, argv[i]); out1c(psh, '\0'); } return (0); } kbuild-3608/src/kash/redir.c0000664000175000017500000002727614670377416015731 0ustar locutuslocutus/* $NetBSD: redir.c,v 1.29 2004/07/08 03:57:33 christos Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)redir.c 8.2 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: redir.c,v 1.29 2004/07/08 03:57:33 christos Exp $"); #endif /* not lint */ #endif #include #include /* PIPE_BUF */ #include #include #include #include /* * Code for dealing with input/output redirection. */ #include "main.h" #include "shell.h" #include "nodes.h" #include "jobs.h" #include "options.h" #include "expand.h" #include "redir.h" #include "output.h" #include "memalloc.h" #include "error.h" #include "shinstance.h" #define EMPTY -2 /* marks an unused slot in redirtab */ #define PIPESIZE SHFILE_PIPE_SIZE //MKINIT struct redirtab *redirlist; /* * We keep track of whether or not fd0 has been redirected. This is for * background commands, where we want to redirect fd0 to /dev/null only * if it hasn't already been redirected. */ //int fd0_redirected = 0; STATIC void openredirect(shinstance *, union node *, char[10], int, const char *); STATIC int openhere(shinstance *, union node *); #ifndef SH_FORKED_MODE void subshellinitredir(shinstance *psh, shinstance *inherit) { /* We can have a redirlist here if we're handling backtick while expanding arguments, just copy it even if the subshell probably doesn't need it. */ struct redirtab *src = inherit->redirlist; if (src) { struct redirtab **dstp = &psh->redirlist; do { struct redirtab *dst = ckmalloc(psh, sizeof(*dst)); memcpy(dst->renamed, src->renamed, sizeof(dst->renamed)); *dstp = dst; dstp = &dst->next; src = src->next; } while (src); *dstp = NULL; psh->fd0_redirected = inherit->fd0_redirected; } /* Copy the expanded redirection filenames (stack), but only the last entry as the subshell does not have the ability to unwind stack in the parent and therefore cannot get to the earlier redirection stuff: */ if (inherit->expfnames) { redirexpfnames * const expfnamesrc = inherit->expfnames; unsigned i = expfnamesrc->count; redirexpfnames *dst = stalloc(psh, offsetof(redirexpfnames, names) + sizeof(dst->names[0]) * i); dst->count = i; dst->depth = 1; dst->prev = NULL; while (i-- > 0) dst->names[i] = stsavestr(psh, expfnamesrc->names[i]); psh->expfnames = dst; } } #endif /* !SH_FORKED_MODE */ /* * Process a list of redirection commands. If the REDIR_PUSH flag is set, * old file descriptors are stashed away so that the redirection can be * undone by calling popredir. If the REDIR_BACKQ flag is set, then the * standard output, and the standard error if it becomes a duplicate of * stdout, is saved in memory. */ void redirect(shinstance *psh, union node *redir, int flags) { union node *n; struct redirtab *sv = NULL; int i; int fd; int try; char memory[10]; /* file descriptors to write to memory */ unsigned idxexpfname; for (i = 10 ; --i >= 0 ; ) memory[i] = 0; memory[1] = flags & REDIR_BACKQ; if (flags & REDIR_PUSH) { sv = ckmalloc(psh, sizeof (struct redirtab)); for (i = 0 ; i < 10 ; i++) sv->renamed[i] = EMPTY; sv->next = psh->redirlist; psh->redirlist = sv; } idxexpfname = 0; for (n = redir, idxexpfname = 0 ; n ; n = n->nfile.next, idxexpfname++) { kHlpAssert(idxexpfname < psh->expfnames->count); fd = n->nfile.fd; try = 0; if ((n->nfile.type == NTOFD || n->nfile.type == NFROMFD) && n->ndup.dupfd == fd) continue; /* redirect from/to same file descriptor */ if ((flags & REDIR_PUSH) && sv->renamed[fd] == EMPTY) { INTOFF; again: if ((i = shfile_fcntl(&psh->fdtab, fd, F_DUPFD, 10)) == -1) { switch (errno) { case EBADF: if (!try) { openredirect(psh, n, memory, flags, psh->expfnames->names[idxexpfname]); try++; goto again; } /* FALLTHROUGH*/ default: INTON; error(psh, "%d: %s", fd, sh_strerror(psh, errno)); /* NOTREACHED */ } } if (!try) { sv->renamed[fd] = i; shfile_close(&psh->fdtab, fd); } INTON; } else { shfile_close(&psh->fdtab, fd); } if (fd == 0) psh->fd0_redirected++; if (!try) openredirect(psh, n, memory, flags, psh->expfnames->names[idxexpfname]); } kHlpAssert(!redir || idxexpfname == psh->expfnames->count); if (memory[1]) psh->out1 = &psh->memout; if (memory[2]) psh->out2 = &psh->memout; } STATIC void openredirect(shinstance *psh, union node *redir, char memory[10], int flags, const char *fname) { int fd = redir->nfile.fd; int f; int oflags = O_WRONLY|O_CREAT|O_TRUNC; /* * We suppress interrupts so that we won't leave open file * descriptors around. This may not be such a good idea because * an open of a device or a fifo can block indefinitely. */ INTOFF; memory[fd] = 0; switch (redir->nfile.type) { case NFROM: if ((f = shfile_open(&psh->fdtab, fname, O_RDONLY, 0)) < 0) goto eopen; break; case NFROMTO: if ((f = shfile_open(&psh->fdtab, fname, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) goto ecreate; break; case NTO: if (Cflag(psh)) oflags |= O_EXCL; /* FALLTHROUGH */ case NCLOBBER: if ((f = shfile_open(&psh->fdtab, fname, oflags, 0666)) < 0) goto ecreate; break; case NAPPEND: if ((f = shfile_open(&psh->fdtab, fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0) goto ecreate; break; case NTOFD: case NFROMFD: if (redir->ndup.dupfd >= 0) { /* if not ">&-" */ if (memory[redir->ndup.dupfd]) memory[fd] = 1; else copyfd(psh, redir->ndup.dupfd, fd); } INTON; return; case NHERE: case NXHERE: f = openhere(psh, redir); break; default: sh_abort(psh); } if (f != fd) { movefd(psh, f, fd); } INTON; return; ecreate: error(psh, "cannot create %s: %s", fname, errmsg(psh, errno, E_CREAT)); eopen: error(psh, "cannot open %s: %s", fname, errmsg(psh, errno, E_OPEN)); } #ifdef KASH_USE_FORKSHELL2 struct openherechild { int pip[2]; size_t len; }; static int openhere_child(shinstance *psh, union node *n, void *argp) { struct openherechild args = *(struct openherechild *)argp; shfile_close(&psh->fdtab, args.pip[0]); sh_signal(psh, SIGINT, SH_SIG_IGN); sh_signal(psh, SIGQUIT, SH_SIG_IGN); sh_signal(psh, SIGHUP, SH_SIG_IGN); # ifdef SIGTSTP sh_signal(psh, SIGTSTP, SH_SIG_IGN); # endif sh_signal(psh, SIGPIPE, SH_SIG_DFL); if (n->type == NHERE) xwrite(psh, args.pip[1], n->nhere.doc->narg.text, args.len); else expandhere(psh, n->nhere.doc, args.pip[1]); return 0; } #endif /* KASH_USE_FORKSHELL2*/ /* * Handle here documents. Normally we fork off a process to write the * data to a pipe. If the document is short, we can stuff the data in * the pipe without forking. */ STATIC int openhere(shinstance *psh, union node *redir) { int pip[2]; size_t len = 0; if (shfile_pipe(&psh->fdtab, pip) < 0) error(psh, "Pipe call failed"); if (redir->type == NHERE) { len = strlen(redir->nhere.doc->narg.text); if (len <= PIPESIZE) { xwrite(psh, pip[1], redir->nhere.doc->narg.text, len); goto out; } } #ifdef KASH_USE_FORKSHELL2 { struct openherechild args; args.pip[0] = pip[0]; args.pip[1] = pip[1]; args.len = len; forkshell2(psh, (struct job *)NULL, redir, FORK_NOJOB | FORK_JUST_IO, openhere_child, redir, &args, sizeof(args), NULL); } #else if (forkshell(psh, (struct job *)NULL, (union node *)NULL, FORK_NOJOB) == 0) { shfile_close(&psh->fdtab, pip[0]); sh_signal(psh, SIGINT, SH_SIG_IGN); sh_signal(psh, SIGQUIT, SH_SIG_IGN); sh_signal(psh, SIGHUP, SH_SIG_IGN); #ifdef SIGTSTP sh_signal(psh, SIGTSTP, SH_SIG_IGN); #endif sh_signal(psh, SIGPIPE, SH_SIG_DFL); if (redir->type == NHERE) xwrite(psh, pip[1], redir->nhere.doc->narg.text, len); else expandhere(psh, redir->nhere.doc, pip[1]); sh__exit(psh, 0); } #endif out: shfile_close(&psh->fdtab, pip[1]); return pip[0]; } /* * Undo the effects of the last redirection. */ void popredir(shinstance *psh) { struct redirtab *rp = psh->redirlist; int i; for (i = 0 ; i < 10 ; i++) { if (rp->renamed[i] != EMPTY) { if (i == 0) psh->fd0_redirected--; if (rp->renamed[i] >= 0) { movefd(psh, rp->renamed[i], i); } else { shfile_close(&psh->fdtab, i); } } } INTOFF; psh->redirlist = rp->next; ckfree(psh, rp); INTON; } /* * Undo all redirections. Called on error or interrupt. */ #ifdef mkinit INCLUDE "redir.h" RESET { while (psh->redirlist) popredir(psh); } SHELLPROC { clearredir(psh); } #endif /* Return true if fd 0 has already been redirected at least once. */ int fd0_redirected_p(shinstance *psh) { return psh->fd0_redirected != 0; } /* * Discard all saved file descriptors. */ void clearredir(shinstance *psh) { struct redirtab *rp; int i; for (rp = psh->redirlist ; rp ; rp = rp->next) { for (i = 0 ; i < 10 ; i++) { if (rp->renamed[i] >= 0) { shfile_close(&psh->fdtab, rp->renamed[i]); } rp->renamed[i] = EMPTY; } } } /* * Copy a file descriptor to be >= to. Returns -1 * if the source file descriptor is closed, EMPTY if there are no unused * file descriptors left. */ int copyfd(shinstance *psh, int from, int to) { int newfd; newfd = shfile_fcntl(&psh->fdtab, from, F_DUPFD, to); if (newfd < 0) { if (errno == EMFILE) return EMPTY; error(psh, "%d: %s", from, sh_strerror(psh, errno)); } return newfd; } /* * Move a file descriptor to be == to. Returns -1 * if the source file descriptor is closed, EMPTY if there are no unused * file descriptors left. */ int movefd(shinstance *psh, int from, int to) { int newfd; newfd = shfile_movefd(&psh->fdtab, from, to); if (newfd < 0) { if (errno == EMFILE) return EMPTY; error(psh, "%d: %s", from, sh_strerror(psh, errno)); } return newfd; } /* * Move a file descriptor to be >= to. Returns -1 * if the source file descriptor is closed, EMPTY if there are no unused * file descriptors left. */ int movefd_above(shinstance *psh, int from, int to) { int newfd; newfd = shfile_movefd_above(&psh->fdtab, from, to); if (newfd < 0) { if (errno == EMFILE) return EMPTY; error(psh, "%d: %s", from, sh_strerror(psh, errno)); } return newfd; } kbuild-3608/src/kash/shheap.c0000664000175000017500000003711214670377416016062 0ustar locutuslocutus/* $Id: shheap.c 3477 2020-09-17 21:52:16Z bird $ */ /** @file * The shell memory heap methods. */ /* * Copyright (c) 2009-2010 knut st. osmundsen * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "shheap.h" #include #include #include "shinstance.h" #if K_OS == K_OS_WINDOWS && defined(SH_FORKED_MODE) # define SHHEAP_IN_USE #endif #ifdef SHHEAP_IN_USE # if K_OS == K_OS_WINDOWS # include # else # include # endif #endif /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ #ifdef SHHEAP_IN_USE /** * heap memory block header. */ typedef struct shmemhdr { size_t magic; /**< Magic value */ size_t size; /**< The block size */ struct shmemhdr *next; /**< Forward pointer. */ struct shmemhdr *prev; /**< Backward pointer. */ struct shmemhdr *next2; /**< Free/Shell list forward. */ struct shmemhdr *prev2; /**< Free/Shell list backward. */ struct shinstance *psh; /**< The shell who allocated it. */ struct shmemchunk *chunk; /**< The chunk who owns this. */ } shmemhdr; /** Free block magic (shmemhdr::magic) */ #define SHMEMHDR_MAGIC_FREE 0xbeeff00d /** Used block magic (shmemhdr::magic) */ #define SHMEMHDR_MAGIC_USED 0xfeedface typedef struct shmemchunk { struct shmemhdr *head; /**< Head of the block list. */ struct shmemhdr *free_head; /**< Head of the free list. */ struct shmemchunk *next; /**< The next block. */ struct shmemchunk *prev; /**< The previous block. */ size_t size; /**< Chunk size. */ size_t magic; /**< Magic value. */ size_t padding0; size_t padding1; } shmemchunk; /** shmemchunk::magic */ #define SHMEMCHUNK_MAGIC 0x12345678 #endif /* K_OS_WINDOWS */ /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ #define SHHEAP_ALIGN(sz) (((sz) + 31) & ~(size_t)31) #define SHHEAP_CHUNK_ALIGN(sz) (((sz) + 0xffff) & ~(size_t)0xffff) #define SHHEAP_MIN_CHUNK 0x80000 //(1024*1024) #ifdef NDEBUG # define SHHEAP_CHECK() do { } while (0) # define SHHEAP_CHECK_2() do { } while (0) # define SHHEAP_ASSERT(expr) do { } while (0) # define SHHEAP_POISON_PSH(p,v) (p) # define SHHEAP_POISON_NULL(v) NULL #else # define SHHEAP_CHECK() shheap_check() # define SHHEAP_CHECK_2() shheap_check() # define SHHEAP_ASSERT(expr) kHlpAssert(expr) # define SHHEAP_POISON_PSH(p,v) ((shinstance *)(v)) # define SHHEAP_POISON_NULL(v) ((void *)(v)) #endif /******************************************************************************* * Global Variables * *******************************************************************************/ #ifdef SHHEAP_IN_USE /** The heap lock. */ static shmtx g_sh_heap_mtx; /** The heap. * This is a list of chunks. */ static shmemchunk *g_sh_heap; #endif int shheap_init(void *phead) { int rc; #ifdef SHHEAP_IN_USE SHHEAP_ASSERT(SHHEAP_ALIGN(sizeof(shmemhdr)) == sizeof(shmemhdr)); rc = shmtx_init(&g_sh_heap_mtx); g_sh_heap = (shmemchunk *)phead; /* non-zero on fork() */ #else rc = 0; #endif return rc; } #ifdef SHHEAP_IN_USE # if K_OS == K_OS_WINDOWS /** * Get the head so the child can pass it to shheap_init() after fork(). * * @returns g_sh_heap. */ void *shheap_get_head(void) { return g_sh_heap; } /** * Copies the heap into the child process. * * @returns 0 on success, -1 and errno on failure. * @param hChild Handle to the child process. */ int shheap_fork_copy_to_child(void *hChild) { shmemchunk *chunk; shmtxtmp tmp; int err = 0; shmtx_enter(&g_sh_heap_mtx, &tmp); for (chunk = g_sh_heap; chunk; chunk = chunk->next) { void *chld_chnk; chld_chnk = (shmemchunk *)VirtualAllocEx(hChild, chunk, chunk->size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); if (chld_chnk != chunk) { err = GetLastError(); fprintf(stderr, "shfork: VirtualAllocEx(,%p,%p,) -> %p/%d\n", chunk, chunk->size, chld_chnk, err); break; } if (!WriteProcessMemory(hChild, chunk, chunk, chunk->size, NULL /* pNumberOfBytesWritten */)) { err = GetLastError(); fprintf(stderr, "shfork: WriteProcessMemory(,%p,,%p,) -> %d\n", chunk, chunk->size, err); break; } } shmtx_leave(&g_sh_heap_mtx, &tmp); if (!err) return 0; errno = EINVAL; return -1; } # endif /* K_OS == K_OS_WINDOWS */ /** * Checks a heap chunk. * @param chunk The chunk to check. */ static void shheap_check_chunk(shmemchunk *chunk) { size_t free_count; struct shmemhdr *mem; struct shmemhdr *prev; SHHEAP_ASSERT(chunk->magic == SHMEMCHUNK_MAGIC); SHHEAP_ASSERT(chunk->head); SHHEAP_ASSERT(chunk->size == SHHEAP_CHUNK_ALIGN(chunk->size)); free_count = 0; prev = NULL; for (mem = chunk->head; mem; mem = mem->next) { size_t size = (mem->next ? (char *)mem->next : (char *)chunk + chunk->size) - (char *)(mem + 1); SHHEAP_ASSERT(mem->size == size); SHHEAP_ASSERT(mem->prev == prev); if (mem->magic == SHMEMHDR_MAGIC_FREE) free_count++; else SHHEAP_ASSERT(mem->magic == SHMEMHDR_MAGIC_USED); prev = mem; } prev = NULL; for (mem = chunk->free_head; mem; mem = mem->next2) { size_t size = (mem->next ? (char *)mem->next : (char *)chunk + chunk->size) - (char *)(mem + 1); SHHEAP_ASSERT(mem->size == size); SHHEAP_ASSERT(mem->prev2 == prev); SHHEAP_ASSERT(mem->magic == SHMEMHDR_MAGIC_FREE); free_count--; prev = mem; } SHHEAP_ASSERT(free_count == 0); } /** * Checks the heap. */ static void shheap_check(void) { shmemchunk *chunk; for (chunk = g_sh_heap; chunk; chunk = chunk->next) shheap_check_chunk(chunk); } /** * Grows the heap with another chunk carving out a block * * @returns Pointer to a used entry of size @a size1. NULL * if we're out of memory * @param size1 The size of the block to be returned (aligned). */ static shmemhdr *shheap_grow(size_t size1) { shmemchunk *chunk; shmemhdr *used; shmemhdr *avail; size_t chunk_size; /* Calc the chunk size and allocate it. */ chunk_size = SHHEAP_ALIGN(size1) + SHHEAP_ALIGN(sizeof(*chunk)) + SHHEAP_ALIGN(sizeof(*used)) * 10; if (chunk_size < SHHEAP_MIN_CHUNK) chunk_size = SHHEAP_MIN_CHUNK; else chunk_size = SHHEAP_CHUNK_ALIGN(chunk_size); # if K_OS == K_OS_WINDOWS chunk = (shmemchunk *)VirtualAlloc(NULL, chunk_size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); # else chunk = NULL; # endif if (!chunk) return NULL; used = (shmemhdr *)((char *)chunk + SHHEAP_ALIGN(sizeof(*chunk))); avail = (shmemhdr *)((char *)(used + 1) + size1); used->magic = SHMEMHDR_MAGIC_USED; used->size = size1; used->next = avail; used->prev = NULL; used->next2 = SHHEAP_POISON_NULL(0x41); used->prev2 = SHHEAP_POISON_NULL(0x41); used->psh = NULL; used->chunk = chunk; avail->magic = SHMEMHDR_MAGIC_FREE; avail->size = (char *)chunk + chunk_size - (char *)(avail + 1); avail->next = NULL; avail->prev = used; avail->next2 = NULL; avail->prev2 = NULL; avail->psh = NULL; avail->chunk = chunk; chunk->head = used; chunk->free_head = avail; chunk->size = chunk_size; chunk->magic = SHMEMCHUNK_MAGIC; chunk->prev = NULL; chunk->next = g_sh_heap; if (g_sh_heap) g_sh_heap->prev = chunk; g_sh_heap = chunk; chunk->padding0 = 0; chunk->padding1 = 0; SHHEAP_CHECK_2(); return used; } /*** * Splits a big memory block into two smaller, one with the * size @a size1. * * The one with the given size is removed from the free list * while the other one remains there. * * @returns The @a size1 sized block, NULL on failure. * @param big The block that is too big. * @param size1 The size of the block to be returned (aligned). */ static shmemhdr *shheap_split(shmemhdr *big, size_t size1) { shmemhdr *split; SHHEAP_ASSERT(SHHEAP_ALIGN(sizeof(*big)) == sizeof(*big)); SHHEAP_ASSERT(big->magic == SHMEMHDR_MAGIC_FREE); SHHEAP_ASSERT(!big->next2 || big->next2->magic == SHMEMHDR_MAGIC_FREE); SHHEAP_ASSERT(!big->prev2 || big->prev2->magic == SHMEMHDR_MAGIC_FREE); split = (shmemhdr *)((uint8_t *)(big + 1) + size1); split->magic = SHMEMHDR_MAGIC_FREE; split->size = big->size - size1 - sizeof(*split); split->next = big->next; split->prev = big; split->next2 = big->next2; split->prev2 = big->prev2; split->psh = SHHEAP_POISON_NULL(0x54); split->chunk = big->chunk; if (big->next2) big->next2->prev2 = split; if (big->prev2) big->prev2->next2 = split; else big->chunk->free_head = split; big->magic = SHMEMHDR_MAGIC_USED; big->next2 = big->prev2 = SHHEAP_POISON_NULL(0x41); if (big->next) big->next->prev = split; big->next = split; big->size = size1; SHHEAP_CHECK_2(); return big; } /*** * Unlinks a free memory block. * @param mem The block to unlink. */ static void shheap_unlink_free(shmemhdr *mem) { if (mem->next2) mem->next2->prev2 = mem->prev2; if (mem->prev2) mem->prev2->next2 = mem->next2; else mem->chunk->free_head = mem->next2; mem->magic = SHMEMHDR_MAGIC_USED; mem->next2 = mem->prev2 = SHHEAP_POISON_NULL(0x42); } #endif /* SHHEAP_IN_USE */ /** free() */ void sh_free(shinstance *psh, void *ptr) { #ifdef SHHEAP_IN_USE shmemhdr *mem; shmemhdr *right; shmemhdr *left; shmtxtmp tmp; if (ptr) mem = (shmemhdr *)ptr - 1; else return; if (mem->magic != SHMEMHDR_MAGIC_USED) { SHHEAP_ASSERT(0); return; } shmtx_enter(&g_sh_heap_mtx, &tmp); SHHEAP_CHECK(); /* join right. */ right = mem->next; if ( right && right->magic == SHMEMHDR_MAGIC_FREE) { mem->next = right->next; if (right->next) right->next->prev = mem; mem->next2 = right->next2; if (right->next2) right->next2->prev2 = mem; mem->prev2 = right->prev2; if (right->prev2) mem->prev2->next2 = mem; else mem->chunk->free_head = mem; mem->size += sizeof(*right) + right->size; mem->magic = SHMEMHDR_MAGIC_FREE; right->magic = ~SHMEMHDR_MAGIC_FREE; mem->psh = SHHEAP_POISON_NULL(0x50); SHHEAP_CHECK_2(); } /* join left */ left = mem->prev; if ( left && left->magic == SHMEMHDR_MAGIC_FREE) { left->next = mem->next; if (mem->next) mem->next->prev = left; if (mem->magic == SHMEMHDR_MAGIC_FREE) { if (mem->next2) mem->next2->prev2 = mem->prev2; if (mem->prev2) mem->prev2->next2 = mem->next2; else mem->chunk->free_head = mem->next2; } left->size += sizeof(*mem) + mem->size; mem->magic = ~SHMEMHDR_MAGIC_USED; left->psh = SHHEAP_POISON_NULL(0x51); } /* insert as free if necessary */ else if (mem->magic == SHMEMHDR_MAGIC_USED) { mem->prev2 = NULL; mem->next2 = mem->chunk->free_head; if (mem->chunk->free_head) mem->chunk->free_head->prev2 = mem; mem->chunk->free_head = mem; mem->magic = SHMEMHDR_MAGIC_FREE; mem->psh = SHHEAP_POISON_NULL(0x52); } SHHEAP_CHECK(); shmtx_leave(&g_sh_heap_mtx, &tmp); #else if (ptr) free(ptr); (void)psh; #endif } /** malloc() */ void *sh_malloc(shinstance *psh, size_t size) { #ifdef SHHEAP_IN_USE shmemchunk *chunk; shmemhdr *mem; shmtxtmp tmp; size = SHHEAP_ALIGN(size); SHHEAP_ASSERT(size); if (!size) size = SHHEAP_ALIGN(1); shmtx_enter(&g_sh_heap_mtx, &tmp); SHHEAP_CHECK(); /* Search for fitting block */ mem = NULL; chunk = g_sh_heap; while (chunk) { mem = chunk->free_head; while (mem && mem->size < size) mem = mem->next2; if (mem) break; chunk = chunk->next; } if (mem) { /* split it, or just unlink it? */ if (mem->size - size > sizeof(*mem) * 2) mem = shheap_split(mem, size); else shheap_unlink_free(mem); } else { /* no block found, try grow the heap. */ mem = shheap_grow(size); if (!mem) { shmtx_leave(&g_sh_heap_mtx, &tmp); return NULL; } } SHHEAP_CHECK(); shmtx_leave(&g_sh_heap_mtx, &tmp); mem->psh = SHHEAP_POISON_PSH(psh, 0x53); return mem + 1; #else (void)psh; return malloc(size); #endif } /** calloc() */ void *sh_calloc(shinstance *psh, size_t num, size_t item_size) { #ifdef SHHEAP_IN_USE size_t size = num * item_size; void *pv = sh_malloc(psh, size); if (pv) pv = memset(pv, '\0', size); return pv; #else (void)psh; return calloc(num, item_size); #endif } /** realloc() */ void *sh_realloc(shinstance *psh, void *old, size_t new_size) { #ifdef SHHEAP_IN_USE void *pv; if (new_size) { if (old) { shmemhdr *hdr = (shmemhdr *)old - 1; if (hdr->size < new_size) { pv = sh_malloc(psh, new_size); if (pv) { memcpy(pv, old, hdr->size); sh_free(psh, old); } } else pv = old; } else pv = sh_malloc(psh, new_size); } else { sh_free(psh, old); pv = NULL; } return pv; #else return realloc(old, new_size); #endif } /** strdup() */ char *sh_strdup(shinstance *psh, const char *string) { size_t len = strlen(string); char *ret = sh_malloc(psh, len + 1); if (ret) memcpy(ret, string, len + 1); return ret; } kbuild-3608/src/kash/error.c0000664000175000017500000002264514670377416015750 0ustar locutuslocutus/* $NetBSD: error.c,v 1.31 2003/08/07 09:05:30 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)error.c 8.2 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: error.c,v 1.31 2003/08/07 09:05:30 agc Exp $"); #endif /* not lint */ #endif /* * Errors and exceptions. */ #include #include #include #include #include "shell.h" #include "main.h" #include "options.h" #include "output.h" #include "error.h" #include "show.h" #include "shinstance.h" /* * Code to handle exceptions in C. */ /*struct jmploc *handler; int exception; volatile int suppressint; volatile int intpending; char *commandname;*/ SH_NORETURN_1 static void exverror(shinstance *psh, int, const char *, va_list) SH_NORETURN_2; /* * Called to raise an exception. Since C doesn't include exceptions, we * just do a longjmp to the exception handler. The type of exception is * stored in the global variable "exception". */ SH_NORETURN_1 void exraise(shinstance *psh, int e) { if (psh->handler == NULL) sh_abort(psh); psh->exception = e; longjmp(psh->handler->loc, 1); } /* * Called from trap.c when a SIGINT is received. (If the user specifies * that SIGINT is to be trapped or ignored using the trap builtin, then * this routine is not called.) Suppressint is nonzero when interrupts * are held using the INTOFF macro. The call to _exit is necessary because * there is a short period after a fork before the signal handlers are * set to the appropriate value for the child. (The test for iflag is * just defensive programming.) */ void onint(shinstance *psh) { shsigset_t nsigset; if (psh->suppressint) { psh->intpending = 1; return; } psh->intpending = 0; sh_sigemptyset(&nsigset); sh_sigprocmask(psh, SIG_SETMASK, &nsigset, NULL); if (psh->rootshell && iflag(psh)) exraise(psh, EXINT); else { sh_signal(psh, SIGINT, SH_SIG_DFL); sh_raise_sigint(psh);/*raise(psh, SIGINT);*/ } /* NOTREACHED */ } static void exvwarning(shinstance *psh, int sv_errno, const char *msg, va_list ap) { /* Partially emulate line buffered output so that: * printf '%d\n' 1 a 2 * and * printf '%d %d %d\n' 1 a 2 * both generate sensible text when stdout and stderr are merged. */ if (psh->output.nextc != psh->output.buf && psh->output.nextc[-1] == '\n') flushout(&psh->output); if (psh->commandname) outfmt(&psh->errout, "%s: ", psh->commandname); if (msg != NULL) { doformat(&psh->errout, msg, ap); if (sv_errno >= 0) outfmt(&psh->errout, ": "); } if (sv_errno >= 0) outfmt(&psh->errout, "%s", sh_strerror(psh, sv_errno)); out2c(psh, '\n'); flushout(&psh->errout); } /* * Exverror is called to raise the error exception. If the second argument * is not NULL then error prints an error message using printf style * formatting. It then raises the error exception. */ static void exverror(shinstance *psh, int cond, const char *msg, va_list ap) { CLEAR_PENDING_INT; INTOFF; #ifdef DEBUG if (msg) { va_list va2; TRACE((psh, "exverror(%d, \"", cond)); # ifdef va_copy /* MSC 2010 still doesn't have va_copy. sigh. */ va_copy(va2, ap); # else va2 = ap; # endif TRACEV((psh, msg, va2)); va_end(va2); TRACE((psh, "\") pid=%" SHPID_PRI "\n", sh_getpid(psh))); } else TRACE((psh, "exverror(%d, NULL) pid=%" SHPID_PRI "\n", cond, sh_getpid(psh))); #endif if (msg) exvwarning(psh, -1, msg, ap); output_flushall(psh); exraise(psh, cond); /* NOTREACHED */ } SH_NORETURN_1 void error(shinstance *psh, const char *msg, ...) { va_list ap; va_start(ap, msg); exverror(psh, EXERROR, msg, ap); /* NOTREACHED */ va_end(ap); } SH_NORETURN_1 void exerror(shinstance *psh, int cond, const char *msg, ...) { va_list ap; va_start(ap, msg); exverror(psh, cond, msg, ap); /* NOTREACHED */ va_end(ap); } /* * error/warning routines for external builtins */ SH_NORETURN_1 void sh_exit(shinstance *psh, int rval) { psh->exerrno = rval & 255; exraise(psh, EXEXEC); } SH_NORETURN_1 void sh_err(shinstance *psh, int status, const char *fmt, ...) { va_list ap; va_start(ap, fmt); exvwarning(psh, errno, fmt, ap); va_end(ap); sh_exit(psh, status); } SH_NORETURN_1 void sh_verr(shinstance *psh, int status, const char *fmt, va_list ap) { exvwarning(psh, errno, fmt, ap); sh_exit(psh, status); } SH_NORETURN_1 void sh_errx(shinstance *psh, int status, const char *fmt, ...) { va_list ap; va_start(ap, fmt); exvwarning(psh, -1, fmt, ap); va_end(ap); sh_exit(psh, status); } SH_NORETURN_1 void sh_verrx(shinstance *psh, int status, const char *fmt, va_list ap) { exvwarning(psh, -1, fmt, ap); sh_exit(psh, status); } void sh_warn(shinstance *psh, const char *fmt, ...) { va_list ap; va_start(ap, fmt); exvwarning(psh, errno, fmt, ap); va_end(ap); } void sh_vwarn(shinstance *psh, const char *fmt, va_list ap) { exvwarning(psh, errno, fmt, ap); } void sh_warnx(shinstance *psh, const char *fmt, ...) { va_list ap; va_start(ap, fmt); exvwarning(psh, -1, fmt, ap); va_end(ap); } void sh_vwarnx(shinstance *psh, const char *fmt, va_list ap) { exvwarning(psh, -1, fmt, ap); } /* * Table of error messages. */ struct errname { short errcode; /* error number */ short action; /* operation which encountered the error */ const char *msg; /* text describing the error */ }; #define ALL (E_OPEN|E_CREAT|E_EXEC) STATIC const struct errname errormsg[] = { { EINTR, ALL, "interrupted" }, { EACCES, ALL, "permission denied" }, { EIO, ALL, "I/O error" }, { EEXIST, ALL, "file exists" }, { ENOENT, E_OPEN, "no such file" }, { ENOENT, E_CREAT,"directory nonexistent" }, { ENOENT, E_EXEC, "not found" }, { ENOTDIR, E_OPEN, "no such file" }, { ENOTDIR, E_CREAT,"directory nonexistent" }, { ENOTDIR, E_EXEC, "not found" }, { EISDIR, ALL, "is a directory" }, #ifdef EMFILE { EMFILE, ALL, "too many open files" }, #endif { ENFILE, ALL, "file table overflow" }, { ENOSPC, ALL, "file system full" }, #ifdef EDQUOT { EDQUOT, ALL, "disk quota exceeded" }, #endif #ifdef ENOSR { ENOSR, ALL, "no streams resources" }, #endif { ENXIO, ALL, "no such device or address" }, { EROFS, ALL, "read-only file system" }, #ifdef ETXTBSY { ETXTBSY, ALL, "text busy" }, #endif #ifdef EAGAIN { EAGAIN, E_EXEC, "not enough memory" }, #endif { ENOMEM, ALL, "not enough memory" }, #ifdef ENOLINK { ENOLINK, ALL, "remote access failed" }, #endif #ifdef EMULTIHOP { EMULTIHOP, ALL, "remote access failed" }, #endif #ifdef ECOMM { ECOMM, ALL, "remote access failed" }, #endif #ifdef ESTALE { ESTALE, ALL, "remote access failed" }, #endif #ifdef ETIMEDOUT { ETIMEDOUT, ALL, "remote access failed" }, #endif #ifdef ELOOP { ELOOP, ALL, "symbolic link loop" }, #endif { E2BIG, E_EXEC, "argument list too long" }, #ifdef ELIBACC { ELIBACC, E_EXEC, "shared library missing" }, #endif { 0, 0, NULL }, }; /* * Return a string describing an error. The returned string may be a * pointer to a static buffer that will be overwritten on the next call. * Action describes the operation that got the error. */ const char * errmsg(shinstance *psh, int e, int action) { struct errname const *ep; /*static char buf[12];*/ for (ep = errormsg ; ep->errcode ; ep++) { if (ep->errcode == e && (ep->action & action) != 0) return ep->msg; } fmtstr(psh->errmsg_buf, sizeof psh->errmsg_buf, "error %d", e); return psh->errmsg_buf; } #ifdef K_STRICT KHLP_DECL(void) kHlpAssertMsg1(const char *pszExpr, const char *pszFile, unsigned iLine, const char *pszFunction) { shinstance *psh = shthread_get_shell(); TRACE((psh, "Assertion failed in %s --- %s --- %s(%u)\n", pszFunction, pszExpr, pszFile, iLine)); dprintf(psh, "Assertion failed in %s --- %s --- %s(%u)\n", pszFunction, pszExpr, pszFile, iLine); } KHLP_DECL(void) kHlpAssertMsg2(const char *pszFormat, ...) { shinstance *psh = shthread_get_shell(); va_list va; va_start(va, pszFormat); doformat(psh->out2, pszFormat, va); va_end(va); } #endif /* K_STRICT */ kbuild-3608/src/kash/mktokens0000775000175000017500000000557014670377416016232 0ustar locutuslocutus#!/bin/sh - # $NetBSD: mktokens,v 1.10 2003/08/22 11:22:23 agc Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)mktokens 8.1 (Berkeley) 5/31/93 # The following is a list of tokens. The second column is nonzero if the # token marks the end of a list. The third column is the name to print in # error messages. if [ -z "$TMPDIR" ]; then TMPDIR="/tmp" export TMPDIR fi F="$TMPDIR/ka$$" echo $F cat > $F <<\! TEOF 1 end of file TNL 0 newline TSEMI 0 ";" TBACKGND 0 "&" TAND 0 "&&" TOR 0 "||" TPIPE 0 "|" TLP 0 "(" TRP 1 ")" TENDCASE 1 ";;" TENDBQUOTE 1 "`" TREDIR 0 redirection TWORD 0 word TIF 0 "if" TTHEN 1 "then" TELSE 1 "else" TELIF 1 "elif" TFI 1 "fi" TWHILE 0 "while" TUNTIL 0 "until" TFOR 0 "for" TDO 1 "do" TDONE 1 "done" TBEGIN 0 "{" TEND 1 "}" TCASE 0 "case" TESAC 1 "esac" TNOT 0 "!" ! nl=`wc -l $F` exec > token.h awk '{print "#define " $1 " " NR-1}' $F echo ' /* Array indicating which tokens mark the end of a list */ const char tokendlist[] = {' awk '{print "\t" $2 ","}' $F echo '}; const char *const tokname[] = {' sed -e 's/"/\\"/g' \ -e 's/[^ ]*[ ][ ]*[^ ]*[ ][ ]*\(.*\)/ "\1",/' \ $F echo '}; ' sed 's/"//g' $F | awk ' /TIF/{print "#define KWDOFFSET " NR-1; print ""; print "const char *const parsekwd[] = {"} /TIF/,/neverfound/{print " \"" $3 "\","}' echo ' 0 };' rm $F kbuild-3608/src/kash/Makefile.kmk0000664000175000017500000001443414670377416016671 0ustar locutuslocutus# $Id: Makefile.kmk 3477 2020-09-17 21:52:16Z bird $ ## @file # Sub-makefile for kash. # # # Copyright (c) 2005-2020 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # SUB_DEPTH = ../.. include $(KBUILD_PATH)/subheader.kmk KASH_WIN_FORKED_MODE = # # The program. # PROGRAMS += kash kash_TEMPLATE = BIN-THREADED kash_NAME = kmk_ash kash_ASTOOL = YASM kash_DEFS = lint SHELL SMALL KASH_SEPARATE_PARSER_ALLOCATOR if "$(KBUILD_TARGET)" != "win" || defined(KASH_WIN_FORKED_MODE) kash_DEFS += SH_FORKED_MODE else kash_DEFS += KASH_SEPARATE_PARSER_ALLOCATOR KASH_ASYNC_CLOSE_HANDLE endif kash_DEFS.debug = DEBUG=2 K_STRICT kash_DEFS.haiku = BSD kash_DEFS.linux = BSD kash_DEFS.solaris = BSD ## @todo bring over PC_SLASHES? kash_DEFS.win = \ BSD YY_NO_UNISTD_H \ SH_DEAL_WITH_CRLF PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS EXEC_HASH_BANG_SCRIPT \ KASH_USE_FORKSHELL2 kash_DEFS.os2 = \ HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME PC_OS2_LIBPATHS \ SH_DEAL_WITH_CRLF PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS EXEC_HASH_BANG_SCRIPT kash_DEFS.darwin = \ HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME kash_DEFS.dragonfly = \ HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME kash_DEFS.freebsd = \ HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME kash_DEFS.gnukfbsd = HAVE_SYSCTL_H kash_DEFS.netbsd = \ HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME kash_DEFS.openbsd = \ HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME kash_INCS = $(kash_0_OUTDIR) . # (the last is because of error.h) kash_ASFLAGS.win = -g cv8 kash_ASFLAGS.win.x86 = -f win32 kash_ASFLAGS.win.amd64 = -f win64 if "$(USER)" == "bird" && "$(KBUILD_TARGET)" != "win" kash_CFLAGS += -std=gnu99 endif kash_CFLAGS.win.amd64 = -GS- ifdef KASH_WIN_FORKED_MODE kash_LDFLAGS.win = -DYNAMICBASE:NO endif kash_SOURCES = \ main.c \ alias.c \ cd.c \ error.c \ eval.c \ exec.c \ expand.c \ histedit.c \ input.c \ jobs.c \ mail.c \ memalloc.c \ mystring.c \ options.c \ output.c \ parser.c \ redir.c \ show.c \ syntax.c \ trap.c \ var.c \ miscbltin.c \ bltin/echo.c \ bltin/kill.c \ bltin/test.c \ \ $(kash_0_OUTDIR)/builtins.c \ $(kash_0_OUTDIR)/init.c \ $(kash_0_OUTDIR)/nodes.c \ \ setmode.c \ shinstance.c \ shheap.c \ shthread.c \ shfile.c kash_SOURCES.gnuhurd = \ $(kash_0_OUTDIR)/sys_signame.c \ strlcpy.c kash_SOURCES.gnukfbsd = \ $(kash_0_OUTDIR)/sys_signame.c \ strlcpy.c kash_SOURCES.gnuknbsd = \ $(kash_0_OUTDIR)/sys_signame.c \ strlcpy.c kash_SOURCES.haiku = \ $(kash_0_OUTDIR)/sys_signame.c \ strlcpy.c kash_SOURCES.linux = \ $(kash_0_OUTDIR)/sys_signame.c \ strlcpy.c kash_SOURCES.solaris = \ $(kash_0_OUTDIR)/sys_signame.c \ strlcpy.c kash_SOURCES.win = \ $(kash_0_OUTDIR)/sys_signame.c \ strsignal.c \ strlcpy.c \ ../lib/nt/ntstat.c \ ../lib/nt/nthlpcore.c \ ../lib/nt/nthlpfs.c \ ../lib/nt/nt_child_inject_standard_handles.c ifdef KASH_WIN_FORKED_MODE kash_SOURCES.win += \ shfork-win.c \ shforkA-win.asm endif kash_INTERMEDIATES = \ $(kash_0_OUTDIR)/builtins.h \ $(kash_0_OUTDIR)/nodes.h \ $(kash_0_OUTDIR)/token.h kash_CLEAN = \ $(kash_INTERMEDIATES) \ $(kash_0_OUTDIR)/builtins.c \ $(kash_0_OUTDIR)/init.c \ $(kash_0_OUTDIR)/nodes.c kash_main.c_DEFS = KBUILD_SVN_REV=$(KBUILD_SVN_REV) ## ## The manual page. ## #INSTALLS += kash.man #kash.man_TEMPLATE = usr.bin.man #kash.man_SOURCES = sh.1=>kash.1 # # The signal name list: # $$(kash_0_OUTDIR)/sys_signame.c: $$(bld_signames_1_TARGET) | $$(dir $$@) $< $@ BLDPROGS += bld_signames bld_signames_TEMPLATE := BLD bld_signames_DEFS := SHELL SMALL bld_signames_SOURCES := bld_signames.c if1of ($(KBUILD_TARGET), win os2) KASH_USE_PREGENERATED_CODE = 1 endif ifdef KASH_USE_PREGENERATED_CODE # # Use the pregenerated code. # kash_SOURCES += \ $(kash_0_OUTDIR)/arith.c \ $(kash_0_OUTDIR)/arith_lex.c kash_INTERMEDIATES += \ $(kash_0_OUTDIR)/arith.h define def_copy_generated $$$$(kash_0_OUTDIR)/$(src): $(PATH_SUB_CURRENT)/generated/$(src) $$(RM) -f $$@ $$(CP) -f $$^ $$@ endef $(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\ $(eval $(def_copy_generated))) else # !KASH_USE_PREGENERATED_CODE # # Generate the code on the fly. # USES += lex yacc kash_USES = lex yacc kash_LEXTOOL = FLEX kash_LEXFLAGS = -8 #kash_YACCTOOL = BISON kash_YACCTOOL = YACC kash_YACCFLAGS = -ld kash_SOURCES += \ arith.y \ arith_lex.l # # ATTENTION! ATTENTION! ATTENTION! # # Older ash versions has trouble with some of these scripts, great. # Kudos to the NetBSD guys for this clever move. ;) # # So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea. # BOOTSTRAP_SHELL ?= $(SHELL) $$(kash_0_OUTDIR)/builtins.h + $$(kash_0_OUTDIR)/builtins.c: \ $$(kash_DEFPATH)/mkbuiltins \ $$(kash_DEFPATH)/shell.h \ $$(kash_DEFPATH)/builtins.def \ | $$(dir $$@) $(BOOTSTRAP_SHELL) $+ $(dir $@) [ -f $(kash_0_OUTDIR)/builtins.h ] $$(kash_0_OUTDIR)/nodes.h + $$(kash_0_OUTDIR)/nodes.c: \ $$(kash_DEFPATH)/mknodes.sh \ $$(kash_DEFPATH)/nodetypes \ $$(kash_DEFPATH)/nodes.c.pat \ | $$(dir $$@) $(BOOTSTRAP_SHELL) $+ $(dir $@) [ -f $(dir $@)/nodes.h ] $$(kash_0_OUTDIR)/token.h: $$(kash_DEFPATH)/mktokens | $$(dir $$@) $(BOOTSTRAP_SHELL) $+ $(MV) token.h $@ $$(kash_0_OUTDIR)/init.c: \ $$(kash_DEFPATH)/mkinit.sh \ $$(abspathex $$(filter-out $$(kash_0_OUTDIR)/%,$$(kash_SOURCES)), $$(kash_DEFPATH)) \ | $$(dir $$@) $(BOOTSTRAP_SHELL) $+ $(MV) init.c $@ endif # !KASH_USE_PREGENERATED_CODE # # For debugging file handle inheritance on Windows. # if "$(KBUILD_TARGET)" == win && 0 PROGRAMS += tstDump tstDump_TEMPLATE = BIN tstDump_SOURCES = tstDump.c endif # Include the sub-makefile. include $(PATH_SUB_CURRENT)/tests/Makefile.kmk include $(FILE_KBUILD_SUB_FOOTER) kbuild-3608/src/kash/shfile.h0000664000175000017500000001510314670377416016065 0ustar locutuslocutus/* $Id: shfile.h 3473 2020-09-16 21:12:58Z bird $ */ /** @file * File management. */ /* * Copyright (c) 2007-2010 knut st. osmundsen * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef ___shfile_h #define ___shfile_h #include "shtypes.h" #include "shthread.h" #include #include #ifdef _MSC_VER # define _PATH_DEVNULL "nul" # define _PATH_DEFPATH "." #else # if !defined(__sun__) # include # endif # ifndef _PATH_DEVNULL # define _PATH_DEVNULL "/dev/null" # endif # ifndef _PATH_DEFPATH # define _PATH_DEFPATH "/bin:/usr/bin:/sbin:/usr/sbin" # endif #endif #include /* for PIPE_BUF */ #ifndef _MSC_VER # include # include # ifndef O_BINARY # define O_BINARY 0 # endif # ifndef O_TEXT # define O_TEXT 0 # endif #else # include # include # define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) # define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) # define S_ISLNK(m) 0 # define S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) # define S_IXUSR _S_IEXEC # define S_IWUSR _S_IWRITE # define S_IRUSR _S_IREAD # define S_IRWXG 0000070 # define S_IRGRP 0000040 # define S_IWGRP 0000020 # define S_IXGRP 0000010 # define S_IRWXO 0000007 # define S_IROTH 0000004 # define S_IWOTH 0000002 # define S_IXOTH 0000001 # define S_ISUID 0004000 # define S_ISGID 0002000 # define ALLPERMS 0000777 # define F_DUPFD 0 # define F_GETFD 1 # define F_SETFD 2 # define F_GETFL 3 # define F_SETFL 4 # define FD_CLOEXEC 1 # define F_OK 0 # define X_OK 1 # define W_OK 2 # define R_OK 4 # define O_NONBLOCK 0 /** @todo */ #endif #if K_OS == K_OS_WINDOWS # include "nt/ntstat.h" #endif /** * One file. */ typedef struct shfile { int fd; /**< The shell file descriptor number. */ unsigned oflags; /**< Open flags. */ unsigned shflags; /**< The shell file descriptor flags. */ intptr_t native; /**< The native file descriptor number. */ #ifdef DEBUG char *dbgname; /**< The name of the file, if applicable, debug builds only. */ # define SHFILE_DBGNAME(a) a # else # define SHFILE_DBGNAME(a) NULL #endif } shfile; /** @name shfile::shflags values. * @{ */ #define SHFILE_FLAGS_CLOSE_ON_EXEC 0x0001 #define SHFILE_FLAGS_TRACE 0x0002 /**< The 'trace' file, keep open after execve. */ #define SHFILE_FLAGS_TYPE_MASK 0x00f0 #define SHFILE_FLAGS_FILE 0x0000 #define SHFILE_FLAGS_PIPE 0x0010 #define SHFILE_FLAGS_DIR 0x0020 #define SHFILE_FLAGS_TTY 0x0030 #define SHFILE_FLAGS_DIRTY 0x0100 /**< The file has been written to. */ /** @} */ /** * The file descriptor table for a shell. */ typedef struct shfdtab { shmtx mtx; /**< Mutex protecting any operations on the table and it's handles. */ char *cwd; /**< The current directory for this shell instance. */ unsigned size; /**< The size of the table (number of entries). */ shfile *tab; /**< Pointer to the table. */ } shfdtab; int shfile_init(shfdtab *, shfdtab *); void shfile_uninit(shfdtab *, int); void shfile_fork_win(shfdtab *pfdtab, int set, intptr_t *hndls); typedef struct shfdexecwin { int inherithandles; int startsuspended; shmtxtmp tmp; int replacehandles[3]; intptr_t handles[3]; void *strtinfo; } shfdexecwin; int shfile_exec_win(shfdtab *pfdtab, int prepare, shfdexecwin *info); int shfile_exec_unix(shfdtab *pfdtab); #if K_OS == K_OS_WINDOWS && defined(KASH_ASYNC_CLOSE_HANDLE) void shfile_async_close_sync(void); #endif int shfile_open(shfdtab *, const char *, unsigned, mode_t); #if K_OS == K_OS_WINDOWS # define SHFILE_PIPE_SIZE 65536 #elif defined(PIPE_BUF) # define SHFILE_PIPE_SIZE PIPE_BUF #else # define SHFILE_PIPE_SIZE 4096 #endif int shfile_pipe(shfdtab *, int [2]); int shfile_close(shfdtab *, unsigned); long shfile_read(shfdtab *, int, void *, size_t); long shfile_write(shfdtab *, int, const void *, size_t); long shfile_lseek(shfdtab *, int, long, int); int shfile_fcntl(shfdtab *, int fd, int cmd, int arg); int shfile_dup(shfdtab *, int fd); int shfile_movefd(shfdtab *, int fdfrom, int fdto); int shfile_movefd_above(shfdtab *, int fdfrom, int fdmin); int shfile_stat(shfdtab *, const char *, struct stat *); int shfile_stat_isreg(shfdtab *, const char *); /**< returns -1, 0 or 1. */ int shfile_stat_exists(shfdtab *, const char *); /**< same as shfile_stat, but discards the stat data. */ int shfile_lstat(shfdtab *, const char *, struct stat *); int shfile_chdir(shfdtab *, const char *); char *shfile_getcwd(shfdtab *, char *, int); int shfile_access(shfdtab *, const char *, int); int shfile_isatty(shfdtab *, int); int shfile_cloexec(shfdtab *, int, int); int shfile_set_trace(shfdtab *, int); int shfile_ioctl(shfdtab *, int, unsigned long, void *); #if defined(_MSC_VER) || defined(__OS2__) # define TIOCGWINSZ 0x4201 typedef struct sh_winsize { unsigned ws_row; /**< Rows, in characters. */ unsigned ws_col; /**< Columns, in characters. */ unsigned ws_xpixel; /**< Horizontal size, pixels. */ unsigned ws_ypixel; /**< Vertical size, pixels. */ } sh_winsize; #else typedef struct winsize sh_winsize; #endif mode_t shfile_get_umask(shfdtab *); void shfile_set_umask(shfdtab *, mode_t); typedef struct sh_dirent { char name[260]; } shdirent; typedef struct shdir { shfdtab *pfdtab; void *native; shdirent ent; #if K_OS == K_OS_WINDOWS size_t off; size_t cb; char buf[32768 - sizeof(void *) * 2 - sizeof(shdirent) * 2]; #endif } shdir; shdir *shfile_opendir(shfdtab *, const char *); shdirent *shfile_readdir(struct shdir *); void shfile_closedir(struct shdir *); #endif kbuild-3608/src/kash/arith_lex.l0000664000175000017500000001105314670377416016576 0ustar locutuslocutus%option never-interactive %option noyywrap %option noinput %option nounput %option noyyget_out %option noyy_push_state %option noyy_pop_state %option noyy_top_state %option noyy_scan_buffer %option noyy_scan_bytes %option noyy_scan_string %option noyyget_extra %option noyyset_extra %option noyyget_leng %option noyyget_text %option noyyget_lineno %option noyyset_lineno %option noyyget_in %option noyyset_in %option noyyget_out %option noyyset_out %option noyyget_lval %option noyyset_lval %option noyyget_lloc %option noyyset_lloc %option noyyget_debug %option noyyset_debug %option noyyalloc %option noyyrealloc %option noyyfree /** @todo %option reentrant */ %{ /* $NetBSD: arith_lex.l,v 1.13 2005/03/21 22:37:09 dsl Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)arith_lex.l 8.3 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: arith_lex.l,v 1.13 2005/03/21 22:37:09 dsl Exp $"); #endif /* not lint */ #endif #include #include "arith.h" #include "error.h" #include "expand.h" #include "var.h" #include "shinstance.h" extern int yylval; extern shinstance *arith_psh; extern char *arith_buf, *arith_startbuf; #undef YY_INPUT #define YY_INPUT(buf,result,max) \ result = (*buf = *arith_buf++) ? 1 : YY_NULL; #define YY_NO_UNPUT /* Avoid unnecessary libc bits. */ #undef ECHO #define ECHO \ do {} while (0) #undef stdin #define stdin \ NULL #undef stdout #define stdout \ NULL #undef fprintf #define fprintf(a, b, c) \ ((void)0) #undef exit #define exit(rc) \ do {} while (0) #define YY_FATAL_ERROR(msg) \ error(arith_psh, "arith: fatal error: %s", msg) %} %% [ \t\n] { ; } 0x[0-9a-fA-F]+ { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); } 0[0-7]* { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); } [1-9][0-9]* { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); } [A-Za-z_][A-Za-z_0-9]* { char *v = lookupvar(arith_psh, yytext); if (v) { yylval = strtol(v, &v, 0); if (*v == 0) return ARITH_NUM; } error(arith_psh, "arith: syntax error: \"%s\"", arith_startbuf); } "(" { return(ARITH_LPAREN); } ")" { return(ARITH_RPAREN); } "||" { return(ARITH_OR); } "&&" { return(ARITH_AND); } "|" { return(ARITH_BOR); } "^" { return(ARITH_BXOR); } "&" { return(ARITH_BAND); } "==" { return(ARITH_EQ); } "!=" { return(ARITH_NE); } ">" { return(ARITH_GT); } ">=" { return(ARITH_GE); } "<" { return(ARITH_LT); } "<=" { return(ARITH_LE); } "<<" { return(ARITH_LSHIFT); } ">>" { return(ARITH_RSHIFT); } "*" { return(ARITH_MUL); } "/" { return(ARITH_DIV); } "%" { return(ARITH_REM); } "+" { return(ARITH_ADD); } "-" { return(ARITH_SUB); } "~" { return(ARITH_BNOT); } "!" { return(ARITH_NOT); } . { error(arith_psh, "arith: syntax error: \"%s\"", arith_startbuf); } %% void arith_lex_reset() { #ifdef YY_NEW_FILE YY_NEW_FILE; #endif } void * yyalloc(yy_size_t cb) { return sh_malloc(NULL, cb); } void * yyrealloc(void *pv, yy_size_t cb) { return sh_realloc(NULL, pv, cb); } void yyfree(void *pv) { sh_free(NULL, pv); } kbuild-3608/src/kash/shfork-win.c0000664000175000017500000002274214670377416016704 0ustar locutuslocutus /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include "shinstance.h" #include /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** The stack size. This is also defined in shforkA-win.asm. */ #define SHFORK_STACK_SIZE (1*1024*1024) /******************************************************************************* * Global Variables * *******************************************************************************/ static void *g_stack_base = 0; static void *g_stack_limit = 0; /******************************************************************************* * Internal Functions * *******************************************************************************/ static void *shfork_string_to_ptr(const char *str, const char *argv0, const char *what); /* in shforkA-win.asm: */ extern pid_t shfork_do_it(shinstance *psh); extern void shfork_resume(void *cur, void *base, void *limit); /* called by shforkA-win.asm: */ void *shfork_maybe_forked(int argc, char **argv, char **envp); extern int shfork_body(shinstance *psh, void *stack_ptr); extern void init_syntax(void); /** * Called by shforkA-win.asm to check whether we're a forked child * process or not. * * In the former case we will resume execution at the fork resume * point. In the latter we'll allocate a new stack of the forkable * heap and return it to the caller so real_main() in main.c can be * invoked on it. * * @returns Stack or not at all. * @param argc Argument count. * @param argv Argument vector. * @param envp Environment vector. */ void *shfork_maybe_forked(int argc, char **argv, char **envp) { void *stack_ptr; /* * Are we actually forking? */ if ( argc != 8 || strcmp(argv[1], "--!forked!--") || strcmp(argv[2], "--stack-address") || strcmp(argv[4], "--stack-base") || strcmp(argv[6], "--stack-limit")) { char *stack; shheap_init(NULL); g_stack_limit = stack = (char *)sh_malloc(NULL, SHFORK_STACK_SIZE); g_stack_base = stack += SHFORK_STACK_SIZE; return stack; } /* * Do any init that needs to be done before resuming the * fork() call. */ setlocale(LC_ALL, ""); /* * Convert the stack addresses. */ stack_ptr = shfork_string_to_ptr(argv[3], argv[0], "--stack-address"); g_stack_base = shfork_string_to_ptr(argv[5], argv[0], "--stack-base"); g_stack_limit = shfork_string_to_ptr(argv[7], argv[0], "--stack-limit"); kHlpAssert((uintptr_t)stack_ptr < (uintptr_t)g_stack_base); kHlpAssert((uintptr_t)stack_ptr > (uintptr_t)g_stack_limit); /* * Switch stack and jump to the fork resume point. */ shfork_resume(stack_ptr, g_stack_base, g_stack_limit); /* (won't get here) */ return NULL; } /*** * Converts a string into a pointer. * * @returns Pointer. * @param argv0 The program name in case of error. * @param str The string to convert. */ static void *shfork_string_to_ptr(const char *str, const char *argv0, const char *what) { const char *start = str; intptr_t ptr = 0; if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) str += 2; while (*str) { unsigned digit; switch (*str) { case '0': digit = 0; break; case '1': digit = 1; break; case '2': digit = 2; break; case '3': digit = 3; break; case '4': digit = 4; break; case '5': digit = 5; break; case '6': digit = 6; break; case '7': digit = 7; break; case '8': digit = 8; break; case '9': digit = 9; break; case 'a': case 'A': digit = 0xa; break; case 'b': case 'B': digit = 0xb; break; case 'c': case 'C': digit = 0xc; break; case 'd': case 'D': digit = 0xd; break; case 'e': case 'E': digit = 0xe; break; case 'f': case 'F': digit = 0xf; break; default: fprintf(stderr, "%s: fatal error: Invalid %s '%s'\n", argv0, what, start); exit(2); } ptr <<= 4; ptr |= digit; str++; } return (void *)ptr; } /** * Do the fork. * @returns same as fork(). * @param psh The shell that's forking. */ int shfork_do(shinstance *psh) { /* save globals */ void *pheap_head = shheap_get_head(); pid_t pid = shfork_do_it(psh); if (pid == 0) { /* reinit stuff, only the heap is copied! */ shthread_set_shell(psh); shheap_init(pheap_head); setlocale(LC_ALL, ""); init_syntax(); sh_init_globals(); } return pid; } /** * Create the child process making sure it inherits all our handles, * copy of the forkable heap and kick it off. * * Called by shfork_do_it() in shforkA-win.asm. * * @returns child pid on success, -1 and errno on failure. * @param psh The shell that's forking. * @param stack_ptr The stack address at which the guest is suppost to resume. */ int shfork_body(shinstance *psh, void *stack_ptr) { PROCESS_INFORMATION ProcInfo; STARTUPINFO StrtInfo; intptr_t hndls[3]; char szExeName[1024]; char szCmdLine[1024+256]; DWORD cch; int rc = 0; kHlpAssert((uintptr_t)stack_ptr < (uintptr_t)g_stack_base); kHlpAssert((uintptr_t)stack_ptr > (uintptr_t)g_stack_limit); /* * Mark all handles inheritable and get the three standard handles. */ shfile_fork_win(&psh->fdtab, 1 /* set */, &hndls[0]); /* * Create the process. */ cch = GetModuleFileName(GetModuleHandle(NULL), szExeName, sizeof(szExeName)); if (cch > 0) { #if 0 /* quoting the program name doesn't seems to be working :/ */ szCmdLine[0] = '"'; memcpy(&szCmdLine[1], szExeName, cch); szCmdLine[++cch] = '"'; #else memcpy(&szCmdLine[0], szExeName, cch); #endif cch += sprintf(&szCmdLine[cch], " --!forked!-- --stack-address %p --stack-base %p --stack-limit %p", stack_ptr, g_stack_base, g_stack_limit); szCmdLine[cch+1] = '\0'; TRACE2((NULL, "shfork_body: szCmdLine=%s\n", szCmdLine)); memset(&StrtInfo, '\0', sizeof(StrtInfo)); /* just in case. */ StrtInfo.cb = sizeof(StrtInfo); StrtInfo.lpReserved = NULL; StrtInfo.lpDesktop = NULL; StrtInfo.lpTitle = NULL; StrtInfo.dwX = 0; StrtInfo.dwY = 0; StrtInfo.dwXSize = 0; StrtInfo.dwYSize = 0; StrtInfo.dwXCountChars = 0; StrtInfo.dwYCountChars = 0; StrtInfo.dwFillAttribute = 0; StrtInfo.dwFlags = STARTF_USESTDHANDLES;; StrtInfo.wShowWindow = 0; StrtInfo.cbReserved2 = 0; StrtInfo.lpReserved2 = NULL; StrtInfo.hStdInput = (HANDLE)hndls[0]; StrtInfo.hStdOutput = (HANDLE)hndls[1]; StrtInfo.hStdError = (HANDLE)hndls[2]; if (CreateProcess(szExeName, szCmdLine, NULL, /* pProcessAttributes */ NULL, /* pThreadAttributes */ TRUE, /* bInheritHandles */ CREATE_SUSPENDED, NULL, /* pEnvironment */ NULL, /* pCurrentDirectory */ &StrtInfo, &ProcInfo)) { /* * Copy the memory to the child. */ rc = shheap_fork_copy_to_child(ProcInfo.hProcess); if (!rc) { if (ResumeThread(ProcInfo.hThread) != (DWORD)-1) { rc = sh_add_child(psh, ProcInfo.dwProcessId, ProcInfo.hProcess, NULL); if (!rc) rc = (int)ProcInfo.dwProcessId; } else { DWORD dwErr = GetLastError(); fprintf(stderr, "shfork: ResumeThread() -> %d\n", dwErr); errno = EINVAL; rc = -1; } } if (rc == -1) { TerminateProcess(ProcInfo.hProcess, 127); /* needed?: ResumeThread(ProcInfo.hThread); */ CloseHandle(ProcInfo.hProcess); } CloseHandle(ProcInfo.hThread); } else { DWORD dwErr = GetLastError(); fprintf(stderr, "shfork: CreateProcess(%s) -> %d\n", szExeName, dwErr); errno = EINVAL; rc = -1; } } else { DWORD dwErr = GetLastError(); fprintf(stderr, "shfork: GetModuleFileName() -> %d\n", dwErr); errno = EINVAL; rc = -1; } /* * Restore the handle inherit property. */ shfile_fork_win(&psh->fdtab, 0 /* restore */, NULL); return rc; } kbuild-3608/src/kash/setmode.c0000664000175000017500000002572214670377416016256 0ustar locutuslocutus/* $NetBSD: setmode.c,v 1.30 2003/08/07 16:42:56 agc Exp $ */ /* * Copyright (c) 1989, 1993, 1994 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Dave Borman at Cray Research, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94"; #else __RCSID("$NetBSD: setmode.c,v 1.30 2003/08/07 16:42:56 agc Exp $"); #endif /* LIBC_SCCS and not lint */ #endif #include #include #include #include #include #include "shinstance.h" /* for unistd.h types/defines */ #ifdef SETMODE_DEBUG #include #endif #define SET_LEN 6 /* initial # of bitcmd struct to malloc */ #define SET_LEN_INCR 4 /* # of bitcmd structs to add as needed */ typedef struct bitcmd { char cmd; char cmd2; mode_t bits; } BITCMD; #define CMD2_CLR 0x01 #define CMD2_SET 0x02 #define CMD2_GBITS 0x04 #define CMD2_OBITS 0x08 #define CMD2_UBITS 0x10 static BITCMD *addcmd(BITCMD *, int, int, int, unsigned int); static void compress_mode(BITCMD *); #ifdef SETMODE_DEBUG static void dumpmode(BITCMD *); #endif #ifndef _DIAGASSERT # define _DIAGASSERT kHlpAssert #endif #ifndef S_ISTXT # ifdef S_ISVTX # define S_ISTXT S_ISVTX # else # define S_ISTXT 0 # endif #endif /* !S_ISTXT */ /* * Given the old mode and an array of bitcmd structures, apply the operations * described in the bitcmd structures to the old mode, and return the new mode. * Note that there is no '=' command; a strict assignment is just a '-' (clear * bits) followed by a '+' (set bits). */ mode_t kash_getmode(const void *bbox, mode_t omode) { const BITCMD *set; mode_t clrval, newmode, value; _DIAGASSERT(bbox != NULL); set = (const BITCMD *)bbox; newmode = omode; for (value = 0;; set++) switch(set->cmd) { /* * When copying the user, group or other bits around, we "know" * where the bits are in the mode so that we can do shifts to * copy them around. If we don't use shifts, it gets real * grundgy with lots of single bit checks and bit sets. */ case 'u': value = (newmode & S_IRWXU) >> 6; goto common; case 'g': value = (newmode & S_IRWXG) >> 3; goto common; case 'o': value = newmode & S_IRWXO; common: if (set->cmd2 & CMD2_CLR) { clrval = (set->cmd2 & CMD2_SET) ? S_IRWXO : value; if (set->cmd2 & CMD2_UBITS) newmode &= ~((clrval<<6) & set->bits); if (set->cmd2 & CMD2_GBITS) newmode &= ~((clrval<<3) & set->bits); if (set->cmd2 & CMD2_OBITS) newmode &= ~(clrval & set->bits); } if (set->cmd2 & CMD2_SET) { if (set->cmd2 & CMD2_UBITS) newmode |= (value<<6) & set->bits; if (set->cmd2 & CMD2_GBITS) newmode |= (value<<3) & set->bits; if (set->cmd2 & CMD2_OBITS) newmode |= value & set->bits; } break; case '+': newmode |= set->bits; break; case '-': newmode &= ~set->bits; break; case 'X': if (omode & (S_IFDIR|S_IXUSR|S_IXGRP|S_IXOTH)) newmode |= set->bits; break; case '\0': default: #ifdef SETMODE_DEBUG (void)printf("getmode:%04o -> %04o\n", omode, newmode); #endif return (newmode); } } #define ADDCMD(a, b, c, d) do { \ if (set >= endset) { \ BITCMD *newset; \ setlen += SET_LEN_INCR; \ newset = sh_realloc(NULL, saveset, sizeof(BITCMD) * setlen); \ if (newset == NULL) { \ sh_free(NULL, saveset); \ return (NULL); \ } \ set = newset + (set - saveset); \ saveset = newset; \ endset = newset + (setlen - 2); \ } \ set = addcmd(set, (a), (b), (c), (d)); \ } while (/*CONSTCOND*/0) #define STANDARD_BITS (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO) void * kash_setmode(shinstance *psh, const char *p) { int perm, who; char op, *ep; BITCMD *set, *saveset, *endset; mode_t mask; int equalopdone = 0; /* pacify gcc */ int permXbits, setlen; if (!*p) return (NULL); /* * Get a copy of the mask for the permissions that are mask relative. * Flip the bits, we want what's not set. */ mask = shfile_get_umask(&psh->fdtab); setlen = SET_LEN + 2; if ((set = sh_malloc(NULL, sizeof(BITCMD) * setlen)) == NULL) return (NULL); saveset = set; endset = set + (setlen - 2); /* * If an absolute number, get it and return; disallow non-octal digits * or illegal bits. */ if (isdigit((unsigned char)*p)) { perm = (mode_t)strtol(p, &ep, 8); if (*ep || perm & ~(STANDARD_BITS|S_ISTXT)) { sh_free(NULL, saveset); return (NULL); } ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask); set->cmd = 0; return (saveset); } /* * Build list of structures to set/clear/copy bits as described by * each clause of the symbolic mode. */ for (;;) { /* First, find out which bits might be modified. */ for (who = 0;; ++p) { switch (*p) { case 'a': who |= STANDARD_BITS; break; case 'u': who |= S_ISUID|S_IRWXU; break; case 'g': who |= S_ISGID|S_IRWXG; break; case 'o': who |= S_IRWXO; break; default: goto getop; } } getop: if ((op = *p++) != '+' && op != '-' && op != '=') { sh_free(NULL, saveset); return (NULL); } if (op == '=') equalopdone = 0; who &= ~S_ISTXT; for (perm = 0, permXbits = 0;; ++p) { switch (*p) { case 'r': perm |= S_IRUSR|S_IRGRP|S_IROTH; break; case 's': /* * If specific bits where requested and * only "other" bits ignore set-id. */ if (who == 0 || (who & ~S_IRWXO)) perm |= S_ISUID|S_ISGID; break; case 't': /* * If specific bits where requested and * only "other" bits ignore set-id. */ if (who == 0 || (who & ~S_IRWXO)) { who |= S_ISTXT; perm |= S_ISTXT; } break; case 'w': perm |= S_IWUSR|S_IWGRP|S_IWOTH; break; case 'X': permXbits = S_IXUSR|S_IXGRP|S_IXOTH; break; case 'x': perm |= S_IXUSR|S_IXGRP|S_IXOTH; break; case 'u': case 'g': case 'o': /* * When ever we hit 'u', 'g', or 'o', we have * to flush out any partial mode that we have, * and then do the copying of the mode bits. */ if (perm) { ADDCMD(op, who, perm, mask); perm = 0; } if (op == '=') equalopdone = 1; if (op == '+' && permXbits) { ADDCMD('X', who, permXbits, mask); permXbits = 0; } ADDCMD(*p, who, op, mask); break; default: /* * Add any permissions that we haven't already * done. */ if (perm || (op == '=' && !equalopdone)) { if (op == '=') equalopdone = 1; ADDCMD(op, who, perm, mask); perm = 0; } if (permXbits) { ADDCMD('X', who, permXbits, mask); permXbits = 0; } goto apply; } } apply: if (!*p) break; if (*p != ',') goto getop; ++p; } set->cmd = 0; #ifdef SETMODE_DEBUG (void)printf("Before compress_mode()\n"); dumpmode(saveset); #endif compress_mode(saveset); #ifdef SETMODE_DEBUG (void)printf("After compress_mode()\n"); dumpmode(saveset); #endif return (saveset); } static BITCMD * addcmd(set, op, who, oparg, mask) BITCMD *set; int oparg, who; int op; unsigned int mask; { _DIAGASSERT(set != NULL); switch (op) { case '=': set->cmd = '-'; set->bits = who ? who : STANDARD_BITS; set++; op = '+'; /* FALLTHROUGH */ case '+': case '-': case 'X': set->cmd = op; set->bits = (who ? (unsigned int)who : mask) & (unsigned int)oparg; break; case 'u': case 'g': case 'o': set->cmd = op; if (who) { set->cmd2 = ((who & S_IRUSR) ? CMD2_UBITS : 0) | ((who & S_IRGRP) ? CMD2_GBITS : 0) | ((who & S_IROTH) ? CMD2_OBITS : 0); set->bits = (mode_t)~0; } else { set->cmd2 = CMD2_UBITS | CMD2_GBITS | CMD2_OBITS; set->bits = mask; } if (oparg == '+') set->cmd2 |= CMD2_SET; else if (oparg == '-') set->cmd2 |= CMD2_CLR; else if (oparg == '=') set->cmd2 |= CMD2_SET|CMD2_CLR; break; } return (set + 1); } #ifdef SETMODE_DEBUG static void dumpmode(set) BITCMD *set; { _DIAGASSERT(set != NULL); for (; set->cmd; ++set) (void)printf("cmd: '%c' bits %04o%s%s%s%s%s%s\n", set->cmd, set->bits, set->cmd2 ? " cmd2:" : "", set->cmd2 & CMD2_CLR ? " CLR" : "", set->cmd2 & CMD2_SET ? " SET" : "", set->cmd2 & CMD2_UBITS ? " UBITS" : "", set->cmd2 & CMD2_GBITS ? " GBITS" : "", set->cmd2 & CMD2_OBITS ? " OBITS" : ""); } #endif /* * Given an array of bitcmd structures, compress by compacting consecutive * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u', * 'g' and 'o' commands continue to be separate. They could probably be * compacted, but it's not worth the effort. */ static void compress_mode(set) BITCMD *set; { BITCMD *nset; int setbits, clrbits, Xbits, op; _DIAGASSERT(set != NULL); for (nset = set;;) { /* Copy over any 'u', 'g' and 'o' commands. */ while ((op = nset->cmd) != '+' && op != '-' && op != 'X') { *set++ = *nset++; if (!op) return; } for (setbits = clrbits = Xbits = 0;; nset++) { if ((op = nset->cmd) == '-') { clrbits |= nset->bits; setbits &= ~nset->bits; Xbits &= ~nset->bits; } else if (op == '+') { setbits |= nset->bits; clrbits &= ~nset->bits; Xbits &= ~nset->bits; } else if (op == 'X') Xbits |= nset->bits & ~setbits; else break; } if (clrbits) { set->cmd = '-'; set->cmd2 = 0; set->bits = clrbits; set++; } if (setbits) { set->cmd = '+'; set->cmd2 = 0; set->bits = setbits; set++; } if (Xbits) { set->cmd = 'X'; set->cmd2 = 0; set->bits = Xbits; set++; } } } kbuild-3608/src/kash/memalloc.c0000664000175000017500000004603314670377416016405 0ustar locutuslocutus/* $NetBSD: memalloc.c,v 1.28 2003/08/07 09:05:34 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)memalloc.c 8.3 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: memalloc.c,v 1.28 2003/08/07 09:05:34 agc Exp $"); #endif /* not lint */ #endif #include #include #include "shell.h" #include "output.h" #include "memalloc.h" #include "error.h" #include "machdep.h" #include "mystring.h" #include "shinstance.h" #include "nodes.h" /* * Like malloc, but returns an error when out of space. */ pointer ckmalloc(shinstance *psh, size_t nbytes) { pointer p; p = sh_malloc(psh, nbytes); if (p == NULL) error(psh, "Out of space"); return p; } /* * Same for realloc. */ pointer ckrealloc(struct shinstance *psh, pointer p, size_t nbytes) { p = sh_realloc(psh, p, nbytes); if (p == NULL) error(psh, "Out of space"); return p; } /* * Make a copy of a string in safe storage. */ char * savestr(struct shinstance *psh, const char *s) { char *p; size_t len = strlen(s); p = ckmalloc(psh, len + 1); memcpy(p, s, len + 1); return p; } /* * Parse trees for commands are allocated in lifo order, so we use a stack * to make this more efficient, and also to avoid all sorts of exception * handling code to handle interrupts in the middle of a parse. * * The size 504 was chosen because the Ultrix malloc handles that size * well. */ //#define MINSIZE 504 /* minimum size of a block */ //struct stack_block { // struct stack_block *prev; // char space[MINSIZE]; //}; //struct stack_block stackbase; //struct stack_block *stackp = &stackbase; //struct stackmark *markp; //char *stacknxt = stackbase.space; //int stacknleft = MINSIZE; //int sstrnleft; //int herefd = -1; pointer stalloc(shinstance *psh, size_t nbytes) { char *p; nbytes = SHELL_ALIGN(nbytes); if (nbytes > (size_t)psh->stacknleft || psh->stacknleft < 0) { size_t blocksize; struct stack_block *sp; blocksize = nbytes; if (blocksize < MINSIZE) blocksize = MINSIZE; INTOFF; sp = ckmalloc(psh, sizeof(struct stack_block) - MINSIZE + blocksize); sp->prev = psh->stackp; psh->stacknxt = sp->space; psh->stacknleft = (int)blocksize; psh->stackp = sp; INTON; } p = psh->stacknxt; psh->stacknxt += nbytes; psh->stacknleft -= (int)nbytes; return p; } char * stsavestr(struct shinstance *psh, const char *src) { if (src) { size_t size = strlen(src) + 1; char *dst = (char *)stalloc(psh, size); return (char *)memcpy(dst, src, size); } return NULL; } void stunalloc(shinstance *psh, pointer p) { if (p == NULL) { /*DEBUG */ shfile_write(&psh->fdtab, 2, "stunalloc\n", 10); sh_abort(psh); } psh->stacknleft += (int)(psh->stacknxt - (char *)p); psh->stacknxt = p; } void setstackmark(shinstance *psh, struct stackmark *mark) { mark->stackp = psh->stackp; mark->stacknxt = psh->stacknxt; mark->stacknleft = psh->stacknleft; mark->marknext = psh->markp; #ifdef KASH_SEPARATE_PARSER_ALLOCATOR mark->pstacksize = psh->pstacksize; #endif psh->markp = mark; } void popstackmark(shinstance *psh, struct stackmark *mark) { struct stack_block *sp; INTOFF; psh->markp = mark->marknext; while (psh->stackp != mark->stackp) { sp = psh->stackp; psh->stackp = sp->prev; ckfree(psh, sp); } psh->stacknxt = mark->stacknxt; psh->stacknleft = mark->stacknleft; #ifdef KASH_SEPARATE_PARSER_ALLOCATOR pstackpop(psh, mark->pstacksize); #endif INTON; } /* * When the parser reads in a string, it wants to stick the string on the * stack and only adjust the stack pointer when it knows how big the * string is. Stackblock (defined in stack.h) returns a pointer to a block * of space on top of the stack and stackblocklen returns the length of * this block. Growstackblock will grow this space by at least one byte, * possibly moving it (like realloc). Grabstackblock actually allocates the * part of the block that has been used. */ void growstackblock(shinstance *psh) { int newlen = SHELL_ALIGN(psh->stacknleft * 2 + 100); if (psh->stacknxt == psh->stackp->space && psh->stackp != &psh->stackbase) { struct stack_block *oldstackp; struct stackmark *xmark; struct stack_block *sp; INTOFF; oldstackp = psh->stackp; sp = psh->stackp; psh->stackp = sp->prev; sp = ckrealloc(psh, (pointer)sp, sizeof(struct stack_block) - MINSIZE + newlen); sp->prev = psh->stackp; psh->stackp = sp; psh->stacknxt = sp->space; psh->stacknleft = newlen; /* * Stack marks pointing to the start of the old block * must be relocated to point to the new block */ xmark = psh->markp; while (xmark != NULL && xmark->stackp == oldstackp) { xmark->stackp = psh->stackp; xmark->stacknxt = psh->stacknxt; xmark->stacknleft = psh->stacknleft; xmark = xmark->marknext; } INTON; } else { char *oldspace = psh->stacknxt; int oldlen = psh->stacknleft; char *p = stalloc(psh, newlen); (void)memcpy(p, oldspace, oldlen); psh->stacknxt = p; /* free the space */ psh->stacknleft += newlen; /* we just allocated */ } } void grabstackblock(shinstance *psh, int len) { len = SHELL_ALIGN(len); psh->stacknxt += len; psh->stacknleft -= len; } /* * The following routines are somewhat easier to use than the above. * The user declares a variable of type STACKSTR, which may be declared * to be a register. The macro STARTSTACKSTR initializes things. Then * the user uses the macro STPUTC to add characters to the string. In * effect, STPUTC(psh, c, p) is the same as *p++ = c except that the stack is * grown as necessary. When the user is done, she can just leave the * string there and refer to it using stackblock(psh). Or she can allocate * the space for it using grabstackstr(). If it is necessary to allow * someone else to use the stack temporarily and then continue to grow * the string, the user should use grabstack to allocate the space, and * then call ungrabstr(p) to return to the previous mode of operation. * * USTPUTC is like STPUTC except that it doesn't check for overflow. * CHECKSTACKSPACE can be called before USTPUTC to ensure that there * is space for at least one character. */ char * growstackstr(shinstance *psh) { int len = stackblocksize(psh); if (psh->herefd >= 0 && len >= 1024) { xwrite(psh, psh->herefd, stackblock(psh), len); psh->sstrnleft = len - 1; return stackblock(psh); } growstackblock(psh); psh->sstrnleft = stackblocksize(psh) - len - 1; return stackblock(psh) + len; } /* * Called from CHECKSTRSPACE. */ char * makestrspace(shinstance *psh) { int len = stackblocksize(psh) - psh->sstrnleft; growstackblock(psh); psh->sstrnleft = stackblocksize(psh) - len; return stackblock(psh) + len; } /* * Got better control having a dedicated function for this. * * Was: #define grabstackstr(psh, p) stalloc((psh), stackblocksize(psh) - (psh)->sstrnleft) */ char * grabstackstr(shinstance *psh, char *end) { char * const pstart = stackblock(psh); size_t nbytes = (size_t)(end - pstart); kHlpAssert((uintptr_t)end >= (uintptr_t)pstart); /*kHlpAssert(end[-1] == '\0'); - not if it's followed by ungrabstrackstr(), sigh. */ kHlpAssert(SHELL_ALIGN((uintptr_t)pstart) == (uintptr_t)pstart); kHlpAssert(stackblocksize(psh) - psh->sstrnleft >= (ssize_t)nbytes); nbytes = SHELL_ALIGN(nbytes); psh->stacknxt += nbytes; psh->stacknleft -= (int)nbytes; kHlpAssert(psh->stacknleft >= 0); return pstart; } void ungrabstackstr(shinstance *psh, char *s, char *p) { kHlpAssert((size_t)(psh->stacknxt - p) <= SHELL_SIZE); kHlpAssert((uintptr_t)s >= (uintptr_t)&psh->stackp->space[0]); kHlpAssert((uintptr_t)p >= (uintptr_t)s); psh->stacknleft += (int)(psh->stacknxt - s); psh->stacknxt = s; psh->sstrnleft = (int)(psh->stacknleft - (p - s)); } /* * Parser stack allocator. */ #ifdef KASH_SEPARATE_PARSER_ALLOCATOR unsigned pstackrelease(shinstance *psh, pstack_block *pst, const char *caller) { unsigned refs; if (pst) { refs = sh_atomic_dec(&pst->refs); TRACE2((NULL, "pstackrelease: %p - %u refs (%s)\n", pst, refs, caller)); K_NOREF(caller); if (refs == 0) { struct stack_block *top; while ((top = pst->top) != &pst->first) { pst->top = top->prev; kHlpAssert(pst->top); top->prev = NULL; sh_free(psh, top); } pst->nextbyte = NULL; pst->top = NULL; if (!psh->freepstack) psh->freepstack = pst; else sh_free(psh, pst); } } else refs = 0; return refs; } void pstackpop(shinstance *psh, unsigned target) { kHlpAssert(target <= psh->pstacksize); while (target < psh->pstacksize) { unsigned idx = --psh->pstacksize; pstack_block *pst = psh->pstack[idx]; psh->pstack[idx] = NULL; if (psh->curpstack == pst) { pstack_block *pstnext; if (idx <= 0 || (pstnext = psh->pstack[idx - 1])->done) psh->curpstack = NULL; else psh->curpstack = pstnext; } pstackrelease(psh, pst, "popstackmark"); } # ifndef NDEBUG if (psh->curpstack) { unsigned i; for (i = 0; i < psh->pstacksize; i++) if (psh->curpstack == psh->pstack[i]) break; kHlpAssert(i < psh->pstacksize); } # endif } unsigned pstackretain(pstack_block *pst) { unsigned refs = sh_atomic_inc(&pst->refs); kHlpAssert(refs > 1); kHlpAssert(refs < 256 /* bogus, but useful */); return refs; } K_INLINE void pstackpush(shinstance *psh, pstack_block *pst) { unsigned i = psh->pstacksize; if (i + 1 < psh->pstackalloced) { /* likely, except for the first time */ } else { psh->pstack = (pstack_block **)ckrealloc(psh, psh->pstack, sizeof(psh->pstack[0]) * (i + 32)); memset(&psh->pstack[i], 0, sizeof(psh->pstack[0]) * 32); } psh->pstack[i] = pst; psh->pstacksize = i + 1; } /* Does not make it current! */ unsigned pstackretainpush(shinstance *psh, pstack_block *pst) { unsigned refs = pstackretain(pst); pstackpush(psh, pst); TRACE2((psh, "pstackretainpush: %p - entry %u - %u refs\n", pst, psh->pstacksize - 1, refs)); return refs; } pstack_block *pstackallocpush(shinstance *psh) { size_t const blocksize = offsetof(pstack_block, first.space) + MINSIZE; pstack_block *pst; INTOFF; /* * Allocate and initialize it. */ pst = psh->freepstack; if (pst) psh->freepstack = NULL; else pst = (pstack_block *)ckmalloc(psh, blocksize); pst->nextbyte = &pst->first.space[0]; pst->avail = blocksize - offsetof(pstack_block, first.space); pst->topsize = blocksize - offsetof(pstack_block, first.space); pst->strleft = 0; pst->top = &pst->first; pst->allocations = 0; pst->bytesalloced = 0; pst->nodesalloced = 0; pst->entriesalloced = 0; pst->strbytesalloced = 0; pst->blocks = 0; pst->fragmentation = 0; pst->refs = 1; pst->done = K_FALSE; pst->first.prev = NULL; /* * Push it onto the stack and make it current. */ pstackpush(psh, pst); psh->curpstack = pst; INTON; TRACE2((psh, "pstackallocpush: %p - entry %u\n", pst, psh->pstacksize - 1)); return pst; } /** * Marks the block as done, preventing it from being marked current again. */ void pstackmarkdone(pstack_block *pst) { pst->done = K_TRUE; } /** * Allocates and pushes a new block onto the stack, min payload size @a nbytes. */ static void pstallocnewblock(shinstance *psh, pstack_block *pst, size_t nbytes) { /* Allocate a new stack node. */ struct stack_block *sp; size_t const blocksize = nbytes <= MINSIZE ? offsetof(struct stack_block, space) + MINSIZE : K_ALIGN_Z(nbytes + offsetof(struct stack_block, space), 1024); INTOFF; sp = ckmalloc(psh, blocksize); sp->prev = pst->top; pst->fragmentation += pst->avail; pst->topsize = blocksize - offsetof(struct stack_block, space); pst->avail = blocksize - offsetof(struct stack_block, space); pst->nextbyte = sp->space; pst->top = sp; pst->blocks += 1; INTON; } /** * Tries to grow the current stack block to hold a minimum of @a nbytes, * will allocate a new block and copy over pending string bytes if that's not * possible. */ static void pstgrowblock(shinstance *psh, pstack_block *pst, size_t nbytes, size_t tocopy) { struct stack_block *top = pst->top; size_t blocksize; kHlpAssert(pst->avail < nbytes); /* only called when we need more space */ kHlpAssert(tocopy <= pst->avail); /* Double the size used thus far and add some fudge and alignment. Make sure to at least allocate MINSIZE. */ blocksize = K_MAX(K_ALIGN_Z(pst->avail * 2 + 100 + offsetof(struct stack_block, space), 64), MINSIZE); /* If that isn't sufficient, do request size w/ some fudge and alignment. */ if (blocksize < nbytes + offsetof(struct stack_block, space)) blocksize = K_ALIGN_Z(nbytes + offsetof(struct stack_block, space) + 100, 1024); /* * Reallocate the current stack node if we can. */ if ( pst->nextbyte == &top->space[0] /* can't have anything else in the block */ && top->prev != NULL /* first block is embedded in pst and cannot be reallocated */ ) { top = (struct stack_block *)ckrealloc(psh, top, blocksize); pst->top = top; pst->topsize = blocksize - offsetof(struct stack_block, space); pst->avail = blocksize - offsetof(struct stack_block, space); pst->nextbyte = top->space; } /* * Otherwise allocate a new node and copy over the avail bytes * from the old one. */ else { char const * const copysrc = pst->nextbyte; pstallocnewblock(psh, pst, nbytes); kHlpAssert(pst->avail >= nbytes); kHlpAssert(pst->avail >= tocopy); memcpy(pst->nextbyte, copysrc, tocopy); } } K_INLINE void *pstallocint(shinstance *psh, pstack_block *pst, size_t nbytes) { void *ret; /* * Align the size and make sure we've got sufficient bytes available: */ nbytes = SHELL_ALIGN(nbytes); if (pst->avail >= nbytes && (ssize_t)pst->avail >= 0) { /* likely*/ } else pstallocnewblock(psh, pst, nbytes); /* * Carve out the return block. */ ret = pst->nextbyte; pst->nextbyte += nbytes; pst->avail -= nbytes; pst->bytesalloced += nbytes; pst->allocations += 1; return ret; } #endif /* KASH_SEPARATE_PARSER_ALLOCATOR */ void *pstalloc(struct shinstance *psh, size_t nbytes) { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR return pstallocint(psh, psh->curpstack, nbytes); #else return stalloc(psh, nbytes); #endif } union node *pstallocnode(struct shinstance *psh, size_t nbytes) { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR pstack_block * const pst = psh->curpstack; union node * const ret = (union node *)pstallocint(psh, pst, nbytes); pst->nodesalloced++; ret->pblock = pst; return ret; #else return (union node *)pstalloc(psh, nbytes); #endif } struct nodelist *pstalloclist(struct shinstance *psh) { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR pstack_block *pst = psh->curpstack; pst->entriesalloced++; return (struct nodelist *)pstallocint(psh, pst, sizeof(struct nodelist)); #endif return (struct nodelist *)pstalloc(psh, sizeof(struct nodelist)); } char *pstsavestr(struct shinstance *psh, const char *str) { if (str) { size_t const nbytes = strlen(str) + 1; #ifdef KASH_SEPARATE_PARSER_ALLOCATOR pstack_block *pst = psh->curpstack; pst->strbytesalloced += SHELL_ALIGN(nbytes); return (char *)memcpy(pstallocint(psh, pst, nbytes), str, nbytes); #else return (char *)memcpy(pstalloc(psh, nbytes), str, nbytes); #endif } return NULL; } char *pstmakestrspace(struct shinstance *psh, size_t minbytes, char *end) { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR pstack_block *pst = psh->curpstack; size_t const len = end - pst->nextbyte; kHlpAssert(pst->avail - pst->strleft == len); TRACE2((psh, "pstmakestrspace: len=%u minbytes=%u (=> %u)\n", len, minbytes, len + minbytes)); pstgrowblock(psh, pst, minbytes + len, len); pst->strleft = pst->avail - len; return pst->nextbyte + len; #else size_t const len = end - stackblock(psh); kHlpAssert(stackblocksize(psh) - psh->sstrnleft == len); TRACE2((psh, "pstmakestrspace: len=%u minbytes=%u (=> %u)\n", len, minbytes, len + minbytes)); minbytes += len; while (stackblocksize(psh) < minbytes) growstackblock(psh); psh->sstrnleft = (int)(stackblocksize(psh) - len); return (char *)stackblock(psh) + len; #endif } /* PSTPUTC helper */ char *pstputcgrow(shinstance *psh, char *end, char c) { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR pstack_block *pst = psh->curpstack; pst->strleft++; /* PSTPUTC() already incremented it. */ end = pstmakestrspace(psh, 1, end); kHlpAssert(pst->strleft > 0); pst->strleft--; #else psh->sstrnleft++; /* PSTPUTC() already incremented it. */ end = pstmakestrspace(psh, 1, end); kHlpAssert(psh->sstrnleft > 0); psh->sstrnleft--; #endif *end++ = c; return end; } char *pstgrabstr(struct shinstance *psh, char *end) { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR pstack_block *pst = psh->curpstack; char * const pstart = pst->nextbyte; size_t nbytes = (size_t)(end - pstart); kHlpAssert((uintptr_t)end > (uintptr_t)pstart); kHlpAssert(end[-1] == '\0'); kHlpAssert(SHELL_ALIGN((uintptr_t)pstart) == (uintptr_t)pstart); kHlpAssert(pst->avail - pst->strleft >= nbytes); nbytes = SHELL_ALIGN(nbytes); /** @todo don't align strings, align the other allocations. */ pst->nextbyte += nbytes; pst->avail -= nbytes; pst->strbytesalloced += nbytes; return pstart; #else char * const pstart = stackblock(psh); size_t nbytes = (size_t)(end - pstart); kHlpAssert((uintptr_t)end > (uintptr_t)pstart); kHlpAssert(end[-1] == '\0'); kHlpAssert(SHELL_ALIGN((uintptr_t)pstart) == (uintptr_t)pstart); kHlpAssert(stackblocksize(psh) - psh->sstrnleft >= nbytes); nbytes = SHELL_ALIGN(nbytes); /** @todo don't align strings, align the other allocations. */ psh->stacknxt += nbytes; psh->stacknleft -= (int)nbytes; return pstart; #endif } kbuild-3608/src/kash/strsignal.c0000664000175000017500000000031614670377416016614 0ustar locutuslocutus/* * Fake strsignal (for Windows/MSC). */ #include "shinstance.h" /* for MSC */ #include const char *strsignal(int iSig) { if (iSig < NSIG) return sys_signame[iSig]; return NULL; } kbuild-3608/src/kash/mail.h0000664000175000017500000000344014670377416015536 0ustar locutuslocutus/* $NetBSD: mail.h,v 1.10 2003/08/07 09:05:34 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)mail.h 8.2 (Berkeley) 5/4/95 */ void chkmail(struct shinstance *, int); kbuild-3608/src/kash/exec.c0000664000175000017500000007762714670377416015555 0ustar locutuslocutus/* $NetBSD: exec.c,v 1.37 2003/08/07 09:05:31 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)exec.c 8.4 (Berkeley) 6/8/95"; #else __RCSID("$NetBSD: exec.c,v 1.37 2003/08/07 09:05:31 agc Exp $"); #endif /* not lint */ #endif #include #include #include #include #include /* * When commands are first encountered, they are entered in a hash table. * This ensures that a full path search will not have to be done for them * on each invocation. * * We should investigate converting to a linear search, even though that * would make the command name "hash" a misnomer. */ #include "shell.h" #include "main.h" #include "nodes.h" #include "parser.h" #include "redir.h" #include "eval.h" #include "exec.h" #include "builtins.h" #include "var.h" #include "options.h" #include "input.h" #include "output.h" #include "syntax.h" #include "memalloc.h" #include "error.h" #include "init.h" #include "mystring.h" #include "show.h" #include "jobs.h" #include "alias.h" #ifdef __INNOTEK_LIBC__ #include #endif #include "shinstance.h" //#define CMDTABLESIZE 31 /* should be prime */ //#define ARB 1 /* actual size determined at run time */ // // // //struct tblentry { // struct tblentry *next; /* next entry in hash chain */ // union param param; /* definition of builtin function */ // short cmdtype; /* index identifying command */ // char rehash; /* if set, cd done since entry created */ // char cmdname[ARB]; /* name of command */ //}; // // //STATIC struct tblentry *cmdtable[CMDTABLESIZE]; //STATIC int builtinloc = -1; /* index in path of %builtin, or -1 */ //int exerrno = 0; /* Last exec error */ #ifdef PC_EXE_EXTS STATIC const char * const g_exe_suffixes[] = { "", ".exe", ".cmd", ".btm", ".com" }; #endif STATIC void tryexec(shinstance *, char *, char **, char **, int); STATIC void execinterp(shinstance *, char **, char **); STATIC void printentry(shinstance *, struct tblentry *, int); STATIC void clearcmdentry(shinstance *, int); STATIC struct tblentry *cmdlookup(shinstance *, const char *, int); STATIC void delete_cmd_entry(shinstance *); #ifdef PC_EXE_EXTS STATIC int stat_pc_exec_exts(shinstance *, char *fullname, int has_ext, int *suffixp); #endif extern char *const parsekwd[]; #ifndef SH_FORKED_MODE void subshellinitexec(shinstance *psh, shinstance *inherit) { unsigned i; for (i = 0; i < K_ELEMENTS(inherit->cmdtable); i++) { struct tblentry const *csrc = inherit->cmdtable[i]; if (!csrc) { } else { struct tblentry **ppdst = &psh->cmdtable[i]; do { size_t const namesize = strlen(csrc->cmdname) + 1; size_t const entrysize = offsetof(struct tblentry, cmdname) + namesize; struct tblentry *dst = (struct tblentry *)ckmalloc(psh, entrysize); memcpy(dst->cmdname, csrc->cmdname, namesize); dst->rehash = csrc->rehash; dst->cmdtype = csrc->cmdtype; dst->param.func = NULL; switch (csrc->cmdtype) { case CMDUNKNOWN: case CMDNORMAL: dst->param.n.index = csrc->param.n.index; dst->param.n.suffix = csrc->param.n.suffix; break; case CMDFUNCTION: dst->param.func = copyfunc(psh, csrc->param.func); /** @todo optimize function allocations */ break; case CMDBUILTIN: case CMDSPLBLTIN: dst->param.bltin = csrc->param.bltin; break; } *ppdst = dst; ppdst = &dst->next; csrc = csrc->next; } while (csrc); *ppdst = NULL; } } psh->builtinloc = inherit->builtinloc; } #endif /* SH_FORKED_MODE */ /* * Check if 'path' is an absolute (starts with root) path or not. */ K_INLINE int isabspath(const char *path) { #if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 if (path[0] == '/' || path[0] == '\\') { if ( (path[1] == '/' || path[1] == '\\') && (path[2] != '/' && path[2] != '\\' && path[2])) return 1; } else if (path[0] && path[1] == ':' && (path[2] == '\\' || path[2] == '/') && isalpha(path[0])) { return 1; } return 0; #else return path[0] == '/'; #endif } /* * Checks if the filename include a path or not. */ K_INLINE int haspath(const char *name) { #if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 return strchr(name, '/') != NULL || strchr(name, '\\') != NULL || (name[0] && name[1] == ':'); #else return strchr(name, '/') != NULL; #endif } /* * Exec a program. Never returns. If you change this routine, you may * have to change the find_command routine as well. */ SH_NORETURN_1 void shellexec(shinstance *psh, char **argv, char **envp, const char *path, int idx, int suffix) { char *cmdname; int e; const char *argv0 = argv[0]; int argv0len = (int)strlen(argv0); char kmkcmd[48]; #ifdef PC_EXE_EXTS int has_ext = argv0len - 4; has_ext = has_ext > 0 && argv0[has_ext] == '.' /* use strstr and upper/lower permuated extensions to avoid multiple strcasecmp calls. */ && strstr("exe;" "Exe;" "EXe;" "EXE;" "ExE;" "eXe;" "eXE;" "exE;" "cmd;" "Cmd;" "CMd;" "CMD;" "CmD;" "cMd;" "cMD;" "cmD;" "com;" "Com;" "COm;" "COM;" "CoM;" "cOm;" "cOM;" "coM;" "bat;" "Bat;" "BAt;" "BAT;" "BaT;" "bAt;" "bAT;" "baT;" "btm;" "Btm;" "BTm;" "BTM;" "BtM;" "bTm;" "bTM;" "btM;", argv0 + has_ext + 1) != NULL; #else const int has_ext = 1; #endif TRACE((psh, "shellexec: argv[0]=%s idx=%d suffix=%d\n", argv0, idx, suffix)); if (haspath(argv0)) { #ifdef PC_EXE_EXTS if (!has_ext && suffix && (unsigned)suffix < K_ELEMENTS(g_exe_suffixes)) { size_t sufflen = strlen(g_exe_suffixes[suffix]); cmdname = stalloc(psh, argv0len + sufflen + 1); memcpy(cmdname, argv0, argv0len); memcpy(cmdname + argv0len, g_exe_suffixes[suffix], sufflen + 1); tryexec(psh, cmdname, argv, envp, 1); } else #endif { cmdname = stalloc(psh, argv0len + 5); memcpy(cmdname, argv0, argv0len + 1); tryexec(psh, cmdname, argv, envp, has_ext); } TRACE((psh, "shellexec: cmdname=%s\n", cmdname)); stunalloc(psh, cmdname); e = errno; } else { /* Before we search the PATH, transform kmk_builtin_% to kmk_% so we don't need to be too careful mixing internal and external kmk commands. */ if ( argv0len > 12 && argv0len < 42 && strncmp(argv0, "kmk_builtin_", 12) == 0 && strpbrk(argv0 + 12, "./\\-:;<>") == NULL) { memcpy(kmkcmd, "kmk_", 4); memcpy(&kmkcmd[4], argv0 + 12, argv0len + 1 - 8); TRACE((psh, "shellexec: dropped '_builtin' from %s to %s\n", argv0, kmkcmd)); argv0len -= 8; argv0 = kmkcmd; } e = ENOENT; while ((cmdname = padvance(psh, &path, argv0)) != NULL) { if (--idx < 0 && psh->pathopt == NULL) { #ifdef PC_EXE_EXTS if (!has_ext && idx == -1 && suffix && (unsigned)suffix < K_ELEMENTS(g_exe_suffixes)) { strcat(cmdname, g_exe_suffixes[suffix]); tryexec(psh, cmdname, argv, envp, 1); } else #endif tryexec(psh, cmdname, argv, envp, has_ext); if (errno != ENOENT && errno != ENOTDIR) e = errno; } stunalloc(psh, cmdname); } } /* Map to POSIX errors */ switch (e) { case EACCES: psh->exerrno = 126; break; case ENOENT: psh->exerrno = 127; break; default: psh->exerrno = 2; break; } TRACE((psh, "shellexec failed for '%s', errno %d, suppressint %d\n", argv[0], e, psh->suppressint )); exerror(psh, EXEXEC, "%s: %s", argv[0], errmsg(psh, e, E_EXEC)); /* NOTREACHED */ } STATIC void tryexec(shinstance *psh, char *cmd, char **argv, char **envp, int has_ext) { int e; #ifdef EXEC_HASH_BANG_SCRIPT char *p; #endif #ifdef PC_EXE_EXTS /* exploit the effect of stat_pc_exec_exts which adds the * correct extentions to the file. */ if (!has_ext) { int suffix; stat_pc_exec_exts(psh, cmd, 0, &suffix); } #endif #if defined(__INNOTEK_LIBC__) && defined(EXEC_HASH_BANG_SCRIPT) __libc_Back_gfProcessHandleHashBangScripts = 0; #endif #ifdef SYSV do { sh_execve(psh, cmd, argv, envp); } while (errno == EINTR); #else sh_execve(psh, cmd, (const char * const*)argv, (const char * const*)envp); #endif e = errno; if (e == ENOEXEC) { initshellproc(psh); setinputfile(psh, cmd, 0); if (psh->commandnamemalloc) { sh_free(psh, psh->commandname); psh->commandnamemalloc = 0; } if (psh->arg0malloc) sh_free(psh, psh->arg0); psh->commandname = psh->arg0 = savestr(psh, argv[0]); psh->arg0malloc = 1; #ifdef EXEC_HASH_BANG_SCRIPT pgetc(psh); pungetc(psh); /* fill up input buffer */ p = psh->parsenextc; if (psh->parsenleft > 2 && p[0] == '#' && p[1] == '!') { argv[0] = cmd; execinterp(psh, argv, envp); } #endif setparam(psh, argv + 1); exraise(psh, EXSHELLPROC); } errno = e; } #ifdef EXEC_HASH_BANG_SCRIPT /* * Checks if NAME is the (base) name of the shell executable or something * very similar. */ STATIC int is_shell_exe_name(const char *name) { return equal(name, "kmk_ash") || equal(name, "kmk_sh") || equal(name, "kash") || equal(name, "sh"); } /* * Execute an interpreter introduced by "#!", for systems where this * feature has not been built into the kernel. If the interpreter is * the shell, return (effectively ignoring the "#!"). If the execution * of the interpreter fails, exit. * * This code peeks inside the input buffer in order to avoid actually * reading any input. It would benefit from a rewrite. */ #define NEWARGS 16 STATIC void execinterp(shinstance *psh, char **argv, char **envp) { int n; char *inp; char *outp; char c; char *p; char **ap; char *newargs[NEWARGS]; intptr_t i; char **ap2; char **new; /* Split the string into arguments. */ n = psh->parsenleft - 2; inp = psh->parsenextc + 2; ap = newargs; for (;;) { while (--n >= 0 && (*inp == ' ' || *inp == '\t')) inp++; if (n < 0) goto bad; if ((c = *inp++) == '\n') break; if (ap == &newargs[NEWARGS]) bad: error(psh, "Bad #! line"); STARTSTACKSTR(psh, outp); do { STPUTC(psh, c, outp); } while (--n >= 0 && (c = *inp++) != ' ' && c != '\t' && c != '\n'); STPUTC(psh, '\0', outp); n++, inp--; *ap++ = grabstackstr(psh, outp); } /* /usr/bin/env emulation, very common with kash/kmk_ash. */ i = ap - newargs; if (i > 1 && equal(newargs[0], "/usr/bin/env")) { if ( !strchr(newargs[1], '=') && newargs[1][0] != '-') { /* shellexec below searches the PATH for us, so just drop /usr/bin/env. */ TRACE((psh, "hash bang /usr/bin/env utility, dropping /usr/bin/env\n")); ap--; i--; for (n = 0; n < i; n++) newargs[n] = newargs[n + 1]; } /* else: complicated invocation */ } /* If the interpreter is the shell or a similar shell, there is no need to exec. */ if (i == 1) { p = strrchr(newargs[0], '/'); if (!p) p = newargs[0]; if (is_shell_exe_name(p)) { TRACE((psh, "hash bang self\n")); return; } } /* Combine the two argument lists and exec. */ i = (char *)ap - (char *)newargs; /* size in bytes */ if (i == 0) error(psh, "Bad #! line"); for (ap2 = argv ; *ap2++ != NULL ; ); new = ckmalloc(psh, i + ((char *)ap2 - (char *)argv)); ap = newargs, ap2 = new; while ((i -= sizeof (char **)) >= 0) *ap2++ = *ap++; ap = argv; while ((*ap2++ = *ap++)) /* nothing*/; TRACE((psh, "hash bang '%s'\n", new[0])); shellexec(psh, new, envp, pathval(psh), 0, -1); /* NOTREACHED */ } #endif /* EXEC_HASH_BANG_SCRIPT */ /* * Do a path search. The variable path (passed by reference) should be * set to the start of the path before the first call; padvance will update * this value as it proceeds. Successive calls to padvance will return * the possible path expansions in sequence. If an option (indicated by * a percent sign) appears in the path entry then the global variable * psh->pathopt will be set to point to it; otherwise psh->pathopt will be set to * NULL. */ //const char *pathopt; char * padvance(shinstance *psh, const char **path, const char *name) { const char *p; char *q; const char *start; int len; if (*path == NULL) return NULL; start = *path; #ifdef PC_PATH_SEP for (p = start ; *p && *p != ';' && *p != '%' ; p++); #else for (p = start ; *p && *p != ':' && *p != '%' ; p++); #endif len = (int)(p - start + strlen(name) + 2); /* "2" is for '/' and '\0' */ #ifdef PC_EXE_EXTS len += 4; /* "4" is for .exe/.com/.cmd/.bat/.btm */ #endif while (stackblocksize(psh) < len) growstackblock(psh); q = stackblock(psh); if (p != start) { memcpy(q, start, p - start); q += p - start; *q++ = '/'; } strcpy(q, name); psh->pathopt = NULL; if (*p == '%') { psh->pathopt = ++p; #ifdef PC_PATH_SEP while (*p && *p != ';') p++; #else while (*p && *p != ':') p++; #endif } #ifdef PC_PATH_SEP if (*p == ';') #else if (*p == ':') #endif *path = p + 1; else *path = NULL; return stalloc(psh, len); } #ifdef PC_EXE_EXTS STATIC int stat_pc_exec_exts(shinstance *psh, char *fullname, int has_ext, int *suffixp) { int isreg; /* skip the SYSV crap */ if ((isreg = shfile_stat_isreg(&psh->fdtab, fullname)) >= 1) { *suffixp = 0; return isreg; } if (!has_ext && errno == ENOENT) { /* Ignore non-regular files here. */ char *psz = strchr(fullname, '\0'); int i; for (i = 1 /*first entry is empty*/; i < K_ELEMENTS(g_exe_suffixes); i++) { strcpy(psz, g_exe_suffixes[i]); if ((isreg = shfile_stat_isreg(&psh->fdtab, fullname)) >= 1) { *suffixp = i; return isreg; } if (isreg < 0 && errno != ENOENT && errno != ENOTDIR) break; } } *suffixp = -1; return isreg; } #endif /* PC_EXE_EXTS */ /*** Command hashing code ***/ int hashcmd(shinstance *psh, int argc, char **argv) { struct tblentry **pp; struct tblentry *cmdp; int c; int verbose; struct cmdentry entry; char *name; verbose = 0; while ((c = nextopt(psh, "rv")) != '\0') { if (c == 'r') { clearcmdentry(psh, 0); } else if (c == 'v') { verbose++; } } if (*psh->argptr == NULL) { for (pp = psh->cmdtable ; pp < &psh->cmdtable[CMDTABLESIZE] ; pp++) { for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) { if (verbose || cmdp->cmdtype == CMDNORMAL) printentry(psh, cmdp, verbose); } } return 0; } while ((name = *psh->argptr) != NULL) { if ((cmdp = cmdlookup(psh, name, 0)) != NULL && (cmdp->cmdtype == CMDNORMAL || (cmdp->cmdtype == CMDBUILTIN && psh->builtinloc >= 0))) delete_cmd_entry(psh); find_command(psh, name, &entry, DO_ERR, pathval(psh)); if (verbose) { if (entry.cmdtype != CMDUNKNOWN) { /* if no error msg */ cmdp = cmdlookup(psh, name, 0); printentry(psh, cmdp, verbose); } output_flushall(psh); } psh->argptr++; } return 0; } STATIC void printentry(shinstance *psh, struct tblentry *cmdp, int verbose) { int idx; const char *path; char *name; switch (cmdp->cmdtype) { case CMDNORMAL: idx = cmdp->param.n.index; path = pathval(psh); do { name = padvance(psh, &path, cmdp->cmdname); stunalloc(psh, name); } while (--idx >= 0); out1str(psh, name); #ifdef PC_EXE_EXTS if ((unsigned)cmdp->param.n.suffix < K_ELEMENTS(g_exe_suffixes)) out1str(psh, g_exe_suffixes[cmdp->param.n.suffix]); #endif break; case CMDSPLBLTIN: out1fmt(psh, "special builtin %s", cmdp->cmdname); break; case CMDBUILTIN: out1fmt(psh, "builtin %s", cmdp->cmdname); break; case CMDFUNCTION: out1fmt(psh, "function %s", cmdp->cmdname); if (verbose) { struct procstat ps; INTOFF; commandtext(psh, &ps, cmdp->param.func); INTON; out1str(psh, "() { "); out1str(psh, ps.cmd); out1str(psh, "; }"); } break; default: error(psh, "internal error: %s cmdtype %d", cmdp->cmdname, cmdp->cmdtype); } if (cmdp->rehash) out1c(psh, '*'); out1c(psh, '\n'); } /* * Resolve a command name. If you change this routine, you may have to * change the shellexec routine as well. */ void find_command(shinstance *psh, char *name, struct cmdentry *entry, int act, const char *path) { struct tblentry *cmdp, loc_cmd; int idx; int prev; char *fullname; int e; int (*bltin)(shinstance*,int,char **); int argv0len = (int)strlen(name); char kmkcmd[48]; #ifdef PC_EXE_EXTS int has_ext = argv0len - 4; has_ext = has_ext > 0 && name[has_ext] == '.' /* use strstr and upper/lower permuated extensions to avoid multiple strcasecmp calls. */ && strstr("exe;" "Exe;" "EXe;" "EXE;" "ExE;" "eXe;" "eXE;" "exE;" "cmd;" "Cmd;" "CMd;" "CMD;" "CmD;" "cMd;" "cMD;" "cmD;" "com;" "Com;" "COm;" "COM;" "CoM;" "cOm;" "cOM;" "coM;" "bat;" "Bat;" "BAt;" "BAT;" "BaT;" "bAt;" "bAT;" "baT;" "btm;" "Btm;" "BTm;" "BTM;" "BtM;" "bTm;" "bTM;" "btM;", name + has_ext + 1) != NULL; #endif /* If name contains a slash, don't use PATH or hash table */ if (haspath(name)) { if (act & DO_ABS) { while (shfile_stat_exists(&psh->fdtab, name) < 0) { #ifdef SYSV if (errno == EINTR) continue; #endif if (errno != ENOENT && errno != ENOTDIR) e = errno; entry->cmdtype = CMDUNKNOWN; entry->u.n.index = -1; entry->u.n.suffix = -1; return; } entry->cmdtype = CMDNORMAL; entry->u.n.index = -1; entry->u.n.suffix = -1; return; } entry->cmdtype = CMDNORMAL; entry->u.n.index = 0; entry->u.n.suffix = 0; return; } if (path != pathval(psh)) act |= DO_ALTPATH; if (act & DO_ALTPATH && strstr(path, "%builtin") != NULL) act |= DO_ALTBLTIN; /* If name is in the table, check answer will be ok */ if ((cmdp = cmdlookup(psh, name, 0)) != NULL) { do { switch (cmdp->cmdtype) { case CMDNORMAL: if (act & DO_ALTPATH) { cmdp = NULL; continue; } break; case CMDFUNCTION: if (act & DO_NOFUNC) { cmdp = NULL; continue; } break; case CMDBUILTIN: if ((act & DO_ALTBLTIN) || psh->builtinloc >= 0) { cmdp = NULL; continue; } break; } /* if not invalidated by cd, we're done */ if (cmdp->rehash == 0) goto success; } while (0); } /* If %builtin not in path, check for builtin next */ if ((act & DO_ALTPATH ? !(act & DO_ALTBLTIN) : psh->builtinloc < 0) && (bltin = find_builtin(psh, name)) != 0) goto builtin_success; /* We have to search path. */ prev = -1; /* where to start */ if (cmdp) { /* doing a rehash */ if (cmdp->cmdtype == CMDBUILTIN) prev = psh->builtinloc; else prev = cmdp->param.n.index; } /* Before we search the PATH, transform kmk_builtin_% to kmk_% so we don't need to be too careful mixing internal and external kmk command. */ if ( argv0len > 12 && argv0len < (int)sizeof(kmkcmd) && strncmp(name, "kmk_builtin_", 12) == 0 && strpbrk(name + 12, "./\\-:;<>") == NULL) { memcpy(kmkcmd, "kmk_", 4); memcpy(&kmkcmd[4], name + 12, argv0len + 1 - 8); TRACE((psh, "find_command: dropped '_builtin' from %s to %s\n", name, kmkcmd)); argv0len -= 8; name = kmkcmd; } e = ENOENT; idx = -1; loop: while ((fullname = padvance(psh, &path, name)) != NULL) { #ifdef PC_EXE_EXTS int suffix; #endif int isreg; stunalloc(psh, fullname); idx++; if (psh->pathopt) { if (prefix("builtin", psh->pathopt)) { if ((bltin = find_builtin(psh, name)) == 0) goto loop; goto builtin_success; } else if (prefix("func", psh->pathopt)) { /* handled below */ } else { /* ignore unimplemented options */ goto loop; } } /* if rehash, don't redo absolute path names */ if (idx <= prev && isabspath(fullname)) { if (idx < prev) goto loop; TRACE((psh, "searchexec \"%s\": no change\n", name)); goto success; } #ifdef PC_EXE_EXTS while ((isreg = stat_pc_exec_exts(psh, fullname, has_ext, &suffix)) < 0) { #else while ((isreg = shfile_stat_isreg(&psh->fdtab, fullname)) < 0) { #endif #ifdef SYSV if (errno == EINTR) continue; #endif if (errno != ENOENT && errno != ENOTDIR) e = errno; goto loop; } e = EACCES; /* if we fail, this will be the error */ if (isreg < 1) goto loop; if (psh->pathopt) { /* this is a %func directory */ if (act & DO_NOFUNC) goto loop; stalloc(psh, strlen(fullname) + 1); readcmdfile(psh, fullname); if ((cmdp = cmdlookup(psh, name, 0)) == NULL || cmdp->cmdtype != CMDFUNCTION) error(psh, "%s not defined in %s", name, fullname); stunalloc(psh, fullname); goto success; } #ifdef notdef /* XXX this code stops root executing stuff, and is buggy if you need a group from the group list. */ if (statb.st_uid == sh_geteuid(psh)) { if ((statb.st_mode & 0100) == 0) goto loop; } else if (statb.st_gid == sh_getegid(psh)) { if ((statb.st_mode & 010) == 0) goto loop; } else { if ((statb.st_mode & 01) == 0) goto loop; } #endif TRACE((psh, "searchexec \"%s\" returns \"%s\"\n", name, fullname)); INTOFF; if (act & DO_ALTPATH) { stalloc(psh, strlen(fullname) + 1); cmdp = &loc_cmd; } else cmdp = cmdlookup(psh, name, 1); cmdp->cmdtype = CMDNORMAL; cmdp->param.n.index = idx; #ifdef PC_EXE_EXTS cmdp->param.n.suffix = suffix; #else cmdp->param.n.suffix = 0; #endif INTON; goto success; } /* We failed. If there was an entry for this command, delete it */ if (cmdp) delete_cmd_entry(psh); if (act & DO_ERR) outfmt(psh->out2, "%s: %s\n", name, errmsg(psh, e, E_EXEC)); entry->cmdtype = CMDUNKNOWN; return; builtin_success: INTOFF; if (act & DO_ALTPATH) cmdp = &loc_cmd; else cmdp = cmdlookup(psh, name, 1); if (cmdp->cmdtype == CMDFUNCTION) /* DO_NOFUNC must have been set */ cmdp = &loc_cmd; cmdp->cmdtype = CMDBUILTIN; cmdp->param.bltin = bltin; INTON; success: cmdp->rehash = 0; entry->cmdtype = cmdp->cmdtype; entry->u = cmdp->param; } /* * Search the table of builtin commands. */ int (*find_builtin(shinstance *psh, char *name))(shinstance *psh, int, char **) { const struct builtincmd *bp; for (bp = builtincmd ; bp->name ; bp++) { if (*bp->name == *name && equal(bp->name, name)) return bp->builtin; } return 0; } int (*find_splbltin(shinstance *psh, char *name))(shinstance *psh, int, char **) { const struct builtincmd *bp; for (bp = splbltincmd ; bp->name ; bp++) { if (*bp->name == *name && equal(bp->name, name)) return bp->builtin; } return 0; } /* * At shell startup put special builtins into hash table. * ensures they are executed first (see posix). * We stop functions being added with the same name * (as they are impossible to call) */ void hash_special_builtins(shinstance *psh) { const struct builtincmd *bp; struct tblentry *cmdp; for (bp = splbltincmd ; bp->name ; bp++) { cmdp = cmdlookup(psh, bp->name, 1); cmdp->cmdtype = CMDSPLBLTIN; cmdp->param.bltin = bp->builtin; } } /* * Called when a cd is done. Marks all commands so the next time they * are executed they will be rehashed. */ void hashcd(shinstance *psh) { struct tblentry **pp; struct tblentry *cmdp; for (pp = psh->cmdtable ; pp < &psh->cmdtable[CMDTABLESIZE] ; pp++) { for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) { if (cmdp->cmdtype == CMDNORMAL || (cmdp->cmdtype == CMDBUILTIN && psh->builtinloc >= 0)) cmdp->rehash = 1; } } } /* * Fix command hash table when PATH changed. * Called before PATH is changed. The argument is the new value of PATH; * pathval(psh) still returns the old value at this point. * Called with interrupts off. */ void changepath(shinstance *psh, const char *newval) { const char *old, *new; int idx; int firstchange; int bltin; old = pathval(psh); new = newval; firstchange = 9999; /* assume no change */ idx = 0; bltin = -1; for (;;) { if (*old != *new) { firstchange = idx; #ifdef PC_PATH_SEP if ((*old == '\0' && *new == ';') || (*old == ';' && *new == '\0')) #else if ((*old == '\0' && *new == ':') || (*old == ':' && *new == '\0')) #endif firstchange++; old = new; /* ignore subsequent differences */ } if (*new == '\0') break; if (*new == '%' && bltin < 0 && prefix("builtin", new + 1)) bltin = idx; #ifdef PC_PATH_SEP if (*new == ';') { #else if (*new == ':') { #endif idx++; } new++, old++; } if (psh->builtinloc < 0 && bltin >= 0) psh->builtinloc = bltin; /* zap builtins */ if (psh->builtinloc >= 0 && bltin < 0) firstchange = 0; clearcmdentry(psh, firstchange); psh->builtinloc = bltin; } /* * Clear out command entries. The argument specifies the first entry in * PATH which has changed. */ STATIC void clearcmdentry(shinstance *psh, int firstchange) { struct tblentry **tblp; struct tblentry **pp; struct tblentry *cmdp; INTOFF; for (tblp = psh->cmdtable ; tblp < &psh->cmdtable[CMDTABLESIZE] ; tblp++) { pp = tblp; while ((cmdp = *pp) != NULL) { if ((cmdp->cmdtype == CMDNORMAL && cmdp->param.n.index >= firstchange) || (cmdp->cmdtype == CMDBUILTIN && psh->builtinloc >= firstchange)) { *pp = cmdp->next; ckfree(psh, cmdp); } else { pp = &cmdp->next; } } } INTON; } /* * Delete all functions. */ #ifdef mkinit MKINIT void deletefuncs(struct shinstance *); MKINIT void hash_special_builtins(struct shinstance *); INIT { hash_special_builtins(psh); } SHELLPROC { deletefuncs(psh); } #endif void deletefuncs(shinstance *psh) { struct tblentry **tblp; struct tblentry **pp; struct tblentry *cmdp; INTOFF; for (tblp = psh->cmdtable ; tblp < &psh->cmdtable[CMDTABLESIZE] ; tblp++) { pp = tblp; while ((cmdp = *pp) != NULL) { if (cmdp->cmdtype == CMDFUNCTION) { *pp = cmdp->next; freefunc(psh, cmdp->param.func); ckfree(psh, cmdp); } else { pp = &cmdp->next; } } } INTON; } /* * Locate a command in the command hash table. If "add" is nonzero, * add the command to the table if it is not already present. The * variable "lastcmdentry" is set to point to the address of the link * pointing to the entry, so that delete_cmd_entry can delete the * entry. */ struct tblentry **lastcmdentry; STATIC struct tblentry * cmdlookup(shinstance *psh, const char *name, int add) { int hashval; const char *p; struct tblentry *cmdp; struct tblentry **pp; p = name; hashval = *p << 4; while (*p) hashval += *p++; hashval &= 0x7FFF; pp = &psh->cmdtable[hashval % CMDTABLESIZE]; for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) { if (equal(cmdp->cmdname, name)) break; pp = &cmdp->next; } if (add && cmdp == NULL) { INTOFF; cmdp = *pp = ckmalloc(psh, sizeof (struct tblentry) - ARB + strlen(name) + 1); cmdp->next = NULL; cmdp->cmdtype = CMDUNKNOWN; cmdp->rehash = 0; cmdp->param.n.index = 0; cmdp->param.n.suffix = 0; strcpy(cmdp->cmdname, name); INTON; } lastcmdentry = pp; return cmdp; } /* * Delete the command entry returned on the last lookup. */ STATIC void delete_cmd_entry(shinstance *psh) { struct tblentry *cmdp; INTOFF; cmdp = *lastcmdentry; *lastcmdentry = cmdp->next; ckfree(psh, cmdp); INTON; } #ifdef notdef void getcmdentry(shinstance *psh, char *name, struct cmdentry *entry) { struct tblentry *cmdp = cmdlookup(psh, name, 0); if (cmdp) { entry->u = cmdp->param; entry->cmdtype = cmdp->cmdtype; } else { entry->cmdtype = CMDUNKNOWN; entry->u.index = 0; } } #endif /* * Add a new command entry, replacing any existing command entry for * the same name - except special builtins. */ STATIC void addcmdentry(shinstance *psh, char *name, struct cmdentry *entry) { struct tblentry *cmdp; INTOFF; cmdp = cmdlookup(psh, name, 1); if (cmdp->cmdtype != CMDSPLBLTIN) { if (cmdp->cmdtype == CMDFUNCTION) { freefunc(psh, cmdp->param.func); } cmdp->cmdtype = entry->cmdtype; cmdp->param = entry->u; } INTON; } /* * Define a shell function. */ void defun(shinstance *psh, char *name, union node *func) { struct cmdentry entry; INTOFF; entry.cmdtype = CMDFUNCTION; entry.u.func = copyfunc(psh, func); addcmdentry(psh, name, &entry); INTON; } /* * Delete a function if it exists. */ int unsetfunc(shinstance *psh, char *name) { struct tblentry *cmdp; if ((cmdp = cmdlookup(psh, name, 0)) != NULL && cmdp->cmdtype == CMDFUNCTION) { freefunc(psh, cmdp->param.func); delete_cmd_entry(psh); return (0); } return (1); } /* * Locate and print what a word is... * also used for 'command -[v|V]' */ int typecmd(shinstance *psh, int argc, char **argv) { struct cmdentry entry; struct tblentry *cmdp; char * const *pp; struct alias *ap; int err = 0; char *arg; int c; int V_flag = 0; int v_flag = 0; int p_flag = 0; while ((c = nextopt(psh, "vVp")) != 0) { switch (c) { case 'v': v_flag = 1; break; case 'V': V_flag = 1; break; case 'p': p_flag = 1; break; } } if (p_flag && (v_flag || V_flag)) error(psh, "cannot specify -p with -v or -V"); while ((arg = *psh->argptr++)) { if (!v_flag) out1str(psh, arg); /* First look at the keywords */ for (pp = parsekwd; *pp; pp++) if (**pp == *arg && equal(*pp, arg)) break; if (*pp) { if (v_flag) err = 1; else out1str(psh, " is a shell keyword\n"); continue; } /* Then look at the aliases */ if ((ap = lookupalias(psh, arg, 1)) != NULL) { if (!v_flag) out1fmt(psh, " is an alias for \n"); out1fmt(psh, "%s\n", ap->val); continue; } /* Then check if it is a tracked alias */ if ((cmdp = cmdlookup(psh, arg, 0)) != NULL) { entry.cmdtype = cmdp->cmdtype; entry.u = cmdp->param; } else { /* Finally use brute force */ find_command(psh, arg, &entry, DO_ABS, pathval(psh)); } switch (entry.cmdtype) { case CMDNORMAL: { if (!haspath(arg)) { const char *path = pathval(psh); char *name; int j = entry.u.n.index; do { name = padvance(psh, &path, arg); stunalloc(psh, name); } while (--j >= 0); if (!v_flag) out1fmt(psh, " is%s ", cmdp ? " a tracked alias for" : ""); #ifdef PC_EXE_EXTS if ((unsigned)entry.u.n.suffix < K_ELEMENTS(g_exe_suffixes)) out1fmt(psh, "%s%s\n", name, g_exe_suffixes[entry.u.n.suffix]); else #endif out1fmt(psh, "%s\n", name); } else { if (shfile_access(&psh->fdtab, arg, X_OK) == 0) { if (!v_flag) out1fmt(psh, " is "); out1fmt(psh, "%s\n", arg); } else { if (!v_flag) out1fmt(psh, ": %s\n", sh_strerror(psh, errno)); else err = 126; } } break; } case CMDFUNCTION: if (!v_flag) out1str(psh, " is a shell function\n"); else out1fmt(psh, "%s\n", arg); break; case CMDBUILTIN: if (!v_flag) out1str(psh, " is a shell builtin\n"); else out1fmt(psh, "%s\n", arg); break; case CMDSPLBLTIN: if (!v_flag) out1str(psh, " is a special shell builtin\n"); else out1fmt(psh, "%s\n", arg); break; default: if (!v_flag) out1str(psh, ": not found\n"); err = 127; break; } } return err; } kbuild-3608/src/kash/redir.h0000664000175000017500000000456714670377416015734 0ustar locutuslocutus/* $NetBSD: redir.h,v 1.15 2003/08/07 09:05:37 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)redir.h 8.2 (Berkeley) 5/4/95 */ /* flags passed to redirect */ #define REDIR_PUSH 01 /* save previous values of file descriptors */ #define REDIR_BACKQ 02 /* save the command output in memory */ union node; #ifndef SH_FORKED_MODE void subshellinitredir(shinstance *, shinstance *); #endif void redirect(struct shinstance *, union node *, int); void popredir(struct shinstance *); int fd0_redirected_p(struct shinstance *); struct redirexpfnames; void expredircleanup(shinstance *, unsigned); void clearredir(struct shinstance *); int copyfd(struct shinstance *, int, int); int movefd(struct shinstance *, int, int); int movefd_above(struct shinstance *, int, int); kbuild-3608/src/kash/shthread.c0000664000175000017500000001025314670377415016410 0ustar locutuslocutus/* $Id: shthread.c 3505 2021-12-15 22:53:57Z bird $ */ /** @file * * Shell Thread Management. * * Copyright (c) 2007-2010 knut st. osmundsen * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "shthread.h" #include "shinstance.h" #if K_OS == K_OS_WINDOWS # include #elif K_OS == K_OS_OS2 # include # include #else # include #endif /******************************************************************************* * Global Variables * *******************************************************************************/ #if K_OS == K_OS_WINDOWS static DWORD sh_tls = TLS_OUT_OF_INDEXES; #elif K_OS == K_OS_OS2 static int sh_tls = -1; #else static int sh_tls_inited = 0; static pthread_key_t sh_tls; #endif /** * Stores the shell instance pointer in a TLS entry. * * This will allocate the TLS entry on the first call. We assume * there will no be races at that time. * * @param psh The shell instance. */ void shthread_set_shell(struct shinstance *psh) { #if K_OS == K_OS_WINDOWS if (sh_tls == TLS_OUT_OF_INDEXES) { sh_tls = TlsAlloc(); kHlpAssert(sh_tls != TLS_OUT_OF_INDEXES); } if (!TlsSetValue(sh_tls, psh)) kHlpAssert(0); #elif K_OS == K_OS_OS2 if (sh_tls == -1) { sh_tls = __libc_TLSAlloc(); kHlpAssert(sh_tls != -1); } if (__libc_TLSSet(sh_tls, psh) == -1) kHlpAssert(0); #else if (!sh_tls_inited) { if (pthread_key_create(&sh_tls, NULL) != 0) kHlpAssert(0); sh_tls_inited = 1; } if (pthread_setspecific(sh_tls, psh) != 0) kHlpAssert(0); #endif } /** * Get the shell instance pointer from TLS. * * @returns The shell instance. */ struct shinstance *shthread_get_shell(void) { shinstance *psh; #if K_OS == K_OS_WINDOWS psh = (shinstance *)TlsGetValue(sh_tls); #elif K_OS == K_OS_OS2 psh = (shinstance *)__libc_TLSGet(sh_tls); #else psh = (shinstance *)pthread_getspecific(sh_tls); #endif return psh; } /** * Sets the name of the current thread if supported by the OS. */ void shthread_set_name(const char *name) { #if K_OS == K_OS_WINDOWS typedef BOOL (WINAPI * PFNSETTHREADDESCRIPTION)(HANDLE, WCHAR *); static KBOOL volatile s_initialized = K_FALSE; static PFNSETTHREADDESCRIPTION volatile s_pfnSetThreadDescription = NULL; PFNSETTHREADDESCRIPTION pfnSetThreadDescription = s_pfnSetThreadDescription; WCHAR wszName[32]; size_t i; /* Get the function pointer, return if not available. */ if (pfnSetThreadDescription) { } else if (s_initialized) return; else { pfnSetThreadDescription = (PFNSETTHREADDESCRIPTION)GetProcAddress(GetModuleHandleW(L"KERNEL32.DLL"), "SetThreadDescription"); s_pfnSetThreadDescription = pfnSetThreadDescription; s_initialized = K_TRUE; if (!pfnSetThreadDescription) return; } /* Convert the name to UTF-16 and call the API. */ i = strlen(name); kHlpAssertStmt(i < K_ELEMENTS(wszName), i = K_ELEMENTS(wszName)); wszName[i] = '\0'; while (i-- > 0) wszName[i] = name[i]; pfnSetThreadDescription(GetCurrentThread(), wszName); #else K_NOREF(name); #endif } kbuild-3608/src/kash/syntax.c0000664000175000017500000001131714670377415016136 0ustar locutuslocutus/* $NetBSD: syntax.c,v 1.1 2004/01/17 17:38:12 dsl Exp $ */ #include "shell.h" #include "syntax.h" #include "parser.h" #include "shinstance.h" #ifdef _MSC_VER /* doesn't implement the fancy initializers I think... */ char basesyntax[257] = {CSHEOF}; char dqsyntax[257] = {CSHEOF}; char sqsyntax[257] = {CSHEOF}; char arisyntax[257] = {CSHEOF}; char is_type[257] = {0}; void init_syntax(void) { char *tab; int i; #define ndx(ch) (ch + 1 - CHAR_MIN) #define set(ch, val) tab[ndx(ch)] = val #define set_range(s, e, val) for (i = ndx(s); i <= ndx(e); i++) tab[i] = val /*basesyntax*/ tab = basesyntax; set_range(CTL_FIRST, CTL_LAST, CCTL); set('\n', CNL); set('\\', CBACK); set('\'', CSQUOTE); set('"', CDQUOTE); set('`', CBQUOTE); set('$', CVAR); set('}', CENDVAR); set('<', CSPCL); set('>', CSPCL); set('(', CSPCL); set(')', CSPCL); set(';', CSPCL); set('&', CSPCL); set('|', CSPCL); set(' ', CSPCL); set('\t', CSPCL); tab = dqsyntax; set_range(CTL_FIRST, CTL_LAST, CCTL); set('\n', CNL); set('\\', CBACK); set('"', CDQUOTE); set('`', CBQUOTE); set('$', CVAR); set('}', CENDVAR); /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */ set('!', CCTL); set('*', CCTL); set('?', CCTL); set('[', CCTL); set('=', CCTL); set('~', CCTL); set(':', CCTL); set('/', CCTL); set('-', CCTL); tab = sqsyntax; set_range(CTL_FIRST, CTL_LAST, CCTL); set('\n', CNL); set('\'', CSQUOTE); /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */ set('!', CCTL); set('*', CCTL) ; set('?', CCTL); set('[', CCTL); set('=', CCTL); set('~', CCTL); set(':', CCTL); set('/', CCTL); set('-', CCTL); tab = arisyntax; set_range(CTL_FIRST, CTL_LAST, CCTL); set('\n', CNL); set('\\', CBACK); set('`', CBQUOTE); set('\'', CSQUOTE); set('"', CDQUOTE); set('$', CVAR); set('}', CENDVAR); set('(', CLP); set(')', CRP); tab = is_type; set_range('0', '9', ISDIGIT); set_range('a', 'z', ISLOWER); set_range('A', 'Z', ISUPPER); set('_', ISUNDER); set('#', ISSPECL); set('?', ISSPECL); set('$', ISSPECL); set('!', ISSPECL); set('-', ISSPECL); set('*', ISSPECL); set('@', ISSPECL); } #else /* !_MSC_VER */ #if CWORD != 0 #error initialisation assumes 'CWORD' is zero #endif #define ndx(ch) (ch + 1 - CHAR_MIN) #define set(ch, val) [ndx(ch)] = val, #define set_range(s, e, val) [ndx(s) ... ndx(e)] = val, /* Shut up the pedantic warnings about set_range() */ #ifdef __GNUC__ # if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) # pragma GCC diagnostic ignored "-Wpedantic" # endif #endif /* syntax table used when not in quotes */ const char basesyntax[257] = { CSHEOF, set_range(CTL_FIRST, CTL_LAST, CCTL) set('\n', CNL) set('\\', CBACK) set('\'', CSQUOTE) set('"', CDQUOTE) set('`', CBQUOTE) set('$', CVAR) set('}', CENDVAR) set('<', CSPCL) set('>', CSPCL) set('(', CSPCL) set(')', CSPCL) set(';', CSPCL) set('&', CSPCL) set('|', CSPCL) set(' ', CSPCL) set('\t', CSPCL) }; /* syntax table used when in double quotes */ const char dqsyntax[257] = { CSHEOF, set_range(CTL_FIRST, CTL_LAST, CCTL) set('\n', CNL) set('\\', CBACK) set('"', CDQUOTE) set('`', CBQUOTE) set('$', CVAR) set('}', CENDVAR) /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */ set('!', CCTL) set('*', CCTL) set('?', CCTL) set('[', CCTL) set('=', CCTL) set('~', CCTL) set(':', CCTL) set('/', CCTL) set('-', CCTL) }; /* syntax table used when in single quotes */ const char sqsyntax[257] = { CSHEOF, set_range(CTL_FIRST, CTL_LAST, CCTL) set('\n', CNL) set('\'', CSQUOTE) /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */ set('!', CCTL) set('*', CCTL) set('?', CCTL) set('[', CCTL) set('=', CCTL) set('~', CCTL) set(':', CCTL) set('/', CCTL) set('-', CCTL) }; /* syntax table used when in arithmetic */ const char arisyntax[257] = { CSHEOF, set_range(CTL_FIRST, CTL_LAST, CCTL) set('\n', CNL) set('\\', CBACK) set('`', CBQUOTE) set('\'', CSQUOTE) set('"', CDQUOTE) set('$', CVAR) set('}', CENDVAR) set('(', CLP) set(')', CRP) }; /* character classification table */ const char is_type[257] = { 0, set_range('0', '9', ISDIGIT) set_range('a', 'z', ISLOWER) set_range('A', 'Z', ISUPPER) set('_', ISUNDER) set('#', ISSPECL) set('?', ISSPECL) set('$', ISSPECL) set('!', ISSPECL) set('-', ISSPECL) set('*', ISSPECL) set('@', ISSPECL) }; #endif /* !_MSC_VER */ kbuild-3608/src/kash/shinstance.h0000664000175000017500000005305114670377416016756 0ustar locutuslocutus/* $Id: shinstance.h 3480 2020-09-21 11:20:56Z bird $ */ /** @file * The shell instance and it's methods. */ /* * Copyright (c) 2007-2010 knut st. osmundsen * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef ___shinstance_h #define ___shinstance_h #include /* BUFSIZ */ #include /* NSIG */ #ifndef _MSC_VER # include # include # include # include #endif #include #ifdef _MSC_VER # define EWOULDBLOCK 140 #endif #include "shtypes.h" #include "shthread.h" #include "shfile.h" #include "shheap.h" #include "shell.h" #include "output.h" #include "options.h" #include "expand.h" #include "exec.h" #include "var.h" #include "show.h" #ifdef _MSC_VER # define strcasecmp stricmp # define strncasecmp strnicmp #endif #ifndef SH_FORKED_MODE extern shmtx g_sh_exec_inherit_mtx; #endif #ifndef SH_FORKED_MODE /** * Subshell status. */ typedef struct shsubshellstatus { unsigned volatile refs; /**< Reference counter. */ int volatile status; /**< The exit code. */ KBOOL volatile done; /**< Set if done (valid exit code). */ void *towaiton; /**< Event semaphore / whatever to wait on. */ # if K_OS == K_OS_WINDOWS uintptr_t volatile hThread; /**< The thread handle (child closes this). */ # endif struct shsubshellstatus *next; /**< Next free one on the free chain. */ } shsubshellstatus; #else struct shsubshellstatus; #endif /** * A child process. */ typedef struct shchild { shpid pid; /**< The pid. */ #if K_OS == K_OS_WINDOWS void *hChild; /**< The handle to wait on. */ #endif #ifndef SH_FORKED_MODE shsubshellstatus *subshellstatus; /**< Pointer to the subshell status structure. NULL if child process. */ #endif } shchild; /* memalloc.c */ #define MINSIZE 504 /* minimum size of a block */ struct stack_block { struct stack_block *prev; char space[MINSIZE]; }; #ifdef KASH_SEPARATE_PARSER_ALLOCATOR /** Parser stack allocator block. * These are reference counted so they can be shared between the parent and * child shells. They are also using as an alternative to copying function * definitions, here the final goal is to automatically emit separate * pstack_blocks for function while parsing to make it more flexible. */ typedef struct pstack_block { /** Pointer to the next unallocated byte (= stacknxt). */ char *nextbyte; /** Number of bytes available in the current stack block (= stacknleft). */ size_t avail; /* Number of chars left for string data (PSTPUTC, PSTUPUTC, et al) (= sstrnleft). */ size_t strleft; /** Top of the allocation stack (nextbyte points within this). */ struct stack_block *top; /** Size of the top stack element (user space only). */ size_t topsize; /** @name statistics * @{ */ size_t allocations; size_t bytesalloced; size_t nodesalloced; size_t entriesalloced; size_t strbytesalloced; size_t blocks; size_t fragmentation; /** @} */ /** Reference counter. */ unsigned volatile refs; /** Whether to make it current when is restored to the top of the stack. */ KBOOL done; /** The first stack block. */ struct stack_block first; } pstack_block; #endif /* input.c */ struct strpush { struct strpush *prev; /* preceding string on stack */ char *prevstring; int prevnleft; int prevlleft; struct alias *ap; /* if push was associated with an alias */ }; /* * The parsefile structure pointed to by the global variable parsefile * contains information about the current file being read. */ struct parsefile { struct parsefile *prev; /* preceding file on stack */ int linno; /* current line */ int fd; /* file descriptor (or -1 if string) */ int nleft; /* number of chars left in this line */ int lleft; /* number of chars left in this buffer */ char *nextc; /* next char in buffer */ char *buf; /* input buffer */ struct strpush *strpush; /* for pushing strings at this level */ struct strpush basestrpush; /* so pushing one is fast */ }; /* exec.c */ #define CMDTABLESIZE 31 /* should be prime */ #define ARB 1 /* actual size determined at run time */ struct tblentry { struct tblentry *next; /* next entry in hash chain */ union param param; /* definition of builtin function */ short cmdtype; /* index identifying command */ char rehash; /* if set, cd done since entry created */ char cmdname[ARB]; /* name of command */ }; /* expand.c */ /* * Structure specifying which parts of the string should be searched * for IFS characters. */ struct ifsregion { struct ifsregion *next; /* next region in list */ int begoff; /* offset of start of region */ int endoff; /* offset of end of region */ int inquotes; /* search for nul bytes only */ }; /* redir.c */ struct redirtab { struct redirtab *next; short renamed[10]; }; /** * This is a replacement for temporary node field nfile.expfname. * Uses stack allocator, created by expredir(), duplicated by * subshellinitredir() and popped (but not freed) by expredircleanup(). */ typedef struct redirexpfnames { struct redirexpfnames *prev; /**< Previous record. */ unsigned depth; /**< Nesting depth. */ unsigned count; /**< Number of expanded filenames in the array. */ char *names[1]; /**< Variable size. */ } redirexpfnames; /** * A shell instance. * * This is the core structure of the shell, it contains all * the data associated with a shell process except that it's * running in a thread and not a separate process. */ struct shinstance { struct shinstance *next; /**< The next shell instance. */ struct shinstance *prev; /**< The previous shell instance. */ struct shinstance *parent; /**< The parent shell instance. */ shpid pid; /**< The (fake) process id of this shell instance. */ shtid tid; /**< The thread identifier of the thread for this shell. */ shpid pgid; /**< Process group ID. */ shfdtab fdtab; /**< The file descriptor table. */ shsigaction_t sigactions[NSIG]; /**< The signal actions registered with this shell instance. */ shsigset_t sigmask; /**< Our signal mask. */ char **shenviron; /**< The environment vector. */ int linked; /**< Set if we're still linked. */ unsigned num_children; /**< Number of children in the array. */ shchild *children; /**< The child array. */ #ifndef SH_FORKED_MODE int (*thread)(struct shinstance *, void *); /**< The thread procedure. */ void *threadarg; /**< The thread argument. */ struct jmploc *exitjmp; /**< Long jump target in sh_thread_wrapper for use by sh__exit. */ shsubshellstatus *subshellstatus; /**< Pointer to the subshell status structure (NULL if root). */ #endif /* alias.c */ #define ATABSIZE 39 struct alias *atab[ATABSIZE]; unsigned aliases; /**< Number of active aliases. */ /* cd.c */ char *curdir; /**< current working directory */ char *prevdir; /**< previous working directory */ char *cdcomppath; /**< (stalloc) */ int getpwd_first; /**< static in getpwd. (initialized to 1!) */ /* error.h */ struct jmploc *handler; int exception; int exerrno/* = 0 */; /**< Last exec error */ int volatile suppressint; int volatile intpending; /* error.c */ char errmsg_buf[16]; /**< static in errmsg. (bss) */ /* eval.h */ char *commandname; /**< currently executing command */ int exitstatus; /**< exit status of last command */ int back_exitstatus;/**< exit status of backquoted command */ struct strlist *cmdenviron; /**< environment for builtin command (varlist from evalcommand()) */ int funcnest; /**< depth of function calls */ int evalskip; /**< set if we are skipping commands */ int skipcount; /**< number of levels to skip */ int loopnest; /**< current loop nesting level */ int commandnamemalloc; /**< Set if commandname is malloc'ed (only subshells). */ /* expand.c */ char *expdest; /**< output of current string (stack) */ struct nodelist *argbackq; /**< list of back quote expressions */ struct ifsregion ifsfirst; /**< first struct in list of ifs regions */ struct ifsregion *ifslastp; /**< last struct in list */ struct arglist exparg; /**< holds expanded arg list (stack) */ char *expdir; /**< Used by expandmeta. */ /* exec.h */ const char *pathopt; /**< set by padvance */ /* exec.c */ struct tblentry *cmdtable[CMDTABLESIZE]; int builtinloc/* = -1*/; /**< index in path of %builtin, or -1 */ /* input.h */ int plinno/* = 1 */;/**< input line number */ int parsenleft; /**< number of characters left in input buffer */ char *parsenextc; /**< next character in input buffer */ int init_editline/* = 0 */; /**< 0 == not setup, 1 == OK, -1 == failed */ /* input.c */ int parselleft; /**< copy of parsefile->lleft */ struct parsefile basepf; /**< top level input file */ char basebuf[BUFSIZ];/**< buffer for top level input file */ struct parsefile *parsefile/* = &basepf*/; /**< current input file */ #ifndef SMALL EditLine *el; /**< cookie for editline package */ #endif /* jobs.h */ shpid backgndpid/* = -1 */; /**< pid of last background process */ int job_warning; /**< user was warned about stopped jobs */ /* jobs.c */ struct job *jobtab; /**< array of jobs */ int njobs; /**< size of array */ int jobs_invalid; /**< set in child */ shpid initialpgrp; /**< pgrp of shell on invocation */ int curjob/* = -1*/;/**< current job */ int ttyfd/* = -1*/; int jobctl; /**< job control enabled / disabled */ char *cmdnextc; int cmdnleft; /* mail.c */ #define MAXMBOXES 10 int nmboxes; /**< number of mailboxes */ time_t mailtime[MAXMBOXES]; /**< times of mailboxes */ /* main.h */ shpid rootpid; /**< pid of main shell. */ int rootshell; /**< true if we aren't a child of the main shell. */ struct shinstance *psh_rootshell; /**< The root shell pointer. (!rootshell) */ /* memalloc.h */ char *stacknxt/* = stackbase.space*/; int stacknleft/* = MINSIZE*/; int sstrnleft; int herefd/* = -1 */; /* memalloc.c */ struct stack_block stackbase; struct stack_block *stackp/* = &stackbase*/; struct stackmark *markp; #ifdef KASH_SEPARATE_PARSER_ALLOCATOR pstack_block *curpstack; /**< The pstack entry we're currently allocating from (NULL when not in parse.c). */ pstack_block **pstack; /**< Stack of parsed stuff. */ unsigned pstacksize; /**< Number of entries in pstack. */ unsigned pstackalloced; /**< The allocated size of pstack. */ pstack_block *freepstack; /**< One cached pstack entry (lots of parsecmd calls). */ #endif /* myhistedit.h */ int displayhist; #ifndef SMALL History *hist; EditLine *el; #endif /* output.h */ struct output output; struct output errout; struct output memout; struct output *out1; struct output *out2; /* output.c */ #define OUTBUFSIZ BUFSIZ #define MEM_OUT -3 /**< output to dynamically allocated memory */ /* options.h */ struct optent optlist[NOPTS]; char *minusc; /**< argument to -c option */ char *arg0; /**< $0 */ struct shparam shellparam; /**< $@ */ char **argptr; /**< argument list for builtin commands */ char *optionarg; /**< set by nextopt */ char *optptr; /**< used by nextopt */ char **orgargv; /**< The original argument vector (for cleanup). */ int arg0malloc; /**< Indicates whether arg0 was allocated or is part of orgargv. */ /* parse.h */ int tokpushback; int whichprompt; /**< 1 == PS1, 2 == PS2 */ /* parser.c */ int noalias/* = 0*/;/**< when set, don't handle aliases */ struct heredoc *heredoclist; /**< list of here documents to read */ int parsebackquote; /**< nonzero if we are inside backquotes */ int doprompt; /**< if set, prompt the user */ int needprompt; /**< true if interactive and at start of line */ int lasttoken; /**< last token read */ char *wordtext; /**< text of last word returned by readtoken */ int checkkwd; /**< 1 == check for kwds, 2 == also eat newlines */ struct nodelist *backquotelist; union node *redirnode; struct heredoc *heredoc; int quoteflag; /**< set if (part of) last token was quoted */ int startlinno; /**< line # where last token started */ /* redir.c */ struct redirtab *redirlist; int fd0_redirected/* = 0*/; redirexpfnames *expfnames; /**< Expanded filenames for current redirection setup. */ /* show.c */ char tracebuf[1024]; size_t tracepos; int tracefd; /* trap.h */ int pendingsigs; /**< indicates some signal received */ /* trap.c */ char gotsig[NSIG]; /**< indicates specified signal received */ char *trap[NSIG+1]; /**< trap handler commands */ char sigmode[NSIG]; /**< current value of signal */ /* var.h */ struct localvar *localvars; struct var vatty; struct var vifs; struct var vmail; struct var vmpath; struct var vpath; #ifdef _MSC_VER struct var vpath2; #endif struct var vps1; struct var vps2; struct var vps4; #ifndef SMALL struct var vterm; struct var vhistsize; #endif struct var voptind; #ifdef PC_OS2_LIBPATHS struct var libpath_vars[4]; #endif #ifdef SMALL # define VTABSIZE 39 #else # define VTABSIZE 517 #endif struct var *vartab[VTABSIZE]; /* builtins.h */ /* bltin/test.c */ char **t_wp; struct t_op const *t_wp_op; }; extern void sh_init_globals(void); extern shinstance *sh_create_root_shell(char **, char **); extern shinstance *sh_create_child_shell(shinstance *); /* environment & pwd.h */ char *sh_getenv(shinstance *, const char *); char **sh_environ(shinstance *); const char *sh_gethomedir(shinstance *, const char *); /* signals */ #define SH_SIG_UNK ((shsig_t)(intptr_t)-199) #define SH_SIG_DFL ((shsig_t)(intptr_t)SIG_DFL) #define SH_SIG_IGN ((shsig_t)(intptr_t)SIG_IGN) #define SH_SIG_ERR ((shsig_t)(intptr_t)SIG_ERR) #ifdef _MSC_VER # define SA_RESTART 0x02 # define SIG_BLOCK 1 # define SIG_UNBLOCK 2 # define SIG_SETMASK 3 # define SIGHUP 1 /* _SIGHUP_IGNORE */ /*# define SIGINT 2 */ # define SIGQUIT 3 /* _SIGQUIT_IGNORE */ /*# define SIGILL 4 */ /*# define SIGFPE 8 */ /*# define SIGSEGV 11 */ # define SIGPIPE 13 /* _SIGPIPE_IGNORE */ /*# define SIGTERM 15 */ # define SIGTTIN 16 /* _SIGIOINT_IGNORE */ # define SIGTSTP 17 /* _SIGSTOP_IGNORE */ # define SIGTTOU 18 # define SIGCONT 20 /*# define SIGBREAK 21 */ /*# define SIGABRT 22 */ const char *strsignal(int iSig); #endif /* _MSC_VER */ #ifndef HAVE_SYS_SIGNAME extern const char * const sys_signame[NSIG]; #endif int sh_sigaction(shinstance *, int, const struct shsigaction *, struct shsigaction *); shsig_t sh_signal(shinstance *, int, shsig_t); int sh_siginterrupt(shinstance *, int, int); void sh_sigemptyset(shsigset_t *); void sh_sigfillset(shsigset_t *); void sh_sigaddset(shsigset_t *, int); void sh_sigdelset(shsigset_t *, int); int sh_sigismember(shsigset_t const *, int); int sh_sigprocmask(shinstance *, int, shsigset_t const *, shsigset_t *); SH_NORETURN_1 void sh_abort(shinstance *) SH_NORETURN_2; void sh_raise_sigint(shinstance *); int sh_kill(shinstance *, shpid, int); int sh_killpg(shinstance *, shpid, int); /* times */ #include #ifdef _MSC_VER typedef struct shtms { clock_t tms_utime; clock_t tms_stime; clock_t tms_cutime; clock_t tms_cstime; } shtms; #else # include typedef struct tms shtms; #endif clock_t sh_times(shinstance *, shtms *); int sh_sysconf_clk_tck(void); /* wait / process */ int sh_add_child(shinstance *psh, shpid pid, void *hChild, struct shsubshellstatus *sts); #ifdef _MSC_VER # include # define WNOHANG 1 /* Don't hang in wait. */ # define WUNTRACED 2 /* Tell about stopped, untraced children. */ # define WCONTINUED 4 /* Report a job control continued process. */ # define _W_INT(w) (*(int *)&(w)) /* Convert union wait to int. */ # define WCOREFLAG 0200 # define _WSTATUS(x) (_W_INT(x) & 0177) # define _WSTOPPED 0177 /* _WSTATUS if process is stopped */ # define WIFSTOPPED(x) (_WSTATUS(x) == _WSTOPPED) # define WSTOPSIG(x) (_W_INT(x) >> 8) # define WIFSIGNALED(x) (_WSTATUS(x) != 0 && !WIFSTOPPED(x) && !WIFCONTINUED(x)) /* bird: made GLIBC tests happy. */ # define WTERMSIG(x) (_WSTATUS(x)) # define WIFEXITED(x) (_WSTATUS(x) == 0) # define WEXITSTATUS(x) (_W_INT(x) >> 8) # define WIFCONTINUED(x) (x == 0x13) /* 0x13 == SIGCONT */ # define WCOREDUMP(x) (_W_INT(x) & WCOREFLAG) # define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) # define W_STOPCODE(sig) ((sig) << 8 | _WSTOPPED) #else # include # ifdef __HAIKU__ # define WCOREDUMP(x) WIFCORED(x) # endif #endif #ifdef SH_FORKED_MODE shpid sh_fork(shinstance *); #else shpid sh_thread_start(shinstance *pshparent, shinstance *pshchild, int (*thread)(shinstance *, void *), void *arg); #endif shpid sh_waitpid(shinstance *, shpid, int *, int); SH_NORETURN_1 void sh__exit(shinstance *, int) SH_NORETURN_2; int sh_execve(shinstance *, const char *, const char * const*, const char * const *); uid_t sh_getuid(shinstance *); uid_t sh_geteuid(shinstance *); gid_t sh_getgid(shinstance *); gid_t sh_getegid(shinstance *); shpid sh_getpid(shinstance *); shpid sh_getpgrp(shinstance *); shpid sh_getpgid(shinstance *, shpid); int sh_setpgid(shinstance *, shpid, shpid); /* tc* */ shpid sh_tcgetpgrp(shinstance *, int); int sh_tcsetpgrp(shinstance *, int, shpid); /* sys/resource.h */ #ifdef _MSC_VER typedef int64_t shrlim_t; typedef struct shrlimit { shrlim_t rlim_cur; shrlim_t rlim_max; } shrlimit; # define RLIMIT_CPU 0 # define RLIMIT_FSIZE 1 # define RLIMIT_DATA 2 # define RLIMIT_STACK 3 # define RLIMIT_CORE 4 # define RLIMIT_RSS 5 # define RLIMIT_MEMLOCK 6 # define RLIMIT_NPROC 7 # define RLIMIT_NOFILE 8 # define RLIMIT_SBSIZE 9 # define RLIMIT_VMEM 10 # define RLIM_NLIMITS 11 # define RLIM_INFINITY (0x7fffffffffffffffLL) #else typedef rlim_t shrlim_t; typedef struct rlimit shrlimit; #endif int sh_getrlimit(shinstance *, int, shrlimit *); int sh_setrlimit(shinstance *, int, const shrlimit *); /* string.h */ const char *sh_strerror(shinstance *, int); #ifdef DEBUG # define TRACE2(param) trace param # define TRACE2V(param) tracev param #else # define TRACE2(param) do { } while (0) # define TRACE2V(param) do { } while (0) #endif #endif kbuild-3608/src/kash/histedit.c0000664000175000017500000002754714670377416016442 0ustar locutuslocutus/* $NetBSD: histedit.c,v 1.36 2005/05/09 11:35:19 christos Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: histedit.c,v 1.36 2005/05/09 11:35:19 christos Exp $"); #endif /* not lint */ #endif #include #include /* * Editline and history functions (and glue). */ #include "shell.h" #include "parser.h" #include "var.h" #include "options.h" #include "main.h" #include "output.h" #include "mystring.h" #include "myhistedit.h" #include "error.h" #ifndef SMALL #include "eval.h" #include "memalloc.h" #define MAXHISTLOOPS 4 /* max recursions through fc */ #define DEFEDITOR "ed" /* default editor *should* be $EDITOR */ History *hist; /* history cookie */ EditLine *el; /* editline cookie */ int displayhist; static FILE *el_in, *el_out; unsigned char _el_fn_complete(EditLine *, int); STATIC const char *fc_replace(const char *, char *, char *); #ifdef DEBUG extern FILE *tracefile; #endif /* * Set history and editing status. Called whenever the status may * have changed (figures out what to do). */ void histedit(void) { FILE *el_err; #define editing (Eflag(psh) || Vflag(psh)) if (iflag(psh)) { if (!hist) { /* * turn history on */ INTOFF; hist = history_init(); INTON; if (hist != NULL) sethistsize(histsizeval()); else out2str(psh, "sh: can't initialize history\n"); } if (editing && !el && isatty(0)) { /* && isatty(2) ??? */ /* * turn editing on */ char *term, *shname; INTOFF; if (el_in == NULL) el_in = fdopen(0, "r"); if (el_out == NULL) el_out = fdopen(2, "w"); if (el_in == NULL || el_out == NULL) goto bad; el_err = el_out; #if DEBUG if (tracefile) el_err = tracefile; #endif term = lookupvar(psh, "TERM"); if (term) setenv("TERM", term, 1); else unsetenv("TERM"); shname = psh->arg0; if (shname[0] == '-') shname++; el = el_init(shname, el_in, el_out, el_err); if (el != NULL) { if (hist) el_set(el, EL_HIST, history, hist); el_set(el, EL_PROMPT, getprompt); el_set(el, EL_SIGNAL, 1); el_set(el, EL_ADDFN, "rl-complete", "ReadLine compatible completion function", _el_fn_complete); } else { bad: out2str(psh, "sh: can't initialize editing\n"); } INTON; } else if (!editing && el) { INTOFF; el_end(el); el = NULL; INTON; } if (el) { if (Vflag(psh)) el_set(el, EL_EDITOR, "vi"); else if (Eflag(psh)) el_set(el, EL_EDITOR, "emacs"); el_set(el, EL_BIND, "^I", tabcomplete(psh) ? "rl-complete" : "ed-insert", NULL); el_source(el, NULL); } } else { INTOFF; if (el) { /* no editing if not interactive */ el_end(el); el = NULL; } if (hist) { history_end(hist); hist = NULL; } INTON; } } void sethistsize(shinstance *psh, const char *hs) { int histsize; HistEvent he; if (hist != NULL) { if (hs == NULL || *hs == '\0' || (histsize = atoi(hs)) < 0) histsize = 100; history(hist, &he, H_SETSIZE, histsize); } } void setterm(shinstance *psh, const char *term) { if (el != NULL && term != NULL) if (el_set(el, EL_TERMINAL, term) != 0) { outfmt(psh->out2, "sh: Can't set terminal type %s\n", term); outfmt(psh->out2, "sh: Using dumb terminal settings.\n"); } } int inputrc(argc, argv) int argc; char **argv; { if (argc != 2) { out2str(psh, "usage: inputrc file\n"); return 1; } if (el != NULL) { if (el_source(el, argv[1])) { out2str(psh, "inputrc: failed\n"); return 1; } else return 0; } else { out2str(psh, "sh: inputrc ignored, not editing\n"); return 1; } } /* * This command is provided since POSIX decided to standardize * the Korn shell fc command. Oh well... */ int histcmd(int argc, char **argv) { int ch; const char *editor = NULL; HistEvent he; int lflg = 0, nflg = 0, rflg = 0, sflg = 0; int i, retval; const char *firststr, *laststr; int first, last, direction; char *pat = NULL, *repl; /* ksh "fc old=new" crap */ static int active = 0; struct jmploc jmploc; struct jmploc *volatile savehandler; char editfile[MAXPATHLEN + 1]; FILE *efp; #ifdef __GNUC__ /* Avoid longjmp clobbering */ (void) &editor; (void) &lflg; (void) &nflg; (void) &rflg; (void) &sflg; (void) &firststr; (void) &laststr; (void) &pat; (void) &repl; (void) &efp; (void) &argc; (void) &argv; #endif if (hist == NULL) error(psh, "history not active"); if (argc == 1) error(psh, "missing history argument"); optreset = 1; optind = 1; /* initialize getopt */ while (not_fcnumber(argv[optind]) && (ch = getopt(argc, argv, ":e:lnrs")) != -1) switch ((char)ch) { case 'e': editor = optionarg; break; case 'l': lflg = 1; break; case 'n': nflg = 1; break; case 'r': rflg = 1; break; case 's': sflg = 1; break; case ':': error(psh, "option -%c expects argument", optopt); /* NOTREACHED */ case '?': default: error(psh, "unknown option: -%c", optopt); /* NOTREACHED */ } argc -= optind, argv += optind; /* * If executing... */ if (lflg == 0 || editor || sflg) { lflg = 0; /* ignore */ editfile[0] = '\0'; /* * Catch interrupts to reset active counter and * cleanup temp files. */ if (setjmp(jmploc.loc)) { active = 0; if (*editfile) unlink(editfile); handler = savehandler; longjmp(handler->loc, 1); } savehandler = handler; handler = &jmploc; if (++active > MAXHISTLOOPS) { active = 0; displayhist = 0; error(psh, "called recursively too many times"); } /* * Set editor. */ if (sflg == 0) { if (editor == NULL && (editor = bltinlookup(psh, "FCEDIT", 1)) == NULL && (editor = bltinlookup(psh, "EDITOR", 1)) == NULL) editor = DEFEDITOR; if (editor[0] == '-' && editor[1] == '\0') { sflg = 1; /* no edit */ editor = NULL; } } } /* * If executing, parse [old=new] now */ if (lflg == 0 && argc > 0 && ((repl = strchr(argv[0], '=')) != NULL)) { pat = argv[0]; *repl++ = '\0'; argc--, argv++; } /* * determine [first] and [last] */ switch (argc) { case 0: firststr = lflg ? "-16" : "-1"; laststr = "-1"; break; case 1: firststr = argv[0]; laststr = lflg ? "-1" : argv[0]; break; case 2: firststr = argv[0]; laststr = argv[1]; break; default: error(psh, "too many args"); /* NOTREACHED */ } /* * Turn into event numbers. */ first = str_to_event(firststr, 0); last = str_to_event(laststr, 1); if (rflg) { i = last; last = first; first = i; } /* * XXX - this should not depend on the event numbers * always increasing. Add sequence numbers or offset * to the history element in next (diskbased) release. */ direction = first < last ? H_PREV : H_NEXT; /* * If editing, grab a temp file. */ if (editor) { int fd; INTOFF; /* easier */ snprintf(editfile, sizeof(editfile), "%s_shXXXXXX", _PATH_TMP); if ((fd = mkstemp(editfile)) < 0) error(psh, "can't create temporary file %s", editfile); if ((efp = fdopen(fd, "w")) == NULL) { shfile_close(&psh->fdtab, fd); error(psh, "can't allocate stdio buffer for temp"); } } /* * Loop through selected history events. If listing or executing, * do it now. Otherwise, put into temp file and call the editor * after. * * The history interface needs rethinking, as the following * convolutions will demonstrate. */ history(hist, &he, H_FIRST); retval = history(hist, &he, H_NEXT_EVENT, first); for (;retval != -1; retval = history(hist, &he, direction)) { if (lflg) { if (!nflg) out1fmt(psh, "%5d ", he.num); out1str(psh, he.str); } else { const char *s = pat ? fc_replace(he.str, pat, repl) : he.str; if (sflg) { if (displayhist) { out2str(psh, s); } evalstring(psh, strcpy(stalloc(psh, strlen(s) + 1), s), 0); if (displayhist && hist) { /* * XXX what about recursive and * relative histnums. */ history(hist, &he, H_ENTER, s); } } else fputs(s, efp); } /* * At end? (if we were to lose last, we'd sure be * messed up). */ if (he.num == last) break; } if (editor) { char *editcmd; fclose(efp); editcmd = stalloc(psh, strlen(editor) + strlen(editfile) + 2); sprintf(editcmd, "%s %s", editor, editfile); evalstring(psh, editcmd, 0); /* XXX - should use no JC command */ INTON; readcmdfile(psh, editfile); /* XXX - should read back - quick tst */ unlink(editfile); } if (lflg == 0 && active > 0) --active; if (displayhist) displayhist = 0; return 0; } STATIC const char * fc_replace(const char *s, char *p, char *r) { char *dest; int plen = strlen(p); STARTSTACKSTR(psh, dest); while (*s) { if (*s == *p && strncmp(s, p, plen) == 0) { while (*r) STPUTC(psh, *r++, dest); s += plen; *p = '\0'; /* so no more matches */ } else STPUTC(psh, *s++, dest); } STACKSTRNUL(psh, dest); dest = grabstackstr(psh, dest); return (dest); } int not_fcnumber(char *s) { if (s == NULL) return 0; if (*s == '-') s++; return (!is_number(s)); } int str_to_event(const char *str, int last) { HistEvent he; const char *s = str; int relative = 0; int i, retval; retval = history(hist, &he, H_FIRST); switch (*s) { case '-': relative = 1; /*FALLTHROUGH*/ case '+': s++; } if (is_number(s)) { i = atoi(s); if (relative) { while (retval != -1 && i--) { retval = history(hist, &he, H_NEXT); } if (retval == -1) retval = history(hist, &he, H_LAST); } else { retval = history(hist, &he, H_NEXT_EVENT, i); if (retval == -1) { /* * the notion of first and last is * backwards to that of the history package */ retval = history(hist, &he, last ? H_FIRST : H_LAST); } } if (retval == -1) error(psh, "history number %s not found (internal error)", str); } else { /* * pattern */ retval = history(hist, &he, H_PREV_STR, str); if (retval == -1) error(psh, "history pattern not found: %s", str); } return (he.num); } #else /* SMALL */ int histcmd(shinstance *psh, int argc, char **argv) { error(psh, "not compiled with history support"); /* NOTREACHED */ return -1; } int inputrc(shinstance *psh, int argc, char **argv) { error(psh, "not compiled with history support"); /* NOTREACHED */ return -1; } #endif /* SMALL */ kbuild-3608/src/kash/shforkA-win.asm0000664000175000017500000002231114670377416017333 0ustar locutuslocutus; $Id: shforkA-win.asm 2416 2010-09-14 00:30:30Z bird $ ;; @file ; shforkA-win.asm - assembly routines used when forking on Windows. ; ; ; Copyright (c) 2009-2010 knut st. osmundsen ; ; This file is part of kBuild. ; ; kBuild 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. ; ; kBuild 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 kBuild. If not, see ; ; ;******************************************************************************* ;* Defined Constants And Macros * ;******************************************************************************* %ifdef KBUILD_ARCH_AMD64 %define NAME(name) name %else %define NAME(name) _ %+ name %endif ;; The stack size. This is also defined in shfork-win.c. %define SHFORK_STACK_SIZE (1*1024*1024) ;******************************************************************************* ;* External Symbols * ;******************************************************************************* extern NAME(real_main) extern NAME(shfork_maybe_forked) extern NAME(shfork_body) [section .text] ;; ; C main() wrapper. ; NAME(main): global NAME(main) %ifdef KBUILD_ARCH_AMD64 [proc_frame main] %endif ; ; Prolog, spilling parameters from registers. ; %ifdef KBUILD_ARCH_AMD64 [pushreg rbp] push rbp [setframe rbp, 0] mov rbp, rsp [allocstack 0x40] sub rsp, 40h and rsp, ~1fh mov [rbp-08h], rcx ; argc mov [rbp-10h], rdx ; argv mov [rbp-18h], r8 ; envp [endprolog] %else push ebp mov ebp, esp sub esp, 40h and esp, ~1fh %endif ; ; Call shfork_maybe_forked. This will not return if we're forking. ; %ifndef KBUILD_ARCH_AMD64 mov ecx, [ebp + 8h] ; argc mov edx, [ebp + 0ch] ; argv mov eax, [ebp + 10h] ; envp mov [esp ], ecx mov [esp + 4h], edx mov [esp + 8h], eax %endif call NAME(shfork_maybe_forked) ; ; Ok, it returned which means we're not forking. ; ; The accumulator register is now pointing to the top of the ; stack we're going to call real_main on. Switch and call it. ; ; The TIB adjustments is required or we'll crash in longjmp/unwind. ; %ifdef KBUILD_ARCH_AMD64 mov [rsp + 18h], rax mov [rax - 8h], rsp mov r10, [gs:08h] ; StackBase (the higher value) mov r11, [gs:10h] ; StackLimit (the lower value) mov [rax - 10h], r10 mov [rax - 18h], r11 cmp rax, r10 jb .below mov [gs:08h], rax .below: lea r9, [rax - SHFORK_STACK_SIZE] cmp r9, r11 ja .above mov [gs:10h], r9 .above: mov rcx, [rbp - 08h] ; argc mov rdx, [rbp - 10h] ; argv mov r8, [rbp - 18h] ; envp lea rsp, [rax - 40h] ; Switch! %else mov [esp + 18h], eax mov [eax - 4], esp lea esp, [eax - 40h] ; Switch! mov edx, [fs:04h] ; StackBase (the higher value) mov ecx, [fs:08h] ; StackLimit (the lower value) mov [eax - 10h], edx mov [eax - 18h], ecx cmp eax, edx jb .below mov [fs:04h], eax .below: lea edx, [eax - SHFORK_STACK_SIZE] cmp edx, ecx ja .above mov [fs:08h], edx .above: mov ecx, [ebp + 8h] ; argc mov edx, [ebp + 0ch] ; argv mov eax, [ebp + 10h] ; envp mov [esp ], ecx mov [esp + 4h], edx mov [esp + 8h], eax %endif call NAME(real_main) ; ; Switch back the stack, restore the TIB fields and we're done. ; %ifdef KBUILD_ARCH_AMD64 lea r11, [rsp + 40h] mov rsp, [rsp + 38h] mov r8, [r11 - 10h] mov r9, [r11 - 18h] mov [gs:08h], r8 mov [gs:10h], r9 %else lea edx, [esp + 40h] mov esp, [esp + 2ch] mov ecx, [edx - 10h] mov edx, [edx - 18h] mov [fs:04h], ecx mov [fs:08h], edx %endif leave ret %ifdef KBUILD_ARCH_AMD64 [endproc_frame main] %endif ;; ; sh_fork() worker ; ; @returns See fork(). ; @param psh ; NAME(shfork_do_it): global NAME(shfork_do_it) %ifdef KBUILD_ARCH_AMD64 [proc_frame shfork_do_it] [pushreg rbp] push rbp [setframe rbp, 0] mov rbp, rsp [allocstack 0x400] sub rsp, 400h and rsp, ~1ffh [endprolog] %else push ebp mov ebp, esp sub esp, 400h and esp, ~1ffh %endif ; ; Save most registers so they can be restored in the child. ; %ifdef KBUILD_ARCH_AMD64 fxsave [rsp] mov [rsp + 200h], rbp mov [rsp + 208h], rax mov [rsp + 210h], rbx mov [rsp + 218h], rcx mov [rsp + 220h], rdx mov [rsp + 228h], rsi mov [rsp + 230h], rdi mov [rsp + 238h], r8 mov [rsp + 240h], r9 mov [rsp + 248h], r10 mov [rsp + 250h], r11 mov [rsp + 258h], r12 mov [rsp + 260h], r13 mov [rsp + 268h], r14 mov [rsp + 270h], r15 %else fxsave [esp] mov [esp + 200h], ebp mov [esp + 208h], eax mov [esp + 210h], ebx mov [esp + 218h], ecx mov [esp + 220h], edx mov [esp + 228h], esi mov [esp + 230h], edi %endif ; ; Call the shfork_body that will spawn the child and all that. ; %ifdef KBUILD_ARCH_AMD64 ;mov rcx, rcx ; psh mov rdx, rsp ; stack_ptr sub rsp, 20h call NAME(shfork_body) lea rsp, [rsp + 20h] %else mov edx, esp mov ecx, [ebp + 8h] ; psh sub esp, 20h mov [esp ], ecx mov [esp + 4], edx ; stack_ptr call NAME(shfork_body) lea esp, [esp + 20h] %endif ; ; Just leave the function, no need to restore things. ; leave ret %ifdef KBUILD_ARCH_AMD64 [endproc_frame shfork_do_it] %endif ;; ; Switch the stack, restore the register and leave as if we'd called shfork_do_it. ; ; @param cur Current stack pointer. ; @param base The stack base (higher value). ; @param limit The stack limit (lower value). ; NAME(shfork_resume): global NAME(shfork_resume) %ifdef KBUILD_ARCH_AMD64 mov rsp, rcx %else mov ecx, [esp + 4] mov edx, [esp + 8] mov eax, [esp + 12] mov esp, ecx %endif ; ; Adjust stack stuff in the TIB (longjmp/unwind). ; %ifdef KBUILD_ARCH_AMD64 cmp rdx, [gs:08h] ; StackBase (the higher value) jb .below mov [gs:08h], rdx .below: cmp r8, [gs:10h] ; StackLimit ja .above mov [gs:10h], r8 .above: %else cmp edx, [fs:04h] ; StackBase (the higher value) jb .below mov [fs:04h], edx .below: cmp eax, [fs:08h] ; StackLimit ja .above mov [fs:08h], eax .above: %endif ; ; Restore most of the registers. ; ;; @todo xmm registers may require explicit saving/restoring... %ifdef KBUILD_ARCH_AMD64 frstor [rsp] mov rbp, [rsp + 200h] mov rax, [rsp + 208h] mov rbx, [rsp + 210h] mov rcx, [rsp + 218h] mov rdx, [rsp + 220h] mov rsi, [rsp + 228h] mov rdi, [rsp + 230h] mov r8, [rsp + 238h] mov r9, [rsp + 240h] mov r10, [rsp + 248h] mov r11, [rsp + 250h] mov r12, [rsp + 258h] mov r13, [rsp + 260h] mov r14, [rsp + 268h] mov r15, [rsp + 270h] %else frstor [esp] mov ebp, [esp + 200h] mov eax, [esp + 208h] mov ebx, [esp + 210h] mov ecx, [esp + 218h] mov edx, [esp + 220h] mov esi, [esp + 228h] mov edi, [esp + 230h] %endif xor eax, eax ; the child returns 0. leave ret kbuild-3608/src/kash/input.h0000664000175000017500000000550114670377416015753 0ustar locutuslocutus/* $NetBSD: input.h,v 1.15 2003/08/07 09:05:33 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)input.h 8.2 (Berkeley) 5/4/95 */ /* PEOF (the end of file marker) is defined in syntax.h */ /* * The input line number. Input.c just defines this variable, and saves * and restores it when files are pushed and popped. The user of this * package must set its value. */ //extern int plinno; //extern int parsenleft; /* number of characters left in input buffer */ //extern char *parsenextc; /* next character in input buffer */ //extern int init_editline; /* 0 == not setup, 1 == OK, -1 == failed */ char *pfgets(struct shinstance *, char *, int); int pgetc(struct shinstance *); int preadbuffer(struct shinstance *); void pungetc(struct shinstance *); void pushstring(struct shinstance *, char *, size_t, void *); void popstring(struct shinstance *); void setinputfile(struct shinstance *, const char *, int); void setinputfd(struct shinstance *, int, int); void setinputstring(struct shinstance *, char *, int); void popfile(struct shinstance *); void popallfiles(struct shinstance *); void closescript(struct shinstance *); #define pgetc_macro(psh) (--(psh)->parsenleft >= 0? *(psh)->parsenextc++ : preadbuffer(psh)) kbuild-3608/src/kash/generated/0000775000175000017500000000000014670377416016400 5ustar locutuslocutuskbuild-3608/src/kash/generated/arith_lex.c0000664000175000017500000013241014670377415020523 0ustar locutuslocutus#line 2 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c" #line 4 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 33 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef unsigned int yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart (FILE *input_file ); void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); void yy_delete_buffer (YY_BUFFER_STATE b ); void yy_flush_buffer (YY_BUFFER_STATE b ); void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); void yypop_buffer_state (void ); static void yyensure_buffer_stack (void ); static void yy_load_buffer_state (void ); static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define yywrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 29 #define YY_END_OF_BUFFER 30 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[39] = { 0, 0, 0, 30, 28, 1, 1, 27, 23, 12, 6, 7, 21, 24, 25, 22, 3, 4, 17, 28, 15, 5, 11, 10, 26, 14, 9, 3, 0, 4, 19, 18, 13, 16, 20, 5, 8, 2, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1, 1, 5, 6, 1, 7, 8, 9, 10, 1, 11, 1, 12, 13, 14, 14, 14, 14, 14, 14, 14, 15, 15, 1, 1, 16, 17, 18, 1, 1, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 1, 1, 1, 21, 20, 1, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 22, 20, 20, 1, 23, 1, 24, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[25] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 3, 1, 3, 1, 1 } ; static yyconst flex_int16_t yy_base[41] = { 0, 0, 0, 47, 48, 48, 48, 29, 48, 39, 48, 48, 48, 48, 48, 48, 12, 14, 14, 27, 15, 0, 48, 20, 48, 48, 48, 22, 0, 24, 48, 48, 48, 48, 48, 0, 48, 0, 48, 38, 40 } ; static yyconst flex_int16_t yy_def[41] = { 0, 38, 1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 38, 38, 38, 38, 38, 38, 40, 38, 38, 38, 38, 38, 38, 39, 38, 40, 0, 38, 38 } ; static yyconst flex_int16_t yy_nxt[73] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 21, 22, 21, 23, 24, 27, 27, 29, 29, 29, 30, 31, 33, 34, 28, 27, 27, 29, 29, 29, 35, 35, 37, 36, 32, 26, 25, 38, 3, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38 } ; static yyconst flex_int16_t yy_chk[73] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 17, 17, 17, 18, 18, 20, 20, 16, 27, 27, 29, 29, 29, 39, 39, 40, 23, 19, 9, 7, 3, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" #define YY_NO_INPUT 1 /** @todo %option reentrant */ #line 33 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" /* $NetBSD: arith_lex.l,v 1.13 2005/03/21 22:37:09 dsl Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)arith_lex.l 8.3 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: arith_lex.l,v 1.13 2005/03/21 22:37:09 dsl Exp $"); #endif /* not lint */ #endif #include #include "arith.h" #include "error.h" #include "expand.h" #include "var.h" #include "shinstance.h" extern int yylval; extern shinstance *arith_psh; extern char *arith_buf, *arith_startbuf; #undef YY_INPUT #define YY_INPUT(buf,result,max) \ result = (*buf = *arith_buf++) ? 1 : YY_NULL; #define YY_NO_UNPUT /* Avoid unnecessary libc bits. */ #undef ECHO #define ECHO \ do {} while (0) #undef stdin #define stdin \ NULL #undef stdout #define stdout \ NULL #define YY_FATAL_ERROR(msg) \ error(arith_psh, "arith: fatal error: %s", msg) #line 554 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c" #define INITIAL 0 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap (void ); #else extern int yywrap (void ); #endif #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 104 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" #line 707 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 39 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_current_state != 38 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: /* rule 1 can match eol */ YY_RULE_SETUP #line 105 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { ; } YY_BREAK case 2: YY_RULE_SETUP #line 106 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); } YY_BREAK case 3: YY_RULE_SETUP #line 107 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); } YY_BREAK case 4: YY_RULE_SETUP #line 108 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); } YY_BREAK case 5: YY_RULE_SETUP #line 109 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { char *v = lookupvar(arith_psh, yytext); if (v) { yylval = strtol(v, &v, 0); if (*v == 0) return ARITH_NUM; } error(arith_psh, "arith: syntax error: \"%s\"", arith_startbuf); } YY_BREAK case 6: YY_RULE_SETUP #line 117 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_LPAREN); } YY_BREAK case 7: YY_RULE_SETUP #line 118 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_RPAREN); } YY_BREAK case 8: YY_RULE_SETUP #line 119 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_OR); } YY_BREAK case 9: YY_RULE_SETUP #line 120 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_AND); } YY_BREAK case 10: YY_RULE_SETUP #line 121 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_BOR); } YY_BREAK case 11: YY_RULE_SETUP #line 122 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_BXOR); } YY_BREAK case 12: YY_RULE_SETUP #line 123 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_BAND); } YY_BREAK case 13: YY_RULE_SETUP #line 124 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_EQ); } YY_BREAK case 14: YY_RULE_SETUP #line 125 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_NE); } YY_BREAK case 15: YY_RULE_SETUP #line 126 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_GT); } YY_BREAK case 16: YY_RULE_SETUP #line 127 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_GE); } YY_BREAK case 17: YY_RULE_SETUP #line 128 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_LT); } YY_BREAK case 18: YY_RULE_SETUP #line 129 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_LE); } YY_BREAK case 19: YY_RULE_SETUP #line 130 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_LSHIFT); } YY_BREAK case 20: YY_RULE_SETUP #line 131 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_RSHIFT); } YY_BREAK case 21: YY_RULE_SETUP #line 132 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_MUL); } YY_BREAK case 22: YY_RULE_SETUP #line 133 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_DIV); } YY_BREAK case 23: YY_RULE_SETUP #line 134 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_REM); } YY_BREAK case 24: YY_RULE_SETUP #line 135 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_ADD); } YY_BREAK case 25: YY_RULE_SETUP #line 136 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_SUB); } YY_BREAK case 26: YY_RULE_SETUP #line 137 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_BNOT); } YY_BREAK case 27: YY_RULE_SETUP #line 138 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { return(ARITH_NOT); } YY_BREAK case 28: YY_RULE_SETUP #line 139 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" { error(arith_psh, "arith: syntax error: \"%s\"", arith_startbuf); } YY_BREAK case 29: YY_RULE_SETUP #line 140 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" ECHO; YY_BREAK #line 939 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 39 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 39 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 38); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree((void *) b->yy_ch_buf ); yyfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current token. * */ static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = (FILE *) 0; yyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #define YYTABLES_NAME "yytables" #line 140 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" void arith_lex_reset() { #ifdef YY_NEW_FILE YY_NEW_FILE; #endif } void * yyalloc(yy_size_t cb) { return sh_malloc(NULL, cb); } void * yyrealloc(void *pv,yy_size_t cb) { return sh_realloc(NULL, pv, cb); } void yyfree(void *pv) { sh_free(NULL, pv); } kbuild-3608/src/kash/generated/token.h0000664000175000017500000000227314670377416017675 0ustar locutuslocutus#define TEOF 0 #define TNL 1 #define TSEMI 2 #define TBACKGND 3 #define TAND 4 #define TOR 5 #define TPIPE 6 #define TLP 7 #define TRP 8 #define TENDCASE 9 #define TENDBQUOTE 10 #define TREDIR 11 #define TWORD 12 #define TIF 13 #define TTHEN 14 #define TELSE 15 #define TELIF 16 #define TFI 17 #define TWHILE 18 #define TUNTIL 19 #define TFOR 20 #define TDO 21 #define TDONE 22 #define TBEGIN 23 #define TEND 24 #define TCASE 25 #define TESAC 26 #define TNOT 27 /* Array indicating which tokens mark the end of a list */ const char tokendlist[] = { 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, }; const char *const tokname[] = { "end of file", "newline", "\";\"", "\"&\"", "\"&&\"", "\"||\"", "\"|\"", "\"(\"", "\")\"", "\";;\"", "\"`\"", "redirection", "word", "\"if\"", "\"then\"", "\"else\"", "\"elif\"", "\"fi\"", "\"while\"", "\"until\"", "\"for\"", "\"do\"", "\"done\"", "\"{\"", "\"}\"", "\"case\"", "\"esac\"", "\"!\"", }; #define KWDOFFSET 13 const char *const parsekwd[] = { "if", "then", "else", "elif", "fi", "while", "until", "for", "do", "done", "{", "}", "case", "esac", "!", 0 }; kbuild-3608/src/kash/generated/builtins.h0000664000175000017500000000364314670377416020410 0ustar locutuslocutus/* * This file was generated by the mkbuiltins program. */ #include "shtypes.h" struct builtincmd { const char *name; int (*builtin)(shinstance *, int, char **); }; extern const struct builtincmd builtincmd[]; extern const struct builtincmd splbltincmd[]; int bltincmd(shinstance *, int, char **); int bgcmd(shinstance *, int, char **); int breakcmd(shinstance *, int, char **); int cdcmd(shinstance *, int, char **); int dotcmd(shinstance *, int, char **); int echocmd(shinstance *, int, char **); int evalcmd(shinstance *, int, char **); int execcmd(shinstance *, int, char **); int exitcmd(shinstance *, int, char **); int expcmd(shinstance *, int, char **); int exportcmd(shinstance *, int, char **); int falsecmd(shinstance *, int, char **); int histcmd(shinstance *, int, char **); int inputrc(shinstance *, int, char **); int fgcmd(shinstance *, int, char **); int getoptscmd(shinstance *, int, char **); int hashcmd(shinstance *, int, char **); int jobidcmd(shinstance *, int, char **); int jobscmd(shinstance *, int, char **); int localcmd(shinstance *, int, char **); #ifndef SMALL int printfcmd(shinstance *, int, char **); #endif int pwdcmd(shinstance *, int, char **); int readcmd(shinstance *, int, char **); int returncmd(shinstance *, int, char **); int setcmd(shinstance *, int, char **); int setvarcmd(shinstance *, int, char **); int shiftcmd(shinstance *, int, char **); int timescmd(shinstance *, int, char **); int trapcmd(shinstance *, int, char **); int truecmd(shinstance *, int, char **); int typecmd(shinstance *, int, char **); int umaskcmd(shinstance *, int, char **); int unaliascmd(shinstance *, int, char **); int unsetcmd(shinstance *, int, char **); int waitcmd(shinstance *, int, char **); int aliascmd(shinstance *, int, char **); int ulimitcmd(shinstance *, int, char **); int testcmd(shinstance *, int, char **); int killcmd(shinstance *, int, char **); int wordexpcmd(shinstance *, int, char **); kbuild-3608/src/kash/generated/builtins.c0000664000175000017500000000241314670377415020374 0ustar locutuslocutus/* * This file was generated by the mkbuiltins program. */ #include "shell.h" #include "builtins.h" const struct builtincmd builtincmd[] = { { "command", bltincmd }, { "bg", bgcmd }, { "cd", cdcmd }, { "chdir", cdcmd }, { "echo", echocmd }, { "exp", expcmd }, { "let", expcmd }, { "false", falsecmd }, { "fc", histcmd }, { "inputrc", inputrc }, { "fg", fgcmd }, { "getopts", getoptscmd }, { "hash", hashcmd }, { "jobid", jobidcmd }, { "jobs", jobscmd }, { "local", localcmd }, #ifndef SMALL { "printf", printfcmd }, #endif { "pwd", pwdcmd }, { "read", readcmd }, { "setvar", setvarcmd }, { "true", truecmd }, { "type", typecmd }, { "umask", umaskcmd }, { "unalias", unaliascmd }, { "wait", waitcmd }, { "alias", aliascmd }, { "ulimit", ulimitcmd }, { "test", testcmd }, { "[", testcmd }, { "kill", killcmd }, { "wordexp", wordexpcmd }, { 0, 0 }, }; const struct builtincmd splbltincmd[] = { { "break", breakcmd }, { "continue", breakcmd }, { ".", dotcmd }, { "eval", evalcmd }, { "exec", execcmd }, { "exit", exitcmd }, { "export", exportcmd }, { "readonly", exportcmd }, { "return", returncmd }, { "set", setcmd }, { "shift", shiftcmd }, { "times", timescmd }, { "trap", trapcmd }, { ":", truecmd }, { "unset", unsetcmd }, { 0, 0 }, }; kbuild-3608/src/kash/generated/arith.c0000664000175000017500000005244014670377416017660 0ustar locutuslocutus#ifndef lint static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; #endif #include #include #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 #define YYPATCH 20091027 #define YYEMPTY (-1) #define yyclearin (yychar = YYEMPTY) #define yyerrok (yyerrflag = 0) #define YYRECOVERING() (yyerrflag != 0) /* compatibility with bison */ #ifdef YYPARSE_PARAM /* compatibility with FreeBSD */ #ifdef YYPARSE_PARAM_TYPE #define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) #else #define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) #endif #else #define YYPARSE_DECL() yyparse(void) #endif /* YYPARSE_PARAM */ extern int YYPARSE_DECL(); static int yygrowstack(void); #define YYPREFIX "yy" /* $NetBSD: arith.y,v 1.17 2003/09/17 17:33:36 jmmv Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)arith.y 8.3 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: arith.y,v 1.17 2003/09/17 17:33:36 jmmv Exp $"); #endif /* not lint */ #endif #include #include "expand.h" #include "shell.h" #include "error.h" #include "output.h" #include "memalloc.h" #include "shinstance.h" shinstance *arith_psh; const char *arith_buf, *arith_startbuf; void yyerror(const char *); #ifdef TESTARITH int main(int , char *[]); int error(char *); #else # undef malloc # define malloc(cb) sh_malloc(NULL, (cb)) # undef realloc # define realloc(pv,cb) sh_realloc(NULL, (pv), (cb)) # undef free # define free(pv) sh_free(NULL, (pv)) #endif #define ARITH_NUM 257 #define ARITH_LPAREN 258 #define ARITH_RPAREN 259 #define ARITH_OR 260 #define ARITH_AND 261 #define ARITH_BOR 262 #define ARITH_BXOR 263 #define ARITH_BAND 264 #define ARITH_EQ 265 #define ARITH_NE 266 #define ARITH_LT 267 #define ARITH_GT 268 #define ARITH_GE 269 #define ARITH_LE 270 #define ARITH_LSHIFT 271 #define ARITH_RSHIFT 272 #define ARITH_ADD 273 #define ARITH_SUB 274 #define ARITH_MUL 275 #define ARITH_DIV 276 #define ARITH_REM 277 #define ARITH_UNARYMINUS 278 #define ARITH_UNARYPLUS 279 #define ARITH_NOT 280 #define ARITH_BNOT 281 #define YYERRCODE 256 static const short yylhs[] = { -1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; static const short yylen[] = { 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, }; static const short yydefred[] = { 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 24, 23, 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, }; static const short yydgoto[] = { 7, 8, }; static const short yysindex[] = { -255, 0, -255, -255, -255, -255, -255, 0, -67, -85, 0, 0, 0, 0, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, 0, -50, -34, -19, 141, -261, -233, -233, -223, -223, -223, -223, -253, -253, -248, -248, 0, 0, 0, }; static const short yyrindex[] = { 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 140, 136, 131, 125, 109, 117, 61, 73, 85, 97, 33, 47, 1, 17, 0, 0, 0, }; static const short yygindex[] = { 0, 142, }; #define YYTABLESIZE 418 static const short yytable[] = { 0, 16, 1, 2, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 17, 3, 4, 27, 28, 29, 30, 31, 5, 6, 29, 30, 31, 1, 0, 0, 14, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 0, 15, 25, 26, 27, 28, 29, 30, 31, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 3, 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 32, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 8, 8, 8, 8, 8, 8, 8, 8, 13, 13, 13, 13, 13, 13, 13, 13, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 3, 3, 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, }; static const short yycheck[] = { -1, 0, 257, 258, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 0, 273, 274, 273, 274, 275, 276, 277, 280, 281, 275, 276, 277, 0, -1, -1, 0, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, -1, -1, 0, 271, 272, 273, 274, 275, 276, 277, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, 2, 3, 4, 5, 6, -1, -1, -1, -1, -1, -1, -1, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, -1, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 259, 260, 261, 262, 263, 264, 265, 266, 259, 260, 261, 262, 263, 264, 265, 266, 259, 260, 261, 262, 263, 264, 259, 260, 261, 262, 263, 259, 260, 261, 262, 259, 260, 261, 259, 260, -1, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, }; #define YYFINAL 7 #ifndef YYDEBUG #define YYDEBUG 0 #endif #define YYMAXTOKEN 281 #if YYDEBUG static const char *yyname[] = { "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"ARITH_NUM","ARITH_LPAREN", "ARITH_RPAREN","ARITH_OR","ARITH_AND","ARITH_BOR","ARITH_BXOR","ARITH_BAND", "ARITH_EQ","ARITH_NE","ARITH_LT","ARITH_GT","ARITH_GE","ARITH_LE", "ARITH_LSHIFT","ARITH_RSHIFT","ARITH_ADD","ARITH_SUB","ARITH_MUL","ARITH_DIV", "ARITH_REM","ARITH_UNARYMINUS","ARITH_UNARYPLUS","ARITH_NOT","ARITH_BNOT", }; static const char *yyrule[] = { "$accept : exp", "exp : expr", "expr : ARITH_LPAREN expr ARITH_RPAREN", "expr : expr ARITH_OR expr", "expr : expr ARITH_AND expr", "expr : expr ARITH_BOR expr", "expr : expr ARITH_BXOR expr", "expr : expr ARITH_BAND expr", "expr : expr ARITH_EQ expr", "expr : expr ARITH_GT expr", "expr : expr ARITH_GE expr", "expr : expr ARITH_LT expr", "expr : expr ARITH_LE expr", "expr : expr ARITH_NE expr", "expr : expr ARITH_LSHIFT expr", "expr : expr ARITH_RSHIFT expr", "expr : expr ARITH_ADD expr", "expr : expr ARITH_SUB expr", "expr : expr ARITH_MUL expr", "expr : expr ARITH_DIV expr", "expr : expr ARITH_REM expr", "expr : ARITH_NOT expr", "expr : ARITH_BNOT expr", "expr : ARITH_SUB expr", "expr : ARITH_ADD expr", "expr : ARITH_NUM", }; #endif #ifndef YYSTYPE typedef int YYSTYPE; #endif #if YYDEBUG #include #endif /* define the initial stack-sizes */ #ifdef YYSTACKSIZE #undef YYMAXDEPTH #define YYMAXDEPTH YYSTACKSIZE #else #ifdef YYMAXDEPTH #define YYSTACKSIZE YYMAXDEPTH #else #define YYSTACKSIZE 500 #define YYMAXDEPTH 500 #endif #endif #define YYINITSTACKSIZE 500 int yydebug; int yynerrs; int yyerrflag; int yychar; short *yyssp; YYSTYPE *yyvsp; YYSTYPE yyval; YYSTYPE yylval; /* variables for the parser stack */ static short *yyss; static short *yysslim; static YYSTYPE *yyvs; static unsigned yystacksize; int arith(shinstance *psh, const char *s) { long result; INTOFF; /* todo lock */ arith_psh = psh; arith_buf = arith_startbuf = s; result = yyparse(); arith_lex_reset(); /* reprime lex */ arith_psh = NULL; /* todo unlock */ INTON; return (result); } /* * The exp(1) builtin. */ int expcmd(shinstance *psh, int argc, char **argv) { const char *p; char *concat; char **ap; long i; if (argc > 1) { p = argv[1]; if (argc > 2) { /* * concatenate arguments */ STARTSTACKSTR(psh, concat); ap = argv + 2; for (;;) { while (*p) STPUTC(psh, *p++, concat); if ((p = *ap++) == NULL) break; STPUTC(psh, ' ', concat); } STPUTC(psh, '\0', concat); p = grabstackstr(psh, concat); } } else p = ""; i = arith(psh, p); out1fmt(psh, "%ld\n", i); return (! i); } /*************************/ #ifdef TEST_ARITH #include main(argc, argv) char *argv[]; { printf("%d\n", exp(argv[1])); } error(s) char *s; { fprintf(stderr, "exp: %s\n", s); exit(1); } #endif void yyerror(const char *s) { shinstance *psh = arith_psh; #ifndef YYBISON /* yyerrok references yyerrstatus which is a local variable in yyparse().*/ yyerrok; #endif yyclearin; arith_lex_reset(); /* reprime lex */ /** @todo unlock */ error(psh, "arithmetic expression: %s: \"%s\"", s, arith_startbuf); /* NOTREACHED */ } /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(void) { int i; unsigned newsize; short *newss; YYSTYPE *newvs; if ((newsize = yystacksize) == 0) newsize = YYINITSTACKSIZE; else if (newsize >= YYMAXDEPTH) return -1; else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; i = yyssp - yyss; newss = (yyss != 0) ? (short *)realloc(yyss, newsize * sizeof(*newss)) : (short *)malloc(newsize * sizeof(*newss)); if (newss == 0) return -1; yyss = newss; yyssp = newss + i; newvs = (yyvs != 0) ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs)) : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); if (newvs == 0) return -1; yyvs = newvs; yyvsp = newvs + i; yystacksize = newsize; yysslim = yyss + newsize - 1; return 0; } #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab int YYPARSE_DECL() { int yym, yyn, yystate; #if YYDEBUG const char *yys; if ((yys = getenv("YYDEBUG")) != 0) { yyn = *yys; if (yyn >= '0' && yyn <= '9') yydebug = yyn - '0'; } #endif yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; yystate = 0; if (yyss == NULL && yygrowstack()) goto yyoverflow; yyssp = yyss; yyvsp = yyvs; yystate = 0; *yyssp = 0; yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; #if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } #endif } if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } yystate = yytable[yyn]; *++yyssp = yytable[yyn]; *++yyvsp = yylval; yychar = YYEMPTY; if (yyerrflag > 0) --yyerrflag; goto yyloop; } if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) { yyn = yytable[yyn]; goto yyreduce; } if (yyerrflag) goto yyinrecovery; yyerror("syntax error"); goto yyerrlab; yyerrlab: ++yynerrs; yyinrecovery: if (yyerrflag < 3) { yyerrflag = 3; for (;;) { if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); #endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } yystate = yytable[yyn]; *++yyssp = yytable[yyn]; *++yyvsp = yylval; goto yyloop; } else { #if YYDEBUG if (yydebug) printf("%sdebug: error recovery discarding state %d\n", YYPREFIX, *yyssp); #endif if (yyssp <= yyss) goto yyabort; --yyssp; --yyvsp; } } } else { if (yychar == 0) goto yyabort; #if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } #endif yychar = YYEMPTY; goto yyloop; } yyreduce: #if YYDEBUG if (yydebug) printf("%sdebug: state %d, reducing by rule %d (%s)\n", YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; if (yym) yyval = yyvsp[1-yym]; else memset(&yyval, 0, sizeof yyval); switch (yyn) { case 1: { return (yyvsp[0]); } break; case 2: { yyval = yyvsp[-1]; } break; case 3: { yyval = yyvsp[-2] ? yyvsp[-2] : yyvsp[0] ? yyvsp[0] : 0; } break; case 4: { yyval = yyvsp[-2] ? ( yyvsp[0] ? yyvsp[0] : 0 ) : 0; } break; case 5: { yyval = yyvsp[-2] | yyvsp[0]; } break; case 6: { yyval = yyvsp[-2] ^ yyvsp[0]; } break; case 7: { yyval = yyvsp[-2] & yyvsp[0]; } break; case 8: { yyval = yyvsp[-2] == yyvsp[0]; } break; case 9: { yyval = yyvsp[-2] > yyvsp[0]; } break; case 10: { yyval = yyvsp[-2] >= yyvsp[0]; } break; case 11: { yyval = yyvsp[-2] < yyvsp[0]; } break; case 12: { yyval = yyvsp[-2] <= yyvsp[0]; } break; case 13: { yyval = yyvsp[-2] != yyvsp[0]; } break; case 14: { yyval = yyvsp[-2] << yyvsp[0]; } break; case 15: { yyval = yyvsp[-2] >> yyvsp[0]; } break; case 16: { yyval = yyvsp[-2] + yyvsp[0]; } break; case 17: { yyval = yyvsp[-2] - yyvsp[0]; } break; case 18: { yyval = yyvsp[-2] * yyvsp[0]; } break; case 19: { if (yyvsp[0] == 0) yyerror("division by zero"); yyval = yyvsp[-2] / yyvsp[0]; } break; case 20: { if (yyvsp[0] == 0) yyerror("division by zero"); yyval = yyvsp[-2] % yyvsp[0]; } break; case 21: { yyval = !(yyvsp[0]); } break; case 22: { yyval = ~(yyvsp[0]); } break; case 23: { yyval = -(yyvsp[0]); } break; case 24: { yyval = yyvsp[0]; } break; } yyssp -= yym; yystate = *yyssp; yyvsp -= yym; yym = yylhs[yyn]; if (yystate == 0 && yym == 0) { #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state 0 to\ state %d\n", YYPREFIX, YYFINAL); #endif yystate = YYFINAL; *++yyssp = YYFINAL; *++yyvsp = yyval; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; #if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } #endif } if (yychar == 0) goto yyaccept; goto yyloop; } if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yyssp, yystate); #endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = (short) yystate; *++yyvsp = yyval; goto yyloop; yyoverflow: yyerror("yacc stack overflow"); yyabort: return (1); yyaccept: return (0); } kbuild-3608/src/kash/generated/nodes.h0000664000175000017500000000603514670377416017665 0ustar locutuslocutus/* * This file was generated by mknodes.sh */ #define NSEMI 0 #define NCMD 1 #define NPIPE 2 #define NREDIR 3 #define NBACKGND 4 #define NSUBSHELL 5 #define NAND 6 #define NOR 7 #define NIF 8 #define NWHILE 9 #define NUNTIL 10 #define NFOR 11 #define NCASE 12 #define NCLIST 13 #define NDEFUN 14 #define NARG 15 #define NTO 16 #define NCLOBBER 17 #define NFROM 18 #define NFROMTO 19 #define NAPPEND 20 #define NTOFD 21 #define NFROMFD 22 #define NHERE 23 #define NXHERE 24 #define NNOT 25 struct nbinary { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; union node *ch1; union node *ch2; }; struct ncmd { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; int backgnd; union node *args; union node *redirect; }; struct npipe { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; int backgnd; struct nodelist *cmdlist; }; struct nredir { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; union node *n; union node *redirect; }; struct nif { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; union node *test; union node *ifpart; union node *elsepart; }; struct nfor { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; union node *args; union node *body; char *var; }; struct ncase { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; union node *expr; union node *cases; }; struct nclist { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; union node *next; union node *pattern; union node *body; }; struct narg { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; union node *next; char *text; struct nodelist *backquote; }; struct nfile { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; int fd; union node *next; union node *fname; }; struct ndup { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; int fd; union node *next; int dupfd; union node *vname; }; struct nhere { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; int fd; union node *next; union node *doc; }; struct nnot { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR struct pstack_block *pblock; #endif int type; union node *com; }; union node { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR # ifdef __GNUC__ __extension__ # endif struct { struct pstack_block *pblock; int type; }; #else int type; #endif struct nbinary nbinary; struct ncmd ncmd; struct npipe npipe; struct nredir nredir; struct nif nif; struct nfor nfor; struct ncase ncase; struct nclist nclist; struct narg narg; struct nfile nfile; struct ndup ndup; struct nhere nhere; struct nnot nnot; }; struct nodelist { struct nodelist *next; union node *n; }; union node *copyfunc(struct shinstance *, union node *); void freefunc(struct shinstance *, union node *); kbuild-3608/src/kash/generated/arith.h0000664000175000017500000000107314670377416017661 0ustar locutuslocutus#define ARITH_NUM 257 #define ARITH_LPAREN 258 #define ARITH_RPAREN 259 #define ARITH_OR 260 #define ARITH_AND 261 #define ARITH_BOR 262 #define ARITH_BXOR 263 #define ARITH_BAND 264 #define ARITH_EQ 265 #define ARITH_NE 266 #define ARITH_LT 267 #define ARITH_GT 268 #define ARITH_GE 269 #define ARITH_LE 270 #define ARITH_LSHIFT 271 #define ARITH_RSHIFT 272 #define ARITH_ADD 273 #define ARITH_SUB 274 #define ARITH_MUL 275 #define ARITH_DIV 276 #define ARITH_REM 277 #define ARITH_UNARYMINUS 278 #define ARITH_UNARYPLUS 279 #define ARITH_NOT 280 #define ARITH_BNOT 281 kbuild-3608/src/kash/generated/init.c0000664000175000017500000001626414670377416017520 0ustar locutuslocutus/* * This file was generated by the mkinit program. */ #include "shell.h" #include "mystring.h" #include "init.h" #include "eval.h" #include #include "input.h" #include "error.h" #include #include "options.h" #include "output.h" #include "memalloc.h" #include "redir.h" #include #include "trap.h" #include "var.h" #include "shinstance.h" #undef PROFILE #define PROFILE 0 #undef SIGSSIZE #define SIGSSIZE (sizeof(sigs)/sizeof(sigs[0])) #undef MAXPWD #define MAXPWD 256 #undef ALL #define ALL (E_OPEN|E_CREAT|E_EXEC) #undef EV_EXIT #define EV_EXIT 01 /* exit after evaluating tree */ #undef EV_TESTED #define EV_TESTED 02 /* exit status is checked; ignore -e flag */ #undef EV_BACKCMD #define EV_BACKCMD 04 /* command executing within back quotes */ #undef NEWARGS #define NEWARGS 5 #undef MAXHISTLOOPS #define MAXHISTLOOPS 4 /* max recursions through fc */ #undef DEFEDITOR #define DEFEDITOR "ed" /* default editor *should* be $EDITOR */ #undef editing #define editing (Eflag(psh) || Vflag(psh)) #undef EOF_NLEFT #define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */ #undef DEFINE_OPTIONS #define DEFINE_OPTIONS #undef BLOCK_OUT #define BLOCK_OUT -2 /* output to a fixed block of memory */ #undef OUTPUT_ERR #define OUTPUT_ERR 01 /* error occurred on output */ #undef TEMPSIZE #define TEMPSIZE 32 #undef HAVE_VASPRINTF #define HAVE_VASPRINTF 1 #undef EOFMARKLEN #define EOFMARKLEN 79 #undef OPENBRACE #define OPENBRACE '{' #undef CLOSEBRACE #define CLOSEBRACE '}' #undef EMPTY #define EMPTY -2 /* marks an unused slot in redirtab */ #undef S_DFL #define S_DFL 1 /* default signal handling (SIG_DFL) */ #undef S_CATCH #define S_CATCH 2 /* signal is caught */ #undef S_IGN #define S_IGN 3 /* signal is ignored (SIG_IGN) */ #undef S_HARD_IGN #define S_HARD_IGN 4 /* signal is ignored permenantly */ #undef S_RESET #define S_RESET 5 /* temporary - to reset a hard ignored sig */ #undef INCL_BASE #define INCL_BASE #undef LIBPATHSTRICT #define LIBPATHSTRICT 3 #undef QHINF_EXEINFO #define QHINF_EXEINFO 1 /* NE exeinfo. */ #undef QHINF_READRSRCTBL #define QHINF_READRSRCTBL 2 /* Reads from the resource table. */ #undef QHINF_READFILE #define QHINF_READFILE 3 /* Reads from the executable file. */ #undef QHINF_LIBPATHLENGTH #define QHINF_LIBPATHLENGTH 4 /* Gets the libpath length. */ #undef QHINF_LIBPATH #define QHINF_LIBPATH 5 /* Gets the entire libpath. */ #undef QHINF_FIXENTRY #define QHINF_FIXENTRY 6 /* NE only */ #undef QHINF_STE #define QHINF_STE 7 /* NE only */ #undef QHINF_MAPSEL #define QHINF_MAPSEL 8 /* NE only */ #undef SET_LEN #define SET_LEN 6 /* initial # of bitcmd struct to malloc */ #undef SET_LEN_INCR #define SET_LEN_INCR 4 /* # of bitcmd structs to add as needed */ #undef CMD2_CLR #define CMD2_CLR 0x01 #undef CMD2_SET #define CMD2_SET 0x02 #undef CMD2_GBITS #define CMD2_GBITS 0x04 #undef CMD2_OBITS #define CMD2_OBITS 0x08 #undef CMD2_UBITS #define CMD2_UBITS 0x10 #undef STANDARD_BITS #define STANDARD_BITS (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO) #undef SHMEMHDR_MAGIC_FREE #define SHMEMHDR_MAGIC_FREE 0xbeeff00d #undef SHMEMHDR_MAGIC_USED #define SHMEMHDR_MAGIC_USED 0xfeedface #undef SHMEMCHUNK_MAGIC #define SHMEMCHUNK_MAGIC 0x12345678 #undef SHHEAP_MIN_CHUNK #define SHHEAP_MIN_CHUNK 0x80000 //(1024*1024) #undef SHFILE_MAX #define SHFILE_MAX 1024 #undef SHFILE_GROW #define SHFILE_GROW 64 #undef SHFILE_UNIX_MIN_FD #define SHFILE_UNIX_MIN_FD 32 #undef SHFILE_MAX_PATH #define SHFILE_MAX_PATH 4096 #undef YY_NO_UNPUT #define YY_NO_UNPUT extern void rmaliases(shinstance *psh); extern void deletefuncs(struct shinstance *); extern void hash_special_builtins(struct shinstance *); /* * Initialization code. */ void init(shinstance *psh) { /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/exec.c: */ { hash_special_builtins(psh); } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */ { psh->basepf.nextc = psh->basepf.buf = psh->basebuf; } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/options.c: */ { memcpy(&psh->optlist[0], &ro_optlist[0], sizeof(psh->optlist)); } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/var.c: */ { char **envp; initvar(psh); for (envp = sh_environ(psh) ; *envp ; envp++) { if (strchr(*envp, '=')) { setvareq(psh, *envp, VEXPORT|VTEXTFIXED); } } } } /* * This routine is called when an error or an interrupt occurs in an * interactive shell and control is returned to the main command loop. */ void reset(shinstance *psh) { /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/eval.c: */ { psh->evalskip = 0; psh->loopnest = 0; psh->funcnest = 0; } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */ { if (psh->exception != EXSHELLPROC) psh->parselleft = psh->parsenleft = 0; /* clear input buffer */ popallfiles(psh); } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/output.c: */ { psh->out1 = &psh->output; psh->out2 = &psh->errout; if (psh->memout.buf != NULL) { ckfree(psh, psh->memout.buf); psh->memout.buf = NULL; psh->memout.nextc = NULL; } } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/parser.c: */ { psh->tokpushback = 0; psh->checkkwd = 0; } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/redir.c: */ { while (psh->redirlist) popredir(psh); } } /* * This routine is called to initialize the shell to run a shell procedure. */ void initshellproc(shinstance *psh) { /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/alias.c: */ { rmaliases(psh); } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/eval.c: */ { psh->exitstatus = 0; } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/exec.c: */ { deletefuncs(psh); } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */ { popallfiles(psh); } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/jobs.c: */ { psh->backgndpid = -1; #if JOBS psh->jobctl = 0; #endif } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/options.c: */ { int i; for (i = 0; psh->optlist[i].name; i++) psh->optlist[i].val = 0; # if DEBUG == 2 debug(psh) = 1; # endif optschanged(psh); } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/redir.c: */ { clearredir(psh); } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/trap.c: */ { char *sm; clear_traps(psh); for (sm = psh->sigmode ; sm < psh->sigmode + NSIG ; sm++) { if (*sm == S_IGN) *sm = S_HARD_IGN; } } /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/var.c: */ { shprocvar(psh); } } kbuild-3608/src/kash/generated/nodes.c0000664000175000017500000002243014670377416017655 0ustar locutuslocutus/* * This file was generated by mknodes.sh */ /* $NetBSD: nodes.c.pat,v 1.12 2004/06/15 22:57:27 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)nodes.c.pat 8.2 (Berkeley) 5/4/95 */ #include /* * Routine for dealing with parsed shell commands. */ #include "shell.h" #include "nodes.h" #include "memalloc.h" #include "machdep.h" #include "mystring.h" #include "shinstance.h" #ifndef KASH_SEPARATE_PARSER_ALLOCATOR size_t funcblocksize; /* size of structures in function */ size_t funcstringsize; /* size of strings in node */ pointer funcblock; /* block to allocate function from */ char *funcstring; /* block to allocate strings from */ static const short nodesize[26] = { SHELL_ALIGN(sizeof (struct nbinary)), SHELL_ALIGN(sizeof (struct ncmd)), SHELL_ALIGN(sizeof (struct npipe)), SHELL_ALIGN(sizeof (struct nredir)), SHELL_ALIGN(sizeof (struct nredir)), SHELL_ALIGN(sizeof (struct nredir)), SHELL_ALIGN(sizeof (struct nbinary)), SHELL_ALIGN(sizeof (struct nbinary)), SHELL_ALIGN(sizeof (struct nif)), SHELL_ALIGN(sizeof (struct nbinary)), SHELL_ALIGN(sizeof (struct nbinary)), SHELL_ALIGN(sizeof (struct nfor)), SHELL_ALIGN(sizeof (struct ncase)), SHELL_ALIGN(sizeof (struct nclist)), SHELL_ALIGN(sizeof (struct narg)), SHELL_ALIGN(sizeof (struct narg)), SHELL_ALIGN(sizeof (struct nfile)), SHELL_ALIGN(sizeof (struct nfile)), SHELL_ALIGN(sizeof (struct nfile)), SHELL_ALIGN(sizeof (struct nfile)), SHELL_ALIGN(sizeof (struct nfile)), SHELL_ALIGN(sizeof (struct ndup)), SHELL_ALIGN(sizeof (struct ndup)), SHELL_ALIGN(sizeof (struct nhere)), SHELL_ALIGN(sizeof (struct nhere)), SHELL_ALIGN(sizeof (struct nnot)), }; STATIC void calcsize(union node *); STATIC void sizenodelist(struct nodelist *); STATIC union node *copynode(union node *); STATIC struct nodelist *copynodelist(struct nodelist *); STATIC char *nodesavestr(char *); #endif /* !KASH_SEPARATE_PARSER_ALLOCATOR */ /* * Make a copy of a parse tree. */ union node * copyfunc(psh, n) struct shinstance *psh; union node *n; { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR if (n != NULL) { unsigned refs = pstackretain(n->pblock); TRACE2((psh, "copyfunc: %p - %u refs\n", n->pblock, refs)); K_NOREF(refs); } return n; #else if (n == NULL) return NULL; funcblocksize = 0; funcstringsize = 0; calcsize(n); funcblock = ckmalloc(psh, funcblocksize + funcstringsize); funcstring = (char *) funcblock + funcblocksize; return copynode(n); #endif } #ifndef KASH_SEPARATE_PARSER_ALLOCATOR STATIC void calcsize(n) union node *n; { if (n == NULL) return; funcblocksize += nodesize[n->type]; switch (n->type) { case NSEMI: case NAND: case NOR: case NWHILE: case NUNTIL: calcsize(n->nbinary.ch2); calcsize(n->nbinary.ch1); break; case NCMD: calcsize(n->ncmd.redirect); calcsize(n->ncmd.args); break; case NPIPE: sizenodelist(n->npipe.cmdlist); break; case NREDIR: case NBACKGND: case NSUBSHELL: calcsize(n->nredir.redirect); calcsize(n->nredir.n); break; case NIF: calcsize(n->nif.elsepart); calcsize(n->nif.ifpart); calcsize(n->nif.test); break; case NFOR: funcstringsize += strlen(n->nfor.var) + 1; calcsize(n->nfor.body); calcsize(n->nfor.args); break; case NCASE: calcsize(n->ncase.cases); calcsize(n->ncase.expr); break; case NCLIST: calcsize(n->nclist.body); calcsize(n->nclist.pattern); calcsize(n->nclist.next); break; case NDEFUN: case NARG: sizenodelist(n->narg.backquote); funcstringsize += strlen(n->narg.text) + 1; calcsize(n->narg.next); break; case NTO: case NCLOBBER: case NFROM: case NFROMTO: case NAPPEND: calcsize(n->nfile.fname); calcsize(n->nfile.next); break; case NTOFD: case NFROMFD: calcsize(n->ndup.vname); calcsize(n->ndup.next); break; case NHERE: case NXHERE: calcsize(n->nhere.doc); calcsize(n->nhere.next); break; case NNOT: calcsize(n->nnot.com); break; }; } STATIC void sizenodelist(lp) struct nodelist *lp; { while (lp) { funcblocksize += SHELL_ALIGN(sizeof(struct nodelist)); calcsize(lp->n); lp = lp->next; } } STATIC union node * copynode(n) union node *n; { union node *new; if (n == NULL) return NULL; new = funcblock; funcblock = (char *) funcblock + nodesize[n->type]; switch (n->type) { case NSEMI: case NAND: case NOR: case NWHILE: case NUNTIL: new->nbinary.ch2 = copynode(n->nbinary.ch2); new->nbinary.ch1 = copynode(n->nbinary.ch1); break; case NCMD: new->ncmd.redirect = copynode(n->ncmd.redirect); new->ncmd.args = copynode(n->ncmd.args); new->ncmd.backgnd = n->ncmd.backgnd; break; case NPIPE: new->npipe.cmdlist = copynodelist(n->npipe.cmdlist); new->npipe.backgnd = n->npipe.backgnd; break; case NREDIR: case NBACKGND: case NSUBSHELL: new->nredir.redirect = copynode(n->nredir.redirect); new->nredir.n = copynode(n->nredir.n); break; case NIF: new->nif.elsepart = copynode(n->nif.elsepart); new->nif.ifpart = copynode(n->nif.ifpart); new->nif.test = copynode(n->nif.test); break; case NFOR: new->nfor.var = nodesavestr(n->nfor.var); new->nfor.body = copynode(n->nfor.body); new->nfor.args = copynode(n->nfor.args); break; case NCASE: new->ncase.cases = copynode(n->ncase.cases); new->ncase.expr = copynode(n->ncase.expr); break; case NCLIST: new->nclist.body = copynode(n->nclist.body); new->nclist.pattern = copynode(n->nclist.pattern); new->nclist.next = copynode(n->nclist.next); break; case NDEFUN: case NARG: new->narg.backquote = copynodelist(n->narg.backquote); new->narg.text = nodesavestr(n->narg.text); new->narg.next = copynode(n->narg.next); break; case NTO: case NCLOBBER: case NFROM: case NFROMTO: case NAPPEND: new->nfile.fname = copynode(n->nfile.fname); new->nfile.next = copynode(n->nfile.next); new->nfile.fd = n->nfile.fd; break; case NTOFD: case NFROMFD: new->ndup.vname = copynode(n->ndup.vname); new->ndup.dupfd = n->ndup.dupfd; new->ndup.next = copynode(n->ndup.next); new->ndup.fd = n->ndup.fd; break; case NHERE: case NXHERE: new->nhere.doc = copynode(n->nhere.doc); new->nhere.next = copynode(n->nhere.next); new->nhere.fd = n->nhere.fd; break; case NNOT: new->nnot.com = copynode(n->nnot.com); break; }; new->type = n->type; return new; } STATIC struct nodelist * copynodelist(lp) struct nodelist *lp; { struct nodelist *start; struct nodelist **lpp; lpp = &start; while (lp) { *lpp = funcblock; funcblock = (char *) funcblock + SHELL_ALIGN(sizeof(struct nodelist)); (*lpp)->n = copynode(lp->n); lp = lp->next; lpp = &(*lpp)->next; } *lpp = NULL; return start; } STATIC char * nodesavestr(s) char *s; { register char *p = s; register char *q = funcstring; char *rtn = funcstring; while ((*q++ = *p++) != 0) continue; funcstring = q; return rtn; } #endif /* !KASH_SEPARATE_PARSER_ALLOCATOR */ /* * Free a parse tree. */ void freefunc(psh, n) shinstance *psh; union node *n; { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR if (n) pstackrelease(psh, n->pblock, "freefunc"); #else if (n) ckfree(psh, n); #endif } kbuild-3608/src/kash/shinstance.c0000664000175000017500000017316314670377416016760 0ustar locutuslocutus/* $Id: shinstance.c 3570 2022-07-09 14:42:02Z bird $ */ /** @file * The shell instance methods. */ /* * Copyright (c) 2007-2010 knut st. osmundsen * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include #include #ifdef _MSC_VER # include #else # include # include #endif #include "shinstance.h" #include "alias.h" #include "error.h" #include "input.h" #include "jobs.h" #include "memalloc.h" #include "nodes.h" #include "redir.h" #include "shell.h" #include "trap.h" #if K_OS == K_OS_WINDOWS # include # include "nt/nt_child_inject_standard_handles.h" # ifdef SH_FORKED_MODE extern pid_t shfork_do(shinstance *psh); /* shforkA-win.asm */ # endif #endif /********************************************************************************************************************************* * Defined Constants And Macros * *********************************************************************************************************************************/ #ifndef SH_FORKED_MODE /** Used by sh__exit/sh_thread_wrapper for passing zero via longjmp. */ # define SH_EXIT_ZERO 0x0d15ea5e #endif /********************************************************************************************************************************* * Global Variables * *********************************************************************************************************************************/ #ifndef SH_FORKED_MODE /** Mutex serializing exec/spawn to prevent unwanted file inherting. */ shmtx g_sh_exec_inherit_mtx; /** Mutex protecting g_sh_sts_free. */ static shmtx g_sh_sts_mtx; /** List of free subshell status structure (saves CreateEvent calls). */ static shsubshellstatus * volatile g_sh_sts_free = NULL; #endif /** The mutex protecting the the globals and some shell instance members (sigs). */ static shmtx g_sh_mtx; /** The root shell instance. */ static shinstance *g_sh_root; /** The first shell instance. */ static shinstance *g_sh_head; /** The last shell instance. */ static shinstance *g_sh_tail; /** The number of shells. */ static int volatile g_num_shells; /* Statistics: Number of subshells spawned. */ static KU64 g_stat_subshells = 0; /* Statistics: Number of program exec'ed. */ static KU64 volatile g_stat_execs = 0; #if K_OS == K_OS_WINDOWS /* Statistics: Number of serialized exec calls. */ static KU64 volatile g_stat_execs_serialized = 0; #endif /** Per signal state for determining a common denominator. * @remarks defaults and unmasked actions aren't counted. */ struct shsigstate { /** The current signal action. */ #ifndef _MSC_VER struct sigaction sa; #else struct { void (*sa_handler)(int); int sa_flags; shsigset_t sa_mask; } sa; #endif /** The number of restarts (siginterrupt / SA_RESTART). */ int num_restart; /** The number of ignore handlers. */ int num_ignore; /** The number of specific handlers. */ int num_specific; /** The number of threads masking it. */ int num_masked; } g_sig_state[NSIG]; /********************************************************************************************************************************* * Internal Functions * *********************************************************************************************************************************/ #ifndef SH_FORKED_MODE static void shsubshellstatus_signal_and_release(shinstance *psh, int iExit); #endif int shmtx_init(shmtx *pmtx) { #if K_OS == K_OS_WINDOWS typedef int mtxsizecheck[sizeof(CRITICAL_SECTION) + sizeof(KU64) <= sizeof(*pmtx) ? 2 : 0]; InitializeCriticalSection((CRITICAL_SECTION *)pmtx); #else pmtx->b[0] = 0; #endif pmtx->au64[SHMTX_MAGIC_IDX] = SHMTX_MAGIC; return 0; } /** * Safe to call more than once. */ void shmtx_delete(shmtx *pmtx) { if (pmtx->au64[SHMTX_MAGIC_IDX] != SHMTX_MAGIC) { #if K_OS == K_OS_WINDOWS DeleteCriticalSection((CRITICAL_SECTION *)pmtx); #else pmtx->b[0] = 0; #endif pmtx->au64[SHMTX_MAGIC_IDX] = ~SHMTX_MAGIC; } } void shmtx_enter(shmtx *pmtx, shmtxtmp *ptmp) { #if K_OS == K_OS_WINDOWS EnterCriticalSection((CRITICAL_SECTION *)pmtx); ptmp->i = 0x42; #else pmtx->b[0] = 0; ptmp->i = 0; #endif } void shmtx_leave(shmtx *pmtx, shmtxtmp *ptmp) { #if K_OS == K_OS_WINDOWS kHlpAssert(ptmp->i == 0x42); LeaveCriticalSection((CRITICAL_SECTION *)pmtx); ptmp->i = 0x21; #else pmtx->b[0] = 0; ptmp->i = 432; #endif } /** * Initialize globals in shinstance.c. * * Called when creating the rootshell and on windows after forking. */ void sh_init_globals(void) { kHlpAssert(g_sh_mtx.au64[SHMTX_MAGIC_IDX] != SHMTX_MAGIC); shmtx_init(&g_sh_mtx); #ifndef SH_FORKED_MODE shmtx_init(&g_sh_exec_inherit_mtx); shmtx_init(&g_sh_sts_mtx); #endif } /** * Links the shell instance. * * @param psh The shell. */ static void sh_int_link(shinstance *psh) { shmtxtmp tmp; shmtx_enter(&g_sh_mtx, &tmp); if (psh->rootshell) g_sh_root = psh; else g_stat_subshells++; psh->next = NULL; psh->prev = g_sh_tail; if (g_sh_tail) g_sh_tail->next = psh; else g_sh_tail = g_sh_head = psh; g_sh_tail = psh; g_num_shells++; psh->linked = 1; shmtx_leave(&g_sh_mtx, &tmp); } /** * Unlink the shell instance. * * @param psh The shell. */ static void sh_int_unlink(shinstance *psh) { if (psh->linked) { shinstance *pshcur; shmtxtmp tmp; shmtx_enter(&g_sh_mtx, &tmp); g_num_shells--; if (g_sh_tail == psh) g_sh_tail = psh->prev; else psh->next->prev = psh->prev; if (g_sh_head == psh) g_sh_head = psh->next; else psh->prev->next = psh->next; if (g_sh_root == psh) g_sh_root = NULL; /* Orphan children: */ for (pshcur = g_sh_head; pshcur; pshcur = pshcur->next) if (pshcur->parent == psh) pshcur->parent = NULL; shmtx_leave(&g_sh_mtx, &tmp); } } /** * Frees a string vector like environ or argv. * * @param psh The shell to associate the deallocations with. * @param vecp Pointer to the vector pointer. */ static void sh_free_string_vector(shinstance *psh, char ***vecp) { char **vec = *vecp; if (vec) { char *str; size_t i = 0; while ((str = vec[i]) != NULL) { sh_free(psh, str); vec[i] = NULL; i++; } sh_free(psh, vec); *vecp = NULL; } } /** * Destroys the shell instance. * * This will work on partially initialized instances (because I'm lazy). * * @param psh The shell instance to be destroyed. * @note invalidate thread arguments. */ static void sh_destroy(shinstance *psh) { unsigned left, i; INTOFF; sh_int_unlink(psh); /* shinstance stuff: */ shfile_uninit(&psh->fdtab, psh->tracefd); sh_free_string_vector(psh, &psh->shenviron); sh_free(psh, psh->children); psh->children = NULL; #ifndef SH_FORKED_MODE /** @todo children. */ sh_free(psh, psh->threadarg); psh->threadarg = NULL; kHlpAssert(!psh->subshellstatus); if (psh->subshellstatus) { shsubshellstatus_signal_and_release(psh, psh->exitstatus); psh->subshellstatus = NULL; } #endif /* alias.c */ left = psh->aliases; if (left > 0) for (i = 0; i < K_ELEMENTS(psh->atab); i++) { struct alias *cur = psh->atab[i]; if (cur) { do { struct alias *next = cur->next; sh_free(psh, cur->val); sh_free(psh, cur->name); sh_free(psh, cur); cur = next; left--; } while (cur); psh->atab[i] = NULL; if (!left) break; } } /* cd.c */ sh_free(psh, psh->curdir); psh->curdir = NULL; sh_free(psh, psh->prevdir); psh->prevdir = NULL; psh->cdcomppath = NULL; /* stalloc */ /* eval.h */ if (psh->commandnamemalloc) sh_free(psh, psh->commandname); psh->commandname = NULL; psh->cmdenviron = NULL; /* expand.c */ if (psh->ifsfirst.next) { struct ifsregion *ifsrgn = psh->ifsfirst.next; psh->ifsfirst.next = NULL; do { struct ifsregion *next = ifsrgn->next; sh_free(psh, ifsrgn); ifsrgn = next; } while (ifsrgn); } psh->ifslastp = NULL; sh_free(psh, psh->expdir); psh->expdir = NULL; /* exec.h/exec.c */ psh->pathopt = NULL; for (i = 0; i < CMDTABLESIZE; i++) { struct tblentry *cur = psh->cmdtable[i]; if (cur) { do { struct tblentry *next = cur->next; if (cur->cmdtype == CMDFUNCTION) { freefunc(psh, cur->param.func); cur->param.func = NULL; } sh_free(psh, cur); cur = next; } while (cur); psh->cmdtable[i] = NULL; } } /* input.h/c */ if (psh->parsefile != NULL) { popallfiles(psh); while (psh->basepf.strpush) popstring(psh); } /* jobs.h/c */ if (psh->jobtab) { int j = psh->njobs; while (j-- > 0) if (psh->jobtab[j].used && psh->jobtab[j].ps != &psh->jobtab[j].ps0) { sh_free(psh, psh->jobtab[j].ps); psh->jobtab[j].ps = &psh->jobtab[j].ps0; } sh_free(psh, psh->jobtab); psh->jobtab = NULL; psh->njobs = 0; } /* myhistedit.h */ #ifndef SMALL # error FIXME History *hist; EditLine *el; #endif /* output.h */ if (psh->output.buf != NULL) { ckfree(psh, psh->output.buf); psh->output.buf = NULL; } if (psh->errout.buf != NULL) { ckfree(psh, psh->errout.buf); psh->errout.buf = NULL; } if (psh->memout.buf != NULL) { ckfree(psh, psh->memout.buf); psh->memout.buf = NULL; } /* options.h */ if (psh->arg0malloc) { sh_free(psh, psh->arg0); psh->arg0 = NULL; } if (psh->shellparam.malloc) sh_free_string_vector(psh, &psh->shellparam.p); sh_free_string_vector(psh, &psh->orgargv); psh->argptr = NULL; psh->minusc = NULL; /* redir.c */ if (psh->redirlist) { struct redirtab *redir = psh->redirlist; psh->redirlist = NULL; do { struct redirtab *next = redir->next; sh_free(psh, redir); redir = next; } while (redir); } psh->expfnames = NULL; /* stack alloc */ /* trap.c */ for (i = 0; i < K_ELEMENTS(psh->trap); i++) if (!psh->trap[i]) { /* likely */ } else { sh_free(psh, psh->trap[i]); psh->trap[i] = NULL; } /* var.h */ if (psh->localvars) { struct localvar *lvar = psh->localvars; psh->localvars = NULL; do { struct localvar *next = lvar->next; if (!(lvar->flags & VTEXTFIXED)) sh_free(psh, lvar->text); sh_free(psh, lvar); lvar = next; } while (lvar); } for (i = 0; i < K_ELEMENTS(psh->vartab); i++) { struct var *var = psh->vartab[i]; if (!var) { /* likely */ } else { psh->vartab[i] = NULL; do { struct var *next = var->next; if (!(var->flags & (VTEXTFIXED | VSTACK))) sh_free(psh, var->text); if (!(var->flags & (VSTRFIXED | VSTRFIXED2))) sh_free(psh, var); var = next; } while (var); } } /* * memalloc.c: Make sure we've gotten rid of all the stack memory. */ if (psh->stackp != &psh->stackbase && psh->stackp) { struct stack_block *stackp = psh->stackp; do { psh->stackp = stackp->prev; sh_free(psh, stackp); } while ((stackp = psh->stackp) != &psh->stackbase && stackp); } #ifdef KASH_SEPARATE_PARSER_ALLOCATOR //bp msvcr100!_wassert if (psh->pstack) { if (psh->pstacksize > 0) pstackpop(psh, 0); sh_free(psh, psh->pstack); psh->pstack = NULL; } sh_free(psh, psh->freepstack); psh->freepstack = NULL; #endif psh->markp = NULL; /* * Finally get rid of tracefd and then free the shell: */ shfile_uninit(&psh->fdtab, -1); memset(psh, 0, sizeof(*psh)); sh_free(NULL, psh); } /** * Clones a string vector like environ or argv. * * @returns 0 on success, -1 and errno on failure. * @param psh The shell to associate the allocations with. * @param dstp Where to store the clone. * @param src The vector to be cloned. */ static int sh_clone_string_vector(shinstance *psh, char ***dstp, char **src) { char **dst; size_t items; /* count first */ items = 0; while (src[items]) items++; /* alloc clone array. */ *dstp = dst = sh_malloc(psh, sizeof(*dst) * (items + 1)); if (!dst) return -1; /* copy the items */ dst[items] = NULL; while (items-- > 0) { dst[items] = sh_strdup(psh, src[items]); if (!dst[items]) { /* allocation error, clean up. */ while (dst[++items]) sh_free(psh, dst[items]); sh_free(psh, dst); errno = ENOMEM; return -1; } } return 0; } /** * Creates a shell instance, caller must link it. * * @param inherit The shell to inherit from, or NULL if root. * @param argv The argument vector. * @param envp The environment vector. * @param parentfdtab File table to inherit from, NULL if root. * * @returns pointer to root shell on success, NULL on failure. */ static shinstance *sh_create_shell_common(char **argv, char **envp, shfdtab *parentfdtab) { shinstance *psh; /* * The allocations. */ psh = sh_calloc(NULL, sizeof(*psh), 1); if (psh) { /* Init it enough for sh_destroy() to not get upset: */ /* ... */ /* Call the basic initializers. */ if ( !sh_clone_string_vector(psh, &psh->shenviron, envp) && !sh_clone_string_vector(psh, &psh->orgargv, argv) && !shfile_init(&psh->fdtab, parentfdtab)) { unsigned i; /* * The special stuff. */ #ifdef _MSC_VER psh->pgid = psh->pid = _getpid(); #else psh->pid = getpid(); psh->pgid = getpgid(0); #endif /*sh_sigemptyset(&psh->sigrestartset);*/ for (i = 0; i < K_ELEMENTS(psh->sigactions); i++) psh->sigactions[i].sh_handler = SH_SIG_UNK; #if defined(_MSC_VER) sh_sigemptyset(&psh->sigmask); #else sigprocmask(SIG_SETMASK, NULL, &psh->sigmask); #endif /* * State initialization. */ /* cd.c */ psh->getpwd_first = 1; /* exec */ psh->builtinloc = -1; /* memalloc.c */ psh->stacknleft = MINSIZE; psh->herefd = -1; psh->stackp = &psh->stackbase; psh->stacknxt = psh->stackbase.space; /* input.c */ psh->plinno = 1; psh->init_editline = 0; psh->parsefile = &psh->basepf; /* output.c */ psh->output.bufsize = OUTBUFSIZ; psh->output.fd = 1; psh->output.psh = psh; psh->errout.bufsize = 100; psh->errout.fd = 2; psh->errout.psh = psh; psh->memout.fd = MEM_OUT; psh->memout.psh = psh; psh->out1 = &psh->output; psh->out2 = &psh->errout; /* jobs.c */ psh->backgndpid = -1; #if JOBS psh->curjob = -1; #else # error asdf #endif psh->ttyfd = -1; /* show.c */ psh->tracefd = -1; return psh; } sh_destroy(psh); } return NULL; } /** * Creates the root shell instance. * * @param argv The argument vector. * @param envp The environment vector. * * @returns pointer to root shell on success, NULL on failure. */ shinstance *sh_create_root_shell(char **argv, char **envp) { shinstance *psh; sh_init_globals(); psh = sh_create_shell_common(argv, envp, NULL /*parentfdtab*/); if (psh) { sh_int_link(psh); return psh; } return NULL; } #ifndef SH_FORKED_MODE /** * Does the inherting from the parent shell instance. */ static void sh_inherit_from_parent(shinstance *psh, shinstance *inherit) { /* * Make sure we can use TRACE/TRACE2 for logging here. */ #ifdef DEBUG /* show.c */ psh->tracefd = inherit->tracefd; /* options.c */ debug(psh) = debug(inherit); #endif /* * Do the rest of the inheriting. */ psh->parent = inherit; psh->pgid = inherit->pgid; psh->sigmask = psh->sigmask; /** @todo sigactions? */ /// @todo suppressint? /* alises: */ subshellinitalias(psh, inherit); /* cd.c */ psh->getpwd_first = inherit->getpwd_first; if (inherit->curdir) psh->curdir = savestr(psh, inherit->curdir); if (inherit->prevdir) psh->prevdir = savestr(psh, inherit->prevdir); /* eval.h */ /* psh->commandname - see subshellinitoptions */ psh->exitstatus = inherit->exitstatus; /// @todo ?? psh->back_exitstatus = inherit->back_exitstatus; /// @todo ?? psh->funcnest = inherit->funcnest; psh->evalskip = inherit->evalskip; /// @todo ?? psh->skipcount = inherit->skipcount; /// @todo ?? /* exec.c */ subshellinitexec(psh, inherit); /* input.h/input.c - only for the parser and anyway forkchild calls closescript(). */ /* jobs.h - should backgndpid be -1 in subshells? */ /* jobs.c - */ psh->jobctl = inherit->jobctl; /// @todo ?? psh->initialpgrp = inherit->initialpgrp; psh->ttyfd = inherit->ttyfd; /** @todo copy jobtab so the 'jobs' command can be run in a subshell. * Better, make it follow the parent chain and skip the copying. Will * require some kind of job locking. */ /* mail.c - nothing (for now at least) */ /* main.h */ psh->rootpid = inherit->rootpid; psh->psh_rootshell = inherit->psh_rootshell; /* memalloc.h / memalloc.c - nothing. */ /* myhistedit.h */ /** @todo copy history? Do we need to care? */ /* output.h */ /** @todo not sure this is possible/relevant for subshells */ psh->output.fd = inherit->output.fd; psh->errout.fd = inherit->errout.fd; if (inherit->out1 == &inherit->memout) psh->out1 = &psh->memout; if (inherit->out2 == &inherit->memout) psh->out2 = &psh->memout; /* options.h */ subshellinitoptions(psh, inherit); /* parse.h/parse.c */ psh->whichprompt = inherit->whichprompt; /* tokpushback, doprompt and needprompt shouldn't really matter, parsecmd resets thems. */ /* The rest are internal to the parser, as I see them, and can be ignored. */ /* redir.c */ subshellinitredir(psh, inherit); /* trap.h / trap.c */ /** @todo we don't carry pendingsigs to the subshell, right? */ subshellinittrap(psh, inherit); /* var.h */ subshellinitvar(psh, inherit); } /** * Creates a child shell instance. * * @param inherit The shell to inherit from. * * @returns pointer to root shell on success, NULL on failure. */ shinstance *sh_create_child_shell(shinstance *inherit) { shinstance *psh = sh_create_shell_common(inherit->orgargv, inherit->shenviron, &inherit->fdtab); if (psh) { /* Fake a pid for the child: */ static unsigned volatile s_cShells = 0; int const iSubShell = ++s_cShells; psh->pid = SHPID_MAKE(SHPID_GET_PID(inherit->pid), iSubShell); sh_inherit_from_parent(psh, inherit); /* link it */ sh_int_link(psh); return psh; } return NULL; } #endif /* !SH_FORKED_MODE */ /** getenv() */ char *sh_getenv(shinstance *psh, const char *var) { size_t len; int i = 0; if (!var) return NULL; len = strlen(var); i = 0; while (psh->shenviron[i]) { const char *item = psh->shenviron[i]; if ( !strncmp(item, var, len) && item[len] == '=') return (char *)item + len + 1; i++; } return NULL; } char **sh_environ(shinstance *psh) { return psh->shenviron; } const char *sh_gethomedir(shinstance *psh, const char *user) { const char *ret = NULL; #ifdef _MSC_VER ret = sh_getenv(psh, "HOME"); if (!ret) ret = sh_getenv(psh, "USERPROFILE"); #else struct passwd *pwd = getpwnam(user); /** @todo use getpwdnam_r */ (void)psh; ret = pwd ? pwd->pw_dir : NULL; #endif return ret; } /** * Lazy initialization of a signal state, globally. * * @param psh The shell doing the lazy work. * @param signo The signal (valid). */ static void sh_int_lazy_init_sigaction(shinstance *psh, int signo) { if (psh->sigactions[signo].sh_handler == SH_SIG_UNK) { shmtxtmp tmp; shmtx_enter(&g_sh_mtx, &tmp); if (psh->sigactions[signo].sh_handler == SH_SIG_UNK) { shsigaction_t shold; shinstance *cur; #ifndef _MSC_VER struct sigaction old; if (!sigaction(signo, NULL, &old)) { /* convert */ shold.sh_flags = old.sa_flags; shold.sh_mask = old.sa_mask; if (old.sa_handler == SIG_DFL) shold.sh_handler = SH_SIG_DFL; else { kHlpAssert(old.sa_handler == SIG_IGN); shold.sh_handler = SH_SIG_IGN; } } else #endif { /* fake */ #ifndef _MSC_VER kHlpAssert(0); old.sa_handler = SIG_DFL; old.sa_flags = 0; sigemptyset(&shold.sh_mask); sigaddset(&shold.sh_mask, signo); #endif shold.sh_flags = 0; sh_sigemptyset(&shold.sh_mask); sh_sigaddset(&shold.sh_mask, signo); shold.sh_handler = SH_SIG_DFL; } /* update globals */ #ifndef _MSC_VER g_sig_state[signo].sa = old; #else g_sig_state[signo].sa.sa_handler = SIG_DFL; g_sig_state[signo].sa.sa_flags = 0; g_sig_state[signo].sa.sa_mask = shold.sh_mask; #endif TRACE2((psh, "sh_int_lazy_init_sigaction: signo=%d:%s sa_handler=%p sa_flags=%#x\n", signo, sys_signame[signo], g_sig_state[signo].sa.sa_handler, g_sig_state[signo].sa.sa_flags)); /* update all shells */ for (cur = g_sh_head; cur; cur = cur->next) { kHlpAssert(cur->sigactions[signo].sh_handler == SH_SIG_UNK); cur->sigactions[signo] = shold; } } shmtx_leave(&g_sh_mtx, &tmp); } } /** * Perform the default signal action on the shell. * * @param psh The shell instance. * @param signo The signal. */ static void sh_sig_do_default(shinstance *psh, int signo) { /** @todo */ } /** * Deliver a signal to a shell. * * @param psh The shell instance. * @param pshDst The shell instance to signal. * @param signo The signal. * @param locked Whether we're owning the lock or not. */ static void sh_sig_do_signal(shinstance *psh, shinstance *pshDst, int signo, int locked) { shsig_t pfn = pshDst->sigactions[signo].sh_handler; if (pfn == SH_SIG_UNK) { sh_int_lazy_init_sigaction(pshDst, signo); pfn = pshDst->sigactions[signo].sh_handler; } if (pfn == SH_SIG_DFL) sh_sig_do_default(pshDst, signo); else if (pfn == SH_SIG_IGN) /* ignore it */; else { kHlpAssert(pfn != SH_SIG_ERR); pfn(pshDst, signo); } (void)locked; } /** * Handler for external signals. * * @param signo The signal. */ static void sh_sig_common_handler(int signo) { shinstance *psh; /* fprintf(stderr, "sh_sig_common_handler: signo=%d:%s\n", signo, sys_signame[signo]); */ #ifdef _MSC_VER /* We're treating SIGBREAK as if it was SIGINT for now: */ if (signo == SIGBREAK) signo = SIGINT; #endif /* * No need to take locks if there is only one shell. * Since this will be the initial case, just avoid the deadlock * hell for a litte while... */ if (g_num_shells <= 1) { psh = g_sh_head; if (psh) sh_sig_do_signal(NULL, psh, signo, 0 /* no lock */); } else { shmtxtmp tmp; shmtx_enter(&g_sh_mtx, &tmp); /** @todo signal focus chain or something? Atm there will only be one shell, * so it's not really important until we go threaded for real... */ psh = g_sh_tail; while (psh != NULL) { sh_sig_do_signal(NULL, psh, signo, 1 /* locked */); psh = psh->prev; } shmtx_leave(&g_sh_mtx, &tmp); } } int sh_sigaction(shinstance *psh, int signo, const struct shsigaction *newp, struct shsigaction *oldp) { if (newp) TRACE2((psh, "sh_sigaction: signo=%d:%s newp=%p:{.sh_handler=%p, .sh_flags=%#x} oldp=%p\n", signo, sys_signame[signo], newp, newp->sh_handler, newp->sh_flags, oldp)); else TRACE2((psh, "sh_sigaction: signo=%d:%s newp=NULL oldp=%p\n", signo, sys_signame[signo], oldp)); /* * Input validation. */ if (signo >= NSIG || signo <= 0) { errno = EINVAL; return -1; } /* * Make sure our data is correct. */ sh_int_lazy_init_sigaction(psh, signo); /* * Get the old one if requested. */ if (oldp) *oldp = psh->sigactions[signo]; /* * Set the new one if it has changed. * * This will be attempted coordinated with the other signal handlers so * that we can arrive at a common denominator. */ if ( newp && memcmp(&psh->sigactions[signo], newp, sizeof(*newp))) { shmtxtmp tmp; shmtx_enter(&g_sh_mtx, &tmp); /* Undo the accounting for the current entry. */ if (psh->sigactions[signo].sh_handler == SH_SIG_IGN) g_sig_state[signo].num_ignore--; else if (psh->sigactions[signo].sh_handler != SH_SIG_DFL) g_sig_state[signo].num_specific--; if (psh->sigactions[signo].sh_flags & SA_RESTART) g_sig_state[signo].num_restart--; /* Set the new entry. */ psh->sigactions[signo] = *newp; /* Add the bits for the new action entry. */ if (psh->sigactions[signo].sh_handler == SH_SIG_IGN) g_sig_state[signo].num_ignore++; else if (psh->sigactions[signo].sh_handler != SH_SIG_DFL) g_sig_state[signo].num_specific++; if (psh->sigactions[signo].sh_flags & SA_RESTART) g_sig_state[signo].num_restart++; /* * Calc new common action. * * This is quit a bit ASSUMPTIVE about the limited use. We will not * bother synching the mask, and we pretend to care about SA_RESTART. * The only thing we really actually care about is the sh_handler. * * On second though, it's possible we should just tie this to the root * shell since it only really applies to external signal ... */ if ( g_sig_state[signo].num_specific || g_sig_state[signo].num_ignore != g_num_shells) g_sig_state[signo].sa.sa_handler = sh_sig_common_handler; else if (g_sig_state[signo].num_ignore) g_sig_state[signo].sa.sa_handler = SIG_IGN; else g_sig_state[signo].sa.sa_handler = SIG_DFL; g_sig_state[signo].sa.sa_flags = psh->sigactions[signo].sh_flags & SA_RESTART; TRACE2((psh, "sh_sigaction: setting signo=%d:%s to {.sa_handler=%p, .sa_flags=%#x}\n", signo, sys_signame[signo], g_sig_state[signo].sa.sa_handler, g_sig_state[signo].sa.sa_flags)); #ifdef _MSC_VER /* Throw SIGBREAK in with SIGINT for now. */ if (signo == SIGINT) signal(SIGBREAK, g_sig_state[signo].sa.sa_handler); if (signal(signo, g_sig_state[signo].sa.sa_handler) == SIG_ERR) { TRACE2((psh, "sh_sigaction: SIG_ERR, errno=%d signo=%d\n", errno, signo)); if ( signo != SIGHUP /* whatever */ && signo != SIGQUIT && signo != SIGPIPE && signo != SIGTTIN && signo != SIGTSTP && signo != SIGTTOU && signo != SIGCONT) kHlpAssert(0); } #else if (sigaction(signo, &g_sig_state[signo].sa, NULL)) kHlpAssert(0); #endif shmtx_leave(&g_sh_mtx, &tmp); } return 0; } shsig_t sh_signal(shinstance *psh, int signo, shsig_t handler) { shsigaction_t sa; shsig_t ret; /* * Implementation using sh_sigaction. */ if (sh_sigaction(psh, signo, NULL, &sa)) return SH_SIG_ERR; ret = sa.sh_handler; sa.sh_flags &= SA_RESTART; sa.sh_handler = handler; sh_sigemptyset(&sa.sh_mask); sh_sigaddset(&sa.sh_mask, signo); /* ?? */ if (sh_sigaction(psh, signo, &sa, NULL)) return SH_SIG_ERR; return ret; } int sh_siginterrupt(shinstance *psh, int signo, int interrupt) { shsigaction_t sa; int oldflags = 0; /* * Implementation using sh_sigaction. */ if (sh_sigaction(psh, signo, NULL, &sa)) return -1; oldflags = sa.sh_flags; if (interrupt) sa.sh_flags &= ~SA_RESTART; else sa.sh_flags |= ~SA_RESTART; if (!((oldflags ^ sa.sh_flags) & SA_RESTART)) return 0; /* unchanged. */ return sh_sigaction(psh, signo, &sa, NULL); } void sh_sigemptyset(shsigset_t *setp) { memset(setp, 0, sizeof(*setp)); } void sh_sigfillset(shsigset_t *setp) { memset(setp, 0xff, sizeof(*setp)); } void sh_sigaddset(shsigset_t *setp, int signo) { #ifdef _MSC_VER *setp |= 1U << signo; #else sigaddset(setp, signo); #endif } void sh_sigdelset(shsigset_t *setp, int signo) { #ifdef _MSC_VER *setp &= ~(1U << signo); #else sigdelset(setp, signo); #endif } int sh_sigismember(shsigset_t const *setp, int signo) { #ifdef _MSC_VER return !!(*setp & (1U << signo)); #else return !!sigismember(setp, signo); #endif } int sh_sigprocmask(shinstance *psh, int operation, shsigset_t const *newp, shsigset_t *oldp) { int rc; if ( operation != SIG_BLOCK && operation != SIG_UNBLOCK && operation != SIG_SETMASK) { errno = EINVAL; return -1; } #if defined(SH_FORKED_MODE) && !defined(_MSC_VER) rc = sigprocmask(operation, newp, oldp); if (!rc && newp) psh->sigmask = *newp; #else if (oldp) *oldp = psh->sigmask; if (newp) { /* calc the new mask */ shsigset_t mask = psh->sigmask; switch (operation) { case SIG_BLOCK: for (rc = 0; rc < NSIG; rc++) if (sh_sigismember(newp, rc)) sh_sigaddset(&mask, rc); break; case SIG_UNBLOCK: for (rc = 0; rc < NSIG; rc++) if (sh_sigismember(newp, rc)) sh_sigdelset(&mask, rc); break; case SIG_SETMASK: mask = *newp; break; } # if defined(_MSC_VER) rc = 0; # else rc = sigprocmask(operation, &mask, NULL); if (!rc) # endif psh->sigmask = mask; } #endif return rc; } SH_NORETURN_1 void sh_abort(shinstance *psh) { shsigset_t set; TRACE2((psh, "sh_abort\n")); /* block other async signals */ sh_sigfillset(&set); sh_sigdelset(&set, SIGABRT); sh_sigprocmask(psh, SIG_SETMASK, &set, NULL); sh_sig_do_signal(psh, psh, SIGABRT, 0 /* no lock */); /** @todo die in a nicer manner. */ *(char *)1 = 3; TRACE2((psh, "sh_abort returns!\n")); (void)psh; abort(); } void sh_raise_sigint(shinstance *psh) { TRACE2((psh, "sh_raise(SIGINT)\n")); sh_sig_do_signal(psh, psh, SIGINT, 0 /* no lock */); TRACE2((psh, "sh_raise(SIGINT) returns\n")); } int sh_kill(shinstance *psh, shpid pid, int signo) { shinstance *pshDst; shmtxtmp tmp; int rc; /* * Self or any of the subshells? */ shmtx_enter(&g_sh_mtx, &tmp); pshDst = g_sh_tail; while (pshDst != NULL) { if (pshDst->pid == pid) { TRACE2((psh, "sh_kill(%" SHPID_PRI ", %d): pshDst=%p\n", pid, signo, pshDst)); sh_sig_do_signal(psh, pshDst, signo, 1 /* locked */); shmtx_leave(&g_sh_mtx, &tmp); return 0; } pshDst = pshDst->prev; } shmtx_leave(&g_sh_mtx, &tmp); /* * Some other process, call kill where possible */ #ifdef _MSC_VER errno = ENOSYS; rc = -1; #elif defined(SH_FORKED_MODE) /* fprintf(stderr, "kill(%d, %d)\n", pid, signo);*/ rc = kill(pid, signo); #else # error "PORT ME?" #endif TRACE2((psh, "sh_kill(%d, %d) -> %d [%d]\n", pid, signo, rc, errno)); return rc; } int sh_killpg(shinstance *psh, shpid pgid, int signo) { shinstance *pshDst; shmtxtmp tmp; int rc; /* * Self or any of the subshells? */ shmtx_enter(&g_sh_mtx, &tmp); pshDst = g_sh_tail; while (pshDst != NULL) { if (pshDst->pgid == pgid) { TRACE2((psh, "sh_killpg(%" SHPID_PRI ", %d): pshDst=%p\n", pgid, signo, pshDst)); sh_sig_do_signal(psh, pshDst, signo, 1 /* locked */); shmtx_leave(&g_sh_mtx, &tmp); return 0; } pshDst = pshDst->prev; } shmtx_leave(&g_sh_mtx, &tmp); #ifdef _MSC_VER errno = ENOSYS; rc = -1; #elif defined(SH_FORKED_MODE) //fprintf(stderr, "killpg(%d, %d)\n", pgid, signo); rc = killpg(pgid, signo); #else # error "PORTME?" #endif TRACE2((psh, "sh_killpg(%" SHPID_PRI ", %d) -> %d [%d]\n", pgid, signo, rc, errno)); (void)psh; return rc; } clock_t sh_times(shinstance *psh, shtms *tmsp) { #ifdef _MSC_VER errno = ENOSYS; return (clock_t)-1; #elif defined(SH_FORKED_MODE) (void)psh; return times(tmsp); #else # error "PORTME" #endif } int sh_sysconf_clk_tck(void) { #ifdef _MSC_VER return CLK_TCK; #else return sysconf(_SC_CLK_TCK); #endif } #ifndef SH_FORKED_MODE /** * Retains a reference to a subshell status structure. */ static unsigned shsubshellstatus_retain(shsubshellstatus *sts) { unsigned refs = sh_atomic_dec(&sts->refs); kHlpAssert(refs > 1); kHlpAssert(refs < 16); return refs; } /** * Releases a reference to a subshell status structure. */ static unsigned shsubshellstatus_release(shinstance *psh, shsubshellstatus *sts) { unsigned refs = sh_atomic_dec(&sts->refs); kHlpAssert(refs < ~(unsigned)0/4); if (refs == 0) { shmtxtmp tmp; shmtx_enter(&g_sh_sts_mtx, &tmp); sts->next = g_sh_sts_free; g_sh_sts_free = sts; shmtx_leave(&g_sh_sts_mtx, &tmp); } return refs; } /** * Creates a subshell status structure. */ static shsubshellstatus *shsubshellstatus_create(shinstance *psh, int refs) { shsubshellstatus *sts; /* Check the free list: */ if (g_sh_sts_free) { shmtxtmp tmp; shmtx_enter(&g_sh_sts_mtx, &tmp); sts = g_sh_sts_free; if (sts) g_sh_sts_free = sts->next; shmtx_leave(&g_sh_sts_mtx, &tmp); } else sts = NULL; if (sts) { # if K_OS == K_OS_WINDOWS BOOL rc = ResetEvent((HANDLE)sts->towaiton); kHlpAssert(rc); K_NOREF(rc); # endif } else { /* Create a new one: */ sts = (shsubshellstatus *)sh_malloc(psh, sizeof(*sts)); if (!sts) return NULL; # if K_OS == K_OS_WINDOWS sts->towaiton = (void *)CreateEventW(NULL /*noinherit*/, TRUE /*fManualReset*/, FALSE /*fInitialState*/, NULL /*pszName*/); if (!sts->towaiton) { kHlpAssert(0); sh_free(psh, sts); return NULL; } # endif } /* Initialize it: */ sts->refs = refs; sts->status = 999999; sts->done = 0; sts->next = NULL; # if K_OS == K_OS_WINDOWS sts->hThread = 0; # endif return sts; } /** * If we have a subshell status structure, signal and release it. */ static void shsubshellstatus_signal_and_release(shinstance *psh, int iExit) { shsubshellstatus *sts = psh->subshellstatus; if (sts) { BOOL rc; HANDLE hThread; sts->status = W_EXITCODE(iExit, 0); sts->done = K_TRUE; rc = SetEvent((HANDLE)sts->towaiton); kHlpAssert(rc); K_NOREF(rc); hThread = (HANDLE)sts->hThread; sts->hThread = 0; rc = CloseHandle(hThread); kHlpAssert(rc); shsubshellstatus_release(psh, sts); psh->subshellstatus = NULL; } } #endif /* !SH_FORKED_MODE */ /** * Adds a child to the shell * * @returns 0 on success, on failure -1 and errno set to ENOMEM. * * @param psh The shell instance. * @param pid The child pid. * @param hChild Windows child wait handle (process if sts is NULL). * @param sts Subshell status structure, NULL if progress. */ int sh_add_child(shinstance *psh, shpid pid, void *hChild, struct shsubshellstatus *sts) { /* get a free table entry. */ unsigned i = psh->num_children++; if (!(i % 32)) { void *ptr = sh_realloc(psh, psh->children, sizeof(*psh->children) * (i + 32)); if (!ptr) { psh->num_children--; errno = ENOMEM; return -1; } psh->children = ptr; } /* add it */ psh->children[i].pid = pid; #if K_OS == K_OS_WINDOWS psh->children[i].hChild = hChild; #endif #ifndef SH_FORKED_MODE psh->children[i].subshellstatus = sts; #endif (void)hChild; (void)sts; return 0; } #ifdef SH_FORKED_MODE pid_t sh_fork(shinstance *psh) { pid_t pid; TRACE2((psh, "sh_fork\n")); #if K_OS == K_OS_WINDOWS //&& defined(SH_FORKED_MODE) pid = shfork_do(psh); #elif defined(SH_FORKED_MODE) # ifdef _MSC_VER pid = -1; errno = ENOSYS; # else pid = fork(); # endif #else #endif /* child: update the pid and zap the children array */ if (!pid) { # ifdef _MSC_VER psh->pid = _getpid(); # else psh->pid = getpid(); # endif psh->num_children = 0; } TRACE2((psh, "sh_fork -> %d [%d]\n", pid, errno)); (void)psh; return pid; } #else /* !SH_FORKED_MODE */ # ifdef _MSC_VER /** Thread wrapper procedure. */ static unsigned __stdcall sh_thread_wrapper(void *user) { shinstance * volatile volpsh = (shinstance *)user; shinstance *psh = (shinstance *)user; struct jmploc exitjmp; int iExit; /* Update the TID and PID (racing sh_thread_start) */ DWORD tid = GetCurrentThreadId(); shpid pid = GetCurrentProcessId(); pid = SHPID_MAKE(pid, tid); psh->pid = pid; psh->tid = tid; /* Set the TLS entry before we try TRACE or TRACE2. */ shthread_set_shell(psh); TRACE2((psh, "sh_thread_wrapper: enter\n")); if ((iExit = setjmp(exitjmp.loc)) == 0) { psh->exitjmp = &exitjmp; iExit = psh->thread(psh, psh->threadarg); TRACE2((psh, "sh_thread_wrapper: thread proc returns %d (%#x)\n", iExit, iExit)); } else { psh = volpsh; /* paranoia */ psh->exitjmp = NULL; TRACE2((psh, "sh_thread_wrapper: longjmp: iExit=%d (%#x)\n", iExit, iExit)); if (iExit == SH_EXIT_ZERO) iExit = 0; } /* Signal parent. */ shsubshellstatus_signal_and_release(psh, iExit); /* destroy the shell instance and exit the thread. */ TRACE2((psh, "sh_thread_wrapper: quits - iExit=%d\n", iExit)); sh_destroy(psh); shthread_set_shell(NULL); _endthreadex(iExit); return iExit; } # else # error "PORTME" # endif /** * Starts a sub-shell thread. */ shpid sh_thread_start(shinstance *pshparent, shinstance *pshchild, int (*thread)(shinstance *, void *), void *arg) { # ifdef _MSC_VER shpid pid; shsubshellstatus *sts = shsubshellstatus_create(pshparent, 2); pshchild->subshellstatus = sts; if (sts) { unsigned tid = 0; uintptr_t hThread; pshchild->thread = thread; pshchild->threadarg = arg; hThread = _beginthreadex(NULL /*security*/, 0 /*stack_size*/, sh_thread_wrapper, pshchild, 0 /*initflags*/, &tid); sts->hThread = hThread; if (hThread != -1) { pid = SHPID_MAKE(SHPID_GET_PID(pshparent->pid), tid); pshchild->pid = pid; pshchild->tid = tid; if (sh_add_child(pshparent, pid, sts->towaiton, sts) == 0) { return pid; } shsubshellstatus_retain(sts); pid = -ENOMEM; } else pid = -errno; shsubshellstatus_release(pshparent, sts); shsubshellstatus_release(pshparent, sts); } else pid = -ENOMEM; return pid; # else # error "PORTME" # endif } #endif /* !SH_FORKED_MODE */ /** waitpid() */ shpid sh_waitpid(shinstance *psh, shpid pid, int *statusp, int flags) { shpid pidret; #if K_OS == K_OS_WINDOWS //&& defined(SH_FORKED_MODE) DWORD dwRet; HANDLE hChild = INVALID_HANDLE_VALUE; unsigned i; *statusp = 0; pidret = -1; if (pid != -1) { /* * A specific child, try look it up in the child process table * and wait for it. */ for (i = 0; i < psh->num_children; i++) if (psh->children[i].pid == pid) break; if (i < psh->num_children) { dwRet = WaitForSingleObject(psh->children[i].hChild, flags & WNOHANG ? 0 : INFINITE); if (dwRet == WAIT_OBJECT_0) hChild = psh->children[i].hChild; else if (dwRet == WAIT_TIMEOUT) { i = ~0; /* don't try close anything */ pidret = 0; } else errno = ECHILD; } else errno = ECHILD; } else if (psh->num_children <= MAXIMUM_WAIT_OBJECTS) { HANDLE ahChildren[MAXIMUM_WAIT_OBJECTS]; for (i = 0; i < psh->num_children; i++) ahChildren[i] = psh->children[i].hChild; dwRet = WaitForMultipleObjects(psh->num_children, &ahChildren[0], FALSE, flags & WNOHANG ? 0 : INFINITE); i = dwRet - WAIT_OBJECT_0; if (i < psh->num_children) { hChild = psh->children[i].hChild; } else if (dwRet == WAIT_TIMEOUT) { i = ~0; /* don't try close anything */ pidret = 0; } else { i = ~0; /* don't try close anything */ errno = EINVAL; } } else { fprintf(stderr, "panic! too many children!\n"); i = ~0; *(char *)1 = '\0'; /** @todo implement this! */ } /* * Close the handle, and if we succeeded collect the exit code first. */ if (i < psh->num_children) { BOOL rc; if (hChild != INVALID_HANDLE_VALUE) { DWORD dwExitCode = 127; # ifndef SH_FORKED_MODE if (psh->children[i].subshellstatus) { rc = psh->children[i].subshellstatus->done; kHlpAssert(rc); if (rc) { *statusp = psh->children[i].subshellstatus->status; pidret = psh->children[i].pid; } } else # endif if (GetExitCodeProcess(hChild, &dwExitCode)) { pidret = psh->children[i].pid; if (dwExitCode && !W_EXITCODE(dwExitCode, 0)) dwExitCode |= 16; *statusp = W_EXITCODE(dwExitCode, 0); } else errno = EINVAL; } /* close and remove */ # ifndef SH_FORKED_MODE if (psh->children[i].subshellstatus) { shsubshellstatus_release(psh, psh->children[i].subshellstatus); psh->children[i].subshellstatus = NULL; } else # endif { rc = CloseHandle(psh->children[i].hChild); kHlpAssert(rc); } psh->num_children--; if (i < psh->num_children) psh->children[i] = psh->children[psh->num_children]; psh->children[psh->num_children].hChild = NULL; # ifndef SH_FORKED_MODE psh->children[psh->num_children].subshellstatus = NULL; # endif } #elif defined(SH_FORKED_MODE) *statusp = 0; # ifdef _MSC_VER pidret = -1; errno = ENOSYS; # else pidret = waitpid(pid, statusp, flags); # endif #else #endif TRACE2((psh, "waitpid(%" SHPID_PRI ", %p, %#x) -> %" SHPID_PRI " [%d] *statusp=%#x (rc=%d)\n", pid, statusp, flags, pidret, errno, *statusp, WEXITSTATUS(*statusp))); (void)psh; return pidret; } SH_NORETURN_1 void sh__exit(shinstance *psh, int iExit) { TRACE2((psh, "sh__exit(%d)\n", iExit)); #if defined(SH_FORKED_MODE) _exit(iExit); (void)psh; #else psh->exitstatus = iExit; /* * If we're a thread, jump to the sh_thread_wrapper and make a clean exit. */ if (psh->thread) { shsubshellstatus_signal_and_release(psh, iExit); if (psh->exitjmp) longjmp(psh->exitjmp->loc, !iExit ? SH_EXIT_ZERO : iExit); else { static char const s_msg[] = "fatal error in sh__exit: exitjmp is NULL!\n"; shfile_write(&psh->fdtab, 2, s_msg, sizeof(s_msg) - 1); _exit(iExit); } } /* * The main thread will typically have to stick around till all subshell * threads have been stopped. We must tear down this shell instance as * much as possible before doing this, though, as subshells could be * waiting for pipes and such to be closed before they're willing to exit. */ if (g_num_shells > 1) { TRACE2((psh, "sh__exit: %u shells around, must wait...\n", g_num_shells)); shfile_uninit(&psh->fdtab, psh->tracefd); sh_int_unlink(psh); /** @todo */ } _exit(iExit); #endif } int sh_execve(shinstance *psh, const char *exe, const char * const *argv, const char * const *envp) { int rc; g_stat_execs++; #ifdef DEBUG /* log it all */ TRACE2((psh, "sh_execve(%p:{%s}, %p, %p}\n", exe, exe, argv, envp)); for (rc = 0; argv[rc]; rc++) TRACE2((psh, " argv[%d]=%p:{%s}\n", rc, argv[rc], argv[rc])); #endif if (!envp) envp = (const char * const *)sh_environ(psh); #if defined(SH_FORKED_MODE) && K_OS != K_OS_WINDOWS # ifdef _MSC_VER errno = 0; { intptr_t rc2 = _spawnve(_P_WAIT, exe, (char **)argv, (char **)envp); if (rc2 != -1) { TRACE2((psh, "sh_execve: child exited, rc=%d. (errno=%d)\n", rc, errno)); rc = (int)rc2; if (!rc && rc2) rc = 16; exit(rc); } } rc = -1; # else rc = shfile_exec_unix(&psh->fdtab); if (!rc) rc = execve(exe, (char **)argv, (char **)envp); # endif #else # if K_OS == K_OS_WINDOWS { /* * This ain't quite straight forward on Windows... */ PROCESS_INFORMATION ProcInfo; STARTUPINFO StrtInfo; shfdexecwin fdinfo; char *cwd = shfile_getcwd(&psh->fdtab, NULL, 0); char *cmdline; size_t cmdline_size; char *envblock; size_t env_size; char *p; int i; /* Create the environment block. */ if (!envp) envp = sh_environ(psh); env_size = 2; for (i = 0; envp[i]; i++) env_size += strlen(envp[i]) + 1; envblock = p = sh_malloc(psh, env_size); for (i = 0; envp[i]; i++) { size_t len = strlen(envp[i]) + 1; memcpy(p, envp[i], len); p += len; } *p = '\0'; /* Figure the size of the command line. Double quotes makes this tedious and we overestimate to simplify. */ cmdline_size = 2; for (i = 0; argv[i]; i++) { const char *arg = argv[i]; cmdline_size += strlen(arg) + 3; arg = strchr(arg, '"'); if (arg) { do cmdline_size++; while ((arg = strchr(arg + 1, '"')) != NULL); arg = argv[i] - 1; while ((arg = strchr(arg + 1, '\\')) != NULL); cmdline_size++; } } /* Create the command line. */ cmdline = p = sh_malloc(psh, cmdline_size); for (i = 0; argv[i]; i++) { const char *arg = argv[i]; const char *cur = arg; size_t len = strlen(arg); int quoted = 0; char ch; while ((ch = *cur++) != '\0') if (ch <= 0x20 || strchr("&><|%", ch) != NULL) { quoted = 1; break; } if (i != 0) *(p++) = ' '; if (quoted) *(p++) = '"'; if (memchr(arg, '"', len) == NULL) { memcpy(p, arg, len); p += len; } else { /* MS CRT style: double quotes must be escaped; backslashes must be escaped if followed by double quotes. */ while ((ch = *arg++) != '\0') if (ch != '\\' && ch != '"') *p++ = ch; else if (ch == '"') { *p++ = '\\'; *p++ = '"'; } else { unsigned slashes = 1; *p++ = '\\'; while (*arg == '\\') { *p++ = '\\'; slashes++; arg++; } if (*arg == '"') { while (slashes-- > 0) *p++ = '\\'; *p++ = '\\'; *p++ = '"'; arg++; } } } if (quoted) *(p++) = '"'; } p[0] = p[1] = '\0'; /* Init the info structure */ memset(&StrtInfo, '\0', sizeof(StrtInfo)); StrtInfo.cb = sizeof(StrtInfo); /* File handles. */ fdinfo.strtinfo = &StrtInfo; shfile_exec_win(&psh->fdtab, 1 /* prepare */, &fdinfo); TRACE2((psh, "sh_execve: inherithandles=%d replacehandles={%d,%d,%d} handles={%p,%p,%p} suspended=%d Reserved2=%p LB %#x\n", fdinfo.inherithandles, fdinfo.replacehandles[0], fdinfo.replacehandles[1], fdinfo.replacehandles[2], fdinfo.handles[0], fdinfo.handles[1], fdinfo.handles[3], fdinfo.startsuspended, StrtInfo.lpReserved2, StrtInfo.cbReserved2)); if (!fdinfo.inherithandles) { StrtInfo.dwFlags |= STARTF_USESTDHANDLES; StrtInfo.hStdInput = INVALID_HANDLE_VALUE; StrtInfo.hStdOutput = INVALID_HANDLE_VALUE; StrtInfo.hStdError = INVALID_HANDLE_VALUE; } else { StrtInfo.dwFlags |= STARTF_USESTDHANDLES; StrtInfo.hStdInput = (HANDLE)fdinfo.handles[0]; StrtInfo.hStdOutput = (HANDLE)fdinfo.handles[1]; StrtInfo.hStdError = (HANDLE)fdinfo.handles[2]; g_stat_execs_serialized++; } /* Get going... */ rc = CreateProcessA(exe, cmdline, NULL, /* pProcessAttributes */ NULL, /* pThreadAttributes */ fdinfo.inherithandles, fdinfo.startsuspended ? CREATE_SUSPENDED : 0, envblock, cwd, &StrtInfo, &ProcInfo); if (rc) { DWORD dwErr; DWORD dwExitCode; if (fdinfo.startsuspended) { char errmsg[512]; if (!fdinfo.inherithandles) rc = nt_child_inject_standard_handles(ProcInfo.hProcess, fdinfo.replacehandles, (HANDLE *)&fdinfo.handles[0], errmsg, sizeof(errmsg)); else rc = 0; if (!rc) { # ifdef KASH_ASYNC_CLOSE_HANDLE shfile_async_close_sync(); # endif rc = ResumeThread(ProcInfo.hThread); if (!rc) TRACE2((psh, "sh_execve: ResumeThread failed: %u -> errno=ENXIO\n", GetLastError())); } else { TRACE2((psh, "sh_execve: nt_child_inject_standard_handles failed: %d -> errno=ENXIO; %s\n", rc, errmsg)); rc = FALSE; } errno = ENXIO; } shfile_exec_win(&psh->fdtab, rc ? 0 /* done */ : -1 /* done but failed */, &fdinfo); CloseHandle(ProcInfo.hThread); ProcInfo.hThread = INVALID_HANDLE_VALUE; if (rc) { /* * Wait for it and forward the exit code. */ dwErr = WaitForSingleObject(ProcInfo.hProcess, INFINITE); kHlpAssert(dwErr == WAIT_OBJECT_0); if (GetExitCodeProcess(ProcInfo.hProcess, &dwExitCode)) { # ifndef SH_FORKED_MODE shsubshellstatus_signal_and_release(psh, (int)dwExitCode); # endif CloseHandle(ProcInfo.hProcess); ProcInfo.hProcess = INVALID_HANDLE_VALUE; sh__exit(psh, dwExitCode); } /* this shouldn't happen... */ TRACE2((psh, "sh_execve: GetExitCodeProcess failed: %u\n", GetLastError())); kHlpAssert(0); errno = EINVAL; } TerminateProcess(ProcInfo.hProcess, 0x40000015); CloseHandle(ProcInfo.hProcess); } else { DWORD dwErr = GetLastError(); shfile_exec_win(&psh->fdtab, -1 /* done but failed */, &fdinfo); switch (dwErr) { case ERROR_FILE_NOT_FOUND: errno = ENOENT; break; case ERROR_PATH_NOT_FOUND: errno = ENOENT; break; case ERROR_BAD_EXE_FORMAT: errno = ENOEXEC; break; case ERROR_INVALID_EXE_SIGNATURE: errno = ENOEXEC; break; default: errno = EINVAL; break; } TRACE2((psh, "sh_execve: dwErr=%d -> errno=%d\n", dwErr, errno)); } } rc = -1; # else errno = ENOSYS; rc = -1; # endif #endif TRACE2((psh, "sh_execve -> %d [%d]\n", rc, errno)); (void)psh; return (int)rc; } uid_t sh_getuid(shinstance *psh) { #ifdef _MSC_VER uid_t uid = 0; #else uid_t uid = getuid(); #endif TRACE2((psh, "sh_getuid() -> %d [%d]\n", uid, errno)); (void)psh; return uid; } uid_t sh_geteuid(shinstance *psh) { #ifdef _MSC_VER uid_t euid = 0; #else uid_t euid = geteuid(); #endif TRACE2((psh, "sh_geteuid() -> %d [%d]\n", euid, errno)); (void)psh; return euid; } gid_t sh_getgid(shinstance *psh) { #ifdef _MSC_VER gid_t gid = 0; #else gid_t gid = getgid(); #endif TRACE2((psh, "sh_getgid() -> %d [%d]\n", gid, errno)); (void)psh; return gid; } gid_t sh_getegid(shinstance *psh) { #ifdef _MSC_VER gid_t egid = 0; #else gid_t egid = getegid(); #endif TRACE2((psh, "sh_getegid() -> %d [%d]\n", egid, errno)); (void)psh; return egid; } shpid sh_getpid(shinstance *psh) { return psh->pid; } shpid sh_getpgrp(shinstance *psh) { shpid pgid = psh->pgid; #ifndef _MSC_VER kHlpAssert(pgid == getpgrp()); #endif TRACE2((psh, "sh_getpgrp() -> %" SHPID_PRI " [%d]\n", pgid, errno)); return pgid; } /** * @param pid Should always be zero, i.e. referring to the current shell * process. */ shpid sh_getpgid(shinstance *psh, shpid pid) { shpid pgid; if (pid == 0 || psh->pid == pid) { pgid = psh->pgid; #ifndef _MSC_VER kHlpAssert(pgid == getpgrp()); #endif } else { kHlpAssert(0); errno = ESRCH; pgid = -1; } TRACE2((psh, "sh_getpgid(%" SHPID_PRI ") -> %" SHPID_PRI " [%d]\n", pid, pgid, errno)); return pgid; } /** * * @param pid The pid to modify. This is always 0, except when forkparent * calls to group a newly created child. Though, we might * almost safely ignore it in that case as the child will also * perform the operation. * @param pgid The process group to assign @a pid to. */ int sh_setpgid(shinstance *psh, shpid pid, shpid pgid) { #if defined(SH_FORKED_MODE) && !defined(_MSC_VER) int rc = setpgid(pid, pgid); TRACE2((psh, "sh_setpgid(%" SHPID_PRI ", %" SHPID_PRI ") -> %d [%d]\n", pid, pgid, rc, errno)); (void)psh; #else int rc = 0; if (pid == 0 || psh->pid == pid) { TRACE2((psh, "sh_setpgid(self,): %" SHPID_PRI " -> %" SHPID_PRI "\n", psh->pgid, pgid)); psh->pgid = pgid; } else { /** @todo fixme */ rc = -1; errno = ENOSYS; } #endif return rc; } shpid sh_tcgetpgrp(shinstance *psh, int fd) { shpid pgrp; #ifdef _MSC_VER pgrp = -1; errno = ENOSYS; #elif defined(SH_FORKED_MODE) pgrp = tcgetpgrp(fd); #else # error "PORT ME" #endif TRACE2((psh, "sh_tcgetpgrp(%d) -> %" SHPID_PRI " [%d]\n", fd, pgrp, errno)); (void)psh; return pgrp; } int sh_tcsetpgrp(shinstance *psh, int fd, shpid pgrp) { int rc; TRACE2((psh, "sh_tcsetpgrp(%d, %" SHPID_PRI ")\n", fd, pgrp)); #ifdef _MSC_VER rc = -1; errno = ENOSYS; #elif defined(SH_FORKED_MODE) rc = tcsetpgrp(fd, pgrp); #else # error "PORT ME" #endif TRACE2((psh, "sh_tcsetpgrp(%d, %" SHPID_PRI ") -> %d [%d]\n", fd, pgrp, rc, errno)); (void)psh; return rc; } int sh_getrlimit(shinstance *psh, int resid, shrlimit *limp) { #ifdef _MSC_VER int rc = -1; errno = ENOSYS; #elif defined(SH_FORKED_MODE) int rc = getrlimit(resid, limp); #else # error "PORT ME" /* returned the stored limit */ #endif TRACE2((psh, "sh_getrlimit(%d, %p) -> %d [%d] {%ld,%ld}\n", resid, limp, rc, errno, (long)limp->rlim_cur, (long)limp->rlim_max)); (void)psh; return rc; } int sh_setrlimit(shinstance *psh, int resid, const shrlimit *limp) { #ifdef _MSC_VER int rc = -1; errno = ENOSYS; #elif defined(SH_FORKED_MODE) int rc = setrlimit(resid, limp); #else # error "PORT ME" /* if max(shell) < limp; then setrlimit; fi if success; then store limit for later retrival and maxing. */ #endif TRACE2((psh, "sh_setrlimit(%d, %p:{%ld,%ld}) -> %d [%d]\n", resid, limp, (long)limp->rlim_cur, (long)limp->rlim_max, rc, errno)); (void)psh; return rc; } /* Wrapper for strerror that makes sure it doesn't return NULL and causes the caller or fprintf routines to crash. */ const char *sh_strerror(shinstance *psh, int error) { char *err = strerror(error); if (!err) return "strerror return NULL!"; (void)psh; return err; } kbuild-3608/src/kash/error.h0000664000175000017500000001165614670377416015755 0ustar locutuslocutus/* $NetBSD: error.h,v 1.16 2003/08/07 09:05:30 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)error.h 8.2 (Berkeley) 5/4/95 */ #ifndef ___error_h #define ___error_h #include "shtypes.h" #include /* * Types of operations (passed to the errmsg routine). */ #define E_OPEN 01 /* opening a file */ #define E_CREAT 02 /* creating a file */ #define E_EXEC 04 /* executing a program */ /* * We enclose jmp_buf in a structure so that we can declare pointers to * jump locations. The global variable handler contains the location to * jump to when an exception occurs, and the global variable exception * contains a code identifying the exeception. To implement nested * exception handlers, the user should save the value of handler on entry * to an inner scope, set handler to point to a jmploc structure for the * inner scope, and restore handler on exit from the scope. */ #ifndef __HAIKU__ # include #else # include /** @todo silly */ #endif struct jmploc { jmp_buf loc; }; /* extern struct jmploc *handler; extern int exception; extern int exerrno;*/ /* error for EXEXEC */ /* exceptions */ #define EXINT 0 /* SIGINT received */ #define EXERROR 1 /* a generic error */ #define EXSHELLPROC 2 /* execute a shell procedure */ #define EXEXEC 3 /* command execution failed */ /* * These macros allow the user to suspend the handling of interrupt signals * over a period of time. This is similar to SIGHOLD to or sigblock, but * much more efficient and portable. (But hacking the kernel is so much * more fun than worrying about efficiency and portability. :-)) */ /*extern volatile int suppressint; extern volatile int intpending;*/ #define INTOFF psh->suppressint++ #define INTON { if (--psh->suppressint == 0 && psh->intpending) onint(psh); } #define FORCEINTON {psh->suppressint = 0; if (psh->intpending) onint(psh);} #define CLEAR_PENDING_INT psh->intpending = 0 #define int_pending() psh->intpending #if !defined(__GNUC__) && !defined(__attribute__) # define __attribute__(a) #endif SH_NORETURN_1 void exraise(struct shinstance *, int) SH_NORETURN_2; void onint(struct shinstance *); SH_NORETURN_1 void error(struct shinstance *, const char *, ...) SH_NORETURN_2; SH_NORETURN_1 void exerror(struct shinstance *, int, const char *, ...) SH_NORETURN_2; const char *errmsg(struct shinstance *, int, int); SH_NORETURN_1 void sh_err(struct shinstance *, int, const char *, ...) SH_NORETURN_2; SH_NORETURN_1 void sh_verr(struct shinstance *, int, const char *, va_list) SH_NORETURN_2; SH_NORETURN_1 void sh_errx(struct shinstance *, int, const char *, ...) SH_NORETURN_2; SH_NORETURN_1 void sh_verrx(struct shinstance *, int, const char *, va_list) SH_NORETURN_2; void sh_warn(struct shinstance *, const char *, ...); void sh_vwarn(struct shinstance *, const char *, va_list); void sh_warnx(struct shinstance *, const char *, ...); void sh_vwarnx(struct shinstance *, const char *, va_list); SH_NORETURN_1 void sh_exit(struct shinstance *, int) SH_NORETURN_2; /* * BSD setjmp saves the signal mask, which violates ANSI C and takes time, * so we use _setjmp instead. */ #if defined(BSD) && !defined(__SVR4) && !defined(__GLIBC__) \ && !defined(__KLIBC__) && !defined(_MSC_VER) && !defined(__HAIKU__) #define setjmp(jmploc) _setjmp(jmploc) #define longjmp(jmploc, val) _longjmp(jmploc, val) #endif #endif kbuild-3608/src/kash/builtins.def0000664000175000017500000000606714670377416016764 0ustar locutuslocutus#!/bin/sh - # $NetBSD: builtins.def,v 1.21 2004/07/13 15:05:59 seb Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)builtins.def 8.4 (Berkeley) 5/4/95 # # This file lists all the builtin commands. The first column is the name # of a C routine. # The -j flag specifies that this command is to be excluded from systems # without job control. # The -h flag specifies that this command is to be excluded from systems # based on the SMALL compile-time symbol. # The -s flag specifies that this is a posix 'special builtin' command. # The -u flag specifies that this is a posix 'standard utility'. # The rest of the line specifies the command name or names used to run # the command. bltincmd -u command bgcmd -j -u bg breakcmd -s break -s continue cdcmd -u cd chdir dotcmd -s . echocmd echo evalcmd -s eval execcmd -s exec exitcmd -s exit expcmd exp let exportcmd -s export -s readonly falsecmd -u false histcmd -h -u fc inputrc inputrc fgcmd -j -u fg getoptscmd -u getopts hashcmd hash jobidcmd jobid jobscmd -u jobs localcmd local #ifndef SMALL printfcmd printf #endif pwdcmd -u pwd readcmd -u read returncmd -s return setcmd -s set setvarcmd setvar shiftcmd -s shift timescmd -s times trapcmd -s trap truecmd -s : -u true typecmd type umaskcmd -u umask unaliascmd -u unalias unsetcmd -s unset waitcmd -u wait aliascmd -u alias ulimitcmd ulimit testcmd test [ killcmd -u kill # mandated by posix for 'kill %job' wordexpcmd wordexp #newgrp -u newgrp # optional command in posix #exprcmd expr kbuild-3608/src/kash/arith.y0000664000175000017500000001232614670377416015747 0ustar locutuslocutus%{ /* $NetBSD: arith.y,v 1.17 2003/09/17 17:33:36 jmmv Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)arith.y 8.3 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: arith.y,v 1.17 2003/09/17 17:33:36 jmmv Exp $"); #endif /* not lint */ #endif #include #include "expand.h" #include "shell.h" #include "error.h" #include "output.h" #include "memalloc.h" #include "shinstance.h" shinstance *arith_psh; const char *arith_buf, *arith_startbuf; void yyerror(const char *); #ifdef TESTARITH int main(int , char *[]); int error(char *); #else # undef malloc # define malloc(cb) sh_malloc(NULL, (cb)) # undef realloc # define realloc(pv,cb) sh_realloc(NULL, (pv), (cb)) # undef free # define free(pv) sh_free(NULL, (pv)) #endif %} %token ARITH_NUM ARITH_LPAREN ARITH_RPAREN %left ARITH_OR %left ARITH_AND %left ARITH_BOR %left ARITH_BXOR %left ARITH_BAND %left ARITH_EQ ARITH_NE %left ARITH_LT ARITH_GT ARITH_GE ARITH_LE %left ARITH_LSHIFT ARITH_RSHIFT %left ARITH_ADD ARITH_SUB %left ARITH_MUL ARITH_DIV ARITH_REM %left ARITH_UNARYMINUS ARITH_UNARYPLUS ARITH_NOT ARITH_BNOT %% exp: expr { return ($1); } ; expr: ARITH_LPAREN expr ARITH_RPAREN { $$ = $2; } | expr ARITH_OR expr { $$ = $1 ? $1 : $3 ? $3 : 0; } | expr ARITH_AND expr { $$ = $1 ? ( $3 ? $3 : 0 ) : 0; } | expr ARITH_BOR expr { $$ = $1 | $3; } | expr ARITH_BXOR expr { $$ = $1 ^ $3; } | expr ARITH_BAND expr { $$ = $1 & $3; } | expr ARITH_EQ expr { $$ = $1 == $3; } | expr ARITH_GT expr { $$ = $1 > $3; } | expr ARITH_GE expr { $$ = $1 >= $3; } | expr ARITH_LT expr { $$ = $1 < $3; } | expr ARITH_LE expr { $$ = $1 <= $3; } | expr ARITH_NE expr { $$ = $1 != $3; } | expr ARITH_LSHIFT expr { $$ = $1 << $3; } | expr ARITH_RSHIFT expr { $$ = $1 >> $3; } | expr ARITH_ADD expr { $$ = $1 + $3; } | expr ARITH_SUB expr { $$ = $1 - $3; } | expr ARITH_MUL expr { $$ = $1 * $3; } | expr ARITH_DIV expr { if ($3 == 0) yyerror("division by zero"); $$ = $1 / $3; } | expr ARITH_REM expr { if ($3 == 0) yyerror("division by zero"); $$ = $1 % $3; } | ARITH_NOT expr { $$ = !($2); } | ARITH_BNOT expr { $$ = ~($2); } | ARITH_SUB expr %prec ARITH_UNARYMINUS { $$ = -($2); } | ARITH_ADD expr %prec ARITH_UNARYPLUS { $$ = $2; } | ARITH_NUM ; %% int arith(shinstance *psh, const char *s) { long result; INTOFF; /* todo lock */ arith_psh = psh; arith_buf = arith_startbuf = s; result = yyparse(); arith_lex_reset(); /* reprime lex */ arith_psh = NULL; /* todo unlock */ INTON; return (result); } /* * The exp(1) builtin. */ int expcmd(shinstance *psh, int argc, char **argv) { const char *p; char *concat; char **ap; long i; if (argc > 1) { p = argv[1]; if (argc > 2) { /* * concatenate arguments */ STARTSTACKSTR(psh, concat); ap = argv + 2; for (;;) { while (*p) STPUTC(psh, *p++, concat); if ((p = *ap++) == NULL) break; STPUTC(psh, ' ', concat); } STPUTC(psh, '\0', concat); p = grabstackstr(psh, concat); } } else p = ""; i = arith(psh, p); out1fmt(psh, "%ld\n", i); return (! i); } /*************************/ #ifdef TEST_ARITH #include main(argc, argv) char *argv[]; { printf("%d\n", exp(argv[1])); } error(s) char *s; { fprintf(stderr, "exp: %s\n", s); exit(1); } #endif void yyerror(const char *s) { shinstance *psh = arith_psh; #ifndef YYBISON /* yyerrok references yyerrstatus which is a local variable in yyparse().*/ yyerrok; #endif yyclearin; arith_lex_reset(); /* reprime lex */ /** @todo unlock */ error(psh, "arithmetic expression: %s: \"%s\"", s, arith_startbuf); /* NOTREACHED */ } kbuild-3608/src/kash/parser.c0000664000175000017500000013272514670377415016113 0ustar locutuslocutus/* $NetBSD: parser.c,v 1.59 2005/03/21 20:10:29 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95"; #else __RCSID("$NetBSD: parser.c,v 1.59 2005/03/21 20:10:29 dsl Exp $"); #endif /* not lint */ #endif #define SH_MEMALLOC_NO_STACK #include #include "shell.h" #include "parser.h" #include "nodes.h" #include "expand.h" /* defines rmescapes() */ #include "eval.h" /* defines commandname */ #include "redir.h" /* defines copyfd() */ #include "syntax.h" #include "options.h" #include "input.h" #include "output.h" #include "var.h" #include "error.h" #include "memalloc.h" #include "mystring.h" #include "alias.h" #include "show.h" #ifndef SMALL # include "myhistedit.h" #endif #include "cd.h" #include "shinstance.h" /* * Shell command parser. */ #define EOFMARKLEN 79 /* values returned by readtoken */ #include "token.h" #define OPENBRACE '{' #define CLOSEBRACE '}' struct heredoc { struct heredoc *next; /* next here document in list */ union node *here; /* redirection node */ char *eofmark; /* string indicating end of input */ int striptabs; /* if set, strip leading tabs */ }; //static int noalias = 0; /* when set, don't handle aliases */ //struct heredoc *heredoclist; /* list of here documents to read */ //int parsebackquote; /* nonzero if we are inside backquotes */ //int doprompt; /* if set, prompt the user */ //int needprompt; /* true if interactive and at start of line */ //int lasttoken; /* last token read */ //MKINIT int tokpushback; /* last token pushed back */ //char *wordtext; /* text of last word returned by readtoken */ //MKINIT int checkkwd; /* 1 == check for kwds, 2 == also eat newlines */ //struct nodelist *backquotelist; //union node *redirnode; //struct heredoc *heredoc; //int quoteflag; /* set if (part of) last token was quoted */ //int startlinno; /* line # where last token started */ STATIC union node *list(shinstance *, int); STATIC union node *andor(shinstance *); STATIC union node *pipeline(shinstance *); STATIC union node *command(shinstance *); STATIC union node *simplecmd(shinstance *, union node **, union node *); STATIC union node *makename(shinstance *); STATIC void parsefname(shinstance *); STATIC void parseheredoc(shinstance *); STATIC int peektoken(shinstance *); STATIC int readtoken(shinstance *); STATIC int xxreadtoken(shinstance *); STATIC int readtoken1(shinstance *, int, char const *, char *, int); STATIC int noexpand(shinstance *, char *); SH_NORETURN_1 STATIC void synexpect(shinstance *, int) SH_NORETURN_2; SH_NORETURN_1 STATIC void synerror(shinstance *, const char *) SH_NORETURN_2; STATIC void setprompt(shinstance *, int); /* * Read and parse a command. Returns NEOF on end of file. (NULL is a * valid parse tree indicating a blank line.) */ union node * parsecmd(shinstance *psh, int interact) { union node *ret; int t; #ifdef KASH_SEPARATE_PARSER_ALLOCATOR pstack_block *pst = pstackallocpush(psh); #endif TRACE2((psh, "parsecmd(%d)\n", interact)); psh->tokpushback = 0; psh->doprompt = interact; if (psh->doprompt) setprompt(psh, 1); else setprompt(psh, 0); psh->needprompt = 0; t = readtoken(psh); if (t == TEOF) return NEOF; if (t == TNL) return NULL; psh->tokpushback++; ret = list(psh, 1); #if 0 /*def DEBUG*/ TRACE2((psh, "parsecmd(%d) returns:\n", interact)); showtree(psh, ret); #endif #ifdef KASH_SEPARATE_PARSER_ALLOCATOR pstackmarkdone(pst); #endif return ret; } STATIC union node * list(shinstance *psh, int nlflag) { union node *n1, *n2, *n3; int tok; psh->checkkwd = 2; if (nlflag == 0 && tokendlist[peektoken(psh)]) return NULL; n1 = NULL; for (;;) { n2 = andor(psh); tok = readtoken(psh); if (tok == TBACKGND) { if (n2->type == NCMD || n2->type == NPIPE) { n2->ncmd.backgnd = 1; } else if (n2->type == NREDIR) { n2->type = NBACKGND; } else { n3 = pstallocnode(psh, sizeof (struct nredir)); n3->type = NBACKGND; n3->nredir.n = n2; n3->nredir.redirect = NULL; n2 = n3; } } if (n1 == NULL) { n1 = n2; } else { n3 = pstallocnode(psh, sizeof (struct nbinary)); n3->type = NSEMI; n3->nbinary.ch1 = n1; n3->nbinary.ch2 = n2; n1 = n3; } switch (tok) { case TBACKGND: case TSEMI: tok = readtoken(psh); /* fall through */ case TNL: if (tok == TNL) { parseheredoc(psh); if (nlflag) return n1; } else { psh->tokpushback++; } psh->checkkwd = 2; if (tokendlist[peektoken(psh)]) return n1; break; case TEOF: if (psh->heredoclist) parseheredoc(psh); else pungetc(psh); /* push back EOF on input */ return n1; default: if (nlflag) synexpect(psh, -1); psh->tokpushback++; return n1; } } } STATIC union node * andor(shinstance *psh) { union node *n1, *n2, *n3; int t; n1 = pipeline(psh); for (;;) { if ((t = readtoken(psh)) == TAND) { t = NAND; } else if (t == TOR) { t = NOR; } else { psh->tokpushback++; return n1; } n2 = pipeline(psh); n3 = pstallocnode(psh, sizeof (struct nbinary)); n3->type = t; n3->nbinary.ch1 = n1; n3->nbinary.ch2 = n2; n1 = n3; } } STATIC union node * pipeline(shinstance *psh) { union node *n1, *n2, *pipenode; struct nodelist *lp, *prev; int negate; negate = 0; TRACE((psh, "pipeline: entered\n")); while (readtoken(psh) == TNOT) negate = !negate; psh->tokpushback++; n1 = command(psh); if (readtoken(psh) == TPIPE) { pipenode = pstallocnode(psh, sizeof (struct npipe)); pipenode->type = NPIPE; pipenode->npipe.backgnd = 0; lp = pstalloclist(psh); pipenode->npipe.cmdlist = lp; lp->n = n1; do { prev = lp; lp = pstalloclist(psh); lp->n = command(psh); prev->next = lp; } while (readtoken(psh) == TPIPE); lp->next = NULL; n1 = pipenode; } psh->tokpushback++; if (negate) { n2 = pstallocnode(psh, sizeof (struct nnot)); n2->type = NNOT; n2->nnot.com = n1; return n2; } else return n1; } STATIC union node * command(shinstance *psh) { union node *n1, *n2; union node *ap, **app; union node *cp, **cpp; union node *redir, **rpp; int t, negate = 0; psh->checkkwd = 2; redir = NULL; n1 = NULL; rpp = &redir; /* Check for redirection which may precede command */ while (readtoken(psh) == TREDIR) { *rpp = n2 = psh->redirnode; rpp = &n2->nfile.next; parsefname(psh); } psh->tokpushback++; while (readtoken(psh) == TNOT) { TRACE((psh, "command: TNOT recognized\n")); negate = !negate; } psh->tokpushback++; switch (readtoken(psh)) { case TIF: n1 = pstallocnode(psh, sizeof (struct nif)); n1->type = NIF; n1->nif.test = list(psh, 0); if (readtoken(psh) != TTHEN) synexpect(psh, TTHEN); n1->nif.ifpart = list(psh, 0); n2 = n1; while (readtoken(psh) == TELIF) { n2->nif.elsepart = pstallocnode(psh, sizeof (struct nif)); n2 = n2->nif.elsepart; n2->type = NIF; n2->nif.test = list(psh, 0); if (readtoken(psh) != TTHEN) synexpect(psh, TTHEN); n2->nif.ifpart = list(psh, 0); } if (psh->lasttoken == TELSE) n2->nif.elsepart = list(psh, 0); else { n2->nif.elsepart = NULL; psh->tokpushback++; } if (readtoken(psh) != TFI) synexpect(psh, TFI); psh->checkkwd = 1; break; case TWHILE: case TUNTIL: { int got; n1 = pstallocnode(psh, sizeof (struct nbinary)); n1->type = (psh->lasttoken == TWHILE)? NWHILE : NUNTIL; n1->nbinary.ch1 = list(psh, 0); if ((got=readtoken(psh)) != TDO) { TRACE((psh, "expecting DO got %s %s\n", tokname[got], got == TWORD ? psh->wordtext : "")); synexpect(psh, TDO); } n1->nbinary.ch2 = list(psh, 0); if (readtoken(psh) != TDONE) synexpect(psh, TDONE); psh->checkkwd = 1; break; } case TFOR: if (readtoken(psh) != TWORD || psh->quoteflag || ! goodname(psh->wordtext)) synerror(psh, "Bad for loop variable"); n1 = pstallocnode(psh, sizeof (struct nfor)); n1->type = NFOR; n1->nfor.var = psh->wordtext; if (readtoken(psh) == TWORD && ! psh->quoteflag && equal(psh->wordtext, "in")) { app = ≈ while (readtoken(psh) == TWORD) { n2 = pstallocnode(psh, sizeof (struct narg)); n2->type = NARG; n2->narg.text = psh->wordtext; n2->narg.backquote = psh->backquotelist; *app = n2; app = &n2->narg.next; } *app = NULL; n1->nfor.args = ap; if (psh->lasttoken != TNL && psh->lasttoken != TSEMI) synexpect(psh, -1); } else { static char argvars[5] = {CTLVAR, (char)(unsigned char)(VSNORMAL|VSQUOTE), '@', '=', '\0'}; n2 = pstallocnode(psh, sizeof (struct narg)); n2->type = NARG; n2->narg.text = argvars; n2->narg.backquote = NULL; n2->narg.next = NULL; n1->nfor.args = n2; /* * Newline or semicolon here is optional (but note * that the original Bourne shell only allowed NL). */ if (psh->lasttoken != TNL && psh->lasttoken != TSEMI) psh->tokpushback++; } psh->checkkwd = 2; if ((t = readtoken(psh)) == TDO) t = TDONE; else if (t == TBEGIN) t = TEND; else synexpect(psh, -1); n1->nfor.body = list(psh, 0); if (readtoken(psh) != t) synexpect(psh, t); psh->checkkwd = 1; break; case TCASE: n1 = pstallocnode(psh, sizeof (struct ncase)); n1->type = NCASE; if (readtoken(psh) != TWORD) synexpect(psh, TWORD); n1->ncase.expr = n2 = pstallocnode(psh, sizeof (struct narg)); n2->type = NARG; n2->narg.text = psh->wordtext; n2->narg.backquote = psh->backquotelist; n2->narg.next = NULL; while (readtoken(psh) == TNL); if (psh->lasttoken != TWORD || ! equal(psh->wordtext, "in")) synerror(psh, "expecting \"in\""); cpp = &n1->ncase.cases; psh->noalias = 1; psh->checkkwd = 2, readtoken(psh); do { *cpp = cp = pstallocnode(psh, sizeof (struct nclist)); cp->type = NCLIST; app = &cp->nclist.pattern; for (;;) { *app = ap = pstallocnode(psh, sizeof (struct narg)); ap->type = NARG; ap->narg.text = psh->wordtext; ap->narg.backquote = psh->backquotelist; if (psh->checkkwd = 2, readtoken(psh) != TPIPE) break; app = &ap->narg.next; readtoken(psh); } ap->narg.next = NULL; psh->noalias = 0; if (psh->lasttoken != TRP) { synexpect(psh, TRP); } cp->nclist.body = list(psh, 0); psh->checkkwd = 2; if ((t = readtoken(psh)) != TESAC) { if (t != TENDCASE) { psh->noalias = 0; synexpect(psh, TENDCASE); } else { psh->noalias = 1; psh->checkkwd = 2; readtoken(psh); } } cpp = &cp->nclist.next; } while(psh->lasttoken != TESAC); psh->noalias = 0; *cpp = NULL; psh->checkkwd = 1; break; case TLP: n1 = pstallocnode(psh, sizeof (struct nredir)); n1->type = NSUBSHELL; n1->nredir.n = list(psh, 0); n1->nredir.redirect = NULL; if (readtoken(psh) != TRP) synexpect(psh, TRP); psh->checkkwd = 1; break; case TBEGIN: n1 = list(psh, 0); if (readtoken(psh) != TEND) synexpect(psh, TEND); psh->checkkwd = 1; break; /* Handle an empty command like other simple commands. */ case TSEMI: /* * An empty command before a ; doesn't make much sense, and * should certainly be disallowed in the case of `if ;'. */ if (!redir) synexpect(psh, -1); /* FALLTHROUGH */ case TAND: case TOR: case TNL: case TEOF: case TWORD: case TRP: psh->tokpushback++; n1 = simplecmd(psh, rpp, redir); goto checkneg; default: synexpect(psh, -1); /* NOTREACHED */ } /* Now check for redirection which may follow command */ while (readtoken(psh) == TREDIR) { *rpp = n2 = psh->redirnode; rpp = &n2->nfile.next; parsefname(psh); } psh->tokpushback++; *rpp = NULL; if (redir) { if (n1->type != NSUBSHELL) { n2 = pstallocnode(psh, sizeof (struct nredir)); n2->type = NREDIR; n2->nredir.n = n1; n1 = n2; } n1->nredir.redirect = redir; } checkneg: if (negate) { n2 = pstallocnode(psh, sizeof (struct nnot)); n2->type = NNOT; n2->nnot.com = n1; return n2; } else return n1; } STATIC union node * simplecmd(shinstance *psh, union node **rpp, union node *redir) { union node *args, **app; union node **orig_rpp = rpp; union node *n = NULL, *n2; int negate = 0; /* If we don't have any redirections already, then we must reset */ /* rpp to be the address of the local redir variable. */ if (redir == 0) rpp = &redir; args = NULL; app = &args; /* * We save the incoming value, because we need this for shell * functions. There can not be a redirect or an argument between * the function name and the open parenthesis. */ orig_rpp = rpp; while (readtoken(psh) == TNOT) { TRACE((psh, "command: TNOT recognized\n")); negate = !negate; } psh->tokpushback++; for (;;) { if (readtoken(psh) == TWORD) { n = pstallocnode(psh, sizeof (struct narg)); n->type = NARG; n->narg.text = psh->wordtext; n->narg.backquote = psh->backquotelist; *app = n; app = &n->narg.next; } else if (psh->lasttoken == TREDIR) { *rpp = n = psh->redirnode; rpp = &n->nfile.next; parsefname(psh); /* read name of redirection file */ } else if (psh->lasttoken == TLP && app == &args->narg.next && rpp == orig_rpp) { /* We have a function */ if (readtoken(psh) != TRP) synexpect(psh, TRP); #ifdef notdef if (! goodname(n->narg.text)) synerror(psh, "Bad function name"); #endif n->type = NDEFUN; n->narg.next = command(psh); goto checkneg; } else { psh->tokpushback++; break; } } *app = NULL; *rpp = NULL; n = pstallocnode(psh, sizeof (struct ncmd)); n->type = NCMD; n->ncmd.backgnd = 0; n->ncmd.args = args; n->ncmd.redirect = redir; checkneg: if (negate) { n2 = pstallocnode(psh, sizeof (struct nnot)); n2->type = NNOT; n2->nnot.com = n; return n2; } else return n; } STATIC union node * makename(shinstance *psh) { union node *n; n = pstallocnode(psh, sizeof (struct narg)); n->type = NARG; n->narg.next = NULL; n->narg.text = psh->wordtext; n->narg.backquote = psh->backquotelist; return n; } void fixredir(shinstance *psh, union node *n, const char *text, int err) { TRACE((psh, "Fix redir %s %d\n", text, err)); if (!err) n->ndup.vname = NULL; if (is_digit(text[0]) && text[1] == '\0') n->ndup.dupfd = digit_val(text[0]); else if (text[0] == '-' && text[1] == '\0') n->ndup.dupfd = -1; else { if (err) synerror(psh, "Bad fd number"); else n->ndup.vname = makename(psh); } } STATIC void parsefname(shinstance *psh) { union node *n = psh->redirnode; if (readtoken(psh) != TWORD) synexpect(psh, -1); if (n->type == NHERE) { struct heredoc *here = psh->heredoc; struct heredoc *p; size_t i; if (psh->quoteflag == 0) n->type = NXHERE; TRACE((psh, "Here document %d\n", n->type)); if (here->striptabs) { while (*psh->wordtext == '\t') psh->wordtext++; } if (! noexpand(psh, psh->wordtext) || (i = strlen(psh->wordtext)) == 0 || i > EOFMARKLEN) synerror(psh, "Illegal eof marker for << redirection"); rmescapes(psh, psh->wordtext); here->eofmark = psh->wordtext; here->next = NULL; if (psh->heredoclist == NULL) psh->heredoclist = here; else { for (p = psh->heredoclist ; p->next ; p = p->next); p->next = here; } } else if (n->type == NTOFD || n->type == NFROMFD) { fixredir(psh, n, psh->wordtext, 0); } else { n->nfile.fname = makename(psh); } } /* * Input any here documents. */ STATIC void parseheredoc(shinstance *psh) { struct heredoc *here; union node *n; while (psh->heredoclist) { here = psh->heredoclist; psh->heredoclist = here->next; if (psh->needprompt) { setprompt(psh, 2); psh->needprompt = 0; } readtoken1(psh, pgetc(psh), here->here->type == NHERE? SQSYNTAX : DQSYNTAX, here->eofmark, here->striptabs); n = pstallocnode(psh, sizeof (struct narg)); n->narg.type = NARG; n->narg.next = NULL; n->narg.text = psh->wordtext; n->narg.backquote = psh->backquotelist; here->here->nhere.doc = n; } } STATIC int peektoken(shinstance *psh) { int t; t = readtoken(psh); psh->tokpushback++; return (t); } STATIC int readtoken(shinstance *psh) { int t; int savecheckkwd = psh->checkkwd; #ifdef DEBUG int alreadyseen = psh->tokpushback; #endif struct alias *ap; top: t = xxreadtoken(psh); if (psh->checkkwd) { /* * eat newlines */ if (psh->checkkwd == 2) { psh->checkkwd = 0; while (t == TNL) { parseheredoc(psh); t = xxreadtoken(psh); } } else psh->checkkwd = 0; /* * check for keywords and aliases */ if (t == TWORD && !psh->quoteflag) { const char *const *pp; for (pp = parsekwd; *pp; pp++) { if (**pp == *psh->wordtext && equal(*pp, psh->wordtext)) { psh->lasttoken = t = (int)(pp - parsekwd + KWDOFFSET); TRACE((psh, "keyword %s recognized\n", tokname[t])); goto out; } } if(!psh->noalias && (ap = lookupalias(psh, psh->wordtext, 1)) != NULL) { pushstring(psh, ap->val, strlen(ap->val), ap); psh->checkkwd = savecheckkwd; goto top; } } out: psh->checkkwd = (t == TNOT) ? savecheckkwd : 0; } #ifdef DEBUG if (!alreadyseen) TRACE((psh, "token %s %s\n", tokname[t], t == TWORD ? psh->wordtext : "")); else TRACE((psh, "reread token %s \"%s\"\n", tokname[t], t == TWORD ? psh->wordtext : "")); #endif return (t); } /* * Read the next input token. * If the token is a word, we set psh->backquotelist to the list of cmds in * backquotes. We set psh->quoteflag to true if any part of the word was * quoted. * If the token is TREDIR, then we set psh->redirnode to a structure containing * the redirection. * In all cases, the variable psh->startlinno is set to the number of the line * on which the token starts. * * [Change comment: here documents and internal procedures] * [Readtoken shouldn't have any arguments. Perhaps we should make the * word parsing code into a separate routine. In this case, readtoken * doesn't need to have any internal procedures, but parseword does. * We could also make parseoperator in essence the main routine, and * have parseword (readtoken1?) handle both words and redirection.] */ #define RETURN(token) return psh->lasttoken = token STATIC int xxreadtoken(shinstance *psh) { int c; if (psh->tokpushback) { psh->tokpushback = 0; return psh->lasttoken; } if (psh->needprompt) { setprompt(psh, 2); psh->needprompt = 0; } psh->startlinno = psh->plinno; for (;;) { /* until token or start of word found */ c = pgetc_macro(psh); if (c == ' ' || c == '\t') continue; /* quick check for white space first */ switch (c) { case ' ': case '\t': continue; case '#': while ((c = pgetc(psh)) != '\n' && c != PEOF); pungetc(psh); continue; case '\\': if (pgetc(psh) == '\n') { psh->startlinno = ++psh->plinno; if (psh->doprompt) setprompt(psh, 2); else setprompt(psh, 0); continue; } pungetc(psh); goto breakloop; case '\n': psh->plinno++; psh->needprompt = psh->doprompt; RETURN(TNL); case PEOF: RETURN(TEOF); case '&': if (pgetc(psh) == '&') RETURN(TAND); pungetc(psh); RETURN(TBACKGND); case '|': if (pgetc(psh) == '|') RETURN(TOR); pungetc(psh); RETURN(TPIPE); case ';': if (pgetc(psh) == ';') RETURN(TENDCASE); pungetc(psh); RETURN(TSEMI); case '(': RETURN(TLP); case ')': RETURN(TRP); default: goto breakloop; } } breakloop: return readtoken1(psh, c, BASESYNTAX, (char *)NULL, 0); #undef RETURN } /* * If eofmark is NULL, read a word or a redirection symbol. If eofmark * is not NULL, read a here document. In the latter case, eofmark is the * word which marks the end of the document and striptabs is true if * leading tabs should be stripped from the document. The argument firstc * is the first character of the input token or document. * * Because C does not have internal subroutines, I have simulated them * using goto's to implement the subroutine linkage. The following macros * will run code that appears at the end of readtoken1. */ #define CHECKEND() {goto checkend; checkend_return:;} #define PARSEREDIR() {goto parseredir; parseredir_return:;} #define PARSESUB() {goto parsesub; parsesub_return:;} #define PARSEBACKQOLD() {oldstyle = 1; goto parsebackq; parsebackq_oldreturn:;} #define PARSEBACKQNEW() {oldstyle = 0; goto parsebackq; parsebackq_newreturn:;} #define PARSEARITH() {goto parsearith; parsearith_return:;} /* * Keep track of nested doublequotes in dblquote and doublequotep. * We use dblquote for the first 32 levels, and we expand to a malloc'ed * region for levels above that. Usually we never need to malloc. * This code assumes that an int is 32 bits. We don't use uint32_t, * because the rest of the code does not. */ #define ISDBLQUOTE() ((varnest < 32) ? (dblquote & (1 << varnest)) : \ (dblquotep[(varnest / 32) - 1] & (1 << (varnest % 32)))) #define SETDBLQUOTE() \ if (varnest < 32) \ dblquote |= (1 << varnest); \ else \ dblquotep[(varnest / 32) - 1] |= (1 << (varnest % 32)) #define CLRDBLQUOTE() \ if (varnest < 32) \ dblquote &= ~(1 << varnest); \ else \ dblquotep[(varnest / 32) - 1] &= ~(1 << (varnest % 32)) STATIC int readtoken1(shinstance *psh, int firstc, char const *syntax, char *eofmark, int striptabs) { int c = firstc; char *out; char line[EOFMARKLEN + 1]; struct nodelist *bqlist; int quotef = 0; int *dblquotep = NULL; size_t maxnest = 32; int dblquote; int varnest; /* levels of variables expansion */ int arinest; /* levels of arithmetic expansion */ int parenlevel; /* levels of parens in arithmetic */ int oldstyle; char const *prevsyntax; /* syntax before arithmetic */ psh->startlinno = psh->plinno; dblquote = 0; varnest = 0; if (syntax == DQSYNTAX) { SETDBLQUOTE(); } quotef = 0; bqlist = NULL; arinest = 0; parenlevel = 0; #if __GNUC__ /* Try avoid longjmp clobbering */ (void) &maxnest; (void) &dblquotep; (void) &out; (void) "ef; (void) &dblquote; (void) &varnest; (void) &arinest; (void) &parenlevel; (void) &oldstyle; (void) &prevsyntax; (void) &syntax; #endif PSTARTSTACKSTR(psh, out); loop: { /* for each line, until end of word */ #if ATTY if (c == '\034' && psh->doprompt && attyset() && ! equal(termval(), "emacs")) { attyline(); if (syntax == BASESYNTAX) return readtoken(psh); c = pgetc(psh); goto loop; } #endif CHECKEND(); /* set c to PEOF if at end of here document */ for (;;) { /* until end of line or end of word */ PSTCHECKSTRSPACE(psh, 4+1, out); /* permit 4 calls to PSTUPUTC, pluss terminator */ switch(syntax[c]) { case CNL: /* '\n' */ if (syntax == BASESYNTAX) goto endword; /* exit outer loop */ PSTUPUTC(psh, c, out); psh->plinno++; if (psh->doprompt) setprompt(psh, 2); else setprompt(psh, 0); c = pgetc(psh); goto loop; /* continue outer loop */ case CWORD: PSTUPUTC(psh, c, out); break; case CCTL: if (eofmark == NULL || ISDBLQUOTE()) PSTUPUTC(psh, CTLESC, out); PSTUPUTC(psh, c, out); break; case CBACK: /* backslash */ c = pgetc(psh); if (c == PEOF) { PSTUPUTC(psh, '\\', out); pungetc(psh); break; } if (c == '\n') { if (psh->doprompt) setprompt(psh, 2); else setprompt(psh, 0); break; } quotef = 1; if (ISDBLQUOTE() && c != '\\' && c != '`' && c != '$' && (c != '"' || eofmark != NULL)) PSTUPUTC(psh, '\\', out); if (SQSYNTAX[c] == CCTL) PSTUPUTC(psh, CTLESC, out); else if (eofmark == NULL) { PSTUPUTC(psh, CTLQUOTEMARK, out); PSTUPUTC(psh, c, out); if (varnest != 0) PSTUPUTC(psh, CTLQUOTEEND, out); break; } PSTUPUTC(psh, c, out); break; case CSQUOTE: if (syntax != SQSYNTAX) { if (eofmark == NULL) PSTUPUTC(psh, CTLQUOTEMARK, out); quotef = 1; syntax = SQSYNTAX; break; } if (eofmark != NULL && arinest == 0 && varnest == 0) { /* Ignore inside quoted here document */ PSTUPUTC(psh, c, out); break; } /* End of single quotes... */ if (arinest) syntax = ARISYNTAX; else { syntax = BASESYNTAX; if (varnest != 0) PSTUPUTC(psh, CTLQUOTEEND, out); } break; case CDQUOTE: if (eofmark != NULL && arinest == 0 && varnest == 0) { /* Ignore inside here document */ PSTUPUTC(psh, c, out); break; } quotef = 1; if (arinest) { if (ISDBLQUOTE()) { syntax = ARISYNTAX; CLRDBLQUOTE(); } else { syntax = DQSYNTAX; SETDBLQUOTE(); PSTUPUTC(psh, CTLQUOTEMARK, out); } break; } if (eofmark != NULL) break; if (ISDBLQUOTE()) { if (varnest != 0) PSTUPUTC(psh, CTLQUOTEEND, out); syntax = BASESYNTAX; CLRDBLQUOTE(); } else { syntax = DQSYNTAX; SETDBLQUOTE(); PSTUPUTC(psh, CTLQUOTEMARK, out); } break; case CVAR: /* '$' */ PARSESUB(); /* parse substitution */ break; case CENDVAR: /* CLOSEBRACE */ if (varnest > 0 && !ISDBLQUOTE()) { varnest--; PSTUPUTC(psh, CTLENDVAR, out); } else { PSTUPUTC(psh, c, out); } break; case CLP: /* '(' in arithmetic */ parenlevel++; PSTUPUTC(psh, c, out); break; case CRP: /* ')' in arithmetic */ if (parenlevel > 0) { PSTUPUTC(psh, c, out); --parenlevel; } else { if (pgetc(psh) == ')') { if (--arinest == 0) { PSTUPUTC(psh, CTLENDARI, out); syntax = prevsyntax; if (syntax == DQSYNTAX) SETDBLQUOTE(); else CLRDBLQUOTE(); } else PSTUPUTC(psh, ')', out); } else { /* * unbalanced parens * (don't 2nd guess - no error) */ pungetc(psh); PSTUPUTC(psh, ')', out); } } break; case CBQUOTE: /* '`' */ PARSEBACKQOLD(); break; case CSHEOF: goto endword; /* exit outer loop */ default: if (varnest == 0) goto endword; /* exit outer loop */ PSTUPUTC(psh, c, out); } c = pgetc_macro(psh); } } endword: if (syntax == ARISYNTAX) synerror(psh, "Missing '))'"); if (syntax != BASESYNTAX && ! psh->parsebackquote && eofmark == NULL) synerror(psh, "Unterminated quoted string"); if (varnest != 0) { psh->startlinno = psh->plinno; /* { */ synerror(psh, "Missing '}'"); } PSTUPUTC(psh, '\0', out); if (eofmark == NULL) { size_t len = (size_t)(out - PSTBLOCK(psh)); char *start = PSTBLOCK(psh); if ((c == '>' || c == '<') && quotef == 0 && len <= 2 && (*start == '\0' || is_digit(*start))) { out = start; PARSEREDIR(); return psh->lasttoken = TREDIR; } else { pungetc(psh); } } psh->quoteflag = quotef; psh->backquotelist = bqlist; psh->wordtext = pstgrabstr(psh, out); if (dblquotep != NULL) ckfree(psh, dblquotep); return psh->lasttoken = TWORD; /* end of readtoken routine */ /* * Check to see whether we are at the end of the here document. When this * is called, c is set to the first character of the next input line. If * we are at the end of the here document, this routine sets the c to PEOF. */ checkend: { if (eofmark) { if (striptabs) { while (c == '\t') c = pgetc(psh); } if (c == *eofmark) { if (pfgets(psh, line, sizeof line) != NULL) { char *p, *q; p = line; for (q = eofmark + 1 ; *q && *p == *q ; p++, q++); if (*p == '\n' && *q == '\0') { c = PEOF; psh->plinno++; psh->needprompt = psh->doprompt; } else { pushstring(psh, line, strlen(line), NULL); } } } } goto checkend_return; } /* * Parse a redirection operator. The variable "out" points to a string * specifying the fd to be redirected. The variable "c" contains the * first character of the redirection operator. */ parseredir: { union node *np; char fd = *out; char dummy[ sizeof(struct ndup) >= sizeof(struct nfile) && sizeof(struct ndup) >= sizeof(struct nhere) ? 1 : 0]; (void)dummy; np = pstallocnode(psh, sizeof (struct ndup)); if (c == '>') { np->nfile.fd = 1; c = pgetc(psh); if (c == '>') np->type = NAPPEND; else if (c == '|') np->type = NCLOBBER; else if (c == '&') np->type = NTOFD; else { np->type = NTO; pungetc(psh); } } else { /* c == '<' */ np->nfile.fd = 0; switch (c = pgetc(psh)) { case '<': np->type = NHERE; psh->heredoc = (struct heredoc *)pstalloc(psh, sizeof (struct heredoc)); psh->heredoc->here = np; if ((c = pgetc(psh)) == '-') { psh->heredoc->striptabs = 1; } else { psh->heredoc->striptabs = 0; pungetc(psh); } break; case '&': np->type = NFROMFD; break; case '>': np->type = NFROMTO; break; default: np->type = NFROM; pungetc(psh); break; } } if (fd != '\0') np->nfile.fd = digit_val(fd); psh->redirnode = np; goto parseredir_return; } /* * Parse a substitution. At this point, we have read the dollar sign * and nothing else. */ parsesub: { int subtype; int typeloc; int flags; char *p; static const char types[] = "}-+?="; c = pgetc(psh); if (c != '(' && c != OPENBRACE && !is_name(c) && !is_special(c)) { PSTUPUTC(psh, '$', out); pungetc(psh); } else if (c == '(') { /* $(command) or $((arith)) */ if (pgetc(psh) == '(') { PARSEARITH(); } else { pungetc(psh); PARSEBACKQNEW(); } } else { PSTUPUTC(psh, CTLVAR, out); typeloc = (int)(out - PSTBLOCK(psh)); PSTUPUTC(psh, VSNORMAL, out); subtype = VSNORMAL; if (c == OPENBRACE) { c = pgetc(psh); if (c == '#') { if ((c = pgetc(psh)) == CLOSEBRACE) c = '#'; else subtype = VSLENGTH; } else subtype = 0; } if (is_name(c)) { do { PSTPUTC(psh, c, out); c = pgetc(psh); } while (is_in_name(c)); } else if (is_digit(c)) { do { PSTUPUTC(psh, c, out); c = pgetc(psh); } while (is_digit(c)); } else if (is_special(c)) { PSTUPUTC(psh, c, out); c = pgetc(psh); } else { badsub: synerror(psh, "Bad substitution"); } PSTPUTC(psh, '=', out); flags = 0; if (subtype == 0) { switch (c) { case ':': flags = VSNUL; c = pgetc(psh); /*FALLTHROUGH*/ default: p = strchr(types, c); if (p == NULL) goto badsub; subtype = (int)(p - types + VSNORMAL); break; case '%': case '#': { int cc = c; subtype = c == '#' ? VSTRIMLEFT : VSTRIMRIGHT; c = pgetc(psh); if (c == cc) subtype++; else pungetc(psh); break; } } } else { pungetc(psh); } if (ISDBLQUOTE() || arinest) flags |= VSQUOTE; *(PSTBLOCK(psh) + typeloc) = subtype | flags; if (subtype != VSNORMAL) { varnest++; if (varnest >= (int)maxnest) { dblquotep = ckrealloc(psh, dblquotep, maxnest / 8); dblquotep[(maxnest / 32) - 1] = 0; maxnest += 32; } } } goto parsesub_return; } /* * Called to parse command substitutions. Newstyle is set if the command * is enclosed inside $(...); nlpp is a pointer to the head of the linked * list of commands (passed by reference), and savelen is the number of * characters on the top of the stack which must be preserved. */ parsebackq: { struct nodelist **nlpp; int savepbq; union node *n; char *volatile str; struct jmploc jmploc; struct jmploc *volatile savehandler; int savelen; int saveprompt; #ifdef __GNUC__ (void) &saveprompt; #endif savepbq = psh->parsebackquote; if (setjmp(jmploc.loc)) { if (str) ckfree(psh, str); psh->parsebackquote = 0; psh->handler = savehandler; longjmp(psh->handler->loc, 1); } INTOFF; str = NULL; savelen = (int)(out - PSTBLOCK(psh)); if (savelen > 0) { str = ckmalloc(psh, savelen); memcpy(str, PSTBLOCK(psh), savelen); } savehandler = psh->handler; psh->handler = &jmploc; INTON; if (oldstyle) { /* We must read until the closing backquote, giving special treatment to some slashes, and then push the string and reread it as input, interpreting it normally. */ char *pout; int pc; int psavelen; char *pstr; PSTARTSTACKSTR(psh, pout); for (;;) { if (psh->needprompt) { setprompt(psh, 2); psh->needprompt = 0; } switch (pc = pgetc(psh)) { case '`': goto done; case '\\': if ((pc = pgetc(psh)) == '\n') { psh->plinno++; if (psh->doprompt) setprompt(psh, 2); else setprompt(psh, 0); /* * If eating a newline, avoid putting * the newline into the new character * stream (via the PSTPUTC after the * switch). */ continue; } if (pc != '\\' && pc != '`' && pc != '$' && (!ISDBLQUOTE() || pc != '"')) PSTPUTC(psh, '\\', pout); break; case '\n': psh->plinno++; psh->needprompt = psh->doprompt; break; case PEOF: psh->startlinno = psh->plinno; synerror(psh, "EOF in backquote substitution"); break; default: break; } PSTPUTC(psh, pc, pout); } done: PSTPUTC(psh, '\0', pout); psavelen = (int)(pout - PSTBLOCK(psh)); if (psavelen > 0) { /** @todo nonsensical test? */ pstr = pstgrabstr(psh, pout); setinputstring(psh, pstr, 1 /*push*/); } } nlpp = &bqlist; while (*nlpp) nlpp = &(*nlpp)->next; *nlpp = pstalloclist(psh); (*nlpp)->next = NULL; psh->parsebackquote = oldstyle; if (oldstyle) { saveprompt = psh->doprompt; psh->doprompt = 0; } n = list(psh, 0); if (oldstyle) psh->doprompt = saveprompt; else { if (readtoken(psh) != TRP) synexpect(psh, TRP); } (*nlpp)->n = n; if (oldstyle) { /* * Start reading from old file again, ignoring any pushed back * tokens left from the backquote parsing */ popfile(psh); psh->tokpushback = 0; } PSTARTSTACKSTR(psh, out); if (str) { PSTPUTSTRN(psh, str, savelen, out); INTOFF; ckfree(psh, str); str = NULL; INTON; } psh->parsebackquote = savepbq; psh->handler = savehandler; if (arinest || ISDBLQUOTE()) PSTUPUTC(psh, CTLBACKQ | CTLQUOTE, out); else PSTUPUTC(psh, CTLBACKQ, out); if (oldstyle) goto parsebackq_oldreturn; else goto parsebackq_newreturn; } /* * Parse an arithmetic expansion (indicate start of one and set state) */ parsearith: { if (++arinest == 1) { prevsyntax = syntax; syntax = ARISYNTAX; PSTUPUTC(psh, CTLARI, out); if (ISDBLQUOTE()) PSTUPUTC(psh, '"',out); else PSTUPUTC(psh, ' ',out); } else { /* * we collapse embedded arithmetic expansion to * parenthesis, which should be equivalent */ PSTUPUTC(psh, '(', out); } goto parsearith_return; } } /* end of readtoken */ #ifdef mkinit RESET { psh->tokpushback = 0; psh->checkkwd = 0; } #endif /* * Returns true if the text contains nothing to expand (no dollar signs * or backquotes). */ STATIC int noexpand(shinstance *psh, char *text) { char *p; char c; p = text; while ((c = *p++) != '\0') { if (c == CTLQUOTEMARK) continue; if (c == CTLESC) p++; else if (BASESYNTAX[(int)c] == CCTL) return 0; } return 1; } /* * Return true if the argument is a legal variable name (a letter or * underscore followed by zero or more letters, underscores, and digits). */ int goodname(const char *name) { const char *p; p = name; if (! is_name(*p)) return 0; while (*++p) { if (! is_in_name(*p)) return 0; } return 1; } /* * Called when an unexpected token is read during the parse. The argument * is the token that is expected, or -1 if more than one type of token can * occur at this point. */ SH_NORETURN_1 STATIC void synexpect(shinstance *psh, int token) { char msg[64]; if (token >= 0) { fmtstr(msg, 64, "%s unexpected (expecting %s)", tokname[psh->lasttoken], tokname[token]); } else { fmtstr(msg, 64, "%s unexpected", tokname[psh->lasttoken]); } synerror(psh, msg); /* NOTREACHED */ } SH_NORETURN_1 STATIC void synerror(shinstance *psh, const char *msg) { if (psh->commandname) { TRACE((psh, "synerror: %s: %d: Syntax error: %s", psh->commandname, psh->startlinno, msg)); outfmt(&psh->errout, "%s: %d: ", psh->commandname, psh->startlinno); } else { TRACE((psh, "synerror: Syntax error: %s\n", msg)); } outfmt(&psh->errout, "Syntax error: %s\n", msg); error(psh, (char *)NULL); /* NOTREACHED */ } STATIC const char * my_basename(const char *argv0, unsigned *lenp) { const char *tmp; /* skip the path */ for (tmp = strpbrk(argv0, "\\/:"); tmp; tmp = strpbrk(argv0, "\\/:")) argv0 = tmp + 1; if (lenp) { /* find the end, ignoring extenions */ tmp = strrchr(argv0, '.'); if (!tmp) tmp = strchr(argv0, '\0'); *lenp = (unsigned)(tmp - argv0); } return argv0; } STATIC void setprompt(shinstance *psh, int which) { psh->whichprompt = which; #ifndef SMALL if (!el) #endif { /* deal with bash prompts */ const char *prompt = getprompt(psh, NULL); if (!strchr(prompt, '\\')) { out2str(psh, prompt); } else { while (*prompt) { if (*prompt != '\\') { out2c(psh, *prompt++); } else { prompt++; switch (*prompt++) { /* simple */ case '$': out2c(psh, sh_geteuid(psh) ? '$' : '#'); break; case '\\': out2c(psh, '\\'); break; case 'a': out2c(psh, '\a'); break; case 'e': out2c(psh, 033); break; case 'n': out2c(psh, '\n'); break; case 'r': out2c(psh, '\r'); break; /* complicated */ case 's': { unsigned len; const char *arg0 = my_basename(psh->arg0, &len); outfmt(psh->out2, "%.*s", len, arg0); break; } case 'v': outfmt(psh->out2, "%d.%d", KBUILD_VERSION_MAJOR, KBUILD_VERSION_MINOR); break; case 'V': outfmt(psh->out2, "%d.%d.%d", KBUILD_VERSION_MAJOR, KBUILD_VERSION_MINOR, KBUILD_VERSION_PATCH); break; out2str(psh, getpwd(psh, 1) ? getpwd(psh, 1) : "?"); break; case 'w': case 'W': { const char *cwd = getpwd(psh, 1); const char *home = bltinlookup(psh, "HOME", 1); size_t home_len = home ? strlen(home) : 0; if (!cwd) cwd = "?"; if (!strncmp(cwd, home, home_len) && ( cwd[home_len] == '\0' || (cwd[home_len] == '/' && prompt[-1] == 'w'))) { out2c(psh, '~'); if (prompt[-1] == 'w' && cwd[home_len]) { out2str(psh, cwd + home_len); } } else if (prompt[-1] == 'w') { out2str(psh, cwd); } else { out2str(psh, my_basename(cwd, NULL)); } break; } case '0': case '1': case '2': case '3': { unsigned int ch = prompt[-1] - '0'; if (isdigit(*prompt)) { ch *= 8; ch += *prompt++ - '0'; } if (isdigit(*prompt)) { ch *= 8; ch += *prompt++ - '0'; } out2c(psh, ch); break; } /* ignore */ break; case '!': case '#': case '@': case 'A': case 'h': case 'H': case 'j': case 'l': case 't': case 'T': case 'u': case '[': if (strchr(prompt, ']')) { prompt = strchr(prompt, ']') + 1; } break; case 'D': if (*prompt == '{' && strchr(prompt, '}')) { prompt = strchr(prompt, '}') + 1; } break; } } } } } } /* * called by editline -- any expansions to the prompt * should be added here. */ const char * getprompt(shinstance *psh, void *unused) { switch (psh->whichprompt) { case 0: return ""; case 1: return ps1val(psh); case 2: return ps2val(psh); default: return ""; } } #ifndef KASH_SEPARATE_PARSER_ALLOCATOR static union node *copyparsetreeint(shinstance *psh, union node *src); /* * Helper to copyparsetreeint. */ static struct nodelist * copynodelist(shinstance *psh, struct nodelist *src) { struct nodelist *ret = NULL; if (src) { struct nodelist **ppnext = &ret; while (src) { struct nodelist *dst = pstalloclist(psh); dst->next = NULL; *ppnext = dst; ppnext = &dst->next; dst->n = copyparsetreeint(psh, src->n); src = src->next; } } return ret; } /* * Duplicates a node tree. * * Note! This could probably be generated from nodelist. */ static union node * copyparsetreeint(shinstance *psh, union node *src) { /** @todo Try avoid recursion for one of the sub-nodes, esp. when there * is a list like 'next' one. */ union node *ret; if (src) { int const type = src->type; switch (type) { case NSEMI: case NAND: case NOR: case NWHILE: case NUNTIL: ret = pstallocnode(psh, sizeof(src->nbinary)); ret->nbinary.type = type; ret->nbinary.ch1 = copyparsetreeint(psh, src->nbinary.ch1); ret->nbinary.ch2 = copyparsetreeint(psh, src->nbinary.ch2); break; case NCMD: ret = pstallocnode(psh, sizeof(src->ncmd)); ret->ncmd.type = NCMD; ret->ncmd.backgnd = src->ncmd.backgnd; ret->ncmd.args = copyparsetreeint(psh, src->ncmd.args); ret->ncmd.redirect = copyparsetreeint(psh, src->ncmd.redirect); break; case NPIPE: ret = pstallocnode(psh, sizeof(src->npipe)); ret->npipe.type = NPIPE; ret->npipe.backgnd = src->ncmd.backgnd; ret->npipe.cmdlist = copynodelist(psh, src->npipe.cmdlist); break; case NREDIR: case NBACKGND: case NSUBSHELL: ret = pstallocnode(psh, sizeof(src->nredir)); ret->nredir.type = type; ret->nredir.n = copyparsetreeint(psh, src->nredir.n); ret->nredir.redirect = copyparsetreeint(psh, src->nredir.redirect); break; case NIF: ret = pstallocnode(psh, sizeof(src->nif)); ret->nif.type = NIF; ret->nif.test = copyparsetreeint(psh, src->nif.test); ret->nif.ifpart = copyparsetreeint(psh, src->nif.ifpart); ret->nif.elsepart = copyparsetreeint(psh, src->nif.elsepart); break; case NFOR: ret = pstallocnode(psh, sizeof(src->nfor)); ret->nfor.type = NFOR; ret->nfor.args = copyparsetreeint(psh, src->nfor.args); ret->nfor.body = copyparsetreeint(psh, src->nfor.body); ret->nfor.var = pstsavestr(psh, src->nfor.var); break; case NCASE: ret = pstallocnode(psh, sizeof(src->ncase)); ret->ncase.type = NCASE; ret->ncase.expr = copyparsetreeint(psh, src->ncase.expr); ret->ncase.cases = copyparsetreeint(psh, src->ncase.cases); break; case NCLIST: ret = pstallocnode(psh, sizeof(src->nclist)); ret->nclist.type = NCLIST; ret->nclist.next = copyparsetreeint(psh, src->nclist.next); ret->nclist.pattern = copyparsetreeint(psh, src->nclist.pattern); ret->nclist.body = copyparsetreeint(psh, src->nclist.body); break; case NDEFUN: case NARG: ret = pstallocnode(psh, sizeof(src->narg)); ret->narg.type = type; ret->narg.next = copyparsetreeint(psh, src->narg.next); ret->narg.text = pstsavestr(psh, src->narg.text); ret->narg.backquote = copynodelist(psh, src->narg.backquote); break; case NTO: case NCLOBBER: case NFROM: case NFROMTO: case NAPPEND: ret = pstallocnode(psh, sizeof(src->nfile)); ret->nfile.type = type; ret->nfile.fd = src->nfile.fd; ret->nfile.next = copyparsetreeint(psh, src->nfile.next); ret->nfile.fname = copyparsetreeint(psh, src->nfile.fname); break; case NTOFD: case NFROMFD: ret = pstallocnode(psh, sizeof(src->ndup)); ret->ndup.type = type; ret->ndup.fd = src->ndup.fd; ret->ndup.next = copyparsetreeint(psh, src->ndup.next); ret->ndup.dupfd = src->ndup.dupfd; ret->ndup.vname = copyparsetreeint(psh, src->ndup.vname); break; case NHERE: case NXHERE: ret = pstallocnode(psh, sizeof(src->nhere)); ret->nhere.type = type; ret->nhere.fd = src->nhere.fd; ret->nhere.next = copyparsetreeint(psh, src->nhere.next); ret->nhere.doc = copyparsetreeint(psh, src->nhere.doc); break; case NNOT: ret = pstallocnode(psh, sizeof(src->nnot)); ret->nnot.type = NNOT; ret->nnot.com = copyparsetreeint(psh, src->nnot.com); break; default: error(psh, "Unknown node type: %d (node=%p)", src->type, src); return NULL; } } else { ret = NULL; } return ret; } #endif union node *copyparsetree(shinstance *psh, union node *src) { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR K_NOREF(psh); pstackretainpush(psh, src->pblock); return src; #else return copyparsetreeint(psh, src); #endif } kbuild-3608/src/kash/var.h0000664000175000017500000001266414670377415015413 0ustar locutuslocutus/* $NetBSD: var.h,v 1.23 2004/10/02 12:16:53 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)var.h 8.2 (Berkeley) 5/4/95 */ #ifndef ___var_h___ #define ___var_h___ /* * Shell variables. */ /* flags */ #define VEXPORT 0x01 /* variable is exported */ #define VREADONLY 0x02 /* variable cannot be modified */ #define VSTRFIXED 0x04 /* variable struct is statically allocated */ #define VTEXTFIXED 0x08 /* text is statically allocated */ #define VSTACK 0x10 /* text is allocated on the stack */ #define VUNSET 0x20 /* the variable is not set */ #define VNOFUNC 0x40 /* don't call the callback function */ #define VNOSET 0x80 /* do not set variable - just readonly test */ #define VSTRFIXED2 0x4000 /* variable struct is in the shinstance, cannot be freed. (VSTRFIXED is mixed up in local vars) */ #ifdef PC_OS2_LIBPATHS #define VOS2LIBPATH 0x8000 /* OS/2 LIBPATH related variable. */ #endif struct var { struct var *next; /* next entry in hash list */ int flags; /* flags are defined above */ char *text; /* name=value */ int name_len; /* length of name */ void (*func)(struct shinstance *, const char *); /* function to be called when */ /* the variable gets set/unset */ }; struct localvar { struct localvar *next; /* next local variable in list */ struct var *vp; /* the variable that was made local */ int flags; /* saved flags */ char *text; /* saved text */ }; /* struct localvar *localvars; #if ATTY extern struct var vatty; #endif extern struct var vifs; extern struct var vmail; extern struct var vmpath; extern struct var vpath; #ifdef _MSC_VER extern struct var vpath2; #endif extern struct var vps1; extern struct var vps2; extern struct var vps4; #ifndef SMALL extern struct var vterm; extern struct var vtermcap; extern struct var vhistsize; #endif */ /* * The following macros access the values of the above variables. * They have to skip over the name. They return the null string * for unset variables. */ #define ifsval(psh) ((psh)->vifs.text + 4) #define ifsset(psh) (((psh)->vifs.flags & VUNSET) == 0) #define mailval(psh) ((psh)->vmail.text + 5) #define mpathval(psh) ((psh)->vmpath.text + 9) #ifdef _MSC_VER # define pathval(psh) ((psh)->vpath.text[5] || !(psh)->vpath2.text ? &(psh)->vpath.text[5] : &(psh)->vpath2.text[5]) #else # define pathval(psh) ((psh)->vpath.text + 5) #endif #define ps1val(psh) ((psh)->vps1.text + 4) #define ps2val(psh) ((psh)->vps2.text + 4) #define ps4val(psh) ((psh)->vps4.text + 4) #define optindval(psh) ((psh)->voptind.text + 7) #ifndef SMALL #define histsizeval(psh) ((psh)->vhistsize.text + 9) #define termval(psh) ((psh)->vterm.text + 5) #endif #if ATTY #define attyset(psh) (((psh)->vatty.flags & VUNSET) == 0) #endif #define mpathset(psh) (((psh)->vmpath.flags & VUNSET) == 0) void initvar(struct shinstance *); #ifndef SH_FORKED_MODE void subshellinitvar(shinstance *, shinstance *); #endif void setvar(struct shinstance *, const char *, const char *, int); void setvareq(struct shinstance *, char *, int); struct strlist; void listsetvar(struct shinstance *, struct strlist *, int); char *lookupvar(struct shinstance *, const char *); char *bltinlookup(struct shinstance *, const char *, int); char **environment(struct shinstance *); void shprocvar(struct shinstance *); int showvars(struct shinstance *, const char *, int, int); int exportcmd(struct shinstance *, int, char **); int localcmd(struct shinstance *, int, char **); void mklocal(struct shinstance *, const char *, int); void listmklocal(struct shinstance *, struct strlist *, int); void poplocalvars(struct shinstance *); int setvarcmd(struct shinstance *, int, char **); int unsetcmd(struct shinstance *, int, char **); int unsetvar(struct shinstance *, const char *, int); int setvarsafe(struct shinstance *, const char *, const char *, int); void print_quoted(struct shinstance *, const char *); #endif kbuild-3608/src/kash/mkinit.sh0000775000175000017500000001120414670377416016272 0ustar locutuslocutus#! /bin/sh # $NetBSD: mkinit.sh,v 1.2 2004/06/15 23:09:54 dsl Exp $ # Copyright (c) 2003 The NetBSD Foundation, Inc. # All rights reserved. # # This code is derived from software contributed to The NetBSD Foundation # by David Laight. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of The NetBSD Foundation nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. srcs="$*" nl=' ' openparen='(' backslash='\' includes=' "shell.h" "mystring.h" "init.h" ' defines= decles= event_init= event_reset= event_shellproc= for src in $srcs; do exec <$src decnl="$nl" while IFS=; read -r line; do [ "$line" = x ] case "$line " in INIT["{ "]* ) event=init;; RESET["{ "]* ) event=reset;; SHELLPROC["{ "]* ) event=shellproc;; INCLUDE[\ \ ]* ) IFS=' ' set -- $line # ignore duplicates [ "${includes}" != "${includes%* $2 }" ] && continue includes="$includes$2 " continue ;; MKINIT\ ) # struct declaration decles="$decles$nl" while read -r line decles="${decles}${line}${nl}" [ "$line" != "};" ] do : done decnl="$nl" continue ;; MKINIT["{ "]* ) # strip initialiser def=${line#MKINIT} comment="${def#*;}" def="${def%;$comment}" def="${def%%=*}" def="${def% }" decles="${decles}${decnl}extern${def};${comment}${nl}" decnl= continue ;; \#define[\ \ ]* ) IFS=' ' set -- $line # Ignore those with arguments [ "$2" = "${2##*$openparen}" ] || continue # and multiline definitions [ "$line" = "${line%$backslash}" ] || continue defines="${defines}#undef $2${nl}${line}${nl}" continue ;; * ) continue;; esac # code for events ev="${nl} /* from $src: */${nl} {${nl}" while read -r line [ "$line" != "}" ] do # The C program indented by an extra 6 chars using # tabs then spaces. I need to compare the output :-( indent=6 while l=${line# } [ "$l" != "$line" ] do indent=$(($indent + 8)) line="$l" done while l=${line# } [ "$l" != "$line" ] do indent=$(($indent + 1)) line="$l" done [ -z "$line" -o "$line" != "${line###}" ] && indent=0 while [ $indent -ge 8 ] do ev="$ev " indent="$(($indent - 8))" done while [ $indent -gt 0 ] do ev="$ev " indent="$(($indent - 1))" done ev="${ev}${line}${nl}" done ev="${ev} }${nl}" eval event_$event=\"\$event_$event\$ev\" done done exec >init.c.tmp echo "/*" echo " * This file was generated by the mkinit program." echo " */" echo IFS=' ' for f in $includes; do echo "#include $f" done echo "#include \"shinstance.h\"" echo "#include \"nodes.h\"" echo echo echo echo "$defines" echo echo "$decles" echo echo echo "/*" echo " * Initialization code." echo " */" echo echo "void" echo "init(shinstance *psh) {" echo "${event_init%$nl}" echo "}" echo echo echo echo "/*" echo " * This routine is called when an error or an interrupt occurs in an" echo " * interactive shell and control is returned to the main command loop." echo " */" echo echo "void" echo "reset(shinstance *psh) {" echo "${event_reset%$nl}" echo "}" echo echo echo echo "/*" echo " * This routine is called to initialize the shell to run a shell procedure." echo " */" echo echo "void" echo "initshellproc(shinstance *psh) {" echo "${event_shellproc%$nl}" echo "}" exec >&- mv init.c.tmp init.c kbuild-3608/src/kash/mkbuiltins0000775000175000017500000000634614670377416016562 0ustar locutuslocutus#!/bin/sh - # $NetBSD: mkbuiltins,v 1.21 2004/06/06 07:03:11 christos Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)mkbuiltins 8.2 (Berkeley) 5/4/95 havehist=1 if [ "X$1" = "X-h" ]; then havehist=0 shift fi shell=$1 builtins=$2 objdir=$3 havejobs=0 if grep '^#define JOBS[ ]*1' ${shell} > /dev/null then havejobs=1 fi exec <$builtins 3> ${objdir}/builtins.c 4> ${objdir}/builtins.h echo '/* * This file was generated by the mkbuiltins program. */ #include "shell.h" #include "builtins.h" const struct builtincmd builtincmd[] = { ' >&3 echo '/* * This file was generated by the mkbuiltins program. */ #include "shtypes.h" struct builtincmd { const char *name; int (*builtin)(shinstance *, int, char **); }; extern const struct builtincmd builtincmd[]; extern const struct builtincmd splbltincmd[]; ' >&4 specials= while read line do set -- $line [ -z "$1" ] && continue case "$1" in \#if*|\#def*|\#end*) echo $line >&3 echo $line >&4 continue ;; esac l1="${line###}" [ "$l1" != "$line" ] && continue func=$1 shift [ x"$1" = x'-j' ] && { [ $havejobs = 0 ] && continue shift } [ x"$1" = x'-h' ] && { [ $havehist = 0 ] && continue shift } echo 'int '"$func"'(shinstance *, int, char **);' >&4 while [ $# != 0 -a "$1" != '#' ] do [ "$1" = '-s' ] && { specials="$specials $2 $func" shift 2 continue; } [ "$1" = '-u' ] && shift echo ' { "'$1'", '"$func"' },' >&3 shift done done echo ' { 0, 0 },' >&3 echo '};' >&3 echo >&3 echo 'const struct builtincmd splbltincmd[] = {' >&3 set -- $specials while [ $# != 0 ] do echo ' { "'$1'", '"$2"' },' >&3 shift 2 done echo ' { 0, 0 },' >&3 echo "};" >&3 kbuild-3608/src/kash/output.c0000664000175000017500000002427314670377416016156 0ustar locutuslocutus/* $NetBSD: output.c,v 1.28 2003/08/07 09:05:36 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: output.c,v 1.28 2003/08/07 09:05:36 agc Exp $"); #endif /* not lint */ #endif /* * Shell output routines. We use our own output routines because: * When a builtin command is interrupted we have to discard * any pending output. * When a builtin command appears in back quotes, we want to * save the output of the command in a region obtained * via malloc, rather than doing a fork and reading the * output of the command via a pipe. * Our output routines may be smaller than the stdio routines. */ #include #include /* defines BUFSIZ */ #include #include #include #include "shell.h" #include "syntax.h" #include "output.h" #include "memalloc.h" #include "error.h" #include "shinstance.h" //#define OUTBUFSIZ BUFSIZ #define BLOCK_OUT -2 /* output to a fixed block of memory */ //#define MEM_OUT -3 /* output to dynamically allocated memory */ #define OUTPUT_ERR 01 /* error occurred on output */ //struct output output = {NULL, 0, NULL, OUTBUFSIZ, 1, 0}; //struct output errout = {NULL, 0, NULL, 100, 2, 0}; //struct output memout = {NULL, 0, NULL, 0, MEM_OUT, 0}; //struct output *out1 = &output; //struct output *out2 = &errout; #ifdef mkinit INCLUDE "output.h" INCLUDE "memalloc.h" RESET { psh->out1 = &psh->output; psh->out2 = &psh->errout; if (psh->memout.buf != NULL) { ckfree(psh, psh->memout.buf); psh->memout.buf = NULL; psh->memout.nextc = NULL; } } #endif #ifdef notdef /* no longer used */ /* * Set up an output file to write to memory rather than a file. */ void open_mem(char *block, int length, struct output *file) { file->nextc = block; file->nleft = --length; file->fd = BLOCK_OUT; file->flags = 0; file->psh = psh; } #endif void out1str(shinstance *psh, const char *p) { outstr(p, psh->out1); } void out2str(shinstance *psh, const char *p) { outstr(p, psh->out2); } void outstr(const char *p, struct output *file) { while (*p) outc(*p++, file); if (file->psh && file == file->psh->out2) flushout(file); } char out_junk[16]; void emptyoutbuf(struct output *dest) { int offset; shinstance *psh = dest->psh; if (dest->fd == BLOCK_OUT) { dest->nextc = out_junk; dest->nleft = sizeof out_junk; dest->flags |= OUTPUT_ERR; } else if (dest->buf == NULL) { INTOFF; dest->buf = ckmalloc(psh, dest->bufsize); dest->nextc = dest->buf; dest->nleft = dest->bufsize; INTON; } else if (dest->fd == MEM_OUT) { offset = dest->bufsize; INTOFF; dest->bufsize <<= 1; dest->buf = ckrealloc(psh, dest->buf, dest->bufsize); dest->nleft = dest->bufsize - offset; dest->nextc = dest->buf + offset; INTON; } else { flushout(dest); } dest->nleft--; } void output_flushall(shinstance *psh) { flushout(&psh->output); flushout(&psh->errout); } void flushout(struct output *dest) { if (dest->buf == NULL || dest->nextc == dest->buf || dest->fd < 0) return; if (xwrite(dest->psh, dest->fd, dest->buf, dest->nextc - dest->buf) < 0) dest->flags |= OUTPUT_ERR; dest->nextc = dest->buf; dest->nleft = dest->bufsize; } void freestdout(shinstance *psh) { INTOFF; if (psh->output.buf) { ckfree(psh, psh->output.buf); psh->output.buf = NULL; psh->output.nextc = NULL; psh->output.nleft = 0; } INTON; } void outfmt(struct output *file, const char *fmt, ...) { va_list ap; va_start(ap, fmt); doformat(file, fmt, ap); va_end(ap); } void out1fmt(shinstance *psh, const char *fmt, ...) { va_list ap; va_start(ap, fmt); doformat(psh->out1, fmt, ap); va_end(ap); } void dprintf(shinstance *psh, const char *fmt, ...) { va_list ap; va_start(ap, fmt); doformat(psh->out2, fmt, ap); va_end(ap); flushout(psh->out2); } void fmtstr(char *outbuf, size_t length, const char *fmt, ...) { va_list ap; struct output strout; va_start(ap, fmt); strout.nextc = outbuf; strout.nleft = (int)length; strout.fd = BLOCK_OUT; strout.flags = 0; strout.psh = NULL; doformat(&strout, fmt, ap); outc('\0', &strout); if (strout.flags & OUTPUT_ERR) outbuf[length - 1] = '\0'; va_end(ap); } /* * Formatted output. This routine handles a subset of the printf formats: * - Formats supported: d, u, o, p, X, s, and c. * - The x format is also accepted but is treated like X. * - The l, ll and q modifiers are accepted. * - The - and # flags are accepted; # only works with the o format. * - Width and precision may be specified with any format except c. * - An * may be given for the width or precision. * - The obsolete practice of preceding the width with a zero to get * zero padding is not supported; use the precision field. * - A % may be printed by writing %% in the format string. */ #define TEMPSIZE 32 #ifdef BSD4_4 #define HAVE_VASPRINTF 1 #endif void doformat(struct output *dest, const char *f, va_list ap) { #ifdef HAVE_VASPRINTF char *s; vasprintf(&s, f, ap); outstr(s, dest); free(s); #else /* !HAVE_VASPRINTF */ static const char digit_lower[] = "0123456789abcdef"; static const char digit_upper[] = "0123456789ABCDEF"; const char *digit; char c; char temp[TEMPSIZE]; int flushleft; int sharp; int width; int prec; int islong; int isquad; char *p; int sign; int64_t l; uint64_t num; unsigned base; int len; int size; int pad; while ((c = *f++) != '\0') { if (c != '%') { outc(c, dest); continue; } flushleft = 0; sharp = 0; width = 0; prec = -1; islong = 0; isquad = 0; for (;;) { if (*f == '-') flushleft++; else if (*f == '#') sharp++; else break; f++; } if (*f == '*') { width = va_arg(ap, int); f++; } else { while (is_digit(*f)) { width = 10 * width + digit_val(*f++); } } if (*f == '.') { if (*++f == '*') { prec = va_arg(ap, int); f++; } else { prec = 0; while (is_digit(*f)) { prec = 10 * prec + digit_val(*f++); } } } if (*f == 'l') { f++; if (*f == 'l') { isquad++; f++; } else islong++; } else if (*f == 'q') { isquad++; f++; } #ifdef _MSC_VER /* for SHPID_PRI / KI64_PRI */ else if (*f == 'I' && f[1] == '6' && f[2] == '4') { isquad++; f += 3; } #endif digit = digit_upper; switch (*f) { case 'd': if (isquad) l = va_arg(ap, int64_t); else if (islong) l = va_arg(ap, long); else l = va_arg(ap, int); sign = 0; num = l; if (l < 0) { num = -l; sign = 1; } base = 10; goto number; case 'u': base = 10; goto uns_number; case 'o': base = 8; goto uns_number; case 'p': outc('0', dest); outc('x', dest); /*FALLTHROUGH*/ case 'x': /* we don't implement 'x'; treat like 'X' */ digit = digit_lower; /*FALLTHROUGH*/ case 'X': base = 16; uns_number: /* an unsigned number */ sign = 0; if (isquad) num = va_arg(ap, uint64_t); else if (islong) num = va_arg(ap, unsigned long); else num = va_arg(ap, unsigned int); number: /* process a number */ p = temp + TEMPSIZE - 1; *p = '\0'; while (num) { *--p = digit[num % base]; num /= base; } len = (int)((temp + TEMPSIZE - 1) - p); if (prec < 0) prec = 1; if (sharp && *f == 'o' && prec <= len) prec = len + 1; pad = 0; if (width) { size = len; if (size < prec) size = prec; size += sign; pad = width - size; if (flushleft == 0) { while (--pad >= 0) outc(' ', dest); } } if (sign) outc('-', dest); prec -= len; while (--prec >= 0) outc('0', dest); while (*p) outc(*p++, dest); while (--pad >= 0) outc(' ', dest); break; case 's': p = va_arg(ap, char *); pad = 0; if (width) { len = (int)strlen(p); if (prec >= 0 && len > prec) len = prec; pad = width - len; if (flushleft == 0) { while (--pad >= 0) outc(' ', dest); } } prec++; while (--prec != 0 && *p) outc(*p++, dest); while (--pad >= 0) outc(' ', dest); break; case 'c': c = va_arg(ap, int); outc(c, dest); break; default: outc(*f, dest); break; } f++; } #endif /* !HAVE_VASPRINTF */ } /* * Version of write which resumes after a signal is caught. */ int xwrite(shinstance *psh, int fd, char *buf, size_t nbytes) { int ntry; long i; size_t n; n = nbytes; ntry = 0; for (;;) { i = shfile_write(&psh->fdtab, fd, buf, n); if (i > 0) { if ((n -= i) <= 0) return (int)nbytes; buf += i; ntry = 0; } else if (i == 0) { if (++ntry > 10) return (int)(nbytes - n); } else if (errno != EINTR) { return -1; } } } kbuild-3608/src/kash/shthread.h0000664000175000017500000000525414670377416016423 0ustar locutuslocutus/* $Id: shthread.h 3515 2021-12-16 12:54:03Z bird $ */ /** @file * * Shell thread methods. * * Copyright (c) 2007-2010 knut st. osmundsen * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef ___shthread_h___ #define ___shthread_h___ #include "shtypes.h" typedef union shmtx { char b[64]; KU64 au64[64/sizeof(KU64)]; void *aptrs[64/sizeof(void *)]; } shmtx; /** Magic mutex value (final u64). * This is used to detect whether the mutex has been initialized or not, * allowing shmtx_delete to be called more than once without doing harm. * @internal */ #define SHMTX_MAGIC KU64_C(0x8888000019641018) /**< Charles Stross */ /** Index into shmtx::au64 of the SHMTX_MAGIC value. * @internal */ #define SHMTX_MAGIC_IDX (sizeof(shmtx) / sizeof(KU64) - 1) typedef struct shmtxtmp { int i; } shmtxtmp; typedef uintptr_t shtid; void shthread_set_shell(struct shinstance *); struct shinstance *shthread_get_shell(void); void shthread_set_name(const char *name); int shmtx_init(shmtx *pmtx); void shmtx_delete(shmtx *pmtx); void shmtx_enter(shmtx *pmtx, shmtxtmp *ptmp); void shmtx_leave(shmtx *pmtx, shmtxtmp *ptmp); K_INLINE unsigned sh_atomic_inc(KU32 volatile *valuep) { #ifdef _MSC_VER return _InterlockedIncrement((long *)valuep); #elif defined(__GNUC__) && (K_ARCH == K_ARCH_AMD64 || K_ARCH == K_ARCH_X86_32) unsigned uRet; __asm__ __volatile__("lock; xaddl %1, %0" : "=m" (*valuep), "=r" (uRet) : "m" (*valuep), "1" (1) : "memory", "cc"); return uRet + 1; #else return __sync_add_and_fetch(valuep, 1); #endif } K_INLINE unsigned sh_atomic_dec(unsigned volatile *valuep) { #ifdef _MSC_VER return _InterlockedDecrement((long *)valuep); #elif defined(__GNUC__) && (K_ARCH == K_ARCH_AMD64 || K_ARCH == K_ARCH_X86_32) unsigned uRet; __asm__ __volatile__("lock; xaddl %1, %0" : "=m" (*valuep), "=r" (uRet) : "m" (*valuep), "1" (-1) : "memory", "cc"); return uRet - 1; #else return __sync_sub_and_fetch(valuep, 1); #endif } #endif kbuild-3608/src/kash/bld_signames.c0000664000175000017500000000644514670377416017246 0ustar locutuslocutus #include "shinstance.h" /* for MSC */ #include #include int main(int argc, char **argv) { char aszSigName[NSIG][16]; FILE *pFile; int i; if (argc != 2 || *argv[1] == '\0') { fprintf(stderr, "syntax error: Expected exactly one parameter, the output-file!\n"); return 2; } /* * Populate the name array. */ strcpy(aszSigName[0], "Signal 0"); for (i = 1; i < NSIG; ++i) sprintf(aszSigName[i], "%i", i); #define SET_SIG_STR(sig) strcpy(aszSigName[SIG##sig], #sig); #if defined(SIGRTMIN) && defined(SIGRTMAX) if (SIGRTMIN < SIGRTMAX && SIGRTMAX < NSIG) { /* lets mimick what bash seems to be doing. */ int const iMidWay = SIGRTMIN + (SIGRTMAX - SIGRTMIN) / 2; SET_SIG_STR(RTMIN); SET_SIG_STR(RTMAX); for (i = SIGRTMIN + 1; i <= iMidWay; i++) sprintf(aszSigName[i], "RTMIN+%i", (int)(i - SIGRTMIN)); for (; i < SIGRTMAX; i++) sprintf(aszSigName[i], "RTMAX%i", (int)(i - SIGRTMAX)); } else fprintf(stderr, "warning: SIGRTMIN=%d, SIGRTMAX=%d, NSIG=%d\n", (int)SIGRTMIN, (int)SIGRTMAX, (int)NSIG); #endif #ifdef SIGHUP SET_SIG_STR(HUP); #endif #ifdef SIGINT SET_SIG_STR(INT); #endif #ifdef SIGQUIT SET_SIG_STR(QUIT); #endif #ifdef SIGILL SET_SIG_STR(ILL); #endif #ifdef SIGTRAP SET_SIG_STR(TRAP); #endif #ifdef SIGABRT SET_SIG_STR(ABRT); #endif #ifdef SIGIOT SET_SIG_STR(IOT); #endif #ifdef SIGBUS SET_SIG_STR(BUS); #endif #ifdef SIGFPE SET_SIG_STR(FPE); #endif #ifdef SIGKILL SET_SIG_STR(KILL); #endif #ifdef SIGUSR1 SET_SIG_STR(USR1); #endif #ifdef SIGSEGV SET_SIG_STR(SEGV); #endif #ifdef SIGUSR2 SET_SIG_STR(USR2); #endif #ifdef SIGPIPE SET_SIG_STR(PIPE); #endif #ifdef SIGALRM SET_SIG_STR(ALRM); #endif #ifdef SIGTERM SET_SIG_STR(TERM); #endif #ifdef SIGSTKFLT SET_SIG_STR(STKFLT); #endif #ifdef SIGCHLD SET_SIG_STR(CHLD); #endif #ifdef SIGCONT SET_SIG_STR(CONT); #endif #ifdef SIGSTOP SET_SIG_STR(STOP); #endif #ifdef SIGTSTP SET_SIG_STR(TSTP); #endif #ifdef SIGTTIN SET_SIG_STR(TTIN); #endif #ifdef SIGTTOU SET_SIG_STR(TTOU); #endif #ifdef SIGURG SET_SIG_STR(URG); #endif #ifdef SIGXCPU SET_SIG_STR(XCPU); #endif #ifdef SIGXFSZ SET_SIG_STR(XFSZ); #endif #ifdef SIGVTALRM SET_SIG_STR(VTALRM); #endif #ifdef SIGPROF SET_SIG_STR(PROF); #endif #ifdef SIGWINCH SET_SIG_STR(WINCH); #endif #ifdef SIGIO SET_SIG_STR(IO); #endif #ifdef SIGPWR SET_SIG_STR(PWR); #endif #ifdef SIGSYS SET_SIG_STR(SYS); #endif #ifdef SIGBREAK SET_SIG_STR(BREAK); #endif #undef SET_SIG_STR /* * Write out the list. */ pFile = fopen(argv[1], "w"); if (!pFile) { fprintf(stderr, "error: failed to open '%s' for writing\n", argv[1]); return 1; } fputs("/* autogenerate */\n" "\n" "#include \"shinstance.h\"\n" "\n" "const char * const sys_signame[NSIG] = \n" "{\n" , pFile); for (i = 0; i < NSIG; i++) fprintf(pFile, " \"%s\",\n", aszSigName[i]); fputs("};\n", pFile); if (fclose(pFile) != 0) { fprintf(stderr, "error: error writing/closing '%s' after writing it\n", argv[1]); return 1; } return 0; } kbuild-3608/src/kash/TOUR0000664000175000017500000004147714670377416015173 0ustar locutuslocutus# $NetBSD: TOUR,v 1.8 1996/10/16 14:24:56 christos Exp $ # @(#)TOUR 8.1 (Berkeley) 5/31/93 NOTE -- This is the original TOUR paper distributed with ash and does not represent the current state of the shell. It is provided anyway since it provides helpful information for how the shell is structured, but be warned that things have changed -- the current shell is still under development. ================================================================ A Tour through Ash Copyright 1989 by Kenneth Almquist. DIRECTORIES: The subdirectory bltin contains commands which can be compiled stand-alone. The rest of the source is in the main ash directory. SOURCE CODE GENERATORS: Files whose names begin with "mk" are programs that generate source code. A complete list of these programs is: program intput files generates ------- ------------ --------- mkbuiltins builtins builtins.h builtins.c mkinit *.c init.c mknodes nodetypes nodes.h nodes.c mksignames - signames.h signames.c mksyntax - syntax.h syntax.c mktokens - token.h bltin/mkexpr unary_op binary_op operators.h operators.c There are undoubtedly too many of these. Mkinit searches all the C source files for entries looking like: INIT { x = 1; /* executed during initialization */ } RESET { x = 2; /* executed when the shell does a longjmp back to the main command loop */ } SHELLPROC { x = 3; /* executed when the shell runs a shell procedure */ } It pulls this code out into routines which are when particular events occur. The intent is to improve modularity by isolating the information about which modules need to be explicitly initialized/reset within the modules themselves. Mkinit recognizes several constructs for placing declarations in the init.c file. INCLUDE "file.h" includes a file. The storage class MKINIT makes a declaration available in the init.c file, for example: MKINIT int funcnest; /* depth of function calls */ MKINIT alone on a line introduces a structure or union declara- tion: MKINIT struct redirtab { short renamed[10]; }; Preprocessor #define statements are copied to init.c without any special action to request this. INDENTATION: The ash source is indented in multiples of six spaces. The only study that I have heard of on the subject con- cluded that the optimal amount to indent is in the range of four to six spaces. I use six spaces since it is not too big a jump from the widely used eight spaces. If you really hate six space indentation, use the adjind (source included) program to change it to something else. EXCEPTIONS: Code for dealing with exceptions appears in exceptions.c. The C language doesn't include exception handling, so I implement it using setjmp and longjmp. The global variable exception contains the type of exception. EXERROR is raised by calling error. EXINT is an interrupt. EXSHELLPROC is an excep- tion which is raised when a shell procedure is invoked. The pur- pose of EXSHELLPROC is to perform the cleanup actions associated with other exceptions. After these cleanup actions, the shell can interpret a shell procedure itself without exec'ing a new copy of the shell. INTERRUPTS: In an interactive shell, an interrupt will cause an EXINT exception to return to the main command loop. (Exception: EXINT is not raised if the user traps interrupts using the trap command.) The INTOFF and INTON macros (defined in exception.h) provide uninterruptable critical sections. Between the execution of INTOFF and the execution of INTON, interrupt signals will be held for later delivery. INTOFF and INTON can be nested. MEMALLOC.C: Memalloc.c defines versions of malloc and realloc which call error when there is no memory left. It also defines a stack oriented memory allocation scheme. Allocating off a stack is probably more efficient than allocation using malloc, but the big advantage is that when an exception occurs all we have to do to free up the memory in use at the time of the exception is to restore the stack pointer. The stack is implemented using a linked list of blocks. STPUTC: If the stack were contiguous, it would be easy to store strings on the stack without knowing in advance how long the string was going to be: p = stackptr; *p++ = c; /* repeated as many times as needed */ stackptr = p; The folloing three macros (defined in memalloc.h) perform these operations, but grow the stack if you run off the end: STARTSTACKSTR(p); STPUTC(c, p); /* repeated as many times as needed */ grabstackstr(p); We now start a top-down look at the code: MAIN.C: The main routine performs some initialization, executes the user's profile if necessary, and calls cmdloop. Cmdloop is repeatedly parses and executes commands. OPTIONS.C: This file contains the option processing code. It is called from main to parse the shell arguments when the shell is invoked, and it also contains the set builtin. The -i and -j op- tions (the latter turns on job control) require changes in signal handling. The routines setjobctl (in jobs.c) and setinteractive (in trap.c) are called to handle changes to these options. PARSING: The parser code is all in parser.c. A recursive des- cent parser is used. Syntax tables (generated by mksyntax) are used to classify characters during lexical analysis. There are three tables: one for normal use, one for use when inside single quotes, and one for use when inside double quotes. The tables are machine dependent because they are indexed by character vari- ables and the range of a char varies from machine to machine. PARSE OUTPUT: The output of the parser consists of a tree of nodes. The various types of nodes are defined in the file node- types. Nodes of type NARG are used to represent both words and the con- tents of here documents. An early version of ash kept the con- tents of here documents in temporary files, but keeping here do- cuments in memory typically results in significantly better per- formance. It would have been nice to make it an option to use temporary files for here documents, for the benefit of small machines, but the code to keep track of when to delete the tem- porary files was complex and I never fixed all the bugs in it. (AT&T has been maintaining the Bourne shell for more than ten years, and to the best of my knowledge they still haven't gotten it to handle temporary files correctly in obscure cases.) The text field of a NARG structure points to the text of the word. The text consists of ordinary characters and a number of special codes defined in parser.h. The special codes are: CTLVAR Variable substitution CTLENDVAR End of variable substitution CTLBACKQ Command substitution CTLBACKQ|CTLQUOTE Command substitution inside double quotes CTLESC Escape next character A variable substitution contains the following elements: CTLVAR type name '=' [ alternative-text CTLENDVAR ] The type field is a single character specifying the type of sub- stitution. The possible types are: VSNORMAL $var VSMINUS ${var-text} VSMINUS|VSNUL ${var:-text} VSPLUS ${var+text} VSPLUS|VSNUL ${var:+text} VSQUESTION ${var?text} VSQUESTION|VSNUL ${var:?text} VSASSIGN ${var=text} VSASSIGN|VSNUL ${var=text} In addition, the type field will have the VSQUOTE flag set if the variable is enclosed in double quotes. The name of the variable comes next, terminated by an equals sign. If the type is not VSNORMAL, then the text field in the substitution follows, ter- minated by a CTLENDVAR byte. Commands in back quotes are parsed and stored in a linked list. The locations of these commands in the string are indicated by CTLBACKQ and CTLBACKQ+CTLQUOTE characters, depending upon whether the back quotes were enclosed in double quotes. The character CTLESC escapes the next character, so that in case any of the CTL characters mentioned above appear in the input, they can be passed through transparently. CTLESC is also used to escape '*', '?', '[', and '!' characters which were quoted by the user and thus should not be used for file name generation. CTLESC characters have proved to be particularly tricky to get right. In the case of here documents which are not subject to variable and command substitution, the parser doesn't insert any CTLESC characters to begin with (so the contents of the text field can be written without any processing). Other here docu- ments, and words which are not subject to splitting and file name generation, have the CTLESC characters removed during the vari- able and command substitution phase. Words which are subject splitting and file name generation have the CTLESC characters re- moved as part of the file name phase. EXECUTION: Command execution is handled by the following files: eval.c The top level routines. redir.c Code to handle redirection of input and output. jobs.c Code to handle forking, waiting, and job control. exec.c Code to to path searches and the actual exec sys call. expand.c Code to evaluate arguments. var.c Maintains the variable symbol table. Called from expand.c. EVAL.C: Evaltree recursively executes a parse tree. The exit status is returned in the global variable exitstatus. The alter- native entry evalbackcmd is called to evaluate commands in back quotes. It saves the result in memory if the command is a buil- tin; otherwise it forks off a child to execute the command and connects the standard output of the child to a pipe. JOBS.C: To create a process, you call makejob to return a job structure, and then call forkshell (passing the job structure as an argument) to create the process. Waitforjob waits for a job to complete. These routines take care of process groups if job control is defined. REDIR.C: Ash allows file descriptors to be redirected and then restored without forking off a child process. This is accom- plished by duplicating the original file descriptors. The redir- tab structure records where the file descriptors have be dupli- cated to. EXEC.C: The routine find_command locates a command, and enters the command in the hash table if it is not already there. The third argument specifies whether it is to print an error message if the command is not found. (When a pipeline is set up, find_command is called for all the commands in the pipeline be- fore any forking is done, so to get the commands into the hash table of the parent process. But to make command hashing as transparent as possible, we silently ignore errors at that point and only print error messages if the command cannot be found later.) The routine shellexec is the interface to the exec system call. EXPAND.C: Arguments are processed in three passes. The first (performed by the routine argstr) performs variable and command substitution. The second (ifsbreakup) performs word splitting and the third (expandmeta) performs file name generation. If the "/u" directory is simulated, then when "/u/username" is replaced by the user's home directory, the flag "didudir" is set. This tells the cd command that it should print out the directory name, just as it would if the "/u" directory were implemented using symbolic links. VAR.C: Variables are stored in a hash table. Probably we should switch to extensible hashing. The variable name is stored in the same string as the value (using the format "name=value") so that no string copying is needed to create the environment of a com- mand. Variables which the shell references internally are preal- located so that the shell can reference the values of these vari- ables without doing a lookup. When a program is run, the code in eval.c sticks any environment variables which precede the command (as in "PATH=xxx command") in the variable table as the simplest way to strip duplicates, and then calls "environment" to get the value of the environment. There are two consequences of this. First, if an assignment to PATH precedes the command, the value of PATH before the assign- ment must be remembered and passed to shellexec. Second, if the program turns out to be a shell procedure, the strings from the environment variables which preceded the command must be pulled out of the table and replaced with strings obtained from malloc, since the former will automatically be freed when the stack (see the entry on memalloc.c) is emptied. BUILTIN COMMANDS: The procedures for handling these are scat- tered throughout the code, depending on which location appears most appropriate. They can be recognized because their names al- ways end in "cmd". The mapping from names to procedures is specified in the file builtins, which is processed by the mkbuil- tins command. A builtin command is invoked with argc and argv set up like a normal program. A builtin command is allowed to overwrite its arguments. Builtin routines can call nextopt to do option pars- ing. This is kind of like getopt, but you don't pass argc and argv to it. Builtin routines can also call error. This routine normally terminates the shell (or returns to the main command loop if the shell is interactive), but when called from a builtin command it causes the builtin command to terminate with an exit status of 2. The directory bltins contains commands which can be compiled in- dependently but can also be built into the shell for efficiency reasons. The makefile in this directory compiles these programs in the normal fashion (so that they can be run regardless of whether the invoker is ash), but also creates a library named bltinlib.a which can be linked with ash. The header file bltin.h takes care of most of the differences between the ash and the stand-alone environment. The user should call the main routine "main", and #define main to be the name of the routine to use when the program is linked into ash. This #define should appear before bltin.h is included; bltin.h will #undef main if the pro- gram is to be compiled stand-alone. CD.C: This file defines the cd and pwd builtins. The pwd com- mand runs /bin/pwd the first time it is invoked (unless the user has already done a cd to an absolute pathname), but then remembers the current directory and updates it when the cd com- mand is run, so subsequent pwd commands run very fast. The main complication in the cd command is in the docd command, which resolves symbolic links into actual names and informs the user where the user ended up if he crossed a symbolic link. SIGNALS: Trap.c implements the trap command. The routine set- signal figures out what action should be taken when a signal is received and invokes the signal system call to set the signal ac- tion appropriately. When a signal that a user has set a trap for is caught, the routine "onsig" sets a flag. The routine dotrap is called at appropriate points to actually handle the signal. When an interrupt is caught and no trap has been set for that signal, the routine "onint" in error.c is called. OUTPUT: Ash uses it's own output routines. There are three out- put structures allocated. "Output" represents the standard out- put, "errout" the standard error, and "memout" contains output which is to be stored in memory. This last is used when a buil- tin command appears in backquotes, to allow its output to be col- lected without doing any I/O through the UNIX operating system. The variables out1 and out2 normally point to output and errout, respectively, but they are set to point to memout when appropri- ate inside backquotes. INPUT: The basic input routine is pgetc, which reads from the current input file. There is a stack of input files; the current input file is the top file on this stack. The code allows the input to come from a string rather than a file. (This is for the -c option and the "." and eval builtin commands.) The global variable plinno is saved and restored when files are pushed and popped from the stack. The parser routines store the number of the current line in this variable. DEBUGGING: If DEBUG is defined in shell.h, then the shell will write debugging information to the file $HOME/trace. Most of this is done using the TRACE macro, which takes a set of printf arguments inside two sets of parenthesis. Example: "TRACE(("n=%d0, n))". The double parenthesis are necessary be- cause the preprocessor can't handle functions with a variable number of arguments. Defining DEBUG also causes the shell to generate a core dump if it is sent a quit signal. The tracing code is in show.c. kbuild-3608/src/kash/mknodes.sh0000775000175000017500000001320714670377416016444 0ustar locutuslocutus#! /bin/sh # $NetBSD: mknodes.sh,v 1.1 2004/01/16 23:24:38 dsl Exp $ # Copyright (c) 2003 The NetBSD Foundation, Inc. # All rights reserved. # # This code is derived from software contributed to The NetBSD Foundation # by David Laight. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of The NetBSD Foundation nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. nodetypes=$1 nodes_pat=$2 objdir="$3" exec <$nodetypes exec >$objdir/nodes.h.tmp echo "/*" echo " * This file was generated by mknodes.sh" echo " */" echo tagno=0 while IFS=; read -r line; do line="${line%%#*}" IFS=' ' set -- $line IFS= [ -z "$2" ] && continue case "$line" in [" "]* ) IFS=' ' [ $field = 0 ] && struct_list="$struct_list $struct" eval field_${struct}_$field=\"\$*\" eval numfld_$struct=\$field field=$(($field + 1)) ;; * ) define=$1 struct=$2 echo "#define $define $tagno" tagno=$(($tagno + 1)) eval define_$struct=\"\$define_$struct \$define\" struct_define="$struct_define $struct" field=0 ;; esac done echo ## @todo inconsistent indentation here. IFS=' ' for struct in $struct_list; do echo echo echo "struct $struct {" echo "#ifdef KASH_SEPARATE_PARSER_ALLOCATOR" echo " struct pstack_block *pblock;" echo "#endif" field=0 while eval line=\"\$field_${struct}_$field\" field=$(($field + 1)) [ -n "$line" ] do IFS=' ' set -- $line name=$1 case $2 in nodeptr ) type="union node *";; nodelist ) type="struct nodelist *";; string ) type="char *";; int ) type="int ";; * ) name=; shift 2; type="$*";; esac echo " $type$name;" done echo "};" done echo echo echo "union node {" echo "#ifdef KASH_SEPARATE_PARSER_ALLOCATOR" echo "# ifdef __GNUC__" echo " __extension__" echo "# endif" echo " struct {" echo " struct pstack_block *pblock;" echo " int type;" echo " };" echo "#else" echo " int type;" echo "#endif" for struct in $struct_list; do echo " struct $struct $struct;" done echo "};" echo echo echo "struct nodelist {" echo " struct nodelist *next;" echo " union node *n;" echo "};" echo echo echo "union node *copyfunc(struct shinstance *, union node *);" echo "void freefunc(struct shinstance *, union node *);" exec <$nodes_pat exec >$objdir/nodes.c.tmp mv -f $objdir/nodes.h.tmp $objdir/nodes.h || exit 1 echo "/*" echo " * This file was generated by mknodes.sh" echo " */" echo while IFS=; read -r line; do IFS=' ' set -- $line IFS= case "$1" in '%SIZES' ) echo "static const short nodesize[$tagno] = {" IFS=' ' for struct in $struct_define; do echo " SHELL_ALIGN(sizeof (struct $struct))," done echo "};" ;; '%CALCSIZE' ) echo " if (n == NULL)" echo " return;" echo " funcblocksize += nodesize[n->type];" echo " switch (n->type) {" IFS=' ' for struct in $struct_list; do eval defines=\"\$define_$struct\" for define in $defines; do echo " case $define:" done eval field=\$numfld_$struct while [ $field != 0 ] do eval line=\"\$field_${struct}_$field\" field=$(($field - 1)) IFS=' ' set -- $line name=$1 cl=")" case $2 in nodeptr ) fn=calcsize;; nodelist ) fn=sizenodelist;; string ) fn="funcstringsize += strlen" cl=") + 1";; * ) continue;; esac echo " ${fn}(n->$struct.$name${cl};" done echo " break;" done echo " };" ;; '%COPY' ) echo " if (n == NULL)" echo " return NULL;" echo " new = funcblock;" echo " funcblock = (char *) funcblock + nodesize[n->type];" echo " switch (n->type) {" IFS=' ' for struct in $struct_list; do eval defines=\"\$define_$struct\" for define in $defines; do echo " case $define:" done eval field=\$numfld_$struct while [ $field != 0 ] do eval line=\"\$field_${struct}_$field\" field=$(($field - 1)) IFS=' ' set -- $line name=$1 case $2 in nodeptr ) fn="copynode(";; nodelist ) fn="copynodelist(";; string ) fn="nodesavestr(";; int ) fn=;; temp ) echo "unexpected 'temp' node type" >&2; exit 2;; * ) continue;; esac f="$struct.$name" echo " new->$f = ${fn}n->$f${fn:+)};" done echo " break;" done echo " };" echo " new->type = n->type;" ;; * ) echo "$line";; esac done exec >/dev/null mv -f $objdir/nodes.c.tmp $objdir/nodes.c || exit 1 kbuild-3608/src/kash/cd.h0000664000175000017500000000410014670377416015174 0ustar locutuslocutus/* $NetBSD: cd.h,v 1.4 2003/08/07 09:05:30 agc Exp $ */ /*- * Copyright (c) 1995 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ const char *getpwd(struct shinstance *, int); int cdcmd(struct shinstance *, int, char **); int pwdcmd(struct shinstance *, int, char **); #ifdef PC_DRIVE_LETTERS #define IS_ROOT(path) ( *(path) == '/' \ || *(path) == '\\' \ || ( ((*(path) >= 'A' && *(path) <= 'Z') || (*(path) >= 'a' && *(path) <= 'z')) \ && (path)[1] == ':') ) #else #define IS_ROOT(path) ( *(path) == '/' ) #endif kbuild-3608/src/kash/jobs.c0000664000175000017500000010657214670377416015556 0ustar locutuslocutus/* $NetBSD: jobs.c,v 1.63 2005/06/01 15:41:19 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: jobs.c,v 1.63 2005/06/01 15:41:19 lukem Exp $"); #endif /* not lint */ #endif #include #include #include #include #include "shell.h" #if JOBS && !defined(_MSC_VER) # include #endif #include "redir.h" #include "show.h" #include "main.h" #include "parser.h" #include "nodes.h" #include "jobs.h" #include "options.h" #include "trap.h" #include "syntax.h" #include "input.h" #include "output.h" #include "memalloc.h" #include "error.h" #include "mystring.h" #include "init.h" #include "shinstance.h" //static struct job *jobtab; /* array of jobs */ //static int njobs; /* size of array */ //static int jobs_invalid; /* set in child */ //MKINIT pid_t backgndpid = -1; /* pid of last background process */ #if JOBS //int initialpgrp; /* pgrp of shell on invocation */ //static int curjob = -1; /* current job */ #endif //static int ttyfd = -1; STATIC void restartjob(shinstance *, struct job *); STATIC void freejob(shinstance *, struct job *); STATIC struct job *getjob(shinstance *, const char *, int); STATIC shpid dowait(shinstance *, int, struct job *); STATIC shpid waitproc(shinstance *, int, struct job *, int *); STATIC void cmdtxt(shinstance *, union node *); STATIC void cmdlist(shinstance *, union node *, int); STATIC void cmdredirlist(shinstance *, union node *, int); STATIC void cmdputs(shinstance *, const char *); STATIC shpid forkparent(shinstance *psh, struct job *jp, union node *n, int mode, shpid pid); STATIC void forkchild(shinstance *psh, shpid pgrp, union node *n, int mode); #ifdef KASH_USE_FORKSHELL2 # ifndef SH_FORKED_MODE struct forkshell2args { shinstance *psh; int mode; shpid pgrp; /**< The forkchild() pgrp argument (-1 if not in group). */ union node *n; void *argp; /**< Points to child callback data following this structure. */ int (* child)(shinstance *, union node *, void *); struct stackmark smark; /* do we need this? */ }; static int forkshell2_thread(shinstance *psh, void *argp); # endif #endif /* * Turn job control on and off. * * Note: This code assumes that the third arg to ioctl is a character * pointer, which is true on Berkeley systems but not System V. Since * System V doesn't have job control yet, this isn't a problem now. */ //MKINIT int jobctl; void setjobctl(shinstance *psh, int on) { if (on == psh->jobctl || psh->rootshell == 0) return; if (on) { int err; int i; if (psh->ttyfd != -1) shfile_close(&psh->fdtab, psh->ttyfd); if ((psh->ttyfd = shfile_open(&psh->fdtab, "/dev/tty", O_RDWR, 0)) == -1) { for (i = 0; i < 3; i++) { if (shfile_isatty(&psh->fdtab, i) && (psh->ttyfd = shfile_dup(&psh->fdtab, i)) != -1) break; } if (i == 3) goto out; } /* Move to a high fd */ for (i = 10; i > 2; i--) { if ((err = shfile_fcntl(&psh->fdtab, psh->ttyfd, F_DUPFD, (1 << i) - 1)) != -1) break; } if (err != -1) { shfile_close(&psh->fdtab, psh->ttyfd); psh->ttyfd = err; } err = shfile_cloexec(&psh->fdtab, psh->ttyfd, 1); if (err == -1) { shfile_close(&psh->fdtab, psh->ttyfd); psh->ttyfd = -1; goto out; } do { /* while we are in the background */ if ((psh->initialpgrp = sh_tcgetpgrp(psh, psh->ttyfd)) < 0) { out: out2str(psh, "sh: can't access tty; job control turned off\n"); mflag(psh) = 0; return; } if (psh->initialpgrp == -1) psh->initialpgrp = sh_getpgrp(psh); else if (psh->initialpgrp != sh_getpgrp(psh)) { sh_killpg(psh, 0, SIGTTIN); continue; } } while (0); setsignal(psh, SIGTSTP); setsignal(psh, SIGTTOU); setsignal(psh, SIGTTIN); if (sh_getpgid(psh, 0) != psh->rootpid && sh_setpgid(psh, 0, psh->rootpid) == -1) error(psh, "Cannot set process group (%s) at %d", sh_strerror(psh, errno), __LINE__); if (sh_tcsetpgrp(psh, psh->ttyfd, psh->rootpid) == -1) error(psh, "Cannot set tty process group (%s) at %d", sh_strerror(psh, errno), __LINE__); } else { /* turning job control off */ if (sh_getpgid(psh, 0) != psh->initialpgrp && sh_setpgid(psh, 0, psh->initialpgrp) == -1) error(psh, "Cannot set process group (%s) at %d", sh_strerror(psh, errno), __LINE__); if (sh_tcsetpgrp(psh, psh->ttyfd, psh->initialpgrp) == -1) error(psh, "Cannot set tty process group (%s) at %d", sh_strerror(psh, errno), __LINE__); shfile_close(&psh->fdtab, psh->ttyfd); psh->ttyfd = -1; setsignal(psh, SIGTSTP); setsignal(psh, SIGTTOU); setsignal(psh, SIGTTIN); } psh->jobctl = on; } #ifdef mkinit INCLUDE SHELLPROC { psh->backgndpid = -1; #if JOBS psh->jobctl = 0; #endif } #endif #if JOBS int fgcmd(shinstance *psh, int argc, char **argv) { struct job *jp; int i; int status; nextopt(psh, ""); jp = getjob(psh, *psh->argptr, 0); if (jp->jobctl == 0) error(psh, "job not created under job control"); out1fmt(psh, "%s", jp->ps[0].cmd); for (i = 1; i < jp->nprocs; i++) out1fmt(psh, " | %s", jp->ps[i].cmd ); out1c(psh, '\n'); output_flushall(psh); for (i = 0; i < jp->nprocs; i++) if (sh_tcsetpgrp(psh, psh->ttyfd, jp->ps[i].pid) != -1) break; if (i >= jp->nprocs) { error(psh, "Cannot set tty process group (%s) at %d", sh_strerror(psh, errno), __LINE__); } restartjob(psh, jp); INTOFF; status = waitforjob(psh, jp); INTON; return status; } static void set_curjob(shinstance *psh, struct job *jp, int mode) { struct job *jp1, *jp2; int i, ji; ji = (int)(jp - psh->jobtab); /* first remove from list */ if (ji == psh->curjob) psh->curjob = jp->prev_job; else { for (i = 0; i < psh->njobs; i++) { if (psh->jobtab[i].prev_job != ji) continue; psh->jobtab[i].prev_job = jp->prev_job; break; } } /* Then re-insert in correct position */ switch (mode) { case 0: /* job being deleted */ jp->prev_job = -1; break; case 1: /* newly created job or backgrounded job, put after all stopped jobs. */ if (psh->curjob != -1 && psh->jobtab[psh->curjob].state == JOBSTOPPED) { for (jp1 = psh->jobtab + psh->curjob; ; jp1 = jp2) { if (jp1->prev_job == -1) break; jp2 = psh->jobtab + jp1->prev_job; if (jp2->state != JOBSTOPPED) break; } jp->prev_job = jp1->prev_job; jp1->prev_job = ji; break; } /* FALLTHROUGH */ case 2: /* newly stopped job - becomes psh->curjob */ jp->prev_job = psh->curjob; psh->curjob = ji; break; } } int bgcmd(shinstance *psh, int argc, char **argv) { struct job *jp; int i; nextopt(psh, ""); do { jp = getjob(psh, *psh->argptr, 0); if (jp->jobctl == 0) error(psh, "job not created under job control"); set_curjob(psh, jp, 1); out1fmt(psh, "[%ld] %s", (long)(jp - psh->jobtab + 1), jp->ps[0].cmd); for (i = 1; i < jp->nprocs; i++) out1fmt(psh, " | %s", jp->ps[i].cmd ); out1c(psh, '\n'); output_flushall(psh); restartjob(psh, jp); } while (*psh->argptr && *++psh->argptr); return 0; } STATIC void restartjob(shinstance *psh, struct job *jp) { struct procstat *ps; int i; if (jp->state == JOBDONE) return; INTOFF; for (i = 0; i < jp->nprocs; i++) if (sh_killpg(psh, jp->ps[i].pid, SIGCONT) != -1) break; if (i >= jp->nprocs) error(psh, "Cannot continue job (%s)", sh_strerror(psh, errno)); for (ps = jp->ps, i = jp->nprocs ; --i >= 0 ; ps++) { if (WIFSTOPPED(ps->status)) { ps->status = -1; jp->state = JOBRUNNING; } } INTON; } #endif static void showjob(shinstance *psh, struct output *out, struct job *jp, int mode) { int procno; int st; struct procstat *ps; size_t col; char s[64]; #if JOBS if (mode & SHOW_PGID) { /* just output process (group) id of pipeline */ outfmt(out, "%" SHPID_PRI "\n", jp->ps->pid); return; } #endif procno = jp->nprocs; if (!procno) return; if (mode & SHOW_PID) mode |= SHOW_MULTILINE; if ((procno > 1 && !(mode & SHOW_MULTILINE)) || (mode & SHOW_SIGNALLED)) { /* See if we have more than one status to report */ ps = jp->ps; st = ps->status; do { int st1 = ps->status; if (st1 != st) /* yes - need multi-line output */ mode |= SHOW_MULTILINE; if (st1 == -1 || !(mode & SHOW_SIGNALLED) || WIFEXITED(st1)) continue; if (WIFSTOPPED(st1) || ((st1 = WTERMSIG(st1) & 0x7f) && st1 != SIGINT && st1 != SIGPIPE)) mode |= SHOW_ISSIG; } while (ps++, --procno); procno = jp->nprocs; } if (mode & SHOW_SIGNALLED && !(mode & SHOW_ISSIG)) { if (jp->state == JOBDONE && !(mode & SHOW_NO_FREE)) { TRACE((psh, "showjob: freeing job %d\n", jp - psh->jobtab + 1)); freejob(psh, jp); } return; } for (ps = jp->ps; --procno >= 0; ps++) { /* for each process */ if (ps == jp->ps) fmtstr(s, 16, "[%ld] %c ", (long)(jp - psh->jobtab + 1), #if JOBS jp == psh->jobtab + psh->curjob ? '+' : psh->curjob != -1 && jp == psh->jobtab + psh->jobtab[psh->curjob].prev_job ? '-' : #endif ' '); else fmtstr(s, 16, " " ); col = strlen(s); if (mode & SHOW_PID) { fmtstr(s + col, 16, "%" SHPID_PRI " ", ps->pid); col += strlen(s + col); } if (ps->status == -1) { scopy("Running", s + col); } else if (WIFEXITED(ps->status)) { st = WEXITSTATUS(ps->status); if (st) fmtstr(s + col, 16, "Done(%d)", st); else fmtstr(s + col, 16, "Done"); } else { const char *pszSigNm; #if JOBS if (WIFSTOPPED(ps->status)) st = WSTOPSIG(ps->status); else /* WIFSIGNALED(ps->status) */ #endif st = WTERMSIG(ps->status); st &= 0x7f; pszSigNm = st < NSIG ? strsignal(st) : NULL; if (pszSigNm) scopyn(pszSigNm, s + col, 32); else fmtstr(s + col, 16, "Signal %d", st); if (WCOREDUMP(ps->status)) { col += strlen(s + col); scopyn(" (core dumped)", s + col, 64 - col); } } col += strlen(s + col); outstr(s, out); do { outc(' ', out); col++; } while (col < 30); outstr(ps->cmd, out); if (mode & SHOW_MULTILINE) { if (procno > 0) { outc(' ', out); outc('|', out); } } else { while (--procno >= 0) outfmt(out, " | %s", (++ps)->cmd ); } outc('\n', out); } flushout(out); jp->changed = 0; if (jp->state == JOBDONE && !(mode & SHOW_NO_FREE)) freejob(psh, jp); } int jobscmd(shinstance *psh, int argc, char **argv) { int mode, m; int sv = psh->jobs_invalid; psh->jobs_invalid = 0; mode = 0; while ((m = nextopt(psh, "lp"))) if (m == 'l') mode = SHOW_PID; else mode = SHOW_PGID; if (*psh->argptr) do showjob(psh, psh->out1, getjob(psh, *psh->argptr,0), mode); while (*++psh->argptr); else showjobs(psh, psh->out1, mode); psh->jobs_invalid = sv; return 0; } /* * Print a list of jobs. If "change" is nonzero, only print jobs whose * statuses have changed since the last call to showjobs. * * If the shell is interrupted in the process of creating a job, the * result may be a job structure containing zero processes. Such structures * will be freed here. */ void showjobs(shinstance *psh, struct output *out, int mode) { int jobno; struct job *jp; int silent = 0; shpid gotpid; TRACE((psh, "showjobs(%x) called\n", mode)); /* If not even one one job changed, there is nothing to do */ gotpid = dowait(psh, 0, NULL); while (dowait(psh, 0, NULL) > 0) continue; #ifdef JOBS /* * Check if we are not in our foreground group, and if not * put us in it. */ if (mflag(psh) && gotpid != -1 && sh_tcgetpgrp(psh, psh->ttyfd) != sh_getpid(psh)) { if (sh_tcsetpgrp(psh, psh->ttyfd, sh_getpid(psh)) == -1) error(psh, "Cannot set tty process group (%s) at %d", sh_strerror(psh, errno), __LINE__); TRACE((psh, "repaired tty process group\n")); silent = 1; } #endif if (psh->jobs_invalid) return; for (jobno = 1, jp = psh->jobtab ; jobno <= psh->njobs ; jobno++, jp++) { if (!jp->used) continue; if (jp->nprocs == 0) { freejob(psh, jp); continue; } if ((mode & SHOW_CHANGED) && !jp->changed) continue; if (silent && jp->changed) { jp->changed = 0; continue; } showjob(psh, out, jp, mode); } } /* * Mark a job structure as unused. */ STATIC void freejob(shinstance *psh, struct job *jp) { INTOFF; if (jp->ps != &jp->ps0) { ckfree(psh, jp->ps); jp->ps = &jp->ps0; } jp->nprocs = 0; jp->used = 0; #if JOBS set_curjob(psh, jp, 0); #endif INTON; } int waitcmd(shinstance *psh, int argc, char **argv) { struct job *job; int status, retval; struct job *jp; nextopt(psh, ""); if (!*psh->argptr) { /* wait for all jobs */ jp = psh->jobtab; if (psh->jobs_invalid) return 0; for (;;) { if (jp >= psh->jobtab + psh->njobs) { /* no running procs */ return 0; } if (!jp->used || jp->state != JOBRUNNING) { jp++; continue; } if (dowait(psh, 1, (struct job *)NULL) == -1) return 128 + SIGINT; jp = psh->jobtab; } } retval = 127; /* XXXGCC: -Wuninitialized */ for (; *psh->argptr; psh->argptr++) { job = getjob(psh, *psh->argptr, 1); if (!job) { retval = 127; continue; } /* loop until process terminated or stopped */ while (job->state == JOBRUNNING) { if (dowait(psh, 1, (struct job *)NULL) == -1) return 128 + SIGINT; } status = job->ps[job->nprocs].status; if (WIFEXITED(status)) retval = WEXITSTATUS(status); #if JOBS else if (WIFSTOPPED(status)) retval = WSTOPSIG(status) + 128; #endif else { /* XXX: limits number of signals */ retval = WTERMSIG(status) + 128; } if (!iflag(psh)) freejob(psh, job); } return retval; } int jobidcmd(shinstance *psh, int argc, char **argv) { struct job *jp; int i; nextopt(psh, ""); jp = getjob(psh, *psh->argptr, 0); for (i = 0 ; i < jp->nprocs ; ) { out1fmt(psh, "%" SHPID_PRI, jp->ps[i].pid); out1c(psh, ++i < jp->nprocs ? ' ' : '\n'); } return 0; } shpid getjobpgrp(shinstance *psh, const char *name) { struct job *jp; jp = getjob(psh, name, 1); if (jp == 0) return 0; return -jp->ps[0].pid; } /* * Convert a job name to a job structure. */ STATIC struct job * getjob(shinstance *psh, const char *name, int noerror) { int jobno = -1; struct job *jp; int pid; int i; const char *err_msg = "No such job: %s"; if (name == NULL) { #if JOBS jobno = psh->curjob; #endif err_msg = "No current job"; } else if (name[0] == '%') { if (is_number(name + 1)) { jobno = number(psh, name + 1) - 1; } else if (!name[2]) { switch (name[1]) { #if JOBS case 0: case '+': case '%': jobno = psh->curjob; err_msg = "No current job"; break; case '-': jobno = psh->curjob; if (jobno != -1) jobno = psh->jobtab[jobno].prev_job; err_msg = "No previous job"; break; #endif default: goto check_pattern; } } else { struct job *found; check_pattern: found = NULL; for (jp = psh->jobtab, i = psh->njobs ; --i >= 0 ; jp++) { if (!jp->used || jp->nprocs <= 0) continue; if ((name[1] == '?' && strstr(jp->ps[0].cmd, name + 2)) || prefix(name + 1, jp->ps[0].cmd)) { if (found) { err_msg = "%s: ambiguous"; found = 0; break; } found = jp; } } if (found) return found; } } else if (is_number(name)) { pid = number(psh, name); for (jp = psh->jobtab, i = psh->njobs ; --i >= 0 ; jp++) { if (jp->used && jp->nprocs > 0 && jp->ps[jp->nprocs - 1].pid == pid) return jp; } } if (!psh->jobs_invalid && jobno >= 0 && jobno < psh->njobs) { jp = psh->jobtab + jobno; if (jp->used) return jp; } if (!noerror) error(psh, err_msg, name); return 0; } /* * Return a new job structure, */ struct job * makejob(shinstance *psh, union node *node, int nprocs) { int i; struct job *jp; if (psh->jobs_invalid) { for (i = psh->njobs, jp = psh->jobtab ; --i >= 0 ; jp++) { if (jp->used) freejob(psh, jp); } psh->jobs_invalid = 0; } for (i = psh->njobs, jp = psh->jobtab ; ; jp++) { if (--i < 0) { INTOFF; if (psh->njobs == 0) { psh->jobtab = ckmalloc(psh, 4 * sizeof psh->jobtab[0]); } else { jp = ckmalloc(psh, (psh->njobs + 4) * sizeof psh->jobtab[0]); memcpy(jp, psh->jobtab, psh->njobs * sizeof jp[0]); /* Relocate `ps' pointers */ for (i = 0; i < psh->njobs; i++) if (jp[i].ps == &psh->jobtab[i].ps0) jp[i].ps = &jp[i].ps0; ckfree(psh, psh->jobtab); psh->jobtab = jp; } jp = psh->jobtab + psh->njobs; for (i = 4 ; --i >= 0 ; psh->jobtab[psh->njobs++].used = 0) { /*empty*/ } INTON; break; } if (jp->used == 0) break; } INTOFF; jp->state = JOBRUNNING; jp->used = 1; jp->changed = 0; jp->nprocs = 0; #if JOBS jp->jobctl = psh->jobctl; set_curjob(psh, jp, 1); #endif if (nprocs > 1) { jp->ps = ckmalloc(psh, nprocs * sizeof (struct procstat)); } else { jp->ps = &jp->ps0; } INTON; TRACE((psh, "makejob(0x%lx, %d) returns %%%d\n", (long)node, nprocs, jp - psh->jobtab + 1)); return jp; } /* * Fork off a subshell. If we are doing job control, give the subshell its * own process group. Jp is a job structure that the job is to be added to. * N is the command that will be evaluated by the child. Both jp and n may * be NULL. The mode parameter can be one of the following: * FORK_FG - Fork off a foreground process. * FORK_BG - Fork off a background process. * FORK_NOJOB - Like FORK_FG, but don't give the process its own * process group even if job control is on. * * When job control is turned off, background processes have their standard * input redirected to /dev/null (except for the second and later processes * in a pipeline). */ #ifndef KASH_USE_FORKSHELL2 shpid forkshell(shinstance *psh, struct job *jp, union node *n, int mode) { int pid; TRACE((psh, "forkshell(%%%d, %p, %d) called\n", jp - psh->jobtab, n, mode)); switch ((pid = sh_fork(psh))) { case -1: TRACE((psh, "Fork failed, errno=%d\n", errno)); INTON; error(psh, "Cannot fork"); return -1; /* won't get here */ case 0: forkchild(psh, jp == NULL || jp->nprocs == 0 ? -1 : jp->ps[0].pid, n, mode); return 0; default: return forkparent(psh, jp, n, mode, pid); } } #else /* KASH_USE_FORKSHELL2 */ shpid forkshell2(shinstance *psh, struct job *jp, union node *n, int mode, int (*child)(struct shinstance *, void *, union node *), union node *nchild, void *argp, size_t arglen, void (*setupchild)(struct shinstance *, struct shinstance *, void *)) { shpid pid; # ifdef SH_FORKED_MODE /* * fork variant. */ pid = sh_fork(psh); if (pid == 0) { /* child */ forkchild(psh, jp == NULL || jp->nprocs == 0 ? -1 : jp->ps[0].pid, n, mode); sh__exit(psh, child(psh, nchild, argp)); return 0; } /* parent */ if (pid != -1) return forkparent(psh, jp, n, mode, pid); TRACE((psh, "Fork failed, errno=%d\n", errno)); INTON; (void)arglen; (void)setupchild; error(psh, "Cannot fork"); return -1; /* won't get here */ # else /* * Clone the shell and start a thread to service the subshell. */ struct shinstance *pshchild; TRACE((psh, "forkshell2(%%%d, %p, %d, %p, %p, %p, %d) called\n", jp - psh->jobtab, n, mode, child, nchild, argp, (int)arglen)); pshchild = sh_create_child_shell(psh); if (pshchild) { /* pack arguments */ struct forkshell2args *args = (struct forkshell2args *)sh_calloc(pshchild, sizeof(*args) + arglen, 1); args->psh = pshchild; args->argp = memcpy(args + 1, argp, arglen); args->child = child; args->mode = mode; args->pgrp = jp == NULL || jp->nprocs == 0 ? -1 : jp->ps[0].pid; setstackmark(pshchild, &args->smark); args->n = copyparsetree(pshchild, n); if (setupchild) setupchild(pshchild, psh, args->argp); /* start the thread */ pid = sh_thread_start(psh, pshchild, forkshell2_thread, args); if (pid >= 0) return forkparent(psh, jp, n, mode, pid); error(psh, "sh_start_child_thread failed (%d)!", (int)pid); } else error(psh, "sh_create_child_shell failed!"); return -1; # endif } #endif STATIC shpid forkparent(shinstance *psh, struct job *jp, union node *n, int mode, shpid pid) { shpid pgrp; if (psh->rootshell && mode != FORK_NOJOB && mflag(psh)) { if (jp == NULL || jp->nprocs == 0) pgrp = pid; else pgrp = jp->ps[0].pid; /* This can fail because we are doing it in the child also */ (void)sh_setpgid(psh, pid, pgrp); } if (mode == FORK_BG) psh->backgndpid = pid; /* set $! */ if (jp) { struct procstat *ps = &jp->ps[jp->nprocs++]; ps->pid = pid; ps->status = -1; ps->cmd[0] = 0; if (/* iflag && rootshell && */ n) commandtext(psh, ps, n); } TRACE((psh, "In parent shell: child = %" SHPID_PRI "\n", pid)); return pid; } STATIC void forkchild(shinstance *psh, shpid pgrp, union node *n, int mode) { int wasroot; const char *devnull = _PATH_DEVNULL; const char *nullerr = "Can't open %s"; wasroot = psh->rootshell; TRACE((psh, "Child shell %" SHPID_PRI "\n", sh_getpid(psh))); psh->rootshell = 0; closescript(psh); clear_traps(psh); #if JOBS psh->jobctl = 0; /* do job control only in root shell */ if (wasroot && mode != FORK_NOJOB && mflag(psh)) { if (pgrp == -1) pgrp = sh_getpid(psh); /* This can fail because we are doing it in the parent also. And we must ignore SIGTTOU at this point or we'll be stopped! */ (void)sh_setpgid(psh, 0, pgrp); if (mode == FORK_FG) { if (sh_tcsetpgrp(psh, psh->ttyfd, pgrp) == -1) error(psh, "Cannot set tty process group (%s) at %d", sh_strerror(psh, errno), __LINE__); } setsignal(psh, SIGTSTP); setsignal(psh, SIGTTOU); } else #endif if (mode == FORK_BG) { ignoresig(psh, SIGINT); ignoresig(psh, SIGQUIT); if (pgrp == -1 && ! fd0_redirected_p(psh)) { shfile_close(&psh->fdtab, 0); if (shfile_open(&psh->fdtab, devnull, O_RDONLY, 0) != 0) error(psh, nullerr, devnull); } } if (wasroot && iflag(psh)) { setsignal(psh, SIGINT); setsignal(psh, SIGQUIT); setsignal(psh, SIGTERM); } psh->jobs_invalid = 1; } #if defined(KASH_USE_FORKSHELL2) && !defined(SH_FORKED_MODE) /** thread procedure */ static int forkshell2_thread(shinstance *psh, void *argp) { struct forkshell2args * volatile volargs = (struct forkshell2args *)argp; struct jmploc jmp; TRACE2((psh, "forkshell2_thread:\n")); if (setjmp(jmp.loc) == 0) { struct forkshell2args * const args = volargs; forkchild(psh, args->pgrp, args->n, args->mode); psh->handler = &jmp; return args->child(psh, args->n, args->argp); } /* * (We longjmp'ed here.) * * This is copied from main() and simplified: */ for (;;) { psh = volargs->psh; /* longjmp paranoia */ if (psh->exception != EXSHELLPROC) { if (psh->exception == EXEXEC) psh->exitstatus = psh->exerrno; else if (psh->exception == EXERROR) psh->exitstatus = 2; TRACE2((psh, "forkshell2_thread: exception=%d -> exitshell2(,%d)\n", psh->exception, psh->exitstatus)); return exitshell2(psh, psh->exitstatus); } /* EXSHELLPROC - tryexec gets us here and it wants to run a program hoping (?) it's a shell script. We must reset the shell state and turn ourselves into a root shell before doing so. */ TRACE2((psh, "forkshell2_thread: exception=EXSHELLPROC\n")); psh->rootpid = /*getpid()*/ psh->pid; psh->rootshell = 1; psh->minusc = NULL; reset(psh); popstackmark(psh, &volargs->smark); FORCEINTON; /* enable interrupts */ /* state3: */ if (sflag(psh) == 0) { # ifdef SIGTSTP static int sigs[] = { SIGINT, SIGQUIT, SIGHUP, SIGPIPE, SIGTSTP }; # else static int sigs[] = { SIGINT, SIGQUIT, SIGHUP, SIGPIPE }; # endif unsigned i; for (i = 0; i < K_ELEMENTS(sigs); i++) setsignal(psh, sigs[i]); } if (setjmp(jmp.loc) == 0) { psh->handler = &jmp; cmdloop(psh, 1); TRACE2((psh, "forkshell2_thread: cmdloop returned -> exitshell2(,%d)\n", psh->exitstatus)); return exitshell2(psh, psh->exitstatus); } } } #endif /* * Wait for job to finish. * * Under job control we have the problem that while a child process is * running interrupts generated by the user are sent to the child but not * to the shell. This means that an infinite loop started by an inter- * active user may be hard to kill. With job control turned off, an * interactive user may place an interactive program inside a loop. If * the interactive program catches interrupts, the user doesn't want * these interrupts to also abort the loop. The approach we take here * is to have the shell ignore interrupt signals while waiting for a * forground process to terminate, and then send itself an interrupt * signal if the child process was terminated by an interrupt signal. * Unfortunately, some programs want to do a bit of cleanup and then * exit on interrupt; unless these processes terminate themselves by * sending a signal to themselves (instead of calling exit) they will * confuse this approach. */ int waitforjob(shinstance *psh, struct job *jp) { #if JOBS shpid mypgrp = sh_getpgrp(psh); #endif int status; int st; INTOFF; TRACE((psh, "waitforjob(%%%d) called\n", jp - psh->jobtab + 1)); while (jp->state == JOBRUNNING) { dowait(psh, 1, jp); } #if JOBS if (jp->jobctl) { if (sh_tcsetpgrp(psh, psh->ttyfd, mypgrp) == -1) error(psh, "Cannot set tty process group (%s) at %d", sh_strerror(psh, errno), __LINE__); } if (jp->state == JOBSTOPPED && psh->curjob != jp - psh->jobtab) set_curjob(psh, jp, 2); #endif status = jp->ps[jp->nprocs - 1].status; /* convert to 8 bits */ if (WIFEXITED(status)) st = WEXITSTATUS(status); #if JOBS else if (WIFSTOPPED(status)) st = WSTOPSIG(status) + 128; #endif else st = WTERMSIG(status) + 128; TRACE((psh, "waitforjob: job %d, nproc %d, status %x, st %x\n", jp - psh->jobtab + 1, jp->nprocs, status, st )); #if JOBS if (jp->jobctl) { /* * This is truly gross. * If we're doing job control, then we did a TIOCSPGRP which * caused us (the shell) to no longer be in the controlling * session -- so we wouldn't have seen any ^C/SIGINT. So, we * intuit from the subprocess exit status whether a SIGINT * occurred, and if so interrupt ourselves. Yuck. - mycroft */ if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT) sh_raise_sigint(psh);/*raise(SIGINT);*/ } #endif if (! JOBS || jp->state == JOBDONE) freejob(psh, jp); INTON; return st; } /* * Wait for a process to terminate. */ STATIC shpid dowait(shinstance *psh, int block, struct job *job) { shpid pid; int status; struct procstat *sp; struct job *jp; struct job *thisjob; int done; int stopped; TRACE((psh, "dowait(%d) called\n", block)); do { pid = waitproc(psh, block, job, &status); TRACE((psh, "wait returns pid %" SHPID_PRI ", status %d\n", pid, status)); } while (pid == -1 && errno == EINTR && psh->gotsig[SIGINT - 1] == 0); if (pid <= 0) return pid; INTOFF; thisjob = NULL; for (jp = psh->jobtab ; jp < psh->jobtab + psh->njobs ; jp++) { if (jp->used) { done = 1; stopped = 1; for (sp = jp->ps ; sp < jp->ps + jp->nprocs ; sp++) { if (sp->pid == -1) continue; if (sp->pid == pid) { TRACE((psh, "Job %d: changing status of proc %" SHPID_PRI " from 0x%x to 0x%x\n", jp - psh->jobtab + 1, pid, sp->status, status)); sp->status = status; thisjob = jp; } if (sp->status == -1) stopped = 0; else if (WIFSTOPPED(sp->status)) done = 0; } if (stopped) { /* stopped or done */ int state = done ? JOBDONE : JOBSTOPPED; if (jp->state != state) { TRACE((psh, "Job %d: changing state from %d to %d\n", jp - psh->jobtab + 1, jp->state, state)); jp->state = state; #if JOBS if (done) set_curjob(psh, jp, 0); #endif } } } } if (thisjob && thisjob->state != JOBRUNNING) { int mode = 0; if (!psh->rootshell || !iflag(psh)) mode = SHOW_SIGNALLED; if (job == thisjob) mode = SHOW_SIGNALLED | SHOW_NO_FREE; if (mode) showjob(psh, psh->out2, thisjob, mode); else { TRACE((psh, "Not printing status, rootshell=%d, job=%p\n", psh->rootshell, job)); thisjob->changed = 1; } } INTON; return pid; } /* * Do a wait system call. If job control is compiled in, we accept * stopped processes. If block is zero, we return a value of zero * rather than blocking. */ STATIC shpid waitproc(shinstance *psh, int block, struct job *jp, int *status) { int flags = 0; #if JOBS if (jp != NULL && jp->jobctl) flags |= WUNTRACED; #endif if (block == 0) flags |= WNOHANG; return sh_waitpid(psh, -1, status, flags); } /* * return 1 if there are stopped jobs, otherwise 0 */ //int job_warning = 0; int stoppedjobs(shinstance *psh) { int jobno; struct job *jp; if (psh->job_warning || psh->jobs_invalid) return (0); for (jobno = 1, jp = psh->jobtab; jobno <= psh->njobs; jobno++, jp++) { if (jp->used == 0) continue; if (jp->state == JOBSTOPPED) { out2str(psh, "You have stopped jobs.\n"); psh->job_warning = 2; return (1); } } return (0); } /* * Return a string identifying a command (to be printed by the * jobs command). */ //STATIC char *cmdnextc; //STATIC int cmdnleft; void commandtext(shinstance *psh, struct procstat *ps, union node *n) { int len; psh->cmdnextc = ps->cmd; if (iflag(psh) || mflag(psh) || sizeof(ps->cmd) < 100) len = sizeof(ps->cmd); else len = sizeof(ps->cmd) / 10; psh->cmdnleft = len; cmdtxt(psh, n); if (psh->cmdnleft <= 0) { char *p = ps->cmd + len - 4; p[0] = '.'; p[1] = '.'; p[2] = '.'; p[3] = 0; } else *psh->cmdnextc = '\0'; TRACE((psh, "commandtext: ps->cmd %x, end %x, left %d\n\t\"%s\"\n", ps->cmd, psh->cmdnextc, psh->cmdnleft, ps->cmd)); } STATIC void cmdtxt(shinstance *psh, union node *n) { union node *np; struct nodelist *lp; const char *p; int i; char s[2]; if (n == NULL || psh->cmdnleft <= 0) return; switch (n->type) { case NSEMI: cmdtxt(psh, n->nbinary.ch1); cmdputs(psh, "; "); cmdtxt(psh, n->nbinary.ch2); break; case NAND: cmdtxt(psh, n->nbinary.ch1); cmdputs(psh, " && "); cmdtxt(psh, n->nbinary.ch2); break; case NOR: cmdtxt(psh, n->nbinary.ch1); cmdputs(psh, " || "); cmdtxt(psh, n->nbinary.ch2); break; case NPIPE: for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) { cmdtxt(psh, lp->n); if (lp->next) cmdputs(psh, " | "); } break; case NSUBSHELL: cmdputs(psh, "("); cmdtxt(psh, n->nredir.n); cmdputs(psh, ")"); break; case NREDIR: case NBACKGND: cmdtxt(psh, n->nredir.n); break; case NIF: cmdputs(psh, "if "); cmdtxt(psh, n->nif.test); cmdputs(psh, "; then "); cmdtxt(psh, n->nif.ifpart); if (n->nif.elsepart) { cmdputs(psh, "; else "); cmdtxt(psh, n->nif.elsepart); } cmdputs(psh, "; fi"); break; case NWHILE: cmdputs(psh, "while "); goto until; case NUNTIL: cmdputs(psh, "until "); until: cmdtxt(psh, n->nbinary.ch1); cmdputs(psh, "; do "); cmdtxt(psh, n->nbinary.ch2); cmdputs(psh, "; done"); break; case NFOR: cmdputs(psh, "for "); cmdputs(psh, n->nfor.var); cmdputs(psh, " in "); cmdlist(psh, n->nfor.args, 1); cmdputs(psh, "; do "); cmdtxt(psh, n->nfor.body); cmdputs(psh, "; done"); break; case NCASE: cmdputs(psh, "case "); cmdputs(psh, n->ncase.expr->narg.text); cmdputs(psh, " in "); for (np = n->ncase.cases; np; np = np->nclist.next) { cmdtxt(psh, np->nclist.pattern); cmdputs(psh, ") "); cmdtxt(psh, np->nclist.body); cmdputs(psh, ";; "); } cmdputs(psh, "esac"); break; case NDEFUN: cmdputs(psh, n->narg.text); cmdputs(psh, "() { ... }"); break; case NCMD: cmdlist(psh, n->ncmd.args, 1); cmdredirlist(psh, n->ncmd.redirect, 0); break; case NARG: cmdputs(psh, n->narg.text); break; case NTO: p = ">"; i = 1; goto redir; case NCLOBBER: p = ">|"; i = 1; goto redir; case NAPPEND: p = ">>"; i = 1; goto redir; case NTOFD: p = ">&"; i = 1; goto redir; case NFROM: p = "<"; i = 0; goto redir; case NFROMFD: p = "<&"; i = 0; goto redir; case NFROMTO: p = "<>"; i = 0; goto redir; redir: if (n->nfile.fd != i) { s[0] = n->nfile.fd + '0'; s[1] = '\0'; cmdputs(psh, s); } cmdputs(psh, p); if (n->type == NTOFD || n->type == NFROMFD) { s[0] = n->ndup.dupfd + '0'; s[1] = '\0'; cmdputs(psh, s); } else { cmdtxt(psh, n->nfile.fname); } break; case NHERE: case NXHERE: cmdputs(psh, "<<..."); break; default: cmdputs(psh, "???"); break; } } STATIC void cmdlist(shinstance *psh, union node *np, int sep) { for (; np; np = np->narg.next) { if (!sep) cmdputs(psh, " "); cmdtxt(psh, np); if (sep && np->narg.next) cmdputs(psh, " "); } } STATIC void cmdredirlist(shinstance *psh, union node *np, int sep) { for (; np; np = np->nfile.next) { if (!sep) cmdputs(psh, " "); cmdtxt(psh, np); if (sep && np->nfile.next) cmdputs(psh, " "); } } STATIC void cmdputs(shinstance *psh, const char *s) { const char *p, *str = 0; char c, cc[2] = " "; char *nextc; int nleft; int subtype = 0; int quoted = 0; static char vstype[16][4] = { "", "}", "-", "+", "?", "=", "#", "##", "%", "%%" }; p = s; nextc = psh->cmdnextc; nleft = psh->cmdnleft; while (nleft > 0 && (c = *p++) != 0) { switch (c) { case CTLESC: c = *p++; break; case CTLVAR: subtype = *p++; if ((subtype & VSTYPE) == VSLENGTH) str = "${#"; else str = "${"; if (!(subtype & VSQUOTE) != !(quoted & 1)) { quoted ^= 1; c = '"'; } else c = *str++; break; case CTLENDVAR: if (quoted & 1) { c = '"'; str = "}"; } else c = '}'; quoted >>= 1; subtype = 0; break; case CTLBACKQ: c = '$'; str = "(...)"; break; case CTLBACKQ+CTLQUOTE: c = '"'; str = "$(...)\""; break; case CTLARI: c = '$'; str = "(("; break; case CTLENDARI: c = ')'; str = ")"; break; case CTLQUOTEMARK: quoted ^= 1; c = '"'; break; case '=': if (subtype == 0) break; str = vstype[subtype & VSTYPE]; if (subtype & VSNUL) c = ':'; else c = *str++; if (c != '}') quoted <<= 1; break; case '\'': case '\\': case '"': case '$': /* These can only happen inside quotes */ cc[0] = c; str = cc; c = '\\'; break; default: break; } do { *nextc++ = c; } while (--nleft > 0 && str && (c = *str++)); str = 0; } if ((quoted & 1) && nleft) { *nextc++ = '"'; nleft--; } psh->cmdnleft = nleft; psh->cmdnextc = nextc; } kbuild-3608/src/kash/jobs.h0000664000175000017500000001114314670377416015550 0ustar locutuslocutus/* $NetBSD: jobs.h,v 1.19 2003/11/27 21:16:14 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)jobs.h 8.2 (Berkeley) 5/4/95 */ #include "output.h" /* Mode argument to forkshell. Don't change FORK_FG or FORK_BG. */ #define FORK_FG 0 #define FORK_BG 1 #define FORK_NOJOB 2 #define FORK_JUST_IO 4 /* forking I/O subprocess/thread (here doc). */ /* mode flags for showjob(s) */ #define SHOW_PGID 0x01 /* only show pgid - for jobs -p */ #define SHOW_MULTILINE 0x02 /* one line per process */ #define SHOW_PID 0x04 /* include process pid */ #define SHOW_CHANGED 0x08 /* only jobs whose state has changed */ #define SHOW_SIGNALLED 0x10 /* only if stopped/exited on signal */ #define SHOW_ISSIG 0x20 /* job was signalled */ #define SHOW_NO_FREE 0x40 /* do not free job */ /* * A job structure contains information about a job. A job is either a * single process or a set of processes contained in a pipeline. In the * latter case, pidlist will be non-NULL, and will point to a -1 terminated * array of pids. */ #define MAXCMDTEXT 200 struct procstat { shpid pid; /* process id */ int status; /* last process status from wait() */ char cmd[MAXCMDTEXT];/* text of command being run */ }; struct job { struct procstat ps0; /* status of process */ struct procstat *ps; /* status or processes when more than one */ int nprocs; /* number of processes */ shpid pgrp; /* process group of this job */ /**< @todo is job:pgrp used anywhere? */ char state; #define JOBRUNNING 0 /* at least one proc running */ #define JOBSTOPPED 1 /* all procs are stopped */ #define JOBDONE 2 /* all procs are completed */ char used; /* true if this entry is in used */ char changed; /* true if status has changed */ #if JOBS char jobctl; /* job running under job control */ int prev_job; /* previous job index */ #endif }; /*extern pid_t backgndpid;*/ /* pid of last background process */ /*extern int job_warning;*/ /* user was warned about stopped jobs */ void setjobctl(struct shinstance *, int); int fgcmd(struct shinstance *, int, char **); int bgcmd(struct shinstance *, int, char **); int jobscmd(struct shinstance *, int, char **); void showjobs(struct shinstance *, struct output *, int); int waitcmd(struct shinstance *, int, char **); int jobidcmd(struct shinstance *, int, char **); union node; struct job *makejob(struct shinstance *, union node *, int); #ifdef KASH_USE_FORKSHELL2 shpid forkshell2(struct shinstance *, struct job *, union node *, int, int (*child)(struct shinstance *, void *, union node *), union node *, void *, size_t, void (*setupchild)(struct shinstance *, struct shinstance *, void *)); #else shpid forkshell(struct shinstance *, struct job *, union node *, int); #endif int waitforjob(struct shinstance *, struct job *); int stoppedjobs(struct shinstance *); void commandtext(struct shinstance *, struct procstat *, union node *); shpid getjobpgrp(struct shinstance *, const char *); #if ! JOBS #define setjobctl(psh, on) /* do nothing */ #endif kbuild-3608/src/kash/nodetypes0000664000175000017500000001212614670377416016401 0ustar locutuslocutus# $NetBSD: nodetypes,v 1.12 2003/08/22 11:22:23 agc Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)nodetypes 8.2 (Berkeley) 5/4/95 # This file describes the nodes used in parse trees. Unindented lines # contain a node type followed by a structure tag. Subsequent indented # lines specify the fields of the structure. Several node types can share # the same structure, in which case the fields of the structure should be # specified only once. # # A field of a structure is described by the name of the field followed # by a type. The currently implemented types are: # nodeptr - a pointer to a node # nodelist - a pointer to a list of nodes # string - a pointer to a nul terminated string # int - an integer # other - any type that can be copied by assignment # The last two types should be followed by the text of a C declaration for # the field. NSEMI nbinary # two commands separated by a semicolon type int ch1 nodeptr # the first child ch2 nodeptr # the second child NCMD ncmd # a simple command type int backgnd int # set to run command in background args nodeptr # the arguments redirect nodeptr # list of file redirections NPIPE npipe # a pipeline type int backgnd int # set to run pipeline in background cmdlist nodelist # the commands in the pipeline NREDIR nredir # redirection (of a complex command) type int n nodeptr # the command redirect nodeptr # list of file redirections NBACKGND nredir # run command in background NSUBSHELL nredir # run command in a subshell NAND nbinary # the && operator NOR nbinary # the || operator NIF nif # the if statement. Elif clauses are handled type int # using multiple if nodes. test nodeptr # if test ifpart nodeptr # then ifpart elsepart nodeptr # else elsepart NWHILE nbinary # the while statement. First child is the test NUNTIL nbinary # the until statement NFOR nfor # the for statement type int args nodeptr # for var in args body nodeptr # do body; done var string # the for variable NCASE ncase # a case statement type int expr nodeptr # the word to switch on cases nodeptr # the list of cases (NCLIST nodes) NCLIST nclist # a case type int next nodeptr # the next case in list pattern nodeptr # list of patterns for this case body nodeptr # code to execute for this case NDEFUN narg # define a function. The "next" field contains # the body of the function. NARG narg # represents a word type int next nodeptr # next word in list text string # the text of the word backquote nodelist # list of commands in back quotes NTO nfile # fd> fname NCLOBBER nfile # fd>| fname NFROM nfile # fd< fname NFROMTO nfile # fd<> fname NAPPEND nfile # fd>> fname type int fd int # file descriptor being redirected (must match ndup) next nodeptr # next redirection in list (must match ndup) fname nodeptr # file name, in a NARG node NTOFD ndup # fd<&dupfd NFROMFD ndup # fd>&dupfd type int fd int # file descriptor being redirected (must match nfile) next nodeptr # next redirection in list (must match nfile) dupfd int # file descriptor to duplicate vname nodeptr # file name if fd>&$var NHERE nhere # fd<<\! NXHERE nhere # fd< #include #include "shell.h" #include "exec.h" /* defines padvance() */ #include "var.h" #include "output.h" #include "memalloc.h" #include "error.h" #include "mail.h" #include "shinstance.h" /*#define MAXMBOXES 10*/ /*STATIC int nmboxes;*/ /* number of mailboxes */ /*STATIC time_t mailtime[MAXMBOXES];*/ /* times of mailboxes */ /* * Print appropriate message(s) if mail has arrived. If the argument is * nozero, then the value of MAIL has changed, so we just update the * values. */ void chkmail(shinstance *psh, int silent) { int i; const char *mpath; char *p; char *q; struct stackmark smark; struct stat statb; if (silent) psh->nmboxes = 10; if (psh->nmboxes == 0) return; setstackmark(psh, &smark); mpath = mpathset(psh) ? mpathval(psh) : mailval(psh); for (i = 0 ; i < psh->nmboxes ; i++) { p = padvance(psh, &mpath, nullstr); if (p == NULL) break; if (*p == '\0') continue; for (q = p ; *q ; q++); if (q[-1] != '/') sh_abort(psh); q[-1] = '\0'; /* delete trailing '/' */ #ifdef notdef /* this is what the System V shell claims to do (it lies) */ if (shfile_stat(&psh->fdtab, p, &statb) < 0) statb.st_mtime = 0; if (statb.st_mtime > psh->mailtime[i] && ! silent) { out2str(psh, psh->pathopt ? psh->pathopt : "you have mail"); out2c(psh, '\n'); } psh->mailtime[i] = statb.st_mtime; #else /* this is what it should do */ if (shfile_stat(&psh->fdtab, p, &statb) < 0) statb.st_size = 0; if (statb.st_size > psh->mailtime[i] && ! silent) { out2str(psh, psh->pathopt ? psh->pathopt : "you have mail"); out2c(psh, '\n'); } psh->mailtime[i] = statb.st_size; #endif } psh->nmboxes = i; popstackmark(psh, &smark); } kbuild-3608/src/kash/alias.h0000664000175000017500000000424014670377416015704 0ustar locutuslocutus/* $NetBSD: alias.h,v 1.6 2003/08/07 09:05:29 agc Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)alias.h 8.2 (Berkeley) 5/4/95 */ #define ALIASINUSE 1 struct alias { struct alias *next; char *name; char *val; int flag; }; #ifndef SH_FORKED_MODE void subshellinitalias(shinstance *, shinstance *); #endif struct alias *lookupalias(struct shinstance *, char *, int); char *get_alias_text(struct shinstance *, char *); int aliascmd(struct shinstance *, int, char **); int unaliascmd(struct shinstance *, int, char **); void rmaliases(struct shinstance *); kbuild-3608/src/kash/sh.10000664000175000017500000016023214670377416015142 0ustar locutuslocutus.\" $NetBSD: sh.1,v 1.80 2005/05/24 00:03:52 wiz Exp $ .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Kenneth Almquist. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" .Dd May 7, 2005 .Os .Dt SH 1 .Sh NAME .Nm sh .Nd command interpreter (shell) .Sh SYNOPSIS .Nm .Bk -words .Op Fl aCefnuvxIimqVEb .Op Cm +aCefnuvxIimqVEb .Ek .Bk -words .Op Fl o Ar option_name .Op Cm +o Ar option_name .Ek .Bk -words .Op Ar command_file Oo Ar argument ... Oc .Ek .Nm .Fl c .Bk -words .Op Fl aCefnuvxIimqVEb .Op Cm +aCefnuvxIimqVEb .Ek .Bk -words .Op Fl o Ar option_name .Op Cm +o Ar option_name .Ek .Bk -words .Ar command_string .Op Ar command_name Oo Ar argument ... Oc .Ek .Nm .Fl s .Bk -words .Op Fl aCefnuvxIimqVEb .Op Cm +aCefnuvxIimqVEb .Ek .Bk -words .Op Fl o Ar option_name .Op Cm +o Ar option_name .Ek .Bk -words .Op Ar argument ... .Ek .Sh DESCRIPTION .Nm is the standard command interpreter for the system. The current version of .Nm is in the process of being changed to conform with the .Tn POSIX 1003.2 and 1003.2a specifications for the shell. This version has many features which make it appear similar in some respects to the Korn shell, but it is not a Korn shell clone (see .Xr ksh 1 ) . Only features designated by .Tn POSIX , plus a few Berkeley extensions, are being incorporated into this shell. .\" We expect .\" .Tn POSIX .\" conformance by the time 4.4 BSD is released. This man page is not intended to be a tutorial or a complete specification of the shell. .Ss Overview The shell is a command that reads lines from either a file or the terminal, interprets them, and generally executes other commands. It is the program that is running when a user logs into the system (although a user can select a different shell with the .Xr chsh 1 command). The shell implements a language that has flow control constructs, a macro facility that provides a variety of features in addition to data storage, along with built in history and line editing capabilities. It incorporates many features to aid interactive use and has the advantage that the interpretative language is common to both interactive and non-interactive use (shell scripts). That is, commands can be typed directly to the running shell or can be put into a file and the file can be executed directly by the shell. .Ss Invocation If no args are present and if the standard input of the shell is connected to a terminal (or if the .Fl i flag is set), and the .Fl c option is not present, the shell is considered an interactive shell. An interactive shell generally prompts before each command and handles programming and command errors differently (as described below). When first starting, the shell inspects argument 0, and if it begins with a dash .Sq - , the shell is also considered a login shell. This is normally done automatically by the system when the user first logs in. A login shell first reads commands from the files .Pa /etc/profile and .Pa .profile if they exist. If the environment variable .Ev ENV is set on entry to a shell, or is set in the .Pa .profile of a login shell, the shell next reads commands from the file named in .Ev ENV . Therefore, a user should place commands that are to be executed only at login time in the .Pa .profile file, and commands that are executed for every shell inside the .Ev ENV file. To set the .Ev ENV variable to some file, place the following line in your .Pa .profile of your home directory .Pp .Dl ENV=$HOME/.shinit; export ENV .Pp substituting for .Dq .shinit any filename you wish. Since the .Ev ENV file is read for every invocation of the shell, including shell scripts and non-interactive shells, the following paradigm is useful for restricting commands in the .Ev ENV file to interactive invocations. Place commands within the .Dq case and .Dq esac below (these commands are described later): .Pp .Bl -item -compact -offset indent .It .Li case $- in *i*) .Bl -item -compact -offset indent .It .Li # commands for interactive use only .It .Li ... .El .It .Li esac .El .Pp If command line arguments besides the options have been specified, then the shell treats the first argument as the name of a file from which to read commands (a shell script), and the remaining arguments are set as the positional parameters of the shell ($1, $2, etc). Otherwise, the shell reads commands from its standard input. .Ss Argument List Processing All of the single letter options have a corresponding name that can be used as an argument to the .Fl o option. The set .Fl o name is provided next to the single letter option in the description below. Specifying a dash .Dq - turns the option on, while using a plus .Dq + disables the option. The following options can be set from the command line or with the .Ic set builtin (described later). .Bl -tag -width aaaallexportfoo -offset indent .It Fl a Em allexport Export all variables assigned to. .It Fl c Read commands from the .Ar command_string operand instead of from the standard input. Special parameter 0 will be set from the .Ar command_name operand and the positional parameters ($1, $2, etc.) set from the remaining argument operands. .It Fl C Em noclobber Don't overwrite existing files with .Dq \*[Gt] . .It Fl e Em errexit If not interactive, exit immediately if any untested command fails. The exit status of a command is considered to be explicitly tested if the command is used to control an .Ic if , .Ic elif , .Ic while , or .Ic until ; or if the command is the left hand operand of an .Dq \*[Am]\*[Am] or .Dq || operator. .It Fl f Em noglob Disable pathname expansion. .It Fl n Em noexec If not interactive, read commands but do not execute them. This is useful for checking the syntax of shell scripts. .It Fl u Em nounset Write a message to standard error when attempting to expand a variable that is not set, and if the shell is not interactive, exit immediately. .It Fl v Em verbose The shell writes its input to standard error as it is read. Useful for debugging. .It Fl x Em xtrace Write each command to standard error (preceded by a .Sq +\ ) before it is executed. Useful for debugging. .It Fl q Em quietprofile If the .Fl v or .Fl x options have been set, do not apply them when reading initialization files, these being .Pa /etc/profile , .Pa .profile , and the file specified by the .Ev ENV environment variable. .It Fl I Em ignoreeof Ignore EOF's from input when interactive. .It Fl i Em interactive Force the shell to behave interactively. .It Fl m Em monitor Turn on job control (set automatically when interactive). .It Fl s Em stdin Read commands from standard input (set automatically if no file arguments are present). This option has no effect when set after the shell has already started running (i.e. with .Ic set ) . .It Fl V Em vi Enable the built-in .Xr vi 1 command line editor (disables .Fl E if it has been set). (See the .Sx Command Line Editing section below.) .It Fl E Em emacs Enable the built-in emacs style command line editor (disables .Fl V if it has been set). (See the .Sx Command Line Editing section below.) .It Fl b Em notify Enable asynchronous notification of background job completion. (UNIMPLEMENTED for 4.4alpha) .It "\ \ " Em cdprint Make an interactive shell always print the new directory name when changed by the .Ic cd command. .It "\ \ " Em tabcomplete Enables filename completion in the command line editor. Typing a tab character will extend the current input word to match a filename. If more than one filename matches it is only extended to be the common prefix. Typing a second tab character will list all the matching names. .El .Ss Lexical Structure The shell reads input in terms of lines from a file and breaks it up into words at whitespace (blanks and tabs), and at certain sequences of characters that are special to the shell called .Dq operators . There are two types of operators: control operators and redirection operators (their meaning is discussed later). Following is a list of operators: .Bl -ohang -offset indent .It "Control operators:" .Dl \*[Am] \*[Am]\*[Am] \&( \&) \&; ;; | || \*[Lt]newline\*[Gt] .It "Redirection operators:" .Dl \*[Lt] \*[Gt] \*[Gt]| \*[Lt]\*[Lt] \*[Gt]\*[Gt] \*[Lt]\*[Am] \*[Gt]\*[Am] \*[Lt]\*[Lt]- \*[Lt]\*[Gt] .El .Ss Quoting Quoting is used to remove the special meaning of certain characters or words to the shell, such as operators, whitespace, or keywords. There are three types of quoting: matched single quotes, matched double quotes, and backslash. .Ss Backslash A backslash preserves the literal meaning of the following character, with the exception of .Aq newline . A backslash preceding a .Aq newline is treated as a line continuation. .Ss Single Quotes Enclosing characters in single quotes preserves the literal meaning of all the characters (except single quotes, making it impossible to put single-quotes in a single-quoted string). .Ss Double Quotes Enclosing characters within double quotes preserves the literal meaning of all characters except dollarsign .Pq $ , backquote .Pq ` , and backslash .Pq \e . The backslash inside double quotes is historically weird, and serves to quote only the following characters: .Dl $ ` \*q \e \*[Lt]newline\*[Gt] . Otherwise it remains literal. .Ss Reserved Words Reserved words are words that have special meaning to the shell and are recognized at the beginning of a line and after a control operator. The following are reserved words: .Bl -column while while while while while -offset indent .It ! Ta elif Ta fi Ta while Ta case .It else Ta for Ta then Ta { Ta } .It do Ta done Ta until Ta if Ta esac .El .Pp Their meaning is discussed later. .Ss Aliases An alias is a name and corresponding value set using the .Ic alias builtin command. Whenever a reserved word may occur (see above), and after checking for reserved words, the shell checks the word to see if it matches an alias. If it does, it replaces it in the input stream with its value. For example, if there is an alias called .Dq lf with the value .Dq "ls -F" , then the input: .Pp .Dl lf foobar Aq return .Pp would become .Pp .Dl ls -F foobar Aq return .Pp Aliases provide a convenient way for naive users to create shorthands for commands without having to learn how to create functions with arguments. They can also be used to create lexically obscure code. This use is discouraged. .Ss Commands The shell interprets the words it reads according to a language, the specification of which is outside the scope of this man page (refer to the BNF in the .Tn POSIX 1003.2 document). Essentially though, a line is read and if the first word of the line (or after a control operator) is not a reserved word, then the shell has recognized a simple command. Otherwise, a complex command or some other special construct may have been recognized. .Ss Simple Commands If a simple command has been recognized, the shell performs the following actions: .Bl -enum -offset indent .It Leading words of the form .Dq name=value are stripped off and assigned to the environment of the simple command. Redirection operators and their arguments (as described below) are stripped off and saved for processing. .It The remaining words are expanded as described in the section called .Dq Expansions , and the first remaining word is considered the command name and the command is located. The remaining words are considered the arguments of the command. If no command name resulted, then the .Dq name=value variable assignments recognized in item 1 affect the current shell. .It Redirections are performed as described in the next section. .El .Ss Redirections Redirections are used to change where a command reads its input or sends its output. In general, redirections open, close, or duplicate an existing reference to a file. The overall format used for redirection is: .Pp .Dl [n] Va redir-op Ar file .Pp where .Va redir-op is one of the redirection operators mentioned previously. Following is a list of the possible redirections. The .Bq n is an optional number, as in .Sq 3 (not .Sq Bq 3 ) , that refers to a file descriptor. .Bl -tag -width aaabsfiles -offset indent .It [n] Ns \*[Gt] file Redirect standard output (or n) to file. .It [n] Ns \*[Gt]| file Same, but override the .Fl C option. .It [n] Ns \*[Gt]\*[Gt] file Append standard output (or n) to file. .It [n] Ns \*[Lt] file Redirect standard input (or n) from file. .It [n1] Ns \*[Lt]\*[Am] Ns n2 Duplicate standard input (or n1) from file descriptor n2. .It [n] Ns \*[Lt]\*[Am]- Close standard input (or n). .It [n1] Ns \*[Gt]\*[Am] Ns n2 Duplicate standard output (or n1) to n2. .It [n] Ns \*[Gt]\*[Am]- Close standard output (or n). .It [n] Ns \*[Lt]\*[Gt] file Open file for reading and writing on standard input (or n). .El .Pp The following redirection is often called a .Dq here-document . .Bl -item -offset indent .It .Li [n]\*[Lt]\*[Lt] delimiter .Dl here-doc-text ... .Li delimiter .El .Pp All the text on successive lines up to the delimiter is saved away and made available to the command on standard input, or file descriptor n if it is specified. If the delimiter as specified on the initial line is quoted, then the here-doc-text is treated literally, otherwise the text is subjected to parameter expansion, command substitution, and arithmetic expansion (as described in the section on .Dq Expansions ) . If the operator is .Dq \*[Lt]\*[Lt]- instead of .Dq \*[Lt]\*[Lt] , then leading tabs in the here-doc-text are stripped. .Ss Search and Execution There are three types of commands: shell functions, builtin commands, and normal programs -- and the command is searched for (by name) in that order. They each are executed in a different way. .Pp When a shell function is executed, all of the shell positional parameters (except $0, which remains unchanged) are set to the arguments of the shell function. The variables which are explicitly placed in the environment of the command (by placing assignments to them before the function name) are made local to the function and are set to the values given. Then the command given in the function definition is executed. The positional parameters are restored to their original values when the command completes. This all occurs within the current shell. .Pp Shell builtins are executed internally to the shell, without spawning a new process. .Pp Otherwise, if the command name doesn't match a function or builtin, the command is searched for as a normal program in the file system (as described in the next section). When a normal program is executed, the shell runs the program, passing the arguments and the environment to the program. If the program is not a normal executable file (i.e., if it does not begin with the "magic number" whose .Tn ASCII representation is "#!", so .Xr execve 2 returns .Er ENOEXEC then) the shell will interpret the program in a subshell. The child shell will reinitialize itself in this case, so that the effect will be as if a new shell had been invoked to handle the ad-hoc shell script, except that the location of hashed commands located in the parent shell will be remembered by the child. .Pp Note that previous versions of this document and the source code itself misleadingly and sporadically refer to a shell script without a magic number as a "shell procedure". .Ss Path Search When locating a command, the shell first looks to see if it has a shell function by that name. Then it looks for a builtin command by that name. If a builtin command is not found, one of two things happen: .Bl -enum .It Command names containing a slash are simply executed without performing any searches. .It The shell searches each entry in .Ev PATH in turn for the command. The value of the .Ev PATH variable should be a series of entries separated by colons. Each entry consists of a directory name. The current directory may be indicated implicitly by an empty directory name, or explicitly by a single period. .El .Ss Command Exit Status Each command has an exit status that can influence the behavior of other shell commands. The paradigm is that a command exits with zero for normal or success, and non-zero for failure, error, or a false indication. The man page for each command should indicate the various exit codes and what they mean. Additionally, the builtin commands return exit codes, as does an executed shell function. .Pp If a command consists entirely of variable assignments then the exit status of the command is that of the last command substitution if any, otherwise 0. .Ss Complex Commands Complex commands are combinations of simple commands with control operators or reserved words, together creating a larger complex command. More generally, a command is one of the following: .Bl -bullet .It simple command .It pipeline .It list or compound-list .It compound command .It function definition .El .Pp Unless otherwise stated, the exit status of a command is that of the last simple command executed by the command. .Ss Pipelines A pipeline is a sequence of one or more commands separated by the control operator |. The standard output of all but the last command is connected to the standard input of the next command. The standard output of the last command is inherited from the shell, as usual. .Pp The format for a pipeline is: .Pp .Dl [!] command1 [ | command2 ...] .Pp The standard output of command1 is connected to the standard input of command2. The standard input, standard output, or both of a command is considered to be assigned by the pipeline before any redirection specified by redirection operators that are part of the command. .Pp If the pipeline is not in the background (discussed later), the shell waits for all commands to complete. .Pp If the reserved word ! does not precede the pipeline, the exit status is the exit status of the last command specified in the pipeline. Otherwise, the exit status is the logical NOT of the exit status of the last command. That is, if the last command returns zero, the exit status is 1; if the last command returns greater than zero, the exit status is zero. .Pp Because pipeline assignment of standard input or standard output or both takes place before redirection, it can be modified by redirection. For example: .Pp .Dl $ command1 2\*[Gt]\*[Am]1 | command2 .Pp sends both the standard output and standard error of command1 to the standard input of command2. .Pp A ; or .Aq newline terminator causes the preceding AND-OR-list (described next) to be executed sequentially; a \*[Am] causes asynchronous execution of the preceding AND-OR-list. .Pp Note that unlike some other shells, each process in the pipeline is a child of the invoking shell (unless it is a shell builtin, in which case it executes in the current shell -- but any effect it has on the environment is wiped). .Ss Background Commands -- \*[Am] If a command is terminated by the control operator ampersand (\*[Am]), the shell executes the command asynchronously -- that is, the shell does not wait for the command to finish before executing the next command. .Pp The format for running a command in background is: .Pp .Dl command1 \*[Am] [command2 \*[Am] ...] .Pp If the shell is not interactive, the standard input of an asynchronous command is set to .Pa /dev/null . .Ss Lists -- Generally Speaking A list is a sequence of zero or more commands separated by newlines, semicolons, or ampersands, and optionally terminated by one of these three characters. The commands in a list are executed in the order they are written. If command is followed by an ampersand, the shell starts the command and immediately proceed onto the next command; otherwise it waits for the command to terminate before proceeding to the next one. .Ss Short-Circuit List Operators .Dq \*[Am]\*[Am] and .Dq || are AND-OR list operators. .Dq \*[Am]\*[Am] executes the first command, and then executes the second command if and only if the exit status of the first command is zero. .Dq || is similar, but executes the second command if and only if the exit status of the first command is nonzero. .Dq \*[Am]\*[Am] and .Dq || both have the same priority. Note that these operators are left-associative, so .Dq true || echo bar && echo baz writes .Dq baz and nothing else. This is not the way it works in C. .Ss Flow-Control Constructs -- if, while, for, case The syntax of the if command is .Bd -literal -offset indent if list then list [ elif list then list ] ... [ else list ] fi .Ed .Pp The syntax of the while command is .Bd -literal -offset indent while list do list done .Ed .Pp The two lists are executed repeatedly while the exit status of the first list is zero. The until command is similar, but has the word until in place of while, which causes it to repeat until the exit status of the first list is zero. .Pp The syntax of the for command is .Bd -literal -offset indent for variable in word ... do list done .Ed .Pp The words are expanded, and then the list is executed repeatedly with the variable set to each word in turn. do and done may be replaced with .Dq { and .Dq } . .Pp The syntax of the break and continue command is .Bd -literal -offset indent break [ num ] continue [ num ] .Ed .Pp Break terminates the num innermost for or while loops. Continue continues with the next iteration of the innermost loop. These are implemented as builtin commands. .Pp The syntax of the case command is .Bd -literal -offset indent case word in pattern) list ;; \&... esac .Ed .Pp The pattern can actually be one or more patterns (see .Sx Shell Patterns described later), separated by .Dq \*(Ba characters. .Ss Grouping Commands Together Commands may be grouped by writing either .Pp .Dl (list) .Pp or .Pp .Dl { list; } .Pp The first of these executes the commands in a subshell. Builtin commands grouped into a (list) will not affect the current shell. The second form does not fork another shell so is slightly more efficient. Grouping commands together this way allows you to redirect their output as though they were one program: .Pp .Bd -literal -offset indent { echo -n \*q hello \*q ; echo \*q world" ; } \*[Gt] greeting .Ed .Pp Note that .Dq } must follow a control operator (here, .Dq \&; ) so that it is recognized as a reserved word and not as another command argument. .Ss Functions The syntax of a function definition is .Pp .Dl name ( ) command .Pp A function definition is an executable statement; when executed it installs a function named name and returns an exit status of zero. The command is normally a list enclosed between .Dq { and .Dq } . .Pp Variables may be declared to be local to a function by using a local command. This should appear as the first statement of a function, and the syntax is .Pp .Dl local [ variable | - ] ... .Pp Local is implemented as a builtin command. .Pp When a variable is made local, it inherits the initial value and exported and readonly flags from the variable with the same name in the surrounding scope, if there is one. Otherwise, the variable is initially unset. The shell uses dynamic scoping, so that if you make the variable x local to function f, which then calls function g, references to the variable x made inside g will refer to the variable x declared inside f, not to the global variable named x. .Pp The only special parameter that can be made local is .Dq - . Making .Dq - local any shell options that are changed via the set command inside the function to be restored to their original values when the function returns. .Pp The syntax of the return command is .Pp .Dl return [ exitstatus ] .Pp It terminates the currently executing function. Return is implemented as a builtin command. .Ss Variables and Parameters The shell maintains a set of parameters. A parameter denoted by a name is called a variable. When starting up, the shell turns all the environment variables into shell variables. New variables can be set using the form .Pp .Dl name=value .Pp Variables set by the user must have a name consisting solely of alphabetics, numerics, and underscores - the first of which must not be numeric. A parameter can also be denoted by a number or a special character as explained below. .Ss Positional Parameters A positional parameter is a parameter denoted by a number (n \*[Gt] 0). The shell sets these initially to the values of its command line arguments that follow the name of the shell script. The .Ic set builtin can also be used to set or reset them. .Ss Special Parameters A special parameter is a parameter denoted by one of the following special characters. The value of the parameter is listed next to its character. .Bl -tag -width thinhyphena .It * Expands to the positional parameters, starting from one. When the expansion occurs within a double-quoted string it expands to a single field with the value of each parameter separated by the first character of the .Ev IFS variable, or by a .Aq space if .Ev IFS is unset. .It @ Expands to the positional parameters, starting from one. When the expansion occurs within double-quotes, each positional parameter expands as a separate argument. If there are no positional parameters, the expansion of @ generates zero arguments, even when @ is double-quoted. What this basically means, for example, is if $1 is .Dq abc and $2 is .Dq def ghi , then .Qq $@ expands to the two arguments: .Pp .Sm off .Dl \*q abc \*q \ \*q def\ ghi \*q .Sm on .It # Expands to the number of positional parameters. .It \&? Expands to the exit status of the most recent pipeline. .It - (Hyphen.) Expands to the current option flags (the single-letter option names concatenated into a string) as specified on invocation, by the set builtin command, or implicitly by the shell. .It $ Expands to the process ID of the invoked shell. A subshell retains the same value of $ as its parent. .It \&! Expands to the process ID of the most recent background command executed from the current shell. For a pipeline, the process ID is that of the last command in the pipeline. .It 0 (Zero.) Expands to the name of the shell or shell script. .El .Ss Word Expansions This clause describes the various expansions that are performed on words. Not all expansions are performed on every word, as explained later. .Pp Tilde expansions, parameter expansions, command substitutions, arithmetic expansions, and quote removals that occur within a single word expand to a single field. It is only field splitting or pathname expansion that can create multiple fields from a single word. The single exception to this rule is the expansion of the special parameter @ within double-quotes, as was described above. .Pp The order of word expansion is: .Bl -enum .It Tilde Expansion, Parameter Expansion, Command Substitution, Arithmetic Expansion (these all occur at the same time). .It Field Splitting is performed on fields generated by step (1) unless the .Ev IFS variable is null. .It Pathname Expansion (unless set .Fl f is in effect). .It Quote Removal. .El .Pp The $ character is used to introduce parameter expansion, command substitution, or arithmetic evaluation. .Ss Tilde Expansion (substituting a user's home directory) A word beginning with an unquoted tilde character (~) is subjected to tilde expansion. All the characters up to a slash (/) or the end of the word are treated as a username and are replaced with the user's home directory. If the username is missing (as in .Pa ~/foobar ) , the tilde is replaced with the value of the .Va HOME variable (the current user's home directory). .Ss Parameter Expansion The format for parameter expansion is as follows: .Pp .Dl ${expression} .Pp where expression consists of all characters until the matching .Dq } . Any .Dq } escaped by a backslash or within a quoted string, and characters in embedded arithmetic expansions, command substitutions, and variable expansions, are not examined in determining the matching .Dq } . .Pp The simplest form for parameter expansion is: .Pp .Dl ${parameter} .Pp The value, if any, of parameter is substituted. .Pp The parameter name or symbol can be enclosed in braces, which are optional except for positional parameters with more than one digit or when parameter is followed by a character that could be interpreted as part of the name. If a parameter expansion occurs inside double-quotes: .Bl -enum .It Pathname expansion is not performed on the results of the expansion. .It Field splitting is not performed on the results of the expansion, with the exception of the special rules for @. .El .Pp In addition, a parameter expansion can be modified by using one of the following formats. .Bl -tag -width aaparameterwordaaaaa .It ${parameter:-word} Use Default Values. If parameter is unset or null, the expansion of word is substituted; otherwise, the value of parameter is substituted. .It ${parameter:=word} Assign Default Values. If parameter is unset or null, the expansion of word is assigned to parameter. In all cases, the final value of parameter is substituted. Only variables, not positional parameters or special parameters, can be assigned in this way. .It ${parameter:?[word]} Indicate Error if Null or Unset. If parameter is unset or null, the expansion of word (or a message indicating it is unset if word is omitted) is written to standard error and the shell exits with a nonzero exit status. Otherwise, the value of parameter is substituted. An interactive shell need not exit. .It ${parameter:+word} Use Alternative Value. If parameter is unset or null, null is substituted; otherwise, the expansion of word is substituted. .El .Pp In the parameter expansions shown previously, use of the colon in the format results in a test for a parameter that is unset or null; omission of the colon results in a test for a parameter that is only unset. .Bl -tag -width aaparameterwordaaaaa .It ${#parameter} String Length. The length in characters of the value of parameter. .El .Pp The following four varieties of parameter expansion provide for substring processing. In each case, pattern matching notation (see .Sx Shell Patterns ) , rather than regular expression notation, is used to evaluate the patterns. If parameter is * or @, the result of the expansion is unspecified. Enclosing the full parameter expansion string in double-quotes does not cause the following four varieties of pattern characters to be quoted, whereas quoting characters within the braces has this effect. .Bl -tag -width aaparameterwordaaaaa .It ${parameter%word} Remove Smallest Suffix Pattern. The word is expanded to produce a pattern. The parameter expansion then results in parameter, with the smallest portion of the suffix matched by the pattern deleted. .It ${parameter%%word} Remove Largest Suffix Pattern. The word is expanded to produce a pattern. The parameter expansion then results in parameter, with the largest portion of the suffix matched by the pattern deleted. .It ${parameter#word} Remove Smallest Prefix Pattern. The word is expanded to produce a pattern. The parameter expansion then results in parameter, with the smallest portion of the prefix matched by the pattern deleted. .It ${parameter##word} Remove Largest Prefix Pattern. The word is expanded to produce a pattern. The parameter expansion then results in parameter, with the largest portion of the prefix matched by the pattern deleted. .El .Ss Command Substitution Command substitution allows the output of a command to be substituted in place of the command name itself. Command substitution occurs when the command is enclosed as follows: .Pp .Dl $(command) .Pp or .Po .Dq backquoted version .Pc : .Pp .Dl `command` .Pp The shell expands the command substitution by executing command in a subshell environment and replacing the command substitution with the standard output of the command, removing sequences of one or more .Ao newline Ac Ns s at the end of the substitution. (Embedded .Ao newline Ac Ns s before the end of the output are not removed; however, during field splitting, they may be translated into .Ao space Ac Ns s , depending on the value of .Ev IFS and quoting that is in effect.) .Ss Arithmetic Expansion Arithmetic expansion provides a mechanism for evaluating an arithmetic expression and substituting its value. The format for arithmetic expansion is as follows: .Pp .Dl $((expression)) .Pp The expression is treated as if it were in double-quotes, except that a double-quote inside the expression is not treated specially. The shell expands all tokens in the expression for parameter expansion, command substitution, and quote removal. .Pp Next, the shell treats this as an arithmetic expression and substitutes the value of the expression. .Ss White Space Splitting (Field Splitting) After parameter expansion, command substitution, and arithmetic expansion the shell scans the results of expansions and substitutions that did not occur in double-quotes for field splitting and multiple fields can result. .Pp The shell treats each character of the .Ev IFS as a delimiter and use the delimiters to split the results of parameter expansion and command substitution into fields. .Pp Non-whitespace characters in .Ev IFS are treated strictly as parameter terminators. So adjacent non-whitespace .Ev IFS characters will produce empty parameters. .Pp If .Ev IFS is unset it is assumed to contain space, tab, and newline. .Ss Pathname Expansion (File Name Generation) Unless the .Fl f flag is set, file name generation is performed after word splitting is complete. Each word is viewed as a series of patterns, separated by slashes. The process of expansion replaces the word with the names of all existing files whose names can be formed by replacing each pattern with a string that matches the specified pattern. There are two restrictions on this: first, a pattern cannot match a string containing a slash, and second, a pattern cannot match a string starting with a period unless the first character of the pattern is a period. The next section describes the patterns used for both Pathname Expansion and the .Ic case command. .Ss Shell Patterns A pattern consists of normal characters, which match themselves, and meta-characters. The meta-characters are .Dq \&! , .Dq * , .Dq \&? , and .Dq \&[ . These characters lose their special meanings if they are quoted. When command or variable substitution is performed and the dollar sign or back quotes are not double quoted, the value of the variable or the output of the command is scanned for these characters and they are turned into meta-characters. .Pp An asterisk .Pq Dq * matches any string of characters. A question mark matches any single character. A left bracket .Pq Dq \&[ introduces a character class. The end of the character class is indicated by a .Pq Dq \&] ; if the .Dq \&] is missing then the .Dq \&[ matches a .Dq \&[ rather than introducing a character class. A character class matches any of the characters between the square brackets. A range of characters may be specified using a minus sign. The character class may be complemented by making an exclamation point the first character of the character class. .Pp To include a .Dq \&] in a character class, make it the first character listed (after the .Dq \&! , if any). To include a minus sign, make it the first or last character listed. .Ss Builtins This section lists the builtin commands which are builtin because they need to perform some operation that can't be performed by a separate process. In addition to these, there are several other commands that may be builtin for efficiency (e.g. .Xr printf 1 , .Xr echo 1 , .Xr test 1 , etc). .Bl -tag -width 5n .It : A null command that returns a 0 (true) exit value. .It \&. file The commands in the specified file are read and executed by the shell. .It alias Op Ar name Ns Op Ar "=string ..." If .Ar name=string is specified, the shell defines the alias .Ar name with value .Ar string . If just .Ar name is specified, the value of the alias .Ar name is printed. With no arguments, the .Ic alias builtin prints the names and values of all defined aliases (see .Ic unalias ) . .It bg [ Ar job ] ... Continue the specified jobs (or the current job if no jobs are given) in the background. .It Xo command .Op Fl p .Op Fl v .Op Fl V .Ar command .Op Ar arg ... .Xc Execute the specified command but ignore shell functions when searching for it. (This is useful when you have a shell function with the same name as a builtin command.) .Bl -tag -width 5n .It Fl p search for command using a .Ev PATH that guarantees to find all the standard utilities. .It Fl V Do not execute the command but search for the command and print the resolution of the command search. This is the same as the type builtin. .It Fl v Do not execute the command but search for the command and print the absolute pathname of utilities, the name for builtins or the expansion of aliases. .El .It cd Op Ar directory Op Ar replace Switch to the specified directory (default .Ev $HOME ) . If .Ar replace is specified, then the new directory name is generated by replacing the first occurrence of .Ar directory in the current directory name with .Ar replace . Otherwise if an entry for .Ev CDPATH appears in the environment of the .Ic cd command or the shell variable .Ev CDPATH is set and the directory name does not begin with a slash, then the directories listed in .Ev CDPATH will be searched for the specified directory. The format of .Ev CDPATH is the same as that of .Ev PATH . In an interactive shell, the .Ic cd command will print out the name of the directory that it actually switched to if this is different from the name that the user gave. These may be different either because the .Ev CDPATH mechanism was used or because a symbolic link was crossed. .It eval Ar string ... Concatenate all the arguments with spaces. Then re-parse and execute the command. .It exec Op Ar command arg ... Unless command is omitted, the shell process is replaced with the specified program (which must be a real program, not a shell builtin or function). Any redirections on the .Ic exec command are marked as permanent, so that they are not undone when the .Ic exec command finishes. .It exit Op Ar exitstatus Terminate the shell process. If .Ar exitstatus is given it is used as the exit status of the shell; otherwise the exit status of the preceding command is used. .It export Ar name ... .It export Fl p The specified names are exported so that they will appear in the environment of subsequent commands. The only way to un-export a variable is to unset it. The shell allows the value of a variable to be set at the same time it is exported by writing .Pp .Dl export name=value .Pp With no arguments the export command lists the names of all exported variables. With the .Fl p option specified the output will be formatted suitably for non-interactive use. .It Xo fc Op Fl e Ar editor .Op Ar first Op Ar last .Xc .It Xo fc Fl l .Op Fl nr .Op Ar first Op Ar last .Xc .It Xo fc Fl s Op Ar old=new .Op Ar first .Xc The .Ic fc builtin lists, or edits and re-executes, commands previously entered to an interactive shell. .Bl -tag -width 5n .It Fl e No editor Use the editor named by editor to edit the commands. The editor string is a command name, subject to search via the .Ev PATH variable. The value in the .Ev FCEDIT variable is used as a default when .Fl e is not specified. If .Ev FCEDIT is null or unset, the value of the .Ev EDITOR variable is used. If .Ev EDITOR is null or unset, .Xr ed 1 is used as the editor. .It Fl l No (ell) List the commands rather than invoking an editor on them. The commands are written in the sequence indicated by the first and last operands, as affected by .Fl r , with each command preceded by the command number. .It Fl n Suppress command numbers when listing with -l. .It Fl r Reverse the order of the commands listed (with .Fl l ) or edited (with neither .Fl l nor .Fl s ) . .It Fl s Re-execute the command without invoking an editor. .It first .It last Select the commands to list or edit. The number of previous commands that can be accessed are determined by the value of the .Ev HISTSIZE variable. The value of first or last or both are one of the following: .Bl -tag -width 5n .It [+]number A positive number representing a command number; command numbers can be displayed with the .Fl l option. .It Fl number A negative decimal number representing the command that was executed number of commands previously. For example, \-1 is the immediately previous command. .El .It string A string indicating the most recently entered command that begins with that string. If the old=new operand is not also specified with .Fl s , the string form of the first operand cannot contain an embedded equal sign. .El .Pp The following environment variables affect the execution of fc: .Bl -tag -width HISTSIZE .It Ev FCEDIT Name of the editor to use. .It Ev HISTSIZE The number of previous commands that are accessible. .El .It fg Op Ar job Move the specified job or the current job to the foreground. .It getopts Ar optstring var The .Tn POSIX .Ic getopts command, not to be confused with the .Em Bell Labs -derived .Xr getopt 1 . .Pp The first argument should be a series of letters, each of which may be optionally followed by a colon to indicate that the option requires an argument. The variable specified is set to the parsed option. .Pp The .Ic getopts command deprecates the older .Xr getopt 1 utility due to its handling of arguments containing whitespace. .Pp The .Ic getopts builtin may be used to obtain options and their arguments from a list of parameters. When invoked, .Ic getopts places the value of the next option from the option string in the list in the shell variable specified by .Va var and its index in the shell variable .Ev OPTIND . When the shell is invoked, .Ev OPTIND is initialized to 1. For each option that requires an argument, the .Ic getopts builtin will place it in the shell variable .Ev OPTARG . If an option is not allowed for in the .Va optstring , then .Ev OPTARG will be unset. .Pp .Va optstring is a string of recognized option letters (see .Xr getopt 3 ) . If a letter is followed by a colon, the option is expected to have an argument which may or may not be separated from it by whitespace. If an option character is not found where expected, .Ic getopts will set the variable .Va var to a .Dq \&? ; .Ic getopts will then unset .Ev OPTARG and write output to standard error. By specifying a colon as the first character of .Va optstring all errors will be ignored. .Pp A nonzero value is returned when the last option is reached. If there are no remaining arguments, .Ic getopts will set .Va var to the special option, .Dq -- , otherwise, it will set .Va var to .Dq \&? . .Pp The following code fragment shows how one might process the arguments for a command that can take the options .Op a and .Op b , and the option .Op c , which requires an argument. .Pp .Bd -literal -offset indent while getopts abc: f do case $f in a | b) flag=$f;; c) carg=$OPTARG;; \\?) echo $USAGE; exit 1;; esac done shift `expr $OPTIND - 1` .Ed .Pp This code will accept any of the following as equivalent: .Pp .Bd -literal -offset indent cmd \-acarg file file cmd \-a \-c arg file file cmd \-carg -a file file cmd \-a \-carg \-\- file file .Ed .It hash Fl rv Ar command ... The shell maintains a hash table which remembers the locations of commands. With no arguments whatsoever, the .Ic hash command prints out the contents of this table. Entries which have not been looked at since the last .Ic cd command are marked with an asterisk; it is possible for these entries to be invalid. .Pp With arguments, the .Ic hash command removes the specified commands from the hash table (unless they are functions) and then locates them. With the .Fl v option, hash prints the locations of the commands as it finds them. The .Fl r option causes the hash command to delete all the entries in the hash table except for functions. .It inputrc Ar file Read the .Va file to set keybindings as defined by .Xr editrc 5 . .It jobid Op Ar job Print the process id's of the processes in the job. If the .Ar job argument is omitted, the current job is used. .It jobs This command lists out all the background processes which are children of the current shell process. .It pwd Op Fl LP Print the current directory. If .Fl L is specified the cached value (initially set from .Ev PWD ) is checked to see if it refers to the current directory, if it does the value is printed. Otherwise the current directory name is found using .Xr getcwd(3) . The environment variable .Ev PWD is set to printed value. .Pp The default is .Ic pwd .Fl L , but note that the builtin .Ic cd command doesn't currently support .Fl L or .Fl P and will cache (almost) the absolute path. If .Ic cd is changed, .Ic pwd may be changed to default to .Ic pwd .Fl P . .Pp If the current directory is renamed and replaced by a symlink to the same directory, or the initial .Ev PWD value followed a symbolic link, then the cached value may not be the absolute path. .Pp The builtin command may differ from the program of the same name because the program will use .Ev PWD and the builtin uses a separately cached value. .It Xo read Op Fl p Ar prompt .Op Fl r .Ar variable .Op Ar ... .Xc The prompt is printed if the .Fl p option is specified and the standard input is a terminal. Then a line is read from the standard input. The trailing newline is deleted from the line and the line is split as described in the section on word splitting above, and the pieces are assigned to the variables in order. If there are more pieces than variables, the remaining pieces (along with the characters in .Ev IFS that separated them) are assigned to the last variable. If there are more variables than pieces, the remaining variables are assigned the null string. The .Ic read builtin will indicate success unless EOF is encountered on input, in which case failure is returned. .Pp By default, unless the .Fl r option is specified, the backslash .Dq \e acts as an escape character, causing the following character to be treated literally. If a backslash is followed by a newline, the backslash and the newline will be deleted. .It readonly Ar name ... .It readonly Fl p The specified names are marked as read only, so that they cannot be subsequently modified or unset. The shell allows the value of a variable to be set at the same time it is marked read only by writing .Pp .Dl readonly name=value .Pp With no arguments the readonly command lists the names of all read only variables. With the .Fl p option specified the output will be formatted suitably for non-interactive use. .Pp .It Xo set .Oo { .Fl options | Cm +options | Cm -- } .Oc Ar arg ... .Xc The .Ic set command performs three different functions. .Pp With no arguments, it lists the values of all shell variables. .Pp If options are given, it sets the specified option flags, or clears them as described in the section called .Sx Argument List Processing . .Pp The third use of the set command is to set the values of the shell's positional parameters to the specified args. To change the positional parameters without changing any options, use .Dq -- as the first argument to set. If no args are present, the set command will clear all the positional parameters (equivalent to executing .Dq shift $# . ) .It setvar Ar variable Ar value Assigns value to variable. (In general it is better to write variable=value rather than using .Ic setvar . .Ic setvar is intended to be used in functions that assign values to variables whose names are passed as parameters.) .It shift Op Ar n Shift the positional parameters n times. A .Ic shift sets the value of .Va $1 to the value of .Va $2 , the value of .Va $2 to the value of .Va $3 , and so on, decreasing the value of .Va $# by one. If there are zero positional parameters, .Ic shift does nothing. .It Xo trap .Op Fl l .Xc .It Xo trap .Op Ar action .Ar signal ... .Xc Cause the shell to parse and execute action when any of the specified signals are received. The signals are specified by signal number or as the name of the signal. If .Ar signal is .Li 0 , the action is executed when the shell exits. .Ar action may be null, which cause the specified signals to be ignored. With .Ar action omitted or set to `-' the specified signals are set to their default action. When the shell forks off a subshell, it resets trapped (but not ignored) signals to the default action. The .Ic trap command has no effect on signals that were ignored on entry to the shell. Issuing .Ic trap with option .Ar -l will print a list of valid signal names. .Ic trap without any arguments cause it to write a list of signals and their associated action to the standard output in a format that is suitable as an input to the shell that achieves the same trapping results. .Pp Examples: .Pp .Dl trap .Pp List trapped signals and their corresponding action .Pp .Dl trap -l .Pp Print a list of valid signals .Pp .Dl trap '' INT QUIT tstp 30 .Pp Ignore signals INT QUIT TSTP USR1 .Pp .Dl trap date INT .Pp Print date upon receiving signal INT .It type Op Ar name ... Interpret each name as a command and print the resolution of the command search. Possible resolutions are: shell keyword, alias, shell builtin, command, tracked alias and not found. For aliases the alias expansion is printed; for commands and tracked aliases the complete pathname of the command is printed. .It ulimit Xo .Op Fl H \*(Ba Fl S .Op Fl a \*(Ba Fl tfdscmlpn Op Ar value .Xc Inquire about or set the hard or soft limits on processes or set new limits. The choice between hard limit (which no process is allowed to violate, and which may not be raised once it has been lowered) and soft limit (which causes processes to be signaled but not necessarily killed, and which may be raised) is made with these flags: .Bl -tag -width Fl .It Fl H set or inquire about hard limits .It Fl S set or inquire about soft limits. If neither .Fl H nor .Fl S is specified, the soft limit is displayed or both limits are set. If both are specified, the last one wins. .El .Pp .Bl -tag -width Fl The limit to be interrogated or set, then, is chosen by specifying any one of these flags: .It Fl a show all the current limits .It Fl b show or set the limit on the socket buffer size of a process (in bytes) .It Fl t show or set the limit on CPU time (in seconds) .It Fl f show or set the limit on the largest file that can be created (in 512-byte blocks) .It Fl d show or set the limit on the data segment size of a process (in kilobytes) .It Fl s show or set the limit on the stack size of a process (in kilobytes) .It Fl c show or set the limit on the largest core dump size that can be produced (in 512-byte blocks) .It Fl m show or set the limit on the total physical memory that can be in use by a process (in kilobytes) .It Fl l show or set the limit on how much memory a process can lock with .Xr mlock 2 (in kilobytes) .It Fl p show or set the limit on the number of processes this user can have at one time .It Fl n show or set the limit on the number of files a process can have open at once .El .Pp If none of these is specified, it is the limit on file size that is shown or set. If value is specified, the limit is set to that number; otherwise the current limit is displayed. .Pp Limits of an arbitrary process can be displayed or set using the .Xr sysctl 8 utility. .Pp .It umask Op Ar mask Set the value of umask (see .Xr umask 2 ) to the specified octal value. If the argument is omitted, the umask value is printed. .It unalias Xo .Op Fl a .Op Ar name .Xc If .Ar name is specified, the shell removes that alias. If .Fl a is specified, all aliases are removed. .It unset Ar name ... The specified variables and functions are unset and unexported. If a given name corresponds to both a variable and a function, both the variable and the function are unset. .It wait Op Ar job Wait for the specified job to complete and return the exit status of the last process in the job. If the argument is omitted, wait for all jobs to complete and then return an exit status of zero. .El .Ss Command Line Editing When .Nm is being used interactively from a terminal, the current command and the command history (see .Ic fc in .Sx Builtins ) can be edited using emacs-mode or vi-mode command-line editing. The command .Ql set -o emacs enables emacs-mode editing. The command .Ql set -o vi enables vi-mode editing and places sh into vi insert mode. (See the .Sx Argument List Processing section above.) .Pp The vi mode uses commands similar to a subset of those described in the .Xr vi 1 man page. With vi-mode enabled, sh can be switched between insert mode and command mode. It's similar to vi: typing .Aq ESC will throw you into command VI command mode. Hitting .Aq return while in command mode will pass the line to the shell. .Pp The emacs mode uses commands similar to a subset available in the emacs editor. With emacs-mode enabled, special keys can be used to modify the text in the buffer using the control key. .Pp .Nm uses the .Xr editline 3 library. .Sh EXIT STATUS Errors that are detected by the shell, such as a syntax error, will cause the shell to exit with a non-zero exit status. If the shell is not an interactive shell, the execution of the shell file will be aborted. Otherwise the shell will return the exit status of the last command executed, or if the exit builtin is used with a numeric argument, it will return the argument. .Sh ENVIRONMENT .Bl -tag -width MAILCHECK .It Ev HOME Set automatically by .Xr login 1 from the user's login directory in the password file .Pq Xr passwd 5 . This environment variable also functions as the default argument for the cd builtin. .It Ev PATH The default search path for executables. See the above section .Sx Path Search . .It Ev CDPATH The search path used with the cd builtin. .It Ev LANG The string used to specify localization information that allows users to work with different culture-specific and language conventions. See .Xr nls 7 . .It Ev MAIL The name of a mail file, that will be checked for the arrival of new mail. Overridden by .Ev MAILPATH . .It Ev MAILCHECK The frequency in seconds that the shell checks for the arrival of mail in the files specified by the .Ev MAILPATH or the .Ev MAIL file. If set to 0, the check will occur at each prompt. .It Ev MAILPATH A colon .Dq \&: separated list of file names, for the shell to check for incoming mail. This environment setting overrides the .Ev MAIL setting. There is a maximum of 10 mailboxes that can be monitored at once. .It Ev PS1 The primary prompt string, which defaults to .Dq $ \ , unless you are the superuser, in which case it defaults to .Dq # \ . .It Ev PS2 The secondary prompt string, which defaults to .Dq \*[Gt] \ . .It Ev PS4 Output before each line when execution trace (set -x) is enabled, defaults to .Dq + \ . .It Ev IFS Input Field Separators. This is normally set to .Aq space , .Aq tab , and .Aq newline . See the .Sx White Space Splitting section for more details. .It Ev TERM The default terminal setting for the shell. This is inherited by children of the shell, and is used in the history editing modes. .It Ev HISTSIZE The number of lines in the history buffer for the shell. .El .Sh FILES .Bl -item -width HOMEprofilexxxx .It .Pa $HOME/.profile .It .Pa /etc/profile .El .Sh SEE ALSO .Xr csh 1 , .Xr echo 1 , .Xr getopt 1 , .Xr ksh 1 , .Xr login 1 , .Xr printf 1 , .Xr test 1 , .Xr editline 3 , .Xr getopt 3 , .\" .Xr profile 4 , .Xr editrc 5 , .Xr passwd 5 , .Xr environ 7 , .Xr nls 7 , .Xr sysctl 8 .Sh HISTORY A .Nm command appeared in .At v1 . It was, however, unmaintainable so we wrote this one. .Sh BUGS Setuid shell scripts should be avoided at all costs, as they are a significant security risk. .Pp PS1, PS2, and PS4 should be subject to parameter expansion before being displayed. .Pp The characters generated by filename completion should probably be quoted to ensure that the filename is still valid after the input line has been processed. kbuild-3608/src/kash/eval.c0000664000175000017500000010712114670377416015537 0ustar locutuslocutus/* $NetBSD: eval.c,v 1.84 2005/06/23 23:05:29 christos Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; #else __RCSID("$NetBSD: eval.c,v 1.84 2005/06/23 23:05:29 christos Exp $"); #endif /* not lint */ #endif #include #include #include #include #ifdef HAVE_SYSCTL_H # ifdef __OpenBSD__ /* joyful crap */ # include # undef psh # endif # include #endif /* * Evaluate a command. */ #include "shell.h" #include "nodes.h" #include "syntax.h" #include "expand.h" #include "parser.h" #include "jobs.h" #include "eval.h" #include "builtins.h" #include "options.h" #include "exec.h" #include "redir.h" #include "input.h" #include "output.h" #include "trap.h" #include "var.h" #include "memalloc.h" #include "error.h" #include "show.h" #include "mystring.h" #include "main.h" #ifndef SMALL # include "myhistedit.h" #endif #include "shinstance.h" /* flags in argument to evaltree */ #define EV_EXIT 01 /* exit after evaluating tree */ #define EV_TESTED 02 /* exit status is checked; ignore -e flag */ #define EV_BACKCMD 04 /* command executing within back quotes */ /*int evalskip;*/ /* set if we are skipping commands */ /*STATIC int skipcount;*/ /* number of levels to skip */ /*MKINIT int loopnest;*/ /* current loop nesting level */ /*int funcnest;*/ /* depth of function calls */ /*char *commandname;*/ /*struct strlist *cmdenviron;*/ /*int exitstatus;*/ /* exit status of last command */ /*int back_exitstatus;*/ /* exit status of backquoted command */ STATIC void evalloop(shinstance *, union node *, int); STATIC void evalfor(shinstance *, union node *, int); STATIC void evalcase(shinstance *, union node *, int); STATIC void evalsubshell(shinstance *, union node *, int); STATIC unsigned expredir(shinstance *, union node *); STATIC void evalpipe(shinstance *, union node *); STATIC void evalcommand(shinstance *, union node *, int, struct backcmd *); STATIC void prehash(shinstance *, union node *); /* * Called to reset things after an exception. */ #ifdef mkinit INCLUDE "eval.h" RESET { psh->evalskip = 0; psh->loopnest = 0; psh->funcnest = 0; } SHELLPROC { psh->exitstatus = 0; } #endif static int sh_pipe(shinstance *psh, int fds[2]) { int nfd; if (shfile_pipe(&psh->fdtab, fds)) return -1; if (fds[0] < 3) { nfd = shfile_fcntl(&psh->fdtab, fds[0], F_DUPFD, 3); if (nfd != -1) { shfile_close(&psh->fdtab, fds[0]); fds[0] = nfd; } } if (fds[1] < 3) { nfd = shfile_fcntl(&psh->fdtab, fds[1], F_DUPFD, 3); if (nfd != -1) { shfile_close(&psh->fdtab, fds[1]); fds[1] = nfd; } } return 0; } /* * The eval commmand. */ int evalcmd(shinstance *psh, int argc, char **argv) { char *p; char *concat; char **ap; if (argc > 1) { p = argv[1]; if (argc > 2) { STARTSTACKSTR(psh, concat); ap = argv + 2; for (;;) { while (*p) STPUTC(psh, *p++, concat); if ((p = *ap++) == NULL) break; STPUTC(psh, ' ', concat); } STPUTC(psh, '\0', concat); p = grabstackstr(psh, concat); } evalstring(psh, p, EV_TESTED); } return psh->exitstatus; } /* * Execute a command or commands contained in a string. */ void evalstring(shinstance *psh, char *s, int flag) { union node *n; struct stackmark smark; setstackmark(psh, &smark); setinputstring(psh, s, 1); while ((n = parsecmd(psh, 0)) != NEOF) { evaltree(psh, n, flag); popstackmark(psh, &smark); } popfile(psh); popstackmark(psh, &smark); } /* * Evaluate a parse tree. The value is left in the global variable * exitstatus. */ void evaltree(shinstance *psh, union node *n, int flags) { if (n == NULL) { TRACE((psh, "evaltree(NULL) called\n")); psh->exitstatus = 0; goto out; } #ifndef SMALL psh->displayhist = 1; /* show history substitutions done with fc */ #endif TRACE((psh, "pid %" SHPID_PRI ", evaltree(%p: %d, %d) called\n", sh_getpid(psh), n, n->type, flags)); switch (n->type) { case NSEMI: evaltree(psh, n->nbinary.ch1, flags & EV_TESTED); if (psh->evalskip) goto out; evaltree(psh, n->nbinary.ch2, flags); break; case NAND: evaltree(psh, n->nbinary.ch1, EV_TESTED); if (psh->evalskip || psh->exitstatus != 0) goto out; evaltree(psh, n->nbinary.ch2, flags); break; case NOR: evaltree(psh, n->nbinary.ch1, EV_TESTED); if (psh->evalskip || psh->exitstatus == 0) goto out; evaltree(psh, n->nbinary.ch2, flags); break; case NREDIR: { unsigned const oldfnames = expredir(psh, n->nredir.redirect); redirect(psh, n->nredir.redirect, REDIR_PUSH); evaltree(psh, n->nredir.n, flags); popredir(psh); expredircleanup(psh, oldfnames); break; } case NSUBSHELL: evalsubshell(psh, n, flags); break; case NBACKGND: evalsubshell(psh, n, flags); break; case NIF: { evaltree(psh, n->nif.test, EV_TESTED); if (psh->evalskip) goto out; if (psh->exitstatus == 0) evaltree(psh, n->nif.ifpart, flags); else if (n->nif.elsepart) evaltree(psh, n->nif.elsepart, flags); else psh->exitstatus = 0; break; } case NWHILE: case NUNTIL: evalloop(psh, n, flags); break; case NFOR: evalfor(psh, n, flags); break; case NCASE: evalcase(psh, n, flags); break; case NDEFUN: defun(psh, n->narg.text, n->narg.next); psh->exitstatus = 0; break; case NNOT: evaltree(psh, n->nnot.com, EV_TESTED); psh->exitstatus = !psh->exitstatus; break; case NPIPE: evalpipe(psh, n); break; case NCMD: evalcommand(psh, n, flags, (struct backcmd *)NULL); break; default: out1fmt(psh, "Node type = %d\n", n->type); flushout(&psh->output); break; } out: if (psh->pendingsigs) dotrap(psh); if ((flags & EV_EXIT) != 0) exitshell(psh, psh->exitstatus); } STATIC void evalloop(shinstance *psh, union node *n, int flags) { int status; psh->loopnest++; status = 0; for (;;) { evaltree(psh, n->nbinary.ch1, EV_TESTED); if (psh->evalskip) { skipping: if (psh->evalskip == SKIPCONT && --psh->skipcount <= 0) { psh->evalskip = 0; continue; } if (psh->evalskip == SKIPBREAK && --psh->skipcount <= 0) psh->evalskip = 0; break; } if (n->type == NWHILE) { if (psh->exitstatus != 0) break; } else { if (psh->exitstatus == 0) break; } evaltree(psh, n->nbinary.ch2, flags & EV_TESTED); status = psh->exitstatus; if (psh->evalskip) goto skipping; } psh->loopnest--; psh->exitstatus = status; } STATIC void evalfor(shinstance *psh, union node *n, int flags) { struct arglist arglist; union node *argp; struct strlist *sp; struct stackmark smark; int status = 0; setstackmark(psh, &smark); arglist.lastp = &arglist.list; for (argp = n->nfor.args ; argp ; argp = argp->narg.next) { expandarg(psh, argp, &arglist, EXP_FULL | EXP_TILDE); if (psh->evalskip) goto out; } *arglist.lastp = NULL; psh->loopnest++; for (sp = arglist.list ; sp ; sp = sp->next) { setvar(psh, n->nfor.var, sp->text, 0); evaltree(psh, n->nfor.body, flags & EV_TESTED); status = psh->exitstatus; if (psh->evalskip) { if (psh->evalskip == SKIPCONT && --psh->skipcount <= 0) { psh->evalskip = 0; continue; } if (psh->evalskip == SKIPBREAK && --psh->skipcount <= 0) psh->evalskip = 0; break; } } psh->loopnest--; psh->exitstatus = status; out: popstackmark(psh, &smark); } STATIC void evalcase(shinstance *psh, union node *n, int flags) { union node *cp; union node *patp; struct arglist arglist; struct stackmark smark; int status = 0; setstackmark(psh, &smark); arglist.lastp = &arglist.list; expandarg(psh, n->ncase.expr, &arglist, EXP_TILDE); for (cp = n->ncase.cases ; cp && psh->evalskip == 0 ; cp = cp->nclist.next) { for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) { if (casematch(psh, patp, arglist.list->text)) { if (psh->evalskip == 0) { evaltree(psh, cp->nclist.body, flags); status = psh->exitstatus; } goto out; } } } out: psh->exitstatus = status; popstackmark(psh, &smark); } #ifdef KASH_USE_FORKSHELL2 /* * Child of evalsubshell. */ struct evalsubshellchild { int flags; int backgnd; }; static int evalsubshell_child(shinstance *psh, union node *n, void *argp) { struct evalsubshellchild args = *(struct evalsubshellchild *)argp; INTON; if (args.backgnd) args.flags &=~ EV_TESTED; redirect(psh, n->nredir.redirect, 0); /* never returns */ evaltree(psh, n->nredir.n, args.flags | EV_EXIT); /** @todo make us return here. */ return 0; } #endif /* KASH_USE_FORKSHELL2 */ /* * Kick off a subshell to evaluate a tree. */ STATIC void evalsubshell(shinstance *psh, union node *n, int flags) { struct job *jp; int backgnd = (n->type == NBACKGND); unsigned expfnamedepth; expfnamedepth = expredir(psh, n->nredir.redirect); INTOFF; jp = makejob(psh, n, 1); #ifdef KASH_USE_FORKSHELL2 { struct evalsubshellchild args; args.flags = flags; args.backgnd = backgnd; forkshell2(psh, jp, n, backgnd ? FORK_BG : FORK_FG, evalsubshell_child, n, &args, sizeof(args), NULL); } #else if (forkshell(psh, jp, n, backgnd ? FORK_BG : FORK_FG) == 0) { INTON; if (backgnd) flags &=~ EV_TESTED; redirect(psh, n->nredir.redirect, 0); /* never returns */ evaltree(psh, n->nredir.n, flags | EV_EXIT); } #endif if (! backgnd) psh->exitstatus = waitforjob(psh, jp); expredircleanup(psh, expfnamedepth); INTON; } /* * Compute the names of the files in a redirection list. */ STATIC unsigned expredir(shinstance *psh, union node *n) { union node *redir; redirexpfnames *expfnames; unsigned i; /* We typically end up here w/o redirections. */ if (!n) return !(expfnames = psh->expfnames) ? 0 : expfnames->depth + 1; /* Prepare a table for the expanded names. */ i = 0; for (redir = n; redir ; redir = redir->nfile.next) i++; expfnames = stalloc(psh, offsetof(redirexpfnames, names) + sizeof(expfnames->names[0]) * i); expfnames->count = i; TRACE2((psh, "expredir: %p: count=%u\n", expfnames, i)); /* Do the expansion. */ for (redir = n, i = 0 ; redir ; redir = redir->nfile.next, i++) { struct arglist fn; fn.lastp = &fn.list; switch (redir->type) { case NFROMTO: case NFROM: case NTO: case NCLOBBER: case NAPPEND: expandarg(psh, redir->nfile.fname, &fn, EXP_TILDE | EXP_REDIR); expfnames->names[i] = fn.list->text; break; case NFROMFD: case NTOFD: if (redir->ndup.vname) { expandarg(psh, redir->ndup.vname, &fn, EXP_FULL | EXP_TILDE); fixredir(psh, redir, fn.list->text, 1); } expfnames->names[i] = NULL; break; default: kHlpAssert(redir->type == NHERE || redir->type == NXHERE); expfnames->names[i] = NULL; break; } } kHlpAssert(i == expfnames->count); /* Do the linking at the end, as nesting happens when we expand backtick arguments. */ expfnames->prev = psh->expfnames; psh->expfnames = expfnames; return expfnames->depth = psh->expfnames ? psh->expfnames->depth + 1 : 1; } STATIC void expredircleanup(shinstance *psh, unsigned depth) { redirexpfnames *expfnames = psh->expfnames; kHlpAssert(expfnames == NULL ? depth == 0 : expfnames->depth == depth || expfnames->depth + 1 == depth); while (expfnames && expfnames->depth >= depth) expfnames = psh->expfnames = expfnames->prev; } #ifdef KASH_USE_FORKSHELL2 /* * Child of evalpipe. */ struct evalpipechild { int prevfd; int pip[2]; }; static int evalpipe_child(shinstance *psh, union node *n, void *argp) { struct evalpipechild args = *(struct evalpipechild *)argp; if (args.prevfd > 0) { movefd(psh, args.prevfd, 0); } if (args.pip[1] >= 0) { shfile_close(&psh->fdtab, args.pip[0]); if (args.pip[1] != 1) { movefd(psh, args.pip[1], 1); } } evaltree(psh, n, EV_EXIT); /** @todo make it return thru here. */ return 0; } #endif /* KASH_USE_FORKSHELL2 */ /* * Evaluate a pipeline. All the processes in the pipeline are children * of the process creating the pipeline. (This differs from some versions * of the shell, which make the last process in a pipeline the parent * of all the rest.) */ STATIC void evalpipe(shinstance *psh, union node *n) { struct job *jp; struct nodelist *lp; int pipelen; int prevfd; int pip[2]; TRACE((psh, "evalpipe(0x%lx) called\n", (long)n)); pipelen = 0; for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) pipelen++; INTOFF; jp = makejob(psh, n, pipelen); prevfd = -1; for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) { prehash(psh, lp->n); pip[1] = -1; if (lp->next) { if (sh_pipe(psh, pip) < 0) { shfile_close(&psh->fdtab, prevfd); error(psh, "Pipe call failed"); } } #ifdef KASH_USE_FORKSHELL2 { struct evalpipechild args; args.prevfd = prevfd; args.pip[0] = pip[0]; args.pip[1] = pip[1]; forkshell2(psh, jp, lp->n, n->npipe.backgnd ? FORK_BG : FORK_FG, evalpipe_child, lp->n, &args, sizeof(args), NULL); } #else if (forkshell(psh, jp, lp->n, n->npipe.backgnd ? FORK_BG : FORK_FG) == 0) { INTON; if (prevfd > 0) { movefd(psh, prevfd, 0); } if (pip[1] >= 0) { shfile_close(&psh->fdtab, pip[0]); if (pip[1] != 1) { movefd(psh, pip[1], 1); } } evaltree(psh, lp->n, EV_EXIT); } #endif if (prevfd >= 0) shfile_close(&psh->fdtab, prevfd); prevfd = pip[0]; shfile_close(&psh->fdtab, pip[1]); } if (n->npipe.backgnd == 0) { psh->exitstatus = waitforjob(psh, jp); TRACE((psh, "evalpipe: job done exit status %d\n", psh->exitstatus)); } INTON; } #ifdef KASH_USE_FORKSHELL2 /* * evalbackcmd child. */ struct evalbackcmdchild { int pip[2]; }; static int evalbackcmd_child(shinstance *psh, union node *n, void *argp) { struct evalbackcmdchild args = *(struct evalbackcmdchild *)argp; FORCEINTON; shfile_close(&psh->fdtab, args.pip[0]); if (args.pip[1] != 1) { movefd(psh, args.pip[1], 1); } eflag(psh) = 0; evaltree(psh, n, EV_EXIT); /* NOTREACHED */ /** @todo make it return here to simplify thread handling (no need for setjmp). */ return 0; } #endif /* KASH_USE_FORKSHELL2 */ /* * Execute a command inside back quotes. If it's a builtin command, we * want to save its output in a block obtained from malloc. Otherwise * we fork off a subprocess and get the output of the command via a pipe. * Should be called with interrupts off. */ void evalbackcmd(shinstance *psh, union node *n, struct backcmd *result) { int pip[2]; struct job *jp; struct stackmark smark; /* unnecessary */ setstackmark(psh, &smark); result->fd = -1; result->buf = NULL; result->nleft = 0; result->jp = NULL; if (n == NULL) { goto out; } #ifdef notyet /* * For now we disable executing builtins in the same * context as the shell, because we are not keeping * enough state to recover from changes that are * supposed only to affect subshells. eg. echo "`cd /`" */ if (n->type == NCMD) { psh->exitstatus = opsh->exitstatus; evalcommand(psh, n, EV_BACKCMD, result); } else #endif { INTOFF; if (sh_pipe(psh, pip) < 0) error(psh, "Pipe call failed"); jp = makejob(psh, n, 1); #ifdef KASH_USE_FORKSHELL2 { struct evalbackcmdchild args; args.pip[0] = pip[0]; args.pip[1] = pip[1]; forkshell2(psh, jp, n, FORK_NOJOB, evalbackcmd_child, n, &args, sizeof(args), NULL); } #else if (forkshell(psh, jp, n, FORK_NOJOB) == 0) { FORCEINTON; shfile_close(&psh->fdtab, pip[0]); if (pip[1] != 1) { movefd(psh, pip[1], 1); } eflag(psh) = 0; evaltree(psh, n, EV_EXIT); /* NOTREACHED */ } #endif shfile_close(&psh->fdtab, pip[1]); result->fd = pip[0]; result->jp = jp; INTON; } out: popstackmark(psh, &smark); TRACE((psh, "evalbackcmd done: fd=%d buf=0x%x nleft=%d jp=0x%x\n", result->fd, result->buf, result->nleft, result->jp)); } static const char * syspath(shinstance *psh) { #ifdef CTL_USER static char *sys_path = NULL; static int mib[] = {CTL_USER, USER_CS_PATH}; #endif #ifdef PC_PATH_SEP static char def_path[] = "PATH=/usr/bin;/bin;/usr/sbin;/sbin"; #else static char def_path[] = "PATH=/usr/bin:/bin:/usr/sbin:/sbin"; #endif #ifdef CTL_USER size_t len; if (sys_path == NULL) { if (sysctl(mib, 2, 0, &len, 0, 0) != -1 && (sys_path = ckmalloc(psh, len + 5)) != NULL && sysctl(mib, 2, sys_path + 5, &len, 0, 0) != -1) { memcpy(sys_path, "PATH=", 5); } else { ckfree(psh, sys_path); /* something to keep things happy */ sys_path = def_path; } } return sys_path; #else return def_path; #endif } static int parse_command_args(shinstance *psh, int argc, char **argv, int *use_syspath) { int sv_argc = argc; char *cp, c; *use_syspath = 0; for (;;) { argv++; if (--argc == 0) break; cp = *argv; if (*cp++ != '-') break; if (*cp == '-' && cp[1] == 0) { argv++; argc--; break; } while ((c = *cp++)) { switch (c) { case 'p': *use_syspath = 1; break; default: /* run 'typecmd' for other options */ return 0; } } } return sv_argc - argc; } /* * The split up evalcommand code: * evalcommand_out, evalcommand_parent, evalcommand_doit, evalcommand_child */ /*int vforked = 0; - obsolete */ /* Both child and parent exits thru here. */ STATIC void evalcommand_out(shinstance *psh, int flags, char *lastarg, unsigned expfnamedepth, struct stackmark *smarkp) { if (lastarg) /* dsl: I think this is intended to be used to support * '_' in 'vi' command mode during line editing... * However I implemented that within libedit itself. */ setvar(psh, "_", lastarg, 0); expredircleanup(psh, expfnamedepth); popstackmark(psh, smarkp); if (eflag(psh) && psh->exitstatus && !(flags & EV_TESTED)) exitshell(psh, psh->exitstatus); } /* Called if we forkshell(). */ STATIC void evalcommand_parent(shinstance *psh, int flags, char *lastarg, unsigned expfnamedepth, struct stackmark *smarkp, int mode, struct job *jp, int pip[2], struct backcmd *backcmd) { if (mode == FORK_FG) { /* argument to fork */ psh->exitstatus = waitforjob(psh, jp); } else if (mode == FORK_NOJOB) { backcmd->fd = pip[0]; shfile_close(&psh->fdtab, pip[1]); backcmd->jp = jp; } FORCEINTON; evalcommand_out(psh, flags, lastarg, expfnamedepth, smarkp); } struct evalcommanddoit { struct stackmark smark; unsigned expfnamedepth; struct backcmd *backcmd; int flags; int argc; char **argv; char *lastarg; struct arglist varlist; const char *path; struct cmdentry cmdentry; /* for child stuff only: */ int pip[2]; }; STATIC void evalcommand_doit(shinstance *psh, union node *cmd, struct evalcommanddoit *args) { struct jmploc jmploc; struct jmploc *volatile savehandler; struct localvar *volatile savelocalvars; /* This is the child process if a fork occurred. */ /* Execute the command. */ switch (args->cmdentry.cmdtype) { case CMDFUNCTION: { volatile struct shparam saveparam; #ifdef DEBUG trputs(psh, "Shell function: "); trargs(psh, args->argv); #endif redirect(psh, cmd->ncmd.redirect, REDIR_PUSH); saveparam = psh->shellparam; psh->shellparam.malloc = 0; psh->shellparam.reset = 1; psh->shellparam.nparam = args->argc - 1; psh->shellparam.p = args->argv + 1; psh->shellparam.optnext = NULL; INTOFF; savelocalvars = psh->localvars; psh->localvars = NULL; INTON; if (setjmp(jmploc.loc)) { if (psh->exception == EXSHELLPROC) { freeparam(psh, (volatile struct shparam *) &saveparam); } else { freeparam(psh, &psh->shellparam); psh->shellparam = saveparam; } poplocalvars(psh); psh->localvars = savelocalvars; psh->handler = savehandler; longjmp(psh->handler->loc, 1); } savehandler = psh->handler; psh->handler = &jmploc; listmklocal(psh, args->varlist.list, 0); /* stop shell blowing its stack */ if (++psh->funcnest > 1000) error(psh, "too many nested function calls"); evaltree(psh, args->cmdentry.u.func, args->flags & EV_TESTED); psh->funcnest--; INTOFF; poplocalvars(psh); psh->localvars = savelocalvars; freeparam(psh, &psh->shellparam); psh->shellparam = saveparam; psh->handler = savehandler; popredir(psh); INTON; if (psh->evalskip == SKIPFUNC) { psh->evalskip = 0; psh->skipcount = 0; } if (args->flags & EV_EXIT) exitshell(psh, psh->exitstatus); break; } case CMDBUILTIN: case CMDSPLBLTIN: { volatile int temp_path = 0; char *volatile savecmdname; int volatile savecmdnamemalloc; volatile int e; int mode; #ifdef DEBUG trputs(psh, "builtin command: "); trargs(psh, args->argv); #endif mode = (args->cmdentry.u.bltin == execcmd) ? 0 : REDIR_PUSH; if (args->flags == EV_BACKCMD) { psh->memout.nleft = 0; psh->memout.nextc = psh->memout.buf; psh->memout.bufsize = 64; mode |= REDIR_BACKQ; } e = -1; savehandler = psh->handler; savecmdname = psh->commandname; savecmdnamemalloc = psh->commandnamemalloc; psh->handler = &jmploc; if (!setjmp(jmploc.loc)) { /* We need to ensure the command hash table isn't * corruped by temporary PATH assignments. * However we must ensure the 'local' command works! */ if (args->path != pathval(psh) && (args->cmdentry.u.bltin == hashcmd || args->cmdentry.u.bltin == typecmd)) { savelocalvars = psh->localvars; psh->localvars = 0; mklocal(psh, args->path - 5 /* PATH= */, 0); temp_path = 1; } else temp_path = 0; redirect(psh, cmd->ncmd.redirect, mode); /* exec is a special builtin, but needs this list... */ psh->cmdenviron = args->varlist.list; /* we must check 'readonly' flag for all builtins */ listsetvar(psh, args->varlist.list, args->cmdentry.cmdtype == CMDSPLBLTIN ? 0 : VNOSET); psh->commandnamemalloc = 0; psh->commandname = args->argv[0]; /* initialize nextopt */ psh->argptr = args->argv + 1; psh->optptr = NULL; /* and getopt */ #if 0 /** @todo fix getop usage! */ #if defined(__FreeBSD__) || defined(__EMX__) || defined(__APPLE__) optreset = 1; optind = 1; #else optind = 0; /* init */ #endif #endif psh->exitstatus = args->cmdentry.u.bltin(psh, args->argc, args->argv); } else { e = psh->exception; psh->exitstatus = e == EXINT ? SIGINT + 128 : e == EXEXEC ? psh->exerrno : 2; } psh->handler = savehandler; output_flushall(psh); psh->out1 = &psh->output; psh->out2 = &psh->errout; freestdout(psh); if (temp_path) { poplocalvars(psh); psh->localvars = savelocalvars; } psh->cmdenviron = NULL; if (e != EXSHELLPROC) { psh->commandname = savecmdname; psh->commandnamemalloc = savecmdnamemalloc; if (args->flags & EV_EXIT) exitshell(psh, psh->exitstatus); } else if (savecmdnamemalloc) sh_free(psh, savecmdname); if (e != -1) { if ((e != EXERROR && e != EXEXEC) || args->cmdentry.cmdtype == CMDSPLBLTIN) exraise(psh, e); FORCEINTON; } if (args->cmdentry.u.bltin != execcmd) popredir(psh); if (args->flags == EV_BACKCMD) { args->backcmd->buf = psh->memout.buf; args->backcmd->nleft = (int)(psh->memout.nextc - psh->memout.buf); psh->memout.buf = NULL; } break; } default: { struct strlist *sp; char **envp; #ifdef DEBUG trputs(psh, "normal command: "); trargs(psh, args->argv); #endif clearredir(psh); redirect(psh, cmd->ncmd.redirect, 0); for (sp = args->varlist.list ; sp ; sp = sp->next) setvareq(psh, sp->text, VEXPORT|VSTACK); envp = environment(psh); shellexec(psh, args->argv, envp, args->path, args->cmdentry.u.n.index, args->cmdentry.u.n.suffix); break; } } evalcommand_out(psh, args->flags, args->lastarg, args->expfnamedepth, &args->smark); } /* child callback. */ static int evalcommand_child(shinstance *psh, union node *cmd, void *argp) { struct evalcommanddoit *args = (struct evalcommanddoit *)argp; if (args->flags & EV_BACKCMD) { FORCEINTON; shfile_close(&psh->fdtab, args->pip[0]); if (args->pip[1] != 1) { movefd(psh, args->pip[1], 1); } } args->flags |= EV_EXIT; evalcommand_doit(psh, cmd, args); /* not reached */ /** @todo make it return here */ return 0; } #ifdef KASH_USE_FORKSHELL2 /* Copies data in the argument structure from parent to child. */ static void evalcommand_setup_child(shinstance *pshchild, shinstance *pshparent, void *argp) { struct evalcommanddoit *args = (struct evalcommanddoit *)argp; char **argv; char **srcargv; struct strlist *sp; int argc, i; setstackmark(pshchild, &args->smark); /* copy arguments. */ srcargv = args->argv; argc = args->argc; args->argv = argv = stalloc(pshchild, sizeof(char *) * (argc + 1)); for (i = 0; i < argc; i++) argv[i] = stsavestr(pshchild, srcargv[i]); argv[argc] = NULL; if (args->lastarg) args->lastarg = argv[argc - 1]; /* copy variable list, checking for the 'path'. */ sp = args->varlist.list; args->varlist.list = NULL; args->varlist.lastp = &args->varlist.list; for (; sp; sp = sp->next) { struct strlist *snew = (struct strlist *)stalloc(pshchild, sizeof(*snew)); char *text; snew->next = NULL; snew->text = text = stsavestr(pshchild, sp->text); if (&text[5] == args->path) args->path = &text[sizeof("PATH=") - 1]; *args->varlist.lastp = snew; args->varlist.lastp = &snew->next; } if (args->path == pathval(pshparent)) args->path = pathval(pshchild); /* back tick command should be ignored in this codepath (flags != EV_BACKCMD as EV_EXIT is ORed in). */ /* If cmdentry references an internal function, we must duplicates (reference) it's nodes. */ if (args->cmdentry.cmdtype == CMDFUNCTION) args->cmdentry.u.func = copyparsetree(pshchild, args->cmdentry.u.func); /** @todo isn't this duplicated already? */ } #endif /* KASH_USE_FORKSHELL2 */ /* * Execute a simple command. */ STATIC void evalcommand(shinstance *psh, union node *cmd, int flags, struct backcmd *backcmd) { struct evalcommanddoit args; char **argv; int argc; union node *argp; int numvars; struct arglist arglist; struct strlist *sp; const char *path = pathval(psh); /* First expand the arguments. */ TRACE((psh, "evalcommand(0x%lx, %d) called\n", (long)cmd, flags)); setstackmark(psh, &args.smark); psh->back_exitstatus = 0; arglist.lastp = &arglist.list; /* Expand arguments, ignoring the initial 'name=value' ones */ for (argp = cmd->ncmd.args, numvars = 0 ; argp ; argp = argp->narg.next, numvars++) { char *p = argp->narg.text; char ch = *p; if (is_name(ch)) { do ch = *++p; while (is_in_name(ch)); if (ch == '=') continue; } break; } for (/*continue on argp from above. */ ; argp ; argp = argp->narg.next) expandarg(psh, argp, &arglist, EXP_FULL | EXP_TILDE); *arglist.lastp = NULL; args.expfnamedepth = expredir(psh, cmd->ncmd.redirect); /* Now do the initial 'name=value' ones we skipped above */ args.varlist.lastp = &args.varlist.list; for (argp = cmd->ncmd.args ; numvars > 0 && argp ; argp = argp->narg.next, numvars--) expandarg(psh, argp, &args.varlist, EXP_VARTILDE); *args.varlist.lastp = NULL; argc = 0; for (sp = arglist.list ; sp ; sp = sp->next) argc++; args.argc = argc; args.argv = argv = stalloc(psh, sizeof (char *) * (argc + 1)); for (sp = arglist.list ; sp ; sp = sp->next) { TRACE((psh, "evalcommand arg: %s\n", sp->text)); *argv++ = sp->text; } *argv = NULL; args.lastarg = NULL; if (iflag(psh) && psh->funcnest == 0 && argc > 0) args.lastarg = argv[-1]; argv -= argc; /* Print the command if xflag is set. */ if (xflag(psh)) { char sep = 0; out2str(psh, ps4val(psh)); for (sp = args.varlist.list ; sp ; sp = sp->next) { if (sep != 0) outc(sep, &psh->errout); out2str(psh, sp->text); sep = ' '; } for (sp = arglist.list ; sp ; sp = sp->next) { if (sep != 0) outc(sep, &psh->errout); out2str(psh, sp->text); sep = ' '; } outc('\n', &psh->errout); flushout(&psh->errout); } /* Now locate the command. */ if (argc == 0) { args.cmdentry.cmdtype = CMDSPLBLTIN; args.cmdentry.u.bltin = bltincmd; } else { static const char PATH[] = "PATH="; int cmd_flags = DO_ERR; /* * Modify the command lookup path, if a PATH= assignment * is present */ for (sp = args.varlist.list; sp; sp = sp->next) if (strncmp(sp->text, PATH, sizeof(PATH) - 1) == 0) path = sp->text + sizeof(PATH) - 1; do { int argsused, use_syspath; find_command(psh, argv[0], &args.cmdentry, cmd_flags, path); if (args.cmdentry.cmdtype == CMDUNKNOWN) { psh->exitstatus = 127; flushout(&psh->errout); evalcommand_out(psh, flags, args.lastarg, args.expfnamedepth, &args.smark); return; } /* implement the 'command' builtin here */ if (args.cmdentry.cmdtype != CMDBUILTIN || args.cmdentry.u.bltin != bltincmd) break; cmd_flags |= DO_NOFUNC; argsused = parse_command_args(psh, argc, argv, &use_syspath); if (argsused == 0) { /* use 'type' builting to display info */ args.cmdentry.u.bltin = typecmd; break; } argc -= argsused; argv += argsused; if (use_syspath) path = syspath(psh) + 5; } while (argc != 0); if (args.cmdentry.cmdtype == CMDSPLBLTIN && cmd_flags & DO_NOFUNC) /* posix mandates that 'command ' act as if was a normal builtin */ args.cmdentry.cmdtype = CMDBUILTIN; } /* Fork off a child process if necessary. */ if (cmd->ncmd.backgnd || (args.cmdentry.cmdtype == CMDNORMAL && (flags & EV_EXIT) == 0) || ( (flags & EV_BACKCMD) != 0 && ( (args.cmdentry.cmdtype != CMDBUILTIN && args.cmdentry.cmdtype != CMDSPLBLTIN) || args.cmdentry.u.bltin == dotcmd || args.cmdentry.u.bltin == evalcmd))) { struct job *jp; int mode; INTOFF; jp = makejob(psh, cmd, 1); mode = cmd->ncmd.backgnd; args.pip[0] = -1; args.pip[1] = -1; if (flags & EV_BACKCMD) { mode = FORK_NOJOB; if (sh_pipe(psh, args.pip) < 0) error(psh, "Pipe call failed"); } args.backcmd = backcmd; args.flags = flags; args.path = path; #ifdef KASH_USE_FORKSHELL2 forkshell2(psh, jp, cmd, mode, evalcommand_child, cmd, &args, sizeof(args), evalcommand_setup_child); evalcommand_parent(psh, flags, args.lastarg, args.expfnamedepth, &args.smark, mode, jp, args.pip, backcmd); #else if (forkshell(psh, jp, cmd, mode) != 0) { evalcommand_parent(psh, flags, args.lastarg, args.expfnamedepth, &args.smark, mode, jp, args.pip, backcmd); return; /* at end of routine */ } evalcommand_child(psh, cmd, &args); #endif } else { args.backcmd = backcmd; args.flags = flags; args.path = path; evalcommand_doit(psh, cmd, &args); } } /* * Search for a command. This is called before we fork so that the * location of the command will be available in the parent as well as * the child. The check for "goodname" is an overly conservative * check that the name will not be subject to expansion. */ STATIC void prehash(shinstance *psh, union node *n) { struct cmdentry entry; if (n->type == NCMD && n->ncmd.args) if (goodname(n->ncmd.args->narg.text)) find_command(psh, n->ncmd.args->narg.text, &entry, 0, pathval(psh)); } /* * Builtin commands. Builtin commands whose functions are closely * tied to evaluation are implemented here. */ /* * No command given. */ int bltincmd(shinstance *psh, int argc, char **argv) { /* * Preserve psh->exitstatus of a previous possible redirection * as POSIX mandates */ return psh->back_exitstatus; } /* * Handle break and continue commands. Break, continue, and return are * all handled by setting the psh->evalskip flag. The evaluation routines * above all check this flag, and if it is set they start skipping * commands rather than executing them. The variable skipcount is * the number of loops to break/continue, or the number of function * levels to return. (The latter is always 1.) It should probably * be an error to break out of more loops than exist, but it isn't * in the standard shell so we don't make it one here. */ int breakcmd(shinstance *psh, int argc, char **argv) { int n = argc > 1 ? number(psh, argv[1]) : 1; if (n > psh->loopnest) n = psh->loopnest; if (n > 0) { psh->evalskip = (**argv == 'c')? SKIPCONT : SKIPBREAK; psh->skipcount = n; } return 0; } /* * The return command. */ int returncmd(shinstance *psh, int argc, char **argv) { #if 0 int ret = argc > 1 ? number(psh, argv[1]) : psh->exitstatus; #else int ret; if (argc > 1) { /* make return -1 and VSC lite work ... */ if (argv[1][0] != '-' || !is_number(&argv[1][1])) ret = number(psh, argv[1]); else ret = -number(psh, &argv[1][1]) & 255; /* take the bash approach */ } else { ret = psh->exitstatus; } #endif if (psh->funcnest) { psh->evalskip = SKIPFUNC; psh->skipcount = 1; return ret; } else { /* Do what ksh does; skip the rest of the file */ psh->evalskip = SKIPFILE; psh->skipcount = 1; return ret; } } int falsecmd(shinstance *psh, int argc, char **argv) { return 1; } int truecmd(shinstance *psh, int argc, char **argv) { return 0; } int execcmd(shinstance *psh, int argc, char **argv) { if (argc > 1) { struct strlist *sp; iflag(psh) = 0; /* exit on error */ mflag(psh) = 0; optschanged(psh); for (sp = psh->cmdenviron; sp; sp = sp->next) setvareq(psh, sp->text, VEXPORT|VSTACK); shellexec(psh, argv + 1, environment(psh), pathval(psh), 0, -1); } return 0; } static int conv_time(clock_t ticks, char *seconds, size_t l) { static clock_t tpm = 0; clock_t mins; size_t i; if (!tpm) tpm = /*sysconf(_SC_CLK_TCK)*/sh_sysconf_clk_tck() * 60; mins = ticks / tpm; #ifdef _MSC_VER { char tmp[64]; sprintf(tmp, "%.4f", (ticks - mins * tpm) * 60.0 / tpm); strlcpy(seconds, tmp, l); } #else snprintf(seconds, l, "%.4f", (ticks - mins * tpm) * 60.0 / tpm ); #endif if (seconds[0] == '6' && seconds[1] == '0') { /* 59.99995 got rounded up... */ mins++; strlcpy(seconds, "0.0", l); return mins; } /* suppress trailing zeros */ i = strlen(seconds) - 1; for (; seconds[i] == '0' && seconds[i - 1] != '.'; i--) seconds[i] = 0; return mins; } int timescmd(shinstance *psh, int argc, char **argv) { shtms tms; int u, s, cu, cs; char us[8], ss[8], cus[8], css[8]; nextopt(psh, ""); sh_times(psh, &tms); u = conv_time(tms.tms_utime, us, sizeof(us)); s = conv_time(tms.tms_stime, ss, sizeof(ss)); cu = conv_time(tms.tms_cutime, cus, sizeof(cus)); cs = conv_time(tms.tms_cstime, css, sizeof(css)); outfmt(psh->out1, "%dm%ss %dm%ss\n%dm%ss %dm%ss\n", u, us, s, ss, cu, cus, cs, css); return 0; } kbuild-3608/src/kash/input.c0000664000175000017500000003200214670377416015742 0ustar locutuslocutus/* $NetBSD: input.c,v 1.39 2003/08/07 09:05:32 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)input.c 8.3 (Berkeley) 6/9/95"; #else __RCSID("$NetBSD: input.c,v 1.39 2003/08/07 09:05:32 agc Exp $"); #endif /* not lint */ #endif #include /* defines BUFSIZ */ #include #include #include /* * This file implements the input routines used by the parser. */ #include "shell.h" #include "redir.h" #include "syntax.h" #include "input.h" #include "output.h" #include "options.h" #include "memalloc.h" #include "error.h" #include "alias.h" #include "parser.h" #include "myhistedit.h" #include "shinstance.h" #define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */ //MKINIT //struct strpush { // struct strpush *prev; /* preceding string on stack */ // char *prevstring; // int prevnleft; // int prevlleft; // struct alias *ap; /* if push was associated with an alias */ //}; // ///* // * The parsefile structure pointed to by the global variable parsefile // * contains information about the current file being read. // */ // //MKINIT //struct parsefile { // struct parsefile *prev; /* preceding file on stack */ // int linno; /* current line */ // int fd; /* file descriptor (or -1 if string) */ // int nleft; /* number of chars left in this line */ // int lleft; /* number of chars left in this buffer */ // char *nextc; /* next char in buffer */ // char *buf; /* input buffer */ // struct strpush *strpush; /* for pushing strings at this level */ // struct strpush basestrpush; /* so pushing one is fast */ //}; // // //int plinno = 1; /* input line number */ //int parsenleft; /* copy of parsefile->nleft */ //MKINIT int parselleft; /* copy of parsefile->lleft */ //char *parsenextc; /* copy of parsefile->nextc */ //MKINIT struct parsefile basepf; /* top level input file */ //MKINIT char basebuf[BUFSIZ]; /* buffer for top level input file */ //struct parsefile *parsefile = &basepf; /* current input file */ //int init_editline = 0; /* editline library initialized? */ //int whichprompt; /* 1 == PS1, 2 == PS2 */ // //#ifndef SMALL //EditLine *el; /* cookie for editline package */ //#endif STATIC void pushfile(shinstance *psh); static int preadfd(shinstance *psh); #ifdef mkinit INCLUDE INCLUDE "input.h" INCLUDE "error.h" INIT { psh->basepf.nextc = psh->basepf.buf = psh->basebuf; } RESET { if (psh->exception != EXSHELLPROC) psh->parselleft = psh->parsenleft = 0; /* clear input buffer */ popallfiles(psh); } SHELLPROC { popallfiles(psh); } #endif /* * Read a line from the script. */ char * pfgets(shinstance *psh, char *line, int len) { char *p = line; int nleft = len; int c; while (--nleft > 0) { c = pgetc_macro(psh); if (c == PEOF) { if (p == line) return NULL; break; } *p++ = c; if (c == '\n') break; } *p = '\0'; return line; } /* * Read a character from the script, returning PEOF on end of file. * Nul characters in the input are silently discarded. */ int pgetc(shinstance *psh) { return pgetc_macro(psh); } static int preadfd_inner(shinstance *psh, char *buf, int bufsize) { int nr; retry: #ifndef SMALL if (psh->parsefile->fd == 0 && psh->el) { static const char *rl_cp; static int el_len; if (rl_cp == NULL) rl_cp = el_gets(psh->el, &el_len); if (rl_cp == NULL) nr = 0; else { nr = el_len; if (nr > bufsize) nr = bufsize; memcpy(buf, rl_cp, nr); if (nr != el_len) { el_len -= nr; rl_cp += nr; } else rl_cp = 0; } } else #endif nr = shfile_read(&psh->fdtab, psh->parsefile->fd, buf, bufsize); if (nr <= 0) { if (nr < 0) { if (errno == EINTR) goto retry; if (psh->parsefile->fd == 0 && errno == EWOULDBLOCK) { int flags = shfile_fcntl(&psh->fdtab, 0, F_GETFL, 0); if (flags >= 0 && flags & O_NONBLOCK) { flags &=~ O_NONBLOCK; if (shfile_fcntl(&psh->fdtab, 0, F_SETFL, flags) >= 0) { out2str(psh, "sh: turning off NDELAY mode\n"); goto retry; } } } } nr = -1; } return nr; } static int preadfd(shinstance *psh) { int nr; char *buf = psh->parsefile->buf; psh->parsenextc = buf; #ifdef SH_DEAL_WITH_CRLF /* Convert CRLF to LF. */ nr = preadfd_inner(psh, buf, BUFSIZ - 9); if (nr > 0) { char *cr = memchr(buf, '\r', nr); while (cr) { size_t left = nr - (cr - buf); if (left > 1 && cr[1] == '\n') { left--; nr--; memmove(cr, cr + 1, left); cr = memchr(cr, '\r', left); } else if (left == 1) { /* Special case: \r at buffer end. Read one more char. Screw \r\r\n sequences. */ int nr2 = preadfd_inner(psh, cr + 1, 1); if (nr2 != 1) break; if (cr[1] == '\n') { *cr = '\n'; } else { nr++; } break; } else { cr = memchr(cr + 1, '\r', left); } } } #else nr = preadfd_inner(psh, buf, BUFSIZ - 8); #endif return nr; } /* * Refill the input buffer and return the next input character: * * 1) If a string was pushed back on the input, pop it; * 2) If an EOF was pushed back (parsenleft == EOF_NLEFT) or we are reading * from a string so we can't refill the buffer, return EOF. * 3) If the is more stuff in this buffer, use it else call read to fill it. * 4) Process input up to the next newline, deleting nul characters. */ int preadbuffer(shinstance *psh) { char *p, *q; int more; #ifndef SMALL int something; #endif char savec; if (psh->parsefile->strpush) { popstring(psh); if (--psh->parsenleft >= 0) return (*psh->parsenextc++); } if (psh->parsenleft == EOF_NLEFT || psh->parsefile->buf == NULL) return PEOF; flushout(&psh->output); flushout(&psh->errout); again: if (psh->parselleft <= 0) { if ((psh->parselleft = preadfd(psh)) == -1) { psh->parselleft = psh->parsenleft = EOF_NLEFT; return PEOF; } } q = p = psh->parsenextc; /* delete nul characters */ #ifndef SMALL something = 0; #endif for (more = 1; more;) { switch (*p) { case '\0': p++; /* Skip nul */ goto check; case '\t': case ' ': break; case '\n': psh->parsenleft = (int)(q - psh->parsenextc); more = 0; /* Stop processing here */ break; default: #ifndef SMALL something = 1; #endif break; } *q++ = *p++; check: if (--psh->parselleft <= 0) { psh->parsenleft = (int)(q - psh->parsenextc - 1); if (psh->parsenleft < 0) goto again; *q = '\0'; more = 0; } } savec = *q; *q = '\0'; #ifndef SMALL if (psh->parsefile->fd == 0 && hist && something) { HistEvent he; INTOFF; history(hist, &he, psh->whichprompt == 1? H_ENTER : H_APPEND, psh->parsenextc); INTON; } #endif if (vflag(psh)) { out2str(psh, psh->parsenextc); flushout(psh->out2); } *q = savec; return *psh->parsenextc++; } /* * Undo the last call to pgetc. Only one character may be pushed back. * PEOF may be pushed back. */ void pungetc(shinstance *psh) { psh->parsenleft++; psh->parsenextc--; } /* * Push a string back onto the input at this current parsefile level. * We handle aliases this way. */ void pushstring(shinstance *psh, char *s, size_t len, void *ap) { struct strpush *sp; INTOFF; /*dprintf("*** calling pushstring: %s, %d\n", s, len);*/ if (psh->parsefile->strpush) { sp = ckmalloc(psh, sizeof (struct strpush)); sp->prev = psh->parsefile->strpush; psh->parsefile->strpush = sp; } else sp = psh->parsefile->strpush = &(psh->parsefile->basestrpush); sp->prevstring = psh->parsenextc; sp->prevnleft = psh->parsenleft; sp->prevlleft = psh->parselleft; sp->ap = (struct alias *)ap; if (ap) ((struct alias *)ap)->flag |= ALIASINUSE; psh->parsenextc = s; psh->parsenleft = (int)len; INTON; } void popstring(shinstance *psh) { struct strpush *sp = psh->parsefile->strpush; INTOFF; psh->parsenextc = sp->prevstring; psh->parsenleft = sp->prevnleft; psh->parselleft = sp->prevlleft; /*dprintf("*** calling popstring: restoring to '%s'\n", psh->parsenextc);*/ if (sp->ap) sp->ap->flag &= ~ALIASINUSE; psh->parsefile->strpush = sp->prev; if (sp != &(psh->parsefile->basestrpush)) ckfree(psh, sp); INTON; } /* * Set the input to take input from a file. If push is set, push the * old input onto the stack first. */ void setinputfile(shinstance *psh, const char *fname, int push) { int fd; int fd2; INTOFF; /** @todo shfile fixme */ if ((fd = shfile_open(&psh->fdtab, fname, O_RDONLY, 0)) < 0) error(psh, "Can't open %s", fname); if (fd < 10) { fd2 = movefd_above(psh, fd, 10); if (fd2 < 0) error(psh, "Out of file descriptors"); fd = fd2; } setinputfd(psh, fd, push); INTON; } /* * Like setinputfile, but takes an open file descriptor. Call this with * interrupts off. */ void setinputfd(shinstance *psh, int fd, int push) { (void) shfile_cloexec(&psh->fdtab, fd, 1 /* close it */); if (push) { pushfile(psh); psh->parsefile->buf = ckmalloc(psh, BUFSIZ); } if (psh->parsefile->fd > 0) shfile_close(&psh->fdtab, psh->parsefile->fd); psh->parsefile->fd = fd; if (psh->parsefile->buf == NULL) psh->parsefile->buf = ckmalloc(psh, BUFSIZ); psh->parselleft = psh->parsenleft = 0; psh->plinno = 1; } /* * Like setinputfile, but takes input from a string. */ void setinputstring(shinstance *psh, char *string, int push) { INTOFF; if (push) pushfile(psh); psh->parsenextc = string; psh->parselleft = psh->parsenleft = (int)strlen(string); psh->parsefile->buf = NULL; psh->plinno = 1; INTON; } /* * To handle the "." command, a stack of input files is used. Pushfile * adds a new entry to the stack and popfile restores the previous level. */ STATIC void pushfile(shinstance *psh) { struct parsefile *pf; psh->parsefile->nleft = psh->parsenleft; psh->parsefile->lleft = psh->parselleft; psh->parsefile->nextc = psh->parsenextc; psh->parsefile->linno = psh->plinno; pf = (struct parsefile *)ckmalloc(psh, sizeof (struct parsefile)); pf->prev = psh->parsefile; pf->fd = -1; pf->strpush = NULL; pf->basestrpush.prev = NULL; psh->parsefile = pf; } void popfile(shinstance *psh) { struct parsefile *pf = psh->parsefile; INTOFF; if (pf->fd >= 0) shfile_close(&psh->fdtab, pf->fd); if (pf->buf) ckfree(psh, pf->buf); while (pf->strpush) popstring(psh); psh->parsefile = pf->prev; ckfree(psh, pf); psh->parsenleft = psh->parsefile->nleft; psh->parselleft = psh->parsefile->lleft; psh->parsenextc = psh->parsefile->nextc; psh->plinno = psh->parsefile->linno; INTON; } /* * Return to top level. */ void popallfiles(shinstance *psh) { while (psh->parsefile != &psh->basepf) popfile(psh); } /* * Close the file(s) that the shell is reading commands from. Called * after a fork is done. * * Takes one arg, vfork, which tells it to not modify its global vars * as it is still running in the parent. * * This code is (probably) unnecessary as the 'close on exec' flag is * set and should be enough. In the vfork case it is definitely wrong * to close the fds as another fork() may be done later to feed data * from a 'here' document into a pipe and we don't want to close the * pipe! */ void closescript(shinstance *psh) { popallfiles(psh); if (psh->parsefile->fd > 0) { shfile_close(&psh->fdtab, psh->parsefile->fd); psh->parsefile->fd = 0; } } kbuild-3608/src/kash/output.h0000664000175000017500000000670114670377416016157 0ustar locutuslocutus/* $NetBSD: output.h,v 1.17 2003/08/07 09:05:36 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)output.h 8.2 (Berkeley) 5/4/95 */ #ifndef OUTPUT_INCL #include /* The stupid, stupid, unix specification guys added dprintf to stdio.h! Wonder what kind of weed they were smoking when doing that... */ #include #undef dprintf #define dprintf mydprintf struct output { char *nextc; int nleft; char *buf; int bufsize; short fd; short flags; struct shinstance *psh; }; /*extern struct output output; extern struct output errout; extern struct output memout; extern struct output *out1; extern struct output *out2;*/ #if !defined(__GNUC__) && !defined(__attribute__) # define __attribute__(a) #endif void open_mem(char *, int, struct output *); void out1str(struct shinstance *, const char *); void out2str(struct shinstance *, const char *); void outstr(const char *, struct output *); void emptyoutbuf(struct output *); void output_flushall(struct shinstance *); void flushout(struct output *); void freestdout(struct shinstance *); void outfmt(struct output *, const char *, ...) __attribute__((__format__(__printf__,2,3))); void out1fmt(struct shinstance *, const char *, ...) __attribute__((__format__(__printf__,2,3))); void dprintf(struct shinstance *, const char *, ...) __attribute__((__format__(__printf__,2,3))); void fmtstr(char *, size_t, const char *, ...) __attribute__((__format__(__printf__,3,4))); void doformat(struct output *, const char *, va_list); int xwrite(struct shinstance *, int, char *, size_t); int xioctl(struct shinstance *, int, unsigned long, char *); #define outc(c, file) (--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c))) #define out1c(psh, c) outc(c, (psh)->out1); #define out2c(psh, c) outc(c, (psh)->out2); #define OUTPUT_INCL #endif kbuild-3608/src/kash/strlcpy.c0000664000175000017500000000501014670377416016302 0ustar locutuslocutus/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */ /* * Copyright (c) 1998 Todd C. Miller * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #if 0 #if defined(LIBC_SCCS) && !defined(lint) static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $"); #include //__FBSDID("$FreeBSD: src/lib/libc/string/strlcpy.c,v 1.7 2003/05/01 19:03:14 nectar Exp $"); #endif /* LIBC_SCCS and not lint */ #endif #include #include /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t strlcpy(dst, src, siz) char *dst; const char *src; size_t siz; { char *d = dst; const char *s = src; size_t n = siz; /* Copy as many bytes as will fit */ if (n != 0 && --n != 0) { do { if ((*d++ = *s++) == 0) break; } while (--n != 0); } /* Not enough room in dst, add NUL and traverse rest of src */ if (n == 0) { if (siz != 0) *d = '\0'; /* NUL-terminate dst */ while (*s++) ; } return(s - src - 1); /* count does not include NUL */ } kbuild-3608/src/kash/cd.c0000664000175000017500000002535414670377416015205 0ustar locutuslocutus/* $NetBSD: cd.c,v 1.34 2003/11/14 20:00:28 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)cd.c 8.2 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: cd.c,v 1.34 2003/11/14 20:00:28 dsl Exp $"); #endif /* not lint */ #endif #include #include #include #include /* * The cd and pwd commands. */ #include "shell.h" #include "var.h" #include "nodes.h" /* for jobs.h */ #include "jobs.h" #include "options.h" #include "output.h" #include "memalloc.h" #include "error.h" #include "exec.h" #include "redir.h" #include "mystring.h" #include "show.h" #include "cd.h" #include "shinstance.h" STATIC int docd(shinstance *psh, char *, int); STATIC char *getcomponent(shinstance *psh); STATIC void updatepwd(shinstance *psh, char *); STATIC void find_curdir(shinstance *psh, int noerror); /*char *curdir = NULL;*/ /* current working directory */ /*char *prevdir;*/ /* previous working directory */ /*STATIC char *cdcomppath;*/ int cdcmd(shinstance *psh, int argc, char **argv) { const char *dest; const char *path; char *p, *d; struct stat statb; int print = cdprint(psh); /* set -cdprint to enable */ nextopt(psh, nullstr); /* * Try (quite hard) to have 'curdir' defined, nothing has set * it on entry to the shell, but we want 'cd fred; cd -' to work. */ getpwd(psh, 1); dest = *psh->argptr; if (dest == NULL) { dest = bltinlookup(psh, "HOME", 1); if (dest == NULL) error(psh, "HOME not set"); } else { if (psh->argptr[1]) { /* Do 'ksh' style substitution */ if (!psh->curdir) error(psh, "PWD not set"); p = strstr(psh->curdir, dest); if (!p) error(psh, "bad substitution"); d = stalloc(psh, strlen(psh->curdir) + strlen(psh->argptr[1]) + 1); memcpy(d, psh->curdir, p - psh->curdir); strcpy(d + (p - psh->curdir), psh->argptr[1]); strcat(d, p + strlen(dest)); dest = d; print = 1; } } if (dest[0] == '-' && dest[1] == '\0') { dest = psh->prevdir ? psh->prevdir : psh->curdir; print = 1; } if (*dest == '\0') dest = "."; if (IS_ROOT(dest) || (path = bltinlookup(psh, "CDPATH", 1)) == NULL) path = nullstr; while ((p = padvance(psh, &path, dest)) != NULL) { if (shfile_stat(&psh->fdtab, p, &statb) >= 0 && S_ISDIR(statb.st_mode)) { if (!print) { /* * XXX - rethink */ if (p[0] == '.' && p[1] == '/' && p[2] != '\0') p += 2; print = strcmp(p, dest); } if (docd(psh, p, print) >= 0) return 0; } } error(psh, "can't cd to %s", dest); /* NOTREACHED */ return 1; } /* * Actually do the chdir. In an interactive shell, print the * directory name if "print" is nonzero. */ STATIC int docd(shinstance *psh, char *dest, int print) { char *p; char *q; char *component; struct stat statb; int first; int badstat; TRACE((psh, "docd(\"%s\", %d) called\n", dest, print)); /* * Check each component of the path. If we find a symlink or * something we can't stat, clear curdir to force a getcwd() * next time we get the value of the current directory. */ badstat = 0; psh->cdcomppath = stalloc(psh, strlen(dest) + 1); scopy(dest, psh->cdcomppath); STARTSTACKSTR(psh, p); if (IS_ROOT(dest)) { STPUTC(psh, '/', p); psh->cdcomppath++; } first = 1; while ((q = getcomponent(psh)) != NULL) { if (q[0] == '\0' || (q[0] == '.' && q[1] == '\0')) continue; if (! first) STPUTC(psh, '/', p); first = 0; component = q; while (*q) STPUTC(psh, *q++, p); if (equal(component, "..")) continue; STACKSTRNUL(psh, p); if ((shfile_lstat(&psh->fdtab, stackblock(psh), &statb) < 0) || (S_ISLNK(statb.st_mode))) { /* print = 1; */ badstat = 1; break; } } INTOFF; if (shfile_chdir(&psh->fdtab, dest) < 0) { INTON; return -1; } updatepwd(psh, badstat ? NULL : dest); INTON; if (print && iflag(psh) && psh->curdir) out1fmt(psh, "%s\n", psh->curdir); return 0; } /* * Get the next component of the path name pointed to by psh->cdcomppath. * This routine overwrites the string pointed to by psh->cdcomppath. */ STATIC char * getcomponent(shinstance *psh) { char *p; char *start; if ((p = psh->cdcomppath) == NULL) return NULL; start = psh->cdcomppath; while (*p != '/' && *p != '\0') p++; if (*p == '\0') { psh->cdcomppath = NULL; } else { *p++ = '\0'; psh->cdcomppath = p; } return start; } /* * Update curdir (the name of the current directory) in response to a * cd command. We also call hashcd to let the routines in exec.c know * that the current directory has changed. */ STATIC void updatepwd(shinstance *psh, char *dir) { char *new; char *p; hashcd(psh); /* update command hash table */ /* * If our argument is NULL, we don't know the current directory * any more because we traversed a symbolic link or something * we couldn't stat(). */ if (dir == NULL || psh->curdir == NULL) { if (psh->prevdir) ckfree(psh, psh->prevdir); INTOFF; psh->prevdir = psh->curdir; psh->curdir = NULL; getpwd(psh, 1); INTON; if (psh->curdir) setvar(psh, "PWD", psh->curdir, VEXPORT); else unsetvar(psh, "PWD", 0); return; } psh->cdcomppath = stalloc(psh, strlen(dir) + 1); scopy(dir, psh->cdcomppath); STARTSTACKSTR(psh, new); if (!IS_ROOT(dir)) { p = psh->curdir; while (*p) STPUTC(psh, *p++, new); if (p[-1] == '/') STUNPUTC(psh, new); } while ((p = getcomponent(psh)) != NULL) { if (equal(p, "..")) { while (new > stackblock(psh) && (STUNPUTC(psh, new), *new) != '/'); } else if (*p != '\0' && ! equal(p, ".")) { STPUTC(psh, '/', new); while (*p) STPUTC(psh, *p++, new); } } if (new == stackblock(psh)) STPUTC(psh, '/', new); STACKSTRNUL(psh, new); INTOFF; if (psh->prevdir) ckfree(psh, psh->prevdir); psh->prevdir = psh->curdir; psh->curdir = savestr(psh, stackblock(psh)); setvar(psh, "PWD", psh->curdir, VEXPORT); INTON; } /* * Posix says the default should be 'pwd -L' (as below), however * the 'cd' command (above) does something much nearer to the * posix 'cd -P' (not the posix default of 'cd -L'). * If 'cd' is changed to support -P/L then the default here * needs to be revisited if the historic behaviour is to be kept. */ int pwdcmd(shinstance *psh, int argc, char **argv) { int i; char opt = 'L'; while ((i = nextopt(psh, "LP")) != '\0') opt = i; if (*psh->argptr) error(psh, "unexpected argument"); if (opt == 'L') getpwd(psh, 0); else find_curdir(psh, 0); setvar(psh, "PWD", psh->curdir, VEXPORT); out1str(psh, psh->curdir); out1c(psh, '\n'); return 0; } #define MAXPWD 256 /* * Find out what the current directory is. If we already know the current * directory, this routine returns immediately. */ const char * getpwd(shinstance *psh, int noerror) { char *pwd; struct stat stdot, stpwd; /*static int first = 1;*/ if (psh->curdir) return psh->curdir; if (psh->getpwd_first) { psh->getpwd_first = 0; pwd = sh_getenv(psh, "PWD"); if (pwd && IS_ROOT(pwd) && shfile_stat(&psh->fdtab, ".", &stdot) != -1 && shfile_stat(&psh->fdtab, pwd, &stpwd) != -1 && stdot.st_dev == stpwd.st_dev && stdot.st_ino == stpwd.st_ino) { psh->curdir = savestr(psh, pwd); return psh->curdir; } } find_curdir(psh, noerror); return psh->curdir; } STATIC void find_curdir(shinstance *psh, int noerror) { int i; char *pwd; /* * Things are a bit complicated here; we could have just used * getcwd, but traditionally getcwd is implemented using popen * to /bin/pwd. This creates a problem for us, since we cannot * keep track of the job if it is being ran behind our backs. * So we re-implement getcwd(), and we suppress interrupts * throughout the process. This is not completely safe, since * the user can still break out of it by killing the pwd program. * We still try to use getcwd for systems that we know have a * c implementation of getcwd, that does not open a pipe to * /bin/pwd. */ #if 1 //defined(__NetBSD__) || defined(__SVR4) || defined(__INNOTEK_LIBC__) for (i = MAXPWD;; i *= 2) { pwd = stalloc(psh, i); if (shfile_getcwd(&psh->fdtab, pwd, i) != NULL) { psh->curdir = savestr(psh, pwd); return; } stunalloc(psh, pwd); if (errno == ERANGE) continue; if (!noerror) error(psh, "getcwd() failed: %s", sh_strerror(psh, errno)); return; } #else { char *p; int status; struct job *jp; int pip[2]; pwd = stalloc(psh, MAXPWD); INTOFF; if (pipe(pip) < 0) error(psh, "Pipe call failed"); jp = makejob((union node *)NULL, 1); if (forkshell(jp, (union node *)NULL, FORK_NOJOB) == 0) { (void) close(pip[0]); if (pip[1] != 1) { close(1); copyfd(pip[1], 1); close(pip[1]); } (void) execl("/bin/pwd", "pwd", (char *)0); error(psh, "Cannot exec /bin/pwd"); } (void) close(pip[1]); pip[1] = -1; p = pwd; while ((i = read(pip[0], p, pwd + MAXPWD - p)) > 0 || (i == -1 && errno == EINTR)) { if (i > 0) p += i; } (void) close(pip[0]); pip[0] = -1; status = waitforjob(jp); if (status != 0) error(psh, (char *)0); if (i < 0 || p == pwd || p[-1] != '\n') { if (noerror) { INTON; return; } error(psh, "pwd command failed"); } p[-1] = '\0'; INTON; psh->curdir = savestr(pwd); return; } #endif } kbuild-3608/src/kash/miscbltin.c0000664000175000017500000002300414670377416016571 0ustar locutuslocutus/* $NetBSD: miscbltin.c,v 1.35 2005/03/19 14:22:50 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)miscbltin.c 8.4 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: miscbltin.c,v 1.35 2005/03/19 14:22:50 dsl Exp $"); #endif /* not lint */ #endif /* * Miscelaneous builtins. */ #include #include #include #include #include "shell.h" #include "options.h" #include "var.h" #include "output.h" #include "memalloc.h" #include "error.h" #include "miscbltin.h" #include "mystring.h" #include "shinstance.h" #include "shfile.h" #undef rflag void *kash_setmode(shinstance *psh, const char *p); mode_t kash_getmode(const void *bbox, mode_t omode); /* * The read builtin. * Backslahes escape the next char unless -r is specified. * * This uses unbuffered input, which may be avoidable in some cases. * * Note that if IFS=' :' then read x y should work so that: * 'a b' x='a', y='b' * ' a b ' x='a', y='b' * ':b' x='', y='b' * ':' x='', y='' * '::' x='', y='' * ': :' x='', y='' * ':::' x='', y='::' * ':b c:' x='', y='b c:' */ int readcmd(shinstance *psh, int argc, char **argv) { char **ap; char c; int rflag; char *prompt; const char *ifs; char *p; int startword; int status; int i; int is_ifs; int saveall = 0; rflag = 0; prompt = NULL; while ((i = nextopt(psh, "p:r")) != '\0') { if (i == 'p') prompt = psh->optionarg; else rflag = 1; } if (prompt && shfile_isatty(&psh->fdtab, 0)) { out2str(psh, prompt); output_flushall(psh); } if (*(ap = psh->argptr) == NULL) error(psh, "arg count"); if ((ifs = bltinlookup(psh, "IFS", 1)) == NULL) ifs = " \t\n"; status = 0; startword = 2; STARTSTACKSTR(psh, p); for (;;) { if (shfile_read(&psh->fdtab, 0, &c, 1) != 1) { status = 1; break; } if (c == '\0') continue; if (c == '\\' && !rflag) { if (shfile_read(&psh->fdtab, 0, &c, 1) != 1) { status = 1; break; } if (c != '\n') STPUTC(psh, c, p); continue; } if (c == '\n') break; if (strchr(ifs, c)) is_ifs = strchr(" \t\n", c) ? 1 : 2; else is_ifs = 0; if (startword != 0) { if (is_ifs == 1) { /* Ignore leading IFS whitespace */ if (saveall) STPUTC(psh, c, p); continue; } if (is_ifs == 2 && startword == 1) { /* Only one non-whitespace IFS per word */ startword = 2; if (saveall) STPUTC(psh, c, p); continue; } } if (is_ifs == 0) { /* append this character to the current variable */ startword = 0; if (saveall) /* Not just a spare terminator */ saveall++; STPUTC(psh, c, p); continue; } /* end of variable... */ startword = is_ifs; if (ap[1] == NULL) { /* Last variable needs all IFS chars */ saveall++; STPUTC(psh, c, p); continue; } STACKSTRNUL(psh, p); setvar(psh, *ap, stackblock(psh), 0); ap++; STARTSTACKSTR(psh, p); } STACKSTRNUL(psh, p); /* Remove trailing IFS chars */ for (; stackblock(psh) <= --p; *p = 0) { if (!strchr(ifs, *p)) break; if (strchr(" \t\n", *p)) /* Always remove whitespace */ continue; if (saveall > 1) /* Don't remove non-whitespace unless it was naked */ break; } setvar(psh, *ap, stackblock(psh), 0); /* Set any remaining args to "" */ while (*++ap != NULL) setvar(psh, *ap, nullstr, 0); return status; } int umaskcmd(shinstance *psh, int argc, char **argv) { char *ap; int mask; int i; int symbolic_mode = 0; while ((i = nextopt(psh, "S")) != '\0') { symbolic_mode = 1; } mask = shfile_get_umask(&psh->fdtab); if ((ap = *psh->argptr) == NULL) { if (symbolic_mode) { char u[4], g[4], o[4]; i = 0; if ((mask & S_IRUSR) == 0) u[i++] = 'r'; if ((mask & S_IWUSR) == 0) u[i++] = 'w'; if ((mask & S_IXUSR) == 0) u[i++] = 'x'; u[i] = '\0'; i = 0; if ((mask & S_IRGRP) == 0) g[i++] = 'r'; if ((mask & S_IWGRP) == 0) g[i++] = 'w'; if ((mask & S_IXGRP) == 0) g[i++] = 'x'; g[i] = '\0'; i = 0; if ((mask & S_IROTH) == 0) o[i++] = 'r'; if ((mask & S_IWOTH) == 0) o[i++] = 'w'; if ((mask & S_IXOTH) == 0) o[i++] = 'x'; o[i] = '\0'; out1fmt(psh, "u=%s,g=%s,o=%s\n", u, g, o); } else { out1fmt(psh, "%.4o\n", mask); } } else { if (isdigit((unsigned char)*ap)) { mask = 0; do { if (*ap >= '8' || *ap < '0') error(psh, "Illegal number: %s", argv[1]); mask = (mask << 3) + (*ap - '0'); } while (*++ap != '\0'); shfile_set_umask(&psh->fdtab, mask); } else { void *set; INTOFF; if ((set = kash_setmode(psh, ap)) != 0) { mask = kash_getmode(set, ~mask & 0777); ckfree(psh, set); } INTON; if (!set) error(psh, "Illegal mode: %s", ap); shfile_set_umask(&psh->fdtab, ~mask & 0777); } } return 0; } /* * ulimit builtin * * This code, originally by Doug Gwyn, Doug Kingston, Eric Gisin, and * Michael Rendell was ripped from pdksh 5.0.8 and hacked for use with * ash by J.T. Conklin. * * Public domain. */ struct limits { const char *name; int cmd; int factor; /* multiply by to get rlim_{cur,max} values */ char option; }; static const struct limits limits[] = { #ifdef RLIMIT_CPU { "time(seconds)", RLIMIT_CPU, 1, 't' }, #endif #ifdef RLIMIT_FSIZE { "file(blocks)", RLIMIT_FSIZE, 512, 'f' }, #endif #ifdef RLIMIT_DATA { "data(kbytes)", RLIMIT_DATA, 1024, 'd' }, #endif #ifdef RLIMIT_STACK { "stack(kbytes)", RLIMIT_STACK, 1024, 's' }, #endif #ifdef RLIMIT_CORE { "coredump(blocks)", RLIMIT_CORE, 512, 'c' }, #endif #ifdef RLIMIT_RSS { "memory(kbytes)", RLIMIT_RSS, 1024, 'm' }, #endif #ifdef RLIMIT_MEMLOCK { "locked memory(kbytes)", RLIMIT_MEMLOCK, 1024, 'l' }, #endif #ifdef RLIMIT_NPROC { "process(processes)", RLIMIT_NPROC, 1, 'p' }, #endif #ifdef RLIMIT_NOFILE { "nofiles(descriptors)", RLIMIT_NOFILE, 1, 'n' }, #endif #ifdef RLIMIT_VMEM { "vmemory(kbytes)", RLIMIT_VMEM, 1024, 'v' }, #endif #ifdef RLIMIT_SWAP { "swap(kbytes)", RLIMIT_SWAP, 1024, 'w' }, #endif #ifdef RLIMIT_SBSIZE { "sbsize(bytes)", RLIMIT_SBSIZE, 1, 'b' }, #endif { (char *) 0, 0, 0, '\0' } }; int ulimitcmd(shinstance *psh, int argc, char **argv) { int c; shrlim_t val = 0; enum { SOFT = 0x1, HARD = 0x2 } how = SOFT | HARD; const struct limits *l; int set, all = 0; int optc, what; shrlimit limit; what = 'f'; while ((optc = nextopt(psh, "HSabtfdsmcnpl")) != '\0') switch (optc) { case 'H': how = HARD; break; case 'S': how = SOFT; break; case 'a': all = 1; break; default: what = optc; } for (l = limits; l->name && l->option != what; l++) ; if (!l->name) error(psh, "internal error (%c)", what); set = *psh->argptr ? 1 : 0; if (set) { char *p = *psh->argptr; if (all || psh->argptr[1]) error(psh, "too many arguments"); if (strcmp(p, "unlimited") == 0) val = RLIM_INFINITY; else { val = (shrlim_t) 0; while ((c = *p++) >= '0' && c <= '9') { shrlim_t const prev = val; val = (val * 10) + (long)(c - '0'); if (val < prev) break; } if (c) error(psh, "bad number"); val *= l->factor; } } if (all) { for (l = limits; l->name; l++) { sh_getrlimit(psh, l->cmd, &limit); if (how & SOFT) val = limit.rlim_cur; else if (how & HARD) val = limit.rlim_max; out1fmt(psh, "%-20s ", l->name); if (val == RLIM_INFINITY) out1fmt(psh, "unlimited\n"); else { val /= l->factor; out1fmt(psh, "%lld\n", (long long) val); } } return 0; } sh_getrlimit(psh, l->cmd, &limit); if (set) { if (how & HARD) limit.rlim_max = val; if (how & SOFT) limit.rlim_cur = val; if (sh_setrlimit(psh, l->cmd, &limit) < 0) error(psh, "error setting limit (%s)", sh_strerror(psh, errno)); } else { if (how & SOFT) val = limit.rlim_cur; else if (how & HARD) val = limit.rlim_max; if (val == RLIM_INFINITY) out1fmt(psh, "unlimited\n"); else { val /= l->factor; out1fmt(psh, "%lld\n", (long long) val); } } return 0; } kbuild-3608/src/kash/init.h0000664000175000017500000000354214670377416015562 0ustar locutuslocutus/* $NetBSD: init.h,v 1.10 2003/08/07 09:05:32 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)init.h 8.2 (Berkeley) 5/4/95 */ void init(struct shinstance *); void reset(struct shinstance *); void initshellproc(struct shinstance *); kbuild-3608/src/kash/alias.c0000664000175000017500000001654014670377416015705 0ustar locutuslocutus/* $NetBSD: alias.c,v 1.12 2003/08/07 09:05:29 agc Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: alias.c,v 1.12 2003/08/07 09:05:29 agc Exp $"); #endif /* not lint */ #endif #include #include "shell.h" #include "input.h" #include "output.h" #include "error.h" #include "memalloc.h" #include "mystring.h" #include "alias.h" #include "options.h" /* XXX for argptr (should remove?) */ #include "var.h" #include "shinstance.h" /*#define ATABSIZE 39 struct alias *atab[ATABSIZE];*/ STATIC void setalias(shinstance *, char *, char *); STATIC int unalias(shinstance *, char *); STATIC struct alias **hashalias(shinstance *, char *); #ifndef SH_FORKED_MODE void subshellinitalias(shinstance *psh, shinstance *inherit) { unsigned i; unsigned left = inherit->aliases; if (left == 0) return; for (i = 0; i < K_ELEMENTS(inherit->atab); i++) { struct alias const *asrc = inherit->atab[i]; if (asrc) { struct alias **ppdst = &psh->atab[i]; do { if (*asrc->name) { struct alias *dst = (struct alias *)ckmalloc(psh, sizeof(*dst)); dst->name = savestr(psh, asrc->name); dst->val = savestr(psh, asrc->val); dst->flag = asrc->flag; *ppdst = dst; ppdst = &dst->next; } left--; asrc = asrc->next; } while (asrc); *ppdst = NULL; if (left == 0) break; } } } #endif /* !SH_FORKED_MODE */ STATIC void setalias(shinstance *psh, char *name, char *val) { struct alias *ap, **app; app = hashalias(psh, name); for (ap = *app; ap; ap = ap->next) { if (equal(name, ap->name)) { INTOFF; ckfree(psh, ap->val); ap->val = savestr(psh, val); INTON; return; } } /* not found */ INTOFF; ap = ckmalloc(psh, sizeof (struct alias)); ap->name = savestr(psh, name); /* * XXX - HACK: in order that the parser will not finish reading the * alias value off the input before processing the next alias, we * dummy up an extra space at the end of the alias. This is a crock * and should be re-thought. The idea (if you feel inclined to help) * is to avoid alias recursions. The mechanism used is: when * expanding an alias, the value of the alias is pushed back on the * input as a string and a pointer to the alias is stored with the * string. The alias is marked as being in use. When the input * routine finishes reading the string, it markes the alias not * in use. The problem is synchronization with the parser. Since * it reads ahead, the alias is marked not in use before the * resulting token(s) is next checked for further alias sub. The * H A C K is that we add a little fluff after the alias value * so that the string will not be exhausted. This is a good * idea ------- ***NOT*** */ #ifdef notyet ap->val = savestr(psh, val); #else /* hack */ { size_t len = strlen(val); ap->val = ckmalloc(psh, len + 2); memcpy(ap->val, val, len); ap->val[len] = ' '; /* fluff */ ap->val[len+1] = '\0'; } #endif ap->next = *app; *app = ap; psh->aliases++; INTON; } STATIC int unalias(shinstance *psh, char *name) { struct alias *ap, **app; app = hashalias(psh, name); for (ap = *app; ap; app = &(ap->next), ap = ap->next) { if (equal(name, ap->name)) { /* * if the alias is currently in use (i.e. its * buffer is being used by the input routine) we * just null out the name instead of freeing it. * We could clear it out later, but this situation * is so rare that it hardly seems worth it. */ if (ap->flag & ALIASINUSE) *ap->name = '\0'; else { INTOFF; *app = ap->next; ckfree(psh, ap->name); ckfree(psh, ap->val); ckfree(psh, ap); psh->aliases--; INTON; } return (0); } } return (1); } #ifdef mkinit MKINIT void rmaliases(shinstance *psh); SHELLPROC { rmaliases(psh); } #endif void rmaliases(shinstance *psh) { struct alias *ap, *tmp; int i; INTOFF; for (i = 0; i < ATABSIZE; i++) { ap = psh->atab[i]; psh->atab[i] = NULL; while (ap) { ckfree(psh, ap->name); ckfree(psh, ap->val); tmp = ap; ap = ap->next; ckfree(psh, tmp); } } INTON; } struct alias * lookupalias(shinstance *psh, char *name, int check) { struct alias *ap = *hashalias(psh, name); for (; ap; ap = ap->next) { if (equal(name, ap->name)) { if (check && (ap->flag & ALIASINUSE)) return (NULL); return (ap); } } return (NULL); } char * get_alias_text(shinstance *psh, char *name) { struct alias *ap; ap = lookupalias(psh, name, 0); if (ap == NULL) return NULL; return ap->val; } /* * TODO - sort output */ int aliascmd(shinstance *psh, int argc, char **argv) { char *n, *v; int ret = 0; struct alias *ap; if (argc == 1) { int i; for (i = 0; i < ATABSIZE; i++) for (ap = psh->atab[i]; ap; ap = ap->next) { if (*ap->name != '\0') { out1fmt(psh, "alias %s=", ap->name); print_quoted(psh, ap->val); out1c(psh, '\n'); } } return (0); } while ((n = *++argv) != NULL) { if ((v = strchr(n+1, '=')) == NULL) { /* n+1: funny ksh stuff */ if ((ap = lookupalias(psh, n, 0)) == NULL) { outfmt(psh->out2, "alias: %s not found\n", n); ret = 1; } else { out1fmt(psh, "alias %s=", n); print_quoted(psh, ap->val); out1c(psh, '\n'); } } else { *v++ = '\0'; setalias(psh, n, v); } } return (ret); } int unaliascmd(shinstance *psh, int argc, char **argv) { int i; while ((i = nextopt(psh, "a")) != '\0') { if (i == 'a') { rmaliases(psh); return (0); } } for (i = 0; *psh->argptr; psh->argptr++) i = unalias(psh, *psh->argptr); return (i); } STATIC struct alias ** hashalias(shinstance *psh, char *p) { unsigned int hashval; hashval = *p << 4; while (*p) hashval+= *p++; return &psh->atab[hashval % ATABSIZE]; } kbuild-3608/src/kash/show.c0000664000175000017500000002610114670377416015566 0ustar locutuslocutus/* $NetBSD: show.c,v 1.26 2003/11/14 10:46:13 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)show.c 8.3 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: show.c,v 1.26 2003/11/14 10:46:13 dsl Exp $"); #endif /* not lint */ #endif #include #include #include #include "shell.h" #include "parser.h" #include "nodes.h" #include "mystring.h" #include "show.h" #include "options.h" #include "shinstance.h" #ifdef DEBUG static void shtree(union node *, int, char *, FILE*); static void shcmd(union node *, FILE *); static void sharg(union node *, FILE *); static void indent(int, char *, FILE *); static void trstring(shinstance *, char *); void showtree(shinstance *psh, union node *n) { trputs(psh, "showtree called\n"); shtree(n, 1, NULL, stdout); } static void shtree(union node *n, int ind, char *pfx, FILE *fp) { struct nodelist *lp; const char *s; if (n == NULL) return; indent(ind, pfx, fp); switch(n->type) { case NSEMI: s = "; "; goto binop; case NAND: s = " && "; goto binop; case NOR: s = " || "; binop: shtree(n->nbinary.ch1, ind, NULL, fp); /* if (ind < 0) */ fputs(s, fp); shtree(n->nbinary.ch2, ind, NULL, fp); break; case NCMD: shcmd(n, fp); if (ind >= 0) putc('\n', fp); break; case NPIPE: for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) { shcmd(lp->n, fp); if (lp->next) fputs(" | ", fp); } if (n->npipe.backgnd) fputs(" &", fp); if (ind >= 0) putc('\n', fp); break; default: fprintf(fp, "", n->type); if (ind >= 0) putc('\n', fp); break; } } static void shcmd(union node *cmd, FILE *fp) { union node *np; int first; const char *s; int dftfd; first = 1; for (np = cmd->ncmd.args ; np ; np = np->narg.next) { if (! first) putchar(' '); sharg(np, fp); first = 0; } for (np = cmd->ncmd.redirect ; np ; np = np->nfile.next) { if (! first) putchar(' '); switch (np->nfile.type) { case NTO: s = ">"; dftfd = 1; break; case NCLOBBER: s = ">|"; dftfd = 1; break; case NAPPEND: s = ">>"; dftfd = 1; break; case NTOFD: s = ">&"; dftfd = 1; break; case NFROM: s = "<"; dftfd = 0; break; case NFROMFD: s = "<&"; dftfd = 0; break; case NFROMTO: s = "<>"; dftfd = 0; break; default: s = "*error*"; dftfd = 0; break; } if (np->nfile.fd != dftfd) fprintf(fp, "%d", np->nfile.fd); fputs(s, fp); if (np->nfile.type == NTOFD || np->nfile.type == NFROMFD) { fprintf(fp, "%d", np->ndup.dupfd); } else { sharg(np->nfile.fname, fp); } first = 0; } } static void sharg(union node *arg, FILE *fp) { char *p; struct nodelist *bqlist; int subtype; if (arg->type != NARG) { printf("\n", arg->type); abort(); } bqlist = arg->narg.backquote; for (p = arg->narg.text ; *p ; p++) { switch (*p) { case CTLESC: putc(*++p, fp); break; case CTLVAR: putc('$', fp); putc('{', fp); subtype = *++p; if (subtype == VSLENGTH) putc('#', fp); while (*p != '=') putc(*p++, fp); if (subtype & VSNUL) putc(':', fp); switch (subtype & VSTYPE) { case VSNORMAL: putc('}', fp); break; case VSMINUS: putc('-', fp); break; case VSPLUS: putc('+', fp); break; case VSQUESTION: putc('?', fp); break; case VSASSIGN: putc('=', fp); break; case VSTRIMLEFT: putc('#', fp); break; case VSTRIMLEFTMAX: putc('#', fp); putc('#', fp); break; case VSTRIMRIGHT: putc('%', fp); break; case VSTRIMRIGHTMAX: putc('%', fp); putc('%', fp); break; case VSLENGTH: break; default: printf("", subtype); } break; case CTLENDVAR: putc('}', fp); break; case CTLBACKQ: case CTLBACKQ|CTLQUOTE: putc('$', fp); putc('(', fp); shtree(bqlist->n, -1, NULL, fp); putc(')', fp); break; default: putc(*p, fp); break; } } } static void indent(int amount, char *pfx, FILE *fp) { int i; for (i = 0 ; i < amount ; i++) { if (pfx && i == amount - 1) fputs(pfx, fp); putc('\t', fp); } } #endif #ifdef DEBUG /* * Debugging stuff. */ /** @def TRY_GET_PSH_OR_RETURN * Make sure @a psh is valid, trying to fetch it from TLS * if it's NULL and returning (void) if that fails. */ # define TRY_GET_PSH_OR_RETURN(psh) \ if (!(psh)) { \ (psh) = shthread_get_shell(); \ if (!(psh)) \ return; \ } else do { } while (0) /** @def RETURN_IF_NOT_TRACING * Return if we're not tracing. */ # define RETURN_IF_NOT_TRACING(psh) \ if (debug(psh) != 1 || psh->tracefd == -1) \ return; \ else do {} while (0) /* Flushes the tracebuf. */ static void trace_flush(shinstance *psh) { size_t pos = psh->tracepos; if (pos > sizeof(psh->tracebuf)) { char *end; kHlpAssert(0); end = memchr(psh->tracebuf, '\0', sizeof(psh->tracebuf)); pos = end ? end - &psh->tracebuf[0] : 0; } if (pos) { int s = errno; char prefix[40]; size_t len; #ifdef SH_FORKED_MODE len = sprintf(prefix, "[%" SHPID_PRI "] ", sh_getpid(psh)); #else shpid pid = sh_getpid(psh); len = sprintf(prefix, "[%d/%d] ", SHPID_GET_PID(pid), SHPID_GET_TID(pid)); #endif shfile_write(&psh->fdtab, psh->tracefd, prefix, len); shfile_write(&psh->fdtab, psh->tracefd, psh->tracebuf, pos); psh->tracepos = 0; psh->tracebuf[0] = '\0'; errno = s; } } /* Adds a char to the trace buffer. */ static void trace_char(shinstance *psh, int c) { size_t pos = psh->tracepos; if (pos >= sizeof(psh->tracebuf) - 1) { trace_flush(psh); pos = psh->tracepos; } psh->tracebuf[pos] = c; psh->tracepos = pos + 1; if (c == '\n') trace_flush(psh); else psh->tracebuf[pos + 1] = '\0'; } /* Add a string to the trace buffer. */ static void trace_string(shinstance *psh, const char *str) { /* push it out line by line. */ while (*str) { /* find line/string length. */ size_t pos; size_t len; const char *end = str; int flush_it = 0; while (*end) { if (*end++ == '\n') { flush_it = 1; break; } } len = end - str; /* copy to the buffer */ pos = psh->tracepos; if (pos + len <= sizeof(psh->tracebuf)) { memcpy(&psh->tracebuf[pos], str, len); psh->tracepos = pos + len; if (flush_it) trace_flush(psh); } else { /* it's too big for some reason... */ int s = errno; trace_flush(psh); shfile_write(&psh->fdtab, psh->tracefd, str, len); if (!flush_it) shfile_write(&psh->fdtab, psh->tracefd, "[too long]\n", sizeof( "[too long]\n") - 1); errno = s; } /* advance */ str = end; } } void trputc(shinstance *psh, int c) { TRY_GET_PSH_OR_RETURN(psh); RETURN_IF_NOT_TRACING(psh); trace_char(psh, c); } void trace(shinstance *psh, const char *fmt, ...) { va_list va; char buf[2048]; TRY_GET_PSH_OR_RETURN(psh); RETURN_IF_NOT_TRACING(psh); va_start(va, fmt); # ifdef _MSC_VER _vsnprintf(buf, sizeof(buf), fmt, va); # else vsnprintf(buf, sizeof(buf), fmt, va); # endif va_end(va); trace_string(psh, buf); } void tracev(shinstance *psh, const char *fmt, va_list va) { char buf[2048]; TRY_GET_PSH_OR_RETURN(psh); RETURN_IF_NOT_TRACING(psh); # ifdef _MSC_VER _vsnprintf(buf, sizeof(buf), fmt, va); # else vsnprintf(buf, sizeof(buf), fmt, va); # endif trace_string(psh, buf); } void trputs(shinstance *psh, const char *s) { TRY_GET_PSH_OR_RETURN(psh); RETURN_IF_NOT_TRACING(psh); trace_string(psh, s); trace_char(psh, '\n'); } static void trstring(shinstance *psh, char *s) { char *p; char c; TRY_GET_PSH_OR_RETURN(psh); RETURN_IF_NOT_TRACING(psh); trace_char(psh, '"'); for (p = s ; *p ; p++) { switch (*p) { case '\n': c = 'n'; goto backslash; case '\t': c = 't'; goto backslash; case '\r': c = 'r'; goto backslash; case '"': c = '"'; goto backslash; case '\\': c = '\\'; goto backslash; case CTLESC: c = 'e'; goto backslash; case CTLVAR: c = 'v'; goto backslash; case CTLVAR+CTLQUOTE: c = 'V'; goto backslash; case CTLBACKQ: c = 'q'; goto backslash; case CTLBACKQ+CTLQUOTE: c = 'Q'; goto backslash; backslash: trace_char(psh, '\\'); trace_char(psh, c); break; default: if (*p >= ' ' && *p <= '~') trace_char(psh, *p); else { trace_char(psh, '\\'); trace_char(psh, *p >> 6 & 03); trace_char(psh, *p >> 3 & 07); trace_char(psh, *p & 07); } break; } } trace_char(psh, '"'); } void trargs(shinstance *psh, char **ap) { TRY_GET_PSH_OR_RETURN(psh); RETURN_IF_NOT_TRACING(psh); while (*ap) { trstring(psh, *ap++); if (*ap) trace_char(psh, ' '); else trace_char(psh, '\n'); } } void opentrace(shinstance *psh) { static const char s[] = "./trace"; TRY_GET_PSH_OR_RETURN(psh); if (debug(psh) != 1) { /* disabled */ if (psh->tracefd != -1) { trace_flush(psh); shfile_close(&psh->fdtab, psh->tracefd); psh->tracefd = -1; } return; } /* else: (re-)enabled */ if (psh->tracefd != -1) return; psh->tracefd = shfile_open(&psh->fdtab, s, O_APPEND | O_RDWR | O_CREAT, 0600); if (psh->tracefd != -1) { /* relocate it */ int want_fd = 199; while (want_fd > 10) { int fd2 = shfile_fcntl(&psh->fdtab, psh->tracefd, F_DUPFD, want_fd); if (fd2 != -1) { shfile_close(&psh->fdtab, psh->tracefd); psh->tracefd = fd2; break; } want_fd = ((want_fd + 1) / 2) - 1; } shfile_cloexec(&psh->fdtab, psh->tracefd, 1 /* close it */); shfile_set_trace(&psh->fdtab, psh->tracefd); } if (psh->tracefd == -1) { fprintf(stderr, "Can't open %s\n", s); debug(psh) = 0; return; } trace_string(psh, "Tracing started.\n"); } #endif /* DEBUG */ kbuild-3608/src/kash/nodes.c.pat0000664000175000017500000001025514670377416016504 0ustar locutuslocutus/* $NetBSD: nodes.c.pat,v 1.12 2004/06/15 22:57:27 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)nodes.c.pat 8.2 (Berkeley) 5/4/95 */ #include /* * Routine for dealing with parsed shell commands. */ #include "shell.h" #include "nodes.h" #include "memalloc.h" #include "machdep.h" #include "mystring.h" #include "shinstance.h" #ifndef KASH_SEPARATE_PARSER_ALLOCATOR size_t funcblocksize; /* size of structures in function */ size_t funcstringsize; /* size of strings in node */ pointer funcblock; /* block to allocate function from */ char *funcstring; /* block to allocate strings from */ %SIZES STATIC void calcsize(union node *); STATIC void sizenodelist(struct nodelist *); STATIC union node *copynode(union node *); STATIC struct nodelist *copynodelist(struct nodelist *); STATIC char *nodesavestr(char *); #endif /* !KASH_SEPARATE_PARSER_ALLOCATOR */ /* * Make a copy of a parse tree. */ union node * copyfunc(psh, n) struct shinstance *psh; union node *n; { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR if (n != NULL) { unsigned refs = pstackretain(n->pblock); TRACE2((psh, "copyfunc: %p - %u refs\n", n->pblock, refs)); K_NOREF(refs); } return n; #else if (n == NULL) return NULL; funcblocksize = 0; funcstringsize = 0; calcsize(n); funcblock = ckmalloc(psh, funcblocksize + funcstringsize); funcstring = (char *) funcblock + funcblocksize; return copynode(n); #endif } #ifndef KASH_SEPARATE_PARSER_ALLOCATOR STATIC void calcsize(n) union node *n; { %CALCSIZE } STATIC void sizenodelist(lp) struct nodelist *lp; { while (lp) { funcblocksize += SHELL_ALIGN(sizeof(struct nodelist)); calcsize(lp->n); lp = lp->next; } } STATIC union node * copynode(n) union node *n; { union node *new; %COPY return new; } STATIC struct nodelist * copynodelist(lp) struct nodelist *lp; { struct nodelist *start; struct nodelist **lpp; lpp = &start; while (lp) { *lpp = funcblock; funcblock = (char *) funcblock + SHELL_ALIGN(sizeof(struct nodelist)); (*lpp)->n = copynode(lp->n); lp = lp->next; lpp = &(*lpp)->next; } *lpp = NULL; return start; } STATIC char * nodesavestr(s) char *s; { register char *p = s; register char *q = funcstring; char *rtn = funcstring; while ((*q++ = *p++) != 0) continue; funcstring = q; return rtn; } #endif /* !KASH_SEPARATE_PARSER_ALLOCATOR */ /* * Free a parse tree. */ void freefunc(psh, n) shinstance *psh; union node *n; { #ifdef KASH_SEPARATE_PARSER_ALLOCATOR if (n) pstackrelease(psh, n->pblock, "freefunc"); #else if (n) ckfree(psh, n); #endif } kbuild-3608/src/kash/mystring.h0000664000175000017500000000447214670377416016476 0ustar locutuslocutus/* $NetBSD: mystring.h,v 1.11 2003/08/07 09:05:35 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)mystring.h 8.2 (Berkeley) 5/4/95 */ #ifndef ___mystring_h #define ___mystring_h #include #include "shtypes.h" /* ssize_t */ void scopyn(const char *, char *, ssize_t); int prefix(const char *, const char *); int number(struct shinstance *, const char *); int is_number(const char *); #if !defined(RT_OS_FREEBSD) && !defined(RT_OS_NETBSD) && !defined(RT_OS_OPENBSD) && !defined(RT_OS_OS2) \ && /* newer darwin: */ !defined(strlcpy) size_t strlcpy(char *dst, const char *src, size_t siz); #endif #define equal(s1, s2) (strcmp(s1, s2) == 0) #define scopy(s1, s2) ((void)strcpy(s2, s1)) #endif kbuild-3608/src/kash/tests/0000775000175000017500000000000014670377416015604 5ustar locutuslocutuskbuild-3608/src/kash/tests/Makefile.kmk0000664000175000017500000000340014670377416020022 0ustar locutuslocutus# $Id: Makefile.kmk 3433 2020-09-02 17:25:31Z bird $ ## @file # Sub-makefile for kash tests. # # # Copyright (c) 2005-2010 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # SUB_DEPTH = ../../.. include $(KBUILD_PATH)/subheader.kmk # # The program. # TESTING += kash_tests KASH_TEST_BIN = $(if $(kash_1_TARGET),$(kash_1_TARGET),$(PATH_INS)/$(TEMPLATE_BIN_INST)kmk_ash$(SUFF_EXE)) KASH_TEST_DIR := $(PATH_SUB_CURRENT) KASH_TESTCASES := $(addprefix $(KASH_TEST_DIR)/,\ trap-exit-1 \ trap-int-1 \ trap-term-1 \ tick-1 \ redirect-1 \ redirect-2 \ redirect-3 \ pipe-1 \ pipe-2 \ ) # exec-1 - lost kash_tests:: $(ECHO) "kash tests..." @export KASH_TEST_DIR=$(KASH_TEST_DIR); \ KASH_FAILURE=0; \ $(foreach test,$(KASH_TESTCASES)\ ,echo " * $(KASH_TEST_BIN) $(test)"; \ if ! $(KASH_TEST_BIN) $(test); then \ echo " => FAILURE!"; \ KASH_FAILURE=`$(EXPR_EXT) $${KASH_FAILURE} + 1`; \ fi; \ ) \ if test $$KASH_FAILURE -eq 0; then \ echo 'kash tests: All tests succeeded.'; \ else \ echo "kash tests: $$KASH_FAILURE tests failed"'!!'; \ echo ""; \ exit 1; \ fi include $(FILE_KBUILD_SUB_FOOTER) kbuild-3608/src/kash/tests/redirect-30000775000175000017500000000054614670377416017500 0ustar locutuslocutus#!/bin/sh # Redirect input to an external command. . ${KASH_TEST_DIR}/common-include.sh TMPFILE="/tmp/redirect-3.$$.tmp" echo 1 > $TMPFILE echo 2 >> $TMPFILE echo 3 >> $TMPFILE VAR=`$CMD_SED -e '/2/!d' < $TMPFILE` $CMD_RM -f $TMPFILE if test "$VAR" != "2"; then echo "redirect-3: FAILURE - VAR=$VAR." exit 1 fi echo "redirect-3: SUCCESS" exit 0 kbuild-3608/src/kash/tests/redirect-20000775000175000017500000000054114670377416017472 0ustar locutuslocutus#!/bin/sh # Redirect output from builtin commands in a subshell. . ${KASH_TEST_DIR}/common-include.sh TMPFILE="/tmp/redirect-2.$$.tmp" (echo -n 1 ; echo -n 2 ; echo -n 3 ) > $TMPFILE VAR=`$CMD_CAT $TMPFILE` $CMD_RM -f $TMPFILE if test "$VAR" != "123"; then echo "redirect-2: FAILURE - VAR=$VAR" exit 1 fi echo "redirect-2: SUCCESS" exit 0 kbuild-3608/src/kash/tests/trap-exit-10000775000175000017500000000012514670377416017603 0ustar locutuslocutus#!/bin/sh trap 'echo "trap-exit-1: overriding exit 1"; exit 0' EXIT exit 1 exit 2 kbuild-3608/src/kash/tests/pipe-10000664000175000017500000000053014670377416016620 0ustar locutuslocutus#!/bin/sh # Pipes input from an builtin command thru an external one. . ${KASH_TEST_DIR}/common-include.sh TMPFILE="/tmp/pipe-1.$$.tmp" echo piped | $CMD_SED -e 's/piped/1/' > $TMPFILE VAR=`$CMD_CAT $TMPFILE` $CMD_RM -f $TMPFILE if test "$VAR" != "1"; then echo "pipe-1: FAILURE - VAR=$VAR" exit 1 fi echo "pipe-1: SUCCESS" exit 0 kbuild-3608/src/kash/tests/netbsd/0000775000175000017500000000000014670377416017063 5ustar locutuslocutuskbuild-3608/src/kash/tests/netbsd/waitjob0000775000175000017500000000014114670377416020444 0ustar locutuslocutus#!/bin/sh sleep 3 & sleep 1 & wait %1 [ $? = 0 ] || echo fail1 wait %2 [ $? = 0 ] || echo fail2 kbuild-3608/src/kash/tests/netbsd/var10000775000175000017500000000014314670377416017660 0ustar locutuslocutus#!/bin/sh line='/foo/bar/*/baz' if [ "/foo/bar/" != ${line%%\**}"" ] then echo broken exit 1 fi kbuild-3608/src/kash/tests/netbsd/exit10000775000175000017500000000014614670377416020044 0ustar locutuslocutus#!/bin/sh x=`( trap 'echo exiting' EXIT; /usr/bin/true )` if [ -z "$x" ] then echo failed exit 1 fi kbuild-3608/src/kash/tests/trap-term-10000775000175000017500000000013014670377416017575 0ustar locutuslocutus#!/bin/sh trap 'echo "trap-term-1: caught SIGTERM"; exit 0' TERM kill -TERM $$ exit 2 kbuild-3608/src/kash/tests/trap-int-10000775000175000017500000000012414670377416017423 0ustar locutuslocutus#!/bin/sh trap 'echo "trap-int-1: caught SIGINT"; exit 0' INT kill -INT $$ exit 2 kbuild-3608/src/kash/tests/redirect-10000775000175000017500000000046314670377416017474 0ustar locutuslocutus#!/bin/sh # Redirect output from a builtin command. . ${KASH_TEST_DIR}/common-include.sh TMPFILE="/tmp/redirect-1.$$.tmp" echo 1 > $TMPFILE VAR=`$CMD_CAT $TMPFILE` $CMD_RM -f $TMPFILE if test "$VAR" != "1"; then echo "redirect-1: FAILURE - VAR=$VAR" exit 1 fi echo "redirect-1: SUCCESS" exit 0 kbuild-3608/src/kash/tests/tick-10000775000175000017500000000024014670377416016616 0ustar locutuslocutus#!/bin/sh VAR=`echo "echoed string"` if test "$VAR" != "echoed string"; then echo "tick-1: failure: VAR=$VAR" exit 1 fi echo 'tick-1: SUCCESS' exit 0 kbuild-3608/src/kash/tests/pipe-20000664000175000017500000000125214670377416016623 0ustar locutuslocutus#!/bin/sh # Pipes input from an builtin command thru an external one. . ${KASH_TEST_DIR}/common-include.sh TMPFILE1="/tmp/pipe-2a.$$.tmp" TMPFILE2="/tmp/pipe-2b.$$.tmp" echo piped > $TMPFILE1 $CMD_CAT $TMPFILE1 \ | $CMD_SED -e 's/piped/abc/' \ | $CMD_SED -e 's/abc/def/' \ | $CMD_SED -e 's/def/ghi/' \ | $CMD_SED -e 's/ghi/jkl/' \ | $CMD_SED -e 's/jkl/mno/' \ | $CMD_SED -e 's/mno/pqr/' \ | $CMD_SED -e 's/pqr/stu/' \ | $CMD_SED -e 's/stu/vwx/' \ | $CMD_SED -e 's/vwx/yz_/' \ > $TMPFILE2 VAR=`$CMD_CAT $TMPFILE2` $CMD_RM -f -- $TMPFILE1 $TMPFILE2 if test "$VAR" != "yz_"; then echo "pipe-2: FAILURE - VAR=$VAR" exit 1 fi echo "pipe-2: SUCCESS" exit 0 kbuild-3608/src/kash/tests/common-include.sh0000775000175000017500000000053314670377416021055 0ustar locutuslocutus# File to be sourced. Contains pointers to a bunch of shell utilities. CMD_PREFIX=kmk_ CMD_CAT=${CMD_PREFIX}cat CMD_CP=${CMD_PREFIX}cp CMD_EXPR=${CMD_PREFIX}expr CMD_INSTALL=${CMD_PREFIX}install CMD_LN=${CMD_PREFIX}ln CMD_MV=${CMD_PREFIX}mv CMD_RM=${CMD_PREFIX}rm CMD_SED=${CMD_PREFIX}sed CMD_SLEEP=${CMD_PREFIX}sleep CMD_TIME=${CMD_PREFIX}time kbuild-3608/src/kash/show.h0000664000175000017500000000410514670377416015573 0ustar locutuslocutus/* $NetBSD: show.h,v 1.7 2003/08/07 09:05:38 agc Exp $ */ /*- * Copyright (c) 1995 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)show.h 1.1 (Berkeley) 5/4/95 */ #ifndef ___show_h #define ___show_h #include union node; void showtree(struct shinstance *, union node *); #ifdef DEBUG void trace(struct shinstance *, const char *, ...); void tracev(struct shinstance *, const char *, va_list); void trargs(struct shinstance *, char **); void trputc(struct shinstance *, int); void trputs(struct shinstance *, const char *); void opentrace(struct shinstance *); #endif #endif kbuild-3608/src/kash/shell.h0000664000175000017500000000613714670377416015731 0ustar locutuslocutus/* $NetBSD: shell.h,v 1.17 2003/08/07 09:05:38 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)shell.h 8.2 (Berkeley) 5/4/95 */ /* * The follow should be set to reflect the type of system you have: * JOBS -> 1 if you have Berkeley job control, 0 otherwise. * SHORTNAMES -> 1 if your linker cannot handle long names. * define BSD if you are running 4.2 BSD or later. * define SYSV if you are running under System V. * define DEBUG=1 to compile in debugging ('set -o debug' to turn on) * define DEBUG=2 to compile in and turn on debugging. * define DO_SHAREDVFORK to indicate that vfork(2) shares its address * with its parent. * * When debugging is on, debugging info will be written to ./trace and * a quit signal will generate a core dump. */ #ifndef ___shell_h #define ___shell_h #ifndef _MSC_VER # include #endif #define JOBS 1 #ifndef BSD # define BSD 1 #endif #if 0 #ifndef DO_SHAREDVFORK # if __NetBSD_Version__ >= 104000000 # define DO_SHAREDVFORK # endif #endif #endif typedef void *pointer; #ifndef NULL # define NULL (void *)0 #endif #define STATIC /* empty */ #define MKINIT /* empty */ #ifdef HAVE_SYS_CDEFS_H # include #endif extern char nullstr[1]; /* null string */ #ifdef DEBUG # define TRACE(param) trace param # define TRACEV(param) tracev param #else # define TRACE(param) # define TRACEV(param) #endif #include "shtypes.h" #ifndef SH_FORKED_MODE # ifndef KASH_USE_FORKSHELL2 # define KASH_USE_FORKSHELL2 # endif #endif #endif kbuild-3608/src/kash/expand.h0000664000175000017500000000555014670377416016077 0ustar locutuslocutus/* $NetBSD: expand.h,v 1.16 2004/07/13 15:05:59 seb Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)expand.h 8.2 (Berkeley) 5/4/95 */ #ifndef ___expand_h #define ___expand_h #include "shtypes.h" struct strlist { struct strlist *next; char *text; }; struct arglist { struct strlist *list; struct strlist **lastp; }; /* * expandarg() flags */ #define EXP_FULL 0x1 /* perform word splitting & file globbing */ #define EXP_TILDE 0x2 /* do normal tilde expansion */ #define EXP_VARTILDE 0x4 /* expand tildes in an assignment */ #define EXP_REDIR 0x8 /* file glob for a redirection (1 match only) */ #define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */ #define EXP_IFS_SPLIT 0x20 /* need to record arguments for ifs breakup */ union node; void expandhere(struct shinstance *, union node *, int); void expandarg(struct shinstance *, union node *, struct arglist *, int); int patmatch(struct shinstance *, char *, char *, int); void rmescapes(struct shinstance *, char *); int casematch(struct shinstance *, union node *, char *); int wordexpcmd(struct shinstance *, int, char **); /* From arith.y */ int arith(struct shinstance *, const char *); int expcmd(struct shinstance *, int , char **); void arith_lex_reset(void); int yylex(void); #endif kbuild-3608/src/kash/myhistedit.h0000664000175000017500000000416114670377416017000 0ustar locutuslocutus/* $NetBSD: myhistedit.h,v 1.10 2003/08/07 09:05:35 agc Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)myhistedit.h 8.2 (Berkeley) 5/4/95 */ #ifndef SMALL #include /*extern History *hist; extern EditLine *el;*/ #endif /*extern int displayhist;*/ void histedit(struct shinstance *); void sethistsize(struct shinstance *, const char *); void setterm(struct shinstance *, const char *); int histcmd(struct shinstance *, int, char **); int inputrc(struct shinstance *, int, char **); int not_fcnumber(struct shinstance *, char *); int str_to_event(struct shinstance *, const char *, int); kbuild-3608/src/kash/shfile.c0000664000175000017500000024404014670377416016064 0ustar locutuslocutus/* $Id: shfile.c 3542 2022-01-29 01:36:00Z bird $ */ /** @file * * File management. * * Copyright (c) 2007-2010 knut st. osmundsen * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "shfile.h" #include "shinstance.h" /* TRACE2 */ #include #include #include #if K_OS == K_OS_WINDOWS # include # define WIN32_NO_STATUS # include # if !defined(_WIN32_WINNT) # define _WIN32_WINNT 0x0502 /* Windows Server 2003 */ # endif # include //NTSTATUS #else # include # include # include #endif /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def SHFILE_IN_USE * Whether the file descriptor table stuff is actually in use or not. */ #if K_OS == K_OS_WINDOWS \ || K_OS == K_OS_OPENBSD /* because of ugly pthread library pipe hacks */ \ || !defined(SH_FORKED_MODE) # define SHFILE_IN_USE #endif /** The max file table size. */ #define SHFILE_MAX 1024 /** The file table growth rate. */ #define SHFILE_GROW 64 /** The min native unix file descriptor. */ #define SHFILE_UNIX_MIN_FD 32 /** The path buffer size we use. */ #define SHFILE_MAX_PATH 4096 /** Set errno and return. Doing a trace in debug build. */ #define RETURN_ERROR(rc, err, msg) \ do { \ TRACE2((NULL, "%s: " ## msg ## " - returning %d / %d\n", __FUNCTION__, (rc), (err))); \ errno = (err); \ return (rc); \ } while (0) #if K_OS == K_OS_WINDOWS /* See msdos.h for description. */ # define FOPEN 0x01 # define FEOFLAG 0x02 # define FCRLF 0x04 # define FPIPE 0x08 # define FNOINHERIT 0x10 # define FAPPEND 0x20 # define FDEV 0x40 # define FTEXT 0x80 # define MY_ObjectBasicInformation 0 # define MY_FileNamesInformation 12 typedef struct { ULONG Attributes; ACCESS_MASK GrantedAccess; ULONG HandleCount; ULONG PointerCount; ULONG PagedPoolUsage; ULONG NonPagedPoolUsage; ULONG Reserved[3]; ULONG NameInformationLength; ULONG TypeInformationLength; ULONG SecurityDescriptorLength; LARGE_INTEGER CreateTime; } MY_OBJECT_BASIC_INFORMATION; #if 0 typedef struct { union { LONG Status; PVOID Pointer; }; ULONG_PTR Information; } MY_IO_STATUS_BLOCK; #else typedef IO_STATUS_BLOCK MY_IO_STATUS_BLOCK; #endif typedef MY_IO_STATUS_BLOCK *PMY_IO_STATUS_BLOCK; typedef struct { ULONG NextEntryOffset; ULONG FileIndex; ULONG FileNameLength; WCHAR FileName[1]; } MY_FILE_NAMES_INFORMATION, *PMY_FILE_NAMES_INFORMATION; typedef NTSTATUS (NTAPI * PFN_NtQueryObject)(HANDLE, int, void *, size_t, size_t *); typedef NTSTATUS (NTAPI * PFN_NtQueryDirectoryFile)(HANDLE, HANDLE, void *, void *, PMY_IO_STATUS_BLOCK, void *, ULONG, int, int, PUNICODE_STRING, int); typedef NTSTATUS (NTAPI * PFN_RtlUnicodeStringToAnsiString)(PANSI_STRING, PCUNICODE_STRING, int); #endif /* K_OS_WINDOWS */ /********************************************************************************************************************************* * Global Variables * *********************************************************************************************************************************/ #if K_OS == K_OS_WINDOWS static int g_shfile_globals_initialized = 0; static PFN_NtQueryObject g_pfnNtQueryObject = NULL; static PFN_NtQueryDirectoryFile g_pfnNtQueryDirectoryFile = NULL; static PFN_RtlUnicodeStringToAnsiString g_pfnRtlUnicodeStringToAnsiString = NULL; # ifdef KASH_ASYNC_CLOSE_HANDLE /** Data for the asynchronous CloseHandle machinery. */ static struct shfileasyncclose { /** Mutex protecting the asynchronous CloseHandle stuff. */ shmtx mtx; /** Handle to event that the closer-threads are waiting on. */ HANDLE evt_workers; /** The ring buffer read index (for closer-threads). */ unsigned volatile idx_read; /** The ring buffer write index (for shfile_native_close). * When idx_read and idx_write are the same, the ring buffer is empty. */ unsigned volatile idx_write; /** Number of handles currently being pending closure (handles + current * CloseHandle calls). */ unsigned volatile num_pending; /** Set if the threads should terminate. */ KBOOL volatile terminate_threads; /** Set if one or more shell threads have requested evt_sync to be signalled * when there are no more pending requests. */ KBOOL volatile signal_sync; /** Number of threads that have been spawned. */ KU8 num_threads; /** Handle to event that the shell threads are waiting on to sync. */ HANDLE evt_sync; /** Ring buffer containing handles to be closed. */ HANDLE handles[32]; /** Worker threads doing the asynchronous closing. */ HANDLE threads[8]; } g_shfile_async_close; # endif #endif /* K_OS_WINDOWS */ /********************************************************************************************************************************* * Internal Functions * *********************************************************************************************************************************/ #ifdef SHFILE_IN_USE # if K_OS == K_OS_WINDOWS static HANDLE shfile_set_inherit_win(shfile *pfd, int set); # endif #endif #ifdef SHFILE_IN_USE # ifdef DEBUG # if K_OS == K_OS_WINDOWS static KU64 shfile_nano_ts(void) { static KBOOL volatile s_has_factor = K_FALSE; static double volatile s_factor; double factor; LARGE_INTEGER now; if (s_has_factor) factor = s_factor; else { QueryPerformanceFrequency(&now); s_factor = factor = (double)1000000000.0 / now.QuadPart; s_has_factor = K_TRUE; } QueryPerformanceCounter(&now); return (KU64)(now.QuadPart * factor); } # endif /* K_OS_WINDOWS */ # endif /* DEBUG */ # if K_OS == K_OS_WINDOWS && defined(KASH_ASYNC_CLOSE_HANDLE) /** * The closer thread function. */ static unsigned __stdcall shfile_async_close_handle_thread(void *ignored) { KBOOL decrement_pending = K_FALSE; shthread_set_name("Async CloseHandle"); while (!g_shfile_async_close.terminate_threads) { HANDLE toclose; unsigned idx; shmtxtmp tmp; /* * Grab a handle if there is one: */ shmtx_enter(&g_shfile_async_close.mtx, &tmp); if (decrement_pending) { kHlpAssert(g_shfile_async_close.num_pending > 0); g_shfile_async_close.num_pending -= 1; } idx = g_shfile_async_close.idx_read % K_ELEMENTS(g_shfile_async_close.handles); if (idx != g_shfile_async_close.idx_write % K_ELEMENTS(g_shfile_async_close.handles)) { kHlpAssert(g_shfile_async_close.num_pending > 0); toclose = g_shfile_async_close.handles[idx]; kHlpAssert(toclose); g_shfile_async_close.handles[idx] = NULL; g_shfile_async_close.idx_read = (idx + 1) % K_ELEMENTS(g_shfile_async_close.handles); } else { /* Signal waiters if requested and we've reached zero pending requests. */ if (g_shfile_async_close.signal_sync && g_shfile_async_close.num_pending == 0) { BOOL rc = SetEvent(g_shfile_async_close.evt_sync); kHlpAssert(rc); g_shfile_async_close.signal_sync = FALSE; } toclose = NULL; } shmtx_leave(&g_shfile_async_close.mtx, &tmp); /* Do the closing if we have something to close, otherwise wait for work to arrive. */ if (toclose != NULL) { BOOL rc = CloseHandle(toclose); kHlpAssert(rc); decrement_pending = K_TRUE; } else { DWORD dwRet = WaitForSingleObject(g_shfile_async_close.evt_workers, 10000 /*ms*/); kHlpAssert(dwRet == WAIT_OBJECT_0 || dwRet == WAIT_TIMEOUT); decrement_pending = K_FALSE; } } K_NOREF(ignored); return 0; } /** * Try submit a handle for automatic closing. * * @returns K_TRUE if submitted successfully, K_FALSE if not. */ static KBOOL shfile_async_close_submit(HANDLE toclose) { KBOOL ret; unsigned idx; unsigned idx_next; unsigned idx_read; unsigned num_pending = 0; unsigned num_threads = 0; shmtxtmp tmp; shmtx_enter(&g_shfile_async_close.mtx, &tmp); /* Get the write index and check that there is a free slot in the buffer: */ idx = g_shfile_async_close.idx_write % K_ELEMENTS(g_shfile_async_close.handles); idx_next = (idx + 1) % K_ELEMENTS(g_shfile_async_close.handles); idx_read = g_shfile_async_close.idx_read % K_ELEMENTS(g_shfile_async_close.handles); if (idx_next != idx_read) { /* Write the handle to the ring buffer: */ kHlpAssert(g_shfile_async_close.handles[idx] == NULL); g_shfile_async_close.handles[idx] = toclose; g_shfile_async_close.idx_write = idx_next; num_pending = g_shfile_async_close.num_pending + 1; g_shfile_async_close.num_pending = num_pending; ret = SetEvent(g_shfile_async_close.evt_workers); kHlpAssert(ret); if (ret) { /* If we have more pending requests than threads, create a new thread. */ num_threads = g_shfile_async_close.num_threads; if (num_pending > num_threads && num_threads < K_ELEMENTS(g_shfile_async_close.threads)) { int const savederrno = errno; unsigned tid = 0; intptr_t hThread = _beginthreadex(NULL /*security*/, 0 /*stack_size*/, shfile_async_close_handle_thread, NULL /*arg*/, 0 /*initflags*/, &tid); kHlpAssert(hThread != -1); if (hThread != -1) { g_shfile_async_close.threads[num_threads] = (HANDLE)hThread; g_shfile_async_close.num_threads = ++num_threads; } else { TRACE2((NULL, "shfile_async_close_submit: _beginthreadex failed: %d\n", errno)); if (num_threads == 0) ret = K_FALSE; } errno = savederrno; } } else TRACE2((NULL, "shfile_async_close_submit: SetEvent(%p) failed: %u\n", g_shfile_async_close.evt_workers, GetLastError())); /* cleanup on failure. */ if (ret) { /* likely */ } else { g_shfile_async_close.handles[idx] = NULL; g_shfile_async_close.idx_write = idx; g_shfile_async_close.num_pending = num_pending - 1; } } else ret = K_FALSE; shmtx_leave(&g_shfile_async_close.mtx, &tmp); TRACE2((NULL, "shfile_async_close_submit: toclose=%p idx=%d #pending=%u #thread=%u -> %d\n", toclose, idx, num_pending, num_threads, ret)); return ret; } /** * Wait for all pending CloseHandle calls to complete. */ void shfile_async_close_sync(void) { shmtxtmp tmp; shmtx_enter(&g_shfile_async_close.mtx, &tmp); if (g_shfile_async_close.num_pending > 0) { DWORD dwRet; /** @todo help out? */ if (!g_shfile_async_close.signal_sync) { BOOL rc = ResetEvent(g_shfile_async_close.evt_sync); kHlpAssert(rc); K_NOREF(rc); g_shfile_async_close.signal_sync = K_TRUE; } shmtx_leave(&g_shfile_async_close.mtx, &tmp); TRACE2((NULL, "shfile_async_close_sync: Calling WaitForSingleObject...\n")); dwRet = WaitForSingleObject(g_shfile_async_close.evt_sync, 10000 /*ms*/); kHlpAssert(dwRet == WAIT_OBJECT_0); kHlpAssert(g_shfile_async_close.num_pending == 0); TRACE2((NULL, "shfile_async_close_sync: WaitForSingleObject returned %u...\n", dwRet)); } else shmtx_leave(&g_shfile_async_close.mtx, &tmp); } # endif /* K_OS == K_OS_WINDOWS && defined(KASH_ASYNC_CLOSE_HANDLE) */ /** * Close the specified native handle. * * @param native The native file handle. * @param file The file table entry if available. * @param inheritable The inheritability of the handle on windows, K_FALSE elsewhere. */ static void shfile_native_close(intptr_t native, shfile *file, KBOOL inheritable) { # if K_OS == K_OS_WINDOWS # ifdef KASH_ASYNC_CLOSE_HANDLE /* * CloseHandle may take several milliseconds on NTFS after we've appended * a few bytes to a file. When a script uses lots of 'echo line-text >> file' * we end up executing very slowly, even if 'echo' is builtin and the statement * requires no subshells to be spawned. * * So, detect problematic handles and do CloseHandle asynchronously. When * executing a child process, we probably will have to make sure the CloseHandle * operation has completed before we do ResumeThread on the child to make 100% * sure we can't have any sharing conflicts or end up with incorrect CRT stat() * results. Sharing conflicts are not a problem for builtin commands, and for * stat we do not use the CRT code but ntstat.c/h and it seems to work fine * (might be a tiny bit slower, so (TODO) might be worth reducing what we ask for). * * If child processes are spawned using handle inheritance and the handle in * question is inheritable, we will have to fix the inheriability before pushing * on the async-close queue. This shouldn't have the CloseHandle issues. */ if ( file && (file->shflags & (SHFILE_FLAGS_DIRTY | SHFILE_FLAGS_TYPE_MASK)) == (SHFILE_FLAGS_DIRTY | SHFILE_FLAGS_FILE)) { if (inheritable) native = (intptr_t)shfile_set_inherit_win(file, 0); if (shfile_async_close_submit((HANDLE)native)) return; } /* * Otherwise close it right here: */ # endif { # ifdef DEBUG KU64 ns = shfile_nano_ts(); BOOL fRc = CloseHandle((HANDLE)native); kHlpAssert(fRc); K_NOREF(fRc); ns = shfile_nano_ts() - ns; if (ns > 1000000) TRACE2((NULL, "shfile_native_close: %u ns %p oflags=%#x %s\n", ns, native, file ? file->oflags : 0, file ? file->dbgname : NULL)); # else BOOL fRc = CloseHandle((HANDLE)native); kHlpAssert(fRc); K_NOREF(fRc); # endif } # else /* K_OS != K_OS_WINDOWS */ int s = errno; close(native); errno = s; # endif /* K_OS != K_OS_WINDOWS */ K_NOREF(file); } /** * Grows the descriptor table, making sure that it can hold @a fdMin, * * @returns The max(fdMin, fdFirstNew) on success, -1 on failure. * @param pfdtab The table to grow. * @param fdMin Grow to include this index. */ static int shfile_grow_tab_locked(shfdtab *pfdtab, int fdMin) { /* * Grow the descriptor table. */ int fdRet = -1; shfile *new_tab; int new_size = pfdtab->size + SHFILE_GROW; while (new_size < fdMin) new_size += SHFILE_GROW; TRACE2((NULL, "shfile_grow_tab_locked: old %p / %d entries; new size: %d\n", pfdtab->tab, pfdtab->size, new_size)); new_tab = sh_realloc(shthread_get_shell(), pfdtab->tab, new_size * sizeof(shfile)); if (new_tab) { int i; for (i = pfdtab->size; i < new_size; i++) { new_tab[i].fd = -1; new_tab[i].oflags = 0; new_tab[i].shflags = 0; new_tab[i].native = -1; # ifdef DEBUG new_tab[i].dbgname = NULL; # endif } fdRet = pfdtab->size; if (fdRet < fdMin) fdRet = fdMin; pfdtab->tab = new_tab; pfdtab->size = new_size; TRACE2((NULL, "shfile_grow_tab_locked: new %p / %d entries\n", pfdtab->tab, pfdtab->size)); } return fdRet; } /** * Inserts the file into the descriptor table. * * If we're out of memory and cannot extend the table, we'll close the * file, set errno to EMFILE and return -1. * * @returns The file descriptor number. -1 and errno on failure. * @param pfdtab The file descriptor table. * @param native The native file handle. * @param oflags The flags the it was opened/created with. * @param shflags The shell file flags. * @param fdMin The minimum file descriptor number, pass -1 if any is ok. * @param who Who we're doing this for (for logging purposes). * @param dbgname The filename, if applicable/available. */ static int shfile_insert(shfdtab *pfdtab, intptr_t native, unsigned oflags, unsigned shflags, int fdMin, const char *who, const char *dbgname) { shmtxtmp tmp; int fd; int i; /* * Fend of bad stuff. */ if (fdMin >= SHFILE_MAX) { TRACE2((NULL, "shfile_insert: fdMin=%d is out of bounds; native=%p %s\n", fdMin, native, dbgname)); shfile_native_close(native, NULL, K_FALSE); errno = EMFILE; return -1; } # if K_OS != K_OS_WINDOWS if (fcntl((int)native, F_SETFD, fcntl((int)native, F_GETFD, 0) | FD_CLOEXEC) == -1) { int e = errno; TRACE2((NULL, "shfile_insert: F_SETFD failed %d; native=%p %s\n", e, native, dbgname)); close((int)native); errno = e; return -1; } # endif shmtx_enter(&pfdtab->mtx, &tmp); /* * Search for a fitting unused location. */ fd = -1; for (i = fdMin >= 0 ? fdMin : 0; (unsigned)i < pfdtab->size; i++) if (pfdtab->tab[i].fd == -1) { fd = i; break; } if (fd == -1) fd = shfile_grow_tab_locked(pfdtab, fdMin); /* * Fill in the entry if we've found one. */ if (fd != -1) { pfdtab->tab[fd].fd = fd; pfdtab->tab[fd].oflags = oflags; pfdtab->tab[fd].shflags = shflags; pfdtab->tab[fd].native = native; #ifdef DEBUG pfdtab->tab[fd].dbgname = dbgname ? sh_strdup(NULL, dbgname) : NULL; #endif TRACE2((NULL, "shfile_insert: #%d: native=%p oflags=%#x shflags=%#x %s\n", fd, native, oflags, shflags, dbgname)); } else shfile_native_close(native, NULL, K_FALSE); shmtx_leave(&pfdtab->mtx, &tmp); if (fd == -1) errno = EMFILE; (void)who; return fd; } # if K_OS != K_OS_WINDOWS /** * Makes a copy of the native file, closes the original, and inserts the copy * into the descriptor table. * * If we're out of memory and cannot extend the table, we'll close the * file, set errno to EMFILE and return -1. * * @returns The file descriptor number. -1 and errno on failure. * @param pfdtab The file descriptor table. * @param pnative The native file handle on input, -1 on output. * @param oflags The flags the it was opened/created with. * @param shflags The shell file flags. * @param fdMin The minimum file descriptor number, pass -1 if any is ok. * @param who Who we're doing this for (for logging purposes). * @param dbgname The filename, if applicable/available. */ static int shfile_copy_insert_and_close(shfdtab *pfdtab, int *pnative, unsigned oflags, unsigned shflags, int fdMin, const char *who, const char *dbgname) { int fd = -1; int s = errno; int native_copy = fcntl(*pnative, F_DUPFD, SHFILE_UNIX_MIN_FD); close(*pnative); *pnative = -1; errno = s; if (native_copy != -1) fd = shfile_insert(pfdtab, native_copy, oflags, shflags, fdMin, who, dbgname); return fd; } # endif /* !K_OS_WINDOWS */ /** * Gets a file descriptor and lock the file descriptor table. * * @returns Pointer to the file and table ownership on success, * NULL and errno set to EBADF on failure. * @param pfdtab The file descriptor table. * @param fd The file descriptor number. * @param ptmp See shmtx_enter. */ static shfile *shfile_get(shfdtab *pfdtab, int fd, shmtxtmp *ptmp) { shfile *file = NULL; if ( fd >= 0 && (unsigned)fd < pfdtab->size) { shmtx_enter(&pfdtab->mtx, ptmp); if ((unsigned)fd < pfdtab->size && pfdtab->tab[fd].fd != -1) file = &pfdtab->tab[fd]; else shmtx_leave(&pfdtab->mtx, ptmp); } if (!file) errno = EBADF; return file; } /** * Puts back a file descriptor and releases the table ownership. * * @param pfdtab The file descriptor table. * @param file The file. * @param ptmp See shmtx_leave. */ static void shfile_put(shfdtab *pfdtab, shfile *file, shmtxtmp *ptmp) { shmtx_leave(&pfdtab->mtx, ptmp); kHlpAssert(file); (void)file; } /** * Constructs a path from the current directory and the passed in path. * * @returns 0 on success, -1 and errno set to ENAMETOOLONG or EINVAL on failure. * * @param pfdtab The file descriptor table * @param path The path the caller supplied. * @param buf Where to put the path. This is assumed to be SHFILE_MAX_PATH * chars in size. */ int shfile_make_path(shfdtab *pfdtab, const char *path, char *buf) { size_t path_len = strlen(path); if (path_len == 0) { errno = EINVAL; return -1; } if (path_len >= SHFILE_MAX_PATH) { errno = ENAMETOOLONG; return -1; } if ( *path == '/' # if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 || *path == '\\' || ( *path && path[1] == ':' && ( (*path >= 'A' && *path <= 'Z') || (*path >= 'a' && *path <= 'z'))) # endif ) { memcpy(buf, path, path_len + 1); } else { size_t cwd_len; shmtxtmp tmp; shmtx_enter(&pfdtab->mtx, &tmp); cwd_len = strlen(pfdtab->cwd); memcpy(buf, pfdtab->cwd, cwd_len); shmtx_leave(&pfdtab->mtx, &tmp); if (cwd_len + path_len + 1 >= SHFILE_MAX_PATH) { errno = ENAMETOOLONG; return -1; } if ( !cwd_len || buf[cwd_len - 1] != '/') buf[cwd_len++] = '/'; memcpy(buf + cwd_len, path, path_len + 1); } # if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 if (!strcmp(buf, "/dev/null")) strcpy(buf, "NUL"); # endif return 0; } # if K_OS == K_OS_WINDOWS /** * Adjusts the file name if it ends with a trailing directory slash. * * Windows APIs doesn't like trailing slashes. * * @returns 1 if it has a directory slash, 0 if not. * * @param abspath The path to adjust (SHFILE_MAX_PATH). */ static int shfile_trailing_slash_hack(char *abspath) { /* * Anything worth adjust here? */ size_t path_len = strlen(abspath); if ( path_len == 0 || ( abspath[path_len - 1] != '/' # if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 && abspath[path_len - 1] != '\\' # endif ) ) return 0; /* * Ok, make the adjustment. */ if (path_len + 2 <= SHFILE_MAX_PATH) { /* Add a '.' to the end. */ abspath[path_len++] = '.'; abspath[path_len] = '\0'; } else { /* No space for a dot, remove the slash if it's alone or just remove one and add a dot like above. */ if ( abspath[path_len - 2] != '/' # if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 && abspath[path_len - 2] != '\\' # endif ) abspath[--path_len] = '\0'; else abspath[path_len - 1] = '.'; } return 1; } /** * Converts a DOS(/Windows) error code to errno, * assigning it to errno. * * @returns -1 * @param err The DOS error. */ static int shfile_dos2errno(int err) { switch (err) { case ERROR_BAD_ENVIRONMENT: errno = E2BIG; break; case ERROR_ACCESS_DENIED: errno = EACCES; break; case ERROR_CURRENT_DIRECTORY: errno = EACCES; break; case ERROR_LOCK_VIOLATION: errno = EACCES; break; case ERROR_NETWORK_ACCESS_DENIED: errno = EACCES; break; case ERROR_CANNOT_MAKE: errno = EACCES; break; case ERROR_FAIL_I24: errno = EACCES; break; case ERROR_DRIVE_LOCKED: errno = EACCES; break; case ERROR_SEEK_ON_DEVICE: errno = EACCES; break; case ERROR_NOT_LOCKED: errno = EACCES; break; case ERROR_LOCK_FAILED: errno = EACCES; break; case ERROR_NO_PROC_SLOTS: errno = EAGAIN; break; case ERROR_MAX_THRDS_REACHED: errno = EAGAIN; break; case ERROR_NESTING_NOT_ALLOWED: errno = EAGAIN; break; case ERROR_INVALID_HANDLE: errno = EBADF; break; case ERROR_INVALID_TARGET_HANDLE: errno = EBADF; break; case ERROR_DIRECT_ACCESS_HANDLE: errno = EBADF; break; case ERROR_WAIT_NO_CHILDREN: errno = ECHILD; break; case ERROR_CHILD_NOT_COMPLETE: errno = ECHILD; break; case ERROR_FILE_EXISTS: errno = EEXIST; break; case ERROR_ALREADY_EXISTS: errno = EEXIST; break; case ERROR_INVALID_FUNCTION: errno = EINVAL; break; case ERROR_INVALID_ACCESS: errno = EINVAL; break; case ERROR_INVALID_DATA: errno = EINVAL; break; case ERROR_INVALID_PARAMETER: errno = EINVAL; break; case ERROR_NEGATIVE_SEEK: errno = EINVAL; break; case ERROR_TOO_MANY_OPEN_FILES: errno = EMFILE; break; case ERROR_FILE_NOT_FOUND: errno = ENOENT; break; case ERROR_PATH_NOT_FOUND: errno = ENOENT; break; case ERROR_INVALID_DRIVE: errno = ENOENT; break; case ERROR_NO_MORE_FILES: errno = ENOENT; break; case ERROR_BAD_NETPATH: errno = ENOENT; break; case ERROR_BAD_NET_NAME: errno = ENOENT; break; case ERROR_BAD_PATHNAME: errno = ENOENT; break; case ERROR_FILENAME_EXCED_RANGE: errno = ENOENT; break; case ERROR_BAD_FORMAT: errno = ENOEXEC; break; case ERROR_ARENA_TRASHED: errno = ENOMEM; break; case ERROR_NOT_ENOUGH_MEMORY: errno = ENOMEM; break; case ERROR_INVALID_BLOCK: errno = ENOMEM; break; case ERROR_NOT_ENOUGH_QUOTA: errno = ENOMEM; break; case ERROR_DISK_FULL: errno = ENOSPC; break; case ERROR_DIR_NOT_EMPTY: errno = ENOTEMPTY; break; case ERROR_BROKEN_PIPE: errno = EPIPE; break; case ERROR_NOT_SAME_DEVICE: errno = EXDEV; break; default: errno = EINVAL; break; } return -1; } /** * Converts an NT status code to errno, * assigning it to errno. * * @returns -1 * @param rcNt The NT status code. */ static int shfile_nt2errno(NTSTATUS rcNt) { switch (rcNt) { default: errno = EINVAL; break; } return -1; } DWORD shfile_query_handle_access_mask(HANDLE h, PACCESS_MASK pMask) { MY_OBJECT_BASIC_INFORMATION BasicInfo; NTSTATUS rcNt; if (!g_pfnNtQueryObject) return ERROR_NOT_SUPPORTED; rcNt = g_pfnNtQueryObject(h, MY_ObjectBasicInformation, &BasicInfo, sizeof(BasicInfo), NULL); if (rcNt >= 0) { *pMask = BasicInfo.GrantedAccess; return NO_ERROR; } if (rcNt != STATUS_INVALID_HANDLE) return ERROR_GEN_FAILURE; return ERROR_INVALID_HANDLE; } # endif /* K_OS == K_OS_WINDOWS */ #endif /* SHFILE_IN_USE */ /** * Converts DOS slashes to UNIX slashes if necessary. * * @param pszPath The path to fix. */ K_INLINE void shfile_fix_slashes(char *pszPath) { #if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 while ((pszPath = strchr(pszPath, '\\'))) *pszPath++ = '/'; #else (void)pszPath; #endif } /** * Initializes the global variables in this file. */ static void shfile_init_globals(void) { #if K_OS == K_OS_WINDOWS if (!g_shfile_globals_initialized) { HMODULE hNtDll = GetModuleHandle("NTDLL"); g_pfnNtQueryObject = (PFN_NtQueryObject) GetProcAddress(hNtDll, "NtQueryObject"); g_pfnNtQueryDirectoryFile = (PFN_NtQueryDirectoryFile)GetProcAddress(hNtDll, "NtQueryDirectoryFile"); g_pfnRtlUnicodeStringToAnsiString = (PFN_RtlUnicodeStringToAnsiString)GetProcAddress(hNtDll, "RtlUnicodeStringToAnsiString"); if ( !g_pfnRtlUnicodeStringToAnsiString || !g_pfnNtQueryDirectoryFile) { /* fatal error */ } # ifdef KASH_ASYNC_CLOSE_HANDLE /* * Init the async CloseHandle state. */ shmtx_init(&g_shfile_async_close.mtx); g_shfile_async_close.evt_workers = CreateEventW(NULL, FALSE /*fManualReset*/, FALSE /*fInitialState*/, NULL /*pwszName*/); g_shfile_async_close.evt_sync = CreateEventW(NULL, TRUE /*fManualReset*/, FALSE /*fInitialState*/, NULL /*pwszName*/); if ( !g_shfile_async_close.evt_workers || !g_shfile_async_close.evt_sync) { fprintf(stderr, "fatal error: CreateEventW failed: %u\n", GetLastError()); _exit(19); } g_shfile_async_close.idx_read = 0; g_shfile_async_close.idx_write = 0; g_shfile_async_close.num_pending = 0; g_shfile_async_close.terminate_threads = K_FALSE; g_shfile_async_close.signal_sync = K_FALSE; g_shfile_async_close.num_threads = 0; { unsigned i = K_ELEMENTS(g_shfile_async_close.handles); while (i-- > 0) g_shfile_async_close.handles[i] = NULL; i = K_ELEMENTS(g_shfile_async_close.threads); while (i-- > 0) g_shfile_async_close.threads[i] = NULL; } # endif g_shfile_globals_initialized = 1; } #endif } /** * Initializes a file descriptor table. * * @returns 0 on success, -1 and errno on failure. * @param pfdtab The table to initialize. * @param inherit File descriptor table to inherit from. If not specified * we will inherit from the current process as it were. */ int shfile_init(shfdtab *pfdtab, shfdtab *inherit) { int rc; shfile_init_globals(); pfdtab->cwd = NULL; pfdtab->size = 0; pfdtab->tab = NULL; rc = shmtx_init(&pfdtab->mtx); if (!rc) { #ifdef SHFILE_IN_USE /* Get CWD with unix slashes. */ if (!inherit) { char buf[SHFILE_MAX_PATH]; if (getcwd(buf, sizeof(buf))) { shfile_fix_slashes(buf); pfdtab->cwd = sh_strdup(NULL, buf); } if (pfdtab->cwd) { # if K_OS == K_OS_WINDOWS static const struct { DWORD dwStdHandle; unsigned fFlags; } aStdHandles[3] = { { STD_INPUT_HANDLE, _O_RDONLY }, { STD_OUTPUT_HANDLE, _O_WRONLY }, { STD_ERROR_HANDLE, _O_WRONLY } }; int i; STARTUPINFO Info; ACCESS_MASK Mask; DWORD dwErr; rc = 0; /* Try pick up the Visual C++ CRT file descriptor info. */ __try { GetStartupInfo(&Info); } __except (EXCEPTION_EXECUTE_HANDLER) { memset(&Info, 0, sizeof(Info)); } if ( Info.cbReserved2 > sizeof(int) && (uintptr_t)Info.lpReserved2 >= 0x1000 && (i = *(int *)Info.lpReserved2) >= 1 && i <= 2048 && ( Info.cbReserved2 == i * 5 + 4 //|| Info.cbReserved2 == i * 5 + 1 - check the cygwin sources. || Info.cbReserved2 == i * 9 + 4)) { uint8_t *paf = (uint8_t *)Info.lpReserved2 + sizeof(int); int dwPerH = 1 + (Info.cbReserved2 == i * 9 + 4); DWORD *ph = (DWORD *)(paf + i) + dwPerH * i; HANDLE aStdHandles2[3]; int j; //if (Info.cbReserved2 == i * 5 + 1) - check the cygwin sources. // i--; for (j = 0; j < 3; j++) aStdHandles2[j] = GetStdHandle(aStdHandles[j].dwStdHandle); while (i-- > 0) { ph -= dwPerH; if ( (paf[i] & (FOPEN | FNOINHERIT)) == FOPEN && *ph != (uint32_t)INVALID_HANDLE_VALUE && *ph != 0) { HANDLE h = (HANDLE)(intptr_t)*ph; int fd2; int fFlags; int fFlags2; if ( h == aStdHandles2[j = 0] || h == aStdHandles2[j = 1] || h == aStdHandles2[j = 2]) fFlags = aStdHandles[j].fFlags; else { dwErr = shfile_query_handle_access_mask(h, &Mask); if (dwErr == ERROR_INVALID_HANDLE) continue; if (dwErr == NO_ERROR) { fFlags = 0; if ( (Mask & (GENERIC_READ | FILE_READ_DATA)) && (Mask & (GENERIC_WRITE | FILE_WRITE_DATA | FILE_APPEND_DATA))) fFlags |= O_RDWR; else if (Mask & (GENERIC_READ | FILE_READ_DATA)) fFlags |= O_RDONLY; else if (Mask & (GENERIC_WRITE | FILE_WRITE_DATA | FILE_APPEND_DATA)) fFlags |= O_WRONLY; else fFlags |= O_RDWR; if ((Mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) == FILE_APPEND_DATA) fFlags |= O_APPEND; } else fFlags = O_RDWR; } if (paf[i] & FPIPE) fFlags2 = SHFILE_FLAGS_PIPE; else if (paf[i] & FDEV) fFlags2 = SHFILE_FLAGS_TTY; else fFlags2 = 0; fd2 = shfile_insert(pfdtab, (intptr_t)h, fFlags, fFlags2, i, "shtab_init", NULL); kHlpAssert(fd2 == i); (void)fd2; if (fd2 != i) rc = -1; } } } /* Check the three standard handles. */ for (i = 0; i < 3; i++) if ( (unsigned)i >= pfdtab->size || pfdtab->tab[i].fd == -1) { HANDLE hFile = GetStdHandle(aStdHandles[i].dwStdHandle); if ( hFile != INVALID_HANDLE_VALUE && hFile != NULL) { DWORD dwType = GetFileType(hFile); unsigned fFlags = aStdHandles[i].fFlags; unsigned fFlags2; int fd2; if (dwType == FILE_TYPE_CHAR) fFlags2 = SHFILE_FLAGS_TTY; else if (dwType == FILE_TYPE_PIPE) fFlags2 = SHFILE_FLAGS_PIPE; else fFlags2 = SHFILE_FLAGS_FILE; fd2 = shfile_insert(pfdtab, (intptr_t)hFile, fFlags, fFlags2, i, "shtab_init", NULL); kHlpAssert(fd2 == i); (void)fd2; if (fd2 != i) rc = -1; } } # else /* * Annoying... */ int fd; for (fd = 0; fd < 10; fd++) { int oflags = fcntl(fd, F_GETFL, 0); if (oflags != -1) { int cox = fcntl(fd, F_GETFD, 0); struct stat st; if ( cox != -1 && fstat(fd, &st) != -1) { int native; int fd2; int fFlags2 = 0; if (cox & FD_CLOEXEC) fFlags2 |= SHFILE_FLAGS_CLOSE_ON_EXEC; if (S_ISREG(st.st_mode)) fFlags2 |= SHFILE_FLAGS_FILE; else if (S_ISDIR(st.st_mode)) fFlags2 |= SHFILE_FLAGS_DIR; else if (S_ISCHR(st.st_mode)) fFlags2 |= SHFILE_FLAGS_TTY; else if (S_ISFIFO(st.st_mode)) fFlags2 |= SHFILE_FLAGS_PIPE; else fFlags2 |= SHFILE_FLAGS_TTY; native = fcntl(fd, F_DUPFD, SHFILE_UNIX_MIN_FD); if (native == -1) native = fd; fd2 = shfile_insert(pfdtab, native, oflags, fFlags2, fd, "shtab_init", NULL); kHlpAssert(fd2 == fd); (void)fd2; if (fd2 != fd) rc = -1; if (native != fd) close(fd); } } } # endif } else rc = -1; } else { /* * Inherit from parent shell's file table. */ shfile const *src; shfile *dst; shmtxtmp tmp; unsigned fdcount; unsigned fd; shmtx_enter(&inherit->mtx, &tmp); /* allocate table and cwd: */ fdcount = inherit->size; pfdtab->tab = dst = (shfile *)(fdcount ? sh_calloc(NULL, sizeof(pfdtab->tab[0]), fdcount) : NULL); pfdtab->cwd = sh_strdup(NULL, inherit->cwd); if ( pfdtab->cwd && (pfdtab->tab || fdcount == 0)) { /* duplicate table entries: */ for (fd = 0, src = inherit->tab; fd < fdcount; fd++, src++, dst++) if (src->fd == -1) dst->native = dst->fd = -1; else { # if K_OS == K_OS_WINDOWS # ifdef SH_FORKED_MODE KBOOL const cox = !!(src->shflags & SHFILE_FLAGS_CLOSE_ON_EXEC); # else KBOOL const cox = K_TRUE; # endif # endif *dst = *src; # ifdef DEBUG if (src->dbgname) dst->dbgname = sh_strdup(NULL, src->dbgname); # endif # if K_OS == K_OS_WINDOWS if (DuplicateHandle(GetCurrentProcess(), (HANDLE)src->native, GetCurrentProcess(), (HANDLE *)&dst->native, 0, FALSE /* bInheritHandle */, DUPLICATE_SAME_ACCESS)) TRACE2((NULL, "shfile_init: %d (%#x, %#x) %p (was %p)\n", dst->fd, dst->oflags, dst->shflags, dst->native, src->native)); else { dst->native = (intptr_t)INVALID_HANDLE_VALUE; rc = shfile_dos2errno(GetLastError()); TRACE2((NULL, "shfile_init: %d (%#x, %#x) %p - failed %d / %u!\n", dst->fd, dst->oflags, dst->shflags, src->native, rc, GetLastError())); break; } # elif K_OS == K_OS_LINUX /* 2.6.27 / glibc 2.9 */ || K_OS == K_OS_FREEBSD /* 10.0 */ || K_OS == K_OS_NETBSD /* 6.0 */ dst->native = dup3(src->native, -1, cox ? O_CLOEXEC : 0); # else if (cox) { # ifndef SH_FORKED_MODE shmtxtmp tmp2; shmtx_enter(&global_exec_something, &tmp) # endif dst->native = dup2(src->native, -1); if (dst->native >= 0) rc = fcntl(dst->native, F_SETFD, FD_CLOEXEC); # ifndef SH_FORKED_MODE shmtx_leave(&global_exec_something, &tmp) # endif if (rc != 0) break; } else dst->native = dup2(src->native, -1); if (dst->native < 0) { rc = -1; break; } # endif } } else rc = -1; pfdtab->size = fd; shmtx_leave(&inherit->mtx, &tmp); } /* inherit != NULL */ #endif } return rc; } /** * Deletes the file descriptor table. * * Safe to call more than once. */ void shfile_uninit(shfdtab *pfdtab, int tracefd) { if (!pfdtab) return; if (pfdtab->tab) { unsigned left = pfdtab->size; struct shfile *pfd = pfdtab->tab; unsigned tracefdfound = 0; while (left-- > 0) { if (pfd->fd != -1) { if (pfd->fd != tracefd) { #if K_OS == K_OS_WINDOWS BOOL rc = CloseHandle((HANDLE)pfd->native); kHlpAssert(rc == TRUE); K_NOREF(rc); #else int rc = close((int)pfd->native); kHlpAssert(rc == 0); K_NOREF(rc); #endif pfd->fd = -1; pfd->native = -1; } else tracefdfound++; /* there is only the one */ } pfd++; } if (!tracefdfound) { /* likely */ } else return; sh_free(NULL, pfdtab->tab); pfdtab->tab = NULL; } shmtx_delete(&pfdtab->mtx); sh_free(NULL, pfdtab->cwd); pfdtab->cwd = NULL; } #if K_OS == K_OS_WINDOWS && defined(SHFILE_IN_USE) /** * Changes the inheritability of a file descriptor, taking console handles into * account. * * @note This MAY change the native handle for the entry. * * @returns The native handle. * @param pfd The file descriptor to change. * @param set If set, make child processes inherit the handle, if clear * make them not inherit it. */ static HANDLE shfile_set_inherit_win(shfile *pfd, int set) { HANDLE hFile = (HANDLE)pfd->native; if (!SetHandleInformation(hFile, HANDLE_FLAG_INHERIT, set ? HANDLE_FLAG_INHERIT : 0)) { /* SetHandleInformation doesn't work for console handles, so we have to duplicate the handle to change the inheritability. */ DWORD err = GetLastError(); if ( err == ERROR_INVALID_PARAMETER && DuplicateHandle(GetCurrentProcess(), hFile, GetCurrentProcess(), &hFile, 0, set ? TRUE : FALSE /* bInheritHandle */, DUPLICATE_SAME_ACCESS)) { TRACE2((NULL, "shfile_set_inherit_win: %p -> %p (set=%d)\n", pfd->native, hFile, set)); if (!CloseHandle((HANDLE)pfd->native)) kHlpAssert(0); pfd->native = (intptr_t)hFile; } else { err = GetLastError(); kHlpAssert(0); hFile = (HANDLE)pfd->native; } } return hFile; } # ifdef SH_FORKED_MODE /** * Helper for shfork. * * @param pfdtab The file descriptor table. * @param set Whether to make all handles inheritable (1) or * to restore them to the rigth state (0). * @param hndls Where to store the three standard handles. */ void shfile_fork_win(shfdtab *pfdtab, int set, intptr_t *hndls) { shmtxtmp tmp; unsigned i; shmtx_enter(&pfdtab->mtx, &tmp); TRACE2((NULL, "shfile_fork_win: set=%d\n", set)); i = pfdtab->size; while (i-- > 0) { if (pfdtab->tab[i].fd == i) { shfile_set_inherit_win(&pfdtab->tab[i], set); if (set) TRACE2((NULL, " #%d: native=%#x oflags=%#x shflags=%#x\n", i, pfdtab->tab[i].native, pfdtab->tab[i].oflags, pfdtab->tab[i].shflags)); } } if (hndls) { for (i = 0; i < 3; i++) { if ( pfdtab->size > i && pfdtab->tab[i].fd == i) hndls[i] = pfdtab->tab[i].native; else hndls[i] = (intptr_t)INVALID_HANDLE_VALUE; TRACE2((NULL, "shfile_fork_win: i=%d size=%d fd=%d native=%d hndls[%d]=%p\n", i, pfdtab->size, pfdtab->tab[i].fd, pfdtab->tab[i].native, i, hndls[i])); } } shmtx_leave(&pfdtab->mtx, &tmp); } # endif /* SH_FORKED_MODE */ /** shfile_exec_win helper that make sure there are no _O_APPEND handles. */ static KBOOL shfile_exec_win_no_append(shfdtab *pfdtab, unsigned count) { unsigned i; for (i = 0; i < count; i++) if ( (pfdtab->tab[i].oflags & _O_APPEND) && (pfdtab->tab[i].oflags & (_O_WRONLY | _O_RDWR))) return K_FALSE; return K_TRUE; } /** * Helper for sh_execve. * * This is called before and after CreateProcess. On the first call it * will mark the non-close-on-exec handles as inheritable and produce * the startup info for the CRT. On the second call, after CreateProcess, * it will restore the handle inheritability properties. * * @returns 0 on success, non-zero on failure. * @param pfdtab The file descriptor table. * @param prepare Which call, 1 if before, 0 if after and success, -1 if after on failure. * @param info The info structure. */ int shfile_exec_win(shfdtab *pfdtab, int prepare, shfdexecwin *info) { STARTUPINFOA *strtinfo = (STARTUPINFOA *)info->strtinfo; int rc = 0; shmtxtmp tmp; unsigned count; unsigned i; shmtx_enter(&pfdtab->mtx, &tmp); TRACE2((NULL, "shfile_exec_win: prepare=%p\n", prepare)); count = pfdtab->size < (0x10000-4) / (1 + sizeof(HANDLE)) ? pfdtab->size : (0x10000-4) / (1 + sizeof(HANDLE)); while ( count > 3 && ( pfdtab->tab[count - 1].fd == -1 || (pfdtab->tab[count - 1].shflags & SHFILE_FLAGS_CLOSE_ON_EXEC))) count--; if (prepare > 0) { if (count <= 3 && shfile_exec_win_no_append(pfdtab, count)) { info->inherithandles = 0; info->startsuspended = 1; strtinfo->cbReserved2 = 0; strtinfo->lpReserved2 = NULL; } else { size_t cbData = sizeof(int) + count * (1 + sizeof(HANDLE)); uint8_t *pbData = sh_malloc(shthread_get_shell(), cbData); uint8_t *paf = pbData + sizeof(int); HANDLE *pah = (HANDLE *)(paf + count); info->inherithandles = 1; # ifdef KASH_ASYNC_CLOSE_HANDLE info->startsuspended = g_shfile_async_close.num_pending > 0; # else info->startsuspended = 0; # endif strtinfo->cbReserved2 = (unsigned short)cbData; strtinfo->lpReserved2 = pbData; # ifndef SH_FORKED_MODE shmtx_leave(&pfdtab->mtx, &tmp); /* should be harmless as this isn't really necessary at all. */ shmtx_enter(&g_sh_exec_inherit_mtx, &info->tmp); shmtx_enter(&pfdtab->mtx, &tmp); # endif *(int *)pbData = count; i = count; while (i-- > 0) { if ( pfdtab->tab[i].fd == i && !(pfdtab->tab[i].shflags & SHFILE_FLAGS_CLOSE_ON_EXEC)) { HANDLE hFile = shfile_set_inherit_win(&pfdtab->tab[i], 1); TRACE2((NULL, " #%d: native=%#x oflags=%#x shflags=%#x\n", i, hFile, pfdtab->tab[i].oflags, pfdtab->tab[i].shflags)); paf[i] = FOPEN; if (pfdtab->tab[i].oflags & _O_APPEND) paf[i] |= FAPPEND; if (pfdtab->tab[i].oflags & _O_TEXT) paf[i] |= FTEXT; switch (pfdtab->tab[i].shflags & SHFILE_FLAGS_TYPE_MASK) { case SHFILE_FLAGS_TTY: paf[i] |= FDEV; break; case SHFILE_FLAGS_PIPE: paf[i] |= FPIPE; break; } pah[i] = hFile; } else { paf[i] = 0; pah[i] = INVALID_HANDLE_VALUE; } } } for (i = 0; i < 3; i++) { if ( i < count && pfdtab->tab[i].fd == i) { info->replacehandles[i] = 1; info->handles[i] = pfdtab->tab[i].native; } else { info->replacehandles[i] = 0; info->handles[i] = (intptr_t)INVALID_HANDLE_VALUE; } TRACE2((NULL, "shfile_exec_win: i=%d count=%d fd=%d native=%d hndls[%d]=\n", i, count, pfdtab->tab[i].fd, pfdtab->tab[i].native, i, info->handles[i])); } } else { shfile *file = pfdtab->tab; sh_free(NULL, strtinfo->lpReserved2); strtinfo->lpReserved2 = NULL; i = count; if (prepare == 0) for (i = 0; i < count; i++, file++) { if ( file->fd == i && !(file->shflags & SHFILE_FLAGS_TRACE)) { shfile_native_close(file->native, file, info->inherithandles); file->fd = -1; file->oflags = 0; file->shflags = 0; file->native = -1; # ifdef DEBUG sh_free(NULL, file->dbgname); file->dbgname = NULL; # endif } } else if (info->inherithandles) for (i = 0; i < count; i++, file++) if ( file->fd == i && !(file->shflags & SHFILE_FLAGS_CLOSE_ON_EXEC)) shfile_set_inherit_win(file, 0); # ifndef SH_FORKED_MODE if (info->inherithandles) shmtx_leave(&g_sh_exec_inherit_mtx, &info->tmp); # endif } shmtx_leave(&pfdtab->mtx, &tmp); return rc; } #endif /* K_OS_WINDOWS */ #if K_OS != K_OS_WINDOWS /** * Prepare file handles for inherting before a execve call. * * This is only used in the normal mode, so we've forked and need not worry * about cleaning anything up after us. Nor do we need think about locking. * * @returns 0 on success, -1 on failure. */ int shfile_exec_unix(shfdtab *pfdtab) { int rc = 0; # ifdef SHFILE_IN_USE unsigned fd; for (fd = 0; fd < pfdtab->size; fd++) { if ( pfdtab->tab[fd].fd != -1 && !(pfdtab->tab[fd].shflags & SHFILE_FLAGS_CLOSE_ON_EXEC) ) { TRACE2((NULL, "shfile_exec_unix: %d => %d\n", pfdtab->tab[fd].native, fd)); if (dup2(pfdtab->tab[fd].native, fd) < 0) { /* fatal_error(NULL, "shfile_exec_unix: failed to move %d to %d", pfdtab->tab[fd].fd, fd); */ rc = -1; } } } # endif return rc; } #endif /* !K_OS_WINDOWS */ /** * open(). */ int shfile_open(shfdtab *pfdtab, const char *name, unsigned flags, mode_t mode) { int fd; #ifdef SHFILE_IN_USE char absname[SHFILE_MAX_PATH]; # if K_OS == K_OS_WINDOWS HANDLE hFile; DWORD dwDesiredAccess; DWORD dwShareMode; DWORD dwCreationDisposition; DWORD dwFlagsAndAttributes; SECURITY_ATTRIBUTES SecurityAttributes; # ifndef _O_ACCMODE # define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) # endif switch (flags & (_O_ACCMODE | _O_APPEND)) { case _O_RDONLY: dwDesiredAccess = GENERIC_READ; break; case _O_RDONLY | _O_APPEND: dwDesiredAccess = GENERIC_READ; break; case _O_WRONLY: dwDesiredAccess = GENERIC_WRITE; break; case _O_WRONLY | _O_APPEND: dwDesiredAccess = (FILE_GENERIC_WRITE & ~FILE_WRITE_DATA); break; case _O_RDWR: dwDesiredAccess = GENERIC_READ | GENERIC_WRITE; break; case _O_RDWR | _O_APPEND: dwDesiredAccess = GENERIC_READ | (FILE_GENERIC_WRITE & ~FILE_WRITE_DATA); break; default: RETURN_ERROR(-1, EINVAL, "invalid mode"); } dwShareMode = FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE; SecurityAttributes.nLength = sizeof(SecurityAttributes); SecurityAttributes.lpSecurityDescriptor = NULL; SecurityAttributes.bInheritHandle = FALSE; if (flags & _O_CREAT) { if ((flags & (_O_EXCL | _O_TRUNC)) == (_O_EXCL | _O_TRUNC)) RETURN_ERROR(-1, EINVAL, "_O_EXCL | _O_TRUNC"); if (flags & _O_TRUNC) dwCreationDisposition = CREATE_ALWAYS; /* not 100%, but close enough */ else if (flags & _O_EXCL) dwCreationDisposition = CREATE_NEW; else dwCreationDisposition = OPEN_ALWAYS; } else if (flags & _O_TRUNC) dwCreationDisposition = TRUNCATE_EXISTING; else dwCreationDisposition = OPEN_EXISTING; if (!(flags & _O_CREAT) || (mode & 0222)) dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL; else dwFlagsAndAttributes = FILE_ATTRIBUTE_READONLY; fd = shfile_make_path(pfdtab, name, &absname[0]); if (!fd) { # ifdef DEBUG KU64 ns = shfile_nano_ts(); # endif SetLastError(0); hFile = CreateFileA(absname, dwDesiredAccess, dwShareMode, &SecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, NULL /* hTemplateFile */); # ifdef DEBUG ns = shfile_nano_ts() - ns; if (ns > 1000000) TRACE2((NULL, "shfile_open: %u ns hFile=%p (%d) %s\n", ns, hFile, GetLastError(), absname)); # endif if (hFile != INVALID_HANDLE_VALUE) fd = shfile_insert(pfdtab, (intptr_t)hFile, flags, 0, -1, "shfile_open", absname); else fd = shfile_dos2errno(GetLastError()); } # else /* K_OS != K_OS_WINDOWS */ fd = shfile_make_path(pfdtab, name, &absname[0]); if (!fd) { fd = open(absname, flags, mode); if (fd != -1) fd = shfile_copy_insert_and_close(pfdtab, &fd, flags, 0, -1, "shfile_open", absname); } # endif /* K_OS != K_OS_WINDOWS */ #else fd = open(name, flags, mode); #endif TRACE2((NULL, "shfile_open(%p:{%s}, %#x, 0%o) -> %d [%d]\n", name, name, flags, mode, fd, errno)); return fd; } int shfile_pipe(shfdtab *pfdtab, int fds[2]) { int rc = -1; #ifdef SHFILE_IN_USE # if K_OS == K_OS_WINDOWS HANDLE hRead = INVALID_HANDLE_VALUE; HANDLE hWrite = INVALID_HANDLE_VALUE; SECURITY_ATTRIBUTES SecurityAttributes; SecurityAttributes.nLength = sizeof(SecurityAttributes); SecurityAttributes.lpSecurityDescriptor = NULL; SecurityAttributes.bInheritHandle = FALSE; fds[1] = fds[0] = -1; if (CreatePipe(&hRead, &hWrite, &SecurityAttributes, SHFILE_PIPE_SIZE)) { fds[0] = shfile_insert(pfdtab, (intptr_t)hRead, O_RDONLY, SHFILE_FLAGS_PIPE, -1, "shfile_pipe", "pipe-rd"); if (fds[0] != -1) { fds[1] = shfile_insert(pfdtab, (intptr_t)hWrite, O_WRONLY, SHFILE_FLAGS_PIPE, -1, "shfile_pipe", "pipe-wr"); if (fds[1] != -1) rc = 0; } # else int native_fds[2]; fds[1] = fds[0] = -1; if (!pipe(native_fds)) { fds[0] = shfile_copy_insert_and_close(pfdtab, &native_fds[0], O_RDONLY, SHFILE_FLAGS_PIPE, -1, "shfile_pipe", "pipe-rd"); if (fds[0] != -1) { fds[1] = shfile_copy_insert_and_close(pfdtab, &native_fds[1], O_WRONLY, SHFILE_FLAGS_PIPE, -1, "shfile_pipe", "pipe-wr"); if (fds[1] != -1) rc = 0; } # endif if (fds[1] == -1) { int s = errno; if (fds[0] != -1) { shmtxtmp tmp; shmtx_enter(&pfdtab->mtx, &tmp); rc = fds[0]; pfdtab->tab[rc].fd = -1; pfdtab->tab[rc].oflags = 0; pfdtab->tab[rc].shflags = 0; pfdtab->tab[rc].native = -1; shmtx_leave(&pfdtab->mtx, &tmp); } # if K_OS == K_OS_WINDOWS CloseHandle(hRead); CloseHandle(hWrite); # else close(native_fds[0]); close(native_fds[1]); # endif fds[0] = fds[1] = -1; errno = s; rc = -1; } } else { # if K_OS == K_OS_WINDOWS errno = shfile_dos2errno(GetLastError()); # endif rc = -1; } #else rc = pipe(fds); #endif TRACE2((NULL, "shfile_pipe() -> %d{%d,%d} [%d]\n", rc, fds[0], fds[1], errno)); return rc; } /** * dup(). */ int shfile_dup(shfdtab *pfdtab, int fd) { return shfile_fcntl(pfdtab,fd, F_DUPFD, 0); } /** * Move the file descriptor, closing any existing descriptor at @a fdto. * * @returns fdto on success, -1 and errno on failure. * @param pfdtab The file descriptor table. * @param fdfrom The descriptor to move. * @param fdto Where to move it. */ int shfile_movefd(shfdtab *pfdtab, int fdfrom, int fdto) { #ifdef SHFILE_IN_USE int rc; shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fdfrom, &tmp); if (file) { /* prepare the new entry */ if ((unsigned)fdto >= pfdtab->size) shfile_grow_tab_locked(pfdtab, fdto); if ((unsigned)fdto < pfdtab->size) { if (pfdtab->tab[fdto].fd != -1) shfile_native_close(pfdtab->tab[fdto].native, &pfdtab->tab[fdto], K_FALSE); /* setup the target. */ pfdtab->tab[fdto].fd = fdto; pfdtab->tab[fdto].oflags = file->oflags; pfdtab->tab[fdto].shflags = file->shflags; pfdtab->tab[fdto].native = file->native; # ifdef DEBUG pfdtab->tab[fdto].dbgname = file->dbgname; # endif /* close the source. */ file->fd = -1; file->oflags = 0; file->shflags = 0; file->native = -1; # ifdef DEBUG file->dbgname = NULL; # endif rc = fdto; } else { errno = EMFILE; rc = -1; } shfile_put(pfdtab, file, &tmp); } else rc = -1; return rc; #else int fdnew = dup2(fdfrom, fdto); if (fdnew >= 0) close(fdfrom); return fdnew; #endif } /** * Move the file descriptor to somewhere at @a fdMin or above. * * @returns the new file descriptor success, -1 and errno on failure. * @param pfdtab The file descriptor table. * @param fdfrom The descriptor to move. * @param fdMin The minimum descriptor. */ int shfile_movefd_above(shfdtab *pfdtab, int fdfrom, int fdMin) { #ifdef SHFILE_IN_USE int fdto; shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fdfrom, &tmp); if (file) { /* find a new place */ int i; fdto = -1; for (i = fdMin; (unsigned)i < pfdtab->size; i++) if (pfdtab->tab[i].fd == -1) { fdto = i; break; } if (fdto == -1) fdto = shfile_grow_tab_locked(pfdtab, fdMin); if (fdto != -1) { /* setup the target. */ pfdtab->tab[fdto].fd = fdto; pfdtab->tab[fdto].oflags = file->oflags; pfdtab->tab[fdto].shflags = file->shflags; pfdtab->tab[fdto].native = file->native; # ifdef DEBUG pfdtab->tab[fdto].dbgname = file->dbgname; # endif /* close the source. */ file->fd = -1; file->oflags = 0; file->shflags = 0; file->native = -1; # ifdef DEBUG file->dbgname = NULL; # endif } else { errno = EMFILE; fdto = -1; } shfile_put(pfdtab, file, &tmp); } else fdto = -1; return fdto; #else int fdnew = fcntl(fdfrom, F_DUPFD, fdMin); if (fdnew >= 0) close(fdfrom); return fdnew; #endif } /** * close(). */ int shfile_close(shfdtab *pfdtab, unsigned fd) { int rc; #ifdef SHFILE_IN_USE shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fd, &tmp); if (file) { shfile_native_close(file->native, file, K_FALSE); file->fd = -1; file->oflags = 0; file->shflags = 0; file->native = -1; # ifdef DEBUG sh_free(NULL, file->dbgname); file->dbgname = NULL; # endif shfile_put(pfdtab, file, &tmp); rc = 0; } else rc = -1; #else rc = close(fd); #endif TRACE2((NULL, "shfile_close(%d) -> %d [%d]\n", fd, rc, errno)); return rc; } /** * read(). */ long shfile_read(shfdtab *pfdtab, int fd, void *buf, size_t len) { long rc; #ifdef SHFILE_IN_USE shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fd, &tmp); if (file) { # if K_OS == K_OS_WINDOWS DWORD dwRead = 0; if (ReadFile((HANDLE)file->native, buf, (DWORD)len, &dwRead, NULL)) rc = dwRead; else rc = shfile_dos2errno(GetLastError()); # else rc = read(file->native, buf, len); # endif shfile_put(pfdtab, file, &tmp); } else rc = -1; #else rc = read(fd, buf, len); #endif return rc; } /** * write(). */ long shfile_write(shfdtab *pfdtab, int fd, const void *buf, size_t len) { long rc; #ifdef SHFILE_IN_USE shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fd, &tmp); if (file) { # if K_OS == K_OS_WINDOWS DWORD dwWritten = 0; if (WriteFile((HANDLE)file->native, buf, (DWORD)len, &dwWritten, NULL)) rc = dwWritten; else rc = shfile_dos2errno(GetLastError()); # else rc = write(file->native, buf, len); # endif file->shflags |= SHFILE_FLAGS_DIRTY; /* there should be no concurrent access, so this is safe. */ shfile_put(pfdtab, file, &tmp); } else rc = -1; # ifdef DEBUG if (fd != shthread_get_shell()->tracefd) TRACE2((NULL, "shfile_write(%d,,%d) -> %d [%d]\n", fd, len, rc, errno)); # endif #else if (fd != shthread_get_shell()->tracefd) { int iSavedErrno = errno; struct stat s; int x; x = fstat(fd, &s); TRACE2((NULL, "shfile_write(%d) - %lu bytes (%d) - pos %lu - before; %o\n", fd, (long)s.st_size, x, (long)lseek(fd, 0, SEEK_CUR), s.st_mode )); K_NOREF(x); errno = iSavedErrno; } rc = write(fd, buf, len); #endif return rc; } /** * lseek(). */ long shfile_lseek(shfdtab *pfdtab, int fd, long off, int whench) { long rc; #ifdef SHFILE_IN_USE shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fd, &tmp); if (file) { # if K_OS == K_OS_WINDOWS kHlpAssert(SEEK_SET == FILE_BEGIN); kHlpAssert(SEEK_CUR == FILE_CURRENT); kHlpAssert(SEEK_END == FILE_END); rc = SetFilePointer((HANDLE)file->native, off, NULL, whench); if (rc == INVALID_SET_FILE_POINTER) rc = shfile_dos2errno(GetLastError()); # else rc = lseek(file->native, off, whench); # endif shfile_put(pfdtab, file, &tmp); } else rc = -1; #else rc = lseek(fd, off, whench); #endif return rc; } int shfile_fcntl(shfdtab *pfdtab, int fd, int cmd, int arg) { int rc; #ifdef SHFILE_IN_USE shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fd, &tmp); if (file) { switch (cmd) { case F_GETFL: rc = file->oflags; break; case F_SETFL: { unsigned mask = O_NONBLOCK | O_APPEND | O_BINARY | O_TEXT; # ifdef O_DIRECT mask |= O_DIRECT; # endif # ifdef O_ASYNC mask |= O_ASYNC; # endif # ifdef O_SYNC mask |= O_SYNC; # endif if ((file->oflags & mask) == (arg & mask)) rc = 0; else { # if K_OS == K_OS_WINDOWS kHlpAssert(0); errno = EINVAL; rc = -1; # else rc = fcntl(file->native, F_SETFL, arg); if (rc != -1) file->oflags = (file->oflags & ~mask) | (arg & mask); # endif } break; } case F_DUPFD: { # if K_OS == K_OS_WINDOWS HANDLE hNew = INVALID_HANDLE_VALUE; if (DuplicateHandle(GetCurrentProcess(), (HANDLE)file->native, GetCurrentProcess(), &hNew, 0, FALSE /* bInheritHandle */, DUPLICATE_SAME_ACCESS)) rc = shfile_insert(pfdtab, (intptr_t)hNew, file->oflags, file->shflags, arg, "shfile_fcntl", SHFILE_DBGNAME(file->dbgname)); else rc = shfile_dos2errno(GetLastError()); # else int nativeNew = fcntl(file->native, F_DUPFD, SHFILE_UNIX_MIN_FD); if (nativeNew != -1) rc = shfile_insert(pfdtab, nativeNew, file->oflags, file->shflags, arg, "shfile_fcntl", SHFILE_DBGNAME(file->dbgname)); else rc = -1; # endif break; } default: errno = -EINVAL; rc = -1; break; } shfile_put(pfdtab, file, &tmp); } else rc = -1; #else rc = fcntl(fd, cmd, arg); #endif switch (cmd) { case F_GETFL: TRACE2((NULL, "shfile_fcntl(%d,F_GETFL,ignored=%d) -> %d [%d]\n", fd, arg, rc, errno)); break; case F_SETFL: TRACE2((NULL, "shfile_fcntl(%d,F_SETFL,newflags=%#x) -> %d [%d]\n", fd, arg, rc, errno)); break; case F_DUPFD: TRACE2((NULL, "shfile_fcntl(%d,F_DUPFD,minfd=%d) -> %d [%d]\n", fd, arg, rc, errno)); break; default: TRACE2((NULL, "shfile_fcntl(%d,%d,%d) -> %d [%d]\n", fd, cmd, arg, rc, errno)); break; } return rc; } int shfile_stat(shfdtab *pfdtab, const char *path, struct stat *pst) { #ifdef SHFILE_IN_USE char abspath[SHFILE_MAX_PATH]; int rc; rc = shfile_make_path(pfdtab, path, &abspath[0]); if (!rc) { # if K_OS == K_OS_WINDOWS # if 1 rc = birdStatFollowLink(abspath, pst); # else int dir_slash = shfile_trailing_slash_hack(abspath); rc = stat(abspath, pst); /** @todo re-implement stat. */ if (!rc && dir_slash && !S_ISDIR(pst->st_mode)) { rc = -1; errno = ENOTDIR; } # endif # else rc = stat(abspath, pst); # endif } TRACE2((NULL, "shfile_stat(,%s,) -> %d [%d] st_size=%llu st_mode=%o\n", path, rc, errno, (unsigned long long)pst->st_size, pst->st_mode)); return rc; #else return stat(path, pst); #endif } /** * @retval 1 if regular file. * @retval 0 if found but not a regular file. * @retval -1 and errno on failure */ int shfile_stat_isreg(shfdtab *pfdtab, const char *path) { #if defined(SHFILE_IN_USE) && K_OS == K_OS_WINDOWS char abspath[SHFILE_MAX_PATH]; KU16 mode = 0; int rc = shfile_make_path(pfdtab, path, &abspath[0]); if (!rc) { rc = birdStatModeOnly(abspath, &mode, 0 /*fFollowLink*/); if (rc >= 0) rc = S_ISREG(mode) ? 1 : 0; } TRACE2((NULL, "shfile_stat_isreg(,%s,) -> %d [%d] st_mode=%o\n", path, rc, errno, mode)); return rc; #else struct stat st; int rc = shfile_stat(pfdtab, path, &st); if (rc >= 0) rc = S_ISREG(st.st_mode) ? 1 : 0; return rc; #endif } /** * Same as shfile_stat, but without the data structure. */ int shfile_stat_exists(shfdtab *pfdtab, const char *path) { #if defined(SHFILE_IN_USE) && K_OS == K_OS_WINDOWS char abspath[SHFILE_MAX_PATH]; KU16 mode = 0; int rc = shfile_make_path(pfdtab, path, &abspath[0]); if (!rc) rc = birdStatModeOnly(abspath, &mode, 0 /*fFollowLink*/); TRACE2((NULL, "shfile_stat_exists(,%s,) -> %d [%d] st_mode=%o\n", path, rc, errno, mode)); return rc; #else struct stat ignored; return shfile_stat(pfdtab, path, &ignored); #endif } int shfile_lstat(shfdtab *pfdtab, const char *path, struct stat *pst) { int rc; #ifdef SHFILE_IN_USE char abspath[SHFILE_MAX_PATH]; rc = shfile_make_path(pfdtab, path, &abspath[0]); if (!rc) { # if K_OS == K_OS_WINDOWS # if 1 rc = birdStatOnLink(abspath, pst); # else int dir_slash = shfile_trailing_slash_hack(abspath); rc = stat(abspath, pst); /** @todo re-implement stat. */ if (!rc && dir_slash && !S_ISDIR(pst->st_mode)) { rc = -1; errno = ENOTDIR; } # endif # else rc = lstat(abspath, pst); # endif } #else rc = stat(path, pst); #endif TRACE2((NULL, "shfile_lstat(,%s,) -> %d [%d] st_size=%llu st_mode=%o\n", path, rc, errno, (unsigned long long)pst->st_size, pst->st_mode)); return rc; } /** * chdir(). */ int shfile_chdir(shfdtab *pfdtab, const char *path) { int rc; #ifdef SHFILE_IN_USE shinstance *psh = shthread_get_shell(); char abspath[SHFILE_MAX_PATH]; rc = shfile_make_path(pfdtab, path, &abspath[0]); if (!rc) { char *abspath_copy = sh_strdup(psh, abspath); char *free_me = abspath_copy; rc = chdir(abspath); if (!rc) { shmtxtmp tmp; shmtx_enter(&pfdtab->mtx, &tmp); shfile_fix_slashes(abspath_copy); free_me = pfdtab->cwd; pfdtab->cwd = abspath_copy; shmtx_leave(&pfdtab->mtx, &tmp); } sh_free(psh, free_me); } else rc = -1; #else rc = chdir(path); #endif TRACE2((NULL, "shfile_chdir(,%s) -> %d [%d]\n", path, rc, errno)); return rc; } /** * getcwd(). */ char *shfile_getcwd(shfdtab *pfdtab, char *buf, int size) { char *ret; #ifdef SHFILE_IN_USE ret = NULL; if (buf && !size) errno = -EINVAL; else { size_t cwd_size; shmtxtmp tmp; shmtx_enter(&pfdtab->mtx, &tmp); cwd_size = strlen(pfdtab->cwd) + 1; if (buf) { if (cwd_size <= (size_t)size) ret = memcpy(buf, pfdtab->cwd, cwd_size); else errno = ERANGE; } else { if ((size_t)size < cwd_size) size = (int)cwd_size; ret = sh_malloc(shthread_get_shell(), size); if (ret) ret = memcpy(ret, pfdtab->cwd, cwd_size); else errno = ENOMEM; } shmtx_leave(&pfdtab->mtx, &tmp); } #else ret = getcwd(buf, size); #endif TRACE2((NULL, "shfile_getcwd(,%p,%d) -> %s [%d]\n", buf, size, ret, errno)); return ret; } /** * access(). */ int shfile_access(shfdtab *pfdtab, const char *path, int type) { int rc; #ifdef SHFILE_IN_USE char abspath[SHFILE_MAX_PATH]; rc = shfile_make_path(pfdtab, path, &abspath[0]); if (!rc) { # ifdef _MSC_VER if (type & X_OK) type = (type & ~X_OK) | R_OK; # endif rc = access(abspath, type); } #else # ifdef _MSC_VER if (type & X_OK) type = (type & ~X_OK) | R_OK; # endif rc = access(path, type); #endif TRACE2((NULL, "shfile_access(,%s,%#x) -> %d [%d]\n", path, type, rc, errno)); return rc; } /** * isatty() */ int shfile_isatty(shfdtab *pfdtab, int fd) { int rc; #ifdef SHFILE_IN_USE shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fd, &tmp); if (file) { # if K_OS == K_OS_WINDOWS rc = (file->shflags & SHFILE_FLAGS_TYPE_MASK) == SHFILE_FLAGS_TTY; # else rc = isatty(file->native); # endif shfile_put(pfdtab, file, &tmp); } else rc = 0; #else rc = isatty(fd); #endif TRACE2((NULL, "isatty(%d) -> %d [%d]\n", fd, rc, errno)); return rc; } /** * fcntl F_SETFD / FD_CLOEXEC. */ int shfile_cloexec(shfdtab *pfdtab, int fd, int closeit) { int rc; #ifdef SHFILE_IN_USE shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fd, &tmp); if (file) { if (closeit) file->shflags |= SHFILE_FLAGS_CLOSE_ON_EXEC; else file->shflags &= ~SHFILE_FLAGS_CLOSE_ON_EXEC; shfile_put(pfdtab, file, &tmp); rc = 0; } else rc = -1; #else rc = fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | (closeit ? FD_CLOEXEC : 0)); #endif TRACE2((NULL, "shfile_cloexec(%d, %d) -> %d [%d]\n", fd, closeit, rc, errno)); return rc; } /** * Sets the SHFILE_FLAGS_TRACE flag. */ int shfile_set_trace(shfdtab *pfdtab, int fd) { int rc; #ifdef SHFILE_IN_USE shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fd, &tmp); if (file) { file->shflags |= SHFILE_FLAGS_TRACE; shfile_put(pfdtab, file, &tmp); rc = 0; } else rc = -1; #else rc = 0; #endif TRACE2((NULL, "shfile_set_trace(%d) -> %d\n", fd, rc)); return rc; } int shfile_ioctl(shfdtab *pfdtab, int fd, unsigned long request, void *buf) { int rc; #ifdef SHFILE_IN_USE shmtxtmp tmp; shfile *file = shfile_get(pfdtab, fd, &tmp); if (file) { # if K_OS == K_OS_WINDOWS rc = -1; errno = ENOSYS; # else rc = ioctl(file->native, request, buf); # endif shfile_put(pfdtab, file, &tmp); } else rc = -1; #else rc = ioctl(fd, request, buf); #endif TRACE2((NULL, "ioctl(%d, %#x, %p) -> %d\n", fd, request, buf, rc)); return rc; } mode_t shfile_get_umask(shfdtab *pfdtab) { /** @todo */ return 022; } void shfile_set_umask(shfdtab *pfdtab, mode_t mask) { /** @todo */ (void)mask; } shdir *shfile_opendir(shfdtab *pfdtab, const char *dir) { #if defined(SHFILE_IN_USE) && K_OS == K_OS_WINDOWS shdir *pdir = NULL; TRACE2((NULL, "shfile_opendir: dir='%s'\n", dir)); shfile_init_globals(); if (g_pfnNtQueryDirectoryFile) { char abspath[SHFILE_MAX_PATH]; if (shfile_make_path(pfdtab, dir, &abspath[0]) == 0) { HANDLE hFile; SECURITY_ATTRIBUTES SecurityAttributes; SecurityAttributes.nLength = sizeof(SecurityAttributes); SecurityAttributes.lpSecurityDescriptor = NULL; SecurityAttributes.bInheritHandle = FALSE; hFile = CreateFileA(abspath, GENERIC_READ, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, &SecurityAttributes, OPEN_EXISTING, FILE_ATTRIBUTE_DIRECTORY | FILE_FLAG_BACKUP_SEMANTICS, NULL /* hTemplateFile */); if (hFile != INVALID_HANDLE_VALUE) { pdir = (shdir *)sh_malloc(shthread_get_shell(), sizeof(*pdir)); if (pdir) { pdir->pfdtab = pfdtab; pdir->native = hFile; pdir->off = ~(size_t)0; } else CloseHandle(hFile); } else { errno = shfile_dos2errno(GetLastError()); TRACE2((NULL, "shfile_opendir: CreateFileA(%s) -> %d/%d\n", abspath, GetLastError(), errno)); } } } else errno = ENOSYS; return pdir; #else TRACE2((NULL, "shfile_opendir: dir='%s'\n", dir)); return (shdir *)opendir(dir); #endif } shdirent *shfile_readdir(struct shdir *pdir) { #if defined(SHFILE_IN_USE) && K_OS == K_OS_WINDOWS if (pdir) { NTSTATUS rcNt; if ( pdir->off == ~(size_t)0 || pdir->off + sizeof(MY_FILE_NAMES_INFORMATION) >= pdir->cb) { MY_IO_STATUS_BLOCK Ios; memset(&Ios, 0, sizeof(Ios)); rcNt = g_pfnNtQueryDirectoryFile(pdir->native, NULL /*Event*/, NULL /*ApcRoutine*/, NULL /*ApcContext*/, &Ios, &pdir->buf[0], sizeof(pdir->buf), MY_FileNamesInformation, FALSE /*ReturnSingleEntry*/, NULL /*FileName*/, pdir->off == ~(size_t)0 /*RestartScan*/); if (rcNt >= 0 && rcNt != STATUS_PENDING) { pdir->cb = Ios.Information; pdir->off = 0; } else if (rcNt == STATUS_NO_MORE_FILES) errno = 0; /* wrong? */ else shfile_nt2errno(rcNt); } if ( pdir->off != ~(size_t)0 && pdir->off + sizeof(MY_FILE_NAMES_INFORMATION) <= pdir->cb) { PMY_FILE_NAMES_INFORMATION pcur = (PMY_FILE_NAMES_INFORMATION)&pdir->buf[pdir->off]; ANSI_STRING astr; UNICODE_STRING ustr; astr.Length = astr.MaximumLength = sizeof(pdir->ent.name); astr.Buffer = &pdir->ent.name[0]; ustr.Length = ustr.MaximumLength = pcur->FileNameLength < ~(USHORT)0 ? (USHORT)pcur->FileNameLength : ~(USHORT)0; ustr.Buffer = &pcur->FileName[0]; rcNt = g_pfnRtlUnicodeStringToAnsiString(&astr, &ustr, 0/*AllocateDestinationString*/); if (rcNt < 0) sprintf(pdir->ent.name, "conversion-failed-%08x-rcNt=%08x-len=%u", pcur->FileIndex, rcNt, pcur->FileNameLength); if (pcur->NextEntryOffset) pdir->off += pcur->NextEntryOffset; else pdir->off = pdir->cb; return &pdir->ent; } } else errno = EINVAL; return NULL; #else struct dirent *pde = readdir((DIR *)pdir); return pde ? (shdirent *)&pde->d_name[0] : NULL; #endif } void shfile_closedir(struct shdir *pdir) { #if defined(SHFILE_IN_USE) && K_OS == K_OS_WINDOWS if (pdir) { CloseHandle(pdir->native); pdir->pfdtab = NULL; pdir->native = INVALID_HANDLE_VALUE; sh_free(shthread_get_shell(), pdir); } else errno = EINVAL; #else closedir((DIR *)pdir); #endif } kbuild-3608/src/kash/eval.h0000664000175000017500000000536414670377416015552 0ustar locutuslocutus/* $NetBSD: eval.h,v 1.14 2003/08/07 09:05:31 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)eval.h 8.2 (Berkeley) 5/4/95 */ /*extern char *commandname;*/ /* currently executing command */ /*extern int exitstatus;*/ /* exit status of last command */ /*extern int back_exitstatus;*/ /* exit status of backquoted command */ /*extern struct strlist *cmdenviron;*/ /* environment for builtin command */ struct backcmd { /* result of evalbackcmd */ int fd; /* file descriptor to read from */ char *buf; /* buffer */ int nleft; /* number of chars in buffer */ struct job *jp; /* job structure for command */ }; void evalstring(struct shinstance *, char *, int); union node; /* BLETCH for ansi C */ void evaltree(struct shinstance *, union node *, int); void evalbackcmd(struct shinstance *, union node *, struct backcmd *); /* in_function returns nonzero if we are currently evaluating a function */ #define in_function(psh) (psh)->funcnest /*extern int funcnest; extern int evalskip;*/ /* reasons for skipping commands (see comment on breakcmd routine) */ #define SKIPBREAK 1 #define SKIPCONT 2 #define SKIPFUNC 3 #define SKIPFILE 4 kbuild-3608/src/kash/shtypes.h0000664000175000017500000000753114670377416016320 0ustar locutuslocutus/* $Id: shtypes.h 3477 2020-09-17 21:52:16Z bird $ */ /** @file * Wrapper for missing types and such. */ /* * Copyright (c) 2007-2010 knut st. osmundsen * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef ___shtypes_h___ #define ___shtypes_h___ #include "k/kTypes.h" /* Use these, not the ones below. */ #include "k/kHlpAssert.h" #include #include #ifdef __HAIKU__ # include /* silly */ #elif !defined(_MSC_VER) # include #endif #ifdef _MSC_VER typedef signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef _int64 int64_t; typedef unsigned _int64 uint64_t; # if _MSC_VER >= 1400 # include /* intptr_t and uintptr_t */ # else typedef KIPTR intptr_t; typedef KUPTR uintptr_t; # endif #define INT16_C(c) (c) #define INT32_C(c) (c) #define INT64_C(c) (c ## LL) #define UINT8_C(c) (c) #define UINT16_C(c) (c) #define UINT32_C(c) (c ## U) #define UINT64_C(c) (c ## ULL) #define INTMAX_C(c) (c ## LL) #define UINTMAX_C(c) (c ## ULL) #undef INT8_MIN #define INT8_MIN (-0x7f-1) #undef INT16_MIN #define INT16_MIN (-0x7fff-1) #undef INT32_MIN #define INT32_MIN (-0x7fffffff-1) #undef INT64_MIN #define INT64_MIN (-0x7fffffffffffffffLL-1) #undef INT8_MAX #define INT8_MAX 0x7f #undef INT16_MAX #define INT16_MAX 0x7fff #undef INT32_MAX #define INT32_MAX 0x7fffffff #undef INT64_MAX #define INT64_MAX 0x7fffffffffffffffLL #undef UINT8_MAX #define UINT8_MAX 0xff #undef UINT16_MAX #define UINT16_MAX 0xffff #undef UINT32_MAX #define UINT32_MAX 0xffffffffU #undef UINT64_MAX #define UINT64_MAX 0xffffffffffffffffULL typedef int pid_t; typedef unsigned short uid_t; typedef unsigned short gid_t; typedef int mode_t; typedef intptr_t ssize_t; #else # include #endif struct shinstance; typedef struct shinstance shinstance; #ifdef _MSC_VER typedef uint32_t shsigset_t; #else typedef sigset_t shsigset_t; #endif typedef void (*shsig_t)(shinstance *, int); typedef struct shsigaction { shsig_t sh_handler; shsigset_t sh_mask; int sh_flags; } shsigaction_t; /* SH_NORETURN_1 must be both on prototypes and definitions, while SH_NORETURN_2 should at least be on the prototype. */ #ifdef _MSC_VER # define SH_NORETURN_1 __declspec(noreturn) # define SH_NORETURN_2 #else # define SH_NORETURN_1 # define SH_NORETURN_2 __attribute__((__noreturn__)) #endif /** @name Extra wide pid_t so we can safely add a sub-pid to the top. * @{ */ #ifndef SH_FORKED_MODE typedef KI64 shpid; # define SHPID_MAKE(pid, tid) ((shpid)(KU32)(pid) | (shpid)(KU32)(tid) << 32) # define SHPID_GET_PID(shpid) ((pid_t)(KU32)(shpid)) # define SHPID_GET_TID(shpid) ((pid_t)((shpid) >> 32)) # define SHPID_PRI KI64_PRI #else typedef pid_t shpid; # define SHPID_GET_PID(shpid) (shpid) # define SHPID_PRI KI32_PRI #endif /** @} */ #endif kbuild-3608/src/kash/parser.h0000664000175000017500000000713314670377416016113 0ustar locutuslocutus/* $NetBSD: parser.h,v 1.17 2004/06/26 22:09:49 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)parser.h 8.3 (Berkeley) 5/4/95 */ #ifndef ___parse_h #define ___parse_h /* control characters in argument strings */ #define CTL_FIRST '\201' /* first 'special' character */ #define CTLESC '\201' /* escape next character */ #define CTLVAR '\202' /* variable defn */ #define CTLENDVAR '\203' #define CTLBACKQ '\204' #define CTLQUOTE 01 /* ored with CTLBACKQ code if in quotes */ /* CTLBACKQ | CTLQUOTE == '\205' */ #define CTLARI '\206' /* arithmetic expression */ #define CTLENDARI '\207' #define CTLQUOTEMARK '\210' #define CTLQUOTEEND '\211' /* only inside ${...} */ #define CTL_LAST '\211' /* last 'special' character */ /* variable substitution byte (follows CTLVAR) */ #define VSTYPE 0x0f /* type of variable substitution */ #define VSNUL 0x10 /* colon--treat the empty string as unset */ #define VSQUOTE 0x80 /* inside double quotes--suppress splitting */ /* values of VSTYPE field */ #define VSNORMAL 0x1 /* normal variable: $var or ${var} */ #define VSMINUS 0x2 /* ${var-text} */ #define VSPLUS 0x3 /* ${var+text} */ #define VSQUESTION 0x4 /* ${var?message} */ #define VSASSIGN 0x5 /* ${var=text} */ #define VSTRIMLEFT 0x6 /* ${var#pattern} */ #define VSTRIMLEFTMAX 0x7 /* ${var##pattern} */ #define VSTRIMRIGHT 0x8 /* ${var%pattern} */ #define VSTRIMRIGHTMAX 0x9 /* ${var%%pattern} */ #define VSLENGTH 0xa /* ${#var} */ /* * NEOF is returned by parsecmd when it encounters an end of file. It * must be distinct from NULL, so we use the address of a variable that * happens to be handy. */ /*extern int tokpushback;*/ #define NEOF ((union node *)&psh->tokpushback) /*extern int whichprompt;*/ /* 1 == PS1, 2 == PS2 */ union node *parsecmd(struct shinstance *, int); void fixredir(struct shinstance *, union node *, const char *, int); int goodname(const char *); const char *getprompt(struct shinstance *, void *); union node *copyparsetree(shinstance *, union node *); #endif kbuild-3608/src/kash/machdep.h0000664000175000017500000000501114670377416016211 0ustar locutuslocutus/* $NetBSD: machdep.h,v 1.11 2003/08/07 09:05:33 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)machdep.h 8.2 (Berkeley) 5/4/95 */ /* * Most machines require the value returned from malloc to be aligned * in some way. The following macro will get this right on many machines. */ /* For the purposes of the allocation stack(s), this is nonsensical given that struct stack_block does not align the 'space' member accordingly. That member will be aligned according to the pointer size, so we should do the same here and not mix in any 'double' nonsense: */ #if 0 #define SHELL_SIZE (sizeof(union {int i; char *cp; double d; }) - 1) #else #define SHELL_SIZE (sizeof(void *) - 1) #endif /* * It appears that grabstackstr() will barf with such alignments * because stalloc() will return a string allocated in a new stackblock. */ #define SHELL_ALIGN(nbytes) (((nbytes) + SHELL_SIZE) & ~SHELL_SIZE) kbuild-3608/src/kash/main.h0000664000175000017500000000410014670377416015532 0ustar locutuslocutus/* $NetBSD: main.h,v 1.10 2003/08/07 09:05:34 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)main.h 8.2 (Berkeley) 5/4/95 */ #include "shtypes.h" /*extern int rootpid;*/ /* pid of main shell */ /*extern int rootshell;*/ /* true if we aren't a child of the main shell */ void readcmdfile(struct shinstance *, char *); void cmdloop(struct shinstance *, int); int dotcmd(struct shinstance *, int, char **); int exitcmd(struct shinstance *, int, char **); kbuild-3608/src/kash/exec.h0000664000175000017500000000742314670377416015545 0ustar locutuslocutus/* $NetBSD: exec.h,v 1.21 2003/08/07 09:05:31 agc Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)exec.h 8.3 (Berkeley) 6/8/95 */ #ifndef ___exec_h #define ___exec_h /* values of cmdtype */ #define CMDUNKNOWN -1 /* no entry in table for command */ #define CMDNORMAL 0 /* command is an executable program */ #define CMDFUNCTION 1 /* command is a shell function */ #define CMDBUILTIN 2 /* command is a shell builtin */ #define CMDSPLBLTIN 3 /* command is a special shell builtin */ union param { struct { int index; int suffix; /* PC suffix index */ } n; int (*bltin)(struct shinstance*, int, char**); union node *func; }; struct cmdentry { int cmdtype; union param u; }; /* action to find_command() */ #define DO_ERR 0x01 /* prints errors */ #define DO_ABS 0x02 /* checks absolute paths */ #define DO_NOFUNC 0x04 /* don't return shell functions, for command */ #define DO_ALTPATH 0x08 /* using alternate path */ #define DO_ALTBLTIN 0x20 /* %builtin in alt. path */ /*extern const char *pathopt;*/ /* set by padvance */ #if !defined(__GNUC__) && !defined(__attribute__) # define __attribute__(a) #endif #ifndef SH_FORKED_MODE void subshellinitexec(shinstance *, shinstance *); #endif SH_NORETURN_1 void shellexec(struct shinstance *, char **, char **, const char *, int, int) SH_NORETURN_2; char *padvance(struct shinstance *, const char **, const char *); int hashcmd(struct shinstance *, int, char **); void find_command(struct shinstance *, char *, struct cmdentry *, int, const char *); int (*find_builtin(struct shinstance *, char *))(struct shinstance *, int, char **); int (*find_splbltin(struct shinstance *, char *))(struct shinstance *, int, char **); void hashcd(struct shinstance *); void changepath(struct shinstance *, const char *); void deletefuncs(struct shinstance *); void getcmdentry(struct shinstance *, char *, struct cmdentry *); void addcmdentry(struct shinstance *, char *, struct cmdentry *); void defun(struct shinstance *, char *, union node *); int unsetfunc(struct shinstance *, char *); int typecmd(struct shinstance *, int, char **); void hash_special_builtins(struct shinstance *); #endif kbuild-3608/src/kash/options.c0000664000175000017500000003710214670377416016304 0ustar locutuslocutus/* $NetBSD: options.c,v 1.38 2005/03/20 21:38:17 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: options.c,v 1.38 2005/03/20 21:38:17 dsl Exp $"); #endif /* not lint */ #endif #include #include "shell.h" #define DEFINE_OPTIONS #include "options.h" #undef DEFINE_OPTIONS #include "nodes.h" /* for other header files */ #include "eval.h" #include "jobs.h" #include "input.h" #include "output.h" #include "trap.h" #include "var.h" #include "memalloc.h" #include "error.h" #include "mystring.h" #ifndef SMALL # include "myhistedit.h" #endif #include "show.h" #include "shinstance.h" //char *arg0; /* value of $0 */ //struct shparam shellparam; /* current positional parameters */ //char **argptr; /* argument list for builtin commands */ //char *optionarg; /* set by nextopt (like getopt) */ //char *optptr; /* used by nextopt */ //char *minusc; /* argument to -c option */ STATIC void options(shinstance *, int); STATIC void minus_o(shinstance *, char *, int); STATIC void setoption(shinstance *, int, int); STATIC int getopts(shinstance *, char *, char *, char **, char ***, char **); #ifndef SH_FORKED_MODE void subshellinitoptions(shinstance *psh, shinstance *inherit) { unsigned i; int left; const char *arg; memcpy(&psh->optlist[0], &inherit->optlist[0], sizeof(psh->optlist)); /** @todo opimize: skip this when executing builtins. */ /* Whether the subshell uses argptr/shellparam/arg0 or replaces them depends on whether the shell will execute a builtin command or not. orgargv is already set by the shinstance.c core code, scan the original again and update arg0, shellparm, argptr and optptr. */ /* arg0 is either something from orgargv, or in the EXSHELLPROC case a separate allocation that we need to dupe here. The (new) arg0malloc flag indicates which. */ i = 0; psh->arg0malloc = inherit->arg0malloc; if (inherit->arg0malloc) { psh->arg0 = savestr(psh, inherit->arg0); } else { while ((arg = inherit->orgargv[i]) != NULL) { if (inherit->arg0 == arg) { psh->arg0 = psh->orgargv[i]; break; } i++; } kHlpAssert(psh->arg0 != NULL); } /* eval.h's commandname is same as arg0 when set unless we're doing a dot-include. */ if (inherit->commandname) { if (inherit->commandname == inherit->arg0) { psh->commandname = psh->arg0; } else { psh->commandname = savestr(psh, inherit->commandname); psh->commandnamemalloc = 1; } } /* shellparam is either pointing right after arg0 in orgargv, though it may also be a separately allocated thing (see setparam), or pointing to the arguments of a shell function we're executing (see eval.c). All in all, it's simpler if we just copy the whole darn thing, ASSUMING no modifications will be made that are needed to be visible elsewhere. */ psh->shellparam.malloc = 1; psh->shellparam.reset = inherit->shellparam.reset; psh->shellparam.nparam = left = inherit->shellparam.nparam; kHlpAssert(left >= 0); psh->shellparam.p = (char **)ckmalloc(psh, (left + 1) * sizeof(psh->shellparam.p[0])); psh->shellparam.p[left] = NULL; while (left-- > 0) { arg = inherit->shellparam.p[left]; psh->shellparam.p[left] = savestr(psh, arg); } /* The shellparam.optnext member is either NULL or points to a 'p' entry. */ if (inherit->shellparam.optnext) { size_t idx = (size_t)(inherit->shellparam.optnext - inherit->shellparam.p); kHlpAssert(idx <= inherit->shellparam.nparam); if (idx <= inherit->shellparam.nparam) psh->shellparam.optnext = &psh->shellparam.p[idx]; } /* The shellparam.optptr member is either NULL or points within argument prior to shellparam.optnext. We can leave it as NULL if at the EOS. */ if (inherit->shellparam.optptr && *inherit->shellparam.optptr != '\0') { intptr_t idx; if (!inherit->shellparam.optnext || inherit->shellparam.optnext == inherit->shellparam.p) idx = (intptr_t)(inherit->shellparam.nparam - 1); else { idx = (intptr_t)(inherit->shellparam.optnext - inherit->shellparam.p - 1); if (idx > inherit->shellparam.nparam) idx = inherit->shellparam.nparam - 1; } while (idx >= 0) { size_t arglen, off; arg = inherit->shellparam.p[idx]; arglen = strlen(arg); off = (size_t)(inherit->shellparam.optptr - arg); if (off < arglen) { psh->shellparam.optptr = psh->shellparam.p[idx] + off; break; } off--; } kHlpAssert(psh->shellparam.optptr != NULL); } /* minusc: only used in main.c, so not applicable to subshells. */ /* optionarg: only used by callers of nextopt, so not relevant when forking subhells. */ } #endif /* SH_FORKED_MODE */ /* * Process the shell command line arguments. */ void procargs(shinstance *psh, int argc, char **argv) { int i; psh->argptr = argv; if (argc > 0) psh->argptr++; for (i = 0; i < NOPTS; i++) psh->optlist[i].val = 2; options(psh, 1); if (*psh->argptr == NULL && psh->minusc == NULL) sflag(psh) = 1; if (iflag(psh) == 2 && sflag(psh) == 1 && shfile_isatty(&psh->fdtab, 0) && shfile_isatty(&psh->fdtab, 1)) iflag(psh) = 1; if (mflag(psh) == 2) mflag(psh) = iflag(psh); for (i = 0; i < NOPTS; i++) if (psh->optlist[i].val == 2) psh->optlist[i].val = 0; #if DEBUG == 2 debug(psh) = 1; #endif psh->commandnamemalloc = 0; psh->arg0malloc = 0; psh->arg0 = argv[0]; if (sflag(psh) == 0 && psh->minusc == NULL) { psh->commandname = argv[0]; psh->arg0 = *psh->argptr++; setinputfile(psh, psh->arg0, 0); psh->commandname = psh->arg0; } /* POSIX 1003.2: first arg after -c cmd is $0, remainder $1... */ if (psh->minusc != NULL) { if (psh->argptr == NULL || *psh->argptr == NULL) error(psh, "Bad -c option"); psh->minusc = *psh->argptr++; if (*psh->argptr != 0) psh->arg0 = *psh->argptr++; } psh->shellparam.p = psh->argptr; psh->shellparam.reset = 1; /* kHlpAssert(shellparam.malloc == 0 && shellparam.nparam == 0); */ while (*psh->argptr) { psh->shellparam.nparam++; psh->argptr++; } optschanged(psh); } void optschanged(shinstance *psh) { setinteractive(psh, iflag(psh)); #ifndef SMALL histedit(psh); #endif setjobctl(psh, mflag(psh)); } /* * Process shell options. The global variable argptr contains a pointer * to the argument list; we advance it past the options. */ STATIC void options(shinstance *psh, int cmdline) { static char empty[] = ""; char *p; int val; int c; if (cmdline) psh->minusc = NULL; while ((p = *psh->argptr) != NULL) { psh->argptr++; if ((c = *p++) == '-') { val = 1; if (p[0] == '\0' || (p[0] == '-' && p[1] == '\0')) { if (!cmdline) { /* "-" means turn off -x and -v */ if (p[0] == '\0') xflag(psh) = vflag(psh) = 0; /* "--" means reset params */ else if (*psh->argptr == NULL) setparam(psh, psh->argptr); } break; /* "-" or "--" terminates options */ } } else if (c == '+') { val = 0; } else { psh->argptr--; break; } while ((c = *p++) != '\0') { if (c == 'c' && cmdline) { /* command is after shell args*/ psh->minusc = empty; } else if (c == 'o') { minus_o(psh, *psh->argptr, val); if (*psh->argptr) psh->argptr++; } else { setoption(psh, c, val); } } } } static void set_opt_val(shinstance *psh, int i, int val) { int j; int flag; if (val && (flag = psh->optlist[i].opt_set)) { /* some options (eg vi/emacs) are mutually exclusive */ for (j = 0; j < NOPTS; j++) if (psh->optlist[j].opt_set == flag) psh->optlist[j].val = 0; } psh->optlist[i].val = val; #ifdef DEBUG if (&psh->optlist[i].val == &debug(psh)) opentrace(psh); #endif } STATIC void minus_o(shinstance *psh, char *name, int val) { int i; if (name == NULL) { out1str(psh, "Current option settings\n"); for (i = 0; i < NOPTS; i++) out1fmt(psh, "%-16s%s\n", psh->optlist[i].name, psh->optlist[i].val ? "on" : "off"); } else { for (i = 0; i < NOPTS; i++) if (equal(name, psh->optlist[i].name)) { set_opt_val(psh, i, val); return; } error(psh, "Illegal option -o %s", name); } } STATIC void setoption(shinstance *psh, int flag, int val) { int i; for (i = 0; i < NOPTS; i++) if (psh->optlist[i].letter == flag) { set_opt_val(psh, i, val); return; } error(psh, "Illegal option -%c", flag); /* NOTREACHED */ } #ifdef mkinit INCLUDE "options.h" INIT { memcpy(&psh->optlist[0], &ro_optlist[0], sizeof(psh->optlist)); } SHELLPROC { int i; for (i = 0; psh->optlist[i].name; i++) psh->optlist[i].val = 0; # if DEBUG == 2 debug(psh) = 1; # endif optschanged(psh); } #endif /* * Set the shell parameters. */ void setparam(shinstance *psh, char **argv) { char **newparam; char **ap; int nparam; for (nparam = 0 ; argv[nparam] ; nparam++) continue; ap = newparam = ckmalloc(psh, (nparam + 1) * sizeof *ap); while (*argv) { *ap++ = savestr(psh, *argv++); } *ap = NULL; freeparam(psh, &psh->shellparam); psh->shellparam.malloc = 1; psh->shellparam.nparam = nparam; psh->shellparam.p = newparam; psh->shellparam.optnext = NULL; } /* * Free the list of positional parameters. */ void freeparam(shinstance *psh, volatile struct shparam *param) { char **ap; if (param->malloc) { for (ap = param->p ; *ap ; ap++) ckfree(psh, *ap); ckfree(psh, param->p); } } /* * The shift builtin command. */ int shiftcmd(shinstance *psh, int argc, char **argv) { int n; char **ap1, **ap2; n = 1; if (argc > 1) n = number(psh, argv[1]); if (n > psh->shellparam.nparam) error(psh, "can't shift that many"); INTOFF; psh->shellparam.nparam -= n; for (ap1 = psh->shellparam.p ; --n >= 0 ; ap1++) { if (psh->shellparam.malloc) ckfree(psh, *ap1); } ap2 = psh->shellparam.p; while ((*ap2++ = *ap1++) != NULL); psh->shellparam.optnext = NULL; INTON; return 0; } /* * The set command builtin. */ int setcmd(shinstance *psh, int argc, char **argv) { if (argc == 1) return showvars(psh, 0, 0, 1); INTOFF; options(psh, 0); optschanged(psh); if (*psh->argptr != NULL) { setparam(psh, psh->argptr); } INTON; return 0; } void getoptsreset(shinstance *psh, const char *value) { if (number(psh, value) == 1) { psh->shellparam.optnext = NULL; psh->shellparam.reset = 1; } } /* * The getopts builtin. Shellparam.optnext points to the next argument * to be processed. Shellparam.optptr points to the next character to * be processed in the current argument. If shellparam.optnext is NULL, * then it's the first time getopts has been called. */ int getoptscmd(shinstance *psh, int argc, char **argv) { char **optbase; if (argc < 3) error(psh, "usage: getopts optstring var [arg]"); else if (argc == 3) optbase = psh->shellparam.p; else optbase = &argv[3]; if (psh->shellparam.reset == 1) { psh->shellparam.optnext = optbase; psh->shellparam.optptr = NULL; psh->shellparam.reset = 0; } return getopts(psh, argv[1], argv[2], optbase, &psh->shellparam.optnext, &psh->shellparam.optptr); } STATIC int getopts(shinstance *psh, char *optstr, char *optvar, char **optfirst, char ***optnext, char **optpptr) { char *p, *q; char c = '?'; int done = 0; int ind = 0; int err = 0; char s[12]; if ((p = *optpptr) == NULL || *p == '\0') { /* Current word is done, advance */ if (*optnext == NULL) return 1; p = **optnext; if (p == NULL || *p != '-' || *++p == '\0') { atend: ind = (int)(*optnext - optfirst + 1); *optnext = NULL; p = NULL; done = 1; goto out; } (*optnext)++; if (p[0] == '-' && p[1] == '\0') /* check for "--" */ goto atend; } c = *p++; for (q = optstr; *q != c; ) { if (*q == '\0') { if (optstr[0] == ':') { s[0] = c; s[1] = '\0'; err |= setvarsafe(psh, "OPTARG", s, 0); } else { outfmt(&psh->errout, "Illegal option -%c\n", c); (void) unsetvar(psh, "OPTARG", 0); } c = '?'; goto bad; } if (*++q == ':') q++; } if (*++q == ':') { if (*p == '\0' && (p = **optnext) == NULL) { if (optstr[0] == ':') { s[0] = c; s[1] = '\0'; err |= setvarsafe(psh, "OPTARG", s, 0); c = ':'; } else { outfmt(&psh->errout, "No arg for -%c option\n", c); (void) unsetvar(psh, "OPTARG", 0); c = '?'; } goto bad; } if (p == **optnext) (*optnext)++; err |= setvarsafe(psh, "OPTARG", p, 0); p = NULL; } else err |= setvarsafe(psh, "OPTARG", "", 0); ind = (int)(*optnext - optfirst + 1); goto out; bad: ind = 1; *optnext = NULL; p = NULL; out: *optpptr = p; fmtstr(s, sizeof(s), "%d", ind); err |= setvarsafe(psh, "OPTIND", s, VNOFUNC); s[0] = c; s[1] = '\0'; err |= setvarsafe(psh, optvar, s, 0); if (err) { *optnext = NULL; *optpptr = NULL; output_flushall(psh); exraise(psh, EXERROR); } return done; } /* * XXX - should get rid of. have all builtins use getopt(3). the * library getopt must have the BSD extension static variable "optreset" * otherwise it can't be used within the shell safely. * * Standard option processing (a la getopt) for builtin routines. The * only argument that is passed to nextopt is the option string; the * other arguments are unnecessary. It return the character, or '\0' on * end of input. */ int nextopt(shinstance *psh, const char *optstring) { char *p; const char *q; char c; if ((p = psh->optptr) == NULL || *p == '\0') { p = *psh->argptr; if (p == NULL || *p != '-' || *++p == '\0') return '\0'; psh->argptr++; if (p[0] == '-' && p[1] == '\0') /* check for "--" */ return '\0'; } c = *p++; for (q = optstring ; *q != c ; ) { if (*q == '\0') error(psh, "Illegal option -%c", c); if (*++q == ':') q++; } if (*++q == ':') { if (*p == '\0' && (p = *psh->argptr++) == NULL) error(psh, "No arg for -%c option", c); psh->optionarg = p; p = NULL; } psh->optptr = p; return c; } kbuild-3608/src/kash/var.c0000664000175000017500000005442714670377416015412 0ustar locutuslocutus/* $NetBSD: var.c,v 1.36 2004/10/06 10:23:43 enami Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95"; #else __RCSID("$NetBSD: var.c,v 1.36 2004/10/06 10:23:43 enami Exp $"); #endif /* not lint */ #endif #include #include #include #ifdef PC_OS2_LIBPATHS #define INCL_BASE #include #ifndef LIBPATHSTRICT #define LIBPATHSTRICT 3 #endif extern APIRET #ifdef APIENTRY APIENTRY #endif DosQueryHeaderInfo(HMODULE hmod, ULONG ulIndex, PVOID pvBuffer, ULONG cbBuffer, ULONG ulSubFunction); #define QHINF_EXEINFO 1 /* NE exeinfo. */ #define QHINF_READRSRCTBL 2 /* Reads from the resource table. */ #define QHINF_READFILE 3 /* Reads from the executable file. */ #define QHINF_LIBPATHLENGTH 4 /* Gets the libpath length. */ #define QHINF_LIBPATH 5 /* Gets the entire libpath. */ #define QHINF_FIXENTRY 6 /* NE only */ #define QHINF_STE 7 /* NE only */ #define QHINF_MAPSEL 8 /* NE only */ #endif /* * Shell variables. */ #include "shell.h" #include "output.h" #include "expand.h" #include "nodes.h" /* for other headers */ #include "eval.h" /* defines cmdenviron */ #include "exec.h" #include "syntax.h" #include "options.h" #include "mail.h" #include "var.h" #include "memalloc.h" #include "error.h" #include "mystring.h" #include "parser.h" #include "show.h" #ifndef SMALL # include "myhistedit.h" #endif #include "shinstance.h" //#ifdef SMALL //#define VTABSIZE 39 //#else //#define VTABSIZE 517 //#endif struct varinit { unsigned var_off; int flags; const char *text; void (*func)(shinstance *, const char *); }; //#if ATTY //struct var vatty; //#endif //#ifndef SMALL //struct var vhistsize; //struct var vterm; //#endif //struct var vifs; //struct var vmail; //struct var vmpath; //struct var vpath; //#ifdef _MSC_VER //struct var vpath2; //#endif //struct var vps1; //struct var vps2; //struct var vps4; //struct var vvers; - unused //struct var voptind; #ifdef PC_OS2_LIBPATHS //static struct var libpath_vars[4]; static const char * const libpath_envs[4] = {"LIBPATH=", "BEGINLIBPATH=", "ENDLIBPATH=", "LIBPATHSTRICT="}; #endif const struct varinit varinit[] = { #if ATTY { offsetof(shinstance, vatty), VSTRFIXED|VSTRFIXED2|VTEXTFIXED|VUNSET, "ATTY=", NULL }, #endif #ifndef SMALL { offsetof(shinstance, vhistsize), VSTRFIXED|VSTRFIXED2|VTEXTFIXED|VUNSET, "HISTSIZE=", sethistsize }, #endif { offsetof(shinstance, vifs), VSTRFIXED|VSTRFIXED2|VTEXTFIXED, "IFS= \t\n", NULL }, { offsetof(shinstance, vmail), VSTRFIXED|VSTRFIXED2|VTEXTFIXED|VUNSET, "MAIL=", NULL }, { offsetof(shinstance, vmpath), VSTRFIXED|VSTRFIXED2|VTEXTFIXED|VUNSET, "MAILPATH=", NULL }, { offsetof(shinstance, vpath), VSTRFIXED|VSTRFIXED2|VTEXTFIXED, "PATH=" _PATH_DEFPATH, changepath }, /* * vps1 depends on uid */ { offsetof(shinstance, vps2), VSTRFIXED|VSTRFIXED2|VTEXTFIXED, "PS2=> ", NULL }, { offsetof(shinstance, vps4), VSTRFIXED|VSTRFIXED2|VTEXTFIXED, "PS4=+ ", NULL }, #ifndef SMALL { offsetof(shinstance, vterm), VSTRFIXED|VSTRFIXED2|VTEXTFIXED|VUNSET, "TERM=", setterm }, #endif { offsetof(shinstance, voptind), VSTRFIXED|VSTRFIXED2|VTEXTFIXED|VNOFUNC, "OPTIND=1", getoptsreset }, { 0, 0, NULL, NULL } }; //struct var *vartab[VTABSIZE]; STATIC int strequal(const char *, const char *); STATIC struct var *find_var(shinstance *, const char *, struct var ***, int *); /* * Initialize the varable symbol tables and import the environment */ #ifdef mkinit INCLUDE "var.h" INIT { char **envp; initvar(psh); for (envp = sh_environ(psh) ; *envp ; envp++) { if (strchr(*envp, '=')) { setvareq(psh, *envp, VEXPORT|VTEXTFIXED); } } } #endif /* * This routine initializes the builtin variables. It is called when the * shell is initialized and again when a shell procedure is spawned. */ void initvar(shinstance *psh) { const struct varinit *ip; struct var *vp; struct var **vpp; #ifdef PC_OS2_LIBPATHS char *psz = ckmalloc(psh, 2048); int rc; int i; for (i = 0; i < 4; i++) { psh->libpath_vars[i].flags = VSTRFIXED | VSTRFIXED2 | VOS2LIBPATH; psh->libpath_vars[i].func = NULL; if (i > 0) { psz[0] = psz[1] = psz[2] = psz[3] = '\0'; rc = DosQueryExtLIBPATH(psz, i); } else { rc = DosQueryHeaderInfo(NULLHANDLE, 0, psz, 2048, QHINF_LIBPATH); psh->libpath_vars[i].flags |= VREADONLY; } if (!rc && *psz) { int cch1 = strlen(libpath_envs[i]); int cch2 = strlen(psz) + 1; psh->libpath_vars[i].text = ckmalloc(psh, cch1 + cch2); memcpy(psh->libpath_vars[i].text, libpath_envs[i], cch1); memcpy(psh->libpath_vars[i].text + cch1, psz, cch2); } else { psh->libpath_vars[i].flags |= VUNSET | VTEXTFIXED; psh->libpath_vars[i].text = (char *)libpath_envs[i]; } if (find_var(psh, psh->libpath_vars[i].text, &vpp, &psh->libpath_vars[i].name_len) != NULL) continue; psh->libpath_vars[i].next = *vpp; *vpp = &psh->libpath_vars[i]; } ckfree(psh, psz); #endif for (ip = varinit; ip->text; ip++) { vp = (struct var *)((char *)psh + ip->var_off); if (find_var(psh, ip->text, &vpp, &vp->name_len) != NULL) continue; vp->next = *vpp; *vpp = vp; vp->text = sh_strdup(psh, ip->text); vp->flags = ip->flags; vp->func = ip->func; } /* * PS1 depends on uid */ if (find_var(psh, "PS1", &vpp, &psh->vps1.name_len) == NULL) { psh->vps1.next = *vpp; *vpp = &psh->vps1; #ifdef KBUILD_VERSION_MAJOR psh->vps1.text = sh_strdup(psh, sh_geteuid(psh) ? "PS1=kash$ " : "PS1=kash# "); #else psh->vps1.text = sh_strdup(psh, sh_geteuid(psh) ? "PS1=$ " : "PS1=# "); #endif psh->vps1.flags = VSTRFIXED|VSTRFIXED2|VTEXTFIXED; /** @todo text isn't fixed here... */ } } #ifndef SH_FORKED_MODE /* * This routine is called to copy variable state from parent to child shell. */ void subshellinitvar(shinstance *psh, shinstance *inherit) { unsigned i; for (i = 0; i < K_ELEMENTS(inherit->vartab); i++) { struct var const *vsrc = inherit->vartab[i]; if (vsrc) { struct var **ppdst = &psh->vartab[i]; do { struct var *dst; if (!(vsrc->flags & VSTRFIXED2)) { dst = (struct var *)ckmalloc(psh, sizeof(*dst)); *dst = *vsrc; dst->flags &= ~VSTRFIXED; } else { /* VSTRFIXED2 is used when the structure is a fixed allocation in the shinstance structure, so scan those to find which it is: */ size_t left = ((struct var *)&inherit->vartab[0] - &inherit->vatty); struct var const *fixedsrc = &inherit->vatty; dst = &psh->vatty; while (left-- > 0) if (vsrc != fixedsrc) { fixedsrc++; dst++; } else break; kHlpAssert(left < 256 /*whatever, just no rollover*/); *dst = *vsrc; } if (!(vsrc->flags & VTEXTFIXED)) { dst->text = savestr(psh, vsrc->text); dst->flags &= ~VSTACK; } *ppdst = dst; ppdst = &dst->next; vsrc = vsrc->next; } while (vsrc); *ppdst = NULL; } } /** @todo We don't always need to copy local variables. */ if (inherit->localvars) { struct localvar const *vsrc = inherit->localvars; struct localvar **ppdst = &psh->localvars; do { struct localvar *dst = ckmalloc(psh, sizeof(*dst)); dst->flags = vsrc->flags & ~(VSTACK | VTEXTFIXED | (vsrc->flags & VSTRFIXED2 ? 0 : VSTRFIXED)); if (vsrc->text) dst->text = savestr(psh, vsrc->text); else { dst->text = NULL; dst->flags |= vsrc->flags & VTEXTFIXED; } dst->vp = find_var(psh, vsrc->vp->text, NULL, NULL); kHlpAssert(dst->vp); *ppdst = dst; ppdst = &dst->next; vsrc = vsrc->next; } while (vsrc); *ppdst = NULL; } } #endif /* !SH_FORKED_MODE */ /* * Safe version of setvar, returns 1 on success 0 on failure. */ int setvarsafe(shinstance *psh, const char *name, const char *val, int flags) { struct jmploc jmploc; struct jmploc *volatile savehandler = psh->handler; int err = 0; #ifdef __GNUC__ (void) &err; #endif if (setjmp(jmploc.loc)) err = 1; else { psh->handler = &jmploc; setvar(psh, name, val, flags); } psh->handler = savehandler; return err; } /* * Set the value of a variable. The flags argument is ored with the * flags of the variable. If val is NULL, the variable is unset. */ void setvar(shinstance *psh, const char *name, const char *val, int flags) { const char *p; const char *q; char *d; size_t len; int namelen; char *nameeq; int isbad; isbad = 0; p = name; if (! is_name(*p)) isbad = 1; p++; for (;;) { if (! is_in_name(*p)) { if (*p == '\0' || *p == '=') break; isbad = 1; } p++; } namelen = (int)(p - name); if (isbad) error(psh, "%.*s: bad variable name", namelen, name); len = namelen + 2; /* 2 is space for '=' and '\0' */ if (val == NULL) { flags |= VUNSET; } else { len += strlen(val); } d = nameeq = ckmalloc(psh, len); q = name; while (--namelen >= 0) *d++ = *q++; *d++ = '='; *d = '\0'; if (val) scopy(val, d); setvareq(psh, nameeq, flags); } /* * Same as setvar except that the variable and value are passed in * the first argument as name=value. Since the first argument will * be actually stored in the table, it should not be a string that * will go away. */ void setvareq(shinstance *psh, char *s, int flags) { struct var *vp, **vpp; int nlen; #if defined(_MSC_VER) || defined(_WIN32) /* On Windows PATH is often spelled 'Path', correct this here. */ if ( s[0] == 'P' && s[1] == 'a' && s[2] == 't' && s[3] == 'h' && (s[4] == '\0' || s[4] == '=') ) { s[1] = 'A'; s[2] = 'T'; s[3] = 'H'; } #endif if (aflag(psh)) flags |= VEXPORT; vp = find_var(psh, s, &vpp, &nlen); if (vp != NULL) { if (vp->flags & VREADONLY) error(psh, "%.*s: is read only", vp->name_len, s); if (flags & VNOSET) return; INTOFF; if (vp->func && (flags & VNOFUNC) == 0) (*vp->func)(psh, s + vp->name_len + 1); if ((vp->flags & (VTEXTFIXED|VSTACK)) == 0) ckfree(psh, vp->text); vp->flags &= ~(VTEXTFIXED|VSTACK|VUNSET); vp->flags |= flags & ~VNOFUNC; vp->text = s; #ifdef PC_OS2_LIBPATHS if ((vp->flags & VOS2LIBPATH) && (vp->flags & VEXPORT)) vp->flags &= ~VEXPORT; #endif /* * We could roll this to a function, to handle it as * a regular variable function callback, but why bother? */ if (vp == &psh->vmpath || (vp == &psh->vmail && ! mpathset(psh))) chkmail(psh, 1); INTON; return; } /* not found */ if (flags & VNOSET) return; vp = ckmalloc(psh, sizeof (*vp)); vp->flags = flags & ~VNOFUNC; vp->text = s; vp->name_len = nlen; vp->next = *vpp; vp->func = NULL; *vpp = vp; } /* * Process a linked list of variable assignments. */ void listsetvar(shinstance *psh, struct strlist *list, int flags) { struct strlist *lp; INTOFF; for (lp = list ; lp ; lp = lp->next) { setvareq(psh, savestr(psh, lp->text), flags); } INTON; } void listmklocal(shinstance *psh, struct strlist *list, int flags) { struct strlist *lp; for (lp = list ; lp ; lp = lp->next) mklocal(psh, lp->text, flags); } /* * Find the value of a variable. Returns NULL if not set. */ char * lookupvar(shinstance *psh, const char *name) { struct var *v; v = find_var(psh, name, NULL, NULL); if (v == NULL || v->flags & VUNSET) return NULL; return v->text + v->name_len + 1; } /* * Search the environment of a builtin command. If the second argument * is nonzero, return the value of a variable even if it hasn't been * exported. */ char * bltinlookup(shinstance *psh, const char *name, int doall) { struct strlist *sp; struct var *v; for (sp = psh->cmdenviron ; sp ; sp = sp->next) { if (strequal(sp->text, name)) return strchr(sp->text, '=') + 1; } v = find_var(psh, name, NULL, NULL); if (v == NULL || v->flags & VUNSET || (!doall && !(v->flags & VEXPORT))) return NULL; return v->text + v->name_len + 1; } /* * Generate a list of exported variables. This routine is used to construct * the third argument to execve when executing a program. */ char ** environment(shinstance *psh) { int nenv; struct var **vpp; struct var *vp; char **env; char **ep; nenv = 0; for (vpp = psh->vartab ; vpp < psh->vartab + VTABSIZE ; vpp++) { for (vp = *vpp ; vp ; vp = vp->next) if (vp->flags & VEXPORT) nenv++; } ep = env = stalloc(psh, (nenv + 1) * sizeof *env); for (vpp = psh->vartab ; vpp < psh->vartab + VTABSIZE ; vpp++) { for (vp = *vpp ; vp ; vp = vp->next) if (vp->flags & VEXPORT) *ep++ = vp->text; } *ep = NULL; #ifdef PC_OS2_LIBPATHS /* * Set the libpaths now as this is exec() time. */ for (nenv = 0; nenv < 3; nenv++) DosSetExtLIBPATH(strchr(psh->libpath_vars[nenv].text, '=') + 1, nenv); #endif return env; } /* * Called when a shell procedure is invoked to clear out nonexported * variables. It is also necessary to reallocate variables of with * VSTACK set since these are currently allocated on the stack. */ #ifdef mkinit void shprocvar(shinstance *psh); SHELLPROC { shprocvar(psh); } #endif void shprocvar(shinstance *psh) { struct var **vpp; struct var *vp, **prev; for (vpp = psh->vartab ; vpp < psh->vartab + VTABSIZE ; vpp++) { for (prev = vpp ; (vp = *prev) != NULL ; ) { if ((vp->flags & VEXPORT) == 0) { *prev = vp->next; if ((vp->flags & VTEXTFIXED) == 0) ckfree(psh, vp->text); if ((vp->flags & (VSTRFIXED | VSTRFIXED2)) == 0) ckfree(psh, vp); } else { if (vp->flags & VSTACK) { vp->text = savestr(psh, vp->text); vp->flags &=~ VSTACK; } prev = &vp->next; } } } initvar(psh); } /* * Command to list all variables which are set. Currently this command * is invoked from the set command when the set command is called without * any variables. */ void print_quoted(shinstance *psh, const char *p) { const char *q; if (strcspn(p, "|&;<>()$`\\\"' \t\n*?[]#~=%") == strlen(p)) { out1fmt(psh, "%s", p); return; } while (*p) { if (*p == '\'') { out1fmt(psh, "\\'"); p++; continue; } q = strchr(p, '\''); if (!q) { out1fmt(psh, "'%s'", p ); return; } out1fmt(psh, "'%.*s'", (int)(q - p), p ); p = q; } } static int sort_var(const void *v_v1, const void *v_v2) { const struct var * const *v1 = v_v1; const struct var * const *v2 = v_v2; /* XXX Will anyone notice we include the '=' of the shorter name? */ return strcoll((*v1)->text, (*v2)->text); } /* * POSIX requires that 'set' (but not export or readonly) output the * variables in lexicographic order - by the locale's collating order (sigh). * Maybe we could keep them in an ordered balanced binary tree * instead of hashed lists. * For now just roll 'em through qsort for printing... */ int showvars(shinstance *psh, const char *name, int flag, int show_value) { struct var **vpp; struct var *vp; const char *p; static struct var **list; /* static in case we are interrupted */ static int list_len; int count = 0; if (!list) { list_len = 32; list = ckmalloc(psh, list_len * sizeof(*list)); } for (vpp = psh->vartab ; vpp < psh->vartab + VTABSIZE ; vpp++) { for (vp = *vpp ; vp ; vp = vp->next) { if (flag && !(vp->flags & flag)) continue; if (vp->flags & VUNSET && !(show_value & 2)) continue; if (count >= list_len) { list = ckrealloc(psh, list, (list_len << 1) * sizeof(*list)); list_len <<= 1; } list[count++] = vp; } } qsort(list, count, sizeof(*list), sort_var); for (vpp = list; count--; vpp++) { vp = *vpp; if (name) out1fmt(psh, "%s ", name); for (p = vp->text ; *p != '=' ; p++) out1c(psh, *p); if (!(vp->flags & VUNSET) && show_value) { out1fmt(psh, "="); print_quoted(psh, ++p); } out1c(psh, '\n'); } return 0; } /* * The export and readonly commands. */ int exportcmd(shinstance *psh, int argc, char **argv) { struct var *vp; char *name; const char *p; int flag = argv[0][0] == 'r'? VREADONLY : VEXPORT; int pflag; pflag = nextopt(psh, "p") == 'p' ? 3 : 0; if (argc <= 1 || pflag) { showvars(psh, pflag ? argv[0] : 0, flag, pflag ); return 0; } while ((name = *psh->argptr++) != NULL) { if ((p = strchr(name, '=')) != NULL) { p++; } else { vp = find_var(psh, name, NULL, NULL); if (vp != NULL) { vp->flags |= flag; continue; } } setvar(psh, name, p, flag); } return 0; } /* * The "local" command. */ int localcmd(shinstance *psh, int argc, char **argv) { char *name; if (! in_function(psh)) error(psh, "Not in a function"); while ((name = *psh->argptr++) != NULL) { mklocal(psh, name, 0); } return 0; } /* * Make a variable a local variable. When a variable is made local, it's * value and flags are saved in a localvar structure. The saved values * will be restored when the shell function returns. We handle the name * "-" as a special case. */ void mklocal(shinstance *psh, const char *name, int flags) { struct localvar *lvp; struct var **vpp; struct var *vp; INTOFF; lvp = ckmalloc(psh, sizeof (struct localvar)); if (name[0] == '-' && name[1] == '\0') { char *p; p = ckmalloc(psh, sizeof_optlist); lvp->text = memcpy(p, psh->optlist, sizeof_optlist); vp = NULL; } else { vp = find_var(psh, name, &vpp, NULL); if (vp == NULL) { if (strchr(name, '=')) setvareq(psh, savestr(psh, name), VSTRFIXED|flags); else setvar(psh, name, NULL, VSTRFIXED|flags); vp = *vpp; /* the new variable */ lvp->text = NULL; lvp->flags = VUNSET; } else { lvp->text = vp->text; lvp->flags = vp->flags; vp->flags |= VSTRFIXED|VTEXTFIXED; if (name[vp->name_len] == '=') setvareq(psh, savestr(psh, name), flags); } } lvp->vp = vp; lvp->next = psh->localvars; psh->localvars = lvp; INTON; } /* * Called after a function returns. */ void poplocalvars(shinstance *psh) { struct localvar *lvp; struct var *vp; while ((lvp = psh->localvars) != NULL) { psh->localvars = lvp->next; vp = lvp->vp; TRACE((psh, "poplocalvar %s", vp ? vp->text : "-")); if (vp == NULL) { /* $- saved */ memcpy(psh->optlist, lvp->text, sizeof_optlist); ckfree(psh, lvp->text); } else if ((lvp->flags & (VUNSET|VSTRFIXED)) == VUNSET) { (void)unsetvar(psh, vp->text, 0); } else { if (vp->func && (vp->flags & VNOFUNC) == 0) (*vp->func)(psh, lvp->text + vp->name_len + 1); if ((vp->flags & VTEXTFIXED) == 0) ckfree(psh, vp->text); vp->flags = lvp->flags; vp->text = lvp->text; } ckfree(psh, lvp); } } int setvarcmd(shinstance *psh, int argc, char **argv) { if (argc <= 2) return unsetcmd(psh, argc, argv); else if (argc == 3) setvar(psh, argv[1], argv[2], 0); else error(psh, "List assignment not implemented"); return 0; } /* * The unset builtin command. We unset the function before we unset the * variable to allow a function to be unset when there is a readonly variable * with the same name. */ int unsetcmd(shinstance *psh, int argc, char **argv) { char **ap; int i; int flg_func = 0; int flg_var = 0; int ret = 0; while ((i = nextopt(psh, "evf")) != '\0') { if (i == 'f') flg_func = 1; else flg_var = i; } if (flg_func == 0 && flg_var == 0) flg_var = 1; for (ap = psh->argptr; *ap ; ap++) { if (flg_func) ret |= unsetfunc(psh, *ap); if (flg_var) ret |= unsetvar(psh, *ap, flg_var == 'e'); } return ret; } /* * Unset the specified variable. */ int unsetvar(shinstance *psh, const char *s, int unexport) { struct var **vpp; struct var *vp; vp = find_var(psh, s, &vpp, NULL); if (vp == NULL) return 1; if (vp->flags & VREADONLY) return (1); INTOFF; if (unexport) { vp->flags &= ~VEXPORT; } else { if (vp->text[vp->name_len + 1] != '\0') setvar(psh, s, nullstr, 0); vp->flags &= ~VEXPORT; vp->flags |= VUNSET; if ((vp->flags & (VSTRFIXED | VSTRFIXED2)) == 0) { if ((vp->flags & VTEXTFIXED) == 0) ckfree(psh, vp->text); *vpp = vp->next; ckfree(psh, vp); } } INTON; return 0; } /* * Returns true if the two strings specify the same varable. The first * variable name is terminated by '='; the second may be terminated by * either '=' or '\0'. */ STATIC int strequal(const char *p, const char *q) { while (*p == *q++) { if (*p++ == '=') return 1; } if (*p == '=' && *(q - 1) == '\0') return 1; return 0; } /* * Search for a variable. * 'name' may be terminated by '=' or a NUL. * vppp is set to the pointer to vp, or the list head if vp isn't found * lenp is set to the number of charactets in 'name' */ STATIC struct var * find_var(shinstance *psh, const char *name, struct var ***vppp, int *lenp) { unsigned int hashval; int len; struct var *vp, **vpp; const char *p = name; hashval = 0; while (*p && *p != '=') hashval = 2 * hashval + (unsigned char)*p++; len = (int)(p - name); if (lenp) *lenp = len; vpp = &psh->vartab[hashval % VTABSIZE]; if (vppp) *vppp = vpp; for (vp = *vpp ; vp ; vpp = &vp->next, vp = *vpp) { if (vp->name_len != len) continue; if (memcmp(vp->text, name, len) != 0) continue; if (vppp) *vppp = vpp; return vp; } return NULL; } kbuild-3608/src/kash/tstDump.c0000664000175000017500000000542114670377416016250 0ustar locutuslocutus/* $Id: tstDump.c 2413 2010-09-11 17:43:04Z bird $ */ /** @file * tstDump - dump inherited file handle information on Windows. */ /* * Copyright (c) 2010 knut st. osmundsen * * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include int main() { STARTUPINFO Info; GetStartupInfo(&Info); printf("tst: hStdInput =%p / %p\n", Info.hStdInput, GetStdHandle(STD_INPUT_HANDLE)); printf("tst: hStdOutput=%p / %p\n", Info.hStdOutput, GetStdHandle(STD_OUTPUT_HANDLE)); printf("tst: hStdError =%p / %p\n", Info.hStdError, GetStdHandle(STD_ERROR_HANDLE)); printf("tst: cbReserved2=%d (%#x) lpReserved2=%p\n", Info.cbReserved2, Info.cbReserved2, Info.lpReserved2); if (Info.cbReserved2 > sizeof(int) && Info.lpReserved2) { int count = *(int *)Info.lpReserved2; unsigned char *paf = (unsigned char *)Info.lpReserved2 + sizeof(int); HANDLE *pah = (HANDLE *)(paf + count); int i; printf("tst: count=%d\n", count); for (i = 0; i < count; i++) { if (paf[i] == 0 && pah[i] == INVALID_HANDLE_VALUE) continue; printf("tst: #%02d: native=%#p flags=%#x", i, pah[i], paf[i]); if (paf[i] & 0x01) printf(" FOPEN"); if (paf[i] & 0x02) printf(" FEOFLAG"); if (paf[i] & 0x02) printf(" FEOFLAG"); if (paf[i] & 0x04) printf(" FCRLF"); if (paf[i] & 0x08) printf(" FPIPE"); if (paf[i] & 0x10) printf(" FNOINHERIT"); if (paf[i] & 0x20) printf(" FAPPEND"); if (paf[i] & 0x40) printf(" FDEV"); if (paf[i] & 0x80) printf(" FTEXT"); printf("\n"); } } return 0; } kbuild-3608/src/kash/funcs/0000775000175000017500000000000014670377416015560 5ustar locutuslocutuskbuild-3608/src/kash/funcs/login0000664000175000017500000000377614670377416016630 0ustar locutuslocutus# $NetBSD: login,v 1.7 1995/05/11 21:31:11 christos Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)login 8.2 (Berkeley) 5/4/95 # replaces the login builtin in the BSD shell login () exec login "$@" kbuild-3608/src/kash/funcs/kill0000664000175000017500000000416714670377416016446 0ustar locutuslocutus# $NetBSD: kill,v 1.7 1995/05/11 21:31:10 christos Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)kill 8.2 (Berkeley) 5/4/95 # Convert job names to process ids and then run /bin/kill. kill() { local args x args= for x in "$@" do case $x in %*) x=`jobid "$x"` ;; esac args="$args $x" done /bin/kill $args } kbuild-3608/src/kash/funcs/suspend0000664000175000017500000000375014670377416017171 0ustar locutuslocutus# $NetBSD: suspend,v 1.7 1995/05/11 21:31:17 christos Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)suspend 8.2 (Berkeley) 5/4/95 suspend() { local - set +j kill -TSTP 0 } kbuild-3608/src/kash/funcs/popd0000664000175000017500000000502614670377416016450 0ustar locutuslocutus# $NetBSD: popd,v 1.7 1995/05/11 21:31:13 christos Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)popd 8.2 (Berkeley) 5/4/95 # pushd, popd, and dirs --- written by Chris Bertin # Pixel Computer Inc. ...!wjh12!pixel!pixutl!chris # as modified by Patrick Elam of GTRI and Kenneth Almquist at UW pushd () { SAVE=`pwd` if [ "$1" = "" ] then if [ "$DSTACK" = "" ] then echo "pushd: directory stack empty." return 1 fi set $DSTACK cd $1 || return shift 1 DSTACK="$*" else cd $1 > /dev/null || return fi DSTACK="$SAVE $DSTACK" dirs } popd () { if [ "$DSTACK" = "" ] then echo "popd: directory stack empty." return 1 fi set $DSTACK cd $1 shift DSTACK=$* dirs } dirs () { echo "`pwd` $DSTACK" return 0 } kbuild-3608/src/kash/funcs/pushd0000664000175000017500000000503014670377416016624 0ustar locutuslocutus# $NetBSD: pushd,v 1.7 1995/05/11 21:31:15 christos Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)pushd 8.2 (Berkeley) 5/4/95 # pushd, popd, and dirs --- written by Chris Bertin # Pixel Computer Inc. ...!wjh12!pixel!pixutl!chris # as modified by Patrick Elam of GTRI and Kenneth Almquist at UW pushd () { SAVE=`pwd` if [ "$1" = "" ] then if [ "$DSTACK" = "" ] then echo "pushd: directory stack empty." return 1 fi set $DSTACK cd $1 || return shift 1 DSTACK="$*" else cd $1 > /dev/null || return fi DSTACK="$SAVE $DSTACK" dirs } popd () { if [ "$DSTACK" = "" ] then echo "popd: directory stack empty." return 1 fi set $DSTACK cd $1 shift DSTACK=$* dirs } dirs () { echo "`pwd` $DSTACK" return 0 } kbuild-3608/src/kash/funcs/cmv0000664000175000017500000000420314670377416016267 0ustar locutuslocutus# $NetBSD: cmv,v 1.7 1995/05/11 21:31:05 christos Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)cmv 8.2 (Berkeley) 5/4/95 # Conditional move--don't replace an existing file. cmv() { if test $# != 2 then echo "cmv: arg count" return 2 fi if test -f "$2" -o -w "$2" then echo "$2 exists" return 2 fi /bin/mv "$1" "$2" } kbuild-3608/src/kash/funcs/dirs0000664000175000017500000000502614670377416016447 0ustar locutuslocutus# $NetBSD: dirs,v 1.7 1995/05/11 21:31:08 christos Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)dirs 8.2 (Berkeley) 5/4/95 # pushd, popd, and dirs --- written by Chris Bertin # Pixel Computer Inc. ...!wjh12!pixel!pixutl!chris # as modified by Patrick Elam of GTRI and Kenneth Almquist at UW pushd () { SAVE=`pwd` if [ "$1" = "" ] then if [ "$DSTACK" = "" ] then echo "pushd: directory stack empty." return 1 fi set $DSTACK cd $1 || return shift 1 DSTACK="$*" else cd $1 > /dev/null || return fi DSTACK="$SAVE $DSTACK" dirs } popd () { if [ "$DSTACK" = "" ] then echo "popd: directory stack empty." return 1 fi set $DSTACK cd $1 shift DSTACK=$* dirs } dirs () { echo "`pwd` $DSTACK" return 0 } kbuild-3608/src/kash/funcs/newgrp0000664000175000017500000000372314670377416017012 0ustar locutuslocutus# $NetBSD: newgrp,v 1.7 1995/05/11 21:31:12 christos Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Kenneth Almquist. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)newgrp 8.2 (Berkeley) 5/4/95 newgrp() exec newgrp "$@" kbuild-3608/src/kash/bltin/0000775000175000017500000000000014670377416015552 5ustar locutuslocutuskbuild-3608/src/kash/bltin/Makefile.kup0000664000175000017500000000000014670377416017776 0ustar locutuslocutuskbuild-3608/src/kash/bltin/printf.c0000664000175000017500000003333014670377416017222 0ustar locutuslocutus/* $NetBSD: printf.c,v 1.31 2005/03/22 23:55:46 dsl Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #if !defined(BUILTIN) && !defined(SHELL) __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ The Regents of the University of California. All rights reserved.\n"); #endif #ifndef lint static char sccsid[] = "@(#)printf.c 8.2 (Berkeley) 3/22/95"; #else __RCSID("$NetBSD: printf.c,v 1.31 2005/03/22 23:55:46 dsl Exp $"); #endif /* not lint */ #endif #include #include #include #include #include #include #include #include #include #include #include #include #include "shinstance.h" #ifdef __GNUC__ #define ESCAPE '\e' #else #define ESCAPE 033 #endif static void conv_escape_str(char *, void (*)(int)); static char *conv_escape(char *, char *); static char *conv_expand(const char *); static int getchr(void); static double getdouble(void); static int getwidth(void); static intmax_t getintmax(void); static uintmax_t getuintmax(void); static char *getstr(void); static char *mklong(const char *, int); static void check_conversion(const char *, const char *); static void usage(void); static void b_count(int); static void b_output(int); static size_t b_length; static char *b_fmt; static int rval; static char **gargv; #ifdef BUILTIN /* csh builtin */ #define main progprintf #endif #ifdef SHELL /* sh (aka ash) builtin */ #define main printfcmd #include "../../bin/sh/bltin/bltin.h" #endif /* SHELL */ #define PF(f, func) { \ if (fieldwidth != -1) { \ if (precision != -1) \ (void)printf(f, fieldwidth, precision, func); \ else \ (void)printf(f, fieldwidth, func); \ } else if (precision != -1) \ (void)printf(f, precision, func); \ else \ (void)printf(f, func); \ } #define APF(cpp, f, func) { \ if (fieldwidth != -1) { \ if (precision != -1) \ (void)asprintf(cpp, f, fieldwidth, precision, func); \ else \ (void)asprintf(cpp, f, fieldwidth, func); \ } else if (precision != -1) \ (void)asprintf(cpp, f, precision, func); \ else \ (void)asprintf(cpp, f, func); \ } int main(int, char **); int main(int argc, char *argv[]) { char *fmt, *start; int fieldwidth, precision; char nextch; char *format; int ch; #if !defined(SHELL) && !defined(BUILTIN) (void)setlocale (LC_ALL, ""); #endif while ((ch = getopt(argc, argv, "")) != -1) { switch (ch) { case '?': default: usage(); return 1; } } argc -= optind; argv += optind; if (argc < 1) { usage(); return 1; } format = *argv; gargv = ++argv; #define SKIP1 "#-+ 0" #define SKIP2 "*0123456789" do { /* * Basic algorithm is to scan the format string for conversion * specifications -- once one is found, find out if the field * width or precision is a '*'; if it is, gather up value. * Note, format strings are reused as necessary to use up the * provided arguments, arguments of zero/null string are * provided to use up the format string. */ /* find next format specification */ for (fmt = format; (ch = *fmt++) != '\0';) { if (ch == '\\') { char c_ch; fmt = conv_escape(fmt, &c_ch); putchar(c_ch); continue; } if (ch != '%' || (*fmt == '%' && ++fmt)) { (void)putchar(ch); continue; } /* Ok - we've found a format specification, Save its address for a later printf(). */ start = fmt - 1; /* skip to field width */ fmt += strspn(fmt, SKIP1); fieldwidth = *fmt == '*' ? getwidth() : -1; /* skip to possible '.', get following precision */ fmt += strspn(fmt, SKIP2); if (*fmt == '.') ++fmt; precision = *fmt == '*' ? getwidth() : -1; fmt += strspn(fmt, SKIP2); ch = *fmt; if (!ch) { warnx("missing format character"); return (1); } /* null terminate format string to we can use it as an argument to printf. */ nextch = fmt[1]; fmt[1] = 0; switch (ch) { case 'B': { const char *p = conv_expand(getstr()); *fmt = 's'; PF(start, p); break; } case 'b': { /* There has to be a better way to do this, * but the string we generate might have * embedded nulls. */ static char *a, *t; char *cp = getstr(); /* Free on entry in case shell longjumped out */ if (a != NULL) free(a); a = NULL; if (t != NULL) free(t); t = NULL; /* Count number of bytes we want to output */ b_length = 0; conv_escape_str(cp, b_count); t = malloc(b_length + 1); if (t == NULL) break; memset(t, 'x', b_length); t[b_length] = 0; /* Get printf to calculate the lengths */ *fmt = 's'; APF(&a, start, t); b_fmt = a; /* Output leading spaces and data bytes */ conv_escape_str(cp, b_output); /* Add any trailing spaces */ printf("%s", b_fmt); break; } case 'c': { char p = getchr(); PF(start, p); break; } case 's': { char *p = getstr(); PF(start, p); break; } case 'd': case 'i': { intmax_t p = getintmax(); char *f = mklong(start, ch); PF(f, p); break; } case 'o': case 'u': case 'x': case 'X': { uintmax_t p = getuintmax(); char *f = mklong(start, ch); PF(f, p); break; } case 'e': case 'E': case 'f': case 'g': case 'G': { double p = getdouble(); PF(start, p); break; } default: warnx("%s: invalid directive", start); return 1; } *fmt++ = ch; *fmt = nextch; /* escape if a \c was encountered */ if (rval & 0x100) return rval & ~0x100; } } while (gargv != argv && *gargv); return rval; } /* helper functions for conv_escape_str */ static void /*ARGSUSED*/ b_count(int ch) { b_length++; } /* Output one converted character for every 'x' in the 'format' */ static void b_output(int ch) { for (;;) { switch (*b_fmt++) { case 0: b_fmt--; return; case ' ': putchar(' '); break; default: putchar(ch); return; } } } /* * Print SysV echo(1) style escape string * Halts processing string if a \c escape is encountered. */ static void conv_escape_str(char *str, void (*do_putchar)(int)) { int value; int ch; char c; while ((ch = *str++) != '\0') { if (ch != '\\') { do_putchar(ch); continue; } ch = *str++; if (ch == 'c') { /* \c as in SYSV echo - abort all processing.... */ rval |= 0x100; break; } /* * %b string octal constants are not like those in C. * They start with a \0, and are followed by 0, 1, 2, * or 3 octal digits. */ if (ch == '0') { int octnum = 0, i; for (i = 0; i < 3; i++) { if (!isdigit((unsigned char)*str) || *str > '7') break; octnum = (octnum << 3) | (*str++ - '0'); } do_putchar(octnum); continue; } /* \[M][^|-]C as defined by vis(3) */ if (ch == 'M' && *str == '-') { do_putchar(0200 | str[1]); str += 2; continue; } if (ch == 'M' && *str == '^') { str++; value = 0200; ch = '^'; } else value = 0; if (ch == '^') { ch = *str++; if (ch == '?') value |= 0177; else value |= ch & 037; do_putchar(value); continue; } /* Finally test for sequences valid in the format string */ str = conv_escape(str - 1, &c); do_putchar(c); } } /* * Print "standard" escape characters */ static char * conv_escape(char *str, char *conv_ch) { int value; int ch; char num_buf[4], *num_end; ch = *str++; switch (ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': num_buf[0] = ch; ch = str[0]; num_buf[1] = ch; num_buf[2] = ch ? str[1] : 0; num_buf[3] = 0; value = strtoul(num_buf, &num_end, 8); str += num_end - (num_buf + 1); break; case 'x': /* Hexadecimal character constants are not required to be supported (by SuS v1) because there is no consistent way to detect the end of the constant. Supporting 2 byte constants is a compromise. */ ch = str[0]; num_buf[0] = ch; num_buf[1] = ch ? str[1] : 0; num_buf[2] = 0; value = strtoul(num_buf, &num_end, 16); str += num_end - num_buf; break; case '\\': value = '\\'; break; /* backslash */ case '\'': value = '\''; break; /* single quote */ case '"': value = '"'; break; /* double quote */ case 'a': value = '\a'; break; /* alert */ case 'b': value = '\b'; break; /* backspace */ case 'e': value = ESCAPE; break; /* escape */ case 'f': value = '\f'; break; /* form-feed */ case 'n': value = '\n'; break; /* newline */ case 'r': value = '\r'; break; /* carriage-return */ case 't': value = '\t'; break; /* tab */ case 'v': value = '\v'; break; /* vertical-tab */ default: warnx("unknown escape sequence `\\%c'", ch); rval = 1; value = ch; break; } *conv_ch = value; return str; } /* expand a string so that everything is printable */ static char * conv_expand(const char *str) { static char *conv_str; static char no_memory[] = ""; char *cp; int ch; if (conv_str) free(conv_str); /* get a buffer that is definitely large enough.... */ conv_str = malloc(4 * strlen(str) + 1); if (!conv_str) return no_memory; cp = conv_str; while ((ch = *(const unsigned char *)str++) != '\0') { switch (ch) { /* Use C escapes for expected control characters */ case '\\': ch = '\\'; break; /* backslash */ case '\'': ch = '\''; break; /* single quote */ case '"': ch = '"'; break; /* double quote */ case '\a': ch = 'a'; break; /* alert */ case '\b': ch = 'b'; break; /* backspace */ case ESCAPE: ch = 'e'; break; /* escape */ case '\f': ch = 'f'; break; /* form-feed */ case '\n': ch = 'n'; break; /* newline */ case '\r': ch = 'r'; break; /* carriage-return */ case '\t': ch = 't'; break; /* tab */ case '\v': ch = 'v'; break; /* vertical-tab */ default: /* Copy anything printable */ if (isprint(ch)) { *cp++ = ch; continue; } /* Use vis(3) encodings for the rest */ *cp++ = '\\'; if (ch & 0200) { *cp++ = 'M'; ch &= ~0200; } if (ch == 0177) { *cp++ = '^'; *cp++ = '?'; continue; } if (ch < 040) { *cp++ = '^'; *cp++ = ch | 0100; continue; } *cp++ = '-'; *cp++ = ch; continue; } *cp++ = '\\'; *cp++ = ch; } *cp = 0; return conv_str; } static char * mklong(const char *str, int ch) { static char copy[64]; size_t len; len = strlen(str) + 2; if (len > sizeof copy) { warnx("format %s too complex\n", str); len = 4; } (void)memmove(copy, str, len - 3); copy[len - 3] = 'j'; copy[len - 2] = ch; copy[len - 1] = '\0'; return copy; } static int getchr(void) { if (!*gargv) return 0; return (int)**gargv++; } static char * getstr(void) { static char empty[] = ""; if (!*gargv) return empty; return *gargv++; } static int getwidth(void) { long val; char *s, *ep; s = *gargv; if (!*gargv) return (0); gargv++; errno = 0; val = strtoul(s, &ep, 0); check_conversion(s, ep); /* Arbitrarily 'restrict' field widths to 1Mbyte */ if (val < 0 || val > 1 << 20) { warnx("%s: invalid field width", s); return 0; } return val; } static intmax_t getintmax(void) { intmax_t val; char *cp, *ep; cp = *gargv; if (cp == NULL) return 0; gargv++; if (*cp == '\"' || *cp == '\'') return *(cp+1); errno = 0; val = strtoimax(cp, &ep, 0); check_conversion(cp, ep); return val; } static uintmax_t getuintmax(void) { uintmax_t val; char *cp, *ep; cp = *gargv; if (cp == NULL) return 0; gargv++; if (*cp == '\"' || *cp == '\'') return *(cp + 1); /* strtoumax won't error -ve values */ while (isspace(*(unsigned char *)cp)) cp++; if (*cp == '-') { warnx("%s: expected positive numeric value", cp); rval = 1; return 0; } errno = 0; val = strtoumax(cp, &ep, 0); check_conversion(cp, ep); return val; } static double getdouble(void) { double val; char *ep; if (!*gargv) return (0.0); if (**gargv == '\"' || **gargv == '\'') return (double) *((*gargv++)+1); errno = 0; val = strtod(*gargv, &ep); check_conversion(*gargv++, ep); return val; } static void check_conversion(const char *s, const char *ep) { if (*ep) { if (ep == s) warnx("%s: expected numeric value", s); else warnx("%s: not completely converted", s); rval = 1; } else if (errno == ERANGE) { warnx("%s: %s", s, sh_strerror(psh, ERANGE)); rval = 1; } } static void usage(void) { (void)fprintf(stderr, "Usage: %s format [arg ...]\n", getprogname()); } kbuild-3608/src/kash/bltin/echo.c0000664000175000017500000000715714670377416016646 0ustar locutuslocutus/* $NetBSD: echo.c,v 1.12 2005/02/06 04:43:43 perry Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)echo.c 8.1 (Berkeley) 5/31/93 */ /* * Echo command. * * echo is steeped in tradition - several of them! * netbsd has supported 'echo [-n | -e] args' in spite of -e not being * documented anywhere. * Posix requires that -n be supported, output from strings containing * \ is implementation defined * The Single Unix Spec requires that \ escapes be treated as if -e * were set, but that -n not be treated as an option. * (ksh supports 'echo [-eEn] args', but not -- so that it is actually * impossible to actually output '-n') * * It is suggested that 'printf "%b" "string"' be used to get \ sequences * expanded. printf is now a builtin of netbsd's sh and csh. */ #include "shinstance.h" #include "builtins.h" int echocmd(shinstance *psh, int argc, char **argv) { char **ap; const char *p; int nflag = 0; int eflag = 0; ap = argv; if (argc) ap++; if ((p = *ap) != NULL && *p == '-') { if (p[1] == 'n' && !p[2]) { nflag = 1; ap++; } else if (p[1] == 'e' && !p[2]) { eflag = 1; ap++; } } while ((p = *ap++) != NULL) { if (!eflag) { out1str(psh, p); } else { char c; int count; while ((c = *p++) != '\0') { if (c == '\\') { switch (*p++) { case 'a': c = '\a'; break; /* bell */ case 'b': c = '\b'; break; case 'c': return 0; /* exit */ case 'e': c = 033; break; /* escape */ case 'f': c = '\f'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; case 'v': c = '\v'; break; case '\\': break; /* c = '\\' */ case '0': c = 0; count = 3; while (--count >= 0 && (unsigned)(*p - '0') < 8) c = (c << 3) + (*p++ - '0'); break; default: /* Output the '/' and char following */ p--; break; } } out1c(psh, c); } } if (*ap) out1c(psh, ' '); } if (! nflag) out1c(psh, '\n'); return 0; } kbuild-3608/src/kash/bltin/test.c0000664000175000017500000002251214670377416016677 0ustar locutuslocutus/* $NetBSD: test.c,v 1.26 2005/02/10 06:56:55 simonb Exp $ */ /* * test(1); version 7-like -- author Erik Baalbergen * modified by Eric Gisin to be used as built-in. * modified by Arnold Robbins to add SVR3 compatibility * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket). * modified by J.T. Conklin for NetBSD. * * This program is in the Public Domain. */ #if 0 #ifndef lint __RCSID("$NetBSD: test.c,v 1.26 2005/02/10 06:56:55 simonb Exp $"); #endif #endif #include #include #include #include #include #include #include #include "shell.h" #include "error.h" #include "shinstance.h" /* test(1) accepts the following grammar: oexpr ::= aexpr | aexpr "-o" oexpr ; aexpr ::= nexpr | nexpr "-a" aexpr ; nexpr ::= primary | "!" primary primary ::= unary-operator operand | operand binary-operator operand | operand | "(" oexpr ")" ; unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"| "-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S"; binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"| "-nt"|"-ot"|"-ef"; operand ::= */ enum token { EOI, FILRD, FILWR, FILEX, FILEXIST, FILREG, FILDIR, FILCDEV, FILBDEV, FILFIFO, FILSOCK, FILSYM, FILGZ, FILTT, FILSUID, FILSGID, FILSTCK, FILNT, FILOT, FILEQ, FILUID, FILGID, STREZ, STRNZ, STREQ, STRNE, STRLT, STRGT, INTEQ, INTNE, INTGE, INTGT, INTLE, INTLT, UNOT, BAND, BOR, LPAREN, RPAREN, OPERAND }; enum token_types { UNOP, BINOP, BUNOP, BBINOP, PAREN }; static struct t_op { const char *op_text; short op_num, op_type; } const ops [] = { {"-r", FILRD, UNOP}, {"-w", FILWR, UNOP}, {"-x", FILEX, UNOP}, {"-e", FILEXIST,UNOP}, {"-f", FILREG, UNOP}, {"-d", FILDIR, UNOP}, {"-c", FILCDEV,UNOP}, {"-b", FILBDEV,UNOP}, {"-p", FILFIFO,UNOP}, {"-u", FILSUID,UNOP}, {"-g", FILSGID,UNOP}, {"-k", FILSTCK,UNOP}, {"-s", FILGZ, UNOP}, {"-t", FILTT, UNOP}, {"-z", STREZ, UNOP}, {"-n", STRNZ, UNOP}, {"-h", FILSYM, UNOP}, /* for backwards compat */ {"-O", FILUID, UNOP}, {"-G", FILGID, UNOP}, {"-L", FILSYM, UNOP}, {"-S", FILSOCK,UNOP}, {"=", STREQ, BINOP}, {"!=", STRNE, BINOP}, {"<", STRLT, BINOP}, {">", STRGT, BINOP}, {"-eq", INTEQ, BINOP}, {"-ne", INTNE, BINOP}, {"-ge", INTGE, BINOP}, {"-gt", INTGT, BINOP}, {"-le", INTLE, BINOP}, {"-lt", INTLT, BINOP}, {"-nt", FILNT, BINOP}, {"-ot", FILOT, BINOP}, {"-ef", FILEQ, BINOP}, {"!", UNOT, BUNOP}, {"-a", BAND, BBINOP}, {"-o", BOR, BBINOP}, {"(", LPAREN, PAREN}, {")", RPAREN, PAREN}, {0, 0, 0} }; //static char **t_wp; //static struct t_op const *t_wp_op; static void syntax(shinstance *, const char *, const char *); static int oexpr(shinstance *, enum token); static int aexpr(shinstance *, enum token); static int nexpr(shinstance *, enum token); static int primary(shinstance *, enum token); static int binop(shinstance *); static int filstat(shinstance *, char *, enum token); static enum token t_lex(shinstance *, char *); static int isoperand(shinstance *); static int getn(shinstance *, const char *); static int newerf(shinstance *, const char *, const char *); static int olderf(shinstance *, const char *, const char *); static int equalf(shinstance *, const char *, const char *); int testcmd(shinstance *psh, int argc, char **argv) { int res; if (strcmp(argv[0], "[") == 0) { if (strcmp(argv[--argc], "]")) error(psh, "missing ]"); argv[argc] = NULL; } if (argc < 2) return 1; psh->t_wp_op = NULL; psh->t_wp = &argv[1]; res = !oexpr(psh, t_lex(psh, *psh->t_wp)); if (*psh->t_wp != NULL && *++psh->t_wp != NULL) syntax(psh, *psh->t_wp, "unexpected operator"); return res; } static void syntax(shinstance *psh, const char *op, const char *msg) { if (op && *op) error(psh, "%s: %s", op, msg); else error(psh, "%s", msg); } static int oexpr(shinstance *psh, enum token n) { int res; res = aexpr(psh, n); if (t_lex(psh, *++psh->t_wp) == BOR) return oexpr(psh, t_lex(psh, *++psh->t_wp)) || res; psh->t_wp--; return res; } static int aexpr(shinstance *psh, enum token n) { int res; res = nexpr(psh, n); if (t_lex(psh, *++psh->t_wp) == BAND) return aexpr(psh, t_lex(psh, *++psh->t_wp)) && res; psh->t_wp--; return res; } static int nexpr(shinstance *psh, enum token n) { if (n == UNOT) return !nexpr(psh, t_lex(psh, *++psh->t_wp)); return primary(psh, n); } static int primary(shinstance *psh, enum token n) { enum token nn; int res; if (n == EOI) return 0; /* missing expression */ if (n == LPAREN) { if ((nn = t_lex(psh, *++psh->t_wp)) == RPAREN) return 0; /* missing expression */ res = oexpr(psh, nn); if (t_lex(psh, *++psh->t_wp) != RPAREN) syntax(psh, NULL, "closing paren expected"); return res; } if (psh->t_wp_op && psh->t_wp_op->op_type == UNOP) { /* unary expression */ if (*++psh->t_wp == NULL) syntax(psh, psh->t_wp_op->op_text, "argument expected"); switch (n) { case STREZ: return strlen(*psh->t_wp) == 0; case STRNZ: return strlen(*psh->t_wp) != 0; case FILTT: return shfile_isatty(&psh->fdtab, getn(psh, *psh->t_wp)); default: return filstat(psh, *psh->t_wp, n); } } if (t_lex(psh, psh->t_wp[1]), psh->t_wp_op && psh->t_wp_op->op_type == BINOP) { return binop(psh); } return strlen(*psh->t_wp) > 0; } static int binop(shinstance *psh) { const char *opnd1, *opnd2; struct t_op const *op; opnd1 = *psh->t_wp; (void) t_lex(psh, *++psh->t_wp); op = psh->t_wp_op; if ((opnd2 = *++psh->t_wp) == NULL) syntax(psh, op->op_text, "argument expected"); switch (op->op_num) { case STREQ: return strcmp(opnd1, opnd2) == 0; case STRNE: return strcmp(opnd1, opnd2) != 0; case STRLT: return strcmp(opnd1, opnd2) < 0; case STRGT: return strcmp(opnd1, opnd2) > 0; case INTEQ: return getn(psh, opnd1) == getn(psh, opnd2); case INTNE: return getn(psh, opnd1) != getn(psh, opnd2); case INTGE: return getn(psh, opnd1) >= getn(psh, opnd2); case INTGT: return getn(psh, opnd1) > getn(psh, opnd2); case INTLE: return getn(psh, opnd1) <= getn(psh, opnd2); case INTLT: return getn(psh, opnd1) < getn(psh, opnd2); case FILNT: return newerf(psh, opnd1, opnd2); case FILOT: return olderf(psh, opnd1, opnd2); case FILEQ: return equalf(psh, opnd1, opnd2); default: sh_abort(psh); /* NOTREACHED */ return -1; } } static int filstat(shinstance *psh, char *nm, enum token mode) { struct stat s; if (mode == FILSYM ? shfile_lstat(&psh->fdtab, nm, &s) : shfile_stat(&psh->fdtab, nm, &s)) return 0; switch (mode) { case FILRD: return shfile_access(&psh->fdtab, nm, R_OK) == 0; case FILWR: return shfile_access(&psh->fdtab, nm, W_OK) == 0; case FILEX: return shfile_access(&psh->fdtab, nm, X_OK) == 0; case FILEXIST: return shfile_access(&psh->fdtab, nm, F_OK) == 0; case FILREG: return S_ISREG(s.st_mode); case FILDIR: return S_ISDIR(s.st_mode); case FILCDEV: #ifdef S_ISCHR return S_ISCHR(s.st_mode); #else return 0; #endif case FILBDEV: #ifdef S_ISBLK return S_ISBLK(s.st_mode); #else return 0; #endif case FILFIFO: #ifdef S_ISFIFO return S_ISFIFO(s.st_mode); #else return 0; #endif case FILSOCK: #ifdef S_ISSOCK return S_ISSOCK(s.st_mode); #else return 0; #endif case FILSYM: return S_ISLNK(s.st_mode); case FILSUID: return (s.st_mode & S_ISUID) != 0; case FILSGID: return (s.st_mode & S_ISGID) != 0; case FILSTCK: #ifdef S_ISVTX return (s.st_mode & S_ISVTX) != 0; #else return 0; #endif case FILGZ: return s.st_size > (off_t)0; case FILUID: return s.st_uid == sh_geteuid(psh); case FILGID: return s.st_gid == sh_getegid(psh); default: return 1; } } static enum token t_lex(shinstance *psh, char *s) { struct t_op const *op; op = ops; if (s == 0) { psh->t_wp_op = NULL; return EOI; } while (op->op_text) { if (strcmp(s, op->op_text) == 0) { if ((op->op_type == UNOP && isoperand(psh)) || (op->op_num == LPAREN && *(psh->t_wp+1) == 0)) break; psh->t_wp_op = op; return op->op_num; } op++; } psh->t_wp_op = NULL; return OPERAND; } static int isoperand(shinstance *psh) { struct t_op const *op; char *s, *t; op = ops; if ((s = *(psh->t_wp+1)) == 0) return 1; if ((t = *(psh->t_wp+2)) == 0) return 0; while (op->op_text) { if (strcmp(s, op->op_text) == 0) return op->op_type == BINOP && (t[0] != ')' || t[1] != '\0'); op++; } return 0; } /* atoi with error detection */ static int getn(shinstance *psh, const char *s) { char *p; long r; errno = 0; r = strtol(s, &p, 10); if (errno != 0) error(psh, "%s: out of range", s); while (isspace((unsigned char)*p)) p++; if (*p) error(psh, "%s: bad number", s); return (int) r; } static int newerf(shinstance *psh, const char *f1, const char *f2) { struct stat b1, b2; return (shfile_stat(&psh->fdtab, f1, &b1) == 0 && shfile_stat(&psh->fdtab, f2, &b2) == 0 && b1.st_mtime > b2.st_mtime); } static int olderf(shinstance *psh, const char *f1, const char *f2) { struct stat b1, b2; return (shfile_stat(&psh->fdtab, f1, &b1) == 0 && shfile_stat(&psh->fdtab, f2, &b2) == 0 && b1.st_mtime < b2.st_mtime); } static int equalf(shinstance *psh, const char *f1, const char *f2) { struct stat b1, b2; return (shfile_stat(&psh->fdtab, f1, &b1) == 0 && shfile_stat(&psh->fdtab, f2, &b2) == 0 && b1.st_dev == b2.st_dev && b1.st_ino == b2.st_ino); } kbuild-3608/src/kash/bltin/echo.10000664000175000017500000000675714670377416016571 0ustar locutuslocutus.\" $NetBSD: echo.1,v 1.13 2003/08/07 09:05:40 agc Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Kenneth Almquist. .\" Copyright 1989 by Kenneth Almquist .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)echo.1 8.1 (Berkeley) 5/31/93 .\" .Dd May 31, 1993 .Dt ECHO 1 .Os .Sh NAME .Nm echo .Nd produce message in a shell script .Sh SYNOPSIS .Nm .Op Fl n | Fl e .Ar args ... .Sh DESCRIPTION .Nm prints its arguments on the standard output, separated by spaces. Unless the .Fl n option is present, a newline is output following the arguments. The .Fl e option causes .Nm to treat the escape sequences specially, as described in the following paragraph. The .Fl e option is the default, and is provided solely for compatibility with other systems. Only one of the options .Fl n and .Fl e may be given. .Pp If any of the following sequences of characters is encountered during output, the sequence is not output. Instead, the specified action is performed: .Bl -tag -width indent .It Li \eb A backspace character is output. .It Li \ec Subsequent output is suppressed. This is normally used at the end of the last argument to suppress the trailing newline that .Nm would otherwise output. .It Li \ef Output a form feed. .It Li \en Output a newline character. .It Li \er Output a carriage return. .It Li \et Output a (horizontal) tab character. .It Li \ev Output a vertical tab. .It Li \e0 Ns Ar digits Output the character whose value is given by zero to three digits. If there are zero digits, a nul character is output. .It Li \e\e Output a backslash. .El .Sh HINTS Remember that backslash is special to the shell and needs to be escaped. To output a message to standard error, say .Pp .D1 echo message \*[Gt]\*[Am]2 .Sh BUGS The octal character escape mechanism .Pq Li \e0 Ns Ar digits differs from the C language mechanism. .Pp There is no way to force .Nm to treat its arguments literally, rather than interpreting them as options and escape sequences. kbuild-3608/src/kash/bltin/kill.c0000664000175000017500000001412114670377416016650 0ustar locutuslocutus/* $NetBSD: kill.c,v 1.23 2003/08/07 09:05:13 agc Exp $ */ /* * Copyright (c) 1988, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #if !defined(lint) && !defined(SHELL) __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint static char sccsid[] = "@(#)kill.c 8.4 (Berkeley) 4/28/95"; #else __RCSID("$NetBSD: kill.c,v 1.23 2003/08/07 09:05:13 agc Exp $"); #endif /* not lint */ #endif #include #include #include #include #include #include "shtypes.h" #include "jobs.h" #include "error.h" #include "shinstance.h" static int nosig(shinstance *, char *); static void printsignals(shinstance *, struct output *); static int signame_to_signum(char *); static int usage(shinstance *psh); int killcmd(shinstance *psh, int argc, char *argv[]) { int errors, numsig; char *ep; if (argc < 2) return usage(psh); numsig = SIGTERM; argc--, argv++; if (strcmp(*argv, "-l") == 0) { argc--, argv++; if (argc > 1) return usage(psh); if (argc == 1) { if (isdigit((unsigned char)**argv) == 0) return usage(psh); numsig = strtol(*argv, &ep, 10); if (*ep != '\0') { sh_errx(psh, EXIT_FAILURE, "illegal signal number: %s", *argv); /* NOTREACHED */ } if (numsig >= 128) numsig -= 128; if (numsig <= 0 || numsig >= NSIG) return nosig(psh, *argv); outfmt(psh->out1, "%s\n", sys_signame[numsig]); //sh_exit(psh, 0); return 0; } printsignals(psh, psh->out1); //sh_exit(psh, 0); return 0; } if (!strcmp(*argv, "-s")) { argc--, argv++; if (argc < 1) { sh_warnx(psh, "option requires an argument -- s"); return usage(psh); } if (strcmp(*argv, "0")) { if ((numsig = signame_to_signum(*argv)) < 0) return nosig(psh, *argv); } else numsig = 0; argc--, argv++; } else if (**argv == '-') { ++*argv; if (isalpha((unsigned char)**argv)) { if ((numsig = signame_to_signum(*argv)) < 0) return nosig(psh, *argv); } else if (isdigit((unsigned char)**argv)) { numsig = strtol(*argv, &ep, 10); if (!*argv || *ep) { sh_errx(psh, EXIT_FAILURE, "illegal signal number: %s", *argv); /* NOTREACHED */ } if (numsig < 0 || numsig >= NSIG) return nosig(psh, *argv); } else return nosig(psh, *argv); argc--, argv++; } if (argc == 0) return usage(psh); for (errors = 0; argc; argc--, argv++) { const char * const strpid = argv[0]; shpid pid; if (*strpid == '%') { pid = getjobpgrp(psh, strpid); if (pid == 0) { sh_warnx(psh, "illegal job id: %s", strpid); errors = 1; continue; } } else { #if !defined(SH_FORKED_MODE) && defined(_MSC_VER) pid = _strtoi64(strpid, &ep, 10); #elif !defined(SH_FORKED_MODE) pid = strtoll(strpid, &ep, 10); #else pid = strtol(strpid, &ep, 10); #endif if (!*strpid || *ep) { sh_warnx(psh, "illegal process id: %s", strpid); errors = 1; continue; } } if (sh_kill(psh, pid, numsig) == -1) { sh_warn(psh, "%s", strpid); errors = 1; } /* Wakeup the process if it was suspended, so it can exit without an explicit 'fg'. */ if (numsig == SIGTERM || numsig == SIGHUP) sh_kill(psh, pid, SIGCONT); } //sh_exit(psh, errors); ///* NOTREACHED */ return errors; } static int signame_to_signum(char *sig) { int n; if (strncasecmp(sig, "sig", 3) == 0) sig += 3; for (n = 1; n < NSIG; n++) { if (!strcasecmp(sys_signame[n], sig)) return (n); } return (-1); } static int nosig(shinstance *psh, char *name) { sh_warnx(psh, "unknown signal %s; valid signals:", name); printsignals(psh, psh->out2); //sh_exit(psh, 1); ///* NOTREACHED */ return 1; } static void printsignals(shinstance *psh, struct output *out) { int sig; size_t len, nl; const char *name; unsigned termwidth = 80; if (shfile_isatty(&psh->fdtab, out->fd)) { sh_winsize win; if (shfile_ioctl(&psh->fdtab, out->fd, TIOCGWINSZ, &win) == 0 && win.ws_col > 0) termwidth = win.ws_col; } for (len = 0, sig = 1; sig < NSIG; sig++) { name = sys_signame[sig]; nl = 1 + strlen(name); if (len + nl >= termwidth) { outfmt(out, "\n"); len = 0; } else if (len != 0) outfmt(out, " "); len += nl; outfmt(out, "%s", name); } if (len != 0) outfmt(out, "\n"); } static int usage(shinstance *psh) { outfmt(psh->out2, "usage: %s [-s signal_name] pid ...\n" " %s -l [exit_status]\n" " %s -signal_name pid ...\n" " %s -signal_number pid ...\n", psh->commandname, psh->commandname, psh->commandname, psh->commandname); //sh_exit(psh, 1); ///* NOTREACHED */ return 1; } kbuild-3608/src/kash/trap.c0000664000175000017500000002302114670377416015552 0ustar locutuslocutus/* $NetBSD: trap.c,v 1.31 2005/01/11 19:38:57 christos Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95"; #else __RCSID("$NetBSD: trap.c,v 1.31 2005/01/11 19:38:57 christos Exp $"); #endif /* not lint */ #endif #include #include "shell.h" #include "main.h" #include "nodes.h" /* for other headers */ #include "eval.h" #include "jobs.h" #include "show.h" #include "options.h" #include "syntax.h" #include "output.h" #include "memalloc.h" #include "error.h" #include "trap.h" #include "mystring.h" #include "var.h" #include "shinstance.h" /* * Sigmode records the current value of the signal handlers for the various * modes. A value of zero means that the current handler is not known. * S_HARD_IGN indicates that the signal was ignored on entry to the shell, */ #define S_DFL 1 /* default signal handling (SIG_DFL) */ #define S_CATCH 2 /* signal is caught */ #define S_IGN 3 /* signal is ignored (SIG_IGN) */ #define S_HARD_IGN 4 /* signal is ignored permenantly */ #define S_RESET 5 /* temporary - to reset a hard ignored sig */ //char *trap[NSIG+1]; /* trap handler commands */ //MKINIT char sigmode[NSIG]; /* current value of signal */ //char gotsig[NSIG]; /* indicates specified signal received */ //int pendingsigs; /* indicates some signal received */ static int getsigaction(shinstance *, int, shsig_t *); #ifndef SH_FORKED_MODE void subshellinittrap(shinstance *psh, shinstance *inherit) { /* The forkchild calls clear_traps(), we have to emulate that here. */ unsigned i; memcpy(psh->sigmode, inherit->sigmode, sizeof(psh->sigmode)); for (i = 0; i < K_ELEMENTS(inherit->trap); i++) { const char *src = inherit->trap[i]; if (!src) { } else if (i > 0) { setsignal(psh, i); } } } #endif /* * return the signal number described by `p' (as a number or a name) * or -1 if it isn't one */ static int signame_to_signum(shinstance *psh, const char *p) { int i; if (is_number(p)) return number(psh, p); if (strcasecmp(p, "exit") == 0 ) return 0; if (strncasecmp(p, "sig", 3) == 0) p += 3; for (i = 0; i < NSIG; ++i) if (strcasecmp(p, sys_signame[i]) == 0) return i; return -1; } /* * Print a list of valid signal names */ static void printsignals(shinstance *psh) { int n; out1str(psh, "EXIT "); for (n = 1; n < NSIG; n++) { out1fmt(psh, "%s", sys_signame[n]); if ((n == NSIG/2) || n == (NSIG - 1)) out1str(psh, "\n"); else out1c(psh, ' '); } } /* * The trap builtin. */ int trapcmd(shinstance *psh, int argc, char **argv) { char *action; char **ap; int signo; if (argc <= 1) { for (signo = 0 ; signo <= NSIG ; signo++) if (psh->trap[signo] != NULL) { out1fmt(psh, "trap -- "); print_quoted(psh, psh->trap[signo]); out1fmt(psh, " %s\n", (signo) ? sys_signame[signo] : "EXIT"); } return 0; } ap = argv + 1; action = NULL; if (strcmp(*ap, "--") == 0) if (*++ap == NULL) return 0; if (signame_to_signum(psh, *ap) == -1) { if ((*ap)[0] == '-') { if ((*ap)[1] == '\0') ap++; else if ((*ap)[1] == 'l' && (*ap)[2] == '\0') { printsignals(psh); return 0; } else error(psh, "bad option %s\n", *ap); } else action = *ap++; } while (*ap) { if (is_number(*ap)) signo = number(psh, *ap); else signo = signame_to_signum(psh, *ap); if (signo < 0 || signo > NSIG) error(psh, "%s: bad trap", *ap); INTOFF; if (action) action = savestr(psh, action); if (psh->trap[signo]) ckfree(psh, psh->trap[signo]); psh->trap[signo] = action; if (signo != 0) setsignal(psh, signo); INTON; ap++; } return 0; } /* * Clear traps on a fork or vfork. * Takes one arg vfork, to tell it to not be destructive of * the parents variables. */ void clear_traps(shinstance *psh) { char **tp; for (tp = psh->trap ; tp <= &psh->trap[NSIG] ; tp++) { if (*tp && **tp) { /* trap not NULL or SIG_IGN */ INTOFF; ckfree(psh, *tp); *tp = NULL; if (tp != &psh->trap[0]) setsignal(psh, (int)(tp - psh->trap)); INTON; } } } /* * Set the signal handler for the specified signal. The routine figures * out what it should be set to. */ void setsignal(shinstance *psh, int signo) { int action; shsig_t sigact = SH_SIG_DFL; char *t, tsig; if ((t = psh->trap[signo]) == NULL) action = S_DFL; else if (*t != '\0') action = S_CATCH; else action = S_IGN; if (psh->rootshell && action == S_DFL) { switch (signo) { case SIGINT: if (iflag(psh) || psh->minusc || sflag(psh) == 0) action = S_CATCH; break; case SIGQUIT: #ifdef DEBUG if (debug(psh)) break; #endif /* FALLTHROUGH */ case SIGTERM: if (iflag(psh)) action = S_IGN; break; #if JOBS case SIGTSTP: case SIGTTOU: if (mflag(psh)) action = S_IGN; break; #endif } } t = &psh->sigmode[signo - 1]; tsig = *t; if (tsig == 0) { /* * current setting unknown */ if (!getsigaction(psh, signo, &sigact)) { /* * Pretend it worked; maybe we should give a warning * here, but other shells don't. We don't alter * sigmode, so that we retry every time. */ return; } if (sigact == SH_SIG_IGN) { if (mflag(psh) && (signo == SIGTSTP || signo == SIGTTIN || signo == SIGTTOU)) { tsig = S_IGN; /* don't hard ignore these */ } else tsig = S_HARD_IGN; } else { tsig = S_RESET; /* force to be set */ } } if (tsig == S_HARD_IGN || tsig == action) return; switch (action) { case S_DFL: sigact = SH_SIG_DFL; break; case S_CATCH: sigact = onsig; break; case S_IGN: sigact = SH_SIG_IGN; break; } *t = action; sh_siginterrupt(psh, signo, 1); sh_signal(psh, signo, sigact); } /* * Return the current setting for sig w/o changing it. */ static int getsigaction(shinstance *psh, int signo, shsig_t *sigact) { struct shsigaction sa; if (sh_sigaction(psh, signo, NULL, &sa) == -1) return 0; *sigact = (shsig_t)sa.sh_handler; return 1; } /* * Ignore a signal. */ void ignoresig(shinstance *psh, int signo) { if (psh->sigmode[signo - 1] != S_IGN && psh->sigmode[signo - 1] != S_HARD_IGN) { sh_signal(psh, signo, SH_SIG_IGN); } psh->sigmode[signo - 1] = S_HARD_IGN; } #ifdef mkinit INCLUDE INCLUDE "trap.h" SHELLPROC { char *sm; clear_traps(psh); for (sm = psh->sigmode ; sm < psh->sigmode + NSIG ; sm++) { if (*sm == S_IGN) *sm = S_HARD_IGN; } } #endif /* * Signal handler. */ void onsig(shinstance *psh, int signo) { sh_signal(psh, signo, onsig); if (signo == SIGINT && psh->trap[SIGINT] == NULL) { onint(psh); return; } psh->gotsig[signo - 1] = 1; psh->pendingsigs++; } /* * Called to execute a trap. Perhaps we should avoid entering new trap * handlers while we are executing a trap handler. */ void dotrap(shinstance *psh) { int i; int savestatus; for (;;) { for (i = 1 ; ; i++) { if (psh->gotsig[i - 1]) break; if (i >= NSIG) goto done; } psh->gotsig[i - 1] = 0; savestatus=psh->exitstatus; evalstring(psh, psh->trap[i], 0); psh->exitstatus=savestatus; } done: psh->pendingsigs = 0; } /* * Controls whether the shell is interactive or not. */ void setinteractive(shinstance *psh, int on) { static int is_interactive; if (on == is_interactive) return; setsignal(psh, SIGINT); setsignal(psh, SIGQUIT); setsignal(psh, SIGTERM); is_interactive = on; } /* * Called to exit the shell. */ int exitshell2(shinstance *psh, int status) { struct jmploc loc1, loc2; char *p; TRACE((psh, "pid %" SHPID_PRI ", exitshell(%d)\n", sh_getpid(psh), status)); if (setjmp(loc1.loc)) { goto l1; } if (setjmp(loc2.loc)) { goto l2; } psh->handler = &loc1; if ((p = psh->trap[0]) != NULL && *p != '\0') { psh->trap[0] = NULL; evalstring(psh, p, 0); } l1: psh->handler = &loc2; /* probably unnecessary */ output_flushall(psh); #if JOBS setjobctl(psh, 0); #endif l2: return status; } SH_NORETURN_1 void exitshell(shinstance *psh, int status) { sh__exit(psh, exitshell2(psh, status)); /* NOTREACHED */ } kbuild-3608/src/kash/main.c0000664000175000017500000002632214670377416015537 0ustar locutuslocutus/* $NetBSD: main.c,v 1.48 2003/09/14 12:09:29 jmmv Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if 0 #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\ The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint static char sccsid[] = "@(#)main.c 8.7 (Berkeley) 7/19/95"; #else __RCSID("$NetBSD: main.c,v 1.48 2003/09/14 12:09:29 jmmv Exp $"); #endif /* not lint */ #endif #include #include #include #include #include "shell.h" #include "main.h" #include "mail.h" #include "options.h" #include "output.h" #include "parser.h" #include "nodes.h" #include "expand.h" #include "eval.h" #include "jobs.h" #include "input.h" #include "trap.h" #include "var.h" #include "show.h" #include "memalloc.h" #include "error.h" #include "init.h" #include "mystring.h" #include "exec.h" #include "cd.h" #include "shinstance.h" #define PROFILE 0 /*int rootpid; int rootshell;*/ #ifdef unused_variables STATIC union node *curcmd; STATIC union node *prevcmd; #endif STATIC void read_profile(struct shinstance *, const char *); STATIC char *find_dot_file(struct shinstance *, char *); int main(int, char **, char **); SH_NORETURN_1 void shell_main(shinstance *, int, char **) SH_NORETURN_2; #ifdef _MSC_VER extern void init_syntax(void); #endif STATIC int usage(const char *argv0); STATIC int version(const char *argv0); /* * Main routine. We initialize things, parse the arguments, execute * profiles if we're a login shell, and then call cmdloop to execute * commands. The setjmp call sets up the location to jump to when an * exception occurs. When an exception occurs the variable "state" * is used to figure out how far we had gotten. */ int #if K_OS == K_OS_WINDOWS && defined(SH_FORKED_MODE) real_main(int argc, char **argv, char **envp) #else main(int argc, char **argv, char **envp) #endif { shinstance *psh; /* * Global initializations. */ setlocale(LC_ALL, ""); #ifdef _MSC_VER init_syntax(); #endif /* * Check for --version and --help. */ if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '-') { if (!strcmp(argv[1], "--help")) return usage(argv[0]); if (!strcmp(argv[1], "--version")) return version(argv[0]); } /* * Create the root shell instance. */ psh = sh_create_root_shell(argv, envp); if (!psh) return 2; shthread_set_shell(psh); shell_main(psh, argc, psh->orgargv); /* Not reached. */ return 89; } SH_NORETURN_1 void shell_main(shinstance *psh, int argc, char **argv) { struct jmploc jmploc; struct stackmark smark; volatile int state; char *shinit; state = 0; if (setjmp(jmploc.loc)) { /* * When a shell procedure is executed, we raise the * exception EXSHELLPROC to clean up before executing * the shell procedure. */ switch (psh->exception) { case EXSHELLPROC: psh->rootpid = /*getpid()*/ psh->pid; psh->rootshell = 1; psh->minusc = NULL; state = 3; break; case EXEXEC: psh->exitstatus = psh->exerrno; break; case EXERROR: psh->exitstatus = 2; break; default: break; } if (psh->exception != EXSHELLPROC) { if (state == 0 || iflag(psh) == 0 || ! psh->rootshell) exitshell(psh, psh->exitstatus); } reset(psh); if (psh->exception == EXINT #if ATTY && (! attyset(psh) || equal(termval(psh), "emacs")) #endif ) { out2c(psh, '\n'); flushout(&psh->errout); } popstackmark(psh, &smark); FORCEINTON; /* enable interrupts */ if (state == 1) goto state1; else if (state == 2) goto state2; else if (state == 3) goto state3; else goto state4; } psh->handler = &jmploc; psh->rootpid = /*getpid()*/ psh->pid; psh->rootshell = 1; #ifdef DEBUG #if DEBUG == 2 debug(psh) = 1; #endif opentrace(psh); trputs(psh, "Shell args: "); trargs(psh, argv); #endif init(psh); setstackmark(psh, &smark); procargs(psh, argc, argv); if (argv[0] && argv[0][0] == '-') { state = 1; read_profile(psh, "/etc/profile"); state1: state = 2; read_profile(psh, ".profile"); } state2: state = 3; if (sh_getuid(psh) == sh_geteuid(psh) && sh_getgid(psh) == sh_getegid(psh)) { if ((shinit = lookupvar(psh, "ENV")) != NULL && *shinit != '\0') { state = 3; read_profile(psh, shinit); } } state3: state = 4; if (sflag(psh) == 0 || psh->minusc) { static int sigs[] = { SIGINT, SIGQUIT, SIGHUP, #ifdef SIGTSTP SIGTSTP, #endif SIGPIPE }; #define SIGSSIZE (sizeof(sigs)/sizeof(sigs[0])) unsigned i; for (i = 0; i < SIGSSIZE; i++) setsignal(psh, sigs[i]); } if (psh->minusc) evalstring(psh, psh->minusc, 0); if (sflag(psh) || psh->minusc == NULL) { state4: /* XXX ??? - why isn't this before the "if" statement */ cmdloop(psh, 1); } exitshell(psh, psh->exitstatus); /* NOTREACHED */ } /* * Read and execute commands. "Top" is nonzero for the top level command * loop; it turns on prompting if the shell is interactive. */ void cmdloop(struct shinstance *psh, int top) { union node *n; struct stackmark smark; int inter; int numeof = 0; TRACE((psh, "cmdloop(%d) called\n", top)); setstackmark(psh, &smark); for (;;) { if (psh->pendingsigs) dotrap(psh); inter = 0; if (iflag(psh) && top) { inter = 1; showjobs(psh, psh->out2, SHOW_CHANGED); chkmail(psh, 0); flushout(&psh->errout); } n = parsecmd(psh, inter); /* showtree(n); DEBUG */ if (n == NEOF) { if (!top || numeof >= 50) break; if (!stoppedjobs(psh)) { if (!Iflag(psh)) break; out2str(psh, "\nUse \"exit\" to leave shell.\n"); } numeof++; } else if (n != NULL && nflag(psh) == 0) { psh->job_warning = (psh->job_warning == 2) ? 1 : 0; numeof = 0; evaltree(psh, n, 0); } popstackmark(psh, &smark); setstackmark(psh, &smark); if (psh->evalskip == SKIPFILE) { psh->evalskip = 0; break; } } popstackmark(psh, &smark); } /* * Read /etc/profile or .profile. Return on error. */ STATIC void read_profile(struct shinstance *psh, const char *name) { int fd; int xflag_set = 0; int vflag_set = 0; INTOFF; if ((fd = shfile_open(&psh->fdtab, name, O_RDONLY, 0)) >= 0) setinputfd(psh, fd, 1); INTON; if (fd < 0) return; /* -q turns off -x and -v just when executing init files */ if (qflag(psh)) { if (xflag(psh)) xflag(psh) = 0, xflag_set = 1; if (vflag(psh)) vflag(psh) = 0, vflag_set = 1; } cmdloop(psh, 0); if (qflag(psh)) { if (xflag_set) xflag(psh) = 1; if (vflag_set) vflag(psh) = 1; } popfile(psh); } /* * Read a file containing shell functions. */ void readcmdfile(struct shinstance *psh, char *name) { int fd; INTOFF; if ((fd = shfile_open(&psh->fdtab, name, O_RDONLY, 0)) >= 0) setinputfd(psh, fd, 1); else error(psh, "Can't open %s", name); INTON; cmdloop(psh, 0); popfile(psh); } /* * Take commands from a file. To be compatible we should do a path * search for the file, which is necessary to find sub-commands. */ STATIC char * find_dot_file(struct shinstance *psh, char *basename) { char *fullname; const char *path = pathval(psh); /* don't try this for absolute or relative paths */ if (strchr(basename, '/')) return basename; while ((fullname = padvance(psh, &path, basename)) != NULL) { if (shfile_stat_isreg(&psh->fdtab, fullname) > 0) { /* * Don't bother freeing here, since it will * be freed by the caller. */ return fullname; } stunalloc(psh, fullname); } /* not found in the PATH */ error(psh, "%s: not found", basename); /* NOTREACHED */ return NULL; } int dotcmd(struct shinstance *psh, int argc, char **argv) { psh->exitstatus = 0; if (argc >= 2) { /* That's what SVR2 does */ char * const savedcommandname = psh->commandname; int const savedcommandnamemalloc = psh->commandnamemalloc; char *fullname; struct stackmark smark; setstackmark(psh, &smark); fullname = find_dot_file(psh, argv[1]); setinputfile(psh, fullname, 1); psh->commandname = fullname; psh->commandnamemalloc = 0; cmdloop(psh, 0); popfile(psh); psh->commandname = savedcommandname; psh->commandnamemalloc = savedcommandnamemalloc; popstackmark(psh, &smark); } return psh->exitstatus; } int exitcmd(struct shinstance *psh, int argc, char **argv) { if (stoppedjobs(psh)) return 0; if (argc > 1) psh->exitstatus = number(psh, argv[1]); exitshell(psh, psh->exitstatus); /* NOTREACHED */ return 1; } STATIC const char * strip_argv0(const char *argv0, unsigned *lenp) { const char *tmp; /* skip the path */ for (tmp = strpbrk(argv0, "\\/:"); tmp; tmp = strpbrk(argv0, "\\/:")) argv0 = tmp + 1; /* find the end, ignoring extenions */ tmp = strrchr(argv0, '.'); if (!tmp) tmp = strchr(argv0, '\0'); *lenp = (unsigned)(tmp - argv0); return argv0; } STATIC int usage(const char *argv0) { unsigned len; argv0 = strip_argv0(argv0, &len); fprintf(stdout, "usage: %.*s [-aCefnuvxIimqVEb] [+aCefnuvxIimqVEb] [-o option_name]\n" " [+o option_name] [command_file [argument ...]]\n" " or: %.*s -c [-aCefnuvxIimqVEb] [+aCefnuvxIimqVEb] [-o option_name]\n" " [+o option_name] command_string [command_name [argument ...]]\n" " or: %.*s -s [-aCefnuvxIimqVEb] [+aCefnuvxIimqVEb] [-o option_name]\n" " [+o option_name] [argument ...]\n" " or: %.*s --help\n" " or: %.*s --version\n", len, argv0, len, argv0, len, argv0, len, argv0, len, argv0); return 0; } STATIC int version(const char *argv0) { unsigned len; strip_argv0(argv0, &len); fprintf(stdout, "%.*s - kBuild version %d.%d.%d (r%u)\n", len, argv0, KBUILD_VERSION_MAJOR, KBUILD_VERSION_MINOR, KBUILD_VERSION_PATCH, KBUILD_SVN_REV); return 0; } /* * Local Variables: * c-file-style: bsd * End: */ kbuild-3608/src/kash/syntax.h0000664000175000017500000000740114670377416016143 0ustar locutuslocutus/* $NetBSD: syntax.h,v 1.2 2004/01/17 17:38:12 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include /* Syntax classes */ #define CWORD 0 /* character is nothing special */ #define CNL 1 /* newline character */ #define CBACK 2 /* a backslash character */ #define CSQUOTE 3 /* single quote */ #define CDQUOTE 4 /* double quote */ #define CBQUOTE 5 /* backwards single quote */ #define CVAR 6 /* a dollar sign */ #define CENDVAR 7 /* a '}' character */ #define CLP 8 /* a left paren in arithmetic */ #define CRP 9 /* a right paren in arithmetic */ #define CSHEOF 10 /* end of file */ #define CCTL 11 /* like CWORD, except it must be escaped */ #define CSPCL 12 /* these terminate a word */ /* Syntax classes for is_ functions */ #define ISDIGIT 01 /* a digit */ #define ISUPPER 02 /* an upper case letter */ #define ISLOWER 04 /* a lower case letter */ #define ISUNDER 010 /* an underscore */ #define ISSPECL 020 /* the name of a special parameter */ #define PEOF (CHAR_MIN - 1) #define SYNBASE (-PEOF) /* XXX UPEOF is CHAR_MAX, so is a valid 'char' value... */ #define UPEOF ((char)PEOF) #define BASESYNTAX (basesyntax + SYNBASE) #define DQSYNTAX (dqsyntax + SYNBASE) #define SQSYNTAX (sqsyntax + SYNBASE) #define ARISYNTAX (arisyntax + SYNBASE) /* These defines assume that the digits are contiguous */ #define is_digit(c) ((unsigned)((c) - '0') <= 9) #define is_alpha(c) (((char)(c)) != UPEOF && ((c) < CTL_FIRST || (c) > CTL_LAST) && isalpha((unsigned char)(c))) #define is_name(c) (((char)(c)) != UPEOF && ((c) < CTL_FIRST || (c) > CTL_LAST) && ((c) == '_' || isalpha((unsigned char)(c)))) #define is_in_name(c) (((char)(c)) != UPEOF && ((c) < CTL_FIRST || (c) > CTL_LAST) && ((c) == '_' || isalnum((unsigned char)(c)))) #define is_special(c) ((is_type+SYNBASE)[c] & (ISSPECL|ISDIGIT)) #define digit_val(c) ((c) - '0') #ifdef _MSC_VER extern char basesyntax[]; extern char dqsyntax[]; extern char sqsyntax[]; extern char arisyntax[]; extern char is_type[]; #else extern const char basesyntax[]; extern const char dqsyntax[]; extern const char sqsyntax[]; extern const char arisyntax[]; extern const char is_type[]; #endif kbuild-3608/src/kash/options.h0000664000175000017500000001313014670377416016304 0ustar locutuslocutus/* $NetBSD: options.h,v 1.18 2005/05/07 19:52:17 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)options.h 8.2 (Berkeley) 5/4/95 */ #ifndef ___options_h #define ___options_h struct shparam { int nparam; /* # of positional parameters (without $0) */ unsigned char malloc; /* if parameter list dynamically allocated */ unsigned char reset; /* if getopts has been reset */ char **p; /* parameter list */ char **optnext; /* next parameter to be processed by getopts */ char *optptr; /* used by getopts */ }; struct optent { const char *name; /* for set -o */ const char letter; /* set [+/-] and $- */ const char opt_set; /* mutually exclusive option set */ char val; /* value of flag */ }; /* Those marked [U] are required by posix, but have no effect! */ #ifdef DEBUG # define NOPTS 20 #else # define NOPTS 19 #endif #ifdef DEFINE_OPTIONS # define DEF_OPTS(name, letter, opt_set) {name, letter, opt_set, 0}, const struct optent ro_optlist[NOPTS + 1] = { #else # define DEF_OPTS(name, letter, opt_set) #endif #define DEF_OPT(name,letter) DEF_OPTS(name, letter, 0) DEF_OPT( "errexit", 'e' ) /* exit on error */ #define eflag(psh) (psh)->optlist[0].val DEF_OPT( "noglob", 'f' ) /* no pathname expansion */ #define fflag(psh) (psh)->optlist[1].val DEF_OPT( "ignoreeof", 'I' ) /* do not exit on EOF */ #define Iflag(psh) (psh)->optlist[2].val DEF_OPT( "interactive",'i' ) /* interactive shell */ #define iflag(psh) (psh)->optlist[3].val DEF_OPT( "monitor", 'm' ) /* job control */ #define mflag(psh) (psh)->optlist[4].val DEF_OPT( "noexec", 'n' ) /* [U] do not exec commands */ #define nflag(psh) (psh)->optlist[5].val DEF_OPT( "stdin", 's' ) /* read from stdin */ #define sflag(psh) (psh)->optlist[6].val DEF_OPT( "xtrace", 'x' ) /* trace after expansion */ #define xflag(psh) (psh)->optlist[7].val DEF_OPT( "verbose", 'v' ) /* trace read input */ #define vflag(psh) (psh)->optlist[8].val DEF_OPTS( "vi", 'V', 'V' ) /* vi style editing */ #define Vflag(psh) (psh)->optlist[9].val DEF_OPTS( "emacs", 'E', 'V' ) /* emacs style editing */ #define Eflag(psh) (psh)->optlist[10].val DEF_OPT( "noclobber", 'C' ) /* do not overwrite files with > */ #define Cflag(psh) (psh)->optlist[11].val DEF_OPT( "allexport", 'a' ) /* export all variables */ #define aflag(psh) (psh)->optlist[12].val DEF_OPT( "notify", 'b' ) /* [U] report completion of background jobs */ #define bflag(psh) (psh)->optlist[13].val DEF_OPT( "nounset", 'u' ) /* error expansion of unset variables */ #define uflag(psh) (psh)->optlist[14].val DEF_OPT( "quietprofile", 'q' ) #define qflag(psh) (psh)->optlist[15].val DEF_OPT( "nolog", 0 ) /* [U] no functon defs in command history */ #define nolog(psh) (psh)->optlist[16].val DEF_OPT( "cdprint", 0 ) /* always print result of cd */ #define cdprint(psh) (psh)->optlist[17].val DEF_OPT( "tabcomplete", 0 ) /* causes filename expansion */ #define tabcomplete(psh) (psh)->optlist[18].val #ifdef DEBUG DEF_OPT( "debug", 0 ) /* enable debug prints */ #define debug(psh) (psh)->optlist[19].val #endif #ifdef DEFINE_OPTIONS { 0, 0, 0, 0 }, }; #else extern const struct optent ro_optlist[]; #endif #define sizeof_optlist (NOPTS * sizeof(struct optent)) /*extern char *minusc;*/ /* argument to -c option */ /*extern char *arg0;*/ /* $0 */ /*extern struct shparam shellparam;*/ /* $@ */ /*extern char **argptr;*/ /* argument list for builtin commands */ /*extern char *optionarg;*/ /* set by nextopt */ /*extern char *optptr;*/ /* used by nextopt */ #ifndef SH_FORKED_MODE void subshellinitoptions(struct shinstance *, struct shinstance *); #endif void procargs(struct shinstance *, int, char **); void optschanged(struct shinstance *); void setparam(struct shinstance *, char **); void freeparam(struct shinstance *, volatile struct shparam *); int shiftcmd(struct shinstance *, int, char **); int setcmd(struct shinstance *, int, char **); int getoptscmd(struct shinstance *, int, char **); int nextopt(struct shinstance *, const char *); void getoptsreset(struct shinstance *, const char *); #endif kbuild-3608/src/kDeDup/0000775000175000017500000000000014670377473014673 5ustar locutuslocutuskbuild-3608/src/kDeDup/Makefile.kmk0000664000175000017500000000201014670377473017105 0ustar locutuslocutus# $Id: Makefile.kmk 3012 2016-11-07 11:53:11Z bird $ ## @file # Sub-makefile for kDeDup. # # # Copyright (c) 2016 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # SUB_DEPTH = ../.. include $(KBUILD_PATH)/subheader.kmk PROGRAMS += kDeDup kDeDup_TEMPLATE = BIN kDeDup_LIBS = $(LIB_KUTIL) kDeDup_SOURCES = kDeDup.c include $(FILE_KBUILD_SUB_FOOTER) kbuild-3608/src/kDeDup/kDeDup.c0000664000175000017500000012273614670377473016226 0ustar locutuslocutus/* $Id: kDeDup.c 3296 2019-01-22 21:29:08Z bird $ */ /** @file * kDeDup - Utility that finds duplicate files, optionally hardlinking them. */ /* * Copyright (c) 2016 knut st. osmundsen * * This file is part of kBuild. * * kBuild is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kBuild 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 kBuild; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include #include #include #if K_OS != K_OS_WINDOWS # include # include # include # include #endif #include "md5.h" //#include "sha2.h" #if K_OS == K_OS_WINDOWS # include "nt/ntstuff.h" # include "nt/ntstat.h" # include "nt/fts-nt.h" # include "nt/nthlp.h" # include "nt/ntunlink.h" #else # include "fts.h" #endif /********************************************************************************************************************************* * Structures and Typedefs * *********************************************************************************************************************************/ /** * The key is made up of two cryptographic hashes, collisions are * highly unlikely (once SHA2 is implemented). */ typedef struct KDUPFILENODEKEY { /** The MD5 digest of the file. */ KU8 abMd5[16]; /** The 256-bit SHA-2 digest of the file. */ KU8 abSha2[32]; } KDUPFILENODEKEY; /** Pointer to a file node.*/ typedef struct KDUPFILENODE *PKDUPFILENODE; /** * Hash tree node. */ typedef struct KDUPFILENODE { /** The is made up of two hashes. */ KDUPFILENODEKEY mKey; /** Left branch. */ PKDUPFILENODE mpLeft; /** Right branch. */ PKDUPFILENODE mpRight; /** Tree height (hmm). */ KU8 mHeight; /** The inode number. */ KU64 uInode; /** The device number. */ KU64 uDev; /** Pointer to next hard linked node (same inode and udev values). */ PKDUPFILENODE pNextHardLink; /** Pointer to next duplicate node. */ PKDUPFILENODE pNextDup; /** Pointer to next duplicate node on the global list. */ PKDUPFILENODE pNextGlobalDup; /** The path to this file (variable size). */ #if K_OS == K_OS_WINDOWS wchar_t wszPath[1]; #else char szPath[1]; #endif } KDUPFILENODE; #if K_OS == K_OS_WINDOWS # define PATH_PRI "ls" # define PATH_MEMB wszPath # define FTS_ACCPATH fts_wcsaccpath #else # define PATH_PRI "s" # define PATH_MEMB szPath # define FTS_ACCPATH fts_accpath #endif /*#define KAVL_EQUAL_ALLOWED*/ #define KAVL_CHECK_FOR_EQUAL_INSERT #define KAVL_MAX_STACK 32 /*#define KAVL_RANGE */ /*#define KAVL_OFFSET */ /*#define KAVL_STD_KEY_COMP*/ #define KAVLKEY KDUPFILENODEKEY #define KAVLNODE KDUPFILENODE #define KAVL_FN(name) kDupFileTree_ ## name #define KAVL_TYPE(prefix,name) prefix ## KDUPFILENODE ## name #define KAVL_INT(name) KDUPFILENODEINT ## name #define KAVL_DECL(rettype) static rettype #define KAVL_G(key1, key2) ( memcmp(&(key1), &(key2), sizeof(KDUPFILENODEKEY)) > 0 ) #define KAVL_E(key1, key2) ( memcmp(&(key1), &(key2), sizeof(KDUPFILENODEKEY)) == 0 ) #define KAVL_NE(key1, key2) ( memcmp(&(key1), &(key2), sizeof(KDUPFILENODEKEY)) != 0 ) #define register #include //#include //#include - busted #include //#include //#include //#include //#include #include #undef register /** Pointer to a size tree node. */ typedef struct KDUPSIZENODE *PKDUPSIZENODE; /** * Size tree node. */ typedef struct KDUPSIZENODE { /** The file size. */ KU64 mKey; /** Left branch. */ PKDUPSIZENODE mpLeft; /** Right branch. */ PKDUPSIZENODE mpRight; /** Tree height (hmm). */ KU8 mHeight; /** Number of files. */ KU32 cFiles; /** Tree with same sized files. * When cFiles is 1 the root node does not have hashes calculated yet. */ KDUPFILENODEROOT FileRoot; } KDUPSIZENODE; /*#define KAVL_EQUAL_ALLOWED*/ #define KAVL_CHECK_FOR_EQUAL_INSERT #define KAVL_MAX_STACK 32 /*#define KAVL_RANGE */ /*#define KAVL_OFFSET */ #define KAVL_STD_KEY_COMP #define KAVLKEY KU64 #define KAVLNODE KDUPSIZENODE #define KAVL_FN(name) kDupSizeTree_ ## name #define KAVL_TYPE(prefix,name) prefix ## KDUPSIZENODE ## name #define KAVL_INT(name) KDUPSIZENODEINT ## name #define KAVL_DECL(rettype) static rettype #include //#include //#include - busted #include //#include //#include //#include //#include #include /********************************************************************************************************************************* * Global Variables * *********************************************************************************************************************************/ /** The verbosity level. */ static unsigned g_cVerbosity = 0; /** Whether to recurse into subdirectories. */ static KBOOL g_fRecursive = K_FALSE; /** Whether to recurse into symlinked subdirectories. */ static KBOOL g_fRecursiveViaSymlinks = K_FALSE; /** Whether to follow symbolicly linked files. */ static KBOOL g_fFollowSymlinkedFiles = K_TRUE; /** Minimum file size to care about. */ static KU64 g_cbMinFileSize = 1; /** Maximum file size to care about. */ static KU64 g_cbMaxFileSize = KU64_MAX; /** The root of the size tree. */ static KDUPSIZENODEROOT g_SizeRoot; /** Global list of duplicate file with duplicates. * @remarks This only contains the files in the hash tree, not the ones on * the KDUPFILENODE::pNextDup list. */ static PKDUPFILENODE g_pDuplicateHead = NULL; /** Where to insert the next file with duplicates. */ static PKDUPFILENODE *g_ppNextDuplicate = &g_pDuplicateHead; /** Number of files we're tracking. */ static KU64 g_cFiles = 0; /** Number of hardlinked files or files entered more than once. */ static KU64 g_cHardlinked = 0; /** Number of duplicates files (not hardlinked). */ static KU64 g_cDuplicates = 0; /** Number of duplicates files that can be hardlinked. */ static KU64 g_cDuplicatesSaved = 0; /** Size that could be saved if the duplicates were hardlinked. */ static KU64 g_cbDuplicatesSaved = 0; /** * Wrapper around malloc() that complains when out of memory. * * @returns Pointer to allocated memory * @param cb The size of the memory to allocate. */ static void *kDupAlloc(KSIZE cb) { void *pvRet = malloc(cb); if (pvRet) return pvRet; fprintf(stderr, "kDeDup: error: out of memory! (cb=%#zx)\n", cb); return NULL; } /** Wrapper around free() for symmetry. */ #define kDupFree(ptr) free(ptr) #if K_OS != K_OS_WINDOWS /** Wrapper around read() that hides EINTR and such. */ static ssize_t kDupReadFile(int fd, void *pvBuf, size_t cbToRead) { ssize_t cbRet; do cbRet = read(fd, pvBuf, cbToRead); while (cbRet < 0 && errno == EINTR); if (cbRet > 0 && (size_t)cbRet != cbToRead) { for (;;) { size_t cbLeft = cbToRead - (size_t)cbRet; ssize_t cbPart; do cbPart = read(fd, (KU8 *)pvBuf + (size_t)cbRet, cbLeft); while (cbPart < 0 && errno == EINTR); if (cbPart <= 0) break; cbRet += cbPart; } } return cbRet; } #endif static void kDupHashFile(PKDUPFILENODE pFileNode, FTSENT *pFtsEnt) { KSIZE i; PKDUPFILENODE *ppHash; /* * Open the file. */ #if K_OS == K_OS_WINDOWS HANDLE hFile; if (pFtsEnt && pFtsEnt->fts_parent && pFtsEnt->fts_parent->fts_dirfd != INVALID_HANDLE_VALUE) hFile = birdOpenFileExW(pFtsEnt->fts_parent->fts_dirfd, pFtsEnt->fts_wcsname, FILE_READ_DATA | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE); else hFile = birdOpenFileExW(NULL, pFileNode->wszPath, FILE_READ_DATA | SYNCHRONIZE, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, OBJ_CASE_INSENSITIVE); if (hFile != INVALID_HANDLE_VALUE) #else /* K_OS != K_OS_WINDOWS */ # ifdef O_BINARY int fd = open(pFileNode->szPath, O_RDONLY | O_BINARY); # else int fd = open(pFileNode->szPath, O_RDONLY); # endif if (fd >= 0) #endif /* K_OS != K_OS_WINDOWS */ { /* * Init the hash calculation contexts. */ struct MD5Context Md5Ctx; //SHA256CONTEXT Sha256Ctx; MD5Init(&Md5Ctx); //Sha256Init(&Sha256Ctx); /* * Process the file chunk by chunk. * * We could complicate this by memory mapping medium sized files, but * those kind of complications can wait. */ for (;;) { static KU8 s_abBuffer[2*1024*1024]; #if K_OS == K_OS_WINDOWS MY_NTSTATUS rcNt; MY_IO_STATUS_BLOCK Ios; Ios.Information = -1; Ios.u.Status = -1; rcNt = g_pfnNtReadFile(hFile, NULL /*hEvent*/, NULL /*pfnApc*/, NULL /*pvApcCtx*/, &Ios, s_abBuffer, sizeof(s_abBuffer), NULL /*poffFile*/, NULL /*puKey*/); if (MY_NT_SUCCESS(rcNt)) { MD5Update(&Md5Ctx, s_abBuffer, (unsigned)Ios.Information); //SHA256Update(&Sha256Ctx, s_abBuffer, Ios.Information); } else if (rcNt != STATUS_END_OF_FILE) { fprintf(stderr, "kDeDup: warning: Error reading '%ls': %#x\n", pFileNode->wszPath, rcNt); break; } /* Check for end of file. */ if ( rcNt == STATUS_END_OF_FILE || Ios.Information < sizeof(s_abBuffer)) { MD5Final(pFileNode->mKey.abMd5, &Md5Ctx); //Sha256Final(pFileNode->mKey.abSha2, &Sha256Ctx); birdCloseFile(hFile); return; } #else /* K_OS != K_OS_WINDOWS */ ssize_t cbRead = kDupReadFile(fd, s_abBuffer, sizeof(s_abBuffer)); if (cbRead > 0) { MD5Update(&Md5Ctx, s_abBuffer, (unsigned)cbRead); //SHA256Update(&Sha256Ctx, s_abBuffer, (unsigned)cbRead); } else if (cbRead == 0) { MD5Final(pFileNode->mKey.abMd5, &Md5Ctx); //Sha256Final(pFileNode->mKey.abSha2, &Sha256Ctx); close(fd); return; } else { fprintf(stderr, "kDeDup: warning: Error reading '%s': %s (%d)\n", pFileNode->szPath, strerror(errno), errno); break; } #endif /* K_OS != K_OS_WINDOWS */ } #if K_OS == K_OS_WINDOWS birdCloseFile(hFile); #else close(fd); #endif } else fprintf(stderr, "kDeDup: warning: Failed to open '%" PATH_PRI "': %s (%d)\n", pFileNode->PATH_MEMB, strerror(errno), errno); /* * Hashing failed. We fake the digests by repeating the node pointer value * again and again, holding a collision with both SHA2 and MD5 with similar * digest pattern for highly unlikely. */ ppHash = (PKDUPFILENODE *)&pFileNode->mKey; i = sizeof(pFileNode->mKey) / sizeof(*ppHash); while (i-- > 0) *ppHash++ = pFileNode; } /** * Deal with one file, adding it to the tree if it matches the criteria. * * @returns 0 on success, non-zero on failure. * @param pFtsEnt The FTS entry for the file. */ static int kDupDoFile(FTSENT *pFtsEnt) { KU64 cbFile; #if K_OS == K_OS_WINDOWS struct stat const *pStat = &pFtsEnt->fts_stat; #else struct stat const *pStat = pFtsEnt->fts_statp; #endif if (g_cVerbosity >= 2) printf("debug: kDupDoFile(%" PATH_PRI ")\n", pFtsEnt->FTS_ACCPATH); /* * Check that it's within the size range. */ cbFile = pStat->st_size; if ( cbFile >= g_cbMinFileSize && cbFile <= g_cbMaxFileSize) { /* * Start out treating this like a unique file with a unique size, i.e. * allocate all the structures we might possibly need. */ #if K_OS == K_OS_WINDOWS size_t cbAccessPath = (wcslen(pFtsEnt->fts_wcsaccpath) + 1) * sizeof(wchar_t); #else size_t cbAccessPath = strlen(pFtsEnt->fts_accpath) + 1; #endif PKDUPFILENODE pFileNode = (PKDUPFILENODE)kDupAlloc(sizeof(*pFileNode) + cbAccessPath); PKDUPSIZENODE pSizeNode = (PKDUPSIZENODE)kDupAlloc(sizeof(*pSizeNode)); if (!pFileNode || !pSizeNode) return 3; g_cFiles++; memset(&pFileNode->mKey, 0, sizeof(pFileNode->mKey)); pFileNode->pNextHardLink = NULL; pFileNode->pNextDup = NULL; pFileNode->pNextGlobalDup = NULL; pFileNode->uDev = pStat->st_dev; pFileNode->uInode = pStat->st_ino; memcpy(pFileNode->PATH_MEMB, pFtsEnt->FTS_ACCPATH, cbAccessPath); pSizeNode->mKey = cbFile; pSizeNode->cFiles = 1; kDupFileTree_Init(&pSizeNode->FileRoot); kDupFileTree_Insert(&pSizeNode->FileRoot, pFileNode); /* * Try insert it. */ if (kDupSizeTree_Insert(&g_SizeRoot, pSizeNode)) { /* unique size, nothing more to do for now. */ } else { /* * More than one file with this size. We may need to hash the * hash the file we encountered with this size, if this is the * second one. In that case we should check for hardlinked or * double entering of the file first as well. */ kDupFree(pSizeNode); pSizeNode = kDupSizeTree_Get(&g_SizeRoot, cbFile); if (pSizeNode->cFiles == 1) { PKDUPFILENODE pFirstFileNode = pSizeNode->FileRoot.mpRoot; if ( pFirstFileNode->uInode == pFileNode->uInode && pFileNode->uInode != 0 && pFirstFileNode->uDev == pFileNode->uDev) { pFileNode->pNextHardLink = pFirstFileNode->pNextHardLink; pFirstFileNode->pNextHardLink = pFileNode; if (g_cVerbosity >= 1) printf("Found hardlinked: '%" PATH_PRI "' -> '%" PATH_PRI "' (ino:%#" KX64_PRI " dev:%#" KX64_PRI ")\n", pFileNode->PATH_MEMB, pFirstFileNode->PATH_MEMB, pFileNode->uInode, pFileNode->uDev); g_cHardlinked += 1; return 0; } kDupHashFile(pFirstFileNode, NULL); } kDupHashFile(pFileNode, pFtsEnt); if (kDupFileTree_Insert(&pSizeNode->FileRoot, pFileNode)) { /* great, unique content */ } else { /* * Duplicate content. Could be hardlinked or a duplicate entry. */ PKDUPFILENODE pDupFileNode = kDupFileTree_Get(&pSizeNode->FileRoot, pFileNode->mKey); if ( pDupFileNode->uInode == pFileNode->uInode && pFileNode->uInode != 0 && pDupFileNode->uDev == pFileNode->uDev) { pFileNode->pNextHardLink = pDupFileNode->pNextHardLink; pDupFileNode->pNextHardLink = pFileNode; if (g_cVerbosity >= 1) printf("Found hardlinked: '%" PATH_PRI "' -> '%" PATH_PRI "' (ino:%#" KX64_PRI " dev:%#" KX64_PRI ")\n", pFileNode->PATH_MEMB, pDupFileNode->PATH_MEMB, pFileNode->uInode, pFileNode->uDev); g_cHardlinked += 1; } else { KBOOL fDifferentDev; /* Genuinly duplicate (or inode numbers are busted). */ if (!pDupFileNode->pNextDup) { *g_ppNextDuplicate = pDupFileNode; g_ppNextDuplicate = &pDupFileNode->pNextGlobalDup; } /* The list is sorted by device to better facility hardlinking later. */ while ( (fDifferentDev = pDupFileNode->uDev != pFileNode->uDev) && pDupFileNode->pNextDup) pDupFileNode = pDupFileNode->pNextDup; pFileNode->pNextDup = pDupFileNode->pNextDup; pDupFileNode->pNextDup = pFileNode; g_cDuplicates += 1; if (!fDifferentDev) { g_cDuplicatesSaved += 1; #if K_OS == K_OS_WINDOWS g_cbDuplicatesSaved += pStat->st_blocks * BIRD_STAT_BLOCK_SIZE; #else g_cbDuplicatesSaved += pStat->st_size; #endif if (g_cVerbosity >= 1) printf("Found duplicate: '%" PATH_PRI "' <-> '%" PATH_PRI "'\n", pFileNode->PATH_MEMB, pDupFileNode->PATH_MEMB); } else if (g_cVerbosity >= 1) printf("Found duplicate: '%" PATH_PRI "' <-> '%" PATH_PRI "' (devices differ).\n", pFileNode->PATH_MEMB, pDupFileNode->PATH_MEMB); } } } } else if (g_cVerbosity >= 1) printf("Skipping '%" PATH_PRI "' because %" KU64_PRI " bytes is outside the size range.\n", pFtsEnt->FTS_ACCPATH, cbFile); return 0; } /** * Process the non-option arguments, creating the file tree. * * @returns 0 on success, non-zero on failure. * @param papwszFtsArgs The input in argv style. * @param fFtsOptions The FTS options. */ #if K_OS == K_OS_WINDOWS static int kDupReadAll(wchar_t **papwszFtsArgs, unsigned fFtsOptions) #else static int kDupReadAll(char **papszFtsArgs, unsigned fFtsOptions) #endif { int rcExit = 0; #if K_OS == K_OS_WINDOWS FTS *pFts = nt_fts_openw(papwszFtsArgs, fFtsOptions, NULL /*pfnCompare*/); #else FTS *pFts = fts_open(papszFtsArgs, fFtsOptions, NULL /*pfnCompare*/); #endif if (pFts != NULL) { for (;;) { #if K_OS == K_OS_WINDOWS FTSENT *pFtsEnt = nt_fts_read(pFts); #else FTSENT *pFtsEnt = fts_read(pFts); #endif if (pFtsEnt) { switch (pFtsEnt->fts_info) { case FTS_F: rcExit = kDupDoFile(pFtsEnt); if (rcExit == 0) continue; break; case FTS_D: if ( g_fRecursive || pFtsEnt->fts_level == FTS_ROOTLEVEL) /* enumerate dirs on the command line */ continue; #if K_OS == K_OS_WINDOWS rcExit = nt_fts_set(pFts, pFtsEnt, FTS_SKIP); #else rcExit = fts_set(pFts, pFtsEnt, FTS_SKIP); #endif if (rcExit == 0) continue; fprintf(stderr, "kDeDup: internal error: nt_fts_set failed!\n"); rcExit = 1; break; case FTS_DP: /* nothing to do here. */ break; case FTS_SL: { #if K_OS == K_OS_WINDOWS /* The nice thing on windows is that we already know whether it's a directory or file when encountering the symbolic link. */ if ( (pFtsEnt->fts_stat.st_isdirsymlink ? g_fRecursiveViaSymlinks : g_fFollowSymlinkedFiles) && pFtsEnt->fts_number == 0) #else struct stat St; if ( pFtsEnt->fts_number == 0 && ( (g_fRecursiveViaSymlinks && g_fFollowSymlinkedFiles) || ( stat(pFtsEnt->fts_accpath, &St) == 0 && (S_ISDIR(St.st_mode) ? g_fRecursiveViaSymlinks : g_fFollowSymlinkedFiles)))) #endif { pFtsEnt->fts_number++; #if K_OS == K_OS_WINDOWS rcExit = nt_fts_set(pFts, pFtsEnt, FTS_FOLLOW); #else rcExit = fts_set(pFts, pFtsEnt, FTS_FOLLOW); #endif if (rcExit == 0) continue; fprintf(stderr, "kDeDup: internal error: nt_fts_set failed!\n"); rcExit = 1; } break; } case FTS_DC: fprintf(stderr, "kDeDup: warning: Ignoring cycle '%" PATH_PRI "'!\n", pFtsEnt->FTS_ACCPATH); continue; case FTS_NS: fprintf(stderr, "kDeDup: warning: Failed to stat '%" PATH_PRI "': %s (%d)\n", pFtsEnt->FTS_ACCPATH, strerror(pFtsEnt->fts_errno), pFtsEnt->fts_errno); continue; case FTS_DNR: fprintf(stderr, "kDeDup: error: Error reading directory '%" PATH_PRI "': %s (%d)\n", pFtsEnt->FTS_ACCPATH, strerror(pFtsEnt->fts_errno), pFtsEnt->fts_errno); rcExit = 1; break; case FTS_ERR: fprintf(stderr, "kDeDup: error: Error on '%" PATH_PRI "': %s (%d)\n", pFtsEnt->FTS_ACCPATH, strerror(pFtsEnt->fts_errno), pFtsEnt->fts_errno); rcExit = 1; break; /* ignore */ case FTS_SLNONE: case FTS_DEFAULT: break; /* Not supposed to get here. */ default: fprintf(stderr, "kDeDup: internal error: fts_info=%d - '%" PATH_PRI "'\n", pFtsEnt->fts_info, pFtsEnt->FTS_ACCPATH); rcExit = 1; break; } } else if (errno == 0) break; else { fprintf(stderr, "kDeDup: error: nt_fts_read failed: %s (%d)\n", strerror(errno), errno); rcExit = 1; break; } } #if K_OS == K_OS_WINDOWS if (nt_fts_close(pFts) != 0) #else if (fts_close(pFts) != 0) #endif { fprintf(stderr, "kDeDup: error: nt_fts_close failed: %s (%d)\n", strerror(errno), errno); rcExit = 1; } } else { fprintf(stderr, "kDeDup: error: nt_fts_openw failed: %s (%d)\n", strerror(errno), errno); rcExit = 1; } return rcExit; } /** * Compares the content of the two files. * * @returns 0 if equal, 1 if not equal, -1 on open/read error. * @param pFile1 The first file. * @param pFile2 The second file. */ static int kDupCompareFiles(PKDUPFILENODE pFile1, PKDUPFILENODE pFile2) { #if K_OS == K_OS_WINDOWS int rcRet = 0; K_NOREF(pFile1); K_NOREF(pFile2); /** @todo compare files. */ #else int rcRet = -1; # ifdef O_BINARY int fOpen = O_RDONLY | O_BINARY; # else int fOpen = O_RDONLY; # endif /* * Open the two files. */ int fd1 = open(pFile1->szPath, fOpen); if (fd1 >= 0) { int fd2 = open(pFile2->szPath, fOpen); if (fd1 >= 0) { /* * Read and compare all the data. */ static KU8 s_abBuf1[2*1024*1024]; static KU8 s_abBuf2[2*1024*1024]; KU64 off = 0; for (;;) { ssize_t cb1 = kDupReadFile(fd1, s_abBuf1, sizeof(s_abBuf1)); ssize_t cb2 = kDupReadFile(fd2, s_abBuf2, sizeof(s_abBuf2)); if (cb1 < 0 || cb2 < 0) { if (cb1 < 0) fprintf(stderr, "kDeDup: error: reading from '%s': %s (%d)\n", pFile1->szPath, strerror(errno), errno); if (cb2 < 0) fprintf(stderr, "kDeDup: error: reading from '%s': %s (%d)\n", pFile2->szPath, strerror(errno), errno); break; } if (cb1 != cb2) { fprintf(stderr, "kDeDup: warning: '%s' now differs from '%s' in size...\n", pFile1->szPath, pFile2->szPath); rcRet = 1; break; } if (cb1 == 0) { rcRet = 0; break; } if (memcmp(s_abBuf1, s_abBuf2, cb1) != 0) { fprintf(stderr, "kDeDup: warning: hash collision: '%s' differs from '%s' (" KX64_PRI " LB %#x)\n", pFile1->szPath, pFile2->szPath, off, (unsigned)cb1); rcRet = 1; break; } off += cb1; } close(fd2); } close(fd1); } #endif return rcRet; } /** * Hardlink duplicates. */ static int kDupHardlinkDuplicates(void) { int rcExit = 0; PKDUPFILENODE pFileNode; for (pFileNode = g_pDuplicateHead; pFileNode != NULL; pFileNode = pFileNode->pNextGlobalDup) { PKDUPFILENODE pTargetFile = pFileNode; PKDUPFILENODE pDupFile; for (pDupFile = pFileNode->pNextDup; pDupFile != NULL; pDupFile = pDupFile->pNextDup) { /* * Can only hard link if the files are on the same device. */ if (pDupFile->uDev == pTargetFile->uDev) { if (kDupCompareFiles(pDupFile, pTargetFile) == 0) { /* * Start by renaming the orinal file before we try create the hard link. */ #if K_OS == K_OS_WINDOWS static const wchar_t s_wszBackupSuffix[] = L".kDepBackup"; wchar_t wszBackup[0x4000]; size_t cwcPath = wcslen(pDupFile->wszPath); if (cwcPath + sizeof(s_wszBackupSuffix) / sizeof(wchar_t) < K_ELEMENTS(wszBackup)) { memcpy(wszBackup, pDupFile->wszPath, cwcPath * sizeof(wchar_t)); memcpy(&wszBackup[cwcPath], s_wszBackupSuffix, sizeof(s_wszBackupSuffix)); if (MoveFileW(pDupFile->wszPath, wszBackup)) { if (CreateHardLinkW(pDupFile->wszPath, pTargetFile->wszPath, NULL)) { if (birdUnlinkForcedW(wszBackup) == 0) { if (g_cVerbosity >= 1) printf("Hardlinked '%ls' to '%ls'.\n", pDupFile->wszPath, pTargetFile->wszPath); } else { fprintf(stderr, "kDeDup: fatal: failed to delete '%ls' after hardlinking: %s (%d)\n", wszBackup, strerror(errno), errno); return 8; } } else { fprintf(stderr, "kDeDup: error: failed to hard link '%ls' to '%ls': %u\n", pDupFile->wszPath, wszBackup, GetLastError()); if (!MoveFileW(wszBackup, pDupFile->wszPath)) { fprintf(stderr, "kDeDup: fatal: Restore '%ls' to '%ls' after hardlinking failed: %u\n", wszBackup, pDupFile->wszPath, GetLastError()); return 8; } rcExit = 1; } } else { fprintf(stderr, "kDeDup: error: failed to rename '%ls' to '%ls': %u\n", pDupFile->wszPath, wszBackup, GetLastError()); rcExit = 1; } } else { fprintf(stderr, "kDeDup: error: too long backup path: '%ls'\n", pDupFile->wszPath); rcExit = 1; } #else /* K_OS != K_OS_WINDOWS */ static const char s_szBackupSuffix[] = ".kDepBackup"; char szBackup[0x4000]; size_t cchPath = strlen(pDupFile->szPath); if (cchPath + sizeof(s_szBackupSuffix) < sizeof(szBackup)) { struct stat StTmp; memcpy(szBackup, pDupFile->szPath, cchPath); memcpy(&szBackup[cchPath], s_szBackupSuffix, sizeof(s_szBackupSuffix)); if (stat(szBackup, &StTmp) != 0) { if (rename(pDupFile->szPath, szBackup) == 0) { if (link(pTargetFile->szPath, pDupFile->szPath) == 0) { if (unlink(szBackup) == 0) { if (g_cVerbosity >= 1) printf("Hardlinked '%s' to '%s'.\n", pDupFile->szPath, pTargetFile->szPath); } else { fprintf(stderr, "kDeDup: fatal: failed to delete '%s' after hardlinking: %s (%d)\n", szBackup, strerror(errno), errno); return 8; } } else { fprintf(stderr, "kDeDup: error: failed to hard link '%s' to '%s': %s (%d)\n", pDupFile->szPath, szBackup, strerror(errno), errno); if (rename(szBackup, pDupFile->szPath) != 0) { fprintf(stderr, "kDeDup: fatal: Restore '%s' to '%s' after hardlinking failed: %s (%d)\n", szBackup, pDupFile->szPath, strerror(errno), errno); return 8; } rcExit = 1; } } else { fprintf(stderr, "kDeDup: error: failed to rename '%s' to '%s': %s (%d)\n", pDupFile->szPath, szBackup, strerror(errno), errno); rcExit = 1; } } else { fprintf(stderr, "kDeDup: error: failed to rename '%s' to '%s': file already exist (st_mode=%#x)\n", pDupFile->szPath, szBackup, StTmp.st_mode); rcExit = 1; } } else { fprintf(stderr, "kDeDup: error: too long backup path: '%s'\n", pDupFile->szPath); rcExit = 1; } #endif /* K_OS != K_OS_WINDOWS */ } } /* * Since the list is sorted by uDev, we now change the target file. */ else pTargetFile = pDupFile; } } return rcExit; } static int usage(const char *pszName, FILE *pOut) { fprintf(pOut, "usage: %s [options] [path2 [..]]\n" "usage: %s <-V|--version>\n" "usage: %s <-h|--help>\n" , pszName, pszName, pszName); fprintf(pOut, "\n" "Options:\n" " -H, --dereference-command-line, --no-dereference-command-line\n" " Follow symbolic links on the command line.\n" " -L, --dereference\n" " Follow symbolic links while scanning directories.\n" " -P, --no-dereference\n" " Do not follow symbolic links while scanning directories.\n" " -r, --recursive\n" " Recurse into subdirectories, but do not follow links to them.\n" " -R, --recursive-dereference\n" " Same as -r, but also follow into symlinked subdirectories.\n" " -x, --one-file-system\n" " Do not consider other file system (volumes), either down thru a\n" " mount point or via a symbolic link to a directory.\n" " --no-one-file-system, --cross-file-systems\n" " Reverses the effect of --one-file-system.\n" " -q, --quiet, -v,--verbose\n" " Controls the output level.\n" " --hardlink-duplicates\n" " Hardlink duplicate files to remove duplicates and save space. By default\n" " no action is taken and only analysis is done.\n" ); return 0; } #if K_OS == K_OS_WINDOWS int wmain(int argc, wchar_t **argv) #else int main(int argc, char **argv) #endif { int rcExit; /* * Process parameters. Position. */ unsigned cFtsArgs = 0; #if K_OS == K_OS_WINDOWS wchar_t **papwszFtsArgs = (wchar_t **)calloc(argc + 1, sizeof(wchar_t *)); unsigned fFtsOptions = FTS_NOCHDIR | FTS_NO_ANSI; #else char **papszFtsArgs = (char **)calloc(argc + 1, sizeof(char *)); unsigned fFtsOptions = FTS_NOCHDIR; #endif KBOOL fEndOfOptions = K_FALSE; KBOOL fHardlinkDups = K_FALSE; int i; for (i = 1; i < argc; i++) { #if K_OS == K_OS_WINDOWS wchar_t *pwszArg = argv[i]; if ( *pwszArg == '-' && !fEndOfOptions) #else char *pszArg = argv[i]; if ( *pszArg == '-' && !fEndOfOptions) #endif { #if K_OS != K_OS_WINDOWS wchar_t wszOpt[1024] = { 0 }; wchar_t *pwszArg = wszOpt; mbsrtowcs(wszOpt, (const char **)&pszArg, 1024 - 1, NULL); #endif wchar_t wcOpt = *++pwszArg; pwszArg++; if (wcOpt == '-') { /* Translate long options. */ if (wcscmp(pwszArg, L"help") == 0) wcOpt = 'h'; else if (wcscmp(pwszArg, L"version") == 0) wcOpt = 'V'; else if (wcscmp(pwszArg, L"recursive") == 0) wcOpt = 'r'; else if (wcscmp(pwszArg, L"dereference-recursive") == 0) wcOpt = 'R'; else if (wcscmp(pwszArg, L"dereference") == 0) wcOpt = 'L'; else if (wcscmp(pwszArg, L"dereference-command-line") == 0) wcOpt = 'H'; else if (wcscmp(pwszArg, L"one-file-system") == 0) wcOpt = 'x'; /* Process long options. */ else if (*pwszArg == '\0') { fEndOfOptions = K_TRUE; continue; } else if (wcscmp(pwszArg, L"no-recursive") == 0) { g_fRecursive = g_fRecursiveViaSymlinks = K_FALSE; continue; } else if (wcscmp(pwszArg, L"no-dereference-command-line") == 0) { fFtsOptions &= ~FTS_COMFOLLOW; continue; } else if ( wcscmp(pwszArg, L"no-one-file-system") == 0 || wcscmp(pwszArg, L"cross-file-systems") == 0) { fFtsOptions &= ~FTS_XDEV; continue; } else if (wcscmp(pwszArg, L"hardlink-duplicates") == 0) { fHardlinkDups = K_TRUE; continue; } else { fprintf(stderr, "kDeDup: syntax error: Unknown option '--%ls'\n", pwszArg); return 2; } } /* Process one or more short options. */ do { switch (wcOpt) { case 'r': /* --recursive */ g_fRecursive = K_TRUE; break; case 'R': /* --dereference-recursive */ g_fRecursive = g_fRecursiveViaSymlinks = K_TRUE; break; case 'H': /* --dereference-command-line */ fFtsOptions |= FTS_COMFOLLOW; break; case 'L': /* --dereference*/ g_fFollowSymlinkedFiles = K_TRUE; break; case 'x': /* --one-file-system*/ fFtsOptions |= FTS_XDEV; break; case 'q': g_cVerbosity = 0; break; case 'v': g_cVerbosity++; break; case 'h': case '?': return usage("kDeDup", stdout); case 'V': printf("0.0.1\n"); return 0; default: #if K_OS == K_OS_WINDOWS fprintf(stderr, "kDeDup: syntax error: Unknown option '-%lc'\n", wcOpt); #else fprintf(stderr, "kDeDup: syntax error: Unknown option '-%c'\n", (int)wcOpt); #endif return 2; } wcOpt = *pwszArg++; } while (wcOpt != '\0'); } else { /* * Append non-option arguments to the FTS argument vector. */ #if K_OS == K_OS_WINDOWS papwszFtsArgs[cFtsArgs] = pwszArg; #else papszFtsArgs[cFtsArgs] = pszArg; #endif cFtsArgs++; } } /* * Do the FTS processing. */ kDupSizeTree_Init(&g_SizeRoot); #if K_OS == K_OS_WINDOWS rcExit = kDupReadAll(papwszFtsArgs, fFtsOptions); #else rcExit = kDupReadAll(papszFtsArgs, fFtsOptions); #endif if (rcExit == 0) { /* * Display the result. */ printf("Found %" KU64_PRI " duplicate files, out which %" KU64_PRI " can be hardlinked saving %" KU64_PRI " bytes\n", g_cDuplicates, g_cDuplicatesSaved, g_cbDuplicatesSaved); if (fHardlinkDups) rcExit = kDupHardlinkDuplicates(); } K_NOREF(kDupFileTree_Remove); K_NOREF(kDupSizeTree_Remove); return rcExit; } kbuild-3608/src/kmk/0000775000175000017500000000000014670377415014275 5ustar locutuslocutuskbuild-3608/src/kmk/Makefile.am0000664000175000017500000002331414670377413016332 0ustar locutuslocutus# This is a -*-Makefile-*-, or close enough # # Copyright (C) 1997-2016 Free Software Foundation, Inc. # This file is part of GNU Make. # # GNU Make 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. # # GNU Make 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 . AUTOMAKE_OPTIONS = dist-bzip2 silent-rules std-options ACLOCAL_AMFLAGS = -I config MAKE_HOST = @MAKE_HOST@ # Only process if target is MS-Windows if WINDOWSENV MAYBE_W32 = w32 W32INC = -I $(top_srcdir)/w32/include W32LIB = -Lw32 -lw32 ossrc = else ossrc = posixos.c endif # we can safely drop doc and po when bootstrapping kmk. # SUBDIRS = glob config po doc $(MAYBE_W32) SUBDIRS = glob config $(MAYBE_W32) bin_PROGRAMS = kmk kmk_redirect include_HEADERS = gnumake.h if USE_CUSTOMS remote = remote-cstms.c else remote = remote-stub.c endif kmk_SOURCES = ar.c arscan.c commands.c default.c dir.c expand.c file.c \ function.c getopt.c getopt1.c guile.c implicit.c job.c load.c \ loadapi.c main.c misc.c $(ossrc) output.c read.c remake.c \ rule.c signame.c strcache.c variable.c version.c vpath.c \ hash.c $(remote) \ \ expreval.c \ incdep.c \ strcache2.c \ alloccache.c \ kbuild.c \ kbuild-object.c \ electric.c \ ../lib/md5.c \ ../lib/kDep.c \ ../lib/kbuild_version.c \ ../lib/dos2unix.c \ ../lib/maybe_con_fwrite.c \ ../lib/version_compare.c \ \ kmkbuiltin.c \ kmkbuiltin/append.c \ kmkbuiltin/cat.c \ kmkbuiltin/chmod.c \ kmkbuiltin/cmp.c \ kmkbuiltin/cmp_util.c \ kmkbuiltin/cp.c \ kmkbuiltin/cp_utils.c \ kmkbuiltin/echo.c \ kmkbuiltin/expr.c \ kmkbuiltin/install.c \ kmkbuiltin/kDepIDB.c \ kmkbuiltin/kDepObj.c \ kmkbuiltin/ln.c \ kmkbuiltin/md5sum.c \ kmkbuiltin/mkdir.c \ kmkbuiltin/mv.c \ kmkbuiltin/printf.c \ kmkbuiltin/redirect.c \ kmkbuiltin/rm.c \ kmkbuiltin/rmdir.c \ kmkbuiltin/sleep.c \ kmkbuiltin/test.c \ kmkbuiltin/touch.c \ \ kmkbuiltin/err.c \ kmkbuiltin/getopt_r.c \ kmkbuiltin/getopt1_r.c \ kmkbuiltin/fts.c \ kmkbuiltin/setmode.c \ kmkbuiltin/strmode.c \ kmkbuiltin/strlcpy.c \ kmkbuiltin/osdep.c \ kmkbuiltin/kbuild_protection.c \ kmkbuiltin/common-env-and-cwd-opt.c kmk_redirect_SOURCES = kmkbuiltin/redirect.c \ kmkbuiltin/common-env-and-cwd-opt.c \ kmkbuiltin/err.c \ ../lib/kbuild_version.c kmk_redirect_CFLAGS = -UKMK -DKMK_BUILTIN_STANDALONE EXTRA_kmk_SOURCES = vmsjobs.c remote-stub.c remote-cstms.c noinst_HEADERS = commands.h dep.h filedef.h job.h makeint.h rule.h variable.h \ debug.h getopt.h gettext.h hash.h output.h os.h #kmk_LDADD = @LIBOBJS@ @ALLOCA@ $(GLOBLIB) @GETLOADAVG_LIBS@ @LIBINTL@ kmk_LDADD = @LIBOBJS@ @ALLOCA@ $(GLOBLIB) @GETLOADAVG_LIBS@ \ $(GUILE_LIBS) # Only process if target is MS-Windows if WINDOWSENV kmk_LDADD += $(W32LIB) endif man_MANS = make.1 # org - DEFS = -DLOCALEDIR=\"$(localedir)\" -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\" @DEFS@ DEFS = \ -DNO_ARCHIVES \ -DEXPERIMENTAL \ -DCONFIG_WITH_TOUPPER_TOLOWER \ -DCONFIG_WITH_DEFINED \ -DCONFIG_WITH_EXPLICIT_MULTITARGET \ -DCONFIG_WITH_DOT_MUST_MAKE \ -DCONFIG_WITH_PREPEND_ASSIGNMENT \ -DCONFIG_WITH_LOCAL_VARIABLES \ -DCONFIG_WITH_2ND_TARGET_EXPANSION \ -DCONFIG_WITH_ALLOC_CACHES \ -DCONFIG_WITH_STRCACHE2 \ \ -DKMK \ -DKMK_HELPERS \ -DCONFIG_NO_DEFAULT_SUFFIXES \ -DCONFIG_NO_DEFAULT_PATTERN_RULES \ -DCONFIG_NO_DEFAULT_TERMINAL_RULES \ -DCONFIG_NO_DEFAULT_SUFFIX_RULES \ -DCONFIG_NO_DEFAULT_VARIABLES \ -DCONFIG_WITH_EXTENDED_NOTPARALLEL \ -DCONFIG_WITH_INCLUDEDEP \ -DCONFIG_WITHOUT_THREADS \ -DCONFIG_WITH_VALUE_LENGTH \ \ -DCONFIG_WITH_ABSPATHEX \ -DCONFIG_WITH_COMMANDS_FUNC \ -DCONFIG_WITH_DATE \ -DCONFIG_WITH_DEFINED_FUNCTIONS \ -DCONFIG_WITH_EVALPLUS \ -DCONFIG_WITH_FILE_SIZE \ -DCONFIG_WITH_LOOP_FUNCTIONS \ -DCONFIG_WITH_MATH \ -DCONFIG_WITH_NANOTS \ -DCONFIG_WITH_ROOT_FUNC \ -DCONFIG_WITH_RSORT \ -DCONFIG_WITH_STACK \ -DCONFIG_WITH_STRING_FUNCTIONS \ -DCONFIG_WITH_WHERE_FUNCTION \ -DCONFIG_WITH_WHICH \ -DCONFIG_WITH_XARGS \ \ -DCONFIG_WITH_COMPARE \ -DCONFIG_WITH_SET_CONDITIONALS \ -DCONFIG_WITH_IF_CONDITIONALS \ -DCONFIG_WITH_PRINTF \ -DCONFIG_WITH_MINIMAL_STATS \ -DCONFIG_PRETTY_COMMAND_PRINTING \ -DCONFIG_WITH_PRINT_STATS_SWITCH \ -DCONFIG_WITH_PRINT_TIME_SWITCH \ -DCONFIG_WITH_RDONLY_VARIABLE_VALUE \ -DCONFIG_WITH_LAZY_DEPS_VARS \ \ -DKBUILD_TYPE=\"$(KBUILD_TYPE)\" \ -DKBUILD_HOST=\"$(KBUILD_TARGET)\" \ -DKBUILD_HOST_ARCH=\"$(KBUILD_TARGET_ARCH)\" \ -DKBUILD_HOST_CPU=\"$(KBUILD_TARGET_CPU)\" \ \ -DKBUILD_SVN_REV=1 \ -DKBUILD_VERSION_MAJOR=0 \ -DKBUILD_VERSION_MINOR=1 \ -DKBUILD_VERSION_PATCH=9998 \ \ -DCONFIG_WITH_KMK_BUILTIN \ @DEFS@ AM_CPPFLAGS = $(GLOBINC) -I$(srcdir)/../lib -I$(srcdir)/../lib/kStuff/include AM_CFLAGS = $(GUILE_CFLAGS) # Only process if target is MS-Windows if WINDOWSENV AM_CPPFLAGS += $(W32INC) endif # Extra stuff to include in the distribution. EXTRA_DIST = ChangeLog README build.sh.in $(man_MANS) \ README.customs README.OS2 \ SCOPTIONS SMakefile \ README.Amiga Makefile.ami config.ami make.lnk amiga.c amiga.h \ README.DOS Makefile.DOS configure.bat dosbuild.bat configh.dos\ README.W32 NMakefile config.h.W32 build_w32.bat subproc.bat \ make_msvc_net2003.sln make_msvc_net2003.vcproj \ README.VMS makefile.vms makefile.com config.h-vms \ vmsdir.h vmsfunctions.c vmsify.c vms_exit.c vms_progname.c \ vms_export_symbol.c vms_export_symbol_test.com \ gmk-default.scm gmk-default.h # This is built during configure, but behind configure's back DISTCLEANFILES = build.sh # --------------- Internationalization Section localedir = $(datadir)/locale # --------------- Local INSTALL Section # If necessary, change the gid of the app and turn on the setgid flag. # # Whether or not make needs to be installed setgid. # The value should be either 'true' or 'false'. # On many systems, the getloadavg function (used to implement the '-l' # switch) will not work unless make is installed setgid kmem. # inst_setgid = @NEED_SETGID@ # Install make setgid to this group so it can get the load average. # inst_group = @KMEM_GROUP@ install-exec-local: @if $(inst_setgid); then \ app=$(DESTDIR)$(bindir)/`echo $(bin_PROGRAMS)|sed '$(transform)'`; \ if chgrp $(inst_group) $$app && chmod g+s $$app; then \ echo "chgrp $(inst_group) $$app && chmod g+s $$app"; \ else \ echo "$$app needs to be owned by group $(inst_group) and setgid;"; \ echo "otherwise the '-l' option will probably not work."; \ echo "You may need special privileges to complete the installation"; \ echo "of $$app."; \ fi; \ else true; fi # --------------- Generate the Guile default module content guile.$(OBJEXT): gmk-default.h gmk-default.h: $(srcdir)/gmk-default.scm (echo 'static const char *const GUILE_module_defn = " '\\ \ && sed -e 's/;.*//' -e '/^[ \t]*$$/d' -e 's/"/\\"/g' -e 's/$$/ \\/' \ $(srcdir)/gmk-default.scm \ && echo '";') > $@ # --------------- Local DIST Section # Install the w32 and tests subdirectories # dist-hook: (cd $(srcdir); \ sub=`find w32 tests -follow \( -name .git -o -name .deps -o -name work -o -name .gitignore -o -name \*.orig -o -name \*.rej -o -name \*~ -o -name Makefile \) -prune -o -type f -print`; \ tar chf - $$sub) \ | (cd $(distdir); tar xfBp -) # --------------- Local CHECK Section check-local: check-regression check-loadavg @banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \ dashes=`echo "$$banner" | sed s/./=/g`; \ echo; \ echo "$$dashes"; \ echo "$$banner"; \ echo "$$dashes"; \ echo .PHONY: check-loadavg check-regression check-loadavg: loadavg$(EXEEXT) @echo The system uptime program believes the load average to be: -uptime @echo The GNU load average checking code thinks: -./loadavg$(EXEEXT) # The loadavg function is invoked during "make check" to test getloadavg. check_PROGRAMS = loadavg nodist_loadavg_SOURCES = getloadavg.c loadavg_CPPFLAGS = -DTEST loadavg_LDADD = @GETLOADAVG_LIBS@ # > check-regression # # Look for the make test suite, and run it if found and we can find perl. # If we're building outside the tree, we use symlinks to make a local copy of # the test suite. Unfortunately the test suite itself isn't localizable yet. # MAKETESTFLAGS = check-regression: tests/config-flags.pm @if test -f '$(srcdir)/tests/run_make_tests'; then \ ulimit -n 128; \ if $(PERL) -v >/dev/null 2>&1; then \ case `cd '$(srcdir)'; pwd` in `pwd`) : ;; \ *) test -d tests || mkdir tests; \ rm -f srctests; \ if ln -s '$(srcdir)/tests' srctests; then \ for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \ rm -f tests/$$f; ln -s ../srctests/$$f tests; \ done; fi ;; \ esac; \ echo "cd tests && $(PERL) ./run_make_tests.pl -srcdir $(abs_srcdir) -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \ cd tests && $(PERL) ./run_make_tests.pl -srcdir '$(abs_srcdir)' -make '../make$(EXEEXT)' $(MAKETESTFLAGS); \ else \ echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \ fi; \ else \ echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \ fi # --------------- Maintainer's Section # Tell automake that I haven't forgotten about this file and it will be # created before we build a distribution (see maintMakefile in the Git # distribution). README: @MAINT_MAKEFILE@ kbuild-3608/src/kmk/kmk_cc_exec.h0000664000175000017500000000323114670377413016676 0ustar locutuslocutus/* $Id: kmk_cc_exec.h 3154 2018-03-15 23:35:33Z bird $ */ /** @file * kmk_cc - Make "Compiler". */ /* * Copyright (c) 2015-2017 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ #ifndef ___kmk_cc_and_exec_h #define ___kmk_cc_and_exec_h #ifdef CONFIG_WITH_COMPILER #include void kmk_cc_init(void); void kmk_cc_print_stats(void); struct variable; extern struct kmk_cc_expandprog *kmk_cc_compile_variable_for_expand(struct variable *pVar); extern struct kmk_cc_evalprog *kmk_cc_compile_variable_for_eval(struct variable *pVar); extern struct kmk_cc_evalprog *kmk_cc_compile_file_for_eval(FILE *pFile, const char *pszFilename); extern char *kmk_exec_expand_to_var_buf(struct variable *pVar, char *pchDst); extern void kmk_exec_eval_file(struct kmk_cc_evalprog *pProg); extern void kmk_exec_eval_variable(struct variable *pVar); extern void kmk_cc_variable_changed(struct variable *pVar); extern void kmk_cc_variable_deleted(struct variable *pVar); #endif /* CONFIG_WITH_COMPILER */ #endif kbuild-3608/src/kmk/make.lnk0000664000175000017500000000056414670377414015724 0ustar locutuslocutusFROM LIB:cres.o "commands.o"+"job.o"+"dir.o"+"file.o"+"misc.o"+"main.o"+"read.o"+"remake.o"+"rule.o"+"implicit.o"+"default.o"+"variable.o"+"expand.o"+"function.o"+"vpath.o"+"version.o"+"ar.o"+"arscan.o"+"signame.o"+"remote-stub.o"+"getopt.o"+"getopt1.o"+"alloca.o"+"amiga.o"+"hash.o"+"strcache.o"+"output.o" TO "make.new" LIB glob/glob.lib LIB:sc.lib LIB:amiga.lib QUIET kbuild-3608/src/kmk/job.c0000664000175000017500000036160514670377413015224 0ustar locutuslocutus/* Job execution and handling for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #include #include "job.h" #include "debug.h" #include "filedef.h" #include "commands.h" #include "variable.h" #include "os.h" #ifdef CONFIG_WITH_KMK_BUILTIN # include "kmkbuiltin.h" #endif #ifdef KMK # include "kbuild.h" #endif #include /* Default shell to use. */ #ifdef WINDOWS32 #include const char *default_shell = "sh.exe"; int no_default_sh_exe = 1; int batch_mode_shell = 1; # ifndef CONFIG_NEW_WIN32_CTRL_EVENT HANDLE main_thread; # endif #elif defined (_AMIGA) const char *default_shell = ""; extern int MyExecute (char **); int batch_mode_shell = 0; #elif defined (__MSDOS__) /* The default shell is a pointer so we can change it if Makefile says so. It is without an explicit path so we get a chance to search the $PATH for it (since MSDOS doesn't have standard directories we could trust). */ const char *default_shell = "command.com"; int batch_mode_shell = 0; #elif defined (__EMX__) const char *default_shell = "sh.exe"; /* bird changed this from "/bin/sh" as that doesn't make sense on OS/2. */ int batch_mode_shell = 0; #elif defined (VMS) # include # include const char *default_shell = ""; int batch_mode_shell = 0; #define strsignal vms_strsignal char * vms_strsignal (int status); #ifndef C_FACILITY_NO # define C_FACILITY_NO 0x350000 #endif #ifndef VMS_POSIX_EXIT_MASK # define VMS_POSIX_EXIT_MASK (C_FACILITY_NO | 0xA000) #endif #else const char *default_shell = "/bin/sh"; int batch_mode_shell = 0; #endif #ifdef __MSDOS__ # include static int execute_by_shell; static int dos_pid = 123; int dos_status; int dos_command_running; #endif /* __MSDOS__ */ #ifdef _AMIGA # include static int amiga_pid = 123; static int amiga_status; static char amiga_bname[32]; static int amiga_batch_file; #endif /* Amiga. */ #ifdef VMS # ifndef __GNUC__ # include # endif # include # include static void vmsWaitForChildren (int *); #endif #ifdef WINDOWS32 # include # include # include # ifdef CONFIG_NEW_WIN_CHILDREN # include "w32/winchildren.h" # else # include "sub_proc.h" # endif # include "w32err.h" # include "pathstuff.h" # define WAIT_NOHANG 1 #endif /* WINDOWS32 */ #ifdef __EMX__ # include #endif #if defined (HAVE_SYS_WAIT_H) || defined (HAVE_UNION_WAIT) # include #endif #ifdef HAVE_WAITPID # define WAIT_NOHANG(status) waitpid (-1, (status), WNOHANG) #else /* Don't have waitpid. */ # ifdef HAVE_WAIT3 # ifndef wait3 extern int wait3 (); # endif # define WAIT_NOHANG(status) wait3 ((status), WNOHANG, (struct rusage *) 0) # endif /* Have wait3. */ #endif /* Have waitpid. */ #if !defined (wait) && !defined (POSIX) int wait (); #endif #ifndef HAVE_UNION_WAIT # define WAIT_T int # ifndef WTERMSIG # define WTERMSIG(x) ((x) & 0x7f) # endif # ifndef WCOREDUMP # define WCOREDUMP(x) ((x) & 0x80) # endif # ifndef WEXITSTATUS # define WEXITSTATUS(x) (((x) >> 8) & 0xff) # endif # ifndef WIFSIGNALED # define WIFSIGNALED(x) (WTERMSIG (x) != 0) # endif # ifndef WIFEXITED # define WIFEXITED(x) (WTERMSIG (x) == 0) # endif #else /* Have 'union wait'. */ # define WAIT_T union wait # ifndef WTERMSIG # define WTERMSIG(x) ((x).w_termsig) # endif # ifndef WCOREDUMP # define WCOREDUMP(x) ((x).w_coredump) # endif # ifndef WEXITSTATUS # define WEXITSTATUS(x) ((x).w_retcode) # endif # ifndef WIFSIGNALED # define WIFSIGNALED(x) (WTERMSIG(x) != 0) # endif # ifndef WIFEXITED # define WIFEXITED(x) (WTERMSIG(x) == 0) # endif #endif /* Don't have 'union wait'. */ #if !defined(HAVE_UNISTD_H) && !defined(WINDOWS32) # ifndef _MSC_VER /* bird */ int dup2 (); int execve (); void _exit (); # endif /* bird */ # ifndef VMS int geteuid (); int getegid (); int setgid (); int getgid (); # endif #endif /* Different systems have different requirements for pid_t. Plus we have to support gettext string translation... Argh. */ static const char * pid2str (pid_t pid) { static char pidstring[100]; #if defined(WINDOWS32) && (__GNUC__ > 3 || _MSC_VER > 1300) /* %Id is only needed for 64-builds, which were not supported by older versions of Windows compilers. */ sprintf (pidstring, "%Id", pid); #else sprintf (pidstring, "%lu", (unsigned long) pid); #endif return pidstring; } #ifndef HAVE_GETLOADAVG int getloadavg (double loadavg[], int nelem); #endif static void free_child (struct child *); static void start_job_command (struct child *child); static int load_too_high (void); static int job_next_command (struct child *); static int start_waiting_job (struct child *); #ifdef CONFIG_WITH_PRINT_TIME_SWITCH static void print_job_time (struct child *); #endif /* Chain of all live (or recently deceased) children. */ struct child *children = 0; /* Number of children currently running. */ unsigned int job_slots_used = 0; /* Nonzero if the 'good' standard input is in use. */ static int good_stdin_used = 0; /* Chain of children waiting to run until the load average goes down. */ static struct child *waiting_jobs = 0; /* Non-zero if we use a *real* shell (always so on Unix). */ int unixy_shell = 1; /* Number of jobs started in the current second. */ unsigned long job_counter = 0; /* Number of jobserver tokens this instance is currently using. */ unsigned int jobserver_tokens = 0; #ifdef WINDOWS32 # ifndef CONFIG_NEW_WIN_CHILDREN /* (only used by commands.c) */ /* * The macro which references this function is defined in makeint.h. */ int w32_kill (pid_t pid, int sig) { return ((process_kill ((HANDLE)pid, sig) == TRUE) ? 0 : -1); } # endif /* !CONFIG_NEW_WIN_CHILDREN */ /* This function creates a temporary file name with an extension specified * by the unixy arg. * Return an xmalloc'ed string of a newly created temp file and its * file descriptor, or die. */ static char * create_batch_file (char const *base, int unixy, int *fd) { const char *const ext = unixy ? "sh" : "bat"; const char *error_string = NULL; char temp_path[MAXPATHLEN]; /* need to know its length */ unsigned path_size = GetTempPath (sizeof temp_path, temp_path); int path_is_dot = 0; /* The following variable is static so we won't try to reuse a name that was generated a little while ago, because that file might not be on disk yet, since we use FILE_ATTRIBUTE_TEMPORARY below, which tells the OS it doesn't need to flush the cache to disk. If the file is not yet on disk, we might think the name is available, while it really isn't. This happens in parallel builds, where Make doesn't wait for one job to finish before it launches the next one. */ static unsigned uniq = 0; static int second_loop = 0; const unsigned sizemax = strlen (base) + strlen (ext) + 10; if (path_size == 0) { path_size = GetCurrentDirectory (sizeof temp_path, temp_path); path_is_dot = 1; } ++uniq; if (uniq >= 0x10000 && !second_loop) { /* If we already had 64K batch files in this process, make a second loop through the numbers, looking for free slots, i.e. files that were deleted in the meantime. */ second_loop = 1; uniq = 1; } while (path_size > 0 && path_size + sizemax < sizeof temp_path && !(uniq >= 0x10000 && second_loop)) { unsigned size = sprintf (temp_path + path_size, "%s%s-%x.%s", temp_path[path_size - 1] == '\\' ? "" : "\\", base, uniq, ext); HANDLE h = CreateFile (temp_path, /* file name */ GENERIC_READ | GENERIC_WRITE, /* desired access */ 0, /* no share mode */ NULL, /* default security attributes */ CREATE_NEW, /* creation disposition */ FILE_ATTRIBUTE_NORMAL | /* flags and attributes */ FILE_ATTRIBUTE_TEMPORARY, /* we'll delete it */ NULL); /* no template file */ if (h == INVALID_HANDLE_VALUE) { const DWORD er = GetLastError (); if (er == ERROR_FILE_EXISTS || er == ERROR_ALREADY_EXISTS) { ++uniq; if (uniq == 0x10000 && !second_loop) { second_loop = 1; uniq = 1; } } /* the temporary path is not guaranteed to exist */ else if (path_is_dot == 0) { path_size = GetCurrentDirectory (sizeof temp_path, temp_path); path_is_dot = 1; } else { error_string = map_windows32_error_to_string (er); break; } } else { const unsigned final_size = path_size + size + 1; char *const path = xmalloc (final_size); memcpy (path, temp_path, final_size); *fd = _open_osfhandle ((intptr_t)h, 0); if (unixy) { char *p; int ch; for (p = path; (ch = *p) != 0; ++p) if (ch == '\\') *p = '/'; } return path; /* good return */ } } *fd = -1; if (error_string == NULL) error_string = _("Cannot create a temporary file\n"); O (fatal, NILF, error_string); /* not reached */ return NULL; } #endif /* WINDOWS32 */ #ifdef __EMX__ /* returns whether path is assumed to be a unix like shell. */ int _is_unixy_shell (const char *path) { /* list of non unix shells */ const char *known_os2shells[] = { "cmd.exe", "cmd", "4os2.exe", "4os2", "4dos.exe", "4dos", "command.com", "command", NULL }; /* find the rightmost '/' or '\\' */ const char *name = strrchr (path, '/'); const char *p = strrchr (path, '\\'); unsigned i; if (name && p) /* take the max */ name = (name > p) ? name : p; else if (p) /* name must be 0 */ name = p; else if (!name) /* name and p must be 0 */ name = path; if (*name == '/' || *name == '\\') name++; i = 0; while (known_os2shells[i] != NULL) { if (strcasecmp (name, known_os2shells[i]) == 0) return 0; /* not a unix shell */ i++; } /* in doubt assume a unix like shell */ return 1; } #endif /* __EMX__ */ /* determines whether path looks to be a Bourne-like shell. */ int is_bourne_compatible_shell (const char *path) { /* List of known POSIX (or POSIX-ish) shells. */ static const char *unix_shells[] = { "sh", "bash", "ksh", "rksh", "zsh", "ash", "dash", NULL }; const char **s; /* find the rightmost '/' or '\\' */ const char *name = strrchr (path, '/'); char *p = strrchr (path, '\\'); if (name && p) /* take the max */ name = (name > p) ? name : p; else if (p) /* name must be 0 */ name = p; else if (!name) /* name and p must be 0 */ name = path; if (*name == '/' || *name == '\\') ++name; /* this should be able to deal with extensions on Windows-like systems */ for (s = unix_shells; *s != NULL; ++s) { #if defined(WINDOWS32) || defined(__MSDOS__) unsigned int len = strlen (*s); if ((strlen (name) >= len && STOP_SET (name[len], MAP_DOT|MAP_NUL)) && strncasecmp (name, *s, len) == 0) #else if (strcmp (name, *s) == 0) #endif return 1; /* a known unix-style shell */ } /* if not on the list, assume it's not a Bourne-like shell */ return 0; } /* Write an error message describing the exit status given in EXIT_CODE, EXIT_SIG, and COREDUMP, for the target TARGET_NAME. Append "(ignored)" if IGNORED is nonzero. */ static void child_error (struct child *child, int exit_code, int exit_sig, int coredump, int ignored) { const char *pre = "*** "; const char *post = ""; const char *dump = ""; const struct file *f = child->file; const floc *flocp = &f->cmds->fileinfo; const char *nm; size_t l; if (ignored && silent_flag) return; if (exit_sig && coredump) dump = _(" (core dumped)"); if (ignored) { pre = ""; post = _(" (ignored)"); } if (! flocp->filenm) nm = _(""); else { char *a = alloca (strlen (flocp->filenm) + 1 + 11 + 1); sprintf (a, "%s:%lu", flocp->filenm, flocp->lineno + flocp->offset); nm = a; } l = strlen (pre) + strlen (nm) + strlen (f->name) + strlen (post); OUTPUT_SET (&child->output); show_goal_error (); if (exit_sig == 0) # if defined(KMK) && defined(KBUILD_OS_WINDOWS) { const char *exit_name = NULL; switch ((unsigned)exit_code) { case 0xc0000005U: exit_name = "STATUS_ACCESS_VIOLATION"; break; case 0xc000013aU: exit_name = "STATUS_CONTROL_C_EXIT"; break; case 0xc0000374U: exit_name = "STATUS_HEAP_CORRUPTION"; break; case 0xc0000409U: exit_name = "STATUS_STACK_BUFFER_OVERRUN"; break; case 0xc0000417U: exit_name = "STATUS_INVALID_CRUNTIME_PARAMETER"; break; case 0x80000003U: exit_name = "STATUS_BREAKPOINT"; break; case 0x40000015U: exit_name = "STATUS_FATAL_APP_EXIT"; break; case 0x40010004U: exit_name = "DBG_TERMINATE_PROCESS"; break; case 0x40010005U: exit_name = "DBG_CONTROL_C"; break; case 0x40010008U: exit_name = "DBG_CONTROL_BREAK"; break; } if (exit_name) error (NILF, l + strlen (exit_name) + INTSTR_LENGTH, _("%s[%s: %s] Error %d (%s)%s"), pre, nm, f->name, exit_code, exit_name, post); else error (NILF, l + INTSTR_LENGTH + INTSTR_LENGTH, _("%s[%s: %s] Error %d (%#x)%s"), pre, nm, f->name, exit_code, exit_code, post); } # else error (NILF, l + INTSTR_LENGTH, _("%s[%s: %s] Error %d%s"), pre, nm, f->name, exit_code, post); # endif else { const char *s = strsignal (exit_sig); error (NILF, l + strlen (s) + strlen (dump), "%s[%s: %s] %s%s%s", pre, nm, f->name, s, dump, post); } OUTPUT_UNSET (); } /* Handle a dead child. This handler may or may not ever be installed. If we're using the jobserver feature without pselect(), we need it. First, installing it ensures the read will interrupt on SIGCHLD. Second, we close the dup'd read FD to ensure we don't enter another blocking read without reaping all the dead children. In this case we don't need the dead_children count. If we don't have either waitpid or wait3, then make is unreliable, but we use the dead_children count to reap children as best we can. */ static unsigned int dead_children = 0; RETSIGTYPE child_handler (int sig UNUSED) { ++dead_children; jobserver_signal (); #if defined __EMX__ && !defined(__INNOTEK_LIBC__) /* bird */ /* The signal handler must called only once! */ signal (SIGCHLD, SIG_DFL); #endif } extern pid_t shell_function_pid; /* Reap all dead children, storing the returned status and the new command state ('cs_finished') in the 'file' member of the 'struct child' for the dead child, and removing the child from the chain. In addition, if BLOCK nonzero, we block in this function until we've reaped at least one complete child, waiting for it to die if necessary. If ERR is nonzero, print an error message first. */ void reap_children (int block, int err) { #ifndef WINDOWS32 WAIT_T status; #endif /* Initially, assume we have some. */ int reap_more = 1; #ifdef WAIT_NOHANG # define REAP_MORE reap_more #else # define REAP_MORE dead_children #endif /* As long as: We have at least one child outstanding OR a shell function in progress, AND We're blocking for a complete child OR there are more children to reap we'll keep reaping children. */ while ((children != 0 || shell_function_pid != 0) && (block || REAP_MORE)) { unsigned int remote = 0; pid_t pid; int exit_code, exit_sig, coredump; struct child *lastc, *c; int child_failed; int any_remote, any_local; int dontcare; #ifdef CONFIG_WITH_KMK_BUILTIN struct child *completed_child = NULL; #endif if (err && block) { static int printed = 0; /* We might block for a while, so let the user know why. Only print this message once no matter how many jobs are left. */ fflush (stdout); if (!printed) O (error, NILF, _("*** Waiting for unfinished jobs....")); printed = 1; } /* We have one less dead child to reap. As noted in child_handler() above, this count is completely unimportant for all modern, POSIX-y systems that support wait3() or waitpid(). The rest of this comment below applies only to early, broken pre-POSIX systems. We keep the count only because... it's there... The test and decrement are not atomic; if it is compiled into: register = dead_children - 1; dead_children = register; a SIGCHLD could come between the two instructions. child_handler increments dead_children. The second instruction here would lose that increment. But the only effect of dead_children being wrong is that we might wait longer than necessary to reap a child, and lose some parallelism; and we might print the "Waiting for unfinished jobs" message above when not necessary. */ if (dead_children > 0) --dead_children; any_remote = 0; any_local = shell_function_pid != 0; for (c = children; c != 0; c = c->next) { any_remote |= c->remote; any_local |= ! c->remote; #ifdef CONFIG_WITH_KMK_BUILTIN if (c->has_status) { completed_child = c; DB (DB_JOBS, (_("builtin child %p (%s) PID %s %s Status %ld\n"), (void *)c, c->file->name, pid2str (c->pid), c->remote ? _(" (remote)") : "", (long) c->status)); } else #endif DB (DB_JOBS, (_("Live child %p (%s) PID %s %s\n"), (void *)c, c->file->name, pid2str (c->pid), c->remote ? _(" (remote)") : "")); #ifdef VMS break; #endif } /* First, check for remote children. */ if (any_remote) pid = remote_status (&exit_code, &exit_sig, &coredump, 0); else pid = 0; if (pid > 0) /* We got a remote child. */ remote = 1; else if (pid < 0) { /* A remote status command failed miserably. Punt. */ remote_status_lose: pfatal_with_name ("remote_status"); } else { /* No remote children. Check for local children. */ #ifdef CONFIG_WITH_KMK_BUILTIN if (completed_child) { pid = completed_child->pid; # if defined(WINDOWS32) exit_code = completed_child->status; exit_sig = 0; coredump = 0; # else status = (WAIT_T)completed_child->status; # endif } else #endif /* CONFIG_WITH_KMK_BUILTIN */ #if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32) if (any_local) { #ifdef VMS /* Todo: This needs more untangling multi-process support */ /* Just do single child process support now */ vmsWaitForChildren (&status); pid = c->pid; /* VMS failure status can not be fully translated */ status = $VMS_STATUS_SUCCESS (c->cstatus) ? 0 : (1 << 8); /* A Posix failure can be exactly translated */ if ((c->cstatus & VMS_POSIX_EXIT_MASK) == VMS_POSIX_EXIT_MASK) status = (c->cstatus >> 3 & 255) << 8; #else #ifdef WAIT_NOHANG if (!block) pid = WAIT_NOHANG (&status); else #endif EINTRLOOP (pid, wait (&status)); #endif /* !VMS */ } else pid = 0; if (pid < 0) { /* The wait*() failed miserably. Punt. */ pfatal_with_name ("wait"); } else if (pid > 0) { /* We got a child exit; chop the status word up. */ exit_code = WEXITSTATUS (status); exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0; coredump = WCOREDUMP (status); /* If we have started jobs in this second, remove one. */ if (job_counter) --job_counter; } else { /* No local children are dead. */ reap_more = 0; if (!block || !any_remote) break; /* Now try a blocking wait for a remote child. */ pid = remote_status (&exit_code, &exit_sig, &coredump, 1); if (pid < 0) goto remote_status_lose; else if (pid == 0) /* No remote children either. Finally give up. */ break; /* We got a remote child. */ remote = 1; } #endif /* !__MSDOS__, !Amiga, !WINDOWS32. */ #ifdef __MSDOS__ /* Life is very different on MSDOS. */ pid = dos_pid - 1; status = dos_status; exit_code = WEXITSTATUS (status); if (exit_code == 0xff) exit_code = -1; exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0; coredump = 0; #endif /* __MSDOS__ */ #ifdef _AMIGA /* Same on Amiga */ pid = amiga_pid - 1; status = amiga_status; exit_code = amiga_status; exit_sig = 0; coredump = 0; #endif /* _AMIGA */ #ifdef WINDOWS32 { # ifndef CONFIG_NEW_WIN_CHILDREN HANDLE hPID; HANDLE hcTID, hcPID; DWORD dwWaitStatus = 0; exit_code = 0; exit_sig = 0; coredump = 0; # ifndef CONFIG_NEW_WIN32_CTRL_EVENT /* Record the thread ID of the main process, so that we could suspend it in the signal handler. */ if (!main_thread) { hcTID = GetCurrentThread (); hcPID = GetCurrentProcess (); if (!DuplicateHandle (hcPID, hcTID, hcPID, &main_thread, 0, FALSE, DUPLICATE_SAME_ACCESS)) { DWORD e = GetLastError (); fprintf (stderr, "Determine main thread ID (Error %ld: %s)\n", e, map_windows32_error_to_string (e)); } else DB (DB_VERBOSE, ("Main thread handle = %p\n", main_thread)); } # endif /* wait for anything to finish */ hPID = process_wait_for_any (block, &dwWaitStatus); if (hPID) { /* was an error found on this process? */ int werr = process_last_err (hPID); /* get exit data */ exit_code = process_exit_code (hPID); if (werr) fprintf (stderr, "make (e=%d): %s", exit_code, map_windows32_error_to_string (exit_code)); /* signal */ exit_sig = process_signal (hPID); /* cleanup process */ process_cleanup (hPID); coredump = 0; } else if (dwWaitStatus == WAIT_FAILED) { /* The WaitForMultipleObjects() failed miserably. Punt. */ pfatal_with_name ("WaitForMultipleObjects"); } else if (dwWaitStatus == WAIT_TIMEOUT) { /* No child processes are finished. Give up waiting. */ reap_more = 0; break; } pid = (pid_t) hPID; # else /* CONFIG_NEW_WIN_CHILDREN */ # ifndef CONFIG_NEW_WIN32_CTRL_EVENT /* Ctrl-C handler needs to suspend the main thread handle to prevent mayhem when concurrently calling reap_children. */ if ( !main_thread && !DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), GetCurrentProcess (), &main_thread, 0, FALSE, DUPLICATE_SAME_ACCESS)) fprintf (stderr, "Failed to duplicate main thread handle: %u\n", GetLastError ()); # endif assert (!any_remote); pid = 0; coredump = exit_sig = exit_code = 0; { int rc = MkWinChildWait(block, &pid, &exit_code, &exit_sig, &coredump, &c); if (rc != 0) ON (fatal, NILF, _("MkWinChildWait: %u"), rc); } if (pid == 0) { /* No more children, stop. */ reap_more = 0; break; } /* If we have started jobs in this second, remove one. */ if (job_counter) --job_counter; # endif /* CONFIG_NEW_WIN_CHILDREN */ } #endif /* WINDOWS32 */ } /* Check if this is the child of the 'shell' function. */ if (!remote && pid == shell_function_pid) { shell_completed (exit_code, exit_sig); break; } /* Search for a child matching the deceased one. */ lastc = 0; for (c = children; c != 0; lastc = c, c = c->next) if (c->pid == pid && c->remote == remote) break; if (c == 0) /* An unknown child died. Ignore it; it was inherited from our invoker. */ continue; /* Determine the failure status: 0 for success, 1 for updating target in question mode, 2 for anything else. */ if (exit_sig == 0 && exit_code == 0) child_failed = MAKE_SUCCESS; else if (exit_sig == 0 && exit_code == 1 && question_flag && c->recursive) child_failed = MAKE_TROUBLE; else child_failed = MAKE_FAILURE; DB (DB_JOBS, (child_failed ? _("Reaping losing child %p PID %s %s\n") : _("Reaping winning child %p PID %s %s\n"), (void *)c, pid2str (c->pid), c->remote ? _(" (remote)") : "")); if (c->sh_batch_file) { int rm_status; DB (DB_JOBS, (_("Cleaning up temp batch file %s\n"), c->sh_batch_file)); errno = 0; rm_status = remove (c->sh_batch_file); if (rm_status) DB (DB_JOBS, (_("Cleaning up temp batch file %s failed (%d)\n"), c->sh_batch_file, errno)); /* all done with memory */ free (c->sh_batch_file); c->sh_batch_file = NULL; } /* If this child had the good stdin, say it is now free. */ if (c->good_stdin) good_stdin_used = 0; dontcare = c->dontcare; if (child_failed && !c->noerror && !ignore_errors_flag) { /* The commands failed. Write an error message, delete non-precious targets, and abort. */ static int delete_on_error = -1; if (!dontcare && child_failed == MAKE_FAILURE) #ifdef KMK { child_error (c, exit_code, exit_sig, coredump, 0); if ( ( c->file->cmds->lines_flags[c->command_line - 1] & (COMMANDS_SILENT | COMMANDS_RECURSE)) == COMMANDS_SILENT # ifdef KBUILD_OS_WINDOWS /* show commands for NT statuses */ || (exit_code & 0xc0000000) # endif || exit_sig != 0) OS (message, 0, "The failing command:\n%s", c->file->cmds->command_lines[c->command_line - 1]); } #else /* !KMK */ child_error (c, exit_code, exit_sig, coredump, 0); #endif /* !KMK */ c->file->update_status = child_failed == MAKE_FAILURE ? us_failed : us_question; if (delete_on_error == -1) { struct file *f = lookup_file (".DELETE_ON_ERROR"); delete_on_error = f != 0 && f->is_target; } if (exit_sig != 0 || delete_on_error) delete_child_targets (c); } else { if (child_failed) { /* The commands failed, but we don't care. */ child_error (c, exit_code, exit_sig, coredump, 1); child_failed = 0; } /* If there are more commands to run, try to start them. */ if (job_next_command (c)) { if (handling_fatal_signal) { /* Never start new commands while we are dying. Since there are more commands that wanted to be run, the target was not completely remade. So we treat this as if a command had failed. */ c->file->update_status = us_failed; } else { #ifndef NO_OUTPUT_SYNC /* If we're sync'ing per line, write the previous line's output before starting the next one. */ if (output_sync == OUTPUT_SYNC_LINE) output_dump (&c->output); #endif /* Check again whether to start remotely. Whether or not we want to changes over time. Also, start_remote_job may need state set up by start_remote_job_p. */ c->remote = start_remote_job_p (0); start_job_command (c); /* Fatal signals are left blocked in case we were about to put that child on the chain. But it is already there, so it is safe for a fatal signal to arrive now; it will clean up this child's targets. */ unblock_sigs (); if (c->file->command_state == cs_running) /* We successfully started the new command. Loop to reap more children. */ continue; } if (c->file->update_status != us_success) /* We failed to start the commands. */ delete_child_targets (c); } else /* There are no more commands. We got through them all without an unignored error. Now the target has been successfully updated. */ c->file->update_status = us_success; } /* When we get here, all the commands for c->file are finished. */ #ifndef NO_OUTPUT_SYNC /* Synchronize any remaining parallel output. */ # ifdef KMK c->output.dont_truncate = !err && child_failed && !dontcare && !keep_going_flag && !handling_fatal_signal; # endif output_dump (&c->output); #endif /* At this point c->file->update_status is success or failed. But c->file->command_state is still cs_running if all the commands ran; notice_finish_file looks for cs_running to tell it that it's interesting to check the file's modtime again now. */ if (! handling_fatal_signal) /* Notice if the target of the commands has been changed. This also propagates its values for command_state and update_status to its also_make files. */ notice_finished_file (c->file); DB (DB_JOBS, (_("Removing child %p PID %s%s from chain.\n"), (void *)c, pid2str (c->pid), c->remote ? _(" (remote)") : "")); /* Block fatal signals while frobnicating the list, so that children and job_slots_used are always consistent. Otherwise a fatal signal arriving after the child is off the chain and before job_slots_used is decremented would believe a child was live and call reap_children again. */ block_sigs (); /* There is now another slot open. */ if (job_slots_used > 0) --job_slots_used; /* Remove the child from the chain and free it. */ if (lastc == 0) children = c->next; else lastc->next = c->next; #ifdef KMK /* Repeat the error */ /* If the job failed, and the -k flag was not given, die, unless we are already in the process of dying. */ if (!err && child_failed && !dontcare && !keep_going_flag && /* fatal_error_signal will die with the right signal. */ !handling_fatal_signal) { unblock_sigs (); die_with_job_output (child_failed, &c->output); } #endif free_child (c); unblock_sigs (); #ifndef KMK /* See above. */ /* If the job failed, and the -k flag was not given, die, unless we are already in the process of dying. */ if (!err && child_failed && !dontcare && !keep_going_flag && /* fatal_error_signal will die with the right signal. */ !handling_fatal_signal) die (child_failed); #endif /* Only block for one child. */ block = 0; } return; } /* Free the storage allocated for CHILD. */ static void free_child (struct child *child) { #ifdef CONFIG_WITH_PRINT_TIME_SWITCH print_job_time (child); #endif output_close (&child->output); /* bird: Make sure the output_context doesn't point to a freed structure when we return from this function. This is probably an issue elsewhere in the code, however it doesn't cost us much fixing it here. (The access after free was caught in a die() scenario, both in error situations and successful ones.) */ if (output_context == &child->output) OUTPUT_UNSET(); if (!jobserver_tokens) ONS (fatal, NILF, "INTERNAL: Freeing child %p (%s) but no tokens left!\n", (void *)child, child->file->name); /* If we're using the jobserver and this child is not the only outstanding job, put a token back into the pipe for it. */ if (jobserver_enabled () && jobserver_tokens > 1) { jobserver_release (1); DB (DB_JOBS, (_("Released token for child %p (%s).\n"), (void *)child, child->file->name)); } --jobserver_tokens; if (handling_fatal_signal) /* Don't bother free'ing if about to die. */ return; if (child->command_lines != 0) { register unsigned int i; for (i = 0; i < child->file->cmds->ncommand_lines; ++i) free (child->command_lines[i]); free (child->command_lines); } if (child->environment != 0) { register char **ep = child->environment; while (*ep != 0) free (*ep++); free (child->environment); } #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS /* Free the chopped command lines for simple targets when there are no more active references to them. */ child->file->cmds->refs--; if ( !child->file->intermediate && !child->file->pat_variables) free_chopped_commands(child->file->cmds); #endif /* CONFIG_WITH_MEMORY_OPTIMIZATIONS */ free (child); } #ifdef POSIX extern sigset_t fatal_signal_set; #endif void block_sigs (void) { #ifdef POSIX (void) sigprocmask (SIG_BLOCK, &fatal_signal_set, (sigset_t *) 0); #else # ifdef HAVE_SIGSETMASK (void) sigblock (fatal_signal_mask); # endif #endif } #ifdef POSIX void unblock_sigs (void) { sigset_t empty; sigemptyset (&empty); sigprocmask (SIG_SETMASK, &empty, (sigset_t *) 0); } #endif /* Start a job to run the commands specified in CHILD. CHILD is updated to reflect the commands and ID of the child process. NOTE: On return fatal signals are blocked! The caller is responsible for calling 'unblock_sigs', once the new child is safely on the chain so it can be cleaned up in the event of a fatal signal. */ static void start_job_command (struct child *child) { int flags; char *p; #ifdef VMS char *argv; #else char **argv; #endif /* If we have a completely empty commandset, stop now. */ if (!child->command_ptr) goto next_command; #ifdef CONFIG_WITH_PRINT_TIME_SWITCH if (child->start_ts == -1) child->start_ts = nano_timestamp (); #endif /* Combine the flags parsed for the line itself with the flags specified globally for this target. */ flags = (child->file->command_flags | child->file->cmds->lines_flags[child->command_line - 1]); p = child->command_ptr; child->noerror = ((flags & COMMANDS_NOERROR) != 0); while (*p != '\0') { if (*p == '@') flags |= COMMANDS_SILENT; else if (*p == '+') flags |= COMMANDS_RECURSE; else if (*p == '-') child->noerror = 1; #ifdef CONFIG_WITH_COMMANDS_FUNC else if (*p == '%') flags |= COMMAND_GETTER_SKIP_IT; #endif /* Don't skip newlines. */ else if (!ISBLANK (*p)) #ifndef CONFIG_WITH_KMK_BUILTIN break; #else /* CONFIG_WITH_KMK_BUILTIN */ { if ( !(flags & COMMANDS_KMK_BUILTIN) && !strncmp(p, "kmk_builtin_", sizeof("kmk_builtin_") - 1)) flags |= COMMANDS_KMK_BUILTIN; break; } #endif /* CONFIG_WITH_KMK_BUILTIN */ ++p; } child->recursive = ((flags & COMMANDS_RECURSE) != 0); /* Update the file's command flags with any new ones we found. We only keep the COMMANDS_RECURSE setting. Even this isn't 100% correct; we are now marking more commands recursive than should be in the case of multiline define/endef scripts where only one line is marked "+". In order to really fix this, we'll have to keep a lines_flags for every actual line, after expansion. */ child->file->cmds->lines_flags[child->command_line - 1] |= flags & COMMANDS_RECURSE; /* POSIX requires that a recipe prefix after a backslash-newline should be ignored. Remove it now so the output is correct. */ { char prefix = child->file->cmds->recipe_prefix; char *p1, *p2; p1 = p2 = p; while (*p1 != '\0') { *(p2++) = *p1; if (p1[0] == '\n' && p1[1] == prefix) ++p1; ++p1; } *p2 = *p1; } /* Figure out an argument list from this command line. */ { char *end = 0; #ifdef VMS /* Skip any leading whitespace */ while (*p) { if (!ISSPACE (*p)) { if (*p != '\\') break; if ((p[1] != '\n') && (p[1] != 'n') && (p[1] != 't')) break; } p++; } argv = p; /* Although construct_command_argv contains some code for VMS, it was/is not called/used. Please note, for VMS argv is a string (not an array of strings) which contains the complete command line, which for multi-line variables still includes the newlines. So detect newlines and set 'end' (which is used for child->command_ptr) instead of (re-)writing construct_command_argv */ if (!one_shell) { char *s = p; int instring = 0; while (*s) { if (*s == '"') instring = !instring; else if (*s == '\\' && !instring && *(s+1) != 0) s++; else if (*s == '\n' && !instring) { end = s; break; } ++s; } } #else argv = construct_command_argv (p, &end, child->file, child->file->cmds->lines_flags[child->command_line - 1], &child->sh_batch_file); #endif if (end == NULL) child->command_ptr = NULL; else { *end++ = '\0'; child->command_ptr = end; } } /* If -q was given, say that updating 'failed' if there was any text on the command line, or 'succeeded' otherwise. The exit status of 1 tells the user that -q is saying 'something to do'; the exit status for a random error is 2. */ if (argv != 0 && question_flag && !(flags & COMMANDS_RECURSE)) { #ifndef VMS free (argv[0]); free (argv); #endif #ifdef VMS /* On VMS, argv[0] can be a null string here */ if (argv[0] != 0) { #endif child->file->update_status = us_question; notice_finished_file (child->file); return; #ifdef VMS } #endif } if (touch_flag && !(flags & COMMANDS_RECURSE)) { /* Go on to the next command. It might be the recursive one. We construct ARGV only to find the end of the command line. */ #ifndef VMS if (argv) { free (argv[0]); free (argv); } #endif argv = 0; } if (argv == 0) { next_command: #ifdef __MSDOS__ execute_by_shell = 0; /* in case construct_command_argv sets it */ #endif /* This line has no commands. Go to the next. */ if (job_next_command (child)) start_job_command (child); else { /* No more commands. Make sure we're "running"; we might not be if (e.g.) all commands were skipped due to -n. */ set_command_state (child->file, cs_running); child->file->update_status = us_success; notice_finished_file (child->file); } OUTPUT_UNSET(); return; } /* Are we going to synchronize this command's output? Do so if either we're in SYNC_RECURSE mode or this command is not recursive. We'll also check output_sync separately below in case it changes due to error. */ child->output.syncout = output_sync && (output_sync == OUTPUT_SYNC_RECURSE || !(flags & COMMANDS_RECURSE)); OUTPUT_SET (&child->output); #ifndef NO_OUTPUT_SYNC if (! child->output.syncout) /* We don't want to sync this command: to avoid misordered output ensure any already-synced content is written. */ output_dump (&child->output); #endif /* Print the command if appropriate. */ #ifdef CONFIG_PRETTY_COMMAND_PRINTING if ( pretty_command_printing && (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag)) && argv[0][0] != '\0') { unsigned i; for (i = 0; argv[i]; i++) OSSS ( message, 0, "%s'%s'%s", i ? "\t" : "> ", argv[i], argv[i + 1] ? " \\" : ""); } else #endif /* CONFIG_PRETTY_COMMAND_PRINTING */ if (just_print_flag || trace_flag || (!(flags & COMMANDS_SILENT) && !silent_flag)) OS (message, 0, "%s", p); /* Tell update_goal_chain that a command has been started on behalf of this target. It is important that this happens here and not in reap_children (where we used to do it), because reap_children might be reaping children from a different target. We want this increment to guaranteedly indicate that a command was started for the dependency chain (i.e., update_file recursion chain) we are processing. */ ++commands_started; /* Optimize an empty command. People use this for timestamp rules, so avoid forking a useless shell. Do this after we increment commands_started so make still treats this special case as if it performed some action (makes a difference as to what messages are printed, etc. */ #if !defined(VMS) && !defined(_AMIGA) if ( #if defined __MSDOS__ || defined (__EMX__) unixy_shell /* the test is complicated and we already did it */ #else (argv[0] && is_bourne_compatible_shell (argv[0])) #endif && (argv[1] && argv[1][0] == '-' && ((argv[1][1] == 'c' && argv[1][2] == '\0') || (argv[1][1] == 'e' && argv[1][2] == 'c' && argv[1][3] == '\0'))) && (argv[2] && argv[2][0] == ':' && argv[2][1] == '\0') && argv[3] == NULL) { free (argv[0]); free (argv); goto next_command; } #endif /* !VMS && !_AMIGA */ /* If -n was given, recurse to get the next line in the sequence. */ if (just_print_flag && !(flags & COMMANDS_RECURSE)) { #ifndef VMS free (argv[0]); free (argv); #endif goto next_command; } /* We're sure we're going to invoke a command: set up the output. */ output_start (); /* Flush the output streams so they won't have things written twice. */ fflush (stdout); fflush (stderr); #ifdef CONFIG_WITH_KMK_BUILTIN /* If builtin command then pass it on to the builtin shell interpreter. */ if ((flags & COMMANDS_KMK_BUILTIN) && !just_print_flag) { int rc; char **argv_spawn = NULL; char **p2 = argv; while (*p2 && strncmp (*p2, "kmk_builtin_", sizeof("kmk_builtin_") - 1)) p2++; assert (*p2); set_command_state (child->file, cs_running); child->deleted = 0; child->pid = 0; if (p2 != argv) rc = kmk_builtin_command (*p2, child, &argv_spawn, &child->pid); else { int argc = 1; while (argv[argc]) argc++; rc = kmk_builtin_command_parsed (argc, argv, child, &argv_spawn, &child->pid); } # ifndef VMS free (argv[0]); free ((char *) argv); # endif if (!rc) { /* spawned a child? */ if (child->pid) { ++job_counter; return; } /* synchronous command execution? */ if (!argv_spawn) goto next_command; } /* failure? */ if (rc) { child->pid = (pid_t)42424242; child->status = rc << 8; child->has_status = 1; unblock_sigs(); return; } /* conditional check == true; kicking off a child (not kmk_builtin_*). */ argv = argv_spawn; } #endif /* CONFIG_WITH_KMK_BUILTIN */ /* Decide whether to give this child the 'good' standard input (one that points to the terminal or whatever), or the 'bad' one that points to the read side of a broken pipe. */ child->good_stdin = !good_stdin_used; if (child->good_stdin) good_stdin_used = 1; child->deleted = 0; #ifndef _AMIGA /* Set up the environment for the child. */ if (child->environment == 0) child->environment = target_environment (child->file); #endif #if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32) #ifndef VMS /* start_waiting_job has set CHILD->remote if we can start a remote job. */ if (child->remote) { int is_remote, id, used_stdin; if (start_remote_job (argv, child->environment, child->good_stdin ? 0 : get_bad_stdin (), &is_remote, &id, &used_stdin)) /* Don't give up; remote execution may fail for various reasons. If so, simply run the job locally. */ goto run_local; else { if (child->good_stdin && !used_stdin) { child->good_stdin = 0; good_stdin_used = 0; } child->remote = is_remote; child->pid = id; } } else #endif /* !VMS */ { /* Fork the child process. */ char **parent_environ; run_local: block_sigs (); child->remote = 0; #ifdef VMS if (!child_execute_job (child, argv)) { /* Fork failed! */ perror_with_name ("fork", ""); goto error; } #else parent_environ = environ; jobserver_pre_child (flags & COMMANDS_RECURSE); child->pid = child_execute_job (&child->output, child->good_stdin, argv, child->environment); environ = parent_environ; /* Restore value child may have clobbered. */ jobserver_post_child (flags & COMMANDS_RECURSE); if (child->pid < 0) { /* Fork failed! */ unblock_sigs (); perror_with_name ("fork", ""); goto error; } #endif /* !VMS */ } #else /* __MSDOS__ or Amiga or WINDOWS32 */ #ifdef __MSDOS__ { int proc_return; block_sigs (); dos_status = 0; /* We call 'system' to do the job of the SHELL, since stock DOS shell is too dumb. Our 'system' knows how to handle long command lines even if pipes/redirection is needed; it will only call COMMAND.COM when its internal commands are used. */ if (execute_by_shell) { char *cmdline = argv[0]; /* We don't have a way to pass environment to 'system', so we need to save and restore ours, sigh... */ char **parent_environ = environ; environ = child->environment; /* If we have a *real* shell, tell 'system' to call it to do everything for us. */ if (unixy_shell) { /* A *real* shell on MSDOS may not support long command lines the DJGPP way, so we must use 'system'. */ cmdline = argv[2]; /* get past "shell -c" */ } dos_command_running = 1; proc_return = system (cmdline); environ = parent_environ; execute_by_shell = 0; /* for the next time */ } else { dos_command_running = 1; proc_return = spawnvpe (P_WAIT, argv[0], argv, child->environment); } /* Need to unblock signals before turning off dos_command_running, so that child's signals will be treated as such (see fatal_error_signal). */ unblock_sigs (); dos_command_running = 0; /* If the child got a signal, dos_status has its high 8 bits set, so be careful not to alter them. */ if (proc_return == -1) dos_status |= 0xff; else dos_status |= (proc_return & 0xff); ++dead_children; child->pid = dos_pid++; } #endif /* __MSDOS__ */ #ifdef _AMIGA amiga_status = MyExecute (argv); ++dead_children; child->pid = amiga_pid++; if (amiga_batch_file) { amiga_batch_file = 0; DeleteFile (amiga_bname); /* Ignore errors. */ } #endif /* Amiga */ #ifdef WINDOWS32 { # ifndef CONFIG_NEW_WIN_CHILDREN HANDLE hPID; char* arg0; int outfd = FD_STDOUT; int errfd = FD_STDERR; /* make UNC paths safe for CreateProcess -- backslash format */ arg0 = argv[0]; if (arg0 && arg0[0] == '/' && arg0[1] == '/') for ( ; arg0 && *arg0; arg0++) if (*arg0 == '/') *arg0 = '\\'; /* make sure CreateProcess() has Path it needs */ sync_Path_environment (); #ifndef NO_OUTPUT_SYNC /* Divert child output if output_sync in use. */ if (child->output.syncout) { if (child->output.out >= 0) outfd = child->output.out; if (child->output.err >= 0) errfd = child->output.err; } #else outfd = errfd = -1; #endif hPID = process_easy (argv, child->environment, outfd, errfd); if (hPID != INVALID_HANDLE_VALUE) child->pid = (pid_t) hPID; else { int i; unblock_sigs (); fprintf (stderr, _("process_easy() failed to launch process (e=%ld)\n"), process_last_err (hPID)); for (i = 0; argv[i]; i++) fprintf (stderr, "%s ", argv[i]); fprintf (stderr, _("\nCounted %d args in failed launch\n"), i); goto error; } # else /* CONFIG_NEW_WIN_CHILDREN */ struct variable *shell_var = lookup_variable("SHELL", 5); const char *shell_value = !shell_var ? NULL : !shell_var->recursive || strchr(shell_var->value, '$') == NULL ? shell_var->value : variable_expand (shell_var->value); int rc = MkWinChildCreate(argv, child->environment, shell_value, child, &child->pid); if (rc != 0) { int i; unblock_sigs (); fprintf (stderr, _("failed to launch process (rc=%d)\n"), rc); for (i = 0; argv[i]; i++) fprintf (stderr, "%s ", argv[i]); fprintf (stderr, "\n", argv[i]); goto error; } # endif /* CONFIG_NEW_WIN_CHILDREN */ } #endif /* WINDOWS32 */ #endif /* __MSDOS__ or Amiga or WINDOWS32 */ /* Bump the number of jobs started in this second. */ ++job_counter; /* We are the parent side. Set the state to say the commands are running and return. */ set_command_state (child->file, cs_running); /* Free the storage used by the child's argument list. */ #ifdef KMK /* leak */ cleanup_argv: #endif #ifndef VMS free (argv[0]); free (argv); #endif OUTPUT_UNSET(); return; error: child->file->update_status = us_failed; notice_finished_file (child->file); #ifdef KMK /* fix leak */ goto cleanup_argv; #else OUTPUT_UNSET(); #endif } /* Try to start a child running. Returns nonzero if the child was started (and maybe finished), or zero if the load was too high and the child was put on the 'waiting_jobs' chain. */ static int start_waiting_job (struct child *c) { struct file *f = c->file; #ifdef DB_KMK DB (DB_KMK, (_("start_waiting_job %p (`%s') command_flags=%#x slots=%d/%d\n"), (void *)c, c->file->name, c->file->command_flags, job_slots_used, job_slots)); #endif /* If we can start a job remotely, we always want to, and don't care about the local load average. We record that the job should be started remotely in C->remote for start_job_command to test. */ c->remote = start_remote_job_p (1); #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL if (c->file->command_flags & COMMANDS_NOTPARALLEL) { DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s') [start_waiting_job]\n"), not_parallel, not_parallel + 1, (void *)c->file, c->file->name)); assert(not_parallel >= 0); ++not_parallel; } #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ /* If we are running at least one job already and the load average is too high, make this one wait. */ if (!c->remote #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL && ((job_slots_used > 0 && (not_parallel > 0 || load_too_high ())) #else && ((job_slots_used > 0 && load_too_high ()) #endif #ifdef WINDOWS32 # ifndef CONFIG_NEW_WIN_CHILDREN || (process_used_slots () >= MAXIMUM_WAIT_OBJECTS) # endif #endif )) { #ifndef CONFIG_WITH_EXTENDED_NOTPARALLEL /* Put this child on the chain of children waiting for the load average to go down. */ set_command_state (f, cs_running); c->next = waiting_jobs; waiting_jobs = c; #else /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ /* Put this child on the chain of children waiting for the load average to go down. If not parallel, put it last. */ set_command_state (f, cs_running); c->next = waiting_jobs; if (c->next && (c->file->command_flags & COMMANDS_NOTPARALLEL)) { struct child *prev = waiting_jobs; while (prev->next) prev = prev->next; c->next = 0; prev->next = c; } else /* FIXME: insert after the last node with COMMANDS_NOTPARALLEL set */ waiting_jobs = c; DB (DB_KMK, (_("queued child %p (`%s')\n"), (void *)c, c->file->name)); #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ return 0; } /* Start the first command; reap_children will run later command lines. */ start_job_command (c); switch (f->command_state) { case cs_running: c->next = children; DB (DB_JOBS, (_("Putting child %p (%s) PID %s%s on the chain.\n"), (void *)c, c->file->name, pid2str (c->pid), c->remote ? _(" (remote)") : "")); children = c; /* One more job slot is in use. */ ++job_slots_used; unblock_sigs (); break; case cs_not_started: /* All the command lines turned out to be empty. */ f->update_status = us_success; /* FALLTHROUGH */ case cs_finished: notice_finished_file (f); free_child (c); break; default: assert (f->command_state == cs_finished); break; } return 1; } /* Create a 'struct child' for FILE and start its commands running. */ void new_job (struct file *file) { struct commands *cmds = file->cmds; struct child *c; char **lines; unsigned int i; /* Let any previously decided-upon jobs that are waiting for the load to go down start before this new one. */ start_waiting_jobs (); /* Reap any children that might have finished recently. */ reap_children (0, 0); /* Chop the commands up into lines if they aren't already. */ chop_commands (cmds); #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS cmds->refs++; /* retain the chopped lines. */ #endif /* Start the command sequence, record it in a new 'struct child', and add that to the chain. */ c = xcalloc (sizeof (struct child)); output_init (&c->output); c->file = file; c->sh_batch_file = NULL; /* Cache dontcare flag because file->dontcare can be changed once we return. Check dontcare inheritance mechanism for details. */ c->dontcare = file->dontcare; /* Start saving output in case the expansion uses $(info ...) etc. */ OUTPUT_SET (&c->output); /* Expand the command lines and store the results in LINES. */ lines = xmalloc (cmds->ncommand_lines * sizeof (char *)); for (i = 0; i < cmds->ncommand_lines; ++i) { /* Collapse backslash-newline combinations that are inside variable or function references. These are left alone by the parser so that they will appear in the echoing of commands (where they look nice); and collapsed by construct_command_argv when it tokenizes. But letting them survive inside function invocations loses because we don't want the functions to see them as part of the text. */ char *in, *out, *ref; /* IN points to where in the line we are scanning. OUT points to where in the line we are writing. When we collapse a backslash-newline combination, IN gets ahead of OUT. */ in = out = cmds->command_lines[i]; while ((ref = strchr (in, '$')) != 0) { ++ref; /* Move past the $. */ if (out != in) /* Copy the text between the end of the last chunk we processed (where IN points) and the new chunk we are about to process (where REF points). */ memmove (out, in, ref - in); /* Move both pointers past the boring stuff. */ out += ref - in; in = ref; if (*ref == '(' || *ref == '{') { char openparen = *ref; char closeparen = openparen == '(' ? ')' : '}'; char *outref; int count; char *p; *out++ = *in++; /* Copy OPENPAREN. */ outref = out; /* IN now points past the opening paren or brace. Count parens or braces until it is matched. */ count = 0; while (*in != '\0') { if (*in == closeparen && --count < 0) break; else if (*in == '\\' && in[1] == '\n') { /* We have found a backslash-newline inside a variable or function reference. Eat it and any following whitespace. */ int quoted = 0; for (p = in - 1; p > ref && *p == '\\'; --p) quoted = !quoted; if (quoted) /* There were two or more backslashes, so this is not really a continuation line. We don't collapse the quoting backslashes here as is done in collapse_continuations, because the line will be collapsed again after expansion. */ *out++ = *in++; else { /* Skip the backslash, newline, and whitespace. */ in += 2; NEXT_TOKEN (in); /* Discard any preceding whitespace that has already been written to the output. */ while (out > outref && ISBLANK (out[-1])) --out; /* Replace it all with a single space. */ *out++ = ' '; } } else { if (*in == openparen) ++count; *out++ = *in++; } } } } /* There are no more references in this line to worry about. Copy the remaining uninteresting text to the output. */ if (out != in) memmove (out, in, strlen (in) + 1); /* Finally, expand the line. */ cmds->fileinfo.offset = i; lines[i] = allocated_variable_expand_for_file (cmds->command_lines[i], file); } cmds->fileinfo.offset = 0; c->command_lines = lines; #ifdef CONFIG_WITH_PRINT_TIME_SWITCH c->start_ts = -1; #endif /* Fetch the first command line to be run. */ job_next_command (c); /* Wait for a job slot to be freed up. If we allow an infinite number don't bother; also job_slots will == 0 if we're using the jobserver. */ if (job_slots != 0) while (job_slots_used == job_slots) reap_children (1, 0); #ifdef MAKE_JOBSERVER /* If we are controlling multiple jobs make sure we have a token before starting the child. */ /* This can be inefficient. There's a decent chance that this job won't actually have to run any subprocesses: the command script may be empty or otherwise optimized away. It would be nice if we could defer obtaining a token until just before we need it, in start_job_command. To do that we'd need to keep track of whether we'd already obtained a token (since start_job_command is called for each line of the job, not just once). Also more thought needs to go into the entire algorithm; this is where the old parallel job code waits, so... */ else if (jobserver_enabled ()) while (1) { int got_token; DB (DB_JOBS, ("Need a job token; we %shave children\n", children ? "" : "don't ")); /* If we don't already have a job started, use our "free" token. */ if (!jobserver_tokens) break; /* Prepare for jobserver token acquisition. */ jobserver_pre_acquire (); /* Reap anything that's currently waiting. */ reap_children (0, 0); /* Kick off any jobs we have waiting for an opportunity that can run now (i.e., waiting for load). */ start_waiting_jobs (); /* If our "free" slot is available, use it; we don't need a token. */ if (!jobserver_tokens) break; /* There must be at least one child already, or we have no business waiting for a token. */ if (!children) O (fatal, NILF, "INTERNAL: no children as we go to sleep on read\n"); /* Get a token. */ got_token = jobserver_acquire (waiting_jobs != NULL); /* If we got one, we're done here. */ if (got_token == 1) { DB (DB_JOBS, (_("Obtained token for child %p (%s).\n"), (void *)c, c->file->name)); break; } } #endif ++jobserver_tokens; /* Trace the build. Use message here so that changes to working directories are logged. */ if (trace_flag) { char *newer = allocated_variable_expand_for_file ("$?", c->file); const char *nm; if (! cmds->fileinfo.filenm) nm = _(""); else { char *n = alloca (strlen (cmds->fileinfo.filenm) + 1 + 11 + 1); sprintf (n, "%s:%lu", cmds->fileinfo.filenm, cmds->fileinfo.lineno); nm = n; } if (newer[0] == '\0') OSS (message, 0, _("%s: target '%s' does not exist"), nm, c->file->name); else OSSS (message, 0, _("%s: update target '%s' due to: %s"), nm, c->file->name, newer); free (newer); } /* The job is now primed. Start it running. (This will notice if there is in fact no recipe.) */ start_waiting_job (c); #ifndef CONFIG_WITH_EXTENDED_NOTPARALLEL if (job_slots == 1 || not_parallel) /* Since there is only one job slot, make things run linearly. Wait for the child to die, setting the state to 'cs_finished'. */ while (file->command_state == cs_running) reap_children (1, 0); #else /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ if (job_slots == 1 || not_parallel < 0) { /* Since there is only one job slot, make things run linearly. Wait for the child to die, setting the state to `cs_finished'. */ while (file->command_state == cs_running) reap_children (1, 0); } else if (not_parallel > 0) { /* wait for all live children to finish and then continue with the not-parallel child(s). FIXME: this loop could be better? */ while (file->command_state == cs_running && (children != 0 || shell_function_pid != 0) /* reap_child condition */ && not_parallel > 0) reap_children (1, 0); } #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ OUTPUT_UNSET (); return; } /* Move CHILD's pointers to the next command for it to execute. Returns nonzero if there is another command. */ static int job_next_command (struct child *child) { while (child->command_ptr == 0 || *child->command_ptr == '\0') { /* There are no more lines in the expansion of this line. */ if (child->command_line == child->file->cmds->ncommand_lines) { /* There are no more lines to be expanded. */ child->command_ptr = 0; child->file->cmds->fileinfo.offset = 0; return 0; } else /* Get the next line to run. */ child->command_ptr = child->command_lines[child->command_line++]; } child->file->cmds->fileinfo.offset = child->command_line - 1; return 1; } /* Determine if the load average on the system is too high to start a new job. The real system load average is only recomputed once a second. However, a very parallel make can easily start tens or even hundreds of jobs in a second, which brings the system to its knees for a while until that first batch of jobs clears out. To avoid this we use a weighted algorithm to try to account for jobs which have been started since the last second, and guess what the load average would be now if it were computed. This algorithm was provided by Thomas Riedl , who writes: ! calculate something load-oid and add to the observed sys.load, ! so that latter can catch up: ! - every job started increases jobctr; ! - every dying job decreases a positive jobctr; ! - the jobctr value gets zeroed every change of seconds, ! after its value*weight_b is stored into the 'backlog' value last_sec ! - weight_a times the sum of jobctr and last_sec gets ! added to the observed sys.load. ! ! The two weights have been tried out on 24 and 48 proc. Sun Solaris-9 ! machines, using a several-thousand-jobs-mix of cpp, cc, cxx and smallish ! sub-shelled commands (rm, echo, sed...) for tests. ! lowering the 'direct influence' factor weight_a (e.g. to 0.1) ! resulted in significant excession of the load limit, raising it ! (e.g. to 0.5) took bad to small, fast-executing jobs and didn't ! reach the limit in most test cases. ! ! lowering the 'history influence' weight_b (e.g. to 0.1) resulted in ! exceeding the limit for longer-running stuff (compile jobs in ! the .5 to 1.5 sec. range),raising it (e.g. to 0.5) overrepresented ! small jobs' effects. */ #define LOAD_WEIGHT_A 0.25 #define LOAD_WEIGHT_B 0.25 static int load_too_high (void) { #if defined(__MSDOS__) || defined(VMS) || defined(_AMIGA) || defined(__riscos__) || defined(__HAIKU__) return 1; #else static double last_sec; static time_t last_now; double load, guess; time_t now; #if defined(WINDOWS32) && !defined(CONFIG_NEW_WIN_CHILDREN) /* sub_proc.c cannot wait for more than MAXIMUM_WAIT_OBJECTS children */ if (process_used_slots () >= MAXIMUM_WAIT_OBJECTS) return 1; #endif if (max_load_average < 0) return 0; /* Find the real system load average. */ make_access (); if (getloadavg (&load, 1) != 1) { static int lossage = -1; /* Complain only once for the same error. */ if (lossage == -1 || errno != lossage) { if (errno == 0) /* An errno value of zero means getloadavg is just unsupported. */ O (error, NILF, _("cannot enforce load limits on this operating system")); else perror_with_name (_("cannot enforce load limit: "), "getloadavg"); } lossage = errno; load = 0; } user_access (); /* If we're in a new second zero the counter and correct the backlog value. Only keep the backlog for one extra second; after that it's 0. */ now = time (NULL); if (last_now < now) { if (last_now == now - 1) last_sec = LOAD_WEIGHT_B * job_counter; else last_sec = 0.0; job_counter = 0; last_now = now; } /* Try to guess what the load would be right now. */ guess = load + (LOAD_WEIGHT_A * (job_counter + last_sec)); DB (DB_JOBS, ("Estimated system load = %f (actual = %f) (max requested = %f)\n", guess, load, max_load_average)); return guess >= max_load_average; #endif } /* Start jobs that are waiting for the load to be lower. */ void start_waiting_jobs (void) { struct child *job; if (waiting_jobs == 0) return; do { /* Check for recently deceased descendants. */ reap_children (0, 0); /* Take a job off the waiting list. */ job = waiting_jobs; waiting_jobs = job->next; #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL /* If it's a not-parallel job, we've already counted it once when it was queued in start_waiting_job, so decrement before sending it to start_waiting_job again. */ if (job->file->command_flags & COMMANDS_NOTPARALLEL) { DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s') [start_waiting_jobs]\n"), not_parallel, not_parallel - 1, (void *) job->file, job->file->name)); assert(not_parallel > 0); --not_parallel; } #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ /* Try to start that job. We break out of the loop as soon as start_waiting_job puts one back on the waiting list. */ } while (start_waiting_job (job) && waiting_jobs != 0); return; } #ifndef WINDOWS32 /* EMX: Start a child process. This function returns the new pid. */ # if defined __EMX__ int child_execute_job (struct output *out, int good_stdin, char **argv, char **envp) { int pid; int fdin = good_stdin ? FD_STDIN : get_bad_stdin (); int fdout = FD_STDOUT; int fderr = FD_STDERR; int save_fdin = -1; int save_fdout = -1; int save_fderr = -1; /* Divert child output if we want to capture output. */ if (out && out->syncout) { if (out->out >= 0) fdout = out->out; if (out->err >= 0) fderr = out->err; } /* For each FD which needs to be redirected first make a dup of the standard FD to save and mark it close on exec so our child won't see it. Then dup2() the standard FD to the redirect FD, and also mark the redirect FD as close on exec. */ if (fdin != FD_STDIN) { save_fdin = dup (FD_STDIN); if (save_fdin < 0) O (fatal, NILF, _("no more file handles: could not duplicate stdin\n")); CLOSE_ON_EXEC (save_fdin); dup2 (fdin, FD_STDIN); CLOSE_ON_EXEC (fdin); } if (fdout != FD_STDOUT) { save_fdout = dup (FD_STDOUT); if (save_fdout < 0) O (fatal, NILF, _("no more file handles: could not duplicate stdout\n")); CLOSE_ON_EXEC (save_fdout); dup2 (fdout, FD_STDOUT); CLOSE_ON_EXEC (fdout); } if (fderr != FD_STDERR) { if (fderr != fdout) { save_fderr = dup (FD_STDERR); if (save_fderr < 0) O (fatal, NILF, _("no more file handles: could not duplicate stderr\n")); CLOSE_ON_EXEC (save_fderr); } dup2 (fderr, FD_STDERR); CLOSE_ON_EXEC (fderr); } /* Run the command. */ pid = exec_command (argv, envp); /* Restore stdout/stdin/stderr of the parent and close temporary FDs. */ if (save_fdin >= 0) { if (dup2 (save_fdin, FD_STDIN) != FD_STDIN) O (fatal, NILF, _("Could not restore stdin\n")); else close (save_fdin); } if (save_fdout >= 0) { if (dup2 (save_fdout, FD_STDOUT) != FD_STDOUT) O (fatal, NILF, _("Could not restore stdout\n")); else close (save_fdout); } if (save_fderr >= 0) { if (dup2 (save_fderr, FD_STDERR) != FD_STDERR) O (fatal, NILF, _("Could not restore stderr\n")); else close (save_fderr); } return pid; } #elif !defined (_AMIGA) && !defined (__MSDOS__) && !defined (VMS) /* POSIX: Create a child process executing the command in ARGV. ENVP is the environment of the new program. Returns the PID or -1. */ int child_execute_job (struct output *out, int good_stdin, char **argv, char **envp) { int r; int pid; int fdin = good_stdin ? FD_STDIN : get_bad_stdin (); int fdout = FD_STDOUT; int fderr = FD_STDERR; /* Divert child output if we want to capture it. */ if (out && out->syncout) { if (out->out >= 0) fdout = out->out; if (out->err >= 0) fderr = out->err; } pid = vfork(); if (pid != 0) return pid; /* We are the child. */ unblock_sigs (); #ifdef SET_STACK_SIZE /* Reset limits, if necessary. */ if (stack_limit.rlim_cur) setrlimit (RLIMIT_STACK, &stack_limit); #endif /* For any redirected FD, dup2() it to the standard FD. They are all marked close-on-exec already. */ if (fdin != FD_STDIN) EINTRLOOP (r, dup2 (fdin, FD_STDIN)); if (fdout != FD_STDOUT) EINTRLOOP (r, dup2 (fdout, FD_STDOUT)); if (fderr != FD_STDERR) EINTRLOOP (r, dup2 (fderr, FD_STDERR)); /* Run the command. */ exec_command (argv, envp); } #endif /* !AMIGA && !__MSDOS__ && !VMS */ #endif /* !WINDOWS32 */ #if !defined(WINDOWS32) || !defined(CONFIG_NEW_WIN_CHILDREN) #ifndef _AMIGA /* Replace the current process with one running the command in ARGV, with environment ENVP. This function does not return. */ /* EMX: This function returns the pid of the child process. */ # ifdef __EMX__ int # else void # endif exec_command (char **argv, char **envp) { #ifdef VMS /* to work around a problem with signals and execve: ignore them */ #ifdef SIGCHLD signal (SIGCHLD,SIG_IGN); #endif /* Run the program. */ execve (argv[0], argv, envp); perror_with_name ("execve: ", argv[0]); _exit (EXIT_FAILURE); #else #ifdef WINDOWS32 # ifndef CONFIG_NEW_WIN_CHILDREN HANDLE hPID; HANDLE hWaitPID; int exit_code = EXIT_FAILURE; /* make sure CreateProcess() has Path it needs */ sync_Path_environment (); /* launch command */ hPID = process_easy (argv, envp, -1, -1); /* make sure launch ok */ if (hPID == INVALID_HANDLE_VALUE) { int i; fprintf (stderr, _("process_easy() failed to launch process (e=%ld)\n"), process_last_err (hPID)); for (i = 0; argv[i]; i++) fprintf (stderr, "%s ", argv[i]); fprintf (stderr, _("\nCounted %d args in failed launch\n"), i); exit (EXIT_FAILURE); } /* wait and reap last child */ hWaitPID = process_wait_for_any (1, 0); while (hWaitPID) { /* was an error found on this process? */ int err = process_last_err (hWaitPID); /* get exit data */ exit_code = process_exit_code (hWaitPID); if (err) fprintf (stderr, "make (e=%d, rc=%d): %s", err, exit_code, map_windows32_error_to_string (err)); /* cleanup process */ process_cleanup (hWaitPID); /* expect to find only last pid, warn about other pids reaped */ if (hWaitPID == hPID) break; else { char *pidstr = xstrdup (pid2str ((pid_t)hWaitPID)); fprintf (stderr, _("make reaped child pid %s, still waiting for pid %s\n"), pidstr, pid2str ((pid_t)hPID)); free (pidstr); } } /* return child's exit code as our exit code */ exit (exit_code); # else /* CONFIG_NEW_WIN_CHILDREN */ # endif /* CONFIG_NEW_WIN_CHILDREN */ #else /* !WINDOWS32 */ # ifdef __EMX__ int pid; # endif /* Be the user, permanently. */ child_access (); # ifdef __EMX__ /* Run the program. */ pid = spawnvpe (P_NOWAIT, argv[0], argv, envp); if (pid >= 0) return pid; /* the file might have a strange shell extension */ if (errno == ENOENT) errno = ENOEXEC; # else /* Run the program. */ environ = envp; execvp (argv[0], argv); # endif /* !__EMX__ */ switch (errno) { case ENOENT: /* We are in the child: don't use the output buffer. It's not right to run fprintf() here! */ if (makelevel == 0) fprintf (stderr, _("%s: %s: Command not found\n"), program, argv[0]); else fprintf (stderr, _("%s[%u]: %s: Command not found\n"), program, makelevel, argv[0]); break; case ENOEXEC: { /* The file is not executable. Try it as a shell script. */ const char *shell; char **new_argv; int argc; int i=1; # ifdef __EMX__ /* Do not use $SHELL from the environment */ struct variable *p = lookup_variable ("SHELL", 5); if (p) shell = p->value; else shell = 0; # else shell = getenv ("SHELL"); # endif if (shell == 0) shell = default_shell; argc = 1; while (argv[argc] != 0) ++argc; # ifdef __EMX__ if (!unixy_shell) ++argc; # endif new_argv = alloca ((1 + argc + 1) * sizeof (char *)); new_argv[0] = (char *)shell; # ifdef __EMX__ if (!unixy_shell) { new_argv[1] = "/c"; ++i; --argc; } # endif new_argv[i] = argv[0]; while (argc > 0) { new_argv[i + argc] = argv[argc]; --argc; } # ifdef __EMX__ pid = spawnvpe (P_NOWAIT, shell, new_argv, envp); if (pid >= 0) break; # else execvp (shell, new_argv); # endif if (errno == ENOENT) OS (error, NILF, _("%s: Shell program not found"), shell); else perror_with_name ("execvp: ", shell); break; } # ifdef __EMX__ case EINVAL: /* this nasty error was driving me nuts :-( */ O (error, NILF, _("spawnvpe: environment space might be exhausted")); /* FALLTHROUGH */ # endif default: perror_with_name ("execvp: ", argv[0]); break; } # ifdef __EMX__ return pid; # else _exit (127); # endif #endif /* !WINDOWS32 */ #endif /* !VMS */ } #else /* On Amiga */ void exec_command (char **argv) { MyExecute (argv); } void clean_tmp (void) { DeleteFile (amiga_bname); } #endif /* On Amiga */ #endif /* !defined(WINDOWS32) || !defined(CONFIG_NEW_WIN_CHILDREN) */ #ifndef VMS /* Figure out the argument list necessary to run LINE as a command. Try to avoid using a shell. This routine handles only ' quoting, and " quoting when no backslash, $ or ' characters are seen in the quotes. Starting quotes may be escaped with a backslash. If any of the characters in sh_chars is seen, or any of the builtin commands listed in sh_cmds is the first word of a line, the shell is used. If RESTP is not NULL, *RESTP is set to point to the first newline in LINE. If *RESTP is NULL, newlines will be ignored. SHELL is the shell to use, or nil to use the default shell. IFS is the value of $IFS, or nil (meaning the default). FLAGS is the value of lines_flags for this command line. It is used in the WINDOWS32 port to check whether + or $(MAKE) were found in this command line, in which case the effect of just_print_flag is overridden. */ static char ** construct_command_argv_internal (char *line, char **restp, const char *shell, const char *shellflags, const char *ifs, int flags, char **batch_filename UNUSED) { #ifdef __MSDOS__ /* MSDOS supports both the stock DOS shell and ports of Unixy shells. We call 'system' for anything that requires ''slow'' processing, because DOS shells are too dumb. When $SHELL points to a real (unix-style) shell, 'system' just calls it to do everything. When $SHELL points to a DOS shell, 'system' does most of the work internally, calling the shell only for its internal commands. However, it looks on the $PATH first, so you can e.g. have an external command named 'mkdir'. Since we call 'system', certain characters and commands below are actually not specific to COMMAND.COM, but to the DJGPP implementation of 'system'. In particular: The shell wildcard characters are in DOS_CHARS because they will not be expanded if we call the child via 'spawnXX'. The ';' is in DOS_CHARS, because our 'system' knows how to run multiple commands on a single line. DOS_CHARS also include characters special to 4DOS/NDOS, so we won't have to tell one from another and have one more set of commands and special characters. */ static const char *sh_chars_dos = "*?[];|<>%^&()"; static const char *sh_cmds_dos[] = { "break", "call", "cd", "chcp", "chdir", "cls", "copy", "ctty", "date", "del", "dir", "echo", "erase", "exit", "for", "goto", "if", "md", "mkdir", "path", "pause", "prompt", "rd", "rmdir", "rem", "ren", "rename", "set", "shift", "time", "type", "ver", "verify", "vol", ":", 0 }; static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^"; static const char *sh_cmds_sh[] = { "cd", "echo", "eval", "exec", "exit", "login", "logout", "set", "umask", "wait", "while", "for", "case", "if", ":", ".", "break", "continue", "export", "read", "readonly", "shift", "times", "trap", "switch", "unset", "ulimit", 0 }; const char *sh_chars; const char **sh_cmds; #elif defined (__EMX__) static const char *sh_chars_dos = "*?[];|<>%^&()"; static const char *sh_cmds_dos[] = { "break", "call", "cd", "chcp", "chdir", "cls", "copy", "ctty", "date", "del", "dir", "echo", "erase", "exit", "for", "goto", "if", "md", "mkdir", "path", "pause", "prompt", "rd", "rmdir", "rem", "ren", "rename", "set", "shift", "time", "type", "ver", "verify", "vol", ":", 0 }; static const char *sh_chars_os2 = "*?[];|<>%^()\"'&"; static const char *sh_cmds_os2[] = { "call", "cd", "chcp", "chdir", "cls", "copy", "date", "del", "detach", "dir", "echo", "endlocal", "erase", "exit", "for", "goto", "if", "keys", "md", "mkdir", "move", "path", "pause", "prompt", "rd", "rem", "ren", "rename", "rmdir", "set", "setlocal", "shift", "start", "time", "type", "ver", "verify", "vol", ":", 0 }; static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^~'"; static const char *sh_cmds_sh[] = { "echo", "cd", "eval", "exec", "exit", "login", "logout", "set", "umask", "wait", "while", "for", "case", "if", ":", ".", "break", "continue", "export", "read", "readonly", "shift", "times", "trap", "switch", "unset", 0 }; const char *sh_chars; const char **sh_cmds; #elif defined (_AMIGA) static const char *sh_chars = "#;\"|<>()?*$`"; static const char *sh_cmds[] = { "cd", "eval", "if", "delete", "echo", "copy", "rename", "set", "setenv", "date", "makedir", "skip", "else", "endif", "path", "prompt", "unset", "unsetenv", "version", 0 }; #elif defined (WINDOWS32) /* We used to have a double quote (") in sh_chars_dos[] below, but that caused any command line with quoted file names be run through a temporary batch file, which introduces command-line limit of 4K charcaters imposed by cmd.exe. Since CreateProcess can handle quoted file names just fine, removing the quote lifts the limit from a very frequent use case, because using quoted file names is commonplace on MS-Windows. */ static const char *sh_chars_dos = "|&<>"; static const char *sh_cmds_dos[] = { "assoc", "break", "call", "cd", "chcp", "chdir", "cls", "color", "copy", "ctty", "date", "del", "dir", "echo", "echo.", "endlocal", "erase", "exit", "for", "ftype", "goto", "if", "if", "md", "mkdir", "move", "path", "pause", "prompt", "rd", "rem", "ren", "rename", "rmdir", "set", "setlocal", "shift", "time", "title", "type", "ver", "verify", "vol", ":", 0 }; static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^"; static const char *sh_cmds_sh[] = { "cd", "eval", "exec", "exit", "login", "logout", "set", "umask", "wait", "while", "for", "case", "if", ":", ".", "break", "continue", "export", "read", "readonly", "shift", "times", "trap", "switch", "test", #ifdef BATCH_MODE_ONLY_SHELL "echo", #endif 0 }; const char *sh_chars; char const * const * sh_cmds; /* kmk: +_sh +const*2 */ #elif defined(__riscos__) static const char *sh_chars = ""; static const char *sh_cmds[] = { 0 }; #else /* must be UNIX-ish */ static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^~!"; /* kmk: +_sh */ static const char *sh_cmds_sh[] = /* kmk: +_sh */ { ".", ":", "break", "case", "cd", "continue", "eval", "exec", "exit", "export", "for", "if", "login", "logout", "read", "readonly", "set", "shift", "switch", "test", "times", "trap", "ulimit", "umask", "unset", "wait", "while", 0 }; # if 0 /*def HAVE_DOS_PATHS - kmk */ /* This is required if the MSYS/Cygwin ports (which do not define WINDOWS32) are compiled with HAVE_DOS_PATHS defined, which uses sh_chars_sh directly (see below). The value must be identical to that of sh_chars immediately above. */ static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^~!"; # endif /* HAVE_DOS_PATHS */ char const * sh_chars = sh_chars_sh; /* kmk: +_sh +const */ char const * const * sh_cmds = sh_cmds_sh; /* kmk: +_sh +const*2 */ #endif #ifdef KMK static const char sh_chars_kash[] = "#;*?[]&|<>(){}$`^~!"; /* note: no \" - good idea? */ static const char * const sh_cmds_kash[] = { ".", ":", "break", "case", "cd", "continue", "echo", "eval", "exec", "exit", "export", "for", "if", "login", "logout", "read", "readonly", "set", "shift", "switch", "test", "times", "trap", "umask", "wait", "while", 0 /* +echo, -ulimit, -unset */ }; int is_kmk_shell = 0; #endif int i; char *p; #ifndef NDEBUG char *end; #endif char *ap; const char *cap; const char *cp; int instring, word_has_equals, seen_nonequals, last_argument_was_empty; char **new_argv = 0; char *argstr = 0; #ifdef WINDOWS32 int slow_flag = 0; if (!unixy_shell) { sh_cmds = sh_cmds_dos; sh_chars = sh_chars_dos; } else { sh_cmds = sh_cmds_sh; sh_chars = sh_chars_sh; } #endif /* WINDOWS32 */ if (restp != NULL) *restp = NULL; /* Make sure not to bother processing an empty line but stop at newline. */ while (ISBLANK (*line)) ++line; if (*line == '\0') return 0; if (shellflags == 0) shellflags = posix_pedantic ? "-ec" : "-c"; /* See if it is safe to parse commands internally. */ #ifdef KMK /* kmk_ash and kmk_kash are both fine, kmk_ash is the default btw. */ if (shell == 0) { is_kmk_shell = 1; shell = (char *)get_default_kbuild_shell (); } else if (!strcmp (shell, get_default_kbuild_shell())) is_kmk_shell = 1; else { const char *psz = strstr (shell, "/kmk_ash"); if (psz) psz += sizeof ("/kmk_ash") - 1; else { psz = strstr (shell, "/kmk_kash"); if (psz) psz += sizeof ("/kmk_kash") - 1; } # if defined (__OS2__) || defined (_WIN32) || defined (WINDOWS32) is_kmk_shell = psz && (*psz == '\0' || !stricmp (psz, ".exe")); # else is_kmk_shell = psz && *psz == '\0'; # endif } if (is_kmk_shell) { sh_chars = sh_chars_kash; sh_cmds = sh_cmds_kash; } #else /* !KMK */ if (shell == 0) shell = default_shell; #endif /* !KMK */ #ifdef WINDOWS32 else if (strcmp (shell, default_shell)) { char *s1 = _fullpath (NULL, shell, 0); char *s2 = _fullpath (NULL, default_shell, 0); slow_flag = strcmp ((s1 ? s1 : ""), (s2 ? s2 : "")); free (s1); free (s2); } if (slow_flag) goto slow; #else /* not WINDOWS32 */ #if defined (__MSDOS__) || defined (__EMX__) else if (strcasecmp (shell, default_shell)) { extern int _is_unixy_shell (const char *_path); DB (DB_BASIC, (_("$SHELL changed (was '%s', now '%s')\n"), default_shell, shell)); unixy_shell = _is_unixy_shell (shell); /* we must allocate a copy of shell: construct_command_argv() will free * shell after this function returns. */ default_shell = xstrdup (shell); } # ifdef KMK if (is_kmk_shell) { /* done above already */ } else # endif if (unixy_shell) { sh_chars = sh_chars_sh; sh_cmds = sh_cmds_sh; } else { sh_chars = sh_chars_dos; sh_cmds = sh_cmds_dos; # ifdef __EMX__ if (_osmode == OS2_MODE) { sh_chars = sh_chars_os2; sh_cmds = sh_cmds_os2; } # endif } #else /* !__MSDOS__ */ else if (strcmp (shell, default_shell)) goto slow; #endif /* !__MSDOS__ && !__EMX__ */ #endif /* not WINDOWS32 */ if (ifs) for (cap = ifs; *cap != '\0'; ++cap) if (*cap != ' ' && *cap != '\t' && *cap != '\n') goto slow; if (shellflags) if (shellflags[0] != '-' || ((shellflags[1] != 'c' || shellflags[2] != '\0') && (shellflags[1] != 'e' || shellflags[2] != 'c' || shellflags[3] != '\0'))) goto slow; i = strlen (line) + 1; /* More than 1 arg per character is impossible. */ new_argv = xmalloc (i * sizeof (char *)); /* All the args can fit in a buffer as big as LINE is. */ ap = new_argv[0] = argstr = xmalloc (i); #ifndef NDEBUG end = ap + i; #endif /* I is how many complete arguments have been found. */ i = 0; instring = word_has_equals = seen_nonequals = last_argument_was_empty = 0; for (p = line; *p != '\0'; ++p) { assert (ap <= end); if (instring) { /* Inside a string, just copy any char except a closing quote or a backslash-newline combination. */ if (*p == instring) { instring = 0; if (ap == new_argv[0] || *(ap-1) == '\0') last_argument_was_empty = 1; } else if (*p == '\\' && p[1] == '\n') { /* Backslash-newline is handled differently depending on what kind of string we're in: inside single-quoted strings you keep them; in double-quoted strings they disappear. For DOS/Windows/OS2, if we don't have a POSIX shell, we keep the pre-POSIX behavior of removing the backslash-newline. */ if (instring == '"' #if defined (__MSDOS__) || defined (__EMX__) || defined (WINDOWS32) || !unixy_shell #endif ) ++p; else { *(ap++) = *(p++); *(ap++) = *p; } } else if (*p == '\n' && restp != NULL) { /* End of the command line. */ *restp = p; goto end_of_line; } /* Backslash, $, and ` are special inside double quotes. If we see any of those, punt. But on MSDOS, if we use COMMAND.COM, double and single quotes have the same effect. */ else if (instring == '"' && strchr ("\\$`", *p) != 0 && unixy_shell) goto slow; #ifdef WINDOWS32 /* Quoted wildcard characters must be passed quoted to the command, so give up the fast route. */ else if (instring == '"' && strchr ("*?", *p) != 0 && !unixy_shell) goto slow; else if (instring == '"' && strncmp (p, "\\\"", 2) == 0) *ap++ = *++p; #endif else *ap++ = *p; } else if (strchr (sh_chars, *p) != 0) #ifdef KMK { /* Tilde is only special if at the start of a path spec, i.e. don't get excited when we by 8.3 files on windows. */ if ( *p == '~' && p > line && !ISSPACE (p[-1]) && p[-1] != '=' && p[-1] != ':' && p[-1] != '"' && p[-1] != '\'') *ap++ = *p; else /* Not inside a string, but it's a special char. */ goto slow; } #else /* !KMK */ /* Not inside a string, but it's a special char. */ goto slow; #endif /* !KMK */ else if (one_shell && *p == '\n') /* In .ONESHELL mode \n is a separator like ; or && */ goto slow; #ifdef __MSDOS__ else if (*p == '.' && p[1] == '.' && p[2] == '.' && p[3] != '.') /* '...' is a wildcard in DJGPP. */ goto slow; #endif else /* Not a special char. */ switch (*p) { case '=': /* Equals is a special character in leading words before the first word with no equals sign in it. This is not the case with sh -k, but we never get here when using nonstandard shell flags. */ if (! seen_nonequals && unixy_shell) goto slow; word_has_equals = 1; *ap++ = '='; break; case '\\': /* Backslash-newline has special case handling, ref POSIX. We're in the fastpath, so emulate what the shell would do. */ if (p[1] == '\n') { /* Throw out the backslash and newline. */ ++p; /* At the beginning of the argument, skip any whitespace other than newline before the start of the next word. */ if (ap == new_argv[i]) while (ISBLANK (p[1])) ++p; } #ifdef WINDOWS32 /* Backslash before whitespace is not special if our shell is not Unixy. */ else if (ISSPACE (p[1]) && !unixy_shell) { *ap++ = *p; break; } #endif else if (p[1] != '\0') { #ifdef HAVE_DOS_PATHS /* Only remove backslashes before characters special to Unixy shells. All other backslashes are copied verbatim, since they are probably DOS-style directory separators. This still leaves a small window for problems, but at least it should work for the vast majority of naive users. */ #ifdef __MSDOS__ /* A dot is only special as part of the "..." wildcard. */ if (strneq (p + 1, ".\\.\\.", 5)) { *ap++ = '.'; *ap++ = '.'; p += 4; } else #endif if (p[1] != '\\' && p[1] != '\'' && !ISSPACE (p[1]) # ifdef KMK && strchr (sh_chars, p[1]) == 0 && (p[1] != '"' || !unixy_shell)) # else && strchr (sh_chars_sh, p[1]) == 0) # endif /* back up one notch, to copy the backslash */ --p; #endif /* HAVE_DOS_PATHS */ /* Copy and skip the following char. */ *ap++ = *++p; } break; case '\'': case '"': instring = *p; break; case '\n': if (restp != NULL) { /* End of the command line. */ *restp = p; goto end_of_line; } else /* Newlines are not special. */ *ap++ = '\n'; break; case ' ': case '\t': /* We have the end of an argument. Terminate the text of the argument. */ *ap++ = '\0'; new_argv[++i] = ap; last_argument_was_empty = 0; /* Update SEEN_NONEQUALS, which tells us if every word heretofore has contained an '='. */ seen_nonequals |= ! word_has_equals; if (word_has_equals && ! seen_nonequals) /* An '=' in a word before the first word without one is magical. */ goto slow; word_has_equals = 0; /* Prepare for the next word. */ /* If this argument is the command name, see if it is a built-in shell command. If so, have the shell handle it. */ if (i == 1) { register int j; for (j = 0; sh_cmds[j] != 0; ++j) { if (streq (sh_cmds[j], new_argv[0])) goto slow; #if defined(__EMX__) || defined(WINDOWS32) /* Non-Unix shells are case insensitive. */ if (!unixy_shell && strcasecmp (sh_cmds[j], new_argv[0]) == 0) goto slow; #endif } } /* Skip whitespace chars, but not newlines. */ while (ISBLANK (p[1])) ++p; break; default: *ap++ = *p; break; } } end_of_line: if (instring) /* Let the shell deal with an unterminated quote. */ goto slow; /* Terminate the last argument and the argument list. */ *ap = '\0'; if (new_argv[i][0] != '\0' || last_argument_was_empty) ++i; new_argv[i] = 0; if (i == 1) { register int j; for (j = 0; sh_cmds[j] != 0; ++j) if (streq (sh_cmds[j], new_argv[0])) goto slow; } if (new_argv[0] == 0) { /* Line was empty. */ free (argstr); free (new_argv); return 0; } return new_argv; slow:; /* We must use the shell. */ if (new_argv != 0) { /* Free the old argument list we were working on. */ free (argstr); free (new_argv); } #ifdef __MSDOS__ execute_by_shell = 1; /* actually, call 'system' if shell isn't unixy */ #endif #ifdef _AMIGA { char *ptr; char *buffer; char *dptr; buffer = xmalloc (strlen (line)+1); ptr = line; for (dptr=buffer; *ptr; ) { if (*ptr == '\\' && ptr[1] == '\n') ptr += 2; else if (*ptr == '@') /* Kludge: multiline commands */ { ptr += 2; *dptr++ = '\n'; } else *dptr++ = *ptr++; } *dptr = 0; new_argv = xmalloc (2 * sizeof (char *)); new_argv[0] = buffer; new_argv[1] = 0; } #else /* Not Amiga */ #ifdef WINDOWS32 /* * Not eating this whitespace caused things like * * sh -c "\n" * * which gave the shell fits. I think we have to eat * whitespace here, but this code should be considered * suspicious if things start failing.... */ /* Make sure not to bother processing an empty line. */ NEXT_TOKEN (line); if (*line == '\0') return 0; #endif /* WINDOWS32 */ { /* SHELL may be a multi-word command. Construct a command line "$(SHELL) $(.SHELLFLAGS) LINE", with all special chars in LINE escaped. Then recurse, expanding this command line to get the final argument list. */ char *new_line; unsigned int shell_len = strlen (shell); unsigned int line_len = strlen (line); unsigned int sflags_len = shellflags ? strlen (shellflags) : 0; #ifdef WINDOWS32 char *command_ptr = NULL; /* used for batch_mode_shell mode */ #endif # ifdef __EMX__ /* is this necessary? */ if (!unixy_shell && shellflags) ((char *)shellflags)[0] = '/'; /* "/c" */ # endif /* In .ONESHELL mode we are allowed to throw the entire current recipe string at a single shell and trust that the user has configured the shell and shell flags, and formatted the string, appropriately. */ if (one_shell) { /* If the shell is Bourne compatible, we must remove and ignore interior special chars [@+-] because they're meaningless to the shell itself. If, however, we're in .ONESHELL mode and have changed SHELL to something non-standard, we should leave those alone because they could be part of the script. In this case we must also leave in place any leading [@+-] for the same reason. */ /* Remove and ignore interior prefix chars [@+-] because they're meaningless given a single shell. */ #if defined __MSDOS__ || defined (__EMX__) if (unixy_shell) /* the test is complicated and we already did it */ #else if (is_bourne_compatible_shell (shell) #ifdef WINDOWS32 /* If we didn't find any sh.exe, don't behave is if we did! */ && !no_default_sh_exe #endif ) #endif { const char *f = line; char *t = line; /* Copy the recipe, removing and ignoring interior prefix chars [@+-]: they're meaningless in .ONESHELL mode. */ while (f[0] != '\0') { int esc = 0; /* This is the start of a new recipe line. Skip whitespace and prefix characters but not newlines. */ #ifndef CONFIG_WITH_COMMANDS_FUNC while (ISBLANK (*f) || *f == '-' || *f == '@' || *f == '+') #else char ch; while (ISBLANK ((ch = *f)) || ch == '-' || ch == '@' || ch == '+' || ch == '%') #endif ++f; /* Copy until we get to the next logical recipe line. */ while (*f != '\0') { *(t++) = *(f++); if (f[-1] == '\\') esc = !esc; else { /* On unescaped newline, we're done with this line. */ if (f[-1] == '\n' && ! esc) break; /* Something else: reset the escape sequence. */ esc = 0; } } } *t = '\0'; } #ifdef WINDOWS32 else /* non-Posix shell (cmd.exe etc.) */ { const char *f = line; char *t = line; char *tstart = t; int temp_fd; FILE* batch = NULL; int id = GetCurrentProcessId (); PATH_VAR(fbuf); /* Generate a file name for the temporary batch file. */ sprintf (fbuf, "make%d", id); *batch_filename = create_batch_file (fbuf, 0, &temp_fd); DB (DB_JOBS, (_("Creating temporary batch file %s\n"), *batch_filename)); /* Create a FILE object for the batch file, and write to it the commands to be executed. Put the batch file in TEXT mode. */ _setmode (temp_fd, _O_TEXT); batch = _fdopen (temp_fd, "wt"); fputs ("@echo off\n", batch); DB (DB_JOBS, (_("Batch file contents:\n\t@echo off\n"))); /* Copy the recipe, removing and ignoring interior prefix chars [@+-]: they're meaningless in .ONESHELL mode. */ while (*f != '\0') { /* This is the start of a new recipe line. Skip whitespace and prefix characters but not newlines. */ #ifndef CONFIG_WITH_COMMANDS_FUNC while (ISBLANK (*f) || *f == '-' || *f == '@' || *f == '+') #else char ch; while (ISBLANK ((ch = *f)) || ch == '-' || ch == '@' || ch == '+' || ch == '%') #endif ++f; /* Copy until we get to the next logical recipe line. */ while (*f != '\0') { /* Remove the escaped newlines in the command, and the blanks that follow them. Windows shells cannot handle escaped newlines. */ if (*f == '\\' && f[1] == '\n') { f += 2; while (ISBLANK (*f)) ++f; } *(t++) = *(f++); /* On an unescaped newline, we're done with this line. */ if (f[-1] == '\n') break; } /* Write another line into the batch file. */ if (t > tstart) { char c = *t; *t = '\0'; fputs (tstart, batch); DB (DB_JOBS, ("\t%s", tstart)); tstart = t; *t = c; } } DB (DB_JOBS, ("\n")); fclose (batch); /* Create an argv list for the shell command line that will run the batch file. */ new_argv = xmalloc (2 * sizeof (char *)); new_argv[0] = xstrdup (*batch_filename); new_argv[1] = NULL; return new_argv; } #endif /* WINDOWS32 */ /* Create an argv list for the shell command line. */ { int n = 0; new_argv = xmalloc ((4 + sflags_len/2) * sizeof (char *)); new_argv[n++] = xstrdup (shell); /* Chop up the shellflags (if any) and assign them. */ if (! shellflags) new_argv[n++] = xstrdup (""); else { const char *s = shellflags; char *t; unsigned int len; while ((t = find_next_token (&s, &len)) != 0) new_argv[n++] = xstrndup (t, len); } /* Set the command to invoke. */ new_argv[n++] = line; new_argv[n++] = NULL; } return new_argv; } new_line = xmalloc ((shell_len*2) + 1 + sflags_len + 1 + (line_len*2) + 1); ap = new_line; /* Copy SHELL, escaping any characters special to the shell. If we don't escape them, construct_command_argv_internal will recursively call itself ad nauseam, or until stack overflow, whichever happens first. */ for (cp = shell; *cp != '\0'; ++cp) { if (strchr (sh_chars, *cp) != 0) *(ap++) = '\\'; *(ap++) = *cp; } *(ap++) = ' '; if (shellflags) memcpy (ap, shellflags, sflags_len); ap += sflags_len; *(ap++) = ' '; #ifdef WINDOWS32 command_ptr = ap; #endif for (p = line; *p != '\0'; ++p) { if (restp != NULL && *p == '\n') { *restp = p; break; } else if (*p == '\\' && p[1] == '\n') { /* POSIX says we keep the backslash-newline. If we don't have a POSIX shell on DOS/Windows/OS2, mimic the pre-POSIX behavior and remove the backslash/newline. */ #if defined (__MSDOS__) || defined (__EMX__) || defined (WINDOWS32) # define PRESERVE_BSNL unixy_shell #else # define PRESERVE_BSNL 1 #endif if (PRESERVE_BSNL) { *(ap++) = '\\'; /* Only non-batch execution needs another backslash, because it will be passed through a recursive invocation of this function. */ if (!batch_mode_shell) *(ap++) = '\\'; *(ap++) = '\n'; } ++p; continue; } /* DOS shells don't know about backslash-escaping. */ if (unixy_shell && !batch_mode_shell && (*p == '\\' || *p == '\'' || *p == '"' || ISSPACE (*p) || strchr (sh_chars, *p) != 0)) *ap++ = '\\'; #ifdef __MSDOS__ else if (unixy_shell && strneq (p, "...", 3)) { /* The case of '...' wildcard again. */ strcpy (ap, "\\.\\.\\"); ap += 5; p += 2; } #endif *ap++ = *p; } if (ap == new_line + shell_len + sflags_len + 2) { /* Line was empty. */ free (new_line); return 0; } *ap = '\0'; #ifdef WINDOWS32 /* Some shells do not work well when invoked as 'sh -c xxx' to run a command line (e.g. Cygnus GNUWIN32 sh.exe on WIN32 systems). In these cases, run commands via a script file. */ if (just_print_flag && !(flags & COMMANDS_RECURSE)) { /* Need to allocate new_argv, although it's unused, because start_job_command will want to free it and its 0'th element. */ new_argv = xmalloc (2 * sizeof (char *)); new_argv[0] = xstrdup (""); new_argv[1] = NULL; } else if ((no_default_sh_exe || batch_mode_shell) && batch_filename) { int temp_fd; FILE* batch = NULL; int id = GetCurrentProcessId (); PATH_VAR (fbuf); /* create a file name */ sprintf (fbuf, "make%d", id); *batch_filename = create_batch_file (fbuf, unixy_shell, &temp_fd); DB (DB_JOBS, (_("Creating temporary batch file %s\n"), *batch_filename)); /* Create a FILE object for the batch file, and write to it the commands to be executed. Put the batch file in TEXT mode. */ _setmode (temp_fd, _O_TEXT); batch = _fdopen (temp_fd, "wt"); if (!unixy_shell) fputs ("@echo off\n", batch); fputs (command_ptr, batch); fputc ('\n', batch); fclose (batch); DB (DB_JOBS, (_("Batch file contents:%s\n\t%s\n"), !unixy_shell ? "\n\t@echo off" : "", command_ptr)); /* create argv */ new_argv = xmalloc (3 * sizeof (char *)); if (unixy_shell) { new_argv[0] = xstrdup (shell); new_argv[1] = *batch_filename; /* only argv[0] gets freed later */ } else { new_argv[0] = xstrdup (*batch_filename); new_argv[1] = NULL; } new_argv[2] = NULL; } else #endif /* WINDOWS32 */ if (unixy_shell) new_argv = construct_command_argv_internal (new_line, 0, 0, 0, 0, flags, 0); #ifdef __EMX__ else if (!unixy_shell) { /* new_line is local, must not be freed therefore We use line here instead of new_line because we run the shell manually. */ size_t line_len = strlen (line); char *p = new_line; char *q = new_line; memcpy (new_line, line, line_len + 1); /* Replace all backslash-newline combination and also following tabs. Important: stop at the first '\n' because that's what the loop above did. The next line starting at restp[0] will be executed during the next call of this function. */ while (*q != '\0' && *q != '\n') { if (q[0] == '\\' && q[1] == '\n') q += 2; /* remove '\\' and '\n' */ else *p++ = *q++; } *p = '\0'; # ifndef NO_CMD_DEFAULT if (strnicmp (new_line, "echo", 4) == 0 && (new_line[4] == ' ' || new_line[4] == '\t')) { /* the builtin echo command: handle it separately */ size_t echo_len = line_len - 5; char *echo_line = new_line + 5; /* special case: echo 'x="y"' cmd works this way: a string is printed as is, i.e., no quotes are removed. But autoconf uses a command like echo 'x="y"' to determine whether make works. autoconf expects the output x="y" so we will do exactly that. Note: if we do not allow cmd to be the default shell we do not need this kind of voodoo */ if (echo_line[0] == '\'' && echo_line[echo_len - 1] == '\'' && strncmp (echo_line + 1, "ac_maketemp=", strlen ("ac_maketemp=")) == 0) { /* remove the enclosing quotes */ memmove (echo_line, echo_line + 1, echo_len - 2); echo_line[echo_len - 2] = '\0'; } } # endif { /* Let the shell decide what to do. Put the command line into the 2nd command line argument and hope for the best ;-) */ size_t sh_len = strlen (shell); /* exactly 3 arguments + NULL */ new_argv = xmalloc (4 * sizeof (char *)); /* Exactly strlen(shell) + strlen("/c") + strlen(line) + 3 times the trailing '\0' */ new_argv[0] = xmalloc (sh_len + line_len + 5); memcpy (new_argv[0], shell, sh_len + 1); new_argv[1] = new_argv[0] + sh_len + 1; memcpy (new_argv[1], "/c", 3); new_argv[2] = new_argv[1] + 3; memcpy (new_argv[2], new_line, line_len + 1); new_argv[3] = NULL; } } #elif defined(__MSDOS__) else { /* With MSDOS shells, we must construct the command line here instead of recursively calling ourselves, because we cannot backslash-escape the special characters (see above). */ new_argv = xmalloc (sizeof (char *)); line_len = strlen (new_line) - shell_len - sflags_len - 2; new_argv[0] = xmalloc (line_len + 1); strncpy (new_argv[0], new_line + shell_len + sflags_len + 2, line_len); new_argv[0][line_len] = '\0'; } #else else fatal (NILF, CSTRLEN (__FILE__) + INTSTR_LENGTH, _("%s (line %d) Bad shell context (!unixy && !batch_mode_shell)\n"), __FILE__, __LINE__); #endif free (new_line); } #endif /* ! AMIGA */ return new_argv; } #endif /* !VMS */ /* Figure out the argument list necessary to run LINE as a command. Try to avoid using a shell. This routine handles only ' quoting, and " quoting when no backslash, $ or ' characters are seen in the quotes. Starting quotes may be escaped with a backslash. If any of the characters in sh_chars is seen, or any of the builtin commands listed in sh_cmds is the first word of a line, the shell is used. If RESTP is not NULL, *RESTP is set to point to the first newline in LINE. If *RESTP is NULL, newlines will be ignored. FILE is the target whose commands these are. It is used for variable expansion for $(SHELL) and $(IFS). */ char ** construct_command_argv (char *line, char **restp, struct file *file, int cmd_flags, char **batch_filename) { char *shell, *ifs, *shellflags; char **argv; #ifdef VMS char *cptr; int argc; argc = 0; cptr = line; for (;;) { while ((*cptr != 0) && (ISSPACE (*cptr))) cptr++; if (*cptr == 0) break; while ((*cptr != 0) && (!ISSPACE (*cptr))) cptr++; argc++; } argv = xmalloc (argc * sizeof (char *)); if (argv == 0) abort (); cptr = line; argc = 0; for (;;) { while ((*cptr != 0) && (ISSPACE (*cptr))) cptr++; if (*cptr == 0) break; DB (DB_JOBS, ("argv[%d] = [%s]\n", argc, cptr)); argv[argc++] = cptr; while ((*cptr != 0) && (!ISSPACE (*cptr))) cptr++; if (*cptr != 0) *cptr++ = 0; } #else { /* Turn off --warn-undefined-variables while we expand SHELL and IFS. */ int save = warn_undefined_variables_flag; warn_undefined_variables_flag = 0; shell = allocated_variable_expand_for_file ("$(SHELL)", file); #ifdef WINDOWS32 /* * Convert to forward slashes so that construct_command_argv_internal() * is not confused. */ if (shell) { # if 1 /* bird */ unix_slashes (shell); # else char *p = w32ify (shell, 0); strcpy (shell, p); # endif } #endif #ifdef __EMX__ { static const char *unixroot = NULL; static const char *last_shell = ""; static int init = 0; if (init == 0) { unixroot = getenv ("UNIXROOT"); /* unixroot must be NULL or not empty */ if (unixroot && unixroot[0] == '\0') unixroot = NULL; init = 1; } /* if we have an unixroot drive and if shell is not default_shell (which means it's either cmd.exe or the test has already been performed) and if shell is an absolute path without drive letter, try whether it exists e.g.: if "/bin/sh" does not exist use "$UNIXROOT/bin/sh" instead. */ if (unixroot && shell && strcmp (shell, last_shell) != 0 && (shell[0] == '/' || shell[0] == '\\')) { /* trying a new shell, check whether it exists */ size_t size = strlen (shell); char *buf = xmalloc (size + 7); memcpy (buf, shell, size); memcpy (buf + size, ".exe", 5); /* including the trailing '\0' */ if (access (shell, F_OK) != 0 && access (buf, F_OK) != 0) { /* try the same for the unixroot drive */ memmove (buf + 2, buf, size + 5); buf[0] = unixroot[0]; buf[1] = unixroot[1]; if (access (buf, F_OK) == 0) /* we have found a shell! */ /* free(shell); */ shell = buf; else free (buf); } else free (buf); } } #endif /* __EMX__ */ shellflags = allocated_variable_expand_for_file ("$(.SHELLFLAGS)", file); ifs = allocated_variable_expand_for_file ("$(IFS)", file); warn_undefined_variables_flag = save; } # ifdef CONFIG_WITH_KMK_BUILTIN /* If it's a kmk_builtin command, make sure we're treated like a unix shell and and don't get batch files. */ if ( ( !unixy_shell || batch_mode_shell # ifdef WINDOWS32 || no_default_sh_exe # endif ) && line && !strncmp (line, "kmk_builtin_", sizeof("kmk_builtin_") - 1)) { int saved_batch_mode_shell = batch_mode_shell; int saved_unixy_shell = unixy_shell; # ifdef WINDOWS32 int saved_no_default_sh_exe = no_default_sh_exe; no_default_sh_exe = 0; # endif unixy_shell = 1; batch_mode_shell = 0; argv = construct_command_argv_internal (line, restp, shell, shellflags, ifs, cmd_flags, batch_filename); batch_mode_shell = saved_batch_mode_shell; unixy_shell = saved_unixy_shell; # ifdef WINDOWS32 no_default_sh_exe = saved_no_default_sh_exe; # endif } else # endif /* CONFIG_WITH_KMK_BUILTIN */ argv = construct_command_argv_internal (line, restp, shell, shellflags, ifs, cmd_flags, batch_filename); free (shell); free (shellflags); free (ifs); #endif /* !VMS */ return argv; } #if !defined(HAVE_DUP2) && !defined(_AMIGA) int dup2 (int old, int new) { int fd; (void) close (new); EINTRLOOP (fd, dup (old)); if (fd != new) { (void) close (fd); errno = EMFILE; return -1; } return fd; } #endif /* !HAVE_DUP2 && !_AMIGA */ #ifdef CONFIG_WITH_PRINT_TIME_SWITCH /* Prints the time elapsed while executing the commands for the given job. */ void print_job_time (struct child *c) { if ( !handling_fatal_signal && print_time_min != -1 && c->start_ts != -1) { big_int elapsed = nano_timestamp () - c->start_ts; if (elapsed >= print_time_min * BIG_INT_C(1000000000)) { char buf[64]; int len = format_elapsed_nano (buf, sizeof (buf), elapsed); if (len > print_time_width) print_time_width = len; message (1, print_time_width + strlen (c->file->name), _("%*s - %s"), print_time_width, buf, c->file->name); } } } #endif /* On VMS systems, include special VMS functions. */ #ifdef VMS #include "vmsjobs.c" #endif kbuild-3608/src/kmk/maintMakefile0000664000175000017500000003055214670377414016772 0ustar locutuslocutus# Maintainer-only makefile segment. This contains things that are relevant # only if you have the full copy of the GNU make sources from the Git # tree, not a dist copy. BUGLIST := bug-make@gnu.org # These are related to my personal setup. GPG_FINGERPRINT := 6338B6D4 # SRCROOTDIR is just a handy location to keep source files in SRCROOTDIR ?= $(HOME)/src # Where the gnulib project has been locally cloned GNULIBDIR ?= $(SRCROOTDIR)/gnulib # Where to put the CVS checkout of the GNU web repository GNUWEBDIR ?= $(SRCROOTDIR)/gnu-www # Where to put the CVS checkout of the GNU make web repository MAKEWEBDIR ?= $(SRCROOTDIR)/make/make-web # We like mondo-warnings! ifeq ($(KBUILD_TARGET),openbsd) # bird AM_CFLAGS += -Wall -Wwrite-strings -Wshadow -Wpointer-arith -Wbad-function-cast else AM_CFLAGS += -Wall -Wwrite-strings -Wextra -Wdeclaration-after-statement -Wshadow -Wpointer-arith -Wbad-function-cast endif MAKE_MAINTAINER_MODE := -DMAKE_MAINTAINER_MODE AM_CPPFLAGS += $(MAKE_MAINTAINER_MODE) # I want this one but I have to wait for the const cleanup! # -Wwrite-strings # Find the glob source files... this might be dangerous, but we're maintainers! globsrc := $(wildcard glob/*.c) globhdr := $(wildcard glob/*.h) TEMPLATES = README README.DOS README.W32 README.OS2 \ config.ami configh.dos config.h.W32 config.h-vms MTEMPLATES = Makefile.DOS SMakefile # These are built as a side-effect of the dist rule #all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in # Create preprocessor output files--GCC specific! %.i : %.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) -E -dD -o $@ $< # General rule for turning a .template into a regular file. # $(TEMPLATES) : % : %.template Makefile rm -f $@ sed -e 's@%VERSION%@$(VERSION)@g' \ -e 's@%PACKAGE%@$(PACKAGE)@g' \ $< > $@ chmod a-w $@ # Construct Makefiles by adding on dependencies, etc. # $(MTEMPLATES) : % : %.template .dep_segment Makefile rm -f $@ sed -e 's@%VERSION%@$(VERSION)@g' \ -e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \ -e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@g' \ -e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@g' \ -e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@g' \ -e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@g' \ $< > $@ echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \ cat $(word 2,$^) >>$@ chmod a-w $@ NMakefile: NMakefile.template .dep_segment Makefile rm -f $@ cp $< $@ echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \ sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@ chmod a-w $@ # Construct build.sh.in # build.sh.in: build.template Makefile rm -f $@ sed -e 's@%objs%@$(patsubst %.o,%.$${OBJEXT},$(filter-out remote-%,$(make_OBJECTS)))@g' \ -e 's@%globobjs%@$(patsubst %.c,%.$${OBJEXT},$(globsrc))@g' \ $< > $@ chmod a-w+x $@ # Use automake to build a dependency list file, for "foreign" makefiles like # Makefile.DOS. # # Automake used to have a --generate-deps flag, but it's gone now, so we have # to do it ourselves. # DEP_FILES := $(wildcard $(DEPDIR)/*.Po) .dep_segment: Makefile.am maintMakefile $(DEP_FILES) rm -f $@ (for f in $(DEPDIR)/*.Po; do \ echo ""; \ echo "# $$f"; \ sed -e '/^[^:]*\.[ch] *:/d' \ -e 's, /usr/[^ ]*,,g' \ -e 's, $(srcdir)/, ,g' \ -e '/^ *\\$$/d' \ -e '/^ *$$/d' \ < $$f; \ done) > $@ # Cleaning GIT := git # git-clean: Clean all "ignored" files. Leave untracked files. # git-very-clean: Clean all files that aren't stored in source control. .PHONY: git-clean git-very-clean git-clean: -$(GIT) clean -fdX git-very-clean: git-clean -$(GIT) clean -fd ## ---------------------- ## ## Generating ChangeLog. ## ## ---------------------- ## gl2cl-date := 2013-10-10 gl2cl := $(GNULIBDIR)/build-aux/gitlog-to-changelog # Rebuild the changelog whenever a new commit is added ChangeLog: .check-git-HEAD if test -f '$(gl2cl)'; then \ '$(gl2cl)' --since='$(gl2cl-date)' > '$@'; \ else \ echo "WARNING: $(gl2cl) is not available. No $@ generated."; \ fi .PHONY: .check-git-HEAD .check-git-HEAD: sha="`git rev-parse HEAD`"; \ [ -f '$@' ] && [ "`cat '$@' 2>/dev/null`" = "$$sha" ] \ || echo "$$sha" > '$@' ## ---------------- ## ## Updating files. ## ## ---------------- ## RSYNC = rsync -Lrtvz WGET = wget --passive-ftp -np -nv ftp-gnu = ftp://ftp.gnu.org/gnu move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \ echo $(target) is unchanged; rm -f $(target).t; \ else \ mv -f $(target).t $(target); \ fi # ------------------- # # Updating PO files. # # ------------------- # # PO archive mirrors --- Be careful; some might not be fully populated! # ftp://ftp.unex.es/pub/gnu-i18n/po/maint/ # http://translation.sf.net/maint/ # ftp://tiger.informatik.hu-berlin.de/pub/po/maint/ po_wget_flags = --recursive --level=1 --no-directories --no-check-certificate po_repo = http://translationproject.org/latest/$(PACKAGE) po_sync = translationproject.org::tp/latest/$(PACKAGE)/ .PHONY: do-po-update po-update do-po-update: tmppo="/tmp/po-$(PACKAGE)-$(VERSION).$$$$" \ && rm -rf "$$tmppo" \ && mkdir "$$tmppo" \ && $(RSYNC) $(po_sync) "$$tmppo" \ && cp "$$tmppo"/*.po $(top_srcdir)/po \ && rm -rf "$$tmppo" cd po && $(MAKE) update-po $(MAKE) po-check po-update: [ -d "po" ] && $(MAKE) do-po-update # -------------------------- # # Updating GNU build files. # # -------------------------- # # The following pseudo table associates a local directory and a URL # with each of the files that belongs to some other package and is # regularly updated from the specified URL. cvs-url = http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~ git-url = http://git.savannah.gnu.org/cgit target = $(patsubst get-%,%,$@) config-url = $(git-url)/config.git/plain/$(patsubst get-config/%,%,$@) get-config/config.guess get-config/config.sub: @echo $(WGET) $(config-url) -O $(target) \ && $(WGET) $(config-url) -O $(target).t \ && $(move_if_change) gnulib-url = $(git-url)/gnulib.git/plain/build-aux/$(patsubst get-config/%,%,$@) get-config/texinfo.tex: @echo $(WGET) $(gnulib-url) -O $(target) \ && $(WGET) $(gnulib-url) -O $(target).t \ && $(move_if_change) gnustandards-url = $(cvs-url)/gnustandards/gnustandards/$(patsubst get-doc/%,%,$@) get-doc/make-stds.texi get-doc/fdl.texi: @echo $(WGET) $(gnustandards-url) -O $(target) \ && $(WGET) $(gnustandards-url) -O $(target).t \ && $(move_if_change) .PHONY: scm-update scm-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi # --------------------- # # Updating everything. # # --------------------- # .PHONY: update update: po-update scm-update # ---------------------------------- # # Alternative configuration checks. # # ---------------------------------- # .PHONY: check-alt-config check-alt-config: \ checkcfg.--disable-job-server \ checkcfg.--disable-load \ checkcfg.--without-guile \ checkcfg.CPPFLAGS^-DNO_OUTPUT_SYNC \ checkcfg.CPPFLAGS^-DNO_ARCHIVES # Trick GNU make so it doesn't run the submake as a recursive make. NR_MAKE = $(MAKE) # Check builds both with build.sh and with make checkcfg.%: distdir @echo "Building $@ (output in checkcfg.$*.log)" @exec >'checkcfg.$*.log' 2>&1; \ rm -rf $(distdir)/_build \ && mkdir $(distdir)/_build \ && cd $(distdir)/_build \ && echo "Testing configure with $(subst ^,=,$*)" \ && ../configure --srcdir=.. $(subst ^,=,$*) \ $(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS) \ CFLAGS='$(AM_CFLAGS)' \ && ./build.sh \ && ./make $(AM_MAKEFLAGS) check \ && rm -f *.o make \ && $(NR_MAKE) $(AM_MAKEFLAGS) \ && ./make $(AM_MAKEFLAGS) check ## --------------- ## ## Sanity checks. ## ## --------------- ## # Before we build a distribution be sure we run our local checks #distdir: local-check .PHONY: local-check po-check changelog-check # Checks that don't require Git. Run 'changelog-check' last as # previous test may reveal problems requiring new ChangeLog entries. local-check: po-check changelog-check # copyright-check writable-files changelog-check: if head $(top_srcdir)/ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \ :; \ else \ echo "$(VERSION) not in ChangeLog" 1>&2; \ exit 1; \ fi # Verify that all source files using _() are listed in po/POTFILES.in. # Ignore makeint.h; it defines _(). po-check: if test -f po/POTFILES.in; then \ grep '^[^#]' po/POTFILES.in | sort > $@-1; \ $(PERL) -wn -e 'if (/\b_\(/) { $$ARGV eq "./makeint.h" || print "$$ARGV\n" and close ARGV }' `find . -name '*.[ch]'` | sed 's,^\./,,' | sort > $@-2; \ diff -u $@-1 $@-2 || exit 1; \ rm -f $@-1 $@-2; \ fi ## --------------- ## ## Generate docs. ## ## --------------- ## .PHONY: update-makeweb gendocs CVS = cvs makeweb-repo = $(USER)@cvs.sv.gnu.org:/web/make gnuweb-repo = :pserver:anonymous@cvs.sv.gnu.org:/web/www gnuweb-dir = www/server/standards # Get the GNU make web page boilerplate etc. update-makeweb: [ -d '$(MAKEWEBDIR)' ] || mkdir -p '$(MAKEWEBDIR)' [ -d '$(MAKEWEBDIR)'/CVS ] \ && { cd '$(MAKEWEBDIR)' && $(CVS) update; } \ || { mkdir -p '$(dir $(MAKEWEBDIR))' && cd '$(dir $(MAKEWEBDIR))' \ && $(CVS) -d $(makeweb-repo) co -d '$(notdir $(MAKEWEBDIR))' make; } # Get the GNU web page boilerplate etc. update-gnuweb: [ -d '$(GNUWEBDIR)' ] || mkdir -p '$(GNUWEBDIR)' [ -d '$(GNUWEBDIR)/$(gnuweb-dir)'/CVS ] \ && { cd '$(GNUWEBDIR)/$(gnuweb-dir)' && $(CVS) update; } \ || { cd '$(GNUWEBDIR)' && $(CVS) -d $(gnuweb-repo) co '$(gnuweb-dir)'; } gendocs: update-gnuweb update-makeweb cp $(GNULIBDIR)/doc/gendocs_template doc cd doc \ && rm -rf doc/manual \ && $(GNULIBDIR)/build-aux/gendocs.sh --email '$(BUGLIST)' \ make 'GNU Make Manual' find '$(MAKEWEBDIR)'/manual \( -name CVS -prune \) -o \( -name '[!.]*' -type f -exec rm -f '{}' \; \) cp -r doc/manual '$(MAKEWEBDIR)' @echo 'Status of $(MAKEWEBDIR) repo:' && cd '$(MAKEWEBDIR)' \ && cvs -q -n update | grep -v '^M ' \ && echo '- cvs add ' \ && echo '- cvs remove ' \ && echo '- cvs commit' \ && echo '- cvs tag make-$(subst .,-,$(VERSION))' ## ------------------------- ## ## Make release targets. ## ## ------------------------- ## .PHONY: tag-release tag-release: case '$(VERSION)' in \ (*.*.9*) message=" candidate" ;; \ (*) message= ;; \ esac; \ $(GIT) tag -m "GNU Make release$$message $(VERSION)" -u '$(GPG_FINGERPRINT)' '$(VERSION)' ## ------------------------- ## ## GNU FTP upload artifacts. ## ## ------------------------- ## # This target creates the upload artifacts. # Sign it with my key. If you don't have my key/passphrase then sorry, # you're SOL! :) GPG = gpg GPGFLAGS = -u $(GPG_FINGERPRINT) DIST_ARCHIVES_SIG = $(addsuffix .sig,$(DIST_ARCHIVES)) DIST_ARCHIVES_DIRECTIVE = $(addsuffix .directive.asc,$(DIST_ARCHIVES)) # A simple rule to test signing, etc. .PHONY: distsign distsign: $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE) %.sig : % @echo "Signing file '$<':" $(GPG) $(GPGFLAGS) -o "$@" -b "$<" %.directive.asc: % @echo "Creating directive file '$@':" @( \ echo 'version: 1.1'; \ echo 'directory: make'; \ echo 'filename: $*'; \ echo 'comment: Official upload of GNU make version $(VERSION)'; \ ) > "$*.directive" $(GPG) $(GPGFLAGS) -o "$@" --clearsign "$*.directive" @rm -f "$*.directive" # Upload the artifacts FTPPUT = ncftpput gnu-upload-host = ftp-upload.gnu.org gnu-upload-dir = /incoming UPLOADS = upload-alpha upload-ftp .PHONY: $(UPLOADS) $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE) $(FTPPUT) "$(gnu-upload-host)" "$(gnu-upload-dir)/$(@:upload-%=%)" $^ # Rebuild Makefile.in if this file is modifed. Makefile.in: maintMakefile # Copyright (C) 1997-2016 Free Software Foundation, Inc. # This file is part of GNU Make. # # GNU Make 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. # # GNU Make 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 . kbuild-3608/src/kmk/expand.c0000664000175000017500000011472614670377414015732 0ustar locutuslocutus/* Variable expansion functions for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #include #include "filedef.h" #include "job.h" #include "commands.h" #include "variable.h" #include "rule.h" #ifdef CONFIG_WITH_COMPILER # include "kmk_cc_exec.h" #endif /* Initially, any errors reported when expanding strings will be reported against the file where the error appears. */ const floc **expanding_var = &reading_file; /* The next two describe the variable output buffer. This buffer is used to hold the variable-expansion of a line of the makefile. It is made bigger with realloc whenever it is too small. variable_buffer_length is the size currently allocated. variable_buffer is the address of the buffer. For efficiency, it's guaranteed that the buffer will always have VARIABLE_BUFFER_ZONE extra bytes allocated. This allows you to add a few extra chars without having to call a function. Note you should never use these bytes unless you're _sure_ you have room (you know when the buffer length was last checked. */ #define VARIABLE_BUFFER_ZONE 5 #ifndef KMK static unsigned int variable_buffer_length; #else unsigned int variable_buffer_length; #endif char *variable_buffer; #ifdef CONFIG_WITH_VALUE_LENGTH struct recycled_buffer { struct recycled_buffer *next; unsigned int length; }; struct recycled_buffer *recycled_head; #endif /* CONFIG_WITH_VALUE_LENGTH */ #ifndef KMK /* Subroutine of variable_expand and friends: The text to add is LENGTH chars starting at STRING to the variable_buffer. The text is added to the buffer at PTR, and the updated pointer into the buffer is returned as the value. Thus, the value returned by each call to variable_buffer_output should be the first argument to the following call. */ char * variable_buffer_output (char *ptr, const char *string, unsigned int length) { register unsigned int newlen = length + (ptr - variable_buffer); if ((newlen + VARIABLE_BUFFER_ZONE) > variable_buffer_length) { unsigned int offset = ptr - variable_buffer; variable_buffer_length = (newlen + 100 > 2 * variable_buffer_length ? newlen + 100 : 2 * variable_buffer_length); variable_buffer = xrealloc (variable_buffer, variable_buffer_length); ptr = variable_buffer + offset; } memcpy (ptr, string, length); return ptr + length; } #endif /* Return a pointer to the beginning of the variable buffer. */ static char * initialize_variable_output (void) { /* If we don't have a variable output buffer yet, get one. */ #ifdef CONFIG_WITH_VALUE_LENGTH if (variable_buffer == 0) { struct recycled_buffer *recycled = recycled_head; if (recycled) { recycled_head = recycled->next; variable_buffer_length = recycled->length; variable_buffer = (char *)recycled; } else { variable_buffer_length = 384; variable_buffer = xmalloc (variable_buffer_length); } variable_buffer[0] = '\0'; } #else /* CONFIG_WITH_VALUE_LENGTH */ if (variable_buffer == 0) { variable_buffer_length = 200; variable_buffer = xmalloc (variable_buffer_length); variable_buffer[0] = '\0'; } #endif /* CONFIG_WITH_VALUE_LENGTH */ return variable_buffer; } /* Recursively expand V. The returned string is malloc'd. */ static char *allocated_variable_append (const struct variable *v); char * #ifndef CONFIG_WITH_VALUE_LENGTH recursively_expand_for_file (struct variable *v, struct file *file) #else recursively_expand_for_file (struct variable *v, struct file *file, unsigned int *value_lenp) #endif { char *value; const floc *this_var; const floc **saved_varp; struct variable_set_list *save = 0; int set_reading = 0; /* Don't install a new location if this location is empty. This can happen for command-line variables, builtin variables, etc. */ saved_varp = expanding_var; if (v->fileinfo.filenm) { this_var = &v->fileinfo; expanding_var = &this_var; } /* If we have no other file-reading context, use the variable's context. */ if (!reading_file) { set_reading = 1; reading_file = &v->fileinfo; } if (v->expanding) { if (!v->exp_count) /* Expanding V causes infinite recursion. Lose. */ OS (fatal, *expanding_var, _("Recursive variable '%s' references itself (eventually)"), v->name); --v->exp_count; } if (file) { save = current_variable_set_list; current_variable_set_list = file->variables; } v->expanding = 1; #ifndef CONFIG_WITH_VALUE_LENGTH if (v->append) value = allocated_variable_append (v); else value = allocated_variable_expand (v->value); #else /* CONFIG_WITH_VALUE_LENGTH */ if (!v->append) { if (!IS_VARIABLE_RECURSIVE_WITHOUT_DOLLAR (v)) value = allocated_variable_expand_2 (v->value, v->value_length, value_lenp); else { unsigned int len = v->value_length; value = xmalloc (len + 2); memcpy (value, v->value, len + 1); value[len + 1] = '\0'; /* Extra terminator like allocated_variable_expand_2 returns. Why? */ if (value_lenp) *value_lenp = len; } } else { value = allocated_variable_append (v); if (value_lenp) *value_lenp = strlen (value); } #endif /* CONFIG_WITH_VALUE_LENGTH */ v->expanding = 0; if (set_reading) reading_file = 0; if (file) current_variable_set_list = save; expanding_var = saved_varp; return value; } #ifdef CONFIG_WITH_VALUE_LENGTH /* Worker for reference_variable() and kmk_exec_* that expands the recursive variable V. The main difference between this and recursively_expand[_for_file] is that this worker avoids the temporary buffer and outputs directly into the current variable buffer (O). */ char * reference_recursive_variable (char *o, struct variable *v) { const floc *this_var; const floc **saved_varp; int set_reading = 0; /* Don't install a new location if this location is empty. This can happen for command-line variables, builtin variables, etc. */ saved_varp = expanding_var; if (v->fileinfo.filenm) { this_var = &v->fileinfo; expanding_var = &this_var; } /* If we have no other file-reading context, use the variable's context. */ if (!reading_file) { set_reading = 1; reading_file = &v->fileinfo; } if (v->expanding) { if (!v->exp_count) /* Expanding V causes infinite recursion. Lose. */ OS (fatal, *expanding_var, _("Recursive variable `%s' references itself (eventually)"), v->name); --v->exp_count; } v->expanding = 1; if (!v->append) { /* Expand directly into the variable buffer. */ # ifdef CONFIG_WITH_COMPILER v->expand_count++; if ( v->expandprog || (v->expand_count == 3 && kmk_cc_compile_variable_for_expand (v)) ) o = kmk_exec_expand_to_var_buf (v, o); else variable_expand_string_2 (o, v->value, v->value_length, &o); # else MAKE_STATS_2 (v->expand_count++); variable_expand_string_2 (o, v->value, v->value_length, &o); # endif } else { /* XXX: Feel free to optimize appending target variables as well. */ char *value = allocated_variable_append (v); unsigned int value_len = strlen (value); o = variable_buffer_output (o, value, value_len); free (value); } v->expanding = 0; if (set_reading) reading_file = 0; expanding_var = saved_varp; return o; } #endif /* CONFIG_WITH_VALUE_LENGTH */ /* Expand a simple reference to variable NAME, which is LENGTH chars long. */ #ifdef MY_INLINE /* bird */ MY_INLINE char * #else #if defined(__GNUC__) __inline #endif static char * #endif reference_variable (char *o, const char *name, unsigned int length) { struct variable *v; #ifndef CONFIG_WITH_VALUE_LENGTH char *value; #endif v = lookup_variable (name, length); if (v == 0) warn_undefined (name, length); /* If there's no variable by that name or it has no value, stop now. */ if (v == 0 || (*v->value == '\0' && !v->append)) return o; #ifdef CONFIG_WITH_VALUE_LENGTH assert (v->value_length == strlen (v->value)); if (!v->recursive || IS_VARIABLE_RECURSIVE_WITHOUT_DOLLAR (v)) o = variable_buffer_output (o, v->value, v->value_length); else o = reference_recursive_variable (o, v); #else /* !CONFIG_WITH_VALUE_LENGTH */ value = (v->recursive ? recursively_expand (v) : v->value); o = variable_buffer_output (o, value, strlen (value)); if (v->recursive) free (value); #endif /* !CONFIG_WITH_VALUE_LENGTH */ return o; } #ifndef CONFIG_WITH_VALUE_LENGTH /* Only using variable_expand_string_2! */ /* Scan STRING for variable references and expansion-function calls. Only LENGTH bytes of STRING are actually scanned. If LENGTH is -1, scan until a null byte is found. Write the results to LINE, which must point into 'variable_buffer'. If LINE is NULL, start at the beginning of the buffer. Return a pointer to LINE, or to the beginning of the buffer if LINE is NULL. */ char * variable_expand_string (char *line, const char *string, long length) { struct variable *v; const char *p, *p1; char *save; char *o; unsigned int line_offset; if (!line) line = initialize_variable_output (); o = line; line_offset = line - variable_buffer; if (length == 0) { variable_buffer_output (o, "", 1); return (variable_buffer); } /* We need a copy of STRING: due to eval, it's possible that it will get freed as we process it (it might be the value of a variable that's reset for example). Also having a nil-terminated string is handy. */ save = length < 0 ? xstrdup (string) : xstrndup (string, length); p = save; while (1) { /* Copy all following uninteresting chars all at once to the variable output buffer, and skip them. Uninteresting chars end at the next $ or the end of the input. */ p1 = strchr (p, '$'); o = variable_buffer_output (o, p, p1 != 0 ? (unsigned int)(p1 - p) : strlen (p) + 1); if (p1 == 0) break; p = p1 + 1; /* Dispatch on the char that follows the $. */ switch (*p) { case '$': case '\0': /* $$ or $ at the end of the string means output one $ to the variable output buffer. */ o = variable_buffer_output (o, p1, 1); break; case '(': case '{': /* $(...) or ${...} is the general case of substitution. */ { char openparen = *p; char closeparen = (openparen == '(') ? ')' : '}'; const char *begp; const char *beg = p + 1; char *op; char *abeg = NULL; const char *end, *colon; op = o; begp = p; if (handle_function (&op, &begp)) { o = op; p = begp; break; } /* Is there a variable reference inside the parens or braces? If so, expand it before expanding the entire reference. */ end = strchr (beg, closeparen); if (end == 0) /* Unterminated variable reference. */ O (fatal, *expanding_var, _("unterminated variable reference")); p1 = lindex (beg, end, '$'); if (p1 != 0) { /* BEG now points past the opening paren or brace. Count parens or braces until it is matched. */ int count = 0; for (p = beg; *p != '\0'; ++p) { if (*p == openparen) ++count; else if (*p == closeparen && --count < 0) break; } /* If COUNT is >= 0, there were unmatched opening parens or braces, so we go to the simple case of a variable name such as '$($(a)'. */ if (count < 0) { abeg = expand_argument (beg, p); /* Expand the name. */ beg = abeg; end = strchr (beg, '\0'); } } else /* Advance P to the end of this reference. After we are finished expanding this one, P will be incremented to continue the scan. */ p = end; /* This is not a reference to a built-in function and any variable references inside are now expanded. Is the resultant text a substitution reference? */ colon = lindex (beg, end, ':'); if (colon) { /* This looks like a substitution reference: $(FOO:A=B). */ const char *subst_beg = colon + 1; const char *subst_end = lindex (subst_beg, end, '='); if (subst_end == 0) /* There is no = in sight. Punt on the substitution reference and treat this as a variable name containing a colon, in the code below. */ colon = 0; else { const char *replace_beg = subst_end + 1; const char *replace_end = end; /* Extract the variable name before the colon and look up that variable. */ v = lookup_variable (beg, colon - beg); if (v == 0) warn_undefined (beg, colon - beg); /* If the variable is not empty, perform the substitution. */ if (v != 0 && *v->value != '\0') { char *pattern, *replace, *ppercent, *rpercent; char *value = (v->recursive ? recursively_expand (v) : v->value); /* Copy the pattern and the replacement. Add in an extra % at the beginning to use in case there isn't one in the pattern. */ pattern = alloca (subst_end - subst_beg + 2); *(pattern++) = '%'; memcpy (pattern, subst_beg, subst_end - subst_beg); pattern[subst_end - subst_beg] = '\0'; replace = alloca (replace_end - replace_beg + 2); *(replace++) = '%'; memcpy (replace, replace_beg, replace_end - replace_beg); replace[replace_end - replace_beg] = '\0'; /* Look for %. Set the percent pointers properly based on whether we find one or not. */ ppercent = find_percent (pattern); if (ppercent) { ++ppercent; rpercent = find_percent (replace); if (rpercent) ++rpercent; } else { ppercent = pattern; rpercent = replace; --pattern; --replace; } o = patsubst_expand_pat (o, value, pattern, replace, ppercent, rpercent); if (v->recursive) free (value); } } } if (colon == 0) /* This is an ordinary variable reference. Look up the value of the variable. */ o = reference_variable (o, beg, end - beg); free (abeg); } break; default: if (ISSPACE (p[-1])) break; /* A $ followed by a random char is a variable reference: $a is equivalent to $(a). */ o = reference_variable (o, p, 1); break; } if (*p == '\0') break; ++p; } free (save); variable_buffer_output (o, "", 1); return (variable_buffer + line_offset); } #else /* CONFIG_WITH_VALUE_LENGTH */ /* Scan STRING for variable references and expansion-function calls. Only LENGTH bytes of STRING are actually scanned. If LENGTH is -1, scan until a null byte is found. Write the results to LINE, which must point into `variable_buffer'. If LINE is NULL, start at the beginning of the buffer. Return a pointer to LINE, or to the beginning of the buffer if LINE is NULL. Set EOLP to point to the string terminator. */ char * variable_expand_string_2 (char *line, const char *string, long length, char **eolp) { struct variable *v; const char *p, *p1, *eos; char *o; unsigned int line_offset; if (!line) line = initialize_variable_output(); o = line; line_offset = line - variable_buffer; if (length < 0) length = strlen (string); else MY_ASSERT_MSG (string + length == (p1 = memchr (string, '\0', length)) || !p1, ("len=%ld p1=%p %s\n", length, p1, line)); /* Simple 1: Emptry string. */ if (length == 0) { o = variable_buffer_output (o, "\0", 2); *eolp = o - 2; return (variable_buffer + line_offset); } /* Simple 2: Nothing to expand. ~50% if the kBuild calls. */ p1 = (const char *)memchr (string, '$', length); if (p1 == 0) { o = variable_buffer_output (o, string, length); o = variable_buffer_output (o, "\0", 2); *eolp = o - 2; assert (strchr (variable_buffer + line_offset, '\0') == *eolp); return (variable_buffer + line_offset); } p = string; eos = p + length; while (1) { /* Copy all following uninteresting chars all at once to the variable output buffer, and skip them. Uninteresting chars end at the next $ or the end of the input. */ o = variable_buffer_output (o, p, p1 != 0 ? (p1 - p) : (eos - p)); if (p1 == 0) break; p = p1 + 1; /* Dispatch on the char that follows the $. */ switch (*p) { case '$': /* $$ seen means output one $ to the variable output buffer. */ o = variable_buffer_output (o, p, 1); break; case '(': case '{': /* $(...) or ${...} is the general case of substitution. */ { char openparen = *p; char closeparen = (openparen == '(') ? ')' : '}'; const char *begp; const char *beg = p + 1; char *op; char *abeg = NULL; unsigned int alen = 0; const char *end, *colon; op = o; begp = p; end = may_be_function_name (p + 1, eos); if ( end && handle_function (&op, &begp, end, eos)) { o = op; p = begp; MY_ASSERT_MSG (!(p1 = memchr (variable_buffer + line_offset, '\0', o - (variable_buffer + line_offset))), ("line=%p o/exp_end=%p act_end=%p\n", variable_buffer + line_offset, o, p1)); break; } /* Is there a variable reference inside the parens or braces? If so, expand it before expanding the entire reference. */ end = memchr (beg, closeparen, eos - beg); if (end == 0) /* Unterminated variable reference. */ O (fatal, *expanding_var, _("unterminated variable reference")); p1 = lindex (beg, end, '$'); if (p1 != 0) { /* BEG now points past the opening paren or brace. Count parens or braces until it is matched. */ int count = 0; for (p = beg; p < eos; ++p) { if (*p == openparen) ++count; else if (*p == closeparen && --count < 0) break; } /* If COUNT is >= 0, there were unmatched opening parens or braces, so we go to the simple case of a variable name such as `$($(a)'. */ if (count < 0) { unsigned int len; char saved; /* Expand the name. */ saved = *p; *(char *)p = '\0'; /* XXX: proove that this is safe! XXX2: shouldn't be necessary any longer! */ abeg = allocated_variable_expand_3 (beg, p - beg, &len, &alen); beg = abeg; end = beg + len; *(char *)p = saved; } } else /* Advance P to the end of this reference. After we are finished expanding this one, P will be incremented to continue the scan. */ p = end; /* This is not a reference to a built-in function and any variable references inside are now expanded. Is the resultant text a substitution reference? */ colon = lindex (beg, end, ':'); if (colon) { /* This looks like a substitution reference: $(FOO:A=B). */ const char *subst_beg, *subst_end, *replace_beg, *replace_end; subst_beg = colon + 1; subst_end = lindex (subst_beg, end, '='); if (subst_end == 0) /* There is no = in sight. Punt on the substitution reference and treat this as a variable name containing a colon, in the code below. */ colon = 0; else { replace_beg = subst_end + 1; replace_end = end; /* Extract the variable name before the colon and look up that variable. */ v = lookup_variable (beg, colon - beg); if (v == 0) warn_undefined (beg, colon - beg); /* If the variable is not empty, perform the substitution. */ if (v != 0 && *v->value != '\0') { char *pattern, *replace, *ppercent, *rpercent; char *value = (v->recursive ? recursively_expand (v) : v->value); /* Copy the pattern and the replacement. Add in an extra % at the beginning to use in case there isn't one in the pattern. */ pattern = alloca (subst_end - subst_beg + 2); *(pattern++) = '%'; memcpy (pattern, subst_beg, subst_end - subst_beg); pattern[subst_end - subst_beg] = '\0'; replace = alloca (replace_end - replace_beg + 2); *(replace++) = '%'; memcpy (replace, replace_beg, replace_end - replace_beg); replace[replace_end - replace_beg] = '\0'; /* Look for %. Set the percent pointers properly based on whether we find one or not. */ ppercent = find_percent (pattern); if (ppercent) { ++ppercent; rpercent = find_percent (replace); if (rpercent) ++rpercent; } else { ppercent = pattern; rpercent = replace; --pattern; --replace; } o = patsubst_expand_pat (o, value, pattern, replace, ppercent, rpercent); if (v->recursive) free (value); } } } if (colon == 0) /* This is an ordinary variable reference. Look up the value of the variable. */ o = reference_variable (o, beg, end - beg); if (abeg) recycle_variable_buffer (abeg, alen); } break; case '\0': assert (p == eos); break; default: if (ISBLANK (p[-1])) /* XXX: This looks incorrect, previous is '$' */ break; /* A $ followed by a random char is a variable reference: $a is equivalent to $(a). */ o = reference_variable (o, p, 1); break; } if (++p >= eos) break; p1 = memchr (p, '$', eos - p); } o = variable_buffer_output (o, "\0", 2); /* KMK: compensate for the strlen + 1 that was removed above. */ *eolp = o - 2; MY_ASSERT_MSG (strchr (variable_buffer + line_offset, '\0') == *eolp, ("expected=%d actual=%d\nlength=%ld string=%.*s\n", (int)(*eolp - variable_buffer + line_offset), (int)strlen(variable_buffer + line_offset), length, (int)length, string)); return (variable_buffer + line_offset); } #endif /* CONFIG_WITH_VALUE_LENGTH */ /* Scan LINE for variable references and expansion-function calls. Build in 'variable_buffer' the result of expanding the references and calls. Return the address of the resulting string, which is null-terminated and is valid only until the next time this function is called. */ char * variable_expand (const char *line) { #ifndef CONFIG_WITH_VALUE_LENGTH return variable_expand_string (NULL, line, (long)-1); #else /* CONFIG_WITH_VALUE_LENGTH */ char *s; /* this function is abused a lot like this: variable_expand(""). */ if (!*line) { s = variable_buffer_output (initialize_variable_output (), "\0", 2); return s - 2; } return variable_expand_string_2 (NULL, line, (long)-1, &s); #endif /* CONFIG_WITH_VALUE_LENGTH */ } /* Expand an argument for an expansion function. The text starting at STR and ending at END is variable-expanded into a null-terminated string that is returned as the value. This is done without clobbering 'variable_buffer' or the current variable-expansion that is in progress. */ char * expand_argument (const char *str, const char *end) { #ifndef CONFIG_WITH_VALUE_LENGTH char *tmp, *alloc = NULL; char *r; #endif if (str == end) return xstrdup (""); #ifndef CONFIG_WITH_VALUE_LENGTH if (!end || *end == '\0') return allocated_variable_expand (str); if (end - str + 1 > 1000) tmp = alloc = xmalloc (end - str + 1); else tmp = alloca (end - str + 1); memcpy (tmp, str, end - str); tmp[end - str] = '\0'; r = allocated_variable_expand (tmp); free (alloc); return r; #else /* CONFIG_WITH_VALUE_LENGTH */ if (!end) return allocated_variable_expand_2 (str, ~0U, NULL); return allocated_variable_expand_2 (str, end - str, NULL); #endif /* CONFIG_WITH_VALUE_LENGTH */ } /* Expand LINE for FILE. Error messages refer to the file and line where FILE's commands were found. Expansion uses FILE's variable set list. */ char * variable_expand_for_file (const char *line, struct file *file) { char *result; struct variable_set_list *savev; const floc *savef; if (file == 0) return variable_expand (line); savev = current_variable_set_list; current_variable_set_list = file->variables; savef = reading_file; if (file->cmds && file->cmds->fileinfo.filenm) reading_file = &file->cmds->fileinfo; else reading_file = 0; result = variable_expand (line); current_variable_set_list = savev; reading_file = savef; return result; } #if defined (CONFIG_WITH_VALUE_LENGTH) || defined (CONFIG_WITH_COMMANDS_FUNC) /* Expand LINE for FILE. Error messages refer to the file and line where FILE's commands were found. Expansion uses FILE's variable set list. Differs from variable_expand_for_file in that it takes a pointer to where in the variable buffer to start outputting the expanded string, and that it can returned the length of the string if you wish. */ char * variable_expand_for_file_2 (char *o, const char *line, unsigned int length, struct file *file, unsigned int *value_lenp) { char *result; struct variable_set_list *savev; const floc *savef; long len = length == ~0U ? (long)-1 : (long)length; char *eol; if (!o) o = initialize_variable_output(); if (file == 0) result = variable_expand_string_2 (o, line, len, &eol); else { savev = current_variable_set_list; current_variable_set_list = file->variables; savef = reading_file; if (file->cmds && file->cmds->fileinfo.filenm) reading_file = &file->cmds->fileinfo; else reading_file = 0; result = variable_expand_string_2 (o, line, len, &eol); current_variable_set_list = savev; reading_file = savef; } if (value_lenp) *value_lenp = eol - result; return result; } #endif /* CONFIG_WITH_VALUE_LENGTH || CONFIG_WITH_COMMANDS_FUNC */ /* Like allocated_variable_expand, but for += target-specific variables. First recursively construct the variable value from its appended parts in any upper variable sets. Then expand the resulting value. */ static char * variable_append (const char *name, unsigned int length, const struct variable_set_list *set, int local) { const struct variable *v; char *buf = 0; /* If this set is local and the next is not a parent, then next is local. */ int nextlocal = local && set->next_is_parent == 0; /* If there's nothing left to check, return the empty buffer. */ if (!set) return initialize_variable_output (); /* Try to find the variable in this variable set. */ v = lookup_variable_in_set (name, length, set->set); /* If there isn't one, or this one is private, try the set above us. */ if (!v || (!local && v->private_var)) return variable_append (name, length, set->next, nextlocal); /* If this variable type is append, first get any upper values. If not, initialize the buffer. */ if (v->append) buf = variable_append (name, length, set->next, nextlocal); else buf = initialize_variable_output (); /* Append this value to the buffer, and return it. If we already have a value, first add a space. */ if (buf > variable_buffer) buf = variable_buffer_output (buf, " ", 1); #ifdef CONFIG_WITH_VALUE_LENGTH assert (v->value_length == strlen (v->value)); #endif /* Either expand it or copy it, depending. */ if (! v->recursive || IS_VARIABLE_RECURSIVE_WITHOUT_DOLLAR (v)) #ifdef CONFIG_WITH_VALUE_LENGTH return variable_buffer_output (buf, v->value, v->value_length); #else return variable_buffer_output (buf, v->value, strlen (v->value)); #endif #ifdef CONFIG_WITH_VALUE_LENGTH variable_expand_string_2 (buf, v->value, v->value_length, &buf); return buf; #else buf = variable_expand_string (buf, v->value, strlen (v->value)); return (buf + strlen (buf)); #endif } #ifdef CONFIG_WITH_VALUE_LENGTH /* Expands the specified string, appending it to the specified variable value. */ void append_expanded_string_to_variable (struct variable *v, const char *value, unsigned int value_len, int append) { char *p = (char *) memchr (value, '$', value_len); if (!p) /* fast path */ append_string_to_variable (v,value, value_len, append); else if (value_len) { unsigned int off_dollar = p - (char *)value; /* Install a fresh variable buffer. */ char *saved_buffer; unsigned int saved_buffer_length; install_variable_buffer (&saved_buffer, &saved_buffer_length); p = variable_buffer; if (append || !v->value_length) { /* Copy the current value into it and append a space. */ if (v->value_length) { p = variable_buffer_output (p, v->value, v->value_length); p = variable_buffer_output (p, " ", 1); } /* Append the assignment value. */ p = variable_buffer_output (p, value, off_dollar); variable_expand_string_2 (p, value + off_dollar, value_len - off_dollar, &p); } else { /* Expand the assignemnt value. */ p = variable_buffer_output (p, value, off_dollar); variable_expand_string_2 (p, value + off_dollar, value_len - off_dollar, &p); /* Append a space followed by the old value. */ p = variable_buffer_output (p, " ", 1); p = variable_buffer_output (p, v->value, v->value_length + 1) - 1; } /* Replace the variable with the variable buffer. */ #ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE if (v->rdonly_val) v->rdonly_val = 0; else #endif free (v->value); v->value = variable_buffer; v->value_length = p - v->value; v->value_alloc_len = variable_buffer_length; VARIABLE_CHANGED(v); /* Restore the variable buffer, but without freeing the current. */ variable_buffer = NULL; restore_variable_buffer (saved_buffer, saved_buffer_length); } /* else: Drop empty strings. Use $(NO_SUCH_VARIABLE) if a space is wanted. */ } #endif /* CONFIG_WITH_VALUE_LENGTH */ static char * allocated_variable_append (const struct variable *v) { char *val; /* Construct the appended variable value. */ char *obuf = variable_buffer; unsigned int olen = variable_buffer_length; variable_buffer = 0; assert ((unsigned int)v->length == strlen (v->name)); /* bird */ val = variable_append (v->name, strlen (v->name), /** @todo optimize by using v->length! */ current_variable_set_list, 1); variable_buffer_output (val, "", 1); val = variable_buffer; variable_buffer = obuf; variable_buffer_length = olen; return val; } /* Like variable_expand_for_file, but the returned string is malloc'd. This function is called a lot. It wants to be efficient. */ char * allocated_variable_expand_for_file (const char *line, struct file *file) { char *value; char *obuf = variable_buffer; unsigned int olen = variable_buffer_length; variable_buffer = 0; value = variable_expand_for_file (line, file); variable_buffer = obuf; variable_buffer_length = olen; return value; } #ifdef CONFIG_WITH_VALUE_LENGTH /* Handle the most common case in allocated_variable_expand_for_file specially and provide some additional string length features. */ char * allocated_variable_expand_2 (const char *line, unsigned int length, unsigned int *value_lenp) { char *value; char *obuf = variable_buffer; unsigned int olen = variable_buffer_length; long len = length == ~0U ? -1L : (long)length; char *eol; variable_buffer = 0; value = variable_expand_string_2 (NULL, line, len, &eol); if (value_lenp) *value_lenp = eol - value; variable_buffer = obuf; variable_buffer_length = olen; return value; } /* Initially created for handling a special case for variable_expand_string2 where the variable name is expanded and freed right afterwards. This variant allows the variable_buffer to be recycled and thus avoid bothering with a slow free implementation. (Darwin is horrible slow.) */ char * allocated_variable_expand_3 (const char *line, unsigned int length, unsigned int *value_lenp, unsigned int *buffer_lengthp) { char *obuf = variable_buffer; unsigned int olen = variable_buffer_length; long len = (long)length; char *value; char *eol; variable_buffer = 0; value = variable_expand_string_2 (NULL, line, len, &eol); if (value_lenp) *value_lenp = eol - value; *buffer_lengthp = variable_buffer_length; variable_buffer = obuf; variable_buffer_length = olen; return value; } /* recycle a buffer. */ void recycle_variable_buffer (char *buffer, unsigned int length) { struct recycled_buffer *recycled = (struct recycled_buffer *)buffer; assert (!(length & 31)); assert (length >= 384); recycled->length = length; recycled->next = recycled_head; recycled_head = recycled; } #endif /* CONFIG_WITH_VALUE_LENGTH */ /* Install a new variable_buffer context, returning the current one for safe-keeping. */ void install_variable_buffer (char **bufp, unsigned int *lenp) { *bufp = variable_buffer; *lenp = variable_buffer_length; variable_buffer = 0; initialize_variable_output (); } #ifdef CONFIG_WITH_COMPILER /* Same as install_variable_buffer, except we supply a size hint. */ char * install_variable_buffer_with_hint (char **bufp, unsigned int *lenp, unsigned int size_hint) { struct recycled_buffer *recycled; char *buf; *bufp = variable_buffer; *lenp = variable_buffer_length; recycled = recycled_head; if (recycled) { recycled_head = recycled->next; variable_buffer_length = recycled->length; variable_buffer = buf = (char *)recycled; } else { if (size_hint < 512) variable_buffer_length = (size_hint + 1 + 63) & ~(unsigned int)63; else if (size_hint < 4096) variable_buffer_length = (size_hint + 1 + 1023) & ~(unsigned int)1023; else variable_buffer_length = (size_hint + 1 + 4095) & ~(unsigned int)4095; variable_buffer = buf = xmalloc (variable_buffer_length); } buf[0] = '\0'; return buf; } #endif /* CONFIG_WITH_COMPILER */ /* Restore a previously-saved variable_buffer setting (free the current one). */ void restore_variable_buffer (char *buf, unsigned int len) { #ifndef CONFIG_WITH_VALUE_LENGTH free (variable_buffer); #else if (variable_buffer) recycle_variable_buffer (variable_buffer, variable_buffer_length); #endif variable_buffer = buf; variable_buffer_length = len; } /* Used to make sure there is at least SIZE bytes of buffer space available starting at PTR. */ char * ensure_variable_buffer_space(char *ptr, unsigned int size) { unsigned int offset = (unsigned int)(ptr - variable_buffer); assert(offset <= variable_buffer_length); if (variable_buffer_length - offset < size) { unsigned minlen = size + offset; variable_buffer_length *= 2; if (variable_buffer_length < minlen + 100) variable_buffer_length = (minlen + 100 + 63) & ~(unsigned int)63; variable_buffer = xrealloc (variable_buffer, variable_buffer_length); ptr = variable_buffer + offset; } return ptr; } kbuild-3608/src/kmk/INSTALL0000664000175000017500000002207114670377415015330 0ustar locutuslocutusInstallation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PREFIX', the package will use PREFIX as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. kbuild-3608/src/kmk/.gitignore0000664000175000017500000000117214670377413016264 0ustar locutuslocutus# Development artifacts ID TAGS .*gdbinit .gdb_history *~ #* .#* # Configure artifacts ABOUT-NLS Makefile Makefile.in aclocal.m4 autom4te.cache config.cache config.h config.h.in config.log config.status configure stamp-h1 # Build artifacts .deps gmk-default.h loadavg make *.o *.exe *.dll.a *.obj *.lib *.pdb *.sbr # Windows build artifacts WinDebug/ WinRel/ GccDebug/ GccRel/ # Distribution artifacts .dep_segment .check-git-HEAD ChangeLog Makefile.DOS NMakefile README README.DOS README.OS2 README.W32 SMakefile build.sh build.sh.in config.ami config.h-vms config.h.W32 configh.dos make-[0-9]*/ make-[0-9]*.tar.* checkcfg.*.log kbuild-3608/src/kmk/expreval.c0000664000175000017500000017005314670377412016272 0ustar locutuslocutus#ifdef CONFIG_WITH_IF_CONDITIONALS /* $Id: expreval.c 3544 2022-01-29 02:22:03Z bird $ */ /** @file * expreval - Expressions evaluator, C / BSD make / nmake style. */ /* * Copyright (c) 2008-2010 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "makeint.h" #include #include #include "filedef.h" #include "dep.h" #include "job.h" #include "commands.h" #include "variable.h" #include "rule.h" #include "debug.h" #include "hash.h" #include "version_compare.h" #include #ifndef _MSC_VER # include #endif #include /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** The max length of a string representation of a number. */ #define EXPR_NUM_LEN ((sizeof("-9223372036854775802") + 4) & ~3) /** The max operator stack depth. */ #define EXPR_MAX_OPERATORS 72 /** The max operand depth. */ #define EXPR_MAX_OPERANDS 128 /** Check if @a a_ch is a valid separator for a alphabetical binary * operator, omitting isspace. */ #define EXPR_IS_OP_SEPARATOR_NO_SPACE(a_ch) \ (ispunct((a_ch)) && (a_ch) != '@' && (a_ch) != '_') /** Check if @a a_ch is a valid separator for a alphabetical binary operator. */ #define EXPR_IS_OP_SEPARATOR(a_ch) \ (isspace((a_ch)) || EXPR_IS_OP_SEPARATOR_NO_SPACE(a_ch)) /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** The 64-bit signed integer type we're using. */ #ifdef _MSC_VER typedef __int64 EXPRINT64; #else # include typedef int64_t EXPRINT64; #endif /** Pointer to a evaluator instance. */ typedef struct EXPR *PEXPR; /** * Operand variable type. */ typedef enum { /** Invalid zero entry. */ kExprVar_Invalid = 0, /** A number. */ kExprVar_Num, /** A string in need of expanding (perhaps). */ kExprVar_String, /** A simple string that doesn't need expanding. */ kExprVar_SimpleString, /** A quoted string in need of expanding (perhaps). */ kExprVar_QuotedString, /** A simple quoted string that doesn't need expanding. */ kExprVar_QuotedSimpleString, /** The end of the valid variable types. */ kExprVar_End } EXPRVARTYPE; /** * Operand variable. */ typedef struct { /** The variable type. */ EXPRVARTYPE enmType; /** The variable. */ union { /** Pointer to the string. */ char *psz; /** The variable. */ EXPRINT64 i; } uVal; } EXPRVAR; /** Pointer to a operand variable. */ typedef EXPRVAR *PEXPRVAR; /** Pointer to a const operand variable. */ typedef EXPRVAR const *PCEXPRVAR; /** * Operator return statuses. */ typedef enum { kExprRet_Error = -1, kExprRet_Ok = 0, kExprRet_Operator, kExprRet_Operand, kExprRet_EndOfExpr, kExprRet_End } EXPRRET; /** * Operator. */ typedef struct { /** The operator. */ char szOp[11]; /** The length of the operator string. */ char cchOp; /** The pair operator. * This is used with '(' and '?'. */ char chPair; /** The precedence. Higher means higher. */ char iPrecedence; /** The number of arguments it takes. */ signed char cArgs; /** Pointer to the method implementing the operator. */ EXPRRET (*pfn)(PEXPR pThis); } EXPROP; /** Pointer to a const operator. */ typedef EXPROP const *PCEXPROP; /** * Expression evaluator instance. */ typedef struct EXPR { /** The full expression. */ const char *pszExpr; /** The current location. */ const char *psz; /** The current file location, used for errors. */ const floc *pFileLoc; /** Pending binary operator. */ PCEXPROP pPending; /** Top of the operator stack. */ int iOp; /** Top of the operand stack. */ int iVar; /** The operator stack. */ PCEXPROP apOps[EXPR_MAX_OPERATORS]; /** The operand stack. */ EXPRVAR aVars[EXPR_MAX_OPERANDS]; } EXPR; /******************************************************************************* * Global Variables * *******************************************************************************/ /** Operator start character map. * This indicates which characters that are starting operators and which aren't. * * Bit 0: Indicates that this char is used in operators. * Bit 1: When bit 0 is clear, this indicates whitespace. * When bit 1 is set, this indicates whether the operator can be used * immediately next to an operand without any clear separation. * Bits 2 thru 7: Index into g_aExprOps of the first operator starting with * this character. */ static unsigned char g_auchOpStartCharMap[256]; /** Whether we've initialized the map. */ static int g_fExprInitializedMap = 0; /******************************************************************************* * Internal Functions * *******************************************************************************/ static void expr_unget_op(PEXPR pThis); static EXPRRET expr_get_binary_or_eoe_or_rparen(PEXPR pThis); /** * Displays an error message. * * The total string length must not exceed 256 bytes. * * @param pThis The evaluator instance. * @param pszError The message format string. * @param ... The message format args. */ static void expr_error(PEXPR pThis, const char *pszError, ...) { char szTmp[256]; va_list va; va_start(va, pszError); vsprintf(szTmp, pszError, va); va_end(va); OS(fatal,pThis->pFileLoc, "%s", szTmp); } /** * Converts a number to a string. * * @returns pszDst. * @param pszDst The string buffer to write into. Assumes length of EXPR_NUM_LEN. * @param iSrc The number to convert. */ static char *expr_num_to_string(char *pszDst, EXPRINT64 iSrc) { static const char s_szDigits[17] = "0123456789abcdef"; char szTmp[EXPR_NUM_LEN]; char *psz = &szTmp[EXPR_NUM_LEN - 1]; int fNegative; fNegative = iSrc < 0; if (fNegative) { /** @todo this isn't right for INT64_MIN. */ iSrc = -iSrc; } *psz = '\0'; do { #if 0 *--psz = s_szDigits[iSrc & 0xf]; iSrc >>= 4; #else *--psz = s_szDigits[iSrc % 10]; iSrc /= 10; #endif } while (iSrc); #if 0 *--psz = 'x'; *--psz = '0'; #endif if (fNegative) *--psz = '-'; /* copy it into the output buffer. */ return (char *)memcpy(pszDst, psz, &szTmp[EXPR_NUM_LEN] - psz); } /** * Attempts to convert a (simple) string into a number. * * @returns status code. * @param pThis The evaluator instance. This is optional when fQuiet is true. * @param piSrc Where to store the numeric value on success. * @param pszSrc The string to try convert. * @param fQuiet Whether we should be quiet or grumpy on failure. */ static EXPRRET expr_string_to_num(PEXPR pThis, EXPRINT64 *piDst, const char *pszSrc, int fQuiet) { EXPRRET rc = kExprRet_Ok; char const *psz = pszSrc; EXPRINT64 i; unsigned uBase; int fNegative; /* * Skip blanks. */ while (ISBLANK(*psz)) psz++; /* * Check for '-'. * * At this point we will not need to deal with operators, this is * just an indicator of negative numbers. If some operator ends up * here it's because it came from a string expansion and thus shall * not be interpreted. If this turns out to be an stupid restriction * it can be fixed, but for now it stays like this. */ fNegative = *psz == '-'; if (fNegative) psz++; /* * Determin base. * * Recognize some exsotic prefixes here in addition to the two standard ones. */ if (*psz != '0') uBase = 10; else if (psz[1] == 'x' || psz[1] == 'X') { uBase = 16; psz += 2; } else if (psz[1] == 'b' || psz[1] == 'B') { uBase = 2; psz += 2; } else if (psz[1] == 'd' || psz[1] == 'D') { uBase = 10; psz += 2; } else if (psz[1] == 'o' || psz[1] == 'O') { uBase = 8; psz += 2; } else if (isdigit(psz[1]) && psz[1] != '9' && psz[1] != '8') { uBase = 8; psz++; } else uBase = 10; /* * Convert until we hit a non-digit. */ i = 0; for (;;) { unsigned iDigit; int ch = *psz; switch (ch) { case '0': iDigit = 0; break; case '1': iDigit = 1; break; case '2': iDigit = 2; break; case '3': iDigit = 3; break; case '4': iDigit = 4; break; case '5': iDigit = 5; break; case '6': iDigit = 6; break; case '7': iDigit = 7; break; case '8': iDigit = 8; break; case '9': iDigit = 9; break; case 'a': case 'A': iDigit = 10; break; case 'b': case 'B': iDigit = 11; break; case 'c': case 'C': iDigit = 12; break; case 'd': case 'D': iDigit = 13; break; case 'e': case 'E': iDigit = 14; break; case 'f': case 'F': iDigit = 15; break; default: /* is the rest white space? */ while (ISSPACE(*psz)) psz++; if (*psz != '\0') { iDigit = uBase; break; } /* fall thru */ case '\0': if (fNegative) i = -i; *piDst = i; return rc; } if (iDigit >= uBase) { if (fNegative) i = -i; *piDst = i; if (!fQuiet) expr_error(pThis, "Invalid number \"%.80s\"", pszSrc); return kExprRet_Error; } /* add the digit and advance */ i *= uBase; i += iDigit; psz++; } /* not reached */ } /** * Checks if the variable is a string or not. * * @returns 1 if it's a string, 0 otherwise. * @param pVar The variable. */ static int expr_var_is_string(PCEXPRVAR pVar) { return pVar->enmType >= kExprVar_String; } /** * Checks if the variable contains a string that was quoted * in the expression. * * @returns 1 if if was a quoted string, otherwise 0. * @param pVar The variable. */ static int expr_var_was_quoted(PCEXPRVAR pVar) { return pVar->enmType >= kExprVar_QuotedString; } /** * Deletes a variable. * * @param pVar The variable. */ static void expr_var_delete(PEXPRVAR pVar) { if (expr_var_is_string(pVar)) { free(pVar->uVal.psz); pVar->uVal.psz = NULL; } pVar->enmType = kExprVar_Invalid; } /** * Initializes a new variables with a sub-string value. * * @param pVar The new variable. * @param psz The start of the string value. * @param cch The number of chars to copy. * @param enmType The string type. */ static void expr_var_init_substring(PEXPRVAR pVar, const char *psz, size_t cch, EXPRVARTYPE enmType) { /* convert string needing expanding into simple ones if possible. */ if ( enmType == kExprVar_String && !memchr(psz, '$', cch)) enmType = kExprVar_SimpleString; else if ( enmType == kExprVar_QuotedString && !memchr(psz, '$', cch)) enmType = kExprVar_QuotedSimpleString; pVar->enmType = enmType; pVar->uVal.psz = xmalloc(cch + 1); memcpy(pVar->uVal.psz, psz, cch); pVar->uVal.psz[cch] = '\0'; } #if 0 /* unused */ /** * Initializes a new variables with a string value. * * @param pVar The new variable. * @param psz The string value. * @param enmType The string type. */ static void expr_var_init_string(PEXPRVAR pVar, const char *psz, EXPRVARTYPE enmType) { expr_var_init_substring(pVar, psz, strlen(psz), enmType); } /** * Assigns a sub-string value to a variable. * * @param pVar The new variable. * @param psz The start of the string value. * @param cch The number of chars to copy. * @param enmType The string type. */ static void expr_var_assign_substring(PEXPRVAR pVar, const char *psz, size_t cch, EXPRVARTYPE enmType) { expr_var_delete(pVar); expr_var_init_substring(pVar, psz, cch, enmType); } /** * Assignes a string value to a variable. * * @param pVar The variable. * @param psz The string value. * @param enmType The string type. */ static void expr_var_assign_string(PEXPRVAR pVar, const char *psz, EXPRVARTYPE enmType) { expr_var_delete(pVar); expr_var_init_string(pVar, psz, enmType); } #endif /* unused */ /** * Simplifies a string variable. * * @param pVar The variable. */ static void expr_var_make_simple_string(PEXPRVAR pVar) { switch (pVar->enmType) { case kExprVar_Num: { char *psz = (char *)xmalloc(EXPR_NUM_LEN); expr_num_to_string(psz, pVar->uVal.i); pVar->uVal.psz = psz; pVar->enmType = kExprVar_SimpleString; break; } case kExprVar_String: case kExprVar_QuotedString: { char *psz; assert(strchr(pVar->uVal.psz, '$')); psz = allocated_variable_expand(pVar->uVal.psz); free(pVar->uVal.psz); pVar->uVal.psz = psz; pVar->enmType = pVar->enmType == kExprVar_String ? kExprVar_SimpleString : kExprVar_QuotedSimpleString; break; } case kExprVar_SimpleString: case kExprVar_QuotedSimpleString: /* nothing to do. */ break; default: assert(0); } } #if 0 /* unused */ /** * Turns a variable into a string value. * * @param pVar The variable. */ static void expr_var_make_string(PEXPRVAR pVar) { switch (pVar->enmType) { case kExprVar_Num: expr_var_make_simple_string(pVar); break; case kExprVar_String: case kExprVar_SimpleString: case kExprVar_QuotedString: case kExprVar_QuotedSimpleString: /* nothing to do. */ break; default: assert(0); } } #endif /* unused */ /** * Initializes a new variables with a integer value. * * @param pVar The new variable. * @param i The integer value. */ static void expr_var_init_num(PEXPRVAR pVar, EXPRINT64 i) { pVar->enmType = kExprVar_Num; pVar->uVal.i = i; } /** * Assigns a integer value to a variable. * * @param pVar The variable. * @param i The integer value. */ static void expr_var_assign_num(PEXPRVAR pVar, EXPRINT64 i) { expr_var_delete(pVar); expr_var_init_num(pVar, i); } /** * Turns the variable into a number. * * @returns status code. * @param pThis The evaluator instance. * @param pVar The variable. */ static EXPRRET expr_var_make_num(PEXPR pThis, PEXPRVAR pVar) { switch (pVar->enmType) { case kExprVar_Num: /* nothing to do. */ break; case kExprVar_String: expr_var_make_simple_string(pVar); /* fall thru */ case kExprVar_SimpleString: { EXPRINT64 i; EXPRRET rc = expr_string_to_num(pThis, &i, pVar->uVal.psz, 0 /* fQuiet */); if (rc < kExprRet_Ok) return rc; expr_var_assign_num(pVar, i); break; } case kExprVar_QuotedString: case kExprVar_QuotedSimpleString: expr_error(pThis, "Cannot convert a quoted string to a number"); return kExprRet_Error; default: assert(0); return kExprRet_Error; } return kExprRet_Ok; } /** * Try to turn the variable into a number. * * @returns status code. * @param pVar The variable. */ static EXPRRET expr_var_try_make_num(PEXPRVAR pVar) { switch (pVar->enmType) { case kExprVar_Num: /* nothing to do. */ break; case kExprVar_String: expr_var_make_simple_string(pVar); /* fall thru */ case kExprVar_SimpleString: { EXPRINT64 i; EXPRRET rc = expr_string_to_num(NULL, &i, pVar->uVal.psz, 1 /* fQuiet */); if (rc < kExprRet_Ok) return rc; expr_var_assign_num(pVar, i); break; } default: assert(0); case kExprVar_QuotedString: case kExprVar_QuotedSimpleString: /* can't do this */ return kExprRet_Error; } return kExprRet_Ok; } /** * Initializes a new variables with a boolean value. * * @param pVar The new variable. * @param f The boolean value. */ static void expr_var_init_bool(PEXPRVAR pVar, int f) { pVar->enmType = kExprVar_Num; pVar->uVal.i = !!f; } /** * Assigns a boolean value to a variable. * * @param pVar The variable. * @param f The boolean value. */ static void expr_var_assign_bool(PEXPRVAR pVar, int f) { expr_var_delete(pVar); expr_var_init_bool(pVar, f); } /** * Turns the variable into an boolean. * * @returns the boolean interpretation. * @param pVar The variable. */ static int expr_var_make_bool(PEXPRVAR pVar) { switch (pVar->enmType) { case kExprVar_Num: pVar->uVal.i = !!pVar->uVal.i; break; case kExprVar_String: expr_var_make_simple_string(pVar); /* fall thru */ case kExprVar_SimpleString: { /* * Try convert it to a number. If that fails, use the * GNU make boolean logic - not empty string means true. */ EXPRINT64 iVal; char const *psz = pVar->uVal.psz; while (ISBLANK(*psz)) psz++; if ( *psz && expr_string_to_num(NULL, &iVal, psz, 1 /* fQuiet */) >= kExprRet_Ok) expr_var_assign_bool(pVar, iVal != 0); else expr_var_assign_bool(pVar, *psz != '\0'); break; } case kExprVar_QuotedString: expr_var_make_simple_string(pVar); /* fall thru */ case kExprVar_QuotedSimpleString: /* * Use GNU make boolean logic (not empty string means true). * No stripping here, the string is quoted. */ expr_var_assign_bool(pVar, *pVar->uVal.psz != '\0'); break; default: assert(0); break; } return pVar->uVal.i; } /** * Pops a varable off the stack and deletes it. * @param pThis The evaluator instance. */ static void expr_pop_and_delete_var(PEXPR pThis) { expr_var_delete(&pThis->aVars[pThis->iVar]); pThis->iVar--; } /** * Tries to make the variables the same type. * * This will not convert numbers to strings, unless one of them * is a quoted string. * * this will try convert both to numbers if neither is quoted. Both * conversions will have to suceed for this to be commited. * * All strings will be simplified. * * @returns status code. Done complaining on failure. * * @param pThis The evaluator instance. * @param pVar1 The first variable. * @param pVar2 The second variable. */ static EXPRRET expr_var_unify_types(PEXPR pThis, PEXPRVAR pVar1, PEXPRVAR pVar2, const char *pszOp) { /* * Try make the variables the same type before comparing. */ if ( !expr_var_was_quoted(pVar1) && !expr_var_was_quoted(pVar2)) { if ( expr_var_is_string(pVar1) || expr_var_is_string(pVar2)) { if (!expr_var_is_string(pVar1)) expr_var_try_make_num(pVar2); else if (!expr_var_is_string(pVar2)) expr_var_try_make_num(pVar1); else { /* * Both are strings, simplify them then see if both can be made into numbers. */ EXPRINT64 iVar1; EXPRINT64 iVar2; expr_var_make_simple_string(pVar1); expr_var_make_simple_string(pVar2); if ( expr_string_to_num(NULL, &iVar1, pVar1->uVal.psz, 1 /* fQuiet */) >= kExprRet_Ok && expr_string_to_num(NULL, &iVar2, pVar2->uVal.psz, 1 /* fQuiet */) >= kExprRet_Ok) { expr_var_assign_num(pVar1, iVar1); expr_var_assign_num(pVar2, iVar2); } } } } else { expr_var_make_simple_string(pVar1); expr_var_make_simple_string(pVar2); } /* * Complain if they aren't the same type now. */ if (expr_var_is_string(pVar1) != expr_var_is_string(pVar2)) { expr_error(pThis, "Unable to unify types for \"%s\"", pszOp); return kExprRet_Error; } return kExprRet_Ok; } /** * Is variable defined, unary. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_defined(PEXPR pThis) { PEXPRVAR pVar = &pThis->aVars[pThis->iVar]; struct variable *pMakeVar; expr_var_make_simple_string(pVar); pMakeVar = lookup_variable(pVar->uVal.psz, strlen(pVar->uVal.psz)); expr_var_assign_bool(pVar, pMakeVar && *pMakeVar->value != '\0'); return kExprRet_Ok; } /** * Does file(/dir/whatever) exist, unary. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_exists(PEXPR pThis) { PEXPRVAR pVar = &pThis->aVars[pThis->iVar]; struct stat st; expr_var_make_simple_string(pVar); expr_var_assign_bool(pVar, stat(pVar->uVal.psz, &st) == 0); return kExprRet_Ok; } /** * Is target defined, unary. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_target(PEXPR pThis) { PEXPRVAR pVar = &pThis->aVars[pThis->iVar]; struct file *pFile = NULL; /* * Because of secondary target expansion, lookup the unexpanded * name first. */ #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION if ( pVar->enmType == kExprVar_String || pVar->enmType == kExprVar_QuotedString) { pFile = lookup_file(pVar->uVal.psz); if ( pFile && !pFile->need_2nd_target_expansion) pFile = NULL; } if (!pFile) #endif { expr_var_make_simple_string(pVar); pFile = lookup_file(pVar->uVal.psz); } /* * Always inspect the head of a multiple target rule * and look for a file with commands. */ #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (pFile && pFile->multi_head) pFile = pFile->multi_head; #endif while (pFile && !pFile->cmds) pFile = pFile->prev; expr_var_assign_bool(pVar, pFile != NULL && pFile->is_target); return kExprRet_Ok; } /** * Convert to boolean. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_bool(PEXPR pThis) { expr_var_make_bool(&pThis->aVars[pThis->iVar]); return kExprRet_Ok; } /** * Convert to number, works on quoted strings too. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_num(PEXPR pThis) { PEXPRVAR pVar = &pThis->aVars[pThis->iVar]; /* unquote the string */ if (pVar->enmType == kExprVar_QuotedSimpleString) pVar->enmType = kExprVar_SimpleString; else if (pVar->enmType == kExprVar_QuotedString) pVar->enmType = kExprVar_String; return expr_var_make_num(pThis, pVar); } /** * Performs a strlen() on the simplified/converted string argument. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_strlen(PEXPR pThis) { PEXPRVAR pVar = &pThis->aVars[pThis->iVar]; expr_var_make_simple_string(pVar); expr_var_assign_num(pVar, strlen(pVar->uVal.psz)); return kExprRet_Ok; } /** * Convert to string (simplified and quoted) * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_str(PEXPR pThis) { PEXPRVAR pVar = &pThis->aVars[pThis->iVar]; expr_var_make_simple_string(pVar); pVar->enmType = kExprVar_QuotedSimpleString; return kExprRet_Ok; } /** * Pluss (dummy / make_integer) * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_pluss(PEXPR pThis) { return expr_var_make_num(pThis, &pThis->aVars[pThis->iVar]); } /** * Minus (negate) * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_minus(PEXPR pThis) { EXPRRET rc; PEXPRVAR pVar = &pThis->aVars[pThis->iVar]; rc = expr_var_make_num(pThis, pVar); if (rc >= kExprRet_Ok) pVar->uVal.i = -pVar->uVal.i; return rc; } /** * Bitwise NOT. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_bitwise_not(PEXPR pThis) { EXPRRET rc; PEXPRVAR pVar = &pThis->aVars[pThis->iVar]; rc = expr_var_make_num(pThis, pVar); if (rc >= kExprRet_Ok) pVar->uVal.i = ~pVar->uVal.i; return rc; } /** * Logical NOT. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_logical_not(PEXPR pThis) { PEXPRVAR pVar = &pThis->aVars[pThis->iVar]; expr_var_make_bool(pVar); pVar->uVal.i = !pVar->uVal.i; return kExprRet_Ok; } /** * Multiplication. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_multiply(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_make_num(pThis, pVar1); if (rc >= kExprRet_Ok) { rc = expr_var_make_num(pThis, pVar2); if (rc >= kExprRet_Ok) pVar1->uVal.i *= pVar2->uVal.i; } expr_pop_and_delete_var(pThis); return rc; } /** * Division. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_divide(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_make_num(pThis, pVar1); if (rc >= kExprRet_Ok) { rc = expr_var_make_num(pThis, pVar2); if (rc >= kExprRet_Ok) pVar1->uVal.i /= pVar2->uVal.i; } expr_pop_and_delete_var(pThis); return rc; } /** * Modulus. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_modulus(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_make_num(pThis, pVar1); if (rc >= kExprRet_Ok) { rc = expr_var_make_num(pThis, pVar2); if (rc >= kExprRet_Ok) pVar1->uVal.i %= pVar2->uVal.i; } expr_pop_and_delete_var(pThis); return rc; } /** * Addition (numeric). * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_add(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_make_num(pThis, pVar1); if (rc >= kExprRet_Ok) { rc = expr_var_make_num(pThis, pVar2); if (rc >= kExprRet_Ok) pVar1->uVal.i += pVar2->uVal.i; } expr_pop_and_delete_var(pThis); return rc; } /** * Subtract (numeric). * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_sub(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_make_num(pThis, pVar1); if (rc >= kExprRet_Ok) { rc = expr_var_make_num(pThis, pVar2); if (rc >= kExprRet_Ok) pVar1->uVal.i -= pVar2->uVal.i; } expr_pop_and_delete_var(pThis); return rc; } /** * Bitwise left shift. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_shift_left(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_make_num(pThis, pVar1); if (rc >= kExprRet_Ok) { rc = expr_var_make_num(pThis, pVar2); if (rc >= kExprRet_Ok) pVar1->uVal.i <<= pVar2->uVal.i; } expr_pop_and_delete_var(pThis); return rc; } /** * Bitwise right shift. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_shift_right(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_make_num(pThis, pVar1); if (rc >= kExprRet_Ok) { rc = expr_var_make_num(pThis, pVar2); if (rc >= kExprRet_Ok) pVar1->uVal.i >>= pVar2->uVal.i; } expr_pop_and_delete_var(pThis); return rc; } /** * Less than or equal, version string. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_ver_less_or_equal_than(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_unify_types(pThis, pVar1, pVar2, "vle"); if (rc >= kExprRet_Ok) { if (!expr_var_is_string(pVar1)) expr_var_assign_bool(pVar1, pVar1->uVal.i <= pVar2->uVal.i); else expr_var_assign_bool(pVar1, version_compare(pVar1->uVal.psz, pVar2->uVal.psz) <= 0); } expr_pop_and_delete_var(pThis); return rc; } /** * Less than or equal. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_less_or_equal_than(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_unify_types(pThis, pVar1, pVar2, "<="); if (rc >= kExprRet_Ok) { if (!expr_var_is_string(pVar1)) expr_var_assign_bool(pVar1, pVar1->uVal.i <= pVar2->uVal.i); else expr_var_assign_bool(pVar1, strcmp(pVar1->uVal.psz, pVar2->uVal.psz) <= 0); } expr_pop_and_delete_var(pThis); return rc; } /** * Less than, version string. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_ver_less_than(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_unify_types(pThis, pVar1, pVar2, "vlt"); if (rc >= kExprRet_Ok) { if (!expr_var_is_string(pVar1)) expr_var_assign_bool(pVar1, pVar1->uVal.i < pVar2->uVal.i); else expr_var_assign_bool(pVar1, version_compare(pVar1->uVal.psz, pVar2->uVal.psz) < 0); } expr_pop_and_delete_var(pThis); return rc; } /** * Less than. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_less_than(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_unify_types(pThis, pVar1, pVar2, "<"); if (rc >= kExprRet_Ok) { if (!expr_var_is_string(pVar1)) expr_var_assign_bool(pVar1, pVar1->uVal.i < pVar2->uVal.i); else expr_var_assign_bool(pVar1, strcmp(pVar1->uVal.psz, pVar2->uVal.psz) < 0); } expr_pop_and_delete_var(pThis); return rc; } /** * Greater or equal than, version string. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_ver_greater_or_equal_than(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_unify_types(pThis, pVar1, pVar2, "vge"); if (rc >= kExprRet_Ok) { if (!expr_var_is_string(pVar1)) expr_var_assign_bool(pVar1, pVar1->uVal.i >= pVar2->uVal.i); else expr_var_assign_bool(pVar1, version_compare(pVar1->uVal.psz, pVar2->uVal.psz) >= 0); } expr_pop_and_delete_var(pThis); return rc; } /** * Greater or equal than. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_greater_or_equal_than(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_unify_types(pThis, pVar1, pVar2, ">="); if (rc >= kExprRet_Ok) { if (!expr_var_is_string(pVar1)) expr_var_assign_bool(pVar1, pVar1->uVal.i >= pVar2->uVal.i); else expr_var_assign_bool(pVar1, strcmp(pVar1->uVal.psz, pVar2->uVal.psz) >= 0); } expr_pop_and_delete_var(pThis); return rc; } /** * Greater than, version string. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_ver_greater_than(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_unify_types(pThis, pVar1, pVar2, "vgt"); if (rc >= kExprRet_Ok) { if (!expr_var_is_string(pVar1)) expr_var_assign_bool(pVar1, pVar1->uVal.i > pVar2->uVal.i); else expr_var_assign_bool(pVar1, version_compare(pVar1->uVal.psz, pVar2->uVal.psz) > 0); } expr_pop_and_delete_var(pThis); return rc; } /** * Greater than. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_greater_than(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; rc = expr_var_unify_types(pThis, pVar1, pVar2, ">"); if (rc >= kExprRet_Ok) { if (!expr_var_is_string(pVar1)) expr_var_assign_bool(pVar1, pVar1->uVal.i > pVar2->uVal.i); else expr_var_assign_bool(pVar1, strcmp(pVar1->uVal.psz, pVar2->uVal.psz) > 0); } expr_pop_and_delete_var(pThis); return rc; } /** * Equal, version strings. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_ver_equal(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; int const fIsString1 = expr_var_is_string(pVar1); /* * The same type? */ if (fIsString1 == expr_var_is_string(pVar2)) { if (!fIsString1) /* numbers are simple */ expr_var_assign_bool(pVar1, pVar1->uVal.i == pVar2->uVal.i); else { /* try a normal string compare. */ expr_var_make_simple_string(pVar1); expr_var_make_simple_string(pVar2); if (!version_compare(pVar1->uVal.psz, pVar2->uVal.psz)) expr_var_assign_bool(pVar1, 1); /* try convert and compare as number instead. */ else if ( expr_var_try_make_num(pVar1) >= kExprRet_Ok && expr_var_try_make_num(pVar2) >= kExprRet_Ok) expr_var_assign_bool(pVar1, pVar1->uVal.i == pVar2->uVal.i); /* ok, they really aren't equal. */ else expr_var_assign_bool(pVar1, 0); } } else { /* * If the type differs, there are now two options: * 1. Try convert the string to a valid number and compare the numbers. * 2. Convert the non-string to a number and compare the strings. */ if ( expr_var_try_make_num(pVar1) >= kExprRet_Ok && expr_var_try_make_num(pVar2) >= kExprRet_Ok) expr_var_assign_bool(pVar1, pVar1->uVal.i == pVar2->uVal.i); else { expr_var_make_simple_string(pVar1); expr_var_make_simple_string(pVar2); expr_var_assign_bool(pVar1, version_compare(pVar1->uVal.psz, pVar2->uVal.psz) == 0); } } expr_pop_and_delete_var(pThis); return rc; } /** * Not equal, version string. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_ver_not_equal(PEXPR pThis) { EXPRRET rc = expr_op_ver_equal(pThis); if (rc >= kExprRet_Ok) rc = expr_op_logical_not(pThis); return rc; } /** * Equal. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_equal(PEXPR pThis) { EXPRRET rc = kExprRet_Ok; PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; int const fIsString1 = expr_var_is_string(pVar1); /* * The same type? */ if (fIsString1 == expr_var_is_string(pVar2)) { if (!fIsString1) /* numbers are simple */ expr_var_assign_bool(pVar1, pVar1->uVal.i == pVar2->uVal.i); else { /* try a normal string compare. */ expr_var_make_simple_string(pVar1); expr_var_make_simple_string(pVar2); if (!strcmp(pVar1->uVal.psz, pVar2->uVal.psz)) expr_var_assign_bool(pVar1, 1); /* try convert and compare as number instead. */ else if ( expr_var_try_make_num(pVar1) >= kExprRet_Ok && expr_var_try_make_num(pVar2) >= kExprRet_Ok) expr_var_assign_bool(pVar1, pVar1->uVal.i == pVar2->uVal.i); /* ok, they really aren't equal. */ else expr_var_assign_bool(pVar1, 0); } } else { /* * If the type differs, there are now two options: * 1. Convert the string to a valid number and compare the numbers. * 2. Convert an empty string to a 'false' boolean value and compare * numerically. This one is a bit questionable, so we don't try this. */ if ( expr_var_try_make_num(pVar1) >= kExprRet_Ok && expr_var_try_make_num(pVar2) >= kExprRet_Ok) expr_var_assign_bool(pVar1, pVar1->uVal.i == pVar2->uVal.i); else { expr_error(pThis, "Cannot compare strings and numbers"); rc = kExprRet_Error; } } expr_pop_and_delete_var(pThis); return rc; } /** * Not equal. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_not_equal(PEXPR pThis) { EXPRRET rc = expr_op_equal(pThis); if (rc >= kExprRet_Ok) rc = expr_op_logical_not(pThis); return rc; } /** * Bitwise AND. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_bitwise_and(PEXPR pThis) { PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; EXPRRET rc; rc = expr_var_make_num(pThis, pVar1); if (rc >= kExprRet_Ok) { rc = expr_var_make_num(pThis, pVar2); if (rc >= kExprRet_Ok) pVar1->uVal.i &= pVar2->uVal.i; } expr_pop_and_delete_var(pThis); return kExprRet_Ok; } /** * Bitwise XOR. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_bitwise_xor(PEXPR pThis) { PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; EXPRRET rc; rc = expr_var_make_num(pThis, pVar1); if (rc >= kExprRet_Ok) { rc = expr_var_make_num(pThis, pVar2); if (rc >= kExprRet_Ok) pVar1->uVal.i ^= pVar2->uVal.i; } expr_pop_and_delete_var(pThis); return kExprRet_Ok; } /** * Bitwise OR. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_bitwise_or(PEXPR pThis) { PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; EXPRRET rc; rc = expr_var_make_num(pThis, pVar1); if (rc >= kExprRet_Ok) { rc = expr_var_make_num(pThis, pVar2); if (rc >= kExprRet_Ok) pVar1->uVal.i |= pVar2->uVal.i; } expr_pop_and_delete_var(pThis); return kExprRet_Ok; } /** * Logical AND. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_logical_and(PEXPR pThis) { PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; if ( expr_var_make_bool(pVar1) && expr_var_make_bool(pVar2)) expr_var_assign_bool(pVar1, 1); else expr_var_assign_bool(pVar1, 0); expr_pop_and_delete_var(pThis); return kExprRet_Ok; } /** * Logical OR. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_logical_or(PEXPR pThis) { PEXPRVAR pVar1 = &pThis->aVars[pThis->iVar - 1]; PEXPRVAR pVar2 = &pThis->aVars[pThis->iVar]; if ( expr_var_make_bool(pVar1) || expr_var_make_bool(pVar2)) expr_var_assign_bool(pVar1, 1); else expr_var_assign_bool(pVar1, 0); expr_pop_and_delete_var(pThis); return kExprRet_Ok; } /** * Left parenthesis. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_left_parenthesis(PEXPR pThis) { /* * There should be a right parenthesis operator lined up for us now, * eat it. If not found there is an inbalance. */ EXPRRET rc = expr_get_binary_or_eoe_or_rparen(pThis); if ( rc == kExprRet_Operator && pThis->apOps[pThis->iOp]->szOp[0] == ')') { /* pop it and get another one which we can leave pending. */ pThis->iOp--; rc = expr_get_binary_or_eoe_or_rparen(pThis); if (rc >= kExprRet_Ok) expr_unget_op(pThis); } else { expr_error(pThis, "Missing ')'"); rc = kExprRet_Error; } return rc; } /** * Right parenthesis, dummy that's never actually called. * * @returns Status code. * @param pThis The instance. */ static EXPRRET expr_op_right_parenthesis(PEXPR pThis) { assert(0); (void)pThis; return kExprRet_Ok; } /** * The operator table. * * This table is NOT ordered by precedence, but for linear search * allowing for first match to return the correct operator. This * means that || must come before |, or else | will match all. */ static const EXPROP g_aExprOps[] = { #define EXPR_OP(szOp, iPrecedence, cArgs, pfn) { szOp, sizeof(szOp) - 1, '\0', iPrecedence, cArgs, pfn } /* Name, iPrecedence, cArgs, pfn */ EXPR_OP("defined", 90, 1, expr_op_defined), EXPR_OP("exists", 90, 1, expr_op_exists), EXPR_OP("target", 90, 1, expr_op_target), EXPR_OP("bool", 90, 1, expr_op_bool), EXPR_OP("num", 90, 1, expr_op_num), EXPR_OP("strlen", 90, 1, expr_op_strlen), EXPR_OP("str", 90, 1, expr_op_str), EXPR_OP("+", 80, 1, expr_op_pluss), EXPR_OP("-", 80, 1, expr_op_minus), EXPR_OP("~", 80, 1, expr_op_bitwise_not), EXPR_OP("*", 75, 2, expr_op_multiply), EXPR_OP("/", 75, 2, expr_op_divide), EXPR_OP("%", 75, 2, expr_op_modulus), EXPR_OP("+", 70, 2, expr_op_add), EXPR_OP("-", 70, 2, expr_op_sub), EXPR_OP("<<", 65, 2, expr_op_shift_left), EXPR_OP(">>", 65, 2, expr_op_shift_right), EXPR_OP("<=", 60, 2, expr_op_less_or_equal_than), EXPR_OP("<", 60, 2, expr_op_less_than), EXPR_OP(">=", 60, 2, expr_op_greater_or_equal_than), EXPR_OP(">", 60, 2, expr_op_greater_than), EXPR_OP("vle", 60, 2, expr_op_ver_less_or_equal_than), EXPR_OP("vlt", 60, 2, expr_op_ver_less_than), EXPR_OP("vge", 60, 2, expr_op_ver_greater_or_equal_than), EXPR_OP("vgt", 60, 2, expr_op_ver_greater_than), EXPR_OP("==", 55, 2, expr_op_equal), EXPR_OP("veq", 55, 2, expr_op_ver_equal), EXPR_OP("!=", 55, 2, expr_op_not_equal), EXPR_OP("vne", 55, 2, expr_op_ver_not_equal), EXPR_OP("!", 80, 1, expr_op_logical_not), EXPR_OP("^", 45, 2, expr_op_bitwise_xor), EXPR_OP("&&", 35, 2, expr_op_logical_and), EXPR_OP("&", 50, 2, expr_op_bitwise_and), EXPR_OP("||", 30, 2, expr_op_logical_or), EXPR_OP("|", 40, 2, expr_op_bitwise_or), { "(", 1, ')', 10, 1, expr_op_left_parenthesis }, { ")", 1, '(', 10, 0, expr_op_right_parenthesis }, /* { "?", 1, ':', 5, 2, expr_op_question }, { ":", 1, '?', 5, 2, expr_op_colon }, -- too weird for now. */ #undef EXPR_OP }; /** Dummy end of expression fake. */ static const EXPROP g_ExprEndOfExpOp = { "", 0, '\0', 0, 0, NULL }; /** * Initializes the opcode character map if necessary. */ static void expr_map_init(void) { unsigned i; if (g_fExprInitializedMap) return; /* * Initialize it. */ memset(&g_auchOpStartCharMap, 0, sizeof(g_auchOpStartCharMap)); for (i = 0; i < sizeof(g_aExprOps) / sizeof(g_aExprOps[0]); i++) { unsigned int ch = (unsigned int)g_aExprOps[i].szOp[0]; if (!g_auchOpStartCharMap[ch]) { g_auchOpStartCharMap[ch] = (i << 2) | 1; if (!isalpha(ch)) g_auchOpStartCharMap[ch] |= 2; /* Need no clear separation from operands. */ } } /* whitespace (assumes C-like locale because I'm lazy): */ #define SET_WHITESPACE(a_ch) do { \ assert(g_auchOpStartCharMap[(unsigned char)(a_ch)] == 0); \ g_auchOpStartCharMap[(unsigned char)(a_ch)] |= 2; \ } while (0) SET_WHITESPACE(' '); SET_WHITESPACE('\t'); SET_WHITESPACE('\n'); SET_WHITESPACE('\r'); SET_WHITESPACE('\v'); SET_WHITESPACE('\f'); g_fExprInitializedMap = 1; } /** * Looks up a character in the map. * * @returns the value for that char, see g_auchOpStartCharMap for details. * @param ch The character. */ static unsigned char expr_map_get(char ch) { return g_auchOpStartCharMap[(unsigned char)ch]; } /** * Searches the operator table given a potential operator start char. * * @returns Pointer to the matching operator. NULL if not found. * @param psz Pointer to what can be an operator. * @param uchVal The expr_map_get value. * @param fUnary Whether it must be an unary operator or not. */ static PCEXPROP expr_lookup_op(char const *psz, unsigned char uchVal, int fUnary) { char ch = *psz; unsigned i; assert((uchVal & 2) == (isalpha(ch) ? 0 : 2)); for (i = uchVal >> 2; i < sizeof(g_aExprOps) / sizeof(g_aExprOps[0]); i++) { /* compare the string... */ if (g_aExprOps[i].szOp[0] != ch) continue; switch (g_aExprOps[i].cchOp) { case 1: break; case 2: if (g_aExprOps[i].szOp[1] != psz[1]) continue; break; default: if (strncmp(&g_aExprOps[i].szOp[1], psz + 1, g_aExprOps[i].cchOp - 1)) continue; break; } /* ... and the operator type. */ if (fUnary == (g_aExprOps[i].cArgs == 1)) { /* Check if we've got the needed operand separation: */ if ( (uchVal & 2) || EXPR_IS_OP_SEPARATOR(psz[g_aExprOps[i].cchOp])) { /* got a match! */ return &g_aExprOps[i]; } } } return NULL; } /** * Ungets a binary operator. * * The operator is poped from the stack and put in the pending position. * * @param pThis The evaluator instance. */ static void expr_unget_op(PEXPR pThis) { assert(pThis->pPending == NULL); assert(pThis->iOp >= 0); pThis->pPending = pThis->apOps[pThis->iOp]; pThis->apOps[pThis->iOp] = NULL; pThis->iOp--; } /** * Get the next token, it should be a binary operator, or the end of * the expression, or a right parenthesis. * * The operator is pushed onto the stack and the status code indicates * which of the two we found. * * @returns status code. Will grumble on failure. * @retval kExprRet_EndOfExpr if we encountered the end of the expression. * @retval kExprRet_Operator if we encountered a binary operator or right * parenthesis. It's on the operator stack. * * @param pThis The evaluator instance. */ static EXPRRET expr_get_binary_or_eoe_or_rparen(PEXPR pThis) { /* * See if there is anything pending first. */ PCEXPROP pOp = pThis->pPending; if (pOp) pThis->pPending = NULL; else { /* * Eat more of the expression. */ char const *psz = pThis->psz; /* spaces */ unsigned char uchVal; char ch; while (((uchVal = expr_map_get((ch = *psz))) & 3) == 2) psz++; /* see what we've got. */ if (ch) { if (uchVal & 1) pOp = expr_lookup_op(psz, uchVal, 0 /* fUnary */); if (!pOp) { expr_error(pThis, "Expected binary operator, found \"%.42s\"...", psz); return kExprRet_Error; } psz += pOp->cchOp; } else pOp = &g_ExprEndOfExpOp; pThis->psz = psz; } /* * Push it. */ if (pThis->iOp >= EXPR_MAX_OPERATORS - 1) { expr_error(pThis, "Operator stack overflow"); return kExprRet_Error; } pThis->apOps[++pThis->iOp] = pOp; return pOp->iPrecedence ? kExprRet_Operator : kExprRet_EndOfExpr; } /** * Get the next token, it should be an unary operator or an operand. * * This will fail if encountering the end of the expression since * it is implied that there should be something more. * * The token is pushed onto the respective stack and the status code * indicates which it is. * * @returns status code. On failure we'll be done bitching already. * @retval kExprRet_Operator if we encountered an unary operator. * It's on the operator stack. * @retval kExprRet_Operand if we encountered an operand operator. * It's on the operand stack. * * @param This The evaluator instance. */ static EXPRRET expr_get_unary_or_operand(PEXPR pThis) { EXPRRET rc; unsigned char uchVal; PCEXPROP pOp; char const *psz = pThis->psz; char ch; /* * Eat white space and make sure there is something after it. */ while (((uchVal = expr_map_get((ch = *psz))) & 3) == 2) psz++; if (ch == '\0') { expr_error(pThis, "Unexpected end of expression"); return kExprRet_Error; } /* * Is it an operator? */ pOp = NULL; if (uchVal & 1) pOp = expr_lookup_op(psz, uchVal, 1 /* fUnary */); if (pOp) { /* * Push the operator onto the stack. */ if (pThis->iVar < EXPR_MAX_OPERANDS - 1) { pThis->apOps[++pThis->iOp] = pOp; rc = kExprRet_Operator; } else { expr_error(pThis, "Operator stack overflow"); rc = kExprRet_Error; } psz += pOp->cchOp; } else if (pThis->iVar < EXPR_MAX_OPERANDS - 1) { /* * It's an operand. Figure out where it ends and * push it onto the stack. */ const char *pszStart; rc = kExprRet_Ok; if (ch == '"') { pszStart = ++psz; while ((ch = *psz) != '\0' && ch != '"') psz++; expr_var_init_substring(&pThis->aVars[++pThis->iVar], pszStart, psz - pszStart, kExprVar_QuotedString); if (ch != '\0') psz++; } else if (ch == '\'') { pszStart = ++psz; while ((ch = *psz) != '\0' && ch != '\'') psz++; expr_var_init_substring(&pThis->aVars[++pThis->iVar], pszStart, psz - pszStart, kExprVar_QuotedSimpleString); if (ch != '\0') psz++; } else { char achPars[20]; int iPar = -1; char chEndPar = '\0'; pszStart = psz; while ((ch = *psz) != '\0') { char ch2; /* $(adsf) or ${asdf} needs special handling. */ if ( ch == '$' && ( (ch2 = psz[1]) == '(' || ch2 == '{')) { psz++; if (iPar > (int)(sizeof(achPars) / sizeof(achPars[0]))) { expr_error(pThis, "Too deep nesting of variable expansions"); rc = kExprRet_Error; break; } achPars[++iPar] = chEndPar = ch2 == '(' ? ')' : '}'; } else if (ch == chEndPar) { iPar--; chEndPar = iPar >= 0 ? achPars[iPar] : '\0'; } else if (!chEndPar) { uchVal = expr_map_get(ch); if (uchVal == 0) { /*likely*/ } else if ((uchVal & 3) == 2 /*isspace*/) break; else if ( (uchVal & 1) && psz != pszStart /* not at the start */ && ( (uchVal & 2) /* operator without separator needs */ || EXPR_IS_OP_SEPARATOR_NO_SPACE(psz[-1]))) { pOp = expr_lookup_op(psz, uchVal, 0 /* fUnary */); if (pOp) break; } } /* next */ psz++; } if (rc == kExprRet_Ok) expr_var_init_substring(&pThis->aVars[++pThis->iVar], pszStart, psz - pszStart, kExprVar_String); } } else { expr_error(pThis, "Operand stack overflow"); rc = kExprRet_Error; } pThis->psz = psz; return rc; } /** * Evaluates the current expression. * * @returns status code. * * @param pThis The instance. */ static EXPRRET expr_eval(PEXPR pThis) { EXPRRET rc; PCEXPROP pOp; /* * The main loop. */ for (;;) { /* * Eat unary operators until we hit an operand. */ do rc = expr_get_unary_or_operand(pThis); while (rc == kExprRet_Operator); if (rc < kExprRet_Ok) break; /* * Look for a binary operator, right parenthesis or end of expression. */ rc = expr_get_binary_or_eoe_or_rparen(pThis); if (rc < kExprRet_Ok) break; expr_unget_op(pThis); /* * Pop operators and apply them. * * Parenthesis will be handed via precedence, where the left parenthesis * will go pop the right one and make another operator pending. */ while ( pThis->iOp >= 0 && pThis->apOps[pThis->iOp]->iPrecedence >= pThis->pPending->iPrecedence) { pOp = pThis->apOps[pThis->iOp--]; assert(pThis->iVar + 1 >= pOp->cArgs); rc = pOp->pfn(pThis); if (rc < kExprRet_Ok) break; } if (rc < kExprRet_Ok) break; /* * Get the next binary operator or end of expression. * There should be no right parenthesis here. */ rc = expr_get_binary_or_eoe_or_rparen(pThis); if (rc < kExprRet_Ok) break; pOp = pThis->apOps[pThis->iOp]; if (!pOp->iPrecedence) break; /* end of expression */ if (!pOp->cArgs) { expr_error(pThis, "Unexpected \"%s\"", pOp->szOp); rc = kExprRet_Error; break; } } return rc; } /** * Destroys the given instance. * * @param pThis The instance to destroy. */ static void expr_destroy(PEXPR pThis) { while (pThis->iVar >= 0) { expr_var_delete(pThis->aVars); pThis->iVar--; } free(pThis); } /** * Instantiates an expression evaluator. * * @returns The instance. * * @param pszExpr What to parse. * This must stick around until expr_destroy. */ static PEXPR expr_create(char const *pszExpr) { PEXPR pThis = (PEXPR)xmalloc(sizeof(*pThis)); pThis->pszExpr = pszExpr; pThis->psz = pszExpr; pThis->pFileLoc = NULL; pThis->pPending = NULL; pThis->iVar = -1; pThis->iOp = -1; expr_map_init(); return pThis; } /** * Evaluates the given if expression. * * @returns -1, 0 or 1. (GNU make conditional check convention, see read.c.) * @retval -1 if the expression is invalid. * @retval 0 if the expression is true * @retval 1 if the expression is false. * * @param line The expression. * @param flocp The file location, used for errors. */ int expr_eval_if_conditionals(const char *line, const floc *flocp) { /* * Instantiate the expression evaluator and let * it have a go at it. */ int rc = -1; PEXPR pExpr = expr_create(line); pExpr->pFileLoc = flocp; if (expr_eval(pExpr) >= kExprRet_Ok) { /* * Convert the result (on top of the stack) to boolean and * set our return value accordingly. */ if (expr_var_make_bool(&pExpr->aVars[0])) rc = 0; else rc = 1; } expr_destroy(pExpr); return rc; } /** * Evaluates the given expression and returns the result as a string. * * @returns variable buffer position. * * @param o The current variable buffer position. * @param expr The expression. */ char *expr_eval_to_string(char *o, const char *expr) { /* * Instantiate the expression evaluator and let * it have a go at it. */ PEXPR pExpr = expr_create(expr); if (expr_eval(pExpr) >= kExprRet_Ok) { /* * Convert the result (on top of the stack) to a string * and copy it out the variable buffer. */ PEXPRVAR pVar = &pExpr->aVars[0]; expr_var_make_simple_string(pVar); o = variable_buffer_output(o, pVar->uVal.psz, strlen(pVar->uVal.psz)); } else o = variable_buffer_output(o, "", sizeof("") - 1); expr_destroy(pExpr); return o; } #endif /* CONFIG_WITH_IF_CONDITIONALS */ kbuild-3608/src/kmk/read.c0000664000175000017500000036267414670377412015373 0ustar locutuslocutus/* Reading and parsing of makefiles for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #include #include "filedef.h" #include "dep.h" #include "job.h" #include "commands.h" #include "variable.h" #include "rule.h" #include "debug.h" #include "hash.h" #ifdef KMK # include "kbuild.h" #endif #ifdef WINDOWS32 #include # ifndef _MSC_VER # ifndef CONFIG_NEW_WIN_CHILDREN # include "sub_proc.h" # else # include "w32/winchildren.h" # endif # endif #else /* !WINDOWS32 */ #ifndef _AMIGA #ifndef VMS #include #else struct passwd *getpwnam (char *name); #endif #endif #endif /* !WINDOWS32 */ /* A 'struct ebuffer' controls the origin of the makefile we are currently eval'ing. */ struct ebuffer { char *buffer; /* Start of the current line in the buffer. */ char *bufnext; /* Start of the next line in the buffer. */ char *bufstart; /* Start of the entire buffer. */ #ifdef CONFIG_WITH_VALUE_LENGTH char *eol; /* End of the current line in the buffer. */ #endif unsigned int size; /* Malloc'd size of buffer. */ FILE *fp; /* File, or NULL if this is an internal buffer. */ floc floc; /* Info on the file in fp (if any). */ }; /* Track the modifiers we can have on variable assignments */ struct vmodifiers { unsigned int assign_v:1; unsigned int define_v:1; unsigned int undefine_v:1; unsigned int export_v:1; unsigned int override_v:1; unsigned int private_v:1; }; /* Types of "words" that can be read in a makefile. */ enum make_word_type { w_bogus, w_eol, w_static, w_variable, w_colon, w_dcolon, w_semicolon, w_varassign }; /* A 'struct conditionals' contains the information describing all the active conditionals in a makefile. The global variable 'conditionals' contains the conditionals information for the current makefile. It is initialized from the static structure 'toplevel_conditionals' and is later changed to new structures for included makefiles. */ struct conditionals { unsigned int if_cmds; /* Depth of conditional nesting. */ unsigned int allocated; /* Elts allocated in following arrays. */ char *ignoring; /* Are we ignoring or interpreting? 0=interpreting, 1=not yet interpreted, 2=already interpreted */ char *seen_else; /* Have we already seen an 'else'? */ #ifdef KMK char ignoring_first[8]; char seen_else_first[8]; #endif }; #ifdef KMK static struct conditionals toplevel_conditionals = { 0, sizeof (toplevel_conditionals.ignoring_first), &toplevel_conditionals.ignoring_first[0], &toplevel_conditionals.seen_else_first[0], "", "" }; #else /* !KMK */ static struct conditionals toplevel_conditionals; #endif /* !KMK */ static struct conditionals *conditionals = &toplevel_conditionals; /* Default directories to search for include files in */ static const char *default_include_directories[] = { #ifndef KMK #if defined(WINDOWS32) && !defined(INCLUDEDIR) /* This completely up to the user when they install MSVC or other packages. This is defined as a placeholder. */ # define INCLUDEDIR "." #endif # ifdef INCLUDEDIR /* bird */ INCLUDEDIR, # else /* bird */ ".", /* bird */ # endif /* bird */ #ifndef _AMIGA "/usr/gnu/include", "/usr/local/include", "/usr/include", #endif #endif /* !KMK */ 0 }; /* List of directories to search for include files in */ static const char **include_directories; /* Maximum length of an element of the above. */ static unsigned int max_incl_len; /* The filename and pointer to line number of the makefile currently being read in. */ const floc *reading_file = 0; /* The chain of files read by read_all_makefiles. */ static struct goaldep *read_files = 0; static struct goaldep *eval_makefile (const char *filename, int flags); static void eval (struct ebuffer *buffer, int flags); static long readline (struct ebuffer *ebuf); static void do_undefine (char *name, enum variable_origin origin, struct ebuffer *ebuf); static struct variable *do_define (char *name IF_WITH_VALUE_LENGTH_PARAM(char *eos), enum variable_origin origin, struct ebuffer *ebuf); #ifndef CONFIG_WITH_VALUE_LENGTH static int conditional_line (char *line, int len, const floc *flocp); #else static int conditional_line (char *line, char *eol, int len, const floc *flocp); #endif static void record_files (struct nameseq *filenames, const char *pattern, const char *pattern_percent, char *depstr, unsigned int cmds_started, char *commands, unsigned int commands_idx, int two_colon, char prefix, const floc *flocp); static void record_target_var (struct nameseq *filenames, char *defn, enum variable_origin origin, struct vmodifiers *vmod, const floc *flocp); static enum make_word_type get_next_mword (char *buffer, char *delim, char **startp, unsigned int *length); #ifndef CONFIG_WITH_VALUE_LENGTH static void remove_comments (char *line); static char *find_char_unquote (char *string, int map); #else /* CONFIG_WITH_VALUE_LENGTH */ static char *remove_comments (char *line, char *eos); static char *find_char_unquote (char *string, int map, unsigned int string_len); K_INLINE char *find_char_unquote_0 (char *string, int stop1, int map, char **eosp); #endif /* CONFIG_WITH_VALUE_LENGTH */ static char *unescape_char (char *string, int c); /* Compare a word, both length and contents. P must point to the word to be tested, and WLEN must be the length. */ #define word1eq(s) (wlen == CSTRLEN (s) && strneq (s, p, CSTRLEN (s))) /* Read in all the makefiles and return a chain of targets to rebuild. */ struct goaldep * read_all_makefiles (const char **makefiles) { unsigned int num_makefiles = 0; /* Create *_LIST variables, to hold the makefiles, targets, and variables we will be reading. */ define_variable_cname ("MAKEFILE_LIST", "", o_file, 0); DB (DB_BASIC, (_("Reading makefiles...\n"))); /* If there's a non-null variable MAKEFILES, its value is a list of files to read first thing. But don't let it prevent reading the default makefiles and don't let the default goal come from there. */ { char *value; char *name, *p; unsigned int length; { /* Turn off --warn-undefined-variables while we expand MAKEFILES. */ int save = warn_undefined_variables_flag; warn_undefined_variables_flag = 0; #ifndef CONFIG_WITH_VALUE_LENGTH value = allocated_variable_expand ("$(MAKEFILES)"); #else value = allocated_variable_expand_2 (STRING_SIZE_TUPLE("$(MAKEFILES)"), NULL); #endif warn_undefined_variables_flag = save; } /* Set NAME to the start of next token and LENGTH to its length. MAKEFILES is updated for finding remaining tokens. */ p = value; while ((name = find_next_token ((const char **)&p, &length)) != 0) { if (*p != '\0') *p++ = '\0'; eval_makefile (name, RM_NO_DEFAULT_GOAL|RM_INCLUDED|RM_DONTCARE); } free (value); } /* Read makefiles specified with -f switches. */ if (makefiles != 0) while (*makefiles != 0) { struct goaldep *d = eval_makefile (*makefiles, 0); if (errno) perror_with_name ("", *makefiles); /* Reuse the storage allocated for the read_file. */ *makefiles = dep_name (d); ++num_makefiles; ++makefiles; } /* If there were no -f switches, try the default names. */ if (num_makefiles == 0) { static const char *default_makefiles[] = #ifdef VMS /* all lower case since readdir() (the vms version) 'lowercasifies' */ /* TODO: Above is not always true, this needs more work */ # ifdef KMK { "makefile.kmk", "makefile.vms", "gnumakefile.", "makefile.", 0 }; # else { "makefile.vms", "gnumakefile", "makefile", 0 }; # endif #else #ifdef _AMIGA # ifdef KMK { "Makefile.kmk", "makefile.kmk", "GNUmakefile", "Makefile", "SMakefile", 0 }; # else { "GNUmakefile", "Makefile", "SMakefile", 0 }; # endif #else /* !Amiga && !VMS */ #ifdef WINDOWS32 # ifdef KMK { "Makefile.kmk", "makefile.kmk", "GNUmakefile", "makefile", "Makefile", "makefile.mak", 0 }; # else { "GNUmakefile", "makefile", "Makefile", "makefile.mak", 0 }; # endif #else /* !Amiga && !VMS && !WINDOWS32 */ # ifdef KMK { "Makefile.kmk", "makefile.kmk", "GNUmakefile", "makefile", "Makefile", 0 }; # else { "GNUmakefile", "makefile", "Makefile", 0 }; # endif #endif /* !Amiga && !VMS && !WINDOWS32 */ #endif /* AMIGA */ #endif /* VMS */ const char **p = default_makefiles; while (*p != 0 && !file_exists_p (*p)) ++p; if (*p != 0) { eval_makefile (*p, 0); if (errno) perror_with_name ("", *p); } else { /* No default makefile was found. Add the default makefiles to the 'read_files' chain so they will be updated if possible. */ struct goaldep *tail = read_files; /* Add them to the tail, after any MAKEFILES variable makefiles. */ while (tail != 0 && tail->next != 0) tail = tail->next; for (p = default_makefiles; *p != 0; ++p) { struct goaldep *d = alloc_goaldep (); d->file = enter_file (strcache_add (*p)); /* Tell update_goal_chain to bail out as soon as this file is made, and main not to die if we can't make this file. */ d->flags = RM_DONTCARE; if (tail == 0) read_files = d; else tail->next = d; tail = d; } if (tail != 0) tail->next = 0; } } return read_files; } /* Install a new conditional and return the previous one. */ static struct conditionals * install_conditionals (struct conditionals *new) { struct conditionals *save = conditionals; #ifndef KMK memset (new, '\0', sizeof (*new)); #else /* KMK */ new->if_cmds = 0; new->allocated = sizeof (new->ignoring_first); new->ignoring = new->ignoring_first; new->seen_else = new->seen_else_first; #endif /* KMK */ conditionals = new; return save; } /* Free the current conditionals and reinstate a saved one. */ static void restore_conditionals (struct conditionals *saved) { /* Free any space allocated by conditional_line. */ #ifdef KMK if (conditionals->allocated > sizeof (conditionals->ignoring_first)) { #endif free (conditionals->ignoring); free (conditionals->seen_else); #ifdef KMK } #endif /* Restore state. */ conditionals = saved; } static struct goaldep * eval_makefile (const char *filename, int flags) { struct goaldep *deps; struct ebuffer ebuf; const floc *curfile; char *expanded = 0; int makefile_errno; ebuf.floc.filenm = filename; /* Use the original file name. */ ebuf.floc.lineno = 1; ebuf.floc.offset = 0; if (ISDB (DB_VERBOSE)) { printf (_("Reading makefile '%s'"), filename); if (flags & RM_NO_DEFAULT_GOAL) printf (_(" (no default goal)")); if (flags & RM_INCLUDED) printf (_(" (search path)")); if (flags & RM_DONTCARE) printf (_(" (don't care)")); if (flags & RM_NO_TILDE) printf (_(" (no ~ expansion)")); puts ("..."); } /* First, get a stream to read. */ /* Expand ~ in FILENAME unless it came from 'include', in which case it was already done. */ if (!(flags & RM_NO_TILDE) && filename[0] == '~') { expanded = tilde_expand (filename); if (expanded != 0) filename = expanded; } #ifdef _MSC_VER ENULLLOOP (ebuf.fp, fopen (filename, "rN")); /* N == noinherit */ #else ENULLLOOP (ebuf.fp, fopen (filename, "r")); #endif /* Save the error code so we print the right message later. */ makefile_errno = errno; /* Check for unrecoverable errors: out of mem or FILE slots. */ switch (makefile_errno) { #ifdef EMFILE case EMFILE: #endif #ifdef ENFILE case ENFILE: #endif case ENOMEM: { const char *err = strerror (makefile_errno); OS (fatal, reading_file, "%s", err); } } /* If the makefile wasn't found and it's either a makefile from the 'MAKEFILES' variable or an included makefile, search the included makefile search path for this makefile. */ if (ebuf.fp == 0 && (flags & RM_INCLUDED) && *filename != '/') { unsigned int i; for (i = 0; include_directories[i] != 0; ++i) { const char *included = concat (3, include_directories[i], "/", filename); #ifdef _MSC_VER ebuf.fp = fopen (included, "rN"); /* N == noinherit */ #else ebuf.fp = fopen (included, "r"); #endif if (ebuf.fp) { filename = included; break; } } } /* Now we have the final name for this makefile. Enter it into the cache. */ filename = strcache_add (filename); /* Add FILENAME to the chain of read makefiles. */ deps = alloc_goaldep (); deps->next = read_files; read_files = deps; #ifndef CONFIG_WITH_STRCACHE2 deps->file = lookup_file (filename); #else deps->file = lookup_file_cached (filename); #endif if (deps->file == 0) deps->file = enter_file (filename); filename = deps->file->name; deps->flags = flags; free (expanded); /* If the makefile can't be found at all, give up entirely. */ if (ebuf.fp == 0) { /* If we did some searching, errno has the error from the last attempt, rather from FILENAME itself. Store it in case the caller wants to use it in a message. */ errno = makefile_errno; return deps; } /* Set close-on-exec to avoid leaking the makefile to children, such as $(shell ...). */ #ifndef _MSC_VER /* not necessary, see fopen calls above. */ #ifdef HAVE_FILENO CLOSE_ON_EXEC (fileno (ebuf.fp)); #endif #endif /* Add this makefile to the list. */ do_variable_definition (&ebuf.floc, "MAKEFILE_LIST", filename, o_file, f_append, 0); #ifdef CONFIG_WITH_COMPILER /* Execute compiled version if repeatedly evaluating this file. ASSUMES file content is unmodified since compilation. */ deps->file->eval_count++; if ( deps->file->evalprog # ifdef CONFIG_WITH_COMPILE_EVERYTHING || ( deps->file->eval_count == 1 # else || ( deps->file->eval_count == 3 # endif && (deps->file->evalprog = kmk_cc_compile_file_for_eval (ebuf.fp, filename)) != NULL) ) { curfile = reading_file; reading_file = &ebuf.floc; kmk_exec_eval_file (deps->file->evalprog); reading_file = curfile; fclose (ebuf.fp); alloca (0); return 1; } #elif defined (CONFIG_WITH_MAKE_STATS) deps->file->eval_count++; #endif #ifdef KMK /* Buffer the entire file or at least 256KB (footer.kmk) of it. */ { void *stream_buf = NULL; struct stat st; # ifdef KBUILD_OS_WINDOWS if (!birdStatOnFdJustSize(fileno(ebuf.fp), &st.st_size)) # else if (!fstat (fileno (ebuf.fp), &st)) # endif { int stream_buf_size = 256*1024; if (st.st_size < stream_buf_size) { if (st.st_size) stream_buf_size = (st.st_size + 0xfff) & ~0xfff; else stream_buf_size = 0x1000; } stream_buf = xmalloc (stream_buf_size); setvbuf (ebuf.fp, stream_buf, _IOFBF, stream_buf_size); } #endif /* Evaluate the makefile */ ebuf.size = 200; ebuf.buffer = ebuf.bufnext = ebuf.bufstart = xmalloc (ebuf.size); #ifdef CONFIG_WITH_VALUE_LENGTH ebuf.eol = NULL; #endif curfile = reading_file; reading_file = &ebuf.floc; eval (&ebuf, !(flags & RM_NO_DEFAULT_GOAL)); reading_file = curfile; fclose (ebuf.fp); #ifdef KMK if (stream_buf) free (stream_buf); } #endif free (ebuf.bufstart); alloca (0); errno = 0; return deps; } void eval_buffer (char *buffer, const floc *flocp IF_WITH_VALUE_LENGTH_PARAM(char *eos)) { struct ebuffer ebuf; struct conditionals *saved; struct conditionals new; const floc *curfile; /* Evaluate the buffer */ #ifndef CONFIG_WITH_VALUE_LENGTH ebuf.size = strlen (buffer); #else ebuf.size = eos - buffer; ebuf.eol = eos; assert(strchr(buffer, '\0') == eos); #endif ebuf.buffer = ebuf.bufnext = ebuf.bufstart = buffer; ebuf.fp = NULL; if (flocp) ebuf.floc = *flocp; else if (reading_file) ebuf.floc = *reading_file; else { ebuf.floc.filenm = NULL; ebuf.floc.lineno = 1; ebuf.floc.offset = 0; } curfile = reading_file; reading_file = &ebuf.floc; saved = install_conditionals (&new); eval (&ebuf, 1); restore_conditionals (saved); reading_file = curfile; alloca (0); } /* Check LINE to see if it's a variable assignment or undefine. It might use one of the modifiers "export", "override", "private", or it might be one of the conditional tokens like "ifdef", "include", etc. If it's not a variable assignment or undefine, VMOD.V_ASSIGN is 0. Returns LINE. Returns a pointer to the first non-modifier character, and sets VMOD based on the modifiers found if any, plus V_ASSIGN is 1. */ static char * parse_var_assignment (const char *line, struct vmodifiers *vmod) { const char *p; memset (vmod, '\0', sizeof (*vmod)); /* Find the start of the next token. If there isn't one we're done. */ NEXT_TOKEN (line); if (*line == '\0') return (char *)line; p = line; while (1) { int wlen; const char *p2; struct variable v; p2 = parse_variable_definition (p, &v); /* If this is a variable assignment, we're done. */ if (p2) break; /* It's not a variable; see if it's a modifier. */ p2 = end_of_token (p); wlen = p2 - p; if (word1eq ("export")) vmod->export_v = 1; else if (word1eq ("override")) vmod->override_v = 1; else if (word1eq ("private")) vmod->private_v = 1; else if (word1eq ("define")) { /* We can't have modifiers after 'define' */ vmod->define_v = 1; p = next_token (p2); break; } else if (word1eq ("undefine")) { /* We can't have modifiers after 'undefine' */ vmod->undefine_v = 1; p = next_token (p2); break; } else /* Not a variable or modifier: this is not a variable assignment. */ return (char *)line; /* It was a modifier. Try the next word. */ p = next_token (p2); if (*p == '\0') return (char *)line; } /* Found a variable assignment or undefine. */ vmod->assign_v = 1; return (char *)p; } /* Read file FILENAME as a makefile and add its contents to the data base. SET_DEFAULT is true if we are allowed to set the default goal. */ static void eval (struct ebuffer *ebuf, int set_default) { char *collapsed = 0; unsigned int collapsed_length = 0; unsigned int commands_len = 200; char *commands; unsigned int commands_idx = 0; unsigned int cmds_started, tgts_started; int ignoring = 0, in_ignored_define = 0; int no_targets = 0; /* Set when reading a rule without targets. */ struct nameseq *filenames = 0; char *depstr = 0; long nlines = 0; int two_colon = 0; char prefix = cmd_prefix; const char *pattern = 0; const char *pattern_percent; floc *fstart; floc fi; #ifdef CONFIG_WITH_VALUE_LENGTH unsigned int tmp_len; #endif #ifdef KMK struct kbuild_eval_data *kdata = 0; int krc; #endif #define record_waiting_files() \ do \ { \ if (filenames != 0) \ { \ fi.lineno = tgts_started; \ fi.offset = 0; \ record_files (filenames, pattern, pattern_percent, depstr, \ cmds_started, commands, commands_idx, two_colon, \ prefix, &fi); \ filenames = 0; \ } \ commands_idx = 0; \ no_targets = 0; \ pattern = 0; \ } while (0) pattern_percent = 0; cmds_started = tgts_started = 1; fstart = &ebuf->floc; fi.filenm = ebuf->floc.filenm; /* Loop over lines in the file. The strategy is to accumulate target names in FILENAMES, dependencies in DEPS and commands in COMMANDS. These are used to define a rule when the start of the next rule (or eof) is encountered. When you see a "continue" in the loop below, that means we are moving on to the next line. If you see record_waiting_files(), then the statement we are parsing also finishes the previous rule. */ commands = xmalloc (200); while (1) { unsigned int linelen; #ifdef CONFIG_WITH_VALUE_LENGTH char *eol; #endif char *line; unsigned int wlen; char *p; char *p2; struct vmodifiers vmod; /* At the top of this loop, we are starting a brand new line. */ /* Grab the next line to be evaluated */ ebuf->floc.lineno += nlines; nlines = readline (ebuf); /* If there is nothing left to eval, we're done. */ if (nlines < 0) break; line = ebuf->buffer; /* If this is the first line, check for a UTF-8 BOM and skip it. */ if (ebuf->floc.lineno == 1 && line[0] == (char)0xEF && line[1] == (char)0xBB && line[2] == (char)0xBF) { line += 3; if (ISDB(DB_BASIC)) { if (ebuf->floc.filenm) printf (_("Skipping UTF-8 BOM in makefile '%s'\n"), ebuf->floc.filenm); else printf (_("Skipping UTF-8 BOM in makefile buffer\n")); } } /* If this line is empty, skip it. */ if (line[0] == '\0') continue; #ifndef CONFIG_WITH_VALUE_LENGTH linelen = strlen (line); #else linelen = ebuf->eol - line; assert (strlen (line) == linelen); #endif /* Check for a shell command line first. If it is not one, we can stop treating cmd_prefix specially. */ if (line[0] == cmd_prefix) { if (no_targets) /* Ignore the commands in a rule with no targets. */ continue; /* If there is no preceding rule line, don't treat this line as a command, even though it begins with a recipe prefix. SunOS 4 make appears to behave this way. */ if (filenames != 0) { if (ignoring) /* Yep, this is a shell command, and we don't care. */ continue; if (commands_idx == 0) cmds_started = ebuf->floc.lineno; /* Append this command line to the line being accumulated. Skip the initial command prefix character. */ if (linelen + commands_idx > commands_len) { commands_len = (linelen + commands_idx) * 2; commands = xrealloc (commands, commands_len); } memcpy (&commands[commands_idx], line + 1, linelen - 1); commands_idx += linelen - 1; commands[commands_idx++] = '\n'; continue; } } /* This line is not a shell command line. Don't worry about whitespace. Get more space if we need it; we don't need to preserve the current contents of the buffer. */ if (collapsed_length < linelen+1) { collapsed_length = linelen+1; free (collapsed); /* Don't need xrealloc: we don't need to preserve the content. */ collapsed = xmalloc (collapsed_length); } #ifndef CONFIG_WITH_VALUE_LENGTH strcpy (collapsed, line); /* Collapse continuation lines. */ collapse_continuations (collapsed); remove_comments (collapsed); #else memcpy (collapsed, line, linelen + 1); /* Collapse continuation lines. */ eol = collapse_continuations (collapsed, linelen); assert (strchr (collapsed, '\0') == eol); eol = remove_comments (collapsed, eol); assert (strchr (collapsed, '\0') == eol); #endif /* Get rid if starting space (including formfeed, vtab, etc.) */ p = collapsed; NEXT_TOKEN (p); /* See if this is a variable assignment. We need to do this early, to allow variables with names like 'ifdef', 'export', 'private', etc. */ p = parse_var_assignment (p, &vmod); if (vmod.assign_v) { struct variable *v; enum variable_origin origin = vmod.override_v ? o_override : o_file; /* If we're ignoring then we're done now. */ if (ignoring) { if (vmod.define_v) in_ignored_define = 1; continue; } /* Variable assignment ends the previous rule. */ record_waiting_files (); if (vmod.undefine_v) { do_undefine (p, origin, ebuf); continue; } else if (vmod.define_v) v = do_define (p IF_WITH_VALUE_LENGTH_PARAM(NULL), origin, ebuf); else v = try_variable_definition (fstart, p IF_WITH_VALUE_LENGTH_PARAM(NULL), origin, 0); assert (v != NULL); if (vmod.export_v) v->export = v_export; if (vmod.private_v) v->private_var = 1; /* This line has been dealt with. */ continue; } /* If this line is completely empty, ignore it. */ if (*p == '\0') continue; p2 = end_of_token (p); wlen = p2 - p; NEXT_TOKEN (p2); /* If we're in an ignored define, skip this line (but maybe get out). */ if (in_ignored_define) { /* See if this is an endef line (plus optional comment). */ if (word1eq ("endef") && STOP_SET (*p2, MAP_COMMENT|MAP_NUL)) in_ignored_define = 0; continue; } /* Check for conditional state changes. */ { #ifndef CONFIG_WITH_VALUE_LENGTH int i = conditional_line (p, wlen, fstart); #else int i = conditional_line (p, eol, wlen, fstart); #endif if (i != -2) { if (i == -1) O (fatal, fstart, _("invalid syntax in conditional")); ignoring = i; continue; } } /* Nothing to see here... move along. */ if (ignoring) continue; #ifdef CONFIG_WITH_LOCAL_VARIABLES if (word1eq ("local")) { if (*p2 == '\0') O (error, fstart, _("empty `local' directive")); if (strneq (p2, "define", 6) && (ISBLANK (p2[6]) || p2[6] == '\0')) { if (ignoring) in_ignored_define = 1; else { p2 = next_token (p2 + 6); if (*p2 == '\0') O (fatal, fstart, _("empty variable name")); /* Let the variable name be the whole rest of the line, with trailing blanks stripped (comments have already been removed), so it could be a complex variable/function reference that might contain blanks. */ p = strchr (p2, '\0'); while (ISBLANK (p[-1])) --p; do_define (p2 IF_WITH_VALUE_LENGTH_PARAM(p), o_local, ebuf); } } else if (!ignoring && !try_variable_definition (fstart, p2 IF_WITH_VALUE_LENGTH_PARAM(eol), o_local, 0)) O (error, fstart, _("invalid `local' directive")); continue; } #endif /* CONFIG_WITH_LOCAL_VARIABLES */ #ifdef KMK /* Check for the kBuild language extensions. */ if ( wlen > sizeof("kBuild-") && strneq (p, "kBuild-", sizeof("kBuild-") - 1)) { krc = eval_kbuild_read_hook (&kdata, fstart, p, wlen, p2, eol, ignoring); if (krc != 42) { if (krc != 0) ON (error, fstart, _("krc=%d"), krc); continue; } } #endif /* KMK */ /* Manage the "export" keyword used outside of variable assignment as well as "unexport". */ if (word1eq ("export") || word1eq ("unexport")) { int exporting = *p == 'u' ? 0 : 1; /* Export/unexport ends the previous rule. */ record_waiting_files (); /* (un)export by itself causes everything to be (un)exported. */ if (*p2 == '\0') export_all_variables = exporting; else { unsigned int l; const char *cp; char *ap; /* Expand the line so we can use indirect and constructed variable names in an (un)export command. */ #ifndef CONFIG_WITH_VALUE_LENGTH cp = ap = allocated_variable_expand (p2); #else unsigned int buf_len; cp = ap = allocated_variable_expand_3 (p2, eol - p2, NULL, &buf_len); #endif for (p = find_next_token (&cp, &l); p != 0; p = find_next_token (&cp, &l)) { struct variable *v = lookup_variable (p, l); if (v == 0) v = define_variable_global (p, l, "", o_file, 0, fstart); v->export = exporting ? v_export : v_noexport; } #ifndef CONFIG_WITH_VALUE_LENGTH free (ap); #else recycle_variable_buffer (ap, buf_len); #endif } continue; } /* Handle the special syntax for vpath. */ if (word1eq ("vpath")) { const char *cp; char *vpat; unsigned int l; /* vpath ends the previous rule. */ record_waiting_files (); cp = variable_expand (p2); p = find_next_token (&cp, &l); if (p != 0) { vpat = xstrndup (p, l); p = find_next_token (&cp, &l); /* No searchpath means remove all previous selective VPATH's with the same pattern. */ } else /* No pattern means remove all previous selective VPATH's. */ vpat = 0; construct_vpath_list (vpat, p); free (vpat); continue; } #ifdef CONFIG_WITH_INCLUDEDEP assert (strchr (p2, '\0') == eol); if (word1eq ("includedep") || word1eq ("includedep-queue") || word1eq ("includedep-flush")) { /* We have found an `includedep' line specifying one or more dep files to be read at this point. This include variation does no globbing and do not support multiple names. It's trying to save time by being dead simple as well as ignoring errors. */ enum incdep_op op = p[wlen - 1] == 'p' ? incdep_read_it : p[wlen - 1] == 'e' ? incdep_queue : incdep_flush; char *free_me = NULL; unsigned int buf_len; char *name = p2; if (memchr (name, '$', eol - name)) { unsigned int name_len; free_me = name = allocated_variable_expand_3 (name, eol - name, &name_len, &buf_len); eol = name + name_len; while (ISSPACE (*name)) ++name; } while (eol > name && ISSPACE (eol[-1])) --eol; *eol = '\0'; eval_include_dep (name, fstart, op); if (free_me) recycle_variable_buffer (free_me, buf_len); continue; } #endif /* CONFIG_WITH_INCLUDEDEP */ /* Handle include and variants. */ if (word1eq ("include") || word1eq ("-include") || word1eq ("sinclude")) { /* We have found an 'include' line specifying a nested makefile to be read at this point. */ struct conditionals *save; struct conditionals new_conditionals; struct nameseq *files; /* "-include" (vs "include") says no error if the file does not exist. "sinclude" is an alias for this from SGI. */ int noerror = (p[0] != 'i'); #ifdef CONFIG_WITH_VALUE_LENGTH unsigned int buf_len; #endif /* Include ends the previous rule. */ record_waiting_files (); #ifndef CONFIG_WITH_VALUE_LENGTH p = allocated_variable_expand (p2); #else p = allocated_variable_expand_3 (p2, eol - p2, NULL, &buf_len); #endif /* If no filenames, it's a no-op. */ if (*p == '\0') { #ifndef CONFIG_WITH_VALUE_LENGTH free (p); #else recycle_variable_buffer (p, buf_len); #endif continue; } /* Parse the list of file names. Don't expand archive references! */ p2 = p; files = PARSE_FILE_SEQ (&p2, struct nameseq, MAP_NUL, NULL, PARSEFS_NOAR); #ifndef CONFIG_WITH_VALUE_LENGTH free (p); #else recycle_variable_buffer (p, buf_len); #endif /* Save the state of conditionals and start the included makefile with a clean slate. */ save = install_conditionals (&new_conditionals); /* Record the rules that are waiting so they will determine the default goal before those in the included makefile. */ record_waiting_files (); /* Read each included makefile. */ while (files != 0) { struct nameseq *next = files->next; int flags = (RM_INCLUDED | RM_NO_TILDE | (noerror ? RM_DONTCARE : 0) | (set_default ? 0 : RM_NO_DEFAULT_GOAL)); struct goaldep *d = eval_makefile (files->name, flags); if (errno) { d->error = (unsigned short)errno; d->floc = *fstart; } free_ns (files); files = next; } /* Restore conditional state. */ restore_conditionals (save); continue; } /* Handle the load operations. */ if (word1eq ("load") || word1eq ("-load")) { /* A 'load' line specifies a dynamic object to load. */ struct nameseq *files; int noerror = (p[0] == '-'); /* Load ends the previous rule. */ record_waiting_files (); p = allocated_variable_expand (p2); /* If no filenames, it's a no-op. */ if (*p == '\0') { free (p); continue; } /* Parse the list of file names. Don't expand archive references or strip "./" */ p2 = p; files = PARSE_FILE_SEQ (&p2, struct nameseq, MAP_NUL, NULL, PARSEFS_NOAR); free (p); /* Load each file. */ while (files != 0) { struct nameseq *next = files->next; const char *name = files->name; struct goaldep *deps; int r; /* Load the file. 0 means failure. */ r = load_file (&ebuf->floc, &name, noerror); if (! r && ! noerror) OS (fatal, &ebuf->floc, _("%s: failed to load"), name); free_ns (files); files = next; /* Return of -1 means a special load: don't rebuild it. */ if (r == -1) continue; /* It succeeded, so add it to the list "to be rebuilt". */ deps = alloc_goaldep (); deps->next = read_files; read_files = deps; deps->file = lookup_file (name); if (deps->file == 0) deps->file = enter_file (name); deps->file->loaded = 1; } continue; } /* This line starts with a tab but was not caught above because there was no preceding target, and the line might have been usable as a variable definition. But now we know it is definitely lossage. */ if (line[0] == cmd_prefix) O (fatal, fstart, _("recipe commences before first target")); /* This line describes some target files. This is complicated by the existence of target-specific variables, because we can't expand the entire line until we know if we have one or not. So we expand the line word by word until we find the first ':', then check to see if it's a target-specific variable. In this algorithm, 'lb_next' will point to the beginning of the unexpanded parts of the input buffer, while 'p2' points to the parts of the expanded buffer we haven't searched yet. */ { enum make_word_type wtype; char *cmdleft, *semip, *lb_next; unsigned int plen = 0; char *colonp; const char *end, *beg; /* Helpers for whitespace stripping. */ /* Record the previous rule. */ record_waiting_files (); tgts_started = fstart->lineno; /* Search the line for an unquoted ; that is not after an unquoted #. */ cmdleft = find_char_unquote (line, MAP_SEMI|MAP_COMMENT|MAP_VARIABLE IF_WITH_VALUE_LENGTH_PARAM(ebuf->eol - line)); if (cmdleft != 0 && *cmdleft == '#') { /* We found a comment before a semicolon. */ *cmdleft = '\0'; cmdleft = 0; } else if (cmdleft != 0) /* Found one. Cut the line short there before expanding it. */ *(cmdleft++) = '\0'; semip = cmdleft; #ifndef CONFIG_WITH_VALUE_LENGTH collapse_continuations (line); #else collapse_continuations (line, strlen (line)); /**@todo fix this */ #endif /* We can't expand the entire line, since if it's a per-target variable we don't want to expand it. So, walk from the beginning, expanding as we go, and looking for "interesting" chars. The first word is always expandable. */ wtype = get_next_mword (line, NULL, &lb_next, &wlen); switch (wtype) { case w_eol: if (cmdleft != 0) O (fatal, fstart, _("missing rule before recipe")); /* This line contained something but turned out to be nothing but whitespace (a comment?). */ continue; case w_colon: case w_dcolon: /* We accept and ignore rules without targets for compatibility with SunOS 4 make. */ no_targets = 1; continue; default: break; } #ifndef CONFIG_WITH_VALUE_LENGTH p2 = variable_expand_string (NULL, lb_next, wlen); #else p2 = variable_expand_string_2 (NULL, lb_next, wlen, &eol); assert (strchr (p2, '\0') == eol); #endif while (1) { lb_next += wlen; if (cmdleft == 0) { /* Look for a semicolon in the expanded line. */ #ifndef CONFIG_WITH_VALUE_LENGTH cmdleft = find_char_unquote (p2, MAP_SEMI); #else cmdleft = find_char_unquote_0 (p2, ';', MAP_SEMI, &eol); #endif if (cmdleft != 0) { unsigned long p2_off = p2 - variable_buffer; unsigned long cmd_off = cmdleft - variable_buffer; #ifndef CONFIG_WITH_VALUE_LENGTH char *pend = p2 + strlen (p2); #endif /* Append any remnants of lb, then cut the line short at the semicolon. */ *cmdleft = '\0'; /* One school of thought says that you shouldn't expand here, but merely copy, since now you're beyond a ";" and into a command script. However, the old parser expanded the whole line, so we continue that for backwards-compatibility. Also, it wouldn't be entirely consistent, since we do an unconditional expand below once we know we don't have a target-specific variable. */ #ifndef CONFIG_WITH_VALUE_LENGTH (void)variable_expand_string (pend, lb_next, (long)-1); lb_next += strlen (lb_next); #else tmp_len = strlen (lb_next); variable_expand_string_2 (eol, lb_next, tmp_len, &eol); lb_next += tmp_len; #endif p2 = variable_buffer + p2_off; cmdleft = variable_buffer + cmd_off + 1; } } #ifndef CONFIG_WITH_VALUE_LENGTH colonp = find_char_unquote (p2, MAP_COLON); #else colonp = find_char_unquote_0 (p2, ':', MAP_COLON, &eol); #endif #ifdef HAVE_DOS_PATHS /* The drive spec brain-damage strikes again... */ /* Note that the only separators of targets in this context are whitespace and a left paren. If others are possible, they should be added to the string in the call to index. */ while (colonp && (colonp[1] == '/' || colonp[1] == '\\') && colonp > p2 && isalpha ((unsigned char)colonp[-1]) && (colonp == p2 + 1 || strchr (" \t(", colonp[-2]) != 0)) # ifndef CONFIG_WITH_VALUE_LENGTH colonp = find_char_unquote (colonp + 1, MAP_COLON); # else colonp = find_char_unquote_0 (colonp + 1, ':', MAP_COLON, &eol); # endif #endif if (colonp != 0) break; wtype = get_next_mword (lb_next, NULL, &lb_next, &wlen); if (wtype == w_eol) break; #ifndef CONFIG_WITH_VALUE_LENGTH p2 += strlen (p2); *(p2++) = ' '; p2 = variable_expand_string (p2, lb_next, wlen); #else *(eol++) = ' '; p2 = variable_expand_string_2 (eol, lb_next, wlen, &eol); #endif /* We don't need to worry about cmdleft here, because if it was found in the variable_buffer the entire buffer has already been expanded... we'll never get here. */ } p2 = next_token (variable_buffer); /* If the word we're looking at is EOL, see if there's _anything_ on the line. If not, a variable expanded to nothing, so ignore it. If so, we can't parse this line so punt. */ if (wtype == w_eol) { if (*p2 == '\0') continue; /* There's no need to be ivory-tower about this: check for one of the most common bugs found in makefiles... */ if (cmd_prefix == '\t' && strneq (line, " ", 8)) O (fatal, fstart, _("missing separator (did you mean TAB instead of 8 spaces?)")); else O (fatal, fstart, _("missing separator")); } /* Make the colon the end-of-string so we know where to stop looking for targets. Start there again once we're done. */ *colonp = '\0'; filenames = PARSE_SIMPLE_SEQ (&p2, struct nameseq); *colonp = ':'; p2 = colonp; if (!filenames) { /* We accept and ignore rules without targets for compatibility with SunOS 4 make. */ no_targets = 1; continue; } /* This should never be possible; we handled it above. */ assert (*p2 != '\0'); ++p2; /* Is this a one-colon or two-colon entry? */ two_colon = *p2 == ':'; if (two_colon) p2++; /* Test to see if it's a target-specific variable. Copy the rest of the buffer over, possibly temporarily (we'll expand it later if it's not a target-specific variable). PLEN saves the length of the unparsed section of p2, for later. */ if (*lb_next != '\0') { unsigned int l = p2 - variable_buffer; plen = strlen (p2); variable_buffer_output (p2+plen, lb_next, strlen (lb_next)+1); p2 = variable_buffer + l; } p2 = parse_var_assignment (p2, &vmod); if (vmod.assign_v) { /* If there was a semicolon found, add it back, plus anything after it. */ if (semip) { unsigned int l = p2 - variable_buffer; *(--semip) = ';'; #ifndef CONFIG_WITH_VALUE_LENGTH collapse_continuations (semip); #else collapse_continuations (semip, strlen(semip)); /** @todo fix this */ #endif variable_buffer_output (p2 + strlen (p2), semip, strlen (semip)+1); p2 = variable_buffer + l; } record_target_var (filenames, p2, vmod.override_v ? o_override : o_file, &vmod, fstart); filenames = 0; continue; } /* This is a normal target, _not_ a target-specific variable. Unquote any = in the dependency list. */ #ifndef CONFIG_WITH_VALUE_LENGTH find_char_unquote (lb_next, MAP_EQUALS); #else { char *tmp_eos = strchr(lb_next, '\0'); /** @todo see if we can optimize this away... */ find_char_unquote_0 (lb_next, '=', MAP_EQUALS, &tmp_eos); } #endif /* Remember the command prefix for this target. */ prefix = cmd_prefix; /* We have some targets, so don't ignore the following commands. */ no_targets = 0; /* Expand the dependencies, etc. */ if (*lb_next != '\0') { unsigned int l = p2 - variable_buffer; #ifndef CONFIG_WITH_VALUE_LENGTH (void) variable_expand_string (p2 + plen, lb_next, (long)-1); #else char *eos; (void) variable_expand_string_2 (p2 + plen, lb_next, (long)-1, &eos); #endif p2 = variable_buffer + l; /* Look for a semicolon in the expanded line. */ if (cmdleft == 0) { #ifndef CONFIG_WITH_VALUE_LENGTH cmdleft = find_char_unquote (p2, MAP_SEMI); #else cmdleft = find_char_unquote_0 (p2, ';', MAP_SEMI, &eos); #endif if (cmdleft != 0) *(cmdleft++) = '\0'; } } /* Is this a static pattern rule: 'target: %targ: %dep; ...'? */ p = strchr (p2, ':'); while (p != 0 && p[-1] == '\\') { char *q = &p[-1]; int backslash = 0; while (*q-- == '\\') backslash = !backslash; if (backslash) p = strchr (p + 1, ':'); else break; } #ifdef _AMIGA /* Here, the situation is quite complicated. Let's have a look at a couple of targets: install: dev:make dev:make: make dev:make:: xyz The rule is that it's only a target, if there are TWO :'s OR a space around the :. */ if (p && !(ISSPACE (p[1]) || !p[1] || ISSPACE (p[-1]))) p = 0; #endif #ifdef HAVE_DOS_PATHS { int check_again; do { check_again = 0; /* For DOS-style paths, skip a "C:\..." or a "C:/..." */ if (p != 0 && (p[1] == '\\' || p[1] == '/') && isalpha ((unsigned char)p[-1]) && (p == p2 + 1 || strchr (" \t:(", p[-2]) != 0)) { p = strchr (p + 1, ':'); check_again = 1; } } while (check_again); } #endif if (p != 0) { struct nameseq *target; target = PARSE_FILE_SEQ (&p2, struct nameseq, MAP_COLON, NULL, PARSEFS_NOGLOB); ++p2; if (target == 0) O (fatal, fstart, _("missing target pattern")); else if (target->next != 0) OS (fatal, fstart, _("multiple target patterns (target '%s')"), target->name); /* bird added target */ pattern_percent = find_percent_cached (&target->name); pattern = target->name; if (pattern_percent == 0) OS (fatal, fstart, _("target pattern contains no '%%' (target '%s')"), target->name); /* bird added target */ free_ns (target); } else pattern = 0; /* Strip leading and trailing whitespaces. */ beg = p2; end = beg + strlen (beg) - 1; strip_whitespace (&beg, &end); /* Put all the prerequisites here; they'll be parsed later. */ if (beg <= end && *beg != '\0') depstr = xstrndup (beg, end - beg + 1); else depstr = 0; commands_idx = 0; if (cmdleft != 0) { /* Semicolon means rest of line is a command. */ unsigned int l = strlen (cmdleft); cmds_started = fstart->lineno; /* Add this command line to the buffer. */ if (l + 2 > commands_len) { commands_len = (l + 2) * 2; commands = xrealloc (commands, commands_len); } memcpy (commands, cmdleft, l); commands_idx += l; commands[commands_idx++] = '\n'; } /* Determine if this target should be made default. We used to do this in record_files() but because of the delayed target recording and because preprocessor directives are legal in target's commands it is too late. Consider this fragment for example: foo: ifeq ($(.DEFAULT_GOAL),foo) ... endif Because the target is not recorded until after ifeq directive is evaluated the .DEFAULT_GOAL does not contain foo yet as one would expect. Because of this we have to move the logic here. */ if (set_default && default_goal_var->value[0] == '\0') { struct dep *d; struct nameseq *t = filenames; for (; t != 0; t = t->next) { int reject = 0; const char *name = t->name; /* We have nothing to do if this is an implicit rule. */ if (strchr (name, '%') != 0) break; /* See if this target's name does not start with a '.', unless it contains a slash. */ if (*name == '.' && strchr (name, '/') == 0 #ifdef HAVE_DOS_PATHS && strchr (name, '\\') == 0 #endif ) continue; /* If this file is a suffix, don't let it be the default goal file. */ for (d = suffix_file->deps; d != 0; d = d->next) { register struct dep *d2; if (*dep_name (d) != '.' && streq (name, dep_name (d))) { reject = 1; break; } for (d2 = suffix_file->deps; d2 != 0; d2 = d2->next) { #ifndef CONFIG_WITH_STRCACHE2 unsigned int l = strlen (dep_name (d2)); #else unsigned int l = strcache2_get_len (&file_strcache, dep_name (d2)); #endif if (!strneq (name, dep_name (d2), l)) continue; if (streq (name + l, dep_name (d))) { reject = 1; break; } } if (reject) break; } if (!reject) { define_variable_global (".DEFAULT_GOAL", 13, t->name, o_file, 0, NILF); break; } } } continue; } /* We get here except in the case that we just read a rule line. Record now the last rule we read, so following spurious commands are properly diagnosed. */ record_waiting_files (); } #undef word1eq if (conditionals->if_cmds) O (fatal, fstart, _("missing 'endif'")); #ifdef KMK if (kdata != NULL) O (fatal, fstart, _("missing `kBuild-endef-*'")); #endif /* At eof, record the last rule. */ record_waiting_files (); free (collapsed); free (commands); } /* Remove comments from LINE. This is done by copying the text at LINE onto itself. */ #ifndef CONFIG_WITH_VALUE_LENGTH static void remove_comments (char *line) #else static char * remove_comments (char *line, char *eos) #endif { char *comment; #ifndef CONFIG_WITH_VALUE_LENGTH comment = find_char_unquote (line, MAP_COMMENT); if (comment != 0) /* Cut off the line at the #. */ *comment = '\0'; #else comment = find_char_unquote_0 (line, '#', MAP_COMMENT, &eos); if (comment) { /* Cut off the line at the #. */ *comment = '\0'; return comment; } return eos; #endif } /* Execute a 'undefine' directive. The undefine line has already been read, and NAME is the name of the variable to be undefined. */ static void do_undefine (char *name, enum variable_origin origin, struct ebuffer *ebuf) { char *p, *var; /* Expand the variable name and find the beginning (NAME) and end. */ var = allocated_variable_expand (name); name = next_token (var); if (*name == '\0') O (fatal, &ebuf->floc, _("empty variable name")); p = name + strlen (name) - 1; while (p > name && ISBLANK (*p)) --p; p[1] = '\0'; undefine_variable_global (name, p - name + 1, origin); free (var); } /* Execute a 'define' directive. The first line has already been read, and NAME is the name of the variable to be defined. The following lines remain to be read. */ static struct variable * do_define (char *name IF_WITH_VALUE_LENGTH_PARAM(char *eos), enum variable_origin origin, struct ebuffer *ebuf) { struct variable *v; struct variable var; floc defstart; int nlevels = 1; unsigned int length = 100; char *definition = xmalloc (length); unsigned int idx = 0; char *p, *n; defstart = ebuf->floc; p = parse_variable_definition (name, &var); if (p == NULL) /* No assignment token, so assume recursive. */ var.flavor = f_recursive; else { if (var.value[0] != '\0') O (error, &defstart, _("extraneous text after 'define' directive")); /* Chop the string before the assignment token to get the name. */ #ifndef CONFIG_WITH_STRCACHE2 var.name[var.length] = '\0'; #else assert (!strcache2_is_cached (&variable_strcache, var.name)); ((char *)var.name)[var.length] = '\0'; #endif } /* Expand the variable name and find the beginning (NAME) and end. */ n = allocated_variable_expand (name); name = next_token (n); if (name[0] == '\0') O (fatal, &defstart, _("empty variable name")); p = name + strlen (name) - 1; while (p > name && ISBLANK (*p)) --p; p[1] = '\0'; /* Now read the value of the variable. */ while (1) { unsigned int len; char *line; long nlines = readline (ebuf); /* If there is nothing left to be eval'd, there's no 'endef'!! */ if (nlines < 0) O (fatal, &defstart, _("missing 'endef', unterminated 'define'")); ebuf->floc.lineno += nlines; line = ebuf->buffer; #ifndef CONFIG_WITH_VALUE_LENGTH collapse_continuations (line); #else ebuf->eol = collapse_continuations (line, ebuf->eol - line); #endif /* If the line doesn't begin with a tab, test to see if it introduces another define, or ends one. Stop if we find an 'endef' */ if (line[0] != cmd_prefix) { p = next_token (line); #ifndef CONFIG_WITH_VALUE_LENGTH len = strlen (p); #else len = ebuf->eol - p; assert (len == strlen (p)); #endif /* If this is another 'define', increment the level count. */ if ((len == 6 || (len > 6 && ISBLANK (p[6]))) && strneq (p, "define", 6)) ++nlevels; /* If this is an 'endef', decrement the count. If it's now 0, we've found the last one. */ else if ((len == 5 || (len > 5 && ISBLANK (p[5]))) && strneq (p, "endef", 5)) { p += 5; #ifndef CONFIG_WITH_VALUE_LENGTH remove_comments (p); #else ebuf->eol = remove_comments (p, ebuf->eol); #endif if (*(next_token (p)) != '\0') O (error, &ebuf->floc, _("extraneous text after 'endef' directive")); if (--nlevels == 0) break; } } /* Add this line to the variable definition. */ #ifndef CONFIG_WITH_VALUE_LENGTH len = strlen (line); #else len = ebuf->eol - line; assert (len == strlen (line)); #endif if (idx + len + 1 > length) { length = (idx + len) * 2; definition = xrealloc (definition, length + 1); } memcpy (&definition[idx], line, len); idx += len; /* Separate lines with a newline. */ definition[idx++] = '\n'; } /* We've got what we need; define the variable. */ if (idx == 0) definition[0] = '\0'; else definition[idx - 1] = '\0'; #ifndef CONFIG_WITH_VALUE_LENGTH v = do_variable_definition (&defstart, name, definition, origin, var.flavor, 0); #else v = do_variable_definition_2 (&defstart, name, definition, idx ? idx - 1 : idx, var.flavor == f_simple, 0 /* free_value */, origin, var.flavor, 0 /*target_var*/); #endif free (definition); free (n); return (v); } /* Interpret conditional commands "ifdef", "ifndef", "ifeq", "ifneq", "if1of", "ifn1of", "else" and "endif". LINE is the input line, with the command as its first word. FILENAME and LINENO are the filename and line number in the current makefile. They are used for error messages. Value is -2 if the line is not a conditional at all, -1 if the line is an invalid conditional, 0 if following text should be interpreted, 1 if following text should be ignored. */ static int conditional_line (char *line IF_WITH_VALUE_LENGTH_PARAM(char *eol), int len, const floc *flocp) { const char *cmdname; enum { c_ifdef, c_ifndef, c_ifeq, c_ifneq, #ifdef CONFIG_WITH_SET_CONDITIONALS c_if1of, c_ifn1of, #endif #ifdef CONFIG_WITH_IF_CONDITIONALS c_ifcond, #endif c_else, c_endif } cmdtype; unsigned int i; unsigned int o; #ifdef CONFIG_WITH_VALUE_LENGTH assert (strchr (line, '\0') == eol); #endif /* Compare a word, both length and contents. */ #define word1eq(s) (len == CSTRLEN (s) && strneq (s, line, CSTRLEN (s))) #define chkword(s, t) if (word1eq (s)) { cmdtype = (t); cmdname = (s); } /* Make sure this line is a conditional. */ chkword ("ifdef", c_ifdef) else chkword ("ifndef", c_ifndef) else chkword ("ifeq", c_ifeq) else chkword ("ifneq", c_ifneq) #ifdef CONFIG_WITH_SET_CONDITIONALS else chkword ("if1of", c_if1of) else chkword ("ifn1of", c_ifn1of) #endif #ifdef CONFIG_WITH_IF_CONDITIONALS else chkword ("if", c_ifcond) #endif else chkword ("else", c_else) else chkword ("endif", c_endif) else return -2; /* Found one: skip past it and any whitespace after it. */ line += len; NEXT_TOKEN (line); #define EXTRATEXT() OS (error, flocp, _("extraneous text after '%s' directive"), cmdname) #define EXTRACMD() OS (fatal, flocp, _("extraneous '%s'"), cmdname) /* An 'endif' cannot contain extra text, and reduces the if-depth by 1 */ if (cmdtype == c_endif) { if (*line != '\0') EXTRATEXT (); if (!conditionals->if_cmds) EXTRACMD (); --conditionals->if_cmds; goto DONE; } /* An 'else' statement can either be simple, or it can have another conditional after it. */ if (cmdtype == c_else) { const char *p; if (!conditionals->if_cmds) EXTRACMD (); o = conditionals->if_cmds - 1; if (conditionals->seen_else[o]) O (fatal, flocp, _("only one 'else' per conditional")); /* Change the state of ignorance. */ switch (conditionals->ignoring[o]) { case 0: /* We've just been interpreting. Never do it again. */ conditionals->ignoring[o] = 2; break; case 1: /* We've never interpreted yet. Maybe this time! */ conditionals->ignoring[o] = 0; break; } /* It's a simple 'else'. */ if (*line == '\0') { conditionals->seen_else[o] = 1; goto DONE; } /* The 'else' has extra text. That text must be another conditional and cannot be an 'else' or 'endif'. */ /* Find the length of the next word. */ for (p = line+1; ! STOP_SET (*p, MAP_SPACE|MAP_NUL); ++p) ; len = p - line; /* If it's 'else' or 'endif' or an illegal conditional, fail. */ if (word1eq ("else") || word1eq ("endif") || conditional_line (line IF_WITH_VALUE_LENGTH_PARAM(eol), len, flocp) < 0) EXTRATEXT (); else { /* conditional_line() created a new level of conditional. Raise it back to this level. */ if (conditionals->ignoring[o] < 2) conditionals->ignoring[o] = conditionals->ignoring[o+1]; --conditionals->if_cmds; } goto DONE; } #ifndef KMK if (conditionals->allocated == 0) { conditionals->allocated = 5; conditionals->ignoring = xmalloc (conditionals->allocated); conditionals->seen_else = xmalloc (conditionals->allocated); } #endif o = conditionals->if_cmds++; if (conditionals->if_cmds > conditionals->allocated) { #ifdef KMK if (conditionals->allocated <= sizeof (conditionals->ignoring_first)) { assert (conditionals->allocated == sizeof (conditionals->ignoring_first)); conditionals->allocated += 16; conditionals->ignoring = xmalloc (conditionals->allocated); memcpy (conditionals->ignoring, conditionals->ignoring_first, sizeof (conditionals->ignoring_first)); conditionals->seen_else = xmalloc (conditionals->allocated); memcpy (conditionals->seen_else, conditionals->seen_else_first, sizeof (conditionals->seen_else_first)); } else { conditionals->allocated *= 2; #else /* !KMK */ conditionals->allocated += 5; #endif /* !KMK */ conditionals->ignoring = xrealloc (conditionals->ignoring, conditionals->allocated); conditionals->seen_else = xrealloc (conditionals->seen_else, conditionals->allocated); #ifdef KMK } #endif } /* Record that we have seen an 'if...' but no 'else' so far. */ conditionals->seen_else[o] = 0; /* Search through the stack to see if we're already ignoring. */ for (i = 0; i < o; ++i) if (conditionals->ignoring[i]) { /* We are already ignoring, so just push a level to match the next "else" or "endif", and keep ignoring. We don't want to expand variables in the condition. */ conditionals->ignoring[o] = 1; return 1; } if (cmdtype == c_ifdef || cmdtype == c_ifndef) { char *var; struct variable *v; char *p; /* Expand the thing we're looking up, so we can use indirect and constructed variable names. */ #ifndef CONFIG_WITH_VALUE_LENGTH var = allocated_variable_expand (line); #else var = variable_expand_string_2 (NULL, line, eol - line, &p); #endif /* Make sure there's only one variable name to test. */ p = end_of_token (var); i = p - var; NEXT_TOKEN (p); if (*p != '\0') return -1; var[i] = '\0'; v = lookup_variable (var, i); conditionals->ignoring[o] = ((v != 0 && *v->value != '\0') == (cmdtype == c_ifndef)); #ifndef CONFIG_WITH_VALUE_LENGTH free (var); #endif } #ifdef CONFIG_WITH_IF_CONDITIONALS else if (cmdtype == c_ifcond) { int rval = expr_eval_if_conditionals (line, flocp); if (rval == -1) return rval; conditionals->ignoring[o] = rval; } #endif else { #ifdef CONFIG_WITH_SET_CONDITIONALS /* "ifeq", "ifneq", "if1of" or "ifn1of". */ #else /* "ifeq" or "ifneq". */ #endif char *s1, *s2; unsigned int l; char termin = *line == '(' ? ',' : *line; #ifdef CONFIG_WITH_VALUE_LENGTH char *s1_end, *s2_end; #endif if (termin != ',' && termin != '"' && termin != '\'') return -1; s1 = ++line; /* Find the end of the first string. */ if (termin == ',') { int count = 0; for (; *line != '\0'; ++line) if (*line == '(') ++count; else if (*line == ')') --count; else if (*line == ',' && count <= 0) break; } else while (*line != '\0' && *line != termin) ++line; if (*line == '\0') return -1; if (termin == ',') { /* Strip blanks after the first string. */ char *p = line++; while (ISBLANK (p[-1])) --p; *p = '\0'; #ifdef CONFIG_WITH_VALUE_LENGTH l = p - s1; #endif } else { #ifdef CONFIG_WITH_VALUE_LENGTH l = line - s1; #endif *line++ = '\0'; } #ifndef CONFIG_WITH_VALUE_LENGTH s2 = variable_expand (s1); /* We must allocate a new copy of the expanded string because variable_expand re-uses the same buffer. */ l = strlen (s2); s1 = alloca (l + 1); memcpy (s1, s2, l + 1); #else s1 = variable_expand_string_2 (NULL, s1, l, &s1_end); #endif if (termin != ',') /* Find the start of the second string. */ NEXT_TOKEN (line); termin = termin == ',' ? ')' : *line; if (termin != ')' && termin != '"' && termin != '\'') return -1; /* Find the end of the second string. */ if (termin == ')') { int count = 0; s2 = next_token (line); for (line = s2; *line != '\0'; ++line) { if (*line == '(') ++count; else if (*line == ')') { if (count <= 0) break; else --count; } } } else { ++line; s2 = line; while (*line != '\0' && *line != termin) ++line; } if (*line == '\0') return -1; #ifdef CONFIG_WITH_VALUE_LENGTH l = line - s2; #endif *(line++) = '\0'; NEXT_TOKEN (line); if (*line != '\0') EXTRATEXT (); #ifndef CONFIG_WITH_VALUE_LENGTH s2 = variable_expand (s2); #else s2 = variable_expand_string_2 (s1_end + 1, s2, l, &s2_end); if (s2 != s1_end + 1) s1 += s2 - s1_end - 1; /* the variable buffer was reallocated */ #endif #ifdef CONFIG_WITH_SET_CONDITIONALS if (cmdtype == c_if1of || cmdtype == c_ifn1of) { const char *s1_cur; unsigned int s1_len; const char *s1_iterator = s1; conditionals->ignoring[o] = (cmdtype == c_if1of); /* if not found */ while ((s1_cur = find_next_token (&s1_iterator, &s1_len)) != 0) { const char *s2_cur; unsigned int s2_len; const char *s2_iterator = s2; while ((s2_cur = find_next_token (&s2_iterator, &s2_len)) != 0) if (s2_len == s1_len && strneq (s2_cur, s1_cur, s1_len) ) { conditionals->ignoring[o] = (cmdtype != c_if1of); /* found */ break; } } } else conditionals->ignoring[o] = (streq (s1, s2) == (cmdtype == c_ifneq)); #else conditionals->ignoring[o] = (streq (s1, s2) == (cmdtype == c_ifneq)); #endif } DONE: /* Search through the stack to see if we're ignoring. */ for (i = 0; i < conditionals->if_cmds; ++i) if (conditionals->ignoring[i]) return 1; return 0; } /* Record target-specific variable values for files FILENAMES. TWO_COLON is nonzero if a double colon was used. The links of FILENAMES are freed, and so are any names in it that are not incorporated into other data structures. If the target is a pattern, add the variable to the pattern-specific variable value list. */ static void record_target_var (struct nameseq *filenames, char *defn, enum variable_origin origin, struct vmodifiers *vmod, const floc *flocp) { struct nameseq *nextf; struct variable_set_list *global; global = current_variable_set_list; /* If the variable is an append version, store that but treat it as a normal recursive variable. */ for (; filenames != 0; filenames = nextf) { struct variable *v; const char *name = filenames->name; const char *percent; struct pattern_var *p; #ifdef CONFIG_WITH_VALUE_LENGTH const char *fname; #endif nextf = filenames->next; free_ns (filenames); /* If it's a pattern target, then add it to the pattern-specific variable list. */ percent = find_percent_cached (&name); if (percent) { /* Get a reference for this pattern-specific variable struct. */ p = create_pattern_var (name, percent); p->variable.fileinfo = *flocp; /* I don't think this can fail since we already determined it was a variable definition. */ v = assign_variable_definition (&p->variable, defn IF_WITH_VALUE_LENGTH_PARAM(NULL)); assert (v != 0); v->origin = origin; #ifndef CONFIG_WITH_VALUE_LENGTH if (v->flavor == f_simple) v->value = allocated_variable_expand (v->value); else v->value = xstrdup (v->value); #else v->value_length = strlen (v->value); if (v->flavor == f_simple) v->value = allocated_variable_expand_2 (v->value, v->value_length, &v->value_length); else v->value = (char *)memcpy (xmalloc (v->value_length + 1), v->value, v->value_length + 1); v->value_alloc_len = v->value_length + 1; #endif } else { struct file *f; /* Get a file reference for this file, and initialize it. We don't want to just call enter_file() because that allocates a new entry if the file is a double-colon, which we don't want in this situation. */ #ifndef CONFIG_WITH_STRCACHE2 f = lookup_file (name); if (!f) f = enter_file (strcache_add (name)); #else /* CONFIG_WITH_STRCACHE2 */ /* XXX: this is probably already a cached string. */ fname = strcache_add (name); f = lookup_file_cached (fname); if (!f) f = enter_file (fname); #endif /* CONFIG_WITH_STRCACHE2 */ else if (f->double_colon) f = f->double_colon; initialize_file_variables (f, 1); current_variable_set_list = f->variables; v = try_variable_definition (flocp, defn IF_WITH_VALUE_LENGTH_PARAM(NULL), origin, 1); if (!v) O (fatal, flocp, _("Malformed target-specific variable definition")); current_variable_set_list = global; } /* Set up the variable to be *-specific. */ v->per_target = 1; v->private_var = vmod->private_v; v->export = vmod->export_v ? v_export : v_default; /* If it's not an override, check to see if there was a command-line setting. If so, reset the value. */ if (v->origin != o_override) { struct variable *gv; #ifndef CONFIG_WITH_STRCACHE2 int len = strlen (v->name); #else int len = !percent ? strcache2_get_len (&variable_strcache, v->name) : strlen(v->name); #endif gv = lookup_variable (v->name, len); if (gv && v != gv && (gv->origin == o_env_override || gv->origin == o_command)) { #ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE assert (!v->rdonly_val); /* paranoia */ #endif free (v->value); #ifndef CONFIG_WITH_VALUE_LENGTH v->value = xstrdup (gv->value); #else v->value = xstrndup (gv->value, gv->value_length); v->value_length = gv->value_length; #endif v->origin = gv->origin; v->recursive = gv->recursive; v->append = 0; VARIABLE_CHANGED (v); } } } } /* Record a description line for files FILENAMES, with dependencies DEPS, commands to execute described by COMMANDS and COMMANDS_IDX, coming from FILENAME:COMMANDS_STARTED. TWO_COLON is nonzero if a double colon was used. If not nil, PATTERN is the '%' pattern to make this a static pattern rule, and PATTERN_PERCENT is a pointer to the '%' within it. The links of FILENAMES are freed, and so are any names in it that are not incorporated into other data structures. */ static void record_files (struct nameseq *filenames, const char *pattern, const char *pattern_percent, char *depstr, unsigned int cmds_started, char *commands, unsigned int commands_idx, int two_colon, char prefix, const floc *flocp) { #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET struct file *prev_file = 0; enum multitarget_mode { m_unsettled, m_no, m_yes, m_yes_maybe } multi_mode = !two_colon && !pattern ? m_unsettled : m_no; #endif struct commands *cmds; struct dep *deps; const char *implicit_percent; const char *name; /* If we've already snapped deps, that means we're in an eval being resolved after the makefiles have been read in. We can't add more rules at this time, since they won't get snapped and we'll get core dumps. See Savannah bug # 12124. */ if (snapped_deps) O (fatal, flocp, _("prerequisites cannot be defined in recipes")); /* Determine if this is a pattern rule or not. */ name = filenames->name; implicit_percent = find_percent_cached (&name); /* If there's a recipe, set up a struct for it. */ if (commands_idx > 0) { #ifndef CONFIG_WITH_ALLOC_CACHES cmds = xmalloc (sizeof (struct commands)); #else cmds = alloccache_alloc (&commands_cache); #endif cmds->fileinfo.filenm = flocp->filenm; cmds->fileinfo.lineno = cmds_started; cmds->fileinfo.offset = 0; cmds->commands = xstrndup (commands, commands_idx); cmds->command_lines = 0; cmds->recipe_prefix = prefix; #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS cmds->refs = 0; #endif } else cmds = 0; /* If there's a prereq string then parse it--unless it's eligible for 2nd expansion: if so, snap_deps() will do it. */ if (depstr == 0) deps = 0; else { depstr = unescape_char (depstr, ':'); if (second_expansion && strchr (depstr, '$')) { deps = alloc_dep (); deps->name = depstr; deps->need_2nd_expansion = 1; deps->staticpattern = pattern != 0; } else { deps = split_prereqs (depstr); free (depstr); /* We'll enter static pattern prereqs later when we have the stem. We don't want to enter pattern rules at all so that we don't think that they ought to exist (make manual "Implicit Rule Search Algorithm", item 5c). */ if (! pattern && ! implicit_percent) deps = enter_prereqs (deps, NULL); } } /* For implicit rules, _all_ the targets must have a pattern. That means we can test the first one to see if we're working with an implicit rule; if so we handle it specially. */ if (implicit_percent) { struct nameseq *nextf; const char **targets, **target_pats; unsigned int c; if (pattern != 0) O (fatal, flocp, _("mixed implicit and static pattern rules")); /* Count the targets to create an array of target names. We already have the first one. */ nextf = filenames->next; free_ns (filenames); filenames = nextf; for (c = 1; nextf; ++c, nextf = nextf->next) ; targets = xmalloc (c * sizeof (const char *)); target_pats = xmalloc (c * sizeof (const char *)); targets[0] = name; target_pats[0] = implicit_percent; c = 1; while (filenames) { name = filenames->name; implicit_percent = find_percent_cached (&name); if (implicit_percent == 0) O (fatal, flocp, _("mixed implicit and normal rules")); targets[c] = name; target_pats[c] = implicit_percent; ++c; nextf = filenames->next; free_ns (filenames); filenames = nextf; } create_pattern_rule (targets, target_pats, c, two_colon, deps, cmds, 1); return; } /* Walk through each target and create it in the database. We already set up the first target, above. */ while (1) { struct nameseq *nextf = filenames->next; struct file *f; struct dep *this = 0; free_ns (filenames); /* Check for special targets. Do it here instead of, say, snap_deps() so that we can immediately use the value. */ if (streq (name, ".POSIX")) { posix_pedantic = 1; define_variable_cname (".SHELLFLAGS", "-ec", o_default, 0); /* These default values are based on IEEE Std 1003.1-2008. */ define_variable_cname ("ARFLAGS", "-rv", o_default, 0); define_variable_cname ("CC", "c99", o_default, 0); define_variable_cname ("CFLAGS", "-O", o_default, 0); define_variable_cname ("FC", "fort77", o_default, 0); define_variable_cname ("FFLAGS", "-O 1", o_default, 0); define_variable_cname ("SCCSGETFLAGS", "-s", o_default, 0); } else if (streq (name, ".SECONDEXPANSION")) second_expansion = 1; #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION else if (streq (name, ".SECONDTARGETEXPANSION")) second_target_expansion = 1; #endif #if !defined (__MSDOS__) && !defined (__EMX__) else if (streq (name, ".ONESHELL")) one_shell = 1; #endif #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET /* Check for the explicit multitarget mode operators. For this to be identified as an explicit multiple target rule, the first + or +| operator *must* appear between the first two files. If not found as the 2nd file or if found as the 1st file, the rule will be rejected as a potential multiple first target rule. For the subsequent files the operator is only required to switch between maybe and non-maybe mode: `primary + 2nd 3rd +| 4th-maybe + 5th-for-sure: deps; cmds' The whole idea of the maybe-updated files is this: timestamp +| maybe.h: src1.c src2.c grep goes-into-maybe.h $* > timestamp cmp timestamp maybe.h || cp -f timestamp maybe.h This is implemented in remake.c where we don't consider the mtime of the maybe-updated targets. */ if (multi_mode != m_no && name[0] == '+' && (name[1] == '\0' || (name[1] == '|' && name[2] == '\0'))) { if (!prev_file) multi_mode = m_no; /* first */ else { if (multi_mode == m_unsettled) { prev_file->multi_head = prev_file; /* Only the primary file needs the dependencies. */ if (deps) { free_dep_chain (deps); deps = NULL; } } multi_mode = name[1] == '\0' ? m_yes : m_yes_maybe; goto l_next; } } else if (multi_mode == m_unsettled && prev_file) multi_mode = m_no; #endif /* If this is a static pattern rule: 'targets: target%pattern: prereq%pattern; recipe', make sure the pattern matches this target name. */ if (pattern && !pattern_matches (pattern, pattern_percent, name)) OS (error, flocp, _("target '%s' doesn't match the target pattern"), name); else if (deps) /* If there are multiple targets, copy the chain DEPS for all but the last one. It is not safe for the same deps to go in more than one place in the database. */ this = nextf != 0 ? copy_dep_chain (deps) : deps; /* Find or create an entry in the file database for this target. */ if (!two_colon) { /* Single-colon. Combine this rule with the file's existing record, if any. */ #ifndef KMK f = enter_file (strcache_add (name)); #else /* KMK - the name is already in the cache, don't waste time. */ f = enter_file (name); #endif if (f->double_colon) OS (fatal, flocp, _("target file '%s' has both : and :: entries"), f->name); /* If CMDS == F->CMDS, this target was listed in this rule more than once. Just give a warning since this is harmless. */ if (cmds != 0 && cmds == f->cmds) OS (error, flocp, _("target '%s' given more than once in the same rule"), f->name); /* Check for two single-colon entries both with commands. Check is_target so that we don't lose on files such as .c.o whose commands were preinitialized. */ else if (cmds != 0 && f->cmds != 0 && f->is_target) { size_t l = strlen (f->name); error (&cmds->fileinfo, l, _("warning: overriding recipe for target '%s'"), f->name); error (&f->cmds->fileinfo, l, _("warning: ignoring old recipe for target '%s'"), f->name); } /* Defining .DEFAULT with no deps or cmds clears it. */ if (f == default_file && this == 0 && cmds == 0) f->cmds = 0; if (cmds != 0) f->cmds = cmds; #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET /* If this is an explicit multi target rule, add it to the target chain and set the multi_maybe flag according to the current mode. */ if (multi_mode >= m_yes) { f->multi_maybe = multi_mode == m_yes_maybe; prev_file->multi_next = f; assert (prev_file->multi_head != 0); f->multi_head = prev_file->multi_head; if (f == suffix_file) O (error, flocp, _(".SUFFIXES encountered in an explicit multi target rule")); } prev_file = f; #endif /* Defining .SUFFIXES with no dependencies clears out the list of suffixes. */ if (f == suffix_file && this == 0) { free_dep_chain (f->deps); f->deps = 0; } } else { /* Double-colon. Make a new record even if there already is one. */ #ifndef CONFIG_WITH_STRCACHE2 f = lookup_file (name); #else /* CONFIG_WITH_STRCACHE2 - the name is already in the cache, don't waste time. */ f = lookup_file_cached (name); #endif /* CONFIG_WITH_STRCACHE2 */ /* Check for both : and :: rules. Check is_target so we don't lose on default suffix rules or makefiles. */ if (f != 0 && f->is_target && !f->double_colon) OS (fatal, flocp, _("target file '%s' has both : and :: entries"), f->name); #ifndef KMK f = enter_file (strcache_add (name)); #else /* KMK - the name is already in the cache, don't waste time. */ f = enter_file (name); #endif /* If there was an existing entry and it was a double-colon entry, enter_file will have returned a new one, making it the prev pointer of the old one, and setting its double_colon pointer to the first one. */ if (f->double_colon == 0) /* This is the first entry for this name, so we must set its double_colon pointer to itself. */ f->double_colon = f; f->cmds = cmds; } f->is_target = 1; /* If this is a static pattern rule, set the stem to the part of its name that matched the '%' in the pattern, so you can use $* in the commands. If we didn't do it before, enter the prereqs now. */ if (pattern) { static const char *percent = "%"; char *buffer = variable_expand (""); const size_t buffer_offset = buffer - variable_buffer; /* bird */ char *o = patsubst_expand_pat (buffer, name, pattern, percent, pattern_percent+1, percent+1); buffer = variable_buffer + buffer_offset; /* bird - variable_buffer may have been reallocated. */ f->stem = strcache_add_len (buffer, o - buffer); if (this) { if (! this->need_2nd_expansion) this = enter_prereqs (this, f->stem); else this->stem = f->stem; } } /* Add the dependencies to this file entry. */ if (this != 0) { /* Add the file's old deps and the new ones in THIS together. */ if (f->deps == 0) f->deps = this; else if (cmds != 0) { struct dep *d = this; /* If this rule has commands, put these deps first. */ while (d->next != 0) d = d->next; d->next = f->deps; f->deps = this; } else { struct dep *d = f->deps; /* A rule without commands: put its prereqs at the end. */ while (d->next != 0) d = d->next; d->next = this; } } name = f->name; #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET l_next: #endif /* All done! Set up for the next one. */ if (nextf == 0) break; filenames = nextf; /* Reduce escaped percents. If there are any unescaped it's an error */ name = filenames->name; if (find_percent_cached (&name)) O (error, flocp, _("*** mixed implicit and normal rules: deprecated syntax")); } } /* Search STRING for an unquoted STOPCHAR or blank (if BLANK is nonzero). Backslashes quote STOPCHAR, blanks if BLANK is nonzero, and backslash. Quoting backslashes are removed from STRING by compacting it into itself. Returns a pointer to the first unquoted STOPCHAR if there is one, or nil if there are none. STOPCHARs inside variable references are ignored if IGNOREVARS is true. STOPCHAR _cannot_ be '$' if IGNOREVARS is true. */ static char * find_char_unquote (char *string, int map IF_WITH_VALUE_LENGTH_PARAM(unsigned int string_len)) { #ifndef CONFIG_WITH_VALUE_LENGTH unsigned int string_len = 0; #endif char *p = string; #ifdef CONFIG_WITH_VALUE_LENGTH assert (string_len == 0 || string_len == strlen (string)); #endif /* Always stop on NUL. */ map |= MAP_NUL; while (1) { while (! STOP_SET (*p, map)) ++p; if (*p == '\0') break; /* If we stopped due to a variable reference, skip over its contents. */ if (STOP_SET (*p, MAP_VARIABLE)) { char openparen = p[1]; /* Check if '$' is the last character in the string. */ if (openparen == '\0') break; p += 2; /* Skip the contents of a non-quoted, multi-char variable ref. */ if (openparen == '(' || openparen == '{') { unsigned int pcount = 1; char closeparen = (openparen == '(' ? ')' : '}'); char ch; /* bird */ while ((ch = *p)) { if (ch == openparen) ++pcount; else if (ch == closeparen) if (--pcount == 0) { ++p; break; } ++p; } } /* Skipped the variable reference: look for STOPCHARS again. */ continue; } if (p > string && p[-1] == '\\') { /* Search for more backslashes. */ int i = -2; while (&p[i] >= string && p[i] == '\\') --i; ++i; /* Only compute the length if really needed. */ if (string_len == 0) string_len = strlen (string); /* The number of backslashes is now -I. Copy P over itself to swallow half of them. */ memmove (&p[i], &p[i/2], (string_len - (p - string)) - (i/2) + 1); p += i/2; if (i % 2 == 0) /* All the backslashes quoted each other; the STOPCHAR was unquoted. */ return p; /* The STOPCHAR was quoted by a backslash. Look for another. */ } else /* No backslash in sight. */ return p; } /* Never hit a STOPCHAR or blank (with BLANK nonzero). */ return 0; } #ifdef CONFIG_WITH_VALUE_LENGTH /* Special case version of find_char_unquote that only takes stop character. This is so common that it makes a lot of sense to specialize this. */ K_INLINE char * find_char_unquote_0 (char *string, int stop1, int map, char **eosp) { unsigned int string_len = *eosp - string; char *p; assert (strlen (string) == string_len); assert (!(map & MAP_VARIABLE) && map != 0); assert ((stopchar_map[(unsigned char)stop1] & map) == map); p = (char *)memchr (string, stop1, string_len); if (!p) return NULL; if (p <= string || p[-1] != '\\') return p; p = find_char_unquote (string, map, string_len); *eosp = memchr (string, '\0', string_len); return p; } #endif /* Unescape a character in a string. The string is compressed onto itself. */ static char * unescape_char (char *string, int c) { char *p = string; char *s = string; while (*s != '\0') { if (*s == '\\') { char *e = s; int l; /* We found a backslash. See if it's escaping our character. */ while (*e == '\\') ++e; l = e - s; if (*e != c || l%2 == 0) { /* It's not; just take it all without unescaping. */ memmove (p, s, l); p += l; // If we hit the end of the string, we're done if (*e == '\0') break; } else if (l > 1) { /* It is, and there's >1 backslash. Take half of them. */ l /= 2; memmove (p, s, l); p += l; } s = e; } *(p++) = *(s++); } *p = '\0'; return string; } /* Search PATTERN for an unquoted % and handle quoting. */ char * find_percent (char *pattern) { #ifndef CONFIG_WITH_VALUE_LENGTH return find_char_unquote (pattern, MAP_PERCENT); #else char *eos = strchr (pattern, '\0'); return find_char_unquote_0 (pattern, '%', MAP_PERCENT, &eos); #endif } /* Search STRING for an unquoted % and handle quoting. Returns a pointer to the % or NULL if no % was found. This version is used with strings in the string cache: if there's a need to modify the string a new version will be added to the string cache and *STRING will be set to that. */ const char * find_percent_cached (const char **string) { const char *p = *string; char *new = 0; int slen = 0; /* If the first char is a % return now. This lets us avoid extra tests inside the loop. */ if (*p == '%') return p; while (1) { while (! STOP_SET (*p, MAP_PERCENT|MAP_NUL)) ++p; if (*p == '\0') break; /* See if this % is escaped with a backslash; if not we're done. */ if (p[-1] != '\\') break; { /* Search for more backslashes. */ char *pv; int i = -2; while (&p[i] >= *string && p[i] == '\\') --i; ++i; /* At this point we know we'll need to allocate a new string. Make a copy if we haven't yet done so. */ if (! new) { slen = strlen (*string); new = alloca (slen + 1); memcpy (new, *string, slen + 1); p = new + (p - *string); *string = new; } /* At this point *string, p, and new all point into the same string. Get a non-const version of p so we can modify new. */ pv = new + (p - *string); /* The number of backslashes is now -I. Copy P over itself to swallow half of them. */ memmove (&pv[i], &pv[i/2], (slen - (pv - new)) - (i/2) + 1); p += i/2; /* If the backslashes quoted each other; the % was unquoted. */ if (i % 2 == 0) break; } } /* If we had to change STRING, add it to the strcache. */ if (new) { *string = strcache_add (*string); p = *string + (p - new); } /* If we didn't find a %, return NULL. Otherwise return a ptr to it. */ return (*p == '\0') ? NULL : p; } /* Find the next line of text in an eval buffer, combining continuation lines into one line. Return the number of actual lines read (> 1 if continuation lines). Returns -1 if there's nothing left in the buffer. After this function, ebuf->buffer points to the first character of the line we just found. */ /* Read a line of text from a STRING. Since we aren't really reading from a file, don't bother with linenumbers. */ static long readstring (struct ebuffer *ebuf) { char *eol; #ifdef CONFIG_WITH_VALUE_LENGTH char *end; #endif /* If there is nothing left in this buffer, return 0. */ if (ebuf->bufnext >= ebuf->bufstart + ebuf->size) return -1; /* Set up a new starting point for the buffer, and find the end of the next logical line (taking into account backslash/newline pairs). */ eol = ebuf->buffer = ebuf->bufnext; #ifdef CONFIG_WITH_VALUE_LENGTH end = ebuf->bufstart + ebuf->size; #endif while (1) { int backslash = 0; const char *bol = eol; const char *p; /* Find the next newline. At EOS, stop. */ #ifndef CONFIG_WITH_VALUE_LENGTH p = eol = strchr (eol , '\n'); #else p = (char *)memchr (eol, '\n', end - eol); assert (!memchr (eol, '\0', p != 0 ? p - eol : end - eol)); eol = (char *)p; #endif if (!eol) { ebuf->bufnext = ebuf->bufstart + ebuf->size + 1; #ifdef CONFIG_WITH_VALUE_LENGTH ebuf->eol = end; #endif return 0; } /* Found a newline; if it's escaped continue; else we're done. */ while (p > bol && *(--p) == '\\') backslash = !backslash; if (!backslash) break; ++eol; } /* Overwrite the newline char. */ *eol = '\0'; ebuf->bufnext = eol+1; #ifdef CONFIG_WITH_VALUE_LENGTH ebuf->eol = eol; #endif return 0; } static long readline (struct ebuffer *ebuf) { char *p; char *end; char *start; long nlines = 0; /* The behaviors between string and stream buffers are different enough to warrant different functions. Do the Right Thing. */ if (!ebuf->fp) return readstring (ebuf); /* When reading from a file, we always start over at the beginning of the buffer for each new line. */ p = start = ebuf->bufstart; end = p + ebuf->size; *p = '\0'; #ifdef CONFIG_WITH_VALUE_LENGTH ebuf->eol = p; #endif while (fgets (p, end - p, ebuf->fp) != 0) { char *p2; unsigned long len; int backslash; len = strlen (p); if (len == 0) { /* This only happens when the first thing on the line is a '\0'. It is a pretty hopeless case, but (wonder of wonders) Athena lossage strikes again! (xmkmf puts NULs in its makefiles.) There is nothing really to be done; we synthesize a newline so the following line doesn't appear to be part of this line. */ O (error, &ebuf->floc, _("warning: NUL character seen; rest of line ignored")); p[0] = '\n'; len = 1; } /* Jump past the text we just read. */ p += len; /* If the last char isn't a newline, the whole line didn't fit into the buffer. Get some more buffer and try again. */ if (p[-1] != '\n') goto more_buffer; /* We got a newline, so add one to the count of lines. */ ++nlines; #if !defined(WINDOWS32) && !defined(__MSDOS__) && !defined(__EMX__) /* Check to see if the line was really ended with CRLF; if so ignore the CR. */ if ((p - start) > 1 && p[-2] == '\r') { --p; memmove (p-1, p, strlen (p) + 1); } #endif backslash = 0; for (p2 = p - 2; p2 >= start; --p2) { if (*p2 != '\\') break; backslash = !backslash; } if (!backslash) { p[-1] = '\0'; #ifdef CONFIG_WITH_VALUE_LENGTH ebuf->eol = p - 1; #endif break; } /* It was a backslash/newline combo. If we have more space, read another line. */ if (end - p >= 80) { #ifdef CONFIG_WITH_VALUE_LENGTH ebuf->eol = p; #endif continue; } /* We need more space at the end of our buffer, so realloc it. Make sure to preserve the current offset of p. */ more_buffer: { unsigned long off = p - start; ebuf->size *= 2; start = ebuf->buffer = ebuf->bufstart = xrealloc (start, ebuf->size); p = start + off; end = start + ebuf->size; *p = '\0'; #ifdef CONFIG_WITH_VALUE_LENGTH ebuf->eol = p; #endif } } if (ferror (ebuf->fp)) pfatal_with_name (ebuf->floc.filenm); /* If we found some lines, return how many. If we didn't, but we did find _something_, that indicates we read the last line of a file with no final newline; return 1. If we read nothing, we're at EOF; return -1. */ return nlines ? nlines : p == ebuf->bufstart ? -1 : 1; } /* Parse the next "makefile word" from the input buffer, and return info about it. A "makefile word" is one of: w_bogus Should never happen w_eol End of input w_static A static word; cannot be expanded w_variable A word containing one or more variables/functions w_colon A colon w_dcolon A double-colon w_semicolon A semicolon w_varassign A variable assignment operator (=, :=, ::=, +=, >=, ?=, or !=) Note that this function is only used when reading certain parts of the makefile. Don't use it where special rules hold sway (RHS of a variable, in a command list, etc.) */ static enum make_word_type get_next_mword (char *buffer, char *delim, char **startp, unsigned int *length) { enum make_word_type wtype = w_bogus; char *p = buffer, *beg; char c; /* Skip any leading whitespace. */ while (ISBLANK (*p)) ++p; beg = p; c = *(p++); switch (c) { case '\0': wtype = w_eol; break; case ';': wtype = w_semicolon; break; case '=': wtype = w_varassign; break; case ':': wtype = w_colon; switch (*p) { case ':': ++p; if (p[1] != '=') wtype = w_dcolon; else { wtype = w_varassign; ++p; } break; case '=': ++p; wtype = w_varassign; break; } break; case '+': case '?': case '!': #ifdef CONFIG_WITH_PREPEND_ASSIGNMENT case '>': #endif if (*p == '=') { ++p; wtype = w_varassign; break; } /* fall thru */ default: if (delim && strchr (delim, c)) wtype = w_static; break; } /* Did we find something? If so, return now. */ if (wtype != w_bogus) goto done; /* This is some non-operator word. A word consists of the longest string of characters that doesn't contain whitespace, one of [:=#], or [?+!]=, or one of the chars in the DELIM string. */ /* We start out assuming a static word; if we see a variable we'll adjust our assumptions then. */ wtype = w_static; /* We already found the first value of "c", above. */ while (1) { char closeparen; int count; switch (c) { case '\0': case ' ': case '\t': case '=': goto done_word; case ':': #ifdef HAVE_DOS_PATHS /* A word CAN include a colon in its drive spec. The drive spec is allowed either at the beginning of a word, or as part of the archive member name, like in "libfoo.a(d:/foo/bar.o)". */ if (!(p - beg >= 2 && (*p == '/' || *p == '\\') && isalpha ((unsigned char)p[-2]) && (p - beg == 2 || p[-3] == '('))) #endif goto done_word; case '$': c = *(p++); if (c == '$') break; if (c == '\0') goto done_word; /* This is a variable reference, so note that it's expandable. Then read it to the matching close paren. */ wtype = w_variable; if (c == '(') closeparen = ')'; else if (c == '{') closeparen = '}'; else /* This is a single-letter variable reference. */ break; for (count=0; *p != '\0'; ++p) { if (*p == c) ++count; else if (*p == closeparen && --count < 0) { ++p; break; } } break; case '?': case '+': #ifdef CONFIG_WITH_PREPEND_ASSIGNMENT case '>': #endif if (*p == '=') goto done_word; break; case '\\': switch (*p) { case ':': case ';': case '=': case '\\': ++p; break; } break; default: if (delim && strchr (delim, c)) goto done_word; break; } c = *(p++); } done_word: --p; done: if (startp) *startp = beg; if (length) *length = p - beg; return wtype; } /* Construct the list of include directories from the arguments and the default list. */ void construct_include_path (const char **arg_dirs) { #ifdef VAXC /* just don't ask ... */ stat_t stbuf; #else struct stat stbuf; #endif const char **dirs; const char **cpp; unsigned int idx; /* Compute the number of pointers we need in the table. */ idx = sizeof (default_include_directories) / sizeof (const char *); if (arg_dirs) for (cpp = arg_dirs; *cpp != 0; ++cpp) ++idx; #ifdef __MSDOS__ /* Add one for $DJDIR. */ ++idx; #endif #ifdef KMK /* Add one for the kBuild directory. */ ++idx; #endif dirs = xmalloc (idx * sizeof (const char *)); idx = 0; max_incl_len = 0; /* First consider any dirs specified with -I switches. Ignore any that don't exist. Remember the maximum string length. */ if (arg_dirs) while (*arg_dirs != 0) { const char *dir = *(arg_dirs++); char *expanded = 0; int e; if (dir[0] == '~') { expanded = tilde_expand (dir); if (expanded != 0) dir = expanded; } EINTRLOOP (e, stat (dir, &stbuf)); if (e == 0 && S_ISDIR (stbuf.st_mode)) { unsigned int len = strlen (dir); /* If dir name is written with trailing slashes, discard them. */ while (len > 1 && dir[len - 1] == '/') --len; if (len > max_incl_len) max_incl_len = len; dirs[idx++] = strcache_add_len (dir, len); } free (expanded); } /* Now add the standard default dirs at the end. */ #ifdef __MSDOS__ { /* The environment variable $DJDIR holds the root of the DJGPP directory tree; add ${DJDIR}/include. */ struct variable *djdir = lookup_variable ("DJDIR", 5); if (djdir) { unsigned int len = strlen (djdir->value) + 8; char *defdir = alloca (len + 1); strcat (strcpy (defdir, djdir->value), "/include"); dirs[idx++] = strcache_add (defdir); if (len > max_incl_len) max_incl_len = len; } } #endif #ifdef KMK /* Add $(KBUILD_PATH). */ { size_t len = strlen (get_kbuild_path ()); dirs[idx++] = strcache_add_len (get_kbuild_path (), len); if (len > max_incl_len) max_incl_len = len; } #endif for (cpp = default_include_directories; *cpp != 0; ++cpp) { int e; EINTRLOOP (e, stat (*cpp, &stbuf)); if (e == 0 && S_ISDIR (stbuf.st_mode)) { unsigned int len = strlen (*cpp); /* If dir name is written with trailing slashes, discard them. */ while (len > 1 && (*cpp)[len - 1] == '/') --len; if (len > max_incl_len) max_incl_len = len; dirs[idx++] = strcache_add_len (*cpp, len); } } dirs[idx] = 0; /* Now add each dir to the .INCLUDE_DIRS variable. */ for (cpp = dirs; *cpp != 0; ++cpp) do_variable_definition (NILF, ".INCLUDE_DIRS", *cpp, o_default, f_append, 0); include_directories = dirs; } /* Expand ~ or ~USER at the beginning of NAME. Return a newly malloc'd string or 0. */ char * tilde_expand (const char *name) { #ifndef VMS if (name[1] == '/' || name[1] == '\0') { char *home_dir; int is_variable; { /* Turn off --warn-undefined-variables while we expand HOME. */ int save = warn_undefined_variables_flag; warn_undefined_variables_flag = 0; #ifndef CONFIG_WITH_VALUE_LENGTH home_dir = allocated_variable_expand ("$(HOME)"); #else home_dir = allocated_variable_expand_2 (STRING_SIZE_TUPLE("$(HOME)"), NULL); #endif warn_undefined_variables_flag = save; } is_variable = home_dir[0] != '\0'; if (!is_variable) { free (home_dir); home_dir = getenv ("HOME"); } # if !defined(_AMIGA) && !defined(WINDOWS32) if (home_dir == 0 || home_dir[0] == '\0') { char *logname = getlogin (); home_dir = 0; if (logname != 0) { struct passwd *p = getpwnam (logname); if (p != 0) home_dir = p->pw_dir; } } # endif /* !AMIGA && !WINDOWS32 */ if (home_dir != 0) { char *new = xstrdup (concat (2, home_dir, name + 1)); if (is_variable) free (home_dir); return new; } } # if !defined(_AMIGA) && !defined(WINDOWS32) else { struct passwd *pwent; char *userend = strchr (name + 1, '/'); if (userend != 0) *userend = '\0'; pwent = getpwnam (name + 1); if (pwent != 0) { if (userend == 0) return xstrdup (pwent->pw_dir); else return xstrdup (concat (3, pwent->pw_dir, "/", userend + 1)); } else if (userend != 0) *userend = '/'; } # endif /* !AMIGA && !WINDOWS32 */ #endif /* !VMS */ return 0; } /* Parse a string into a sequence of filenames represented as a chain of struct nameseq's and return that chain. Optionally expand the strings via glob(). The string is passed as STRINGP, the address of a string pointer. The string pointer is updated to point at the first character not parsed, which either is a null char or equals STOPCHAR. SIZE is how big to construct chain elements. This is useful if we want them actually to be other structures that have room for additional info. PREFIX, if non-null, is added to the beginning of each filename. FLAGS allows one or more of the following bitflags to be set: PARSEFS_NOSTRIP - Do no strip './'s off the beginning PARSEFS_NOAR - Do not check filenames for archive references PARSEFS_NOGLOB - Do not expand globbing characters PARSEFS_EXISTS - Only return globbed files that actually exist (cannot also set NOGLOB) PARSEFS_NOCACHE - Do not add filenames to the strcache (caller frees) */ void * parse_file_seq (char **stringp, unsigned int size, int stopmap, const char *prefix, int flags IF_WITH_ALLOC_CACHES_PARAM(struct alloccache *alloc_cache) ) { /* tmp points to tmpbuf after the prefix, if any. tp is the end of the buffer. */ static char *tmpbuf = NULL; int cachep = NONE_SET (flags, PARSEFS_NOCACHE); struct nameseq *new = 0; struct nameseq **newp = &new; #ifndef CONFIG_WITH_ALLOC_CACHES #define NEWELT(_n) do { \ const char *__n = (_n); \ *newp = xcalloc (size); \ (*newp)->name = (cachep ? strcache_add (__n) : xstrdup (__n)); \ newp = &(*newp)->next; \ } while(0) #else # define NEWELT(_n) do { \ const char *__n = (_n); \ *newp = alloccache_calloc (alloc_cache); \ (*newp)->name = (cachep ? strcache_add (__n) : xstrdup (__n)); \ newp = &(*newp)->next; \ } while(0) #endif char *p; glob_t gl; char *tp; /* Always stop on NUL. */ stopmap |= MAP_NUL; if (size < sizeof (struct nameseq)) size = sizeof (struct nameseq); if (NONE_SET (flags, PARSEFS_NOGLOB)) dir_setup_glob (&gl); /* Get enough temporary space to construct the largest possible target. */ { static int tmpbuf_len = 0; int l = strlen (*stringp) + 1; if (l > tmpbuf_len) { tmpbuf = xrealloc (tmpbuf, l); tmpbuf_len = l; } } tp = tmpbuf; /* Parse STRING. P will always point to the end of the parsed content. */ p = *stringp; while (1) { const char *name; const char **nlist = 0; char *tildep = 0; int globme = 1; #ifndef NO_ARCHIVES char *arname = 0; char *memname = 0; #endif char *s; int nlen; int i; /* Skip whitespace; at the end of the string or STOPCHAR we're done. */ NEXT_TOKEN (p); if (STOP_SET (*p, stopmap)) break; /* There are names left, so find the end of the next name. Throughout this iteration S points to the start. */ s = p; p = find_char_unquote (p, stopmap|MAP_VMSCOMMA|MAP_BLANK IF_WITH_VALUE_LENGTH_PARAM(0)); #ifdef VMS /* convert comma separated list to space separated */ if (p && *p == ',') *p =' '; #endif #ifdef _AMIGA if (p && STOP_SET (*p, stopmap & MAP_COLON) && !(ISSPACE (p[1]) || !p[1] || ISSPACE (p[-1]))) p = find_char_unquote (p+1, stopmap|MAP_VMSCOMMA|MAP_BLANK); #endif #ifdef HAVE_DOS_PATHS /* For DOS paths, skip a "C:\..." or a "C:/..." until we find the first colon which isn't followed by a slash or a backslash. Note that tokens separated by spaces should be treated as separate tokens since make doesn't allow path names with spaces */ if (stopmap | MAP_COLON) while (p != 0 && !ISSPACE (*p) && (p[1] == '\\' || p[1] == '/') && isalpha ((unsigned char)p[-1])) p = find_char_unquote (p + 1, stopmap|MAP_VMSCOMMA|MAP_BLANK IF_WITH_VALUE_LENGTH_PARAM(0)); #endif if (p == 0) p = s + strlen (s); /* Strip leading "this directory" references. */ if (NONE_SET (flags, PARSEFS_NOSTRIP)) #ifdef VMS /* Skip leading '[]'s. should only be one set or bug somwhere else */ if (p - s > 2 && s[0] == '[' && s[1] == ']') s += 2; /* Skip leading '<>'s. should only be one set or bug somwhere else */ if (p - s > 2 && s[0] == '<' && s[1] == '>') s += 2; #endif /* Skip leading './'s. */ while (p - s > 2 && s[0] == '.' && s[1] == '/') { /* Skip "./" and all following slashes. */ s += 2; while (*s == '/') ++s; } /* Extract the filename just found, and skip it. Set NAME to the string, and NLEN to its length. */ if (s == p) { /* The name was stripped to empty ("./"). */ #if defined(_AMIGA) /* PDS-- This cannot be right!! */ tp[0] = '\0'; nlen = 0; #else tp[0] = '.'; tp[1] = '/'; tp[2] = '\0'; nlen = 2; #endif } else { #ifdef VMS /* VMS filenames can have a ':' in them but they have to be '\'ed but we need * to remove this '\' before we can use the filename. * xstrdup called because S may be read-only string constant. */ char *n = tp; while (s < p) { if (s[0] == '\\' && s[1] == ':') ++s; *(n++) = *(s++); } n[0] = '\0'; nlen = strlen (tp); #else nlen = p - s; memcpy (tp, s, nlen); tp[nlen] = '\0'; #endif } /* At this point, TP points to the element and NLEN is its length. */ #ifndef NO_ARCHIVES /* If this is the start of an archive group that isn't complete, set up to add the archive prefix for future files. A file list like: "libf.a(x.o y.o z.o)" needs to be expanded as: "libf.a(x.o) libf.a(y.o) libf.a(z.o)" TP == TMP means we're not already in an archive group. Ignore something starting with '(', as that cannot actually be an archive-member reference (and treating it as such results in an empty file name, which causes much lossage). Also if it ends in ")" then it's a complete reference so we don't need to treat it specially. Finally, note that archive groups must end with ')' as the last character, so ensure there's some word ending like that before considering this an archive group. */ if (NONE_SET (flags, PARSEFS_NOAR) && tp == tmpbuf && tp[0] != '(' && tp[nlen-1] != ')') { char *n = strchr (tp, '('); if (n) { /* This looks like the first element in an open archive group. A valid group MUST have ')' as the last character. */ const char *e = p; do { const char *o = e; NEXT_TOKEN (e); /* Find the end of this word. We don't want to unquote and we don't care about quoting since we're looking for the last char in the word. */ while (! STOP_SET (*e, stopmap|MAP_BLANK|MAP_VMSCOMMA)) ++e; /* If we didn't move, we're done now. */ if (e == o) break; if (e[-1] == ')') { /* Found the end, so this is the first element in an open archive group. It looks like "lib(mem". Reset TP past the open paren. */ nlen -= (n + 1) - tp; tp = n + 1; /* We can stop looking now. */ break; } } while (*e != '\0'); /* If we have just "lib(", part of something like "lib( a b)", go to the next item. */ if (! nlen) continue; } } /* If we are inside an archive group, make sure it has an end. */ if (tp > tmpbuf) { if (tp[nlen-1] == ')') { /* This is the natural end; reset TP. */ tp = tmpbuf; /* This is just ")", something like "lib(a b )": skip it. */ if (nlen == 1) continue; } else { /* Not the end, so add a "fake" end. */ tp[nlen++] = ')'; tp[nlen] = '\0'; } } #endif /* If we're not globbing we're done: add it to the end of the chain. Go to the next item in the string. */ if (ANY_SET (flags, PARSEFS_NOGLOB)) { NEWELT (concat (2, prefix, tmpbuf)); continue; } /* If we get here we know we're doing glob expansion. TP is a string in tmpbuf. NLEN is no longer used. We may need to do more work: after this NAME will be set. */ name = tmpbuf; /* Expand tilde if applicable. */ if (tmpbuf[0] == '~') { tildep = tilde_expand (tmpbuf); if (tildep != 0) name = tildep; } #ifndef NO_ARCHIVES /* If NAME is an archive member reference replace it with the archive file name, and save the member name in MEMNAME. We will glob on the archive name and then reattach MEMNAME later. */ if (NONE_SET (flags, PARSEFS_NOAR) && ar_name (name)) { ar_parse_name (name, &arname, &memname); name = arname; } #endif /* !NO_ARCHIVES */ /* glob() is expensive: don't call it unless we need to. */ if (NONE_SET (flags, PARSEFS_EXISTS) && strpbrk (name, "?*[") == NULL) { globme = 0; i = 1; nlist = &name; } else switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl)) { case GLOB_NOSPACE: OUT_OF_MEM(); case 0: /* Success. */ i = gl.gl_pathc; nlist = (const char **)gl.gl_pathv; break; case GLOB_NOMATCH: /* If we want only existing items, skip this one. */ if (ANY_SET (flags, PARSEFS_EXISTS)) { i = 0; break; } /* FALLTHROUGH */ default: /* By default keep this name. */ i = 1; nlist = &name; break; } /* For each matched element, add it to the list. */ while (i-- > 0) #ifndef NO_ARCHIVES if (memname != 0) { /* Try to glob on MEMNAME within the archive. */ struct nameseq *found = ar_glob (nlist[i], memname, size); if (! found) /* No matches. Use MEMNAME as-is. */ NEWELT (concat (5, prefix, nlist[i], "(", memname, ")")); else { /* We got a chain of items. Attach them. */ if (*newp) (*newp)->next = found; else *newp = found; /* Find and set the new end. Massage names if necessary. */ while (1) { if (! cachep) found->name = xstrdup (concat (2, prefix, name)); else if (prefix) found->name = strcache_add (concat (2, prefix, name)); if (found->next == 0) break; found = found->next; } newp = &found->next; } } else #endif /* !NO_ARCHIVES */ NEWELT (concat (2, prefix, nlist[i])); if (globme) globfree (&gl); #ifndef NO_ARCHIVES free (arname); #endif free (tildep); } *stringp = p; return new; } kbuild-3608/src/kmk/debug.h0000664000175000017500000000445014670377413015535 0ustar locutuslocutus/* Debugging macros and interface. Copyright (C) 1999-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #define DB_NONE (0x000) #define DB_BASIC (0x001) #define DB_VERBOSE (0x002) #define DB_JOBS (0x004) #define DB_IMPLICIT (0x008) #define DB_MAKEFILES (0x100) #ifdef KMK # define DB_KMK (0x800) #endif #define DB_ALL (0xfff) extern int db_level; #ifdef KMK /* Some extended info for -j and .NOTPARALLEL tracking. */ extern unsigned int makelevel; extern unsigned int job_slots; extern unsigned int job_slots_used; #define DB_HDR() do { printf ("[%u:%u/%u]", makelevel, job_slots_used, job_slots); } while (0) #define ISDB(_l) ((_l)&db_level) #define DBS(_l,_x) do{ if(ISDB(_l)) {DB_HDR(); \ print_spaces (depth); \ printf _x; fflush (stdout);} }while(0) #define DBF(_l,_x) do{ if(ISDB(_l)) {DB_HDR(); \ print_spaces (depth); \ printf (_x, file->name); \ fflush (stdout);} }while(0) #define DB(_l,_x) do{ if(ISDB(_l)) {DB_HDR(); printf _x; fflush (stdout);} }while(0) #else /* !KMK */ #define ISDB(_l) ((_l)&db_level) #define DBS(_l,_x) do{ if(ISDB(_l)) {print_spaces (depth); \ printf _x; fflush (stdout);} }while(0) #define DBF(_l,_x) do{ if(ISDB(_l)) {print_spaces (depth); \ printf (_x, file->name); \ fflush (stdout);} }while(0) #define DB(_l,_x) do{ if(ISDB(_l)) {printf _x; fflush (stdout);} }while(0) #endif /* !KMK */ kbuild-3608/src/kmk/alloca.c0000664000175000017500000003362714670377414015706 0ustar locutuslocutus/* alloca.c -- allocate automatically reclaimed memory (Mostly) portable public-domain implementation -- D A Gwyn This implementation of the PWB library alloca function, which is used to allocate space off the run-time stack so that it is automatically reclaimed upon procedure exit, was inspired by discussions with J. Q. Johnson of Cornell. J.Otto Tennant contributed the Cray support. There are some preprocessor constants that can be defined when compiling for your specific system, for improved efficiency; however, the defaults should be okay. The general concept of this implementation is to keep track of all alloca-allocated blocks, and reclaim any that are found to be deeper in the stack than the current invocation. This heuristic does not reclaim storage as soon as it becomes invalid, but it will do so eventually. As a special case, alloca(0) reclaims storage without allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef emacs #include "blockinput.h" #endif /* If compiling with GCC 2, this file's not needed. */ #if !defined (__GNUC__) || __GNUC__ < 2 /* If someone has defined alloca as a macro, there must be some other way alloca is supposed to work. */ #ifndef alloca #ifdef emacs #ifdef static /* actually, only want this if static is defined as "" -- this is for usg, in which emacs must undefine static in order to make unexec workable */ #ifndef STACK_DIRECTION you lose -- must know STACK_DIRECTION at compile-time #endif /* STACK_DIRECTION undefined */ #endif /* static */ #endif /* emacs */ /* If your stack is a linked list of frames, you have to provide an "address metric" ADDRESS_FUNCTION macro. */ #if defined (CRAY) && defined (CRAY_STACKSEG_END) long i00afunc (); #define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) #else #define ADDRESS_FUNCTION(arg) &(arg) #endif #if __STDC__ typedef void *pointer; #else typedef char *pointer; #endif #ifndef NULL #define NULL 0 #endif /* Different portions of Emacs need to call different versions of malloc. The Emacs executable needs alloca to call xmalloc, because ordinary malloc isn't protected from input signals. On the other hand, the utilities in lib-src need alloca to call malloc; some of them are very simple, and don't have an xmalloc routine. Non-Emacs programs expect this to call use xmalloc. Callers below should use malloc. */ #ifndef emacs #define malloc xmalloc #endif extern pointer malloc (); /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #ifndef STACK_DIRECTION #define STACK_DIRECTION 0 /* Direction unknown. */ #endif #if STACK_DIRECTION != 0 #define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ #else /* STACK_DIRECTION == 0; need run-time code. */ static int stack_dir; /* 1 or -1 once known. */ #define STACK_DIR stack_dir static void find_stack_direction (void) { static char *addr = NULL; /* Address of first 'dummy', once known. */ auto char dummy; /* To get stack address. */ if (addr == NULL) { /* Initial entry. */ addr = ADDRESS_FUNCTION (dummy); find_stack_direction (); /* Recurse once. */ } else { /* Second entry. */ if (ADDRESS_FUNCTION (dummy) > addr) stack_dir = 1; /* Stack grew upward. */ else stack_dir = -1; /* Stack grew downward. */ } } #endif /* STACK_DIRECTION == 0 */ /* An "alloca header" is used to: (a) chain together all alloca'ed blocks; (b) keep track of stack depth. It is very important that sizeof(header) agree with malloc alignment chunk size. The following default should work okay. */ #ifndef ALIGN_SIZE #define ALIGN_SIZE sizeof(double) #endif typedef union hdr { char align[ALIGN_SIZE]; /* To force sizeof(header). */ struct { union hdr *next; /* For chaining headers. */ char *deep; /* For stack depth measure. */ } h; } header; static header *last_alloca_header = NULL; /* -> last alloca header. */ /* Return a pointer to at least SIZE bytes of storage, which will be automatically reclaimed upon exit from the procedure that called alloca. Originally, this space was supposed to be taken from the current stack frame of the caller, but that method cannot be made to work for some implementations of C, for example under Gould's UTX/32. */ pointer alloca (unsigned size) { auto char probe; /* Probes stack depth: */ register char *depth = ADDRESS_FUNCTION (probe); #if STACK_DIRECTION == 0 if (STACK_DIR == 0) /* Unknown growth direction. */ find_stack_direction (); #endif /* Reclaim garbage, defined as all alloca'd storage that was allocated from deeper in the stack than currently. */ { register header *hp; /* Traverses linked list. */ #ifdef emacs BLOCK_INPUT; #endif for (hp = last_alloca_header; hp != NULL;) if ((STACK_DIR > 0 && hp->h.deep > depth) || (STACK_DIR < 0 && hp->h.deep < depth)) { register header *np = hp->h.next; free ((pointer) hp); /* Collect garbage. */ hp = np; /* -> next header. */ } else break; /* Rest are not deeper. */ last_alloca_header = hp; /* -> last valid storage. */ #ifdef emacs UNBLOCK_INPUT; #endif } if (size == 0) return NULL; /* No allocation required. */ /* Allocate combined header + user data storage. */ { register pointer new = malloc (sizeof (header) + size); /* Address of header. */ if (new == 0) abort(); ((header *) new)->h.next = last_alloca_header; ((header *) new)->h.deep = depth; last_alloca_header = (header *) new; /* User storage begins just after header. */ return (pointer) ((char *) new + sizeof (header)); } } #if defined (CRAY) && defined (CRAY_STACKSEG_END) #ifdef DEBUG_I00AFUNC #include #endif #ifndef CRAY_STACK #define CRAY_STACK #ifndef CRAY2 /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ struct stack_control_header { long shgrow:32; /* Number of times stack has grown. */ long shaseg:32; /* Size of increments to stack. */ long shhwm:32; /* High water mark of stack. */ long shsize:32; /* Current size of stack (all segments). */ }; /* The stack segment linkage control information occurs at the high-address end of a stack segment. (The stack grows from low addresses to high addresses.) The initial part of the stack segment linkage control information is 0200 (octal) words. This provides for register storage for the routine which overflows the stack. */ struct stack_segment_linkage { long ss[0200]; /* 0200 overflow words. */ long sssize:32; /* Number of words in this segment. */ long ssbase:32; /* Offset to stack base. */ long:32; long sspseg:32; /* Offset to linkage control of previous segment of stack. */ long:32; long sstcpt:32; /* Pointer to task common address block. */ long sscsnm; /* Private control structure number for microtasking. */ long ssusr1; /* Reserved for user. */ long ssusr2; /* Reserved for user. */ long sstpid; /* Process ID for pid based multi-tasking. */ long ssgvup; /* Pointer to multitasking thread giveup. */ long sscray[7]; /* Reserved for Cray Research. */ long ssa0; long ssa1; long ssa2; long ssa3; long ssa4; long ssa5; long ssa6; long ssa7; long sss0; long sss1; long sss2; long sss3; long sss4; long sss5; long sss6; long sss7; }; #else /* CRAY2 */ /* The following structure defines the vector of words returned by the STKSTAT library routine. */ struct stk_stat { long now; /* Current total stack size. */ long maxc; /* Amount of contiguous space which would be required to satisfy the maximum stack demand to date. */ long high_water; /* Stack high-water mark. */ long overflows; /* Number of stack overflow ($STKOFEN) calls. */ long hits; /* Number of internal buffer hits. */ long extends; /* Number of block extensions. */ long stko_mallocs; /* Block allocations by $STKOFEN. */ long underflows; /* Number of stack underflow calls ($STKRETN). */ long stko_free; /* Number of deallocations by $STKRETN. */ long stkm_free; /* Number of deallocations by $STKMRET. */ long segments; /* Current number of stack segments. */ long maxs; /* Maximum number of stack segments so far. */ long pad_size; /* Stack pad size. */ long current_address; /* Current stack segment address. */ long current_size; /* Current stack segment size. This number is actually corrupted by STKSTAT to include the fifteen word trailer area. */ long initial_address; /* Address of initial segment. */ long initial_size; /* Size of initial segment. */ }; /* The following structure describes the data structure which trails any stack segment. I think that the description in 'asdef' is out of date. I only describe the parts that I am sure about. */ struct stk_trailer { long this_address; /* Address of this block. */ long this_size; /* Size of this block (does not include this trailer). */ long unknown2; long unknown3; long link; /* Address of trailer block of previous segment. */ long unknown5; long unknown6; long unknown7; long unknown8; long unknown9; long unknown10; long unknown11; long unknown12; long unknown13; long unknown14; }; #endif /* CRAY2 */ #endif /* not CRAY_STACK */ #ifdef CRAY2 /* Determine a "stack measure" for an arbitrary ADDRESS. I doubt that "lint" will like this much. */ static long i00afunc (long *address) { struct stk_stat status; struct stk_trailer *trailer; long *block, size; long result = 0; /* We want to iterate through all of the segments. The first step is to get the stack status structure. We could do this more quickly and more directly, perhaps, by referencing the $LM00 common block, but I know that this works. */ STKSTAT (&status); /* Set up the iteration. */ trailer = (struct stk_trailer *) (status.current_address + status.current_size - 15); /* There must be at least one stack segment. Therefore it is a fatal error if "trailer" is null. */ if (trailer == 0) abort (); /* Discard segments that do not contain our argument address. */ while (trailer != 0) { block = (long *) trailer->this_address; size = trailer->this_size; if (block == 0 || size == 0) abort (); trailer = (struct stk_trailer *) trailer->link; if ((block <= address) && (address < (block + size))) break; } /* Set the result to the offset in this segment and add the sizes of all predecessor segments. */ result = address - block; if (trailer == 0) { return result; } do { if (trailer->this_size <= 0) abort (); result += trailer->this_size; trailer = (struct stk_trailer *) trailer->link; } while (trailer != 0); /* We are done. Note that if you present a bogus address (one not in any segment), you will get a different number back, formed from subtracting the address of the first block. This is probably not what you want. */ return (result); } #else /* not CRAY2 */ /* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. Determine the number of the cell within the stack, given the address of the cell. The purpose of this routine is to linearize, in some sense, stack addresses for alloca. */ static long i00afunc (long address) { long stkl = 0; long size, pseg, this_segment, stack; long result = 0; struct stack_segment_linkage *ssptr; /* Register B67 contains the address of the end of the current stack segment. If you (as a subprogram) store your registers on the stack and find that you are past the contents of B67, you have overflowed the segment. B67 also points to the stack segment linkage control area, which is what we are really interested in. */ stkl = CRAY_STACKSEG_END (); ssptr = (struct stack_segment_linkage *) stkl; /* If one subtracts 'size' from the end of the segment, one has the address of the first word of the segment. If this is not the first segment, 'pseg' will be nonzero. */ pseg = ssptr->sspseg; size = ssptr->sssize; this_segment = stkl - size; /* It is possible that calling this routine itself caused a stack overflow. Discard stack segments which do not contain the target address. */ while (!(this_segment <= address && address <= stkl)) { #ifdef DEBUG_I00AFUNC fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); #endif if (pseg == 0) break; stkl = stkl - pseg; ssptr = (struct stack_segment_linkage *) stkl; size = ssptr->sssize; pseg = ssptr->sspseg; this_segment = stkl - size; } result = address - this_segment; /* If you subtract pseg from the current end of the stack, you get the address of the previous stack segment's end. This seems a little convoluted to me, but I'll bet you save a cycle somewhere. */ while (pseg != 0) { #ifdef DEBUG_I00AFUNC fprintf (stderr, "%011o %011o\n", pseg, size); #endif stkl = stkl - pseg; ssptr = (struct stack_segment_linkage *) stkl; size = ssptr->sssize; pseg = ssptr->sspseg; result += size; } return (result); } #endif /* not CRAY2 */ #endif /* CRAY */ #endif /* no alloca */ #endif /* not GCC version 2 */ kbuild-3608/src/kmk/config.h.darwin0000664000175000017500000003316714670377413017206 0ustar locutuslocutus/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if the `closedir' function returns void instead of `int'. */ /* #undef CLOSEDIR_VOID */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ /* Define to 1 if using `getloadavg.c'. */ /* #undef C_GETLOADAVG */ /* Define to 1 for DGUX with . */ /* #undef DGUX */ /* Use high resolution file timestamps if nonzero. */ #define FILE_TIMESTAMP_HI_RES 1 /* Define to 1 if the `getloadavg' function needs to be run setuid or setgid. */ /* #undef GETLOADAVG_PRIVILEGED */ /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 /* Define to 1 if you have and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define to 1 if you have the `atexit' function. */ #define HAVE_ATEXIT 1 /* Use case insensitive file names */ /* #undef HAVE_CASE_INSENSITIVE_FS */ /* Define to 1 if you have the clock_gettime function. */ #define HAVE_CLOCK_GETTIME 1 /* Define to 1 if you have the declaration of `bsd_signal', and to 0 if you don't. */ #define HAVE_DECL_BSD_SIGNAL 1 /* Define to 1 if you have the declaration of `dlerror', and to 0 if you don't. */ #define HAVE_DECL_DLERROR 1 /* Define to 1 if you have the declaration of `dlopen', and to 0 if you don't. */ #define HAVE_DECL_DLOPEN 1 /* Define to 1 if you have the declaration of `dlsym', and to 0 if you don't. */ #define HAVE_DECL_DLSYM 1 /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ #define HAVE_DECL_SYS_SIGLIST 1 /* Define to 1 if you have the declaration of `_sys_siglist', and to 0 if you don't. */ #define HAVE_DECL__SYS_SIGLIST 0 /* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you don't. */ #define HAVE_DECL___SYS_SIGLIST 0 /* Define to 1 if you have the header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 /* Use platform specific coding */ /* #undef HAVE_DOS_PATHS */ /* Define to 1 if you have the `dup' function. */ #define HAVE_DUP 1 /* Define to 1 if you have the `dup2' function. */ #define HAVE_DUP2 1 /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `fdopen' function. */ #define HAVE_FDOPEN 1 /* Define to 1 if you have the `fileno' function. */ #define HAVE_FILENO 1 /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 /* Define to 1 if you have the `getcwd' function. */ #define HAVE_GETCWD 1 /* Define to 1 if you have the `getgroups' function. */ #define HAVE_GETGROUPS 1 /* Define to 1 if you have the `gethostbyname' function. */ /* #undef HAVE_GETHOSTBYNAME */ /* Define to 1 if you have the `gethostname' function. */ /* #undef HAVE_GETHOSTNAME */ /* Define to 1 if you have the `getloadavg' function. */ #define HAVE_GETLOADAVG 1 /* Define to 1 if you have the `getrlimit' function. */ #define HAVE_GETRLIMIT 1 /* Define to 1 if you have a standard gettimeofday function */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `isatty' function. */ #define HAVE_ISATTY 1 /* Define to 1 if you have the `dgc' library (-ldgc). */ /* #undef HAVE_LIBDGC */ /* Define to 1 if you have the `kstat' library (-lkstat). */ /* #undef HAVE_LIBKSTAT */ /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LOCALE_H 1 /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_MACH_MACH_H */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `mkstemp' function. */ #define HAVE_MKSTEMP 1 /* Define to 1 if you have the `mktemp' function. */ #define HAVE_MKTEMP 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_NLIST_H */ /* Define to 1 if you have the `pipe' function. */ #define HAVE_PIPE 1 #if 0 /* before 10.12.0 pselect is a useland implementation, which is insufficient for our purposes. */ /* Define to 1 if you have the `pselect' function. */ # define HAVE_PSELECT 1 #else # undef HAVE_PSELECT #endif /* Define to 1 if you have the `pstat_getdynamic' function. */ /* #undef HAVE_PSTAT_GETDYNAMIC */ /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 /* Define to 1 if defines the SA_RESTART constant. */ #define HAVE_SA_RESTART 1 /* Define to 1 if you have the `setegid' function. */ #define HAVE_SETEGID 1 /* Define to 1 if you have the `seteuid' function. */ #define HAVE_SETEUID 1 /* Define to 1 if you have the `setlinebuf' function. */ #define HAVE_SETLINEBUF 1 /* Define to 1 if you have the `setlocale' function. */ /* #undef HAVE_SETLOCALE */ /* Define to 1 if you have the `setregid' function. */ #define HAVE_SETREGID 1 /* Define to 1 if you have the `setreuid' function. */ #define HAVE_SETREUID 1 /* Define to 1 if you have the `setrlimit' function. */ #define HAVE_SETRLIMIT 1 /* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the `sigsetmask' function. */ #define HAVE_SIGSETMASK 1 /* Define to 1 if you have the `socket' function. */ /* #undef HAVE_SOCKET */ /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strcasecmp' function. */ #define HAVE_STRCASECMP 1 /* Define to 1 if you have the `strcmpi' function. */ /* #undef HAVE_STRCMPI */ /* Define to 1 if you have the `strcoll' function and it is properly defined. */ #define HAVE_STRCOLL 1 /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the `stricmp' function. */ /* #undef HAVE_STRICMP */ /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strncasecmp' function. */ #define HAVE_STRNCASECMP 1 /* Define to 1 if you have the `strncmpi' function. */ /* #undef HAVE_STRNCMPI */ /* Define to 1 if you have the `strndup' function. */ /* #define HAVE_STRNDUP 1 - not in snow leopard */ /* Define to 1 if you have the `strnicmp' function. */ /* #undef HAVE_STRNICMP */ /* Define to 1 if you have the `strsignal' function. */ #define HAVE_STRSIGNAL 1 /* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */ /* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIMEB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the `ttyname' function. */ #define HAVE_TTYNAME 1 /* Define to 1 if the system has the type `uintmax_t'. */ #define HAVE_UINTMAX_T 1 /* Define to 1 if you have the 'union wait' type in . */ /* #undef HAVE_UNION_WAIT */ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if the system has the type `unsigned long long int'. */ #define HAVE_UNSIGNED_LONG_LONG_INT 1 /* Define to 1 if you have the `vfork' function. */ #define HAVE_VFORK 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_VFORK_H */ /* Define to 1 if you have the `wait3' function. */ #define HAVE_WAIT3 1 /* Define to 1 if you have the `waitpid' function. */ #define HAVE_WAITPID 1 /* Define to 1 if `fork' works. */ #define HAVE_WORKING_FORK 1 /* Define to 1 if `vfork' works. */ #define HAVE_WORKING_VFORK 1 /* Build host information. */ #define MAKE_HOST "x86_64-apple-darwin16.7.0" /* Define to 1 to enable job server support in GNU make. */ #define MAKE_JOBSERVER 1 /* Define to 1 to enable 'load' support in GNU make. */ /* #undef MAKE_LOAD */ /* Define to 1 to enable symbolic link timestamp checking. */ #define MAKE_SYMLINKS 1 /* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend on `HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* #undef NLIST_NAME_UNION */ /* Define to 1 if struct nlist.n_name is a pointer rather than an array. */ /* #undef NLIST_STRUCT */ /* Name of package */ #define PACKAGE "make" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "bug-make@gnu.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "GNU make" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "GNU make 4.2.1" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "make" /* Define to the home page for this package. */ #define PACKAGE_URL "http://www.gnu.org/software/make/" /* Define to the version of this package. */ #define PACKAGE_VERSION "4.2.1" /* Define to the character that separates directories in PATH. */ #define PATH_SEPARATOR_CHAR ':' /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void /* Define to the name of the SCCS 'get' command. */ #define SCCS_GET "get" /* Define to 1 if the SCCS 'get' command understands the '-G' option. */ /* #undef SCCS_GET_MINUS_G */ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define to 1 if the `S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if struct stat contains a nanoseconds field */ #define ST_ATIM_NSEC st_atimespec.tv_nsec /* Define if struct stat contains a nanoseconds field */ #define ST_MTIM_NSEC st_mtimespec.tv_nsec /* Define to 1 on System V Release 4. */ /* #undef SVR4 */ /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 /* Define to 1 for Encore UMAX. */ /* #undef UMAX */ /* Define to 1 for Encore UMAX 4.3 that has instead of . */ /* #undef UMAX4_3 */ /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # define _ALL_SOURCE 1 #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # define _POSIX_PTHREAD_SEMANTICS 1 #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE 1 #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # define __EXTENSIONS__ 1 #endif /* Version number of package */ #define VERSION "4.2.1" /* Use platform specific coding */ /* #undef WINDOWS32 */ /* Define if using the dmalloc debugging malloc package */ /* #undef WITH_DMALLOC */ /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define to 1 if on MINIX. */ /* #undef _MINIX */ /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `int' if doesn't define. */ /* #undef gid_t */ /* Define to `long int' if does not define. */ /* #undef off_t */ /* Define to `int' if does not define. */ /* #undef pid_t */ /* Define to `unsigned int' if does not define. */ /* #undef size_t */ /* Define to `int' if does not define. */ /* #undef ssize_t */ /* Define to `int' if doesn't define. */ /* #undef uid_t */ /* Define to the widest unsigned integer type if and do not define. */ /* #undef uintmax_t */ /* Define as `fork' if `vfork' does not work. */ /* #undef vfork */ #include "inlined_memchr.h" kbuild-3608/src/kmk/gnumake.h0000664000175000017500000000554014670377414016100 0ustar locutuslocutus/* External interfaces usable by dynamic objects loaded into GNU Make. --THIS API IS A "TECHNOLOGY PREVIEW" ONLY. IT IS NOT A STABLE INTERFACE-- Copyright (C) 2013-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #ifndef _GNUMAKE_H_ #define _GNUMAKE_H_ /* Specify the location of elements read from makefiles. */ typedef struct { const char *filenm; unsigned long lineno; } gmk_floc; typedef char *(*gmk_func_ptr)(const char *nm, unsigned int argc, char **argv); #ifdef _WIN32 # ifdef GMK_BUILDING_MAKE # define GMK_EXPORT __declspec(dllexport) # else # define GMK_EXPORT __declspec(dllimport) # endif #else # define GMK_EXPORT #endif /* Free memory returned by the gmk_expand() function. */ GMK_EXPORT void gmk_free (char *str); /* Allocate memory in GNU make's context. */ GMK_EXPORT char *gmk_alloc (unsigned int len); /* Run $(eval ...) on the provided string BUFFER. */ GMK_EXPORT void gmk_eval (const char *buffer, const gmk_floc *floc); /* Run GNU make expansion on the provided string STR. Returns an allocated buffer that the caller must free with gmk_free(). */ GMK_EXPORT char *gmk_expand (const char *str); /* Register a new GNU make function NAME (maximum of 255 chars long). When the function is expanded in the makefile, FUNC will be invoked with the appropriate arguments. The return value of FUNC must be either NULL, in which case it expands to the empty string, or a pointer to the result of the expansion in a string created by gmk_alloc(). GNU make will free the memory when it's done. MIN_ARGS is the minimum number of arguments the function requires. MAX_ARGS is the maximum number of arguments (or 0 if there's no maximum). MIN_ARGS and MAX_ARGS may not exceed 255. The FLAGS value may be GMK_FUNC_DEFAULT, or one or more of the following flags OR'd together: GMK_FUNC_NOEXPAND: the arguments to the function will be not be expanded before FUNC is called. */ GMK_EXPORT void gmk_add_function (const char *name, gmk_func_ptr func, unsigned int min_args, unsigned int max_args, unsigned int flags); #define GMK_FUNC_DEFAULT 0x00 #define GMK_FUNC_NOEXPAND 0x01 #endif /* _GNUMAKE_H_ */ kbuild-3608/src/kmk/kbuild.c0000664000175000017500000032213214670377412015713 0ustar locutuslocutus/* $Id: kbuild.c 3425 2020-08-21 12:45:06Z bird $ */ /** @file * kBuild specific make functionality. */ /* * Copyright (c) 2006-2010 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ /* No GNU coding style here! */ /******************************************************************************* * Header Files * *******************************************************************************/ #define NO_MEMCOPY_HACK #include "makeint.h" #include "filedef.h" #include "variable.h" #include "dep.h" #include "debug.h" #ifdef WINDOWS32 # include "pathstuff.h" # include #endif #if defined(__APPLE__) # include #endif #if defined(__FreeBSD__) # include # include #endif #include "kbuild.h" #include "k/kDefs.h" #include /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** Helper for passing a string constant to kbuild_get_variable_n. */ #define ST(strconst) strconst, sizeof(strconst) - 1 #if 1 # define my_memcpy(dst, src, len) \ do { \ if (len > 8) \ memcpy(dst, src, len); \ else \ switch (len) \ { \ case 8: dst[7] = src[7]; /* fall thru */ \ case 7: dst[6] = src[6]; /* fall thru */ \ case 6: dst[5] = src[5]; /* fall thru */ \ case 5: dst[4] = src[4]; /* fall thru */ \ case 4: dst[3] = src[3]; /* fall thru */ \ case 3: dst[2] = src[2]; /* fall thru */ \ case 2: dst[1] = src[1]; /* fall thru */ \ case 1: dst[0] = src[0]; /* fall thru */ \ case 0: break; \ } \ } while (0) #elif defined(__GNUC__) # define my_memcpy __builtin_memcpy #elif defined(_MSC_VER) # pragma instrinic(memcpy) # define my_memcpy memcpy #endif /******************************************************************************* * Global Variables * *******************************************************************************/ /** The argv[0] passed to main. */ static const char *g_pszExeName; /** The initial working directory. */ static char *g_pszInitialCwd; /** * Initialize kBuild stuff. * * @param argc Number of arguments to main(). * @param argv The main() argument vector. */ void init_kbuild(int argc, char **argv) { int rc; PATH_VAR(szTmp); /* * Get the initial cwd for use in my_abspath. */ #ifdef WINDOWS32 if (getcwd_fs(szTmp, GET_PATH_MAX) != 0) #else if (getcwd(szTmp, GET_PATH_MAX) != 0) #endif g_pszInitialCwd = xstrdup(szTmp); else O(fatal, NILF, _("getcwd failed")); /* * Determin the executable name. */ rc = -1; #if defined(__APPLE__) { const char *pszImageName = _dyld_get_image_name(0); if (pszImageName) { size_t cchImageName = strlen(pszImageName); if (cchImageName < GET_PATH_MAX) { memcpy(szTmp, pszImageName, cchImageName + 1); rc = 0; } } } #elif defined(__FreeBSD__) rc = readlink("/proc/curproc/file", szTmp, GET_PATH_MAX - 1); if (rc < 0 || rc == GET_PATH_MAX - 1) { rc = -1; # if 0 /* doesn't work because l_name isn't always absolute, it's just argv0 from exec or something. */ /* /proc is optional, try rtdl. */ void *hExe = dlopen(NULL, 0); rc = -1; if (hExe) { struct link_map const *pLinkMap = 0; if (dlinfo(hExe, RTLD_DI_LINKMAP, &pLinkMap) == 0) { const char *pszImageName = pLinkMap->l_name; size_t cchImageName = strlen(pszImageName); if (cchImageName < GET_PATH_MAX) { memcpy(szTmp, pszImageName, cchImageName + 1); rc = 0; } } } # endif } else szTmp[rc] = '\0'; #elif defined(__gnu_linux__) || defined(__linux__) rc = readlink("/proc/self/exe", szTmp, GET_PATH_MAX - 1); if (rc < 0 || rc == GET_PATH_MAX - 1) rc = -1; else szTmp[rc] = '\0'; #elif defined(__OS2__) _execname(szTmp, GET_PATH_MAX); rc = 0; #elif defined(__sun__) { char szTmp2[64]; snprintf(szTmp2, sizeof(szTmp2), "/proc/%ld/path/a.out", (long)getpid()); rc = readlink(szTmp2, szTmp, GET_PATH_MAX - 1); if (rc < 0 || rc == GET_PATH_MAX - 1) rc = -1; else szTmp[rc] = '\0'; } #elif defined(WINDOWS32) if (GetModuleFileName(GetModuleHandle(NULL), szTmp, GET_PATH_MAX)) rc = 0; #endif #if !defined(__OS2__) && !defined(WINDOWS32) /* fallback, try use the path to locate the binary. */ if ( rc < 0 && access(argv[0], X_OK)) { size_t cchArgv0 = strlen(argv[0]); const char *pszPath = getenv("PATH"); char *pszCopy = xstrdup(pszPath ? pszPath : "."); char *psz = pszCopy; while (*psz) { size_t cch; char *pszEnd = strchr(psz, PATH_SEPARATOR_CHAR); if (!pszEnd) pszEnd = strchr(psz, '\0'); cch = pszEnd - psz; if (cch + cchArgv0 + 2 <= GET_PATH_MAX) { memcpy(szTmp, psz, cch); szTmp[cch] = '/'; memcpy(&szTmp[cch + 1], argv[0], cchArgv0 + 1); if (!access(szTmp, X_OK)) { rc = 0; break; } } /* next */ psz = pszEnd; while (*psz == PATH_SEPARATOR_CHAR) psz++; } free(pszCopy); } #endif if (rc < 0) g_pszExeName = argv[0]; else g_pszExeName = xstrdup(szTmp); (void)argc; } /** * Wrapper that ensures correct starting_directory. */ static char *my_abspath(const char *pszIn, char *pszOut) { char *pszSaved, *pszRet; pszSaved = starting_directory; starting_directory = g_pszInitialCwd; pszRet = abspath(pszIn, pszOut); starting_directory = pszSaved; return pszRet; } /** * Determin the KBUILD_PATH value. * * @returns Pointer to static a buffer containing the value (consider it read-only). */ const char *get_kbuild_path(void) { static const char *s_pszPath = NULL; if (!s_pszPath) { PATH_VAR(szTmpPath); const char *pszEnvVar = getenv("KBUILD_PATH"); if ( !pszEnvVar || !my_abspath(pszEnvVar, szTmpPath)) { pszEnvVar = getenv("PATH_KBUILD"); if ( !pszEnvVar || !my_abspath(pszEnvVar, szTmpPath)) { #ifdef KBUILD_PATH return s_pszPath = KBUILD_PATH; #else /* $(abspath $(KBUILD_BIN_PATH)/../..)*/ size_t cch = strlen(get_kbuild_bin_path()); char *pszTmp2 = alloca(cch + sizeof("/../..")); strcat(strcpy(pszTmp2, get_kbuild_bin_path()), "/../.."); if (!my_abspath(pszTmp2, szTmpPath)) O(fatal, NILF, _("failed to determin KBUILD_PATH")); #endif } } s_pszPath = xstrdup(szTmpPath); } return s_pszPath; } /** * Determin the KBUILD_BIN_PATH value. * * @returns Pointer to static a buffer containing the value (consider it read-only). */ const char *get_kbuild_bin_path(void) { static const char *s_pszPath = NULL; if (!s_pszPath) { PATH_VAR(szTmpPath); const char *pszEnvVar = getenv("KBUILD_BIN_PATH"); if ( !pszEnvVar || !my_abspath(pszEnvVar, szTmpPath)) { pszEnvVar = getenv("PATH_KBUILD_BIN"); if ( !pszEnvVar || !my_abspath(pszEnvVar, szTmpPath)) { #ifdef KBUILD_PATH return s_pszPath = KBUILD_BIN_PATH; #else /* $(abspath $(dir $(ARGV0)).) */ size_t cch = strlen(g_pszExeName); char *pszTmp2 = alloca(cch + sizeof(".")); char *pszSep = pszTmp2 + cch - 1; memcpy(pszTmp2, g_pszExeName, cch); # ifdef HAVE_DOS_PATHS while (pszSep >= pszTmp2 && *pszSep != '/' && *pszSep != '\\' && *pszSep != ':') # else while (pszSep >= pszTmp2 && *pszSep != '/') # endif pszSep--; if (pszSep >= pszTmp2) strcpy(pszSep + 1, "."); else strcpy(pszTmp2, "."); if (!my_abspath(pszTmp2, szTmpPath)) OSS(fatal, NILF, _("failed to determin KBUILD_BIN_PATH (pszTmp2=%s szTmpPath=%s)"), pszTmp2, szTmpPath); #endif /* !KBUILD_PATH */ } } s_pszPath = xstrdup(szTmpPath); } return s_pszPath; } /** * Determin the location of default kBuild shell. * * @returns Pointer to static a buffer containing the location (consider it read-only). */ const char *get_default_kbuild_shell(void) { static char *s_pszDefaultShell = NULL; if (!s_pszDefaultShell) { #if defined(__OS2__) || defined(_WIN32) || defined(WINDOWS32) static const char s_szShellName[] = "/kmk_ash.exe"; #else static const char s_szShellName[] = "/kmk_ash"; #endif const char *pszBin = get_kbuild_bin_path(); size_t cchBin = strlen(pszBin); s_pszDefaultShell = xmalloc(cchBin + sizeof(s_szShellName)); memcpy(s_pszDefaultShell, pszBin, cchBin); memcpy(&s_pszDefaultShell[cchBin], s_szShellName, sizeof(s_szShellName)); } return s_pszDefaultShell; } #ifdef KMK_HELPERS /** * Applies the specified default path to any relative paths in *ppsz. * * @param pDefPath The default path. * @param ppsz Pointer to the string pointer. If we expand anything, *ppsz * will be replaced and the caller is responsible for calling free() on it. * @param pcch IN: *pcch contains the current string length. * OUT: *pcch contains the new string length. * @param pcchAlloc *pcchAlloc contains the length allocated for the string. Can be NULL. * @param fCanFree Whether *ppsz should be freed when we replace it. */ static void kbuild_apply_defpath(struct variable *pDefPath, char **ppsz, unsigned int *pcch, unsigned int *pcchAlloc, int fCanFree) { unsigned int cchInCur; unsigned int cchMaxRelative = 0; const char *pszInCur; /* * The first pass, count the relative paths. */ const char *pszIterator = *ppsz; const char * const pszEos = pszIterator + *pcch; unsigned int cRelativePaths = 0; assert(*pszEos == '\0'); while ((pszInCur = find_next_file_token(&pszIterator, pszEos, &cchInCur)) != NULL) { /* is relative? */ #ifdef HAVE_DOS_PATHS if (pszInCur[0] != '/' && pszInCur[0] != '\\' && (cchInCur < 2 || pszInCur[1] != ':')) #else if (pszInCur[0] != '/') #endif { cRelativePaths++; if (cchInCur > cchMaxRelative) cchMaxRelative = cchInCur; } } /* * The second pass construct the new string. */ if (cRelativePaths) { size_t const cchAbsPathBuf = MAX(GET_PATH_MAX, pDefPath->value_length + cchInCur + 1 + 16); char *pszAbsPathOut = (char *)alloca(cchAbsPathBuf); char *pszAbsPathIn = (char *)alloca(cchAbsPathBuf); size_t cchAbsDefPath; size_t cchOut; char *pszOut; char *pszOutCur; const char *pszInNextCopy = *ppsz; /* make defpath absolute and have a trailing slash first. */ if (abspath(pDefPath->value, pszAbsPathIn) == NULL) memcpy(pszAbsPathIn, pDefPath->value, pDefPath->value_length); cchAbsDefPath = strlen(pszAbsPathIn); #ifdef HAVE_DOS_PATHS if (pszAbsPathIn[cchAbsDefPath - 1] != '/' && pszAbsPathIn[cchAbsDefPath - 1] != '\\') #else if (pszAbsPathIn[cchAbsDefPath - 1] != '/') #endif pszAbsPathIn[cchAbsDefPath++] = '/'; cchOut = *pcch + cRelativePaths * cchAbsDefPath + 1; pszOutCur = pszOut = xmalloc(cchOut); cRelativePaths = 0; pszIterator = *ppsz; while ((pszInCur = find_next_file_token(&pszIterator, pszEos, &cchInCur))) { /* is relative? */ #ifdef HAVE_DOS_PATHS if (pszInCur[0] != '/' && pszInCur[0] != '\\' && (cchInCur < 2 || pszInCur[1] != ':')) #else if (pszInCur[0] != '/') #endif { const char *pszToCopy; size_t cchToCopy; /* Create the abspath input. */ memcpy(&pszAbsPathIn[cchAbsDefPath], pszInCur, cchInCur); pszAbsPathIn[cchAbsDefPath + cchInCur] = '\0'; pszToCopy = abspath(pszAbsPathIn, pszAbsPathOut); if (!pszToCopy) pszToCopy = pszAbsPathIn; /* copy leading input */ if (pszInCur != pszInNextCopy) { const size_t cchCopy = pszInCur - pszInNextCopy; memcpy(pszOutCur, pszInNextCopy, cchCopy); pszOutCur += cchCopy; } pszInNextCopy = pszInCur + cchInCur; /* copy out the abspath. */ cchToCopy = strlen(pszToCopy); assert(cchToCopy <= cchAbsDefPath + cchInCur); memcpy(pszOutCur, pszToCopy, cchToCopy); pszOutCur += cchToCopy; } /* else: Copy absolute paths as bulk when we hit then next relative one or the end. */ } /* the final copy (includes the nil). */ cchInCur = *ppsz + *pcch - pszInNextCopy; memcpy(pszOutCur, pszInNextCopy, cchInCur); pszOutCur += cchInCur; *pszOutCur = '\0'; assert((size_t)(pszOutCur - pszOut) < cchOut); /* set return values */ if (fCanFree) free(*ppsz); *ppsz = pszOut; *pcch = pszOutCur - pszOut; if (pcchAlloc) *pcchAlloc = cchOut; } } /** * Gets a variable that must exist. * Will cause a fatal failure if the variable doesn't exist. * * @returns Pointer to the variable. * @param pszName The variable name. * @param cchName The name length. */ MY_INLINE struct variable * kbuild_get_variable_n(const char *pszName, size_t cchName) { struct variable *pVar = lookup_variable(pszName, cchName); if (!pVar) fatal(NILF, cchName, _("variable `%.*s' isn't defined!"), (int)cchName, pszName); if (pVar->recursive) fatal(NILF, cchName, _("variable `%.*s' is defined as `recursive' instead of `simple'!"), (int)cchName, pszName); MY_ASSERT_MSG(strlen(pVar->value) == pVar->value_length, ("%u != %u %.*s\n", pVar->value_length, (unsigned int)strlen(pVar->value), (int)cchName, pVar->name)); return pVar; } /** * Gets a variable that must exist and can be recursive. * Will cause a fatal failure if the variable doesn't exist. * * @returns Pointer to the variable. * @param pszName The variable name. */ static struct variable * kbuild_get_recursive_variable(const char *pszName) { struct variable *pVar = lookup_variable(pszName, strlen(pszName)); if (!pVar) OS(fatal, NILF, _("variable `%s' isn't defined!"), pszName); MY_ASSERT_MSG(strlen(pVar->value) == pVar->value_length, ("%u != %u %s\n", pVar->value_length, (unsigned int)strlen(pVar->value), pVar->name)); return pVar; } /** * Gets a variable that doesn't have to exit, but if it does can be recursive. * * @returns Pointer to the variable. * NULL if not found. * @param pszName The variable name. Doesn't need to be terminated. * @param cchName The name length. */ static struct variable * kbuild_query_recursive_variable_n(const char *pszName, size_t cchName) { struct variable *pVar = lookup_variable(pszName, cchName); MY_ASSERT_MSG(!pVar || strlen(pVar->value) == pVar->value_length, ("%u != %u %.*s\n", pVar->value_length, (unsigned int)strlen(pVar->value), (int)cchName, pVar->name)); return pVar; } /** * Gets a variable that doesn't have to exit, but if it does can be recursive. * * @returns Pointer to the variable. * NULL if not found. * @param pszName The variable name. */ static struct variable * kbuild_query_recursive_variable(const char *pszName) { return kbuild_query_recursive_variable_n(pszName, strlen(pszName)); } /** * Converts the specified variable into a 'simple' one. * @returns pVar. * @param pVar The variable. */ static struct variable * kbuild_simplify_variable(struct variable *pVar) { if (memchr(pVar->value, '$', pVar->value_length)) { unsigned int value_len; char *pszExpanded = allocated_variable_expand_2(pVar->value, pVar->value_length, &value_len); #ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE if (pVar->rdonly_val) pVar->rdonly_val = 0; else #endif free(pVar->value); assert(pVar->origin != o_automatic); pVar->value = pszExpanded; pVar->value_length = value_len; pVar->value_alloc_len = value_len + 1; } pVar->recursive = 0; VARIABLE_CHANGED(pVar); return pVar; } /** * Looks up a variable. * The value_length field is valid upon successful return. * * @returns Pointer to the variable. NULL if not found. * @param pszName The variable name. * @param cchName The name length. */ MY_INLINE struct variable * kbuild_lookup_variable_n(const char *pszName, size_t cchName) { struct variable *pVar = lookup_variable(pszName, cchName); if (pVar) { MY_ASSERT_MSG(strlen(pVar->value) == pVar->value_length, ("%u != %u %.*s\n", pVar->value_length, (unsigned int)strlen(pVar->value), (int)cchName, pVar->name)); /* Make sure the variable is simple, convert it if necessary. Note! Must NOT do this for the dynamic INCS of sdks/ReorderCompilerIncs.kmk */ if (!pVar->recursive) { /* likely */ } else if ( cchName < sizeof("SDK_ReorderCompilerIncs_INCS.") - 1U || pszName[0] != 'S' || pszName[4] != 'R' || memcmp(pszName, "SDK_ReorderCompilerIncs_INCS.", sizeof("SDK_ReorderCompilerIncs_INCS.") - 1U) == 0) kbuild_simplify_variable(pVar); } return pVar; } /** * Looks up an non-empty variable when simplified and spaces skipped. * * This handy when emulating $(firstword )/$(lastword ) behaviour. * * @returns Pointer to the variable. NULL if not found. * @param pszName The variable name. * @param cchName The name length. */ MY_INLINE struct variable * kbuild_lookup_not_empty_variable_n(const char *pszName, size_t cchName) { struct variable *pVar = kbuild_lookup_variable_n(pszName, cchName); if (pVar && !pVar->recursive) { /* * Skip spaces and make sure it's non-zero. */ char *psz = pVar->value; if (!ISSPACE(*psz)) { /* kind of likely */ } else do psz++; while (ISSPACE(*psz)); if (*psz) { /*kind of likely */ } else pVar = NULL; } return pVar; } /** * Looks up a variable. * The value_length field is valid upon successful return. * * @returns Pointer to the variable. NULL if not found. * @param pszName The variable name. */ MY_INLINE struct variable * kbuild_lookup_variable(const char *pszName) { return kbuild_lookup_variable_n(pszName, strlen(pszName)); } /** * Looks up a variable and applies default a path to all relative paths. * The value_length field is valid upon successful return. * * @returns Pointer to the variable. NULL if not found. * @param pDefPath The default path. * @param pszName The variable name. * @param cchName The name length. */ MY_INLINE struct variable * kbuild_lookup_variable_defpath_n(struct variable *pDefPath, const char *pszName, size_t cchName) { struct variable *pVar = kbuild_lookup_variable_n(pszName, cchName); if (pVar && pDefPath) { assert(pVar->origin != o_automatic); #ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE assert(!pVar->rdonly_val); #endif kbuild_apply_defpath(pDefPath, &pVar->value, &pVar->value_length, &pVar->value_alloc_len, 1); } return pVar; } /** * Looks up a variable and applies default a path to all relative paths. * The value_length field is valid upon successful return. * * @returns Pointer to the variable. NULL if not found. * @param pDefPath The default path. * @param pszName The variable name. */ MY_INLINE struct variable * kbuild_lookup_variable_defpath(struct variable *pDefPath, const char *pszName) { struct variable *pVar = kbuild_lookup_variable(pszName); if (pVar && pDefPath) { assert(pVar->origin != o_automatic); #ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE assert(!pVar->rdonly_val); #endif kbuild_apply_defpath(pDefPath, &pVar->value, &pVar->value_length, &pVar->value_alloc_len, 1); } return pVar; } /** * Gets the first defined property variable. * * When pBldType is given, additional property variations are consulted. * See _TARGET_TOOL/r2433 in footer.kmk for the target-level difference. * Similar extended property lookup is applied to the source part if the * fExtendedSource parameter is non-zero (not done yet as it'll be expensive). * * Since r3415 this function will use $(target)_2_$(type)TOOL to cache the * result of the target specific part of the lookup (_TARGET_TOOL). */ static struct variable * kbuild_first_prop(struct variable *pTarget, struct variable *pSource, struct variable *pTool, struct variable *pType, struct variable *pBldTrg, struct variable *pBldTrgArch, struct variable *pBldType, const char *pszPropF1, char cchPropF1, const char *pszPropF2, char cchPropF2, int fExtendedSource, const char *pszVarName) { struct variable *pVar; size_t cchBuf; char *pszBuf; char *psz, *psz1, *psz2, *psz3, *psz4, *pszEnd; int fCacheIt = 1; fExtendedSource = fExtendedSource && pBldType != NULL; /* calc and allocate a too big name buffer. */ cchBuf = cchPropF2 + 1 + cchPropF1 + 1 + pTarget->value_length + 1 + pSource->value_length + 1 + (pTool ? pTool->value_length + 1 : 0) + pType->value_length + 1 + pBldTrg->value_length + 1 + pBldTrgArch->value_length + 1 + (pBldType ? pBldType->value_length + 1 : 0); pszBuf = xmalloc(cchBuf); #define ADD_VAR(pVar) do { my_memcpy(psz, (pVar)->value, (pVar)->value_length); psz += (pVar)->value_length; } while (0) #define ADD_STR(pszStr, cchStr) do { my_memcpy(psz, (pszStr), (cchStr)); psz += (cchStr); } while (0) #define ADD_CSTR(pszStr) do { my_memcpy(psz, pszStr, sizeof(pszStr) - 1); psz += sizeof(pszStr) - 1; } while (0) #define ADD_CH(ch) do { *psz++ = (ch); } while (0) /* * $(target)_$(source)_$(type)$(propf2).$(bld_trg).$(bld_trg_arch).$(bld_type) * ... * $(target)_$(source)_$(type)$(propf2) */ psz = pszBuf; ADD_VAR(pTarget); ADD_CH('_'); ADD_VAR(pSource); ADD_CH('_'); psz1 = psz; ADD_VAR(pType); ADD_STR(pszPropF2, cchPropF2); #define DO_VARIATIONS(a_fExtended) do { \ psz2 = psz; \ ADD_CH('.'); \ ADD_VAR(pBldTrg); \ psz3 = psz; \ ADD_CH('.'); \ ADD_VAR(pBldTrgArch); \ psz4 = psz; \ if ((a_fExtended) && pBldType) \ { \ ADD_CH('.'); \ ADD_VAR(pBldType); \ pVar = kbuild_lookup_not_empty_variable_n(pszBuf, psz - pszBuf); \ \ /* .$(bld_trg).$(bld_trg_arch) */ \ if (!pVar) \ pVar = kbuild_lookup_not_empty_variable_n(pszBuf, psz4 - pszBuf); \ \ /* .$(bld_trg).$(bld_type) */ \ if (!pVar) \ { \ psz = psz3 + 1; \ ADD_VAR(pBldType); \ pVar = kbuild_lookup_not_empty_variable_n(pszBuf, psz - pszBuf); \ } \ \ /* .$(bld_trg_arch) */ \ if (!pVar) \ { \ psz = psz2 + 1; \ ADD_VAR(pBldTrgArch); \ pVar = kbuild_lookup_not_empty_variable_n(pszBuf, psz - pszBuf); \ } \ \ /* .$(bld_trg) */ \ if (!pVar) \ { \ psz = psz2 + 1; \ ADD_VAR(pBldTrg); \ pVar = kbuild_lookup_not_empty_variable_n(pszBuf, psz - pszBuf); \ } \ \ /* .$(bld_type) */ \ if (!pVar) \ { \ psz = psz2 + 1; \ ADD_VAR(pBldType); \ pVar = kbuild_lookup_not_empty_variable_n(pszBuf, psz - pszBuf); \ } \ } \ else \ { \ /* .$(bld_trg).$(bld_trg_arch) */ \ pVar = kbuild_lookup_not_empty_variable_n(pszBuf, psz4 - pszBuf); \ \ /* .$(bld_trg) */ \ if (!pVar) \ pVar = kbuild_lookup_not_empty_variable_n(pszBuf, psz3 - pszBuf); \ } \ \ /* */ \ if (!pVar) \ pVar = kbuild_lookup_not_empty_variable_n(pszBuf, psz2 - pszBuf); \ } while (0) DO_VARIATIONS(fExtendedSource); /* * $(target)_$(source)_$(propf2).$(bld_trg).$(bld_trg_arch).$(bld_type) [omit $(type) prefix to $(propf2)] * ... * $(target)_$(source)_$(propf2) */ if (!pVar) { psz = psz1; /* rewind to '$(target)_$(source)_' */ ADD_STR(pszPropF2, cchPropF2); DO_VARIATIONS(fExtendedSource); } /* * $(source)_$(type)$(propf2).$(bld_trg).$(bld_trg_arch).$(bld_type) * ... * $(source)_$(type)$(propf2) */ if (!pVar) { psz = pszBuf; ADD_VAR(pSource); ADD_CH('_'); psz1 = psz; ADD_VAR(pType); ADD_STR(pszPropF2, cchPropF2); DO_VARIATIONS(fExtendedSource); /* * $(source)_$(propf2).$(bld_trg).$(bld_trg_arch).$(bld_type) [omit $(type) prefix to $(propf2)] * ... * $(source)_$(propf2) */ if (!pVar) { psz = psz1; /* rewind to '$(source)_' */ ADD_STR(pszPropF2, cchPropF2); DO_VARIATIONS(fExtendedSource); } } /* * Check the cache: $(target)_2_$(type)$(propf2) */ if (pVar) fCacheIt = 0; else if (fCacheIt) { psz = pszBuf; ADD_VAR(pTarget); ADD_STR("_2_", 3); ADD_VAR(pType); ADD_STR(pszPropF2, cchPropF2); pVar = kbuild_lookup_variable_n(pszBuf, psz - pszBuf); /* If found, this can be duplicated and returned directly. No value stripping needed as we defined it (or at least should have) ourselves. */ if (pVar) { pVar = define_variable_vl(pszVarName, strlen(pszVarName), pVar->value, pVar->value_length, 1 /* duplicate */, o_local, 0 /* !recursive */); free(pszBuf); return pVar; } } /* * $(target)_$(type)$(propf2).$(bld_trg).$(bld_trg_arch).$(bld_type) * ... * $(target)_$(type)$(propf2) */ if (!pVar) { psz = pszBuf; ADD_VAR(pTarget); ADD_CH('_'); psz1 = psz; ADD_VAR(pType); ADD_STR(pszPropF2, cchPropF2); DO_VARIATIONS(1); /* * $(target)_$(propf2).$(bld_trg).$(bld_trg_arch).$(bld_type) [omit $(type) prefix to $(propf2)] * ... * $(target)_$(propf2) */ if (!pVar) { psz = psz1; /* rewind to '$(target)_' */ ADD_STR(pszPropF2, cchPropF2); DO_VARIATIONS(1); } } /* * TOOL_$(tool)_$(type)$(propf2).$(bld_trg).$(bld_trg_arch).$(bld_type) * ... * TOOL_$(tool)_$(type)$(propf2) */ if (!pVar && pTool) { psz = pszBuf; ADD_CSTR("TOOL_"); ADD_VAR(pTool); ADD_CH('_'); psz1 = psz; ADD_VAR(pType); ADD_STR(pszPropF2, cchPropF2); DO_VARIATIONS(1); /* * TOOL_$(tool)_$(propf2).$(bld_trg).$(bld_trg_arch).$(bld_type) [omit $(type) prefix to $(propf2)] * ... * TOOL_$(tool)_$(propf2) */ if (!pVar) { psz = psz1; /* rewind to 'TOOL_$(tool)_' */ ADD_STR(pszPropF2, cchPropF2); DO_VARIATIONS(1); } } /* * $(type)$(propf1).$(bld_trg).$(bld_trg_arch).$(bld_type) * ... * $(type)$(propf1) */ if (!pVar) { psz = pszBuf; ADD_VAR(pType); ADD_STR(pszPropF1, cchPropF1); DO_VARIATIONS(1); /* * $(propf1).$(bld_trg).$(bld_trg_arch).$(bld_type) * ... * $(propf1) */ if (!pVar) { psz = pszBuf; ADD_STR(pszPropF1, cchPropF1); DO_VARIATIONS(1); } } /* * Done! */ if (pVar) { /* strip it */ psz = pVar->value; pszEnd = psz + pVar->value_length; while (ISBLANK(*psz)) psz++; while (pszEnd > psz && ISBLANK(pszEnd[-1])) pszEnd--; if (pszEnd > psz) { char chSaved = *pszEnd; *pszEnd = '\0'; pVar = define_variable_vl(pszVarName, strlen(pszVarName), psz, pszEnd - psz, 1 /* duplicate */, o_local, 0 /* !recursive */); *pszEnd = chSaved; } else pVar = NULL; } /* Cache the result if needed. */ if (fCacheIt) { psz = pszBuf; ADD_VAR(pTarget); ADD_STR("_2_", 3); ADD_VAR(pType); ADD_STR(pszPropF2, cchPropF2); define_variable_vl_global(pszBuf, psz - pszBuf, pVar ? pVar->value : "", pVar ? pVar->value_length : 0, 1 /* duplicate */, o_file, 0 /* !recursive */, NILF); } #undef ADD_VAR #undef ADD_STR #undef ADD_CSTR #undef ADD_CH free(pszBuf); return pVar; } /* * _SOURCE_TOOL = $(strip $(firstword \ $($(target)_$(source)_$(type)TOOL.$(bld_trg).$(bld_trg_arch)) \ $($(target)_$(source)_$(type)TOOL.$(bld_trg)) \ $($(target)_$(source)_$(type)TOOL) \ $($(target)_$(source)_TOOL.$(bld_trg).$(bld_trg_arch)) \ $($(target)_$(source)_TOOL.$(bld_trg)) \ $($(target)_$(source)_TOOL) \ $($(source)_$(type)TOOL.$(bld_trg).$(bld_trg_arch)) \ $($(source)_$(type)TOOL.$(bld_trg)) \ $($(source)_$(type)TOOL) \ $($(source)_TOOL.$(bld_trg).$(bld_trg_arch)) \ $($(source)_TOOL.$(bld_trg)) \ $($(source)_TOOL) \ $($(target)_$(type)TOOL.$(bld_trg).$(bld_trg_arch)) \ $($(target)_$(type)TOOL.$(bld_trg)) \ $($(target)_$(type)TOOL) \ $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \ $($(target)_TOOL.$(bld_trg)) \ $($(target)_TOOL) \ \ - the rest depends on pBldType, see _TARGET_TOOL and kbuild_first_prop. $($(type)TOOL.$(bld_trg).$(bld_trg_arch)) \ $($(type)TOOL.$(bld_trg)) \ $($(type)TOOL) \ $(TOOL.$(bld_trg).$(bld_trg_arch)) \ $(TOOL.$(bld_trg)) \ $(TOOL) )) */ static struct variable * kbuild_get_source_tool(struct variable *pTarget, struct variable *pSource, struct variable *pType, struct variable *pBldTrg, struct variable *pBldTrgArch, struct variable *pBldType, const char *pszVarName) { struct variable *pVar = kbuild_first_prop(pTarget, pSource, NULL, pType, pBldTrg, pBldTrgArch, pBldType, "TOOL", sizeof("TOOL") - 1, "TOOL", sizeof("TOOL") - 1, 0 /*fExtendedSource*/, pszVarName); if (!pVar) OSS(fatal, NILF, _("no tool for source `%s' in target `%s'!"), pSource->value, pTarget->value); return pVar; } /** * Helper for func_kbuild_source_tool, func_kbuild_source_one, ++. */ static int kbuild_version_to_int(const char *pszVersion, int fStrict) { int iVer = 0; if (pszVersion && pszVersion[0]) { switch (pszVersion[0] | (pszVersion[1] << 8)) { case '2': iVer = 2; break; case '3': iVer = 3; break; case '4': iVer = 4; break; case '5': iVer = 5; break; case '6': iVer = 6; break; case '7': iVer = 7; break; case '8': iVer = 8; break; case '9': iVer = 9; break; case '0': iVer = 0; break; case '1': iVer = 1; break; default: while (ISBLANK(*pszVersion)) pszVersion++; if (*pszVersion) { char *pszEnd = NULL; long lVer; errno = 0; lVer = strtol(pszVersion, &pszEnd, 10); iVer = (int)lVer; if (fStrict) { if (lVer == 0 && errno != 0) OSN(fatal, NILF, _("invalid version argument '%s': errno=%d"), pszVersion, errno); else if (iVer != (int)lVer || iVer < 0) OS(fatal, NILF, _("version argument out of range '%s'"), pszVersion); else if (pszEnd) { while (ISBLANK(*pszEnd)) pszEnd++; if (*pszEnd) OS(fatal, NILF, _("version is not numerical '%s'"), pszVersion); } } } break; } } return iVer; } /** * "kb-src-tool [ver=0]" - implements _SOURCE_TOOL. * * Since r3415 an extended set of keyword variations is used on the target, tool * and global properties. */ char * func_kbuild_source_tool(char *o, char **argv, const char *pszFuncName) { const int iVer = kbuild_version_to_int(argv[1], 1 /*strict*/); struct variable *pVar = kbuild_get_source_tool(kbuild_get_variable_n(ST("target")), kbuild_get_variable_n(ST("source")), kbuild_get_variable_n(ST("type")), kbuild_get_variable_n(ST("bld_trg")), kbuild_get_variable_n(ST("bld_trg_arch")), kbuild_get_variable_n(ST("bld_type")), argv[0]); if (pVar) o = variable_buffer_output(o, pVar->value, pVar->value_length); (void)pszFuncName; (void)iVer; return o; } /** * Similar to _TARGET_TOOL since r3415. */ static struct variable * kbuild_get_object_suffix(struct variable *pTarget, struct variable *pSource, struct variable *pTool, struct variable *pType, struct variable *pBldTrg, struct variable *pBldTrgArch, struct variable *pBldType, const char *pszVarName) { struct variable *pVar = kbuild_first_prop(pTarget, pSource, pTool, pType, pBldTrg, pBldTrgArch, pBldType, "SUFF_OBJ", sizeof("SUFF_OBJ") - 1, "OBJSUFF", sizeof("OBJSUFF") - 1, 0 /*fExtendedSource*/, pszVarName); if (!pVar) OSS(fatal, NILF, _("no OBJSUFF attribute or SUFF_OBJ default for source `%s' in target `%s'!"), pSource->value, pTarget->value); return pVar; } /** * "kb-obj-suff [ver=0]" * * Since r3415 an extended set of keyword variations is used on the target, tool * and global properties. */ char * func_kbuild_object_suffix(char *o, char **argv, const char *pszFuncName) { const int iVer = kbuild_version_to_int(argv[1], 1 /*strict*/); struct variable *pVar = kbuild_get_object_suffix(kbuild_get_variable_n(ST("target")), kbuild_get_variable_n(ST("source")), kbuild_get_variable_n(ST("tool")), kbuild_get_variable_n(ST("type")), kbuild_get_variable_n(ST("bld_trg")), kbuild_get_variable_n(ST("bld_trg_arch")), kbuild_get_variable_n(ST("bld_type")), argv[0]); if (pVar) o = variable_buffer_output(o, pVar->value, pVar->value_length); (void)pszFuncName; (void)iVer; return o; } /* ## Figure out where to put object files. # @param $1 source file # @param $2 normalized main target # @remark There are two major hacks here: # 1. Source files in the output directory are translated into a gen/ subdir. # 2. Catch anyone specifying $(PATH_SUB_CURRENT)/sourcefile.c. _OBJECT_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(basename \ $(patsubst $(PATH_ROOT)/%,%,$(patsubst $(PATH_SUB_CURRENT)/%,%,$(patsubst $(PATH_TARGET)/$(2)/%,gen/%,$(1))))))) */ static struct variable * kbuild_get_object_base(struct variable *pTarget, struct variable *pSource, const char *pszVarName) { struct variable *pPathTarget = kbuild_get_variable_n(ST("PATH_TARGET")); struct variable *pPathRoot = kbuild_get_variable_n(ST("PATH_ROOT")); struct variable *pPathSubCur = kbuild_get_variable_n(ST("PATH_SUB_CURRENT")); const char *pszSrcPrefix = NULL; size_t cchSrcPrefix = 0; size_t cchSrc = 0; const char *pszSrcEnd; char *pszSrc; char *pszResult; char *psz; char *pszDot; size_t cch; /* * Strip the source filename of any unnecessary leading path and root specs. */ if ( pSource->value_length > pPathTarget->value_length && !strncmp(pSource->value, pPathTarget->value, pPathTarget->value_length)) { pszSrc = pSource->value + pPathTarget->value_length; pszSrcPrefix = "gen/"; cchSrcPrefix = sizeof("gen/") - 1; if ( *pszSrc == '/' && !strncmp(pszSrc + 1, pTarget->value, pTarget->value_length) && ( pszSrc[pTarget->value_length + 1] == '/' || pszSrc[pTarget->value_length + 1] == '\0')) pszSrc += 1 + pTarget->value_length; } else if ( pSource->value_length > pPathRoot->value_length && !strncmp(pSource->value, pPathRoot->value, pPathRoot->value_length)) { pszSrc = pSource->value + pPathRoot->value_length; if ( *pszSrc == '/' && !strncmp(pszSrc + 1, pPathSubCur->value, pPathSubCur->value_length) && ( pszSrc[pPathSubCur->value_length + 1] == '/' || pszSrc[pPathSubCur->value_length + 1] == '\0')) pszSrc += 1 + pPathSubCur->value_length; } else pszSrc = pSource->value; /* skip root specification */ #ifdef HAVE_DOS_PATHS if (isalpha(pszSrc[0]) && pszSrc[1] == ':') pszSrc += 2; #endif while (*pszSrc == '/' #ifdef HAVE_DOS_PATHS || *pszSrc == '\\' #endif ) pszSrc++; /* drop the source extension. */ pszSrcEnd = pSource->value + pSource->value_length; for (;;) { pszSrcEnd--; if ( pszSrcEnd <= pszSrc || *pszSrcEnd == '/' #ifdef HAVE_DOS_PATHS || *pszSrcEnd == '\\' || *pszSrcEnd == ':' #endif ) { pszSrcEnd = pSource->value + pSource->value_length; break; } if (*pszSrcEnd == '.') break; } /* * Assemble the string on the heap and define the objbase variable * which we then return. */ cchSrc = pszSrcEnd - pszSrc; cch = pPathTarget->value_length + 1 /* slash */ + pTarget->value_length + 1 /* slash */ + cchSrcPrefix + cchSrc + 1; psz = pszResult = xmalloc(cch); memcpy(psz, pPathTarget->value, pPathTarget->value_length); psz += pPathTarget->value_length; *psz++ = '/'; memcpy(psz, pTarget->value, pTarget->value_length); psz += pTarget->value_length; *psz++ = '/'; if (pszSrcPrefix) { memcpy(psz, pszSrcPrefix, cchSrcPrefix); psz += cchSrcPrefix; } pszDot = psz; memcpy(psz, pszSrc, cchSrc); psz += cchSrc; *psz = '\0'; /* convert '..' path elements in the source to 'dt'. */ while ((pszDot = memchr(pszDot, '.', psz - pszDot)) != NULL) { if ( pszDot[1] == '.' && ( pszDot == psz || pszDot[-1] == '/' #ifdef HAVE_DOS_PATHS || pszDot[-1] == '\\' || pszDot[-1] == ':' #endif ) && ( !pszDot[2] || pszDot[2] == '/' #ifdef HAVE_DOS_PATHS || pszDot[2] == '\\' || pszDot[2] == ':' #endif ) ) { *pszDot++ = 'd'; *pszDot++ = 't'; } else pszDot++; } /* * Define the variable in the current set and return it. */ return define_variable_vl(pszVarName, strlen(pszVarName), pszResult, cch - 1, 0 /* use pszResult */, o_local, 0 /* !recursive */); } /** * "kb-obj-base [ver]" Implements _OBJECT_BASE. */ char * func_kbuild_object_base(char *o, char **argv, const char *pszFuncName) { const int iVer = kbuild_version_to_int(argv[1], 1 /*strict*/); struct variable *pVar = kbuild_get_object_base(kbuild_lookup_variable("target"), kbuild_lookup_variable("source"), argv[0]); if (pVar) o = variable_buffer_output(o, pVar->value, pVar->value_length); (void)pszFuncName; (void)iVer; return o; } struct kbuild_sdks { char *apsz[4]; struct variable *pa; unsigned c; unsigned iGlobal; unsigned cGlobal; unsigned iTarget; unsigned cTarget; unsigned iSource; unsigned cSource; unsigned iTargetSource; unsigned cTargetSource; unsigned int cchMax; }; /* Fills in the SDK struct (remember to free it). */ static void kbuild_get_sdks(struct kbuild_sdks *pSdks, struct variable *pTarget, struct variable *pSource, struct variable *pBldType, struct variable *pBldTrg, struct variable *pBldTrgArch) { unsigned i; unsigned j; size_t cchTmp, cch; char *pszTmp; unsigned cchCur; char *pszCur; const char *pszIterator; /** @todo rewrite this to avoid sprintf and allocated_varaible_expand_2. */ /* basic init. */ pSdks->cchMax = 0; pSdks->pa = NULL; pSdks->c = 0; i = 0; /* determin required tmp variable name space. */ cchTmp = sizeof("$(__SDKS) $(__SDKS.) $(__SDKS.) $(__SDKS.) $(__SDKS..)") + (pTarget->value_length + pSource->value_length) * 5 + pBldType->value_length + pBldTrg->value_length + pBldTrgArch->value_length + pBldTrg->value_length + pBldTrgArch->value_length; pszTmp = alloca(cchTmp); /* the global sdks. */ pSdks->iGlobal = i; pSdks->cGlobal = 0; cch = sprintf(pszTmp, "$(SDKS) $(SDKS.%s) $(SDKS.%s) $(SDKS.%s) $(SDKS.%s.%s)", pBldType->value, pBldTrg->value, pBldTrgArch->value, pBldTrg->value, pBldTrgArch->value); pszIterator = pSdks->apsz[0] = allocated_variable_expand_2(pszTmp, cch, NULL); while ((pszCur = find_next_token(&pszIterator, &cchCur)) != 0) pSdks->cGlobal++; i += pSdks->cGlobal; /* the target sdks.*/ pSdks->iTarget = i; pSdks->cTarget = 0; cch = sprintf(pszTmp, "$(%s_SDKS) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s.%s)", pTarget->value, pTarget->value, pBldType->value, pTarget->value, pBldTrg->value, pTarget->value, pBldTrgArch->value, pTarget->value, pBldTrg->value, pBldTrgArch->value); pszIterator = pSdks->apsz[1] = allocated_variable_expand_2(pszTmp, cch, NULL); while ((pszCur = find_next_token(&pszIterator, &cchCur)) != 0) pSdks->cTarget++; i += pSdks->cTarget; /* the source sdks.*/ pSdks->iSource = i; pSdks->cSource = 0; cch = sprintf(pszTmp, "$(%s_SDKS) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s.%s)", pSource->value, pSource->value, pBldType->value, pSource->value, pBldTrg->value, pSource->value, pBldTrgArch->value, pSource->value, pBldTrg->value, pBldTrgArch->value); pszIterator = pSdks->apsz[2] = allocated_variable_expand_2(pszTmp, cch, NULL); while ((pszCur = find_next_token(&pszIterator, &cchCur)) != 0) pSdks->cSource++; i += pSdks->cSource; /* the target + source sdks. */ pSdks->iTargetSource = i; pSdks->cTargetSource = 0; cch = sprintf(pszTmp, "$(%s_%s_SDKS) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s.%s)", pTarget->value, pSource->value, pTarget->value, pSource->value, pBldType->value, pTarget->value, pSource->value, pBldTrg->value, pTarget->value, pSource->value, pBldTrgArch->value, pTarget->value, pSource->value, pBldTrg->value, pBldTrgArch->value); assert(cch < cchTmp); (void)cch; pszIterator = pSdks->apsz[3] = allocated_variable_expand_2(pszTmp, cch, NULL); while ((pszCur = find_next_token(&pszIterator, &cchCur)) != 0) pSdks->cTargetSource++; i += pSdks->cTargetSource; pSdks->c = i; if (!i) return; /* * Allocate the variable array and create the variables. */ pSdks->pa = (struct variable *)xmalloc(sizeof(pSdks->pa[0]) * i); memset(pSdks->pa, 0, sizeof(pSdks->pa[0]) * i); for (i = j = 0; j < sizeof(pSdks->apsz) / sizeof(pSdks->apsz[0]); j++) { pszIterator = pSdks->apsz[j]; while ((pszCur = find_next_token(&pszIterator, &cchCur)) != 0) { pSdks->pa[i].value = pszCur; pSdks->pa[i].value_length = cchCur; i++; } } assert(i == pSdks->c); /* terminate them (find_next_token won't work if we terminate them in the previous loop). */ while (i-- > 0) { pSdks->pa[i].value[pSdks->pa[i].value_length] = '\0'; /* calc the max variable length too. */ if (pSdks->cchMax < (unsigned int)pSdks->pa[i].value_length) pSdks->cchMax = pSdks->pa[i].value_length; } } /* releases resources allocated in the kbuild_get_sdks. */ static void kbuild_put_sdks(struct kbuild_sdks *pSdks) { unsigned j; for (j = 0; j < sizeof(pSdks->apsz) / sizeof(pSdks->apsz[0]); j++) free(pSdks->apsz[j]); free(pSdks->pa); } /** Per variable struct used by kbuild_collect_source_prop and helpers. */ struct kbuild_collect_variable { struct variable *pVar; unsigned int cchExp; char *pszExp; }; /** * Helper for kbuild_collect_source_prop. * * Frees up any memory we've allocated for the variable values. */ static struct variable * kbuild_collect_source_prop_create_var(size_t cchTotal, int cVars, struct kbuild_collect_variable *paVars, int iDirection, const char *pszVarName, size_t cchVarName, enum variable_origin enmVarOrigin) { char *pszResult; struct variable *pVar; if (!cVars || !cchTotal) { pszResult = xmalloc(1); *pszResult = '\0'; } else { int iVar; char *psz = pszResult = xmalloc(cchTotal + 1); if (iDirection == 1) { for (iVar = 0; iVar < cVars; iVar++) { my_memcpy(psz, paVars[iVar].pszExp, paVars[iVar].cchExp); psz += paVars[iVar].cchExp; *psz++ = ' '; if (paVars[iVar].pszExp != paVars[iVar].pVar->value) free(paVars[iVar].pszExp); } } else { iVar = cVars; while (iVar-- > 0) { my_memcpy(psz, paVars[iVar].pszExp, paVars[iVar].cchExp); psz += paVars[iVar].cchExp; *psz++ = ' '; if (paVars[iVar].pszExp != paVars[iVar].pVar->value) free(paVars[iVar].pszExp); } } assert(psz != pszResult); assert(cchTotal == (size_t)(psz - pszResult)); psz[-1] = '\0'; cchTotal--; } if (enmVarOrigin == o_local) pVar = define_variable_vl(pszVarName, cchVarName, pszResult, cchTotal, 0 /* take pszResult */ , enmVarOrigin, 0 /* !recursive */); else pVar = define_variable_vl_global(pszVarName, cchVarName, pszResult, cchTotal, 0 /* take pszResult */ , enmVarOrigin, 0 /* !recursive */, NILF); return pVar; } /* this kind of stuff: defs := $(kb-src-exp defs) $(TOOL_$(tool)_DEFS)\ $(TOOL_$(tool)_DEFS.$(bld_type))\ $(TOOL_$(tool)_DEFS.$(bld_trg))\ $(TOOL_$(tool)_DEFS.$(bld_trg_arch))\ $(TOOL_$(tool)_DEFS.$(bld_trg).$(bld_trg_arch))\ $(TOOL_$(tool)_DEFS.$(bld_trg_cpu))\ $(TOOL_$(tool)_$(type)DEFS)\ $(TOOL_$(tool)_$(type)DEFS.$(bld_type))\ $(foreach sdk, $(SDKS.$(bld_trg)) \ $(SDKS.$(bld_trg).$(bld_trg_arch)) \ $(SDKS.$(bld_type)) \ $(SDKS),\ $(SDK_$(sdk)_DEFS)\ $(SDK_$(sdk)_DEFS.$(bld_type))\ $(SDK_$(sdk)_DEFS.$(bld_trg))\ $(SDK_$(sdk)_DEFS.$(bld_trg_arch))\ $(SDK_$(sdk)_DEFS.$(bld_trg).$(bld_trg_arch))\ $(SDK_$(sdk)_DEFS.$(bld_trg_cpu))\ $(SDK_$(sdk)_$(type)DEFS)\ $(SDK_$(sdk)_$(type)DEFS.$(bld_type))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_arch))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg).$(bld_trg_arch))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_cpu)))\ $(DEFS)\ $(DEFS.$(bld_type))\ $(DEFS.$(bld_trg))\ $(DEFS.$(bld_trg_arch))\ $(DEFS.$(bld_trg).$(bld_trg_arch))\ $(DEFS.$(bld_trg_cpu))\ $($(type)DEFS)\ $($(type)DEFS.$(bld_type))\ $($(type)DEFS.$(bld_trg))\ $($(type)DEFS.$(bld_trg_arch))\ $($(type)DEFS.$(bld_trg).$(bld_trg_arch))\ $($(type)DEFS.$(bld_trg_cpu))\ $(foreach sdk, $($(target)_SDKS.$(bld_trg)) \ $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \ $($(target)_SDKS.$(bld_type)) \ $($(target)_SDKS),\ $(SDK_$(sdk)_DEFS)\ $(SDK_$(sdk)_DEFS.$(bld_type))\ $(SDK_$(sdk)_DEFS.$(bld_trg))\ $(SDK_$(sdk)_DEFS.$(bld_trg_arch))\ $(SDK_$(sdk)_DEFS.$(bld_trg).$(bld_trg_arch))\ $(SDK_$(sdk)_DEFS.$(bld_trg_cpu))\ $(SDK_$(sdk)_$(type)DEFS)\ $(SDK_$(sdk)_$(type)DEFS.$(bld_type))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_arch))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg).$(bld_trg_arch))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_cpu)))\ $($(target)_DEFS)\ $($(target)_DEFS.$(bld_type))\ $($(target)_DEFS.$(bld_trg))\ $($(target)_DEFS.$(bld_trg_arch))\ $($(target)_DEFS.$(bld_trg).$(bld_trg_arch))\ $($(target)_DEFS.$(bld_trg_cpu))\ $($(target)_$(type)DEFS)\ $($(target)_$(type)DEFS.$(bld_type))\ $($(target)_$(type)DEFS.$(bld_trg))\ $($(target)_$(type)DEFS.$(bld_trg_arch))\ $($(target)_$(type)DEFS.$(bld_trg).$(bld_trg_arch))\ $($(target)_$(type)DEFS.$(bld_trg_cpu))\ $(foreach sdk, $($(source)_SDKS.$(bld_trg)) \ $($(source)_SDKS.$(bld_trg).$(bld_trg_arch)) \ $($(source)_SDKS.$(bld_type)) \ $($(source)_SDKS),\ $(SDK_$(sdk)_DEFS)\ $(SDK_$(sdk)_DEFS.$(bld_type))\ $(SDK_$(sdk)_DEFS.$(bld_trg))\ $(SDK_$(sdk)_DEFS.$(bld_trg_arch))\ $(SDK_$(sdk)_DEFS.$(bld_trg).$(bld_trg_arch))\ $(SDK_$(sdk)_DEFS.$(bld_trg_cpu))\ $(SDK_$(sdk)_$(type)DEFS)\ $(SDK_$(sdk)_$(type)DEFS.$(bld_type))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_arch))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg).$(bld_trg_arch))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_cpu)))\ $($(source)_DEFS)\ $($(source)_DEFS.$(bld_type))\ $($(source)_DEFS.$(bld_trg))\ $($(source)_DEFS.$(bld_trg_arch))\ $($(source)_DEFS.$(bld_trg).$(bld_trg_arch))\ $($(source)_DEFS.$(bld_trg_cpu))\ $($(source)_$(type)DEFS)\ $($(source)_$(type)DEFS.$(bld_type))\ $($(source)_$(type)DEFS.$(bld_trg))\ $($(source)_$(type)DEFS.$(bld_trg_arch))\ $($(source)_$(type)DEFS.$(bld_trg).$(bld_trg_arch))\ $($(source)_$(type)DEFS.$(bld_trg_cpu))\ $(foreach sdk, $($(target)_$(source)_SDKS.$(bld_trg)) \ $($(target)_$(source)_SDKS.$(bld_trg).$(bld_trg_arch)) \ $($(target)_$(source)_SDKS.$(bld_type)) \ $($(target)_$(source)_SDKS),\ $(SDK_$(sdk)_DEFS)\ $(SDK_$(sdk)_DEFS.$(bld_type))\ $(SDK_$(sdk)_DEFS.$(bld_trg))\ $(SDK_$(sdk)_DEFS.$(bld_trg_arch))\ $(SDK_$(sdk)_DEFS.$(bld_trg).$(bld_trg_arch))\ $(SDK_$(sdk)_DEFS.$(bld_trg_cpu))\ $(SDK_$(sdk)_$(type)DEFS)\ $(SDK_$(sdk)_$(type)DEFS.$(bld_type))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_arch))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg).$(bld_trg_arch))\ $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_cpu)))\ $($(target)_$(source)_DEFS)\ $($(target)_$(source)_DEFS.$(bld_type))\ $($(target)_$(source)_DEFS.$(bld_trg))\ $($(target)_$(source)_DEFS.$(bld_trg_arch))\ $($(target)_$(source)_DEFS.$(bld_trg).$(bld_trg_arch))\ $($(target)_$(source)_DEFS.$(bld_trg_cpu))\ $($(target)_$(source)_$(type)DEFS)\ $($(target)_$(source)_$(type)DEFS.$(bld_type))\ $($(target)_$(source)_$(type)DEFS.$(bld_trg))\ $($(target)_$(source)_$(type)DEFS.$(bld_trg_arch))\ $($(target)_$(source)_$(type)DEFS.$(bld_trg).$(bld_trg_arch))\ $($(target)_$(source)_$(type)DEFS.$(bld_trg_cpu)) */ static struct variable * kbuild_collect_source_prop(struct variable *pTarget, struct variable *pSource, struct variable *pTool, struct kbuild_sdks *pSdks, struct variable *pType, struct variable *pBldType, struct variable *pBldTrg, struct variable *pBldTrgArch, struct variable *pBldTrgCpu, struct variable *pDefPath, const char *pszProp, size_t cchProp, const char *pszVarName, size_t cchVarName, int iDirection) { struct variable *pVar; unsigned iSdk, iSdkEnd; int cVars, iVar; size_t cchTotal, cchBuf; char *pszBuf, *psz, *psz2, *psz3; struct kbuild_collect_variable *paVars; assert(iDirection == 1 || iDirection == -1); /* * Calc and allocate a too big name buffer. */ cchBuf = cchProp + 1 + pTarget->value_length + 1 + pSource->value_length + 1 + pSdks->cchMax + 1 + (pTool ? pTool->value_length + 1 : 0) + pType->value_length + 1 + pBldTrg->value_length + 1 + pBldTrgArch->value_length + 1 + pBldTrgCpu->value_length + 1 + pBldType->value_length + 1 + sizeof("_2_"); pszBuf = xmalloc(cchBuf); /* * Get the variables. * * The compiler will get a heart attack when it sees this code ... ;-) */ cVars = 12 * (pSdks->c + 5); paVars = (struct kbuild_collect_variable *)alloca(cVars * sizeof(paVars[0])); iVar = 0; cchTotal = 0; #define ADD_VAR(pVar) do { my_memcpy(psz, (pVar)->value, (pVar)->value_length); psz += (pVar)->value_length; } while (0) #define ADD_STR(pszStr, cchStr) do { my_memcpy(psz, (pszStr), (cchStr)); psz += (cchStr); } while (0) #define ADD_CSTR(pszStr) do { my_memcpy(psz, pszStr, sizeof(pszStr) - 1); psz += sizeof(pszStr) - 1; } while (0) #define ADD_CH(ch) do { *psz++ = (ch); } while (0) #define DO_VAR_LOOKUP() \ do { \ pVar = kbuild_lookup_variable_n(pszBuf, psz - pszBuf); \ if (pVar) \ { \ paVars[iVar].pVar = pVar; \ if ( !pVar->recursive \ || IS_VARIABLE_RECURSIVE_WITHOUT_DOLLAR(pVar)) \ { \ paVars[iVar].pszExp = pVar->value; \ paVars[iVar].cchExp = pVar->value_length; \ if (pDefPath && paVars[iVar].cchExp) \ kbuild_apply_defpath(pDefPath, &paVars[iVar].pszExp, &paVars[iVar].cchExp, NULL, 0); \ if (paVars[iVar].cchExp) \ { \ cchTotal += paVars[iVar].cchExp + 1; \ iVar++; \ } \ } \ else \ { \ paVars[iVar].pszExp = allocated_variable_expand_2(pVar->value, pVar->value_length, &paVars[iVar].cchExp); \ if (pDefPath && paVars[iVar].cchExp) \ kbuild_apply_defpath(pDefPath, &paVars[iVar].pszExp, &paVars[iVar].cchExp, NULL, 1); \ if (paVars[iVar].cchExp) \ { \ cchTotal += paVars[iVar].cchExp + 1; \ iVar++; \ } \ else \ free(paVars[iVar].pszExp); \ } \ } \ } while (0) #define DO_SINGLE_PSZ3_VARIATION() \ do { \ DO_VAR_LOOKUP(); \ \ ADD_CH('.'); \ psz3 = psz; \ ADD_VAR(pBldType); \ DO_VAR_LOOKUP(); \ \ psz = psz3; \ ADD_VAR(pBldTrg); \ DO_VAR_LOOKUP(); \ \ psz = psz3; \ ADD_VAR(pBldTrgArch); \ DO_VAR_LOOKUP(); \ \ psz = psz3; \ ADD_VAR(pBldTrg); \ ADD_CH('.'); \ ADD_VAR(pBldTrgArch); \ DO_VAR_LOOKUP(); \ \ psz = psz3; \ ADD_VAR(pBldTrgCpu); \ DO_VAR_LOOKUP(); \ } while (0) #define DO_DOUBLE_PSZ2_VARIATION() \ do { \ psz2 = psz; \ ADD_STR(pszProp, cchProp); \ DO_SINGLE_PSZ3_VARIATION(); \ \ /* add prop before type */ \ psz = psz2; \ ADD_VAR(pType); \ ADD_STR(pszProp, cchProp); \ DO_SINGLE_PSZ3_VARIATION(); \ } while (0) /* * The first bunch part may be cached on the target already, check that first: */ psz = pszBuf; ADD_VAR(pTarget); ADD_CSTR("_2_"); ADD_VAR(pType); ADD_STR(pszProp, cchProp); ADD_CH('_'); ADD_VAR(pBldType); *psz = '\0'; pVar = kbuild_lookup_variable_n(pszBuf, psz - pszBuf); if (pVar) assert(iVar == 0); else { /* the tool (lowest priority). */ psz = pszBuf; ADD_CSTR("TOOL_"); ADD_VAR(pTool); ADD_CH('_'); DO_DOUBLE_PSZ2_VARIATION(); /* the global sdks. */ iSdkEnd = iDirection == 1 ? pSdks->iGlobal + pSdks->cGlobal : pSdks->iGlobal - 1; for (iSdk = iDirection == 1 ? pSdks->iGlobal : pSdks->iGlobal + pSdks->cGlobal - 1; iSdk != iSdkEnd; iSdk += iDirection) { struct variable *pSdk = &pSdks->pa[iSdk]; psz = pszBuf; ADD_CSTR("SDK_"); ADD_VAR(pSdk); ADD_CH('_'); DO_DOUBLE_PSZ2_VARIATION(); } /* the globals. */ psz = pszBuf; DO_DOUBLE_PSZ2_VARIATION(); /* the target sdks. */ iSdkEnd = iDirection == 1 ? pSdks->iTarget + pSdks->cTarget : pSdks->iTarget - 1; for (iSdk = iDirection == 1 ? pSdks->iTarget : pSdks->iTarget + pSdks->cTarget - 1; iSdk != iSdkEnd; iSdk += iDirection) { struct variable *pSdk = &pSdks->pa[iSdk]; psz = pszBuf; ADD_CSTR("SDK_"); ADD_VAR(pSdk); ADD_CH('_'); DO_DOUBLE_PSZ2_VARIATION(); } /* the target. */ psz = pszBuf; ADD_VAR(pTarget); ADD_CH('_'); DO_DOUBLE_PSZ2_VARIATION(); /* * Cache the result thus far (frees up anything we might've allocated above). */ psz = pszBuf; ADD_VAR(pTarget); ADD_CSTR("_2_"); ADD_VAR(pType); ADD_STR(pszProp, cchProp); ADD_CH('_'); ADD_VAR(pBldType); *psz = '\0'; assert(iVar <= cVars); pVar = kbuild_collect_source_prop_create_var(cchTotal, iVar, paVars, iDirection, pszBuf, psz - pszBuf, o_file); assert(pVar); } /* Now we use the cached target variable. */ paVars[0].pVar = pVar; paVars[0].pszExp = pVar->value; paVars[0].cchExp = pVar->value_length; cchTotal = paVars[0].cchExp + 1; iVar = 1; /* the source sdks. */ iSdkEnd = iDirection == 1 ? pSdks->iSource + pSdks->cSource : pSdks->iSource - 1; for (iSdk = iDirection == 1 ? pSdks->iSource : pSdks->iSource + pSdks->cSource - 1; iSdk != iSdkEnd; iSdk += iDirection) { struct variable *pSdk = &pSdks->pa[iSdk]; psz = pszBuf; ADD_CSTR("SDK_"); ADD_VAR(pSdk); ADD_CH('_'); DO_DOUBLE_PSZ2_VARIATION(); } /* the source. */ psz = pszBuf; ADD_VAR(pSource); ADD_CH('_'); DO_DOUBLE_PSZ2_VARIATION(); /* the target + source sdks. */ iSdkEnd = iDirection == 1 ? pSdks->iTargetSource + pSdks->cTargetSource : pSdks->iTargetSource - 1; for (iSdk = iDirection == 1 ? pSdks->iTargetSource : pSdks->iTargetSource + pSdks->cTargetSource - 1; iSdk != iSdkEnd; iSdk += iDirection) { struct variable *pSdk = &pSdks->pa[iSdk]; psz = pszBuf; ADD_CSTR("SDK_"); ADD_VAR(pSdk); ADD_CH('_'); DO_DOUBLE_PSZ2_VARIATION(); } /* the target + source. */ psz = pszBuf; ADD_VAR(pTarget); ADD_CH('_'); ADD_VAR(pSource); ADD_CH('_'); DO_DOUBLE_PSZ2_VARIATION(); free(pszBuf); /* * Construct the result value (frees up anything we might've allocated above). */ assert(iVar <= cVars); return kbuild_collect_source_prop_create_var(cchTotal, iVar, paVars, iDirection, pszVarName, cchVarName, o_local); #undef ADD_VAR #undef ADD_STR #undef ADD_CSTR #undef ADD_CH #undef DO_VAR_LOOKUP #undef DO_DOUBLE_PSZ2_VARIATION #undef DO_SINGLE_PSZ3_VARIATION } /* "kb-src-prop [defpath] [ver]" get a source property. */ char * func_kbuild_source_prop(char *o, char **argv, const char *pszFuncName) { struct variable *pTarget = kbuild_get_variable_n(ST("target")); struct variable *pSource = kbuild_get_variable_n(ST("source")); struct variable *pDefPath = NULL; struct variable *pType = kbuild_get_variable_n(ST("type")); struct variable *pTool = kbuild_get_variable_n(ST("tool")); struct variable *pBldType = kbuild_get_variable_n(ST("bld_type")); struct variable *pBldTrg = kbuild_get_variable_n(ST("bld_trg")); struct variable *pBldTrgArch = kbuild_get_variable_n(ST("bld_trg_arch")); struct variable *pBldTrgCpu = kbuild_get_variable_n(ST("bld_trg_cpu")); struct variable *pVar; struct kbuild_sdks Sdks; int iVer = 0; int iDirection; if (!strcmp(argv[2], "left-to-right")) iDirection = 1; else if (!strcmp(argv[2], "right-to-left")) iDirection = -1; else OS(fatal, NILF, _("incorrect direction argument `%s'!"), argv[2]); if (argv[3]) { const char *psz = argv[3]; while (ISSPACE(*psz)) psz++; if (*psz) pDefPath = kbuild_get_variable_n(ST("defpath")); if (argv[4]) iVer = kbuild_version_to_int(argv[4], 1 /*strict*/); } kbuild_get_sdks(&Sdks, pTarget, pSource, pBldType, pBldTrg, pBldTrgArch); pVar = kbuild_collect_source_prop(pTarget, pSource, pTool, &Sdks, pType, pBldType, pBldTrg, pBldTrgArch, pBldTrgCpu, pDefPath, argv[0], strlen(argv[0]), argv[1], strlen(argv[1]), iDirection); if (pVar) o = variable_buffer_output(o, pVar->value, pVar->value_length); kbuild_put_sdks(&Sdks); (void)pszFuncName; (void)iVer; return o; } /* dep := $(obj)$(SUFF_DEP) obj := $(outbase)$(objsuff) dirdep := $(call DIRDEP,$(dir $(outbase))) PATH_$(target)_$(source) := $(patsubst %/,%,$(dir $(outbase))) */ static struct variable * kbuild_set_object_name_and_dep_and_dirdep_and_PATH_target_source(struct variable *pTarget, struct variable *pSource, struct variable *pOutBase, struct variable *pObjSuff, const char *pszVarName, struct variable **ppDep, struct variable **ppDirDep) { struct variable *pDepSuff = kbuild_get_variable_n(ST("SUFF_DEP")); struct variable *pObj; size_t cch = pOutBase->value_length + pObjSuff->value_length + pDepSuff->value_length + 1; char *pszResult = alloca(cch); char *pszName, *psz; /* * dep. */ psz = pszResult; memcpy(psz, pOutBase->value, pOutBase->value_length); psz += pOutBase->value_length; memcpy(psz, pObjSuff->value, pObjSuff->value_length); psz += pObjSuff->value_length; memcpy(psz, pDepSuff->value, pDepSuff->value_length + 1); *ppDep = define_variable_vl("dep", 3, pszResult, cch - 1, 1 /*dup*/, o_local, 0 /* !recursive */); /* * obj */ *psz = '\0'; pObj = define_variable_vl(pszVarName, strlen(pszVarName), pszResult, psz - pszResult, 1/* dup */, o_local, 0 /* !recursive */); /* * PATH_$(target)_$(source) - this is global! */ /* calc variable name. */ cch = sizeof("PATH_")-1 + pTarget->value_length + sizeof("_")-1 + pSource->value_length; psz = pszName = alloca(cch + 1); memcpy(psz, "PATH_", sizeof("PATH_") - 1); psz += sizeof("PATH_") - 1; memcpy(psz, pTarget->value, pTarget->value_length); psz += pTarget->value_length; *psz++ = '_'; memcpy(psz, pSource->value, pSource->value_length + 1); /* strip off the filename. */ psz = pszResult + pOutBase->value_length; for (;;) { psz--; if (psz <= pszResult) OS(fatal, NULL, "whut!?! no path? result=`%s'", pszResult); #ifdef HAVE_DOS_PATHS if (*psz == ':') { psz++; break; } #endif if ( *psz == '/' #ifdef HAVE_DOS_PATHS || *psz == '\\' #endif ) { while ( psz - 1 > pszResult && psz[-1] == '/' #ifdef HAVE_DOS_PATHS || psz[-1] == '\\' #endif ) psz--; #ifdef HAVE_DOS_PATHS if (psz == pszResult + 2 && pszResult[1] == ':') psz++; #endif break; } } *psz = '\0'; /* set global variable */ define_variable_vl_global(pszName, cch, pszResult, psz - pszResult, 1/*dup*/, o_file, 0 /* !recursive */, NILF); /* * dirdep */ if ( psz[-1] != '/' #ifdef HAVE_DOS_PATHS && psz[-1] != '\\' && psz[-1] != ':' #endif ) { *psz++ = '/'; *psz = '\0'; } *ppDirDep = define_variable_vl("dirdep", 6, pszResult, psz - pszResult, 1/*dup*/, o_local, 0 /* !recursive */); return pObj; } /** * * * Setup the base variables for def_target_source_c_cpp_asm_new: * @code X := $(kb-src-tool tool) x := $(kb-obj-base outbase) x := $(kb-obj-suff objsuff) obj := $(outbase)$(objsuff) PATH_$(target)_$(source) := $(patsubst %/,%,$(dir $(outbase))) x := $(kb-src-prop DEFS,defs,left-to-right) x := $(kb-src-prop INCS,incs,right-to-left) x := $(kb-src-prop FLAGS,flags,right-to-left) x := $(kb-src-prop DEPS,deps,left-to-right) dirdep := $(call DIRDEP,$(dir $(outbase))) dep := $(obj)$(SUFF_DEP) * @endcode * * argv[0] is the function version. Prior to r1792 (early 0.1.5) this * was undefined and footer.kmk always passed an empty string. * * Version 2, as implemented in r1797, will make use of the async * includedep queue feature. This means the files will be read by one or * more background threads, leaving the eval'ing to be done later on by * the main thread (in snap_deps). * * Version 3, as implemented in rXXXX, will check * TOOL_$(tool)_COMPILE_$(type)_USES_KOBJCACHE and use * def_target_source_rule_v3plus_objcache if it's non-empty or * def_target_source_rule_v3plus if it's empty (version 2 and older will use * def_target_source_rule). Version 3 will also skip defining several * properties that it considers legacy (todo: which). * * Version 4, as implemented in r3415, will use the extended tool resolution at * the target level (not source) as implemented by the _TARGET_TOOL update in * r2433. * * With r3415 the $(target)_2_$(type)TOOL will be used for caching purposes * regardless of version. */ char * func_kbuild_source_one(char *o, char **argv, const char *pszFuncName) { static int s_fNoCompileDepsDefined = -1; struct variable *pTarget = kbuild_get_variable_n(ST("target")); struct variable *pSource = kbuild_get_variable_n(ST("source")); struct variable *pDefPath = kbuild_get_variable_n(ST("defpath")); struct variable *pType = kbuild_get_variable_n(ST("type")); struct variable *pBldType = kbuild_get_variable_n(ST("bld_type")); struct variable *pBldTrg = kbuild_get_variable_n(ST("bld_trg")); struct variable *pBldTrgArch= kbuild_get_variable_n(ST("bld_trg_arch")); struct variable *pBldTrgCpu = kbuild_get_variable_n(ST("bld_trg_cpu")); const int iVer = kbuild_version_to_int(argv[0], 0 /*strict*/); struct variable *pTool = kbuild_get_source_tool(pTarget, pSource, pType, pBldTrg, pBldTrgArch, iVer >= 4 ? pBldType : NULL, "tool"); struct variable *pOutBase = kbuild_get_object_base(pTarget, pSource, "outbase"); struct variable *pObjSuff = kbuild_get_object_suffix(pTarget, pSource, pTool, pType, pBldTrg, pBldTrgArch, iVer >= 4 ? pBldType : NULL, "objsuff"); struct variable *pDeps, *pOrderDeps, *pDirDep, *pDep, *pVar, *pOutput, *pOutputMaybe; #if 0 /* not used */ struct variable *pDefs, *pIncs, *pFlags; #endif struct variable *pObj = kbuild_set_object_name_and_dep_and_dirdep_and_PATH_target_source(pTarget, pSource, pOutBase, pObjSuff, "obj", &pDep, &pDirDep); int fInstallOldObjsVar = 0; char *pszDstVar, *pszDst, *pszSrcVar, *pszSrc, *pszVal, *psz; char *pszSavedVarBuf; unsigned cchSavedVarBuf; size_t cch; struct kbuild_sdks Sdks; /* * Gather properties. */ kbuild_get_sdks(&Sdks, pTarget, pSource, pBldType, pBldTrg, pBldTrgArch); if (pDefPath && !pDefPath->value_length) pDefPath = NULL; /*pDefs =*/ kbuild_collect_source_prop(pTarget, pSource, pTool, &Sdks, pType, pBldType, pBldTrg, pBldTrgArch, pBldTrgCpu, NULL, ST("DEFS"), ST("defs"), 1 /* left-to-right */); /*pIncs =*/ kbuild_collect_source_prop(pTarget, pSource, pTool, &Sdks, pType, pBldType, pBldTrg, pBldTrgArch, pBldTrgCpu, pDefPath, ST("INCS"), ST("incs"), -1 /* right-to-left */); /*pFlags =*/ kbuild_collect_source_prop(pTarget, pSource, pTool, &Sdks, pType, pBldType, pBldTrg, pBldTrgArch, pBldTrgCpu, NULL, ST("FLAGS"), ST("flags"), 1 /* left-to-right */); pDeps = kbuild_collect_source_prop(pTarget, pSource, pTool, &Sdks, pType, pBldType, pBldTrg, pBldTrgArch, pBldTrgCpu, pDefPath, ST("DEPS"), ST("deps"), 1 /* left-to-right */); pOrderDeps = kbuild_collect_source_prop(pTarget, pSource, pTool, &Sdks, pType, pBldType, pBldTrg, pBldTrgArch, pBldTrgCpu, pDefPath, ST("ORDERDEPS"), ST("orderdeps"), 1 /* left-to-right */); /* * If we've got a default path, we must expand the source now. * If we do this too early, "_property = stuff" won't work becuase * our 'source' value isn't what the user expects. */ if (pDefPath) { /** @todo assert(pSource->origin != o_automatic); We're changing 'source' * from the foreach loop! */ #ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE assert(!pSource->rdonly_val); #endif kbuild_apply_defpath(pDefPath, &pSource->value, &pSource->value_length, &pSource->value_alloc_len, 1 /* can free */); } /* # dependencies ifndef NO_COMPILE_DEPS _DEPFILES_INCLUDED += $(dep) $(if $(wildcard $(dep)),$(eval include $(dep))) endif */ if (s_fNoCompileDepsDefined == -1) s_fNoCompileDepsDefined = kbuild_lookup_variable_n(ST("NO_COMPILE_DEPS")) != NULL; if (!s_fNoCompileDepsDefined) { pVar = kbuild_query_recursive_variable_n("_DEPFILES_INCLUDED", sizeof("_DEPFILES_INCLUDED") - 1); if (pVar) { if (pVar->recursive) pVar = kbuild_simplify_variable(pVar); append_string_to_variable(pVar, pDep->value, pDep->value_length, 1 /* append */); } else define_variable_vl_global("_DEPFILES_INCLUDED", sizeof("_DEPFILES_INCLUDED") - 1, pDep->value, pDep->value_length, 1 /* duplicate_value */, o_file, 0 /* recursive */, NULL /* flocp */); eval_include_dep(pDep->value, NILF, iVer >= 2 ? incdep_queue : incdep_read_it); } /* # call the tool $(target)_$(source)_CMDS_ := $(TOOL_$(tool)_COMPILE_$(type)_CMDS) $(target)_$(source)_OUTPUT_ := $(TOOL_$(tool)_COMPILE_$(type)_OUTPUT) $(target)_$(source)_OUTPUT_MAYBE_ := $(TOOL_$(tool)_COMPILE_$(type)_OUTPUT_MAYBE) $(target)_$(source)_DEPEND_ := $(TOOL_$(tool)_COMPILE_$(type)_DEPEND) $(deps) $(source) $(target)_$(source)_DEPORD_ := $(TOOL_$(tool)_COMPILE_$(type)_DEPORD) $(dirdep) */ /** @todo Make all these local variables, if someone needs the info later it * can be recalculated. (Ticket #80.) */ cch = sizeof("TOOL_") + pTool->value_length + sizeof("_COMPILE_") + pType->value_length + sizeof("_USES_KOBJCACHE"); if (cch < pTarget->value_length + sizeof("$(_2_OBJS)")) cch = pTarget->value_length + sizeof("$(_2_OBJS)"); psz = pszSrcVar = alloca(cch); memcpy(psz, "TOOL_", sizeof("TOOL_") - 1); psz += sizeof("TOOL_") - 1; memcpy(psz, pTool->value, pTool->value_length); psz += pTool->value_length; memcpy(psz, "_COMPILE_", sizeof("_COMPILE_") - 1); psz += sizeof("_COMPILE_") - 1; memcpy(psz, pType->value, pType->value_length); psz += pType->value_length; pszSrc = psz; cch = pTarget->value_length + 1 + pSource->value_length + sizeof("_OUTPUT_MAYBE_"); psz = pszDstVar = alloca(cch); memcpy(psz, pTarget->value, pTarget->value_length); psz += pTarget->value_length; *psz++ = '_'; memcpy(psz, pSource->value, pSource->value_length); psz += pSource->value_length; pszDst = psz; memcpy(pszSrc, "_CMDS", sizeof("_CMDS")); memcpy(pszDst, "_CMDS_", sizeof("_CMDS_")); pVar = kbuild_get_recursive_variable(pszSrcVar); if (iVer <= 2) do_variable_definition_2(NILF, pszDstVar, pVar->value, pVar->value_length, !pVar->recursive, 0, o_local, f_simple, 0 /* !target_var */); do_variable_definition_2(NILF, "kbsrc_cmds", pVar->value, pVar->value_length, !pVar->recursive, 0, o_local, f_simple, 0 /* !target_var */); memcpy(pszSrc, "_OUTPUT", sizeof("_OUTPUT")); memcpy(pszDst, "_OUTPUT_", sizeof("_OUTPUT_")); pVar = kbuild_get_recursive_variable(pszSrcVar); if (iVer <= 2) pOutput = do_variable_definition_2(NILF, pszDstVar, pVar->value, pVar->value_length, !pVar->recursive, 0, o_local, f_simple, 0 /* !target_var */); pOutput = do_variable_definition_2(NILF, "kbsrc_output", pVar->value, pVar->value_length, !pVar->recursive, 0, o_local, f_simple, 0 /* !target_var */); memcpy(pszSrc, "_OUTPUT_MAYBE", sizeof("_OUTPUT_MAYBE")); memcpy(pszDst, "_OUTPUT_MAYBE_", sizeof("_OUTPUT_MAYBE_")); pVar = kbuild_query_recursive_variable(pszSrcVar); if (pVar) { if (iVer <= 2) pOutputMaybe = do_variable_definition_2(NILF, pszDstVar, pVar->value, pVar->value_length, !pVar->recursive, 0, o_local, f_simple, 0 /* !target_var */); pOutputMaybe = do_variable_definition_2(NILF, "kbsrc_output_maybe", pVar->value, pVar->value_length, !pVar->recursive, 0, o_local, f_simple, 0 /* !target_var */); } else { if (iVer <= 2) pOutputMaybe = do_variable_definition_2(NILF, pszDstVar, "", 0, 1, 0, o_local, f_simple, 0 /* !target_var */); pOutputMaybe = do_variable_definition_2(NILF, "kbsrc_output_maybe", "", 0, 1, 0, o_local, f_simple, 0 /* !target_var */); } memcpy(pszSrc, "_DEPEND", sizeof("_DEPEND")); memcpy(pszDst, "_DEPEND_", sizeof("_DEPEND_")); pVar = kbuild_get_recursive_variable(pszSrcVar); psz = pszVal = xmalloc(pVar->value_length + 1 + pDeps->value_length + 1 + pSource->value_length + 1); memcpy(psz, pVar->value, pVar->value_length); psz += pVar->value_length; *psz++ = ' '; memcpy(psz, pDeps->value, pDeps->value_length); psz += pDeps->value_length; *psz++ = ' '; memcpy(psz, pSource->value, pSource->value_length + 1); if (iVer <= 2) do_variable_definition_2(NILF, pszDstVar, pszVal, pVar->value_length + 1 + pDeps->value_length + 1 + pSource->value_length, !pVar->recursive && !pDeps->recursive && !pSource->recursive, NULL, o_local, f_simple, 0 /* !target_var */); do_variable_definition_2(NILF, "kbsrc_depend", pszVal, pVar->value_length + 1 + pDeps->value_length + 1 + pSource->value_length, !pVar->recursive && !pDeps->recursive && !pSource->recursive, pszVal, o_local, f_simple, 0 /* !target_var */); memcpy(pszSrc, "_DEPORD", sizeof("_DEPORD")); memcpy(pszDst, "_DEPORD_", sizeof("_DEPORD_")); pVar = kbuild_get_recursive_variable(pszSrcVar); psz = pszVal = xmalloc(pVar->value_length + 1 + pDirDep->value_length + 1 + pOrderDeps->value_length + 1); memcpy(psz, pVar->value, pVar->value_length); psz += pVar->value_length; *psz++ = ' '; memcpy(psz, pDirDep->value, pDirDep->value_length); psz += pDirDep->value_length; *psz++ = ' '; memcpy(psz, pOrderDeps->value, pOrderDeps->value_length + 1); if (iVer <= 2) do_variable_definition_2(NILF, pszDstVar, pszVal, pVar->value_length + 1 + pDirDep->value_length + 1 + pOrderDeps->value_length, !pVar->recursive && !pDirDep->recursive && !pOrderDeps->recursive, NULL, o_local, f_simple, 0 /* !target_var */); do_variable_definition_2(NILF, "kbsrc_depord", pszVal, pVar->value_length + 1 + pDirDep->value_length + 1 + pOrderDeps->value_length, !pVar->recursive && !pDirDep->recursive && !pOrderDeps->recursive, pszVal, o_local, f_simple, 0 /* !target_var */); /* _OUT_FILES += $($(target)_$(source)_OUTPUT_) $($(target)_$(source)_OUTPUT_MAYBE_) */ pVar = kbuild_get_variable_n(ST("_OUT_FILES")); append_string_to_variable(pVar, pOutput->value, pOutput->value_length, 1 /* append */); if (pOutputMaybe->value_length) append_string_to_variable(pVar, pOutputMaybe->value, pOutputMaybe->value_length, 1 /* append */); /* $(target)_2_OBJS += $(obj) */ memcpy(pszDstVar + pTarget->value_length, "_2_OBJS", sizeof("_2_OBJS")); pVar = kbuild_query_recursive_variable_n(pszDstVar, pTarget->value_length + sizeof("_2_OBJS") - 1); fInstallOldObjsVar |= iVer <= 2 && (!pVar || !pVar->value_length); if (pVar) { if (pVar->recursive) pVar = kbuild_simplify_variable(pVar); append_string_to_variable(pVar, pObj->value, pObj->value_length, 1 /* append */); } else define_variable_vl_global(pszDstVar, pTarget->value_length + sizeof("_2_OBJS") - 1, pObj->value, pObj->value_length, 1 /* duplicate_value */, o_file, 0 /* recursive */, NULL /* flocp */); /* * Install legacy variable. */ if (fInstallOldObjsVar) { /* $(target)_OBJS_ = $($(target)_2_OBJS)*/ memcpy(pszDstVar + pTarget->value_length, "_OBJS_", sizeof("_OBJS_")); pszSrcVar[0] = '$'; pszSrcVar[1] = '('; memcpy(pszSrcVar + 2, pTarget->value, pTarget->value_length); psz = pszSrcVar + 2 + pTarget->value_length; memcpy(psz, "_2_OBJS)", sizeof("_2_OBJS)")); define_variable_vl_global(pszDstVar, pTarget->value_length + sizeof("_OBJS_") - 1, pszSrcVar, pTarget->value_length + sizeof("$(_2_OBJS)") - 1, 1 /* duplicate_value */, o_file, 1 /* recursive */, NULL /* flocp */); } /* $(eval $(def_target_source_rule)) */ if (iVer > 2) { /*ifneq ($(TOOL_$(tool)_COMPILE_$(type)_USES_KOBJCACHE),)*/ int fUsesObjCache = 0; memcpy(pszSrc, "_USES_KOBJCACHE", sizeof("_USES_KOBJCACHE")); pVar = lookup_variable(pszSrcVar, pszSrc + sizeof("_USES_KOBJCACHE") - 1 - pszSrcVar); if (pVar) { if ( !pVar->recursive || IS_VARIABLE_RECURSIVE_WITHOUT_DOLLAR(pVar)) fUsesObjCache = pVar->value_length > 0; else { unsigned int cchTmp = 0; char *pszTmp = allocated_variable_expand_2(pVar->value, pVar->value_length, &cchTmp); free(pszTmp); fUsesObjCache = cchTmp > 0; } } if (!fUsesObjCache) pVar = kbuild_get_recursive_variable("def_target_source_rule_v3plus"); else pVar = kbuild_get_recursive_variable("def_target_source_rule_v3plus_objcache"); } else pVar = kbuild_get_recursive_variable("def_target_source_rule"); pszVal = variable_expand_string_2(o, pVar->value, pVar->value_length, &psz); assert(!((size_t)pszVal & 3)); install_variable_buffer(&pszSavedVarBuf, &cchSavedVarBuf); eval_buffer(pszVal, NULL, psz); restore_variable_buffer(pszSavedVarBuf, cchSavedVarBuf); kbuild_put_sdks(&Sdks); (void)pszFuncName; *pszVal = '\0'; return pszVal; } /* ## Inherit one template property in a non-accumulative manner. # @param $(prop) Property name # @param $(target) Target name # @todo fix the precedence order for some properties. define def_inherit_template_one ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop) ifndef $(target)_$(prop) $(target)_$(prop) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)) endif endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg) ifndef $(target)_$(prop).$(bld_trg) $(target)_$(prop).$(bld_trg) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)) endif endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch) ifndef $(target)_$(prop).$(bld_trg).$(bld_trg_arch) $(target)_$(prop).$(bld_trg).$(bld_trg_arch) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)) endif endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch) ifndef $(target)_$(prop).$(bld_trg_arch) $(target)_$(prop).$(bld_trg_arch) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)) endif endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu) ifndef $(target)_$(prop).$(bld_trg_cpu) $(target)_$(prop).$(bld_trg_cpu) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)) endif endif endef ## Inherit one template property in a non-accumulative manner, deferred expansion. # @param 1: $(prop) Property name # @param 2: $(target) Target name # @todo fix the precedence order for some properties. # @remark this define relies on double evaluation define def_inherit_template_one_deferred ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop) ifndef $(target)_$(prop) $(target)_$(prop) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop)) endif endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg) ifndef $(target)_$(prop).$(bld_trg) $(target)_$(prop).$(bld_trg) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)) endif endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch) ifndef $(target)_$(prop).$(bld_trg).$(bld_trg_arch) $(target)_$(prop).$(bld_trg).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)) endif endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch) ifndef $(target)_$(prop).$(bld_trg_arch) $(target)_$(prop).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)) endif endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu) ifndef $(target)_$(prop).$(bld_trg_cpu) $(target)_$(prop).$(bld_trg_cpu) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)) endif endif endef ## Inherit one acculumlative template property where the 'most significant' items are at the left end. # @param $(prop) Property name # @param $(target) Target name define def_inherit_template_one_accumulate_l ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop) ifeq ($$(flavor $(target)_$(prop)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop)) endif $(target)_$(prop) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop)) endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE) ifeq ($$(flavor $(target)_$(prop).$(KBUILD_TYPE)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(KBUILD_TYPE)) endif $(target)_$(prop).$(KBUILD_TYPE) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE)) endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg) ifeq ($$(flavor $(target)_$(prop).$(bld_trg)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg)) endif $(target)_$(prop).$(bld_trg) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)) endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch) ifeq ($$(flavor $(target)_$(prop).$(bld_trg).$(bld_trg_arch)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg).$(bld_trg_arch)) endif $(target)_$(prop).$(bld_trg).$(bld_trg_arch) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)) endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu) ifeq ($$(flavor $(target)_$(prop).$(bld_trg_cpu)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_cpu)) endif $(target)_$(prop).$(bld_trg_cpu) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)) endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch) ifeq ($$(flavor $(target)_$(prop).$(bld_trg_arch)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_arch)) endif $(target)_$(prop).$(bld_trg_arch) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)) endif endef ## Inherit one acculumlative template property where the 'most significant' items are at the right end. # @param $(prop) Property name # @param $(target) Target name define def_inherit_template_one_accumulate_r ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop) ifeq ($$(flavor $(target)_$(prop)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop)) endif $(target)_$(prop) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop)) endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE) ifeq ($$(flavor $(target)_$(prop).$(KBUILD_TYPE)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(KBUILD_TYPE)) endif $(target)_$(prop).$(KBUILD_TYPE) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE)) endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg) ifeq ($$(flavor $(target)_$(prop).$(bld_trg)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg)) endif $(target)_$(prop).$(bld_trg) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)) endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch) ifeq ($$(flavor $(target)_$(prop).$(bld_trg).$(bld_trg_arch)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg).$(bld_trg_arch)) endif $(target)_$(prop).$(bld_trg).$(bld_trg_arch) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)) endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu) ifeq ($$(flavor $(target)_$(prop).$(bld_trg_cpu)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_cpu)) endif $(target)_$(prop).$(bld_trg_cpu) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)) endif ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch) ifeq ($$(flavor $(target)_$(prop).$(bld_trg_arch)),simple) $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_arch)) endif $(target)_$(prop).$(bld_trg_arch) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)) endif endef ## Inherit template properties for on target. # @param $(target) Target name. define def_inherit_template # sanity check. ifdef _$(target)_ALREADY_PROCESSED $(error kBuild: The target $(target) appears more than once in the target lists! Please correct the makefile(s)) endif _$(target)_ALREADY_PROCESSED := 1 # Inherit any default template. ifdef TEMPLATE ifeq ($($(target)_TEMPLATE),) $(eval $(target)_TEMPLATE:=$(TEMPLATE)) endif endif # Expand the template if specified. ifneq ($($(target)_TEMPLATE),) $(foreach prop,$(PROPS_SINGLE),$(evalval def_inherit_template_one)) $(foreach prop,$(PROPS_DEFERRED),$(eval $(def_inherit_template_one_deferred))) # exploits the 2 evaluation, so no value! $(foreach prop,$(PROPS_ACCUMULATE_L),$(eval $(def_inherit_template_one_accumulate_l))) # += works fine without value $(foreach prop,$(PROPS_ACCUMULATE_R),$(eval $(def_inherit_template_one_accumulate_r))) # use <= (kmk addition) endif endef Invoked like this: $(kb-exp-tmpl 1,$(_ALL_TARGET_TARGETS),$(KBUILD_TARGET),$(KBUILD_TARGET_ARCH),$(KBUILD_TARGET_CPU),$(KBUILD_TYPE)) */ char * func_kbuild_expand_template(char *o, char **argv, const char *pszFuncName) { const char *pszVersion = argv[0]; const char *pszBldTrg = argv[2]; const char *pszBldTrgArch = argv[3]; const char *pszBldTrgCpu = argv[4]; const char *pszBldType = argv[5]; size_t cchBldTrg = strlen(pszBldTrg); size_t cchBldTrgArch = strlen(pszBldTrgArch); size_t cchBldTrgCpu = strlen(pszBldTrgCpu); size_t cchBldType = strlen(pszBldType); size_t cchMaxBld = cchBldTrg + cchBldTrgArch + cchBldTrgCpu + cchBldType; /* too big, but so what. */ struct kbet_key { unsigned int cch; char *psz; } aKeys[6]; unsigned int const cKeys = 6; unsigned int iKey; struct variable *pDefTemplate; struct variable *pProps; struct kbet_prop { const char *pch; unsigned int cch; enum kbet_prop_enum { kPropSingle, kPropDeferred, kPropAccumulateL, kPropAccumulateR } enmType; } *paProps; unsigned int cProps; unsigned int iProp; size_t cchMaxProp; struct variable *pVarTrg; struct variable *pVarSrc; const char *pszIter; const char *pszTarget; unsigned int cchTarget; char *pszSrc = 0; char *pszSrcRef = 0; char *pszSrcBuf = 0; size_t cchSrcBuf = 0; char *pszTrg = 0; size_t cchTrg = 0; /* * Validate input. */ if (pszVersion[0] != '1' || pszVersion[1]) OSS(fatal, NULL, "%s: Unsupported version `%s'", pszFuncName, pszVersion); if (!cchBldTrg) OS(fatal, NULL, "%s: missing bldtrg", pszFuncName); if (!cchBldTrgArch) OS(fatal, NULL, "%s: missing bld_trg_arch", pszFuncName); if (!cchBldTrgCpu) OS(fatal, NULL, "%s: missing bld_trg_cpu", pszFuncName); if (!cchBldType) OS(fatal, NULL, "%s: missing bld_type", pszFuncName); /* * Prepare the keywords, prepending dots for quicker copying. * This allows for an inner loop when processing properties, saving code * at the expense of a few xmallocs. */ /* the first entry is empty. */ aKeys[0].cch = 0; aKeys[0].psz = NULL; /* .$(bld_type) */ aKeys[1].cch = cchBldType + 1; aKeys[1].psz = xmalloc (aKeys[1].cch + 1); aKeys[1].psz[0] = '.'; memcpy(aKeys[1].psz + 1, pszBldType, cchBldType + 1); /* .$(bld_trg) */ aKeys[2].cch = cchBldTrg + 1; aKeys[2].psz = xmalloc (aKeys[2].cch + 1); aKeys[2].psz[0] = '.'; memcpy(aKeys[2].psz + 1, pszBldTrg, cchBldTrg + 1); /* .$(bld_trg).$(bld_trg_arch) */ aKeys[3].cch = cchBldTrg + 1 + cchBldTrgArch + 1; aKeys[3].psz = xmalloc (aKeys[3].cch + 1); aKeys[3].psz[0] = '.'; memcpy(aKeys[3].psz + 1, pszBldTrg, cchBldTrg); aKeys[3].psz[1 + cchBldTrg] = '.'; memcpy(aKeys[3].psz + 1 + cchBldTrg + 1, pszBldTrgArch, cchBldTrgArch + 1); /* .$(bld_trg_cpu) */ aKeys[4].cch = cchBldTrgCpu + 1; aKeys[4].psz = xmalloc (aKeys[4].cch + 1); aKeys[4].psz[0] = '.'; memcpy(aKeys[4].psz + 1, pszBldTrgCpu, cchBldTrgCpu + 1); /* .$(bld_trg_arch) */ aKeys[5].cch = cchBldTrgArch + 1; aKeys[5].psz = xmalloc (aKeys[5].cch + 1); aKeys[5].psz[0] = '.'; memcpy(aKeys[5].psz + 1, pszBldTrgArch, cchBldTrgArch + 1); /* * Prepare the properties, folding them into an array. * This way we won't have to reparse them for each an every target, though * it comes at the expense of one or more heap calls. */ #define PROP_ALLOC_INC 128 iProp = 0; cProps = PROP_ALLOC_INC; paProps = xmalloc(sizeof(*pProps) * cProps); pProps = kbuild_get_variable_n(ST("PROPS_SINGLE")); pszIter = pProps->value; while ((paProps[iProp].pch = find_next_token(&pszIter, &paProps[iProp].cch))) { paProps[iProp].enmType = kPropSingle; if (++iProp >= cProps) { cProps += PROP_ALLOC_INC; paProps = xrealloc(paProps, sizeof(*paProps) * cProps); } } pProps = kbuild_get_variable_n(ST("PROPS_DEFERRED")); pszIter = pProps->value; while ((paProps[iProp].pch = find_next_token(&pszIter, &paProps[iProp].cch))) { paProps[iProp].enmType = kPropDeferred; if (++iProp >= cProps) { cProps += PROP_ALLOC_INC; paProps = xrealloc(paProps, sizeof(*paProps) * cProps); } } pProps = kbuild_get_variable_n(ST("PROPS_ACCUMULATE_L")); pszIter = pProps->value; while ((paProps[iProp].pch = find_next_token(&pszIter, &paProps[iProp].cch))) { paProps[iProp].enmType = kPropAccumulateL; if (++iProp >= cProps) { cProps += PROP_ALLOC_INC; paProps = xrealloc(paProps, sizeof(*paProps) * cProps); } } pProps = kbuild_get_variable_n(ST("PROPS_ACCUMULATE_R")); pszIter = pProps->value; while ((paProps[iProp].pch = find_next_token(&pszIter, &paProps[iProp].cch))) { paProps[iProp].enmType = kPropAccumulateR; if (++iProp >= cProps) { cProps += PROP_ALLOC_INC; paProps = xrealloc(paProps, sizeof(*paProps) * cProps); } } #undef PROP_ALLOC_INC cProps = iProp; /* find the max prop length. */ cchMaxProp = paProps[0].cch; while (--iProp > 0) if (paProps[iProp].cch > cchMaxProp) cchMaxProp = paProps[iProp].cch; /* * Query and prepare (strip) the default template * (given by the TEMPLATE variable). */ pDefTemplate = kbuild_lookup_variable_n(ST("TEMPLATE")); if (pDefTemplate) { if ( pDefTemplate->value_length && ( ISSPACE(pDefTemplate->value[0]) || ISSPACE(pDefTemplate->value[pDefTemplate->value_length - 1]))) { unsigned int off; if (pDefTemplate->rdonly_val) OS(fatal, NULL, "%s: TEMPLATE is read-only", pszFuncName); /* head */ for (off = 0; ISSPACE(pDefTemplate->value[off]); off++) /* nothing */; if (off) { pDefTemplate->value_length -= off; memmove(pDefTemplate->value, pDefTemplate->value + off, pDefTemplate->value_length + 1); } /* tail */ off = pDefTemplate->value_length; while (off > 0 && ISSPACE(pDefTemplate->value[off - 1])) off--; pDefTemplate->value_length = off; pDefTemplate->value[off] = '\0'; VARIABLE_CHANGED(pDefTemplate); } if (!pDefTemplate->value_length) pDefTemplate = NULL; } /* * Iterate the target list. */ pszIter = argv[1]; while ((pszTarget = find_next_token(&pszIter, &cchTarget))) { char *pszTrgProp, *pszSrcProp; char *pszTrgKey, *pszSrcKey; struct variable *pTmpl; const char *pszTmpl; size_t cchTmpl, cchMax; /* resize the target buffer. */ cchMax = cchTarget + cchMaxProp + cchMaxBld + 10; if (cchTrg < cchMax) { cchTrg = (cchMax + 31U) & ~(size_t)31; pszTrg = xrealloc(pszTrg, cchTrg); } /* * Query the TEMPLATE property, if not found or zero-length fall back on the default. */ memcpy(pszTrg, pszTarget, cchTarget); pszTrgProp = pszTrg + cchTarget; memcpy(pszTrgProp, "_TEMPLATE", sizeof("_TEMPLATE")); pszTrgProp++; /* after '_'. */ /** @todo Change this to a recursive lookup with simplification below. That * will allow target_TEMPLATE = $(NO_SUCH_TEMPLATE) instead of having * to use target_TEMPLATE = DUMMY */ pTmpl = kbuild_lookup_variable_n(pszTrg, cchTarget + sizeof("_TEMPLATE") - 1); if (!pTmpl || !pTmpl->value_length) { if (!pDefTemplate) continue; /* no template */ pszTmpl = pDefTemplate->value; cchTmpl = pDefTemplate->value_length; } else { pszTmpl = pTmpl->value; cchTmpl = pTmpl->value_length; while (ISSPACE(*pszTmpl)) cchTmpl--, pszTmpl++; if (!cchTmpl) continue; /* no template */ } /* resize the source buffer. */ cchMax = sizeof("TEMPLATE_") + cchTmpl + cchMaxProp + cchMaxBld + 10 + sizeof(void *); if (cchSrcBuf < cchMax) { cchSrcBuf = (cchMax + 31U) & ~(size_t)31; pszSrcBuf = xrealloc(pszSrcBuf, cchSrcBuf); pszSrc = pszSrcBuf + sizeof(void *); assert(sizeof(void *) >= 2); pszSrcRef = pszSrc - 2; pszSrcRef[0] = '$'; pszSrcRef[1] = '('; } /* prepare the source buffer */ memcpy(pszSrc, "TEMPLATE_", sizeof("TEMPLATE_") - 1); pszSrcProp = pszSrc + sizeof("TEMPLATE_") - 1; memcpy(pszSrcProp, pszTmpl, cchTmpl); pszSrcProp += cchTmpl; *pszSrcProp++ = '_'; /* * Process properties. * Note! The single and deferred are handled in the same way now. */ #define BY_REF_LIMIT 64 /*(cchSrcVar * 4 > 64 ? cchSrcVar * 4 : 64)*/ for (iProp = 0; iProp < cProps; iProp++) { memcpy(pszTrgProp, paProps[iProp].pch, paProps[iProp].cch); pszTrgKey = pszTrgProp + paProps[iProp].cch; memcpy(pszSrcProp, paProps[iProp].pch, paProps[iProp].cch); pszSrcKey = pszSrcProp + paProps[iProp].cch; for (iKey = 0; iKey < cKeys; iKey++) { char *pszTrgEnd; size_t cchSrcVar; /* lookup source, skip ahead if it doesn't exist. */ memcpy(pszSrcKey, aKeys[iKey].psz, aKeys[iKey].cch); cchSrcVar = pszSrcKey - pszSrc + aKeys[iKey].cch; pszSrc[cchSrcVar] = '\0'; pVarSrc = kbuild_query_recursive_variable_n(pszSrc, cchSrcVar); if (!pVarSrc) continue; /* lookup target, skip ahead if it exists. */ memcpy(pszTrgKey, aKeys[iKey].psz, aKeys[iKey].cch); pszTrgEnd = pszTrgKey + aKeys[iKey].cch; *pszTrgEnd = '\0'; pVarTrg = kbuild_query_recursive_variable_n(pszTrg, pszTrgEnd - pszTrg); switch (paProps[iProp].enmType) { case kPropAccumulateL: case kPropAccumulateR: if (pVarTrg) { /* Append to existing variable. If the source is recursive, or we append by reference, we'll have to make sure the target is recusive as well. */ if ( !pVarTrg->recursive && ( pVarSrc->value_length >= BY_REF_LIMIT || pVarSrc->recursive)) pVarTrg->recursive = 1; if (pVarSrc->value_length < BY_REF_LIMIT) append_string_to_variable(pVarTrg, pVarSrc->value, pVarSrc->value_length, paProps[iProp].enmType == kPropAccumulateL /* append */); else { pszSrc[cchSrcVar] = ')'; pszSrc[cchSrcVar + 1] = '\0'; append_string_to_variable(pVarTrg, pszSrcRef, 2 + cchSrcVar + 1, paProps[iProp].enmType == kPropAccumulateL /* append */); } break; } /* else: the target variable doesn't exist, create it. */ /* fall thru */ case kPropSingle: case kPropDeferred: if (pVarTrg) continue; /* skip ahead if it already exists. */ /* copy the variable if its short, otherwise reference it. */ if (pVarSrc->value_length < BY_REF_LIMIT) define_variable_vl_global(pszTrg, pszTrgEnd - pszTrg, pVarSrc->value, pVarSrc->value_length, 1 /* duplicate_value */, o_file, pVarSrc->recursive, NULL /* flocp */); else { pszSrc[cchSrcVar] = ')'; pszSrc[cchSrcVar + 1] = '\0'; define_variable_vl_global(pszTrg, pszTrgEnd - pszTrg, pszSrcRef, 2 + cchSrcVar + 1, 1 /* duplicate_value */, o_file, 1 /* recursive */, NULL /* flocp */); } break; } } /* foreach key */ } /* foreach prop */ #undef BY_REF_LIMIT } /* foreach target */ /* * Cleanup. */ free(pszSrcBuf); free(pszTrg); free(paProps); for (iKey = 1; iKey < cKeys; iKey++) free(aKeys[iKey].psz); return o; } #endif /* KMK_HELPERS */ kbuild-3608/src/kmk/ar.c0000664000175000017500000002044714670377414015051 0ustar locutuslocutus/* Interface to 'ar' archives for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #ifndef NO_ARCHIVES #include "filedef.h" #include "dep.h" #include /* Return nonzero if NAME is an archive-member reference, zero if not. An archive-member reference is a name like 'lib(member)' where member is a non-empty string. If a name like 'lib((entry))' is used, a fatal error is signaled at the attempt to use this unsupported feature. */ int ar_name (const char *name) { const char *p = strchr (name, '('); const char *end; if (p == 0 || p == name) return 0; end = p + strlen (p) - 1; if (*end != ')' || end == p + 1) return 0; if (p[1] == '(' && end[-1] == ')') OS (fatal, NILF, _("attempt to use unsupported feature: '%s'"), name); return 1; } /* Parse the archive-member reference NAME into the archive and member names. Creates one allocated string containing both names, pointed to by ARNAME_P. MEMNAME_P points to the member. */ void ar_parse_name (const char *name, char **arname_p, char **memname_p) { char *p; *arname_p = xstrdup (name); p = strchr (*arname_p, '('); *(p++) = '\0'; p[strlen (p) - 1] = '\0'; *memname_p = p; } /* This function is called by 'ar_scan' to find which member to look at. */ /* ARGSUSED */ static long int ar_member_date_1 (int desc UNUSED, const char *mem, int truncated, long int hdrpos UNUSED, long int datapos UNUSED, long int size UNUSED, long int date, int uid UNUSED, int gid UNUSED, unsigned int mode UNUSED, const void *name) { return ar_name_equal (name, mem, truncated) ? date : 0; } /* Return the modtime of NAME. */ time_t ar_member_date (const char *name) { char *arname; char *memname; long int val; ar_parse_name (name, &arname, &memname); /* Make sure we know the modtime of the archive itself because we are likely to be called just before commands to remake a member are run, and they will change the archive itself. But we must be careful not to enter_file the archive itself if it does not exist, because pattern_search assumes that files found in the data base exist or can be made. */ { struct file *arfile; arfile = lookup_file (arname); if (arfile == 0 && file_exists_p (arname)) arfile = enter_file (strcache_add (arname)); if (arfile != 0) (void) f_mtime (arfile, 0); } val = ar_scan (arname, ar_member_date_1, memname); free (arname); return (val <= 0 ? (time_t) -1 : (time_t) val); } /* Set the archive-member NAME's modtime to now. */ #ifdef VMS int ar_touch (const char *name) { O (error, NILF, _("touch archive member is not available on VMS")); return -1; } #else int ar_touch (const char *name) { char *arname, *memname; int val; ar_parse_name (name, &arname, &memname); /* Make sure we know the modtime of the archive itself before we touch the member, since this will change the archive modtime. */ { struct file *arfile; arfile = enter_file (strcache_add (arname)); f_mtime (arfile, 0); } val = 1; switch (ar_member_touch (arname, memname)) { case -1: OS (error, NILF, _("touch: Archive '%s' does not exist"), arname); break; case -2: OS (error, NILF, _("touch: '%s' is not a valid archive"), arname); break; case -3: perror_with_name ("touch: ", arname); break; case 1: OSS (error, NILF, _("touch: Member '%s' does not exist in '%s'"), memname, arname); break; case 0: val = 0; break; default: OS (error, NILF, _("touch: Bad return code from ar_member_touch on '%s'"), name); } free (arname); return val; } #endif /* !VMS */ /* State of an 'ar_glob' run, passed to 'ar_glob_match'. */ /* On VMS, (object) modules in libraries do not have suffixes. That is, to find a match for a pattern, the pattern must not have any suffix. So the suffix of the pattern is saved and the pattern is stripped (ar_glob). If there is a match and the match, which is a module name, is added to the chain, the saved suffix is added back to construct a source filename (ar_glob_match). */ struct ar_glob_state { const char *arname; const char *pattern; #ifdef VMS char *suffix; #endif unsigned int size; struct nameseq *chain; unsigned int n; }; /* This function is called by 'ar_scan' to match one archive element against the pattern in STATE. */ static long int ar_glob_match (int desc UNUSED, const char *mem, int truncated UNUSED, long int hdrpos UNUSED, long int datapos UNUSED, long int size UNUSED, long int date UNUSED, int uid UNUSED, int gid UNUSED, unsigned int mode UNUSED, const void *arg) { struct ar_glob_state *state = (struct ar_glob_state *)arg; if (fnmatch (state->pattern, mem, FNM_PATHNAME|FNM_PERIOD) == 0) { /* We have a match. Add it to the chain. */ struct nameseq *new = xcalloc (state->size); #ifdef VMS if (state->suffix) new->name = strcache_add( concat(5, state->arname, "(", mem, state->suffix, ")")); else #endif new->name = strcache_add(concat(4, state->arname, "(", mem, ")")); new->next = state->chain; state->chain = new; ++state->n; } return 0L; } /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ static int ar_glob_pattern_p (const char *pattern, int quote) { const char *p; int opened = 0; for (p = pattern; *p != '\0'; ++p) switch (*p) { case '?': case '*': return 1; case '\\': if (quote) ++p; break; case '[': opened = 1; break; case ']': if (opened) return 1; break; } return 0; } /* Glob for MEMBER_PATTERN in archive ARNAME. Return a malloc'd chain of matching elements (or nil if none). */ struct nameseq * ar_glob (const char *arname, const char *member_pattern, unsigned int size) { struct ar_glob_state state; struct nameseq *n; const char **names; unsigned int i; #ifdef VMS char *vms_member_pattern; #endif if (! ar_glob_pattern_p (member_pattern, 1)) return 0; /* Scan the archive for matches. ar_glob_match will accumulate them in STATE.chain. */ state.arname = arname; state.pattern = member_pattern; #ifdef VMS { /* In a copy of the pattern, find the suffix, save it and remove it from the pattern */ char *lastdot; vms_member_pattern = xstrdup(member_pattern); lastdot = strrchr(vms_member_pattern, '.'); state.suffix = lastdot; if (lastdot) { state.suffix = xstrdup(lastdot); *lastdot = 0; } state.pattern = vms_member_pattern; } #endif state.size = size; state.chain = 0; state.n = 0; ar_scan (arname, ar_glob_match, &state); #ifdef VMS /* Deallocate any duplicated string */ free(vms_member_pattern); if (state.suffix) { free(state.suffix); } #endif if (state.chain == 0) return 0; /* Now put the names into a vector for sorting. */ names = alloca (state.n * sizeof (const char *)); i = 0; for (n = state.chain; n != 0; n = n->next) names[i++] = n->name; /* Sort them alphabetically. */ /* MSVC erroneously warns without a cast here. */ qsort ((void *)names, i, sizeof (*names), alpha_compare); /* Put them back into the chain in the sorted order. */ i = 0; for (n = state.chain; n != 0; n = n->next) n->name = names[i++]; return state.chain; } #endif /* Not NO_ARCHIVES. */ kbuild-3608/src/kmk/configure.ac0000664000175000017500000004411514670377413016566 0ustar locutuslocutus# Process this file with autoconf to produce a configure script. # # Copyright (C) 1993-2016 Free Software Foundation, Inc. # This file is part of GNU Make. # # GNU Make 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. # # GNU Make 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 . AC_INIT([GNU make],[4.2.1],[bug-make@gnu.org]) AC_PREREQ([2.69]) # Autoconf setup AC_CONFIG_AUX_DIR([config]) AC_CONFIG_SRCDIR([vpath.c]) AC_CONFIG_HEADERS([config.h]) # Automake setup # We have to enable "foreign" because ChangeLog is auto-generated # We cannot enable -Werror because gettext 0.18.1 has invalid content # When we update gettext to 0.18.3 or better we can add it again. # bird: Added subdir-objects AM_INIT_AUTOMAKE([1.15 foreign -Werror -Wall subdir-objects]) # Checks for programs. AC_USE_SYSTEM_EXTENSIONS AC_PROG_CC AC_PROG_INSTALL AC_PROG_RANLIB AC_PROG_CPP AC_CHECK_PROG([AR], [ar], [ar], [ar]) # Perl is needed for the test suite (only) AC_CHECK_PROG([PERL], [perl], [perl], [perl]) # Needed for w32/Makefile.am AM_PROG_AR # Specialized system macros AC_CANONICAL_HOST AC_AIX AC_ISC_POSIX AC_MINIX # Enable gettext, in "external" mode. # bird: causes trouble when it doesn't find 'po' in SUBDIRS, so skip it. #AM_GNU_GETTEXT_VERSION([0.19.4]) #AM_GNU_GETTEXT([external]) # This test must come as early as possible after the compiler configuration # tests, because the choice of the file model can (in principle) affect # whether functions and headers are available, whether they work, etc. AC_SYS_LARGEFILE # Checks for libraries. AC_SEARCH_LIBS([getpwnam], [sun]) # Checks for header files. AC_HEADER_STDC AC_HEADER_DIRENT AC_HEADER_STAT AC_HEADER_TIME AC_CHECK_HEADERS([stdlib.h locale.h unistd.h limits.h fcntl.h string.h \ memory.h sys/param.h sys/resource.h sys/time.h sys/timeb.h \ sys/select.h]) AM_PROG_CC_C_O AC_C_CONST AC_TYPE_SIGNAL AC_TYPE_UID_T AC_TYPE_PID_T AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINTMAX_T # Find out whether our struct stat returns nanosecond resolution timestamps. AC_STRUCT_ST_MTIM_NSEC AC_STRUCT_ST_ATIM_NSEC AC_CACHE_CHECK([whether to use high resolution file timestamps], [make_cv_file_timestamp_hi_res], [ make_cv_file_timestamp_hi_res=no AS_IF([test "$ac_cv_struct_st_mtim_nsec" != no], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #if HAVE_INTTYPES_H # include #endif]], [[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])], [make_cv_file_timestamp_hi_res=yes]) ])]) AS_IF([test "$make_cv_file_timestamp_hi_res" = yes], [val=1], [val=0]) AC_DEFINE_UNQUOTED([FILE_TIMESTAMP_HI_RES], [$val], [Use high resolution file timestamps if nonzero.]) AS_IF([test "$make_cv_file_timestamp_hi_res" = yes], [ # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function. # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. AC_SEARCH_LIBS([clock_gettime], [rt posix4]) AS_IF([test "$ac_cv_search_clock_gettime" != no], [ AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define to 1 if you have the clock_gettime function.]) ]) ]) # Check for DOS-style pathnames. pds_AC_DOS_PATHS # See if we have a standard version of gettimeofday(). Since actual # implementations can differ, just make sure we have the most common # one. AC_CACHE_CHECK([for standard gettimeofday], [ac_cv_func_gettimeofday], [ac_cv_func_gettimeofday=no AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #include /* kmk/darwin: for exit */ int main () { struct timeval t; t.tv_sec = -1; t.tv_usec = -1; exit (gettimeofday (&t, 0) != 0 || t.tv_sec < 0 || t.tv_usec < 0); }]])], [ac_cv_func_gettimeofday=yes], [ac_cv_func_gettimeofday=no], [ac_cv_func_gettimeofday="no (cross-compiling)"])]) AS_IF([test "$ac_cv_func_gettimeofday" = yes], [ AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [Define to 1 if you have a standard gettimeofday function]) ]) AC_CHECK_FUNCS([strdup strndup mkstemp mktemp fdopen fileno \ dup dup2 getcwd realpath sigsetmask sigaction \ getgroups seteuid setegid setlinebuf setreuid setregid \ getrlimit setrlimit setvbuf pipe strerror strsignal \ lstat readlink atexit isatty ttyname pselect]) # We need to check declarations, not just existence, because on Tru64 this # function is not declared without special flags, which themselves cause # other problems. We'll just use our own. AC_CHECK_DECLS([bsd_signal], [], [], [[#define _GNU_SOURCE 1 #include ]]) AC_FUNC_FORK AC_FUNC_SETVBUF_REVERSED # Rumor has it that strcasecmp lives in -lresolv on some odd systems. # It doesn't hurt much to use our own if we can't find it so I don't # make the effort here. AC_CHECK_FUNCS([strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp]) # strcoll() is used by the GNU glob library AC_FUNC_STRCOLL AC_FUNC_ALLOCA AC_FUNC_CLOSEDIR_VOID # bird: This guile detection does not work on rhel4. Disabled it all since we doesn't care about guile. ## See if the user wants to add (or not) GNU Guile support #PKG_PROG_PKG_CONFIG #AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile], # [Support GNU Guile for embedded scripting])]) # ## For some strange reason, at least on Ubuntu, each version of Guile ## comes with it's own PC file so we have to specify them as individual ## packages. Ugh. #AS_IF([test "x$with_guile" != xno], #[ PKG_CHECK_MODULES([GUILE], [guile-2.0], [have_guile=yes], # [PKG_CHECK_MODULES([GUILE], [guile-1.8], [have_guile=yes], # [have_guile=no])]) #]) # #AS_IF([test "$have_guile" = yes], # [AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])]) # #AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = yes]) AC_FUNC_GETLOADAVG # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it # doesn't. So, we will. AS_IF([test "$ac_cv_header_nlist_h" = yes], [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[struct nlist nl; nl.n_name = "string"; return 0;]])], [make_cv_nlist_struct=yes], [make_cv_nlist_struct=no]) AS_IF([test "$make_cv_nlist_struct" = yes], [ AC_DEFINE([NLIST_STRUCT], [1], [Define to 1 if struct nlist.n_name is a pointer rather than an array.]) ]) ]) AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , , [AC_INCLUDES_DEFAULT #include /* NetBSD declares sys_siglist in unistd.h. */ #if HAVE_UNISTD_H # include #endif ]) # Check out the wait reality. AC_CHECK_HEADERS([sys/wait.h],[],[],[[#include ]]) AC_CHECK_FUNCS([waitpid wait3]) AC_CACHE_CHECK([for union wait], [make_cv_union_wait], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include #include ]], [[union wait status; int pid; pid = wait (&status); #ifdef WEXITSTATUS /* Some POSIXoid systems have both the new-style macros and the old union wait type, and they do not work together. If union wait conflicts with WEXITSTATUS et al, we don't want to use it at all. */ if (WEXITSTATUS (status) != 0) pid = -1; #ifdef WTERMSIG /* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */ -- blow chunks here -- #endif #endif #ifdef HAVE_WAITPID /* Make sure union wait works with waitpid. */ pid = waitpid (-1, &status, 0); #endif ]])], [make_cv_union_wait=yes], [make_cv_union_wait=no]) ]) AS_IF([test "$make_cv_union_wait" = yes], [ AC_DEFINE([HAVE_UNION_WAIT], [1], [Define to 1 if you have the 'union wait' type in .]) ]) # If we're building on Windows/DOS/OS/2, add some support for DOS drive specs. AS_IF([test "$PATH_SEPARATOR" = ';'], [ AC_DEFINE([HAVE_DOS_PATHS], [1], [Define to 1 if your system requires backslashes or drive specs in pathnames.]) ]) # See if the user wants to use pmake's "customs" distributed build capability AC_SUBST([REMOTE]) REMOTE=stub use_customs=false AC_ARG_WITH([customs], [AC_HELP_STRING([--with-customs=DIR], [enable remote jobs via Customs--see README.customs])], [ AS_CASE([$withval], [n|no], [:], [make_cppflags="$CPPFLAGS" AS_CASE([$withval], [y|ye|yes], [:], [CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs" make_ldflags="$LDFLAGS -L$with_customs/lib"]) CF_NETLIBS AC_CHECK_HEADER([customs.h], [use_customs=true REMOTE=cstms LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"], [with_customs=no CPPFLAGS="$make_cppflags" make_badcust=yes]) ]) ]) # Tell automake about this, so it can include the right .c files. AM_CONDITIONAL([USE_CUSTOMS], [test "$use_customs" = true]) # See if the user asked to handle case insensitive file systems. AH_TEMPLATE([HAVE_CASE_INSENSITIVE_FS], [Use case insensitive file names]) AC_ARG_ENABLE([case-insensitive-file-system], AC_HELP_STRING([--enable-case-insensitive-file-system], [assume file systems are case insensitive]), [AS_IF([test "$enableval" = yes], [AC_DEFINE([HAVE_CASE_INSENSITIVE_FS])])]) # See if we can handle the job server feature, and if the user wants it. AC_ARG_ENABLE([job-server], AC_HELP_STRING([--disable-job-server], [disallow recursive make communication during -jN]), [make_cv_job_server="$enableval" user_job_server="$enableval"], [make_cv_job_server="yes"]) AS_IF([test "$ac_cv_func_waitpid" = no && test "$ac_cv_func_wait3" = no], [has_wait_nohang=no], [has_wait_nohang=yes]) AC_CACHE_CHECK([for SA_RESTART], [make_cv_sa_restart], [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[return SA_RESTART;]])], [make_cv_sa_restart=yes], [make_cv_sa_restart=no])]) AS_IF([test "$make_cv_sa_restart" != no], [ AC_DEFINE([HAVE_SA_RESTART], [1], [Define to 1 if defines the SA_RESTART constant.]) ]) # Only allow jobserver on systems that support it AS_CASE([/$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/], [*/no/*], [make_cv_job_server=no]) # Also supported on OS2 and MinGW AS_CASE([$host_os], [os2*|mingw*], [make_cv_job_server=yes]) # If we support it and the user didn't disable it, build with jobserver AS_CASE([/$make_cv_job_server/$user_job_server/], [*/no/*], [: no jobserver], [AC_DEFINE(MAKE_JOBSERVER, 1, [Define to 1 to enable job server support in GNU make.]) ]) # If dl*() functions are supported we can enable the load operation AC_CHECK_DECLS([dlopen, dlsym, dlerror], [], [], [[#include ]]) AC_ARG_ENABLE([load], AC_HELP_STRING([--disable-load], [disable support for the 'load' operation]), [make_cv_load="$enableval" user_load="$enableval"], [make_cv_load="yes"]) AS_CASE([/$ac_cv_have_decl_dlopen/$ac_cv_have_decl_dlsym/$ac_cv_have_decl_dlerror/], [*/no/*], [make_cv_load=no]) # We might need -ldl AS_IF([test "$make_cv_load" = yes], [ AC_SEARCH_LIBS([dlopen], [dl], [], [make_cv_load=]) ]) AS_CASE([/$make_cv_load/$user_load/], [*/no/*], [make_cv_load=no], [AC_DEFINE(MAKE_LOAD, 1, [Define to 1 to enable 'load' support in GNU make.]) ]) # If we want load support, we might need to link with export-dynamic. # See if we can figure it out. Unfortunately this is very difficult. # For example passing -rdynamic to the SunPRO linker gives a warning # but succeeds and creates a shared object, not an executable! AS_IF([test "$make_cv_load" = yes], [ AC_MSG_CHECKING([If the linker accepts -Wl,--export-dynamic]) old_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])], [AC_MSG_RESULT([yes]) AC_SUBST([AM_LDFLAGS], [-Wl,--export-dynamic])], [AC_MSG_RESULT([no]) AC_MSG_CHECKING([If the linker accepts -rdynamic]) LDFLAGS="$old_LDFLAGS -rdynamic" AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])], [AC_MSG_RESULT([yes]) AC_SUBST([AM_LDFLAGS], [-rdynamic])], [AC_MSG_RESULT([no])]) ]) LDFLAGS="$old_LDFLAGS" ]) # if we have both lstat() and readlink() then we can support symlink # timechecks. AS_IF([test "$ac_cv_func_lstat" = yes && test "$ac_cv_func_readlink" = yes], [ AC_DEFINE([MAKE_SYMLINKS], [1], [Define to 1 to enable symbolic link timestamp checking.]) ]) # Find the SCCS commands, so we can include them in our default rules. AC_CACHE_CHECK([for location of SCCS get command], [make_cv_path_sccs_get], [ AS_IF([test -f /usr/sccs/get], [make_cv_path_sccs_get=/usr/sccs/get], [make_cv_path_sccs_get=get]) ]) AC_DEFINE_UNQUOTED([SCCS_GET], ["$make_cv_path_sccs_get"], [Define to the name of the SCCS 'get' command.]) ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later. AS_IF([(/usr/sccs/admin -n s.conftest || admin -n s.conftest) >/dev/null 2>&1 && test -f s.conftest], [ # We successfully created an SCCS file. AC_CACHE_CHECK([if SCCS get command understands -G], [make_cv_sys_get_minus_G], [AS_IF([$make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 && test -f conftoast], [make_cv_sys_get_minus_G=yes], [make_cv_sys_get_minus_G=no]) ]) AS_IF([test "$make_cv_sys_get_minus_G" = yes], [AC_DEFINE([SCCS_GET_MINUS_G], [1], [Define to 1 if the SCCS 'get' command understands the '-G' option.]) ]) ]) rm -f s.conftest conftoast ## bird: always use our glob impl. Avoids trouble with newish glibc. # Check the system to see if it provides GNU glob. If not, use our # local version. #x# AC_CACHE_CHECK([if system libc has GNU glob], [make_cv_sys_gnu_glob], #x# [ AC_EGREP_CPP([gnu glob],[ #x# #include #x# #include #x# #include #x# #x# #define GLOB_INTERFACE_VERSION 1 #x# #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 #x# # include #x# # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION #x# gnu glob #x# # endif #x# #endif], #x# [make_cv_sys_gnu_glob=yes], #x# [make_cv_sys_gnu_glob=no])]) #x# AS_IF([test "$make_cv_sys_gnu_glob" = no], AS_IF([test yes = yes], [ GLOBINC='-I$(srcdir)/glob' GLOBLIB=glob/libglob.a make_cv_sys_gnu_glob=no ]) AC_SUBST([GLOBINC]) AC_SUBST([GLOBLIB]) # Tell automake about this, so it can build the right .c files. AM_CONDITIONAL([USE_LOCAL_GLOB], [test "$make_cv_sys_gnu_glob" = no]) # Let the makefile know what our build host is AC_DEFINE_UNQUOTED([MAKE_HOST],["$host"],[Build host information.]) MAKE_HOST="$host" AC_SUBST([MAKE_HOST]) w32_target_env=no AM_CONDITIONAL([WINDOWSENV], [false]) AS_CASE([$host], [*-*-mingw32], [AM_CONDITIONAL([WINDOWSENV], [true]) w32_target_env=yes AC_DEFINE([WINDOWS32], [1], [Use platform specific coding]) AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding]) ]) AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'], [Define to the character that separates directories in PATH.]) # Include the Maintainer's Makefile section, if it's here. MAINT_MAKEFILE=/dev/null AS_IF([test -r "$srcdir/maintMakefile"], [ MAINT_MAKEFILE="$srcdir/maintMakefile" ]) AC_SUBST_FILE([MAINT_MAKEFILE]) # Allow building with dmalloc AM_WITH_DMALLOC # Forcibly disable SET_MAKE. If it's set it breaks things like the test # scripts, etc. SET_MAKE= # Sanity check and inform the user of what we found AS_IF([test "x$make_badcust" = xyes], [ echo echo "WARNING: --with-customs specified but no customs.h could be found;" echo " disabling Customs support." echo ]) AS_CASE([$with_customs], [""|n|no|y|ye|yes], [:], [AS_IF([test -f "$with_customs/lib/libcustoms.a"], [:], [ echo echo "WARNING: '$with_customs/lib' does not appear to contain the" echo " Customs library. You must build and install Customs" echo " before compiling GNU make." echo ])]) AS_IF([test "x$has_wait_nohang" = xno], [ echo echo "WARNING: Your system has neither waitpid() nor wait3()." echo " Without one of these, signal handling is unreliable." echo " You should be aware that running GNU make with -j" echo " could result in erratic behavior." echo ]) AS_IF([test "x$make_cv_job_server" = xno && test "x$user_job_server" = xyes], [ echo echo "WARNING: Make job server requires a POSIX-ish system that" echo " supports the pipe(), sigaction(), and either" echo " waitpid() or wait3() functions. Your system doesn't" echo " appear to provide one or more of those." echo " Disabling job server support." echo ]) AS_IF([test "x$make_cv_load" = xno && test "x$user_load" = xyes], [ echo echo "WARNING: 'load' support requires a POSIX-ish system that" echo " supports the dlopen(), dlsym(), and dlerror() functions." echo " Your system doesn't appear to provide one or more of these." echo " Disabling 'load' support." echo ]) # Specify what files are to be created. # bird: Removed po/Makefile.in. #AC_CONFIG_FILES([Makefile glob/Makefile po/Makefile.in config/Makefile \ # doc/Makefile w32/Makefile tests/config-flags.pm]) AC_CONFIG_FILES([Makefile glob/Makefile config/Makefile \ doc/Makefile w32/Makefile tests/config-flags.pm]) # OK, do it! AC_OUTPUT # We only generate the build.sh if we have a build.sh.in; we won't have # one before we've created a distribution. AS_IF([test -f "$srcdir/build.sh.in"], [ ./config.status --file build.sh chmod +x build.sh ]) dnl Local Variables: dnl comment-start: "dnl " dnl comment-end: "" dnl comment-start-skip: "\\bdnl\\b\\s *" dnl compile-command: "make configure config.h.in" dnl End: kbuild-3608/src/kmk/testcase-includedep-esc-sub.kmk0000664000175000017500000000613514670377413022270 0ustar locutuslocutus# $Id: testcase-includedep-esc-sub.kmk 3318 2020-04-01 07:05:32Z bird $ ## @file # kBuild - testcase for the includdep directive with filename escaping, helper # file that gets included. # # # Copyright (c) 2007-2020 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # testcase-includedep-esc-sub.kmk=included # spaces /phoney/file-with-two-spaces\ \ .c: \ /phoney/header-file-with-two-spaces\ \ .h # # From example-spaces.kmk # /phoney-dep-ignore: phoney\ space\ \ 1: /phoney-dep\ space\ \ 1 phoney\ colon\:\ 2: /phoney-dep\ colon\:\ 2 \ phoney\ hash\#\ 3 : /phoney-dep\ hash\#\ 3 phoney\ dollar$$\ 4 : /phoney-dep\ dollar$$\ 4 \ phoney\ slash-space\\\ 5: /phoney-dep\ slash-space\\\ 5 phoney\ slash-hash\\\#\ 6: /phoney-dep\ slash-hash\\\#\ 6 \ phoney\ slash-slash-hash\\\\\#\ 7: /phoney-dep\ slash-slash-hash\\\\\#\ 7 phoney\ equal\=\ 8: /phoney-dep\ equal\=\ 8 phoney\ semI\;\ 9: /phoney-dep\ semi\;\ 9 # Note! The percent is only escaped on the target side! phoney\ percent\%\ 10: /phoney-dep\ percent%\ 10 \ # Note! The pipe is only escaped on the dependency list side! phoney\ pipe|\ 11: /phoney-dep\ pipe\|\ 11 phoney\ plus+\ 12: \ /phoney-dep\ plus+\ 12 phoney\ trailing-slash13\\: /phoney-dep\ trailing-slash13\ \ phoney\ trailing-slash13b\\: /phoney-dep\ trailing-slash13b\ \ \ \ \ phoney\ trailing-slash14\\: \ /phoney-dep\ trailing-slash14\\ \ /phoney-dep-ignore phoney\ 15-trailing-space\ : /phoney-dep\ 15-trailing-space\ /phoney-dep-ignore # Note! No stripping spaces! Trailing space here that gets stripped instead of escaped. phoney\ 16-no-trailing-space\\: /phoney-dep\ 16-no-trailing-space\ phoney\ 17-3x-escaped-newlines\ becomes-single-space: /phoney-dep\ 17-3x-escaped-newlines\ \ \ \ becomes-single-space # Note! Must have a trailing space or comment. phoney\ 18-3x-escaped-trailing-spaces-no-newline\ \ \\: \ /phoney-dep\ 18-3x-escaped-trailing-spaces-no-newline\ \ \ phoney\ 19-target-trailing-space-with-padding\ : /phoney-dep\ 19-target-trailing-space-with-padding\ /phoney-dep-ignore phoney\ 20-target-trailing-space-with-newline-padding\ \ \ : /phoney-dep\ 20-target-trailing-space-with-newline-padding\ /phoney-dep-ignore phoney\ 21-target-trailing-space-with-newline-padding-and-tail\ \ \ \ \ my-tail-21: /phoney-dep\ 21-target-trailing-space-with-newline-padding-and-tail\ \ \ \ my-tail-21 all-trailing-slashes1: /phoney-dep\ trailing-slash13\ \ all-trailing-slashes2: /phoney-dep\ trailing-slash13b\ \ \ \ \ kbuild-3608/src/kmk/TODO.private0000664000175000017500000001276514670377414016450 0ustar locutuslocutus -*-Indented-Text-*- GNU Make TODO List ------------------ This list comes both from the authors and from users of GNU make. They are listed in no particular order! Also, I don't guarantee that all of them will be ultimately deemed "good ideas" and implemented. These are just the ones that, at first blush, seem to have some merit (and that I can remember). However, if you see something here you really, really want, speak up. All other things being equal, I will tend to implement things that seem to maximize user satisfaction. If you want to implement some of them yourself, barring the ones I've marked below, have at it! Please contact me first to let me know you're working on it, and give me some info about the design--and, critically, information about any user-visible syntax change, etc. The Top Item ------------ If you know perl (or want to learn DejaGNU or similar), the number one priority on my list of things I don't have time to do right now is fixing up the GNU make test suite. Most importantly it needs to be made "parallelizable", so more than one regression can run at the same time (essentially, make the "work" directory local). Also, the CWD during the test should be in the work directory or, better, a test-specific temporary directory so each test gets a new directory; right now sometimes tests leak files into the main directory which causes subsequent tests to fail (some tests may need to be tweaked). Beyond that, any cleanup done to make writing, reading, or handling tests simpler would be great! Please feel free to make whatever changes you like to the current tests, given some high-level goals, and that you'll port the current tests to whatever you do :). The Rest of the List -------------------- 1) Option to check more than timestamps to determine if targets have changed. This is also a very big one. It's _close_ to my plate :), and I have very definite ideas about how I would like it done. Please pick something else unless you must have this feature. If you try it, please work _extremely_ closely with me on it. 1a) Possibly a special case of this is the .KEEP_STATE feature of Sun's make. Some great folks at W U. in Canada did an implementation of this for a class project. Their approach is reasonable and workable, but doesn't really fit into my ideas for #2. Maybe that's OK. I have paperwork for their work so if you want to do this one talk to me to get what they've already done. [K R Praveen ] 2) Currently you can use "%.foo %.bar : %.baz" to mean that one invocation of the rule builds both targets. GNU make needs a way to do that for explicit rules, too. I heard a rumor that some versions of make all you to say "a.foo + a.bar : a.baz" to do this (i.e., a "+" means one invocation builds both). Don't know if this is the best syntax or not... what if you say "a.foo + a.bar a.bam : a.baz"; what does that mean? 3) Multi-token pattern rule matching (allow %1/%2.c : %1/obj/%2.o, etc., or something like that). Maybe using regex? 4) Provide a .TARGETS variable, containing the names of the targets defined in the makefile. Actually, I now think a $(targets ...) function, at least, might be better than a MAKETARGETS variable. The argument would be types of targets to list: "phony" is the most useful one. I suppose "default" might also be useful. Maybe some others; check the bitfields to see what might be handy. 5) Some sort of operating-system independent way of handling paths would be outstanding, so makefiles can be written for UNIX, VMS, DOS, MS-Windows, Amiga, etc. with a minimum of specialization. Or, perhaps related/instead of, some sort of meta-quoting syntax so make can deal with filenames containing spaces, colons, etc. I dunno, maybe something like $[...]? This may well not be worth doing until #1 is done. 6) Right now the .PRECIOUS, .INTERMEDIATE, and .SECONDARY pseudo-targets have different capabilities. For example, .PRECIOUS can take a "%", the others can't. Etc. These should all work the same, insofar as that makes sense. 7) Improved debugging/logging/etc. capabilities. Part of this is done: I introduced a number of debugging enhancements. Tim Magill is (I think) looking into options to control output more selectively. One thing I want to do in debugging is add a flag to allow debugging of variables as they're expanded (!). This would be incredibly verbose, but could be invaluable when nothing else seems to work and you just can't figure it out. The way variables are expanded now means this isn't 100% trivial, but it probably won't be hard. ------------------------------------------------------------------------------- Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . kbuild-3608/src/kmk/kbuild.h0000664000175000017500000000724414670377414015726 0ustar locutuslocutus/* $Id: kbuild.h 3140 2018-03-14 21:28:10Z bird $ */ /** @file * kBuild specific make functionality. */ /* * Copyright (c) 2006-2010 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ #ifndef ___kBuild_h #define ___kBuild_h char *func_kbuild_source_tool(char *o, char **argv, const char *pszFuncName); char *func_kbuild_object_base(char *o, char **argv, const char *pszFuncName); char *func_kbuild_object_suffix(char *o, char **argv, const char *pszFuncName); char *func_kbuild_source_prop(char *o, char **argv, const char *pszFuncName); char *func_kbuild_source_one(char *o, char **argv, const char *pszFuncName); char *func_kbuild_expand_template(char *o, char **argv, const char *pszFuncName); void init_kbuild(int argc, char **argv); const char *get_kbuild_path(void); const char *get_kbuild_bin_path(void); const char *get_default_kbuild_shell(void); /** @name kBuild objects * @{ */ struct kbuild_eval_data; struct kbuild_object; extern struct kbuild_eval_data *g_pTopKbEvalData; /** Special return value indicating variable name isn't an accessor. */ #define KOBJ_NOT_KBUILD_ACCESSOR ( (struct kbuild_object *)~(size_t)0 ) /** Special lookup_kbuild_object_variable return value. */ #define VAR_NOT_KBUILD_ACCESSOR ( (struct variable *)~(size_t)0 ) struct variable *lookup_kbuild_object_variable_accessor(const char *pchName, size_t cchName); int is_kbuild_object_variable_accessor(const char *pchName, size_t cchName); struct variable *try_define_kbuild_object_variable_via_accessor(const char *pszName, size_t cchName, const char *pszValue, size_t cchValue, int fDuplicateValue, enum variable_origin enmOrigin, int fRecursive, floc const *pFileLoc); struct variable *define_kbuild_object_variable_in_top_obj(const char *pszName, size_t cchName, const char *pszValue, size_t cchValue, int fDuplicateValue, enum variable_origin enmOrigin, int fRecursive, floc const *pFileLoc); struct variable *kbuild_object_variable_pre_append(const char *pchName, size_t cchName, const char *pchValue, size_t cchValue, int fSimpleValue, enum variable_origin enmOrigin, int fAppend, const floc *pFileLoc); int eval_kbuild_read_hook(struct kbuild_eval_data **kdata, const floc *flocp, const char *word, size_t wlen, const char *line, const char *eos, int ignoring); void print_kbuild_data_base(void); void print_kbuild_define_stats(void); void init_kbuild_object(void); /** @} */ #endif kbuild-3608/src/kmk/inlined_memchr.h0000664000175000017500000001076314670377415017432 0ustar locutuslocutus#define _GNU_SOURCE 1 #include #ifdef _MSC_VER _inline void * #else static __inline__ void * #endif my_inline_memchr(const void *pv, int ch, register size_t cb) { register const unsigned int uch = (unsigned)ch; register const unsigned char *pb = (const unsigned char *)pv; #if 0 /* 8-byte loop unroll */ while (cb >= 8) { if (*pb == uch) return (unsigned char *)pb; if (pb[1] == uch) return (unsigned char *)pb + 1; if (pb[2] == uch) return (unsigned char *)pb + 2; if (pb[3] == uch) return (unsigned char *)pb + 3; if (pb[4] == uch) return (unsigned char *)pb + 4; if (pb[5] == uch) return (unsigned char *)pb + 5; if (pb[6] == uch) return (unsigned char *)pb + 6; if (pb[7] == uch) return (unsigned char *)pb + 7; cb -= 8; pb += 8; } switch (cb & 7) { case 0: break; case 1: if (*pb == uch) return (unsigned char *)pb; break; case 2: if (*pb == uch) return (unsigned char *)pb; if (pb[1] == uch) return (unsigned char *)pb + 1; break; case 3: if (*pb == uch) return (unsigned char *)pb; if (pb[1] == uch) return (unsigned char *)pb + 1; if (pb[2] == uch) return (unsigned char *)pb + 2; break; case 4: if (*pb == uch) return (unsigned char *)pb; if (pb[1] == uch) return (unsigned char *)pb + 1; if (pb[2] == uch) return (unsigned char *)pb + 2; if (pb[3] == uch) return (unsigned char *)pb + 3; break; case 5: if (*pb == uch) return (unsigned char *)pb; if (pb[1] == uch) return (unsigned char *)pb + 1; if (pb[2] == uch) return (unsigned char *)pb + 2; if (pb[3] == uch) return (unsigned char *)pb + 3; if (pb[4] == uch) return (unsigned char *)pb + 4; break; case 6: if (*pb == uch) return (unsigned char *)pb; if (pb[1] == uch) return (unsigned char *)pb + 1; if (pb[2] == uch) return (unsigned char *)pb + 2; if (pb[3] == uch) return (unsigned char *)pb + 3; if (pb[4] == uch) return (unsigned char *)pb + 4; if (pb[5] == uch) return (unsigned char *)pb + 5; break; case 7: if (*pb == uch) return (unsigned char *)pb; if (pb[1] == uch) return (unsigned char *)pb + 1; if (pb[2] == uch) return (unsigned char *)pb + 2; if (pb[3] == uch) return (unsigned char *)pb + 3; if (pb[4] == uch) return (unsigned char *)pb + 4; if (pb[5] == uch) return (unsigned char *)pb + 5; if (pb[6] == uch) return (unsigned char *)pb + 6; break; } #elif 1 /* 4 byte loop unroll */ while (cb >= 4) { if (*pb == uch) return (unsigned char *)pb; if (pb[1] == uch) return (unsigned char *)pb + 1; if (pb[2] == uch) return (unsigned char *)pb + 2; if (pb[3] == uch) return (unsigned char *)pb + 3; cb -= 4; pb += 4; } switch (cb & 3) { case 0: break; case 1: if (*pb == uch) return (unsigned char *)pb; break; case 2: if (*pb == uch) return (unsigned char *)pb; if (pb[1] == uch) return (unsigned char *)pb + 1; break; case 3: if (*pb == uch) return (unsigned char *)pb; if (pb[1] == uch) return (unsigned char *)pb + 1; if (pb[2] == uch) return (unsigned char *)pb + 2; break; } #else /* the basic loop */ while (cb > 0) { if (*pb == uch) return (void *)pb; cb--; pb++; } #endif return 0; } #define memchr my_inline_memchr kbuild-3608/src/kmk/Makefile.kmk0000664000175000017500000004153714670377412016525 0ustar locutuslocutus# $Id: Makefile.kmk 3572 2022-10-24 08:36:35Z bird $ ## @file # Sub-makefile for kmk / GNU Make. # # # Copyright (c) 2004-2011 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # SUB_DEPTH = ../.. include $(KBUILD_PATH)/subheader.kmk # Enable new children handling for windows. CONFIG_NEW_WIN_CHILDREN = 1 # # Template for kmk and the kmk_* binaries in this makefile. # TEMPLATE_BIN-KMK = Template for src/gmake binaries TEMPLATE_BIN-KMK_EXTENDS = BIN-THREADED TEMPLATE_BIN-KMK_DEFS = \ HAVE_CONFIG_H \ $(TEMPLATE_BIN_DEFS) \ KBUILD_SVN_REV=$(KBUILD_SVN_REV) \ KBUILD_TYPE=$(TMP_QUOTE_SLASH)"$(KBUILD_TYPE)$(TMP_QUOTE_SLASH)" TEMPLATE_BIN-KMK_DEPS = \ $(kmk_0_OUTDIR)/config.h \ $(kmk_0_OUTDIR)/fts.h TEMPLATE_BIN-KMK_CLEAN = $(TEMPLATE_BIN-KMK_DEPS) TEMPLATE_BIN-KMK_DEPS.solaris = \ $(kmk_0_OUTDIR)/paths.h TEMPLATE_BIN-KMK_CLEAN.solaris = $(TEMPLATE_BIN-KMK_DEPS.solaris) TEMPLATE_BIN-KMK_DEPS.win = \ $(kmk_0_OUTDIR)/sysexits.h \ $(kmk_0_OUTDIR)/unistd.h \ $(kmk_0_OUTDIR)/paths.h \ $(kmk_0_OUTDIR)/grp.h \ $(kmk_0_OUTDIR)/pwd.h \ $(kmk_0_OUTDIR)/inttypes.h TEMPLATE_BIN-KMK_CFLAGS.win.amd64 = $(TEMPLATE_BIN-THREADED_CFLAGS.win.amd64) -wd4244 -wd4267 TEMPLATE_BIN-KMK_CLEAN.win = $(TEMPLATE_BIN-KMK_DEPS.win) TEMPLATE_BIN-KMK_DEFS.debug = $(TEMPLATE_BIN_DEFS.debug) MAKE_MAINTAINER_MODE TEMPLATE_BIN-KMK_INCS = $(kmk_0_OUTDIR) . $(TEMPLATE_BIN-THREADED_INCS) ifneq ($(KBUILD_TARGET),os2) TEMPLATE_BIN-KMK_INCS += glob endif TEMPLATE_BIN-KMK_LIBS = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS) $(kmkmissing_1_TARGET) $(LIB_KUTIL) TEMPLATE_BIN-KMK_LIBS.x86 = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS.x86) TEMPLATE_BIN-KMK_LIBS.amd64 = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS.amd64) ifdef ELECTRIC_HEAP # for electric heap (see electric.c). ifeq ($(KBUILD_TARGET),win) TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) /FI$(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1 else TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) -include $(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1 endif endif ifdef CONFIG_WITH_ALLOCCACHE_DEBUG TEMPLATE_BIN-KMK_DEFS += CONFIG_WITH_ALLOCCACHE_DEBUG endif ifdef CONFIG_NEW_WIN_CHILDREN TEMPLATE_BIN-KMK_DEFS.win = $(TEMPLATE_BIN_DEFS.win) CONFIG_NEW_WIN_CHILDREN endif # GCC sanitizers. ifdef GCC_SANITIZERS TEMPLATE_BIN-KMK_CFLAGS ?= $(TEMPLATE_BIN-THREADED_CFLAGS) # TEMPLATE_BIN-KMK_CFLAGS += -fsanitize=address -fsanitize=undefined -static-libubsan -D GCC_ADDRESS_SANITIZER TEMPLATE_BIN-KMK_CFLAGS += -fsanitize=address -fsanitize=undefined -D GCC_ADDRESS_SANITIZER TEMPLATE_BIN-KMK_LDFLAGS ?= $(TEMPLATE_BIN-THREADED_LDFLAGS) TEMPLATE_BIN-KMK_LDFLAGS += -fsanitize=address -fsanitize=undefined endif # # Library version of the above. # TEMPLATE_LIB-KMK = Template for src/gmake libraries TEMPLATE_LIB-KMK_EXTENDS = BIN-KMK TEMPLATE_LIB-KMK_POST_CMDS.win = $(NO_SUCH_VARIABLE) # # Template for building standalone built-in utilities. # TEMPLATE_BIN-KMK-BUILTIN = Template for standalone built-in utilies. TEMPLATE_BIN-KMK-BUILTIN_EXTENDS = BIN-KMK TEMPLATE_BIN-KMK-BUILTIN_EXTENDS_BY = appending TEMPLATE_BIN-KMK-BUILTIN_DEFS += KMK_BUILTIN_STANDALONE TEMPLATE_BIN-KMK-BUILTIN_SOURCES += kmkbuiltin/err.c # # A library containing the missing features needed by kmk and the # kmk_* binaries. Saves a bit of work later on. # LIBRARIES += kmkmissing kmkmissing_TEMPLATE = LIB-KMK kmkmissing_DEFS = KMK kmkmissing_NOINST = 1 kmkmissing_SOURCES = \ kmkbuiltin/fts.c \ kmkbuiltin/setmode.c \ kmkbuiltin/strmode.c \ kmkbuiltin/kbuild_protection.c \ kmkbuiltin/common-env-and-cwd-opt.c \ kmkbuiltin/getopt_r.c \ kmkbuiltin/getopt1_r.c \ getopt.c \ getopt1.c \ electric.c ifneq ($(KBUILD_TARGET),os2) kmkmissing_SOURCES += \ glob/glob.c endif kmkmissing_SOURCES.darwin = \ kmkbuiltin/darwin.c \ glob/fnmatch.c kmkmissing_SOURCES.dragonfly = \ glob/fnmatch.c kmkmissing_SOURCES.freebsd = \ glob/fnmatch.c kmkmissing_SOURCES.gnuhurd += \ kmkbuiltin/strlcpy.c kmkmissing_SOURCES.gnukfbsd += \ kmkbuiltin/strlcpy.c kmkmissing_SOURCES.gnuknbsd += \ kmkbuiltin/strlcpy.c kmkmissing_SOURCES.haiku = \ kmkbuiltin/haikufakes.c \ glob/fnmatch.c kmkmissing_SOURCES.linux += \ kmkbuiltin/strlcpy.c kmkmissing_SOURCES.netbsd = \ glob/fnmatch.c kmkmissing_SOURCES.openbsd = \ kmkbuiltin/openbsd.c kmkmissing_SOURCES.solaris = \ kmkbuiltin/strlcpy.c \ kmkbuiltin/solfakes.c \ glob/fnmatch.c kmkmissing_SOURCES.win += \ kmkbuiltin/strlcpy.c \ kmkbuiltin/mscfakes.c \ glob/fnmatch.c \ getloadavg.c \ w32/subproc/misc.c \ w32/subproc/w32err.c \ w32/pathstuff.c \ w32/imagecache.c \ w32/compat/posixfcn.c # # kmk # PROGRAMS += kmk kmk_TEMPLATE = BIN-KMK kmk_DEFS = \ NO_ARCHIVES \ EXPERIMENTAL \ CONFIG_WITH_TOUPPER_TOLOWER \ CONFIG_WITH_DEFINED \ CONFIG_WITH_EXPLICIT_MULTITARGET \ CONFIG_WITH_DOT_MUST_MAKE \ CONFIG_WITH_PREPEND_ASSIGNMENT \ CONFIG_WITH_LOCAL_VARIABLES \ CONFIG_WITH_2ND_TARGET_EXPANSION \ CONFIG_WITH_ALLOC_CACHES \ CONFIG_WITH_STRCACHE2 \ \ KMK \ KMK_HELPERS \ CONFIG_NO_DEFAULT_SUFFIXES \ CONFIG_NO_DEFAULT_PATTERN_RULES \ CONFIG_NO_DEFAULT_TERMINAL_RULES \ CONFIG_NO_DEFAULT_SUFFIX_RULES \ CONFIG_NO_DEFAULT_VARIABLES \ \ CONFIG_WITH_ABSPATHEX \ CONFIG_WITH_COMMANDS_FUNC \ CONFIG_WITH_DATE \ CONFIG_WITH_DEFINED_FUNCTIONS \ CONFIG_WITH_EVALPLUS \ CONFIG_WITH_FILE_SIZE \ CONFIG_WITH_LOOP_FUNCTIONS \ CONFIG_WITH_MATH \ CONFIG_WITH_NANOTS \ CONFIG_WITH_ROOT_FUNC \ CONFIG_WITH_RSORT \ CONFIG_WITH_STACK \ CONFIG_WITH_STRING_FUNCTIONS \ CONFIG_WITH_WHERE_FUNCTION \ CONFIG_WITH_WHICH \ CONFIG_WITH_XARGS \ \ CONFIG_WITH_EXTENDED_NOTPARALLEL \ CONFIG_WITH_INCLUDEDEP \ CONFIG_WITH_VALUE_LENGTH \ CONFIG_WITH_COMPARE \ CONFIG_WITH_SET_CONDITIONALS \ CONFIG_WITH_IF_CONDITIONALS \ CONFIG_WITH_PRINTF \ CONFIG_WITH_MINIMAL_STATS \ \ CONFIG_PRETTY_COMMAND_PRINTING \ CONFIG_WITH_PRINT_STATS_SWITCH \ CONFIG_WITH_PRINT_TIME_SWITCH \ CONFIG_WITH_RDONLY_VARIABLE_VALUE \ CONFIG_WITH_LAZY_DEPS_VARS \ CONFIG_WITH_MEMORY_OPTIMIZATIONS \ \ KBUILD_HOST=$(TMP_QUOTE_SLASH)"$(KBUILD_TARGET)$(TMP_QUOTE_SLASH)" \ KBUILD_HOST_ARCH=$(TMP_QUOTE_SLASH)"$(KBUILD_TARGET_ARCH)$(TMP_QUOTE_SLASH)" \ KBUILD_HOST_CPU=$(TMP_QUOTE_SLASH)"$(KBUILD_TARGET_CPU)$(TMP_QUOTE_SLASH)" # kmk_DEFS += CONFIG_WITH_COMPILER # experimental, doesn't work 101% right it seems. kmk_DEFS.x86 = CONFIG_WITH_OPTIMIZATION_HACKS kmk_DEFS.amd64 = CONFIG_WITH_OPTIMIZATION_HACKS kmk_DEFS.win = CONFIG_NEW_WIN32_CTRL_EVENT CONFIG_WITH_OUTPUT_IN_MEMORY kmk_DEFS.debug = CONFIG_WITH_MAKE_STATS ifdef CONFIG_WITH_MAKE_STATS kmk_DEFS += CONFIG_WITH_MAKE_STATS endif #ifdef CONFIG_WITH_KMK_BUILTIN_STATS kmk_DEFS += CONFIG_WITH_KMK_BUILTIN_STATS #endif ifdef CONFIG_WITH_EVAL_COMPILER kmk_DEFS += CONFIG_WITH_EVAL_COMPILER endif ifdef CONFIG_WITH_COMPILE_EVERYTHING kmk_DEFS += CONFIG_WITH_COMPILE_EVERYTHING endif #ifeq ($(KBUILD_TYPE).$(USERNAME),debug.bird) # kmk_DEFS += CONFIG_WITH_COMPILER CONFIG_WITH_EVAL_COMPILER CONFIG_WITH_COMPILE_EVERYTHING #endif kmk_SOURCES = \ main.c \ read.c \ hash.c \ strcache.c \ variable.c \ ar.c \ arscan.c \ commands.c \ default.c \ expand.c \ file.c \ function.c \ implicit.c \ job.c \ misc.c \ output.c \ remake.c \ rule.c \ signame.c \ version.c \ vpath.c \ remote-stub.c \ guile.c \ load.c \ \ alloccache.c \ expreval.c \ incdep.c \ strcache2.c \ kmk_cc_exec.c \ kbuild.c \ kbuild-object.c ifeq ($(KBUILD_TARGET),win) kmk_SOURCES += \ dir-nt-bird.c \ w32/w32os.c else kmk_SOURCES += \ dir.c \ posixos.c endif ifndef CONFIG_NEW_WIN_CHILDREN kmk_SOURCES.win = \ w32/subproc/sub_proc.c else kmk_SOURCES.win = \ w32/winchildren.c endif kmk_DEFS.freebsd.x86 = CONFIG_WITHOUT_THREADS #kmk_LIBS.solaris = malloc #kmk_DEFS.solaris += HAVE_MALLINFO # # kmkbuiltin commands # kmk_DEFS += CONFIG_WITH_KMK_BUILTIN kmk_LIBS += $(LIB_KUTIL) #$(LIB_KDEP) kmk_SOURCES += \ kmkbuiltin.c \ kmkbuiltin/append.c \ kmkbuiltin/cat.c \ kmkbuiltin/chmod.c \ kmkbuiltin/cmp.c \ kmkbuiltin/cmp_util.c \ kmkbuiltin/cp.c \ kmkbuiltin/cp_utils.c \ kmkbuiltin/echo.c \ kmkbuiltin/expr.c \ kmkbuiltin/install.c \ kmkbuiltin/kDepIDB.c \ kmkbuiltin/kDepObj.c \ ../lib/kDep.c \ kmkbuiltin/md5sum.c \ kmkbuiltin/mkdir.c \ kmkbuiltin/mv.c \ kmkbuiltin/ln.c \ kmkbuiltin/printf.c \ kmkbuiltin/redirect.c \ kmkbuiltin/rm.c \ kmkbuiltin/rmdir.c \ $(if-expr $(KBUILD_TARGET) == win,kmkbuiltin/kSubmit.c) \ kmkbuiltin/sleep.c \ kmkbuiltin/test.c \ kmkbuiltin/touch.c \ \ kmkbuiltin/err.c kmk_SOURCES.win += \ kmkbuiltin/kill.c ## @todo kmkbuiltin/redirect.c ## Some profiling #kmk_SOURCES += kbuildprf.c #kmk_DEFS += open=prf_open read=prf_read lseek=prf_lseek close=prf_close ##kmk_DEFS += KMK_PRF=1 ##kmkmissing_DEFS += KMK_PRF=1 # # Standalone kmkbuiltin commands. # PROGRAMS += \ kmk_append \ kmk_cat \ kmk_chmod \ kmk_cp \ kmk_cmp \ kmk_echo \ kmk_expr \ kmk_md5sum \ kmk_mkdir \ kmk_mv \ kmk_install \ kmk_ln \ kmk_printf \ kmk_redirect \ kmk_rm \ kmk_rmdir \ kmk_sleep \ kmk_test \ kmk_touch \ kDepIDB \ kDepObj PROGRAMS.win += \ kmk_kill kmk_append_TEMPLATE = BIN-KMK-BUILTIN kmk_append_INCS = . kmk_append_SOURCES = \ kmkbuiltin/append.c kmk_cat_TEMPLATE = BIN-KMK-BUILTIN kmk_cat_SOURCES = \ kmkbuiltin/cat.c kmk_chmod_TEMPLATE = BIN-KMK-BUILTIN kmk_chmod_SOURCES = \ kmkbuiltin/chmod.c kmk_cmp_TEMPLATE = BIN-KMK-BUILTIN kmk_cmp_SOURCES = \ kmkbuiltin/cmp.c \ kmkbuiltin/cmp_util.c kmk_cp_TEMPLATE = BIN-KMK-BUILTIN kmk_cp_SOURCES = \ kmkbuiltin/cp.c \ kmkbuiltin/cp_utils.c \ kmkbuiltin/cmp_util.c kmk_echo_TEMPLATE = BIN-KMK-BUILTIN kmk_echo_SOURCES = \ kmkbuiltin/echo.c kmk_expr_TEMPLATE = BIN-KMK-BUILTIN kmk_expr_SOURCES = \ kmkbuiltin/expr.c kmk_install_TEMPLATE = BIN-KMK-BUILTIN kmk_install_SOURCES = \ kmkbuiltin/install.c kmk_kill_TEMPLATE = BIN-KMK-BUILTIN kmk_kill_SOURCES = \ kmkbuiltin/kill.c kmk_ln_TEMPLATE = BIN-KMK-BUILTIN kmk_ln_SOURCES = \ kmkbuiltin/ln.c kmk_mkdir_TEMPLATE = BIN-KMK-BUILTIN kmk_mkdir_SOURCES = \ kmkbuiltin/mkdir.c kmk_md5sum_TEMPLATE = BIN-KMK-BUILTIN kmk_md5sum_SOURCES = \ kmkbuiltin/md5sum.c kmk_md5sum_LIBS = $(LIB_KUTIL) kmk_mv_TEMPLATE = BIN-KMK-BUILTIN kmk_mv_SOURCES = \ kmkbuiltin/mv.c kmk_printf_TEMPLATE = BIN-KMK-BUILTIN kmk_printf_SOURCES = \ kmkbuiltin/printf.c kmk_rm_TEMPLATE = BIN-KMK-BUILTIN kmk_rm_SOURCES = \ kmkbuiltin/rm.c kmk_redirect_TEMPLATE = BIN-KMK-BUILTIN kmk_redirect_SOURCES = \ kmkbuiltin/redirect.c kmk_redirect_SOURCES.win = \ ../lib/startuphacks-win.c kmk_rmdir_TEMPLATE = BIN-KMK-BUILTIN kmk_rmdir_SOURCES = \ kmkbuiltin/rmdir.c kmk_sleep_TEMPLATE = BIN-KMK-BUILTIN kmk_sleep_SOURCES = \ kmkbuiltin/sleep.c kmk_test_TEMPLATE = BIN-KMK-BUILTIN kmk_test_SOURCES = \ kmkbuiltin/test.c kmk_touch_TEMPLATE = BIN-KMK-BUILTIN kmk_touch_SOURCES = \ kmkbuiltin/touch.c kDepIDB_TEMPLATE = BIN-KMK-BUILTIN kDepIDB_INCS = . kDepIDB_LIBS = $(LIB_KDEP) $(LIB_KUTIL) kDepIDB_SOURCES = \ kmkbuiltin/kDepIDB.c kDepObj_TEMPLATE = BIN-KMK-BUILTIN kDepObj_INCS = . kDepObj_LIBS = $(LIB_KDEP) $(LIB_KUTIL) kDepObj_SOURCES = \ kmkbuiltin/kDepObj.c # # kmk_gmake - almost plain GNU Make. # PROGRAMS += kmk_gmake kmk_gmake_TEMPLATE = BIN-KMK kmk_gmake_DEFS = \ HAVE_CONFIG_H \ CONFIG_WITH_TOUPPER_TOLOWER \ EXPERIMENTAL # NO_ARCHIVES kmk_gmake_SOURCES = \ main.c \ read.c \ hash.c \ strcache.c \ variable.c \ ar.c \ arscan.c \ commands.c \ default.c \ dir.c \ expand.c \ file.c \ function.c \ implicit.c \ job.c \ misc.c \ output.c \ remake.c \ rule.c \ signame.c \ version.c \ vpath.c \ remote-stub.c \ guile.c \ load.c ifeq ($(KBUILD_TARGET),win) kmk_gmake_SOURCES += \ w32/w32os.c else kmk_gmake_SOURCES += \ posixos.c endif ifndef CONFIG_NEW_WIN_CHILDREN kmk_gmake_SOURCES.win = \ w32/subproc/sub_proc.c else kmk_gmake_SOURCES.win = \ w32/winchildren.c endif # # kmk_fmake - Faster GNU Make. # ifeq ($(USER),bird) # for experimental purposes only. PROGRAMS += kmk_fgmake endif kmk_fgmake_TEMPLATE = BIN-KMK kmk_fgmake_DEFS = \ HAVE_CONFIG_H \ NO_ARCHIVES \ CONFIG_WITH_TOUPPER_TOLOWER \ EXPERIMENTAL \ \ CONFIG_WITH_ALLOC_CACHES \ CONFIG_WITH_LAZY_DEPS_VARS \ CONFIG_WITH_STRCACHE2 \ CONFIG_WITH_VALUE_LENGTH \ CONFIG_WITH_RDONLY_VARIABLE_VALUE # TODO ? # CONFIG_WITH_PRINT_STATS_SWITCH \ # CONFIG_WITH_EXTENDED_NOTPARALLEL \ kmk_fgmake_SOURCES = \ main.c \ read.c \ hash.c \ strcache.c \ strcache2.c \ variable.c \ ar.c \ arscan.c \ commands.c \ default.c \ dir.c \ expand.c \ file.c \ function.c \ implicit.c \ job.c \ misc.c \ output.c \ alloccache.c \ remake.c \ rule.c \ signame.c \ version.c \ vpath.c \ remote-stub.c \ guile.c \ load.c ifeq ($(KBUILD_TARGET),win) kmk_fgmake_SOURCES += \ w32/w32os.c # @todo: dir-nt-bird.c for fgmake else kmk_fgmake_SOURCES += \ posixos.c endif kmk_fgmake_SOURCES.win = \ w32/subproc/sub_proc.c # # tstFileInfo # PROGRAMS.win += tstFileInfo tstFileInfo_TEMPLATE = BIN tstFileInfo_SOURCES = w32/tstFileInfo.c # # tstFileInfo # PROGRAMS.win += tstFtsFake tstFtsFake_TEMPLATE = BIN-KMK tstFtsFake_NOINST = 1 tstFtsFake_DEFS = USE_OLD_FTS tstFtsFake_SOURCES = ../lib/nt/tstNtFts.c include $(FILE_KBUILD_SUB_FOOTER) # # Use checked in config.h instead of running ./Configure for it. # kmk_config.h.$(KBUILD_TARGET) := $(kmk_DEFPATH)/config.h.$(KBUILD_TARGET) $(kmk_0_OUTDIR)/config.h: $(kmk_config.h.$(KBUILD_TARGET)) $(MKDIR) -p $(dir $@) $(CP) $^ $@ # # Some missing headers. # if1of ($(KBUILD_TARGET), win nt) $(kmk_0_OUTDIR)/fts.h: $(MAKEFILE) | $(call DIRDEP,$(kmk_0_OUTDIR)) $(APPEND) -t "$@" "#include " else $(kmk_0_OUTDIR)/fts.h: $(kmk_DEFPATH)/kmkbuiltin/ftsfake.h | $(call DIRDEP,$(kmk_0_OUTDIR)) $(CP) $^ $@ endif $(kmk_0_OUTDIR)/unistd.h: | $(call DIRDEP,$(kmk_0_OUTDIR)) $(ECHO_EXT) > $@ $(kmk_0_OUTDIR)/sysexits.h: | $(call DIRDEP,$(kmk_0_OUTDIR)) $(ECHO_EXT) > $@ $(kmk_0_OUTDIR)/inttypes.h: | $(call DIRDEP,$(kmk_0_OUTDIR)) $(ECHO_EXT) > $@ $(kmk_0_OUTDIR)/paths.h: | $(call DIRDEP,$(kmk_0_OUTDIR)) $(ECHO_EXT) > $@ $(kmk_0_OUTDIR)/pwd.h: | $(call DIRDEP,$(kmk_0_OUTDIR)) $(ECHO_EXT) > $@ $(kmk_0_OUTDIR)/grp.h: | $(call DIRDEP,$(kmk_0_OUTDIR)) $(ECHO_EXT) > $@ # # Some tests. # parallel: parallel_1 parallel_2 parallel_3 parallel_4 parallel_5 parallel_1 parallel_2 parallel_3 parallel_4 parallel_5: echo $@_start ; sleep 1; echo $@_done my_test: echo "1" echo "2" echo "3" echo "4" # # Shell execution tests. # test_shell: test_shell_quoting test_shell_double_quoting test_shell_newline # shell double and single quoting check (was busted on windows in 3.81). test_shell_quoting: $(ECHO_EXT) "double quoted sTrInG" $(ECHO_EXT) "double quoted sTrInG" | $(SED_EXT) -e "s/sTrInG/string/g" $(ECHO_EXT) 'single quoted sTrInG' | $(SED_EXT) -e 's/sTrInG/string/g' $(ECHO) "This string should not be printed with double quotes." $(ECHO) 'This string should not be printed with single quotes.' ( echo " #define PWD \"`pwd`\""; ) test_shell_double_quoting: $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \ "s/foo/$@/" -e \ "s/foo/works/" \ -e "s/foo/\!/" test_shell_double_quoting2: $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \ "s/foo/$@/" -e \ "s/foo/works/" \ -e\ "s/foo/\!/" # when using batch mode shell, the newline got escaped twice and spoiling everything. test_shell_newline: $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \ 's/foo/$@/' -e \ 's/foo/works/' \ -e 's/foo/\!/' test_stack: $(MAKE) -f $(kmk_DEFPATH)/testcase-stack.kmk test_math: $(MAKE) -f $(kmk_DEFPATH)/testcase-math.kmk test_if1of: $(MAKE) -f $(kmk_DEFPATH)/testcase-if1of.kmk test_local: $(MAKE) -f $(kmk_DEFPATH)/testcase-local.kmk test_includedep: $(MAKE) -f $(kmk_DEFPATH)/testcase-includedep.kmk test_root: $(MAKE) -f $(kmk_DEFPATH)/testcase-root.kmk test_2ndtargetexp: $(MAKE) -f $(kmk_DEFPATH)/testcase-2ndtargetexp.kmk test_30_continued_on_failure_worker: this_executable_does_not_exist.exe echo "We shouldn't see this..." test_30_continued_on_failure: $(MAKE) -f $(MAKEFILE) test_30_continued_on_failure_worker; \ RC=$$?; \ if test $${RC} -ne 2; then \ echo "$@: FAILED - exit code $${RC} instead of 2."; \ exit 1; \ else \ echo "$@: SUCCESS"; \ fi test_lazy_deps_vars: $(MAKE) -C $(kmk_DEFPATH) -f testcase-lazy-deps-vars.kmk test_all: \ test_math \ test_stack \ test_shell \ test_if1of \ test_local \ test_root \ test_includedep \ test_2ndtargetexp \ test_30_continued_on_failure \ test_lazy_deps_vars kbuild-3608/src/kmk/remake.c0000664000175000017500000020614414670377414015713 0ustar locutuslocutus/* Basic dependency engine for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #include "filedef.h" #include "job.h" #include "commands.h" #include "dep.h" #include "variable.h" #include "debug.h" #include #ifdef HAVE_FCNTL_H #include #else #include #endif #ifdef VMS #include #endif #ifdef WINDOWS32 #include #endif /* The test for circular dependencies is based on the 'updating' bit in 'struct file'. However, double colon targets have separate 'struct file's; make sure we always use the base of the double colon chain. */ #define start_updating(_f) (((_f)->double_colon ? (_f)->double_colon : (_f))\ ->updating = 1) #define finish_updating(_f) (((_f)->double_colon ? (_f)->double_colon : (_f))\ ->updating = 0) #define is_updating(_f) (((_f)->double_colon ? (_f)->double_colon : (_f))\ ->updating) /* Incremented when a command is started (under -n, when one would be). */ unsigned int commands_started = 0; /* Set to the goal dependency. Mostly needed for remaking makefiles. */ static struct goaldep *goal_list; static struct dep *goal_dep; /* Current value for pruning the scan of the goal chain. All files start with considered == 0. */ static unsigned int considered = 0; static enum update_status update_file (struct file *file, unsigned int depth); static enum update_status update_file_1 (struct file *file, unsigned int depth); static enum update_status check_dep (struct file *file, unsigned int depth, FILE_TIMESTAMP this_mtime, int *must_make); static enum update_status touch_file (struct file *file); static void remake_file (struct file *file); static FILE_TIMESTAMP name_mtime (const char *name); static const char *library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr); #ifdef CONFIG_WITH_DOT_MUST_MAKE static int call_must_make_target_var (struct file *file, unsigned int depth); #endif #ifdef CONFIG_WITH_DOT_IS_CHANGED static int call_is_changed_target_var (struct file *file); #endif /* Remake all the goals in the 'struct dep' chain GOALS. Return -1 if nothing was done, 0 if all goals were updated successfully, or 1 if a goal failed. If rebuilding_makefiles is nonzero, these goals are makefiles, so -t, -q, and -n should be disabled for them unless they were also command-line targets, and we should only make one goal at a time and return as soon as one goal whose 'changed' member is nonzero is successfully made. */ enum update_status update_goal_chain (struct goaldep *goaldeps) { int t = touch_flag, q = question_flag, n = just_print_flag; enum update_status status = us_none; /* Duplicate the chain so we can remove things from it. */ struct dep *goals = copy_dep_chain ((struct dep *)goaldeps); goal_list = rebuilding_makefiles ? goaldeps : NULL; #define MTIME(file) (rebuilding_makefiles ? file_mtime_no_search (file) \ : file_mtime (file)) /* Start a fresh batch of consideration. */ ++considered; /* Update all the goals until they are all finished. */ while (goals != 0) { register struct dep *g, *lastgoal; /* Start jobs that are waiting for the load to go down. */ start_waiting_jobs (); /* Wait for a child to die. */ reap_children (1, 0); lastgoal = 0; g = goals; while (g != 0) { /* Iterate over all double-colon entries for this file. */ struct file *file; int stop = 0, any_not_updated = 0; goal_dep = g; for (file = g->file->double_colon ? g->file->double_colon : g->file; file != NULL; file = file->prev) { unsigned int ocommands_started; enum update_status fail; file->dontcare = ANY_SET (g->flags, RM_DONTCARE); check_renamed (file); if (rebuilding_makefiles) { if (file->cmd_target) { touch_flag = t; question_flag = q; just_print_flag = n; } else touch_flag = question_flag = just_print_flag = 0; } /* Save the old value of 'commands_started' so we can compare later. It will be incremented when any commands are actually run. */ ocommands_started = commands_started; fail = update_file (file, rebuilding_makefiles ? 1 : 0); check_renamed (file); /* Set the goal's 'changed' flag if any commands were started by calling update_file above. We check this flag below to decide when to give an "up to date" diagnostic. */ if (commands_started > ocommands_started) g->changed = 1; stop = 0; if ((fail || file->updated) && status < us_question) { /* We updated this goal. Update STATUS and decide whether to stop. */ if (file->update_status) { /* Updating failed, or -q triggered. The STATUS value tells our caller which. */ status = file->update_status; /* If -q just triggered, stop immediately. It doesn't matter how much more we run, since we already know the answer to return. */ stop = (question_flag && !keep_going_flag && !rebuilding_makefiles); } else { FILE_TIMESTAMP mtime = MTIME (file); check_renamed (file); if (file->updated && g->changed && mtime != file->mtime_before_update) { /* Updating was done. If this is a makefile and just_print_flag or question_flag is set (meaning -n or -q was given and this file was specified as a command-line target), don't change STATUS. If STATUS is changed, we will get re-exec'd, and enter an infinite loop. */ if (!rebuilding_makefiles || (!just_print_flag && !question_flag)) status = us_success; if (rebuilding_makefiles && file->dontcare) /* This is a default makefile; stop remaking. */ stop = 1; } } } /* Keep track if any double-colon entry is not finished. When they are all finished, the goal is finished. */ any_not_updated |= !file->updated; file->dontcare = 0; if (stop) break; } /* Reset FILE since it is null at the end of the loop. */ file = g->file; if (stop || !any_not_updated) { /* If we have found nothing whatever to do for the goal, print a message saying nothing needs doing. */ if (!rebuilding_makefiles /* If the update_status is success, we updated successfully or not at all. G->changed will have been set above if any commands were actually started for this goal. */ && file->update_status == us_success && !g->changed /* Never give a message under -s or -q. */ && !silent_flag && !question_flag) OS (message, 1, ((file->phony || file->cmds == 0) ? _("Nothing to be done for '%s'.") : _("'%s' is up to date.")), file->name); /* This goal is finished. Remove it from the chain. */ if (lastgoal == 0) goals = g->next; else lastgoal->next = g->next; /* Free the storage. */ #ifndef CONFIG_WITH_ALLOC_CACHES free (g); #else free_dep (g); #endif g = lastgoal == 0 ? goals : lastgoal->next; if (stop) break; } else { lastgoal = g; g = g->next; } } /* If we reached the end of the dependency graph update CONSIDERED for the next pass. */ if (g == 0) ++considered; } if (rebuilding_makefiles) { touch_flag = t; question_flag = q; just_print_flag = n; } return status; } /* If we're rebuilding an included makefile that failed, and we care about errors, show an error message the first time. */ void show_goal_error (void) { struct goaldep *goal; if ((goal_dep->flags & (RM_INCLUDED|RM_DONTCARE)) != RM_INCLUDED) return; for (goal = goal_list; goal; goal = goal->next) if (goal_dep->file == goal->file) { if (goal->error) { OSS (error, &goal->floc, "%s: %s", goal->file->name, strerror ((int)goal->error)); goal->error = 0; } return; } } /* If FILE is not up to date, execute the commands for it. Return 0 if successful, non-0 if unsuccessful; but with some flag settings, just call 'exit' if unsuccessful. DEPTH is the depth in recursions of this function. We increment it during the consideration of our dependencies, then decrement it again after finding out whether this file is out of date. If there are multiple double-colon entries for FILE, each is considered in turn. */ static enum update_status update_file (struct file *file, unsigned int depth) { enum update_status status = us_success; struct file *f; f = file->double_colon ? file->double_colon : file; /* Prune the dependency graph: if we've already been here on _this_ pass through the dependency graph, we don't have to go any further. We won't reap_children until we start the next pass, so no state change is possible below here until then. */ if (f->considered == considered) { /* Check for the case where a target has been tried and failed but the diagnostics haven't been issued. If we need the diagnostics then we will have to continue. */ if (!(f->updated && f->update_status > us_none && !f->dontcare && f->no_diag)) { DBF (DB_VERBOSE, _("Pruning file '%s'.\n")); return f->command_state == cs_finished ? f->update_status : us_success; } } /* This loop runs until we start commands for a double colon rule, or until the chain is exhausted. */ for (; f != 0; f = f->prev) { enum update_status new; f->considered = considered; new = update_file_1 (f, depth); check_renamed (f); /* Clean up any alloca() used during the update. */ alloca (0); /* If we got an error, don't bother with double_colon etc. */ if (new && !keep_going_flag) return new; if (f->command_state == cs_running || f->command_state == cs_deps_running) /* Don't run other :: rules for this target until this rule is finished. */ return us_success; if (new > status) status = new; } /* Process the remaining rules in the double colon chain so they're marked considered. Start their prerequisites, too. */ if (file->double_colon) for (; f != 0 ; f = f->prev) { struct dep *d; f->considered = considered; for (d = f->deps; d != 0; d = d->next) { enum update_status new = update_file (d->file, depth + 1); if (new > status) status = new; } } return status; } /* Show a message stating the target failed to build. */ static void complain (struct file *file) { /* If this file has no_diag set then it means we tried to update it before in the dontcare mode and failed. The target that actually failed is not necessarily this file but could be one of its direct or indirect dependencies. So traverse this file's dependencies and find the one that actually caused the failure. */ struct dep *d; for (d = file->deps; d != 0; d = d->next) { if (d->file->updated && d->file->update_status > us_none && file->no_diag) { complain (d->file); break; } } if (d == 0) { show_goal_error (); /* Didn't find any dependencies to complain about. */ #ifdef KMK /* jokes */ if (!keep_going_flag && file->parent == 0) { const char *msg_joke = 0; extern struct dep *goals; /* classics */ if (!strcmp (file->name, "fire") || !strcmp (file->name, "Fire")) msg_joke = "No matches.\n"; else if (!strcmp (file->name, "love") || !strcmp (file->name, "Love") || !strcmp (file->name, "peace") || !strcmp (file->name, "Peace")) msg_joke = "Not war.\n"; else if (!strcmp (file->name, "war")) msg_joke = "Don't know how to make war.\n"; /* http://xkcd.com/149/ - GNU Make bug #23273. */ else if (( !strcmp (file->name, "me") && goals != 0 && !strcmp (dep_name(goals), "me") && goals->next != 0 && !strcmp (dep_name(goals->next), "a") && goals->next->next != 0) || !strncmp (file->name, "me a ", 5)) msg_joke = # ifdef HAVE_UNISTD_H getuid () == 0 ? "Okay.\n" : # endif "What? Make it yourself!\n"; if (msg_joke) { fputs (msg_joke, stderr); die (2); } } #endif /* KMK */ if (file->parent) { size_t l = strlen (file->name) + strlen (file->parent->name) + 4; const char *m = _("%sNo rule to make target '%s', needed by '%s'%s"); if (!keep_going_flag) fatal (NILF, l, m, "", file->name, file->parent->name, ""); error (NILF, l, m, "*** ", file->name, file->parent->name, "."); } else { size_t l = strlen (file->name) + 4; const char *m = _("%sNo rule to make target '%s'%s"); if (!keep_going_flag) fatal (NILF, l, m, "", file->name, ""); error (NILF, l, m, "*** ", file->name, "."); } file->no_diag = 0; } } /* Consider a single 'struct file' and update it as appropriate. Return 0 on success, or non-0 on failure. */ static enum update_status update_file_1 (struct file *file, unsigned int depth) { enum update_status dep_status = us_success; FILE_TIMESTAMP this_mtime; int noexist, must_make, deps_changed; struct file *ofile; struct dep *d, *ad; struct dep amake; int running = 0; #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET struct file *org_file; struct file *req_file; struct file *f2, *f3; /* Secondary target expansion leaves renamed files around, skip any rename files to simplify multi target handling. */ check_renamed(file); /* Remember the request file and find the primary multi target file. Always work on the primary file in a multi target recipe. */ req_file = file; org_file = file; if (file->multi_head != NULL) { if (file->multi_head == file) DBS (DB_VERBOSE, (_("Considering target file '%s' (multi head).\n"), file->name)); else { org_file = file = file->multi_head; DBS (DB_VERBOSE, (_("Considering target file '%s' -> multi head '%s'.\n"), req_file->name, file->name)); assert (file->multi_head == file); } } else #endif /* CONFIG_WITH_EXPLICIT_MULTITARGET */ DBF (DB_VERBOSE, _("Considering target file '%s'.\n")); if (file->updated) { if (file->update_status > us_none) { DBF (DB_VERBOSE, _("Recently tried and failed to update file '%s'.\n")); /* If the file we tried to make is marked no_diag then no message was printed about it when it failed during the makefile rebuild. If we're trying to build it again in the normal rebuild, print a message now. */ if (file->no_diag && !file->dontcare) complain (file); return file->update_status; } DBF (DB_VERBOSE, _("File '%s' was considered already.\n")); return 0; } switch (file->command_state) { case cs_not_started: case cs_deps_running: break; case cs_running: DBF (DB_VERBOSE, _("Still updating file '%s'.\n")); return 0; case cs_finished: DBF (DB_VERBOSE, _("Finished updating file '%s'.\n")); return file->update_status; default: abort (); } /* Determine whether the diagnostics will be issued should this update fail. */ file->no_diag = file->dontcare; ++depth; /* Notice recursive update of the same file. */ start_updating (file); /* We might change file if we find a different one via vpath; remember this one to turn off updating. */ ofile = file; /* Looking at the file's modtime beforehand allows the possibility that its name may be changed by a VPATH search, and thus it may not need an implicit rule. If this were not done, the file might get implicit commands that apply to its initial name, only to have that name replaced with another found by VPATH search. For multi target files check the other files and use the time of the oldest / non-existing file. */ #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET this_mtime = file_mtime (file); check_renamed (file); f3 = file; for (f2 = file->multi_next; f2 != NULL && this_mtime != NONEXISTENT_MTIME; f2 = f2->multi_next) if (!f2->multi_maybe) { FILE_TIMESTAMP second_mtime = file_mtime (f2); if (second_mtime < this_mtime) { this_mtime = second_mtime; f3 = f2; } } /** @todo this isn't sufficient, need to introduce a truly optional type and * make |+ ignore mtime. let's hope that doesn't break too much... */ /* If the requested file doesn't exist, always do a remake in the hope that it is recreated even if it's "maybe" target. */ else if (f2 == req_file && file_mtime (f2) == NONEXISTENT_MTIME) { this_mtime = NONEXISTENT_MTIME; f3 = f2; break; } check_renamed (f3); noexist = this_mtime == NONEXISTENT_MTIME; if (noexist) DBS (DB_BASIC, (_("File '%s' does not exist.\n"), f3->name)); #else /* !CONFIG_WITH_EXPLICIT_MULTITARGET */ this_mtime = file_mtime (file); check_renamed (file); noexist = this_mtime == NONEXISTENT_MTIME; if (noexist) DBF (DB_BASIC, _("File '%s' does not exist.\n")); #endif /* !CONFIG_WITH_EXPLICIT_MULTITARGET */ else if (ORDINARY_MTIME_MIN <= this_mtime && this_mtime <= ORDINARY_MTIME_MAX && file->low_resolution_time) { /* Avoid spurious rebuilds due to low resolution time stamps. */ int ns = FILE_TIMESTAMP_NS (this_mtime); if (ns != 0) OS (error, NILF, _("*** Warning: .LOW_RESOLUTION_TIME file '%s' has a high resolution time stamp"), file->name); this_mtime += FILE_TIMESTAMPS_PER_S - 1 - ns; } must_make = noexist; /* If file was specified as a target with no commands, come up with some default commands. */ if (!file->phony && file->cmds == 0 && !file->tried_implicit) { if (try_implicit_rule (file, depth)) DBF (DB_IMPLICIT, _("Found an implicit rule for '%s'.\n")); else DBF (DB_IMPLICIT, _("No implicit rule found for '%s'.\n")); file->tried_implicit = 1; } if (file->cmds == 0 && !file->is_target && default_file != 0 && default_file->cmds != 0) { DBF (DB_IMPLICIT, _("Using default recipe for '%s'.\n")); file->cmds = default_file->cmds; } /* Update all non-intermediate files we depend on, if necessary, and see whether any of them is more recent than this file. We need to walk our deps, AND the deps of any also_make targets to ensure everything happens in the correct order. bird: For explicit multitarget rules we must iterate all the output files to get the correct picture. The special .MUST_MAKE target variable call is also done from this context. */ #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET assert (file == org_file); for (f2 = file; f2; file = f2 = f2->multi_next) { #endif amake.file = file; amake.next = file->also_make; ad = &amake; while (ad) { struct dep *lastd = 0; /* Find the deps we're scanning */ d = ad->file->deps; ad = ad->next; while (d) { enum update_status new; FILE_TIMESTAMP mtime; int maybe_make; int dontcare = 0; check_renamed (d->file); mtime = file_mtime (d->file); check_renamed (d->file); if (is_updating (d->file)) { #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET /* silently ignore the order-only dep hack. */ if (file->multi_maybe && d->file == org_file) { lastd = d; d = d->next; continue; } #endif OSS (error, NILF, _("Circular %s <- %s dependency dropped."), file->name, d->file->name); /* We cannot free D here because our the caller will still have a reference to it when we were called recursively via check_dep below. */ if (lastd == 0) file->deps = d->next; else lastd->next = d->next; d = d->next; continue; } d->file->parent = file; maybe_make = must_make; /* Inherit dontcare flag from our parent. */ if (rebuilding_makefiles) { dontcare = d->file->dontcare; d->file->dontcare = file->dontcare; } new = check_dep (d->file, depth, this_mtime, &maybe_make); if (new > dep_status) dep_status = new; /* Restore original dontcare flag. */ if (rebuilding_makefiles) d->file->dontcare = dontcare; if (! d->ignore_mtime) must_make = maybe_make; check_renamed (d->file); { register struct file *f = d->file; if (f->double_colon) f = f->double_colon; do { running |= (f->command_state == cs_running || f->command_state == cs_deps_running); f = f->prev; } while (f != 0); } if (dep_status && !keep_going_flag) break; if (!running) /* The prereq is considered changed if the timestamp has changed while it was built, OR it doesn't exist. */ d->changed = ((file_mtime (d->file) != mtime) || (mtime == NONEXISTENT_MTIME)); lastd = d; d = d->next; } } #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (dep_status != 0 && !keep_going_flag) break; } file = org_file; #endif #ifdef CONFIG_WITH_DOT_MUST_MAKE /* Check with the .MUST_MAKE target variable if it's not already decided to make the file. */ # ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (!must_make) for (f2 = org_file; f2 && !must_make; f2 = f2->multi_next) must_make = call_must_make_target_var (f2, depth); # else if (!must_make) must_make = call_must_make_target_var (file, depth); # endif #endif /* CONFIG_WITH_DOT_MUST_MAKE */ /* Now we know whether this target needs updating. If it does, update all the intermediate files we depend on. */ if (must_make || always_make_flag) { #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET for (file = f2 = org_file; f2; file = f2 = f2->multi_next) #endif for (d = file->deps; d != 0; d = d->next) if (d->file->intermediate) { enum update_status new; int dontcare = 0; FILE_TIMESTAMP mtime = file_mtime (d->file); check_renamed (d->file); d->file->parent = file; /* Inherit dontcare flag from our parent. */ if (rebuilding_makefiles) { dontcare = d->file->dontcare; d->file->dontcare = file->dontcare; } /* We may have already considered this file, when we didn't know we'd need to update it. Force update_file() to consider it and not prune it. */ d->file->considered = 0; new = update_file (d->file, depth); if (new > dep_status) dep_status = new; /* Restore original dontcare flag. */ if (rebuilding_makefiles) d->file->dontcare = dontcare; check_renamed (d->file); { register struct file *f = d->file; if (f->double_colon) f = f->double_colon; do { running |= (f->command_state == cs_running || f->command_state == cs_deps_running); f = f->prev; } while (f != 0); } if (dep_status && !keep_going_flag) break; if (!running) d->changed = ((file->phony && file->cmds != 0) || file_mtime (d->file) != mtime); } #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET file = org_file; #endif } finish_updating (file); finish_updating (ofile); DBF (DB_VERBOSE, _("Finished prerequisites of target file '%s'.\n")); if (running) { set_command_state (file, cs_deps_running); --depth; DBF (DB_VERBOSE, _("The prerequisites of '%s' are being made.\n")); return 0; } /* If any dependency failed, give up now. */ if (dep_status) { /* I'm not sure if we can't just assign dep_status... */ file->update_status = dep_status == us_none ? us_failed : dep_status; notice_finished_file (file); --depth; DBF (DB_VERBOSE, _("Giving up on target file '%s'.\n")); if (depth == 0 && keep_going_flag && !just_print_flag && !question_flag) OS (error, NILF, _("Target '%s' not remade because of errors."), file->name); return dep_status; } if (file->command_state == cs_deps_running) /* The commands for some deps were running on the last iteration, but they have finished now. Reset the command_state to not_started to simplify later bookkeeping. It is important that we do this only when the prior state was cs_deps_running, because that prior state was definitely propagated to FILE's also_make's by set_command_state (called above), but in another state an also_make may have independently changed to finished state, and we would confuse that file's bookkeeping (updated, but not_started is bogus state). */ set_command_state (file, cs_not_started); /* Now record which prerequisites are more recent than this file, so we can define $?. */ deps_changed = 0; #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET for (file = f2 = org_file; f2; file = f2 = f2->multi_next) #endif for (d = file->deps; d != 0; d = d->next) { FILE_TIMESTAMP d_mtime = file_mtime (d->file); #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (d->file == file && file->multi_maybe) continue; #endif check_renamed (d->file); if (! d->ignore_mtime) { #if 1 /* %%% In version 4, remove this code completely to implement not remaking deps if their deps are newer than their parents. */ if (d_mtime == NONEXISTENT_MTIME && !d->file->intermediate) /* We must remake if this dep does not exist and is not intermediate. */ must_make = 1; #endif /* Set DEPS_CHANGED if this dep actually changed. */ deps_changed |= d->changed; } /* Set D->changed if either this dep actually changed, or its dependent, FILE, is older or does not exist. */ d->changed |= noexist || d_mtime > this_mtime; if (!noexist && ISDB (DB_BASIC|DB_VERBOSE)) { const char *fmt = 0; if (d->ignore_mtime) { if (ISDB (DB_VERBOSE)) fmt = _("Prerequisite '%s' is order-only for target '%s'.\n"); } else if (d_mtime == NONEXISTENT_MTIME) { if (ISDB (DB_BASIC)) fmt = _("Prerequisite '%s' of target '%s' does not exist.\n"); } else if (d->changed) { if (ISDB (DB_BASIC)) fmt = _("Prerequisite '%s' is newer than target '%s'.\n"); } else if (ISDB (DB_VERBOSE)) fmt = _("Prerequisite '%s' is older than target '%s'.\n"); if (fmt) { print_spaces (depth); printf (fmt, dep_name (d), file->name); fflush (stdout); } } } #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET file = org_file; #endif /* Here depth returns to the value it had when we were called. */ depth--; if (file->double_colon && file->deps == 0) { must_make = 1; DBF (DB_BASIC, _("Target '%s' is double-colon and has no prerequisites.\n")); } else if (!noexist && file->is_target && !deps_changed && file->cmds == 0 && !always_make_flag) { must_make = 0; DBF (DB_VERBOSE, _("No recipe for '%s' and no prerequisites actually changed.\n")); } else if (!must_make && file->cmds != 0 && always_make_flag) { must_make = 1; DBF (DB_VERBOSE, _("Making '%s' due to always-make flag.\n")); } if (!must_make) { if (ISDB (DB_VERBOSE)) { print_spaces (depth); printf (_("No need to remake target '%s'"), file->name); if (!streq (file->name, file->hname)) printf (_("; using VPATH name '%s'"), file->hname); puts ("."); fflush (stdout); } notice_finished_file (file); /* Since we don't need to remake the file, convert it to use the VPATH filename if we found one. hfile will be either the local name if no VPATH or the VPATH name if one was found. */ while (file) { file->name = file->hname; file = file->prev; } return 0; } DBF (DB_BASIC, _("Must remake target '%s'.\n")); /* It needs to be remade. If it's VPATH and not reset via GPATH, toss the VPATH. */ if (!streq (file->name, file->hname)) { DB (DB_BASIC, (_(" Ignoring VPATH name '%s'.\n"), file->hname)); file->ignore_vpath = 1; } /* Now, take appropriate actions to remake the file. */ remake_file (file); if (file->command_state != cs_finished) { DBF (DB_VERBOSE, _("Recipe of '%s' is being run.\n")); return 0; } switch (file->update_status) { case us_failed: DBF (DB_BASIC, _("Failed to remake target file '%s'.\n")); break; case us_success: DBF (DB_BASIC, _("Successfully remade target file '%s'.\n")); break; case us_question: DBF (DB_BASIC, _("Target file '%s' needs to be remade under -q.\n")); break; case us_none: break; } file->updated = 1; return file->update_status; } #ifdef CONFIG_WITH_DOT_MUST_MAKE /* Consider the .MUST_MAKE target variable if present. Returns 1 if must remake, 0 if not. The deal is that .MUST_MAKE returns non-zero if it thinks the target needs updating. We have to initialize file variables (for the sake of pattern vars) and set the most important file variables before calling (expanding) the .MUST_MAKE variable. The file variables keeping the dependency lists, $+, $^, $? and $| are not available at this point because $? depends on things happening after we've decided to make the file. So, to keep things simple all 4 of them are undefined in this call. */ static int call_must_make_target_var (struct file *file, unsigned int depth) { struct variable *var; unsigned char ch; const char *str; if (file->variables) { var = lookup_variable_in_set (".MUST_MAKE", sizeof (".MUST_MAKE") - 1, file->variables->set); if (var) { initialize_file_variables (file, 0); set_file_variables (file, 1 /* called early, no dep lists please */); str = variable_expand_for_file_2 (NULL, var->value, var->value_length, file, NULL); /* Stripped string should be non-zero. */ ch = *str; while (ISSPACE (ch)) ch = *++str; if (ch != '\0') { if (ISDB (DB_BASIC)) { print_spaces (depth); printf (_(".MUST_MAKE returned `%s' for target `%s'.\n"), str, file->name); } return 1; } } } return 0; } #endif /* CONFIG_WITH_DOT_MUST_MAKE */ #ifdef CONFIG_WITH_DOT_IS_CHANGED /* Consider the .IS_CHANGED target variable if present. Returns 1 if the file should be considered modified, 0 if not. The calling context and restrictions are the same as for .MUST_MAKE. Make uses the information from this 'function' for determining whether to make a file which lists this as a prerequisite. So, this is the feature you use to check MD5 sums, file sizes, time stamps and the like with data from a previous run. FIXME: Would be nice to know which file is currently being considered. FIXME: Is currently not invoked for intermediate files. */ static int call_is_changed_target_var (struct file *file) { struct variable *var; unsigned char ch; const char *str; if (file->variables) { var = lookup_variable_in_set (".IS_CHANGED", sizeof (".IS_CHANGED") - 1, file->variables->set); if (var) { initialize_file_variables (file, 0); set_file_variables (file, 1 /* called early, no dep lists please */); str = variable_expand_for_file_2 (NULL, var->value, var->value_length, file, NULL); /* stripped string should be non-zero. */ do ch = *str++; while (ISSPACE (ch)); return (ch != '\0'); } } return 0; } #endif /* CONFIG_WITH_DOT_IS_CHANGED */ /* Set FILE's 'updated' flag and re-check its mtime and the mtime's of all files listed in its 'also_make' member. Under -t, this function also touches FILE. On return, FILE->update_status will no longer be us_none if it was. */ void notice_finished_file (struct file *file) { #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET struct file *f2; #endif struct dep *d; int ran = file->command_state == cs_running; int touched = 0; DB (DB_JOBS, (_("notice_finished_file - entering: file=%p `%s' update_status=%d command_state=%d\n"), /* bird */ (void *) file, file->name, file->update_status, file->command_state)); file->command_state = cs_finished; file->updated = 1; #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (file->multi_head) { assert (file == file->multi_head); for (f2 = file->multi_next; f2 != 0; f2 = f2->multi_next) { f2->command_state = cs_finished; f2->updated = 1; } } #endif #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL /* update not_parallel if the file was flagged for that. */ if ( ran && (file->command_flags & (COMMANDS_NOTPARALLEL | COMMANDS_NO_COMMANDS)) == COMMANDS_NOTPARALLEL) { DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s') [notice_finished_file]\n"), not_parallel, not_parallel - 1, (void *) file, file->name)); assert(not_parallel >= 1); --not_parallel; } #endif if (touch_flag /* The update status will be: us_success if 0 or more commands (+ or ${MAKE}) were run and won; us_none if this target was not remade; >us_none if some commands were run and lost. We touch the target if it has commands which either were not run or won when they ran (i.e. status is 0). */ && file->update_status == us_success) { if (file->cmds != 0 && file->cmds->any_recurse) { /* If all the command lines were recursive, we don't want to do the touching. */ unsigned int i; for (i = 0; i < file->cmds->ncommand_lines; ++i) if (!(file->cmds->lines_flags[i] & COMMANDS_RECURSE)) goto have_nonrecursing; } else { have_nonrecursing: if (file->phony) #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET { file->update_status = us_success; if (file->multi_head) for (f2 = file->multi_next; f2 != 0; f2 = f2->multi_next) f2->update_status = us_success; } #else file->update_status = us_success; #endif /* According to POSIX, -t doesn't affect targets with no cmds. */ else if (file->cmds != 0) { /* Should set file's modification date and do nothing else. */ file->update_status = touch_file (file); #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (file->multi_head) for (f2 = file->multi_next; f2 != 0; f2 = f2->multi_next) { /* figure out this, touch if it exist ignore otherwise? */ } #endif /* Pretend we ran a real touch command, to suppress the "'foo' is up to date" message. */ commands_started++; /* Request for the timestamp to be updated (and distributed to the double-colon entries). Simply setting ran=1 would almost have done the trick, but messes up with the also_make updating logic below. */ touched = 1; } } } if (file->mtime_before_update == UNKNOWN_MTIME) file->mtime_before_update = file->last_mtime; #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (file->multi_head) for (f2 = file->multi_next; f2 != 0; f2 = f2->multi_next) if (f2->mtime_before_update == UNKNOWN_MTIME) f2->mtime_before_update = f2->last_mtime; #endif if ((ran && !file->phony) || touched) { int i = 0; /* If -n, -t, or -q and all the commands are recursive, we ran them so really check the target's mtime again. Otherwise, assume the target would have been updated. */ if ((question_flag || just_print_flag || touch_flag) && file->cmds) { for (i = file->cmds->ncommand_lines; i > 0; --i) if (! (file->cmds->lines_flags[i-1] & COMMANDS_RECURSE)) break; } /* If there were no commands at all, it's always new. */ else if (file->is_target && file->cmds == 0) i = 1; file->last_mtime = i == 0 ? UNKNOWN_MTIME : NEW_MTIME; #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (file->multi_head) for (f2 = file->multi_next; f2 != 0; f2 = f2->multi_next) file->last_mtime = i == 0 ? UNKNOWN_MTIME : NEW_MTIME; /*??*/ #endif } if (file->double_colon) { /* If this is a double colon rule and it is the last one to be updated, propagate the change of modification time to all the double-colon entries for this file. We do it on the last update because it is important to handle individual entries as separate rules with separate timestamps while they are treated as targets and then as one rule with the unified timestamp when they are considered as a prerequisite of some target. */ struct file *f; FILE_TIMESTAMP max_mtime = file->last_mtime; /* Check that all rules were updated and at the same time find the max timestamp. We assume UNKNOWN_MTIME is newer then any other value. */ for (f = file->double_colon; f != 0 && f->updated; f = f->prev) if (max_mtime != UNKNOWN_MTIME && (f->last_mtime == UNKNOWN_MTIME || f->last_mtime > max_mtime)) max_mtime = f->last_mtime; if (f == 0) for (f = file->double_colon; f != 0; f = f->prev) f->last_mtime = max_mtime; } if (ran && file->update_status != us_none) #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET { #endif /* We actually tried to update FILE, which has updated its also_make's as well (if it worked). If it didn't work, it wouldn't work again for them. So mark them as updated with the same status. */ for (d = file->also_make; d != 0; d = d->next) { d->file->command_state = cs_finished; d->file->updated = 1; d->file->update_status = file->update_status; if (ran && !d->file->phony) /* Fetch the new modification time. We do this instead of just invalidating the cached time so that a vpath_search can happen. Otherwise, it would never be done because the target is already updated. */ f_mtime (d->file, 0); } #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET /* Same as above but for explicit multi target rules. */ if (file->multi_head) for (f2 = file->multi_next; f2 != 0; f2 = f2->multi_next) { f2->update_status = file->update_status; if (!f2->phony) f_mtime (f2, 0); } } #endif else if (file->update_status == us_none) #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET { /* Nothing was done for FILE, but it needed nothing done. So mark it now as "succeeded". */ file->update_status = 0; if (file->multi_head) for (f2 = file->multi_next; f2 != 0; f2 = f2->multi_next) f2->update_status = 0; } #else /* Nothing was done for FILE, but it needed nothing done. So mark it now as "succeeded". */ file->update_status = us_success; #endif #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS /* We're done with this command, so free the memory held by the chopped command lines. Saves heap for the compilers & linkers. */ if (file->cmds && file->cmds->command_lines) free_chopped_commands (file->cmds); #endif } /* Check whether another file (whose mtime is THIS_MTIME) needs updating on account of a dependency which is file FILE. If it does, store 1 in *MUST_MAKE_PTR. In the process, update any non-intermediate files that FILE depends on (including FILE itself). Return nonzero if any updating failed. */ static enum update_status check_dep (struct file *file, unsigned int depth, FILE_TIMESTAMP this_mtime, int *must_make_ptr) { struct file *ofile; struct dep *d; enum update_status dep_status = us_success; ++depth; start_updating (file); /* We might change file if we find a different one via vpath; remember this one to turn off updating. */ ofile = file; if (file->phony || !file->intermediate) { /* If this is a non-intermediate file, update it and record whether it is newer than THIS_MTIME. */ FILE_TIMESTAMP mtime; dep_status = update_file (file, depth); check_renamed (file); mtime = file_mtime (file); check_renamed (file); if (mtime == NONEXISTENT_MTIME || mtime > this_mtime) *must_make_ptr = 1; #ifdef CONFIG_WITH_DOT_IS_CHANGED else if ( *must_make_ptr == 0 && call_is_changed_target_var (file)) *must_make_ptr = 1; #endif /* CONFIG_WITH_DOT_IS_CHANGED */ } else { /* FILE is an intermediate file. */ FILE_TIMESTAMP mtime; if (!file->phony && file->cmds == 0 && !file->tried_implicit) { if (try_implicit_rule (file, depth)) DBF (DB_IMPLICIT, _("Found an implicit rule for '%s'.\n")); else DBF (DB_IMPLICIT, _("No implicit rule found for '%s'.\n")); file->tried_implicit = 1; } if (file->cmds == 0 && !file->is_target && default_file != 0 && default_file->cmds != 0) { DBF (DB_IMPLICIT, _("Using default commands for '%s'.\n")); file->cmds = default_file->cmds; } check_renamed (file); mtime = file_mtime (file); check_renamed (file); if (mtime != NONEXISTENT_MTIME && mtime > this_mtime) /* If the intermediate file actually exists and is newer, then we should remake from it. */ *must_make_ptr = 1; else { /* Otherwise, update all non-intermediate files we depend on, if necessary, and see whether any of them is more recent than the file on whose behalf we are checking. */ struct dep *ld; int deps_running = 0; /* If this target is not running, set it's state so that we check it fresh. It could be it was checked as part of an order-only prerequisite and so wasn't rebuilt then, but should be now. */ if (file->command_state != cs_running) { /* If the target was waiting for a dependency it has to be reconsidered, as that dependency might have finished. */ if (file->command_state == cs_deps_running) file->considered = 0; set_command_state (file, cs_not_started); } ld = 0; d = file->deps; while (d != 0) { enum update_status new; int maybe_make; if (is_updating (d->file)) { OSS (error, NILF, _("Circular %s <- %s dependency dropped."), file->name, d->file->name); if (ld == 0) { file->deps = d->next; free_dep (d); d = file->deps; } else { ld->next = d->next; free_dep (d); d = ld->next; } continue; } d->file->parent = file; maybe_make = *must_make_ptr; new = check_dep (d->file, depth, this_mtime, &maybe_make); if (new > dep_status) dep_status = new; if (! d->ignore_mtime) *must_make_ptr = maybe_make; check_renamed (d->file); if (dep_status && !keep_going_flag) break; if (d->file->command_state == cs_running || d->file->command_state == cs_deps_running) deps_running = 1; ld = d; d = d->next; } if (deps_running) /* Record that some of FILE's deps are still being made. This tells the upper levels to wait on processing it until the commands are finished. */ set_command_state (file, cs_deps_running); } } finish_updating (file); finish_updating (ofile); return dep_status; } /* Touch FILE. Return us_success if successful, us_failed if not. */ #define TOUCH_ERROR(call) do{ perror_with_name ((call), file->name); \ return us_failed; }while(0) static enum update_status touch_file (struct file *file) { if (!silent_flag) OS (message, 0, "touch %s", file->name); /* Print-only (-n) takes precedence over touch (-t). */ if (just_print_flag) return us_success; #ifndef NO_ARCHIVES if (ar_name (file->name)) return ar_touch (file->name) ? us_failed : us_success; else #endif { int fd; EINTRLOOP (fd, open (file->name, O_RDWR | O_CREAT, 0666)); if (fd < 0) TOUCH_ERROR ("touch: open: "); else { struct stat statbuf; char buf = 'x'; int e; EINTRLOOP (e, fstat (fd, &statbuf)); if (e < 0) TOUCH_ERROR ("touch: fstat: "); /* Rewrite character 0 same as it already is. */ EINTRLOOP (e, read (fd, &buf, 1)); if (e < 0) TOUCH_ERROR ("touch: read: "); { off_t o; EINTRLOOP (o, lseek (fd, 0L, 0)); if (o < 0L) TOUCH_ERROR ("touch: lseek: "); } EINTRLOOP (e, write (fd, &buf, 1)); if (e < 0) TOUCH_ERROR ("touch: write: "); /* If file length was 0, we just changed it, so change it back. */ if (statbuf.st_size == 0) { (void) close (fd); EINTRLOOP (fd, open (file->name, O_RDWR | O_TRUNC, 0666)); if (fd < 0) TOUCH_ERROR ("touch: open: "); } (void) close (fd); } } return us_success; } /* Having checked and updated the dependencies of FILE, do whatever is appropriate to remake FILE itself. Return the status from executing FILE's commands. */ static void remake_file (struct file *file) { #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET assert(file->multi_head == NULL || file->multi_head == file); #endif if (file->cmds == 0) { if (file->phony) /* Phony target. Pretend it succeeded. */ file->update_status = us_success; else if (file->is_target) /* This is a nonexistent target file we cannot make. Pretend it was successfully remade. */ file->update_status = us_success; else { /* This is a dependency file we cannot remake. Fail. */ if (!rebuilding_makefiles || !file->dontcare) complain (file); file->update_status = us_failed; } } else { chop_commands (file->cmds); /* The normal case: start some commands. */ if (!touch_flag || file->cmds->any_recurse) { execute_file_commands (file); return; } /* This tells notice_finished_file it is ok to touch the file. */ file->update_status = us_success; } /* This does the touching under -t. */ notice_finished_file (file); } /* Return the mtime of a file, given a 'struct file'. Caches the time in the struct file to avoid excess stat calls. If the file is not found, and SEARCH is nonzero, VPATH searching and replacement is done. If that fails, a library (-lLIBNAME) is tried and the library's actual name (/lib/libLIBNAME.a, etc.) is substituted into FILE. */ FILE_TIMESTAMP f_mtime (struct file *file, int search) { FILE_TIMESTAMP mtime; int propagate_timestamp; /* File's mtime is not known; must get it from the system. */ #ifndef NO_ARCHIVES if (ar_name (file->name)) { /* This file is an archive-member reference. */ char *arname, *memname; struct file *arfile; time_t member_date; /* Find the archive's name. */ ar_parse_name (file->name, &arname, &memname); /* Find the modification time of the archive itself. Also allow for its name to be changed via VPATH search. */ arfile = lookup_file (arname); if (arfile == 0) arfile = enter_file (strcache_add (arname)); mtime = f_mtime (arfile, search); check_renamed (arfile); if (search && strcmp (arfile->hname, arname)) { /* The archive's name has changed. Change the archive-member reference accordingly. */ char *name; unsigned int arlen, memlen; arlen = strlen (arfile->hname); memlen = strlen (memname); name = alloca (arlen + 1 + memlen + 2); memcpy (name, arfile->hname, arlen); name[arlen] = '('; memcpy (name + arlen + 1, memname, memlen); name[arlen + 1 + memlen] = ')'; name[arlen + 1 + memlen + 1] = '\0'; /* If the archive was found with GPATH, make the change permanent; otherwise defer it until later. */ if (arfile->name == arfile->hname) rename_file (file, strcache_add (name)); else rehash_file (file, strcache_add (name)); check_renamed (file); } free (arname); file->low_resolution_time = 1; if (mtime == NONEXISTENT_MTIME) /* The archive doesn't exist, so its members don't exist either. */ return NONEXISTENT_MTIME; member_date = ar_member_date (file->hname); mtime = (member_date == (time_t) -1 ? NONEXISTENT_MTIME : file_timestamp_cons (file->hname, member_date, 0)); } else #endif { mtime = name_mtime (file->name); if (mtime == NONEXISTENT_MTIME && search && !file->ignore_vpath) { /* If name_mtime failed, search VPATH. */ const char *name = vpath_search (file->name, &mtime, NULL, NULL); if (name /* Last resort, is it a library (-lxxx)? */ || (file->name[0] == '-' && file->name[1] == 'l' && (name = library_search (file->name, &mtime)) != 0)) { int name_len; if (mtime != UNKNOWN_MTIME) /* vpath_search and library_search store UNKNOWN_MTIME if they didn't need to do a stat call for their work. */ file->last_mtime = mtime; /* If we found it in VPATH, see if it's in GPATH too; if so, change the name right now; if not, defer until after the dependencies are updated. */ #ifndef VMS name_len = strlen (name) - strlen (file->name) - 1; #else name_len = strlen (name) - strlen (file->name); if (name[name_len - 1] == '/') name_len--; #endif if (gpath_search (name, name_len)) { rename_file (file, name); check_renamed (file); return file_mtime (file); } rehash_file (file, name); check_renamed (file); /* If the result of a vpath search is -o or -W, preserve it. Otherwise, find the mtime of the resulting file. */ if (mtime != OLD_MTIME && mtime != NEW_MTIME) mtime = name_mtime (name); } } } /* Files can have bogus timestamps that nothing newly made will be "newer" than. Updating their dependents could just result in loops. So notify the user of the anomaly with a warning. We only need to do this once, for now. */ if (!clock_skew_detected && mtime != NONEXISTENT_MTIME && mtime != NEW_MTIME && !file->updated) { static FILE_TIMESTAMP adjusted_now; FILE_TIMESTAMP adjusted_mtime = mtime; #if defined(WINDOWS32) || defined(__MSDOS__) /* Experimentation has shown that FAT filesystems can set file times up to 3 seconds into the future! Play it safe. */ #define FAT_ADJ_OFFSET (FILE_TIMESTAMP) 3 FILE_TIMESTAMP adjustment = FAT_ADJ_OFFSET << FILE_TIMESTAMP_LO_BITS; if (ORDINARY_MTIME_MIN + adjustment <= adjusted_mtime) adjusted_mtime -= adjustment; #elif defined(__EMX__) /* FAT filesystems round time to the nearest even second! Allow for any file (NTFS or FAT) to perhaps suffer from this brain damage. */ FILE_TIMESTAMP adjustment = (((FILE_TIMESTAMP_S (adjusted_mtime) & 1) == 0 && FILE_TIMESTAMP_NS (adjusted_mtime) == 0) ? (FILE_TIMESTAMP) 1 << FILE_TIMESTAMP_LO_BITS : 0); #endif /* If the file's time appears to be in the future, update our concept of the present and try once more. */ if (adjusted_now < adjusted_mtime) { int resolution; FILE_TIMESTAMP now = file_timestamp_now (&resolution); adjusted_now = now + (resolution - 1); if (adjusted_now < adjusted_mtime) { #ifdef NO_FLOAT OS (error, NILF, _("Warning: File '%s' has modification time in the future"), file->name); #else double from_now = (FILE_TIMESTAMP_S (mtime) - FILE_TIMESTAMP_S (now) + ((FILE_TIMESTAMP_NS (mtime) - FILE_TIMESTAMP_NS (now)) / 1e9)); char from_now_string[100]; if (from_now >= 99 && from_now <= ULONG_MAX) sprintf (from_now_string, "%lu", (unsigned long) from_now); else sprintf (from_now_string, "%.2g", from_now); OSS (error, NILF, _("Warning: File '%s' has modification time %s s in the future"), file->name, from_now_string); #endif clock_skew_detected = 1; } } } /* Store the mtime into all the entries for this file for which it is safe to do so: avoid propagating timestamps to double-colon rules that haven't been examined so they're run or not based on the pre-update timestamp. */ if (file->double_colon) file = file->double_colon; propagate_timestamp = file->updated; do { /* If this file is not implicit but it is intermediate then it was made so by the .INTERMEDIATE target. If this file has never been built by us but was found now, it existed before make started. So, turn off the intermediate bit so make doesn't delete it, since it didn't create it. */ if (mtime != NONEXISTENT_MTIME && file->command_state == cs_not_started && !file->tried_implicit && file->intermediate) file->intermediate = 0; if (file->updated == propagate_timestamp) file->last_mtime = mtime; file = file->prev; } while (file != 0); return mtime; } /* Return the mtime of the file or archive-member reference NAME. */ /* First, we check with stat(). If the file does not exist, then we return NONEXISTENT_MTIME. If it does, and the symlink check flag is set, then examine each indirection of the symlink and find the newest mtime. This causes one duplicate stat() when -L is being used, but the code is much cleaner. */ static FILE_TIMESTAMP name_mtime (const char *name) { FILE_TIMESTAMP mtime; struct stat st; int e; #if defined(KMK) && defined(KBUILD_OS_WINDOWS) extern int stat_only_mtime(const char *pszPath, struct stat *pStat); e = stat_only_mtime (name, &st); #else EINTRLOOP (e, stat (name, &st)); #endif if (e == 0) mtime = FILE_TIMESTAMP_STAT_MODTIME (name, st); else if (errno == ENOENT || errno == ENOTDIR) mtime = NONEXISTENT_MTIME; else { perror_with_name ("stat: ", name); return NONEXISTENT_MTIME; } /* If we get here we either found it, or it doesn't exist. If it doesn't exist see if we can use a symlink mtime instead. */ #ifdef MAKE_SYMLINKS #ifndef S_ISLNK # define S_ISLNK(_m) (((_m)&S_IFMT)==S_IFLNK) #endif if (check_symlink_flag) { PATH_VAR (lpath); /* Check each symbolic link segment (if any). Find the latest mtime amongst all of them (and the target file of course). Note that we have already successfully dereferenced all the links above. So, if we run into any error trying to lstat(), or readlink(), or whatever, something bizarre-o happened. Just give up and use whatever mtime we've already computed at that point. */ strcpy (lpath, name); while (1) { FILE_TIMESTAMP ltime; PATH_VAR (lbuf); long llen; char *p; EINTRLOOP (e, lstat (lpath, &st)); if (e) { /* Just take what we have so far. */ if (errno != ENOENT && errno != ENOTDIR) perror_with_name ("lstat: ", lpath); break; } /* If this is not a symlink, we're done (we started with the real file's mtime so we don't need to test it again). */ if (!S_ISLNK (st.st_mode)) break; /* If this mtime is newer than what we had, keep the new one. */ ltime = FILE_TIMESTAMP_STAT_MODTIME (lpath, st); if (ltime > mtime) mtime = ltime; /* Set up to check the file pointed to by this link. */ EINTRLOOP (llen, readlink (lpath, lbuf, GET_PATH_MAX)); if (llen < 0) { /* Eh? Just take what we have. */ perror_with_name ("readlink: ", lpath); break; } lbuf[llen] = '\0'; /* If the target is fully-qualified or the source is just a filename, then the new path is the target. Otherwise it's the source directory plus the target. */ if (lbuf[0] == '/' || (p = strrchr (lpath, '/')) == NULL) strcpy (lpath, lbuf); else if ((p - lpath) + llen + 2 > GET_PATH_MAX) /* Eh? Path too long! Again, just go with what we have. */ break; else /* Create the next step in the symlink chain. */ strcpy (p+1, lbuf); } } #endif return mtime; } /* Search for a library file specified as -lLIBNAME, searching for a suitable library file in the system library directories and the VPATH directories. */ static const char * library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr) { static const char *dirs[] = { #ifdef KMK ".", #else /* !KMK */ #ifndef _AMIGA "/lib", "/usr/lib", #endif #if defined(WINDOWS32) && !defined(LIBDIR) /* * This is completely up to the user at product install time. Just define * a placeholder. */ #define LIBDIR "." #endif # ifdef LIBDIR /* bird */ LIBDIR, /* Defined by configuration. */ # else /* bird */ ".", /* bird */ # endif /* bird */ #endif /* !KMK */ 0 }; const char *file = 0; char *libpatterns; FILE_TIMESTAMP mtime; /* Loop variables for the libpatterns value. */ char *p; const char *p2; unsigned int len; unsigned int liblen; /* Information about the earliest (in the vpath sequence) match. */ unsigned int best_vpath = 0, best_path = 0; const char **dp; libpatterns = xstrdup (variable_expand ("$(.LIBPATTERNS)")); /* Skip the '-l'. */ lib += 2; liblen = strlen (lib); /* Loop through all the patterns in .LIBPATTERNS, and search on each one. To implement the linker-compatible behavior we have to search through all entries in .LIBPATTERNS and choose the "earliest" one. */ p2 = libpatterns; while ((p = find_next_token (&p2, &len)) != 0) { static char *buf = NULL; static unsigned int buflen = 0; static int libdir_maxlen = -1; static unsigned int std_dirs = 0; char *libbuf = variable_expand (""); const size_t libbuf_offset = libbuf - variable_buffer; /* bird */ /* Expand the pattern using LIB as a replacement. */ { char c = p[len]; char *p3, *p4; p[len] = '\0'; p3 = find_percent (p); if (!p3) { /* Give a warning if there is no pattern. */ OS (error, NILF, _(".LIBPATTERNS element '%s' is not a pattern"), p); p[len] = c; continue; } p4 = variable_buffer_output (libbuf, p, p3-p); p4 = variable_buffer_output (p4, lib, liblen); p4 = variable_buffer_output (p4, p3+1, len - (p3-p)); p[len] = c; libbuf = variable_buffer + libbuf_offset; /* bird - variable_buffer may have been reallocated. UPSTREAM */ } /* Look first for 'libNAME.a' in the current directory. */ mtime = name_mtime (libbuf); if (mtime != NONEXISTENT_MTIME) { if (mtime_ptr != 0) *mtime_ptr = mtime; file = strcache_add (libbuf); /* This by definition will have the best index, so stop now. */ break; } /* Now try VPATH search on that. */ { unsigned int vpath_index, path_index; const char* f = vpath_search (libbuf, mtime_ptr ? &mtime : NULL, &vpath_index, &path_index); if (f) { /* If we have a better match, record it. */ if (file == 0 || vpath_index < best_vpath || (vpath_index == best_vpath && path_index < best_path)) { file = f; best_vpath = vpath_index; best_path = path_index; if (mtime_ptr != 0) *mtime_ptr = mtime; } } } /* Now try the standard set of directories. */ if (!buflen) { for (dp = dirs; *dp != 0; ++dp) { int l = strlen (*dp); if (l > libdir_maxlen) libdir_maxlen = l; std_dirs++; } buflen = strlen (libbuf); buf = xmalloc (libdir_maxlen + buflen + 2); } else if (buflen < strlen (libbuf)) { buflen = strlen (libbuf); buf = xrealloc (buf, libdir_maxlen + buflen + 2); } { /* Use the last std_dirs index for standard directories. This was it will always be greater than the VPATH index. */ unsigned int vpath_index = ~((unsigned int)0) - std_dirs; for (dp = dirs; *dp != 0; ++dp) { sprintf (buf, "%s/%s", *dp, libbuf); mtime = name_mtime (buf); if (mtime != NONEXISTENT_MTIME) { if (file == 0 || vpath_index < best_vpath) { file = strcache_add (buf); best_vpath = vpath_index; if (mtime_ptr != 0) *mtime_ptr = mtime; } } vpath_index++; } } } free (libpatterns); return file; } kbuild-3608/src/kmk/README.customs0000664000175000017500000001061714670377414016655 0ustar locutuslocutus -*-indented-text-*- GNU make can utilize the Customs library, distributed with Pmake, to provide builds distributed across multiple hosts. In order to utilize this capability, you must first download and build the Customs library. It is contained in the Pmake distribution, which can be obtained at: ftp://ftp.icsi.berkeley.edu/pub/ai/stolcke/software/ This integration was tested (superficially) with Pmake 2.1.33. BUILDING CUSTOMS ---------------- First, build pmake and Customs. You need to build pmake first, because Customs require pmake to build. Unfortunately, this is not trivial; please see the pmake and Customs documentation for details. The best place to look for instructions is in the pmake-2.1.33/INSTALL file. Note that the 2.1.33 Pmake distribution comes with a set of patches to GNU make, distributed in the pmake-2.1.33/etc/gnumake/ directory. These patches are based on GNU make 3.75 (there are patches for earlier versions of GNU make, also). The parts of this patchfile which relate directly to Customs support have already been incorporated into this version of GNU make, so you should _NOT_ apply the patch file. However, there are a few non-Customs specific (as far as I could tell) changes here which are not incorporated (for example, the modification to try expanding -lfoo to libfoo.so). If you rely on these changes you'll need to re-apply them by hand. Install the Customs library and header files according to the documentation. You should also install the man pages (contrary to comments in the documentation, they weren't installed automatically for me; I had to cd to the 'pmake-2.1.33/doc' directory and run 'pmake install' there directly). BUILDING GNU MAKE ----------------- Once you've installed Customs, you can build GNU make to use it. When configuring GNU make, merely use the '--with-customs=DIR' option. Provide the directory containing the 'lib' and 'include/customs' subdirectories as DIR. For example, if you installed the customs library in /usr/local/lib and the headers in /usr/local/include/customs, then you'd pass '--with-customs=/usr/local' as an option to configure. Run make (or use build.sh) normally to build GNU make as described in the INSTALL file. See the documentation for Customs for information on starting and configuring Customs. INVOKING CUSTOMS-IZED GNU MAKE ----------------------------- One thing you should be aware of is that the default build environment for Customs requires root permissions. Practically, this means that GNU make must be installed setuid root to use Customs. If you don't want to do this, you can build Customs such that root permissions are not necessary. Andreas Stolcke writes: > pmake, gnumake or any other customs client program is not required to > be suid root if customs was compiled WITHOUT the USE_RESERVED_PORTS > option in customs/config.h. Make sure the "customs" service in > /etc/services is defined accordingly (port 8231 instead of 1001). > Not using USE_RESERVED_PORTS means that a user with programming > skills could impersonate another user by writing a fake customs > client that pretends to be someone other than himself. See the > discussion in etc/SECURITY. PROBLEMS -------- SunOS 4.1.x: The customs/sprite.h header file #includes the header files; this conflicts with GNU make's configuration so you'll get a compile error if you use GCC (or any other ANSI-capable C compiler). I commented out the #include in sprite.h:107: #if defined(sun) || defined(ultrix) || defined(hpux) || defined(sgi) /* #include */ #else YMMV. ------------------------------------------------------------------------------- Copyright (C) 1998-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . kbuild-3608/src/kmk/SMakefile.template0000664000175000017500000001526314670377413017677 0ustar locutuslocutus# -*-Makefile-*- for building GNU make with smake # # NOTE: If you have no 'make' program at all to process this makefile, # run 'build.sh' instead. # # Copyright (C) 1995-2016 Free Software Foundation, Inc. # This file is part of GNU Make. # # GNU Make 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. # # GNU Make 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 . # # Makefile for GNU Make # # Ultrix 2.2 make doesn't expand the value of VPATH. VPATH = /make-%VERSION%/ # This must repeat the value, because configure will remove 'VPATH = .'. srcdir = /make-%VERSION%/ CC = sc RM = delete MAKE = smake CFLAGS = CPPFLAGS = LDFLAGS = # Define these for your system as follows: # -DNO_ARCHIVES To disable 'ar' archive support. # -DNO_FLOAT To avoid using floating-point numbers. # -DENUM_BITFIELDS If the compiler isn't GCC but groks enum foo:2. # Some compilers apparently accept this # without complaint but produce losing code, # so beware. # NeXT 1.0a uses an old version of GCC, which required -D__inline=inline. # See also 'config.h'. defines = # Which flavor of remote job execution support to use. # The code is found in 'remote-$(REMOTE).c'. REMOTE = stub # If you are using the GNU C library, or have the GNU getopt functions in # your C library, you can comment these out. GETOPT = getopt.o getopt1.o GETOPT_SRC = $(srcdir)getopt.c $(srcdir)getopt1.c $(srcdir)getopt.h # If you are using the GNU C library, or have the GNU glob functions in # your C library, you can comment this out. GNU make uses special hooks # into the glob functions to be more efficient (by using make's directory # cache for globbing), so you must use the GNU functions even if your # system's C library has the 1003.2 glob functions already. Also, the glob # functions in the AIX and HPUX C libraries are said to be buggy. GLOB = Lib glob/glob.lib # If your system doesn't have alloca, or the one provided is bad, define this. ALLOCA = alloca.o ALLOCA_SRC = $(srcdir)alloca.c # If your system needs extra libraries loaded in, define them here. # System V probably need -lPW for alloca. HP-UX 7.0's alloca in # libPW.a is broken on HP9000s300 and HP9000s400 machines. Use # alloca.c instead on those machines. LOADLIBES = # Any extra object files your system needs. extras = amiga.o # Common prefix for machine-independent installed files. prefix = # Common prefix for machine-dependent installed files. exec_prefix = # Directory to install 'make' in. bindir = sc:c # Directory to find libraries in for '-lXXX'. libdir = lib: # Directory to search by default for included makefiles. includedir = include: # Directory to install the Info files in. infodir = doc: # Directory to install the man page in. mandir = t: # Number to put on the man page filename. manext = 1 # Prefix to put on installed 'make' binary file name. binprefix = # Prefix to put on installed 'make' man page file name. manprefix = $(binprefix) # Whether or not make needs to be installed setgid. # The value should be either 'true' or 'false'. # On many systems, the getloadavg function (used to implement the '-l' # switch) will not work unless make is installed setgid kmem. install_setgid = false # Install make setgid to this group so it can read /dev/kmem. group = sys # Program to install 'make'. INSTALL_PROGRAM = copy # Program to install the man page. INSTALL_DATA = copy # Generic install program. INSTALL = copy # Program to format Texinfo source into Info files. MAKEINFO = makeinfo # Program to format Texinfo source into DVI files. TEXI2DVI = texi2dvi # Programs to make tags files. ETAGS = etags -w CTAGS = ctags -w #guile = guile.o objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \ rule.o implicit.o default.o variable.o expand.o function.o \ vpath.o version.o ar.o arscan.o signame.o strcache.o hash.o \ output.o remote-$(REMOTE).o $(GLOB) $(GETOPT) $(ALLOCA) \ $(extras) $(guile) srcs = $(srcdir)commands.c $(srcdir)job.c $(srcdir)dir.c \ $(srcdir)file.c $(srcdir)getloadavg.c $(srcdir)misc.c \ $(srcdir)main.c $(srcdir)read.c $(srcdir)remake.c \ $(srcdir)rule.c $(srcdir)implicit.c $(srcdir)default.c \ $(srcdir)variable.c $(srcdir)expand.c $(srcdir)function.c \ $(srcdir)vpath.c $(srcdir)version.c $(srcdir)hash.c \ $(srcdir)guile.c $(srcdir)remote-$(REMOTE).c \ $(srcdir)ar.c $(srcdir)arscan.c $(srcdir)strcache.c \ $(srcdir)signame.c $(srcdir)signame.h $(GETOPT_SRC) \ $(srcdir)commands.h $(srcdir)dep.h $(srcdir)file.h \ $(srcdir)job.h $(srcdir)makeint.h $(srcdir)rule.h \ $(srcdir)output.c $(srcdir)output.h \ $(srcdir)variable.h $(ALLOCA_SRC) $(srcdir)config.h.in .SUFFIXES: .SUFFIXES: .o .c .h .ps .dvi .info .texinfo all: make info: make.info dvi: make.dvi # Some makes apparently use .PHONY as the default goal if it is before 'all'. .PHONY: all check info dvi make.info: make.texinfo $(MAKEINFO) -I$(srcdir) $(srcdir)make.texinfo -o make.info make.dvi: make.texinfo $(TEXI2DVI) $(srcdir)make.texinfo make.ps: make.dvi dvi2ps make.dvi > make.ps make: $(objs) glob/glob.lib $(CC) Link $(LDFLAGS) $(objs) $(LOADLIBES) To make.new -delete quiet make rename make.new make # -I. is needed to find config.h in the build directory. .c.o: $(CC) $(defines) IDir "" IDir $(srcdir)glob \ $(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION) glob/glob.lib: execute << cd glob smake < tagsrcs = $(srcs) $(srcdir)remote-*.c TAGS: $(tagsrcs) $(ETAGS) $(tagsrcs) tags: $(tagsrcs) $(CTAGS) $(tagsrcs) .PHONY: install installdirs install: copy make sc:c loadavg: loadavg.c config.h $(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \ loadavg.c $(LOADLIBES) -o $@ clean: glob-clean -$(RM) -f make loadavg *.o core make.dvi distclean: clean glob-realclean -$(RM) -f Makefile config.h config.status build.sh -$(RM) -f config.log config.cache -$(RM) -f TAGS tags -$(RM) -f make.?? make.??s make.log make.toc make.*aux -$(RM) -f loadavg.c realclean: distclean -$(RM) -f make.info* mostlyclean: clean .PHONY: glob-clean glob-realclean glob-clean glob-realclean: execute << cd glob smake $@ < kbuild-3608/src/kmk/testcase-if1of.kmk0000664000175000017500000000327614670377415017626 0ustar locutuslocutus# $Id: testcase-if1of.kmk 2413 2010-09-11 17:43:04Z bird $ ## @file # kBuild - testcase for the if1of and ifn1of conditionals. # # # Copyright (c) 2007-2010 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # DEPTH = ../.. include $(PATH_KBUILD)/header.kmk # the basics. if1of (asdf,asdf) else $(error busted) endif ifn1of (asdf,asdf) $(error busted) endif # larger sets. if1of (1,2 3 4 5 6 7 8 9 0) $(error busted) endif if1of (1,12 3 4 5 6 7 8 9 0) $(error busted) endif if1of (1,2 31 4 5 6 7 8 9 0) $(error busted) endif ifn1of (1,1 2 3 4 5 6 7 8 9 0) $(error busted) endif ifn1of (8,1 2 3 4 5 6 7 8 9 0) $(error busted) endif ifn1of (asdf,asdf) $(error busted) endif ifn1of (asdf,asdf asdf) $(error busted) endif # any in set 1 match any in set 2. if1of (1 3 5 7 9, 2 4 6 8) $(error busted) endif ifn1of (1 2 3 4 5, 2 4 6 8) $(error busted) endif # real life. ifn1of (win linux, linux) $(error busted) endif ifn1of (win.x86, win.amd64 linux.x86 darwin.x86 win.x86 os2.x86) $(error busted) endif all_recursive: $(ECHO) "if1of and ifn1of work fine" kbuild-3608/src/kmk/kmkbuiltin.c0000664000175000017500000004537214670377412016622 0ustar locutuslocutus/* $Id: kmkbuiltin.c 3389 2020-06-26 17:16:26Z bird $ */ /** @file * kMk Builtin command execution. */ /* * Copyright (c) 2005-2018 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #include #include #include #include #include #include #ifdef _MSC_VER # include #endif #include "makeint.h" #include "job.h" #include "variable.h" #if defined(KBUILD_OS_WINDOWS) && defined(CONFIG_NEW_WIN_CHILDREN) # include "w32/winchildren.h" #endif #include "kmkbuiltin/err.h" #include "kmkbuiltin.h" #ifndef _MSC_VER extern char **environ; #endif /********************************************************************************************************************************* * Global Variables * *********************************************************************************************************************************/ #ifdef CONFIG_WITH_KMK_BUILTIN_STATS extern int print_stats_flag; #endif int kmk_builtin_command(const char *pszCmd, struct child *pChild, char ***ppapszArgvToSpawn, pid_t *pPidSpawned) { int argc; char **argv; int rc; char *pszzCmd; char *pszDst; int fOldStyle = 0; /* * Check and skip the prefix. */ if (strncmp(pszCmd, "kmk_builtin_", sizeof("kmk_builtin_") - 1)) { fprintf(stderr, "kmk_builtin: Invalid command prefix '%s'!\n", pszCmd); return 1; } /* * Parse arguments. */ rc = 0; argc = 0; argv = NULL; pszzCmd = pszDst = (char *)strdup(pszCmd); if (!pszDst) { fprintf(stderr, "kmk_builtin: out of memory. argc=%d\n", argc); return 1; } do { const char * const pszSrcStart = pszCmd; char ch; char chQuote; /* * Start new argument. */ if (!(argc % 16)) { void *pv = realloc(argv, sizeof(char *) * (argc + 17)); if (!pv) { fprintf(stderr, "kmk_builtin: out of memory. argc=%d\n", argc); rc = 1; break; } argv = (char **)pv; } argv[argc++] = pszDst; argv[argc] = NULL; if (!fOldStyle) { /* * Process the next argument, bourne style. */ chQuote = 0; ch = *pszCmd++; do { /* Unquoted mode? */ if (chQuote == 0) { if (ch != '\'' && ch != '"') { if (!isspace(ch)) { if (ch != '\\') *pszDst++ = ch; else { ch = *pszCmd++; if (ch == '\n') /* escaped end-of-line */ break; if (ch == '\r' && *pszCmd == '\n') /* escaped end-of-line */ { pszCmd++; break; } if (ch) *pszDst++ = ch; else { fprintf(stderr, "kmk_builtin: Incomplete escape sequence in argument %d: %s\n", argc, pszSrcStart); rc = 1; break; } } } else break; } else chQuote = ch; } /* Quoted mode */ else if (ch != chQuote) { if ( ch != '\\' || chQuote == '\'') *pszDst++ = ch; else { ch = *pszCmd++; if (ch) { if ( ch != '\\' && ch != '"' && ch != '`' && ch != '$' && ch != '\n') *pszDst++ = '\\'; *pszDst++ = ch; } else { fprintf(stderr, "kmk_builtin: Unbalanced quote in argument %d: %s\n", argc, pszSrcStart); rc = 1; break; } } } else chQuote = 0; } while ((ch = *pszCmd++) != '\0'); } else { /* * Old style in case we ever need it. */ ch = *pszCmd++; if (ch != '"' && ch != '\'') { do *pszDst++ = ch; while ((ch = *pszCmd++) != '\0' && !isspace(ch)); } else { chQuote = ch; for (;;) { char *pszEnd = strchr(pszCmd, chQuote); if (pszEnd) { fprintf(stderr, "kmk_builtin: Unbalanced quote in argument %d: %s\n", argc, pszSrcStart); rc = 1; break; } memcpy(pszDst, pszCmd, pszEnd - pszCmd); pszDst += pszEnd - pszCmd; if (pszEnd[1] != chQuote) break; *pszDst++ = chQuote; } } } *pszDst++ = '\0'; /* * Skip argument separators (IFS=space() for now). Check for EOS. */ if (ch != 0) while ( (ch = *pszCmd) && ( isspace(ch) || (ch == '\\' && (pszCmd[1] == '\n' || (pszCmd[1] == '\r' && pszCmd[2] == '\n'))))) pszCmd++; if (ch == 0) break; } while (rc == 0); /* * Execute the command if parsing was successful. */ if (rc == 0) rc = kmk_builtin_command_parsed(argc, argv, pChild, ppapszArgvToSpawn, pPidSpawned); /* clean up and return. */ free(argv); free(pszzCmd); return rc; } /** * kmk built command. */ static const KMKBUILTINENTRY g_aBuiltIns[] = { #define BUILTIN_ENTRY(a_fn, a_sz, a_uFnSignature, fMtSafe, fNeedEnv) \ { { { sizeof(a_sz) - 1, a_sz, } }, { (uintptr_t)a_fn }, a_uFnSignature, fMtSafe, fNeedEnv } /* More frequently used commands: */ BUILTIN_ENTRY(kmk_builtin_append, "append", FN_SIG_MAIN_SPAWNS, 0, 0), BUILTIN_ENTRY(kmk_builtin_printf, "printf", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_echo, "echo", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_install, "install", FN_SIG_MAIN, 1, 0), BUILTIN_ENTRY(kmk_builtin_kDepObj, "kDepObj", FN_SIG_MAIN, 1, 0), #ifdef KBUILD_OS_WINDOWS BUILTIN_ENTRY(kmk_builtin_kSubmit, "kSubmit", FN_SIG_MAIN_SPAWNS, 0, 1), BUILTIN_ENTRY(kmk_builtin_kill, "kill", FN_SIG_MAIN, 0, 0), #endif BUILTIN_ENTRY(kmk_builtin_mkdir, "mkdir", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_mv, "mv", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_redirect, "redirect", FN_SIG_MAIN_SPAWNS, 1, 1), BUILTIN_ENTRY(kmk_builtin_rm, "rm", FN_SIG_MAIN, 1, 1), BUILTIN_ENTRY(kmk_builtin_rmdir, "rmdir", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_test, "test", FN_SIG_MAIN_TO_SPAWN, 0, 0), /* Less frequently used commands: */ BUILTIN_ENTRY(kmk_builtin_kDepIDB, "kDepIDB", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_chmod, "chmod", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_cp, "cp", FN_SIG_MAIN, 1, 1), BUILTIN_ENTRY(kmk_builtin_expr, "expr", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_ln, "ln", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_md5sum, "md5sum", FN_SIG_MAIN, 1, 0), BUILTIN_ENTRY(kmk_builtin_cmp, "cmp", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_cat, "cat", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_touch, "touch", FN_SIG_MAIN, 0, 0), BUILTIN_ENTRY(kmk_builtin_sleep, "sleep", FN_SIG_MAIN, 1, 0), BUILTIN_ENTRY(kmk_builtin_dircache, "dircache", FN_SIG_MAIN, 0, 0), }; #ifdef CONFIG_WITH_KMK_BUILTIN_STATS /** Statistics running in parallel to g_aBuiltIns. */ struct { big_int cNs; unsigned cTimes; unsigned cAsyncTimes; } g_aBuiltInStats[sizeof(g_aBuiltIns) / sizeof(g_aBuiltIns[0])]; #endif int kmk_builtin_command_parsed(int argc, char **argv, struct child *pChild, char ***ppapszArgvToSpawn, pid_t *pPidSpawned) { /* * Check and skip the prefix. */ static const char s_szPrefix[] = "kmk_builtin_"; const char *pszCmd = argv[0]; if (strncmp(pszCmd, s_szPrefix, sizeof(s_szPrefix) - 1) == 0) { struct KMKBUILTINENTRY const *pEntry; size_t cchAndStart; #if K_ENDIAN == K_ENDIAN_BIG size_t cch; #endif int cLeft; pszCmd += sizeof(s_szPrefix) - 1; /* * Calc the length and start word to avoid calling memcmp/strcmp on each entry. */ #if K_ARCH_BITS != 64 && K_ARCH_BITS != 32 # error "PORT ME!" #endif cchAndStart = strlen(pszCmd); #if K_ENDIAN == K_ENDIAN_BIG cch = cchAndStart; cchAndStart <<= K_ARCH_BITS - 8; switch (cch) { default: /* fall thru */ # if K_ARCH_BITS >= 64 case 7: cchAndStart |= (size_t)pszCmd[6]; /* fall thru */ case 6: cchAndStart |= (size_t)pszCmd[5] << (K_ARCH_BITS - 56); /* fall thru */ case 5: cchAndStart |= (size_t)pszCmd[4] << (K_ARCH_BITS - 48); /* fall thru */ case 4: cchAndStart |= (size_t)pszCmd[3] << (K_ARCH_BITS - 40); /* fall thru */ # endif /* fall thru - gcc 8.2.0 is confused by # endif */ case 3: cchAndStart |= (size_t)pszCmd[2] << (K_ARCH_BITS - 32); /* fall thru */ case 2: cchAndStart |= (size_t)pszCmd[1] << (K_ARCH_BITS - 24); /* fall thru */ case 1: cchAndStart |= (size_t)pszCmd[0] << (K_ARCH_BITS - 16); /* fall thru */ case 0: break; } #else switch (cchAndStart) { default: /* fall thru */ # if K_ARCH_BITS >= 64 case 7: cchAndStart |= (size_t)pszCmd[6] << 56; /* fall thru */ case 6: cchAndStart |= (size_t)pszCmd[5] << 48; /* fall thru */ case 5: cchAndStart |= (size_t)pszCmd[4] << 40; /* fall thru */ case 4: cchAndStart |= (size_t)pszCmd[3] << 32; /* fall thru */ # endif /* fall thru - gcc 8.2.0 is confused by # endif */ case 3: cchAndStart |= (size_t)pszCmd[2] << 24; /* fall thru */ case 2: cchAndStart |= (size_t)pszCmd[1] << 16; /* fall thru */ case 1: cchAndStart |= (size_t)pszCmd[0] << 8; /* fall thru */ case 0: break; } #endif /* * Look up the builtin command in the table. */ pEntry = &g_aBuiltIns[0]; cLeft = sizeof(g_aBuiltIns) / sizeof(g_aBuiltIns[0]); while (cLeft-- > 0) if ( pEntry->uName.cchAndStart != cchAndStart || ( pEntry->uName.s.cch >= sizeof(cchAndStart) && memcmp(pEntry->uName.s.sz, pszCmd, pEntry->uName.s.cch) != 0) ) pEntry++; else { /* * That's a match! * * First get the environment if it is actually needed. This is * especially important when we run on a worker thread as it must * not under any circumstances do stuff like target_environment. */ int rc; char **papszEnvVars = NULL; if (pEntry->fNeedEnv) { papszEnvVars = pChild->environment; if (!papszEnvVars) pChild->environment = papszEnvVars = target_environment(pChild->file); } #if defined(KBUILD_OS_WINDOWS) && defined(CONFIG_NEW_WIN_CHILDREN) /* * If the built-in is multi thread safe, we will run it on a job slot thread. */ if (pEntry->fMtSafe) { rc = MkWinChildCreateBuiltIn(pEntry, argc, argv, papszEnvVars, pChild, pPidSpawned); # ifdef CONFIG_WITH_KMK_BUILTIN_STATS g_aBuiltInStats[pEntry - &g_aBuiltIns[0]].cAsyncTimes++; # endif } else #endif { /* * Call the worker function. */ #ifdef CONFIG_WITH_KMK_BUILTIN_STATS big_int nsStart = print_stats_flag ? nano_timestamp() : 0; #endif KMKBUILTINCTX Ctx; assert(g_fUMask == umask(g_fUMask)); Ctx.pszProgName = pEntry->uName.s.sz; Ctx.pOut = pChild ? &pChild->output : NULL; if (pEntry->uFnSignature == FN_SIG_MAIN) rc = pEntry->u.pfnMain(argc, argv, papszEnvVars, &Ctx); else if (pEntry->uFnSignature == FN_SIG_MAIN_SPAWNS) rc = pEntry->u.pfnMainSpawns(argc, argv, papszEnvVars, &Ctx, pChild, pPidSpawned); else if (pEntry->uFnSignature == FN_SIG_MAIN_TO_SPAWN) { /* * When we got something to execute, check if the child is a kmk_builtin thing. * We recurse here, both because I'm lazy and because it's easier to debug a * problem then (the call stack shows what's been going on). */ rc = pEntry->u.pfnMainToSpawn(argc, argv, papszEnvVars, &Ctx, ppapszArgvToSpawn); if ( !rc && *ppapszArgvToSpawn && !strncmp(**ppapszArgvToSpawn, s_szPrefix, sizeof(s_szPrefix) - 1)) { char **argv_new = *ppapszArgvToSpawn; int argc_new = 1; while (argv_new[argc_new]) argc_new++; assert(argv_new[0] != argv[0]); assert(!*pPidSpawned); *ppapszArgvToSpawn = NULL; rc = kmk_builtin_command_parsed(argc_new, argv_new, pChild, ppapszArgvToSpawn, pPidSpawned); free(argv_new[0]); free(argv_new); } } else rc = 99; assert(g_fUMask == umask(g_fUMask)); /* builtin command must preserve umask! */ #ifdef CONFIG_WITH_KMK_BUILTIN_STATS if (print_stats_flag) { uintptr_t iEntry = pEntry - &g_aBuiltIns[0]; g_aBuiltInStats[iEntry].cTimes++; g_aBuiltInStats[iEntry].cNs += nano_timestamp() - nsStart; } #endif } return rc; } /* * No match! :-( */ fprintf(stderr, "kmk_builtin: Unknown command '%s%s'!\n", s_szPrefix, pszCmd); } else fprintf(stderr, "kmk_builtin: Invalid command prefix '%s'!\n", pszCmd); return 1; } #ifndef KBUILD_OS_WINDOWS /** Dummy. */ int kmk_builtin_dircache(int argc, char **argv, char **envp, PKMKBUILTINCTX pCtx) { (void)argc; (void)argv; (void)envp; (void)pCtx; return 0; } #endif #ifdef CONFIG_WITH_KMK_BUILTIN_STATS /** * Prints the statistiscs to the given output stream. */ extern void kmk_builtin_print_stats(FILE *pOutput, const char *pszPrefix) { const unsigned cEntries = sizeof(g_aBuiltInStats) / sizeof(g_aBuiltInStats[0]); unsigned i; assert(print_stats_flag); fprintf(pOutput, "\n%skmk built-in command statistics:\n", pszPrefix); for (i = 0; i < cEntries; i++) if (g_aBuiltInStats[i].cTimes > 0) { char szTotal[64]; char szAvg[64]; format_elapsed_nano(szTotal, sizeof(szTotal), g_aBuiltInStats[i].cNs); format_elapsed_nano(szAvg, sizeof(szAvg), g_aBuiltInStats[i].cNs / g_aBuiltInStats[i].cTimes); fprintf(pOutput, "%s kmk_builtin_%-9s: %4u times, %9s total, %9s/call\n", pszPrefix, g_aBuiltIns[i].uName.s.sz, g_aBuiltInStats[i].cTimes, szTotal, szAvg); } else if (g_aBuiltInStats[i].cAsyncTimes > 0) fprintf(pOutput, "%s kmk_builtin_%-9s: %4u times in worker thread\n", pszPrefix, g_aBuiltIns[i].uName.s.sz, g_aBuiltInStats[i].cAsyncTimes); } #endif kbuild-3608/src/kmk/COPYING0000664000175000017500000010451314670377415015334 0ustar locutuslocutus GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . kbuild-3608/src/kmk/strcache2.c0000664000175000017500000011556614670377414016334 0ustar locutuslocutus/* $Id: strcache2.c 3140 2018-03-14 21:28:10Z bird $ */ /** @file * strcache2 - New string cache. */ /* * Copyright (c) 2008-2010 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "makeint.h" #include "strcache2.h" #include #include "debug.h" #ifdef _MSC_VER typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef signed char int8_t; typedef signed short int16_t; typedef signed int int32_t; #else # include #endif #ifdef WINDOWS32 # include # include # include # define PARSE_IN_WORKER #endif #ifdef __OS2__ # include #endif #ifdef HAVE_PTHREAD # include #endif /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /* The default size of a memory segment (1MB). */ #define STRCACHE2_SEG_SIZE (1024U*1024U) /* The default hash table shift (hash size give as a power of two). */ #define STRCACHE2_HASH_SHIFT 16 /** Does the modding / masking of a hash number into an index. */ #ifdef STRCACHE2_USE_MASK # define STRCACHE2_MOD_IT(cache, hash) ((hash) & (cache)->hash_mask) #else # define STRCACHE2_MOD_IT(cache, hash) ((hash) % (cache)->hash_div) #endif # if ( defined(__amd64__) || defined(__x86_64__) || defined(__AMD64__) || defined(_M_X64) || defined(__amd64) \ || defined(__i386__) || defined(__x86__) || defined(__X86__) || defined(_M_IX86) || defined(__i386)) \ && !defined(GCC_ADDRESS_SANITIZER) # define strcache2_get_unaligned_16bits(ptr) ( *((const uint16_t *)(ptr))) # else /* (endian doesn't matter) */ # define strcache2_get_unaligned_16bits(ptr) ( (((const uint8_t *)(ptr))[0] << 8) \ | (((const uint8_t *)(ptr))[1]) ) # endif /******************************************************************************* * Global Variables * *******************************************************************************/ /* List of initialized string caches. */ static struct strcache2 *strcache_head; #ifndef STRCACHE2_USE_MASK /** Finds the closest primary number for power of two value (or something else * useful if not support). */ MY_INLINE unsigned int strcache2_find_prime(unsigned int shift) { switch (shift) { case 5: return 31; case 6: return 61; case 7: return 127; case 8: return 251; case 9: return 509; case 10: return 1021; case 11: return 2039; case 12: return 4093; case 13: return 8191; case 14: return 16381; case 15: return 32749; case 16: return 65521; case 17: return 131063; case 18: return 262139; case 19: return 524269; case 20: return 1048573; case 21: return 2097143; case 22: return 4194301; case 23: return 8388593; default: assert (0); return (1 << shift) - 1; } } #endif /* The following is a bit experiment. It produces longer chains, i.e. worse distribution of the strings in the table, however the actual make performances is better (> 2); while (head-- > 0) { hash += strcache2_get_unaligned_16bits (str); tmp = (strcache2_get_unaligned_16bits (str + 2) << 11) ^ hash; hash = (hash << 16) ^ tmp; str += 2 * sizeof (uint16_t); hash += hash >> 11; } /* tail BIG_HASH_TAIL bytes (minus the odd ones) */ str += (len - BIG_HASH_HEAD - BIG_HASH_TAIL) & ~3U; head = (BIG_HASH_TAIL >> 2); while (head-- > 0) { hash += strcache2_get_unaligned_16bits (str); tmp = (strcache2_get_unaligned_16bits (str + 2) << 11) ^ hash; hash = (hash << 16) ^ tmp; str += 2 * sizeof (uint16_t); hash += hash >> 11; } /* force "avalanching" of final 127 bits. */ hash ^= hash << 3; hash += hash >> 5; hash ^= hash << 4; hash += hash >> 17; hash ^= hash << 25; hash += hash >> 6; return hash; } #endif /* BIG_HASH_SIZE */ MY_INLINE unsigned int strcache2_case_sensitive_hash (const char *str, unsigned int len) { #if 1 /* Paul Hsieh hash SuperFast function: http://www.azillionmonkeys.com/qed/hash.html This performs very good and as a sligtly better distribution than STRING_N_HASH_1 on a typical kBuild run. It is also 37% faster than return_STRING_N_HASH_1 when running the two 100 times over typical kBuild strings that end up here (did a fprintf here and built kBuild). Compiler was 32-bit gcc 4.0.1, darwin, with -O2. FIXME: A path for well aligned data should be added to speed up execution on alignment sensitive systems. */ unsigned int rem; uint32_t hash; uint32_t tmp; assert (sizeof (uint8_t) == sizeof (char)); # ifdef BIG_HASH_SIZE /* long string? */ # if 0 /*BIG_HASH_SIZE > 128*/ if (MY_PREDICT_FALSE(len >= BIG_HASH_SIZE)) # else if (len >= BIG_HASH_SIZE) # endif return strcache2_case_sensitive_hash_big (str, len); # endif /* short string: main loop, walking on 2 x uint16_t */ hash = len; rem = len & 3; len >>= 2; while (len > 0) { hash += strcache2_get_unaligned_16bits (str); tmp = (strcache2_get_unaligned_16bits (str + 2) << 11) ^ hash; hash = (hash << 16) ^ tmp; str += 2 * sizeof (uint16_t); hash += hash >> 11; len--; } /* the remainder */ switch (rem) { case 3: hash += strcache2_get_unaligned_16bits (str); hash ^= hash << 16; hash ^= str[sizeof (uint16_t)] << 18; hash += hash >> 11; break; case 2: hash += strcache2_get_unaligned_16bits (str); hash ^= hash << 11; hash += hash >> 17; break; case 1: hash += *str; hash ^= hash << 10; hash += hash >> 1; break; } /* force "avalanching" of final 127 bits. */ hash ^= hash << 3; hash += hash >> 5; hash ^= hash << 4; hash += hash >> 17; hash ^= hash << 25; hash += hash >> 6; return hash; #elif 1 /* Note! This implementation is 18% faster than return_STRING_N_HASH_1 when running the two 100 times over typical kBuild strings that end up here (did a fprintf here and built kBuild). Compiler was 32-bit gcc 4.0.1, darwin, with -O2. */ unsigned int hash = 0; if (MY_PREDICT_TRUE(len >= 2)) { unsigned int ch0 = *str++; hash = 0; len--; while (len >= 2) { unsigned int ch1 = *str++; hash += ch0 << (ch1 & 0xf); ch0 = *str++; hash += ch1 << (ch0 & 0xf); len -= 2; } if (len == 1) { unsigned ch1 = *str; hash += ch0 << (ch1 & 0xf); hash += ch1; } else hash += ch0; } else if (len) { hash = *str; hash += hash << (hash & 0xf); } else hash = 0; return hash; #elif 1 # if 0 /* This is SDBM. This specific form/unroll was benchmarked to be 28% faster than return_STRING_N_HASH_1. (Now the weird thing is that putting the (ch) first in the assignment made it noticably slower.) However, it is noticably slower in practice, most likely because of more collisions. Hrmpf. */ # define UPDATE_HASH(ch) hash = (hash << 6) + (hash << 16) - hash + (ch) unsigned int hash = 0; # else /* This is DJB2. This specific form/unroll was benchmarked to be 27% fast than return_STRING_N_HASH_1. Ditto. */ # define UPDATE_HASH(ch) hash = (hash << 5) + hash + (ch) unsigned int hash = 5381; # endif while (len >= 4) { UPDATE_HASH (str[0]); UPDATE_HASH (str[1]); UPDATE_HASH (str[2]); UPDATE_HASH (str[3]); str += 4; len -= 4; } switch (len) { default: case 0: return hash; case 1: UPDATE_HASH (str[0]); return hash; case 2: UPDATE_HASH (str[0]); UPDATE_HASH (str[1]); return hash; case 3: UPDATE_HASH (str[0]); UPDATE_HASH (str[1]); UPDATE_HASH (str[2]); return hash; } #endif } MY_INLINE unsigned int strcache2_case_insensitive_hash (const char *str, unsigned int len) { unsigned int hash = 0; if (MY_PREDICT_TRUE(len >= 2)) { unsigned int ch0 = *str++; ch0 = tolower (ch0); hash = 0; len--; while (len >= 2) { unsigned int ch1 = *str++; ch1 = tolower (ch1); hash += ch0 << (ch1 & 0xf); ch0 = *str++; ch0 = tolower (ch0); hash += ch1 << (ch0 & 0xf); len -= 2; } if (len == 1) { unsigned ch1 = *str; ch1 = tolower (ch1); hash += ch0 << (ch1 & 0xf); hash += ch1; } else hash += ch0; } else if (len) { hash = *str; hash += hash << (hash & 0xf); } else hash = 0; return hash; } #if 0 MY_INLINE int strcache2_memcmp_inline_short (const char *xs, const char *ys, unsigned int length) { if (length <= 8) { /* short string compare - ~50% of the kBuild calls. */ assert ( !((size_t)ys & 3) ); if (!((size_t)xs & 3)) { /* aligned */ int result; switch (length) { default: /* memcmp for longer strings */ return memcmp (xs, ys, length); case 8: result = *(int32_t*)(xs + 4) - *(int32_t*)(ys + 4); result |= *(int32_t*)xs - *(int32_t*)ys; return result; case 7: result = xs[6] - ys[6]; result |= xs[5] - ys[5]; result |= xs[4] - ys[4]; result |= *(int32_t*)xs - *(int32_t*)ys; return result; case 6: result = xs[5] - ys[5]; result |= xs[4] - ys[4]; result |= *(int32_t*)xs - *(int32_t*)ys; return result; case 5: result = xs[4] - ys[4]; result |= *(int32_t*)xs - *(int32_t*)ys; return result; case 4: return *(int32_t*)xs - *(int32_t*)ys; case 3: result = xs[2] - ys[2]; result |= xs[1] - ys[1]; result |= xs[0] - ys[0]; return result; case 2: result = xs[1] - ys[1]; result |= xs[0] - ys[0]; return result; case 1: return *xs - *ys; case 0: return 0; } } else { /* unaligned */ int result = 0; switch (length) { case 8: result |= xs[7] - ys[7]; case 7: result |= xs[6] - ys[6]; case 6: result |= xs[5] - ys[5]; case 5: result |= xs[4] - ys[4]; case 4: result |= xs[3] - ys[3]; case 3: result |= xs[2] - ys[2]; case 2: result |= xs[1] - ys[1]; case 1: result |= xs[0] - ys[0]; case 0: return result; } } } /* memcmp for longer strings */ return memcmp (xs, ys, length); } #endif MY_INLINE int strcache2_memcmp_inlined (const char *xs, const char *ys, unsigned int length) { #ifndef ELECTRIC_HEAP assert ( !((size_t)ys & 3) ); #endif if (!((size_t)xs & 3)) { /* aligned */ int result; unsigned reminder = length & 7; length >>= 3; while (length-- > 0) { result = *(int32_t*)xs - *(int32_t*)ys; result |= *(int32_t*)(xs + 4) - *(int32_t*)(ys + 4); if (MY_PREDICT_FALSE(result)) return result; xs += 8; ys += 8; } switch (reminder) { case 7: result = *(int32_t*)xs - *(int32_t*)ys; result |= xs[6] - ys[6]; result |= xs[5] - ys[5]; result |= xs[4] - ys[4]; return result; case 6: result = *(int32_t*)xs - *(int32_t*)ys; result |= xs[5] - ys[5]; result |= xs[4] - ys[4]; return result; case 5: result = *(int32_t*)xs - *(int32_t*)ys; result |= xs[4] - ys[4]; return result; case 4: return *(int32_t*)xs - *(int32_t*)ys; case 3: result = xs[2] - ys[2]; result |= xs[1] - ys[1]; result |= xs[0] - ys[0]; return result; case 2: result = xs[1] - ys[1]; result |= xs[0] - ys[0]; return result; case 1: return *xs - *ys; default: case 0: return 0; } } else { /* unaligned */ int result; unsigned reminder = length & 7; length >>= 3; while (length-- > 0) { #if defined(__i386__) || defined(__x86_64__) result = ( ((int32_t)xs[3] << 24) | ((int32_t)xs[2] << 16) | ((int32_t)xs[1] << 8) | xs[0] ) - *(int32_t*)ys; result |= ( ((int32_t)xs[7] << 24) | ((int32_t)xs[6] << 16) | ((int32_t)xs[5] << 8) | xs[4] ) - *(int32_t*)(ys + 4); #else result = xs[3] - ys[3]; result |= xs[2] - ys[2]; result |= xs[1] - ys[1]; result |= xs[0] - ys[0]; result |= xs[7] - ys[7]; result |= xs[6] - ys[6]; result |= xs[5] - ys[5]; result |= xs[4] - ys[4]; #endif if (MY_PREDICT_FALSE(result)) return result; xs += 8; ys += 8; } result = 0; switch (reminder) { case 7: result |= xs[6] - ys[6]; /* fall thru */ case 6: result |= xs[5] - ys[5]; /* fall thru */ case 5: result |= xs[4] - ys[4]; /* fall thru */ case 4: result |= xs[3] - ys[3]; /* fall thru */ case 3: result |= xs[2] - ys[2]; /* fall thru */ case 2: result |= xs[1] - ys[1]; /* fall thru */ case 1: result |= xs[0] - ys[0]; /* fall thru */ return result; default: case 0: return 0; } } } MY_INLINE int strcache2_is_equal (struct strcache2 *cache, struct strcache2_entry const *entry, const char *str, unsigned int length, unsigned int hash) { assert (!cache->case_insensitive); /* the simple stuff first. */ if ( entry->hash != hash || entry->length != length) return 0; #if 0 return memcmp (str, entry + 1, length) == 0; #elif 1 return strcache2_memcmp_inlined (str, (const char *)(entry + 1), length) == 0; #else return strcache2_memcmp_inline_short (str, (const char *)(entry + 1), length) == 0; #endif } #if defined(HAVE_CASE_INSENSITIVE_FS) MY_INLINE int strcache2_is_iequal (struct strcache2 *cache, struct strcache2_entry const *entry, const char *str, unsigned int length, unsigned int hash) { assert (cache->case_insensitive); /* the simple stuff first. */ if ( entry->hash != hash || entry->length != length) return 0; # if defined(_MSC_VER) || defined(__OS2__) return _memicmp (entry + 1, str, length) == 0; # else return strncasecmp ((const char *)(entry + 1), str, length) == 0; # endif } #endif /* HAVE_CASE_INSENSITIVE_FS */ static void strcache2_rehash (struct strcache2 *cache) { unsigned int src = cache->hash_size; struct strcache2_entry **src_tab = cache->hash_tab; struct strcache2_entry **dst_tab; #ifndef STRCACHE2_USE_MASK unsigned int hash_shift; #endif /* Allocate a new hash table twice the size of the current. */ cache->hash_size <<= 1; #ifdef STRCACHE2_USE_MASK cache->hash_mask <<= 1; cache->hash_mask |= 1; #else for (hash_shift = 1; (1U << hash_shift) < cache->hash_size; hash_shift++) /* nothing */; cache->hash_div = strcache2_find_prime (hash_shift); #endif cache->rehash_count <<= 1; cache->hash_tab = dst_tab = (struct strcache2_entry **) xmalloc (cache->hash_size * sizeof (struct strcache2_entry *)); memset (dst_tab, '\0', cache->hash_size * sizeof (struct strcache2_entry *)); /* Copy the entries from the old to the new hash table. */ cache->collision_count = 0; while (src-- > 0) { struct strcache2_entry *entry = src_tab[src]; while (entry) { struct strcache2_entry *next = entry->next; unsigned int dst = STRCACHE2_MOD_IT (cache, entry->hash); if ((entry->next = dst_tab[dst]) != 0) cache->collision_count++; dst_tab[dst] = entry; entry = next; } } /* That's it, just free the old table and we're done. */ free (src_tab); } static struct strcache2_seg * strcache2_new_seg (struct strcache2 *cache, unsigned int minlen) { struct strcache2_seg *seg; size_t size; size_t off; size = cache->def_seg_size; if (size < (size_t)minlen + sizeof (struct strcache2_seg) + STRCACHE2_ENTRY_ALIGNMENT) { size = (size_t)minlen * 2; size = (size + 0xfff) & ~(size_t)0xfff; } seg = xmalloc (size); seg->start = (char *)(seg + 1); seg->size = size - sizeof (struct strcache2_seg); off = (size_t)seg->start & (STRCACHE2_ENTRY_ALIGNMENT - 1); if (off) { off = STRCACHE2_ENTRY_ALIGNMENT - off; seg->start += off; seg->size -= off; } assert (seg->size > minlen); seg->cursor = seg->start; seg->avail = seg->size; seg->next = cache->seg_head; cache->seg_head = seg; return seg; } /* Internal worker that enters a new string into the cache. */ static const char * strcache2_enter_string (struct strcache2 *cache, unsigned int idx, const char *str, unsigned int length, unsigned int hash) { struct strcache2_entry *entry; struct strcache2_seg *seg; unsigned int size; char *str_copy; /* Allocate space for the string. */ size = length + 1 + sizeof (struct strcache2_entry); size = (size + STRCACHE2_ENTRY_ALIGNMENT - 1) & ~(STRCACHE2_ENTRY_ALIGNMENT - 1U); seg = cache->seg_head; if (MY_PREDICT_FALSE(seg->avail < size)) { do seg = seg->next; while (seg && seg->avail < size); if (!seg) seg = strcache2_new_seg (cache, size); } entry = (struct strcache2_entry *) seg->cursor; assert (!((size_t)entry & (STRCACHE2_ENTRY_ALIGNMENT - 1))); seg->cursor += size; seg->avail -= size; /* Setup the entry, copy the string and insert it into the hash table. */ entry->user = NULL; entry->length = length; entry->hash = hash; str_copy = (char *) memcpy (entry + 1, str, length); str_copy[length] = '\0'; if ((entry->next = cache->hash_tab[idx]) != 0) cache->collision_count++; cache->hash_tab[idx] = entry; cache->count++; if (cache->count >= cache->rehash_count) strcache2_rehash (cache); return str_copy; } /* The public add string interface. */ const char * strcache2_add (struct strcache2 *cache, const char *str, unsigned int length) { struct strcache2_entry const *entry; unsigned int hash = strcache2_case_sensitive_hash (str, length); unsigned int idx; assert (!cache->case_insensitive); assert (!memchr (str, '\0', length)); MAKE_STATS (cache->lookup_count++); /* Lookup the entry in the hash table, hoping for an early match. If not found, enter the string at IDX. */ idx = STRCACHE2_MOD_IT (cache, hash); entry = cache->hash_tab[idx]; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_equal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_1st_count++); entry = entry->next; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_equal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_2nd_count++); /* Loop the rest. */ for (;;) { entry = entry->next; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_equal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_3rd_count++); } /* not reached */ } /* The public add string interface for prehashed strings. Use strcache2_hash_str to calculate the hash of a string. */ const char * strcache2_add_hashed (struct strcache2 *cache, const char *str, unsigned int length, unsigned int hash) { struct strcache2_entry const *entry; unsigned int idx; #ifndef NDEBUG unsigned correct_hash; assert (!cache->case_insensitive); assert (!memchr (str, '\0', length)); correct_hash = strcache2_case_sensitive_hash (str, length); MY_ASSERT_MSG (hash == correct_hash, ("%#x != %#x\n", hash, correct_hash)); #endif /* NDEBUG */ MAKE_STATS (cache->lookup_count++); /* Lookup the entry in the hash table, hoping for an early match. If not found, enter the string at IDX. */ idx = STRCACHE2_MOD_IT (cache, hash); entry = cache->hash_tab[idx]; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_equal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_1st_count++); entry = entry->next; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_equal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_2nd_count++); /* Loop the rest. */ for (;;) { entry = entry->next; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_equal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_3rd_count++); } /* not reached */ } /* The public lookup (case sensitive) string interface. */ const char * strcache2_lookup (struct strcache2 *cache, const char *str, unsigned int length) { struct strcache2_entry const *entry; unsigned int hash = strcache2_case_sensitive_hash (str, length); unsigned int idx; assert (!cache->case_insensitive); assert (!memchr (str, '\0', length)); MAKE_STATS (cache->lookup_count++); /* Lookup the entry in the hash table, hoping for an early match. */ idx = STRCACHE2_MOD_IT (cache, hash); entry = cache->hash_tab[idx]; if (!entry) return NULL; if (strcache2_is_equal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_1st_count++); entry = entry->next; if (!entry) return NULL; if (strcache2_is_equal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_2nd_count++); /* Loop the rest. */ for (;;) { entry = entry->next; if (!entry) return NULL; if (strcache2_is_equal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_3rd_count++); } /* not reached */ } #if defined(HAVE_CASE_INSENSITIVE_FS) /* The public add string interface for case insensitive strings. */ const char * strcache2_iadd (struct strcache2 *cache, const char *str, unsigned int length) { struct strcache2_entry const *entry; unsigned int hash = strcache2_case_insensitive_hash (str, length); unsigned int idx; assert (cache->case_insensitive); assert (!memchr (str, '\0', length)); MAKE_STATS (cache->lookup_count++); /* Lookup the entry in the hash table, hoping for an early match. If not found, enter the string at IDX. */ idx = STRCACHE2_MOD_IT (cache, hash); entry = cache->hash_tab[idx]; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_iequal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_1st_count++); entry = entry->next; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_iequal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_2nd_count++); /* Loop the rest. */ for (;;) { entry = entry->next; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_iequal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_3rd_count++); } /* not reached */ } /* The public add string interface for prehashed case insensitive strings. Use strcache2_hash_istr to calculate the hash of a string. */ const char * strcache2_iadd_hashed (struct strcache2 *cache, const char *str, unsigned int length, unsigned int hash) { struct strcache2_entry const *entry; unsigned int idx; #ifndef NDEBUG unsigned correct_hash; assert (cache->case_insensitive); assert (!memchr (str, '\0', length)); correct_hash = strcache2_case_insensitive_hash (str, length); MY_ASSERT_MSG (hash == correct_hash, ("%#x != %#x\n", hash, correct_hash)); #endif /* NDEBUG */ MAKE_STATS (cache->lookup_count++); /* Lookup the entry in the hash table, hoping for an early match. If not found, enter the string at IDX. */ idx = STRCACHE2_MOD_IT (cache, hash); entry = cache->hash_tab[idx]; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_iequal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_1st_count++); entry = entry->next; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_iequal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_2nd_count++); /* Loop the rest. */ for (;;) { entry = entry->next; if (!entry) return strcache2_enter_string (cache, idx, str, length, hash); if (strcache2_is_iequal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_3rd_count++); } /* not reached */ } /* The public lookup (case insensitive) string interface. */ const char * strcache2_ilookup (struct strcache2 *cache, const char *str, unsigned int length) { struct strcache2_entry const *entry; unsigned int hash = strcache2_case_insensitive_hash (str, length); unsigned int idx; assert (cache->case_insensitive); assert (!memchr (str, '\0', length)); MAKE_STATS (cache->lookup_count++); /* Lookup the entry in the hash table, hoping for an early match. */ idx = STRCACHE2_MOD_IT (cache, hash); entry = cache->hash_tab[idx]; if (!entry) return NULL; if (strcache2_is_iequal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_1st_count++); entry = entry->next; if (!entry) return NULL; if (strcache2_is_iequal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_2nd_count++); /* Loop the rest. */ for (;;) { entry = entry->next; if (!entry) return NULL; if (strcache2_is_iequal (cache, entry, str, length, hash)) return (const char *)(entry + 1); MAKE_STATS (cache->collision_3rd_count++); } /* not reached */ } #endif /* HAVE_CASE_INSENSITIVE_FS */ /* Is the given string cached? returns 1 if it is, 0 if it isn't. */ int strcache2_is_cached (struct strcache2 *cache, const char *str) { /* Check mandatory alignment first. */ if (!((size_t)str & (sizeof (void *) - 1))) { /* Check the segment list and consider the question answered if the string is within one of them. (Could check it more thoroughly...) */ struct strcache2_seg const *seg; for (seg = cache->seg_head; seg; seg = seg->next) if ((size_t)(str - seg->start) < seg->size) return 1; } return 0; } /* Verify the integrity of the specified string, returning 0 if OK. */ int strcache2_verify_entry (struct strcache2 *cache, const char *str) { struct strcache2_entry const *entry; unsigned int hash; unsigned int length; const char *end; entry = (struct strcache2_entry const *)str - 1; if ((size_t)entry & (STRCACHE2_ENTRY_ALIGNMENT - 1)) { fprintf (stderr, "strcache2[%s]: missaligned entry %p\nstring: %p=%s\n", cache->name, (void *)entry, (void *)str, str); return -1; } end = memchr (str, '\0', entry->length + 1); length = end - str; if (length != entry->length) { fprintf (stderr, "strcache2[%s]: corrupt entry %p, length: %u, expected %u;\nstring: %s\n", cache->name, (void *)entry, length, entry->length, str); return -1; } hash = cache->case_insensitive ? strcache2_case_insensitive_hash (str, entry->length) : strcache2_case_sensitive_hash (str, entry->length); if (hash != entry->hash) { fprintf (stderr, "strcache2[%s]: corrupt entry %p, hash: %x, expected %x;\nstring: %s\n", cache->name, (void *)entry, hash, entry->hash, str); return -1; } return 0; } /* Calculates the case sensitive hash values of the string. The first hash is returned, the other is put at HASH2P. */ unsigned int strcache2_hash_str (const char *str, unsigned int length, unsigned int *hash2p) { *hash2p = 1; return strcache2_case_sensitive_hash (str, length); } /* Calculates the case insensitive hash values of the string. The first hash is returned, the other is put at HASH2P. */ unsigned int strcache2_hash_istr (const char *str, unsigned int length, unsigned int *hash2p) { *hash2p = 1; return strcache2_case_insensitive_hash (str, length); } /* Initalizes a new cache. */ void strcache2_init (struct strcache2 *cache, const char *name, unsigned int size, unsigned int def_seg_size, int case_insensitive, int thread_safe) { unsigned hash_shift; assert (!thread_safe); /* calc the size as a power of two */ if (!size) hash_shift = STRCACHE2_HASH_SHIFT; else { assert (size <= (~0U / 2 + 1)); for (hash_shift = 8; (1U << hash_shift) < size; hash_shift++) /* nothing */; } /* adjust the default segment size */ if (!def_seg_size) def_seg_size = STRCACHE2_SEG_SIZE; else if (def_seg_size < sizeof (struct strcache2_seg) * 10) def_seg_size = sizeof (struct strcache2_seg) * 10; else if ((def_seg_size & 0xfff) < 0xf00) def_seg_size = ((def_seg_size + 0xfff) & ~0xfffU); /* init the structure. */ cache->case_insensitive = case_insensitive; #ifdef STRCACHE2_USE_MASK cache->hash_mask = (1U << hash_shift) - 1U; #else cache->hash_div = strcache2_find_prime(hash_shift); #endif cache->count = 0; cache->collision_count = 0; cache->lookup_count = 0; cache->collision_1st_count = 0; cache->collision_2nd_count = 0; cache->collision_3rd_count = 0; cache->rehash_count = (1U << hash_shift) / 4 * 3; /* rehash at 75% */ cache->init_size = 1U << hash_shift; cache->hash_size = 1U << hash_shift; cache->def_seg_size = def_seg_size; cache->lock = NULL; cache->name = name; /* allocate the hash table and first segment. */ cache->hash_tab = (struct strcache2_entry **) xmalloc (cache->init_size * sizeof (struct strcache2_entry *)); memset (cache->hash_tab, '\0', cache->init_size * sizeof (struct strcache2_entry *)); strcache2_new_seg (cache, 0); /* link it */ cache->next = strcache_head; strcache_head = cache; } /* Terminates a string cache, freeing all memory and other associated resources. */ void strcache2_term (struct strcache2 *cache) { /* unlink it */ if (strcache_head == cache) strcache_head = cache->next; else { struct strcache2 *prev = strcache_head; while (prev->next != cache) prev = prev->next; assert (prev); prev->next = cache->next; } /* free the memory segments */ do { void *free_it = cache->seg_head; cache->seg_head = cache->seg_head->next; free (free_it); } while (cache->seg_head); /* free the hash and clear the structure. */ free (cache->hash_tab); memset (cache, '\0', sizeof (struct strcache2)); } /* Print statistics a string cache. */ void strcache2_print_stats (struct strcache2 *cache, const char *prefix) { unsigned int seg_count = 0; unsigned long seg_total_bytes = 0; unsigned long seg_avg_bytes; unsigned long seg_avail_bytes = 0; unsigned long seg_max_bytes = 0; struct strcache2_seg *seg; unsigned int str_count = 0; unsigned long str_total_len = 0; unsigned int str_avg_len; unsigned int str_min_len = ~0U; unsigned int str_max_len = 0; unsigned int idx; unsigned int rehashes; unsigned int chain_depths[32]; printf (_("\n%s strcache2: %s\n"), prefix, cache->name); /* Segment statistics. */ for (seg = cache->seg_head; seg; seg = seg->next) { seg_count++; seg_total_bytes += seg->size; seg_avail_bytes += seg->avail; if (seg->size > seg_max_bytes) seg_max_bytes = seg->size; } seg_avg_bytes = seg_total_bytes / seg_count; printf (_("%s %u segments: total = %lu / max = %lu / avg = %lu / def = %u avail = %lu\n"), prefix, seg_count, seg_total_bytes, seg_max_bytes, seg_avg_bytes, cache->def_seg_size, seg_avail_bytes); /* String statistics. */ memset (chain_depths, '\0', sizeof (chain_depths)); idx = cache->hash_size; while (idx-- > 0) { struct strcache2_entry const *entry = cache->hash_tab[idx]; unsigned int depth = 0; for (; entry != 0; entry = entry->next, depth++) { unsigned int length = entry->length; str_total_len += length; if (length > str_max_len) str_max_len = length; if (length < str_min_len) str_min_len = length; str_count++; } chain_depths[depth >= 32 ? 31 : depth]++; } str_avg_len = cache->count ? str_total_len / cache->count : 0; printf (_("%s %u strings: total len = %lu / max = %u / avg = %u / min = %u\n"), prefix, cache->count, str_total_len, str_max_len, str_avg_len, str_min_len); if (str_count != cache->count) printf (_("%s string count mismatch! cache->count=%u, actual count is %u\n"), prefix, cache->count, str_count); /* Hash statistics. */ idx = cache->init_size; rehashes = 0; while (idx < cache->hash_size) { idx *= 2; rehashes++; } #ifdef STRCACHE2_USE_MASK printf (_("%s hash size = %u mask = %#x rehashed %u times"), prefix, cache->hash_size, cache->hash_mask, rehashes); #else printf (_("%s hash size = %u div = %#x rehashed %u times"), prefix, cache->hash_size, cache->hash_div, rehashes); #endif if (cache->lookup_count) printf (_("%s lookups = %lu\n" "%s hash collisions 1st = %lu (%u%%) 2nd = %lu (%u%%) 3rd = %lu (%u%%)"), prefix, cache->lookup_count, prefix, cache->collision_1st_count, (unsigned int)((100.0 * cache->collision_1st_count) / cache->lookup_count), cache->collision_2nd_count, (unsigned int)((100.0 * cache->collision_2nd_count) / cache->lookup_count), cache->collision_3rd_count, (unsigned int)((100.0 * cache->collision_3rd_count) / cache->lookup_count)); printf (_("\n%s hash insert collisions = %u (%u%%)\n"), prefix, cache->collision_count,(unsigned int)((100.0 * cache->collision_count) / cache->count)); printf (_("%s %5u (%u%%) empty hash table slots\n"), prefix, chain_depths[0], (unsigned int)((100.0 * chain_depths[0]) / cache->hash_size)); printf (_("%s %5u (%u%%) occupied hash table slots\n"), prefix, chain_depths[1], (unsigned int)((100.0 * chain_depths[1]) / cache->hash_size)); for (idx = 2; idx < 32; idx++) { unsigned strs_at_this_depth = chain_depths[idx]; unsigned i; for (i = idx + 1; i < 32; i++) strs_at_this_depth += chain_depths[i]; if (strs_at_this_depth) printf (_("%s %5u (%2u%%) with %u string%s chained on; %5u (%2u%%) strings at depth %u.\n"), prefix, chain_depths[idx], (unsigned int)((100.0 * chain_depths[idx]) / (cache->count - cache->collision_count)), idx - 1, idx == 2 ? " " : "s", strs_at_this_depth, (unsigned int)((100.0 * strs_at_this_depth) / cache->count), idx - 1); } } /* Print statistics for all string caches. */ void strcache2_print_stats_all (const char *prefix) { struct strcache2 *cur; for (cur = strcache_head; cur; cur = cur->next) strcache2_print_stats (cur, prefix); } kbuild-3608/src/kmk/electric.h0000664000175000017500000000336514670377413016245 0ustar locutuslocutus/* $Id: electric.h 3150 2018-03-15 18:18:03Z bird $ */ /** @file * A simple electric heap implementation, wrapper header. */ /* * Copyright (c) 2007-2010 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ #ifdef ELECTRIC_HEAP #include #ifdef WINDOWS32 # include #endif #include /* strdup */ void xfree (void *); void *xcalloc (unsigned int); void *xmalloc (unsigned int); void *xrealloc (void *, unsigned int); char *xstrdup (const char *); #ifdef __GNUC__ void *xmalloc_size_t (size_t size); void *xcalloc_size_t (size_t size, size_t items); void *xrealloc_size_t (void *ptr, size_t size); #endif #undef free //#define free(a) xfree(a) #define free xfree #undef strdup #define strdup(a) xstrdup(a) #undef calloc #undef malloc #undef realloc #ifdef __GNUC__ # define calloc(a,b) xcalloc_size_t(a,b) # define malloc(a) xmalloc_size_t(a) # define realloc(a,b) xrealloc_size_t(a,b) #else # define calloc(a,b) xcalloc((a) * (b)) # define malloc(a) xmalloc(a) # define realloc(a,b) xrealloc((a),(b)) #endif #endif kbuild-3608/src/kmk/dir.c0000664000175000017500000012657314670377413015233 0ustar locutuslocutus/* Directory hashing for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #include "hash.h" #include "filedef.h" #include "dep.h" #ifdef HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) # ifdef VMS /* its prototype is in vmsdir.h, which is not needed for HAVE_DIRENT_H */ const char *vmsify (const char *name, int type); # endif #else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen # ifdef HAVE_SYS_NDIR_H # include # endif # ifdef HAVE_SYS_DIR_H # include # endif # ifdef HAVE_NDIR_H # include # endif # ifdef HAVE_VMSDIR_H # include "vmsdir.h" # endif /* HAVE_VMSDIR_H */ #endif /* bird: FreeBSD + smbfs -> readdir() + EBADF */ #ifdef __FreeBSD__ # include #endif /* bird: end */ #ifdef CONFIG_WITH_STRCACHE2 # include #endif /* In GNU systems, defines this macro for us. */ #ifdef _D_NAMLEN # undef NAMLEN # define NAMLEN(d) _D_NAMLEN(d) #endif #if (defined (POSIX) || defined (VMS) || defined (WINDOWS32)) && !defined (__GNU_LIBRARY__) /* Posix does not require that the d_ino field be present, and some systems do not provide it. */ # define REAL_DIR_ENTRY(dp) 1 # define FAKE_DIR_ENTRY(dp) #else # define REAL_DIR_ENTRY(dp) (dp->d_ino != 0) # define FAKE_DIR_ENTRY(dp) (dp->d_ino = 1) #endif /* POSIX */ #ifdef __MSDOS__ #include #include /* If it's MSDOS that doesn't have _USE_LFN, disable LFN support. */ #ifndef _USE_LFN #define _USE_LFN 0 #endif static const char * dosify (const char *filename) { static char dos_filename[14]; char *df; int i; if (filename == 0 || _USE_LFN) return filename; /* FIXME: what about filenames which violate 8+3 constraints, like "config.h.in", or ".emacs"? */ if (strpbrk (filename, "\"*+,;<=>?[\\]|") != 0) return filename; df = dos_filename; /* First, transform the name part. */ for (i = 0; i < 8 && ! STOP_SET (*filename, MAP_DOT|MAP_NUL); ++i) *df++ = tolower ((unsigned char)*filename++); /* Now skip to the next dot. */ while (! STOP_SET (*filename, MAP_DOT|MAP_NUL)) ++filename; if (*filename != '\0') { *df++ = *filename++; for (i = 0; i < 3 && ! STOP_SET (*filename, MAP_DOT|MAP_NUL); ++i) *df++ = tolower ((unsigned char)*filename++); } /* Look for more dots. */ while (! STOP_SET (*filename, MAP_DOT|MAP_NUL)) ++filename; if (*filename == '.') return filename; *df = 0; return dos_filename; } #endif /* __MSDOS__ */ #ifdef WINDOWS32 #include #include "pathstuff.h" #endif #ifdef _AMIGA #include #endif #ifdef HAVE_CASE_INSENSITIVE_FS static const char * downcase (const char *filename) { static PATH_VAR (new_filename); char *df; if (filename == 0) return 0; df = new_filename; while (*filename != '\0') { *df++ = tolower ((unsigned char)*filename); ++filename; } *df = 0; return new_filename; } #endif /* HAVE_CASE_INSENSITIVE_FS */ #ifdef VMS static char * downcase_inplace(char *filename) { char *name; name = filename; while (*name != '\0') { *name = tolower ((unsigned char)*name); ++name; } return filename; } #ifndef _USE_STD_STAT /* VMS 8.2 fixed the VMS stat output to have unique st_dev and st_ino when _USE_STD_STAT is used on the compile line. Prior to _USE_STD_STAT support, the st_dev is a pointer to thread static memory containing the device of the last filename looked up. Todo: find out if the ino_t still needs to be faked on a directory. */ /* Define this if the older VMS_INO_T is needed */ #define VMS_INO_T 1 static int vms_hash (const char *name) { int h = 0; while (*name) { unsigned char uc = *name; int g; #ifdef HAVE_CASE_INSENSITIVE_FS h = (h << 4) + (isupper (uc) ? tolower (uc) : uc); #else h = (h << 4) + uc; #endif name++; g = h & 0xf0000000; if (g) { h = h ^ (g >> 24); h = h ^ g; } } return h; } /* fake stat entry for a directory */ static int vmsstat_dir (const char *name, struct stat *st) { char *s; int h; DIR *dir; dir = opendir (name); if (dir == 0) return -1; closedir (dir); s = strchr (name, ':'); /* find device */ if (s) { /* to keep the compiler happy we said "const char *name", now we cheat */ *s++ = 0; st->st_dev = (char *)vms_hash (name); h = vms_hash (s); *(s-1) = ':'; } else { st->st_dev = 0; h = vms_hash (name); } st->st_ino[0] = h & 0xff; st->st_ino[1] = h & 0xff00; st->st_ino[2] = h >> 16; return 0; } # define stat(__path, __sbuf) vmsstat_dir (__path, __sbuf) #endif /* _USE_STD_STAT */ #endif /* VMS */ /* Hash table of directories. */ #ifndef DIRECTORY_BUCKETS #ifdef KMK # define DIRECTORY_BUCKETS 4096 # else # define DIRECTORY_BUCKETS 199 # endif #endif struct directory_contents { dev_t dev; /* Device and inode numbers of this dir. */ #ifdef WINDOWS32 /* Inode means nothing on WINDOWS32. Even file key information is * unreliable because it is random per file open and undefined for remote * filesystems. The most unique attribute I can come up with is the fully * qualified name of the directory. Beware though, this is also * unreliable. I'm open to suggestion on a better way to emulate inode. */ # ifndef CONFIG_WITH_STRCACHE2 char *path_key; # else char const *path_key; /* strcache'ed */ # endif time_t ctime; time_t mtime; /* controls check for stale directory cache */ int fs_flags; /* FS_FAT, FS_NTFS, ... */ # define FS_FAT 0x1 # define FS_NTFS 0x2 # define FS_UNKNOWN 0x4 # ifdef KMK time_t last_updated; /**< The last time the directory was re-read. */ # endif #else # ifdef VMS_INO_T ino_t ino[3]; # else ino_t ino; # endif #endif /* WINDOWS32 */ struct hash_table dirfiles; /* Files in this directory. */ DIR *dirstream; /* Stream reading this directory. */ }; static unsigned long directory_contents_hash_1 (const void *key_0) { const struct directory_contents *key = key_0; unsigned long hash; #ifdef WINDOWS32 # ifndef CONFIG_WITH_STRCACHE2 hash = 0; ISTRING_HASH_1 (key->path_key, hash); # else /* CONFIG_WITH_STRCACHE2 */ hash = strcache2_calc_ptr_hash (&file_strcache, key->path_key); # endif /* CONFIG_WITH_STRCACHE2 */ hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) key->ctime; #else # ifdef VMS_INO_T hash = (((unsigned int) key->dev << 4) ^ ((unsigned int) key->ino[0] + (unsigned int) key->ino[1] + (unsigned int) key->ino[2])); # else hash = ((unsigned int) key->dev << 4) ^ (unsigned int) key->ino; # endif #endif /* WINDOWS32 */ return hash; } static unsigned long directory_contents_hash_2 (const void *key_0) { const struct directory_contents *key = key_0; unsigned long hash; #ifdef WINDOWS32 # ifndef CONFIG_WITH_STRCACHE2 hash = 0; ISTRING_HASH_2 (key->path_key, hash); # else /* CONFIG_WITH_STRCACHE2 */ hash = strcache2_get_hash (&file_strcache, key->path_key); # endif /* CONFIG_WITH_STRCACHE2 */ hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) ~key->ctime; #else # ifdef VMS_INO_T hash = (((unsigned int) key->dev << 4) ^ ~((unsigned int) key->ino[0] + (unsigned int) key->ino[1] + (unsigned int) key->ino[2])); # else hash = ((unsigned int) key->dev << 4) ^ (unsigned int) ~key->ino; # endif #endif /* WINDOWS32 */ return hash; } /* Sometimes it's OK to use subtraction to get this value: result = X - Y; But, if we're not sure of the type of X and Y they may be too large for an int (on a 64-bit system for example). So, use ?: instead. See Savannah bug #15534. NOTE! This macro has side-effects! */ #define MAKECMP(_x,_y) ((_x)<(_y)?-1:((_x)==(_y)?0:1)) static int directory_contents_hash_cmp (const void *xv, const void *yv) { const struct directory_contents *x = xv; const struct directory_contents *y = yv; int result; #ifdef WINDOWS32 # ifndef CONFIG_WITH_STRCACHE2 ISTRING_COMPARE (x->path_key, y->path_key, result); if (result) return result; # else /* CONFIG_WITH_STRCACHE2 */ if (x->path_key != y->path_key) return -1; # endif /* CONFIG_WITH_STRCACHE2 */ result = MAKECMP(x->ctime, y->ctime); if (result) return result; #else # ifdef VMS_INO_T result = MAKECMP(x->ino[0], y->ino[0]); if (result) return result; result = MAKECMP(x->ino[1], y->ino[1]); if (result) return result; result = MAKECMP(x->ino[2], y->ino[2]); if (result) return result; # else result = MAKECMP(x->ino, y->ino); if (result) return result; # endif #endif /* WINDOWS32 */ return MAKECMP(x->dev, y->dev); } /* Table of directory contents hashed by device and inode number. */ static struct hash_table directory_contents; #ifdef CONFIG_WITH_ALLOC_CACHES /* Allocation cache for directory contents. */ struct alloccache directory_contents_cache; #endif struct directory { const char *name; /* Name of the directory. */ /* The directory's contents. This data may be shared by several entries in the hash table, which refer to the same directory (identified uniquely by 'dev' and 'ino') under different names. */ struct directory_contents *contents; }; #ifndef CONFIG_WITH_STRCACHE2 static unsigned long directory_hash_1 (const void *key) { return_ISTRING_HASH_1 (((const struct directory *) key)->name); } static unsigned long directory_hash_2 (const void *key) { return_ISTRING_HASH_2 (((const struct directory *) key)->name); } static int directory_hash_cmp (const void *x, const void *y) { return_ISTRING_COMPARE (((const struct directory *) x)->name, ((const struct directory *) y)->name); } #endif /* !CONFIG_WITH_STRCACHE2 */ /* Table of directories hashed by name. */ static struct hash_table directories; #ifdef CONFIG_WITH_ALLOC_CACHES /* Allocation cache for directories. */ struct alloccache directories_cache; #endif /* Never have more than this many directories open at once. */ #define MAX_OPEN_DIRECTORIES 10 static unsigned int open_directories = 0; /* Hash table of files in each directory. */ struct dirfile { const char *name; /* Name of the file. */ size_t length; short impossible; /* This file is impossible. */ }; #ifndef CONFIG_WITH_STRCACHE2 static unsigned long dirfile_hash_1 (const void *key) { return_ISTRING_HASH_1 (((struct dirfile const *) key)->name); } static unsigned long dirfile_hash_2 (const void *key) { return_ISTRING_HASH_2 (((struct dirfile const *) key)->name); } static int dirfile_hash_cmp (const void *xv, const void *yv) { const struct dirfile *x = xv; const struct dirfile *y = yv; int result = x->length - y->length; if (result) return result; return_ISTRING_COMPARE (x->name, y->name); } #endif /* !CONFIG_WITH_STRCACHE2 */ #ifndef DIRFILE_BUCKETS #define DIRFILE_BUCKETS 107 #endif #ifdef CONFIG_WITH_ALLOC_CACHES /* Allocation cache for dirfiles. */ struct alloccache dirfile_cache; #endif static int dir_contents_file_exists_p (struct directory_contents *dir, const char *filename); static struct directory *find_directory (const char *name); /* Find the directory named NAME and return its 'struct directory'. */ static struct directory * find_directory (const char *name) { struct directory *dir; struct directory **dir_slot; struct directory dir_key; #ifndef CONFIG_WITH_STRCACHE2 dir_key.name = name; dir_slot = (struct directory **) hash_find_slot (&directories, &dir_key); #else const char *p = name + strlen (name); # if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) dir_key.name = strcache_add_len (downcase(name), p - name); # else dir_key.name = strcache_add_len (name, p - name); # endif dir_slot = (struct directory **) hash_find_slot_strcached (&directories, &dir_key); #endif dir = *dir_slot; if (HASH_VACANT (dir)) { /* The directory was not found. Create a new entry for it. */ #ifndef CONFIG_WITH_STRCACHE2 const char *p = name + strlen (name); #endif struct stat st; int r; #ifndef CONFIG_WITH_ALLOC_CACHES dir = xmalloc (sizeof (struct directory)); #else dir = alloccache_alloc (&directories_cache); #endif #ifndef CONFIG_WITH_STRCACHE2 #if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) /* Todo: Why is this only needed on VMS? */ { char *lname = downcase_inplace (xstrdup (name)); dir->name = strcache_add_len (lname, p - name); free (lname); } #else dir->name = strcache_add_len (name, p - name); #endif #else /* CONFIG_WITH_STRCACHE2 */ dir->name = dir_key.name; #endif /* CONFIG_WITH_STRCACHE2 */ hash_insert_at (&directories, dir, dir_slot); /* The directory is not in the name hash table. Find its device and inode numbers, and look it up by them. */ #if defined(WINDOWS32) { char tem[MAXPATHLEN], *tstart, *tend; /* Remove any trailing slashes. Windows32 stat fails even on valid directories if they end in a slash. */ memcpy (tem, name, p - name + 1); tstart = tem; if (tstart[1] == ':') tstart += 2; for (tend = tem + (p - name - 1); tend > tstart && (*tend == '/' || *tend == '\\'); tend--) *tend = '\0'; r = stat (tem, &st); } #else EINTRLOOP (r, stat (name, &st)); #endif if (r < 0) { /* Couldn't stat the directory. Mark this by setting the 'contents' member to a nil pointer. */ dir->contents = 0; } else { /* Search the contents hash table; device and inode are the key. */ #ifdef WINDOWS32 PATH_VAR (w32_fullpath); char *w32_path; #endif struct directory_contents *dc; struct directory_contents **dc_slot; struct directory_contents dc_key; dc_key.dev = st.st_dev; #ifdef WINDOWS32 w32_path = unix_slashes_resolved (name, w32_fullpath, GET_PATH_MAX); # ifndef CONFIG_WITH_STRCACHE2 dc_key.path_key = w32_path; /* = w32ify (name, 1); - bird */ # else /* CONFIG_WITH_STRCACHE2 */ dc_key.path_key = strcache_add (w32_path); # endif /* CONFIG_WITH_STRCACHE2 */ dc_key.ctime = st.st_ctime; #else # ifdef VMS_INO_T dc_key.ino[0] = st.st_ino[0]; dc_key.ino[1] = st.st_ino[1]; dc_key.ino[2] = st.st_ino[2]; # else dc_key.ino = st.st_ino; # endif #endif dc_slot = (struct directory_contents **) hash_find_slot (&directory_contents, &dc_key); dc = *dc_slot; if (HASH_VACANT (dc)) { /* Nope; this really is a directory we haven't seen before. */ #ifdef WINDOWS32 char fs_label[BUFSIZ]; char fs_type[BUFSIZ]; unsigned long fs_serno; unsigned long fs_flags; unsigned long fs_len; #endif #if defined(WINDOWS32) && defined(KMK) static char s_last_volume[4]; static int s_last_flags; #endif #ifndef CONFIG_WITH_ALLOC_CACHES dc = (struct directory_contents *) xmalloc (sizeof (struct directory_contents)); #else dc = (struct directory_contents *) alloccache_alloc (&directory_contents_cache); #endif /* Enter it in the contents hash table. */ dc->dev = st.st_dev; #ifdef WINDOWS32 # ifndef CONFIG_WITH_STRCACHE2 dc->path_key = xstrdup (w32_path); # else /* CONFIG_WITH_STRCACHE2 */ dc->path_key = dc_key.path_key; # endif /* CONFIG_WITH_STRCACHE2 */ dc->ctime = st.st_ctime; dc->mtime = st.st_mtime; # ifdef KMK dc->last_updated = time(NULL); # endif /* NTFS is the only WINDOWS32 filesystem that bumps mtime on a directory when files are added/deleted from a directory. */ w32_path[3] = '\0'; # ifdef KMK /* Need for speed: Cache the GetVolumeInformation result. */ if ( s_last_volume[0] == w32_path[0] && s_last_volume[1] == w32_path[1] && s_last_volume[2] == w32_path[2] && s_last_volume[3] == w32_path[3]) dc->fs_flags = s_last_flags; else { # endif if (GetVolumeInformation (w32_path, fs_label, sizeof (fs_label), &fs_serno, &fs_len, &fs_flags, fs_type, sizeof (fs_type)) == FALSE) dc->fs_flags = FS_UNKNOWN; else if (!strcmp (fs_type, "FAT")) dc->fs_flags = FS_FAT; else if (!strcmp (fs_type, "NTFS")) dc->fs_flags = FS_NTFS; else dc->fs_flags = FS_UNKNOWN; # ifdef KMK s_last_volume[0] = w32_path[0]; s_last_volume[1] = w32_path[1]; s_last_volume[2] = w32_path[2]; s_last_volume[3] = w32_path[3]; s_last_flags = dc->fs_flags; # endif #else # ifdef VMS_INO_T dc->ino[0] = st.st_ino[0]; dc->ino[1] = st.st_ino[1]; dc->ino[2] = st.st_ino[2]; # else dc->ino = st.st_ino; # endif #endif /* WINDOWS32 */ hash_insert_at (&directory_contents, dc, dc_slot); ENULLLOOP (dc->dirstream, opendir (name)); if (dc->dirstream == 0) /* Couldn't open the directory. Mark this by setting the 'files' member to a nil pointer. */ dc->dirfiles.ht_vec = 0; else { #ifdef KMK int buckets = st.st_nlink * 2; if (buckets < DIRFILE_BUCKETS) buckets = DIRFILE_BUCKETS; hash_init_strcached (&dc->dirfiles, buckets, &file_strcache, offsetof (struct dirfile, name)); #else # ifndef CONFIG_WITH_STRCACHE2 hash_init (&dc->dirfiles, DIRFILE_BUCKETS, dirfile_hash_1, dirfile_hash_2, dirfile_hash_cmp); # else /* CONFIG_WITH_STRCACHE2 */ hash_init_strcached (&dc->dirfiles, DIRFILE_BUCKETS, &file_strcache, offsetof (struct dirfile, name)); # endif /* CONFIG_WITH_STRCACHE2 */ #endif ++open_directories; if (open_directories == MAX_OPEN_DIRECTORIES) /* We have too many directories open already. Read the entire directory and then close it. */ dir_contents_file_exists_p (dc, 0); } } /* Point the name-hashed entry for DIR at its contents data. */ dir->contents = dc; } } return dir; } /* Return 1 if the name FILENAME is entered in DIR's hash table. FILENAME must contain no slashes. */ static int dir_contents_file_exists_p (struct directory_contents *dir, const char *filename) { struct dirfile *df; struct dirent *d; #ifdef WINDOWS32 # ifndef KMK struct stat st; # endif int rehash = 0; #endif #ifdef KMK int ret = 0; #endif if (dir == 0 || dir->dirfiles.ht_vec == 0) /* The directory could not be stat'd or opened. */ return 0; #ifdef __MSDOS__ filename = dosify (filename); #endif #ifdef HAVE_CASE_INSENSITIVE_FS filename = downcase (filename); #endif #ifdef __EMX__ if (filename != 0) _fnlwr (filename); /* lower case for FAT drives */ #endif if (filename != 0) { struct dirfile dirfile_key; if (*filename == '\0') { /* Checking if the directory exists. */ return 1; } #ifndef CONFIG_WITH_STRCACHE2 dirfile_key.name = filename; dirfile_key.length = strlen (filename); df = hash_find_item (&dir->dirfiles, &dirfile_key); #else /* CONFIG_WITH_STRCACHE2 */ dirfile_key.length = strlen (filename); dirfile_key.name = filename = strcache_add_len (filename, dirfile_key.length); df = hash_find_item_strcached (&dir->dirfiles, &dirfile_key); #endif /* CONFIG_WITH_STRCACHE2 */ if (df) return !df->impossible; } /* The file was not found in the hashed list. Try to read the directory further. */ if (dir->dirstream == 0) { #if defined(WINDOWS32) && !defined(KMK) /* * Check to see if directory has changed since last read. FAT * filesystems force a rehash always as mtime does not change * on directories (ugh!). */ # ifdef KMK if (dir->path_key && time(NULL) > dc->last_updated + 2) /* KMK: Only recheck every 2 seconds. */ # else if (dir->path_key) # endif { if ((dir->fs_flags & FS_FAT) != 0) { dir->mtime = time ((time_t *) 0); rehash = 1; } # ifdef KMK else if ( birdStatModTimeOnly (dir->path_key, &st.st_mtim, 1) == 0 && st.st_mtime > dir->mtime) # else else if (stat (dir->path_key, &st) == 0 && st.st_mtime > dir->mtime) # endif { /* reset date stamp to show most recent re-process. */ dir->mtime = st.st_mtime; rehash = 1; } /* If it has been already read in, all done. */ if (!rehash) return 0; /* make sure directory can still be opened; if not return. */ dir->dirstream = opendir (dir->path_key); if (!dir->dirstream) return 0; # ifdef KMK dc->last_updated = time(NULL); # endif } else #endif /* The directory has been all read in. */ return 0; } while (1) { /* Enter the file in the hash table. */ unsigned int len; struct dirfile dirfile_key; struct dirfile **dirfile_slot; ENULLLOOP (d, readdir (dir->dirstream)); if (d == 0) { /* bird: Workaround for smbfs mounts returning EBADF at the end of the search. To exactly determin the cause here, I should probably do some smbfs tracing, but for now just ignoring the EBADF on seems to work. (The smb server is 64-bit vista, btw.) */ #if defined (__FreeBSD__) struct statfs stfs; int saved_errno = errno; errno = 0; if (saved_errno == EBADF && !fstatfs (dirfd (dir->dirstream), &stfs) && !(stfs.f_flags & MNT_LOCAL) && !strcmp(stfs.f_fstypename, "smbfs")) { /*fprintf (stderr, "EBADF on remote fs! dirfd=%d errno=%d\n", dirfd (dir->dirstream), errno);*/ saved_errno = 0; } errno = saved_errno; #endif /* bird: end */ if (errno) pfatal_with_name ("INTERNAL: readdir"); break; } #if defined(VMS) && defined(HAVE_DIRENT_H) /* In VMS we get file versions too, which have to be stripped off. Some versions of VMS return versions on Unix files even when the feature option to strip them is set. */ { char *p = strrchr (d->d_name, ';'); if (p) *p = '\0'; } #endif if (!REAL_DIR_ENTRY (d)) continue; len = NAMLEN (d); #ifndef CONFIG_WITH_STRCACHE2 dirfile_key.name = d->d_name; dirfile_key.length = len; dirfile_slot = (struct dirfile **) hash_find_slot (&dir->dirfiles, &dirfile_key); #else # if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) dirfile_key.name = strcache_add_len (downcase(d->d_name), len); # else dirfile_key.name = strcache_add_len (d->d_name, len); # endif dirfile_key.length = len; dirfile_slot = (struct dirfile **) hash_find_slot_strcached (&dir->dirfiles, &dirfile_key); #endif #ifdef WINDOWS32 /* * If re-reading a directory, don't cache files that have * already been discovered. */ if (! rehash || HASH_VACANT (*dirfile_slot)) #endif { #ifndef CONFIG_WITH_ALLOC_CACHES df = xmalloc (sizeof (struct dirfile)); #else df = alloccache_alloc (&dirfile_cache); #endif #ifndef CONFIG_WITH_STRCACHE2 #if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) /* TODO: Why is this only needed on VMS? */ df->name = strcache_add_len (downcase_inplace (d->d_name), len); #else df->name = strcache_add_len (d->d_name, len); #endif #else /* CONFIG_WITH_STRCACHE2 */ df->name = dirfile_key.name; #endif /* CONFIG_WITH_STRCACHE2 */ df->length = len; df->impossible = 0; hash_insert_at (&dir->dirfiles, df, dirfile_slot); } /* Check if the name matches the one we're searching for. */ #ifndef CONFIG_WITH_STRCACHE2 if (filename != 0 && patheq (d->d_name, filename)) #else if (filename != 0 && dirfile_key.name == filename) #endif #ifdef KMK ret = 1; /* Cache the whole dir. Prevents trouble on windows and os2 during 'rebuild'. */ #else return 1; #endif } /* If the directory has been completely read in, close the stream and reset the pointer to nil. */ if (d == 0) { --open_directories; closedir (dir->dirstream); dir->dirstream = 0; } #ifdef KMK return ret; #else return 0; #endif } /* Return 1 if the name FILENAME in directory DIRNAME is entered in the dir hash table. FILENAME must contain no slashes. */ int dir_file_exists_p (const char *dirname, const char *filename) { #ifdef VMS if ((filename != NULL) && (dirname != NULL)) { int want_vmsify; want_vmsify = (strpbrk (dirname, ":<[") != NULL); if (want_vmsify) filename = vmsify (filename, 0); } #endif return dir_contents_file_exists_p (find_directory (dirname)->contents, filename); } /* Return 1 if the file named NAME exists. */ int file_exists_p (const char *name) { const char *dirend; const char *dirname; const char *slash; #ifndef NO_ARCHIVES if (ar_name (name)) return ar_member_date (name) != (time_t) -1; #endif dirend = strrchr (name, '/'); #ifdef VMS if (dirend == 0) { dirend = strrchr (name, ']'); dirend == NULL ? dirend : dirend++; } if (dirend == 0) { dirend = strrchr (name, '>'); dirend == NULL ? dirend : dirend++; } if (dirend == 0) { dirend = strrchr (name, ':'); dirend == NULL ? dirend : dirend++; } #endif /* VMS */ #ifdef HAVE_DOS_PATHS /* Forward and backslashes might be mixed. We need the rightmost one. */ { const char *bslash = strrchr (name, '\\'); if (!dirend || bslash > dirend) dirend = bslash; /* The case of "d:file". */ if (!dirend && name[0] && name[1] == ':') dirend = name + 1; } #endif /* HAVE_DOS_PATHS */ if (dirend == 0) #ifndef _AMIGA return dir_file_exists_p (".", name); #else /* !AMIGA */ return dir_file_exists_p ("", name); #endif /* AMIGA */ slash = dirend; if (dirend == name) dirname = "/"; else { char *p; #ifdef HAVE_DOS_PATHS /* d:/ and d: are *very* different... */ if (dirend < name + 3 && name[1] == ':' && (*dirend == '/' || *dirend == '\\' || *dirend == ':')) dirend++; #endif p = alloca (dirend - name + 1); memcpy (p, name, dirend - name); p[dirend - name] = '\0'; dirname = p; } #ifdef VMS if (*slash == '/') slash++; #else slash++; #endif return dir_file_exists_p (dirname, slash); } /* Mark FILENAME as 'impossible' for 'file_impossible_p'. This means an attempt has been made to search for FILENAME as an intermediate file, and it has failed. */ void file_impossible (const char *filename) { const char *dirend; const char *p = filename; struct directory *dir; struct dirfile *new; dirend = strrchr (p, '/'); #ifdef VMS if (dirend == NULL) { dirend = strrchr (p, ']'); dirend == NULL ? dirend : dirend++; } if (dirend == NULL) { dirend = strrchr (p, '>'); dirend == NULL ? dirend : dirend++; } if (dirend == NULL) { dirend = strrchr (p, ':'); dirend == NULL ? dirend : dirend++; } #endif #ifdef HAVE_DOS_PATHS /* Forward and backslashes might be mixed. We need the rightmost one. */ { const char *bslash = strrchr (p, '\\'); if (!dirend || bslash > dirend) dirend = bslash; /* The case of "d:file". */ if (!dirend && p[0] && p[1] == ':') dirend = p + 1; } #endif /* HAVE_DOS_PATHS */ if (dirend == 0) #ifdef _AMIGA dir = find_directory (""); #else /* !AMIGA */ dir = find_directory ("."); #endif /* AMIGA */ else { const char *dirname; const char *slash = dirend; if (dirend == p) dirname = "/"; else { char *cp; #ifdef HAVE_DOS_PATHS /* d:/ and d: are *very* different... */ if (dirend < p + 3 && p[1] == ':' && (*dirend == '/' || *dirend == '\\' || *dirend == ':')) dirend++; #endif cp = alloca (dirend - p + 1); memcpy (cp, p, dirend - p); cp[dirend - p] = '\0'; dirname = cp; } dir = find_directory (dirname); #ifdef VMS if (*slash == '/') filename = p = slash + 1; else filename = p = slash; #else filename = p = slash + 1; #endif } if (dir->contents == 0) /* The directory could not be stat'd. We allocate a contents structure for it, but leave it out of the contents hash table. */ #ifndef CONFIG_WITH_ALLOC_CACHES dir->contents = xcalloc (sizeof (struct directory_contents)); #else dir->contents = alloccache_calloc (&directory_contents_cache); #endif if (dir->contents->dirfiles.ht_vec == 0) { #ifndef CONFIG_WITH_STRCACHE2 hash_init (&dir->contents->dirfiles, DIRFILE_BUCKETS, dirfile_hash_1, dirfile_hash_2, dirfile_hash_cmp); #else /* CONFIG_WITH_STRCACHE2 */ hash_init_strcached (&dir->contents->dirfiles, DIRFILE_BUCKETS, &file_strcache, offsetof (struct dirfile, name)); #endif /* CONFIG_WITH_STRCACHE2 */ } /* Make a new entry and put it in the table. */ #ifndef CONFIG_WITH_ALLOC_CACHES new = xmalloc (sizeof (struct dirfile)); #else new = alloccache_alloc (&dirfile_cache); #endif new->length = strlen (filename); #if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) /* todo: Why is this only needed on VMS? */ new->name = strcache_add_len (downcase (filename), new->length); #else new->name = strcache_add_len (filename, new->length); #endif new->impossible = 1; #ifndef CONFIG_WITH_STRCACHE2 hash_insert (&dir->contents->dirfiles, new); #else /* CONFIG_WITH_STRCACHE2 */ hash_insert_strcached (&dir->contents->dirfiles, new); #endif /* CONFIG_WITH_STRCACHE2 */ } /* Return nonzero if FILENAME has been marked impossible. */ int file_impossible_p (const char *filename) { const char *dirend; struct directory_contents *dir; struct dirfile *dirfile; struct dirfile dirfile_key; #ifdef VMS int want_vmsify = 0; #endif dirend = strrchr (filename, '/'); #ifdef VMS if (dirend == NULL) { want_vmsify = (strpbrk (filename, "]>:^") != NULL); dirend = strrchr (filename, ']'); } if (dirend == NULL && want_vmsify) dirend = strrchr (filename, '>'); if (dirend == NULL && want_vmsify) dirend = strrchr (filename, ':'); #endif #ifdef HAVE_DOS_PATHS /* Forward and backslashes might be mixed. We need the rightmost one. */ { const char *bslash = strrchr (filename, '\\'); if (!dirend || bslash > dirend) dirend = bslash; /* The case of "d:file". */ if (!dirend && filename[0] && filename[1] == ':') dirend = filename + 1; } #endif /* HAVE_DOS_PATHS */ if (dirend == 0) #ifdef _AMIGA dir = find_directory ("")->contents; #else /* !AMIGA */ dir = find_directory (".")->contents; #endif /* AMIGA */ else { const char *dirname; const char *slash = dirend; if (dirend == filename) dirname = "/"; else { char *cp; #ifdef HAVE_DOS_PATHS /* d:/ and d: are *very* different... */ if (dirend < filename + 3 && filename[1] == ':' && (*dirend == '/' || *dirend == '\\' || *dirend == ':')) dirend++; #endif cp = alloca (dirend - filename + 1); memcpy (cp, filename, dirend - filename); cp[dirend - filename] = '\0'; dirname = cp; } dir = find_directory (dirname)->contents; #ifdef VMS if (*slash == '/') filename = slash + 1; else filename = slash; #else filename = slash + 1; #endif } if (dir == 0 || dir->dirfiles.ht_vec == 0) /* There are no files entered for this directory. */ return 0; #ifdef __MSDOS__ filename = dosify (filename); #endif #ifdef HAVE_CASE_INSENSITIVE_FS filename = downcase (filename); #endif #ifdef VMS if (want_vmsify) filename = vmsify (filename, 1); #endif #ifndef CONFIG_WITH_STRCACHE2 dirfile_key.name = filename; dirfile_key.length = strlen (filename); dirfile = hash_find_item (&dir->dirfiles, &dirfile_key); #else dirfile_key.length = strlen (filename); dirfile_key.name = strcache_add_len (filename, dirfile_key.length); dirfile = hash_find_item_strcached (&dir->dirfiles, &dirfile_key); #endif if (dirfile) return dirfile->impossible; return 0; } /* Return the already allocated name in the directory hash table that matches DIR. */ const char * dir_name (const char *dir) { return find_directory (dir)->name; } /* Print the data base of directories. */ void print_dir_data_base (void) { unsigned int files; unsigned int impossible; struct directory **dir_slot; struct directory **dir_end; puts (_("\n# Directories\n")); files = impossible = 0; dir_slot = (struct directory **) directories.ht_vec; dir_end = dir_slot + directories.ht_size; for ( ; dir_slot < dir_end; dir_slot++) { struct directory *dir = *dir_slot; if (! HASH_VACANT (dir)) { if (dir->contents == 0) printf (_("# %s: could not be stat'd.\n"), dir->name); else if (dir->contents->dirfiles.ht_vec == 0) { #ifdef WINDOWS32 printf (_("# %s (key %s, mtime %I64u): could not be opened.\n"), dir->name, dir->contents->path_key, (unsigned long long)dir->contents->mtime); #else /* WINDOWS32 */ #ifdef VMS_INO_T printf (_("# %s (device %d, inode [%d,%d,%d]): could not be opened.\n"), dir->name, dir->contents->dev, dir->contents->ino[0], dir->contents->ino[1], dir->contents->ino[2]); #else printf (_("# %s (device %ld, inode %ld): could not be opened.\n"), dir->name, (long int) dir->contents->dev, (long int) dir->contents->ino); #endif #endif /* WINDOWS32 */ } else { unsigned int f = 0; unsigned int im = 0; struct dirfile **files_slot; struct dirfile **files_end; files_slot = (struct dirfile **) dir->contents->dirfiles.ht_vec; files_end = files_slot + dir->contents->dirfiles.ht_size; for ( ; files_slot < files_end; files_slot++) { struct dirfile *df = *files_slot; if (! HASH_VACANT (df)) { if (df->impossible) ++im; else ++f; } } #ifdef WINDOWS32 printf (_("# %s (key %s, mtime %I64u): "), dir->name, dir->contents->path_key, (unsigned long long)dir->contents->mtime); #else /* WINDOWS32 */ #ifdef VMS_INO_T printf (_("# %s (device %d, inode [%d,%d,%d]): "), dir->name, dir->contents->dev, dir->contents->ino[0], dir->contents->ino[1], dir->contents->ino[2]); #else printf (_("# %s (device %ld, inode %ld): "), dir->name, (long)dir->contents->dev, (long)dir->contents->ino); #endif #endif /* WINDOWS32 */ if (f == 0) fputs (_("No"), stdout); else printf ("%u", f); fputs (_(" files, "), stdout); if (im == 0) fputs (_("no"), stdout); else printf ("%u", im); fputs (_(" impossibilities"), stdout); if (dir->contents->dirstream == 0) puts ("."); else puts (_(" so far.")); files += f; impossible += im; #ifdef KMK fputs ("# ", stdout); hash_print_stats (&dir->contents->dirfiles, stdout); fputs ("\n", stdout); #endif } } } fputs ("\n# ", stdout); if (files == 0) fputs (_("No"), stdout); else printf ("%u", files); fputs (_(" files, "), stdout); if (impossible == 0) fputs (_("no"), stdout); else printf ("%u", impossible); printf (_(" impossibilities in %lu directories.\n"), directories.ht_fill); #ifdef KMK fputs ("# directories: ", stdout); hash_print_stats (&directories, stdout); fputs ("\n# directory_contents: ", stdout); hash_print_stats (&directory_contents, stdout); fputs ("\n", stdout); #endif } #ifdef CONFIG_WITH_PRINT_STATS_SWITCH /* Print stats */ void print_dir_stats (void) { /** @todo normal dir stats. */ } #endif /* Hooks for globbing. */ /* Structure describing state of iterating through a directory hash table. */ struct dirstream { struct directory_contents *contents; /* The directory being read. */ struct dirfile **dirfile_slot; /* Current slot in table. */ }; /* Forward declarations. */ static __ptr_t open_dirstream (const char *); static struct dirent *read_dirstream (__ptr_t); static __ptr_t open_dirstream (const char *directory) { struct dirstream *new; struct directory *dir = find_directory (directory); if (dir->contents == 0 || dir->contents->dirfiles.ht_vec == 0) /* DIR->contents is nil if the directory could not be stat'd. DIR->contents->dirfiles is nil if it could not be opened. */ return 0; /* Read all the contents of the directory now. There is no benefit in being lazy, since glob will want to see every file anyway. */ dir_contents_file_exists_p (dir->contents, 0); new = xmalloc (sizeof (struct dirstream)); new->contents = dir->contents; new->dirfile_slot = (struct dirfile **) new->contents->dirfiles.ht_vec; return (__ptr_t) new; } static struct dirent * read_dirstream (__ptr_t stream) { static char *buf; static unsigned int bufsz; struct dirstream *const ds = (struct dirstream *) stream; struct directory_contents *dc = ds->contents; struct dirfile **dirfile_end = (struct dirfile **) dc->dirfiles.ht_vec + dc->dirfiles.ht_size; while (ds->dirfile_slot < dirfile_end) { struct dirfile *df = *ds->dirfile_slot++; if (! HASH_VACANT (df) && !df->impossible) { /* The glob interface wants a 'struct dirent', so mock one up. */ struct dirent *d; unsigned int len = df->length + 1; unsigned int sz = sizeof (*d) - sizeof (d->d_name) + len; if (sz > bufsz) { bufsz *= 2; if (sz > bufsz) bufsz = sz; buf = xrealloc (buf, bufsz); } d = (struct dirent *) buf; #ifdef __MINGW32__ # if __MINGW32_MAJOR_VERSION < 3 || (__MINGW32_MAJOR_VERSION == 3 && \ __MINGW32_MINOR_VERSION == 0) d->d_name = xmalloc (len); # endif #endif FAKE_DIR_ENTRY (d); #ifdef _DIRENT_HAVE_D_NAMLEN d->d_namlen = len - 1; #endif #ifdef _DIRENT_HAVE_D_TYPE d->d_type = DT_UNKNOWN; #endif memcpy (d->d_name, df->name, len); return d; } } return 0; } /* On 64 bit ReliantUNIX (5.44 and above) in LFS mode, stat() is actually a * macro for stat64(). If stat is a macro, make a local wrapper function to * invoke it. * * On MS-Windows, stat() "succeeds" for foo/bar/. where foo/bar is a * regular file; fix that here. */ #if !defined(stat) && !defined(WINDOWS32) || defined(VMS) # ifndef VMS # ifndef HAVE_SYS_STAT_H int stat (const char *path, struct stat *sbuf); # endif # else /* We are done with the fake stat. Go back to the real stat */ # ifdef stat # undef stat # endif # endif # define local_stat stat #else static int local_stat (const char *path, struct stat *buf) { int e; #ifdef WINDOWS32 size_t plen = strlen (path); /* Make sure the parent of "." exists and is a directory, not a file. This is because 'stat' on Windows normalizes the argument foo/. => foo without checking first that foo is a directory. */ if (plen > 1 && path[plen - 1] == '.' && (path[plen - 2] == '/' || path[plen - 2] == '\\')) { char parent[MAXPATHLEN]; strncpy (parent, path, plen - 2); parent[plen - 2] = '\0'; if (stat (parent, buf) < 0 || !_S_ISDIR (buf->st_mode)) return -1; } #endif EINTRLOOP (e, stat (path, buf)); return e; } #endif #ifdef KMK static int dir_exists_p (const char *dirname) { if (file_exists_p (dirname)) { struct directory *dir = find_directory (dirname); if (dir != NULL && dir->contents && dir->contents->dirfiles.ht_vec != NULL) return 1; } return 0; } #endif void dir_setup_glob (glob_t *gl) { gl->gl_opendir = open_dirstream; gl->gl_readdir = read_dirstream; gl->gl_closedir = free; gl->gl_stat = local_stat; #ifdef __EMX__ /* The FreeBSD implementation actually uses gl_lstat!! */ gl->gl_lstat = local_stat; #endif #ifdef GLOB_WITH_EXTENDED_KMK_MEMBERS gl->gl_exists = file_exists_p; gl->gl_isdir = dir_exists_p; #endif /* We don't bother setting gl_lstat, since glob never calls it. The slot is only there for compatibility with 4.4 BSD. */ } void hash_init_directories (void) { #ifndef CONFIG_WITH_STRCACHE2 hash_init (&directories, DIRECTORY_BUCKETS, directory_hash_1, directory_hash_2, directory_hash_cmp); #else /* CONFIG_WITH_STRCACHE2 */ hash_init_strcached (&directories, DIRECTORY_BUCKETS, &file_strcache, offsetof (struct directory, name)); #endif /* CONFIG_WITH_STRCACHE2 */ hash_init (&directory_contents, DIRECTORY_BUCKETS, directory_contents_hash_1, directory_contents_hash_2, directory_contents_hash_cmp); #ifdef CONFIG_WITH_ALLOC_CACHES alloccache_init (&directories_cache, sizeof (struct directory), "directories", NULL, NULL); alloccache_init (&directory_contents_cache, sizeof (struct directory_contents), "directory_contents", NULL, NULL); alloccache_init (&dirfile_cache, sizeof (struct dirfile), "dirfile", NULL, NULL); #endif /* CONFIG_WITH_ALLOC_CACHES */ } kbuild-3608/src/kmk/arscan.c0000664000175000017500000006707414670377414015725 0ustar locutuslocutus/* Library function for scanning an archive file. Copyright (C) 1987-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #ifdef TEST /* Hack, the real error() routine eventually pulls in die from main.c */ #define error(a, b, c, d) #endif #ifdef HAVE_FCNTL_H #include #else #include #endif #ifndef NO_ARCHIVES #ifdef VMS #include #include #include #include #include #include #include #include /* This symbol should be present in lbrdef.h. */ #ifndef LBR$_HDRTRUNC #pragma extern_model save #pragma extern_model globalvalue extern unsigned int LBR$_HDRTRUNC; #pragma extern_model restore #endif #include #include const char * vmsify (const char *name, int type); /* Time conversion from VMS to Unix Conversion from local time (stored in library) to GMT (needed for gmake) Note: The tm_gmtoff element is a VMS extension to the ANSI standard. */ static time_t vms_time_to_unix(void *vms_time) { struct tm *tmp; time_t unix_time; unix_time = decc$fix_time(vms_time); tmp = localtime(&unix_time); unix_time -= tmp->tm_gmtoff; return unix_time; } /* VMS library routines need static variables for callback */ static void *VMS_lib_idx; static const void *VMS_saved_arg; static long int (*VMS_function) (); static long int VMS_function_ret; /* This is a callback procedure for lib$get_index */ static int VMS_get_member_info(struct dsc$descriptor_s *module, unsigned long *rfa) { int status, i; const int truncated = 0; /* Member name may be truncated */ time_t member_date; /* Member date */ char *filename; unsigned int buffer_length; /* Actual buffer length */ /* Unused constants - Make does not actually use most of these */ const int file_desc = -1; /* archive file descriptor for reading the data */ const int header_position = 0; /* Header position */ const int data_position = 0; /* Data position in file */ const int data_size = 0; /* Data size */ const int uid = 0; /* member gid */ const int gid = 0; /* member gid */ const int mode = 0; /* member protection mode */ /* End of unused constants */ static struct dsc$descriptor_s bufdesc = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL }; /* Only need the module definition */ struct mhddef *mhd; /* If a previous callback is non-zero, just return that status */ if (VMS_function_ret) { return SS$_NORMAL; } /* lbr_set_module returns more than just the module header. So allocate a buffer which is big enough: the maximum LBR$C_MAXHDRSIZ. That's at least bigger than the size of struct mhddef. If the request is too small, a buffer truncated warning is issued so it can be reissued with a larger buffer. We do not care if the buffer is truncated, so that is still a success. */ mhd = xmalloc(LBR$C_MAXHDRSIZ); bufdesc.dsc$a_pointer = (char *) mhd; bufdesc.dsc$w_length = LBR$C_MAXHDRSIZ; status = lbr$set_module(&VMS_lib_idx, rfa, &bufdesc, &buffer_length, 0); if ((status != LBR$_HDRTRUNC) && !$VMS_STATUS_SUCCESS(status)) { ON(error, NILF, _("lbr$set_module() failed to extract module info, status = %d"), status); lbr$close(&VMS_lib_idx); return status; } #ifdef TEST /* When testing this code, it is useful to know the length returned */ printf("Input length = %d, actual = %d\n", bufdesc.dsc$w_length, buffer_length); #endif /* Conversion from VMS time to C time. VMS defectlet - mhddef is sub-optimal, for the time, it has a 32 bit longword, mhd$l_datim, and a 32 bit fill instead of two longwords, or equivalent. */ member_date = vms_time_to_unix(&mhd->mhd$l_datim); free(mhd); /* Here we have a problem. The module name on VMS does not have a file type, but the filename pattern in the "VMS_saved_arg" may have one. But only the method being called knows how to interpret the filename pattern. There are currently two different formats being used. This means that we need a VMS specific code in those methods to handle it. */ filename = xmalloc(module->dsc$w_length + 1); /* TODO: We may need an option to preserve the case of the module For now force the module name to lower case */ for (i = 0; i < module->dsc$w_length; i++) filename[i] = _tolower((unsigned char )module->dsc$a_pointer[i]); filename[i] = '\0'; VMS_function_ret = (*VMS_function)(file_desc, filename, truncated, header_position, data_position, data_size, member_date, uid, gid, mode, VMS_saved_arg); free(filename); return SS$_NORMAL; } /* Takes three arguments ARCHIVE, FUNCTION and ARG. Open the archive named ARCHIVE, find its members one by one, and for each one call FUNCTION with the following arguments: archive file descriptor for reading the data, member name, member name might be truncated flag, member header position in file, member data position in file, member data size, member date, member uid, member gid, member protection mode, ARG. NOTE: on VMS systems, only name, date, and arg are meaningful! The descriptor is poised to read the data of the member when FUNCTION is called. It does not matter how much data FUNCTION reads. If FUNCTION returns nonzero, we immediately return what FUNCTION returned. Returns -1 if archive does not exist, Returns -2 if archive has invalid format. Returns 0 if have scanned successfully. */ long int ar_scan (const char *archive, ar_member_func_t function, const void *varg) { char *vms_archive; static struct dsc$descriptor_s libdesc = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL }; const unsigned long func = LBR$C_READ; const unsigned long type = LBR$C_TYP_UNK; const unsigned long index = 1; unsigned long lib_idx; int status; VMS_saved_arg = varg; /* Null archive string can show up in test and cause an access violation */ if (archive == NULL) { /* Null filenames do not exist */ return -1; } /* archive path name must be in VMS format */ vms_archive = (char *) vmsify(archive, 0); status = lbr$ini_control(&VMS_lib_idx, &func, &type, 0); if (!$VMS_STATUS_SUCCESS(status)) { ON(error, NILF, _("lbr$ini_control() failed with status = %d"), status); return -2; } libdesc.dsc$a_pointer = vms_archive; libdesc.dsc$w_length = strlen(vms_archive); status = lbr$open(&VMS_lib_idx, &libdesc, 0, NULL, 0, NULL, 0); if (!$VMS_STATUS_SUCCESS(status)) { /* TODO: A library format failure could mean that this is a file generated by the GNU AR utility and in that case, we need to take the UNIX codepath. This will also take a change to the GNV AR wrapper program. */ switch (status) { case RMS$_FNF: /* Archive does not exist */ return -1; default: #ifndef TEST OSN(error, NILF, _("unable to open library '%s' to lookup member status %d"), archive, status); #endif /* For library format errors, specification says to return -2 */ return -2; } } VMS_function = function; /* Clear the return status, as we are supposed to stop calling the callback function if it becomes non-zero, and this is a static variable. */ VMS_function_ret = 0; status = lbr$get_index(&VMS_lib_idx, &index, VMS_get_member_info, NULL, 0); lbr$close(&VMS_lib_idx); /* Unless a failure occurred in the lbr$ routines, return the the status from the 'function' routine. */ if ($VMS_STATUS_SUCCESS(status)) { return VMS_function_ret; } /* This must be something wrong with the library and an error message should already have been printed. */ return -2; } #else /* !VMS */ /* SCO Unix's compiler defines both of these. */ #ifdef M_UNIX #undef M_XENIX #endif /* On the sun386i and in System V rel 3, ar.h defines two different archive formats depending upon whether you have defined PORTAR (normal) or PORT5AR (System V Release 1). There is no default, one or the other must be defined to have a nonzero value. */ #if (!defined (PORTAR) || PORTAR == 0) && (!defined (PORT5AR) || PORT5AR == 0) #undef PORTAR #ifdef M_XENIX /* According to Jim Sievert , for SCO XENIX defining PORTAR to 1 gets the wrong archive format, and defining it to 0 gets the right one. */ #define PORTAR 0 #else #define PORTAR 1 #endif #endif /* On AIX, define these symbols to be sure to get both archive formats. AIX 4.3 introduced the "big" archive format to support 64-bit object files, so on AIX 4.3 systems we need to support both the "normal" and "big" archive formats. An archive's format is indicated in the "fl_magic" field of the "FL_HDR" structure. For a normal archive, this field will be the string defined by the AIAMAG symbol. For a "big" archive, it will be the string defined by the AIAMAGBIG symbol (at least on AIX it works this way). Note: we'll define these symbols regardless of which AIX version we're compiling on, but this is okay since we'll use the new symbols only if they're present. */ #ifdef _AIX # define __AR_SMALL__ # define __AR_BIG__ #endif #ifndef WINDOWS32 # if !defined (__ANDROID__) && !defined (__BEOS__) && !defined (__HAIKU__) /* bird: exclude haiku */ # include # else /* These platforms don't have but have archives in the same format * as many other Unices. This was taken from GNU binutils for BeOS. */ # define ARMAG "!\n" /* String that begins an archive file. */ # define SARMAG 8 /* Size of that string. */ # define ARFMAG "`\n" /* String in ar_fmag at end of each header. */ struct ar_hdr { char ar_name[16]; /* Member file name, sometimes / terminated. */ char ar_date[12]; /* File date, decimal seconds since Epoch. */ char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */ char ar_mode[8]; /* File mode, in ASCII octal. */ char ar_size[10]; /* File size, in ASCII decimal. */ char ar_fmag[2]; /* Always contains ARFMAG. */ }; # endif # define TOCHAR(_m) (_m) #else /* These should allow us to read Windows (VC++) libraries (according to Frank * Libbrecht ) */ # include # include # include # define ARMAG IMAGE_ARCHIVE_START # define SARMAG IMAGE_ARCHIVE_START_SIZE # define ar_hdr _IMAGE_ARCHIVE_MEMBER_HEADER # define ar_name Name # define ar_mode Mode # define ar_size Size # define ar_date Date # define ar_uid UserID # define ar_gid GroupID /* In Windows the member names have type BYTE so we must cast them. */ # define TOCHAR(_m) ((char *)(_m)) #endif /* Cray's apparently defines this. */ #ifndef AR_HDR_SIZE # define AR_HDR_SIZE (sizeof (struct ar_hdr)) #endif /* Takes three arguments ARCHIVE, FUNCTION and ARG. Open the archive named ARCHIVE, find its members one by one, and for each one call FUNCTION with the following arguments: archive file descriptor for reading the data, member name, member name might be truncated flag, member header position in file, member data position in file, member data size, member date, member uid, member gid, member protection mode, ARG. The descriptor is poised to read the data of the member when FUNCTION is called. It does not matter how much data FUNCTION reads. If FUNCTION returns nonzero, we immediately return what FUNCTION returned. Returns -1 if archive does not exist, Returns -2 if archive has invalid format. Returns 0 if have scanned successfully. */ long int ar_scan (const char *archive, ar_member_func_t function, const void *arg) { #ifdef AIAMAG FL_HDR fl_header; # ifdef AIAMAGBIG int big_archive = 0; FL_HDR_BIG fl_header_big; # endif #endif char *namemap = 0; int desc = open (archive, O_RDONLY, 0); if (desc < 0) return -1; #ifdef SARMAG { char buf[SARMAG]; int nread; EINTRLOOP (nread, read (desc, buf, SARMAG)); if (nread != SARMAG || memcmp (buf, ARMAG, SARMAG)) { (void) close (desc); return -2; } } #else #ifdef AIAMAG { int nread; EINTRLOOP (nread, read (desc, &fl_header, FL_HSZ)); if (nread != FL_HSZ) { (void) close (desc); return -2; } #ifdef AIAMAGBIG /* If this is a "big" archive, then set the flag and re-read the header into the "big" structure. */ if (!memcmp (fl_header.fl_magic, AIAMAGBIG, SAIAMAG)) { off_t o; big_archive = 1; /* seek back to beginning of archive */ EINTRLOOP (o, lseek (desc, 0, 0)); if (o < 0) { (void) close (desc); return -2; } /* re-read the header into the "big" structure */ EINTRLOOP (nread, read (desc, &fl_header_big, FL_HSZ_BIG)); if (nread != FL_HSZ_BIG) { (void) close (desc); return -2; } } else #endif /* Check to make sure this is a "normal" archive. */ if (memcmp (fl_header.fl_magic, AIAMAG, SAIAMAG)) { (void) close (desc); return -2; } } #else { #ifndef M_XENIX int buf; #else unsigned short int buf; #endif int nread; EINTRLOOP (nread, read (desc, &buf, sizeof (buf))); if (nread != sizeof (buf) || buf != ARMAG) { (void) close (desc); return -2; } } #endif #endif /* Now find the members one by one. */ { #ifdef SARMAG register long int member_offset = SARMAG; #else #ifdef AIAMAG long int member_offset; long int last_member_offset; #ifdef AIAMAGBIG if ( big_archive ) { sscanf (fl_header_big.fl_fstmoff, "%20ld", &member_offset); sscanf (fl_header_big.fl_lstmoff, "%20ld", &last_member_offset); } else #endif { sscanf (fl_header.fl_fstmoff, "%12ld", &member_offset); sscanf (fl_header.fl_lstmoff, "%12ld", &last_member_offset); } if (member_offset == 0) { /* Empty archive. */ close (desc); return 0; } #else #ifndef M_XENIX register long int member_offset = sizeof (int); #else /* Xenix. */ register long int member_offset = sizeof (unsigned short int); #endif /* Not Xenix. */ #endif #endif while (1) { register int nread; struct ar_hdr member_header; #ifdef AIAMAGBIG struct ar_hdr_big member_header_big; #endif #ifdef AIAMAG char name[256]; int name_len; long int dateval; int uidval, gidval; long int data_offset; #else char namebuf[sizeof member_header.ar_name + 1]; char *name; int is_namemap; /* Nonzero if this entry maps long names. */ int long_name = 0; #endif long int eltsize; unsigned int eltmode; long int fnval; off_t o; EINTRLOOP (o, lseek (desc, member_offset, 0)); if (o < 0) { (void) close (desc); return -2; } #ifdef AIAMAG #define AR_MEMHDR_SZ(x) (sizeof(x) - sizeof (x._ar_name)) #ifdef AIAMAGBIG if (big_archive) { EINTRLOOP (nread, read (desc, &member_header_big, AR_MEMHDR_SZ(member_header_big))); if (nread != AR_MEMHDR_SZ(member_header_big)) { (void) close (desc); return -2; } sscanf (member_header_big.ar_namlen, "%4d", &name_len); EINTRLOOP (nread, read (desc, name, name_len)); if (nread != name_len) { (void) close (desc); return -2; } name[name_len] = 0; sscanf (member_header_big.ar_date, "%12ld", &dateval); sscanf (member_header_big.ar_uid, "%12d", &uidval); sscanf (member_header_big.ar_gid, "%12d", &gidval); sscanf (member_header_big.ar_mode, "%12o", &eltmode); sscanf (member_header_big.ar_size, "%20ld", &eltsize); data_offset = (member_offset + AR_MEMHDR_SZ(member_header_big) + name_len + 2); } else #endif { EINTRLOOP (nread, read (desc, &member_header, AR_MEMHDR_SZ(member_header))); if (nread != AR_MEMHDR_SZ(member_header)) { (void) close (desc); return -2; } sscanf (member_header.ar_namlen, "%4d", &name_len); EINTRLOOP (nread, read (desc, name, name_len)); if (nread != name_len) { (void) close (desc); return -2; } name[name_len] = 0; sscanf (member_header.ar_date, "%12ld", &dateval); sscanf (member_header.ar_uid, "%12d", &uidval); sscanf (member_header.ar_gid, "%12d", &gidval); sscanf (member_header.ar_mode, "%12o", &eltmode); sscanf (member_header.ar_size, "%12ld", &eltsize); data_offset = (member_offset + AR_MEMHDR_SZ(member_header) + name_len + 2); } data_offset += data_offset % 2; fnval = (*function) (desc, name, 0, member_offset, data_offset, eltsize, dateval, uidval, gidval, eltmode, arg); #else /* Not AIAMAG. */ EINTRLOOP (nread, read (desc, &member_header, AR_HDR_SIZE)); if (nread == 0) /* No data left means end of file; that is OK. */ break; if (nread != AR_HDR_SIZE #if defined(ARFMAG) || defined(ARFZMAG) || ( # ifdef ARFMAG memcmp (member_header.ar_fmag, ARFMAG, 2) # else 1 # endif && # ifdef ARFZMAG memcmp (member_header.ar_fmag, ARFZMAG, 2) # else 1 # endif ) #endif ) { (void) close (desc); return -2; } name = namebuf; memcpy (name, member_header.ar_name, sizeof member_header.ar_name); { register char *p = name + sizeof member_header.ar_name; do *p = '\0'; while (p > name && *--p == ' '); #ifndef AIAMAG /* If the member name is "//" or "ARFILENAMES/" this may be a list of file name mappings. The maximum file name length supported by the standard archive format is 14 characters. This member will actually always be the first or second entry in the archive, but we don't check that. */ is_namemap = (!strcmp (name, "//") || !strcmp (name, "ARFILENAMES/")); #endif /* Not AIAMAG. */ /* On some systems, there is a slash after each member name. */ if (*p == '/') *p = '\0'; #ifndef AIAMAG /* If the member name starts with a space or a slash, this is an index into the file name mappings (used by GNU ar). Otherwise if the member name looks like #1/NUMBER the real member name appears in the element data (used by 4.4BSD). */ if (! is_namemap && (name[0] == ' ' || name[0] == '/') && namemap != 0) { name = namemap + atoi (name + 1); long_name = 1; } else if (name[0] == '#' && name[1] == '1' && name[2] == '/') { int namesize = atoi (name + 3); name = alloca (namesize + 1); EINTRLOOP (nread, read (desc, name, namesize)); if (nread != namesize) { close (desc); return -2; } name[namesize] = '\0'; long_name = 1; } #endif /* Not AIAMAG. */ } #ifndef M_XENIX sscanf (TOCHAR (member_header.ar_mode), "%o", &eltmode); eltsize = atol (TOCHAR (member_header.ar_size)); #else /* Xenix. */ eltmode = (unsigned short int) member_header.ar_mode; eltsize = member_header.ar_size; #endif /* Not Xenix. */ fnval = (*function) (desc, name, ! long_name, member_offset, member_offset + AR_HDR_SIZE, eltsize, #ifndef M_XENIX atol (TOCHAR (member_header.ar_date)), atoi (TOCHAR (member_header.ar_uid)), atoi (TOCHAR (member_header.ar_gid)), #else /* Xenix. */ member_header.ar_date, member_header.ar_uid, member_header.ar_gid, #endif /* Not Xenix. */ eltmode, arg); #endif /* AIAMAG. */ if (fnval) { (void) close (desc); return fnval; } #ifdef AIAMAG if (member_offset == last_member_offset) /* End of the chain. */ break; #ifdef AIAMAGBIG if (big_archive) sscanf (member_header_big.ar_nxtmem, "%20ld", &member_offset); else #endif sscanf (member_header.ar_nxtmem, "%12ld", &member_offset); if (lseek (desc, member_offset, 0) != member_offset) { (void) close (desc); return -2; } #else /* If this member maps archive names, we must read it in. The name map will always precede any members whose names must be mapped. */ if (is_namemap) { char *clear; char *limit; namemap = alloca (eltsize); EINTRLOOP (nread, read (desc, namemap, eltsize)); if (nread != eltsize) { (void) close (desc); return -2; } /* The names are separated by newlines. Some formats have a trailing slash. Null terminate the strings for convenience. */ limit = namemap + eltsize; for (clear = namemap; clear < limit; clear++) { if (*clear == '\n') { *clear = '\0'; if (clear[-1] == '/') clear[-1] = '\0'; } } is_namemap = 0; } member_offset += AR_HDR_SIZE + eltsize; if (member_offset % 2 != 0) member_offset++; #endif } } close (desc); return 0; } #endif /* !VMS */ /* Return nonzero iff NAME matches MEM. If TRUNCATED is nonzero, MEM may be truncated to sizeof (struct ar_hdr.ar_name) - 1. */ int ar_name_equal (const char *name, const char *mem, int truncated) { const char *p; p = strrchr (name, '/'); if (p != 0) name = p + 1; #ifndef VMS if (truncated) { #ifdef AIAMAG /* TRUNCATED should never be set on this system. */ abort (); #else struct ar_hdr hdr; #if !defined (__hpux) && !defined (cray) return strneq (name, mem, sizeof (hdr.ar_name) - 1); #else return strneq (name, mem, sizeof (hdr.ar_name) - 2); #endif /* !__hpux && !cray */ #endif /* !AIAMAG */ } return !strcmp (name, mem); #else /* VMS members do not have suffixes, but the filenames usually have. Do we need to strip VMS disk/directory format paths? Most VMS compilers etc. by default are case insensitive but produce uppercase external names, incl. module names. However the VMS librarian (ar) and the linker by default are case sensitive: they take what they get, usually uppercase names. So for the non-default settings of the compilers etc. there is a need to have a case sensitive mode. */ { int len; len = strlen(mem); int match; char *dot; if ((dot=strrchr(name,'.'))) match = (len == dot - name) && !strncasecmp(name, mem, len); else match = !strcasecmp (name, mem); return match; } #endif /* !VMS */ } #ifndef VMS /* ARGSUSED */ static long int ar_member_pos (int desc UNUSED, const char *mem, int truncated, long int hdrpos, long int datapos UNUSED, long int size UNUSED, long int date UNUSED, int uid UNUSED, int gid UNUSED, unsigned int mode UNUSED, const void *name) { if (!ar_name_equal (name, mem, truncated)) return 0; return hdrpos; } /* Set date of member MEMNAME in archive ARNAME to current time. Returns 0 if successful, -1 if file ARNAME does not exist, -2 if not a valid archive, -3 if other random system call error (including file read-only), 1 if valid but member MEMNAME does not exist. */ int ar_member_touch (const char *arname, const char *memname) { long int pos = ar_scan (arname, ar_member_pos, memname); int fd; struct ar_hdr ar_hdr; off_t o; int r; unsigned int ui; struct stat statbuf; if (pos < 0) return (int) pos; if (!pos) return 1; EINTRLOOP (fd, open (arname, O_RDWR, 0666)); if (fd < 0) return -3; /* Read in this member's header */ EINTRLOOP (o, lseek (fd, pos, 0)); if (o < 0) goto lose; EINTRLOOP (r, read (fd, &ar_hdr, AR_HDR_SIZE)); if (r != AR_HDR_SIZE) goto lose; /* Write back the header, thus touching the archive file. */ EINTRLOOP (o, lseek (fd, pos, 0)); if (o < 0) goto lose; EINTRLOOP (r, write (fd, &ar_hdr, AR_HDR_SIZE)); if (r != AR_HDR_SIZE) goto lose; /* The file's mtime is the time we we want. */ EINTRLOOP (r, fstat (fd, &statbuf)); if (r < 0) goto lose; #if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || defined(WINDOWS32) /* Advance member's time to that time */ for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++) ar_hdr.ar_date[ui] = ' '; sprintf (TOCHAR (ar_hdr.ar_date), "%lu", (long unsigned) statbuf.st_mtime); #ifdef AIAMAG ar_hdr.ar_date[strlen (ar_hdr.ar_date)] = ' '; #endif #else ar_hdr.ar_date = statbuf.st_mtime; #endif /* Write back this member's header */ EINTRLOOP (o, lseek (fd, pos, 0)); if (o < 0) goto lose; EINTRLOOP (r, write (fd, &ar_hdr, AR_HDR_SIZE)); if (r != AR_HDR_SIZE) goto lose; close (fd); return 0; lose: r = errno; close (fd); errno = r; return -3; } #endif #ifdef TEST long int describe_member (int desc, const char *name, int truncated, long int hdrpos, long int datapos, long int size, long int date, int uid, int gid, unsigned int mode, const void *arg) { extern char *ctime (); printf (_("Member '%s'%s: %ld bytes at %ld (%ld).\n"), name, truncated ? _(" (name might be truncated)") : "", size, hdrpos, datapos); printf (_(" Date %s"), ctime (&date)); printf (_(" uid = %d, gid = %d, mode = 0%o.\n"), uid, gid, mode); return 0; } int main (int argc, char **argv) { ar_scan (argv[1], describe_member, NULL); return 0; } #endif /* TEST. */ #endif /* NO_ARCHIVES. */ kbuild-3608/src/kmk/kdepdb.c0000664000175000017500000007570114670377414015703 0ustar locutuslocutus/* $Id: incdep.c 2283 2009-02-24 04:54:00Z bird $ */ /** @file * kdepdb - Dependency database. */ /* * Copyright (c) 2009-2010 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "makeint.h" #include "../lib/k/kDefs.h" #include "../lib/k/kTypes.h" #include #include #include "dep.h" #include "filedef.h" #include "job.h" #include "commands.h" #include "variable.h" #include "rule.h" #include "debug.h" #include "strcache2.h" #ifdef HAVE_FCNTL_H # include #else # include #endif #if K_OS == K_WINDOWS # include #else # include # include #endif /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** @def KDEPDB_ASSERT_SIZE * Check the size of an on-disk type. * * @param Type The type which size it being checked. * @param Size The size it should have. */ #ifdef __GNUC__ # define KDEPDB_ASSERT_SIZE(Type, Size) \ extern int kDepDbAssertSize[1] __attribute__((unused)), \ kDepDbAssertSize[sizeof(Type) == (Size)] __attribute__((unused)) #else # define KDEPDB_ASSERT_SIZE(Type, Size) \ typedef int kDepDbAssertSize[sizeof(Type) == (Size)] #endif KDEPDB_ASSERT_SIZE(KU8, 1); KDEPDB_ASSERT_SIZE(KU16, 2); KDEPDB_ASSERT_SIZE(KU32, 4); KDEPDB_ASSERT_SIZE(KU64, 8); /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * File header. * * @remarks All on-disk formats are in little-endian format. */ typedef struct KDEPDBHDR { /** The file magic. */ KU8 szMagic[8]; /** The major file format version. */ KU8 uVerMajor; /** The minor file format version. */ KU8 uVerMinor; /** Reserved \#2. */ KU16 uReserved2; /** Reserved \#1. */ KU32 uReserved1; /** The internal name of this file. */ KU8 szName[16]; } KDEPDBHDR; KDEPDB_ASSERT_SIZE(KDEPDBHDR, 32); /** The file header magic value. */ #define KDEPDBHDR_MAGIC "kDepDb\0" /** The current major file format version number. */ #define KDEPDBHDR_VERSION_MAJOR 0 /** The current minor file format version number. * Numbers above 240 indicate unsupported development variants. */ #define KDEPDBHDR_VERSION_MINOR 240 /** * Hash table file. * * The hash table is recreated in a new file when we have to grow it. */ typedef struct KDEPDBHASH { /** The file header. */ KDEPDBHDR Hdr; /** The number of hash table entries. */ KU32 cEntries; /** The number of hash table entries with content. */ KU32 cUsedEntries; /** The number of collisions on insert. */ KU32 cCollisions; /** Reserved member \#5. */ KU32 uReserved5; /** Reserved member \#4. */ KU32 uReserved4; /** Reserved member \#3. */ KU32 uReserved3; /** Reserved member \#2. */ KU32 uReserved2; /** Reserved member \#1. */ KU32 uReserved1; /** The hash table. */ KU32 auEntries[32]; } KDEPDBHASH; KDEPDB_ASSERT_SIZE(KDEPDBHASH, 32+32+4*32); /** The item value indicating that it is unused. */ #define KDEPDBHASH_UNUSED KU32_C(0xffffffff) /** The item indicating that it hash been deleted. */ #define KDEPDBHASH_DELETED KU32_C(0xfffffffe) /** The first special item value. */ #define KDEPDBHASH_END KU32_C(0xfffffff0) /** * A string table string entry. * * This should be a multiple of 32 bytes. */ typedef struct KDEPDBSTRING { /** The hash number for the string. */ KU32 uHash; /** The string length, excluding the zero terminator. */ KU32 cchString; /** The string. */ KU8 szString[24]; } KDEPDBSTRING; KDEPDB_ASSERT_SIZE(KDEPDBSTRING, 32); /** * String table file. * * The file is insertion only and will grow forever. */ typedef struct KDEPDBSTRTAB { /** The file header. */ KDEPDBHDR Hdr; /** The end of the valid string table indexes. */ KU32 iStringEnd; /** Reserved member \#7. */ KU32 uReserved7; /** Reserved member \#6. */ KU32 uReserved6; /** Reserved member \#5. */ KU32 uReserved5; /** Reserved member \#4. */ KU32 uReserved4; /** Reserved member \#3. */ KU32 uReserved3; /** Reserved member \#2. */ KU32 uReserved2; /** Reserved member \#1. */ KU32 uReserved1; /** The string table. */ KDEPDBSTRING aStrings[1]; } KDEPDBSTRTAB; KDEPDB_ASSERT_SIZE(KDEPDBSTRTAB, 32+32+32); /** The end of the valid string table indexes (exclusive). */ #define KDEPDBG_STRTAB_IDX_END KU32_C(0x80000000) /** The string was not found. */ #define KDEPDBG_STRTAB_IDX_NOT_FOUND KU32_C(0xfffffffd) /** Error during string table operation. */ #define KDEPDBG_STRTAB_IDX_ERROR KU32_C(0xfffffffe) /** Generic invalid string table index. */ #define KDEPDBG_STRTAB_IDX_INVALID KU32_C(0xffffffff) /** * Directory entry. */ typedef struct KDEPDBDIRENTRY { /** The string table index of the entry name. * Unused entries are set to KDEPDBG_STRTAB_IDX_INVALID. */ KU32 iName; /** The actual data stream size. * Unused entries are set to KU32_MAX. */ KU32 cbData; /** The number of blocks allocated for this stream. * Unused entries are set to KU32_MAX. */ KU32 cBlocks; /** The start block number. * The stream is a contiguous sequence of blocks. This optimizes and * simplifies reading the stream at the expense of operations extending it. * * In unused entries, this serves as the free chain pointer with KU32_MAX as * nil value. */ KU32 iStartBlock; } KDEPDBDIRENTRY; KDEPDB_ASSERT_SIZE(KDEPDBDIRENTRY, 16); /** * Directory file. */ typedef struct KDEPDBDIR { /** The file header. */ KDEPDBHDR Hdr; /** The number of entries. */ KU32 cEntries; /** The head of the free chain. (Index into aEntries.) */ KU32 iFreeHead; /** Reserved member \#6. */ KU32 uReserved6; /** Reserved member \#5. */ KU32 uReserved5; /** Reserved member \#4. */ KU32 uReserved4; /** Reserved member \#3. */ KU32 uReserved3; /** Reserved member \#2. */ KU32 uReserved2; /** Reserved member \#1. */ KU32 uReserved1; /** Directory entries. */ KDEPDBDIRENTRY aEntries[2]; } KDEPDBDIR; KDEPDB_ASSERT_SIZE(KDEPDBDIR, 32+32+32); /** * A block allocation bitmap. * * This can track 2^(12+8) = 2^20 = 1M blocks. */ typedef struct KDEPDBDATABITMAP { /** Bitmap where each bit is a block. * 0 indicates unused blocks and 1 indicates used ones. */ KU8 bm[4096]; } KDEPDBDATABITMAP; KDEPDB_ASSERT_SIZE(KDEPDBDATABITMAP, 4096); /** * Data file. * * The block numbering starts with this structure as block 0. */ typedef struct KDEPDBDATA { /** The file header. */ KDEPDBHDR Hdr; /** The size of a block. */ KU32 cbBlock; /** Reserved member \#7. */ KU32 uReserved7; /** Reserved member \#6. */ KU32 uReserved6; /** Reserved member \#5. */ KU32 uReserved5; /** Reserved member \#4. */ KU32 uReserved4; /** Reserved member \#3. */ KU32 uReserved3; /** Reserved member \#2. */ KU32 uReserved2; /** Reserved member \#1. */ KU32 uReserved1; /** Block numbers for the allocation bitmaps. */ KU32 aiBitmaps[4096]; } KDEPDBDATA; /** The end of the valid block indexes (exclusive). */ #define KDEPDB_BLOCK_IDX_END KU32_C(0xfffffff0) /** The index of an unallocated bitmap block. */ #define KDEPDB_BLOCK_IDX_UNALLOCATED KU32_C(0xffffffff) /** * Stream storing dependencies. * * The stream name gives the output file name, so all that we need is the list * of files it depends on. These are serialized as a list of string table * indexes. */ typedef struct KDEPDBDEPSTREAM { /** String table indexes for the dependencies. */ KU32 aiDeps[1]; } KDEPDBDEPSTREAM; /** * A file handle structure. */ typedef struct KDEPDBFH { #if K_OS == K_OS_WINDOWS /** The file handle. */ HANDLE hFile; /** The mapping object handle. */ HANDLE hMapObj; #else /** The file handle. */ int fd; #endif /** The current file size. */ KU32 cb; } KDEPDBFH; /** * Internal control structure for a string table. */ typedef struct KDEPDBINTSTRTAB { /** The hash file. */ KDEPDBHASH *pHash; /** The handle of the hash file. */ KDEPDBFH hHash; /** The string table file. */ KDEPDBSTRTAB *pStrTab; /** The handle of the string table file. */ KDEPDBFH hStrTab; /** The end of the allocated string table indexes (i.e. when to grow the * file). */ KU32 iStringAlloced; } KDEPDBINTSTRTAB; /** * Internal control structure for a data set. * * This governs the directory file, the directory hash file and the data file. */ typedef struct KDEPDBINTDATASET { /** The hash file. */ KDEPDBHASH pHash; /** The size of the hash file. */ KU32 cbHash; /** The size of the directory file. */ KU32 cbDir; /** The mapping of the directory file. */ KDEPDBHASH pDir; /** The data file. */ KDEPDBDATA pData; /** The size of the data file. */ KU32 cbData; /** The handle of the hash file. */ KDEPDBFH hHash; /** The handle of the directory file. */ KDEPDBFH hDir; /** The handle of the data file. */ KDEPDBFH hData; } KDEPDBINTDATASET; /** * The database instance. * * To simplifiy things the database uses 8 files for storing the different kinds * of data. This greatly reduces the complexity compared to a single file * solution. */ typedef struct KDEPDB { /** The string table. */ KDEPDBINTSTRTAB StrTab; /** The variable data set. */ KDEPDBINTDATASET DepSet; /** The command data set. */ KDEPDBINTDATASET CmdSet; } KDEPDB; /******************************************************************************* * Internal Functions * *******************************************************************************/ static void *kDepDbAlloc(KSIZE cb); static void kDepDbFree(void *pv); static void kDepDbFHInit(KDEPDBFH *pFH); static int kDepDbFHUpdateSize(KDEPDBFH *pFH); static int kDepDbFHOpen(KDEPDBFH *pFH, const char *pszFilename, KBOOL fCreate, KBOOL *pfNew); static int kDepDbFHClose(KDEPDBFH *pFH); static int kDepDbFHWriteAt(KDEPDBFH *pFH, KU32 off, void const *pvBuf, KSIZE cbBuf); static int kDepDbFHMap(KDEPDBFH *pFH, void **ppvMap); static int kDepDbFHUnmap(KDEPDBFH *pFH, void **ppvMap); static int kDepDbFHGrow(KDEPDBFH *pFH, KSIZE cbNew, void **ppvMap); static KU32 kDepDbHashString(const char *pszString, size_t cchString); /** xmalloc wrapper. */ static void *kDepDbAlloc(KSIZE cb) { return xmalloc(cb); } /** free wrapper. */ static void kDepDbFree(void *pv) { if (pv) free(pv); } /** * Initializes the file handle structure so closing it without first opening it * will work smoothly. * * @param pFH The file handle structure. */ static void kDepDbFHInit(KDEPDBFH *pFH) { #if K_OS == K_OS_WINDOWS pFH->hFile = INVALID_HANDLE_VALUE; pFH->hMapObj = INVALID_HANDLE_VALUE; #else pFH->fd = -1; #endif pFH->cb = 0; } /** * Updates the file size. * * @returns 0 on success. Some non-zero native error code on failure. * @param pFH The file handle structure. */ static int kDepDbFHUpdateSize(KDEPDBFH *pFH) { #if K_OS == K_OS_WINDOWS DWORD rc; DWORD dwHigh; DWORD dwLow; SetLastError(0); dwLow = GetFileSize(File, &High); rc = GetLastError(); if (rc) { pFH->cb = 0; return (int)rc; } if (High) pFH->cb = KU32_MAX; else pFH->cb = dwLow; #else off_t cb; cb = lseek(pFH->fd, 0, SEEK_END); if (cb == -1) { pFH->cb = 0; return errno; } pFH->cb = cb; if ((off_t)pFH->cb != cb) pFH->cb = KU32_MAX; #endif return 0; } /** * Opens an existing file or creates a new one. * * @returns 0 on success. Some non-zero native error code on failure. * * @param pFH The file handle structure. * @param pszFilename The name of the file. * @param fCreate Whether we should create the file or not. * @param pfCreated Where to return whether we created it or not. */ static int kDepDbFHOpen(KDEPDBFH *pFH, const char *pszFilename, KBOOL fCreate, KBOOL *pfCreated) { int rc; #if K_OS == K_OS_WINDOWS SECURITY_ATTRIBUTES SecAttr; SecAttr.bInheritHandle = FALSE; SecAttr.lpSecurityDescriptor = NULL; SecAttr.nLength = 0; pFH->cb = 0; SetLastError(0); pFH->hFile = CreateFile(pszFilename, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, &SecAttr, fCreate ? OPEN_ALWAYS : OPEN_EXISTING, 0, NULL); if (pFH->hFile == INVALID_HANDLE_VALUE) return GetLastError(); *pfCreated = GetLastError() == 0; #else int fFlags = O_RDWR; # ifdef O_BINARY fFlags |= O_BINARY; # endif pFH->cb = 0; pFH->fd = open(pszFilename, fFlags, 0); if (pFH->fd >= 0) *pfCreated = K_FALSE; else if (!fCreate) return errno; else { pFH->fd = open(pszFilename, fFlags | O_EXCL | O_CREAT, 0666); if (pFH->fd < 0) return errno; *pfCreated = K_TRUE; } fcntl(pFH->fd, F_SETFD, FD_CLOEXEC); #endif /* update the size */ rc = kDepDbFHUpdateSize(pFH); if (rc) kDepDbFHClose(pFH); return rc; } /** * Closes an open file. * * @returns 0 on success. Some non-zero native error code on failure. * * @param pFH The file handle structure. */ static int kDepDbFHClose(KDEPDBFH *pFH) { #if K_OS == K_OS_WINDOWS if (pFH->hFile != INVALID_HANDLE_VALUE) { if (!CloseHandle(pFH->hFile)) return GetLastError(); pFH->hFile = INVALID_HANDLE_VALUE; } #else if (pFH->fd >= 0) { if (close(pFH->fd) != 0) return errno; pFH->fd = -1; } #endif pFH->cb = 0; return 0; } /** * Writes to a file. * * @returns 0 on success. Some non-zero native error code on failure. * * @param pFH The file handle structure. * @param off The offset into the file to start writing at. * @param pvBuf What to write. * @param cbBuf How much to write. */ static int kDepDbFHWriteAt(KDEPDBFH *pFH, KU32 off, void const *pvBuf, KSIZE cbBuf) { #if K_OS == K_OS_WINDOWS ULONG cbWritten; if (SetFilePointer(pFH->hFile, off, NULL, FILE_CURRENT) == INVALID_SET_FILE_POINTER) return GetLastError(); if (!WriteFile(pFH->hFile, pvBuf, cbBuf, &cbWritten, NULL)) return GetLastError(); if (cbWritten != cbBuf) return -1; #else ssize_t cbWritten; if (lseek(pFH->fd, off, SEEK_SET) == -1) return errno; errno = 0; cbWritten = write(pFH->fd, pvBuf, cbBuf); if ((size_t)cbWritten != cbBuf) return errno ? errno : EIO; #endif return kDepDbFHUpdateSize(pFH); } /** * Creates a memory mapping of the file. * * @returns 0 on success. Some non-zero native error code on failure. * * @param pFH The file handle structure. * @param ppvMap Where to return the map address. */ static int kDepDbFHMap(KDEPDBFH *pFH, void **ppvMap) { #if K_OS == K_OS_WINDOWS *ppvMap = NULL; return -1; #else *ppvMap = mmap(NULL, pFH->cb, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, pFH->fd, 0); if (*ppvMap == (void *)-1) { *ppvMap = NULL; return errno; } #endif return 0; } /** * Flushes and destroys a memory of the file. * * @returns 0 on success. Some non-zero native error code on failure. * * @param pFH The file handle structure. * @param ppvMap The pointer to the mapping pointer. This will be set to * NULL on success. */ static int kDepDbFHUnmap(KDEPDBFH *pFH, void **ppvMap) { #if K_OS == K_OS_WINDOWS return -1; #else if (msync(*ppvMap, pFH->cb, MS_SYNC) == -1) return errno; if (munmap(*ppvMap, pFH->cb) == -1) return errno; *ppvMap = NULL; #endif return 0; } /** * Grows the memory mapping of the file. * * The content of the new space is undefined. * * @returns 0 on success. Some non-zero native error code on failure. * * @param pFH The file handle structure. * @param cbNew The new mapping size. * @param ppvMap The pointer to the mapping pointer. This may change and * may be set to NULL on failure. */ static int kDepDbFHGrow(KDEPDBFH *pFH, KSIZE cbNew, void **ppvMap) { #if K_OS == K_OS_WINDOWS return -1; #else if ((KU32)cbNew != cbNew) return ERANGE; if (cbNew <= pFH->cb) return 0; if (munmap(*ppvMap, pFH->cb) == -1) return errno; *ppvMap = NULL; pFH->cb = cbNew; return kDepDbFHMap(pFH, ppvMap); #endif } /** Macro for reading an potentially unaligned 16-bit word from a string. */ # if K_ARCH == K_ARCH_AMD64 \ || K_ARCH == K_ARCH_X86_32 \ || K_ARCH == K_ARCH_X86_16 # define kDepDbHashString_get_unaligned_16bits(ptr) ( *((const KU16 *)(ptr)) ) # elif K_ENDIAN == K_ENDIAN_LITTLE # define kDepDbHashString_get_unaligned_16bits(ptr) ( (((const KU8 *)(ptr))[0]) \ | (((const KU8 *)(ptr))[1] << 8) ) # else # define kDepDbHashString_get_unaligned_16bits(ptr) ( (((const KU8 *)(ptr))[0] << 8) \ | (((const KU8 *)(ptr))[1]) ) # endif /** * Hash a string. * * @returns Hash value. * * @param pszString The string to hash. * @param cchString How much to hash. */ static KU32 kDepDbHashString(const char *pszString, size_t cchString) { /* * Paul Hsieh hash SuperFast function: * http://www.azillionmonkeys.com/qed/hash.html */ /** @todo A path for well aligned data should be added to speed up execution on * alignment sensitive systems. */ unsigned int uRem; KU32 uHash; KU32 uTmp; assert(sizeof(KU8) == sizeof(char)); /* main loop, walking on 2 x KU16 */ uHash = cchString; uRem = cchString & 3; cchString >>= 2; while (cchString > 0) { uHash += kDepDbHashString_get_unaligned_16bits(pszString); uTmp = (kDepDbHashString_get_unaligned_16bits(pszString + 2) << 11) ^ uHash; uHash = (uHash << 16) ^ uTmp; pszString += 2 * sizeof(KU16); uHash += uHash >> 11; cchString--; } /* the remainder */ switch (uRem) { case 3: uHash += kDepDbHashString_get_unaligned_16bits(pszString); uHash ^= uHash << 16; uHash ^= pszString[sizeof(KU16)] << 18; uHash += uHash >> 11; break; case 2: uHash += kDepDbHashString_get_unaligned_16bits(pszString); uHash ^= uHash << 11; uHash += uHash >> 17; break; case 1: uHash += *pszString; uHash ^= uHash << 10; uHash += uHash >> 1; break; } /* force "avalanching" of final 127 bits. */ uHash ^= uHash << 3; uHash += uHash >> 5; uHash ^= uHash << 4; uHash += uHash >> 17; uHash ^= uHash << 25; uHash += uHash >> 6; return uHash; } /*** * Looks up a string in the string table. * * @returns The string table index. * @retval KDEPDBG_STRTAB_IDX_NOT_FOUND is not found. * @retval KDEPDBG_STRTAB_IDX_ERROR on internal inconsistency. * * @param pStrTab The string table. * @param pszString The string. * @param cchStringIn The string length. * @param uHash The hash of the string. */ static KU32 kDepDbStrTabLookupHashed(KDEPDBINTSTRTAB const *pStrTab, const char *pszString, size_t cchStringIn, KU32 uHash) { KU32 const cchString = (KU32)cchStringIn; KDEPDBHASH const *pHash = pStrTab->pHash; KDEPDBSTRING const *paStrings = &pStrTab->pStrTab->aStrings[0]; KU32 const iStringEnd = K_LE2H_U32(pStrTab->pStrTab->iStringEnd); KU32 iHash; /* sanity */ if (cchString != cchStringIn) return KDEPDBG_STRTAB_IDX_NOT_FOUND; /* * Hash lookup of the string. */ iHash = uHash % pHash->cEntries; for (;;) { KU32 iString = K_LE2H_U32(pHash->auEntries[iHash]); if (iString < iStringEnd) { KDEPDBSTRING const *pString = &paStrings[iString]; if ( K_LE2H_U32(pString->uHash) == uHash && K_LE2H_U32(pString->cchString) == cchString && !memcmp(pString->szString, pszString, cchString)) return iString; } else if (iString == KDEPDBHASH_UNUSED) return KDEPDBG_STRTAB_IDX_NOT_FOUND; else if (iString != KDEPDBHASH_DELETED) return KDEPDBG_STRTAB_IDX_ERROR; /* advance */ iHash = (iHash + 1) % pHash->cEntries; } } /** * Doubles the hash table size and rehashes it. * * @returns 0 on success, -1 on failure. * @param pStrTab The string table. * @todo Rebuild from string table, we'll be accessing it anyways. */ static int kDepDbStrTabReHash(KDEPDBINTSTRTAB *pStrTab) { KDEPDBSTRING const *paStrings = &pStrTab->pStrTab->aStrings[0]; KU32 const iStringEnd = K_LE2H_U32(pStrTab->pStrTab->iStringEnd); KDEPDBHASH *pHash = pStrTab->pHash; KDEPDBHASH HashHdr = *pHash; KU32 *pauNew; KU32 cEntriesNew; KU32 i; /* * Calc the size of the new hash table. */ if (pHash->cEntries >= KU32_C(0x80000000)) return -1; cEntriesNew = 1024; while (cEntriesNew <= pHash->cEntries) cEntriesNew <<= 1; /* * Allocate and initialize an empty hash table in memory. */ pauNew = kDepDbAlloc(cEntriesNew * sizeof(KU32)); if (!pauNew) return -1; i = cEntriesNew; while (i-- > 0) pauNew[i] = KDEPDBHASH_UNUSED; /* * Popuplate the new table. */ HashHdr.cEntries = K_LE2H_U32(cEntriesNew); HashHdr.cCollisions = 0; HashHdr.cUsedEntries = 0; i = pHash->cEntries; while (i-- > 0) { KU32 iString = K_LE2H_U32(pHash->auEntries[i]); if (iString < iStringEnd) { KU32 iHash = (paStrings[iString].uHash % cEntriesNew); if (pauNew[iHash] != K_H2LE_U32(KDEPDBHASH_UNUSED)) { do { iHash = (iHash + 1) % cEntriesNew; HashHdr.cCollisions++; } while (pauNew[iHash] != K_H2LE_U32(KDEPDBHASH_UNUSED)); } pauNew[iHash] = iString; HashHdr.cUsedEntries++; } else if ( iString != KDEPDBHASH_UNUSED && iString != KDEPDBHASH_DELETED) { kDepDbFree(pauNew); return -1; } } HashHdr.cCollisions = K_H2LE_U32(HashHdr.cCollisions); HashHdr.cUsedEntries = K_H2LE_U32(HashHdr.cUsedEntries); /* * Unmap the hash, write the new hash table and map it again. */ if (!kDepDbFHUnmap(&pStrTab->hHash, (void **)&pStrTab->pHash)) { if ( !kDepDbFHWriteAt(&pStrTab->hHash, 0, &HashHdr, K_OFFSETOF(KDEPDBHASH, auEntries)) && !kDepDbFHWriteAt(&pStrTab->hHash, K_OFFSETOF(KDEPDBHASH, auEntries), pauNew, sizeof(pauNew[0]) * cEntriesNew)) { kDepDbFree(pauNew); pauNew = NULL; if (!kDepDbFHMap(&pStrTab->hHash, (void **)&pStrTab->pHash)) return 0; } else kDepDbFHWriteAt(&pStrTab->hHash, 0, "\0\0\0\0", 4); /* file is screwed, trash the magic. */ } kDepDbFree(pauNew); return -1; } /** * Add a string to the string table. * * If already in the table, the index of the existing entry is returned. * * @returns String index on success, * @retval KDEPDBG_STRTAB_IDX_ERROR on I/O and inconsistency errors. * * @param pStrTab The string table. * @param pszString The string to add. * @param cchStringIn The length of the string. * @param uHash The hash of the string. */ static KU32 kDepDbStrTabAddHashed(KDEPDBINTSTRTAB *pStrTab, const char *pszString, size_t cchStringIn, KU32 uHash) { KU32 const cchString = (KU32)cchStringIn; KDEPDBHASH *pHash = pStrTab->pHash; KDEPDBSTRING *paStrings = &pStrTab->pStrTab->aStrings[0]; KU32 const iStringEnd = K_LE2H_U32(pStrTab->pStrTab->iStringEnd); KU32 iInsertAt = KDEPDBHASH_UNUSED; KU32 cCollisions = 0; KU32 iHash; KU32 iString; KU32 cEntries; KDEPDBSTRING *pNewString; /* sanity */ if (cchString != cchStringIn) return KDEPDBG_STRTAB_IDX_NOT_FOUND; /* * Hash lookup of the string, finding either an existing copy or where to * insert the new string at in the hash table. */ iHash = uHash % pHash->cEntries; for (;;) { iString = K_LE2H_U32(pHash->auEntries[iHash]); if (iString < iStringEnd) { KDEPDBSTRING const *pString = &paStrings[iString]; if ( K_LE2H_U32(pString->uHash) == uHash && K_LE2H_U32(pString->cchString) == cchString && !memcmp(pString->szString, pszString, cchString)) return iString; } else { if (iInsertAt == KDEPDBHASH_UNUSED) iInsertAt = iHash; if (iString == KDEPDBHASH_UNUSED) break; if (iString != KDEPDBHASH_DELETED) return KDEPDBG_STRTAB_IDX_ERROR; } /* advance */ cCollisions++; iHash = (iHash + 1) % pHash->cEntries; } /* * Add string to the string table. * The string table file is grown in 256KB increments and ensuring at least 64KB unused new space. */ cEntries = cchString + 1 <= sizeof(paStrings[0].szString) ? 1 : (cchString + 1 - sizeof(paStrings[0].szString) + sizeof(KDEPDBSTRING) - 1) / sizeof(KDEPDBSTRING); if (iStringEnd + cEntries > pStrTab->iStringAlloced) { KSIZE cbNewSize = K_ALIGN_Z((iStringEnd + cEntries) * sizeof(KDEPDBSTRING) + 64*1024, 256*1024); KU32 iStringAlloced = (pStrTab->hStrTab.cb - K_OFFSETOF(KDEPDBSTRTAB, aStrings)) / sizeof(KDEPDBSTRING); if ( iStringAlloced <= pStrTab->iStringAlloced || iStringAlloced >= KDEPDBG_STRTAB_IDX_END || iStringAlloced >= KDEPDBHASH_END) return KDEPDBG_STRTAB_IDX_ERROR; if (kDepDbFHGrow(&pStrTab->hStrTab, cbNewSize, (void **)&pStrTab->pStrTab) != 0) return KDEPDBG_STRTAB_IDX_ERROR; pStrTab->iStringAlloced = iStringAlloced; paStrings = &pStrTab->pStrTab->aStrings[0]; } pNewString = &paStrings[iStringEnd]; pNewString->uHash = K_H2LE_U32(uHash); pNewString->cchString = K_H2LE_U32(cchString); memcpy(&pNewString->szString, pszString, cchString); pNewString->szString[cchString] = '\0'; pStrTab->pStrTab->iStringEnd = K_H2LE_U32(iStringEnd + cEntries); /* * Insert hash table entry, rehash it if necessary. */ pHash->auEntries[iInsertAt] = K_H2LE_U32(iStringEnd); pHash->cUsedEntries = K_H2LE_U32(K_LE2H_U32(pHash->cUsedEntries) + 1); pHash->cCollisions = K_H2LE_U32(K_LE2H_U32(pHash->cCollisions) + cCollisions); if ( K_LE2H_U32(pHash->cUsedEntries) > K_LE2H_U32(pHash->cEntries) / 3 * 2 && kDepDbStrTabReHash(pStrTab) != 0) return KDEPDBG_STRTAB_IDX_ERROR; return iStringEnd; } /** Wrapper for kDepDbStrTabLookupHashed. */ static KU32 kDepDbStrTabLookupN(KDEPDBINTSTRTAB const *pStrTab, const char *pszString, size_t cchString) { return kDepDbStrTabLookupHashed(pStrTab, pszString, cchString, kDepDbHashString(pszString, cchString)); } /** Wrapper for kDepDbStrTabAddHashed. */ static KU32 kDepDbStrTabAddN(KDEPDBINTSTRTAB *pStrTab, const char *pszString, size_t cchString) { return kDepDbStrTabAddHashed(pStrTab, pszString, cchString, kDepDbHashString(pszString, cchString)); } /** Wrapper for kDepDbStrTabLookupHashed. */ static KU32 kDepDbStrTabLookup(KDEPDBINTSTRTAB const *pStrTab, const char *pszString) { return kDepDbStrTabLookupN(pStrTab, pszString, strlen(pszString)); } /** Wrapper for kDepDbStrTabAddHashed. */ static KU32 kDepDbStrTabAdd(KDEPDBINTSTRTAB *pStrTab, const char *pszString) { return kDepDbStrTabAddN(pStrTab, pszString, strlen(pszString)); } /** * Opens the string table files, creating them if necessary. */ static int kDepDbStrTabInit(KDEPDBINTSTRTAB *pStrTab, const char *pszFilenameBase) { size_t cchFilenameBase = strlen(pszFilenameBase); char szPath[4096]; int rc; KBOOL fNew; /* Basic member init, so kDepDbStrTabTerm always works. */ pStrTab->pHash = NULL; kDepDbFHInit(&pStrTab->hHash); pStrTab->pStrTab = NULL; kDepDbFHInit(&pStrTab->hStrTab); pStrTab->iStringAlloced = 0; /* check the length. */ if (cchFilenameBase + sizeof(".strtab.hash") > sizeof(szPath)) return -1; /* * Open the string table first. */ memcpy(szPath, pszFilenameBase, cchFilenameBase); memcpy(&szPath[cchFilenameBase], ".strtab", sizeof(".strtab")); rc = kDepDbFHOpen(&pStrTab->hStrTab, szPath, K_TRUE, &fNew); return -1; } kbuild-3608/src/kmk/README.VMS0000664000175000017500000005133314670377413015624 0ustar locutuslocutusOverview: -*-text-mode-*- --------- This version of GNU make has been tested on: OpenVMS V8.3/V8.4 (Alpha) and V8.4 (Integrity) AND V7.3 (VAX) This version of GNU Make is intended to be run from DCL to run make scripts with a special syntax that is described below. It likely will not be able to run unmodified Unix makefiles. There is an older implementation of GNU Make that was ported to GNV. Work is now in progress to merge that port to get a single version of GNU Make available. When that merge is done, GNU Make will auto detect that it is running under a Posix shell and then operate as close to GNU Make on Unix as possible. The descriptions below are for running GNU make from DCL or equivalent. Recipe differences: ------------------- GNU Make for OpenVMS can not currently run native Unix make files because of differences in the implementation. I am trying to document the current behavior in this section. This is based on the information in the file NEWS. and running the test suite. TODO: More tests are needed to validate and demonstrate the OpenVMS expected behavior. In some cases the older behavior of GNU Make when run from DCL is not compatible with standard makefile behavior. This behavior can be changed when running GNU Make from DCL by setting either DCL symbols or logical names of the format GNV$. The settings are enabled with a string starting with one of '1', 'T', or 'E' for "1", "TRUE", or "ENABLE". They are disabled with a '0', 'F', or 'D' for "1", "FALSE", or "DISABLE". If they are not explicitly set to one of these values, then they will be set to their default values. The value of the setting DECC$FILENAME_UNIX_REPORT or DECC$FILENAME_UNIX_ONLY will now cause the $(dir x) function to return './' or '[]' as appropriate. The name GNV$MAKE_OLD_VMS when enabled will cause GNU Make to behave as much as the older method as can be done with out disabling VMS features. When it is disabled GNU Make have the new behavior which more closely matches Unix Make behavior. The default is currently the old behavior when running GNU Make from DCL. In the future this may change. When running make from GNV Bash the new behavior is the default. This is a global setting that sets the default behavior for several other options that can be individually changed. Many of the individual settings are to make it so that the self tests for GNU Make need less VMS specific modifications. The name GNV$MAKE_COMMA when enabled will cause GNU Make to expect a comma for a path separator and use a comma for the separator for a list of files. When disabled, it will cause GNU Make to use a colon for a path separator and a space for the separator for a list of files. The default is to be enabled if the GNU Make is set to the older behavior. The name GNV$MAKE_SHELL_SIM when enabled will cause GNU Make to try to simulate a Posix shell more closely. The following behaviors occur: * Single quotes are converted to double quotes and any double quotes inside of them are doubled. No environment variable expansion is simulated. * A exit command status will be converted to a Posix Exit where 0 is success and non-zero is failure. * The $ character will cause environment variable expansion. * Environent variables can be set on the command line before a command. VMS generally uses logical name search lists instead of path variables where the resolution is handled by VMS independent of the program. Which means that it is likely that nothing will notice if the default path specifier is changed in the future. Currently the built in VMS specific macros and recipes depend on the comma being used as a file list separator. TODO: Remove this dependency as other functions in GNU Make depend on a space being used as a separator. The format for recipes are a combination of Unix macros, a subset of simulated UNIX commands, some shell emulation, and OpenVMS commands. This makes the resulting makefiles unique to the OpenVMS port of GNU make. If you are creating a OpenVMS specific makefile from scratch, you should also look at MMK (Madgoat Make) available at https://github.com/endlesssoftware/mmk MMK uses full OpenVMS syntax and a persistent subprocess is used for the recipe lines, allowing multiple line rules. The default makefile search order is "makefile.vms", "gnumakefile", "makefile". TODO: See if that lookup is case sensitive. When Make is invoked from DCL, it will create a foreign command using the name of executable image, with any facility prefix removed, for the duration of the make program, so it can be used internally to recursively run make(). The macro MAKE_COMMAND will be set to this foreign command. When make is launched from an exec*() command from a C program, the foreign command is not created. The macro MAKE_COMMAND will be set to the actual command passed as argv[0] to the exec*() function. If the DCL symbol or logical name GNV$MAKE_USE_MCR exists, then the macro MAKE_COMMAND will be set to be an "MCR" command with the absolute path used by DCL to launch make. The foreign command will not be created. The macro MAKE is set to be the same value as the macro MAKE_COMMAND on all platforms. Each recipe command is normally run as a separate spawned processes, except for the cases documented below where a temporary DCL command file may be used. BUG: Testing has shown that the commands in the temporary command files are not always created properly. This issue is still under investigation. Any macros marked as exported are temporarily created as DCL symbols for child images to use. DCL symbol substitution is not done with these commands. Untested: Symbol substitution. When a temporary DCL command file is used, DCL symbol substitution will work. For VMS 7.3-1 and earlier, command lines are limited to 255 characters or 1024 characters in a command file. For VMS 7.3-2 and later, command lines are limited to 4059 characters or 8192 characters in a command file. VMS limits each token of a command line to 256 characters, and limits a command line to 127 tokens. Command lines above the limit length are written to a command file in sys$scratch:. In order to handle Unix style extensions to VMS DCL, GNU Make has parsed the recipe commands and them modified them as needed. The parser has been re-written to resolve numerous bugs in handling valid VMS syntax and potential buffer overruns. The new parser may need whitespace characters where DCL does not require it, and also may require that quotes are matched were DCL forgives if they are not. There is a small chance that existing VMS specific makefiles will be affected. The '<', '>' was previously implemented using command files. Now GNU Make will check to see if the is already a VMS "PIPE" command and if it is not, will convert the command to a VMS "PIPE" command. The '>>' redirection has been implemented by using a temporary command file. This will be described later. The DCL symbol or logical name GNV$MAKE_USE_CMD_FILE when set to a string starting with one of '1','T', or 'E' for "1", "TRUE", or "ENABLE", then temporary DCL command files are always used for running commands. Some recipe strings with embedded new lines will not be handled correctly when a command file is used. GNU Make generally does text comparisons for the targets and sources. The make program itself can handle either Unix or OpenVMS format filenames, but normally does not do any conversions from one format to another. TODO: The OpenVMS format syntax handling is incomplete. TODO: ODS-5 EFS support is missing. BUG: The internal routines to convert filenames to and from OpenVMS format do not work correctly. Note: In the examples below, line continuations such as a backslash may have been added to make the examples easier to read in this format. BUG: That feature does not completely work at this time. Since the OpenVMS utilities generally expect OpenVMS format paths, you will usually have to use OpenVMS format paths for rules and targets. BUG: Relative OpenVMS paths may not work in targets, especially combined with vpaths. This is because GNU make will just concatenate the directories as it does on Unix. The variables $^ and $@ separate files with commas instead of spaces. This is controlled by the name GNV$MAKE_COMMA as documented in the previous section. While this may seem the natural thing to do with OpenVMS, it actually causes problems when trying to use other make functions that expect the files to be separated by spaces. If you run into this, you need the following workaround to convert the output. TODO: Look at have the $^ and $@ use spaces like on Unix and have and easy to use function to do the conversions and have the built in OpenVMS specific recipes and macros use it. Example: comma := , empty := space := $(empty) $(empty) foo: $(addsuffix .3,$(subs $(comma),$(space),$^) Makefile variables are looked up in the current environment. You can set symbols or logicals in DCL and evaluate them in the Makefile via $(). Variables defined in the Makefile override OpenVMS symbols/logicals. OpenVMS logical and symbols names show up as "environment" using the origin function. when the "-e" option is specified, the origion function shows them as "environment override". On Posix the test scripts indicate that they should show up just as "environment". When GNU make reads in a symbol or logical name into the environment, it converts any dollar signs found to double dollar signs for convenience in using DCL symbols and logical names in recipes. When GNU make exports a DCL symbol for a child process, if the first dollar sign found is followed by second dollar sign, then all double dollar signs will be convirted to single dollar signs. The variable $(ARCH) is predefined as IA64, ALPHA or VAX respectively. Makefiles for different OpenVMS systems can now be written by checking $(ARCH). Since IA64 and ALPHA are similar, usually just a check for VAX or not VAX is sufficient. You may have to update makefiles that assume VAX if not ALPHA. ifeq ($(ARCH),VAX) $(ECHO) "On the VAX" else $(ECHO) "On the ALPHA or IA64" endif Empty commands are handled correctly and don't end in a new DCL process. The exit command needs to have OpenVMS exit codes. To pass a Posix code back to the make script, you need to encode it by multiplying it by 8 and then adding %x1035a002 for a failure code and %x1035a001 for a success. Make will interpret any posix code other than 0 as a failure. TODO: Add an option have simulate Posix exit commands in recipes. Lexical functions can be used in pipes to simulate shell file test rules. Example: Posix: b : c ; [ -f $@ ] || echo >> $@ OpenVMS: b : c ; if f$$search("$@") then pipe open/append xx $@ ; write xx "" ; close xx You can also use pipes and turning messages off to silently test for a failure. x = %x1035a00a %.b : %.c pipe set mess/nofac/noiden/nosev/notext ; type $^/output=$@ || exit $(x) Runtime issues: The OpenVMS C Runtime has a convention for encoding a Posix exit status into to OpenVMS exit codes. These status codes will have the hex value of 0x35a000. OpenVMS exit code may also have a hex value of %x10000000 set on them. This is a flag to tell DCL not to write out the exit code. To convert an OpenVMS encoded Posix exit status code to the original code You subtract %x35a000 and any flags from the OpenVMS code and divide it by 8. WARNING: Backward-incompatibility! The make program exit now returns the same encoded Posix exit code as on Unix. Previous versions returned the OpenVMS exit status code if that is what caused the recipe to fail. TODO: Provide a way for scripts calling make to obtain that OpenVMS status code. Make internally has two error codes, MAKE_FAILURE and MAKE_TROUBLE. These will have the error "-E-" severity set on exit. MAKE_TROUBLE is returned only if the option "-q" or "--question" is used and has a Posix value of 1 and an OpenVMS status of %x1035a00a. MAKE_FAILURE has a Posix value of 2 and an OpenVMS status of %x1035a012. Output from GNU make may have single quotes around some values where on other platforms it does not. Also output that would be in double quotes on some platforms may show up as single quotes on VMS. There may be extra blank lines in the output on VMS. https://savannah.gnu.org/bugs/?func=detailitem&item_id=41760 There may be a "Waiting for unfinished jobs..." show up in the output. Error messages generated by Make or Unix utilities may slightly vary from Posix platforms. Typically the case may be different. When make deletes files, on posix platforms it writes out 'rm' and the list of files. On VMS, only the files are writen out, one per line. TODO: VMS There may be extra leading white space or additional or missing whitespace in the output of recipes. GNU Make uses sys$scratch: for the tempfiles that it creates. The OpenVMS CRTL library maps /tmp to sys$scratch if the TMP: logical name does not exist. As the CRTL may use both sys$scratch: and /tmp internally, if you define the TMP logical name to be different than SYS$SCRATCH:, you may end up with only some temporary files in TMP: and some in SYS$SCRATCH: The default include directory for including other makefiles is SYS$SYSROOT:[SYSLIB] (I don't remember why I didn't just use SYS$LIBRARY: instead; maybe it wouldn't work that way). TODO: A better default may be desired. If the device for a file in a recipe does not exist, on OpenVMS an error message of "stat: : no such device or address" will be output. Make ignores success, informational, or warning errors (-S-, -I-, or -W-). But it will stop on -E- and -F- errors. (unless you do something to override this in your makefile, or whatever). Unix compatibilty features: --------------------------- If the command 'echo' is seen, any single quotes on the line will be converted to double quotes. The variable $(CD) is implemented as a built in Change Directory command. This invokes the 'builtin_cd' Executing a 'set default' recipe doesn't do the trick, since it only affects the subprocess spawned for that command. The 'builtin_cd' is generally expected to be on its own line. The 'builtin_cd' either from the expansion of $(CD) or directly put in a recipe line will be executed before any other commands in that recipe line. DCL parameter substitution will not work for the 'builtin_cd' command. Putting a 'builtin_cd' in a pipeline or an IF-THEN line should not be done because the 'builtin_cd' is always executed and executed first. The directory change is persistent. Unix shell style I/O redirection is supported. You can now write lines like: "mcr sys$disk:[]program.exe < input.txt > output.txt &> error.txt" Posix shells have ":" as a null command. These are now handled. https://savannah.gnu.org/bugs/index.php?41761 A note on appending the redirected output. A simple mechanism is implemented to make ">>" work in action lines. In OpenVMS there is no simple feature like ">>" to have DCL command or program output redirected and appended to a file. GNU make for OpenVMS implements the redirection of ">>" by using a command procedure. The current algorithm creates the output file if it does not exist and then uses the DCL open/append to extend it. SYS$OUTPUT is then directed to that file. The implementation supports only one redirected append output to a file and that redirection is done before any other commands in that line are executed, so it redirects all output for that command. The older implementation wrote the output to a temporary file in in sys$scratch: and then attempted to append the file to the existing file. The temporary file names looked like "CMDxxxxx.". Any time the created command procedure can not complete, this happens. Pressing Ctrl+Y to abort make is one case. In case of Ctrl+Y the associated command procedure is left in SYS$SCRATCH:. The command procedures will be named gnv$make_cmd*.com. The CtrlY handler now uses $delprc to delete all children. This way also actions with DCL commands will be stopped. As before the CtrlY handler then sends SIGQUIT to itself, which is handled in common code. Temporary command files are now deleted in the OpenVMS child termination handler. That deletes them even if a Ctrl+C was pressed. TODO: Does the previous section about >> leaving files still apply? The behavior of pressing Ctrl+C is not changed. It still has only an effect, after the current action is terminated. If that doesn't happen or takes too long, Ctrl+Y should be used instead. Build Options: Added support to have case sensitive targets and dependencies but to still use case blind file names. This is especially useful for Java makefiles on VMS: .SUFFIXES : .SUFFIXES : .class .java .java.class : javac "$<" HelloWorld.class : HelloWorld.java A new macro WANT_CASE_SENSITIVE_TARGETS in config.h-vms was introduced. It needs to be enabled to get this feature; default is disabled. TODO: This should be a run-time setting based on if the process has been set to case sensitive. Unimplemented functionality: The new feature "Loadable objects" is not yet supported. If you need it, please send a change request or submit a bug report. The new option --output-sync (-O) is accepted but has no effect: GNU make for OpenVMS does not support running multiple commands simultaneously. Self test failures and todos: ----------------------------- The test harness can not handle testing some of the VMS specific modes because of the features needed for to be set for the Perl to run. Need to find a way to set the VMS features before running make as a child. GNU make was not currently translating the OpenVMS encoded POSIX values returned to it back to the Posix values. I have temporarily modified the Perl test script to compensate for it. This should be being handled internally to Make. TODO: Verify and update the Perl test script. The features/parallelism test was failing. OpenVMS is executing the rules in sequence not in parallel as this feature was not implemented. GNU Make on VMS no longer claims it is implemented. TODO: Implement it. Symlink support is not present. Symlinks are supported by OpenVMS 8.3 and later. Error messages should be supressed with the "-" at the beginning of a line. On openVMS they were showing up. TODO: Is this still an issue? The internal vmsify and unixify OpenVMS to/from UNIX are not handling logical names correctly. Build instructions: ------------------ Don't use the HP C V7.2-001 compiler, which has an incompatible change how __STDC__ is defined. This results at least in compile time warnings. Make a 1st version $ @makefile.com ! ignore any compiler and/or linker warning $ copy make.exe 1st-make.exe Use the 1st version to generate a 2nd version as a test. $ mc sys$disk:[]1st-make clean ! ignore any file not found messages $ mc sys$disk:[]1st-make Verify your 2nd version by building Make again. $ copy make.exe 2nd-make.exe $ mc sys$disk:[]2nd-make clean $ mc sys$disk:[]2nd-make Running the tests: ------------------ Running the tests on OpenVMS requires the following software to be installed as most of the tests are Unix oriented. * Perl 5.18 or later. https://sourceforge.net/projects/vmsperlkit/files/ * GNV 2.1.3 + Updates including a minimum of: * Bash 4.3.30 * ld_tools 3.0.2 * coreutils 8.21 https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/ https://sourceforge.net/projects/gnv/files/ As the test scripts need to create some foreign commands that persist after the test is run, it is recommend that either you use a subprocess or a dedicated login to run the tests. To get detailed information for running the tests: $ set default [.tests] $ @run_make_tests help Running the script with no parameters will run all the tests. After the the test script has been run once in a session, assuming that you built make in sys$disk:[make], you can redefined the "bin" logical name as follows: $ define bin sys$disk:[make],gnv$gnu:[bin] Then you can use Perl to run the scripts. $ perl run_make_tests.pl Acknowlegements: ---------------- See NEWS. for details of past changes. These are the currently known contributers to this port. Hartmut Becker John Malmberg Michael Gehre John Eisenbraun Klaus Kaempf Mike Moretti John W. Eaton kbuild-3608/src/kmk/testcase-stack.kmk0000664000175000017500000000545714670377415017732 0ustar locutuslocutus# $Id: testcase-stack.kmk 2413 2010-09-11 17:43:04Z bird $ ## @file # kBuild - testcase for the functions. # # # Copyright (c) 2007-2010 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # DEPTH = ../.. include $(PATH_KBUILD)/header.kmk ifneq ($(not 1),) $(error The 'not' function is missing) endif ifneq ($(eq 1,1),1) $(error The 'eq' function is missing) endif ASSERT1 = $(if $(not $(eq $(STACK1),$(1))),$(error failure: STACK1:='$(STACK1)' expected='$(1)')) $(call stack-push,STACK1,1) $(call ASSERT,1) $(call stack-push,STACK1,2) $(call ASSERT,1 2) $(call stack-push,STACK1,3) $(call ASSERT,1 2 3) $(call stack-push,STACK1,4) $(call ASSERT,1 2 3 4) $(call stack-push,STACK1,5) $(call ASSERT,1 2 3 4 5) $(call stack-popv,STACK1) $(call ASSERT,1 2 3 4) $(call stack-push,STACK1,5) $(call ASSERT,1 2 3 4 5) $(call stack-popv,STACK1) $(call ASSERT,1 2 3 4) $(call stack-popv,STACK1) $(call ASSERT,1 2 3) $(call stack-push,STACK1,4) $(call ASSERT,1 2 3 4) $(call stack-push,STACK1,5) $(call ASSERT,1 2 3 4 5) top := $(call stack-top,STACK1) $(if $(not $(eq $(top),5)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='5')) $(call ASSERT,1 2 3 4 5) top := $(call stack-pop,STACK1) $(if $(not $(eq $(top),5)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='5')) $(call ASSERT,1 2 3 4) top := $(call stack-pop,STACK1) $(if $(not $(eq $(top),4)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='4')) $(call ASSERT,1 2 3) top := $(call stack-pop,STACK1) $(if $(not $(eq $(top),3)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='3')) $(call ASSERT,1 2) top := $(call stack-pop,STACK1) $(if $(not $(eq $(top),2)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='2')) $(call ASSERT,1) top := $(call stack-top,STACK1) $(if $(not $(eq $(top),1)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='1')) $(call ASSERT,1) top := $(call stack-pop,STACK1) $(if $(not $(eq $(top),1)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='1')) $(call ASSERT,) top := $(call stack-pop,STACK1) $(if $(not $(eq $(top),)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='')) $(call ASSERT,) all_recursive: $(ECHO) The stack works.$(STACK1) kbuild-3608/src/kmk/testcase-xargs.kmk0000664000175000017500000000404614670377415017742 0ustar locutuslocutus# $Id: testcase-xargs.kmk 2413 2010-09-11 17:43:04Z bird $ ## @file # kBuild - testcase for the xargs function. # Requires manual inspection of the output. # # # Copyright (c) 2007-2010 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # DEPTH = ../.. include $(PATH_KBUILD)/header.kmk ifneq ($(not 1),) $(error The 'not' function is missing) endif ifneq ($(eq 1,1),1) $(error The 'eq' function is missing) endif ASSERT_TRUE = $(if $(not $(1)),$(error failure: '$(1)' isn't true)) ASSERT_FALSE = $(if $(1) ,$(error failure: '$(1)' isn't false)) # 94 bytes ONEARG = abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_xxxxxxxxxxxx ITERATIONS := 0 1 2 3 4 5 6 7 8 9 ITERATIONS := $(foreach i, 0 1 2 3 4 5 6 7 8 9,$(addprefix $(i),$(ITERATIONS))) ITERATIONS := $(foreach i, 0 1 2 3 4 5 6 7 8 9,$(addprefix $(i),$(ITERATIONS))) ITERATIONS := $(foreach i, 0 1 2 3 4 5 6 7 8 9,$(addprefix $(i),$(ITERATIONS))) ITERATIONS := $(foreach i, 0 1 2 3 4 5 6 7 8 9,$(addprefix $(i),$(ITERATIONS))) # add a 5 bytes sequence number and a space, then duplicate it 10000 times: # 100 bytes * 10000 = 1,000,000 bytes. REALLY_LONG := $(foreach i,$(ITERATIONS),$(i)$(ONEARG)) #$(call ASSERT_TRUE, $(xargs $(ECHO) 1:, $(ECHO) 2:, $(ECHO) 3:, asdf asdf asdf asdf asdf asdf asdf adf asdf asdf)) all_recursive: $(xargs @$(ECHO_EXT) 1:, @$(ECHO_EXT) 2:, @$(ECHO_EXT) 3:, $(REALLY_LONG)) $(ECHO) done kbuild-3608/src/kmk/configure.bat0000664000175000017500000000365414670377414016755 0ustar locutuslocutus@echo off rem Copyright (C) 1994-2016 Free Software Foundation, Inc. rem This file is part of GNU Make. rem rem GNU Make is free software; you can redistribute it and/or modify it under rem the terms of the GNU General Public License as published by the Free rem Software Foundation; either version 3 of the License, or (at your option) rem any later version. rem rem GNU Make is distributed in the hope that it will be useful, but WITHOUT rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for. rem more details. rem rem You should have received a copy of the GNU General Public License along rem with this program. If not, see . echo Configuring MAKE for DJGPP rem The SmallEnv trick protects against too small environment block, rem in which case the values will be truncated and the whole thing rem goes awry. COMMAND.COM will say "Out of environment space", but rem many people don't care, so we force them to care by refusing to go. rem Where is the srcdir? set XSRC=. if not "%XSRC%"=="." goto SmallEnv if "%1%"=="" goto SrcDone set XSRC=%1 if not "%XSRC%"=="%1" goto SmallEnv :SrcDone update %XSRC%/configh.dos ./config.h rem Do they have Make? redir -o junk.$$$ -eo make -n -f NUL rem REDIR will return 1 if it cannot run Make. rem If it can run Make, it will usually return 2, rem but 0 is also OK with us. if errorlevel 2 goto MakeOk if not errorlevel 1 goto MakeOk if exist junk.$$$ del junk.$$$ echo No Make program found--use DOSBUILD.BAT to build Make. goto End rem They do have Make. Generate the Makefile. :MakeOk del junk.$$$ update %XSRC%/Makefile.DOS ./Makefile echo Done. if not "%XSRC%"=="." echo Invoke Make thus: "make srcdir=%XSRC%" goto End :SmallEnv echo Your environment is too small. Please enlarge it and run me again. :End set XRSC= kbuild-3608/src/kmk/config.h-vms.template0000664000175000017500000003115514670377413020333 0ustar locutuslocutus/* config.h-vms. Generated by hand by Klaus Kämpf -*-C-*- Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ /* config.h. Generated automatically by configure. */ /* config.h.in. Generated automatically from configure.ac by autoheader. */ /* Pull in types.h here to get __CRTL_VER defined for old versions of the compiler which don't define it. */ #ifdef __DECC # include #endif /* Define to 1 if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE /* #undef _ALL_SOURCE */ #endif /* Define to 1 if NLS is requested. */ /* #undef ENABLE_NLS */ /* Define as 1 if you have dcgettext. */ /* #undef HAVE_DCGETTEXT */ /* Define as 1 if you have gettext and don't want to use GNU gettext. */ /* #undef HAVE_GETTEXT */ /* Embed GNU Guile support */ /* #undef HAVE_GUILE */ /* Define to 1 if your locale.h file contains LC_MESSAGES. */ /* #undef HAVE_LC_MESSAGES */ /* Define to the installation directory for locales. */ #define LOCALEDIR "" /* Define as 1 if you have the stpcpy function. */ /* #undef HAVE_STPCPY */ /* Define to 1 if the closedir function returns void instead of int. */ /* #undef CLOSEDIR_VOID */ /* Define to empty if the keyword does not work. */ /* #undef const */ /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define for DGUX with . */ /* #undef DGUX */ /* Define to 1 if the 'getloadavg' function needs to be run setuid or setgid. */ /* #undef GETLOADAVG_PRIVILEGED */ /* Define to 'unsigned long' or 'unsigned long long' if doesn't define. */ #define uintmax_t unsigned long /* Define to 'int' if doesn't define. */ /* #undef gid_t */ /* Define to 1 if you have alloca, as a function or macro. */ #define HAVE_ALLOCA 1 /* Define to 1 if you have and it should be used (not on Ultrix). */ /* #undef HAVE_ALLOCA_H */ /* Define to 1 if you have the fdopen function. */ #define HAVE_FDOPEN 1 /* Define to 1 if your system has a working fnmatch function. */ /* #undef HAVE_FNMATCH */ /* Define to 1 if your system has its own 'getloadavg' function. */ /* #undef HAVE_GETLOADAVG */ /* Define to 1 if you have the getmntent function. */ /* #undef HAVE_GETMNTENT */ /* Define to 1 if the 'long double' type works. */ /* #undef HAVE_LONG_DOUBLE */ /* Define to 1 if you support file names longer than 14 characters. */ #define HAVE_LONG_FILE_NAMES 1 /* Define to 1 if you have a working 'mmap' system call. */ /* #undef HAVE_MMAP */ /* Define to 1 if system calls automatically restart after interruption by a signal. */ /* #undef HAVE_RESTARTABLE_SYSCALLS */ /* Define to 1 if your struct stat has st_blksize. */ /* #undef HAVE_ST_BLKSIZE */ /* Define to 1 if your struct stat has st_blocks. */ /* #undef HAVE_ST_BLOCKS */ /* Define to 1 if you have the strcoll function and it is properly defined. */ /* #undef HAVE_STRCOLL */ /* Define to 1 if you have the strncasecmp' function. */ #if __CRTL_VER >= 70000000 #define HAVE_STRNCASECMP 1 #endif /* Define to 1 if your struct stat has st_rdev. */ /* #undef HAVE_ST_RDEV */ /* Define to 1 if you have the strftime function. */ /* #undef HAVE_STRFTIME */ /* Define to 1 if you have that is POSIX.1 compatible. */ /* #undef HAVE_SYS_WAIT_H */ /* Define to 1 if your struct tm has tm_zone. */ /* #undef HAVE_TM_ZONE */ /* Define to 1 if you don't have tm_zone but do have the external array tzname. */ /* #undef HAVE_TZNAME */ /* Define to 1 if you have . */ #ifdef __DECC #define HAVE_UNISTD_H 1 #endif /* Define to 1 if utime(file, NULL) sets file's timestamp to the present. */ /* #undef HAVE_UTIME_NULL */ /* Define to 1 if you have the wait3 system call. */ /* #undef HAVE_WAIT3 */ /* Define to 1 if on MINIX. */ /* #undef _MINIX */ /* Define to 1 if your struct nlist has an n_un member. */ /* #undef NLIST_NAME_UNION */ /* Define to 1 if you have . */ /* #undef NLIST_STRUCT */ /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Define to 'int' if doesn't define. */ /* I assume types.h is available for all 5.0 cc/cxx compilers */ #if __DECC_VER < 50090000 #define pid_t int #endif /* Define to 1 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define to 1 if you need to in order for stat and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define as the return type of signal handlers (int or void). */ #define RETSIGTYPE void /* Define to 1 if the setvbuf function takes the buffering type as its second argument and the buffer pointer as the third, as on System V before release 3. */ /* #undef SETVBUF_REVERSED */ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define to 1 if the 'S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ /* Define to 1 if you have the ANSI C header files. */ /* #undef STDC_HEADERS */ /* Define on System V Release 4. */ /* #undef SVR4 */ /* Define to 1 if 'sys_siglist' is declared by . */ /* #undef SYS_SIGLIST_DECLARED */ /* Define to 'int' if doesn't define. */ #if __DECC_VER < 50090000 #define uid_t int #endif /* Define for Encore UMAX. */ /* #undef UMAX */ /* Define for Encore UMAX 4.3 that has instead of . */ /* #undef UMAX4_3 */ /* Name of this package (needed by automake) */ #define PACKAGE "%PACKAGE%" /* Version of this package (needed by automake) */ #define VERSION "%VERSION%" /* Define to the name of the SCCS 'get' command. */ /* #undef SCCS_GET */ /* Define this if the SCCS 'get' command understands the '-G' option. */ /* #undef SCCS_GET_MINUS_G */ /* Define this to enable job server support in GNU make. */ /* #undef MAKE_JOBSERVER */ /* Define to be the nanoseconds member of struct stat's st_mtim, if it exists. */ /* #undef ST_MTIM_NSEC */ /* Define to 1 if the C library defines the variable 'sys_siglist'. */ /* #undefine HAVE_SYS_SIGLIST */ /* Define to 1 if the C library defines the variable '_sys_siglist'. */ /* #undef HAVE__SYS_SIGLIST */ /* Define to 1 if you have the 'union wait' type in . */ /* #undef HAVE_UNION_WAIT */ /* Define to 1 if you have the dup2 function. */ #define HAVE_DUP2 1 /* Define to 1 if you have the getcwd function. */ #define HAVE_GETCWD 1 /* Define to 1 if you have the getgroups function. */ /* #undef HAVE_GETGROUPS */ /* Define to 1 if you have the gethostbyname function. */ /* #undef HAVE_GETHOSTBYNAME */ /* Define to 1 if you have the gethostname function. */ /* #undef HAVE_GETHOSTNAME */ /* Define to 1 if you have the memmove function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the mktemp function. */ #define HAVE_MKTEMP 1 /* Define to 1 if you have the psignal function. */ /* #undef HAVE_PSIGNAL */ /* Define to 1 if you have the pstat_getdynamic function. */ /* #undef HAVE_PSTAT_GETDYNAMIC */ /* Define to 1 if you have the setegid function. */ /* #undef HAVE_SETEGID */ /* Define to 1 if you have the seteuid function. */ /* #undef HAVE_SETEUID */ /* Define to 1 if you have the setlinebuf function. */ /* #undef HAVE_SETLINEBUF */ /* Define to 1 if you have the setregid function. */ /* #undefine HAVE_SETREGID */ /* Define to 1 if you have the setreuid function. */ /* #define HAVE_SETREUID */ /* Define to 1 if you have the sigsetmask function. */ #define HAVE_SIGSETMASK 1 /* Define to 1 if you have the socket function. */ /* #undef HAVE_SOCKET */ /* Define to 1 if you have the strcasecmp function. */ #define HAVE_STRCASECMP 1 /* Define to 1 if you have the strcmpi function. */ /* #undef HAVE_STRCMPI */ /* Define to 1 if you have the stricmp function. */ /* #undef HAVE_STRICMP */ /* Define to 1 if you have the strerror function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the strsignal function. */ /* #undef HAVE_STRSIGNAL */ /* Define to 1 if you have the wait3 function. */ /* #undef HAVE_WAIT3 */ /* Define to 1 if you have the waitpid function. */ /* #undef HAVE_WAITPID */ /* Define to 1 if you have the header file. */ #define HAVE_DIRENT_H 1 /* Define to 1 if you have the header file. */ #ifdef __DECC #define HAVE_FCNTL_H 1 #endif /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_MACH_MACH_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_MEMORY_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_PARAM_H */ /* Define to 1 if you have the header file. */ #ifndef __GNUC__ #define HAVE_SYS_TIMEB_H 1 #endif /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_WAIT_H */ /* Define to 1 if you have the dgc library (-ldgc). */ /* #undef HAVE_LIBDGC */ /* Define to 1 if you have the kstat library (-lkstat). */ /* #undef HAVE_LIBKSTAT * /* Define to 1 if you have the sun library (-lsun). */ /* #undef HAVE_LIBSUN */ /* Define to 1 if you have the `isatty' function. */ /* #undef HAVE_ISATTY */ /* Define to 1 if you have the `ttyname' function. */ /* #undef HAVE_TTYNAME */ /* Use high resolution file timestamps if nonzero. */ #define FILE_TIMESTAMP_HI_RES 0 /* Define for case insensitve filenames */ #define HAVE_CASE_INSENSITIVE_FS 1 /* VMS specific, define it if you want to use case sensitive targets */ /* #undef WANT_CASE_SENSITIVE_TARGETS */ /* VMS specific, V7.0 has opendir() and friends, so it's undefined */ /* If you want to use non-VMS code for opendir() etc. on V7.0 and greater define the first or both macros AND change the compile command to get the non-VMS versions linked: (prefix=(all,except=(opendir,... */ /* #undef HAVE_VMSDIR_H */ /* #undef _DIRENT_HAVE_D_NAMLEN */ /* On older systems without 7.0 backport of CRTL use non-VMS code for opendir() etc. */ #if __CRTL_VER < 70000000 # define HAVE_VMSDIR_H 1 #endif #if defined(HAVE_VMSDIR_H) && defined(HAVE_DIRENT_H) #undef HAVE_DIRENT_H #endif #define HAVE_STDLIB_H 1 #define INCLUDEDIR "sys$sysroot:[syslib]" #define LIBDIR "sys$sysroot:[syslib]" /* Don't use RTL functions of OpenVMS */ #ifdef __DECC #include #include #define getopt gnu_getopt #define optarg gnu_optarg #define optopt gnu_optopt #define optind gnu_optind #define opterr gnu_opterr #define globfree gnu_globfree #define glob gnu_glob #endif /* Define if using alloca.c. */ /* #undef C_ALLOCA */ /* maybe this should be placed into makeint.h */ #if defined(__VAX) && defined(__DECC) #define alloca(n) __ALLOCA(n) #endif /* Output sync sypport */ #define NO_OUTPUT_SYNC /* Define to 1 to write even short single-line actions into a VMS/DCL command file; this also enables exporting make environment variables into the (sub-)process, which executes the action. The usual make rules apply whether a shell variable - here a DCL symbol or VMS logical [see CRTL getenv()] - is added to the make environment and is exported. */ #define USE_DCL_COM_FILE 1 /* Build host information. */ #define MAKE_HOST "VMS" kbuild-3608/src/kmk/ChangeLog.10000664000175000017500000055522114670377414016217 0ustar locutuslocutusTue Oct 29 20:57:36 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Version 3.62. * remake.c (update_file_1): Check for deps still running before giving up if any dep has failed. Sat Oct 26 16:20:00 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * make.h [uts]: #undef S_ISREG and S_ISDIR if defined. Fri Oct 25 19:50:39 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Version 3.60.17. Thu Oct 24 16:58:36 1991 Roland McGrath (roland@wookumz.gnu.ai.mit.edu) * job.c (start_job): Don't check for empty cmds before tweaking the command_ptr. Just let construct_command_argv do it. Tue Oct 22 20:21:03 1991 Roland McGrath (roland@wookumz.gnu.ai.mit.edu) * remake.c, arscan.c [POSIX]: instead of . * make.h [POSIX]: Declare vfork as pid_t. Mon Oct 21 15:37:30 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Version 3.60.16. * job.c (construct_command_argv, construct_command_argv_internal): Take new 2nd arg RESTP. If non-NULL, stop parsing at newline, and store addr of the NL in *RESTP. (start_job): Don't chop expanded cmd lines up; use above code to do it. * function.c (expand_function: `shell'): Pass RESTP==NULL. Sat Oct 19 15:36:34 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Version 3.60.15. Fri Oct 18 15:26:55 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * job.c (start_job): If on the same cmds->command_lines elt, look at cmds->lines_recurse[CHILD->command_line - 1] instead of [CHILD->command_line]. * dir.c [sgi]: , not ndir or anything else. Thu Oct 17 16:28:55 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * file.c (print_file_data_base): Remove unused var. * make.h [NeXT]: No #define ANSI_STRING. Tue Oct 15 20:08:41 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * Version 3.60.14. Fri Oct 11 16:23:52 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * make.h: Use PATH_MAX for getwd defn. * make.h: Move getcwd/getwd outside of #ifndef POSIX, and make it #if USG||POSIX. Thu Oct 10 11:53:31 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * Version 3.60.13. * read.c (read_all_makefiles): When processing MAKEFILES, save the malloc'd ptr to be freed, instead of freeing part-way thru it. * remake.c (update_file_1): Don't tweak FILE->also_make. (update_file): Do it here. After calling update_file_1, set the command_state, update_status, and updated members of each also_make elt to FILE's values. Tue Oct 8 14:56:04 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * Version 3.60.12. * remake.c (notice_finished_file): Set command_state of FILE and its also_make chain to cs_finished here. * commands.c (execute_file_commands), job.c (child_handler), remake.c (remake_file): Don't set it before calling notice_finished_file. * file.h (struct file): Changed `also_make' to struct dep *. * job.c (delete_child_targets), file.c (print_file_data_base), remake.c (notice_finished_file), implicit.c (pattern_search): Use dep chain instead of array of file names. Mon Oct 7 17:04:33 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * Version 3.60.11. * arscan.c: Declare open. * misc.c: Declare {get,set}{re,}[ug]id. * variable.c (target_environment): Declare getenv. Sat Oct 5 15:13:03 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * make.h [NeXT]: instead of . Fri Oct 4 16:05:41 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * default.c (default_suffixes, defualt_suffix_rules): Add .texi just like .texinfo. * Version 3.60.10. * job.c: Move vfork decl into make.h. Fri Sep 27 18:45:30 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * compatMakefile (glob/libglob.a): Pass CC value to submake. Thu Sep 26 00:08:15 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * load.c (load_average): Made not static. * load.c [ultrix && vax]: Define LDAV_TYPE and LDAV_CVT for Ultrix 4.2. Tue Sep 24 00:17:20 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Version 3.60.9. * read.c (record_files): Warn about extra cmds even if the target's name begins with a dot. I think the lusers can handle this. Mon Sep 23 22:33:26 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * make.h, arscan.c: Don't declare bcmp, bzero, or bcopy if they're #define'd. * make.h: Declare write and open. * default.c (default_suffixes, default_suffix_rules, default_variables): Add .C just like .cc. * make.texinfo (Catalogue of Rules): Document .C. * make.man (-w): Fix gramo. Fri Sep 20 17:18:16 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * make.h: No text after #endif. Sun Sep 15 16:20:46 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * Version 3.60.8. * implicit.c (pattern_search): In the second pass, recurse on rule deps that don't have a %. Why did I make it not do this? Fri Sep 14 18:29:39 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * read.c (record_files): For extra cmds, use the last ones given. If the target's name doesn't begin with a dot (bletch!!), emit a two-line warning, one line giving the old cmds' location and the other the new cmds' location. * misc.c (makefile_error, makefile_fatal): New fns. * make.h: Declare them. * Use them instead of error/fatal for all msgs including a file name and line number. Thu Sep 13 16:35:54 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * make.h: Declare define_default_variables. Declare ar_parse_name, instead of ar_name_parse (M-t). Mon Sep 10 18:35:40 1991 Roland McGrath (roland@wookumz.gnu.ai.mit.edu) * Version 3.60.7. * make.texinfo (Variables: Setting): Say whitespace is removed if "immediately after =", rather than simply "after =". * job.c: Don't declare wait #ifdef POSIX. * make.h [__GNUC__]: #undef alloca and then #define it. * main.c (main): When pruning makefiles which might loop from the read_makefiles chain, look at all `prev' entries of double-colon rules. Fri Sep 7 00:41:53 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * main.c (main): Only remove makefiles with cmds but no deps from the list of makefiles to be rebuilt if they are :: targets. : targets with cmds and no deps are not dangerous. Wed Sep 5 17:35:51 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * compatMakefile (defines): Add comment that some compilers take ENUM_BITFIELDS but produce bogus code. (LOAD_AVG): Fix examples to \ "s. (LOADLIBES): Add comment that SGI Irix needs -lmld for nlist. Tue Sep 4 20:26:26 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Version 3.60.6. Fri Aug 30 19:34:04 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * remake.c (update_file_1): When checking the command_state of deps, check through the prev chain. (update_goal_chain): When a target is finished, start checking its prev (if it has one) instead. Wed Aug 7 17:32:03 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * rule.c (convert_to_pattern): Allow files with deps to define suffix rules (really this time). Mon Aug 5 17:09:21 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * misc.c (user_access, make_access): Do saved-IDs (USG) flavor #ifdef POSIX. * file.c (enter_file): Strip ./s here. * read.c (parse_file_seq): Not here. Tue Jul 23 23:34:30 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * compatMakefile: Added comment that -lPW alloca is broken on HPUX. Thu Jul 18 03:10:41 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Version 3.60.5. * read.c (read_makefile): Ignore lines containing chars that are all isspace, not just all isblank. * make.texinfo (Copying): @include gpl.texinfo, rather than copying the text. * gpl.texinfo: New file (symlink to /gd/gnu/doc/gpl.texinfo). * GNUmakefile: Put gpl.texinfo in distribution. Tue Jul 16 12:50:35 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * make.h: #define _GNU_SOURCE before including headers. Include and define isblank if doesn't. * commands.c: Don't include here. * *.c: Use isblank instead of explicit ' ' || '\t'. Mon Jul 15 17:43:38 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * function.c (expand_function: `filter'/`filter-out'): Fixed to not loop infinitely. Fri Jul 12 12:18:12 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * function.c (expand_function: `filter'/`filter-out'): Rewritten to handle filter-out of multiple patterns properly. Also no longer mallocs and reallocs for temp array; uses alloca and a linked-list instead. Wed Jul 10 22:34:54 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Version 3.60.4. * make.texinfo: Moved some @groups that were outside @examples to be inside them. * load.c [apollo] (load_average): Define using special syscall for Apollo DOMAIN/OS SR10.n. Thu Jul 4 12:32:53 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * make.texinfo (Missing): Added Unix excessive implicit rule search; mention that POSIX.2 doesn't require any of the missing features. (Top): Updated printed manual price to $15. Wed Jul 3 18:17:50 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * file.c (rename_file): Carry over last_mtime when merging files. * remake.c (f_mtime): Tail-recurse after renaming VPATH file, to check for saved date in existing renamed-to file. * remote-cstms.c (start_remote_job): Use PATH_VAR. * commands.c [POSIX || __GNU_LIBRARY__]: Don't declare getpid. * compatMakefile (glob-{clean,realclean}): Run clean/realclean in glob. (clean, realclean): Require those. * make.h: Always declare environ. Don't declare old glob functions. * GNUmakefile: Make no-lib deps for load.c and remote.c. Tue Jul 2 18:35:20 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Version 3.60.3. Mon Jul 1 16:58:30 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * read.c (multi_glob): Don't pass GLOB_QUOTE flag to glob. * make.h [POSIX]: Include , and don't declare things that should be there. * main.c (main) [USG && sgi]: malloc a buffer for broken sgi stdio. Sat Jun 29 11:22:21 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * function.c (expand_function: `shell'): Use alloca for the error msg buffer, instead of assuming an arbitrary max size. Fri Jun 28 18:15:08 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * job.c [POSIX] (search_path): Do real 1003.1 goop to get NGROUPS_MAX. Wed Jun 26 11:04:44 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * default.c (define_default_variables): New fn. (install_default_implicit_rules): Code for above fn moved there. * main.c (main): Do define_default_variables before reading the makefile. Tue Jun 25 17:30:46 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * main.c (main): Quote ; in MAKEOVERRIDES. Tue Jun 18 13:56:30 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * compatMakefile: Fixed typo in comment. Tue Jun 11 00:14:59 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * Version 3.60.2. Mon Jun 10 14:46:37 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * make.h: Always include . [POSIX]: Include and #define MAXPATHLEN to be PATH_MAX. * default.c (default_suffix_rules: .texinfo.dvi): Use $(TEXI2DVI). (default_variables): Define TEXI2DVI. Thu Jun 6 16:49:19 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * Version 3.60.1. * make.h (SIGNAL): Cast handler arg to SIGHANDLER type. Wed Jun 5 06:00:43 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * read.c (multi_glob): Use POSIX.2 `glob' function. If a glob pattern matches nothing, leave it as is (a la sh, bash). Also, if can't find USER for ~USER, leave it as is (a la bash). Mon Jun 3 16:36:00 1991 Roland McGrath (roland@albert.gnu.ai.mit.edu) * compatMakefile: Rewrote comments about -Ds to be easier to use. * make.h, arscan.c, remake.c, main.c, dir.c, job.c: Changed tests of _POSIX_SOURCE to POSIX. * job.c: Take getdtablesize out of #ifdef __GNU_LIBRARY__. Put separately #ifdef USG. * COPYING: Replaced with version 2. * Changed copyright notices to refer to GPL v2. Thu May 30 00:31:11 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * make.h: Don't declare sigblock for POSIX. * main.c (main, log_working_directory) [USG]: Get getcwd failure mode from errno, not passed buffer like BSD getwd. * misc.c (child_access): New fn to set access for a child process; like user_access, but you can't change back. * make.h: Declare it. * job.c (exec_command): Use it in place of user_access. Wed May 29 23:28:48 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * default.c (default_variables) [pyr]: PC = pascal. Tue May 28 20:24:56 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * variable.c (print_variable): Put a newline before `endef'. Sat May 25 02:39:52 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * Version 3.60. Wed May 22 19:41:37 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * Version 3.59.5. Thu May 16 13:59:24 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * main.c (main): Do USGr3 setvbuf behavior #ifdef APOLLO. Don't handle SIGCHLD #ifdef USG (Apollo is USG but defines SIGCHLD). Fri May 10 14:59:33 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * remake.c [sgi]: Don't include . Wed May 8 01:54:08 1991 Roland McGrath (roland@geech.gnu.ai.mit.edu) * make.h (SIGHANDLER): #define as (void *) #if __STDC__, else (int (*)()). (SIGNAL): Use it to cast return value. * main.c (main): Cast SIG_IGN to SIGHANDLER when comparing. * job.c (block_signals, unblock_signals): Use SIGNAL instead of signal. * main.c: Declare mktemp to return char*, not int. * job.c (new_job): Don't increment files_remade. * remake.c (notice_finished_file): Do it here. * read.c (do_define): Don't clobber DEFINITION[-1] on empty defns. Free storage that is no longer needed. Wed Apr 24 20:49:48 1991 Roland McGrath (roland at churchy.gnu.ai.mit.edu) * misc.c (message): New fn to print informational msgs with leading "make: " or "make[N]: ". * make.h: Declare it. * remake.c (update_file): Use it instead of printf. Fri Apr 19 05:52:45 1991 Roland McGrath (roland at churchy.gnu.ai.mit.edu) * main.c (main): When there are no targets, if there were no makefiles, print a different error message, which mentions makefiles. Tue Apr 16 03:22:45 1991 Roland McGrath (roland at geech.gnu.ai.mit.edu) * remake.c (update_file): Print "nothing to be done" instead of "is up to date" if FILE->cmds == 0. * job.c [!WIFEXITED]: Define if not already defined. Thu Apr 11 18:00:50 1991 Roland McGrath (roland at wookumz.gnu.ai.mit.edu) * arscan.c (ar_name_equal): Fixed truncation comparison. Tue Apr 2 16:17:35 1991 Roland McGrath (roland at churchy.gnu.ai.mit.edu) * glob.c: Use common version from djm. * dir.c: Snarfed #ifdef mess for or whatever from glob.c. (dir_file_exists_p): Ignore directory entries with d_ino==0. Mon Apr 1 20:49:45 1991 Roland McGrath (roland at albert.gnu.ai.mit.edu) * Version 3.59.4. Fri Mar 29 19:16:18 1991 Roland McGrath (roland at albert.gnu.ai.mit.edu) * job.c (free_child): Free CHILD->environment and its elts. Sat Mar 23 14:08:09 1991 Roland McGrath (roland at albert.gnu.ai.mit.edu) * read.c (read_makefile): Don't ignore lines containing only comments if they start with a tab. Such lines should be passed to the shell for it to decide about the comments. * job.c (free_child): Free CHILD->command_lines and its elts, not CHILD->commands (which is obsolete). * job.h, job.c: Remove obsolete `commands' member of `struct child'. Sun Mar 17 18:40:53 1991 Roland McGrath (roland at albert.ai.mit.edu) * remake.c (update_file): Print a msg for a top-level up-to-date phony target (a different one than for a real file). * read.c (conditional_line): Boundary check so we don't check the value of the -1th elt of the stack (which is bogus). Sat Mar 16 16:58:47 1991 Roland McGrath (roland at albert.ai.mit.edu) * read.c (conditional_line): Don't evaluate an if* when we're already ignoring. Instead, just push a new level, with a value of 1, to keep ignoring. Tue Mar 12 00:16:52 1991 Roland McGrath (roland at geech.ai.mit.edu) * Version 3.59.3. Mon Mar 11 23:56:57 1991 Roland McGrath (roland at geech.ai.mit.edu) * job.c (construct_command_argv_internal): Quote backslashes when building the shell -c line. Fri Mar 8 01:40:18 1991 Roland McGrath (roland at geech.ai.mit.edu) * job.c (exec_command): Call user_access rather than setgid(getgid()). * misc.c (remove_comments): Renamed from collapse_line; took out collapse_continuations call. * make.h: Change decl. * read.c (read_makefile): Collapse continuations on the line buffer immediately after reading it. Call remove_comments rather than collapse_line (which is now defunct). Thu Feb 21 18:06:51 1991 Roland McGrath (mcgrath at cygint.cygnus.com) * misc.c (user_access, make_access): New fns to toggle btwn permissions for user data (files and spawning children), and permissions for make (for taking the load average, mostly). * make.h: Declare them. * job.c (start_job): Call make_access before wait_to_start_job, and user_access after. * main.c (main): Call user_access before doing much. Mon Feb 3 15:02:03 1991 Roland McGrath (roland at albert.ai.mit.edu) * Version 3.59.2. Tue Jan 29 20:30:50 1991 Roland McGrath (roland at cygint.cygnus.com) * read.c (read_all_makefiles): Use allocated_variable_expand to expand `$(MAKEFILES)', since the results are used across calls to read_makefile, which could clobber them. Wed Jan 23 00:24:10 1991 Roland McGrath (roland at cygint.cygnus.com) * main.c (main): Call install_default_implicit_rules after reading makefiles, not before. * default.c (install_default_implicit_rules): If a suffix-rule file entry has cmds, don't give it any from default_suffix_rules. Fri Jan 17 17:39:49 1991 Roland McGrath (roland at albert.ai.mit.edu) * arscan.c: Added support for AIX archives. * remake.c: Don't include ar.h. * main.c: Removed unused atol decl. * arscan.c (ar_scan): Declare arg FUNCTION to return long int. * ar.c (ar_touch): Don't perror for an invalid archive. * make.h: Declare lseek as long int. * job.c [hpux]: Define getdtablesize a la USG. Sun Jan 12 21:08:34 1991 Roland McGrath (roland at albert.ai.mit.edu) * Version 3.59.1. Fri Jan 10 03:48:08 1991 Roland McGrath (roland at albert.ai.mit.edu) * job.c (search_path): Take new arg, place to put full pathname (rather than mallocing it). (exec_command): Pass it, using auto storage. * main.c (print_version): Updated copyright years. Wed Jan 8 19:46:19 1991 Roland McGrath (roland at albert.ai.mit.edu) * job.c [_POSIX_SOURCE]: Just #include , and define macro WAIT_NOHANG in terms of waitpid. [!_POSIX_SOURCE && (HAVE_SYS_WAIT || !USG)]: Don't #include (make.h does). Define macro WAIT_NOHANG in terms of wait3. (child_handler): #ifdef on WAIT_NOHANG, not HAVE_SYS_WAIT || !USG. Use WAIT_NOHANG macro instead of wait3. * file.h (struct file.command_state): Remove unused elt. Wed Dec 26 18:10:26 1990 Roland McGrath (roland at albert.ai.mit.edu) * commands.c (set_file_variables): If FILE got its commands from .DEFAULT, make $< == $@ (4.3 BSD/POSIX.2d11 compat). Mon Dec 24 17:36:27 1990 Roland McGrath (roland at albert.ai.mit.edu) * default.c (default_variables): Rename 2nd LINK.s defn to LINK.S. Fri Dec 14 15:05:25 1990 Roland McGrath (roland at albert.ai.mit.edu) * vpath.c (selective_vpath_search): Check for makefile-mentioned before checking for actual existence. The old order loses if the containing directory doesn't exist (but a rule might make it). * make.h [__GNUC__]: Don't #define alloca if already #define'd. * rule.c (convert_to_pattern): Don't look at the target constructed for the empty rule when making the null-suffix rule. Construct it over again, since the former may have been freed already. Thu Dec 13 17:21:03 1990 Roland McGrath (roland at churchy.ai.mit.edu) * make.h [__GNU_LIBRARY__]: Include to get random fn decls. Wed Dec 12 17:12:59 1990 Roland McGrath (roland at churchy.ai.mit.edu) * make.h, arscan.c, glob.c: Only include #ifdef USG. * variable.c (define_variable_in_set): Replace env_overrides check that wasn't really redundant (undoing Sep 28 change). Add comment saying why this check is necessary. * job.c, main.c [DGUX]: Needs siglist like USG. Mon Dec 11 01:19:29 1990 Roland McGrath (roland at albert.ai.mit.edu) * default.c [M_XENIX]: For rules that are different for Xenix, use the generic Unix version #ifdef __GNUC__. * main.c [M_XENIX]: Use USGr3-style setvbuf call. * read.c (find_percent): Do backslash folding correctly, not leaving extra crud on the end of the string. Sun Dec 10 21:48:36 1990 Roland McGrath (roland at albert.ai.mit.edu) * job.c: Don't declare wait3 if it's #defined. * GNUmakefile, compatMakefile, make.texinfo: Change make-info to make.info. Thu Dec 7 21:20:01 1990 Roland McGrath (roland at churchy.ai.mit.edu) * make.h [STDC_HEADERS || __GNU_LIBRARY__ || _POSIX_SOURCE]: Use ANSI and names for str/mem functions. Use to declare misc fns rather than explicit decls. [_POSIX_SOURCE]: Don't declare kill ( will). Include before because some braindead nonconformant 1003.1 implementation needs it. * misc.c: Don't declare malloc, realloc. Do it in make.h. * arscan.c, glob.c: Use sequence for string fns from make.h verbatim. * make.h (S_ISDIR, S_ISREG): Declare if necessary. * commands.c (delete_child_targets), job.c (search_path), read.c (construct_include_path): Use S_ISfoo(m) instead of (m & S_IFMT) == S_IFfoo. * dir.c, glob.c [_POSIX_SOURCE]: Use dirent. Wed Nov 29 22:53:32 1990 Roland McGrath (roland at geech.ai.mit.edu) * Version 3.59. Tue Nov 28 16:00:04 1990 Roland McGrath (roland at churchy.ai.mit.edu) * arscan.c (ar_name_equal) [APOLLO]: Don't do `.o' hacking. On Apollos the full file name is elsewhere, and there is no length restriction (or so I'm told). Thu Nov 23 17:33:11 1990 Roland McGrath (roland at albert.ai.mit.edu) * load.c [hp300 && BSD] (LDAV_CVT): Define for this system. Tue Nov 21 07:58:40 1990 Roland McGrath (roland at albert.ai.mit.edu) * read.c (record_files): Fix trivial bug with deciding to free storage for a file name. Thu Nov 16 06:21:38 1990 Roland McGrath (roland at geech.ai.mit.edu) * compatMakefile ($(bindir)/make): Install it setgid kmem. Thu Nov 1 16:12:55 1990 Roland McGrath (roland at churchy.ai.mit.edu) * GNUmakefile (make-*.tar.Z): Use `h' option to tar (dereference symlinks), to grab texinfo.tex from wherever it lives. Tue Oct 30 16:15:20 1990 Roland McGrath (roland at churchy.ai.mit.edu) * Version 3.58.13. Fri Oct 26 14:33:34 1990 Roland McGrath (roland at churchy.ai.mit.edu) * GNUmakefile: make-*.tar.Z: Include texinfo.tex. Tue Oct 23 19:34:33 1990 Roland McGrath (roland at churchy.ai.mit.edu) * main.c (define_makeflags): When there are no flags to write, make sure the array has two leading nulls, since `MAKEFLAGS' is defined from &flags[1]. * main.c (default_keep_going_flag): New variable (constant one). (command_switches: -k, -S): Use above for default value. (define_makeflags): Only write flag/flag_off switches if they are on, and either there is no default value, or they are not the default. Mon Oct 22 16:14:44 1990 Roland McGrath (roland at churchy.ai.mit.edu) * main.c (struct command_switch): New member `no_makefile'. (command_switches: -n, -q, -t): Set no_makefile == 1. (define_makeflags): Take new arg MAKEFILE: if nonzero, don't use options whose `no_makefile' flags are set. (main): Call define_makeflags with MAKEFILE==1 before remaking makefiles, and again with MAKEFILE==0 before remaking goals. Tue Oct 2 17:16:45 1990 Roland McGrath (roland at geech.ai.mit.edu) * Version 3.58.12. Mon Oct 1 15:43:23 1990 Roland McGrath (roland at churchy.ai.mit.edu) * arscan.c [HPUX]: Use PORTAR==1 format. Sat Sep 29 16:38:05 1990 Roland McGrath (roland at churchy.ai.mit.edu) * make.h, remake.c, arscan.c: Don't declare `open'. Fri Sep 28 04:46:23 1990 Roland McGrath (roland at churchy.ai.mit.edu) * variable.c (define_variable_in_set): Remove redundant -e check. Wed Sep 26 00:28:59 1990 Roland McGrath (roland at geech.ai.mit.edu) * job.c (start_job): Set RECURSIVE from the right elt of CHILD->file->cmds->lines_recurse. * commands.c (chop_commands): Don't botch the line count for allocating CMDS->lines_recurse. * Version 3.58.11. * job.c (start_job): Don't always increment CHILD->command_line! Only do it when CHILD->command_ptr has run out! (Dumb bug. Sigh.) Thu Sep 20 02:18:51 1990 Roland McGrath (roland at geech.ai.mit.edu) * GNUmakefile [ARCH]: Give explicit rule for remote.{c,dep} to use variable `REMOTE' for more flags. ($(prog)): Link in $(LOADLIBES). Wed Sep 19 02:30:36 1990 Roland McGrath (roland at churchy.ai.mit.edu) * commands.h (struct commands): New member `ncommand_lines', the number of elts in `command_lines' et al. * commands.c (chop_commands): Set `ncommand_lines' elt of CMDS, and don't put a nil pointer at the end of `command_lines'. * job.h (struct child): New member `command_lines' to hold variable-expanded command lines. * job.c (new_job): Store expanded command lines in `command_lines' member of new child. Don't clobber FILE->cmds. (start_job): Use CHILD->command_lines in place of CHILD->file->cmds->command_lines. * variable.h, variable.c, job.c, expand.c: Undo yesterday's change, which is no longer necessary since we have cleverly avoided the issue. * job.c (start_job): Don't variable-expand each command line. (new_job): Do them all here, storing the expansions in the array. Tue Sep 18 01:23:13 1990 Roland McGrath (roland at churchy.ai.mit.edu) * variable.h (struct variable): Remove `expanding' member. * variable.c (define_variable_in_set): Don't initialize it. * expand.c (struct variable_expanding): New type, a linked list containing `struct variable' pointers. (variables_expanding): New variable, the chain of variables currently being expanded. (recursively_expand): Don't test and set `expanding' member. Instead, run through the `variables_expanding' chain looking for a link referring to V to find self-reference. Add a new link to the chain, describing V, before recursive expansion, and pop it off afterward. * job.c (child_handler): Save `variables_expanding' and clear it before calling start_job, and restore it afterward. This avoids major lossage when the SIGCHLD comes in the middle of variable expansion. Mon Sep 17 14:46:26 1990 Roland McGrath (roland at geech.ai.mit.edu) * job.c, commands.c: Don't define sigmask. * make.h: Put it here instead. * variable.c (target_environment): If `.NOEXPORT' was specified as a target, only export command-line and environment variables, and file-origin variables that were in the original environment. * make.man: Add missing ?roff control for `-I' option description. Thu Sep 13 14:10:02 1990 Roland McGrath (roland at churchy.ai.mit.edu) * load.c [UMAX]: Move #include to [not UMAX_43]. Wed Sep 12 15:10:15 1990 Roland McGrath (roland at churchy.ai.mit.edu) * expand.c (recursively_expand): Don't use `reading_filename' and `reading_lineno_ptr' if they're nil. Thu Aug 30 17:32:50 1990 Roland McGrath (roland at geech) * Version 3.58.10. Tue Aug 28 04:06:29 1990 Roland McGrath (roland at churchy.ai.mit.edu) * job.c [USG] (unknown_children_possible): New variable, set nonzero when it's possible for children not in the `children' chain to die. (block_signals) [USG]: Set it. (unblock_signals) [USG]: Clear it. (child_handler) [USG]: Don't complain about unknown children if `unknown_children_possible' is set. * read.c (do_define): Make sure there's enough space for the newline, so we don't write off the end of allocated space. * arscan.c (ar_name_equal): Fixed to work when MEM is AR_NAMELEN-1 but NAME is not the same length. Sat Aug 25 16:17:14 1990 Roland McGrath (roland at geech) * job.c (construct_command_argv_internal): Use a static char array for a constant, since old C has no auto aggregate initializers. Thu Aug 23 16:11:03 1990 Roland McGrath (roland at churchy.ai.mit.edu) * job.c (search_path): If PATH is nil or "" use a default path. Wed Aug 22 01:05:32 1990 Roland McGrath (roland at churchy.ai.mit.edu) * Version 3.58.9. * job.c (exec_command): Don't take PATH and SHELL args. Get them from ENVP. (child_execute_job): Don't take FILE arg, and don't pass path and shell to exec_command. (start_job): Don't pass FILE arg to child_execute_job. * function.c (expand_function: `shell'): Ditto. * main.c (main): Don't pass path and shell to exec_command. Fri Aug 17 23:17:27 1990 Roland McGrath (roland at geech) * job.c (construct_command_argv_internal): New fn broken out of construct_command_argv. Takes strings SHELL and IFS instead of doing variable expansion for them. Recurse to make an argv for SHELL, passing SHELL==0. When SHELL==0, don't recurse for shell argv; make a simple one using /bin/sh. (construct_command_argv): Do the variable expansions and call above. Thu Aug 16 19:03:14 1990 Roland McGrath (roland at geech) * read.c (multi_glob): For ~USER/FILE, if USER isn't found, don't change the file name at all. Tue Aug 7 18:33:28 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * function.c (expand_function: `suffix'/`notdir'): Don't kill the last space if we never wrote one. * function.c (expand_function: `suffix'): Retain the dot, like the documentation says. Mon Aug 6 14:35:06 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.58.8. * main.c (decode_switches): For positive_int and floating cases, move SW past the arg (and don't set it to ""), so another switch can follow. Fri Aug 3 00:43:15 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * job.c (child_execute_job): Use unblock_signals instead of push_signals_blocked_p (0). * main.c (fatal_signal_mask): New variable, mask of signals caught with fatal_error_signal. (main): Set it. * job.c ({block,unblock}_children): Renamed to {block,unblock}_signals. Block/unblock both child signal and signals in fatal_signal_mask. (children_blocked_p_{stack,max,depth}, {push,pop}_children_blocked_p): Renamed from children to signals. Use {block,unblock}_signals instead of {block,unblock}_children. * commands.c (fatal_error_signal), job.c (wait_for_children, new_job, child_execute_job, main, log_working_directory), function.c (expand_function: `shell'), job.h: Rename {push,pop}_children_blocked_p to {push,pop}_signals_blocked_p. * job.c (child_handler): Call {block,unblock}_signals instead of just {block,unblock}_remote_children. We need to block the fatal signals. Thu Aug 2 22:41:06 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * main.c, function.c: Fixed typos in comments. * file.c (print_file_data_base): Fix computation of avg files/bucket. Tue Jul 31 22:11:14 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.58.7. Wed Jul 25 16:32:38 1990 Roland McGrath (mcgrath at tully.Berkeley.EDU) * arscan.c (ar_name_equal): Fixed to really do it right. (ar_member_pos): Fixed order of args. * ar.c (ar_member_date_1): Ditto. Fri Jul 20 15:30:26 1990 Roland McGrath (mcgrath at tully.Berkeley.EDU) * arscan.c (ar_name_equal): Rewritten. Accounts for a possible trailing slash in MEM. * remake.c (f_mtime): Keep track of whether ARNAME is used and free it if not. Also free MEMNAME. * ar.c (ar_member_date, ar_touch): Ditto. * arscan.c (arscan) [HPUX or hpux]: Treat same as USGr3 PORTAR==1. * make.h: If NSIG is not defined, but _NSIG is, #define NSIG _NSIG. * compatMakefile: Don't use $* in explicit rules. * default.c (default_variables: "PREPROCESS.S"): Include $(CPPFLAGS). * remake.c (f_mtime): If FILE is an ar ref, get the member modtime. * function.c (string_glob): Terminate the string properly when it's empty. Wed Jul 18 11:26:56 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.58.6. * commands.c (set_file_variables): Fixed computation for ^F/?F elt len. Sat Jul 14 13:41:24 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * job.c (construct_command_argv): Always use allocated_variable_expand_for_file instead of variable_expand_for_file because we might be called from inside a variable expansion (for the `shell' function). * function.c (expand_function: `shell'): Free the arglist's storage correctly. construct_command_argv only allocates ARGV and ARGV[0]. * job.c (children_blocked_p_idx): Renamed to children_blocked_p_depth. (push_children_blocked_p, pop_children_blocked_p): Use ..._depth instead of ..._idx, and do it right! Wed Jul 11 15:35:43 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * make.h (SIGNAL): New macro to replace `signal' calls. Does arg and ret value casts to (void *) #ifdef __STDC__ to avoid conflicts btwn ANSI and BSD `signal' and handler types. * main.c (main), job.c (child_handler): Use it. Fri Jul 6 00:00:38 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * ar.c (ar_member_date, ar_touch): Pass 2nd arg to f_mtime. * read.c (read_makefile): Search the include path for MAKEFILES variable makefiles (TYPE == 1), like it says in the manual. * file.h (struct file), main.c (struct command_switch): Remove trailing commas from enums. * commands.c (execute_file_commands): Remove unused variables. * commands.h: Declare chop_commands. * make.h: Declare uniquize_deps. * main.c (main): Remove unused variable. (decode_switches): Remove unused label. * remake.c: Include "ar.h" for ar_parse_name decl. * implicit.c (try_implicit_rule): Remove unused variable. * function.c (expand_function: `shell'): Declare fork, pipe. * ar.c: Declare ar_name_equal. * GNUmakefile: If using gcc, add warning flags to CFLAGS. * remake.c: Remove decl of ar_member_date, since it's done in make.h. * remake.c (f_mtime): For ar refs, allow the archive to be found via VPATH search if we're searching, and change the ar ref accordingly. * ar.c (ar_parse_name): New global fn to parse archive-member references into the archive and member names. (ar_member_date, ar_touch): Use it. * make.h: Declare it. * remake.c (f_mtime): After doing rename_file, do check_renamed instead of assuming rename_file will always set FILE->renamed (which it won't). * vpath.c (selective_vpath_search): Only accept prospective files that don't actually exist yet are mentioned in a makefile if the file we are searching for isn't a target. Wed Jul 4 04:11:55 1990 Roland McGrath (mcgrath at helen.Berkeley.EDU) * remake.c (update_goal_chain): Do check_renamed after calling file_mtime. (check_dep): Ditto after update_file. * file.c (rename_file): Prettied up long message for merging cmds. * remake.c (update_file_1): Get each dep file's modtime, and allow for it being renamed, before checking for a circular dep, since a renaming may have introduced one. Tue Jul 3 18:15:01 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * ar.c (ar_touch): Don't free ARNAME since enter_file holds onto the storage. * function.c (string_glob): Don't leave a trailing space. * read.c (do_define): Allow leading whitespace before `endef'. Mon Jul 2 14:10:16 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * implicit.c (pattern_search): No longer take NAME arg. Instead take ARCHIVE flag. If ARCHIVE is nonzero, FILE->name is of the form "LIB(MEMBER)"; rule for "(MEMBER)" is searched for, and LASTSLASH is set to nil. Since NAME was only non-nil when it was the archive member name passed by try_implicit_rule, this change easily allows turning off LASTSLASH checking for archive members without excessive kludgery. (try_implicit_rule): Pass ARCHIVE flag instead of file name. * Version 3.58.5. * commands./c (set_file_variables): Don't kill last char of $(^D) elts. Sat Jun 30 00:53:38 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * ar.c (ar_member_date): Don't free ARNAME since enter_file holds onto the storage. * arscan.c (ar_scan) [sun386 && PORTAR == 1]: Treat like USGr3. Wed Jun 27 14:38:49 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * main.c (main): Put a newline on the debugging message when deciding not to remake a makefile to avoid a possible loop. Only decide not to remake makefiles that have commands (as well as being targets and having no deps). Fri Jun 22 12:35:37 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * default.c (default_variables): Define `LINK.s' and `LINK.S'. (default_suffix_rules): Define .S.o rule. * job.c (construct_command_argv): If we decide to go the slow route, free all storage for the chopped args. (start_job): Free the argument list's storage correctly. construct_command_argv only allocates ARGV and ARGV[0]. Tue Jun 19 18:27:43 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.58.4. Fri Jun 15 21:12:10 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * glob.c: New version from ai-lab which doesn't do [^abc]. Thu Jun 7 00:30:46 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * dir.c: Copied dirent vs direct et al mess from glob.c. * glob.c: Replaced with updated version from djm. * glob.c: Check macro DIRENT instead of _POSIX_SOURCE for . __GNU_LIBRARY__ implies DIRENT and STDC_HEADERS. Thu May 31 22:19:49 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * vpath.c (vpath_search): Don't stop the loop if a pattern matches but the search fails. All matching patterns have their paths searched (like it says in the manual). * make.texinfo (Rules: Directory Search: Selective Search): Say that multiple `vpath' directives with the same pattern DO accumulate, not supersede earlier ones. * vpath.c (print_vpath_data_base): Increment the count of vpaths on each loop iteration, rather than letting it stay zero. * Version 3.58.3. * job.c (block_children, unblock_children): Made static. (push_children_blocked_p, pop_children_blocked_p): New functions to push and pop whether children are blocked or not. * job.h: Declare push_children_blocked_p, pop_children_blocked_p and not block_children, unblock_children. * commands.c (fatal_error_signal), job.c (wait_for_children, new_job, child_execute_job), main.c (main, log_working_directory): Use sequences of push_children_blocked_p (1) and pop_children_blocked_p () instead of explicitly blocking and unblocking children. * function.c (expand_function: `shell'): Don't unblock children. The push-pop sequence in wait_for_children makes it unnecessary. Tue May 29 21:30:00 1990 Roland McGrath (mcgrath at helen.Berkeley.EDU) * read.c (do_define): Don't include the last newline in the definition. * function.c (expand_function: `shell'): Call construct_command_argv before forking and don't fork if it returns nil. Free the argument list's storage before finishing. * job.c (start_job): Free the storage for the child's argument list in the parent side of the fork after the child has been spawned. * job.c (start_job): If construct_command_argv returns nil, go to the next command line. * job.c (construct_command_argv): Use the shell if the command contains an unterminated quote. Wed May 23 19:54:10 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.58.2. * read.c (read_makefile): Parse "override define" correctly. Thu May 17 15:25:58 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * arscan.c [USG]: Don't declare memcpy and memcmp. should do this anyway (and lack of declarations is harmless). * remote-customs.c: Renamed to remote-cstms.c for System V. * remote.c [CUSTOMS]: Changed accordingly. Sun May 13 14:38:39 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * GNUmakefile: Use same cmds for doc tar.Z as for dist tar.Z (so the contents go in make-N.NN). Thu Apr 26 19:33:25 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.58.1. Wed Apr 25 20:27:52 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * job.c (init_siglist): Don't do SIGUSR1 and SIGUSR2 if they are the same as SIGIO and SIGURG (true on Cray). Tue Apr 24 20:26:41 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * arscan.c (ar_scan): Do behavior for PORTAR == 1 and USGr3 also #ifdef APOLLO. Wed Apr 11 10:00:39 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * job.c (exec_command): Set the effective GID to the real GID. Somehow this code got lost. * implicit.c (pattern_search): Use the right index variable when seeing if we need to expand FILE->also_make. Sun Mar 4 09:18:58 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.58.0. * remake.c (remake_file): Treat non-targets without commands under -t the same as anything else without commands. Sat Feb 24 17:46:04 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * default.c (default_variables: PREPROCESS.S): Removed $< from defn. * main.c (main): Ignore arguments that are the empty string, rather than feeding them to enter_file and barfing therein. Wed Feb 14 16:28:37 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * main.c (main): Call construct_include_path after doing chdirs. Thu Feb 8 13:43:44 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.58. Sat Feb 3 22:06:55 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.57.7. * make.texinfo (Implicit: Catalogue of Rules): For RCS, noted that working files are never overwritten by the default rule. Thu Feb 1 17:27:54 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * rule.c (count_implicit_rule_limits): Redid loop control to not run twice on freed rules. * GNUmakefile: Made `.dep' files be architecture-specific too. * main.c (main, log_working_directory) [USG]: Block children around calls to `getwd' (actually `getcwd' on USG), because that function sometimes spawns a child running /bin/pwd on USG. Tue Jan 30 14:02:50 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * function.c (subst_expand): Pay attention to SUFFIX_ONLY, putz. Wed Jan 24 21:03:29 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * make.man: Fixed repeated word. * make.texinfo (Missing): Reworded a buggy sentence. Mon Jan 22 12:39:22 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * main.c (print_version): Added 1990 to copyright notice. * Version 3.57.6. Sat Jan 20 11:52:01 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * file.c (rename_file): Don't free the storage for the old name, since it might not have been malloc'd. * job.c (construct_command_argv): Call allocated_variable_expand_for_file instead of variable_expand_for_file to expand `$(SHELL)'. * make.texinfo (Bugs): Change address from roland@wheaties.ai.mit.edu to roland@prep.ai.mit.edu. Tue Jan 16 19:22:33 1990 Roland McGrath (mcgrath at tully.Berkeley.EDU) * Version 3.57.5. Sun Jan 14 16:48:01 1990 Roland McGrath (mcgrath at helen.Berkeley.EDU) * job.c (start_job): Only call wait_to_start_job for the first command line in each sequence. Thu Jan 4 14:27:20 1990 Roland McGrath (mcgrath at helen.Berkeley.EDU) * load.c [LDAV_BASED] (wait_to_start_job): Loop while job_slots_used > 0, not > 1. * job.c (search_path): Don't return a pointer to local storage. Allocate data space for the pathname instead. * function.c (expand_function: `shell'): Don't write garbage if the child wrote no output. Wed Jan 3 15:28:30 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.57.4. * file.h (struct file): New member `renamed', a `struct file *' that is the place this file has been renamed to (or nil). (check_renamed): Macro to check for a file having been renamed. Dereferences the renaming and sets the given variable. * file.c (rename_file): Completely rewritten. Renames in place if possible, or moves FILE to a different hash bucket if there is no existing file with the new name. If there is an existing file with the new name, FILE is merged into it and FILE->renamed is set to point to it. * variable.c (merge_variable_sets): New fn to merge two variable sets. (merge_variable_set_lists): New fn to merge two variable set lists. * variable.h: Declare merge_variable_set_lists. * remake.c (update_file_1, check_dep): Run `check_renamed' after calling file_mtime, check_dep. (update_file): Same after update_file_1. (update_goal_chain, update_file_1, check_dep): Same after update_file. * read.c (uniquize_deps): New fn, broken out of record_files, to remove duplicate deps from a chain. (record_files): Use it. * implicit.c (pattern_search): Use uniquize_deps. * file.h (file_mtime_1): New macro, like file_mtime, but take second arg, passed to f_mtime. (file_mtime): Implement as file_mtime_1 (file, 1). (file_mtime_no_search): New macro: file_mtime (file, 0). * remake.c (f_mtime): Take new arg SEARCH. Only do VPATH and `-lNAME' searching if it is nonzero. * main.c (main): Use file_mtime_no_search for makefiles. * remake.c (update_goal_chain): Use file_mtime_no_search if MAKEFILES. * main.c (printed_version): New variable, init'd to zero. (print_version): Set it to nonzero before returning. (die): If -v and !printed_version, call print_version before clean up and death. * main.c (log_working_directory): Keep track of whether or not the "Entering" message has been printed, and return without printing the "Leaving" message if not. * main.c (decode_switches): Don't complain about missing args before checking for a noarg_value elt in the command_switch structure. Tue Jan 2 15:41:08 1990 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.texinfo (Commands: Recursion: Options/Recursion): Document special case of -j. * make.texinfo, main.c, job.c: Changed copyright notices to include 1990. * make.texinfo (Top): Fixed introductory paragraph, which said that `make' itself (instead of the manual) has various chapters. (Variables: Advanced: Substitution Refs): When pxref'ing about `patsubst', use node `Text Functions', not `Functions'. Add an xref about `patsubst' after description of $(var:a%b=c%d). (Functions: Syntax of Functions): Explain why mixing delimiters in function/var refs is unwise. Clarify fn arg evaluation order. (Options): Reworded sentence about `-e'. (Implicit: Implicit Variables): Don't say `RM' is unused. Say the dflt values for the flag vars is empty unless otherwise noted, since some have defaults. (Implicit: Pattern Rules: Pattern Examples): Clarified use of $< and $@ in first example. (Implicit: Last Resort): Don't say the .DEFAULT example creates files "silently". It's automatic, but not silent. (Implicit: Search Algorithm): Fixed confusing ungrammatical sentence for item 5.1. (Archives: Archive Update): Added missing `next' pointer. (Archives: Archive Symbols): Note that GNU `ar' deals with this automatically. * job.c (search_path): New fn, to search for an executable file in a search path (broken out of exec_command). (exec_command): Take fourth arg, the shell program to use (if necessary). Use search_path for the program, and the shell program. Pass args "file args ..." to shell program (with no -c), where FILE is the full pathname of the program (script) to be run. (child_execute_job): Pass shell program to exec_command. * main.c (main): Ditto. * main.c (main): Don't write a message if exec_command returns, because it will never return. Fri Dec 22 16:19:58 1989 Roland McGrath (mcgrath at hecuba.Berkeley.EDU) * default.c (default_variables: "LINK.cc"): Use $(C++FLAGS) instead of $(CFLAGS). Wed Dec 20 09:58:48 1989 Roland McGrath (mcgrath at hecuba.Berkeley.EDU) * job.c (new_job): If start_job set the child's `command_state' to `cs_finished', call notice_finished_file. Sun Dec 17 19:45:41 1989 Roland McGrath (mcgrath at hecuba.Berkeley.EDU) * Version 3.57.3. Wed Dec 13 17:57:12 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * rule.c (convert_to_pattern): Accept files with dependencies as suffix rules. Thu Nov 30 15:47:13 1989 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.57.2. * function.c (expand_function: `shell'): Don't clobber BUFFER and then try to free it. * remake.c (update_file_1): Took code to force remake of nonexistent deps out of #if 0, and changed the test to nonexistent non-intermediate deps. In version 4, I think removing this test completely will implement the new feature that if a: b and b: c and c is newer than a, b need not be remade. Sun Nov 26 16:12:41 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * compatMakefile (load.o, remote.o): Use $*.c instead of explicit file names so that using VPATH works. Tue Nov 21 14:57:18 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.57.1. Fri Nov 10 03:28:40 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * remake.c (check_dep): Set *MUST_MAKE_PTR if FILE does not exist after being updated. (The exact opposite test was here before; why???) (update_file_1): Set a dep's `changed' member after updating it if it is phony and has commands (because they will then always be executed). Thu Nov 9 13:47:12 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * load.c [UMAX]: #ifdef UMAX_43 include different headers for the `inq_stats' call. * compatMakefile (LOAD_AVG): Document UMAX_43. * Version 3.57.0. * commands.c (chop_commands): New function to chop commands into lines. * job.c (new_job): Break that code out, and call chop_commands. * remake.c (remake_file): Call chop_commands before looking at FILE->cmds->any_recurse. * make.texinfo (Running: Goals): Don't say that the default target won't be taken from an included makefile. * remake.c (update_file_1): #if 0 out setting MUST_MAKE if a dep doesn't exist. Fri Nov 3 15:53:03 1989 Roland McGrath (mcgrath at tully.Berkeley.EDU) * Version 3.57. * variable.c (try_variable_definition): Don't calculate useless value. * main.c (define_makeflags): Fixed -j propagation. * commands.c (execute_file_commands): Removed unused variable. Sun Oct 29 11:11:15 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * commands.c (execute_file_commands): If the commands are empty, call notice_finished_file before returning. Sat Oct 28 23:06:32 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * remake.c (update_file_1): Don't always update a target that has no deps. Only do this for double-colon targets. Wed Oct 25 16:36:16 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * main.c (main) [hpux]: hpux == HPUX. * compatMakefile (defines): Document that HPUX should be defined. Tue Oct 24 19:19:48 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.56.8. * job.c (exec_command): Fixed what mode bits are checked. * remake.c (update_file_1): "No cmds and no deps actually changed" loses if ! FILE->is_target. * make.texinfo (Variables: Setting): Don't say that spaces after a variable definition are ignored (since they aren't). Mon Oct 23 14:34:23 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.56.7. * remake.c (update_file_1): If, after being updated, any dependency does not exist, remake the target. * remake.c (update_file_1): Always update if FILE has commands but no deps. * commands.c (execute_file_commands): If we return early because there are no commands, set FILE->updated. Thu Oct 19 18:47:37 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * arscan.c (ar_scan) [M_XENIX]: Don't run atoi or atol on the `struct ar_hdr' members that are int or long int on Xenix. Sat Oct 14 10:43:03 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * arscan.c (ar_scan): Cosmetic clean ups. (ar_name_equal): New function to compare names, handling truncated member names and special `.o' truncation. (ar_member_pos): Use ar_name_equal. * ar.c (ar_member_date_1): Use ar_name_equal. * Version 3.56.6. * file.h (struct file): Made `update_status' a `short int', and moved it before `command_state' so the bitfields can be packed better. * remake.c (files_remade): Made global. (notice_finished_file): Don't increment files_remade. * job.c (new_job): Do. * job.c (start_job): Don't return a value. Always set CHILD->file->command_state to either cs_running or cs_finished. (new_job, child_handler): Don't expect start_job to return a value. Instead, look at the file's command_state. * commands.c (chop_commands): Merged into job.c (new_job). * commands.h: Don't declare chop_commands. * job.c (start_job): Made static. (new_job): New function to create a `struct child' and call start_job. (free_child): New function to free a `struct child'. (child_handler, new_job): Call it. * job.h: Don't declare start_job. Do declare new_job. * commands.c (execute_file_commands): Call new_job. * commands.c (execute_file_commands): Don't set FILE->update_status if start_job fails. * function.c (expand_function): Don't use `reading_filename' and `reading_lineno_ptr' if they're nil. Fri Oct 13 18:16:00 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * read.c (find_semicolon): New function to look for an unquoted ; not preceded by an unquoted # in a string. (read_makefile): Call it before expanding the line. If it finds a ;, cut the line short there before expanding it. If not, call it again after expanding. * commands.c (execute_file_commands): Don't check FILE->command_state. We won't get called unless it's cs_not_started. * read.c (read_makefile): Call collapse_line on the variable-expanded rule line after checking for ; and #. * job.c (start_job): When there are no more commands, always return 0. * commands.c (execute_file_commands): Don't put the new child in the `children' chain unless FILE->command_state is cs_running. * read.c (read_makefile): Rewrote ;-handling to only do it once (why did I do it twice??) and to check for a # before the ;. * job.c (start_job): Set CHILD->file->update_status to 0 when we run out of commands. Set it to 1 before returning failure. (child_handler): Don't set C->file->update_status to 0 when start_job returns success and commands are not running. * read.c (read_makefile): If there is a # before the ; for commands, forget the ; and commands. Thu Oct 12 15:48:16 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * job.c (child_execute_job): Pass -c to the shell. Wed Oct 11 18:41:10 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.56.5. * main.c (define_makeflags): Cleaned up to keep better track of dashes written, etc. * function.c (expand_function: `shell'): When converting newlines to spaces in output, search with `index' calls rather than a simple loop. * main.c (main): Make sure stdout is line-buffered. * main.c (decode_switches): Always check for missing switch arg. Mon Oct 9 17:17:23 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.56.4. Sat Oct 7 00:32:25 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * commands.c (set_file_variables): #ifdef NO_ARCHIVES, still set $@ and $%. * commands.c (set_file_variables): Include a trailing slash in the directory variables (@D, etc.). * job.c (child_handler): Call notice_finished_file after changing a child's state to `cs_finished'. * remake.c (update_file_1): Don't call notice_finished_file if FILE->command_state == cs_finished. Wed Oct 4 16:09:33 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.56.3. Tue Oct 3 21:09:51 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * read.c (read_all_makefiles): When setting elements of MAKEFILES from the contents of read_makefiles, make sure we're using the right element. * dir.c, glob.c [USGr3 || DIRENT]: Don't define d_ino as d_fileno. * Version 3.56.2. * remake.c (update_file_1): Return zero after calling remake_file if FILE->command_state != cs_finished. Test update_status thoroughly. * commands.c (execute_file_commands): Don't call notice_finished_file. * remake.c (remake_file): Return immediately after calling execute_file_commands. Sat Sep 30 14:57:05 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.56.1 (alpha). * file.h (struct file): Made `update_status' not be a bitfield, since some broken compilers don't handle it right. * function.c (expand_function: `join'): Don't clobber the pointers and then try to free them. * job.c (exec_command): Fixed & vs = precedence problem. Thu Sep 28 17:29:56 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * remake.c (update_file_1): Fixed typo in debugging output. * remake.c (library_file_mtime): Search for /usr/local/lib/libLIB.a after /usr/lib/libLIB.a. Tue Sep 26 16:07:58 1989 Roland McGrath (mcgrath at helen.Berkeley.EDU) * read.c (conditional_line): For `ifeq (a, b)', swallow space after the comma. Sun Sep 24 13:25:32 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * function.c (patsubst_function): If BY_WORD and the match is not a full word, update the text pointer correctly. * function.c (expand_function: `word'): Don't lose track of the second arg's expansion and free something else instead. Fri Sep 22 16:15:29 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.56. Thu Sep 21 14:28:42 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * main.c (main): Make an array of the mtimes of the makefiles before updating them, and compare their file_mtimes against this later. Don't re-exec if a makefile was successfully updated but didn't change. If a makefile failed to be remade and no longer exists, die. If a makefile failed to be remade, but changed anyway, re-exec. If a makefile failed to be remade, but is unchanged, continue on. Wed Sep 20 18:02:07 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.55.6. * implicit.c (pattern_search): Maintain an array CHECK_LASTSLASH of the CHECK_LASTSLASH flag values used to match each member of TRYRULES. When making FILE->stem, if CHECKED_LASTSLASH[FOUNDRULE], prepend the part of FILENAME before LASTSLASH. Tue Sep 19 17:44:08 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * dir.c (dir_file_exists_p): Check for FILENAME being nil before checking for it being "". * main.c (define_makeflags): Fixed test for whether a flag/flag_off option was non-default. Also changed to generate a string that Unix Make will grok (except for FP/int values and new flags). * job.c (child_execute_job): Don't use the shell's -c option. Also fixed an off-by-one bug in the ARGV -> shell arg list copying. Mon Sep 18 15:17:31 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.55.5. * read.c (parse_file_seq): Check the beginning of the file name for a `./', not the two chars after the end of the name (Q rather than P). * job.c (child_execute_job): Include all of ARGV in the arg list for the shell. * main.c (define_makeflags): Don't include floating and positive_int options in !PF. * job.c (exec_command): Set the effective gid to the real gid before execing. * job.c (child_execute_job): Don't clobber the arg list when execing the shell. Sun Sep 17 15:27:19 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * main.c (define_makeflags): Moved all the checking inside the switch. * load.c [LDAV_BASED] (load_average): When we can't get the load average, return zero instead of running off the end. * file.c: Include variables.h. * job.c: Declare dup2 and {block,unblock}_remote_children. * file.h: Declare f_mtime. * job.c: Don't declare construct_command_argv, since job.h does. * function.c, main.c, load.c, remake.c: Include job.h. * load.c [LDAV_BASED] (load_average): Declare nlist. * variable.h: Declare print_file_variables. * job.c [!USG]: Don't declare sigsetmask. [!USG]: Declare getdtablesize. Don't declare load_average. Do declare wait_to_start_job. Declare vfork, gete[gu]id, execve. * commands.c: Declare remote_kill, getpid. * make.h: Declare kill, exit, sigblock, pipe, close, ctime, open, lseek, read. * make.h [not USG]: Declare sigsetmask. * job.h: Declare wait_for_children and {block,unblock}_children. * dir.c (dir_file_exists_p): If FILENAME is nil, read in the whole directory. (find_directory): When we want to read in the whole directory, call dir_file_exists_p with nil instead of "". * file.h (struct file), job.h (struct child), variable.h (struct variable): Use bitfields for flags. * make.h (ENUM_BITFIELD): If GCC or #ifdef ENUM_BITFIELDS, define as :BITS, else empty. * compatMakefile (defines): Document ENUM_BITFIELDS. Sat Sep 16 12:38:58 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.55.4 (alpha). * GNUmakefile (dist): Depend on default and doc. * load.c [LDAV_BASED]: Include rather than ; #ifdef NLIST_NAME_UNION, use n_un.n_name instead of n_name. * compatMakefile (LOAD_AVG): Document NLIST_NAME_UNION. * job.c [USG-ish]: Don't redefine WIF{SIGNALED,EXITED} if they're already defined. Fri Sep 15 13:59:42 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * glob.c, dir.c [USGr3 or DIRENT]: If neither d_ino, nor d_fileno is defined, define d_ino as d_fileno. Thu Sep 14 18:29:38 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * job.c: Don't declare exec_command static. * make.texinfo (Name Index): Changed title to include directives. * Version 3.55.3 (alpha). * make.texinfo (Running: Options): Document -e. * main.c (main): Always give imported environment variables origin `o_env'. * variable.c (define_variable_in_set): Under -e, if ORIGIN, or an existing variable's origin, is `o_env', make it `o_env_override'. * load.c: Use the symbol KERNEL_FILE_NAME instead of KERNEL_FILE. * compatMakefile: Changed the comment for `LOAD_AVG' accordingly. Thu Sep 7 16:46:26 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.55.2 (alpha). * variable.c (print_variable_set), rule.c (print_rule_data_base), file.c (print_file_data_base): If NO_FLOAT is defined, don't use floating-point for printing statistics. * compatMakefile (defines): Document NO_FLOAT. * make.h (HASH): New macro to add the hashing value of one char to a variable.c. * file.c (lookup_file, enter_file, rename_file): Use it. * dir.c (find_directory, dir_file_exists_p, file_impossible_p): Ditto. * variable.c (define_variable_in_set, lookup_variable): Same here. * variable.c, file.c, dir.c: Don't define *_BUCKETS if they are already defined. * compatMakefile (defines): Added comment about defining NO_ARCHIVES. (ARCHIVES, ARCHIVES_SRC): New variables for {ar,arscan}.[oc]. (objs, srcs): Use $(ARCHIVES) and $(ARCHIVES_SRC). * commands.c (set_file_variables), dir.c (file_exists_p), remake.c (touch_file, name_mtime), implicit.c (try_implicit_rule, pattern_search), make.h: If NO_ARCHIVES is #defined, don't do any archive stuff. * commands.c (set_file_variables): Don't kill the last char of directory names in $([@*<%?^]D). Wed Sep 6 15:23:11 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * default.c (default_terminal_rules {%:: %,v}, {%:: RCS/%,v}): Don't run co if the target exists. * glob.c (glob_match): [!xyz], rather than [^xyz], means none of [xyz]. * glob.c: Misc minor cosmetic changes. Tue Sep 5 14:49:56 1989 Roland McGrath (mcgrath at saffron.Berkeley.EDU) * load.c [LDAV_BASED] (load_average): Check for == -1, rather than < 0 to see if lseek fails. On some systems, `avenrun' is at an offset > (2**31)-1, and lseek succeeds, returning a negative value. Mon Sep 4 11:07:58 1989 Roland McGrath (mcgrath at saffron.Berkeley.EDU) * rule.c (new_pattern_rule): Return `int' instead of `void': nonzero if the passed rule was used, zero if not. (install_pattern_rule): Pay attention to the return from new_pattern_rule, and don't set the rule's `terminal' flag or give it commands unless it's used. (create_pattern_rule): Same idea. * dir.c (find_directory): Removed unused variable. * commands.c (execute_file_commands): Removed unused variable. * read.c (record_files): Don't use NAME after freeing it. Sat Sep 2 00:33:19 1989 Roland McGrath (mcgrath at saffron.Berkeley.EDU) * Version 3.55.1 (alpha). * function.c (string_glob): Don't add spaces after file names that aren't added. (Also means don't add spaces without checking the size of the buffer.) * remake.c (update_goal_chain): Don't remove makefiles with cmds and no deps from the chain. * main.c (main): Do it here, before calling update_goal_chain. * remake.c (update_goal_chain): When updating fails, change STATUS even if MAKEFILES is set. Also stop remaking when updating fails if not under -k and MAKEFILES is not set. * remake.c (remake_file, update_file_1, notice_finished_file), commands.c (execute_file_commands), make.h, commands.h: The functions remake_file, notice_finished_file, and execute_file_commands no longer return values, and their callers no longer expect values returned. * remake.c (notice_finished_file): Don't set FILE's modtime to now if it is a non-target with no commands. Fri Sep 1 00:04:39 1989 Roland McGrath (mcgrath at saffron.Berkeley.EDU) * read.c (read_all_makefiles): After freeing each element on MAKEFILES, replace it with the name stored in read_makefiles by read_makefile. * remake.c (update_file_1): Don't decide not to remake if FILE has no cmds and no deps actually changed if FILE doesn't have any deps. * file.c (remove_intermediate): Remove precious files that also have the `dontcare' flag set. * remake.c (update_file_1): Don't always remake if FILE has cmds but no deps; only if FILE is double-colon. (I don't know why this should be done for double-colon targets, but that's what Unix make does.) * load.c [LDAV_BASED] (load_average): Write error messages if the various system calls fail. Keep track of if we've failed before. The first time we fail, write a message saying -l won't be enforced. The first time we succeed after having failed, write a message saying -l will be enforced again. * remake.c [USG]: Don't #include * load.c [generic Unix LDAV_BASED]: #include #ifdef USG, else instead. * job.c [USG && !USGr3 && !HAVE_DUP2]: Remove redundant #include and declaration of `errno'. [...] (dup2): Fixed so it won't always lose. * default.c (default_suffix_rules: .texinfo.dvi): Copy, rather than move, the aux and index files, so the TeX run can use them. * compatMakefile: Remove redundant comment. * load.c [generic Unix LDAV_BASED]: Include instead of , since the `struct nlist' declaration in varies more than the one in . (load_average): Use the `n_un.n_name' field of the `struct nlist', since the declaration uses the union. * main.c (main): For the temporary files made for stdin makefiles, set the `intermediate' and `dontcare' flags. * file.c (remove_intermediates): Don't print any messages for files whose `dontcare' flag is set. (The only files that will be intermediate and `dontcare' will be the temporary files made for stdin makefiles.) * job.c (exec_command): Made global. * job.h: Declare it. * main.c (main): Use exec_command when re-execing. * make.h: Declare environ. * make.c: Don't. * job.c (child_execute_job): New function to perform everything done in the child side of a fork (for a job or `shell' function). (start_job): Call it. * job.h: Declare construct_command_argv and child_execute_job. * function.c (expand_function: `shell'): Use child_execute_job. Thu Aug 31 18:42:51 1989 Roland McGrath (mcgrath at saffron.Berkeley.EDU) * function.c (expand_function: `shell'): Remove a trailing newline instead of turning it into a space. * main.c (main): Do init_siglist #ifdef HAVE_SIGLIST. * job.c [WTERMSIG || (USG && !HAVE_SYS_WAIT)]: Test each W* macro separately and define all those that aren't defined. Sat Aug 26 15:13:21 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * ar.c (ar_name): Return zero for `(foo)'. * Version 3.55. * make.texinfo (Rules: Multiple Targets): Make this node's `next' pointer point to `Static Pattern'. * make.texinfo (Makefiles: MAKEFILES Variable): Make this node's `prev' pointer point to `Makefile Names'. * make.1: Renamed to make.man. * compatMakefile: Define `mandir' and `manext'. (install): Depend on $(mandir)/make.$(manext). ($(mandir)/make.$(manext)): Depend on make.man and copy it to $@. ($(bindir)/make): Use `make' rather than $<; so Unix make can grok it. Thu Aug 24 03:35:48 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * variable.c (target_environment): Allow variables that start with underscores. Wed Aug 23 22:50:32 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * variable.c (target_environment): Reject variables that don't start with letters. Tue Aug 22 04:14:29 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * GNUmakefile (make-$(version).tar.Z): Put make.1 (the Unix manual page) in the tar file. * variable.c (target_environment): Don't write variables with origin o_default (i.e., ones from default.c). * make.texinfo (Commands: Recursion: Variables/Recursion): Document that default variables are not put in the environment. * remake.c (update_file_1): Remake all targets with commands but no deps. Sat Aug 19 06:03:16 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * remake.c (update_file_1): In the final loop, set the deps' `changed' members if they are newer than FILE. * remake.c (update_goal_chain): Under -d, print a message if we decide not to remake a makefile so as to avoid a possible infinite loop. Fri Aug 18 20:30:14 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * remake.c (remake_file): Cleaned up. * commands.c (execute_file_commands): If the commands are empty, set FILE->update_status to zero before returning. * remake.c (notice_finished_file): Set `last_mtime' fields to zero instead of calling name_mtime; file_mtime will do that later if anybody cares. Thu Aug 17 10:01:11 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * make.texinfo (Rules: Wildcards: Wildcard Examples): Give this node a `prev' pointer. * Version 3.54.9 (alpha). * make.texinfo: Fixed some @nodes. * remake.c (check_dep): Don't set *MUST_MAKE_PTR if FILE doesn't exist after running update_file. * remake.c (notice_finished_file): If FILE has no commands, pretend its modtime is now. * remake.c (update_file_1): In the loops that call update_file on the deps, compare modtimes before and after (unless deps are still being made) and set the deps' `changed' members. Do not set the `changed' members in the loop that prints the newer/older debugging messages. * remake.c (update_file_1): If no deps changed and FILE has no commands, decide it doesn't need remaking. * remake.c (update_file_1): Print a debugging message if we take commands from default_file. * make.texinfo (Rules: Directory Search: Selective Search): Removed note about warning for `vpath' with a constant pathname, since it isn't warned about anymore. * remake.c (update_goal_chain): If MAKEFILES, remove makefiles which are targets and have no deps. * make.texinfo (Makefiles: Remaking Makefiles): Document that makefiles will not be remade if they are targets but have no dependencies. Tue Aug 15 00:00:08 1989 Roland McGrath (roland at apple-gunkies.ai.mit.edu) * remake.c (notice_finished_file): Increment files_remade for non-phony files if they didn't exist before (even if they still don't). * job.c: Include and declare errno. * job.c (exec_command): If the execve fails with ENOEXEC (Exec format error), return instead of exiting the child process. * job.c (start_job): In the child side, if exec_command fails, try using the shell. * job.c (start_job): In the child side, call unblock_children instead of sigsetmask. * remake.c (notice_finished_file): Under -n or -q, always increment files_remade for non-phony files. * rule.c (intall_pattern_rule): Use find_percent. * vpath.c (vpath_search): Pass the `percent' members to pattern_matches. Mon Aug 14 23:30:24 1989 Roland McGrath (roland at apple-gunkies.ai.mit.edu) * vpath.c (struct vpath): New member `percent', to hold a pointer into the pattern where the % is. (construct_vpath_list): Call find_percent on the pattern and set the new `percent' member. * read.c (read_makefile): Don't run find_percent on `vpath' directive patterns. * function.c (pattern_matches): Take new arg PERCENT, a pointer into PATTERN where the % is. If PERCENT is nil, copy PATTERN into local space and run find_percent on it. (expand_function: `filter', `filter-out'): Pass new arg to pattern_matches. * read.c (record_files): Pass PATTERN_PERCENT to pattern_matches for static pattern rules. Save the percent pointer into implicit rule targets, and pass them to create_pattern_rule. * rule.c (convert_to_pattern): Pass new arg to create_pattern_rule. (create_pattern_rule): Take new arg TARGET_PERCENTS, nil or an array of pointers into the corresponding elements of TARGETS, where the %s are. Sun Aug 13 00:29:19 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * Version 3.54.8. * README.templatate, README-doc.template: New files, turned into README and README-doc to go into the two distribution tar files. * GNUmakefile: Added a rule to edit the version number in README.template and README-doc.template, producing README and README-doc. * remake.c (update_goal_chain): If -n or -q is in effect for a makefile, and it got updated, don't change STATUS, so we can still return -1 (meaning nothing was done). This avoids an infinite loop on "make -n Makefile". Sat Aug 12 23:14:24 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * remake.c (notice_finished_file): Treat -q the same as -n. * remake.c (update_goal_chain): Fixed handling of return from update_file. If -n or -q is in effect, ignore it. * job.c (start_job): Don't test for -t. We should never get called in that case. Fri Aug 11 04:09:14 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * function.c (expand_function): Removed unused variables. (handle_function): Removed unused variable. * main.c (main): Removed unused variable. Wed Aug 9 09:37:10 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * Version 3.54.7. * remake.c (notice_finished_file): If FILE's modtime actually changed, increment files_remade. (remake_file): Don't increment files_remade. * remake.c (update_file): Don't print "up to date" messages for phony files. * job.c (child_handler): Don't set C->file->update_status to 1 if start_job returns nonzero under -n or -t. * expand.c (variable_expand): Count parens in $(foo:a=b) refs. * main.c: Removed old declaration of `glob_tilde' (which hasn't existed for a few months). Tue Aug 8 23:53:43 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * job.c (exec_command): Fixed to not ignore the last path component and to do the right thing with an empty path. Fri Aug 4 15:58:19 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * remake.c (library_file_mtime): Look for libLIB.a, not /libLIB.a. Do VPATH search on libLIB.a, not /usr/lib/libLIB.a Thu Aug 3 20:42:00 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * job.c [HAVE_SYS_WAIT or not USG]: If WIFSIGNALED is not defined by , define it as (WTERMSIG != 0). Tue Aug 1 19:25:34 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * remake.c (remake_file): If FILE has no commands and is a target, don't set its time to now. The time gets reset by notice_finished_file anyway, and it isn't needed since check_dep checks for nonexistence. * Version 3.54.6. * read.c (read_makefile): Don't read off the end of the string after an `include'. * job.c (exec_command): New function to search the path for a file and execute it. (start_job): Use exec_command rather than execvp. * read.c (read_makefile): Expand `include' directive args before parsing them. Allow trailing whitespace after filename. * variable.c (target_environment): Put makelevel + 1, rather than makelevel, in the `MAKELEVEL' envariable. Sat Jul 29 10:27:04 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * remake.c (notice_finished_file): Don't get the new modtime of phony files. * remake.c (remake_file): Run commands instead of touching under -t if FILE->cmds->any_recurse is set. * commands.h (struct commands): Add new member `any_recurse', to be set nonzero if any `lines_recurse' element is nonzero. * commands.c (chop_commands): Set the `any_recurse' member. * commands.c (execute_file_commands): Split chopping of commands into lines into new function chop_commands. * commands.h: Declare chop_commands. * read.c (read_makefile): Test for a line beginning with a tab after checking for conditional lines, but before all other checks. Fri Jul 28 18:10:29 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * read.c (read_makefile): Match directives against collapsed line and use that for their args. * read.c (read_makefile): Warn about extra text after `include'. Tue Jul 25 14:34:25 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * make.texinfo (Rules: Directory Search: Selective Search): Fixed example to use correct `vpath' syntax. Mon Jul 24 12:10:58 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * Version 3.54.5. * job.c (start_job): In the child side, unblock SIGCHLD. Fri Jul 21 18:25:59 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * make.h: Don't include #ifdef sun. Mon Jul 17 14:29:10 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * implicit.c (pattern_search): If ar_name (FILENAME), don't check for directory names. * job.c (wait_for_children): Changed "waiting for children" message to "waiting for unfinished jobs". Fri Jul 14 13:17:13 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * load.c (load_average): Use an unsigned offset into kmem. Thu Jul 13 18:44:49 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * variable.c (pop_variable_scope): Don't free the head of the chain of variables in each bucket twice. Tue Jul 11 06:45:24 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * GNUmakefile: Include COPYING in the doc tar file. * variable.c, read.c, misc.c, job.c, function.c: Replace some identical "for" loops with next_token or end_of_token calls. Mon Jul 10 16:55:08 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * Version 3.54.4. * compatMakefile: Documented new conditionals. * job.c: Don't define sys_siglist if HAVE_SIGLIST is defined. Don't define dup2 if HAVE_DUP2 is defined. * job.c (child_handler): Interpret the return from start_job correctly. * remake.c (update_file_1): Don't write "target not remade because of errors" message under -n or -q. * read.c: Declare getpwnam. * glob.c: Use if DIRENT is defined. [USG]: Don't declare memcpy, since does. Fri Jul 7 20:53:13 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * misc.c (collapse_line): Copy the line over in the right place. Fri Jul 7 18:33:24 1989 Roland McGrath (fsf at void.ai.mit.edu) * remake.c: Conditionalize inclusion of on not USG, since HP-UX defines a `struct file' there. Fri Jul 7 12:11:30 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * job.c: If WTERMSIG is defined by , define WAIT_T as int, and don't define other macros; this covers HP-UX. If WTERMSIG is not defined, use int or union wait based on USG and HAVE_SYS_WAIT; this covers BSD and SysV. * Version 3.54.3 (alpha). * job.c [USG and not USGr3]: Include and declare errno. * job.c (unblock_children [USG]): Declare child_handler. * job.c: Renamed WRETCODE to WEXITSTATUS. [HAVE_SYS_WAIT or not USG]: Undefine WTERMSIG, WCOREDUMP, and WEXITSTATUS before defining them. The HP-UX defines them. * main.c (main): If there are no goals, fatal AFTER printing the data base under -p. Thu Jul 6 22:43:33 1989 Roland McGrath (roland at apple-gunkies.ai.mit.edu) * glob.c [USG]: #define rindex as strrchr. * job.c [USG]: Include and #define getdtablesize() as NOFILE. Wed Jul 5 09:36:00 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * Version 3.54.2 (alpha). * expand.c (variable_expand): When expanding recursive variable references (${${a}}), use the correct delimiters in the constructed variable reference. Mon Jul 3 18:29:26 1989 Roland McGrath (roland at apple-gunkies.ai.mit.edu) * compatMakefile: Clear out and redefine the .SUFFIXES list because silly Sun 4 make defines .cps.h. * compatMakefile: Fix comment about -DNO_MINUS_C_MINUS_O. * remake.c: Include for O_* on 4.2. * commands.c: Define sigmask if it's not defined. Fri Jun 30 07:33:08 1989 Roland McGrath (roland at apple-gunkies.ai.mit.edu) * remake.c (remake_file): Don't always increment files_remade. * variable.c (push_new_variable_scope): Zero the new variable hash table. Thu Jun 29 17:14:32 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * expand.c (variable_expand): When terminating the variable expansion buffer, use variable_buffer_output instead of a simply zero store, because the buffer may need to be enlarged. Wed Jun 28 16:53:47 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * Version 3.54. * default.c (default_suffixes): Added `.ln'. (default_suffix_rules): Changed lint rules to use -C. Thu Jun 22 20:49:35 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * job.c (start_job): Set `environ' to CHILD->environment before execing in the child process! Tue Jun 20 17:23:13 1989 Roland McGrath (roland at spiff.ai.mit.edu) * compatMakefile: Put job.h and rule.h in `srcs'. * Version 3.53. Mon Jun 19 16:25:18 1989 Roland McGrath (roland at spiff.ai.mit.edu) * job.c (start_job): If there are no more commands, return nonzero under -n or -t. * compatMakefile (make): Pass `-f' to mv. * GNUmakefile: If `ARCH' or `machine' is defined, make $(ARCH)/*.o and $(ARCH)/make instead of *.o and make. * function.c (string_glob): Don't try to use freed storage! * read.c (readline): If there is only one byte of space in the buffer, enlarge the buffer before reading more. * arscan.c [M_XENIX]: Miscellaneous minor changes for Xenix. Sun Jun 18 13:07:45 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * GNUmakefile (depend): Split commands into two lines so they won't be so long when variable-expanded. * compatMakefile: Documented MINUS_C_MINUS_O meaning. The line describing it got removed when the USG/wait stuff was documented. Sat Jun 17 22:56:54 1989 Roland McGrath (roland at hobbes.ai.mit.edu) * Version 3.52. Mon Jun 12 17:45:11 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * remake.c (check_dep): Drop circular dependencies instead of fataling. (update_file_1 already does this.) * default.c (default_suffix_rules): For .s -> .o, put the -o flag to the assembler before the source file name. Sun Jun 11 12:00:52 1989 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.51. * make.texinfo (Features): Noted 1003.2 requirement of `+' meaning. * file.c (remove_intermediates): If !SIG, write a single "rm" command line, listing all files. * read.c (read_makefile): Don't free the storage for the passed filename, since it might not be malloc'd. When doing an included makefile, free the name's storage. (read_all_makefiles): Use variable_expand to find the value of `MAKEFILES'. Free the storage for the names of -f makefiles. (read_makefile): Allocate storage for the makefile name in the `struct file' in read_makefiles. * make.texinfo (Running: Instead of Execution): Document the effect of + and $(MAKE)/${MAKE}. * make.texinfo (Functions: Foreach Function): Document that if the iteration variable was undefined before the `foreach' call, it will be undefined after the call. * commands.c: Split into commands.c, job.h, and job.c. * rule.c (try_implicit_rule, pattern_search): Moved to new file implicit.c. * rule.c: Split into rule.h, rule.c, and default.c. * default.c (install_default_pattern_rules): Renamed to install_default_implicit_rules. * make.h, main.c (main): Renamed uses. * make.c: Renamed to misc.c. * make.c (main, log_working_directory, decode_switches, decode_env_switches, define_makeflags, die, print_version, print_data_base): Moved to new file main.c. * commands.c (execute_file_commands): Don't collapse backslash-newlines here. When chopping the commands up into lines, don't chop at backslash-newlines. (start_job): Collapse backslash-newlines after printing the line. * commands.c (start_job): Don't collapse backslash-newlines here. (execute_file_commands): Collapse backslash-newlines before chopping the commands up into lines. * commands.c (set_file_variables): Initialize the length counters for $^ and $? to zero! * commands.c (start_job): Use vfork instead of fork. Someone else says the child and parent DO have separate file descriptors. * variable.c: Split internals into variable.c, function expansion into function.c, and variable expansion into expand.c. * function.c (handle_function): New function to check for a function invocation and expand it. * expand.c (variable_expand): Use handle_function. * variable.c (push_new_variable_scope): New function to push a new empty variable set onto the current setlist. (pop_variable_scope): New function to pop the topmost set from the current setlist and free its storage. * function.c (expand_function: `foreach'): Push a new variable scope for the iteration variable and pop the scope when finished. * variable.h: Declare new functions. * variable.c (initialize_variable_output): New function to return a pointer to the beginning of the output buffer. (save_variable_output): New function to save the variable output state. (restore_variable_output): New function to restore it. * expand.c (variable_expand): Use initialize_variable_output. (allocated_variable_expand): Use {save,restore}_variable_output. * variable.c (current_setlist): Renamed to current_variable_set_list and made global. Sat Jun 10 00:11:25 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * remake.c (library_file_mtime): Check for libNAME.a in the current directory before doing VPATH search. * variable.c (print_variable_set): Don't write "# Variables", and write fewer blank lines. (print_variable_data_base): Precede the variables with "# Variables". * make.c (main): Print the data base under -p after doing everything else, just before exitting. This way it gets info determined in updating the goal targets. * variable.c (print_variable_data_base): Split into print_variable, which prints one variable, and print_variable_set, which prints a set. Replaced with a call to print_variable_set for the global set. (print_file_variables): New function to print a given file's local variables. * file.c (print_file_data_base): Call print_file_variables to print each file's local variables. * commands.c (set_file_variables): Actually define the values for the $^ and $? variables!!! * make.texinfo (Implicit: Pattern Rules: Automatic): Document new D and F versions of $^ and $?. * commands.c (start_job): In the child fork, use getdtablesize and a loop to close all file descriptors other than 0, 1, and 2. We need to do this since not only the bad stdin pipe, but also some directories, may be open. * commands.c (start_job): Use fork instead of vfork, because a vfork parent and child share file descriptors, and our child needs to diddle with stdin. * variable.c (initialize_file_variables): When created a new variable set, zero out the hash table. * variable.c (target_environment): Don't use variables whose names are not made up of alphanumerics and underscores. * remake.c (update_file_1): Set the `parent' member of each dependency to FILE before updating it. * file.h (struct file): Add `parent' member. * variable.c (initialize_file_variables): Don't take second arg PARENT. Use FILE->parent instead. If FILE->parent->variables is nil, recurse to initialize it. * variable.h: Declare {allocated_}variable_expand_for_file. * variable.c (allocated_variable_expand): Now allocated_variable_expand_for_file, calling variable_expand_for_file, and taking second arg FILE. (allocated_variable_expand): New function, a wrapper around allocated_variable_expand_for_file, passing a nil second arg. Fri Jun 9 12:11:45 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * commands.c (start_job): On the child side of the fork, always close the bad stdin file descriptor. * commands.c (struct child): New member `environment', to hold the environment for the child. (execute_file_commands): Set the new childs `environment' member to nil before calling start_job. (start_job): Set up CHILD->environment before running the commands if it is nil. * make.c (main): Don't call new_environ. `shell' functions will now be run with the environment make was called with. * commands.c (child_handler): Don't check C->command_ptr before calling start_job since we now have to check C->file->cmds->command_lines and it's easier to let start_job handle all that. * commands.c (struct child): New member `command_line', to hold an index into file->cmds->command_lines. (execute_file_commands): Set the new child's `command_line' to 0 and its `commands' and `commands_ptr' to nil. (start_job): When CHILD->command_ptr runs out, increment CHILD->command_line and run the corresponding line from CHILD->file->cmds->command_lines. Run it even under -t, -q, or -n if the CHILD->file->cmds->lines_recurse element for that line is set. * commands.c (execute_file_commands): Chop CMDS up into lines, setting its `command_lines' and `lines_recurse' members, if it wasn't already chopped. * commands.h (struct commands): New members `command_lines' and `lines_recurse'. The first is an array of chopped-up lines; the second is an array of flags, each nonzero if the corresponding line is recursive. * variable.c (variable_expand_for_file): If FILE is nil, just do a vanilla variable_expand. (expand_function: `shell'): Pass second arg (as nil) to construct_command_argv. * commands.c (construct_command_argv): Use variable_expand_for_file on `$(SHELL)' and `$(IFS)' instead of lookup_variable to check those variables. This handles file-local and recursive values correctly. To support this, take an additional argument FILE. * variable.c (initialize_file_variables): New function to initialize FILE's variable set list from PARENT's setlist. PARENT is the immediate dependent that caused FILE to be remade, or nil if FILE is a goal. (When user-level per-file variables are implemented, PARENT should be passed as nil when defining per-file variables.) * variable.c (variable_expand_for_file): New function to expand a line using the variable set of a given file, and reporting error messages for the file and line number of that file's commands. * variable.h: Don't declare lookup_variable_for_file. * variable.c (lookup_variable_*): Turned back into lookup_variable. It now uses current_setlist. (global_setlist): New static `struct variable_set_list', a setlist containing global_variable_set. (current_setlist): New static `struct variable_set_list *', a pointer to the current variable set list. (define_variable): Define in the current top-level set, not the global set. * commands.c (set_file_variables): New function to set up the automatic variables for a file in its own variable set. (execute_file_commands): Use set_file_variables. * variable.c (new_environ): Replaced with target_environment, taking an argument FILE, and returning an environment for FILE's commands. * variable.c, variable.h: Remove all global special variable pointers. * variable.c (define_variable_for_file): New function like define_variable, but takes additional arg FILE, and defines the variable in the variable set at the top of FILE's chain. (lookup_variable_for_file): New function like lookup_variable, but takes additional arg FILE, and looks the variable up in all of FILE's variable sets. * file.h (struct file): New member `variables', a `struct variable_set_list' containing the list of variable sets used in the expansion of the file's commands. * variable.c (variables): Replaced with static `struct variable_set' global_variable_set. (define_variable): Now define_variable_in_set, taking additional argument SET, the `struct variable_set' to define it in. (define_variable): Use define_variable_in_set with global_variable_set. (lookup_variable): Now lookup_variable_in_set, taking additional argument SET, the `struct variable_set' to look it up in. (lookup_variable): Use lookup_variable_in_set with global_variable_set. (lookup_variable_in_setlist): New function to look up a variable in a `struct variable_set_list' using lookup_variable_in_set. * variable.h (struct variable_set): New structure, containing a hash table and the number of hash buckets. (struct variable_set_list): New structure, containing a link for a linked-list, and a `struct variable_set'. * commands.c (start_job): Under -n, return what the recursive start_job call returns, since it might actually start a child. * make.texinfo (Rules: Wildcards): Document ~ and ~USER expansion. * commands.c (execute_file_commands): If start_job returns failure, but -t is set, set FILE->update_status to success. (start_job): If -t is set, and the commands are not recursive, return failure (is is done for -q). * remake.c (touch_file): New function to touch FILE. (remake_file): Use touch_file. When touching a file, still do execute_file_commands. * remake.c (remake_file): Don't check question_flag (-q), since we can't know here if the commands are recursive. * commands.c (start_job): Don't use the `recursive' member of CHILD->file->cmds. Instead, check for leading +s and $(MAKE) or ${MAKE} in the command line here. * commands.h (struct commands): Remove `recursive' member. * rule.c (install_default_pattern_rules): Remove use of `recursive' member. * read.c (record_files): Don't check commands from $(MAKE) and set their `recursive' member. * commands.c (fatal_error_signal): Treat SIGQUIT like SIGINT, SIGHUP, and SIGTERM, but don't send it to ourselves because it will cause a core dump. Thu Jun 8 20:30:04 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.50. * variable.c (variable_expand): Use allocated_variable_expand instead of expand_argument in a few places. * variable.c (allocated_variable_expand): Do static variable shuffling here instead of using expand_argument. (expand_argument): Use allocated_variable_expand. * variable.c (recursively_expand): New function to recursively expand its argument (a `struct variable'), returning the malloc'd value. (variable_expand): Use recursively_expand. Sun May 28 12:49:27 1989 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.c (main): Fixed buggy fix in deciding to increase space for command-line variable definitions. (First it never did it, then it always did it; now it does it when necessary.) Sat May 27 14:01:54 1989 Roland McGrath (mcgrath at hecuba.Berkeley.EDU) * make.c (main): Fixed bug in deciding to increase space for command-line variable definitions. Fri May 26 15:48:01 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * read.c (multi_glob): Use allocated_expand_variable for checking `HOME' variable for ~ expansion, since this may be called from inside a `wildcard' function expansion. * variable.h: Declare allocated_expand_variable. * variable.c (allocated_expand_variable): New function to do variable expansion in an allocated buffer, rather than the static one. * make.c (main): Don't set glob_tilde (it no longer exists). * variable.c (string_glob): Use multi_glob and parse_file_seq. * read.c (multi_glob): Do ~ expansion here. * glob.c (glob_tilde, glob_filename): Removed ~ expansion. * variable.c (define_variable, lookup_variable): Use a smarter hashing algorithm (the same one used for files and directories). (VARIABLE_BUCKETS): Increased to 523. * file.c (enter_file, lookup_file, rename_file): Use a smarter hashing algorithm, spreading the bits about somewhat. * make.c (log_working_directory): Under `-p', precede the directory message with a `#'. * make.c (print_version): Under `-p', precede each line with a `#'. (print_data_base): Precede the header line with a `#' and include the date and time on it. * vpath.c (print_vpath_data_base): Precede non-directive lines with `#'s. * commands.c (print_commands): Precede the non-command line with a `#'. * rule.c (print_rule_data_base), file.c (print_file_data_base): Precede non-rule lines with `#'s. * dir.c (print_dir_data_base): Precede all lines with `#'s. * variable.c (print_variable_data_base): Changed format so that it can be makefile input. Lines that are not variable definitions are preceded with `#'. Nonrecursive variable definitions are made with all dollar signs doubled to reproduce the initial value. Recursive variable definitions containing newlines are done with `define' directives. Nonrecursive variable definitions containing newlines, and variable names containing :, =, or newlines, will come out garbled. Wed May 24 00:20:04 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.49. Tue May 23 19:18:00 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * variable.c (expand_function: `filter'/`filter-out'): Use find_percent instead of pattern_p. * variable.c (expand_function: `patsubst'): Pass new args (both nil) to patsubst_expand. (variable_expand): For $(var:pat%=rep%) references, pass new args to patsubst_expand so as to avoid find_percent and thus disallow quoting the %s. * read.c (record_files): Pass new args to patsubst_expand. * variable.c (patsubst_expand): Take two new args: PATTERN_PERCENT and REPLACE_PERCENT. Each of these, if non-nil, means that PATTERN (or REPLACE) has already been run through find_percent, and PATTERN_PERCENT (or REPLACE_PERCENT) is the result. * make.h: Declare find_percent instead of pattern_p. * read.c (pattern_p): Changed to find_percent, returning a pointer to the %, or nil if there is none. (record_files): Take another arg, PATTERN_PERCENT, a pointer to the % in PATTERN. (read_makefile): Pass PATTERN_PERCENT to record_files. * make.texinfo (Rules: Static Pattern: Static Usage, Rules: Directory Search: Selective Search, Functions: Text Functions): Documented that `%' can be quoted. * variable.c (expand_function: `filter'/`filter-out'): Use pattern_p to allow quoted %s in patterns. * variable.c (patsubst_expand): Use pattern_p on PATTERN and REPLACE to allow quoted %s. Quoting backslashes are removed from REPLACE even if PATTERN contains no unquoted %. * read.c (pattern_p): Made global. * make.h: Declare pattern_p. * read.c (pattern_p): New function to search for an unquoted % in a string. Backslashes quote %s and backslashes. Quoting backslashes are removed from the string by compacting it into itself. Returns nonzero if an unquoted % was found, zero if not. (record_files): Use pattern_p to check for implicit rules. (read_makefile): Use pattern_p to check for static pattern rules. Also use it to allow quoted %s in `vpath' patterns; warn about `vpath' patterns with no %s. Mon May 22 16:31:52 1989 Roland McGrath (mcgrath at tully.Berkeley.EDU) * glob.c (glob_filename): Replace a `1' with the `l' that should have been there. This incidentally stops it from dumping core. * glob.c (glob_filename): If the path is just a directory, with no file name pattern, return the directory alone. * glob.c (glob_tilde): New global variable (int), defaults to zero. (glob_filename): If glob_tilde is nonzero, expand ~ or ~USER. * variable.c (string_glob): Keep a static allocated buffer for file names taken from the list, instead of allocating and freeing one every time. Fri May 19 18:06:26 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * make.c (decode_switches): Get floating numbers from the right string. Sun May 14 13:48:04 1989 Roland McGrath (mcgrath at homer.Berkeley.EDU) * commands.c (delete_child_targets): When deleting `also_make' files, include the target's name in the message: make: *** [foo] Deleting file `bar' Sat May 13 17:34:26 1989 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.c (max_load_average, default_load_average): Default to -1. * load.c (wait_to_start_job): Return if max_load_average is < 0.0, not equal. Fri May 12 16:08:05 1989 Roland McGrath (mcgrath at homer.Berkeley.EDU) * variable.c (variable_buffer_output): Don't try to do pointer arithmetic between objects not in the same array. Wed May 10 15:55:29 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * rule.c [M_XENIX] (default_suffix_rules, default_variables): Minor changes to allow for strange compiler syntax. * rule.c (default_variables): Don't include "> $@" in $(PREPROCESS.S), since it's already in the .S.s rule. * file.c (enter_file): Make a new double-colon file the `prev' member of the bottom `prev' file (the one whose `prev' is nil). * read.c (do_define): Append newlines after copying the lines into the value buffer, so we end up with a trailing newline. * make.c (print_version): If the global variable `remote_description' is not nil or "", append "-%s" (its value) to the version number. * remote-*.c: Define remote_description appropriately. Sun May 7 15:15:53 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * commands.c (error_status): Converted to new function child_error, taking new arguments TARGET_NAME and IGNORED, and writing an error message: "*** [target] Error 1" (or signal #, etc.), appending " (ignored)" if IGNORED is nonzero. (child_handler): Use child_error instead of error_status. * compatMakefile (all): Don't depend on `doc'. * compatMakefile (clean): Don't remove make-info*. (realclean): New rule, depends on `clean', removes tags, TAGS, and all Info and TeX files. Thu May 4 17:00:46 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * variable.c (print_variable_data_base), file.c (print_file_data_base), rule.c (print_rule_data_base), Use floating-point for averages and percentages. * make.c (print_data_base): Print messages before and after the data base information. * commands.c (print_commands): Changed output format to separate lines in commands and prefix them with tabs. * dir.c (print_dir_data_base): Changed output format slightly. * vpath.c (struct vpath, construct_vpath_list, selective_vpath_search): Remove the `exists' member and its uses. * vpath.c (print_vpath_data_base): New function to print all selective and general VPATH search paths (for -p). * make.c (print_data_base): Call print_vpath_data_base. * file.c (print_file_data_base): Changed format to look more like a makefile rule. Now reports all information in the `struct file'. * rule.c (print_rule_data_base): Changed format of display from: %: (terminal) depends on: RCS/%,v to: %: RCS/%,v is terminal. references nonexistent subdirectory. Also include number and percent that refer to nonexistent subdirectories. Thu Apr 27 15:45:40 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * make.c (main): Figure out the level of recursion before writing the `Entering directory' message. * variable.c (define_automatic_variables): Don't figure out the level of recursion from `MAKELEVEL'. It's now done in main. * Version 3.48. Wed Apr 26 16:39:17 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * commands.c (child_handler): Set `update_status' to zero when there are no more commands. * make.c (log_working_directory): If MAKELEVEL > 0, indicate the recurson in the message (make[1]: ...). * commands.c (child_handler): Change status to `cs_finished' when commands fail. * commands.c (start_job): Return 0 (success) if there were no more commands for the child. (child_handler): Change the status to `cs_finished' when start_job fails to start the commands. * make.c (main): Don't handle SIGEMT if it's not defined. Do handle SIGDANGER if it is defined. * commands.c (child_handler): Reorganized inner loop so that it doesn't try to inspect the child before finding it. Tue Apr 25 16:28:24 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * make.c (end_of_token): Fixed bug wherein backslashes caused immediate return. * Version 3.47. * make.texinfo (Implicit: Pattern Rules: Automatic): Document setting of `$*' for explicit rules. Add note clarifying that automatic variables, though referred to in the documentation as `$<', etc. are no different than `$(<)', etc. Fri Apr 21 18:00:12 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * file.c (enter_file): Don't strip leading `./'s. * read.c (parse_file_seq): Strip leading `./'s. Thu Apr 13 17:26:41 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * make.texinfo (Commands: Parallel, Running: Options): Document that -l with no argument removes a previous load limit. * make.c (struct command_switch): New member `default_value'. (default_job_slots): Default value (of 1) for -j. (default_load_average): Default value (of 0, unlimited) for -l. (command_switches): Use default values for -j and -l. Also, -l without an arg now means no load limit. (define_makeflags): Don't write positive_int or floating options whose values are their defaults. * make.c (main): Under -w, write a `Leaving directory' message before re-execing. Tue Apr 11 16:46:29 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.46. * Makefile: Provide an easy place for system-specific definitions (-DUSG, etc.) and extra object files (for whatever). * make.texinfo: Miscellaneous fixes from RMS. Mon Apr 10 19:31:34 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * rule.c (pattern_search): Put rules with `subdir' flags set in TRYRULES, since these might be valid with VPATHs. In the TRYRULES loop, don't do lookup_file or file_exists_p calls for dependencies of rules with `subdir' flags set, but still do vpath_search calls and intermediate-file searches. Thu Apr 6 16:33:00 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * make.texinfo (Implicit: Pattern Rules: Automatic): Document the new definition of $* for explicit rules. * commands.c (execute_file_commands): If FILE->stem is nil, figure out if FILE->name ends in a suffix in the .SUFFIXES list; if so, store the name sans suffix in FILE->stem (and $*). Wed Apr 5 15:24:48 1989 Roland McGrath (mcgrath at helen.Berkeley.EDU) * file.c (remove_intermediates): Don't use `file_exists_p' to check for the existence of intermediate files, because the hashed directories will probably be out of date. * commands.c (child_handler): Free the good stdin before running the next command line. * commands.c [USG] (init_siglist): Don't case SIGEMT if it's not defined. Do case SIGDANGER (for IBM RT) if it is defined. * commands.c: Changed `SYS_WAIT' to `HAVE_SYS_WAIT'. (child_handler): Use `wait3' if HAVE_SYS_WAIT is #defined. * file.c (enter_file): If any `./'s are stripped off, allocate a new copy of the shortened name. * rule.c (pattern_search): Allocate the right length strings for `also_make' members. Sat Apr 1 13:28:38 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.45. * GNUmakefile: Make a separate tarfile of the DVI and info files. * make.c (define_makeflags): If a switch that takes an argument has its default value, put the switch in MAKEFLAGS with no arguments. * make.c (command_switches): Pass `-l' in MAKEFLAGS. Wed Mar 29 17:50:05 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * GNUmakefile: Don't include the DVI and info files in the dist. * commands.c (child_handler): Don't call check_changed_{directories,vpaths}. * make.h: Don't declare check_changed_{directories,vpaths}. * vpath.c (check_changed_vpaths): Removed this function. * dir.c (struct directory): Remove `modtime' member. (find_directory): Don't set `modtime' member. (check_changed_directories): Removed this function. * remake.c (update_file_1): Set FILE->command_state to cs_finished if it didn't need to be remade. * remake.c (update_file): Only write the "up to date" message if the target went from `not_started' state to `finished' state without incrementing the count of files remade. * commands.c [USG] (init_siglist): If both SIGCHLD and SIGCLD are defined, don't put them both in the `switch'. Tue Mar 28 15:37:02 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * file.c (rename_file): Change FILE's name!!! * rule.c (create_pattern_rule): Set the `terminal' member of the new rule after calling new_pattern_rule, which zeros it. * rule.c (default_variables): Use $(C++) in $(COMPILE.cc)! Sun Mar 26 15:52:30 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Makefile: Added a `clean' target. Fri Mar 24 15:08:46 1989 Roland McGrath (mcgrath at helen.Berkeley.EDU) * Version 3.44. * file.c (rename_file): If a `struct file' for the renamed-to name exists, and it is a target or has deps or commands, barf. If not just remove the old one for put in the new one. * remake.c (update_file_1, check_dep): Changed it back so that equal modtimes to NOT make dependencies be considered newer. RCS checks out files with equal modtimes as the RCS files, so this screws it. * make.h, glob.c: If __GNUC__ is defined, use __builtin_alloca. * Makefile: Use variables `ALLOCA' and `ALLOCASRC' so systems without a good standard alloca can get it from the Emacs distribution (or somewhere). * dir.c: Don't include , since make.h does. * make.c: Removed debugging version of getwd. Thu Mar 23 16:16:27 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.43. * remake.c (update_file_1): If a dependency loop is found, don't fatal. Emit an error message and remove the dependency. * remake.c (library_file_mtime): Fixed to use the right names. (update_file_1, check_dep): Consider a dependency "newer" than its dependent if they have the same modification time. Wed Mar 22 19:31:35 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * file.c (remove_intermediates): Don't try to remove nonexistent files. Mon Mar 20 10:21:22 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.42. * rule.c (default_variables): Set F77 to $(FC) and F77FLAGS to $(FFLAGS) so explicit rules expecting these (which are in System V) will work. However, there is no way to make setting these affect the implicit rules, unless we trash FC and FFLAGS (which BSD uses). [USG]: Set GET to `get' rather than `/usr/sccs/get'. Sun Mar 19 20:00:27 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * vpath.c (construct_vpath_list): Don't replace VPATH[ELEM] with dir_name (V), because the latter may get freed. Sat Mar 18 15:01:39 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.41. * make.texinfo: Cleaned-up edition 0.1 Beta from RMS and Bob Chassell. * file.c (rename_file): If a file with the new name already existed, use the same storage space, after freeing the old file's name, deps, and `also_make' member, preserving the link in the chain. Also write an error message telling the user to report the incident; I don't think this should be able to happen, but I'm not sure. * file.c (rename_file): Don't add the hash values of the old and new names together! Reset HASHVAL before computing the second value. * dir.c (check_changed_directories): Zero the new file hash table after allocating it. * dir.c (dir_file_exists_p): If FILENAME is "", return 1 if the directory exists. * vpath.c (check_changed_vpaths): New function to run through the search paths of all VPATHs, making the `exists' members correspond to reality. * commands.c (child_handler): Call check_changed_vpaths. * make.h: Declare check_changed_vpaths. * vpath.c (struct vpath): New element `exists', an array of char flags; exists[N] is nonzero if searchpath[N] exists. (construct_vpath_list): Set the `exists' member. (selective_vpath_search): Don't search directories whose `exists' elements are zero. * read.c (read_makefile): Set the `dontcare' flag of makefiles from the MAKEFILES variable if they were not mentioned anywhere but in the MAKEFILES variable. * read.c (read_makefile): Don't write an error message if fopen fails for a makefile from the MAKEFILES variable. * dir.c (struct directory): Add `modtime' member to record the modification time of the directory when it was opened. (check_changed_directories): New function to check all known directories; if their modtimes have changed since they were opened, their file tables are cleared and they are reset to be read in. * commands.c (child_handler): Call check_changed_directories before returning. make.h: Declare check_changed_directories. Tue Mar 14 20:07:13 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.40. * make.c (print_version): Made the copyright say 1988, 1989. * read.c (read_all_makefiles): Don't set *MAKEFILES to the name of the end of the read_makefiles chain, since the latter may be from an included makefile. (Why did I do this before?) * make.c (main): Set argv[0] to "" if it was nil. Don't put the command-line variable definitions into argv[0], only into the MAKE variable! Sun Mar 5 20:44:08 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * ar.c (ar_member_date, ar_touch): Remove the trailing ) from the member name. Fri Mar 3 18:15:15 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * commands.c (construct_command_argv): Initialize NEW_ARGV to 0. At `slow' label, if NEW_ARGV is not 0, free it; then allocate 4 strings. Tue Feb 28 14:29:39 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.39. * COPYING, make.texinfo: New GNU General Public License, version 1. * *.c, *.h, Makefile: New copyright notices for the new GNU General Public License, version 1. * commands.c [USG]: Define WRETCODE correctly (again). * variable.c (expand_function: `shell'): Don't capture the standard error output of the shell command. * ar.c (ar_touch, ar_member_date): Allocate MEMNAME with the right length. * load.c [not UMAX] (load_average): Don't clobber the first nlist member when trying to set the second! Thu Feb 23 13:13:53 1989 Roland McGrath (mcgrath at tully.Berkeley.EDU) * commands.c (child_handler): Really ignore errors under -i and for - lines, don't just print a different message. * make.c (decode_switches): Fixed handling of arguments (or lack thereof) to switches. Wed Feb 22 16:25:39 1989 Roland McGrath (mcgrath at tully.Berkeley.EDU) * commands.c (construct_command_argv): Don't clobber LINE when checking the IFS variable. Sun Feb 19 11:17:07 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * load.c [UMAX, not NO_LDAV] (load_average): Return 0.0 rather than randomness when calls fail. * Version 3.38. * commands.c (fatal_error_signal): If handling a user kill signal (TERM, INT, HUP), wait for the children without printing the "Waiting for children" message, since they will die quickly. * Version 3.37. * remote-stub.c (remote_status): Take another arg, BLOCK. If this is nonzero block waiting for remote children. If not, return 0 if we would have to block. * commands.c (child_handler) [not USG]: If called as a signal handler, use wait3 and don't block. [USG]: If called as a signal handler, return after handling one child. Sat Feb 18 13:37:04 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * file.c (snap_deps): Process all double-colon entries of each file, not just the first one. * Version 3.36. * remote-stub.c: remote.c renamed. remote.c: Just include remote-stub.c * commands.c (child_handler): If we were called as a signal handler, return after handling one child. * commands.c [not USG]: Include and define `sigmask' if doesn't. (block_children, unblock_children): Use sigmask rather than bitshifting explicitly (and incorrectly). * remote.c (remote_kill): New function to send a signal to a remote child. * commands.c (fatal_error_signal): If we get a SIGTERM, send one to each living child. If we get a SIGTERM, SIGINT, or SIGHUP, delete all pending targets before waiting for children. (struct child): Add new member `deleted'. (start_job): Initialize `deleted' member to 0. (delete_child_targets): New function to delete a given child's targets, unless the `deleted' flag in the `struct child' says they have already been deleted. Sets this flag before returning. Thu Feb 16 18:32:07 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * commands.c [USG]: Define `WRETCODE' correctly (X & 0xff00). Tue Feb 14 16:05:00 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * commands.c (construct_command_argv): Don't make the 0th element of the argument list be "sh" when executing /bin/sh, because start_job uses the 0th element as the program name. Sun Feb 12 17:42:05 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.35. * read.c (readline): Put a null in the beginning of the buffer before starting the reading loop. * read.c (read_makefile): Made main reading loop while !feof (infile), and removed EOF check after calling readline. Sun Feb 5 19:52:38 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * remote.c (block_remote_children, unblock_remote_children): New (stub) functions to block and restore asynchronous notification of remote child death. * commands.c (block_children): Call block_remote_children. (unblock_children): Call unblock_remote_children. (child_handler): If called as a signal handler, block remote children on entry and unblock them before returning. * commands.c (child_handler): For unknown children, if they are remote, give their remote ID; if local, give their PID and make's. * commands.c (execute_file_command): Don't put a new child in the chain unless start_job succeeds. Block children before calling start_job, and unblock them after putting the child in the chain and incrementing `job_slots_used' (if start_job succeeded). * commands.c (block_children, unblock_children): Make these globally visible (not `static'). commands.h: Declare block_children and unblock_children. * variable.c (expand_function: `shell'): Use `shell_function_completed'. Block children before forking and unblock after `shell_function_pid' is set properly and `shell_function_completed' is reset to 0. * commands.c (child_handler): When the child of the `shell' function completes, set `shell_function_completed' to 1 if it actually ran, or -1 if it didn't (due to fork or exec failure). * commands.c (block_children, unblock_children): New functions to block and unblock the child termination signal. (wait_for_children): Use block_children and unblock_children. (execute_file_commands): Block children around the critical section wherein a new child is put on the chain. * make.c (main): Change the environment to contain the correct MAKELEVEL before re-execing. Sat Feb 4 18:28:48 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.34. Fri Feb 3 16:36:49 1989 Roland McGrath (mcgrath at helen.Berkeley.EDU) * rule.c (default_variables): Fixed $(LINK.c). Wed Feb 1 18:05:07 1989 Roland McGrath (mcgrath at pepper.Berkeley.EDU) * Version 3.33. * version.c: Removed copyright notice, since this is a one-line file. * commands.c (error_status): Made it return BUF, rather than running off the end (this apparently worked on Sun 3s for some reason). * ar.c, commands.c, dep.h, load.c, make.c, make.h, read.c, remake.c, rule.c, variable.c, Makefile: Changed copyrght notices to cover 1989. Mon Jan 30 15:51:28 1989 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.32. Fri Jan 27 20:09:24 1989 Roland McGrath (mcgrath at tully.Berkeley.EDU) * remake.c (remake_file): Don't touch phony targets. * rule.c (convert_to_pattern): Fixed an incorrect length passed to savestring. * variable.c (expand_function: `shell'): Close the read side of the pipe on the parent side of the fork. * commands.c (start_job): On the child of the fork, close the BAD_STDIN fd if we're not using it. * read.c (record_files): A file beginning with a dot can be a default target if it also contains a slash (as in `../foo'). * commands.c (wait_for_children): For BSD, block SIGCHLD rather than ignoring it to avoid a race condition when child_handler is returning. * commands.c (child_handler): Do blocking waits. (error_status): Return a string describing exit status. (Split out of child_handler). * read.c (multi_glob): Change VECTOR to VEC for Alliant. Thu Jan 5 00:06:51 1989 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.31. * make.texinfo (Features): Noted $(foo:PAT=SUB) from SunOS 4.0. * make.texinfo (Options/Recursion): -d and -p go in the environment. * load.c: Include "commands.h". Wed Jan 4 17:49:25 1989 Roland McGrath (mcgrath at homer.Berkeley.EDU) * make.c (switches): -d and -p can come from the environment and are put into it. * read.c (record_files): Fixed the checking for duplicate deps so it doesn't clobber the first one. * make.texinfo: Documented default implicit rule changes. * rule.c: Revamped default suffix rules. They now use Sun's style of using variables `COMPILE.c', `LINK.c', etc. for each suffix, and use `TARGET_ARCH' and `TARGET_MACH' variable where appropriate. Also support Modula-2 compilation (suffixes .sym, .def, and .mod). Ratfor Yacc support is gone, since nobody has yacc -r. All EFL support is gone, since nobody uses EFL. * ar.c, arscan.c: Don't assume `long int' and `int' are the same. * commands.c [USG]: Fixed wait status bit encoding. [USG and not USGr3] (dup2): Define this for SysVr2. * make.h, dep.h, make.c [iAPX286]: Make allowances for this brain-damaged compiler. * make.texinfo (Variables: Flavors): Fixed a typo. Tue Jan 3 18:09:31 1989 Roland McGrath (mcgrath at homer.Berkeley.EDU) * ar.c (ar_member_date, ar_touch): Truncate member names to 15 chars. * Version 3.30. * commands.c [SYS_WAIT]: If this is defined, use BSD and wait3 even if USG. * read.c (record_files): Defining .DEFAULT with no deps or commands clears its commands. * rule.c (default_suffixes): Added `.sh'. (default_suffix_rules): Added single-suffix .sh rule, copies source to target and makes target executable. make.texinfo (Catalogue of Rules): Documented .sh rule and its use in conjunction with SCCS. * rule.c (set_default_suffixes): Define variable `SUFFIXES' to the default list ("" under -r). make.texinfo (Suffix Rules): Document `SUFFIXES' variable. * rule.c (default_variables), make.texinfo (Implicit Variables): Variable AR defaults to `ar', ARFLAGS to `rv', and RM to `rm -f'. * rule.c (install_default_pattern_rules): Default variables are made recursive. (default_variables): Added "CPP", defined to "$(CC) -E". (default_suffixes): Added `.S', before `.s'. (default_suffix_rules): New rule for .S to .s, runs CPP. All rules that use CPP now include "$(CPPFLAGS)". make.texinfo (Catalogue of Implicit Rules, Implicit Variables): Documented above changes. * commands.c [USG] (sys_siglist): Don't define. [USG] (init_siglist): New function to initialize sys_siglist. * make.texinfo (Variables: Reference): Documented `$(foo:PAT=SUB)' references. * variable.c (variable_expand): A reference `$(foo:PAT=SUB)' is equivalent to `$(patsubst PAT,SUB,$(foo))'. * variable.c (variable_expand): Free the storage for the expansion of a recursive variable when it is nod longer needed. * variable.c (variable_expand): When checking for `$($(foo))', use lindex so as not to search for the second `$' outside the parens. * make.c (struct stringlist, main, decode_switches): Changed `index' member to `idx'. Sat Dec 24 16:02:32 1988 Roland McGrath (mcgrath at paris.Berkeley.EDU) * commands.c (wait_for_children [USG]): Handle SIGCLD with SIG_DFL, rather than SIG_IGN. Ignoring SIGCLD reportedly makes wait return -1. * arscan.c [USGr3]: Define PORTAR to 1 (as with sun386). (ar_scan [USGr3]): Remove trailing slashes from member names. Thu Dec 22 17:54:05 1988 Roland McGrath (mcgrath at homer.Berkeley.EDU) * make.texinfo (Makefiles: Overriding Makefiles): New node documenting use of .DEFAULT to have one makefile defer unmakeable targets to another. * make.texinfo (Implicit: Using Implicit, Implicit: Last Resort): Mention empty commands and xref node `Empty Commands'. Wed Dec 21 20:12:40 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * Version 3.29. * make.c (struct command_switch, command_switches, et al): New member `noarg_value', if not nil, ptr to value to use if no arg is given to a switch that would otherwise require one. The -j option can now be given w/o an arg, to mean infinite jobs. * commands.c: If job_slots is zero, infinite jobs. * read.c (read_all_makefiles, read_makefile): Make makefiles precious. * make.c (decode_switches): For a positive_int or floating option, if we moved to the next argument word, but found no argument for the option, move back to the correct word. * make.c (decode_switches): If we got any unknown options, die after processing all arguments. * GNUmakefile: Moved `include depend' to the end, so the default goal will be set before then. * load.c (wait_to_start_job [Unix, UMAX]): Merged into one version under #ifdef LDAV_BASED. Only loop while we have jobs running. Sleep for increasing amounts (increase one second per iteration) before checking the load average (after the first check). Get the load average from function load_average. (wait_to_start_job [not LDAV_BASED]): Always return. (load_average [UMAX]): Fetch load average for Encore UMAX. (load_average [not NO_LDAV]): Fetch load average from /dev/kmem. [not NO_LDAV]: Define LDAV_BASED. Tue Dec 20 18:54:50 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * Version 3.28. * commands.c (wait_for_children): Take second arg, ERROR. If nonzero, and there are children, print a message on stderr. (execute_file_commands, fatal_error_signal): Pass second arg. * make.c (die), remake.c (update_goal_chain), variable.c (expand_function: `shell'): Ditto. Sat Dec 17 01:05:38 1988 Roland McGrath (mcgrath at paris.Berkeley.EDU) * commands.c (start_job): Call wait_to_start_job before forking. * load.c (load_average): Converted to wait_to_start_job. * remote.c: New file for remote execution functions. (start_remote_job_p): Return nonzero if the next job should be run remotely. (start_remote_job): Start a remote job and return an ID for it. (remote_status): Get status of dead remote children. Fri Dec 16 16:51:07 1988 Roland McGrath (mcgrath at hecuba.Berkeley.EDU) * commands.c (start_job): If start_remote_job_p () returns nonzero, call start_remote_job to start the job rather than fork and exec. (child_handler): * commands.c (execute_file_commands): Moved load average checking to start_job. * commands.c (child_handler: USG): Record the pid wait returns. * load.c (UMAX): Added some #include's needed for UMAX. * read.c (multi_glob), variable.c (string_glob): Ignore a (char **) -1 return from glob_filename. * variable.c (variable_expand): Make sure we don't increment past the end of the string we were passed. * variable.c (variable_expand): Terminate the expansion. * file.c (rename_file): If there is already a file under the new name, set its contents equal to FILE's (ick). * variable.c (define_automatic_variables): Pass all the args to define_variable when defining MAKELEVEL! * commands.c (execute_file_commands): If max_load_average > 0, and we have children running, don't start up another child until the load average goes below max_load_average. * make.c: New variable `max_load_average'. (struct command_switch, decode_switches, decode_env_switches): Handle floating-point (double) args. (command_switches): Added `-l' switch to set `max_load_average'. * load.c (load_average): New file and function to return a double that is the current load average (1.00 scale). * GNUmakefile, oldMakefile: Pass flags in $(LOAD_AVG) for load.c. Thu Dec 15 15:22:08 1988 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Makefile: Renamed to oldMakefile. * GNUmakefile: Make Makefile from oldMakefile and depend. * read.c (read_all_makefiles): When putting the default makefiles in the read_makefiles chain so they will be remade, put them in the right order. * remake.c (update_goal_chain): If MAKEFILES is nonzero, always make in serial, and return as soon as one goal whose `changed' member is nonzero is successfully remade. * commands.c: Don't include . * commands.c (construct_command_argv): Added ` to sh_chars. * make.h: Don't declare construct_makeflags. * make.c (main): Set up MAKEFLAGS and MFLAGS and make an environment both before and after reading the makefiles, so the makefiles can use them and possible change them, and later children will get the right information. (construct_makeflags): Replaced with define_makeflags (static void), which defines the two variables. * variable.c (define_automatic_variables): Don't define MAKEFLAGS and MFLAGS. Mon Dec 12 14:40:31 1988 Roland McGrath (mcgrath at helen.Berkeley.EDU) * Version 3.27. * commands.c (child_handler): Reset the handler to ourselves when called for USG, since it has no safe signals. * commands.c: For USG, use an int rather than a `union wait' for wait calls, and dissect it with bitmasks. (child_handler): No wait3 system call in USG. Since we can't protect from hanging, always return immediately if we have no children we know about and we're not running a `shell' function. (There is still the danger of hanging waiting for a child that died without our being notified.) * remake.c: Include instead of . What we need is really in , and while BSD includes , USG doesn't. * make.c (main): Figure out the program name before doing anything which might need it (in a call to error or fatal). * dir.c, glob.c: Use `struct dirent' and for USGr3. * arscan.c (ar_scan): Added missing & before buf (which is an int) if SARMAG is not defined (SysV). Fri Dec 9 18:44:13 1988 Roland McGrath (mcgrath at pepper.Berkeley.EDU) * Version 3.26. * dir.c (find_directory, dir_file_exists_p): Keep track of how many directories we have open and don't let it be more than MAX_OPEN_DIRECTORIES (currently 10). * variable.c (expand_function: `foreach'): Use expand_argument rather than variable_expand so each repetition doesn't clobber the last!!! Mon Dec 5 15:58:46 1988 Roland McGrath (mcgrath at hecuba.Berkeley.EDU) * Version 3.25. * Makefile: Define `install' target. * GNUmakefile: Don't include GNUmakefile or depend in the distribution file. Wed Nov 30 15:53:42 1988 Roland McGrath (mcgrath at helen.Berkeley.EDU) * commands.c (execute_file_commands): Don't clobber a null into random storage if there were no $^ and/or $? words. * remake.c (check_dep): Set *MUST_MAKE_PTR nonzero if a dependency doesn't exist. * ar.c (ar_member_date, ar_touch): Make sure the modtime of the archive file itself is known before we fetch or change the modtime of one of its members. * read.c (read_makefile): Expand variable and function references before parsing rules so variable can contain special characters (colons and semicolons). Sat Nov 26 11:36:31 1988 Roland McGrath (mcgrath at homer.Berkeley.EDU) * variable.c (expand_function: `filter', `filter-out'): Fixed so that filter-out works right. * variable.c (expand_function: `filter', `filter-out'): Made these functions use each word of their first argument as a pattern. Fri Nov 25 10:51:47 1988 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.24. * read.c (record_files): If a target is listed more than once in a single rule (that defines commands), give a warning message rather than the counter-intuitive message saying commands were already defined (in the same place). * make.c (fatal, error): Made them both take 6 args since there is at least one error message that need that many. Too bad vfprintf is not universal! * Version 3.23. * read.c (read_makefile): Moved the construction of the `struct commands' into record_files. Call record_files before recursing for an included makefile so the higher-up will determine the default goal. (record_files): Take arguments COMMANDS, COMMANDS_IDX and COMMANDS_STARTED and construct a `struct commands. Thu Nov 24 14:36:33 1988 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.22. * make.c (main): Made it a fatal error if we can't move back to the directory we started in before re-execing. * make.c (main): Get the current directory before doing anything else, so we know it even if we don't need it for the value of `MAKE', since we might want it when re-execing. Wed Nov 23 13:34:44 1988 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.21. * read.c (record_files): Eliminate duplicate deps in a chain. * variable.c (expand_function: `sort'): Pass the right number to qsort, not one less. * remake.c (remake_file): Always call notice_finished_file if FILE->command_state == cs_finished. * commands.c (execute_file_commands): Call notice_finished_file to set FILE's status correctly when start_job fails (because it's out of commands or running under -n). Fri Nov 18 15:31:12 1988 Roland McGrath (mcgrath at saffron.Berkeley.EDU) * Version 3.20. * remake.c (update_file_1): Set the `update_status' of FILE to nonzero and set FILE's `updated' bit if we have decided to give up on remaking FILE because of errors in the dependencies. * rule.c (pattern_search): Debugging messages use `dependency' (vs. `dependent') properly. * make.texinfo (Conditionals: Conditional Syntax): Function index entries for `ifndef' and `ifneq'. * variable.c (define_automatic_variables): Define `MAKELEVEL' to the decimal number of the makelevel, since it may be malformed or blank. * remake.c (remake_file): Call notice_finished_file after touching. Sat Nov 12 19:29:34 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * Version 3.19. * GNUmakefile (dist): Pass the `-f' flag to compress. * vpath.c (build_vpath_lists): Check for VPATHS being nil after constructing the general VPATH list from the `VPATH' variable. Fri Nov 11 08:02:26 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.c (fatal, error): Made error messages for recursive runs be shorter. Thu Nov 10 16:51:36 1988 Roland McGrath (mcgrath at basil.Berkeley.EDU) * Version 3.18. * read.c (read_makefile): Made it eat leading spaces and formfeeds (but not tabs), like it's documented to. * read.c (read_makefile): Let included makefiles determine the default goal, as is done by System V Make. Tue Nov 1 19:03:08 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * variable.c (new_environ): Don't increment VCNT when a variable is rejected. Fri Oct 28 16:54:15 1988 Roland McGrath (mcgrath at basil.Berkeley.EDU) * Version 3.17. * rule.c (convert_to_pattern): Don't use the same storage for a name in two rules since new_pattern_rule may free this storage when a rule is discarded. * rule.c (new_pattern_rule): Undid useless change I made Oct 25. Thu Oct 27 19:17:53 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * Version 3.16. * GNUmakefile, Makefile: Fixed a typo in a comment. * Makefile: Removed malloc.o from object file list. * variable.c: Removed old debugging #define's for xmalloc and xrealloc so non-ANSI cpp's won't barf. * make.c (main): Made local array for temp file name static so compilers that don't do auto aggregate initialization won't barf. * read.c: Removed static declaration of copy_dep_chain since it is no longer static. Tue Oct 25 16:59:30 1988 Roland McGrath (mcgrath at pepper.Berkeley.EDU) * rule.c (new_pattern_rule): If we threw out the new rule because it matched an old one and OVERRIDE was zero, don't put the freed pointer in the chain! Wed Oct 19 15:07:43 1988 Roland McGrath (mcgrath at pepper.Berkeley.EDU) * Version 3.15. * variable.c (expand_function: `sort'): Don't do the sorting and writing out if there were no words in the first place. * remake.c (remake_file): Only fail with a "no way to make" message for a dependency (non-target) file. If we don't know how to remake a target file, pretend it was successfully remade and is very new. * remake.c (remake_file): Don't increment `files_remade' for a non-target file we don't know how to remake. * read.c (record_files): Don't die with "both : and :: entries" for a file whose `is_target' flag is not set. Tue Oct 18 17:24:11 1988 Roland McGrath (mcgrath at paris.Berkeley.EDU) * variable.c (expand_function: `patsubst', `subst'): Free the right things! * variable.c (expand_function: `subst'): Don't clobber the pointer to the end of the second arg and then try to use it!!! Mon Oct 17 16:44:45 1988 Roland McGrath (mcgrath at catnip.Berkeley.EDU) * variable.c (expand_function: `patsubst'): Don't clobber the pointer to the end of the second arg and then try to use it!!! * variable.c (expand_function: `word' function): Made it parse its second argument correctly. * ar.c (ar_touch): Return 1 rather than -1 for on errors. Sat Oct 15 15:12:16 1988 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.14. * GNUmakefile: Removed explicit rule for make.dvi since the built-in implicit rule now works. * rule.c (default_suffix_rules): Fixed .texinfo.dvi rule yet again so that it really works, now that parens are counted. * remake.c (update_file_1): Set FILE's `updated' flag after calling remake_file if it failed or finished immediately. * remake.c (update_file): Use the `updated' flag rather than the command state to decide if a file was fully considered, and therefore might give an "up to date" message. * variable.c (expand_function): Made all functions that take more than one argument count parens of the appropriate flavor in their args and ignore commands nested in parens. Fri Oct 14 18:35:00 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * read.c (read_all_makefiles): Pass second arg to read_makefile for default makefiles. Thu Oct 13 16:40:08 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * Version 3.13. * GNUmakefile: Added an explicit rule for make.dvi since the built-in .texinfo.dvi implicit rule is screwed up. * rule.c (default_suffix_rules): Added a comment that the .texinfo.dvi rule does not work because of an ahem, feature of Make that at some point will be fixed--er, enhanced to alleviate this difficulty. * rule.c (default_suffix_rules): Fixed Texinfo -> DVI rule (again). * make.texinfo (Commands: Execution): Documented new competing for standard input among children. * commands.c (struct child): Added `good_stdin' flag to tell if this child has the stdin that doesn't point into nirvana. (good_stdin_used): New variable to tell if any child has the good standard input. (child_handler): Reset `good_stdin_used' if a dead child's `good_stdin' flag is set. (start_job): Give the new child the good standard input if `good_stdin_used' is no set, and set the child's `good_stdin' flag appropriately. * rule.c (default_suffix_rules): Changed Texinfo -> DVI rule to work better (I hope). * read.c (read_all_makefiles): Stop reading default makefiles after one is found. * read.c (read_makefile): Reset `reading_filename' and `reading_lineno_ptr' after recursing for an included makefile. * GNUmakefile: New GNU Make-specific makefile that does everything Makefile does plus distribution stuff, and doesn't contain any hacks to try to work with Unix make. * Makefile: Removed distribution stuff. * make.c (main): Use mktemp to construct the names of temporary files used for standard input makefiles. * make.c (main): Don't turn standard input into a broken pipe. * commands.c (start_job): Keep two extra file descriptors around: a good standard input, and a bad one that reads from a broken pipe. On the child side of the fork, if there are other children, give this one the broken pipe so they won't compete; if this is the only one, give it the good standard input. * make.h: Declare notice_finished_file. * commands.c (execute_file_commands): Use noticed_finished_file after waiting for the child when there is only one job slot. * remake.c (notice_finished_file): New function to re-check mtime's and such things to be done when commands finish. (update_file_1): Use notice_finished_file. * commands.c (child_handler, execute_file_commands): Use new variable `job_slots_used' to record the number of jobs currently running, rather than diddling with `job_slots'. (execute_file_commands): Increment `job_slots_used' before calling start_job and decrement it on failure to avoid race condition. If there is only one job slot, wait for the child to finish and return its status so commands are run in linear order, as if there were no parallelism. Wed Oct 12 15:59:03 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * remake.c (remake_file): Don't print a "No way to make" message for targets whose `dontcare' flags are set. * read.c (read_all_makefiles): Set the `dontcare' flag of the `struct file' each default makefile added to the chain. * file.h (struct file): Add `dontcare' member. * read.c (read_all_makefiles): When no default makefiles are found, put the names of all those tried in the `read_makefiles' chain so they will be updated if possible, giving their `struct dep's' `changed' members the value of 0 so we won't care if they cannot be found or remade. * make.texinfo (Makefiles: Remaking Makefiles): Documented that default makefiles will be remade if not found. * read.c (read_all_makefiles): If no default makefiles can be found, go through the list of default names, trying to make one, stopping if one is made. * remake.c (remake_file): Set STATUS to 0 after successfully touching. * dir.c (file_impossible, file_impossible_p): Don't clobber FILENAME to "" and then try to to a strcmp on it!!! Mon Oct 10 16:09:18 1988 Roland McGrath (mcgrath at cinnamon.Berkeley.EDU) * make.c (main): Don't do `dir_load (".")'. * rule.c (count_implicit_rule_limits), vpath.c (construct_vpath_list): Test the existence of a given directory by `dir_file_exists_p (DIR, ".")' and assume that if this returns zero, it means the directory really does not exist. * dir.c (struct dirdata): Replaced with `struct directory' for directories, each containing a chain of `struct dirfiles', one for each file (real or impossible). (dir_load): Removed. (find_directory): New function to find the `struct directory' for a named directory and return it (possibly creating a new one). (dir_file_exists_p): Read the directory on the fly if its stream is still valid (and ever was) if the file we're looking for is not already in the hash tables. (file_impossible, file_impossible_p, dir_name, print_dir_data_base): Use the new directory/file scheme. * make.texinfo: Miscellaneous editorial changes and clarifiactions. * commands.c (struct child): Remove `environ' member. (child_handler, start_job, execute_file_commands): Remove use of `environ' member and new_environ. * make.c (main): Call new_environ after reading makefiles. * variable.h: Declare `new_environ' to return void. * variable.c (new_environ): Put the environment in `environ' and return void. Fri Oct 7 15:48:39 1988 Roland McGrath (mcgrath at pepper.Berkeley.EDU) * Version 3.12. * Makefile: Don't make the uncompressed tar file. * variable.c (expand_function: `shell' function): Made it not expect read to null-terminate the buffer. * Makefile: Made it use a temporary symlink to . rather than a temporary directory to make the distribution tar file. Thu Oct 6 17:52:35 1988 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.11. * make.texinfo: Fixed a line that got garbaged somehow. Mon Oct 3 16:14:39 1988 Roland McGrath (mcgrath at paris.Berkeley.EDU) * make.c (main): Try to move back to the directory we started in before re-exec ourself. * remake.c (update_file_1): A double-colon target with no deps always needs to be remade. * remake.c (remake_file): Changed "No way to make" message to say `target' rather than `file'. Sun Oct 2 12:50:47 1988 Roland McGrath (mcgrath at catnip.Berkeley.EDU) * remake.c (update_file_1): Set FILE->update_status to the return value of remake_file. * rule.c (convert_to_pattern): Fixed swapped lengths passed to xmalloc for source/target suffixes. * make.texinfo: Documented that MAKEFLAGS and MFLAGS are read in from makefiles. Updated the `Features' section a bit. * make.c (main): Read switches from MAKEFLAGS and MFLAGS variables after reading in makefiles. * make.c (main): Put a line "/tmp/foo:;" rather than ".PHONY: /tmp/foo" in front of temp files made for stdin makefiles. * remake.c (update_file): Test the state of the right `struct file' for double-colon files. * make.c (main): Put a ".PHONY: /tmp/foo" line in front of temp files made for stdin makefiles so they won't be remade when we re-exec. Kludge-o-matic!! * remake.c (update_goal_chain): Judge files as being finished based on their `updated' flag, not their state. * read.c (read_makefile): Don't check for FILENAME being "-". (read_all_makefiles): Set each element of MAKEFILES to the name put in READ_MAKEFILES by read_makefile, since read_makefile may free the storage for the name it is passed, and someone might want to look at the elements of MAKEFILES again. * make.c (main): For each `-f' flag with arg `-' (standard input), read standard input into a temp file and pass the temp file's name to read_all_makefiles, after making sure it will not be remade. * make.c (construct_makeflags): Always put out `-j1'. Sat Oct 1 00:19:59 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * commands.c (execute_file_commands): If commands are nothing but whitespace, set the state to `cs_finished' before returning 0. * make.c (decode_switches): Allocate space for args in stringlists so they can be freed later. * make.h: Declare `makelevel'. * variable.c (makelevel): Moved to make.c (and made global). * make.c (fatal, error): Print the makelevel if it's > 0. (perror_with_name): Use error rather than calling fprintf directly. (pfatal_with_name): Use fatal rather than fprintf and die. * variable.c (new_environ): Don't put default variables (origin `o_default') into the environment; they just take up space. * read.c (read_makefile): Don't add FILENAME to the chain of read makefiles if it's "-" (standard input). * remake.c (update_goal_chain): Set STATUS correctly when nothing happens (as well as in all other situations). * make.c (construct_makeflags): Put a `-' before each switch and spaces between them. * Version 3.10. * commands.c (wait_for_children): Don't check if `children' is nil. This is the case when waiting for the child of a `shell' function. * dir.c (dir_load): Don't add a hash-table entry for directory DIRNAME and filename "" if DIRNAME doesn't exist. * commands.c (execute_file_commands): Return 0 after start_job returns 1 (failure) under the -n flag. * remake.c (remake_file): Set the state to `cs_finished' when not calling execute_file_commands. * remake.c (update_goal_chain): Second arg is now MAKEFILES, nonzero meaning to disable -t, -q, and -n for each target unless the target was also given on the command-line. * read.c (read_makefile): Enter the `struct file's for the makefiles added to the `read_makefiles' `struct dep' chain. * remake.c (update_goal_chain): Made it not enter the files for the goals in the chain. It will already have been done. * rule.c (convert_to_pattern): Null-terminate the names of targets and deps of the pattern rules properly. Fri Sep 30 18:56:20 1988 Roland McGrath (mcgrath at nutmeg.Berkeley.EDU) * make.c (main): Call install_default_pattern_rules. * make.h: Declare copy_dep_chain. * read.c (copy_dep_chain): Moved to make.c (and made global). * make.c (main): Call update_goal_chain to update goals. Update read makefiles and re-exec self if they change. * remake.c (update_file): Make this function static. (update_goal_chain): New function to update a `struct dep' chain of goals, waiting until they are all finished before returning. * make.h: Don't declare update_file. Declare update_goal_chain. * make.c (main): Call snap_deps, etc. that were in read_all_makefiles. * read.c (find_makefile): Removed this function. (read_all_makefiles): Don't update makefiles, don't diddle with pattern rules, don't call snap_deps, etc. Return a `struct dep' chain of all makefiles read. (read_makefile): Now takes two args: FILENAME and TYPE, which is 0 for a normal makefile, 1 for MAKEFILES variable or 2 for an included makefile. Add a `struct dep' containing the name of the makefile (as it was found in the search path for type 2s), and TYPE in the `changed' member to the global `read_makefiles' chain. * make.h, rule.c (displace_pattern_rules, add_displaced_pattern_rules): Removed these functions. * read.c (read_makefile): Variable-expand the name of an `include'd makefile before calling find_makefile on it. * file.c (snap_deps): If the `struct file' for a `struct dep' already exists, free the `struct dep's `name' member before setting it to nil (since this info is in the `struct file'). * read.c (copy_dep_chain): Made it copy each name rather than leaving multiple `struct dep's with the same pointers. Thu Sep 29 19:08:13 1988 Roland McGrath (mcgrath at catnip.Berkeley.EDU) * make.c (decode_switches): Fixed second decode_env_switches call to use correct length of "MFLAGS" (6, not 5). * read.c (read_makefile): Don't stop reading when readline returns zero lines read. Only stop when the stream reaches EOF. This makes it recognize the last line of a makefile without a newline. * remake.c (remake_file): If we don't know how to make FILE, set its command state to `cs_finished'. * remake.c (update_file): Don't write the "up to date" message if update_file_1 returned a nonzero status. Wed Sep 28 16:30:07 1988 Roland McGrath (mcgrath at catnip.Berkeley.EDU) * commands.c (child_handler): Set the `update_status' member properly for ignored errors. * rule.c (convert_to_pattern): Made it not care about if the target suffix comes before the source suffix in the .SUFFIXES list. * make.texinfo: Misc editorial changes. * commands.c (wait_for_children): Return immediately if `children' is nil (there are no children). Tue Sep 27 15:33:14 1988 Roland McGrath (mcgrath at pepper.Berkeley.EDU) * Version 3.09. * commands.c (struct child): New member `command_ptr' to hold the current position in the commands. The `commands' member is never changed. (start_job, child_handler, execute_file_commands): Use new method for `commands' and `command_ptr' members. * make.c (decode_env_switches): Skip past an invalid letter (instead of looping forever). * commands.c (struct child): Add `environ' member to hold the environment for this child. (execute_file_commands): Get a new environment from new_environ and put in the the new `struct child's `environ' member. (child_handler): When freeing a child, free its `commands' member, the elements of its `environ' array and its `environ' member itself. (start_job): Set `environ' to the child's `environ' member before exec'ing the command. * variable.h, variable.c (new_environ): Made it return the new environment, not putting it in `environ'. * remake.c (update_file): Don't give a "is up to date" message unless no files were remade and the state went from `cs_not_started' to `cs_finished', so repeat calls to finish jobs won't get the message. Mon Sep 26 16:26:08 1988 Roland McGrath (mcgrath at helen.Berkeley.EDU) * Version 3.08. * make.texinfo (Commands: Execution): Documented that children will be waited for rather than killed. * commands.c (fatal_error_signal): Wait for children. (kill_children): Removed this function. * make.c (main, die): Wait for children to die, don't kill them. * variable.c (expand_function): Use wait_for_children. * make.c (main): Use wait_for_children rather than child_handler. * commands.c (wait_for_children): New function to block waiting for children, insuring that child_handler is not called recursively. (execute_file_commands, kill_children): Use wait_for_children. * commands.c (child_handler): Start up additional commands in a sequence after an ignored error. * remake.c (update_file): Don't print "`foo' is up to date" messages when update_file_1 returns while commands are executing. * remake.c (update_file_1): Pass the file name to name_mtime, not the bloody `struct file', dammit!! * commands.c (child_handler): Print out the "*** ..." error message when not under -i. (I somehow forgot this.) * remake.c (update_file_1): Use name_mtime rather than file_mtime to re-get the mtime of a file whose commands have finished. * make.c (command_switches, decode_switches, decode_env_switches): Make all switches that take string args allow them right after the switch letter. * commands.c (child_handler): Check for a child being the `shell' function's command returning and set the global variable for expand_function to check. * variable.c (expand_function): For the `shell' function, instead of waiting for the child shell ourselves, let child_handler do it and loop around waiting for something to happen. * make.c (print_version): Made the copyright year static, not dynamic. * make.h, make.c: Remove construct_argv function. * make.c (main): Say "no goal target" instead of "no target". * make.texinfo (Commands: Parallel): Don't send SIGKILL. * commands.c (kill_children): Don't send SIGKILL to children that aren't killed by the first signal. * make.c (main), commands.c (kill_children): Decide between SIGCHLD and SIGCLD based on whether or not SIGCHLD is defined, not on USG. * Makefile: Link make with $(LOADLIBES). * read.c (construct_include_path): Fixed another bad xrealloc call. * make.c (decode_switches): Fixed an xrealloc call with no first arg. Sat Sep 24 01:16:21 1988 Roland McGrath (mcgrath at paris.Berkeley.EDU) * Version 3.07. * remake.c (update_file_1): If deps are running, set state to `cs_deps_running' and return 0. If deps are done, run commands. * commands.c (child_handler): Made it delete non-precious targets killed by fatal signals. * make.texinfo: Documented parallelism. Fri Sep 23 16:52:27 1988 Roland McGrath (mcgrath at helen.Berkeley.EDU) * remake.c (update_file_1): Don't return if FILE's state is `cs_deps_running'. In that case, we need to run through and check the states of all our dependencies. * commands.c (execute_file_commands): Decrement `job_slots' after starting a new job to run file commands. * commands.c (start_job): Made it set the state to `cs_running'. * make.c (main): Fixed usage of `g', `lastgoal', and `goals' in the goal-making loop. * commands.c (child_handler): When commands finish, set the corresponding file's `update_status' and `updated' flags as appropriate, and reset the modtimes of the file and any `also_make' files it has. * remake.c (remake_file): Don't re-set `last_mtime' and set `updated'. * commands.c (fatal_error_signal): Don't swallow all the children with a loop around `wait ((union wait *) 0)'!!! * make.c (struct command_switch): Added `positive_int' type. (switches): Added -j (job_slots). (construct_makeflags, decode_switches, decode_env_switches): Handle`positive_int'-type switches. * glob.c (glob_vector): Rename local variable `vector' to `VeCtOr'. This is said to avoid a conflict with some system's global `vector' variable. * variable.c (expand_function): Made the `shell' function use construct_command_argv and do its own child control and piping. * make.c (main): Turn standard input into a broken pipe after reading in all makefiles (the last time it will be needed). * commands.c (struct child): Remove `pipe_fd' member. We don't use pipes any more. (start_job): Return 0 for success, 1 or failure (rather than void). Don't use pipes. Don't turn the child's stdin into a broken pipe. (child_handler): Print "*** Error" messages when necessary. Die on failed commands when -k was not given. (execute_file_commands): Check the return of start_job and remove the child from the chain and return failure if it is nonzero. * make.c (die): New function to clean up and exit. (fatal, pfatal_with_name): Use die. Thu Sep 22 14:27:11 1988 Roland McGrath (mcgrath at helen.Berkeley.EDU) * commands.c (struct child): Added `commands', `pipe_fd', and `noerror' members to keep track of info about a command thread. (start_job): New function to start a job and update the argument `struct child' to reflect its status. (execute_file_commands): Merged run_file_commands back in. Made it use new start_job function. * rule.c (freerule): Don't free the `struct commands' of the discarded rule. It may be used in more than one place. * commands.c (execute_command_line): Made it not try to delete the possibly partly-made file. The child_handler function will do this. (fatal_error_signal): Ditto + call kill_children. * make.h: Declare job_slots. * make.c (main): Collect goals in a dep chain and run through this chain waiting for a child, eliminating finished goals, updating all remaining goals, and quitting if they fail and not -k. * commands.c (child_handler): If called with SIG < 0, - SIG is the max number of children to bury. * commands.c (child_handler): If called with SIG as zero, block waiting for running children. (kill_children): Call child_handler with zero rather than SIGCHLD. * remake.c (update_file_1): Use the `command_state' member of FILE and its dependencies to determine what commands are running, what to do, etc. If commands or dep commands are running when we are called, return success (0). If commands finished since the last time we were called, return their status. * commands.h: Declare kill_children. * commands.c: Define `struct child' to keep track of child processes, with the chain in `children'. (child_handler): New function to catch child-termination signals (SIGCHLD, or SIGCLD for USG), store the returned status in the appropriate structure, take the now-obsolete `struct child' out of the chain, and free its storage. (execute_file_commands): Put all of the stuff invloving running the commands into new function run_file_commands. Execute_file_commands now does process management for the commands, while run_file_commands (which is run in a subprocess) runs the commands. (kill_children): New function to kill all running children by sending them signal SIG. If there are any children still living after they are all sent SIG, they are all sent SIGKILL. * make.c (main): Catch SIGCHLD (SIGCLD for USG) with child_handler. * commands.h: Declare child_handler function. * commands.c (execute_file_commands): Check the `command_state' member of FILE and return 0 if it is `cs_running' or `cs_deps_running' and return the stored status if it is `cs_finished'. * file.h (struct file): Added `command_state' member. * commands.c (execute_command_line): Add `$' to the list of characters special to the shell. Wed Sep 21 15:57:41 1988 Roland McGrath (mcgrath at helen.Berkeley.EDU) * read.c (read_all_makefiles): Call convert_to_pattern before recomputing the limits after adding the displaced rules. * make.c (main): Move calls to snap_deps, convert_to_pattern, and build_vpath_lists to read_all_makefiles. * read.c (read_all_makefiles): Install the default pattern rules before checking to remake the makefiles, displace these rules before reading in the makefiles, and then add the displaced rules to the chain after reading in all the makefiles. * make.c (main): Don't call install_default_pattern_rules or count_implicit_rule_limits. * make.h: Declare displace_pattern_rules and add_displaced_pattern_rules. * rule.c (displace_pattern_rules, add_displaced_pattern_rules): New functions to stow the chain and add the stowed chain on the end of the current chain. * make.texinfo (Implicit: Search Algorithm): Fixed PREV reference. * make.c (main): Call construct_include_path right after decoding the switches. * read.c (find_makefile): Use rename_file. * file.h: Declare rename_file. * file.c (rename_file): New function to rename a `struct file' and put it in the correct hash bucket. * read.c (find_makefile): New function to find and update a makefile. (read_all_makefilese): Use find_makefile. (read_makefile): Don't do updating. Removed UPDATEIT arg. * remake.c (update_file_1): Took out setting the `updated' member to -1 rather than 1 sometimes. * make.c (main): Made it print version info before doing anything else. * remake.c (library_file_mtime, f_mtime): Removed use of last two arguments to vpath_search. * rule.c (pattern_search): Removed use of last two arguments to vpath_search. * vpath.c (vpath_search, selective_vpath_search): Removed unused DIRPREFIX and DPLEN args. * read.c (read_makefile): Also turn off -n when updating makefiles. Tue Sep 20 17:01:10 1988 Roland McGrath (mcgrath at pepper.Berkeley.EDU) * Makefile: Put tags files in the tarfile. * read.c (read_makefile): Get the modtime of the makefile via a stat call so that a later file_mtime call won't do VPATH search for it. * read.c (read_makefile): Don't turn off -t and -q if the makefile was a command-line target. * make.c (main): Enter command-line targets as files and set their `cmd_target' members. * file.h (struct file): Added `cmd_target' member. * read.c (read_makefile): Temporarily turn off -t and -q while updating makefiles. * make.c (main): Don't use arg 0 from other_args (which is now argv[0]; i.e., the program's name). * read.c (read_makefile): Only return nonzero if commands were actually run to remake the makefile. * remake.c (update_file_1): Set FILE->updated to -1 if no commands were actually run (because no update was done or -t was given). * make.c (decode_switches): Fixed bug wherein xrealloc was passed bad args if it tried to expand other_args->list. * read.c (read_all_makefiles): Made it not look at the `MAKE' variable, just use argv[0]. Sun Sep 18 17:34:11 1988 Roland McGrath (mcgrath at paris.Berkeley.EDU) * read.c (rerun_make): New function to re-exec make. * make.c (construct_makeflags, construct_argv): New functions to construct the `MAKEFLAGS' variable and to construct an arg list from parsed info. * read.c (read_makefile): New arg UPDATEIT, if nonzero, says to update the makefile as a target before reading it in. When reading included makefiles, pass this as zero. Now returns nonzero if the makefile was updated, zero if not. (read_all_makefiles): Pass a nonzero UPDATEIT arg to read_makefile for all default and -f makefiles and all makefiles from the `MAKEFILES' variable. If any of the makefiles has changed, re-exec self to re-read them. * remake.c (update_file): Print a "File `foo' up to date'" message under -p. * commands.c (execute_file_commands): Allocate one byte for each of $^ and $< rather than zero if they are to be empty. Fri Sep 16 13:59:59 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * Version 3.06. * make.c (command_switches): Fixed entry for `-o' switch. * make.texinfo: Renamed -c switch to -C. * make.c: Renamed -c switch to -C. * Miscellaneous de-linting. * read.c (record_files): Made it not free the storage for the name if it started with `./' and was therefore not quite the same as in the `struct file'. * read.c (record_files): If commands were specified twice, the error message specifies in what files and at what line numbers. * make.c (main): If any of the signals we usually fatal on were ignored by the parent (probably a shell), ignore them. * make.c (main): Print version info for -v, -p, or -d. (print_data_base): Don't print version info. It will be done in main. * variable.c: Increased number of hash buckets to 257. * file.c: Increased number of hash buckets to 1007. * rule.c (count_implicit_rule_limits): Moved comptation of `maxsuffix' to convert_to_pattern, since that function uses `maxsuffix', and must be called before count_implicit_rule_limits. * rule.c (pattern_search): If an existent (non-intermediate) dependency was found via a terminal rule, set its `tried_implicit' flag, so it will never have implicit rule search done. * glob.c: Bug fix to avoid alloca(0). * arscan.c: USG and Sun386i fixes. Thu Sep 15 19:40:26 1988 Roland McGrath (mcgrath at helen.Berkeley.EDU) * make.texinfo: Fixed some typos and spelling errors. Wed Sep 7 14:20:39 1988 Roland McGrath (mcgrath at helen.Berkeley.EDU) * make.c (decode_switches): Fixed bug wherein a bad option would give a useless error message and loop forever. Tue Sep 6 14:36:02 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.texinfo: Documented `shell' function. * variable.c (expand_function): New function `shell', does backquote-style command expansion of its arg. * commands.c (execute_command_line): Second arg OUTBUF, if not nil, gets filled in with a malloc'd buffer containing the piped stdout of the command. (execute_file_commands): Use above (pass nil). Mon Sep 5 17:03:49 1988 Roland McGrath (mcgrath at hecuba.Berkeley.EDU) * Makefile: Added copyright notice. Added a comment about defining `NO_MINUS_C_MINUS_O' if necessary. * Version 3.05. * rule.c (default_suffix_rules): Don't pass `-o' switches with `-c' switches if `NO_MINUS_C_MINUS_O' is #define'd. * make.texinfo: Documented `GNUmakefile'. * read.c (read_all_makefiles): Made it try default makefile `GNUmakefile' before others. * make.texinfo: Added new-style Texinfo header thingies. Sat Sep 3 18:09:39 1988 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.04. * make.texinfo (Chained Rules): Added a @cindex about using .PRECIOUS to preserve intermediate files. * remake.c (update_file_1): Made it not just return before executing commands under -p. * rule.c (default_pattern_rules, default_variables): Made it use `$(AR)' for `ar r' (to put files in archives). * vpath.c (build_vpath_lists): Made it recursively expand the `VPATH' variable (by using variable_expand instead of lookup_variable). * read.c (conditional_line): Made it not swallow whitespace after the comma in an `ifeq' using the `(a,b)' syntax. * rule.c (count_implicit_rule_limits): Made it not crash if a pattern rule dep begins with `/'. Sun Aug 28 15:51:12 1988 Roland McGrath (mcgrath at homer.Berkeley.EDU) * make.texinfo: Clarified that the arg to the `origin' function is a variable *name*, not a reference. * make.texinfo: Clarified that both -Idir and -I dir are allowed. Sat Aug 27 13:49:28 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * remake.c (remake_file): Made touching phonies work right. Wed Aug 24 20:40:48 1988 Roland McGrath (mcgrath at nutmeg.Berkeley.EDU) * make.texinfo: Removed reference to `RANLIB' variable. * Version 3.03. * variables.c (expand_function): Added `origin' function. * make.texinfo: Documented same. * read.c (record_files): Made double-colon entries work. Sat Aug 20 21:09:39 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.c (collapse_continuations): Bug fix from RMS. * rule.c (install_default_pattern_rules): Made it set the `in_use' flag of the created rules to zero, rather than letting it be random garbage. * rule.c (pattern_search): Fixed putting `also make' targets into file strucutres. * read.c (record_files): Fixed bug which made double-colon entries make it read off into space. * make.c (decode_switches): Made it understand `ignored' switches rather than dumping core. Sun Aug 14 16:49:00 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * read.c (read_makefile): Made `include' filenames be variable-expanded. * read.c (read_makefile): Fixed an error message. * read.c (read_makefile): Made it accept ^L's as whitespace. * make.c (next_token, end_of_token): Ditto. * vpath.c (vpath_search): Fixed it so that the general VPATH (from the variable) is always checked, even if a selective VPATH (from a directive) matched the filename. Sat Aug 13 14:20:46 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.c (decode_switches, main): Made the command switches be processed from a table of switches, variables, and types. No functions are passed argc and argv any more. They are passed arrays of strings they need to process. * read.c (read_all_makefiles): Made it take an array rather than argc and argv. (construct_include_path): Ditto. * make.c (collapse_continuations): Made it work right (I hope). * make.texinfo: Minor editorial changes. * read.c (read_makefile): Minor speed improvement by freeing and then mallocing something rather than reallocing it to avoid the unnecessary bcopy. Thu Aug 11 00:10:43 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.texinfo: Fixed some unquoted @'s. * make.texinfo: Documented multiple-target pattern rules. Miscellaneous minor editorial changes and corrections. * make.texinfo (Implicit: Catalogue of Rules): Removed the list of variables. That's what the next section is for. (Implicit: Implicit Variables): Made it agree with reality. Wed Aug 10 00:55:39 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * variable.c (print_variable_data_base): Fixed bug which made -p dump core. (This was a really idiotic bug.) * rule.c (pattern_search): Fixed a bug which made it make the `also_make' member of the file in question nil if the first of the successful rule's targets was the matching one. Made it use only as much storage as necessary in the `also_make' member. (create_pattern): Made it use only as much storage as necessary in the `lens' and `suffixes' members of the created rule. * remake.c (library_file_mtime): Made it `static'. * file.c: Added a declaration for `errno', which is declared in some 's, but not all. * file.h (struct file): Added `also_make' member for multiple-target implicit rules. * rule.c (pattern_search): Made it put the names of files updated by the given file's commands in its `also_make' member. * remake.c (update_file_1): Made it mark the files in a file's `also_make' member as updated when the file is updated. * variable.c (try_variable_definition): Fixed a bug which made it define a variable with the name of the whole definition when there was no space before the = or :=. * make.texinfo (Features): Made the changes which were made in RCS revision 2.7 but somehow lost since then. Added -W. Tue Aug 9 10:04:50 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * variable.h: Added `o_default' to `enum variable_origin'. * variable.c (print_variable_data_base): Made it print the origins of the variables. * rule.c (install_default_pattern_rules): Made it define the default variables with origin `o_default'. * make.texinfo: Documented -W. * make.c (decode_switches, main): Added the -W flag to give files a time-stamp of now, for a `what if' effect when used with -n. * commands.c (print_commands): Made it say `(built-in)' for commands that are built into the default ruleset. * read.c (record_file): Made .SUFFIXES get its deps frontwards (again). * rule.c (set_default_suffixes, convert_to_pattern): Made it read .SUFFIXES's deps frontwards, so the converted rules will not be in reverse order. * rule.c (new_pattern_rule): Fixed a bug wherein it would keep searching after it had removed a matching rule and ended up diddling with freed storage. * rule.c (freerule): Made it take the given rule off the chain. (new_pattern_rule, count_implicit_rule_limits): Use freerule to remove rules from the chain. * vpath.c (construct_vpath_list): Made it return after cleaning out all previous searchpaths when given a nil DIRPATH arg, so it won't go into the construction code and dump core dereferencing a nil pointer. * variable.c (patsubst_expand): Fixed a bug which made it not match correctly and sometimes dump core. Mon Aug 8 16:35:48 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * rule.c (default_suffix_rules): Made the .texinfo.dvi rule remove the files used in the comparison to determine whether or not a second TeX run is necessary. * make.texinfo: Fixed some overfull TeX hboxes. * make.texinfo (Implicit: Catalogue of Rules): Fixed a Texinfo error. * rule.c (create_pattern_rule): Fixed bug wherein index was not being passed its second arg. * read.c (getline): Merged back into readline. * rule.c (default_suffixes, default_suffix_rules, default_variables): Added .texinfo.info rule. * make.texinfo (Implicit: Catalogue of Rules): Documented .texinfo.dvi and .texinfo.info rules. * make.texinfo (Top): Changed `last updated' date to be correct (for the last time it was updated, not today). Changed `for version 3.00' since it's not going to be called that. Sat Aug 6 19:51:10 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * commands.c (print_commands): Added this function to print the contents of a `struct commands' for -p. * rule.c (print_rule_data_base): Use above. * file.c (print_file_data_base): Ditto. * rule.c (count_implicit_rule_limits, new_pattern_rule, install_pattern_rule, print_rule_data_base): Made it understand the changed `struct rule' and act accordingly. (freerule): Added this function to free all the storage used by a rule. * rule.c (pattern_search): Made it grok multiple targets of pattern rules. The matching is done properly, but at present, only the matching pattern's target is used to give deps and commands. Fri Aug 5 18:00:29 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * rule.c (struct rule): Changed name, namelen, and patsuffix members to targets, lens, and suffixes, which are arrays, for multiple targets. (create_pattern_rule): Now takes first arg TARGETS, a nil-terminated array of targets, rather than a single target and patsuffix pointer. * read.c (record_files): If it finds an implicit pattern rule, it collects all the targets into an array and passes the whole thing to create_pattern_rule. If there are non-pattern targets, it is a fatal error. Tue Aug 2 15:06:38 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.c (readline): Split backslash-newline checking from reading and buffer-expanding. (getline): Created to do the reading and buffer-expanding formerly done in readline. * rule.c (pattern_search): Made it reject nonterminal match-anything rules when a specific rule has matched, rather than rejecting terminal match-anything rules in this case. * rule.c (convert_to_pattern): Fixed a bug caused when the change to make it only recognize two-suffix rules whose target suffixes precede their dependency suffixes which made it work in the opposite direction (even worse than it started out). * rule.c (pattern_search): Made it reject nonterminal match-anything rules as intermediate targets when searching for both real and intermediate dependencies, rather than only when searching for intermediate ones. Sun Jul 31 00:33:56 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * rule.c (convert_to_pattern): Made it only recognize two-suffix rules whose target suffix comes before the dependency suffix in the .SUFFIXES list. * variable.c (define_automatic_variables): Made all automatic variables be defined with origin `o_automatic'. * variable.h: Added `o_automatic' to `enum variable_origin' * file.c (remove_intermediates): Made it not print an error message if the error was that the file does not exist. * rule.c: Removed `recursive' member from `struct rule'. * remake.c (library_file_mtime): Made it not use the directory hash functions, as reading in and hashing /usr/lib and /lib is slow and most likely unnecessary. * remake.c (remake_file): Changed message from ``No specification for making'' to ``No way to make'' so it will be short enough that most filenames will fit on a line. Made it look at the `recursive' member of the `struct commands', rather than of the `struct file' (which no longer has one). * commands.c (execute_file_commands): Made it look at the `recursive' member of the `struct commands', rather than of the `struct file' (which no longer has one). * file.h: Removed `recursive' member from `struct file'. * commands.h: Added `recursive' member to `struct commands'. * dep.h: Removed unused `quotedparen' member from `struct nameseq' and `struct dep'. * read.c (dequote): Removed this function. (multi_glob): Removed reference to `quotedparen' member of a `struct nameseq' and calls to dequote. * read.c (record_files): Made it set the stem for $* for all static pattern rules, not just those with commands given at that time. Removed check for recursive commands. Made it check for pairs of .SUFFIXES dependencies to reject as default goals as well as single ones (that don't start with dots). (read_makefile): Added checks for recursive commands to set the `recursive' flag in the `struct commands'. Sat Jul 30 15:47:23 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.c (find_next_token): Made the LENGTHPTR arg optionally nil. * make.c: Removed `files_made' variable which is defined static in remake.c and used only there. (main): Cleaned up somewhat. (decode_switches): Cleaned up a bit. Made an unknown option be a non-fatal error. (decode_env_switches): Made LEN arg unsigned. Cleaned up. (print_version): Made it say ``see the source'' rather than ``see the source file'', since there is more than one. * file.h: Made `num_intermediates' declared unsigned. * file.c: Made `num_intermediates' variable unsigned. (remove_intermediates): Removed unused FORMAT arg. (enter_file): Made it handle double-colon files properly, adding the new entry as the old entry's prev pointer. * dir.c: Re-indented the `struct dir' definition to be right. (dir_load): Cleaned up slightly. (file_exists_p): Removed comment saying we could use `access', since that is a bad idea (except for setuid programs). Cleaned up slightly. * commands.c: Changed some comments slightly. (execute_file_commands): Cleaned up a bit. Changed some comments, added others. Moved freeing of storage for $^ and $? to the same place as for the other automatic variables. (execute_command_line): Made `#' trigger a shell. Added some comments. Cleaned up a bit. Put all the special chars that trigger shells into an array easily changeable at the top. * ar.c: Added comments explaining each function. (ar_scan_1): Merged into ar_member_date. (ar_member_date): Changed call to ar_scan_1 to the body of that function. (ar_member_date_1): Simplified to a ?: expression rather than an if-else statement. (ar_member_touch): Changed error handling around a bit. None of these errors are fatal now. * variable.c (subst_expand): Added a new arg BY_WORD, to do substs only on full words. (patsubst_expand): Fixed bug which made calls whose patterns contained no `%' to not work correctly, by using above. (variable_expand): Pass extra arg to `subst_expand'. * variable.c (expand_function): Fixed bug which made `foreach' calls with one-word lists run off into never-never land. Fri Jul 29 20:12:36 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * variable.c (expand_function): Made a very minor speed improvement by avoiding an unnecessary strlen call. Wed Jul 27 16:01:47 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * rule.c (default_suffixes): Rearranged the list somewhat; added `.el' and `.elc' to speed things up (especially when building Emacs), for the same reason `.h' is there. * read.c (record_files): Changed `lineno' from `long' to `unsigned int'. Sun Jul 24 02:15:30 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * variable.c (expand_function): Eliminated use of `wstok' because it is non-reentrant and unreliable. Fixed a minor bug which would cause something not to be freed. * make.c (wstok): Removed `wstok' because it is no longer used. * variable.c (expand_function): Made `foreach' function put spaces between output texts like it's supposed to. Sat Jul 23 17:32:55 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * rule.c (default_suffixes, default_suffix_rules): Added rule to make %.dvi from %.texinfo. * dir.c (print_dir_data_base): Made it say a bit more. Fri Jul 22 23:13:16 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * make.c (print_data_base): Split this function up into one for each thing. * variable.c (print_variable_data_base): One of the above. * rule.c (print_rule_data_base): Ditto. * file.c (print_file_data_base): Ditto. * dir.c (print_dir_data_base): Ditto. * rule.c (install_pattern_rule): Fixed a bug which caused the terminal and recursive flags to always be zero for rules entered by this function. * make.texinfo (Rules: Double-colon): Added a paragraph explaining the purpose of double-colon rules. * make.texinfo (Implicit: Catalogue of Rules): Updated to reflect new C++, TeX, Web, and Texinfo rules. Other slight editorial changes. * commands.c (execute_file_commands): Fixed a bug wherein random memory could get written for files with no deps. Wed Jul 20 19:30:31 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * read.c (readline): Fix bug wherein it would not recognize a backslash-newline if the buffer filled up and was enlarged right before reading the newline. Tue Jul 19 19:55:02 1988 Roland McGrath (mcgrath at chilli.Berkeley.EDU) * read.c: Added default suffix rules for .cc (using $(C++), which defaults to `g++', and $(C++FLAGS)), .tex, .dvi, .web and .cweb (using $(TEX), $(WEAVE), $(TANGLE), $(CWEAVE) and $(CTANGLE)). Sat Jul 16 21:24:28 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * Made error formats use %u rather than %ld for line numbers, which are now unsigned int's rather than long's. * read.c (conditional_line): Fixed some bugs caused by use of unsigned int rather than int in one place. * read.c (conditional_line): Put the info about active conditionals in a struct. (read_makefile): Make a new struct of info about conditionals for included makefiles and restore the old one after the included makefile has been read. * read.c (read_makefile): Don't try to read a makefile with name "" after giving an error message because an `include' directive gave no filename. * read.c (read_makefile): Give an error message for non-whitespace text after the filename in an `include' directive. * make.c (error): Take five args, like `fatal'. It managed to lose with only two. Is there a better way to do this without vfprintf? * read.c (read_makefile): Commands consisting of only whitespace are not the same as no commands. I thought I'd fixed this bug months ago; it seems to have come back. * make.c (collapse_continuations): All whitespace around a backslash-newline combination is turned into a single space. * Added COPYING file and copyright notices to all files. * make.texinfo (Running: Goals): Fix a typo. * read.c (do_define): Take an arg for the origin of the variable being defined. (read_makefile): Grok `override define'. * make.texinfo (Variables: Override Directive, Defining): Document the `override define' combination directive. * ar.c (ar_member_date): Make a 0 return from `ar_scan' return (time_t) -1 (nonexistent file), rather than (time_t) 0, which, when put in the `struct file', makes `file_mtime' try to get the mtime over and over again. * variable.c (pattern_matches): Fix a bug that made patterns not beginning with `%' never match. Fri Jul 15 21:01:44 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU) * Took Make out of RCS. * Split the monolithic `make.c' into several smaller files. Copyright (C) 1988-2009 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . kbuild-3608/src/kmk/make_msvc_net2003.vcproj0000664000175000017500000001676514670377414020660 0ustar locutuslocutus kbuild-3608/src/kmk/getopt.c0000664000175000017500000007213114670377413015745 0ustar locutuslocutus/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987-2016 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. GNU Make 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. GNU Make 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 . */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO # define _NO_PROTO #endif #ifdef HAVE_CONFIG_H # include #endif #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ # ifndef const # define const # endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 # include # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ # include # include #endif /* GNU C library. */ #ifdef VMS # include # if HAVE_STRING_H - 0 # include # endif #endif /* This is for other GNU distributions with internationalized messages. When compiling libc, the _ macro is predefined. */ #include "gettext.h" #define _(msgid) gettext (msgid) /* This version of `getopt' appears to the caller like standard Unix 'getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ int __getopt_initialized = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ # include # define my_index strchr #else # if HAVE_STRING_H # include # else # include # endif #ifndef KMK /* Avoid depending on library functions or files whose names are inconsistent. */ #ifndef getenv extern char *getenv (); #endif #else /* KMK */ # include #endif /* KMK */ static char * my_index (const char *str, int chr) { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ # if (!defined __STDC__ || !__STDC__) && !defined strlen /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); # endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; #ifdef _LIBC /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; static int nonoption_flags_max_len; static int nonoption_flags_len; static int original_argc; static char *const *original_argv; /* Make sure the environment variable bash 2.0 puts in the environment is valid for the getopt call we must make sure that the ARGV passed to getopt is that one passed to the process. */ static void __attribute__ ((unused)) store_args_and_env (int argc, char *const *argv) { /* XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ original_argc = argc; original_argv = argv; } # ifdef text_set_element text_set_element (__libc_subinit, store_args_and_env); # endif /* text_set_element */ # define SWAP_FLAGS(ch1, ch2) \ if (nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined __STDC__ && __STDC__ static void exchange (char **); #endif static void exchange (char **argv) { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #ifdef _LIBC /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len), '\0', top + 1 - nonoption_flags_max_len); nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ #if defined __STDC__ && __STDC__ static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * _getopt_initialize (int argc, char *const *argv, const char *optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #ifdef _LIBC if (posixly_correct == NULL && argc == original_argc && argv == original_argv) { if (nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = nonoption_flags_max_len = strlen (orig_str); if (nonoption_flags_max_len < argc) nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } nonoption_flags_len = nonoption_flags_max_len; } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only) { optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #ifdef _LIBC # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ || (optind < nonoption_flags_len \ && __getopt_nonoption_flags[optind] == '1')) #else # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option '%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) { /* bird: disambiguate */ if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, _("%s: option '--%s' doesn't allow an argument\n"), argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, _("%s: option '%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); } nextchar += strlen (nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option '%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, _("%s: unrecognized option '--%s'\n"), argv[0], nextchar); else /* +option or -option */ fprintf (stderr, _("%s: unrecognized option '%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) fprintf (stderr, _("\ %s: option '-W %s' doesn't allow an argument\n"), argv[0], pfound->name); nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option '%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (int argc, char *const *argv, const char *optstring) { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* Not ELIDE_CODE. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value '%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ kbuild-3608/src/kmk/implicit.c0000664000175000017500000010374314670377414016262 0ustar locutuslocutus/* Implicit rule searching for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #include "filedef.h" #include "rule.h" #include "dep.h" #include "debug.h" #include "variable.h" #include "job.h" /* struct child, used inside commands.h */ #include "commands.h" /* set_file_variables */ static int pattern_search (struct file *file, int archive, unsigned int depth, unsigned int recursions); /* For a FILE which has no commands specified, try to figure out some from the implicit pattern rules. Returns 1 if a suitable implicit rule was found, after modifying FILE to contain the appropriate commands and deps, or returns 0 if no implicit rule was found. */ int try_implicit_rule (struct file *file, unsigned int depth) { DBF (DB_IMPLICIT, _("Looking for an implicit rule for '%s'.\n")); /* The order of these searches was previously reversed. My logic now is that since the non-archive search uses more information in the target (the archive search omits the archive name), it is more specific and should come first. */ if (pattern_search (file, 0, depth, 0)) return 1; #ifndef NO_ARCHIVES /* If this is an archive member reference, use just the archive member name to search for implicit rules. */ if (ar_name (file->name)) { DBF (DB_IMPLICIT, _("Looking for archive-member implicit rule for '%s'.\n")); if (pattern_search (file, 1, depth, 0)) return 1; } #endif return 0; } /* Scans the BUFFER for the next word with whitespace as a separator. Returns the pointer to the beginning of the word. LENGTH hold the length of the word. */ static const char * get_next_word (const char *buffer, unsigned int *length) { const char *p = buffer, *beg; char c; /* Skip any leading whitespace. */ NEXT_TOKEN (p); beg = p; c = *(p++); if (c == '\0') { if (length) /* bird: shut up gcc. */ *length = 0; return 0; } /* We already found the first value of "c", above. */ while (1) { char closeparen; int count; switch (c) { case '\0': case ' ': case '\t': goto done_word; case '$': c = *(p++); if (c == '$') break; /* This is a variable reference, so read it to the matching close paren. */ if (c == '(') closeparen = ')'; else if (c == '{') closeparen = '}'; else /* This is a single-letter variable reference. */ break; for (count = 0; *p != '\0'; ++p) { if (*p == c) ++count; else if (*p == closeparen && --count < 0) { ++p; break; } } break; case '|': goto done; default: break; } c = *(p++); } done_word: --p; done: if (length) *length = p - beg; return beg; } /* This structure stores information about the expanded prerequisites for a pattern rule. NAME is always set to the strcache'd name of the prereq. FILE and PATTERN will be set for intermediate files only. IGNORE_MTIME is copied from the prerequisite we expanded. */ struct patdeps { const char *name; const char *pattern; struct file *file; unsigned int ignore_mtime : 1; }; /* This structure stores information about pattern rules that we need to try. */ struct tryrule { struct rule *rule; /* Index of the target in this rule that matched the file. */ unsigned int matches; /* Stem length for this match. */ unsigned int stemlen; /* Definition order of this rule. Used to implement stable sort.*/ unsigned int order; /* Nonzero if the LASTSLASH logic was used in matching this rule. */ char checked_lastslash; }; int stemlen_compare (const void *v1, const void *v2) { const struct tryrule *r1 = v1; const struct tryrule *r2 = v2; int r = r1->stemlen - r2->stemlen; return r != 0 ? r : (int)(r1->order - r2->order); } /* Search the pattern rules for a rule with an existing dependency to make FILE. If a rule is found, the appropriate commands and deps are put in FILE and 1 is returned. If not, 0 is returned. If ARCHIVE is nonzero, FILE->name is of the form "LIB(MEMBER)". A rule for "(MEMBER)" will be searched for, and "(MEMBER)" will not be chopped up into directory and filename parts. If an intermediate file is found by pattern search, the intermediate file is set up as a target by the recursive call and is also made a dependency of FILE. DEPTH is used for debugging messages. */ static int pattern_search (struct file *file, int archive, unsigned int depth, unsigned int recursions) { /* Filename we are searching for a rule for. */ const char *filename = archive ? strchr (file->name, '(') : file->name; /* Length of FILENAME. */ unsigned int namelen = strlen (filename); /* The last slash in FILENAME (or nil if there is none). */ const char *lastslash; /* This is a file-object used as an argument in recursive calls. It never contains any data except during a recursive call. */ struct file *int_file = 0; /* List of dependencies found recursively. */ unsigned int max_deps = max_pattern_deps; struct patdeps *deplist = xmalloc (max_deps * sizeof (struct patdeps)); struct patdeps *pat = deplist; /* Names of possible dependencies are constructed in this buffer. */ char *depname = alloca (namelen + max_pattern_dep_length); /* The start and length of the stem of FILENAME for the current rule. */ const char *stem = 0; unsigned int stemlen = 0; unsigned int fullstemlen = 0; /* Buffer in which we store all the rules that are possibly applicable. */ struct tryrule *tryrules = xmalloc (num_pattern_rules * max_pattern_targets * sizeof (struct tryrule)); /* Number of valid elements in TRYRULES. */ unsigned int nrules; /* The index in TRYRULES of the rule we found. */ unsigned int foundrule; /* Nonzero if should consider intermediate files as dependencies. */ int intermed_ok; /* Nonzero if we have initialized file variables for this target. */ int file_vars_initialized = 0; /* Nonzero if we have matched a pattern-rule target that is not just '%'. */ int specific_rule_matched = 0; unsigned int ri; /* uninit checks OK */ struct rule *rule; char *pathdir = NULL; unsigned long pathlen; PATH_VAR (stem_str); /* @@ Need to get rid of stem, stemlen, etc. */ #ifndef NO_ARCHIVES if (archive || ar_name (filename)) lastslash = 0; else #endif { /* Set LASTSLASH to point at the last slash in FILENAME but not counting any slash at the end. (foo/bar/ counts as bar/ in directory foo/, not empty in directory foo/bar/.) */ lastslash = strrchr (filename, '/'); #ifdef VMS if (lastslash == NULL) lastslash = strrchr (filename, ']'); if (lastslash == NULL) lastslash = strrchr (filename, '>'); if (lastslash == NULL) lastslash = strrchr (filename, ':'); #endif #ifdef HAVE_DOS_PATHS /* Handle backslashes (possibly mixed with forward slashes) and the case of "d:file". */ { char *bslash = strrchr (filename, '\\'); if (lastslash == 0 || bslash > lastslash) lastslash = bslash; if (lastslash == 0 && filename[0] && filename[1] == ':') lastslash = filename + 1; } #endif if (lastslash != 0 && lastslash[1] == '\0') lastslash = 0; } pathlen = lastslash - filename + 1; /* First see which pattern rules match this target and may be considered. Put them in TRYRULES. */ nrules = 0; for (rule = pattern_rules; rule != 0; rule = rule->next) { unsigned int ti; /* If the pattern rule has deps but no commands, ignore it. Users cancel built-in rules by redefining them without commands. */ if (rule->deps != 0 && rule->cmds == 0) continue; /* If this rule is in use by a parent pattern_search, don't use it here. */ if (rule->in_use) { DBS (DB_IMPLICIT, (_("Avoiding implicit rule recursion.\n"))); continue; } for (ti = 0; ti < rule->num; ++ti) { const char *target = rule->targets[ti]; const char *suffix = rule->suffixes[ti]; char check_lastslash; /* Rules that can match any filename and are not terminal are ignored if we're recursing, so that they cannot be intermediate files. */ if (recursions > 0 && target[1] == '\0' && !rule->terminal) continue; if (rule->lens[ti] > namelen) /* It can't possibly match. */ continue; /* From the lengths of the filename and the pattern parts, find the stem: the part of the filename that matches the %. */ stem = filename + (suffix - target - 1); stemlen = namelen - rule->lens[ti] + 1; /* Set CHECK_LASTSLASH if FILENAME contains a directory prefix and the target pattern does not contain a slash. */ check_lastslash = 0; if (lastslash) { #ifdef VMS check_lastslash = strpbrk (target, "/]>:") == NULL; #else check_lastslash = strchr (target, '/') == 0; #endif #ifdef HAVE_DOS_PATHS /* Didn't find it yet: check for DOS-type directories. */ if (check_lastslash) { char *b = strchr (target, '\\'); check_lastslash = !(b || (target[0] && target[1] == ':')); } #endif } if (check_lastslash) { /* If so, don't include the directory prefix in STEM here. */ if (pathlen > stemlen) continue; stemlen -= pathlen; stem += pathlen; } /* Check that the rule pattern matches the text before the stem. */ if (check_lastslash) { if (stem > (lastslash + 1) && !strneq (target, lastslash + 1, stem - lastslash - 1)) continue; } else if (stem > filename && !strneq (target, filename, stem - filename)) continue; /* Check that the rule pattern matches the text after the stem. We could test simply use streq, but this way we compare the first two characters immediately. This saves time in the very common case where the first character matches because it is a period. */ if (*suffix != stem[stemlen] || (*suffix != '\0' && !streq (&suffix[1], &stem[stemlen + 1]))) continue; /* Record if we match a rule that not all filenames will match. */ if (target[1] != '\0') specific_rule_matched = 1; /* A rule with no dependencies and no commands exists solely to set specific_rule_matched when it matches. Don't try to use it. */ if (rule->deps == 0 && rule->cmds == 0) continue; /* Record this rule in TRYRULES and the index of the matching target in MATCHES. If several targets of the same rule match, that rule will be in TRYRULES more than once. */ tryrules[nrules].rule = rule; tryrules[nrules].matches = ti; tryrules[nrules].stemlen = stemlen + (check_lastslash ? pathlen : 0); tryrules[nrules].order = nrules; tryrules[nrules].checked_lastslash = check_lastslash; ++nrules; } } /* Bail out early if we haven't found any rules. */ if (nrules == 0) goto done; /* Sort the rules to place matches with the shortest stem first. This way the most specific rules will be tried first. */ if (nrules > 1) qsort (tryrules, nrules, sizeof (struct tryrule), stemlen_compare); /* If we have found a matching rule that won't match all filenames, retroactively reject any non-"terminal" rules that do always match. */ if (specific_rule_matched) for (ri = 0; ri < nrules; ++ri) if (!tryrules[ri].rule->terminal) { unsigned int j; for (j = 0; j < tryrules[ri].rule->num; ++j) if (tryrules[ri].rule->targets[j][1] == '\0') { tryrules[ri].rule = 0; break; } } /* Try each rule once without intermediate files, then once with them. */ for (intermed_ok = 0; intermed_ok < 2; ++intermed_ok) { pat = deplist; /* Try each pattern rule till we find one that applies. If it does, expand its dependencies (as substituted) and chain them in DEPS. */ for (ri = 0; ri < nrules; ri++) { struct dep *dep; char check_lastslash; unsigned int failed = 0; int file_variables_set = 0; unsigned int deps_found = 0; /* NPTR points to the part of the prereq we haven't processed. */ const char *nptr = 0; const char *dir = NULL; int order_only = 0; unsigned int matches; rule = tryrules[ri].rule; /* RULE is nil when we discover that a rule, already placed in TRYRULES, should not be applied. */ if (rule == 0) continue; /* Reject any terminal rules if we're looking to make intermediate files. */ if (intermed_ok && rule->terminal) continue; /* From the lengths of the filename and the matching pattern parts, find the stem: the part of the filename that matches the %. */ matches = tryrules[ri].matches; stem = filename + (rule->suffixes[matches] - rule->targets[matches]) - 1; stemlen = (namelen - rule->lens[matches]) + 1; check_lastslash = tryrules[ri].checked_lastslash; if (check_lastslash) { stem += pathlen; stemlen -= pathlen; /* We need to add the directory prefix, so set it up. */ if (! pathdir) { pathdir = alloca (pathlen + 1); memcpy (pathdir, filename, pathlen); pathdir[pathlen] = '\0'; } dir = pathdir; } if (stemlen > GET_PATH_MAX) { DBS (DB_IMPLICIT, (_("Stem too long: '%.*s'.\n"), (int) stemlen, stem)); continue; } DBS (DB_IMPLICIT, (_("Trying pattern rule with stem '%.*s'.\n"), (int) stemlen, stem)); strncpy (stem_str, stem, stemlen); stem_str[stemlen] = '\0'; /* If there are no prerequisites, then this rule matches. */ if (rule->deps == 0) break; /* Temporary assign STEM to file->stem (needed to set file variables below). */ file->stem = stem_str; /* Mark this rule as in use so a recursive pattern_search won't try to use it. */ rule->in_use = 1; /* Try each prerequisite; see if it exists or can be created. We'll build a list of prereq info in DEPLIST. Due to 2nd expansion we may have to process multiple prereqs for a single dep entry. */ pat = deplist; dep = rule->deps; nptr = dep_name (dep); while (1) { struct dep *dl, *d; char *p; /* If we're out of name to parse, start the next prereq. */ if (! nptr) { dep = dep->next; if (dep == 0) break; nptr = dep_name (dep); } /* If we don't need a second expansion, just replace the %. */ if (! dep->need_2nd_expansion) { p = strchr (nptr, '%'); if (p == 0) strcpy (depname, nptr); else { char *o = depname; if (check_lastslash) { memcpy (o, filename, pathlen); o += pathlen; } memcpy (o, nptr, p - nptr); o += p - nptr; memcpy (o, stem_str, stemlen); o += stemlen; strcpy (o, p + 1); } /* Parse the expanded string. It might have wildcards. */ p = depname; dl = PARSE_SIMPLE_SEQ (&p, struct dep); for (d = dl; d != NULL; d = d->next) { ++deps_found; d->ignore_mtime = dep->ignore_mtime; } /* We've used up this dep, so next time get a new one. */ nptr = 0; } /* We have to perform second expansion on this prereq. In an ideal world we would take the dependency line, substitute the stem, re-expand the whole line and chop it into individual prerequisites. Unfortunately this won't work because of the "check_lastslash" twist. Instead, we will have to go word by word, taking $()'s into account. For each word we will substitute the stem, re-expand, chop it up, and, if check_lastslash != 0, add the directory part to each resulting prerequisite. */ else { int add_dir = 0; unsigned int len; struct dep **dptr; nptr = get_next_word (nptr, &len); if (nptr == 0) continue; /* See this is a transition to order-only prereqs. */ if (! order_only && len == 1 && nptr[0] == '|') { order_only = 1; nptr += len; continue; } /* If the dependency name has %, substitute the stem. If we just replace % with the stem value then later, when we do the 2nd expansion, we will re-expand this stem value again. This is not good if you have certain characters in your stem (like $). Instead, we will replace % with $* and allow the second expansion to take care of it for us. This way (since $* is a simple variable) there won't be additional re-expansion of the stem. */ p = lindex (nptr, nptr + len, '%'); if (p == 0) { memcpy (depname, nptr, len); depname[len] = '\0'; } else { unsigned int i = p - nptr; memcpy (depname, nptr, i); memcpy (depname + i, "$*", 2); memcpy (depname + i + 2, p + 1, len - i - 1); depname[len + 2 - 1] = '\0'; if (check_lastslash) add_dir = 1; } /* Set up for the next word. */ nptr += len; /* Initialize and set file variables if we haven't already done so. */ if (!file_vars_initialized) { initialize_file_variables (file, 0); #if defined(CONFIG_WITH_COMMANDS_FUNC) || defined (CONFIG_WITH_DOT_MUST_MAKE) set_file_variables (file, 0 /* real call */); #else set_file_variables (file); #endif file_vars_initialized = 1; } /* Update the stem value in $* for this rule. */ else if (!file_variables_set) { define_variable_for_file ( "*", 1, file->stem, o_automatic, 0, file); file_variables_set = 1; } /* Perform the 2nd expansion. */ p = variable_expand_for_file (depname, file); dptr = &dl; /* Parse the results into a deps list. */ do { /* Parse the expanded string. */ struct dep *dp = PARSE_FILE_SEQ (&p, struct dep, order_only ? MAP_NUL : MAP_PIPE, add_dir ? dir : NULL, PARSEFS_NONE); *dptr = dp; for (d = dp; d != NULL; d = d->next) { ++deps_found; if (order_only) d->ignore_mtime = 1; dptr = &d->next; } /* If we stopped due to an order-only token, note it. */ if (*p == '|') { order_only = 1; ++p; } } while (*p != '\0'); } /* If there are more than max_pattern_deps prerequisites (due to 2nd expansion), reset it and realloc the arrays. */ if (deps_found > max_deps) { unsigned int l = pat - deplist; /* This might have changed due to recursion. */ max_pattern_deps = MAX(max_pattern_deps, deps_found); max_deps = max_pattern_deps; deplist = xrealloc (deplist, max_deps * sizeof (struct patdeps)); pat = deplist + l; } /* Go through the nameseq and handle each as a prereq name. */ for (d = dl; d != 0; d = d->next) { struct dep *expl_d; int is_rule = d->name == dep_name (dep); if (file_impossible_p (d->name)) { /* If this prereq has already been ruled "impossible", then the rule fails. Don't bother trying it on the second pass either since we know that will fail. */ DBS (DB_IMPLICIT, (is_rule ? _("Rejecting impossible rule prerequisite '%s'.\n") : _("Rejecting impossible implicit prerequisite '%s'.\n"), d->name)); tryrules[ri].rule = 0; failed = 1; break; } memset (pat, '\0', sizeof (struct patdeps)); pat->ignore_mtime = d->ignore_mtime; DBS (DB_IMPLICIT, (is_rule ? _("Trying rule prerequisite '%s'.\n") : _("Trying implicit prerequisite '%s'.\n"), d->name)); /* If this prereq is also explicitly mentioned for FILE, skip all tests below since it must be built no matter which implicit rule we choose. */ for (expl_d = file->deps; expl_d != 0; expl_d = expl_d->next) if (streq (dep_name (expl_d), d->name)) break; if (expl_d != 0) { (pat++)->name = d->name; continue; } /* The DEP->changed flag says that this dependency resides in a nonexistent directory. So we normally can skip looking for the file. However, if CHECK_LASTSLASH is set, then the dependency file we are actually looking for is in a different directory (the one gotten by prepending FILENAME's directory), so it might actually exist. */ /* @@ dep->changed check is disabled. */ if (lookup_file (d->name) != 0 /*|| ((!dep->changed || check_lastslash) && */ || file_exists_p (d->name)) { (pat++)->name = d->name; continue; } /* This code, given FILENAME = "lib/foo.o", dependency name "lib/foo.c", and VPATH=src, searches for "src/lib/foo.c". */ { const char *vname = vpath_search (d->name, 0, NULL, NULL); if (vname) { DBS (DB_IMPLICIT, (_("Found prerequisite '%s' as VPATH '%s'\n"), d->name, vname)); (pat++)->name = d->name; continue; } } /* We could not find the file in any place we should look. Try to make this dependency as an intermediate file, but only on the second pass. */ if (intermed_ok) { DBS (DB_IMPLICIT, (_("Looking for a rule with intermediate file '%s'.\n"), d->name)); if (int_file == 0) int_file = alloca (sizeof (struct file)); memset (int_file, '\0', sizeof (struct file)); int_file->name = d->name; if (pattern_search (int_file, 0, depth + 1, recursions + 1)) { pat->pattern = int_file->name; int_file->name = d->name; pat->file = int_file; int_file = 0; (pat++)->name = d->name; continue; } /* If we have tried to find P as an intermediate file and failed, mark that name as impossible so we won't go through the search again later. */ if (int_file->variables) free_variable_set (int_file->variables); if (int_file->pat_variables) free_variable_set (int_file->pat_variables); file_impossible (d->name); } /* A dependency of this rule does not exist. Therefore, this rule fails. */ failed = 1; break; } /* Free the ns chain. */ free_dep_chain (dl); if (failed) break; } /* Reset the stem in FILE. */ file->stem = 0; /* This rule is no longer 'in use' for recursive searches. */ rule->in_use = 0; if (! failed) /* This pattern rule does apply. Stop looking for one. */ break; /* This pattern rule does not apply. Keep looking. */ } /* If we found an applicable rule without intermediate files, don't try with them. */ if (ri < nrules) break; rule = 0; } /* RULE is nil if the loop went through the list but everything failed. */ if (rule == 0) goto done; foundrule = ri; /* If we are recursing, store the pattern that matched FILENAME in FILE->name for use in upper levels. */ if (recursions > 0) /* Kludge-o-matic */ file->name = rule->targets[tryrules[foundrule].matches]; /* DEPLIST lists the prerequisites for the rule we found. This includes the intermediate files, if any. Convert them into entries on the deps-chain of FILE. */ while (pat-- > deplist) { struct dep *dep; const char *s; if (pat->file != 0) { /* If we need to use an intermediate file, make sure it is entered as a target, with the info that was found for it in the recursive pattern_search call. We know that the intermediate file did not already exist as a target; therefore we can assume that the deps and cmds of F below are null before we change them. */ struct file *imf = pat->file; struct file *f = lookup_file (imf->name); /* We don't want to delete an intermediate file that happened to be a prerequisite of some (other) target. Mark it as secondary. We don't want it to be precious as that disables DELETE_ON_ERROR etc. */ if (f != 0) f->secondary = 1; else f = enter_file (imf->name); f->deps = imf->deps; f->cmds = imf->cmds; f->stem = imf->stem; f->variables = imf->variables; f->pat_variables = imf->pat_variables; f->pat_searched = imf->pat_searched; f->also_make = imf->also_make; f->is_target = 1; f->intermediate = 1; f->tried_implicit = 1; imf = lookup_file (pat->pattern); if (imf != 0 && imf->precious) f->precious = 1; for (dep = f->deps; dep != 0; dep = dep->next) { dep->file = enter_file (dep->name); dep->name = 0; dep->file->tried_implicit |= dep->changed; } } dep = alloc_dep (); dep->ignore_mtime = pat->ignore_mtime; s = strcache_add (pat->name); if (recursions) dep->name = s; else { dep->file = lookup_file (s); if (dep->file == 0) dep->file = enter_file (s); } if (pat->file == 0 && tryrules[foundrule].rule->terminal) { /* If the file actually existed (was not an intermediate file), and the rule that found it was a terminal one, then we want to mark the found file so that it will not have implicit rule search done for it. If we are not entering a 'struct file' for it now, we indicate this with the 'changed' flag. */ if (dep->file == 0) dep->changed = 1; else dep->file->tried_implicit = 1; } dep->next = file->deps; file->deps = dep; } if (!tryrules[foundrule].checked_lastslash) { /* Always allocate new storage, since STEM might be on the stack for an intermediate file. */ file->stem = strcache_add_len (stem, stemlen); fullstemlen = stemlen; } else { int dirlen = (lastslash + 1) - filename; char *sp; /* We want to prepend the directory from the original FILENAME onto the stem. */ fullstemlen = dirlen + stemlen; sp = alloca (fullstemlen + 1); memcpy (sp, filename, dirlen); memcpy (sp + dirlen, stem, stemlen); sp[fullstemlen] = '\0'; #ifndef CONFIG_WITH_VALUE_LENGTH file->stem = strcache_add (sp); #else file->stem = strcache_add_len (sp, fullstemlen); #endif } file->cmds = rule->cmds; file->is_target = 1; /* Set precious flag. */ { struct file *f = lookup_file (rule->targets[tryrules[foundrule].matches]); if (f && f->precious) file->precious = 1; } /* If this rule builds other targets, too, put the others into FILE's 'also_make' member. */ if (rule->num > 1) for (ri = 0; ri < rule->num; ++ri) if (ri != tryrules[foundrule].matches) { char *nm = alloca (rule->lens[ri] + fullstemlen + 1); char *p = nm; struct file *f; struct dep *new = alloc_dep (); /* GKM FIMXE: handle '|' here too */ memcpy (p, rule->targets[ri], rule->suffixes[ri] - rule->targets[ri] - 1); p += rule->suffixes[ri] - rule->targets[ri] - 1; memcpy (p, file->stem, fullstemlen); p += fullstemlen; memcpy (p, rule->suffixes[ri], rule->lens[ri] - (rule->suffixes[ri] - rule->targets[ri])+1); new->name = strcache_add (nm); new->file = enter_file (new->name); new->next = file->also_make; /* Set precious flag. */ f = lookup_file (rule->targets[ri]); if (f && f->precious) new->file->precious = 1; /* Set the is_target flag so that this file is not treated as intermediate by the pattern rule search algorithm and file_exists_p cannot pick it up yet. */ new->file->is_target = 1; file->also_make = new; } done: free (tryrules); free (deplist); return rule != 0; } kbuild-3608/src/kmk/NMakefile.template0000664000175000017500000001017214670377413017664 0ustar locutuslocutus# -*-Makefile-*- to build GNU make with nmake # # NOTE: If you have no 'make' program at all to process this makefile, # run 'build_w32.bat' instead. # # Copyright (C) 1996-2016 Free Software Foundation, Inc. # This file is part of GNU Make. # # GNU Make 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. # # GNU Make 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 . LINK = link CC = cl MAKE = nmake OUTDIR=. MAKEFILE=NMakefile SUBPROC_MAKEFILE=NMakefile CFLAGS_any = /nologo /MT /W4 /GX /Zi /YX /I . /I glob /I w32/include /D WIN32 /D WINDOWS32 /D _CONSOLE /D HAVE_CONFIG_H CFLAGS_debug = $(CFLAGS_any) /Od /D DEBUG /D _DEBUG /FR.\WinDebug/ /Fp.\WinDebug/make.pch /Fo.\WinDebug/ /Fd.\WinDebug/make.pdb CFLAGS_release = $(CFLAGS_any) /O2 /D NDEBUG /FR.\WinRel/ /Fp.\WinRel/make.pch /Fo.\WinRel/ LDFLAGS_debug = w32\subproc\WinDebug\subproc.lib /NOLOGO /SUBSYSTEM:console\ /STACK:0x400000 /INCREMENTAL:no /PDB:WinDebug/make.pdb /OUT:WinDebug/make.exe /DEBUG LDFLAGS_release = w32\subproc\WinRel\subproc.lib /NOLOGO /SUBSYSTEM:console\ /STACK:0x400000 /INCREMENTAL:no /OUT:WinRel/make.exe all: config.h subproc Release Debug # # Make sure we build the subproc library first. It has it's own # makefile. To be portable to Windows 95, we put the instructions # on how to build the library into a batch file. On NT, we could # simply have done foo && bar && dog, but this doesn't port. # subproc: w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib: w32/subproc/misc.c w32/subproc/sub_proc.c w32/subproc/w32err.c subproc.bat $(SUBPROC_MAKEFILE) $(MAKE) if exist WinDebug\make.exe erase WinDebug\make.exe if exist WinRel\make.exe erase WinRel\make.exe config.h: config.h.W32 copy $? $@ Release: $(MAKE) /f $(MAKEFILE) LDFLAGS="$(LDFLAGS_release)" CFLAGS="$(CFLAGS_release)" OUTDIR=WinRel WinRel/make.exe Debug: $(MAKE) /f $(MAKEFILE) LDFLAGS="$(LDFLAGS_debug)" CFLAGS="$(CFLAGS_debug)" OUTDIR=WinDebug WinDebug/make.exe clean: if exist WinDebug\nul rmdir /s /q WinDebug if exist WinRel\nul rmdir /s /q WinRel if exist w32\subproc\WinDebug\nul rmdir /s /q w32\subproc\WinDebug if exist w32\subproc\WinRel\nul rmdir /s /q w32\subproc\WinRel if exist config.h erase config.h erase *.pdb $(OUTDIR): if not exist .\$@\nul mkdir .\$@ LIBS = kernel32.lib user32.lib advapi32.lib guile = $(OUTDIR)/guile.obj OBJS = \ $(OUTDIR)/ar.obj \ $(OUTDIR)/arscan.obj \ $(OUTDIR)/commands.obj \ $(OUTDIR)/default.obj \ $(OUTDIR)/dir.obj \ $(OUTDIR)/expand.obj \ $(OUTDIR)/file.obj \ $(OUTDIR)/function.obj \ $(OUTDIR)/getloadavg.obj \ $(OUTDIR)/getopt.obj \ $(OUTDIR)/getopt1.obj \ $(OUTDIR)/hash.obj \ $(OUTDIR)/implicit.obj \ $(OUTDIR)/job.obj \ $(OUTDIR)/load.obj \ $(OUTDIR)/main.obj \ $(OUTDIR)/misc.obj \ $(OUTDIR)/output.obj \ $(OUTDIR)/read.obj \ $(OUTDIR)/remake.obj \ $(OUTDIR)/remote-stub.obj \ $(OUTDIR)/rule.obj \ $(OUTDIR)/signame.obj \ $(OUTDIR)/strcache.obj \ $(OUTDIR)/variable.obj \ $(OUTDIR)/version.obj \ $(OUTDIR)/vpath.obj \ $(OUTDIR)/glob.obj \ $(OUTDIR)/fnmatch.obj \ $(OUTDIR)/dirent.obj \ $(OUTDIR)/pathstuff.obj \ $(OUTDIR)/posixfcn.obj \ $(OUTDIR)/w32os.obj \ $(guile) $(OUTDIR)/make.exe: $(OUTDIR) $(OBJS) $(LINK) @<< $(LDFLAGS) $(LIBS) $(OBJS) << .c{$(OUTDIR)}.obj: $(CC) $(CFLAGS) /c $< $(OUTDIR)/glob.obj : glob/glob.c $(CC) $(CFLAGS) /c $? $(OUTDIR)/fnmatch.obj : glob/fnmatch.c $(CC) $(CFLAGS) /c $? $(OUTDIR)/dirent.obj : w32/compat/dirent.c $(CC) $(CFLAGS) /c $? $(OUTDIR)/posixfcn.obj : w32/compat/posixfcn.c $(CC) $(CFLAGS) /c $? $(OUTDIR)/pathstuff.obj : w32/pathstuff.c $(CC) $(CFLAGS) /c $? $(OUTDIR)/w32os.obj : w32/w32os.c $(CC) $(CFLAGS) /c $? kbuild-3608/src/kmk/rule.c0000664000175000017500000003654014670377414015417 0ustar locutuslocutus/* Pattern and suffix rule internals for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #include #include "filedef.h" #include "dep.h" #include "job.h" #include "commands.h" #include "variable.h" #include "rule.h" static void freerule (struct rule *rule, struct rule *lastrule); /* Chain of all pattern rules. */ struct rule *pattern_rules; /* Pointer to last rule in the chain, so we can add onto the end. */ struct rule *last_pattern_rule; /* Number of rules in the chain. */ unsigned int num_pattern_rules; /* Maximum number of target patterns of any pattern rule. */ unsigned int max_pattern_targets; /* Maximum number of dependencies of any pattern rule. */ unsigned int max_pattern_deps; /* Maximum length of the name of a dependencies of any pattern rule. */ unsigned int max_pattern_dep_length; /* Pointer to structure for the file .SUFFIXES whose dependencies are the suffixes to be searched. */ struct file *suffix_file; /* Maximum length of a suffix. */ unsigned int maxsuffix; /* Compute the maximum dependency length and maximum number of dependencies of all implicit rules. Also sets the subdir flag for a rule when appropriate, possibly removing the rule completely when appropriate. */ void count_implicit_rule_limits (void) { char *name; int namelen; struct rule *rule; num_pattern_rules = max_pattern_targets = max_pattern_deps = 0; max_pattern_dep_length = 0; name = 0; namelen = 0; rule = pattern_rules; while (rule != 0) { unsigned int ndeps = 0; struct dep *dep; struct rule *next = rule->next; ++num_pattern_rules; if (rule->num > max_pattern_targets) max_pattern_targets = rule->num; for (dep = rule->deps; dep != 0; dep = dep->next) { const char *dname = dep_name (dep); unsigned int len = strlen (dname); #ifdef VMS const char *p = strrchr (dname, ']'); const char *p2; if (p == 0) p = strrchr (dname, ':'); p2 = p != 0 ? strchr (dname, '%') : 0; #else const char *p = strrchr (dname, '/'); const char *p2 = p != 0 ? strchr (dname, '%') : 0; #endif ndeps++; if (len > max_pattern_dep_length) max_pattern_dep_length = len; if (p != 0 && p2 > p) { /* There is a slash before the % in the dep name. Extract the directory name. */ if (p == dname) ++p; if (p - dname > namelen) { namelen = p - dname; name = xrealloc (name, namelen + 1); } memcpy (name, dname, p - dname); name[p - dname] = '\0'; /* In the deps of an implicit rule the 'changed' flag actually indicates that the dependency is in a nonexistent subdirectory. */ dep->changed = !dir_file_exists_p (name, ""); } else /* This dependency does not reside in a subdirectory. */ dep->changed = 0; } if (ndeps > max_pattern_deps) max_pattern_deps = ndeps; rule = next; } free (name); } /* Create a pattern rule from a suffix rule. TARGET is the target suffix; SOURCE is the source suffix. CMDS are the commands. If TARGET is nil, it means the target pattern should be '(%.o)'. If SOURCE is nil, it means there should be no deps. */ static void convert_suffix_rule (const char *target, const char *source, struct commands *cmds) { const char **names, **percents; struct dep *deps; names = xmalloc (sizeof (const char *)); percents = xmalloc (sizeof (const char *)); if (target == 0) { /* Special case: TARGET being nil means we are defining a '.X.a' suffix rule; the target pattern is always '(%.o)'. */ #ifdef VMS *names = strcache_add_len ("(%.obj)", 7); #else *names = strcache_add_len ("(%.o)", 5); #endif *percents = *names + 1; } else { /* Construct the target name. */ unsigned int len = strlen (target); char *p = alloca (1 + len + 1); p[0] = '%'; memcpy (p + 1, target, len + 1); *names = strcache_add_len (p, len + 1); *percents = *names; } if (source == 0) deps = 0; else { /* Construct the dependency name. */ unsigned int len = strlen (source); char *p = alloca (1 + len + 1); p[0] = '%'; memcpy (p + 1, source, len + 1); deps = alloc_dep (); deps->name = strcache_add_len (p, len + 1); } create_pattern_rule (names, percents, 1, 0, deps, cmds, 0); } /* Convert old-style suffix rules to pattern rules. All rules for the suffixes on the .SUFFIXES list are converted and added to the chain of pattern rules. */ void convert_to_pattern (void) { struct dep *d, *d2; char *rulename; /* We will compute every potential suffix rule (.x.y) from the list of suffixes in the .SUFFIXES target's dependencies and see if it exists. First find the longest of the suffixes. */ maxsuffix = 0; for (d = suffix_file->deps; d != 0; d = d->next) { unsigned int l = strlen (dep_name (d)); if (l > maxsuffix) maxsuffix = l; } /* Space to construct the suffix rule target name. */ rulename = alloca ((maxsuffix * 2) + 1); for (d = suffix_file->deps; d != 0; d = d->next) { unsigned int slen; /* Make a rule that is just the suffix, with no deps or commands. This rule exists solely to disqualify match-anything rules. */ convert_suffix_rule (dep_name (d), 0, 0); if (d->file->cmds != 0) /* Record a pattern for this suffix's null-suffix rule. */ convert_suffix_rule ("", dep_name (d), d->file->cmds); /* Add every other suffix to this one and see if it exists as a two-suffix rule. */ slen = strlen (dep_name (d)); memcpy (rulename, dep_name (d), slen); for (d2 = suffix_file->deps; d2 != 0; d2 = d2->next) { struct file *f; unsigned int s2len; s2len = strlen (dep_name (d2)); /* Can't build something from itself. */ if (slen == s2len && streq (dep_name (d), dep_name (d2))) continue; memcpy (rulename + slen, dep_name (d2), s2len + 1); f = lookup_file (rulename); if (f == 0 || f->cmds == 0) continue; if (s2len == 2 && rulename[slen] == '.' && rulename[slen + 1] == 'a') /* A suffix rule '.X.a:' generates the pattern rule '(%.o): %.X'. It also generates a normal '%.a: %.X' rule below. */ convert_suffix_rule (NULL, /* Indicates '(%.o)'. */ dep_name (d), f->cmds); /* The suffix rule '.X.Y:' is converted to the pattern rule '%.Y: %.X'. */ convert_suffix_rule (dep_name (d2), dep_name (d), f->cmds); } } } /* Install the pattern rule RULE (whose fields have been filled in) at the end of the list (so that any rules previously defined will take precedence). If this rule duplicates a previous one (identical target and dependencies), the old one is replaced if OVERRIDE is nonzero, otherwise this new one is thrown out. When an old rule is replaced, the new one is put at the end of the list. Return nonzero if RULE is used; zero if not. */ static int new_pattern_rule (struct rule *rule, int override) { struct rule *r, *lastrule; unsigned int i, j; rule->in_use = 0; rule->terminal = 0; rule->next = 0; /* Search for an identical rule. */ lastrule = 0; for (r = pattern_rules; r != 0; lastrule = r, r = r->next) for (i = 0; i < rule->num; ++i) { for (j = 0; j < r->num; ++j) if (!streq (rule->targets[i], r->targets[j])) break; /* If all the targets matched... */ if (j == r->num) { struct dep *d, *d2; for (d = rule->deps, d2 = r->deps; d != 0 && d2 != 0; d = d->next, d2 = d2->next) if (!streq (dep_name (d), dep_name (d2))) break; if (d == 0 && d2 == 0) { /* All the dependencies matched. */ if (override) { /* Remove the old rule. */ freerule (r, lastrule); /* Install the new one. */ if (pattern_rules == 0) pattern_rules = rule; else last_pattern_rule->next = rule; last_pattern_rule = rule; /* We got one. Stop looking. */ goto matched; } else { /* The old rule stays intact. Destroy the new one. */ freerule (rule, (struct rule *) 0); return 0; } } } } matched:; if (r == 0) { /* There was no rule to replace. */ if (pattern_rules == 0) pattern_rules = rule; else last_pattern_rule->next = rule; last_pattern_rule = rule; } return 1; } /* Install an implicit pattern rule based on the three text strings in the structure P points to. These strings come from one of the arrays of default implicit pattern rules. TERMINAL specifies what the 'terminal' field of the rule should be. */ void install_pattern_rule (struct pspec *p, int terminal) { struct rule *r; const char *ptr; r = xmalloc (sizeof (struct rule)); r->num = 1; r->targets = xmalloc (sizeof (const char *)); r->suffixes = xmalloc (sizeof (const char *)); r->lens = xmalloc (sizeof (unsigned int)); r->lens[0] = strlen (p->target); r->targets[0] = p->target; r->suffixes[0] = find_percent_cached (&r->targets[0]); assert (r->suffixes[0] != NULL); ++r->suffixes[0]; ptr = p->dep; r->deps = PARSE_SIMPLE_SEQ ((char **)&ptr, struct dep); if (new_pattern_rule (r, 0)) { r->terminal = terminal; #ifndef CONFIG_WITH_ALLOC_CACHES r->cmds = xmalloc (sizeof (struct commands)); #else r->cmds = alloccache_alloc (&commands_cache); #endif r->cmds->fileinfo.filenm = 0; r->cmds->fileinfo.lineno = 0; r->cmds->fileinfo.offset = 0; /* These will all be string literals, but we malloc space for them anyway because somebody might want to free them later. */ r->cmds->commands = xstrdup (p->commands); r->cmds->command_lines = 0; r->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT; #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS r->cmds->refs = 1000; #endif } } /* Free all the storage used in RULE and take it out of the pattern_rules chain. LASTRULE is the rule whose next pointer points to RULE. */ static void freerule (struct rule *rule, struct rule *lastrule) { struct rule *next = rule->next; free_dep_chain (rule->deps); /* MSVC erroneously warns without a cast here. */ free ((void *)rule->targets); free ((void *)rule->suffixes); free (rule->lens); /* We can't free the storage for the commands because there are ways that they could be in more than one place: * If the commands came from a suffix rule, they could also be in the 'struct file's for other suffix rules or plain targets given on the same makefile line. * If two suffixes that together make a two-suffix rule were each given twice in the .SUFFIXES list, and in the proper order, two identical pattern rules would be created and the second one would be discarded here, but both would contain the same 'struct commands' pointer from the 'struct file' for the suffix rule. */ free (rule); if (pattern_rules == rule) if (lastrule != 0) abort (); else pattern_rules = next; else if (lastrule != 0) lastrule->next = next; if (last_pattern_rule == rule) last_pattern_rule = lastrule; } /* Create a new pattern rule with the targets in the nil-terminated array TARGETS. TARGET_PERCENTS is an array of pointers to the % in each element of TARGETS. N is the number of items in the array (not counting the nil element). The new rule has dependencies DEPS and commands from COMMANDS. It is a terminal rule if TERMINAL is nonzero. This rule overrides identical rules with different commands if OVERRIDE is nonzero. The storage for TARGETS and its elements and TARGET_PERCENTS is used and must not be freed until the rule is destroyed. */ void create_pattern_rule (const char **targets, const char **target_percents, unsigned int n, int terminal, struct dep *deps, struct commands *commands, int override) { unsigned int i; struct rule *r = xmalloc (sizeof (struct rule)); r->num = n; r->cmds = commands; r->deps = deps; r->targets = targets; r->suffixes = target_percents; r->lens = xmalloc (n * sizeof (unsigned int)); for (i = 0; i < n; ++i) { r->lens[i] = strlen (targets[i]); assert (r->suffixes[i] != NULL); ++r->suffixes[i]; } if (new_pattern_rule (r, override)) r->terminal = terminal; #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS if (commands != NULL) commands->refs = 1000; #endif } /* Print the data base of rules. */ static void /* Useful to call from gdb. */ print_rule (struct rule *r) { unsigned int i; for (i = 0; i < r->num; ++i) { fputs (r->targets[i], stdout); putchar ((i + 1 == r->num) ? ':' : ' '); } if (r->terminal) putchar (':'); print_prereqs (r->deps); if (r->cmds != 0) print_commands (r->cmds); } void print_rule_data_base (void) { unsigned int rules, terminal; struct rule *r; puts (_("\n# Implicit Rules")); rules = terminal = 0; for (r = pattern_rules; r != 0; r = r->next) { ++rules; putchar ('\n'); print_rule (r); if (r->terminal) ++terminal; } if (rules == 0) puts (_("\n# No implicit rules.")); else { printf (_("\n# %u implicit rules, %u"), rules, terminal); #ifndef NO_FLOAT printf (" (%.1f%%)", (double) terminal / (double) rules * 100.0); #else { int f = (terminal * 1000 + 5) / rules; printf (" (%d.%d%%)", f/10, f%10); } #endif puts (_(" terminal.")); } if (num_pattern_rules != rules) { /* This can happen if a fatal error was detected while reading the makefiles and thus count_implicit_rule_limits wasn't called yet. */ if (num_pattern_rules != 0) ONN (fatal, NILF, _("BUG: num_pattern_rules is wrong! %u != %u"), num_pattern_rules, rules); } } kbuild-3608/src/kmk/config.h.netbsd0000775000175000017500000003135414670377415017202 0ustar locutuslocutus/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if the `closedir' function returns void instead of `int'. */ /* #undef CLOSEDIR_VOID */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ /* Define to 1 if using `getloadavg.c'. */ /* #undef C_GETLOADAVG */ /* Define to 1 for DGUX with . */ /* #undef DGUX */ /* Use high resolution file timestamps if nonzero. */ #define FILE_TIMESTAMP_HI_RES 0 /* Define to 1 if the `getloadavg' function needs to be run setuid or setgid. */ /* #undef GETLOADAVG_PRIVILEGED */ /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 /* Define to 1 if you have and it should be used (not on Ultrix). */ /* #undef HAVE_ALLOCA_H */ /* Define to 1 if your compiler conforms to the ANSI C standard. */ #define HAVE_ANSI_COMPILER 1 /* Define to 1 if you have the `atexit' function. */ #define HAVE_ATEXIT 1 /* Use case insensitive file names */ /* #undef HAVE_CASE_INSENSITIVE_FS */ /* Define to 1 if you have the clock_gettime function. */ /* #undef HAVE_CLOCK_GETTIME */ /* Define to 1 if you have the declaration of `bsd_signal', and to 0 if you don't. */ #define HAVE_DECL_BSD_SIGNAL 0 /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ #define HAVE_DECL_SYS_SIGLIST 1 /* Define to 1 if you have the declaration of `_sys_siglist', and to 0 if you don't. */ #define HAVE_DECL__SYS_SIGLIST 0 /* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you don't. */ #define HAVE_DECL___SYS_SIGLIST 0 /* Define to 1 if you have the header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ /* #undef HAVE_DOPRNT */ /* Use platform specific coding */ /* #undef HAVE_DOS_PATHS */ /* Define to 1 if you have the `dup2' function. */ #define HAVE_DUP2 1 /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `fdopen' function. */ #define HAVE_FDOPEN 1 /* Define to 1 if you have the `fileno' function. */ #define HAVE_FILENO 1 /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 /* Define to 1 if you have the `getcwd' function. */ #define HAVE_GETCWD 1 /* Define to 1 if you have the `getgroups' function. */ #define HAVE_GETGROUPS 1 /* Define to 1 if you have the `gethostbyname' function. */ /* #undef HAVE_GETHOSTBYNAME */ /* Define to 1 if you have the `gethostname' function. */ /* #undef HAVE_GETHOSTNAME */ /* Define to 1 if you have the `getloadavg' function. */ #define HAVE_GETLOADAVG 1 /* Define to 1 if you have the `getrlimit' function. */ #define HAVE_GETRLIMIT 1 /* Define to 1 if you have a standard gettimeofday function */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `dgc' library (-ldgc). */ /* #undef HAVE_LIBDGC */ /* Define to 1 if you have the `kstat' library (-lkstat). */ /* #undef HAVE_LIBKSTAT */ /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LOCALE_H 1 /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_MACH_MACH_H */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `mkstemp' function. */ #define HAVE_MKSTEMP 1 /* Define to 1 if you have the `mktemp' function. */ #define HAVE_MKTEMP 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_NLIST_H */ /* Define to 1 if you have the `pipe' function. */ #define HAVE_PIPE 1 /* Define to 1 if you have the `pstat_getdynamic' function. */ /* #undef HAVE_PSTAT_GETDYNAMIC */ /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 /* Define to 1 if defines the SA_RESTART constant. */ #define HAVE_SA_RESTART 1 /* Define to 1 if you have the `setegid' function. */ #define HAVE_SETEGID 1 /* Define to 1 if you have the `seteuid' function. */ #define HAVE_SETEUID 1 /* Define to 1 if you have the `setlinebuf' function. */ #define HAVE_SETLINEBUF 1 /* Define to 1 if you have the `setlocale' function. */ /* #undef HAVE_SETLOCALE */ /* Define to 1 if you have the `setregid' function. */ #define HAVE_SETREGID 1 /* Define to 1 if you have the `setreuid' function. */ #define HAVE_SETREUID 1 /* Define to 1 if you have the `setrlimit' function. */ #define HAVE_SETRLIMIT 1 /* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the `sigsetmask' function. */ #define HAVE_SIGSETMASK 1 /* Define to 1 if you have the `socket' function. */ /* #undef HAVE_SOCKET */ /* Define to 1 if you have the header file. */ #define HAVE_STDARG_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strcasecmp' function. */ #define HAVE_STRCASECMP 1 /* Define to 1 if you have the `strcmpi' function. */ /* #undef HAVE_STRCMPI */ /* Define to 1 if you have the `strcoll' function and it is properly defined. */ #define HAVE_STRCOLL 1 /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the `stricmp' function. */ /* #undef HAVE_STRICMP */ /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strncasecmp' function. */ #define HAVE_STRNCASECMP 1 /* Define to 1 if you have the `strncmpi' function. */ /* #undef HAVE_STRNCMPI */ /* Define to 1 if you have the `strndup' function. */ #define HAVE_STRNDUP 1 /* Define to 1 if you have the `strnicmp' function. */ /* #undef HAVE_STRNICMP */ /* Define to 1 if you have the `strsignal' function. */ #define HAVE_STRSIGNAL 1 /* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */ /* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIMEB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the \`union wait' type in . */ /* #undef HAVE_UNION_WAIT */ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_VARARGS_H */ /* Define to 1 if you have the `vfork' function. */ #define HAVE_VFORK 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_VFORK_H */ /* Define to 1 if you have the `vprintf' function. */ #define HAVE_VPRINTF 1 /* Define to 1 if you have the `wait3' function. */ #define HAVE_WAIT3 1 /* Define to 1 if you have the `waitpid' function. */ #define HAVE_WAITPID 1 /* Define to 1 if `fork' works. */ #define HAVE_WORKING_FORK 1 /* Define to 1 if `vfork' works. */ #define HAVE_WORKING_VFORK 1 /* Build host information. (not used by kmk) */ #define MAKE_HOST "i386-unknown-netbsdelf5.1." /* Define to 1 to enable job server support in GNU make. */ #define MAKE_JOBSERVER 1 /* Define to 1 to enable symbolic link timestamp checking. */ #define MAKE_SYMLINKS 1 /* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend on `HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* #undef NLIST_NAME_UNION */ /* Define to 1 if struct nlist.n_name is a pointer rather than an array. */ /* #undef NLIST_STRUCT */ /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Name of package */ #define PACKAGE "make" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "bug-make@gnu.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "GNU make" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "GNU make 3.82" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "make" /* Define to the home page for this package. */ #define PACKAGE_URL "http://www.gnu.org/software/make/" /* Define to the version of this package. */ #define PACKAGE_VERSION "3.82" /* Define to the character that separates directories in PATH. */ #define PATH_SEPARATOR_CHAR ':' /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void /* Define to the name of the SCCS 'get' command. */ #define SCCS_GET "get" /* Define to 1 if the SCCS 'get' command understands the '-G' option. */ /* #undef SCCS_GET_MINUS_G */ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define to 1 if the `S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if struct stat contains a nanoseconds field */ /* #undef ST_MTIM_NSEC */ /* Define to 1 on System V Release 4. */ /* #undef SVR4 */ /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 /* Define to 1 for Encore UMAX. */ /* #undef UMAX */ /* Define to 1 for Encore UMAX 4.3 that has instead of . */ /* #undef UMAX4_3 */ /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # define _ALL_SOURCE 1 #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # define _POSIX_PTHREAD_SEMANTICS 1 #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE 1 #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # define __EXTENSIONS__ 1 #endif /* Version number of package */ #define VERSION "3.82" /* Use platform specific coding */ /* #undef WINDOWS32 */ /* Define if using the dmalloc debugging malloc package */ /* #undef WITH_DMALLOC */ /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define to 1 if on MINIX. */ /* #undef _MINIX */ /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `int' if doesn't define. */ /* #undef gid_t */ /* Define to `int' if does not define. */ /* #undef pid_t */ /* Define to `unsigned int' if does not define. */ /* #undef size_t */ /* Define to `int' if doesn't define. */ /* #undef uid_t */ /* Define uintmax_t if not defined in or . */ /* #undef uintmax_t */ /* Define as `fork' if `vfork' does not work. */ /* #undef vfork */ #include "inlined_memchr.h" kbuild-3608/src/kmk/config.h.os20000664000175000017500000003214214670377415016417 0ustar locutuslocutus/* config.h. Generated by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if the `closedir' function returns void instead of `int'. */ /* #undef CLOSEDIR_VOID */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ /* Define to 1 if using `getloadavg.c'. */ /* #undef C_GETLOADAVG */ /* Define to 1 for DGUX with . */ /* #undef DGUX */ /* Define to 1 if translation of program messages to the user's native language is requested. */ #define ENABLE_NLS 1 /* Use high resolution file timestamps if nonzero. */ #define FILE_TIMESTAMP_HI_RES 0 /* Define to 1 if the `getloadavg' function needs to be run setuid or setgid. */ /* #undef GETLOADAVG_PRIVILEGED */ /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 /* Define to 1 if you have and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define if your compiler conforms to the ANSI C standard. */ #define HAVE_ANSI_COMPILER 1 /* Define to 1 if you have the `atexit' function. */ #define HAVE_ATEXIT 1 /* Use case insensitive file names */ /* #undef HAVE_CASE_INSENSITIVE_FS */ /* Define to 1 if you have the declaration of `bsd_signal', and to 0 if you don't. */ #define HAVE_DECL_BSD_SIGNAL 1 /* Define if you have the clock_gettime function. */ /* #undef HAVE_CLOCK_GETTIME */ /* Define if the GNU dcgettext() function is already present or preinstalled. */ #define HAVE_DCGETTEXT 1 /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ #define HAVE_DECL_SYS_SIGLIST 1 /* Define to 1 if you have the declaration of `_sys_siglist', and to 0 if you don't. */ #define HAVE_DECL__SYS_SIGLIST 0 /* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you don't. */ #define HAVE_DECL___SYS_SIGLIST 0 /* Define to 1 if you have the header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ /* #undef HAVE_DOPRNT */ /* Use platform specific coding */ #define HAVE_DOS_PATHS 1 /* Define to 1 if you have the `dup2' function. */ #define HAVE_DUP2 1 /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `fdopen' function. */ #define HAVE_FDOPEN 1 /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 /* Define to 1 if you have the `getcwd' function. */ #define HAVE_GETCWD 1 /* Define to 1 if you have the `getgroups' function. */ #define HAVE_GETGROUPS 1 /* Define to 1 if you have the `gethostbyname' function. */ /* #undef HAVE_GETHOSTBYNAME */ /* Define to 1 if you have the `gethostname' function. */ /* #undef HAVE_GETHOSTNAME */ /* Define to 1 if you have the `getloadavg' function. */ #define HAVE_GETLOADAVG 1 /* Define to 1 if you have the `getrlimit' function. */ #define HAVE_GETRLIMIT 1 /* Define if the GNU gettext() function is already present or preinstalled. */ #define HAVE_GETTEXT 1 /* Define if you have a standard gettimeofday function */ #define HAVE_GETTIMEOFDAY 1 /* Define if you have the iconv() function. */ /* #undef HAVE_ICONV */ /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `dgc' library (-ldgc). */ /* #undef HAVE_LIBDGC */ /* Define to 1 if you have the `kstat' library (-lkstat). */ /* #undef HAVE_LIBKSTAT */ /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LOCALE_H 1 /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_MACH_MACH_H */ /* Define to 1 if you have the `memcpy' function. */ #define HAVE_MEMCPY 1 /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `mkstemp' function. */ #define HAVE_MKSTEMP 1 /* Define to 1 if you have the `mktemp' function. */ #define HAVE_MKTEMP 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_NLIST_H */ /* Define to 1 if you have the `pipe' function. */ #define HAVE_PIPE 1 /* Define to 1 if you have the `pstat_getdynamic' function. */ /* #undef HAVE_PSTAT_GETDYNAMIC */ /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 /* Define if defines the SA_RESTART constant. */ #define HAVE_SA_RESTART 1 /* Define to 1 if you have the `setegid' function. */ #define HAVE_SETEGID 1 /* Define to 1 if you have the `seteuid' function. */ #define HAVE_SETEUID 1 /* Define to 1 if you have the `setlinebuf' function. */ #define HAVE_SETLINEBUF 1 /* Define to 1 if you have the `setlocale' function. */ /* #undef HAVE_SETLOCALE */ /* Define to 1 if you have the `setregid' function. */ #define HAVE_SETREGID 1 /* Define to 1 if you have the `setreuid' function. */ #define HAVE_SETREUID 1 /* Define to 1 if you have the `setrlimit' function. */ #define HAVE_SETRLIMIT 1 /* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the `sigsetmask' function. */ #define HAVE_SIGSETMASK 1 /* Define to 1 if you have the `socket' function. */ /* #undef HAVE_SOCKET */ /* Define to 1 if you have the header file. */ #define HAVE_STDARG_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strcasecmp' function. */ /* #undef HAVE_STRCASECMP */ /* Define to 1 if you have the `strchr' function. */ #define HAVE_STRCHR 1 /* Define to 1 if you have the `strcoll' function and it is properly defined. */ #define HAVE_STRCOLL 1 /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strncasecmp' function. */ #define HAVE_STRNCASECMP 1 /* Define to 1 if you have the `strncmpi' function. */ /* #undef HAVE_STRNCMPI */ /* Define to 1 if you have the `strsignal' function. */ #define HAVE_STRSIGNAL 1 /* Define to 1 if you have the `strndup' function. */ #define HAVE_STRNDUP 1 /* Define to 1 if you have the `strnicmp' function. */ #define HAVE_STRNICMP 1 /* Define to 1 if `n_un.n_name' is member of `struct nlist'. */ /* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIMEB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_WAIT_H 1 /* Define this if you have the \`union wait' type in . */ /* #undef HAVE_UNION_WAIT */ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_VARARGS_H */ /* Define to 1 if you have the `vfork' function. */ /* #undef HAVE_VFORK */ /* Define to 1 if you have the header file. */ /* #undef HAVE_VFORK_H */ /* Define to 1 if you have the `vprintf' function. */ #define HAVE_VPRINTF 1 /* Define to 1 if you have the `wait3' function. */ #define HAVE_WAIT3 1 /* Define to 1 if you have the `waitpid' function. */ #define HAVE_WAITPID 1 /* Define to 1 if `fork' works. */ #define HAVE_WORKING_FORK 1 /* Define to 1 if `vfork' works. */ /* #undef HAVE_WORKING_VFORK */ /* Build host information. (not used by kmk) */ #define MAKE_HOST "i386-pc-os2-emx" /* Define this to enable job server support in GNU make. */ #define MAKE_JOBSERVER 1 /* Define this to enable symbolic link timestamp checking. */ #define MAKE_SYMLINKS 1 /* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend on `HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* #undef NLIST_NAME_UNION */ /* Define if struct nlist.n_name is a pointer rather than an array. */ /* #undef NLIST_STRUCT */ /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Name of package */ #define PACKAGE "make" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "bug-make@gnu.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "GNU make" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "GNU make 3.82" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "make" /* Define to the version of this package. */ #define PACKAGE_VERSION "3.82" /* Define to 1 if the C compiler supports function prototypes. */ #define PROTOTYPES 1 /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void /* Define to the name of the SCCS 'get' command. */ #define SCCS_GET "get" /* Define this if the SCCS 'get' command understands the '-G' option. */ /* #undef SCCS_GET_MINUS_G */ /* Define to 1 if the `setvbuf' function takes the buffering type as its second argument and the buffer pointer as the third, as on System V before release 3. */ /* #undef SETVBUF_REVERSED */ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define to 1 if the `S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if struct stat contains a nanoseconds field */ /* #undef ST_MTIM_NSEC */ /* Define to 1 on System V Release 4. */ /* #undef SVR4 */ /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 /* Define to 1 for Encore UMAX. */ /* #undef UMAX */ /* Define to 1 for Encore UMAX 4.3 that has instead of . */ /* #undef UMAX4_3 */ /* Version number of package */ #define VERSION "3.81" /* Use platform specific coding */ /* #undef WINDOWS32 */ /* Define if using the dmalloc debugging malloc package */ /* #undef WITH_DMALLOC */ /* Define to 1 if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE /* # undef _ALL_SOURCE */ #endif /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define to 1 if on MINIX. */ /* #undef _MINIX */ /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define like PROTOTYPES; this can be used by system headers. */ #define __PROTOTYPES 1 /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `int' if doesn't define. */ /* #undef gid_t */ /* Define to `int' if does not define. */ /* #undef pid_t */ /* Define to `int' if doesn't define. */ /* #undef uid_t */ /* Define uintmax_t if not defined in or . */ /* #undef uintmax_t */ /* Define as `fork' if `vfork' does not work. */ #define vfork fork /* * Modifications: */ /* Define to the installation directory for locales. */ #define LOCALEDIR "" /* * If you have a shell that does not grok 'sh -c quoted-command-line' * correctly, you need this setting. Please see below for specific * shell support. */ #define BATCH_MODE_ONLY_SHELL 1 #define _DIRENT_HAVE_D_NAMLEN 1 #define _DIRENT_HAVE_D_TYPE 1 #define INCLUDEDIR "." #define LIBDIR "." #include "inlined_memchr.h" kbuild-3608/src/kmk/signame.c0000664000175000017500000001531714670377414016072 0ustar locutuslocutus/* Convert between signal names and numbers. Copyright (C) 1990-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" /* If the system provides strsignal, we don't need it. */ #if !HAVE_STRSIGNAL /* If the system provides sys_siglist, we'll use that. Otherwise create our own. */ #if !HAVE_DECL_SYS_SIGLIST /* Some systems do not define NSIG in . */ #ifndef NSIG #ifdef _NSIG #define NSIG _NSIG #else #define NSIG 32 #endif #endif /* There is too much variation in Sys V signal numbers and names, so we must initialize them at runtime. */ static const char *undoc; static const char *sys_siglist[NSIG]; /* Table of abbreviations for signals. Note: A given number can appear more than once with different abbreviations. */ #define SIG_TABLE_SIZE (NSIG*2) typedef struct { int number; const char *abbrev; } num_abbrev; static num_abbrev sig_table[SIG_TABLE_SIZE]; /* Number of elements of sig_table used. */ static int sig_table_nelts = 0; /* Enter signal number NUMBER into the tables with ABBREV and NAME. */ static void init_sig (int number, const char *abbrev, const char *name) { /* If this value is ever greater than NSIG it seems like it'd be a bug in the system headers, but... better safe than sorry. We know, for example, that this isn't always true on VMS. */ if (number >= 0 && number < NSIG) sys_siglist[number] = name; if (sig_table_nelts < SIG_TABLE_SIZE) { sig_table[sig_table_nelts].number = number; sig_table[sig_table_nelts++].abbrev = abbrev; } } static int signame_init (void) { int i; undoc = xstrdup (_("unknown signal")); /* Initialize signal names. */ for (i = 0; i < NSIG; i++) sys_siglist[i] = undoc; /* Initialize signal names. */ #if defined (SIGHUP) init_sig (SIGHUP, "HUP", _("Hangup")); #endif #if defined (SIGINT) init_sig (SIGINT, "INT", _("Interrupt")); #endif #if defined (SIGQUIT) init_sig (SIGQUIT, "QUIT", _("Quit")); #endif #if defined (SIGILL) init_sig (SIGILL, "ILL", _("Illegal Instruction")); #endif #if defined (SIGTRAP) init_sig (SIGTRAP, "TRAP", _("Trace/breakpoint trap")); #endif /* If SIGIOT == SIGABRT, we want to print it as SIGABRT because SIGABRT is in ANSI and POSIX.1 and SIGIOT isn't. */ #if defined (SIGABRT) init_sig (SIGABRT, "ABRT", _("Aborted")); #endif #if defined (SIGIOT) init_sig (SIGIOT, "IOT", _("IOT trap")); #endif #if defined (SIGEMT) init_sig (SIGEMT, "EMT", _("EMT trap")); #endif #if defined (SIGFPE) init_sig (SIGFPE, "FPE", _("Floating point exception")); #endif #if defined (SIGKILL) init_sig (SIGKILL, "KILL", _("Killed")); #endif #if defined (SIGBUS) init_sig (SIGBUS, "BUS", _("Bus error")); #endif #if defined (SIGSEGV) init_sig (SIGSEGV, "SEGV", _("Segmentation fault")); #endif #if defined (SIGSYS) init_sig (SIGSYS, "SYS", _("Bad system call")); #endif #if defined (SIGPIPE) init_sig (SIGPIPE, "PIPE", _("Broken pipe")); #endif #if defined (SIGALRM) init_sig (SIGALRM, "ALRM", _("Alarm clock")); #endif #if defined (SIGTERM) init_sig (SIGTERM, "TERM", _("Terminated")); #endif #if defined (SIGUSR1) init_sig (SIGUSR1, "USR1", _("User defined signal 1")); #endif #if defined (SIGUSR2) init_sig (SIGUSR2, "USR2", _("User defined signal 2")); #endif /* If SIGCLD == SIGCHLD, we want to print it as SIGCHLD because that is what is in POSIX.1. */ #if defined (SIGCHLD) init_sig (SIGCHLD, "CHLD", _("Child exited")); #endif #if defined (SIGCLD) init_sig (SIGCLD, "CLD", _("Child exited")); #endif #if defined (SIGPWR) init_sig (SIGPWR, "PWR", _("Power failure")); #endif #if defined (SIGTSTP) init_sig (SIGTSTP, "TSTP", _("Stopped")); #endif #if defined (SIGTTIN) init_sig (SIGTTIN, "TTIN", _("Stopped (tty input)")); #endif #if defined (SIGTTOU) init_sig (SIGTTOU, "TTOU", _("Stopped (tty output)")); #endif #if defined (SIGSTOP) init_sig (SIGSTOP, "STOP", _("Stopped (signal)")); #endif #if defined (SIGXCPU) init_sig (SIGXCPU, "XCPU", _("CPU time limit exceeded")); #endif #if defined (SIGXFSZ) init_sig (SIGXFSZ, "XFSZ", _("File size limit exceeded")); #endif #if defined (SIGVTALRM) init_sig (SIGVTALRM, "VTALRM", _("Virtual timer expired")); #endif #if defined (SIGPROF) init_sig (SIGPROF, "PROF", _("Profiling timer expired")); #endif #if defined (SIGWINCH) /* "Window size changed" might be more accurate, but even if that is all that it means now, perhaps in the future it will be extended to cover other kinds of window changes. */ init_sig (SIGWINCH, "WINCH", _("Window changed")); #endif #if defined (SIGCONT) init_sig (SIGCONT, "CONT", _("Continued")); #endif #if defined (SIGURG) init_sig (SIGURG, "URG", _("Urgent I/O condition")); #endif #if defined (SIGIO) /* "I/O pending" has also been suggested. A disadvantage is that signal only happens when the process has asked for it, not every time I/O is pending. Another disadvantage is the confusion from giving it a different name than under Unix. */ init_sig (SIGIO, "IO", _("I/O possible")); #endif #if defined (SIGWIND) init_sig (SIGWIND, "WIND", _("SIGWIND")); #endif #if defined (SIGPHONE) init_sig (SIGPHONE, "PHONE", _("SIGPHONE")); #endif #if defined (SIGPOLL) init_sig (SIGPOLL, "POLL", _("I/O possible")); #endif #if defined (SIGLOST) init_sig (SIGLOST, "LOST", _("Resource lost")); #endif #if defined (SIGDANGER) init_sig (SIGDANGER, "DANGER", _("Danger signal")); #endif #if defined (SIGINFO) init_sig (SIGINFO, "INFO", _("Information request")); #endif #if defined (SIGNOFP) init_sig (SIGNOFP, "NOFP", _("Floating point co-processor not available")); #endif return 1; } #endif /* HAVE_DECL_SYS_SIGLIST */ char * strsignal (int sig) { static char buf[] = "Signal 12345678901234567890"; #if ! HAVE_DECL_SYS_SIGLIST # if HAVE_DECL__SYS_SIGLIST # define sys_siglist _sys_siglist # elif HAVE_DECL___SYS_SIGLIST # define sys_siglist __sys_siglist # else static char sig_initted = 0; if (!sig_initted) sig_initted = signame_init (); # endif #endif if (sig > 0 && sig < NSIG) return (char *) sys_siglist[sig]; sprintf (buf, "Signal %d", sig); return buf; } #endif /* HAVE_STRSIGNAL */ kbuild-3608/src/kmk/testcase-includedep.kmk0000664000175000017500000000474514670377415020740 0ustar locutuslocutus# $Id: testcase-includedep.kmk 2413 2010-09-11 17:43:04Z bird $ ## @file # kBuild - testcase for the includedep directive. # # # Copyright (c) 2008-2010 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # DEPTH = ../.. include $(PATH_KBUILD)/header.kmk ifdef testcase-includedep-sub.kmk $(error testcase-includedep-sub.kmk is defined at the start of the testcase.) endif foo = testcase-includedep-sub includedep $(foo).kmk ifneq ($(testcase-includedep-sub.kmk),included) $(error The first test failed.) endif testcase-includedep-sub.kmk := ifdef testcase-includedep-sub.kmk $(error testcase-includedep-sub.kmk is persistent and does not want to be undefed.) endif foo = includedep includedep testcase-$(foo)-sub.kmk ifneq ($(testcase-includedep-sub.kmk),included) $(error The second test failed.) endif testcase-includedep-sub.kmk := ifdef testcase-includedep-sub.kmk $(error testcase-includedep-sub.kmk is persistent and does not want to be undefed.) endif foo = kmk includedep testcase-includedep-sub.$(foo) ifneq ($(testcase-includedep-sub.kmk),included) $(error The thrid test failed.) endif testcase-includedep-sub.kmk := ifdef testcase-includedep-sub.kmk $(error testcase-includedep-sub.kmk is persistent and does not want to be undefed.) endif includedep testcase-includedep-sub.kmk ifneq ($(testcase-includedep-sub.kmk),included) $(error The forth test failed.) endif testcase-includedep-sub.kmk := ifdef testcase-includedep-sub.kmk $(error testcase-includedep-sub.kmk is persistent and does not want to be undefed.) endif foo = asdf includedep testcase-$(foo)-sub.kmk ifeq ($(testcase-includedep-sub.kmk),included) $(error The fifth test failed.) endif testcase-includedep-sub.kmk := ifdef testcase-includedep-sub.kmk $(error testcase-includedep-sub.kmk is persistent and does not want to be undefed.) endif all_recursive: $(ECHO) "includedep works fine" kbuild-3608/src/kmk/amiga.h0000664000175000017500000000146014670377413015523 0ustar locutuslocutus/* Definitions for amiga specific things Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ int MyExecute (char ** argv); char * wildcard_expansion (char * wc, char * o); kbuild-3608/src/kmk/file.c0000664000175000017500000012167614670377413015373 0ustar locutuslocutus/* Target file management for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #include #include "filedef.h" #include "dep.h" #include "job.h" #include "commands.h" #include "variable.h" #include "debug.h" #include "hash.h" #ifdef CONFIG_WITH_STRCACHE2 # include #endif /* Remember whether snap_deps has been invoked: we need this to be sure we don't add new rules (via $(eval ...)) afterwards. In the future it would be nice to support this, but it means we'd need to re-run snap_deps() or at least its functionality... it might mean changing snap_deps() to be run per-file, so we can invoke it after the eval... or remembering which files in the hash have been snapped (a new boolean flag?) and having snap_deps() only work on files which have not yet been snapped. */ int snapped_deps = 0; /* Hash table of files the makefile knows how to make. */ #ifndef CONFIG_WITH_STRCACHE2 static unsigned long file_hash_1 (const void *key) { return_ISTRING_HASH_1 (((struct file const *) key)->hname); } static unsigned long file_hash_2 (const void *key) { return_ISTRING_HASH_2 (((struct file const *) key)->hname); } #endif /* !CONFIG_WITH_STRCACHE2 */ static int file_hash_cmp (const void *x, const void *y) { #ifndef CONFIG_WITH_STRCACHE2 return_ISTRING_COMPARE (((struct file const *) x)->hname, ((struct file const *) y)->hname); #else /* CONFIG_WITH_STRCACHE2 */ return ((struct file const *) x)->hname == ((struct file const *) y)->hname ? 0 : -1; #endif /* CONFIG_WITH_STRCACHE2 */ } static struct hash_table files; /* Whether or not .SECONDARY with no prerequisites was given. */ static int all_secondary = 0; /* Access the hash table of all file records. lookup_file given a name, return the struct file * for that name, or nil if there is none. */ #ifndef CONFIG_WITH_STRCACHE2 struct file * lookup_file (const char *name) #else /* CONFIG_WITH_STRCACHE2 */ MY_INLINE struct file * lookup_file_common (const char *name, int cached) #endif /* CONFIG_WITH_STRCACHE2 */ { struct file *f; struct file file_key; #ifdef VMS int want_vmsify; #ifndef WANT_CASE_SENSITIVE_TARGETS char *lname; #endif #endif assert (*name != '\0'); /* This is also done in parse_file_seq, so this is redundant for names read from makefiles. It is here for names passed on the command line. */ #ifdef VMS want_vmsify = (strpbrk (name, "]>:^") != NULL); # ifndef WANT_CASE_SENSITIVE_TARGETS if (*name != '.') { const char *n; char *ln; lname = xstrdup (name); for (n = name, ln = lname; *n != '\0'; ++n, ++ln) *ln = isupper ((unsigned char)*n) ? tolower ((unsigned char)*n) : *n; *ln = '\0'; name = lname; } # endif while (name[0] == '[' && name[1] == ']' && name[2] != '\0') name += 2; while (name[0] == '<' && name[1] == '>' && name[2] != '\0') name += 2; #endif while (name[0] == '.' #ifdef HAVE_DOS_PATHS && (name[1] == '/' || name[1] == '\\') #else && name[1] == '/' #endif && name[2] != '\0') { name += 2; while (*name == '/' #ifdef HAVE_DOS_PATHS || *name == '\\' #endif ) /* Skip following slashes: ".//foo" is "foo", not "/foo". */ ++name; } if (*name == '\0') { /* It was all slashes after a dot. */ #if defined(_AMIGA) name = ""; #else name = "./"; #endif #if defined(VMS) /* TODO - This section is probably not needed. */ if (want_vmsify) name = "[]"; #endif } #ifndef CONFIG_WITH_STRCACHE2 file_key.hname = name; f = hash_find_item (&files, &file_key); #else /* CONFIG_WITH_STRCACHE2 */ if (!cached) { file_key.hname = strcache2_lookup_file (&file_strcache, name, strlen (name)); if (file_key.hname) f = hash_find_item_strcached (&files, &file_key); else f = NULL; } else { file_key.hname = name; f = hash_find_item_strcached (&files, &file_key); } #endif /* CONFIG_WITH_STRCACHE2 */ #if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) if (*name != '.') free (lname); #endif return f; } #ifdef CONFIG_WITH_STRCACHE2 /* Given a name, return the struct file * for that name, or nil if there is none. */ struct file * lookup_file (const char *name) { return lookup_file_common (name, 0 /* cached */); } /* Given a name in the strcache, return the struct file * for that name, or nil if there is none. */ struct file * lookup_file_cached (const char *name) { assert (strcache_iscached (name)); return lookup_file_common (name, 1 /* cached */); } #endif /* CONFIG_WITH_STRCACHE2 */ /* Look up a file record for file NAME and return it. Create a new record if one doesn't exist. NAME will be stored in the new record so it should be constant or in the strcache etc. */ struct file * enter_file (const char *name) { struct file *f; struct file *new; struct file **file_slot; struct file file_key; assert (*name != '\0'); assert (! verify_flag || strcache_iscached (name)); #if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) if (*name != '.') { const char *n; char *lname, *ln; lname = xstrdup (name); for (n = name, ln = lname; *n != '\0'; ++n, ++ln) if (isupper ((unsigned char)*n)) *ln = tolower ((unsigned char)*n); else *ln = *n; *ln = '\0'; name = strcache_add (lname); free (lname); } #endif file_key.hname = name; #ifndef CONFIG_WITH_STRCACHE2 file_slot = (struct file **) hash_find_slot (&files, &file_key); #else /* CONFIG_WITH_STRCACHE2 */ file_slot = (struct file **) hash_find_slot_strcached (&files, &file_key); #endif /* CONFIG_WITH_STRCACHE2 */ f = *file_slot; if (! HASH_VACANT (f) && !f->double_colon) { f->builtin = 0; return f; } #ifndef CONFIG_WITH_ALLOC_CACHES new = xcalloc (sizeof (struct file)); #else new = alloccache_calloc (&file_cache); #endif new->name = new->hname = name; new->update_status = us_none; if (HASH_VACANT (f)) { new->last = new; hash_insert_at (&files, new, file_slot); } else { /* There is already a double-colon entry for this file. */ new->double_colon = f; f->last->prev = new; f->last = new; } #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION /* Check if the name needs 2nd expansion or not. */ if (second_target_expansion && strchr (name, '$') != NULL) new->need_2nd_target_expansion = 1; #endif return new; } /* Rehash FILE to NAME. This is not as simple as resetting the 'hname' member, since it must be put in a new hash bucket, and possibly merged with an existing file called NAME. */ void rehash_file (struct file *from_file, const char *to_hname) { struct file file_key; struct file **file_slot; struct file *to_file; struct file *deleted_file; struct file *f; #ifdef CONFIG_WITH_STRCACHE2 assert (strcache_iscached (to_hname)); assert (strcache_iscached (from_file->hname)); #endif /* If it's already that name, we're done. */ from_file->builtin = 0; file_key.hname = to_hname; if (! file_hash_cmp (from_file, &file_key)) return; /* Find the end of the renamed list for the "from" file. */ file_key.hname = from_file->hname; while (from_file->renamed != 0) from_file = from_file->renamed; if (file_hash_cmp (from_file, &file_key)) /* hname changed unexpectedly!! */ abort (); /* Remove the "from" file from the hash. */ #ifndef CONFIG_WITH_STRCACHE2 deleted_file = hash_delete (&files, from_file); #else deleted_file = hash_delete_strcached (&files, from_file); #endif if (deleted_file != from_file) /* from_file isn't the one stored in files */ abort (); /* Find where the newly renamed file will go in the hash. */ file_key.hname = to_hname; #ifndef CONFIG_WITH_STRCACHE2 file_slot = (struct file **) hash_find_slot (&files, &file_key); #else /* CONFIG_WITH_STRCACHE2 */ file_slot = (struct file **) hash_find_slot_strcached (&files, &file_key); #endif /* CONFIG_WITH_STRCACHE2 */ to_file = *file_slot; /* Change the hash name for this file. */ from_file->hname = to_hname; for (f = from_file->double_colon; f != 0; f = f->prev) f->hname = to_hname; /* If the new name doesn't exist yet just set it to the renamed file. */ if (HASH_VACANT (to_file)) { hash_insert_at (&files, from_file, file_slot); return; } /* TO_FILE already exists under TO_HNAME. We must retain TO_FILE and merge FROM_FILE into it. */ if (from_file->cmds != 0) { if (to_file->cmds == 0) to_file->cmds = from_file->cmds; else if (from_file->cmds != to_file->cmds) { size_t l = strlen (from_file->name); /* We have two sets of commands. We will go with the one given in the rule explicitly mentioning this name, but give a message to let the user know what's going on. */ if (to_file->cmds->fileinfo.filenm != 0) error (&from_file->cmds->fileinfo, l + strlen (to_file->cmds->fileinfo.filenm) + INTSTR_LENGTH, _("Recipe was specified for file '%s' at %s:%lu,"), from_file->name, to_file->cmds->fileinfo.filenm, to_file->cmds->fileinfo.lineno); else error (&from_file->cmds->fileinfo, l, _("Recipe for file '%s' was found by implicit rule search,"), from_file->name); l += strlen (to_hname); error (&from_file->cmds->fileinfo, l, _("but '%s' is now considered the same file as '%s'."), from_file->name, to_hname); error (&from_file->cmds->fileinfo, l, _("Recipe for '%s' will be ignored in favor of the one for '%s'."), to_hname, from_file->name); } } #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET /* Merge multi target attributes and considerations. */ if (from_file->multi_head) { if (to_file->multi_head) OSS (fatal, NILF, _("can't rename/merge multi target '%s' with multi target '%s'"), from_file->name, to_hname); to_file->multi_maybe = from_file->multi_maybe; to_file->multi_next = from_file->multi_next; to_file->multi_head = f = from_file->multi_head; if (f == from_file) { for (; f != 0; f = f->multi_next) f->multi_head = to_file; to_file->multi_head = to_file; } else { while (f->multi_next != from_file) f = f->multi_next; assert(f->multi_next == from_file); f->multi_next = to_file; } # ifdef NDEBUG from_file->multi_head = to_file->multi_head; from_file->multi_next = NULL; # else from_file->multi_head = (struct file *)0x2; /* poison */ from_file->multi_next = (struct file *)0x8; # endif } #endif /* Merge the dependencies of the two files. */ if (to_file->deps == 0) to_file->deps = from_file->deps; else { struct dep *deps = to_file->deps; while (deps->next != 0) deps = deps->next; deps->next = from_file->deps; } merge_variable_set_lists (&to_file->variables, from_file->variables); if (to_file->double_colon && from_file->is_target && !from_file->double_colon) OSS (fatal, NILF, _("can't rename single-colon '%s' to double-colon '%s'"), from_file->name, to_hname); if (!to_file->double_colon && from_file->double_colon) { if (to_file->is_target) OSS (fatal, NILF, _("can't rename double-colon '%s' to single-colon '%s'"), from_file->name, to_hname); else to_file->double_colon = from_file->double_colon; } if (from_file->last_mtime > to_file->last_mtime) /* %%% Kludge so -W wins on a file that gets vpathized. */ to_file->last_mtime = from_file->last_mtime; to_file->mtime_before_update = from_file->mtime_before_update; #define MERGE(field) to_file->field |= from_file->field MERGE (precious); MERGE (tried_implicit); MERGE (updating); MERGE (updated); MERGE (is_target); MERGE (cmd_target); MERGE (phony); MERGE (loaded); MERGE (ignore_vpath); #undef MERGE to_file->builtin = 0; from_file->renamed = to_file; } /* Rename FILE to NAME. This is not as simple as resetting the 'name' member, since it must be put in a new hash bucket, and possibly merged with an existing file called NAME. */ void rename_file (struct file *from_file, const char *to_hname) { rehash_file (from_file, to_hname); while (from_file) { from_file->name = from_file->hname; from_file = from_file->prev; } } #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION /* Performs secondary target name expansion and then renames the file using rename_file. */ static void do_2nd_target_expansion (struct file *f) { unsigned int len; char *tmp_name = allocated_variable_expand_2 ( f->name, strcache2_get_len (&file_strcache, f->name), &len); const char *name = strcache_add_len (tmp_name, len); free (tmp_name); rename_file (f, name); } #endif /* CONFIG_WITH_2ND_TARGET_EXPANSION */ /* Remove all nonprecious intermediate files. If SIG is nonzero, this was caused by a fatal signal, meaning that a different message will be printed, and the message will go to stderr rather than stdout. */ void remove_intermediates (int sig) { struct file **file_slot; struct file **file_end; int doneany = 0; /* If there's no way we will ever remove anything anyway, punt early. */ if (question_flag || touch_flag || all_secondary) return; if (sig && just_print_flag) return; file_slot = (struct file **) files.ht_vec; file_end = file_slot + files.ht_size; for ( ; file_slot < file_end; file_slot++) if (! HASH_VACANT (*file_slot)) { struct file *f = *file_slot; /* Is this file eligible for automatic deletion? Yes, IFF: it's marked intermediate, it's not secondary, it wasn't given on the command line, and it's either a -include makefile or it's not precious. */ if (f->intermediate && (f->dontcare || !f->precious) && !f->secondary && !f->cmd_target) { int status; if (f->update_status == us_none) /* If nothing would have created this file yet, don't print an "rm" command for it. */ continue; if (just_print_flag) status = 0; else { status = unlink (f->name); if (status < 0 && errno == ENOENT) continue; } if (!f->dontcare) { if (sig) OS (error, NILF, _("*** Deleting intermediate file '%s'"), f->name); else { if (! doneany) DB (DB_BASIC, (_("Removing intermediate files...\n"))); if (!silent_flag) { if (! doneany) { fputs ("rm ", stdout); doneany = 1; } else putchar (' '); fputs (f->name, stdout); fflush (stdout); } } if (status < 0) perror_with_name ("unlink: ", f->name); } } } if (doneany && !sig) { putchar ('\n'); fflush (stdout); } } /* Given a string containing prerequisites (fully expanded), break it up into a struct dep list. Enter each of these prereqs into the file database. */ struct dep * split_prereqs (char *p) { struct dep *new = PARSE_FILE_SEQ (&p, struct dep, MAP_PIPE, NULL, PARSEFS_NONE); if (*p) { /* Files that follow '|' are "order-only" prerequisites that satisfy the dependency by existing: their modification times are irrelevant. */ struct dep *ood; ++p; ood = PARSE_SIMPLE_SEQ (&p, struct dep); if (! new) new = ood; else { struct dep *dp; for (dp = new; dp->next != NULL; dp = dp->next) ; dp->next = ood; } for (; ood != NULL; ood = ood->next) ood->ignore_mtime = 1; } return new; } /* Given a list of prerequisites, enter them into the file database. If STEM is set then first expand patterns using STEM. */ struct dep * enter_prereqs (struct dep *deps, const char *stem) { struct dep *d1; if (deps == 0) return 0; /* If we have a stem, expand the %'s. We use patsubst_expand to translate the prerequisites' patterns into plain prerequisite names. */ if (stem) { const char *pattern = "%"; char *buffer = variable_expand (""); struct dep *dp = deps, *dl = 0; while (dp != 0) { char *percent; int nl = strlen (dp->name) + 1; char *nm = alloca (nl); memcpy (nm, dp->name, nl); percent = find_percent (nm); if (percent) { char *o; /* We have to handle empty stems specially, because that would be equivalent to $(patsubst %,dp->name,) which will always be empty. */ if (stem[0] == '\0') { memmove (percent, percent+1, strlen (percent)); o = variable_buffer_output (buffer, nm, strlen (nm) + 1); } else o = patsubst_expand_pat (buffer, stem, pattern, nm, pattern+1, percent+1); /* If the name expanded to the empty string, ignore it. */ if (buffer[0] == '\0') { struct dep *df = dp; if (dp == deps) dp = deps = deps->next; else dp = dl->next = dp->next; free_dep (df); continue; } /* Save the name. */ dp->name = strcache_add_len (buffer, o - buffer); } dp->stem = stem; dp->staticpattern = 1; dl = dp; dp = dp->next; } } /* Enter them as files, unless they need a 2nd expansion. */ for (d1 = deps; d1 != 0; d1 = d1->next) { if (d1->need_2nd_expansion) continue; d1->file = lookup_file (d1->name); if (d1->file == 0) d1->file = enter_file (d1->name); d1->staticpattern = 0; d1->name = 0; } return deps; } /* Set the intermediate flag. */ static void set_intermediate (const void *item) { struct file *f = (struct file *) item; f->intermediate = 1; } /* Expand and parse each dependency line. */ static void expand_deps (struct file *f) { struct dep *d; struct dep **dp; const char *file_stem = f->stem; int initialized = 0; f->updating = 0; /* Walk through the dependencies. For any dependency that needs 2nd expansion, expand it then insert the result into the list. */ dp = &f->deps; d = f->deps; while (d != 0) { char *p; struct dep *new, *next; char *name = (char *)d->name; if (! d->name || ! d->need_2nd_expansion) { /* This one is all set already. */ dp = &d->next; d = d->next; continue; } #ifdef CONFIG_WITH_INCLUDEDEP /* Dependencies loaded by includedep are ready for use and we skip the expensive parsing and globbing for them. */ if (d->includedep) { d->need_2nd_expansion = 0; d->file = lookup_file (name); if (d->file == 0) d->file = enter_file (name); d->name = 0; free(name); dp = &d->next; d = d->next; continue; } #endif /* CONFIG_WITH_INCLUDEDEP */ /* If it's from a static pattern rule, convert the patterns into "$*" so they'll expand properly. */ if (d->staticpattern) { char *o = variable_expand (""); o = subst_expand (o, name, "%", "$*", 1, 2, 0); *o = '\0'; #ifndef CONFIG_WITH_STRCACHE2 free (name); d->name = name = xstrdup (variable_buffer); /* bird not d->name, can be reallocated */ #else d->name = strcache2_add (&file_strcache, variable_buffer, o - variable_buffer); #endif d->staticpattern = 0; } /* We're going to do second expansion so initialize file variables for the file. Since the stem for static pattern rules comes from individual dep lines, we will temporarily set f->stem to d->stem. */ if (!initialized) { initialize_file_variables (f, 0); initialized = 1; } if (d->stem != 0) f->stem = d->stem; #if defined(CONFIG_WITH_COMMANDS_FUNC) || defined (CONFIG_WITH_DOT_MUST_MAKE) set_file_variables (f, 0 /* real call, f->deps == 0 so we're ok. */); #else set_file_variables (f); #endif p = variable_expand_for_file (d->name, f); if (d->stem != 0) f->stem = file_stem; /* At this point we don't need the name anymore: free it. */ free (name); /* Parse the prerequisites and enter them into the file database. */ new = enter_prereqs (split_prereqs (p), d->stem); /* If there were no prereqs here (blank!) then throw this one out. */ if (new == 0) { *dp = d->next; free_dep (d); d = *dp; continue; } /* Add newly parsed prerequisites. */ next = d->next; #ifdef KMK /* bird: memory leak */ assert(new != d); free_dep (d); #endif *dp = new; for (dp = &new->next, d = new->next; d != 0; dp = &d->next, d = d->next) ; *dp = next; d = *dp; } } /* Reset the updating flag. */ static void reset_updating (const void *item) { struct file *f = (struct file *) item; f->updating = 0; } /* For each dependency of each file, make the 'struct dep' point at the appropriate 'struct file' (which may have to be created). Also mark the files depended on by .PRECIOUS, .PHONY, .SILENT, and various other special targets. */ void snap_deps (void) { struct file *f; struct file *f2; struct dep *d; /* Remember that we've done this. Once we start snapping deps we can no longer define new targets. */ snapped_deps = 1; #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION /* Perform 2nd target expansion on files which requires this. This will be re-inserting (delete+insert) hash table entries so we have to use hash_dump(). */ if (second_target_expansion) { struct file **file_slot_0, **file_end, **file_slot; # ifdef KMK /* turn on warnings here. */ int save = warn_undefined_variables_flag; warn_undefined_variables_flag = 1; # endif file_slot_0 = (struct file **) hash_dump (&files, 0, 0); file_end = file_slot_0 + files.ht_fill; for (file_slot = file_slot_0; file_slot < file_end; file_slot++) for (f = *file_slot; f != 0; f = f->prev) if (f->need_2nd_target_expansion) do_2nd_target_expansion (f); free (file_slot_0); # ifdef KMK warn_undefined_variables_flag = save; # endif /* Disable second target expansion now since we won't expand files entered after this point. (Saves CPU cycles in enter_file()). */ second_target_expansion = 0; } #endif /* CONFIG_WITH_2ND_TARGET_EXPANSION */ #ifdef CONFIG_WITH_INCLUDEDEP /* Process any queued includedep files. Since includedep is supposed to be *simple* stuff, we can do this after the second target expansion and thereby save a little time. */ incdep_flush_and_term (); #endif /* CONFIG_WITH_INCLUDEDEP */ /* Perform second expansion and enter each dependency name as a file. We must use hash_dump() here because within these loops we likely add new files to the table, possibly causing an in-situ table expansion. We only need to do this if second_expansion has been defined; if it hasn't then all deps were expanded as the makefile was read in. If we ever change make to be able to unset .SECONDARY_EXPANSION this will have to change. */ if (second_expansion) { struct file **file_slot_0 = (struct file **) hash_dump (&files, 0, 0); struct file **file_end = file_slot_0 + files.ht_fill; struct file **file_slot; const char *suffixes; /* Expand .SUFFIXES: its prerequisites are used for $$* calc. */ f = lookup_file (".SUFFIXES"); suffixes = f ? f->name : 0; for (; f != 0; f = f->prev) expand_deps (f); #if 0 /* def KMK - not-parallel is a performance kill, but since double-colon is werid anyway, skip this hack. */ /* This is a HACK to work around the still broken test #9 in features/double_colon. It produces the wrong result if the build is parallel because of changed evaluation order. Just make these problematic rules execute in single field till a proper fix is forthcomming... */ for (file_slot = file_slot_0; file_slot < file_end; file_slot++) if ( (f = *file_slot) != 0 && f->double_colon && ( f->double_colon != f || f->last != f)) for (f2 = f->double_colon; f2 != 0; f2 = f2->prev) f2->command_flags |= COMMANDS_NOTPARALLEL; #endif /* KMK */ /* For every target that's not .SUFFIXES, expand its prerequisites. */ for (file_slot = file_slot_0; file_slot < file_end; file_slot++) for (f = *file_slot; f != 0; f = f->prev) if (f->name != suffixes) expand_deps (f); free (file_slot_0); } else /* We're not doing second expansion, so reset updating. */ hash_map (&files, reset_updating); /* Now manage all the special targets. */ for (f = lookup_file (".PRECIOUS"); f != 0; f = f->prev) for (d = f->deps; d != 0; d = d->next) for (f2 = d->file; f2 != 0; f2 = f2->prev) f2->precious = 1; for (f = lookup_file (".LOW_RESOLUTION_TIME"); f != 0; f = f->prev) for (d = f->deps; d != 0; d = d->next) for (f2 = d->file; f2 != 0; f2 = f2->prev) f2->low_resolution_time = 1; for (f = lookup_file (".PHONY"); f != 0; f = f->prev) for (d = f->deps; d != 0; d = d->next) for (f2 = d->file; f2 != 0; f2 = f2->prev) { /* Mark this file as phony nonexistent target. */ f2->phony = 1; f2->is_target = 1; f2->last_mtime = NONEXISTENT_MTIME; f2->mtime_before_update = NONEXISTENT_MTIME; } for (f = lookup_file (".INTERMEDIATE"); f != 0; f = f->prev) /* Mark .INTERMEDIATE deps as intermediate files. */ for (d = f->deps; d != 0; d = d->next) for (f2 = d->file; f2 != 0; f2 = f2->prev) f2->intermediate = 1; /* .INTERMEDIATE with no deps does nothing. Marking all files as intermediates is useless since the goal targets would be deleted after they are built. */ for (f = lookup_file (".SECONDARY"); f != 0; f = f->prev) /* Mark .SECONDARY deps as both intermediate and secondary. */ if (f->deps) for (d = f->deps; d != 0; d = d->next) for (f2 = d->file; f2 != 0; f2 = f2->prev) f2->intermediate = f2->secondary = 1; /* .SECONDARY with no deps listed marks *all* files that way. */ else { all_secondary = 1; hash_map (&files, set_intermediate); } f = lookup_file (".EXPORT_ALL_VARIABLES"); if (f != 0 && f->is_target) export_all_variables = 1; f = lookup_file (".IGNORE"); if (f != 0 && f->is_target) { if (f->deps == 0) ignore_errors_flag = 1; else for (d = f->deps; d != 0; d = d->next) for (f2 = d->file; f2 != 0; f2 = f2->prev) f2->command_flags |= COMMANDS_NOERROR; } f = lookup_file (".SILENT"); if (f != 0 && f->is_target) { if (f->deps == 0) silent_flag = 1; else for (d = f->deps; d != 0; d = d->next) for (f2 = d->file; f2 != 0; f2 = f2->prev) f2->command_flags |= COMMANDS_SILENT; } f = lookup_file (".NOTPARALLEL"); if (f != 0 && f->is_target) #ifndef CONFIG_WITH_EXTENDED_NOTPARALLEL not_parallel = 1; #else /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ { if (f->deps == 0) { DB (DB_KMK, (_("not_parallel -1\n"))); not_parallel = -1; } else for (d = f->deps; d != 0; d = d->next) for (f2 = d->file; f2 != 0; f2 = f2->prev) f2->command_flags |= COMMANDS_NOTPARALLEL; } #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ #ifndef NO_MINUS_C_MINUS_O /* If .POSIX was defined, remove OUTPUT_OPTION to comply. */ /* This needs more work: what if the user sets this in the makefile? if (posix_pedantic) define_variable_cname ("OUTPUT_OPTION", "", o_default, 1); */ #endif } /* Set the 'command_state' member of FILE and all its 'also_make's. */ void set_command_state (struct file *file, enum cmd_state state) { struct dep *d; file->command_state = state; for (d = file->also_make; d != 0; d = d->next) d->file->command_state = state; #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (file->multi_head) for (file = file->multi_head; file != 0; file = file->multi_next) file->command_state = state; #endif } /* Convert an external file timestamp to internal form. */ FILE_TIMESTAMP file_timestamp_cons (const char *fname, time_t stamp, long int ns) { int offset = ORDINARY_MTIME_MIN + (FILE_TIMESTAMP_HI_RES ? ns : 0); FILE_TIMESTAMP s = stamp; FILE_TIMESTAMP product = (FILE_TIMESTAMP) s << FILE_TIMESTAMP_LO_BITS; FILE_TIMESTAMP ts = product + offset; if (! (s <= FILE_TIMESTAMP_S (ORDINARY_MTIME_MAX) && product <= ts && ts <= ORDINARY_MTIME_MAX)) { char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1]; const char *f = fname ? fname : _("Current time"); ts = s <= OLD_MTIME ? ORDINARY_MTIME_MIN : ORDINARY_MTIME_MAX; file_timestamp_sprintf (buf, ts); OSS (error, NILF, _("%s: Timestamp out of range; substituting %s"), f, buf); } return ts; } /* Return the current time as a file timestamp, setting *RESOLUTION to its resolution. */ FILE_TIMESTAMP file_timestamp_now (int *resolution) { int r; time_t s; int ns; /* Don't bother with high-resolution clocks if file timestamps have only one-second resolution. The code below should work, but it's not worth the hassle of debugging it on hosts where it fails. */ #if FILE_TIMESTAMP_HI_RES # if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME { struct timespec timespec; if (clock_gettime (CLOCK_REALTIME, ×pec) == 0) { r = 1; s = timespec.tv_sec; ns = timespec.tv_nsec; goto got_time; } } # endif # if HAVE_GETTIMEOFDAY { struct timeval timeval; if (gettimeofday (&timeval, 0) == 0) { r = 1000; s = timeval.tv_sec; ns = timeval.tv_usec * 1000; goto got_time; } } # endif #endif r = 1000000000; s = time ((time_t *) 0); ns = 0; #if FILE_TIMESTAMP_HI_RES got_time: #endif *resolution = r; return file_timestamp_cons (0, s, ns); } /* Place into the buffer P a printable representation of the file timestamp TS. */ void file_timestamp_sprintf (char *p, FILE_TIMESTAMP ts) { time_t t = FILE_TIMESTAMP_S (ts); struct tm *tm = localtime (&t); if (tm) sprintf (p, "%04d-%02d-%02d %02d:%02d:%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); else if (t < 0) sprintf (p, "%ld", (long) t); else sprintf (p, "%lu", (unsigned long) t); p += strlen (p); /* Append nanoseconds as a fraction, but remove trailing zeros. We don't know the actual timestamp resolution, since clock_getres applies only to local times, whereas this timestamp might come from a remote filesystem. So removing trailing zeros is the best guess that we can do. */ sprintf (p, ".%09d", FILE_TIMESTAMP_NS (ts)); p += strlen (p) - 1; while (*p == '0') p--; p += *p != '.'; *p = '\0'; } /* Print the data base of files. */ void print_prereqs (const struct dep *deps) { const struct dep *ood = 0; /* Print all normal dependencies; note any order-only deps. */ for (; deps != 0; deps = deps->next) if (! deps->ignore_mtime) printf (" %s", dep_name (deps)); else if (! ood) ood = deps; /* Print order-only deps, if we have any. */ if (ood) { printf (" | %s", dep_name (ood)); for (ood = ood->next; ood != 0; ood = ood->next) if (ood->ignore_mtime) printf (" %s", dep_name (ood)); } putchar ('\n'); } static void print_file (const void *item) { const struct file *f = item; /* If we're not using builtin targets, don't show them. Ideally we'd be able to delete them altogether but currently there's no facility to ever delete a file once it's been added. */ if (no_builtin_rules_flag && f->builtin) return; putchar ('\n'); if (f->cmds && f->cmds->recipe_prefix != cmd_prefix) { fputs (".RECIPEPREFIX = ", stdout); cmd_prefix = f->cmds->recipe_prefix; if (cmd_prefix != RECIPEPREFIX_DEFAULT) putchar (cmd_prefix); putchar ('\n'); } if (f->variables != 0) print_target_variables (f); if (!f->is_target) puts (_("# Not a target:")); #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (f->multi_head) { const struct file *f2; if (f->multi_head == f) { int multi_maybe = -1; assert (!f->multi_maybe); assert (!f->double_colon); printf ("%s", f->name); for (f2 = f->multi_next; f2 != 0; f2 = f2->multi_next) { printf (" %s%s", f2->multi_maybe != multi_maybe ? f2->multi_maybe ? "+| " : "+ " : "", f2->name); multi_maybe = f2->multi_maybe; } if (f->deps) printf (": \\\n\t"); else putchar (':'); } else printf ("%s:%s", f->name, f->double_colon ? ":" : ""); } else #endif printf ("%s:%s", f->name, f->double_colon ? ":" : ""); print_prereqs (f->deps); #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET if (f->multi_head && f->multi_head != f) { const struct file *f2; fputs (_("# In multi target list:"), stdout); for (f2 = f->multi_head; f2 != 0; f2 = f2->multi_next) printf (" %s%s", f2->name, f == f2 ? "(*)" : ""); putchar ('\n'); if (f->multi_maybe) puts (_("# File is an optional multi target member.")); } #endif if (f->precious) puts (_("# Precious file (prerequisite of .PRECIOUS).")); if (f->phony) puts (_("# Phony target (prerequisite of .PHONY).")); if (f->cmd_target) puts (_("# Command line target.")); if (f->dontcare) puts (_("# A default, MAKEFILES, or -include/sinclude makefile.")); #if defined (CONFIG_WITH_COMPILER) || defined (CONFIG_WITH_MAKE_STATS) if (f->eval_count > 0) { # ifdef CONFIG_WITH_COMPILER if (f->evalprog) printf (_("# Makefile evaluated %u times - compiled\n"), f->eval_count); else # endif printf (_("# Makefile evaluated %u times\n"), f->eval_count); } #endif if (f->builtin) puts (_("# Builtin rule")); puts (f->tried_implicit ? _("# Implicit rule search has been done.") : _("# Implicit rule search has not been done.")); if (f->stem != 0) printf (_("# Implicit/static pattern stem: '%s'\n"), f->stem); if (f->intermediate) puts (_("# File is an intermediate prerequisite.")); if (f->also_make != 0) { const struct dep *d; fputs (_("# Also makes:"), stdout); for (d = f->also_make; d != 0; d = d->next) printf (" %s", dep_name (d)); putchar ('\n'); } if (f->last_mtime == UNKNOWN_MTIME) puts (_("# Modification time never checked.")); else if (f->last_mtime == NONEXISTENT_MTIME) puts (_("# File does not exist.")); else if (f->last_mtime == OLD_MTIME) puts (_("# File is very old.")); else { char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1]; file_timestamp_sprintf (buf, f->last_mtime); printf (_("# Last modified %s\n"), buf); } puts (f->updated ? _("# File has been updated.") : _("# File has not been updated.")); switch (f->command_state) { case cs_running: puts (_("# Recipe currently running (THIS IS A BUG).")); break; case cs_deps_running: puts (_("# Dependencies recipe running (THIS IS A BUG).")); break; case cs_not_started: case cs_finished: switch (f->update_status) { case us_none: break; case us_success: puts (_("# Successfully updated.")); break; case us_question: assert (question_flag); puts (_("# Needs to be updated (-q is set).")); break; case us_failed: puts (_("# Failed to be updated.")); break; } break; default: puts (_("# Invalid value in 'command_state' member!")); fflush (stdout); fflush (stderr); abort (); } if (f->variables != 0) print_file_variables (f); if (f->cmds != 0) print_commands (f->cmds); if (f->prev) print_file ((const void *) f->prev); } void print_file_data_base (void) { puts (_("\n# Files")); hash_map (&files, print_file); fputs (_("\n# files hash-table stats:\n# "), stdout); hash_print_stats (&files, stdout); } #ifdef CONFIG_WITH_PRINT_STATS_SWITCH void print_file_stats (void) { fputs (_("\n# files hash-table stats:\n# "), stdout); hash_print_stats (&files, stdout); fputs ("\n", stdout); } #endif /* Verify the integrity of the data base of files. */ #define VERIFY_CACHED(_p,_n) \ do{ \ if (_p->_n && _p->_n[0] && !strcache_iscached (_p->_n)) \ error (NULL, strlen (_p->name) + CSTRLEN (# _n) + strlen (_p->_n), \ _("%s: Field '%s' not cached: %s"), _p->name, # _n, _p->_n); \ }while(0) static void verify_file (const void *item) { const struct file *f = item; const struct dep *d; VERIFY_CACHED (f, name); VERIFY_CACHED (f, hname); VERIFY_CACHED (f, vpath); VERIFY_CACHED (f, stem); /* Check the deps. */ for (d = f->deps; d != 0; d = d->next) { if (! d->need_2nd_expansion) VERIFY_CACHED (d, name); VERIFY_CACHED (d, stem); } } void verify_file_data_base (void) { hash_map (&files, verify_file); } #define EXPANSION_INCREMENT(_l) ((((_l) / 500) + 1) * 500) char * build_target_list (char *value) { static unsigned long last_targ_count = 0; if (files.ht_fill != last_targ_count) { unsigned long max = EXPANSION_INCREMENT (strlen (value)); unsigned long len; char *p; struct file **fp = (struct file **) files.ht_vec; struct file **end = &fp[files.ht_size]; /* Make sure we have at least MAX bytes in the allocated buffer. */ value = xrealloc (value, max); p = value; len = 0; for (; fp < end; ++fp) if (!HASH_VACANT (*fp) && (*fp)->is_target) { struct file *f = *fp; int l = strlen (f->name); len += l + 1; if (len > max) { unsigned long off = p - value; max += EXPANSION_INCREMENT (l + 1); value = xrealloc (value, max); p = &value[off]; } memcpy (p, f->name, l); p += l; *(p++) = ' '; } *(p-1) = '\0'; last_targ_count = files.ht_fill; } return value; } void init_hash_files (void) { #ifndef CONFIG_WITH_STRCACHE2 # ifdef KMK hash_init (&files, /*65535*/ 32755, file_hash_1, file_hash_2, file_hash_cmp); # else hash_init (&files, 1000, file_hash_1, file_hash_2, file_hash_cmp); # endif #else /* CONFIG_WITH_STRCACHE2 */ # ifdef KMK hash_init_strcached (&files, 32755, &file_strcache, offsetof (struct file, hname)); # else hash_init_strcached (&files, 1000, &file_strcache, offsetof (struct file, hname)); # endif #endif /* CONFIG_WITH_STRCACHE2 */ } /* EOF */ kbuild-3608/src/kmk/testcase-ifeq-escape.kmk0000664000175000017500000000037714670377413021001 0ustar locutuslocutus# $Id: testcase-ifeq-escape.kmk 3154 2018-03-15 23:35:33Z bird $ # Testcase for weird 'ifeq' and funny escapes. ifeq "1 \ \ \ \ \ " \ "1 " $(info info: ifeq -> equal) else $(error info: ifeq -> not equal - wrong) endif all: @echo okay kbuild-3608/src/kmk/config.h.haiku0000664000175000017500000003133714670377415017022 0ustar locutuslocutus/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if the `closedir' function returns void instead of `int'. */ /* #undef CLOSEDIR_VOID */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ /* Define to 1 if using `getloadavg.c'. */ #define C_GETLOADAVG 1 /* Define to 1 for DGUX with . */ /* #undef DGUX */ /* Use high resolution file timestamps if nonzero. */ #define FILE_TIMESTAMP_HI_RES 1 /* Define to 1 if the `getloadavg' function needs to be run setuid or setgid. */ /* #undef GETLOADAVG_PRIVILEGED */ /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 /* Define to 1 if you have and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define to 1 if your compiler conforms to the ANSI C standard. */ #define HAVE_ANSI_COMPILER 1 /* Define to 1 if you have the `atexit' function. */ #define HAVE_ATEXIT 1 /* Use case insensitive file names */ /* #undef HAVE_CASE_INSENSITIVE_FS */ /* Define to 1 if you have the clock_gettime function. */ #define HAVE_CLOCK_GETTIME 1 /* Define to 1 if you have the declaration of `bsd_signal', and to 0 if you don't. */ #define HAVE_DECL_BSD_SIGNAL 0 /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ #define HAVE_DECL_SYS_SIGLIST 1 /* Define to 1 if you have the declaration of `_sys_siglist', and to 0 if you don't. */ #define HAVE_DECL__SYS_SIGLIST 0 /* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you don't. */ #define HAVE_DECL___SYS_SIGLIST 0 /* Define to 1 if you have the header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ /* #undef HAVE_DOPRNT */ /* Use platform specific coding */ /* #undef HAVE_DOS_PATHS */ /* Define to 1 if you have the `dup2' function. */ #define HAVE_DUP2 1 /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `fdopen' function. */ #define HAVE_FDOPEN 1 /* Define to 1 if you have the `fileno' function. */ #define HAVE_FILENO 1 /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 /* Define to 1 if you have the `getcwd' function. */ #define HAVE_GETCWD 1 /* Define to 1 if you have the `getgroups' function. */ #define HAVE_GETGROUPS 1 /* Define to 1 if you have the `gethostbyname' function. */ /* #undef HAVE_GETHOSTBYNAME */ /* Define to 1 if you have the `gethostname' function. */ /* #undef HAVE_GETHOSTNAME */ /* Define to 1 if you have the `getloadavg' function. */ /* #undef HAVE_GETLOADAVG */ /* Define to 1 if you have the `getrlimit' function. */ #define HAVE_GETRLIMIT 1 /* Define to 1 if you have a standard gettimeofday function */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `dgc' library (-ldgc). */ /* #undef HAVE_LIBDGC */ /* Define to 1 if you have the `kstat' library (-lkstat). */ /* #undef HAVE_LIBKSTAT */ /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LOCALE_H 1 /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_MACH_MACH_H */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `mkstemp' function. */ #define HAVE_MKSTEMP 1 /* Define to 1 if you have the `mktemp' function. */ #define HAVE_MKTEMP 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_NLIST_H */ /* Define to 1 if you have the `pipe' function. */ #define HAVE_PIPE 1 /* Define to 1 if you have the `pstat_getdynamic' function. */ /* #undef HAVE_PSTAT_GETDYNAMIC */ /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 /* Define to 1 if defines the SA_RESTART constant. */ #define HAVE_SA_RESTART 1 /* Define to 1 if you have the `setegid' function. */ #define HAVE_SETEGID 1 /* Define to 1 if you have the `seteuid' function. */ #define HAVE_SETEUID 1 /* Define to 1 if you have the `setlinebuf' function. */ #define HAVE_SETLINEBUF 1 /* Define to 1 if you have the `setlocale' function. */ #define HAVE_SETLOCALE 1 /* Define to 1 if you have the `setregid' function. */ #define HAVE_SETREGID 1 /* Define to 1 if you have the `setreuid' function. */ #define HAVE_SETREUID 1 /* Define to 1 if you have the `setrlimit' function. */ #define HAVE_SETRLIMIT 1 /* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the `sigsetmask' function. */ /* #undef HAVE_SIGSETMASK */ /* Define to 1 if you have the `socket' function. */ /* #undef HAVE_SOCKET */ /* Define to 1 if you have the header file. */ #define HAVE_STDARG_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strcasecmp' function. */ #define HAVE_STRCASECMP 1 /* Define to 1 if you have the `strcmpi' function. */ /* #undef HAVE_STRCMPI */ /* Define to 1 if you have the `strcoll' function and it is properly defined. */ #define HAVE_STRCOLL 1 /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the `stricmp' function. */ /* #undef HAVE_STRICMP */ /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strncasecmp' function. */ #define HAVE_STRNCASECMP 1 /* Define to 1 if you have the `strncmpi' function. */ /* #undef HAVE_STRNCMPI */ /* Define to 1 if you have the `strndup' function. */ #define HAVE_STRNDUP 1 /* Define to 1 if you have the `strnicmp' function. */ /* #undef HAVE_STRNICMP */ /* Define to 1 if you have the `strsignal' function. */ #define HAVE_STRSIGNAL 1 /* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */ /* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIMEB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the \`union wait' type in . */ /* #undef HAVE_UNION_WAIT */ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_VARARGS_H */ /* Define to 1 if you have the `vfork' function. */ #define HAVE_VFORK 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_VFORK_H */ /* Define to 1 if you have the `vprintf' function. */ #define HAVE_VPRINTF 1 /* Define to 1 if you have the `wait3' function. */ /* #undef HAVE_WAIT3 */ /* Define to 1 if you have the `waitpid' function. */ #define HAVE_WAITPID 1 /* Define to 1 if `fork' works. */ #define HAVE_WORKING_FORK 1 /* Define to 1 if `vfork' works. */ #define HAVE_WORKING_VFORK 1 /* Build host information. (not used by kmk) */ #define MAKE_HOST "i586-pc-haiku" /* Define to 1 to enable job server support in GNU make. */ #define MAKE_JOBSERVER 1 /* Define to 1 to enable symbolic link timestamp checking. */ #define MAKE_SYMLINKS 1 /* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend on `HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* #undef NLIST_NAME_UNION */ /* Define to 1 if struct nlist.n_name is a pointer rather than an array. */ /* #undef NLIST_STRUCT */ /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Name of package */ #define PACKAGE "make" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "bug-make@gnu.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "GNU make" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "GNU make 3.82" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "make" /* Define to the home page for this package. */ #define PACKAGE_URL "http://www.gnu.org/software/make/" /* Define to the version of this package. */ #define PACKAGE_VERSION "3.82" /* Define to the character that separates directories in PATH. */ #define PATH_SEPARATOR_CHAR ':' /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void /* Define to the name of the SCCS 'get' command. */ #define SCCS_GET "get" /* Define to 1 if the SCCS 'get' command understands the '-G' option. */ /* #undef SCCS_GET_MINUS_G */ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define to 1 if the `S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if struct stat contains a nanoseconds field */ #define ST_MTIM_NSEC tv_nsec /* Define to 1 on System V Release 4. */ /* #undef SVR4 */ /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 /* Define to 1 for Encore UMAX. */ /* #undef UMAX */ /* Define to 1 for Encore UMAX 4.3 that has instead of . */ /* #undef UMAX4_3 */ /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # define _ALL_SOURCE 1 #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # define _POSIX_PTHREAD_SEMANTICS 1 #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE 1 #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # define __EXTENSIONS__ 1 #endif /* Version number of package */ #define VERSION "3.82" /* Use platform specific coding */ /* #undef WINDOWS32 */ /* Define if using the dmalloc debugging malloc package */ /* #undef WITH_DMALLOC */ /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define to 1 if on MINIX. */ /* #undef _MINIX */ /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `int' if doesn't define. */ /* #undef gid_t */ /* Define to `int' if does not define. */ /* #undef pid_t */ /* Define to `unsigned int' if does not define. */ /* #undef size_t */ /* Define to `int' if doesn't define. */ /* #undef uid_t */ /* Define uintmax_t if not defined in or . */ /* #undef uintmax_t */ /* Define as `fork' if `vfork' does not work. */ /* #undef vfork */ #include "inlined_memchr.h" kbuild-3608/src/kmk/kbuildprf.c0000664000175000017500000000150514670377415016424 0ustar locutuslocutus#include #include #include #include __int64 prf_now(void) { return GetTickCount(); } #undef open int prf_open(const char *name, int of, int mask) { int fd; // int err; // __int64 t = prf_now(); fd = _open(name, of, mask); // err = errno; // t = prf_now() - t; // fprintf(stderr, "open(%s, %#x) -> %d/%d in %lu\n", name, of, fd, err, (long)t); // errno = err; return fd; } #undef close int prf_close(int fd) { int rc; rc = _close(fd); return rc; } #undef read int prf_read(int fd, void *buf, long cb) { int cbRead; cbRead = _read(fd, buf, cb); return cbRead; } #undef lseek long prf_lseek(int fd, long off, int whence) { long rc; rc = _lseek(fd, off, whence); return rc; } kbuild-3608/src/kmk/dosbuild.bat0000664000175000017500000000647014670377414016600 0ustar locutuslocutus@echo off rem Copyright (C) 1998-2016 Free Software Foundation, Inc. rem This file is part of GNU Make. rem rem GNU Make is free software; you can redistribute it and/or modify it under rem the terms of the GNU General Public License as published by the Free rem Software Foundation; either version 3 of the License, or (at your option) rem any later version. rem rem GNU Make is distributed in the hope that it will be useful, but WITHOUT rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for. rem more details. rem rem You should have received a copy of the GNU General Public License along rem with this program. If not, see . echo Building Make for MSDOS rem Echo ON so they will see what is going on. @echo on gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g commands.c -o commands.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g output.c -o output.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g job.c -o job.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g dir.c -o dir.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g file.c -o file.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g misc.c -o misc.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g main.c -o main.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -DINCLUDEDIR=\"c:/djgpp/include\" -O2 -g read.c -o read.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -DLIBDIR=\"c:/djgpp/lib\" -O2 -g remake.c -o remake.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g rule.c -o rule.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g implicit.c -o implicit.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g default.c -o default.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g variable.c -o variable.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g expand.c -o expand.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g function.c -o function.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g vpath.c -o vpath.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g hash.c -o hash.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g strcache.c -o strcache.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g version.c -o version.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g ar.c -o ar.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g arscan.c -o arscan.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g signame.c -o signame.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g remote-stub.c -o remote-stub.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g getopt.c -o getopt.o gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g getopt1.c -o getopt1.o @cd glob @if exist libglob.a del libglob.a gcc -I. -c -DHAVE_CONFIG_H -I.. -O2 -g glob.c -o glob.o gcc -I. -c -DHAVE_CONFIG_H -I.. -O2 -g fnmatch.c -o fnmatch.o ar rv libglob.a glob.o fnmatch.o @echo off cd .. echo commands.o > respf.$$$ for %%f in (job output dir file misc main read remake rule implicit default variable) do echo %%f.o >> respf.$$$ for %%f in (expand function vpath hash strcache version ar arscan signame remote-stub getopt getopt1) do echo %%f.o >> respf.$$$ echo glob/libglob.a >> respf.$$$ rem gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g guile.c -o guile.o rem echo guile.o >> respf.$$$ @echo Linking... @echo on gcc -o make.new @respf.$$$ @if exist make.exe echo Make.exe is now built! @if not exist make.exe echo Make.exe build failed... @if exist make.exe del respf.$$$ kbuild-3608/src/kmk/vmsify.c0000664000175000017500000004430514670377415015764 0ustar locutuslocutus/* vmsify.c -- Module for vms <-> unix file name conversion Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ /* Written by Klaus Kämpf (kkaempf@progis.de) of proGIS Software, Aachen, Germany */ #include #include #include #include "makeint.h" #if VMS #include #include #include #include #include #include #include #include /* Initialize a string descriptor (struct dsc$descriptor_s) for an arbitrary string. ADDR is a pointer to the first character of the string, and LEN is the length of the string. */ #define INIT_DSC_S(dsc, addr, len) do { \ (dsc).dsc$b_dtype = DSC$K_DTYPE_T; \ (dsc).dsc$b_class = DSC$K_CLASS_S; \ (dsc).dsc$w_length = (len); \ (dsc).dsc$a_pointer = (addr); \ } while (0) /* Initialize a string descriptor (struct dsc$descriptor_s) for a NUL-terminated string. S is a pointer to the string; the length is determined by calling strlen(). */ #define INIT_DSC_CSTRING(dsc, s) INIT_DSC_S(dsc, s, strlen(s)) #endif /* copy 'from' to 'to' up to but not including 'upto' return 0 if eos on from return 1 if upto found return 'to' at last char + 1 return 'from' at match + 1 or eos if no match if as_dir == 1, change all '.' to '_' else change all '.' but the last to '_' */ static int copyto (char **to, const char **from, char upto, int as_dir) { const char *s; s = strrchr (*from, '.'); while (**from) { if (**from == upto) { do { (*from)++; } while (**from == upto); return 1; } if (**from == '.') { if ((as_dir == 1) || (*from != s)) **to = '_'; else **to = '.'; } else { #ifdef HAVE_CASE_INSENSITIVE_FS if (isupper ((unsigned char)**from)) **to = tolower ((unsigned char)**from); else #endif **to = **from; } (*to)++; (*from)++; } return 0; } /* get translation of logical name */ static char * trnlog (const char *name) { int stat; static char reslt[1024]; $DESCRIPTOR (reslt_dsc, reslt); short resltlen; struct dsc$descriptor_s name_dsc; char *s; /* * the string isn't changed, but there is no string descriptor with * "const char *dsc$a_pointer" */ INIT_DSC_CSTRING (name_dsc, (char *)name); stat = lib$sys_trnlog (&name_dsc, &resltlen, &reslt_dsc); if ((stat&1) == 0) { return ""; } if (stat == SS$_NOTRAN) { return ""; } reslt[resltlen] = '\0'; s = xmalloc (resltlen+1); strcpy (s, reslt); return s; } static char * showall (char *s) { static char t[512]; char *pt; pt = t; if (strchr (s, '\\') == 0) return s; while (*s) { if (*s == '\\') { *pt++ = *s; } *pt++ = *s++; } return pt; } enum namestate { N_START, N_DEVICE, N_OPEN, N_DOT, N_CLOSED, N_DONE }; /* convert unix style name to vms style type = 0 -> name is a full name (directory and filename part) type = 1 -> name is a directory type = 2 -> name is a filename without directory The following conversions are applied (0) (1) (2) input full name dir name file name 1 ./ [] .dir 2 ../ .dir 3 // : :[000000] :000000.dir 4 //a a: a: a: 5 //a/ a: a: a:000000.dir 9 / [000000] [000000] 000000.dir 10 /a [000000]a [a] [000000]a 11 /a/ [a] [a] [000000]a.dir 12 /a/b [a]b [a.b] [a]b 13 /a/b/ [a.b] [a.b] [a]b.dir 14 /a/b/c [a.b]c [a.b.c] [a.b]c 15 /a/b/c/ [a.b.c] [a.b.c] [a.b]c.dir 16 a a [.a] a 17 a/ [.a] [.a] a.dir 18 a/b [.a]b [.a.b] [.a]b 19 a/b/ [.a.b] [.a.b] [.a]b.dir 20 a/b/c [.a.b]c [.a.b.c] [.a.b]c 21 a/b/c/ [.a.b.c] [.a.b.c] [.a.b]c.dir 22 a.b.c a_b.c [.a_b_c] a_b_c.dir 23 [x][y]z [x.y]z [x.y]z [x.y]z 24 [x][.y]z [x.y]z [x.y]z [x.y]z 25 filenames with '$' are left unchanged if they contain no '/' 25 filenames with ':' are left unchanged 26 filenames with a single pair of '[' ']' are left unchanged The input string is not written to. The result is also const because it's a static buffer; we don't want to change it. */ const char * vmsify (const char *name, int type) { /* max 255 device max 39 directory max 39 filename max 39 filetype max 5 version */ /* todo: VMSMAXPATHLEN is defined for ODS2 names: it needs to be adjusted. */ #define VMSMAXPATHLEN 512 enum namestate nstate; static char vmsname[VMSMAXPATHLEN+1]; const char *fptr; const char *t; char *vptr; int as_dir; int count; const char *s; const char *s1; const char *s2; if (name == 0) return 0; fptr = name; vptr = vmsname; nstate = N_START; /* case 25a */ t = strpbrk (name, "$:"); if (t != 0) { // const char *s1; // const char *s2; if (type == 1) { s1 = strchr (t+1, '['); s2 = strchr (t+1, ']'); } if (*t == '$') { if (strchr (name, '/') == 0) { strcpy (vmsname, name); if ((type == 1) && (s1 != 0) && (s2 == 0)) strcat (vmsname, "]"); return vmsname; } } else { strcpy (vmsname, name); if ((type == 1) && (s1 != 0) && (s2 == 0)) strcat (vmsname, "]"); return vmsname; } } /* case 26 */ t = strchr (name, '['); if (t != 0) { // const char *s; // const char *s1 = strchr (t+1, '['); s1 = strchr (t+1, '['); if (s1 == 0) { strcpy (vmsname, name); if ((type == 1) && (strchr (t+1, ']') == 0)) strcat (vmsname, "]"); return vmsname; } s1--; if (*s1 != ']') { strcpy (vmsname, name); return vmsname; /* not ][, keep unchanged */ } /* we have ][ */ s = name; /* s -> starting char s1 -> ending ']' */ do { strncpy (vptr, s, s1-s); /* copy up to but not including ']' */ vptr += s1-s; if (*s1 == 0) break; s = s1 + 1; /* s -> char behind ']' */ if (*s != '[') /* was '][' ? */ break; /* no, last ] found, exit */ s++; if (*s != '.') *vptr++ = '.'; s1 = strchr (s, ']'); if (s1 == 0) /* no closing ] */ s1 = s + strlen (s); } while (1); *vptr++ = ']'; fptr = s; } else /* no [ in name */ { int state = 0; int rooted = 1; /* flag if logical is rooted, else insert [000000] */ do { switch (state) { case 0: /* start of loop */ if (*fptr == '/') { fptr++; state = 1; } else if (*fptr == '.') { fptr++; state = 10; } else state = 2; break; case 1: /* '/' at start */ if (*fptr == '/') { fptr++; state = 3; } else state = 4; break; case 2: /* no '/' at start */ { const char *s = strchr (fptr, '/'); if (s == 0) /* no '/' (16) */ { if (type == 1) { strcpy (vptr, "[."); vptr += 2; } copyto (&vptr, &fptr, 0, (type==1)); if (type == 1) *vptr++ = ']'; state = -1; } else /* found '/' (17..21) */ { if ((type == 2) && (*(s+1) == 0)) /* 17(2) */ { copyto (&vptr, &fptr, '/', 1); state = 7; } else { strcpy (vptr, "[."); vptr += 2; copyto (&vptr, &fptr, '/', 1); nstate = N_OPEN; state = 9; } } break; } case 3: /* '//' at start */ { // const char *s; // const char *s1; char *vp; while (*fptr == '/') /* collapse all '/' */ fptr++; if (*fptr == 0) /* just // */ { char cwdbuf[VMSMAXPATHLEN+1]; s1 = getcwd(cwdbuf, VMSMAXPATHLEN); if (s1 == 0) { vmsname[0] = '\0'; return vmsname; /* FIXME, err getcwd */ } s = strchr (s1, ':'); if (s == 0) { vmsname[0] = '\0'; return vmsname; /* FIXME, err no device */ } strncpy (vptr, s1, s-s1+1); vptr += s-s1+1; state = -1; break; } s = vptr; if (copyto (&vptr, &fptr, '/', 1) == 0) /* copy device part */ { *vptr++ = ':'; state = -1; break; } *vptr = ':'; nstate = N_DEVICE; if (*fptr == 0) /* just '//a/' */ { strcpy (vptr+1, "[000000]"); vptr += 9; state = -1; break; } *vptr = 0; /* check logical for [000000] insertion */ vp = trnlog (s); if (*vp != '\0') { /* found translation */ for (;;) /* loop over all nested logicals */ { char *vp2 = vp + strlen (vp) - 1; if (*vp2 == ':') /* translation ends in ':' */ { vp2 = trnlog (vp); free (vp); if (*vp2 == 0) { rooted = 0; break; } vp = vp2; continue; /* next iteration */ } if (*vp2 == ']') /* translation ends in ']' */ { if (*(vp2-1) == '.') /* ends in '.]' */ { if (strncmp (fptr, "000000", 6) != 0) rooted = 0; } else { strcpy (vmsname, s1); vp = strchr (vmsname, ']'); *vp = '.'; nstate = N_DOT; vptr = vp; } } break; } free (vp); } else rooted = 0; if (*vptr == 0) { nstate = N_DEVICE; *vptr++ = ':'; } else vptr++; if (rooted == 0) { nstate = N_DOT; strcpy (vptr, "[000000."); vptr += 8; vp = vptr-1; } else vp = 0; /* vp-> '.' after 000000 or NULL */ s = strchr (fptr, '/'); if (s == 0) { /* no next '/' */ if (*(vptr-1) == '.') *(vptr-1) = ']'; else if (rooted == 0) *vptr++ = ']'; copyto (&vptr, &fptr, 0, (type == 1)); state = -1; break; } else { while (*(s+1) == '/') /* skip multiple '/' */ s++; } if ((rooted != 0) && (*(vptr-1) != '.')) { *vptr++ = '['; nstate = N_DOT; } else if ((nstate == N_DOT) && (vp != 0) && (*(s+1) == 0)) { if (type == 2) { *vp = ']'; nstate = N_CLOSED; } } state = 9; break; } case 4: /* single '/' at start (9..15) */ if (*fptr == 0) state = 5; else state = 6; break; case 5: /* just '/' at start (9) */ if (type != 2) { *vptr++ = '['; nstate = N_OPEN; } strcpy (vptr, "000000"); vptr += 6; if (type == 2) state = 7; else state = 8; break; case 6: /* chars following '/' at start 10..15 */ { const char *s; *vptr++ = '['; nstate = N_OPEN; s = strchr (fptr, '/'); if (s == 0) /* 10 */ { if (type != 1) { strcpy (vptr, "000000]"); vptr += 7; } copyto (&vptr, &fptr, 0, (type == 1)); if (type == 1) { *vptr++ = ']'; } state = -1; } else /* 11..15 */ { if ( (type == 2) && (*(s+1) == 0)) /* 11(2) */ { strcpy (vptr, "000000]"); nstate = N_CLOSED; vptr += 7; } copyto (&vptr, &fptr, '/', (*(vptr-1) != ']')); state = 9; } break; } case 7: /* add '.dir' and exit */ if ((nstate == N_OPEN) || (nstate == N_DOT)) { char *vp = vptr-1; while (vp > vmsname) { if (*vp == ']') { break; } if (*vp == '.') { *vp = ']'; break; } vp--; } } strcpy (vptr, ".dir"); vptr += 4; state = -1; break; case 8: /* add ']' and exit */ *vptr++ = ']'; state = -1; break; case 9: /* 17..21, fptr -> 1st '/' + 1 */ { const char *s; if (*fptr == 0) { if (type == 2) { state = 7; } else state = 8; break; } s = strchr (fptr, '/'); if (s == 0) { if (type != 1) { if (nstate == N_OPEN) { *vptr++ = ']'; nstate = N_CLOSED; } as_dir = 0; } else { if (nstate == N_OPEN) { *vptr++ = '.'; nstate = N_DOT; } as_dir = 1; } } else { while (*(s+1) == '/') s++; if ( (type == 2) && (*(s+1) == 0)) /* 19(2), 21(2)*/ { if (nstate != N_CLOSED) { *vptr++ = ']'; nstate = N_CLOSED; } as_dir = 1; } else { if (nstate == N_OPEN) { *vptr++ = '.'; nstate = N_DOT; } as_dir = 1; } } if ( (*fptr == '.') /* check for '..' or '../' */ && (*(fptr+1) == '.') && ((*(fptr+2) == '/') || (*(fptr+2) == 0)) ) { char *vp; fptr += 2; if (*fptr == '/') { do { fptr++; } while (*fptr == '/'); } else if (*fptr == 0) type = 1; vptr--; /* vptr -> '.' or ']' */ vp = vptr; for (;;) { vp--; if (*vp == '.') /* one back */ { vptr = vp; nstate = N_OPEN; break; } if (*vp == '[') /* top level reached */ { if (*fptr == 0) { strcpy (vp, "[000000]"); vptr = vp + 8; nstate = N_CLOSED; s = 0; break; } else { vptr = vp+1; nstate = N_OPEN; break; } } } } else { copyto (&vptr, &fptr, '/', as_dir); if (nstate == N_DOT) nstate = N_OPEN; } if (s == 0) { /* 18,20 */ if (type == 1) *vptr++ = ']'; state = -1; } else { if (*(s+1) == 0) { if (type == 2) /* 19,21 */ { state = 7; } else { *vptr++ = ']'; state = -1; } } } break; } case 10: /* 1,2 first is '.' */ if (*fptr == '.') { fptr++; state = 11; } else state = 12; break; case 11: /* 2, '..' at start */ count = 1; if (*fptr != 0) { if (*fptr != '/') /* got ..xxx */ { strcpy (vmsname, name); return vmsname; } do /* got ../ */ { fptr++; while (*fptr == '/') fptr++; if (*fptr != '.') break; if (*(fptr+1) != '.') break; fptr += 2; if ((*fptr == 0) || (*fptr == '/')) count++; } while (*fptr == '/'); } { /* got '..' or '../' */ char *vp; char cwdbuf[VMSMAXPATHLEN+1]; vp = getcwd(cwdbuf, VMSMAXPATHLEN); if (vp == 0) { vmsname[0] = '\0'; return vmsname; /* FIXME, err getcwd */ } strcpy (vptr, vp); vp = strchr (vptr, ']'); if (vp != 0) { nstate = N_OPEN; while (vp > vptr) { vp--; if (*vp == '[') { vp++; strcpy (vp, "000000]"); state = -1; break; } else if (*vp == '.') { if (--count == 0) { if (*fptr == 0) /* had '..' or '../' */ { *vp++ = ']'; state = -1; } else /* had '../xxx' */ { state = 9; } *vp = '\0'; break; } } } } vptr += strlen (vptr); } break; case 12: /* 1, '.' at start */ if (*fptr != 0) { if (*fptr != '/') { strcpy (vmsname, name); return vmsname; } while (*fptr == '/') fptr++; } { char *vp; char cwdbuf[VMSMAXPATHLEN+1]; vp = getcwd(cwdbuf, VMSMAXPATHLEN); if (vp == 0) { vmsname[0] = '\0'; return vmsname; /*FIXME, err getcwd */ } strcpy (vptr, vp); } if (*fptr == 0) { state = -1; break; } else { char *vp = strchr (vptr, ']'); if (vp == 0) { state = -1; break; } *vp = '\0'; nstate = N_OPEN; vptr += strlen (vptr); state = 9; } break; } } while (state > 0); } /* directory conversion done fptr -> filename part of input string vptr -> free space in vmsname */ *vptr++ = 0; return vmsname; } /* convert from vms-style to unix-style dev:[dir1.dir2] //dev/dir1/dir2/ */ const char * unixify (const char *name) { static char piece[512]; const char *s; char *p; if (strchr (name, '/') != 0) /* already in unix style */ { strcpy (piece, name); return piece; } p = piece; *p = 0; /* device part */ s = strchr (name, ':'); if (s != 0) { int l = s - name; *p++ = '/'; *p++ = '/'; strncpy (p, name, l); p += l; } /* directory part */ *p++ = '/'; s = strchr (name, '['); if (s != 0) { s++; switch (*s) { case ']': /* [] */ strcat (p, "./"); break; case '-': /* [- */ strcat (p, "../"); break; case '.': strcat (p, "./"); /* [. */ break; default: s--; break; } s++; while (*s) { if (*s == '.') *p++ = '/'; else *p++ = *s; s++; if (*s == ']') { s++; break; } } if (*s != 0) /* more after ']' ?? */ { if (*(p-1) != '/') *p++ = '/'; strcpy (p, s); /* copy it anyway */ } } else /* no '[' anywhere */ { *p++ = 0; } /* force end with '/' */ if (*(p-1) != '/') *p++ = '/'; *p = 0; return piece; } /* EOF */ kbuild-3608/src/kmk/README.git0000664000175000017500000002470414670377414015745 0ustar locutuslocutus -*-text-*- ------------------------------------------------------------------------------- Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . ------------------------------------------------------------------------------- Obtaining Git Code ------------------ This seems redundant, since if you're reading this you most likely have already performed this step; however, for completeness, you can obtain the GNU make source code via Git from the FSF's Savannah project : $ git clone git://git.savannah.gnu.org/make.git Changes using Git ----------------- For non-developers, you can continue to provide patches as before, or if you make a public repository I can pull from that if you prefer. Starting with GNU make 4.0 we no longer keep a separate ChangeLog file in source control. We use the Gnulib git-to-changelog conversion script to convert the Git comments into ChangeLog-style entries for release. As a result, please format your Git comments carefully so they will look clean after conversion. In particular, each line of your comment will have a TAB added before it so be sure your comment lines are not longer than 72 characters; prefer 70 or less. Please use standard ChangeLog formats for your commit messages (sans the leading TAB of course). Rule #1: Don't rewrite pushed history (don't use "git push --force"). Typical simple workflow might be: * Edit files * Use "git status" and "git diff" to verify your changes * Use "git add" to stage the changes you want to make * Use "git commit" to commit the staged changes to your local repository * Use "git pull" to accept & merge new changes from the Savannah repository * Use "git push" to push your commits back to the Savannah repository For Emacs users, there are many options for Git integration but I strongly recommend the Magit package: http://www.emacswiki.org/emacs/Magit It makes the workflow much clearer, and has advanced features such as constructing multiple commits from various files and even from different diff chunks in the same file. There is a video available which helps a lot. Coding Standards ---------------- GNU make code adheres to the GNU Coding Standards. Please use only spaces and no TAB characters in source code. Additionally, GNU make is a foundational bootstrap package for the GNU project; as such it is very conservative about language features it expects. It should build with any C compiler conforming to the ANSI C89 / ISO C90 standard. Building From Git ----------------- To build GNU make from Git, you will need Autoconf, Automake, and Gettext, and any tools that those utilities require (GNU m4, Perl, etc.). See the configure.ac file to find the minimum versions of each of these tools. You will also need a copy of wget and gnulib. When building from Git you must build in the source directory: "VPATH builds" from remote directories are not supported. Once you've created a distribution, of course, you can unpack it and do a VPATH build from there. After checking out the code, you will need to perform these steps to get to the point where you can run "make". 1) $ autoreconf -i This rebuilds all the things that need rebuilding, installing missing files as symbolic links. You may get warnings here about missing files like README, etc. Ignore them, they are harmless. 2) $ ./configure Generate a Makefile 3) $ make update Use wget to retrieve various other files that GNU make relies on, but does not keep in its own source tree. NB: You may need GNU make to correctly perform this step; if you use a platform-local make you may get problems with missing files in doc/. At this point you have successfully brought your Git copy of the GNU make source directory up to the point where it can be treated more-or-less like the official package you would get from ftp.gnu.org. That is, you can just run: $ make && make check && make install to build and install GNU make. Windows builds from Git ----------------------- If you have a UNIX emulation like CYGWIN you can opt to run the general build procedure above; it will work. Be sure to read README.W32.template for information on options you might want to use when running ./configure. If you can't or don't want to do that, then rename the file README.W32.template to README.W32 and follow those instructions. Creating a Package ------------------ Once you have performed the above steps (including the configuration and build) you can create a GNU make package. This is very simple, just run: $ make dist-gzip and, if you like: $ make dist-bzip2 Even better, you should run this: $ make distcheck Which will build both .gz and .bz2 package files, then unpack them into a temporary location, try to build them, and repack them, verifying that everything works, you get the same results, _and_ no extraneous files are left over after the "distclean" rule--whew!! Now, _that_ is why converting to Automake is worth the trouble! A big "huzzah!" to Tom T. and the AutoToolers! Steps to Release ---------------- Here are the things that need to be done (in more or less this order) before making an official release. If something breaks such that you need to change code, be sure to start over again sufficiently that everything is consistent (that's why we don't finalize the Git tag, etc. until the end). * Update the configure.ac file with the new release number. * Update the EDITION value in the doc/make.texi file. * Update the NEWS file with the release number and date. * Ensure the Savannah bug list URL in the NEWS file uses the correct "Fixed Release" ID number. * Run "make distcheck" to be sure it all works. * Run "make check-alt-config" to be sure alternative configurations work * Run "make update-makeweb" to get a copy of the GNU make web pages * Run "make update-gnuweb" to get a copy of the GNU website boilerplate pages * Update the web page boilerplate if necessary: ../gnu-www/www/server/standards/patch-from-parent ../make-web/make.html \ ../gnu-www/www/server/standards/boilerplate.html * Run "make gendocs" (requires gnulib) to generate the manual files for the GNU make web pages. * Follow the directions from gendocs for the web page repository * run "make tag-release" to create a Git tag for the release * Push everything: git push --tags origin master Manage the Savannah project for GNU make: >>> This is only for real releases, not release candidate builds <<< * In Savannah modify the "Value", "Rank", and "Description" values for the current "SCM" entry in both "Component Version" and "Fix Release" fields to refer to the new release. The "Rank" field should be 10 less than the previous release so it orders properly. * In Savannah create a new entry for the "Component Version" and "Fix Release" fields: - Value: SCM - Rank: 20 - Descr: Issues found in code retrieved from Source Code Management (Git), rather than a distributed version. Please include the SHA you are working with. - Descr: Fixed in Source Code Management (Git). The fix will be included in the next release of GNU make. Start the next release: * Update configure.ac and add a ".90" to the release number. * Update the NEWS file with a new section for the release / date. * Update the Savannah URL for the bugs fixed in the NEWS section. Publishing a Package -------------------- In order to publish a package on the FSF FTP site, either the release site ftp://ftp.gnu.org, or the prerelease site ftp://alpha.gnu.org, you first need to have my GPG private key and my passphrase to unlock it. And, you can't have them! So there! But, just so I remember here's what to do: Make sure the "Steps to Release" are complete and committed and tagged. git clone git://git.savannah.gnu.org/make.git make-release cd make-release make upload-alpha # for alpha.gnu.org (pre-releases) -OR- make upload-ftp # for ftp.gnu.org (official releases) Depending on your distribution (whether GnuPG is integrated with your keyring etc.) it will either pop up a window asking for your GPG key passphrase one time, or else it will use the CLI to ask for the GPG passphrase _THREE_ times. Sigh. For both final releases and pre-releases, send an email with the URL of the package to the GNU translation robot to allow the translators to work on it: Where to Announce ----------------- Create the announcement in a text file, using 'git shortlog', then sign it with GPG: gpg --clearsign Or, use your mail client's PGP/GPG signing capabilities. Announce the release: * For release candidate builds: To: bug-make@gnu.org CC: coordinator@translationproject.org BCC: help-make@gnu.org, make-w32@gnu.org, make-alpha@gnu.org * For release builds To: info-gnu@gnu.org, bug-make@gnu.org CC: coordinator@translationproject.org BCC: help-make@gnu.org, make-w32@gnu.org, make-alpha@gnu.org * Add a news item to the Savannah project site. * Add an update to freecode.com (nee freshmeat.net) Appendix A - For The Brave -------------------------- For those of you who trust me implicitly, or are just brave (or foolhardy), here is a canned sequence of commands to build a GNU make distribution package from a virgin Git source checkout (assuming all the prerequisites are available of course). This list is eminently suitable for a quick swipe o' the mouse and a swift click o' mouse-2 into an xterm. Go for it! autoreconf -i ./configure make update make make check Or, for a debugging version: autoreconf -i && ./configure CFLAGS=-g && make update && make && make check Or, all-in-one: autoreconf -i && ./configure && make update && make && make check kbuild-3608/src/kmk/strcache.c0000664000175000017500000002410214670377414016233 0ustar locutuslocutus/* Constant string caching for GNU Make. Copyright (C) 2006-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #ifndef CONFIG_WITH_STRCACHE2 #include #include #include "hash.h" /* A string cached here will never be freed, so we don't need to worry about reference counting. We just store the string, and then remember it in a hash so it can be looked up again. */ typedef unsigned short int sc_buflen_t; struct strcache { struct strcache *next; /* The next block of strings. Must be first! */ sc_buflen_t end; /* Offset to the beginning of free space. */ sc_buflen_t bytesfree; /* Free space left in this buffer. */ sc_buflen_t count; /* # of strings in this buffer (for stats). */ char buffer[1]; /* The buffer comes after this. */ }; /* The size (in bytes) of each cache buffer. Try to pick something that will map well into the heap. This must be able to be represented by a short int (<=65535). */ #define CACHE_BUFFER_BASE (8192) #define CACHE_BUFFER_ALLOC(_s) ((_s) - (2 * sizeof (size_t))) #define CACHE_BUFFER_OFFSET (offsetof (struct strcache, buffer)) #define CACHE_BUFFER_SIZE(_s) (CACHE_BUFFER_ALLOC(_s) - CACHE_BUFFER_OFFSET) #define BUFSIZE CACHE_BUFFER_SIZE (CACHE_BUFFER_BASE) static struct strcache *strcache = NULL; static struct strcache *fullcache = NULL; static unsigned long total_buffers = 0; static unsigned long total_strings = 0; static unsigned long total_size = 0; /* Add a new buffer to the cache. Add it at the front to reduce search time. This can also increase the overhead, since it's less likely that older buffers will be filled in. However, GNU make has so many smaller strings that this doesn't seem to be much of an issue in practice. */ static struct strcache * new_cache (struct strcache **head, sc_buflen_t buflen) { struct strcache *new = xmalloc (buflen + CACHE_BUFFER_OFFSET); new->end = 0; new->count = 0; new->bytesfree = buflen; new->next = *head; *head = new; ++total_buffers; return new; } static const char * copy_string (struct strcache *sp, const char *str, unsigned int len) { /* Add the string to this cache. */ char *res = &sp->buffer[sp->end]; memmove (res, str, len); res[len++] = '\0'; sp->end += len; sp->bytesfree -= len; ++sp->count; return res; } static const char * add_string (const char *str, unsigned int len) { const char *res; struct strcache *sp; struct strcache **spp = &strcache; /* We need space for the nul char. */ unsigned int sz = len + 1; ++total_strings; total_size += sz; /* If the string we want is too large to fit into a single buffer, then no existing cache is large enough. Add it directly to the fullcache. */ if (sz > BUFSIZE) { sp = new_cache (&fullcache, sz); return copy_string (sp, str, len); } /* Find the first cache with enough free space. */ for (; *spp != NULL; spp = &(*spp)->next) if ((*spp)->bytesfree > sz) break; sp = *spp; /* If nothing is big enough, make a new cache at the front. */ if (sp == NULL) { sp = new_cache (&strcache, BUFSIZE); spp = &strcache; } /* Add the string to this cache. */ res = copy_string (sp, str, len); /* If the amount free in this cache is less than the average string size, consider it full and move it to the full list. */ if (total_strings > 20 && sp->bytesfree < (total_size / total_strings) + 1) { *spp = sp->next; sp->next = fullcache; fullcache = sp; } return res; } /* For strings too large for the strcache, we just save them in a list. */ struct hugestring { struct hugestring *next; /* The next string. */ char buffer[1]; /* The string. */ }; static struct hugestring *hugestrings = NULL; static const char * add_hugestring (const char *str, unsigned int len) { struct hugestring *new = xmalloc (sizeof (struct hugestring) + len); memcpy (new->buffer, str, len); new->buffer[len] = '\0'; new->next = hugestrings; hugestrings = new; return new->buffer; } /* Hash table of strings in the cache. */ static unsigned long str_hash_1 (const void *key) { return_ISTRING_HASH_1 ((const char *) key); } static unsigned long str_hash_2 (const void *key) { return_ISTRING_HASH_2 ((const char *) key); } static int str_hash_cmp (const void *x, const void *y) { return_ISTRING_COMPARE ((const char *) x, (const char *) y); } static struct hash_table strings; static unsigned long total_adds = 0; static const char * add_hash (const char *str, unsigned int len) { char *const *slot; const char *key; /* If it's too large for the string cache, just copy it. We don't bother trying to match these. */ if (len > USHRT_MAX - 1) return add_hugestring (str, len); /* Look up the string in the hash. If it's there, return it. */ slot = (char *const *) hash_find_slot (&strings, str); key = *slot; /* Count the total number of add operations we performed. */ ++total_adds; if (!HASH_VACANT (key)) return key; /* Not there yet so add it to a buffer, then into the hash table. */ key = add_string (str, len); hash_insert_at (&strings, key, slot); return key; } /* Returns true if the string is in the cache; false if not. */ int strcache_iscached (const char *str) { struct strcache *sp; for (sp = strcache; sp != 0; sp = sp->next) if (str >= sp->buffer && str < sp->buffer + sp->end) return 1; for (sp = fullcache; sp != 0; sp = sp->next) if (str >= sp->buffer && str < sp->buffer + sp->end) return 1; { struct hugestring *hp; for (hp = hugestrings; hp != 0; hp = hp->next) if (str == hp->buffer) return 1; } return 0; } /* If the string is already in the cache, return a pointer to the cached version. If not, add it then return a pointer to the cached version. Note we do NOT take control of the string passed in. */ const char * strcache_add (const char *str) { return add_hash (str, strlen (str)); } const char * strcache_add_len (const char *str, unsigned int len) { /* If we're not given a nul-terminated string we have to create one, because the hashing functions expect it. */ if (str[len] != '\0') { char *key = alloca (len + 1); memcpy (key, str, len); key[len] = '\0'; str = key; } return add_hash (str, len); } void strcache_init (void) { hash_init (&strings, 8000, str_hash_1, str_hash_2, str_hash_cmp); } /* Generate some stats output. */ void strcache_print_stats (const char *prefix) { const struct strcache *sp; unsigned long numbuffs = 0, fullbuffs = 0; unsigned long totfree = 0, maxfree = 0, minfree = BUFSIZE; if (! strcache) { printf (_("\n%s No strcache buffers\n"), prefix); return; } /* Count the first buffer separately since it's not full. */ for (sp = strcache->next; sp != NULL; sp = sp->next) { sc_buflen_t bf = sp->bytesfree; totfree += bf; maxfree = (bf > maxfree ? bf : maxfree); minfree = (bf < minfree ? bf : minfree); ++numbuffs; } for (sp = fullcache; sp != NULL; sp = sp->next) { sc_buflen_t bf = sp->bytesfree; totfree += bf; maxfree = (bf > maxfree ? bf : maxfree); minfree = (bf < minfree ? bf : minfree); ++numbuffs; ++fullbuffs; } /* Make sure we didn't lose any buffers. */ assert (total_buffers == numbuffs + 1); printf (_("\n%s strcache buffers: %lu (%lu) / strings = %lu / storage = %lu B / avg = %lu B\n"), prefix, numbuffs + 1, fullbuffs, total_strings, total_size, (total_size / total_strings)); printf (_("%s current buf: size = %hu B / used = %hu B / count = %hu / avg = %hu B\n"), prefix, (sc_buflen_t)BUFSIZE, strcache->end, strcache->count, (strcache->end / strcache->count)); if (numbuffs) { /* Show information about non-current buffers. */ unsigned long sz = total_size - strcache->end; unsigned long cnt = total_strings - strcache->count; sc_buflen_t avgfree = totfree / numbuffs; printf (_("%s other used: total = %lu B / count = %lu / avg = %lu B\n"), prefix, sz, cnt, sz / cnt); printf (_("%s other free: total = %lu B / max = %lu B / min = %lu B / avg = %hu B\n"), prefix, totfree, maxfree, minfree, avgfree); } printf (_("\n%s strcache performance: lookups = %lu / hit rate = %lu%%\n"), prefix, total_adds, (long unsigned)(100.0 * (total_adds - total_strings) / total_adds)); fputs (_("# hash-table stats:\n# "), stdout); hash_print_stats (&strings, stdout); } #else /* CONFIG_WITH_STRCACHE2 */ #include "strcache2.h" const char *suffixes_strcached; /* The file string cache. */ struct strcache2 file_strcache; void strcache_init (void) { strcache2_init(&file_strcache, "file", /* name */ 131072, /* hash size */ 0, /* default segment size*/ #ifdef HAVE_CASE_INSENSITIVE_FS 1, /* case insensitive */ #else 0, /* case insensitive */ #endif 0); /* thread safe */ /* .SUFFIXES is referenced in several loops, keep the added pointer in a global var so these can be optimized. */ suffixes_strcached = strcache_add_len (".SUFFIXES", sizeof (".SUFFIXES")-1); } void strcache_print_stats (const char *prefix) { strcache2_print_stats (&file_strcache, prefix); } #endif /* CONFIG_WITH_STRCACHE2 */ kbuild-3608/src/kmk/testcase-math.kmk0000664000175000017500000000651614670377415017553 0ustar locutuslocutus# $Id: testcase-math.kmk 2413 2010-09-11 17:43:04Z bird $ ## @file # kBuild - testcase for the math functions. # # # Copyright (c) 2007-2010 knut st. osmundsen # # This file is part of kBuild. # # kBuild 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. # # kBuild 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 kBuild. If not, see # # DEPTH = ../.. include $(PATH_KBUILD)/header.kmk ifneq ($(not 1),) $(error The 'not' function is missing) endif ifneq ($(eq 1,1),1) $(error The 'eq' function is missing) endif ASSERT_TRUE = $(if $(not $(1)),$(error failure: '$(1)' isn't true)) ASSERT_FALSE = $(if $(1) ,$(error failure: '$(1)' isn't false)) $(call ASSERT_TRUE, $(int-eq 0x0, 0)) $(call ASSERT_FALSE,$(int-eq 1, 0)) $(call ASSERT_FALSE,$(int-eq 1123123123, 9898787987)) $(call ASSERT_TRUE, $(int-eq 1234567890, 1234567890)) $(call ASSERT_TRUE, $(int-eq 0x1c, 28)) $(call ASSERT_TRUE, $(int-eq 1c, 28)) $(call ASSERT_TRUE, $(int-ne 0x123, -0x123)) $(call ASSERT_TRUE, $(int-ne 123, -0x123)) $(call ASSERT_FALSE,$(int-ne 0x100, 256)) $(call ASSERT_FALSE,$(int-ne 0x0, 0)) $(call ASSERT_FALSE,$(int-ne 0x1c, 28)) $(call ASSERT_TRUE, $(int-le 0, 0)) $(call ASSERT_TRUE, $(int-le -0, 0)) $(call ASSERT_FALSE,$(int-le 5, 1)) $(call ASSERT_FALSE,$(int-lt 5, 1)) $(call ASSERT_FALSE,$(int-lt 5, 5)) $(call ASSERT_TRUE, $(int-lt 9, 10)) $(call ASSERT_TRUE, $(int-lt -9, -8)) $(call ASSERT_TRUE, $(int-ge 0, 0)) $(call ASSERT_TRUE, $(int-ge -0, 0)) $(call ASSERT_TRUE, $(int-ge 1, 0)) $(call ASSERT_TRUE, $(int-ge -55, -55)) $(call ASSERT_TRUE, $(int-ge 512, 400)) $(call ASSERT_TRUE, $(int-ge -18, -19)) $(call ASSERT_FALSE,$(int-ge -19, -18)) $(call ASSERT_FALSE,$(int-ge 15, 20)) $(call ASSERT_FALSE,$(int-gt 15, 20)) $(call ASSERT_FALSE,$(int-gt 15, 15)) $(call ASSERT_TRUE, $(int-gt 20, 15)) ASSERT2 = $(if $(not $(int-eq $(1),$(2))),$(error failure: '$(1)' -ne '$(2)')) $(call ASSERT2,$(int-add 1, 1),0x2) $(call ASSERT2,$(int-add 1, 1, 1, 1, 1, 1, 1),7) $(call ASSERT2,$(int-add 1, -1),0) $(call ASSERT2,$(int-sub 1, -1),2) $(call ASSERT2,$(int-sub 1, 5),-4) $(call ASSERT2,$(int-mul 0x10, 0x20),0x200) $(call ASSERT2,$(int-mul 0x20, 0x10),0x200) $(call ASSERT2,$(int-mul 4, 7),28) $(call ASSERT2,$(int-mul 2, 2, 2, 2, 2, 4, 1, 1, 1, 1),128) $(call ASSERT2,$(int-div 0x1000, 0x100),0x10) $(call ASSERT2,$(int-div 999, 10),99) $(call ASSERT2,$(int-div 4096, 4,2,2,2,2),64) #$(call ASSERT2,$(int-div 0x1230023213, 0),0x0) $(call ASSERT2,$(int-mod 19, 10),9) $(call ASSERT2,$(int-mod 9, 10),9) $(call ASSERT2,$(int-mod 30, 10),0) $(call ASSERT2,$(int-not 0),-1) $(call ASSERT2,$(int-and 1, 1),1) $(call ASSERT2,$(int-and 0x123123214, 0xfff),0x214) $(call ASSERT2,$(int-and 0x123123214, 0xf0f, 0xf),4) $(call ASSERT2,$(int-or 1, 1, 1, 2, 2),3) $(call ASSERT2,$(int-xor 1, 1, 2, 2),0) $(call ASSERT2,$(int-xor 1, 2, 4),7) all_recursive: $(ECHO) The math works. 6 * 7 = $(int-mul 6,7) kbuild-3608/src/kmk/README.template0000664000175000017500000001523114670377413016767 0ustar locutuslocutusThis directory contains the %VERSION% release of GNU Make. See the file NEWS for the user-visible changes from previous releases. In addition, there have been bugs fixed. Please check the system-specific notes below for any caveats related to your operating system. For general building and installation instructions, see the file INSTALL. If you need to build GNU Make and have no other 'make' program to use, you can use the shell script 'build.sh' instead. To do this, first run 'configure' as described in INSTALL. Then, instead of typing 'make' to build the program, type 'sh build.sh'. This should compile the program in the current directory. Then you will have a Make program that you can use for './make install', or whatever else. Some systems' Make programs are broken and cannot process the Makefile for GNU Make. If you get errors from your system's Make when building GNU Make, try using 'build.sh' instead. GNU Make is free software. See the file COPYING for copying conditions. GNU Make is copyright by the Free Software Foundation. Copyright notices condense sequential years into a range; e.g. "1987-1994" means all years from 1987 to 1994 inclusive. Downloading ----------- GNU Make can be obtained in many different ways. See a description here: http://www.gnu.org/software/software.html Documentation ------------- GNU make is fully documented in the GNU Make manual, which is contained in this distribution as the file make.texinfo. You can also find on-line and preformatted (PostScript and DVI) versions at the FSF's web site. There is information there about ordering hardcopy documentation. http://www.gnu.org/ http://www.gnu.org/doc/doc.html http://www.gnu.org/manual/manual.html Development ----------- GNU Make development is hosted by Savannah, the FSF's online development management tool. Savannah is here: http://savannah.gnu.org And the GNU Make development page is here: http://savannah.gnu.org/projects/make/ You can find most information concerning the development of GNU Make at this site. Bug Reporting ------------- You can send GNU make bug reports to . Please see the section of the GNU make manual entitled 'Problems and Bugs' for information on submitting useful and complete bug reports. You can also use the online bug tracking system in the Savannah GNU Make project to submit new problem reports or search for existing ones: http://savannah.gnu.org/bugs/?group=make If you need help using GNU make, try these forums: help-make@gnu.org help-utils@gnu.org news:gnu.utils.help news:gnu.utils.bug Git Access ---------- The GNU make source repository is available via Git from the GNU Savannah Git server; look here for details: http://savannah.gnu.org/git/?group=make Please note: you won't be able to build GNU make from Git without installing appropriate maintainer's tools, such as GNU m4, automake, autoconf, Perl, GNU make, and GCC. See the README.git file for hints on how to build GNU make once these tools are available. We make no guarantees about the contents or quality of the latest code in the Git repository: it is not unheard of for code that is known to be broken to be checked in. Use at your own risk. System-specific Notes --------------------- It has been reported that the XLC 1.2 compiler on AIX 3.2 is buggy such that if you compile make with 'cc -O' on AIX 3.2, it will not work correctly. It is said that using 'cc' without '-O' does work. The standard /bin/sh on SunOS 4.1.3_U1 and 4.1.4 is broken and cannot be used to configure GNU make. Please install a different shell such as bash or pdksh in order to run "configure". See this message for more information: http://mail.gnu.org/archive/html/bug-autoconf/2003-10/msg00190.html One area that is often a problem in configuration and porting is the code to check the system's current load average. To make it easier to test and debug this code, you can do 'make check-loadavg' to see if it works properly on your system. (You must run 'configure' beforehand, but you need not build Make itself to run this test.) Another potential source of porting problems is the support for large files (LFS) in configure for those operating systems that provide it. Please report any bugs that you find in this area. If you run into difficulties, then as a workaround you should be able to disable LFS by adding the '--disable-largefile' option to the 'configure' script. On systems that support micro- and nano-second timestamp values and where stat(2) provides this information, GNU make will use it when comparing timestamps to get the most accurate possible result. However, note that many current implementations of tools that *set* timestamps do not preserve micro- or nano-second granularity. This means that "cp -p" and other similar tools (tar, etc.) may not exactly duplicate timestamps with micro- and nano-second granularity on some systems. If your build system contains rules that depend on proper behavior of tools like "cp -p", you should consider using the .LOW_RESOLUTION_TIME pseudo-target to force make to treat them properly. See the manual for details. Ports ----- - See README.customs for details on integrating GNU make with the Customs distributed build environment from the Pmake distribution. - See README.VMS for details about GNU Make on OpenVMS. - See README.Amiga for details about GNU Make on AmigaDOS. - See README.W32 for details about GNU Make on Windows NT, 95, or 98. - See README.DOS for compilation instructions on MS-DOS and MS-Windows using DJGPP tools. A precompiled binary of the MSDOS port of GNU Make is available as part of DJGPP; see the WWW page http://www.delorie.com/djgpp/ for more information. Please note there are two _separate_ ports of GNU make for Microsoft systems: a native Windows tool built with (for example) MSVC or Cygwin, and a DOS-based tool built with DJGPP. Please be sure you are looking at the right README! ------------------------------------------------------------------------------- Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . kbuild-3608/src/kmk/variable.c0000664000175000017500000033031314670377412016226 0ustar locutuslocutus/* Internals of variables for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #include #include "filedef.h" #include "dep.h" #include "job.h" #include "commands.h" #include "variable.h" #include "rule.h" #ifdef WINDOWS32 #include "pathstuff.h" #endif #include "hash.h" #ifdef KMK # include "kbuild.h" # ifdef WINDOWS32 # include # else # include # endif #endif #ifdef CONFIG_WITH_STRCACHE2 # include #endif #ifdef CONFIG_WITH_COMPILER # include "kmk_cc_exec.h" #endif #ifdef KMK /** Gets the real variable if alias. For use when looking up variables. */ # define RESOLVE_ALIAS_VARIABLE(v) \ do { \ if ((v) != NULL && (v)->alias) \ { \ (v) = (struct variable *)(v)->value; \ assert ((v)->aliased); \ assert (!(v)->alias); \ } \ } while (0) #endif #ifdef KMK /* Incremented every time a variable is modified, so that target_environment knows when to regenerate the table of exported global variables. */ static size_t global_variable_generation = 0; #endif /* Incremented every time we add or remove a global variable. */ static unsigned long variable_changenum; /* Chain of all pattern-specific variables. */ static struct pattern_var *pattern_vars; /* Pointer to the last struct in the pack of a specific size, from 1 to 255.*/ static struct pattern_var *last_pattern_vars[256]; /* Create a new pattern-specific variable struct. The new variable is inserted into the PATTERN_VARS list in the shortest patterns first order to support the shortest stem matching (the variables are matched in the reverse order so the ones with the longest pattern will be considered first). Variables with the same pattern length are inserted in the definition order. */ struct pattern_var * create_pattern_var (const char *target, const char *suffix) { register unsigned int len = strlen (target); register struct pattern_var *p = xmalloc (sizeof (struct pattern_var)); if (pattern_vars != 0) { if (len < 256 && last_pattern_vars[len] != 0) { p->next = last_pattern_vars[len]->next; last_pattern_vars[len]->next = p; } else { /* Find the position where we can insert this variable. */ register struct pattern_var **v; for (v = &pattern_vars; ; v = &(*v)->next) { /* Insert at the end of the pack so that patterns with the same length appear in the order they were defined .*/ if (*v == 0 || (*v)->len > len) { p->next = *v; *v = p; break; } } } } else { pattern_vars = p; p->next = 0; } p->target = target; p->len = len; p->suffix = suffix + 1; if (len < 256) last_pattern_vars[len] = p; return p; } /* Look up a target in the pattern-specific variable list. */ static struct pattern_var * lookup_pattern_var (struct pattern_var *start, const char *target) { struct pattern_var *p; unsigned int targlen = strlen (target); for (p = start ? start->next : pattern_vars; p != 0; p = p->next) { const char *stem; unsigned int stemlen; if (p->len > targlen) /* It can't possibly match. */ continue; /* From the lengths of the filename and the pattern parts, find the stem: the part of the filename that matches the %. */ stem = target + (p->suffix - p->target - 1); stemlen = targlen - p->len + 1; /* Compare the text in the pattern before the stem, if any. */ if (stem > target && !strneq (p->target, target, stem - target)) continue; /* Compare the text in the pattern after the stem, if any. We could test simply using streq, but this way we compare the first two characters immediately. This saves time in the very common case where the first character matches because it is a period. */ if (*p->suffix == stem[stemlen] && (*p->suffix == '\0' || streq (&p->suffix[1], &stem[stemlen+1]))) break; } return p; } #ifdef CONFIG_WITH_STRCACHE2 struct strcache2 variable_strcache; #endif /* Hash table of all global variable definitions. */ #ifndef CONFIG_WITH_STRCACHE2 static unsigned long variable_hash_1 (const void *keyv) { struct variable const *key = (struct variable const *) keyv; return_STRING_N_HASH_1 (key->name, key->length); } static unsigned long variable_hash_2 (const void *keyv) { struct variable const *key = (struct variable const *) keyv; return_STRING_N_HASH_2 (key->name, key->length); } static int variable_hash_cmp (const void *xv, const void *yv) { struct variable const *x = (struct variable const *) xv; struct variable const *y = (struct variable const *) yv; int result = x->length - y->length; if (result) return result; return_STRING_N_COMPARE (x->name, y->name, x->length); } #endif /* !CONFIG_WITH_STRCACHE2 */ #ifndef VARIABLE_BUCKETS # ifdef KMK /* Move to Makefile.kmk? (insanely high, but wtf, it gets the collitions down) */ # define VARIABLE_BUCKETS 65535 # else /*!KMK*/ #define VARIABLE_BUCKETS 523 # endif /*!KMK*/ #endif #ifndef PERFILE_VARIABLE_BUCKETS # ifdef KMK /* Move to Makefile.kmk? */ # define PERFILE_VARIABLE_BUCKETS 127 # else #define PERFILE_VARIABLE_BUCKETS 23 # endif #endif #ifndef SMALL_SCOPE_VARIABLE_BUCKETS # ifdef KMK /* Move to Makefile.kmk? */ # define SMALL_SCOPE_VARIABLE_BUCKETS 63 # else #define SMALL_SCOPE_VARIABLE_BUCKETS 13 # endif #endif #ifndef ENVIRONMENT_VARIABLE_BUCKETS /* added by bird. */ # define ENVIRONMENT_VARIABLE_BUCKETS 256 #endif #ifdef KMK /* Drop the 'static' */ struct variable_set global_variable_set; struct variable_set_list global_setlist #else static struct variable_set global_variable_set; static struct variable_set_list global_setlist #endif = { 0, &global_variable_set, 0 }; struct variable_set_list *current_variable_set_list = &global_setlist; /* Implement variables. */ void init_hash_global_variable_set (void) { #ifndef CONFIG_WITH_STRCACHE2 hash_init (&global_variable_set.table, VARIABLE_BUCKETS, variable_hash_1, variable_hash_2, variable_hash_cmp); #else /* CONFIG_WITH_STRCACHE2 */ strcache2_init (&variable_strcache, "variable", 262144, 0, 0, 0); hash_init_strcached (&global_variable_set.table, VARIABLE_BUCKETS, &variable_strcache, offsetof (struct variable, name)); #endif /* CONFIG_WITH_STRCACHE2 */ } /* Define variable named NAME with value VALUE in SET. VALUE is copied. LENGTH is the length of NAME, which does not need to be null-terminated. ORIGIN specifies the origin of the variable (makefile, command line or environment). If RECURSIVE is nonzero a flag is set in the variable saying that it should be recursively re-expanded. */ #ifdef CONFIG_WITH_VALUE_LENGTH struct variable * define_variable_in_set (const char *name, unsigned int length, const char *value, unsigned int value_len, int duplicate_value, enum variable_origin origin, int recursive, struct variable_set *set, const floc *flocp) #else struct variable * define_variable_in_set (const char *name, unsigned int length, const char *value, enum variable_origin origin, int recursive, struct variable_set *set, const floc *flocp) #endif { struct variable *v; struct variable **var_slot; struct variable var_key; #ifdef KMK if (set == NULL || set == &global_variable_set) global_variable_generation++; #endif if (env_overrides && origin == o_env) origin = o_env_override; #ifndef KMK if (set == NULL) set = &global_variable_set; #else /* KMK */ /* Intercept kBuild object variable definitions. */ if (name[0] == '[' && length > 3) { v = try_define_kbuild_object_variable_via_accessor (name, length, value, value_len, duplicate_value, origin, recursive, flocp); if (v != VAR_NOT_KBUILD_ACCESSOR) return v; } if (set == NULL) { if (g_pTopKbEvalData) return define_kbuild_object_variable_in_top_obj (name, length, value, value_len, duplicate_value, origin, recursive, flocp); set = &global_variable_set; } #endif /* KMK */ #ifndef CONFIG_WITH_STRCACHE2 var_key.name = (char *) name; var_key.length = length; var_slot = (struct variable **) hash_find_slot (&set->table, &var_key); v = *var_slot; #ifdef VMS /* VMS does not populate envp[] with DCL symbols and logical names which historically are mapped to environent variables. If the variable is not yet defined, then we need to check if getenv() can find it. Do not do this for origin == o_env to avoid infinte recursion */ if (HASH_VACANT (v) && (origin != o_env)) { struct variable * vms_variable; char * vname = alloca (length + 1); char * vvalue; strncpy (vname, name, length); vvalue = getenv(vname); /* Values starting with '$' are probably foreign commands. We want to treat them as Shell aliases and not look them up here */ if ((vvalue != NULL) && (vvalue[0] != '$')) { vms_variable = lookup_variable(name, length); /* Refresh the slot */ var_slot = (struct variable **) hash_find_slot (&set->table, &var_key); v = *var_slot; } } #endif /* if (env_overrides && origin == o_env) origin = o_env_override; - bird moved this up */ #else /* CONFIG_WITH_STRCACHE2 */ name = strcache2_add (&variable_strcache, name, length); if ( set != &global_variable_set || !(v = strcache2_get_user_val (&variable_strcache, name))) { var_key.name = name; var_key.length = length; var_slot = (struct variable **) hash_find_slot_strcached (&set->table, &var_key); v = *var_slot; } else { assert (!v || (v->name == name && !HASH_VACANT (v))); var_slot = 0; } #endif /* CONFIG_WITH_STRCACHE2 */ if (! HASH_VACANT (v)) { #ifdef KMK RESOLVE_ALIAS_VARIABLE(v); #endif if (env_overrides && v->origin == o_env) /* V came from in the environment. Since it was defined before the switches were parsed, it wasn't affected by -e. */ v->origin = o_env_override; /* A variable of this name is already defined. If the old definition is from a stronger source than this one, don't redefine it. */ if ((int) origin >= (int) v->origin) { #ifdef CONFIG_WITH_VALUE_LENGTH if (value_len == ~0U) value_len = strlen (value); else assert (value_len == strlen (value)); if (!duplicate_value || duplicate_value == -1) { # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE if (v->value != 0 && !v->rdonly_val) free (v->value); v->rdonly_val = duplicate_value == -1; v->value = (char *) value; v->value_alloc_len = 0; # else if (v->value != 0) free (v->value); v->value = (char *) value; v->value_alloc_len = value_len + 1; # endif } else { if (v->value_alloc_len <= value_len) { # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE if (v->rdonly_val) v->rdonly_val = 0; else # endif free (v->value); v->value_alloc_len = VAR_ALIGN_VALUE_ALLOC (value_len + 1); v->value = xmalloc (v->value_alloc_len); MAKE_STATS_2(v->reallocs++); } memcpy (v->value, value, value_len + 1); } v->value_length = value_len; #else /* !CONFIG_WITH_VALUE_LENGTH */ free (v->value); v->value = xstrdup (value); #endif /* !CONFIG_WITH_VALUE_LENGTH */ if (flocp != 0) v->fileinfo = *flocp; else v->fileinfo.filenm = 0; v->origin = origin; v->recursive = recursive; VARIABLE_CHANGED (v); } return v; } /* Create a new variable definition and add it to the hash table. */ #ifndef CONFIG_WITH_ALLOC_CACHES v = xmalloc (sizeof (struct variable)); #else v = alloccache_alloc (&variable_cache); #endif #ifndef CONFIG_WITH_STRCACHE2 v->name = xstrndup (name, length); #else v->name = name; /* already cached. */ #endif v->length = length; hash_insert_at (&set->table, v, var_slot); if (set == &global_variable_set) ++variable_changenum; #ifdef CONFIG_WITH_VALUE_LENGTH if (value_len == ~0U) value_len = strlen (value); else assert (value_len == strlen (value)); v->value_length = value_len; if (!duplicate_value || duplicate_value == -1) { # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE v->rdonly_val = duplicate_value == -1; v->value_alloc_len = v->rdonly_val ? 0 : value_len + 1; # endif v->value = (char *)value; } else { # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE v->rdonly_val = 0; # endif v->value_alloc_len = VAR_ALIGN_VALUE_ALLOC (value_len + 1); v->value = xmalloc (v->value_alloc_len); memcpy (v->value, value, value_len + 1); } #else /* !CONFIG_WITH_VALUE_LENGTH */ v->value = xstrdup (value); #endif /* !CONFIG_WITH_VALUE_LENGTH */ if (flocp != 0) v->fileinfo = *flocp; else v->fileinfo.filenm = 0; v->origin = origin; v->recursive = recursive; v->special = 0; v->expanding = 0; v->exp_count = 0; v->per_target = 0; v->append = 0; v->private_var = 0; #ifdef KMK v->alias = 0; v->aliased = 0; #endif v->export = v_default; #ifdef CONFIG_WITH_COMPILER v->recursive_without_dollar = 0; v->evalprog = 0; v->expandprog = 0; v->evalval_count = 0; v->expand_count = 0; #else MAKE_STATS_2(v->expand_count = 0); MAKE_STATS_2(v->evalval_count = 0); #endif MAKE_STATS_2(v->changes = 0); MAKE_STATS_2(v->reallocs = 0); MAKE_STATS_2(v->references = 0); MAKE_STATS_2(v->cTicksEvalVal = 0); v->exportable = 1; if (*name != '_' && (*name < 'A' || *name > 'Z') && (*name < 'a' || *name > 'z')) v->exportable = 0; else { for (++name; *name != '\0'; ++name) if (*name != '_' && (*name < 'a' || *name > 'z') && (*name < 'A' || *name > 'Z') && !ISDIGIT(*name)) break; if (*name != '\0') v->exportable = 0; } #ifdef CONFIG_WITH_STRCACHE2 /* If it's the global set, remember the variable. */ if (set == &global_variable_set) strcache2_set_user_val (&variable_strcache, v->name, v); #endif return v; } /* Undefine variable named NAME in SET. LENGTH is the length of NAME, which does not need to be null-terminated. ORIGIN specifies the origin of the variable (makefile, command line or environment). */ static void free_variable_name_and_value (const void *item) { struct variable *v = (struct variable *) item; #ifndef CONFIG_WITH_STRCACHE2 free (v->name); #endif #ifdef CONFIG_WITH_COMPILER if (v->evalprog || v->expandprog) kmk_cc_variable_deleted (v); #endif #ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE if (!v->rdonly_val) #endif free (v->value); } void free_variable_set (struct variable_set_list *list) { hash_map (&list->set->table, free_variable_name_and_value); #ifndef CONFIG_WITH_ALLOC_CACHES hash_free (&list->set->table, 1); free (list->set); free (list); #else hash_free_cached (&list->set->table, 1, &variable_cache); alloccache_free (&variable_set_cache, list->set); alloccache_free (&variable_set_list_cache, list); #endif } void undefine_variable_in_set (const char *name, unsigned int length, enum variable_origin origin, struct variable_set *set) { struct variable *v; struct variable **var_slot; struct variable var_key; if (set == NULL) set = &global_variable_set; #ifndef CONFIG_WITH_STRCACHE2 var_key.name = (char *) name; var_key.length = length; var_slot = (struct variable **) hash_find_slot (&set->table, &var_key); #else var_key.name = strcache2_lookup(&variable_strcache, name, length); if (!var_key.name) return; var_key.length = length; var_slot = (struct variable **) hash_find_slot_strcached (&set->table, &var_key); #endif #ifdef KMK if (set == &global_variable_set) global_variable_generation++; #endif if (env_overrides && origin == o_env) origin = o_env_override; v = *var_slot; if (! HASH_VACANT (v)) { #ifdef KMK if (v->aliased || v->alias) { if (v->aliased) OS (error, NULL, _("Cannot undefine the aliased variable '%s'"), v->name); else OS (error, NULL, _("Cannot undefine the variable alias '%s'"), v->name); return; } #endif if (env_overrides && v->origin == o_env) /* V came from in the environment. Since it was defined before the switches were parsed, it wasn't affected by -e. */ v->origin = o_env_override; /* Undefine only if this undefinition is from an equal or stronger source than the variable definition. */ if ((int) origin >= (int) v->origin) { hash_delete_at (&set->table, var_slot); #ifdef CONFIG_WITH_STRCACHE2 if (set == &global_variable_set) strcache2_set_user_val (&variable_strcache, v->name, NULL); #endif free_variable_name_and_value (v); #ifndef CONFIG_WITH_ALLOC_CACHES free (v); #else alloccache_free (&variable_cache, v); #endif if (set == &global_variable_set) ++variable_changenum; } } } #ifdef KMK /* Define variable named NAME as an alias of the variable TARGET. SET defaults to the global set if NULL. FLOCP is just for completeness. */ struct variable * define_variable_alias_in_set (const char *name, unsigned int length, struct variable *target, enum variable_origin origin, struct variable_set *set, const floc *flocp) { struct variable *v; struct variable **var_slot; #ifdef KMK if (set == NULL || set == &global_variable_set) global_variable_generation++; #endif /* Look it up the hash table slot for it. */ name = strcache2_add (&variable_strcache, name, length); if ( set != &global_variable_set || !(v = strcache2_get_user_val (&variable_strcache, name))) { struct variable var_key; var_key.name = name; var_key.length = length; var_slot = (struct variable **) hash_find_slot_strcached (&set->table, &var_key); v = *var_slot; } else { assert (!v || (v->name == name && !HASH_VACANT (v))); var_slot = 0; } if (! HASH_VACANT (v)) { /* A variable of this name is already defined. If the old definition is from a stronger source than this one, don't redefine it. */ if (env_overrides && v->origin == o_env) /* V came from in the environment. Since it was defined before the switches were parsed, it wasn't affected by -e. */ v->origin = o_env_override; if ((int) origin < (int) v->origin) return v; if (v->value != 0 && !v->rdonly_val) free (v->value); VARIABLE_CHANGED (v); } else { /* Create a new variable definition and add it to the hash table. */ v = alloccache_alloc (&variable_cache); v->name = name; /* already cached. */ v->length = length; hash_insert_at (&set->table, v, var_slot); v->special = 0; v->expanding = 0; v->exp_count = 0; v->per_target = 0; v->append = 0; v->private_var = 0; v->aliased = 0; v->export = v_default; #ifdef CONFIG_WITH_COMPILER v->recursive_without_dollar = 0; v->evalprog = 0; v->expandprog = 0; v->evalval_count = 0; v->expand_count = 0; #else MAKE_STATS_2(v->expand_count = 0); MAKE_STATS_2(v->evalval_count = 0); #endif MAKE_STATS_2(v->changes = 0); MAKE_STATS_2(v->reallocs = 0); MAKE_STATS_2(v->references = 0); MAKE_STATS_2(v->cTicksEvalVal = 0); v->exportable = 1; if (*name != '_' && (*name < 'A' || *name > 'Z') && (*name < 'a' || *name > 'z')) v->exportable = 0; else { for (++name; *name != '\0'; ++name) if (*name != '_' && (*name < 'a' || *name > 'z') && (*name < 'A' || *name > 'Z') && !ISDIGIT(*name)) break; if (*name != '\0') v->exportable = 0; } /* If it's the global set, remember the variable. */ if (set == &global_variable_set) strcache2_set_user_val (&variable_strcache, v->name, v); } /* Common variable setup. */ v->alias = 1; v->rdonly_val = 1; v->value = (char *)target; v->value_length = sizeof(*target); /* Non-zero to provoke trouble. */ v->value_alloc_len = sizeof(*target); if (flocp != 0) v->fileinfo = *flocp; else v->fileinfo.filenm = 0; v->origin = origin; v->recursive = 0; /* Mark the target as aliased. */ target->aliased = 1; return v; } #endif /* KMK */ /* If the variable passed in is "special", handle its special nature. Currently there are two such variables, both used for introspection: .VARIABLES expands to a list of all the variables defined in this instance of make. .TARGETS expands to a list of all the targets defined in this instance of make. Returns the variable reference passed in. */ #define EXPANSION_INCREMENT(_l) ((((_l) / 500) + 1) * 500) static struct variable * lookup_special_var (struct variable *var) { static unsigned long last_changenum = 0; /* This one actually turns out to be very hard, due to the way the parser records targets. The way it works is that target information is collected internally until make knows the target is completely specified. It unitl it sees that some new construct (a new target or variable) is defined that it knows the previous one is done. In short, this means that if you do this: all: TARGS := $(.TARGETS) then $(TARGS) won't contain "all", because it's not until after the variable is created that the previous target is completed. Changing this would be a major pain. I think a less complex way to do it would be to pre-define the target files as soon as the first line is parsed, then come back and do the rest of the definition as now. That would allow $(.TARGETS) to be correct without a major change to the way the parser works. if (streq (var->name, ".TARGETS")) var->value = build_target_list (var->value); else */ if (variable_changenum != last_changenum && streq (var->name, ".VARIABLES")) { #ifndef CONFIG_WITH_VALUE_LENGTH unsigned long max = EXPANSION_INCREMENT (strlen (var->value)); #else unsigned long max = EXPANSION_INCREMENT (var->value_length); #endif unsigned long len; char *p; struct variable **vp = (struct variable **) global_variable_set.table.ht_vec; struct variable **end = &vp[global_variable_set.table.ht_size]; /* Make sure we have at least MAX bytes in the allocated buffer. */ var->value = xrealloc (var->value, max); MAKE_STATS_2(var->reallocs++); /* Walk through the hash of variables, constructing a list of names. */ p = var->value; len = 0; for (; vp < end; ++vp) if (!HASH_VACANT (*vp)) { struct variable *v = *vp; int l = v->length; len += l + 1; if (len > max) { unsigned long off = p - var->value; max += EXPANSION_INCREMENT (l + 1); var->value = xrealloc (var->value, max); p = &var->value[off]; MAKE_STATS_2(var->reallocs++); } memcpy (p, v->name, l); p += l; *(p++) = ' '; } *(p-1) = '\0'; #ifdef CONFIG_WITH_VALUE_LENGTH var->value_length = p - var->value - 1; var->value_alloc_len = max; #endif VARIABLE_CHANGED (var); /* Remember the current variable change number. */ last_changenum = variable_changenum; } return var; } #if 0 /*FIX THIS - def KMK*/ /* bird: speed */ MY_INLINE struct variable * lookup_cached_variable (const char *name) { const struct variable_set_list *setlist = current_variable_set_list; struct hash_table *ht; unsigned int hash_1; unsigned int hash_2; unsigned int idx; struct variable *v; /* first set, first entry, both unrolled. */ if (setlist->set == &global_variable_set) { v = (struct variable *) strcache2_get_user_val (&variable_strcache, name); if (MY_PREDICT_TRUE (v)) return MY_PREDICT_FALSE (v->special) ? lookup_special_var (v) : v; assert (setlist->next == 0); return 0; } hash_1 = strcache2_calc_ptr_hash (&variable_strcache, name); ht = &setlist->set->table; MAKE_STATS (ht->ht_lookups++); idx = hash_1 & (ht->ht_size - 1); v = ht->ht_vec[idx]; if (v != 0) { if ( (void *)v != hash_deleted_item && v->name == name) return MY_PREDICT_FALSE (v->special) ? lookup_special_var (v) : v; /* the rest of the loop */ hash_2 = strcache2_get_hash (&variable_strcache, name) | 1; for (;;) { idx += hash_2; idx &= (ht->ht_size - 1); v = (struct variable *) ht->ht_vec[idx]; MAKE_STATS (ht->ht_collisions++); /* there are hardly any deletions, so don't bother with not counting deleted clashes. */ if (v == 0) break; if ( (void *)v != hash_deleted_item && v->name == name) return MY_PREDICT_FALSE (v->special) ? lookup_special_var (v) : v; } /* inner collision loop */ } else hash_2 = strcache2_get_hash (&variable_strcache, name) | 1; /* The other sets, if any. */ setlist = setlist->next; while (setlist) { if (setlist->set == &global_variable_set) { v = (struct variable *) strcache2_get_user_val (&variable_strcache, name); if (MY_PREDICT_TRUE (v)) return MY_PREDICT_FALSE (v->special) ? lookup_special_var (v) : v; assert (setlist->next == 0); return 0; } /* first iteration unrolled */ ht = &setlist->set->table; MAKE_STATS (ht->ht_lookups++); idx = hash_1 & (ht->ht_size - 1); v = ht->ht_vec[idx]; if (v != 0) { if ( (void *)v != hash_deleted_item && v->name == name) return MY_PREDICT_FALSE (v->special) ? lookup_special_var (v) : v; /* the rest of the loop */ for (;;) { idx += hash_2; idx &= (ht->ht_size - 1); v = (struct variable *) ht->ht_vec[idx]; MAKE_STATS (ht->ht_collisions++); /* see reason above */ if (v == 0) break; if ( (void *)v != hash_deleted_item && v->name == name) return MY_PREDICT_FALSE (v->special) ? lookup_special_var (v) : v; } /* inner collision loop */ } /* next */ setlist = setlist->next; } return 0; } # ifndef NDEBUG struct variable * lookup_variable_for_assert (const char *name, unsigned int length) { const struct variable_set_list *setlist; struct variable var_key; var_key.name = name; var_key.length = length; for (setlist = current_variable_set_list; setlist != 0; setlist = setlist->next) { struct variable *v; v = (struct variable *) hash_find_item_strcached (&setlist->set->table, &var_key); if (v) return MY_PREDICT_FALSE (v->special) ? lookup_special_var (v) : v; } return 0; } # endif /* !NDEBUG */ #endif /* KMK - need for speed */ /* Lookup a variable whose name is a string starting at NAME and with LENGTH chars. NAME need not be null-terminated. Returns address of the 'struct variable' containing all info on the variable, or nil if no such variable is defined. */ struct variable * lookup_variable (const char *name, unsigned int length) { #if 1 /*FIX THIS - ndef KMK*/ const struct variable_set_list *setlist; struct variable var_key; #else /* KMK */ struct variable *v; #endif /* KMK */ int is_parent = 0; #ifdef CONFIG_WITH_STRCACHE2 const char *cached_name; #endif # ifdef KMK /* Check for kBuild-define- local variable accesses and handle these first. */ if (length > 3 && name[0] == '[') { struct variable *v = lookup_kbuild_object_variable_accessor(name, length); if (v != VAR_NOT_KBUILD_ACCESSOR) { MAKE_STATS_2 (v->references++); return v; } } # endif #ifdef CONFIG_WITH_STRCACHE2 /* lookup the name in the string case, if it's not there it won't be in any of the sets either. */ cached_name = strcache2_lookup (&variable_strcache, name, length); if (!cached_name) return NULL; name = cached_name; #endif /* CONFIG_WITH_STRCACHE2 */ #if 1 /*FIX THIS - ndef KMK */ var_key.name = (char *) name; var_key.length = length; for (setlist = current_variable_set_list; setlist != 0; setlist = setlist->next) { const struct variable_set *set = setlist->set; struct variable *v; # ifndef CONFIG_WITH_STRCACHE2 v = (struct variable *) hash_find_item ((struct hash_table *) &set->table, &var_key); # else /* CONFIG_WITH_STRCACHE2 */ v = (struct variable *) hash_find_item_strcached ((struct hash_table *) &set->table, &var_key); # endif /* CONFIG_WITH_STRCACHE2 */ if (v && (!is_parent || !v->private_var)) { # ifdef KMK RESOLVE_ALIAS_VARIABLE(v); # endif MAKE_STATS_2 (v->references++); return v->special ? lookup_special_var (v) : v; } is_parent |= setlist->next_is_parent; } #else /* KMK - need for speed */ v = lookup_cached_variable (name); assert (lookup_variable_for_assert(name, length) == v); #ifdef VMS if (v) #endif return v; #endif /* KMK - need for speed */ #ifdef VMS /* VMS does not populate envp[] with DCL symbols and logical names which historically are mapped to enviroment varables and returned by getenv() */ { char *vname = alloca (length + 1); char *value; strncpy (vname, name, length); vname[length] = 0; value = getenv (vname); if (value != 0) { char *sptr; int scnt; sptr = value; scnt = 0; while ((sptr = strchr (sptr, '$'))) { scnt++; sptr++; } if (scnt > 0) { char *nvalue; char *nptr; nvalue = alloca (strlen (value) + scnt + 1); sptr = value; nptr = nvalue; while (*sptr) { if (*sptr == '$') { *nptr++ = '$'; *nptr++ = '$'; } else { *nptr++ = *sptr; } sptr++; } *nptr = '\0'; return define_variable (vname, length, nvalue, o_env, 1); } return define_variable (vname, length, value, o_env, 1); } } #endif /* VMS */ return 0; } #ifdef CONFIG_WITH_STRCACHE2 /* Alternative version of lookup_variable that takes a name that's already in the variable string cache. */ struct variable * lookup_variable_strcached (const char *name) { struct variable *v; #if 1 /*FIX THIS - ndef KMK*/ const struct variable_set_list *setlist; struct variable var_key; #endif /* KMK */ int is_parent = 0; #ifndef NDEBUG strcache2_verify_entry (&variable_strcache, name); #endif #ifdef KMK /* Check for kBuild-define- local variable accesses and handle these first. */ if (strcache2_get_len(&variable_strcache, name) > 3 && name[0] == '[') { v = lookup_kbuild_object_variable_accessor(name, strcache2_get_len(&variable_strcache, name)); if (v != VAR_NOT_KBUILD_ACCESSOR) { MAKE_STATS_2 (v->references++); return v; } } #endif #if 1 /*FIX THIS - ndef KMK */ var_key.name = (char *) name; var_key.length = strcache2_get_len(&variable_strcache, name); for (setlist = current_variable_set_list; setlist != 0; setlist = setlist->next) { const struct variable_set *set = setlist->set; v = (struct variable *) hash_find_item_strcached ((struct hash_table *) &set->table, &var_key); if (v && (!is_parent || !v->private_var)) { # ifdef KMK RESOLVE_ALIAS_VARIABLE(v); # endif MAKE_STATS_2 (v->references++); return v->special ? lookup_special_var (v) : v; } is_parent |= setlist->next_is_parent; } #else /* KMK - need for speed */ v = lookup_cached_variable (name); assert (lookup_variable_for_assert(name, length) == v); #ifdef VMS if (v) #endif return v; #endif /* KMK - need for speed */ #ifdef VMS # error "Port me (split out the relevant code from lookup_varaible and call it)" #endif return 0; } #endif /* Lookup a variable whose name is a string starting at NAME and with LENGTH chars in set SET. NAME need not be null-terminated. Returns address of the 'struct variable' containing all info on the variable, or nil if no such variable is defined. */ struct variable * lookup_variable_in_set (const char *name, unsigned int length, const struct variable_set *set) { struct variable var_key; #ifndef CONFIG_WITH_STRCACHE2 var_key.name = (char *) name; var_key.length = length; return (struct variable *) hash_find_item ((struct hash_table *) &set->table, &var_key); #else /* CONFIG_WITH_STRCACHE2 */ const char *cached_name; struct variable *v; # ifdef KMK /* Check for kBuild-define- local variable accesses and handle these first. */ if (length > 3 && name[0] == '[' && set == &global_variable_set) { v = lookup_kbuild_object_variable_accessor(name, length); if (v != VAR_NOT_KBUILD_ACCESSOR) { RESOLVE_ALIAS_VARIABLE(v); MAKE_STATS_2 (v->references++); return v; } } # endif /* lookup the name in the string case, if it's not there it won't be in any of the sets either. Optimize lookups in the global set. */ cached_name = strcache2_lookup(&variable_strcache, name, length); if (!cached_name) return NULL; if (set == &global_variable_set) { v = strcache2_get_user_val (&variable_strcache, cached_name); assert (!v || v->name == cached_name); } else { var_key.name = cached_name; var_key.length = length; v = (struct variable *) hash_find_item_strcached ( (struct hash_table *) &set->table, &var_key); } # ifdef KMK RESOLVE_ALIAS_VARIABLE(v); # endif MAKE_STATS_2 (if (v) v->references++); return v; #endif /* CONFIG_WITH_STRCACHE2 */ } /* Initialize FILE's variable set list. If FILE already has a variable set list, the topmost variable set is left intact, but the the rest of the chain is replaced with FILE->parent's setlist. If FILE is a double-colon rule, then we will use the "root" double-colon target's variable set as the parent of FILE's variable set. If we're READING a makefile, don't do the pattern variable search now, since the pattern variable might not have been defined yet. */ void initialize_file_variables (struct file *file, int reading) { struct variable_set_list *l = file->variables; if (l == 0) { #ifndef CONFIG_WITH_ALLOC_CACHES l = (struct variable_set_list *) xmalloc (sizeof (struct variable_set_list)); l->set = xmalloc (sizeof (struct variable_set)); #else /* CONFIG_WITH_ALLOC_CACHES */ l = (struct variable_set_list *) alloccache_alloc (&variable_set_list_cache); l->set = (struct variable_set *) alloccache_alloc (&variable_set_cache); #endif /* CONFIG_WITH_ALLOC_CACHES */ #ifndef CONFIG_WITH_STRCACHE2 hash_init (&l->set->table, PERFILE_VARIABLE_BUCKETS, variable_hash_1, variable_hash_2, variable_hash_cmp); #else /* CONFIG_WITH_STRCACHE2 */ hash_init_strcached (&l->set->table, PERFILE_VARIABLE_BUCKETS, &variable_strcache, offsetof (struct variable, name)); #endif /* CONFIG_WITH_STRCACHE2 */ file->variables = l; } /* If this is a double-colon, then our "parent" is the "root" target for this double-colon rule. Since that rule has the same name, parent, etc. we can just use its variables as the "next" for ours. */ if (file->double_colon && file->double_colon != file) { initialize_file_variables (file->double_colon, reading); l->next = file->double_colon->variables; l->next_is_parent = 0; return; } if (file->parent == 0) l->next = &global_setlist; else { initialize_file_variables (file->parent, reading); l->next = file->parent->variables; } l->next_is_parent = 1; /* If we're not reading makefiles and we haven't looked yet, see if we can find pattern variables for this target. */ if (!reading && !file->pat_searched) { struct pattern_var *p; p = lookup_pattern_var (0, file->name); if (p != 0) { struct variable_set_list *global = current_variable_set_list; /* We found at least one. Set up a new variable set to accumulate all the pattern variables that match this target. */ file->pat_variables = create_new_variable_set (); current_variable_set_list = file->pat_variables; do { /* We found one, so insert it into the set. */ struct variable *v; if (p->variable.flavor == f_simple) { v = define_variable_loc ( p->variable.name, strlen (p->variable.name), p->variable.value, p->variable.origin, 0, &p->variable.fileinfo); v->flavor = f_simple; } else { #ifndef CONFIG_WITH_VALUE_LENGTH v = do_variable_definition ( &p->variable.fileinfo, p->variable.name, p->variable.value, p->variable.origin, p->variable.flavor, 1); #else v = do_variable_definition_2 ( &p->variable.fileinfo, p->variable.name, p->variable.value, p->variable.value_length, 0, 0, p->variable.origin, p->variable.flavor, 1); #endif } /* Also mark it as a per-target and copy export status. */ v->per_target = p->variable.per_target; v->export = p->variable.export; v->private_var = p->variable.private_var; } while ((p = lookup_pattern_var (p, file->name)) != 0); current_variable_set_list = global; } file->pat_searched = 1; } /* If we have a pattern variable match, set it up. */ if (file->pat_variables != 0) { file->pat_variables->next = l->next; file->pat_variables->next_is_parent = l->next_is_parent; l->next = file->pat_variables; l->next_is_parent = 0; } } /* Pop the top set off the current variable set list, and free all its storage. */ struct variable_set_list * create_new_variable_set (void) { register struct variable_set_list *setlist; register struct variable_set *set; #ifndef CONFIG_WITH_ALLOC_CACHES set = xmalloc (sizeof (struct variable_set)); #else set = (struct variable_set *) alloccache_alloc (&variable_set_cache); #endif #ifndef CONFIG_WITH_STRCACHE2 hash_init (&set->table, SMALL_SCOPE_VARIABLE_BUCKETS, variable_hash_1, variable_hash_2, variable_hash_cmp); #else /* CONFIG_WITH_STRCACHE2 */ hash_init_strcached (&set->table, SMALL_SCOPE_VARIABLE_BUCKETS, &variable_strcache, offsetof (struct variable, name)); #endif /* CONFIG_WITH_STRCACHE2 */ #ifndef CONFIG_WITH_ALLOC_CACHES setlist = (struct variable_set_list *) xmalloc (sizeof (struct variable_set_list)); #else setlist = (struct variable_set_list *) alloccache_alloc (&variable_set_list_cache); #endif setlist->set = set; setlist->next = current_variable_set_list; setlist->next_is_parent = 0; return setlist; } /* Create a new variable set and push it on the current setlist. If we're pushing a global scope (that is, the current scope is the global scope) then we need to "push" it the other way: file variable sets point directly to the global_setlist so we need to replace that with the new one. */ struct variable_set_list * push_new_variable_scope (void) { current_variable_set_list = create_new_variable_set (); if (current_variable_set_list->next == &global_setlist) { /* It was the global, so instead of new -> &global we want to replace &global with the new one and have &global -> new, with current still pointing to &global */ struct variable_set *set = current_variable_set_list->set; current_variable_set_list->set = global_setlist.set; global_setlist.set = set; current_variable_set_list->next = global_setlist.next; global_setlist.next = current_variable_set_list; current_variable_set_list = &global_setlist; } return (current_variable_set_list); } void pop_variable_scope (void) { struct variable_set_list *setlist; struct variable_set *set; /* Can't call this if there's no scope to pop! */ assert (current_variable_set_list->next != NULL); if (current_variable_set_list != &global_setlist) { /* We're not pointing to the global setlist, so pop this one. */ setlist = current_variable_set_list; set = setlist->set; current_variable_set_list = setlist->next; } else { /* This set is the one in the global_setlist, but there is another global set beyond that. We want to copy that set to global_setlist, then delete what used to be in global_setlist. */ setlist = global_setlist.next; set = global_setlist.set; global_setlist.set = setlist->set; global_setlist.next = setlist->next; global_setlist.next_is_parent = setlist->next_is_parent; } /* Free the one we no longer need. */ #ifndef CONFIG_WITH_ALLOC_CACHES free (setlist); hash_map (&set->table, free_variable_name_and_value); hash_free (&set->table, 1); free (set); #else alloccache_free (&variable_set_list_cache, setlist); hash_map (&set->table, free_variable_name_and_value); hash_free_cached (&set->table, 1, &variable_cache); alloccache_free (&variable_set_cache, set); #endif } /* Merge FROM_SET into TO_SET, freeing unused storage in FROM_SET. */ static void merge_variable_sets (struct variable_set *to_set, struct variable_set *from_set) { struct variable **from_var_slot = (struct variable **) from_set->table.ht_vec; struct variable **from_var_end = from_var_slot + from_set->table.ht_size; int inc = to_set == &global_variable_set ? 1 : 0; for ( ; from_var_slot < from_var_end; from_var_slot++) if (! HASH_VACANT (*from_var_slot)) { struct variable *from_var = *from_var_slot; struct variable **to_var_slot #ifndef CONFIG_WITH_STRCACHE2 = (struct variable **) hash_find_slot (&to_set->table, *from_var_slot); #else /* CONFIG_WITH_STRCACHE2 */ = (struct variable **) hash_find_slot_strcached (&to_set->table, *from_var_slot); #endif /* CONFIG_WITH_STRCACHE2 */ if (HASH_VACANT (*to_var_slot)) { hash_insert_at (&to_set->table, from_var, to_var_slot); variable_changenum += inc; } else { /* GKM FIXME: delete in from_set->table */ #ifdef KMK if (from_var->aliased) OS (fatal, NULL, ("Attempting to delete aliased variable '%s'"), from_var->name); if (from_var->alias) OS (fatal, NULL, ("Attempting to delete variable aliased '%s'"), from_var->name); #endif #ifdef CONFIG_WITH_COMPILER if (from_var->evalprog || from_var->expandprog) kmk_cc_variable_deleted (from_var); #endif #ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE if (!from_var->rdonly_val) #endif free (from_var->value); free (from_var); } } } /* Merge SETLIST1 into SETLIST0, freeing unused storage in SETLIST1. */ void merge_variable_set_lists (struct variable_set_list **setlist0, struct variable_set_list *setlist1) { struct variable_set_list *to = *setlist0; struct variable_set_list *last0 = 0; /* If there's nothing to merge, stop now. */ if (!setlist1) return; /* This loop relies on the fact that all setlists terminate with the global setlist (before NULL). If that's not true, arguably we SHOULD die. */ if (to) while (setlist1 != &global_setlist && to != &global_setlist) { struct variable_set_list *from = setlist1; setlist1 = setlist1->next; merge_variable_sets (to->set, from->set); last0 = to; to = to->next; } if (setlist1 != &global_setlist) { if (last0 == 0) *setlist0 = setlist1; else last0->next = setlist1; } } #if defined(KMK) && !defined(WINDOWS32) /* Parses out the next number from the uname release level string. Fast forwards to the end of the string when encountering some non-conforming chars. */ static unsigned long parse_release_number (const char **ppsz) { unsigned long ul; char *psz = (char *)*ppsz; if (ISDIGIT (*psz)) { ul = strtoul (psz, &psz, 10); if (psz != NULL && *psz == '.') psz++; else psz = strchr (*ppsz, '\0'); *ppsz = psz; } else ul = 0; return ul; } #endif /* Define the automatic variables, and record the addresses of their structures so we can change their values quickly. */ void define_automatic_variables (void) { struct variable *v; #ifndef KMK char buf[200]; #else char buf[1024]; const char *val; struct variable *envvar1; struct variable *envvar2; # ifndef WINDOWS32 struct utsname uts; # endif unsigned long ulMajor = 0, ulMinor = 0, ulPatch = 0, ul4th = 0; #endif sprintf (buf, "%u", makelevel); define_variable_cname (MAKELEVEL_NAME, buf, o_env, 0); sprintf (buf, "%s%s%s", version_string, (remote_description == 0 || remote_description[0] == '\0') ? "" : "-", (remote_description == 0 || remote_description[0] == '\0') ? "" : remote_description); #ifndef KMK define_variable_cname ("MAKE_VERSION", buf, o_default, 0); define_variable_cname ("MAKE_HOST", make_host, o_default, 0); #else /* KMK */ /* Define KMK_VERSION to indicate kMk. */ define_variable_cname ("KMK_VERSION", buf, o_default, 0); /* Define KBUILD_VERSION* */ sprintf (buf, "%d", KBUILD_VERSION_MAJOR); define_variable_cname ("KBUILD_VERSION_MAJOR", buf, o_default, 0); sprintf (buf, "%d", KBUILD_VERSION_MINOR); define_variable_cname ("KBUILD_VERSION_MINOR", buf, o_default, 0); sprintf (buf, "%d", KBUILD_VERSION_PATCH); define_variable_cname ("KBUILD_VERSION_PATCH", buf, o_default, 0); sprintf (buf, "%d", KBUILD_SVN_REV); define_variable_cname ("KBUILD_KMK_REVISION", buf, o_default, 0); sprintf (buf, "%d.%d.%d-r%d", KBUILD_VERSION_MAJOR, KBUILD_VERSION_MINOR, KBUILD_VERSION_PATCH, KBUILD_SVN_REV); define_variable_cname ("KBUILD_VERSION", buf, o_default, 0); /* The host defaults. The BUILD_* stuff will be replaced by KBUILD_* soon. */ envvar1 = lookup_variable (STRING_SIZE_TUPLE ("KBUILD_HOST")); envvar2 = lookup_variable (STRING_SIZE_TUPLE ("BUILD_PLATFORM")); val = envvar1 ? envvar1->value : envvar2 ? envvar2->value : KBUILD_HOST; if (envvar1 && envvar2 && strcmp (envvar1->value, envvar2->value)) OS (error, NULL, _("KBUILD_HOST and BUILD_PLATFORM differs, using KBUILD_HOST=%s."), val); if (!envvar1) define_variable_cname ("KBUILD_HOST", val, o_default, 0); if (!envvar2) define_variable_cname ("BUILD_PLATFORM", "$(KBUILD_HOST)", o_default, 1); envvar1 = lookup_variable (STRING_SIZE_TUPLE ("KBUILD_HOST_ARCH")); envvar2 = lookup_variable (STRING_SIZE_TUPLE ("BUILD_PLATFORM_ARCH")); val = envvar1 ? envvar1->value : envvar2 ? envvar2->value : KBUILD_HOST_ARCH; if (envvar1 && envvar2 && strcmp (envvar1->value, envvar2->value)) OS (error, NULL, _("KBUILD_HOST_ARCH and BUILD_PLATFORM_ARCH differs, using KBUILD_HOST_ARCH=%s."), val); if (!envvar1) define_variable_cname ("KBUILD_HOST_ARCH", val, o_default, 0); if (!envvar2) define_variable_cname ("BUILD_PLATFORM_ARCH", "$(KBUILD_HOST_ARCH)", o_default, 1); envvar1 = lookup_variable (STRING_SIZE_TUPLE ("KBUILD_HOST_CPU")); envvar2 = lookup_variable (STRING_SIZE_TUPLE ("BUILD_PLATFORM_CPU")); val = envvar1 ? envvar1->value : envvar2 ? envvar2->value : KBUILD_HOST_CPU; if (envvar1 && envvar2 && strcmp (envvar1->value, envvar2->value)) OS (error, NULL, _("KBUILD_HOST_CPU and BUILD_PLATFORM_CPU differs, using KBUILD_HOST_CPU=%s."), val); if (!envvar1) define_variable_cname ("KBUILD_HOST_CPU", val, o_default, 0); if (!envvar2) define_variable_cname ("BUILD_PLATFORM_CPU", "$(KBUILD_HOST_CPU)", o_default, 1); /* The host kernel version. */ # if defined(WINDOWS32) { OSVERSIONINFOEXW oix; NTSTATUS (WINAPI *pfnRtlGetVersion)(OSVERSIONINFOEXW *); *(FARPROC *)&pfnRtlGetVersion = GetProcAddress (GetModuleHandleW (L"NTDLL.DLL"), "RtlGetVersion"); /* GetVersionEx lies */ memset (&oix, '\0', sizeof (oix)); oix.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW); if (!pfnRtlGetVersion || pfnRtlGetVersion (&oix) < 0) { memset (&oix, '\0', sizeof (oix)); oix.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW); if (!GetVersionExW((LPOSVERSIONINFOW)&oix)) { memset (&oix, '\0', sizeof (oix)); oix.dwOSVersionInfoSize = sizeof (OSVERSIONINFOW); GetVersionExW ((LPOSVERSIONINFOW)&oix); } } if (oix.dwPlatformId == VER_PLATFORM_WIN32_NT) { ulMajor = oix.dwMajorVersion; ulMinor = oix.dwMinorVersion; ulPatch = oix.wServicePackMajor; ul4th = oix.wServicePackMinor; } else { ulMajor = oix.dwPlatformId == 1 ? 0 /*Win95/98/ME*/ : oix.dwPlatformId == 3 ? 1 /*WinCE*/ : 2; /*??*/ ulMinor = oix.dwMajorVersion; ulPatch = oix.dwMinorVersion; ul4th = oix.wServicePackMajor; } oix.dwBuildNumber &= 0x3fffffff; sprintf (buf, "%lu", oix.dwBuildNumber); define_variable_cname ("KBUILD_HOST_VERSION_BUILD", buf, o_default, 0); sprintf (buf, "%lu.%lu.%lu.%lu.%lu", ulMajor, ulMinor, ulPatch, ul4th, oix.dwBuildNumber); define_variable_cname ("KBUILD_HOST_VERSION", buf, o_default, 0); } # else memset (&uts, 0, sizeof(uts)); uname (&uts); val = uts.release; ulMajor = parse_release_number (&val); ulMinor = parse_release_number (&val); ulPatch = parse_release_number (&val); ul4th = parse_release_number (&val); define_variable_cname ("KBUILD_HOST_UNAME_SYSNAME", uts.sysname, o_default, 0); define_variable_cname ("KBUILD_HOST_UNAME_RELEASE", uts.release, o_default, 0); define_variable_cname ("KBUILD_HOST_UNAME_VERSION", uts.version, o_default, 0); define_variable_cname ("KBUILD_HOST_UNAME_MACHINE", uts.machine, o_default, 0); define_variable_cname ("KBUILD_HOST_UNAME_NODENAME", uts.nodename, o_default, 0); sprintf (buf, "%lu.%lu.%lu.%lu", ulMajor, ulMinor, ulPatch, ul4th); define_variable_cname ("KBUILD_HOST_VERSION", buf, o_default, 0); # endif sprintf (buf, "%lu", ulMajor); define_variable_cname ("KBUILD_HOST_VERSION_MAJOR", buf, o_default, 0); sprintf (buf, "%lu", ulMinor); define_variable_cname ("KBUILD_HOST_VERSION_MINOR", buf, o_default, 0); sprintf (buf, "%lu", ulPatch); define_variable_cname ("KBUILD_HOST_VERSION_PATCH", buf, o_default, 0); /* The kBuild locations. */ define_variable_cname ("KBUILD_PATH", get_kbuild_path (), o_default, 0); define_variable_cname ("KBUILD_BIN_PATH", get_kbuild_bin_path (), o_default, 0); define_variable_cname ("PATH_KBUILD", "$(KBUILD_PATH)", o_default, 1); define_variable_cname ("PATH_KBUILD_BIN", "$(KBUILD_BIN_PATH)", o_default, 1); /* Define KMK_FEATURES to indicate various working KMK features. */ # if defined (CONFIG_WITH_RSORT) \ && defined (CONFIG_WITH_ABSPATHEX) \ && defined (CONFIG_WITH_TOUPPER_TOLOWER) \ && defined (CONFIG_WITH_DEFINED) \ && defined (CONFIG_WITH_VALUE_LENGTH) \ && defined (CONFIG_WITH_COMPARE) \ && defined (CONFIG_WITH_STACK) \ && defined (CONFIG_WITH_MATH) \ && defined (CONFIG_WITH_XARGS) \ && defined (CONFIG_WITH_EXPLICIT_MULTITARGET) \ && defined (CONFIG_WITH_DOT_MUST_MAKE) \ && defined (CONFIG_WITH_PREPEND_ASSIGNMENT) \ && defined (CONFIG_WITH_SET_CONDITIONALS) \ && defined (CONFIG_WITH_DATE) \ && defined (CONFIG_WITH_FILE_SIZE) \ && defined (CONFIG_WITH_WHERE_FUNCTION) \ && defined (CONFIG_WITH_WHICH) \ && defined (CONFIG_WITH_EVALPLUS) \ && (defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)) \ && defined (CONFIG_WITH_COMMANDS_FUNC) \ && defined (CONFIG_WITH_PRINTF) \ && defined (CONFIG_WITH_LOOP_FUNCTIONS) \ && defined (CONFIG_WITH_ROOT_FUNC) \ && defined (CONFIG_WITH_STRING_FUNCTIONS) \ && defined (CONFIG_WITH_DEFINED_FUNCTIONS) \ && defined (KMK_HELPERS) define_variable_cname ("KMK_FEATURES", "append-dash-n abspath includedep-queue install-hard-linking umask quote versort" " kBuild-define" " rsort" " abspathex" " toupper tolower" " defined" " comp-vars comp-cmds comp-cmds-ex" " stack" " math-int" " xargs" " explicit-multitarget" " dot-must-make" " prepend-assignment" " set-conditionals intersects" " date" " file-size" " expr if-expr select" " where" " which" " evalctx evalval evalvalctx evalcall evalcall2 eval-opt-var" " make-stats" " commands" " printf" " for while" " root" " length insert pos lastpos substr translate" " kb-src-tool kb-obj-base kb-obj-suff kb-src-prop kb-src-one kb-exp-tmpl" " firstdefined lastdefined" , o_default, 0); # else /* MSC can't deal with strings mixed with #if/#endif, thus the slow way. */ # error "All features should be enabled by default!" strcpy (buf, "append-dash-n abspath includedep-queue install-hard-linking umask quote versort" " kBuild-define"); # if defined (CONFIG_WITH_RSORT) strcat (buf, " rsort"); # endif # if defined (CONFIG_WITH_ABSPATHEX) strcat (buf, " abspathex"); # endif # if defined (CONFIG_WITH_TOUPPER_TOLOWER) strcat (buf, " toupper tolower"); # endif # if defined (CONFIG_WITH_DEFINED) strcat (buf, " defined"); # endif # if defined (CONFIG_WITH_VALUE_LENGTH) && defined(CONFIG_WITH_COMPARE) strcat (buf, " comp-vars comp-cmds comp-cmds-ex"); # endif # if defined (CONFIG_WITH_STACK) strcat (buf, " stack"); # endif # if defined (CONFIG_WITH_MATH) strcat (buf, " math-int"); # endif # if defined (CONFIG_WITH_XARGS) strcat (buf, " xargs"); # endif # if defined (CONFIG_WITH_EXPLICIT_MULTITARGET) strcat (buf, " explicit-multitarget"); # endif # if defined (CONFIG_WITH_DOT_MUST_MAKE) strcat (buf, " dot-must-make"); # endif # if defined (CONFIG_WITH_PREPEND_ASSIGNMENT) strcat (buf, " prepend-assignment"); # endif # if defined (CONFIG_WITH_SET_CONDITIONALS) strcat (buf, " set-conditionals intersects"); # endif # if defined (CONFIG_WITH_DATE) strcat (buf, " date"); # endif # if defined (CONFIG_WITH_FILE_SIZE) strcat (buf, " file-size"); # endif # if defined (CONFIG_WITH_IF_CONDITIONALS) strcat (buf, " expr if-expr select"); # endif # if defined (CONFIG_WITH_WHERE_FUNCTION) strcat (buf, " where"); # endif # if defined (CONFIG_WITH_WHICH) strcat (buf, " which"); # endif # if defined (CONFIG_WITH_EVALPLUS) strcat (buf, " evalctx evalval evalvalctx evalcall evalcall2 eval-opt-var"); # endif # if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS) strcat (buf, " make-stats"); # endif # if defined (CONFIG_WITH_COMMANDS_FUNC) strcat (buf, " commands"); # endif # if defined (CONFIG_WITH_PRINTF) strcat (buf, " printf"); # endif # if defined (CONFIG_WITH_LOOP_FUNCTIONS) strcat (buf, " for while"); # endif # if defined (CONFIG_WITH_ROOT_FUNC) strcat (buf, " root"); # endif # if defined (CONFIG_WITH_STRING_FUNCTIONS) strcat (buf, " length insert pos lastpos substr translate"); # endif # if defined (CONFIG_WITH_DEFINED_FUNCTIONS) strcat (buf, " firstdefined lastdefined"); # endif # if defined (KMK_HELPERS) strcat (buf, " kb-src-tool kb-obj-base kb-obj-suff kb-src-prop kb-src-one kb-exp-tmpl"); # endif define_variable_cname ("KMK_FEATURES", buf, o_default, 0); # endif #endif /* KMK */ #ifdef CONFIG_WITH_KMK_BUILTIN /* The supported kMk Builtin commands. */ define_variable_cname ("KMK_BUILTIN", "append cat chmod cp cmp echo expr install kDepIDB ln md5sum mkdir mv printf rm rmdir sleep test", o_default, 0); #endif #ifdef __MSDOS__ /* Allow to specify a special shell just for Make, and use $COMSPEC as the default $SHELL when appropriate. */ { static char shell_str[] = "SHELL"; const int shlen = sizeof (shell_str) - 1; struct variable *mshp = lookup_variable ("MAKESHELL", 9); struct variable *comp = lookup_variable ("COMSPEC", 7); /* $(MAKESHELL) overrides $(SHELL) even if -e is in effect. */ if (mshp) (void) define_variable (shell_str, shlen, mshp->value, o_env_override, 0); else if (comp) { /* $(COMSPEC) shouldn't override $(SHELL). */ struct variable *shp = lookup_variable (shell_str, shlen); if (!shp) (void) define_variable (shell_str, shlen, comp->value, o_env, 0); } } #elif defined(__EMX__) { static char shell_str[] = "SHELL"; const int shlen = sizeof (shell_str) - 1; struct variable *shell = lookup_variable (shell_str, shlen); struct variable *replace = lookup_variable ("MAKESHELL", 9); /* if $MAKESHELL is defined in the environment assume o_env_override */ if (replace && *replace->value && replace->origin == o_env) replace->origin = o_env_override; /* if $MAKESHELL is not defined use $SHELL but only if the variable did not come from the environment */ if (!replace || !*replace->value) if (shell && *shell->value && (shell->origin == o_env || shell->origin == o_env_override)) { /* overwrite whatever we got from the environment */ free (shell->value); shell->value = xstrdup (default_shell); shell->origin = o_default; } /* Some people do not like cmd to be used as the default if $SHELL is not defined in the Makefile. With -DNO_CMD_DEFAULT you can turn off this behaviour */ # ifndef NO_CMD_DEFAULT /* otherwise use $COMSPEC */ if (!replace || !*replace->value) replace = lookup_variable ("COMSPEC", 7); /* otherwise use $OS2_SHELL */ if (!replace || !*replace->value) replace = lookup_variable ("OS2_SHELL", 9); # else # warning NO_CMD_DEFAULT: GNU make will not use CMD.EXE as default shell # endif if (replace && *replace->value) /* overwrite $SHELL */ (void) define_variable (shell_str, shlen, replace->value, replace->origin, 0); else /* provide a definition if there is none */ (void) define_variable (shell_str, shlen, default_shell, o_default, 0); } #endif /* This won't override any definition, but it will provide one if there isn't one there. */ v = define_variable_cname ("SHELL", default_shell, o_default, 0); #ifdef __MSDOS__ v->export = v_export; /* Export always SHELL. */ #endif /* On MSDOS we do use SHELL from environment, since it isn't a standard environment variable on MSDOS, so whoever sets it, does that on purpose. On OS/2 we do not use SHELL from environment but we have already handled that problem above. */ #if !defined(__MSDOS__) && !defined(__EMX__) /* Don't let SHELL come from the environment. */ if (*v->value == '\0' || v->origin == o_env || v->origin == o_env_override) { # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE if (v->rdonly_val) v->rdonly_val = 0; else # endif free (v->value); v->origin = o_file; v->value = xstrdup (default_shell); # ifdef CONFIG_WITH_VALUE_LENGTH v->value_length = strlen (v->value); v->value_alloc_len = v->value_length + 1; # endif } #endif /* Make sure MAKEFILES gets exported if it is set. */ v = define_variable_cname ("MAKEFILES", "", o_default, 0); v->export = v_ifset; /* Define the magic D and F variables in terms of the automatic variables they are variations of. */ #if defined(__MSDOS__) || defined(WINDOWS32) /* For consistency, remove the trailing backslash as well as slash. */ define_variable_cname ("@D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $@)))", o_automatic, 1); define_variable_cname ("%D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $%)))", o_automatic, 1); define_variable_cname ("*D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $*)))", o_automatic, 1); define_variable_cname ("export) { case v_default: if (v->origin == o_default || v->origin == o_automatic) /* Only export default variables by explicit request. */ continue; /* The variable doesn't have a name that can be exported. */ if (! v->exportable) continue; if (! export_all_variables && v->origin != o_command && v->origin != o_env && v->origin != o_env_override) continue; break; case v_export: break; case v_noexport: { /* If this is the SHELL variable and it's not exported, then add the value from our original environment, if the original environment defined a value for SHELL. */ extern struct variable shell_var; if (streq (v->name, "SHELL") && shell_var.value) { v = &shell_var; break; } continue; } case v_ifset: if (v->origin == o_default) continue; break; } assert (strcache2_is_cached (&variable_strcache, v->name)); new_slot = (struct variable **) hash_find_slot_strcached (&global_variable_set_exports, v); if (HASH_VACANT (*new_slot)) hash_insert_at (&global_variable_set_exports, v, new_slot); } /* done */ global_variable_set_exports_generation = global_variable_generation; } #endif /* Create a new environment for FILE's commands. If FILE is nil, this is for the 'shell' function. The child's MAKELEVEL variable is incremented. */ char ** target_environment (struct file *file) { struct variable_set_list *set_list; register struct variable_set_list *s; struct hash_table table; struct variable **v_slot; struct variable **v_end; struct variable makelevel_key; char **result_0; char **result; #ifdef CONFIG_WITH_STRCACHE2 const char *cached_name; #endif #ifdef KMK if (global_variable_set_exports_generation != global_variable_generation) update_global_variable_set_exports(); #endif if (file == 0) set_list = current_variable_set_list; else set_list = file->variables; #ifndef CONFIG_WITH_STRCACHE2 hash_init (&table, ENVIRONMENT_VARIABLE_BUCKETS, variable_hash_1, variable_hash_2, variable_hash_cmp); #else /* CONFIG_WITH_STRCACHE2 */ hash_init_strcached (&table, ENVIRONMENT_VARIABLE_BUCKETS, &variable_strcache, offsetof (struct variable, name)); #endif /* CONFIG_WITH_STRCACHE2 */ /* Run through all the variable sets in the list, accumulating variables in TABLE. */ for (s = set_list; s != 0; s = s->next) { struct variable_set *set = s->set; #ifdef KMK if (set == &global_variable_set) { assert(s->next == NULL); break; } #endif v_slot = (struct variable **) set->table.ht_vec; v_end = v_slot + set->table.ht_size; for ( ; v_slot < v_end; v_slot++) if (! HASH_VACANT (*v_slot)) { struct variable **new_slot; struct variable *v = *v_slot; /* If this is a per-target variable and it hasn't been touched already then look up the global version and take its export value. */ if (v->per_target && v->export == v_default) { struct variable *gv; #ifndef CONFIG_WITH_VALUE_LENGTH gv = lookup_variable_in_set (v->name, strlen (v->name), &global_variable_set); #else assert ((int)strlen(v->name) == v->length); gv = lookup_variable_in_set (v->name, v->length, &global_variable_set); #endif if (gv) v->export = gv->export; } switch (v->export) { case v_default: if (v->origin == o_default || v->origin == o_automatic) /* Only export default variables by explicit request. */ continue; /* The variable doesn't have a name that can be exported. */ if (! v->exportable) continue; if (! export_all_variables && v->origin != o_command && v->origin != o_env && v->origin != o_env_override) continue; break; case v_export: break; case v_noexport: { /* If this is the SHELL variable and it's not exported, then add the value from our original environment, if the original environment defined a value for SHELL. */ if (streq (v->name, "SHELL") && shell_var.value) { v = &shell_var; break; } continue; } case v_ifset: if (v->origin == o_default) continue; break; } #ifndef CONFIG_WITH_STRCACHE2 new_slot = (struct variable **) hash_find_slot (&table, v); #else /* CONFIG_WITH_STRCACHE2 */ assert (strcache2_is_cached (&variable_strcache, v->name)); new_slot = (struct variable **) hash_find_slot_strcached (&table, v); #endif /* CONFIG_WITH_STRCACHE2 */ if (HASH_VACANT (*new_slot)) hash_insert_at (&table, v, new_slot); } } #ifdef KMK /* Add the global exports to table. */ v_slot = (struct variable **) global_variable_set_exports.ht_vec; v_end = v_slot + global_variable_set_exports.ht_size; for ( ; v_slot < v_end; v_slot++) if (! HASH_VACANT (*v_slot)) { struct variable **new_slot; struct variable *v = *v_slot; assert (strcache2_is_cached (&variable_strcache, v->name)); new_slot = (struct variable **) hash_find_slot_strcached (&table, v); if (HASH_VACANT (*new_slot)) hash_insert_at (&table, v, new_slot); } #endif #ifndef CONFIG_WITH_STRCACHE2 makelevel_key.name = (char *)MAKELEVEL_NAME; makelevel_key.length = MAKELEVEL_LENGTH; hash_delete (&table, &makelevel_key); #else /* CONFIG_WITH_STRCACHE2 */ /* lookup the name in the string case, if it's not there it won't be in any of the sets either. */ cached_name = strcache2_lookup (&variable_strcache, MAKELEVEL_NAME, MAKELEVEL_LENGTH); if (cached_name) { makelevel_key.name = cached_name; makelevel_key.length = MAKELEVEL_LENGTH; hash_delete_strcached (&table, &makelevel_key); } #endif /* CONFIG_WITH_STRCACHE2 */ result = result_0 = xmalloc ((table.ht_fill + 2) * sizeof (char *)); v_slot = (struct variable **) table.ht_vec; v_end = v_slot + table.ht_size; for ( ; v_slot < v_end; v_slot++) if (! HASH_VACANT (*v_slot)) { struct variable *v = *v_slot; /* If V is recursively expanded and didn't come from the environment, expand its value. If it came from the environment, it should go back into the environment unchanged. */ if (v->recursive && v->origin != o_env && v->origin != o_env_override) { #ifndef CONFIG_WITH_VALUE_LENGTH char *value = recursively_expand_for_file (v, file); #else char *value = recursively_expand_for_file (v, file, NULL); #endif #ifdef WINDOWS32 if (strcmp (v->name, "Path") == 0 || strcmp (v->name, "PATH") == 0) convert_Path_to_windows32 (value, ';'); #endif *result++ = xstrdup (concat (3, v->name, "=", value)); free (value); } else { #ifdef WINDOWS32 if (strcmp (v->name, "Path") == 0 || strcmp (v->name, "PATH") == 0) convert_Path_to_windows32 (v->value, ';'); #endif *result++ = xstrdup (concat (3, v->name, "=", v->value)); } } *result = xmalloc (100); sprintf (*result, "%s=%u", MAKELEVEL_NAME, makelevel + 1); *++result = 0; hash_free (&table, 0); return result_0; } #ifdef CONFIG_WITH_VALUE_LENGTH /* Worker function for do_variable_definition_append() and append_expanded_string_to_variable(). The APPEND argument indicates whether it's an append or prepend operation. */ void append_string_to_variable (struct variable *v, const char *value, unsigned int value_len, int append) { /* The previous definition of the variable was recursive. The new value is the unexpanded old and new values. */ unsigned int new_value_len = value_len + (v->value_length != 0 ? 1 + v->value_length : 0); int done_1st_prepend_copy = 0; #ifdef KMK assert (!v->alias); #endif /* Drop empty strings. Use $(NO_SUCH_VARIABLE) if a space is wanted. */ if (!value_len) return; /* adjust the size. */ if (v->value_alloc_len <= new_value_len + 1) { if (v->value_alloc_len < 256) v->value_alloc_len = 256; else v->value_alloc_len *= 2; if (v->value_alloc_len < new_value_len + 1) v->value_alloc_len = VAR_ALIGN_VALUE_ALLOC (new_value_len + 1 + value_len /*future*/ ); # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE if ((append || !v->value_length) && !v->rdonly_val) # else if (append || !v->value_length) # endif v->value = xrealloc (v->value, v->value_alloc_len); else { /* avoid the extra memcpy the xrealloc may have to do */ char *new_buf = xmalloc (v->value_alloc_len); memcpy (&new_buf[value_len + 1], v->value, v->value_length + 1); done_1st_prepend_copy = 1; # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE if (v->rdonly_val) v->rdonly_val = 0; else # endif free (v->value); v->value = new_buf; } MAKE_STATS_2(v->reallocs++); } /* insert the new bits */ if (v->value_length != 0) { if (append) { v->value[v->value_length] = ' '; memcpy (&v->value[v->value_length + 1], value, value_len + 1); } else { if (!done_1st_prepend_copy) memmove (&v->value[value_len + 1], v->value, v->value_length + 1); v->value[value_len] = ' '; memcpy (v->value, value, value_len); } } else memcpy (v->value, value, value_len + 1); v->value_length = new_value_len; VARIABLE_CHANGED (v); } struct variable * do_variable_definition_append (const floc *flocp, struct variable *v, const char *value, unsigned int value_len, int simple_value, enum variable_origin origin, int append) { if (env_overrides && origin == o_env) origin = o_env_override; if (env_overrides && v->origin == o_env) /* V came from in the environment. Since it was defined before the switches were parsed, it wasn't affected by -e. */ v->origin = o_env_override; /* A variable of this name is already defined. If the old definition is from a stronger source than this one, don't redefine it. */ if ((int) origin < (int) v->origin) return v; v->origin = origin; /* location */ if (flocp != 0) v->fileinfo = *flocp; /* The juicy bits, append the specified value to the variable This is a heavily exercised code path in kBuild. */ if (value_len == ~0U) value_len = strlen (value); if (v->recursive || simple_value) append_string_to_variable (v, value, value_len, append); else /* The previous definition of the variable was simple. The new value comes from the old value, which was expanded when it was set; and from the expanded new value. */ append_expanded_string_to_variable (v, value, value_len, append); /* update the variable */ return v; } #endif /* CONFIG_WITH_VALUE_LENGTH */ static struct variable * set_special_var (struct variable *var) { if (streq (var->name, RECIPEPREFIX_NAME)) { /* The user is resetting the command introduction prefix. This has to happen immediately, so that subsequent rules are interpreted properly. */ cmd_prefix = var->value[0]=='\0' ? RECIPEPREFIX_DEFAULT : var->value[0]; } return var; } /* Given a string, shell-execute it and return a malloc'ed string of the * result. This removes only ONE newline (if any) at the end, for maximum * compatibility with the *BSD makes. If it fails, returns NULL. */ static char * shell_result (const char *p) { char *buf; unsigned int len; char *args[2]; char *result; install_variable_buffer (&buf, &len); args[0] = (char *) p; args[1] = NULL; variable_buffer_output (func_shell_base (variable_buffer, args, 0), "\0", 1); result = strdup (variable_buffer); restore_variable_buffer (buf, len); return result; } /* Given a variable, a value, and a flavor, define the variable. See the try_variable_definition() function for details on the parameters. */ struct variable * #ifndef CONFIG_WITH_VALUE_LENGTH do_variable_definition (const floc *flocp, const char *varname, const char *value, enum variable_origin origin, enum variable_flavor flavor, int target_var) #else /* CONFIG_WITH_VALUE_LENGTH */ do_variable_definition_2 (const floc *flocp, const char *varname, const char *value, unsigned int value_len, int simple_value, char *free_value, enum variable_origin origin, enum variable_flavor flavor, int target_var) #endif /* CONFIG_WITH_VALUE_LENGTH */ { const char *p; char *alloc_value = NULL; struct variable *v; int append = 0; int conditional = 0; const size_t varname_len = strlen (varname); /* bird */ #ifdef CONFIG_WITH_VALUE_LENGTH if (value_len == ~0U) value_len = strlen (value); else assert (value_len == strlen (value)); #endif /* Calculate the variable's new value in VALUE. */ switch (flavor) { default: case f_bogus: /* Should not be possible. */ abort (); case f_simple: /* A simple variable definition "var := value". Expand the value. We have to allocate memory since otherwise it'll clobber the variable buffer, and we may still need that if we're looking at a target-specific variable. */ #ifndef CONFIG_WITH_VALUE_LENGTH p = alloc_value = allocated_variable_expand (value); #else /* CONFIG_WITH_VALUE_LENGTH */ if (!simple_value) p = alloc_value = allocated_variable_expand_2 (value, value_len, &value_len); else { if (value_len == ~0U) value_len = strlen (value); if (!free_value) p = alloc_value = xstrndup (value, value_len); else { assert (value == free_value); p = alloc_value = free_value; free_value = 0; } } #endif /* CONFIG_WITH_VALUE_LENGTH */ break; case f_shell: { /* A shell definition "var != value". Expand value, pass it to the shell, and store the result in recursively-expanded var. */ char *q = allocated_variable_expand (value); p = alloc_value = shell_result (q); free (q); flavor = f_recursive; break; } case f_conditional: /* A conditional variable definition "var ?= value". The value is set IFF the variable is not defined yet. */ v = lookup_variable (varname, varname_len); if (v) #ifndef CONFIG_WITH_VALUE_LENGTH return v->special ? set_special_var (v) : v; #else /* CONFIG_WITH_VALUE_LENGTH */ { if (free_value) free (free_value); return v->special ? set_special_var (v) : v; } #endif /* CONFIG_WITH_VALUE_LENGTH */ conditional = 1; flavor = f_recursive; /* FALLTHROUGH */ case f_recursive: /* A recursive variable definition "var = value". The value is used verbatim. */ p = value; break; #ifdef CONFIG_WITH_PREPEND_ASSIGNMENT case f_append: case f_prepend: { const enum variable_flavor org_flavor = flavor; #else case f_append: { #endif /* If we have += but we're in a target variable context, we want to append only with other variables in the context of this target. */ if (target_var) { append = 1; v = lookup_variable_in_set (varname, varname_len, current_variable_set_list->set); /* Don't append from the global set if a previous non-appending target-specific variable definition exists. */ if (v && !v->append) append = 0; } #ifdef KMK else if ( g_pTopKbEvalData || ( varname_len > 3 && varname[0] == '[' && is_kbuild_object_variable_accessor (varname, varname_len)) ) { v = kbuild_object_variable_pre_append (varname, varname_len, value, value_len, simple_value, origin, org_flavor == f_append, flocp); if (free_value) free (free_value); return v; } #endif #ifdef CONFIG_WITH_LOCAL_VARIABLES /* If 'local', restrict it to the current variable context. */ else if (origin == o_local) v = lookup_variable_in_set (varname, varname_len, current_variable_set_list->set); #endif else v = lookup_variable (varname, varname_len); if (v == 0) { /* There was no old value. This becomes a normal recursive definition. */ p = value; flavor = f_recursive; } else { #ifdef CONFIG_WITH_VALUE_LENGTH v->append = append; v = do_variable_definition_append (flocp, v, value, value_len, simple_value, origin, # ifdef CONFIG_WITH_PREPEND_ASSIGNMENT org_flavor == f_append); # else 1); # endif if (free_value) free (free_value); return v; #else /* !CONFIG_WITH_VALUE_LENGTH */ /* Paste the old and new values together in VALUE. */ unsigned int oldlen, vallen; const char *val; char *tp = NULL; val = value; if (v->recursive) /* The previous definition of the variable was recursive. The new value is the unexpanded old and new values. */ flavor = f_recursive; else /* The previous definition of the variable was simple. The new value comes from the old value, which was expanded when it was set; and from the expanded new value. Allocate memory for the expansion as we may still need the rest of the buffer if we're looking at a target-specific variable. */ val = tp = allocated_variable_expand (val); oldlen = strlen (v->value); vallen = strlen (val); p = alloc_value = xmalloc (oldlen + 1 + vallen + 1); # ifdef CONFIG_WITH_PREPEND_ASSIGNMENT if (org_flavor == f_prepend) { memcpy (alloc_value, val, vallen); alloc_value[oldlen] = ' '; memcpy (&alloc_value[oldlen + 1], v->value, oldlen + 1); } else # endif /* CONFIG_WITH_PREPEND_ASSIGNMENT */ { memcpy (alloc_value, v->value, oldlen); alloc_value[oldlen] = ' '; memcpy (&alloc_value[oldlen + 1], val, vallen + 1); } free (tp); #endif /* !CONFIG_WITH_VALUE_LENGTH */ } } } #ifdef __MSDOS__ /* Many Unix Makefiles include a line saying "SHELL=/bin/sh", but non-Unix systems don't conform to this default configuration (in fact, most of them don't even have '/bin'). On the other hand, $SHELL in the environment, if set, points to the real pathname of the shell. Therefore, we generally won't let lines like "SHELL=/bin/sh" from the Makefile override $SHELL from the environment. But first, we look for the basename of the shell in the directory where SHELL= points, and along the $PATH; if it is found in any of these places, we define $SHELL to be the actual pathname of the shell. Thus, if you have bash.exe installed as d:/unix/bash.exe, and d:/unix is on your $PATH, then SHELL=/usr/local/bin/bash will have the effect of defining SHELL to be "d:/unix/bash.exe". */ if ((origin == o_file || origin == o_override) && strcmp (varname, "SHELL") == 0) { PATH_VAR (shellpath); extern char * __dosexec_find_on_path (const char *, char *[], char *); /* See if we can find "/bin/sh.exe", "/bin/sh.com", etc. */ if (__dosexec_find_on_path (p, NULL, shellpath)) { char *tp; for (tp = shellpath; *tp; tp++) if (*tp == '\\') *tp = '/'; v = define_variable_loc (varname, varname_len, shellpath, origin, flavor == f_recursive, flocp); } else { const char *shellbase, *bslash; struct variable *pathv = lookup_variable ("PATH", 4); char *path_string; char *fake_env[2]; size_t pathlen = 0; shellbase = strrchr (p, '/'); bslash = strrchr (p, '\\'); if (!shellbase || bslash > shellbase) shellbase = bslash; if (!shellbase && p[1] == ':') shellbase = p + 1; if (shellbase) shellbase++; else shellbase = p; /* Search for the basename of the shell (with standard executable extensions) along the $PATH. */ if (pathv) pathlen = strlen (pathv->value); path_string = xmalloc (5 + pathlen + 2 + 1); /* On MSDOS, current directory is considered as part of $PATH. */ sprintf (path_string, "PATH=.;%s", pathv ? pathv->value : ""); fake_env[0] = path_string; fake_env[1] = 0; if (__dosexec_find_on_path (shellbase, fake_env, shellpath)) { char *tp; for (tp = shellpath; *tp; tp++) if (*tp == '\\') *tp = '/'; v = define_variable_loc (varname, varname_len, shellpath, origin, flavor == f_recursive, flocp); } else v = lookup_variable (varname, varname_len); free (path_string); } } else #endif /* __MSDOS__ */ #ifdef WINDOWS32 if ( varname_len == sizeof("SHELL") - 1 /* bird */ && (origin == o_file || origin == o_override || origin == o_command) && streq (varname, "SHELL")) { extern const char *default_shell; /* Call shell locator function. If it returns TRUE, then set no_default_sh_exe to indicate sh was found and set new value for SHELL variable. */ if (find_and_set_default_shell (p)) { v = define_variable_in_set (varname, varname_len, default_shell, # ifdef CONFIG_WITH_VALUE_LENGTH ~0U, 1 /* duplicate_value */, # endif origin, flavor == f_recursive, (target_var ? current_variable_set_list->set : NULL), flocp); no_default_sh_exe = 0; } else { char *tp = alloc_value; alloc_value = allocated_variable_expand (p); if (find_and_set_default_shell (alloc_value)) { v = define_variable_in_set (varname, varname_len, p, #ifdef CONFIG_WITH_VALUE_LENGTH ~0U, 1 /* duplicate_value */, #endif origin, flavor == f_recursive, (target_var ? current_variable_set_list->set : NULL), flocp); no_default_sh_exe = 0; } else v = lookup_variable (varname, varname_len); free (tp); } } else #endif /* If we are defining variables inside an $(eval ...), we might have a different variable context pushed, not the global context (maybe we're inside a $(call ...) or something. Since this function is only ever invoked in places where we want to define globally visible variables, make sure we define this variable in the global set. */ v = define_variable_in_set (varname, varname_len, p, #ifdef CONFIG_WITH_VALUE_LENGTH value_len, !alloc_value, #endif origin, flavor == f_recursive, #ifdef CONFIG_WITH_LOCAL_VARIABLES (target_var || origin == o_local #else (target_var #endif ? current_variable_set_list->set : NULL), flocp); v->append = append; v->conditional = conditional; #ifndef CONFIG_WITH_VALUE_LENGTH free (alloc_value); #else if (free_value) free (free_value); #endif return v->special ? set_special_var (v) : v; } /* Parse P (a null-terminated string) as a variable definition. If it is not a variable definition, return NULL and the contents of *VAR are undefined, except NAME is set to the first non-space character or NIL. If it is a variable definition, return a pointer to the char after the assignment token and set the following fields (only) of *VAR: name : name of the variable (ALWAYS SET) (NOT NUL-TERMINATED!) length : length of the variable name value : value of the variable (nul-terminated) flavor : flavor of the variable Other values in *VAR are unchanged. */ char * parse_variable_definition (const char *p, struct variable *var) { int wspace = 0; const char *e = NULL; /** @todo merge 4.2.1: parse_variable_definition does more now */ NEXT_TOKEN (p); var->name = (char *)p; var->length = 0; while (1) { int c = *p++; /* If we find a comment or EOS, it's not a variable definition. */ if (STOP_SET (c, MAP_COMMENT|MAP_NUL)) return NULL; if (c == '$') { /* This begins a variable expansion reference. Make sure we don't treat chars inside the reference as assignment tokens. */ char closeparen; unsigned int count; c = *p++; if (c == '(') closeparen = ')'; else if (c == '{') closeparen = '}'; else if (c == '\0') return NULL; else /* '$$' or '$X'. Either way, nothing special to do here. */ continue; /* P now points past the opening paren or brace. Count parens or braces until it is matched. */ for (count = 1; *p != '\0'; ++p) { if (*p == closeparen && --count == 0) { ++p; break; } if (*p == c) ++count; } continue; } /* If we find whitespace skip it, and remember we found it. */ if (ISBLANK (c)) { wspace = 1; e = p - 1; NEXT_TOKEN (p); c = *p; if (c == '\0') return NULL; ++p; } if (c == '=') { var->flavor = f_recursive; if (! e) e = p - 1; break; } /* Match assignment variants (:=, +=, ?=, !=) */ if (*p == '=') { switch (c) { case ':': var->flavor = f_simple; break; case '+': var->flavor = f_append; break; #ifdef CONFIG_WITH_PREPEND_ASSIGNMENT case '<': var->flavor = f_prepend; break; #endif case '?': var->flavor = f_conditional; break; case '!': var->flavor = f_shell; break; default: /* If we skipped whitespace, non-assignments means no var. */ if (wspace) return NULL; /* Might be assignment, or might be $= or #=. Check. */ continue; } if (! e) e = p - 1; ++p; break; } /* Check for POSIX ::= syntax */ if (c == ':') { /* A colon other than :=/::= is not a variable defn. */ if (*p != ':' || p[1] != '=') return NULL; /* POSIX allows ::= to be the same as GNU make's := */ var->flavor = f_simple; if (! e) e = p - 1; p += 2; break; } /* If we skipped whitespace, non-assignments means no var. */ if (wspace) return NULL; } var->length = e - var->name; var->value = next_token (p); #ifdef CONFIG_WITH_VALUE_LENGTH var->value_alloc_len = ~(unsigned int)0; var->value_length = -1; # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE var->rdonly_val = 0; # endif #endif return (char *)p; } /* Try to interpret LINE (a null-terminated string) as a variable definition. If LINE was recognized as a variable definition, a pointer to its 'struct variable' is returned. If LINE is not a variable definition, NULL is returned. */ struct variable * assign_variable_definition (struct variable *v, const char *line IF_WITH_VALUE_LENGTH_PARAM(char *eos)) { #ifndef CONFIG_WITH_VALUE_LENGTH char *name; #endif if (!parse_variable_definition (line, v)) return NULL; #ifdef CONFIG_WITH_VALUE_LENGTH if (eos) { v->value_length = eos - v->value; assert (strchr (v->value, '\0') == eos); } #endif /* Expand the name, so "$(foo)bar = baz" works. */ #ifndef CONFIG_WITH_VALUE_LENGTH name = alloca (v->length + 1); memcpy (name, v->name, v->length); name[v->length] = '\0'; v->name = allocated_variable_expand (name); #else /* CONFIG_WITH_VALUE_LENGTH */ v->name = allocated_variable_expand_2 (v->name, v->length, NULL); #endif /* CONFIG_WITH_VALUE_LENGTH */ if (v->name[0] == '\0') O (fatal, &v->fileinfo, _("empty variable name")); return v; } /* Try to interpret LINE (a null-terminated string) as a variable definition. ORIGIN may be o_file, o_override, o_env, o_env_override, o_local, or o_command specifying that the variable definition comes from a makefile, an override directive, the environment with or without the -e switch, or the command line. See the comments for assign_variable_definition(). If LINE was recognized as a variable definition, a pointer to its 'struct variable' is returned. If LINE is not a variable definition, NULL is returned. */ struct variable * try_variable_definition (const floc *flocp, const char *line IF_WITH_VALUE_LENGTH_PARAM(char *eos), enum variable_origin origin, int target_var) { struct variable v; struct variable *vp; if (flocp != 0) v.fileinfo = *flocp; else v.fileinfo.filenm = 0; #ifndef CONFIG_WITH_VALUE_LENGTH if (!assign_variable_definition (&v, line)) return 0; vp = do_variable_definition (flocp, v.name, v.value, origin, v.flavor, target_var); #else if (!assign_variable_definition (&v, line, eos)) return 0; vp = do_variable_definition_2 (flocp, v.name, v.value, v.value_length, 0, NULL, origin, v.flavor, target_var); #endif #ifndef CONFIG_WITH_STRCACHE2 free (v.name); #else free ((char *)v.name); #endif return vp; } #if defined (CONFIG_WITH_COMPILER) || defined (CONFIG_WITH_MAKE_STATS) static unsigned long var_stats_evalvals, var_stats_evalvaled; static unsigned long var_stats_expands, var_stats_expanded; #endif #ifdef CONFIG_WITH_COMPILER static unsigned long var_stats_expandprogs, var_stats_evalprogs; #endif #ifdef CONFIG_WITH_MAKE_STATS static unsigned long var_stats_changes, var_stats_changed; static unsigned long var_stats_reallocs, var_stats_realloced; static unsigned long var_stats_references, var_stats_referenced; static unsigned long var_stats_val_len, var_stats_val_alloc_len; static unsigned long var_stats_val_rdonly_len; #endif /* Print information for variable V, prefixing it with PREFIX. */ static void print_variable (const void *item, void *arg) { const struct variable *v = item; const char *prefix = arg; const char *origin; #ifdef KMK const struct variable *alias = v; RESOLVE_ALIAS_VARIABLE(v); #endif switch (v->origin) { case o_automatic: origin = _("automatic"); break; case o_default: origin = _("default"); break; case o_env: origin = _("environment"); break; case o_file: origin = _("makefile"); break; case o_env_override: origin = _("environment under -e"); break; case o_command: origin = _("command line"); break; case o_override: origin = _("'override' directive"); break; #ifdef CONFIG_WITH_LOCAL_VARIABLES case o_local: origin = _("`local' directive"); break; #endif case o_invalid: default: abort (); } fputs ("# ", stdout); fputs (origin, stdout); if (v->private_var) fputs (" private", stdout); #ifndef KMK if (v->fileinfo.filenm) printf (_(" (from '%s', line %lu)"), v->fileinfo.filenm, v->fileinfo.lineno + v->fileinfo.offset); #else /* KMK */ if (alias->fileinfo.filenm) printf (_(" (from '%s', line %lu)"), alias->fileinfo.filenm, alias->fileinfo.lineno); if (alias->aliased) fputs (" aliased", stdout); if (alias->alias) printf (_(", alias for '%s'"), v->name); #endif /* KMK */ #if defined (CONFIG_WITH_COMPILER) || defined (CONFIG_WITH_MAKE_STATS) if (v->evalval_count != 0) { # ifdef CONFIG_WITH_MAKE_STATS printf (_(", %u evalvals (%llu ticks)"), v->evalval_count, v->cTicksEvalVal); # else printf (_(", %u evalvals"), v->evalval_count); # endif var_stats_evalvaled++; } var_stats_evalvals += v->evalval_count; if (v->expand_count != 0) { printf (_(", %u expands"), v->expand_count); var_stats_expanded++; } var_stats_expands += v->expand_count; # ifdef CONFIG_WITH_COMPILER if (v->evalprog != 0) { printf (_(", evalprog")); var_stats_evalprogs++; } if (v->expandprog != 0) { printf (_(", expandprog")); var_stats_expandprogs++; } # endif #endif #ifdef CONFIG_WITH_MAKE_STATS if (v->changes != 0) { printf (_(", %u changes"), v->changes); var_stats_changed++; } var_stats_changes += v->changes; if (v->reallocs != 0) { printf (_(", %u reallocs"), v->reallocs); var_stats_realloced++; } var_stats_reallocs += v->reallocs; if (v->references != 0) { printf (_(", %u references"), v->references); var_stats_referenced++; } var_stats_references += v->references; var_stats_val_len += v->value_length; if (v->value_alloc_len) var_stats_val_alloc_len += v->value_alloc_len; else var_stats_val_rdonly_len += v->value_length; assert (v->value_length == strlen (v->value)); /*assert (v->rdonly_val ? !v->value_alloc_len : v->value_alloc_len > v->value_length); - FIXME */ #endif /* CONFIG_WITH_MAKE_STATS */ putchar ('\n'); fputs (prefix, stdout); /* Is this a 'define'? */ if (v->recursive && strchr (v->value, '\n') != 0) #ifndef KMK /** @todo language feature for aliases */ printf ("define %s\n%s\nendef\n", v->name, v->value); #else printf ("define %s\n%s\nendef\n", alias->name, v->value); #endif else { char *p; #ifndef KMK /** @todo language feature for aliases */ printf ("%s %s= ", v->name, v->recursive ? v->append ? "+" : "" : ":"); #else printf ("%s %s= ", alias->name, v->recursive ? v->append ? "+" : "" : ":"); #endif /* Check if the value is just whitespace. */ p = next_token (v->value); if (p != v->value && *p == '\0') /* All whitespace. */ printf ("$(subst ,,%s)", v->value); else if (v->recursive) fputs (v->value, stdout); else /* Double up dollar signs. */ for (p = v->value; *p != '\0'; ++p) { if (*p == '$') putchar ('$'); putchar (*p); } putchar ('\n'); } } static void print_auto_variable (const void *item, void *arg) { const struct variable *v = item; if (v->origin == o_automatic) print_variable (item, arg); } static void print_noauto_variable (const void *item, void *arg) { const struct variable *v = item; if (v->origin != o_automatic) print_variable (item, arg); } /* Print all the variables in SET. PREFIX is printed before the actual variable definitions (everything else is comments). */ #ifndef KMK static #endif void print_variable_set (struct variable_set *set, const char *prefix, int pauto) { #if defined (CONFIG_WITH_COMPILER) || defined (CONFIG_WITH_MAKE_STATS) var_stats_expands = var_stats_expanded = var_stats_evalvals = var_stats_evalvaled = 0; #endif #ifdef CONFIG_WITH_COMPILER var_stats_expandprogs = var_stats_evalprogs = 0; #endif #ifdef CONFIG_WITH_MAKE_STATS var_stats_changes = var_stats_changed = var_stats_reallocs = var_stats_realloced = var_stats_references = var_stats_referenced = var_stats_val_len = var_stats_val_alloc_len = var_stats_val_rdonly_len = 0; #endif hash_map_arg (&set->table, (pauto ? print_auto_variable : print_variable), (void *)prefix); if (set->table.ht_fill) { #ifdef CONFIG_WITH_MAKE_STATS unsigned long fragmentation; fragmentation = var_stats_val_alloc_len - (var_stats_val_len - var_stats_val_rdonly_len); printf(_("# variable set value stats:\n\ # strings %7lu bytes, readonly %6lu bytes\n"), var_stats_val_len, var_stats_val_rdonly_len); if (var_stats_val_alloc_len) printf(_("# allocated %7lu bytes, fragmentation %6lu bytes (%u%%)\n"), var_stats_val_alloc_len, fragmentation, (unsigned int)((100.0 * fragmentation) / var_stats_val_alloc_len)); if (var_stats_changed) printf(_("# changed %5lu (%2u%%), changes %6lu\n"), var_stats_changed, (unsigned int)((100.0 * var_stats_changed) / set->table.ht_fill), var_stats_changes); if (var_stats_realloced) printf(_("# reallocated %5lu (%2u%%), reallocations %6lu\n"), var_stats_realloced, (unsigned int)((100.0 * var_stats_realloced) / set->table.ht_fill), var_stats_reallocs); if (var_stats_referenced) printf(_("# referenced %5lu (%2u%%), references %6lu\n"), var_stats_referenced, (unsigned int)((100.0 * var_stats_referenced) / set->table.ht_fill), var_stats_references); #endif #if defined (CONFIG_WITH_COMPILER) || defined (CONFIG_WITH_MAKE_STATS) if (var_stats_evalvals) printf(_("# evalvaled %5lu (%2u%%), evalval calls %6lu\n"), var_stats_evalvaled, (unsigned int)((100.0 * var_stats_evalvaled) / set->table.ht_fill), var_stats_evalvals); if (var_stats_expands) printf(_("# expanded %5lu (%2u%%), expands %6lu\n"), var_stats_expanded, (unsigned int)((100.0 * var_stats_expanded) / set->table.ht_fill), var_stats_expands); #endif #ifdef CONFIG_WITH_COMPILER if (var_stats_expandprogs || var_stats_evalprogs) printf(_("# eval progs %5lu (%2u%%), expand progs %6lu (%2u%%)\n"), var_stats_evalprogs, (unsigned int)((100.0 * var_stats_evalprogs) / set->table.ht_fill), var_stats_expandprogs, (unsigned int)((100.0 * var_stats_expandprogs) / set->table.ht_fill)); #endif } fputs (_("# variable set hash-table stats:\n"), stdout); fputs ("# ", stdout); hash_print_stats (&set->table, stdout); putc ('\n', stdout); } /* Print the data base of variables. */ void print_variable_data_base (void) { puts (_("\n# Variables\n")); print_variable_set (&global_variable_set, "", 0); puts (_("\n# Pattern-specific Variable Values")); { struct pattern_var *p; unsigned int rules = 0; for (p = pattern_vars; p != 0; p = p->next) { ++rules; printf ("\n%s :\n", p->target); print_variable (&p->variable, (void *)"# "); } if (rules == 0) puts (_("\n# No pattern-specific variable values.")); else printf (_("\n# %u pattern-specific variable values"), rules); } #ifdef CONFIG_WITH_STRCACHE2 strcache2_print_stats (&variable_strcache, "# "); #endif } #ifdef CONFIG_WITH_PRINT_STATS_SWITCH void print_variable_stats (void) { fputs (_("\n# Global variable hash-table stats:\n# "), stdout); hash_print_stats (&global_variable_set.table, stdout); fputs ("\n", stdout); } #endif /* Print all the local variables of FILE. */ void print_file_variables (const struct file *file) { if (file->variables != 0) print_variable_set (file->variables->set, "# ", 1); } void print_target_variables (const struct file *file) { if (file->variables != 0) { int l = strlen (file->name); char *t = alloca (l + 3); strcpy (t, file->name); t[l] = ':'; t[l+1] = ' '; t[l+2] = '\0'; hash_map_arg (&file->variables->set->table, print_noauto_variable, t); } } #ifdef WINDOWS32 void sync_Path_environment (void) { char *path = allocated_variable_expand ("$(PATH)"); static char *environ_path = NULL; if (!path) return; /* If done this before, free the previous entry before allocating new one. */ free (environ_path); /* Create something WINDOWS32 world can grok. */ convert_Path_to_windows32 (path, ';'); environ_path = xstrdup (concat (3, "PATH", "=", path)); putenv (environ_path); free (path); } #endif kbuild-3608/src/kmk/output.c0000664000175000017500000011217214670377413016003 0ustar locutuslocutus/* Output to stdout / stderr for GNU make Copyright (C) 2013-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ #include "makeint.h" #include "job.h" /* GNU make no longer supports pre-ANSI89 environments. */ #include #include #include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_FCNTL_H # include #else # include #endif #ifdef WINDOWS32 # include # include # ifndef CONFIG_NEW_WIN_CHILDREN # include "sub_proc.h" # else # include "w32/winchildren.h" # endif #endif /* WINDOWS32 */ #ifdef KBUILD_OS_WINDOWS # include "console.h" #endif struct output *output_context = NULL; unsigned int stdio_traced = 0; #define OUTPUT_NONE (-1) #define OUTPUT_ISSET(_out) ((_out)->out >= 0 || (_out)->err >= 0) #ifdef HAVE_FCNTL_H # define STREAM_OK(_s) ((fcntl (fileno (_s), F_GETFD) != -1) || (errno != EBADF)) #else # define STREAM_OK(_s) 1 #endif #if defined(KMK) && !defined(NO_OUTPUT_SYNC) /* Non-negative if we're counting output lines. This is used by die_with_job_output to decide whether the initial build error needs to be repeated because there was too much output from parallel jobs between it and the actual make termination. */ int output_metered = -1; static void meter_output_block (char const *buffer, size_t len) { while (len > 0) { char *nl = (char *)memchr (buffer, '\n', len); size_t linelen; if (nl) { linelen = nl - buffer + 1; output_metered++; } else linelen = len; output_metered += linelen / 132; /* advance */ buffer += linelen; len -= linelen; } } #endif #ifdef CONFIG_WITH_OUTPUT_IN_MEMORY # define MEMBUF_MIN_SEG_SIZE 4096 # define MEMBUF_MAX_SEG_SIZE (512*1024) # define MEMBUF_MAX_MOVE_LEN ( MEMBUF_MIN_SEG_SIZE \ - offsetof (struct output_segment, runs) \ - sizeof (struct output_run)) # define MEMBUF_MAX_TOTAL ( sizeof (void *) <= 4 \ ? (size_t)512*1024 : (size_t)16*1024*1024 ) static void *acquire_semaphore (void); static void release_semaphore (void *); static int log_working_directory (int); /* Is make's stdout going to the same place as stderr? Also, did we already sync_init (== -1)? */ static int combined_output = -1; /* Helper for membuf_reset and output_reset */ static membuf_reset (struct output *out) { struct output_segment *seg; while ((seg = out->out.head_seg)) { out->out.head_seg = seg->next; free (seg); } out->out.tail_seg = NULL; out->out.tail_run = NULL; out->out.head_run = NULL; out->out.left = 0; out->out.total = 0; while ((seg = out->err.head_seg)) { out->err.head_seg = seg->next; free (seg); } out->err.tail_seg = NULL; out->err.tail_run = NULL; out->err.head_run = NULL; out->err.left = 0; out->err.total = 0; out->seqno = 0; } /* Used by die_with_job_output to suppress output when it shouldn't be repeated. */ void output_reset (struct output *out) { if (out && (out->out.total || out->err.total)) membuf_reset (out); } /* Internal worker for output_dump and membuf_dump_most. */ static void membuf_dump (struct output *out) { if (out->out.total || out->err.total) { int traced = 0; struct output_run *err_run; struct output_run *out_run; FILE *prevdst; /* Try to acquire the semaphore. If it fails, dump the output unsynchronized; still better than silently discarding it. We want to keep this lock for as little time as possible. */ void *sem = acquire_semaphore (); # if defined (KBUILD_OS_WINDOWS) || defined (KBUILD_OS_OS2) || defined (KBUILD_OS_DOS) int prev_mode_out = _setmode (fileno (stdout), _O_BINARY); int prev_mode_err = _setmode (fileno (stderr), _O_BINARY); # endif # ifndef KMK /* this drives me bananas. */ /* Log the working directory for this dump. */ if (print_directory_flag && output_sync != OUTPUT_SYNC_RECURSE) traced = log_working_directory (1); # endif /* Work the out and err sequences in parallel. */ out_run = out->out.head_run; err_run = out->err.head_run; prevdst = NULL; while (err_run || out_run) { FILE *dst; const void *src; size_t len; if (out_run && (!err_run || out_run->seqno <= err_run->seqno)) { src = out_run + 1; len = out_run->len; dst = stdout; out_run = out_run->next; } else { src = err_run + 1; len = err_run->len; dst = stderr; err_run = err_run->next; } if (dst != prevdst) fflush(prevdst); prevdst = dst; #ifdef KMK if (output_metered < 0) { /* likely */ } else meter_output_block (src, len); #endif # if 0 /* for debugging */ while (len > 0) { const char *nl = (const char *)memchr (src, '\n', len); size_t line_len = nl ? nl - (const char *)src + 1 : len; char *tmp = (char *)xmalloc (1 + line_len + 1 + 1); tmp[0] = '{'; memcpy (&tmp[1], src, line_len); tmp[1 + line_len] = '}'; # ifdef KBUILD_OS_WINDOWS maybe_con_fwrite (tmp, 1 + line_len + 1, 1, dst); # else fwrite (tmp, 1 + line_len + 1, 1, dst); # endif free (tmp); src = (const char *)src + line_len; len -= line_len; } #else # ifdef KBUILD_OS_WINDOWS maybe_con_fwrite (src, len, 1, dst); # else fwrite (src, len, 1, dst); # endif # endif } if (prevdst) fflush (prevdst); # ifndef KMK /* this drives me bananas. */ if (traced) log_working_directory (0); # endif /* Exit the critical section. */ # if defined (KBUILD_OS_WINDOWS) || defined (KBUILD_OS_OS2) || defined (KBUILD_OS_DOS) _setmode (fileno (stdout), prev_mode_out); _setmode (fileno (stderr), prev_mode_err); # endif if (sem) release_semaphore (sem); # ifdef KMK if (!out->dont_truncate) { /* likely */ } else return; # endif /* Free the segments and reset the state. */ membuf_reset (out); } else assert (out->out.head_seg == NULL && out->err.head_seg == NULL); } /* Writes up to LEN bytes to the given segment. Returns how much was actually written. */ static size_t membuf_write_segment (struct output_membuf *membuf, struct output_segment *seg, const char *src, size_t len, unsigned int *pseqno) { size_t written = 0; if (seg && membuf->left > 0) { struct output_run *run = membuf->tail_run; char *dst = (char *)(run + 1) + run->len; assert ((uintptr_t)run - (uintptr_t)seg < seg->size); /* If the sequence number didn't change, then we can append to the current run without further considerations. */ if (run->seqno == *pseqno) written = len; /* If the current run does not end with a newline, don't start a new run till we encounter one. */ else if (dst[-1] != '\n') { char const *srcnl = (const char *)memchr (src, '\n', len); written = srcnl ? srcnl - src + 1 : len; } /* Try create a new empty run and append to it. */ else { size_t const offnextrun = ( (uintptr_t)dst - (uintptr_t)(seg) + sizeof(void *) - 1) & ~(sizeof(void *) - 1); if (offnextrun > seg->size - sizeof (struct output_run) * 2) return 0; /* need new segment */ run = run->next = (struct output_run *)((char *)seg + offnextrun); run->next = NULL; run->seqno = ++(*pseqno); run->len = 0; membuf->tail_run = run; membuf->left = seg->size - (offnextrun + sizeof (*run)); dst = (char *)(run + 1); written = len; } /* Append to the current run. */ if (written > membuf->left) written = membuf->left; memcpy (dst, src, written); run->len += written; membuf->left -= written; } return written; } /* Helper for membuf_write_new_segment and membuf_dump_most that figures out now much data needs to be moved from the previous run in order to make it end with a newline. */ static size_t membuf_calc_move_len (struct output_run *tail_run) { size_t to_move = 0; if (tail_run) { const char *data = (const char *)(tail_run + 1); size_t off = tail_run->len; while (off > 0 && data[off - 1] != '\n') off--; to_move = tail_run->len - off; if (to_move >= MEMBUF_MAX_MOVE_LEN) to_move = 0; } return to_move; } /* Allocates a new segment and writes to it. This will take care to make sure the previous run terminates with a newline so that we pass whole lines to fwrite when dumping. */ static size_t membuf_write_new_segment (struct output_membuf *membuf, const char *src, size_t len, unsigned int *pseqno) { struct output_run *prev_run = membuf->tail_run; struct output_segment *prev_seg = membuf->tail_seg; size_t const to_move = membuf_calc_move_len (prev_run); struct output_segment *new_seg; size_t written; char *dst; /* Figure the the segment size. We start with MEMBUF_MIN_SEG_SIZE and double it each time till we reach MEMBUF_MAX_SEG_SIZE. */ size_t const offset_runs = offsetof (struct output_segment, runs); size_t segsize = !prev_seg ? MEMBUF_MIN_SEG_SIZE : prev_seg->size >= MEMBUF_MAX_SEG_SIZE ? MEMBUF_MAX_SEG_SIZE : prev_seg->size * 2; while ( segsize < to_move + len + offset_runs + sizeof (struct output_run) * 2 && segsize < MEMBUF_MAX_SEG_SIZE) segsize *= 2; /* Allocate the segment and link it and the first run. */ new_seg = (struct output_segment *)xmalloc (segsize); new_seg->size = segsize; new_seg->next = NULL; new_seg->runs[0].next = NULL; if (!prev_seg) { membuf->head_seg = new_seg; membuf->head_run = &new_seg->runs[0]; } else { prev_seg->next = new_seg; prev_run->next = &new_seg->runs[0]; } membuf->tail_seg = new_seg; membuf->tail_run = &new_seg->runs[0]; membuf->total += segsize; membuf->left = segsize - sizeof (struct output_run) - offset_runs; /* Initialize and write data to the first run. */ dst = (char *)&new_seg->runs[0]; /* Try bypass gcc array size cleverness. */ dst += sizeof (struct output_run); assert (MEMBUF_MAX_MOVE_LEN < MEMBUF_MIN_SEG_SIZE); if (to_move > 0) { /* Move to_move bytes from the previous run in hope that we'll get a newline to soon. Afterwards call membuf_segment_write to work SRC. */ assert (prev_run != NULL); assert (membuf->left >= to_move); prev_run->len -= to_move; new_seg->runs[0].len = to_move; new_seg->runs[0].seqno = prev_run->seqno; memcpy (dst, (const char *)(prev_run + 1) + prev_run->len, to_move); membuf->left -= to_move; written = membuf_write_segment (membuf, new_seg, src, len, pseqno); } else { /* Create a run with up to LEN from SRC. */ written = len; if (written > membuf->left) written = membuf->left; new_seg->runs[0].len = written; new_seg->runs[0].seqno = ++(*pseqno); memcpy (dst, src, written); membuf->left -= written; } return written; } /* Worker for output_write that will dump most of the output when we hit MEMBUF_MAX_TOTAL on either of the two membuf structures, then free all the output segments. Incomplete lines will be held over to the next buffers and copied into new segments. */ static void membuf_dump_most (struct output *out) { size_t out_to_move = membuf_calc_move_len (out->out.tail_run); size_t err_to_move = membuf_calc_move_len (out->err.tail_run); if (!out_to_move && !err_to_move) membuf_dump (out); else { /* Allocate a stack buffer for holding incomplete lines. This should be fine since we're only talking about max 2 * MEMBUF_MAX_MOVE_LEN. The -1 on the sequence numbers, ise because membuf_write_new_segment will increment them before use. */ unsigned int out_seqno = out_to_move ? out->out.tail_run->seqno - 1 : 0; unsigned int err_seqno = err_to_move ? out->err.tail_run->seqno - 1 : 0; char *tmp = alloca (out_to_move + err_to_move); if (out_to_move) { out->out.tail_run->len -= out_to_move; memcpy (tmp, (char *)(out->out.tail_run + 1) + out->out.tail_run->len, out_to_move); } if (err_to_move) { out->err.tail_run->len -= err_to_move; memcpy (tmp + out_to_move, (char *)(out->err.tail_run + 1) + out->err.tail_run->len, err_to_move); } membuf_dump (out); if (out_to_move) { size_t written = membuf_write_new_segment (&out->out, tmp, out_to_move, &out_seqno); assert (written == out_to_move); (void)written; } if (err_to_move) { size_t written = membuf_write_new_segment (&out->err, tmp + out_to_move, err_to_move, &err_seqno); assert (written == err_to_move); (void)written; } } } /* write/fwrite like function, binary mode. */ ssize_t output_write_bin (struct output *out, int is_err, const char *src, size_t len) { size_t ret = len; if (!out || !out->syncout) { FILE *f = is_err ? stderr : stdout; # if defined (KBUILD_OS_WINDOWS) || defined (KBUILD_OS_OS2) || defined (KBUILD_OS_DOS) /* On DOS platforms we need to disable \n -> \r\n converts that is common on standard output/error. Also optimize for console output. */ int saved_errno; int fd = fileno (f); int prev_mode = _setmode (fd, _O_BINARY); maybe_con_fwrite (src, len, 1, f); if (fflush (f) == EOF) ret = -1; saved_errno = errno; _setmode (fd, prev_mode); errno = saved_errno; # else fwrite (src, len, 1, f); if (fflush (f) == EOF) ret = -1; # endif } else { struct output_membuf *membuf = is_err ? &out->err : &out->out; while (len > 0) { size_t runlen = membuf_write_segment (membuf, membuf->tail_seg, src, len, &out->seqno); if (!runlen) { if (membuf->total < MEMBUF_MAX_TOTAL) runlen = membuf_write_new_segment (membuf, src, len, &out->seqno); else membuf_dump_most (out); } /* advance */ len -= runlen; src += runlen; } } return ret; } #endif /* CONFIG_WITH_OUTPUT_IN_MEMORY */ /* write/fwrite like function, text mode. */ ssize_t output_write_text (struct output *out, int is_err, const char *src, size_t len) { #ifdef CONFIG_WITH_OUTPUT_IN_MEMORY # if defined (KBUILD_OS_WINDOWS) || defined (KBUILD_OS_OS2) || defined (KBUILD_OS_DOS) ssize_t ret = len; if (!out || !out->syncout) { /* ASSUME fwrite does the desired conversion. */ FILE *f = is_err ? stderr : stdout; # ifdef KBUILD_OS_WINDOWS if (maybe_con_fwrite (src, len, 1, f) < 0) ret = -1; # else fwrite (src, len, 1, f); # endif if (fflush (f) == EOF) ret = -1; } else { /* Work the buffer line by line, replacing each \n with \r\n. */ while (len > 0) { const char *nl = memchr ( src, '\n', len); size_t line_len = nl ? nl - src : len; output_write_bin (out, is_err, src, line_len); if (!nl) break; output_write_bin (out, is_err, "\r\n", 2); len -= line_len + 1; src += line_len + 1; } } return ret; # else return output_write_bin (out, is_err, src, len); # endif #else ssize_t ret = len; if (! out || ! out->syncout) { FILE *f = is_err ? stderr : stdout; # ifdef KBUILD_OS_WINDOWS maybe_con_fwrite(src, len, 1, f); # else fwrite (src, len, 1, f); # endif fflush (f); } else { int fd = is_err ? out->err : out->out; int r; EINTRLOOP (r, lseek (fd, 0, SEEK_END)); while (1) { EINTRLOOP (r, write (fd, src, len)); if ((size_t)r == len || r <= 0) break; len -= r; src += r; } } return ret; #endif } /* Write a string to the current STDOUT or STDERR. */ static void _outputs (struct output *out, int is_err, const char *msg) { #ifdef CONFIG_WITH_OUTPUT_IN_MEMORY output_write_text (out, is_err, msg, strlen (msg)); #else /* !CONFIG_WITH_OUTPUT_IN_MEMORY */ if (! out || ! out->syncout) { FILE *f = is_err ? stderr : stdout; # ifdef KBUILD_OS_WINDOWS maybe_con_fwrite(msg, strlen(msg), 1, f); # else fputs (msg, f); # endif fflush (f); } else { int fd = is_err ? out->err : out->out; int len = strlen (msg); int r; EINTRLOOP (r, lseek (fd, 0, SEEK_END)); while (1) { EINTRLOOP (r, write (fd, msg, len)); if (r == len || r <= 0) break; len -= r; msg += r; } } #endif /* !CONFIG_WITH_OUTPUT_IN_MEMORY */ } /* Write a message indicating that we've just entered or left (according to ENTERING) the current directory. */ static int log_working_directory (int entering) { static char *buf = NULL; static unsigned int len = 0; unsigned int need; const char *fmt; char *p; /* Get enough space for the longest possible output. */ need = strlen (program) + INTSTR_LENGTH + 2 + 1; if (starting_directory) need += strlen (starting_directory); /* Use entire sentences to give the translators a fighting chance. */ if (makelevel == 0) if (starting_directory == 0) if (entering) fmt = _("%s: Entering an unknown directory\n"); else fmt = _("%s: Leaving an unknown directory\n"); else if (entering) fmt = _("%s: Entering directory '%s'\n"); else fmt = _("%s: Leaving directory '%s'\n"); else if (starting_directory == 0) if (entering) fmt = _("%s[%u]: Entering an unknown directory\n"); else fmt = _("%s[%u]: Leaving an unknown directory\n"); else if (entering) fmt = _("%s[%u]: Entering directory '%s'\n"); else fmt = _("%s[%u]: Leaving directory '%s'\n"); need += strlen (fmt); if (need > len) { buf = xrealloc (buf, need); len = need; } p = buf; if (print_data_base_flag) { *(p++) = '#'; *(p++) = ' '; } if (makelevel == 0) if (starting_directory == 0) sprintf (p, fmt , program); else sprintf (p, fmt, program, starting_directory); else if (starting_directory == 0) sprintf (p, fmt, program, makelevel); else sprintf (p, fmt, program, makelevel, starting_directory); _outputs (NULL, 0, buf); return 1; } /* Set a file descriptor to be in O_APPEND mode. If it fails, just ignore it. */ static void set_append_mode (int fd) { #if defined(F_GETFL) && defined(F_SETFL) && defined(O_APPEND) int flags = fcntl (fd, F_GETFL, 0); if (flags >= 0) fcntl (fd, F_SETFL, flags | O_APPEND); #endif } #ifndef NO_OUTPUT_SYNC /* Semaphore for use in -j mode with output_sync. */ static sync_handle_t sync_handle = -1; #define FD_NOT_EMPTY(_f) ((_f) != OUTPUT_NONE && lseek ((_f), 0, SEEK_END) > 0) /* Set up the sync handle. Disables output_sync on error. */ static int sync_init (void) { int combined_output = 0; #ifdef WINDOWS32 # ifdef CONFIG_NEW_WIN_CHILDREN if (STREAM_OK (stdout)) { if (STREAM_OK (stderr)) { char mtxname[256]; sync_handle = create_mutex (mtxname, sizeof (mtxname)); if (sync_handle != -1) { prepare_mutex_handle_string (mtxname); return same_stream (stdout, stderr); } perror_with_name ("output-sync suppressed: ", "create_mutex"); } else perror_with_name ("output-sync suppressed: ", "stderr"); } else perror_with_name ("output-sync suppressed: ", "stdout"); output_sync = OUTPUT_SYNC_NONE; # else /* !CONFIG_NEW_WIN_CHILDREN */ if ((!STREAM_OK (stdout) && !STREAM_OK (stderr)) || (sync_handle = create_mutex ()) == -1) { perror_with_name ("output-sync suppressed: ", "stderr"); output_sync = 0; } else { combined_output = same_stream (stdout, stderr); prepare_mutex_handle_string (sync_handle); } # endif /* !CONFIG_NEW_WIN_CHILDREN */ #else if (STREAM_OK (stdout)) { struct stat stbuf_o, stbuf_e; sync_handle = fileno (stdout); combined_output = (fstat (fileno (stdout), &stbuf_o) == 0 && fstat (fileno (stderr), &stbuf_e) == 0 && stbuf_o.st_dev == stbuf_e.st_dev && stbuf_o.st_ino == stbuf_e.st_ino); } else if (STREAM_OK (stderr)) sync_handle = fileno (stderr); else { perror_with_name ("output-sync suppressed: ", "stderr"); output_sync = 0; } #endif return combined_output; } #ifndef CONFIG_WITH_OUTPUT_IN_MEMORY /* Support routine for output_sync() */ static void pump_from_tmp (int from, FILE *to) { # ifdef KMK char buffer[8192]; # else static char buffer[8192]; #endif # if defined (KBUILD_OS_WINDOWS) || defined (KBUILD_OS_OS2) || defined (KBUILD_OS_DOS) int prev_mode; /* "from" is opened by open_tmpfd, which does it in binary mode, so we need the mode of "to" to match that. */ prev_mode = _setmode (fileno (to), O_BINARY); #endif if (lseek (from, 0, SEEK_SET) == -1) perror ("lseek()"); while (1) { int len; EINTRLOOP (len, read (from, buffer, sizeof (buffer))); if (len < 0) perror ("read()"); if (len <= 0) break; #ifdef KMK if (output_metered < 0) { /* likely */ } else meter_output_block (buffer, len); #endif if (fwrite (buffer, len, 1, to) < 1) { perror ("fwrite()"); break; } fflush (to); } # if defined (KBUILD_OS_WINDOWS) || defined (KBUILD_OS_OS2) || defined (KBUILD_OS_DOS) /* Switch "to" back to its original mode, so that log messages by Make have the same EOL format as without --output-sync. */ _setmode (fileno (to), prev_mode); #endif } #endif /* CONFIG_WITH_OUTPUT_IN_MEMORY */ /* Obtain the lock for writing output. */ static void * acquire_semaphore (void) { static struct flock fl; fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 1; if (fcntl (sync_handle, F_SETLKW, &fl) != -1) return &fl; #ifdef KBUILD_OS_DARWIN /* F_SETLKW isn't supported on pipes */ if (errno != EBADF) #endif perror ("fcntl()"); return NULL; } /* Release the lock for writing output. */ static void release_semaphore (void *sem) { struct flock *flp = (struct flock *)sem; flp->l_type = F_UNLCK; if (fcntl (sync_handle, F_SETLKW, flp) == -1) perror ("fcntl()"); } #ifndef CONFIG_WITH_OUTPUT_IN_MEMORY /* Returns a file descriptor to a temporary file. The file is automatically closed/deleted on exit. Don't use a FILE* stream. */ int output_tmpfd (void) { int fd = -1; FILE *tfile = tmpfile (); if (! tfile) { #ifdef KMK if (output_context && output_context->syncout) output_context->syncout = 0; /* Avoid inifinit recursion. */ #endif pfatal_with_name ("tmpfile"); } /* Create a duplicate so we can close the stream. */ fd = dup (fileno (tfile)); if (fd < 0) { #ifdef KMK if (output_context && output_context->syncout) output_context->syncout = 0; /* Avoid inifinit recursion. */ #endif pfatal_with_name ("dup"); } fclose (tfile); set_append_mode (fd); return fd; } /* Adds file descriptors to the child structure to support output_sync; one for stdout and one for stderr as long as they are open. If stdout and stderr share a device they can share a temp file too. Will reset output_sync on error. */ static void setup_tmpfile (struct output *out) { /* Is make's stdout going to the same place as stderr? */ static int combined_output = -1; if (combined_output < 0) { #ifdef KMK /* prevent infinite recursion if sync_init() calls perror_with_name. */ combined_output = 0; #endif combined_output = sync_init (); } if (STREAM_OK (stdout)) { int fd = output_tmpfd (); if (fd < 0) goto error; CLOSE_ON_EXEC (fd); out->out = fd; } if (STREAM_OK (stderr)) { if (out->out != OUTPUT_NONE && combined_output) out->err = out->out; else { int fd = output_tmpfd (); if (fd < 0) goto error; CLOSE_ON_EXEC (fd); out->err = fd; } } return; /* If we failed to create a temp file, disable output sync going forward. */ error: output_close (out); output_sync = OUTPUT_SYNC_NONE; } #endif /* CONFIG_WITH_OUTPUT_IN_MEMORY */ /* Synchronize the output of jobs in -j mode to keep the results of each job together. This is done by holding the results in temp files, one for stdout and potentially another for stderr, and only releasing them to "real" stdout/stderr when a semaphore can be obtained. */ void output_dump (struct output *out) { #ifdef CONFIG_WITH_OUTPUT_IN_MEMORY membuf_dump (out); #else int outfd_not_empty = FD_NOT_EMPTY (out->out); int errfd_not_empty = FD_NOT_EMPTY (out->err); if (outfd_not_empty || errfd_not_empty) { # ifndef KMK /* this drives me bananas. */ int traced = 0; # endif /* Try to acquire the semaphore. If it fails, dump the output unsynchronized; still better than silently discarding it. We want to keep this lock for as little time as possible. */ void *sem = acquire_semaphore (); # ifndef KMK /* this drives me bananas. */ /* Log the working directory for this dump. */ if (print_directory_flag && output_sync != OUTPUT_SYNC_RECURSE) traced = log_working_directory (1); # endif if (outfd_not_empty) pump_from_tmp (out->out, stdout); if (errfd_not_empty && out->err != out->out) pump_from_tmp (out->err, stderr); # ifndef KMK /* this drives me bananas. */ if (traced) log_working_directory (0); # endif /* Exit the critical section. */ if (sem) release_semaphore (sem); # ifdef KMK if (!out->dont_truncate) { /* likely */ } else return; # endif /* Truncate and reset the output, in case we use it again. */ if (out->out != OUTPUT_NONE) { int e; lseek (out->out, 0, SEEK_SET); EINTRLOOP (e, ftruncate (out->out, 0)); } if (out->err != OUTPUT_NONE && out->err != out->out) { int e; lseek (out->err, 0, SEEK_SET); EINTRLOOP (e, ftruncate (out->err, 0)); } } #endif } # if defined(KMK) && !defined(CONFIG_WITH_OUTPUT_IN_MEMORY) /* Used by die_with_job_output to suppress output when it shouldn't be repeated. */ void output_reset (struct output *out) { if (out) { if (out->out != OUTPUT_NONE) { int e; lseek (out->out, 0, SEEK_SET); EINTRLOOP (e, ftruncate (out->out, 0)); } if (out->err != OUTPUT_NONE && out->err != out->out) { int e; lseek (out->err, 0, SEEK_SET); EINTRLOOP (e, ftruncate (out->err, 0)); } } } # endif #endif /* NO_OUTPUT_SYNC */ /* Provide support for temporary files. */ #ifndef HAVE_STDLIB_H # ifdef HAVE_MKSTEMP int mkstemp (char *template); # else char *mktemp (char *template); # endif #endif FILE * output_tmpfile (char **name, const char *template) { #ifdef HAVE_FDOPEN int fd; #endif #if defined HAVE_MKSTEMP || defined HAVE_MKTEMP # define TEMPLATE_LEN strlen (template) #else # define TEMPLATE_LEN L_tmpnam #endif *name = xmalloc (TEMPLATE_LEN + 1); strcpy (*name, template); #if defined HAVE_MKSTEMP && defined HAVE_FDOPEN /* It's safest to use mkstemp(), if we can. */ fd = mkstemp (*name); if (fd == -1) return 0; return fdopen (fd, "w"); #else # ifdef HAVE_MKTEMP (void) mktemp (*name); # else (void) tmpnam (*name); # endif # ifdef HAVE_FDOPEN /* Can't use mkstemp(), but guard against a race condition. */ EINTRLOOP (fd, open (*name, O_CREAT|O_EXCL|O_WRONLY, 0600)); if (fd == -1) return 0; return fdopen (fd, "w"); # else /* Not secure, but what can we do? */ return fopen (*name, "w"); # endif #endif } /* This code is stolen from gnulib. If/when we abandon the requirement to work with K&R compilers, we can remove this (and perhaps other parts of GNU make!) and migrate to using gnulib directly. This is called only through atexit(), which means die() has already been invoked. So, call exit() here directly. Apparently that works...? */ /* Close standard output, exiting with status 'exit_failure' on failure. If a program writes *anything* to stdout, that program should close stdout and make sure that it succeeds before exiting. Otherwise, suppose that you go to the extreme of checking the return status of every function that does an explicit write to stdout. The last printf can succeed in writing to the internal stream buffer, and yet the fclose(stdout) could still fail (due e.g., to a disk full error) when it tries to write out that buffered data. Thus, you would be left with an incomplete output file and the offending program would exit successfully. Even calling fflush is not always sufficient, since some file systems (NFS and CODA) buffer written/flushed data until an actual close call. Besides, it's wasteful to check the return value from every call that writes to stdout -- just let the internal stream state record the failure. That's what the ferror test is checking below. It's important to detect such failures and exit nonzero because many tools (most notably 'make' and other build-management systems) depend on being able to detect failure in other tools via their exit status. */ static void close_stdout (void) { int prev_fail = ferror (stdout); int fclose_fail = fclose (stdout); if (prev_fail || fclose_fail) { if (fclose_fail) perror_with_name (_("write error: stdout"), ""); else O (error, NILF, _("write error: stdout")); exit (MAKE_TROUBLE); } } void output_init (struct output *out) { if (out) { #ifdef CONFIG_WITH_OUTPUT_IN_MEMORY out->out.head_seg = NULL; out->out.tail_seg = NULL; out->out.head_run = NULL; out->out.tail_run = NULL; out->err.head_seg = NULL; out->err.tail_seg = NULL; out->err.head_run = NULL; out->err.tail_run = NULL; out->err.total = 0; out->out.total = 0; out->seqno = 0; #else out->out = out->err = OUTPUT_NONE; #endif out->syncout = !!output_sync; #ifdef KMK out->dont_truncate = 0; #endif return; } /* Configure this instance of make. Be sure stdout is line-buffered. */ #ifdef HAVE_SETVBUF # ifdef SETVBUF_REVERSED setvbuf (stdout, _IOLBF, xmalloc (BUFSIZ), BUFSIZ); # else /* setvbuf not reversed. */ /* Some buggy systems lose if we pass 0 instead of allocating ourselves. */ setvbuf (stdout, 0, _IOLBF, BUFSIZ); # endif /* setvbuf reversed. */ #elif HAVE_SETLINEBUF setlinebuf (stdout); #endif /* setlinebuf missing. */ /* Force stdout/stderr into append mode. This ensures parallel jobs won't lose output due to overlapping writes. */ set_append_mode (fileno (stdout)); set_append_mode (fileno (stderr)); #ifdef HAVE_ATEXIT if (STREAM_OK (stdout)) atexit (close_stdout); #endif } void output_close (struct output *out) { if (! out) { if (stdio_traced) log_working_directory (0); return; } #ifndef NO_OUTPUT_SYNC output_dump (out); #endif #ifdef CONFIG_WITH_OUTPUT_IN_MEMORY assert (out->out.total == 0); assert (out->out.head_seg == NULL); assert (out->err.total == 0); assert (out->err.head_seg == NULL); #else if (out->out >= 0) close (out->out); if (out->err >= 0 && out->err != out->out) close (out->err); #endif output_init (out); } /* We're about to generate output: be sure it's set up. */ void output_start (void) { #ifdef CONFIG_WITH_OUTPUT_IN_MEMORY /* If we're syncing output make sure the sempahore (win) is set up. */ if (output_context && output_context->syncout) if (combined_output < 0) combined_output = sync_init (); #else #ifndef NO_OUTPUT_SYNC /* If we're syncing output make sure the temporary file is set up. */ if (output_context && output_context->syncout) if (! OUTPUT_ISSET(output_context)) setup_tmpfile (output_context); #endif #endif #ifndef KMK /* If we're not syncing this output per-line or per-target, make sure we emit the "Entering..." message where appropriate. */ if (output_sync == OUTPUT_SYNC_NONE || output_sync == OUTPUT_SYNC_RECURSE) #else /* Indiscriminately output "Entering..." and "Leaving..." message for each command line or target is plain annoying! And when there is no recursion it's actually inappropriate. Haven't got a simple way of detecting that, so back to the old behavior for now. [bird] */ #endif if (! stdio_traced && print_directory_flag) stdio_traced = log_working_directory (1); } void outputs (int is_err, const char *msg) { if (! msg || *msg == '\0') return; output_start (); _outputs (output_context, is_err, msg); } static struct fmtstring { char *buffer; size_t size; } fmtbuf = { NULL, 0 }; static char * get_buffer (size_t need) { /* Make sure we have room. NEED includes space for \0. */ if (need > fmtbuf.size) { fmtbuf.size += need * 2; fmtbuf.buffer = xrealloc (fmtbuf.buffer, fmtbuf.size); } fmtbuf.buffer[need-1] = '\0'; return fmtbuf.buffer; } /* Print a message on stdout. */ void message (int prefix, size_t len, const char *fmt, ...) { va_list args; char *p; len += strlen (fmt) + strlen (program) + INTSTR_LENGTH + 4 + 1 + 1; p = get_buffer (len); if (prefix) { if (makelevel == 0) sprintf (p, "%s: ", program); else sprintf (p, "%s[%u]: ", program, makelevel); p += strlen (p); } va_start (args, fmt); vsprintf (p, fmt, args); va_end (args); strcat (p, "\n"); assert (fmtbuf.buffer[len-1] == '\0'); outputs (0, fmtbuf.buffer); } /* Print an error message. */ void error (const floc *flocp, size_t len, const char *fmt, ...) { va_list args; char *p; len += (strlen (fmt) + strlen (program) + (flocp && flocp->filenm ? strlen (flocp->filenm) : 0) + INTSTR_LENGTH + 4 + 1 + 1); p = get_buffer (len); if (flocp && flocp->filenm) sprintf (p, "%s:%lu: ", flocp->filenm, flocp->lineno + flocp->offset); else if (makelevel == 0) sprintf (p, "%s: ", program); else sprintf (p, "%s[%u]: ", program, makelevel); p += strlen (p); va_start (args, fmt); vsprintf (p, fmt, args); va_end (args); strcat (p, "\n"); assert (fmtbuf.buffer[len-1] == '\0'); outputs (1, fmtbuf.buffer); } /* Print an error message and exit. */ void fatal (const floc *flocp, size_t len, const char *fmt, ...) { va_list args; const char *stop = _(". Stop.\n"); char *p; len += (strlen (fmt) + strlen (program) + (flocp && flocp->filenm ? strlen (flocp->filenm) : 0) + INTSTR_LENGTH + 8 + strlen (stop) + 1); p = get_buffer (len); if (flocp && flocp->filenm) sprintf (p, "%s:%lu: *** ", flocp->filenm, flocp->lineno + flocp->offset); else if (makelevel == 0) sprintf (p, "%s: *** ", program); else sprintf (p, "%s[%u]: *** ", program, makelevel); p += strlen (p); va_start (args, fmt); vsprintf (p, fmt, args); va_end (args); strcat (p, stop); assert (fmtbuf.buffer[len-1] == '\0'); outputs (1, fmtbuf.buffer); die (MAKE_FAILURE); } /* Print an error message from errno. */ void perror_with_name (const char *str, const char *name) { const char *err = strerror (errno); OSSS (error, NILF, _("%s%s: %s"), str, name, err); } /* Print an error message from errno and exit. */ void pfatal_with_name (const char *name) { const char *err = strerror (errno); OSS (fatal, NILF, _("%s: %s"), name, err); /* NOTREACHED */ } kbuild-3608/src/kmk/README.OS2.template0000664000175000017500000001477514670377414017406 0ustar locutuslocutusPort of GNU make to OS/2. Features of GNU make that do not work under OS/2: - remote job execution - dynamic load balancing Special features of the OS/2 version: Due to the fact that some people might want to use sh syntax in Makefiles while others might want to use OS/2's native shell cmd.exe, GNU make supports both shell types. The following list defines the order that is used to determine the shell: 1. The shell specified by the environment variable MAKESHELL. 2. The shell specified by the SHELL variable within a Makefile. Like Unix, SHELL is NOT taken from the environment. 3. The shell specified by the COMSPEC environment variable. 4. The shell specified by the OS2_SHELL environment variable. 5. If none of the above is defined /bin/sh is used as default. This happens e.g. in the make testsuite. Note: - Points 3 and 4 can be turned off at compile time by adding -DNO_CMD_DEFAULT to the CPPFLAGS. - DOS support is not tested for EMX and therefore might not work. - The UNIXROOT environment variable is supported to find /bin/sh if it is not on the current drive. COMPILATION OF GNU MAKE FOR OS/2: I. ***** SPECIAL OPTIONS ***** - At compile time you can turn off that cmd is used as default shell (but only /bin/sh). Simply set CPPFLAGS="-DNO_CMD_DEFAULT" and make will not use cmd unless you cause it to do so by setting MAKESHELL to cmd or by specifying SHELL=cmd in your Makefile. - At compile time you can set CPPFLAGS="-DNO_CHDIR2" to turn off that GNU make prints drive letters. This is necessary if you want to run the testsuite. II. ***** REQUIREMENTS FOR THE COMPILATION ***** A standard Unix like build environment: - sh compatible shell (ksh, bash, ash, but tested only with pdksh 5.2.14 release 2) If you use pdksh it is recommended to update to 5.2.14 release 2. Older versions may not work! You can get this version at http://www.math.ohio-state.edu/~ilya/software/os2/pdksh-5.2.14-bin-2.zip - GNU file utilities (make sure that install.exe from the file utilities is in front of your PATH before X:\OS2\INSTALL\INSTALL.EXE. I recommend also to change the filename to ginstall.exe instead of install.exe to avoid confusion with X:\OS2\INSTALL\INSTALL.EXE) - GNU shell utilities - GNU text utilities - gawk - grep - sed - GNU make 3.79.1 (special OS/2 patched version) or higher - perl 5.005 or higher - GNU texinfo (you can use 3.1 (gnuinfo.zip), but I recommend 4.0) If you want to recreate the configuration files (developers only!) you need also: GNU m4 1.4, autoconf 2.59, automake 1.9.6 (or compatible) III. ***** COMPILATION AND INSTALLATION ***** a) ** Developers only - Everyone else should skip this section ** To recreate the configuration files use: export EMXSHELL=ksh aclocal -I config automake autoconf autoheader b) Installation into x:/usr Note: Although it is possible to compile make using "./configure", "make", "make install" this is not recommended. In particular, you must ALWAYS use LDFLAGS="-Zstack 0x6000" because the default stack size is far to small and make will not work properly! Recommended environment variables and installation options: export ac_executable_extensions=".exe" export CPPFLAGS="-D__ST_MT_ERRNO__" export CFLAGS="-O2 -Zomf -Zmt" export LDFLAGS="-Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 0x6000" export RANLIB="echo" ./configure --prefix=x:/usr --infodir=x:/usr/share/info --mandir=x:/usr/share/man --without-included-gettext make AR=emxomfar make install Note: If you use gcc 2.9.x I recommend to set also LIBS="-lgcc" Note: You can add -DNO_CMD_DEFAULT and -DNO_CHDIR2 to CPPFLAGS. See section I. for details. IV. ***** NLS support ***** GNU make has NLS (National Language Support), with the following caveats: a) It will only work with GNU gettext, and b) GNU gettext support is not included in the GNU make package. Therefore, if you wish to enable the internationalization features of GNU make you must install GNU gettext on your system before configuring GNU make. You can choose the languages to be installed. To install support for English, German and French only enter: export LINGUAS="en de fr" If you don't specify LINGUAS all languages are installed. If you don't want NLS support (English only) use the option --disable-nls for the configure script. Note if GNU gettext is not installed then NLS will not be enabled regardless of this flag. V. ***** Running the make test suite ***** To run the included make test suite you have to set CPPFLAGS="-D__ST_MT_ERRNO__ -DNO_CMD_DEFAULT -DNO_CHDIR2" before you compile make. This is due to some restrictions of the testsuite itself. -DNO_CMD_DEFAULT causes make to use /bin/sh as default shell in every case. Normally you could simply set MAKESHELL="/bin/sh" to do this but the testsuite ignores the environment. -DNO_CHDIR2 causes make not to use drive letters for directory names (i.e. _chdir2() and _getcwd2() are NOT used). The testsuite interpretes the whole output of make, especially statements like make[1]: Entering directory 'C:/somewhere/make-3.79.1/tests' where the testsuite does not expect the drive letter. This would be interpreted as an error even if there is none. To run the testsuite do the following: export CPPFLAGS="-D__ST_MT_ERRNO__ -DNO_CMD_DEFAULT -DNO_CHDIR2" export CFLAGS="-Zomf -O2 -Zmt" export LDFLAGS="-Zcrtdll -s -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 0x6000" export RANLIB="echo" ./configure --prefix=x:/usr --disable-nls make AR=emxomfar make check All tests should work fine with the exception of one of the "INCLUDE_DIRS" tests which will fail if your /usr/include directory is on a drive different from the make source tree. ------------------------------------------------------------------------------- Copyright (C) 2003-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . kbuild-3608/src/kmk/config.h.solaris0000664000175000017500000003063014670377413017366 0ustar locutuslocutus/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if the `closedir' function returns void instead of `int'. */ /* #undef CLOSEDIR_VOID */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ /* Define to 1 if using `getloadavg.c'. */ /* #undef C_GETLOADAVG */ /* Define to 1 for DGUX with . */ /* #undef DGUX */ /* Use high resolution file timestamps if nonzero. */ #define FILE_TIMESTAMP_HI_RES 1 /* Define to 1 if the `getloadavg' function needs to be run setuid or setgid. */ /* #undef GETLOADAVG_PRIVILEGED */ /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 /* Define to 1 if you have and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define to 1 if your compiler conforms to the ANSI C standard. */ #define HAVE_ANSI_COMPILER 1 /* Define to 1 if you have the `atexit' function. */ #define HAVE_ATEXIT 1 /* Define to 1 if you have the `bsd_signal' function. */ #define HAVE_BSD_SIGNAL 1 #define HAVE_DECL_BSD_SIGNAL 1 /* Use case insensitive file names */ /* #undef HAVE_CASE_INSENSITIVE_FS */ /* Define to 1 if you have the clock_gettime function. */ #define HAVE_CLOCK_GETTIME 1 /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ #define HAVE_DECL_SYS_SIGLIST 0 /* Define to 1 if you have the declaration of `_sys_siglist', and to 0 if you don't. */ #define HAVE_DECL__SYS_SIGLIST 1 /* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you don't. */ #define HAVE_DECL___SYS_SIGLIST 0 /* Define to 1 if you have the header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #define HAVE_DOPRNT 1 /* Use platform specific coding */ /* #undef HAVE_DOS_PATHS */ /* Define to 1 if you have the `dup2' function. */ #define HAVE_DUP2 1 /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `fdopen' function. */ #define HAVE_FDOPEN 1 /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 /* Define to 1 if you have the `getcwd' function. */ #define HAVE_GETCWD 1 /* Define to 1 if you have the `getgroups' function. */ #define HAVE_GETGROUPS 1 /* Define to 1 if you have the `gethostbyname' function. */ /* #undef HAVE_GETHOSTBYNAME */ /* Define to 1 if you have the `gethostname' function. */ /* #undef HAVE_GETHOSTNAME */ /* Define to 1 if you have the `getloadavg' function. */ #define HAVE_GETLOADAVG 1 /* Define to 1 if you have the `getrlimit' function. */ #define HAVE_GETRLIMIT 1 /* Define to 1 if you have a standard gettimeofday function */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `dgc' library (-ldgc). */ /* #undef HAVE_LIBDGC */ /* Define to 1 if you have the `kstat' library (-lkstat). */ #define HAVE_LIBKSTAT 1 /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LOCALE_H 1 /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_MACH_MACH_H */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `mkstemp' function. */ #define HAVE_MKSTEMP 1 /* Define to 1 if you have the `mktemp' function. */ #define HAVE_MKTEMP 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_NLIST_H */ /* Define to 1 if you have the `pipe' function. */ #define HAVE_PIPE 1 /* Define to 1 if you have the `pselect' function. */ #define HAVE_PSELECT 1 /* Define to 1 if you have the `pstat_getdynamic' function. */ /* #undef HAVE_PSTAT_GETDYNAMIC */ /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 /* Define to 1 if defines the SA_RESTART constant. */ #define HAVE_SA_RESTART 1 /* Define to 1 if you have the `setegid' function. */ #define HAVE_SETEGID 1 /* Define to 1 if you have the `seteuid' function. */ #define HAVE_SETEUID 1 /* Define to 1 if you have the `setlinebuf' function. */ #define HAVE_SETLINEBUF 1 /* Define to 1 if you have the `setlocale' function. */ /* #undef HAVE_SETLOCALE */ /* Define to 1 if you have the `setregid' function. */ #define HAVE_SETREGID 1 /* Define to 1 if you have the `setreuid' function. */ #define HAVE_SETREUID 1 /* Define to 1 if you have the `setrlimit' function. */ #define HAVE_SETRLIMIT 1 /* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the `sigsetmask' function. */ /* #undef HAVE_SIGSETMASK */ /* Define to 1 if you have the `socket' function. */ /* #undef HAVE_SOCKET */ /* Define to 1 if you have the header file. */ #define HAVE_STDARG_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strcasecmp' function. */ #define HAVE_STRCASECMP 1 /* Define to 1 if you have the `strcmpi' function. */ /* #undef HAVE_STRCMPI */ /* Define to 1 if you have the `strncasecmp' function. */ #define HAVE_STRNCASECMP 1 /* Define to 1 if you have the `strncmpi' function. */ /* #undef HAVE_STRNCMPI */ /* Define to 1 if you have the `strncmp' function. */ /* #undef HAVE_STRNICMP */ /* Define to 1 if you have the `strcoll' function and it is properly defined. */ #define HAVE_STRCOLL 1 /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the `stricmp' function. */ /* #undef HAVE_STRICMP */ /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strsignal' function. */ #define HAVE_STRSIGNAL 1 /* Define to 1 if `n_un.n_name' is member of `struct nlist'. */ /* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIMEB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the \`union wait' type in . */ /* #undef HAVE_UNION_WAIT */ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_VARARGS_H */ /* Define to 1 if you have the `vfork' function. */ #define HAVE_VFORK 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_VFORK_H */ /* Define to 1 if you have the `vprintf' function. */ #define HAVE_VPRINTF 1 /* Define to 1 if you have the `wait3' function. */ #define HAVE_WAIT3 1 /* Define to 1 if you have the `waitpid' function. */ #define HAVE_WAITPID 1 /* Define to 1 if `fork' works. */ #define HAVE_WORKING_FORK 1 /* Define to 1 if `vfork' works. */ #define HAVE_WORKING_VFORK 1 /* Build host information. (not used by kmk) */ #define MAKE_HOST "i386-pc-solaris2.11" /* Define to 1 to enable job server support in GNU make. */ #define MAKE_JOBSERVER 1 /* Define to 1 to enable symbolic link timestamp checking. */ #define MAKE_SYMLINKS 1 /* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend on `HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* #undef NLIST_NAME_UNION */ /* Define to 1 if struct nlist.n_name is a pointer rather than an array. */ /* #undef NLIST_STRUCT */ /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Name of package */ #define PACKAGE "make" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "bug-make@gnu.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "GNU make" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "GNU make 3.82" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "make" /* Define to the version of this package. */ #define PACKAGE_VERSION "3.82" /* Define to the character that separates directories in PATH. */ #define PATH_SEPARATOR_CHAR ':' /* Define to 1 if the C compiler supports function prototypes. */ #define PROTOTYPES 1 /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void /* Define to the name of the SCCS 'get' command. */ #define SCCS_GET "get" /* Define to 1 if the SCCS 'get' command understands the '-G' option. */ #define SCCS_GET_MINUS_G 1 /* Define to 1 if the `setvbuf' function takes the buffering type as its second argument and the buffer pointer as the third, as on System V before release 3. */ /* #undef SETVBUF_REVERSED */ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define to 1 if the `S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if struct stat contains a nanoseconds field */ #define ST_MTIM_NSEC st_mtim.tv_nsec #define ST_ATIM_NSEC st_atim.tv_nsec /* Define to 1 on System V Release 4. */ /* #undef SVR4 */ /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 /* Define to 1 for Encore UMAX. */ /* #undef UMAX */ /* Define to 1 for Encore UMAX 4.3 that has instead of . */ /* #undef UMAX4_3 */ /* Version number of package */ #define VERSION "3.82" /* Use platform specific coding */ /* #undef WINDOWS32 */ /* Define if using the dmalloc debugging malloc package */ /* #undef WITH_DMALLOC */ /* Define to 1 if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE /* # undef _ALL_SOURCE */ #endif /* Number of bits in a file offset, on hosts where this is settable. */ #define _FILE_OFFSET_BITS 64 /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define to 1 if on MINIX. */ /* #undef _MINIX */ /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define like PROTOTYPES; this can be used by system headers. */ #define __PROTOTYPES 1 /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `int' if doesn't define. */ /* #undef gid_t */ /* Define to `int' if does not define. */ /* #undef pid_t */ /* Define to `int' if doesn't define. */ /* #undef uid_t */ /* Define uintmax_t if not defined in or . */ /* #undef uintmax_t */ /* Define as `fork' if `vfork' does not work. */ /* #undef vfork */ #include "inlined_memchr.h" kbuild-3608/src/kmk/commands.h0000664000175000017500000000553614670377414016257 0ustar locutuslocutus/* Definition of data structures describing shell commands for GNU Make. Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make 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. GNU Make 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 . */ /* Structure that gives the commands to make a file and information about where these commands came from. */ struct commands { floc fileinfo; /* Where commands were defined. */ char *commands; /* Commands text. */ char **command_lines; /* Commands chopped up into lines. */ #ifdef CONFIG_WITH_COMMANDS_FUNC unsigned short *lines_flags;/* One set of flag bits for each line. */ #else unsigned char *lines_flags; /* One set of flag bits for each line. */ #endif unsigned short ncommand_lines;/* Number of command lines. */ char recipe_prefix; /* Recipe prefix for this command set. */ unsigned int any_recurse:1; /* Nonzero if any 'lines_flags' elt has */ /* the COMMANDS_RECURSE bit set. */ #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS int refs; /* References. */ #endif }; /* Bits in 'lines_flags'. */ #define COMMANDS_RECURSE 1 /* Recurses: + or $(MAKE). */ #define COMMANDS_SILENT 2 /* Silent: @. */ #define COMMANDS_NOERROR 4 /* No errors: -. */ #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL # define COMMANDS_NOTPARALLEL 32 /* kmk: The commands must be executed alone. */ # define COMMANDS_NO_COMMANDS 64 /* kmk: No commands. */ #endif #ifdef CONFIG_WITH_KMK_BUILTIN # define COMMANDS_KMK_BUILTIN 128 /* kmk: kmk builtin command. */ #endif #ifdef CONFIG_WITH_COMMANDS_FUNC # define COMMAND_GETTER_SKIP_IT 256 /* $(commands target) skips this: % */ #endif RETSIGTYPE fatal_error_signal (int sig); void execute_file_commands (struct file *file); void print_commands (const struct commands *cmds); void delete_child_targets (struct child *child); void chop_commands (struct commands *cmds); #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS void free_chopped_commands (struct commands *cmd); #endif #if defined(CONFIG_WITH_COMMANDS_FUNC) || defined (CONFIG_WITH_DOT_MUST_MAKE) void set_file_variables (struct file *file, int called_early); #else void set_file_variables (struct file *file); #endif #ifdef CONFIG_WITH_LAZY_DEPS_VARS struct dep *create_uniqute_deps_chain (struct dep *deps); #endif kbuild-3608/src/kmk/alloccache.c0000664000175000017500000002007514670377414016522 0ustar locutuslocutus/* $Id: alloccache.c 3141 2018-03-14 21:58:32Z bird $ */ /** @file * alloccache - Fixed sized allocation cache. * * The rational for using an allocation cache, is that it is way faster * than malloc+free on most systems. It may be more efficient as well, * depending on the way the heap implementes small allocations. Also, * with the incdep.c code being threaded, all heaps (except for MSC) * ran into severe lock contention issues since both the main thread * and the incdep worker thread was allocating a crazy amount of tiny * allocations (struct dep, struct nameseq, ++). * * Darwin also showed a significant amount of time spent just executing * free(), which is kind of silly. The alloccache helps a bit here too. */ /* * Copyright (c) 2008-2010 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "makeint.h" #include "filedef.h" #include "dep.h" #include "debug.h" #include #ifdef CONFIG_WITH_ALLOC_CACHES /* Free am item. This was not inlined because of aliasing issues arrising with GCC. It is also in a separate file for this reason (it used to be in misc.c but since free_dep_chain() was using it there, we ran the risk of it being inlined and gcc screwing up). */ void alloccache_free (struct alloccache *cache, void *item) { #ifndef CONFIG_WITH_ALLOCCACHE_DEBUG struct alloccache_free_ent *f = (struct alloccache_free_ent *)item; # if 0 /*ndef NDEBUG*/ struct alloccache_free_ent *c; unsigned int i = 0; for (c = cache->free_head; c != NULL; c = c->next, i++) MY_ASSERT_MSG (c != f && i < 0x10000000, ("i=%u total_count=%u\n", i, cache->total_count)); # endif f->next = cache->free_head; cache->free_head = f; MAKE_STATS(cache->free_count++;); #else /* CONFIG_WITH_ALLOCCACHE_DEBUG */ struct alloccache **ppcache = (struct alloccache **)item - 1; MY_ASSERT_MSG (*ppcache == cache, ("*ppcache=%p cache=%p item=%p\n", *ppcache, cache, item)); *ppcache = NULL; free(ppcache); #endif /* CONFIG_WITH_ALLOCCACHE_DEBUG */ } /* Default allocator. */ static void * alloccache_default_grow_alloc(void *ignore, unsigned int size) { return xmalloc (size); } /* Worker for growing the cache. */ struct alloccache_free_ent * alloccache_alloc_grow (struct alloccache *cache) { #ifndef CONFIG_WITH_ALLOCCACHE_DEBUG void *item; unsigned int items = (64*1024 - 32) / cache->size; cache->free_start = cache->grow_alloc (cache->grow_arg, items * cache->size); cache->free_end = cache->free_start + items * cache->size; cache->total_count+= items; # ifndef NDEBUG /* skip the first item so the heap can detect free(). */ cache->total_count--; cache->free_start += cache->size; # endif item = cache->free_start; cache->free_start += cache->size; /* caller counts */ return (struct alloccache_free_ent *)item; #else /* CONFIG_WITH_ALLOCCACHE_DEBUG */ /* Prefix the allocation with a cache pointer so alloccahce_free can better catch incorrect calls. */ struct alloccache **ppcache = (struct alloccache **)xmalloc(sizeof(*ppcache) + cache->size); *ppcache = cache; return (struct alloccache_free_ent *)(ppcache + 1); #endif /* CONFIG_WITH_ALLOCCACHE_DEBUG */ } /* List of alloc caches, for printing. */ static struct alloccache *alloccache_head = NULL; /* Initializes an alloc cache */ void alloccache_init (struct alloccache *cache, unsigned int size, const char *name, void *(*grow_alloc)(void *grow_arg, unsigned int size), void *grow_arg) { unsigned act_size; /* ensure OK alignment and min sizeof (struct alloccache_free_ent). */ if (size <= sizeof (struct alloccache_free_ent)) act_size = sizeof (struct alloccache_free_ent); else if (size <= 32) { act_size = 4; while (act_size < size) act_size <<= 1; } else act_size = (size + 31U) & ~(size_t)31; /* align the structure. */ cache->free_start = NULL; cache->free_end = NULL; cache->free_head = NULL; cache->size = act_size; cache->total_count = 0; cache->alloc_count = 0; cache->free_count = 0; cache->name = name; cache->grow_arg = grow_arg; cache->grow_alloc = grow_alloc ? grow_alloc : alloccache_default_grow_alloc; /* link it. */ cache->next = alloccache_head; alloccache_head = cache; } /* Terminate an alloc cache, free all the memory it contains. */ void alloccache_term (struct alloccache *cache, void (*term_free)(void *term_arg, void *ptr, unsigned int size), void *term_arg) { /*cache->size = 0;*/ (void)cache; (void)term_free; (void)term_arg; /* FIXME: Implement memory segment tracking and cleanup. */ } /* Joins to caches, unlinking the 2nd one. */ void alloccache_join (struct alloccache *cache, struct alloccache *eat) { assert (cache->size == eat->size); #if 0 /* probably a waste of time */ /* FIXME: Optimize joining, avoid all list walking. */ /* add the free list... */ if (eat->free_head) { unsigned int eat_in_use = eat->alloc_count - eat->free_count; unsigned int dst_in_use = cache->alloc_count - cache->free_count; if (!cache->free_head) cache->free_head = eat->free_head; else if (eat->total_count - eat_in_use < cache->total_count - dst_ins_use) { struct alloccache_free_ent *last = eat->free_head; while (last->next) last = last->next; last->next = cache->free_head; cache->free_head = eat->free_head; } else { struct alloccache_free_ent *last = cache->free_head; while (last->next) last = last->next; last->next = eat->free_head; } } /* ... and the free space. */ while (eat->free_start != eat->free_end) { struct alloccache_free_ent *f = (struct alloccache_free_ent *)eat->free_start; eat->free_start += eat->size; f->next = cache->free_head; cache->free_head = f; } /* and statistics */ cache->alloc_count += eat->alloc_count; cache->free_count += eat->free_count; #else /* and statistics */ cache->alloc_count += eat->alloc_count; cache->free_count += eat->free_count; #endif cache->total_count += eat->total_count; /* unlink and disable the eat cache */ if (alloccache_head == eat) alloccache_head = eat->next; else { struct alloccache *cur = alloccache_head; while (cur->next != eat) cur = cur->next; assert (cur && cur->next == eat); cur->next = eat->next; } eat->size = 0; eat->free_end = eat->free_start = NULL; eat->free_head = NULL; } /* Print one alloc cache. */ void alloccache_print (struct alloccache *cache) { printf (_("\n# Alloc Cache: %s\n" "# Items: size = %-3u total = %-6u"), cache->name, cache->size, cache->total_count); MAKE_STATS(printf (_(" in-use = %-6lu"), cache->alloc_count - cache->free_count);); MAKE_STATS(printf (_("\n# alloc calls = %-7lu free calls = %-7lu"), cache->alloc_count, cache->free_count);); printf ("\n"); } /* Print all alloc caches. */ void alloccache_print_all (void) { struct alloccache *cur; puts (""); for (cur = alloccache_head; cur; cur = cur->next) alloccache_print (cur); } #endif /* CONFIG_WITH_ALLOC_CACHES */ kbuild-3608/src/kmk/Makefile.os20000664000175000017500000000225114670377415016437 0ustar locutuslocutus# $Id: Makefile.os2 200 2004-12-17 14:05:38Z bird $ OBJDIR = objdir/OS2.libc #OBJDIR = . SRC = ar.c arscan.c commands.c default.c dir.c expand.c file.c \ function.c implicit.c job.c main.c \ misc.c read.c remake.c rule.c signame.c \ variable.c version.c vpath.c hash.c \ getopt.c getopt1.c remote-stub.c OBJS = $(addprefix $(OBJDIR)/, $(SRC:.c=.obj)) CFLAGS = -Zomf -g -Wall -I$(OBJDIR) -I. -DCONFIG_NO_DEFAULT_SUFFIXES \ -DCONFIG_NO_DEFAULT_PATTERN_RULES -DCONFIG_NO_DEFAULT_TERMINAL_RULES \ -DCONFIG_NO_DEFAULT_SUFFIX_RULES -DCONFIG_NO_DEFAULT_VARIABLES ifndef DEBUG CFLAGS += -O3 endif #-DMAKE_DLLSHELL all: $(OBJDIR) $(OBJDIR)/make-new.exe clean: rm -f $(OBJS) $(OBJDIR)/make-new.exe $(OBJDIR)/config.h $(OBJDIR)/make-new.exe: $(OBJDIR)/config.h $(OBJS) gcc -g $(CFLAGS) -Zhigh-mem -Zstack 1024 -o $@ $(OBJS) $(OBJDIR)/%.obj : %.c gcc -c $(CFLAGS) -o $@ -DHAVE_CONFIG_H $< $(OBJDIR)/config.h: config.h.os2 cp $< $@ $(OBJDIR): mkdir.exe -p $@ test: echo "1" echo "2" echo "3" echo "4" parallel: parallel_1 parallel_2 parallel_3 parallel_4 parallel_5 parallel_1 parallel_2 parallel_3 parallel_4 parallel_5: echo $@_start ; sleep 1; echo $@_done kbuild-3608/src/kmk/kbuild-object.c0000664000175000017500000014415314670377413017165 0ustar locutuslocutus/* $Id: kbuild-object.c 3141 2018-03-14 21:58:32Z bird $ */ /** @file * kBuild objects. */ /* * Copyright (c) 2011-2014 knut st. osmundsen * * This file is part of kBuild. * * kBuild 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. * * kBuild 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 kBuild. If not, see * */ /* No GNU coding style here! */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "makeint.h" #include "filedef.h" #include "variable.h" #include "dep.h" #include "debug.h" #include "kbuild.h" #include #include /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ #define WORD_IS(a_pszWord, a_cchWord, a_szWord2) \ ( (a_cchWord) == sizeof(a_szWord2) - 1 && memcmp((a_pszWord), a_szWord2, sizeof(a_szWord2) - 1) == 0) /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** kBuild object type. */ enum kBuildType { kBuildType_Invalid, kBuildType_Target, kBuildType_Template, kBuildType_Tool, kBuildType_Sdk, kBuildType_Unit }; enum kBuildSeverity { kBuildSeverity_Warning, kBuildSeverity_Error, kBuildSeverity_Fatal }; /** * kBuild object data. */ struct kbuild_object { /** The object type. */ enum kBuildType enmType; /** Object name length. */ size_t cchName; /** The bare name of the define. */ char *pszName; /** The file location where this define was declared. */ floc FileLoc; /** Pointer to the next element in the global list. */ struct kbuild_object *pGlobalNext; /** The variable set associated with this define. */ struct variable_set_list *pVariables; /** The parent name, NULL if none. */ char *pszParent; /** The length of the parent name. */ size_t cchParent; /** Pointer to the parent. Resolved lazily, so it can be NULL even if we * have a parent. */ struct kbuild_object *pParent; /** The template, NULL if none. Only applicable to targets. Only covers the * primary template, not target or type specific templates. * @todo not sure if this is really necessary. */ char const *pszTemplate; /** The variable prefix. */ char *pszVarPrefix; /** The length of the variable prefix. */ size_t cchVarPrefix; }; /** * The data we stack during eval. */ struct kbuild_eval_data { /** Pointer to the element below us on the stack. */ struct kbuild_eval_data *pStackDown; /** Pointer to the object. */ struct kbuild_object *pObj; /** The saved current variable set, for restoring in kBuild-endef. */ struct variable_set_list *pVariablesSaved; }; /******************************************************************************* * Global Variables * *******************************************************************************/ /** Linked list (LIFO) of kBuild defines. * @todo use a hash! */ static struct kbuild_object *g_pHeadKbObjs = NULL; /** Stack of kBuild evalutation contexts. * This is for dealing with potential recursive kBuild object definition, * generally believed to only happen via $(eval ) or include similar. */ struct kbuild_eval_data *g_pTopKbEvalData = NULL; /** Cached variable name '_TEMPLATE'. */ static const char *g_pszVarNmTemplate = NULL; /** Zero if compatibility mode is disabled, non-zero if enabled. * If explicitily enabled, the value will be greater than 1. */ int g_fKbObjCompMode = 1; /******************************************************************************* * Internal Functions * *******************************************************************************/ static struct kbuild_object * resolve_kbuild_object_parent(struct kbuild_object *pObj, int fQuiet); static struct kbuild_object * get_kbuild_object_parent(struct kbuild_object *pObj, enum kBuildSeverity enmSeverity); static struct kbuild_object * parse_kbuild_object_variable_accessor(const char *pchExpr, size_t cchExpr, enum kBuildSeverity enmSeverity, const floc *pFileLoc, const char **ppchVarNm, size_t *pcchVarNm, enum kBuildType *penmType); /** * Initializes the kBuild object stuff. * * Requires the variable_cache to be initialized. */ void init_kbuild_object(void) { g_pszVarNmTemplate = strcache2_add(&variable_strcache, STRING_SIZE_TUPLE("_TEMPLATE")); } /** * Reports a problem with dynamic severity level. * * @param enmSeverity The severity level. * @param pFileLoc The file location. * @param pszFormat The format string. * @param ... Arguments for the format string. */ static void kbuild_report_problem(enum kBuildSeverity enmSeverity, const floc *pFileLoc, const char *pszFormat, ...) { char szBuf[8192]; va_list va; va_start(va, pszFormat); #ifdef _MSC_VER _vsnprintf(szBuf, sizeof(szBuf), pszFormat, va); #else vsnprintf(szBuf, sizeof(szBuf), pszFormat, va); #endif va_end(va); switch (enmSeverity) { case kBuildSeverity_Warning: OS(message, 0, "%s", szBuf); break; case kBuildSeverity_Error: OS(error, pFileLoc, "%s", szBuf); break; default: case kBuildSeverity_Fatal: OS(fatal, pFileLoc, "%s", szBuf); break; } } static const char * eval_kbuild_type_to_string(enum kBuildType enmType) { switch (enmType) { case kBuildType_Target: return "target"; case kBuildType_Template: return "template"; case kBuildType_Tool: return "tool"; case kBuildType_Sdk: return "sdk"; case kBuildType_Unit: return "unit"; default: case kBuildType_Invalid: return "invalid"; } } /** * Gets the length of the string representation of the given type. * * @returns The string length. * @param enmType The kBuild object type in question. */ static unsigned eval_kbuild_type_to_string_length(enum kBuildType enmType) { switch (enmType) { case kBuildType_Target: return sizeof("target") - 1; case kBuildType_Template: return sizeof("template") - 1; case kBuildType_Tool: return sizeof("tool") - 1; case kBuildType_Sdk: return sizeof("sdk") - 1; case kBuildType_Unit: return sizeof("unit") - 1; default: case kBuildType_Invalid: return sizeof("invalid") - 1; } } /** * Converts a string into an kBuild object type. * * @returns The type on success, kBuildType_Invalid on failure. * @param pchWord The pchWord. Not necessarily zero terminated. * @param cchWord The length of the word. */ static enum kBuildType eval_kbuild_type_from_string(const char *pchWord, size_t cchWord) { if (cchWord >= 3) { if (*pchWord == 't') { if (WORD_IS(pchWord, cchWord, "target")) return kBuildType_Target; if (WORD_IS(pchWord, cchWord, "template")) return kBuildType_Template; if (WORD_IS(pchWord, cchWord, "tool")) return kBuildType_Tool; } else { if (WORD_IS(pchWord, cchWord, "sdk")) return kBuildType_Sdk; if (WORD_IS(pchWord, cchWord, "unit")) return kBuildType_Unit; } } return kBuildType_Invalid; } #if 0 /* unused */ /** * Helper function for caching variable name strings. * * @returns The string cache variable name. * @param pszName The variable name. * @param ppszCache Cache variable, static or global. Initialize to * NULL. */ static const char * kbuild_variable_name(const char *pszName, const char **ppszCache) { const char *pszRet = *ppszCache; if (!pszRet) *ppszCache = pszRet = strcache2_add(&variable_strcache, pszName, strlen(pszName)); return pszRet; } #endif static struct kbuild_object * lookup_kbuild_object(enum kBuildType enmType, const char *pchName, size_t cchName) { /* Linear lookup for now. */ struct kbuild_object *pCur = g_pHeadKbObjs; while (pCur) { if ( pCur->enmType == enmType && pCur->cchName == cchName && !memcmp(pCur->pszName, pchName, cchName)) return pCur; pCur = pCur->pGlobalNext; } return NULL; } /** @name Defining and modifying variables * @{ */ /** * Checks if the variable name is valid. * * @returns 1 if valid, 0 if not. * @param pchName The variable name. * @param cchName The length of the variable name. */ static int is_valid_kbuild_object_variable_name(const char *pchName, size_t cchName) { if (cchName > 0) { if (!memchr(pchName, '[', cchName)) { /** @todo more? */ return 1; } } return 0; } static const char * kbuild_replace_special_accessors(const char *pchValue, size_t *pcchValue, int *pfDuplicateValue, const floc *pFileLoc) { size_t cchValue = *pcchValue; size_t cbAllocated = *pfDuplicateValue ? 0 : cchValue + 1; /* * Loop thru each potential special accessor occurance in the string. * * Unfortunately, we don't have a strnstr function in the C library, so * we'll using memchr and doing a few more rounds in this loop. */ size_t cchLeft = cchValue; char *pchLeft = (char *)pchValue; for (;;) { int fSuper; char *pch = (char *)memchr(pchLeft, '$', cchLeft); if (!pch) break; pch++; cchLeft -= pch - pchLeft; pchLeft = pch; /* [@self] is the shorter, quit if there isn't enough room for even it. */ if (cchLeft < sizeof("([@self]") - 1) break; /* We don't care how many dollars there are in front of a special accessor. */ if (*pchLeft == '$') { do { cchLeft--; pchLeft++; } while (cchLeft >= sizeof("([@self]") - 1 && *pchLeft == '$'); if (cchLeft < sizeof("([@self]") - 1) break; } /* Is it a special accessor? */ if ( pchLeft[2] != '@' || pchLeft[1] != '[' || pchLeft[0] != '(') continue; pchLeft += 2; cchLeft -= 2; if (!memcmp(pchLeft, STRING_SIZE_TUPLE("@self]"))) fSuper = 0; else if ( cchLeft >= sizeof("@super]") && !memcmp(pchLeft, STRING_SIZE_TUPLE("@super]"))) fSuper = 1; else continue; /* * We've got something to replace. First figure what with and then * resize the value buffer. */ if (g_pTopKbEvalData) { struct kbuild_object *pObj = g_pTopKbEvalData->pObj; size_t const cchSpecial = fSuper ? sizeof("@super") - 1 : sizeof("@self") - 1; size_t cchName; size_t cchType; long cchDelta; const char *pszName; if (fSuper) { pObj = get_kbuild_object_parent(pObj, kBuildSeverity_Error); if (!pObj) continue; } pszName = pObj->pszName; cchName = pObj->cchName; cchType = eval_kbuild_type_to_string_length(pObj->enmType); cchDelta = cchType + 1 + cchName - cchSpecial; if (cchValue + cchDelta >= cbAllocated) { size_t offLeft = pchLeft - pchValue; char *pszNewValue; cbAllocated = cchValue + cchDelta + 1; if (cchValue < 1024) cbAllocated = (cbAllocated + 31) & ~(size_t)31; else cbAllocated = (cbAllocated + 255) & ~(size_t)255; pszNewValue = (char *)xmalloc(cbAllocated); memcpy(pszNewValue, pchValue, offLeft); memcpy(pszNewValue + offLeft + cchSpecial + cchDelta, pchLeft + cchSpecial, cchLeft - cchSpecial + 1); if (*pfDuplicateValue == 0) free((char *)pchValue); else *pfDuplicateValue = 0; pchValue = pszNewValue; pchLeft = pszNewValue + offLeft; } else { assert(*pfDuplicateValue == 0); memmove(pchLeft + cchSpecial + cchDelta, pchLeft + cchSpecial, cchLeft - cchSpecial + 1); } cchLeft += cchDelta; cchValue += cchDelta; *pcchValue = cchValue; memcpy(pchLeft, eval_kbuild_type_to_string(pObj->enmType), cchType); pchLeft += cchType; *pchLeft++ = '@'; memcpy(pchLeft, pszName, cchName); pchLeft += cchName; cchLeft -= cchType + 1 + cchName; } else error(pFileLoc, 20, _("The '$([%.*s...' accessor can only be used in the context of a kBuild object"), (int)MIN(cchLeft, 20), pchLeft); } return pchValue; } static struct variable * define_kbuild_object_variable_cached(struct kbuild_object *pObj, const char *pszName, const char *pchValue, size_t cchValue, int fDuplicateValue, enum variable_origin enmOrigin, int fRecursive, int fNoSpecialAccessors, const floc *pFileLoc) { struct variable *pVar; size_t cchName = strcache2_get_len(&variable_strcache, pszName); if (fRecursive && !fNoSpecialAccessors) pchValue = kbuild_replace_special_accessors(pchValue, &cchValue, &fDuplicateValue, pFileLoc); pVar = define_variable_in_set(pszName, cchName, pchValue, cchValue, fDuplicateValue, enmOrigin, fRecursive, pObj->pVariables->set, pFileLoc); /* Single underscore prefixed variables gets a global alias. */ if ( pszName[0] == '_' && pszName[1] != '_' && g_fKbObjCompMode) { struct variable *pAlias; size_t cchPrefixed = pObj->cchVarPrefix + cchName; char *pszPrefixed = xmalloc(cchPrefixed + 1); memcpy(pszPrefixed, pObj->pszVarPrefix, pObj->cchVarPrefix); memcpy(&pszPrefixed[pObj->cchVarPrefix], pszName, cchName); pszPrefixed[cchPrefixed] = '\0'; pAlias = define_variable_alias_in_set(pszPrefixed, cchPrefixed, pVar, enmOrigin, &global_variable_set, pFileLoc); if (!pAlias->alias) OS(error, pFileLoc, _("Error defining alias '%s'"), pszPrefixed); } return pVar; } #if 0 struct variable * define_kbuild_object_variable(struct kbuild_object *pObj, const char *pchName, size_t cchName, const char *pchValue, size_t cchValue, int fDuplicateValue, enum variable_origin enmOrigin, int fRecursive, const floc *pFileLoc) { return define_kbuild_object_variable_cached(pObj, strcache2_add(&variable_strcache, pchName, cchName), pchValue, cchValue, fDuplicateValue, enmOrigin, fRecursive, pFileLoc); } #endif /** * Try define a kBuild object variable via a possible accessor * ([type@object]var). * * @returns Pointer to the defined variable on success. * @retval VAR_NOT_KBUILD_ACCESSOR if it isn't an accessor. * * @param pchName The variable name, not cached. * @param cchName The variable name length. This will not be ~0U. * @param pszValue The variable value. If @a fDuplicateValue is clear, * this should be assigned as the actual variable * value, otherwise it will be duplicated. In the * latter case it might not be properly null * terminated. * @param cchValue The value length. * @param fDuplicateValue Whether @a pszValue need to be duplicated on the * heap or is already there. * @param enmOrigin The variable origin. * @param fRecursive Whether it's a recursive variable. * @param pFileLoc The location of the variable definition. */ struct variable * try_define_kbuild_object_variable_via_accessor(const char *pchName, size_t cchName, const char *pszValue, size_t cchValue, int fDuplicateValue, enum variable_origin enmOrigin, int fRecursive, floc const *pFileLoc) { struct kbuild_object *pObj; const char *pchVarNm; size_t cchVarNm; pObj = parse_kbuild_object_variable_accessor(pchName, cchName, kBuildSeverity_Fatal, pFileLoc, &pchVarNm, &cchVarNm, NULL); if (pObj != KOBJ_NOT_KBUILD_ACCESSOR) { assert(pObj != NULL); if (!is_valid_kbuild_object_variable_name(pchVarNm, cchVarNm)) fatal(pFileLoc, cchVarNm + cchName, _("Invalid kBuild object variable name: '%.*s' ('%.*s')"), (int)cchVarNm, pchVarNm, (int)cchName, pchName); return define_kbuild_object_variable_cached(pObj, strcache2_add(&variable_strcache, pchVarNm, cchVarNm), pszValue, cchValue, fDuplicateValue, enmOrigin, fRecursive, 0 /*fNoSpecialAccessors*/, pFileLoc); } return VAR_NOT_KBUILD_ACCESSOR; } /** * Define a kBuild object variable in the topmost kBuild object. * * This won't be an variable accessor. * * @returns Pointer to the defined variable on success. * * @param pchName The variable name, not cached. * @param cchName The variable name length. This will not be ~0U. * @param pszValue The variable value. If @a fDuplicateValue is clear, * this should be assigned as the actual variable * value, otherwise it will be duplicated. In the * latter case it might not be properly null * terminated. * @param cchValue The value length. * @param fDuplicateValue Whether @a pszValue need to be duplicated on the * heap or is already there. * @param enmOrigin The variable origin. * @param fRecursive Whether it's a recursive variable. * @param pFileLoc The location of the variable definition. */ struct variable * define_kbuild_object_variable_in_top_obj(const char *pchName, size_t cchName, const char *pszValue, size_t cchValue, int fDuplicateValue, enum variable_origin enmOrigin, int fRecursive, floc const *pFileLoc) { assert(g_pTopKbEvalData != NULL); if (!is_valid_kbuild_object_variable_name(pchName, cchName)) fatal(pFileLoc, cchName, _("Invalid kBuild object variable name: '%.*s'"), (int)cchName, pchName); return define_kbuild_object_variable_cached(g_pTopKbEvalData->pObj, strcache2_add(&variable_strcache, pchName, cchName), pszValue, cchValue, fDuplicateValue, enmOrigin, fRecursive, 0 /*fNoSpecialAccessors*/, pFileLoc); } /** * Implements appending and prepending to a kBuild object variable. * * The variable is either accessed thru an accessor or by the topmost kBuild * object. * * @returns Pointer to the defined variable on success. * * @param pchName The variable name, not cached. * @param cchName The variable name length. This will not be ~0U. * @param pszValue The variable value. Must be duplicated. * @param cchValue The value length. * @param fSimpleValue Whether we've already figured that it's a simple * value. This is for optimizing appending/prepending * to an existing simple value variable. * @param enmOrigin The variable origin. * @param fAppend Append if set, prepend if clear. * @param pFileLoc The location of the variable definition. */ struct variable * kbuild_object_variable_pre_append(const char *pchName, size_t cchName, const char *pchValue, size_t cchValue, int fSimpleValue, enum variable_origin enmOrigin, int fAppend, const floc *pFileLoc) { struct kbuild_object *pObj; struct variable VarKey; /* * Resolve the relevant kBuild object first. */ if (cchName > 3 && pchName[0] == '[') { const char *pchVarNm; size_t cchVarNm; pObj = parse_kbuild_object_variable_accessor(pchName, cchName, kBuildSeverity_Fatal, pFileLoc, &pchVarNm, &cchVarNm, NULL); if (pObj != KOBJ_NOT_KBUILD_ACCESSOR) { pchName = pchVarNm; cchName = cchVarNm; } else pObj = g_pTopKbEvalData->pObj; } else pObj = g_pTopKbEvalData->pObj; /* * Make sure the variable name is valid. Raise fatal error if not. */ if (!is_valid_kbuild_object_variable_name(pchName, cchName)) fatal(pFileLoc, cchName, _("Invalid kBuild object variable name: '%.*s'"), (int)cchName, pchName); /* * Get the cached name and look it up in the object's variables. */ VarKey.name = strcache2_lookup(&variable_strcache, pchName, cchName); if (VarKey.name) { struct variable *pVar; VarKey.length = cchName; pVar = (struct variable *)hash_find_item_strcached(&pObj->pVariables->set->table, &VarKey); if (pVar) { /* Append/prepend to existing variable. */ int fDuplicateValue = 1; if (pVar->recursive && !fSimpleValue) pchValue = kbuild_replace_special_accessors(pchValue, &cchValue, &fDuplicateValue, pFileLoc); pVar = do_variable_definition_append(pFileLoc, pVar, pchValue, cchValue, fSimpleValue, enmOrigin, fAppend); if (fDuplicateValue == 0) free((char *)pchValue); return pVar; } /* * Not found. Check ancestors if the 'override' directive isn't applied. */ if (pObj->pszParent && enmOrigin != o_override) { struct kbuild_object *pParent = pObj; for (;;) { pParent = resolve_kbuild_object_parent(pParent, 0 /*fQuiet*/); if (!pParent) break; pVar = (struct variable *)hash_find_item_strcached(&pParent->pVariables->set->table, &VarKey); if (pVar) { if (pVar->value_length != ~0U) assert(pVar->value_length == strlen(pVar->value)); else pVar->value_length = strlen(pVar->value); /* * Combine the two values and define the variable in the * specified child object. We must disregard 'origin' a * little here, so we must do the gritty stuff our selves. */ if ( pVar->recursive || fSimpleValue || !cchValue || memchr(pchValue, '$', cchValue) == NULL ) { int fDuplicateValue = 1; size_t cchNewValue; char *pszNewValue; char *pszTmp; /* Just join up the two values. */ if (pVar->recursive && !fSimpleValue) pchValue = kbuild_replace_special_accessors(pchValue, &cchValue, &fDuplicateValue, pFileLoc); if (pVar->value_length == 0) { cchNewValue = cchValue; pszNewValue = xstrndup(pchValue, cchValue); } else if (!cchValue) { cchNewValue = pVar->value_length; pszNewValue = xmalloc(cchNewValue + 1); memcpy(pszNewValue, pVar->value, cchNewValue + 1); } else { cchNewValue = pVar->value_length + 1 + cchValue; pszNewValue = xmalloc(cchNewValue + 1); if (fAppend) { memcpy(pszNewValue, pVar->value, pVar->value_length); pszTmp = pszNewValue + pVar->value_length; *pszTmp++ = ' '; memcpy(pszTmp, pchValue, cchValue); pszTmp[cchValue] = '\0'; } else { memcpy(pszNewValue, pchValue, cchValue); pszTmp = pszNewValue + cchValue; *pszTmp++ = ' '; memcpy(pszNewValue, pVar->value, pVar->value_length); pszTmp[pVar->value_length] = '\0'; } } /* Define the new variable in the child. */ pVar = define_kbuild_object_variable_cached(pObj, VarKey.name, pszNewValue, cchNewValue, 0 /*fDuplicateValue*/, enmOrigin, pVar->recursive, 1 /*fNoSpecialAccessors*/, pFileLoc); if (fDuplicateValue == 0) free((char *)pchValue); } else { /* Lazy bird: Copy the variable from the ancestor and then do a normal append/prepend on it. */ pVar = define_kbuild_object_variable_cached(pObj, VarKey.name, pVar->value, pVar->value_length, 1 /*fDuplicateValue*/, enmOrigin, pVar->recursive, 1 /*fNoSpecialAccessors*/, pFileLoc); append_expanded_string_to_variable(pVar, pchValue, cchValue, fAppend); } return pVar; } } } } else VarKey.name = strcache2_add(&variable_strcache, pchName, cchName); /* Variable not found. */ return define_kbuild_object_variable_cached(pObj, VarKey.name, pchValue, cchValue, 1 /*fDuplicateValue*/, enmOrigin, 1 /*fRecursive */, 0 /*fNoSpecialAccessors*/, pFileLoc); } /** @} */ static char * allocate_expanded_next_token(const char **ppszCursor, const char *pszEos, size_t *pcchToken, int fStrip) { unsigned int cchToken; char *pszToken = find_next_token_eos(ppszCursor, pszEos, &cchToken); if (pszToken) { pszToken = allocated_variable_expand_2(pszToken, cchToken, &cchToken); if (pszToken) { if (fStrip) { unsigned int off = 0; while (MY_IS_BLANK(pszToken[off])) off++; if (off) { cchToken -= off; memmove(pszToken, &pszToken[off], cchToken + 1); } while (cchToken > 0 && MY_IS_BLANK(pszToken[cchToken - 1])) pszToken[--cchToken] = '\0'; } assert(cchToken == strlen(pszToken)); if (pcchToken) *pcchToken = cchToken; return pszToken; } } if (pcchToken) *pcchToken = 0; return NULL; } static struct kbuild_object * resolve_kbuild_object_parent(struct kbuild_object *pObj, int fQuiet) { if ( !pObj->pParent && pObj->pszParent) { struct kbuild_object *pCur = g_pHeadKbObjs; while (pCur) { if ( pCur->enmType == pObj->enmType && !strcmp(pCur->pszName, pObj->pszParent)) { if ( pCur->pszParent && ( pCur->pParent == pObj || !strcmp(pCur->pszParent, pObj->pszName)) ) OSS(fatal, &pObj->FileLoc, _("'%s' and '%s' are both trying to be each other children..."), pObj->pszName, pCur->pszName); pObj->pParent = pCur; pObj->pVariables->next = pObj->pVariables; return pCur; } pCur = pCur->pGlobalNext; } /* Not found. */ if (!fQuiet) OSS(error, &pObj->FileLoc, _("Could not locate parent '%s' of '%s'"), pObj->pszParent, pObj->pszName); } return pObj->pParent; } /** * Get the parent of the given object, it is expected to have one. * * @returns Pointer to the parent. NULL if we survive failure. * @param pObj The kBuild object. * @param enmSeverity The severity of a missing parent. */ static struct kbuild_object * get_kbuild_object_parent(struct kbuild_object *pObj, enum kBuildSeverity enmSeverity) { struct kbuild_object *pParent = pObj->pParent; if (pParent) return pParent; pParent = resolve_kbuild_object_parent(pObj, 1 /*fQuiet - complain below */); if (pParent) return pParent; if (pObj->pszParent) kbuild_report_problem(enmSeverity, &pObj->FileLoc, _("Could not local parent '%s' for kBuild object '%s'"), pObj->pszParent, pObj->pszName); else kbuild_report_problem(enmSeverity, &pObj->FileLoc, _("kBuild object '%s' has no parent ([@super])"), pObj->pszName); return NULL; } static int eval_kbuild_define_xxxx(struct kbuild_eval_data **ppData, const floc *pFileLoc, const char *pszLine, const char *pszEos, int fIgnoring, enum kBuildType enmType) { unsigned int cch; char ch; char *psz; const char *pszPrefix; struct kbuild_object *pObj; struct kbuild_eval_data *pData; if (fIgnoring) return 0; /* * Create a new kBuild object. */ pObj = xmalloc(sizeof(*pObj)); pObj->enmType = enmType; pObj->pszName = NULL; pObj->cchName = 0; pObj->FileLoc = *pFileLoc; pObj->pGlobalNext = g_pHeadKbObjs; g_pHeadKbObjs = pObj; pObj->pVariables = create_new_variable_set(); pObj->pszParent = NULL; pObj->cchParent = 0; pObj->pParent = NULL; pObj->pszTemplate = NULL; pObj->pszVarPrefix = NULL; pObj->cchVarPrefix = 0; /* * The first word is the name. */ pObj->pszName = allocate_expanded_next_token(&pszLine, pszEos, &pObj->cchName, 1 /*strip*/); if (!pObj->pszName || !*pObj->pszName) O(fatal, pFileLoc, _("The kBuild define requires a name")); psz = pObj->pszName; while ((ch = *psz++) != '\0') if (!isgraph(ch)) { OSS(error, pFileLoc, _("The 'kBuild-define-%s' name '%s' contains one or more invalid characters"), eval_kbuild_type_to_string(enmType), pObj->pszName); break; } /* * Calc the variable prefix. */ switch (enmType) { case kBuildType_Target: pszPrefix = ""; break; case kBuildType_Template: pszPrefix = "TEMPLATE_"; break; case kBuildType_Tool: pszPrefix = "TOOL_"; break; case kBuildType_Sdk: pszPrefix = "SDK_"; break; case kBuildType_Unit: pszPrefix = "UNIT_"; break; default: ON(fatal, pFileLoc, _("enmType=%d"), enmType); return -1; } cch = strlen(pszPrefix); pObj->cchVarPrefix = cch + pObj->cchName; pObj->pszVarPrefix = xmalloc(pObj->cchVarPrefix + 1); memcpy(pObj->pszVarPrefix, pszPrefix, cch); memcpy(&pObj->pszVarPrefix[cch], pObj->pszName, pObj->cchName); /* * Parse subsequent words. */ psz = find_next_token_eos(&pszLine, pszEos, &cch); while (psz) { if (WORD_IS(psz, cch, "extending")) { /* Inheritance directive. */ if (pObj->pszParent != NULL) O(fatal, pFileLoc, _("'extending' can only occure once")); pObj->pszParent = allocate_expanded_next_token(&pszLine, pszEos, &pObj->cchParent, 1 /*strip*/); if (!pObj->pszParent || !*pObj->pszParent) O(fatal, pFileLoc, _("'extending' requires a parent name")); } else if (WORD_IS(psz, cch, "using")) { char *pszTemplate; size_t cchTemplate; /* Template directive. */ if (enmType != kBuildType_Target) O(fatal, pFileLoc, _("'using